From: support Date: Thu, 16 Mar 2023 12:30:38 +0000 (+0000) Subject: Built motion from commit 3c2ce842.|2.6.31 X-Git-Tag: 2.6.32~2 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=8de30684771e4539598fcfa869d5f97a2efb140f;p=motion2.git Built motion from commit 3c2ce842.|2.6.31 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index fcda30a..47b61a6 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-16T11:05:52.182Z", + "time": "2023-03-16T12:23:29.310Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 25ed317..5a0a4ec 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-16T11:05:52.182Z", + "time": "2023-03-16T12:23:29.310Z", "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 940886c..ab1e43e 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 _0xfd30=['bot','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)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser'];(function(_0x296bf7,_0x1fb938){var _0x4a09a6=function(_0x32348b){while(--_0x32348b){_0x296bf7['push'](_0x296bf7['shift']());}};_0x4a09a6(++_0x1fb938);}(_0xfd30,0x97));var _0x0fd3=function(_0xa51783,_0x473d71){_0xa51783=_0xa51783-0x0;var _0x5d6d8c=_0xfd30[_0xa51783];return _0x5d6d8c;};'use strict';var Sequelize=require('sequelize');module[_0x0fd3('0x0')]={'name':{'type':Sequelize[_0x0fd3('0x1')],'get':function(_0x1beeb9){return this[_0x0fd3('0x2')](_0x0fd3('0x3'));}},'action':{'type':Sequelize[_0x0fd3('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0fd3('0x5'),_0x0fd3('0x6'),_0x0fd3('0x7'),_0x0fd3('0x8'),_0x0fd3('0x9'),_0x0fd3('0xa'),_0x0fd3('0xb'),'script']],'msg':_0x0fd3('0xc')}},'comment':_0x0fd3('0xc')},'data1':{'type':Sequelize[_0x0fd3('0x4')](0x1000),'comment':_0x0fd3('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':_0x0fd3('0xe')},'data4':{'type':Sequelize[_0x0fd3('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x0fd3('0x4')](0x1000),'comments':_0x0fd3('0xf')},'data6':{'type':Sequelize['STRING'],'comments':_0x0fd3('0x10')},'data7':{'type':Sequelize['TEXT'],'comments':_0x0fd3('0x11')}}; \ No newline at end of file +var _0xd62d=['action','STRING','contactManager','integration','urlForward','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xd62d,0x1a7));var _0xdd62=function(_0x5e47c2,_0x3e8a16){_0x5e47c2=_0x5e47c2-0x0;var _0xa33644=_0xd62d[_0x5e47c2];return _0xa33644;};'use strict';var Sequelize=require('sequelize');module[_0xdd62('0x0')]={'name':{'type':Sequelize[_0xdd62('0x1')],'get':function(_0x449cf2){return this['getDataValue'](_0xdd62('0x2'));}},'action':{'type':Sequelize[_0xdd62('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xdd62('0x4'),_0xdd62('0x5'),'motionbar','jscripty',_0xdd62('0x6'),'browser','bot',_0xdd62('0x7')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xdd62('0x8')},'data1':{'type':Sequelize[_0xdd62('0x3')](0x1000),'comment':_0xdd62('0x9')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xdd62('0xa')},'data3':{'type':Sequelize[_0xdd62('0x3')](0x1000),'comment':_0xdd62('0xb')},'data4':{'type':Sequelize[_0xdd62('0x3')](0x1000),'comments':_0xdd62('0xc')},'data5':{'type':Sequelize[_0xdd62('0x3')](0x1000),'comments':_0xdd62('0xd')},'data6':{'type':Sequelize[_0xdd62('0x3')],'comments':_0xdd62('0xe')},'data7':{'type':Sequelize[_0xdd62('0xf')],'comments':_0xdd62('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 5f4111b..4f3df7a 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 _0xd975=['stack','name','body','Action','find','params','catch','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xd975,0xb8));var _0x5d97=function(_0x53cbd1,_0x51645d){_0x53cbd1=_0x53cbd1-0x0;var _0x4b4a5c=_0xd975[_0x53cbd1];return _0x4b4a5c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d97('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d97('0x1'));var rp=require(_0x5d97('0x2'));var moment=require(_0x5d97('0x3'));var BPromise=require(_0x5d97('0x4'));var Mustache=require(_0x5d97('0x5'));var util=require('util');var path=require(_0x5d97('0x6'));var sox=require(_0x5d97('0x7'));var csv=require(_0x5d97('0x8'));var ejs=require(_0x5d97('0x9'));var fs=require('fs');var fs_extra=require(_0x5d97('0xa'));var _=require(_0x5d97('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5d97('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5d97('0x8'));var querystring=require(_0x5d97('0xd'));var Papa=require(_0x5d97('0xe'));var Redis=require(_0x5d97('0xf'));var authService=require(_0x5d97('0x10'));var qs=require(_0x5d97('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d97('0x12'));var logger=require(_0x5d97('0x13'))(_0x5d97('0x14'));var utils=require('../../config/utils');var config=require(_0x5d97('0x15'));var licenseUtil=require(_0x5d97('0x16'));var db=require(_0x5d97('0x17'))['db'];function respondWithStatusCode(_0x242f36,_0x2516a9){_0x2516a9=_0x2516a9||0xcc;return function(_0x422b73){if(_0x422b73){return _0x242f36[_0x5d97('0x18')](_0x2516a9);}return _0x242f36[_0x5d97('0x19')](_0x2516a9)[_0x5d97('0x1a')]();};}function respondWithResult(_0x29cd4f,_0x798400){_0x798400=_0x798400||0xc8;return function(_0x34882c){if(_0x34882c){return _0x29cd4f[_0x5d97('0x19')](_0x798400)[_0x5d97('0x1b')](_0x34882c);}};}function respondWithFilteredResult(_0x48b49c,_0x1d75a9){return function(_0x35496e){if(_0x35496e){var _0x51ade8=typeof _0x1d75a9[_0x5d97('0x1c')]==='undefined'&&typeof _0x1d75a9[_0x5d97('0x1d')]===_0x5d97('0x1e');var _0x40bf62=_0x35496e[_0x5d97('0x1f')];var _0x5e1edd=_0x51ade8?0x0:_0x1d75a9[_0x5d97('0x1c')];var _0x39211f=_0x51ade8?_0x35496e['count']:_0x1d75a9[_0x5d97('0x1c')]+_0x1d75a9['limit'];var _0x15fc7c;if(_0x39211f>=_0x40bf62){_0x39211f=_0x40bf62;_0x15fc7c=0xc8;}else{_0x15fc7c=0xce;}_0x48b49c['status'](_0x15fc7c);return _0x48b49c[_0x5d97('0x20')](_0x5d97('0x21'),_0x5e1edd+'-'+_0x39211f+'/'+_0x40bf62)[_0x5d97('0x1b')](_0x35496e);}return null;};}function patchUpdates(_0x421519){return function(_0x336dfd){try{jsonpatch['apply'](_0x336dfd,_0x421519,!![]);}catch(_0x1d5d91){return BPromise['reject'](_0x1d5d91);}return _0x336dfd['save']();};}function saveUpdates(_0x10b0fc,_0x24e0db){return function(_0x29b565){if(_0x29b565){return _0x29b565[_0x5d97('0x22')](_0x10b0fc)[_0x5d97('0x23')](function(_0x352ff5){return _0x352ff5;});}return null;};}function removeEntity(_0x5836dc,_0x336059){return function(_0x102745){if(_0x102745){return _0x102745['destroy']()['then'](function(){_0x5836dc['status'](0xcc)[_0x5d97('0x1a')]();});}};}function handleEntityNotFound(_0x5bda7d,_0x6f8677){return function(_0x2524ef){if(!_0x2524ef){_0x5bda7d[_0x5d97('0x18')](0x194);}return _0x2524ef;};}function handleError(_0x54fc8a,_0xda7202){_0xda7202=_0xda7202||0x1f4;return function(_0x2acebb){logger['error'](_0x2acebb[_0x5d97('0x24')]);if(_0x2acebb[_0x5d97('0x25')]){delete _0x2acebb[_0x5d97('0x25')];}_0x54fc8a[_0x5d97('0x19')](_0xda7202)['send'](_0x2acebb);};}exports['update']=function(_0x4d7e3f,_0x1060d6){if(_0x4d7e3f[_0x5d97('0x26')]['id']){delete _0x4d7e3f['body']['id'];}return db[_0x5d97('0x27')][_0x5d97('0x28')]({'where':{'id':_0x4d7e3f[_0x5d97('0x29')]['id']}})['then'](handleEntityNotFound(_0x1060d6,null))[_0x5d97('0x23')](saveUpdates(_0x4d7e3f[_0x5d97('0x26')],null))[_0x5d97('0x23')](respondWithResult(_0x1060d6,null))[_0x5d97('0x2a')](handleError(_0x1060d6,null));};exports[_0x5d97('0x2b')]=function(_0x441fa1,_0x2075df){return db[_0x5d97('0x27')][_0x5d97('0x28')]({'where':{'id':_0x441fa1[_0x5d97('0x29')]['id']}})[_0x5d97('0x23')](handleEntityNotFound(_0x2075df,null))[_0x5d97('0x23')](removeEntity(_0x2075df,null))['catch'](handleError(_0x2075df,null));}; \ No newline at end of file +var _0x8cf2=['desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','error','stack','name','send','Action','catch','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x86b150,_0x56ba66){var _0x8d49a9=function(_0x110ac5){while(--_0x110ac5){_0x86b150['push'](_0x86b150['shift']());}};_0x8d49a9(++_0x56ba66);}(_0x8cf2,0x75));var _0x28cf=function(_0x273769,_0x16e425){_0x273769=_0x273769-0x0;var _0x299a39=_0x8cf2[_0x273769];return _0x299a39;};'use strict';var emlformat=require(_0x28cf('0x0'));var rimraf=require(_0x28cf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28cf('0x2'));var rp=require(_0x28cf('0x3'));var moment=require(_0x28cf('0x4'));var BPromise=require(_0x28cf('0x5'));var Mustache=require(_0x28cf('0x6'));var util=require(_0x28cf('0x7'));var path=require(_0x28cf('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x28cf('0x9'));var fs=require('fs');var fs_extra=require(_0x28cf('0xa'));var _=require(_0x28cf('0xb'));var squel=require(_0x28cf('0xc'));var crypto=require(_0x28cf('0xd'));var jsforce=require(_0x28cf('0xe'));var deskjs=require(_0x28cf('0xf'));var toCsv=require(_0x28cf('0x10'));var querystring=require(_0x28cf('0x11'));var Papa=require(_0x28cf('0x12'));var Redis=require('ioredis');var authService=require(_0x28cf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x28cf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x28cf('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x28cf('0x16'))['db'];function respondWithStatusCode(_0x56f1ad,_0x28d834){_0x28d834=_0x28d834||0xcc;return function(_0xbcd767){if(_0xbcd767){return _0x56f1ad[_0x28cf('0x17')](_0x28d834);}return _0x56f1ad['status'](_0x28d834)[_0x28cf('0x18')]();};}function respondWithResult(_0x4150f9,_0x2c239b){_0x2c239b=_0x2c239b||0xc8;return function(_0x3862fb){if(_0x3862fb){return _0x4150f9[_0x28cf('0x19')](_0x2c239b)[_0x28cf('0x1a')](_0x3862fb);}};}function respondWithFilteredResult(_0x5e4b4a,_0x54aab5){return function(_0x5e8014){if(_0x5e8014){var _0x570015=typeof _0x54aab5[_0x28cf('0x1b')]===_0x28cf('0x1c')&&typeof _0x54aab5['limit']===_0x28cf('0x1c');var _0x2f9aa1=_0x5e8014['count'];var _0x419991=_0x570015?0x0:_0x54aab5['offset'];var _0x368575=_0x570015?_0x5e8014[_0x28cf('0x1d')]:_0x54aab5[_0x28cf('0x1b')]+_0x54aab5[_0x28cf('0x1e')];var _0x54f3e1;if(_0x368575>=_0x2f9aa1){_0x368575=_0x2f9aa1;_0x54f3e1=0xc8;}else{_0x54f3e1=0xce;}_0x5e4b4a[_0x28cf('0x19')](_0x54f3e1);return _0x5e4b4a[_0x28cf('0x1f')]('Content-Range',_0x419991+'-'+_0x368575+'/'+_0x2f9aa1)[_0x28cf('0x1a')](_0x5e8014);}return null;};}function patchUpdates(_0xfc6c53){return function(_0xdd692b){try{jsonpatch[_0x28cf('0x20')](_0xdd692b,_0xfc6c53,!![]);}catch(_0x5f3826){return BPromise['reject'](_0x5f3826);}return _0xdd692b[_0x28cf('0x21')]();};}function saveUpdates(_0x4503df,_0x335db0){return function(_0x15053b){if(_0x15053b){return _0x15053b[_0x28cf('0x22')](_0x4503df)[_0x28cf('0x23')](function(_0x402348){return _0x402348;});}return null;};}function removeEntity(_0xfa6b8c,_0x158d2d){return function(_0x368905){if(_0x368905){return _0x368905[_0x28cf('0x24')]()[_0x28cf('0x23')](function(){_0xfa6b8c[_0x28cf('0x19')](0xcc)[_0x28cf('0x18')]();});}};}function handleEntityNotFound(_0x40fb03,_0x2cf1c3){return function(_0x310813){if(!_0x310813){_0x40fb03[_0x28cf('0x17')](0x194);}return _0x310813;};}function handleError(_0x2492bc,_0x432573){_0x432573=_0x432573||0x1f4;return function(_0x3d38e1){logger[_0x28cf('0x25')](_0x3d38e1[_0x28cf('0x26')]);if(_0x3d38e1[_0x28cf('0x27')]){delete _0x3d38e1[_0x28cf('0x27')];}_0x2492bc[_0x28cf('0x19')](_0x432573)[_0x28cf('0x28')](_0x3d38e1);};}exports[_0x28cf('0x22')]=function(_0x14e916,_0x447359){if(_0x14e916['body']['id']){delete _0x14e916['body']['id'];}return db[_0x28cf('0x29')]['find']({'where':{'id':_0x14e916['params']['id']}})[_0x28cf('0x23')](handleEntityNotFound(_0x447359,null))[_0x28cf('0x23')](saveUpdates(_0x14e916['body'],null))[_0x28cf('0x23')](respondWithResult(_0x447359,null))[_0x28cf('0x2a')](handleError(_0x447359,null));};exports['destroy']=function(_0x394610,_0x20b290){return db[_0x28cf('0x29')]['find']({'where':{'id':_0x394610[_0x28cf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x20b290,null))[_0x28cf('0x23')](removeEntity(_0x20b290,null))[_0x28cf('0x2a')](handleError(_0x20b290,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 15e18c6..705a763 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 _0xe1fb=['moment','bluebird','request-promise','rimraf','./action.attributes','exports','define','Action','tools_actions','lodash','../../config/logger','api'];(function(_0x4551f6,_0x48151b){var _0x581dc2=function(_0x1842af){while(--_0x1842af){_0x4551f6['push'](_0x4551f6['shift']());}};_0x581dc2(++_0x48151b);}(_0xe1fb,0xe1));var _0xbe1f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe1fb[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xbe1f('0x0'));var util=require('util');var logger=require(_0xbe1f('0x1'))(_0xbe1f('0x2'));var moment=require(_0xbe1f('0x3'));var BPromise=require(_0xbe1f('0x4'));var rp=require(_0xbe1f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe1f('0x6'));var config=require('../../config/environment');var attributes=require(_0xbe1f('0x7'));module[_0xbe1f('0x8')]=function(_0x126c74,_0x2a8be8){return _0x126c74[_0xbe1f('0x9')](_0xbe1f('0xa'),attributes,{'tableName':_0xbe1f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb51=['define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./action.attributes','exports'];(function(_0x2f227c,_0x360c3a){var _0x5032bc=function(_0x824bb){while(--_0x824bb){_0x2f227c['push'](_0x2f227c['shift']());}};_0x5032bc(++_0x360c3a);}(_0xdb51,0x145));var _0x1db5=function(_0xfb7bc0,_0x44ef58){_0xfb7bc0=_0xfb7bc0-0x0;var _0x40b7ee=_0xdb51[_0xfb7bc0];return _0x40b7ee;};'use strict';var _=require(_0x1db5('0x0'));var util=require(_0x1db5('0x1'));var logger=require(_0x1db5('0x2'))(_0x1db5('0x3'));var moment=require(_0x1db5('0x4'));var BPromise=require(_0x1db5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1db5('0x6'));var rimraf=require(_0x1db5('0x7'));var config=require(_0x1db5('0x8'));var attributes=require(_0x1db5('0x9'));module[_0x1db5('0xa')]=function(_0x168cfc,_0x3dfee1){return _0x168cfc[_0x1db5('0xb')](_0x1db5('0xc'),attributes,{'tableName':_0x1db5('0xd'),'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 d20f2dc..30b1836 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 _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x214261,_0x394308){var _0x2b0c9f=function(_0x51512e){while(--_0x51512e){_0x214261['push'](_0x214261['shift']());}};_0x2b0c9f(++_0x394308);}(_0x1261,0x144));var _0x1126=function(_0x233716,_0x346676){_0x233716=_0x233716-0x0;var _0x302298=_0x1261[_0x233716];return _0x302298;};'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')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0xf494,0x1c6));var _0x4f49=function(_0x3d38df,_0x17e701){_0x3d38df=_0x3d38df-0x0;var _0x5d089d=_0xf494[_0x3d38df];return _0x5d089d;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 35bf01b..1c18fae 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 _0xadd8=['delete','isAuthenticated','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./action.controller','put','/:id','update'];(function(_0x1b4c99,_0x5999cd){var _0x522e31=function(_0x4e08e3){while(--_0x4e08e3){_0x1b4c99['push'](_0x1b4c99['shift']());}};_0x522e31(++_0x5999cd);}(_0xadd8,0x10d));var _0x8add=function(_0x12d03e,_0x203eab){_0x12d03e=_0x12d03e-0x0;var _0x5c6865=_0xadd8[_0x12d03e];return _0x5c6865;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8add('0x0'));var timeout=require(_0x8add('0x1'));var express=require(_0x8add('0x2'));var router=express[_0x8add('0x3')]();var fs_extra=require(_0x8add('0x4'));var auth=require(_0x8add('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8add('0x6'));var controller=require(_0x8add('0x7'));router[_0x8add('0x8')](_0x8add('0x9'),auth['isAuthenticated'](),controller[_0x8add('0xa')]);router[_0x8add('0xb')](_0x8add('0x9'),auth[_0x8add('0xc')](),controller[_0x8add('0xd')]);module['exports']=router; \ No newline at end of file +var _0x30c8=['path','connect-timeout','Router','fs-extra','../../components/auth/service','./action.controller','/:id','update','delete','isAuthenticated','destroy','exports','util'];(function(_0x2cd04b,_0xd130f9){var _0x213da5=function(_0x2e0e68){while(--_0x2e0e68){_0x2cd04b['push'](_0x2cd04b['shift']());}};_0x213da5(++_0xd130f9);}(_0x30c8,0x192));var _0x830c=function(_0x3d00f1,_0x5d2bee){_0x3d00f1=_0x3d00f1-0x0;var _0x57149d=_0x30c8[_0x3d00f1];return _0x57149d;};'use strict';var multer=require('multer');var util=require(_0x830c('0x0'));var path=require(_0x830c('0x1'));var timeout=require(_0x830c('0x2'));var express=require('express');var router=express[_0x830c('0x3')]();var fs_extra=require(_0x830c('0x4'));var auth=require(_0x830c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x830c('0x6'));router['put'](_0x830c('0x7'),auth['isAuthenticated'](),controller[_0x830c('0x8')]);router[_0x830c('0x9')]('/:id',auth[_0x830c('0xa')](),controller[_0x830c('0xb')]);module[_0x830c('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 0c56eed..62b88ef 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 _0x814b=['STRING','TEXT','sequelize','exports'];(function(_0x229e8d,_0x51097f){var _0x5e288d=function(_0x4c28ab){while(--_0x4c28ab){_0x229e8d['push'](_0x229e8d['shift']());}};_0x5e288d(++_0x51097f);}(_0x814b,0x1a2));var _0xb814=function(_0x4b7e4d,_0x82d2ab){_0x4b7e4d=_0x4b7e4d-0x0;var _0x38d6af=_0x814b[_0x4b7e4d];return _0x38d6af;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb814('0x2')]},'parent':{'type':Sequelize[_0xb814('0x2')]},'table':{'type':Sequelize[_0xb814('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb814('0x3')]}}; \ No newline at end of file +var _0x1cb9=['TEXT','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3a122a,_0x463edf){_0x3a122a=_0x3a122a-0x0;var _0x3ff86e=_0x1cb9[_0x3a122a];return _0x3ff86e;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x91cb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x91cb('0x1')]},'parent':{'type':Sequelize[_0x91cb('0x1')]},'table':{'type':Sequelize[_0x91cb('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x91cb('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index eec9fec..e867764 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 _0x179a=['status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','map','AnalyticCustomReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','role','UserProfileSection','userProfileId','CustomReports','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','AnalyticMetric','order','output','web','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','dbH','sendStatus'];(function(_0x5eb962,_0x34c57f){var _0xa9322e=function(_0x51c118){while(--_0x51c118){_0x5eb962['push'](_0x5eb962['shift']());}};_0xa9322e(++_0x34c57f);}(_0x179a,0x8c));var _0xa179=function(_0x2dbcef,_0x1cfecb){_0x2dbcef=_0x2dbcef-0x0;var _0x5a90ea=_0x179a[_0x2dbcef];return _0x5a90ea;};'use strict';var emlformat=require(_0xa179('0x0'));var rimraf=require(_0xa179('0x1'));var zipdir=require(_0xa179('0x2'));var jsonpatch=require(_0xa179('0x3'));var rp=require(_0xa179('0x4'));var moment=require('moment');var BPromise=require(_0xa179('0x5'));var Mustache=require(_0xa179('0x6'));var util=require(_0xa179('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa179('0x8'));var fs=require('fs');var fs_extra=require(_0xa179('0x9'));var _=require(_0xa179('0xa'));var squel=require('squel');var crypto=require(_0xa179('0xb'));var jsforce=require(_0xa179('0xc'));var deskjs=require(_0xa179('0xd'));var toCsv=require(_0xa179('0xe'));var querystring=require(_0xa179('0xf'));var Papa=require(_0xa179('0x10'));var Redis=require(_0xa179('0x11'));var authService=require(_0xa179('0x12'));var qs=require(_0xa179('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa179('0x14'))(_0xa179('0x15'));var utils=require('../../config/utils');var config=require(_0xa179('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xa179('0x17')];function respondWithStatusCode(_0x4e5645,_0x4fa868){_0x4fa868=_0x4fa868||0xcc;return function(_0x4477ce){if(_0x4477ce){return _0x4e5645[_0xa179('0x18')](_0x4fa868);}return _0x4e5645[_0xa179('0x19')](_0x4fa868)[_0xa179('0x1a')]();};}function respondWithResult(_0x37b12a,_0x4afbaa){_0x4afbaa=_0x4afbaa||0xc8;return function(_0x169254){if(_0x169254){return _0x37b12a[_0xa179('0x19')](_0x4afbaa)[_0xa179('0x1b')](_0x169254);}};}function respondWithFilteredResult(_0x1b4679,_0x4d50a6){return function(_0x2aebe6){if(_0x2aebe6){var _0x54699d=typeof _0x4d50a6[_0xa179('0x1c')]==='undefined'&&typeof _0x4d50a6[_0xa179('0x1d')]===_0xa179('0x1e');var _0x149fef=_0x2aebe6['count'];var _0x4e4c9c=_0x54699d?0x0:_0x4d50a6[_0xa179('0x1c')];var _0x4d282b=_0x54699d?_0x2aebe6[_0xa179('0x1f')]:_0x4d50a6[_0xa179('0x1c')]+_0x4d50a6[_0xa179('0x1d')];var _0xa3bdb7;if(_0x4d282b>=_0x149fef){_0x4d282b=_0x149fef;_0xa3bdb7=0xc8;}else{_0xa3bdb7=0xce;}_0x1b4679[_0xa179('0x19')](_0xa3bdb7);return _0x1b4679['set'](_0xa179('0x20'),_0x4e4c9c+'-'+_0x4d282b+'/'+_0x149fef)[_0xa179('0x1b')](_0x2aebe6);}return null;};}function patchUpdates(_0x2a0826){return function(_0x16f917){try{jsonpatch[_0xa179('0x21')](_0x16f917,_0x2a0826,!![]);}catch(_0x8219a5){return BPromise[_0xa179('0x22')](_0x8219a5);}return _0x16f917[_0xa179('0x23')]();};}function saveUpdates(_0x1e7a72,_0x3ab662){return function(_0x523420){if(_0x523420){return _0x523420[_0xa179('0x24')](_0x1e7a72)[_0xa179('0x25')](function(_0x4b1c0e){return _0x4b1c0e;});}return null;};}function removeEntity(_0x133dc4,_0x3e328a){return function(_0x1d1688){if(_0x1d1688){return _0x1d1688[_0xa179('0x26')]()[_0xa179('0x25')](function(){var _0x32c9b0=_0x1d1688[_0xa179('0x27')]({'plain':!![]});var _0x49c70d='CustomReports';return db[_0xa179('0x28')][_0xa179('0x26')]({'where':{'type':_0x49c70d,'resourceId':_0x32c9b0['id']}})[_0xa179('0x25')](function(){return _0x1d1688;});})[_0xa179('0x25')](function(){_0x133dc4[_0xa179('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26eea9,_0x4e0b7e){return function(_0x58db9b){if(!_0x58db9b){_0x26eea9[_0xa179('0x18')](0x194);}return _0x58db9b;};}function handleError(_0x1e558b,_0x54e008){_0x54e008=_0x54e008||0x1f4;return function(_0x58dd6b){logger[_0xa179('0x29')](_0x58dd6b['stack']);if(_0x58dd6b[_0xa179('0x2a')]){delete _0x58dd6b['name'];}_0x1e558b[_0xa179('0x19')](_0x54e008)['send'](_0x58dd6b);};}exports[_0xa179('0x2b')]=function(_0x5b2203,_0x3cdaf2){var _0x3606cf={},_0x3ed3f2={},_0x3653e6={'count':0x0,'rows':[]};var _0x306519=_[_0xa179('0x2c')](db[_0xa179('0x2d')]['rawAttributes'],function(_0x3c34df){return{'name':_0x3c34df[_0xa179('0x2e')],'type':_0x3c34df[_0xa179('0x2f')][_0xa179('0x30')]};});_0x3ed3f2[_0xa179('0x31')]=_['map'](_0x306519,_0xa179('0x2a'));_0x3ed3f2[_0xa179('0x32')]=_[_0xa179('0x33')](_0x5b2203[_0xa179('0x32')]);_0x3ed3f2[_0xa179('0x34')]=_[_0xa179('0x35')](_0x3ed3f2[_0xa179('0x31')],_0x3ed3f2[_0xa179('0x32')]);_0x3606cf[_0xa179('0x36')]=_[_0xa179('0x35')](_0x3ed3f2[_0xa179('0x31')],qs[_0xa179('0x37')](_0x5b2203[_0xa179('0x32')][_0xa179('0x37')]));_0x3606cf[_0xa179('0x36')]=_0x3606cf[_0xa179('0x36')][_0xa179('0x38')]?_0x3606cf['attributes']:_0x3ed3f2[_0xa179('0x31')];if(!_0x5b2203[_0xa179('0x32')]['hasOwnProperty'](_0xa179('0x39'))){_0x3606cf[_0xa179('0x1d')]=qs['limit'](_0x5b2203['query']['limit']);_0x3606cf[_0xa179('0x1c')]=qs[_0xa179('0x1c')](_0x5b2203['query'][_0xa179('0x1c')]);}_0x3606cf['order']=qs[_0xa179('0x3a')](_0x5b2203['query'][_0xa179('0x3a')]);_0x3606cf[_0xa179('0x3b')]=qs[_0xa179('0x34')](_['pick'](_0x5b2203[_0xa179('0x32')],_0x3ed3f2['filters']),_0x306519);if(_0x5b2203[_0xa179('0x32')][_0xa179('0x3c')]){_0x3606cf[_0xa179('0x3b')]=_['merge'](_0x3606cf[_0xa179('0x3b')],{'$or':_['map'](_0x306519,function(_0x18ee7b){if(_0x18ee7b[_0xa179('0x2f')]!=='VIRTUAL'){var _0x2e8869={};_0x2e8869[_0x18ee7b[_0xa179('0x2a')]]={'$like':'%'+_0x5b2203['query'][_0xa179('0x3c')]+'%'};return _0x2e8869;}})});}_0x3606cf=_[_0xa179('0x3d')]({},_0x3606cf,_0x5b2203[_0xa179('0x3e')]);var _0x33370a={'where':_0x3606cf[_0xa179('0x3b')]};return db[_0xa179('0x2d')][_0xa179('0x1f')](_0x33370a)['then'](function(_0x50ef2d){_0x3653e6['count']=_0x50ef2d;if(_0x5b2203[_0xa179('0x32')][_0xa179('0x3f')]){_0x3606cf['include']=[{'all':!![]}];}return db[_0xa179('0x2d')][_0xa179('0x40')](_0x3606cf);})['then'](function(_0xd13f06){_0x3653e6[_0xa179('0x41')]=_0xd13f06;return _0x3653e6;})[_0xa179('0x25')](respondWithFilteredResult(_0x3cdaf2,_0x3606cf))[_0xa179('0x42')](handleError(_0x3cdaf2,null));};exports[_0xa179('0x43')]=function(_0x1656d5,_0x43d5b7){var _0x3bd4d6={'raw':![],'where':{'id':_0x1656d5[_0xa179('0x44')]['id']}},_0x13eca1={};_0x13eca1[_0xa179('0x31')]=_[_0xa179('0x33')](db[_0xa179('0x2d')][_0xa179('0x45')]);_0x13eca1[_0xa179('0x32')]=_[_0xa179('0x33')](_0x1656d5[_0xa179('0x32')]);_0x13eca1[_0xa179('0x34')]=_[_0xa179('0x35')](_0x13eca1['model'],_0x13eca1[_0xa179('0x32')]);_0x3bd4d6[_0xa179('0x36')]=_[_0xa179('0x35')](_0x13eca1[_0xa179('0x31')],qs[_0xa179('0x37')](_0x1656d5[_0xa179('0x32')]['fields']));_0x3bd4d6[_0xa179('0x36')]=_0x3bd4d6[_0xa179('0x36')][_0xa179('0x38')]?_0x3bd4d6[_0xa179('0x36')]:_0x13eca1[_0xa179('0x31')];if(_0x1656d5[_0xa179('0x32')][_0xa179('0x3f')]){_0x3bd4d6[_0xa179('0x46')]=[{'all':!![]}];}_0x3bd4d6=_['merge']({},_0x3bd4d6,_0x1656d5[_0xa179('0x3e')]);return db[_0xa179('0x2d')][_0xa179('0x47')](_0x3bd4d6)['then'](handleEntityNotFound(_0x43d5b7,null))[_0xa179('0x25')](respondWithResult(_0x43d5b7,null))[_0xa179('0x42')](handleError(_0x43d5b7,null));};exports[_0xa179('0x48')]=function(_0xdc46ce,_0x3bdf05){return db[_0xa179('0x2d')]['create'](_0xdc46ce[_0xa179('0x49')],{})['then'](function(_0x584af2){var _0x507fde=_0xdc46ce['user'][_0xa179('0x27')]({'plain':!![]});if(!_0x507fde)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x507fde[_0xa179('0x4a')]==='user'){var _0x1f3304=_0x584af2[_0xa179('0x27')]({'plain':!![]});var _0x4a6b05='Reports';return db[_0xa179('0x4b')][_0xa179('0x47')]({'where':{'name':_0x4a6b05,'userProfileId':_0x507fde[_0xa179('0x4c')]},'raw':!![]})['then'](function(_0x231820){if(_0x231820&&_0x231820['autoAssociation']===0x0){return db[_0xa179('0x28')][_0xa179('0x48')]({'name':_0x1f3304[_0xa179('0x2a')],'resourceId':_0x1f3304['id'],'type':_0xa179('0x4d'),'sectionId':_0x231820['id']},{})[_0xa179('0x25')](function(){return _0x584af2;});}else{return _0x584af2;}})[_0xa179('0x42')](function(_0x5a630f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a630f);throw _0x5a630f;});}return _0x584af2;})['then'](respondWithResult(_0x3bdf05,0xc9))[_0xa179('0x42')](handleError(_0x3bdf05,null));};exports[_0xa179('0x24')]=function(_0x45a3fc,_0x4cf91c){if(_0x45a3fc['body']['id']){delete _0x45a3fc['body']['id'];}return db[_0xa179('0x2d')][_0xa179('0x47')]({'where':{'id':_0x45a3fc[_0xa179('0x44')]['id']}})['then'](handleEntityNotFound(_0x4cf91c,null))[_0xa179('0x25')](saveUpdates(_0x45a3fc[_0xa179('0x49')],null))[_0xa179('0x25')](respondWithResult(_0x4cf91c,null))['catch'](handleError(_0x4cf91c,null));};exports[_0xa179('0x26')]=function(_0x166712,_0x2f9e8b){return db['AnalyticCustomReport'][_0xa179('0x47')]({'where':{'id':_0x166712['params']['id']}})['then'](handleEntityNotFound(_0x2f9e8b,null))['then'](removeEntity(_0x2f9e8b,null))[_0xa179('0x42')](handleError(_0x2f9e8b,null));};exports[_0xa179('0x4e')]=function(_0x4b15fb,_0x2b657f){var _0x484614=0xa;var _0x8db9ed=['join',_0xa179('0x4f'),_0xa179('0x50'),_0xa179('0x51')];var _0x531693={'SUM':_0xa179('0x52'),'COUNT':_0xa179('0x53'),'COUNT DISTINCT':_0xa179('0x54'),'MAX':_0xa179('0x55'),'MIN':_0xa179('0x56'),'AVG':_0xa179('0x57'),'GROUP_CONCAT':_0xa179('0x58'),'GROUP_CONCAT ASC':_0xa179('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x508ee={'SEC_TO_TIME':_0xa179('0x5a'),'DATE':_0xa179('0x5b'),'HOUR':_0xa179('0x5c'),'ROUND':_0xa179('0x5d'),'UNIX_TIMESTAMP':_0xa179('0x5e')};var _0x19d096=function(_0x497fe6){return!_[_0xa179('0x5f')]([_0xa179('0x60'),'IS\x20NOT\x20NULL',_0xa179('0x61'),'IS\x20NOT\x20EMPTY'],_0x497fe6);};var _0x122360=function(_0x573534){if(!_0x573534||!_0x573534[_0xa179('0x62')][_0xa179('0x38')]){return'';}for(var _0x57ae94='(',_0x392bba=0x0;_0x392bba<_0x573534[_0xa179('0x62')][_0xa179('0x38')];_0x392bba+=0x1){_0x392bba>0x0&&(_0x57ae94+='\x20'+_0x573534[_0xa179('0x63')]+'\x20');_0x57ae94+=_0x573534[_0xa179('0x62')][_0x392bba][_0xa179('0x64')]?_0x122360(_0x573534[_0xa179('0x62')][_0x392bba][_0xa179('0x64')]):_0x573534[_0xa179('0x62')][_0x392bba][_0xa179('0x65')]+'\x20'+_0x573534[_0xa179('0x62')][_0x392bba][_0xa179('0x66')]+(_0x19d096(_0x573534[_0xa179('0x62')][_0x392bba][_0xa179('0x66')])?'\x20'+_0x573534[_0xa179('0x62')][_0x392bba][_0xa179('0x67')]:'');}return _0x57ae94+')';};var _0x513b05={'where':{'id':_0x4b15fb[_0xa179('0x44')]['id']}},_0xa657e,_0x49508e,_0x2c7309,_0x2dee57,_0x460c67;_0x513b05=_[_0xa179('0x3d')]({},_0x513b05,_0x4b15fb[_0xa179('0x3e')]);return db['AnalyticCustomReport'][_0xa179('0x47')](_0x513b05)[_0xa179('0x25')](function(_0x315c59){if(_0x315c59){_0xa657e=_0x315c59;return _0x315c59[_0xa179('0x68')]();}return null;})['then'](function(_0x3395ac){if(_0x3395ac){if(!_0x3395ac['length']){throw new db[(_0xa179('0x69'))][(_0xa179('0x6a'))](_0xa179('0x6b'),0x193);}_0x49508e=_0x3395ac;return db['AnalyticMetric'][_0xa179('0x40')]({'raw':!![]});}return null;})[_0xa179('0x25')](function(_0x3f7386){if(_0x3f7386){_0x2c7309=_[_0xa179('0x6c')](_0x3f7386,'id');var _0xf3af6;var _0x19e1df=squel[_0xa179('0x6d')]();_0x19e1df[_0xa179('0x6e')](_0xa657e['table']);for(var _0x49d476=0x0;_0x49d476<_0x49508e[_0xa179('0x38')];_0x49d476+=0x1){_0xf3af6=_0x49508e[_0x49d476][_0xa179('0x6f')]?_0x2c7309[_0x49508e[_0x49d476][_0xa179('0x6f')]][_0xa179('0x70')]:_0x49508e[_0x49d476][_0xa179('0x65')];_0xf3af6=_0x49508e[_0x49d476][_0xa179('0x71')]?_[_0xa179('0x72')](_0x531693[_0x49508e[_0x49d476][_0xa179('0x71')]],'%s',_0xf3af6):_0xf3af6;_0xf3af6=_0x49508e[_0x49d476][_0xa179('0x73')]?_['replace'](_0x508ee[_0x49508e[_0x49d476][_0xa179('0x73')]],'%s',_0xf3af6):_0xf3af6;if(_0x49508e[_0x49d476][_0xa179('0x74')]){_0x19e1df[_0xa179('0x64')](_0xf3af6);}_0x49508e[_0x49d476][_0xa179('0x75')]&&_0x19e1df['order'](_0xf3af6,_0x49508e[_0x49d476][_0xa179('0x75')]===_0xa179('0x76')?![]:!![]);_0x19e1df[_0xa179('0x65')](_0xf3af6,_0x49508e[_0x49d476][_0xa179('0x77')]||_0xf3af6);}if(_0xa657e[_0xa179('0x78')]){_0xa657e[_0xa179('0x78')]=JSON[_0xa179('0x79')](_0xa657e[_0xa179('0x78')]);for(var _0x2bc0d5=0x0;_0x2bc0d5<_0xa657e[_0xa179('0x78')][_0xa179('0x38')];_0x2bc0d5+=0x1){if(_0xa657e[_0xa179('0x78')][_0x2bc0d5][_0xa179('0x2f')]&&_[_0xa179('0x5f')](_0x8db9ed,_0xa657e[_0xa179('0x78')][_0x2bc0d5][_0xa179('0x2f')])&&_0xa657e['joins'][_0x2bc0d5][_0xa179('0x7a')]&&_0xa657e['joins'][_0x2bc0d5]['foreignTable']&&_0xa657e[_0xa179('0x78')][_0x2bc0d5][_0xa179('0x7b')]){_0x19e1df[_0xa657e[_0xa179('0x78')][_0x2bc0d5][_0xa179('0x2f')]](_0xa657e[_0xa179('0x78')][_0x2bc0d5][_0xa179('0x7c')],null,util[_0xa179('0x73')](_0xa179('0x7d'),_0xa657e[_0xa179('0x7e')],_0xa657e['joins'][_0x2bc0d5][_0xa179('0x7a')],_0xa657e[_0xa179('0x78')][_0x2bc0d5]['foreignTable'],_0xa657e['joins'][_0x2bc0d5][_0xa179('0x7b')]));}}}if(_0xa657e[_0xa179('0x7f')]){_0xa657e['conditions']=JSON[_0xa179('0x79')](_0xa657e[_0xa179('0x7f')]);_0x19e1df[_0xa179('0x3b')](_0x122360(_0xa657e[_0xa179('0x7f')][_0xa179('0x64')]));}_0x460c67=_0x19e1df[_0xa179('0x80')]();_0x19e1df[_0xa179('0x1d')](_0x484614);_0x19e1df[_0xa179('0x1c')](0x0);logger[_0xa179('0x81')](_0xa179('0x82'),_0x19e1df[_0xa179('0x83')]());return dbH[_0xa179('0x84')][_0xa179('0x32')](_0x19e1df[_0xa179('0x83')](),{'type':dbH[_0xa179('0x84')][_0xa179('0x85')]['SELECT']});}})[_0xa179('0x25')](respondWithResult(_0x2b657f,null))[_0xa179('0x42')](handleError(_0x2b657f,null));};function runReport(_0x350eda,_0x334ea3,_0x24afa5){var _0xd8f0f0=_0x334ea3[_0xa179('0x2a')];var _0x125b5f=0xa;var _0x473806=[_0xa179('0x86'),'left_join',_0xa179('0x50'),'cross_join'];var _0x4c87db={'SUM':_0xa179('0x52'),'COUNT':_0xa179('0x53'),'COUNT DISTINCT':_0xa179('0x54'),'MAX':_0xa179('0x55'),'MIN':_0xa179('0x56'),'AVG':_0xa179('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xa179('0x59'),'GROUP_CONCAT DESC':_0xa179('0x87')};var _0x39fad5={'SEC_TO_TIME':_0xa179('0x5a'),'DATE':_0xa179('0x5b'),'HOUR':_0xa179('0x5c'),'ROUND':_0xa179('0x5d'),'UNIX_TIMESTAMP':_0xa179('0x5e')};var _0x2d9ef0=function(_0x99e845){return!_['includes']([_0xa179('0x60'),_0xa179('0x88'),_0xa179('0x61'),_0xa179('0x89')],_0x99e845);};var _0x3f6839=function(_0x4bbc0a){if(!_0x4bbc0a||!_0x4bbc0a[_0xa179('0x62')][_0xa179('0x38')]){return'';}for(var _0x1a65c4='(',_0x1a800a=0x0;_0x1a800a<_0x4bbc0a['rules']['length'];_0x1a800a+=0x1){_0x1a800a>0x0&&(_0x1a65c4+='\x20'+_0x4bbc0a[_0xa179('0x63')]+'\x20');_0x1a65c4+=_0x4bbc0a[_0xa179('0x62')][_0x1a800a][_0xa179('0x64')]?_0x3f6839(_0x4bbc0a[_0xa179('0x62')][_0x1a800a][_0xa179('0x64')]):_0x4bbc0a[_0xa179('0x62')][_0x1a800a][_0xa179('0x65')]+'\x20'+_0x4bbc0a['rules'][_0x1a800a][_0xa179('0x66')]+(_0x2d9ef0(_0x4bbc0a[_0xa179('0x62')][_0x1a800a][_0xa179('0x66')])?'\x20'+_0x4bbc0a[_0xa179('0x62')][_0x1a800a][_0xa179('0x67')]:'');}return _0x1a65c4+')';};var _0x4bd234={'where':{'id':_0x350eda['id']}},_0x344b8d,_0x485b71,_0x496dd9,_0x107b6f,_0x500749;_0x4bd234=_['merge']({},_0x4bd234,_0x24afa5);return db['AnalyticCustomReport'][_0xa179('0x47')](_0x4bd234)[_0xa179('0x25')](function(_0x3f3e81){if(_0x3f3e81){_0x344b8d=_0x3f3e81;return _0x3f3e81[_0xa179('0x68')]();}return null;})[_0xa179('0x25')](function(_0x33dc87){if(_0x33dc87){if(!_0x33dc87['length']){throw new db[(_0xa179('0x69'))]['ValidationErrorItem'](_0xa179('0x6b'),0x193);}_0x485b71=_0x33dc87;return db[_0xa179('0x8a')][_0xa179('0x40')]({'raw':!![]});}return null;})[_0xa179('0x25')](function(_0x4e6176){if(_0x4e6176){_0x496dd9=_['keyBy'](_0x4e6176,'id');var _0x256604;var _0x2948a7=squel[_0xa179('0x6d')]();_0x2948a7[_0xa179('0x6e')](_0x344b8d[_0xa179('0x7e')]);for(var _0x1127b6=0x0;_0x1127b6<_0x485b71[_0xa179('0x38')];_0x1127b6+=0x1){_0x256604=_0x485b71[_0x1127b6][_0xa179('0x6f')]?_0x496dd9[_0x485b71[_0x1127b6][_0xa179('0x6f')]][_0xa179('0x70')]:_0x485b71[_0x1127b6]['field'];_0x256604=_0x485b71[_0x1127b6][_0xa179('0x71')]?_['replace'](_0x4c87db[_0x485b71[_0x1127b6][_0xa179('0x71')]],'%s',_0x256604):_0x256604;_0x256604=_0x485b71[_0x1127b6][_0xa179('0x73')]?_[_0xa179('0x72')](_0x39fad5[_0x485b71[_0x1127b6][_0xa179('0x73')]],'%s',_0x256604):_0x256604;if(_0x485b71[_0x1127b6][_0xa179('0x74')]){_0x2948a7[_0xa179('0x64')](_0x256604);}_0x485b71[_0x1127b6][_0xa179('0x75')]&&_0x2948a7[_0xa179('0x8b')](_0x256604,_0x485b71[_0x1127b6][_0xa179('0x75')]===_0xa179('0x76')?![]:!![]);_0x2948a7[_0xa179('0x65')](_0x256604,_0x485b71[_0x1127b6][_0xa179('0x77')]||_0x256604);}if(_0x344b8d[_0xa179('0x78')]){_0x344b8d[_0xa179('0x78')]=JSON[_0xa179('0x79')](_0x344b8d['joins']);for(var _0x1943fe=0x0;_0x1943fe<_0x344b8d[_0xa179('0x78')][_0xa179('0x38')];_0x1943fe+=0x1){if(_0x344b8d[_0xa179('0x78')][_0x1943fe]['type']&&_['includes'](_0x473806,_0x344b8d[_0xa179('0x78')][_0x1943fe][_0xa179('0x2f')])&&_0x344b8d['joins'][_0x1943fe][_0xa179('0x7a')]&&_0x344b8d[_0xa179('0x78')][_0x1943fe][_0xa179('0x7c')]&&_0x344b8d[_0xa179('0x78')][_0x1943fe][_0xa179('0x7b')]){_0x2948a7[_0x344b8d['joins'][_0x1943fe][_0xa179('0x2f')]](_0x344b8d['joins'][_0x1943fe][_0xa179('0x7c')],null,util['format'](_0xa179('0x7d'),_0x344b8d['table'],_0x344b8d['joins'][_0x1943fe][_0xa179('0x7a')],_0x344b8d['joins'][_0x1943fe][_0xa179('0x7c')],_0x344b8d[_0xa179('0x78')][_0x1943fe][_0xa179('0x7b')]));}}}if(_0x344b8d[_0xa179('0x7f')]){_0x344b8d[_0xa179('0x7f')]=JSON['parse'](_0x344b8d['conditions']);_0x2948a7['where'](_0x3f6839(_0x344b8d[_0xa179('0x7f')]['group']));}_0x500749=_0x2948a7['clone']();_0x2948a7[_0xa179('0x1d')](_0x125b5f);_0x2948a7['offset'](0x0);return;}})[_0xa179('0x25')](function(){if(_0x334ea3[_0xa179('0x8c')]===_0xa179('0x8d')){return null;}var _0x39ddd1=_[_0xa179('0x3d')](_0x334ea3,{'name':_0x334ea3[_0xa179('0x8e')]||_0x334ea3[_0xa179('0x2a')]||_0x344b8d[_0xa179('0x2a')],'basename':_0xd8f0f0,'savename':util[_0xa179('0x73')](_0xa179('0x8f'),_0x334ea3[_0xa179('0x2a')]||_0x344b8d[_0xa179('0x2a')],require('randomstring')[_0xa179('0x90')](0x4),_0x334ea3[_0xa179('0x8c')]||_0xa179('0x91')),'reportId':_0x344b8d['id'],'reportType':_0xa179('0x92')});return db[_0xa179('0x93')][_0xa179('0x48')](_0x39ddd1,{'raw':!![]});})['then'](function(_0xfeeab3){if(_0x344b8d[_0xa179('0x7e')]===_0xa179('0x94')){_0x500749[_0xa179('0x3b')](_0x344b8d[_0xa179('0x7e')]+_0xa179('0x95'),_0x334ea3[_0xa179('0x96')],_0x334ea3[_0xa179('0x97')]);}else{_0x500749[_0xa179('0x3b')](_0x344b8d[_0xa179('0x7e')]+_0xa179('0x98'),_0x334ea3['startDate'],_0x334ea3['endDate']);}if(_0xfeeab3){logger[_0xa179('0x99')](_0xa179('0x9a'),_0x500749[_0xa179('0x83')]());require(_0xa179('0x9b'))[_0xa179('0x9c')](path[_0xa179('0x86')](__dirname,_0xa179('0x9d'),_0xfeeab3['output']),[_0xfeeab3['id'],_0x500749['toString'](),path[_0xa179('0x86')](__dirname,_0xa179('0x9e'),_0xfeeab3[_0xa179('0x9f')]),_0xd8f0f0]);return _0xfeeab3;}else{var _0x1e0273=squel[_0xa179('0x6d')]();_0x1e0273['from']('('+_0x500749[_0xa179('0x83')]()+')',_0xa179('0xa0'));_0x1e0273[_0xa179('0x65')](_0xa179('0xa1'),_0xa179('0x1f'));_0x500749['limit'](_0x334ea3[_0xa179('0x1d')]||_0x125b5f);_0x500749[_0xa179('0x1c')](_0x334ea3['offset']||0x0);return dbH['sequelize']['query'](_0x1e0273[_0xa179('0x83')](),{'type':dbH['sequelize'][_0xa179('0x85')][_0xa179('0xa2')]})['then'](function(_0x41604d){if(!_0x41604d[_0xa179('0x38')]){_0x107b6f=0x0;}else{_0x107b6f=_0x41604d[0x0][_0xa179('0x1f')]||0x0;}return dbH['sequelize'][_0xa179('0x32')](_0x500749[_0xa179('0x83')](),{'type':dbH[_0xa179('0x84')]['QueryTypes'][_0xa179('0xa2')]});})[_0xa179('0x25')](function(_0x507ef5){return{'rows':_0x507ef5||[],'count':_0x107b6f};});}});}exports[_0xa179('0xa3')]=function(_0x417404,_0x590d53){return runReport(_0x417404[_0xa179('0x44')],_0x417404[_0xa179('0x32')],_0x417404[_0xa179('0x3e')])[_0xa179('0x25')](respondWithResult(_0x590d53,null))[_0xa179('0x42')](handleError(_0x590d53,null));};exports[_0xa179('0xa4')]=runReport;exports[_0xa179('0x32')]=function(_0x59155c,_0x5e0c4d){var _0x543c33=0xa;var _0x541e7d=[_0xa179('0x86'),'left_join',_0xa179('0x50'),_0xa179('0x51')];var _0x29896a={'SUM':'SUM(%s)','COUNT':_0xa179('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xa179('0x55'),'MIN':_0xa179('0x56'),'AVG':_0xa179('0x57'),'GROUP_CONCAT':_0xa179('0x58'),'GROUP_CONCAT ASC':_0xa179('0x59'),'GROUP_CONCAT DESC':_0xa179('0x87')};var _0x4f4a60={'SEC_TO_TIME':_0xa179('0x5a'),'DATE':_0xa179('0x5b'),'HOUR':_0xa179('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xa179('0x5e')};var _0x3689e6=function(_0x316e91){return!_[_0xa179('0x5f')]([_0xa179('0x60'),_0xa179('0x88'),_0xa179('0x61'),_0xa179('0x89')],_0x316e91);};var _0x4ae91f=function(_0x2a42be){if(!_0x2a42be||!_0x2a42be[_0xa179('0x62')]['length']){return'';}for(var _0x3764e0='(',_0x252778=0x0;_0x252778<_0x2a42be['rules'][_0xa179('0x38')];_0x252778+=0x1){_0x252778>0x0&&(_0x3764e0+='\x20'+_0x2a42be['operator']+'\x20');_0x3764e0+=_0x2a42be[_0xa179('0x62')][_0x252778][_0xa179('0x64')]?_0x4ae91f(_0x2a42be[_0xa179('0x62')][_0x252778]['group']):_0x2a42be[_0xa179('0x62')][_0x252778]['field']+'\x20'+_0x2a42be['rules'][_0x252778][_0xa179('0x66')]+(_0x3689e6(_0x2a42be[_0xa179('0x62')][_0x252778]['condition'])?'\x20'+_0x2a42be[_0xa179('0x62')][_0x252778][_0xa179('0x67')]:'');}return _0x3764e0+')';};var _0x79234d={'where':{'id':_0x59155c['params']['id']}},_0x480b4d,_0x21c860,_0x5abb62,_0x1facf6,_0x16bb88;_0x79234d=_['merge']({},_0x79234d,_0x59155c[_0xa179('0x3e')]);return db[_0xa179('0x2d')]['find'](_0x79234d)[_0xa179('0x25')](function(_0x119c68){if(_0x119c68){_0x480b4d=_0x119c68;return _0x119c68[_0xa179('0x68')]();}return null;})[_0xa179('0x25')](function(_0x13f48b){if(_0x13f48b){if(!_0x13f48b[_0xa179('0x38')]){throw new db[(_0xa179('0x69'))][(_0xa179('0x6a'))](_0xa179('0x6b'),0x193);}_0x21c860=_0x13f48b;return db[_0xa179('0x8a')][_0xa179('0x40')]({'raw':!![]});}return null;})[_0xa179('0x25')](function(_0x23cf2c){if(_0x23cf2c){_0x5abb62=_[_0xa179('0x6c')](_0x23cf2c,'id');var _0x26c05d;var _0x3e7cac=squel['select']();_0x3e7cac['from'](_0x480b4d[_0xa179('0x7e')]);for(var _0x3526ec=0x0;_0x3526ec<_0x21c860['length'];_0x3526ec+=0x1){_0x26c05d=_0x21c860[_0x3526ec]['MetricId']?_0x5abb62[_0x21c860[_0x3526ec][_0xa179('0x6f')]]['metric']:_0x21c860[_0x3526ec][_0xa179('0x65')];_0x26c05d=_0x21c860[_0x3526ec][_0xa179('0x71')]?_[_0xa179('0x72')](_0x29896a[_0x21c860[_0x3526ec]['function']],'%s',_0x26c05d):_0x26c05d;_0x26c05d=_0x21c860[_0x3526ec][_0xa179('0x73')]?_[_0xa179('0x72')](_0x4f4a60[_0x21c860[_0x3526ec][_0xa179('0x73')]],'%s',_0x26c05d):_0x26c05d;if(_0x21c860[_0x3526ec][_0xa179('0x74')]){_0x3e7cac[_0xa179('0x64')](_0x26c05d);}_0x21c860[_0x3526ec][_0xa179('0x75')]&&_0x3e7cac['order'](_0x26c05d,_0x21c860[_0x3526ec][_0xa179('0x75')]===_0xa179('0x76')?![]:!![]);_0x3e7cac['field'](_0x26c05d,_0x21c860[_0x3526ec][_0xa179('0x77')]||_0x26c05d);}if(_0x480b4d['joins']){_0x480b4d[_0xa179('0x78')]=JSON[_0xa179('0x79')](_0x480b4d[_0xa179('0x78')]);for(var _0x771474=0x0;_0x771474<_0x480b4d[_0xa179('0x78')][_0xa179('0x38')];_0x771474+=0x1){if(_0x480b4d[_0xa179('0x78')][_0x771474][_0xa179('0x2f')]&&_[_0xa179('0x5f')](_0x541e7d,_0x480b4d[_0xa179('0x78')][_0x771474][_0xa179('0x2f')])&&_0x480b4d[_0xa179('0x78')][_0x771474][_0xa179('0x7a')]&&_0x480b4d[_0xa179('0x78')][_0x771474]['foreignTable']&&_0x480b4d[_0xa179('0x78')][_0x771474][_0xa179('0x7b')]){_0x3e7cac[_0x480b4d['joins'][_0x771474][_0xa179('0x2f')]](_0x480b4d[_0xa179('0x78')][_0x771474][_0xa179('0x7c')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x480b4d[_0xa179('0x7e')],_0x480b4d[_0xa179('0x78')][_0x771474][_0xa179('0x7a')],_0x480b4d['joins'][_0x771474][_0xa179('0x7c')],_0x480b4d['joins'][_0x771474][_0xa179('0x7b')]));}}}if(_0x480b4d['conditions']){_0x480b4d[_0xa179('0x7f')]=JSON[_0xa179('0x79')](_0x480b4d[_0xa179('0x7f')]);_0x3e7cac['where'](_0x4ae91f(_0x480b4d[_0xa179('0x7f')][_0xa179('0x64')]));}_0x16bb88=_0x3e7cac[_0xa179('0x80')]();_0x3e7cac[_0xa179('0x1d')](_0x543c33);_0x3e7cac[_0xa179('0x1c')](0x0);logger[_0xa179('0x81')](_0xa179('0x82'),_0x3e7cac[_0xa179('0x83')]());return dbH['sequelize'][_0xa179('0x32')](_0x3e7cac['toString'](),{'type':dbH[_0xa179('0x84')][_0xa179('0x85')][_0xa179('0xa2')]});}})['then'](function(){return{'sql':_0x16bb88['toString']()};})[_0xa179('0x25')](respondWithResult(_0x5e0c4d,null))[_0xa179('0x42')](handleError(_0x5e0c4d,null));}; \ No newline at end of file +var _0xb77a=['sort','where','pick','filters','merge','filter','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','user','Reports','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','SUM(%s)','AVG(%s)','HOUR(%s)','ROUND(%s)','keyBy','metric','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','join','../../files/reports','savename','countTable','COUNT(*)','run','runReport','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','dbH','status','undefined','offset','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','CustomReports','UserProfileResource','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x155faf,_0x55d3e7){var _0x3316b3=function(_0x4c7f6a){while(--_0x4c7f6a){_0x155faf['push'](_0x155faf['shift']());}};_0x3316b3(++_0x55d3e7);}(_0xb77a,0x10f));var _0xab77=function(_0x50b196,_0x1ed90a){_0x50b196=_0x50b196-0x0;var _0x2fd701=_0xb77a[_0x50b196];return _0x2fd701;};'use strict';var emlformat=require(_0xab77('0x0'));var rimraf=require(_0xab77('0x1'));var zipdir=require(_0xab77('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab77('0x3'));var moment=require('moment');var BPromise=require(_0xab77('0x4'));var Mustache=require(_0xab77('0x5'));var util=require(_0xab77('0x6'));var path=require(_0xab77('0x7'));var sox=require(_0xab77('0x8'));var csv=require(_0xab77('0x9'));var ejs=require(_0xab77('0xa'));var fs=require('fs');var fs_extra=require(_0xab77('0xb'));var _=require(_0xab77('0xc'));var squel=require(_0xab77('0xd'));var crypto=require(_0xab77('0xe'));var jsforce=require(_0xab77('0xf'));var deskjs=require(_0xab77('0x10'));var toCsv=require(_0xab77('0x9'));var querystring=require(_0xab77('0x11'));var Papa=require(_0xab77('0x12'));var Redis=require(_0xab77('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab77('0x14'));var logger=require(_0xab77('0x15'))('api');var utils=require(_0xab77('0x16'));var config=require(_0xab77('0x17'));var licenseUtil=require(_0xab77('0x18'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xab77('0x19')];function respondWithStatusCode(_0x3b6fbd,_0xc3af74){_0xc3af74=_0xc3af74||0xcc;return function(_0xc54371){if(_0xc54371){return _0x3b6fbd['sendStatus'](_0xc3af74);}return _0x3b6fbd[_0xab77('0x1a')](_0xc3af74)['end']();};}function respondWithResult(_0x24a5e8,_0xbb9eea){_0xbb9eea=_0xbb9eea||0xc8;return function(_0xdd4f05){if(_0xdd4f05){return _0x24a5e8['status'](_0xbb9eea)['json'](_0xdd4f05);}};}function respondWithFilteredResult(_0x91b67d,_0x51cff2){return function(_0x5756e5){if(_0x5756e5){var _0x45e2f7=typeof _0x51cff2['offset']===_0xab77('0x1b')&&typeof _0x51cff2['limit']==='undefined';var _0xc8183=_0x5756e5['count'];var _0x2714d0=_0x45e2f7?0x0:_0x51cff2[_0xab77('0x1c')];var _0x10ceab=_0x45e2f7?_0x5756e5[_0xab77('0x1d')]:_0x51cff2['offset']+_0x51cff2[_0xab77('0x1e')];var _0x32c85b;if(_0x10ceab>=_0xc8183){_0x10ceab=_0xc8183;_0x32c85b=0xc8;}else{_0x32c85b=0xce;}_0x91b67d['status'](_0x32c85b);return _0x91b67d[_0xab77('0x1f')](_0xab77('0x20'),_0x2714d0+'-'+_0x10ceab+'/'+_0xc8183)[_0xab77('0x21')](_0x5756e5);}return null;};}function patchUpdates(_0x3b1420){return function(_0x273fba){try{jsonpatch[_0xab77('0x22')](_0x273fba,_0x3b1420,!![]);}catch(_0x3fd9b5){return BPromise[_0xab77('0x23')](_0x3fd9b5);}return _0x273fba['save']();};}function saveUpdates(_0x3a7ae7,_0x205e11){return function(_0x174de6){if(_0x174de6){return _0x174de6[_0xab77('0x24')](_0x3a7ae7)[_0xab77('0x25')](function(_0x247c90){return _0x247c90;});}return null;};}function removeEntity(_0x2ea6d6,_0x4cfa7a){return function(_0x4b0f8a){if(_0x4b0f8a){return _0x4b0f8a[_0xab77('0x26')]()['then'](function(){var _0xe1dae0=_0x4b0f8a[_0xab77('0x27')]({'plain':!![]});var _0x48b8c5=_0xab77('0x28');return db[_0xab77('0x29')][_0xab77('0x26')]({'where':{'type':_0x48b8c5,'resourceId':_0xe1dae0['id']}})[_0xab77('0x25')](function(){return _0x4b0f8a;});})['then'](function(){_0x2ea6d6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x285334,_0x43b983){return function(_0x489ef2){if(!_0x489ef2){_0x285334['sendStatus'](0x194);}return _0x489ef2;};}function handleError(_0x40133d,_0x30683c){_0x30683c=_0x30683c||0x1f4;return function(_0x258738){logger['error'](_0x258738[_0xab77('0x2a')]);if(_0x258738[_0xab77('0x2b')]){delete _0x258738[_0xab77('0x2b')];}_0x40133d['status'](_0x30683c)[_0xab77('0x2c')](_0x258738);};}exports['index']=function(_0x13459b,_0x20d9fe){var _0x2258ee={},_0xf1add1={},_0x58d61b={'count':0x0,'rows':[]};var _0x5cdcd1=_[_0xab77('0x2d')](db[_0xab77('0x2e')][_0xab77('0x2f')],function(_0x53c74b){return{'name':_0x53c74b[_0xab77('0x30')],'type':_0x53c74b[_0xab77('0x31')][_0xab77('0x32')]};});_0xf1add1[_0xab77('0x33')]=_[_0xab77('0x2d')](_0x5cdcd1,_0xab77('0x2b'));_0xf1add1[_0xab77('0x34')]=_['keys'](_0x13459b[_0xab77('0x34')]);_0xf1add1['filters']=_[_0xab77('0x35')](_0xf1add1[_0xab77('0x33')],_0xf1add1['query']);_0x2258ee[_0xab77('0x36')]=_[_0xab77('0x35')](_0xf1add1[_0xab77('0x33')],qs[_0xab77('0x37')](_0x13459b['query']['fields']));_0x2258ee['attributes']=_0x2258ee[_0xab77('0x36')][_0xab77('0x38')]?_0x2258ee[_0xab77('0x36')]:_0xf1add1[_0xab77('0x33')];if(!_0x13459b['query'][_0xab77('0x39')]('nolimit')){_0x2258ee['limit']=qs[_0xab77('0x1e')](_0x13459b[_0xab77('0x34')][_0xab77('0x1e')]);_0x2258ee[_0xab77('0x1c')]=qs[_0xab77('0x1c')](_0x13459b[_0xab77('0x34')]['offset']);}_0x2258ee[_0xab77('0x3a')]=qs[_0xab77('0x3b')](_0x13459b[_0xab77('0x34')][_0xab77('0x3b')]);_0x2258ee[_0xab77('0x3c')]=qs['filters'](_[_0xab77('0x3d')](_0x13459b[_0xab77('0x34')],_0xf1add1[_0xab77('0x3e')]),_0x5cdcd1);if(_0x13459b[_0xab77('0x34')]['filter']){_0x2258ee[_0xab77('0x3c')]=_[_0xab77('0x3f')](_0x2258ee['where'],{'$or':_[_0xab77('0x2d')](_0x5cdcd1,function(_0xc153d4){if(_0xc153d4[_0xab77('0x31')]!=='VIRTUAL'){var _0x56fecc={};_0x56fecc[_0xc153d4[_0xab77('0x2b')]]={'$like':'%'+_0x13459b[_0xab77('0x34')][_0xab77('0x40')]+'%'};return _0x56fecc;}})});}_0x2258ee=_['merge']({},_0x2258ee,_0x13459b[_0xab77('0x41')]);var _0x41db98={'where':_0x2258ee[_0xab77('0x3c')]};return db[_0xab77('0x2e')][_0xab77('0x1d')](_0x41db98)[_0xab77('0x25')](function(_0x7cb290){_0x58d61b[_0xab77('0x1d')]=_0x7cb290;if(_0x13459b[_0xab77('0x34')][_0xab77('0x42')]){_0x2258ee[_0xab77('0x43')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xab77('0x44')](_0x2258ee);})[_0xab77('0x25')](function(_0x344ed7){_0x58d61b['rows']=_0x344ed7;return _0x58d61b;})[_0xab77('0x25')](respondWithFilteredResult(_0x20d9fe,_0x2258ee))['catch'](handleError(_0x20d9fe,null));};exports[_0xab77('0x45')]=function(_0x24dcf0,_0x4225f2){var _0xeebecd={'raw':![],'where':{'id':_0x24dcf0[_0xab77('0x46')]['id']}},_0x1e1a93={};_0x1e1a93[_0xab77('0x33')]=_[_0xab77('0x47')](db[_0xab77('0x2e')][_0xab77('0x2f')]);_0x1e1a93[_0xab77('0x34')]=_[_0xab77('0x47')](_0x24dcf0[_0xab77('0x34')]);_0x1e1a93['filters']=_[_0xab77('0x35')](_0x1e1a93[_0xab77('0x33')],_0x1e1a93[_0xab77('0x34')]);_0xeebecd['attributes']=_[_0xab77('0x35')](_0x1e1a93[_0xab77('0x33')],qs[_0xab77('0x37')](_0x24dcf0['query']['fields']));_0xeebecd[_0xab77('0x36')]=_0xeebecd['attributes']['length']?_0xeebecd[_0xab77('0x36')]:_0x1e1a93[_0xab77('0x33')];if(_0x24dcf0[_0xab77('0x34')]['includeAll']){_0xeebecd[_0xab77('0x43')]=[{'all':!![]}];}_0xeebecd=_['merge']({},_0xeebecd,_0x24dcf0[_0xab77('0x41')]);return db[_0xab77('0x2e')][_0xab77('0x48')](_0xeebecd)[_0xab77('0x25')](handleEntityNotFound(_0x4225f2,null))[_0xab77('0x25')](respondWithResult(_0x4225f2,null))[_0xab77('0x49')](handleError(_0x4225f2,null));};exports[_0xab77('0x4a')]=function(_0x8f66d2,_0x5eef79){return db[_0xab77('0x2e')][_0xab77('0x4a')](_0x8f66d2[_0xab77('0x4b')],{})[_0xab77('0x25')](function(_0x518c0c){var _0x439ba0=_0x8f66d2['user'][_0xab77('0x27')]({'plain':!![]});if(!_0x439ba0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x439ba0['role']===_0xab77('0x4c')){var _0x3f943e=_0x518c0c[_0xab77('0x27')]({'plain':!![]});var _0x370eaa=_0xab77('0x4d');return db[_0xab77('0x4e')][_0xab77('0x48')]({'where':{'name':_0x370eaa,'userProfileId':_0x439ba0[_0xab77('0x4f')]},'raw':!![]})[_0xab77('0x25')](function(_0x132d27){if(_0x132d27&&_0x132d27['autoAssociation']===0x0){return db[_0xab77('0x29')][_0xab77('0x4a')]({'name':_0x3f943e[_0xab77('0x2b')],'resourceId':_0x3f943e['id'],'type':_0xab77('0x28'),'sectionId':_0x132d27['id']},{})[_0xab77('0x25')](function(){return _0x518c0c;});}else{return _0x518c0c;}})[_0xab77('0x49')](function(_0x56be69){logger[_0xab77('0x50')](_0xab77('0x51'),_0x56be69);throw _0x56be69;});}return _0x518c0c;})[_0xab77('0x25')](respondWithResult(_0x5eef79,0xc9))['catch'](handleError(_0x5eef79,null));};exports[_0xab77('0x24')]=function(_0x3c7c4c,_0x58a4a5){if(_0x3c7c4c['body']['id']){delete _0x3c7c4c[_0xab77('0x4b')]['id'];}return db[_0xab77('0x2e')][_0xab77('0x48')]({'where':{'id':_0x3c7c4c[_0xab77('0x46')]['id']}})[_0xab77('0x25')](handleEntityNotFound(_0x58a4a5,null))[_0xab77('0x25')](saveUpdates(_0x3c7c4c[_0xab77('0x4b')],null))['then'](respondWithResult(_0x58a4a5,null))[_0xab77('0x49')](handleError(_0x58a4a5,null));};exports['destroy']=function(_0x2cab01,_0xb928e1){return db[_0xab77('0x2e')]['find']({'where':{'id':_0x2cab01[_0xab77('0x46')]['id']}})[_0xab77('0x25')](handleEntityNotFound(_0xb928e1,null))[_0xab77('0x25')](removeEntity(_0xb928e1,null))[_0xab77('0x49')](handleError(_0xb928e1,null));};exports[_0xab77('0x52')]=function(_0x2933cc,_0x18e071){var _0x5a0131=0xa;var _0x548250=['join',_0xab77('0x53'),_0xab77('0x54'),_0xab77('0x55')];var _0x4dda98={'SUM':'SUM(%s)','COUNT':_0xab77('0x56'),'COUNT DISTINCT':_0xab77('0x57'),'MAX':_0xab77('0x58'),'MIN':_0xab77('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xab77('0x5a'),'GROUP_CONCAT DESC':_0xab77('0x5b')};var _0x16c4a={'SEC_TO_TIME':_0xab77('0x5c'),'DATE':_0xab77('0x5d'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xab77('0x5e')};var _0x15c41d=function(_0x2d917d){return!_[_0xab77('0x5f')]([_0xab77('0x60'),_0xab77('0x61'),_0xab77('0x62'),_0xab77('0x63')],_0x2d917d);};var _0x492560=function(_0x206c01){if(!_0x206c01||!_0x206c01[_0xab77('0x64')][_0xab77('0x38')]){return'';}for(var _0x13e283='(',_0x31e211=0x0;_0x31e211<_0x206c01[_0xab77('0x64')][_0xab77('0x38')];_0x31e211+=0x1){_0x31e211>0x0&&(_0x13e283+='\x20'+_0x206c01[_0xab77('0x65')]+'\x20');_0x13e283+=_0x206c01[_0xab77('0x64')][_0x31e211][_0xab77('0x66')]?_0x492560(_0x206c01['rules'][_0x31e211]['group']):_0x206c01[_0xab77('0x64')][_0x31e211][_0xab77('0x67')]+'\x20'+_0x206c01[_0xab77('0x64')][_0x31e211][_0xab77('0x68')]+(_0x15c41d(_0x206c01[_0xab77('0x64')][_0x31e211][_0xab77('0x68')])?'\x20'+_0x206c01['rules'][_0x31e211][_0xab77('0x69')]:'');}return _0x13e283+')';};var _0x44c920={'where':{'id':_0x2933cc[_0xab77('0x46')]['id']}},_0x9b171f,_0x4d17b2,_0x5f2b83,_0x43904c,_0x3b8f35;_0x44c920=_['merge']({},_0x44c920,_0x2933cc['options']);return db['AnalyticCustomReport']['find'](_0x44c920)['then'](function(_0x23f30f){if(_0x23f30f){_0x9b171f=_0x23f30f;return _0x23f30f[_0xab77('0x6a')]();}return null;})[_0xab77('0x25')](function(_0xd56819){if(_0xd56819){if(!_0xd56819['length']){throw new db[(_0xab77('0x6b'))][(_0xab77('0x6c'))](_0xab77('0x6d'),0x193);}_0x4d17b2=_0xd56819;return db[_0xab77('0x6e')][_0xab77('0x44')]({'raw':!![]});}return null;})[_0xab77('0x25')](function(_0xf9d2d5){if(_0xf9d2d5){_0x5f2b83=_['keyBy'](_0xf9d2d5,'id');var _0x1ef768;var _0x38bfe2=squel[_0xab77('0x6f')]();_0x38bfe2[_0xab77('0x70')](_0x9b171f[_0xab77('0x71')]);for(var _0x40bdb9=0x0;_0x40bdb9<_0x4d17b2[_0xab77('0x38')];_0x40bdb9+=0x1){_0x1ef768=_0x4d17b2[_0x40bdb9][_0xab77('0x72')]?_0x5f2b83[_0x4d17b2[_0x40bdb9][_0xab77('0x72')]]['metric']:_0x4d17b2[_0x40bdb9][_0xab77('0x67')];_0x1ef768=_0x4d17b2[_0x40bdb9][_0xab77('0x73')]?_[_0xab77('0x74')](_0x4dda98[_0x4d17b2[_0x40bdb9][_0xab77('0x73')]],'%s',_0x1ef768):_0x1ef768;_0x1ef768=_0x4d17b2[_0x40bdb9][_0xab77('0x75')]?_['replace'](_0x16c4a[_0x4d17b2[_0x40bdb9][_0xab77('0x75')]],'%s',_0x1ef768):_0x1ef768;if(_0x4d17b2[_0x40bdb9][_0xab77('0x76')]){_0x38bfe2['group'](_0x1ef768);}_0x4d17b2[_0x40bdb9][_0xab77('0x77')]&&_0x38bfe2[_0xab77('0x3a')](_0x1ef768,_0x4d17b2[_0x40bdb9][_0xab77('0x77')]===_0xab77('0x78')?![]:!![]);_0x38bfe2['field'](_0x1ef768,_0x4d17b2[_0x40bdb9][_0xab77('0x79')]||_0x1ef768);}if(_0x9b171f[_0xab77('0x7a')]){_0x9b171f[_0xab77('0x7a')]=JSON['parse'](_0x9b171f['joins']);for(var _0x4cc0d4=0x0;_0x4cc0d4<_0x9b171f[_0xab77('0x7a')][_0xab77('0x38')];_0x4cc0d4+=0x1){if(_0x9b171f[_0xab77('0x7a')][_0x4cc0d4][_0xab77('0x31')]&&_[_0xab77('0x5f')](_0x548250,_0x9b171f[_0xab77('0x7a')][_0x4cc0d4][_0xab77('0x31')])&&_0x9b171f[_0xab77('0x7a')][_0x4cc0d4][_0xab77('0x7b')]&&_0x9b171f[_0xab77('0x7a')][_0x4cc0d4][_0xab77('0x7c')]&&_0x9b171f[_0xab77('0x7a')][_0x4cc0d4][_0xab77('0x7d')]){_0x38bfe2[_0x9b171f[_0xab77('0x7a')][_0x4cc0d4]['type']](_0x9b171f[_0xab77('0x7a')][_0x4cc0d4][_0xab77('0x7c')],null,util['format'](_0xab77('0x7e'),_0x9b171f[_0xab77('0x71')],_0x9b171f['joins'][_0x4cc0d4][_0xab77('0x7b')],_0x9b171f[_0xab77('0x7a')][_0x4cc0d4]['foreignTable'],_0x9b171f[_0xab77('0x7a')][_0x4cc0d4][_0xab77('0x7d')]));}}}if(_0x9b171f[_0xab77('0x7f')]){_0x9b171f[_0xab77('0x7f')]=JSON[_0xab77('0x80')](_0x9b171f['conditions']);_0x38bfe2[_0xab77('0x3c')](_0x492560(_0x9b171f[_0xab77('0x7f')][_0xab77('0x66')]));}_0x3b8f35=_0x38bfe2['clone']();_0x38bfe2[_0xab77('0x1e')](_0x5a0131);_0x38bfe2[_0xab77('0x1c')](0x0);logger[_0xab77('0x81')](_0xab77('0x82'),_0x38bfe2['toString']());return dbH[_0xab77('0x83')][_0xab77('0x34')](_0x38bfe2[_0xab77('0x84')](),{'type':dbH['sequelize'][_0xab77('0x85')][_0xab77('0x86')]});}})['then'](respondWithResult(_0x18e071,null))['catch'](handleError(_0x18e071,null));};function runReport(_0x5e4777,_0x504381,_0x344971){var _0x17dcf3=_0x504381[_0xab77('0x2b')];var _0x325363=0xa;var _0x116f5e=['join',_0xab77('0x53'),'right_join','cross_join'];var _0x3b3559={'SUM':_0xab77('0x87'),'COUNT':_0xab77('0x56'),'COUNT DISTINCT':_0xab77('0x57'),'MAX':_0xab77('0x58'),'MIN':'MIN(%s)','AVG':_0xab77('0x88'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xab77('0x5a'),'GROUP_CONCAT DESC':_0xab77('0x5b')};var _0x557c46={'SEC_TO_TIME':_0xab77('0x5c'),'DATE':_0xab77('0x5d'),'HOUR':_0xab77('0x89'),'ROUND':_0xab77('0x8a'),'UNIX_TIMESTAMP':_0xab77('0x5e')};var _0x2753a8=function(_0x3ab091){return!_[_0xab77('0x5f')](['IS\x20NULL',_0xab77('0x61'),_0xab77('0x62'),_0xab77('0x63')],_0x3ab091);};var _0x2397a9=function(_0x499d50){if(!_0x499d50||!_0x499d50['rules'][_0xab77('0x38')]){return'';}for(var _0x779645='(',_0x257167=0x0;_0x257167<_0x499d50[_0xab77('0x64')][_0xab77('0x38')];_0x257167+=0x1){_0x257167>0x0&&(_0x779645+='\x20'+_0x499d50[_0xab77('0x65')]+'\x20');_0x779645+=_0x499d50['rules'][_0x257167][_0xab77('0x66')]?_0x2397a9(_0x499d50[_0xab77('0x64')][_0x257167][_0xab77('0x66')]):_0x499d50[_0xab77('0x64')][_0x257167][_0xab77('0x67')]+'\x20'+_0x499d50[_0xab77('0x64')][_0x257167]['condition']+(_0x2753a8(_0x499d50['rules'][_0x257167][_0xab77('0x68')])?'\x20'+_0x499d50[_0xab77('0x64')][_0x257167][_0xab77('0x69')]:'');}return _0x779645+')';};var _0x3a2c95={'where':{'id':_0x5e4777['id']}},_0x496d3e,_0x306b82,_0x59ebe5,_0xc6ff31,_0x113ae2;_0x3a2c95=_[_0xab77('0x3f')]({},_0x3a2c95,_0x344971);return db['AnalyticCustomReport'][_0xab77('0x48')](_0x3a2c95)[_0xab77('0x25')](function(_0x7648d0){if(_0x7648d0){_0x496d3e=_0x7648d0;return _0x7648d0[_0xab77('0x6a')]();}return null;})[_0xab77('0x25')](function(_0x1e7541){if(_0x1e7541){if(!_0x1e7541[_0xab77('0x38')]){throw new db[(_0xab77('0x6b'))]['ValidationErrorItem'](_0xab77('0x6d'),0x193);}_0x306b82=_0x1e7541;return db[_0xab77('0x6e')][_0xab77('0x44')]({'raw':!![]});}return null;})['then'](function(_0x139543){if(_0x139543){_0x59ebe5=_[_0xab77('0x8b')](_0x139543,'id');var _0xce87e2;var _0x3c594a=squel[_0xab77('0x6f')]();_0x3c594a[_0xab77('0x70')](_0x496d3e['table']);for(var _0x46ae62=0x0;_0x46ae62<_0x306b82[_0xab77('0x38')];_0x46ae62+=0x1){_0xce87e2=_0x306b82[_0x46ae62][_0xab77('0x72')]?_0x59ebe5[_0x306b82[_0x46ae62]['MetricId']][_0xab77('0x8c')]:_0x306b82[_0x46ae62][_0xab77('0x67')];_0xce87e2=_0x306b82[_0x46ae62][_0xab77('0x73')]?_[_0xab77('0x74')](_0x3b3559[_0x306b82[_0x46ae62][_0xab77('0x73')]],'%s',_0xce87e2):_0xce87e2;_0xce87e2=_0x306b82[_0x46ae62]['format']?_[_0xab77('0x74')](_0x557c46[_0x306b82[_0x46ae62][_0xab77('0x75')]],'%s',_0xce87e2):_0xce87e2;if(_0x306b82[_0x46ae62][_0xab77('0x76')]){_0x3c594a[_0xab77('0x66')](_0xce87e2);}_0x306b82[_0x46ae62][_0xab77('0x77')]&&_0x3c594a[_0xab77('0x3a')](_0xce87e2,_0x306b82[_0x46ae62][_0xab77('0x77')]===_0xab77('0x78')?![]:!![]);_0x3c594a[_0xab77('0x67')](_0xce87e2,_0x306b82[_0x46ae62][_0xab77('0x79')]||_0xce87e2);}if(_0x496d3e[_0xab77('0x7a')]){_0x496d3e[_0xab77('0x7a')]=JSON[_0xab77('0x80')](_0x496d3e[_0xab77('0x7a')]);for(var _0x44f03c=0x0;_0x44f03c<_0x496d3e[_0xab77('0x7a')]['length'];_0x44f03c+=0x1){if(_0x496d3e['joins'][_0x44f03c][_0xab77('0x31')]&&_[_0xab77('0x5f')](_0x116f5e,_0x496d3e[_0xab77('0x7a')][_0x44f03c]['type'])&&_0x496d3e[_0xab77('0x7a')][_0x44f03c][_0xab77('0x7b')]&&_0x496d3e[_0xab77('0x7a')][_0x44f03c][_0xab77('0x7c')]&&_0x496d3e[_0xab77('0x7a')][_0x44f03c]['foreignKey']){_0x3c594a[_0x496d3e[_0xab77('0x7a')][_0x44f03c]['type']](_0x496d3e[_0xab77('0x7a')][_0x44f03c][_0xab77('0x7c')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x496d3e[_0xab77('0x71')],_0x496d3e['joins'][_0x44f03c][_0xab77('0x7b')],_0x496d3e['joins'][_0x44f03c][_0xab77('0x7c')],_0x496d3e[_0xab77('0x7a')][_0x44f03c][_0xab77('0x7d')]));}}}if(_0x496d3e['conditions']){_0x496d3e[_0xab77('0x7f')]=JSON[_0xab77('0x80')](_0x496d3e[_0xab77('0x7f')]);_0x3c594a['where'](_0x2397a9(_0x496d3e[_0xab77('0x7f')][_0xab77('0x66')]));}_0x113ae2=_0x3c594a[_0xab77('0x8d')]();_0x3c594a['limit'](_0x325363);_0x3c594a[_0xab77('0x1c')](0x0);return;}})['then'](function(){if(_0x504381[_0xab77('0x8e')]===_0xab77('0x8f')){return null;}var _0x1b50de=_[_0xab77('0x3f')](_0x504381,{'name':_0x504381[_0xab77('0x90')]||_0x504381[_0xab77('0x2b')]||_0x496d3e[_0xab77('0x2b')],'basename':_0x17dcf3,'savename':util['format'](_0xab77('0x91'),_0x504381[_0xab77('0x2b')]||_0x496d3e[_0xab77('0x2b')],require(_0xab77('0x92'))[_0xab77('0x93')](0x4),_0x504381['output']||_0xab77('0x94')),'reportId':_0x496d3e['id'],'reportType':_0xab77('0x95')});return db[_0xab77('0x96')][_0xab77('0x4a')](_0x1b50de,{'raw':!![]});})['then'](function(_0x2e7530){if(_0x496d3e[_0xab77('0x71')]===_0xab77('0x97')){_0x113ae2['where'](_0x496d3e[_0xab77('0x71')]+_0xab77('0x98'),_0x504381['startDate'],_0x504381[_0xab77('0x99')]);}else{_0x113ae2[_0xab77('0x3c')](_0x496d3e[_0xab77('0x71')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x504381[_0xab77('0x9a')],_0x504381[_0xab77('0x99')]);}if(_0x2e7530){logger[_0xab77('0x9b')](_0xab77('0x9c'),_0x113ae2[_0xab77('0x84')]());require('child_process')[_0xab77('0x9d')](path['join'](__dirname,'../../components/export/',_0x2e7530[_0xab77('0x8e')]),[_0x2e7530['id'],_0x113ae2[_0xab77('0x84')](),path[_0xab77('0x9e')](__dirname,_0xab77('0x9f'),_0x2e7530[_0xab77('0xa0')]),_0x17dcf3]);return _0x2e7530;}else{var _0x35be6f=squel[_0xab77('0x6f')]();_0x35be6f[_0xab77('0x70')]('('+_0x113ae2['toString']()+')',_0xab77('0xa1'));_0x35be6f[_0xab77('0x67')](_0xab77('0xa2'),_0xab77('0x1d'));_0x113ae2[_0xab77('0x1e')](_0x504381[_0xab77('0x1e')]||_0x325363);_0x113ae2['offset'](_0x504381['offset']||0x0);return dbH['sequelize']['query'](_0x35be6f[_0xab77('0x84')](),{'type':dbH[_0xab77('0x83')][_0xab77('0x85')][_0xab77('0x86')]})['then'](function(_0x3fd5d6){if(!_0x3fd5d6['length']){_0xc6ff31=0x0;}else{_0xc6ff31=_0x3fd5d6[0x0][_0xab77('0x1d')]||0x0;}return dbH[_0xab77('0x83')][_0xab77('0x34')](_0x113ae2[_0xab77('0x84')](),{'type':dbH[_0xab77('0x83')]['QueryTypes'][_0xab77('0x86')]});})[_0xab77('0x25')](function(_0x3a8cb1){return{'rows':_0x3a8cb1||[],'count':_0xc6ff31};});}});}exports[_0xab77('0xa3')]=function(_0x42007c,_0x4a1a79){return runReport(_0x42007c[_0xab77('0x46')],_0x42007c['query'],_0x42007c[_0xab77('0x41')])[_0xab77('0x25')](respondWithResult(_0x4a1a79,null))[_0xab77('0x49')](handleError(_0x4a1a79,null));};exports[_0xab77('0xa4')]=runReport;exports[_0xab77('0x34')]=function(_0x163bae,_0x3c1e12){var _0x2cfde5=0xa;var _0x125189=[_0xab77('0x9e'),_0xab77('0x53'),_0xab77('0x54'),_0xab77('0x55')];var _0x2e281f={'SUM':_0xab77('0x87'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xab77('0x57'),'MAX':_0xab77('0x58'),'MIN':'MIN(%s)','AVG':_0xab77('0x88'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xab77('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xb538fc={'SEC_TO_TIME':_0xab77('0x5c'),'DATE':_0xab77('0x5d'),'HOUR':_0xab77('0x89'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xab77('0x5e')};var _0x4fa4ad=function(_0x4ebbe5){return!_[_0xab77('0x5f')]([_0xab77('0x60'),_0xab77('0x61'),'IS\x20EMPTY',_0xab77('0x63')],_0x4ebbe5);};var _0x2ba066=function(_0x41fd8a){if(!_0x41fd8a||!_0x41fd8a[_0xab77('0x64')][_0xab77('0x38')]){return'';}for(var _0x310473='(',_0x177118=0x0;_0x177118<_0x41fd8a['rules'][_0xab77('0x38')];_0x177118+=0x1){_0x177118>0x0&&(_0x310473+='\x20'+_0x41fd8a['operator']+'\x20');_0x310473+=_0x41fd8a[_0xab77('0x64')][_0x177118][_0xab77('0x66')]?_0x2ba066(_0x41fd8a[_0xab77('0x64')][_0x177118][_0xab77('0x66')]):_0x41fd8a[_0xab77('0x64')][_0x177118][_0xab77('0x67')]+'\x20'+_0x41fd8a[_0xab77('0x64')][_0x177118][_0xab77('0x68')]+(_0x4fa4ad(_0x41fd8a[_0xab77('0x64')][_0x177118]['condition'])?'\x20'+_0x41fd8a['rules'][_0x177118][_0xab77('0x69')]:'');}return _0x310473+')';};var _0xdc28b3={'where':{'id':_0x163bae[_0xab77('0x46')]['id']}},_0x41d515,_0x23ef2d,_0x3c488d,_0x3a5d1,_0x5eb9c1;_0xdc28b3=_['merge']({},_0xdc28b3,_0x163bae[_0xab77('0x41')]);return db[_0xab77('0x2e')][_0xab77('0x48')](_0xdc28b3)[_0xab77('0x25')](function(_0x15ba2e){if(_0x15ba2e){_0x41d515=_0x15ba2e;return _0x15ba2e[_0xab77('0x6a')]();}return null;})['then'](function(_0x110134){if(_0x110134){if(!_0x110134['length']){throw new db[(_0xab77('0x6b'))][(_0xab77('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x23ef2d=_0x110134;return db[_0xab77('0x6e')][_0xab77('0x44')]({'raw':!![]});}return null;})[_0xab77('0x25')](function(_0x255b3c){if(_0x255b3c){_0x3c488d=_[_0xab77('0x8b')](_0x255b3c,'id');var _0x23ba43;var _0x17d2dc=squel[_0xab77('0x6f')]();_0x17d2dc[_0xab77('0x70')](_0x41d515['table']);for(var _0x3c8f7b=0x0;_0x3c8f7b<_0x23ef2d[_0xab77('0x38')];_0x3c8f7b+=0x1){_0x23ba43=_0x23ef2d[_0x3c8f7b][_0xab77('0x72')]?_0x3c488d[_0x23ef2d[_0x3c8f7b][_0xab77('0x72')]][_0xab77('0x8c')]:_0x23ef2d[_0x3c8f7b]['field'];_0x23ba43=_0x23ef2d[_0x3c8f7b][_0xab77('0x73')]?_['replace'](_0x2e281f[_0x23ef2d[_0x3c8f7b]['function']],'%s',_0x23ba43):_0x23ba43;_0x23ba43=_0x23ef2d[_0x3c8f7b]['format']?_[_0xab77('0x74')](_0xb538fc[_0x23ef2d[_0x3c8f7b][_0xab77('0x75')]],'%s',_0x23ba43):_0x23ba43;if(_0x23ef2d[_0x3c8f7b][_0xab77('0x76')]){_0x17d2dc[_0xab77('0x66')](_0x23ba43);}_0x23ef2d[_0x3c8f7b]['orderBy']&&_0x17d2dc[_0xab77('0x3a')](_0x23ba43,_0x23ef2d[_0x3c8f7b][_0xab77('0x77')]===_0xab77('0x78')?![]:!![]);_0x17d2dc[_0xab77('0x67')](_0x23ba43,_0x23ef2d[_0x3c8f7b][_0xab77('0x79')]||_0x23ba43);}if(_0x41d515[_0xab77('0x7a')]){_0x41d515['joins']=JSON[_0xab77('0x80')](_0x41d515[_0xab77('0x7a')]);for(var _0xa4828=0x0;_0xa4828<_0x41d515['joins'][_0xab77('0x38')];_0xa4828+=0x1){if(_0x41d515['joins'][_0xa4828][_0xab77('0x31')]&&_[_0xab77('0x5f')](_0x125189,_0x41d515[_0xab77('0x7a')][_0xa4828][_0xab77('0x31')])&&_0x41d515[_0xab77('0x7a')][_0xa4828]['parentKey']&&_0x41d515[_0xab77('0x7a')][_0xa4828][_0xab77('0x7c')]&&_0x41d515['joins'][_0xa4828][_0xab77('0x7d')]){_0x17d2dc[_0x41d515['joins'][_0xa4828][_0xab77('0x31')]](_0x41d515[_0xab77('0x7a')][_0xa4828]['foreignTable'],null,util[_0xab77('0x75')](_0xab77('0x7e'),_0x41d515[_0xab77('0x71')],_0x41d515['joins'][_0xa4828][_0xab77('0x7b')],_0x41d515[_0xab77('0x7a')][_0xa4828][_0xab77('0x7c')],_0x41d515[_0xab77('0x7a')][_0xa4828][_0xab77('0x7d')]));}}}if(_0x41d515[_0xab77('0x7f')]){_0x41d515[_0xab77('0x7f')]=JSON[_0xab77('0x80')](_0x41d515[_0xab77('0x7f')]);_0x17d2dc[_0xab77('0x3c')](_0x2ba066(_0x41d515[_0xab77('0x7f')][_0xab77('0x66')]));}_0x5eb9c1=_0x17d2dc['clone']();_0x17d2dc['limit'](_0x2cfde5);_0x17d2dc[_0xab77('0x1c')](0x0);logger[_0xab77('0x81')](_0xab77('0x82'),_0x17d2dc[_0xab77('0x84')]());return dbH[_0xab77('0x83')]['query'](_0x17d2dc[_0xab77('0x84')](),{'type':dbH[_0xab77('0x83')][_0xab77('0x85')][_0xab77('0x86')]});}})[_0xab77('0x25')](function(){return{'sql':_0x5eb9c1[_0xab77('0x84')]()};})[_0xab77('0x25')](respondWithResult(_0x3c1e12,null))[_0xab77('0x49')](handleError(_0x3c1e12,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index f7661c4..3e93c68 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 _0x990e=['request-promise','path','rimraf','./analyticCustomReport.attributes','define','analytics_custom_reports','util','api','moment'];(function(_0x44177c,_0x491caa){var _0x71d1c3=function(_0x2ca003){while(--_0x2ca003){_0x44177c['push'](_0x44177c['shift']());}};_0x71d1c3(++_0x491caa);}(_0x990e,0x1da));var _0xe990=function(_0x3798d8,_0x1d1a5d){_0x3798d8=_0x3798d8-0x0;var _0x2d747a=_0x990e[_0x3798d8];return _0x2d747a;};'use strict';var _=require('lodash');var util=require(_0xe990('0x0'));var logger=require('../../config/logger')(_0xe990('0x1'));var moment=require(_0xe990('0x2'));var BPromise=require('bluebird');var rp=require(_0xe990('0x3'));var fs=require('fs');var path=require(_0xe990('0x4'));var rimraf=require(_0xe990('0x5'));var config=require('../../config/environment');var attributes=require(_0xe990('0x6'));module['exports']=function(_0x4163f6,_0x1ed2ff){return _0x4163f6[_0xe990('0x7')]('AnalyticCustomReport',attributes,{'tableName':_0xe990('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cdc=['exports','define','analytics_custom_reports','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x7cdc,0x1b1));var _0xc7cd=function(_0x5d007a,_0xcba219){_0x5d007a=_0x5d007a-0x0;var _0x44f5e3=_0x7cdc[_0x5d007a];return _0x44f5e3;};'use strict';var _=require('lodash');var util=require(_0xc7cd('0x0'));var logger=require(_0xc7cd('0x1'))('api');var moment=require(_0xc7cd('0x2'));var BPromise=require('bluebird');var rp=require(_0xc7cd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc7cd('0x4'));var config=require(_0xc7cd('0x5'));var attributes=require(_0xc7cd('0x6'));module[_0xc7cd('0x7')]=function(_0x4c1e46,_0x26e6cd){return _0x4c1e46[_0xc7cd('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0xc7cd('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index d6dacc0..4d9b8a7 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 _0x80a9=['../../config/logger','../../config/environment','jayson/promise','client','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80a9,0xc3));var _0x980a=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x80a9[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require('lodash');var util=require(_0x980a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x980a('0x1'));var fs=require('fs');var Redis=require(_0x980a('0x2'));var db=require(_0x980a('0x3'))['db'];var utils=require(_0x980a('0x4'));var logger=require(_0x980a('0x5'))('rpc');var config=require(_0x980a('0x6'));var jayson=require(_0x980a('0x7'));var client=jayson[_0x980a('0x8')][_0x980a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d2e22,_0x253536,_0x2c4f8f){return new BPromise(function(_0xca82dc,_0x3b7811){return client[_0x980a('0xa')](_0x4d2e22,_0x2c4f8f)['then'](function(_0x497977){logger[_0x980a('0xb')](_0x980a('0xc'),_0x253536,_0x980a('0xd'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x253536,_0x980a('0xd'),JSON[_0x980a('0xe')](_0x497977));if(_0x497977[_0x980a('0xf')]){if(_0x497977[_0x980a('0xf')][_0x980a('0x10')]===0x1f4){logger[_0x980a('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x253536,_0x497977['error'][_0x980a('0x11')]);return _0x3b7811(_0x497977[_0x980a('0xf')][_0x980a('0x11')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x253536,_0x497977[_0x980a('0xf')][_0x980a('0x11')]);return _0xca82dc(_0x497977[_0x980a('0xf')][_0x980a('0x11')]);}else{logger[_0x980a('0xb')](_0x980a('0xc'),_0x253536,_0x980a('0xd'));_0xca82dc(_0x497977[_0x980a('0x12')]['message']);}})[_0x980a('0x13')](function(_0x3dd9f1){logger[_0x980a('0xf')](_0x980a('0xc'),_0x253536,_0x3dd9f1);_0x3b7811(_0x3dd9f1);});});} \ No newline at end of file +var _0x5c39=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x5c39,0xff));var _0x95c3=function(_0x42df4b,_0x5133ba){_0x42df4b=_0x42df4b-0x0;var _0x167966=_0x5c39[_0x42df4b];return _0x167966;};'use strict';var _=require('lodash');var util=require(_0x95c3('0x0'));var moment=require(_0x95c3('0x1'));var BPromise=require(_0x95c3('0x2'));var rs=require(_0x95c3('0x3'));var fs=require('fs');var Redis=require(_0x95c3('0x4'));var db=require(_0x95c3('0x5'))['db'];var utils=require(_0x95c3('0x6'));var logger=require(_0x95c3('0x7'))(_0x95c3('0x8'));var config=require(_0x95c3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x95c3('0xa')][_0x95c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22e219,_0x20d5ad,_0x4d9134){return new BPromise(function(_0x1ad5b8,_0x2b58ba){return client[_0x95c3('0xc')](_0x22e219,_0x4d9134)[_0x95c3('0xd')](function(_0x127673){logger[_0x95c3('0xe')](_0x95c3('0xf'),_0x20d5ad,_0x95c3('0x10'));logger[_0x95c3('0x11')](_0x95c3('0x12'),_0x20d5ad,_0x95c3('0x10'),JSON['stringify'](_0x127673));if(_0x127673[_0x95c3('0x13')]){if(_0x127673[_0x95c3('0x13')]['code']===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x20d5ad,_0x127673['error']['message']);return _0x2b58ba(_0x127673['error'][_0x95c3('0x14')]);}logger[_0x95c3('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x20d5ad,_0x127673[_0x95c3('0x13')][_0x95c3('0x14')]);return _0x1ad5b8(_0x127673['error'][_0x95c3('0x14')]);}else{logger['info'](_0x95c3('0xf'),_0x20d5ad,_0x95c3('0x10'));_0x1ad5b8(_0x127673[_0x95c3('0x15')][_0x95c3('0x14')]);}})[_0x95c3('0x16')](function(_0x3143db){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x20d5ad,_0x3143db);_0x2b58ba(_0x3143db);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index e701925..09e1cc7 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 _0x44b2=['query','post','create','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run'];(function(_0x5d5ab2,_0x1d3681){var _0xb8fe37=function(_0x29a76c){while(--_0x29a76c){_0x5d5ab2['push'](_0x5d5ab2['shift']());}};_0xb8fe37(++_0x1d3681);}(_0x44b2,0x192));var _0x244b=function(_0x38cdc3,_0x4a8a01){_0x38cdc3=_0x38cdc3-0x0;var _0x2329f8=_0x44b2[_0x38cdc3];return _0x2329f8;};'use strict';var multer=require(_0x244b('0x0'));var util=require(_0x244b('0x1'));var path=require('path');var timeout=require(_0x244b('0x2'));var express=require(_0x244b('0x3'));var router=express['Router']();var fs_extra=require(_0x244b('0x4'));var auth=require(_0x244b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x244b('0x6'));var controller=require(_0x244b('0x7'));router[_0x244b('0x8')]('/',auth[_0x244b('0x9')](),controller[_0x244b('0xa')]);router[_0x244b('0x8')](_0x244b('0xb'),auth[_0x244b('0x9')](),controller[_0x244b('0xc')]);router[_0x244b('0x8')](_0x244b('0xd'),auth[_0x244b('0x9')](),controller[_0x244b('0xe')]);router[_0x244b('0x8')](_0x244b('0xf'),auth[_0x244b('0x9')](),controller['run']);router[_0x244b('0x8')]('/:id/query',auth[_0x244b('0x9')](),controller[_0x244b('0x10')]);router[_0x244b('0x11')]('/',auth[_0x244b('0x9')](),controller[_0x244b('0x12')]);router['put'](_0x244b('0xb'),auth['isAuthenticated'](),controller[_0x244b('0x13')]);router[_0x244b('0x14')](_0x244b('0xb'),auth[_0x244b('0x9')](),controller['destroy']);module[_0x244b('0x15')]=router; \ No newline at end of file +var _0x635a=['query','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query'];(function(_0x40a4e8,_0x4f0b81){var _0x30f2cd=function(_0x38b3e8){while(--_0x38b3e8){_0x40a4e8['push'](_0x40a4e8['shift']());}};_0x30f2cd(++_0x4f0b81);}(_0x635a,0x13f));var _0xa635=function(_0x3c9782,_0x2741b7){_0x3c9782=_0x3c9782-0x0;var _0x15b97c=_0x635a[_0x3c9782];return _0x15b97c;};'use strict';var multer=require(_0xa635('0x0'));var util=require('util');var path=require(_0xa635('0x1'));var timeout=require(_0xa635('0x2'));var express=require(_0xa635('0x3'));var router=express[_0xa635('0x4')]();var fs_extra=require(_0xa635('0x5'));var auth=require(_0xa635('0x6'));var interaction=require(_0xa635('0x7'));var config=require(_0xa635('0x8'));var controller=require(_0xa635('0x9'));router[_0xa635('0xa')]('/',auth[_0xa635('0xb')](),controller[_0xa635('0xc')]);router[_0xa635('0xa')](_0xa635('0xd'),auth[_0xa635('0xb')](),controller[_0xa635('0xe')]);router[_0xa635('0xa')](_0xa635('0xf'),auth[_0xa635('0xb')](),controller[_0xa635('0x10')]);router[_0xa635('0xa')]('/:id/run',auth[_0xa635('0xb')](),controller[_0xa635('0x11')]);router['get'](_0xa635('0x12'),auth[_0xa635('0xb')](),controller[_0xa635('0x13')]);router[_0xa635('0x14')]('/',auth[_0xa635('0xb')](),controller[_0xa635('0x15')]);router[_0xa635('0x16')](_0xa635('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xa635('0x17')](_0xa635('0xd'),auth[_0xa635('0xb')](),controller[_0xa635('0x18')]);module[_0xa635('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 391f373..6e4fa80 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5075=['exports','STRING','TEXT','sequelize'];(function(_0x2a6754,_0x277259){var _0x17feda=function(_0x5745be){while(--_0x5745be){_0x2a6754['push'](_0x2a6754['shift']());}};_0x17feda(++_0x277259);}(_0x5075,0x73));var _0x5507=function(_0x1ded25,_0x26be3d){_0x1ded25=_0x1ded25-0x0;var _0x8ec99f=_0x5075[_0x1ded25];return _0x8ec99f;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'name':{'type':Sequelize[_0x5507('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5507('0x2')]},'parent':{'type':Sequelize[_0x5507('0x2')]},'table':{'type':Sequelize[_0x5507('0x2')]},'conditions':{'type':Sequelize[_0x5507('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf2ca=['STRING','TEXT','sequelize','exports'];(function(_0x4ec863,_0x85080a){var _0x2071fc=function(_0x5a49a2){while(--_0x5a49a2){_0x4ec863['push'](_0x4ec863['shift']());}};_0x2071fc(++_0x85080a);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x576e92,_0x165314){_0x576e92=_0x576e92-0x0;var _0x24c32e=_0xf2ca[_0x576e92];return _0x24c32e;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'name':{'type':Sequelize[_0xaf2c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xaf2c('0x2')]},'table':{'type':Sequelize[_0xaf2c('0x2')]},'conditions':{'type':Sequelize[_0xaf2c('0x3')]},'joins':{'type':Sequelize[_0xaf2c('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index a7401d6..bf1f354 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 _0x2ef3=['Sequelize','from','foreignKey','output','web','fullPath','generate','csv','cdr','startDate','endDate','info','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','IS\x20NULL','IS\x20NOT\x20EMPTY','metric','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','update','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20EMPTY','operator','rules','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2ef3,0xba));var _0x32ef=function(_0x37a7a7,_0x19ea80){_0x37a7a7=_0x37a7a7-0x0;var _0x3a81c9=_0x2ef3[_0x37a7a7];return _0x3a81c9;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0x32ef('0x18'))['dbH'];function respondWithStatusCode(_0x3e98df,_0x1ef1ae){_0x1ef1ae=_0x1ef1ae||0xcc;return function(_0x5c3eb9){if(_0x5c3eb9){return _0x3e98df['sendStatus'](_0x1ef1ae);}return _0x3e98df[_0x32ef('0x19')](_0x1ef1ae)['end']();};}function respondWithResult(_0x326fce,_0x40a6e6){_0x40a6e6=_0x40a6e6||0xc8;return function(_0x93d492){if(_0x93d492){return _0x326fce[_0x32ef('0x19')](_0x40a6e6)['json'](_0x93d492);}};}function respondWithFilteredResult(_0x55bf0b,_0x531e30){return function(_0x13db1a){if(_0x13db1a){var _0x3950e6=typeof _0x531e30[_0x32ef('0x1a')]==='undefined'&&typeof _0x531e30['limit']===_0x32ef('0x1b');var _0x1a9476=_0x13db1a[_0x32ef('0x1c')];var _0x57863c=_0x3950e6?0x0:_0x531e30[_0x32ef('0x1a')];var _0x33e230=_0x3950e6?_0x13db1a['count']:_0x531e30[_0x32ef('0x1a')]+_0x531e30[_0x32ef('0x1d')];var _0x26aff3;if(_0x33e230>=_0x1a9476){_0x33e230=_0x1a9476;_0x26aff3=0xc8;}else{_0x26aff3=0xce;}_0x55bf0b[_0x32ef('0x19')](_0x26aff3);return _0x55bf0b[_0x32ef('0x1e')](_0x32ef('0x1f'),_0x57863c+'-'+_0x33e230+'/'+_0x1a9476)['json'](_0x13db1a);}return null;};}function patchUpdates(_0x3c5b78){return function(_0x5cc3ef){try{jsonpatch[_0x32ef('0x20')](_0x5cc3ef,_0x3c5b78,!![]);}catch(_0x3a20ca){return BPromise['reject'](_0x3a20ca);}return _0x5cc3ef[_0x32ef('0x21')]();};}function saveUpdates(_0x97780,_0x5e8898){return function(_0x55f7f2){if(_0x55f7f2){return _0x55f7f2['update'](_0x97780)[_0x32ef('0x22')](function(_0xb30fab){return _0xb30fab;});}return null;};}function removeEntity(_0x225feb,_0x478bef){return function(_0x59585f){if(_0x59585f){return _0x59585f[_0x32ef('0x23')]()['then'](function(){var _0x51a412=_0x59585f[_0x32ef('0x24')]({'plain':!![]});var _0x14d4b3=_0x32ef('0x25');return db[_0x32ef('0x26')][_0x32ef('0x23')]({'where':{'type':_0x14d4b3,'resourceId':_0x51a412['id']}})[_0x32ef('0x22')](function(){return _0x59585f;});})[_0x32ef('0x22')](function(){_0x225feb[_0x32ef('0x19')](0xcc)[_0x32ef('0x27')]();});}};}function handleEntityNotFound(_0x2f52d7,_0x1335e2){return function(_0xba4b3f){if(!_0xba4b3f){_0x2f52d7['sendStatus'](0x194);}return _0xba4b3f;};}function handleError(_0xd65fde,_0x2f5d06){_0x2f5d06=_0x2f5d06||0x1f4;return function(_0x5a04cd){logger[_0x32ef('0x28')](_0x5a04cd[_0x32ef('0x29')]);if(_0x5a04cd[_0x32ef('0x2a')]){delete _0x5a04cd[_0x32ef('0x2a')];}_0xd65fde['status'](_0x2f5d06)[_0x32ef('0x2b')](_0x5a04cd);};}exports[_0x32ef('0x2c')]=function(_0x31dbc3,_0x2ac686){var _0x1b668a={},_0x1a6ed2={},_0x1a122d={'count':0x0,'rows':[]};var _0x575f3e=_[_0x32ef('0x2d')](db['AnalyticDefaultReport'][_0x32ef('0x2e')],function(_0x2b6c6a){return{'name':_0x2b6c6a['fieldName'],'type':_0x2b6c6a[_0x32ef('0x2f')][_0x32ef('0x30')]};});_0x1a6ed2[_0x32ef('0x31')]=_[_0x32ef('0x2d')](_0x575f3e,_0x32ef('0x2a'));_0x1a6ed2['query']=_['keys'](_0x31dbc3[_0x32ef('0x32')]);_0x1a6ed2['filters']=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],_0x1a6ed2[_0x32ef('0x32')]);_0x1b668a[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],qs['fields'](_0x31dbc3['query']['fields']));_0x1b668a[_0x32ef('0x34')]=_0x1b668a[_0x32ef('0x34')][_0x32ef('0x35')]?_0x1b668a['attributes']:_0x1a6ed2['model'];if(!_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x36')](_0x32ef('0x37'))){_0x1b668a['limit']=qs['limit'](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1d')]);_0x1b668a[_0x32ef('0x1a')]=qs[_0x32ef('0x1a')](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1a')]);}_0x1b668a[_0x32ef('0x38')]=qs[_0x32ef('0x39')](_0x31dbc3[_0x32ef('0x32')]['sort']);_0x1b668a[_0x32ef('0x3a')]=qs[_0x32ef('0x3b')](_[_0x32ef('0x3c')](_0x31dbc3['query'],_0x1a6ed2[_0x32ef('0x3b')]),_0x575f3e);if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x3d')]){_0x1b668a[_0x32ef('0x3a')]=_[_0x32ef('0x3e')](_0x1b668a[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x2d')](_0x575f3e,function(_0x1cebed){if(_0x1cebed[_0x32ef('0x2f')]!==_0x32ef('0x3f')){var _0xb4db74={};_0xb4db74[_0x1cebed[_0x32ef('0x2a')]]={'$like':'%'+_0x31dbc3['query'][_0x32ef('0x3d')]+'%'};return _0xb4db74;}})});}_0x1b668a=_[_0x32ef('0x3e')]({},_0x1b668a,_0x31dbc3[_0x32ef('0x40')]);var _0x1733e3={'where':_0x1b668a[_0x32ef('0x3a')]};return db[_0x32ef('0x41')][_0x32ef('0x1c')](_0x1733e3)['then'](function(_0x538758){_0x1a122d[_0x32ef('0x1c')]=_0x538758;if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x42')]){_0x1b668a[_0x32ef('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x32ef('0x44')](_0x1b668a);})[_0x32ef('0x22')](function(_0x5d2f06){_0x1a122d[_0x32ef('0x45')]=_0x5d2f06;return _0x1a122d;})['then'](respondWithFilteredResult(_0x2ac686,_0x1b668a))[_0x32ef('0x46')](handleError(_0x2ac686,null));};exports[_0x32ef('0x47')]=function(_0x37a497,_0x3be46d){var _0x2c2b62={'raw':!![],'where':{'id':_0x37a497[_0x32ef('0x48')]['id']}},_0x2310ae={};_0x2310ae[_0x32ef('0x31')]=_[_0x32ef('0x49')](db[_0x32ef('0x41')]['rawAttributes']);_0x2310ae[_0x32ef('0x32')]=_['keys'](_0x37a497[_0x32ef('0x32')]);_0x2310ae[_0x32ef('0x3b')]=_[_0x32ef('0x33')](_0x2310ae['model'],_0x2310ae[_0x32ef('0x32')]);_0x2c2b62[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x2310ae[_0x32ef('0x31')],qs[_0x32ef('0x4a')](_0x37a497[_0x32ef('0x32')][_0x32ef('0x4a')]));_0x2c2b62['attributes']=_0x2c2b62['attributes'][_0x32ef('0x35')]?_0x2c2b62[_0x32ef('0x34')]:_0x2310ae[_0x32ef('0x31')];if(_0x37a497[_0x32ef('0x32')][_0x32ef('0x42')]){_0x2c2b62[_0x32ef('0x43')]=[{'all':!![]}];}_0x2c2b62=_[_0x32ef('0x3e')]({},_0x2c2b62,_0x37a497[_0x32ef('0x40')]);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2c2b62)[_0x32ef('0x22')](handleEntityNotFound(_0x3be46d,null))[_0x32ef('0x22')](respondWithResult(_0x3be46d,null))[_0x32ef('0x46')](handleError(_0x3be46d,null));};exports['create']=function(_0x420f00,_0x12fbd7){return db[_0x32ef('0x41')][_0x32ef('0x4c')](_0x420f00[_0x32ef('0x4d')],{})[_0x32ef('0x22')](function(_0x278696){var _0x1acded=_0x420f00[_0x32ef('0x4e')][_0x32ef('0x24')]({'plain':!![]});if(!_0x1acded)throw new Error(_0x32ef('0x4f'));if(_0x1acded[_0x32ef('0x50')]===_0x32ef('0x4e')){var _0x326445=_0x278696[_0x32ef('0x24')]({'plain':!![]});var _0x3fb4d8=_0x32ef('0x51');return db[_0x32ef('0x52')]['find']({'where':{'name':_0x3fb4d8,'userProfileId':_0x1acded['userProfileId']},'raw':!![]})[_0x32ef('0x22')](function(_0x259c32){if(_0x259c32&&_0x259c32[_0x32ef('0x53')]===0x0){return db[_0x32ef('0x26')][_0x32ef('0x4c')]({'name':_0x326445[_0x32ef('0x2a')],'resourceId':_0x326445['id'],'type':_0x32ef('0x25'),'sectionId':_0x259c32['id']},{})[_0x32ef('0x22')](function(){return _0x278696;});}else{return _0x278696;}})[_0x32ef('0x46')](function(_0x368bf1){logger[_0x32ef('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x368bf1);throw _0x368bf1;});}return _0x278696;})[_0x32ef('0x22')](respondWithResult(_0x12fbd7,0xc9))[_0x32ef('0x46')](handleError(_0x12fbd7,null));};exports[_0x32ef('0x54')]=function(_0x3fe01f,_0x38314a){if(_0x3fe01f[_0x32ef('0x4d')]['id']){delete _0x3fe01f['body']['id'];}return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x3fe01f[_0x32ef('0x48')]['id']}})['then'](handleEntityNotFound(_0x38314a,null))[_0x32ef('0x22')](saveUpdates(_0x3fe01f['body'],null))[_0x32ef('0x22')](respondWithResult(_0x38314a,null))[_0x32ef('0x46')](handleError(_0x38314a,null));};exports['destroy']=function(_0x206ad5,_0x59e5f9){return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x206ad5[_0x32ef('0x48')]['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x59e5f9,null))[_0x32ef('0x22')](removeEntity(_0x59e5f9,null))[_0x32ef('0x46')](handleError(_0x59e5f9,null));};exports[_0x32ef('0x55')]=function(_0x56260f,_0x56cc75){var _0xdfa103=0xa;var _0x52232a=['join',_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0x6aae59={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0xbd059e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2ac877=function(_0x3c31d0){return!_[_0x32ef('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x3c31d0);};var _0x17f447=function(_0x5bb114){if(!_0x5bb114||!_0x5bb114['rules'][_0x32ef('0x35')]){return'';}for(var _0x208989='(',_0x10cb37=0x0;_0x10cb37<_0x5bb114['rules'][_0x32ef('0x35')];_0x10cb37+=0x1){_0x10cb37>0x0&&(_0x208989+='\x20'+_0x5bb114[_0x32ef('0x65')]+'\x20');_0x208989+=_0x5bb114[_0x32ef('0x66')][_0x10cb37]['group']?_0x17f447(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x67')]):_0x5bb114['rules'][_0x10cb37]['field']+'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')]+(_0x2ac877(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')])?'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x69')]:'');}return _0x208989+')';};var _0x4c89e8={'where':{'id':_0x56260f[_0x32ef('0x48')]['id']}},_0x285330,_0x63b65,_0x25b6d6,_0x36ed97,_0x21e930;_0x4c89e8=_[_0x32ef('0x3e')]({},_0x4c89e8,_0x56260f[_0x32ef('0x40')]);return db[_0x32ef('0x41')]['find'](_0x4c89e8)[_0x32ef('0x22')](function(_0x29ff58){if(_0x29ff58){_0x285330=_0x29ff58;return _0x29ff58[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0x79ae28){if(_0x79ae28){if(!_0x79ae28['length']){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x63b65=_0x79ae28;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x526fb1){if(_0x526fb1){_0x25b6d6=_[_0x32ef('0x6e')](_0x526fb1,'id');var _0x544045;var _0x216e2f=squel[_0x32ef('0x6f')]();_0x216e2f['from'](_0x285330['table']);for(var _0x2c9f7a=0x0;_0x2c9f7a<_0x63b65[_0x32ef('0x35')];_0x2c9f7a+=0x1){_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x70')]?_0x25b6d6[_0x63b65[_0x2c9f7a]['MetricId']]['metric']:_0x63b65[_0x2c9f7a][_0x32ef('0x71')];_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x6aae59[_0x63b65[_0x2c9f7a][_0x32ef('0x72')]],'%s',_0x544045):_0x544045;_0x544045=_0x63b65[_0x2c9f7a]['format']?_[_0x32ef('0x73')](_0xbd059e[_0x63b65[_0x2c9f7a][_0x32ef('0x74')]],'%s',_0x544045):_0x544045;if(_0x63b65[_0x2c9f7a][_0x32ef('0x75')]){_0x216e2f[_0x32ef('0x67')](_0x544045);}_0x63b65[_0x2c9f7a][_0x32ef('0x76')]&&_0x216e2f[_0x32ef('0x38')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x216e2f[_0x32ef('0x71')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x78')]||_0x544045);}if(_0x285330[_0x32ef('0x79')]){_0x285330[_0x32ef('0x79')]=JSON['parse'](_0x285330['joins']);for(var _0x3a9c97=0x0;_0x3a9c97<_0x285330[_0x32ef('0x79')]['length'];_0x3a9c97+=0x1){if(_0x285330[_0x32ef('0x79')][_0x3a9c97]['type']&&_[_0x32ef('0x63')](_0x52232a,_0x285330[_0x32ef('0x79')][_0x3a9c97][_0x32ef('0x2f')])&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7a')]&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')]&&_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']){_0x216e2f[_0x285330['joins'][_0x3a9c97][_0x32ef('0x2f')]](_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')],null,util['format'](_0x32ef('0x7c'),_0x285330[_0x32ef('0x7d')],_0x285330[_0x32ef('0x79')][_0x3a9c97]['parentKey'],_0x285330['joins'][_0x3a9c97]['foreignTable'],_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']));}}}if(_0x285330[_0x32ef('0x7e')]){_0x285330[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x285330[_0x32ef('0x7e')]);_0x216e2f[_0x32ef('0x3a')](_0x17f447(_0x285330[_0x32ef('0x7e')]['group']));}_0x21e930=_0x216e2f[_0x32ef('0x80')]();_0x216e2f['limit'](_0xdfa103);_0x216e2f['offset'](0x0);logger[_0x32ef('0x81')]('Limited\x20Query:',_0x216e2f[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')]['query'](_0x216e2f[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')][_0x32ef('0x84')][_0x32ef('0x85')]});}})[_0x32ef('0x22')](respondWithResult(_0x56cc75,null))[_0x32ef('0x46')](handleError(_0x56cc75,null));};function runReport(_0x4b5506,_0x51736f,_0x35b10d){var _0x5e0b55=_0x51736f[_0x32ef('0x2a')];var _0x266688=0xa;var _0x114d8e=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),'cross_join'];var _0x3232ca={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':_0x32ef('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x211fb1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0xfb4845=function(_0x21067e){return!_[_0x32ef('0x63')](['IS\x20NULL',_0x32ef('0x8b'),_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x21067e);};var _0x35653b=function(_0x5ea727){if(!_0x5ea727||!_0x5ea727[_0x32ef('0x66')]['length']){return'';}for(var _0x43f36e='(',_0x39300f=0x0;_0x39300f<_0x5ea727[_0x32ef('0x66')][_0x32ef('0x35')];_0x39300f+=0x1){_0x39300f>0x0&&(_0x43f36e+='\x20'+_0x5ea727['operator']+'\x20');_0x43f36e+=_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x67')]?_0x35653b(_0x5ea727[_0x32ef('0x66')][_0x39300f]['group']):_0x5ea727['rules'][_0x39300f]['field']+'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')]+(_0xfb4845(_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')])?'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f]['value']:'');}return _0x43f36e+')';};var _0x2678e3={'where':{'id':_0x4b5506['id']}},_0x5b3deb,_0x471de6,_0x7b0ea5,_0xc43e1,_0x4baa7a;_0x2678e3=_[_0x32ef('0x3e')]({},_0x2678e3,_0x35b10d);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2678e3)[_0x32ef('0x22')](function(_0x28bebb){if(_0x28bebb){_0x5b3deb=_0x28bebb;return _0x28bebb['getFields']();}return null;})[_0x32ef('0x22')](function(_0x484df0){if(_0x484df0){if(!_0x484df0[_0x32ef('0x35')]){throw new db[(_0x32ef('0x8c'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x471de6=_0x484df0;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x3b9896){if(_0x3b9896){_0x7b0ea5=_['keyBy'](_0x3b9896,'id');var _0x356fd4;var _0x51ca6e=squel['select']();_0x51ca6e[_0x32ef('0x8d')](_0x5b3deb['table']);for(var _0x2237cf=0x0;_0x2237cf<_0x471de6[_0x32ef('0x35')];_0x2237cf+=0x1){_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x70')]?_0x7b0ea5[_0x471de6[_0x2237cf]['MetricId']]['metric']:_0x471de6[_0x2237cf][_0x32ef('0x71')];_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x3232ca[_0x471de6[_0x2237cf][_0x32ef('0x72')]],'%s',_0x356fd4):_0x356fd4;_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x211fb1[_0x471de6[_0x2237cf][_0x32ef('0x74')]],'%s',_0x356fd4):_0x356fd4;if(_0x471de6[_0x2237cf]['groupBy']){_0x51ca6e[_0x32ef('0x67')](_0x356fd4);}_0x471de6[_0x2237cf][_0x32ef('0x76')]&&_0x51ca6e[_0x32ef('0x38')](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x76')]==='DESC'?![]:!![]);_0x51ca6e['field'](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x78')]||_0x356fd4);}if(_0x5b3deb['joins']){_0x5b3deb[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x5b3deb['joins']);for(var _0x5c7594=0x0;_0x5c7594<_0x5b3deb['joins'][_0x32ef('0x35')];_0x5c7594+=0x1){if(_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x2f')]&&_[_0x32ef('0x63')](_0x114d8e,_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x2f')])&&_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x8e')]){_0x51ca6e[_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['type']](_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')],null,util[_0x32ef('0x74')](_0x32ef('0x7c'),_0x5b3deb[_0x32ef('0x7d')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7b')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['foreignKey']));}}}if(_0x5b3deb[_0x32ef('0x7e')]){_0x5b3deb['conditions']=JSON[_0x32ef('0x7f')](_0x5b3deb[_0x32ef('0x7e')]);_0x51ca6e[_0x32ef('0x3a')](_0x35653b(_0x5b3deb[_0x32ef('0x7e')][_0x32ef('0x67')]));}_0x4baa7a=_0x51ca6e['clone']();_0x51ca6e[_0x32ef('0x1d')](_0x266688);_0x51ca6e[_0x32ef('0x1a')](0x0);return;}})[_0x32ef('0x22')](function(){if(_0x51736f[_0x32ef('0x8f')]===_0x32ef('0x90')){return null;}var _0x1cfdd8=_[_0x32ef('0x3e')](_0x51736f,{'name':_0x51736f[_0x32ef('0x91')]||_0x51736f[_0x32ef('0x2a')]||_0x5b3deb['name'],'basename':_0x5e0b55,'savename':util['format']('%s-%s.%s',_0x51736f[_0x32ef('0x2a')]||_0x5b3deb[_0x32ef('0x2a')],require('randomstring')[_0x32ef('0x92')](0x4),_0x51736f['output']||_0x32ef('0x93')),'reportId':_0x5b3deb['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0x32ef('0x4c')](_0x1cfdd8,{'raw':!![]});})[_0x32ef('0x22')](function(_0x118d2e){if(_0x5b3deb[_0x32ef('0x7d')]===_0x32ef('0x94')){_0x4baa7a['where'](_0x5b3deb[_0x32ef('0x7d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x51736f[_0x32ef('0x95')],_0x51736f['endDate']);}else{_0x4baa7a['where'](_0x5b3deb['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x51736f['startDate'],_0x51736f[_0x32ef('0x96')]);}if(_0x118d2e){logger[_0x32ef('0x97')]('Run\x20Query:',_0x4baa7a[_0x32ef('0x82')]());require(_0x32ef('0x98'))[_0x32ef('0x99')](path[_0x32ef('0x86')](__dirname,_0x32ef('0x9a'),_0x118d2e[_0x32ef('0x8f')]),[_0x118d2e['id'],_0x4baa7a['toString'](),path[_0x32ef('0x86')](__dirname,'../../files/reports',_0x118d2e[_0x32ef('0x9b')]),_0x5e0b55]);return _0x118d2e;}else{var _0x1be713=squel['select']();_0x1be713[_0x32ef('0x8d')]('('+_0x4baa7a['toString']()+')',_0x32ef('0x9c'));_0x1be713[_0x32ef('0x71')](_0x32ef('0x9d'),_0x32ef('0x1c'));_0x4baa7a['limit'](_0x51736f[_0x32ef('0x1d')]||_0x266688);_0x4baa7a[_0x32ef('0x1a')](_0x51736f[_0x32ef('0x1a')]||0x0);return dbH[_0x32ef('0x83')]['query'](_0x1be713[_0x32ef('0x82')](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]})[_0x32ef('0x22')](function(_0x28ef17){if(!_0x28ef17[_0x32ef('0x35')]){_0xc43e1=0x0;}else{_0xc43e1=_0x28ef17[0x0][_0x32ef('0x1c')]||0x0;}return dbH['sequelize'][_0x32ef('0x32')](_0x4baa7a['toString'](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]});})[_0x32ef('0x22')](function(_0x3956e7){return{'rows':_0x3956e7||[],'count':_0xc43e1};});}});}exports['run']=function(_0x8d3b24,_0x642716){return runReport(_0x8d3b24[_0x32ef('0x48')],_0x8d3b24[_0x32ef('0x32')],_0x8d3b24['options'])['then'](respondWithResult(_0x642716,null))['catch'](handleError(_0x642716,null));};exports[_0x32ef('0x9e')]=runReport;exports[_0x32ef('0x32')]=function(_0x4454f3,_0xc92dcc){var _0x3d18b9=0xa;var _0x9233cb=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0xa76912={'SUM':'SUM(%s)','COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0x1526a1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0x2d4d2f=function(_0x292488){return!_[_0x32ef('0x63')]([_0x32ef('0x9f'),_0x32ef('0x8b'),_0x32ef('0x64'),_0x32ef('0xa0')],_0x292488);};var _0x50b674=function(_0x379d40){if(!_0x379d40||!_0x379d40[_0x32ef('0x66')][_0x32ef('0x35')]){return'';}for(var _0x4b7a4d='(',_0x16525b=0x0;_0x16525b<_0x379d40['rules'][_0x32ef('0x35')];_0x16525b+=0x1){_0x16525b>0x0&&(_0x4b7a4d+='\x20'+_0x379d40[_0x32ef('0x65')]+'\x20');_0x4b7a4d+=_0x379d40[_0x32ef('0x66')][_0x16525b]['group']?_0x50b674(_0x379d40[_0x32ef('0x66')][_0x16525b]['group']):_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x71')]+'\x20'+_0x379d40['rules'][_0x16525b][_0x32ef('0x68')]+(_0x2d4d2f(_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x68')])?'\x20'+_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x69')]:'');}return _0x4b7a4d+')';};var _0x264075={'where':{'id':_0x4454f3[_0x32ef('0x48')]['id']}},_0x3798d1,_0x4befa9,_0x493ae9,_0x143d39,_0x497948;_0x264075=_[_0x32ef('0x3e')]({},_0x264075,_0x4454f3['options']);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x264075)['then'](function(_0x1200c9){if(_0x1200c9){_0x3798d1=_0x1200c9;return _0x1200c9[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0xa5f787){if(_0xa5f787){if(!_0xa5f787[_0x32ef('0x35')]){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x4befa9=_0xa5f787;return db['AnalyticMetric'][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x55ad11){if(_0x55ad11){_0x493ae9=_[_0x32ef('0x6e')](_0x55ad11,'id');var _0x2971a8;var _0x522c22=squel[_0x32ef('0x6f')]();_0x522c22[_0x32ef('0x8d')](_0x3798d1['table']);for(var _0xb41a01=0x0;_0xb41a01<_0x4befa9[_0x32ef('0x35')];_0xb41a01+=0x1){_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x70')]?_0x493ae9[_0x4befa9[_0xb41a01][_0x32ef('0x70')]][_0x32ef('0xa1')]:_0x4befa9[_0xb41a01][_0x32ef('0x71')];_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x72')]?_['replace'](_0xa76912[_0x4befa9[_0xb41a01]['function']],'%s',_0x2971a8):_0x2971a8;_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x1526a1[_0x4befa9[_0xb41a01][_0x32ef('0x74')]],'%s',_0x2971a8):_0x2971a8;if(_0x4befa9[_0xb41a01]['groupBy']){_0x522c22[_0x32ef('0x67')](_0x2971a8);}_0x4befa9[_0xb41a01][_0x32ef('0x76')]&&_0x522c22['order'](_0x2971a8,_0x4befa9[_0xb41a01][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x522c22['field'](_0x2971a8,_0x4befa9[_0xb41a01]['alias']||_0x2971a8);}if(_0x3798d1[_0x32ef('0x79')]){_0x3798d1[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x3798d1['joins']);for(var _0x5f4eab=0x0;_0x5f4eab<_0x3798d1['joins'][_0x32ef('0x35')];_0x5f4eab+=0x1){if(_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')]&&_['includes'](_0x9233cb,_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')])&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['parentKey']&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')]&&_0x3798d1['joins'][_0x5f4eab]['foreignKey']){_0x522c22[_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['type']](_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3798d1[_0x32ef('0x7d')],_0x3798d1['joins'][_0x5f4eab][_0x32ef('0x7a')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x8e')]));}}}if(_0x3798d1[_0x32ef('0x7e')]){_0x3798d1[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x3798d1[_0x32ef('0x7e')]);_0x522c22[_0x32ef('0x3a')](_0x50b674(_0x3798d1['conditions']['group']));}_0x497948=_0x522c22[_0x32ef('0x80')]();_0x522c22[_0x32ef('0x1d')](_0x3d18b9);_0x522c22[_0x32ef('0x1a')](0x0);logger[_0x32ef('0x81')](_0x32ef('0xa2'),_0x522c22[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')][_0x32ef('0x32')](_0x522c22[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')]['QueryTypes'][_0x32ef('0x85')]});}})[_0x32ef('0x22')](function(){return{'sql':_0x497948[_0x32ef('0x82')]()};})[_0x32ef('0x22')](respondWithResult(_0xc92dcc,null))[_0x32ef('0x46')](handleError(_0xc92dcc,null));}; \ No newline at end of file +var _0xda19=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','groupBy','orderBy','order','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','metric','format','DESC','parse','parentKey','web','output','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','json','offset','undefined','limit','count','set','apply','update','then','DefaultReports','destroy','end','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','options','find','getFields'];(function(_0x577cb0,_0x26747e){var _0x25d4e9=function(_0x13ca7a){while(--_0x13ca7a){_0x577cb0['push'](_0x577cb0['shift']());}};_0x25d4e9(++_0x26747e);}(_0xda19,0xd5));var _0x9da1=function(_0x268306,_0x146a9e){_0x268306=_0x268306-0x0;var _0x488ae7=_0xda19[_0x268306];return _0x488ae7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9da1('0x17')];function respondWithStatusCode(_0x1d93f8,_0xd2d225){_0xd2d225=_0xd2d225||0xcc;return function(_0x1ffa2a){if(_0x1ffa2a){return _0x1d93f8['sendStatus'](_0xd2d225);}return _0x1d93f8[_0x9da1('0x18')](_0xd2d225)['end']();};}function respondWithResult(_0x4d17e1,_0x40ba9d){_0x40ba9d=_0x40ba9d||0xc8;return function(_0x479ccd){if(_0x479ccd){return _0x4d17e1[_0x9da1('0x18')](_0x40ba9d)[_0x9da1('0x19')](_0x479ccd);}};}function respondWithFilteredResult(_0x37653d,_0x1a1a6b){return function(_0x7f1a64){if(_0x7f1a64){var _0x514d8e=typeof _0x1a1a6b[_0x9da1('0x1a')]===_0x9da1('0x1b')&&typeof _0x1a1a6b[_0x9da1('0x1c')]===_0x9da1('0x1b');var _0xfb278d=_0x7f1a64[_0x9da1('0x1d')];var _0x497676=_0x514d8e?0x0:_0x1a1a6b['offset'];var _0x17205d=_0x514d8e?_0x7f1a64[_0x9da1('0x1d')]:_0x1a1a6b[_0x9da1('0x1a')]+_0x1a1a6b[_0x9da1('0x1c')];var _0x40a967;if(_0x17205d>=_0xfb278d){_0x17205d=_0xfb278d;_0x40a967=0xc8;}else{_0x40a967=0xce;}_0x37653d[_0x9da1('0x18')](_0x40a967);return _0x37653d[_0x9da1('0x1e')]('Content-Range',_0x497676+'-'+_0x17205d+'/'+_0xfb278d)[_0x9da1('0x19')](_0x7f1a64);}return null;};}function patchUpdates(_0x554845){return function(_0x9c3b37){try{jsonpatch[_0x9da1('0x1f')](_0x9c3b37,_0x554845,!![]);}catch(_0x1fc065){return BPromise['reject'](_0x1fc065);}return _0x9c3b37['save']();};}function saveUpdates(_0x14793b,_0x3e6f85){return function(_0x16ee0c){if(_0x16ee0c){return _0x16ee0c[_0x9da1('0x20')](_0x14793b)[_0x9da1('0x21')](function(_0x165b73){return _0x165b73;});}return null;};}function removeEntity(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(_0x3bfa40){return _0x3bfa40['destroy']()[_0x9da1('0x21')](function(){var _0x3f5680=_0x3bfa40['get']({'plain':!![]});var _0x2fd49c=_0x9da1('0x22');return db['UserProfileResource'][_0x9da1('0x23')]({'where':{'type':_0x2fd49c,'resourceId':_0x3f5680['id']}})[_0x9da1('0x21')](function(){return _0x3bfa40;});})['then'](function(){_0x4c60aa['status'](0xcc)[_0x9da1('0x24')]();});}};}function handleEntityNotFound(_0x47055e,_0x5eca5b){return function(_0x27c6e2){if(!_0x27c6e2){_0x47055e['sendStatus'](0x194);}return _0x27c6e2;};}function handleError(_0x5a6f2d,_0x5a59c2){_0x5a59c2=_0x5a59c2||0x1f4;return function(_0x31b826){logger[_0x9da1('0x25')](_0x31b826[_0x9da1('0x26')]);if(_0x31b826[_0x9da1('0x27')]){delete _0x31b826[_0x9da1('0x27')];}_0x5a6f2d['status'](_0x5a59c2)[_0x9da1('0x28')](_0x31b826);};}exports['index']=function(_0x1feae0,_0x235ced){var _0x5b38b3={},_0xc29ba8={},_0x2eb48f={'count':0x0,'rows':[]};var _0x4f318b=_[_0x9da1('0x29')](db[_0x9da1('0x2a')][_0x9da1('0x2b')],function(_0x2b2b48){return{'name':_0x2b2b48['fieldName'],'type':_0x2b2b48['type'][_0x9da1('0x2c')]};});_0xc29ba8[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x4f318b,_0x9da1('0x27'));_0xc29ba8[_0x9da1('0x2e')]=_['keys'](_0x1feae0[_0x9da1('0x2e')]);_0xc29ba8[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8[_0x9da1('0x2d')],_0xc29ba8[_0x9da1('0x2e')]);_0x5b38b3[_0x9da1('0x31')]=_['intersection'](_0xc29ba8[_0x9da1('0x2d')],qs['fields'](_0x1feae0['query'][_0x9da1('0x32')]));_0x5b38b3['attributes']=_0x5b38b3[_0x9da1('0x31')][_0x9da1('0x33')]?_0x5b38b3[_0x9da1('0x31')]:_0xc29ba8[_0x9da1('0x2d')];if(!_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x5b38b3[_0x9da1('0x1c')]=qs['limit'](_0x1feae0[_0x9da1('0x2e')]['limit']);_0x5b38b3[_0x9da1('0x1a')]=qs['offset'](_0x1feae0['query'][_0x9da1('0x1a')]);}_0x5b38b3['order']=qs[_0x9da1('0x36')](_0x1feae0[_0x9da1('0x2e')]['sort']);_0x5b38b3[_0x9da1('0x37')]=qs[_0x9da1('0x2f')](_[_0x9da1('0x38')](_0x1feae0[_0x9da1('0x2e')],_0xc29ba8['filters']),_0x4f318b);if(_0x1feae0[_0x9da1('0x2e')]['filter']){_0x5b38b3[_0x9da1('0x37')]=_['merge'](_0x5b38b3[_0x9da1('0x37')],{'$or':_[_0x9da1('0x29')](_0x4f318b,function(_0x58e165){if(_0x58e165[_0x9da1('0x39')]!==_0x9da1('0x3a')){var _0x394acf={};_0x394acf[_0x58e165['name']]={'$like':'%'+_0x1feae0['query']['filter']+'%'};return _0x394acf;}})});}_0x5b38b3=_[_0x9da1('0x3b')]({},_0x5b38b3,_0x1feae0['options']);var _0x5b215c={'where':_0x5b38b3[_0x9da1('0x37')]};return db[_0x9da1('0x2a')][_0x9da1('0x1d')](_0x5b215c)['then'](function(_0x42dbd8){_0x2eb48f[_0x9da1('0x1d')]=_0x42dbd8;if(_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x3c')]){_0x5b38b3[_0x9da1('0x3d')]=[{'all':!![]}];}return db[_0x9da1('0x2a')][_0x9da1('0x3e')](_0x5b38b3);})['then'](function(_0x467350){_0x2eb48f['rows']=_0x467350;return _0x2eb48f;})[_0x9da1('0x21')](respondWithFilteredResult(_0x235ced,_0x5b38b3))['catch'](handleError(_0x235ced,null));};exports[_0x9da1('0x3f')]=function(_0x40d848,_0x599211){var _0x265366={'raw':!![],'where':{'id':_0x40d848['params']['id']}},_0xfeec5f={};_0xfeec5f[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x2a')][_0x9da1('0x2b')]);_0xfeec5f['query']=_['keys'](_0x40d848[_0x9da1('0x2e')]);_0xfeec5f[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],_0xfeec5f[_0x9da1('0x2e')]);_0x265366[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],qs['fields'](_0x40d848[_0x9da1('0x2e')][_0x9da1('0x32')]));_0x265366[_0x9da1('0x31')]=_0x265366['attributes'][_0x9da1('0x33')]?_0x265366[_0x9da1('0x31')]:_0xfeec5f[_0x9da1('0x2d')];if(_0x40d848['query'][_0x9da1('0x3c')]){_0x265366[_0x9da1('0x3d')]=[{'all':!![]}];}_0x265366=_[_0x9da1('0x3b')]({},_0x265366,_0x40d848['options']);return db[_0x9da1('0x2a')]['find'](_0x265366)['then'](handleEntityNotFound(_0x599211,null))[_0x9da1('0x21')](respondWithResult(_0x599211,null))[_0x9da1('0x40')](handleError(_0x599211,null));};exports['create']=function(_0x712d10,_0x2066d2){return db['AnalyticDefaultReport'][_0x9da1('0x41')](_0x712d10[_0x9da1('0x42')],{})[_0x9da1('0x21')](function(_0x3a529d){var _0x4780ca=_0x712d10[_0x9da1('0x43')][_0x9da1('0x44')]({'plain':!![]});if(!_0x4780ca)throw new Error(_0x9da1('0x45'));if(_0x4780ca[_0x9da1('0x46')]==='user'){var _0x147c65=_0x3a529d[_0x9da1('0x44')]({'plain':!![]});var _0x34a203=_0x9da1('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x34a203,'userProfileId':_0x4780ca[_0x9da1('0x48')]},'raw':!![]})[_0x9da1('0x21')](function(_0x3870dd){if(_0x3870dd&&_0x3870dd[_0x9da1('0x49')]===0x0){return db[_0x9da1('0x4a')][_0x9da1('0x41')]({'name':_0x147c65[_0x9da1('0x27')],'resourceId':_0x147c65['id'],'type':_0x9da1('0x22'),'sectionId':_0x3870dd['id']},{})[_0x9da1('0x21')](function(){return _0x3a529d;});}else{return _0x3a529d;}})[_0x9da1('0x40')](function(_0x868167){logger[_0x9da1('0x25')](_0x9da1('0x4b'),_0x868167);throw _0x868167;});}return _0x3a529d;})[_0x9da1('0x21')](respondWithResult(_0x2066d2,0xc9))['catch'](handleError(_0x2066d2,null));};exports[_0x9da1('0x20')]=function(_0x1fbb5d,_0x4d241a){if(_0x1fbb5d[_0x9da1('0x42')]['id']){delete _0x1fbb5d['body']['id'];}return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x1fbb5d[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4d241a,null))[_0x9da1('0x21')](saveUpdates(_0x1fbb5d[_0x9da1('0x42')],null))[_0x9da1('0x21')](respondWithResult(_0x4d241a,null))[_0x9da1('0x40')](handleError(_0x4d241a,null));};exports[_0x9da1('0x23')]=function(_0x343b05,_0x170351){return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x343b05[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x170351,null))[_0x9da1('0x21')](removeEntity(_0x170351,null))[_0x9da1('0x40')](handleError(_0x170351,null));};exports[_0x9da1('0x4d')]=function(_0x4607a9,_0x2020d0){var _0x3c01c3=0xa;var _0xfa8d3f=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),_0x9da1('0x50')];var _0x5bda2a={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0xc27b00={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x27ac84=function(_0x10ebc9){return!_[_0x9da1('0x5c')]([_0x9da1('0x5d'),_0x9da1('0x5e'),_0x9da1('0x5f'),'IS\x20NOT\x20EMPTY'],_0x10ebc9);};var _0x5f5dc2=function(_0x454a68){if(!_0x454a68||!_0x454a68['rules']['length']){return'';}for(var _0x5b4a05='(',_0x6f86c3=0x0;_0x6f86c3<_0x454a68['rules'][_0x9da1('0x33')];_0x6f86c3+=0x1){_0x6f86c3>0x0&&(_0x5b4a05+='\x20'+_0x454a68['operator']+'\x20');_0x5b4a05+=_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x61')]?_0x5f5dc2(_0x454a68['rules'][_0x6f86c3][_0x9da1('0x61')]):_0x454a68[_0x9da1('0x60')][_0x6f86c3]['field']+'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x62')]+(_0x27ac84(_0x454a68['rules'][_0x6f86c3]['condition'])?'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x63')]:'');}return _0x5b4a05+')';};var _0x21d00c={'where':{'id':_0x4607a9['params']['id']}},_0x3ca531,_0x236b01,_0x44d7fe,_0x5cb102,_0x3d2c25;_0x21d00c=_['merge']({},_0x21d00c,_0x4607a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0x21d00c)[_0x9da1('0x21')](function(_0x3382b1){if(_0x3382b1){_0x3ca531=_0x3382b1;return _0x3382b1[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x1f2a4b){if(_0x1f2a4b){if(!_0x1f2a4b[_0x9da1('0x33')]){throw new db['Sequelize'][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x236b01=_0x1f2a4b;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x491fcb){if(_0x491fcb){_0x44d7fe=_[_0x9da1('0x6a')](_0x491fcb,'id');var _0x13fadd;var _0x419f78=squel[_0x9da1('0x6b')]();_0x419f78[_0x9da1('0x6c')](_0x3ca531[_0x9da1('0x6d')]);for(var _0x55a6d2=0x0;_0x55a6d2<_0x236b01[_0x9da1('0x33')];_0x55a6d2+=0x1){_0x13fadd=_0x236b01[_0x55a6d2]['MetricId']?_0x44d7fe[_0x236b01[_0x55a6d2][_0x9da1('0x6e')]]['metric']:_0x236b01[_0x55a6d2][_0x9da1('0x6f')];_0x13fadd=_0x236b01[_0x55a6d2][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x5bda2a[_0x236b01[_0x55a6d2][_0x9da1('0x70')]],'%s',_0x13fadd):_0x13fadd;_0x13fadd=_0x236b01[_0x55a6d2]['format']?_['replace'](_0xc27b00[_0x236b01[_0x55a6d2]['format']],'%s',_0x13fadd):_0x13fadd;if(_0x236b01[_0x55a6d2][_0x9da1('0x72')]){_0x419f78[_0x9da1('0x61')](_0x13fadd);}_0x236b01[_0x55a6d2][_0x9da1('0x73')]&&_0x419f78[_0x9da1('0x74')](_0x13fadd,_0x236b01[_0x55a6d2]['orderBy']==='DESC'?![]:!![]);_0x419f78[_0x9da1('0x6f')](_0x13fadd,_0x236b01[_0x55a6d2][_0x9da1('0x75')]||_0x13fadd);}if(_0x3ca531[_0x9da1('0x76')]){_0x3ca531['joins']=JSON['parse'](_0x3ca531[_0x9da1('0x76')]);for(var _0x1deb93=0x0;_0x1deb93<_0x3ca531[_0x9da1('0x76')]['length'];_0x1deb93+=0x1){if(_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0xfa8d3f,_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x39')])&&_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey']&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')]&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x78')]){_0x419f78[_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]](_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0x3ca531[_0x9da1('0x6d')],_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey'],_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],_0x3ca531['joins'][_0x1deb93][_0x9da1('0x78')]));}}}if(_0x3ca531['conditions']){_0x3ca531[_0x9da1('0x7a')]=JSON['parse'](_0x3ca531[_0x9da1('0x7a')]);_0x419f78[_0x9da1('0x37')](_0x5f5dc2(_0x3ca531[_0x9da1('0x7a')][_0x9da1('0x61')]));}_0x3d2c25=_0x419f78[_0x9da1('0x7b')]();_0x419f78[_0x9da1('0x1c')](_0x3c01c3);_0x419f78[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x419f78[_0x9da1('0x7e')]());return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x419f78[_0x9da1('0x7e')](),{'type':dbH['sequelize'][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](respondWithResult(_0x2020d0,null))[_0x9da1('0x40')](handleError(_0x2020d0,null));};function runReport(_0x162597,_0x4f39bc,_0x1ca102){var _0x2eb5e6=_0x4f39bc['name'];var _0x4a4cda=0xa;var _0x84f8d8=[_0x9da1('0x4e'),_0x9da1('0x82'),_0x9da1('0x4f'),_0x9da1('0x50')];var _0x4701b3={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x3a0a84={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':_0x9da1('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9da1('0x84')};var _0x354c5a=function(_0x53ab6a){return!_[_0x9da1('0x5c')](['IS\x20NULL',_0x9da1('0x5e'),'IS\x20EMPTY',_0x9da1('0x85')],_0x53ab6a);};var _0x106bd9=function(_0x347cb8){if(!_0x347cb8||!_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x3e331a='(',_0x1f785c=0x0;_0x1f785c<_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')];_0x1f785c+=0x1){_0x1f785c>0x0&&(_0x3e331a+='\x20'+_0x347cb8[_0x9da1('0x86')]+'\x20');_0x3e331a+=_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x61')]?_0x106bd9(_0x347cb8['rules'][_0x1f785c][_0x9da1('0x61')]):_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x6f')]+'\x20'+_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x62')]+(_0x354c5a(_0x347cb8[_0x9da1('0x60')][_0x1f785c]['condition'])?'\x20'+_0x347cb8['rules'][_0x1f785c][_0x9da1('0x63')]:'');}return _0x3e331a+')';};var _0xdecc82={'where':{'id':_0x162597['id']}},_0xe12dd7,_0x4cd85f,_0x4bf74c,_0x28335d,_0x175b4b;_0xdecc82=_[_0x9da1('0x3b')]({},_0xdecc82,_0x1ca102);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xdecc82)[_0x9da1('0x21')](function(_0x5561f0){if(_0x5561f0){_0xe12dd7=_0x5561f0;return _0x5561f0[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x5a64fd){if(_0x5a64fd){if(!_0x5a64fd['length']){throw new db[(_0x9da1('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cd85f=_0x5a64fd;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x18ae08){if(_0x18ae08){_0x4bf74c=_[_0x9da1('0x6a')](_0x18ae08,'id');var _0x30065d;var _0x40a2ef=squel[_0x9da1('0x6b')]();_0x40a2ef['from'](_0xe12dd7['table']);for(var _0xd10ba4=0x0;_0xd10ba4<_0x4cd85f[_0x9da1('0x33')];_0xd10ba4+=0x1){_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]?_0x4bf74c[_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]][_0x9da1('0x88')]:_0x4cd85f[_0xd10ba4][_0x9da1('0x6f')];_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x4701b3[_0x4cd85f[_0xd10ba4]['function']],'%s',_0x30065d):_0x30065d;_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]?_['replace'](_0x3a0a84[_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]],'%s',_0x30065d):_0x30065d;if(_0x4cd85f[_0xd10ba4][_0x9da1('0x72')]){_0x40a2ef[_0x9da1('0x61')](_0x30065d);}_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]&&_0x40a2ef[_0x9da1('0x74')](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]===_0x9da1('0x8a')?![]:!![]);_0x40a2ef['field'](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x75')]||_0x30065d);}if(_0xe12dd7['joins']){_0xe12dd7[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0xe12dd7[_0x9da1('0x76')]);for(var _0x22b679=0x0;_0x22b679<_0xe12dd7['joins'][_0x9da1('0x33')];_0x22b679+=0x1){if(_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0x84f8d8,_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')])&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]){_0x40a2ef[_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]](_0xe12dd7['joins'][_0x22b679][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0xe12dd7['table'],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]));}}}if(_0xe12dd7[_0x9da1('0x7a')]){_0xe12dd7[_0x9da1('0x7a')]=JSON['parse'](_0xe12dd7[_0x9da1('0x7a')]);_0x40a2ef[_0x9da1('0x37')](_0x106bd9(_0xe12dd7['conditions'][_0x9da1('0x61')]));}_0x175b4b=_0x40a2ef[_0x9da1('0x7b')]();_0x40a2ef[_0x9da1('0x1c')](_0x4a4cda);_0x40a2ef['offset'](0x0);return;}})['then'](function(){if(_0x4f39bc['output']===_0x9da1('0x8d')){return null;}var _0x3b17aa=_[_0x9da1('0x3b')](_0x4f39bc,{'name':_0x4f39bc['fullPath']||_0x4f39bc['name']||_0xe12dd7[_0x9da1('0x27')],'basename':_0x2eb5e6,'savename':util[_0x9da1('0x89')]('%s-%s.%s',_0x4f39bc[_0x9da1('0x27')]||_0xe12dd7['name'],require('randomstring')['generate'](0x4),_0x4f39bc[_0x9da1('0x8e')]||_0x9da1('0x8f')),'reportId':_0xe12dd7['id'],'reportType':_0x9da1('0x90')});return db[_0x9da1('0x91')][_0x9da1('0x41')](_0x3b17aa,{'raw':!![]});})[_0x9da1('0x21')](function(_0x2aac99){if(_0xe12dd7[_0x9da1('0x6d')]===_0x9da1('0x92')){_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc['startDate'],_0x4f39bc['endDate']);}else{_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc[_0x9da1('0x93')],_0x4f39bc[_0x9da1('0x94')]);}if(_0x2aac99){logger[_0x9da1('0x95')](_0x9da1('0x96'),_0x175b4b[_0x9da1('0x7e')]());require(_0x9da1('0x97'))[_0x9da1('0x98')](path[_0x9da1('0x4e')](__dirname,'../../components/export/',_0x2aac99[_0x9da1('0x8e')]),[_0x2aac99['id'],_0x175b4b[_0x9da1('0x7e')](),path[_0x9da1('0x4e')](__dirname,_0x9da1('0x99'),_0x2aac99[_0x9da1('0x9a')]),_0x2eb5e6]);return _0x2aac99;}else{var _0x5ad3f8=squel[_0x9da1('0x6b')]();_0x5ad3f8['from']('('+_0x175b4b[_0x9da1('0x7e')]()+')',_0x9da1('0x9b'));_0x5ad3f8[_0x9da1('0x6f')]('COUNT(*)','count');_0x175b4b[_0x9da1('0x1c')](_0x4f39bc[_0x9da1('0x1c')]||_0x4a4cda);_0x175b4b[_0x9da1('0x1a')](_0x4f39bc['offset']||0x0);return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x5ad3f8['toString'](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')]['SELECT']})['then'](function(_0x489b3f){if(!_0x489b3f[_0x9da1('0x33')]){_0x28335d=0x0;}else{_0x28335d=_0x489b3f[0x0]['count']||0x0;}return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x175b4b[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});})['then'](function(_0x355a71){return{'rows':_0x355a71||[],'count':_0x28335d};});}});}exports[_0x9da1('0x9c')]=function(_0x492e1a,_0x449a17){return runReport(_0x492e1a[_0x9da1('0x4c')],_0x492e1a[_0x9da1('0x2e')],_0x492e1a[_0x9da1('0x64')])['then'](respondWithResult(_0x449a17,null))[_0x9da1('0x40')](handleError(_0x449a17,null));};exports[_0x9da1('0x9d')]=runReport;exports[_0x9da1('0x2e')]=function(_0x8280a9,_0x374754){var _0x1e466a=0xa;var _0x3f9133=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),'cross_join'];var _0x3dd3e0={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x52e4a6={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4aa903=function(_0x55d7f2){return!_['includes'](['IS\x20NULL',_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x85')],_0x55d7f2);};var _0x3212ad=function(_0x5ac65b){if(!_0x5ac65b||!_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x21a99d='(',_0xd19a7c=0x0;_0xd19a7c<_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')];_0xd19a7c+=0x1){_0xd19a7c>0x0&&(_0x21a99d+='\x20'+_0x5ac65b[_0x9da1('0x86')]+'\x20');_0x21a99d+=_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]?_0x3212ad(_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]):_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x6f')]+'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c]['condition']+(_0x4aa903(_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x62')])?'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x63')]:'');}return _0x21a99d+')';};var _0xb14af1={'where':{'id':_0x8280a9[_0x9da1('0x4c')]['id']}},_0x245566,_0x5b2591,_0x3c51e3,_0x54b83d,_0x23bf86;_0xb14af1=_['merge']({},_0xb14af1,_0x8280a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xb14af1)[_0x9da1('0x21')](function(_0x4bb140){if(_0x4bb140){_0x245566=_0x4bb140;return _0x4bb140[_0x9da1('0x66')]();}return null;})['then'](function(_0x47cbdd){if(_0x47cbdd){if(!_0x47cbdd['length']){throw new db[(_0x9da1('0x87'))][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x5b2591=_0x47cbdd;return db['AnalyticMetric'][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x5e1e24){if(_0x5e1e24){_0x3c51e3=_[_0x9da1('0x6a')](_0x5e1e24,'id');var _0x49ddec;var _0x407218=squel['select']();_0x407218['from'](_0x245566['table']);for(var _0x316fee=0x0;_0x316fee<_0x5b2591['length'];_0x316fee+=0x1){_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x6e')]?_0x3c51e3[_0x5b2591[_0x316fee][_0x9da1('0x6e')]]['metric']:_0x5b2591[_0x316fee]['field'];_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x70')]?_['replace'](_0x3dd3e0[_0x5b2591[_0x316fee][_0x9da1('0x70')]],'%s',_0x49ddec):_0x49ddec;_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x89')]?_['replace'](_0x52e4a6[_0x5b2591[_0x316fee]['format']],'%s',_0x49ddec):_0x49ddec;if(_0x5b2591[_0x316fee][_0x9da1('0x72')]){_0x407218[_0x9da1('0x61')](_0x49ddec);}_0x5b2591[_0x316fee][_0x9da1('0x73')]&&_0x407218[_0x9da1('0x74')](_0x49ddec,_0x5b2591[_0x316fee]['orderBy']==='DESC'?![]:!![]);_0x407218[_0x9da1('0x6f')](_0x49ddec,_0x5b2591[_0x316fee][_0x9da1('0x75')]||_0x49ddec);}if(_0x245566[_0x9da1('0x76')]){_0x245566[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0x245566['joins']);for(var _0x56ec7d=0x0;_0x56ec7d<_0x245566[_0x9da1('0x76')][_0x9da1('0x33')];_0x56ec7d+=0x1){if(_0x245566['joins'][_0x56ec7d][_0x9da1('0x39')]&&_['includes'](_0x3f9133,_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')])&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x8c')]&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')]&&_0x245566['joins'][_0x56ec7d][_0x9da1('0x78')]){_0x407218[_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')]](_0x245566[_0x9da1('0x76')][_0x56ec7d]['foreignTable'],null,util[_0x9da1('0x89')](_0x9da1('0x79'),_0x245566[_0x9da1('0x6d')],_0x245566['joins'][_0x56ec7d]['parentKey'],_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')],_0x245566['joins'][_0x56ec7d]['foreignKey']));}}}if(_0x245566[_0x9da1('0x7a')]){_0x245566[_0x9da1('0x7a')]=JSON[_0x9da1('0x8b')](_0x245566[_0x9da1('0x7a')]);_0x407218[_0x9da1('0x37')](_0x3212ad(_0x245566['conditions'][_0x9da1('0x61')]));}_0x23bf86=_0x407218['clone']();_0x407218[_0x9da1('0x1c')](_0x1e466a);_0x407218[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x407218['toString']());return dbH['sequelize'][_0x9da1('0x2e')](_0x407218[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](function(){return{'sql':_0x23bf86['toString']()};})[_0x9da1('0x21')](respondWithResult(_0x374754,null))[_0x9da1('0x40')](handleError(_0x374754,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 7effb81..a50f8de 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 _0x632c=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1b3009,_0x249b9e){var _0x1a95f6=function(_0x1384f6){while(--_0x1384f6){_0x1b3009['push'](_0x1b3009['shift']());}};_0x1a95f6(++_0x249b9e);}(_0x632c,0x69));var _0xc632=function(_0x3c7f1e,_0x2daf7a){_0x3c7f1e=_0x3c7f1e-0x0;var _0x217234=_0x632c[_0x3c7f1e];return _0x217234;};'use strict';var _=require(_0xc632('0x0'));var util=require(_0xc632('0x1'));var logger=require(_0xc632('0x2'))('api');var moment=require(_0xc632('0x3'));var BPromise=require(_0xc632('0x4'));var rp=require(_0xc632('0x5'));var fs=require('fs');var path=require(_0xc632('0x6'));var rimraf=require(_0xc632('0x7'));var config=require(_0xc632('0x8'));var attributes=require(_0xc632('0x9'));module[_0xc632('0xa')]=function(_0x1f0128,_0x93d5d9){return _0x1f0128[_0xc632('0xb')](_0xc632('0xc'),attributes,{'tableName':_0xc632('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea45=['lodash','util','api','bluebird','./analyticDefaultReport.attributes','exports','analytics_default_reports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea45,0x1a4));var _0x5ea4=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0xea45[_0x3a78a0];return _0x48e917;};'use strict';var _=require(_0x5ea4('0x0'));var util=require(_0x5ea4('0x1'));var logger=require('../../config/logger')(_0x5ea4('0x2'));var moment=require('moment');var BPromise=require(_0x5ea4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5ea4('0x4'));module[_0x5ea4('0x5')]=function(_0x541f27,_0x15b32a){return _0x541f27['define']('AnalyticDefaultReport',attributes,{'tableName':_0x5ea4('0x6'),'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 d162f84..28ec188 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 _0xdf9b=['jayson/promise','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x47e84a,_0x2ca88a){var _0x827058=function(_0x4c7d0a){while(--_0x4c7d0a){_0x47e84a['push'](_0x47e84a['shift']());}};_0x827058(++_0x2ca88a);}(_0xdf9b,0x161));var _0xbdf9=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xdf9b[_0x29d915];return _0x160f86;};'use strict';var _=require(_0xbdf9('0x0'));var util=require('util');var moment=require(_0xbdf9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbdf9('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xbdf9('0x3'));var logger=require(_0xbdf9('0x4'))(_0xbdf9('0x5'));var config=require(_0xbdf9('0x6'));var jayson=require(_0xbdf9('0x7'));var client=jayson[_0xbdf9('0x8')][_0xbdf9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35b060,_0x143f4e,_0x310dcb){return new BPromise(function(_0x348353,_0x357026){return client[_0xbdf9('0xa')](_0x35b060,_0x310dcb)[_0xbdf9('0xb')](function(_0x53ceeb){logger['info'](_0xbdf9('0xc'),_0x143f4e,_0xbdf9('0xd'));logger[_0xbdf9('0xe')](_0xbdf9('0xf'),_0x143f4e,_0xbdf9('0xd'),JSON['stringify'](_0x53ceeb));if(_0x53ceeb[_0xbdf9('0x10')]){if(_0x53ceeb[_0xbdf9('0x10')][_0xbdf9('0x11')]===0x1f4){logger['error'](_0xbdf9('0xc'),_0x143f4e,_0x53ceeb[_0xbdf9('0x10')][_0xbdf9('0x12')]);return _0x357026(_0x53ceeb[_0xbdf9('0x10')][_0xbdf9('0x12')]);}logger[_0xbdf9('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x143f4e,_0x53ceeb[_0xbdf9('0x10')]['message']);return _0x348353(_0x53ceeb['error'][_0xbdf9('0x12')]);}else{logger['info'](_0xbdf9('0xc'),_0x143f4e,_0xbdf9('0xd'));_0x348353(_0x53ceeb['result'][_0xbdf9('0x12')]);}})[_0xbdf9('0x13')](function(_0x19b5c5){logger[_0xbdf9('0x10')](_0xbdf9('0xc'),_0x143f4e,_0x19b5c5);_0x357026(_0x19b5c5);});});} \ No newline at end of file +var _0x63bb=['then','info','AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x245cab,_0x565284){var _0x144703=function(_0xcbc535){while(--_0xcbc535){_0x245cab['push'](_0x245cab['shift']());}};_0x144703(++_0x565284);}(_0x63bb,0x6d));var _0xb63b=function(_0x1653bf,_0x43083b){_0x1653bf=_0x1653bf-0x0;var _0xe57166=_0x63bb[_0x1653bf];return _0xe57166;};'use strict';var _=require('lodash');var util=require(_0xb63b('0x0'));var moment=require(_0xb63b('0x1'));var BPromise=require(_0xb63b('0x2'));var rs=require(_0xb63b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb63b('0x4'))['db'];var utils=require(_0xb63b('0x5'));var logger=require(_0xb63b('0x6'))('rpc');var config=require(_0xb63b('0x7'));var jayson=require(_0xb63b('0x8'));var client=jayson['client'][_0xb63b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x374842,_0x4161f6,_0x42f075){return new BPromise(function(_0x1e8612,_0x3fd31b){return client[_0xb63b('0xa')](_0x374842,_0x42f075)[_0xb63b('0xb')](function(_0x246843){logger[_0xb63b('0xc')](_0xb63b('0xd'),_0x4161f6,'request\x20sent');logger['debug'](_0xb63b('0xe'),_0x4161f6,_0xb63b('0xf'),JSON[_0xb63b('0x10')](_0x246843));if(_0x246843['error']){if(_0x246843[_0xb63b('0x11')]['code']===0x1f4){logger[_0xb63b('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4161f6,_0x246843[_0xb63b('0x11')][_0xb63b('0x12')]);return _0x3fd31b(_0x246843[_0xb63b('0x11')]['message']);}logger[_0xb63b('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4161f6,_0x246843[_0xb63b('0x11')][_0xb63b('0x12')]);return _0x1e8612(_0x246843[_0xb63b('0x11')][_0xb63b('0x12')]);}else{logger['info'](_0xb63b('0xd'),_0x4161f6,_0xb63b('0xf'));_0x1e8612(_0x246843['result'][_0xb63b('0x12')]);}})[_0xb63b('0x13')](function(_0x584bac){logger['error'](_0xb63b('0xd'),_0x4161f6,_0x584bac);_0x3fd31b(_0x584bac);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 24b0b4b..1639a9c 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 _0x9311=['create','put','update','exports','multer','path','connect-timeout','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','post'];(function(_0x2a0be1,_0x580dec){var _0x89606=function(_0x29b789){while(--_0x29b789){_0x2a0be1['push'](_0x2a0be1['shift']());}};_0x89606(++_0x580dec);}(_0x9311,0x1b4));var _0x1931=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9311[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x1931('0x0'));var util=require('util');var path=require(_0x1931('0x1'));var timeout=require(_0x1931('0x2'));var express=require(_0x1931('0x3'));var router=express[_0x1931('0x4')]();var fs_extra=require(_0x1931('0x5'));var auth=require(_0x1931('0x6'));var interaction=require(_0x1931('0x7'));var config=require(_0x1931('0x8'));var controller=require(_0x1931('0x9'));router[_0x1931('0xa')]('/',auth[_0x1931('0xb')](),controller[_0x1931('0xc')]);router['get'](_0x1931('0xd'),auth[_0x1931('0xb')](),controller['show']);router[_0x1931('0xa')](_0x1931('0xe'),auth[_0x1931('0xb')](),controller[_0x1931('0xf')]);router['get'](_0x1931('0x10'),auth[_0x1931('0xb')](),controller[_0x1931('0x11')]);router[_0x1931('0xa')](_0x1931('0x12'),auth[_0x1931('0xb')](),controller['query']);router[_0x1931('0x13')]('/',auth[_0x1931('0xb')](),controller[_0x1931('0x14')]);router[_0x1931('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1931('0x16')]);router['delete'](_0x1931('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x1931('0x17')]=router; \ No newline at end of file +var _0xbdf6=['create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','/:id/preview','preview','run','/:id/query','query','post'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbdf6,0x7c));var _0x6bdf=function(_0x411644,_0xe6e988){_0x411644=_0x411644-0x0;var _0x2eefc9=_0xbdf6[_0x411644];return _0x2eefc9;};'use strict';var multer=require(_0x6bdf('0x0'));var util=require(_0x6bdf('0x1'));var path=require(_0x6bdf('0x2'));var timeout=require(_0x6bdf('0x3'));var express=require(_0x6bdf('0x4'));var router=express[_0x6bdf('0x5')]();var fs_extra=require(_0x6bdf('0x6'));var auth=require(_0x6bdf('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6bdf('0x8'));var controller=require(_0x6bdf('0x9'));router['get']('/',auth[_0x6bdf('0xa')](),controller[_0x6bdf('0xb')]);router[_0x6bdf('0xc')](_0x6bdf('0xd'),auth[_0x6bdf('0xa')](),controller['show']);router[_0x6bdf('0xc')](_0x6bdf('0xe'),auth['isAuthenticated'](),controller[_0x6bdf('0xf')]);router[_0x6bdf('0xc')]('/:id/run',auth[_0x6bdf('0xa')](),controller[_0x6bdf('0x10')]);router[_0x6bdf('0xc')](_0x6bdf('0x11'),auth[_0x6bdf('0xa')](),controller[_0x6bdf('0x12')]);router[_0x6bdf('0x13')]('/',auth[_0x6bdf('0xa')](),controller[_0x6bdf('0x14')]);router[_0x6bdf('0x15')](_0x6bdf('0xd'),auth[_0x6bdf('0xa')](),controller[_0x6bdf('0x16')]);router['delete'](_0x6bdf('0xd'),auth[_0x6bdf('0xa')](),controller[_0x6bdf('0x17')]);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 b318ba7..e60d8dc 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 _0x89d8=['Loading','ENUM','scheduled','manual','INTEGER','UNSIGNED','moment','STRING','pdf','csv','DATE'];(function(_0x16d79b,_0x2ffb7d){var _0x19cd8b=function(_0x23ccfc){while(--_0x23ccfc){_0x16d79b['push'](_0x16d79b['shift']());}};_0x19cd8b(++_0x2ffb7d);}(_0x89d8,0xa0));var _0x889d=function(_0x42f0d1,_0x45fe4a){_0x42f0d1=_0x42f0d1-0x0;var _0x43f981=_0x89d8[_0x42f0d1];return _0x43f981;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x889d('0x0'));module['exports']={'name':{'type':Sequelize[_0x889d('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0x889d('0x2'),'xlsx'),'allowNull':![],'defaultValue':_0x889d('0x3')},'savename':{'type':Sequelize[_0x889d('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x889d('0x4')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0x889d('0x5')},'type':{'type':Sequelize[_0x889d('0x6')]('manual',_0x889d('0x7')),'allowNull':![],'defaultValue':_0x889d('0x8')},'reportId':{'type':Sequelize[_0x889d('0x9')](0xb)[_0x889d('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x974a=['moment','exports','STRING','ENUM','csv','pdf','DATE','Loading','manual','INTEGER','UNSIGNED','sequelize'];(function(_0x48863d,_0xb57402){var _0x16c8f1=function(_0xbc21a4){while(--_0xbc21a4){_0x48863d['push'](_0x48863d['shift']());}};_0x16c8f1(++_0xb57402);}(_0x974a,0x137));var _0xa974=function(_0x55a740,_0x2e70eb){_0x55a740=_0x55a740-0x0;var _0xc2679=_0x974a[_0x55a740];return _0xc2679;};'use strict';var Sequelize=require(_0xa974('0x0'));var moment=require(_0xa974('0x1'));module[_0xa974('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xa974('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xa974('0x4')](_0xa974('0x5'),_0xa974('0x6'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xa974('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa974('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xa974('0x3')],'defaultValue':_0xa974('0x8')},'type':{'type':Sequelize[_0xa974('0x4')](_0xa974('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0xa974('0x9')},'reportId':{'type':Sequelize[_0xa974('0xa')](0xb)[_0xa974('0xb')]},'reportType':{'type':Sequelize[_0xa974('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 7dbc797..27ff276 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 _0xf039=['update','then','ExtractedReports','name','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','download','output','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','savename','format','basename','toLowerCase','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','limit','offset','count','status','set','apply','reject','save'];(function(_0x3f9f0f,_0x531b30){var _0x2eb31d=function(_0x43feb1){while(--_0x43feb1){_0x3f9f0f['push'](_0x3f9f0f['shift']());}};_0x2eb31d(++_0x531b30);}(_0xf039,0x1b5));var _0x9f03=function(_0x5dd778,_0x5045e8){_0x5dd778=_0x5dd778-0x0;var _0x359c75=_0xf039[_0x5dd778];return _0x359c75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f03('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f03('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9f03('0x2'));var util=require(_0x9f03('0x3'));var path=require(_0x9f03('0x4'));var sox=require(_0x9f03('0x5'));var csv=require(_0x9f03('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f03('0x7'));var _=require(_0x9f03('0x8'));var squel=require(_0x9f03('0x9'));var crypto=require(_0x9f03('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9f03('0xb'));var toCsv=require(_0x9f03('0x6'));var querystring=require(_0x9f03('0xc'));var Papa=require(_0x9f03('0xd'));var Redis=require(_0x9f03('0xe'));var authService=require(_0x9f03('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f03('0x10'));var logger=require('../../config/logger')(_0x9f03('0x11'));var utils=require(_0x9f03('0x12'));var config=require(_0x9f03('0x13'));var licenseUtil=require(_0x9f03('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48d7b5,_0x2c7b97){_0x2c7b97=_0x2c7b97||0xcc;return function(_0x324fa4){if(_0x324fa4){return _0x48d7b5[_0x9f03('0x15')](_0x2c7b97);}return _0x48d7b5['status'](_0x2c7b97)[_0x9f03('0x16')]();};}function respondWithResult(_0x54e557,_0x56f90b){_0x56f90b=_0x56f90b||0xc8;return function(_0x28379f){if(_0x28379f){return _0x54e557['status'](_0x56f90b)[_0x9f03('0x17')](_0x28379f);}};}function respondWithFilteredResult(_0x1f3101,_0x2f4937){return function(_0x4f2c80){if(_0x4f2c80){var _0x50b236=typeof _0x2f4937['offset']===_0x9f03('0x18')&&typeof _0x2f4937[_0x9f03('0x19')]==='undefined';var _0x56e5c8=_0x4f2c80['count'];var _0x47beca=_0x50b236?0x0:_0x2f4937[_0x9f03('0x1a')];var _0x342c2c=_0x50b236?_0x4f2c80[_0x9f03('0x1b')]:_0x2f4937[_0x9f03('0x1a')]+_0x2f4937[_0x9f03('0x19')];var _0x191788;if(_0x342c2c>=_0x56e5c8){_0x342c2c=_0x56e5c8;_0x191788=0xc8;}else{_0x191788=0xce;}_0x1f3101[_0x9f03('0x1c')](_0x191788);return _0x1f3101[_0x9f03('0x1d')]('Content-Range',_0x47beca+'-'+_0x342c2c+'/'+_0x56e5c8)[_0x9f03('0x17')](_0x4f2c80);}return null;};}function patchUpdates(_0x45003a){return function(_0x10b780){try{jsonpatch[_0x9f03('0x1e')](_0x10b780,_0x45003a,!![]);}catch(_0x4ef30a){return BPromise[_0x9f03('0x1f')](_0x4ef30a);}return _0x10b780[_0x9f03('0x20')]();};}function saveUpdates(_0x3fa7ce,_0x5aff90){return function(_0x525463){if(_0x525463){return _0x525463[_0x9f03('0x21')](_0x3fa7ce)[_0x9f03('0x22')](function(_0x18fefe){return _0x18fefe;});}return null;};}function removeEntity(_0xfb7a2e,_0x573e5b){return function(_0x4a6442){if(_0x4a6442){return _0x4a6442['destroy']()['then'](function(){var _0x467b98=_0x4a6442['get']({'plain':!![]});var _0x3f8e5e=_0x9f03('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x3f8e5e,'resourceId':_0x467b98['id']}})[_0x9f03('0x22')](function(){return _0x4a6442;});})['then'](function(){_0xfb7a2e['status'](0xcc)[_0x9f03('0x16')]();});}};}function handleEntityNotFound(_0x3399b1,_0x1b24da){return function(_0x273081){if(!_0x273081){_0x3399b1['sendStatus'](0x194);}return _0x273081;};}function handleError(_0x4911a2,_0x2b8443){_0x2b8443=_0x2b8443||0x1f4;return function(_0x472de6){logger['error'](_0x472de6['stack']);if(_0x472de6['name']){delete _0x472de6[_0x9f03('0x24')];}_0x4911a2[_0x9f03('0x1c')](_0x2b8443)['send'](_0x472de6);};}exports[_0x9f03('0x25')]=function(_0x2bc133,_0x1a185a){var _0x2965ea={},_0x26086f={},_0x1e4f57={'count':0x0,'rows':[]};var _0x2edd38=_['map'](db[_0x9f03('0x26')][_0x9f03('0x27')],function(_0x3d7601){return{'name':_0x3d7601[_0x9f03('0x28')],'type':_0x3d7601[_0x9f03('0x29')][_0x9f03('0x2a')]};});_0x26086f['model']=_[_0x9f03('0x2b')](_0x2edd38,_0x9f03('0x24'));_0x26086f[_0x9f03('0x2c')]=_[_0x9f03('0x2d')](_0x2bc133[_0x9f03('0x2c')]);_0x26086f[_0x9f03('0x2e')]=_[_0x9f03('0x2f')](_0x26086f[_0x9f03('0x30')],_0x26086f[_0x9f03('0x2c')]);_0x2965ea[_0x9f03('0x31')]=_[_0x9f03('0x2f')](_0x26086f[_0x9f03('0x30')],qs[_0x9f03('0x32')](_0x2bc133['query'][_0x9f03('0x32')]));_0x2965ea[_0x9f03('0x31')]=_0x2965ea[_0x9f03('0x31')][_0x9f03('0x33')]?_0x2965ea[_0x9f03('0x31')]:_0x26086f[_0x9f03('0x30')];if(!_0x2bc133[_0x9f03('0x2c')][_0x9f03('0x34')](_0x9f03('0x35'))){_0x2965ea[_0x9f03('0x19')]=qs[_0x9f03('0x19')](_0x2bc133[_0x9f03('0x2c')]['limit']);_0x2965ea[_0x9f03('0x1a')]=qs[_0x9f03('0x1a')](_0x2bc133[_0x9f03('0x2c')][_0x9f03('0x1a')]);}_0x2965ea[_0x9f03('0x36')]=qs[_0x9f03('0x37')](_0x2bc133[_0x9f03('0x2c')][_0x9f03('0x37')]);_0x2965ea[_0x9f03('0x38')]=qs[_0x9f03('0x2e')](_[_0x9f03('0x39')](_0x2bc133['query'],_0x26086f['filters']),_0x2edd38);if(_0x2bc133[_0x9f03('0x2c')][_0x9f03('0x3a')]){_0x2965ea['where']=_[_0x9f03('0x3b')](_0x2965ea['where'],{'$or':_[_0x9f03('0x2b')](_0x2edd38,function(_0x1f00c4){if(_0x1f00c4['type']!==_0x9f03('0x3c')){var _0x33b29b={};_0x33b29b[_0x1f00c4[_0x9f03('0x24')]]={'$like':'%'+_0x2bc133[_0x9f03('0x2c')]['filter']+'%'};return _0x33b29b;}})});}_0x2965ea=_[_0x9f03('0x3b')]({},_0x2965ea,_0x2bc133[_0x9f03('0x3d')]);var _0x4d26c8={'where':_0x2965ea['where']};return db[_0x9f03('0x26')][_0x9f03('0x1b')](_0x4d26c8)[_0x9f03('0x22')](function(_0x44effa){_0x1e4f57['count']=_0x44effa;if(_0x2bc133[_0x9f03('0x2c')]['includeAll']){_0x2965ea[_0x9f03('0x3e')]=[{'all':!![]}];}return db[_0x9f03('0x26')]['findAll'](_0x2965ea);})[_0x9f03('0x22')](function(_0x1211a5){_0x1e4f57[_0x9f03('0x3f')]=_0x1211a5;return _0x1e4f57;})[_0x9f03('0x22')](respondWithFilteredResult(_0x1a185a,_0x2965ea))[_0x9f03('0x40')](handleError(_0x1a185a,null));};exports[_0x9f03('0x41')]=function(_0x543935,_0x8e3d63){var _0x52a5dd={'raw':!![],'where':{'id':_0x543935[_0x9f03('0x42')]['id']}},_0x56063c={};_0x56063c[_0x9f03('0x30')]=_['keys'](db[_0x9f03('0x26')]['rawAttributes']);_0x56063c[_0x9f03('0x2c')]=_[_0x9f03('0x2d')](_0x543935[_0x9f03('0x2c')]);_0x56063c[_0x9f03('0x2e')]=_[_0x9f03('0x2f')](_0x56063c[_0x9f03('0x30')],_0x56063c[_0x9f03('0x2c')]);_0x52a5dd[_0x9f03('0x31')]=_[_0x9f03('0x2f')](_0x56063c['model'],qs[_0x9f03('0x32')](_0x543935['query'][_0x9f03('0x32')]));_0x52a5dd[_0x9f03('0x31')]=_0x52a5dd[_0x9f03('0x31')][_0x9f03('0x33')]?_0x52a5dd['attributes']:_0x56063c[_0x9f03('0x30')];if(_0x543935[_0x9f03('0x2c')]['includeAll']){_0x52a5dd[_0x9f03('0x3e')]=[{'all':!![]}];}_0x52a5dd=_[_0x9f03('0x3b')]({},_0x52a5dd,_0x543935[_0x9f03('0x3d')]);return db[_0x9f03('0x26')][_0x9f03('0x43')](_0x52a5dd)[_0x9f03('0x22')](handleEntityNotFound(_0x8e3d63,null))[_0x9f03('0x22')](respondWithResult(_0x8e3d63,null))[_0x9f03('0x40')](handleError(_0x8e3d63,null));};exports[_0x9f03('0x44')]=function(_0x3b6371,_0x27ecb7){return db['AnalyticExtractedReport']['create'](_0x3b6371['body'],{})[_0x9f03('0x22')](function(_0x3b81ec){var _0x52d149=_0x3b6371[_0x9f03('0x45')]['get']({'plain':!![]});if(!_0x52d149)throw new Error(_0x9f03('0x46'));if(_0x52d149[_0x9f03('0x47')]===_0x9f03('0x45')){var _0x5ea14f=_0x3b81ec['get']({'plain':!![]});var _0x541bd1=_0x9f03('0x23');return db[_0x9f03('0x48')][_0x9f03('0x43')]({'where':{'name':_0x541bd1,'userProfileId':_0x52d149[_0x9f03('0x49')]},'raw':!![]})[_0x9f03('0x22')](function(_0x5ad7dd){if(_0x5ad7dd&&_0x5ad7dd[_0x9f03('0x4a')]===0x0){return db[_0x9f03('0x4b')][_0x9f03('0x44')]({'name':_0x5ea14f[_0x9f03('0x24')],'resourceId':_0x5ea14f['id'],'type':_0x5ad7dd[_0x9f03('0x24')],'sectionId':_0x5ad7dd['id']},{})['then'](function(){return _0x3b81ec;});}else{return _0x3b81ec;}})[_0x9f03('0x40')](function(_0x2f8fdd){logger[_0x9f03('0x4c')](_0x9f03('0x4d'),_0x2f8fdd);throw _0x2f8fdd;});}return _0x3b81ec;})[_0x9f03('0x22')](respondWithResult(_0x27ecb7,0xc9))[_0x9f03('0x40')](handleError(_0x27ecb7,null));};exports['update']=function(_0x43283e,_0x5e6fd0){if(_0x43283e[_0x9f03('0x4e')]['id']){delete _0x43283e[_0x9f03('0x4e')]['id'];}return db[_0x9f03('0x26')][_0x9f03('0x43')]({'where':{'id':_0x43283e['params']['id']}})[_0x9f03('0x22')](handleEntityNotFound(_0x5e6fd0,null))['then'](saveUpdates(_0x43283e[_0x9f03('0x4e')],null))[_0x9f03('0x22')](respondWithResult(_0x5e6fd0,null))[_0x9f03('0x40')](handleError(_0x5e6fd0,null));};exports[_0x9f03('0x4f')]=function(_0x50b801,_0x31d0f2){return db[_0x9f03('0x26')][_0x9f03('0x43')]({'where':{'id':_0x50b801[_0x9f03('0x42')]['id']}})[_0x9f03('0x22')](handleEntityNotFound(_0x31d0f2,null))[_0x9f03('0x22')](removeEntity(_0x31d0f2,null))['catch'](handleError(_0x31d0f2,null));};exports[_0x9f03('0x50')]=function(_0x47d783,_0x182f28,_0x4027b0){return db['AnalyticExtractedReport'][_0x9f03('0x43')]({'where':{'id':_0x47d783[_0x9f03('0x42')]['id']},'attributes':[_0x9f03('0x24'),'basename','savename',_0x9f03('0x51')],'raw':!![]})[_0x9f03('0x22')](handleEntityNotFound(_0x182f28,null))['then'](function(_0x518149){if(_0x518149){if(!fs[_0x9f03('0x52')](path[_0x9f03('0x53')](config[_0x9f03('0x54')],'server/files/reports',_0x518149['savename']))){throw new db[(_0x9f03('0x55'))][(_0x9f03('0x56'))](_0x9f03('0x57'));}if(_0x47d783[_0x9f03('0x2c')][_0x9f03('0x58')]){return _0x182f28[_0x9f03('0x15')](0xc8);}return _0x182f28[_0x9f03('0x50')](path[_0x9f03('0x53')](config['root'],_0x9f03('0x59'),_0x518149[_0x9f03('0x5a')]),util[_0x9f03('0x5b')]('%s.%s',_0x518149[_0x9f03('0x5c')]||_0x518149['name'],_0x518149['output'][_0x9f03('0x5d')]()));}})[_0x9f03('0x40')](handleError(_0x182f28,null));}; \ No newline at end of file +var _0xd227=['where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','download','%s.%s','toLowerCase','rimraf','moment','bluebird','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3aa0f0,_0x14b9c6){var _0x3dc85d=function(_0x1ce464){while(--_0x1ce464){_0x3aa0f0['push'](_0x3aa0f0['shift']());}};_0x3dc85d(++_0x14b9c6);}(_0xd227,0x13a));var _0x7d22=function(_0x4ed6c7,_0x2e6803){_0x4ed6c7=_0x4ed6c7-0x0;var _0x112d0c=_0xd227[_0x4ed6c7];return _0x112d0c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d22('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7d22('0x1'));var BPromise=require(_0x7d22('0x2'));var Mustache=require('mustache');var util=require(_0x7d22('0x3'));var path=require(_0x7d22('0x4'));var sox=require(_0x7d22('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d22('0x6'));var squel=require(_0x7d22('0x7'));var crypto=require('crypto');var jsforce=require(_0x7d22('0x8'));var deskjs=require(_0x7d22('0x9'));var toCsv=require(_0x7d22('0xa'));var querystring=require(_0x7d22('0xb'));var Papa=require(_0x7d22('0xc'));var Redis=require('ioredis');var authService=require(_0x7d22('0xd'));var qs=require(_0x7d22('0xe'));var as=require(_0x7d22('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d22('0x10'))('api');var utils=require(_0x7d22('0x11'));var config=require(_0x7d22('0x12'));var licenseUtil=require(_0x7d22('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfe99f1,_0x5b9388){_0x5b9388=_0x5b9388||0xcc;return function(_0xde93c0){if(_0xde93c0){return _0xfe99f1['sendStatus'](_0x5b9388);}return _0xfe99f1[_0x7d22('0x14')](_0x5b9388)[_0x7d22('0x15')]();};}function respondWithResult(_0x86d699,_0x2350d1){_0x2350d1=_0x2350d1||0xc8;return function(_0x47a7b5){if(_0x47a7b5){return _0x86d699[_0x7d22('0x14')](_0x2350d1)['json'](_0x47a7b5);}};}function respondWithFilteredResult(_0xe632d,_0x16637d){return function(_0x12bcbc){if(_0x12bcbc){var _0x499aea=typeof _0x16637d['offset']===_0x7d22('0x16')&&typeof _0x16637d[_0x7d22('0x17')]==='undefined';var _0x367709=_0x12bcbc[_0x7d22('0x18')];var _0x3f977a=_0x499aea?0x0:_0x16637d['offset'];var _0x5ec42b=_0x499aea?_0x12bcbc[_0x7d22('0x18')]:_0x16637d[_0x7d22('0x19')]+_0x16637d[_0x7d22('0x17')];var _0xdfdade;if(_0x5ec42b>=_0x367709){_0x5ec42b=_0x367709;_0xdfdade=0xc8;}else{_0xdfdade=0xce;}_0xe632d[_0x7d22('0x14')](_0xdfdade);return _0xe632d[_0x7d22('0x1a')](_0x7d22('0x1b'),_0x3f977a+'-'+_0x5ec42b+'/'+_0x367709)['json'](_0x12bcbc);}return null;};}function patchUpdates(_0x30c6c9){return function(_0x1c8027){try{jsonpatch['apply'](_0x1c8027,_0x30c6c9,!![]);}catch(_0x106a9a){return BPromise[_0x7d22('0x1c')](_0x106a9a);}return _0x1c8027[_0x7d22('0x1d')]();};}function saveUpdates(_0x2dbf55,_0xe0364e){return function(_0x4a4a55){if(_0x4a4a55){return _0x4a4a55[_0x7d22('0x1e')](_0x2dbf55)[_0x7d22('0x1f')](function(_0x4a4b5f){return _0x4a4b5f;});}return null;};}function removeEntity(_0x24b5d7,_0x540841){return function(_0x7040c7){if(_0x7040c7){return _0x7040c7[_0x7d22('0x20')]()[_0x7d22('0x1f')](function(){var _0x298b65=_0x7040c7['get']({'plain':!![]});var _0x25d724=_0x7d22('0x21');return db[_0x7d22('0x22')]['destroy']({'where':{'type':_0x25d724,'resourceId':_0x298b65['id']}})['then'](function(){return _0x7040c7;});})[_0x7d22('0x1f')](function(){_0x24b5d7[_0x7d22('0x14')](0xcc)[_0x7d22('0x15')]();});}};}function handleEntityNotFound(_0x501c12,_0x380963){return function(_0x1924cc){if(!_0x1924cc){_0x501c12['sendStatus'](0x194);}return _0x1924cc;};}function handleError(_0x1bfff5,_0x4ced06){_0x4ced06=_0x4ced06||0x1f4;return function(_0x5827fc){logger[_0x7d22('0x23')](_0x5827fc[_0x7d22('0x24')]);if(_0x5827fc[_0x7d22('0x25')]){delete _0x5827fc[_0x7d22('0x25')];}_0x1bfff5[_0x7d22('0x14')](_0x4ced06)[_0x7d22('0x26')](_0x5827fc);};}exports[_0x7d22('0x27')]=function(_0x43fa8d,_0x512746){var _0x293b3c={},_0x1c5ef3={},_0x528e4b={'count':0x0,'rows':[]};var _0x5be8b8=_[_0x7d22('0x28')](db[_0x7d22('0x29')][_0x7d22('0x2a')],function(_0x5a78e2){return{'name':_0x5a78e2[_0x7d22('0x2b')],'type':_0x5a78e2[_0x7d22('0x2c')][_0x7d22('0x2d')]};});_0x1c5ef3[_0x7d22('0x2e')]=_[_0x7d22('0x28')](_0x5be8b8,'name');_0x1c5ef3[_0x7d22('0x2f')]=_[_0x7d22('0x30')](_0x43fa8d[_0x7d22('0x2f')]);_0x1c5ef3[_0x7d22('0x31')]=_[_0x7d22('0x32')](_0x1c5ef3['model'],_0x1c5ef3['query']);_0x293b3c['attributes']=_[_0x7d22('0x32')](_0x1c5ef3['model'],qs[_0x7d22('0x33')](_0x43fa8d[_0x7d22('0x2f')][_0x7d22('0x33')]));_0x293b3c[_0x7d22('0x34')]=_0x293b3c[_0x7d22('0x34')][_0x7d22('0x35')]?_0x293b3c[_0x7d22('0x34')]:_0x1c5ef3[_0x7d22('0x2e')];if(!_0x43fa8d[_0x7d22('0x2f')][_0x7d22('0x36')](_0x7d22('0x37'))){_0x293b3c[_0x7d22('0x17')]=qs[_0x7d22('0x17')](_0x43fa8d[_0x7d22('0x2f')][_0x7d22('0x17')]);_0x293b3c['offset']=qs['offset'](_0x43fa8d['query'][_0x7d22('0x19')]);}_0x293b3c[_0x7d22('0x38')]=qs[_0x7d22('0x39')](_0x43fa8d[_0x7d22('0x2f')][_0x7d22('0x39')]);_0x293b3c[_0x7d22('0x3a')]=qs[_0x7d22('0x31')](_['pick'](_0x43fa8d[_0x7d22('0x2f')],_0x1c5ef3[_0x7d22('0x31')]),_0x5be8b8);if(_0x43fa8d['query'][_0x7d22('0x3b')]){_0x293b3c[_0x7d22('0x3a')]=_[_0x7d22('0x3c')](_0x293b3c[_0x7d22('0x3a')],{'$or':_['map'](_0x5be8b8,function(_0x163c48){if(_0x163c48['type']!==_0x7d22('0x3d')){var _0x49abac={};_0x49abac[_0x163c48[_0x7d22('0x25')]]={'$like':'%'+_0x43fa8d['query'][_0x7d22('0x3b')]+'%'};return _0x49abac;}})});}_0x293b3c=_[_0x7d22('0x3c')]({},_0x293b3c,_0x43fa8d['options']);var _0x19379b={'where':_0x293b3c[_0x7d22('0x3a')]};return db[_0x7d22('0x29')][_0x7d22('0x18')](_0x19379b)[_0x7d22('0x1f')](function(_0x101560){_0x528e4b[_0x7d22('0x18')]=_0x101560;if(_0x43fa8d[_0x7d22('0x2f')][_0x7d22('0x3e')]){_0x293b3c[_0x7d22('0x3f')]=[{'all':!![]}];}return db[_0x7d22('0x29')][_0x7d22('0x40')](_0x293b3c);})[_0x7d22('0x1f')](function(_0xde943e){_0x528e4b[_0x7d22('0x41')]=_0xde943e;return _0x528e4b;})['then'](respondWithFilteredResult(_0x512746,_0x293b3c))[_0x7d22('0x42')](handleError(_0x512746,null));};exports[_0x7d22('0x43')]=function(_0x1838b6,_0x49694c){var _0x4f13e7={'raw':!![],'where':{'id':_0x1838b6[_0x7d22('0x44')]['id']}},_0x41ab39={};_0x41ab39[_0x7d22('0x2e')]=_['keys'](db['AnalyticExtractedReport'][_0x7d22('0x2a')]);_0x41ab39['query']=_[_0x7d22('0x30')](_0x1838b6[_0x7d22('0x2f')]);_0x41ab39[_0x7d22('0x31')]=_[_0x7d22('0x32')](_0x41ab39[_0x7d22('0x2e')],_0x41ab39['query']);_0x4f13e7['attributes']=_[_0x7d22('0x32')](_0x41ab39['model'],qs[_0x7d22('0x33')](_0x1838b6['query'][_0x7d22('0x33')]));_0x4f13e7[_0x7d22('0x34')]=_0x4f13e7[_0x7d22('0x34')][_0x7d22('0x35')]?_0x4f13e7[_0x7d22('0x34')]:_0x41ab39[_0x7d22('0x2e')];if(_0x1838b6[_0x7d22('0x2f')][_0x7d22('0x3e')]){_0x4f13e7[_0x7d22('0x3f')]=[{'all':!![]}];}_0x4f13e7=_['merge']({},_0x4f13e7,_0x1838b6[_0x7d22('0x45')]);return db[_0x7d22('0x29')][_0x7d22('0x46')](_0x4f13e7)['then'](handleEntityNotFound(_0x49694c,null))[_0x7d22('0x1f')](respondWithResult(_0x49694c,null))[_0x7d22('0x42')](handleError(_0x49694c,null));};exports['create']=function(_0x1615f2,_0x48881e){return db['AnalyticExtractedReport'][_0x7d22('0x47')](_0x1615f2[_0x7d22('0x48')],{})[_0x7d22('0x1f')](function(_0xb3ce2){var _0x410c8b=_0x1615f2[_0x7d22('0x49')]['get']({'plain':!![]});if(!_0x410c8b)throw new Error(_0x7d22('0x4a'));if(_0x410c8b[_0x7d22('0x4b')]===_0x7d22('0x49')){var _0x290ade=_0xb3ce2[_0x7d22('0x4c')]({'plain':!![]});var _0xbacc67=_0x7d22('0x21');return db[_0x7d22('0x4d')][_0x7d22('0x46')]({'where':{'name':_0xbacc67,'userProfileId':_0x410c8b['userProfileId']},'raw':!![]})[_0x7d22('0x1f')](function(_0x4efc90){if(_0x4efc90&&_0x4efc90['autoAssociation']===0x0){return db[_0x7d22('0x22')][_0x7d22('0x47')]({'name':_0x290ade[_0x7d22('0x25')],'resourceId':_0x290ade['id'],'type':_0x4efc90['name'],'sectionId':_0x4efc90['id']},{})['then'](function(){return _0xb3ce2;});}else{return _0xb3ce2;}})[_0x7d22('0x42')](function(_0x347540){logger[_0x7d22('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x347540);throw _0x347540;});}return _0xb3ce2;})[_0x7d22('0x1f')](respondWithResult(_0x48881e,0xc9))['catch'](handleError(_0x48881e,null));};exports[_0x7d22('0x1e')]=function(_0x4736ef,_0x3824a1){if(_0x4736ef['body']['id']){delete _0x4736ef[_0x7d22('0x48')]['id'];}return db[_0x7d22('0x29')][_0x7d22('0x46')]({'where':{'id':_0x4736ef['params']['id']}})['then'](handleEntityNotFound(_0x3824a1,null))[_0x7d22('0x1f')](saveUpdates(_0x4736ef['body'],null))[_0x7d22('0x1f')](respondWithResult(_0x3824a1,null))[_0x7d22('0x42')](handleError(_0x3824a1,null));};exports[_0x7d22('0x20')]=function(_0x1c982d,_0x176ce5){return db[_0x7d22('0x29')][_0x7d22('0x46')]({'where':{'id':_0x1c982d['params']['id']}})[_0x7d22('0x1f')](handleEntityNotFound(_0x176ce5,null))[_0x7d22('0x1f')](removeEntity(_0x176ce5,null))[_0x7d22('0x42')](handleError(_0x176ce5,null));};exports['download']=function(_0x4acfcd,_0x16c9f2,_0x5b5295){return db[_0x7d22('0x29')]['find']({'where':{'id':_0x4acfcd[_0x7d22('0x44')]['id']},'attributes':[_0x7d22('0x25'),_0x7d22('0x4e'),_0x7d22('0x4f'),_0x7d22('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x16c9f2,null))[_0x7d22('0x1f')](function(_0xdd9a74){if(_0xdd9a74){if(!fs[_0x7d22('0x51')](path[_0x7d22('0x52')](config[_0x7d22('0x53')],_0x7d22('0x54'),_0xdd9a74[_0x7d22('0x4f')]))){throw new db[(_0x7d22('0x55'))][(_0x7d22('0x56'))](_0x7d22('0x57'));}if(_0x4acfcd[_0x7d22('0x2f')][_0x7d22('0x58')]){return _0x16c9f2[_0x7d22('0x59')](0xc8);}return _0x16c9f2[_0x7d22('0x5a')](path[_0x7d22('0x52')](config['root'],_0x7d22('0x54'),_0xdd9a74[_0x7d22('0x4f')]),util['format'](_0x7d22('0x5b'),_0xdd9a74[_0x7d22('0x4e')]||_0xdd9a74[_0x7d22('0x25')],_0xdd9a74['output'][_0x7d22('0x5c')]()));}})['catch'](handleError(_0x16c9f2,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index d5b3326..ae99824 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 _0x9425=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment','request-promise','path','rimraf','./analyticExtractedReport.attributes','exports'];(function(_0x1028fa,_0x35294b){var _0x4b9f16=function(_0x1e872a){while(--_0x1e872a){_0x1028fa['push'](_0x1028fa['shift']());}};_0x4b9f16(++_0x35294b);}(_0x9425,0x93));var _0x5942=function(_0xcde34b,_0x32d4e3){_0xcde34b=_0xcde34b-0x0;var _0x5c90b0=_0x9425[_0xcde34b];return _0x5c90b0;};'use strict';var _=require(_0x5942('0x0'));var util=require(_0x5942('0x1'));var logger=require('../../config/logger')(_0x5942('0x2'));var moment=require(_0x5942('0x3'));var BPromise=require('bluebird');var rp=require(_0x5942('0x4'));var fs=require('fs');var path=require(_0x5942('0x5'));var rimraf=require(_0x5942('0x6'));var config=require('../../config/environment');var attributes=require(_0x5942('0x7'));module[_0x5942('0x8')]=function(_0x573365,_0x4ce87d){return _0x573365[_0x5942('0x9')](_0x5942('0xa'),attributes,{'tableName':_0x5942('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x826c=['bluebird','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','lodash','../../config/logger','api'];(function(_0x4486d8,_0x18aacd){var _0x55684a=function(_0x26a2c){while(--_0x26a2c){_0x4486d8['push'](_0x4486d8['shift']());}};_0x55684a(++_0x18aacd);}(_0x826c,0x1c8));var _0xc826=function(_0x325e5b,_0x4096f9){_0x325e5b=_0x325e5b-0x0;var _0xfd6072=_0x826c[_0x325e5b];return _0xfd6072;};'use strict';var _=require(_0xc826('0x0'));var util=require('util');var logger=require(_0xc826('0x1'))(_0xc826('0x2'));var moment=require('moment');var BPromise=require(_0xc826('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc826('0x4'));var rimraf=require(_0xc826('0x5'));var config=require(_0xc826('0x6'));var attributes=require(_0xc826('0x7'));module[_0xc826('0x8')]=function(_0x159ea9,_0x23c847){return _0x159ea9['define']('AnalyticExtractedReport',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 05e896f..1be3e2d 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 _0x46d9=['request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xdc11a6,_0xaac541){var _0x4241c1=function(_0xca1e71){while(--_0xca1e71){_0xdc11a6['push'](_0xdc11a6['shift']());}};_0x4241c1(++_0xaac541);}(_0x46d9,0x16a));var _0x946d=function(_0x626f11,_0x366baa){_0x626f11=_0x626f11-0x0;var _0x28cb29=_0x46d9[_0x626f11];return _0x28cb29;};'use strict';var _=require(_0x946d('0x0'));var util=require(_0x946d('0x1'));var moment=require(_0x946d('0x2'));var BPromise=require(_0x946d('0x3'));var rs=require(_0x946d('0x4'));var fs=require('fs');var Redis=require(_0x946d('0x5'));var db=require(_0x946d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x946d('0x7'))(_0x946d('0x8'));var config=require(_0x946d('0x9'));var jayson=require(_0x946d('0xa'));var client=jayson[_0x946d('0xb')][_0x946d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd041bc,_0x1fa598,_0x4d4d2d){return new BPromise(function(_0x40b800,_0xf7200a){return client[_0x946d('0xd')](_0xd041bc,_0x4d4d2d)[_0x946d('0xe')](function(_0x22eb59){logger[_0x946d('0xf')](_0x946d('0x10'),_0x1fa598,_0x946d('0x11'));logger[_0x946d('0x12')](_0x946d('0x13'),_0x1fa598,_0x946d('0x11'),JSON['stringify'](_0x22eb59));if(_0x22eb59['error']){if(_0x22eb59[_0x946d('0x14')][_0x946d('0x15')]===0x1f4){logger[_0x946d('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1fa598,_0x22eb59['error'][_0x946d('0x16')]);return _0xf7200a(_0x22eb59[_0x946d('0x14')][_0x946d('0x16')]);}logger[_0x946d('0x14')](_0x946d('0x10'),_0x1fa598,_0x22eb59[_0x946d('0x14')][_0x946d('0x16')]);return _0x40b800(_0x22eb59[_0x946d('0x14')][_0x946d('0x16')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1fa598,_0x946d('0x11'));_0x40b800(_0x22eb59[_0x946d('0x17')][_0x946d('0x16')]);}})[_0x946d('0x18')](function(_0x2a802d){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1fa598,_0x2a802d);_0xf7200a(_0x2a802d);});});} \ No newline at end of file +var _0x9ef6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x9ef6,0x1ca));var _0x69ef=function(_0x5c1cdc,_0x322014){_0x5c1cdc=_0x5c1cdc-0x0;var _0x2e8317=_0x9ef6[_0x5c1cdc];return _0x2e8317;};'use strict';var _=require(_0x69ef('0x0'));var util=require(_0x69ef('0x1'));var moment=require('moment');var BPromise=require(_0x69ef('0x2'));var rs=require(_0x69ef('0x3'));var fs=require('fs');var Redis=require(_0x69ef('0x4'));var db=require(_0x69ef('0x5'))['db'];var utils=require(_0x69ef('0x6'));var logger=require(_0x69ef('0x7'))('rpc');var config=require(_0x69ef('0x8'));var jayson=require(_0x69ef('0x9'));var client=jayson[_0x69ef('0xa')][_0x69ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x597c24,_0x44d502,_0x4c87a2){return new BPromise(function(_0x14dc45,_0x15d883){return client[_0x69ef('0xc')](_0x597c24,_0x4c87a2)[_0x69ef('0xd')](function(_0xc52536){logger[_0x69ef('0xe')](_0x69ef('0xf'),_0x44d502,'request\x20sent');logger[_0x69ef('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x44d502,_0x69ef('0x11'),JSON[_0x69ef('0x12')](_0xc52536));if(_0xc52536[_0x69ef('0x13')]){if(_0xc52536[_0x69ef('0x13')]['code']===0x1f4){logger[_0x69ef('0x13')](_0x69ef('0xf'),_0x44d502,_0xc52536[_0x69ef('0x13')][_0x69ef('0x14')]);return _0x15d883(_0xc52536['error']['message']);}logger['error'](_0x69ef('0xf'),_0x44d502,_0xc52536[_0x69ef('0x13')][_0x69ef('0x14')]);return _0x14dc45(_0xc52536[_0x69ef('0x13')][_0x69ef('0x14')]);}else{logger[_0x69ef('0xe')](_0x69ef('0xf'),_0x44d502,_0x69ef('0x11'));_0x14dc45(_0xc52536[_0x69ef('0x15')][_0x69ef('0x14')]);}})[_0x69ef('0x16')](function(_0x2c229d){logger[_0x69ef('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x44d502,_0x2c229d);_0x15d883(_0x2c229d);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 5ef223d..e976d00 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 _0xc947=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','show','get','download','post','create','put','/:id'];(function(_0x53e519,_0x36a0be){var _0x27ed5c=function(_0x5de347){while(--_0x5de347){_0x53e519['push'](_0x53e519['shift']());}};_0x27ed5c(++_0x36a0be);}(_0xc947,0x88));var _0x7c94=function(_0x4a6e01,_0x512aa9){_0x4a6e01=_0x4a6e01-0x0;var _0x26d16a=_0xc947[_0x4a6e01];return _0x26d16a;};'use strict';var multer=require(_0x7c94('0x0'));var util=require(_0x7c94('0x1'));var path=require(_0x7c94('0x2'));var timeout=require('connect-timeout');var express=require(_0x7c94('0x3'));var router=express[_0x7c94('0x4')]();var fs_extra=require(_0x7c94('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7c94('0x6'));var config=require(_0x7c94('0x7'));var controller=require(_0x7c94('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x7c94('0x9')](),controller[_0x7c94('0xa')]);router[_0x7c94('0xb')]('/:id/download',auth[_0x7c94('0x9')](),controller[_0x7c94('0xc')]);router[_0x7c94('0xd')]('/',auth[_0x7c94('0x9')](),controller[_0x7c94('0xe')]);router[_0x7c94('0xf')](_0x7c94('0x10'),auth[_0x7c94('0x9')](),controller['update']);router['delete'](_0x7c94('0x10'),auth[_0x7c94('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x88c5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','download','post','create','put','update','destroy','util','connect-timeout','express','Router','fs-extra'];(function(_0x51d311,_0x55bce9){var _0x4ab945=function(_0x1a40e4){while(--_0x1a40e4){_0x51d311['push'](_0x51d311['shift']());}};_0x4ab945(++_0x55bce9);}(_0x88c5,0x73));var _0x588c=function(_0x53f964,_0x3b52b8){_0x53f964=_0x53f964-0x0;var _0x17be6c=_0x88c5[_0x53f964];return _0x17be6c;};'use strict';var multer=require('multer');var util=require(_0x588c('0x0'));var path=require('path');var timeout=require(_0x588c('0x1'));var express=require(_0x588c('0x2'));var router=express[_0x588c('0x3')]();var fs_extra=require(_0x588c('0x4'));var auth=require(_0x588c('0x5'));var interaction=require(_0x588c('0x6'));var config=require(_0x588c('0x7'));var controller=require(_0x588c('0x8'));router[_0x588c('0x9')]('/',auth[_0x588c('0xa')](),controller[_0x588c('0xb')]);router[_0x588c('0x9')](_0x588c('0xc'),auth[_0x588c('0xa')](),controller[_0x588c('0xd')]);router['get']('/:id/download',auth[_0x588c('0xa')](),controller[_0x588c('0xe')]);router[_0x588c('0xf')]('/',auth['isAuthenticated'](),controller[_0x588c('0x10')]);router[_0x588c('0x11')](_0x588c('0xc'),auth[_0x588c('0xa')](),controller[_0x588c('0x12')]);router['delete'](_0x588c('0xc'),auth[_0x588c('0xa')](),controller[_0x588c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 3908e22..e7e2c1e 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 _0x1947=['STRING','BOOLEAN','TEXT'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x1947,0x6b));var _0x7194=function(_0x5631b8,_0x246c8f){_0x5631b8=_0x5631b8-0x0;var _0x56757b=_0x1947[_0x5631b8];return _0x56757b;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize[_0x7194('0x0')]},'alias':{'type':Sequelize[_0x7194('0x1')]},'function':{'type':Sequelize[_0x7194('0x1')]},'format':{'type':Sequelize[_0x7194('0x1')]},'groupBy':{'type':Sequelize[_0x7194('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xee8c=['STRING','exports','TEXT'];(function(_0x477491,_0x5ca700){var _0xac6aec=function(_0x180568){while(--_0x180568){_0x477491['push'](_0x477491['shift']());}};_0xac6aec(++_0x5ca700);}(_0xee8c,0xfa));var _0xcee8=function(_0x33793a,_0x515635){_0x33793a=_0x33793a-0x0;var _0x242389=_0xee8c[_0x33793a];return _0x242389;};'use strict';var Sequelize=require('sequelize');module[_0xcee8('0x0')]={'field':{'type':Sequelize[_0xcee8('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xcee8('0x2')]},'format':{'type':Sequelize[_0xcee8('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 8144497..1c75665 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 _0x06e5=['CustomReportId','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','then','destroy','sendStatus','error','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','find','create','bulkCreate','body','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction'];(function(_0x1992f3,_0xbb6172){var _0x347149=function(_0x3d6024){while(--_0x3d6024){_0x1992f3['push'](_0x1992f3['shift']());}};_0x347149(++_0xbb6172);}(_0x06e5,0x1db));var _0x506e=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x06e5[_0x455c6c];return _0x488242;};'use strict';var emlformat=require(_0x506e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x506e('0x1'));var rp=require(_0x506e('0x2'));var moment=require(_0x506e('0x3'));var BPromise=require(_0x506e('0x4'));var Mustache=require(_0x506e('0x5'));var util=require('util');var path=require(_0x506e('0x6'));var sox=require(_0x506e('0x7'));var csv=require(_0x506e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x506e('0x9'));var _=require('lodash');var squel=require(_0x506e('0xa'));var crypto=require('crypto');var jsforce=require(_0x506e('0xb'));var deskjs=require(_0x506e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x506e('0xd'));var Papa=require(_0x506e('0xe'));var Redis=require(_0x506e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x506e('0x10'));var logger=require(_0x506e('0x11'))(_0x506e('0x12'));var utils=require('../../config/utils');var config=require(_0x506e('0x13'));var licenseUtil=require(_0x506e('0x14'));var db=require(_0x506e('0x15'))['db'];function respondWithStatusCode(_0x12e666,_0x3bf3a6){_0x3bf3a6=_0x3bf3a6||0xcc;return function(_0x115c06){if(_0x115c06){return _0x12e666['sendStatus'](_0x3bf3a6);}return _0x12e666[_0x506e('0x16')](_0x3bf3a6)[_0x506e('0x17')]();};}function respondWithResult(_0x2c5b9a,_0x4a5dab){_0x4a5dab=_0x4a5dab||0xc8;return function(_0x3de929){if(_0x3de929){return _0x2c5b9a[_0x506e('0x16')](_0x4a5dab)[_0x506e('0x18')](_0x3de929);}};}function respondWithFilteredResult(_0x4fb193,_0x290993){return function(_0x5d7681){if(_0x5d7681){var _0x2f2ecf=typeof _0x290993['offset']===_0x506e('0x19')&&typeof _0x290993[_0x506e('0x1a')]===_0x506e('0x19');var _0x27d11c=_0x5d7681['count'];var _0x32243e=_0x2f2ecf?0x0:_0x290993['offset'];var _0x11bde7=_0x2f2ecf?_0x5d7681[_0x506e('0x1b')]:_0x290993[_0x506e('0x1c')]+_0x290993['limit'];var _0x2e1df0;if(_0x11bde7>=_0x27d11c){_0x11bde7=_0x27d11c;_0x2e1df0=0xc8;}else{_0x2e1df0=0xce;}_0x4fb193[_0x506e('0x16')](_0x2e1df0);return _0x4fb193['set'](_0x506e('0x1d'),_0x32243e+'-'+_0x11bde7+'/'+_0x27d11c)['json'](_0x5d7681);}return null;};}function patchUpdates(_0x43a183){return function(_0x205671){try{jsonpatch['apply'](_0x205671,_0x43a183,!![]);}catch(_0x3edce5){return BPromise[_0x506e('0x1e')](_0x3edce5);}return _0x205671[_0x506e('0x1f')]();};}function saveUpdates(_0x3b006d,_0x250332){return function(_0x32e396){if(_0x32e396){return _0x32e396['update'](_0x3b006d)[_0x506e('0x20')](function(_0x5e388d){return _0x5e388d;});}return null;};}function removeEntity(_0x458b13,_0x153340){return function(_0x593c98){if(_0x593c98){return _0x593c98[_0x506e('0x21')]()[_0x506e('0x20')](function(){_0x458b13[_0x506e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d5d41,_0x26ec0b){return function(_0x1da142){if(!_0x1da142){_0x1d5d41[_0x506e('0x22')](0x194);}return _0x1da142;};}function handleError(_0xf03cf8,_0x160c2e){_0x160c2e=_0x160c2e||0x1f4;return function(_0x46d48a){logger[_0x506e('0x23')](_0x46d48a['stack']);if(_0x46d48a[_0x506e('0x24')]){delete _0x46d48a[_0x506e('0x24')];}_0xf03cf8[_0x506e('0x16')](_0x160c2e)['send'](_0x46d48a);};}exports[_0x506e('0x25')]=function(_0x3f42ca,_0xfc7265){var _0x56312d={},_0x8c492={},_0x3d4222={'count':0x0,'rows':[]};var _0x298087=_[_0x506e('0x26')](db[_0x506e('0x27')][_0x506e('0x28')],function(_0x37293f){return{'name':_0x37293f[_0x506e('0x29')],'type':_0x37293f[_0x506e('0x2a')][_0x506e('0x2b')]};});_0x8c492[_0x506e('0x2c')]=_[_0x506e('0x26')](_0x298087,_0x506e('0x24'));_0x8c492[_0x506e('0x2d')]=_[_0x506e('0x2e')](_0x3f42ca['query']);_0x8c492['filters']=_[_0x506e('0x2f')](_0x8c492[_0x506e('0x2c')],_0x8c492['query']);_0x56312d['attributes']=_[_0x506e('0x2f')](_0x8c492[_0x506e('0x2c')],qs['fields'](_0x3f42ca['query'][_0x506e('0x30')]));_0x56312d[_0x506e('0x31')]=_0x56312d[_0x506e('0x31')][_0x506e('0x32')]?_0x56312d[_0x506e('0x31')]:_0x8c492['model'];if(!_0x3f42ca['query']['hasOwnProperty'](_0x506e('0x33'))){_0x56312d[_0x506e('0x1a')]=qs['limit'](_0x3f42ca['query'][_0x506e('0x1a')]);_0x56312d[_0x506e('0x1c')]=qs[_0x506e('0x1c')](_0x3f42ca[_0x506e('0x2d')][_0x506e('0x1c')]);}_0x56312d[_0x506e('0x34')]=qs['sort'](_0x3f42ca[_0x506e('0x2d')][_0x506e('0x35')]);_0x56312d[_0x506e('0x36')]=qs['filters'](_[_0x506e('0x37')](_0x3f42ca[_0x506e('0x2d')],_0x8c492[_0x506e('0x38')]),_0x298087);if(_0x3f42ca[_0x506e('0x2d')][_0x506e('0x39')]){_0x56312d[_0x506e('0x36')]=_['merge'](_0x56312d['where'],{'$or':_[_0x506e('0x26')](_0x298087,function(_0x88f35e){if(_0x88f35e['type']!==_0x506e('0x3a')){var _0x12ba80={};_0x12ba80[_0x88f35e['name']]={'$like':'%'+_0x3f42ca[_0x506e('0x2d')][_0x506e('0x39')]+'%'};return _0x12ba80;}})});}_0x56312d=_[_0x506e('0x3b')]({},_0x56312d,_0x3f42ca['options']);var _0x11f23f={'where':_0x56312d['where']};return db[_0x506e('0x27')]['count'](_0x11f23f)[_0x506e('0x20')](function(_0x16ab78){_0x3d4222[_0x506e('0x1b')]=_0x16ab78;if(_0x3f42ca[_0x506e('0x2d')][_0x506e('0x3c')]){_0x56312d[_0x506e('0x3d')]=[{'all':!![]}];}return db[_0x506e('0x27')][_0x506e('0x3e')](_0x56312d);})[_0x506e('0x20')](function(_0x4d3ff3){_0x3d4222[_0x506e('0x3f')]=_0x4d3ff3;return _0x3d4222;})['then'](respondWithFilteredResult(_0xfc7265,_0x56312d))[_0x506e('0x40')](handleError(_0xfc7265,null));};exports[_0x506e('0x41')]=function(_0x15e7ff,_0x31e39b){var _0x5408da={'raw':![],'where':{'id':_0x15e7ff[_0x506e('0x42')]['id']}},_0x1f62d2={};_0x1f62d2[_0x506e('0x2c')]=_[_0x506e('0x2e')](db[_0x506e('0x27')][_0x506e('0x28')]);_0x1f62d2[_0x506e('0x2d')]=_[_0x506e('0x2e')](_0x15e7ff[_0x506e('0x2d')]);_0x1f62d2[_0x506e('0x38')]=_['intersection'](_0x1f62d2[_0x506e('0x2c')],_0x1f62d2['query']);_0x5408da[_0x506e('0x31')]=_[_0x506e('0x2f')](_0x1f62d2[_0x506e('0x2c')],qs[_0x506e('0x30')](_0x15e7ff[_0x506e('0x2d')]['fields']));_0x5408da[_0x506e('0x31')]=_0x5408da['attributes'][_0x506e('0x32')]?_0x5408da['attributes']:_0x1f62d2[_0x506e('0x2c')];if(_0x15e7ff[_0x506e('0x2d')][_0x506e('0x3c')]){_0x5408da[_0x506e('0x3d')]=[{'all':!![]}];}_0x5408da=_['merge']({},_0x5408da,_0x15e7ff['options']);return db[_0x506e('0x27')][_0x506e('0x43')](_0x5408da)[_0x506e('0x20')](handleEntityNotFound(_0x31e39b,null))[_0x506e('0x20')](respondWithResult(_0x31e39b,null))['catch'](handleError(_0x31e39b,null));};exports[_0x506e('0x44')]=function(_0x4ec635,_0x5d49d2){return db[_0x506e('0x27')][_0x506e('0x44')](_0x4ec635['body'],{})[_0x506e('0x20')](respondWithResult(_0x5d49d2,0xc9))[_0x506e('0x40')](handleError(_0x5d49d2,null));};exports['bulkCreate']=function(_0x44b9f0,_0x3be354){return db[_0x506e('0x27')][_0x506e('0x45')](_0x44b9f0[_0x506e('0x46')],{'raw':![],'individualHooks':!![]})[_0x506e('0x20')](respondWithResult(_0x3be354,0xc9))[_0x506e('0x40')](handleError(_0x3be354,null));};exports['update']=function(_0x4f3b8a,_0x2a4645){if(_0x4f3b8a[_0x506e('0x46')]['id']){delete _0x4f3b8a[_0x506e('0x46')]['id'];}return db[_0x506e('0x27')][_0x506e('0x43')]({'where':{'id':_0x4f3b8a[_0x506e('0x42')]['id']}})[_0x506e('0x20')](handleEntityNotFound(_0x2a4645,null))['then'](saveUpdates(_0x4f3b8a['body'],null))[_0x506e('0x20')](respondWithResult(_0x2a4645,null))[_0x506e('0x40')](handleError(_0x2a4645,null));};exports[_0x506e('0x21')]=function(_0x636d58,_0x5d5ba6){return db[_0x506e('0x27')][_0x506e('0x43')]({'where':{'id':_0x636d58[_0x506e('0x42')]['id']}})[_0x506e('0x20')](handleEntityNotFound(_0x5d5ba6,null))[_0x506e('0x20')](removeEntity(_0x5d5ba6,null))['catch'](handleError(_0x5d5ba6,null));};exports[_0x506e('0x47')]=function(_0x49bb4b,_0x450ed8){return db[_0x506e('0x27')][_0x506e('0x21')]({'where':{'id':_0x49bb4b[_0x506e('0x2d')][_0x506e('0x48')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x450ed8,0xcc))[_0x506e('0x40')](handleError(_0x450ed8,null));};exports[_0x506e('0x49')]=function(_0x1c1a17,_0x49790c,_0x5f4c3d){return db[_0x506e('0x4a')][_0x506e('0x4b')]({'where':{'id':_0x1c1a17['params']['id']}})[_0x506e('0x20')](handleEntityNotFound(_0x49790c,null))[_0x506e('0x20')](function(_0x38e4be){if(_0x38e4be){return db[_0x506e('0x4c')][_0x506e('0x4d')](function(_0x3f8f59){return db[_0x506e('0x27')][_0x506e('0x21')]({'where':{'CustomReportId':_0x1c1a17[_0x506e('0x42')]['id']},'transaction':_0x3f8f59})[_0x506e('0x20')](function(_0x95978c){var _0x4d0a68=_[_0x506e('0x26')](_0x1c1a17[_0x506e('0x46')],function(_0x2f4af3){delete _0x2f4af3['id'];_0x2f4af3[_0x506e('0x4e')]=_0x1c1a17['params']['id'];return _0x2f4af3;});return db[_0x506e('0x27')][_0x506e('0x45')](_0x4d0a68,{'transaction':_0x3f8f59});});})[_0x506e('0x20')](function(){return db[_0x506e('0x27')][_0x506e('0x3e')]({'where':{'CustomReportId':_0x1c1a17['params']['id']}});});}})['then'](respondWithResult(_0x49790c,null))['catch'](handleError(_0x49790c,null));}; \ No newline at end of file +var _0x596c=['fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','bulkCreate','bulkDestroy','ids','addFields','findOne','sequelize','CustomReportId','request-promise','bluebird','mustache','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','AnalyticFieldReport','fieldName','key','model','query','keys','filters','intersection','attributes'];(function(_0x2d6efb,_0x4cadf8){var _0x31654d=function(_0xead211){while(--_0xead211){_0x2d6efb['push'](_0x2d6efb['shift']());}};_0x31654d(++_0x4cadf8);}(_0x596c,0x1cd));var _0xc596=function(_0x402eac,_0x465ce5){_0x402eac=_0x402eac-0x0;var _0x441ae2=_0x596c[_0x402eac];return _0x441ae2;};'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(_0xc596('0x0'));var moment=require('moment');var BPromise=require(_0xc596('0x1'));var Mustache=require(_0xc596('0x2'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc596('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc596('0x4'));var _=require(_0xc596('0x5'));var squel=require('squel');var crypto=require(_0xc596('0x6'));var jsforce=require('jsforce');var deskjs=require(_0xc596('0x7'));var toCsv=require(_0xc596('0x3'));var querystring=require('querystring');var Papa=require(_0xc596('0x8'));var Redis=require(_0xc596('0x9'));var authService=require(_0xc596('0xa'));var qs=require('../../components/parsers/qs');var as=require(_0xc596('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc596('0xc'))('api');var utils=require(_0xc596('0xd'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc596('0xe'))['db'];function respondWithStatusCode(_0x5b8211,_0x53c8da){_0x53c8da=_0x53c8da||0xcc;return function(_0x1605f0){if(_0x1605f0){return _0x5b8211[_0xc596('0xf')](_0x53c8da);}return _0x5b8211['status'](_0x53c8da)[_0xc596('0x10')]();};}function respondWithResult(_0x2adaa2,_0x2cd4ef){_0x2cd4ef=_0x2cd4ef||0xc8;return function(_0x33f653){if(_0x33f653){return _0x2adaa2[_0xc596('0x11')](_0x2cd4ef)[_0xc596('0x12')](_0x33f653);}};}function respondWithFilteredResult(_0x2318c5,_0xf8bfa7){return function(_0x15c644){if(_0x15c644){var _0x4d8bc7=typeof _0xf8bfa7[_0xc596('0x13')]===_0xc596('0x14')&&typeof _0xf8bfa7[_0xc596('0x15')]===_0xc596('0x14');var _0x5aec08=_0x15c644['count'];var _0x39a19e=_0x4d8bc7?0x0:_0xf8bfa7[_0xc596('0x13')];var _0x4713c4=_0x4d8bc7?_0x15c644['count']:_0xf8bfa7[_0xc596('0x13')]+_0xf8bfa7[_0xc596('0x15')];var _0x1d8f8a;if(_0x4713c4>=_0x5aec08){_0x4713c4=_0x5aec08;_0x1d8f8a=0xc8;}else{_0x1d8f8a=0xce;}_0x2318c5[_0xc596('0x11')](_0x1d8f8a);return _0x2318c5[_0xc596('0x16')](_0xc596('0x17'),_0x39a19e+'-'+_0x4713c4+'/'+_0x5aec08)[_0xc596('0x12')](_0x15c644);}return null;};}function patchUpdates(_0x3b214c){return function(_0x2e8af5){try{jsonpatch[_0xc596('0x18')](_0x2e8af5,_0x3b214c,!![]);}catch(_0x5703ec){return BPromise[_0xc596('0x19')](_0x5703ec);}return _0x2e8af5[_0xc596('0x1a')]();};}function saveUpdates(_0x12b730,_0x2ab766){return function(_0x4cd5af){if(_0x4cd5af){return _0x4cd5af['update'](_0x12b730)[_0xc596('0x1b')](function(_0x486c3d){return _0x486c3d;});}return null;};}function removeEntity(_0x16d548,_0x6c0e53){return function(_0x37b3a6){if(_0x37b3a6){return _0x37b3a6[_0xc596('0x1c')]()[_0xc596('0x1b')](function(){_0x16d548[_0xc596('0x11')](0xcc)[_0xc596('0x10')]();});}};}function handleEntityNotFound(_0x1cd892,_0x596774){return function(_0x2a39a2){if(!_0x2a39a2){_0x1cd892[_0xc596('0xf')](0x194);}return _0x2a39a2;};}function handleError(_0x220f3e,_0x38eab8){_0x38eab8=_0x38eab8||0x1f4;return function(_0x12152f){logger[_0xc596('0x1d')](_0x12152f[_0xc596('0x1e')]);if(_0x12152f[_0xc596('0x1f')]){delete _0x12152f[_0xc596('0x1f')];}_0x220f3e[_0xc596('0x11')](_0x38eab8)['send'](_0x12152f);};}exports[_0xc596('0x20')]=function(_0x27df77,_0x57159d){var _0x38baa9={},_0x43f23b={},_0x1f32ca={'count':0x0,'rows':[]};var _0x59f155=_[_0xc596('0x21')](db[_0xc596('0x22')]['rawAttributes'],function(_0x5980fc){return{'name':_0x5980fc[_0xc596('0x23')],'type':_0x5980fc['type'][_0xc596('0x24')]};});_0x43f23b[_0xc596('0x25')]=_[_0xc596('0x21')](_0x59f155,'name');_0x43f23b[_0xc596('0x26')]=_[_0xc596('0x27')](_0x27df77[_0xc596('0x26')]);_0x43f23b[_0xc596('0x28')]=_[_0xc596('0x29')](_0x43f23b[_0xc596('0x25')],_0x43f23b['query']);_0x38baa9[_0xc596('0x2a')]=_['intersection'](_0x43f23b[_0xc596('0x25')],qs[_0xc596('0x2b')](_0x27df77[_0xc596('0x26')][_0xc596('0x2b')]));_0x38baa9[_0xc596('0x2a')]=_0x38baa9[_0xc596('0x2a')][_0xc596('0x2c')]?_0x38baa9[_0xc596('0x2a')]:_0x43f23b['model'];if(!_0x27df77[_0xc596('0x26')][_0xc596('0x2d')](_0xc596('0x2e'))){_0x38baa9[_0xc596('0x15')]=qs['limit'](_0x27df77['query'][_0xc596('0x15')]);_0x38baa9[_0xc596('0x13')]=qs[_0xc596('0x13')](_0x27df77[_0xc596('0x26')][_0xc596('0x13')]);}_0x38baa9[_0xc596('0x2f')]=qs['sort'](_0x27df77[_0xc596('0x26')][_0xc596('0x30')]);_0x38baa9[_0xc596('0x31')]=qs[_0xc596('0x28')](_['pick'](_0x27df77[_0xc596('0x26')],_0x43f23b[_0xc596('0x28')]),_0x59f155);if(_0x27df77[_0xc596('0x26')][_0xc596('0x32')]){_0x38baa9['where']=_[_0xc596('0x33')](_0x38baa9[_0xc596('0x31')],{'$or':_[_0xc596('0x21')](_0x59f155,function(_0x231b77){if(_0x231b77[_0xc596('0x34')]!==_0xc596('0x35')){var _0x3d512f={};_0x3d512f[_0x231b77[_0xc596('0x1f')]]={'$like':'%'+_0x27df77[_0xc596('0x26')][_0xc596('0x32')]+'%'};return _0x3d512f;}})});}_0x38baa9=_[_0xc596('0x33')]({},_0x38baa9,_0x27df77[_0xc596('0x36')]);var _0x40585f={'where':_0x38baa9[_0xc596('0x31')]};return db[_0xc596('0x22')]['count'](_0x40585f)['then'](function(_0x252011){_0x1f32ca[_0xc596('0x37')]=_0x252011;if(_0x27df77[_0xc596('0x26')][_0xc596('0x38')]){_0x38baa9[_0xc596('0x39')]=[{'all':!![]}];}return db[_0xc596('0x22')][_0xc596('0x3a')](_0x38baa9);})['then'](function(_0x5b474a){_0x1f32ca['rows']=_0x5b474a;return _0x1f32ca;})[_0xc596('0x1b')](respondWithFilteredResult(_0x57159d,_0x38baa9))[_0xc596('0x3b')](handleError(_0x57159d,null));};exports['show']=function(_0xae943b,_0x46d8d5){var _0x5b979f={'raw':![],'where':{'id':_0xae943b[_0xc596('0x3c')]['id']}},_0x399048={};_0x399048[_0xc596('0x25')]=_[_0xc596('0x27')](db['AnalyticFieldReport'][_0xc596('0x3d')]);_0x399048[_0xc596('0x26')]=_[_0xc596('0x27')](_0xae943b[_0xc596('0x26')]);_0x399048['filters']=_['intersection'](_0x399048[_0xc596('0x25')],_0x399048[_0xc596('0x26')]);_0x5b979f['attributes']=_[_0xc596('0x29')](_0x399048['model'],qs[_0xc596('0x2b')](_0xae943b[_0xc596('0x26')][_0xc596('0x2b')]));_0x5b979f[_0xc596('0x2a')]=_0x5b979f['attributes'][_0xc596('0x2c')]?_0x5b979f[_0xc596('0x2a')]:_0x399048[_0xc596('0x25')];if(_0xae943b['query'][_0xc596('0x38')]){_0x5b979f[_0xc596('0x39')]=[{'all':!![]}];}_0x5b979f=_['merge']({},_0x5b979f,_0xae943b['options']);return db[_0xc596('0x22')][_0xc596('0x3e')](_0x5b979f)['then'](handleEntityNotFound(_0x46d8d5,null))[_0xc596('0x1b')](respondWithResult(_0x46d8d5,null))[_0xc596('0x3b')](handleError(_0x46d8d5,null));};exports[_0xc596('0x3f')]=function(_0x2848ec,_0x4a9fed){return db[_0xc596('0x22')][_0xc596('0x3f')](_0x2848ec[_0xc596('0x40')],{})[_0xc596('0x1b')](respondWithResult(_0x4a9fed,0xc9))[_0xc596('0x3b')](handleError(_0x4a9fed,null));};exports['bulkCreate']=function(_0x5ba9ca,_0x486f86){return db[_0xc596('0x22')][_0xc596('0x41')](_0x5ba9ca[_0xc596('0x40')],{'raw':![],'individualHooks':!![]})[_0xc596('0x1b')](respondWithResult(_0x486f86,0xc9))[_0xc596('0x3b')](handleError(_0x486f86,null));};exports['update']=function(_0x58cf44,_0x4390d6){if(_0x58cf44[_0xc596('0x40')]['id']){delete _0x58cf44[_0xc596('0x40')]['id'];}return db[_0xc596('0x22')][_0xc596('0x3e')]({'where':{'id':_0x58cf44[_0xc596('0x3c')]['id']}})[_0xc596('0x1b')](handleEntityNotFound(_0x4390d6,null))[_0xc596('0x1b')](saveUpdates(_0x58cf44[_0xc596('0x40')],null))[_0xc596('0x1b')](respondWithResult(_0x4390d6,null))[_0xc596('0x3b')](handleError(_0x4390d6,null));};exports[_0xc596('0x1c')]=function(_0x4396b7,_0x2e5dfa){return db[_0xc596('0x22')][_0xc596('0x3e')]({'where':{'id':_0x4396b7[_0xc596('0x3c')]['id']}})[_0xc596('0x1b')](handleEntityNotFound(_0x2e5dfa,null))[_0xc596('0x1b')](removeEntity(_0x2e5dfa,null))['catch'](handleError(_0x2e5dfa,null));};exports[_0xc596('0x42')]=function(_0x2a85fd,_0xb47c0e){return db[_0xc596('0x22')]['destroy']({'where':{'id':_0x2a85fd[_0xc596('0x26')][_0xc596('0x43')]||[]},'raw':![],'individualHooks':!![]})[_0xc596('0x1b')](respondWithResult(_0xb47c0e,0xcc))['catch'](handleError(_0xb47c0e,null));};exports[_0xc596('0x44')]=function(_0x5552ef,_0x186e5f,_0x103535){return db['AnalyticCustomReport'][_0xc596('0x45')]({'where':{'id':_0x5552ef[_0xc596('0x3c')]['id']}})[_0xc596('0x1b')](handleEntityNotFound(_0x186e5f,null))[_0xc596('0x1b')](function(_0x520937){if(_0x520937){return db[_0xc596('0x46')]['transaction'](function(_0x1fff2d){return db[_0xc596('0x22')][_0xc596('0x1c')]({'where':{'CustomReportId':_0x5552ef[_0xc596('0x3c')]['id']},'transaction':_0x1fff2d})[_0xc596('0x1b')](function(_0x3768a8){var _0x28d3af=_[_0xc596('0x21')](_0x5552ef[_0xc596('0x40')],function(_0x2fef1d){delete _0x2fef1d['id'];_0x2fef1d[_0xc596('0x47')]=_0x5552ef[_0xc596('0x3c')]['id'];return _0x2fef1d;});return db[_0xc596('0x22')][_0xc596('0x41')](_0x28d3af,{'transaction':_0x1fff2d});});})[_0xc596('0x1b')](function(){return db[_0xc596('0x22')][_0xc596('0x3a')]({'where':{'CustomReportId':_0x5552ef['params']['id']}});});}})[_0xc596('0x1b')](respondWithResult(_0x186e5f,null))[_0xc596('0x3b')](handleError(_0x186e5f,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index daafc22..5f5f09d 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 _0x2064=['moment','bluebird','request-promise','path','rimraf','./analyticFieldReport.attributes','exports','analytics_report_fields','lodash','util','../../config/logger','api'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x2064,0x74));var _0x4206=function(_0x245839,_0x2b21d2){_0x245839=_0x245839-0x0;var _0x5d65e2=_0x2064[_0x245839];return _0x5d65e2;};'use strict';var _=require(_0x4206('0x0'));var util=require(_0x4206('0x1'));var logger=require(_0x4206('0x2'))(_0x4206('0x3'));var moment=require(_0x4206('0x4'));var BPromise=require(_0x4206('0x5'));var rp=require(_0x4206('0x6'));var fs=require('fs');var path=require(_0x4206('0x7'));var rimraf=require(_0x4206('0x8'));var config=require('../../config/environment');var attributes=require(_0x4206('0x9'));module[_0x4206('0xa')]=function(_0x1b5615,_0xbca1eb){return _0x1b5615['define']('AnalyticFieldReport',attributes,{'tableName':_0x4206('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f83=['../../config/environment','./analyticFieldReport.attributes','define','analytics_report_fields','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x9f83,0x12d));var _0x39f8=function(_0x4e2929,_0x93b5f1){_0x4e2929=_0x4e2929-0x0;var _0x4e1c87=_0x9f83[_0x4e2929];return _0x4e1c87;};'use strict';var _=require(_0x39f8('0x0'));var util=require(_0x39f8('0x1'));var logger=require(_0x39f8('0x2'))(_0x39f8('0x3'));var moment=require('moment');var BPromise=require(_0x39f8('0x4'));var rp=require(_0x39f8('0x5'));var fs=require('fs');var path=require(_0x39f8('0x6'));var rimraf=require('rimraf');var config=require(_0x39f8('0x7'));var attributes=require(_0x39f8('0x8'));module['exports']=function(_0x2af4b1,_0x5a72dc){return _0x2af4b1[_0x39f8('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0x39f8('0xa'),'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 d93300e..3461eb4 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 _0x2047=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x87cb2b,_0x33c1a6){var _0x152d0d=function(_0x26357e){while(--_0x26357e){_0x87cb2b['push'](_0x87cb2b['shift']());}};_0x152d0d(++_0x33c1a6);}(_0x2047,0xb3));var _0x7204=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x2047[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7204('0x0'));var util=require(_0x7204('0x1'));var moment=require('moment');var BPromise=require(_0x7204('0x2'));var rs=require(_0x7204('0x3'));var fs=require('fs');var Redis=require(_0x7204('0x4'));var db=require(_0x7204('0x5'))['db'];var utils=require(_0x7204('0x6'));var logger=require(_0x7204('0x7'))(_0x7204('0x8'));var config=require(_0x7204('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7204('0xa')][_0x7204('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a9f38,_0x5f2478,_0x2f7606){return new BPromise(function(_0x2d4ace,_0x440fc0){return client['request'](_0x5a9f38,_0x2f7606)[_0x7204('0xc')](function(_0x275d62){logger[_0x7204('0xd')](_0x7204('0xe'),_0x5f2478,'request\x20sent');logger[_0x7204('0xf')](_0x7204('0x10'),_0x5f2478,_0x7204('0x11'),JSON['stringify'](_0x275d62));if(_0x275d62['error']){if(_0x275d62[_0x7204('0x12')][_0x7204('0x13')]===0x1f4){logger[_0x7204('0x12')](_0x7204('0xe'),_0x5f2478,_0x275d62[_0x7204('0x12')][_0x7204('0x14')]);return _0x440fc0(_0x275d62[_0x7204('0x12')][_0x7204('0x14')]);}logger[_0x7204('0x12')](_0x7204('0xe'),_0x5f2478,_0x275d62[_0x7204('0x12')][_0x7204('0x14')]);return _0x2d4ace(_0x275d62[_0x7204('0x12')][_0x7204('0x14')]);}else{logger[_0x7204('0xd')](_0x7204('0xe'),_0x5f2478,_0x7204('0x11'));_0x2d4ace(_0x275d62[_0x7204('0x15')][_0x7204('0x14')]);}})[_0x7204('0x16')](function(_0x2efd1b){logger[_0x7204('0x12')](_0x7204('0xe'),_0x5f2478,_0x2efd1b);_0x440fc0(_0x2efd1b);});});} \ No newline at end of file +var _0x2fa5=['rpc','../../config/environment','jayson/promise','client','http','request','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2fa5,0x1c4));var _0x52fa=function(_0xec0833,_0x1b4e39){_0xec0833=_0xec0833-0x0;var _0x166af1=_0x2fa5[_0xec0833];return _0x166af1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x52fa('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x52fa('0x1'));var db=require(_0x52fa('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x52fa('0x3'))(_0x52fa('0x4'));var config=require(_0x52fa('0x5'));var jayson=require(_0x52fa('0x6'));var client=jayson[_0x52fa('0x7')][_0x52fa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x362f3d,_0x2e67d9,_0x4b8b9a){return new BPromise(function(_0x1cca68,_0x472914){return client[_0x52fa('0x9')](_0x362f3d,_0x4b8b9a)['then'](function(_0xeb6252){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x2e67d9,'request\x20sent');logger[_0x52fa('0xa')](_0x52fa('0xb'),_0x2e67d9,_0x52fa('0xc'),JSON[_0x52fa('0xd')](_0xeb6252));if(_0xeb6252[_0x52fa('0xe')]){if(_0xeb6252['error']['code']===0x1f4){logger[_0x52fa('0xe')](_0x52fa('0xf'),_0x2e67d9,_0xeb6252[_0x52fa('0xe')][_0x52fa('0x10')]);return _0x472914(_0xeb6252['error']['message']);}logger[_0x52fa('0xe')](_0x52fa('0xf'),_0x2e67d9,_0xeb6252[_0x52fa('0xe')][_0x52fa('0x10')]);return _0x1cca68(_0xeb6252[_0x52fa('0xe')]['message']);}else{logger['info'](_0x52fa('0xf'),_0x2e67d9,'request\x20sent');_0x1cca68(_0xeb6252[_0x52fa('0x11')][_0x52fa('0x10')]);}})[_0x52fa('0x12')](function(_0x1f5351){logger[_0x52fa('0xe')](_0x52fa('0xf'),_0x2e67d9,_0x1f5351);_0x472914(_0x1f5351);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index d514c19..015c7f6 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(_0x4816b3,_0xf66be3){var _0x471068=function(_0x41ff38){while(--_0x41ff38){_0x4816b3['push'](_0x4816b3['shift']());}};_0x471068(++_0xf66be3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x18e9e3,_0x33ec06){var _0xcee7dc=function(_0x102b51){while(--_0x102b51){_0x18e9e3['push'](_0x18e9e3['shift']());}};_0xcee7dc(++_0x33ec06);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 94f86b6..66d9f3d 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 _0xa3b7=['STRING','TEXT','sequelize'];(function(_0x32b4aa,_0x12eba6){var _0x473160=function(_0x4906b6){while(--_0x4906b6){_0x32b4aa['push'](_0x32b4aa['shift']());}};_0x473160(++_0x12eba6);}(_0xa3b7,0xe6));var _0x7a3b=function(_0x334fea,_0x1f1e18){_0x334fea=_0x334fea-0x0;var _0x3c5829=_0xa3b7[_0x334fea];return _0x3c5829;};'use strict';var Sequelize=require(_0x7a3b('0x0'));module['exports']={'name':{'type':Sequelize[_0x7a3b('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x7a3b('0x1')]},'metric':{'type':Sequelize[_0x7a3b('0x2')]},'description':{'type':Sequelize[_0x7a3b('0x1')]}}; \ No newline at end of file +var _0x2948=['STRING','name','TEXT','sequelize','exports'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x2948,0xcb));var _0x8294=function(_0xb79f3c,_0x41cae2){_0xb79f3c=_0xb79f3c-0x0;var _0x4d18e0=_0x2948[_0xb79f3c];return _0x4d18e0;};'use strict';var Sequelize=require(_0x8294('0x0'));module[_0x8294('0x1')]={'name':{'type':Sequelize[_0x8294('0x2')],'allowNull':![],'unique':_0x8294('0x3')},'table':{'type':Sequelize[_0x8294('0x2')]},'metric':{'type':Sequelize[_0x8294('0x4')]},'description':{'type':Sequelize[_0x8294('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index b3d4e50..44c8633 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 _0x46ed=['where','pick','filter','merge','map','type','options','count','includeAll','include','findAll','rows','params','keys','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','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','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x9ab07,_0x33af4a){var _0x269e22=function(_0x4a1825){while(--_0x4a1825){_0x9ab07['push'](_0x9ab07['shift']());}};_0x269e22(++_0x33af4a);}(_0x46ed,0x168));var _0xd46e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x46ed[_0x1928c9];return _0x51b5fb;};'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'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){var _0x5424e5=_0x62dea5['get']({'plain':!![]});var _0x371054=_0xd46e('0x26');return db[_0xd46e('0x27')][_0xd46e('0x28')]({'where':{'type':_0x371054,'resourceId':_0x5424e5['id']}})[_0xd46e('0x25')](function(){return _0x62dea5;});})[_0xd46e('0x25')](function(){_0x33c2e0[_0xd46e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d789,_0x3c301a){return function(_0xddbce9){if(!_0xddbce9){_0x45d789[_0xd46e('0x1a')](0x194);}return _0xddbce9;};}function handleError(_0x96f15c,_0x16e941){_0x16e941=_0x16e941||0x1f4;return function(_0x58aeef){logger[_0xd46e('0x29')](_0x58aeef[_0xd46e('0x2a')]);if(_0x58aeef[_0xd46e('0x2b')]){delete _0x58aeef[_0xd46e('0x2b')];}_0x96f15c[_0xd46e('0x1b')](_0x16e941)[_0xd46e('0x2c')](_0x58aeef);};}exports[_0xd46e('0x2d')]=function(_0x2c5ec7,_0x18f060){var _0x45ea47={},_0x2ff785={},_0x504324={'count':0x0,'rows':[]};var _0x2f4a1b=_['map'](db[_0xd46e('0x2e')][_0xd46e('0x2f')],function(_0x4f5718){return{'name':_0x4f5718[_0xd46e('0x30')],'type':_0x4f5718['type'][_0xd46e('0x31')]};});_0x2ff785[_0xd46e('0x32')]=_['map'](_0x2f4a1b,_0xd46e('0x2b'));_0x2ff785[_0xd46e('0x33')]=_['keys'](_0x2c5ec7[_0xd46e('0x33')]);_0x2ff785[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x2ff785['model'],_0x2ff785['query']);_0x45ea47[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x2ff785[_0xd46e('0x32')],qs[_0xd46e('0x37')](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x37')]));_0x45ea47[_0xd46e('0x36')]=_0x45ea47[_0xd46e('0x36')]['length']?_0x45ea47[_0xd46e('0x36')]:_0x2ff785[_0xd46e('0x32')];if(!_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x45ea47[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x2c5ec7['query'][_0xd46e('0x1d')]);_0x45ea47[_0xd46e('0x1c')]=qs['offset'](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x1c')]);}_0x45ea47[_0xd46e('0x3a')]=qs[_0xd46e('0x3b')](_0x2c5ec7['query'][_0xd46e('0x3b')]);_0x45ea47[_0xd46e('0x3c')]=qs[_0xd46e('0x34')](_[_0xd46e('0x3d')](_0x2c5ec7[_0xd46e('0x33')],_0x2ff785[_0xd46e('0x34')]),_0x2f4a1b);if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x3e')]){_0x45ea47['where']=_[_0xd46e('0x3f')](_0x45ea47[_0xd46e('0x3c')],{'$or':_[_0xd46e('0x40')](_0x2f4a1b,function(_0x25657a){if(_0x25657a[_0xd46e('0x41')]!=='VIRTUAL'){var _0x964c66={};_0x964c66[_0x25657a['name']]={'$like':'%'+_0x2c5ec7['query']['filter']+'%'};return _0x964c66;}})});}_0x45ea47=_['merge']({},_0x45ea47,_0x2c5ec7[_0xd46e('0x42')]);var _0x54949f={'where':_0x45ea47[_0xd46e('0x3c')]};return db[_0xd46e('0x2e')]['count'](_0x54949f)[_0xd46e('0x25')](function(_0x4114e6){_0x504324[_0xd46e('0x43')]=_0x4114e6;if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x44')]){_0x45ea47[_0xd46e('0x45')]=[{'all':!![]}];}return db[_0xd46e('0x2e')][_0xd46e('0x46')](_0x45ea47);})[_0xd46e('0x25')](function(_0xec367d){_0x504324[_0xd46e('0x47')]=_0xec367d;return _0x504324;})['then'](respondWithFilteredResult(_0x18f060,_0x45ea47))['catch'](handleError(_0x18f060,null));};exports['show']=function(_0x2b4a5a,_0x4e1d94){var _0x168d35={'raw':!![],'where':{'id':_0x2b4a5a[_0xd46e('0x48')]['id']}},_0x272f5f={};_0x272f5f[_0xd46e('0x32')]=_[_0xd46e('0x49')](db[_0xd46e('0x2e')][_0xd46e('0x2f')]);_0x272f5f[_0xd46e('0x33')]=_['keys'](_0x2b4a5a[_0xd46e('0x33')]);_0x272f5f['filters']=_[_0xd46e('0x35')](_0x272f5f[_0xd46e('0x32')],_0x272f5f[_0xd46e('0x33')]);_0x168d35[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x272f5f['model'],qs[_0xd46e('0x37')](_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x37')]));_0x168d35[_0xd46e('0x36')]=_0x168d35[_0xd46e('0x36')]['length']?_0x168d35[_0xd46e('0x36')]:_0x272f5f[_0xd46e('0x32')];if(_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x44')]){_0x168d35[_0xd46e('0x45')]=[{'all':!![]}];}_0x168d35=_['merge']({},_0x168d35,_0x2b4a5a[_0xd46e('0x42')]);return db[_0xd46e('0x2e')][_0xd46e('0x4a')](_0x168d35)[_0xd46e('0x25')](handleEntityNotFound(_0x4e1d94,null))[_0xd46e('0x25')](respondWithResult(_0x4e1d94,null))[_0xd46e('0x4b')](handleError(_0x4e1d94,null));};exports[_0xd46e('0x4c')]=function(_0x440dcc,_0x5188f6){return db[_0xd46e('0x2e')][_0xd46e('0x4c')](_0x440dcc[_0xd46e('0x4d')],{})[_0xd46e('0x25')](function(_0x1f1941){var _0x4e84c8=_0x440dcc['user'][_0xd46e('0x4e')]({'plain':!![]});if(!_0x4e84c8)throw new Error(_0xd46e('0x4f'));if(_0x4e84c8[_0xd46e('0x50')]==='user'){var _0x479711=_0x1f1941[_0xd46e('0x4e')]({'plain':!![]});var _0x9d8638='Metrics';return db[_0xd46e('0x51')][_0xd46e('0x4a')]({'where':{'name':_0x9d8638,'userProfileId':_0x4e84c8[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x25')](function(_0x1bd8a5){if(_0x1bd8a5&&_0x1bd8a5[_0xd46e('0x53')]===0x0){return db[_0xd46e('0x27')][_0xd46e('0x4c')]({'name':_0x479711['name'],'resourceId':_0x479711['id'],'type':_0x1bd8a5[_0xd46e('0x2b')],'sectionId':_0x1bd8a5['id']},{})[_0xd46e('0x25')](function(){return _0x1f1941;});}else{return _0x1f1941;}})[_0xd46e('0x4b')](function(_0x63ee74){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x63ee74);throw _0x63ee74;});}return _0x1f1941;})[_0xd46e('0x25')](respondWithResult(_0x5188f6,0xc9))['catch'](handleError(_0x5188f6,null));};exports[_0xd46e('0x24')]=function(_0x2af20b,_0x393cb9){if(_0x2af20b[_0xd46e('0x4d')]['id']){delete _0x2af20b[_0xd46e('0x4d')]['id'];}return db[_0xd46e('0x2e')]['find']({'where':{'id':_0x2af20b[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x393cb9,null))[_0xd46e('0x25')](saveUpdates(_0x2af20b['body'],null))[_0xd46e('0x25')](respondWithResult(_0x393cb9,null))[_0xd46e('0x4b')](handleError(_0x393cb9,null));};exports[_0xd46e('0x28')]=function(_0x2042d4,_0x1886e6){return db[_0xd46e('0x2e')][_0xd46e('0x4a')]({'where':{'id':_0x2042d4[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x1886e6,null))[_0xd46e('0x25')](removeEntity(_0x1886e6,null))[_0xd46e('0x4b')](handleError(_0x1886e6,null));}; \ No newline at end of file +var _0x008c=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','get','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x151762,_0x17691f){var _0x27f596=function(_0x4ca750){while(--_0x4ca750){_0x151762['push'](_0x151762['shift']());}};_0x27f596(++_0x17691f);}(_0x008c,0x188));var _0xc008=function(_0x27def7,_0x3f0835){_0x27def7=_0x27def7-0x0;var _0x581cbc=_0x008c[_0x27def7];return _0x581cbc;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){var _0x2e3cfb=_0x58a6ea[_0xc008('0x23')]({'plain':!![]});var _0x5410f5='Metrics';return db['UserProfileResource'][_0xc008('0x22')]({'where':{'type':_0x5410f5,'resourceId':_0x2e3cfb['id']}})[_0xc008('0x21')](function(){return _0x58a6ea;});})[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2aca,_0x4fce9c){return function(_0x4adbab){if(!_0x4adbab){_0x5e2aca['sendStatus'](0x194);}return _0x4adbab;};}function handleError(_0x3865c0,_0x29ba43){_0x29ba43=_0x29ba43||0x1f4;return function(_0x25eae4){logger['error'](_0x25eae4[_0xc008('0x24')]);if(_0x25eae4[_0xc008('0x25')]){delete _0x25eae4[_0xc008('0x25')];}_0x3865c0[_0xc008('0x19')](_0x29ba43)['send'](_0x25eae4);};}exports[_0xc008('0x26')]=function(_0x2e0b4e,_0x53ed35){var _0x58db82={},_0x539766={},_0x1032b2={'count':0x0,'rows':[]};var _0x267abd=_[_0xc008('0x27')](db[_0xc008('0x28')][_0xc008('0x29')],function(_0xceebc3){return{'name':_0xceebc3[_0xc008('0x2a')],'type':_0xceebc3[_0xc008('0x2b')][_0xc008('0x2c')]};});_0x539766[_0xc008('0x2d')]=_[_0xc008('0x27')](_0x267abd,_0xc008('0x25'));_0x539766['query']=_[_0xc008('0x2e')](_0x2e0b4e[_0xc008('0x2f')]);_0x539766['filters']=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],_0x539766[_0xc008('0x2f')]);_0x58db82[_0xc008('0x31')]=_[_0xc008('0x30')](_0x539766[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x32')]));_0x58db82['attributes']=_0x58db82[_0xc008('0x31')][_0xc008('0x33')]?_0x58db82[_0xc008('0x31')]:_0x539766[_0xc008('0x2d')];if(!_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x34')](_0xc008('0x35'))){_0x58db82['limit']=qs[_0xc008('0x1d')](_0x2e0b4e[_0xc008('0x2f')]['limit']);_0x58db82[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x2e0b4e['query'][_0xc008('0x1b')]);}_0x58db82[_0xc008('0x36')]=qs[_0xc008('0x37')](_0x2e0b4e['query']['sort']);_0x58db82['where']=qs[_0xc008('0x38')](_['pick'](_0x2e0b4e[_0xc008('0x2f')],_0x539766[_0xc008('0x38')]),_0x267abd);if(_0x2e0b4e[_0xc008('0x2f')][_0xc008('0x39')]){_0x58db82[_0xc008('0x3a')]=_[_0xc008('0x3b')](_0x58db82[_0xc008('0x3a')],{'$or':_[_0xc008('0x27')](_0x267abd,function(_0xffd2b3){if(_0xffd2b3[_0xc008('0x2b')]!==_0xc008('0x3c')){var _0xdfca2e={};_0xdfca2e[_0xffd2b3[_0xc008('0x25')]]={'$like':'%'+_0x2e0b4e[_0xc008('0x2f')]['filter']+'%'};return _0xdfca2e;}})});}_0x58db82=_[_0xc008('0x3b')]({},_0x58db82,_0x2e0b4e[_0xc008('0x3d')]);var _0x30b7df={'where':_0x58db82[_0xc008('0x3a')]};return db['AnalyticMetric'][_0xc008('0x1e')](_0x30b7df)[_0xc008('0x21')](function(_0xc8cb91){_0x1032b2[_0xc008('0x1e')]=_0xc8cb91;if(_0x2e0b4e[_0xc008('0x2f')]['includeAll']){_0x58db82[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x28')][_0xc008('0x3f')](_0x58db82);})[_0xc008('0x21')](function(_0x7279e8){_0x1032b2['rows']=_0x7279e8;return _0x1032b2;})[_0xc008('0x21')](respondWithFilteredResult(_0x53ed35,_0x58db82))[_0xc008('0x40')](handleError(_0x53ed35,null));};exports[_0xc008('0x41')]=function(_0x408192,_0x4b80f3){var _0x26cd05={'raw':!![],'where':{'id':_0x408192[_0xc008('0x42')]['id']}},_0xe37446={};_0xe37446['model']=_[_0xc008('0x2e')](db['AnalyticMetric'][_0xc008('0x29')]);_0xe37446['query']=_[_0xc008('0x2e')](_0x408192[_0xc008('0x2f')]);_0xe37446['filters']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],_0xe37446[_0xc008('0x2f')]);_0x26cd05['attributes']=_[_0xc008('0x30')](_0xe37446[_0xc008('0x2d')],qs[_0xc008('0x32')](_0x408192[_0xc008('0x2f')][_0xc008('0x32')]));_0x26cd05[_0xc008('0x31')]=_0x26cd05['attributes']['length']?_0x26cd05['attributes']:_0xe37446[_0xc008('0x2d')];if(_0x408192[_0xc008('0x2f')][_0xc008('0x43')]){_0x26cd05[_0xc008('0x3e')]=[{'all':!![]}];}_0x26cd05=_[_0xc008('0x3b')]({},_0x26cd05,_0x408192[_0xc008('0x3d')]);return db[_0xc008('0x28')][_0xc008('0x44')](_0x26cd05)['then'](handleEntityNotFound(_0x4b80f3,null))['then'](respondWithResult(_0x4b80f3,null))['catch'](handleError(_0x4b80f3,null));};exports[_0xc008('0x45')]=function(_0x2651cf,_0x158eae){return db['AnalyticMetric'][_0xc008('0x45')](_0x2651cf[_0xc008('0x46')],{})[_0xc008('0x21')](function(_0x1c2c50){var _0x4981b4=_0x2651cf[_0xc008('0x47')][_0xc008('0x23')]({'plain':!![]});if(!_0x4981b4)throw new Error(_0xc008('0x48'));if(_0x4981b4[_0xc008('0x49')]===_0xc008('0x47')){var _0x52c444=_0x1c2c50['get']({'plain':!![]});var _0x223056='Metrics';return db[_0xc008('0x4a')][_0xc008('0x44')]({'where':{'name':_0x223056,'userProfileId':_0x4981b4[_0xc008('0x4b')]},'raw':!![]})['then'](function(_0x144ab2){if(_0x144ab2&&_0x144ab2[_0xc008('0x4c')]===0x0){return db[_0xc008('0x4d')][_0xc008('0x45')]({'name':_0x52c444[_0xc008('0x25')],'resourceId':_0x52c444['id'],'type':_0x144ab2['name'],'sectionId':_0x144ab2['id']},{})[_0xc008('0x21')](function(){return _0x1c2c50;});}else{return _0x1c2c50;}})[_0xc008('0x40')](function(_0x4b4c6d){logger[_0xc008('0x4e')](_0xc008('0x4f'),_0x4b4c6d);throw _0x4b4c6d;});}return _0x1c2c50;})['then'](respondWithResult(_0x158eae,0xc9))['catch'](handleError(_0x158eae,null));};exports[_0xc008('0x20')]=function(_0xd47b74,_0x20947b){if(_0xd47b74[_0xc008('0x46')]['id']){delete _0xd47b74[_0xc008('0x46')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0xd47b74[_0xc008('0x42')]['id']}})['then'](handleEntityNotFound(_0x20947b,null))[_0xc008('0x21')](saveUpdates(_0xd47b74[_0xc008('0x46')],null))[_0xc008('0x21')](respondWithResult(_0x20947b,null))[_0xc008('0x40')](handleError(_0x20947b,null));};exports[_0xc008('0x22')]=function(_0x27a167,_0x49d8b0){return db[_0xc008('0x28')][_0xc008('0x44')]({'where':{'id':_0x27a167[_0xc008('0x42')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x49d8b0,null))[_0xc008('0x21')](removeEntity(_0x49d8b0,null))['catch'](handleError(_0x49d8b0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index dd95010..c02dd3a 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 _0x7412=['bluebird','define','analytics_metrics','lodash','api'];(function(_0x179c4a,_0x10eb06){var _0x5d1879=function(_0x1f1dcd){while(--_0x1f1dcd){_0x179c4a['push'](_0x179c4a['shift']());}};_0x5d1879(++_0x10eb06);}(_0x7412,0x161));var _0x2741=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x7412[_0x25d386];return _0x857f4a;};'use strict';var _=require(_0x2741('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2741('0x1'));var moment=require('moment');var BPromise=require(_0x2741('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x23985b,_0xcc6e28){return _0x23985b[_0x2741('0x3')]('AnalyticMetric',attributes,{'tableName':_0x2741('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfe8=['analytics_metrics','util','api','moment','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x377ddf,_0x102e9a){var _0x5b8465=function(_0x3e0ed3){while(--_0x3e0ed3){_0x377ddf['push'](_0x377ddf['shift']());}};_0x5b8465(++_0x102e9a);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x1f3894,_0x375683){_0x1f3894=_0x1f3894-0x0;var _0xe66dd1=_0xbfe8[_0x1f3894];return _0xe66dd1;};'use strict';var _=require('lodash');var util=require(_0x8bfe('0x0'));var logger=require('../../config/logger')(_0x8bfe('0x1'));var moment=require(_0x8bfe('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bfe('0x3'));var rimraf=require(_0x8bfe('0x4'));var config=require('../../config/environment');var attributes=require(_0x8bfe('0x5'));module[_0x8bfe('0x6')]=function(_0x314a9a,_0x4933c9){return _0x314a9a[_0x8bfe('0x7')](_0x8bfe('0x8'),attributes,{'tableName':_0x8bfe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index b64d771..36c305c 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 _0x9fd6=['message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x9fd6,0xf6));var _0x69fd=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9fd6[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x69fd('0x0'));var util=require(_0x69fd('0x1'));var moment=require('moment');var BPromise=require(_0x69fd('0x2'));var rs=require(_0x69fd('0x3'));var fs=require('fs');var Redis=require(_0x69fd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x69fd('0x5'));var logger=require(_0x69fd('0x6'))('rpc');var config=require(_0x69fd('0x7'));var jayson=require(_0x69fd('0x8'));var client=jayson['client'][_0x69fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f03c4,_0x563d85,_0x5ef488){return new BPromise(function(_0x4e08ee,_0x48800b){return client[_0x69fd('0xa')](_0x3f03c4,_0x5ef488)[_0x69fd('0xb')](function(_0x804da4){logger['info'](_0x69fd('0xc'),_0x563d85,_0x69fd('0xd'));logger[_0x69fd('0xe')](_0x69fd('0xf'),_0x563d85,_0x69fd('0xd'),JSON[_0x69fd('0x10')](_0x804da4));if(_0x804da4['error']){if(_0x804da4[_0x69fd('0x11')]['code']===0x1f4){logger[_0x69fd('0x11')](_0x69fd('0xc'),_0x563d85,_0x804da4['error'][_0x69fd('0x12')]);return _0x48800b(_0x804da4[_0x69fd('0x11')][_0x69fd('0x12')]);}logger[_0x69fd('0x11')](_0x69fd('0xc'),_0x563d85,_0x804da4[_0x69fd('0x11')][_0x69fd('0x12')]);return _0x4e08ee(_0x804da4[_0x69fd('0x11')][_0x69fd('0x12')]);}else{logger[_0x69fd('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x563d85,_0x69fd('0xd'));_0x4e08ee(_0x804da4[_0x69fd('0x14')][_0x69fd('0x12')]);}})[_0x69fd('0x15')](function(_0x11f7a9){logger[_0x69fd('0x11')](_0x69fd('0xc'),_0x563d85,_0x11f7a9);_0x48800b(_0x11f7a9);});});} \ No newline at end of file +var _0x4819=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xb9ac5,_0x4d9640){var _0x3d4bd8=function(_0x25ec21){while(--_0x25ec21){_0xb9ac5['push'](_0xb9ac5['shift']());}};_0x3d4bd8(++_0x4d9640);}(_0x4819,0xec));var _0x9481=function(_0x20dbe3,_0x2cc5b3){_0x20dbe3=_0x20dbe3-0x0;var _0x57b693=_0x4819[_0x20dbe3];return _0x57b693;};'use strict';var _=require(_0x9481('0x0'));var util=require(_0x9481('0x1'));var moment=require('moment');var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))('rpc');var config=require(_0x9481('0x8'));var jayson=require(_0x9481('0x9'));var client=jayson['client'][_0x9481('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b769f,_0x4ed818,_0xf007a0){return new BPromise(function(_0x440c8f,_0x5143f8){return client[_0x9481('0xb')](_0x2b769f,_0xf007a0)[_0x9481('0xc')](function(_0x4296bc){logger[_0x9481('0xd')](_0x9481('0xe'),_0x4ed818,_0x9481('0xf'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x4ed818,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x4296bc));if(_0x4296bc[_0x9481('0x11')]){if(_0x4296bc[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xe'),_0x4ed818,_0x4296bc[_0x9481('0x11')][_0x9481('0x13')]);return _0x5143f8(_0x4296bc[_0x9481('0x11')]['message']);}logger[_0x9481('0x11')](_0x9481('0xe'),_0x4ed818,_0x4296bc['error'][_0x9481('0x13')]);return _0x440c8f(_0x4296bc[_0x9481('0x11')][_0x9481('0x13')]);}else{logger['info'](_0x9481('0xe'),_0x4ed818,_0x9481('0xf'));_0x440c8f(_0x4296bc[_0x9481('0x14')][_0x9481('0x13')]);}})[_0x9481('0x15')](function(_0x966cf9){logger[_0x9481('0x11')](_0x9481('0xe'),_0x4ed818,_0x966cf9);_0x5143f8(_0x966cf9);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 543dba9..3e24b6c 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 _0x23f4=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','delete','destroy','util'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x23f4,0x1ee));var _0x423f=function(_0x32e180,_0x486844){_0x32e180=_0x32e180-0x0;var _0x3e390d=_0x23f4[_0x32e180];return _0x3e390d;};'use strict';var multer=require('multer');var util=require(_0x423f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x423f('0x1'));var router=express[_0x423f('0x2')]();var fs_extra=require(_0x423f('0x3'));var auth=require(_0x423f('0x4'));var interaction=require(_0x423f('0x5'));var config=require(_0x423f('0x6'));var controller=require(_0x423f('0x7'));router[_0x423f('0x8')]('/',auth[_0x423f('0x9')](),controller['index']);router[_0x423f('0x8')](_0x423f('0xa'),auth['isAuthenticated'](),controller[_0x423f('0xb')]);router[_0x423f('0xc')]('/',auth[_0x423f('0x9')](),controller['create']);router['put']('/:id',auth[_0x423f('0x9')](),controller['update']);router[_0x423f('0xd')](_0x423f('0xa'),auth[_0x423f('0x9')](),controller[_0x423f('0xe')]);module['exports']=router; \ No newline at end of file +var _0x6347=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./analyticMetric.controller','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','util'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0x6347,0x1c9));var _0x7634=function(_0x2d1f2a,_0x4803f2){_0x2d1f2a=_0x2d1f2a-0x0;var _0x740409=_0x6347[_0x2d1f2a];return _0x740409;};'use strict';var multer=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var path=require('path');var timeout=require(_0x7634('0x2'));var express=require(_0x7634('0x3'));var router=express[_0x7634('0x4')]();var fs_extra=require(_0x7634('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7634('0x6'));var config=require('../../config/environment');var controller=require(_0x7634('0x7'));router[_0x7634('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7634('0x8')](_0x7634('0x9'),auth[_0x7634('0xa')](),controller[_0x7634('0xb')]);router[_0x7634('0xc')]('/',auth[_0x7634('0xa')](),controller['create']);router[_0x7634('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7634('0xe')](_0x7634('0x9'),auth[_0x7634('0xa')](),controller[_0x7634('0xf')]);module[_0x7634('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 145fe11..b75e6df 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 _0x7b72=['TEXT','sequelize','exports'];(function(_0x2db432,_0x1713f5){var _0x515b43=function(_0x5e7c81){while(--_0x5e7c81){_0x2db432['push'](_0x2db432['shift']());}};_0x515b43(++_0x1713f5);}(_0x7b72,0xcd));var _0x27b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b72[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x27b7('0x0'));module[_0x27b7('0x1')]={'tree':{'type':Sequelize[_0x27b7('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5c9b=['TEXT','sequelize','exports'];(function(_0x36982c,_0x226c13){var _0x4ff168=function(_0x44eec8){while(--_0x44eec8){_0x36982c['push'](_0x36982c['shift']());}};_0x4ff168(++_0x226c13);}(_0x5c9b,0x14e));var _0xb5c9=function(_0x880077,_0x3aedaa){_0x880077=_0x880077-0x0;var _0x86ba0d=_0x5c9b[_0x880077];return _0x86ba0d;};'use strict';var Sequelize=require(_0xb5c9('0x0'));module[_0xb5c9('0x1')]={'tree':{'type':Sequelize[_0xb5c9('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 2545614..6b4807f 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 _0x1383=['lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x1383,0x8c));var _0x3138=function(_0x381666,_0x435217){_0x381666=_0x381666-0x0;var _0x1212e5=_0x1383[_0x381666];return _0x1212e5;};'use strict';var emlformat=require(_0x3138('0x0'));var rimraf=require(_0x3138('0x1'));var zipdir=require(_0x3138('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3138('0x3'));var moment=require('moment');var BPromise=require(_0x3138('0x4'));var Mustache=require(_0x3138('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3138('0x6'));var csv=require(_0x3138('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3138('0x8'));var squel=require('squel');var crypto=require(_0x3138('0x9'));var jsforce=require(_0x3138('0xa'));var deskjs=require(_0x3138('0xb'));var toCsv=require(_0x3138('0x7'));var querystring=require(_0x3138('0xc'));var Papa=require(_0x3138('0xd'));var Redis=require(_0x3138('0xe'));var authService=require(_0x3138('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3138('0x10'));var hardwareService=require(_0x3138('0x11'));var logger=require(_0x3138('0x12'))(_0x3138('0x13'));var utils=require('../../config/utils');var config=require(_0x3138('0x14'));var licenseUtil=require(_0x3138('0x15'));var db=require(_0x3138('0x16'))['db'];function respondWithStatusCode(_0x48affb,_0x23c4ab){_0x23c4ab=_0x23c4ab||0xcc;return function(_0x23d1a8){if(_0x23d1a8){return _0x48affb[_0x3138('0x17')](_0x23c4ab);}return _0x48affb[_0x3138('0x18')](_0x23c4ab)[_0x3138('0x19')]();};}function respondWithResult(_0x377470,_0x34487e){_0x34487e=_0x34487e||0xc8;return function(_0xbf2cc0){if(_0xbf2cc0){return _0x377470[_0x3138('0x18')](_0x34487e)[_0x3138('0x1a')](_0xbf2cc0);}};}function respondWithFilteredResult(_0x201f55,_0xc42682){return function(_0x51edfa){if(_0x51edfa){var _0x14cde6=typeof _0xc42682[_0x3138('0x1b')]===_0x3138('0x1c')&&typeof _0xc42682[_0x3138('0x1d')]===_0x3138('0x1c');var _0x2c87ce=_0x51edfa[_0x3138('0x1e')];var _0x1b94a3=_0x14cde6?0x0:_0xc42682[_0x3138('0x1b')];var _0x185088=_0x14cde6?_0x51edfa['count']:_0xc42682['offset']+_0xc42682[_0x3138('0x1d')];var _0x4ef39e;if(_0x185088>=_0x2c87ce){_0x185088=_0x2c87ce;_0x4ef39e=0xc8;}else{_0x4ef39e=0xce;}_0x201f55[_0x3138('0x18')](_0x4ef39e);return _0x201f55[_0x3138('0x1f')]('Content-Range',_0x1b94a3+'-'+_0x185088+'/'+_0x2c87ce)[_0x3138('0x1a')](_0x51edfa);}return null;};}function patchUpdates(_0x515a92){return function(_0x2eda5b){try{jsonpatch['apply'](_0x2eda5b,_0x515a92,!![]);}catch(_0x4ad92f){return BPromise[_0x3138('0x20')](_0x4ad92f);}return _0x2eda5b[_0x3138('0x21')]();};}function saveUpdates(_0x28e6d5,_0x3141e5){return function(_0x49355b){if(_0x49355b){return _0x49355b['update'](_0x28e6d5)[_0x3138('0x22')](function(_0x3266a1){return _0x3266a1;});}return null;};}function removeEntity(_0x3754c6,_0x46c7ab){return function(_0x30276c){if(_0x30276c){return _0x30276c[_0x3138('0x23')]()[_0x3138('0x22')](function(){_0x3754c6[_0x3138('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5156fa,_0x3be314){return function(_0x4f091a){if(!_0x4f091a){_0x5156fa[_0x3138('0x17')](0x194);}return _0x4f091a;};}function handleError(_0x23ea1f,_0x22ff2a){_0x22ff2a=_0x22ff2a||0x1f4;return function(_0x41344a){logger[_0x3138('0x24')](_0x41344a[_0x3138('0x25')]);if(_0x41344a['name']){delete _0x41344a[_0x3138('0x26')];}_0x23ea1f['status'](_0x22ff2a)[_0x3138('0x27')](_0x41344a);};}exports[_0x3138('0x28')]=function(_0x110981,_0x232a53){var _0x304776={},_0x5be736={},_0x2aa7d9={'count':0x0,'rows':[]};var _0x20f407=_[_0x3138('0x29')](db[_0x3138('0x2a')][_0x3138('0x2b')],function(_0x3908fa){return{'name':_0x3908fa[_0x3138('0x2c')],'type':_0x3908fa['type'][_0x3138('0x2d')]};});_0x5be736[_0x3138('0x2e')]=_[_0x3138('0x29')](_0x20f407,_0x3138('0x26'));_0x5be736[_0x3138('0x2f')]=_['keys'](_0x110981['query']);_0x5be736[_0x3138('0x30')]=_[_0x3138('0x31')](_0x5be736[_0x3138('0x2e')],_0x5be736[_0x3138('0x2f')]);_0x304776[_0x3138('0x32')]=_['intersection'](_0x5be736[_0x3138('0x2e')],qs[_0x3138('0x33')](_0x110981[_0x3138('0x2f')][_0x3138('0x33')]));_0x304776['attributes']=_0x304776[_0x3138('0x32')][_0x3138('0x34')]?_0x304776[_0x3138('0x32')]:_0x5be736[_0x3138('0x2e')];if(!_0x110981[_0x3138('0x2f')][_0x3138('0x35')]('nolimit')){_0x304776['limit']=qs[_0x3138('0x1d')](_0x110981[_0x3138('0x2f')][_0x3138('0x1d')]);_0x304776[_0x3138('0x1b')]=qs[_0x3138('0x1b')](_0x110981[_0x3138('0x2f')][_0x3138('0x1b')]);}_0x304776[_0x3138('0x36')]=qs[_0x3138('0x37')](_0x110981['query'][_0x3138('0x37')]);_0x304776[_0x3138('0x38')]=qs[_0x3138('0x30')](_[_0x3138('0x39')](_0x110981[_0x3138('0x2f')],_0x5be736[_0x3138('0x30')]),_0x20f407);if(_0x110981[_0x3138('0x2f')][_0x3138('0x3a')]){_0x304776[_0x3138('0x38')]=_[_0x3138('0x3b')](_0x304776[_0x3138('0x38')],{'$or':_[_0x3138('0x29')](_0x20f407,function(_0x4b31f6){if(_0x4b31f6[_0x3138('0x3c')]!==_0x3138('0x3d')){var _0x16cd44={};_0x16cd44[_0x4b31f6[_0x3138('0x26')]]={'$like':'%'+_0x110981['query'][_0x3138('0x3a')]+'%'};return _0x16cd44;}})});}_0x304776=_['merge']({},_0x304776,_0x110981[_0x3138('0x3e')]);var _0x45280a={'where':_0x304776[_0x3138('0x38')]};return db['AnalyticTreeReport'][_0x3138('0x1e')](_0x45280a)[_0x3138('0x22')](function(_0x706c73){_0x2aa7d9[_0x3138('0x1e')]=_0x706c73;if(_0x110981[_0x3138('0x2f')][_0x3138('0x3f')]){_0x304776[_0x3138('0x40')]=[{'all':!![]}];}return db[_0x3138('0x2a')][_0x3138('0x41')](_0x304776);})['then'](function(_0xb38bc8){_0x2aa7d9[_0x3138('0x42')]=_0xb38bc8;return _0x2aa7d9;})[_0x3138('0x22')](respondWithFilteredResult(_0x232a53,_0x304776))['catch'](handleError(_0x232a53,null));};exports['show']=function(_0x5f03bd,_0x2a1999){var _0x296247={'raw':!![],'where':{'id':_0x5f03bd[_0x3138('0x43')]['id']}},_0x5b1321={};_0x5b1321[_0x3138('0x2e')]=_['keys'](db['AnalyticTreeReport']['rawAttributes']);_0x5b1321[_0x3138('0x2f')]=_[_0x3138('0x44')](_0x5f03bd['query']);_0x5b1321[_0x3138('0x30')]=_[_0x3138('0x31')](_0x5b1321[_0x3138('0x2e')],_0x5b1321['query']);_0x296247[_0x3138('0x32')]=_[_0x3138('0x31')](_0x5b1321[_0x3138('0x2e')],qs[_0x3138('0x33')](_0x5f03bd[_0x3138('0x2f')][_0x3138('0x33')]));_0x296247[_0x3138('0x32')]=_0x296247['attributes'][_0x3138('0x34')]?_0x296247['attributes']:_0x5b1321[_0x3138('0x2e')];if(_0x5f03bd['query'][_0x3138('0x3f')]){_0x296247[_0x3138('0x40')]=[{'all':!![]}];}_0x296247=_[_0x3138('0x3b')]({},_0x296247,_0x5f03bd['options']);return db[_0x3138('0x2a')][_0x3138('0x45')](_0x296247)[_0x3138('0x22')](handleEntityNotFound(_0x2a1999,null))[_0x3138('0x22')](respondWithResult(_0x2a1999,null))[_0x3138('0x46')](handleError(_0x2a1999,null));};exports[_0x3138('0x47')]=function(_0x11e981,_0x50e97d){return db[_0x3138('0x2a')][_0x3138('0x47')](_0x11e981[_0x3138('0x48')],{})[_0x3138('0x22')](respondWithResult(_0x50e97d,0xc9))[_0x3138('0x46')](handleError(_0x50e97d,null));};exports[_0x3138('0x49')]=function(_0x5a3a1f,_0x3bdfac){if(_0x5a3a1f[_0x3138('0x48')]['id']){delete _0x5a3a1f['body']['id'];}return db[_0x3138('0x2a')]['find']({'where':{'id':_0x5a3a1f['params']['id']}})[_0x3138('0x22')](handleEntityNotFound(_0x3bdfac,null))[_0x3138('0x22')](saveUpdates(_0x5a3a1f[_0x3138('0x48')],null))[_0x3138('0x22')](respondWithResult(_0x3bdfac,null))['catch'](handleError(_0x3bdfac,null));};exports[_0x3138('0x23')]=function(_0x5111d3,_0x5df5cc){return db['AnalyticTreeReport']['find']({'where':{'id':_0x5111d3[_0x3138('0x43')]['id']}})['then'](handleEntityNotFound(_0x5df5cc,null))[_0x3138('0x22')](removeEntity(_0x5df5cc,null))['catch'](handleError(_0x5df5cc,null));}; \ No newline at end of file +var _0xa462=['rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','index','AnalyticTreeReport','fieldName','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','include','findAll','params','rawAttributes','includeAll','catch','create','body','find','eml-format'];(function(_0x614f5,_0x2cfabe){var _0x2360f7=function(_0x30c1c3){while(--_0x30c1c3){_0x614f5['push'](_0x614f5['shift']());}};_0x2360f7(++_0x2cfabe);}(_0xa462,0x12f));var _0x2a46=function(_0x1afe66,_0x1cdecd){_0x1afe66=_0x1afe66-0x0;var _0x9a9acd=_0xa462[_0x1afe66];return _0x9a9acd;};'use strict';var emlformat=require(_0x2a46('0x0'));var rimraf=require(_0x2a46('0x1'));var zipdir=require(_0x2a46('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2a46('0x3'));var moment=require('moment');var BPromise=require(_0x2a46('0x4'));var Mustache=require(_0x2a46('0x5'));var util=require(_0x2a46('0x6'));var path=require(_0x2a46('0x7'));var sox=require(_0x2a46('0x8'));var csv=require(_0x2a46('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a46('0xa'));var _=require(_0x2a46('0xb'));var squel=require(_0x2a46('0xc'));var crypto=require(_0x2a46('0xd'));var jsforce=require(_0x2a46('0xe'));var deskjs=require(_0x2a46('0xf'));var toCsv=require(_0x2a46('0x9'));var querystring=require('querystring');var Papa=require(_0x2a46('0x10'));var Redis=require(_0x2a46('0x11'));var authService=require(_0x2a46('0x12'));var qs=require(_0x2a46('0x13'));var as=require(_0x2a46('0x14'));var hardwareService=require(_0x2a46('0x15'));var logger=require(_0x2a46('0x16'))(_0x2a46('0x17'));var utils=require(_0x2a46('0x18'));var config=require(_0x2a46('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a46('0x1a'))['db'];function respondWithStatusCode(_0x284073,_0x3a8ceb){_0x3a8ceb=_0x3a8ceb||0xcc;return function(_0x16de60){if(_0x16de60){return _0x284073['sendStatus'](_0x3a8ceb);}return _0x284073[_0x2a46('0x1b')](_0x3a8ceb)[_0x2a46('0x1c')]();};}function respondWithResult(_0x9fe1b9,_0x3a8ff3){_0x3a8ff3=_0x3a8ff3||0xc8;return function(_0x2fc0ca){if(_0x2fc0ca){return _0x9fe1b9[_0x2a46('0x1b')](_0x3a8ff3)[_0x2a46('0x1d')](_0x2fc0ca);}};}function respondWithFilteredResult(_0x234a38,_0x4e1a0a){return function(_0x3b9f4b){if(_0x3b9f4b){var _0x539994=typeof _0x4e1a0a[_0x2a46('0x1e')]===_0x2a46('0x1f')&&typeof _0x4e1a0a['limit']==='undefined';var _0x357498=_0x3b9f4b[_0x2a46('0x20')];var _0x1f1c56=_0x539994?0x0:_0x4e1a0a[_0x2a46('0x1e')];var _0xa255b=_0x539994?_0x3b9f4b['count']:_0x4e1a0a[_0x2a46('0x1e')]+_0x4e1a0a[_0x2a46('0x21')];var _0x136698;if(_0xa255b>=_0x357498){_0xa255b=_0x357498;_0x136698=0xc8;}else{_0x136698=0xce;}_0x234a38['status'](_0x136698);return _0x234a38[_0x2a46('0x22')](_0x2a46('0x23'),_0x1f1c56+'-'+_0xa255b+'/'+_0x357498)['json'](_0x3b9f4b);}return null;};}function patchUpdates(_0x53cc1f){return function(_0x2d14aa){try{jsonpatch[_0x2a46('0x24')](_0x2d14aa,_0x53cc1f,!![]);}catch(_0x170c0b){return BPromise['reject'](_0x170c0b);}return _0x2d14aa['save']();};}function saveUpdates(_0x356938,_0x386299){return function(_0x32ed5c){if(_0x32ed5c){return _0x32ed5c[_0x2a46('0x25')](_0x356938)[_0x2a46('0x26')](function(_0x4b0610){return _0x4b0610;});}return null;};}function removeEntity(_0x555289,_0x21636c){return function(_0x310523){if(_0x310523){return _0x310523[_0x2a46('0x27')]()['then'](function(){_0x555289[_0x2a46('0x1b')](0xcc)[_0x2a46('0x1c')]();});}};}function handleEntityNotFound(_0x498e10,_0x365d5b){return function(_0x47cc87){if(!_0x47cc87){_0x498e10[_0x2a46('0x28')](0x194);}return _0x47cc87;};}function handleError(_0x705547,_0x30206a){_0x30206a=_0x30206a||0x1f4;return function(_0xe87cf2){logger[_0x2a46('0x29')](_0xe87cf2[_0x2a46('0x2a')]);if(_0xe87cf2['name']){delete _0xe87cf2['name'];}_0x705547['status'](_0x30206a)['send'](_0xe87cf2);};}exports[_0x2a46('0x2b')]=function(_0x3fb77e,_0x11227c){var _0x506e1e={},_0x52b846={},_0x1afe6f={'count':0x0,'rows':[]};var _0x4722b0=_['map'](db[_0x2a46('0x2c')]['rawAttributes'],function(_0x4cde07){return{'name':_0x4cde07[_0x2a46('0x2d')],'type':_0x4cde07['type'][_0x2a46('0x2e')]};});_0x52b846[_0x2a46('0x2f')]=_['map'](_0x4722b0,_0x2a46('0x30'));_0x52b846[_0x2a46('0x31')]=_[_0x2a46('0x32')](_0x3fb77e['query']);_0x52b846[_0x2a46('0x33')]=_[_0x2a46('0x34')](_0x52b846[_0x2a46('0x2f')],_0x52b846[_0x2a46('0x31')]);_0x506e1e['attributes']=_[_0x2a46('0x34')](_0x52b846[_0x2a46('0x2f')],qs[_0x2a46('0x35')](_0x3fb77e[_0x2a46('0x31')]['fields']));_0x506e1e['attributes']=_0x506e1e[_0x2a46('0x36')][_0x2a46('0x37')]?_0x506e1e[_0x2a46('0x36')]:_0x52b846[_0x2a46('0x2f')];if(!_0x3fb77e[_0x2a46('0x31')][_0x2a46('0x38')]('nolimit')){_0x506e1e[_0x2a46('0x21')]=qs['limit'](_0x3fb77e['query'][_0x2a46('0x21')]);_0x506e1e['offset']=qs[_0x2a46('0x1e')](_0x3fb77e[_0x2a46('0x31')][_0x2a46('0x1e')]);}_0x506e1e[_0x2a46('0x39')]=qs[_0x2a46('0x3a')](_0x3fb77e[_0x2a46('0x31')][_0x2a46('0x3a')]);_0x506e1e[_0x2a46('0x3b')]=qs[_0x2a46('0x33')](_[_0x2a46('0x3c')](_0x3fb77e[_0x2a46('0x31')],_0x52b846[_0x2a46('0x33')]),_0x4722b0);if(_0x3fb77e[_0x2a46('0x31')][_0x2a46('0x3d')]){_0x506e1e['where']=_['merge'](_0x506e1e[_0x2a46('0x3b')],{'$or':_[_0x2a46('0x3e')](_0x4722b0,function(_0x35ef95){if(_0x35ef95[_0x2a46('0x3f')]!==_0x2a46('0x40')){var _0x41a287={};_0x41a287[_0x35ef95[_0x2a46('0x30')]]={'$like':'%'+_0x3fb77e[_0x2a46('0x31')][_0x2a46('0x3d')]+'%'};return _0x41a287;}})});}_0x506e1e=_[_0x2a46('0x41')]({},_0x506e1e,_0x3fb77e[_0x2a46('0x42')]);var _0x3f45c5={'where':_0x506e1e['where']};return db['AnalyticTreeReport'][_0x2a46('0x20')](_0x3f45c5)['then'](function(_0x5d81dc){_0x1afe6f[_0x2a46('0x20')]=_0x5d81dc;if(_0x3fb77e['query']['includeAll']){_0x506e1e[_0x2a46('0x43')]=[{'all':!![]}];}return db[_0x2a46('0x2c')][_0x2a46('0x44')](_0x506e1e);})[_0x2a46('0x26')](function(_0x3f0b1f){_0x1afe6f['rows']=_0x3f0b1f;return _0x1afe6f;})['then'](respondWithFilteredResult(_0x11227c,_0x506e1e))['catch'](handleError(_0x11227c,null));};exports['show']=function(_0x2808b1,_0x46c7b1){var _0x490cc7={'raw':!![],'where':{'id':_0x2808b1[_0x2a46('0x45')]['id']}},_0x2df5ce={};_0x2df5ce[_0x2a46('0x2f')]=_[_0x2a46('0x32')](db['AnalyticTreeReport'][_0x2a46('0x46')]);_0x2df5ce[_0x2a46('0x31')]=_[_0x2a46('0x32')](_0x2808b1[_0x2a46('0x31')]);_0x2df5ce[_0x2a46('0x33')]=_[_0x2a46('0x34')](_0x2df5ce[_0x2a46('0x2f')],_0x2df5ce[_0x2a46('0x31')]);_0x490cc7[_0x2a46('0x36')]=_['intersection'](_0x2df5ce['model'],qs[_0x2a46('0x35')](_0x2808b1[_0x2a46('0x31')]['fields']));_0x490cc7[_0x2a46('0x36')]=_0x490cc7['attributes']['length']?_0x490cc7['attributes']:_0x2df5ce[_0x2a46('0x2f')];if(_0x2808b1[_0x2a46('0x31')][_0x2a46('0x47')]){_0x490cc7['include']=[{'all':!![]}];}_0x490cc7=_[_0x2a46('0x41')]({},_0x490cc7,_0x2808b1[_0x2a46('0x42')]);return db[_0x2a46('0x2c')]['find'](_0x490cc7)[_0x2a46('0x26')](handleEntityNotFound(_0x46c7b1,null))[_0x2a46('0x26')](respondWithResult(_0x46c7b1,null))[_0x2a46('0x48')](handleError(_0x46c7b1,null));};exports[_0x2a46('0x49')]=function(_0x2d6b8e,_0x5a5668){return db[_0x2a46('0x2c')]['create'](_0x2d6b8e['body'],{})['then'](respondWithResult(_0x5a5668,0xc9))[_0x2a46('0x48')](handleError(_0x5a5668,null));};exports[_0x2a46('0x25')]=function(_0x464a02,_0x4e571e){if(_0x464a02[_0x2a46('0x4a')]['id']){delete _0x464a02[_0x2a46('0x4a')]['id'];}return db[_0x2a46('0x2c')]['find']({'where':{'id':_0x464a02[_0x2a46('0x45')]['id']}})[_0x2a46('0x26')](handleEntityNotFound(_0x4e571e,null))[_0x2a46('0x26')](saveUpdates(_0x464a02[_0x2a46('0x4a')],null))[_0x2a46('0x26')](respondWithResult(_0x4e571e,null))[_0x2a46('0x48')](handleError(_0x4e571e,null));};exports[_0x2a46('0x27')]=function(_0x380255,_0x2b86da){return db['AnalyticTreeReport'][_0x2a46('0x4b')]({'where':{'id':_0x380255[_0x2a46('0x45')]['id']}})[_0x2a46('0x26')](handleEntityNotFound(_0x2b86da,null))[_0x2a46('0x26')](removeEntity(_0x2b86da,null))[_0x2a46('0x48')](handleError(_0x2b86da,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index c26006d..e133139 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 _0xae6a=['analytics_report_trees','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport'];(function(_0x4d8f25,_0x1b0452){var _0x15ae64=function(_0x20bd6a){while(--_0x20bd6a){_0x4d8f25['push'](_0x4d8f25['shift']());}};_0x15ae64(++_0x1b0452);}(_0xae6a,0x79));var _0xaae6=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xae6a[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaae6('0x0'))('api');var moment=require(_0xaae6('0x1'));var BPromise=require(_0xaae6('0x2'));var rp=require(_0xaae6('0x3'));var fs=require('fs');var path=require(_0xaae6('0x4'));var rimraf=require('rimraf');var config=require(_0xaae6('0x5'));var attributes=require(_0xaae6('0x6'));module['exports']=function(_0x51cdca,_0x1c5361){return _0x51cdca[_0xaae6('0x7')](_0xaae6('0x8'),attributes,{'tableName':_0xaae6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08f1=['define','analytics_report_trees','lodash','util','../../config/logger','api','rimraf','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x08f1,0x160));var _0x108f=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x08f1[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x108f('0x0'));var util=require(_0x108f('0x1'));var logger=require(_0x108f('0x2'))(_0x108f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x108f('0x4'));var config=require(_0x108f('0x5'));var attributes=require(_0x108f('0x6'));module[_0x108f('0x7')]=function(_0x310432,_0x320bcf){return _0x310432[_0x108f('0x8')]('AnalyticTreeReport',attributes,{'tableName':_0x108f('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 5a641da..80bc295 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x112e6a,_0x4dfc41){var _0x1b691b=function(_0x9465e2){while(--_0x9465e2){_0x112e6a['push'](_0x112e6a['shift']());}};_0x1b691b(++_0x4dfc41);}(_0x2ef3,0xba));var _0x32ef=function(_0x314685,_0x28abb0){_0x314685=_0x314685-0x0;var _0x556c06=_0x2ef3[_0x314685];return _0x556c06;};'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')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x36f8eb,_0x5b6e60){var _0x14d199=function(_0x10b8b0){while(--_0x10b8b0){_0x36f8eb['push'](_0x36f8eb['shift']());}};_0x14d199(++_0x5b6e60);}(_0xdb28,0x106));var _0x8db2=function(_0x43daa0,_0x385585){_0x43daa0=_0x43daa0-0x0;var _0x49b51a=_0xdb28[_0x43daa0];return _0x49b51a;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 21f7d8d..1522f6f 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 _0x1792=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','/:id','show','post','isAuthenticated'];(function(_0x526e98,_0x5eda7e){var _0x204d42=function(_0x2d4ec0){while(--_0x2d4ec0){_0x526e98['push'](_0x526e98['shift']());}};_0x204d42(++_0x5eda7e);}(_0x1792,0x146));var _0x2179=function(_0x266a89,_0x1d1ace){_0x266a89=_0x266a89-0x0;var _0x1fae3e=_0x1792[_0x266a89];return _0x1fae3e;};'use strict';var multer=require('multer');var util=require(_0x2179('0x0'));var path=require(_0x2179('0x1'));var timeout=require(_0x2179('0x2'));var express=require(_0x2179('0x3'));var router=express[_0x2179('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2179('0x5'));var interaction=require(_0x2179('0x6'));var config=require(_0x2179('0x7'));var controller=require(_0x2179('0x8'));router[_0x2179('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2179('0x9')](_0x2179('0xa'),auth['isAuthenticated'](),controller[_0x2179('0xb')]);router[_0x2179('0xc')]('/',auth[_0x2179('0xd')](),controller[_0x2179('0xe')]);router[_0x2179('0xf')](_0x2179('0xa'),auth['isAuthenticated'](),controller[_0x2179('0x10')]);router[_0x2179('0x11')](_0x2179('0xa'),auth['isAuthenticated'](),controller[_0x2179('0x12')]);module[_0x2179('0x13')]=router; \ No newline at end of file +var _0x24cf=['put','update','delete','destroy','exports','util','path','express','Router','fs-extra','isAuthenticated','get','/:id','show','post','create'];(function(_0x19112a,_0x3f9d8e){var _0x21b9f0=function(_0x13f1a5){while(--_0x13f1a5){_0x19112a['push'](_0x19112a['shift']());}};_0x21b9f0(++_0x3f9d8e);}(_0x24cf,0xc5));var _0xf24c=function(_0x334df2,_0x3e5500){_0x334df2=_0x334df2-0x0;var _0x23a453=_0x24cf[_0x334df2];return _0x23a453;};'use strict';var multer=require('multer');var util=require(_0xf24c('0x0'));var path=require(_0xf24c('0x1'));var timeout=require('connect-timeout');var express=require(_0xf24c('0x2'));var router=express[_0xf24c('0x3')]();var fs_extra=require(_0xf24c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0xf24c('0x5')](),controller['index']);router[_0xf24c('0x6')](_0xf24c('0x7'),auth[_0xf24c('0x5')](),controller[_0xf24c('0x8')]);router[_0xf24c('0x9')]('/',auth[_0xf24c('0x5')](),controller[_0xf24c('0xa')]);router[_0xf24c('0xb')](_0xf24c('0x7'),auth[_0xf24c('0x5')](),controller[_0xf24c('0xc')]);router[_0xf24c('0xd')](_0xf24c('0x7'),auth['isAuthenticated'](),controller[_0xf24c('0xe')]);module[_0xf24c('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index cf3e27f..8598337 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 _0x1cc7=['STRING','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1cc7,0x15a));var _0x71cc=function(_0x4a2b02,_0x3eca2c){_0x4a2b02=_0x4a2b02-0x0;var _0x5c2104=_0x1cc7[_0x4a2b02];return _0x5c2104;};'use strict';var Sequelize=require(_0x71cc('0x0'));module[_0x71cc('0x1')]={'name':{'type':Sequelize[_0x71cc('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe0c3=['sequelize','STRING'];(function(_0x688a1,_0x4c742e){var _0x43ead1=function(_0x166569){while(--_0x166569){_0x688a1['push'](_0x688a1['shift']());}};_0x43ead1(++_0x4c742e);}(_0xe0c3,0xea));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3e0c('0x0'));module['exports']={'name':{'type':Sequelize[_0x3e0c('0x1')]},'basename':{'type':Sequelize[_0x3e0c('0x1')]},'type':{'type':Sequelize[_0x3e0c('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index d2ba285..bf69dec 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 _0x96fe=['send','map','rawAttributes','type','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','Attachment','includeAll','findAll','rows','catch','show','params','include','find','clone','get','omit','createdAt','updatedAt','body','create','update','file','basename','filename','download','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x96fe,0x1cd));var _0xe96f=function(_0x582c5b,_0x13e6ae){_0x582c5b=_0x582c5b-0x0;var _0xb73f6d=_0x96fe[_0x582c5b];return _0xb73f6d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe96f('0x0'));var jsonpatch=require(_0xe96f('0x1'));var rp=require('request-promise');var moment=require(_0xe96f('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe96f('0x3'));var sox=require(_0xe96f('0x4'));var csv=require(_0xe96f('0x5'));var ejs=require(_0xe96f('0x6'));var fs=require('fs');var fs_extra=require(_0xe96f('0x7'));var _=require(_0xe96f('0x8'));var squel=require(_0xe96f('0x9'));var crypto=require('crypto');var jsforce=require(_0xe96f('0xa'));var deskjs=require(_0xe96f('0xb'));var toCsv=require(_0xe96f('0x5'));var querystring=require(_0xe96f('0xc'));var Papa=require(_0xe96f('0xd'));var Redis=require(_0xe96f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe96f('0xf'));var as=require(_0xe96f('0x10'));var hardwareService=require(_0xe96f('0x11'));var logger=require('../../config/logger')(_0xe96f('0x12'));var utils=require(_0xe96f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe96f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49c6c3,_0x53fdde){_0x53fdde=_0x53fdde||0xcc;return function(_0x5b995d){if(_0x5b995d){return _0x49c6c3['sendStatus'](_0x53fdde);}return _0x49c6c3['status'](_0x53fdde)[_0xe96f('0x15')]();};}function respondWithResult(_0x14705e,_0x5ca28d){_0x5ca28d=_0x5ca28d||0xc8;return function(_0x5c817f){if(_0x5c817f){return _0x14705e['status'](_0x5ca28d)[_0xe96f('0x16')](_0x5c817f);}};}function respondWithFilteredResult(_0x4a7250,_0x147168){return function(_0x5ca612){if(_0x5ca612){var _0x3cad9b=typeof _0x147168['offset']===_0xe96f('0x17')&&typeof _0x147168[_0xe96f('0x18')]===_0xe96f('0x17');var _0x54e25c=_0x5ca612[_0xe96f('0x19')];var _0x3ab2e9=_0x3cad9b?0x0:_0x147168[_0xe96f('0x1a')];var _0x3a2112=_0x3cad9b?_0x5ca612['count']:_0x147168[_0xe96f('0x1a')]+_0x147168[_0xe96f('0x18')];var _0x18991a;if(_0x3a2112>=_0x54e25c){_0x3a2112=_0x54e25c;_0x18991a=0xc8;}else{_0x18991a=0xce;}_0x4a7250[_0xe96f('0x1b')](_0x18991a);return _0x4a7250[_0xe96f('0x1c')](_0xe96f('0x1d'),_0x3ab2e9+'-'+_0x3a2112+'/'+_0x54e25c)['json'](_0x5ca612);}return null;};}function patchUpdates(_0x190856){return function(_0x356f99){try{jsonpatch[_0xe96f('0x1e')](_0x356f99,_0x190856,!![]);}catch(_0x35f603){return BPromise[_0xe96f('0x1f')](_0x35f603);}return _0x356f99[_0xe96f('0x20')]();};}function saveUpdates(_0x52f4fc,_0x490b79){return function(_0x4fc6c4){if(_0x4fc6c4){return _0x4fc6c4['update'](_0x52f4fc)[_0xe96f('0x21')](function(_0x429a38){return _0x429a38;});}return null;};}function removeEntity(_0x119ce1,_0x3078f8){return function(_0x3d14b6){if(_0x3d14b6){return _0x3d14b6[_0xe96f('0x22')]()[_0xe96f('0x21')](function(){_0x119ce1[_0xe96f('0x1b')](0xcc)[_0xe96f('0x15')]();});}};}function handleEntityNotFound(_0x4eb338,_0x1c4171){return function(_0x7a5579){if(!_0x7a5579){_0x4eb338[_0xe96f('0x23')](0x194);}return _0x7a5579;};}function handleError(_0x1d4ebe,_0x488a51){_0x488a51=_0x488a51||0x1f4;return function(_0x4bb9d7){logger['error'](_0x4bb9d7['stack']);if(_0x4bb9d7[_0xe96f('0x24')]){delete _0x4bb9d7[_0xe96f('0x24')];}_0x1d4ebe['status'](_0x488a51)[_0xe96f('0x25')](_0x4bb9d7);};}exports['index']=function(_0x1356d5,_0xe9a0bc){var _0x52e83a={},_0x470e18={},_0x39abfe={'count':0x0,'rows':[]};var _0xef6c6d=_[_0xe96f('0x26')](db['Attachment'][_0xe96f('0x27')],function(_0xef67f5){return{'name':_0xef67f5['fieldName'],'type':_0xef67f5[_0xe96f('0x28')]['key']};});_0x470e18['model']=_['map'](_0xef6c6d,_0xe96f('0x24'));_0x470e18[_0xe96f('0x29')]=_[_0xe96f('0x2a')](_0x1356d5[_0xe96f('0x29')]);_0x470e18['filters']=_[_0xe96f('0x2b')](_0x470e18['model'],_0x470e18[_0xe96f('0x29')]);_0x52e83a[_0xe96f('0x2c')]=_['intersection'](_0x470e18['model'],qs[_0xe96f('0x2d')](_0x1356d5[_0xe96f('0x29')][_0xe96f('0x2d')]));_0x52e83a[_0xe96f('0x2c')]=_0x52e83a[_0xe96f('0x2c')][_0xe96f('0x2e')]?_0x52e83a[_0xe96f('0x2c')]:_0x470e18[_0xe96f('0x2f')];if(!_0x1356d5[_0xe96f('0x29')][_0xe96f('0x30')]('nolimit')){_0x52e83a[_0xe96f('0x18')]=qs[_0xe96f('0x18')](_0x1356d5[_0xe96f('0x29')][_0xe96f('0x18')]);_0x52e83a[_0xe96f('0x1a')]=qs[_0xe96f('0x1a')](_0x1356d5[_0xe96f('0x29')][_0xe96f('0x1a')]);}_0x52e83a[_0xe96f('0x31')]=qs[_0xe96f('0x32')](_0x1356d5[_0xe96f('0x29')][_0xe96f('0x32')]);_0x52e83a['where']=qs[_0xe96f('0x33')](_[_0xe96f('0x34')](_0x1356d5[_0xe96f('0x29')],_0x470e18[_0xe96f('0x33')]),_0xef6c6d);if(_0x1356d5[_0xe96f('0x29')][_0xe96f('0x35')]){_0x52e83a[_0xe96f('0x36')]=_[_0xe96f('0x37')](_0x52e83a['where'],{'$or':_[_0xe96f('0x26')](_0xef6c6d,function(_0x5a9309){if(_0x5a9309[_0xe96f('0x28')]!==_0xe96f('0x38')){var _0x26a440={};_0x26a440[_0x5a9309[_0xe96f('0x24')]]={'$like':'%'+_0x1356d5[_0xe96f('0x29')]['filter']+'%'};return _0x26a440;}})});}_0x52e83a=_[_0xe96f('0x37')]({},_0x52e83a,_0x1356d5[_0xe96f('0x39')]);var _0x17a403={'where':_0x52e83a[_0xe96f('0x36')]};return db[_0xe96f('0x3a')][_0xe96f('0x19')](_0x17a403)['then'](function(_0x249c21){_0x39abfe[_0xe96f('0x19')]=_0x249c21;if(_0x1356d5['query'][_0xe96f('0x3b')]){_0x52e83a['include']=[{'all':!![]}];}return db[_0xe96f('0x3a')][_0xe96f('0x3c')](_0x52e83a);})[_0xe96f('0x21')](function(_0x2d21d8){_0x39abfe[_0xe96f('0x3d')]=_0x2d21d8;return _0x39abfe;})[_0xe96f('0x21')](respondWithFilteredResult(_0xe9a0bc,_0x52e83a))[_0xe96f('0x3e')](handleError(_0xe9a0bc,null));};exports[_0xe96f('0x3f')]=function(_0x272c42,_0x5bd240){var _0x6a1991={'raw':!![],'where':{'id':_0x272c42[_0xe96f('0x40')]['id']}},_0x4706e6={};_0x4706e6[_0xe96f('0x2f')]=_[_0xe96f('0x2a')](db[_0xe96f('0x3a')][_0xe96f('0x27')]);_0x4706e6[_0xe96f('0x29')]=_[_0xe96f('0x2a')](_0x272c42[_0xe96f('0x29')]);_0x4706e6[_0xe96f('0x33')]=_[_0xe96f('0x2b')](_0x4706e6[_0xe96f('0x2f')],_0x4706e6[_0xe96f('0x29')]);_0x6a1991[_0xe96f('0x2c')]=_['intersection'](_0x4706e6['model'],qs[_0xe96f('0x2d')](_0x272c42[_0xe96f('0x29')]['fields']));_0x6a1991[_0xe96f('0x2c')]=_0x6a1991['attributes']['length']?_0x6a1991[_0xe96f('0x2c')]:_0x4706e6[_0xe96f('0x2f')];if(_0x272c42[_0xe96f('0x29')][_0xe96f('0x3b')]){_0x6a1991[_0xe96f('0x41')]=[{'all':!![]}];}_0x6a1991=_[_0xe96f('0x37')]({},_0x6a1991,_0x272c42[_0xe96f('0x39')]);return db[_0xe96f('0x3a')][_0xe96f('0x42')](_0x6a1991)[_0xe96f('0x21')](handleEntityNotFound(_0x5bd240,null))[_0xe96f('0x21')](respondWithResult(_0x5bd240,null))[_0xe96f('0x3e')](handleError(_0x5bd240,null));};exports[_0xe96f('0x43')]=function(_0x57f7a8,_0x3fc2bc){var _0x1f509b={'where':{'id':_0x57f7a8['params']['id']}},_0x2be0ac={};_0x2be0ac['model']=_[_0xe96f('0x2a')](db['Attachment'][_0xe96f('0x27')]);_0x1f509b[_0xe96f('0x2c')]=_[_0xe96f('0x2b')](_0x2be0ac[_0xe96f('0x2f')],qs[_0xe96f('0x2d')](_0x57f7a8['query'][_0xe96f('0x2d')]));_0x1f509b[_0xe96f('0x2c')]=_0x1f509b[_0xe96f('0x2c')]['length']?_0x1f509b[_0xe96f('0x2c')]:_0x2be0ac[_0xe96f('0x2f')];if(_0x57f7a8[_0xe96f('0x29')][_0xe96f('0x3b')]){_0x1f509b[_0xe96f('0x41')]=[{'all':!![]}];}_0x1f509b=_['merge']({},_0x1f509b,_0x57f7a8[_0xe96f('0x39')]);return db['Attachment'][_0xe96f('0x42')](_0x1f509b)[_0xe96f('0x21')](handleEntityNotFound(_0x3fc2bc,null))[_0xe96f('0x21')](function(_0x55bc19){if(_0x55bc19){var _0x7b74dc=_0x55bc19[_0xe96f('0x44')]({'plain':!![]});_0x7b74dc=qs[_0xe96f('0x45')](_0x7b74dc,['id',_0xe96f('0x46'),_0xe96f('0x47')]);_0x57f7a8['body']=_['omit'](_0x57f7a8[_0xe96f('0x48')],['id','createdAt',_0xe96f('0x47')]);return db[_0xe96f('0x3a')][_0xe96f('0x49')](_[_0xe96f('0x37')](_0x7b74dc,_0x57f7a8[_0xe96f('0x48')]),{'include':_0x57f7a8[_0xe96f('0x29')][_0xe96f('0x3b')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x3fc2bc,0xc9))[_0xe96f('0x3e')](handleError(_0x3fc2bc,null));};exports[_0xe96f('0x4a')]=function(_0x12357f,_0x38f16e){if(_0x12357f[_0xe96f('0x48')]['id']){delete _0x12357f[_0xe96f('0x48')]['id'];}return db['Attachment'][_0xe96f('0x42')]({'where':{'id':_0x12357f[_0xe96f('0x40')]['id']}})[_0xe96f('0x21')](handleEntityNotFound(_0x38f16e,null))[_0xe96f('0x21')](saveUpdates(_0x12357f[_0xe96f('0x48')],null))[_0xe96f('0x21')](respondWithResult(_0x38f16e,null))[_0xe96f('0x3e')](handleError(_0x38f16e,null));};exports[_0xe96f('0x22')]=function(_0x2dfb91,_0x3ca750){return db[_0xe96f('0x3a')][_0xe96f('0x42')]({'where':{'id':_0x2dfb91['params']['id']}})[_0xe96f('0x21')](handleEntityNotFound(_0x3ca750,null))[_0xe96f('0x21')](removeEntity(_0x3ca750,null))[_0xe96f('0x3e')](handleError(_0x3ca750,null));};exports[_0xe96f('0x49')]=function(_0x36e21b,_0x1b172,_0x43dd44){_0x36e21b[_0xe96f('0x48')][_0xe96f('0x24')]=_0x36e21b[_0xe96f('0x4b')]['originalname'];_0x36e21b['body'][_0xe96f('0x4c')]=_0x36e21b[_0xe96f('0x4b')][_0xe96f('0x4d')];_0x36e21b['body'][_0xe96f('0x28')]=_0x36e21b['file']['mimetype'];return db[_0xe96f('0x3a')][_0xe96f('0x49')](_0x36e21b['body'])[_0xe96f('0x21')](respondWithResult(_0x1b172,0xc9))[_0xe96f('0x3e')](handleError(_0x1b172,null));};exports[_0xe96f('0x4e')]=function(_0x15ce5d,_0x1feed7,_0x8fbf0a){return db[_0xe96f('0x3a')]['findOne']({'where':{'id':_0x15ce5d[_0xe96f('0x40')]['id']},'raw':!![]})[_0xe96f('0x21')](handleEntityNotFound(_0x1feed7,null))[_0xe96f('0x21')](function(_0x2c2553){if(_0x2c2553){var _0x16b998=_0x2c2553[_0xe96f('0x4f')]!==null;var _0x36b3b3=path[_0xe96f('0x50')](config['root'],_0xe96f('0x51'));if(_0x16b998){_0x36b3b3=path[_0xe96f('0x50')](_0x36b3b3,_0xe96f('0x52'));}var _0x2eeabf=path[_0xe96f('0x50')](_0x36b3b3,_0x2c2553['basename']);return _0x1feed7['download'](_0x2eeabf);}})[_0xe96f('0x3e')](handleError(_0x1feed7,null));}; \ No newline at end of file +var _0x6af8=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','undefined','count','set','Content-Range','reject','update','then','destroy','error','name','send','index','Attachment','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','clone','get','omit','createdAt','updatedAt','body','create','file','filename','mimetype','download','ChatOfflineMessageId','join','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x110a30,_0x1ec1e0){var _0x5f0e4f=function(_0x211ea0){while(--_0x211ea0){_0x110a30['push'](_0x110a30['shift']());}};_0x5f0e4f(++_0x1ec1e0);}(_0x6af8,0xe7));var _0x86af=function(_0x981675,_0x59feff){_0x981675=_0x981675-0x0;var _0x566cf4=_0x6af8[_0x981675];return _0x566cf4;};'use strict';var emlformat=require(_0x86af('0x0'));var rimraf=require(_0x86af('0x1'));var zipdir=require(_0x86af('0x2'));var jsonpatch=require(_0x86af('0x3'));var rp=require(_0x86af('0x4'));var moment=require(_0x86af('0x5'));var BPromise=require(_0x86af('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x86af('0x7'));var sox=require('sox');var csv=require(_0x86af('0x8'));var ejs=require(_0x86af('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x86af('0xa'));var crypto=require(_0x86af('0xb'));var jsforce=require(_0x86af('0xc'));var deskjs=require(_0x86af('0xd'));var toCsv=require('to-csv');var querystring=require(_0x86af('0xe'));var Papa=require('papaparse');var Redis=require(_0x86af('0xf'));var authService=require(_0x86af('0x10'));var qs=require(_0x86af('0x11'));var as=require(_0x86af('0x12'));var hardwareService=require(_0x86af('0x13'));var logger=require(_0x86af('0x14'))(_0x86af('0x15'));var utils=require('../../config/utils');var config=require(_0x86af('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c870b,_0x22ec55){_0x22ec55=_0x22ec55||0xcc;return function(_0x4be0ab){if(_0x4be0ab){return _0x3c870b[_0x86af('0x17')](_0x22ec55);}return _0x3c870b[_0x86af('0x18')](_0x22ec55)[_0x86af('0x19')]();};}function respondWithResult(_0xfd878,_0x2b563d){_0x2b563d=_0x2b563d||0xc8;return function(_0x46aa6b){if(_0x46aa6b){return _0xfd878[_0x86af('0x18')](_0x2b563d)['json'](_0x46aa6b);}};}function respondWithFilteredResult(_0x2a6ba1,_0x2205f9){return function(_0x44a5fa){if(_0x44a5fa){var _0x181da5=typeof _0x2205f9[_0x86af('0x1a')]===_0x86af('0x1b')&&typeof _0x2205f9['limit']===_0x86af('0x1b');var _0x36fb22=_0x44a5fa[_0x86af('0x1c')];var _0x90c30d=_0x181da5?0x0:_0x2205f9[_0x86af('0x1a')];var _0x5e7441=_0x181da5?_0x44a5fa[_0x86af('0x1c')]:_0x2205f9[_0x86af('0x1a')]+_0x2205f9['limit'];var _0x5f1c8c;if(_0x5e7441>=_0x36fb22){_0x5e7441=_0x36fb22;_0x5f1c8c=0xc8;}else{_0x5f1c8c=0xce;}_0x2a6ba1[_0x86af('0x18')](_0x5f1c8c);return _0x2a6ba1[_0x86af('0x1d')](_0x86af('0x1e'),_0x90c30d+'-'+_0x5e7441+'/'+_0x36fb22)['json'](_0x44a5fa);}return null;};}function patchUpdates(_0x2d5e8b){return function(_0x5e8271){try{jsonpatch['apply'](_0x5e8271,_0x2d5e8b,!![]);}catch(_0xe20753){return BPromise[_0x86af('0x1f')](_0xe20753);}return _0x5e8271['save']();};}function saveUpdates(_0x161bf8,_0x516902){return function(_0x17430b){if(_0x17430b){return _0x17430b[_0x86af('0x20')](_0x161bf8)[_0x86af('0x21')](function(_0x251a57){return _0x251a57;});}return null;};}function removeEntity(_0x5e83d7,_0x6aa612){return function(_0x1bb574){if(_0x1bb574){return _0x1bb574[_0x86af('0x22')]()[_0x86af('0x21')](function(){_0x5e83d7[_0x86af('0x18')](0xcc)[_0x86af('0x19')]();});}};}function handleEntityNotFound(_0x5565f6,_0x1ae07c){return function(_0x5961c8){if(!_0x5961c8){_0x5565f6[_0x86af('0x17')](0x194);}return _0x5961c8;};}function handleError(_0xd0eb7b,_0x5dae65){_0x5dae65=_0x5dae65||0x1f4;return function(_0x51b5a2){logger[_0x86af('0x23')](_0x51b5a2['stack']);if(_0x51b5a2[_0x86af('0x24')]){delete _0x51b5a2[_0x86af('0x24')];}_0xd0eb7b[_0x86af('0x18')](_0x5dae65)[_0x86af('0x25')](_0x51b5a2);};}exports[_0x86af('0x26')]=function(_0x44e322,_0x35f296){var _0x639b4d={},_0x13fa03={},_0x52c1a={'count':0x0,'rows':[]};var _0x2e64a8=_['map'](db[_0x86af('0x27')][_0x86af('0x28')],function(_0x4cd511){return{'name':_0x4cd511['fieldName'],'type':_0x4cd511[_0x86af('0x29')][_0x86af('0x2a')]};});_0x13fa03[_0x86af('0x2b')]=_[_0x86af('0x2c')](_0x2e64a8,_0x86af('0x24'));_0x13fa03['query']=_[_0x86af('0x2d')](_0x44e322[_0x86af('0x2e')]);_0x13fa03[_0x86af('0x2f')]=_[_0x86af('0x30')](_0x13fa03[_0x86af('0x2b')],_0x13fa03['query']);_0x639b4d['attributes']=_[_0x86af('0x30')](_0x13fa03[_0x86af('0x2b')],qs[_0x86af('0x31')](_0x44e322[_0x86af('0x2e')][_0x86af('0x31')]));_0x639b4d[_0x86af('0x32')]=_0x639b4d[_0x86af('0x32')][_0x86af('0x33')]?_0x639b4d[_0x86af('0x32')]:_0x13fa03[_0x86af('0x2b')];if(!_0x44e322[_0x86af('0x2e')][_0x86af('0x34')]('nolimit')){_0x639b4d[_0x86af('0x35')]=qs[_0x86af('0x35')](_0x44e322['query'][_0x86af('0x35')]);_0x639b4d[_0x86af('0x1a')]=qs[_0x86af('0x1a')](_0x44e322[_0x86af('0x2e')][_0x86af('0x1a')]);}_0x639b4d[_0x86af('0x36')]=qs[_0x86af('0x37')](_0x44e322[_0x86af('0x2e')][_0x86af('0x37')]);_0x639b4d['where']=qs['filters'](_[_0x86af('0x38')](_0x44e322[_0x86af('0x2e')],_0x13fa03[_0x86af('0x2f')]),_0x2e64a8);if(_0x44e322[_0x86af('0x2e')][_0x86af('0x39')]){_0x639b4d[_0x86af('0x3a')]=_[_0x86af('0x3b')](_0x639b4d['where'],{'$or':_[_0x86af('0x2c')](_0x2e64a8,function(_0x1c4294){if(_0x1c4294[_0x86af('0x29')]!==_0x86af('0x3c')){var _0x4627dc={};_0x4627dc[_0x1c4294[_0x86af('0x24')]]={'$like':'%'+_0x44e322[_0x86af('0x2e')]['filter']+'%'};return _0x4627dc;}})});}_0x639b4d=_[_0x86af('0x3b')]({},_0x639b4d,_0x44e322[_0x86af('0x3d')]);var _0xa78d94={'where':_0x639b4d[_0x86af('0x3a')]};return db[_0x86af('0x27')][_0x86af('0x1c')](_0xa78d94)[_0x86af('0x21')](function(_0x55a404){_0x52c1a[_0x86af('0x1c')]=_0x55a404;if(_0x44e322[_0x86af('0x2e')][_0x86af('0x3e')]){_0x639b4d[_0x86af('0x3f')]=[{'all':!![]}];}return db[_0x86af('0x27')]['findAll'](_0x639b4d);})[_0x86af('0x21')](function(_0x29d913){_0x52c1a[_0x86af('0x40')]=_0x29d913;return _0x52c1a;})['then'](respondWithFilteredResult(_0x35f296,_0x639b4d))[_0x86af('0x41')](handleError(_0x35f296,null));};exports[_0x86af('0x42')]=function(_0x5e6d74,_0x528df8){var _0x4c0e4d={'raw':!![],'where':{'id':_0x5e6d74[_0x86af('0x43')]['id']}},_0x2596f4={};_0x2596f4[_0x86af('0x2b')]=_[_0x86af('0x2d')](db[_0x86af('0x27')][_0x86af('0x28')]);_0x2596f4[_0x86af('0x2e')]=_[_0x86af('0x2d')](_0x5e6d74[_0x86af('0x2e')]);_0x2596f4[_0x86af('0x2f')]=_[_0x86af('0x30')](_0x2596f4[_0x86af('0x2b')],_0x2596f4['query']);_0x4c0e4d[_0x86af('0x32')]=_[_0x86af('0x30')](_0x2596f4[_0x86af('0x2b')],qs[_0x86af('0x31')](_0x5e6d74[_0x86af('0x2e')]['fields']));_0x4c0e4d[_0x86af('0x32')]=_0x4c0e4d['attributes']['length']?_0x4c0e4d[_0x86af('0x32')]:_0x2596f4[_0x86af('0x2b')];if(_0x5e6d74[_0x86af('0x2e')][_0x86af('0x3e')]){_0x4c0e4d[_0x86af('0x3f')]=[{'all':!![]}];}_0x4c0e4d=_[_0x86af('0x3b')]({},_0x4c0e4d,_0x5e6d74['options']);return db[_0x86af('0x27')][_0x86af('0x44')](_0x4c0e4d)[_0x86af('0x21')](handleEntityNotFound(_0x528df8,null))['then'](respondWithResult(_0x528df8,null))[_0x86af('0x41')](handleError(_0x528df8,null));};exports[_0x86af('0x45')]=function(_0x28f1a8,_0xb195a8){var _0x101e11={'where':{'id':_0x28f1a8[_0x86af('0x43')]['id']}},_0x210d7b={};_0x210d7b[_0x86af('0x2b')]=_['keys'](db[_0x86af('0x27')][_0x86af('0x28')]);_0x101e11[_0x86af('0x32')]=_['intersection'](_0x210d7b[_0x86af('0x2b')],qs[_0x86af('0x31')](_0x28f1a8[_0x86af('0x2e')][_0x86af('0x31')]));_0x101e11[_0x86af('0x32')]=_0x101e11['attributes'][_0x86af('0x33')]?_0x101e11['attributes']:_0x210d7b['model'];if(_0x28f1a8[_0x86af('0x2e')][_0x86af('0x3e')]){_0x101e11[_0x86af('0x3f')]=[{'all':!![]}];}_0x101e11=_['merge']({},_0x101e11,_0x28f1a8[_0x86af('0x3d')]);return db[_0x86af('0x27')][_0x86af('0x44')](_0x101e11)[_0x86af('0x21')](handleEntityNotFound(_0xb195a8,null))['then'](function(_0x1558b3){if(_0x1558b3){var _0x1d19a2=_0x1558b3[_0x86af('0x46')]({'plain':!![]});_0x1d19a2=qs[_0x86af('0x47')](_0x1d19a2,['id',_0x86af('0x48'),_0x86af('0x49')]);_0x28f1a8['body']=_[_0x86af('0x47')](_0x28f1a8[_0x86af('0x4a')],['id',_0x86af('0x48'),_0x86af('0x49')]);return db[_0x86af('0x27')][_0x86af('0x4b')](_[_0x86af('0x3b')](_0x1d19a2,_0x28f1a8[_0x86af('0x4a')]),{'include':_0x28f1a8['query'][_0x86af('0x3e')]?[{'all':!![]}]:undefined});}})[_0x86af('0x21')](respondWithResult(_0xb195a8,0xc9))[_0x86af('0x41')](handleError(_0xb195a8,null));};exports[_0x86af('0x20')]=function(_0x31d0f6,_0x573a96){if(_0x31d0f6[_0x86af('0x4a')]['id']){delete _0x31d0f6[_0x86af('0x4a')]['id'];}return db[_0x86af('0x27')][_0x86af('0x44')]({'where':{'id':_0x31d0f6['params']['id']}})[_0x86af('0x21')](handleEntityNotFound(_0x573a96,null))[_0x86af('0x21')](saveUpdates(_0x31d0f6[_0x86af('0x4a')],null))[_0x86af('0x21')](respondWithResult(_0x573a96,null))['catch'](handleError(_0x573a96,null));};exports[_0x86af('0x22')]=function(_0x1936e1,_0x239252){return db[_0x86af('0x27')][_0x86af('0x44')]({'where':{'id':_0x1936e1[_0x86af('0x43')]['id']}})[_0x86af('0x21')](handleEntityNotFound(_0x239252,null))[_0x86af('0x21')](removeEntity(_0x239252,null))[_0x86af('0x41')](handleError(_0x239252,null));};exports[_0x86af('0x4b')]=function(_0x474a23,_0x112355,_0xa4ba52){_0x474a23[_0x86af('0x4a')][_0x86af('0x24')]=_0x474a23[_0x86af('0x4c')]['originalname'];_0x474a23[_0x86af('0x4a')]['basename']=_0x474a23[_0x86af('0x4c')][_0x86af('0x4d')];_0x474a23[_0x86af('0x4a')][_0x86af('0x29')]=_0x474a23[_0x86af('0x4c')][_0x86af('0x4e')];return db['Attachment'][_0x86af('0x4b')](_0x474a23[_0x86af('0x4a')])[_0x86af('0x21')](respondWithResult(_0x112355,0xc9))[_0x86af('0x41')](handleError(_0x112355,null));};exports[_0x86af('0x4f')]=function(_0x21c61a,_0x309762,_0x38031d){return db[_0x86af('0x27')]['findOne']({'where':{'id':_0x21c61a[_0x86af('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x309762,null))['then'](function(_0x5be14a){if(_0x5be14a){var _0x3c3533=_0x5be14a[_0x86af('0x50')]!==null;var _0xe10bfd=path[_0x86af('0x51')](config['root'],'server/files/attachments/');if(_0x3c3533){_0xe10bfd=path[_0x86af('0x51')](_0xe10bfd,'offline-chat/');}var _0x1194b7=path[_0x86af('0x51')](_0xe10bfd,_0x5be14a[_0x86af('0x52')]);return _0x309762[_0x86af('0x4f')](_0x1194b7);}})[_0x86af('0x41')](handleError(_0x309762,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 5f80e34..159d4c3 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 _0x34b8=['moment','bluebird','request-promise','path','../../config/environment','./attachment.attributes','define','Attachment','attachments','util','../../config/logger','api'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x34b8,0x1a1));var _0x834b=function(_0x5691bd,_0x20a3ae){_0x5691bd=_0x5691bd-0x0;var _0x4e0259=_0x34b8[_0x5691bd];return _0x4e0259;};'use strict';var _=require('lodash');var util=require(_0x834b('0x0'));var logger=require(_0x834b('0x1'))(_0x834b('0x2'));var moment=require(_0x834b('0x3'));var BPromise=require(_0x834b('0x4'));var rp=require(_0x834b('0x5'));var fs=require('fs');var path=require(_0x834b('0x6'));var rimraf=require('rimraf');var config=require(_0x834b('0x7'));var attributes=require(_0x834b('0x8'));module['exports']=function(_0x11c5de,_0x310b13){return _0x11c5de[_0x834b('0x9')](_0x834b('0xa'),attributes,{'tableName':_0x834b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe525=['../../config/logger','request-promise','path','../../config/environment','./attachment.attributes','exports','Attachment','attachments','lodash','util'];(function(_0x43ed13,_0x2b7693){var _0x4a3a37=function(_0x4e4cbb){while(--_0x4e4cbb){_0x43ed13['push'](_0x43ed13['shift']());}};_0x4a3a37(++_0x2b7693);}(_0xe525,0xc6));var _0x5e52=function(_0x4a81b9,_0x320e9c){_0x4a81b9=_0x4a81b9-0x0;var _0x40e1d3=_0xe525[_0x4a81b9];return _0x40e1d3;};'use strict';var _=require(_0x5e52('0x0'));var util=require(_0x5e52('0x1'));var logger=require(_0x5e52('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5e52('0x3'));var fs=require('fs');var path=require(_0x5e52('0x4'));var rimraf=require('rimraf');var config=require(_0x5e52('0x5'));var attributes=require(_0x5e52('0x6'));module[_0x5e52('0x7')]=function(_0xcdb3a9,_0x3dc544){return _0xcdb3a9['define'](_0x5e52('0x8'),attributes,{'tableName':_0x5e52('0x9'),'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 700f20c..726e163 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 _0x9de3=['jayson/promise','http','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','create','options','CreateAttachment','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x5f01f7,_0x4aefaa){var _0x4bb40e=function(_0x2868bf){while(--_0x2868bf){_0x5f01f7['push'](_0x5f01f7['shift']());}};_0x4bb40e(++_0x4aefaa);}(_0x9de3,0xea));var _0x39de=function(_0x195a66,_0x1f1ac1){_0x195a66=_0x195a66-0x0;var _0x55cff6=_0x9de3[_0x195a66];return _0x55cff6;};'use strict';var _=require(_0x39de('0x0'));var util=require('util');var moment=require(_0x39de('0x1'));var BPromise=require(_0x39de('0x2'));var rs=require(_0x39de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x39de('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x39de('0x5'))(_0x39de('0x6'));var config=require(_0x39de('0x7'));var jayson=require(_0x39de('0x8'));var client=jayson['client'][_0x39de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x185872,_0x3ed6a1,_0x87049c){return new BPromise(function(_0x2604fa,_0x59ce28){return client['request'](_0x185872,_0x87049c)['then'](function(_0x27e596){logger[_0x39de('0xa')](_0x39de('0xb'),_0x3ed6a1,_0x39de('0xc'));logger[_0x39de('0xd')](_0x39de('0xe'),_0x3ed6a1,_0x39de('0xc'),JSON[_0x39de('0xf')](_0x27e596));if(_0x27e596['error']){if(_0x27e596[_0x39de('0x10')]['code']===0x1f4){logger['error'](_0x39de('0xb'),_0x3ed6a1,_0x27e596[_0x39de('0x10')][_0x39de('0x11')]);return _0x59ce28(_0x27e596['error'][_0x39de('0x11')]);}logger[_0x39de('0x10')](_0x39de('0xb'),_0x3ed6a1,_0x27e596[_0x39de('0x10')][_0x39de('0x11')]);return _0x2604fa(_0x27e596[_0x39de('0x10')][_0x39de('0x11')]);}else{logger[_0x39de('0xa')](_0x39de('0xb'),_0x3ed6a1,_0x39de('0xc'));_0x2604fa(_0x27e596['result'][_0x39de('0x11')]);}})[_0x39de('0x12')](function(_0x20bd18){logger[_0x39de('0x10')]('Attachment,\x20%s,\x20%s',_0x3ed6a1,_0x20bd18);_0x59ce28(_0x20bd18);});});}exports['CreateAttachment']=function(_0x2d355b){var _0x5e9e37=this;return new Promise(function(_0x1fb6fa,_0x1d08a2){return db['Attachment'][_0x39de('0x13')](_0x2d355b['body'],{'raw':_0x2d355b[_0x39de('0x14')]?_0x2d355b[_0x39de('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xab6f89){logger['info']('CreateAttachment',_0x2d355b);logger[_0x39de('0xd')](_0x39de('0x15'),_0x2d355b,JSON[_0x39de('0xf')](_0xab6f89));_0x1fb6fa(_0xab6f89);})[_0x39de('0x12')](function(_0x400d62){logger[_0x39de('0x10')]('CreateAttachment',_0x400d62[_0x39de('0x11')],_0x2d355b);_0x1d08a2(_0x5e9e37[_0x39de('0x10')](0x1f4,_0x400d62[_0x39de('0x11')]));});});}; \ No newline at end of file +var _0xee5b=['debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateAttachment','Attachment','create','body','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','Attachment,\x20%s,\x20%s'];(function(_0x39f364,_0x230572){var _0x295493=function(_0x48a360){while(--_0x48a360){_0x39f364['push'](_0x39f364['shift']());}};_0x295493(++_0x230572);}(_0xee5b,0x1f4));var _0xbee5=function(_0x49f1cf,_0x50e313){_0x49f1cf=_0x49f1cf-0x0;var _0x540043=_0xee5b[_0x49f1cf];return _0x540043;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var moment=require(_0xbee5('0x1'));var BPromise=require(_0xbee5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbee5('0x3'));var db=require(_0xbee5('0x4'))['db'];var utils=require(_0xbee5('0x5'));var logger=require(_0xbee5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbee5('0x7'));var client=jayson[_0xbee5('0x8')][_0xbee5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x804ab8,_0x4f5065,_0x5505e3){return new BPromise(function(_0x53d5b9,_0x5baf5c){return client['request'](_0x804ab8,_0x5505e3)[_0xbee5('0xa')](function(_0x7dda04){logger[_0xbee5('0xb')](_0xbee5('0xc'),_0x4f5065,'request\x20sent');logger[_0xbee5('0xd')](_0xbee5('0xe'),_0x4f5065,_0xbee5('0xf'),JSON[_0xbee5('0x10')](_0x7dda04));if(_0x7dda04[_0xbee5('0x11')]){if(_0x7dda04[_0xbee5('0x11')][_0xbee5('0x12')]===0x1f4){logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error'][_0xbee5('0x13')]);return _0x5baf5c(_0x7dda04['error'][_0xbee5('0x13')]);}logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error']['message']);return _0x53d5b9(_0x7dda04[_0xbee5('0x11')]['message']);}else{logger[_0xbee5('0xb')]('Attachment,\x20%s,\x20%s',_0x4f5065,_0xbee5('0xf'));_0x53d5b9(_0x7dda04[_0xbee5('0x14')][_0xbee5('0x13')]);}})['catch'](function(_0x27e034){logger[_0xbee5('0x11')]('Attachment,\x20%s,\x20%s',_0x4f5065,_0x27e034);_0x5baf5c(_0x27e034);});});}exports[_0xbee5('0x15')]=function(_0x538460){var _0x11b4a3=this;return new Promise(function(_0x3c3f4e,_0x35eb5c){return db[_0xbee5('0x16')][_0xbee5('0x17')](_0x538460[_0xbee5('0x18')],{'raw':_0x538460[_0xbee5('0x19')]?_0x538460[_0xbee5('0x19')][_0xbee5('0x1a')]===undefined?!![]:![]:!![]})[_0xbee5('0xa')](function(_0x35d7d3){logger[_0xbee5('0xb')](_0xbee5('0x15'),_0x538460);logger['debug']('CreateAttachment',_0x538460,JSON[_0xbee5('0x10')](_0x35d7d3));_0x3c3f4e(_0x35d7d3);})['catch'](function(_0x205491){logger[_0xbee5('0x11')](_0xbee5('0x15'),_0x205491[_0xbee5('0x13')],_0x538460);_0x35eb5c(_0x11b4a3[_0xbee5('0x11')](0x1f4,_0x205491[_0xbee5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 7bc012c..184a3ef 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x18776a,_0x4fecab){_0x18776a=_0x18776a-0x0;var _0x484e4a=_0x0b0e[_0x18776a];return _0x484e4a;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'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 baa4631..639e2ab 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 _0xac20=['catch','status','send','message','login','ad-login','role','signToken','json','use','passport','passport-local','Strategy','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','activedirectory','undefined','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled','blocked','online','user','agent','blockedAt','add','minutes','clearBlockUser','getLicense'];(function(_0x485038,_0x3e26e8){var _0xa87ace=function(_0x1cf247){while(--_0x1cf247){_0x485038['push'](_0x485038['shift']());}};_0xa87ace(++_0x3e26e8);}(_0xac20,0x9a));var _0x0ac2=function(_0x555f67,_0x57ad68){_0x555f67=_0x555f67-0x0;var _0x5bf0ac=_0xac20[_0x555f67];return _0x5bf0ac;};'use strict';var passport=require(_0x0ac2('0x0'));var LocalStrategy=require(_0x0ac2('0x1'))[_0x0ac2('0x2')];var moment=require('moment');var ActiveDirectory=require(_0x0ac2('0x3'));var BPromise=require('bluebird');var util=require(_0x0ac2('0x4'));var db=require(_0x0ac2('0x5'))['db'];var authService=require(_0x0ac2('0x6'));var utils=require(_0x0ac2('0x7'));var config=require(_0x0ac2('0x8'));var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0x3244fc){var _0x84bdac=![];if(typeof _0x3244fc[_0x0ac2('0x9')]!==_0x0ac2('0xa')){_0x84bdac=_0x3244fc[_0x0ac2('0x9')][_0x0ac2('0xb')]&&_0x3244fc[_0x0ac2('0x9')]['url']&&_0x3244fc[_0x0ac2('0x9')][_0x0ac2('0xc')];}return _0x84bdac;}function adAuthenticate(_0x2a4423,_0x5a80b3,_0x8e4c1b){return new BPromise(function(_0x187d1e,_0x31eadb){try{var _0x2c8b0a=new ActiveDirectory(_0x2a4423);_0x2c8b0a[_0x0ac2('0xd')](_0x5a80b3,_0x8e4c1b,function(_0x2b2fcd,_0x5572f5){if(_0x2b2fcd){logger[_0x0ac2('0xe')](_0x0ac2('0xf'),_0x5a80b3,util[_0x0ac2('0x10')](_0x2b2fcd,{'showHidden':![],'depth':null}));_0x31eadb(_0x0ac2('0x11'));}else if(!_0x5572f5){logger[_0x0ac2('0xe')](_0x0ac2('0x12'),_0x5a80b3);_0x31eadb(_0x0ac2('0x11'));}else{_0x187d1e(_0x5572f5);}});}catch(_0x472681){_0x31eadb(_0x472681);}});}function ActiveDirectoryAuthenticate(_0x2c277b,_0x28c0af,_0x287821,_0x11fbda){var _0x50a2ed,_0x149434;if(!isActiveDirectoryConfigured(config)){logger[_0x0ac2('0xe')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x28c0af);return _0x11fbda(null,![],{'message':_0x0ac2('0x11')});}return db[_0x0ac2('0x13')][_0x0ac2('0x14')]({'where':{'id':0x1},'attributes':[_0x0ac2('0x15'),_0x0ac2('0x16')],'raw':!![]})[_0x0ac2('0x17')](function(_0x161378){_0x50a2ed=_0x161378;if(!_0x50a2ed[_0x0ac2('0x15')]){logger[_0x0ac2('0xe')](_0x0ac2('0x18'),_0x28c0af);throw new Error(_0x0ac2('0x11'));}return _0x2c277b['findOne']({'attributes':['id',_0x0ac2('0x19'),_0x0ac2('0x1a'),_0x0ac2('0x1b'),'role',_0x0ac2('0x1c'),_0x0ac2('0x1d'),'blockedAt',_0x0ac2('0x1e')],'where':{'name':_0x28c0af,'role':{'$or':['admin',_0x0ac2('0x1f'),_0x0ac2('0x20')]},'adSsoEnabled':!![]}});})[_0x0ac2('0x17')](function(_0x1f62d3){if(!_0x1f62d3||_0x1f62d3&&_0x1f62d3[_0x0ac2('0x19')]!==_0x28c0af){throw new Error(_0x0ac2('0x11'));}_0x149434=_0x1f62d3;var _0x68e20=_0x149434[_0x0ac2('0x19')]+'@'+config[_0x0ac2('0x9')][_0x0ac2('0xc')];return adAuthenticate(config[_0x0ac2('0x9')],_0x68e20,_0x287821);})['then'](function(_0x3fdcd6){if(_0x149434[_0x0ac2('0x1c')]){throw new Error(_0x0ac2('0x11'));}if(_0x50a2ed['blockDuration']>0x0){if(_0x149434[_0x0ac2('0x1d')]){if(moment(_0x149434[_0x0ac2('0x21')])[_0x0ac2('0x22')](_0x50a2ed[_0x0ac2('0x16')],_0x0ac2('0x23'))>moment()){throw new Error(_0x0ac2('0x11'));}return utils[_0x0ac2('0x24')](_0x149434,0x0,![],null)[_0x0ac2('0x17')](function(){return utils[_0x0ac2('0x25')](_0x149434);})['then'](function(){return _0x11fbda(null,_0x149434);});}else{return utils[_0x0ac2('0x25')](_0x149434)['then'](function(){return _0x11fbda(null,_0x149434);});}}else{return utils['getLicense'](_0x149434)[_0x0ac2('0x17')](function(){return _0x11fbda(null,_0x149434);});}})[_0x0ac2('0x26')](function(_0x5cded3){return _0x11fbda(null,![],_0x5cded3);});}function handleError(_0x486aa7,_0x2c0979,_0x42f8bc){return _0x486aa7[_0x0ac2('0x27')](_0x2c0979||0x1f4)[_0x0ac2('0x28')]({'message':_0x42f8bc?_0x42f8bc[_0x0ac2('0x29')]||_0x42f8bc:''});}exports[_0x0ac2('0x2a')]=function(_0x1236ac,_0x54646b,_0x32f7af){passport[_0x0ac2('0xd')](_0x0ac2('0x2b'),function(_0x44bfae,_0x2ed07d,_0x4743ba){var _0x41f46b=_0x44bfae||_0x4743ba;if(_0x41f46b){return handleError(_0x54646b,0x191,_0x41f46b);}if(!_0x2ed07d){return handleError(_0x54646b,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x128125={'payload':{'id':_0x2ed07d['id'],'role':_0x2ed07d[_0x0ac2('0x2c')]},'options':{'expiresIn':0x15180}};return authService[_0x0ac2('0x2d')](_0x128125)['then'](function(_0xa46175){_0x54646b[_0x0ac2('0x2e')]({'id':_0x2ed07d['id'],'token':_0xa46175,'statusCall':'','isAlreadyLogged':_0x2ed07d[_0x0ac2('0x1e')]});});}})(_0x1236ac,_0x54646b,_0x32f7af);};passport[_0x0ac2('0x2f')]('ad-login',new LocalStrategy({'usernameField':_0x0ac2('0x19'),'passwordField':_0x0ac2('0x1a')},function(_0x5d7cd4,_0x548f50,_0x1e6214){return ActiveDirectoryAuthenticate(db['User'],_0x5d7cd4,_0x548f50,_0x1e6214);})); \ No newline at end of file +var _0xe7ce=['blockedAt','online','admin','user','agent','then','disabled','add','minutes','clearBlockUser','getLicense','catch','status','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport-local','Strategy','bluebird','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','name','password','role','blocked'];(function(_0x4a9fb7,_0x4cbfd7){var _0x40b90e=function(_0x59664c){while(--_0x59664c){_0x4a9fb7['push'](_0x4a9fb7['shift']());}};_0x40b90e(++_0x4cbfd7);}(_0xe7ce,0x185));var _0xee7c=function(_0x4bc927,_0x25e1da){_0x4bc927=_0x4bc927-0x0;var _0x4f08a8=_0xe7ce[_0x4bc927];return _0x4f08a8;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xee7c('0x0'))[_0xee7c('0x1')];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xee7c('0x2'));var util=require(_0xee7c('0x3'));var db=require(_0xee7c('0x4'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xee7c('0x5'));var config=require(_0xee7c('0x6'));var logger=require(_0xee7c('0x7'))(_0xee7c('0x8'));function isActiveDirectoryConfigured(_0x4e1813){var _0x10238f=![];if(typeof _0x4e1813[_0xee7c('0x9')]!==_0xee7c('0xa')){_0x10238f=_0x4e1813[_0xee7c('0x9')][_0xee7c('0xb')]&&_0x4e1813[_0xee7c('0x9')][_0xee7c('0xc')]&&_0x4e1813[_0xee7c('0x9')]['domain'];}return _0x10238f;}function adAuthenticate(_0x3fcf0a,_0x13e0da,_0x1d721b){return new BPromise(function(_0x4a93e4,_0x37833f){try{var _0x7b69fa=new ActiveDirectory(_0x3fcf0a);_0x7b69fa[_0xee7c('0xd')](_0x13e0da,_0x1d721b,function(_0x33b10e,_0x511045){if(_0x33b10e){logger[_0xee7c('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x13e0da,util[_0xee7c('0xf')](_0x33b10e,{'showHidden':![],'depth':null}));_0x37833f(_0xee7c('0x10'));}else if(!_0x511045){logger[_0xee7c('0xe')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x13e0da);_0x37833f(_0xee7c('0x10'));}else{_0x4a93e4(_0x511045);}});}catch(_0x5f44c6){_0x37833f(_0x5f44c6);}});}function ActiveDirectoryAuthenticate(_0x9ae5de,_0x355a1d,_0x21e5a2,_0x374984){var _0x4bd9d4,_0x1cdfcc;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xee7c('0x11'),_0x355a1d);return _0x374984(null,![],{'message':_0xee7c('0x10')});}return db['Setting'][_0xee7c('0x12')]({'where':{'id':0x1},'attributes':[_0xee7c('0x13'),_0xee7c('0x14')],'raw':!![]})['then'](function(_0x49e4f7){_0x4bd9d4=_0x49e4f7;if(!_0x4bd9d4[_0xee7c('0x13')]){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x355a1d);throw new Error(_0xee7c('0x10'));}return _0x9ae5de[_0xee7c('0x12')]({'attributes':['id',_0xee7c('0x15'),_0xee7c('0x16'),'salt',_0xee7c('0x17'),'disabled',_0xee7c('0x18'),_0xee7c('0x19'),_0xee7c('0x1a')],'where':{'name':_0x355a1d,'role':{'$or':[_0xee7c('0x1b'),_0xee7c('0x1c'),_0xee7c('0x1d')]},'adSsoEnabled':!![]}});})[_0xee7c('0x1e')](function(_0x2fbebd){if(!_0x2fbebd||_0x2fbebd&&_0x2fbebd[_0xee7c('0x15')]!==_0x355a1d){throw new Error(_0xee7c('0x10'));}_0x1cdfcc=_0x2fbebd;var _0x36c5e3=_0x1cdfcc[_0xee7c('0x15')]+'@'+config[_0xee7c('0x9')]['domain'];return adAuthenticate(config[_0xee7c('0x9')],_0x36c5e3,_0x21e5a2);})[_0xee7c('0x1e')](function(_0x5e1da5){if(_0x1cdfcc[_0xee7c('0x1f')]){throw new Error(_0xee7c('0x10'));}if(_0x4bd9d4[_0xee7c('0x14')]>0x0){if(_0x1cdfcc[_0xee7c('0x18')]){if(moment(_0x1cdfcc[_0xee7c('0x19')])[_0xee7c('0x20')](_0x4bd9d4[_0xee7c('0x14')],_0xee7c('0x21'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xee7c('0x22')](_0x1cdfcc,0x0,![],null)[_0xee7c('0x1e')](function(){return utils[_0xee7c('0x23')](_0x1cdfcc);})['then'](function(){return _0x374984(null,_0x1cdfcc);});}else{return utils['getLicense'](_0x1cdfcc)[_0xee7c('0x1e')](function(){return _0x374984(null,_0x1cdfcc);});}}else{return utils[_0xee7c('0x23')](_0x1cdfcc)[_0xee7c('0x1e')](function(){return _0x374984(null,_0x1cdfcc);});}})[_0xee7c('0x24')](function(_0x6686a6){return _0x374984(null,![],_0x6686a6);});}function handleError(_0x2da04a,_0x5213e2,_0x147b5c){return _0x2da04a[_0xee7c('0x25')](_0x5213e2||0x1f4)['send']({'message':_0x147b5c?_0x147b5c[_0xee7c('0x26')]||_0x147b5c:''});}exports[_0xee7c('0x27')]=function(_0x2cb1d1,_0x1f7dd4,_0x558b97){passport[_0xee7c('0xd')](_0xee7c('0x28'),function(_0x2ac5b1,_0x5d2ae2,_0x301255){var _0xce9272=_0x2ac5b1||_0x301255;if(_0xce9272){return handleError(_0x1f7dd4,0x191,_0xce9272);}if(!_0x5d2ae2){return handleError(_0x1f7dd4,0x194,{'message':_0xee7c('0x29')});}else{var _0x3127f2={'payload':{'id':_0x5d2ae2['id'],'role':_0x5d2ae2[_0xee7c('0x17')]},'options':{'expiresIn':0x15180}};return authService[_0xee7c('0x2a')](_0x3127f2)['then'](function(_0x3dec9f){_0x1f7dd4[_0xee7c('0x2b')]({'id':_0x5d2ae2['id'],'token':_0x3dec9f,'statusCall':'','isAlreadyLogged':_0x5d2ae2[_0xee7c('0x1a')]});});}})(_0x2cb1d1,_0x1f7dd4,_0x558b97);};passport[_0xee7c('0x2c')](_0xee7c('0x28'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0xe524f0,_0x12d950,_0x31e520){return ActiveDirectoryAuthenticate(db[_0xee7c('0x2d')],_0xe524f0,_0x12d950,_0x31e520);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 1d23a64..ad7728e 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 _0x5b3f=['express','./authActiveDirectory.controller','post'];(function(_0x167fbf,_0x58d638){var _0xfbf538=function(_0xb63552){while(--_0xb63552){_0x167fbf['push'](_0x167fbf['shift']());}};_0xfbf538(++_0x58d638);}(_0x5b3f,0x17d));var _0xf5b3=function(_0x108d52,_0x261d9a){_0x108d52=_0x108d52-0x0;var _0x59b7cf=_0x5b3f[_0x108d52];return _0x59b7cf;};'use strict';var express=require(_0xf5b3('0x0'));var router=express['Router']();var controller=require(_0xf5b3('0x1'));router[_0xf5b3('0x2')]('/',controller['login']);module['exports']=router; \ No newline at end of file +var _0x636e=['exports','express','Router','login'];(function(_0x31c6ca,_0x5b37b3){var _0x1b5088=function(_0x3c840b){while(--_0x3c840b){_0x31c6ca['push'](_0x31c6ca['shift']());}};_0x1b5088(++_0x5b37b3);}(_0x636e,0x95));var _0xe636=function(_0x5e00d9,_0x16319b){_0x5e00d9=_0x5e00d9-0x0;var _0x3f53d1=_0x636e[_0x5e00d9];return _0x3f53d1;};'use strict';var express=require(_0xe636('0x0'));var router=express[_0xe636('0x1')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0xe636('0x2')]);module[_0xe636('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 17c5a00..45fd515 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(_0x305f2f,_0x445a9f){var _0x335375=function(_0x8172f2){while(--_0x8172f2){_0x305f2f['push'](_0x305f2f['shift']());}};_0x335375(++_0x445a9f);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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(_0x5d88da,_0x43b964){var _0x4391bb=function(_0x449ac4){while(--_0x449ac4){_0x5d88da['push'](_0x5d88da['shift']());}};_0x4391bb(++_0x43b964);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 ff31d91..ea26d72 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 _0x9578=['/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../../components/auth/service','login'];(function(_0x322bef,_0x4890d4){var _0x229e60=function(_0x45f89b){while(--_0x45f89b){_0x322bef['push'](_0x322bef['shift']());}};_0x229e60(++_0x4890d4);}(_0x9578,0x89));var _0x8957=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x9578[_0x373dee];return _0x46798f;};'use strict';var express=require(_0x8957('0x0'));var passport=require(_0x8957('0x1'));var router=express[_0x8957('0x2')]();var controller=require(_0x8957('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0x8957('0x4'));router['get']('/',controller[_0x8957('0x5')]);router['get'](_0x8957('0x6'),controller[_0x8957('0x7')],authService[_0x8957('0x8')],userController[_0x8957('0x5')],authService[_0x8957('0x9')]);module[_0x8957('0xa')]=router; \ No newline at end of file +var _0xffcc=['setTokenCookie','exports','passport','./authGoogle.controller','../user/user.controller.js','get','callback','login'];(function(_0x3110b8,_0x1e54b1){var _0xd41d04=function(_0x1eb317){while(--_0x1eb317){_0x3110b8['push'](_0x3110b8['shift']());}};_0xd41d04(++_0x1e54b1);}(_0xffcc,0x112));var _0xcffc=function(_0x210e2b,_0x377c45){_0x210e2b=_0x210e2b-0x0;var _0x5e1dbc=_0xffcc[_0x210e2b];return _0x5e1dbc;};'use strict';var express=require('express');var passport=require(_0xcffc('0x0'));var router=express['Router']();var controller=require(_0xcffc('0x1'));var userController=require(_0xcffc('0x2'));var authService=require('../../components/auth/service');router['get']('/',controller['login']);router[_0xcffc('0x3')]('/callback',controller[_0xcffc('0x4')],authService['isMiddleware'],userController[_0xcffc('0x5')],authService[_0xcffc('0x6')]);module[_0xcffc('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 863862a..5dfb9a3 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 _0xf022=['getLicense','catch','MailAccount','find','email','CloudProvider','merge','format','\x22%s\x22\x20<%s>','Smtp','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','securePassword','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','use','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','blockDuration','then','findOne','password','salt','role','disabled','blocked','blockedAt','loginAttempts','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','minutes','clearBlockUser'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xf022,0x8c));var _0x2f02=function(_0x4e11d5,_0x1ce514){_0x4e11d5=_0x4e11d5-0x0;var _0x5e4e4c=_0xf022[_0x4e11d5];return _0x5e4e4c;};'use strict';var util=require('util');var passport=require(_0x2f02('0x0'));var LocalStrategy=require(_0x2f02('0x1'))[_0x2f02('0x2')];var jayson=require(_0x2f02('0x3'));var _=require(_0x2f02('0x4'));var rs=require(_0x2f02('0x5'));var moment=require(_0x2f02('0x6'));var db=require(_0x2f02('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x2f02('0x8'));var client=jayson[_0x2f02('0x9')][_0x2f02('0xa')]({'port':0x232b});function localAuthenticate(_0x382e08,_0x744216,_0x35cdf5,_0x2931a0){var _0xab50e2,_0x4ead79;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x2f02('0xb')],'raw':!![]})[_0x2f02('0xc')](function(_0x48ee87){_0xab50e2=_0x48ee87;return _0x382e08[_0x2f02('0xd')]({'attributes':['id','name',_0x2f02('0xe'),_0x2f02('0xf'),_0x2f02('0x10'),_0x2f02('0x11'),_0x2f02('0x12'),_0x2f02('0x13'),_0x2f02('0x14')],'where':{'name':_0x744216,'role':{'$or':['admin','user',_0x2f02('0x15')]}}});})[_0x2f02('0xc')](function(_0x20a44d){if(!_0x20a44d||_0x20a44d&&_0x20a44d[_0x2f02('0x16')]!==_0x744216){throw new Error(_0x2f02('0x17'));}else{_0x4ead79=_0x20a44d;return _0x4ead79;}})[_0x2f02('0xc')](function(){_0x4ead79['authenticate'](_0x35cdf5,function(_0x4c482e,_0x20b6a0){var _0x326978=_0x4ead79[_0x2f02('0x14')]+0x1;if(_0x4c482e){return _0x2931a0(_0x4c482e);}else if(!_0x20b6a0){if(_0x4ead79[_0x2f02('0x11')]){return _0x2931a0(null,![],{'message':_0x2f02('0x17')});}else if(_0xab50e2[_0x2f02('0x18')]>0x0){if(_0x4ead79[_0x2f02('0x12')]){if(_0xab50e2[_0x2f02('0xb')]>0x0){if(moment(_0x4ead79[_0x2f02('0x13')])[_0x2f02('0x19')](_0xab50e2[_0x2f02('0xb')],_0x2f02('0x1a'))>moment()){return _0x2931a0(null,![],{'message':_0x2f02('0x17')});}else{return utils[_0x2f02('0x1b')](_0x4ead79,_0x326978,![],null)[_0x2f02('0xc')](function(){return _0x2931a0(null,![],{'message':_0x2f02('0x17')});});}}else{return _0x2931a0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x326978>=_0xab50e2[_0x2f02('0x18')]){return utils[_0x2f02('0x1b')](_0x4ead79,0x0,!![],moment())[_0x2f02('0xc')](function(){return _0x2931a0(null,![],{'message':_0x2f02('0x17')});});}else{return utils[_0x2f02('0x1b')](_0x4ead79,_0x326978,![],null)['then'](function(){return _0x2931a0(null,![],{'message':_0x2f02('0x17')});});}}}else{return _0x2931a0(null,![],{'message':_0x2f02('0x17')});}}else{if(_0x4ead79[_0x2f02('0x11')]){return _0x2931a0(null,![],{'message':_0x2f02('0x17')});}else if(_0xab50e2[_0x2f02('0x18')]>0x0){if(_0x4ead79[_0x2f02('0x12')]){if(_0xab50e2[_0x2f02('0xb')]>0x0){if(moment(_0x4ead79[_0x2f02('0x13')])[_0x2f02('0x19')](_0xab50e2[_0x2f02('0xb')],_0x2f02('0x1a'))>moment()){return _0x2931a0(null,![],{'message':_0x2f02('0x17')});}else{return utils[_0x2f02('0x1b')](_0x4ead79,0x0,![],null)['then'](function(){return utils['getLicense'](_0x4ead79);})[_0x2f02('0xc')](function(){return _0x2931a0(null,_0x4ead79);});}}else{return _0x2931a0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x4ead79,0x0,![],null)['then'](function(){return utils[_0x2f02('0x1c')](_0x4ead79);})['then'](function(){return _0x2931a0(null,_0x4ead79);})[_0x2f02('0x1d')](function(_0x309110){return _0x2931a0(null,![],_0x309110);});}}else{if(_0x4ead79[_0x2f02('0x12')]){return _0x2931a0(null,![],{'message':_0x2f02('0x17')});}else{return utils[_0x2f02('0x1c')](_0x4ead79)[_0x2f02('0xc')](function(){return _0x2931a0(null,_0x4ead79);});}}}});})[_0x2f02('0x1d')](function(_0x36fe48){return _0x2931a0(null,![],_0x36fe48);});}function sendServiceMail(_0x21cd26){return db[_0x2f02('0x1e')][_0x2f02('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x2f02('0x16'),_0x2f02('0x20')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x2f02('0x21')],'as':'CloudProvider'}]}]})['then'](function(_0x3169ec){if(!_0x3169ec){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x1d8626=_0x3169ec['getSmtpOptions']();var _0x41727a={'account':_0x1d8626,'message':_[_0x2f02('0x22')]({'from':util[_0x2f02('0x23')](_0x2f02('0x24'),_0x3169ec[_0x2f02('0x16')],_0x3169ec[_0x2f02('0x20')]||_0x3169ec[_0x2f02('0x25')][_0x2f02('0x26')])},_0x21cd26)};return client[_0x2f02('0x27')](_0x2f02('0x28'),_0x41727a);})[_0x2f02('0xc')](function(_0xe88c95){if(_0xe88c95[_0x2f02('0x29')]){throw new Error(util[_0x2f02('0x23')](_0x2f02('0x2a'),_0xe88c95[_0x2f02('0x29')][_0x2f02('0x2b')]||JSON[_0x2f02('0x2c')](_0xe88c95['error'])));}return!![];});}function handleError(_0x51865e,_0x50c1c1,_0x177fa2){return _0x51865e[_0x2f02('0x2d')](_0x50c1c1||0x1f4)[_0x2f02('0x2e')]({'message':_0x177fa2?_0x177fa2[_0x2f02('0x2b')]||_0x177fa2:''});}exports[_0x2f02('0x2f')]=function(_0xeac591,_0x48ee09,_0x3b1892){passport[_0x2f02('0x30')](_0x2f02('0x31'),function(_0x4ef107,_0x17c58b,_0x11d17a){var _0x5b03e1=_0x4ef107||_0x11d17a;if(_0x5b03e1){return handleError(_0x48ee09,0x191,_0x5b03e1);}if(!_0x17c58b){return handleError(_0x48ee09,0x194,{'message':_0x2f02('0x32')});}else{var _0x487d26={'payload':{'id':_0x17c58b['id'],'role':_0x17c58b[_0x2f02('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x2f02('0x33')](_0x487d26)['then'](function(_0x201998){_0x48ee09[_0x2f02('0x34')]({'id':_0x17c58b['id'],'token':_0x201998,'statusCall':'','isAlreadyLogged':_0x17c58b[_0x2f02('0x35')]});});}})(_0xeac591,_0x48ee09,_0x3b1892);};exports[_0x2f02('0x36')]=function(_0x11b9b2,_0xab745){if(!_0x11b9b2[_0x2f02('0x37')]['email']){return handleError(_0xab745,0x1f4,{'message':_0x2f02('0x38')});}var _0x34076c=rs[_0x2f02('0x39')]();_0x11b9b2[_0x2f02('0x37')][_0x2f02('0x20')]=_0x11b9b2[_0x2f02('0x37')][_0x2f02('0x20')][_0x2f02('0x3a')]()[_0x2f02('0x3b')]();var _0x220ef3;return db[_0x2f02('0x3c')]['findOne']({'where':{'id':0x1},'attributes':[_0x2f02('0x18'),_0x2f02('0xb')],'raw':!![]})[_0x2f02('0xc')](function(_0x5e49fe){_0x220ef3=_0x5e49fe;return db[_0x2f02('0x3d')][_0x2f02('0x1f')]({'where':{'email':_0x11b9b2[_0x2f02('0x37')][_0x2f02('0x20')]}});})[_0x2f02('0xc')](function(_0x3052a9){if(!_0x3052a9){throw new Error(_0x2f02('0x3e'));}if(_0x3052a9[_0x2f02('0x11')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x3052a9[_0x2f02('0x12')]){if(moment(_0x3052a9[_0x2f02('0x13')])['add'](_0x220ef3[_0x2f02('0xb')],_0x2f02('0x1a'))>moment()){throw new Error(_0x2f02('0x3f'));}else{_0x3052a9[_0x2f02('0x12')]=![];_0x3052a9[_0x2f02('0x13')]=null;}}_0x3052a9[_0x2f02('0x40')]=_0x34076c;_0x3052a9[_0x2f02('0x41')]=Date[_0x2f02('0x42')]()+0x36ee80;return _0x3052a9[_0x2f02('0x43')]();})[_0x2f02('0xc')](function(){return sendServiceMail({'to':_0x11b9b2['body'][_0x2f02('0x20')],'subject':_0x2f02('0x44'),'text':_0x2f02('0x45')+_0x2f02('0x46')+_0x2f02('0x47')+_0x11b9b2['headers']['host']+_0x2f02('0x48')+_0x34076c+'\x0a\x0a'+_0x2f02('0x49')});})['then'](function(){_0xab745[_0x2f02('0x2d')](0xc8)[_0x2f02('0x2e')]({'message':_0x2f02('0x4a')});})[_0x2f02('0x1d')](function(_0x5698f7){return handleError(_0xab745,0x1f4,_0x5698f7);});};exports[_0x2f02('0x4b')]=function(_0x405bc9,_0x5d6367){return db[_0x2f02('0x3d')][_0x2f02('0x1f')]({'where':{'resetPasswordToken':_0x405bc9[_0x2f02('0x4c')]['token'],'resetPasswordExpires':{'$gt':Date[_0x2f02('0x42')]()}}})['then'](function(_0x1eb96a){if(!_0x1eb96a){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x2f02('0xd')]({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})['then'](function(_0x496f9d){if(_0x496f9d[_0x2f02('0x4d')])authService[_0x2f02('0x4e')](_0x405bc9[_0x2f02('0x37')][_0x2f02('0xe')]);if(!_0x496f9d[_0x2f02('0x4f')]||!_0x1eb96a[_0x2f02('0x50')])return _0x1eb96a;authService[_0x2f02('0x51')](_0x405bc9['body'][_0x2f02('0xe')],_0x1eb96a[_0x2f02('0x50')],_0x496f9d[_0x2f02('0x52')]);return _0x1eb96a;})[_0x2f02('0xc')](function(){_0x1eb96a[_0x2f02('0xe')]=_0x405bc9['body'][_0x2f02('0xe')];_0x1eb96a[_0x2f02('0x40')]=null;_0x1eb96a['resetPasswordExpires']=null;return _0x1eb96a[_0x2f02('0x43')]();});})[_0x2f02('0xc')](function(){_0x5d6367[_0x2f02('0x2d')](0xc8)[_0x2f02('0x2e')]({'message':'Password\x20reset!'});})[_0x2f02('0x1d')](function(_0x5cc2dc){return handleError(_0x5d6367,0x1f4,_0x5cc2dc);});};passport[_0x2f02('0x53')](_0x2f02('0x31'),new LocalStrategy({'usernameField':_0x2f02('0x16'),'passwordField':_0x2f02('0xe')},function(_0x231e56,_0x38021f,_0x11a725){return localAuthenticate(db[_0x2f02('0x3d')],_0x231e56,_0x38021f,_0x11a725);})); \ No newline at end of file +var _0x6e2b=['../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','blocked','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','clearBlockUser','add','minutes','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','online','forgot','body','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','send','Reset\x20Email\x20sent!','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment'];(function(_0x4e3e19,_0x555547){var _0xd3384d=function(_0x18b1d0){while(--_0x18b1d0){_0x4e3e19['push'](_0x4e3e19['shift']());}};_0xd3384d(++_0x555547);}(_0x6e2b,0x9e));var _0xb6e2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6e2b[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xb6e2('0x0'));var passport=require(_0xb6e2('0x1'));var LocalStrategy=require(_0xb6e2('0x2'))[_0xb6e2('0x3')];var jayson=require(_0xb6e2('0x4'));var _=require(_0xb6e2('0x5'));var rs=require(_0xb6e2('0x6'));var moment=require(_0xb6e2('0x7'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0xb6e2('0x8'));var client=jayson[_0xb6e2('0x9')][_0xb6e2('0xa')]({'port':0x232b});function localAuthenticate(_0x1e7c90,_0x40492f,_0x57c2bb,_0x5d157f){var _0x58babb,_0x58b123;return db[_0xb6e2('0xb')][_0xb6e2('0xc')]({'where':{'id':0x1},'attributes':[_0xb6e2('0xd'),_0xb6e2('0xe')],'raw':!![]})[_0xb6e2('0xf')](function(_0x205de8){_0x58babb=_0x205de8;return _0x1e7c90[_0xb6e2('0xc')]({'attributes':['id',_0xb6e2('0x10'),_0xb6e2('0x11'),_0xb6e2('0x12'),'role','disabled',_0xb6e2('0x13'),_0xb6e2('0x14'),_0xb6e2('0x15')],'where':{'name':_0x40492f,'role':{'$or':[_0xb6e2('0x16'),_0xb6e2('0x17'),'agent']}}});})['then'](function(_0xfbb0f9){if(!_0xfbb0f9||_0xfbb0f9&&_0xfbb0f9[_0xb6e2('0x10')]!==_0x40492f){throw new Error(_0xb6e2('0x18'));}else{_0x58b123=_0xfbb0f9;return _0x58b123;}})[_0xb6e2('0xf')](function(){_0x58b123[_0xb6e2('0x19')](_0x57c2bb,function(_0x5966c8,_0x4ff9ea){var _0x40133b=_0x58b123['loginAttempts']+0x1;if(_0x5966c8){return _0x5d157f(_0x5966c8);}else if(!_0x4ff9ea){if(_0x58b123[_0xb6e2('0x1a')]){return _0x5d157f(null,![],{'message':_0xb6e2('0x18')});}else if(_0x58babb[_0xb6e2('0xd')]>0x0){if(_0x58b123[_0xb6e2('0x13')]){if(_0x58babb[_0xb6e2('0xe')]>0x0){if(moment(_0x58b123[_0xb6e2('0x14')])['add'](_0x58babb[_0xb6e2('0xe')],'minutes')>moment()){return _0x5d157f(null,![],{'message':_0xb6e2('0x18')});}else{return utils[_0xb6e2('0x1b')](_0x58b123,_0x40133b,![],null)[_0xb6e2('0xf')](function(){return _0x5d157f(null,![],{'message':_0xb6e2('0x18')});});}}else{return _0x5d157f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x40133b>=_0x58babb[_0xb6e2('0xd')]){return utils[_0xb6e2('0x1b')](_0x58b123,0x0,!![],moment())[_0xb6e2('0xf')](function(){return _0x5d157f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xb6e2('0x1b')](_0x58b123,_0x40133b,![],null)[_0xb6e2('0xf')](function(){return _0x5d157f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x5d157f(null,![],{'message':_0xb6e2('0x18')});}}else{if(_0x58b123[_0xb6e2('0x1a')]){return _0x5d157f(null,![],{'message':_0xb6e2('0x18')});}else if(_0x58babb['allowedLoginAttempts']>0x0){if(_0x58b123[_0xb6e2('0x13')]){if(_0x58babb['blockDuration']>0x0){if(moment(_0x58b123[_0xb6e2('0x14')])[_0xb6e2('0x1c')](_0x58babb[_0xb6e2('0xe')],_0xb6e2('0x1d'))>moment()){return _0x5d157f(null,![],{'message':_0xb6e2('0x18')});}else{return utils['clearBlockUser'](_0x58b123,0x0,![],null)[_0xb6e2('0xf')](function(){return utils[_0xb6e2('0x1e')](_0x58b123);})[_0xb6e2('0xf')](function(){return _0x5d157f(null,_0x58b123);});}}else{return _0x5d157f(null,![],{'message':_0xb6e2('0x18')});}}else{return utils[_0xb6e2('0x1b')](_0x58b123,0x0,![],null)['then'](function(){return utils['getLicense'](_0x58b123);})[_0xb6e2('0xf')](function(){return _0x5d157f(null,_0x58b123);})[_0xb6e2('0x1f')](function(_0x53dd4d){return _0x5d157f(null,![],_0x53dd4d);});}}else{if(_0x58b123[_0xb6e2('0x13')]){return _0x5d157f(null,![],{'message':_0xb6e2('0x18')});}else{return utils[_0xb6e2('0x1e')](_0x58b123)[_0xb6e2('0xf')](function(){return _0x5d157f(null,_0x58b123);});}}}});})[_0xb6e2('0x1f')](function(_0x4e5dc7){return _0x5d157f(null,![],_0x4e5dc7);});}function sendServiceMail(_0x57811e){return db['MailAccount'][_0xb6e2('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0xb6e2('0x21')],'include':[{'model':db[_0xb6e2('0x22')],'as':_0xb6e2('0x23'),'include':[{'model':db[_0xb6e2('0x24')],'as':_0xb6e2('0x24')}]}]})[_0xb6e2('0xf')](function(_0x78999a){if(!_0x78999a){throw new Error(_0xb6e2('0x25'));}var _0x34617f=_0x78999a[_0xb6e2('0x26')]();var _0x562fbf={'account':_0x34617f,'message':_['merge']({'from':util[_0xb6e2('0x27')](_0xb6e2('0x28'),_0x78999a[_0xb6e2('0x10')],_0x78999a[_0xb6e2('0x21')]||_0x78999a[_0xb6e2('0x23')][_0xb6e2('0x17')])},_0x57811e)};return client[_0xb6e2('0x29')](_0xb6e2('0x2a'),_0x562fbf);})[_0xb6e2('0xf')](function(_0x1f74f7){if(_0x1f74f7['error']){throw new Error(util[_0xb6e2('0x27')](_0xb6e2('0x2b'),_0x1f74f7[_0xb6e2('0x2c')][_0xb6e2('0x2d')]||JSON[_0xb6e2('0x2e')](_0x1f74f7[_0xb6e2('0x2c')])));}return!![];});}function handleError(_0x55d8e4,_0x557a0c,_0x487b06){return _0x55d8e4['status'](_0x557a0c||0x1f4)['send']({'message':_0x487b06?_0x487b06['message']||_0x487b06:''});}exports['login']=function(_0x44a5c4,_0x2a1cf8,_0x36aeb5){passport['authenticate'](_0xb6e2('0x2f'),function(_0xa83fd6,_0xf1f785,_0x334d47){var _0x178573=_0xa83fd6||_0x334d47;if(_0x178573){return handleError(_0x2a1cf8,0x191,_0x178573);}if(!_0xf1f785){return handleError(_0x2a1cf8,0x194,{'message':_0xb6e2('0x30')});}else{var _0x2e030c={'payload':{'id':_0xf1f785['id'],'role':_0xf1f785[_0xb6e2('0x31')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2e030c)[_0xb6e2('0xf')](function(_0x60d3e){_0x2a1cf8['json']({'id':_0xf1f785['id'],'token':_0x60d3e,'statusCall':'','isAlreadyLogged':_0xf1f785[_0xb6e2('0x32')]});});}})(_0x44a5c4,_0x2a1cf8,_0x36aeb5);};exports[_0xb6e2('0x33')]=function(_0x41c1a2,_0x286c29){if(!_0x41c1a2[_0xb6e2('0x34')]['email']){return handleError(_0x286c29,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x11fe3d=rs[_0xb6e2('0x35')]();_0x41c1a2[_0xb6e2('0x34')][_0xb6e2('0x21')]=_0x41c1a2[_0xb6e2('0x34')][_0xb6e2('0x21')][_0xb6e2('0x36')]()[_0xb6e2('0x37')]();var _0x504b9e;return db[_0xb6e2('0xb')][_0xb6e2('0xc')]({'where':{'id':0x1},'attributes':[_0xb6e2('0xd'),_0xb6e2('0xe')],'raw':!![]})['then'](function(_0x1f3090){_0x504b9e=_0x1f3090;return db['User']['find']({'where':{'email':_0x41c1a2['body']['email']}});})[_0xb6e2('0xf')](function(_0x114b2e){if(!_0x114b2e){throw new Error(_0xb6e2('0x38'));}if(_0x114b2e['disabled']){throw new Error(_0xb6e2('0x39'));}if(_0x114b2e[_0xb6e2('0x13')]){if(moment(_0x114b2e[_0xb6e2('0x14')])[_0xb6e2('0x1c')](_0x504b9e[_0xb6e2('0xe')],'minutes')>moment()){throw new Error(_0xb6e2('0x3a'));}else{_0x114b2e[_0xb6e2('0x13')]=![];_0x114b2e[_0xb6e2('0x14')]=null;}}_0x114b2e[_0xb6e2('0x3b')]=_0x11fe3d;_0x114b2e[_0xb6e2('0x3c')]=Date[_0xb6e2('0x3d')]()+0x36ee80;return _0x114b2e[_0xb6e2('0x3e')]();})[_0xb6e2('0xf')](function(){return sendServiceMail({'to':_0x41c1a2[_0xb6e2('0x34')][_0xb6e2('0x21')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xb6e2('0x3f')+_0xb6e2('0x40')+_0x41c1a2[_0xb6e2('0x41')][_0xb6e2('0x42')]+'/reset/'+_0x11fe3d+'\x0a\x0a'+_0xb6e2('0x43')});})[_0xb6e2('0xf')](function(){_0x286c29[_0xb6e2('0x44')](0xc8)[_0xb6e2('0x45')]({'message':_0xb6e2('0x46')});})['catch'](function(_0x544e5f){return handleError(_0x286c29,0x1f4,_0x544e5f);});};exports[_0xb6e2('0x47')]=function(_0x27434a,_0x118945){return db[_0xb6e2('0x48')][_0xb6e2('0x20')]({'where':{'resetPasswordToken':_0x27434a[_0xb6e2('0x49')][_0xb6e2('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xb6e2('0x3d')]()}}})[_0xb6e2('0xf')](function(_0x1a2ff9){if(!_0x1a2ff9){throw new Error(_0xb6e2('0x4b'));}return db[_0xb6e2('0xb')]['findOne']({'attributes':['id',_0xb6e2('0x4c'),_0xb6e2('0x4d'),_0xb6e2('0x4e')]})[_0xb6e2('0xf')](function(_0xe7e144){if(_0xe7e144[_0xb6e2('0x4c')])authService['validatePasswordPattern'](_0x27434a[_0xb6e2('0x34')][_0xb6e2('0x11')]);if(!_0xe7e144[_0xb6e2('0x4d')]||!_0x1a2ff9[_0xb6e2('0x4f')])return _0x1a2ff9;authService[_0xb6e2('0x50')](_0x27434a['body'][_0xb6e2('0x11')],_0x1a2ff9['previousPasswords'],_0xe7e144[_0xb6e2('0x4e')]);return _0x1a2ff9;})[_0xb6e2('0xf')](function(){_0x1a2ff9[_0xb6e2('0x11')]=_0x27434a[_0xb6e2('0x34')][_0xb6e2('0x11')];_0x1a2ff9['resetPasswordToken']=null;_0x1a2ff9['resetPasswordExpires']=null;return _0x1a2ff9['save']();});})[_0xb6e2('0xf')](function(){_0x118945[_0xb6e2('0x44')](0xc8)['send']({'message':_0xb6e2('0x51')});})['catch'](function(_0x2189cf){return handleError(_0x118945,0x1f4,_0x2189cf);});};passport[_0xb6e2('0x52')](_0xb6e2('0x2f'),new LocalStrategy({'usernameField':'name','passwordField':_0xb6e2('0x11')},function(_0x193bdd,_0x2802e8,_0x17cd27){return localAuthenticate(db[_0xb6e2('0x48')],_0x193bdd,_0x2802e8,_0x17cd27);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index af2731e..1fd0511 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 _0xe7c7=['/reset/:token','reset','Router','./authLocal.controller','post','login','/forgot','forgot'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0xe7c7,0x16a));var _0x7e7c=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xe7c7[_0x1589dd];return _0x1bddd1;};'use strict';var express=require('express');var router=express[_0x7e7c('0x0')]();var controller=require(_0x7e7c('0x1'));router[_0x7e7c('0x2')]('/',controller[_0x7e7c('0x3')]);router[_0x7e7c('0x2')](_0x7e7c('0x4'),controller[_0x7e7c('0x5')]);router['post'](_0x7e7c('0x6'),controller[_0x7e7c('0x7')]);module['exports']=router; \ No newline at end of file +var _0x7fe8=['exports','express','Router','./authLocal.controller','post','login','forgot','/reset/:token','reset'];(function(_0x57369a,_0x1550f0){var _0x3cdd5b=function(_0x13af47){while(--_0x13af47){_0x57369a['push'](_0x57369a['shift']());}};_0x3cdd5b(++_0x1550f0);}(_0x7fe8,0x145));var _0x87fe=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x7fe8[_0x4d613c];return _0x301fe3;};'use strict';var express=require(_0x87fe('0x0'));var router=express[_0x87fe('0x1')]();var controller=require(_0x87fe('0x2'));router[_0x87fe('0x3')]('/',controller[_0x87fe('0x4')]);router[_0x87fe('0x3')]('/forgot',controller[_0x87fe('0x5')]);router[_0x87fe('0x3')](_0x87fe('0x6'),controller[_0x87fe('0x7')]);module[_0x87fe('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 846a22e..5efd932 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 _0xfbe1=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x50d4d6,_0x7006fd){var _0x48e8b2=function(_0x508215){while(--_0x508215){_0x50d4d6['push'](_0x50d4d6['shift']());}};_0x48e8b2(++_0x7006fd);}(_0xfbe1,0x135));var _0x1fbe=function(_0xd878dc,_0x2887c8){_0xd878dc=_0xd878dc-0x0;var _0x3a6da0=_0xfbe1[_0xd878dc];return _0x3a6da0;};'use strict';var Sequelize=require(_0x1fbe('0x0'));module[_0x1fbe('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x1fbe('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x1fbe('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x1fbe('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xe6f5=['BOOLEAN','sequelize','exports','STRING'];(function(_0x34bedd,_0x541e66){var _0x4050b3=function(_0x64e23e){while(--_0x64e23e){_0x34bedd['push'](_0x34bedd['shift']());}};_0x4050b3(++_0x541e66);}(_0xe6f5,0xed));var _0x5e6f=function(_0x4f3463,_0x5a1ee7){_0x4f3463=_0x4f3463-0x0;var _0x5f0e49=_0xe6f5[_0x4f3463];return _0x5f0e49;};'use strict';var Sequelize=require(_0x5e6f('0x0'));module[_0x5e6f('0x1')]={'name':{'type':Sequelize[_0x5e6f('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x5e6f('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x5e6f('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 ed8d76b..381cd0a 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 _0x10a1=['end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','Automation','rows','catch','show','params','find','create','body','addConditions','Condition','ids','length','getConditions','addActions','Action','omit','getActions','findOne','pick','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x216b6e,_0x1170ac){var _0x44a3f5=function(_0x38863b){while(--_0x38863b){_0x216b6e['push'](_0x216b6e['shift']());}};_0x44a3f5(++_0x1170ac);}(_0x10a1,0x8f));var _0x110a=function(_0x40f532,_0x5127a8){_0x40f532=_0x40f532-0x0;var _0x11d5dc=_0x10a1[_0x40f532];return _0x11d5dc;};'use strict';var emlformat=require(_0x110a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x110a('0x1'));var rp=require(_0x110a('0x2'));var moment=require(_0x110a('0x3'));var BPromise=require(_0x110a('0x4'));var Mustache=require(_0x110a('0x5'));var util=require(_0x110a('0x6'));var path=require(_0x110a('0x7'));var sox=require('sox');var csv=require(_0x110a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x110a('0x9'));var _=require(_0x110a('0xa'));var squel=require(_0x110a('0xb'));var crypto=require(_0x110a('0xc'));var jsforce=require(_0x110a('0xd'));var deskjs=require(_0x110a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x110a('0xf'));var Papa=require(_0x110a('0x10'));var Redis=require(_0x110a('0x11'));var authService=require(_0x110a('0x12'));var qs=require(_0x110a('0x13'));var as=require(_0x110a('0x14'));var hardwareService=require(_0x110a('0x15'));var logger=require(_0x110a('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x110a('0x17'));var db=require(_0x110a('0x18'))['db'];function respondWithStatusCode(_0x305e4d,_0x596667){_0x596667=_0x596667||0xcc;return function(_0x51f130){if(_0x51f130){return _0x305e4d[_0x110a('0x19')](_0x596667);}return _0x305e4d[_0x110a('0x1a')](_0x596667)[_0x110a('0x1b')]();};}function respondWithResult(_0x169d52,_0x1f786a){_0x1f786a=_0x1f786a||0xc8;return function(_0x5bbaea){if(_0x5bbaea){return _0x169d52[_0x110a('0x1a')](_0x1f786a)[_0x110a('0x1c')](_0x5bbaea);}};}function respondWithFilteredResult(_0x42ef9b,_0x268b1b){return function(_0x45ffd1){if(_0x45ffd1){var _0x563020=typeof _0x268b1b[_0x110a('0x1d')]===_0x110a('0x1e')&&typeof _0x268b1b[_0x110a('0x1f')]==='undefined';var _0x580e9c=_0x45ffd1[_0x110a('0x20')];var _0x375e2d=_0x563020?0x0:_0x268b1b['offset'];var _0x11f1c0=_0x563020?_0x45ffd1['count']:_0x268b1b['offset']+_0x268b1b[_0x110a('0x1f')];var _0x58826a;if(_0x11f1c0>=_0x580e9c){_0x11f1c0=_0x580e9c;_0x58826a=0xc8;}else{_0x58826a=0xce;}_0x42ef9b[_0x110a('0x1a')](_0x58826a);return _0x42ef9b[_0x110a('0x21')](_0x110a('0x22'),_0x375e2d+'-'+_0x11f1c0+'/'+_0x580e9c)[_0x110a('0x1c')](_0x45ffd1);}return null;};}function patchUpdates(_0x4ca5d7){return function(_0x2dc8a7){try{jsonpatch[_0x110a('0x23')](_0x2dc8a7,_0x4ca5d7,!![]);}catch(_0x3c3016){return BPromise['reject'](_0x3c3016);}return _0x2dc8a7[_0x110a('0x24')]();};}function saveUpdates(_0x4a0d73,_0x5ec8b8){return function(_0x3f62a6){if(_0x3f62a6){return _0x3f62a6[_0x110a('0x25')](_0x4a0d73)[_0x110a('0x26')](function(_0xff3f81){return _0xff3f81;});}return null;};}function removeEntity(_0x32b0ba,_0x2116ba){return function(_0x1bd140){if(_0x1bd140){return _0x1bd140[_0x110a('0x27')]()[_0x110a('0x26')](function(){_0x32b0ba[_0x110a('0x1a')](0xcc)[_0x110a('0x1b')]();});}};}function handleEntityNotFound(_0x19b9e6,_0xb2ba4c){return function(_0x21c476){if(!_0x21c476){_0x19b9e6[_0x110a('0x19')](0x194);}return _0x21c476;};}function handleError(_0x54d787,_0x59834){_0x59834=_0x59834||0x1f4;return function(_0x2882c0){logger[_0x110a('0x28')](_0x2882c0[_0x110a('0x29')]);if(_0x2882c0[_0x110a('0x2a')]){delete _0x2882c0[_0x110a('0x2a')];}_0x54d787[_0x110a('0x1a')](_0x59834)[_0x110a('0x2b')](_0x2882c0);};}exports[_0x110a('0x2c')]=function(_0x234ae1,_0x35955d){var _0xc2b7d1={},_0x581975={},_0x42a2d3={'count':0x0,'rows':[]};var _0x4e118c=_[_0x110a('0x2d')](db['Automation'][_0x110a('0x2e')],function(_0x27b5a9){return{'name':_0x27b5a9['fieldName'],'type':_0x27b5a9[_0x110a('0x2f')]['key']};});_0x581975['model']=_[_0x110a('0x2d')](_0x4e118c,_0x110a('0x2a'));_0x581975[_0x110a('0x30')]=_[_0x110a('0x31')](_0x234ae1['query']);_0x581975[_0x110a('0x32')]=_[_0x110a('0x33')](_0x581975[_0x110a('0x34')],_0x581975[_0x110a('0x30')]);_0xc2b7d1['attributes']=_['intersection'](_0x581975[_0x110a('0x34')],qs['fields'](_0x234ae1[_0x110a('0x30')][_0x110a('0x35')]));_0xc2b7d1[_0x110a('0x36')]=_0xc2b7d1[_0x110a('0x36')]['length']?_0xc2b7d1[_0x110a('0x36')]:_0x581975[_0x110a('0x34')];if(!_0x234ae1[_0x110a('0x30')][_0x110a('0x37')](_0x110a('0x38'))){_0xc2b7d1['limit']=qs['limit'](_0x234ae1[_0x110a('0x30')][_0x110a('0x1f')]);_0xc2b7d1[_0x110a('0x1d')]=qs['offset'](_0x234ae1[_0x110a('0x30')][_0x110a('0x1d')]);}_0xc2b7d1[_0x110a('0x39')]=qs['sort'](_0x234ae1[_0x110a('0x30')][_0x110a('0x3a')]);_0xc2b7d1['where']=qs[_0x110a('0x32')](_['pick'](_0x234ae1[_0x110a('0x30')],_0x581975[_0x110a('0x32')]),_0x4e118c);if(_0x234ae1[_0x110a('0x30')][_0x110a('0x3b')]){_0xc2b7d1[_0x110a('0x3c')]=_[_0x110a('0x3d')](_0xc2b7d1[_0x110a('0x3c')],{'$or':_[_0x110a('0x2d')](_0x4e118c,function(_0x3465aa){if(_0x3465aa['type']!==_0x110a('0x3e')){var _0x3abb59={};_0x3abb59[_0x3465aa[_0x110a('0x2a')]]={'$like':'%'+_0x234ae1['query'][_0x110a('0x3b')]+'%'};return _0x3abb59;}})});}_0xc2b7d1=_[_0x110a('0x3d')]({},_0xc2b7d1,_0x234ae1[_0x110a('0x3f')]);var _0xc552dc={'where':_0xc2b7d1[_0x110a('0x3c')]};return db['Automation'][_0x110a('0x20')](_0xc552dc)[_0x110a('0x26')](function(_0x524476){_0x42a2d3[_0x110a('0x20')]=_0x524476;if(_0x234ae1[_0x110a('0x30')][_0x110a('0x40')]){_0xc2b7d1[_0x110a('0x41')]=[{'all':!![]}];}return db[_0x110a('0x42')]['findAll'](_0xc2b7d1);})['then'](function(_0x4fc08b){_0x42a2d3[_0x110a('0x43')]=_0x4fc08b;return _0x42a2d3;})[_0x110a('0x26')](respondWithFilteredResult(_0x35955d,_0xc2b7d1))[_0x110a('0x44')](handleError(_0x35955d,null));};exports[_0x110a('0x45')]=function(_0x30323b,_0x4383cf){var _0x17266f={'raw':![],'where':{'id':_0x30323b[_0x110a('0x46')]['id']}},_0x17d732={};_0x17d732[_0x110a('0x34')]=_[_0x110a('0x31')](db[_0x110a('0x42')][_0x110a('0x2e')]);_0x17d732[_0x110a('0x30')]=_[_0x110a('0x31')](_0x30323b[_0x110a('0x30')]);_0x17d732['filters']=_[_0x110a('0x33')](_0x17d732[_0x110a('0x34')],_0x17d732[_0x110a('0x30')]);_0x17266f[_0x110a('0x36')]=_[_0x110a('0x33')](_0x17d732[_0x110a('0x34')],qs[_0x110a('0x35')](_0x30323b[_0x110a('0x30')][_0x110a('0x35')]));_0x17266f['attributes']=_0x17266f[_0x110a('0x36')]['length']?_0x17266f[_0x110a('0x36')]:_0x17d732[_0x110a('0x34')];if(_0x30323b[_0x110a('0x30')]['includeAll']){_0x17266f[_0x110a('0x41')]=[{'all':!![]}];}_0x17266f=_[_0x110a('0x3d')]({},_0x17266f,_0x30323b[_0x110a('0x3f')]);return db['Automation'][_0x110a('0x47')](_0x17266f)['then'](handleEntityNotFound(_0x4383cf,null))[_0x110a('0x26')](respondWithResult(_0x4383cf,null))[_0x110a('0x44')](handleError(_0x4383cf,null));};exports[_0x110a('0x48')]=function(_0x95c2c4,_0x395baf){return db[_0x110a('0x42')][_0x110a('0x48')](_0x95c2c4[_0x110a('0x49')],{})['then'](respondWithResult(_0x395baf,0xc9))[_0x110a('0x44')](handleError(_0x395baf,null));};exports['update']=function(_0x42cefc,_0x53a7e7){if(_0x42cefc['body']['id']){delete _0x42cefc[_0x110a('0x49')]['id'];}return db[_0x110a('0x42')][_0x110a('0x47')]({'where':{'id':_0x42cefc[_0x110a('0x46')]['id']}})[_0x110a('0x26')](handleEntityNotFound(_0x53a7e7,null))[_0x110a('0x26')](saveUpdates(_0x42cefc[_0x110a('0x49')],null))[_0x110a('0x26')](respondWithResult(_0x53a7e7,null))[_0x110a('0x44')](handleError(_0x53a7e7,null));};exports[_0x110a('0x27')]=function(_0x506555,_0x51f801){return db[_0x110a('0x42')][_0x110a('0x47')]({'where':{'id':_0x506555[_0x110a('0x46')]['id']}})[_0x110a('0x26')](handleEntityNotFound(_0x51f801,null))[_0x110a('0x26')](removeEntity(_0x51f801,null))[_0x110a('0x44')](handleError(_0x51f801,null));};exports[_0x110a('0x4a')]=function(_0x55f129,_0x5ea71f,_0x40b784){return db[_0x110a('0x4b')]['find']({'where':{'id':_0x55f129[_0x110a('0x46')]['id']}})[_0x110a('0x26')](handleEntityNotFound(_0x5ea71f,null))[_0x110a('0x26')](function(_0x2d4477){if(_0x2d4477){return _0x2d4477[_0x110a('0x4a')](_0x55f129[_0x110a('0x49')][_0x110a('0x4c')],_['omit'](_0x55f129[_0x110a('0x49')],[_0x110a('0x4c'),'id'])||{});}})[_0x110a('0x26')](respondWithResult(_0x5ea71f,null))[_0x110a('0x44')](handleError(_0x5ea71f,null));};exports['getConditions']=function(_0x544a5c,_0x4afa9a,_0x6c13d7){var _0x55420e={};var _0x355766={};var _0x5ccef0;var _0xe462bb;return db[_0x110a('0x42')]['findOne']({'where':{'id':_0x544a5c[_0x110a('0x46')]['id']}})[_0x110a('0x26')](handleEntityNotFound(_0x4afa9a,null))[_0x110a('0x26')](function(_0x19e2c6){if(_0x19e2c6){_0x5ccef0=_0x19e2c6;_0x355766[_0x110a('0x34')]=_[_0x110a('0x31')](db[_0x110a('0x4b')][_0x110a('0x2e')]);_0x355766[_0x110a('0x30')]=_['keys'](_0x544a5c[_0x110a('0x30')]);_0x355766['filters']=_['intersection'](_0x355766[_0x110a('0x34')],_0x355766['query']);_0x55420e['attributes']=_['intersection'](_0x355766[_0x110a('0x34')],qs[_0x110a('0x35')](_0x544a5c[_0x110a('0x30')][_0x110a('0x35')]));_0x55420e[_0x110a('0x36')]=_0x55420e[_0x110a('0x36')][_0x110a('0x4d')]?_0x55420e[_0x110a('0x36')]:_0x355766[_0x110a('0x34')];_0x55420e[_0x110a('0x39')]=qs[_0x110a('0x3a')](_0x544a5c['query']['sort']);_0x55420e[_0x110a('0x3c')]=qs[_0x110a('0x32')](_['pick'](_0x544a5c[_0x110a('0x30')],_0x355766[_0x110a('0x32')]));if(_0x544a5c[_0x110a('0x30')][_0x110a('0x3b')]){_0x55420e[_0x110a('0x3c')]=_[_0x110a('0x3d')](_0x55420e[_0x110a('0x3c')],{'$or':_[_0x110a('0x2d')](_0x55420e[_0x110a('0x36')],function(_0x459d63){var _0x3bfe81={};_0x3bfe81[_0x459d63]={'$like':'%'+_0x544a5c[_0x110a('0x30')][_0x110a('0x3b')]+'%'};return _0x3bfe81;})});}_0x55420e=_[_0x110a('0x3d')]({},_0x55420e,_0x544a5c[_0x110a('0x3f')]);return _0x5ccef0['getConditions'](_0x55420e);}})['then'](function(_0x511f3e){if(_0x511f3e){_0xe462bb=_0x511f3e[_0x110a('0x4d')];if(!_0x544a5c[_0x110a('0x30')][_0x110a('0x37')](_0x110a('0x38'))){_0x55420e['limit']=qs[_0x110a('0x1f')](_0x544a5c[_0x110a('0x30')][_0x110a('0x1f')]);_0x55420e['offset']=qs[_0x110a('0x1d')](_0x544a5c[_0x110a('0x30')][_0x110a('0x1d')]);}return _0x5ccef0[_0x110a('0x4e')](_0x55420e);}})[_0x110a('0x26')](function(_0x1b258f){if(_0x1b258f){return _0x1b258f?{'count':_0xe462bb,'rows':_0x1b258f}:null;}})[_0x110a('0x26')](respondWithResult(_0x4afa9a,null))['catch'](handleError(_0x4afa9a,null));};exports[_0x110a('0x4f')]=function(_0x40525a,_0x45bedd,_0x3ae347){return db[_0x110a('0x50')][_0x110a('0x47')]({'where':{'id':_0x40525a['params']['id']}})[_0x110a('0x26')](handleEntityNotFound(_0x45bedd,null))['then'](function(_0x983b93){if(_0x983b93){return _0x983b93[_0x110a('0x4f')](_0x40525a[_0x110a('0x49')][_0x110a('0x4c')],_[_0x110a('0x51')](_0x40525a[_0x110a('0x49')],[_0x110a('0x4c'),'id'])||{});}})[_0x110a('0x26')](respondWithResult(_0x45bedd,null))[_0x110a('0x44')](handleError(_0x45bedd,null));};exports[_0x110a('0x52')]=function(_0x50ee84,_0x37ebf5,_0x5f339a){var _0x39a37b={};var _0x5a4f34={};var _0x114c44;var _0x1ad784;return db[_0x110a('0x42')][_0x110a('0x53')]({'where':{'id':_0x50ee84[_0x110a('0x46')]['id']}})[_0x110a('0x26')](handleEntityNotFound(_0x37ebf5,null))[_0x110a('0x26')](function(_0x5c941e){if(_0x5c941e){_0x114c44=_0x5c941e;_0x5a4f34[_0x110a('0x34')]=_[_0x110a('0x31')](db[_0x110a('0x50')][_0x110a('0x2e')]);_0x5a4f34[_0x110a('0x30')]=_[_0x110a('0x31')](_0x50ee84[_0x110a('0x30')]);_0x5a4f34[_0x110a('0x32')]=_[_0x110a('0x33')](_0x5a4f34['model'],_0x5a4f34[_0x110a('0x30')]);_0x39a37b[_0x110a('0x36')]=_['intersection'](_0x5a4f34[_0x110a('0x34')],qs[_0x110a('0x35')](_0x50ee84[_0x110a('0x30')][_0x110a('0x35')]));_0x39a37b[_0x110a('0x36')]=_0x39a37b[_0x110a('0x36')][_0x110a('0x4d')]?_0x39a37b[_0x110a('0x36')]:_0x5a4f34[_0x110a('0x34')];_0x39a37b[_0x110a('0x39')]=qs[_0x110a('0x3a')](_0x50ee84[_0x110a('0x30')]['sort']);_0x39a37b[_0x110a('0x3c')]=qs['filters'](_[_0x110a('0x54')](_0x50ee84[_0x110a('0x30')],_0x5a4f34['filters']));if(_0x50ee84[_0x110a('0x30')][_0x110a('0x3b')]){_0x39a37b['where']=_['merge'](_0x39a37b['where'],{'$or':_['map'](_0x39a37b[_0x110a('0x36')],function(_0x471ddb){var _0x3376ea={};_0x3376ea[_0x471ddb]={'$like':'%'+_0x50ee84[_0x110a('0x30')][_0x110a('0x3b')]+'%'};return _0x3376ea;})});}_0x39a37b=_[_0x110a('0x3d')]({},_0x39a37b,_0x50ee84[_0x110a('0x3f')]);return _0x114c44[_0x110a('0x52')](_0x39a37b);}})['then'](function(_0x244a91){if(_0x244a91){_0x1ad784=_0x244a91[_0x110a('0x4d')];if(!_0x50ee84[_0x110a('0x30')][_0x110a('0x37')](_0x110a('0x38'))){_0x39a37b[_0x110a('0x1f')]=qs[_0x110a('0x1f')](_0x50ee84[_0x110a('0x30')][_0x110a('0x1f')]);_0x39a37b[_0x110a('0x1d')]=qs[_0x110a('0x1d')](_0x50ee84[_0x110a('0x30')]['offset']);}return _0x114c44[_0x110a('0x52')](_0x39a37b);}})[_0x110a('0x26')](function(_0x591c07){if(_0x591c07){return _0x591c07?{'count':_0x1ad784,'rows':_0x591c07}:null;}})[_0x110a('0x26')](respondWithResult(_0x37ebf5,null))[_0x110a('0x44')](handleError(_0x37ebf5,null));}; \ No newline at end of file +var _0x74e4=['fields','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','catch','show','params','length','options','create','body','find','addConditions','ids','omit','getConditions','findOne','keys','pick','addActions','Action','getActions','hasOwnProperty','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','Automation','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes'];(function(_0x209e2e,_0x1d7c3b){var _0x479b49=function(_0x2ecb1c){while(--_0x2ecb1c){_0x209e2e['push'](_0x209e2e['shift']());}};_0x479b49(++_0x1d7c3b);}(_0x74e4,0x165));var _0x474e=function(_0x220835,_0x2d58dd){_0x220835=_0x220835-0x0;var _0x5cd63b=_0x74e4[_0x220835];return _0x5cd63b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x474e('0x0'));var jsonpatch=require(_0x474e('0x1'));var rp=require(_0x474e('0x2'));var moment=require(_0x474e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x474e('0x4'));var path=require('path');var sox=require(_0x474e('0x5'));var csv=require(_0x474e('0x6'));var ejs=require(_0x474e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x474e('0x8'));var crypto=require(_0x474e('0x9'));var jsforce=require(_0x474e('0xa'));var deskjs=require(_0x474e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x474e('0xc'));var Papa=require(_0x474e('0xd'));var Redis=require(_0x474e('0xe'));var authService=require(_0x474e('0xf'));var qs=require(_0x474e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x474e('0x11'));var logger=require(_0x474e('0x12'))(_0x474e('0x13'));var utils=require(_0x474e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x474e('0x15'));var db=require(_0x474e('0x16'))['db'];function respondWithStatusCode(_0x5a5c85,_0x22ff33){_0x22ff33=_0x22ff33||0xcc;return function(_0x30bd24){if(_0x30bd24){return _0x5a5c85[_0x474e('0x17')](_0x22ff33);}return _0x5a5c85[_0x474e('0x18')](_0x22ff33)[_0x474e('0x19')]();};}function respondWithResult(_0x51dc41,_0x1f31d2){_0x1f31d2=_0x1f31d2||0xc8;return function(_0x1b2892){if(_0x1b2892){return _0x51dc41['status'](_0x1f31d2)['json'](_0x1b2892);}};}function respondWithFilteredResult(_0x3ca30d,_0x4d1229){return function(_0x26236c){if(_0x26236c){var _0x1a5c86=typeof _0x4d1229[_0x474e('0x1a')]==='undefined'&&typeof _0x4d1229[_0x474e('0x1b')]===_0x474e('0x1c');var _0x21eeda=_0x26236c[_0x474e('0x1d')];var _0x23878f=_0x1a5c86?0x0:_0x4d1229[_0x474e('0x1a')];var _0xadb0f6=_0x1a5c86?_0x26236c[_0x474e('0x1d')]:_0x4d1229[_0x474e('0x1a')]+_0x4d1229[_0x474e('0x1b')];var _0x124a4d;if(_0xadb0f6>=_0x21eeda){_0xadb0f6=_0x21eeda;_0x124a4d=0xc8;}else{_0x124a4d=0xce;}_0x3ca30d[_0x474e('0x18')](_0x124a4d);return _0x3ca30d[_0x474e('0x1e')]('Content-Range',_0x23878f+'-'+_0xadb0f6+'/'+_0x21eeda)[_0x474e('0x1f')](_0x26236c);}return null;};}function patchUpdates(_0x4cac35){return function(_0x1b0816){try{jsonpatch[_0x474e('0x20')](_0x1b0816,_0x4cac35,!![]);}catch(_0x20bd72){return BPromise[_0x474e('0x21')](_0x20bd72);}return _0x1b0816[_0x474e('0x22')]();};}function saveUpdates(_0x58e1e4,_0x397367){return function(_0x172508){if(_0x172508){return _0x172508[_0x474e('0x23')](_0x58e1e4)[_0x474e('0x24')](function(_0x4a1967){return _0x4a1967;});}return null;};}function removeEntity(_0x352ec2,_0xd5c7c4){return function(_0xb0b39a){if(_0xb0b39a){return _0xb0b39a[_0x474e('0x25')]()[_0x474e('0x24')](function(){_0x352ec2[_0x474e('0x18')](0xcc)[_0x474e('0x19')]();});}};}function handleEntityNotFound(_0x5a84f4,_0x57c94c){return function(_0x6bc62b){if(!_0x6bc62b){_0x5a84f4[_0x474e('0x17')](0x194);}return _0x6bc62b;};}function handleError(_0x1d7467,_0x4a8532){_0x4a8532=_0x4a8532||0x1f4;return function(_0x2237b3){logger[_0x474e('0x26')](_0x2237b3[_0x474e('0x27')]);if(_0x2237b3[_0x474e('0x28')]){delete _0x2237b3[_0x474e('0x28')];}_0x1d7467['status'](_0x4a8532)['send'](_0x2237b3);};}exports[_0x474e('0x29')]=function(_0x345d96,_0x582868){var _0x23b5b6={},_0x57f1b6={},_0x25c240={'count':0x0,'rows':[]};var _0x36b0c2=_[_0x474e('0x2a')](db[_0x474e('0x2b')][_0x474e('0x2c')],function(_0x2b8a04){return{'name':_0x2b8a04[_0x474e('0x2d')],'type':_0x2b8a04[_0x474e('0x2e')][_0x474e('0x2f')]};});_0x57f1b6[_0x474e('0x30')]=_[_0x474e('0x2a')](_0x36b0c2,'name');_0x57f1b6['query']=_['keys'](_0x345d96['query']);_0x57f1b6[_0x474e('0x31')]=_[_0x474e('0x32')](_0x57f1b6[_0x474e('0x30')],_0x57f1b6[_0x474e('0x33')]);_0x23b5b6[_0x474e('0x34')]=_[_0x474e('0x32')](_0x57f1b6['model'],qs[_0x474e('0x35')](_0x345d96['query']['fields']));_0x23b5b6[_0x474e('0x34')]=_0x23b5b6[_0x474e('0x34')]['length']?_0x23b5b6['attributes']:_0x57f1b6[_0x474e('0x30')];if(!_0x345d96[_0x474e('0x33')]['hasOwnProperty'](_0x474e('0x36'))){_0x23b5b6[_0x474e('0x1b')]=qs[_0x474e('0x1b')](_0x345d96[_0x474e('0x33')][_0x474e('0x1b')]);_0x23b5b6['offset']=qs[_0x474e('0x1a')](_0x345d96[_0x474e('0x33')]['offset']);}_0x23b5b6[_0x474e('0x37')]=qs['sort'](_0x345d96[_0x474e('0x33')][_0x474e('0x38')]);_0x23b5b6[_0x474e('0x39')]=qs[_0x474e('0x31')](_['pick'](_0x345d96[_0x474e('0x33')],_0x57f1b6[_0x474e('0x31')]),_0x36b0c2);if(_0x345d96['query']['filter']){_0x23b5b6[_0x474e('0x39')]=_[_0x474e('0x3a')](_0x23b5b6[_0x474e('0x39')],{'$or':_['map'](_0x36b0c2,function(_0x220282){if(_0x220282[_0x474e('0x2e')]!==_0x474e('0x3b')){var _0x56ba95={};_0x56ba95[_0x220282['name']]={'$like':'%'+_0x345d96[_0x474e('0x33')][_0x474e('0x3c')]+'%'};return _0x56ba95;}})});}_0x23b5b6=_[_0x474e('0x3a')]({},_0x23b5b6,_0x345d96['options']);var _0x304616={'where':_0x23b5b6[_0x474e('0x39')]};return db[_0x474e('0x2b')][_0x474e('0x1d')](_0x304616)['then'](function(_0x15a394){_0x25c240[_0x474e('0x1d')]=_0x15a394;if(_0x345d96['query'][_0x474e('0x3d')]){_0x23b5b6[_0x474e('0x3e')]=[{'all':!![]}];}return db[_0x474e('0x2b')]['findAll'](_0x23b5b6);})[_0x474e('0x24')](function(_0x389d20){_0x25c240['rows']=_0x389d20;return _0x25c240;})['then'](respondWithFilteredResult(_0x582868,_0x23b5b6))[_0x474e('0x3f')](handleError(_0x582868,null));};exports[_0x474e('0x40')]=function(_0x1b2845,_0x40a4ed){var _0x5324f4={'raw':![],'where':{'id':_0x1b2845[_0x474e('0x41')]['id']}},_0x21a28d={};_0x21a28d[_0x474e('0x30')]=_['keys'](db[_0x474e('0x2b')]['rawAttributes']);_0x21a28d[_0x474e('0x33')]=_['keys'](_0x1b2845[_0x474e('0x33')]);_0x21a28d['filters']=_[_0x474e('0x32')](_0x21a28d[_0x474e('0x30')],_0x21a28d[_0x474e('0x33')]);_0x5324f4[_0x474e('0x34')]=_[_0x474e('0x32')](_0x21a28d['model'],qs[_0x474e('0x35')](_0x1b2845[_0x474e('0x33')][_0x474e('0x35')]));_0x5324f4['attributes']=_0x5324f4['attributes'][_0x474e('0x42')]?_0x5324f4[_0x474e('0x34')]:_0x21a28d[_0x474e('0x30')];if(_0x1b2845[_0x474e('0x33')]['includeAll']){_0x5324f4['include']=[{'all':!![]}];}_0x5324f4=_[_0x474e('0x3a')]({},_0x5324f4,_0x1b2845[_0x474e('0x43')]);return db['Automation']['find'](_0x5324f4)['then'](handleEntityNotFound(_0x40a4ed,null))[_0x474e('0x24')](respondWithResult(_0x40a4ed,null))['catch'](handleError(_0x40a4ed,null));};exports[_0x474e('0x44')]=function(_0x331e16,_0x72eded){return db[_0x474e('0x2b')]['create'](_0x331e16[_0x474e('0x45')],{})[_0x474e('0x24')](respondWithResult(_0x72eded,0xc9))[_0x474e('0x3f')](handleError(_0x72eded,null));};exports[_0x474e('0x23')]=function(_0x23c9de,_0x56bdae){if(_0x23c9de[_0x474e('0x45')]['id']){delete _0x23c9de[_0x474e('0x45')]['id'];}return db['Automation'][_0x474e('0x46')]({'where':{'id':_0x23c9de['params']['id']}})[_0x474e('0x24')](handleEntityNotFound(_0x56bdae,null))[_0x474e('0x24')](saveUpdates(_0x23c9de[_0x474e('0x45')],null))[_0x474e('0x24')](respondWithResult(_0x56bdae,null))[_0x474e('0x3f')](handleError(_0x56bdae,null));};exports[_0x474e('0x25')]=function(_0x1bd4e6,_0x124df9){return db['Automation'][_0x474e('0x46')]({'where':{'id':_0x1bd4e6[_0x474e('0x41')]['id']}})[_0x474e('0x24')](handleEntityNotFound(_0x124df9,null))[_0x474e('0x24')](removeEntity(_0x124df9,null))['catch'](handleError(_0x124df9,null));};exports[_0x474e('0x47')]=function(_0x1a56cf,_0x3cbc66,_0x290d91){return db['Condition'][_0x474e('0x46')]({'where':{'id':_0x1a56cf[_0x474e('0x41')]['id']}})['then'](handleEntityNotFound(_0x3cbc66,null))[_0x474e('0x24')](function(_0x58ee90){if(_0x58ee90){return _0x58ee90[_0x474e('0x47')](_0x1a56cf['body'][_0x474e('0x48')],_[_0x474e('0x49')](_0x1a56cf['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x3cbc66,null))[_0x474e('0x3f')](handleError(_0x3cbc66,null));};exports[_0x474e('0x4a')]=function(_0x546897,_0x5ce0f2,_0x1eaf18){var _0x4c267c={};var _0x2fe406={};var _0x3b7ade;var _0x232582;return db[_0x474e('0x2b')][_0x474e('0x4b')]({'where':{'id':_0x546897['params']['id']}})[_0x474e('0x24')](handleEntityNotFound(_0x5ce0f2,null))[_0x474e('0x24')](function(_0x27af92){if(_0x27af92){_0x3b7ade=_0x27af92;_0x2fe406['model']=_[_0x474e('0x4c')](db['Condition'][_0x474e('0x2c')]);_0x2fe406['query']=_['keys'](_0x546897[_0x474e('0x33')]);_0x2fe406[_0x474e('0x31')]=_['intersection'](_0x2fe406[_0x474e('0x30')],_0x2fe406['query']);_0x4c267c[_0x474e('0x34')]=_[_0x474e('0x32')](_0x2fe406[_0x474e('0x30')],qs[_0x474e('0x35')](_0x546897[_0x474e('0x33')][_0x474e('0x35')]));_0x4c267c[_0x474e('0x34')]=_0x4c267c[_0x474e('0x34')][_0x474e('0x42')]?_0x4c267c[_0x474e('0x34')]:_0x2fe406[_0x474e('0x30')];_0x4c267c['order']=qs['sort'](_0x546897[_0x474e('0x33')][_0x474e('0x38')]);_0x4c267c[_0x474e('0x39')]=qs[_0x474e('0x31')](_[_0x474e('0x4d')](_0x546897[_0x474e('0x33')],_0x2fe406['filters']));if(_0x546897[_0x474e('0x33')][_0x474e('0x3c')]){_0x4c267c[_0x474e('0x39')]=_[_0x474e('0x3a')](_0x4c267c['where'],{'$or':_[_0x474e('0x2a')](_0x4c267c[_0x474e('0x34')],function(_0x355e17){var _0x215701={};_0x215701[_0x355e17]={'$like':'%'+_0x546897[_0x474e('0x33')][_0x474e('0x3c')]+'%'};return _0x215701;})});}_0x4c267c=_[_0x474e('0x3a')]({},_0x4c267c,_0x546897[_0x474e('0x43')]);return _0x3b7ade[_0x474e('0x4a')](_0x4c267c);}})[_0x474e('0x24')](function(_0x14aeb3){if(_0x14aeb3){_0x232582=_0x14aeb3['length'];if(!_0x546897['query']['hasOwnProperty'](_0x474e('0x36'))){_0x4c267c['limit']=qs['limit'](_0x546897[_0x474e('0x33')][_0x474e('0x1b')]);_0x4c267c[_0x474e('0x1a')]=qs[_0x474e('0x1a')](_0x546897[_0x474e('0x33')][_0x474e('0x1a')]);}return _0x3b7ade[_0x474e('0x4a')](_0x4c267c);}})[_0x474e('0x24')](function(_0x55a023){if(_0x55a023){return _0x55a023?{'count':_0x232582,'rows':_0x55a023}:null;}})[_0x474e('0x24')](respondWithResult(_0x5ce0f2,null))[_0x474e('0x3f')](handleError(_0x5ce0f2,null));};exports[_0x474e('0x4e')]=function(_0x14ebdf,_0x276d17,_0x118efc){return db[_0x474e('0x4f')][_0x474e('0x46')]({'where':{'id':_0x14ebdf['params']['id']}})[_0x474e('0x24')](handleEntityNotFound(_0x276d17,null))[_0x474e('0x24')](function(_0x158e34){if(_0x158e34){return _0x158e34[_0x474e('0x4e')](_0x14ebdf[_0x474e('0x45')][_0x474e('0x48')],_['omit'](_0x14ebdf['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x276d17,null))[_0x474e('0x3f')](handleError(_0x276d17,null));};exports[_0x474e('0x50')]=function(_0x4bcc54,_0x36e1e6,_0x5c41d4){var _0x8ad628={};var _0x189c83={};var _0x4265d5;var _0x4f9edb;return db[_0x474e('0x2b')]['findOne']({'where':{'id':_0x4bcc54['params']['id']}})['then'](handleEntityNotFound(_0x36e1e6,null))[_0x474e('0x24')](function(_0x386650){if(_0x386650){_0x4265d5=_0x386650;_0x189c83[_0x474e('0x30')]=_[_0x474e('0x4c')](db[_0x474e('0x4f')][_0x474e('0x2c')]);_0x189c83['query']=_['keys'](_0x4bcc54[_0x474e('0x33')]);_0x189c83['filters']=_['intersection'](_0x189c83[_0x474e('0x30')],_0x189c83[_0x474e('0x33')]);_0x8ad628[_0x474e('0x34')]=_[_0x474e('0x32')](_0x189c83['model'],qs[_0x474e('0x35')](_0x4bcc54[_0x474e('0x33')][_0x474e('0x35')]));_0x8ad628[_0x474e('0x34')]=_0x8ad628['attributes']['length']?_0x8ad628[_0x474e('0x34')]:_0x189c83[_0x474e('0x30')];_0x8ad628[_0x474e('0x37')]=qs[_0x474e('0x38')](_0x4bcc54['query']['sort']);_0x8ad628[_0x474e('0x39')]=qs[_0x474e('0x31')](_[_0x474e('0x4d')](_0x4bcc54[_0x474e('0x33')],_0x189c83['filters']));if(_0x4bcc54[_0x474e('0x33')]['filter']){_0x8ad628['where']=_[_0x474e('0x3a')](_0x8ad628['where'],{'$or':_[_0x474e('0x2a')](_0x8ad628[_0x474e('0x34')],function(_0x45e1d6){var _0x58a4a3={};_0x58a4a3[_0x45e1d6]={'$like':'%'+_0x4bcc54[_0x474e('0x33')][_0x474e('0x3c')]+'%'};return _0x58a4a3;})});}_0x8ad628=_[_0x474e('0x3a')]({},_0x8ad628,_0x4bcc54[_0x474e('0x43')]);return _0x4265d5[_0x474e('0x50')](_0x8ad628);}})[_0x474e('0x24')](function(_0x3679cb){if(_0x3679cb){_0x4f9edb=_0x3679cb[_0x474e('0x42')];if(!_0x4bcc54[_0x474e('0x33')][_0x474e('0x51')](_0x474e('0x36'))){_0x8ad628[_0x474e('0x1b')]=qs[_0x474e('0x1b')](_0x4bcc54[_0x474e('0x33')][_0x474e('0x1b')]);_0x8ad628[_0x474e('0x1a')]=qs['offset'](_0x4bcc54[_0x474e('0x33')][_0x474e('0x1a')]);}return _0x4265d5[_0x474e('0x50')](_0x8ad628);}})[_0x474e('0x24')](function(_0x43a9cd){if(_0x43a9cd){return _0x43a9cd?{'count':_0x4f9edb,'rows':_0x43a9cd}:null;}})[_0x474e('0x24')](respondWithResult(_0x36e1e6,null))[_0x474e('0x3f')](handleError(_0x36e1e6,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index e19eb86..fdf2729 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 _0xc84a=['Automation','tools_automations','util','../../config/logger','moment','bluebird','path','../../config/environment','./automation.attributes','exports','define'];(function(_0x53b0f8,_0x459130){var _0x133415=function(_0x37a4a5){while(--_0x37a4a5){_0x53b0f8['push'](_0x53b0f8['shift']());}};_0x133415(++_0x459130);}(_0xc84a,0x1ba));var _0xac84=function(_0x2e7eca,_0x5d2d6e){_0x2e7eca=_0x2e7eca-0x0;var _0x5d186b=_0xc84a[_0x2e7eca];return _0x5d186b;};'use strict';var _=require('lodash');var util=require(_0xac84('0x0'));var logger=require(_0xac84('0x1'))('api');var moment=require(_0xac84('0x2'));var BPromise=require(_0xac84('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac84('0x4'));var rimraf=require('rimraf');var config=require(_0xac84('0x5'));var attributes=require(_0xac84('0x6'));module[_0xac84('0x7')]=function(_0x4d4ee7,_0x586065){return _0x4d4ee7[_0xac84('0x8')](_0xac84('0x9'),attributes,{'tableName':_0xac84('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d9f=['exports','define','Automation','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./automation.attributes'];(function(_0x1a6597,_0x17f51c){var _0x41eadd=function(_0xe9a407){while(--_0xe9a407){_0x1a6597['push'](_0x1a6597['shift']());}};_0x41eadd(++_0x17f51c);}(_0x4d9f,0xdb));var _0xf4d9=function(_0x19a2d3,_0xe8232a){_0x19a2d3=_0x19a2d3-0x0;var _0xbbae3f=_0x4d9f[_0x19a2d3];return _0xbbae3f;};'use strict';var _=require('lodash');var util=require(_0xf4d9('0x0'));var logger=require(_0xf4d9('0x1'))(_0xf4d9('0x2'));var moment=require(_0xf4d9('0x3'));var BPromise=require(_0xf4d9('0x4'));var rp=require(_0xf4d9('0x5'));var fs=require('fs');var path=require(_0xf4d9('0x6'));var rimraf=require('rimraf');var config=require(_0xf4d9('0x7'));var attributes=require(_0xf4d9('0x8'));module[_0xf4d9('0x9')]=function(_0x23cd94,_0x28b9c9){return _0x23cd94[_0xf4d9('0xa')](_0xf4d9('0xb'),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 b37dc70..fdf8f74 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 _0x2a84=['request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','Automation,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x3081e1,_0x241403){var _0x291dc7=function(_0x1c7269){while(--_0x1c7269){_0x3081e1['push'](_0x3081e1['shift']());}};_0x291dc7(++_0x241403);}(_0x2a84,0x170));var _0x42a8=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2a84[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x42a8('0x0'));var util=require(_0x42a8('0x1'));var moment=require('moment');var BPromise=require(_0x42a8('0x2'));var rs=require(_0x42a8('0x3'));var fs=require('fs');var Redis=require(_0x42a8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x42a8('0x5'));var logger=require('../../config/logger')(_0x42a8('0x6'));var config=require(_0x42a8('0x7'));var jayson=require(_0x42a8('0x8'));var client=jayson['client'][_0x42a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b17b7,_0x434dc9,_0x10c2fe){return new BPromise(function(_0x4ff8e0,_0x2aa872){return client[_0x42a8('0xa')](_0x4b17b7,_0x10c2fe)['then'](function(_0x40062e){logger[_0x42a8('0xb')]('Automation,\x20%s,\x20%s',_0x434dc9,_0x42a8('0xc'));logger[_0x42a8('0xd')](_0x42a8('0xe'),_0x434dc9,'request\x20sent',JSON['stringify'](_0x40062e));if(_0x40062e[_0x42a8('0xf')]){if(_0x40062e['error'][_0x42a8('0x10')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x434dc9,_0x40062e[_0x42a8('0xf')][_0x42a8('0x11')]);return _0x2aa872(_0x40062e[_0x42a8('0xf')][_0x42a8('0x11')]);}logger[_0x42a8('0xf')](_0x42a8('0x12'),_0x434dc9,_0x40062e[_0x42a8('0xf')][_0x42a8('0x11')]);return _0x4ff8e0(_0x40062e['error']['message']);}else{logger[_0x42a8('0xb')](_0x42a8('0x12'),_0x434dc9,_0x42a8('0xc'));_0x4ff8e0(_0x40062e['result'][_0x42a8('0x11')]);}})[_0x42a8('0x13')](function(_0x3c0d41){logger[_0x42a8('0xf')](_0x42a8('0x12'),_0x434dc9,_0x3c0d41);_0x2aa872(_0x3c0d41);});});} \ No newline at end of file +var _0x91b6=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x15ce3a,_0x1cf22c){var _0x202f3b=function(_0xd3605e){while(--_0xd3605e){_0x15ce3a['push'](_0x15ce3a['shift']());}};_0x202f3b(++_0x1cf22c);}(_0x91b6,0x18b));var _0x691b=function(_0x181707,_0x47d753){_0x181707=_0x181707-0x0;var _0x1d2b7a=_0x91b6[_0x181707];return _0x1d2b7a;};'use strict';var _=require(_0x691b('0x0'));var util=require(_0x691b('0x1'));var moment=require('moment');var BPromise=require(_0x691b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x691b('0x3'))['db'];var utils=require(_0x691b('0x4'));var logger=require(_0x691b('0x5'))(_0x691b('0x6'));var config=require(_0x691b('0x7'));var jayson=require(_0x691b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x448027,_0x1ebd9c,_0x4ff18c){return new BPromise(function(_0x223632,_0xceca6a){return client[_0x691b('0x9')](_0x448027,_0x4ff18c)[_0x691b('0xa')](function(_0xbd8767){logger[_0x691b('0xb')](_0x691b('0xc'),_0x1ebd9c,_0x691b('0xd'));logger['debug'](_0x691b('0xe'),_0x1ebd9c,_0x691b('0xd'),JSON[_0x691b('0xf')](_0xbd8767));if(_0xbd8767[_0x691b('0x10')]){if(_0xbd8767[_0x691b('0x10')][_0x691b('0x11')]===0x1f4){logger['error'](_0x691b('0xc'),_0x1ebd9c,_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);return _0xceca6a(_0xbd8767[_0x691b('0x10')]['message']);}logger[_0x691b('0x10')](_0x691b('0xc'),_0x1ebd9c,_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);return _0x223632(_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);}else{logger[_0x691b('0xb')]('Automation,\x20%s,\x20%s',_0x1ebd9c,_0x691b('0xd'));_0x223632(_0xbd8767['result'][_0x691b('0x12')]);}})[_0x691b('0x13')](function(_0x2e4f84){logger[_0x691b('0x10')](_0x691b('0xc'),_0x1ebd9c,_0x2e4f84);_0xceca6a(_0x2e4f84);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index e2d8941..86d4202 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 _0xe1f0=['/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','get','/:id','/:id/conditions'];(function(_0x323419,_0x2a6172){var _0x4c0be7=function(_0x5ae2df){while(--_0x5ae2df){_0x323419['push'](_0x323419['shift']());}};_0x4c0be7(++_0x2a6172);}(_0xe1f0,0x1c2));var _0x0e1f=function(_0x4246a1,_0x4e6401){_0x4246a1=_0x4246a1-0x0;var _0xe77d55=_0xe1f0[_0x4246a1];return _0xe77d55;};'use strict';var multer=require('multer');var util=require(_0x0e1f('0x0'));var path=require(_0x0e1f('0x1'));var timeout=require('connect-timeout');var express=require(_0x0e1f('0x2'));var router=express[_0x0e1f('0x3')]();var fs_extra=require(_0x0e1f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0e1f('0x5'));var config=require(_0x0e1f('0x6'));var controller=require(_0x0e1f('0x7'));router['get']('/',auth[_0x0e1f('0x8')](),controller['index']);router[_0x0e1f('0x9')](_0x0e1f('0xa'),auth[_0x0e1f('0x8')](),controller['show']);router['get'](_0x0e1f('0xb'),auth[_0x0e1f('0x8')](),controller['getConditions']);router[_0x0e1f('0x9')](_0x0e1f('0xc'),auth[_0x0e1f('0x8')](),controller[_0x0e1f('0xd')]);router[_0x0e1f('0xe')]('/',auth[_0x0e1f('0x8')](),controller[_0x0e1f('0xf')]);router[_0x0e1f('0xe')](_0x0e1f('0xb'),auth[_0x0e1f('0x8')](),controller[_0x0e1f('0x10')]);router[_0x0e1f('0xe')]('/:id/actions',auth[_0x0e1f('0x8')](),controller[_0x0e1f('0x11')]);router[_0x0e1f('0x12')](_0x0e1f('0xa'),auth[_0x0e1f('0x8')](),controller[_0x0e1f('0x13')]);router[_0x0e1f('0x14')](_0x0e1f('0xa'),auth[_0x0e1f('0x8')](),controller[_0x0e1f('0x15')]);module['exports']=router; \ No newline at end of file +var _0x8ebf=['create','/:id/conditions','addConditions','addActions','put','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/actions','post'];(function(_0x23dcb0,_0x1d33d8){var _0x64f3a3=function(_0x55af46){while(--_0x55af46){_0x23dcb0['push'](_0x23dcb0['shift']());}};_0x64f3a3(++_0x1d33d8);}(_0x8ebf,0x15c));var _0xf8eb=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0x8ebf[_0x4687df];return _0x32eaef;};'use strict';var multer=require(_0xf8eb('0x0'));var util=require(_0xf8eb('0x1'));var path=require(_0xf8eb('0x2'));var timeout=require('connect-timeout');var express=require(_0xf8eb('0x3'));var router=express[_0xf8eb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf8eb('0x5'));var interaction=require(_0xf8eb('0x6'));var config=require(_0xf8eb('0x7'));var controller=require('./automation.controller');router[_0xf8eb('0x8')]('/',auth[_0xf8eb('0x9')](),controller['index']);router[_0xf8eb('0x8')](_0xf8eb('0xa'),auth[_0xf8eb('0x9')](),controller['show']);router[_0xf8eb('0x8')]('/:id/conditions',auth[_0xf8eb('0x9')](),controller['getConditions']);router[_0xf8eb('0x8')](_0xf8eb('0xb'),auth[_0xf8eb('0x9')](),controller['getActions']);router[_0xf8eb('0xc')]('/',auth[_0xf8eb('0x9')](),controller[_0xf8eb('0xd')]);router[_0xf8eb('0xc')](_0xf8eb('0xe'),auth[_0xf8eb('0x9')](),controller[_0xf8eb('0xf')]);router[_0xf8eb('0xc')]('/:id/actions',auth[_0xf8eb('0x9')](),controller[_0xf8eb('0x10')]);router[_0xf8eb('0x11')](_0xf8eb('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xf8eb('0x9')](),controller[_0xf8eb('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 2a86648..0fc1ffb 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 _0xf318=['UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER'];(function(_0x5794dd,_0x37af14){var _0x1a32a7=function(_0x3637dd){while(--_0x3637dd){_0x5794dd['push'](_0x5794dd['shift']());}};_0x1a32a7(++_0x37af14);}(_0xf318,0x155));var _0x8f31=function(_0x29a91e,_0x2b178a){_0x29a91e=_0x29a91e-0x0;var _0x4aac00=_0xf318[_0x29a91e];return _0x4aac00;};'use strict';var Sequelize=require(_0x8f31('0x0'));module[_0x8f31('0x1')]={'name':{'type':Sequelize[_0x8f31('0x2')],'unique':_0x8f31('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x8f31('0x4')](_0x8f31('0x5')),'allowNull':![],'defaultValue':_0x8f31('0x5')},'description':{'type':Sequelize[_0x8f31('0x2')]},'active':{'type':Sequelize[_0x8f31('0x6')],'defaultValue':0x0,'comment':_0x8f31('0x7')},'limitCalls':{'type':Sequelize[_0x8f31('0x8')](0x4)[_0x8f31('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x8f31('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f31('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8f31('0x8')](0x3)[_0x8f31('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f31('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8f31('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8f31('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x8f31('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f31('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8f31('0x8')](0x5)[_0x8f31('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8f31('0x8')](0x3)[_0x8f31('0x9')],'defaultValue':0x3,'comment':_0x8f31('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8f31('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8f31('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8f31('0x8')](0x3)[_0x8f31('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x8f31('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x8f31('0x4')]('always','never',_0x8f31('0x11')),'defaultValue':_0x8f31('0x12')},'dialAMDActive':{'type':Sequelize[_0x8f31('0x6')],'defaultValue':0x0,'comment':_0x8f31('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x8f31('0x8')](0x9)[_0x8f31('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8f31('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x8f31('0x8')](0x9)[_0x8f31('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8f31('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8f31('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8f31('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8f31('0x8')](0x9)[_0x8f31('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x8f31('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8f31('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8f31('0x8')](0x9)[_0x8f31('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8f31('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8f31('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8f31('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8f31('0x8')](0x5)[_0x8f31('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8f31('0x8')](0x9)[_0x8f31('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8f31('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8f31('0x4')](_0x8f31('0x1b'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x8f31('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8f31('0x8')](0x3)[_0x8f31('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x8f31('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8f31('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8f31('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f31('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8f31('0x8')](0x5)[_0x8f31('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8f31('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x8f31('0x8')](0x3)[_0x8f31('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f31('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x8f31('0x8')](0x5)[_0x8f31('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8f31('0x8')](0x3)[_0x8f31('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8f31('0x8')](0x5)[_0x8f31('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8f31('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x8f31('0x8')](0x3)[_0x8f31('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x8f31('0x8')](0x5)[_0x8f31('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8f31('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8f31('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8f31('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8f31('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x6665=['07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x315011,_0x3dfb3e){var _0x569d4b=function(_0x31dda7){while(--_0x31dda7){_0x315011['push'](_0x315011['shift']());}};_0x569d4b(++_0x3dfb3e);}(_0x6665,0x88));var _0x5666=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x6665[_0x4e5552];return _0x60a338;};'use strict';var Sequelize=require(_0x5666('0x0'));module[_0x5666('0x1')]={'name':{'type':Sequelize[_0x5666('0x2')],'unique':_0x5666('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5666('0x4')](_0x5666('0x5')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x5666('0x2')]},'active':{'type':Sequelize[_0x5666('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x5666('0x7')](0x4)[_0x5666('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5666('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5666('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5666('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x5666('0x7')](0x3)[_0x5666('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5666('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5666('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5666('0x7')](0x5)[_0x5666('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5666('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5666('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x5666('0x7')](0x5)[_0x5666('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5666('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5666('0x7')](0x3)[_0x5666('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5666('0x7')](0x5)[_0x5666('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5666('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5666('0x7')](0x3)[_0x5666('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5666('0x2')],'defaultValue':_0x5666('0xe')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x5666('0xf'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x5666('0x6')],'defaultValue':0x0,'comment':_0x5666('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0x5666('0x7')](0x9)[_0x5666('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5666('0x11')},'dialAMDGreeting':{'type':Sequelize[_0x5666('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5666('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5666('0x7')](0x9)[_0x5666('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x5666('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x5666('0x7')](0x9)[_0x5666('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5666('0x7')](0x9)[_0x5666('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x5666('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x5666('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5666('0x13')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5666('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x5666('0x4')](_0x5666('0x14'),'ASC'),'defaultValue':_0x5666('0x14')},'dialPrefix':{'type':Sequelize[_0x5666('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5666('0x7')](0x3)[_0x5666('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5666('0x15')},'dialCutDigit':{'type':Sequelize[_0x5666('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5666('0x16')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5666('0x7')](0x3)[_0x5666('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5666('0x17')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5666('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5666('0x18')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5666('0x19')},'dialDropRetryFrequency':{'type':Sequelize[_0x5666('0x7')](0x5)[_0x5666('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5666('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5666('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5666('0x1a')},'dialMachineMaxRetry':{'type':Sequelize[_0x5666('0x7')](0x3)[_0x5666('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5666('0x1b')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5666('0x1c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5666('0x7')](0x3)[_0x5666('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5666('0x1d')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5666('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 0163ea6..88f4d8d 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 _0x515d=['then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','length','Campaign','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','pick','CampaignId','CmHopper','findAll','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','NOW()','CmListId','toString','ListId','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','cm_contacts','COALESCE(phone,\x27\x27)','insert','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x5b184c,_0x504587){var _0x151399=function(_0x3766b1){while(--_0x3766b1){_0x5b184c['push'](_0x5b184c['shift']());}};_0x151399(++_0x504587);}(_0x515d,0x104));var _0xd515=function(_0x119768,_0x238c19){_0x119768=_0x119768-0x0;var _0x5c8503=_0x515d[_0x119768];return _0x5c8503;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd515('0x0'));var zipdir=require(_0xd515('0x1'));var jsonpatch=require(_0xd515('0x2'));var rp=require(_0xd515('0x3'));var moment=require(_0xd515('0x4'));var BPromise=require(_0xd515('0x5'));var Mustache=require(_0xd515('0x6'));var util=require(_0xd515('0x7'));var path=require('path');var sox=require(_0xd515('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd515('0x9'));var _=require(_0xd515('0xa'));var squel=require(_0xd515('0xb'));var crypto=require(_0xd515('0xc'));var jsforce=require(_0xd515('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd515('0xe'));var querystring=require(_0xd515('0xf'));var Papa=require(_0xd515('0x10'));var Redis=require(_0xd515('0x11'));var authService=require(_0xd515('0x12'));var qs=require(_0xd515('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd515('0x14'));var logger=require(_0xd515('0x15'))(_0xd515('0x16'));var utils=require(_0xd515('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd515('0x18'));var db=require(_0xd515('0x19'))['db'];function respondWithStatusCode(_0x29c078,_0x33b905){_0x33b905=_0x33b905||0xcc;return function(_0x1d6bda){if(_0x1d6bda){return _0x29c078[_0xd515('0x1a')](_0x33b905);}return _0x29c078[_0xd515('0x1b')](_0x33b905)[_0xd515('0x1c')]();};}function respondWithResult(_0x1f23b7,_0x43384b){_0x43384b=_0x43384b||0xc8;return function(_0x10620b){if(_0x10620b){return _0x1f23b7[_0xd515('0x1b')](_0x43384b)[_0xd515('0x1d')](_0x10620b);}};}function respondWithFilteredResult(_0x589d04,_0x274550){return function(_0xc41eca){if(_0xc41eca){var _0xc8fbf=typeof _0x274550[_0xd515('0x1e')]===_0xd515('0x1f')&&typeof _0x274550[_0xd515('0x20')]===_0xd515('0x1f');var _0x139e91=_0xc41eca[_0xd515('0x21')];var _0x564c4e=_0xc8fbf?0x0:_0x274550['offset'];var _0x43bb12=_0xc8fbf?_0xc41eca[_0xd515('0x21')]:_0x274550[_0xd515('0x1e')]+_0x274550[_0xd515('0x20')];var _0x1ef858;if(_0x43bb12>=_0x139e91){_0x43bb12=_0x139e91;_0x1ef858=0xc8;}else{_0x1ef858=0xce;}_0x589d04[_0xd515('0x1b')](_0x1ef858);return _0x589d04[_0xd515('0x22')](_0xd515('0x23'),_0x564c4e+'-'+_0x43bb12+'/'+_0x139e91)[_0xd515('0x1d')](_0xc41eca);}return null;};}function patchUpdates(_0x5c7fef){return function(_0x57e1f4){try{jsonpatch[_0xd515('0x24')](_0x57e1f4,_0x5c7fef,!![]);}catch(_0x5b1649){return BPromise[_0xd515('0x25')](_0x5b1649);}return _0x57e1f4[_0xd515('0x26')]();};}function saveUpdates(_0x2b2ed5,_0x4e9d06){return function(_0xb422bc){if(_0xb422bc){return _0xb422bc[_0xd515('0x27')](_0x2b2ed5)[_0xd515('0x28')](function(_0x299b46){return _0x299b46;});}return null;};}function removeEntity(_0x519b7f,_0x430153){return function(_0x11cc9f){if(_0x11cc9f){return _0x11cc9f[_0xd515('0x29')]()[_0xd515('0x28')](function(){var _0x1a5f58=_0x11cc9f[_0xd515('0x2a')]({'plain':!![]});var _0x130533=_0xd515('0x2b');return db[_0xd515('0x2c')]['destroy']({'where':{'type':_0x130533,'resourceId':_0x1a5f58['id']}})['then'](function(){return _0x11cc9f;});})[_0xd515('0x28')](function(){_0x519b7f[_0xd515('0x1b')](0xcc)[_0xd515('0x1c')]();});}};}function handleEntityNotFound(_0x3105b4,_0x1d70a8){return function(_0x2171bc){if(!_0x2171bc){_0x3105b4[_0xd515('0x1a')](0x194);}return _0x2171bc;};}function handleError(_0x33fc3b,_0x53ec33){_0x53ec33=_0x53ec33||0x1f4;return function(_0x38766a){logger[_0xd515('0x2d')](_0x38766a[_0xd515('0x2e')]);if(_0x38766a[_0xd515('0x2f')]){delete _0x38766a[_0xd515('0x2f')];}_0x33fc3b[_0xd515('0x1b')](_0x53ec33)[_0xd515('0x30')](_0x38766a);};}exports['index']=function(_0x587bdc,_0x5d4f45){var _0x1ed161={},_0x1f77cd={},_0x3feaf6={'count':0x0,'rows':[]};var _0x50f61f=_['map'](db['Campaign'][_0xd515('0x31')],function(_0xd2a563){return{'name':_0xd2a563[_0xd515('0x32')],'type':_0xd2a563[_0xd515('0x33')][_0xd515('0x34')]};});_0x1f77cd['model']=_[_0xd515('0x35')](_0x50f61f,'name');_0x1f77cd[_0xd515('0x36')]=_[_0xd515('0x37')](_0x587bdc[_0xd515('0x36')]);_0x1f77cd[_0xd515('0x38')]=_[_0xd515('0x39')](_0x1f77cd[_0xd515('0x3a')],_0x1f77cd[_0xd515('0x36')]);_0x1ed161['attributes']=_[_0xd515('0x39')](_0x1f77cd[_0xd515('0x3a')],qs[_0xd515('0x3b')](_0x587bdc[_0xd515('0x36')][_0xd515('0x3b')]));_0x1ed161['attributes']=_0x1ed161[_0xd515('0x3c')]['length']?_0x1ed161[_0xd515('0x3c')]:_0x1f77cd[_0xd515('0x3a')];if(!_0x587bdc[_0xd515('0x36')][_0xd515('0x3d')](_0xd515('0x3e'))){_0x1ed161[_0xd515('0x20')]=qs[_0xd515('0x20')](_0x587bdc[_0xd515('0x36')][_0xd515('0x20')]);_0x1ed161[_0xd515('0x1e')]=qs[_0xd515('0x1e')](_0x587bdc[_0xd515('0x36')]['offset']);}_0x1ed161[_0xd515('0x3f')]=qs[_0xd515('0x40')](_0x587bdc[_0xd515('0x36')]['sort']);_0x1ed161[_0xd515('0x41')]=qs['filters'](_['pick'](_0x587bdc['query'],_0x1f77cd['filters']),_0x50f61f);if(_0x587bdc[_0xd515('0x36')][_0xd515('0x42')]){_0x1ed161['where']=_[_0xd515('0x43')](_0x1ed161['where'],{'$or':_['map'](_0x50f61f,function(_0x1cabec){if(_0x1cabec['type']!=='VIRTUAL'){var _0x2c2def={};_0x2c2def[_0x1cabec[_0xd515('0x2f')]]={'$like':'%'+_0x587bdc[_0xd515('0x36')][_0xd515('0x42')]+'%'};return _0x2c2def;}})});}_0x1ed161=_[_0xd515('0x43')]({},_0x1ed161,_0x587bdc[_0xd515('0x44')]);var _0x15ef1a={'where':_0x1ed161[_0xd515('0x41')]};return db['Campaign'][_0xd515('0x21')](_0x15ef1a)[_0xd515('0x28')](function(_0x45b7b4){_0x3feaf6['count']=_0x45b7b4;if(_0x587bdc[_0xd515('0x36')][_0xd515('0x45')]){_0x1ed161[_0xd515('0x46')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x1ed161);})[_0xd515('0x28')](function(_0x3d752){_0x3feaf6[_0xd515('0x47')]=_0x3d752;return _0x3feaf6;})[_0xd515('0x28')](respondWithFilteredResult(_0x5d4f45,_0x1ed161))[_0xd515('0x48')](handleError(_0x5d4f45,null));};exports[_0xd515('0x49')]=function(_0x126661,_0x49a962){var _0x489941={'raw':![],'where':{'id':_0x126661[_0xd515('0x4a')]['id']}},_0x5cfff0={};_0x5cfff0[_0xd515('0x3a')]=_[_0xd515('0x37')](db['Campaign'][_0xd515('0x31')]);_0x5cfff0[_0xd515('0x36')]=_[_0xd515('0x37')](_0x126661[_0xd515('0x36')]);_0x5cfff0[_0xd515('0x38')]=_['intersection'](_0x5cfff0[_0xd515('0x3a')],_0x5cfff0[_0xd515('0x36')]);_0x489941[_0xd515('0x3c')]=_[_0xd515('0x39')](_0x5cfff0[_0xd515('0x3a')],qs[_0xd515('0x3b')](_0x126661['query'][_0xd515('0x3b')]));_0x489941['attributes']=_0x489941[_0xd515('0x3c')][_0xd515('0x4b')]?_0x489941[_0xd515('0x3c')]:_0x5cfff0['model'];if(_0x126661[_0xd515('0x36')][_0xd515('0x45')]){_0x489941['include']=[{'all':!![]}];}_0x489941=_[_0xd515('0x43')]({},_0x489941,_0x126661[_0xd515('0x44')]);return db[_0xd515('0x4c')]['find'](_0x489941)[_0xd515('0x28')](handleEntityNotFound(_0x49a962,null))['then'](respondWithResult(_0x49a962,null))[_0xd515('0x48')](handleError(_0x49a962,null));};exports[_0xd515('0x4d')]=function(_0x39ba14,_0x4843fa){return db[_0xd515('0x4c')]['create'](_0x39ba14[_0xd515('0x4e')],{})[_0xd515('0x28')](function(_0x14bc06){var _0xe84589=_0x39ba14['user']['get']({'plain':!![]});if(!_0xe84589)throw new Error(_0xd515('0x4f'));if(_0xe84589[_0xd515('0x50')]===_0xd515('0x51')){var _0x3eb60f=_0x14bc06['get']({'plain':!![]});var _0x560bb8=_0xd515('0x2b');return db['UserProfileSection'][_0xd515('0x52')]({'where':{'name':_0x560bb8,'userProfileId':_0xe84589['userProfileId']},'raw':!![]})[_0xd515('0x28')](function(_0xbbccf4){if(_0xbbccf4&&_0xbbccf4[_0xd515('0x53')]===0x0){return db[_0xd515('0x2c')]['create']({'name':_0x3eb60f['name'],'resourceId':_0x3eb60f['id'],'type':_0xbbccf4[_0xd515('0x2f')],'sectionId':_0xbbccf4['id']},{})[_0xd515('0x28')](function(){return _0x14bc06;});}else{return _0x14bc06;}})['catch'](function(_0xb1a212){logger[_0xd515('0x2d')](_0xd515('0x54'),_0xb1a212);throw _0xb1a212;});}return _0x14bc06;})[_0xd515('0x28')](respondWithResult(_0x4843fa,0xc9))[_0xd515('0x48')](handleError(_0x4843fa,null));};exports[_0xd515('0x55')]=function(_0x48ecec,_0x5d8c28){var _0x31ebaa={'where':{'id':_0x48ecec[_0xd515('0x4a')]['id']}},_0x2c9629={};_0x2c9629['model']=_[_0xd515('0x37')](db[_0xd515('0x4c')]['rawAttributes']);_0x31ebaa[_0xd515('0x3c')]=_[_0xd515('0x39')](_0x2c9629['model'],qs[_0xd515('0x3b')](_0x48ecec[_0xd515('0x36')][_0xd515('0x3b')]));_0x31ebaa[_0xd515('0x3c')]=_0x31ebaa[_0xd515('0x3c')][_0xd515('0x4b')]?_0x31ebaa['attributes']:_0x2c9629[_0xd515('0x3a')];if(_0x48ecec['query'][_0xd515('0x45')]){_0x31ebaa[_0xd515('0x46')]=[{'all':!![]}];}_0x31ebaa=_[_0xd515('0x43')]({},_0x31ebaa,_0x48ecec['options']);return db[_0xd515('0x4c')][_0xd515('0x52')](_0x31ebaa)[_0xd515('0x28')](handleEntityNotFound(_0x5d8c28,null))[_0xd515('0x28')](function(_0x7b2843){if(_0x7b2843){var _0x21ffed=_0x7b2843[_0xd515('0x2a')]({'plain':!![]});_0x21ffed=qs[_0xd515('0x56')](_0x21ffed,['id',_0xd515('0x57'),_0xd515('0x58')]);_0x48ecec[_0xd515('0x4e')]=_[_0xd515('0x56')](_0x48ecec[_0xd515('0x4e')],['id',_0xd515('0x57'),_0xd515('0x58')]);return db[_0xd515('0x4c')][_0xd515('0x4d')](_[_0xd515('0x43')](_0x21ffed,_0x48ecec[_0xd515('0x4e')]),{'include':_0x48ecec[_0xd515('0x36')][_0xd515('0x45')]?[{'all':!![]}]:undefined})[_0xd515('0x28')](function(_0xe6a36f){var _0x337d1f=_0x48ecec[_0xd515('0x51')][_0xd515('0x2a')]({'plain':!![]});if(!_0x337d1f)throw new Error(_0xd515('0x4f'));if(_0x337d1f['role']===_0xd515('0x51')){var _0x1338f8=_0xe6a36f['get']({'plain':!![]});var _0x390db2=_0xd515('0x2b');return db[_0xd515('0x59')][_0xd515('0x52')]({'where':{'name':_0x390db2,'userProfileId':_0x337d1f['userProfileId']},'raw':!![]})['then'](function(_0x1fb7bc){if(_0x1fb7bc&&_0x1fb7bc[_0xd515('0x53')]===0x0){return db[_0xd515('0x2c')]['create']({'name':_0x1338f8[_0xd515('0x2f')],'resourceId':_0x1338f8['id'],'type':_0x1fb7bc[_0xd515('0x2f')],'sectionId':_0x1fb7bc['id']},{})[_0xd515('0x28')](function(){return _0xe6a36f;});}else{return _0xe6a36f;}})[_0xd515('0x48')](function(_0x20fae4){logger[_0xd515('0x2d')](_0xd515('0x54'),_0x20fae4);throw _0x20fae4;});}return _0xe6a36f;});}})['then'](respondWithResult(_0x5d8c28,0xc9))[_0xd515('0x48')](handleError(_0x5d8c28,null));};exports[_0xd515('0x27')]=function(_0x2cd132,_0x2dc0a5){if(_0x2cd132['body']['id']){delete _0x2cd132[_0xd515('0x4e')]['id'];}return db[_0xd515('0x4c')][_0xd515('0x52')]({'where':{'id':_0x2cd132[_0xd515('0x4a')]['id']}})[_0xd515('0x28')](handleEntityNotFound(_0x2dc0a5,null))[_0xd515('0x28')](saveUpdates(_0x2cd132['body'],null))[_0xd515('0x28')](respondWithResult(_0x2dc0a5,null))[_0xd515('0x48')](handleError(_0x2dc0a5,null));};exports[_0xd515('0x29')]=function(_0x18975f,_0xdaad90){return db[_0xd515('0x4c')][_0xd515('0x52')]({'where':{'id':_0x18975f['params']['id']}})['then'](handleEntityNotFound(_0xdaad90,null))[_0xd515('0x28')](removeEntity(_0xdaad90,null))[_0xd515('0x48')](handleError(_0xdaad90,null));};exports['getHoppers']=function(_0x3b3561,_0x273af7,_0x601d2d){var _0x442ea9={'raw':!![],'where':{}};var _0x2af946={};var _0x1e1e45={'count':0x0,'rows':[]};return db[_0xd515('0x4c')]['findOne']({'where':{'id':_0x3b3561[_0xd515('0x4a')]['id']}})[_0xd515('0x28')](handleEntityNotFound(_0x273af7,null))['then'](function(_0x131438){if(_0x131438){_0x2af946[_0xd515('0x3a')]=_[_0xd515('0x37')](db['CmHopper'][_0xd515('0x31')]);_0x2af946[_0xd515('0x36')]=_[_0xd515('0x37')](_0x3b3561['query']);_0x2af946[_0xd515('0x38')]=_[_0xd515('0x39')](_0x2af946[_0xd515('0x3a')],_0x2af946[_0xd515('0x36')]);_0x442ea9[_0xd515('0x3c')]=_[_0xd515('0x39')](_0x2af946[_0xd515('0x3a')],qs['fields'](_0x3b3561[_0xd515('0x36')][_0xd515('0x3b')]));_0x442ea9['attributes']=_0x442ea9[_0xd515('0x3c')]['length']?_0x442ea9[_0xd515('0x3c')]:_0x2af946[_0xd515('0x3a')];if(!_0x3b3561[_0xd515('0x36')][_0xd515('0x3d')](_0xd515('0x3e'))){_0x442ea9[_0xd515('0x20')]=qs['limit'](_0x3b3561['query']['limit']);_0x442ea9[_0xd515('0x1e')]=qs['offset'](_0x3b3561['query'][_0xd515('0x1e')]);}_0x442ea9[_0xd515('0x3f')]=qs[_0xd515('0x40')](_0x3b3561[_0xd515('0x36')][_0xd515('0x40')]);_0x442ea9[_0xd515('0x41')]=qs[_0xd515('0x38')](_[_0xd515('0x5a')](_0x3b3561[_0xd515('0x36')],_0x2af946['filters']));_0x442ea9[_0xd515('0x41')][_0xd515('0x5b')]=_0x131438['id'];if(_0x3b3561['query'][_0xd515('0x42')]){_0x442ea9[_0xd515('0x41')]=_['merge'](_0x442ea9[_0xd515('0x41')],{'$or':_[_0xd515('0x35')](_0x442ea9[_0xd515('0x3c')],function(_0x25be6e){var _0x1950b6={};_0x1950b6[_0x25be6e]={'$like':'%'+_0x3b3561[_0xd515('0x36')][_0xd515('0x42')]+'%'};return _0x1950b6;})});}_0x442ea9=_[_0xd515('0x43')]({},_0x442ea9,_0x3b3561[_0xd515('0x44')]);return db['CmHopper'][_0xd515('0x21')]({'where':_0x442ea9['where']})[_0xd515('0x28')](function(_0x51c285){_0x1e1e45['count']=_0x51c285;if(_0x3b3561['query'][_0xd515('0x45')]){_0x442ea9[_0xd515('0x46')]=[{'all':!![]}];}return db[_0xd515('0x5c')][_0xd515('0x5d')](_0x442ea9);})['then'](function(_0x3ef3bc){_0x1e1e45[_0xd515('0x47')]=_0x3ef3bc;return _0x1e1e45;});}})[_0xd515('0x28')](respondWithFilteredResult(_0x273af7,_0x442ea9))[_0xd515('0x48')](handleError(_0x273af7,null));};exports[_0xd515('0x5e')]=function(_0x35656e,_0x26efcb,_0x3d5bc8){var _0x3ae5f0={'raw':!![],'where':{}};var _0x25b7e0={};var _0x5edf58={'count':0x0,'rows':[]};return db[_0xd515('0x4c')][_0xd515('0x5f')]({'where':{'id':_0x35656e['params']['id']}})[_0xd515('0x28')](handleEntityNotFound(_0x26efcb,null))['then'](function(_0x16b810){if(_0x16b810){_0x25b7e0['model']=_[_0xd515('0x37')](db[_0xd515('0x60')][_0xd515('0x31')]);_0x25b7e0[_0xd515('0x36')]=_[_0xd515('0x37')](_0x35656e['query']);_0x25b7e0[_0xd515('0x38')]=_[_0xd515('0x39')](_0x25b7e0[_0xd515('0x3a')],_0x25b7e0[_0xd515('0x36')]);_0x3ae5f0[_0xd515('0x3c')]=_[_0xd515('0x39')](_0x25b7e0[_0xd515('0x3a')],qs['fields'](_0x35656e[_0xd515('0x36')][_0xd515('0x3b')]));_0x3ae5f0['attributes']=_0x3ae5f0[_0xd515('0x3c')][_0xd515('0x4b')]?_0x3ae5f0[_0xd515('0x3c')]:_0x25b7e0[_0xd515('0x3a')];if(!_0x35656e[_0xd515('0x36')][_0xd515('0x3d')](_0xd515('0x3e'))){_0x3ae5f0[_0xd515('0x20')]=qs[_0xd515('0x20')](_0x35656e[_0xd515('0x36')]['limit']);_0x3ae5f0[_0xd515('0x1e')]=qs[_0xd515('0x1e')](_0x35656e[_0xd515('0x36')][_0xd515('0x1e')]);}_0x3ae5f0['order']=qs[_0xd515('0x40')](_0x35656e[_0xd515('0x36')][_0xd515('0x40')]);_0x3ae5f0[_0xd515('0x41')]=qs[_0xd515('0x38')](_[_0xd515('0x5a')](_0x35656e['query'],_0x25b7e0[_0xd515('0x38')]));_0x3ae5f0[_0xd515('0x41')][_0xd515('0x5b')]=_0x16b810['id'];if(_0x35656e['query'][_0xd515('0x42')]){_0x3ae5f0['where']=_[_0xd515('0x43')](_0x3ae5f0[_0xd515('0x41')],{'$or':_[_0xd515('0x35')](_0x3ae5f0[_0xd515('0x3c')],function(_0x4f84ae){var _0x36bcfa={};_0x36bcfa[_0x4f84ae]={'$like':'%'+_0x35656e[_0xd515('0x36')][_0xd515('0x42')]+'%'};return _0x36bcfa;})});}_0x3ae5f0=_['merge']({},_0x3ae5f0,_0x35656e[_0xd515('0x44')]);return db[_0xd515('0x60')][_0xd515('0x21')]({'where':_0x3ae5f0[_0xd515('0x41')]})[_0xd515('0x28')](function(_0x5cf607){_0x5edf58[_0xd515('0x21')]=_0x5cf607;if(_0x35656e[_0xd515('0x36')][_0xd515('0x45')]){_0x3ae5f0['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xd515('0x5d')](_0x3ae5f0);})[_0xd515('0x28')](function(_0x2157ae){_0x5edf58[_0xd515('0x47')]=_0x2157ae;return _0x5edf58;});}})[_0xd515('0x28')](respondWithFilteredResult(_0x26efcb,_0x3ae5f0))['catch'](handleError(_0x26efcb,null));};exports[_0xd515('0x61')]=function(_0x4e8afe,_0xbe54df,_0x4ee971){var _0x4af2f8={'raw':!![],'where':{}};var _0x5a412e={};var _0x1c6c4c={'count':0x0,'rows':[]};return db[_0xd515('0x4c')][_0xd515('0x5f')]({'where':{'id':_0x4e8afe['params']['id']}})['then'](handleEntityNotFound(_0xbe54df,null))[_0xd515('0x28')](function(_0x7f823e){if(_0x7f823e){_0x5a412e[_0xd515('0x3a')]=_['keys'](db[_0xd515('0x62')]['rawAttributes']);_0x5a412e[_0xd515('0x36')]=_[_0xd515('0x37')](_0x4e8afe['query']);_0x5a412e[_0xd515('0x38')]=_[_0xd515('0x39')](_0x5a412e[_0xd515('0x3a')],_0x5a412e[_0xd515('0x36')]);_0x4af2f8['attributes']=_[_0xd515('0x39')](_0x5a412e[_0xd515('0x3a')],qs[_0xd515('0x3b')](_0x4e8afe[_0xd515('0x36')][_0xd515('0x3b')]));_0x4af2f8['attributes']=_0x4af2f8['attributes']['length']?_0x4af2f8[_0xd515('0x3c')]:_0x5a412e[_0xd515('0x3a')];if(!_0x4e8afe['query'][_0xd515('0x3d')]('nolimit')){_0x4af2f8[_0xd515('0x20')]=qs[_0xd515('0x20')](_0x4e8afe[_0xd515('0x36')][_0xd515('0x20')]);_0x4af2f8[_0xd515('0x1e')]=qs[_0xd515('0x1e')](_0x4e8afe[_0xd515('0x36')]['offset']);}_0x4af2f8[_0xd515('0x3f')]=qs['sort'](_0x4e8afe['query']['sort']);_0x4af2f8[_0xd515('0x41')]=qs['filters'](_['pick'](_0x4e8afe[_0xd515('0x36')],_0x5a412e[_0xd515('0x38')]));_0x4af2f8[_0xd515('0x41')]['CampaignId']=_0x7f823e['id'];if(_0x4e8afe['query']['filter']){_0x4af2f8['where']=_['merge'](_0x4af2f8[_0xd515('0x41')],{'$or':_[_0xd515('0x35')](_0x4af2f8[_0xd515('0x3c')],function(_0x209c96){var _0x3ab81c={};_0x3ab81c[_0x209c96]={'$like':'%'+_0x4e8afe[_0xd515('0x36')][_0xd515('0x42')]+'%'};return _0x3ab81c;})});}_0x4af2f8=_[_0xd515('0x43')]({},_0x4af2f8,_0x4e8afe[_0xd515('0x44')]);return db[_0xd515('0x62')]['count']({'where':_0x4af2f8[_0xd515('0x41')]})['then'](function(_0x5f29be){_0x1c6c4c[_0xd515('0x21')]=_0x5f29be;if(_0x4e8afe[_0xd515('0x36')][_0xd515('0x45')]){_0x4af2f8[_0xd515('0x46')]=[{'all':!![]}];}return db[_0xd515('0x62')][_0xd515('0x5d')](_0x4af2f8);})[_0xd515('0x28')](function(_0x3c2370){_0x1c6c4c['rows']=_0x3c2370;return _0x1c6c4c;});}})[_0xd515('0x28')](respondWithFilteredResult(_0xbe54df,_0x4af2f8))[_0xd515('0x48')](handleError(_0xbe54df,null));};exports['getHopperBlacks']=function(_0x11def2,_0x53e4e7,_0x510f17){var _0x3f3483={'raw':!![],'where':{}};var _0x4a4302={};var _0x28716d={'count':0x0,'rows':[]};return db[_0xd515('0x4c')][_0xd515('0x5f')]({'where':{'id':_0x11def2[_0xd515('0x4a')]['id']}})[_0xd515('0x28')](handleEntityNotFound(_0x53e4e7,null))[_0xd515('0x28')](function(_0x1411e7){if(_0x1411e7){_0x4a4302[_0xd515('0x3a')]=_[_0xd515('0x37')](db['CmHopperBlack'][_0xd515('0x31')]);_0x4a4302[_0xd515('0x36')]=_[_0xd515('0x37')](_0x11def2['query']);_0x4a4302['filters']=_[_0xd515('0x39')](_0x4a4302[_0xd515('0x3a')],_0x4a4302['query']);_0x3f3483['attributes']=_['intersection'](_0x4a4302[_0xd515('0x3a')],qs[_0xd515('0x3b')](_0x11def2['query'][_0xd515('0x3b')]));_0x3f3483['attributes']=_0x3f3483[_0xd515('0x3c')][_0xd515('0x4b')]?_0x3f3483[_0xd515('0x3c')]:_0x4a4302[_0xd515('0x3a')];if(!_0x11def2[_0xd515('0x36')][_0xd515('0x3d')](_0xd515('0x3e'))){_0x3f3483[_0xd515('0x20')]=qs['limit'](_0x11def2[_0xd515('0x36')][_0xd515('0x20')]);_0x3f3483[_0xd515('0x1e')]=qs[_0xd515('0x1e')](_0x11def2['query'][_0xd515('0x1e')]);}_0x3f3483[_0xd515('0x3f')]=qs['sort'](_0x11def2[_0xd515('0x36')][_0xd515('0x40')]);_0x3f3483['where']=qs[_0xd515('0x38')](_[_0xd515('0x5a')](_0x11def2[_0xd515('0x36')],_0x4a4302['filters']));_0x3f3483[_0xd515('0x41')][_0xd515('0x5b')]=_0x1411e7['id'];if(_0x11def2['query'][_0xd515('0x42')]){_0x3f3483[_0xd515('0x41')]=_['merge'](_0x3f3483[_0xd515('0x41')],{'$or':_[_0xd515('0x35')](_0x3f3483['attributes'],function(_0x1c3c6c){var _0x3ab747={};_0x3ab747[_0x1c3c6c]={'$like':'%'+_0x11def2[_0xd515('0x36')][_0xd515('0x42')]+'%'};return _0x3ab747;})});}_0x3f3483=_[_0xd515('0x43')]({},_0x3f3483,_0x11def2[_0xd515('0x44')]);return db[_0xd515('0x63')]['count']({'where':_0x3f3483[_0xd515('0x41')]})[_0xd515('0x28')](function(_0x237c6b){_0x28716d[_0xd515('0x21')]=_0x237c6b;if(_0x11def2[_0xd515('0x36')][_0xd515('0x45')]){_0x3f3483[_0xd515('0x46')]=[{'all':!![]}];}return db[_0xd515('0x63')][_0xd515('0x5d')](_0x3f3483);})[_0xd515('0x28')](function(_0x1edaa0){_0x28716d[_0xd515('0x47')]=_0x1edaa0;return _0x28716d;});}})[_0xd515('0x28')](respondWithFilteredResult(_0x53e4e7,_0x3f3483))['catch'](handleError(_0x53e4e7,null));};exports[_0xd515('0x64')]=function(_0x96b1f6,_0x3a6ff8,_0x4ca5e5){var _0x1e734b={};var _0xb04480={};var _0x56b67f;var _0x30c80c;return db[_0xd515('0x4c')][_0xd515('0x5f')]({'where':{'id':_0x96b1f6[_0xd515('0x4a')]['id']}})[_0xd515('0x28')](handleEntityNotFound(_0x3a6ff8,null))[_0xd515('0x28')](function(_0xac5c7f){if(_0xac5c7f){_0x56b67f=_0xac5c7f;_0xb04480['model']=_[_0xd515('0x37')](db[_0xd515('0x65')][_0xd515('0x31')]);_0xb04480['query']=_[_0xd515('0x37')](_0x96b1f6[_0xd515('0x36')]);_0xb04480[_0xd515('0x38')]=_[_0xd515('0x39')](_0xb04480[_0xd515('0x3a')],_0xb04480[_0xd515('0x36')]);_0x1e734b[_0xd515('0x3c')]=_[_0xd515('0x39')](_0xb04480[_0xd515('0x3a')],qs[_0xd515('0x3b')](_0x96b1f6[_0xd515('0x36')][_0xd515('0x3b')]));_0x1e734b[_0xd515('0x3c')]=_0x1e734b['attributes'][_0xd515('0x4b')]?_0x1e734b[_0xd515('0x3c')]:_0xb04480[_0xd515('0x3a')];_0x1e734b[_0xd515('0x3f')]=qs['sort'](_0x96b1f6[_0xd515('0x36')][_0xd515('0x40')]);_0x1e734b[_0xd515('0x41')]=qs[_0xd515('0x38')](_['pick'](_0x96b1f6[_0xd515('0x36')],_0xb04480[_0xd515('0x38')]));if(_0x96b1f6[_0xd515('0x36')][_0xd515('0x42')]){_0x1e734b[_0xd515('0x41')]=_[_0xd515('0x43')](_0x1e734b[_0xd515('0x41')],{'$or':_['map'](_0x1e734b[_0xd515('0x3c')],function(_0x4f05dc){var _0x47121a={};_0x47121a[_0x4f05dc]={'$like':'%'+_0x96b1f6[_0xd515('0x36')][_0xd515('0x42')]+'%'};return _0x47121a;})});}_0x1e734b=_[_0xd515('0x43')]({},_0x1e734b,_0x96b1f6['options']);return _0x56b67f[_0xd515('0x64')](_0x1e734b);}})[_0xd515('0x28')](function(_0x1e6736){if(_0x1e6736){_0x30c80c=_0x1e6736[_0xd515('0x4b')];if(!_0x96b1f6[_0xd515('0x36')][_0xd515('0x3d')]('nolimit')){_0x1e734b[_0xd515('0x20')]=qs[_0xd515('0x20')](_0x96b1f6['query']['limit']);_0x1e734b['offset']=qs[_0xd515('0x1e')](_0x96b1f6[_0xd515('0x36')]['offset']);}return _0x56b67f[_0xd515('0x64')](_0x1e734b);}})[_0xd515('0x28')](function(_0x50ae8d){if(_0x50ae8d){return _0x50ae8d?{'count':_0x30c80c,'rows':_0x50ae8d}:null;}})['then'](respondWithResult(_0x3a6ff8,null))['catch'](handleError(_0x3a6ff8,null));};exports[_0xd515('0x66')]=function(_0x3b43ad,_0x426f9b,_0x3a5736){var _0x13a90c,_0x43c4bd;var _0x40813d=[];var _0x227cd9=moment()[_0xd515('0x67')](_0xd515('0x68'));return db[_0xd515('0x4c')][_0xd515('0x52')]({'where':{'id':_0x3b43ad[_0xd515('0x4a')]['id']}})['then'](handleEntityNotFound(_0x426f9b,null))[_0xd515('0x28')](function(_0x531956){if(_0x531956){_0x43c4bd=_0x531956;return _0x531956[_0xd515('0x66')](_0x3b43ad[_0xd515('0x4e')][_0xd515('0x69')],_[_0xd515('0x56')](_0x3b43ad[_0xd515('0x4e')],[_0xd515('0x69'),'id'])||{});}return null;})[_0xd515('0x6a')](function(_0x1b1c07){var _0x4fb7cc;var _0x1b2cd5;_0x13a90c=_0x1b1c07||[];var _0x31e053=[];if(_0x1b1c07){for(var _0x7cd9a7=0x0;_0x7cd9a7<_0x1b1c07[_0xd515('0x4b')];_0x7cd9a7+=0x1){var _0x39733c=_0x1b1c07[_0x7cd9a7][_0xd515('0x2a')]({'plain':!![]});_0x43c4bd[_0xd515('0x6b')]=_0x3b43ad[_0xd515('0x4e')]['dialCheckDuplicateType']?_0x3b43ad[_0xd515('0x4e')]['dialCheckDuplicateType']:_0x43c4bd['dialCheckDuplicateType'];switch(_0x43c4bd[_0xd515('0x6b')]){case _0xd515('0x6c'):_0x4fb7cc=squel['insert']()[_0xd515('0x6d')](_0xd515('0x6e'))[_0xd515('0x6f')]([_0xd515('0x70'),_0xd515('0x71'),_0xd515('0x72'),'ListId','CampaignId',_0xd515('0x57'),_0xd515('0x58')],squel[_0xd515('0x73')]()[_0xd515('0x74')](_0xd515('0x70'),_0xd515('0x70'))[_0xd515('0x74')](_0xd515('0x75'),_0xd515('0x71'))[_0xd515('0x74')]('id',_0xd515('0x72'))[_0xd515('0x74')](_0x39733c[_0xd515('0x76')][_0xd515('0x77')](),_0xd515('0x78'))['field'](_0x3b43ad[_0xd515('0x4a')]['id']['toString'](),_0xd515('0x5b'))[_0xd515('0x74')]('\x27'+_0x227cd9+'\x27',_0xd515('0x57'))[_0xd515('0x74')]('\x27'+_0x227cd9+'\x27',_0xd515('0x58'))[_0xd515('0x79')]('cm_contacts')[_0xd515('0x41')](_0xd515('0x7a'))[_0xd515('0x41')](_0xd515('0x7b'),_0x39733c['CmListId'][_0xd515('0x77')]())[_0xd515('0x41')](_0xd515('0x7c'))[_0xd515('0x41')](_0xd515('0x7d'),squel[_0xd515('0x73')]()['field'](_0xd515('0x7e'))[_0xd515('0x79')](_0xd515('0x7f'))['where'](_0xd515('0x80'),_0x3b43ad[_0xd515('0x4a')]['id'][_0xd515('0x77')]()))[_0xd515('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd515('0x73')]()['field']('COALESCE(phone,\x27\x27)')[_0xd515('0x79')](_0xd515('0x6e'))[_0xd515('0x41')](_0xd515('0x80'),_0x3b43ad[_0xd515('0x4a')]['id'][_0xd515('0x77')]())))[_0xd515('0x77')]();break;case _0xd515('0x81'):_0x4fb7cc=squel['insert']()['into']('cm_hopper')[_0xd515('0x6f')]([_0xd515('0x70'),_0xd515('0x71'),_0xd515('0x72'),_0xd515('0x78'),_0xd515('0x5b'),_0xd515('0x57'),'updatedAt'],squel[_0xd515('0x73')]()['field'](_0xd515('0x70'),'phone')[_0xd515('0x74')](_0xd515('0x75'),_0xd515('0x71'))[_0xd515('0x74')]('id','ContactId')['field'](_0x39733c[_0xd515('0x76')]['toString'](),_0xd515('0x78'))['field'](_0x3b43ad['params']['id'][_0xd515('0x77')](),_0xd515('0x5b'))[_0xd515('0x74')]('\x27'+_0x227cd9+'\x27',_0xd515('0x57'))['field']('\x27'+_0x227cd9+'\x27',_0xd515('0x58'))[_0xd515('0x79')](_0xd515('0x82'))[_0xd515('0x41')]('deletedAt\x20IS\x20NULL')[_0xd515('0x41')](_0xd515('0x7b'),_0x39733c[_0xd515('0x76')][_0xd515('0x77')]())['where'](_0xd515('0x7c'))[_0xd515('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd515('0x73')]()[_0xd515('0x74')](_0xd515('0x83'))[_0xd515('0x79')](_0xd515('0x6e'))[_0xd515('0x41')]('CampaignId\x20=\x20?',_0x3b43ad['params']['id'][_0xd515('0x77')]())))[_0xd515('0x77')]();break;default:_0x4fb7cc=squel[_0xd515('0x84')]()['into']('cm_hopper')['fromQuery']([_0xd515('0x70'),_0xd515('0x71'),_0xd515('0x72'),'ListId','CampaignId',_0xd515('0x57'),'updatedAt'],squel[_0xd515('0x73')]()[_0xd515('0x74')](_0xd515('0x70'),_0xd515('0x70'))[_0xd515('0x74')](_0xd515('0x75'),_0xd515('0x71'))[_0xd515('0x74')]('id',_0xd515('0x72'))[_0xd515('0x74')](_0x39733c[_0xd515('0x76')][_0xd515('0x77')](),_0xd515('0x78'))[_0xd515('0x74')](_0x3b43ad[_0xd515('0x4a')]['id'][_0xd515('0x77')](),_0xd515('0x5b'))[_0xd515('0x74')]('\x27'+_0x227cd9+'\x27',_0xd515('0x57'))['field']('\x27'+_0x227cd9+'\x27',_0xd515('0x58'))[_0xd515('0x79')]('cm_contacts')[_0xd515('0x41')](_0xd515('0x7a'))[_0xd515('0x41')](_0xd515('0x7b'),_0x39733c[_0xd515('0x76')][_0xd515('0x77')]())['where'](_0xd515('0x7c')))[_0xd515('0x77')]();}_0x1b2cd5=squel[_0xd515('0x84')]()[_0xd515('0x6d')](_0xd515('0x85'))[_0xd515('0x6f')]([_0xd515('0x86'),_0xd515('0x71'),_0xd515('0x70'),_0xd515('0x87'),_0xd515('0x57'),_0xd515('0x58')],squel[_0xd515('0x73')]()[_0xd515('0x74')](_0xd515('0x88'),'id')[_0xd515('0x74')](_0xd515('0x75'),_0xd515('0x71'))['field']('ci.item','phone')[_0xd515('0x74')](_0xd515('0x89'),_0xd515('0x87'))[_0xd515('0x74')]('\x27'+_0x227cd9+'\x27','createdAt')['field']('\x27'+_0x227cd9+'\x27','updatedAt')[_0xd515('0x79')](_0xd515('0x8a'),'ci')[_0xd515('0x8b')](_0xd515('0x6e'),'h',_0xd515('0x8c'))[_0xd515('0x41')](_0xd515('0x8d'),_0x39733c['CmListId']['toString']())[_0xd515('0x41')](_0xd515('0x8e'),_0x3b43ad[_0xd515('0x4a')]['id']['toString']())['where']('h.createdAt\x20=\x20?',_0x227cd9))[_0xd515('0x77')]();_0x31e053[_0xd515('0x8f')](db[_0xd515('0x90')]['query'](_0x4fb7cc));_0x40813d[_0xd515('0x8f')](db[_0xd515('0x90')]['query'](_0x1b2cd5));}return BPromise[_0xd515('0x91')](_0x31e053);}})[_0xd515('0x28')](function(){return BPromise['all'](_0x40813d);})[_0xd515('0x28')](function(){return _0x13a90c;})['then'](respondWithResult(_0x426f9b,null))[_0xd515('0x48')](handleError(_0x426f9b,null));};exports[_0xd515('0x92')]=function(_0x7132d2,_0x3bbed9,_0x4a9bbc){return db[_0xd515('0x4c')][_0xd515('0x52')]({'where':{'id':_0x7132d2[_0xd515('0x4a')]['id']}})[_0xd515('0x28')](handleEntityNotFound(_0x3bbed9,null))['then'](function(_0x341960){if(_0x341960){return _0x341960['removeLists'](_0x7132d2[_0xd515('0x36')][_0xd515('0x69')]);}})[_0xd515('0x28')](function(_0x274562){if(_0x274562){return db[_0xd515('0x5c')]['destroy']({'where':{'ListId':_0x7132d2['query']['ids'],'CampaignId':_0x7132d2[_0xd515('0x4a')]['id']}})[_0xd515('0x28')](function(){return _0x274562;});}})[_0xd515('0x28')](respondWithStatusCode(_0x3bbed9,null))[_0xd515('0x48')](handleError(_0x3bbed9,null));};exports[_0xd515('0x93')]=function(_0xb46293,_0x2c4b7e,_0x52b769){var _0x3976ec={};var _0x17cc01={};var _0x5f0668;var _0x4ec671;return db[_0xd515('0x4c')]['findOne']({'where':{'id':_0xb46293[_0xd515('0x4a')]['id']}})[_0xd515('0x28')](handleEntityNotFound(_0x2c4b7e,null))['then'](function(_0x379e0c){if(_0x379e0c){_0x5f0668=_0x379e0c;_0x17cc01[_0xd515('0x3a')]=_[_0xd515('0x37')](db['CmList']['rawAttributes']);_0x17cc01[_0xd515('0x36')]=_[_0xd515('0x37')](_0xb46293[_0xd515('0x36')]);_0x17cc01[_0xd515('0x38')]=_[_0xd515('0x39')](_0x17cc01[_0xd515('0x3a')],_0x17cc01['query']);_0x3976ec[_0xd515('0x3c')]=_[_0xd515('0x39')](_0x17cc01[_0xd515('0x3a')],qs['fields'](_0xb46293[_0xd515('0x36')][_0xd515('0x3b')]));_0x3976ec[_0xd515('0x3c')]=_0x3976ec[_0xd515('0x3c')]['length']?_0x3976ec['attributes']:_0x17cc01[_0xd515('0x3a')];_0x3976ec[_0xd515('0x3f')]=qs[_0xd515('0x40')](_0xb46293[_0xd515('0x36')][_0xd515('0x40')]);_0x3976ec[_0xd515('0x41')]=qs['filters'](_[_0xd515('0x5a')](_0xb46293['query'],_0x17cc01[_0xd515('0x38')]));if(_0xb46293[_0xd515('0x36')][_0xd515('0x42')]){_0x3976ec['where']=_[_0xd515('0x43')](_0x3976ec[_0xd515('0x41')],{'$or':_[_0xd515('0x35')](_0x3976ec[_0xd515('0x3c')],function(_0x129fa5){var _0x5b8425={};_0x5b8425[_0x129fa5]={'$like':'%'+_0xb46293[_0xd515('0x36')]['filter']+'%'};return _0x5b8425;})});}_0x3976ec=_[_0xd515('0x43')]({},_0x3976ec,_0xb46293['options']);return _0x5f0668[_0xd515('0x93')](_0x3976ec);}})['then'](function(_0x255477){if(_0x255477){_0x4ec671=_0x255477['length'];if(!_0xb46293[_0xd515('0x36')]['hasOwnProperty']('nolimit')){_0x3976ec[_0xd515('0x20')]=qs[_0xd515('0x20')](_0xb46293[_0xd515('0x36')][_0xd515('0x20')]);_0x3976ec[_0xd515('0x1e')]=qs[_0xd515('0x1e')](_0xb46293['query'][_0xd515('0x1e')]);}return _0x5f0668[_0xd515('0x93')](_0x3976ec);}})[_0xd515('0x28')](function(_0x30f242){if(_0x30f242){return _0x30f242?{'count':_0x4ec671,'rows':_0x30f242}:null;}})[_0xd515('0x28')](respondWithResult(_0x2c4b7e,null))['catch'](handleError(_0x2c4b7e,null));};exports[_0xd515('0x94')]=function(_0x1301c3,_0x149a8e,_0x5d3c71){var _0x30ca9e,_0x438617;var _0x387519=[];var _0x5cdc5b=moment()[_0xd515('0x67')](_0xd515('0x68'));return db['Campaign'][_0xd515('0x52')]({'where':{'id':_0x1301c3[_0xd515('0x4a')]['id']}})['then'](handleEntityNotFound(_0x149a8e,null))[_0xd515('0x28')](function(_0x2c9d45){if(_0x2c9d45){_0x438617=_0x2c9d45;return _0x2c9d45[_0xd515('0x94')](_0x1301c3[_0xd515('0x4e')][_0xd515('0x69')],_[_0xd515('0x56')](_0x1301c3[_0xd515('0x4e')],[_0xd515('0x69'),'id'])||{});}return null;})[_0xd515('0x6a')](function(_0x35e173){var _0x39e7ad;var _0x1253df;_0x30ca9e=_0x35e173||[];var _0x57b460=[];if(_0x35e173){for(var _0x213e23=0x0;_0x213e23<_0x35e173[_0xd515('0x4b')];_0x213e23+=0x1){var _0x529361=_0x35e173[_0x213e23][_0xd515('0x2a')]({'plain':!![]});_0x39e7ad=squel[_0xd515('0x84')]()[_0xd515('0x6d')]('cm_hopper_black')[_0xd515('0x6f')]([_0xd515('0x70'),'ContactId',_0xd515('0x78'),'CampaignId',_0xd515('0x57'),'updatedAt'],squel[_0xd515('0x73')]()[_0xd515('0x74')](_0xd515('0x70'),_0xd515('0x70'))[_0xd515('0x74')]('id','ContactId')[_0xd515('0x74')](_0x529361[_0xd515('0x76')][_0xd515('0x77')](),'ListId')['field'](_0x1301c3['params']['id'][_0xd515('0x77')](),_0xd515('0x5b'))[_0xd515('0x74')](_0xd515('0x75'),'createdAt')['field']('NOW()',_0xd515('0x58'))[_0xd515('0x79')]('cm_contacts')[_0xd515('0x41')](_0xd515('0x7a'))[_0xd515('0x41')]('ListId\x20=\x20?',_0x529361[_0xd515('0x76')][_0xd515('0x77')]())['where'](_0xd515('0x7c')))[_0xd515('0x77')]();_0x57b460[_0xd515('0x8f')](db[_0xd515('0x90')][_0xd515('0x36')](_0x39e7ad));}return BPromise['all'](_0x57b460);}})['then'](function(){return _0x30ca9e;})[_0xd515('0x28')](respondWithResult(_0x149a8e,null))['catch'](handleError(_0x149a8e,null));};exports[_0xd515('0x95')]=function(_0x2f2fb4,_0x2117e2,_0x2997e6){return db[_0xd515('0x4c')][_0xd515('0x52')]({'where':{'id':_0x2f2fb4[_0xd515('0x4a')]['id']}})[_0xd515('0x28')](handleEntityNotFound(_0x2117e2,null))[_0xd515('0x28')](function(_0x21d165){if(_0x21d165){return _0x21d165[_0xd515('0x95')](_0x2f2fb4['query'][_0xd515('0x69')]);}})['then'](function(_0x4d210a){if(_0x4d210a){return db[_0xd515('0x63')]['destroy']({'where':{'ListId':_0x2f2fb4['query']['ids'],'CampaignId':_0x2f2fb4[_0xd515('0x4a')]['id']}})['then'](function(){return _0x4d210a;});}})[_0xd515('0x28')](respondWithStatusCode(_0x2117e2,null))['catch'](handleError(_0x2117e2,null));}; \ No newline at end of file +var _0xd403=['onlyIfOpen','insert','cm_contacts','CampaignId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','h.id','ci.OrderBY','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','IvrCampaigns','UserProfileResource','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','Campaign','find','create','body','user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','omit','role','UserProfileSection','getHoppers','findOne','CmHopper','pick','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','NOW()','field','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','from','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)'];(function(_0x320fec,_0x49c104){var _0x158c82=function(_0x2f4668){while(--_0x2f4668){_0x320fec['push'](_0x320fec['shift']());}};_0x158c82(++_0x49c104);}(_0xd403,0x1d5));var _0x3d40=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xd403[_0xaa0309];return _0x5de7ce;};'use strict';var emlformat=require(_0x3d40('0x0'));var rimraf=require(_0x3d40('0x1'));var zipdir=require(_0x3d40('0x2'));var jsonpatch=require(_0x3d40('0x3'));var rp=require('request-promise');var moment=require(_0x3d40('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3d40('0x5'));var util=require(_0x3d40('0x6'));var path=require(_0x3d40('0x7'));var sox=require(_0x3d40('0x8'));var csv=require(_0x3d40('0x9'));var ejs=require(_0x3d40('0xa'));var fs=require('fs');var fs_extra=require(_0x3d40('0xb'));var _=require(_0x3d40('0xc'));var squel=require(_0x3d40('0xd'));var crypto=require(_0x3d40('0xe'));var jsforce=require(_0x3d40('0xf'));var deskjs=require(_0x3d40('0x10'));var toCsv=require(_0x3d40('0x9'));var querystring=require(_0x3d40('0x11'));var Papa=require(_0x3d40('0x12'));var Redis=require(_0x3d40('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3d40('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d40('0x15'));var logger=require(_0x3d40('0x16'))(_0x3d40('0x17'));var utils=require('../../config/utils');var config=require(_0x3d40('0x18'));var licenseUtil=require(_0x3d40('0x19'));var db=require(_0x3d40('0x1a'))['db'];function respondWithStatusCode(_0x49ea7c,_0x31c199){_0x31c199=_0x31c199||0xcc;return function(_0x405625){if(_0x405625){return _0x49ea7c['sendStatus'](_0x31c199);}return _0x49ea7c['status'](_0x31c199)[_0x3d40('0x1b')]();};}function respondWithResult(_0x24d2c0,_0x3e6d19){_0x3e6d19=_0x3e6d19||0xc8;return function(_0x5062ec){if(_0x5062ec){return _0x24d2c0[_0x3d40('0x1c')](_0x3e6d19)[_0x3d40('0x1d')](_0x5062ec);}};}function respondWithFilteredResult(_0x311d57,_0x3e6e71){return function(_0x2b5e2d){if(_0x2b5e2d){var _0x359e9d=typeof _0x3e6e71[_0x3d40('0x1e')]==='undefined'&&typeof _0x3e6e71['limit']===_0x3d40('0x1f');var _0x2f38e1=_0x2b5e2d[_0x3d40('0x20')];var _0x75437e=_0x359e9d?0x0:_0x3e6e71[_0x3d40('0x1e')];var _0x2f3663=_0x359e9d?_0x2b5e2d[_0x3d40('0x20')]:_0x3e6e71[_0x3d40('0x1e')]+_0x3e6e71[_0x3d40('0x21')];var _0x402b4e;if(_0x2f3663>=_0x2f38e1){_0x2f3663=_0x2f38e1;_0x402b4e=0xc8;}else{_0x402b4e=0xce;}_0x311d57[_0x3d40('0x1c')](_0x402b4e);return _0x311d57['set']('Content-Range',_0x75437e+'-'+_0x2f3663+'/'+_0x2f38e1)[_0x3d40('0x1d')](_0x2b5e2d);}return null;};}function patchUpdates(_0x41608f){return function(_0x2fc0e2){try{jsonpatch[_0x3d40('0x22')](_0x2fc0e2,_0x41608f,!![]);}catch(_0x28b1c0){return BPromise[_0x3d40('0x23')](_0x28b1c0);}return _0x2fc0e2[_0x3d40('0x24')]();};}function saveUpdates(_0xbd7298,_0x3df1f9){return function(_0x321bc2){if(_0x321bc2){return _0x321bc2[_0x3d40('0x25')](_0xbd7298)[_0x3d40('0x26')](function(_0x181688){return _0x181688;});}return null;};}function removeEntity(_0x5314c5,_0x1a2d0f){return function(_0x14cad3){if(_0x14cad3){return _0x14cad3[_0x3d40('0x27')]()[_0x3d40('0x26')](function(){var _0x645da4=_0x14cad3['get']({'plain':!![]});var _0x45aa46=_0x3d40('0x28');return db[_0x3d40('0x29')][_0x3d40('0x27')]({'where':{'type':_0x45aa46,'resourceId':_0x645da4['id']}})[_0x3d40('0x26')](function(){return _0x14cad3;});})['then'](function(){_0x5314c5[_0x3d40('0x1c')](0xcc)[_0x3d40('0x1b')]();});}};}function handleEntityNotFound(_0x4e4ee9,_0x412d46){return function(_0x1f94ac){if(!_0x1f94ac){_0x4e4ee9[_0x3d40('0x2a')](0x194);}return _0x1f94ac;};}function handleError(_0x537790,_0x38ff70){_0x38ff70=_0x38ff70||0x1f4;return function(_0x265c2c){logger[_0x3d40('0x2b')](_0x265c2c[_0x3d40('0x2c')]);if(_0x265c2c[_0x3d40('0x2d')]){delete _0x265c2c[_0x3d40('0x2d')];}_0x537790[_0x3d40('0x1c')](_0x38ff70)[_0x3d40('0x2e')](_0x265c2c);};}exports['index']=function(_0x4e536f,_0x394fab){var _0xcb3c3b={},_0x5071b9={},_0x2c1ce6={'count':0x0,'rows':[]};var _0x4f235f=_[_0x3d40('0x2f')](db['Campaign'][_0x3d40('0x30')],function(_0xbff1f2){return{'name':_0xbff1f2[_0x3d40('0x31')],'type':_0xbff1f2[_0x3d40('0x32')][_0x3d40('0x33')]};});_0x5071b9['model']=_['map'](_0x4f235f,_0x3d40('0x2d'));_0x5071b9[_0x3d40('0x34')]=_[_0x3d40('0x35')](_0x4e536f['query']);_0x5071b9[_0x3d40('0x36')]=_['intersection'](_0x5071b9['model'],_0x5071b9['query']);_0xcb3c3b[_0x3d40('0x37')]=_[_0x3d40('0x38')](_0x5071b9[_0x3d40('0x39')],qs[_0x3d40('0x3a')](_0x4e536f[_0x3d40('0x34')][_0x3d40('0x3a')]));_0xcb3c3b[_0x3d40('0x37')]=_0xcb3c3b[_0x3d40('0x37')][_0x3d40('0x3b')]?_0xcb3c3b['attributes']:_0x5071b9['model'];if(!_0x4e536f[_0x3d40('0x34')][_0x3d40('0x3c')](_0x3d40('0x3d'))){_0xcb3c3b[_0x3d40('0x21')]=qs[_0x3d40('0x21')](_0x4e536f[_0x3d40('0x34')]['limit']);_0xcb3c3b[_0x3d40('0x1e')]=qs[_0x3d40('0x1e')](_0x4e536f[_0x3d40('0x34')]['offset']);}_0xcb3c3b[_0x3d40('0x3e')]=qs['sort'](_0x4e536f[_0x3d40('0x34')][_0x3d40('0x3f')]);_0xcb3c3b['where']=qs[_0x3d40('0x36')](_['pick'](_0x4e536f['query'],_0x5071b9[_0x3d40('0x36')]),_0x4f235f);if(_0x4e536f[_0x3d40('0x34')]['filter']){_0xcb3c3b[_0x3d40('0x40')]=_[_0x3d40('0x41')](_0xcb3c3b[_0x3d40('0x40')],{'$or':_['map'](_0x4f235f,function(_0x295418){if(_0x295418[_0x3d40('0x32')]!==_0x3d40('0x42')){var _0x2c45c5={};_0x2c45c5[_0x295418[_0x3d40('0x2d')]]={'$like':'%'+_0x4e536f[_0x3d40('0x34')][_0x3d40('0x43')]+'%'};return _0x2c45c5;}})});}_0xcb3c3b=_[_0x3d40('0x41')]({},_0xcb3c3b,_0x4e536f[_0x3d40('0x44')]);var _0x322030={'where':_0xcb3c3b[_0x3d40('0x40')]};return db['Campaign'][_0x3d40('0x20')](_0x322030)['then'](function(_0x575268){_0x2c1ce6['count']=_0x575268;if(_0x4e536f[_0x3d40('0x34')][_0x3d40('0x45')]){_0xcb3c3b[_0x3d40('0x46')]=[{'all':!![]}];}return db['Campaign'][_0x3d40('0x47')](_0xcb3c3b);})[_0x3d40('0x26')](function(_0x46e59d){_0x2c1ce6[_0x3d40('0x48')]=_0x46e59d;return _0x2c1ce6;})['then'](respondWithFilteredResult(_0x394fab,_0xcb3c3b))[_0x3d40('0x49')](handleError(_0x394fab,null));};exports[_0x3d40('0x4a')]=function(_0x17becc,_0x1be4a9){var _0xdde7e4={'raw':![],'where':{'id':_0x17becc[_0x3d40('0x4b')]['id']}},_0x4387f5={};_0x4387f5[_0x3d40('0x39')]=_[_0x3d40('0x35')](db[_0x3d40('0x4c')]['rawAttributes']);_0x4387f5['query']=_[_0x3d40('0x35')](_0x17becc[_0x3d40('0x34')]);_0x4387f5[_0x3d40('0x36')]=_[_0x3d40('0x38')](_0x4387f5[_0x3d40('0x39')],_0x4387f5[_0x3d40('0x34')]);_0xdde7e4[_0x3d40('0x37')]=_[_0x3d40('0x38')](_0x4387f5[_0x3d40('0x39')],qs['fields'](_0x17becc['query'][_0x3d40('0x3a')]));_0xdde7e4[_0x3d40('0x37')]=_0xdde7e4[_0x3d40('0x37')][_0x3d40('0x3b')]?_0xdde7e4[_0x3d40('0x37')]:_0x4387f5['model'];if(_0x17becc[_0x3d40('0x34')][_0x3d40('0x45')]){_0xdde7e4['include']=[{'all':!![]}];}_0xdde7e4=_['merge']({},_0xdde7e4,_0x17becc['options']);return db[_0x3d40('0x4c')][_0x3d40('0x4d')](_0xdde7e4)[_0x3d40('0x26')](handleEntityNotFound(_0x1be4a9,null))['then'](respondWithResult(_0x1be4a9,null))[_0x3d40('0x49')](handleError(_0x1be4a9,null));};exports['create']=function(_0x580eee,_0xa3ba73){return db[_0x3d40('0x4c')][_0x3d40('0x4e')](_0x580eee[_0x3d40('0x4f')],{})['then'](function(_0xb99156){var _0x5d957d=_0x580eee[_0x3d40('0x50')][_0x3d40('0x51')]({'plain':!![]});if(!_0x5d957d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d957d['role']===_0x3d40('0x50')){var _0x1448c4=_0xb99156[_0x3d40('0x51')]({'plain':!![]});var _0x23eadf=_0x3d40('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x23eadf,'userProfileId':_0x5d957d[_0x3d40('0x52')]},'raw':!![]})[_0x3d40('0x26')](function(_0x333538){if(_0x333538&&_0x333538[_0x3d40('0x53')]===0x0){return db[_0x3d40('0x29')][_0x3d40('0x4e')]({'name':_0x1448c4['name'],'resourceId':_0x1448c4['id'],'type':_0x333538[_0x3d40('0x2d')],'sectionId':_0x333538['id']},{})[_0x3d40('0x26')](function(){return _0xb99156;});}else{return _0xb99156;}})[_0x3d40('0x49')](function(_0x10223d){logger[_0x3d40('0x2b')](_0x3d40('0x54'),_0x10223d);throw _0x10223d;});}return _0xb99156;})[_0x3d40('0x26')](respondWithResult(_0xa3ba73,0xc9))[_0x3d40('0x49')](handleError(_0xa3ba73,null));};exports[_0x3d40('0x55')]=function(_0x189e80,_0x40eb86){var _0x1ab188={'where':{'id':_0x189e80[_0x3d40('0x4b')]['id']}},_0x427f2a={};_0x427f2a['model']=_['keys'](db['Campaign']['rawAttributes']);_0x1ab188['attributes']=_[_0x3d40('0x38')](_0x427f2a['model'],qs[_0x3d40('0x3a')](_0x189e80[_0x3d40('0x34')]['fields']));_0x1ab188[_0x3d40('0x37')]=_0x1ab188[_0x3d40('0x37')]['length']?_0x1ab188[_0x3d40('0x37')]:_0x427f2a[_0x3d40('0x39')];if(_0x189e80[_0x3d40('0x34')]['includeAll']){_0x1ab188[_0x3d40('0x46')]=[{'all':!![]}];}_0x1ab188=_['merge']({},_0x1ab188,_0x189e80[_0x3d40('0x44')]);return db['Campaign']['find'](_0x1ab188)['then'](handleEntityNotFound(_0x40eb86,null))[_0x3d40('0x26')](function(_0x18626d){if(_0x18626d){var _0x5ad181=_0x18626d[_0x3d40('0x51')]({'plain':!![]});_0x5ad181=qs['omit'](_0x5ad181,['id','createdAt',_0x3d40('0x56')]);_0x189e80['body']=_[_0x3d40('0x57')](_0x189e80['body'],['id','createdAt',_0x3d40('0x56')]);return db['Campaign'][_0x3d40('0x4e')](_[_0x3d40('0x41')](_0x5ad181,_0x189e80[_0x3d40('0x4f')]),{'include':_0x189e80[_0x3d40('0x34')][_0x3d40('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x358999){var _0x1d6445=_0x189e80[_0x3d40('0x50')][_0x3d40('0x51')]({'plain':!![]});if(!_0x1d6445)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d6445[_0x3d40('0x58')]===_0x3d40('0x50')){var _0x4600a2=_0x358999['get']({'plain':!![]});var _0x44d093=_0x3d40('0x28');return db[_0x3d40('0x59')][_0x3d40('0x4d')]({'where':{'name':_0x44d093,'userProfileId':_0x1d6445[_0x3d40('0x52')]},'raw':!![]})['then'](function(_0x850ccc){if(_0x850ccc&&_0x850ccc[_0x3d40('0x53')]===0x0){return db[_0x3d40('0x29')][_0x3d40('0x4e')]({'name':_0x4600a2[_0x3d40('0x2d')],'resourceId':_0x4600a2['id'],'type':_0x850ccc[_0x3d40('0x2d')],'sectionId':_0x850ccc['id']},{})[_0x3d40('0x26')](function(){return _0x358999;});}else{return _0x358999;}})['catch'](function(_0x5d14f8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d14f8);throw _0x5d14f8;});}return _0x358999;});}})[_0x3d40('0x26')](respondWithResult(_0x40eb86,0xc9))['catch'](handleError(_0x40eb86,null));};exports[_0x3d40('0x25')]=function(_0x471d78,_0x19f033){if(_0x471d78[_0x3d40('0x4f')]['id']){delete _0x471d78[_0x3d40('0x4f')]['id'];}return db[_0x3d40('0x4c')][_0x3d40('0x4d')]({'where':{'id':_0x471d78[_0x3d40('0x4b')]['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x19f033,null))['then'](saveUpdates(_0x471d78[_0x3d40('0x4f')],null))[_0x3d40('0x26')](respondWithResult(_0x19f033,null))[_0x3d40('0x49')](handleError(_0x19f033,null));};exports[_0x3d40('0x27')]=function(_0x46ef8e,_0x25637f){return db[_0x3d40('0x4c')][_0x3d40('0x4d')]({'where':{'id':_0x46ef8e[_0x3d40('0x4b')]['id']}})['then'](handleEntityNotFound(_0x25637f,null))[_0x3d40('0x26')](removeEntity(_0x25637f,null))[_0x3d40('0x49')](handleError(_0x25637f,null));};exports[_0x3d40('0x5a')]=function(_0x11fc54,_0x2cfc63,_0x213ea9){var _0x4dc423={'raw':!![],'where':{}};var _0x4409a2={};var _0x5cea69={'count':0x0,'rows':[]};return db[_0x3d40('0x4c')][_0x3d40('0x5b')]({'where':{'id':_0x11fc54['params']['id']}})['then'](handleEntityNotFound(_0x2cfc63,null))[_0x3d40('0x26')](function(_0xa531d1){if(_0xa531d1){_0x4409a2[_0x3d40('0x39')]=_['keys'](db[_0x3d40('0x5c')][_0x3d40('0x30')]);_0x4409a2[_0x3d40('0x34')]=_['keys'](_0x11fc54[_0x3d40('0x34')]);_0x4409a2['filters']=_[_0x3d40('0x38')](_0x4409a2[_0x3d40('0x39')],_0x4409a2[_0x3d40('0x34')]);_0x4dc423[_0x3d40('0x37')]=_[_0x3d40('0x38')](_0x4409a2['model'],qs[_0x3d40('0x3a')](_0x11fc54['query']['fields']));_0x4dc423[_0x3d40('0x37')]=_0x4dc423['attributes'][_0x3d40('0x3b')]?_0x4dc423[_0x3d40('0x37')]:_0x4409a2[_0x3d40('0x39')];if(!_0x11fc54['query']['hasOwnProperty'](_0x3d40('0x3d'))){_0x4dc423[_0x3d40('0x21')]=qs['limit'](_0x11fc54['query'][_0x3d40('0x21')]);_0x4dc423['offset']=qs[_0x3d40('0x1e')](_0x11fc54[_0x3d40('0x34')][_0x3d40('0x1e')]);}_0x4dc423['order']=qs[_0x3d40('0x3f')](_0x11fc54[_0x3d40('0x34')][_0x3d40('0x3f')]);_0x4dc423[_0x3d40('0x40')]=qs[_0x3d40('0x36')](_[_0x3d40('0x5d')](_0x11fc54[_0x3d40('0x34')],_0x4409a2['filters']));_0x4dc423[_0x3d40('0x40')]['CampaignId']=_0xa531d1['id'];if(_0x11fc54[_0x3d40('0x34')][_0x3d40('0x43')]){_0x4dc423[_0x3d40('0x40')]=_[_0x3d40('0x41')](_0x4dc423[_0x3d40('0x40')],{'$or':_['map'](_0x4dc423[_0x3d40('0x37')],function(_0x183b7d){var _0x5416f3={};_0x5416f3[_0x183b7d]={'$like':'%'+_0x11fc54[_0x3d40('0x34')]['filter']+'%'};return _0x5416f3;})});}_0x4dc423=_[_0x3d40('0x41')]({},_0x4dc423,_0x11fc54[_0x3d40('0x44')]);return db[_0x3d40('0x5c')][_0x3d40('0x20')]({'where':_0x4dc423[_0x3d40('0x40')]})[_0x3d40('0x26')](function(_0x15e576){_0x5cea69['count']=_0x15e576;if(_0x11fc54[_0x3d40('0x34')][_0x3d40('0x45')]){_0x4dc423[_0x3d40('0x46')]=[{'all':!![]}];}return db[_0x3d40('0x5c')]['findAll'](_0x4dc423);})[_0x3d40('0x26')](function(_0x1e84f0){_0x5cea69[_0x3d40('0x48')]=_0x1e84f0;return _0x5cea69;});}})['then'](respondWithFilteredResult(_0x2cfc63,_0x4dc423))[_0x3d40('0x49')](handleError(_0x2cfc63,null));};exports['getHopperHistories']=function(_0x8883b2,_0x4647e5,_0x5bdbd8){var _0x317dcf={'raw':!![],'where':{}};var _0x568ba9={};var _0x229865={'count':0x0,'rows':[]};return db[_0x3d40('0x4c')][_0x3d40('0x5b')]({'where':{'id':_0x8883b2[_0x3d40('0x4b')]['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x4647e5,null))[_0x3d40('0x26')](function(_0x2916f9){if(_0x2916f9){_0x568ba9[_0x3d40('0x39')]=_[_0x3d40('0x35')](db['CmHopperHistory'][_0x3d40('0x30')]);_0x568ba9['query']=_[_0x3d40('0x35')](_0x8883b2[_0x3d40('0x34')]);_0x568ba9['filters']=_[_0x3d40('0x38')](_0x568ba9[_0x3d40('0x39')],_0x568ba9[_0x3d40('0x34')]);_0x317dcf['attributes']=_[_0x3d40('0x38')](_0x568ba9['model'],qs[_0x3d40('0x3a')](_0x8883b2[_0x3d40('0x34')][_0x3d40('0x3a')]));_0x317dcf[_0x3d40('0x37')]=_0x317dcf[_0x3d40('0x37')][_0x3d40('0x3b')]?_0x317dcf[_0x3d40('0x37')]:_0x568ba9[_0x3d40('0x39')];if(!_0x8883b2[_0x3d40('0x34')]['hasOwnProperty'](_0x3d40('0x3d'))){_0x317dcf[_0x3d40('0x21')]=qs[_0x3d40('0x21')](_0x8883b2[_0x3d40('0x34')][_0x3d40('0x21')]);_0x317dcf[_0x3d40('0x1e')]=qs[_0x3d40('0x1e')](_0x8883b2[_0x3d40('0x34')][_0x3d40('0x1e')]);}_0x317dcf[_0x3d40('0x3e')]=qs[_0x3d40('0x3f')](_0x8883b2['query'][_0x3d40('0x3f')]);_0x317dcf[_0x3d40('0x40')]=qs['filters'](_[_0x3d40('0x5d')](_0x8883b2[_0x3d40('0x34')],_0x568ba9['filters']));_0x317dcf['where'][_0x3d40('0x5e')]=_0x2916f9['id'];if(_0x8883b2[_0x3d40('0x34')][_0x3d40('0x43')]){_0x317dcf[_0x3d40('0x40')]=_[_0x3d40('0x41')](_0x317dcf[_0x3d40('0x40')],{'$or':_['map'](_0x317dcf[_0x3d40('0x37')],function(_0x97a8f2){var _0x1aca85={};_0x1aca85[_0x97a8f2]={'$like':'%'+_0x8883b2[_0x3d40('0x34')][_0x3d40('0x43')]+'%'};return _0x1aca85;})});}_0x317dcf=_[_0x3d40('0x41')]({},_0x317dcf,_0x8883b2[_0x3d40('0x44')]);return db['CmHopperHistory']['count']({'where':_0x317dcf[_0x3d40('0x40')]})['then'](function(_0x1c0932){_0x229865['count']=_0x1c0932;if(_0x8883b2[_0x3d40('0x34')][_0x3d40('0x45')]){_0x317dcf[_0x3d40('0x46')]=[{'all':!![]}];}return db[_0x3d40('0x5f')][_0x3d40('0x47')](_0x317dcf);})[_0x3d40('0x26')](function(_0x496311){_0x229865[_0x3d40('0x48')]=_0x496311;return _0x229865;});}})['then'](respondWithFilteredResult(_0x4647e5,_0x317dcf))['catch'](handleError(_0x4647e5,null));};exports[_0x3d40('0x60')]=function(_0x3d8be8,_0x37ccdd,_0x44578d){var _0x49e8fe={'raw':!![],'where':{}};var _0x2fbfb5={};var _0x3cbdcf={'count':0x0,'rows':[]};return db['Campaign'][_0x3d40('0x5b')]({'where':{'id':_0x3d8be8[_0x3d40('0x4b')]['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x37ccdd,null))[_0x3d40('0x26')](function(_0x162945){if(_0x162945){_0x2fbfb5['model']=_['keys'](db[_0x3d40('0x61')][_0x3d40('0x30')]);_0x2fbfb5['query']=_[_0x3d40('0x35')](_0x3d8be8['query']);_0x2fbfb5[_0x3d40('0x36')]=_['intersection'](_0x2fbfb5['model'],_0x2fbfb5['query']);_0x49e8fe[_0x3d40('0x37')]=_['intersection'](_0x2fbfb5[_0x3d40('0x39')],qs[_0x3d40('0x3a')](_0x3d8be8[_0x3d40('0x34')][_0x3d40('0x3a')]));_0x49e8fe[_0x3d40('0x37')]=_0x49e8fe[_0x3d40('0x37')][_0x3d40('0x3b')]?_0x49e8fe['attributes']:_0x2fbfb5[_0x3d40('0x39')];if(!_0x3d8be8[_0x3d40('0x34')][_0x3d40('0x3c')](_0x3d40('0x3d'))){_0x49e8fe[_0x3d40('0x21')]=qs[_0x3d40('0x21')](_0x3d8be8[_0x3d40('0x34')]['limit']);_0x49e8fe['offset']=qs[_0x3d40('0x1e')](_0x3d8be8[_0x3d40('0x34')][_0x3d40('0x1e')]);}_0x49e8fe[_0x3d40('0x3e')]=qs[_0x3d40('0x3f')](_0x3d8be8['query'][_0x3d40('0x3f')]);_0x49e8fe[_0x3d40('0x40')]=qs[_0x3d40('0x36')](_[_0x3d40('0x5d')](_0x3d8be8[_0x3d40('0x34')],_0x2fbfb5[_0x3d40('0x36')]));_0x49e8fe[_0x3d40('0x40')]['CampaignId']=_0x162945['id'];if(_0x3d8be8['query'][_0x3d40('0x43')]){_0x49e8fe[_0x3d40('0x40')]=_[_0x3d40('0x41')](_0x49e8fe[_0x3d40('0x40')],{'$or':_['map'](_0x49e8fe[_0x3d40('0x37')],function(_0x385429){var _0x362bec={};_0x362bec[_0x385429]={'$like':'%'+_0x3d8be8[_0x3d40('0x34')]['filter']+'%'};return _0x362bec;})});}_0x49e8fe=_[_0x3d40('0x41')]({},_0x49e8fe,_0x3d8be8['options']);return db[_0x3d40('0x61')][_0x3d40('0x20')]({'where':_0x49e8fe[_0x3d40('0x40')]})['then'](function(_0x49a656){_0x3cbdcf[_0x3d40('0x20')]=_0x49a656;if(_0x3d8be8['query'][_0x3d40('0x45')]){_0x49e8fe['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x3d40('0x47')](_0x49e8fe);})[_0x3d40('0x26')](function(_0x51917c){_0x3cbdcf[_0x3d40('0x48')]=_0x51917c;return _0x3cbdcf;});}})[_0x3d40('0x26')](respondWithFilteredResult(_0x37ccdd,_0x49e8fe))[_0x3d40('0x49')](handleError(_0x37ccdd,null));};exports[_0x3d40('0x62')]=function(_0x5512f4,_0x1495ae,_0x281525){var _0x42ca13={'raw':!![],'where':{}};var _0x4b0adb={};var _0x3345bc={'count':0x0,'rows':[]};return db[_0x3d40('0x4c')]['findOne']({'where':{'id':_0x5512f4[_0x3d40('0x4b')]['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x1495ae,null))[_0x3d40('0x26')](function(_0x382776){if(_0x382776){_0x4b0adb[_0x3d40('0x39')]=_[_0x3d40('0x35')](db['CmHopperBlack'][_0x3d40('0x30')]);_0x4b0adb[_0x3d40('0x34')]=_[_0x3d40('0x35')](_0x5512f4[_0x3d40('0x34')]);_0x4b0adb[_0x3d40('0x36')]=_[_0x3d40('0x38')](_0x4b0adb['model'],_0x4b0adb['query']);_0x42ca13[_0x3d40('0x37')]=_[_0x3d40('0x38')](_0x4b0adb['model'],qs['fields'](_0x5512f4['query'][_0x3d40('0x3a')]));_0x42ca13[_0x3d40('0x37')]=_0x42ca13[_0x3d40('0x37')]['length']?_0x42ca13[_0x3d40('0x37')]:_0x4b0adb['model'];if(!_0x5512f4[_0x3d40('0x34')][_0x3d40('0x3c')](_0x3d40('0x3d'))){_0x42ca13[_0x3d40('0x21')]=qs[_0x3d40('0x21')](_0x5512f4[_0x3d40('0x34')][_0x3d40('0x21')]);_0x42ca13['offset']=qs[_0x3d40('0x1e')](_0x5512f4[_0x3d40('0x34')][_0x3d40('0x1e')]);}_0x42ca13[_0x3d40('0x3e')]=qs[_0x3d40('0x3f')](_0x5512f4[_0x3d40('0x34')]['sort']);_0x42ca13[_0x3d40('0x40')]=qs[_0x3d40('0x36')](_['pick'](_0x5512f4[_0x3d40('0x34')],_0x4b0adb[_0x3d40('0x36')]));_0x42ca13['where'][_0x3d40('0x5e')]=_0x382776['id'];if(_0x5512f4['query'][_0x3d40('0x43')]){_0x42ca13[_0x3d40('0x40')]=_['merge'](_0x42ca13[_0x3d40('0x40')],{'$or':_[_0x3d40('0x2f')](_0x42ca13['attributes'],function(_0x3bd591){var _0x16f64d={};_0x16f64d[_0x3bd591]={'$like':'%'+_0x5512f4[_0x3d40('0x34')][_0x3d40('0x43')]+'%'};return _0x16f64d;})});}_0x42ca13=_['merge']({},_0x42ca13,_0x5512f4['options']);return db[_0x3d40('0x63')][_0x3d40('0x20')]({'where':_0x42ca13[_0x3d40('0x40')]})['then'](function(_0x2ffed4){_0x3345bc['count']=_0x2ffed4;if(_0x5512f4['query'][_0x3d40('0x45')]){_0x42ca13[_0x3d40('0x46')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x3d40('0x47')](_0x42ca13);})[_0x3d40('0x26')](function(_0x3773e9){_0x3345bc[_0x3d40('0x48')]=_0x3773e9;return _0x3345bc;});}})[_0x3d40('0x26')](respondWithFilteredResult(_0x1495ae,_0x42ca13))[_0x3d40('0x49')](handleError(_0x1495ae,null));};exports[_0x3d40('0x64')]=function(_0x230d49,_0x43d62d,_0xd243c4){var _0x334633={};var _0x4abce8={};var _0x3773e5;var _0x37a6bf;return db[_0x3d40('0x4c')][_0x3d40('0x5b')]({'where':{'id':_0x230d49[_0x3d40('0x4b')]['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x43d62d,null))['then'](function(_0x37bacc){if(_0x37bacc){_0x3773e5=_0x37bacc;_0x4abce8[_0x3d40('0x39')]=_[_0x3d40('0x35')](db['CmList']['rawAttributes']);_0x4abce8[_0x3d40('0x34')]=_[_0x3d40('0x35')](_0x230d49['query']);_0x4abce8[_0x3d40('0x36')]=_[_0x3d40('0x38')](_0x4abce8['model'],_0x4abce8['query']);_0x334633[_0x3d40('0x37')]=_[_0x3d40('0x38')](_0x4abce8['model'],qs['fields'](_0x230d49[_0x3d40('0x34')][_0x3d40('0x3a')]));_0x334633['attributes']=_0x334633['attributes'][_0x3d40('0x3b')]?_0x334633['attributes']:_0x4abce8[_0x3d40('0x39')];_0x334633['order']=qs[_0x3d40('0x3f')](_0x230d49[_0x3d40('0x34')][_0x3d40('0x3f')]);_0x334633['where']=qs[_0x3d40('0x36')](_[_0x3d40('0x5d')](_0x230d49[_0x3d40('0x34')],_0x4abce8[_0x3d40('0x36')]));if(_0x230d49[_0x3d40('0x34')][_0x3d40('0x43')]){_0x334633[_0x3d40('0x40')]=_[_0x3d40('0x41')](_0x334633[_0x3d40('0x40')],{'$or':_['map'](_0x334633[_0x3d40('0x37')],function(_0xc92421){var _0x58f6a7={};_0x58f6a7[_0xc92421]={'$like':'%'+_0x230d49[_0x3d40('0x34')]['filter']+'%'};return _0x58f6a7;})});}_0x334633=_[_0x3d40('0x41')]({},_0x334633,_0x230d49[_0x3d40('0x44')]);return _0x3773e5[_0x3d40('0x64')](_0x334633);}})[_0x3d40('0x26')](function(_0x5b0f25){if(_0x5b0f25){_0x37a6bf=_0x5b0f25[_0x3d40('0x3b')];if(!_0x230d49['query'][_0x3d40('0x3c')](_0x3d40('0x3d'))){_0x334633[_0x3d40('0x21')]=qs[_0x3d40('0x21')](_0x230d49[_0x3d40('0x34')][_0x3d40('0x21')]);_0x334633[_0x3d40('0x1e')]=qs[_0x3d40('0x1e')](_0x230d49[_0x3d40('0x34')][_0x3d40('0x1e')]);}return _0x3773e5['getLists'](_0x334633);}})[_0x3d40('0x26')](function(_0x5d4a70){if(_0x5d4a70){return _0x5d4a70?{'count':_0x37a6bf,'rows':_0x5d4a70}:null;}})[_0x3d40('0x26')](respondWithResult(_0x43d62d,null))[_0x3d40('0x49')](handleError(_0x43d62d,null));};exports[_0x3d40('0x65')]=function(_0xf3c644,_0x26309d,_0x1d8f41){var _0x39bf67,_0x43e18e;var _0x1d5a17=[];var _0x836dc7=moment()['format'](_0x3d40('0x66'));return db[_0x3d40('0x4c')][_0x3d40('0x4d')]({'where':{'id':_0xf3c644[_0x3d40('0x4b')]['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x26309d,null))[_0x3d40('0x26')](function(_0x41d3ca){if(_0x41d3ca){_0x43e18e=_0x41d3ca;return _0x41d3ca['addLists'](_0xf3c644[_0x3d40('0x4f')]['ids'],_[_0x3d40('0x57')](_0xf3c644['body'],[_0x3d40('0x67'),'id'])||{});}return null;})[_0x3d40('0x68')](function(_0x1b80d6){var _0x275a02;var _0x49848e;_0x39bf67=_0x1b80d6||[];var _0x3eda3d=[];if(_0x1b80d6){for(var _0x2a8851=0x0;_0x2a8851<_0x1b80d6['length'];_0x2a8851+=0x1){var _0x11f1bd=_0x1b80d6[_0x2a8851][_0x3d40('0x51')]({'plain':!![]});_0x43e18e[_0x3d40('0x69')]=_0xf3c644[_0x3d40('0x4f')][_0x3d40('0x69')]?_0xf3c644['body']['dialCheckDuplicateType']:_0x43e18e[_0x3d40('0x69')];switch(_0x43e18e['dialCheckDuplicateType']){case _0x3d40('0x6a'):_0x275a02=squel['insert']()[_0x3d40('0x6b')](_0x3d40('0x6c'))[_0x3d40('0x6d')]([_0x3d40('0x6e'),_0x3d40('0x6f'),_0x3d40('0x70'),_0x3d40('0x71'),_0x3d40('0x5e'),_0x3d40('0x72'),_0x3d40('0x56')],squel['select']()['field'](_0x3d40('0x6e'),'phone')['field'](_0x3d40('0x73'),'scheduledAt')[_0x3d40('0x74')]('id',_0x3d40('0x70'))[_0x3d40('0x74')](_0x11f1bd['CmListId'][_0x3d40('0x75')](),_0x3d40('0x71'))[_0x3d40('0x74')](_0xf3c644[_0x3d40('0x4b')]['id'][_0x3d40('0x75')](),_0x3d40('0x5e'))[_0x3d40('0x74')]('\x27'+_0x836dc7+'\x27',_0x3d40('0x72'))['field']('\x27'+_0x836dc7+'\x27',_0x3d40('0x56'))['from']('cm_contacts')[_0x3d40('0x40')](_0x3d40('0x76'))[_0x3d40('0x40')](_0x3d40('0x77'),_0x11f1bd[_0x3d40('0x78')]['toString']())[_0x3d40('0x40')](_0x3d40('0x79'))[_0x3d40('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3d40('0x7a')]()[_0x3d40('0x74')](_0x3d40('0x7b'))[_0x3d40('0x7c')]('cm_hopper_final')[_0x3d40('0x40')]('CampaignId\x20=\x20?',_0xf3c644[_0x3d40('0x4b')]['id'][_0x3d40('0x75')]()))[_0x3d40('0x40')](_0x3d40('0x7d'),squel[_0x3d40('0x7a')]()[_0x3d40('0x74')](_0x3d40('0x7e'))[_0x3d40('0x7c')](_0x3d40('0x6c'))[_0x3d40('0x40')]('CampaignId\x20=\x20?',_0xf3c644[_0x3d40('0x4b')]['id'][_0x3d40('0x75')]())))['toString']();break;case _0x3d40('0x7f'):_0x275a02=squel[_0x3d40('0x80')]()[_0x3d40('0x6b')](_0x3d40('0x6c'))['fromQuery']([_0x3d40('0x6e'),_0x3d40('0x6f'),'ContactId',_0x3d40('0x71'),'CampaignId',_0x3d40('0x72'),_0x3d40('0x56')],squel[_0x3d40('0x7a')]()[_0x3d40('0x74')](_0x3d40('0x6e'),'phone')['field'](_0x3d40('0x73'),_0x3d40('0x6f'))[_0x3d40('0x74')]('id',_0x3d40('0x70'))[_0x3d40('0x74')](_0x11f1bd['CmListId'][_0x3d40('0x75')](),_0x3d40('0x71'))[_0x3d40('0x74')](_0xf3c644['params']['id']['toString'](),_0x3d40('0x5e'))[_0x3d40('0x74')]('\x27'+_0x836dc7+'\x27',_0x3d40('0x72'))[_0x3d40('0x74')]('\x27'+_0x836dc7+'\x27',_0x3d40('0x56'))[_0x3d40('0x7c')](_0x3d40('0x81'))[_0x3d40('0x40')](_0x3d40('0x76'))['where'](_0x3d40('0x77'),_0x11f1bd[_0x3d40('0x78')][_0x3d40('0x75')]())[_0x3d40('0x40')](_0x3d40('0x79'))['where'](_0x3d40('0x7d'),squel[_0x3d40('0x7a')]()[_0x3d40('0x74')](_0x3d40('0x7e'))[_0x3d40('0x7c')](_0x3d40('0x6c'))[_0x3d40('0x40')](_0x3d40('0x82'),_0xf3c644[_0x3d40('0x4b')]['id'][_0x3d40('0x75')]())))[_0x3d40('0x75')]();break;default:_0x275a02=squel[_0x3d40('0x80')]()['into'](_0x3d40('0x6c'))[_0x3d40('0x6d')]([_0x3d40('0x6e'),_0x3d40('0x6f'),_0x3d40('0x70'),_0x3d40('0x71'),_0x3d40('0x5e'),_0x3d40('0x72'),_0x3d40('0x56')],squel['select']()[_0x3d40('0x74')](_0x3d40('0x6e'),_0x3d40('0x6e'))[_0x3d40('0x74')](_0x3d40('0x73'),_0x3d40('0x6f'))[_0x3d40('0x74')]('id',_0x3d40('0x70'))['field'](_0x11f1bd[_0x3d40('0x78')][_0x3d40('0x75')](),_0x3d40('0x71'))[_0x3d40('0x74')](_0xf3c644[_0x3d40('0x4b')]['id'][_0x3d40('0x75')](),_0x3d40('0x5e'))[_0x3d40('0x74')]('\x27'+_0x836dc7+'\x27',_0x3d40('0x72'))[_0x3d40('0x74')]('\x27'+_0x836dc7+'\x27',_0x3d40('0x56'))[_0x3d40('0x7c')](_0x3d40('0x81'))[_0x3d40('0x40')]('deletedAt\x20IS\x20NULL')[_0x3d40('0x40')](_0x3d40('0x77'),_0x11f1bd['CmListId'][_0x3d40('0x75')]())[_0x3d40('0x40')](_0x3d40('0x79')))[_0x3d40('0x75')]();}_0x49848e=squel['insert']()[_0x3d40('0x6b')](_0x3d40('0x83'))[_0x3d40('0x6d')]([_0x3d40('0x84'),_0x3d40('0x6f'),_0x3d40('0x6e'),'OrderBy',_0x3d40('0x72'),'updatedAt'],squel[_0x3d40('0x7a')]()[_0x3d40('0x74')](_0x3d40('0x85'),'id')['field']('NOW()',_0x3d40('0x6f'))[_0x3d40('0x74')]('ci.item',_0x3d40('0x6e'))[_0x3d40('0x74')](_0x3d40('0x86'),_0x3d40('0x87'))[_0x3d40('0x74')]('\x27'+_0x836dc7+'\x27',_0x3d40('0x72'))['field']('\x27'+_0x836dc7+'\x27','updatedAt')[_0x3d40('0x7c')](_0x3d40('0x88'),'ci')[_0x3d40('0x89')](_0x3d40('0x6c'),'h',_0x3d40('0x8a'))[_0x3d40('0x40')](_0x3d40('0x8b'),_0x11f1bd[_0x3d40('0x78')][_0x3d40('0x75')]())[_0x3d40('0x40')]('h.CampaignId=?',_0xf3c644[_0x3d40('0x4b')]['id']['toString']())[_0x3d40('0x40')](_0x3d40('0x8c'),_0x836dc7))['toString']();_0x3eda3d[_0x3d40('0x8d')](db[_0x3d40('0x8e')][_0x3d40('0x34')](_0x275a02));_0x1d5a17[_0x3d40('0x8d')](db[_0x3d40('0x8e')][_0x3d40('0x34')](_0x49848e));}return BPromise['all'](_0x3eda3d);}})[_0x3d40('0x26')](function(){return BPromise[_0x3d40('0x8f')](_0x1d5a17);})[_0x3d40('0x26')](function(){return _0x39bf67;})[_0x3d40('0x26')](respondWithResult(_0x26309d,null))[_0x3d40('0x49')](handleError(_0x26309d,null));};exports[_0x3d40('0x90')]=function(_0x2d6556,_0x22e4f5,_0x11851a){return db[_0x3d40('0x4c')][_0x3d40('0x4d')]({'where':{'id':_0x2d6556['params']['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x22e4f5,null))[_0x3d40('0x26')](function(_0x1c80ff){if(_0x1c80ff){return _0x1c80ff[_0x3d40('0x90')](_0x2d6556[_0x3d40('0x34')][_0x3d40('0x67')]);}})['then'](function(_0x213153){if(_0x213153){return db[_0x3d40('0x5c')]['destroy']({'where':{'ListId':_0x2d6556[_0x3d40('0x34')][_0x3d40('0x67')],'CampaignId':_0x2d6556[_0x3d40('0x4b')]['id']}})['then'](function(){return _0x213153;});}})[_0x3d40('0x26')](respondWithStatusCode(_0x22e4f5,null))[_0x3d40('0x49')](handleError(_0x22e4f5,null));};exports[_0x3d40('0x91')]=function(_0x16f636,_0x1f75b2,_0x10e479){var _0x11c7c3={};var _0x36a069={};var _0x5ab498;var _0x325579;return db[_0x3d40('0x4c')][_0x3d40('0x5b')]({'where':{'id':_0x16f636['params']['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x1f75b2,null))[_0x3d40('0x26')](function(_0x13e1dc){if(_0x13e1dc){_0x5ab498=_0x13e1dc;_0x36a069[_0x3d40('0x39')]=_['keys'](db['CmList'][_0x3d40('0x30')]);_0x36a069[_0x3d40('0x34')]=_[_0x3d40('0x35')](_0x16f636[_0x3d40('0x34')]);_0x36a069['filters']=_[_0x3d40('0x38')](_0x36a069[_0x3d40('0x39')],_0x36a069[_0x3d40('0x34')]);_0x11c7c3[_0x3d40('0x37')]=_['intersection'](_0x36a069[_0x3d40('0x39')],qs['fields'](_0x16f636[_0x3d40('0x34')][_0x3d40('0x3a')]));_0x11c7c3[_0x3d40('0x37')]=_0x11c7c3[_0x3d40('0x37')][_0x3d40('0x3b')]?_0x11c7c3['attributes']:_0x36a069['model'];_0x11c7c3['order']=qs[_0x3d40('0x3f')](_0x16f636[_0x3d40('0x34')][_0x3d40('0x3f')]);_0x11c7c3['where']=qs['filters'](_[_0x3d40('0x5d')](_0x16f636[_0x3d40('0x34')],_0x36a069[_0x3d40('0x36')]));if(_0x16f636['query'][_0x3d40('0x43')]){_0x11c7c3[_0x3d40('0x40')]=_[_0x3d40('0x41')](_0x11c7c3['where'],{'$or':_[_0x3d40('0x2f')](_0x11c7c3[_0x3d40('0x37')],function(_0x4d7817){var _0x22f625={};_0x22f625[_0x4d7817]={'$like':'%'+_0x16f636[_0x3d40('0x34')][_0x3d40('0x43')]+'%'};return _0x22f625;})});}_0x11c7c3=_[_0x3d40('0x41')]({},_0x11c7c3,_0x16f636[_0x3d40('0x44')]);return _0x5ab498[_0x3d40('0x91')](_0x11c7c3);}})[_0x3d40('0x26')](function(_0x394aba){if(_0x394aba){_0x325579=_0x394aba['length'];if(!_0x16f636[_0x3d40('0x34')]['hasOwnProperty']('nolimit')){_0x11c7c3[_0x3d40('0x21')]=qs[_0x3d40('0x21')](_0x16f636['query']['limit']);_0x11c7c3[_0x3d40('0x1e')]=qs[_0x3d40('0x1e')](_0x16f636[_0x3d40('0x34')][_0x3d40('0x1e')]);}return _0x5ab498[_0x3d40('0x91')](_0x11c7c3);}})[_0x3d40('0x26')](function(_0x3f2ad8){if(_0x3f2ad8){return _0x3f2ad8?{'count':_0x325579,'rows':_0x3f2ad8}:null;}})['then'](respondWithResult(_0x1f75b2,null))[_0x3d40('0x49')](handleError(_0x1f75b2,null));};exports['addBlackLists']=function(_0x5b5cdc,_0x27f2bc,_0x335ad2){var _0x46f5bd,_0x1ba164;var _0x2ed7ba=[];var _0x5b90be=moment()[_0x3d40('0x92')](_0x3d40('0x66'));return db[_0x3d40('0x4c')][_0x3d40('0x4d')]({'where':{'id':_0x5b5cdc[_0x3d40('0x4b')]['id']}})['then'](handleEntityNotFound(_0x27f2bc,null))[_0x3d40('0x26')](function(_0x30a94f){if(_0x30a94f){_0x1ba164=_0x30a94f;return _0x30a94f['addBlackLists'](_0x5b5cdc[_0x3d40('0x4f')]['ids'],_[_0x3d40('0x57')](_0x5b5cdc[_0x3d40('0x4f')],[_0x3d40('0x67'),'id'])||{});}return null;})[_0x3d40('0x68')](function(_0x397301){var _0x5bb0dc;var _0x278733;_0x46f5bd=_0x397301||[];var _0x1ebfef=[];if(_0x397301){for(var _0x4442f8=0x0;_0x4442f8<_0x397301['length'];_0x4442f8+=0x1){var _0x3d17e2=_0x397301[_0x4442f8][_0x3d40('0x51')]({'plain':!![]});_0x5bb0dc=squel[_0x3d40('0x80')]()[_0x3d40('0x6b')](_0x3d40('0x93'))[_0x3d40('0x6d')]([_0x3d40('0x6e'),_0x3d40('0x70'),'ListId',_0x3d40('0x5e'),_0x3d40('0x72'),'updatedAt'],squel['select']()[_0x3d40('0x74')](_0x3d40('0x6e'),_0x3d40('0x6e'))[_0x3d40('0x74')]('id',_0x3d40('0x70'))[_0x3d40('0x74')](_0x3d17e2[_0x3d40('0x78')][_0x3d40('0x75')](),'ListId')['field'](_0x5b5cdc[_0x3d40('0x4b')]['id']['toString'](),'CampaignId')[_0x3d40('0x74')](_0x3d40('0x73'),_0x3d40('0x72'))[_0x3d40('0x74')](_0x3d40('0x73'),_0x3d40('0x56'))[_0x3d40('0x7c')](_0x3d40('0x81'))[_0x3d40('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x3d17e2[_0x3d40('0x78')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x3d40('0x75')]();_0x1ebfef[_0x3d40('0x8d')](db[_0x3d40('0x8e')][_0x3d40('0x34')](_0x5bb0dc));}return BPromise[_0x3d40('0x8f')](_0x1ebfef);}})[_0x3d40('0x26')](function(){return _0x46f5bd;})['then'](respondWithResult(_0x27f2bc,null))[_0x3d40('0x49')](handleError(_0x27f2bc,null));};exports[_0x3d40('0x94')]=function(_0x177fc5,_0x4d8afe,_0x5df071){return db[_0x3d40('0x4c')][_0x3d40('0x4d')]({'where':{'id':_0x177fc5[_0x3d40('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4d8afe,null))['then'](function(_0x16c7c7){if(_0x16c7c7){return _0x16c7c7[_0x3d40('0x94')](_0x177fc5[_0x3d40('0x34')][_0x3d40('0x67')]);}})[_0x3d40('0x26')](function(_0x1e4d30){if(_0x1e4d30){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x177fc5[_0x3d40('0x34')][_0x3d40('0x67')],'CampaignId':_0x177fc5[_0x3d40('0x4b')]['id']}})[_0x3d40('0x26')](function(){return _0x1e4d30;});}})[_0x3d40('0x26')](respondWithStatusCode(_0x4d8afe,null))[_0x3d40('0x49')](handleError(_0x4d8afe,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 1ab572f..fc5fbfb 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(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x7a54,0x106));var _0x47a5=function(_0x31fca8,_0xd6b571){_0x31fca8=_0x31fca8-0x0;var _0x8deb85=_0x7a54[_0x31fca8];return _0x8deb85;};'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 2ba0ad3..8446806 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 _0xc5ba=['limit','map','include','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','Campaign','options','where','attributes'];(function(_0x2265da,_0xfbbd2e){var _0x430c2b=function(_0x20d671){while(--_0x20d671){_0x2265da['push'](_0x2265da['shift']());}};_0x430c2b(++_0xfbbd2e);}(_0xc5ba,0xb9));var _0xac5b=function(_0x131acf,_0x4b4597){_0x131acf=_0x131acf-0x0;var _0x40d32e=_0xc5ba[_0x131acf];return _0x40d32e;};'use strict';var _=require(_0xac5b('0x0'));var util=require(_0xac5b('0x1'));var moment=require(_0xac5b('0x2'));var BPromise=require(_0xac5b('0x3'));var rs=require(_0xac5b('0x4'));var fs=require('fs');var Redis=require(_0xac5b('0x5'));var db=require(_0xac5b('0x6'))['db'];var utils=require(_0xac5b('0x7'));var logger=require(_0xac5b('0x8'))(_0xac5b('0x9'));var config=require(_0xac5b('0xa'));var jayson=require(_0xac5b('0xb'));var client=jayson[_0xac5b('0xc')][_0xac5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x38602a,_0xc09fbc,_0xc193a7){return new BPromise(function(_0x4a7fc7,_0x525e20){return client[_0xac5b('0xe')](_0x38602a,_0xc193a7)['then'](function(_0x3c5bd3){logger[_0xac5b('0xf')](_0xac5b('0x10'),_0xc09fbc,_0xac5b('0x11'));logger[_0xac5b('0x12')](_0xac5b('0x13'),_0xc09fbc,_0xac5b('0x11'),JSON[_0xac5b('0x14')](_0x3c5bd3));if(_0x3c5bd3[_0xac5b('0x15')]){if(_0x3c5bd3['error'][_0xac5b('0x16')]===0x1f4){logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);return _0x525e20(_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);}logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);return _0x4a7fc7(_0x3c5bd3[_0xac5b('0x15')]['message']);}else{logger[_0xac5b('0xf')](_0xac5b('0x10'),_0xc09fbc,_0xac5b('0x11'));_0x4a7fc7(_0x3c5bd3[_0xac5b('0x18')][_0xac5b('0x17')]);}})[_0xac5b('0x19')](function(_0x363de5){logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x363de5);_0x525e20(_0x363de5);});});}exports[_0xac5b('0x1a')]=function(_0x11e6fa){var _0x551ccf=this;return new Promise(function(_0x2db8d1,_0x4c46e5){return db[_0xac5b('0x1b')]['findAll']({'raw':_0x11e6fa[_0xac5b('0x1c')]?_0x11e6fa[_0xac5b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x11e6fa['options']?_0x11e6fa['options'][_0xac5b('0x1d')]||null:null,'attributes':_0x11e6fa['options']?_0x11e6fa[_0xac5b('0x1c')][_0xac5b('0x1e')]||null:null,'limit':_0x11e6fa[_0xac5b('0x1c')]?_0x11e6fa[_0xac5b('0x1c')][_0xac5b('0x1f')]||null:null,'include':_0x11e6fa['options']?_0x11e6fa['options']['include']?_[_0xac5b('0x20')](_0x11e6fa['options'][_0xac5b('0x21')],function(_0x32d186){return{'model':db[_0x32d186['model']],'as':_0x32d186['as'],'attributes':_0x32d186[_0xac5b('0x1e')],'include':_0x32d186[_0xac5b('0x21')]?_[_0xac5b('0x20')](_0x32d186[_0xac5b('0x21')],function(_0x3c3b08){return{'model':db[_0x3c3b08[_0xac5b('0x22')]],'as':_0x3c3b08['as'],'attributes':_0x3c3b08[_0xac5b('0x1e')],'include':_0x3c3b08[_0xac5b('0x21')]?_[_0xac5b('0x20')](_0x3c3b08[_0xac5b('0x21')],function(_0x578d11){return{'model':db[_0x578d11[_0xac5b('0x22')]],'as':_0x578d11['as'],'attributes':_0x578d11[_0xac5b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xac5b('0x23')](function(_0x4191a7){logger[_0xac5b('0xf')](_0xac5b('0x1a'),_0x11e6fa);logger[_0xac5b('0x12')](_0xac5b('0x1a'),_0x11e6fa,JSON[_0xac5b('0x14')](_0x4191a7));_0x2db8d1(_0x4191a7);})[_0xac5b('0x19')](function(_0x36f1e4){logger['error'](_0xac5b('0x1a'),_0x36f1e4[_0xac5b('0x17')],_0x11e6fa);_0x4c46e5(_0x551ccf[_0xac5b('0x15')](0x1f4,_0x36f1e4['message']));});});}; \ No newline at end of file +var _0x0b40=['Campaign,\x20%s,\x20%s','message','info','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xc391bf,_0x5cc846){var _0x4bd503=function(_0x6970a9){while(--_0x6970a9){_0xc391bf['push'](_0xc391bf['shift']());}};_0x4bd503(++_0x5cc846);}(_0x0b40,0xba));var _0x00b4=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0x0b40[_0x5f1cf8];return _0x27d0fa;};'use strict';var _=require('lodash');var util=require(_0x00b4('0x0'));var moment=require(_0x00b4('0x1'));var BPromise=require('bluebird');var rs=require(_0x00b4('0x2'));var fs=require('fs');var Redis=require(_0x00b4('0x3'));var db=require(_0x00b4('0x4'))['db'];var utils=require(_0x00b4('0x5'));var logger=require(_0x00b4('0x6'))(_0x00b4('0x7'));var config=require('../../config/environment');var jayson=require(_0x00b4('0x8'));var client=jayson[_0x00b4('0x9')][_0x00b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x120157,_0x5684ec,_0x445536){return new BPromise(function(_0x20c810,_0x3f6285){return client['request'](_0x120157,_0x445536)[_0x00b4('0xb')](function(_0x144611){logger['info']('Campaign,\x20%s,\x20%s',_0x5684ec,_0x00b4('0xc'));logger[_0x00b4('0xd')](_0x00b4('0xe'),_0x5684ec,_0x00b4('0xc'),JSON[_0x00b4('0xf')](_0x144611));if(_0x144611[_0x00b4('0x10')]){if(_0x144611[_0x00b4('0x10')][_0x00b4('0x11')]===0x1f4){logger[_0x00b4('0x10')](_0x00b4('0x12'),_0x5684ec,_0x144611[_0x00b4('0x10')][_0x00b4('0x13')]);return _0x3f6285(_0x144611['error']['message']);}logger[_0x00b4('0x10')](_0x00b4('0x12'),_0x5684ec,_0x144611[_0x00b4('0x10')][_0x00b4('0x13')]);return _0x20c810(_0x144611['error'][_0x00b4('0x13')]);}else{logger[_0x00b4('0x14')](_0x00b4('0x12'),_0x5684ec,_0x00b4('0xc'));_0x20c810(_0x144611[_0x00b4('0x15')][_0x00b4('0x13')]);}})[_0x00b4('0x16')](function(_0x56e54c){logger[_0x00b4('0x10')](_0x00b4('0x12'),_0x5684ec,_0x56e54c);_0x3f6285(_0x56e54c);});});}exports[_0x00b4('0x17')]=function(_0x3f4b1d){var _0x24a5be=this;return new Promise(function(_0x5d960a,_0x265dbd){return db[_0x00b4('0x18')][_0x00b4('0x19')]({'raw':_0x3f4b1d['options']?_0x3f4b1d[_0x00b4('0x1a')][_0x00b4('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f4b1d[_0x00b4('0x1a')]?_0x3f4b1d[_0x00b4('0x1a')][_0x00b4('0x1c')]||null:null,'attributes':_0x3f4b1d['options']?_0x3f4b1d['options'][_0x00b4('0x1d')]||null:null,'limit':_0x3f4b1d[_0x00b4('0x1a')]?_0x3f4b1d[_0x00b4('0x1a')][_0x00b4('0x1e')]||null:null,'include':_0x3f4b1d[_0x00b4('0x1a')]?_0x3f4b1d['options'][_0x00b4('0x1f')]?_[_0x00b4('0x20')](_0x3f4b1d['options'][_0x00b4('0x1f')],function(_0x40d7ba){return{'model':db[_0x40d7ba[_0x00b4('0x21')]],'as':_0x40d7ba['as'],'attributes':_0x40d7ba['attributes'],'include':_0x40d7ba[_0x00b4('0x1f')]?_[_0x00b4('0x20')](_0x40d7ba[_0x00b4('0x1f')],function(_0x50d48d){return{'model':db[_0x50d48d['model']],'as':_0x50d48d['as'],'attributes':_0x50d48d[_0x00b4('0x1d')],'include':_0x50d48d[_0x00b4('0x1f')]?_[_0x00b4('0x20')](_0x50d48d[_0x00b4('0x1f')],function(_0x3cf0ff){return{'model':db[_0x3cf0ff[_0x00b4('0x21')]],'as':_0x3cf0ff['as'],'attributes':_0x3cf0ff['attributes']};}):[]};}):[]};}):[]:[]})[_0x00b4('0xb')](function(_0x3abc75){logger[_0x00b4('0x14')](_0x00b4('0x17'),_0x3f4b1d);logger[_0x00b4('0xd')](_0x00b4('0x17'),_0x3f4b1d,JSON[_0x00b4('0xf')](_0x3abc75));_0x5d960a(_0x3abc75);})[_0x00b4('0x16')](function(_0x3d3684){logger[_0x00b4('0x10')](_0x00b4('0x17'),_0x3d3684['message'],_0x3f4b1d);_0x265dbd(_0x24a5be[_0x00b4('0x10')](0x1f4,_0x3d3684[_0x00b4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index eb87513..183efdc 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 _0x731f=['update','delete','removeBlackLists','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','show','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addBlackLists','put'];(function(_0x11e659,_0x3a258f){var _0x462223=function(_0x2f32cf){while(--_0x2f32cf){_0x11e659['push'](_0x11e659['shift']());}};_0x462223(++_0x3a258f);}(_0x731f,0xc3));var _0xf731=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x731f[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xf731('0x0'));var util=require(_0xf731('0x1'));var path=require(_0xf731('0x2'));var timeout=require(_0xf731('0x3'));var express=require(_0xf731('0x4'));var router=express[_0xf731('0x5')]();var fs_extra=require(_0xf731('0x6'));var auth=require(_0xf731('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf731('0x8'));var controller=require('./campaign.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf731('0x9')](_0xf731('0xa'),auth['isAuthenticated'](),controller[_0xf731('0xb')]);router[_0xf731('0x9')](_0xf731('0xc'),auth[_0xf731('0xd')](),controller[_0xf731('0xe')]);router[_0xf731('0x9')](_0xf731('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xf731('0x9')](_0xf731('0x10'),auth[_0xf731('0xd')](),controller[_0xf731('0x11')]);router['get'](_0xf731('0x12'),auth[_0xf731('0xd')](),controller[_0xf731('0x13')]);router['get'](_0xf731('0x14'),auth[_0xf731('0xd')](),controller['getLists']);router[_0xf731('0x9')](_0xf731('0x15'),auth[_0xf731('0xd')](),controller[_0xf731('0x16')]);router['post']('/',auth[_0xf731('0xd')](),controller[_0xf731('0x17')]);router[_0xf731('0x18')](_0xf731('0x19'),auth[_0xf731('0xd')](),controller[_0xf731('0x1a')]);router[_0xf731('0x18')](_0xf731('0x14'),auth['isAuthenticated'](),controller['addLists']);router[_0xf731('0x18')](_0xf731('0x15'),auth[_0xf731('0xd')](),controller[_0xf731('0x1b')]);router[_0xf731('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0xf731('0x1d')]);router[_0xf731('0x1e')]('/:id',auth[_0xf731('0xd')](),controller['destroy']);router[_0xf731('0x1e')](_0xf731('0x14'),auth[_0xf731('0xd')](),controller['removeLists']);router[_0xf731('0x1e')](_0xf731('0x15'),auth[_0xf731('0xd')](),controller[_0xf731('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x93da=['/:id/clone','clone','addLists','addBlackLists','put','delete','destroy','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','Router','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create'];(function(_0x52f773,_0x25eeb7){var _0x43fa26=function(_0x7d1470){while(--_0x7d1470){_0x52f773['push'](_0x52f773['shift']());}};_0x43fa26(++_0x25eeb7);}(_0x93da,0x92));var _0xa93d=function(_0x2a36e6,_0x250137){_0x2a36e6=_0x2a36e6-0x0;var _0x438728=_0x93da[_0x2a36e6];return _0x438728;};'use strict';var multer=require(_0xa93d('0x0'));var util=require('util');var path=require(_0xa93d('0x1'));var timeout=require(_0xa93d('0x2'));var express=require(_0xa93d('0x3'));var router=express[_0xa93d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa93d('0x5'));var controller=require(_0xa93d('0x6'));router[_0xa93d('0x7')]('/',auth[_0xa93d('0x8')](),controller[_0xa93d('0x9')]);router[_0xa93d('0x7')](_0xa93d('0xa'),auth[_0xa93d('0x8')](),controller[_0xa93d('0xb')]);router['get'](_0xa93d('0xc'),auth['isAuthenticated'](),controller[_0xa93d('0xd')]);router[_0xa93d('0x7')](_0xa93d('0xe'),auth['isAuthenticated'](),controller[_0xa93d('0xf')]);router[_0xa93d('0x7')](_0xa93d('0x10'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x11')]);router['get']('/:id/hopper_black',auth[_0xa93d('0x8')](),controller['getHopperBlacks']);router[_0xa93d('0x7')](_0xa93d('0x12'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x13')]);router[_0xa93d('0x7')](_0xa93d('0x14'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x15')]);router[_0xa93d('0x16')]('/',auth[_0xa93d('0x8')](),controller[_0xa93d('0x17')]);router[_0xa93d('0x16')](_0xa93d('0x18'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x19')]);router['post']('/:id/lists',auth[_0xa93d('0x8')](),controller[_0xa93d('0x1a')]);router[_0xa93d('0x16')](_0xa93d('0x14'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x1b')]);router[_0xa93d('0x1c')](_0xa93d('0xa'),auth[_0xa93d('0x8')](),controller['update']);router[_0xa93d('0x1d')](_0xa93d('0xa'),auth['isAuthenticated'](),controller[_0xa93d('0x1e')]);router[_0xa93d('0x1d')](_0xa93d('0x12'),auth['isAuthenticated'](),controller[_0xa93d('0x1f')]);router[_0xa93d('0x1d')](_0xa93d('0x14'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x20')]);module[_0xa93d('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index b062bae..2ae8e25 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 _0x0f14=['VIRTUAL','getDataValue','key','sequelize','exports','STRING','TEXT','medium'];(function(_0x2626d6,_0x31a009){var _0x510e0e=function(_0x4c58ff){while(--_0x4c58ff){_0x2626d6['push'](_0x2626d6['shift']());}};_0x510e0e(++_0x31a009);}(_0x0f14,0x13b));var _0x40f1=function(_0x512419,_0x39ecdd){_0x512419=_0x512419-0x0;var _0x286cf6=_0x0f14[_0x512419];return _0x286cf6;};'use strict';var Sequelize=require(_0x40f1('0x0'));module[_0x40f1('0x1')]={'key':{'type':Sequelize[_0x40f1('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x40f1('0x3')],'length':_0x40f1('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x40f1('0x2')]},'name':{'type':Sequelize[_0x40f1('0x5')],'get':function(){return this[_0x40f1('0x6')](_0x40f1('0x7'));}}}; \ No newline at end of file +var _0xc292=['medium','VIRTUAL','key','exports','STRING','TEXT'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xc292,0x141));var _0x2c29=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc292[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require('sequelize');module[_0x2c29('0x0')]={'key':{'type':Sequelize[_0x2c29('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x2c29('0x2')],'length':_0x2c29('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2c29('0x1')]},'name':{'type':Sequelize[_0x2c29('0x4')],'get':function(){return this['getDataValue'](_0x2c29('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 3596fb2..123e77c 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 _0x4bdd=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','CannedAnswer','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','intersection','options','find','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4bdd,0xbb));var _0xd4bd=function(_0x1df9f5,_0x3a9b63){_0x1df9f5=_0x1df9f5-0x0;var _0x11310f=_0x4bdd[_0x1df9f5];return _0x11310f;};'use strict';var emlformat=require(_0xd4bd('0x0'));var rimraf=require(_0xd4bd('0x1'));var zipdir=require(_0xd4bd('0x2'));var jsonpatch=require(_0xd4bd('0x3'));var rp=require(_0xd4bd('0x4'));var moment=require(_0xd4bd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd4bd('0x6'));var util=require(_0xd4bd('0x7'));var path=require(_0xd4bd('0x8'));var sox=require(_0xd4bd('0x9'));var csv=require('to-csv');var ejs=require(_0xd4bd('0xa'));var fs=require('fs');var fs_extra=require(_0xd4bd('0xb'));var _=require(_0xd4bd('0xc'));var squel=require('squel');var crypto=require(_0xd4bd('0xd'));var jsforce=require(_0xd4bd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd4bd('0xf'));var querystring=require(_0xd4bd('0x10'));var Papa=require(_0xd4bd('0x11'));var Redis=require(_0xd4bd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd4bd('0x13'));var as=require(_0xd4bd('0x14'));var hardwareService=require(_0xd4bd('0x15'));var logger=require(_0xd4bd('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xd4bd('0x17'));var licenseUtil=require(_0xd4bd('0x18'));var db=require(_0xd4bd('0x19'))['db'];function respondWithStatusCode(_0x4c2ade,_0x1c3e89){_0x1c3e89=_0x1c3e89||0xcc;return function(_0x386115){if(_0x386115){return _0x4c2ade['sendStatus'](_0x1c3e89);}return _0x4c2ade[_0xd4bd('0x1a')](_0x1c3e89)[_0xd4bd('0x1b')]();};}function respondWithResult(_0x1f6232,_0x38d7b0){_0x38d7b0=_0x38d7b0||0xc8;return function(_0x491dde){if(_0x491dde){return _0x1f6232[_0xd4bd('0x1a')](_0x38d7b0)[_0xd4bd('0x1c')](_0x491dde);}};}function respondWithFilteredResult(_0x5b7426,_0x28c3ab){return function(_0x25cdc6){if(_0x25cdc6){var _0x333a85=typeof _0x28c3ab[_0xd4bd('0x1d')]==='undefined'&&typeof _0x28c3ab['limit']===_0xd4bd('0x1e');var _0x1ccd92=_0x25cdc6[_0xd4bd('0x1f')];var _0x192418=_0x333a85?0x0:_0x28c3ab[_0xd4bd('0x1d')];var _0x421213=_0x333a85?_0x25cdc6['count']:_0x28c3ab[_0xd4bd('0x1d')]+_0x28c3ab[_0xd4bd('0x20')];var _0x3bc65c;if(_0x421213>=_0x1ccd92){_0x421213=_0x1ccd92;_0x3bc65c=0xc8;}else{_0x3bc65c=0xce;}_0x5b7426[_0xd4bd('0x1a')](_0x3bc65c);return _0x5b7426[_0xd4bd('0x21')](_0xd4bd('0x22'),_0x192418+'-'+_0x421213+'/'+_0x1ccd92)['json'](_0x25cdc6);}return null;};}function patchUpdates(_0x2a4af9){return function(_0x533bf1){try{jsonpatch[_0xd4bd('0x23')](_0x533bf1,_0x2a4af9,!![]);}catch(_0xe703e3){return BPromise[_0xd4bd('0x24')](_0xe703e3);}return _0x533bf1[_0xd4bd('0x25')]();};}function saveUpdates(_0x483509,_0x4438cb){return function(_0x53d0af){if(_0x53d0af){return _0x53d0af[_0xd4bd('0x26')](_0x483509)['then'](function(_0x5cedad){return _0x5cedad;});}return null;};}function removeEntity(_0x318f16,_0x1cf7bf){return function(_0x2184db){if(_0x2184db){return _0x2184db['destroy']()[_0xd4bd('0x27')](function(){var _0xbc456=_0x2184db['get']({'plain':!![]});var _0x1fa02c='CannedAnswers';return db[_0xd4bd('0x28')][_0xd4bd('0x29')]({'where':{'type':_0x1fa02c,'resourceId':_0xbc456['id']}})[_0xd4bd('0x27')](function(){return _0x2184db;});})[_0xd4bd('0x27')](function(){_0x318f16['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24e483,_0x35eced){return function(_0x4376ca){if(!_0x4376ca){_0x24e483[_0xd4bd('0x2a')](0x194);}return _0x4376ca;};}function handleError(_0x1017a8,_0x2cfffe){_0x2cfffe=_0x2cfffe||0x1f4;return function(_0x136dc4){logger[_0xd4bd('0x2b')](_0x136dc4[_0xd4bd('0x2c')]);if(_0x136dc4[_0xd4bd('0x2d')]){delete _0x136dc4[_0xd4bd('0x2d')];}_0x1017a8[_0xd4bd('0x1a')](_0x2cfffe)['send'](_0x136dc4);};}exports[_0xd4bd('0x2e')]=function(_0x4e95dc,_0x1e1490){var _0x3bb8f7={},_0x5b09d6={},_0x4bd50a={'count':0x0,'rows':[]};var _0x2818fe=_[_0xd4bd('0x2f')](db[_0xd4bd('0x30')]['rawAttributes'],function(_0x90fcba){return{'name':_0x90fcba[_0xd4bd('0x31')],'type':_0x90fcba[_0xd4bd('0x32')][_0xd4bd('0x33')]};});_0x5b09d6['model']=_[_0xd4bd('0x2f')](_0x2818fe,_0xd4bd('0x2d'));_0x5b09d6['query']=_['keys'](_0x4e95dc['query']);_0x5b09d6['filters']=_['intersection'](_0x5b09d6[_0xd4bd('0x34')],_0x5b09d6[_0xd4bd('0x35')]);_0x3bb8f7[_0xd4bd('0x36')]=_['intersection'](_0x5b09d6[_0xd4bd('0x34')],qs[_0xd4bd('0x37')](_0x4e95dc['query'][_0xd4bd('0x37')]));_0x3bb8f7['attributes']=_0x3bb8f7[_0xd4bd('0x36')][_0xd4bd('0x38')]?_0x3bb8f7['attributes']:_0x5b09d6['model'];if(!_0x4e95dc[_0xd4bd('0x35')][_0xd4bd('0x39')](_0xd4bd('0x3a'))){_0x3bb8f7[_0xd4bd('0x20')]=qs[_0xd4bd('0x20')](_0x4e95dc[_0xd4bd('0x35')][_0xd4bd('0x20')]);_0x3bb8f7[_0xd4bd('0x1d')]=qs[_0xd4bd('0x1d')](_0x4e95dc['query'][_0xd4bd('0x1d')]);}_0x3bb8f7[_0xd4bd('0x3b')]=qs[_0xd4bd('0x3c')](_0x4e95dc[_0xd4bd('0x35')][_0xd4bd('0x3c')]);_0x3bb8f7[_0xd4bd('0x3d')]=qs[_0xd4bd('0x3e')](_[_0xd4bd('0x3f')](_0x4e95dc[_0xd4bd('0x35')],_0x5b09d6[_0xd4bd('0x3e')]),_0x2818fe);if(_0x4e95dc[_0xd4bd('0x35')][_0xd4bd('0x40')]){_0x3bb8f7[_0xd4bd('0x3d')]=_['merge'](_0x3bb8f7[_0xd4bd('0x3d')],{'$or':[{'key':{'$like':'%'+_0x4e95dc[_0xd4bd('0x35')]['filter']+'%'}},{'value':{'$like':'%'+_0x4e95dc[_0xd4bd('0x35')][_0xd4bd('0x40')]+'%'}}]});}_0x3bb8f7=_[_0xd4bd('0x41')]({},_0x3bb8f7,_0x4e95dc['options']);var _0x1edfcd={'where':_0x3bb8f7['where']};return db[_0xd4bd('0x30')][_0xd4bd('0x1f')](_0x1edfcd)[_0xd4bd('0x27')](function(_0x3fbbc8){_0x4bd50a[_0xd4bd('0x1f')]=_0x3fbbc8;if(_0x4e95dc[_0xd4bd('0x35')][_0xd4bd('0x42')]){_0x3bb8f7[_0xd4bd('0x43')]=[{'all':!![]}];}return db[_0xd4bd('0x30')][_0xd4bd('0x44')](_0x3bb8f7);})[_0xd4bd('0x27')](function(_0x5a10fa){_0x4bd50a[_0xd4bd('0x45')]=_0x5a10fa;return _0x4bd50a;})[_0xd4bd('0x27')](respondWithFilteredResult(_0x1e1490,_0x3bb8f7))[_0xd4bd('0x46')](handleError(_0x1e1490,null));};exports[_0xd4bd('0x47')]=function(_0x4b5f95,_0x1d1710){var _0x462fc1={'raw':!![],'where':{'id':_0x4b5f95['params']['id']}},_0x3d8769={};_0x3d8769[_0xd4bd('0x34')]=_['keys'](db[_0xd4bd('0x30')][_0xd4bd('0x48')]);_0x3d8769['query']=_[_0xd4bd('0x49')](_0x4b5f95[_0xd4bd('0x35')]);_0x3d8769[_0xd4bd('0x3e')]=_['intersection'](_0x3d8769[_0xd4bd('0x34')],_0x3d8769['query']);_0x462fc1['attributes']=_[_0xd4bd('0x4a')](_0x3d8769[_0xd4bd('0x34')],qs[_0xd4bd('0x37')](_0x4b5f95[_0xd4bd('0x35')][_0xd4bd('0x37')]));_0x462fc1[_0xd4bd('0x36')]=_0x462fc1[_0xd4bd('0x36')][_0xd4bd('0x38')]?_0x462fc1[_0xd4bd('0x36')]:_0x3d8769[_0xd4bd('0x34')];if(_0x4b5f95[_0xd4bd('0x35')][_0xd4bd('0x42')]){_0x462fc1[_0xd4bd('0x43')]=[{'all':!![]}];}_0x462fc1=_['merge']({},_0x462fc1,_0x4b5f95[_0xd4bd('0x4b')]);return db[_0xd4bd('0x30')][_0xd4bd('0x4c')](_0x462fc1)[_0xd4bd('0x27')](handleEntityNotFound(_0x1d1710,null))[_0xd4bd('0x27')](respondWithResult(_0x1d1710,null))['catch'](handleError(_0x1d1710,null));};exports['update']=function(_0x24a512,_0x2c25a1){if(_0x24a512['body']['id']){delete _0x24a512[_0xd4bd('0x4d')]['id'];}return db[_0xd4bd('0x30')][_0xd4bd('0x4c')]({'where':{'id':_0x24a512[_0xd4bd('0x4e')]['id']}})[_0xd4bd('0x27')](handleEntityNotFound(_0x2c25a1,null))[_0xd4bd('0x27')](saveUpdates(_0x24a512[_0xd4bd('0x4d')],null))[_0xd4bd('0x27')](respondWithResult(_0x2c25a1,null))[_0xd4bd('0x46')](handleError(_0x2c25a1,null));};exports['destroy']=function(_0x3725e8,_0x41256b){return db[_0xd4bd('0x30')][_0xd4bd('0x4c')]({'where':{'id':_0x3725e8['params']['id']}})[_0xd4bd('0x27')](handleEntityNotFound(_0x41256b,null))[_0xd4bd('0x27')](removeEntity(_0x41256b,null))[_0xd4bd('0x46')](handleError(_0x41256b,null));};exports['create']=function(_0x24430c,_0x492e77){var _0x2ca9f1={'key':_0x24430c[_0xd4bd('0x4d')][_0xd4bd('0x33')]};if(_0x24430c[_0xd4bd('0x4d')][_0xd4bd('0x4f')]){_0x2ca9f1[_0xd4bd('0x4f')]=_0x24430c[_0xd4bd('0x4d')][_0xd4bd('0x4f')];}else if(_0x24430c['body'][_0xd4bd('0x50')]){_0x2ca9f1[_0xd4bd('0x50')]=_0x24430c['body'][_0xd4bd('0x50')];}else if(_0x24430c[_0xd4bd('0x4d')][_0xd4bd('0x51')]){_0x2ca9f1[_0xd4bd('0x51')]=_0x24430c['body']['OpenchannelAccountId'];}else if(_0x24430c[_0xd4bd('0x4d')][_0xd4bd('0x52')]){_0x2ca9f1[_0xd4bd('0x52')]=_0x24430c['body'][_0xd4bd('0x52')];}return db['CannedAnswer']['find']({'where':_0x2ca9f1})[_0xd4bd('0x27')](function(_0x4a59a6){if(_0x4a59a6){throw new db[(_0xd4bd('0x53'))]['ValidationError'](_0xd4bd('0x54'));}return db[_0xd4bd('0x30')][_0xd4bd('0x55')](_0x24430c['body']);})[_0xd4bd('0x27')](function(_0x2ac976){var _0x171c64=_0x24430c[_0xd4bd('0x56')]['get']({'plain':!![]});if(!_0x171c64)throw new Error(_0xd4bd('0x57'));if(_0x171c64[_0xd4bd('0x58')]==='user'){var _0x2cb623=_0x2ac976[_0xd4bd('0x59')]({'plain':!![]});return db['UserProfileSection'][_0xd4bd('0x4c')]({'where':{'name':'CannedAnswers','userProfileId':_0x171c64[_0xd4bd('0x5a')]},'raw':!![]})[_0xd4bd('0x27')](function(_0x5e843d){if(_0x5e843d&&_0x5e843d[_0xd4bd('0x5b')]===0x0){return db[_0xd4bd('0x28')][_0xd4bd('0x55')]({'name':_0x2cb623[_0xd4bd('0x2d')],'resourceId':_0x2cb623['id'],'type':_0x5e843d[_0xd4bd('0x2d')],'sectionId':_0x5e843d['id']},{})[_0xd4bd('0x27')](function(){return _0x2ac976;});}else{return _0x2ac976;}})['catch'](function(_0x348385){logger[_0xd4bd('0x2b')](_0xd4bd('0x5c'),_0x348385);throw _0x348385;});}return _0x2ac976;})[_0xd4bd('0x27')](respondWithResult(_0x492e77,0xc9))[_0xd4bd('0x46')](handleError(_0x492e77,null));}; \ No newline at end of file +var _0xfbc8=['rows','show','params','catch','update','body','find','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','get','CannedAnswers','destroy','then','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','CannedAnswer','findAll'];(function(_0xaee297,_0x58190c){var _0x90293c=function(_0x281ba3){while(--_0x281ba3){_0xaee297['push'](_0xaee297['shift']());}};_0x90293c(++_0x58190c);}(_0xfbc8,0x1bb));var _0x8fbc=function(_0x45cd35,_0x41147c){_0x45cd35=_0x45cd35-0x0;var _0x16db84=_0xfbc8[_0x45cd35];return _0x16db84;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8fbc('0x0'));var jsonpatch=require(_0x8fbc('0x1'));var rp=require(_0x8fbc('0x2'));var moment=require(_0x8fbc('0x3'));var BPromise=require(_0x8fbc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8fbc('0x5'));var sox=require(_0x8fbc('0x6'));var csv=require(_0x8fbc('0x7'));var ejs=require(_0x8fbc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8fbc('0x9'));var squel=require(_0x8fbc('0xa'));var crypto=require(_0x8fbc('0xb'));var jsforce=require(_0x8fbc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8fbc('0x7'));var querystring=require(_0x8fbc('0xd'));var Papa=require(_0x8fbc('0xe'));var Redis=require('ioredis');var authService=require(_0x8fbc('0xf'));var qs=require(_0x8fbc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8fbc('0x11'));var logger=require('../../config/logger')(_0x8fbc('0x12'));var utils=require('../../config/utils');var config=require(_0x8fbc('0x13'));var licenseUtil=require(_0x8fbc('0x14'));var db=require(_0x8fbc('0x15'))['db'];function respondWithStatusCode(_0x3d8a17,_0xcdfa91){_0xcdfa91=_0xcdfa91||0xcc;return function(_0x89f19a){if(_0x89f19a){return _0x3d8a17[_0x8fbc('0x16')](_0xcdfa91);}return _0x3d8a17[_0x8fbc('0x17')](_0xcdfa91)[_0x8fbc('0x18')]();};}function respondWithResult(_0x29ab06,_0x27bff9){_0x27bff9=_0x27bff9||0xc8;return function(_0x35ae1a){if(_0x35ae1a){return _0x29ab06[_0x8fbc('0x17')](_0x27bff9)[_0x8fbc('0x19')](_0x35ae1a);}};}function respondWithFilteredResult(_0x55cd74,_0x47cf48){return function(_0x3b92eb){if(_0x3b92eb){var _0x3b070d=typeof _0x47cf48['offset']===_0x8fbc('0x1a')&&typeof _0x47cf48[_0x8fbc('0x1b')]===_0x8fbc('0x1a');var _0x4ce8c3=_0x3b92eb[_0x8fbc('0x1c')];var _0x5896e5=_0x3b070d?0x0:_0x47cf48[_0x8fbc('0x1d')];var _0x19c23c=_0x3b070d?_0x3b92eb['count']:_0x47cf48[_0x8fbc('0x1d')]+_0x47cf48[_0x8fbc('0x1b')];var _0x231206;if(_0x19c23c>=_0x4ce8c3){_0x19c23c=_0x4ce8c3;_0x231206=0xc8;}else{_0x231206=0xce;}_0x55cd74[_0x8fbc('0x17')](_0x231206);return _0x55cd74[_0x8fbc('0x1e')](_0x8fbc('0x1f'),_0x5896e5+'-'+_0x19c23c+'/'+_0x4ce8c3)['json'](_0x3b92eb);}return null;};}function patchUpdates(_0x4d74a8){return function(_0x38ffb8){try{jsonpatch[_0x8fbc('0x20')](_0x38ffb8,_0x4d74a8,!![]);}catch(_0x32bcb6){return BPromise[_0x8fbc('0x21')](_0x32bcb6);}return _0x38ffb8[_0x8fbc('0x22')]();};}function saveUpdates(_0x354c90,_0x3be4a2){return function(_0x51167e){if(_0x51167e){return _0x51167e['update'](_0x354c90)['then'](function(_0x19ed0a){return _0x19ed0a;});}return null;};}function removeEntity(_0x1bae03,_0x36371c){return function(_0x5059a6){if(_0x5059a6){return _0x5059a6['destroy']()['then'](function(){var _0x329b12=_0x5059a6[_0x8fbc('0x23')]({'plain':!![]});var _0x55d9fc=_0x8fbc('0x24');return db['UserProfileResource'][_0x8fbc('0x25')]({'where':{'type':_0x55d9fc,'resourceId':_0x329b12['id']}})[_0x8fbc('0x26')](function(){return _0x5059a6;});})['then'](function(){_0x1bae03[_0x8fbc('0x17')](0xcc)[_0x8fbc('0x18')]();});}};}function handleEntityNotFound(_0x1097bb,_0x1cc446){return function(_0x508595){if(!_0x508595){_0x1097bb[_0x8fbc('0x16')](0x194);}return _0x508595;};}function handleError(_0x1177da,_0x51d9ae){_0x51d9ae=_0x51d9ae||0x1f4;return function(_0x4fbce9){logger[_0x8fbc('0x27')](_0x4fbce9[_0x8fbc('0x28')]);if(_0x4fbce9[_0x8fbc('0x29')]){delete _0x4fbce9[_0x8fbc('0x29')];}_0x1177da[_0x8fbc('0x17')](_0x51d9ae)['send'](_0x4fbce9);};}exports[_0x8fbc('0x2a')]=function(_0x1741cc,_0x3f1eee){var _0x573a53={},_0x48e06e={},_0x8801f0={'count':0x0,'rows':[]};var _0x462283=_['map'](db['CannedAnswer'][_0x8fbc('0x2b')],function(_0x3e0a5e){return{'name':_0x3e0a5e[_0x8fbc('0x2c')],'type':_0x3e0a5e[_0x8fbc('0x2d')]['key']};});_0x48e06e[_0x8fbc('0x2e')]=_[_0x8fbc('0x2f')](_0x462283,'name');_0x48e06e[_0x8fbc('0x30')]=_[_0x8fbc('0x31')](_0x1741cc[_0x8fbc('0x30')]);_0x48e06e[_0x8fbc('0x32')]=_[_0x8fbc('0x33')](_0x48e06e['model'],_0x48e06e[_0x8fbc('0x30')]);_0x573a53[_0x8fbc('0x34')]=_[_0x8fbc('0x33')](_0x48e06e[_0x8fbc('0x2e')],qs[_0x8fbc('0x35')](_0x1741cc[_0x8fbc('0x30')][_0x8fbc('0x35')]));_0x573a53[_0x8fbc('0x34')]=_0x573a53[_0x8fbc('0x34')][_0x8fbc('0x36')]?_0x573a53[_0x8fbc('0x34')]:_0x48e06e[_0x8fbc('0x2e')];if(!_0x1741cc['query'][_0x8fbc('0x37')](_0x8fbc('0x38'))){_0x573a53['limit']=qs[_0x8fbc('0x1b')](_0x1741cc[_0x8fbc('0x30')][_0x8fbc('0x1b')]);_0x573a53[_0x8fbc('0x1d')]=qs[_0x8fbc('0x1d')](_0x1741cc[_0x8fbc('0x30')][_0x8fbc('0x1d')]);}_0x573a53['order']=qs[_0x8fbc('0x39')](_0x1741cc[_0x8fbc('0x30')][_0x8fbc('0x39')]);_0x573a53[_0x8fbc('0x3a')]=qs[_0x8fbc('0x32')](_[_0x8fbc('0x3b')](_0x1741cc[_0x8fbc('0x30')],_0x48e06e[_0x8fbc('0x32')]),_0x462283);if(_0x1741cc[_0x8fbc('0x30')][_0x8fbc('0x3c')]){_0x573a53[_0x8fbc('0x3a')]=_[_0x8fbc('0x3d')](_0x573a53[_0x8fbc('0x3a')],{'$or':[{'key':{'$like':'%'+_0x1741cc[_0x8fbc('0x30')][_0x8fbc('0x3c')]+'%'}},{'value':{'$like':'%'+_0x1741cc['query'][_0x8fbc('0x3c')]+'%'}}]});}_0x573a53=_[_0x8fbc('0x3d')]({},_0x573a53,_0x1741cc[_0x8fbc('0x3e')]);var _0x47b7aa={'where':_0x573a53[_0x8fbc('0x3a')]};return db['CannedAnswer'][_0x8fbc('0x1c')](_0x47b7aa)[_0x8fbc('0x26')](function(_0x5bbe31){_0x8801f0[_0x8fbc('0x1c')]=_0x5bbe31;if(_0x1741cc[_0x8fbc('0x30')][_0x8fbc('0x3f')]){_0x573a53[_0x8fbc('0x40')]=[{'all':!![]}];}return db[_0x8fbc('0x41')][_0x8fbc('0x42')](_0x573a53);})[_0x8fbc('0x26')](function(_0x37dbc8){_0x8801f0[_0x8fbc('0x43')]=_0x37dbc8;return _0x8801f0;})['then'](respondWithFilteredResult(_0x3f1eee,_0x573a53))['catch'](handleError(_0x3f1eee,null));};exports[_0x8fbc('0x44')]=function(_0x12d9fb,_0x5e4378){var _0x2da16d={'raw':!![],'where':{'id':_0x12d9fb[_0x8fbc('0x45')]['id']}},_0x2df1c0={};_0x2df1c0[_0x8fbc('0x2e')]=_['keys'](db[_0x8fbc('0x41')][_0x8fbc('0x2b')]);_0x2df1c0['query']=_[_0x8fbc('0x31')](_0x12d9fb[_0x8fbc('0x30')]);_0x2df1c0[_0x8fbc('0x32')]=_[_0x8fbc('0x33')](_0x2df1c0['model'],_0x2df1c0[_0x8fbc('0x30')]);_0x2da16d['attributes']=_[_0x8fbc('0x33')](_0x2df1c0[_0x8fbc('0x2e')],qs['fields'](_0x12d9fb[_0x8fbc('0x30')][_0x8fbc('0x35')]));_0x2da16d['attributes']=_0x2da16d[_0x8fbc('0x34')]['length']?_0x2da16d['attributes']:_0x2df1c0[_0x8fbc('0x2e')];if(_0x12d9fb[_0x8fbc('0x30')]['includeAll']){_0x2da16d['include']=[{'all':!![]}];}_0x2da16d=_[_0x8fbc('0x3d')]({},_0x2da16d,_0x12d9fb[_0x8fbc('0x3e')]);return db['CannedAnswer']['find'](_0x2da16d)[_0x8fbc('0x26')](handleEntityNotFound(_0x5e4378,null))[_0x8fbc('0x26')](respondWithResult(_0x5e4378,null))[_0x8fbc('0x46')](handleError(_0x5e4378,null));};exports[_0x8fbc('0x47')]=function(_0xcbe79b,_0x5e9dd9){if(_0xcbe79b[_0x8fbc('0x48')]['id']){delete _0xcbe79b['body']['id'];}return db[_0x8fbc('0x41')][_0x8fbc('0x49')]({'where':{'id':_0xcbe79b[_0x8fbc('0x45')]['id']}})['then'](handleEntityNotFound(_0x5e9dd9,null))['then'](saveUpdates(_0xcbe79b[_0x8fbc('0x48')],null))[_0x8fbc('0x26')](respondWithResult(_0x5e9dd9,null))[_0x8fbc('0x46')](handleError(_0x5e9dd9,null));};exports[_0x8fbc('0x25')]=function(_0x4aa8d7,_0x29714d){return db[_0x8fbc('0x41')]['find']({'where':{'id':_0x4aa8d7['params']['id']}})[_0x8fbc('0x26')](handleEntityNotFound(_0x29714d,null))['then'](removeEntity(_0x29714d,null))['catch'](handleError(_0x29714d,null));};exports['create']=function(_0xa18dfe,_0x439ee2){var _0x457947={'key':_0xa18dfe['body']['key']};if(_0xa18dfe[_0x8fbc('0x48')][_0x8fbc('0x4a')]){_0x457947[_0x8fbc('0x4a')]=_0xa18dfe[_0x8fbc('0x48')]['MailAccountId'];}else if(_0xa18dfe[_0x8fbc('0x48')][_0x8fbc('0x4b')]){_0x457947[_0x8fbc('0x4b')]=_0xa18dfe[_0x8fbc('0x48')][_0x8fbc('0x4b')];}else if(_0xa18dfe[_0x8fbc('0x48')]['OpenchannelAccountId']){_0x457947['OpenchannelAccountId']=_0xa18dfe['body'][_0x8fbc('0x4c')];}else if(_0xa18dfe[_0x8fbc('0x48')]['ChatWebsiteId']){_0x457947[_0x8fbc('0x4d')]=_0xa18dfe[_0x8fbc('0x48')][_0x8fbc('0x4d')];}return db[_0x8fbc('0x41')][_0x8fbc('0x49')]({'where':_0x457947})[_0x8fbc('0x26')](function(_0x26ce58){if(_0x26ce58){throw new db[(_0x8fbc('0x4e'))][(_0x8fbc('0x4f'))](_0x8fbc('0x50'));}return db[_0x8fbc('0x41')]['create'](_0xa18dfe[_0x8fbc('0x48')]);})[_0x8fbc('0x26')](function(_0x3135c9){var _0xca4537=_0xa18dfe['user']['get']({'plain':!![]});if(!_0xca4537)throw new Error(_0x8fbc('0x51'));if(_0xca4537[_0x8fbc('0x52')]==='user'){var _0x166126=_0x3135c9[_0x8fbc('0x23')]({'plain':!![]});return db['UserProfileSection'][_0x8fbc('0x49')]({'where':{'name':_0x8fbc('0x24'),'userProfileId':_0xca4537[_0x8fbc('0x53')]},'raw':!![]})['then'](function(_0x2ad0dd){if(_0x2ad0dd&&_0x2ad0dd[_0x8fbc('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x166126['name'],'resourceId':_0x166126['id'],'type':_0x2ad0dd[_0x8fbc('0x29')],'sectionId':_0x2ad0dd['id']},{})[_0x8fbc('0x26')](function(){return _0x3135c9;});}else{return _0x3135c9;}})['catch'](function(_0x230267){logger[_0x8fbc('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x230267);throw _0x230267;});}return _0x3135c9;})[_0x8fbc('0x26')](respondWithResult(_0x439ee2,0xc9))[_0x8fbc('0x46')](handleError(_0x439ee2,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index cb081f7..e2dbc17 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 _0x86e6=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x86e6,0x1c2));var _0x686e=function(_0x25cd96,_0x236b7e){_0x25cd96=_0x25cd96-0x0;var _0x5060a9=_0x86e6[_0x25cd96];return _0x5060a9;};'use strict';var _=require(_0x686e('0x0'));var util=require('util');var logger=require(_0x686e('0x1'))(_0x686e('0x2'));var moment=require(_0x686e('0x3'));var BPromise=require(_0x686e('0x4'));var rp=require(_0x686e('0x5'));var fs=require('fs');var path=require(_0x686e('0x6'));var rimraf=require(_0x686e('0x7'));var config=require('../../config/environment');var attributes=require(_0x686e('0x8'));module[_0x686e('0x9')]=function(_0x148e6d,_0x5672cb){return _0x148e6d[_0x686e('0xa')](_0x686e('0xb'),attributes,{'tableName':_0x686e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x686e('0xd'),'collate':_0x686e('0xe')});}; \ No newline at end of file +var _0x1fc6=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','utf8mb4_unicode_ci','lodash'];(function(_0x9ba57c,_0x5ecc0d){var _0x627a6e=function(_0x3c702d){while(--_0x3c702d){_0x9ba57c['push'](_0x9ba57c['shift']());}};_0x627a6e(++_0x5ecc0d);}(_0x1fc6,0x11f));var _0x61fc=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0x1fc6[_0x378b4];return _0x11d07b;};'use strict';var _=require(_0x61fc('0x0'));var util=require(_0x61fc('0x1'));var logger=require(_0x61fc('0x2'))(_0x61fc('0x3'));var moment=require(_0x61fc('0x4'));var BPromise=require('bluebird');var rp=require(_0x61fc('0x5'));var fs=require('fs');var path=require(_0x61fc('0x6'));var rimraf=require('rimraf');var config=require(_0x61fc('0x7'));var attributes=require(_0x61fc('0x8'));module[_0x61fc('0x9')]=function(_0x1873e3,_0x145d3c){return _0x1873e3['define'](_0x61fc('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x61fc('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 10716dc..2c9bbec 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(_0x12265d,_0x383381){var _0x5961da=function(_0x26acf4){while(--_0x26acf4){_0x12265d['push'](_0x12265d['shift']());}};_0x5961da(++_0x383381);}(_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 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(_0x5e8c03,_0x7cabd9){var _0x473152=function(_0x3c4238){while(--_0x3c4238){_0x5e8c03['push'](_0x5e8c03['shift']());}};_0x473152(++_0x7cabd9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 5b59006..dff0fe4 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 _0x2079=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x22cbe1,_0x356f61){var _0x73f617=function(_0x8fd59e){while(--_0x8fd59e){_0x22cbe1['push'](_0x22cbe1['shift']());}};_0x73f617(++_0x356f61);}(_0x2079,0xe8));var _0x9207=function(_0xb3b187,_0x548ce0){_0xb3b187=_0xb3b187-0x0;var _0x502f3d=_0x2079[_0xb3b187];return _0x502f3d;};'use strict';var multer=require(_0x9207('0x0'));var util=require(_0x9207('0x1'));var path=require(_0x9207('0x2'));var timeout=require(_0x9207('0x3'));var express=require(_0x9207('0x4'));var router=express[_0x9207('0x5')]();var fs_extra=require(_0x9207('0x6'));var auth=require(_0x9207('0x7'));var interaction=require(_0x9207('0x8'));var config=require(_0x9207('0x9'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0x9207('0xa')](),controller[_0x9207('0xb')]);router[_0x9207('0xc')](_0x9207('0xd'),auth[_0x9207('0xa')](),controller['show']);router[_0x9207('0xe')]('/',auth['isAuthenticated'](),controller[_0x9207('0xf')]);router['put'](_0x9207('0xd'),auth[_0x9207('0xa')](),controller[_0x9207('0x10')]);router[_0x9207('0x11')]('/:id',auth[_0x9207('0xa')](),controller[_0x9207('0x12')]);module[_0x9207('0x13')]=router; \ No newline at end of file +var _0x5404=['show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index'];(function(_0x22fd55,_0x5735c5){var _0xa2259e=function(_0x5664d4){while(--_0x5664d4){_0x22fd55['push'](_0x22fd55['shift']());}};_0xa2259e(++_0x5735c5);}(_0x5404,0x13a));var _0x4540=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5404[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x4540('0x0'));var util=require(_0x4540('0x1'));var path=require(_0x4540('0x2'));var timeout=require(_0x4540('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4540('0x4'));var config=require('../../config/environment');var controller=require(_0x4540('0x5'));router[_0x4540('0x6')]('/',auth[_0x4540('0x7')](),controller[_0x4540('0x8')]);router[_0x4540('0x6')]('/:id',auth[_0x4540('0x7')](),controller[_0x4540('0x9')]);router[_0x4540('0xa')]('/',auth[_0x4540('0x7')](),controller[_0x4540('0xb')]);router[_0x4540('0xc')](_0x4540('0xd'),auth[_0x4540('0x7')](),controller[_0x4540('0xe')]);router['delete'](_0x4540('0xd'),auth['isAuthenticated'](),controller[_0x4540('0xf')]);module[_0x4540('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 7b5531f..55dd24d 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 _0xbe0f=['exports','STRING','INTEGER','sequelize'];(function(_0x284531,_0x345bdb){var _0x28cd85=function(_0x5b7632){while(--_0x5b7632){_0x284531['push'](_0x284531['shift']());}};_0x28cd85(++_0x345bdb);}(_0xbe0f,0x1d3));var _0xfbe0=function(_0x4f96ac,_0x18dc01){_0x4f96ac=_0x4f96ac-0x0;var _0x33bd52=_0xbe0f[_0x4f96ac];return _0x33bd52;};'use strict';var Sequelize=require(_0xfbe0('0x0'));module[_0xfbe0('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xfbe0('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xfbe0('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xfbe0('0x2')]},'dstchannel':{'type':Sequelize[_0xfbe0('0x2')]},'lastapp':{'type':Sequelize[_0xfbe0('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xfbe0('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xfbe0('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xfbe0('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xfbe0('0x2')]},'userfield':{'type':Sequelize[_0xfbe0('0x2')]},'uniqueid':{'type':Sequelize[_0xfbe0('0x2')]},'linkedid':{'type':Sequelize[_0xfbe0('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xfbe0('0x2')]},'type':{'type':Sequelize[_0xfbe0('0x2')]},'tag':{'type':Sequelize[_0xfbe0('0x2')]}}; \ No newline at end of file +var _0x91ff=['STRING','INTEGER','DATE'];(function(_0x4a563b,_0x36f42d){var _0x2935ef=function(_0x32593f){while(--_0x32593f){_0x4a563b['push'](_0x4a563b['shift']());}};_0x2935ef(++_0x36f42d);}(_0x91ff,0x15b));var _0xf91f=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x91ff[_0x387777];return _0x3f84c0;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0xf91f('0x0')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xf91f('0x1')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xf91f('0x1')]},'dcontext':{'type':Sequelize[_0xf91f('0x1')]},'channel':{'type':Sequelize[_0xf91f('0x1')]},'dstchannel':{'type':Sequelize[_0xf91f('0x1')]},'lastapp':{'type':Sequelize[_0xf91f('0x1')]},'lastdata':{'type':Sequelize[_0xf91f('0x1')]},'duration':{'type':Sequelize[_0xf91f('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf91f('0x1')]},'amaflags':{'type':Sequelize[_0xf91f('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xf91f('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xf91f('0x1')]},'sequence':{'type':Sequelize[_0xf91f('0x1')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf91f('0x1')]},'tag':{'type':Sequelize[_0xf91f('0x1')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index b23b21e..1b33672 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 _0xf725=['save','update','then','destroy','error','stack','name','send','index','map','Cdr','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','keys','rawAttributes','length','include','catch','create','body','find','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','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x51d182,_0x5565ff){var _0x31d025=function(_0x312539){while(--_0x312539){_0x51d182['push'](_0x51d182['shift']());}};_0x31d025(++_0x5565ff);}(_0xf725,0x7e));var _0x5f72=function(_0x2b859d,_0x1d36f0){_0x2b859d=_0x2b859d-0x0;var _0x30bde3=_0xf725[_0x2b859d];return _0x30bde3;};'use strict';var emlformat=require(_0x5f72('0x0'));var rimraf=require(_0x5f72('0x1'));var zipdir=require(_0x5f72('0x2'));var jsonpatch=require(_0x5f72('0x3'));var rp=require(_0x5f72('0x4'));var moment=require(_0x5f72('0x5'));var BPromise=require(_0x5f72('0x6'));var Mustache=require(_0x5f72('0x7'));var util=require(_0x5f72('0x8'));var path=require(_0x5f72('0x9'));var sox=require('sox');var csv=require(_0x5f72('0xa'));var ejs=require(_0x5f72('0xb'));var fs=require('fs');var fs_extra=require(_0x5f72('0xc'));var _=require(_0x5f72('0xd'));var squel=require(_0x5f72('0xe'));var crypto=require(_0x5f72('0xf'));var jsforce=require(_0x5f72('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5f72('0x11'));var Papa=require(_0x5f72('0x12'));var Redis=require('ioredis');var authService=require(_0x5f72('0x13'));var qs=require(_0x5f72('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f72('0x15'));var logger=require(_0x5f72('0x16'))(_0x5f72('0x17'));var utils=require(_0x5f72('0x18'));var config=require(_0x5f72('0x19'));var licenseUtil=require(_0x5f72('0x1a'));var db=require(_0x5f72('0x1b'))['db'];function respondWithStatusCode(_0x537d7d,_0x1ac591){_0x1ac591=_0x1ac591||0xcc;return function(_0x3307ed){if(_0x3307ed){return _0x537d7d[_0x5f72('0x1c')](_0x1ac591);}return _0x537d7d[_0x5f72('0x1d')](_0x1ac591)[_0x5f72('0x1e')]();};}function respondWithResult(_0x57007a,_0x43d1fd){_0x43d1fd=_0x43d1fd||0xc8;return function(_0x4f81e9){if(_0x4f81e9){return _0x57007a['status'](_0x43d1fd)[_0x5f72('0x1f')](_0x4f81e9);}};}function respondWithFilteredResult(_0x5a036c,_0x3267a){return function(_0x4adc76){if(_0x4adc76){var _0x317eed=typeof _0x3267a['offset']===_0x5f72('0x20')&&typeof _0x3267a[_0x5f72('0x21')]==='undefined';var _0xea99d5=_0x4adc76[_0x5f72('0x22')];var _0x1497d4=_0x317eed?0x0:_0x3267a['offset'];var _0x490d14=_0x317eed?_0x4adc76['count']:_0x3267a[_0x5f72('0x23')]+_0x3267a[_0x5f72('0x21')];var _0x269dae;if(_0x490d14>=_0xea99d5){_0x490d14=_0xea99d5;_0x269dae=0xc8;}else{_0x269dae=0xce;}_0x5a036c[_0x5f72('0x1d')](_0x269dae);return _0x5a036c[_0x5f72('0x24')](_0x5f72('0x25'),_0x1497d4+'-'+_0x490d14+'/'+_0xea99d5)[_0x5f72('0x1f')](_0x4adc76);}return null;};}function patchUpdates(_0x5859fc){return function(_0x151a67){try{jsonpatch[_0x5f72('0x26')](_0x151a67,_0x5859fc,!![]);}catch(_0xd6dff9){return BPromise[_0x5f72('0x27')](_0xd6dff9);}return _0x151a67[_0x5f72('0x28')]();};}function saveUpdates(_0x2c599a,_0x30235e){return function(_0x367716){if(_0x367716){return _0x367716[_0x5f72('0x29')](_0x2c599a)[_0x5f72('0x2a')](function(_0x21c7d2){return _0x21c7d2;});}return null;};}function removeEntity(_0x530009,_0x433935){return function(_0x21f4a3){if(_0x21f4a3){return _0x21f4a3[_0x5f72('0x2b')]()[_0x5f72('0x2a')](function(){_0x530009['status'](0xcc)[_0x5f72('0x1e')]();});}};}function handleEntityNotFound(_0x3d05bc,_0x5c3325){return function(_0x447019){if(!_0x447019){_0x3d05bc[_0x5f72('0x1c')](0x194);}return _0x447019;};}function handleError(_0x347723,_0x521174){_0x521174=_0x521174||0x1f4;return function(_0x58ff77){logger[_0x5f72('0x2c')](_0x58ff77[_0x5f72('0x2d')]);if(_0x58ff77[_0x5f72('0x2e')]){delete _0x58ff77[_0x5f72('0x2e')];}_0x347723[_0x5f72('0x1d')](_0x521174)[_0x5f72('0x2f')](_0x58ff77);};}exports[_0x5f72('0x30')]=function(_0x59af82,_0x1b12cd){var _0x49eea5={},_0xc8ca5a={},_0x35fa31={'count':0x0,'rows':[]};var _0x7cce31=_[_0x5f72('0x31')](db[_0x5f72('0x32')]['rawAttributes'],function(_0x502057){return{'name':_0x502057[_0x5f72('0x33')],'type':_0x502057[_0x5f72('0x34')][_0x5f72('0x35')]};});_0xc8ca5a[_0x5f72('0x36')]=_[_0x5f72('0x31')](_0x7cce31,_0x5f72('0x2e'));_0xc8ca5a[_0x5f72('0x37')]=_['keys'](_0x59af82[_0x5f72('0x37')]);_0xc8ca5a[_0x5f72('0x38')]=_[_0x5f72('0x39')](_0xc8ca5a[_0x5f72('0x36')],_0xc8ca5a[_0x5f72('0x37')]);_0x49eea5['attributes']=_[_0x5f72('0x39')](_0xc8ca5a[_0x5f72('0x36')],qs[_0x5f72('0x3a')](_0x59af82[_0x5f72('0x37')][_0x5f72('0x3a')]));_0x49eea5[_0x5f72('0x3b')]=_0x49eea5['attributes']['length']?_0x49eea5[_0x5f72('0x3b')]:_0xc8ca5a[_0x5f72('0x36')];if(!_0x59af82['query'][_0x5f72('0x3c')](_0x5f72('0x3d'))){_0x49eea5[_0x5f72('0x21')]=qs[_0x5f72('0x21')](_0x59af82[_0x5f72('0x37')][_0x5f72('0x21')]);_0x49eea5[_0x5f72('0x23')]=qs[_0x5f72('0x23')](_0x59af82[_0x5f72('0x37')][_0x5f72('0x23')]);}_0x49eea5[_0x5f72('0x3e')]=qs[_0x5f72('0x3f')](_0x59af82[_0x5f72('0x37')][_0x5f72('0x3f')]);_0x49eea5['where']=qs[_0x5f72('0x38')](_['pick'](_0x59af82['query'],_0xc8ca5a[_0x5f72('0x38')]),_0x7cce31);if(_0x59af82[_0x5f72('0x37')][_0x5f72('0x40')]){_0x49eea5[_0x5f72('0x41')]=_[_0x5f72('0x42')](_0x49eea5[_0x5f72('0x41')],{'$or':_['map'](_0x7cce31,function(_0x1b9692){if(_0x1b9692[_0x5f72('0x34')]!==_0x5f72('0x43')){var _0x40d988={};_0x40d988[_0x1b9692[_0x5f72('0x2e')]]={'$like':'%'+_0x59af82[_0x5f72('0x37')][_0x5f72('0x40')]+'%'};return _0x40d988;}})});}_0x49eea5=_[_0x5f72('0x42')]({},_0x49eea5,_0x59af82[_0x5f72('0x44')]);var _0x2b8549={'where':_0x49eea5[_0x5f72('0x41')]};return db[_0x5f72('0x32')][_0x5f72('0x22')](_0x2b8549)[_0x5f72('0x2a')](function(_0xefdf17){_0x35fa31['count']=_0xefdf17;if(_0x59af82['query'][_0x5f72('0x45')]){_0x49eea5['include']=[{'all':!![]}];}return db['Cdr'][_0x5f72('0x46')](_0x49eea5);})[_0x5f72('0x2a')](function(_0x57d320){_0x35fa31[_0x5f72('0x47')]=_0x57d320;return _0x35fa31;})[_0x5f72('0x2a')](respondWithFilteredResult(_0x1b12cd,_0x49eea5))['catch'](handleError(_0x1b12cd,null));};exports[_0x5f72('0x48')]=function(_0x2314ea,_0x4f2d4a){var _0xcfefc5={'raw':!![],'where':{'id':_0x2314ea['params']['id']}},_0x4f57a6={};_0x4f57a6[_0x5f72('0x36')]=_[_0x5f72('0x49')](db[_0x5f72('0x32')][_0x5f72('0x4a')]);_0x4f57a6[_0x5f72('0x37')]=_[_0x5f72('0x49')](_0x2314ea[_0x5f72('0x37')]);_0x4f57a6['filters']=_[_0x5f72('0x39')](_0x4f57a6[_0x5f72('0x36')],_0x4f57a6[_0x5f72('0x37')]);_0xcfefc5[_0x5f72('0x3b')]=_['intersection'](_0x4f57a6[_0x5f72('0x36')],qs[_0x5f72('0x3a')](_0x2314ea[_0x5f72('0x37')][_0x5f72('0x3a')]));_0xcfefc5['attributes']=_0xcfefc5[_0x5f72('0x3b')][_0x5f72('0x4b')]?_0xcfefc5[_0x5f72('0x3b')]:_0x4f57a6[_0x5f72('0x36')];if(_0x2314ea['query'][_0x5f72('0x45')]){_0xcfefc5[_0x5f72('0x4c')]=[{'all':!![]}];}_0xcfefc5=_['merge']({},_0xcfefc5,_0x2314ea[_0x5f72('0x44')]);return db[_0x5f72('0x32')]['find'](_0xcfefc5)[_0x5f72('0x2a')](handleEntityNotFound(_0x4f2d4a,null))[_0x5f72('0x2a')](respondWithResult(_0x4f2d4a,null))[_0x5f72('0x4d')](handleError(_0x4f2d4a,null));};exports['create']=function(_0xc30598,_0x5efa48){return db[_0x5f72('0x32')][_0x5f72('0x4e')](_0xc30598['body'],{})[_0x5f72('0x2a')](respondWithResult(_0x5efa48,0xc9))[_0x5f72('0x4d')](handleError(_0x5efa48,null));};exports[_0x5f72('0x29')]=function(_0x302fff,_0x506774){if(_0x302fff[_0x5f72('0x4f')]['id']){delete _0x302fff[_0x5f72('0x4f')]['id'];}return db[_0x5f72('0x32')][_0x5f72('0x50')]({'where':{'id':_0x302fff['params']['id']}})[_0x5f72('0x2a')](handleEntityNotFound(_0x506774,null))['then'](saveUpdates(_0x302fff[_0x5f72('0x4f')],null))[_0x5f72('0x2a')](respondWithResult(_0x506774,null))[_0x5f72('0x4d')](handleError(_0x506774,null));};exports[_0x5f72('0x2b')]=function(_0x142089,_0x3f071c){return db[_0x5f72('0x32')][_0x5f72('0x50')]({'where':{'id':_0x142089[_0x5f72('0x51')]['id']}})[_0x5f72('0x2a')](handleEntityNotFound(_0x3f071c,null))['then'](removeEntity(_0x3f071c,null))[_0x5f72('0x4d')](handleError(_0x3f071c,null));};exports[_0x5f72('0x52')]=function(_0x5c5d94,_0x30e03){return db[_0x5f72('0x32')]['describe']()[_0x5f72('0x2a')](respondWithResult(_0x30e03,null))[_0x5f72('0x4d')](handleError(_0x30e03,null));}; \ No newline at end of file +var _0xa0a1=['querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','set','apply','reject','then','destroy','end','error','stack','name','send','index','Cdr','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','keys','options','create','body','update','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x544832,_0x2b8cfb){var _0x19c757=function(_0x5f213e){while(--_0x5f213e){_0x544832['push'](_0x544832['shift']());}};_0x19c757(++_0x2b8cfb);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x34cef7,_0x52293f){_0x34cef7=_0x34cef7-0x0;var _0x8f7873=_0xa0a1[_0x34cef7];return _0x8f7873;};'use strict';var emlformat=require(_0x1a0a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a0a('0x1'));var jsonpatch=require(_0x1a0a('0x2'));var rp=require(_0x1a0a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1a0a('0x4'));var util=require(_0x1a0a('0x5'));var path=require('path');var sox=require(_0x1a0a('0x6'));var csv=require(_0x1a0a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a0a('0x8'));var _=require(_0x1a0a('0x9'));var squel=require(_0x1a0a('0xa'));var crypto=require(_0x1a0a('0xb'));var jsforce=require(_0x1a0a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1a0a('0x7'));var querystring=require(_0x1a0a('0xd'));var Papa=require(_0x1a0a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1a0a('0xf'));var hardwareService=require(_0x1a0a('0x10'));var logger=require(_0x1a0a('0x11'))('api');var utils=require(_0x1a0a('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1a0a('0x13'));var db=require(_0x1a0a('0x14'))['db'];function respondWithStatusCode(_0x461b36,_0x1877bf){_0x1877bf=_0x1877bf||0xcc;return function(_0x289046){if(_0x289046){return _0x461b36[_0x1a0a('0x15')](_0x1877bf);}return _0x461b36[_0x1a0a('0x16')](_0x1877bf)['end']();};}function respondWithResult(_0x88d191,_0x3b0b2d){_0x3b0b2d=_0x3b0b2d||0xc8;return function(_0x3c531c){if(_0x3c531c){return _0x88d191[_0x1a0a('0x16')](_0x3b0b2d)[_0x1a0a('0x17')](_0x3c531c);}};}function respondWithFilteredResult(_0x4c8080,_0x16b8c9){return function(_0x80627b){if(_0x80627b){var _0x157b74=typeof _0x16b8c9['offset']===_0x1a0a('0x18')&&typeof _0x16b8c9['limit']===_0x1a0a('0x18');var _0x57f65d=_0x80627b['count'];var _0x3a988c=_0x157b74?0x0:_0x16b8c9[_0x1a0a('0x19')];var _0x307fdc=_0x157b74?_0x80627b[_0x1a0a('0x1a')]:_0x16b8c9['offset']+_0x16b8c9['limit'];var _0x239065;if(_0x307fdc>=_0x57f65d){_0x307fdc=_0x57f65d;_0x239065=0xc8;}else{_0x239065=0xce;}_0x4c8080[_0x1a0a('0x16')](_0x239065);return _0x4c8080[_0x1a0a('0x1b')]('Content-Range',_0x3a988c+'-'+_0x307fdc+'/'+_0x57f65d)[_0x1a0a('0x17')](_0x80627b);}return null;};}function patchUpdates(_0x3547fe){return function(_0x5bb4bd){try{jsonpatch[_0x1a0a('0x1c')](_0x5bb4bd,_0x3547fe,!![]);}catch(_0x1ba27f){return BPromise[_0x1a0a('0x1d')](_0x1ba27f);}return _0x5bb4bd['save']();};}function saveUpdates(_0x159a2a,_0xc33284){return function(_0x1f4083){if(_0x1f4083){return _0x1f4083['update'](_0x159a2a)[_0x1a0a('0x1e')](function(_0x47ef88){return _0x47ef88;});}return null;};}function removeEntity(_0x28c094,_0x2d426d){return function(_0x2d7967){if(_0x2d7967){return _0x2d7967[_0x1a0a('0x1f')]()[_0x1a0a('0x1e')](function(){_0x28c094['status'](0xcc)[_0x1a0a('0x20')]();});}};}function handleEntityNotFound(_0x8e4151,_0x561407){return function(_0x4cf939){if(!_0x4cf939){_0x8e4151[_0x1a0a('0x15')](0x194);}return _0x4cf939;};}function handleError(_0x184de8,_0x3f61e4){_0x3f61e4=_0x3f61e4||0x1f4;return function(_0x365ab5){logger[_0x1a0a('0x21')](_0x365ab5[_0x1a0a('0x22')]);if(_0x365ab5[_0x1a0a('0x23')]){delete _0x365ab5[_0x1a0a('0x23')];}_0x184de8[_0x1a0a('0x16')](_0x3f61e4)[_0x1a0a('0x24')](_0x365ab5);};}exports[_0x1a0a('0x25')]=function(_0x35fd0a,_0x354d89){var _0x385f2b={},_0x396c01={},_0x3069ab={'count':0x0,'rows':[]};var _0x297b12=_['map'](db[_0x1a0a('0x26')][_0x1a0a('0x27')],function(_0x36ca44){return{'name':_0x36ca44[_0x1a0a('0x28')],'type':_0x36ca44[_0x1a0a('0x29')][_0x1a0a('0x2a')]};});_0x396c01[_0x1a0a('0x2b')]=_[_0x1a0a('0x2c')](_0x297b12,_0x1a0a('0x23'));_0x396c01[_0x1a0a('0x2d')]=_['keys'](_0x35fd0a[_0x1a0a('0x2d')]);_0x396c01[_0x1a0a('0x2e')]=_['intersection'](_0x396c01[_0x1a0a('0x2b')],_0x396c01['query']);_0x385f2b['attributes']=_[_0x1a0a('0x2f')](_0x396c01[_0x1a0a('0x2b')],qs['fields'](_0x35fd0a[_0x1a0a('0x2d')][_0x1a0a('0x30')]));_0x385f2b[_0x1a0a('0x31')]=_0x385f2b['attributes'][_0x1a0a('0x32')]?_0x385f2b[_0x1a0a('0x31')]:_0x396c01['model'];if(!_0x35fd0a[_0x1a0a('0x2d')][_0x1a0a('0x33')]('nolimit')){_0x385f2b[_0x1a0a('0x34')]=qs[_0x1a0a('0x34')](_0x35fd0a[_0x1a0a('0x2d')][_0x1a0a('0x34')]);_0x385f2b['offset']=qs[_0x1a0a('0x19')](_0x35fd0a[_0x1a0a('0x2d')][_0x1a0a('0x19')]);}_0x385f2b[_0x1a0a('0x35')]=qs[_0x1a0a('0x36')](_0x35fd0a[_0x1a0a('0x2d')][_0x1a0a('0x36')]);_0x385f2b[_0x1a0a('0x37')]=qs[_0x1a0a('0x2e')](_['pick'](_0x35fd0a['query'],_0x396c01['filters']),_0x297b12);if(_0x35fd0a['query'][_0x1a0a('0x38')]){_0x385f2b['where']=_[_0x1a0a('0x39')](_0x385f2b[_0x1a0a('0x37')],{'$or':_['map'](_0x297b12,function(_0x5f586c){if(_0x5f586c[_0x1a0a('0x29')]!==_0x1a0a('0x3a')){var _0x13042e={};_0x13042e[_0x5f586c[_0x1a0a('0x23')]]={'$like':'%'+_0x35fd0a['query'][_0x1a0a('0x38')]+'%'};return _0x13042e;}})});}_0x385f2b=_['merge']({},_0x385f2b,_0x35fd0a['options']);var _0x4852e8={'where':_0x385f2b[_0x1a0a('0x37')]};return db[_0x1a0a('0x26')]['count'](_0x4852e8)[_0x1a0a('0x1e')](function(_0x2dcda5){_0x3069ab['count']=_0x2dcda5;if(_0x35fd0a['query'][_0x1a0a('0x3b')]){_0x385f2b[_0x1a0a('0x3c')]=[{'all':!![]}];}return db['Cdr'][_0x1a0a('0x3d')](_0x385f2b);})[_0x1a0a('0x1e')](function(_0x56cfd6){_0x3069ab[_0x1a0a('0x3e')]=_0x56cfd6;return _0x3069ab;})['then'](respondWithFilteredResult(_0x354d89,_0x385f2b))[_0x1a0a('0x3f')](handleError(_0x354d89,null));};exports['show']=function(_0x2dfcfb,_0x7b6e14){var _0x3466f6={'raw':!![],'where':{'id':_0x2dfcfb['params']['id']}},_0x2a72b7={};_0x2a72b7[_0x1a0a('0x2b')]=_[_0x1a0a('0x40')](db[_0x1a0a('0x26')][_0x1a0a('0x27')]);_0x2a72b7['query']=_[_0x1a0a('0x40')](_0x2dfcfb[_0x1a0a('0x2d')]);_0x2a72b7['filters']=_[_0x1a0a('0x2f')](_0x2a72b7[_0x1a0a('0x2b')],_0x2a72b7[_0x1a0a('0x2d')]);_0x3466f6[_0x1a0a('0x31')]=_[_0x1a0a('0x2f')](_0x2a72b7[_0x1a0a('0x2b')],qs[_0x1a0a('0x30')](_0x2dfcfb[_0x1a0a('0x2d')][_0x1a0a('0x30')]));_0x3466f6[_0x1a0a('0x31')]=_0x3466f6['attributes'][_0x1a0a('0x32')]?_0x3466f6[_0x1a0a('0x31')]:_0x2a72b7['model'];if(_0x2dfcfb['query']['includeAll']){_0x3466f6['include']=[{'all':!![]}];}_0x3466f6=_[_0x1a0a('0x39')]({},_0x3466f6,_0x2dfcfb[_0x1a0a('0x41')]);return db['Cdr']['find'](_0x3466f6)['then'](handleEntityNotFound(_0x7b6e14,null))[_0x1a0a('0x1e')](respondWithResult(_0x7b6e14,null))[_0x1a0a('0x3f')](handleError(_0x7b6e14,null));};exports[_0x1a0a('0x42')]=function(_0x2c58a9,_0x4678da){return db[_0x1a0a('0x26')][_0x1a0a('0x42')](_0x2c58a9[_0x1a0a('0x43')],{})[_0x1a0a('0x1e')](respondWithResult(_0x4678da,0xc9))[_0x1a0a('0x3f')](handleError(_0x4678da,null));};exports[_0x1a0a('0x44')]=function(_0x2bab64,_0x23a985){if(_0x2bab64['body']['id']){delete _0x2bab64[_0x1a0a('0x43')]['id'];}return db[_0x1a0a('0x26')][_0x1a0a('0x45')]({'where':{'id':_0x2bab64['params']['id']}})[_0x1a0a('0x1e')](handleEntityNotFound(_0x23a985,null))[_0x1a0a('0x1e')](saveUpdates(_0x2bab64['body'],null))[_0x1a0a('0x1e')](respondWithResult(_0x23a985,null))[_0x1a0a('0x3f')](handleError(_0x23a985,null));};exports['destroy']=function(_0x555b6d,_0x313e79){return db['Cdr']['find']({'where':{'id':_0x555b6d[_0x1a0a('0x46')]['id']}})['then'](handleEntityNotFound(_0x313e79,null))[_0x1a0a('0x1e')](removeEntity(_0x313e79,null))[_0x1a0a('0x3f')](handleError(_0x313e79,null));};exports[_0x1a0a('0x47')]=function(_0x3678c7,_0x22a0f9){return db[_0x1a0a('0x26')][_0x1a0a('0x47')]()[_0x1a0a('0x1e')](respondWithResult(_0x22a0f9,null))[_0x1a0a('0x3f')](handleError(_0x22a0f9,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 2c715f4..60064f6 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(_0x10015a,_0x34f9e8){var _0x479049=function(_0x1356e3){while(--_0x1356e3){_0x10015a['push'](_0x10015a['shift']());}};_0x479049(++_0x34f9e8);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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(_0x3c262a,_0x6cfa16){var _0x259ea1=function(_0x2fc847){while(--_0x2fc847){_0x3c262a['push'](_0x3c262a['shift']());}};_0x259ea1(++_0x6cfa16);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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 dfa3099..ffc4940 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 _0x8043=['Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','code','error','message','catch','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info'];(function(_0x4fa970,_0x4a2655){var _0x50094c=function(_0x1593f9){while(--_0x1593f9){_0x4fa970['push'](_0x4fa970['shift']());}};_0x50094c(++_0x4a2655);}(_0x8043,0x182));var _0x3804=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x8043[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0x3804('0x0'));var util=require('util');var moment=require(_0x3804('0x1'));var BPromise=require(_0x3804('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3804('0x3'));var logger=require(_0x3804('0x4'))(_0x3804('0x5'));var config=require(_0x3804('0x6'));var jayson=require(_0x3804('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3148e4,_0x588bd7,_0x66847e){return new BPromise(function(_0x35d4f1,_0x21b591){return client['request'](_0x3148e4,_0x66847e)[_0x3804('0x8')](function(_0x5d27f4){logger[_0x3804('0x9')](_0x3804('0xa'),_0x588bd7,_0x3804('0xb'));logger[_0x3804('0xc')](_0x3804('0xd'),_0x588bd7,_0x3804('0xb'),JSON['stringify'](_0x5d27f4));if(_0x5d27f4['error']){if(_0x5d27f4['error'][_0x3804('0xe')]===0x1f4){logger[_0x3804('0xf')](_0x3804('0xa'),_0x588bd7,_0x5d27f4[_0x3804('0xf')][_0x3804('0x10')]);return _0x21b591(_0x5d27f4[_0x3804('0xf')][_0x3804('0x10')]);}logger[_0x3804('0xf')](_0x3804('0xa'),_0x588bd7,_0x5d27f4[_0x3804('0xf')][_0x3804('0x10')]);return _0x35d4f1(_0x5d27f4['error']['message']);}else{logger[_0x3804('0x9')](_0x3804('0xa'),_0x588bd7,_0x3804('0xb'));_0x35d4f1(_0x5d27f4['result'][_0x3804('0x10')]);}})[_0x3804('0x11')](function(_0xdbb6eb){logger[_0x3804('0xf')]('Cdr,\x20%s,\x20%s',_0x588bd7,_0xdbb6eb);_0x21b591(_0xdbb6eb);});});} \ No newline at end of file +var _0xfb36=['then','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Cdr,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x40ce3e,_0x385f40){var _0x4a7296=function(_0x5f236b){while(--_0x5f236b){_0x40ce3e['push'](_0x40ce3e['shift']());}};_0x4a7296(++_0x385f40);}(_0xfb36,0x93));var _0x6fb3=function(_0x55ab31,_0x2881e9){_0x55ab31=_0x55ab31-0x0;var _0x2eefc3=_0xfb36[_0x55ab31];return _0x2eefc3;};'use strict';var _=require(_0x6fb3('0x0'));var util=require(_0x6fb3('0x1'));var moment=require(_0x6fb3('0x2'));var BPromise=require(_0x6fb3('0x3'));var rs=require(_0x6fb3('0x4'));var fs=require('fs');var Redis=require(_0x6fb3('0x5'));var db=require(_0x6fb3('0x6'))['db'];var utils=require(_0x6fb3('0x7'));var logger=require(_0x6fb3('0x8'))(_0x6fb3('0x9'));var config=require('../../config/environment');var jayson=require(_0x6fb3('0xa'));var client=jayson[_0x6fb3('0xb')][_0x6fb3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c054d,_0x208e28,_0x338b7d){return new BPromise(function(_0x11ab55,_0x281ba4){return client[_0x6fb3('0xd')](_0x3c054d,_0x338b7d)[_0x6fb3('0xe')](function(_0x5c6fc7){logger['info']('Cdr,\x20%s,\x20%s',_0x208e28,'request\x20sent');logger[_0x6fb3('0xf')](_0x6fb3('0x10'),_0x208e28,_0x6fb3('0x11'),JSON['stringify'](_0x5c6fc7));if(_0x5c6fc7[_0x6fb3('0x12')]){if(_0x5c6fc7['error'][_0x6fb3('0x13')]===0x1f4){logger[_0x6fb3('0x12')](_0x6fb3('0x14'),_0x208e28,_0x5c6fc7[_0x6fb3('0x12')][_0x6fb3('0x15')]);return _0x281ba4(_0x5c6fc7[_0x6fb3('0x12')][_0x6fb3('0x15')]);}logger[_0x6fb3('0x12')]('Cdr,\x20%s,\x20%s',_0x208e28,_0x5c6fc7['error'][_0x6fb3('0x15')]);return _0x11ab55(_0x5c6fc7['error'][_0x6fb3('0x15')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x208e28,_0x6fb3('0x11'));_0x11ab55(_0x5c6fc7['result'][_0x6fb3('0x15')]);}})[_0x6fb3('0x16')](function(_0x4418cd){logger['error'](_0x6fb3('0x14'),_0x208e28,_0x4418cd);_0x281ba4(_0x4418cd);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index a644b5b..c577412 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x5930aa,_0xf07ae){var _0x274e6c=function(_0x4dbb3b){while(--_0x4dbb3b){_0x5930aa['push'](_0x5930aa['shift']());}};_0x274e6c(++_0xf07ae);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x568c73,_0xb1cd74){var _0x42f893=function(_0x20c08){while(--_0x20c08){_0x568c73['push'](_0x568c73['shift']());}};_0x42f893(++_0xb1cd74);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0xb10b[_0x3ce2c4];return _0x4047c1;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index f82a683..417753d 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 _0x9952=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x53ac70,_0x2c5cec){var _0x25450b=function(_0x3aa64d){while(--_0x3aa64d){_0x53ac70['push'](_0x53ac70['shift']());}};_0x25450b(++_0x2c5cec);}(_0x9952,0xcb));var _0x2995=function(_0x333714,_0x3370ac){_0x333714=_0x333714-0x0;var _0x4c211e=_0x9952[_0x333714];return _0x4c211e;};'use strict';var Sequelize=require(_0x2995('0x0'));module[_0x2995('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2995('0x2')],'allowNull':![],'defaultValue':_0x2995('0x3')},'appdata':{'type':Sequelize[_0x2995('0x4')]()},'description':{'type':Sequelize[_0x2995('0x2')]},'interval':{'type':Sequelize[_0x2995('0x2')],'defaultValue':_0x2995('0x5')}}; \ No newline at end of file +var _0x7d49=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x9f7498,_0x536073){var _0x51fb51=function(_0x43846b){while(--_0x43846b){_0x9f7498['push'](_0x9f7498['shift']());}};_0x51fb51(++_0x536073);}(_0x7d49,0x1c5));var _0x97d4=function(_0x49ae1b,_0x3ba84f){_0x49ae1b=_0x49ae1b-0x0;var _0x3c1df7=_0x7d49[_0x49ae1b];return _0x3c1df7;};'use strict';var Sequelize=require(_0x97d4('0x0'));module[_0x97d4('0x1')]={'priority':{'type':Sequelize[_0x97d4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x97d4('0x3')],'allowNull':![],'defaultValue':_0x97d4('0x4')},'appdata':{'type':Sequelize[_0x97d4('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x97d4('0x3')],'defaultValue':_0x97d4('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 2cd3f90..bd84b46 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 _0x5088=['mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','name','send','params','keys','ChatApplication','query','filters','model','intersection','fields','attributes','length','includeAll','include','merge','find','update','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x50f5f9,_0x3df513){var _0x5738ef=function(_0x142616){while(--_0x142616){_0x50f5f9['push'](_0x50f5f9['shift']());}};_0x5738ef(++_0x3df513);}(_0x5088,0xa9));var _0x8508=function(_0x36a5d0,_0x477b0f){_0x36a5d0=_0x36a5d0-0x0;var _0x2b0076=_0x5088[_0x36a5d0];return _0x2b0076;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8508('0x0'));var zipdir=require(_0x8508('0x1'));var jsonpatch=require(_0x8508('0x2'));var rp=require(_0x8508('0x3'));var moment=require('moment');var BPromise=require(_0x8508('0x4'));var Mustache=require(_0x8508('0x5'));var util=require(_0x8508('0x6'));var path=require(_0x8508('0x7'));var sox=require('sox');var csv=require(_0x8508('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8508('0x9'));var _=require(_0x8508('0xa'));var squel=require('squel');var crypto=require(_0x8508('0xb'));var jsforce=require(_0x8508('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8508('0x8'));var querystring=require(_0x8508('0xd'));var Papa=require(_0x8508('0xe'));var Redis=require(_0x8508('0xf'));var authService=require(_0x8508('0x10'));var qs=require(_0x8508('0x11'));var as=require(_0x8508('0x12'));var hardwareService=require(_0x8508('0x13'));var logger=require(_0x8508('0x14'))('api');var utils=require(_0x8508('0x15'));var config=require(_0x8508('0x16'));var licenseUtil=require(_0x8508('0x17'));var db=require(_0x8508('0x18'))['db'];function respondWithStatusCode(_0x184f08,_0x129d4c){_0x129d4c=_0x129d4c||0xcc;return function(_0x2a6969){if(_0x2a6969){return _0x184f08['sendStatus'](_0x129d4c);}return _0x184f08[_0x8508('0x19')](_0x129d4c)[_0x8508('0x1a')]();};}function respondWithResult(_0x1d64a7,_0x431b14){_0x431b14=_0x431b14||0xc8;return function(_0x4c4bf9){if(_0x4c4bf9){return _0x1d64a7[_0x8508('0x19')](_0x431b14)[_0x8508('0x1b')](_0x4c4bf9);}};}function respondWithFilteredResult(_0x5b1b8d,_0x34da29){return function(_0x4f81c7){if(_0x4f81c7){var _0xe8daa7=typeof _0x34da29[_0x8508('0x1c')]===_0x8508('0x1d')&&typeof _0x34da29[_0x8508('0x1e')]===_0x8508('0x1d');var _0x5668d3=_0x4f81c7[_0x8508('0x1f')];var _0x12a592=_0xe8daa7?0x0:_0x34da29['offset'];var _0x53621f=_0xe8daa7?_0x4f81c7[_0x8508('0x1f')]:_0x34da29['offset']+_0x34da29[_0x8508('0x1e')];var _0x3a8832;if(_0x53621f>=_0x5668d3){_0x53621f=_0x5668d3;_0x3a8832=0xc8;}else{_0x3a8832=0xce;}_0x5b1b8d[_0x8508('0x19')](_0x3a8832);return _0x5b1b8d['set'](_0x8508('0x20'),_0x12a592+'-'+_0x53621f+'/'+_0x5668d3)[_0x8508('0x1b')](_0x4f81c7);}return null;};}function patchUpdates(_0x245f8c){return function(_0x1da402){try{jsonpatch[_0x8508('0x21')](_0x1da402,_0x245f8c,!![]);}catch(_0x2d041e){return BPromise[_0x8508('0x22')](_0x2d041e);}return _0x1da402[_0x8508('0x23')]();};}function saveUpdates(_0x266b93,_0x34ee74){return function(_0x455594){if(_0x455594){return _0x455594['update'](_0x266b93)[_0x8508('0x24')](function(_0x1fb31e){return _0x1fb31e;});}return null;};}function removeEntity(_0x43fa1b,_0x5874b2){return function(_0x1efffd){if(_0x1efffd){return _0x1efffd[_0x8508('0x25')]()[_0x8508('0x24')](function(){_0x43fa1b['status'](0xcc)[_0x8508('0x1a')]();});}};}function handleEntityNotFound(_0x133d37,_0x373c86){return function(_0x2ccf2d){if(!_0x2ccf2d){_0x133d37['sendStatus'](0x194);}return _0x2ccf2d;};}function handleError(_0x500849,_0x3dcdff){_0x3dcdff=_0x3dcdff||0x1f4;return function(_0x4d872c){logger[_0x8508('0x26')](_0x4d872c['stack']);if(_0x4d872c[_0x8508('0x27')]){delete _0x4d872c[_0x8508('0x27')];}_0x500849[_0x8508('0x19')](_0x3dcdff)[_0x8508('0x28')](_0x4d872c);};}exports['show']=function(_0x2a99e0,_0x3d0d71){var _0x473363={'raw':!![],'where':{'id':_0x2a99e0[_0x8508('0x29')]['id']}},_0x4e51db={};_0x4e51db['model']=_[_0x8508('0x2a')](db[_0x8508('0x2b')]['rawAttributes']);_0x4e51db[_0x8508('0x2c')]=_['keys'](_0x2a99e0['query']);_0x4e51db[_0x8508('0x2d')]=_['intersection'](_0x4e51db[_0x8508('0x2e')],_0x4e51db[_0x8508('0x2c')]);_0x473363['attributes']=_[_0x8508('0x2f')](_0x4e51db[_0x8508('0x2e')],qs[_0x8508('0x30')](_0x2a99e0[_0x8508('0x2c')][_0x8508('0x30')]));_0x473363['attributes']=_0x473363[_0x8508('0x31')][_0x8508('0x32')]?_0x473363[_0x8508('0x31')]:_0x4e51db['model'];if(_0x2a99e0[_0x8508('0x2c')][_0x8508('0x33')]){_0x473363[_0x8508('0x34')]=[{'all':!![]}];}_0x473363=_[_0x8508('0x35')]({},_0x473363,_0x2a99e0['options']);return db['ChatApplication'][_0x8508('0x36')](_0x473363)[_0x8508('0x24')](handleEntityNotFound(_0x3d0d71,null))[_0x8508('0x24')](respondWithResult(_0x3d0d71,null))['catch'](handleError(_0x3d0d71,null));};exports[_0x8508('0x37')]=function(_0x2c70a1,_0x32dfd2){if(_0x2c70a1['body']['id']){delete _0x2c70a1['body']['id'];}return db[_0x8508('0x2b')]['find']({'where':{'id':_0x2c70a1['params']['id']}})[_0x8508('0x24')](handleEntityNotFound(_0x32dfd2,null))[_0x8508('0x24')](saveUpdates(_0x2c70a1[_0x8508('0x38')],null))[_0x8508('0x24')](respondWithResult(_0x32dfd2,null))[_0x8508('0x39')](handleError(_0x32dfd2,null));};exports['destroy']=function(_0x452dd0,_0x575cec){return db['ChatApplication'][_0x8508('0x36')]({'where':{'id':_0x452dd0[_0x8508('0x29')]['id']}})[_0x8508('0x24')](handleEntityNotFound(_0x575cec,null))[_0x8508('0x24')](removeEntity(_0x575cec,null))[_0x8508('0x39')](handleError(_0x575cec,null));}; \ No newline at end of file +var _0x220b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','sendStatus','error','stack','name','show','params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','length','merge','options','find','catch','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x220b,0x1a2));var _0xb220=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x220b[_0x5471ec];return _0x121d4c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb220('0x0'));var zipdir=require(_0xb220('0x1'));var jsonpatch=require(_0xb220('0x2'));var rp=require(_0xb220('0x3'));var moment=require('moment');var BPromise=require(_0xb220('0x4'));var Mustache=require('mustache');var util=require(_0xb220('0x5'));var path=require('path');var sox=require(_0xb220('0x6'));var csv=require(_0xb220('0x7'));var ejs=require(_0xb220('0x8'));var fs=require('fs');var fs_extra=require(_0xb220('0x9'));var _=require('lodash');var squel=require(_0xb220('0xa'));var crypto=require(_0xb220('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb220('0xc'));var toCsv=require(_0xb220('0x7'));var querystring=require(_0xb220('0xd'));var Papa=require(_0xb220('0xe'));var Redis=require(_0xb220('0xf'));var authService=require(_0xb220('0x10'));var qs=require(_0xb220('0x11'));var as=require(_0xb220('0x12'));var hardwareService=require(_0xb220('0x13'));var logger=require('../../config/logger')(_0xb220('0x14'));var utils=require(_0xb220('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x528ce0,_0x59ef3e){_0x59ef3e=_0x59ef3e||0xcc;return function(_0x11229c){if(_0x11229c){return _0x528ce0['sendStatus'](_0x59ef3e);}return _0x528ce0[_0xb220('0x16')](_0x59ef3e)[_0xb220('0x17')]();};}function respondWithResult(_0x378a3b,_0x312c59){_0x312c59=_0x312c59||0xc8;return function(_0x576649){if(_0x576649){return _0x378a3b['status'](_0x312c59)[_0xb220('0x18')](_0x576649);}};}function respondWithFilteredResult(_0x1db409,_0x159eb7){return function(_0x2ee3d2){if(_0x2ee3d2){var _0x16a34b=typeof _0x159eb7[_0xb220('0x19')]===_0xb220('0x1a')&&typeof _0x159eb7[_0xb220('0x1b')]===_0xb220('0x1a');var _0x1416de=_0x2ee3d2[_0xb220('0x1c')];var _0x464ceb=_0x16a34b?0x0:_0x159eb7[_0xb220('0x19')];var _0x21cf2d=_0x16a34b?_0x2ee3d2[_0xb220('0x1c')]:_0x159eb7[_0xb220('0x19')]+_0x159eb7[_0xb220('0x1b')];var _0x1cc822;if(_0x21cf2d>=_0x1416de){_0x21cf2d=_0x1416de;_0x1cc822=0xc8;}else{_0x1cc822=0xce;}_0x1db409[_0xb220('0x16')](_0x1cc822);return _0x1db409[_0xb220('0x1d')](_0xb220('0x1e'),_0x464ceb+'-'+_0x21cf2d+'/'+_0x1416de)[_0xb220('0x18')](_0x2ee3d2);}return null;};}function patchUpdates(_0x213736){return function(_0x358035){try{jsonpatch['apply'](_0x358035,_0x213736,!![]);}catch(_0x45b406){return BPromise['reject'](_0x45b406);}return _0x358035[_0xb220('0x1f')]();};}function saveUpdates(_0x5c4d46,_0x3a1ad7){return function(_0x501f0f){if(_0x501f0f){return _0x501f0f[_0xb220('0x20')](_0x5c4d46)[_0xb220('0x21')](function(_0x2ddf73){return _0x2ddf73;});}return null;};}function removeEntity(_0x2f5a0d,_0x396c72){return function(_0x2975ff){if(_0x2975ff){return _0x2975ff['destroy']()[_0xb220('0x21')](function(){_0x2f5a0d[_0xb220('0x16')](0xcc)[_0xb220('0x17')]();});}};}function handleEntityNotFound(_0x1849c8,_0x180b94){return function(_0x4d83aa){if(!_0x4d83aa){_0x1849c8[_0xb220('0x22')](0x194);}return _0x4d83aa;};}function handleError(_0x30b75b,_0x57768e){_0x57768e=_0x57768e||0x1f4;return function(_0x2b9b1a){logger[_0xb220('0x23')](_0x2b9b1a[_0xb220('0x24')]);if(_0x2b9b1a[_0xb220('0x25')]){delete _0x2b9b1a[_0xb220('0x25')];}_0x30b75b[_0xb220('0x16')](_0x57768e)['send'](_0x2b9b1a);};}exports[_0xb220('0x26')]=function(_0x54c1b9,_0x589e07){var _0x181b14={'raw':!![],'where':{'id':_0x54c1b9[_0xb220('0x27')]['id']}},_0x1a9b82={};_0x1a9b82[_0xb220('0x28')]=_[_0xb220('0x29')](db[_0xb220('0x2a')][_0xb220('0x2b')]);_0x1a9b82[_0xb220('0x2c')]=_[_0xb220('0x29')](_0x54c1b9[_0xb220('0x2c')]);_0x1a9b82['filters']=_[_0xb220('0x2d')](_0x1a9b82[_0xb220('0x28')],_0x1a9b82[_0xb220('0x2c')]);_0x181b14['attributes']=_['intersection'](_0x1a9b82[_0xb220('0x28')],qs['fields'](_0x54c1b9['query']['fields']));_0x181b14[_0xb220('0x2e')]=_0x181b14[_0xb220('0x2e')][_0xb220('0x2f')]?_0x181b14[_0xb220('0x2e')]:_0x1a9b82[_0xb220('0x28')];if(_0x54c1b9[_0xb220('0x2c')]['includeAll']){_0x181b14['include']=[{'all':!![]}];}_0x181b14=_[_0xb220('0x30')]({},_0x181b14,_0x54c1b9[_0xb220('0x31')]);return db['ChatApplication'][_0xb220('0x32')](_0x181b14)['then'](handleEntityNotFound(_0x589e07,null))[_0xb220('0x21')](respondWithResult(_0x589e07,null))[_0xb220('0x33')](handleError(_0x589e07,null));};exports[_0xb220('0x20')]=function(_0x5e4c0a,_0x1ed281){if(_0x5e4c0a['body']['id']){delete _0x5e4c0a['body']['id'];}return db['ChatApplication'][_0xb220('0x32')]({'where':{'id':_0x5e4c0a['params']['id']}})[_0xb220('0x21')](handleEntityNotFound(_0x1ed281,null))[_0xb220('0x21')](saveUpdates(_0x5e4c0a[_0xb220('0x34')],null))['then'](respondWithResult(_0x1ed281,null))['catch'](handleError(_0x1ed281,null));};exports[_0xb220('0x35')]=function(_0x4f385e,_0xb3cff4){return db[_0xb220('0x2a')]['find']({'where':{'id':_0x4f385e[_0xb220('0x27')]['id']}})[_0xb220('0x21')](handleEntityNotFound(_0xb3cff4,null))[_0xb220('0x21')](removeEntity(_0xb3cff4,null))[_0xb220('0x33')](handleError(_0xb3cff4,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 384e0dc..66697fb 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 _0xcc56=['request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','ChatApplication','chat_applications','utf8mb4','util','api','moment'];(function(_0x413741,_0x273935){var _0x18b564=function(_0x1dc369){while(--_0x1dc369){_0x413741['push'](_0x413741['shift']());}};_0x18b564(++_0x273935);}(_0xcc56,0x76));var _0x6cc5=function(_0x2e785e,_0x232c0a){_0x2e785e=_0x2e785e-0x0;var _0x230f26=_0xcc56[_0x2e785e];return _0x230f26;};'use strict';var _=require('lodash');var util=require(_0x6cc5('0x0'));var logger=require('../../config/logger')(_0x6cc5('0x1'));var moment=require(_0x6cc5('0x2'));var BPromise=require('bluebird');var rp=require(_0x6cc5('0x3'));var fs=require('fs');var path=require(_0x6cc5('0x4'));var rimraf=require(_0x6cc5('0x5'));var config=require(_0x6cc5('0x6'));var attributes=require(_0x6cc5('0x7'));module['exports']=function(_0x3ffbcb,_0x183e07){return _0x3ffbcb['define'](_0x6cc5('0x8'),attributes,{'tableName':_0x6cc5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6cc5('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xfc9f=['utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./chatApplication.attributes','ChatApplication','chat_applications'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc9f,0x7a));var _0xffc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfc9f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xffc9('0x0'));var util=require('util');var logger=require(_0xffc9('0x1'))(_0xffc9('0x2'));var moment=require(_0xffc9('0x3'));var BPromise=require(_0xffc9('0x4'));var rp=require(_0xffc9('0x5'));var fs=require('fs');var path=require(_0xffc9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xffc9('0x7'));module['exports']=function(_0x155cef,_0x122a56){return _0x155cef['define'](_0xffc9('0x8'),attributes,{'tableName':_0xffc9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xffc9('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index def94d1..72bb6c7 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 _0xd3ad=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xd3ad,0xca));var _0xdd3a=function(_0x548c38,_0x2b5ba2){_0x548c38=_0x548c38-0x0;var _0x11fa76=_0xd3ad[_0x548c38];return _0x11fa76;};'use strict';var _=require(_0xdd3a('0x0'));var util=require('util');var moment=require(_0xdd3a('0x1'));var BPromise=require(_0xdd3a('0x2'));var rs=require(_0xdd3a('0x3'));var fs=require('fs');var Redis=require(_0xdd3a('0x4'));var db=require(_0xdd3a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd3a('0x6'))(_0xdd3a('0x7'));var config=require(_0xdd3a('0x8'));var jayson=require(_0xdd3a('0x9'));var client=jayson[_0xdd3a('0xa')][_0xdd3a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44133a,_0x5cc897,_0x39753c){return new BPromise(function(_0x20fea5,_0x3929e3){return client[_0xdd3a('0xc')](_0x44133a,_0x39753c)[_0xdd3a('0xd')](function(_0x23ada7){logger[_0xdd3a('0xe')](_0xdd3a('0xf'),_0x5cc897,_0xdd3a('0x10'));logger[_0xdd3a('0x11')](_0xdd3a('0x12'),_0x5cc897,_0xdd3a('0x10'),JSON[_0xdd3a('0x13')](_0x23ada7));if(_0x23ada7['error']){if(_0x23ada7[_0xdd3a('0x14')][_0xdd3a('0x15')]===0x1f4){logger[_0xdd3a('0x14')]('ChatApplication,\x20%s,\x20%s',_0x5cc897,_0x23ada7[_0xdd3a('0x14')][_0xdd3a('0x16')]);return _0x3929e3(_0x23ada7[_0xdd3a('0x14')][_0xdd3a('0x16')]);}logger[_0xdd3a('0x14')](_0xdd3a('0xf'),_0x5cc897,_0x23ada7[_0xdd3a('0x14')][_0xdd3a('0x16')]);return _0x20fea5(_0x23ada7[_0xdd3a('0x14')]['message']);}else{logger[_0xdd3a('0xe')](_0xdd3a('0xf'),_0x5cc897,_0xdd3a('0x10'));_0x20fea5(_0x23ada7['result'][_0xdd3a('0x16')]);}})[_0xdd3a('0x17')](function(_0x3fde0f){logger[_0xdd3a('0x14')](_0xdd3a('0xf'),_0x5cc897,_0x3fde0f);_0x3929e3(_0x3fde0f);});});} \ No newline at end of file +var _0x8456=['code','message','lodash','util','bluebird','randomstring','../../config/utils','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x19db9b,_0x4e3b99){var _0x257ad3=function(_0x427fd3){while(--_0x427fd3){_0x19db9b['push'](_0x19db9b['shift']());}};_0x257ad3(++_0x4e3b99);}(_0x8456,0xf0));var _0x6845=function(_0x12e6b2,_0x183b5e){_0x12e6b2=_0x12e6b2-0x0;var _0x5618b2=_0x8456[_0x12e6b2];return _0x5618b2;};'use strict';var _=require(_0x6845('0x0'));var util=require(_0x6845('0x1'));var moment=require('moment');var BPromise=require(_0x6845('0x2'));var rs=require(_0x6845('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6845('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6845('0x5'));var client=jayson[_0x6845('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x108235,_0x8824d3,_0x342b40){return new BPromise(function(_0x20e5df,_0x69a43d){return client[_0x6845('0x7')](_0x108235,_0x342b40)[_0x6845('0x8')](function(_0x34699b){logger[_0x6845('0x9')](_0x6845('0xa'),_0x8824d3,_0x6845('0xb'));logger['debug'](_0x6845('0xc'),_0x8824d3,_0x6845('0xb'),JSON[_0x6845('0xd')](_0x34699b));if(_0x34699b[_0x6845('0xe')]){if(_0x34699b[_0x6845('0xe')][_0x6845('0xf')]===0x1f4){logger['error'](_0x6845('0xa'),_0x8824d3,_0x34699b['error'][_0x6845('0x10')]);return _0x69a43d(_0x34699b[_0x6845('0xe')]['message']);}logger[_0x6845('0xe')](_0x6845('0xa'),_0x8824d3,_0x34699b[_0x6845('0xe')]['message']);return _0x20e5df(_0x34699b['error'][_0x6845('0x10')]);}else{logger[_0x6845('0x9')](_0x6845('0xa'),_0x8824d3,_0x6845('0xb'));_0x20e5df(_0x34699b['result'][_0x6845('0x10')]);}})['catch'](function(_0x24fd15){logger['error'](_0x6845('0xa'),_0x8824d3,_0x24fd15);_0x69a43d(_0x24fd15);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 2065f73..d9c8690 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 _0x71fd=['get','/:id','isAuthenticated','show','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x378afc,_0x52d1b9){var _0x1b88ff=function(_0x593013){while(--_0x593013){_0x378afc['push'](_0x378afc['shift']());}};_0x1b88ff(++_0x52d1b9);}(_0x71fd,0x76));var _0xd71f=function(_0x1f4acf,_0x4ea06c){_0x1f4acf=_0x1f4acf-0x0;var _0x25ea54=_0x71fd[_0x1f4acf];return _0x25ea54;};'use strict';var multer=require(_0xd71f('0x0'));var util=require('util');var path=require(_0xd71f('0x1'));var timeout=require(_0xd71f('0x2'));var express=require(_0xd71f('0x3'));var router=express[_0xd71f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd71f('0x5'));var interaction=require(_0xd71f('0x6'));var config=require(_0xd71f('0x7'));var controller=require('./chatApplication.controller');router[_0xd71f('0x8')](_0xd71f('0x9'),auth[_0xd71f('0xa')](),controller[_0xd71f('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xd71f('0xa')](),controller[_0xd71f('0xc')]);module[_0xd71f('0xd')]=router; \ No newline at end of file +var _0x3f50=['../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x32674e,_0x4f0d04){var _0x2032b8=function(_0x591bf2){while(--_0x591bf2){_0x32674e['push'](_0x32674e['shift']());}};_0x2032b8(++_0x4f0d04);}(_0x3f50,0x10a));var _0x03f5=function(_0x5de96a,_0x3ee340){_0x5de96a=_0x5de96a-0x0;var _0x53ab51=_0x3f50[_0x5de96a];return _0x53ab51;};'use strict';var multer=require(_0x03f5('0x0'));var util=require(_0x03f5('0x1'));var path=require(_0x03f5('0x2'));var timeout=require(_0x03f5('0x3'));var express=require(_0x03f5('0x4'));var router=express[_0x03f5('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x03f5('0x6'));var config=require(_0x03f5('0x7'));var controller=require(_0x03f5('0x8'));router[_0x03f5('0x9')](_0x03f5('0xa'),auth[_0x03f5('0xb')](),controller[_0x03f5('0xc')]);router['put']('/:id',auth[_0x03f5('0xb')](),controller['update']);router[_0x03f5('0xd')](_0x03f5('0xa'),auth[_0x03f5('0xb')](),controller[_0x03f5('0xe')]);module[_0x03f5('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 42c428d..2ad38c1 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 _0x71c3=['STRING','BOOLEAN','sequelize','exports'];(function(_0x1d8e3b,_0x4a0fb5){var _0x516223=function(_0x30357e){while(--_0x30357e){_0x1d8e3b['push'](_0x1d8e3b['shift']());}};_0x516223(++_0x4a0fb5);}(_0x71c3,0xc6));var _0x371c=function(_0xbc1d68,_0x4cae27){_0xbc1d68=_0xbc1d68-0x0;var _0x4ca6ff=_0x71c3[_0xbc1d68];return _0x4ca6ff;};'use strict';var Sequelize=require(_0x371c('0x0'));module[_0x371c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x371c('0x2')]},'write':{'type':Sequelize[_0x371c('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa810=['exports','BOOLEAN','sequelize'];(function(_0xe1336b,_0x3f3130){var _0x1cf4b2=function(_0x38bcc5){while(--_0x38bcc5){_0xe1336b['push'](_0xe1336b['shift']());}};_0x1cf4b2(++_0x3f3130);}(_0xa810,0x80));var _0x0a81=function(_0xc8a11,_0x347a33){_0xc8a11=_0xc8a11-0x0;var _0x55a500=_0xa810[_0xc8a11];return _0x55a500;};'use strict';var Sequelize=require(_0x0a81('0x0'));module[_0x0a81('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x0a81('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 28da62e..bd7accf 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 _0x0f9a=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','params','describe','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','User','removeMembers','ChatGroupId','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','save','update','then','destroy','name','send','index','map','ChatGroup'];(function(_0x5c6783,_0x5ee78a){var _0x34a61f=function(_0x546a49){while(--_0x546a49){_0x5c6783['push'](_0x5c6783['shift']());}};_0x34a61f(++_0x5ee78a);}(_0x0f9a,0xf8));var _0xa0f9=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0f9a[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xa0f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa0f9('0x1'));var jsonpatch=require(_0xa0f9('0x2'));var rp=require(_0xa0f9('0x3'));var moment=require(_0xa0f9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa0f9('0x5'));var path=require(_0xa0f9('0x6'));var sox=require(_0xa0f9('0x7'));var csv=require(_0xa0f9('0x8'));var ejs=require(_0xa0f9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0f9('0xa'));var squel=require(_0xa0f9('0xb'));var crypto=require(_0xa0f9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa0f9('0xd'));var toCsv=require(_0xa0f9('0x8'));var querystring=require(_0xa0f9('0xe'));var Papa=require(_0xa0f9('0xf'));var Redis=require(_0xa0f9('0x10'));var authService=require(_0xa0f9('0x11'));var qs=require(_0xa0f9('0x12'));var as=require(_0xa0f9('0x13'));var hardwareService=require(_0xa0f9('0x14'));var logger=require(_0xa0f9('0x15'))('api');var utils=require(_0xa0f9('0x16'));var config=require(_0xa0f9('0x17'));var licenseUtil=require(_0xa0f9('0x18'));var db=require(_0xa0f9('0x19'))['db'];config[_0xa0f9('0x1a')]=_[_0xa0f9('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa0f9('0x1c'))(new Redis(config['redis']));require(_0xa0f9('0x1d'))[_0xa0f9('0x1e')](socket);function respondWithStatusCode(_0x1bc0a2,_0xbb9895){_0xbb9895=_0xbb9895||0xcc;return function(_0x2eb55d){if(_0x2eb55d){return _0x1bc0a2[_0xa0f9('0x1f')](_0xbb9895);}return _0x1bc0a2[_0xa0f9('0x20')](_0xbb9895)[_0xa0f9('0x21')]();};}function respondWithResult(_0x2187e3,_0x554bd2){_0x554bd2=_0x554bd2||0xc8;return function(_0x5d1023){if(_0x5d1023){return _0x2187e3[_0xa0f9('0x20')](_0x554bd2)[_0xa0f9('0x22')](_0x5d1023);}};}function respondWithFilteredResult(_0x23f935,_0x292616){return function(_0x1de864){if(_0x1de864){var _0x4d6493=typeof _0x292616[_0xa0f9('0x23')]===_0xa0f9('0x24')&&typeof _0x292616['limit']===_0xa0f9('0x24');var _0x5f2d95=_0x1de864[_0xa0f9('0x25')];var _0x42c34d=_0x4d6493?0x0:_0x292616['offset'];var _0xd9e353=_0x4d6493?_0x1de864[_0xa0f9('0x25')]:_0x292616[_0xa0f9('0x23')]+_0x292616['limit'];var _0x366619;if(_0xd9e353>=_0x5f2d95){_0xd9e353=_0x5f2d95;_0x366619=0xc8;}else{_0x366619=0xce;}_0x23f935[_0xa0f9('0x20')](_0x366619);return _0x23f935['set'](_0xa0f9('0x26'),_0x42c34d+'-'+_0xd9e353+'/'+_0x5f2d95)['json'](_0x1de864);}return null;};}function patchUpdates(_0x188bb4){return function(_0x413e69){try{jsonpatch['apply'](_0x413e69,_0x188bb4,!![]);}catch(_0x258d88){return BPromise[_0xa0f9('0x27')](_0x258d88);}return _0x413e69[_0xa0f9('0x28')]();};}function saveUpdates(_0x5872da,_0x3e4997){return function(_0x3329ac){if(_0x3329ac){return _0x3329ac[_0xa0f9('0x29')](_0x5872da)[_0xa0f9('0x2a')](function(_0x12f85c){return _0x12f85c;});}return null;};}function removeEntity(_0x42f67d,_0x4713e1){return function(_0x84d1ab){if(_0x84d1ab){return _0x84d1ab[_0xa0f9('0x2b')]()['then'](function(){_0x42f67d[_0xa0f9('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5eb659,_0x23ae19){return function(_0x2ad07d){if(!_0x2ad07d){_0x5eb659[_0xa0f9('0x1f')](0x194);}return _0x2ad07d;};}function handleError(_0x4dfe83,_0x135991){_0x135991=_0x135991||0x1f4;return function(_0x4c9e23){logger['error'](_0x4c9e23['stack']);if(_0x4c9e23[_0xa0f9('0x2c')]){delete _0x4c9e23[_0xa0f9('0x2c')];}_0x4dfe83['status'](_0x135991)[_0xa0f9('0x2d')](_0x4c9e23);};}exports[_0xa0f9('0x2e')]=function(_0x440f43,_0x23337e){var _0xdb2062={},_0x16c691={},_0x2836a4={'count':0x0,'rows':[]};var _0x454cd6=_[_0xa0f9('0x2f')](db[_0xa0f9('0x30')]['rawAttributes'],function(_0x29c005){return{'name':_0x29c005[_0xa0f9('0x31')],'type':_0x29c005[_0xa0f9('0x32')][_0xa0f9('0x33')]};});_0x16c691[_0xa0f9('0x34')]=_[_0xa0f9('0x2f')](_0x454cd6,_0xa0f9('0x2c'));_0x16c691[_0xa0f9('0x35')]=_[_0xa0f9('0x36')](_0x440f43['query']);_0x16c691[_0xa0f9('0x37')]=_[_0xa0f9('0x38')](_0x16c691[_0xa0f9('0x34')],_0x16c691[_0xa0f9('0x35')]);_0xdb2062[_0xa0f9('0x39')]=_[_0xa0f9('0x38')](_0x16c691[_0xa0f9('0x34')],qs[_0xa0f9('0x3a')](_0x440f43[_0xa0f9('0x35')][_0xa0f9('0x3a')]));_0xdb2062[_0xa0f9('0x39')]=_0xdb2062[_0xa0f9('0x39')][_0xa0f9('0x3b')]?_0xdb2062[_0xa0f9('0x39')]:_0x16c691[_0xa0f9('0x34')];if(!_0x440f43[_0xa0f9('0x35')][_0xa0f9('0x3c')](_0xa0f9('0x3d'))){_0xdb2062[_0xa0f9('0x3e')]=qs[_0xa0f9('0x3e')](_0x440f43['query'][_0xa0f9('0x3e')]);_0xdb2062[_0xa0f9('0x23')]=qs[_0xa0f9('0x23')](_0x440f43['query'][_0xa0f9('0x23')]);}_0xdb2062[_0xa0f9('0x3f')]=qs[_0xa0f9('0x40')](_0x440f43[_0xa0f9('0x35')]['sort']);_0xdb2062[_0xa0f9('0x41')]=qs[_0xa0f9('0x37')](_[_0xa0f9('0x42')](_0x440f43[_0xa0f9('0x35')],_0x16c691[_0xa0f9('0x37')]),_0x454cd6);if(_0x440f43[_0xa0f9('0x35')][_0xa0f9('0x43')]){_0xdb2062[_0xa0f9('0x41')]=_[_0xa0f9('0x44')](_0xdb2062[_0xa0f9('0x41')],{'$or':_[_0xa0f9('0x2f')](_0x454cd6,function(_0x457eda){if(_0x457eda['type']!==_0xa0f9('0x45')){var _0x117af6={};_0x117af6[_0x457eda[_0xa0f9('0x2c')]]={'$like':'%'+_0x440f43[_0xa0f9('0x35')][_0xa0f9('0x43')]+'%'};return _0x117af6;}})});}_0xdb2062=_['merge']({},_0xdb2062,_0x440f43[_0xa0f9('0x46')]);var _0x47834b={'where':_0xdb2062[_0xa0f9('0x41')]};return db['ChatGroup']['count'](_0x47834b)[_0xa0f9('0x2a')](function(_0x4e0af5){_0x2836a4[_0xa0f9('0x25')]=_0x4e0af5;if(_0x440f43[_0xa0f9('0x35')]['includeAll']){_0xdb2062[_0xa0f9('0x47')]=[{'all':!![]}];}return db[_0xa0f9('0x30')][_0xa0f9('0x48')](_0xdb2062);})[_0xa0f9('0x2a')](function(_0x4cc11f){_0x2836a4[_0xa0f9('0x49')]=_0x4cc11f;return _0x2836a4;})['then'](respondWithFilteredResult(_0x23337e,_0xdb2062))[_0xa0f9('0x4a')](handleError(_0x23337e,null));};exports[_0xa0f9('0x4b')]=function(_0x565564,_0x1b72d3){var _0x1dd53b={'raw':!![],'where':{'id':_0x565564['params']['id']}},_0x311c47={};_0x311c47['model']=_[_0xa0f9('0x36')](db[_0xa0f9('0x30')][_0xa0f9('0x4c')]);_0x311c47[_0xa0f9('0x35')]=_['keys'](_0x565564['query']);_0x311c47['filters']=_[_0xa0f9('0x38')](_0x311c47[_0xa0f9('0x34')],_0x311c47[_0xa0f9('0x35')]);_0x1dd53b[_0xa0f9('0x39')]=_[_0xa0f9('0x38')](_0x311c47[_0xa0f9('0x34')],qs[_0xa0f9('0x3a')](_0x565564[_0xa0f9('0x35')][_0xa0f9('0x3a')]));_0x1dd53b[_0xa0f9('0x39')]=_0x1dd53b['attributes']['length']?_0x1dd53b[_0xa0f9('0x39')]:_0x311c47[_0xa0f9('0x34')];if(_0x565564['query'][_0xa0f9('0x4d')]){_0x1dd53b[_0xa0f9('0x47')]=[{'all':!![]}];}_0x1dd53b=_['merge']({},_0x1dd53b,_0x565564[_0xa0f9('0x46')]);return db[_0xa0f9('0x30')][_0xa0f9('0x4e')](_0x1dd53b)[_0xa0f9('0x2a')](handleEntityNotFound(_0x1b72d3,null))[_0xa0f9('0x2a')](respondWithResult(_0x1b72d3,null))[_0xa0f9('0x4a')](handleError(_0x1b72d3,null));};exports[_0xa0f9('0x4f')]=function(_0x203edc,_0x29b501){return db['ChatGroup']['create'](_0x203edc[_0xa0f9('0x50')],{})['then'](respondWithResult(_0x29b501,0xc9))[_0xa0f9('0x4a')](handleError(_0x29b501,null));};exports[_0xa0f9('0x29')]=function(_0x1ab347,_0x495454){if(_0x1ab347[_0xa0f9('0x50')]['id']){delete _0x1ab347[_0xa0f9('0x50')]['id'];}return db['ChatGroup'][_0xa0f9('0x4e')]({'where':{'id':_0x1ab347[_0xa0f9('0x51')]['id']}})[_0xa0f9('0x2a')](handleEntityNotFound(_0x495454,null))[_0xa0f9('0x2a')](saveUpdates(_0x1ab347[_0xa0f9('0x50')],null))[_0xa0f9('0x2a')](respondWithResult(_0x495454,null))[_0xa0f9('0x4a')](handleError(_0x495454,null));};exports['destroy']=function(_0x290aa6,_0x1b329d){return db[_0xa0f9('0x30')]['find']({'where':{'id':_0x290aa6[_0xa0f9('0x51')]['id']}})[_0xa0f9('0x2a')](handleEntityNotFound(_0x1b329d,null))[_0xa0f9('0x2a')](removeEntity(_0x1b329d,null))[_0xa0f9('0x4a')](handleError(_0x1b329d,null));};exports[_0xa0f9('0x52')]=function(_0x2bc109,_0x8345ad){return db['ChatGroup'][_0xa0f9('0x52')]()[_0xa0f9('0x2a')](respondWithResult(_0x8345ad,null))[_0xa0f9('0x4a')](handleError(_0x8345ad,null));};exports['getUnread']=function(_0x32bd82,_0x26551b,_0x1e8603){return db[_0xa0f9('0x53')][_0xa0f9('0x25')]({'where':{'ChatGroupId':_0x32bd82['params']['id'],'ToId':_0x32bd82[_0xa0f9('0x54')]['id'],'read':![]}})[_0xa0f9('0x2a')](function(_0x49d723){return{'id':_[_0xa0f9('0x55')](_0x32bd82['params']['id']),'count':_0x49d723};})[_0xa0f9('0x2a')](respondWithResult(_0x26551b,null))[_0xa0f9('0x4a')](handleError(_0x26551b,null));};exports[_0xa0f9('0x56')]=function(_0x48a0fd,_0x4160d6,_0x73714c){return db[_0xa0f9('0x30')][_0xa0f9('0x4e')]({'where':{'id':_0x48a0fd[_0xa0f9('0x51')]['id']}})['then'](handleEntityNotFound(_0x4160d6,null))['then'](function(_0x109984){if(_0x109984){return _0x109984[_0xa0f9('0x56')](_0x48a0fd['body']['ids'],_[_0xa0f9('0x57')](_0x48a0fd['body'],[_0xa0f9('0x58'),'id'])||{});}})[_0xa0f9('0x2a')](respondWithResult(_0x4160d6,null))[_0xa0f9('0x4a')](handleError(_0x4160d6,null));};exports[_0xa0f9('0x59')]=function(_0x1cccbc,_0x1d4b15,_0x50068c){var _0x552002={};var _0x58eb33={};var _0x2d2415;var _0x787560;return db['ChatGroup']['findOne']({'where':{'id':_0x1cccbc[_0xa0f9('0x51')]['id']}})[_0xa0f9('0x2a')](handleEntityNotFound(_0x1d4b15,null))[_0xa0f9('0x2a')](function(_0x55b457){if(_0x55b457){_0x2d2415=_0x55b457;_0x58eb33[_0xa0f9('0x34')]=_[_0xa0f9('0x36')](db[_0xa0f9('0x5a')][_0xa0f9('0x4c')]);_0x58eb33['query']=_[_0xa0f9('0x36')](_0x1cccbc[_0xa0f9('0x35')]);_0x58eb33[_0xa0f9('0x37')]=_[_0xa0f9('0x38')](_0x58eb33[_0xa0f9('0x34')],_0x58eb33['query']);_0x552002['attributes']=_[_0xa0f9('0x38')](_0x58eb33[_0xa0f9('0x34')],qs[_0xa0f9('0x3a')](_0x1cccbc[_0xa0f9('0x35')][_0xa0f9('0x3a')]));_0x552002[_0xa0f9('0x39')]=_0x552002[_0xa0f9('0x39')]['length']?_0x552002[_0xa0f9('0x39')]:_0x58eb33[_0xa0f9('0x34')];_0x552002[_0xa0f9('0x3f')]=qs[_0xa0f9('0x40')](_0x1cccbc[_0xa0f9('0x35')][_0xa0f9('0x40')]);_0x552002[_0xa0f9('0x41')]=qs['filters'](_['pick'](_0x1cccbc[_0xa0f9('0x35')],_0x58eb33[_0xa0f9('0x37')]));if(_0x1cccbc[_0xa0f9('0x35')]['filter']){_0x552002[_0xa0f9('0x41')]=_[_0xa0f9('0x44')](_0x552002[_0xa0f9('0x41')],{'$or':_[_0xa0f9('0x2f')](_0x552002[_0xa0f9('0x39')],function(_0x2f613f){var _0x4e29d9={};_0x4e29d9[_0x2f613f]={'$like':'%'+_0x1cccbc['query']['filter']+'%'};return _0x4e29d9;})});}_0x552002=_[_0xa0f9('0x44')]({},_0x552002,_0x1cccbc[_0xa0f9('0x46')]);return _0x2d2415['getMembers'](_0x552002);}})[_0xa0f9('0x2a')](function(_0x34566b){if(_0x34566b){_0x787560=_0x34566b[_0xa0f9('0x3b')];if(!_0x1cccbc[_0xa0f9('0x35')]['hasOwnProperty']('nolimit')){_0x552002['limit']=qs[_0xa0f9('0x3e')](_0x1cccbc[_0xa0f9('0x35')]['limit']);_0x552002[_0xa0f9('0x23')]=qs[_0xa0f9('0x23')](_0x1cccbc[_0xa0f9('0x35')][_0xa0f9('0x23')]);}return _0x2d2415[_0xa0f9('0x59')](_0x552002);}})[_0xa0f9('0x2a')](function(_0x3bf20c){if(_0x3bf20c){return _0x3bf20c?{'count':_0x787560,'rows':_0x3bf20c}:null;}})[_0xa0f9('0x2a')](respondWithResult(_0x1d4b15,null))[_0xa0f9('0x4a')](handleError(_0x1d4b15,null));};exports[_0xa0f9('0x5b')]=function(_0xbafb2a,_0x2a9181,_0x1caa80){return db[_0xa0f9('0x30')][_0xa0f9('0x4e')]({'where':{'id':_0xbafb2a[_0xa0f9('0x51')]['id']}})[_0xa0f9('0x2a')](handleEntityNotFound(_0x2a9181,null))[_0xa0f9('0x2a')](function(_0x2d3fd2){if(_0x2d3fd2){return _0x2d3fd2[_0xa0f9('0x5b')](_0xbafb2a['query']['ids']);}})[_0xa0f9('0x2a')](respondWithStatusCode(_0x2a9181,null))[_0xa0f9('0x4a')](handleError(_0x2a9181,null));};exports['addMessage']=function(_0x188c3d,_0x3575c0,_0x5a3e7b){if(_0x188c3d['body']['id']){delete _0x188c3d[_0xa0f9('0x50')]['id'];}return db[_0xa0f9('0x30')][_0xa0f9('0x4e')]({'where':{'id':_0x188c3d[_0xa0f9('0x51')]['id']}})[_0xa0f9('0x2a')](handleEntityNotFound(_0x3575c0,null))[_0xa0f9('0x2a')](function(_0x1faed0){if(_0x1faed0){_0x188c3d[_0xa0f9('0x50')][_0xa0f9('0x5c')]=_0x1faed0['id'];return db[_0xa0f9('0x53')]['create'](_0x188c3d[_0xa0f9('0x50')]);}})['then'](respondWithResult(_0x3575c0,null))[_0xa0f9('0x4a')](handleError(_0x3575c0,null));};exports[_0xa0f9('0x5d')]=function(_0x11432e,_0x3c3c20,_0x43df75){var _0x2a9bfe={};var _0x363b90={};var _0x443945;var _0x4c9968;return db[_0xa0f9('0x30')][_0xa0f9('0x5e')]({'where':{'id':_0x11432e[_0xa0f9('0x51')]['id']}})[_0xa0f9('0x2a')](handleEntityNotFound(_0x3c3c20,null))[_0xa0f9('0x2a')](function(_0x4cb5dc){if(_0x4cb5dc){_0x443945=_0x4cb5dc;_0x363b90[_0xa0f9('0x34')]=_[_0xa0f9('0x36')](db[_0xa0f9('0x53')]['rawAttributes']);_0x363b90[_0xa0f9('0x35')]=_['keys'](_0x11432e[_0xa0f9('0x35')]);_0x363b90[_0xa0f9('0x37')]=_[_0xa0f9('0x38')](_0x363b90[_0xa0f9('0x34')],_0x363b90[_0xa0f9('0x35')]);_0x2a9bfe[_0xa0f9('0x39')]=_[_0xa0f9('0x38')](_0x363b90[_0xa0f9('0x34')],qs[_0xa0f9('0x3a')](_0x11432e['query'][_0xa0f9('0x3a')]));_0x2a9bfe[_0xa0f9('0x39')]=_0x2a9bfe[_0xa0f9('0x39')][_0xa0f9('0x3b')]?_0x2a9bfe[_0xa0f9('0x39')]:_0x363b90[_0xa0f9('0x34')];_0x2a9bfe[_0xa0f9('0x3f')]=qs[_0xa0f9('0x40')](_0x11432e['query'][_0xa0f9('0x40')]);_0x2a9bfe[_0xa0f9('0x41')]=qs['filters'](_[_0xa0f9('0x42')](_0x11432e[_0xa0f9('0x35')],_0x363b90[_0xa0f9('0x37')]));if(_0x11432e[_0xa0f9('0x35')][_0xa0f9('0x43')]){_0x2a9bfe[_0xa0f9('0x41')]=_[_0xa0f9('0x44')](_0x2a9bfe[_0xa0f9('0x41')],{'$or':_['map'](_0x2a9bfe['attributes'],function(_0x2f851d){var _0x52a009={};_0x52a009[_0x2f851d]={'$like':'%'+_0x11432e[_0xa0f9('0x35')][_0xa0f9('0x43')]+'%'};return _0x52a009;})});}if(_0x11432e[_0xa0f9('0x35')][_0xa0f9('0x5f')]){var _0x1b34ea=_0x11432e['query']['$gte'][_0xa0f9('0x60')](',');var _0x24410c={};_0x24410c[_0x1b34ea[0x0]]={'$gte':moment(_0x1b34ea[0x1])[_0xa0f9('0x61')](_0xa0f9('0x62'))};_0x2a9bfe[_0xa0f9('0x41')]=_['merge'](_0x2a9bfe['where'],_0x24410c);}_0x2a9bfe=_[_0xa0f9('0x44')]({},_0x2a9bfe,_0x11432e[_0xa0f9('0x46')]);return _0x443945[_0xa0f9('0x5d')](_0x2a9bfe);}})[_0xa0f9('0x2a')](function(_0x5ac5fe){if(_0x5ac5fe){_0x4c9968=_0x5ac5fe[_0xa0f9('0x3b')];if(!_0x11432e['query'][_0xa0f9('0x3c')](_0xa0f9('0x3d'))){_0x2a9bfe[_0xa0f9('0x3e')]=qs['limit'](_0x11432e[_0xa0f9('0x35')][_0xa0f9('0x3e')]);_0x2a9bfe[_0xa0f9('0x23')]=qs['offset'](_0x11432e[_0xa0f9('0x35')][_0xa0f9('0x23')]);}return _0x443945[_0xa0f9('0x5d')](_0x2a9bfe);}})['then'](function(_0x3e9ec8){if(_0x3e9ec8){return _0x3e9ec8?{'count':_0x4c9968,'rows':_0x3e9ec8}:null;}})[_0xa0f9('0x2a')](respondWithResult(_0x3c3c20,null))[_0xa0f9('0x4a')](handleError(_0x3c3c20,null));}; \ No newline at end of file +var _0xe9ec=['bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','defaults','redis','localhost','register','status','end','limit','undefined','count','offset','Content-Range','json','apply','reject','update','then','destroy','sendStatus','stack','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','params','keys','include','options','find','create','body','describe','toInteger','addMembers','ids','omit','getMembers','findOne','removeMembers','ChatInternalMessage','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x6d3aa,_0x452556){var _0x3457f1=function(_0x1a7234){while(--_0x1a7234){_0x6d3aa['push'](_0x6d3aa['shift']());}};_0x3457f1(++_0x452556);}(_0xe9ec,0x1c2));var _0xce9e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe9ec[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xce9e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce9e('0x1'));var jsonpatch=require(_0xce9e('0x2'));var rp=require(_0xce9e('0x3'));var moment=require(_0xce9e('0x4'));var BPromise=require(_0xce9e('0x5'));var Mustache=require(_0xce9e('0x6'));var util=require(_0xce9e('0x7'));var path=require(_0xce9e('0x8'));var sox=require(_0xce9e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce9e('0xa'));var _=require(_0xce9e('0xb'));var squel=require(_0xce9e('0xc'));var crypto=require(_0xce9e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xce9e('0xe'));var toCsv=require(_0xce9e('0xf'));var querystring=require(_0xce9e('0x10'));var Papa=require(_0xce9e('0x11'));var Redis=require('ioredis');var authService=require(_0xce9e('0x12'));var qs=require(_0xce9e('0x13'));var as=require(_0xce9e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce9e('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xce9e('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xce9e('0x17')](config[_0xce9e('0x18')],{'host':_0xce9e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce9e('0x18')]));require('./chatGroup.socket')[_0xce9e('0x1a')](socket);function respondWithStatusCode(_0x5dfc31,_0x2d51e2){_0x2d51e2=_0x2d51e2||0xcc;return function(_0x550fb6){if(_0x550fb6){return _0x5dfc31['sendStatus'](_0x2d51e2);}return _0x5dfc31[_0xce9e('0x1b')](_0x2d51e2)[_0xce9e('0x1c')]();};}function respondWithResult(_0x2ee224,_0x1a77b9){_0x1a77b9=_0x1a77b9||0xc8;return function(_0x40d522){if(_0x40d522){return _0x2ee224[_0xce9e('0x1b')](_0x1a77b9)['json'](_0x40d522);}};}function respondWithFilteredResult(_0x4ca4ff,_0xed8e13){return function(_0x2e26bd){if(_0x2e26bd){var _0x3148f8=typeof _0xed8e13['offset']==='undefined'&&typeof _0xed8e13[_0xce9e('0x1d')]===_0xce9e('0x1e');var _0x2a99f7=_0x2e26bd[_0xce9e('0x1f')];var _0x154268=_0x3148f8?0x0:_0xed8e13[_0xce9e('0x20')];var _0x33a1f3=_0x3148f8?_0x2e26bd[_0xce9e('0x1f')]:_0xed8e13[_0xce9e('0x20')]+_0xed8e13[_0xce9e('0x1d')];var _0x50e7c0;if(_0x33a1f3>=_0x2a99f7){_0x33a1f3=_0x2a99f7;_0x50e7c0=0xc8;}else{_0x50e7c0=0xce;}_0x4ca4ff[_0xce9e('0x1b')](_0x50e7c0);return _0x4ca4ff['set'](_0xce9e('0x21'),_0x154268+'-'+_0x33a1f3+'/'+_0x2a99f7)[_0xce9e('0x22')](_0x2e26bd);}return null;};}function patchUpdates(_0x2e1bc8){return function(_0x4acf75){try{jsonpatch[_0xce9e('0x23')](_0x4acf75,_0x2e1bc8,!![]);}catch(_0x50d28e){return BPromise[_0xce9e('0x24')](_0x50d28e);}return _0x4acf75['save']();};}function saveUpdates(_0xc6fd85,_0x27d837){return function(_0x58cc20){if(_0x58cc20){return _0x58cc20[_0xce9e('0x25')](_0xc6fd85)[_0xce9e('0x26')](function(_0x374647){return _0x374647;});}return null;};}function removeEntity(_0x5c7571,_0x5a8142){return function(_0x4b12d0){if(_0x4b12d0){return _0x4b12d0[_0xce9e('0x27')]()[_0xce9e('0x26')](function(){_0x5c7571[_0xce9e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e476c,_0x18bb07){return function(_0x4acaa6){if(!_0x4acaa6){_0x2e476c[_0xce9e('0x28')](0x194);}return _0x4acaa6;};}function handleError(_0xf64f19,_0x4e210c){_0x4e210c=_0x4e210c||0x1f4;return function(_0x95a25d){logger['error'](_0x95a25d[_0xce9e('0x29')]);if(_0x95a25d['name']){delete _0x95a25d['name'];}_0xf64f19['status'](_0x4e210c)[_0xce9e('0x2a')](_0x95a25d);};}exports[_0xce9e('0x2b')]=function(_0x5cfd14,_0xa7345d){var _0x5e05b5={},_0xe00715={},_0x4984a7={'count':0x0,'rows':[]};var _0x10e2c1=_[_0xce9e('0x2c')](db[_0xce9e('0x2d')][_0xce9e('0x2e')],function(_0x1e23a5){return{'name':_0x1e23a5[_0xce9e('0x2f')],'type':_0x1e23a5[_0xce9e('0x30')][_0xce9e('0x31')]};});_0xe00715[_0xce9e('0x32')]=_['map'](_0x10e2c1,_0xce9e('0x33'));_0xe00715[_0xce9e('0x34')]=_['keys'](_0x5cfd14[_0xce9e('0x34')]);_0xe00715['filters']=_[_0xce9e('0x35')](_0xe00715[_0xce9e('0x32')],_0xe00715[_0xce9e('0x34')]);_0x5e05b5[_0xce9e('0x36')]=_[_0xce9e('0x35')](_0xe00715['model'],qs[_0xce9e('0x37')](_0x5cfd14['query'][_0xce9e('0x37')]));_0x5e05b5[_0xce9e('0x36')]=_0x5e05b5[_0xce9e('0x36')][_0xce9e('0x38')]?_0x5e05b5[_0xce9e('0x36')]:_0xe00715['model'];if(!_0x5cfd14[_0xce9e('0x34')][_0xce9e('0x39')](_0xce9e('0x3a'))){_0x5e05b5[_0xce9e('0x1d')]=qs['limit'](_0x5cfd14[_0xce9e('0x34')]['limit']);_0x5e05b5[_0xce9e('0x20')]=qs[_0xce9e('0x20')](_0x5cfd14['query'][_0xce9e('0x20')]);}_0x5e05b5[_0xce9e('0x3b')]=qs[_0xce9e('0x3c')](_0x5cfd14[_0xce9e('0x34')][_0xce9e('0x3c')]);_0x5e05b5['where']=qs[_0xce9e('0x3d')](_[_0xce9e('0x3e')](_0x5cfd14[_0xce9e('0x34')],_0xe00715[_0xce9e('0x3d')]),_0x10e2c1);if(_0x5cfd14[_0xce9e('0x34')][_0xce9e('0x3f')]){_0x5e05b5[_0xce9e('0x40')]=_[_0xce9e('0x41')](_0x5e05b5['where'],{'$or':_['map'](_0x10e2c1,function(_0x2865c1){if(_0x2865c1[_0xce9e('0x30')]!==_0xce9e('0x42')){var _0x343dee={};_0x343dee[_0x2865c1['name']]={'$like':'%'+_0x5cfd14[_0xce9e('0x34')][_0xce9e('0x3f')]+'%'};return _0x343dee;}})});}_0x5e05b5=_['merge']({},_0x5e05b5,_0x5cfd14['options']);var _0x5e1570={'where':_0x5e05b5[_0xce9e('0x40')]};return db['ChatGroup'][_0xce9e('0x1f')](_0x5e1570)[_0xce9e('0x26')](function(_0x834ede){_0x4984a7[_0xce9e('0x1f')]=_0x834ede;if(_0x5cfd14['query'][_0xce9e('0x43')]){_0x5e05b5['include']=[{'all':!![]}];}return db[_0xce9e('0x2d')][_0xce9e('0x44')](_0x5e05b5);})[_0xce9e('0x26')](function(_0x52d282){_0x4984a7[_0xce9e('0x45')]=_0x52d282;return _0x4984a7;})[_0xce9e('0x26')](respondWithFilteredResult(_0xa7345d,_0x5e05b5))[_0xce9e('0x46')](handleError(_0xa7345d,null));};exports['show']=function(_0x4cd2ef,_0x58e980){var _0x58da99={'raw':!![],'where':{'id':_0x4cd2ef[_0xce9e('0x47')]['id']}},_0xe3c207={};_0xe3c207[_0xce9e('0x32')]=_[_0xce9e('0x48')](db[_0xce9e('0x2d')][_0xce9e('0x2e')]);_0xe3c207[_0xce9e('0x34')]=_[_0xce9e('0x48')](_0x4cd2ef[_0xce9e('0x34')]);_0xe3c207[_0xce9e('0x3d')]=_[_0xce9e('0x35')](_0xe3c207[_0xce9e('0x32')],_0xe3c207[_0xce9e('0x34')]);_0x58da99[_0xce9e('0x36')]=_['intersection'](_0xe3c207['model'],qs[_0xce9e('0x37')](_0x4cd2ef[_0xce9e('0x34')][_0xce9e('0x37')]));_0x58da99[_0xce9e('0x36')]=_0x58da99[_0xce9e('0x36')][_0xce9e('0x38')]?_0x58da99['attributes']:_0xe3c207[_0xce9e('0x32')];if(_0x4cd2ef[_0xce9e('0x34')][_0xce9e('0x43')]){_0x58da99[_0xce9e('0x49')]=[{'all':!![]}];}_0x58da99=_[_0xce9e('0x41')]({},_0x58da99,_0x4cd2ef[_0xce9e('0x4a')]);return db[_0xce9e('0x2d')][_0xce9e('0x4b')](_0x58da99)[_0xce9e('0x26')](handleEntityNotFound(_0x58e980,null))[_0xce9e('0x26')](respondWithResult(_0x58e980,null))[_0xce9e('0x46')](handleError(_0x58e980,null));};exports[_0xce9e('0x4c')]=function(_0x5b85b0,_0x3e2d7d){return db[_0xce9e('0x2d')][_0xce9e('0x4c')](_0x5b85b0[_0xce9e('0x4d')],{})[_0xce9e('0x26')](respondWithResult(_0x3e2d7d,0xc9))[_0xce9e('0x46')](handleError(_0x3e2d7d,null));};exports[_0xce9e('0x25')]=function(_0x5c77c5,_0x13108f){if(_0x5c77c5[_0xce9e('0x4d')]['id']){delete _0x5c77c5[_0xce9e('0x4d')]['id'];}return db[_0xce9e('0x2d')][_0xce9e('0x4b')]({'where':{'id':_0x5c77c5[_0xce9e('0x47')]['id']}})['then'](handleEntityNotFound(_0x13108f,null))['then'](saveUpdates(_0x5c77c5[_0xce9e('0x4d')],null))[_0xce9e('0x26')](respondWithResult(_0x13108f,null))['catch'](handleError(_0x13108f,null));};exports['destroy']=function(_0x2083b0,_0x5241ec){return db['ChatGroup'][_0xce9e('0x4b')]({'where':{'id':_0x2083b0[_0xce9e('0x47')]['id']}})['then'](handleEntityNotFound(_0x5241ec,null))[_0xce9e('0x26')](removeEntity(_0x5241ec,null))['catch'](handleError(_0x5241ec,null));};exports[_0xce9e('0x4e')]=function(_0x384da5,_0xc6cf8){return db['ChatGroup']['describe']()[_0xce9e('0x26')](respondWithResult(_0xc6cf8,null))[_0xce9e('0x46')](handleError(_0xc6cf8,null));};exports['getUnread']=function(_0x4d6242,_0x5ba239,_0x351437){return db['ChatInternalMessage'][_0xce9e('0x1f')]({'where':{'ChatGroupId':_0x4d6242[_0xce9e('0x47')]['id'],'ToId':_0x4d6242['user']['id'],'read':![]}})[_0xce9e('0x26')](function(_0xbdec12){return{'id':_[_0xce9e('0x4f')](_0x4d6242[_0xce9e('0x47')]['id']),'count':_0xbdec12};})['then'](respondWithResult(_0x5ba239,null))[_0xce9e('0x46')](handleError(_0x5ba239,null));};exports['addMembers']=function(_0xeeeaa0,_0x56bb76,_0x99fc0a){return db[_0xce9e('0x2d')][_0xce9e('0x4b')]({'where':{'id':_0xeeeaa0[_0xce9e('0x47')]['id']}})[_0xce9e('0x26')](handleEntityNotFound(_0x56bb76,null))['then'](function(_0x1d080c){if(_0x1d080c){return _0x1d080c[_0xce9e('0x50')](_0xeeeaa0[_0xce9e('0x4d')][_0xce9e('0x51')],_[_0xce9e('0x52')](_0xeeeaa0[_0xce9e('0x4d')],[_0xce9e('0x51'),'id'])||{});}})[_0xce9e('0x26')](respondWithResult(_0x56bb76,null))[_0xce9e('0x46')](handleError(_0x56bb76,null));};exports[_0xce9e('0x53')]=function(_0xb404f7,_0xea8ae,_0x2def06){var _0x136af9={};var _0x3dede1={};var _0x51099d;var _0x4fa4f2;return db[_0xce9e('0x2d')][_0xce9e('0x54')]({'where':{'id':_0xb404f7[_0xce9e('0x47')]['id']}})[_0xce9e('0x26')](handleEntityNotFound(_0xea8ae,null))['then'](function(_0x41d243){if(_0x41d243){_0x51099d=_0x41d243;_0x3dede1['model']=_[_0xce9e('0x48')](db['User'][_0xce9e('0x2e')]);_0x3dede1[_0xce9e('0x34')]=_[_0xce9e('0x48')](_0xb404f7[_0xce9e('0x34')]);_0x3dede1[_0xce9e('0x3d')]=_[_0xce9e('0x35')](_0x3dede1[_0xce9e('0x32')],_0x3dede1[_0xce9e('0x34')]);_0x136af9['attributes']=_[_0xce9e('0x35')](_0x3dede1[_0xce9e('0x32')],qs[_0xce9e('0x37')](_0xb404f7[_0xce9e('0x34')][_0xce9e('0x37')]));_0x136af9[_0xce9e('0x36')]=_0x136af9[_0xce9e('0x36')][_0xce9e('0x38')]?_0x136af9[_0xce9e('0x36')]:_0x3dede1[_0xce9e('0x32')];_0x136af9[_0xce9e('0x3b')]=qs[_0xce9e('0x3c')](_0xb404f7[_0xce9e('0x34')][_0xce9e('0x3c')]);_0x136af9['where']=qs[_0xce9e('0x3d')](_[_0xce9e('0x3e')](_0xb404f7[_0xce9e('0x34')],_0x3dede1[_0xce9e('0x3d')]));if(_0xb404f7[_0xce9e('0x34')][_0xce9e('0x3f')]){_0x136af9['where']=_[_0xce9e('0x41')](_0x136af9['where'],{'$or':_[_0xce9e('0x2c')](_0x136af9[_0xce9e('0x36')],function(_0x5b93db){var _0x26b49a={};_0x26b49a[_0x5b93db]={'$like':'%'+_0xb404f7['query'][_0xce9e('0x3f')]+'%'};return _0x26b49a;})});}_0x136af9=_[_0xce9e('0x41')]({},_0x136af9,_0xb404f7[_0xce9e('0x4a')]);return _0x51099d[_0xce9e('0x53')](_0x136af9);}})[_0xce9e('0x26')](function(_0x57c177){if(_0x57c177){_0x4fa4f2=_0x57c177[_0xce9e('0x38')];if(!_0xb404f7[_0xce9e('0x34')][_0xce9e('0x39')](_0xce9e('0x3a'))){_0x136af9['limit']=qs[_0xce9e('0x1d')](_0xb404f7[_0xce9e('0x34')][_0xce9e('0x1d')]);_0x136af9['offset']=qs['offset'](_0xb404f7[_0xce9e('0x34')][_0xce9e('0x20')]);}return _0x51099d['getMembers'](_0x136af9);}})['then'](function(_0x54864b){if(_0x54864b){return _0x54864b?{'count':_0x4fa4f2,'rows':_0x54864b}:null;}})[_0xce9e('0x26')](respondWithResult(_0xea8ae,null))['catch'](handleError(_0xea8ae,null));};exports[_0xce9e('0x55')]=function(_0x494710,_0x280baa,_0x53d5b5){return db[_0xce9e('0x2d')][_0xce9e('0x4b')]({'where':{'id':_0x494710['params']['id']}})[_0xce9e('0x26')](handleEntityNotFound(_0x280baa,null))[_0xce9e('0x26')](function(_0x6d07a9){if(_0x6d07a9){return _0x6d07a9[_0xce9e('0x55')](_0x494710[_0xce9e('0x34')][_0xce9e('0x51')]);}})[_0xce9e('0x26')](respondWithStatusCode(_0x280baa,null))[_0xce9e('0x46')](handleError(_0x280baa,null));};exports['addMessage']=function(_0x23721d,_0x5e9288,_0x37d23e){if(_0x23721d[_0xce9e('0x4d')]['id']){delete _0x23721d['body']['id'];}return db[_0xce9e('0x2d')][_0xce9e('0x4b')]({'where':{'id':_0x23721d[_0xce9e('0x47')]['id']}})[_0xce9e('0x26')](handleEntityNotFound(_0x5e9288,null))['then'](function(_0x3f97dc){if(_0x3f97dc){_0x23721d['body']['ChatGroupId']=_0x3f97dc['id'];return db[_0xce9e('0x56')][_0xce9e('0x4c')](_0x23721d['body']);}})[_0xce9e('0x26')](respondWithResult(_0x5e9288,null))[_0xce9e('0x46')](handleError(_0x5e9288,null));};exports[_0xce9e('0x57')]=function(_0x2ba7cc,_0x3e0f87,_0x328257){var _0x166b75={};var _0x537bb9={};var _0x4c1f88;var _0x37d8da;return db[_0xce9e('0x2d')][_0xce9e('0x54')]({'where':{'id':_0x2ba7cc['params']['id']}})['then'](handleEntityNotFound(_0x3e0f87,null))[_0xce9e('0x26')](function(_0x32c774){if(_0x32c774){_0x4c1f88=_0x32c774;_0x537bb9[_0xce9e('0x32')]=_[_0xce9e('0x48')](db['ChatInternalMessage'][_0xce9e('0x2e')]);_0x537bb9['query']=_[_0xce9e('0x48')](_0x2ba7cc[_0xce9e('0x34')]);_0x537bb9[_0xce9e('0x3d')]=_['intersection'](_0x537bb9[_0xce9e('0x32')],_0x537bb9[_0xce9e('0x34')]);_0x166b75[_0xce9e('0x36')]=_['intersection'](_0x537bb9[_0xce9e('0x32')],qs['fields'](_0x2ba7cc['query'][_0xce9e('0x37')]));_0x166b75['attributes']=_0x166b75[_0xce9e('0x36')][_0xce9e('0x38')]?_0x166b75[_0xce9e('0x36')]:_0x537bb9[_0xce9e('0x32')];_0x166b75[_0xce9e('0x3b')]=qs[_0xce9e('0x3c')](_0x2ba7cc[_0xce9e('0x34')]['sort']);_0x166b75['where']=qs[_0xce9e('0x3d')](_[_0xce9e('0x3e')](_0x2ba7cc['query'],_0x537bb9[_0xce9e('0x3d')]));if(_0x2ba7cc[_0xce9e('0x34')][_0xce9e('0x3f')]){_0x166b75[_0xce9e('0x40')]=_['merge'](_0x166b75[_0xce9e('0x40')],{'$or':_[_0xce9e('0x2c')](_0x166b75[_0xce9e('0x36')],function(_0x3e79ce){var _0x342529={};_0x342529[_0x3e79ce]={'$like':'%'+_0x2ba7cc[_0xce9e('0x34')][_0xce9e('0x3f')]+'%'};return _0x342529;})});}if(_0x2ba7cc[_0xce9e('0x34')][_0xce9e('0x58')]){var _0x321c67=_0x2ba7cc['query'][_0xce9e('0x58')]['split'](',');var _0x1ed78d={};_0x1ed78d[_0x321c67[0x0]]={'$gte':moment(_0x321c67[0x1])[_0xce9e('0x59')](_0xce9e('0x5a'))};_0x166b75['where']=_[_0xce9e('0x41')](_0x166b75['where'],_0x1ed78d);}_0x166b75=_[_0xce9e('0x41')]({},_0x166b75,_0x2ba7cc[_0xce9e('0x4a')]);return _0x4c1f88[_0xce9e('0x57')](_0x166b75);}})[_0xce9e('0x26')](function(_0x2ff574){if(_0x2ff574){_0x37d8da=_0x2ff574['length'];if(!_0x2ba7cc[_0xce9e('0x34')][_0xce9e('0x39')]('nolimit')){_0x166b75[_0xce9e('0x1d')]=qs[_0xce9e('0x1d')](_0x2ba7cc[_0xce9e('0x34')]['limit']);_0x166b75[_0xce9e('0x20')]=qs[_0xce9e('0x20')](_0x2ba7cc['query'][_0xce9e('0x20')]);}return _0x4c1f88[_0xce9e('0x57')](_0x166b75);}})[_0xce9e('0x26')](function(_0x4a7b9e){if(_0x4a7b9e){return _0x4a7b9e?{'count':_0x37d8da,'rows':_0x4a7b9e}:null;}})[_0xce9e('0x26')](respondWithResult(_0x3e0f87,null))[_0xce9e('0x46')](handleError(_0x3e0f87,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index ff2c356..5de5cc1 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 _0x1a21=['setMaxListeners','save','update','emit','hasOwnProperty','events','../../mysqldb','ChatGroup'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x1a21,0x1bd));var _0x11a2=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x1a21[_0x1e4a8e];return _0x5408f9;};'use strict';var EventEmitter=require(_0x11a2('0x0'));var ChatGroup=require(_0x11a2('0x1'))['db'][_0x11a2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x11a2('0x3')](0x0);var events={'afterCreate':_0x11a2('0x4'),'afterUpdate':_0x11a2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1a849a){return function(_0x5a9aa3,_0x14487f,_0x34f712){ChatGroupEvents[_0x11a2('0x6')](_0x1a849a+':'+_0x5a9aa3['id'],_0x5a9aa3);ChatGroupEvents[_0x11a2('0x6')](_0x1a849a,_0x5a9aa3);_0x34f712(null);};}for(var e in events){if(events[_0x11a2('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x803d=['update','remove','emit','hasOwnProperty','hook','exports','events','ChatGroup','setMaxListeners','save'];(function(_0x24d61f,_0x38cebb){var _0x29ae79=function(_0x5ae6b7){while(--_0x5ae6b7){_0x24d61f['push'](_0x24d61f['shift']());}};_0x29ae79(++_0x38cebb);}(_0x803d,0x15a));var _0xd803=function(_0x30b5cc,_0x56fbfc){_0x30b5cc=_0x30b5cc-0x0;var _0x382eb4=_0x803d[_0x30b5cc];return _0x382eb4;};'use strict';var EventEmitter=require(_0xd803('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xd803('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd803('0x2')](0x0);var events={'afterCreate':_0xd803('0x3'),'afterUpdate':_0xd803('0x4'),'afterDestroy':_0xd803('0x5')};function emitEvent(_0x11253c){return function(_0x57138a,_0xc67786,_0x55e3d2){ChatGroupEvents[_0xd803('0x6')](_0x11253c+':'+_0x57138a['id'],_0x57138a);ChatGroupEvents[_0xd803('0x6')](_0x11253c,_0x57138a);_0x55e3d2(null);};}for(var e in events){if(events[_0xd803('0x7')](e)){var event=events[e];ChatGroup[_0xd803('0x8')](e,emitEvent(event));}}module[_0xd803('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index ff3b977..d32cbe4 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 _0x8064=['path','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash','util','moment','bluebird','request-promise'];(function(_0xa61132,_0x3de45c){var _0x1154fc=function(_0x2eb7c6){while(--_0x2eb7c6){_0xa61132['push'](_0xa61132['shift']());}};_0x1154fc(++_0x3de45c);}(_0x8064,0x145));var _0x4806=function(_0x22af79,_0x33e17){_0x22af79=_0x22af79-0x0;var _0x4dd10d=_0x8064[_0x22af79];return _0x4dd10d;};'use strict';var _=require(_0x4806('0x0'));var util=require(_0x4806('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4806('0x2'));var BPromise=require(_0x4806('0x3'));var rp=require(_0x4806('0x4'));var fs=require('fs');var path=require(_0x4806('0x5'));var rimraf=require('rimraf');var config=require(_0x4806('0x6'));var attributes=require(_0x4806('0x7'));module[_0x4806('0x8')]=function(_0x76fdcd,_0x3f0a16){return _0x76fdcd[_0x4806('0x9')](_0x4806('0xa'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc290=['util','api','moment','path','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0xc290,0x14d));var _0x0c29=function(_0x2ffc5d,_0x564eba){_0x2ffc5d=_0x2ffc5d-0x0;var _0x57f0a=_0xc290[_0x2ffc5d];return _0x57f0a;};'use strict';var _=require('lodash');var util=require(_0x0c29('0x0'));var logger=require('../../config/logger')(_0x0c29('0x1'));var moment=require(_0x0c29('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c29('0x3'));var rimraf=require('rimraf');var config=require(_0x0c29('0x4'));var attributes=require(_0x0c29('0x5'));module[_0x0c29('0x6')]=function(_0x57c4f6,_0x277042){return _0x57c4f6[_0x0c29('0x7')](_0x0c29('0x8'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index b18e4c5..720be89 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 _0x5270=['redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','request\x20sent','code','ChatGroup,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x5270,0xab));var _0x0527=function(_0x556068,_0x70fa32){_0x556068=_0x556068-0x0;var _0x42a882=_0x5270[_0x556068];return _0x42a882;};'use strict';var _=require(_0x0527('0x0'));var util=require(_0x0527('0x1'));var moment=require('moment');var BPromise=require(_0x0527('0x2'));var rs=require(_0x0527('0x3'));var fs=require('fs');var Redis=require(_0x0527('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0527('0x5'));var logger=require(_0x0527('0x6'))(_0x0527('0x7'));var config=require(_0x0527('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0527('0x9')][_0x0527('0xa')]({'port':0x232a});config[_0x0527('0xb')]=_[_0x0527('0xc')](config['redis'],{'host':_0x0527('0xd'),'port':0x18eb});var socket=require(_0x0527('0xe'))(new Redis(config[_0x0527('0xb')]));require(_0x0527('0xf'))[_0x0527('0x10')](socket);function respondWithRpcPromise(_0x115d11,_0xd96a09,_0x2bd8b3){return new BPromise(function(_0x3bf342,_0x2cd5de){return client[_0x0527('0x11')](_0x115d11,_0x2bd8b3)['then'](function(_0x51b91d){logger[_0x0527('0x12')]('ChatGroup,\x20%s,\x20%s',_0xd96a09,_0x0527('0x13'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0xd96a09,'request\x20sent',JSON['stringify'](_0x51b91d));if(_0x51b91d['error']){if(_0x51b91d['error'][_0x0527('0x14')]===0x1f4){logger['error'](_0x0527('0x15'),_0xd96a09,_0x51b91d[_0x0527('0x16')][_0x0527('0x17')]);return _0x2cd5de(_0x51b91d[_0x0527('0x16')][_0x0527('0x17')]);}logger[_0x0527('0x16')](_0x0527('0x15'),_0xd96a09,_0x51b91d[_0x0527('0x16')]['message']);return _0x3bf342(_0x51b91d[_0x0527('0x16')]['message']);}else{logger[_0x0527('0x12')](_0x0527('0x15'),_0xd96a09,_0x0527('0x13'));_0x3bf342(_0x51b91d[_0x0527('0x18')][_0x0527('0x17')]);}})[_0x0527('0x19')](function(_0xf8bfb9){logger['error'](_0x0527('0x15'),_0xd96a09,_0xf8bfb9);_0x2cd5de(_0xf8bfb9);});});} \ No newline at end of file +var _0x32c0=['error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x32c0,0x1f3));var _0x032c=function(_0x174ae1,_0x30e650){_0x174ae1=_0x174ae1-0x0;var _0x4c5108=_0x32c0[_0x174ae1];return _0x4c5108;};'use strict';var _=require(_0x032c('0x0'));var util=require(_0x032c('0x1'));var moment=require('moment');var BPromise=require(_0x032c('0x2'));var rs=require(_0x032c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x032c('0x4'))['db'];var utils=require(_0x032c('0x5'));var logger=require(_0x032c('0x6'))(_0x032c('0x7'));var config=require('../../config/environment');var jayson=require(_0x032c('0x8'));var client=jayson[_0x032c('0x9')][_0x032c('0xa')]({'port':0x232a});config[_0x032c('0xb')]=_['defaults'](config[_0x032c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x032c('0xc'))(new Redis(config[_0x032c('0xb')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x3c7233,_0x5be922,_0x33fed9){return new BPromise(function(_0x520943,_0x428600){return client[_0x032c('0xd')](_0x3c7233,_0x33fed9)[_0x032c('0xe')](function(_0x14be2a){logger[_0x032c('0xf')](_0x032c('0x10'),_0x5be922,'request\x20sent');logger[_0x032c('0x11')](_0x032c('0x12'),_0x5be922,_0x032c('0x13'),JSON[_0x032c('0x14')](_0x14be2a));if(_0x14be2a['error']){if(_0x14be2a[_0x032c('0x15')][_0x032c('0x16')]===0x1f4){logger[_0x032c('0x15')](_0x032c('0x10'),_0x5be922,_0x14be2a[_0x032c('0x15')][_0x032c('0x17')]);return _0x428600(_0x14be2a['error'][_0x032c('0x17')]);}logger[_0x032c('0x15')](_0x032c('0x10'),_0x5be922,_0x14be2a[_0x032c('0x15')][_0x032c('0x17')]);return _0x520943(_0x14be2a[_0x032c('0x15')]['message']);}else{logger[_0x032c('0xf')](_0x032c('0x10'),_0x5be922,_0x032c('0x13'));_0x520943(_0x14be2a[_0x032c('0x18')][_0x032c('0x17')]);}})[_0x032c('0x19')](function(_0xe222c0){logger[_0x032c('0x15')](_0x032c('0x10'),_0x5be922,_0xe222c0);_0x428600(_0xe222c0);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 120d5fa..e9fdcab 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 _0x1d79=['removeListener','register','length','chatGroup:','./chatGroup.events','remove'];(function(_0x31a28f,_0x2732b6){var _0x143c5b=function(_0xffd9de){while(--_0xffd9de){_0x31a28f['push'](_0x31a28f['shift']());}};_0x143c5b(++_0x2732b6);}(_0x1d79,0x88));var _0x91d7=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x1d79[_0x138adb];return _0x1b27f2;};'use strict';var ChatGroupEvents=require(_0x91d7('0x0'));var events=['save',_0x91d7('0x1'),'update'];function createListener(_0x5dbbbf,_0x4bd0a1){return function(_0x56661b){_0x4bd0a1['emit'](_0x5dbbbf,_0x56661b);};}function removeListener(_0x19cd78,_0xd12e17){return function(){ChatGroupEvents[_0x91d7('0x2')](_0x19cd78,_0xd12e17);};}exports[_0x91d7('0x3')]=function(_0x58580c){for(var _0x5e1592=0x0,_0xfabf01=events[_0x91d7('0x4')];_0x5e1592<_0xfabf01;_0x5e1592++){var _0xc93da8=events[_0x5e1592];var _0x3771f9=createListener(_0x91d7('0x5')+_0xc93da8,_0x58580c);ChatGroupEvents['on'](_0xc93da8,_0x3771f9);}}; \ No newline at end of file +var _0x304c=['removeListener','register','length','chatGroup:','save','remove','update','emit'];(function(_0x4e364c,_0x32af6b){var _0x213b5b=function(_0x56434e){while(--_0x56434e){_0x4e364c['push'](_0x4e364c['shift']());}};_0x213b5b(++_0x32af6b);}(_0x304c,0x154));var _0xc304=function(_0x1c16e5,_0x297035){_0x1c16e5=_0x1c16e5-0x0;var _0x38de4e=_0x304c[_0x1c16e5];return _0x38de4e;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xc304('0x0'),_0xc304('0x1'),_0xc304('0x2')];function createListener(_0x3fce8f,_0x3c4c93){return function(_0x5bb45d){_0x3c4c93[_0xc304('0x3')](_0x3fce8f,_0x5bb45d);};}function removeListener(_0x2da327,_0x149f03){return function(){ChatGroupEvents[_0xc304('0x4')](_0x2da327,_0x149f03);};}exports[_0xc304('0x5')]=function(_0x2067e){for(var _0x30ad9f=0x0,_0xd40177=events[_0xc304('0x6')];_0x30ad9f<_0xd40177;_0x30ad9f++){var _0x4805fb=events[_0x30ad9f];var _0x59cca9=createListener(_0xc304('0x7')+_0x4805fb,_0x2067e);ChatGroupEvents['on'](_0x4805fb,_0x59cca9);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 46ba60c..4d87e8b 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 _0x34df=['get','index','isAuthenticated','describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','create','post','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller'];(function(_0x4e05d8,_0xab2ee9){var _0x356a48=function(_0x161d87){while(--_0x161d87){_0x4e05d8['push'](_0x4e05d8['shift']());}};_0x356a48(++_0xab2ee9);}(_0x34df,0x1e4));var _0xf34d=function(_0x2341c6,_0x3af092){_0x2341c6=_0x2341c6-0x0;var _0x54c34d=_0x34df[_0x2341c6];return _0x54c34d;};'use strict';var multer=require(_0xf34d('0x0'));var util=require(_0xf34d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf34d('0x2'));var router=express[_0xf34d('0x3')]();var fs_extra=require(_0xf34d('0x4'));var auth=require(_0xf34d('0x5'));var interaction=require(_0xf34d('0x6'));var config=require(_0xf34d('0x7'));var controller=require(_0xf34d('0x8'));router[_0xf34d('0x9')]('/',auth['isAuthenticated'](),controller[_0xf34d('0xa')]);router[_0xf34d('0x9')]('/describe',auth[_0xf34d('0xb')](),controller[_0xf34d('0xc')]);router[_0xf34d('0x9')](_0xf34d('0xd'),auth['isAuthenticated'](),controller[_0xf34d('0xe')]);router[_0xf34d('0x9')]('/:id/unread',auth[_0xf34d('0xb')](),controller[_0xf34d('0xf')]);router[_0xf34d('0x9')](_0xf34d('0x10'),auth['isAuthenticated'](),controller[_0xf34d('0x11')]);router[_0xf34d('0x9')](_0xf34d('0x12'),auth[_0xf34d('0xb')](),controller['getMessages']);router['post']('/',auth[_0xf34d('0xb')](),controller[_0xf34d('0x13')]);router[_0xf34d('0x14')]('/:id/members',auth['isAuthenticated'](),controller[_0xf34d('0x15')]);router[_0xf34d('0x14')](_0xf34d('0x12'),auth['isAuthenticated'](),controller[_0xf34d('0x16')]);router[_0xf34d('0x17')]('/:id',auth[_0xf34d('0xb')](),controller[_0xf34d('0x18')]);router[_0xf34d('0x19')](_0xf34d('0xd'),auth[_0xf34d('0xb')](),controller[_0xf34d('0x1a')]);router['delete'](_0xf34d('0x10'),auth[_0xf34d('0xb')](),controller[_0xf34d('0x1b')]);module[_0xf34d('0x1c')]=router; \ No newline at end of file +var _0xc711=['./chatGroup.controller','get','isAuthenticated','index','describe','/:id','/:id/unread','/:id/members','getMembers','getMessages','post','create','addMembers','/:id/messages','put','update','destroy','delete','exports','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xc711,0xf4));var _0x1c71=function(_0x5d3903,_0x3d6c3e){_0x5d3903=_0x5d3903-0x0;var _0x4b8bc9=_0xc711[_0x5d3903];return _0x4b8bc9;};'use strict';var multer=require('multer');var util=require(_0x1c71('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1c71('0x1'));var router=express[_0x1c71('0x2')]();var fs_extra=require(_0x1c71('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1c71('0x4'));var config=require(_0x1c71('0x5'));var controller=require(_0x1c71('0x6'));router[_0x1c71('0x7')]('/',auth[_0x1c71('0x8')](),controller[_0x1c71('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x1c71('0xa')]);router[_0x1c71('0x7')](_0x1c71('0xb'),auth[_0x1c71('0x8')](),controller['show']);router[_0x1c71('0x7')](_0x1c71('0xc'),auth[_0x1c71('0x8')](),controller['getUnread']);router['get'](_0x1c71('0xd'),auth[_0x1c71('0x8')](),controller[_0x1c71('0xe')]);router[_0x1c71('0x7')]('/:id/messages',auth[_0x1c71('0x8')](),controller[_0x1c71('0xf')]);router[_0x1c71('0x10')]('/',auth[_0x1c71('0x8')](),controller[_0x1c71('0x11')]);router[_0x1c71('0x10')]('/:id/members',auth[_0x1c71('0x8')](),controller[_0x1c71('0x12')]);router[_0x1c71('0x10')](_0x1c71('0x13'),auth['isAuthenticated'](),controller['addMessage']);router[_0x1c71('0x14')](_0x1c71('0xb'),auth[_0x1c71('0x8')](),controller[_0x1c71('0x15')]);router['delete'](_0x1c71('0xb'),auth[_0x1c71('0x8')](),controller[_0x1c71('0x16')]);router[_0x1c71('0x17')](_0x1c71('0xd'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x1c71('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index a72f08b..7ae1261 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 _0x12d6=['sequelize','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out'];(function(_0x4be38f,_0x268580){var _0x19dbfd=function(_0x31b813){while(--_0x31b813){_0x4be38f['push'](_0x4be38f['shift']());}};_0x19dbfd(++_0x268580);}(_0x12d6,0x1a2));var _0x612d=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0x12d6[_0x52085a];return _0x5afc1a;};'use strict';var Sequelize=require(_0x612d('0x0'));module['exports']={'closed':{'type':Sequelize[_0x612d('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x612d('0x2')]},'ratingType':{'type':Sequelize[_0x612d('0x3')](_0x612d('0x4'),_0x612d('0x5')),'defaultValue':_0x612d('0x4')},'ratingMessage':{'type':Sequelize[_0x612d('0x6')]},'pathTranscript':{'type':Sequelize[_0x612d('0x6')]},'mailTranscript':{'type':Sequelize[_0x612d('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x612d('0x8')]},'disposition':{'type':Sequelize[_0x612d('0x7')]},'secondDisposition':{'type':Sequelize[_0x612d('0x7')]},'thirdDisposition':{'type':Sequelize[_0x612d('0x7')]},'note':{'type':Sequelize[_0x612d('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x612d('0x7')]},'osName':{'type':Sequelize[_0x612d('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x612d('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x612d('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x612d('0x6')](_0x612d('0x9'))},'read1stAt':{'type':Sequelize[_0x612d('0x8')]},'lastMsgAt':{'type':Sequelize[_0x612d('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x612d('0x3')]('in',_0x612d('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x612d('0x7')]},'customerPort':{'type':Sequelize[_0x612d('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x612d('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x612d('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x612d('0x2')]}}; \ No newline at end of file +var _0xa877=['star','TEXT','DATE','STRING','long','ENUM','out','sequelize','exports','BOOLEAN','INTEGER'];(function(_0x4df208,_0x105fd3){var _0xb19b91=function(_0x28536b){while(--_0x28536b){_0x4df208['push'](_0x4df208['shift']());}};_0xb19b91(++_0x105fd3);}(_0xa877,0x1eb));var _0x7a87=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa877[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x7a87('0x0'));module[_0x7a87('0x1')]={'closed':{'type':Sequelize[_0x7a87('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7a87('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x7a87('0x4'),'thumb'),'defaultValue':_0x7a87('0x4')},'ratingMessage':{'type':Sequelize[_0x7a87('0x5')]},'pathTranscript':{'type':Sequelize[_0x7a87('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7a87('0x6')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7a87('0x7')]},'note':{'type':Sequelize[_0x7a87('0x7')]},'browserName':{'type':Sequelize[_0x7a87('0x7')]},'browserVersion':{'type':Sequelize[_0x7a87('0x7')]},'osName':{'type':Sequelize[_0x7a87('0x7')]},'osVersion':{'type':Sequelize[_0x7a87('0x7')]},'deviceModel':{'type':Sequelize[_0x7a87('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x7a87('0x7')]},'referer':{'type':Sequelize[_0x7a87('0x5')]},'customerIp':{'type':Sequelize[_0x7a87('0x7')]},'formData':{'type':Sequelize[_0x7a87('0x5')](_0x7a87('0x8'))},'read1stAt':{'type':Sequelize[_0x7a87('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x7a87('0x9')]('in',_0x7a87('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x7a87('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x7a87('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x7a87('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7a87('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index b924030..0c0232a 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 _0x3d7a=['getMyMessages','hasOwnProperty','nolimit','pick','push','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','download','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','read','get','mkdirSync','Chat','Account','Owner','N.A.','closed','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','toString','value','renderFile','views','downloadInteraction.ejs','.pdf','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','set','update','destroy','stack','name','send','render','merge','body','contact','account','index','map','ChatInteraction','rawAttributes','type','key','getOptions','findAll','chat','query','user','show','params','model','keys','intersection','attributes','fields','includeAll','include','options','find','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','fullname','email','POST','vidaooTopic','isNull','vidaooNote','follow','vidaooMetadata','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','UserId','disposition','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','ChatOfflineMessageId','close','mailTranscript','join','root','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','User','ContactId','length','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','filters','order','sort','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count','rows'];(function(_0x3a9e82,_0x43b22d){var _0x3209a9=function(_0x3c5ddd){while(--_0x3c5ddd){_0x3a9e82['push'](_0x3a9e82['shift']());}};_0x3209a9(++_0x43b22d);}(_0x3d7a,0x1cd));var _0xa3d7=function(_0x4b49c9,_0x290d55){_0x4b49c9=_0x4b49c9-0x0;var _0xab2d67=_0x3d7a[_0x4b49c9];return _0xab2d67;};'use strict';var rimraf=require(_0xa3d7('0x0'));var zipdir=require('zip-dir');var rp=require(_0xa3d7('0x1'));var moment=require(_0xa3d7('0x2'));var BPromise=require(_0xa3d7('0x3'));var Mustache=require(_0xa3d7('0x4'));var util=require(_0xa3d7('0x5'));var path=require(_0xa3d7('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0xa3d7('0x7'));var interaction=require(_0xa3d7('0x8'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xa3d7('0x9'))(_0xa3d7('0xa'));var config=require(_0xa3d7('0xb'));var db=require('../../mysqldb')['db'];config[_0xa3d7('0xc')]=_[_0xa3d7('0xd')](config[_0xa3d7('0xc')],{'host':_0xa3d7('0xe'),'port':0x18eb});var socket=require(_0xa3d7('0xf'))(new Redis(config[_0xa3d7('0xc')]));require(_0xa3d7('0x10'))['register'](socket);var jayson=require(_0xa3d7('0x11'));var client=jayson[_0xa3d7('0x12')]['http']({'port':0x232b});var client9004=jayson[_0xa3d7('0x12')][_0xa3d7('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x3328e0,_0x6285b1,_0x10b9a8,_0x304d0d){return new BPromise(function(_0x3832e0,_0x491eef){var _0x5eb6b1=_0x304d0d||client;return _0x5eb6b1[_0xa3d7('0x14')](_0x3328e0,_0x10b9a8)[_0xa3d7('0x15')](function(_0x4de410){logger[_0xa3d7('0x16')](_0xa3d7('0x17'),_0x6285b1,_0xa3d7('0x18'));logger['debug'](_0xa3d7('0x19'),_0x6285b1,_0xa3d7('0x18'),JSON['stringify'](_0x4de410));if(_0x4de410[_0xa3d7('0x1a')]){if(_0x4de410[_0xa3d7('0x1a')][_0xa3d7('0x1b')]===0x1f4){logger[_0xa3d7('0x1a')](_0xa3d7('0x17'),_0x6285b1,_0x4de410[_0xa3d7('0x1a')]['message']);return _0x491eef(_0x4de410[_0xa3d7('0x1a')][_0xa3d7('0x1c')]);}logger[_0xa3d7('0x1a')](_0xa3d7('0x17'),_0x6285b1,_0x4de410['error'][_0xa3d7('0x1c')]);return _0x3832e0(_0x4de410[_0xa3d7('0x1a')][_0xa3d7('0x1c')]);}else{logger[_0xa3d7('0x16')](_0xa3d7('0x17'),_0x6285b1,'request\x20sent');_0x3832e0(_0x4de410[_0xa3d7('0x1d')][_0xa3d7('0x1c')]);}})[_0xa3d7('0x1e')](function(_0x331d54){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x6285b1,_0x331d54);_0x491eef(_0x331d54);});});}function respondWithStatusCode(_0x4a1981,_0x4db22e){_0x4db22e=_0x4db22e||0xcc;return function(_0x1e2a8b){if(_0x1e2a8b){return _0x4a1981[_0xa3d7('0x1f')](_0x4db22e);}return _0x4a1981[_0xa3d7('0x20')](_0x4db22e)['end']();};}function respondWithResult(_0x419652,_0x1eb3cd){_0x1eb3cd=_0x1eb3cd||0xc8;return function(_0x122724){if(_0x122724){return _0x419652[_0xa3d7('0x20')](_0x1eb3cd)[_0xa3d7('0x21')](_0x122724);}};}function respondWithFilteredResult(_0x478f8a,_0x1a8b3b){return function(_0xb30fe9){if(_0xb30fe9){var _0x194dee=typeof _0x1a8b3b[_0xa3d7('0x22')]===_0xa3d7('0x23')&&typeof _0x1a8b3b[_0xa3d7('0x24')]===_0xa3d7('0x23');var _0x4f1cc7=_0xb30fe9['count'];var _0x5c9ffa=_0x194dee?0x0:_0x1a8b3b[_0xa3d7('0x22')];var _0x43fef8=_0x194dee?_0xb30fe9['count']:_0x1a8b3b['offset']+_0x1a8b3b['limit'];var _0x230c9a;if(_0x43fef8>=_0x4f1cc7){_0x43fef8=_0x4f1cc7;_0x230c9a=0xc8;}else{_0x230c9a=0xce;}_0x478f8a['status'](_0x230c9a);return _0x478f8a[_0xa3d7('0x25')]('Content-Range',_0x5c9ffa+'-'+_0x43fef8+'/'+_0x4f1cc7)[_0xa3d7('0x21')](_0xb30fe9);}return null;};}function saveUpdates(_0x4e7579){return function(_0x5823ae){if(_0x5823ae){return _0x5823ae[_0xa3d7('0x26')](_0x4e7579)[_0xa3d7('0x15')](function(_0x20ccec){return _0x20ccec;});}return null;};}function removeEntity(_0x47e25b){return function(_0x363fe8){if(_0x363fe8){return _0x363fe8[_0xa3d7('0x27')]()['then'](function(){_0x47e25b[_0xa3d7('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x60e8b1){return function(_0x2ab73d){if(!_0x2ab73d){_0x60e8b1['sendStatus'](0x194);}return _0x2ab73d;};}function handleError(_0x3ac178,_0x3f02c6){_0x3f02c6=_0x3f02c6||0x1f4;return function(_0x142e37){logger[_0xa3d7('0x1a')](_0x142e37[_0xa3d7('0x28')]);if(_0x142e37[_0xa3d7('0x29')]){delete _0x142e37['name'];}_0x3ac178[_0xa3d7('0x20')](_0x3f02c6)[_0xa3d7('0x2a')](_0x142e37);};}function getMustacheRender(_0x2e3bef,_0x4523a){return Mustache[_0xa3d7('0x2b')](_0x2e3bef,_[_0xa3d7('0x2c')](_0x4523a[_0xa3d7('0x2d')],{'contact':_0x4523a[_0xa3d7('0x2e')],'message':_0x4523a[_0xa3d7('0x1c')],'agent':_0x4523a['agent'],'interaction':_0x4523a['interaction'],'account':_0x4523a[_0xa3d7('0x2f')]}))||'';}exports[_0xa3d7('0x30')]=function(_0x707356,_0x40264d){var _0x4f7916={};var _0x1cd56e=_[_0xa3d7('0x31')](db[_0xa3d7('0x32')][_0xa3d7('0x33')],function(_0x125bbc){return{'name':_0x125bbc['fieldName'],'type':_0x125bbc[_0xa3d7('0x34')][_0xa3d7('0x35')]};});_0x4f7916=qs[_0xa3d7('0x36')](_0x1cd56e,_0x707356);return interaction[_0xa3d7('0x37')](_0xa3d7('0x38'),_0x707356[_0xa3d7('0x39')],_0x707356[_0xa3d7('0x3a')],_0x4f7916,_0x1cd56e)[_0xa3d7('0x15')](respondWithFilteredResult(_0x40264d,_0x4f7916))[_0xa3d7('0x1e')](handleError(_0x40264d,null));};exports[_0xa3d7('0x3b')]=function(_0x2f32e3,_0x2d8f32){var _0x4a6128={'raw':![],'where':{'id':_0x2f32e3[_0xa3d7('0x3c')]['id']}},_0x39b88d={};_0x39b88d[_0xa3d7('0x3d')]=_[_0xa3d7('0x3e')](db[_0xa3d7('0x32')]['rawAttributes']);_0x39b88d[_0xa3d7('0x39')]=_[_0xa3d7('0x3e')](_0x2f32e3[_0xa3d7('0x39')]);_0x39b88d['filters']=_[_0xa3d7('0x3f')](_0x39b88d[_0xa3d7('0x3d')],_0x39b88d[_0xa3d7('0x39')]);_0x4a6128[_0xa3d7('0x40')]=_['intersection'](_0x39b88d[_0xa3d7('0x3d')],qs[_0xa3d7('0x41')](_0x2f32e3[_0xa3d7('0x39')][_0xa3d7('0x41')]));_0x4a6128[_0xa3d7('0x40')]=_0x4a6128[_0xa3d7('0x40')]['length']?_0x4a6128['attributes']:_0x39b88d['model'];if(_0x2f32e3[_0xa3d7('0x39')][_0xa3d7('0x42')]){_0x4a6128[_0xa3d7('0x43')]=[{'all':!![]}];}_0x4a6128=_[_0xa3d7('0x2c')]({},_0x4a6128,_0x2f32e3[_0xa3d7('0x44')]);return db[_0xa3d7('0x32')][_0xa3d7('0x45')](_0x4a6128)[_0xa3d7('0x15')](handleEntityNotFound(_0x2d8f32,null))['then'](respondWithResult(_0x2d8f32,null))[_0xa3d7('0x1e')](handleError(_0x2d8f32,null));};exports['create']=function(_0x129220,_0x1ab590){return db['ChatInteraction']['create'](_0x129220[_0xa3d7('0x2d')],{})[_0xa3d7('0x15')](respondWithResult(_0x1ab590,0xc9))[_0xa3d7('0x1e')](handleError(_0x1ab590,null));};exports[_0xa3d7('0x26')]=function(_0x2456f5,_0x40b47f){if(_0x2456f5[_0xa3d7('0x2d')]['id']){delete _0x2456f5[_0xa3d7('0x2d')]['id'];}return db[_0xa3d7('0x32')][_0xa3d7('0x45')]({'where':{'id':_0x2456f5[_0xa3d7('0x3c')]['id']}})[_0xa3d7('0x15')](handleEntityNotFound(_0x40b47f,null))[_0xa3d7('0x15')](saveUpdates(_0x2456f5[_0xa3d7('0x2d')],null))[_0xa3d7('0x15')](respondWithResult(_0x40b47f,null))[_0xa3d7('0x1e')](handleError(_0x40b47f,null));};exports[_0xa3d7('0x27')]=function(_0x4e2b4a,_0x521f5f){return db[_0xa3d7('0x32')][_0xa3d7('0x45')]({'where':{'id':_0x4e2b4a['params']['id']}})['then'](handleEntityNotFound(_0x521f5f,null))[_0xa3d7('0x15')](removeEntity(_0x521f5f,null))[_0xa3d7('0x1e')](handleError(_0x521f5f,null));};exports[_0xa3d7('0x46')]=function(_0x401abf,_0x12fd36){return db[_0xa3d7('0x32')][_0xa3d7('0x46')]()['then'](respondWithResult(_0x12fd36,null))[_0xa3d7('0x1e')](handleError(_0x12fd36,null));};exports[_0xa3d7('0x47')]=function(_0x59567c,_0x4933e6){var _0x2f89f6=_0x59567c[_0xa3d7('0x3c')]['id'];var _0x4eadef;var _0x5a0000;var _0x653c3d;return db['ChatInteraction'][_0xa3d7('0x48')]({'where':{'id':_0x2f89f6}})[_0xa3d7('0x15')](function(_0x3e6c57){_0x4eadef=_0x3e6c57;return db[_0xa3d7('0x49')]['findOne']({'where':{'id':_0x3e6c57[_0xa3d7('0x4a')]},'attributes':['id',_0xa3d7('0x4b'),_0xa3d7('0x4c'),'vidaooTopic','vidaooNote','vidaooMetadata'],'raw':!![]});})[_0xa3d7('0x15')](function(_0xff6fda){if(_0xff6fda&&_0xff6fda[_0xa3d7('0x4b')]&&_0xff6fda[_0xa3d7('0x4c')]){_0x5a0000=_0xff6fda;var _0x5af550={'interaction':{'id':_0x2f89f6},'agent':{'id':_0x59567c['user']['id'],'name':_0x59567c['user']['name'],'fullname':_0x59567c[_0xa3d7('0x3a')][_0xa3d7('0x4d')],'email':_0x59567c[_0xa3d7('0x3a')][_0xa3d7('0x4e')]},'contact':_0x59567c[_0xa3d7('0x2d')][_0xa3d7('0x2e')],'account':_0x59567c[_0xa3d7('0x2d')][_0xa3d7('0x2f')]};var _0x383a13={'rejectUnauthorized':![],'method':_0xa3d7('0x4f'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0xff6fda[_0xa3d7('0x4b')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x59567c[_0xa3d7('0x3a')][_0xa3d7('0x4e')]],'buttons':null,'topic':_0x5a0000[_0xa3d7('0x50')],'note':_[_0xa3d7('0x51')](_0x5a0000[_0xa3d7('0x52')])?null:getMustacheRender(_0x5a0000[_0xa3d7('0x52')],_0x5af550),'metadata':null},'redirect':_0xa3d7('0x53'),'json':!![]};try{if(!_[_0xa3d7('0x51')](_0x5a0000[_0xa3d7('0x54')])){var _0x5ce4d6=getMustacheRender(_0x5a0000['vidaooMetadata'],_0x5af550);var _0x20fe2b=JSON['parse'](_0x5ce4d6);_0x383a13[_0xa3d7('0x2d')][_0xa3d7('0x55')]=_0x20fe2b;}}catch(_0x2c1a47){throw new db[(_0xa3d7('0x56'))][(_0xa3d7('0x57'))](_0xa3d7('0x58'));}return rp(_0x383a13);}else{throw new db[(_0xa3d7('0x56'))][(_0xa3d7('0x57'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xa3d7('0x15')](function(_0x21d5a0){_0x653c3d=_0x21d5a0;if(_0x653c3d['id']){var _0x43eed9={'body':_0x653c3d[_0xa3d7('0x59')],'ChatWebsiteId':_0x5a0000['id'],'ChatInteractionId':_0x4eadef['id'],'direction':_0xa3d7('0x5a'),'UserId':_0x59567c[_0xa3d7('0x3a')]['id']};return db[_0xa3d7('0x5b')][_0xa3d7('0x5c')](_0x43eed9,{});}else{throw new db[(_0xa3d7('0x56'))]['ValidationError'](_0xa3d7('0x5d'));}})[_0xa3d7('0x15')](function(){return _0x4eadef[_0xa3d7('0x5e')]({'vidaooSessionId':_0x653c3d['id']});})[_0xa3d7('0x15')](respondWithResult(_0x4933e6,null))['catch'](handleError(_0x4933e6,null));};exports[_0xa3d7('0x5f')]=function(_0x30e6c3,_0x1e50b8){if(_0x30e6c3[_0xa3d7('0x2d')]['id']){delete _0x30e6c3[_0xa3d7('0x2d')]['id'];}return db[_0xa3d7('0x32')][_0xa3d7('0x45')]({'where':{'id':_0x30e6c3[_0xa3d7('0x3c')]['id']},'include':[{'model':db[_0xa3d7('0x60')],'as':_0xa3d7('0x61')}]})[_0xa3d7('0x15')](handleEntityNotFound(_0x1e50b8,null))['then'](saveUpdates(_0x30e6c3[_0xa3d7('0x2d')],null))['then'](respondWithResult(_0x1e50b8,null))['catch'](handleError(_0x1e50b8,null));};exports['abandon']=function(_0x2b4641,_0x517e1d){if(_0x2b4641[_0xa3d7('0x2d')]['id']){delete _0x2b4641[_0xa3d7('0x2d')]['id'];}return db[_0xa3d7('0x32')][_0xa3d7('0x45')]({'where':{'id':_0x2b4641['params']['id']}})[_0xa3d7('0x15')](function(_0x31d940){if(!_0x31d940){logger[_0xa3d7('0x1a')](_0xa3d7('0x62'),_0xa3d7('0x63'),0x194,'entity\x20not\x20found');_0x517e1d[_0xa3d7('0x1f')](0x194);}else{if(_0x31d940[_0xa3d7('0x64')]){throw new db[(_0xa3d7('0x56'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x31d940;})[_0xa3d7('0x15')](function(_0x173736){if(_0x173736){return _0x173736[_0xa3d7('0x26')]({'closed':_0x2b4641[_0xa3d7('0x2d')]['closed'],'disposition':_0x2b4641['body'][_0xa3d7('0x65')]})[_0xa3d7('0x15')](function(_0x2d3103){return _0x2d3103;});}})[_0xa3d7('0x15')](function(){return respondWithRpcPromise('AbandonInteraction',_0xa3d7('0x63'),_0x2b4641[_0xa3d7('0x2d')],client9004);})[_0xa3d7('0x15')](respondWithResult(_0x517e1d,null))[_0xa3d7('0x1e')](handleError(_0x517e1d,null));};exports[_0xa3d7('0x66')]=function(_0x9b6424,_0x306a3c){_0x9b6424[_0xa3d7('0x2d')]['name']=_0x9b6424[_0xa3d7('0x67')][_0xa3d7('0x68')];_0x9b6424[_0xa3d7('0x2d')][_0xa3d7('0x69')]=_0x9b6424[_0xa3d7('0x67')][_0xa3d7('0x6a')];_0x9b6424[_0xa3d7('0x2d')]['type']=_0x9b6424[_0xa3d7('0x67')][_0xa3d7('0x6b')];return db[_0xa3d7('0x6c')][_0xa3d7('0x5c')](_0x9b6424[_0xa3d7('0x2d')])['then'](respondWithResult(_0x306a3c,0xc9))['catch'](handleError(_0x306a3c,null));};exports[_0xa3d7('0x6d')]=function(_0x388d97,_0x5ae6a6){return db['ChatInteraction'][_0xa3d7('0x48')]({'where':{'id':_0x388d97[_0xa3d7('0x3c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5ae6a6,null))[_0xa3d7('0x15')](function(_0x434c95){if(_0x434c95){if(_0x434c95['closed']){return _0x5ae6a6['status'](0x193)[_0xa3d7('0x21')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0xa3d7('0x48')]({'where':{'id':_0x388d97[_0xa3d7('0x39')]['attachId']},'raw':!![]})[_0xa3d7('0x15')](handleEntityNotFound(_0x5ae6a6,null));}})[_0xa3d7('0x15')](function(_0x169600){if(_0x169600){var _0x5663e2=_0x169600[_0xa3d7('0x6e')]!==null;var _0x51c7fb=path['join'](config['root'],'server/files/attachments/');if(_0x5663e2){_0x51c7fb=path['join'](_0x51c7fb,'offline-chat/');}var _0x149e77=path['join'](_0x51c7fb,_0x169600['basename']);return _0x5ae6a6['download'](_0x149e77);}})[_0xa3d7('0x1e')](handleError(_0x5ae6a6,null));};exports[_0xa3d7('0x6f')]=function(_0x49c01e,_0x43a701){var _0x2c01ab=null;var _0x55adfb=null;var _0x3ccf23=null;if(_0x49c01e[_0xa3d7('0x2d')]['id']){delete _0x49c01e['body']['id'];}if(_0x49c01e[_0xa3d7('0x2d')][_0xa3d7('0x70')]){_0x3ccf23=path[_0xa3d7('0x71')](config[_0xa3d7('0x72')],_0xa3d7('0x73'),util[_0xa3d7('0x74')](_0xa3d7('0x75'),Date[_0xa3d7('0x76')]()));_0x49c01e[_0xa3d7('0x2d')]['pathTranscript']=_0x3ccf23;}return db[_0xa3d7('0x32')][_0xa3d7('0x45')]({'where':{'id':_0x49c01e[_0xa3d7('0x3c')]['id']},'include':[{'model':db[_0xa3d7('0x5b')],'as':_0xa3d7('0x77'),'include':[{'model':db[_0xa3d7('0x78')],'as':'User'}]}]})[_0xa3d7('0x15')](handleEntityNotFound(_0x43a701,null))[_0xa3d7('0x15')](saveUpdates(_0x49c01e[_0xa3d7('0x2d')],null))[_0xa3d7('0x15')](function(_0x18c3d2){if(_0x18c3d2){_0x2c01ab=_0x18c3d2;return db[_0xa3d7('0x49')][_0xa3d7('0x45')]({'where':{'id':_0x2c01ab[_0xa3d7('0x4a')]}});}})['then'](function(_0x1c2996){if(_0x1c2996){_0x55adfb=_0x1c2996;return db[_0xa3d7('0x60')][_0xa3d7('0x45')]({'where':{'id':_0x2c01ab[_0xa3d7('0x79')]}});}})[_0xa3d7('0x15')](function(_0x146c96){if(_0x146c96){if(_0x3ccf23){var _0x415d7f=null;for(var _0xbc5ac8=0x1;_0xbc5ac8<_0x2c01ab[_0xa3d7('0x77')][_0xa3d7('0x7a')];++_0xbc5ac8){_0x415d7f=_0x2c01ab['Messages'][_0xbc5ac8];var _0x56d249=_0x415d7f['UserId']?util[_0xa3d7('0x74')](_0xa3d7('0x7b'),_0x55adfb[_0xa3d7('0x7c')],_0x415d7f[_0xa3d7('0x64')]):_0xa3d7('0x7d');var _0xee2d5d=_0x49c01e[_0xa3d7('0x2d')][_0xa3d7('0x7e')]||util['format'](_0xa3d7('0x7b'),_0xa3d7('0x7f'),_0x415d7f['ContactId']);switch(_0x55adfb[_0xa3d7('0x80')]){case _0xa3d7('0x81'):_0x56d249=_0x415d7f[_0xa3d7('0x64')]?util[_0xa3d7('0x74')](_0xa3d7('0x7b'),_0x55adfb[_0xa3d7('0x7c')],_0x415d7f[_0xa3d7('0x64')]):'System';break;case'agent_alias':_0x56d249=_0x415d7f[_0xa3d7('0x64')]?_0x415d7f[_0xa3d7('0x78')][_0xa3d7('0x82')]||_0x415d7f[_0xa3d7('0x78')][_0xa3d7('0x4d')]:_0xa3d7('0x7d');break;case'agent_fullname':_0x56d249=_0x415d7f[_0xa3d7('0x64')]?_0x415d7f['User'][_0xa3d7('0x4d')]:'System';break;default:_0x56d249=_0x415d7f[_0xa3d7('0x64')]?util[_0xa3d7('0x74')](_0xa3d7('0x7b'),_0x55adfb[_0xa3d7('0x7c')],_0x415d7f[_0xa3d7('0x64')]):_0xa3d7('0x7d');}var _0x169494=util[_0xa3d7('0x74')](_0xa3d7('0x83'),moment(_0x415d7f[_0xa3d7('0x84')])['format'](_0xa3d7('0x85')),_0x415d7f[_0xa3d7('0x86')]==='in'?_0xee2d5d:_0x56d249,_0x415d7f[_0xa3d7('0x2d')]);if(!_0x415d7f[_0xa3d7('0x87')]){fs[_0xa3d7('0x88')](_0x3ccf23,_0x169494);}}return db[_0xa3d7('0x89')][_0xa3d7('0x48')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xa3d7('0x8a'),'raw':!![],'include':[{'model':db[_0xa3d7('0x8b')],'as':_0xa3d7('0x8b'),'raw':!![]}]}]});}}})[_0xa3d7('0x15')](function(_0x3d8325){if(!_0x3d8325||!_0x3d8325[_0xa3d7('0x8a')]||!_0x49c01e[_0xa3d7('0x2d')])return _0x2c01ab;var _0x46c56e=_0x3d8325[_0xa3d7('0x8c')]();return respondWithRpcPromise(_0xa3d7('0x8d'),_0xa3d7('0x8e'),{'account':_0x46c56e,'message':{'from':util[_0xa3d7('0x74')]('\x22%s\x22\x20<%s>',_0x3d8325['name'],_0x3d8325['email']||_0x3d8325['Smtp'][_0xa3d7('0x3a')]),'to':_0x49c01e[_0xa3d7('0x2d')][_0xa3d7('0x70')],'subject':_0xa3d7('0x8f'),'text':util['format'](_0xa3d7('0x90'),_0x49c01e['body'][_0xa3d7('0x70')]),'attachments':[{'path':_0x3ccf23}]}})['then'](function(){return _0x2c01ab;})[_0xa3d7('0x1e')](function(_0x2f6e46){logger[_0xa3d7('0x1a')](_0x2f6e46);});})[_0xa3d7('0x15')](respondWithStatusCode(_0x43a701,0xc8))[_0xa3d7('0x1e')](handleError(_0x43a701,null));};exports[_0xa3d7('0x91')]=function(_0x4e24de,_0x540319){return db[_0xa3d7('0x5b')]['find']({'where':{'id':_0x4e24de['params']['id']}})[_0xa3d7('0x15')](handleEntityNotFound(_0x540319,null))[_0xa3d7('0x15')](function(_0x5856db){if(_0x5856db){return _0x5856db[_0xa3d7('0x91')](_0x4e24de['body'][_0xa3d7('0x92')],_[_0xa3d7('0x93')](_0x4e24de['body'],[_0xa3d7('0x92'),'id'])||{});}})[_0xa3d7('0x15')](respondWithResult(_0x540319,null))['catch'](handleError(_0x540319,null));};exports[_0xa3d7('0x94')]=function(_0x537592,_0x3f5ee0){var _0x3dc707={'raw':![],'where':{}};var _0x484172={};var _0x49a69d={'count':0x0,'rows':[]};return db[_0xa3d7('0x32')]['findOne']({'where':{'id':_0x537592['params']['id']}})[_0xa3d7('0x15')](handleEntityNotFound(_0x3f5ee0,null))[_0xa3d7('0x15')](function(_0x5262a7){if(_0x5262a7){_0x484172[_0xa3d7('0x3d')]=_[_0xa3d7('0x3e')](db[_0xa3d7('0x5b')][_0xa3d7('0x33')]);_0x484172[_0xa3d7('0x39')]=_[_0xa3d7('0x3e')](_0x537592[_0xa3d7('0x39')]);_0x484172[_0xa3d7('0x95')]=_['intersection'](_0x484172[_0xa3d7('0x3d')],_0x484172['query']);_0x3dc707[_0xa3d7('0x40')]=_[_0xa3d7('0x3f')](_0x484172[_0xa3d7('0x3d')],qs[_0xa3d7('0x41')](_0x537592[_0xa3d7('0x39')][_0xa3d7('0x41')]));_0x3dc707['attributes']=_0x3dc707[_0xa3d7('0x40')][_0xa3d7('0x7a')]?_0x3dc707[_0xa3d7('0x40')]:_0x484172['model'];if(!_0x537592[_0xa3d7('0x39')]['hasOwnProperty']('nolimit')){_0x3dc707['limit']=qs[_0xa3d7('0x24')](_0x537592[_0xa3d7('0x39')]['limit']);_0x3dc707[_0xa3d7('0x22')]=qs['offset'](_0x537592[_0xa3d7('0x39')]['offset']);}_0x3dc707[_0xa3d7('0x96')]=qs[_0xa3d7('0x97')](_0x537592['query'][_0xa3d7('0x97')]);_0x3dc707[_0xa3d7('0x98')]=qs[_0xa3d7('0x95')](_['pick'](_0x537592[_0xa3d7('0x39')],_0x484172[_0xa3d7('0x95')]));_0x3dc707[_0xa3d7('0x98')][_0xa3d7('0x99')]=_0x5262a7['id'];if(_0x537592[_0xa3d7('0x39')][_0xa3d7('0x9a')]){_0x3dc707[_0xa3d7('0x98')]=_['merge'](_0x3dc707[_0xa3d7('0x98')],{'$or':_[_0xa3d7('0x31')](_0x3dc707[_0xa3d7('0x40')],function(_0x2b9287){var _0x5a6e5f={};_0x5a6e5f[_0x2b9287]={'$like':'%'+_0x537592['query']['filter']+'%'};return _0x5a6e5f;})});}if(_0x537592[_0xa3d7('0x39')]['$gte']){var _0x273c13=_0x537592[_0xa3d7('0x39')][_0xa3d7('0x9b')][_0xa3d7('0x9c')](',');var _0x11ea7c={};_0x11ea7c[_0x273c13[0x0]]={'$gte':moment(_0x273c13[0x1])[_0xa3d7('0x74')](_0xa3d7('0x9d'))};_0x3dc707['where']=_['merge'](_0x3dc707[_0xa3d7('0x98')],_0x11ea7c);}_0x3dc707=_[_0xa3d7('0x2c')]({},_0x3dc707,_0x537592['options']);return db[_0xa3d7('0x5b')][_0xa3d7('0x9e')]({'where':_0x3dc707[_0xa3d7('0x98')]})[_0xa3d7('0x15')](function(_0x3ee67a){_0x49a69d['count']=_0x3ee67a;if(_0x537592['query'][_0xa3d7('0x42')]){_0x3dc707[_0xa3d7('0x43')]=[{'all':!![]}];}return db[_0xa3d7('0x5b')][_0xa3d7('0x37')](_0x3dc707);})[_0xa3d7('0x15')](function(_0x25edbc){_0x49a69d[_0xa3d7('0x9f')]=_0x25edbc;return _0x49a69d;});}})[_0xa3d7('0x15')](respondWithFilteredResult(_0x3f5ee0,_0x3dc707))[_0xa3d7('0x1e')](handleError(_0x3f5ee0,null));};exports[_0xa3d7('0xa0')]=function(_0x35937c,_0x400035){var _0x4a23fa={'where':{}},_0x2689a3={},_0xe48867={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xa3d7('0x48')]({'where':{'id':_0x35937c[_0xa3d7('0x3c')]['id']}})[_0xa3d7('0x15')](handleEntityNotFound(_0x400035,null))[_0xa3d7('0x15')](function(_0x13b281){if(_0x13b281){_0x2689a3['model']=_[_0xa3d7('0x3e')](db[_0xa3d7('0x5b')][_0xa3d7('0x33')]);_0x2689a3[_0xa3d7('0x39')]=_['keys'](_0x35937c[_0xa3d7('0x39')]);_0x2689a3['filters']=_[_0xa3d7('0x3f')](_0x2689a3[_0xa3d7('0x3d')],_0x2689a3['query']);_0x4a23fa[_0xa3d7('0x40')]=_[_0xa3d7('0x3f')](_0x2689a3[_0xa3d7('0x3d')],qs['fields'](_0x35937c[_0xa3d7('0x39')][_0xa3d7('0x41')]));_0x4a23fa['attributes']=_0x4a23fa[_0xa3d7('0x40')][_0xa3d7('0x7a')]?_0x4a23fa[_0xa3d7('0x40')]:_0x2689a3[_0xa3d7('0x3d')];if(!_0x35937c[_0xa3d7('0x39')][_0xa3d7('0xa1')](_0xa3d7('0xa2'))){_0x4a23fa[_0xa3d7('0x24')]=qs['limit'](_0x35937c[_0xa3d7('0x39')]['limit']);_0x4a23fa[_0xa3d7('0x22')]=qs[_0xa3d7('0x22')](_0x35937c['query']['offset']);}_0x4a23fa[_0xa3d7('0x96')]=qs[_0xa3d7('0x97')](_0x35937c[_0xa3d7('0x39')][_0xa3d7('0x97')]);_0x4a23fa['where']=qs[_0xa3d7('0x95')](_[_0xa3d7('0xa3')](_0x35937c[_0xa3d7('0x39')],_0x2689a3[_0xa3d7('0x95')]));_0x4a23fa[_0xa3d7('0x98')][_0xa3d7('0x99')]=_0x13b281['id'];if(_0x35937c['query'][_0xa3d7('0x9a')]){_0x4a23fa[_0xa3d7('0x98')]=_['merge'](_0x4a23fa['where'],{'$or':_[_0xa3d7('0x31')](_0x4a23fa['attributes'],function(_0x66a4cf){var _0x491f4a={};_0x491f4a[_0x66a4cf]={'$like':'%'+_0x35937c[_0xa3d7('0x39')][_0xa3d7('0x9a')]+'%'};return _0x491f4a;})});}_0x4a23fa[_0xa3d7('0x98')]['secret']=![];if(_0x35937c['query']['id']){_0x4a23fa[_0xa3d7('0x98')]['id']={'$gt':_0x35937c['query']['id']};}_0x4a23fa=_['merge']({},_0x4a23fa,_0x35937c[_0xa3d7('0x44')]);return db[_0xa3d7('0x5b')]['count']({'where':_0x4a23fa[_0xa3d7('0x98')]})[_0xa3d7('0x15')](function(_0x2fca13){_0xe48867['count']=_0x2fca13;_0x4a23fa[_0xa3d7('0x43')]=[];if(_0x35937c[_0xa3d7('0x39')]['includeAgent']){_0x4a23fa['include'][_0xa3d7('0xa4')]({'model':db[_0xa3d7('0x78')],'as':'User','attributes':['id','fullname',_0xa3d7('0x82')]});}if(_0x35937c[_0xa3d7('0x39')][_0xa3d7('0x42')]){_0x4a23fa[_0xa3d7('0x43')]=[{'all':!![]}];}return db[_0xa3d7('0x5b')][_0xa3d7('0x37')](_0x4a23fa);})[_0xa3d7('0x15')](function(_0x3f40ef){_0xe48867['rows']=_0x3f40ef;return _0xe48867;});}})[_0xa3d7('0x15')](respondWithFilteredResult(_0x400035,_0x4a23fa))[_0xa3d7('0x1e')](handleError(_0x400035,null));};exports[_0xa3d7('0xa5')]=function(_0x2692a4,_0x341273){return db['ChatInteraction'][_0xa3d7('0x45')]({'where':{'id':_0x2692a4[_0xa3d7('0x3c')]['id']}})[_0xa3d7('0x15')](handleEntityNotFound(_0x341273,null))[_0xa3d7('0x15')](function(_0x74dfc){if(_0x74dfc){return _0x74dfc[_0xa3d7('0xa6')](_0x2692a4[_0xa3d7('0x2d')][_0xa3d7('0x92')],_[_0xa3d7('0x93')](_0x2692a4[_0xa3d7('0x2d')],[_0xa3d7('0x92'),'id'])||{})[_0xa3d7('0xa7')](function(){return db[_0xa3d7('0xa8')][_0xa3d7('0x37')]({'attributes':['id',_0xa3d7('0x29'),_0xa3d7('0xa9')],'where':{'id':_0x2692a4[_0xa3d7('0x2d')]['ids']}});})[_0xa3d7('0x15')](function(_0x53869e){socket[_0xa3d7('0xaa')](_0xa3d7('0xab'),{'id':Number(_0x2692a4['params']['id']),'tags':_0x53869e||[]});return{'id':Number(_0x2692a4[_0xa3d7('0x3c')]['id']),'tags':_0x53869e||[]};});}})['then'](respondWithResult(_0x341273,null))['catch'](handleError(_0x341273,null));};exports[_0xa3d7('0xac')]=function(_0x32e85a,_0x3d9cb5){return db['ChatInteraction'][_0xa3d7('0x45')]({'where':{'id':_0x32e85a['params']['id']}})[_0xa3d7('0x15')](handleEntityNotFound(_0x3d9cb5,null))[_0xa3d7('0x15')](function(_0xb22302){if(_0xb22302){return _0xb22302[_0xa3d7('0xac')](_0x32e85a[_0xa3d7('0x39')][_0xa3d7('0x92')]);}})[_0xa3d7('0x15')](respondWithStatusCode(_0x3d9cb5,null))['catch'](handleError(_0x3d9cb5,null));};exports[_0xa3d7('0xad')]=function(_0x51b2be,_0x33204b){var _0x3d7600=moment()[_0xa3d7('0xae')]()['toString']();var _0x79a082=path[_0xa3d7('0x71')](config[_0xa3d7('0x72')],_0xa3d7('0xaf'),_0xa3d7('0xb0'),_0xa3d7('0xb1'));var _0x2e470f=path[_0xa3d7('0x71')](config[_0xa3d7('0x72')],'server','files',_0xa3d7('0xb2'));var _0x5a2e6b=path['join'](_0x79a082,_0x3d7600);var _0x5d05c4=util[_0xa3d7('0x74')](_0xa3d7('0xb3'),_0x51b2be[_0xa3d7('0x3c')]['id'],_0x3d7600);var _0x36c1e1=path[_0xa3d7('0x71')](_0x79a082,_0x5d05c4);var _0x1914be=[];_0x1914be[_0xa3d7('0xa4')]({'model':db[_0xa3d7('0x78')],'as':_0xa3d7('0x78'),'attributes':['id',_0xa3d7('0x4d')],'raw':!![]});_0x1914be[_0xa3d7('0xa4')]({'model':db['CmContact'],'as':_0xa3d7('0x61'),'attributes':['id',_0xa3d7('0xb4'),_0xa3d7('0xb5')],'raw':!![]});if(_0x51b2be[_0xa3d7('0x39')][_0xa3d7('0xb2')]){_0x1914be[_0xa3d7('0xa4')]({'model':db['Attachment'],'as':_0xa3d7('0x6c'),'raw':!![]});}var _0x43102e=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id','body',_0xa3d7('0x84'),_0xa3d7('0x86'),_0xa3d7('0x87'),_0xa3d7('0xb6')],'include':_0x1914be}];_0x43102e[_0xa3d7('0xa4')]({'model':db[_0xa3d7('0x49')],'as':'Account','attributes':['id',_0xa3d7('0x29')]});_0x43102e['push']({'model':db[_0xa3d7('0x78')],'as':'Owner','attributes':['id',_0xa3d7('0x4d')]});return db[_0xa3d7('0x32')]['find']({'where':{'id':_0x51b2be[_0xa3d7('0x3c')]['id']},'include':_0x43102e})['then'](handleEntityNotFound(_0x33204b,null))[_0xa3d7('0x15')](function(_0x4d1fdd){if(_0x4d1fdd){var _0x21a4ed=_0x4d1fdd[_0xa3d7('0xb7')]({'plain':!![]});fs[_0xa3d7('0xb8')](_0x5a2e6b);var _0x50470e={'channel':_0xa3d7('0xb9'),'account':_0x21a4ed[_0xa3d7('0xba')]['name'],'agent':_0x21a4ed[_0xa3d7('0xbb')]?_0x21a4ed[_0xa3d7('0xbb')][_0xa3d7('0x4d')]:_0xa3d7('0xbc'),'createdAt':moment(_0x21a4ed['createdAt'])[_0xa3d7('0x74')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x21a4ed[_0xa3d7('0xbd')]?moment(_0x21a4ed['closedAt'])[_0xa3d7('0x74')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x21a4ed[_0xa3d7('0x65')],'chatInfo':{'browser':_0x21a4ed[_0xa3d7('0xbe')],'os':_0x21a4ed[_0xa3d7('0xbf')],'referer':_0x21a4ed[_0xa3d7('0xc0')],'customerIp':_0x21a4ed[_0xa3d7('0xc1')],'customerPort':_0x21a4ed[_0xa3d7('0xc2')]?_0x21a4ed[_0xa3d7('0xc2')]:'N.A.'},'messages':_(_0x21a4ed[_0xa3d7('0x77')])[_0xa3d7('0xc3')]()['filter']({'secret':![]})[_0xa3d7('0x31')](function(_0x47e6aa){if(_0x47e6aa['Attachment']){var _0x2b120a=path[_0xa3d7('0x71')](_0x2e470f,_0x47e6aa[_0xa3d7('0x6c')][_0xa3d7('0x69')]);if(fs[_0xa3d7('0xc4')](_0x2b120a)){fs[_0xa3d7('0xc5')](_0x2b120a)[_0xa3d7('0xc6')](fs[_0xa3d7('0xc7')](path[_0xa3d7('0x71')](_0x5a2e6b,_0x47e6aa[_0xa3d7('0x6c')][_0xa3d7('0x69')])));}}return{'date':moment(_0x47e6aa[_0xa3d7('0x84')])[_0xa3d7('0x74')](_0xa3d7('0x9d'))[_0xa3d7('0xc8')](),'sender':_0x47e6aa[_0xa3d7('0x86')]===_0xa3d7('0x5a')?_0x47e6aa['User']?_0x47e6aa['User']['fullname']:'System':_0x47e6aa[_0xa3d7('0x61')][_0xa3d7('0xb4')]+(_0x47e6aa[_0xa3d7('0x61')][_0xa3d7('0xb5')]?'\x20'+_0x47e6aa[_0xa3d7('0x61')][_0xa3d7('0xb5')]:''),'body':_0x47e6aa[_0xa3d7('0x6c')]?_0x47e6aa[_0xa3d7('0x6c')][_0xa3d7('0x69')]:_0x47e6aa['body'],'direction':_0x47e6aa[_0xa3d7('0x86')]==='out'?'A':'C','secret':_0x47e6aa[_0xa3d7('0x87')],'read':_0x47e6aa[_0xa3d7('0xb6')],'attachment':_0x47e6aa['Attachment']};})[_0xa3d7('0xc9')]()};return ejs[_0xa3d7('0xca')](path[_0xa3d7('0x71')](config['root'],_0xa3d7('0xaf'),_0xa3d7('0xcb'),_0xa3d7('0xcc')),{'interaction':_0x50470e})['then'](function(_0x2081d5){var _0x125084=path['join'](_0x5a2e6b,'transcript-'+_0x21a4ed['id']+'-'+_0x3d7600+_0xa3d7('0xcd'));var _0x2c8215={'path':_0x125084,'channel':'Chat','interactionId':_0x21a4ed['id']};return pdf['createPdfFromHTML'](_0x2081d5,_0x2c8215);})[_0xa3d7('0x15')](function(){return new Promise(function(_0x3032ea,_0x4fbeaf){zipdir(_0x5a2e6b,{'saveTo':_0x36c1e1},function(_0x200942,_0x468d46){if(_0x200942)return _0x4fbeaf(_0x200942);return _0x3032ea(_0x468d46);});})[_0xa3d7('0x15')](function(){return new BPromise(function(_0xc5dbb1,_0x39b6cd){rimraf(_0x5a2e6b,function(_0x139fbf){if(_0x139fbf)_0x39b6cd(_0x139fbf);return _0xc5dbb1();});});})[_0xa3d7('0x15')](function(){return _0x33204b[_0xa3d7('0xad')](_0x36c1e1,_0x5d05c4,function(_0x51404b){if(_0x51404b){logger[_0xa3d7('0x1a')]('err',_0x51404b);}else{fs[_0xa3d7('0xce')](_0x36c1e1);}});});});}else{return _0x33204b[_0xa3d7('0x1f')](0xc8);}})[_0xa3d7('0x1e')](handleError(_0x33204b,null));}; \ No newline at end of file +var _0x79d1=['keys','query','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','name','fullname','email','POST','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','mimetype','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsiteId','CmContact','format','%s%d','customer','Visitor','ContactId','agentIdentifier','website_alias','agentAlias','System','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','order','sort','where','pick','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','getMyMessages','includeAgent','addTags','setTags','omit','spread','Tag','color','emit','chatInteractionTags:save','removeTags','toString','files','tmp','server','attachments','transcript-%d-%s.zip','push','Contact','lastName','secret','read','Account','get','mkdirSync','N.A.','closedAt','osName','referer','customerIp','customerPort','tail','createReadStream','firstName','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','defaults','localhost','redis','./chatInteraction.socket','register','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','stack','send','render','contact','interaction','account','index','map','ChatInteraction','rawAttributes','type','getOptions','findAll','chat','user','show','params','model'];(function(_0x4f347f,_0x5ceafd){var _0x2d9bc2=function(_0x4fe4f9){while(--_0x4fe4f9){_0x4f347f['push'](_0x4f347f['shift']());}};_0x2d9bc2(++_0x5ceafd);}(_0x79d1,0x95));var _0x179d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x79d1[_0x40a045];return _0x1a687c;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x179d('0x0'));var rp=require(_0x179d('0x1'));var moment=require(_0x179d('0x2'));var BPromise=require(_0x179d('0x3'));var Mustache=require(_0x179d('0x4'));var util=require(_0x179d('0x5'));var path=require(_0x179d('0x6'));var ejs=require(_0x179d('0x7'));var fs=require('fs');var _=require(_0x179d('0x8'));var Redis=require(_0x179d('0x9'));var interaction=require(_0x179d('0xa'));var qs=require(_0x179d('0xb'));var pdf=require(_0x179d('0xc'));var logger=require(_0x179d('0xd'))(_0x179d('0xe'));var config=require('../../config/environment');var db=require(_0x179d('0xf'))['db'];config['redis']=_[_0x179d('0x10')](config['redis'],{'host':_0x179d('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x179d('0x12')]));require(_0x179d('0x13'))[_0x179d('0x14')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x179d('0x15')]({'port':0x232b});var client9004=jayson[_0x179d('0x16')][_0x179d('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x4ab090,_0x3ed0cd,_0x4929fe,_0x148456){return new BPromise(function(_0x5db82d,_0x4e1818){var _0x41932d=_0x148456||client;return _0x41932d[_0x179d('0x17')](_0x4ab090,_0x4929fe)[_0x179d('0x18')](function(_0x4c5f40){logger[_0x179d('0x19')](_0x179d('0x1a'),_0x3ed0cd,_0x179d('0x1b'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3ed0cd,_0x179d('0x1b'),JSON[_0x179d('0x1c')](_0x4c5f40));if(_0x4c5f40[_0x179d('0x1d')]){if(_0x4c5f40[_0x179d('0x1d')]['code']===0x1f4){logger[_0x179d('0x1d')](_0x179d('0x1a'),_0x3ed0cd,_0x4c5f40['error'][_0x179d('0x1e')]);return _0x4e1818(_0x4c5f40[_0x179d('0x1d')][_0x179d('0x1e')]);}logger[_0x179d('0x1d')](_0x179d('0x1a'),_0x3ed0cd,_0x4c5f40[_0x179d('0x1d')][_0x179d('0x1e')]);return _0x5db82d(_0x4c5f40[_0x179d('0x1d')][_0x179d('0x1e')]);}else{logger[_0x179d('0x19')](_0x179d('0x1a'),_0x3ed0cd,_0x179d('0x1b'));_0x5db82d(_0x4c5f40[_0x179d('0x1f')][_0x179d('0x1e')]);}})[_0x179d('0x20')](function(_0x2d1d9f){logger[_0x179d('0x1d')](_0x179d('0x1a'),_0x3ed0cd,_0x2d1d9f);_0x4e1818(_0x2d1d9f);});});}function respondWithStatusCode(_0x4c6a44,_0x54bf5f){_0x54bf5f=_0x54bf5f||0xcc;return function(_0x1eda31){if(_0x1eda31){return _0x4c6a44[_0x179d('0x21')](_0x54bf5f);}return _0x4c6a44[_0x179d('0x22')](_0x54bf5f)[_0x179d('0x23')]();};}function respondWithResult(_0x52d0de,_0x40254d){_0x40254d=_0x40254d||0xc8;return function(_0x1d64c6){if(_0x1d64c6){return _0x52d0de['status'](_0x40254d)['json'](_0x1d64c6);}};}function respondWithFilteredResult(_0x370876,_0x1bdf80){return function(_0x32d388){if(_0x32d388){var _0x17e482=typeof _0x1bdf80[_0x179d('0x24')]===_0x179d('0x25')&&typeof _0x1bdf80[_0x179d('0x26')]==='undefined';var _0x2fbbc3=_0x32d388[_0x179d('0x27')];var _0x233941=_0x17e482?0x0:_0x1bdf80[_0x179d('0x24')];var _0x548152=_0x17e482?_0x32d388[_0x179d('0x27')]:_0x1bdf80['offset']+_0x1bdf80['limit'];var _0x23b406;if(_0x548152>=_0x2fbbc3){_0x548152=_0x2fbbc3;_0x23b406=0xc8;}else{_0x23b406=0xce;}_0x370876[_0x179d('0x22')](_0x23b406);return _0x370876[_0x179d('0x28')](_0x179d('0x29'),_0x233941+'-'+_0x548152+'/'+_0x2fbbc3)[_0x179d('0x2a')](_0x32d388);}return null;};}function saveUpdates(_0x253bbb){return function(_0x38dc98){if(_0x38dc98){return _0x38dc98[_0x179d('0x2b')](_0x253bbb)['then'](function(_0x47bafb){return _0x47bafb;});}return null;};}function removeEntity(_0x57c066){return function(_0x16f3dd){if(_0x16f3dd){return _0x16f3dd[_0x179d('0x2c')]()['then'](function(){_0x57c066[_0x179d('0x22')](0xcc)[_0x179d('0x23')]();});}};}function handleEntityNotFound(_0x436f34){return function(_0x442b0a){if(!_0x442b0a){_0x436f34[_0x179d('0x21')](0x194);}return _0x442b0a;};}function handleError(_0x48962f,_0x5d1300){_0x5d1300=_0x5d1300||0x1f4;return function(_0x3ac824){logger[_0x179d('0x1d')](_0x3ac824[_0x179d('0x2d')]);if(_0x3ac824['name']){delete _0x3ac824['name'];}_0x48962f[_0x179d('0x22')](_0x5d1300)[_0x179d('0x2e')](_0x3ac824);};}function getMustacheRender(_0x1f6215,_0x126350){return Mustache[_0x179d('0x2f')](_0x1f6215,_['merge'](_0x126350['body'],{'contact':_0x126350[_0x179d('0x30')],'message':_0x126350[_0x179d('0x1e')],'agent':_0x126350['agent'],'interaction':_0x126350[_0x179d('0x31')],'account':_0x126350[_0x179d('0x32')]}))||'';}exports[_0x179d('0x33')]=function(_0x55560f,_0x334293){var _0x4de57e={};var _0x17cd1b=_[_0x179d('0x34')](db[_0x179d('0x35')][_0x179d('0x36')],function(_0x2ab330){return{'name':_0x2ab330['fieldName'],'type':_0x2ab330[_0x179d('0x37')]['key']};});_0x4de57e=qs[_0x179d('0x38')](_0x17cd1b,_0x55560f);return interaction[_0x179d('0x39')](_0x179d('0x3a'),_0x55560f['query'],_0x55560f[_0x179d('0x3b')],_0x4de57e,_0x17cd1b)[_0x179d('0x18')](respondWithFilteredResult(_0x334293,_0x4de57e))['catch'](handleError(_0x334293,null));};exports[_0x179d('0x3c')]=function(_0x48f87d,_0x392dfd){var _0x7f155a={'raw':![],'where':{'id':_0x48f87d[_0x179d('0x3d')]['id']}},_0x3161f9={};_0x3161f9[_0x179d('0x3e')]=_[_0x179d('0x3f')](db['ChatInteraction'][_0x179d('0x36')]);_0x3161f9[_0x179d('0x40')]=_[_0x179d('0x3f')](_0x48f87d[_0x179d('0x40')]);_0x3161f9[_0x179d('0x41')]=_[_0x179d('0x42')](_0x3161f9['model'],_0x3161f9['query']);_0x7f155a[_0x179d('0x43')]=_['intersection'](_0x3161f9[_0x179d('0x3e')],qs[_0x179d('0x44')](_0x48f87d[_0x179d('0x40')][_0x179d('0x44')]));_0x7f155a[_0x179d('0x43')]=_0x7f155a[_0x179d('0x43')][_0x179d('0x45')]?_0x7f155a[_0x179d('0x43')]:_0x3161f9['model'];if(_0x48f87d[_0x179d('0x40')][_0x179d('0x46')]){_0x7f155a['include']=[{'all':!![]}];}_0x7f155a=_[_0x179d('0x47')]({},_0x7f155a,_0x48f87d['options']);return db[_0x179d('0x35')][_0x179d('0x48')](_0x7f155a)['then'](handleEntityNotFound(_0x392dfd,null))[_0x179d('0x18')](respondWithResult(_0x392dfd,null))[_0x179d('0x20')](handleError(_0x392dfd,null));};exports['create']=function(_0x2c299e,_0x1d1877){return db['ChatInteraction'][_0x179d('0x49')](_0x2c299e['body'],{})['then'](respondWithResult(_0x1d1877,0xc9))['catch'](handleError(_0x1d1877,null));};exports['update']=function(_0x7d4784,_0x1e93bf){if(_0x7d4784['body']['id']){delete _0x7d4784[_0x179d('0x4a')]['id'];}return db['ChatInteraction'][_0x179d('0x48')]({'where':{'id':_0x7d4784[_0x179d('0x3d')]['id']}})[_0x179d('0x18')](handleEntityNotFound(_0x1e93bf,null))[_0x179d('0x18')](saveUpdates(_0x7d4784[_0x179d('0x4a')],null))[_0x179d('0x18')](respondWithResult(_0x1e93bf,null))[_0x179d('0x20')](handleError(_0x1e93bf,null));};exports[_0x179d('0x2c')]=function(_0x3d8ddf,_0x2477c2){return db[_0x179d('0x35')][_0x179d('0x48')]({'where':{'id':_0x3d8ddf['params']['id']}})[_0x179d('0x18')](handleEntityNotFound(_0x2477c2,null))[_0x179d('0x18')](removeEntity(_0x2477c2,null))[_0x179d('0x20')](handleError(_0x2477c2,null));};exports[_0x179d('0x4b')]=function(_0x1a38b7,_0x4dfb0c){return db[_0x179d('0x35')]['describe']()[_0x179d('0x18')](respondWithResult(_0x4dfb0c,null))[_0x179d('0x20')](handleError(_0x4dfb0c,null));};exports[_0x179d('0x4c')]=function(_0x53e17e,_0x501632){var _0x498a04=_0x53e17e[_0x179d('0x3d')]['id'];var _0x5478b2;var _0x208c87;var _0x4d9763;return db[_0x179d('0x35')][_0x179d('0x4d')]({'where':{'id':_0x498a04}})[_0x179d('0x18')](function(_0xdeec2){_0x5478b2=_0xdeec2;return db[_0x179d('0x4e')]['findOne']({'where':{'id':_0xdeec2['ChatWebsiteId']},'attributes':['id',_0x179d('0x4f'),_0x179d('0x50'),_0x179d('0x51'),_0x179d('0x52'),_0x179d('0x53')],'raw':!![]});})[_0x179d('0x18')](function(_0xdf0bb9){if(_0xdf0bb9&&_0xdf0bb9[_0x179d('0x4f')]&&_0xdf0bb9['vidaooEscalation']){_0x208c87=_0xdf0bb9;var _0xb39726={'interaction':{'id':_0x498a04},'agent':{'id':_0x53e17e['user']['id'],'name':_0x53e17e[_0x179d('0x3b')][_0x179d('0x54')],'fullname':_0x53e17e[_0x179d('0x3b')][_0x179d('0x55')],'email':_0x53e17e['user'][_0x179d('0x56')]},'contact':_0x53e17e[_0x179d('0x4a')][_0x179d('0x30')],'account':_0x53e17e[_0x179d('0x4a')][_0x179d('0x32')]};var _0x279873={'rejectUnauthorized':![],'method':_0x179d('0x57'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0xdf0bb9[_0x179d('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x53e17e[_0x179d('0x3b')]['email']],'buttons':null,'topic':_0x208c87[_0x179d('0x51')],'note':_[_0x179d('0x58')](_0x208c87[_0x179d('0x52')])?null:getMustacheRender(_0x208c87['vidaooNote'],_0xb39726),'metadata':null},'redirect':_0x179d('0x59'),'json':!![]};try{if(!_[_0x179d('0x58')](_0x208c87[_0x179d('0x53')])){var _0x5d4700=getMustacheRender(_0x208c87[_0x179d('0x53')],_0xb39726);var _0x58988d=JSON[_0x179d('0x5a')](_0x5d4700);_0x279873['body'][_0x179d('0x5b')]=_0x58988d;}}catch(_0x53d4c4){throw new db[(_0x179d('0x5c'))][(_0x179d('0x5d'))](_0x179d('0x5e'));}return rp(_0x279873);}else{throw new db[(_0x179d('0x5c'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x179d('0x18')](function(_0x4ec484){_0x4d9763=_0x4ec484;if(_0x4d9763['id']){var _0xe4c9b4={'body':_0x4d9763[_0x179d('0x5f')],'ChatWebsiteId':_0x208c87['id'],'ChatInteractionId':_0x5478b2['id'],'direction':_0x179d('0x60'),'UserId':_0x53e17e[_0x179d('0x3b')]['id']};return db[_0x179d('0x61')][_0x179d('0x49')](_0xe4c9b4,{});}else{throw new db[(_0x179d('0x5c'))][(_0x179d('0x5d'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x5478b2[_0x179d('0x62')]({'vidaooSessionId':_0x4d9763['id']});})[_0x179d('0x18')](respondWithResult(_0x501632,null))[_0x179d('0x20')](handleError(_0x501632,null));};exports[_0x179d('0x63')]=function(_0x7eb1b3,_0xb3e2e9){if(_0x7eb1b3[_0x179d('0x4a')]['id']){delete _0x7eb1b3['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x7eb1b3[_0x179d('0x3d')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x179d('0x18')](handleEntityNotFound(_0xb3e2e9,null))[_0x179d('0x18')](saveUpdates(_0x7eb1b3[_0x179d('0x4a')],null))[_0x179d('0x18')](respondWithResult(_0xb3e2e9,null))['catch'](handleError(_0xb3e2e9,null));};exports[_0x179d('0x64')]=function(_0x2d4e3c,_0x3dad4f){if(_0x2d4e3c[_0x179d('0x4a')]['id']){delete _0x2d4e3c[_0x179d('0x4a')]['id'];}return db[_0x179d('0x35')][_0x179d('0x48')]({'where':{'id':_0x2d4e3c['params']['id']}})[_0x179d('0x18')](function(_0x45af23){if(!_0x45af23){logger[_0x179d('0x1d')](_0x179d('0x65'),_0x179d('0x64'),0x194,_0x179d('0x66'));_0x3dad4f[_0x179d('0x21')](0x194);}else{if(_0x45af23[_0x179d('0x67')]){throw new db[(_0x179d('0x5c'))][(_0x179d('0x5d'))](_0x179d('0x68'));}}return _0x45af23;})[_0x179d('0x18')](function(_0x145fd0){if(_0x145fd0){return _0x145fd0[_0x179d('0x2b')]({'closed':_0x2d4e3c['body'][_0x179d('0x69')],'disposition':_0x2d4e3c[_0x179d('0x4a')][_0x179d('0x6a')]})[_0x179d('0x18')](function(_0xcb0f84){return _0xcb0f84;});}})[_0x179d('0x18')](function(){return respondWithRpcPromise(_0x179d('0x6b'),_0x179d('0x64'),_0x2d4e3c[_0x179d('0x4a')],client9004);})['then'](respondWithResult(_0x3dad4f,null))['catch'](handleError(_0x3dad4f,null));};exports[_0x179d('0x6c')]=function(_0x2cfe0a,_0x3bde1a){_0x2cfe0a['body'][_0x179d('0x54')]=_0x2cfe0a[_0x179d('0x6d')][_0x179d('0x6e')];_0x2cfe0a[_0x179d('0x4a')][_0x179d('0x6f')]=_0x2cfe0a['file']['filename'];_0x2cfe0a[_0x179d('0x4a')][_0x179d('0x37')]=_0x2cfe0a[_0x179d('0x6d')][_0x179d('0x70')];return db[_0x179d('0x71')][_0x179d('0x49')](_0x2cfe0a[_0x179d('0x4a')])[_0x179d('0x18')](respondWithResult(_0x3bde1a,0xc9))[_0x179d('0x20')](handleError(_0x3bde1a,null));};exports[_0x179d('0x72')]=function(_0x55090b,_0x32a08d){return db['ChatInteraction'][_0x179d('0x4d')]({'where':{'id':_0x55090b[_0x179d('0x3d')]['id']},'raw':!![]})[_0x179d('0x18')](handleEntityNotFound(_0x32a08d,null))[_0x179d('0x18')](function(_0x3e2c76){if(_0x3e2c76){if(_0x3e2c76[_0x179d('0x69')]){return _0x32a08d['status'](0x193)[_0x179d('0x2a')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x179d('0x4d')]({'where':{'id':_0x55090b[_0x179d('0x40')][_0x179d('0x73')]},'raw':!![]})['then'](handleEntityNotFound(_0x32a08d,null));}})['then'](function(_0x2b7feb){if(_0x2b7feb){var _0x5b75b3=_0x2b7feb[_0x179d('0x74')]!==null;var _0x31a5bd=path[_0x179d('0x75')](config[_0x179d('0x76')],_0x179d('0x77'));if(_0x5b75b3){_0x31a5bd=path[_0x179d('0x75')](_0x31a5bd,_0x179d('0x78'));}var _0x50a3aa=path[_0x179d('0x75')](_0x31a5bd,_0x2b7feb[_0x179d('0x6f')]);return _0x32a08d[_0x179d('0x79')](_0x50a3aa);}})[_0x179d('0x20')](handleError(_0x32a08d,null));};exports[_0x179d('0x7a')]=function(_0x1284d7,_0x16be90){var _0x3cb1ce=null;var _0x512949=null;var _0x1cd08b=null;if(_0x1284d7[_0x179d('0x4a')]['id']){delete _0x1284d7[_0x179d('0x4a')]['id'];}if(_0x1284d7[_0x179d('0x4a')][_0x179d('0x7b')]){_0x1cd08b=path['join'](config[_0x179d('0x76')],_0x179d('0x7c'),util['format'](_0x179d('0x7d'),Date[_0x179d('0x7e')]()));_0x1284d7[_0x179d('0x4a')][_0x179d('0x7f')]=_0x1cd08b;}return db['ChatInteraction'][_0x179d('0x48')]({'where':{'id':_0x1284d7['params']['id']},'include':[{'model':db[_0x179d('0x61')],'as':_0x179d('0x80'),'include':[{'model':db['User'],'as':_0x179d('0x81')}]}]})[_0x179d('0x18')](handleEntityNotFound(_0x16be90,null))[_0x179d('0x18')](saveUpdates(_0x1284d7[_0x179d('0x4a')],null))[_0x179d('0x18')](function(_0x41311f){if(_0x41311f){_0x3cb1ce=_0x41311f;return db[_0x179d('0x4e')][_0x179d('0x48')]({'where':{'id':_0x3cb1ce[_0x179d('0x82')]}});}})[_0x179d('0x18')](function(_0xfc09d){if(_0xfc09d){_0x512949=_0xfc09d;return db[_0x179d('0x83')][_0x179d('0x48')]({'where':{'id':_0x3cb1ce['ContactId']}});}})[_0x179d('0x18')](function(_0xadd2b6){if(_0xadd2b6){if(_0x1cd08b){var _0x5acc89=null;for(var _0x464062=0x1;_0x464062<_0x3cb1ce[_0x179d('0x80')]['length'];++_0x464062){_0x5acc89=_0x3cb1ce[_0x179d('0x80')][_0x464062];var _0x128a9f=_0x5acc89['UserId']?util[_0x179d('0x84')](_0x179d('0x85'),_0x512949['agentAlias'],_0x5acc89[_0x179d('0x67')]):'System';var _0x30787d=_0x1284d7[_0x179d('0x4a')][_0x179d('0x86')]||util['format']('%s%d',_0x179d('0x87'),_0x5acc89[_0x179d('0x88')]);switch(_0x512949[_0x179d('0x89')]){case _0x179d('0x8a'):_0x128a9f=_0x5acc89['UserId']?util[_0x179d('0x84')](_0x179d('0x85'),_0x512949[_0x179d('0x8b')],_0x5acc89['UserId']):_0x179d('0x8c');break;case _0x179d('0x8d'):_0x128a9f=_0x5acc89['UserId']?_0x5acc89[_0x179d('0x81')][_0x179d('0x8e')]||_0x5acc89[_0x179d('0x81')][_0x179d('0x55')]:_0x179d('0x8c');break;case'agent_fullname':_0x128a9f=_0x5acc89['UserId']?_0x5acc89['User']['fullname']:_0x179d('0x8c');break;default:_0x128a9f=_0x5acc89['UserId']?util[_0x179d('0x84')](_0x179d('0x85'),_0x512949[_0x179d('0x8b')],_0x5acc89['UserId']):_0x179d('0x8c');}var _0x1a6a0c=util[_0x179d('0x84')](_0x179d('0x8f'),moment(_0x5acc89[_0x179d('0x90')])[_0x179d('0x84')](_0x179d('0x91')),_0x5acc89[_0x179d('0x92')]==='in'?_0x30787d:_0x128a9f,_0x5acc89['body']);if(!_0x5acc89['secret']){fs[_0x179d('0x93')](_0x1cd08b,_0x1a6a0c);}}return db['MailAccount'][_0x179d('0x4d')]({'where':{'service':!![]},'include':[{'model':db[_0x179d('0x94')],'as':_0x179d('0x95'),'raw':!![],'include':[{'model':db[_0x179d('0x96')],'as':_0x179d('0x96'),'raw':!![]}]}]});}}})[_0x179d('0x18')](function(_0xded189){if(!_0xded189||!_0xded189[_0x179d('0x95')]||!_0x1284d7[_0x179d('0x4a')])return _0x3cb1ce;var _0x154b9d=_0xded189['getSmtpOptions']();return respondWithRpcPromise(_0x179d('0x97'),_0x179d('0x98'),{'account':_0x154b9d,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0xded189['name'],_0xded189['email']||_0xded189[_0x179d('0x95')][_0x179d('0x3b')]),'to':_0x1284d7['body']['mailTranscript'],'subject':_0x179d('0x99'),'text':util['format'](_0x179d('0x9a'),_0x1284d7[_0x179d('0x4a')][_0x179d('0x7b')]),'attachments':[{'path':_0x1cd08b}]}})[_0x179d('0x18')](function(){return _0x3cb1ce;})[_0x179d('0x20')](function(_0x64cf54){logger[_0x179d('0x1d')](_0x64cf54);});})[_0x179d('0x18')](respondWithStatusCode(_0x16be90,0xc8))[_0x179d('0x20')](handleError(_0x16be90,null));};exports[_0x179d('0x9b')]=function(_0x2656fa,_0x21dcc4){return db[_0x179d('0x61')][_0x179d('0x48')]({'where':{'id':_0x2656fa[_0x179d('0x3d')]['id']}})[_0x179d('0x18')](handleEntityNotFound(_0x21dcc4,null))[_0x179d('0x18')](function(_0x312bac){if(_0x312bac){return _0x312bac[_0x179d('0x9b')](_0x2656fa['body'][_0x179d('0x9c')],_['omit'](_0x2656fa[_0x179d('0x4a')],[_0x179d('0x9c'),'id'])||{});}})[_0x179d('0x18')](respondWithResult(_0x21dcc4,null))[_0x179d('0x20')](handleError(_0x21dcc4,null));};exports[_0x179d('0x9d')]=function(_0x2376e3,_0x38d39c){var _0x24c53c={'raw':![],'where':{}};var _0x4c4de3={};var _0x2c61ac={'count':0x0,'rows':[]};return db[_0x179d('0x35')][_0x179d('0x4d')]({'where':{'id':_0x2376e3[_0x179d('0x3d')]['id']}})[_0x179d('0x18')](handleEntityNotFound(_0x38d39c,null))['then'](function(_0x199af7){if(_0x199af7){_0x4c4de3['model']=_[_0x179d('0x3f')](db[_0x179d('0x61')]['rawAttributes']);_0x4c4de3[_0x179d('0x40')]=_['keys'](_0x2376e3[_0x179d('0x40')]);_0x4c4de3['filters']=_[_0x179d('0x42')](_0x4c4de3[_0x179d('0x3e')],_0x4c4de3[_0x179d('0x40')]);_0x24c53c[_0x179d('0x43')]=_[_0x179d('0x42')](_0x4c4de3['model'],qs[_0x179d('0x44')](_0x2376e3['query'][_0x179d('0x44')]));_0x24c53c[_0x179d('0x43')]=_0x24c53c[_0x179d('0x43')][_0x179d('0x45')]?_0x24c53c[_0x179d('0x43')]:_0x4c4de3[_0x179d('0x3e')];if(!_0x2376e3[_0x179d('0x40')][_0x179d('0x9e')]('nolimit')){_0x24c53c[_0x179d('0x26')]=qs[_0x179d('0x26')](_0x2376e3['query'][_0x179d('0x26')]);_0x24c53c[_0x179d('0x24')]=qs[_0x179d('0x24')](_0x2376e3[_0x179d('0x40')][_0x179d('0x24')]);}_0x24c53c[_0x179d('0x9f')]=qs['sort'](_0x2376e3[_0x179d('0x40')][_0x179d('0xa0')]);_0x24c53c[_0x179d('0xa1')]=qs[_0x179d('0x41')](_[_0x179d('0xa2')](_0x2376e3[_0x179d('0x40')],_0x4c4de3[_0x179d('0x41')]));_0x24c53c['where'][_0x179d('0xa3')]=_0x199af7['id'];if(_0x2376e3['query']['filter']){_0x24c53c[_0x179d('0xa1')]=_['merge'](_0x24c53c[_0x179d('0xa1')],{'$or':_['map'](_0x24c53c[_0x179d('0x43')],function(_0x48ffab){var _0x54fa28={};_0x54fa28[_0x48ffab]={'$like':'%'+_0x2376e3[_0x179d('0x40')][_0x179d('0xa4')]+'%'};return _0x54fa28;})});}if(_0x2376e3[_0x179d('0x40')][_0x179d('0xa5')]){var _0x1e227a=_0x2376e3[_0x179d('0x40')]['$gte']['split'](',');var _0x2d57dc={};_0x2d57dc[_0x1e227a[0x0]]={'$gte':moment(_0x1e227a[0x1])['format'](_0x179d('0xa6'))};_0x24c53c['where']=_[_0x179d('0x47')](_0x24c53c[_0x179d('0xa1')],_0x2d57dc);}_0x24c53c=_['merge']({},_0x24c53c,_0x2376e3[_0x179d('0xa7')]);return db[_0x179d('0x61')][_0x179d('0x27')]({'where':_0x24c53c[_0x179d('0xa1')]})[_0x179d('0x18')](function(_0x56d9ad){_0x2c61ac[_0x179d('0x27')]=_0x56d9ad;if(_0x2376e3[_0x179d('0x40')][_0x179d('0x46')]){_0x24c53c[_0x179d('0xa8')]=[{'all':!![]}];}return db['ChatMessage'][_0x179d('0x39')](_0x24c53c);})[_0x179d('0x18')](function(_0x44f1ca){_0x2c61ac[_0x179d('0xa9')]=_0x44f1ca;return _0x2c61ac;});}})['then'](respondWithFilteredResult(_0x38d39c,_0x24c53c))['catch'](handleError(_0x38d39c,null));};exports[_0x179d('0xaa')]=function(_0xcc7547,_0x4d6d48){var _0x5a40b6={'where':{}},_0x5c08e2={},_0x50398f={'count':0x0,'rows':[]};return db[_0x179d('0x35')][_0x179d('0x4d')]({'where':{'id':_0xcc7547[_0x179d('0x3d')]['id']}})[_0x179d('0x18')](handleEntityNotFound(_0x4d6d48,null))[_0x179d('0x18')](function(_0x4a0765){if(_0x4a0765){_0x5c08e2['model']=_[_0x179d('0x3f')](db[_0x179d('0x61')]['rawAttributes']);_0x5c08e2[_0x179d('0x40')]=_[_0x179d('0x3f')](_0xcc7547[_0x179d('0x40')]);_0x5c08e2[_0x179d('0x41')]=_['intersection'](_0x5c08e2[_0x179d('0x3e')],_0x5c08e2[_0x179d('0x40')]);_0x5a40b6[_0x179d('0x43')]=_[_0x179d('0x42')](_0x5c08e2[_0x179d('0x3e')],qs[_0x179d('0x44')](_0xcc7547[_0x179d('0x40')][_0x179d('0x44')]));_0x5a40b6[_0x179d('0x43')]=_0x5a40b6[_0x179d('0x43')][_0x179d('0x45')]?_0x5a40b6['attributes']:_0x5c08e2[_0x179d('0x3e')];if(!_0xcc7547[_0x179d('0x40')]['hasOwnProperty']('nolimit')){_0x5a40b6['limit']=qs['limit'](_0xcc7547[_0x179d('0x40')][_0x179d('0x26')]);_0x5a40b6[_0x179d('0x24')]=qs[_0x179d('0x24')](_0xcc7547[_0x179d('0x40')][_0x179d('0x24')]);}_0x5a40b6[_0x179d('0x9f')]=qs['sort'](_0xcc7547[_0x179d('0x40')]['sort']);_0x5a40b6['where']=qs['filters'](_['pick'](_0xcc7547['query'],_0x5c08e2[_0x179d('0x41')]));_0x5a40b6['where']['ChatInteractionId']=_0x4a0765['id'];if(_0xcc7547[_0x179d('0x40')]['filter']){_0x5a40b6[_0x179d('0xa1')]=_[_0x179d('0x47')](_0x5a40b6[_0x179d('0xa1')],{'$or':_['map'](_0x5a40b6['attributes'],function(_0x1db3ef){var _0x49163b={};_0x49163b[_0x1db3ef]={'$like':'%'+_0xcc7547[_0x179d('0x40')]['filter']+'%'};return _0x49163b;})});}_0x5a40b6['where']['secret']=![];if(_0xcc7547['query']['id']){_0x5a40b6[_0x179d('0xa1')]['id']={'$gt':_0xcc7547[_0x179d('0x40')]['id']};}_0x5a40b6=_[_0x179d('0x47')]({},_0x5a40b6,_0xcc7547[_0x179d('0xa7')]);return db[_0x179d('0x61')][_0x179d('0x27')]({'where':_0x5a40b6[_0x179d('0xa1')]})[_0x179d('0x18')](function(_0x283d02){_0x50398f[_0x179d('0x27')]=_0x283d02;_0x5a40b6[_0x179d('0xa8')]=[];if(_0xcc7547[_0x179d('0x40')][_0x179d('0xab')]){_0x5a40b6[_0x179d('0xa8')]['push']({'model':db[_0x179d('0x81')],'as':_0x179d('0x81'),'attributes':['id',_0x179d('0x55'),'alias']});}if(_0xcc7547[_0x179d('0x40')][_0x179d('0x46')]){_0x5a40b6[_0x179d('0xa8')]=[{'all':!![]}];}return db['ChatMessage'][_0x179d('0x39')](_0x5a40b6);})['then'](function(_0x1772f7){_0x50398f[_0x179d('0xa9')]=_0x1772f7;return _0x50398f;});}})['then'](respondWithFilteredResult(_0x4d6d48,_0x5a40b6))['catch'](handleError(_0x4d6d48,null));};exports[_0x179d('0xac')]=function(_0x54613f,_0x4bc042){return db[_0x179d('0x35')][_0x179d('0x48')]({'where':{'id':_0x54613f[_0x179d('0x3d')]['id']}})[_0x179d('0x18')](handleEntityNotFound(_0x4bc042,null))['then'](function(_0x275367){if(_0x275367){return _0x275367[_0x179d('0xad')](_0x54613f['body'][_0x179d('0x9c')],_[_0x179d('0xae')](_0x54613f[_0x179d('0x4a')],[_0x179d('0x9c'),'id'])||{})[_0x179d('0xaf')](function(){return db[_0x179d('0xb0')][_0x179d('0x39')]({'attributes':['id',_0x179d('0x54'),_0x179d('0xb1')],'where':{'id':_0x54613f[_0x179d('0x4a')]['ids']}});})[_0x179d('0x18')](function(_0x2bbe91){socket[_0x179d('0xb2')](_0x179d('0xb3'),{'id':Number(_0x54613f[_0x179d('0x3d')]['id']),'tags':_0x2bbe91||[]});return{'id':Number(_0x54613f[_0x179d('0x3d')]['id']),'tags':_0x2bbe91||[]};});}})['then'](respondWithResult(_0x4bc042,null))[_0x179d('0x20')](handleError(_0x4bc042,null));};exports[_0x179d('0xb4')]=function(_0x1c7d2d,_0x4535da){return db[_0x179d('0x35')][_0x179d('0x48')]({'where':{'id':_0x1c7d2d[_0x179d('0x3d')]['id']}})[_0x179d('0x18')](handleEntityNotFound(_0x4535da,null))[_0x179d('0x18')](function(_0xfa30d1){if(_0xfa30d1){return _0xfa30d1[_0x179d('0xb4')](_0x1c7d2d[_0x179d('0x40')][_0x179d('0x9c')]);}})[_0x179d('0x18')](respondWithStatusCode(_0x4535da,null))[_0x179d('0x20')](handleError(_0x4535da,null));};exports['download']=function(_0x56d444,_0x3cd251){var _0x34fa3d=moment()['unix']()[_0x179d('0xb5')]();var _0x24fcc4=path['join'](config['root'],'server',_0x179d('0xb6'),_0x179d('0xb7'));var _0x345b8f=path['join'](config[_0x179d('0x76')],_0x179d('0xb8'),_0x179d('0xb6'),_0x179d('0xb9'));var _0x24c255=path[_0x179d('0x75')](_0x24fcc4,_0x34fa3d);var _0x176858=util[_0x179d('0x84')](_0x179d('0xba'),_0x56d444['params']['id'],_0x34fa3d);var _0x5848f8=path[_0x179d('0x75')](_0x24fcc4,_0x176858);var _0x5b7291=[];_0x5b7291[_0x179d('0xbb')]({'model':db['User'],'as':_0x179d('0x81'),'attributes':['id','fullname'],'raw':!![]});_0x5b7291[_0x179d('0xbb')]({'model':db[_0x179d('0x83')],'as':_0x179d('0xbc'),'attributes':['id','firstName',_0x179d('0xbd')],'raw':!![]});if(_0x56d444[_0x179d('0x40')][_0x179d('0xb9')]){_0x5b7291[_0x179d('0xbb')]({'model':db[_0x179d('0x71')],'as':'Attachment','raw':!![]});}var _0x5e908c=[{'model':db[_0x179d('0x61')],'as':_0x179d('0x80'),'attributes':['id','body',_0x179d('0x90'),_0x179d('0x92'),_0x179d('0xbe'),_0x179d('0xbf')],'include':_0x5b7291}];_0x5e908c[_0x179d('0xbb')]({'model':db[_0x179d('0x4e')],'as':_0x179d('0xc0'),'attributes':['id',_0x179d('0x54')]});_0x5e908c[_0x179d('0xbb')]({'model':db[_0x179d('0x81')],'as':'Owner','attributes':['id',_0x179d('0x55')]});return db['ChatInteraction'][_0x179d('0x48')]({'where':{'id':_0x56d444[_0x179d('0x3d')]['id']},'include':_0x5e908c})[_0x179d('0x18')](handleEntityNotFound(_0x3cd251,null))[_0x179d('0x18')](function(_0x4d08c6){if(_0x4d08c6){var _0x5e6a26=_0x4d08c6[_0x179d('0xc1')]({'plain':!![]});fs[_0x179d('0xc2')](_0x24c255);var _0x58d60a={'channel':'Chat','account':_0x5e6a26[_0x179d('0xc0')][_0x179d('0x54')],'agent':_0x5e6a26['Owner']?_0x5e6a26['Owner'][_0x179d('0x55')]:_0x179d('0xc3'),'createdAt':moment(_0x5e6a26['createdAt'])['format'](_0x179d('0xa6'))[_0x179d('0xb5')](),'closedAt':_0x5e6a26[_0x179d('0x69')]?moment(_0x5e6a26[_0x179d('0xc4')])[_0x179d('0x84')](_0x179d('0xa6'))[_0x179d('0xb5')]():'','disposition':_0x5e6a26[_0x179d('0x6a')],'chatInfo':{'browser':_0x5e6a26['browserName'],'os':_0x5e6a26[_0x179d('0xc5')],'referer':_0x5e6a26[_0x179d('0xc6')],'customerIp':_0x5e6a26[_0x179d('0xc7')],'customerPort':_0x5e6a26[_0x179d('0xc8')]?_0x5e6a26[_0x179d('0xc8')]:'N.A.'},'messages':_(_0x5e6a26[_0x179d('0x80')])[_0x179d('0xc9')]()[_0x179d('0xa4')]({'secret':![]})[_0x179d('0x34')](function(_0x1fcc8d){if(_0x1fcc8d[_0x179d('0x71')]){var _0x3b4b63=path[_0x179d('0x75')](_0x345b8f,_0x1fcc8d['Attachment'][_0x179d('0x6f')]);if(fs['existsSync'](_0x3b4b63)){fs[_0x179d('0xca')](_0x3b4b63)['pipe'](fs['createWriteStream'](path['join'](_0x24c255,_0x1fcc8d[_0x179d('0x71')]['basename'])));}}return{'date':moment(_0x1fcc8d['createdAt'])[_0x179d('0x84')]('YYYY-MM-DD\x20HH:mm:ss')[_0x179d('0xb5')](),'sender':_0x1fcc8d[_0x179d('0x92')]===_0x179d('0x60')?_0x1fcc8d[_0x179d('0x81')]?_0x1fcc8d[_0x179d('0x81')]['fullname']:'System':_0x1fcc8d['Contact'][_0x179d('0xcb')]+(_0x1fcc8d[_0x179d('0xbc')][_0x179d('0xbd')]?'\x20'+_0x1fcc8d[_0x179d('0xbc')][_0x179d('0xbd')]:''),'body':_0x1fcc8d[_0x179d('0x71')]?_0x1fcc8d[_0x179d('0x71')]['basename']:_0x1fcc8d[_0x179d('0x4a')],'direction':_0x1fcc8d['direction']==='out'?'A':'C','secret':_0x1fcc8d['secret'],'read':_0x1fcc8d[_0x179d('0xbf')],'attachment':_0x1fcc8d[_0x179d('0x71')]};})[_0x179d('0xcc')]()};return ejs[_0x179d('0xcd')](path[_0x179d('0x75')](config['root'],'server',_0x179d('0xce'),'downloadInteraction.ejs'),{'interaction':_0x58d60a})[_0x179d('0x18')](function(_0x31ef4b){var _0x1ce2d6=path[_0x179d('0x75')](_0x24c255,_0x179d('0xcf')+_0x5e6a26['id']+'-'+_0x34fa3d+_0x179d('0xd0'));var _0x3b60c3={'path':_0x1ce2d6,'channel':'Chat','interactionId':_0x5e6a26['id']};return pdf[_0x179d('0xd1')](_0x31ef4b,_0x3b60c3);})[_0x179d('0x18')](function(){return new Promise(function(_0x27bfcf,_0x457978){zipdir(_0x24c255,{'saveTo':_0x5848f8},function(_0x35aac7,_0x2f1feb){if(_0x35aac7)return _0x457978(_0x35aac7);return _0x27bfcf(_0x2f1feb);});})['then'](function(){return new BPromise(function(_0x5a39f9,_0x135683){rimraf(_0x24c255,function(_0x14e269){if(_0x14e269)_0x135683(_0x14e269);return _0x5a39f9();});});})[_0x179d('0x18')](function(){return _0x3cd251['download'](_0x5848f8,_0x176858,function(_0x15244e){if(_0x15244e){logger[_0x179d('0x1d')](_0x179d('0xd2'),_0x15244e);}else{fs[_0x179d('0xd3')](_0x5848f8);}});});});}else{return _0x3cd251['sendStatus'](0xc8);}})[_0x179d('0x20')](handleError(_0x3cd251,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index dcfac6e..9a338b5 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 _0x33ff=['../../mysqldb','ChatMessage','setMaxListeners','save','remove','getUsers','Users','findAll','then','setDataValue','emit','hook','exports'];(function(_0x27b3e7,_0x4748fd){var _0x21b36e=function(_0x1c1ff2){while(--_0x1c1ff2){_0x27b3e7['push'](_0x27b3e7['shift']());}};_0x21b36e(++_0x4748fd);}(_0x33ff,0x9c));var _0xf33f=function(_0x5805d7,_0x3d584a){_0x5805d7=_0x5805d7-0x0;var _0x170fe4=_0x33ff[_0x5805d7];return _0x170fe4;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xf33f('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0xf33f('0x0'))['db'][_0xf33f('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xf33f('0x2')](0x0);var events={'afterCreate':_0xf33f('0x3'),'afterUpdate':'update','afterDestroy':_0xf33f('0x4')};function emitEvent(_0xe0b5a5){return function(_0x4a146a,_0x119351,_0x3345bc){_0x4a146a[_0xf33f('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x59d716){_0x4a146a['setDataValue'](_0xf33f('0x6'),_0x59d716['map'](function(_0x354da6){return{'id':_0x354da6['id']};}));return ChatMessage[_0xf33f('0x7')]({'where':{'ChatInteractionId':_0x4a146a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf33f('0x8')](function(_0x3a5715){_0x4a146a[_0xf33f('0x9')]('unreadMessages',_0x3a5715['length']);ChatInteractionEvents['emit'](_0xe0b5a5+':'+_0x4a146a['id'],_0x4a146a);ChatInteractionEvents[_0xf33f('0xa')](_0xe0b5a5,_0x4a146a);_0x3345bc(null);})['catch'](_0x3345bc(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xf33f('0xb')](e,emitEvent(event));}}module[_0xf33f('0xc')]=ChatInteractionEvents; \ No newline at end of file +var _0x7bf4=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hook','exports','../../mysqldb','ChatInteraction','setMaxListeners','save','remove'];(function(_0x25e486,_0x5b72c9){var _0x4ac677=function(_0x450fd0){while(--_0x450fd0){_0x25e486['push'](_0x25e486['shift']());}};_0x4ac677(++_0x5b72c9);}(_0x7bf4,0x15b));var _0x47bf=function(_0x34e362,_0x397343){_0x34e362=_0x34e362-0x0;var _0x4142a8=_0x7bf4[_0x34e362];return _0x4142a8;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x47bf('0x0'))['db'][_0x47bf('0x1')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x47bf('0x2')](0x0);var events={'afterCreate':_0x47bf('0x3'),'afterUpdate':'update','afterDestroy':_0x47bf('0x4')};function emitEvent(_0x381039){return function(_0x453e2c,_0x2cf806,_0x593fc2){_0x453e2c[_0x47bf('0x5')]({'attributes':['id'],'raw':!![]})[_0x47bf('0x6')](function(_0x2708fe){_0x453e2c[_0x47bf('0x7')](_0x47bf('0x8'),_0x2708fe[_0x47bf('0x9')](function(_0x2b7f21){return{'id':_0x2b7f21['id']};}));return ChatMessage[_0x47bf('0xa')]({'where':{'ChatInteractionId':_0x453e2c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x47bf('0x6')](function(_0x5bbc30){_0x453e2c[_0x47bf('0x7')](_0x47bf('0xb'),_0x5bbc30['length']);ChatInteractionEvents['emit'](_0x381039+':'+_0x453e2c['id'],_0x453e2c);ChatInteractionEvents[_0x47bf('0xc')](_0x381039,_0x453e2c);_0x593fc2(null);})[_0x47bf('0xd')](_0x593fc2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x47bf('0xe')](e,emitEvent(event));}}module[_0x47bf('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index e850eec..98b2a9f 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 _0x4faa=['rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x43ef1d,_0x3a4978){var _0x1a23b0=function(_0x55e7d2){while(--_0x55e7d2){_0x43ef1d['push'](_0x43ef1d['shift']());}};_0x1a23b0(++_0x3a4978);}(_0x4faa,0x149));var _0xa4fa=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x4faa[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0xa4fa('0x0'));var util=require(_0xa4fa('0x1'));var logger=require(_0xa4fa('0x2'))('api');var moment=require(_0xa4fa('0x3'));var BPromise=require(_0xa4fa('0x4'));var rp=require(_0xa4fa('0x5'));var fs=require('fs');var path=require(_0xa4fa('0x6'));var rimraf=require(_0xa4fa('0x7'));var config=require(_0xa4fa('0x8'));var attributes=require(_0xa4fa('0x9'));module[_0xa4fa('0xa')]=function(_0xd1008,_0x97dbd){return _0xd1008[_0xa4fa('0xb')](_0xa4fa('0xc'),attributes,{'tableName':_0xa4fa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e34f4,_0x2ff849,_0x3e9711){if(_0x4e34f4[_0xa4fa('0xe')](_0xa4fa('0xf'))){_0x4e34f4[_0xa4fa('0x10')]=moment()[_0xa4fa('0x11')](_0xa4fa('0x12'));}_0x3e9711(null,_0x4e34f4);}},'charset':_0xa4fa('0x13'),'collate':_0xa4fa('0x14')});}; \ No newline at end of file +var _0x1d91=['utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0x1d91,0x179));var _0x11d9=function(_0x55e83d,_0x29534f){_0x55e83d=_0x55e83d-0x0;var _0x394761=_0x1d91[_0x55e83d];return _0x394761;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x11d9('0x0'))('api');var moment=require(_0x11d9('0x1'));var BPromise=require(_0x11d9('0x2'));var rp=require(_0x11d9('0x3'));var fs=require('fs');var path=require(_0x11d9('0x4'));var rimraf=require(_0x11d9('0x5'));var config=require(_0x11d9('0x6'));var attributes=require(_0x11d9('0x7'));module[_0x11d9('0x8')]=function(_0x1236d3,_0x304736){return _0x1236d3[_0x11d9('0x9')](_0x11d9('0xa'),attributes,{'tableName':_0x11d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x563f0e,_0x257690,_0x397178){if(_0x563f0e[_0x11d9('0xc')]('closed')){_0x563f0e['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x397178(null,_0x563f0e);}},'charset':_0x11d9('0xd'),'collate':_0x11d9('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 018b7ef..a9a8464 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 _0xdf44=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','where','info','catch','AddTagsToChatInteraction','find','ids','omit','spread','AddTags','util','bluebird'];(function(_0x2d1600,_0x261562){var _0x3f7626=function(_0x3ee5f8){while(--_0x3ee5f8){_0x2d1600['push'](_0x2d1600['shift']());}};_0x3f7626(++_0x261562);}(_0xdf44,0x73));var _0x4df4=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xdf44[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var util=require(_0x4df4('0x0'));var moment=require('moment');var BPromise=require(_0x4df4('0x1'));var rs=require(_0x4df4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4df4('0x3'))['db'];var utils=require(_0x4df4('0x4'));var logger=require(_0x4df4('0x5'))(_0x4df4('0x6'));var config=require('../../config/environment');var jayson=require(_0x4df4('0x7'));var client=jayson[_0x4df4('0x8')][_0x4df4('0x9')]({'port':0x232a});config[_0x4df4('0xa')]=_['defaults'](config[_0x4df4('0xa')],{'host':_0x4df4('0xb'),'port':0x18eb});var socket=require(_0x4df4('0xc'))(new Redis(config['redis']));require(_0x4df4('0xd'))[_0x4df4('0xe')](socket);function respondWithRpcPromise(_0x52deef,_0x193a4b,_0x4fec34){return new BPromise(function(_0x5c90e9,_0xe4889c){return client['request'](_0x52deef,_0x4fec34)[_0x4df4('0xf')](function(_0x36f502){logger['info'](_0x4df4('0x10'),_0x193a4b,_0x4df4('0x11'));logger[_0x4df4('0x12')](_0x4df4('0x13'),_0x193a4b,_0x4df4('0x11'),JSON[_0x4df4('0x14')](_0x36f502));if(_0x36f502[_0x4df4('0x15')]){if(_0x36f502[_0x4df4('0x15')][_0x4df4('0x16')]===0x1f4){logger['error'](_0x4df4('0x10'),_0x193a4b,_0x36f502['error']['message']);return _0xe4889c(_0x36f502[_0x4df4('0x15')][_0x4df4('0x17')]);}logger['error'](_0x4df4('0x10'),_0x193a4b,_0x36f502['error']['message']);return _0x5c90e9(_0x36f502['error'][_0x4df4('0x17')]);}else{logger['info'](_0x4df4('0x10'),_0x193a4b,_0x4df4('0x11'));_0x5c90e9(_0x36f502[_0x4df4('0x18')][_0x4df4('0x17')]);}})['catch'](function(_0x3b4f07){logger[_0x4df4('0x15')](_0x4df4('0x10'),_0x193a4b,_0x3b4f07);_0xe4889c(_0x3b4f07);});});}exports[_0x4df4('0x19')]=function(_0x376233){var _0x2a03d5=this;return new Promise(function(_0x30f883,_0x1b5d50){return db[_0x4df4('0x1a')][_0x4df4('0x1b')](_0x376233[_0x4df4('0x1c')],{'raw':_0x376233[_0x4df4('0x1d')]?_0x376233['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x376233['options']?_0x376233['options'][_0x4df4('0x1e')]||null:null,'attributes':_0x376233[_0x4df4('0x1d')]?_0x376233[_0x4df4('0x1d')]['attributes']||null:null,'limit':_0x376233[_0x4df4('0x1d')]?_0x376233[_0x4df4('0x1d')]['limit']||null:null})[_0x4df4('0xf')](function(_0x43d657){logger[_0x4df4('0x1f')](_0x4df4('0x19'),_0x376233);logger[_0x4df4('0x12')](_0x4df4('0x19'),_0x376233,JSON['stringify'](_0x43d657));_0x30f883(_0x43d657);})[_0x4df4('0x20')](function(_0x5353fd){logger[_0x4df4('0x15')](_0x4df4('0x19'),_0x5353fd[_0x4df4('0x17')],_0x376233);_0x1b5d50(_0x2a03d5[_0x4df4('0x15')](0x1f4,_0x5353fd['message']));});});};exports[_0x4df4('0x21')]=function(_0x1aaad0){return new Promise(function(_0x81209c,_0x41ab03){return db[_0x4df4('0x1a')][_0x4df4('0x22')]({'where':_0x1aaad0['options']?_0x1aaad0[_0x4df4('0x1d')][_0x4df4('0x1e')]||null:null})[_0x4df4('0xf')](function(_0x42a4c1){if(_0x42a4c1){return _0x42a4c1['addTags'](_0x1aaad0['body'][_0x4df4('0x23')],_[_0x4df4('0x24')](_0x1aaad0[_0x4df4('0x1c')],['ids','id'])||{});}})[_0x4df4('0x25')](function(_0x4c6d4d){logger[_0x4df4('0x1f')](_0x4df4('0x26'),_0x1aaad0);logger[_0x4df4('0x12')](_0x4df4('0x26'),_0x1aaad0,JSON[_0x4df4('0x14')](_0x4c6d4d));_0x81209c(_0x4c6d4d);})[_0x4df4('0x20')](function(_0x2d5c7c){logger['error'](_0x4df4('0x26'),_0x2d5c7c[_0x4df4('0x17')],_0x1aaad0);_0x41ab03(_this[_0x4df4('0x15')](0x1f4,_0x2d5c7c[_0x4df4('0x17')]));});});}; \ No newline at end of file +var _0x7739=['AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','defaults','redis','localhost','socket.io-emitter','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','UpdateChatInteraction','update','options','raw','attributes','limit','AddTagsToChatInteraction','ChatInteraction','find','where','addTags','body','ids','omit','spread'];(function(_0x36cec5,_0x11477e){var _0x328186=function(_0x5bca9d){while(--_0x5bca9d){_0x36cec5['push'](_0x36cec5['shift']());}};_0x328186(++_0x11477e);}(_0x7739,0xeb));var _0x9773=function(_0x218ee2,_0x44b8e8){_0x218ee2=_0x218ee2-0x0;var _0x5b74a6=_0x7739[_0x218ee2];return _0x5b74a6;};'use strict';var _=require(_0x9773('0x0'));var util=require(_0x9773('0x1'));var moment=require(_0x9773('0x2'));var BPromise=require('bluebird');var rs=require(_0x9773('0x3'));var fs=require('fs');var Redis=require(_0x9773('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9773('0x5'));var logger=require('../../config/logger')(_0x9773('0x6'));var config=require('../../config/environment');var jayson=require(_0x9773('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x9773('0x8')](config[_0x9773('0x9')],{'host':_0x9773('0xa'),'port':0x18eb});var socket=require(_0x9773('0xb'))(new Redis(config[_0x9773('0x9')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x14d4cc,_0xa1cba5,_0x88f214){return new BPromise(function(_0x12957e,_0x2eb139){return client[_0x9773('0xc')](_0x14d4cc,_0x88f214)[_0x9773('0xd')](function(_0x3db0dc){logger[_0x9773('0xe')](_0x9773('0xf'),_0xa1cba5,_0x9773('0x10'));logger[_0x9773('0x11')](_0x9773('0x12'),_0xa1cba5,_0x9773('0x10'),JSON[_0x9773('0x13')](_0x3db0dc));if(_0x3db0dc['error']){if(_0x3db0dc['error'][_0x9773('0x14')]===0x1f4){logger[_0x9773('0x15')](_0x9773('0xf'),_0xa1cba5,_0x3db0dc[_0x9773('0x15')][_0x9773('0x16')]);return _0x2eb139(_0x3db0dc[_0x9773('0x15')][_0x9773('0x16')]);}logger[_0x9773('0x15')](_0x9773('0xf'),_0xa1cba5,_0x3db0dc[_0x9773('0x15')]['message']);return _0x12957e(_0x3db0dc[_0x9773('0x15')]['message']);}else{logger[_0x9773('0xe')](_0x9773('0xf'),_0xa1cba5,_0x9773('0x10'));_0x12957e(_0x3db0dc['result']['message']);}})['catch'](function(_0x2f6012){logger[_0x9773('0x15')]('ChatInteraction,\x20%s,\x20%s',_0xa1cba5,_0x2f6012);_0x2eb139(_0x2f6012);});});}exports[_0x9773('0x17')]=function(_0x177e9a){var _0x1b8bc7=this;return new Promise(function(_0x44e259,_0x4e12ce){return db['ChatInteraction'][_0x9773('0x18')](_0x177e9a['body'],{'raw':_0x177e9a[_0x9773('0x19')]?_0x177e9a[_0x9773('0x19')][_0x9773('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x177e9a[_0x9773('0x19')]?_0x177e9a['options']['where']||null:null,'attributes':_0x177e9a[_0x9773('0x19')]?_0x177e9a[_0x9773('0x19')][_0x9773('0x1b')]||null:null,'limit':_0x177e9a[_0x9773('0x19')]?_0x177e9a[_0x9773('0x19')][_0x9773('0x1c')]||null:null})[_0x9773('0xd')](function(_0x4eff96){logger[_0x9773('0xe')](_0x9773('0x17'),_0x177e9a);logger[_0x9773('0x11')](_0x9773('0x17'),_0x177e9a,JSON[_0x9773('0x13')](_0x4eff96));_0x44e259(_0x4eff96);})['catch'](function(_0x8a2758){logger['error'](_0x9773('0x17'),_0x8a2758['message'],_0x177e9a);_0x4e12ce(_0x1b8bc7[_0x9773('0x15')](0x1f4,_0x8a2758['message']));});});};exports[_0x9773('0x1d')]=function(_0x247bbc){return new Promise(function(_0x3286db,_0x291113){return db[_0x9773('0x1e')][_0x9773('0x1f')]({'where':_0x247bbc[_0x9773('0x19')]?_0x247bbc[_0x9773('0x19')][_0x9773('0x20')]||null:null})[_0x9773('0xd')](function(_0x524416){if(_0x524416){return _0x524416[_0x9773('0x21')](_0x247bbc[_0x9773('0x22')][_0x9773('0x23')],_[_0x9773('0x24')](_0x247bbc['body'],['ids','id'])||{});}})[_0x9773('0x25')](function(_0x59a381){logger[_0x9773('0xe')](_0x9773('0x26'),_0x247bbc);logger[_0x9773('0x11')](_0x9773('0x26'),_0x247bbc,JSON[_0x9773('0x13')](_0x59a381));_0x3286db(_0x59a381);})['catch'](function(_0x28b427){logger[_0x9773('0x15')]('AddTags',_0x28b427['message'],_0x247bbc);_0x291113(_this[_0x9773('0x15')](0x1f4,_0x28b427['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 0f573bf..30b4f72 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 _0x4b4a=['update','emit','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x5a2c99,_0x173ee0){var _0x242b3a=function(_0x122ead){while(--_0x122ead){_0x5a2c99['push'](_0x5a2c99['shift']());}};_0x242b3a(++_0x173ee0);}(_0x4b4a,0xde));var _0xa4b4=function(_0x5465e6,_0x2a8809){_0x5465e6=_0x5465e6-0x0;var _0x10044e=_0x4b4a[_0x5465e6];return _0x10044e;};'use strict';var ChatInteractionEvents=require(_0xa4b4('0x0'));var events=[_0xa4b4('0x1'),'remove',_0xa4b4('0x2')];function createListener(_0xad1a88,_0x15e663){return function(_0x53248b){_0x15e663[_0xa4b4('0x3')](_0xad1a88,_0x53248b);};}function removeListener(_0x4cdfd2,_0x1484cf){return function(){ChatInteractionEvents['removeListener'](_0x4cdfd2,_0x1484cf);};}exports[_0xa4b4('0x4')]=function(_0x3f2822){for(var _0x1a0e37=0x0,_0x4dc522=events[_0xa4b4('0x5')];_0x1a0e37<_0x4dc522;_0x1a0e37++){var _0x21047f=events[_0x1a0e37];var _0x3a412f=createListener(_0xa4b4('0x6')+_0x21047f,_0x3f2822);ChatInteractionEvents['on'](_0x21047f,_0x3a412f);}}; \ No newline at end of file +var _0xf109=['remove','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x466b13,_0x7f20ce){var _0x5cb98c=function(_0x5c369f){while(--_0x5c369f){_0x466b13['push'](_0x466b13['shift']());}};_0x5cb98c(++_0x7f20ce);}(_0xf109,0x1de));var _0x9f10=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xf109[_0x1b4b23];return _0x2a325b;};'use strict';var ChatInteractionEvents=require(_0x9f10('0x0'));var events=[_0x9f10('0x1'),_0x9f10('0x2'),'update'];function createListener(_0x1f9ed8,_0x34d67c){return function(_0x368f40){_0x34d67c['emit'](_0x1f9ed8,_0x368f40);};}function removeListener(_0x4d57aa,_0x550c4c){return function(){ChatInteractionEvents['removeListener'](_0x4d57aa,_0x550c4c);};}exports[_0x9f10('0x3')]=function(_0x53c7a9){for(var _0x13d9d1=0x0,_0x294780=events[_0x9f10('0x4')];_0x13d9d1<_0x294780;_0x13d9d1++){var _0x11d75a=events[_0x13d9d1];var _0x1d7ed7=createListener(_0x9f10('0x5')+_0x11d75a,_0x53c7a9);ChatInteractionEvents['on'](_0x11d75a,_0x1d7ed7);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 98a11a3..550f9cb 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 _0xc705=['/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','addMessage','/:id/tags','chat','chatinteraction:addtags','put','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','path','Router','fs-extra','../../components/auth/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show'];(function(_0x10687d,_0x5458d0){var _0xd1eef9=function(_0x1c8ee4){while(--_0x1c8ee4){_0x10687d['push'](_0x10687d['shift']());}};_0xd1eef9(++_0x5458d0);}(_0xc705,0x11e));var _0x5c70=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0xc705[_0x11e05d];return _0x335588;};'use strict';var multer=require(_0x5c70('0x0'));var util=require('util');var path=require(_0x5c70('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5c70('0x2')]();var fs_extra=require(_0x5c70('0x3'));var auth=require(_0x5c70('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5c70('0x5'));router[_0x5c70('0x6')]('/',auth[_0x5c70('0x7')](),controller[_0x5c70('0x8')]);router[_0x5c70('0x6')](_0x5c70('0x9'),auth['isAuthenticated'](),controller[_0x5c70('0xa')]);router['get'](_0x5c70('0xb'),auth[_0x5c70('0xc')](),controller[_0x5c70('0xd')]);router['get'](_0x5c70('0xe'),auth[_0x5c70('0xc')](),controller[_0x5c70('0xf')]);router[_0x5c70('0x6')](_0x5c70('0x10'),auth[_0x5c70('0x7')](),controller[_0x5c70('0x11')]);router[_0x5c70('0x6')]('/:id/my_messages',auth[_0x5c70('0xc')](),controller[_0x5c70('0x12')]);router['get'](_0x5c70('0x13'),auth[_0x5c70('0x7')](),controller[_0x5c70('0x14')]);router['post']('/',auth[_0x5c70('0x7')](),controller[_0x5c70('0x15')]);router[_0x5c70('0x16')](_0x5c70('0x17'),auth['isAuthenticated'](),controller[_0x5c70('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1e9126,_0x77b1e0,_0x2e1bdc){_0x2e1bdc(null,path['join'](config[_0x5c70('0x19')],_0x5c70('0x1a')));},'filename':function(_0x4fcfeb,_0x21d7dd,_0xf4fc1f){_0xf4fc1f(null,util['format'](_0x5c70('0x1b'),Date[_0x5c70('0x1c')](),_0x21d7dd[_0x5c70('0x1d')][_0x5c70('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5c70('0x16')](_0x5c70('0x1f'),upload[_0x5c70('0x20')]('file'),controller['attachmentUpload']);router['post'](_0x5c70('0x10'),auth[_0x5c70('0xc')](),controller[_0x5c70('0x21')]);router[_0x5c70('0x16')](_0x5c70('0x22'),auth['isAuthenticated'](),interaction['tracked'](_0x5c70('0x23'),_0x5c70('0x24')),controller['addTags']);router[_0x5c70('0x25')](_0x5c70('0xb'),auth[_0x5c70('0x7')](),interaction[_0x5c70('0x26')](_0x5c70('0x23'),_0x5c70('0x27')),controller[_0x5c70('0x28')]);router['put'](_0x5c70('0x29'),controller[_0x5c70('0x2a')]);router[_0x5c70('0x25')]('/:id/abandon',auth[_0x5c70('0xc')](),controller[_0x5c70('0x2b')]);router['put'](_0x5c70('0x2c'),controller['close']);router[_0x5c70('0x2d')](_0x5c70('0xb'),auth['isAuthenticated'](),interaction[_0x5c70('0x26')](_0x5c70('0x23'),_0x5c70('0x2e')),controller[_0x5c70('0x2f')]);router[_0x5c70('0x2d')]('/:id/tags',auth[_0x5c70('0x7')](),controller[_0x5c70('0x30')]);module[_0x5c70('0x31')]=router; \ No newline at end of file +var _0xd080=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','/:id/download','download','post','create','createVidaooSession','diskStorage','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','tracked','addTags','put','chat','/:id/custom_update','abandon','close','delete','destroy','removeTags','exports','multer','path'];(function(_0xa4f636,_0xaca1b6){var _0x37e02a=function(_0x49bd47){while(--_0x49bd47){_0xa4f636['push'](_0xa4f636['shift']());}};_0x37e02a(++_0xaca1b6);}(_0xd080,0x1de));var _0x0d08=function(_0x49bda3,_0x2bb661){_0x49bda3=_0x49bda3-0x0;var _0x18b651=_0xd080[_0x49bda3];return _0x18b651;};'use strict';var multer=require(_0x0d08('0x0'));var util=require('util');var path=require(_0x0d08('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d08('0x2')]();var fs_extra=require(_0x0d08('0x3'));var auth=require(_0x0d08('0x4'));var interaction=require(_0x0d08('0x5'));var config=require(_0x0d08('0x6'));var controller=require(_0x0d08('0x7'));router['get']('/',auth[_0x0d08('0x8')](),controller[_0x0d08('0x9')]);router['get'](_0x0d08('0xa'),auth[_0x0d08('0x8')](),controller[_0x0d08('0xb')]);router[_0x0d08('0xc')](_0x0d08('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x0d08('0xe')]);router[_0x0d08('0xc')](_0x0d08('0xf'),auth[_0x0d08('0x10')](),controller[_0x0d08('0x11')]);router[_0x0d08('0xc')](_0x0d08('0x12'),auth['isAuthenticated'](),controller['getMessages']);router[_0x0d08('0xc')](_0x0d08('0x13'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0x0d08('0xc')](_0x0d08('0x14'),auth[_0x0d08('0x8')](),controller[_0x0d08('0x15')]);router[_0x0d08('0x16')]('/',auth[_0x0d08('0x8')](),controller[_0x0d08('0x17')]);router[_0x0d08('0x16')]('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x0d08('0x18')]);var upload=multer({'storage':multer[_0x0d08('0x19')]({'destination':function(_0x569140,_0x31b15a,_0x1ab314){_0x1ab314(null,path['join'](config['root'],_0x0d08('0x1a')));},'filename':function(_0x35a6fa,_0x9aa5a,_0x1516a2){_0x1516a2(null,util[_0x0d08('0x1b')](_0x0d08('0x1c'),Date[_0x0d08('0x1d')](),_0x9aa5a[_0x0d08('0x1e')][_0x0d08('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0d08('0x16')](_0x0d08('0x20'),upload[_0x0d08('0x21')](_0x0d08('0x22')),controller[_0x0d08('0x23')]);router[_0x0d08('0x16')]('/:id/messages',auth[_0x0d08('0x10')](),controller[_0x0d08('0x24')]);router[_0x0d08('0x16')]('/:id/tags',auth[_0x0d08('0x8')](),interaction[_0x0d08('0x25')]('chat','chatinteraction:addtags'),controller[_0x0d08('0x26')]);router[_0x0d08('0x27')](_0x0d08('0xd'),auth[_0x0d08('0x8')](),interaction[_0x0d08('0x25')](_0x0d08('0x28'),'chatinteraction:update'),controller['update']);router[_0x0d08('0x27')](_0x0d08('0x29'),controller['customUpdate']);router[_0x0d08('0x27')]('/:id/abandon',auth[_0x0d08('0x10')](),controller[_0x0d08('0x2a')]);router[_0x0d08('0x27')]('/:id/close',controller[_0x0d08('0x2b')]);router[_0x0d08('0x2c')](_0x0d08('0xd'),auth[_0x0d08('0x8')](),interaction['tracked']('chat','chatinteraction:destroy'),controller[_0x0d08('0x2d')]);router[_0x0d08('0x2c')]('/:id/tags',auth[_0x0d08('0x8')](),controller[_0x0d08('0x2e')]);module[_0x0d08('0x2f')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 46d3b61..f5bde66 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 _0x032e=['medium','BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0x032e,0x14d));var _0xe032=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x032e[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0xe032('0x0'));module[_0xe032('0x1')]={'body':{'type':Sequelize[_0xe032('0x2')](_0xe032('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe032('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe032('0x5')]}}; \ No newline at end of file +var _0x91b4=['sequelize','TEXT','BOOLEAN','INTEGER'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0x91b4,0x130));var _0x491b=function(_0x576fe4,_0x2e4f2b){_0x576fe4=_0x576fe4-0x0;var _0x192e88=_0x91b4[_0x576fe4];return _0x192e88;};'use strict';var Sequelize=require(_0x491b('0x0'));module['exports']={'body':{'type':Sequelize[_0x491b('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x491b('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x491b('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 49906e1..5c4e67c 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 _0x2c6e=['find','catch','create','body','describe','get','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','admin','userpic','internal','lastLoginAt','showWebBar','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','UserProfileResource','agent','resourceId','push','FromId','ToId','read','all','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatInternalMessage','includeAll','findAll','rows','params','keys','rawAttributes','fields','length','include'];(function(_0x1c9906,_0x3cd175){var _0x1726d8=function(_0x469f42){while(--_0x469f42){_0x1c9906['push'](_0x1c9906['shift']());}};_0x1726d8(++_0x3cd175);}(_0x2c6e,0x1cf));var _0xe2c6=function(_0x23f3f2,_0x305d7e){_0x23f3f2=_0x23f3f2-0x0;var _0x4891cb=_0x2c6e[_0x23f3f2];return _0x4891cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe2c6('0x0'));var zipdir=require(_0xe2c6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe2c6('0x2'));var BPromise=require(_0xe2c6('0x3'));var Mustache=require(_0xe2c6('0x4'));var util=require(_0xe2c6('0x5'));var path=require(_0xe2c6('0x6'));var sox=require('sox');var csv=require(_0xe2c6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe2c6('0x8'));var _=require('lodash');var squel=require(_0xe2c6('0x9'));var crypto=require(_0xe2c6('0xa'));var jsforce=require(_0xe2c6('0xb'));var deskjs=require(_0xe2c6('0xc'));var toCsv=require(_0xe2c6('0x7'));var querystring=require(_0xe2c6('0xd'));var Papa=require(_0xe2c6('0xe'));var Redis=require('ioredis');var authService=require(_0xe2c6('0xf'));var qs=require(_0xe2c6('0x10'));var as=require(_0xe2c6('0x11'));var hardwareService=require(_0xe2c6('0x12'));var logger=require('../../config/logger')(_0xe2c6('0x13'));var utils=require('../../config/utils');var config=require(_0xe2c6('0x14'));var licenseUtil=require(_0xe2c6('0x15'));var db=require(_0xe2c6('0x16'))['db'];config[_0xe2c6('0x17')]=_[_0xe2c6('0x18')](config[_0xe2c6('0x17')],{'host':_0xe2c6('0x19'),'port':0x18eb});var socket=require(_0xe2c6('0x1a'))(new Redis(config['redis']));require(_0xe2c6('0x1b'))[_0xe2c6('0x1c')](socket);function respondWithStatusCode(_0x1192e5,_0x899d83){_0x899d83=_0x899d83||0xcc;return function(_0x4686bc){if(_0x4686bc){return _0x1192e5[_0xe2c6('0x1d')](_0x899d83);}return _0x1192e5[_0xe2c6('0x1e')](_0x899d83)['end']();};}function respondWithResult(_0x3fe77d,_0x4bb0dc){_0x4bb0dc=_0x4bb0dc||0xc8;return function(_0x489362){if(_0x489362){return _0x3fe77d[_0xe2c6('0x1e')](_0x4bb0dc)[_0xe2c6('0x1f')](_0x489362);}};}function respondWithFilteredResult(_0x130def,_0x861a60){return function(_0x5a76eb){if(_0x5a76eb){var _0xe6d2fc=typeof _0x861a60[_0xe2c6('0x20')]==='undefined'&&typeof _0x861a60[_0xe2c6('0x21')]===_0xe2c6('0x22');var _0x29d287=_0x5a76eb['count'];var _0x16536e=_0xe6d2fc?0x0:_0x861a60[_0xe2c6('0x20')];var _0x148fc5=_0xe6d2fc?_0x5a76eb[_0xe2c6('0x23')]:_0x861a60[_0xe2c6('0x20')]+_0x861a60[_0xe2c6('0x21')];var _0x534f98;if(_0x148fc5>=_0x29d287){_0x148fc5=_0x29d287;_0x534f98=0xc8;}else{_0x534f98=0xce;}_0x130def[_0xe2c6('0x1e')](_0x534f98);return _0x130def[_0xe2c6('0x24')](_0xe2c6('0x25'),_0x16536e+'-'+_0x148fc5+'/'+_0x29d287)['json'](_0x5a76eb);}return null;};}function patchUpdates(_0x5cbe1a){return function(_0xf30011){try{jsonpatch[_0xe2c6('0x26')](_0xf30011,_0x5cbe1a,!![]);}catch(_0x2dbed6){return BPromise[_0xe2c6('0x27')](_0x2dbed6);}return _0xf30011[_0xe2c6('0x28')]();};}function saveUpdates(_0x584c85,_0x48419d){return function(_0x2bf3d2){if(_0x2bf3d2){return _0x2bf3d2[_0xe2c6('0x29')](_0x584c85)[_0xe2c6('0x2a')](function(_0x4ae0c8){return _0x4ae0c8;});}return null;};}function removeEntity(_0xea59ff,_0x4e2f6d){return function(_0x38c1e7){if(_0x38c1e7){return _0x38c1e7[_0xe2c6('0x2b')]()[_0xe2c6('0x2a')](function(){_0xea59ff['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x200c7c,_0x433b82){return function(_0xf52913){if(!_0xf52913){_0x200c7c[_0xe2c6('0x1d')](0x194);}return _0xf52913;};}function handleError(_0x1140a8,_0x4851e8){_0x4851e8=_0x4851e8||0x1f4;return function(_0x303277){logger[_0xe2c6('0x2c')](_0x303277[_0xe2c6('0x2d')]);if(_0x303277[_0xe2c6('0x2e')]){delete _0x303277[_0xe2c6('0x2e')];}_0x1140a8[_0xe2c6('0x1e')](_0x4851e8)[_0xe2c6('0x2f')](_0x303277);};}exports[_0xe2c6('0x30')]=function(_0x1a0f97,_0xdb9e26){var _0xb7cc6b={},_0x15e4cd={},_0x144804={'count':0x0,'rows':[]};var _0x5af65f=_[_0xe2c6('0x31')](db['ChatInternalMessage']['rawAttributes'],function(_0x76c8d1){return{'name':_0x76c8d1[_0xe2c6('0x32')],'type':_0x76c8d1[_0xe2c6('0x33')][_0xe2c6('0x34')]};});_0x15e4cd[_0xe2c6('0x35')]=_[_0xe2c6('0x31')](_0x5af65f,'name');_0x15e4cd[_0xe2c6('0x36')]=_['keys'](_0x1a0f97[_0xe2c6('0x36')]);_0x15e4cd[_0xe2c6('0x37')]=_[_0xe2c6('0x38')](_0x15e4cd['model'],_0x15e4cd['query']);_0xb7cc6b[_0xe2c6('0x39')]=_[_0xe2c6('0x38')](_0x15e4cd[_0xe2c6('0x35')],qs['fields'](_0x1a0f97[_0xe2c6('0x36')]['fields']));_0xb7cc6b[_0xe2c6('0x39')]=_0xb7cc6b[_0xe2c6('0x39')]['length']?_0xb7cc6b[_0xe2c6('0x39')]:_0x15e4cd[_0xe2c6('0x35')];if(!_0x1a0f97[_0xe2c6('0x36')][_0xe2c6('0x3a')]('nolimit')){_0xb7cc6b[_0xe2c6('0x21')]=qs['limit'](_0x1a0f97[_0xe2c6('0x36')][_0xe2c6('0x21')]);_0xb7cc6b['offset']=qs[_0xe2c6('0x20')](_0x1a0f97[_0xe2c6('0x36')]['offset']);}_0xb7cc6b[_0xe2c6('0x3b')]=qs[_0xe2c6('0x3c')](_0x1a0f97[_0xe2c6('0x36')][_0xe2c6('0x3c')]);_0xb7cc6b[_0xe2c6('0x3d')]=qs[_0xe2c6('0x37')](_[_0xe2c6('0x3e')](_0x1a0f97[_0xe2c6('0x36')],_0x15e4cd['filters']),_0x5af65f);if(_0x1a0f97[_0xe2c6('0x36')][_0xe2c6('0x3f')]){_0xb7cc6b[_0xe2c6('0x3d')]=_[_0xe2c6('0x40')](_0xb7cc6b[_0xe2c6('0x3d')],{'$or':_[_0xe2c6('0x31')](_0x5af65f,function(_0x4f51b6){if(_0x4f51b6[_0xe2c6('0x33')]!==_0xe2c6('0x41')){var _0xff8e0b={};_0xff8e0b[_0x4f51b6[_0xe2c6('0x2e')]]={'$like':'%'+_0x1a0f97[_0xe2c6('0x36')]['filter']+'%'};return _0xff8e0b;}})});}_0xb7cc6b=_[_0xe2c6('0x40')]({},_0xb7cc6b,_0x1a0f97[_0xe2c6('0x42')]);var _0x56ab99={'where':_0xb7cc6b['where']};return db[_0xe2c6('0x43')]['count'](_0x56ab99)['then'](function(_0x5567b0){_0x144804['count']=_0x5567b0;if(_0x1a0f97[_0xe2c6('0x36')][_0xe2c6('0x44')]){_0xb7cc6b['include']=[{'all':!![]}];}return db[_0xe2c6('0x43')][_0xe2c6('0x45')](_0xb7cc6b);})['then'](function(_0x412653){_0x144804[_0xe2c6('0x46')]=_0x412653;return _0x144804;})['then'](respondWithFilteredResult(_0xdb9e26,_0xb7cc6b))['catch'](handleError(_0xdb9e26,null));};exports['show']=function(_0x7bc701,_0x7243cd){var _0x569ee4={'raw':!![],'where':{'id':_0x7bc701[_0xe2c6('0x47')]['id']}},_0x3a869c={};_0x3a869c[_0xe2c6('0x35')]=_[_0xe2c6('0x48')](db[_0xe2c6('0x43')][_0xe2c6('0x49')]);_0x3a869c['query']=_[_0xe2c6('0x48')](_0x7bc701[_0xe2c6('0x36')]);_0x3a869c[_0xe2c6('0x37')]=_[_0xe2c6('0x38')](_0x3a869c[_0xe2c6('0x35')],_0x3a869c[_0xe2c6('0x36')]);_0x569ee4[_0xe2c6('0x39')]=_['intersection'](_0x3a869c[_0xe2c6('0x35')],qs[_0xe2c6('0x4a')](_0x7bc701[_0xe2c6('0x36')][_0xe2c6('0x4a')]));_0x569ee4[_0xe2c6('0x39')]=_0x569ee4[_0xe2c6('0x39')][_0xe2c6('0x4b')]?_0x569ee4[_0xe2c6('0x39')]:_0x3a869c[_0xe2c6('0x35')];if(_0x7bc701['query'][_0xe2c6('0x44')]){_0x569ee4[_0xe2c6('0x4c')]=[{'all':!![]}];}_0x569ee4=_[_0xe2c6('0x40')]({},_0x569ee4,_0x7bc701[_0xe2c6('0x42')]);return db[_0xe2c6('0x43')][_0xe2c6('0x4d')](_0x569ee4)['then'](handleEntityNotFound(_0x7243cd,null))['then'](respondWithResult(_0x7243cd,null))[_0xe2c6('0x4e')](handleError(_0x7243cd,null));};exports[_0xe2c6('0x4f')]=function(_0x5ab53d,_0x5706f8){return db['ChatInternalMessage']['create'](_0x5ab53d[_0xe2c6('0x50')],{})[_0xe2c6('0x2a')](respondWithResult(_0x5706f8,0xc9))[_0xe2c6('0x4e')](handleError(_0x5706f8,null));};exports['update']=function(_0x5ca1d9,_0x3f522d){if(_0x5ca1d9['body']['id']){delete _0x5ca1d9[_0xe2c6('0x50')]['id'];}return db[_0xe2c6('0x43')][_0xe2c6('0x4d')]({'where':{'id':_0x5ca1d9[_0xe2c6('0x47')]['id']}})[_0xe2c6('0x2a')](handleEntityNotFound(_0x3f522d,null))[_0xe2c6('0x2a')](saveUpdates(_0x5ca1d9['body'],null))[_0xe2c6('0x2a')](respondWithResult(_0x3f522d,null))[_0xe2c6('0x4e')](handleError(_0x3f522d,null));};exports['destroy']=function(_0x35eaed,_0x238e76){return db[_0xe2c6('0x43')][_0xe2c6('0x4d')]({'where':{'id':_0x35eaed[_0xe2c6('0x47')]['id']}})[_0xe2c6('0x2a')](handleEntityNotFound(_0x238e76,null))[_0xe2c6('0x2a')](removeEntity(_0x238e76,null))[_0xe2c6('0x4e')](handleError(_0x238e76,null));};exports['describe']=function(_0x1dc6b5,_0x4ffcda){return db['ChatInternalMessage'][_0xe2c6('0x51')]()[_0xe2c6('0x2a')](respondWithResult(_0x4ffcda,null))[_0xe2c6('0x4e')](handleError(_0x4ffcda,null));};function wrapUser(_0x289514){return function(_0x1735a6){var _0x28e984=_0x289514[_0xe2c6('0x52')]({'plain':!![]});_0x28e984['messages']=[];if(_0x1735a6){_0x28e984[_0xe2c6('0x53')]=_0x1735a6[_0xe2c6('0x54')];_0x28e984[_0xe2c6('0x55')]=_0x1735a6;}else{_0x28e984['lastMessageAt']=moment(0x0)[_0xe2c6('0x56')](_0xe2c6('0x57'));_0x28e984['lastMessage']={};}return _0x28e984;};}exports[_0xe2c6('0x58')]=function(_0xe6bfe2,_0x10437c,_0x7028b8){var _0x281882=[];return db['User'][_0xe2c6('0x45')]({'where':{'role':['agent',_0xe2c6('0x59'),'user']},'attributes':['id','fullname',_0xe2c6('0x2e'),'role',_0xe2c6('0x5a'),_0xe2c6('0x5b'),'online',_0xe2c6('0x5c'),'allowmessenger',_0xe2c6('0x5d')],'order':qs[_0xe2c6('0x3c')]('-online'),'include':[{'model':db['VoiceQueue'],'as':_0xe2c6('0x5e'),'attributes':['id','name',_0xe2c6('0x33')],'through':{'attributes':[]}}]})[_0xe2c6('0x2a')](function(_0x20ef06){if(_0x20ef06){var _0x2c7d8e=_0xe6bfe2[_0xe2c6('0x5f')][_0xe2c6('0x52')]({'plain':!![]});if(!_0x2c7d8e)throw new Error(_0xe2c6('0x60'));if(_0x2c7d8e[_0xe2c6('0x61')]===_0xe2c6('0x5f')){return db[_0xe2c6('0x62')]['find']({'where':{'name':_0xe2c6('0x63'),'userProfileId':_0x2c7d8e['userProfileId']},'raw':!![]})[_0xe2c6('0x2a')](function(_0x255f94){if(_0x255f94){if(_0x255f94['autoAssociation']===0x0){return db[_0xe2c6('0x64')][_0xe2c6('0x45')]({'where':{'sectionId':_0x255f94['id']},'raw':!![]})[_0xe2c6('0x2a')](function(_0x34daf1){var _0x1d0486=[];if(_['isEmpty'](_0x34daf1)){_0x1d0486=_[_0xe2c6('0x3f')](_0x20ef06,function(_0x142434){if(_0x142434[_0xe2c6('0x61')]!==_0xe2c6('0x65')){return _0x142434;}});return _0x1d0486;}else{for(var _0x4e2aed=0x0;_0x4e2aed<_0x20ef06['length'];_0x4e2aed++){var _0x2fdebb=_0x20ef06[_0x4e2aed];if(_0x2fdebb[_0xe2c6('0x61')]===_0xe2c6('0x65')){var _0x59c7bd=_['find'](_0x34daf1,function(_0xc7f46a){return _0xc7f46a[_0xe2c6('0x66')]===_0x2fdebb['id'];});if(_0x59c7bd)_0x1d0486[_0xe2c6('0x67')](_0x2fdebb);}else{_0x1d0486[_0xe2c6('0x67')](_0x2fdebb);}}return _0x1d0486;}});}else{return _0x20ef06;}}else{var _0x14d359=_['filter'](_0x20ef06,function(_0x411afe){if(_0x411afe[_0xe2c6('0x61')]!==_0xe2c6('0x65')){return _0x411afe;}});return _0x14d359;}});}else{return _0x20ef06;}}})['then'](function(_0x32379e){var _0x246ed5=[];if(_0x32379e){_0x281882=_0x32379e;for(var _0x78b6d5=0x0;_0x78b6d5<_0x32379e[_0xe2c6('0x4b')];_0x78b6d5+=0x1){_0x281882[_0x78b6d5]['messages']=[];_0x246ed5['push'](db[_0xe2c6('0x43')]['find']({'where':{'FromId':[_0xe6bfe2['user']['id'],_0x32379e[_0x78b6d5]['id']],'ToId':[_0xe6bfe2[_0xe2c6('0x5f')]['id'],_0x32379e[_0x78b6d5]['id']],'ChatGroupId':null},'attributes':['id',_0xe2c6('0x54'),_0xe2c6('0x68'),_0xe2c6('0x69'),_0xe2c6('0x6a'),'body'],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe2c6('0x2a')](wrapUser(_0x32379e[_0x78b6d5])));}return BPromise[_0xe2c6('0x6b')](_0x246ed5);}return[];})[_0xe2c6('0x2a')](function(_0x2fc83e){return{'rows':_0x2fc83e,'count':_0x2fc83e[_0xe2c6('0x4b')]};})[_0xe2c6('0x2a')](respondWithResult(_0x10437c,null))['catch'](handleError(_0x10437c,null));}; \ No newline at end of file +var _0x6e3f=['Agents','userProfileId','autoAssociation','isEmpty','messages','push','FromId','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','name','send','index','map','ChatInternalMessage','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','params','rawAttributes','find','catch','create','body','describe','get','lastMessageAt','createdAt','lastMessage','getUsers','findAll','agent','admin','fullname','internal','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x4596b9,_0x1a3f4a){var _0x5da47a=function(_0x4ae8bd){while(--_0x4ae8bd){_0x4596b9['push'](_0x4596b9['shift']());}};_0x5da47a(++_0x1a3f4a);}(_0x6e3f,0x1a0));var _0xf6e3=function(_0x20bd48,_0x293e0d){_0x20bd48=_0x20bd48-0x0;var _0x8c31ae=_0x6e3f[_0x20bd48];return _0x8c31ae;};'use strict';var emlformat=require(_0xf6e3('0x0'));var rimraf=require(_0xf6e3('0x1'));var zipdir=require(_0xf6e3('0x2'));var jsonpatch=require(_0xf6e3('0x3'));var rp=require('request-promise');var moment=require(_0xf6e3('0x4'));var BPromise=require(_0xf6e3('0x5'));var Mustache=require(_0xf6e3('0x6'));var util=require(_0xf6e3('0x7'));var path=require('path');var sox=require(_0xf6e3('0x8'));var csv=require('to-csv');var ejs=require(_0xf6e3('0x9'));var fs=require('fs');var fs_extra=require(_0xf6e3('0xa'));var _=require(_0xf6e3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf6e3('0xc'));var deskjs=require(_0xf6e3('0xd'));var toCsv=require(_0xf6e3('0xe'));var querystring=require(_0xf6e3('0xf'));var Papa=require('papaparse');var Redis=require(_0xf6e3('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf6e3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6e3('0x12'))(_0xf6e3('0x13'));var utils=require('../../config/utils');var config=require(_0xf6e3('0x14'));var licenseUtil=require(_0xf6e3('0x15'));var db=require(_0xf6e3('0x16'))['db'];config[_0xf6e3('0x17')]=_[_0xf6e3('0x18')](config[_0xf6e3('0x17')],{'host':_0xf6e3('0x19'),'port':0x18eb});var socket=require(_0xf6e3('0x1a'))(new Redis(config[_0xf6e3('0x17')]));require(_0xf6e3('0x1b'))['register'](socket);function respondWithStatusCode(_0xf8fe99,_0x8a1bd8){_0x8a1bd8=_0x8a1bd8||0xcc;return function(_0x52db50){if(_0x52db50){return _0xf8fe99['sendStatus'](_0x8a1bd8);}return _0xf8fe99[_0xf6e3('0x1c')](_0x8a1bd8)[_0xf6e3('0x1d')]();};}function respondWithResult(_0x5bdaae,_0x291f39){_0x291f39=_0x291f39||0xc8;return function(_0x48c2ba){if(_0x48c2ba){return _0x5bdaae[_0xf6e3('0x1c')](_0x291f39)[_0xf6e3('0x1e')](_0x48c2ba);}};}function respondWithFilteredResult(_0x51e9c1,_0x56cfeb){return function(_0x416fdb){if(_0x416fdb){var _0x4f3d83=typeof _0x56cfeb[_0xf6e3('0x1f')]==='undefined'&&typeof _0x56cfeb[_0xf6e3('0x20')]===_0xf6e3('0x21');var _0x39cea7=_0x416fdb[_0xf6e3('0x22')];var _0x417826=_0x4f3d83?0x0:_0x56cfeb[_0xf6e3('0x1f')];var _0x38681c=_0x4f3d83?_0x416fdb['count']:_0x56cfeb[_0xf6e3('0x1f')]+_0x56cfeb[_0xf6e3('0x20')];var _0x686851;if(_0x38681c>=_0x39cea7){_0x38681c=_0x39cea7;_0x686851=0xc8;}else{_0x686851=0xce;}_0x51e9c1[_0xf6e3('0x1c')](_0x686851);return _0x51e9c1[_0xf6e3('0x23')](_0xf6e3('0x24'),_0x417826+'-'+_0x38681c+'/'+_0x39cea7)[_0xf6e3('0x1e')](_0x416fdb);}return null;};}function patchUpdates(_0x47efac){return function(_0x1b98f5){try{jsonpatch[_0xf6e3('0x25')](_0x1b98f5,_0x47efac,!![]);}catch(_0x10685e){return BPromise['reject'](_0x10685e);}return _0x1b98f5[_0xf6e3('0x26')]();};}function saveUpdates(_0x178e7f,_0xf83b67){return function(_0x5afe57){if(_0x5afe57){return _0x5afe57[_0xf6e3('0x27')](_0x178e7f)['then'](function(_0x6251c9){return _0x6251c9;});}return null;};}function removeEntity(_0x291a31,_0x59d2cb){return function(_0x4b992e){if(_0x4b992e){return _0x4b992e[_0xf6e3('0x28')]()[_0xf6e3('0x29')](function(){_0x291a31[_0xf6e3('0x1c')](0xcc)[_0xf6e3('0x1d')]();});}};}function handleEntityNotFound(_0x492f14,_0x18ecb5){return function(_0x49708e){if(!_0x49708e){_0x492f14[_0xf6e3('0x2a')](0x194);}return _0x49708e;};}function handleError(_0x456d4f,_0x6d7fa5){_0x6d7fa5=_0x6d7fa5||0x1f4;return function(_0x48b06e){logger[_0xf6e3('0x2b')](_0x48b06e['stack']);if(_0x48b06e[_0xf6e3('0x2c')]){delete _0x48b06e['name'];}_0x456d4f[_0xf6e3('0x1c')](_0x6d7fa5)[_0xf6e3('0x2d')](_0x48b06e);};}exports[_0xf6e3('0x2e')]=function(_0x2c54aa,_0x746bc5){var _0x27a10a={},_0x3e6c60={},_0x5ceb96={'count':0x0,'rows':[]};var _0x2648cc=_[_0xf6e3('0x2f')](db[_0xf6e3('0x30')]['rawAttributes'],function(_0x3cfb21){return{'name':_0x3cfb21['fieldName'],'type':_0x3cfb21['type']['key']};});_0x3e6c60['model']=_[_0xf6e3('0x2f')](_0x2648cc,_0xf6e3('0x2c'));_0x3e6c60[_0xf6e3('0x31')]=_[_0xf6e3('0x32')](_0x2c54aa['query']);_0x3e6c60[_0xf6e3('0x33')]=_['intersection'](_0x3e6c60[_0xf6e3('0x34')],_0x3e6c60[_0xf6e3('0x31')]);_0x27a10a['attributes']=_[_0xf6e3('0x35')](_0x3e6c60['model'],qs[_0xf6e3('0x36')](_0x2c54aa[_0xf6e3('0x31')][_0xf6e3('0x36')]));_0x27a10a[_0xf6e3('0x37')]=_0x27a10a[_0xf6e3('0x37')][_0xf6e3('0x38')]?_0x27a10a[_0xf6e3('0x37')]:_0x3e6c60[_0xf6e3('0x34')];if(!_0x2c54aa[_0xf6e3('0x31')]['hasOwnProperty'](_0xf6e3('0x39'))){_0x27a10a[_0xf6e3('0x20')]=qs[_0xf6e3('0x20')](_0x2c54aa[_0xf6e3('0x31')][_0xf6e3('0x20')]);_0x27a10a[_0xf6e3('0x1f')]=qs[_0xf6e3('0x1f')](_0x2c54aa[_0xf6e3('0x31')][_0xf6e3('0x1f')]);}_0x27a10a[_0xf6e3('0x3a')]=qs[_0xf6e3('0x3b')](_0x2c54aa[_0xf6e3('0x31')][_0xf6e3('0x3b')]);_0x27a10a[_0xf6e3('0x3c')]=qs['filters'](_[_0xf6e3('0x3d')](_0x2c54aa[_0xf6e3('0x31')],_0x3e6c60[_0xf6e3('0x33')]),_0x2648cc);if(_0x2c54aa[_0xf6e3('0x31')][_0xf6e3('0x3e')]){_0x27a10a[_0xf6e3('0x3c')]=_[_0xf6e3('0x3f')](_0x27a10a[_0xf6e3('0x3c')],{'$or':_[_0xf6e3('0x2f')](_0x2648cc,function(_0x1a197a){if(_0x1a197a[_0xf6e3('0x40')]!=='VIRTUAL'){var _0x5d9e4e={};_0x5d9e4e[_0x1a197a[_0xf6e3('0x2c')]]={'$like':'%'+_0x2c54aa['query'][_0xf6e3('0x3e')]+'%'};return _0x5d9e4e;}})});}_0x27a10a=_[_0xf6e3('0x3f')]({},_0x27a10a,_0x2c54aa[_0xf6e3('0x41')]);var _0x278b2d={'where':_0x27a10a['where']};return db[_0xf6e3('0x30')][_0xf6e3('0x22')](_0x278b2d)[_0xf6e3('0x29')](function(_0x4088d6){_0x5ceb96[_0xf6e3('0x22')]=_0x4088d6;if(_0x2c54aa[_0xf6e3('0x31')][_0xf6e3('0x42')]){_0x27a10a[_0xf6e3('0x43')]=[{'all':!![]}];}return db[_0xf6e3('0x30')]['findAll'](_0x27a10a);})['then'](function(_0x4ee02c){_0x5ceb96[_0xf6e3('0x44')]=_0x4ee02c;return _0x5ceb96;})[_0xf6e3('0x29')](respondWithFilteredResult(_0x746bc5,_0x27a10a))['catch'](handleError(_0x746bc5,null));};exports['show']=function(_0x56df03,_0x52839c){var _0x1dca2d={'raw':!![],'where':{'id':_0x56df03[_0xf6e3('0x45')]['id']}},_0x49f9cf={};_0x49f9cf[_0xf6e3('0x34')]=_[_0xf6e3('0x32')](db[_0xf6e3('0x30')][_0xf6e3('0x46')]);_0x49f9cf[_0xf6e3('0x31')]=_[_0xf6e3('0x32')](_0x56df03[_0xf6e3('0x31')]);_0x49f9cf['filters']=_[_0xf6e3('0x35')](_0x49f9cf[_0xf6e3('0x34')],_0x49f9cf[_0xf6e3('0x31')]);_0x1dca2d[_0xf6e3('0x37')]=_[_0xf6e3('0x35')](_0x49f9cf[_0xf6e3('0x34')],qs[_0xf6e3('0x36')](_0x56df03[_0xf6e3('0x31')][_0xf6e3('0x36')]));_0x1dca2d[_0xf6e3('0x37')]=_0x1dca2d['attributes'][_0xf6e3('0x38')]?_0x1dca2d['attributes']:_0x49f9cf[_0xf6e3('0x34')];if(_0x56df03[_0xf6e3('0x31')][_0xf6e3('0x42')]){_0x1dca2d[_0xf6e3('0x43')]=[{'all':!![]}];}_0x1dca2d=_[_0xf6e3('0x3f')]({},_0x1dca2d,_0x56df03['options']);return db[_0xf6e3('0x30')][_0xf6e3('0x47')](_0x1dca2d)['then'](handleEntityNotFound(_0x52839c,null))['then'](respondWithResult(_0x52839c,null))[_0xf6e3('0x48')](handleError(_0x52839c,null));};exports[_0xf6e3('0x49')]=function(_0x538111,_0x3038e8){return db[_0xf6e3('0x30')][_0xf6e3('0x49')](_0x538111[_0xf6e3('0x4a')],{})['then'](respondWithResult(_0x3038e8,0xc9))[_0xf6e3('0x48')](handleError(_0x3038e8,null));};exports[_0xf6e3('0x27')]=function(_0xbc793d,_0x35da51){if(_0xbc793d[_0xf6e3('0x4a')]['id']){delete _0xbc793d[_0xf6e3('0x4a')]['id'];}return db[_0xf6e3('0x30')][_0xf6e3('0x47')]({'where':{'id':_0xbc793d[_0xf6e3('0x45')]['id']}})[_0xf6e3('0x29')](handleEntityNotFound(_0x35da51,null))[_0xf6e3('0x29')](saveUpdates(_0xbc793d[_0xf6e3('0x4a')],null))[_0xf6e3('0x29')](respondWithResult(_0x35da51,null))['catch'](handleError(_0x35da51,null));};exports[_0xf6e3('0x28')]=function(_0xc19300,_0x9aca1c){return db[_0xf6e3('0x30')]['find']({'where':{'id':_0xc19300[_0xf6e3('0x45')]['id']}})[_0xf6e3('0x29')](handleEntityNotFound(_0x9aca1c,null))[_0xf6e3('0x29')](removeEntity(_0x9aca1c,null))[_0xf6e3('0x48')](handleError(_0x9aca1c,null));};exports[_0xf6e3('0x4b')]=function(_0x5629e7,_0x526ac3){return db[_0xf6e3('0x30')]['describe']()[_0xf6e3('0x29')](respondWithResult(_0x526ac3,null))[_0xf6e3('0x48')](handleError(_0x526ac3,null));};function wrapUser(_0xc5beac){return function(_0x4c654d){var _0x2ee5b7=_0xc5beac[_0xf6e3('0x4c')]({'plain':!![]});_0x2ee5b7['messages']=[];if(_0x4c654d){_0x2ee5b7[_0xf6e3('0x4d')]=_0x4c654d[_0xf6e3('0x4e')];_0x2ee5b7[_0xf6e3('0x4f')]=_0x4c654d;}else{_0x2ee5b7['lastMessageAt']=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2ee5b7[_0xf6e3('0x4f')]={};}return _0x2ee5b7;};}exports[_0xf6e3('0x50')]=function(_0x5678e0,_0x18a72c,_0x34a085){var _0x357169=[];return db['User'][_0xf6e3('0x51')]({'where':{'role':[_0xf6e3('0x52'),_0xf6e3('0x53'),'user']},'attributes':['id',_0xf6e3('0x54'),_0xf6e3('0x2c'),'role','userpic',_0xf6e3('0x55'),'online','lastLoginAt',_0xf6e3('0x56'),_0xf6e3('0x57')],'order':qs[_0xf6e3('0x3b')](_0xf6e3('0x58')),'include':[{'model':db[_0xf6e3('0x59')],'as':_0xf6e3('0x5a'),'attributes':['id',_0xf6e3('0x2c'),_0xf6e3('0x40')],'through':{'attributes':[]}}]})[_0xf6e3('0x29')](function(_0x257bdc){if(_0x257bdc){var _0x43351b=_0x5678e0[_0xf6e3('0x5b')]['get']({'plain':!![]});if(!_0x43351b)throw new Error(_0xf6e3('0x5c'));if(_0x43351b[_0xf6e3('0x5d')]==='user'){return db['UserProfileSection'][_0xf6e3('0x47')]({'where':{'name':_0xf6e3('0x5e'),'userProfileId':_0x43351b[_0xf6e3('0x5f')]},'raw':!![]})[_0xf6e3('0x29')](function(_0x1a2c92){if(_0x1a2c92){if(_0x1a2c92[_0xf6e3('0x60')]===0x0){return db['UserProfileResource'][_0xf6e3('0x51')]({'where':{'sectionId':_0x1a2c92['id']},'raw':!![]})['then'](function(_0x504b21){var _0x24bd6f=[];if(_[_0xf6e3('0x61')](_0x504b21)){_0x24bd6f=_[_0xf6e3('0x3e')](_0x257bdc,function(_0x70ba67){if(_0x70ba67[_0xf6e3('0x5d')]!==_0xf6e3('0x52')){return _0x70ba67;}});return _0x24bd6f;}else{for(var _0x41565a=0x0;_0x41565a<_0x257bdc['length'];_0x41565a++){var _0x18423f=_0x257bdc[_0x41565a];if(_0x18423f[_0xf6e3('0x5d')]===_0xf6e3('0x52')){var _0x22252d=_[_0xf6e3('0x47')](_0x504b21,function(_0x4b39d7){return _0x4b39d7['resourceId']===_0x18423f['id'];});if(_0x22252d)_0x24bd6f['push'](_0x18423f);}else{_0x24bd6f['push'](_0x18423f);}}return _0x24bd6f;}});}else{return _0x257bdc;}}else{var _0x101c98=_[_0xf6e3('0x3e')](_0x257bdc,function(_0x176d9f){if(_0x176d9f['role']!==_0xf6e3('0x52')){return _0x176d9f;}});return _0x101c98;}});}else{return _0x257bdc;}}})[_0xf6e3('0x29')](function(_0x5bdfbd){var _0x3c2242=[];if(_0x5bdfbd){_0x357169=_0x5bdfbd;for(var _0x4b9f8a=0x0;_0x4b9f8a<_0x5bdfbd[_0xf6e3('0x38')];_0x4b9f8a+=0x1){_0x357169[_0x4b9f8a][_0xf6e3('0x62')]=[];_0x3c2242[_0xf6e3('0x63')](db[_0xf6e3('0x30')][_0xf6e3('0x47')]({'where':{'FromId':[_0x5678e0[_0xf6e3('0x5b')]['id'],_0x5bdfbd[_0x4b9f8a]['id']],'ToId':[_0x5678e0[_0xf6e3('0x5b')]['id'],_0x5bdfbd[_0x4b9f8a]['id']],'ChatGroupId':null},'attributes':['id',_0xf6e3('0x4e'),_0xf6e3('0x64'),'ToId','read',_0xf6e3('0x4a')],'order':qs[_0xf6e3('0x3b')](_0xf6e3('0x65')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf6e3('0x29')](wrapUser(_0x5bdfbd[_0x4b9f8a])));}return BPromise['all'](_0x3c2242);}return[];})[_0xf6e3('0x29')](function(_0x1880ca){return{'rows':_0x1880ca,'count':_0x1880ca[_0xf6e3('0x38')]};})[_0xf6e3('0x29')](respondWithResult(_0x18a72c,null))[_0xf6e3('0x48')](handleError(_0x18a72c,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 3c81175..594cf3b 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 _0x2324=['emit','hasOwnProperty','hook','ChatInternalMessage','setMaxListeners','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2324,0x1c3));var _0x4232=function(_0x2214f1,_0x3b44fb){_0x2214f1=_0x2214f1-0x0;var _0x2c2597=_0x2324[_0x2214f1];return _0x2c2597;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x4232('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4232('0x1')](0x0);var events={'afterCreate':_0x4232('0x2'),'afterUpdate':'update','afterDestroy':_0x4232('0x3')};function emitEvent(_0x21188d){return function(_0x66b0f5,_0x5adc3e,_0x278bfa){ChatInternalMessageEvents['emit'](_0x21188d+':'+_0x66b0f5['id'],_0x66b0f5);ChatInternalMessageEvents[_0x4232('0x4')](_0x21188d,_0x66b0f5);_0x278bfa(null);};}for(var e in events){if(events[_0x4232('0x5')](e)){var event=events[e];ChatInternalMessage[_0x4232('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xc7ec=['../../mysqldb','save','update','remove','hasOwnProperty','exports','events'];(function(_0x31f233,_0x5ed1ab){var _0x4e0203=function(_0x4e45ae){while(--_0x4e45ae){_0x31f233['push'](_0x31f233['shift']());}};_0x4e0203(++_0x5ed1ab);}(_0xc7ec,0x164));var _0xcc7e=function(_0x122633,_0x22057b){_0x122633=_0x122633-0x0;var _0x2d02e5=_0xc7ec[_0x122633];return _0x2d02e5;};'use strict';var EventEmitter=require(_0xcc7e('0x0'));var ChatInternalMessage=require(_0xcc7e('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcc7e('0x2'),'afterUpdate':_0xcc7e('0x3'),'afterDestroy':_0xcc7e('0x4')};function emitEvent(_0x67367d){return function(_0x2a7005,_0x2420b0,_0x4168ea){ChatInternalMessageEvents['emit'](_0x67367d+':'+_0x2a7005['id'],_0x2a7005);ChatInternalMessageEvents['emit'](_0x67367d,_0x2a7005);_0x4168ea(null);};}for(var e in events){if(events[_0xcc7e('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xcc7e('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index f86252f..e1a5a42 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 _0x3bff=['ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatInternalMessage.attributes','define'];(function(_0x2c0015,_0x544386){var _0x59325b=function(_0x1f5d9e){while(--_0x1f5d9e){_0x2c0015['push'](_0x2c0015['shift']());}};_0x59325b(++_0x544386);}(_0x3bff,0x10b));var _0xf3bf=function(_0x1aa444,_0x4d6b5f){_0x1aa444=_0x1aa444-0x0;var _0xb36b20=_0x3bff[_0x1aa444];return _0xb36b20;};'use strict';var _=require(_0xf3bf('0x0'));var util=require('util');var logger=require(_0xf3bf('0x1'))(_0xf3bf('0x2'));var moment=require(_0xf3bf('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3bf('0x4'));var rimraf=require(_0xf3bf('0x5'));var config=require(_0xf3bf('0x6'));var attributes=require(_0xf3bf('0x7'));module['exports']=function(_0x234c6b,_0x20416a){return _0x234c6b[_0xf3bf('0x8')](_0xf3bf('0x9'),attributes,{'tableName':_0xf3bf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf3bf('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x12d3=['rimraf','../../config/environment','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xe6b8ed,_0x4e5b4d){var _0x39a1b7=function(_0x2aa3c9){while(--_0x2aa3c9){_0xe6b8ed['push'](_0xe6b8ed['shift']());}};_0x39a1b7(++_0x4e5b4d);}(_0x12d3,0x133));var _0x312d=function(_0x19aa6d,_0x2cb0d0){_0x19aa6d=_0x19aa6d-0x0;var _0x5f4924=_0x12d3[_0x19aa6d];return _0x5f4924;};'use strict';var _=require(_0x312d('0x0'));var util=require(_0x312d('0x1'));var logger=require(_0x312d('0x2'))(_0x312d('0x3'));var moment=require(_0x312d('0x4'));var BPromise=require(_0x312d('0x5'));var rp=require(_0x312d('0x6'));var fs=require('fs');var path=require(_0x312d('0x7'));var rimraf=require(_0x312d('0x8'));var config=require(_0x312d('0x9'));var attributes=require('./chatInternalMessage.attributes');module[_0x312d('0xa')]=function(_0x186de3,_0x3e65df){return _0x186de3[_0x312d('0xb')](_0x312d('0xc'),attributes,{'tableName':_0x312d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x312d('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index e18074a..f044903 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 _0x0ccb=['socket.io-emitter','./chatInternalMessage.socket','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x5ad2ca,_0x3fd18c){var _0x47c908=function(_0x5250c9){while(--_0x5250c9){_0x5ad2ca['push'](_0x5ad2ca['shift']());}};_0x47c908(++_0x3fd18c);}(_0x0ccb,0x77));var _0xb0cc=function(_0x5188a4,_0x41866d){_0x5188a4=_0x5188a4-0x0;var _0x218c30=_0x0ccb[_0x5188a4];return _0x218c30;};'use strict';var _=require(_0xb0cc('0x0'));var util=require(_0xb0cc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb0cc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0cc('0x3'))['db'];var utils=require(_0xb0cc('0x4'));var logger=require(_0xb0cc('0x5'))(_0xb0cc('0x6'));var config=require(_0xb0cc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb0cc('0x8')][_0xb0cc('0x9')]({'port':0x232a});config[_0xb0cc('0xa')]=_[_0xb0cc('0xb')](config[_0xb0cc('0xa')],{'host':_0xb0cc('0xc'),'port':0x18eb});var socket=require(_0xb0cc('0xd'))(new Redis(config[_0xb0cc('0xa')]));require(_0xb0cc('0xe'))['register'](socket);function respondWithRpcPromise(_0x135560,_0x49a12d,_0x1e7650){return new BPromise(function(_0x52944b,_0x2cb1f7){return client['request'](_0x135560,_0x1e7650)['then'](function(_0x3e7361){logger[_0xb0cc('0xf')](_0xb0cc('0x10'),_0x49a12d,_0xb0cc('0x11'));logger[_0xb0cc('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x49a12d,_0xb0cc('0x11'),JSON['stringify'](_0x3e7361));if(_0x3e7361[_0xb0cc('0x13')]){if(_0x3e7361['error'][_0xb0cc('0x14')]===0x1f4){logger['error'](_0xb0cc('0x10'),_0x49a12d,_0x3e7361[_0xb0cc('0x13')][_0xb0cc('0x15')]);return _0x2cb1f7(_0x3e7361[_0xb0cc('0x13')][_0xb0cc('0x15')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x49a12d,_0x3e7361[_0xb0cc('0x13')]['message']);return _0x52944b(_0x3e7361[_0xb0cc('0x13')][_0xb0cc('0x15')]);}else{logger['info'](_0xb0cc('0x10'),_0x49a12d,_0xb0cc('0x11'));_0x52944b(_0x3e7361['result'][_0xb0cc('0x15')]);}})['catch'](function(_0x2fd3d3){logger[_0xb0cc('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x49a12d,_0x2fd3d3);_0x2cb1f7(_0x2fd3d3);});});} \ No newline at end of file +var _0xce77=['stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug'];(function(_0x1580f7,_0x5580dc){var _0x147246=function(_0x5661ea){while(--_0x5661ea){_0x1580f7['push'](_0x1580f7['shift']());}};_0x147246(++_0x5580dc);}(_0xce77,0x18e));var _0x7ce7=function(_0xe12f87,_0x40f96b){_0xe12f87=_0xe12f87-0x0;var _0x2bb9f7=_0xce77[_0xe12f87];return _0x2bb9f7;};'use strict';var _=require(_0x7ce7('0x0'));var util=require(_0x7ce7('0x1'));var moment=require(_0x7ce7('0x2'));var BPromise=require(_0x7ce7('0x3'));var rs=require(_0x7ce7('0x4'));var fs=require('fs');var Redis=require(_0x7ce7('0x5'));var db=require(_0x7ce7('0x6'))['db'];var utils=require(_0x7ce7('0x7'));var logger=require(_0x7ce7('0x8'))('rpc');var config=require(_0x7ce7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7ce7('0xa')][_0x7ce7('0xb')]({'port':0x232a});config[_0x7ce7('0xc')]=_[_0x7ce7('0xd')](config['redis'],{'host':_0x7ce7('0xe'),'port':0x18eb});var socket=require(_0x7ce7('0xf'))(new Redis(config[_0x7ce7('0xc')]));require(_0x7ce7('0x10'))['register'](socket);function respondWithRpcPromise(_0x50fc7e,_0x5ed452,_0xaba8a0){return new BPromise(function(_0x2bdff8,_0x1a6511){return client[_0x7ce7('0x11')](_0x50fc7e,_0xaba8a0)[_0x7ce7('0x12')](function(_0x1e6cbb){logger[_0x7ce7('0x13')](_0x7ce7('0x14'),_0x5ed452,'request\x20sent');logger[_0x7ce7('0x15')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x5ed452,'request\x20sent',JSON[_0x7ce7('0x16')](_0x1e6cbb));if(_0x1e6cbb[_0x7ce7('0x17')]){if(_0x1e6cbb['error']['code']===0x1f4){logger[_0x7ce7('0x17')](_0x7ce7('0x14'),_0x5ed452,_0x1e6cbb[_0x7ce7('0x17')][_0x7ce7('0x18')]);return _0x1a6511(_0x1e6cbb[_0x7ce7('0x17')]['message']);}logger[_0x7ce7('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x5ed452,_0x1e6cbb[_0x7ce7('0x17')][_0x7ce7('0x18')]);return _0x2bdff8(_0x1e6cbb['error'][_0x7ce7('0x18')]);}else{logger['info'](_0x7ce7('0x14'),_0x5ed452,_0x7ce7('0x19'));_0x2bdff8(_0x1e6cbb[_0x7ce7('0x1a')][_0x7ce7('0x18')]);}})[_0x7ce7('0x1b')](function(_0x9ddb24){logger['error'](_0x7ce7('0x14'),_0x5ed452,_0x9ddb24);_0x1a6511(_0x9ddb24);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index ea21829..d4ce3ac 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 _0x1134=['remove','update','emit','removeListener','register','length','./chatInternalMessage.events','save'];(function(_0x2acbce,_0x2b48d3){var _0x1de0e0=function(_0x36ae0e){while(--_0x36ae0e){_0x2acbce['push'](_0x2acbce['shift']());}};_0x1de0e0(++_0x2b48d3);}(_0x1134,0xce));var _0x4113=function(_0x47a3db,_0x332b2d){_0x47a3db=_0x47a3db-0x0;var _0x5dd2d7=_0x1134[_0x47a3db];return _0x5dd2d7;};'use strict';var ChatInternalMessageEvents=require(_0x4113('0x0'));var events=[_0x4113('0x1'),_0x4113('0x2'),_0x4113('0x3')];function createListener(_0x2e97b3,_0x33ef56){return function(_0x255faf){_0x33ef56[_0x4113('0x4')](_0x2e97b3,_0x255faf);};}function removeListener(_0x47f056,_0x182b5e){return function(){ChatInternalMessageEvents[_0x4113('0x5')](_0x47f056,_0x182b5e);};}exports[_0x4113('0x6')]=function(_0x389b67){for(var _0x1f5b0c=0x0,_0x5d0296=events[_0x4113('0x7')];_0x1f5b0c<_0x5d0296;_0x1f5b0c++){var _0x57369f=events[_0x1f5b0c];var _0x28e56d=createListener('chatInternalMessage:'+_0x57369f,_0x389b67);ChatInternalMessageEvents['on'](_0x57369f,_0x28e56d);}}; \ No newline at end of file +var _0x0bfa=['save','remove','emit','removeListener','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bfa,0xb9));var _0xa0bf=function(_0x1f6154,_0x91c64e){_0x1f6154=_0x1f6154-0x0;var _0x8326c6=_0x0bfa[_0x1f6154];return _0x8326c6;};'use strict';var ChatInternalMessageEvents=require(_0xa0bf('0x0'));var events=[_0xa0bf('0x1'),_0xa0bf('0x2'),'update'];function createListener(_0x30c2b2,_0x24f681){return function(_0x16cb98){_0x24f681[_0xa0bf('0x3')](_0x30c2b2,_0x16cb98);};}function removeListener(_0x330258,_0x3016e3){return function(){ChatInternalMessageEvents[_0xa0bf('0x4')](_0x330258,_0x3016e3);};}exports['register']=function(_0x3d2ecf){for(var _0x5cffcf=0x0,_0x3aad94=events['length'];_0x5cffcf<_0x3aad94;_0x5cffcf++){var _0x2e3c6d=events[_0x5cffcf];var _0xe3c815=createListener(_0xa0bf('0x5')+_0x2e3c6d,_0x3d2ecf);ChatInternalMessageEvents['on'](_0x2e3c6d,_0xe3c815);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 086db6e..dde74a5 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 _0xf335=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/users','/:id','create','put','delete','destroy','exports','multer','util','connect-timeout','Router'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0xf335,0x13f));var _0x5f33=function(_0x4c56d0,_0x307147){_0x4c56d0=_0x4c56d0-0x0;var _0x4f0389=_0xf335[_0x4c56d0];return _0x4f0389;};'use strict';var multer=require(_0x5f33('0x0'));var util=require(_0x5f33('0x1'));var path=require('path');var timeout=require(_0x5f33('0x2'));var express=require('express');var router=express[_0x5f33('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5f33('0x4'));var interaction=require(_0x5f33('0x5'));var config=require(_0x5f33('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x5f33('0x7')]('/',auth['isAuthenticated'](),controller[_0x5f33('0x8')]);router['get'](_0x5f33('0x9'),auth[_0x5f33('0xa')](),controller[_0x5f33('0xb')]);router['get'](_0x5f33('0xc'),auth[_0x5f33('0xa')](),controller['getUsers']);router[_0x5f33('0x7')](_0x5f33('0xd'),auth[_0x5f33('0xa')](),controller['show']);router['post']('/',auth[_0x5f33('0xa')](),controller[_0x5f33('0xe')]);router[_0x5f33('0xf')](_0x5f33('0xd'),controller['update']);router[_0x5f33('0x10')](_0x5f33('0xd'),auth['isAuthenticated'](),controller[_0x5f33('0x11')]);module[_0x5f33('0x12')]=router; \ No newline at end of file +var _0x502d=['create','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','describe','/users','getUsers','show','post'];(function(_0x1ae111,_0x181d78){var _0x329e81=function(_0x3fc4f4){while(--_0x3fc4f4){_0x1ae111['push'](_0x1ae111['shift']());}};_0x329e81(++_0x181d78);}(_0x502d,0x1d1));var _0xd502=function(_0x4812e0,_0x2ccf3c){_0x4812e0=_0x4812e0-0x0;var _0x252e0f=_0x502d[_0x4812e0];return _0x252e0f;};'use strict';var multer=require(_0xd502('0x0'));var util=require(_0xd502('0x1'));var path=require(_0xd502('0x2'));var timeout=require('connect-timeout');var express=require(_0xd502('0x3'));var router=express[_0xd502('0x4')]();var fs_extra=require(_0xd502('0x5'));var auth=require(_0xd502('0x6'));var interaction=require(_0xd502('0x7'));var config=require('../../config/environment');var controller=require(_0xd502('0x8'));router['get']('/',auth[_0xd502('0x9')](),controller[_0xd502('0xa')]);router[_0xd502('0xb')](_0xd502('0xc'),auth[_0xd502('0x9')](),controller[_0xd502('0xd')]);router[_0xd502('0xb')](_0xd502('0xe'),auth[_0xd502('0x9')](),controller[_0xd502('0xf')]);router[_0xd502('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xd502('0x10')]);router[_0xd502('0x11')]('/',auth[_0xd502('0x9')](),controller[_0xd502('0x12')]);router['put'](_0xd502('0x13'),controller[_0xd502('0x14')]);router[_0xd502('0x15')](_0xd502('0x13'),auth[_0xd502('0x9')](),controller[_0xd502('0x16')]);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 78f1829..8e0e4af 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 _0x0fd9=['DATE','STRING','exports','TEXT','medium','BOOLEAN','out'];(function(_0xa0ab99,_0x5496c1){var _0x3bf6b5=function(_0x270d0a){while(--_0x270d0a){_0xa0ab99['push'](_0xa0ab99['shift']());}};_0x3bf6b5(++_0x5496c1);}(_0x0fd9,0xa3));var _0x90fd=function(_0x4480b9,_0x5c2949){_0x4480b9=_0x4480b9-0x0;var _0x3f0f02=_0x0fd9[_0x4480b9];return _0x3f0f02;};'use strict';var Sequelize=require('sequelize');module[_0x90fd('0x0')]={'body':{'type':Sequelize[_0x90fd('0x1')](_0x90fd('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x90fd('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x90fd('0x4')),'defaultValue':_0x90fd('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x90fd('0x5')]},'providerName':{'type':Sequelize[_0x90fd('0x6')]},'providerResponse':{'type':Sequelize[_0x90fd('0x1')]}}; \ No newline at end of file +var _0x173d=['exports','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x5efb4a,_0x39b1ec){var _0x5f31a2=function(_0x2375a7){while(--_0x2375a7){_0x5efb4a['push'](_0x5efb4a['shift']());}};_0x5f31a2(++_0x39b1ec);}(_0x173d,0x108));var _0xd173=function(_0x5e8a79,_0x10d6ae){_0x5e8a79=_0x5e8a79-0x0;var _0x4a856c=_0x173d[_0x5e8a79];return _0x4a856c;};'use strict';var Sequelize=require('sequelize');module[_0xd173('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd173('0x1')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd173('0x2')]('in',_0xd173('0x3')),'defaultValue':_0xd173('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd173('0x4')]},'providerName':{'type':Sequelize[_0xd173('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 7ddd09f..56c8188 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 _0x752e=['type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','rows','show','params','rawAttributes','length','include','find','create','body','describe','accept','acceptMessage','reject','UserId','user','agent','get','ChatInteraction','interaction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','contact','User','fullname','email','internal','motionChannel','channel','event','EventManager','rejectmessage','formData','util','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','http','client','chat-interactions','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','map','ChatMessage','fieldName'];(function(_0x153ca0,_0x144b31){var _0x5836cd=function(_0x1ef5bf){while(--_0x1ef5bf){_0x153ca0['push'](_0x153ca0['shift']());}};_0x5836cd(++_0x144b31);}(_0x752e,0xfd));var _0xe752=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x752e[_0x173441];return _0x2423a8;};'use strict';var util=require(_0xe752('0x0'));var _=require(_0xe752('0x1'));var Redis=require(_0xe752('0x2'));var interactionService=require(_0xe752('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xe752('0x4'))(_0xe752('0x5'));var config=require(_0xe752('0x6'));var db=require(_0xe752('0x7'))['db'];config[_0xe752('0x8')]=_['defaults'](config[_0xe752('0x8')],{'host':_0xe752('0x9'),'port':0x18eb});var socket=require(_0xe752('0xa'))(new Redis(config[_0xe752('0x8')]));require(_0xe752('0xb'))['register'](socket);var jayson=require(_0xe752('0xc'));var client=jayson['client'][_0xe752('0xd')]({'port':0x232c});var client9002=jayson[_0xe752('0xe')][_0xe752('0xd')]({'port':0x232a});var interaction_log=require(_0xe752('0x4'))(_0xe752('0xf'));function respondWithRpcPromise(_0x86ec46,_0x5f5a55,_0x2aeda5,_0x2a9980){return new Promise(function(_0x27d5db,_0x58bae0){var _0x5e7a9e=_0x2a9980||client;return _0x5e7a9e[_0xe752('0x10')](_0x86ec46,_0x2aeda5)[_0xe752('0x11')](function(_0x40cf64){logger[_0xe752('0x12')](_0xe752('0x13'),_0x5f5a55,_0xe752('0x14'));logger[_0xe752('0x15')](_0xe752('0x16'),_0x5f5a55,_0xe752('0x14'),JSON['stringify'](_0x40cf64));if(_0x40cf64[_0xe752('0x17')]){if(_0x40cf64['error']['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x5f5a55,_0x40cf64[_0xe752('0x17')][_0xe752('0x18')]);return _0x58bae0(_0x40cf64[_0xe752('0x17')][_0xe752('0x18')]);}logger[_0xe752('0x17')](_0xe752('0x13'),_0x5f5a55,_0x40cf64[_0xe752('0x17')][_0xe752('0x18')]);return _0x27d5db(_0x40cf64[_0xe752('0x17')][_0xe752('0x18')]);}else{logger['info'](_0xe752('0x13'),_0x5f5a55,_0xe752('0x14'));_0x27d5db(_0x40cf64['result'][_0xe752('0x18')]);}})[_0xe752('0x19')](function(_0x17b747){logger[_0xe752('0x17')](_0xe752('0x13'),_0x5f5a55,_0x17b747);_0x58bae0(_0x17b747);});});}function respondWithResult(_0x2db940,_0x3c7c60){_0x3c7c60=_0x3c7c60||0xc8;return function(_0x42bcae){if(_0x42bcae){return _0x2db940['status'](_0x3c7c60)[_0xe752('0x1a')](_0x42bcae);}};}function respondWithFilteredResult(_0x42fa3d,_0x9bcea0){return function(_0x4f696f){if(_0x4f696f){var _0x58a831=typeof _0x9bcea0[_0xe752('0x1b')]===_0xe752('0x1c')&&typeof _0x9bcea0[_0xe752('0x1d')]===_0xe752('0x1c');var _0x1357ef=_0x4f696f['count'];var _0x4ec6ab=_0x58a831?0x0:_0x9bcea0[_0xe752('0x1b')];var _0x1b4bc5=_0x58a831?_0x4f696f[_0xe752('0x1e')]:_0x9bcea0['offset']+_0x9bcea0[_0xe752('0x1d')];var _0x4171fd;if(_0x1b4bc5>=_0x1357ef){_0x1b4bc5=_0x1357ef;_0x4171fd=0xc8;}else{_0x4171fd=0xce;}_0x42fa3d[_0xe752('0x1f')](_0x4171fd);return _0x42fa3d[_0xe752('0x20')](_0xe752('0x21'),_0x4ec6ab+'-'+_0x1b4bc5+'/'+_0x1357ef)[_0xe752('0x1a')](_0x4f696f);}return null;};}function saveUpdates(_0x159ef7){return function(_0x18a4ab){if(_0x18a4ab){return _0x18a4ab[_0xe752('0x22')](_0x159ef7)[_0xe752('0x11')](function(_0x590206){return _0x590206;});}return null;};}function removeEntity(_0xd4b3e){return function(_0x43c5e4){if(_0x43c5e4){return _0x43c5e4[_0xe752('0x23')]()['then'](function(){_0xd4b3e[_0xe752('0x1f')](0xcc)[_0xe752('0x24')]();});}};}function handleEntityNotFound(_0x17c9ec){return function(_0x8ebe80){if(!_0x8ebe80){_0x17c9ec[_0xe752('0x25')](0x194);}return _0x8ebe80;};}function handleError(_0x49e517,_0x304448){_0x304448=_0x304448||0x1f4;return function(_0xcadd27){logger[_0xe752('0x17')](_0xcadd27[_0xe752('0x26')]);if(_0xcadd27[_0xe752('0x27')]){delete _0xcadd27[_0xe752('0x27')];}_0x49e517[_0xe752('0x1f')](_0x304448)[_0xe752('0x28')](_0xcadd27);};}exports['index']=function(_0x3966e0,_0x15db49){var _0x2776db={},_0x9f41bb={},_0x5be029={'count':0x0,'rows':[]};var _0x55a9e8=_[_0xe752('0x29')](db[_0xe752('0x2a')]['rawAttributes'],function(_0x4c7845){return{'name':_0x4c7845[_0xe752('0x2b')],'type':_0x4c7845[_0xe752('0x2c')]['key']};});_0x9f41bb['model']=_[_0xe752('0x29')](_0x55a9e8,_0xe752('0x27'));_0x9f41bb[_0xe752('0x2d')]=_[_0xe752('0x2e')](_0x3966e0[_0xe752('0x2d')]);_0x9f41bb[_0xe752('0x2f')]=_[_0xe752('0x30')](_0x9f41bb[_0xe752('0x31')],_0x9f41bb['query']);_0x2776db['attributes']=_[_0xe752('0x30')](_0x9f41bb['model'],qs[_0xe752('0x32')](_0x3966e0[_0xe752('0x2d')][_0xe752('0x32')]));_0x2776db['attributes']=_0x2776db[_0xe752('0x33')]['length']?_0x2776db[_0xe752('0x33')]:_0x9f41bb[_0xe752('0x31')];if(!_0x3966e0[_0xe752('0x2d')][_0xe752('0x34')](_0xe752('0x35'))){_0x2776db[_0xe752('0x1d')]=qs['limit'](_0x3966e0[_0xe752('0x2d')][_0xe752('0x1d')]);_0x2776db[_0xe752('0x1b')]=qs[_0xe752('0x1b')](_0x3966e0[_0xe752('0x2d')]['offset']);}_0x2776db[_0xe752('0x36')]=qs[_0xe752('0x37')](_0x3966e0[_0xe752('0x2d')][_0xe752('0x37')]);_0x2776db[_0xe752('0x38')]=qs[_0xe752('0x2f')](_['pick'](_0x3966e0[_0xe752('0x2d')],_0x9f41bb[_0xe752('0x2f')]),_0x55a9e8);if(_0x3966e0[_0xe752('0x2d')]['filter']){_0x2776db[_0xe752('0x38')]=_['merge'](_0x2776db[_0xe752('0x38')],{'$or':_['map'](_0x55a9e8,function(_0x59ea31){if(_0x59ea31['type']!==_0xe752('0x39')){var _0x44ded9={};_0x44ded9[_0x59ea31[_0xe752('0x27')]]={'$like':'%'+_0x3966e0[_0xe752('0x2d')][_0xe752('0x3a')]+'%'};return _0x44ded9;}})});}_0x2776db=_[_0xe752('0x3b')]({},_0x2776db,_0x3966e0[_0xe752('0x3c')]);var _0x2cfaae={'where':_0x2776db['where']};return db[_0xe752('0x2a')][_0xe752('0x1e')](_0x2cfaae)[_0xe752('0x11')](function(_0x358f94){_0x5be029[_0xe752('0x1e')]=_0x358f94;if(_0x3966e0[_0xe752('0x2d')][_0xe752('0x3d')]){_0x2776db['include']=[{'all':!![]}];}return db[_0xe752('0x2a')]['findAll'](_0x2776db);})['then'](function(_0x16a7e8){_0x5be029[_0xe752('0x3e')]=_0x16a7e8;return _0x5be029;})['then'](respondWithFilteredResult(_0x15db49,_0x2776db))[_0xe752('0x19')](handleError(_0x15db49,null));};exports[_0xe752('0x3f')]=function(_0x346a6c,_0x2f9475){var _0x5b1256={'raw':!![],'where':{'id':_0x346a6c[_0xe752('0x40')]['id']}},_0x1482ff={};_0x1482ff[_0xe752('0x31')]=_['keys'](db[_0xe752('0x2a')][_0xe752('0x41')]);_0x1482ff[_0xe752('0x2d')]=_['keys'](_0x346a6c[_0xe752('0x2d')]);_0x1482ff[_0xe752('0x2f')]=_[_0xe752('0x30')](_0x1482ff['model'],_0x1482ff[_0xe752('0x2d')]);_0x5b1256[_0xe752('0x33')]=_[_0xe752('0x30')](_0x1482ff['model'],qs['fields'](_0x346a6c[_0xe752('0x2d')]['fields']));_0x5b1256[_0xe752('0x33')]=_0x5b1256[_0xe752('0x33')][_0xe752('0x42')]?_0x5b1256['attributes']:_0x1482ff[_0xe752('0x31')];if(_0x346a6c[_0xe752('0x2d')][_0xe752('0x3d')]){_0x5b1256[_0xe752('0x43')]=[{'all':!![]}];}_0x5b1256=_[_0xe752('0x3b')]({},_0x5b1256,_0x346a6c[_0xe752('0x3c')]);return db[_0xe752('0x2a')][_0xe752('0x44')](_0x5b1256)[_0xe752('0x11')](handleEntityNotFound(_0x2f9475,null))['then'](respondWithResult(_0x2f9475,null))[_0xe752('0x19')](handleError(_0x2f9475,null));};exports['create']=function(_0x1b185d,_0x8e368c){return db[_0xe752('0x2a')][_0xe752('0x45')](_0x1b185d[_0xe752('0x46')],{})[_0xe752('0x11')](respondWithResult(_0x8e368c,0xc9))[_0xe752('0x19')](handleError(_0x8e368c,null));};exports['update']=function(_0x33ac48,_0x403653){if(_0x33ac48['body']['id']){delete _0x33ac48[_0xe752('0x46')]['id'];}return db[_0xe752('0x2a')][_0xe752('0x44')]({'where':{'id':_0x33ac48[_0xe752('0x40')]['id']}})['then'](handleEntityNotFound(_0x403653,null))['then'](saveUpdates(_0x33ac48['body'],null))['then'](respondWithResult(_0x403653,null))[_0xe752('0x19')](handleError(_0x403653,null));};exports[_0xe752('0x23')]=function(_0x581da0,_0x574dbe){return db['ChatMessage'][_0xe752('0x44')]({'where':{'id':_0x581da0[_0xe752('0x40')]['id']}})[_0xe752('0x11')](handleEntityNotFound(_0x574dbe,null))[_0xe752('0x11')](removeEntity(_0x574dbe,null))['catch'](handleError(_0x574dbe,null));};exports[_0xe752('0x47')]=function(_0x46a223,_0x9ed8dc){return db[_0xe752('0x2a')][_0xe752('0x47')]()[_0xe752('0x11')](respondWithResult(_0x9ed8dc,null))[_0xe752('0x19')](handleError(_0x9ed8dc,null));};exports[_0xe752('0x48')]=function(_0x1a192e,_0x1457b2){var _0x77b488='chat';return interactionService[_0xe752('0x49')](_0x1a192e,_0x77b488)['then'](respondWithResult(_0x1457b2,null))[_0xe752('0x19')](handleError(_0x1457b2,null));};exports[_0xe752('0x4a')]=function(_0x4309c1,_0x377b7d){var _0x567a7c={'agent':{},'channel':'chat'};if(_0x4309c1[_0xe752('0x46')]['id']){delete _0x4309c1[_0xe752('0x46')]['id'];}_0x4309c1[_0xe752('0x46')][_0xe752('0x4b')]=_0x4309c1[_0xe752('0x46')][_0xe752('0x4b')]||_0x4309c1[_0xe752('0x4c')]['id'];_0x567a7c[_0xe752('0x4d')]['id']=_0x4309c1[_0xe752('0x46')][_0xe752('0x4b')];return db['ChatMessage'][_0xe752('0x44')]({'where':{'id':_0x4309c1[_0xe752('0x40')]['id'],'UserId':null}})[_0xe752('0x11')](handleEntityNotFound(_0x377b7d,null))[_0xe752('0x11')](function(_0x443803){if(_0x443803){_0x567a7c[_0xe752('0x18')]=_0x443803[_0xe752('0x4e')]({'plain':!![]});return db[_0xe752('0x4f')][_0xe752('0x44')]({'where':{'id':_0x443803['ChatInteractionId']}});}return null;})[_0xe752('0x11')](handleEntityNotFound(_0x377b7d,null))[_0xe752('0x11')](function(_0x117603){if(_0x117603){_0x567a7c[_0xe752('0x50')]=_0x117603['get']({'plain':!![]});interaction_log[_0xe752('0x12')](_0xe752('0x51'),_0x4309c1['user']['id'],_0x4309c1['user'][_0xe752('0x27')],_0x4309c1[_0xe752('0x4c')][_0xe752('0x52')],_0x567a7c[_0xe752('0x50')]['id'],_0x4309c1[_0xe752('0x46')]?JSON[_0xe752('0x53')](_0x4309c1['body']):'null');return respondWithRpcPromise('RejectMessage',_0xe752('0x54'),_0x567a7c);}return null;})[_0xe752('0x11')](function(_0x1aa4ae){var _0x5e7d77=_0xe752('0x55')+_0x1aa4ae[_0xe752('0x18')][_0xe752('0x56')];return db['sequelize'][_0xe752('0x2d')](_0x5e7d77,{'type':db['Sequelize']['QueryTypes'][_0xe752('0x57')],'raw':!![]})[_0xe752('0x11')](function(_0x324c8d){return _0x324c8d;});})[_0xe752('0x11')](function(_0x3a5822){if(_0x3a5822){_0x567a7c[_0xe752('0x18')][_0xe752('0x58')]=_0x3a5822[0x0];if(!_0x4309c1[_0xe752('0x46')]['UserId'])return;return db[_0xe752('0x59')][_0xe752('0x44')]({'where':{'id':_0x4309c1[_0xe752('0x46')][_0xe752('0x4b')],'role':_0xe752('0x4d')},'attributes':['id','name',_0xe752('0x5a'),_0xe752('0x5b'),_0xe752('0x5c')],'raw':!![]});}return null;})[_0xe752('0x11')](function(_0x3a2790){if(!_0x3a2790)return null;_0x567a7c[_0xe752('0x18')][_0xe752('0x4d')]=_0x3a2790;return _0x567a7c;})[_0xe752('0x11')](function(_0x3e7973){if(_0x3e7973){_0x3e7973[_0xe752('0x18')]['interface']=util['format']('SIP/%s',_0x4309c1[_0xe752('0x4c')][_0xe752('0x27')]);_0x3e7973[_0xe752('0x18')]['channel']=_0x567a7c['channel'];_0x3e7973[_0xe752('0x18')][_0xe752('0x5d')]=_0x567a7c[_0xe752('0x5e')];_0x3e7973['message'][_0xe752('0x5f')]='reject';respondWithRpcPromise(_0xe752('0x60'),'EventManager',{'event':_0xe752('0x61'),'message':_[_0xe752('0x3b')](_0x567a7c[_0xe752('0x18')],JSON['parse'](_0x567a7c['interaction'][_0xe752('0x62')]))},client9002);return _0x567a7c;}return null;})[_0xe752('0x11')](respondWithResult(_0x377b7d,null))[_0xe752('0x19')](handleError(_0x377b7d,null));}; \ No newline at end of file +var _0xa236=['ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatMessage,\x20%s,\x20%s','message','catch','status','offset','undefined','limit','count','set','Content-Range','destroy','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','show','params','keys','includeAll','create','body','update','find','describe','accept','chat','acceptMessage','agent','UserId','get','ChatInteraction','interaction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','internal','interface','format','SIP/%s','motionChannel','reject','EventManager','parse','formData','util','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','chat-interactions','request','then','info','debug'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0xa236,0x1e4));var _0x6a23=function(_0x5c6061,_0x5bb492){_0x5c6061=_0x5c6061-0x0;var _0x396143=_0xa236[_0x5c6061];return _0x396143;};'use strict';var util=require(_0x6a23('0x0'));var _=require(_0x6a23('0x1'));var Redis=require('ioredis');var interactionService=require(_0x6a23('0x2'));var qs=require(_0x6a23('0x3'));var logger=require(_0x6a23('0x4'))(_0x6a23('0x5'));var config=require(_0x6a23('0x6'));var db=require('../../mysqldb')['db'];config[_0x6a23('0x7')]=_[_0x6a23('0x8')](config[_0x6a23('0x7')],{'host':_0x6a23('0x9'),'port':0x18eb});var socket=require(_0x6a23('0xa'))(new Redis(config[_0x6a23('0x7')]));require(_0x6a23('0xb'))[_0x6a23('0xc')](socket);var jayson=require(_0x6a23('0xd'));var client=jayson[_0x6a23('0xe')][_0x6a23('0xf')]({'port':0x232c});var client9002=jayson[_0x6a23('0xe')][_0x6a23('0xf')]({'port':0x232a});var interaction_log=require(_0x6a23('0x4'))(_0x6a23('0x10'));function respondWithRpcPromise(_0xf30835,_0x6f10d1,_0x16d619,_0x2cdbc5){return new Promise(function(_0x129770,_0x2550c7){var _0x7be8ef=_0x2cdbc5||client;return _0x7be8ef[_0x6a23('0x11')](_0xf30835,_0x16d619)[_0x6a23('0x12')](function(_0x460c19){logger[_0x6a23('0x13')]('ChatMessage,\x20%s,\x20%s',_0x6f10d1,'request\x20sent');logger[_0x6a23('0x14')](_0x6a23('0x15'),_0x6f10d1,_0x6a23('0x16'),JSON['stringify'](_0x460c19));if(_0x460c19['error']){if(_0x460c19[_0x6a23('0x17')][_0x6a23('0x18')]===0x1f4){logger['error'](_0x6a23('0x19'),_0x6f10d1,_0x460c19['error'][_0x6a23('0x1a')]);return _0x2550c7(_0x460c19['error'][_0x6a23('0x1a')]);}logger[_0x6a23('0x17')](_0x6a23('0x19'),_0x6f10d1,_0x460c19[_0x6a23('0x17')]['message']);return _0x129770(_0x460c19['error']['message']);}else{logger['info'](_0x6a23('0x19'),_0x6f10d1,_0x6a23('0x16'));_0x129770(_0x460c19['result'][_0x6a23('0x1a')]);}})[_0x6a23('0x1b')](function(_0x1bd598){logger[_0x6a23('0x17')](_0x6a23('0x19'),_0x6f10d1,_0x1bd598);_0x2550c7(_0x1bd598);});});}function respondWithResult(_0x47a754,_0x2b90bf){_0x2b90bf=_0x2b90bf||0xc8;return function(_0x3c1332){if(_0x3c1332){return _0x47a754[_0x6a23('0x1c')](_0x2b90bf)['json'](_0x3c1332);}};}function respondWithFilteredResult(_0x4d0331,_0x2fccf3){return function(_0x37f403){if(_0x37f403){var _0x317f7e=typeof _0x2fccf3[_0x6a23('0x1d')]===_0x6a23('0x1e')&&typeof _0x2fccf3[_0x6a23('0x1f')]===_0x6a23('0x1e');var _0x48de6f=_0x37f403[_0x6a23('0x20')];var _0x128418=_0x317f7e?0x0:_0x2fccf3[_0x6a23('0x1d')];var _0x4cdcd7=_0x317f7e?_0x37f403['count']:_0x2fccf3['offset']+_0x2fccf3[_0x6a23('0x1f')];var _0x38ebd8;if(_0x4cdcd7>=_0x48de6f){_0x4cdcd7=_0x48de6f;_0x38ebd8=0xc8;}else{_0x38ebd8=0xce;}_0x4d0331[_0x6a23('0x1c')](_0x38ebd8);return _0x4d0331[_0x6a23('0x21')](_0x6a23('0x22'),_0x128418+'-'+_0x4cdcd7+'/'+_0x48de6f)['json'](_0x37f403);}return null;};}function saveUpdates(_0x5ab977){return function(_0x23a4f4){if(_0x23a4f4){return _0x23a4f4['update'](_0x5ab977)['then'](function(_0x2d9ab1){return _0x2d9ab1;});}return null;};}function removeEntity(_0x2dadc9){return function(_0x176853){if(_0x176853){return _0x176853[_0x6a23('0x23')]()[_0x6a23('0x12')](function(){_0x2dadc9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xef6300){return function(_0x1d6446){if(!_0x1d6446){_0xef6300['sendStatus'](0x194);}return _0x1d6446;};}function handleError(_0x212646,_0x45b81d){_0x45b81d=_0x45b81d||0x1f4;return function(_0x3f2735){logger[_0x6a23('0x17')](_0x3f2735['stack']);if(_0x3f2735[_0x6a23('0x24')]){delete _0x3f2735[_0x6a23('0x24')];}_0x212646['status'](_0x45b81d)[_0x6a23('0x25')](_0x3f2735);};}exports[_0x6a23('0x26')]=function(_0x4656f1,_0x48ffcb){var _0x1a3c12={},_0x2bcecd={},_0x50c71d={'count':0x0,'rows':[]};var _0x527cef=_[_0x6a23('0x27')](db[_0x6a23('0x28')][_0x6a23('0x29')],function(_0x58bef6){return{'name':_0x58bef6[_0x6a23('0x2a')],'type':_0x58bef6[_0x6a23('0x2b')][_0x6a23('0x2c')]};});_0x2bcecd[_0x6a23('0x2d')]=_['map'](_0x527cef,_0x6a23('0x24'));_0x2bcecd[_0x6a23('0x2e')]=_['keys'](_0x4656f1[_0x6a23('0x2e')]);_0x2bcecd[_0x6a23('0x2f')]=_['intersection'](_0x2bcecd['model'],_0x2bcecd[_0x6a23('0x2e')]);_0x1a3c12[_0x6a23('0x30')]=_[_0x6a23('0x31')](_0x2bcecd['model'],qs[_0x6a23('0x32')](_0x4656f1[_0x6a23('0x2e')][_0x6a23('0x32')]));_0x1a3c12[_0x6a23('0x30')]=_0x1a3c12[_0x6a23('0x30')][_0x6a23('0x33')]?_0x1a3c12[_0x6a23('0x30')]:_0x2bcecd[_0x6a23('0x2d')];if(!_0x4656f1[_0x6a23('0x2e')][_0x6a23('0x34')](_0x6a23('0x35'))){_0x1a3c12['limit']=qs[_0x6a23('0x1f')](_0x4656f1[_0x6a23('0x2e')][_0x6a23('0x1f')]);_0x1a3c12[_0x6a23('0x1d')]=qs[_0x6a23('0x1d')](_0x4656f1['query'][_0x6a23('0x1d')]);}_0x1a3c12['order']=qs['sort'](_0x4656f1[_0x6a23('0x2e')][_0x6a23('0x36')]);_0x1a3c12[_0x6a23('0x37')]=qs[_0x6a23('0x2f')](_[_0x6a23('0x38')](_0x4656f1[_0x6a23('0x2e')],_0x2bcecd[_0x6a23('0x2f')]),_0x527cef);if(_0x4656f1[_0x6a23('0x2e')][_0x6a23('0x39')]){_0x1a3c12[_0x6a23('0x37')]=_['merge'](_0x1a3c12[_0x6a23('0x37')],{'$or':_[_0x6a23('0x27')](_0x527cef,function(_0x4ccfff){if(_0x4ccfff[_0x6a23('0x2b')]!==_0x6a23('0x3a')){var _0x274bf6={};_0x274bf6[_0x4ccfff[_0x6a23('0x24')]]={'$like':'%'+_0x4656f1[_0x6a23('0x2e')][_0x6a23('0x39')]+'%'};return _0x274bf6;}})});}_0x1a3c12=_[_0x6a23('0x3b')]({},_0x1a3c12,_0x4656f1[_0x6a23('0x3c')]);var _0x57c68c={'where':_0x1a3c12[_0x6a23('0x37')]};return db[_0x6a23('0x28')][_0x6a23('0x20')](_0x57c68c)[_0x6a23('0x12')](function(_0x16e42f){_0x50c71d['count']=_0x16e42f;if(_0x4656f1[_0x6a23('0x2e')]['includeAll']){_0x1a3c12[_0x6a23('0x3d')]=[{'all':!![]}];}return db[_0x6a23('0x28')]['findAll'](_0x1a3c12);})[_0x6a23('0x12')](function(_0x2ff62f){_0x50c71d[_0x6a23('0x3e')]=_0x2ff62f;return _0x50c71d;})['then'](respondWithFilteredResult(_0x48ffcb,_0x1a3c12))[_0x6a23('0x1b')](handleError(_0x48ffcb,null));};exports[_0x6a23('0x3f')]=function(_0x22dfc5,_0x4acd1e){var _0xc0304={'raw':!![],'where':{'id':_0x22dfc5[_0x6a23('0x40')]['id']}},_0x82a9d1={};_0x82a9d1[_0x6a23('0x2d')]=_['keys'](db[_0x6a23('0x28')][_0x6a23('0x29')]);_0x82a9d1[_0x6a23('0x2e')]=_[_0x6a23('0x41')](_0x22dfc5['query']);_0x82a9d1[_0x6a23('0x2f')]=_[_0x6a23('0x31')](_0x82a9d1[_0x6a23('0x2d')],_0x82a9d1[_0x6a23('0x2e')]);_0xc0304['attributes']=_[_0x6a23('0x31')](_0x82a9d1[_0x6a23('0x2d')],qs[_0x6a23('0x32')](_0x22dfc5[_0x6a23('0x2e')][_0x6a23('0x32')]));_0xc0304['attributes']=_0xc0304['attributes'][_0x6a23('0x33')]?_0xc0304[_0x6a23('0x30')]:_0x82a9d1[_0x6a23('0x2d')];if(_0x22dfc5[_0x6a23('0x2e')][_0x6a23('0x42')]){_0xc0304['include']=[{'all':!![]}];}_0xc0304=_[_0x6a23('0x3b')]({},_0xc0304,_0x22dfc5[_0x6a23('0x3c')]);return db[_0x6a23('0x28')]['find'](_0xc0304)['then'](handleEntityNotFound(_0x4acd1e,null))[_0x6a23('0x12')](respondWithResult(_0x4acd1e,null))[_0x6a23('0x1b')](handleError(_0x4acd1e,null));};exports[_0x6a23('0x43')]=function(_0x1290a8,_0x538eea){return db[_0x6a23('0x28')][_0x6a23('0x43')](_0x1290a8[_0x6a23('0x44')],{})['then'](respondWithResult(_0x538eea,0xc9))[_0x6a23('0x1b')](handleError(_0x538eea,null));};exports[_0x6a23('0x45')]=function(_0x58781f,_0x1ac2ed){if(_0x58781f['body']['id']){delete _0x58781f['body']['id'];}return db['ChatMessage'][_0x6a23('0x46')]({'where':{'id':_0x58781f['params']['id']}})[_0x6a23('0x12')](handleEntityNotFound(_0x1ac2ed,null))['then'](saveUpdates(_0x58781f['body'],null))[_0x6a23('0x12')](respondWithResult(_0x1ac2ed,null))[_0x6a23('0x1b')](handleError(_0x1ac2ed,null));};exports[_0x6a23('0x23')]=function(_0x40bdce,_0x448910){return db[_0x6a23('0x28')]['find']({'where':{'id':_0x40bdce[_0x6a23('0x40')]['id']}})[_0x6a23('0x12')](handleEntityNotFound(_0x448910,null))[_0x6a23('0x12')](removeEntity(_0x448910,null))['catch'](handleError(_0x448910,null));};exports[_0x6a23('0x47')]=function(_0x13e574,_0x8dbadc){return db['ChatMessage'][_0x6a23('0x47')]()[_0x6a23('0x12')](respondWithResult(_0x8dbadc,null))[_0x6a23('0x1b')](handleError(_0x8dbadc,null));};exports[_0x6a23('0x48')]=function(_0x480dae,_0x5b5bbc){var _0x1aa4e6=_0x6a23('0x49');return interactionService[_0x6a23('0x4a')](_0x480dae,_0x1aa4e6)[_0x6a23('0x12')](respondWithResult(_0x5b5bbc,null))[_0x6a23('0x1b')](handleError(_0x5b5bbc,null));};exports['reject']=function(_0x1f97a2,_0x503099){var _0x305222={'agent':{},'channel':_0x6a23('0x49')};if(_0x1f97a2[_0x6a23('0x44')]['id']){delete _0x1f97a2['body']['id'];}_0x1f97a2['body']['UserId']=_0x1f97a2['body']['UserId']||_0x1f97a2['user']['id'];_0x305222[_0x6a23('0x4b')]['id']=_0x1f97a2['body'][_0x6a23('0x4c')];return db[_0x6a23('0x28')][_0x6a23('0x46')]({'where':{'id':_0x1f97a2[_0x6a23('0x40')]['id'],'UserId':null}})[_0x6a23('0x12')](handleEntityNotFound(_0x503099,null))[_0x6a23('0x12')](function(_0x4845e0){if(_0x4845e0){_0x305222[_0x6a23('0x1a')]=_0x4845e0[_0x6a23('0x4d')]({'plain':!![]});return db[_0x6a23('0x4e')][_0x6a23('0x46')]({'where':{'id':_0x4845e0['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x503099,null))[_0x6a23('0x12')](function(_0x4b8f2a){if(_0x4b8f2a){_0x305222[_0x6a23('0x4f')]=_0x4b8f2a[_0x6a23('0x4d')]({'plain':!![]});interaction_log[_0x6a23('0x13')](_0x6a23('0x50'),_0x1f97a2[_0x6a23('0x51')]['id'],_0x1f97a2['user'][_0x6a23('0x24')],_0x1f97a2[_0x6a23('0x51')][_0x6a23('0x52')],_0x305222[_0x6a23('0x4f')]['id'],_0x1f97a2['body']?JSON[_0x6a23('0x53')](_0x1f97a2['body']):_0x6a23('0x54'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x305222);}return null;})[_0x6a23('0x12')](function(_0x46b322){var _0x1671ad=_0x6a23('0x55')+_0x46b322['message'][_0x6a23('0x56')];return db['sequelize'][_0x6a23('0x2e')](_0x1671ad,{'type':db[_0x6a23('0x57')]['QueryTypes'][_0x6a23('0x58')],'raw':!![]})[_0x6a23('0x12')](function(_0x1dc9af){return _0x1dc9af;});})[_0x6a23('0x12')](function(_0x1b9b67){if(_0x1b9b67){_0x305222[_0x6a23('0x1a')][_0x6a23('0x59')]=_0x1b9b67[0x0];if(!_0x1f97a2[_0x6a23('0x44')][_0x6a23('0x4c')])return;return db[_0x6a23('0x5a')][_0x6a23('0x46')]({'where':{'id':_0x1f97a2['body'][_0x6a23('0x4c')],'role':_0x6a23('0x4b')},'attributes':['id',_0x6a23('0x24'),_0x6a23('0x5b'),'email',_0x6a23('0x5c')],'raw':!![]});}return null;})[_0x6a23('0x12')](function(_0x8a088c){if(!_0x8a088c)return null;_0x305222[_0x6a23('0x1a')]['agent']=_0x8a088c;return _0x305222;})[_0x6a23('0x12')](function(_0x3f892f){if(_0x3f892f){_0x3f892f[_0x6a23('0x1a')][_0x6a23('0x5d')]=util[_0x6a23('0x5e')](_0x6a23('0x5f'),_0x1f97a2[_0x6a23('0x51')][_0x6a23('0x24')]);_0x3f892f[_0x6a23('0x1a')]['channel']=_0x305222['channel'];_0x3f892f[_0x6a23('0x1a')][_0x6a23('0x60')]=_0x305222['channel'];_0x3f892f[_0x6a23('0x1a')]['event']=_0x6a23('0x61');respondWithRpcPromise(_0x6a23('0x62'),_0x6a23('0x62'),{'event':'rejectmessage','message':_[_0x6a23('0x3b')](_0x305222[_0x6a23('0x1a')],JSON[_0x6a23('0x63')](_0x305222[_0x6a23('0x4f')][_0x6a23('0x64')]))},client9002);return _0x305222;}return null;})[_0x6a23('0x12')](respondWithResult(_0x503099,null))[_0x6a23('0x1b')](handleError(_0x503099,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index cbef62c..6b055b1 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 _0x565a=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3d34da,_0x3abcc1){var _0xcf6af8=function(_0x300a53){while(--_0x300a53){_0x3d34da['push'](_0x3d34da['shift']());}};_0xcf6af8(++_0x3abcc1);}(_0x565a,0x1d6));var _0xa565=function(_0x520b60,_0x29f32f){_0x520b60=_0x520b60-0x0;var _0x172d1f=_0x565a[_0x520b60];return _0x172d1f;};'use strict';var EventEmitter=require(_0xa565('0x0'));var ChatMessage=require(_0xa565('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa565('0x2')](0x0);var events={'afterCreate':_0xa565('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2ce015){return function(_0x789e4e,_0xeefbc1,_0x434a5f){ChatMessageEvents[_0xa565('0x4')](_0x2ce015+':'+_0x789e4e['id'],_0x789e4e);ChatMessageEvents[_0xa565('0x4')](_0x2ce015,_0x789e4e);_0x434a5f(null);};}for(var e in events){if(events[_0xa565('0x5')](e)){var event=events[e];ChatMessage[_0xa565('0x6')](e,emitEvent(event));}}module[_0xa565('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x20ad=['emit','hook','exports','events','ChatMessage','setMaxListeners','save','update'];(function(_0x31e7dd,_0xd5691d){var _0x16062f=function(_0x11625e){while(--_0x11625e){_0x31e7dd['push'](_0x31e7dd['shift']());}};_0x16062f(++_0xd5691d);}(_0x20ad,0x1db));var _0xd20a=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x20ad[_0x20c9b2];return _0x2c6030;};'use strict';var EventEmitter=require(_0xd20a('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xd20a('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd20a('0x2')](0x0);var events={'afterCreate':_0xd20a('0x3'),'afterUpdate':_0xd20a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x141cf5){return function(_0x2ce50b,_0x4c7df4,_0x2206eb){ChatMessageEvents[_0xd20a('0x5')](_0x141cf5+':'+_0x2ce50b['id'],_0x2ce50b);ChatMessageEvents[_0xd20a('0x5')](_0x141cf5,_0x2ce50b);_0x2206eb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xd20a('0x6')](e,emitEvent(event));}}module[_0xd20a('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index c4a3390..000d5a5 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 _0x2960=['chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage'];(function(_0x531b74,_0x3a473b){var _0x513d17=function(_0x2ea644){while(--_0x2ea644){_0x531b74['push'](_0x531b74['shift']());}};_0x513d17(++_0x3a473b);}(_0x2960,0x71));var _0x0296=function(_0x264e1e,_0x3af804){_0x264e1e=_0x264e1e-0x0;var _0x4b1840=_0x2960[_0x264e1e];return _0x4b1840;};'use strict';var _=require(_0x0296('0x0'));var util=require(_0x0296('0x1'));var logger=require(_0x0296('0x2'))(_0x0296('0x3'));var moment=require('moment');var BPromise=require(_0x0296('0x4'));var rp=require(_0x0296('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0296('0x6'));var config=require(_0x0296('0x7'));var attributes=require(_0x0296('0x8'));module['exports']=function(_0x299dac,_0x3d4085){return _0x299dac[_0x0296('0x9')](_0x0296('0xa'),attributes,{'tableName':_0x0296('0xb'),'paranoid':![],'indexes':[{'name':_0x0296('0xc'),'fields':[_0x0296('0xd')],'type':_0x0296('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x254b59,_0x3931f8,_0x15bc6b){var _0x5208e5=_0x299dac[_0x0296('0xf')];var _0x359dc4=_0x254b59[_0x0296('0x10')]({'plain':!![]});if(_0x359dc4[_0x0296('0x11')]['toLowerCase']()==='in'||_0x359dc4[_0x0296('0x11')][_0x0296('0x12')]()===_0x0296('0x13')&&!_0x359dc4[_0x0296('0x14')]&&!_[_0x0296('0x15')](_0x359dc4['UserId'])){_0x5208e5[_0x0296('0x16')]['findOne']({'where':{'id':_0x359dc4[_0x0296('0x17')]}})[_0x0296('0x18')](function(_0xde7543){if(_0xde7543){_0xde7543[_0x0296('0x19')]({'lastMsgAt':_0x359dc4[_0x0296('0x1a')],'lastMsgDirection':_0x359dc4[_0x0296('0x11')]['toLowerCase']()});}})[_0x0296('0x1b')](function(_0x3551f9){console[_0x0296('0x1c')](_0x3551f9);});}_0x15bc6b();}},'charset':_0x0296('0x1d'),'collate':_0x0296('0x1e')});}; \ No newline at end of file +var _0x4a25=['exports','ChatMessage','chat_messages','fti_chat_messages','get','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x4a25,0x1d4));var _0x54a2=function(_0x2353fe,_0x4b0bca){_0x2353fe=_0x2353fe-0x0;var _0x4d43f6=_0x4a25[_0x2353fe];return _0x4d43f6;};'use strict';var _=require(_0x54a2('0x0'));var util=require('util');var logger=require(_0x54a2('0x1'))('api');var moment=require(_0x54a2('0x2'));var BPromise=require(_0x54a2('0x3'));var rp=require(_0x54a2('0x4'));var fs=require('fs');var path=require(_0x54a2('0x5'));var rimraf=require('rimraf');var config=require(_0x54a2('0x6'));var attributes=require(_0x54a2('0x7'));module[_0x54a2('0x8')]=function(_0x3ecde5,_0x472eed){return _0x3ecde5['define'](_0x54a2('0x9'),attributes,{'tableName':_0x54a2('0xa'),'paranoid':![],'indexes':[{'name':_0x54a2('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d0334,_0x5db8dc,_0x466c88){var _0x28655c=_0x3ecde5['models'];var _0x38a9f5=_0x3d0334[_0x54a2('0xc')]({'plain':!![]});if(_0x38a9f5['direction'][_0x54a2('0xd')]()==='in'||_0x38a9f5[_0x54a2('0xe')]['toLowerCase']()===_0x54a2('0xf')&&!_0x38a9f5[_0x54a2('0x10')]&&!_[_0x54a2('0x11')](_0x38a9f5[_0x54a2('0x12')])){_0x28655c[_0x54a2('0x13')][_0x54a2('0x14')]({'where':{'id':_0x38a9f5[_0x54a2('0x15')]}})[_0x54a2('0x16')](function(_0x5e5786){if(_0x5e5786){_0x5e5786[_0x54a2('0x17')]({'lastMsgAt':_0x38a9f5['createdAt'],'lastMsgDirection':_0x38a9f5[_0x54a2('0xe')][_0x54a2('0xd')]()});}})[_0x54a2('0x18')](function(_0x1fcc41){console[_0x54a2('0x19')](_0x1fcc41);});}_0x466c88();}},'charset':_0x54a2('0x1a'),'collate':_0x54a2('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index d83a481..604952a 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 _0x26e4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateChatMessage','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x7e2b04,_0xcdb260){var _0x396645=function(_0xc0507f){while(--_0xc0507f){_0x7e2b04['push'](_0x7e2b04['shift']());}};_0x396645(++_0xcdb260);}(_0x26e4,0xe1));var _0x426e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x26e4[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x426e('0x0'));var util=require('util');var moment=require(_0x426e('0x1'));var BPromise=require(_0x426e('0x2'));var rs=require(_0x426e('0x3'));var fs=require('fs');var Redis=require(_0x426e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x426e('0x5'));var logger=require(_0x426e('0x6'))(_0x426e('0x7'));var config=require(_0x426e('0x8'));var jayson=require(_0x426e('0x9'));var client=jayson[_0x426e('0xa')][_0x426e('0xb')]({'port':0x232a});config[_0x426e('0xc')]=_[_0x426e('0xd')](config[_0x426e('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x426e('0xe'))[_0x426e('0xf')](socket);function respondWithRpcPromise(_0xa1bffd,_0x218bed,_0x4fc6c7){return new BPromise(function(_0xde24ff,_0x37350c){return client[_0x426e('0x10')](_0xa1bffd,_0x4fc6c7)[_0x426e('0x11')](function(_0x458af8){logger['info'](_0x426e('0x12'),_0x218bed,_0x426e('0x13'));logger[_0x426e('0x14')](_0x426e('0x15'),_0x218bed,_0x426e('0x13'),JSON['stringify'](_0x458af8));if(_0x458af8[_0x426e('0x16')]){if(_0x458af8['error'][_0x426e('0x17')]===0x1f4){logger[_0x426e('0x16')]('ChatMessage,\x20%s,\x20%s',_0x218bed,_0x458af8[_0x426e('0x16')][_0x426e('0x18')]);return _0x37350c(_0x458af8['error']['message']);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x218bed,_0x458af8[_0x426e('0x16')][_0x426e('0x18')]);return _0xde24ff(_0x458af8[_0x426e('0x16')][_0x426e('0x18')]);}else{logger[_0x426e('0x19')](_0x426e('0x12'),_0x218bed,_0x426e('0x13'));_0xde24ff(_0x458af8[_0x426e('0x1a')][_0x426e('0x18')]);}})[_0x426e('0x1b')](function(_0x39322d){logger[_0x426e('0x16')](_0x426e('0x12'),_0x218bed,_0x39322d);_0x37350c(_0x39322d);});});}exports[_0x426e('0x1c')]=function(_0x486701){var _0x119cb8=this;return new Promise(function(_0x11a096,_0x23b031){return db['ChatMessage'][_0x426e('0x1d')](_0x486701[_0x426e('0x1e')],{'raw':_0x486701[_0x426e('0x1f')]?_0x486701[_0x426e('0x1f')][_0x426e('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x51cff4){logger[_0x426e('0x19')]('CreateChatMessage',_0x486701);logger['debug'](_0x426e('0x1c'),_0x486701,JSON['stringify'](_0x51cff4));_0x11a096(_0x51cff4);})[_0x426e('0x1b')](function(_0x218024){logger[_0x426e('0x16')](_0x426e('0x1c'),_0x218024[_0x426e('0x18')],_0x486701);_0x23b031(_0x119cb8[_0x426e('0x16')](0x1f4,_0x218024[_0x426e('0x18')]));});});}; \ No newline at end of file +var _0xe982=['body','options','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','create'];(function(_0x34d546,_0x16f762){var _0x20fd3e=function(_0x1b07f6){while(--_0x1b07f6){_0x34d546['push'](_0x34d546['shift']());}};_0x20fd3e(++_0x16f762);}(_0xe982,0x112));var _0x2e98=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe982[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x2e98('0x0'));var util=require(_0x2e98('0x1'));var moment=require(_0x2e98('0x2'));var BPromise=require('bluebird');var rs=require(_0x2e98('0x3'));var fs=require('fs');var Redis=require(_0x2e98('0x4'));var db=require(_0x2e98('0x5'))['db'];var utils=require(_0x2e98('0x6'));var logger=require(_0x2e98('0x7'))(_0x2e98('0x8'));var config=require(_0x2e98('0x9'));var jayson=require(_0x2e98('0xa'));var client=jayson['client'][_0x2e98('0xb')]({'port':0x232a});config['redis']=_[_0x2e98('0xc')](config[_0x2e98('0xd')],{'host':_0x2e98('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2e98('0xd')]));require(_0x2e98('0xf'))[_0x2e98('0x10')](socket);function respondWithRpcPromise(_0x1ad07d,_0x40bc15,_0x33c268){return new BPromise(function(_0xf73a03,_0x5250fc){return client[_0x2e98('0x11')](_0x1ad07d,_0x33c268)[_0x2e98('0x12')](function(_0x33e246){logger[_0x2e98('0x13')](_0x2e98('0x14'),_0x40bc15,_0x2e98('0x15'));logger[_0x2e98('0x16')](_0x2e98('0x17'),_0x40bc15,'request\x20sent',JSON[_0x2e98('0x18')](_0x33e246));if(_0x33e246[_0x2e98('0x19')]){if(_0x33e246['error'][_0x2e98('0x1a')]===0x1f4){logger['error'](_0x2e98('0x14'),_0x40bc15,_0x33e246[_0x2e98('0x19')][_0x2e98('0x1b')]);return _0x5250fc(_0x33e246[_0x2e98('0x19')][_0x2e98('0x1b')]);}logger[_0x2e98('0x19')]('ChatMessage,\x20%s,\x20%s',_0x40bc15,_0x33e246[_0x2e98('0x19')]['message']);return _0xf73a03(_0x33e246[_0x2e98('0x19')][_0x2e98('0x1b')]);}else{logger['info'](_0x2e98('0x14'),_0x40bc15,_0x2e98('0x15'));_0xf73a03(_0x33e246[_0x2e98('0x1c')][_0x2e98('0x1b')]);}})[_0x2e98('0x1d')](function(_0x180bae){logger['error'](_0x2e98('0x14'),_0x40bc15,_0x180bae);_0x5250fc(_0x180bae);});});}exports[_0x2e98('0x1e')]=function(_0x27f118){var _0x1d1ca9=this;return new Promise(function(_0x23f2b1,_0x55c4a0){return db['ChatMessage'][_0x2e98('0x1f')](_0x27f118[_0x2e98('0x20')],{'raw':_0x27f118['options']?_0x27f118[_0x2e98('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x2e98('0x12')](function(_0x352132){logger['info']('CreateChatMessage',_0x27f118);logger[_0x2e98('0x16')]('CreateChatMessage',_0x27f118,JSON['stringify'](_0x352132));_0x23f2b1(_0x352132);})[_0x2e98('0x1d')](function(_0x231f71){logger[_0x2e98('0x19')](_0x2e98('0x1e'),_0x231f71[_0x2e98('0x1b')],_0x27f118);_0x55c4a0(_0x1d1ca9[_0x2e98('0x19')](0x1f4,_0x231f71[_0x2e98('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 433b0b3..36587fa 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 _0x91c6=['removeListener','register','chatMessage:','./chatMessage.events','update','emit'];(function(_0xb39133,_0x5df74d){var _0xdbb390=function(_0x1c99f1){while(--_0x1c99f1){_0xb39133['push'](_0xb39133['shift']());}};_0xdbb390(++_0x5df74d);}(_0x91c6,0xf9));var _0x691c=function(_0x1ba470,_0x60aae0){_0x1ba470=_0x1ba470-0x0;var _0x20cdef=_0x91c6[_0x1ba470];return _0x20cdef;};'use strict';var ChatMessageEvents=require(_0x691c('0x0'));var events=['save','remove',_0x691c('0x1')];function createListener(_0x20c69c,_0xafe4d5){return function(_0xa59a0a){_0xafe4d5[_0x691c('0x2')](_0x20c69c,_0xa59a0a);};}function removeListener(_0x4944ce,_0xa14528){return function(){ChatMessageEvents[_0x691c('0x3')](_0x4944ce,_0xa14528);};}exports[_0x691c('0x4')]=function(_0x1b2e82){for(var _0x3dddf8=0x0,_0x29876a=events['length'];_0x3dddf8<_0x29876a;_0x3dddf8++){var _0x93b7b0=events[_0x3dddf8];var _0x40629a=createListener(_0x691c('0x5')+_0x93b7b0,_0x1b2e82);ChatMessageEvents['on'](_0x93b7b0,_0x40629a);}}; \ No newline at end of file +var _0xc492=['./chatMessage.events','save','remove','register','chatMessage:'];(function(_0x47ce74,_0x57a458){var _0x419f44=function(_0x254607){while(--_0x254607){_0x47ce74['push'](_0x47ce74['shift']());}};_0x419f44(++_0x57a458);}(_0xc492,0xd7));var _0x2c49=function(_0x5d2a6b,_0x20810e){_0x5d2a6b=_0x5d2a6b-0x0;var _0x528839=_0xc492[_0x5d2a6b];return _0x528839;};'use strict';var ChatMessageEvents=require(_0x2c49('0x0'));var events=[_0x2c49('0x1'),_0x2c49('0x2'),'update'];function createListener(_0x57cde2,_0x37eda4){return function(_0x5bab73){_0x37eda4['emit'](_0x57cde2,_0x5bab73);};}function removeListener(_0x555cba,_0x1de940){return function(){ChatMessageEvents['removeListener'](_0x555cba,_0x1de940);};}exports[_0x2c49('0x3')]=function(_0x499c4e){for(var _0x3ad911=0x0,_0x9c10f7=events['length'];_0x3ad911<_0x9c10f7;_0x3ad911++){var _0xe7b4cb=events[_0x3ad911];var _0x17f596=createListener(_0x2c49('0x4')+_0xe7b4cb,_0x499c4e);ChatMessageEvents['on'](_0xe7b4cb,_0x17f596);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 84997e3..3b5649f 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 _0xe25d=['./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','post','chat','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2fd3fe,_0x509f0e){var _0x4b500a=function(_0x19f381){while(--_0x19f381){_0x2fd3fe['push'](_0x2fd3fe['shift']());}};_0x4b500a(++_0x509f0e);}(_0xe25d,0x18a));var _0xde25=function(_0x40338e,_0x810b8a){_0x40338e=_0x40338e-0x0;var _0x28788b=_0xe25d[_0x40338e];return _0x28788b;};'use strict';var multer=require(_0xde25('0x0'));var util=require('util');var path=require(_0xde25('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xde25('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xde25('0x3'));var interaction=require(_0xde25('0x4'));var config=require('../../config/environment');var controller=require(_0xde25('0x5'));router[_0xde25('0x6')]('/',auth[_0xde25('0x7')](),controller['index']);router[_0xde25('0x6')](_0xde25('0x8'),auth[_0xde25('0x7')](),controller[_0xde25('0x9')]);router[_0xde25('0x6')](_0xde25('0xa'),auth[_0xde25('0x7')](),controller['show']);router[_0xde25('0xb')]('/',auth[_0xde25('0x7')](),interaction['tracked'](_0xde25('0xc'),'chatmessage:create'),controller['create']);router[_0xde25('0xd')]('/:id',controller[_0xde25('0xe')]);router[_0xde25('0xd')](_0xde25('0xf'),auth['isAuthenticated'](),controller[_0xde25('0x10')]);router['put'](_0xde25('0x11'),auth[_0xde25('0x7')](),controller['reject']);router[_0xde25('0x12')](_0xde25('0xa'),auth['isAuthenticated'](),controller[_0xde25('0x13')]);module[_0xde25('0x14')]=router; \ No newline at end of file +var _0xcf92=['delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','chat','chatmessage:create','create','put','/:id/accept','accept','/:id/reject','reject'];(function(_0x5cbf0c,_0x32c5ed){var _0x36571c=function(_0x287aa1){while(--_0x287aa1){_0x5cbf0c['push'](_0x5cbf0c['shift']());}};_0x36571c(++_0x32c5ed);}(_0xcf92,0xc0));var _0x2cf9=function(_0x3fe514,_0x30c4ba){_0x3fe514=_0x3fe514-0x0;var _0x56ba25=_0xcf92[_0x3fe514];return _0x56ba25;};'use strict';var multer=require(_0x2cf9('0x0'));var util=require('util');var path=require(_0x2cf9('0x1'));var timeout=require('connect-timeout');var express=require(_0x2cf9('0x2'));var router=express['Router']();var fs_extra=require(_0x2cf9('0x3'));var auth=require(_0x2cf9('0x4'));var interaction=require(_0x2cf9('0x5'));var config=require(_0x2cf9('0x6'));var controller=require(_0x2cf9('0x7'));router[_0x2cf9('0x8')]('/',auth[_0x2cf9('0x9')](),controller[_0x2cf9('0xa')]);router['get'](_0x2cf9('0xb'),auth['isAuthenticated'](),controller[_0x2cf9('0xc')]);router[_0x2cf9('0x8')](_0x2cf9('0xd'),auth[_0x2cf9('0x9')](),controller['show']);router[_0x2cf9('0xe')]('/',auth[_0x2cf9('0x9')](),interaction[_0x2cf9('0xf')](_0x2cf9('0x10'),_0x2cf9('0x11')),controller[_0x2cf9('0x12')]);router[_0x2cf9('0x13')](_0x2cf9('0xd'),controller['update']);router[_0x2cf9('0x13')](_0x2cf9('0x14'),auth[_0x2cf9('0x9')](),controller[_0x2cf9('0x15')]);router['put'](_0x2cf9('0x16'),auth[_0x2cf9('0x9')](),controller[_0x2cf9('0x17')]);router[_0x2cf9('0x18')](_0x2cf9('0xd'),auth[_0x2cf9('0x9')](),controller[_0x2cf9('0x19')]);module[_0x2cf9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 374bd7c..59adb02 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 _0x5f66=['medium','TEXT','exports'];(function(_0x36a0a6,_0x2504c4){var _0x5a94c9=function(_0x297ffc){while(--_0x297ffc){_0x36a0a6['push'](_0x36a0a6['shift']());}};_0x5a94c9(++_0x2504c4);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'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 +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x1b936f,_0x12b112){var _0xeb2a6e=function(_0x1976ed){while(--_0x1976ed){_0x1b936f['push'](_0x1b936f['shift']());}};_0xeb2a6e(++_0x12b112);}(_0x5f2f,0x73));var _0xf5f2=function(_0x560af1,_0x80d213){_0x560af1=_0x560af1-0x0;var _0x45fc1d=_0x5f2f[_0x560af1];return _0x45fc1d;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 97adc7d..37a2cc6 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(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x7a54,0x106));var _0x47a5=function(_0x1f26b2,_0x50bc06){_0x1f26b2=_0x1f26b2-0x0;var _0x1548e0=_0x7a54[_0x1f26b2];return _0x1548e0;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x1511b0,_0x1c4c09){var _0x4b9a7a=function(_0x4ed840){while(--_0x4ed840){_0x1511b0['push'](_0x1511b0['shift']());}};_0x4b9a7a(++_0x1c4c09);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 9fbb3ab..a70c71f 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 _0xee7c=['setMaxListeners','remove','emit','hasOwnProperty','exports','../../mysqldb','ChatOfflineMessage'];(function(_0x63a040,_0x1aa8d5){var _0x5254b1=function(_0xab0f26){while(--_0xab0f26){_0x63a040['push'](_0x63a040['shift']());}};_0x5254b1(++_0x1aa8d5);}(_0xee7c,0x14e));var _0xcee7=function(_0x41cb39,_0xb161ae){_0x41cb39=_0x41cb39-0x0;var _0x1359e8=_0xee7c[_0x41cb39];return _0x1359e8;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0xcee7('0x0'))['db'][_0xcee7('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xcee7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xcee7('0x3')};function emitEvent(_0x4e26aa){return function(_0x20da40,_0x532afe,_0x4c04ee){ChatOfflineMessageEvents['emit'](_0x4e26aa+':'+_0x20da40['id'],_0x20da40);ChatOfflineMessageEvents[_0xcee7('0x4')](_0x4e26aa,_0x20da40);_0x4c04ee(null);};}for(var e in events){if(events[_0xcee7('0x5')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xcee7('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x964c=['hook','../../mysqldb','update','remove','emit'];(function(_0x32d537,_0x580e46){var _0x2ec857=function(_0x38ff38){while(--_0x38ff38){_0x32d537['push'](_0x32d537['shift']());}};_0x2ec857(++_0x580e46);}(_0x964c,0x65));var _0xc964=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x964c[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0xc964('0x0'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc964('0x1'),'afterDestroy':_0xc964('0x2')};function emitEvent(_0x22982c){return function(_0xe338ef,_0x593bd4,_0x36a832){ChatOfflineMessageEvents[_0xc964('0x3')](_0x22982c+':'+_0xe338ef['id'],_0xe338ef);ChatOfflineMessageEvents[_0xc964('0x3')](_0x22982c,_0xe338ef);_0x36a832(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0xc964('0x4')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 6f7674a..bdfa21f 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 _0xf133=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x5c4d27,_0x5b0822){var _0x1dda1a=function(_0x5ea638){while(--_0x5ea638){_0x5c4d27['push'](_0x5c4d27['shift']());}};_0x1dda1a(++_0x5b0822);}(_0xf133,0xbe));var _0x3f13=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xf133[_0x5d6456];return _0x4d66c1;};'use strict';var attributes=require(_0x3f13('0x0'));module[_0x3f13('0x1')]=function(_0x42992c){return _0x42992c[_0x3f13('0x2')](_0x3f13('0x3'),attributes,{'tableName':_0x3f13('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3f13('0x5')});}; \ No newline at end of file +var _0x59d7=['exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x181dc5,_0x2ac432){var _0x5ea42d=function(_0x521d2d){while(--_0x521d2d){_0x181dc5['push'](_0x181dc5['shift']());}};_0x5ea42d(++_0x2ac432);}(_0x59d7,0x19d));var _0x759d=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x59d7[_0x383356];return _0x32ee5a;};'use strict';var attributes=require(_0x759d('0x0'));module[_0x759d('0x1')]=function(_0x3c6f64){return _0x3c6f64['define'](_0x759d('0x2'),attributes,{'tableName':_0x759d('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x759d('0x4'),'collate':_0x759d('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index bbbd77b..76d049c 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 _0x5704=['error','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x594821,_0x153b6c){var _0x139112=function(_0x105337){while(--_0x105337){_0x594821['push'](_0x594821['shift']());}};_0x139112(++_0x153b6c);}(_0x5704,0x1e3));var _0x4570=function(_0x44e201,_0x2477f9){_0x44e201=_0x44e201-0x0;var _0xb720a9=_0x5704[_0x44e201];return _0xb720a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4570('0x0'));var BPromise=require(_0x4570('0x1'));var rs=require(_0x4570('0x2'));var fs=require('fs');var Redis=require(_0x4570('0x3'));var db=require(_0x4570('0x4'))['db'];var utils=require(_0x4570('0x5'));var logger=require(_0x4570('0x6'))(_0x4570('0x7'));var config=require(_0x4570('0x8'));var jayson=require(_0x4570('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24bbe2,_0x39f107,_0x1e97c9){return new BPromise(function(_0x3ad974,_0x2ac130){return client[_0x4570('0xa')](_0x24bbe2,_0x1e97c9)[_0x4570('0xb')](function(_0x3648aa){logger[_0x4570('0xc')](_0x4570('0xd'),_0x39f107,_0x4570('0xe'));logger[_0x4570('0xf')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x39f107,_0x4570('0xe'),JSON[_0x4570('0x10')](_0x3648aa));if(_0x3648aa['error']){if(_0x3648aa[_0x4570('0x11')]['code']===0x1f4){logger['error'](_0x4570('0xd'),_0x39f107,_0x3648aa[_0x4570('0x11')][_0x4570('0x12')]);return _0x2ac130(_0x3648aa['error'][_0x4570('0x12')]);}logger[_0x4570('0x11')](_0x4570('0xd'),_0x39f107,_0x3648aa[_0x4570('0x11')][_0x4570('0x12')]);return _0x3ad974(_0x3648aa['error'][_0x4570('0x12')]);}else{logger[_0x4570('0xc')](_0x4570('0xd'),_0x39f107,_0x4570('0xe'));_0x3ad974(_0x3648aa[_0x4570('0x13')][_0x4570('0x12')]);}})['catch'](function(_0x3da18d){logger[_0x4570('0x11')](_0x4570('0xd'),_0x39f107,_0x3da18d);_0x2ac130(_0x3da18d);});});} \ No newline at end of file +var _0x0261=['debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x476c88,_0x15a566){var _0x124cb7=function(_0x5c99e3){while(--_0x5c99e3){_0x476c88['push'](_0x476c88['shift']());}};_0x124cb7(++_0x15a566);}(_0x0261,0x11b));var _0x1026=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x0261[_0x35f7f5];return _0x5567a4;};'use strict';var _=require(_0x1026('0x0'));var util=require(_0x1026('0x1'));var moment=require(_0x1026('0x2'));var BPromise=require(_0x1026('0x3'));var rs=require(_0x1026('0x4'));var fs=require('fs');var Redis=require(_0x1026('0x5'));var db=require(_0x1026('0x6'))['db'];var utils=require(_0x1026('0x7'));var logger=require(_0x1026('0x8'))(_0x1026('0x9'));var config=require(_0x1026('0xa'));var jayson=require(_0x1026('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x465ee3,_0x332f1c,_0x557baa){return new BPromise(function(_0xa2d1de,_0x42dfa7){return client[_0x1026('0xc')](_0x465ee3,_0x557baa)['then'](function(_0x408f52){logger[_0x1026('0xd')](_0x1026('0xe'),_0x332f1c,_0x1026('0xf'));logger[_0x1026('0x10')](_0x1026('0x11'),_0x332f1c,_0x1026('0xf'),JSON[_0x1026('0x12')](_0x408f52));if(_0x408f52['error']){if(_0x408f52[_0x1026('0x13')][_0x1026('0x14')]===0x1f4){logger['error'](_0x1026('0xe'),_0x332f1c,_0x408f52[_0x1026('0x13')]['message']);return _0x42dfa7(_0x408f52['error'][_0x1026('0x15')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x332f1c,_0x408f52['error'][_0x1026('0x15')]);return _0xa2d1de(_0x408f52[_0x1026('0x13')][_0x1026('0x15')]);}else{logger['info'](_0x1026('0xe'),_0x332f1c,_0x1026('0xf'));_0xa2d1de(_0x408f52[_0x1026('0x16')][_0x1026('0x15')]);}})['catch'](function(_0x262a10){logger[_0x1026('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x332f1c,_0x262a10);_0x42dfa7(_0x262a10);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index b1a3b20..01a70da 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 _0x3ff4=['destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','describe','post','create','put','/:id','delete'];(function(_0x2bd9db,_0x2f6076){var _0x28441e=function(_0x354695){while(--_0x354695){_0x2bd9db['push'](_0x2bd9db['shift']());}};_0x28441e(++_0x2f6076);}(_0x3ff4,0xe6));var _0x43ff=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x3ff4[_0x2aec52];return _0x3b8835;};'use strict';var multer=require('multer');var util=require(_0x43ff('0x0'));var path=require(_0x43ff('0x1'));var timeout=require(_0x43ff('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x43ff('0x3'));var auth=require(_0x43ff('0x4'));var interaction=require(_0x43ff('0x5'));var config=require(_0x43ff('0x6'));var controller=require(_0x43ff('0x7'));router['get']('/',auth[_0x43ff('0x8')](),controller[_0x43ff('0x9')]);router[_0x43ff('0xa')]('/describe',auth[_0x43ff('0x8')](),controller[_0x43ff('0xb')]);router[_0x43ff('0xa')]('/:id',auth[_0x43ff('0x8')](),controller['show']);router[_0x43ff('0xc')]('/',auth['isAuthenticated'](),controller[_0x43ff('0xd')]);router[_0x43ff('0xe')](_0x43ff('0xf'),auth[_0x43ff('0x8')](),controller['update']);router[_0x43ff('0x10')](_0x43ff('0xf'),auth[_0x43ff('0x8')](),controller[_0x43ff('0x11')]);module[_0x43ff('0x12')]=router; \ No newline at end of file +var _0x1651=['get','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','describe'];(function(_0x51ec61,_0xf9d1e3){var _0x223200=function(_0x3bd510){while(--_0x3bd510){_0x51ec61['push'](_0x51ec61['shift']());}};_0x223200(++_0xf9d1e3);}(_0x1651,0x15c));var _0x1165=function(_0x49d64f,_0x3d016){_0x49d64f=_0x49d64f-0x0;var _0x3c20fe=_0x1651[_0x49d64f];return _0x3c20fe;};'use strict';var multer=require(_0x1165('0x0'));var util=require(_0x1165('0x1'));var path=require(_0x1165('0x2'));var timeout=require(_0x1165('0x3'));var express=require(_0x1165('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1165('0x5'));var interaction=require(_0x1165('0x6'));var config=require(_0x1165('0x7'));var controller=require(_0x1165('0x8'));router['get']('/',auth[_0x1165('0x9')](),controller[_0x1165('0xa')]);router['get']('/describe',auth[_0x1165('0x9')](),controller[_0x1165('0xb')]);router[_0x1165('0xc')](_0x1165('0xd'),auth[_0x1165('0x9')](),controller[_0x1165('0xe')]);router[_0x1165('0xf')]('/',auth[_0x1165('0x9')](),controller[_0x1165('0x10')]);router[_0x1165('0x11')](_0x1165('0xd'),auth[_0x1165('0x9')](),controller[_0x1165('0x12')]);router['delete']('/:id',auth[_0x1165('0x9')](),controller[_0x1165('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index f03925e..6bd59d9 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 _0x870d=['sequelize','exports','STRING','ENUM','mouseOver'];(function(_0xd5196c,_0x3b4fbf){var _0x3d93da=function(_0x301d3c){while(--_0x301d3c){_0xd5196c['push'](_0xd5196c['shift']());}};_0x3d93da(++_0x3b4fbf);}(_0x870d,0xaa));var _0xd870=function(_0x37d80f,_0x3247d5){_0x37d80f=_0x37d80f-0x0;var _0x339434=_0x870d[_0x37d80f];return _0x339434;};'use strict';var Sequelize=require(_0xd870('0x0'));module[_0xd870('0x1')]={'name':{'type':Sequelize[_0xd870('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd870('0x3')]('mouseOver','timeout'),'defaultValue':_0xd870('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x58cc=['sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x58cc,0x72));var _0xc58c=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x58cc[_0x54d4fe];return _0x1ab5bb;};'use strict';var Sequelize=require(_0xc58c('0x0'));module[_0xc58c('0x1')]={'name':{'type':Sequelize[_0xc58c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc58c('0x3')](_0xc58c('0x4'),_0xc58c('0x5')),'defaultValue':_0xc58c('0x4')},'selector':{'type':Sequelize[_0xc58c('0x2')]},'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 e4c1916..d390a7e 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 _0xf2ca=['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','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','error','stack','name','send','show','params','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','model','fields','length','includeAll','include','merge','options','find','create','catch','update','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x50b1c5,_0x1cf2a9){_0x50b1c5=_0x50b1c5-0x0;var _0x344f99=_0xf2ca[_0x50b1c5];return _0x344f99;};'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'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x3c1ae6,_0xe929b5){return function(_0xff396f){if(!_0xff396f){_0x3c1ae6[_0xaf2c('0x18')](0x194);}return _0xff396f;};}function handleError(_0x4a8dd8,_0x29f8b0){_0x29f8b0=_0x29f8b0||0x1f4;return function(_0x2051be){logger[_0xaf2c('0x24')](_0x2051be[_0xaf2c('0x25')]);if(_0x2051be['name']){delete _0x2051be[_0xaf2c('0x26')];}_0x4a8dd8['status'](_0x29f8b0)[_0xaf2c('0x27')](_0x2051be);};}exports[_0xaf2c('0x28')]=function(_0x15466b,_0x5d685a){var _0x2747bb={'raw':!![],'where':{'id':_0x15466b[_0xaf2c('0x29')]['id']}},_0x2ea490={};_0x2ea490['model']=_[_0xaf2c('0x2a')](db[_0xaf2c('0x2b')][_0xaf2c('0x2c')]);_0x2ea490[_0xaf2c('0x2d')]=_['keys'](_0x15466b[_0xaf2c('0x2d')]);_0x2ea490[_0xaf2c('0x2e')]=_[_0xaf2c('0x2f')](_0x2ea490['model'],_0x2ea490['query']);_0x2747bb[_0xaf2c('0x30')]=_['intersection'](_0x2ea490[_0xaf2c('0x31')],qs['fields'](_0x15466b[_0xaf2c('0x2d')][_0xaf2c('0x32')]));_0x2747bb['attributes']=_0x2747bb[_0xaf2c('0x30')][_0xaf2c('0x33')]?_0x2747bb['attributes']:_0x2ea490[_0xaf2c('0x31')];if(_0x15466b[_0xaf2c('0x2d')][_0xaf2c('0x34')]){_0x2747bb[_0xaf2c('0x35')]=[{'all':!![]}];}_0x2747bb=_[_0xaf2c('0x36')]({},_0x2747bb,_0x15466b[_0xaf2c('0x37')]);return db['ChatProactiveAction'][_0xaf2c('0x38')](_0x2747bb)['then'](handleEntityNotFound(_0x5d685a,null))[_0xaf2c('0x23')](respondWithResult(_0x5d685a,null))['catch'](handleError(_0x5d685a,null));};exports[_0xaf2c('0x39')]=function(_0x59f686,_0x2f3d16){return db['ChatProactiveAction'][_0xaf2c('0x39')](_0x59f686['body'],{})[_0xaf2c('0x23')](respondWithResult(_0x2f3d16,0xc9))[_0xaf2c('0x3a')](handleError(_0x2f3d16,null));};exports[_0xaf2c('0x3b')]=function(_0x14ec58,_0x470aff){if(_0x14ec58['body']['id']){delete _0x14ec58['body']['id'];}return db[_0xaf2c('0x2b')][_0xaf2c('0x38')]({'where':{'id':_0x14ec58[_0xaf2c('0x29')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x470aff,null))[_0xaf2c('0x23')](saveUpdates(_0x14ec58[_0xaf2c('0x3c')],null))['then'](respondWithResult(_0x470aff,null))[_0xaf2c('0x3a')](handleError(_0x470aff,null));};exports[_0xaf2c('0x3d')]=function(_0x4fdc8b,_0x36081a){return db[_0xaf2c('0x2b')][_0xaf2c('0x38')]({'where':{'id':_0x4fdc8b[_0xaf2c('0x29')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x36081a,null))[_0xaf2c('0x23')](removeEntity(_0x36081a,null))[_0xaf2c('0x3a')](handleError(_0x36081a,null));}; \ No newline at end of file +var _0x9aee=['body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','end','error','name','send','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','include','options','find','then','catch','create'];(function(_0x1d4ea9,_0x3f1d85){var _0x2cf5eb=function(_0x145f17){while(--_0x145f17){_0x1d4ea9['push'](_0x1d4ea9['shift']());}};_0x2cf5eb(++_0x3f1d85);}(_0x9aee,0x71));var _0xe9ae=function(_0x440f53,_0x58aa56){_0x440f53=_0x440f53-0x0;var _0x190b07=_0x9aee[_0x440f53];return _0x190b07;};'use strict';var emlformat=require(_0xe9ae('0x0'));var rimraf=require(_0xe9ae('0x1'));var zipdir=require(_0xe9ae('0x2'));var jsonpatch=require(_0xe9ae('0x3'));var rp=require(_0xe9ae('0x4'));var moment=require(_0xe9ae('0x5'));var BPromise=require(_0xe9ae('0x6'));var Mustache=require(_0xe9ae('0x7'));var util=require(_0xe9ae('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe9ae('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe9ae('0xa'));var crypto=require('crypto');var jsforce=require(_0xe9ae('0xb'));var deskjs=require(_0xe9ae('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe9ae('0xd'));var Papa=require(_0xe9ae('0xe'));var Redis=require(_0xe9ae('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe9ae('0x10'));var as=require(_0xe9ae('0x11'));var hardwareService=require(_0xe9ae('0x12'));var logger=require('../../config/logger')(_0xe9ae('0x13'));var utils=require('../../config/utils');var config=require(_0xe9ae('0x14'));var licenseUtil=require(_0xe9ae('0x15'));var db=require(_0xe9ae('0x16'))['db'];function respondWithStatusCode(_0x1833c9,_0x3f55e5){_0x3f55e5=_0x3f55e5||0xcc;return function(_0x1be4dd){if(_0x1be4dd){return _0x1833c9[_0xe9ae('0x17')](_0x3f55e5);}return _0x1833c9[_0xe9ae('0x18')](_0x3f55e5)['end']();};}function respondWithResult(_0x2f2c3b,_0x38b4af){_0x38b4af=_0x38b4af||0xc8;return function(_0x4e8869){if(_0x4e8869){return _0x2f2c3b[_0xe9ae('0x18')](_0x38b4af)[_0xe9ae('0x19')](_0x4e8869);}};}function respondWithFilteredResult(_0x44fa8c,_0x43963c){return function(_0x3ef25b){if(_0x3ef25b){var _0x1fd836=typeof _0x43963c[_0xe9ae('0x1a')]===_0xe9ae('0x1b')&&typeof _0x43963c[_0xe9ae('0x1c')]==='undefined';var _0x5b18ae=_0x3ef25b[_0xe9ae('0x1d')];var _0x4bae07=_0x1fd836?0x0:_0x43963c[_0xe9ae('0x1a')];var _0x32748a=_0x1fd836?_0x3ef25b[_0xe9ae('0x1d')]:_0x43963c[_0xe9ae('0x1a')]+_0x43963c['limit'];var _0x4e9e93;if(_0x32748a>=_0x5b18ae){_0x32748a=_0x5b18ae;_0x4e9e93=0xc8;}else{_0x4e9e93=0xce;}_0x44fa8c['status'](_0x4e9e93);return _0x44fa8c[_0xe9ae('0x1e')](_0xe9ae('0x1f'),_0x4bae07+'-'+_0x32748a+'/'+_0x5b18ae)['json'](_0x3ef25b);}return null;};}function patchUpdates(_0x1ad4d5){return function(_0x49fc40){try{jsonpatch[_0xe9ae('0x20')](_0x49fc40,_0x1ad4d5,!![]);}catch(_0x324de0){return BPromise[_0xe9ae('0x21')](_0x324de0);}return _0x49fc40['save']();};}function saveUpdates(_0x4a7568,_0x475b7a){return function(_0x206bd7){if(_0x206bd7){return _0x206bd7[_0xe9ae('0x22')](_0x4a7568)['then'](function(_0x36285a){return _0x36285a;});}return null;};}function removeEntity(_0x29d690,_0x31e94f){return function(_0x3fd466){if(_0x3fd466){return _0x3fd466[_0xe9ae('0x23')]()['then'](function(){_0x29d690[_0xe9ae('0x18')](0xcc)[_0xe9ae('0x24')]();});}};}function handleEntityNotFound(_0x9f1726,_0x209236){return function(_0x5cec8a){if(!_0x5cec8a){_0x9f1726[_0xe9ae('0x17')](0x194);}return _0x5cec8a;};}function handleError(_0x5195ce,_0x3e78ca){_0x3e78ca=_0x3e78ca||0x1f4;return function(_0x18e5b3){logger[_0xe9ae('0x25')](_0x18e5b3['stack']);if(_0x18e5b3[_0xe9ae('0x26')]){delete _0x18e5b3[_0xe9ae('0x26')];}_0x5195ce[_0xe9ae('0x18')](_0x3e78ca)[_0xe9ae('0x27')](_0x18e5b3);};}exports['show']=function(_0x266f36,_0x3db24e){var _0x483df4={'raw':!![],'where':{'id':_0x266f36[_0xe9ae('0x28')]['id']}},_0x4ac613={};_0x4ac613[_0xe9ae('0x29')]=_[_0xe9ae('0x2a')](db[_0xe9ae('0x2b')]['rawAttributes']);_0x4ac613[_0xe9ae('0x2c')]=_['keys'](_0x266f36[_0xe9ae('0x2c')]);_0x4ac613[_0xe9ae('0x2d')]=_[_0xe9ae('0x2e')](_0x4ac613[_0xe9ae('0x29')],_0x4ac613[_0xe9ae('0x2c')]);_0x483df4[_0xe9ae('0x2f')]=_['intersection'](_0x4ac613[_0xe9ae('0x29')],qs[_0xe9ae('0x30')](_0x266f36[_0xe9ae('0x2c')][_0xe9ae('0x30')]));_0x483df4[_0xe9ae('0x2f')]=_0x483df4[_0xe9ae('0x2f')]['length']?_0x483df4[_0xe9ae('0x2f')]:_0x4ac613[_0xe9ae('0x29')];if(_0x266f36[_0xe9ae('0x2c')]['includeAll']){_0x483df4[_0xe9ae('0x31')]=[{'all':!![]}];}_0x483df4=_['merge']({},_0x483df4,_0x266f36[_0xe9ae('0x32')]);return db[_0xe9ae('0x2b')][_0xe9ae('0x33')](_0x483df4)['then'](handleEntityNotFound(_0x3db24e,null))[_0xe9ae('0x34')](respondWithResult(_0x3db24e,null))[_0xe9ae('0x35')](handleError(_0x3db24e,null));};exports[_0xe9ae('0x36')]=function(_0x416bae,_0x161c77){return db[_0xe9ae('0x2b')]['create'](_0x416bae[_0xe9ae('0x37')],{})[_0xe9ae('0x34')](respondWithResult(_0x161c77,0xc9))['catch'](handleError(_0x161c77,null));};exports[_0xe9ae('0x22')]=function(_0x2813a0,_0x22c47c){if(_0x2813a0['body']['id']){delete _0x2813a0[_0xe9ae('0x37')]['id'];}return db['ChatProactiveAction'][_0xe9ae('0x33')]({'where':{'id':_0x2813a0[_0xe9ae('0x28')]['id']}})[_0xe9ae('0x34')](handleEntityNotFound(_0x22c47c,null))[_0xe9ae('0x34')](saveUpdates(_0x2813a0['body'],null))[_0xe9ae('0x34')](respondWithResult(_0x22c47c,null))['catch'](handleError(_0x22c47c,null));};exports[_0xe9ae('0x23')]=function(_0x50d500,_0x52e381){return db[_0xe9ae('0x2b')]['find']({'where':{'id':_0x50d500[_0xe9ae('0x28')]['id']}})[_0xe9ae('0x34')](handleEntityNotFound(_0x52e381,null))[_0xe9ae('0x34')](removeEntity(_0x52e381,null))[_0xe9ae('0x35')](handleError(_0x52e381,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 2833467..eebc53c 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 _0x1c59=['rimraf','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c59,0x1f1));var _0x91c5=function(_0x4145be,_0xdab769){_0x4145be=_0x4145be-0x0;var _0x2227d7=_0x1c59[_0x4145be];return _0x2227d7;};'use strict';var _=require(_0x91c5('0x0'));var util=require(_0x91c5('0x1'));var logger=require(_0x91c5('0x2'))(_0x91c5('0x3'));var moment=require('moment');var BPromise=require(_0x91c5('0x4'));var rp=require(_0x91c5('0x5'));var fs=require('fs');var path=require(_0x91c5('0x6'));var rimraf=require(_0x91c5('0x7'));var config=require('../../config/environment');var attributes=require(_0x91c5('0x8'));module[_0x91c5('0x9')]=function(_0x512334,_0x44424f){return _0x512334[_0x91c5('0xa')]('ChatProactiveAction',attributes,{'tableName':_0x91c5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45e1=['exports','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes'];(function(_0x2abe9a,_0x426745){var _0xdd91ac=function(_0x4279e5){while(--_0x4279e5){_0x2abe9a['push'](_0x2abe9a['shift']());}};_0xdd91ac(++_0x426745);}(_0x45e1,0x145));var _0x145e=function(_0xb37185,_0x3ec508){_0xb37185=_0xb37185-0x0;var _0x575b45=_0x45e1[_0xb37185];return _0x575b45;};'use strict';var _=require(_0x145e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x145e('0x1'));var moment=require(_0x145e('0x2'));var BPromise=require(_0x145e('0x3'));var rp=require(_0x145e('0x4'));var fs=require('fs');var path=require(_0x145e('0x5'));var rimraf=require('rimraf');var config=require(_0x145e('0x6'));var attributes=require(_0x145e('0x7'));module[_0x145e('0x8')]=function(_0x5228a5,_0x12fed4){return _0x5228a5['define']('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','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 7c22c06..18cad78 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 _0x5278=['moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x3d5d16,_0x4cf444){var _0x442a4d=function(_0x4712c0){while(--_0x4712c0){_0x3d5d16['push'](_0x3d5d16['shift']());}};_0x442a4d(++_0x4cf444);}(_0x5278,0x166));var _0x8527=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x5278[_0x4ae829];return _0x256b31;};'use strict';var _=require(_0x8527('0x0'));var util=require(_0x8527('0x1'));var moment=require(_0x8527('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8527('0x3'));var db=require(_0x8527('0x4'))['db'];var utils=require(_0x8527('0x5'));var logger=require('../../config/logger')(_0x8527('0x6'));var config=require(_0x8527('0x7'));var jayson=require(_0x8527('0x8'));var client=jayson['client'][_0x8527('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x195055,_0x345408,_0x365a4a){return new BPromise(function(_0x1e7640,_0x269a68){return client[_0x8527('0xa')](_0x195055,_0x365a4a)['then'](function(_0x36689e){logger[_0x8527('0xb')](_0x8527('0xc'),_0x345408,'request\x20sent');logger['debug'](_0x8527('0xd'),_0x345408,_0x8527('0xe'),JSON[_0x8527('0xf')](_0x36689e));if(_0x36689e[_0x8527('0x10')]){if(_0x36689e[_0x8527('0x10')]['code']===0x1f4){logger[_0x8527('0x10')](_0x8527('0xc'),_0x345408,_0x36689e[_0x8527('0x10')][_0x8527('0x11')]);return _0x269a68(_0x36689e[_0x8527('0x10')][_0x8527('0x11')]);}logger[_0x8527('0x10')](_0x8527('0xc'),_0x345408,_0x36689e[_0x8527('0x10')][_0x8527('0x11')]);return _0x1e7640(_0x36689e[_0x8527('0x10')][_0x8527('0x11')]);}else{logger[_0x8527('0xb')](_0x8527('0xc'),_0x345408,_0x8527('0xe'));_0x1e7640(_0x36689e[_0x8527('0x12')][_0x8527('0x11')]);}})[_0x8527('0x13')](function(_0x270988){logger[_0x8527('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x345408,_0x270988);_0x269a68(_0x270988);});});} \ No newline at end of file +var _0x828f=['message','request\x20sent','result','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x45c981,_0x2ad2d4){var _0x4f62c8=function(_0x55209b){while(--_0x55209b){_0x45c981['push'](_0x45c981['shift']());}};_0x4f62c8(++_0x2ad2d4);}(_0x828f,0xc1));var _0xf828=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0x828f[_0x5eb22e];return _0x27fed5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf828('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf828('0x1'));var db=require(_0xf828('0x2'))['db'];var utils=require(_0xf828('0x3'));var logger=require(_0xf828('0x4'))(_0xf828('0x5'));var config=require(_0xf828('0x6'));var jayson=require(_0xf828('0x7'));var client=jayson[_0xf828('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfeb32a,_0x1a393c,_0x43a369){return new BPromise(function(_0x353b54,_0x5d937e){return client['request'](_0xfeb32a,_0x43a369)[_0xf828('0x9')](function(_0x29120d){logger[_0xf828('0xa')](_0xf828('0xb'),_0x1a393c,'request\x20sent');logger[_0xf828('0xc')](_0xf828('0xd'),_0x1a393c,'request\x20sent',JSON['stringify'](_0x29120d));if(_0x29120d[_0xf828('0xe')]){if(_0x29120d[_0xf828('0xe')][_0xf828('0xf')]===0x1f4){logger[_0xf828('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x1a393c,_0x29120d[_0xf828('0xe')]['message']);return _0x5d937e(_0x29120d[_0xf828('0xe')]['message']);}logger[_0xf828('0xe')](_0xf828('0xb'),_0x1a393c,_0x29120d[_0xf828('0xe')][_0xf828('0x10')]);return _0x353b54(_0x29120d[_0xf828('0xe')][_0xf828('0x10')]);}else{logger[_0xf828('0xa')](_0xf828('0xb'),_0x1a393c,_0xf828('0x11'));_0x353b54(_0x29120d[_0xf828('0x12')][_0xf828('0x10')]);}})['catch'](function(_0xf4b944){logger[_0xf828('0xe')](_0xf828('0xb'),_0x1a393c,_0xf4b944);_0x5d937e(_0xf4b944);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 8470cd9..525c216 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(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xeff8,0x186));var _0x8eff=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0xeff8[_0x43b08];return _0x5e05f4;};'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 _0xb4c7=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','show','create'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x4e820b,_0x37b5af){_0x4e820b=_0x4e820b-0x0;var _0x3f539e=_0xb4c7[_0x4e820b];return _0x3f539e;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xc')]);router['post']('/',auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xd')]);router['put'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0x10')]);module[_0x7b4c('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 4e3e5c8..33d204d 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 _0x549d=['ENUM','rrmemory','beepall','exports','STRING','INTEGER'];(function(_0xa57f9f,_0x337d01){var _0xa98c39=function(_0x171b7a){while(--_0x171b7a){_0xa57f9f['push'](_0xa57f9f['shift']());}};_0xa98c39(++_0x337d01);}(_0x549d,0xd5));var _0xd549=function(_0x230fd4,_0x5313d2){_0x230fd4=_0x230fd4-0x0;var _0x35bda4=_0x549d[_0x230fd4];return _0x35bda4;};'use strict';var Sequelize=require('sequelize');module[_0xd549('0x0')]={'name':{'type':Sequelize[_0xd549('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd549('0x1')]},'timeout':{'type':Sequelize[_0xd549('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd549('0x3')](_0xd549('0x4'),_0xd549('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xcb86=['name','INTEGER','rrmemory','roundrobin','exports','STRING'];(function(_0x5bfc72,_0x959e59){var _0x11fe83=function(_0x51cbb9){while(--_0x51cbb9){_0x5bfc72['push'](_0x5bfc72['shift']());}};_0x11fe83(++_0x959e59);}(_0xcb86,0xac));var _0x6cb8=function(_0x13b762,_0x9c16ee){_0x13b762=_0x13b762-0x0;var _0x344406=_0xcb86[_0x13b762];return _0x344406;};'use strict';var Sequelize=require('sequelize');module[_0x6cb8('0x0')]={'name':{'type':Sequelize[_0x6cb8('0x1')],'unique':_0x6cb8('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6cb8('0x1')]},'timeout':{'type':Sequelize[_0x6cb8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6cb8('0x4'),'beepall',_0x6cb8('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 7601dec..a556ebc 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 _0xf2dd=['Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','compact','value','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','lodash','../../config/logger','api','../../config/environment','redis','defaults','./chatQueue.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','end','error','name','send','map','ChatQueue','fieldName','type','getOptions','where','include','query','rows','catch','show','params','model','keys','rawAttributes','attributes','intersection','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','filters','order','sort','filter','UserChatQueue','findAll','User','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','pick','hasOwnProperty','nolimit','addTeams','ids'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xf2dd,0x11c));var _0xdf2d=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xf2dd[_0x2261ce];return _0x524640;};'use strict';var BPromise=require(_0xdf2d('0x0'));var util=require('util');var _=require(_0xdf2d('0x1'));var squel=require('squel');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xdf2d('0x2'))(_0xdf2d('0x3'));var config=require(_0xdf2d('0x4'));var db=require('../../mysqldb')['db'];config[_0xdf2d('0x5')]=_[_0xdf2d('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdf2d('0x7'))[_0xdf2d('0x8')](socket);function respondWithStatusCode(_0x4a2915,_0x2ba73f){_0x2ba73f=_0x2ba73f||0xcc;return function(_0x287a7a){if(_0x287a7a){return _0x4a2915[_0xdf2d('0x9')](_0x2ba73f);}return _0x4a2915[_0xdf2d('0xa')](_0x2ba73f)['end']();};}function respondWithResult(_0x18698f,_0x5d8a9a){_0x5d8a9a=_0x5d8a9a||0xc8;return function(_0xa9ab74){if(_0xa9ab74){return _0x18698f[_0xdf2d('0xa')](_0x5d8a9a)[_0xdf2d('0xb')](_0xa9ab74);}};}function respondWithFilteredResult(_0x2fb135,_0x5eb281){return function(_0x185a79){if(_0x185a79){var _0x3a83f2=typeof _0x5eb281[_0xdf2d('0xc')]==='undefined'&&typeof _0x5eb281[_0xdf2d('0xd')]===_0xdf2d('0xe');var _0xf25775=_0x185a79[_0xdf2d('0xf')];var _0x402f6a=_0x3a83f2?0x0:_0x5eb281[_0xdf2d('0xc')];var _0xb393ed=_0x3a83f2?_0x185a79[_0xdf2d('0xf')]:_0x5eb281[_0xdf2d('0xc')]+_0x5eb281['limit'];var _0x5b683a;if(_0xb393ed>=_0xf25775){_0xb393ed=_0xf25775;_0x5b683a=0xc8;}else{_0x5b683a=0xce;}_0x2fb135[_0xdf2d('0xa')](_0x5b683a);return _0x2fb135[_0xdf2d('0x10')](_0xdf2d('0x11'),_0x402f6a+'-'+_0xb393ed+'/'+_0xf25775)[_0xdf2d('0xb')](_0x185a79);}return null;};}function saveUpdates(_0x394d82){return function(_0x47b1d0){if(_0x47b1d0){return _0x47b1d0[_0xdf2d('0x12')](_0x394d82)[_0xdf2d('0x13')](function(_0x1f3311){return _0x1f3311;});}return null;};}function removeEntity(_0x3eb957){return function(_0x10b4e4){if(_0x10b4e4){return _0x10b4e4[_0xdf2d('0x14')]()['then'](function(){var _0x3a4b63=_0x10b4e4[_0xdf2d('0x15')]({'plain':!![]});var _0x350357=_0xdf2d('0x16');return db[_0xdf2d('0x17')]['destroy']({'where':{'type':_0x350357,'resourceId':_0x3a4b63['id']}})[_0xdf2d('0x13')](function(){return _0x10b4e4;});})['then'](function(){_0x3eb957[_0xdf2d('0xa')](0xcc)[_0xdf2d('0x18')]();});}};}function handleEntityNotFound(_0x4199f8){return function(_0x49219f){if(!_0x49219f){_0x4199f8[_0xdf2d('0x9')](0x194);}return _0x49219f;};}function handleError(_0x5e71b8,_0x2280e6){_0x2280e6=_0x2280e6||0x1f4;return function(_0x513173){logger[_0xdf2d('0x19')](_0x513173['stack']);if(_0x513173['name']){delete _0x513173[_0xdf2d('0x1a')];}_0x5e71b8[_0xdf2d('0xa')](_0x2280e6)[_0xdf2d('0x1b')](_0x513173);};}exports['index']=function(_0x288667,_0x2d4515){var _0xda43d={};var _0x141894={'count':0x0,'rows':[]};var _0x31de94=_[_0xdf2d('0x1c')](db[_0xdf2d('0x1d')]['rawAttributes'],function(_0x4410fe){return{'name':_0x4410fe[_0xdf2d('0x1e')],'type':_0x4410fe[_0xdf2d('0x1f')]['key']};});_0xda43d=qs[_0xdf2d('0x20')](_0x31de94,_0x288667);var _0x9653f5={'where':_0xda43d[_0xdf2d('0x21')]};return db[_0xdf2d('0x1d')][_0xdf2d('0xf')](_0x9653f5)[_0xdf2d('0x13')](function(_0x338be4){_0x141894[_0xdf2d('0xf')]=_0x338be4;_0xda43d[_0xdf2d('0x22')]=qs['include'](_0x288667[_0xdf2d('0x23')]);return db[_0xdf2d('0x1d')]['findAll'](_0xda43d);})['then'](function(_0x4ff3c6){_0x141894[_0xdf2d('0x24')]=_0x4ff3c6;return _0x141894;})[_0xdf2d('0x13')](respondWithFilteredResult(_0x2d4515,_0xda43d))[_0xdf2d('0x25')](handleError(_0x2d4515,null));};exports[_0xdf2d('0x26')]=function(_0x22fd49,_0x1cb429){var _0x588a10={'raw':!![],'where':{'id':_0x22fd49[_0xdf2d('0x27')]['id']}},_0x2b4274={};_0x2b4274[_0xdf2d('0x28')]=_[_0xdf2d('0x29')](db[_0xdf2d('0x1d')][_0xdf2d('0x2a')]);_0x2b4274[_0xdf2d('0x23')]=_[_0xdf2d('0x29')](_0x22fd49['query']);_0x2b4274['filters']=_['intersection'](_0x2b4274[_0xdf2d('0x28')],_0x2b4274[_0xdf2d('0x23')]);_0x588a10[_0xdf2d('0x2b')]=_[_0xdf2d('0x2c')](_0x2b4274[_0xdf2d('0x28')],qs[_0xdf2d('0x2d')](_0x22fd49[_0xdf2d('0x23')]['fields']));_0x588a10[_0xdf2d('0x2b')]=_0x588a10['attributes'][_0xdf2d('0x2e')]?_0x588a10[_0xdf2d('0x2b')]:_0x2b4274[_0xdf2d('0x28')];if(_0x22fd49['query'][_0xdf2d('0x2f')]){_0x588a10[_0xdf2d('0x22')]=[{'all':!![]}];}_0x588a10=_[_0xdf2d('0x30')]({},_0x588a10,_0x22fd49[_0xdf2d('0x31')]);return db[_0xdf2d('0x1d')]['find'](_0x588a10)[_0xdf2d('0x13')](handleEntityNotFound(_0x1cb429,null))[_0xdf2d('0x13')](respondWithResult(_0x1cb429,null))[_0xdf2d('0x25')](handleError(_0x1cb429,null));};exports['create']=function(_0x34abec,_0x1f9e87){return db['ChatQueue'][_0xdf2d('0x32')](_0x34abec[_0xdf2d('0x33')],{})[_0xdf2d('0x13')](function(_0x4456fc){var _0x5dbcdc=_0x34abec[_0xdf2d('0x34')]['get']({'plain':!![]});if(!_0x5dbcdc)throw new Error(_0xdf2d('0x35'));if(_0x5dbcdc[_0xdf2d('0x36')]===_0xdf2d('0x34')){var _0x2ca170=_0x4456fc[_0xdf2d('0x15')]({'plain':!![]});var _0x5f1da5=_0xdf2d('0x16');return db[_0xdf2d('0x37')][_0xdf2d('0x38')]({'where':{'name':_0x5f1da5,'userProfileId':_0x5dbcdc['userProfileId']},'raw':!![]})['then'](function(_0x3ba4b8){if(_0x3ba4b8&&_0x3ba4b8[_0xdf2d('0x39')]===0x0){return db['UserProfileResource']['create']({'name':_0x2ca170[_0xdf2d('0x1a')],'resourceId':_0x2ca170['id'],'type':_0x3ba4b8[_0xdf2d('0x1a')],'sectionId':_0x3ba4b8['id']},{})['then'](function(){return _0x4456fc;});}else{return _0x4456fc;}})[_0xdf2d('0x25')](function(_0x3a17fd){logger[_0xdf2d('0x19')](_0xdf2d('0x3a'),_0x3a17fd);throw _0x3a17fd;});}return _0x4456fc;})['then'](respondWithResult(_0x1f9e87,0xc9))['catch'](handleError(_0x1f9e87,null));};exports[_0xdf2d('0x12')]=function(_0x59505c,_0x4bc0f0){if(_0x59505c['body']['id']){delete _0x59505c['body']['id'];}return db['ChatQueue']['find']({'where':{'id':_0x59505c[_0xdf2d('0x27')]['id']}})[_0xdf2d('0x13')](handleEntityNotFound(_0x4bc0f0,null))[_0xdf2d('0x13')](saveUpdates(_0x59505c[_0xdf2d('0x33')],null))[_0xdf2d('0x13')](respondWithResult(_0x4bc0f0,null))[_0xdf2d('0x25')](handleError(_0x4bc0f0,null));};exports['destroy']=function(_0x1fb3c7,_0x13a11f){return db[_0xdf2d('0x1d')]['find']({'where':{'id':_0x1fb3c7['params']['id']}})[_0xdf2d('0x13')](handleEntityNotFound(_0x13a11f,null))[_0xdf2d('0x13')](removeEntity(_0x13a11f,null))['catch'](handleError(_0x13a11f,null));};exports[_0xdf2d('0x3b')]=function(_0x5a0e29,_0x4b6c49){return db[_0xdf2d('0x1d')][_0xdf2d('0x3b')]()[_0xdf2d('0x13')](respondWithResult(_0x4b6c49,null))[_0xdf2d('0x25')](handleError(_0x4b6c49,null));};exports['getMembers']=function(_0x416062,_0xf36449){var _0x2fa380={'raw':!![],'where':{}},_0x547072={},_0x453c34;return db[_0xdf2d('0x1d')][_0xdf2d('0x3c')]({'where':{'id':_0x416062['params']['id']}})[_0xdf2d('0x13')](handleEntityNotFound(_0xf36449,null))[_0xdf2d('0x13')](function(_0x4fcfc2){if(_0x4fcfc2){_0x453c34=_0x4fcfc2['get']({'plain':!![]});_0x547072[_0xdf2d('0x28')]=_['keys'](db['UserChatQueue'][_0xdf2d('0x2a')]);_0x547072[_0xdf2d('0x23')]=_[_0xdf2d('0x29')](_0x416062[_0xdf2d('0x23')]);_0x547072[_0xdf2d('0x3d')]=_[_0xdf2d('0x2c')](_0x547072[_0xdf2d('0x28')],_0x547072[_0xdf2d('0x23')]);_0x2fa380[_0xdf2d('0x2b')]=_[_0xdf2d('0x2c')](_0x547072['model'],qs['fields'](_0x416062['query'][_0xdf2d('0x2d')]));_0x2fa380[_0xdf2d('0x2b')]=_0x2fa380[_0xdf2d('0x2b')][_0xdf2d('0x2e')]?_0x2fa380[_0xdf2d('0x2b')]:_0x547072[_0xdf2d('0x28')];if(!_0x416062['query']['hasOwnProperty']('nolimit')){_0x2fa380[_0xdf2d('0xd')]=qs[_0xdf2d('0xd')](_0x416062[_0xdf2d('0x23')][_0xdf2d('0xd')]);_0x2fa380[_0xdf2d('0xc')]=qs[_0xdf2d('0xc')](_0x416062[_0xdf2d('0x23')][_0xdf2d('0xc')]);}_0x2fa380[_0xdf2d('0x3e')]=qs['sort'](_0x416062[_0xdf2d('0x23')][_0xdf2d('0x3f')]);_0x2fa380[_0xdf2d('0x21')]=qs['filters'](_['pick'](_0x416062[_0xdf2d('0x23')],_0x547072[_0xdf2d('0x3d')]));_0x2fa380[_0xdf2d('0x21')]['ChatQueueId']=_0x4fcfc2['id'];if(_0x416062['query'][_0xdf2d('0x40')]){_0x2fa380[_0xdf2d('0x21')]=_[_0xdf2d('0x30')](_0x2fa380[_0xdf2d('0x21')],{'$or':_['map'](_0x2fa380[_0xdf2d('0x2b')],function(_0x4ff62a){var _0x2aed95={};_0x2aed95[_0x4ff62a]={'$like':'%'+_0x416062['query'][_0xdf2d('0x40')]+'%'};return _0x2aed95;})});}_0x2fa380=_[_0xdf2d('0x30')]({},_0x2fa380,_0x416062[_0xdf2d('0x31')]);return db[_0xdf2d('0x41')][_0xdf2d('0x42')](_0x2fa380);}})[_0xdf2d('0x13')](function(_0x6676eb){if(_0x6676eb){return db[_0xdf2d('0x43')]['findAndCountAll']({'where':{'id':_[_0xdf2d('0x1c')](_0x6676eb,_0xdf2d('0x44')),'role':_0xdf2d('0x45')},'attributes':['id',_0xdf2d('0x1a'),_0xdf2d('0x46'),_0xdf2d('0x47'),_0xdf2d('0x48')]});}})[_0xdf2d('0x13')](function(_0x223243){if(_0x223243){return{'count':_0x223243[_0xdf2d('0xf')],'rows':_[_0xdf2d('0x1c')](_0x223243[_0xdf2d('0x24')],function(_0x40bbaa){return{'membername':_0x40bbaa[_0xdf2d('0x1a')],'UserId':_0x40bbaa['id'],'queue_name':_0x453c34[_0xdf2d('0x1a')],'ChatQueueId':_0x453c34['id'],'interface':util[_0xdf2d('0x49')](_0xdf2d('0x4a'),_0xdf2d('0x4b'),_0x40bbaa['name']),'penalty':0x0,'paused':_0x40bbaa[_0xdf2d('0x46')],'createdAt':_0x40bbaa[_0xdf2d('0x48')],'updatedAt':_0x40bbaa[_0xdf2d('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdf2d('0x13')](respondWithFilteredResult(_0xf36449,_0x2fa380))[_0xdf2d('0x25')](handleError(_0xf36449,null));};exports[_0xdf2d('0x4c')]=function(_0x31b45f,_0x358c4e){var _0x56d7c7={};var _0xfc4755={};var _0x88a0fb;var _0x1edbf0;return db[_0xdf2d('0x1d')][_0xdf2d('0x3c')]({'where':{'id':_0x31b45f[_0xdf2d('0x27')]['id']}})[_0xdf2d('0x13')](handleEntityNotFound(_0x358c4e,null))[_0xdf2d('0x13')](function(_0x589a71){if(_0x589a71){_0x88a0fb=_0x589a71;_0xfc4755[_0xdf2d('0x28')]=_[_0xdf2d('0x29')](db['Team'][_0xdf2d('0x2a')]);_0xfc4755[_0xdf2d('0x23')]=_['keys'](_0x31b45f[_0xdf2d('0x23')]);_0xfc4755[_0xdf2d('0x3d')]=_[_0xdf2d('0x2c')](_0xfc4755[_0xdf2d('0x28')],_0xfc4755[_0xdf2d('0x23')]);_0x56d7c7['attributes']=_[_0xdf2d('0x2c')](_0xfc4755['model'],qs[_0xdf2d('0x2d')](_0x31b45f['query'][_0xdf2d('0x2d')]));_0x56d7c7[_0xdf2d('0x2b')]=_0x56d7c7['attributes'][_0xdf2d('0x2e')]?_0x56d7c7[_0xdf2d('0x2b')]:_0xfc4755[_0xdf2d('0x28')];_0x56d7c7['order']=qs[_0xdf2d('0x3f')](_0x31b45f[_0xdf2d('0x23')]['sort']);_0x56d7c7[_0xdf2d('0x21')]=qs[_0xdf2d('0x3d')](_[_0xdf2d('0x4d')](_0x31b45f[_0xdf2d('0x23')],_0xfc4755[_0xdf2d('0x3d')]));if(_0x31b45f['query'][_0xdf2d('0x40')]){_0x56d7c7[_0xdf2d('0x21')]=_[_0xdf2d('0x30')](_0x56d7c7[_0xdf2d('0x21')],{'$or':_[_0xdf2d('0x1c')](_0x56d7c7[_0xdf2d('0x2b')],function(_0x5756df){var _0x5d5dd3={};_0x5d5dd3[_0x5756df]={'$like':'%'+_0x31b45f[_0xdf2d('0x23')][_0xdf2d('0x40')]+'%'};return _0x5d5dd3;})});}_0x56d7c7=_[_0xdf2d('0x30')]({},_0x56d7c7,_0x31b45f[_0xdf2d('0x31')]);return _0x88a0fb[_0xdf2d('0x4c')](_0x56d7c7);}})[_0xdf2d('0x13')](function(_0x5e57dc){if(_0x5e57dc){_0x1edbf0=_0x5e57dc[_0xdf2d('0x2e')];if(!_0x31b45f[_0xdf2d('0x23')][_0xdf2d('0x4e')](_0xdf2d('0x4f'))){_0x56d7c7['limit']=qs[_0xdf2d('0xd')](_0x31b45f[_0xdf2d('0x23')][_0xdf2d('0xd')]);_0x56d7c7['offset']=qs[_0xdf2d('0xc')](_0x31b45f[_0xdf2d('0x23')][_0xdf2d('0xc')]);}return _0x88a0fb[_0xdf2d('0x4c')](_0x56d7c7);}})[_0xdf2d('0x13')](function(_0x34f6c1){if(_0x34f6c1){return _0x34f6c1?{'count':_0x1edbf0,'rows':_0x34f6c1}:null;}})[_0xdf2d('0x13')](respondWithResult(_0x358c4e,null))[_0xdf2d('0x25')](handleError(_0x358c4e,null));};exports[_0xdf2d('0x50')]=function(_0x480214,_0x277371){var _0x54c46f=_0x480214[_0xdf2d('0x33')][_0xdf2d('0x51')];return db[_0xdf2d('0x52')][_0xdf2d('0x42')]({'where':{'id':_0x54c46f},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdf2d('0x53'),'attributes':['id',_0xdf2d('0x1a'),_0xdf2d('0x54'),_0xdf2d('0x55'),_0xdf2d('0x56')],'raw':!![]}]})[_0xdf2d('0x13')](function(_0x17f73d){if(_0x17f73d){var _0x5ae26c=_[_0xdf2d('0x57')](_0x17f73d,function(_0x1c3081){var _0x5beaca=_0x1c3081[_0xdf2d('0x15')]({'plain':!![]});return _0x5beaca[_0xdf2d('0x53')];});return db[_0xdf2d('0x1d')][_0xdf2d('0x38')]({'where':{'id':_0x480214[_0xdf2d('0x27')]['id']}})['then'](function(_0xde71df){return db[_0xdf2d('0x58')][_0xdf2d('0x59')](function(_0x592bd8){return _0xde71df['addTeams'](_0x54c46f,{'transaction':_0x592bd8})[_0xdf2d('0x13')](function(){return BPromise['each'](_0x5ae26c,function(_0x5c4cb4){return db[_0xdf2d('0x41')][_0xdf2d('0x5a')]({'where':{'UserId':_0x5c4cb4['id'],'ChatQueueId':_0x480214['params']['id']},'transaction':_0x592bd8});});})[_0xdf2d('0x13')](function(){_0x5ae26c[_0xdf2d('0x5b')](function(_0x38971f){socket[_0xdf2d('0x5c')](_0xdf2d('0x5d'),{'UserId':_0x38971f['id'],'ChatQueueId':_0xde71df['id']});});});});});}})[_0xdf2d('0x13')](respondWithStatusCode(_0x277371,null))[_0xdf2d('0x25')](handleError(_0x277371,null));};exports['removeTeams']=function(_0x57fa9e,_0x463345){return db[_0xdf2d('0x52')][_0xdf2d('0x42')]({'where':{'id':_0x57fa9e['query'][_0xdf2d('0x51')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdf2d('0x53'),'attributes':['id'],'raw':!![]}]})[_0xdf2d('0x13')](handleEntityNotFound(_0x463345,null))[_0xdf2d('0x13')](function(_0x3642de){var _0x202d81=_[_0xdf2d('0x1c')](_0x3642de,'id');var _0x2e4c16=[];var _0x270f12=[];var _0x1c34c9=squel[_0xdf2d('0x5e')]();_0x1c34c9['field'](_0xdf2d('0x5f'))[_0xdf2d('0x60')](_0xdf2d('0x61'),'tq')[_0xdf2d('0x62')](_0xdf2d('0x63'),'ut',_0xdf2d('0x64'))[_0xdf2d('0x21')](_0xdf2d('0x65'),_0x57fa9e['params']['id']);for(var _0x15b25c=0x0;_0x15b25c<_0x3642de['length'];_0x15b25c+=0x1){let _0x240cec=_0x3642de[_0x15b25c];for(var _0x43f3ed=0x0;_0x43f3ed<_0x240cec['Agents'][_0xdf2d('0x2e')];_0x43f3ed+=0x1){let _0x512fc6=_0x240cec[_0xdf2d('0x53')][_0x43f3ed];var _0x3044a3=_0x1c34c9[_0xdf2d('0x66')]();_0x3044a3[_0xdf2d('0x21')](_0xdf2d('0x67'),_0x512fc6['id']);_0x270f12[_0xdf2d('0x68')](db[_0xdf2d('0x58')][_0xdf2d('0x23')](_0x3044a3[_0xdf2d('0x69')](),{'type':db[_0xdf2d('0x58')][_0xdf2d('0x6a')]['SELECT']})[_0xdf2d('0x13')](function(_0x269844){if(_0x269844['length']===0x1){return _0x512fc6['id'];}else{var _0x3cfc9a=_[_0xdf2d('0x6b')](_['map'](_0x269844,_0xdf2d('0x6c')),function(_0x368b31){return _['includes'](_0x202d81,_0x368b31);});if(_0x3cfc9a){return _0x512fc6['id'];}}}));}}return BPromise[_0xdf2d('0x6d')](_0x270f12)[_0xdf2d('0x13')](function(_0x4cd1d7){_0x2e4c16=_(_0x2e4c16)[_0xdf2d('0x6e')](_0x4cd1d7)[_0xdf2d('0x6f')]()[_0xdf2d('0x70')]();return db[_0xdf2d('0x1d')][_0xdf2d('0x38')]({'where':{'id':_0x57fa9e[_0xdf2d('0x27')]['id']}})[_0xdf2d('0x13')](function(_0xeff871){return db[_0xdf2d('0x58')]['transaction'](function(_0x570eba){return _0xeff871[_0xdf2d('0x71')](_0x57fa9e[_0xdf2d('0x23')][_0xdf2d('0x51')],{'transaction':_0x570eba})[_0xdf2d('0x13')](function(){if(!_[_0xdf2d('0x72')](_0x2e4c16)){return _0xeff871[_0xdf2d('0x73')](_0x2e4c16,{'transaction':_0x570eba});}})[_0xdf2d('0x13')](function(){_0x2e4c16[_0xdf2d('0x5b')](function(_0x2edcd0){socket['emit'](_0xdf2d('0x74'),{'UserId':_0x2edcd0,'ChatQueueId':_0xeff871['id']});});});});});});})[_0xdf2d('0x13')](respondWithStatusCode(_0x463345,null))[_0xdf2d('0x25')](handleError(_0x463345,null));};exports[_0xdf2d('0x75')]=function(_0x5c88ea,_0x126df5){return db[_0xdf2d('0x1d')][_0xdf2d('0x38')]({'where':{'id':_0x5c88ea['params']['id']}})[_0xdf2d('0x13')](handleEntityNotFound(_0x126df5,null))['then'](function(_0x94e795){if(_0x94e795){return _0x94e795[_0xdf2d('0x75')](_0x5c88ea['body'][_0xdf2d('0x51')],_[_0xdf2d('0x76')](_0x5c88ea[_0xdf2d('0x33')],[_0xdf2d('0x51'),'id'])||{})[_0xdf2d('0x77')](function(_0x3bbee3){for(var _0x193098=0x0;_0x193098<_0x5c88ea[_0xdf2d('0x33')][_0xdf2d('0x51')]['length'];_0x193098+=0x1){socket[_0xdf2d('0x5c')]('userChatQueue:save',{'UserId':Number(_0x5c88ea[_0xdf2d('0x33')]['ids'][_0x193098]),'ChatQueueId':Number(_0x5c88ea[_0xdf2d('0x27')]['id'])});}return _0x3bbee3;});}})['then'](respondWithResult(_0x126df5,null))[_0xdf2d('0x25')](handleError(_0x126df5,null));};exports[_0xdf2d('0x73')]=function(_0x5dd11c,_0x4a9380){return db[_0xdf2d('0x1d')]['find']({'where':{'id':_0x5dd11c[_0xdf2d('0x27')]['id']}})[_0xdf2d('0x13')](handleEntityNotFound(_0x4a9380,null))['then'](function(_0x3638a4){if(_0x3638a4){return _0x3638a4[_0xdf2d('0x73')](_0x5dd11c[_0xdf2d('0x23')][_0xdf2d('0x51')])[_0xdf2d('0x13')](function(){if(_[_0xdf2d('0x78')](_0x5dd11c['query']['ids'])){for(var _0x1788c9=0x0;_0x1788c9<_0x5dd11c[_0xdf2d('0x23')][_0xdf2d('0x51')][_0xdf2d('0x2e')];_0x1788c9+=0x1){socket['emit'](_0xdf2d('0x74'),{'UserId':Number(_0x5dd11c[_0xdf2d('0x23')][_0xdf2d('0x51')][_0x1788c9]),'ChatQueueId':Number(_0x5dd11c['params']['id'])});}}else{socket[_0xdf2d('0x5c')](_0xdf2d('0x74'),{'UserId':Number(_0x5dd11c['query'][_0xdf2d('0x51')]),'ChatQueueId':Number(_0x5dd11c[_0xdf2d('0x27')]['id'])});}});}})[_0xdf2d('0x13')](respondWithStatusCode(_0x4a9380,null))[_0xdf2d('0x25')](handleError(_0x4a9380,null));};exports['getAgents']=function(_0x282542,_0x5b609c){var _0x25431b={};var _0x571f6f={};var _0x3e27c6;var _0x328b88;return db[_0xdf2d('0x1d')]['findOne']({'where':{'id':_0x282542[_0xdf2d('0x27')]['id']}})['then'](handleEntityNotFound(_0x5b609c,null))['then'](function(_0xf2b924){if(_0xf2b924){_0x3e27c6=_0xf2b924;_0x571f6f['model']=_[_0xdf2d('0x29')](db['User'][_0xdf2d('0x2a')]);_0x571f6f[_0xdf2d('0x23')]=_[_0xdf2d('0x29')](_0x282542['query']);_0x571f6f[_0xdf2d('0x3d')]=_[_0xdf2d('0x2c')](_0x571f6f[_0xdf2d('0x28')],_0x571f6f['query']);_0x25431b[_0xdf2d('0x2b')]=_[_0xdf2d('0x2c')](_0x571f6f[_0xdf2d('0x28')],qs['fields'](_0x282542[_0xdf2d('0x23')][_0xdf2d('0x2d')]));_0x25431b['attributes']=_0x25431b['attributes'][_0xdf2d('0x2e')]?_0x25431b['attributes']:_0x571f6f[_0xdf2d('0x28')];_0x25431b[_0xdf2d('0x3e')]=qs[_0xdf2d('0x3f')](_0x282542[_0xdf2d('0x23')]['sort']);_0x25431b[_0xdf2d('0x21')]=qs[_0xdf2d('0x3d')](_[_0xdf2d('0x4d')](_0x282542[_0xdf2d('0x23')],_0x571f6f[_0xdf2d('0x3d')]));if(_0x282542['query'][_0xdf2d('0x40')]){_0x25431b[_0xdf2d('0x21')]=_[_0xdf2d('0x30')](_0x25431b[_0xdf2d('0x21')],{'$or':_[_0xdf2d('0x1c')](_0x25431b[_0xdf2d('0x2b')],function(_0x34cc9a){var _0x2ccb0a={};_0x2ccb0a[_0x34cc9a]={'$like':'%'+_0x282542['query'][_0xdf2d('0x40')]+'%'};return _0x2ccb0a;})});}_0x25431b=_['merge']({},_0x25431b,_0x282542[_0xdf2d('0x31')]);return _0x3e27c6[_0xdf2d('0x79')](_0x25431b);}})[_0xdf2d('0x13')](function(_0x50dca4){if(_0x50dca4){_0x328b88=_0x50dca4[_0xdf2d('0x2e')];if(!_0x282542[_0xdf2d('0x23')][_0xdf2d('0x4e')](_0xdf2d('0x4f'))){_0x25431b[_0xdf2d('0xd')]=qs[_0xdf2d('0xd')](_0x282542['query'][_0xdf2d('0xd')]);_0x25431b['offset']=qs[_0xdf2d('0xc')](_0x282542['query']['offset']);}return _0x3e27c6[_0xdf2d('0x79')](_0x25431b);}})[_0xdf2d('0x13')](function(_0x567992){if(_0x567992){return _0x567992?{'count':_0x328b88,'rows':_0x567992}:null;}})[_0xdf2d('0x13')](respondWithResult(_0x5b609c,null))[_0xdf2d('0x25')](handleError(_0x5b609c,null));}; \ No newline at end of file +var _0x2e5a=['fields','includeAll','merge','options','create','user','UserProfileSection','find','userProfileId','UserProfileResource','update','body','getMembers','findOne','UserChatQueue','length','hasOwnProperty','nolimit','order','sort','ChatQueueId','filter','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','%s/%s','Team','pick','getTeams','addTeams','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','select','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','all','compact','value','isEmpty','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','then','get','ChatQueues','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','catch','show','params','keys','ChatQueue','filters','intersection','model','attributes'];(function(_0x523e3f,_0xbdbe8b){var _0x71967f=function(_0x2c2c2b){while(--_0x2c2c2b){_0x523e3f['push'](_0x523e3f['shift']());}};_0x71967f(++_0xbdbe8b);}(_0x2e5a,0x199));var _0xa2e5=function(_0x4945b8,_0x28d659){_0x4945b8=_0x4945b8-0x0;var _0x38a136=_0x2e5a[_0x4945b8];return _0x38a136;};'use strict';var BPromise=require('bluebird');var util=require(_0xa2e5('0x0'));var _=require('lodash');var squel=require('squel');var Redis=require(_0xa2e5('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xa2e5('0x2'))(_0xa2e5('0x3'));var config=require(_0xa2e5('0x4'));var db=require(_0xa2e5('0x5'))['db'];config[_0xa2e5('0x6')]=_[_0xa2e5('0x7')](config[_0xa2e5('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xa2e5('0x8'))(new Redis(config['redis']));require(_0xa2e5('0x9'))[_0xa2e5('0xa')](socket);function respondWithStatusCode(_0x23364a,_0x2c1b4f){_0x2c1b4f=_0x2c1b4f||0xcc;return function(_0x2d7fc3){if(_0x2d7fc3){return _0x23364a[_0xa2e5('0xb')](_0x2c1b4f);}return _0x23364a[_0xa2e5('0xc')](_0x2c1b4f)['end']();};}function respondWithResult(_0xfa5952,_0x4b237d){_0x4b237d=_0x4b237d||0xc8;return function(_0x25a9e3){if(_0x25a9e3){return _0xfa5952[_0xa2e5('0xc')](_0x4b237d)[_0xa2e5('0xd')](_0x25a9e3);}};}function respondWithFilteredResult(_0x4a95ff,_0x405a75){return function(_0x2a3362){if(_0x2a3362){var _0x586280=typeof _0x405a75[_0xa2e5('0xe')]===_0xa2e5('0xf')&&typeof _0x405a75[_0xa2e5('0x10')]==='undefined';var _0x39d049=_0x2a3362['count'];var _0x4235a9=_0x586280?0x0:_0x405a75[_0xa2e5('0xe')];var _0x4bdab6=_0x586280?_0x2a3362['count']:_0x405a75[_0xa2e5('0xe')]+_0x405a75[_0xa2e5('0x10')];var _0x2c4e67;if(_0x4bdab6>=_0x39d049){_0x4bdab6=_0x39d049;_0x2c4e67=0xc8;}else{_0x2c4e67=0xce;}_0x4a95ff[_0xa2e5('0xc')](_0x2c4e67);return _0x4a95ff[_0xa2e5('0x11')](_0xa2e5('0x12'),_0x4235a9+'-'+_0x4bdab6+'/'+_0x39d049)[_0xa2e5('0xd')](_0x2a3362);}return null;};}function saveUpdates(_0x57f785){return function(_0x282ff3){if(_0x282ff3){return _0x282ff3['update'](_0x57f785)[_0xa2e5('0x13')](function(_0x596262){return _0x596262;});}return null;};}function removeEntity(_0x3cf06a){return function(_0x2741f9){if(_0x2741f9){return _0x2741f9['destroy']()['then'](function(){var _0x2e774c=_0x2741f9[_0xa2e5('0x14')]({'plain':!![]});var _0x1d506a=_0xa2e5('0x15');return db['UserProfileResource'][_0xa2e5('0x16')]({'where':{'type':_0x1d506a,'resourceId':_0x2e774c['id']}})[_0xa2e5('0x13')](function(){return _0x2741f9;});})[_0xa2e5('0x13')](function(){_0x3cf06a[_0xa2e5('0xc')](0xcc)[_0xa2e5('0x17')]();});}};}function handleEntityNotFound(_0x227428){return function(_0x398e13){if(!_0x398e13){_0x227428['sendStatus'](0x194);}return _0x398e13;};}function handleError(_0x547b88,_0x332999){_0x332999=_0x332999||0x1f4;return function(_0x21800f){logger[_0xa2e5('0x18')](_0x21800f[_0xa2e5('0x19')]);if(_0x21800f[_0xa2e5('0x1a')]){delete _0x21800f[_0xa2e5('0x1a')];}_0x547b88[_0xa2e5('0xc')](_0x332999)['send'](_0x21800f);};}exports[_0xa2e5('0x1b')]=function(_0x379f1b,_0x412ac4){var _0x514be3={};var _0xc0d3da={'count':0x0,'rows':[]};var _0x37a889=_[_0xa2e5('0x1c')](db['ChatQueue'][_0xa2e5('0x1d')],function(_0x5cb4de){return{'name':_0x5cb4de[_0xa2e5('0x1e')],'type':_0x5cb4de[_0xa2e5('0x1f')][_0xa2e5('0x20')]};});_0x514be3=qs[_0xa2e5('0x21')](_0x37a889,_0x379f1b);var _0x77200e={'where':_0x514be3[_0xa2e5('0x22')]};return db['ChatQueue']['count'](_0x77200e)[_0xa2e5('0x13')](function(_0x5447d9){_0xc0d3da['count']=_0x5447d9;_0x514be3[_0xa2e5('0x23')]=qs['include'](_0x379f1b[_0xa2e5('0x24')]);return db['ChatQueue'][_0xa2e5('0x25')](_0x514be3);})[_0xa2e5('0x13')](function(_0x4145bd){_0xc0d3da['rows']=_0x4145bd;return _0xc0d3da;})['then'](respondWithFilteredResult(_0x412ac4,_0x514be3))[_0xa2e5('0x26')](handleError(_0x412ac4,null));};exports[_0xa2e5('0x27')]=function(_0xf29f7d,_0x21c474){var _0x2c18e7={'raw':!![],'where':{'id':_0xf29f7d[_0xa2e5('0x28')]['id']}},_0x533ab2={};_0x533ab2['model']=_[_0xa2e5('0x29')](db[_0xa2e5('0x2a')][_0xa2e5('0x1d')]);_0x533ab2[_0xa2e5('0x24')]=_[_0xa2e5('0x29')](_0xf29f7d['query']);_0x533ab2[_0xa2e5('0x2b')]=_[_0xa2e5('0x2c')](_0x533ab2[_0xa2e5('0x2d')],_0x533ab2[_0xa2e5('0x24')]);_0x2c18e7[_0xa2e5('0x2e')]=_[_0xa2e5('0x2c')](_0x533ab2[_0xa2e5('0x2d')],qs[_0xa2e5('0x2f')](_0xf29f7d[_0xa2e5('0x24')][_0xa2e5('0x2f')]));_0x2c18e7['attributes']=_0x2c18e7[_0xa2e5('0x2e')]['length']?_0x2c18e7['attributes']:_0x533ab2[_0xa2e5('0x2d')];if(_0xf29f7d[_0xa2e5('0x24')][_0xa2e5('0x30')]){_0x2c18e7[_0xa2e5('0x23')]=[{'all':!![]}];}_0x2c18e7=_[_0xa2e5('0x31')]({},_0x2c18e7,_0xf29f7d[_0xa2e5('0x32')]);return db['ChatQueue']['find'](_0x2c18e7)[_0xa2e5('0x13')](handleEntityNotFound(_0x21c474,null))['then'](respondWithResult(_0x21c474,null))[_0xa2e5('0x26')](handleError(_0x21c474,null));};exports[_0xa2e5('0x33')]=function(_0xd6bb94,_0x4da0db){return db[_0xa2e5('0x2a')][_0xa2e5('0x33')](_0xd6bb94['body'],{})[_0xa2e5('0x13')](function(_0x2d7882){var _0x527134=_0xd6bb94[_0xa2e5('0x34')]['get']({'plain':!![]});if(!_0x527134)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x527134['role']===_0xa2e5('0x34')){var _0x22e450=_0x2d7882[_0xa2e5('0x14')]({'plain':!![]});var _0x3c5e22=_0xa2e5('0x15');return db[_0xa2e5('0x35')][_0xa2e5('0x36')]({'where':{'name':_0x3c5e22,'userProfileId':_0x527134[_0xa2e5('0x37')]},'raw':!![]})['then'](function(_0xcaa90b){if(_0xcaa90b&&_0xcaa90b['autoAssociation']===0x0){return db[_0xa2e5('0x38')][_0xa2e5('0x33')]({'name':_0x22e450[_0xa2e5('0x1a')],'resourceId':_0x22e450['id'],'type':_0xcaa90b['name'],'sectionId':_0xcaa90b['id']},{})[_0xa2e5('0x13')](function(){return _0x2d7882;});}else{return _0x2d7882;}})[_0xa2e5('0x26')](function(_0x346324){logger[_0xa2e5('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x346324);throw _0x346324;});}return _0x2d7882;})[_0xa2e5('0x13')](respondWithResult(_0x4da0db,0xc9))[_0xa2e5('0x26')](handleError(_0x4da0db,null));};exports[_0xa2e5('0x39')]=function(_0x3e858d,_0x5a20ad){if(_0x3e858d[_0xa2e5('0x3a')]['id']){delete _0x3e858d[_0xa2e5('0x3a')]['id'];}return db[_0xa2e5('0x2a')][_0xa2e5('0x36')]({'where':{'id':_0x3e858d[_0xa2e5('0x28')]['id']}})[_0xa2e5('0x13')](handleEntityNotFound(_0x5a20ad,null))['then'](saveUpdates(_0x3e858d['body'],null))[_0xa2e5('0x13')](respondWithResult(_0x5a20ad,null))[_0xa2e5('0x26')](handleError(_0x5a20ad,null));};exports[_0xa2e5('0x16')]=function(_0x3d49ee,_0x4c11c2){return db[_0xa2e5('0x2a')][_0xa2e5('0x36')]({'where':{'id':_0x3d49ee['params']['id']}})[_0xa2e5('0x13')](handleEntityNotFound(_0x4c11c2,null))[_0xa2e5('0x13')](removeEntity(_0x4c11c2,null))['catch'](handleError(_0x4c11c2,null));};exports['describe']=function(_0x164276,_0x595521){return db[_0xa2e5('0x2a')]['describe']()[_0xa2e5('0x13')](respondWithResult(_0x595521,null))[_0xa2e5('0x26')](handleError(_0x595521,null));};exports[_0xa2e5('0x3b')]=function(_0x229904,_0xd682fb){var _0x8e46bb={'raw':!![],'where':{}},_0x58a6ea={},_0x4c1b86;return db[_0xa2e5('0x2a')][_0xa2e5('0x3c')]({'where':{'id':_0x229904[_0xa2e5('0x28')]['id']}})['then'](handleEntityNotFound(_0xd682fb,null))[_0xa2e5('0x13')](function(_0x12bf33){if(_0x12bf33){_0x4c1b86=_0x12bf33[_0xa2e5('0x14')]({'plain':!![]});_0x58a6ea['model']=_[_0xa2e5('0x29')](db[_0xa2e5('0x3d')][_0xa2e5('0x1d')]);_0x58a6ea[_0xa2e5('0x24')]=_[_0xa2e5('0x29')](_0x229904[_0xa2e5('0x24')]);_0x58a6ea[_0xa2e5('0x2b')]=_[_0xa2e5('0x2c')](_0x58a6ea[_0xa2e5('0x2d')],_0x58a6ea[_0xa2e5('0x24')]);_0x8e46bb['attributes']=_[_0xa2e5('0x2c')](_0x58a6ea[_0xa2e5('0x2d')],qs[_0xa2e5('0x2f')](_0x229904[_0xa2e5('0x24')][_0xa2e5('0x2f')]));_0x8e46bb[_0xa2e5('0x2e')]=_0x8e46bb['attributes'][_0xa2e5('0x3e')]?_0x8e46bb[_0xa2e5('0x2e')]:_0x58a6ea[_0xa2e5('0x2d')];if(!_0x229904[_0xa2e5('0x24')][_0xa2e5('0x3f')](_0xa2e5('0x40'))){_0x8e46bb[_0xa2e5('0x10')]=qs[_0xa2e5('0x10')](_0x229904['query'][_0xa2e5('0x10')]);_0x8e46bb[_0xa2e5('0xe')]=qs[_0xa2e5('0xe')](_0x229904[_0xa2e5('0x24')][_0xa2e5('0xe')]);}_0x8e46bb[_0xa2e5('0x41')]=qs['sort'](_0x229904[_0xa2e5('0x24')][_0xa2e5('0x42')]);_0x8e46bb[_0xa2e5('0x22')]=qs[_0xa2e5('0x2b')](_['pick'](_0x229904[_0xa2e5('0x24')],_0x58a6ea[_0xa2e5('0x2b')]));_0x8e46bb[_0xa2e5('0x22')][_0xa2e5('0x43')]=_0x12bf33['id'];if(_0x229904[_0xa2e5('0x24')][_0xa2e5('0x44')]){_0x8e46bb[_0xa2e5('0x22')]=_[_0xa2e5('0x31')](_0x8e46bb[_0xa2e5('0x22')],{'$or':_[_0xa2e5('0x1c')](_0x8e46bb[_0xa2e5('0x2e')],function(_0x3394f9){var _0x32a3de={};_0x32a3de[_0x3394f9]={'$like':'%'+_0x229904[_0xa2e5('0x24')][_0xa2e5('0x44')]+'%'};return _0x32a3de;})});}_0x8e46bb=_[_0xa2e5('0x31')]({},_0x8e46bb,_0x229904[_0xa2e5('0x32')]);return db[_0xa2e5('0x3d')][_0xa2e5('0x25')](_0x8e46bb);}})[_0xa2e5('0x13')](function(_0x89bc78){if(_0x89bc78){return db[_0xa2e5('0x45')][_0xa2e5('0x46')]({'where':{'id':_[_0xa2e5('0x1c')](_0x89bc78,'UserId'),'role':_0xa2e5('0x47')},'attributes':['id',_0xa2e5('0x1a'),_0xa2e5('0x48'),_0xa2e5('0x49'),_0xa2e5('0x4a')]});}})[_0xa2e5('0x13')](function(_0x2fa455){if(_0x2fa455){return{'count':_0x2fa455['count'],'rows':_['map'](_0x2fa455['rows'],function(_0x589eaa){return{'membername':_0x589eaa[_0xa2e5('0x1a')],'UserId':_0x589eaa['id'],'queue_name':_0x4c1b86['name'],'ChatQueueId':_0x4c1b86['id'],'interface':util['format'](_0xa2e5('0x4b'),'SIP',_0x589eaa[_0xa2e5('0x1a')]),'penalty':0x0,'paused':_0x589eaa[_0xa2e5('0x48')],'createdAt':_0x589eaa[_0xa2e5('0x4a')],'updatedAt':_0x589eaa[_0xa2e5('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa2e5('0x13')](respondWithFilteredResult(_0xd682fb,_0x8e46bb))[_0xa2e5('0x26')](handleError(_0xd682fb,null));};exports['getTeams']=function(_0x5cd7a9,_0x3dba64){var _0x35d322={};var _0x13b3c6={};var _0x38bc23;var _0x59ee9e;return db[_0xa2e5('0x2a')][_0xa2e5('0x3c')]({'where':{'id':_0x5cd7a9[_0xa2e5('0x28')]['id']}})['then'](handleEntityNotFound(_0x3dba64,null))[_0xa2e5('0x13')](function(_0x133753){if(_0x133753){_0x38bc23=_0x133753;_0x13b3c6['model']=_['keys'](db[_0xa2e5('0x4c')][_0xa2e5('0x1d')]);_0x13b3c6[_0xa2e5('0x24')]=_[_0xa2e5('0x29')](_0x5cd7a9[_0xa2e5('0x24')]);_0x13b3c6[_0xa2e5('0x2b')]=_['intersection'](_0x13b3c6[_0xa2e5('0x2d')],_0x13b3c6[_0xa2e5('0x24')]);_0x35d322[_0xa2e5('0x2e')]=_[_0xa2e5('0x2c')](_0x13b3c6[_0xa2e5('0x2d')],qs[_0xa2e5('0x2f')](_0x5cd7a9['query'][_0xa2e5('0x2f')]));_0x35d322['attributes']=_0x35d322['attributes']['length']?_0x35d322[_0xa2e5('0x2e')]:_0x13b3c6[_0xa2e5('0x2d')];_0x35d322[_0xa2e5('0x41')]=qs[_0xa2e5('0x42')](_0x5cd7a9[_0xa2e5('0x24')][_0xa2e5('0x42')]);_0x35d322[_0xa2e5('0x22')]=qs[_0xa2e5('0x2b')](_[_0xa2e5('0x4d')](_0x5cd7a9[_0xa2e5('0x24')],_0x13b3c6[_0xa2e5('0x2b')]));if(_0x5cd7a9[_0xa2e5('0x24')]['filter']){_0x35d322['where']=_[_0xa2e5('0x31')](_0x35d322[_0xa2e5('0x22')],{'$or':_[_0xa2e5('0x1c')](_0x35d322[_0xa2e5('0x2e')],function(_0x450dbb){var _0x101afa={};_0x101afa[_0x450dbb]={'$like':'%'+_0x5cd7a9[_0xa2e5('0x24')][_0xa2e5('0x44')]+'%'};return _0x101afa;})});}_0x35d322=_[_0xa2e5('0x31')]({},_0x35d322,_0x5cd7a9[_0xa2e5('0x32')]);return _0x38bc23[_0xa2e5('0x4e')](_0x35d322);}})[_0xa2e5('0x13')](function(_0x4182c8){if(_0x4182c8){_0x59ee9e=_0x4182c8['length'];if(!_0x5cd7a9[_0xa2e5('0x24')]['hasOwnProperty'](_0xa2e5('0x40'))){_0x35d322[_0xa2e5('0x10')]=qs[_0xa2e5('0x10')](_0x5cd7a9[_0xa2e5('0x24')]['limit']);_0x35d322[_0xa2e5('0xe')]=qs[_0xa2e5('0xe')](_0x5cd7a9[_0xa2e5('0x24')][_0xa2e5('0xe')]);}return _0x38bc23[_0xa2e5('0x4e')](_0x35d322);}})[_0xa2e5('0x13')](function(_0x11bb3c){if(_0x11bb3c){return _0x11bb3c?{'count':_0x59ee9e,'rows':_0x11bb3c}:null;}})[_0xa2e5('0x13')](respondWithResult(_0x3dba64,null))[_0xa2e5('0x26')](handleError(_0x3dba64,null));};exports[_0xa2e5('0x4f')]=function(_0xd3b153,_0x2b84b5){var _0x507e80=_0xd3b153[_0xa2e5('0x3a')]['ids'];return db[_0xa2e5('0x4c')]['findAll']({'where':{'id':_0x507e80},'attributes':['id'],'include':[{'model':db[_0xa2e5('0x45')],'as':'Agents','attributes':['id',_0xa2e5('0x1a'),'online',_0xa2e5('0x50'),_0xa2e5('0x51')],'raw':!![]}]})['then'](function(_0x4763b7){if(_0x4763b7){var _0x446803=_['flatMap'](_0x4763b7,function(_0x594c60){var _0x502b59=_0x594c60[_0xa2e5('0x14')]({'plain':!![]});return _0x502b59[_0xa2e5('0x52')];});return db[_0xa2e5('0x2a')][_0xa2e5('0x36')]({'where':{'id':_0xd3b153[_0xa2e5('0x28')]['id']}})[_0xa2e5('0x13')](function(_0x435558){return db[_0xa2e5('0x53')][_0xa2e5('0x54')](function(_0xa535cd){return _0x435558['addTeams'](_0x507e80,{'transaction':_0xa535cd})[_0xa2e5('0x13')](function(){return BPromise[_0xa2e5('0x55')](_0x446803,function(_0x5af0c2){return db[_0xa2e5('0x3d')][_0xa2e5('0x56')]({'where':{'UserId':_0x5af0c2['id'],'ChatQueueId':_0xd3b153['params']['id']},'transaction':_0xa535cd});});})[_0xa2e5('0x13')](function(){_0x446803[_0xa2e5('0x57')](function(_0x49e8a8){socket[_0xa2e5('0x58')](_0xa2e5('0x59'),{'UserId':_0x49e8a8['id'],'ChatQueueId':_0x435558['id']});});});});});}})[_0xa2e5('0x13')](respondWithStatusCode(_0x2b84b5,null))[_0xa2e5('0x26')](handleError(_0x2b84b5,null));};exports[_0xa2e5('0x5a')]=function(_0x18e8dd,_0xa8b922){return db[_0xa2e5('0x4c')][_0xa2e5('0x25')]({'where':{'id':_0x18e8dd[_0xa2e5('0x24')][_0xa2e5('0x5b')]},'attributes':['id'],'include':[{'model':db[_0xa2e5('0x45')],'as':_0xa2e5('0x52'),'attributes':['id'],'raw':!![]}]})[_0xa2e5('0x13')](handleEntityNotFound(_0xa8b922,null))[_0xa2e5('0x13')](function(_0x2556a4){var _0x5997eb=_['map'](_0x2556a4,'id');var _0x279f03=[];var _0x334aeb=[];var _0x34f5bb=squel[_0xa2e5('0x5c')]();_0x34f5bb['field']('tq.TeamId')[_0xa2e5('0x5d')](_0xa2e5('0x5e'),'tq')[_0xa2e5('0x5f')]('user_has_teams','ut',_0xa2e5('0x60'))[_0xa2e5('0x22')](_0xa2e5('0x61'),_0x18e8dd[_0xa2e5('0x28')]['id']);for(var _0x18c51=0x0;_0x18c51<_0x2556a4['length'];_0x18c51+=0x1){let _0x3c4177=_0x2556a4[_0x18c51];for(var _0x55e20e=0x0;_0x55e20e<_0x3c4177['Agents'][_0xa2e5('0x3e')];_0x55e20e+=0x1){let _0x15d694=_0x3c4177[_0xa2e5('0x52')][_0x55e20e];var _0x3fddbe=_0x34f5bb[_0xa2e5('0x62')]();_0x3fddbe[_0xa2e5('0x22')](_0xa2e5('0x63'),_0x15d694['id']);_0x334aeb[_0xa2e5('0x64')](db[_0xa2e5('0x53')][_0xa2e5('0x24')](_0x3fddbe['toString'](),{'type':db[_0xa2e5('0x53')][_0xa2e5('0x65')]['SELECT']})['then'](function(_0x569ac3){if(_0x569ac3[_0xa2e5('0x3e')]===0x1){return _0x15d694['id'];}else{var _0xea878=_['every'](_[_0xa2e5('0x1c')](_0x569ac3,_0xa2e5('0x66')),function(_0x50190c){return _['includes'](_0x5997eb,_0x50190c);});if(_0xea878){return _0x15d694['id'];}}}));}}return BPromise[_0xa2e5('0x67')](_0x334aeb)[_0xa2e5('0x13')](function(_0x498e2c){_0x279f03=_(_0x279f03)['union'](_0x498e2c)[_0xa2e5('0x68')]()[_0xa2e5('0x69')]();return db['ChatQueue'][_0xa2e5('0x36')]({'where':{'id':_0x18e8dd['params']['id']}})[_0xa2e5('0x13')](function(_0x36f8cd){return db[_0xa2e5('0x53')][_0xa2e5('0x54')](function(_0x2816f1){return _0x36f8cd['removeTeams'](_0x18e8dd[_0xa2e5('0x24')][_0xa2e5('0x5b')],{'transaction':_0x2816f1})[_0xa2e5('0x13')](function(){if(!_[_0xa2e5('0x6a')](_0x279f03)){return _0x36f8cd['removeAgents'](_0x279f03,{'transaction':_0x2816f1});}})[_0xa2e5('0x13')](function(){_0x279f03['forEach'](function(_0x5d1db3){socket[_0xa2e5('0x58')](_0xa2e5('0x6b'),{'UserId':_0x5d1db3,'ChatQueueId':_0x36f8cd['id']});});});});});});})['then'](respondWithStatusCode(_0xa8b922,null))[_0xa2e5('0x26')](handleError(_0xa8b922,null));};exports['addAgents']=function(_0x5aa27a,_0x2b42bd){return db[_0xa2e5('0x2a')][_0xa2e5('0x36')]({'where':{'id':_0x5aa27a[_0xa2e5('0x28')]['id']}})[_0xa2e5('0x13')](handleEntityNotFound(_0x2b42bd,null))[_0xa2e5('0x13')](function(_0x39c316){if(_0x39c316){return _0x39c316[_0xa2e5('0x6c')](_0x5aa27a[_0xa2e5('0x3a')][_0xa2e5('0x5b')],_[_0xa2e5('0x6d')](_0x5aa27a[_0xa2e5('0x3a')],[_0xa2e5('0x5b'),'id'])||{})[_0xa2e5('0x6e')](function(_0x4323f7){for(var _0x38641c=0x0;_0x38641c<_0x5aa27a[_0xa2e5('0x3a')]['ids'][_0xa2e5('0x3e')];_0x38641c+=0x1){socket[_0xa2e5('0x58')](_0xa2e5('0x59'),{'UserId':Number(_0x5aa27a[_0xa2e5('0x3a')][_0xa2e5('0x5b')][_0x38641c]),'ChatQueueId':Number(_0x5aa27a[_0xa2e5('0x28')]['id'])});}return _0x4323f7;});}})[_0xa2e5('0x13')](respondWithResult(_0x2b42bd,null))['catch'](handleError(_0x2b42bd,null));};exports[_0xa2e5('0x6f')]=function(_0x9a17c8,_0xabde46){return db[_0xa2e5('0x2a')][_0xa2e5('0x36')]({'where':{'id':_0x9a17c8[_0xa2e5('0x28')]['id']}})[_0xa2e5('0x13')](handleEntityNotFound(_0xabde46,null))[_0xa2e5('0x13')](function(_0xaf9ee1){if(_0xaf9ee1){return _0xaf9ee1[_0xa2e5('0x6f')](_0x9a17c8['query'][_0xa2e5('0x5b')])[_0xa2e5('0x13')](function(){if(_[_0xa2e5('0x70')](_0x9a17c8[_0xa2e5('0x24')][_0xa2e5('0x5b')])){for(var _0x476e97=0x0;_0x476e97<_0x9a17c8['query'][_0xa2e5('0x5b')]['length'];_0x476e97+=0x1){socket[_0xa2e5('0x58')]('userChatQueue:remove',{'UserId':Number(_0x9a17c8['query'][_0xa2e5('0x5b')][_0x476e97]),'ChatQueueId':Number(_0x9a17c8[_0xa2e5('0x28')]['id'])});}}else{socket['emit'](_0xa2e5('0x6b'),{'UserId':Number(_0x9a17c8[_0xa2e5('0x24')]['ids']),'ChatQueueId':Number(_0x9a17c8[_0xa2e5('0x28')]['id'])});}});}})[_0xa2e5('0x13')](respondWithStatusCode(_0xabde46,null))[_0xa2e5('0x26')](handleError(_0xabde46,null));};exports[_0xa2e5('0x71')]=function(_0x416327,_0x438bfe){var _0x331675={};var _0x4a8ed0={};var _0x3ff9e9;var _0x40dd9e;return db['ChatQueue'][_0xa2e5('0x3c')]({'where':{'id':_0x416327[_0xa2e5('0x28')]['id']}})[_0xa2e5('0x13')](handleEntityNotFound(_0x438bfe,null))[_0xa2e5('0x13')](function(_0x336b48){if(_0x336b48){_0x3ff9e9=_0x336b48;_0x4a8ed0[_0xa2e5('0x2d')]=_['keys'](db[_0xa2e5('0x45')][_0xa2e5('0x1d')]);_0x4a8ed0[_0xa2e5('0x24')]=_[_0xa2e5('0x29')](_0x416327[_0xa2e5('0x24')]);_0x4a8ed0['filters']=_[_0xa2e5('0x2c')](_0x4a8ed0[_0xa2e5('0x2d')],_0x4a8ed0[_0xa2e5('0x24')]);_0x331675['attributes']=_['intersection'](_0x4a8ed0[_0xa2e5('0x2d')],qs[_0xa2e5('0x2f')](_0x416327[_0xa2e5('0x24')][_0xa2e5('0x2f')]));_0x331675['attributes']=_0x331675[_0xa2e5('0x2e')][_0xa2e5('0x3e')]?_0x331675['attributes']:_0x4a8ed0[_0xa2e5('0x2d')];_0x331675[_0xa2e5('0x41')]=qs[_0xa2e5('0x42')](_0x416327[_0xa2e5('0x24')]['sort']);_0x331675['where']=qs[_0xa2e5('0x2b')](_[_0xa2e5('0x4d')](_0x416327[_0xa2e5('0x24')],_0x4a8ed0['filters']));if(_0x416327['query'][_0xa2e5('0x44')]){_0x331675[_0xa2e5('0x22')]=_[_0xa2e5('0x31')](_0x331675[_0xa2e5('0x22')],{'$or':_[_0xa2e5('0x1c')](_0x331675[_0xa2e5('0x2e')],function(_0x44f1af){var _0x3914ce={};_0x3914ce[_0x44f1af]={'$like':'%'+_0x416327[_0xa2e5('0x24')][_0xa2e5('0x44')]+'%'};return _0x3914ce;})});}_0x331675=_[_0xa2e5('0x31')]({},_0x331675,_0x416327[_0xa2e5('0x32')]);return _0x3ff9e9[_0xa2e5('0x71')](_0x331675);}})[_0xa2e5('0x13')](function(_0x5693f8){if(_0x5693f8){_0x40dd9e=_0x5693f8[_0xa2e5('0x3e')];if(!_0x416327[_0xa2e5('0x24')][_0xa2e5('0x3f')](_0xa2e5('0x40'))){_0x331675[_0xa2e5('0x10')]=qs[_0xa2e5('0x10')](_0x416327['query'][_0xa2e5('0x10')]);_0x331675[_0xa2e5('0xe')]=qs[_0xa2e5('0xe')](_0x416327['query'][_0xa2e5('0xe')]);}return _0x3ff9e9[_0xa2e5('0x71')](_0x331675);}})['then'](function(_0x278555){if(_0x278555){return _0x278555?{'count':_0x40dd9e,'rows':_0x278555}:null;}})[_0xa2e5('0x13')](respondWithResult(_0x438bfe,null))[_0xa2e5('0x26')](handleError(_0x438bfe,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 540f1d9..b95392f 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 _0xa8cb=['events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x556c0b,_0x10238c){var _0x354a90=function(_0x5314b6){while(--_0x5314b6){_0x556c0b['push'](_0x556c0b['shift']());}};_0x354a90(++_0x10238c);}(_0xa8cb,0x1c3));var _0xba8c=function(_0x24a65d,_0x5112bc){_0x24a65d=_0x24a65d-0x0;var _0x1a7a42=_0xa8cb[_0x24a65d];return _0x1a7a42;};'use strict';var EventEmitter=require(_0xba8c('0x0'));var ChatQueue=require(_0xba8c('0x1'))['db'][_0xba8c('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xba8c('0x3')](0x0);var events={'afterCreate':_0xba8c('0x4'),'afterUpdate':_0xba8c('0x5'),'afterDestroy':_0xba8c('0x6')};function emitEvent(_0x4aad5c){return function(_0x561818,_0x15c8dc,_0x50257b){ChatQueueEvents[_0xba8c('0x7')](_0x4aad5c+':'+_0x561818['id'],_0x561818);ChatQueueEvents[_0xba8c('0x7')](_0x4aad5c,_0x561818);_0x50257b(null);};}for(var e in events){if(events[_0xba8c('0x8')](e)){var event=events[e];ChatQueue[_0xba8c('0x9')](e,emitEvent(event));}}module[_0xba8c('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0x1cd5=['hasOwnProperty','hook','exports','events','setMaxListeners','update','remove','emit'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x1cd5,0x193));var _0x51cd=function(_0x42331d,_0x324fe0){_0x42331d=_0x42331d-0x0;var _0x4b0c71=_0x1cd5[_0x42331d];return _0x4b0c71;};'use strict';var EventEmitter=require(_0x51cd('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x51cd('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x51cd('0x2'),'afterDestroy':_0x51cd('0x3')};function emitEvent(_0x2fdfa5){return function(_0x19c74f,_0x538b10,_0x2bd804){ChatQueueEvents[_0x51cd('0x4')](_0x2fdfa5+':'+_0x19c74f['id'],_0x19c74f);ChatQueueEvents[_0x51cd('0x4')](_0x2fdfa5,_0x19c74f);_0x2bd804(null);};}for(var e in events){if(events[_0x51cd('0x5')](e)){var event=events[e];ChatQueue[_0x51cd('0x6')](e,emitEvent(event));}}module[_0x51cd('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 50bccad..39cd6e8 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 _0x5b9d=['bluebird','request-promise','path','../../config/environment','./chatQueue.attributes','chat_queues','lodash','util','../../config/logger','api'];(function(_0x20df69,_0x3c71dd){var _0x4d6cd2=function(_0x546eaf){while(--_0x546eaf){_0x20df69['push'](_0x20df69['shift']());}};_0x4d6cd2(++_0x3c71dd);}(_0x5b9d,0x1dc));var _0xd5b9=function(_0x84ce83,_0x98461d){_0x84ce83=_0x84ce83-0x0;var _0x4490be=_0x5b9d[_0x84ce83];return _0x4490be;};'use strict';var _=require(_0xd5b9('0x0'));var util=require(_0xd5b9('0x1'));var logger=require(_0xd5b9('0x2'))(_0xd5b9('0x3'));var moment=require('moment');var BPromise=require(_0xd5b9('0x4'));var rp=require(_0xd5b9('0x5'));var fs=require('fs');var path=require(_0xd5b9('0x6'));var rimraf=require('rimraf');var config=require(_0xd5b9('0x7'));var attributes=require(_0xd5b9('0x8'));module['exports']=function(_0x5c8702,_0x5d9c22){return _0x5c8702['define']('ChatQueue',attributes,{'tableName':_0xd5b9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56b9=['../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3809e3,_0x132e51){var _0x334579=function(_0x109a77){while(--_0x109a77){_0x3809e3['push'](_0x3809e3['shift']());}};_0x334579(++_0x132e51);}(_0x56b9,0x1e2));var _0x956b=function(_0x4f964a,_0x41f80b){_0x4f964a=_0x4f964a-0x0;var _0x22142b=_0x56b9[_0x4f964a];return _0x22142b;};'use strict';var _=require(_0x956b('0x0'));var util=require(_0x956b('0x1'));var logger=require(_0x956b('0x2'))(_0x956b('0x3'));var moment=require(_0x956b('0x4'));var BPromise=require('bluebird');var rp=require(_0x956b('0x5'));var fs=require('fs');var path=require(_0x956b('0x6'));var rimraf=require(_0x956b('0x7'));var config=require(_0x956b('0x8'));var attributes=require(_0x956b('0x9'));module[_0x956b('0xa')]=function(_0x57ace5,_0x4c6033){return _0x57ace5[_0x956b('0xb')](_0x956b('0xc'),attributes,{'tableName':_0x956b('0xd'),'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 2f01ecf..fe0f213 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 _0xf960=['../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','options','raw','where','attributes','include','map','model','ShowChatQueue','find','lodash','moment','randomstring','ioredis'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0xf960,0x193));var _0x0f96=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0xf960[_0x18cac4];return _0x2227c6;};'use strict';var _=require(_0x0f96('0x0'));var util=require('util');var moment=require(_0x0f96('0x1'));var BPromise=require('bluebird');var rs=require(_0x0f96('0x2'));var fs=require('fs');var Redis=require(_0x0f96('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0f96('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x0f96('0x5'));var jayson=require(_0x0f96('0x6'));var client=jayson[_0x0f96('0x7')][_0x0f96('0x8')]({'port':0x232a});config[_0x0f96('0x9')]=_['defaults'](config['redis'],{'host':_0x0f96('0xa'),'port':0x18eb});var socket=require(_0x0f96('0xb'))(new Redis(config[_0x0f96('0x9')]));require(_0x0f96('0xc'))[_0x0f96('0xd')](socket);function respondWithRpcPromise(_0x624bbc,_0x5686ae,_0x14ba11){return new BPromise(function(_0x568991,_0xe8afc){return client['request'](_0x624bbc,_0x14ba11)[_0x0f96('0xe')](function(_0x3cc1c8){logger[_0x0f96('0xf')](_0x0f96('0x10'),_0x5686ae,'request\x20sent');logger[_0x0f96('0x11')](_0x0f96('0x12'),_0x5686ae,_0x0f96('0x13'),JSON[_0x0f96('0x14')](_0x3cc1c8));if(_0x3cc1c8['error']){if(_0x3cc1c8[_0x0f96('0x15')][_0x0f96('0x16')]===0x1f4){logger[_0x0f96('0x15')](_0x0f96('0x10'),_0x5686ae,_0x3cc1c8[_0x0f96('0x15')][_0x0f96('0x17')]);return _0xe8afc(_0x3cc1c8['error'][_0x0f96('0x17')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x5686ae,_0x3cc1c8[_0x0f96('0x15')][_0x0f96('0x17')]);return _0x568991(_0x3cc1c8[_0x0f96('0x15')][_0x0f96('0x17')]);}else{logger[_0x0f96('0xf')](_0x0f96('0x10'),_0x5686ae,_0x0f96('0x13'));_0x568991(_0x3cc1c8[_0x0f96('0x18')][_0x0f96('0x17')]);}})[_0x0f96('0x19')](function(_0x151e0d){logger[_0x0f96('0x15')](_0x0f96('0x10'),_0x5686ae,_0x151e0d);_0xe8afc(_0x151e0d);});});}exports[_0x0f96('0x1a')]=function(_0x481c5b){var _0x1034b8=this;return new Promise(function(_0x3e044d,_0x125b50){return db[_0x0f96('0x1b')]['findAll']({'raw':_0x481c5b[_0x0f96('0x1c')]?_0x481c5b[_0x0f96('0x1c')][_0x0f96('0x1d')]===undefined?!![]:![]:!![],'where':_0x481c5b['options']?_0x481c5b[_0x0f96('0x1c')][_0x0f96('0x1e')]||null:null,'attributes':_0x481c5b['options']?_0x481c5b[_0x0f96('0x1c')][_0x0f96('0x1f')]||null:null,'limit':_0x481c5b[_0x0f96('0x1c')]?_0x481c5b[_0x0f96('0x1c')]['limit']||null:null,'include':_0x481c5b[_0x0f96('0x1c')]?_0x481c5b[_0x0f96('0x1c')][_0x0f96('0x20')]?_[_0x0f96('0x21')](_0x481c5b[_0x0f96('0x1c')][_0x0f96('0x20')],function(_0x3cfca7){return{'model':db[_0x3cfca7['model']],'as':_0x3cfca7['as'],'attributes':_0x3cfca7[_0x0f96('0x1f')],'include':_0x3cfca7[_0x0f96('0x20')]?_[_0x0f96('0x21')](_0x3cfca7['include'],function(_0x43128e){return{'model':db[_0x43128e[_0x0f96('0x22')]],'as':_0x43128e['as'],'attributes':_0x43128e[_0x0f96('0x1f')],'include':_0x43128e[_0x0f96('0x20')]?_[_0x0f96('0x21')](_0x43128e['include'],function(_0x2961e1){return{'model':db[_0x2961e1[_0x0f96('0x22')]],'as':_0x2961e1['as'],'attributes':_0x2961e1[_0x0f96('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0f96('0xe')](function(_0xcb71bd){logger[_0x0f96('0xf')](_0x0f96('0x1a'),_0x481c5b);logger[_0x0f96('0x11')](_0x0f96('0x1a'),_0x481c5b,JSON[_0x0f96('0x14')](_0xcb71bd));_0x3e044d(_0xcb71bd);})['catch'](function(_0x12b6f4){logger[_0x0f96('0x15')]('GetChatQueue',_0x12b6f4[_0x0f96('0x17')],_0x481c5b);_0x125b50(_0x1034b8[_0x0f96('0x15')](0x1f4,_0x12b6f4['message']));});});};exports[_0x0f96('0x23')]=function(_0x2abcd4){var _0x36e2a6=this;return new Promise(function(_0x44bcab,_0x107072){return db[_0x0f96('0x1b')][_0x0f96('0x24')]({'raw':_0x2abcd4['options']?_0x2abcd4['options'][_0x0f96('0x1d')]===undefined?!![]:![]:!![],'where':_0x2abcd4['options']?_0x2abcd4['options']['where']||null:null,'attributes':_0x2abcd4[_0x0f96('0x1c')]?_0x2abcd4[_0x0f96('0x1c')][_0x0f96('0x1f')]||null:null,'include':_0x2abcd4['options']?_0x2abcd4[_0x0f96('0x1c')][_0x0f96('0x20')]?_[_0x0f96('0x21')](_0x2abcd4[_0x0f96('0x1c')][_0x0f96('0x20')],function(_0x23f207){return{'model':db[_0x23f207[_0x0f96('0x22')]],'as':_0x23f207['as'],'attributes':_0x23f207[_0x0f96('0x1f')],'include':_0x23f207['include']?_[_0x0f96('0x21')](_0x23f207['include'],function(_0x3269ff){return{'model':db[_0x3269ff[_0x0f96('0x22')]],'as':_0x3269ff['as'],'attributes':_0x3269ff[_0x0f96('0x1f')],'include':_0x3269ff[_0x0f96('0x20')]?_[_0x0f96('0x21')](_0x3269ff[_0x0f96('0x20')],function(_0x46cd68){return{'model':db[_0x46cd68['model']],'as':_0x46cd68['as'],'attributes':_0x46cd68['attributes']};}):[]};}):[]};}):[]:[]})[_0x0f96('0xe')](function(_0x3774ed){logger[_0x0f96('0xf')](_0x0f96('0x23'),_0x2abcd4);logger['debug'](_0x0f96('0x23'),_0x2abcd4,JSON[_0x0f96('0x14')](_0x3774ed));_0x44bcab(_0x3774ed);})[_0x0f96('0x19')](function(_0x19a832){logger[_0x0f96('0x15')](_0x0f96('0x23'),_0x19a832[_0x0f96('0x17')],_0x2abcd4);_0x107072(_0x36e2a6[_0x0f96('0x15')](0x1f4,_0x19a832[_0x0f96('0x17')]));});});}; \ No newline at end of file +var _0xbd5f=['request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatQueue','findAll','options','raw','where','attributes','limit','include','model','map','debug','GetChatQueue','catch','ShowChatQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','register'];(function(_0x38f295,_0x48ecc3){var _0x4450bc=function(_0x294a4f){while(--_0x294a4f){_0x38f295['push'](_0x38f295['shift']());}};_0x4450bc(++_0x48ecc3);}(_0xbd5f,0x1c7));var _0xfbd5=function(_0x356db4,_0x36dbfe){_0x356db4=_0x356db4-0x0;var _0x2a9100=_0xbd5f[_0x356db4];return _0x2a9100;};'use strict';var _=require(_0xfbd5('0x0'));var util=require(_0xfbd5('0x1'));var moment=require(_0xfbd5('0x2'));var BPromise=require('bluebird');var rs=require(_0xfbd5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfbd5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbd5('0x5'))(_0xfbd5('0x6'));var config=require(_0xfbd5('0x7'));var jayson=require(_0xfbd5('0x8'));var client=jayson[_0xfbd5('0x9')][_0xfbd5('0xa')]({'port':0x232a});config[_0xfbd5('0xb')]=_['defaults'](config[_0xfbd5('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfbd5('0xb')]));require('./chatQueue.socket')[_0xfbd5('0xc')](socket);function respondWithRpcPromise(_0x1cf660,_0x28b8bd,_0x541986){return new BPromise(function(_0x5376c7,_0x4ea0b9){return client[_0xfbd5('0xd')](_0x1cf660,_0x541986)[_0xfbd5('0xe')](function(_0x1b57af){logger[_0xfbd5('0xf')](_0xfbd5('0x10'),_0x28b8bd,_0xfbd5('0x11'));logger['debug'](_0xfbd5('0x12'),_0x28b8bd,'request\x20sent',JSON[_0xfbd5('0x13')](_0x1b57af));if(_0x1b57af[_0xfbd5('0x14')]){if(_0x1b57af['error']['code']===0x1f4){logger[_0xfbd5('0x14')](_0xfbd5('0x10'),_0x28b8bd,_0x1b57af[_0xfbd5('0x14')][_0xfbd5('0x15')]);return _0x4ea0b9(_0x1b57af[_0xfbd5('0x14')][_0xfbd5('0x15')]);}logger[_0xfbd5('0x14')](_0xfbd5('0x10'),_0x28b8bd,_0x1b57af['error'][_0xfbd5('0x15')]);return _0x5376c7(_0x1b57af[_0xfbd5('0x14')][_0xfbd5('0x15')]);}else{logger['info'](_0xfbd5('0x10'),_0x28b8bd,_0xfbd5('0x11'));_0x5376c7(_0x1b57af['result'][_0xfbd5('0x15')]);}})['catch'](function(_0x5b0401){logger[_0xfbd5('0x14')](_0xfbd5('0x10'),_0x28b8bd,_0x5b0401);_0x4ea0b9(_0x5b0401);});});}exports['GetChatQueue']=function(_0x220bc1){var _0x2fc40c=this;return new Promise(function(_0x5d74ed,_0x1a2ee7){return db[_0xfbd5('0x16')][_0xfbd5('0x17')]({'raw':_0x220bc1[_0xfbd5('0x18')]?_0x220bc1[_0xfbd5('0x18')][_0xfbd5('0x19')]===undefined?!![]:![]:!![],'where':_0x220bc1[_0xfbd5('0x18')]?_0x220bc1[_0xfbd5('0x18')][_0xfbd5('0x1a')]||null:null,'attributes':_0x220bc1['options']?_0x220bc1[_0xfbd5('0x18')][_0xfbd5('0x1b')]||null:null,'limit':_0x220bc1[_0xfbd5('0x18')]?_0x220bc1[_0xfbd5('0x18')][_0xfbd5('0x1c')]||null:null,'include':_0x220bc1[_0xfbd5('0x18')]?_0x220bc1[_0xfbd5('0x18')][_0xfbd5('0x1d')]?_['map'](_0x220bc1['options']['include'],function(_0x2a6f8c){return{'model':db[_0x2a6f8c[_0xfbd5('0x1e')]],'as':_0x2a6f8c['as'],'attributes':_0x2a6f8c[_0xfbd5('0x1b')],'include':_0x2a6f8c['include']?_['map'](_0x2a6f8c[_0xfbd5('0x1d')],function(_0x908fb5){return{'model':db[_0x908fb5[_0xfbd5('0x1e')]],'as':_0x908fb5['as'],'attributes':_0x908fb5[_0xfbd5('0x1b')],'include':_0x908fb5[_0xfbd5('0x1d')]?_[_0xfbd5('0x1f')](_0x908fb5[_0xfbd5('0x1d')],function(_0x24ec67){return{'model':db[_0x24ec67['model']],'as':_0x24ec67['as'],'attributes':_0x24ec67[_0xfbd5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfbd5('0xe')](function(_0x195f41){logger[_0xfbd5('0xf')]('GetChatQueue',_0x220bc1);logger[_0xfbd5('0x20')](_0xfbd5('0x21'),_0x220bc1,JSON[_0xfbd5('0x13')](_0x195f41));_0x5d74ed(_0x195f41);})[_0xfbd5('0x22')](function(_0x27af3f){logger[_0xfbd5('0x14')](_0xfbd5('0x21'),_0x27af3f[_0xfbd5('0x15')],_0x220bc1);_0x1a2ee7(_0x2fc40c[_0xfbd5('0x14')](0x1f4,_0x27af3f['message']));});});};exports[_0xfbd5('0x23')]=function(_0x29f410){var _0x45e067=this;return new Promise(function(_0x3a51c7,_0x328f81){return db[_0xfbd5('0x16')]['find']({'raw':_0x29f410[_0xfbd5('0x18')]?_0x29f410[_0xfbd5('0x18')][_0xfbd5('0x19')]===undefined?!![]:![]:!![],'where':_0x29f410[_0xfbd5('0x18')]?_0x29f410['options']['where']||null:null,'attributes':_0x29f410['options']?_0x29f410[_0xfbd5('0x18')][_0xfbd5('0x1b')]||null:null,'include':_0x29f410[_0xfbd5('0x18')]?_0x29f410['options']['include']?_[_0xfbd5('0x1f')](_0x29f410[_0xfbd5('0x18')]['include'],function(_0x52d022){return{'model':db[_0x52d022[_0xfbd5('0x1e')]],'as':_0x52d022['as'],'attributes':_0x52d022[_0xfbd5('0x1b')],'include':_0x52d022[_0xfbd5('0x1d')]?_[_0xfbd5('0x1f')](_0x52d022['include'],function(_0x3f872c){return{'model':db[_0x3f872c[_0xfbd5('0x1e')]],'as':_0x3f872c['as'],'attributes':_0x3f872c[_0xfbd5('0x1b')],'include':_0x3f872c['include']?_[_0xfbd5('0x1f')](_0x3f872c[_0xfbd5('0x1d')],function(_0x5204d1){return{'model':db[_0x5204d1[_0xfbd5('0x1e')]],'as':_0x5204d1['as'],'attributes':_0x5204d1[_0xfbd5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfbd5('0xe')](function(_0x4baeff){logger[_0xfbd5('0xf')](_0xfbd5('0x23'),_0x29f410);logger[_0xfbd5('0x20')](_0xfbd5('0x23'),_0x29f410,JSON[_0xfbd5('0x13')](_0x4baeff));_0x3a51c7(_0x4baeff);})['catch'](function(_0xbcb78e){logger[_0xfbd5('0x14')](_0xfbd5('0x23'),_0xbcb78e[_0xfbd5('0x15')],_0x29f410);_0x328f81(_0x45e067[_0xfbd5('0x14')](0x1f4,_0xbcb78e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 679804e..b5a271d 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 _0x9bde=['chatQueue:','save','update','emit','removeListener','register','length'];(function(_0x441563,_0x1d4a28){var _0x2369ec=function(_0x1f97ba){while(--_0x1f97ba){_0x441563['push'](_0x441563['shift']());}};_0x2369ec(++_0x1d4a28);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4973aa,_0x478aea){_0x4973aa=_0x4973aa-0x0;var _0x1dd2b0=_0x9bde[_0x4973aa];return _0x1dd2b0;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xe9bd('0x0'),'remove',_0xe9bd('0x1')];function createListener(_0x4c63ca,_0x51786f){return function(_0x3005aa){_0x51786f[_0xe9bd('0x2')](_0x4c63ca,_0x3005aa);};}function removeListener(_0x1c1b34,_0x10822d){return function(){ChatQueueEvents[_0xe9bd('0x3')](_0x1c1b34,_0x10822d);};}exports[_0xe9bd('0x4')]=function(_0x4fd7b8){for(var _0x4763e9=0x0,_0x5f18fe=events[_0xe9bd('0x5')];_0x4763e9<_0x5f18fe;_0x4763e9++){var _0xa66ae2=events[_0x4763e9];var _0x2d5c75=createListener(_0xe9bd('0x6')+_0xa66ae2,_0x4fd7b8);ChatQueueEvents['on'](_0xa66ae2,_0x2d5c75);}}; \ No newline at end of file +var _0x207c=['length','chatQueue:','save','remove','update','emit'];(function(_0x3f7e45,_0x4121c){var _0x4d6882=function(_0x1fcfa2){while(--_0x1fcfa2){_0x3f7e45['push'](_0x3f7e45['shift']());}};_0x4d6882(++_0x4121c);}(_0x207c,0x1e8));var _0xc207=function(_0x303d9d,_0x363884){_0x303d9d=_0x303d9d-0x0;var _0x4ccd15=_0x207c[_0x303d9d];return _0x4ccd15;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xc207('0x0'),_0xc207('0x1'),_0xc207('0x2')];function createListener(_0xaaba3d,_0x2b40be){return function(_0x12f1f2){_0x2b40be[_0xc207('0x3')](_0xaaba3d,_0x12f1f2);};}function removeListener(_0x4b9daa,_0x38ff02){return function(){ChatQueueEvents['removeListener'](_0x4b9daa,_0x38ff02);};}exports['register']=function(_0x55023e){for(var _0xc88789=0x0,_0x314561=events[_0xc207('0x4')];_0xc88789<_0x314561;_0xc88789++){var _0x59ff6f=events[_0xc88789];var _0x25cb97=createListener(_0xc207('0x5')+_0x59ff6f,_0x55023e);ChatQueueEvents['on'](_0x59ff6f,_0x25cb97);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 036c53c..0b8edfc 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 _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x5fc3,0xa8));var _0x35fc=function(_0x7b173,_0x539d7f){_0x7b173=_0x7b173-0x0;var _0x1c598c=_0x5fc3[_0x7b173];return _0x1c598c;};'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/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file +var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3e74,0x175));var _0x43e7=function(_0x5bbd3b,_0x4616a3){_0x5bbd3b=_0x5bbd3b-0x0;var _0x488799=_0x3e74[_0x5bbd3b];return _0x488799;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 9f37c5d..c68b3b9 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 _0x4b40=['exports','STRING','DATE','sequelize'];(function(_0x2d87a5,_0xd11824){var _0x197c5f=function(_0x489d1d){while(--_0x489d1d){_0x2d87a5['push'](_0x2d87a5['shift']());}};_0x197c5f(++_0xd11824);}(_0x4b40,0x1f3));var _0x04b4=function(_0x3da5ed,_0x2bed0a){_0x3da5ed=_0x3da5ed-0x0;var _0x3c5723=_0x4b40[_0x3da5ed];return _0x3c5723;};'use strict';var moment=require('moment');var Sequelize=require(_0x04b4('0x0'));module[_0x04b4('0x1')]={'uniqueid':{'type':Sequelize[_0x04b4('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x04b4('0x2')]},'joinAt':{'type':Sequelize[_0x04b4('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x04b4('0x3')]},'exitAt':{'type':Sequelize[_0x04b4('0x3')]},'reason':{'type':Sequelize[_0x04b4('0x2')]}}; \ No newline at end of file +var _0xb2d8=['sequelize','exports','STRING','DATE'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xb2d8,0x94));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x8b2d('0x0'));module[_0x8b2d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8b2d('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8b2d('0x3')]},'acceptAt':{'type':Sequelize[_0x8b2d('0x3')]},'exitAt':{'type':Sequelize[_0x8b2d('0x3')]},'reason':{'type':Sequelize[_0x8b2d('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 526851e..b78238d 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 _0xf603=['moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','find','catch','body','describe','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x1c1c4d,_0x50a4c1){var _0x248419=function(_0x4338fe){while(--_0x4338fe){_0x1c1c4d['push'](_0x1c1c4d['shift']());}};_0x248419(++_0x50a4c1);}(_0xf603,0x124));var _0x3f60=function(_0x4bb214,_0x5b8720){_0x4bb214=_0x4bb214-0x0;var _0x3b91ac=_0xf603[_0x4bb214];return _0x3b91ac;};'use strict';var emlformat=require(_0x3f60('0x0'));var rimraf=require(_0x3f60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f60('0x2'));var rp=require(_0x3f60('0x3'));var moment=require(_0x3f60('0x4'));var BPromise=require(_0x3f60('0x5'));var Mustache=require(_0x3f60('0x6'));var util=require(_0x3f60('0x7'));var path=require(_0x3f60('0x8'));var sox=require(_0x3f60('0x9'));var csv=require(_0x3f60('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3f60('0xb'));var crypto=require(_0x3f60('0xc'));var jsforce=require(_0x3f60('0xd'));var deskjs=require(_0x3f60('0xe'));var toCsv=require(_0x3f60('0xa'));var querystring=require(_0x3f60('0xf'));var Papa=require(_0x3f60('0x10'));var Redis=require(_0x3f60('0x11'));var authService=require(_0x3f60('0x12'));var qs=require(_0x3f60('0x13'));var as=require(_0x3f60('0x14'));var hardwareService=require(_0x3f60('0x15'));var logger=require(_0x3f60('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3f60('0x17'));var db=require(_0x3f60('0x18'))['db'];function respondWithStatusCode(_0x2e79e8,_0x58e120){_0x58e120=_0x58e120||0xcc;return function(_0xeb6151){if(_0xeb6151){return _0x2e79e8[_0x3f60('0x19')](_0x58e120);}return _0x2e79e8['status'](_0x58e120)[_0x3f60('0x1a')]();};}function respondWithResult(_0x1b3e74,_0x53ec7a){_0x53ec7a=_0x53ec7a||0xc8;return function(_0x1ec7f4){if(_0x1ec7f4){return _0x1b3e74['status'](_0x53ec7a)[_0x3f60('0x1b')](_0x1ec7f4);}};}function respondWithFilteredResult(_0x2cd28f,_0x5e7718){return function(_0x3c0e9d){if(_0x3c0e9d){var _0x4e84b5=typeof _0x5e7718[_0x3f60('0x1c')]==='undefined'&&typeof _0x5e7718[_0x3f60('0x1d')]===_0x3f60('0x1e');var _0xbc26c=_0x3c0e9d[_0x3f60('0x1f')];var _0x3ae771=_0x4e84b5?0x0:_0x5e7718[_0x3f60('0x1c')];var _0x52aa44=_0x4e84b5?_0x3c0e9d[_0x3f60('0x1f')]:_0x5e7718[_0x3f60('0x1c')]+_0x5e7718[_0x3f60('0x1d')];var _0x9c845f;if(_0x52aa44>=_0xbc26c){_0x52aa44=_0xbc26c;_0x9c845f=0xc8;}else{_0x9c845f=0xce;}_0x2cd28f[_0x3f60('0x20')](_0x9c845f);return _0x2cd28f[_0x3f60('0x21')]('Content-Range',_0x3ae771+'-'+_0x52aa44+'/'+_0xbc26c)[_0x3f60('0x1b')](_0x3c0e9d);}return null;};}function patchUpdates(_0x2f1735){return function(_0x4dace9){try{jsonpatch[_0x3f60('0x22')](_0x4dace9,_0x2f1735,!![]);}catch(_0x2dba08){return BPromise[_0x3f60('0x23')](_0x2dba08);}return _0x4dace9[_0x3f60('0x24')]();};}function saveUpdates(_0x1d23bb,_0x1b161e){return function(_0x44b665){if(_0x44b665){return _0x44b665[_0x3f60('0x25')](_0x1d23bb)[_0x3f60('0x26')](function(_0x31847d){return _0x31847d;});}return null;};}function removeEntity(_0x3f6fa7,_0x35b8f6){return function(_0x1f9390){if(_0x1f9390){return _0x1f9390[_0x3f60('0x27')]()[_0x3f60('0x26')](function(){_0x3f6fa7['status'](0xcc)[_0x3f60('0x1a')]();});}};}function handleEntityNotFound(_0x3cdef4,_0x15315b){return function(_0x4581d6){if(!_0x4581d6){_0x3cdef4[_0x3f60('0x19')](0x194);}return _0x4581d6;};}function handleError(_0x36dfdb,_0xc106a9){_0xc106a9=_0xc106a9||0x1f4;return function(_0x23e265){logger['error'](_0x23e265[_0x3f60('0x28')]);if(_0x23e265[_0x3f60('0x29')]){delete _0x23e265[_0x3f60('0x29')];}_0x36dfdb[_0x3f60('0x20')](_0xc106a9)[_0x3f60('0x2a')](_0x23e265);};}exports[_0x3f60('0x2b')]=function(_0x39e14c,_0x4520a5){var _0x16b590={},_0x3cd0a7={},_0x2f1bc9={'count':0x0,'rows':[]};var _0x457e5b=_[_0x3f60('0x2c')](db[_0x3f60('0x2d')][_0x3f60('0x2e')],function(_0x14d83c){return{'name':_0x14d83c[_0x3f60('0x2f')],'type':_0x14d83c[_0x3f60('0x30')][_0x3f60('0x31')]};});_0x3cd0a7[_0x3f60('0x32')]=_[_0x3f60('0x2c')](_0x457e5b,_0x3f60('0x29'));_0x3cd0a7[_0x3f60('0x33')]=_[_0x3f60('0x34')](_0x39e14c[_0x3f60('0x33')]);_0x3cd0a7[_0x3f60('0x35')]=_[_0x3f60('0x36')](_0x3cd0a7[_0x3f60('0x32')],_0x3cd0a7[_0x3f60('0x33')]);_0x16b590[_0x3f60('0x37')]=_[_0x3f60('0x36')](_0x3cd0a7['model'],qs[_0x3f60('0x38')](_0x39e14c[_0x3f60('0x33')]['fields']));_0x16b590[_0x3f60('0x37')]=_0x16b590[_0x3f60('0x37')][_0x3f60('0x39')]?_0x16b590[_0x3f60('0x37')]:_0x3cd0a7['model'];if(!_0x39e14c[_0x3f60('0x33')][_0x3f60('0x3a')]('nolimit')){_0x16b590['limit']=qs[_0x3f60('0x1d')](_0x39e14c['query'][_0x3f60('0x1d')]);_0x16b590[_0x3f60('0x1c')]=qs[_0x3f60('0x1c')](_0x39e14c[_0x3f60('0x33')]['offset']);}_0x16b590['order']=qs[_0x3f60('0x3b')](_0x39e14c[_0x3f60('0x33')][_0x3f60('0x3b')]);_0x16b590[_0x3f60('0x3c')]=qs[_0x3f60('0x35')](_[_0x3f60('0x3d')](_0x39e14c['query'],_0x3cd0a7[_0x3f60('0x35')]),_0x457e5b);if(_0x39e14c['query'][_0x3f60('0x3e')]){_0x16b590['where']=_[_0x3f60('0x3f')](_0x16b590[_0x3f60('0x3c')],{'$or':_[_0x3f60('0x2c')](_0x457e5b,function(_0x466d05){if(_0x466d05[_0x3f60('0x30')]!=='VIRTUAL'){var _0x4fa98d={};_0x4fa98d[_0x466d05[_0x3f60('0x29')]]={'$like':'%'+_0x39e14c[_0x3f60('0x33')][_0x3f60('0x3e')]+'%'};return _0x4fa98d;}})});}_0x16b590=_['merge']({},_0x16b590,_0x39e14c[_0x3f60('0x40')]);var _0x42f82d={'where':_0x16b590['where']};return db['ChatQueueReport'][_0x3f60('0x1f')](_0x42f82d)[_0x3f60('0x26')](function(_0x3f2129){_0x2f1bc9[_0x3f60('0x1f')]=_0x3f2129;if(_0x39e14c[_0x3f60('0x33')]['includeAll']){_0x16b590[_0x3f60('0x41')]=[{'all':!![]}];}return db[_0x3f60('0x2d')][_0x3f60('0x42')](_0x16b590);})[_0x3f60('0x26')](function(_0x4c6346){_0x2f1bc9[_0x3f60('0x43')]=_0x4c6346;return _0x2f1bc9;})['then'](respondWithFilteredResult(_0x4520a5,_0x16b590))['catch'](handleError(_0x4520a5,null));};exports[_0x3f60('0x44')]=function(_0x20422a,_0x4ef8f2){var _0x5cfc2f={'raw':!![],'where':{'id':_0x20422a[_0x3f60('0x45')]['id']}},_0x4f0752={};_0x4f0752[_0x3f60('0x32')]=_['keys'](db['ChatQueueReport']['rawAttributes']);_0x4f0752[_0x3f60('0x33')]=_['keys'](_0x20422a['query']);_0x4f0752[_0x3f60('0x35')]=_[_0x3f60('0x36')](_0x4f0752['model'],_0x4f0752['query']);_0x5cfc2f[_0x3f60('0x37')]=_['intersection'](_0x4f0752[_0x3f60('0x32')],qs['fields'](_0x20422a[_0x3f60('0x33')][_0x3f60('0x38')]));_0x5cfc2f[_0x3f60('0x37')]=_0x5cfc2f[_0x3f60('0x37')][_0x3f60('0x39')]?_0x5cfc2f['attributes']:_0x4f0752[_0x3f60('0x32')];if(_0x20422a[_0x3f60('0x33')]['includeAll']){_0x5cfc2f['include']=[{'all':!![]}];}_0x5cfc2f=_[_0x3f60('0x3f')]({},_0x5cfc2f,_0x20422a[_0x3f60('0x40')]);return db[_0x3f60('0x2d')][_0x3f60('0x46')](_0x5cfc2f)[_0x3f60('0x26')](handleEntityNotFound(_0x4ef8f2,null))['then'](respondWithResult(_0x4ef8f2,null))[_0x3f60('0x47')](handleError(_0x4ef8f2,null));};exports['create']=function(_0xe5a2a6,_0x253d2f){return db[_0x3f60('0x2d')]['create'](_0xe5a2a6[_0x3f60('0x48')],{})[_0x3f60('0x26')](respondWithResult(_0x253d2f,0xc9))[_0x3f60('0x47')](handleError(_0x253d2f,null));};exports['update']=function(_0x217348,_0x55f75f){if(_0x217348[_0x3f60('0x48')]['id']){delete _0x217348[_0x3f60('0x48')]['id'];}return db[_0x3f60('0x2d')][_0x3f60('0x46')]({'where':{'id':_0x217348['params']['id']}})[_0x3f60('0x26')](handleEntityNotFound(_0x55f75f,null))[_0x3f60('0x26')](saveUpdates(_0x217348['body'],null))[_0x3f60('0x26')](respondWithResult(_0x55f75f,null))['catch'](handleError(_0x55f75f,null));};exports['destroy']=function(_0x4ce17d,_0x55dd97){return db['ChatQueueReport'][_0x3f60('0x46')]({'where':{'id':_0x4ce17d['params']['id']}})[_0x3f60('0x26')](handleEntityNotFound(_0x55dd97,null))[_0x3f60('0x26')](removeEntity(_0x55dd97,null))[_0x3f60('0x47')](handleError(_0x55dd97,null));};exports['describe']=function(_0x1f9921,_0x1c09a0){return db[_0x3f60('0x2d')][_0x3f60('0x49')]()[_0x3f60('0x26')](respondWithResult(_0x1c09a0,null))[_0x3f60('0x47')](handleError(_0x1c09a0,null));}; \ No newline at end of file +var _0x1db9=['merge','VIRTUAL','include','findAll','rows','show','keys','includeAll','find','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0x1db9,0x176));var _0x91db=function(_0x1f0f1b,_0x124a77){_0x1f0f1b=_0x1f0f1b-0x0;var _0x58a668=_0x1db9[_0x1f0f1b];return _0x58a668;};'use strict';var emlformat=require(_0x91db('0x0'));var rimraf=require(_0x91db('0x1'));var zipdir=require(_0x91db('0x2'));var jsonpatch=require(_0x91db('0x3'));var rp=require(_0x91db('0x4'));var moment=require(_0x91db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x91db('0x6'));var util=require(_0x91db('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x91db('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91db('0x9'));var squel=require(_0x91db('0xa'));var crypto=require(_0x91db('0xb'));var jsforce=require(_0x91db('0xc'));var deskjs=require(_0x91db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91db('0xe'));var Papa=require('papaparse');var Redis=require(_0x91db('0xf'));var authService=require(_0x91db('0x10'));var qs=require(_0x91db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91db('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x91db('0x13'));var licenseUtil=require(_0x91db('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x540c48,_0x2b9b98){_0x2b9b98=_0x2b9b98||0xcc;return function(_0x329277){if(_0x329277){return _0x540c48[_0x91db('0x15')](_0x2b9b98);}return _0x540c48[_0x91db('0x16')](_0x2b9b98)[_0x91db('0x17')]();};}function respondWithResult(_0x4c3124,_0x371158){_0x371158=_0x371158||0xc8;return function(_0x285052){if(_0x285052){return _0x4c3124[_0x91db('0x16')](_0x371158)[_0x91db('0x18')](_0x285052);}};}function respondWithFilteredResult(_0x2df307,_0x33b39d){return function(_0x260b56){if(_0x260b56){var _0x143bc4=typeof _0x33b39d[_0x91db('0x19')]===_0x91db('0x1a')&&typeof _0x33b39d[_0x91db('0x1b')]===_0x91db('0x1a');var _0x5f5440=_0x260b56[_0x91db('0x1c')];var _0x23d125=_0x143bc4?0x0:_0x33b39d[_0x91db('0x19')];var _0x42e66c=_0x143bc4?_0x260b56[_0x91db('0x1c')]:_0x33b39d[_0x91db('0x19')]+_0x33b39d['limit'];var _0x4ae820;if(_0x42e66c>=_0x5f5440){_0x42e66c=_0x5f5440;_0x4ae820=0xc8;}else{_0x4ae820=0xce;}_0x2df307[_0x91db('0x16')](_0x4ae820);return _0x2df307[_0x91db('0x1d')](_0x91db('0x1e'),_0x23d125+'-'+_0x42e66c+'/'+_0x5f5440)[_0x91db('0x18')](_0x260b56);}return null;};}function patchUpdates(_0x50cf9c){return function(_0x168dea){try{jsonpatch[_0x91db('0x1f')](_0x168dea,_0x50cf9c,!![]);}catch(_0x6e3ca6){return BPromise[_0x91db('0x20')](_0x6e3ca6);}return _0x168dea[_0x91db('0x21')]();};}function saveUpdates(_0x31b96c,_0xaad1f6){return function(_0x8e323f){if(_0x8e323f){return _0x8e323f[_0x91db('0x22')](_0x31b96c)[_0x91db('0x23')](function(_0x554454){return _0x554454;});}return null;};}function removeEntity(_0x58774f,_0x134caa){return function(_0x2ac8d5){if(_0x2ac8d5){return _0x2ac8d5['destroy']()[_0x91db('0x23')](function(){_0x58774f[_0x91db('0x16')](0xcc)[_0x91db('0x17')]();});}};}function handleEntityNotFound(_0x6e3a9c,_0x3729d3){return function(_0x4e2a8f){if(!_0x4e2a8f){_0x6e3a9c['sendStatus'](0x194);}return _0x4e2a8f;};}function handleError(_0x42e53f,_0x2f0b86){_0x2f0b86=_0x2f0b86||0x1f4;return function(_0x329118){logger['error'](_0x329118[_0x91db('0x24')]);if(_0x329118[_0x91db('0x25')]){delete _0x329118[_0x91db('0x25')];}_0x42e53f[_0x91db('0x16')](_0x2f0b86)['send'](_0x329118);};}exports[_0x91db('0x26')]=function(_0x2a00d1,_0x1805ef){var _0x49c504={},_0x2ff6c8={},_0x69fdc2={'count':0x0,'rows':[]};var _0x2d3ebd=_[_0x91db('0x27')](db[_0x91db('0x28')][_0x91db('0x29')],function(_0x2e6a27){return{'name':_0x2e6a27[_0x91db('0x2a')],'type':_0x2e6a27[_0x91db('0x2b')][_0x91db('0x2c')]};});_0x2ff6c8[_0x91db('0x2d')]=_[_0x91db('0x27')](_0x2d3ebd,_0x91db('0x25'));_0x2ff6c8[_0x91db('0x2e')]=_['keys'](_0x2a00d1[_0x91db('0x2e')]);_0x2ff6c8[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],_0x2ff6c8[_0x91db('0x2e')]);_0x49c504['attributes']=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],qs[_0x91db('0x31')](_0x2a00d1['query'][_0x91db('0x31')]));_0x49c504['attributes']=_0x49c504[_0x91db('0x32')][_0x91db('0x33')]?_0x49c504[_0x91db('0x32')]:_0x2ff6c8[_0x91db('0x2d')];if(!_0x2a00d1['query'][_0x91db('0x34')](_0x91db('0x35'))){_0x49c504[_0x91db('0x1b')]=qs['limit'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x1b')]);_0x49c504['offset']=qs[_0x91db('0x19')](_0x2a00d1[_0x91db('0x2e')]['offset']);}_0x49c504[_0x91db('0x36')]=qs['sort'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x37')]);_0x49c504['where']=qs['filters'](_['pick'](_0x2a00d1[_0x91db('0x2e')],_0x2ff6c8[_0x91db('0x2f')]),_0x2d3ebd);if(_0x2a00d1['query'][_0x91db('0x38')]){_0x49c504[_0x91db('0x39')]=_[_0x91db('0x3a')](_0x49c504[_0x91db('0x39')],{'$or':_[_0x91db('0x27')](_0x2d3ebd,function(_0x3cccc7){if(_0x3cccc7[_0x91db('0x2b')]!==_0x91db('0x3b')){var _0xcdc472={};_0xcdc472[_0x3cccc7[_0x91db('0x25')]]={'$like':'%'+_0x2a00d1[_0x91db('0x2e')]['filter']+'%'};return _0xcdc472;}})});}_0x49c504=_[_0x91db('0x3a')]({},_0x49c504,_0x2a00d1['options']);var _0x14de6d={'where':_0x49c504[_0x91db('0x39')]};return db['ChatQueueReport'][_0x91db('0x1c')](_0x14de6d)[_0x91db('0x23')](function(_0x16a7e9){_0x69fdc2[_0x91db('0x1c')]=_0x16a7e9;if(_0x2a00d1[_0x91db('0x2e')]['includeAll']){_0x49c504[_0x91db('0x3c')]=[{'all':!![]}];}return db[_0x91db('0x28')][_0x91db('0x3d')](_0x49c504);})['then'](function(_0x4733a4){_0x69fdc2[_0x91db('0x3e')]=_0x4733a4;return _0x69fdc2;})[_0x91db('0x23')](respondWithFilteredResult(_0x1805ef,_0x49c504))['catch'](handleError(_0x1805ef,null));};exports[_0x91db('0x3f')]=function(_0x2b7830,_0x29831c){var _0x3d73a7={'raw':!![],'where':{'id':_0x2b7830['params']['id']}},_0x3609e1={};_0x3609e1[_0x91db('0x2d')]=_['keys'](db[_0x91db('0x28')][_0x91db('0x29')]);_0x3609e1[_0x91db('0x2e')]=_[_0x91db('0x40')](_0x2b7830[_0x91db('0x2e')]);_0x3609e1[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x3609e1[_0x91db('0x2d')],_0x3609e1[_0x91db('0x2e')]);_0x3d73a7[_0x91db('0x32')]=_[_0x91db('0x30')](_0x3609e1['model'],qs['fields'](_0x2b7830[_0x91db('0x2e')][_0x91db('0x31')]));_0x3d73a7[_0x91db('0x32')]=_0x3d73a7['attributes'][_0x91db('0x33')]?_0x3d73a7[_0x91db('0x32')]:_0x3609e1[_0x91db('0x2d')];if(_0x2b7830[_0x91db('0x2e')][_0x91db('0x41')]){_0x3d73a7['include']=[{'all':!![]}];}_0x3d73a7=_[_0x91db('0x3a')]({},_0x3d73a7,_0x2b7830['options']);return db[_0x91db('0x28')][_0x91db('0x42')](_0x3d73a7)[_0x91db('0x23')](handleEntityNotFound(_0x29831c,null))[_0x91db('0x23')](respondWithResult(_0x29831c,null))[_0x91db('0x43')](handleError(_0x29831c,null));};exports[_0x91db('0x44')]=function(_0x17f7b3,_0xd5a8fb){return db[_0x91db('0x28')]['create'](_0x17f7b3['body'],{})[_0x91db('0x23')](respondWithResult(_0xd5a8fb,0xc9))[_0x91db('0x43')](handleError(_0xd5a8fb,null));};exports[_0x91db('0x22')]=function(_0x410423,_0x27e224){if(_0x410423['body']['id']){delete _0x410423[_0x91db('0x45')]['id'];}return db[_0x91db('0x28')][_0x91db('0x42')]({'where':{'id':_0x410423[_0x91db('0x46')]['id']}})[_0x91db('0x23')](handleEntityNotFound(_0x27e224,null))['then'](saveUpdates(_0x410423[_0x91db('0x45')],null))[_0x91db('0x23')](respondWithResult(_0x27e224,null))[_0x91db('0x43')](handleError(_0x27e224,null));};exports[_0x91db('0x47')]=function(_0x50b269,_0x3d8dfb){return db['ChatQueueReport']['find']({'where':{'id':_0x50b269[_0x91db('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d8dfb,null))[_0x91db('0x23')](removeEntity(_0x3d8dfb,null))['catch'](handleError(_0x3d8dfb,null));};exports['describe']=function(_0x2c30ff,_0x371277){return db[_0x91db('0x28')]['describe']()[_0x91db('0x23')](respondWithResult(_0x371277,null))[_0x91db('0x43')](handleError(_0x371277,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 4fa6d48..ea2134f 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x1b6f1d,_0x3c21ff){var _0xcc0832=function(_0x5a1ba2){while(--_0x5a1ba2){_0x1b6f1d['push'](_0x1b6f1d['shift']());}};_0xcc0832(++_0x3c21ff);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 8f2ae56..497b19e 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 _0x043c=['where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','CreateChatQueueReport','UpdateChatQueueReport','ChatQueueReport','update','raw'];(function(_0x5053b9,_0x9c52a6){var _0x565876=function(_0x32d7af){while(--_0x32d7af){_0x5053b9['push'](_0x5053b9['shift']());}};_0x565876(++_0x9c52a6);}(_0x043c,0xc8));var _0xc043=function(_0x3ab928,_0x2b990b){_0x3ab928=_0x3ab928-0x0;var _0xf47692=_0x043c[_0x3ab928];return _0xf47692;};'use strict';var _=require(_0xc043('0x0'));var util=require(_0xc043('0x1'));var moment=require('moment');var BPromise=require(_0xc043('0x2'));var rs=require(_0xc043('0x3'));var fs=require('fs');var Redis=require(_0xc043('0x4'));var db=require(_0xc043('0x5'))['db'];var utils=require(_0xc043('0x6'));var logger=require('../../config/logger')(_0xc043('0x7'));var config=require(_0xc043('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc043('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c2d99,_0xbf8c16,_0x4a6472){return new BPromise(function(_0x544227,_0x19a944){return client[_0xc043('0xa')](_0x1c2d99,_0x4a6472)[_0xc043('0xb')](function(_0x138159){logger[_0xc043('0xc')](_0xc043('0xd'),_0xbf8c16,_0xc043('0xe'));logger[_0xc043('0xf')](_0xc043('0x10'),_0xbf8c16,'request\x20sent',JSON[_0xc043('0x11')](_0x138159));if(_0x138159['error']){if(_0x138159[_0xc043('0x12')][_0xc043('0x13')]===0x1f4){logger[_0xc043('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0xbf8c16,_0x138159[_0xc043('0x12')][_0xc043('0x14')]);return _0x19a944(_0x138159[_0xc043('0x12')][_0xc043('0x14')]);}logger[_0xc043('0x12')](_0xc043('0xd'),_0xbf8c16,_0x138159[_0xc043('0x12')]['message']);return _0x544227(_0x138159[_0xc043('0x12')]['message']);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0xbf8c16,_0xc043('0xe'));_0x544227(_0x138159[_0xc043('0x15')][_0xc043('0x14')]);}})[_0xc043('0x16')](function(_0x481045){logger[_0xc043('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0xbf8c16,_0x481045);_0x19a944(_0x481045);});});}exports['CreateChatQueueReport']=function(_0x30e65f){var _0x4e915f=this;return new Promise(function(_0x47647c,_0x4d66eb){return db['ChatQueueReport'][_0xc043('0x17')](_0x30e65f[_0xc043('0x18')],{'raw':_0x30e65f[_0xc043('0x19')]?_0x30e65f['options']['raw']===undefined?!![]:![]:!![]})[_0xc043('0xb')](function(_0xbd88){logger[_0xc043('0xc')](_0xc043('0x1a'),_0x30e65f);logger[_0xc043('0xf')](_0xc043('0x1a'),_0x30e65f,JSON[_0xc043('0x11')](_0xbd88));_0x47647c(_0xbd88);})[_0xc043('0x16')](function(_0x19d4cd){logger[_0xc043('0x12')]('CreateChatQueueReport',_0x19d4cd[_0xc043('0x14')],_0x30e65f);_0x4d66eb(_0x4e915f[_0xc043('0x12')](0x1f4,_0x19d4cd[_0xc043('0x14')]));});});};exports[_0xc043('0x1b')]=function(_0x3f6679){var _0x297ec3=this;return new Promise(function(_0x1d0918,_0x1557e5){return db[_0xc043('0x1c')][_0xc043('0x1d')](_0x3f6679[_0xc043('0x18')],{'raw':_0x3f6679[_0xc043('0x19')]?_0x3f6679[_0xc043('0x19')][_0xc043('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f6679[_0xc043('0x19')]?_0x3f6679[_0xc043('0x19')][_0xc043('0x1f')]||null:null,'attributes':_0x3f6679[_0xc043('0x19')]?_0x3f6679['options'][_0xc043('0x20')]||null:null,'limit':_0x3f6679[_0xc043('0x19')]?_0x3f6679[_0xc043('0x19')]['limit']||null:null})[_0xc043('0xb')](function(_0x592146){logger[_0xc043('0xc')]('UpdateChatQueueReport',_0x3f6679);logger[_0xc043('0xf')](_0xc043('0x1b'),_0x3f6679,JSON[_0xc043('0x11')](_0x592146));_0x1d0918(_0x592146);})['catch'](function(_0x5c98ed){logger[_0xc043('0x12')](_0xc043('0x1b'),_0x5c98ed['message'],_0x3f6679);_0x1557e5(_0x297ec3[_0xc043('0x12')](0x1f4,_0x5c98ed[_0xc043('0x14')]));});});}; \ No newline at end of file +var _0xa63b=['info','CreateChatQueueReport','UpdateChatQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','ChatQueueReport','create','body','options','raw'];(function(_0x193b59,_0x1d3454){var _0x339e71=function(_0x401922){while(--_0x401922){_0x193b59['push'](_0x193b59['shift']());}};_0x339e71(++_0x1d3454);}(_0xa63b,0xb5));var _0xba63=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xa63b[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xba63('0x0'));var util=require(_0xba63('0x1'));var moment=require(_0xba63('0x2'));var BPromise=require(_0xba63('0x3'));var rs=require(_0xba63('0x4'));var fs=require('fs');var Redis=require(_0xba63('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xba63('0x6'));var logger=require(_0xba63('0x7'))(_0xba63('0x8'));var config=require(_0xba63('0x9'));var jayson=require(_0xba63('0xa'));var client=jayson[_0xba63('0xb')][_0xba63('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x398e80,_0x134562,_0x365a5f){return new BPromise(function(_0x52b829,_0x4e16d3){return client[_0xba63('0xd')](_0x398e80,_0x365a5f)[_0xba63('0xe')](function(_0x109f7b){logger['info'](_0xba63('0xf'),_0x134562,'request\x20sent');logger[_0xba63('0x10')](_0xba63('0x11'),_0x134562,'request\x20sent',JSON[_0xba63('0x12')](_0x109f7b));if(_0x109f7b[_0xba63('0x13')]){if(_0x109f7b[_0xba63('0x13')][_0xba63('0x14')]===0x1f4){logger['error'](_0xba63('0xf'),_0x134562,_0x109f7b['error']['message']);return _0x4e16d3(_0x109f7b[_0xba63('0x13')]['message']);}logger[_0xba63('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x134562,_0x109f7b[_0xba63('0x13')][_0xba63('0x15')]);return _0x52b829(_0x109f7b['error'][_0xba63('0x15')]);}else{logger['info'](_0xba63('0xf'),_0x134562,_0xba63('0x16'));_0x52b829(_0x109f7b['result'][_0xba63('0x15')]);}})[_0xba63('0x17')](function(_0x5dbf76){logger[_0xba63('0x13')](_0xba63('0xf'),_0x134562,_0x5dbf76);_0x4e16d3(_0x5dbf76);});});}exports['CreateChatQueueReport']=function(_0x428d4f){var _0x4f097e=this;return new Promise(function(_0x2c9fe4,_0x39a559){return db[_0xba63('0x18')][_0xba63('0x19')](_0x428d4f[_0xba63('0x1a')],{'raw':_0x428d4f[_0xba63('0x1b')]?_0x428d4f[_0xba63('0x1b')][_0xba63('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2b6804){logger[_0xba63('0x1d')](_0xba63('0x1e'),_0x428d4f);logger[_0xba63('0x10')](_0xba63('0x1e'),_0x428d4f,JSON[_0xba63('0x12')](_0x2b6804));_0x2c9fe4(_0x2b6804);})[_0xba63('0x17')](function(_0x403af3){logger[_0xba63('0x13')](_0xba63('0x1e'),_0x403af3[_0xba63('0x15')],_0x428d4f);_0x39a559(_0x4f097e[_0xba63('0x13')](0x1f4,_0x403af3[_0xba63('0x15')]));});});};exports[_0xba63('0x1f')]=function(_0x1de008){var _0x42b042=this;return new Promise(function(_0x579029,_0x4ca5ae){return db['ChatQueueReport']['update'](_0x1de008[_0xba63('0x1a')],{'raw':_0x1de008[_0xba63('0x1b')]?_0x1de008[_0xba63('0x1b')][_0xba63('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1de008[_0xba63('0x1b')]?_0x1de008[_0xba63('0x1b')][_0xba63('0x20')]||null:null,'attributes':_0x1de008[_0xba63('0x1b')]?_0x1de008[_0xba63('0x1b')][_0xba63('0x21')]||null:null,'limit':_0x1de008[_0xba63('0x1b')]?_0x1de008[_0xba63('0x1b')][_0xba63('0x22')]||null:null})[_0xba63('0xe')](function(_0x1f572f){logger[_0xba63('0x1d')](_0xba63('0x1f'),_0x1de008);logger['debug'](_0xba63('0x1f'),_0x1de008,JSON[_0xba63('0x12')](_0x1f572f));_0x579029(_0x1f572f);})['catch'](function(_0x420ddc){logger[_0xba63('0x13')]('UpdateChatQueueReport',_0x420ddc[_0xba63('0x15')],_0x1de008);_0x4ca5ae(_0x42b042[_0xba63('0x13')](0x1f4,_0x420ddc[_0xba63('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index e29b462..99593ef 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 _0x5928=['../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','update','delete','/:id','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x584ee0,_0x4ec16b){var _0x35a786=function(_0x28c512){while(--_0x28c512){_0x584ee0['push'](_0x584ee0['shift']());}};_0x35a786(++_0x4ec16b);}(_0x5928,0x10c));var _0x8592=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5928[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8592('0x0'));var util=require(_0x8592('0x1'));var path=require(_0x8592('0x2'));var timeout=require('connect-timeout');var express=require(_0x8592('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8592('0x4'));var interaction=require(_0x8592('0x5'));var config=require(_0x8592('0x6'));var controller=require(_0x8592('0x7'));router[_0x8592('0x8')]('/',auth[_0x8592('0x9')](),controller[_0x8592('0xa')]);router['get'](_0x8592('0xb'),auth[_0x8592('0x9')](),controller[_0x8592('0xc')]);router[_0x8592('0x8')]('/:id',auth[_0x8592('0x9')](),controller[_0x8592('0xd')]);router[_0x8592('0xe')]('/',auth[_0x8592('0x9')](),controller[_0x8592('0xf')]);router['put']('/:id',auth[_0x8592('0x9')](),controller[_0x8592('0x10')]);router[_0x8592('0x11')](_0x8592('0x12'),auth['isAuthenticated'](),controller[_0x8592('0x13')]);module[_0x8592('0x14')]=router; \ No newline at end of file +var _0x4a58=['post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0xc7679b,_0x2511a2){var _0x4e8f0b=function(_0x166401){while(--_0x166401){_0xc7679b['push'](_0xc7679b['shift']());}};_0x4e8f0b(++_0x2511a2);}(_0x4a58,0x72));var _0x84a5=function(_0x2e69fb,_0x4359e3){_0x2e69fb=_0x2e69fb-0x0;var _0x4d2404=_0x4a58[_0x2e69fb];return _0x4d2404;};'use strict';var multer=require('multer');var util=require(_0x84a5('0x0'));var path=require(_0x84a5('0x1'));var timeout=require(_0x84a5('0x2'));var express=require(_0x84a5('0x3'));var router=express[_0x84a5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x84a5('0x5'));var controller=require(_0x84a5('0x6'));router[_0x84a5('0x7')]('/',auth[_0x84a5('0x8')](),controller[_0x84a5('0x9')]);router['get']('/describe',auth[_0x84a5('0x8')](),controller['describe']);router[_0x84a5('0x7')](_0x84a5('0xa'),auth['isAuthenticated'](),controller[_0x84a5('0xb')]);router[_0x84a5('0xc')]('/',auth['isAuthenticated'](),controller[_0x84a5('0xd')]);router[_0x84a5('0xe')](_0x84a5('0xa'),auth[_0x84a5('0x8')](),controller[_0x84a5('0xf')]);router[_0x84a5('0x10')](_0x84a5('0xa'),auth[_0x84a5('0x8')](),controller[_0x84a5('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index ff6d46a..4303154 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4f475c,_0x48d78c){var _0x31402e=function(_0x4c72f8){while(--_0x4c72f8){_0x4f475c['push'](_0x4f475c['shift']());}};_0x31402e(++_0x48d78c);}(_0xaa88,0x137));var _0x8aa8=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xaa88[_0x68ee8b];return _0x5148f7;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x67655b,_0x15ff31){var _0x71c09d=function(_0x50c331){while(--_0x50c331){_0x67655b['push'](_0x67655b['shift']());}};_0x71c09d(++_0x15ff31);}(_0x008c,0x188));var _0xc008=function(_0xb096ef,_0x20ebdf){_0xb096ef=_0xb096ef-0x0;var _0x5ac5b=_0x008c[_0xb096ef];return _0x5ac5b;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 3c42aa4..af77a8e 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 _0xc60a=['destroy','sendStatus','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','include','findAll','rows','catch','show','params','length','options','find','body','update','describe','eml-format','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x212ec3,_0x5182cd){var _0x1ee279=function(_0x30a2f6){while(--_0x30a2f6){_0x212ec3['push'](_0x212ec3['shift']());}};_0x1ee279(++_0x5182cd);}(_0xc60a,0x1d1));var _0xac60=function(_0x41c9b2,_0xd0b0c2){_0x41c9b2=_0x41c9b2-0x0;var _0x183be9=_0xc60a[_0x41c9b2];return _0x183be9;};'use strict';var emlformat=require(_0xac60('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xac60('0x1'));var moment=require('moment');var BPromise=require(_0xac60('0x2'));var Mustache=require(_0xac60('0x3'));var util=require('util');var path=require('path');var sox=require(_0xac60('0x4'));var csv=require(_0xac60('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac60('0x6'));var _=require(_0xac60('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xac60('0x8'));var toCsv=require(_0xac60('0x5'));var querystring=require(_0xac60('0x9'));var Papa=require(_0xac60('0xa'));var Redis=require(_0xac60('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xac60('0xc'));var as=require(_0xac60('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac60('0xe'))(_0xac60('0xf'));var utils=require('../../config/utils');var config=require(_0xac60('0x10'));var licenseUtil=require(_0xac60('0x11'));var db=require(_0xac60('0x12'))['db'];function respondWithStatusCode(_0x51bba4,_0x3c76c0){_0x3c76c0=_0x3c76c0||0xcc;return function(_0x3acd9f){if(_0x3acd9f){return _0x51bba4['sendStatus'](_0x3c76c0);}return _0x51bba4[_0xac60('0x13')](_0x3c76c0)[_0xac60('0x14')]();};}function respondWithResult(_0x4891c9,_0x290cad){_0x290cad=_0x290cad||0xc8;return function(_0x4658f8){if(_0x4658f8){return _0x4891c9['status'](_0x290cad)[_0xac60('0x15')](_0x4658f8);}};}function respondWithFilteredResult(_0x453d60,_0x4c0431){return function(_0x26390e){if(_0x26390e){var _0x536404=typeof _0x4c0431[_0xac60('0x16')]===_0xac60('0x17')&&typeof _0x4c0431[_0xac60('0x18')]===_0xac60('0x17');var _0x494c13=_0x26390e['count'];var _0x413f79=_0x536404?0x0:_0x4c0431[_0xac60('0x16')];var _0x48c5fb=_0x536404?_0x26390e[_0xac60('0x19')]:_0x4c0431[_0xac60('0x16')]+_0x4c0431[_0xac60('0x18')];var _0x49f110;if(_0x48c5fb>=_0x494c13){_0x48c5fb=_0x494c13;_0x49f110=0xc8;}else{_0x49f110=0xce;}_0x453d60[_0xac60('0x13')](_0x49f110);return _0x453d60[_0xac60('0x1a')](_0xac60('0x1b'),_0x413f79+'-'+_0x48c5fb+'/'+_0x494c13)[_0xac60('0x15')](_0x26390e);}return null;};}function patchUpdates(_0x56023f){return function(_0x5f54f9){try{jsonpatch[_0xac60('0x1c')](_0x5f54f9,_0x56023f,!![]);}catch(_0xe29627){return BPromise[_0xac60('0x1d')](_0xe29627);}return _0x5f54f9[_0xac60('0x1e')]();};}function saveUpdates(_0x1fdd7d,_0x5b81f){return function(_0x8c110d){if(_0x8c110d){return _0x8c110d['update'](_0x1fdd7d)[_0xac60('0x1f')](function(_0x1a2c7e){return _0x1a2c7e;});}return null;};}function removeEntity(_0x47d2a9,_0x39d332){return function(_0x16939d){if(_0x16939d){return _0x16939d[_0xac60('0x20')]()[_0xac60('0x1f')](function(){_0x47d2a9[_0xac60('0x13')](0xcc)[_0xac60('0x14')]();});}};}function handleEntityNotFound(_0x2b9c43,_0x3d0e43){return function(_0x20f18a){if(!_0x20f18a){_0x2b9c43[_0xac60('0x21')](0x194);}return _0x20f18a;};}function handleError(_0x2ba3f2,_0x28eec7){_0x28eec7=_0x28eec7||0x1f4;return function(_0x599c15){logger['error'](_0x599c15[_0xac60('0x22')]);if(_0x599c15[_0xac60('0x23')]){delete _0x599c15[_0xac60('0x23')];}_0x2ba3f2[_0xac60('0x13')](_0x28eec7)[_0xac60('0x24')](_0x599c15);};}exports[_0xac60('0x25')]=function(_0x2c8b6b,_0x22db4f){var _0x7fb524={},_0x26e89e={},_0x5a259b={'count':0x0,'rows':[]};var _0x13b4af=_[_0xac60('0x26')](db[_0xac60('0x27')][_0xac60('0x28')],function(_0x27ec4b){return{'name':_0x27ec4b[_0xac60('0x29')],'type':_0x27ec4b['type']['key']};});_0x26e89e['model']=_[_0xac60('0x26')](_0x13b4af,_0xac60('0x23'));_0x26e89e[_0xac60('0x2a')]=_[_0xac60('0x2b')](_0x2c8b6b[_0xac60('0x2a')]);_0x26e89e[_0xac60('0x2c')]=_[_0xac60('0x2d')](_0x26e89e[_0xac60('0x2e')],_0x26e89e[_0xac60('0x2a')]);_0x7fb524['attributes']=_[_0xac60('0x2d')](_0x26e89e['model'],qs[_0xac60('0x2f')](_0x2c8b6b[_0xac60('0x2a')][_0xac60('0x2f')]));_0x7fb524['attributes']=_0x7fb524[_0xac60('0x30')]['length']?_0x7fb524[_0xac60('0x30')]:_0x26e89e[_0xac60('0x2e')];if(!_0x2c8b6b[_0xac60('0x2a')][_0xac60('0x31')](_0xac60('0x32'))){_0x7fb524['limit']=qs[_0xac60('0x18')](_0x2c8b6b[_0xac60('0x2a')][_0xac60('0x18')]);_0x7fb524[_0xac60('0x16')]=qs[_0xac60('0x16')](_0x2c8b6b[_0xac60('0x2a')][_0xac60('0x16')]);}_0x7fb524[_0xac60('0x33')]=qs[_0xac60('0x34')](_0x2c8b6b['query'][_0xac60('0x34')]);_0x7fb524[_0xac60('0x35')]=qs[_0xac60('0x2c')](_[_0xac60('0x36')](_0x2c8b6b[_0xac60('0x2a')],_0x26e89e['filters']),_0x13b4af);if(_0x2c8b6b['query']['filter']){_0x7fb524[_0xac60('0x35')]=_[_0xac60('0x37')](_0x7fb524[_0xac60('0x35')],{'$or':_[_0xac60('0x26')](_0x13b4af,function(_0x105670){if(_0x105670[_0xac60('0x38')]!==_0xac60('0x39')){var _0x3a0794={};_0x3a0794[_0x105670[_0xac60('0x23')]]={'$like':'%'+_0x2c8b6b['query'][_0xac60('0x3a')]+'%'};return _0x3a0794;}})});}_0x7fb524=_[_0xac60('0x37')]({},_0x7fb524,_0x2c8b6b['options']);var _0x5733f4={'where':_0x7fb524[_0xac60('0x35')]};return db[_0xac60('0x27')]['count'](_0x5733f4)['then'](function(_0x8ac150){_0x5a259b[_0xac60('0x19')]=_0x8ac150;if(_0x2c8b6b[_0xac60('0x2a')]['includeAll']){_0x7fb524[_0xac60('0x3b')]=[{'all':!![]}];}return db[_0xac60('0x27')][_0xac60('0x3c')](_0x7fb524);})[_0xac60('0x1f')](function(_0x4fb6b2){_0x5a259b[_0xac60('0x3d')]=_0x4fb6b2;return _0x5a259b;})[_0xac60('0x1f')](respondWithFilteredResult(_0x22db4f,_0x7fb524))[_0xac60('0x3e')](handleError(_0x22db4f,null));};exports[_0xac60('0x3f')]=function(_0x2f2475,_0x193206){var _0x1379b0={'raw':!![],'where':{'id':_0x2f2475[_0xac60('0x40')]['id']}},_0x4290b6={};_0x4290b6[_0xac60('0x2e')]=_['keys'](db[_0xac60('0x27')]['rawAttributes']);_0x4290b6[_0xac60('0x2a')]=_[_0xac60('0x2b')](_0x2f2475[_0xac60('0x2a')]);_0x4290b6[_0xac60('0x2c')]=_['intersection'](_0x4290b6[_0xac60('0x2e')],_0x4290b6[_0xac60('0x2a')]);_0x1379b0[_0xac60('0x30')]=_['intersection'](_0x4290b6[_0xac60('0x2e')],qs['fields'](_0x2f2475[_0xac60('0x2a')][_0xac60('0x2f')]));_0x1379b0['attributes']=_0x1379b0['attributes'][_0xac60('0x41')]?_0x1379b0['attributes']:_0x4290b6[_0xac60('0x2e')];if(_0x2f2475[_0xac60('0x2a')]['includeAll']){_0x1379b0[_0xac60('0x3b')]=[{'all':!![]}];}_0x1379b0=_['merge']({},_0x1379b0,_0x2f2475[_0xac60('0x42')]);return db[_0xac60('0x27')][_0xac60('0x43')](_0x1379b0)[_0xac60('0x1f')](handleEntityNotFound(_0x193206,null))[_0xac60('0x1f')](respondWithResult(_0x193206,null))[_0xac60('0x3e')](handleError(_0x193206,null));};exports['create']=function(_0x1cee40,_0x572422){return db['ChatTransferReport']['create'](_0x1cee40[_0xac60('0x44')],{})[_0xac60('0x1f')](respondWithResult(_0x572422,0xc9))[_0xac60('0x3e')](handleError(_0x572422,null));};exports[_0xac60('0x45')]=function(_0x4b689d,_0x1fbeb0){if(_0x4b689d['body']['id']){delete _0x4b689d['body']['id'];}return db[_0xac60('0x27')][_0xac60('0x43')]({'where':{'id':_0x4b689d[_0xac60('0x40')]['id']}})['then'](handleEntityNotFound(_0x1fbeb0,null))['then'](saveUpdates(_0x4b689d[_0xac60('0x44')],null))[_0xac60('0x1f')](respondWithResult(_0x1fbeb0,null))[_0xac60('0x3e')](handleError(_0x1fbeb0,null));};exports['destroy']=function(_0x4dcdb8,_0x2cd32f){return db[_0xac60('0x27')][_0xac60('0x43')]({'where':{'id':_0x4dcdb8['params']['id']}})[_0xac60('0x1f')](handleEntityNotFound(_0x2cd32f,null))['then'](removeEntity(_0x2cd32f,null))[_0xac60('0x3e')](handleError(_0x2cd32f,null));};exports['describe']=function(_0x2c8700,_0x249c3c){return db[_0xac60('0x27')][_0xac60('0x46')]()[_0xac60('0x1f')](respondWithResult(_0x249c3c,null))[_0xac60('0x3e')](handleError(_0x249c3c,null));}; \ No newline at end of file +var _0x7008=['catch','show','params','intersection','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','options','findAll','rows'];(function(_0x53c43d,_0x1541b4){var _0x594166=function(_0x282ff7){while(--_0x282ff7){_0x53c43d['push'](_0x53c43d['shift']());}};_0x594166(++_0x1541b4);}(_0x7008,0x185));var _0x8700=function(_0x57e1f7,_0xfa390a){_0x57e1f7=_0x57e1f7-0x0;var _0x3c1940=_0x7008[_0x57e1f7];return _0x3c1940;};'use strict';var emlformat=require(_0x8700('0x0'));var rimraf=require(_0x8700('0x1'));var zipdir=require(_0x8700('0x2'));var jsonpatch=require(_0x8700('0x3'));var rp=require('request-promise');var moment=require(_0x8700('0x4'));var BPromise=require(_0x8700('0x5'));var Mustache=require('mustache');var util=require(_0x8700('0x6'));var path=require(_0x8700('0x7'));var sox=require(_0x8700('0x8'));var csv=require(_0x8700('0x9'));var ejs=require(_0x8700('0xa'));var fs=require('fs');var fs_extra=require(_0x8700('0xb'));var _=require(_0x8700('0xc'));var squel=require('squel');var crypto=require(_0x8700('0xd'));var jsforce=require(_0x8700('0xe'));var deskjs=require(_0x8700('0xf'));var toCsv=require(_0x8700('0x9'));var querystring=require(_0x8700('0x10'));var Papa=require(_0x8700('0x11'));var Redis=require(_0x8700('0x12'));var authService=require(_0x8700('0x13'));var qs=require(_0x8700('0x14'));var as=require(_0x8700('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8700('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8700('0x17'))['db'];function respondWithStatusCode(_0x10f9d4,_0x14d24d){_0x14d24d=_0x14d24d||0xcc;return function(_0xf315f9){if(_0xf315f9){return _0x10f9d4[_0x8700('0x18')](_0x14d24d);}return _0x10f9d4[_0x8700('0x19')](_0x14d24d)[_0x8700('0x1a')]();};}function respondWithResult(_0x50eb8d,_0x33a0f1){_0x33a0f1=_0x33a0f1||0xc8;return function(_0x28fb33){if(_0x28fb33){return _0x50eb8d[_0x8700('0x19')](_0x33a0f1)[_0x8700('0x1b')](_0x28fb33);}};}function respondWithFilteredResult(_0x70fd70,_0x406ee6){return function(_0x58b06c){if(_0x58b06c){var _0x25508a=typeof _0x406ee6[_0x8700('0x1c')]===_0x8700('0x1d')&&typeof _0x406ee6[_0x8700('0x1e')]===_0x8700('0x1d');var _0x54bae9=_0x58b06c[_0x8700('0x1f')];var _0x24fe1c=_0x25508a?0x0:_0x406ee6[_0x8700('0x1c')];var _0x4e0499=_0x25508a?_0x58b06c['count']:_0x406ee6[_0x8700('0x1c')]+_0x406ee6[_0x8700('0x1e')];var _0x7ba748;if(_0x4e0499>=_0x54bae9){_0x4e0499=_0x54bae9;_0x7ba748=0xc8;}else{_0x7ba748=0xce;}_0x70fd70[_0x8700('0x19')](_0x7ba748);return _0x70fd70['set'](_0x8700('0x20'),_0x24fe1c+'-'+_0x4e0499+'/'+_0x54bae9)[_0x8700('0x1b')](_0x58b06c);}return null;};}function patchUpdates(_0x1e404f){return function(_0x2f8548){try{jsonpatch[_0x8700('0x21')](_0x2f8548,_0x1e404f,!![]);}catch(_0x2aafd9){return BPromise[_0x8700('0x22')](_0x2aafd9);}return _0x2f8548[_0x8700('0x23')]();};}function saveUpdates(_0x35df7e,_0x3a7a31){return function(_0x4d09bb){if(_0x4d09bb){return _0x4d09bb[_0x8700('0x24')](_0x35df7e)[_0x8700('0x25')](function(_0xcf258c){return _0xcf258c;});}return null;};}function removeEntity(_0x246157,_0x36611e){return function(_0x114287){if(_0x114287){return _0x114287[_0x8700('0x26')]()[_0x8700('0x25')](function(){_0x246157[_0x8700('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2f1a,_0x1470ed){return function(_0x50c5de){if(!_0x50c5de){_0x5e2f1a['sendStatus'](0x194);}return _0x50c5de;};}function handleError(_0x4c6d29,_0x310688){_0x310688=_0x310688||0x1f4;return function(_0x56ac4e){logger[_0x8700('0x27')](_0x56ac4e[_0x8700('0x28')]);if(_0x56ac4e[_0x8700('0x29')]){delete _0x56ac4e[_0x8700('0x29')];}_0x4c6d29[_0x8700('0x19')](_0x310688)[_0x8700('0x2a')](_0x56ac4e);};}exports[_0x8700('0x2b')]=function(_0x3be479,_0x4393ab){var _0x4a95c8={},_0x41ab8f={},_0x49e8bf={'count':0x0,'rows':[]};var _0x2dd515=_[_0x8700('0x2c')](db[_0x8700('0x2d')][_0x8700('0x2e')],function(_0xf96394){return{'name':_0xf96394[_0x8700('0x2f')],'type':_0xf96394['type'][_0x8700('0x30')]};});_0x41ab8f[_0x8700('0x31')]=_['map'](_0x2dd515,_0x8700('0x29'));_0x41ab8f[_0x8700('0x32')]=_[_0x8700('0x33')](_0x3be479[_0x8700('0x32')]);_0x41ab8f[_0x8700('0x34')]=_['intersection'](_0x41ab8f[_0x8700('0x31')],_0x41ab8f[_0x8700('0x32')]);_0x4a95c8[_0x8700('0x35')]=_['intersection'](_0x41ab8f[_0x8700('0x31')],qs[_0x8700('0x36')](_0x3be479['query'][_0x8700('0x36')]));_0x4a95c8['attributes']=_0x4a95c8['attributes'][_0x8700('0x37')]?_0x4a95c8[_0x8700('0x35')]:_0x41ab8f[_0x8700('0x31')];if(!_0x3be479[_0x8700('0x32')]['hasOwnProperty'](_0x8700('0x38'))){_0x4a95c8[_0x8700('0x1e')]=qs[_0x8700('0x1e')](_0x3be479[_0x8700('0x32')][_0x8700('0x1e')]);_0x4a95c8[_0x8700('0x1c')]=qs[_0x8700('0x1c')](_0x3be479[_0x8700('0x32')][_0x8700('0x1c')]);}_0x4a95c8['order']=qs[_0x8700('0x39')](_0x3be479[_0x8700('0x32')][_0x8700('0x39')]);_0x4a95c8['where']=qs['filters'](_[_0x8700('0x3a')](_0x3be479['query'],_0x41ab8f['filters']),_0x2dd515);if(_0x3be479[_0x8700('0x32')][_0x8700('0x3b')]){_0x4a95c8['where']=_[_0x8700('0x3c')](_0x4a95c8[_0x8700('0x3d')],{'$or':_[_0x8700('0x2c')](_0x2dd515,function(_0x45fe53){if(_0x45fe53[_0x8700('0x3e')]!==_0x8700('0x3f')){var _0x166bd2={};_0x166bd2[_0x45fe53[_0x8700('0x29')]]={'$like':'%'+_0x3be479[_0x8700('0x32')]['filter']+'%'};return _0x166bd2;}})});}_0x4a95c8=_[_0x8700('0x3c')]({},_0x4a95c8,_0x3be479[_0x8700('0x40')]);var _0x232b02={'where':_0x4a95c8[_0x8700('0x3d')]};return db[_0x8700('0x2d')][_0x8700('0x1f')](_0x232b02)[_0x8700('0x25')](function(_0x279092){_0x49e8bf[_0x8700('0x1f')]=_0x279092;if(_0x3be479[_0x8700('0x32')]['includeAll']){_0x4a95c8['include']=[{'all':!![]}];}return db[_0x8700('0x2d')][_0x8700('0x41')](_0x4a95c8);})['then'](function(_0x16a102){_0x49e8bf[_0x8700('0x42')]=_0x16a102;return _0x49e8bf;})[_0x8700('0x25')](respondWithFilteredResult(_0x4393ab,_0x4a95c8))[_0x8700('0x43')](handleError(_0x4393ab,null));};exports[_0x8700('0x44')]=function(_0x25de59,_0x372fee){var _0x7719ca={'raw':!![],'where':{'id':_0x25de59[_0x8700('0x45')]['id']}},_0x24652c={};_0x24652c[_0x8700('0x31')]=_[_0x8700('0x33')](db[_0x8700('0x2d')][_0x8700('0x2e')]);_0x24652c[_0x8700('0x32')]=_[_0x8700('0x33')](_0x25de59[_0x8700('0x32')]);_0x24652c[_0x8700('0x34')]=_['intersection'](_0x24652c['model'],_0x24652c[_0x8700('0x32')]);_0x7719ca['attributes']=_[_0x8700('0x46')](_0x24652c[_0x8700('0x31')],qs[_0x8700('0x36')](_0x25de59['query'][_0x8700('0x36')]));_0x7719ca[_0x8700('0x35')]=_0x7719ca[_0x8700('0x35')][_0x8700('0x37')]?_0x7719ca[_0x8700('0x35')]:_0x24652c['model'];if(_0x25de59[_0x8700('0x32')][_0x8700('0x47')]){_0x7719ca['include']=[{'all':!![]}];}_0x7719ca=_[_0x8700('0x3c')]({},_0x7719ca,_0x25de59[_0x8700('0x40')]);return db[_0x8700('0x2d')]['find'](_0x7719ca)['then'](handleEntityNotFound(_0x372fee,null))[_0x8700('0x25')](respondWithResult(_0x372fee,null))[_0x8700('0x43')](handleError(_0x372fee,null));};exports[_0x8700('0x48')]=function(_0x14a17b,_0x2bb131){return db[_0x8700('0x2d')][_0x8700('0x48')](_0x14a17b[_0x8700('0x49')],{})[_0x8700('0x25')](respondWithResult(_0x2bb131,0xc9))['catch'](handleError(_0x2bb131,null));};exports[_0x8700('0x24')]=function(_0x4b4cd6,_0xc3831a){if(_0x4b4cd6[_0x8700('0x49')]['id']){delete _0x4b4cd6[_0x8700('0x49')]['id'];}return db[_0x8700('0x2d')][_0x8700('0x4a')]({'where':{'id':_0x4b4cd6[_0x8700('0x45')]['id']}})[_0x8700('0x25')](handleEntityNotFound(_0xc3831a,null))[_0x8700('0x25')](saveUpdates(_0x4b4cd6[_0x8700('0x49')],null))[_0x8700('0x25')](respondWithResult(_0xc3831a,null))[_0x8700('0x43')](handleError(_0xc3831a,null));};exports['destroy']=function(_0x30ad3e,_0x421d7e){return db[_0x8700('0x2d')]['find']({'where':{'id':_0x30ad3e[_0x8700('0x45')]['id']}})[_0x8700('0x25')](handleEntityNotFound(_0x421d7e,null))['then'](removeEntity(_0x421d7e,null))[_0x8700('0x43')](handleError(_0x421d7e,null));};exports['describe']=function(_0x4456be,_0x1c7f0f){return db[_0x8700('0x2d')][_0x8700('0x4b')]()[_0x8700('0x25')](respondWithResult(_0x1c7f0f,null))[_0x8700('0x43')](handleError(_0x1c7f0f,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index a430b2f..a44ea5a 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 _0xe7f5=['rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x527f0a,_0x6c54af){var _0x758028=function(_0x3d6d82){while(--_0x3d6d82){_0x527f0a['push'](_0x527f0a['shift']());}};_0x758028(++_0x6c54af);}(_0xe7f5,0x11f));var _0x5e7f=function(_0x54c877,_0x17ba52){_0x54c877=_0x54c877-0x0;var _0x281de3=_0xe7f5[_0x54c877];return _0x281de3;};'use strict';var _=require(_0x5e7f('0x0'));var util=require(_0x5e7f('0x1'));var logger=require(_0x5e7f('0x2'))(_0x5e7f('0x3'));var moment=require('moment');var BPromise=require(_0x5e7f('0x4'));var rp=require(_0x5e7f('0x5'));var fs=require('fs');var path=require(_0x5e7f('0x6'));var rimraf=require(_0x5e7f('0x7'));var config=require(_0x5e7f('0x8'));var attributes=require(_0x5e7f('0x9'));module[_0x5e7f('0xa')]=function(_0x3840f3,_0x11d0d5){return _0x3840f3[_0x5e7f('0xb')](_0x5e7f('0xc'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x5e7f('0xd'),'fields':[_0x5e7f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe09a=['path','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xe09a,0x180));var _0xae09=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe09a[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xae09('0x0'));var util=require(_0xae09('0x1'));var logger=require('../../config/logger')(_0xae09('0x2'));var moment=require(_0xae09('0x3'));var BPromise=require(_0xae09('0x4'));var rp=require(_0xae09('0x5'));var fs=require('fs');var path=require(_0xae09('0x6'));var rimraf=require('rimraf');var config=require(_0xae09('0x7'));var attributes=require('./chatTransferReport.attributes');module[_0xae09('0x8')]=function(_0x3008e9,_0x340ce4){return _0x3008e9[_0xae09('0x9')](_0xae09('0xa'),attributes,{'tableName':_0xae09('0xb'),'paranoid':![],'indexes':[{'name':_0xae09('0xc'),'fields':[_0xae09('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 eaf66e4..b20c68d 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 _0x636d=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x511894,_0x2950ef){var _0x2ccc28=function(_0x4b15e8){while(--_0x4b15e8){_0x511894['push'](_0x511894['shift']());}};_0x2ccc28(++_0x2950ef);}(_0x636d,0x1df));var _0xd636=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x636d[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xd636('0x0'));var util=require(_0xd636('0x1'));var moment=require('moment');var BPromise=require(_0xd636('0x2'));var rs=require(_0xd636('0x3'));var fs=require('fs');var Redis=require(_0xd636('0x4'));var db=require(_0xd636('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd636('0x6'))('rpc');var config=require(_0xd636('0x7'));var jayson=require(_0xd636('0x8'));var client=jayson[_0xd636('0x9')][_0xd636('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19ebc5,_0x165316,_0x266ce2){return new BPromise(function(_0x58ac91,_0x27dd41){return client['request'](_0x19ebc5,_0x266ce2)[_0xd636('0xb')](function(_0x363a77){logger[_0xd636('0xc')](_0xd636('0xd'),_0x165316,_0xd636('0xe'));logger[_0xd636('0xf')](_0xd636('0x10'),_0x165316,_0xd636('0xe'),JSON['stringify'](_0x363a77));if(_0x363a77['error']){if(_0x363a77[_0xd636('0x11')]['code']===0x1f4){logger[_0xd636('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x165316,_0x363a77[_0xd636('0x11')][_0xd636('0x12')]);return _0x27dd41(_0x363a77[_0xd636('0x11')][_0xd636('0x12')]);}logger[_0xd636('0x11')](_0xd636('0xd'),_0x165316,_0x363a77[_0xd636('0x11')]['message']);return _0x58ac91(_0x363a77['error'][_0xd636('0x12')]);}else{logger[_0xd636('0xc')](_0xd636('0xd'),_0x165316,_0xd636('0xe'));_0x58ac91(_0x363a77[_0xd636('0x13')]['message']);}})[_0xd636('0x14')](function(_0x2bd3c1){logger[_0xd636('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x165316,_0x2bd3c1);_0x27dd41(_0x2bd3c1);});});} \ No newline at end of file +var _0x757b=['then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x2e61dd,_0x5131b7){var _0x41f98c=function(_0x55b2e8){while(--_0x55b2e8){_0x2e61dd['push'](_0x2e61dd['shift']());}};_0x41f98c(++_0x5131b7);}(_0x757b,0x88));var _0xb757=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x757b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb757('0x0'));var util=require(_0xb757('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb757('0x2'));var fs=require('fs');var Redis=require(_0xb757('0x3'));var db=require(_0xb757('0x4'))['db'];var utils=require(_0xb757('0x5'));var logger=require(_0xb757('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb757('0x7'));var client=jayson[_0xb757('0x8')][_0xb757('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x535a6a,_0x2bce4b,_0x456493){return new BPromise(function(_0x11a6ba,_0x4d77d8){return client[_0xb757('0xa')](_0x535a6a,_0x456493)[_0xb757('0xb')](function(_0x3d184f){logger[_0xb757('0xc')](_0xb757('0xd'),_0x2bce4b,_0xb757('0xe'));logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x2bce4b,_0xb757('0xe'),JSON[_0xb757('0xf')](_0x3d184f));if(_0x3d184f['error']){if(_0x3d184f[_0xb757('0x10')][_0xb757('0x11')]===0x1f4){logger[_0xb757('0x10')](_0xb757('0xd'),_0x2bce4b,_0x3d184f[_0xb757('0x10')][_0xb757('0x12')]);return _0x4d77d8(_0x3d184f[_0xb757('0x10')][_0xb757('0x12')]);}logger[_0xb757('0x10')](_0xb757('0xd'),_0x2bce4b,_0x3d184f[_0xb757('0x10')][_0xb757('0x12')]);return _0x11a6ba(_0x3d184f['error'][_0xb757('0x12')]);}else{logger[_0xb757('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x2bce4b,_0xb757('0xe'));_0x11a6ba(_0x3d184f[_0xb757('0x13')][_0xb757('0x12')]);}})[_0xb757('0x14')](function(_0x2256c0){logger[_0xb757('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x2bce4b,_0x2256c0);_0x4d77d8(_0x2256c0);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 872af5b..fb2c38d 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 _0xc447=['isAuthenticated','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','/describe'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0xc447,0xf7));var _0x7c44=function(_0x4c802d,_0x3e2096){_0x4c802d=_0x4c802d-0x0;var _0x1da688=_0xc447[_0x4c802d];return _0x1da688;};'use strict';var multer=require(_0x7c44('0x0'));var util=require(_0x7c44('0x1'));var path=require(_0x7c44('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7c44('0x3'));var interaction=require(_0x7c44('0x4'));var config=require('../../config/environment');var controller=require(_0x7c44('0x5'));router[_0x7c44('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7c44('0x6')](_0x7c44('0x7'),auth[_0x7c44('0x8')](),controller[_0x7c44('0x9')]);router[_0x7c44('0x6')](_0x7c44('0xa'),auth['isAuthenticated'](),controller[_0x7c44('0xb')]);router[_0x7c44('0xc')]('/',auth[_0x7c44('0x8')](),controller[_0x7c44('0xd')]);router['put'](_0x7c44('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x7c44('0xe')](_0x7c44('0xa'),auth[_0x7c44('0x8')](),controller[_0x7c44('0xf')]);module[_0x7c44('0x10')]=router; \ No newline at end of file +var _0x4bd1=['index','isAuthenticated','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get'];(function(_0x594352,_0x29d569){var _0x3e1e22=function(_0x34939d){while(--_0x34939d){_0x594352['push'](_0x594352['shift']());}};_0x3e1e22(++_0x29d569);}(_0x4bd1,0xfe));var _0x14bd=function(_0x333fed,_0x3d2122){_0x333fed=_0x333fed-0x0;var _0x12cac2=_0x4bd1[_0x333fed];return _0x12cac2;};'use strict';var multer=require(_0x14bd('0x0'));var util=require(_0x14bd('0x1'));var path=require(_0x14bd('0x2'));var timeout=require(_0x14bd('0x3'));var express=require(_0x14bd('0x4'));var router=express[_0x14bd('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x14bd('0x6'));var config=require(_0x14bd('0x7'));var controller=require(_0x14bd('0x8'));router[_0x14bd('0x9')]('/',auth['isAuthenticated'](),controller[_0x14bd('0xa')]);router[_0x14bd('0x9')]('/describe',auth[_0x14bd('0xb')](),controller[_0x14bd('0xc')]);router[_0x14bd('0x9')]('/:id',auth[_0x14bd('0xb')](),controller[_0x14bd('0xd')]);router[_0x14bd('0xe')]('/',auth[_0x14bd('0xb')](),controller[_0x14bd('0xf')]);router[_0x14bd('0x10')]('/:id',auth[_0x14bd('0xb')](),controller[_0x14bd('0x11')]);router[_0x14bd('0x12')](_0x14bd('0x13'),auth[_0x14bd('0xb')](),controller[_0x14bd('0x14')]);module[_0x14bd('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index dfe3d0f..1d59844 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 _0xb975=['alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','star','TEXT','input','name','text','getDataValue','onlineForm','parse','setDataValue','stringify','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.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT'];(function(_0x4c4517,_0x37a0cc){var _0xc5fb17=function(_0x598da5){while(--_0x598da5){_0x4c4517['push'](_0x4c4517['shift']());}};_0xc5fb17(++_0x37a0cc);}(_0xb975,0x19f));var _0x5b97=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0xb975[_0x1c34e7];return _0x378cb1;};'use strict';var Sequelize=require(_0x5b97('0x0'));var rs=require(_0x5b97('0x1'));module['exports']={'name':{'type':Sequelize[_0x5b97('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x5b97('0x2')],'allowNull':![],'unique':_0x5b97('0x3')},'description':{'type':Sequelize[_0x5b97('0x2')]},'mapKey':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0x4')},'mapKeyOffline':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0x5')},'customerAlias':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5b97('0x2')],'allowNull':![],'defaultValue':_0x5b97('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5b97('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5b97('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x5b97('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x5b97('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5b97('0x2')]},'animation':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5b97('0x9')](_0x5b97('0xa'),_0x5b97('0xb')),'defaultValue':_0x5b97('0xa')},'header_online':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0xc')},'start_chat_button':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0xe')},'download_transcript':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x5b97('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5b97('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0x11')},'noteTitle':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0x13')},'closingMessageButton':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0x14')},'skipMessageButton':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0x15')},'conditionAgreement':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x5b97('0x9')](_0x5b97('0x16'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5b97('0x17')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x5b97('0x18'),'variable':null,'config':{'placeholder':_0x5b97('0x19'),'type':_0x5b97('0x1a'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x5b97('0x18'),'props':{'title':_0x5b97('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x5b97('0x4'),'type':_0x5b97('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x5b97('0x1b')](_0x5b97('0x1c'))?JSON[_0x5b97('0x1d')](this[_0x5b97('0x1b')](_0x5b97('0x1c'))):{};},'set':function(_0x34acda){return this[_0x5b97('0x1e')](_0x5b97('0x1c'),JSON[_0x5b97('0x1f')](_0x34acda));}},'offlineForm':{'type':Sequelize[_0x5b97('0x17')],'defaultValue':function(){return JSON[_0x5b97('0x1f')]({'items':[{'type':_0x5b97('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x5b97('0x4'),'type':_0x5b97('0x4')},'variable':null},{'type':_0x5b97('0x20'),'config':{'placeholder':'Comments'},'props':{'title':_0x5b97('0x21'),'helpText':_0x5b97('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x5b97('0x1b')](_0x5b97('0x23'))?JSON[_0x5b97('0x1d')](this['getDataValue']('offlineForm')):{};},'set':function(_0x3f7042){return this[_0x5b97('0x1e')]('offlineForm',JSON[_0x5b97('0x1f')](_0x3f7042));}},'token':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':function(){return rs[_0x5b97('0x24')]();}},'autoclose':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5b97('0x2')]},'waitingTitle':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0x25')},'waitingMessage':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0x27')},'skipUnmanaged':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0x15')},'sendUnmanaged':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0x14')},'enableCustomerAttachment':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x5b97('0x17')]},'showAgentAvatar':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5b97('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5b97('0x28');}},'notificationSound':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x5b97('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0x2b')},'messagesAlignment':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':_0x5b97('0x2c')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x5b97('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x5b97('0x2')],'allowNull':![],'defaultValue':_0x5b97('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5b97('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x5b97('0x2e')},'systemAvatar':{'type':Sequelize[_0x5b97('0x17')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5b97('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':![],'comment':_0x5b97('0x2f'),'set':function(_0x43b215){if(!_0x43b215)this[_0x5b97('0x1e')](_0x5b97('0x30'),null);this[_0x5b97('0x1e')](_0x5b97('0x31'),_0x43b215);}},'vidaooEscalation':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x5b97('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x5b97('0x2')],'defaultValue':function(){return _0x5b97('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x5b97('0x17')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x5b97('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x5b97('0x17')]}}; \ No newline at end of file +var _0xe373=['Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x18084e,_0x1983c6){var _0x46d662=function(_0x4888ab){while(--_0x4888ab){_0x18084e['push'](_0x18084e['shift']());}};_0x46d662(++_0x1983c6);}(_0xe373,0x1aa));var _0x3e37=function(_0x482fd,_0x2cb692){_0x482fd=_0x482fd-0x0;var _0x2c8289=_0xe373[_0x482fd];return _0x2c8289;};'use strict';var Sequelize=require(_0x3e37('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x3e37('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x3e37('0x1')],'allowNull':![],'unique':_0x3e37('0x2')},'description':{'type':Sequelize[_0x3e37('0x1')]},'mapKey':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0x3')},'key':{'type':Sequelize[_0x3e37('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0x4')},'customerAlias':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3e37('0x1')],'allowNull':![],'defaultValue':_0x3e37('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3e37('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x3e37('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3e37('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x3e37('0x1')]},'animation':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3e37('0x9')](_0x3e37('0xa'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0xb')},'start_chat_button':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0xd')},'header_offline':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0xe')},'download_transcript':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x3e37('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3e37('0x10')]},'closingQuestion':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x13')},'placeholderMessage':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x14')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0x15')},'closingMessageButton':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0xd')},'skipMessageButton':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x16')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x17')},'ratingType':{'type':Sequelize[_0x3e37('0x9')]('star',_0x3e37('0x18')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x3e37('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3e37('0x10')],'defaultValue':function(){return JSON[_0x3e37('0x19')]({'items':[{'type':_0x3e37('0x1a'),'variable':null,'config':{'placeholder':_0x3e37('0x1b'),'type':_0x3e37('0x1c'),'required':!![]},'props':{'title':_0x3e37('0x1b'),'helpText':''}},{'type':_0x3e37('0x1a'),'props':{'title':_0x3e37('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x3e37('0x3'),'type':_0x3e37('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3e37('0x1d')](_0x3e37('0x1e'))?JSON[_0x3e37('0x1f')](this['getDataValue'](_0x3e37('0x1e'))):{};},'set':function(_0x324542){return this['setDataValue'](_0x3e37('0x1e'),JSON['stringify'](_0x324542));}},'offlineForm':{'type':Sequelize[_0x3e37('0x10')],'defaultValue':function(){return JSON[_0x3e37('0x19')]({'items':[{'type':_0x3e37('0x1a'),'props':{'title':_0x3e37('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x3e37('0x3'),'type':'email'},'variable':null},{'type':_0x3e37('0x20'),'config':{'placeholder':'Comments'},'props':{'title':_0x3e37('0x21'),'helpText':_0x3e37('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x3e37('0x1d')](_0x3e37('0x23'))?JSON[_0x3e37('0x1f')](this['getDataValue'](_0x3e37('0x23'))):{};},'set':function(_0x15ef4a){return this[_0x3e37('0x24')]('offlineForm',JSON[_0x3e37('0x19')](_0x15ef4a));}},'token':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':function(){return rs[_0x3e37('0x25')]();}},'autoclose':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3e37('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3e37('0x1')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0x26')},'waitingMessage':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3e37('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x3e37('0x29');}},'notificationSound':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x3e37('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x3e37('0x2b')},'verticalAlignment':{'type':Sequelize[_0x3e37('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x2c')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3e37('0x1')],'allowNull':![],'defaultValue':_0x3e37('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3e37('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3e37('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':_0x3e37('0x2e')},'systemAvatar':{'type':Sequelize[_0x3e37('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3e37('0x7')],'comment':_0x3e37('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x3e37('0x8')],'defaultValue':![],'comment':_0x3e37('0x30'),'set':function(_0x2107e2){if(!_0x2107e2)this[_0x3e37('0x24')](_0x3e37('0x31'),null);this[_0x3e37('0x24')](_0x3e37('0x32'),_0x2107e2);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3e37('0x1')]},'vidaooTopic':{'type':Sequelize[_0x3e37('0x1')],'allowNull':![],'defaultValue':_0x3e37('0x33')},'vidaooNote':{'type':Sequelize[_0x3e37('0x1')],'defaultValue':function(){return _0x3e37('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x3e37('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x3e37('0x8')],'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 b36e14d..43584bd 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 _0x4c6d=['root','getLicense','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','ifTime','notify','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','from','List','Contacts','DESC','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','asc','list','contact','headers','closed','ChatInteraction','threadId','interaction','Writing\x20on\x20closed\x20interaction','lastName','messageId','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','forcedOwnership','queueId','queue','Start','EventManager','offline','files','Sequelize','difference','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','ChatOfflineMessage','fromString','originalname','mimetype','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','fullname','internal','Tag','Tags','color','tag','getSnippet','getProactiveActions','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','origin','testWebsiteWithWildcard','connection','remoteAddress','virtual','replace','alignment','verticalAlignment','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','ISOLATION_LEVELS','READ_COMMITTED','priority','finally','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','isArray','emit','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','querystring','html-to-text','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','url','URL','../../mysqldb','redis','defaults','register','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','stack','name','send','user-agent-parser','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','x-real-port','referer','browser','%s\x20%s','unknown','version','format','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','intersection','find','catch','create','body','address','forEach','testWildcardValidity','trim','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','split','params','describe','addDisposition','Disposition','findOne','pick','ChatWebsiteId','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','sitepic','file','addAvatar','filename','addCustomerAvatar','customerAvatar','systemAvatar','join'];(function(_0x5aaf04,_0xe8e359){var _0x2f4980=function(_0x630de3){while(--_0x630de3){_0x5aaf04['push'](_0x5aaf04['shift']());}};_0x2f4980(++_0xe8e359);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x1ec1b4,_0x529bc6){_0x1ec1b4=_0x1ec1b4-0x0;var _0x519065=_0x4c6d[_0x1ec1b4];return _0x519065;};'use strict';var Mustache=require(_0xd4c6('0x0'));var util=require(_0xd4c6('0x1'));var path=require(_0xd4c6('0x2'));var ejs=require(_0xd4c6('0x3'));var fs=require('fs');var fs_extra=require(_0xd4c6('0x4'));var _=require('lodash');var querystring=require(_0xd4c6('0x5'));var htmlToText=require(_0xd4c6('0x6'));var Redis=require(_0xd4c6('0x7'));var jayson=require('jayson/promise');var qs=require(_0xd4c6('0x8'));var logger=require(_0xd4c6('0x9'))('api');var config=require(_0xd4c6('0xa'));var APIBadRequestError=require(_0xd4c6('0xb'))[_0xd4c6('0xc')];var APINotFoundError=require('../../errors/api')[_0xd4c6('0xd')];var APIOutOfIntervalError=require(_0xd4c6('0xb'))[_0xd4c6('0xe')];var APIHandleError=require('../../errors/api')[_0xd4c6('0xf')];var APIConflictError=require(_0xd4c6('0xb'))[_0xd4c6('0x10')];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require(_0xd4c6('0x11'))[_0xd4c6('0x12')];var db=require(_0xd4c6('0x13'))['db'];config[_0xd4c6('0x14')]=_[_0xd4c6('0x15')](config[_0xd4c6('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd4c6('0x14')]));require('./chatWebsite.socket')[_0xd4c6('0x16')](socket);var client=jayson[_0xd4c6('0x17')][_0xd4c6('0x18')]({'port':0x232c});var client9002=jayson[_0xd4c6('0x17')][_0xd4c6('0x18')]({'port':0x232a});var client9003=jayson[_0xd4c6('0x17')][_0xd4c6('0x18')]({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x11e6c2,_0x3deb85,_0x25e1fb,_0x25204d){return new Promise(function(_0x3cb95c,_0x3da1f4){var _0xe52075=_0x25204d||client;return _0xe52075['request'](_0x11e6c2,_0x25e1fb)[_0xd4c6('0x19')](function(_0x44126c){logger[_0xd4c6('0x1a')](_0xd4c6('0x1b'),_0x3deb85,_0xd4c6('0x1c'));logger['debug'](_0xd4c6('0x1d'),_0x3deb85,_0xd4c6('0x1c'),JSON[_0xd4c6('0x1e')](_0x44126c));if(_0x44126c['error']){if(_0x44126c[_0xd4c6('0x1f')][_0xd4c6('0x20')]===0x1f4){logger[_0xd4c6('0x1f')](_0xd4c6('0x1b'),_0x3deb85,_0x44126c['error'][_0xd4c6('0x21')]);return _0x3da1f4(_0x44126c['error'][_0xd4c6('0x21')]);}logger[_0xd4c6('0x1f')](_0xd4c6('0x1b'),_0x3deb85,_0x44126c[_0xd4c6('0x1f')][_0xd4c6('0x21')]);return _0x3cb95c(_0x44126c[_0xd4c6('0x1f')][_0xd4c6('0x21')]);}else{logger[_0xd4c6('0x1a')](_0xd4c6('0x1b'),_0x3deb85,_0xd4c6('0x1c'));_0x3cb95c(_0x44126c[_0xd4c6('0x22')][_0xd4c6('0x21')]);}})['catch'](function(_0x582326){logger[_0xd4c6('0x1f')](_0xd4c6('0x1b'),_0x3deb85,_0x582326);_0x3da1f4(_0x582326);});});}function respondWithStatusCode(_0x4a5390,_0x1dee19){_0x1dee19=_0x1dee19||0xcc;return function(_0x3a2c50){if(_0x3a2c50){return _0x4a5390[_0xd4c6('0x23')](_0x1dee19);}return _0x4a5390['status'](_0x1dee19)[_0xd4c6('0x24')]();};}function respondWithResult(_0x30276c,_0x5614f3){_0x5614f3=_0x5614f3||0xc8;return function(_0x406ed0){if(_0x406ed0){return _0x30276c[_0xd4c6('0x25')](_0x5614f3)[_0xd4c6('0x26')](_0x406ed0);}};}function respondWithFilteredResult(_0x488e7e,_0x3ce942){return function(_0x3b656d){if(_0x3b656d){var _0x255630=typeof _0x3ce942[_0xd4c6('0x27')]===_0xd4c6('0x28')&&typeof _0x3ce942[_0xd4c6('0x29')]===_0xd4c6('0x28');var _0x1f32d8=_0x3b656d[_0xd4c6('0x2a')];var _0x1de7ae=_0x255630?0x0:_0x3ce942[_0xd4c6('0x27')];var _0x31e3d0=_0x255630?_0x3b656d[_0xd4c6('0x2a')]:_0x3ce942[_0xd4c6('0x27')]+_0x3ce942['limit'];var _0x25229b;if(_0x31e3d0>=_0x1f32d8){_0x31e3d0=_0x1f32d8;_0x25229b=0xc8;}else{_0x25229b=0xce;}_0x488e7e[_0xd4c6('0x25')](_0x25229b);return _0x488e7e[_0xd4c6('0x2b')](_0xd4c6('0x2c'),_0x1de7ae+'-'+_0x31e3d0+'/'+_0x1f32d8)['json'](_0x3b656d);}return null;};}function saveUpdates(_0x4f8a76){return function(_0x5737cb){if(_0x5737cb){return _0x5737cb[_0xd4c6('0x2d')](_0x4f8a76)[_0xd4c6('0x19')](function(_0x1eb355){return _0x1eb355;});}return null;};}function removeEntity(_0x2ee8df){return function(_0x1ac153){if(_0x1ac153){return _0x1ac153[_0xd4c6('0x2e')]()[_0xd4c6('0x19')](function(){var _0x5cd469=_0x1ac153[_0xd4c6('0x2f')]({'plain':!![]});var _0x3ae596=_0xd4c6('0x30');return db['UserProfileResource'][_0xd4c6('0x2e')]({'where':{'type':_0x3ae596,'resourceId':_0x5cd469['id']}})[_0xd4c6('0x19')](function(){return _0x1ac153;});})[_0xd4c6('0x19')](function(){_0x2ee8df['status'](0xcc)[_0xd4c6('0x24')]();});}};}function handleEntityNotFound(_0x37a3a1){return function(_0xdff93){if(!_0xdff93){_0x37a3a1[_0xd4c6('0x23')](0x194);}return _0xdff93;};}function handleError(_0x4af6b9,_0x25b48a){_0x25b48a=_0x25b48a||0x1f4;return function(_0x155b05){logger[_0xd4c6('0x1f')](_0x155b05[_0xd4c6('0x31')]);if(_0x155b05[_0xd4c6('0x32')]){delete _0x155b05['name'];}_0x4af6b9[_0xd4c6('0x25')](_0x25b48a)[_0xd4c6('0x33')](_0x155b05);};}function createInteractionObject(_0xdcd5fc,_0x1269bf,_0x24a145,_0x2cdb9d){var _0x554666=require(_0xd4c6('0x34'));var _0x3e9e92=new _0x554666();var _0x3bb951=_0x3e9e92['setUA'](_0x24a145[_0xd4c6('0x35')])[_0xd4c6('0x36')]();var _0x1c95e3=_0x1269bf[_0xd4c6('0x37')];if(_0x24a145[_0xd4c6('0x38')]){_0x1c95e3=_0x24a145[_0xd4c6('0x38')];}else if(_0x24a145[_0xd4c6('0x39')]){_0x1c95e3=_[_0xd4c6('0x3a')](_0x24a145[_0xd4c6('0x39')]['split'](','));}return{'ContactId':_0x2cdb9d['id'],'ChatWebsiteId':_0xdcd5fc,'from':(_0x2cdb9d[_0xd4c6('0x3b')]||'')+'\x20'+(_0x2cdb9d['lastName']||''),'customerIp':_0x1c95e3,'customerPort':_0x24a145['x-real-port']?_0x24a145[_0xd4c6('0x3c')]:null,'referer':_0x1269bf[_0xd4c6('0x3d')],'browserName':_0x3bb951[_0xd4c6('0x3e')][_0xd4c6('0x32')]&&_0x3bb951[_0xd4c6('0x3e')]['version']?util['format'](_0xd4c6('0x3f'),_0x3bb951[_0xd4c6('0x3e')][_0xd4c6('0x32')],_0x3bb951[_0xd4c6('0x3e')]['version']):_0xd4c6('0x40'),'browserVersion':_0x3bb951['browser'][_0xd4c6('0x41')]||_0xd4c6('0x40'),'osName':util[_0xd4c6('0x42')]('%s\x20%s',_0x3bb951['os'][_0xd4c6('0x32')],_0x3bb951['os'][_0xd4c6('0x41')]),'osVersion':_0x3bb951['os'][_0xd4c6('0x41')],'deviceModel':_0x3bb951[_0xd4c6('0x43')][_0xd4c6('0x44')]&&_0x3bb951[_0xd4c6('0x43')][_0xd4c6('0x45')]?util[_0xd4c6('0x42')](_0xd4c6('0x46'),_0x3bb951['device'][_0xd4c6('0x44')],_0x3bb951[_0xd4c6('0x43')][_0xd4c6('0x45')],_0x3bb951['device'][_0xd4c6('0x47')]):null,'deviceVendor':_0x3bb951[_0xd4c6('0x43')][_0xd4c6('0x45')],'deviceType':_0x3bb951['device']['type'],'formData':JSON[_0xd4c6('0x1e')](_0x1269bf)};}exports[_0xd4c6('0x48')]=function(_0x36ce36,_0x5b9816){var _0x3410c2={'include':[{'model':db[_0xd4c6('0x49')],'as':_0xd4c6('0x4a')}]},_0x1e0b04={},_0x1a53e9={'count':0x0,'rows':[]};var _0x1ae91b=_['map'](db[_0xd4c6('0x4b')][_0xd4c6('0x4c')],function(_0x1c61e5){return{'name':_0x1c61e5[_0xd4c6('0x4d')],'type':_0x1c61e5[_0xd4c6('0x47')][_0xd4c6('0x4e')]};});_0x1e0b04[_0xd4c6('0x44')]=_[_0xd4c6('0x4f')](_0x1ae91b,'name');_0x1e0b04['query']=_[_0xd4c6('0x50')](_0x36ce36[_0xd4c6('0x51')]);_0x1e0b04[_0xd4c6('0x52')]=_['intersection'](_0x1e0b04[_0xd4c6('0x44')],_0x1e0b04[_0xd4c6('0x51')]);_0x3410c2[_0xd4c6('0x53')]=_['intersection'](_0x1e0b04[_0xd4c6('0x44')],qs[_0xd4c6('0x54')](_0x36ce36[_0xd4c6('0x51')][_0xd4c6('0x54')]));_0x3410c2['attributes']=_0x3410c2[_0xd4c6('0x53')][_0xd4c6('0x55')]?_0x3410c2[_0xd4c6('0x53')]:_0x1e0b04[_0xd4c6('0x44')];if(!_0x36ce36[_0xd4c6('0x51')][_0xd4c6('0x56')](_0xd4c6('0x57'))){_0x3410c2['limit']=qs[_0xd4c6('0x29')](_0x36ce36[_0xd4c6('0x51')][_0xd4c6('0x29')]);_0x3410c2['offset']=qs[_0xd4c6('0x27')](_0x36ce36[_0xd4c6('0x51')][_0xd4c6('0x27')]);}_0x3410c2[_0xd4c6('0x58')]=qs[_0xd4c6('0x59')](_0x36ce36[_0xd4c6('0x51')][_0xd4c6('0x59')]);_0x3410c2['where']=qs[_0xd4c6('0x52')](_['pick'](_0x36ce36['query'],_0x1e0b04[_0xd4c6('0x52')]),_0x1ae91b);if(_0x36ce36['query'][_0xd4c6('0x5a')]){_0x3410c2['where']=_[_0xd4c6('0x5b')](_0x3410c2['where'],{'$or':_['map'](_0x1ae91b,function(_0x33d12d){if(_0x33d12d[_0xd4c6('0x47')]!==_0xd4c6('0x5c')){var _0x256e45={};_0x256e45[_0x33d12d[_0xd4c6('0x32')]]={'$like':'%'+_0x36ce36[_0xd4c6('0x51')][_0xd4c6('0x5a')]+'%'};return _0x256e45;}})});}_0x3410c2=_[_0xd4c6('0x5b')]({},_0x3410c2,_0x36ce36[_0xd4c6('0x5d')]);var _0x5e52db={'where':_0x3410c2[_0xd4c6('0x5e')]};return db[_0xd4c6('0x4b')][_0xd4c6('0x2a')](_0x5e52db)[_0xd4c6('0x19')](function(_0x19f8fe){_0x1a53e9[_0xd4c6('0x2a')]=_0x19f8fe;if(_0x36ce36[_0xd4c6('0x51')][_0xd4c6('0x5f')]){_0x3410c2[_0xd4c6('0x60')]=[{'all':!![]}];}return db[_0xd4c6('0x4b')][_0xd4c6('0x61')](_0x3410c2);})['then'](function(_0x51dda2){_0x1a53e9[_0xd4c6('0x62')]=_0x51dda2;return _0x1a53e9;})[_0xd4c6('0x19')](respondWithFilteredResult(_0x5b9816,_0x3410c2))['catch'](handleError(_0x5b9816,null));};exports['show']=function(_0x4a86e3,_0x211c55){var _0x218250={'raw':![],'where':{'id':_0x4a86e3['params']['id']},'include':[{'model':db[_0xd4c6('0x49')],'as':_0xd4c6('0x4a')}]},_0x4b61c7={};_0x4b61c7[_0xd4c6('0x44')]=_[_0xd4c6('0x50')](db[_0xd4c6('0x4b')]['rawAttributes']);_0x4b61c7[_0xd4c6('0x51')]=_[_0xd4c6('0x50')](_0x4a86e3[_0xd4c6('0x51')]);_0x4b61c7[_0xd4c6('0x52')]=_[_0xd4c6('0x63')](_0x4b61c7[_0xd4c6('0x44')],_0x4b61c7[_0xd4c6('0x51')]);_0x218250[_0xd4c6('0x53')]=_[_0xd4c6('0x63')](_0x4b61c7[_0xd4c6('0x44')],qs[_0xd4c6('0x54')](_0x4a86e3[_0xd4c6('0x51')][_0xd4c6('0x54')]));_0x218250['attributes']=_0x218250['attributes'][_0xd4c6('0x55')]?_0x218250['attributes']:_0x4b61c7['model'];if(_0x4a86e3['query'][_0xd4c6('0x5f')]){_0x218250[_0xd4c6('0x60')]=[{'all':!![]}];}_0x218250=_[_0xd4c6('0x5b')]({},_0x218250,_0x4a86e3[_0xd4c6('0x5d')]);return db['ChatWebsite'][_0xd4c6('0x64')](_0x218250)[_0xd4c6('0x19')](handleEntityNotFound(_0x211c55,null))['then'](respondWithResult(_0x211c55,null))[_0xd4c6('0x65')](handleError(_0x211c55,null));};exports[_0xd4c6('0x66')]=function(_0x3873d6,_0x192311){var _0x5cf823=null;_0x3873d6[_0xd4c6('0x67')][_0xd4c6('0x68')]['split'](',')[_0xd4c6('0x69')](_0xbbdb9c=>{if(_0xbbdb9c['trim']()!==''&&!wildcardUtils[_0xd4c6('0x6a')](_0xbbdb9c[_0xd4c6('0x6b')]())){_0x5cf823=new APIBadRequestError('\x22'+_0xbbdb9c['trim']()+_0xd4c6('0x6c'));}});if(_0x5cf823){return handleError(_0x192311,null)(_0x5cf823);}return db['ChatWebsite'][_0xd4c6('0x66')](_0x3873d6[_0xd4c6('0x67')],{})[_0xd4c6('0x19')](function(_0x116604){var _0x2a8448=_0x3873d6[_0xd4c6('0x6d')]['get']({'plain':!![]});if(!_0x2a8448)throw new Error(_0xd4c6('0x6e'));if(_0x2a8448['role']===_0xd4c6('0x6d')){var _0x336cbd=_0x116604['get']({'plain':!![]});var _0x136fd1=_0xd4c6('0x30');return db[_0xd4c6('0x6f')]['find']({'where':{'name':_0x136fd1,'userProfileId':_0x2a8448[_0xd4c6('0x70')]},'raw':!![]})['then'](function(_0x1ade87){if(_0x1ade87&&_0x1ade87[_0xd4c6('0x71')]===0x0){return db['UserProfileResource'][_0xd4c6('0x66')]({'name':_0x336cbd['name'],'resourceId':_0x336cbd['id'],'type':_0x1ade87[_0xd4c6('0x32')],'sectionId':_0x1ade87['id']},{})[_0xd4c6('0x19')](function(){return _0x116604;});}else{return _0x116604;}})['catch'](function(_0x22032b){logger[_0xd4c6('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22032b);throw _0x22032b;});}return _0x116604;})[_0xd4c6('0x19')](respondWithResult(_0x192311,0xc9))[_0xd4c6('0x65')](handleError(_0x192311,null));};exports['update']=function(_0x237255,_0x1b30f1){var _0x247ad3=null;_0x237255['body'][_0xd4c6('0x68')][_0xd4c6('0x72')](',')[_0xd4c6('0x69')](_0x324d88=>{if(_0x324d88[_0xd4c6('0x6b')]()!==''&&!wildcardUtils[_0xd4c6('0x6a')](_0x324d88[_0xd4c6('0x6b')]())){_0x247ad3=new APIBadRequestError('\x22'+_0x324d88[_0xd4c6('0x6b')]()+_0xd4c6('0x6c'));}});if(_0x247ad3){return handleError(_0x1b30f1,null)(_0x247ad3);}if(_0x237255[_0xd4c6('0x67')]['id']){delete _0x237255[_0xd4c6('0x67')]['id'];}return db[_0xd4c6('0x4b')][_0xd4c6('0x64')]({'where':{'id':_0x237255[_0xd4c6('0x73')]['id']},'include':[{'model':db[_0xd4c6('0x49')],'as':_0xd4c6('0x4a')}]})[_0xd4c6('0x19')](handleEntityNotFound(_0x1b30f1,null))[_0xd4c6('0x19')](saveUpdates(_0x237255[_0xd4c6('0x67')],null))['then'](respondWithResult(_0x1b30f1,null))['catch'](handleError(_0x1b30f1,null));};exports[_0xd4c6('0x2e')]=function(_0x477451,_0x143c00){return db[_0xd4c6('0x4b')][_0xd4c6('0x64')]({'where':{'id':_0x477451[_0xd4c6('0x73')]['id']}})[_0xd4c6('0x19')](handleEntityNotFound(_0x143c00,null))[_0xd4c6('0x19')](removeEntity(_0x143c00,null))['catch'](handleError(_0x143c00,null));};exports[_0xd4c6('0x74')]=function(_0x1eb9bd,_0x25ccd6){return db['ChatWebsite'][_0xd4c6('0x74')]()[_0xd4c6('0x19')](respondWithResult(_0x25ccd6,null))['catch'](handleError(_0x25ccd6,null));};exports[_0xd4c6('0x75')]=function(_0x4152e7,_0x4a7d0b){if(_0x4152e7[_0xd4c6('0x67')]['id']){delete _0x4152e7['body']['id'];}return db[_0xd4c6('0x4b')][_0xd4c6('0x64')]({'where':{'id':_0x4152e7[_0xd4c6('0x73')]['id']}})[_0xd4c6('0x19')](handleEntityNotFound(_0x4a7d0b,null))['then'](function(_0x81b8e5){if(_0x81b8e5){_0x4152e7[_0xd4c6('0x67')]['ChatWebsiteId']=_0x81b8e5['id'];return db[_0xd4c6('0x76')][_0xd4c6('0x66')](_0x4152e7['body']);}})[_0xd4c6('0x19')](respondWithResult(_0x4a7d0b,null))[_0xd4c6('0x65')](handleError(_0x4a7d0b,null));};exports['getDispositions']=function(_0x59b98f,_0x62dcac){var _0x16fecf={'raw':![],'where':{}};var _0x44eb65={};var _0x2d406d={'count':0x0,'rows':[]};return db[_0xd4c6('0x4b')][_0xd4c6('0x77')]({'where':{'id':_0x59b98f['params']['id']}})[_0xd4c6('0x19')](handleEntityNotFound(_0x62dcac,null))[_0xd4c6('0x19')](function(_0x1f2826){if(_0x1f2826){_0x44eb65[_0xd4c6('0x44')]=_[_0xd4c6('0x50')](db[_0xd4c6('0x76')]['rawAttributes']);_0x44eb65['query']=_[_0xd4c6('0x50')](_0x59b98f[_0xd4c6('0x51')]);_0x44eb65[_0xd4c6('0x52')]=_[_0xd4c6('0x63')](_0x44eb65[_0xd4c6('0x44')],_0x44eb65['query']);_0x16fecf[_0xd4c6('0x53')]=_[_0xd4c6('0x63')](_0x44eb65[_0xd4c6('0x44')],qs[_0xd4c6('0x54')](_0x59b98f[_0xd4c6('0x51')]['fields']));_0x16fecf[_0xd4c6('0x53')]=_0x16fecf['attributes'][_0xd4c6('0x55')]?_0x16fecf[_0xd4c6('0x53')]:_0x44eb65[_0xd4c6('0x44')];if(!_0x59b98f[_0xd4c6('0x51')][_0xd4c6('0x56')](_0xd4c6('0x57'))){_0x16fecf[_0xd4c6('0x29')]=qs[_0xd4c6('0x29')](_0x59b98f[_0xd4c6('0x51')]['limit']);_0x16fecf['offset']=qs['offset'](_0x59b98f[_0xd4c6('0x51')][_0xd4c6('0x27')]);}_0x16fecf[_0xd4c6('0x58')]=qs[_0xd4c6('0x59')](_0x59b98f[_0xd4c6('0x51')][_0xd4c6('0x59')]);_0x16fecf[_0xd4c6('0x5e')]=qs['filters'](_[_0xd4c6('0x78')](_0x59b98f[_0xd4c6('0x51')],_0x44eb65['filters']));_0x16fecf[_0xd4c6('0x5e')][_0xd4c6('0x79')]=_0x1f2826['id'];if(_0x59b98f['query']['filter']){_0x16fecf['where']=_[_0xd4c6('0x5b')](_0x16fecf[_0xd4c6('0x5e')],{'$or':_['map'](_0x16fecf['attributes'],function(_0x577b8c){var _0x22a30c={};_0x22a30c[_0x577b8c]={'$like':'%'+_0x59b98f[_0xd4c6('0x51')][_0xd4c6('0x5a')]+'%'};return _0x22a30c;})});}_0x16fecf=_[_0xd4c6('0x5b')]({},_0x16fecf,_0x59b98f['options']);return db[_0xd4c6('0x76')][_0xd4c6('0x2a')]({'where':_0x16fecf['where']})[_0xd4c6('0x19')](function(_0x40ee9e){_0x2d406d['count']=_0x40ee9e;if(_0x59b98f['query'][_0xd4c6('0x5f')]){_0x16fecf[_0xd4c6('0x60')]=[{'all':!![]}];}return db[_0xd4c6('0x76')]['findAll'](_0x16fecf);})[_0xd4c6('0x19')](function(_0x567398){_0x2d406d[_0xd4c6('0x62')]=_0x567398;return _0x2d406d;});}})[_0xd4c6('0x19')](respondWithFilteredResult(_0x62dcac,_0x16fecf))[_0xd4c6('0x65')](handleError(_0x62dcac,null));};exports[_0xd4c6('0x7a')]=function(_0x56a794,_0x4c5c1f){return db[_0xd4c6('0x4b')]['find']({'where':{'id':_0x56a794[_0xd4c6('0x73')]['id']}})[_0xd4c6('0x19')](handleEntityNotFound(_0x4c5c1f,null))['then'](function(_0x29065b){if(_0x29065b){return _0x29065b[_0xd4c6('0x7a')](_0x56a794[_0xd4c6('0x51')]['ids']);}})['then'](respondWithStatusCode(_0x4c5c1f,null))[_0xd4c6('0x65')](handleError(_0x4c5c1f,null));};exports[_0xd4c6('0x7b')]=function(_0x35dbb2,_0x4763ec){if(_0x35dbb2[_0xd4c6('0x67')]['id']){delete _0x35dbb2[_0xd4c6('0x67')]['id'];}return db[_0xd4c6('0x4b')][_0xd4c6('0x64')]({'where':{'id':_0x35dbb2[_0xd4c6('0x73')]['id']}})[_0xd4c6('0x19')](handleEntityNotFound(_0x4763ec,null))[_0xd4c6('0x19')](function(_0x320812){if(_0x320812){_0x35dbb2[_0xd4c6('0x67')]['ChatWebsiteId']=_0x320812['id'];return db['CannedAnswer'][_0xd4c6('0x66')](_0x35dbb2['body']);}})[_0xd4c6('0x19')](respondWithResult(_0x4763ec,null))[_0xd4c6('0x65')](handleError(_0x4763ec,null));};exports[_0xd4c6('0x7c')]=function(_0x1b91a1,_0x23461a){var _0x2f01e6={'raw':![],'where':{}};var _0x355b52={};var _0x5b44f8={'count':0x0,'rows':[]};return db[_0xd4c6('0x4b')][_0xd4c6('0x77')]({'where':{'id':_0x1b91a1[_0xd4c6('0x73')]['id']}})['then'](handleEntityNotFound(_0x23461a,null))[_0xd4c6('0x19')](function(_0x163561){if(_0x163561){_0x355b52[_0xd4c6('0x44')]=_[_0xd4c6('0x50')](db[_0xd4c6('0x7d')][_0xd4c6('0x4c')]);_0x355b52[_0xd4c6('0x51')]=_[_0xd4c6('0x50')](_0x1b91a1[_0xd4c6('0x51')]);_0x355b52[_0xd4c6('0x52')]=_[_0xd4c6('0x63')](_0x355b52[_0xd4c6('0x44')],_0x355b52[_0xd4c6('0x51')]);_0x2f01e6[_0xd4c6('0x53')]=_[_0xd4c6('0x63')](_0x355b52[_0xd4c6('0x44')],qs['fields'](_0x1b91a1[_0xd4c6('0x51')]['fields']));_0x2f01e6[_0xd4c6('0x53')]=_0x2f01e6[_0xd4c6('0x53')][_0xd4c6('0x55')]?_0x2f01e6[_0xd4c6('0x53')]:_0x355b52[_0xd4c6('0x44')];if(!_0x1b91a1[_0xd4c6('0x51')][_0xd4c6('0x56')]('nolimit')){_0x2f01e6[_0xd4c6('0x29')]=qs['limit'](_0x1b91a1[_0xd4c6('0x51')]['limit']);_0x2f01e6[_0xd4c6('0x27')]=qs[_0xd4c6('0x27')](_0x1b91a1['query'][_0xd4c6('0x27')]);}_0x2f01e6[_0xd4c6('0x58')]=qs[_0xd4c6('0x59')](_0x1b91a1[_0xd4c6('0x51')][_0xd4c6('0x59')]);_0x2f01e6[_0xd4c6('0x5e')]=qs[_0xd4c6('0x52')](_[_0xd4c6('0x78')](_0x1b91a1[_0xd4c6('0x51')],_0x355b52['filters']));_0x2f01e6[_0xd4c6('0x5e')]['ChatWebsiteId']=_0x163561['id'];if(_0x1b91a1['query'][_0xd4c6('0x5a')]){_0x2f01e6[_0xd4c6('0x5e')]=_[_0xd4c6('0x5b')](_0x2f01e6[_0xd4c6('0x5e')],{'$or':_[_0xd4c6('0x4f')](_0x2f01e6[_0xd4c6('0x53')],function(_0xa2e4be){var _0xe41b8a={};_0xe41b8a[_0xa2e4be]={'$like':'%'+_0x1b91a1[_0xd4c6('0x51')][_0xd4c6('0x5a')]+'%'};return _0xe41b8a;})});}_0x2f01e6=_[_0xd4c6('0x5b')]({},_0x2f01e6,_0x1b91a1[_0xd4c6('0x5d')]);return db[_0xd4c6('0x7d')][_0xd4c6('0x2a')]({'where':_0x2f01e6[_0xd4c6('0x5e')]})[_0xd4c6('0x19')](function(_0x9dc0a8){_0x5b44f8[_0xd4c6('0x2a')]=_0x9dc0a8;if(_0x1b91a1[_0xd4c6('0x51')][_0xd4c6('0x5f')]){_0x2f01e6[_0xd4c6('0x60')]=[{'all':!![]}];}return db[_0xd4c6('0x7d')][_0xd4c6('0x61')](_0x2f01e6);})['then'](function(_0x340449){_0x5b44f8[_0xd4c6('0x62')]=_0x340449;return _0x5b44f8;});}})[_0xd4c6('0x19')](respondWithFilteredResult(_0x23461a,_0x2f01e6))[_0xd4c6('0x65')](handleError(_0x23461a,null));};exports[_0xd4c6('0x7e')]=function(_0x2ead6a,_0x3c573e){return db[_0xd4c6('0x4b')][_0xd4c6('0x64')]({'where':{'id':_0x2ead6a[_0xd4c6('0x73')]['id']}})[_0xd4c6('0x19')](handleEntityNotFound(_0x3c573e,null))[_0xd4c6('0x19')](function(_0x30d46d){if(_0x30d46d){return _0x30d46d['removeAnswers'](_0x2ead6a[_0xd4c6('0x51')][_0xd4c6('0x7f')]);}})[_0xd4c6('0x19')](respondWithStatusCode(_0x3c573e,null))['catch'](handleError(_0x3c573e,null));};exports['addLogo']=function(_0xf2f815,_0x2d75b0){_0xf2f815[_0xd4c6('0x67')][_0xd4c6('0x80')]=_0xf2f815[_0xd4c6('0x81')]['filename'];return db[_0xd4c6('0x4b')]['find']({'where':{'id':_0xf2f815[_0xd4c6('0x73')]['id']}})[_0xd4c6('0x19')](handleEntityNotFound(_0x2d75b0,null))[_0xd4c6('0x19')](saveUpdates(_0xf2f815['body'],null))[_0xd4c6('0x19')](respondWithResult(_0x2d75b0,null))['catch'](handleError(_0x2d75b0,null));};exports[_0xd4c6('0x82')]=function(_0xab677,_0x3cc399){_0xab677['body']['agentAvatar']=_0xab677['file'][_0xd4c6('0x83')];return db[_0xd4c6('0x4b')][_0xd4c6('0x64')]({'where':{'id':_0xab677['params']['id']}})[_0xd4c6('0x19')](handleEntityNotFound(_0x3cc399,null))['then'](saveUpdates(_0xab677[_0xd4c6('0x67')],null))[_0xd4c6('0x19')](respondWithResult(_0x3cc399,null))['catch'](handleError(_0x3cc399,null));};exports[_0xd4c6('0x84')]=function(_0x722821,_0x372666){_0x722821['body'][_0xd4c6('0x85')]=_0x722821[_0xd4c6('0x81')][_0xd4c6('0x83')];return db['ChatWebsite']['find']({'where':{'id':_0x722821['params']['id']}})[_0xd4c6('0x19')](handleEntityNotFound(_0x372666,null))[_0xd4c6('0x19')](saveUpdates(_0x722821[_0xd4c6('0x67')],null))[_0xd4c6('0x19')](respondWithResult(_0x372666,null))[_0xd4c6('0x65')](handleError(_0x372666,null));};exports['addSystemAvatar']=function(_0x3977be,_0x2373f0){_0x3977be[_0xd4c6('0x67')][_0xd4c6('0x86')]=_0x3977be['file'][_0xd4c6('0x83')];return db[_0xd4c6('0x4b')][_0xd4c6('0x64')]({'where':{'id':_0x3977be[_0xd4c6('0x73')]['id']}})[_0xd4c6('0x19')](handleEntityNotFound(_0x2373f0,null))['then'](saveUpdates(_0x3977be[_0xd4c6('0x67')],null))[_0xd4c6('0x19')](respondWithResult(_0x2373f0,null))['catch'](handleError(_0x2373f0,null));};exports['getLogo']=function(_0x50a150,_0x53ef92){var _0x2dce13=path[_0xd4c6('0x87')](config[_0xd4c6('0x88')],'server/files/images/logos/default_logo.svg');var _0x33df7e={'where':{'id':_0x50a150[_0xd4c6('0x73')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x1865f6=![];return require('../../config/license/util')[_0xd4c6('0x89')]()[_0xd4c6('0x19')](function(_0x1233c6){if(_0x1233c6){_0x1865f6=_0x1233c6['custom'];}})[_0xd4c6('0x19')](function(){return db[_0xd4c6('0x4b')][_0xd4c6('0x64')](_0x33df7e);})[_0xd4c6('0x19')](handleEntityNotFound(_0x53ef92,null))[_0xd4c6('0x19')](function(_0x2eefa9){if(_0x2eefa9){if(!_['isNil'](_0x2eefa9[_0xd4c6('0x80')])){if(fs[_0xd4c6('0x8a')](path['join'](config[_0xd4c6('0x88')],_0xd4c6('0x8b'),_0x2eefa9['sitepic']))&&_0x1865f6){_0x2dce13=path[_0xd4c6('0x87')](config[_0xd4c6('0x88')],_0xd4c6('0x8b'),_0x2eefa9['sitepic']);}}return _0x53ef92[_0xd4c6('0x8c')](_0x2dce13);}})[_0xd4c6('0x65')](handleError(_0x53ef92,null));};exports[_0xd4c6('0x8d')]=function(_0x3f88f5,_0x52a0e9){var _0x479b4f=path[_0xd4c6('0x87')](config[_0xd4c6('0x88')],_0xd4c6('0x8e'));var _0x2e1cbe={'where':{'id':_0x3f88f5['params']['id']},'attributes':['id',_0xd4c6('0x8f')],'raw':!![]};return db[_0xd4c6('0x4b')][_0xd4c6('0x64')](_0x2e1cbe)[_0xd4c6('0x19')](handleEntityNotFound(_0x52a0e9,null))['then'](function(_0xf4b7f2){if(_0xf4b7f2){if(!_[_0xd4c6('0x90')](_0xf4b7f2[_0xd4c6('0x8f')])){if(fs['existsSync'](path[_0xd4c6('0x87')](config['root'],_0xd4c6('0x91'),_0xf4b7f2[_0xd4c6('0x8f')]))){_0x479b4f=path[_0xd4c6('0x87')](config['root'],_0xd4c6('0x91'),_0xf4b7f2[_0xd4c6('0x8f')]);}}return _0x52a0e9[_0xd4c6('0x8c')](_0x479b4f);}})['catch'](handleError(_0x52a0e9,null));};exports[_0xd4c6('0x92')]=function(_0x41b4e9,_0x3255df){var _0x210383=path[_0xd4c6('0x87')](config['root'],_0xd4c6('0x93'));var _0x4adb59={'where':{'id':_0x41b4e9['params']['id']},'attributes':['id',_0xd4c6('0x85'),_0xd4c6('0x94')],'raw':!![]};return db[_0xd4c6('0x4b')][_0xd4c6('0x64')](_0x4adb59)[_0xd4c6('0x19')](handleEntityNotFound(_0x3255df,null))[_0xd4c6('0x19')](function(_0x386dca){if(_0x386dca){if(!_['isNil'](_0x386dca[_0xd4c6('0x85')])){if(fs[_0xd4c6('0x8a')](path[_0xd4c6('0x87')](config[_0xd4c6('0x88')],_0xd4c6('0x91'),_0x386dca[_0xd4c6('0x85')]))&&_0x386dca[_0xd4c6('0x94')]){_0x210383=path[_0xd4c6('0x87')](config[_0xd4c6('0x88')],_0xd4c6('0x91'),_0x386dca[_0xd4c6('0x85')]);}}return _0x3255df['download'](_0x210383);}})[_0xd4c6('0x65')](handleError(_0x3255df,null));};exports[_0xd4c6('0x95')]=function(_0x28eb72,_0x4b121d){var _0x17c55a=path[_0xd4c6('0x87')](config[_0xd4c6('0x88')],_0xd4c6('0x96'));var _0x253643={'where':{'id':_0x28eb72[_0xd4c6('0x73')]['id']},'attributes':['id',_0xd4c6('0x86')],'raw':!![]};return db[_0xd4c6('0x4b')][_0xd4c6('0x64')](_0x253643)[_0xd4c6('0x19')](handleEntityNotFound(_0x4b121d,null))[_0xd4c6('0x19')](function(_0x2e52f3){if(_0x2e52f3){if(!_[_0xd4c6('0x90')](_0x2e52f3['systemAvatar'])){if(fs[_0xd4c6('0x8a')](path['join'](config[_0xd4c6('0x88')],_0xd4c6('0x91'),_0x2e52f3[_0xd4c6('0x86')]))){_0x17c55a=path[_0xd4c6('0x87')](config['root'],_0xd4c6('0x91'),_0x2e52f3['systemAvatar']);}}return _0x4b121d[_0xd4c6('0x8c')](_0x17c55a);}})[_0xd4c6('0x65')](handleError(_0x4b121d,null));};function checkWebsiteInterval(_0x4b9ed7){var _0x5413d0=_0x4b9ed7[_0xd4c6('0x97')];if(!_0x5413d0){return Promise[_0xd4c6('0x98')](_0x4b9ed7);}var _0x3df331=_0x4b9ed7['timezone']||undefined;return _0x5413d0[_0xd4c6('0x99')](_0x3df331)[_0xd4c6('0x19')](function(_0x2c3024){if(!_0x2c3024){throw new APIOutOfIntervalError();}return _0x4b9ed7;});}exports[_0xd4c6('0x9a')]=function(_0xdaaeb1,_0x3050bb){var _0x328eef={'body':_0xdaaeb1[_0xd4c6('0x67')],'channel':'chat'};var _0x5ce38a=[];var _0x34afb4=[];var _0x3e10a9={};var _0x1dae40=![];if(_0xdaaeb1['body']['id']){delete _0xdaaeb1['body']['id'];}if(_[_0xd4c6('0x90')](_0xdaaeb1[_0xd4c6('0x67')]['from'])){throw new APIBadRequestError(_0xd4c6('0x9b'));}if(_[_0xd4c6('0x90')](_0xdaaeb1[_0xd4c6('0x67')][_0xd4c6('0x9c')])){throw new APIBadRequestError(_0xd4c6('0x9d'));}if(_[_0xd4c6('0x9e')](_0xdaaeb1[_0xd4c6('0x67')][_0xd4c6('0x67')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0xefe392=_0xdaaeb1[_0xd4c6('0x67')]['customerIp']&&_0xdaaeb1[_0xd4c6('0x67')][_0xd4c6('0x3d')];return db[_0xd4c6('0x9f')]['describe']()[_0xd4c6('0x19')](function(_0x27e2bb){if(!_0x27e2bb){throw new Error(_0xd4c6('0xa0'));}_0x5ce38a=Object[_0xd4c6('0x50')](_0x27e2bb)['filter'](function(_0x2196ae){return![_0xd4c6('0xa1'),_0xd4c6('0xa2')][_0xd4c6('0xa3')](_0x2196ae);});_0x34afb4=Object['keys'](_0x27e2bb)[_0xd4c6('0x5a')](function(_0xa23727){return![_0xd4c6('0xa1'),_0xd4c6('0xa2'),_0xd4c6('0xa4'),_0xd4c6('0xa5')][_0xd4c6('0xa3')](_0xa23727);});if(!_[_0xd4c6('0xa3')](_0x34afb4,_0xdaaeb1[_0xd4c6('0x67')]['mapKey'])){throw new APIBadRequestError(_0xd4c6('0xa6')+_0x34afb4[_0xd4c6('0x87')](',\x20'));}_0x3e10a9[_0xdaaeb1[_0xd4c6('0x67')][_0xd4c6('0x9c')]]=_0xdaaeb1[_0xd4c6('0x67')][_0xd4c6('0xa7')];})[_0xd4c6('0x19')](function(){return db['ChatWebsite']['find']({'where':{'id':_0xdaaeb1[_0xd4c6('0x73')]['id']},'include':[{'model':db['CmList'],'as':_0xd4c6('0xa8'),'include':[{'model':db[_0xd4c6('0x9f')],'as':_0xd4c6('0xa9'),'where':_0x3e10a9,'limit':0x1,'order':[['updatedAt',_0xd4c6('0xaa')]]}]},{'model':db[_0xd4c6('0xab')],'as':_0xd4c6('0xac')},{'model':db[_0xd4c6('0x97')],'as':_0xd4c6('0x97'),'include':[{'model':db[_0xd4c6('0x97')],'as':_0xd4c6('0xad'),'attributes':['id',_0xd4c6('0xae')],'raw':!![]}]}]});})[_0xd4c6('0x19')](function(_0x112e6e){if(!_0x112e6e){throw new APINotFoundError(util[_0xd4c6('0x42')](_0xd4c6('0xaf'),_0xdaaeb1['params']['id']));}if(_0xefe392){return checkWebsiteInterval(_0x112e6e);}return _0x112e6e;})[_0xd4c6('0x19')](function(_0x123f35){_0x328eef[_0xd4c6('0xb0')]=_0x123f35;_0x328eef[_0xd4c6('0xb1')]=_['orderBy'](_0x123f35[_0xd4c6('0xac')],['priority'],[_0xd4c6('0xb2')]);if(_0x328eef[_0xd4c6('0xb0')][_0xd4c6('0xac')]){delete _0x328eef['account'][_0xd4c6('0xac')];}_0x328eef[_0xd4c6('0xb3')]=_0x123f35[_0xd4c6('0xa8')]||{'id':_0x123f35['ListId']};if(_0x328eef['list']&&_0x328eef['list'][_0xd4c6('0xa9')][_0xd4c6('0x55')]){return _0x328eef[_0xd4c6('0xb3')][_0xd4c6('0xa9')][0x0];}var _0x207928=_['defaults'](_0xdaaeb1[_0xd4c6('0x67')],{'firstName':_0xdaaeb1[_0xd4c6('0x67')][_0xd4c6('0xa7')],'ListId':_0x123f35[_0xd4c6('0xa5')]});_0x207928[_0xdaaeb1['body'][_0xd4c6('0x9c')]]=_0xdaaeb1['body'][_0xd4c6('0xa7')];return db[_0xd4c6('0x9f')]['create'](_0x207928,{'fields':_0x5ce38a,'raw':!![]});})[_0xd4c6('0x19')](function(_0x12b5cc){_0x328eef[_0xd4c6('0xb4')]=_0x12b5cc;var _0x17177f=createInteractionObject(_0xdaaeb1[_0xd4c6('0x73')]['id'],_0xdaaeb1['body'],_0xdaaeb1[_0xd4c6('0xb5')],_0x12b5cc);var _0x5e6e1f={'ChatWebsiteId':_0xdaaeb1[_0xd4c6('0x73')]['id']};if(_0xdaaeb1[_0xd4c6('0x67')]['threadId']){_0x5e6e1f['threadId']=_0xdaaeb1['body']['threadId'];_0x5e6e1f[_0xd4c6('0xb6')]=![];return db[_0xd4c6('0xb7')][_0xd4c6('0x64')]({'where':_0x5e6e1f})[_0xd4c6('0x19')](function(_0x4c22c5){var _0xa0e905=_0xdaaeb1[_0xd4c6('0x67')]['customerIp']&&_0xdaaeb1[_0xd4c6('0x67')][_0xd4c6('0x3d')];if(_0x4c22c5){_0x1dae40=!![];return _0x4c22c5;}else if(!_0xa0e905&&_0x4c22c5&&_0x4c22c5[_0xd4c6('0xb6')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x17177f[_0xd4c6('0xb8')]=_0xdaaeb1[_0xd4c6('0x67')][_0xd4c6('0xb8')];_0x17177f['externalUrl']=_0xdaaeb1[_0xd4c6('0x67')]['externalUrl'];return db[_0xd4c6('0xb7')][_0xd4c6('0x66')](_0x17177f);});}_0x5e6e1f['ContactId']=_0x12b5cc['id'];if(_0xdaaeb1['body'][_0xd4c6('0xb9')]&&_0xdaaeb1[_0xd4c6('0x67')]['interaction']['id']){_0x5e6e1f['id']=_0xdaaeb1[_0xd4c6('0x67')][_0xd4c6('0xb9')]['id'];return db['ChatInteraction']['find']({'where':_0x5e6e1f})[_0xd4c6('0x19')](function(_0x322462){var _0x4638a0=_0xdaaeb1[_0xd4c6('0x67')][_0xd4c6('0x37')]&&_0xdaaeb1['body']['referer'];if(!_0x4638a0&&_0x322462&&_0x322462[_0xd4c6('0xb6')]){throw new APIConflictError(_0xd4c6('0xba'));}else if(_0x322462){_0x1dae40=!![];return _0x322462;}else{return db[_0xd4c6('0xb7')][_0xd4c6('0x66')](_0x17177f);}});}return db[_0xd4c6('0xb7')][_0xd4c6('0x66')](_0x17177f);})[_0xd4c6('0x19')](function(_0x30c34a){if(!_0x1dae40){return _0x30c34a;}var _0x371016={'from':(_0x328eef['contact'][_0xd4c6('0x3b')]||'')+'\x20'+(_0x328eef[_0xd4c6('0xb4')][_0xd4c6('0xbb')]||'')};if(_0xdaaeb1[_0xd4c6('0x67')][_0xd4c6('0xb8')]&&_0xdaaeb1['body'][_0xd4c6('0xbc')]&&_0xdaaeb1[_0xd4c6('0x67')][_0xd4c6('0xb8')]!=_0xdaaeb1['body'][_0xd4c6('0xbc')]){_0x371016[_0xd4c6('0xb8')]=_0xdaaeb1[_0xd4c6('0x67')][_0xd4c6('0xbc')];}return _0x30c34a['update'](_0x371016);})['then'](function(_0x595df2){_0x328eef[_0xd4c6('0xb9')]=_0x595df2[_0xd4c6('0x2f')]({'plain':!![]});_0x328eef[_0xd4c6('0xb9')]['created']=!_0x1dae40;if(_0x328eef[_0xd4c6('0xb9')]['created']){if(_0x328eef[_0xd4c6('0xb0')][_0xd4c6('0xbd')]){_0x328eef[_0xd4c6('0xb1')]['push']({'id':0x0,'priority':_0x328eef[_0xd4c6('0xb1')]['length']+0x1,'app':_0xd4c6('0xbe'),'appdata':_0xd4c6('0xbf'),'interval':_0xd4c6('0xc0')});}}return db[_0xd4c6('0xc1')][_0xd4c6('0x66')]({'body':_0xdaaeb1[_0xd4c6('0x67')]['body'],'ChatWebsiteId':_0xdaaeb1[_0xd4c6('0x73')]['id'],'ChatInteractionId':_0x595df2['id'],'direction':'in','ContactId':_0x328eef['contact']['id'],'AttachmentId':_0xdaaeb1[_0xd4c6('0x67')][_0xd4c6('0xc2')]});})[_0xd4c6('0x19')](function(_0x55c81c){_0x328eef[_0xd4c6('0x21')]=_0x55c81c;if(!_0x328eef['interaction'][_0xd4c6('0xc3')]){return;}return db[_0xd4c6('0xc4')][_0xd4c6('0x64')]({'attributes':['id',_0xd4c6('0x32')],'where':{'id':_0x328eef[_0xd4c6('0xb9')]['UserId']}});})[_0xd4c6('0x19')](function(_0x3bb31c){if(_0x3bb31c){_0x328eef['applications'][_0xd4c6('0xc5')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3bb31c[_0xd4c6('0x32')]+','+(_0x328eef[_0xd4c6('0xb0')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x328eef[_0xd4c6('0xc6')]=!![];}if(!_0x328eef[_0xd4c6('0xb9')]['queueId']){return;}return db['ChatQueue']['find']({'attributes':['id','name'],'where':{'id':_0x328eef[_0xd4c6('0xb9')][_0xd4c6('0xc7')]}});})[_0xd4c6('0x19')](function(_0x15596d){if(_0x15596d){_0x328eef[_0xd4c6('0xb1')][_0xd4c6('0xc5')]({'id':0x0,'priority':0x1,'app':_0xd4c6('0xc8'),'appdata':_0x15596d['name']+','+(_0x328eef['account']['waitForTheAssignedQueue']||0x12c),'interval':_0xd4c6('0xc0')});}return respondWithRpcPromise(_0xd4c6('0xc9'),'startRouting',_0x328eef);})[_0xd4c6('0x19')](function(_0xc78c28){respondWithRpcPromise('EventManager',_0xd4c6('0xca'),{'event':'notify','message':_0xc78c28},client9002);return _0xc78c28;})[_0xd4c6('0x19')](respondWithResult(_0x3050bb,null))['catch'](APIHandleError(_0x3050bb));};exports[_0xd4c6('0xcb')]=function(_0x57697d,_0x176501){var _0x32ac4b,_0x430efc,_0x4e02e8;var _0x44d2b2=[];var _0x23d6dc={};var _0x51c530=_0x57697d[_0xd4c6('0xcc')]||[];var _0x5f0f22=[];var _0x2c9f76;return db[_0xd4c6('0x9f')][_0xd4c6('0x74')]()['then'](function(_0x239bdb){if(!_0x239bdb){throw new db[(_0xd4c6('0xcd'))]['ValidationError']('no\x20available\x20attributes');}_0x44d2b2=_[_0xd4c6('0xce')](_['keys'](_0x239bdb),[_0xd4c6('0xa1'),'updatedAt',_0xd4c6('0xa4'),_0xd4c6('0xa5')]);if(_0x57697d[_0xd4c6('0x67')]['id']){delete _0x57697d['body']['id'];}if(_[_0xd4c6('0x90')](_0x57697d['body'][_0xd4c6('0xa7')])){throw _0x176501[_0xd4c6('0x25')](0x1f4)['send'](new db[(_0xd4c6('0xcd'))][(_0xd4c6('0xcf'))](_0xd4c6('0xd0')));}if(_[_0xd4c6('0x90')](_0x57697d[_0xd4c6('0x67')][_0xd4c6('0x67')])||_0x57697d[_0xd4c6('0x67')][_0xd4c6('0x67')]===''){throw _0x176501['status'](0x1f4)[_0xd4c6('0x33')](new db[(_0xd4c6('0xcd'))]['ValidationError'](_0xd4c6('0xd1')));}if(_[_0xd4c6('0x90')](_0x57697d[_0xd4c6('0x67')][_0xd4c6('0xd2')])){throw _0x176501[_0xd4c6('0x25')](0x1f4)[_0xd4c6('0x33')](new db[(_0xd4c6('0xcd'))][(_0xd4c6('0xcf'))](_0xd4c6('0xd3')+_0x44d2b2));}if(!_['includes'](_0x44d2b2,_0x57697d[_0xd4c6('0x67')][_0xd4c6('0xd2')])){throw _0x176501[_0xd4c6('0x25')](0x1f4)[_0xd4c6('0x33')](new db[(_0xd4c6('0xcd'))][(_0xd4c6('0xcf'))](_0xd4c6('0xd4')+_0x44d2b2));}_0x23d6dc[_0x57697d['body'][_0xd4c6('0xd2')]]=_0x57697d[_0xd4c6('0x67')][_0xd4c6('0xa7')];})[_0xd4c6('0x19')](function(){return db[_0xd4c6('0x4b')][_0xd4c6('0x64')]({'where':{'id':_0x57697d[_0xd4c6('0x73')]['id']},'include':[{'model':db[_0xd4c6('0xd5')],'as':_0xd4c6('0xa8')},{'model':db[_0xd4c6('0xd6')],'as':_0xd4c6('0xd6')}]});})['then'](handleEntityNotFound(_0x176501,null))[_0xd4c6('0x19')](function(_0x250bdb){if(_0x250bdb&&_0x250bdb[_0xd4c6('0xa8')]){_0x430efc=_0x250bdb;var _0x4ff6ad=_['defaults'](_0x57697d[_0xd4c6('0x67')],{'firstName':_0x57697d[_0xd4c6('0x67')][_0xd4c6('0xa7')],'phone':_0x57697d[_0xd4c6('0x67')]['from'],'ListId':_0x250bdb[_0xd4c6('0xa5')]});_0x4ff6ad[_0x57697d[_0xd4c6('0x67')][_0xd4c6('0xd2')]]=_0x57697d[_0xd4c6('0x67')][_0xd4c6('0xa7')];return db[_0xd4c6('0x9f')][_0xd4c6('0xd7')]({'where':_0x23d6dc,'defaults':_0x4ff6ad});}})[_0xd4c6('0xd8')](function(_0x253e8e){if(_0x253e8e){_0x4e02e8=_0x253e8e;var _0x28e352=fs[_0xd4c6('0xd9')](path['join'](config[_0xd4c6('0x88')],_0xd4c6('0xda')),'utf8');var _0x1ee08d=ejs['render'](_0x28e352,{'body':_['toPairs'](_0x57697d[_0xd4c6('0x67')][_0xd4c6('0x67')]),'bodyTitle':_0x430efc['offlineMessageBody']});return db[_0xd4c6('0xdb')]['create']({'body':_0x1ee08d,'plainBody':htmlToText[_0xd4c6('0xdc')](_0x1ee08d),'ContactId':_0x253e8e['id'],'ChatWebsiteId':_0x430efc['id']});}})[_0xd4c6('0x19')](function(_0x22b61f){_0x2c9f76=_0x22b61f;if(_0x51c530['length']){var _0x38a3b7=_0x51c530[_0xd4c6('0x4f')](function(_0x54aea3){return{'name':_0x54aea3[_0xd4c6('0xdd')],'basename':_0x54aea3[_0xd4c6('0x83')],'type':_0x54aea3[_0xd4c6('0xde')],'ChatOfflineMessageId':_0x22b61f['id']};});_0x5f0f22=_0x38a3b7[_0xd4c6('0x4f')](_0x2bdb20=>{var _0x14025c={'filename':_0x2bdb20[_0xd4c6('0x32')],'path':path['join'](config[_0xd4c6('0x88')],'server',_0xd4c6('0xcc'),_0xd4c6('0xdf'),_0xd4c6('0xe0'),_0x2bdb20[_0xd4c6('0xe1')])};return _0x14025c;});if(!_0x430efc[_0xd4c6('0xe2')]){return db[_0xd4c6('0xe3')][_0xd4c6('0xe4')](function(_0x43ec53){return db[_0xd4c6('0xe5')][_0xd4c6('0xe6')](_0x38a3b7,{'transaction':_0x43ec53});});}}})['then'](function(){if(_0x2c9f76){_0x32ac4b=_0x2c9f76;return db[_0xd4c6('0xd6')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xd4c6('0xe7')],'as':_0xd4c6('0xe8'),'raw':!![],'include':[{'model':db[_0xd4c6('0xe9')],'as':'CloudProvider','raw':!![]}]}]});}})['then'](function(_0x3119a1){if(_0x3119a1&&_0x3119a1[_0xd4c6('0xe8')]&&_0x430efc[_0xd4c6('0xea')]&&_0x430efc[_0xd4c6('0xeb')]){var _0x4d0ed6=_0x3119a1[_0xd4c6('0xec')]();return respondWithRpcPromise('SendMail',_0xd4c6('0xed'),{'account':_0x4d0ed6,'message':{'from':util[_0xd4c6('0x42')](_0xd4c6('0xee'),_0x3119a1['name'],_0x3119a1[_0xd4c6('0xef')]||_0x3119a1[_0xd4c6('0xe8')]['user']),'to':_0x430efc[_0xd4c6('0xeb')],'subject':_0x430efc['offlineMessageSubject'],'html':_0x32ac4b[_0xd4c6('0x67')],'attachments':_0x5f0f22}},client9003)[_0xd4c6('0x19')](function(){return _0x32ac4b;})[_0xd4c6('0x65')](function(_0x345a60){logger['error'](_0x345a60);});}})[_0xd4c6('0x19')](function(){if(_0x430efc&&_0x430efc['openNewInteraction']&&_0x430efc['MailAccountId']){var _0x437922=[];if(_0x51c530['length']){_0x437922=_0x51c530['map'](function(_0x2d6f0c){return{'name':_0x2d6f0c[_0xd4c6('0xdd')],'basename':_0x2d6f0c['filename'],'type':_0x2d6f0c[_0xd4c6('0xde')],'ChatOfflineMessageId':_0x2c9f76['id']};});}var _0x274191;if(!_[_0xd4c6('0x90')](_0x430efc[_0xd4c6('0xf0')])){var _0x1f785c=_[_0xd4c6('0x4f')](_0x57697d[_0xd4c6('0x67')],function(_0x469180){return _0x469180;});var _0x3bdc08=_[_0xd4c6('0xf1')](_0x1f785c)[0x0];var _0x3e715b=_[_0xd4c6('0xf2')](_0x3bdc08,function(_0x2fa704){return _0x2fa704;});_0x274191=_0x3e715b[0x1][_0x430efc[_0xd4c6('0xf0')]];}var _0x342c0b={'from':_0x4e02e8[_0xd4c6('0xef')],'firstName':_0x4e02e8[_0xd4c6('0x3b')],'lastName':_0x4e02e8[_0xd4c6('0xbb')],'mapKey':_0xd4c6('0xef'),'message':{'from':_0x4e02e8[_0xd4c6('0xef')],'to':_0x430efc[_0xd4c6('0xd6')][_0xd4c6('0xef')],'cc':'','subject':_['isNil'](_0x274191)?_0x430efc['offlineMessageSubject']:_0x274191,'messageId':'','sentAt':new Date(),'attach':_0x437922[_0xd4c6('0x55')],'attachments':_0x437922,'originChannel':_0xd4c6('0xf3'),'ChatWebsiteId':_0x430efc['id'],'ChatOfflineMessageId':_0x32ac4b['id'],'originTo':_0x430efc[_0xd4c6('0xd6')][_0xd4c6('0xef')]},'body':_0x32ac4b[_0xd4c6('0x67')]};var _0x4641f4={'account':{'id':_0x430efc['MailAccountId']},'body':_0x342c0b,'log':_0xd4c6('0xf4')};return respondWithRpcPromise(_0xd4c6('0xf4'),'notifyMail',_0x4641f4,client9001)[_0xd4c6('0x19')](function(){return _0x32ac4b;})[_0xd4c6('0x65')](function(_0x4f64a7){logger[_0xd4c6('0x1f')](_0x4f64a7);});}return;})[_0xd4c6('0x19')](function(){if(_0x32ac4b){return _0x32ac4b;}})[_0xd4c6('0x19')](respondWithResult(_0x176501,null))[_0xd4c6('0x65')](function(){for(var _0x108ac2 of _0x51c530){var _0x81d96=path[_0xd4c6('0x87')](config[_0xd4c6('0x88')],_0xd4c6('0xf5'),'files',_0xd4c6('0xdf'),_0xd4c6('0xe0'),_0x108ac2[_0xd4c6('0x83')]);fs_extra[_0xd4c6('0xf6')](_0x81d96)[_0xd4c6('0x65')](function(_0x17e359){logger[_0xd4c6('0x1f')](_0xd4c6('0xf7'),_0x81d96,_0x17e359);});}});};exports['addInteraction']=function(_0x10ea84,_0x10568d){return db['ChatInteraction'][_0xd4c6('0x64')]({'where':{'id':_0x10ea84['params']['id']}})['then'](handleEntityNotFound(_0x10568d,null))[_0xd4c6('0x19')](function(_0x109a82){if(_0x109a82){return _0x109a82[_0xd4c6('0xf8')](_0x10ea84['body'][_0xd4c6('0x7f')],_['omit'](_0x10ea84[_0xd4c6('0x67')],['ids','id'])||{});}})[_0xd4c6('0x19')](respondWithResult(_0x10568d,null))['catch'](handleError(_0x10568d,null));};exports[_0xd4c6('0xf9')]=function(_0x1dc000,_0x43749b){var _0x343fbd={'raw':![],'where':{}};var _0x7c9bb={};var _0x300450={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd4c6('0x77')]({'where':{'id':_0x1dc000['params']['id']}})[_0xd4c6('0x19')](handleEntityNotFound(_0x43749b,null))[_0xd4c6('0x19')](function(_0x6dd51a){if(_0x6dd51a){_0x7c9bb[_0xd4c6('0x44')]=_[_0xd4c6('0x50')](db[_0xd4c6('0xb7')][_0xd4c6('0x4c')]);_0x7c9bb['query']=_[_0xd4c6('0x50')](_0x1dc000[_0xd4c6('0x51')]);_0x7c9bb[_0xd4c6('0x52')]=_[_0xd4c6('0x63')](_0x7c9bb['model'],_0x7c9bb[_0xd4c6('0x51')]);_0x343fbd['attributes']=_['intersection'](_0x7c9bb[_0xd4c6('0x44')],qs[_0xd4c6('0x54')](_0x1dc000['query'][_0xd4c6('0x54')]));_0x343fbd[_0xd4c6('0x53')]=_0x343fbd[_0xd4c6('0x53')][_0xd4c6('0x55')]?_0x343fbd['attributes']:_0x7c9bb[_0xd4c6('0x44')];if(!_0x1dc000[_0xd4c6('0x51')][_0xd4c6('0x56')]('nolimit')){_0x343fbd[_0xd4c6('0x29')]=qs['limit'](_0x1dc000[_0xd4c6('0x51')][_0xd4c6('0x29')]);_0x343fbd[_0xd4c6('0x27')]=qs[_0xd4c6('0x27')](_0x1dc000[_0xd4c6('0x51')][_0xd4c6('0x27')]);}_0x343fbd[_0xd4c6('0x58')]=qs[_0xd4c6('0x59')](_0x1dc000[_0xd4c6('0x51')][_0xd4c6('0x59')]);_0x343fbd[_0xd4c6('0x5e')]=qs[_0xd4c6('0x52')](_[_0xd4c6('0x78')](_0x1dc000[_0xd4c6('0x51')],_0x7c9bb['filters']));_0x343fbd['where']['ChatWebsiteId']=_0x6dd51a['id'];if(_0x1dc000['query']['filter']){_0x343fbd['where']=_['merge'](_0x343fbd[_0xd4c6('0x5e')],{'$or':_[_0xd4c6('0x4f')](_0x343fbd[_0xd4c6('0x53')],function(_0x20fd1c){var _0x203995={};_0x203995[_0x20fd1c]={'$like':'%'+_0x1dc000[_0xd4c6('0x51')][_0xd4c6('0x5a')]+'%'};return _0x203995;})});}_0x343fbd=_[_0xd4c6('0x5b')]({},_0x343fbd,_0x1dc000[_0xd4c6('0x5d')]);return db[_0xd4c6('0xb7')][_0xd4c6('0x2a')]({'where':_0x343fbd['where']})[_0xd4c6('0x19')](function(_0x1ad362){_0x300450['count']=_0x1ad362;if(_0x1dc000[_0xd4c6('0x51')]['includeAll']){_0x343fbd['include']=[{'model':db[_0xd4c6('0x9f')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xd4c6('0x32'),_0xd4c6('0xfa'),_0xd4c6('0xfb')],'required':![]},{'model':db[_0xd4c6('0xfc')],'as':_0xd4c6('0xfd'),'attributes':['id','name',_0xd4c6('0xfe')],'where':_0x1dc000['query'][_0xd4c6('0xff')]?{'id':_0x1dc000[_0xd4c6('0x51')][_0xd4c6('0xff')]}:undefined,'required':_0x1dc000['query'][_0xd4c6('0xff')]?!![]:![]}];}return db[_0xd4c6('0xb7')][_0xd4c6('0x61')](_0x343fbd);})[_0xd4c6('0x19')](function(_0x3af32f){_0x300450[_0xd4c6('0x62')]=_0x3af32f;return _0x300450;});}})[_0xd4c6('0x19')](respondWithFilteredResult(_0x43749b,_0x343fbd))['catch'](handleError(_0x43749b,null));};exports[_0xd4c6('0x100')]=function(_0x5f1c0f,_0x5af83f){var _0x5adc0f=0x0;var _0xa84598=0x0;var _0x5721a9=![];var _0x4d03d9;var _0x3e7002;return db['ChatWebsite'][_0xd4c6('0x64')]({'where':{'id':_0x5f1c0f['params']['id']},'include':[{'model':db['Interval'],'as':_0xd4c6('0x97'),'include':[{'model':db[_0xd4c6('0x97')],'as':_0xd4c6('0xad'),'attributes':['id',_0xd4c6('0xae')]}]}]})[_0xd4c6('0x19')](handleEntityNotFound(_0x5af83f,null))[_0xd4c6('0x19')](function(_0x146e61){if(_0x146e61){_0x4d03d9=_0x146e61;return _0x146e61[_0xd4c6('0x101')]({'raw':!![]});}})[_0xd4c6('0x19')](function(_0x4393e2){if(_0x4d03d9){if(_0x4393e2){_0x3e7002=_0x4393e2;}}return require('../../config/license/util')[_0xd4c6('0x89')]();})[_0xd4c6('0x19')](function(_0x290acd){if(_0x290acd){_0xa84598=_0x290acd['virtual'];_0x5721a9=_0x290acd['custom'];}})[_0xd4c6('0x19')](function(){return db[_0xd4c6('0xb7')][_0xd4c6('0x2a')]({'where':{'closed':![]}});})['then'](function(_0x34bcf9){_0x5adc0f=_0x34bcf9;if(_0xa84598&&_0x34bcf9>_0xa84598){return db[_0xd4c6('0x102')][_0xd4c6('0x77')]({'where':{'id':0x1}})['then'](function(_0x5be160){if(_0x5be160){_0x5be160[_0xd4c6('0x103')](_0xd4c6('0x104'));}});}})['then'](function(){var _0x23a11c=_0x4d03d9[_0xd4c6('0x97')];var _0x1e81ad=_0x4d03d9['timezone']||undefined;return _0x23a11c?_0x23a11c['ifTime'](_0x1e81ad):!![];})[_0xd4c6('0x19')](function(_0x35c669){var _0xb4d00c=fs['readFileSync'](path[_0xd4c6('0x87')](config['root'],_0xd4c6('0x105')),_0xd4c6('0x106'));var _0x5b64af='3.13.0';var _0x503261=![];var _0x41df79,_0x2e2189;if(_0x5f1c0f[_0xd4c6('0xb5')][_0xd4c6('0x3d')]){_0x41df79=new URL(_0x5f1c0f['headers'][_0xd4c6('0x3d')])[_0xd4c6('0x107')];}else if(_0x5f1c0f['headers'][_0xd4c6('0x107')]){_0x41df79=new URL(_0x5f1c0f[_0xd4c6('0xb5')][_0xd4c6('0x107')])['origin'];}else{_0x41df79='http://localhost:9000';}_0x2e2189=typeof _0x4d03d9[_0xd4c6('0x68')][_0xd4c6('0x72')](',')[_0xd4c6('0x64')](function(_0x20f8d4){return wildcardUtils[_0xd4c6('0x108')](_0x20f8d4,_0x41df79);})!==_0xd4c6('0x28');var _0x4e6aea={'chatVersion':_0x5b64af,'chatWebsiteAddressOrigin':_0x2e2189?_0x41df79:_0x4d03d9[_0xd4c6('0x68')],'remote':_0x4d03d9['remote'],'query':querystring[_0xd4c6('0x1e')](_[_0xd4c6('0x5b')](_0x4d03d9[_0xd4c6('0x2f')]({'plain':!![]}),{'customerIp':_0x5f1c0f[_0xd4c6('0xb5')][_0xd4c6('0x39')]||_0x5f1c0f[_0xd4c6('0xb5')]['x-real-ip']||_0x5f1c0f[_0xd4c6('0x109')][_0xd4c6('0x10a')]||_0x5f1c0f['ip'],'referer':_0x5f1c0f[_0xd4c6('0xb5')]['referer'],'openedInteractions':_0x5adc0f,'maxInteractions':_0xa84598,'virtual':_0x5721a9[_0xd4c6('0x10b')],'online':_0x35c669,'custom':_0x5721a9,'address':_0x2e2189?_0x41df79:null}))[_0xd4c6('0x10c')](/'/g,'\x5c\x27')};_0x5af83f[_0xd4c6('0x33')](ejs['render'](Mustache['render'](_0xb4d00c,_0x4e6aea),{'proactiveActions':_0x3e7002,'alignment':_0x4d03d9[_0xd4c6('0x10d')],'verticalAlignment':_0x4d03d9[_0xd4c6('0x10e')],'div_color':_0x4d03d9[_0xd4c6('0xfe')],'labelText':_0x4d03d9['labelText'],'text_color':_0x4d03d9[_0xd4c6('0x10f')],'text_button_color':_0x4d03d9[_0xd4c6('0x110')],'button_color':_0x4d03d9['color_button'],'background_color':_0x4d03d9[_0xd4c6('0x111')],'hideWhenOffline':_0x4d03d9[_0xd4c6('0x112')],'intervalId':_0x4d03d9[_0xd4c6('0x113')],'isDevelopment':_0x503261,'chatVersion':_0x5b64af}));})['catch'](handleError(_0x5af83f,null));};exports[_0xd4c6('0x114')]=function(_0x443cd8,_0x1916cc){var _0x481bf6=_0x443cd8['params']['id'];var _0x5dcd4a=_0x443cd8['body'];var _0x37a69b=0xc8;var _0x558a72=null;return db[_0xd4c6('0xe3')]['transaction']({'isolationLevel':db[_0xd4c6('0xe3')]['Transaction'][_0xd4c6('0x115')][_0xd4c6('0x116')]},function(_0x418ec5){return db[_0xd4c6('0x4b')][_0xd4c6('0x77')]({'where':{'id':_0x481bf6},'transaction':_0x418ec5})['then'](function(_0x41858f){if(_0x41858f){return db[_0xd4c6('0xab')][_0xd4c6('0x2e')]({'where':{'ChatWebsiteId':_0x481bf6},'transaction':_0x418ec5})[_0xd4c6('0x19')](function(){var _0x2305b9=_['map'](_0x5dcd4a,function(_0x56da17){_0x56da17[_0xd4c6('0x79')]=_0x481bf6;return _0x56da17;});return db['ChatApplication']['bulkCreate'](_0x2305b9,{'transaction':_0x418ec5});});}else{_0x37a69b=0x194;_0x558a72=[];}});})[_0xd4c6('0x19')](function(){if(_0x37a69b!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x481bf6},'order':_0xd4c6('0x117')})[_0xd4c6('0x19')](function(_0x290047){_0x558a72=_0x290047;});}})[_0xd4c6('0x65')](function(_0x1dc5e6){_0x37a69b=0x1f4;logger['error'](_0x1dc5e6[_0xd4c6('0x31')]);if(_0x1dc5e6['name']){delete _0x1dc5e6[_0xd4c6('0x32')];}_0x558a72=_0x1dc5e6;})[_0xd4c6('0x118')](function(){if(_0x558a72===null){_0x1916cc[_0xd4c6('0x23')](_0x37a69b);}else{if(_0x37a69b===0x1f4){_0x1916cc['status'](_0x37a69b)[_0xd4c6('0x33')](_0x558a72);}else{_0x1916cc[_0xd4c6('0x25')](_0x37a69b)[_0xd4c6('0x26')](_0x558a72);}}});};exports[_0xd4c6('0x119')]=function(_0x2cd898,_0x321f24){var _0x4ba6c9={};var _0x8b9aba={};var _0x3099a3;var _0xfb26f4;return db[_0xd4c6('0x4b')][_0xd4c6('0x77')]({'where':{'id':_0x2cd898['params']['id']}})[_0xd4c6('0x19')](handleEntityNotFound(_0x321f24,null))[_0xd4c6('0x19')](function(_0x2fb85b){if(_0x2fb85b){_0x3099a3=_0x2fb85b;_0x8b9aba[_0xd4c6('0x44')]=_[_0xd4c6('0x50')](db[_0xd4c6('0xab')][_0xd4c6('0x4c')]);_0x8b9aba[_0xd4c6('0x51')]=_[_0xd4c6('0x50')](_0x2cd898[_0xd4c6('0x51')]);_0x8b9aba['filters']=_[_0xd4c6('0x63')](_0x8b9aba[_0xd4c6('0x44')],_0x8b9aba[_0xd4c6('0x51')]);_0x4ba6c9[_0xd4c6('0x53')]=_[_0xd4c6('0x63')](_0x8b9aba[_0xd4c6('0x44')],qs[_0xd4c6('0x54')](_0x2cd898[_0xd4c6('0x51')][_0xd4c6('0x54')]));_0x4ba6c9[_0xd4c6('0x53')]=_0x4ba6c9['attributes']['length']?_0x4ba6c9[_0xd4c6('0x53')]:_0x8b9aba[_0xd4c6('0x44')];_0x4ba6c9[_0xd4c6('0x58')]=qs[_0xd4c6('0x59')](_0x2cd898[_0xd4c6('0x51')][_0xd4c6('0x59')]);_0x4ba6c9[_0xd4c6('0x5e')]=qs[_0xd4c6('0x52')](_[_0xd4c6('0x78')](_0x2cd898['query'],_0x8b9aba[_0xd4c6('0x52')]));if(_0x2cd898[_0xd4c6('0x51')][_0xd4c6('0x5a')]){_0x4ba6c9[_0xd4c6('0x5e')]=_[_0xd4c6('0x5b')](_0x4ba6c9[_0xd4c6('0x5e')],{'$or':_[_0xd4c6('0x4f')](_0x4ba6c9['attributes'],function(_0x591ae8){var _0x4c6b59={};_0x4c6b59[_0x591ae8]={'$like':'%'+_0x2cd898['query']['filter']+'%'};return _0x4c6b59;})});}_0x4ba6c9=_['merge']({},_0x4ba6c9,_0x2cd898[_0xd4c6('0x5d')]);return _0x3099a3[_0xd4c6('0x119')](_0x4ba6c9);}})[_0xd4c6('0x19')](function(_0x1f1206){if(_0x1f1206){_0xfb26f4=_0x1f1206['length'];if(!_0x2cd898[_0xd4c6('0x51')][_0xd4c6('0x56')](_0xd4c6('0x57'))){_0x4ba6c9['limit']=qs[_0xd4c6('0x29')](_0x2cd898['query']['limit']);_0x4ba6c9[_0xd4c6('0x27')]=qs['offset'](_0x2cd898['query']['offset']);}return _0x3099a3['getApplications'](_0x4ba6c9);}})['then'](function(_0x2b28f9){if(_0x2b28f9){return _0x2b28f9?{'count':_0xfb26f4,'rows':_0x2b28f9}:null;}})['then'](respondWithResult(_0x321f24,null))[_0xd4c6('0x65')](handleError(_0x321f24,null));};exports[_0xd4c6('0x11a')]=function(_0x3aca4f,_0x2f992d){return db[_0xd4c6('0x11b')][_0xd4c6('0x64')]({'where':{'id':_0x3aca4f['params']['id']}})[_0xd4c6('0x19')](handleEntityNotFound(_0x2f992d,null))[_0xd4c6('0x19')](function(_0x3ae9b2){if(_0x3ae9b2){return _0x3ae9b2[_0xd4c6('0x11a')](_0x3aca4f[_0xd4c6('0x67')]['ids'],_[_0xd4c6('0x11c')](_0x3aca4f[_0xd4c6('0x67')],['ids','id'])||{});}})[_0xd4c6('0x19')](respondWithResult(_0x2f992d,null))['catch'](handleError(_0x2f992d,null));};exports['getProactiveActions']=function(_0x4e9b87,_0x4716b7){var _0x50bc0e={};var _0x12288f={};var _0xadbbfa;var _0x474bc0;return db['ChatWebsite'][_0xd4c6('0x77')]({'where':{'id':_0x4e9b87[_0xd4c6('0x73')]['id']}})[_0xd4c6('0x19')](handleEntityNotFound(_0x4716b7,null))[_0xd4c6('0x19')](function(_0x353acb){if(_0x353acb){_0xadbbfa=_0x353acb;_0x12288f[_0xd4c6('0x44')]=_[_0xd4c6('0x50')](db[_0xd4c6('0x11d')]['rawAttributes']);_0x12288f[_0xd4c6('0x51')]=_[_0xd4c6('0x50')](_0x4e9b87[_0xd4c6('0x51')]);_0x12288f['filters']=_[_0xd4c6('0x63')](_0x12288f[_0xd4c6('0x44')],_0x12288f[_0xd4c6('0x51')]);_0x50bc0e[_0xd4c6('0x53')]=_[_0xd4c6('0x63')](_0x12288f[_0xd4c6('0x44')],qs[_0xd4c6('0x54')](_0x4e9b87[_0xd4c6('0x51')][_0xd4c6('0x54')]));_0x50bc0e[_0xd4c6('0x53')]=_0x50bc0e[_0xd4c6('0x53')][_0xd4c6('0x55')]?_0x50bc0e[_0xd4c6('0x53')]:_0x12288f[_0xd4c6('0x44')];_0x50bc0e[_0xd4c6('0x58')]=qs[_0xd4c6('0x59')](_0x4e9b87[_0xd4c6('0x51')]['sort']);_0x50bc0e[_0xd4c6('0x5e')]=qs[_0xd4c6('0x52')](_['pick'](_0x4e9b87['query'],_0x12288f[_0xd4c6('0x52')]));if(_0x4e9b87[_0xd4c6('0x51')][_0xd4c6('0x5a')]){_0x50bc0e[_0xd4c6('0x5e')]=_[_0xd4c6('0x5b')](_0x50bc0e['where'],{'$or':_[_0xd4c6('0x4f')](_0x50bc0e[_0xd4c6('0x53')],function(_0x3370a8){var _0x4b9274={};_0x4b9274[_0x3370a8]={'$like':'%'+_0x4e9b87['query']['filter']+'%'};return _0x4b9274;})});}_0x50bc0e=_[_0xd4c6('0x5b')]({},_0x50bc0e,_0x4e9b87['options']);return _0xadbbfa[_0xd4c6('0x101')](_0x50bc0e);}})['then'](function(_0x5893cc){if(_0x5893cc){_0x474bc0=_0x5893cc[_0xd4c6('0x55')];if(!_0x4e9b87[_0xd4c6('0x51')][_0xd4c6('0x56')]('nolimit')){_0x50bc0e[_0xd4c6('0x29')]=qs['limit'](_0x4e9b87['query']['limit']);_0x50bc0e[_0xd4c6('0x27')]=qs[_0xd4c6('0x27')](_0x4e9b87[_0xd4c6('0x51')]['offset']);}return _0xadbbfa[_0xd4c6('0x101')](_0x50bc0e);}})[_0xd4c6('0x19')](function(_0xe1fa08){if(_0xe1fa08){return _0xe1fa08?{'count':_0x474bc0,'rows':_0xe1fa08}:null;}})['then'](respondWithResult(_0x4716b7,null))['catch'](handleError(_0x4716b7,null));};exports['getFields']=function(_0x3a2cd7,_0x569cc9){var _0x537cad=_0x3a2cd7[_0xd4c6('0x51')][_0xd4c6('0x11e')]===_0xd4c6('0x11f')?_0xd4c6('0x120'):_0xd4c6('0x121');return db[_0xd4c6('0x4b')][_0xd4c6('0x64')]({'attributes':['id',_0x537cad],'where':{'id':_0x3a2cd7[_0xd4c6('0x73')]['id']}})[_0xd4c6('0x19')](handleEntityNotFound(_0x569cc9,null))[_0xd4c6('0x19')](function(_0x5e1921){if(_0x5e1921){var _0x598a10=_0x5e1921[_0x537cad];var _0x509d54=_0x598a10&&_0x598a10[_0xd4c6('0x122')]?_0x598a10[_0xd4c6('0x122')]:[];_0x569cc9[_0xd4c6('0x33')]({'fromKey':_[_0xd4c6('0x90')](_0x598a10[_0xd4c6('0x123')])?undefined:_0x598a10[_0xd4c6('0x123')],'count':_0x509d54[_0xd4c6('0x55')],'rows':_0x509d54});}})['catch'](handleError(_0x569cc9,null));};exports[_0xd4c6('0x124')]=function(_0x1e91e2,_0x4dd08b){var _0xa8d64e={'raw':![],'where':{}};var _0x3d8926={};var _0x521c0f={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x1e91e2['params']['id']}})['then'](handleEntityNotFound(_0x4dd08b,null))['then'](function(_0x2fdf81){if(_0x2fdf81){_0x3d8926[_0xd4c6('0x44')]=_['keys'](db[_0xd4c6('0xdb')][_0xd4c6('0x4c')]);_0x3d8926['query']=_[_0xd4c6('0x50')](_0x1e91e2['query']);_0x3d8926[_0xd4c6('0x52')]=_[_0xd4c6('0x63')](_0x3d8926['model'],_0x3d8926[_0xd4c6('0x51')]);_0xa8d64e['attributes']=_[_0xd4c6('0x63')](_0x3d8926[_0xd4c6('0x44')],qs[_0xd4c6('0x54')](_0x1e91e2['query'][_0xd4c6('0x54')]));_0xa8d64e['attributes']=_0xa8d64e[_0xd4c6('0x53')][_0xd4c6('0x55')]?_0xa8d64e[_0xd4c6('0x53')]:_0x3d8926[_0xd4c6('0x44')];if(!_0x1e91e2[_0xd4c6('0x51')]['hasOwnProperty']('nolimit')){_0xa8d64e[_0xd4c6('0x29')]=qs['limit'](_0x1e91e2['query'][_0xd4c6('0x29')]);_0xa8d64e['offset']=qs[_0xd4c6('0x27')](_0x1e91e2['query'][_0xd4c6('0x27')]);}_0xa8d64e[_0xd4c6('0x58')]=qs['sort'](_0x1e91e2['query'][_0xd4c6('0x59')]);_0xa8d64e[_0xd4c6('0x5e')]=qs[_0xd4c6('0x52')](_[_0xd4c6('0x78')](_0x1e91e2[_0xd4c6('0x51')],_0x3d8926['filters']));_0xa8d64e[_0xd4c6('0x5e')][_0xd4c6('0x79')]=_0x2fdf81['id'];if(_0x1e91e2[_0xd4c6('0x51')][_0xd4c6('0x5a')]){_0xa8d64e[_0xd4c6('0x5e')]=_[_0xd4c6('0x5b')](_0xa8d64e[_0xd4c6('0x5e')],{'$or':_['map'](_0xa8d64e['attributes'],function(_0x1c0e91){var _0x2ad781={};_0x2ad781[_0x1c0e91]={'$like':'%'+_0x1e91e2[_0xd4c6('0x51')][_0xd4c6('0x5a')]+'%'};return _0x2ad781;})});}_0xa8d64e=_['merge']({},_0xa8d64e,_0x1e91e2[_0xd4c6('0x5d')]);return db[_0xd4c6('0xdb')][_0xd4c6('0x2a')]({'where':_0xa8d64e[_0xd4c6('0x5e')]})[_0xd4c6('0x19')](function(_0x5117ef){_0x521c0f[_0xd4c6('0x2a')]=_0x5117ef;if(_0x1e91e2[_0xd4c6('0x51')][_0xd4c6('0x5f')]){_0xa8d64e[_0xd4c6('0x60')]=[{'all':!![]}];}else{_0xa8d64e[_0xd4c6('0x60')]=[{'model':db[_0xd4c6('0x9f')],'as':'Contact','required':![]},{'model':db[_0xd4c6('0xe5')],'as':_0xd4c6('0x125'),'required':![]}];}return db['ChatOfflineMessage'][_0xd4c6('0x61')](_0xa8d64e);})[_0xd4c6('0x19')](function(_0x3d9255){_0x521c0f[_0xd4c6('0x62')]=_0x3d9255;return _0x521c0f;});}})[_0xd4c6('0x19')](respondWithFilteredResult(_0x4dd08b,_0xa8d64e))[_0xd4c6('0x65')](handleError(_0x4dd08b,null));};exports['addAgents']=function(_0x3c7546,_0xbdc219){return db['ChatWebsite'][_0xd4c6('0x64')]({'where':{'id':_0x3c7546[_0xd4c6('0x73')]['id']}})[_0xd4c6('0x19')](handleEntityNotFound(_0xbdc219,null))[_0xd4c6('0x19')](function(_0x3e93de){if(_0x3e93de){return _0x3e93de[_0xd4c6('0x126')](_0x3c7546[_0xd4c6('0x67')][_0xd4c6('0x7f')],_[_0xd4c6('0x11c')](_0x3c7546['body'],[_0xd4c6('0x7f'),'id'])||{})[_0xd4c6('0xd8')](function(_0x593cdd){for(var _0x18b05b=0x0;_0x18b05b<_0x3c7546[_0xd4c6('0x67')]['ids'][_0xd4c6('0x55')];_0x18b05b+=0x1){socket['emit'](_0xd4c6('0x127'),{'UserId':Number(_0x3c7546['body'][_0xd4c6('0x7f')][_0x18b05b]),'ChatWebsiteId':Number(_0x3c7546[_0xd4c6('0x73')]['id'])});}return _0x593cdd;});}})[_0xd4c6('0x19')](respondWithResult(_0xbdc219,null))[_0xd4c6('0x65')](handleError(_0xbdc219,null));};exports['removeAgents']=function(_0xd3bb14,_0x1557aa){return db[_0xd4c6('0x4b')][_0xd4c6('0x64')]({'where':{'id':_0xd3bb14[_0xd4c6('0x73')]['id']}})['then'](handleEntityNotFound(_0x1557aa,null))[_0xd4c6('0x19')](function(_0x1dcea6){if(_0x1dcea6){return _0x1dcea6['removeAgents'](_0xd3bb14[_0xd4c6('0x51')]['ids'])[_0xd4c6('0x19')](function(){if(_[_0xd4c6('0x128')](_0xd3bb14[_0xd4c6('0x51')][_0xd4c6('0x7f')])){for(var _0xf39468=0x0;_0xf39468<_0xd3bb14[_0xd4c6('0x51')]['ids']['length'];_0xf39468+=0x1){socket[_0xd4c6('0x129')](_0xd4c6('0x12a'),{'UserId':Number(_0xd3bb14[_0xd4c6('0x51')][_0xd4c6('0x7f')][_0xf39468]),'ChatWebsiteId':Number(_0xd3bb14[_0xd4c6('0x73')]['id'])});}}else{socket['emit'](_0xd4c6('0x12a'),{'UserId':Number(_0xd3bb14['query']['ids']),'ChatWebsiteId':Number(_0xd3bb14[_0xd4c6('0x73')]['id'])});}});}})[_0xd4c6('0x19')](respondWithStatusCode(_0x1557aa,null))[_0xd4c6('0x65')](handleError(_0x1557aa,null));};exports[_0xd4c6('0x12b')]=function(_0x335c01,_0xf7a9f4){var _0x12fd44={};var _0x49d2be={};var _0x3627f4;var _0x2d81b6;return db[_0xd4c6('0x4b')]['findOne']({'where':{'id':_0x335c01[_0xd4c6('0x73')]['id']}})[_0xd4c6('0x19')](handleEntityNotFound(_0xf7a9f4,null))[_0xd4c6('0x19')](function(_0x4e7398){if(_0x4e7398){_0x3627f4=_0x4e7398;_0x49d2be[_0xd4c6('0x44')]=_[_0xd4c6('0x50')](db[_0xd4c6('0xc4')][_0xd4c6('0x4c')]);_0x49d2be[_0xd4c6('0x51')]=_['keys'](_0x335c01[_0xd4c6('0x51')]);_0x49d2be[_0xd4c6('0x52')]=_[_0xd4c6('0x63')](_0x49d2be[_0xd4c6('0x44')],_0x49d2be[_0xd4c6('0x51')]);_0x12fd44['attributes']=_[_0xd4c6('0x63')](_0x49d2be[_0xd4c6('0x44')],qs[_0xd4c6('0x54')](_0x335c01[_0xd4c6('0x51')][_0xd4c6('0x54')]));_0x12fd44['attributes']=_0x12fd44[_0xd4c6('0x53')]['length']?_0x12fd44['attributes']:_0x49d2be[_0xd4c6('0x44')];_0x12fd44['order']=qs[_0xd4c6('0x59')](_0x335c01[_0xd4c6('0x51')]['sort']);_0x12fd44[_0xd4c6('0x5e')]=qs[_0xd4c6('0x52')](_['pick'](_0x335c01[_0xd4c6('0x51')],_0x49d2be[_0xd4c6('0x52')]));if(_0x335c01['query'][_0xd4c6('0x5a')]){_0x12fd44[_0xd4c6('0x5e')]=_[_0xd4c6('0x5b')](_0x12fd44['where'],{'$or':_['map'](_0x12fd44[_0xd4c6('0x53')],function(_0x286fec){var _0x3c341e={};_0x3c341e[_0x286fec]={'$like':'%'+_0x335c01[_0xd4c6('0x51')][_0xd4c6('0x5a')]+'%'};return _0x3c341e;})});}_0x12fd44=_[_0xd4c6('0x5b')]({},_0x12fd44,_0x335c01['options']);return _0x3627f4[_0xd4c6('0x12b')](_0x12fd44);}})[_0xd4c6('0x19')](function(_0x434680){if(_0x434680){_0x2d81b6=_0x434680[_0xd4c6('0x55')];if(!_0x335c01[_0xd4c6('0x51')]['hasOwnProperty'](_0xd4c6('0x57'))){_0x12fd44[_0xd4c6('0x29')]=qs[_0xd4c6('0x29')](_0x335c01['query']['limit']);_0x12fd44['offset']=qs[_0xd4c6('0x27')](_0x335c01[_0xd4c6('0x51')][_0xd4c6('0x27')]);}return _0x3627f4[_0xd4c6('0x12b')](_0x12fd44);}})[_0xd4c6('0x19')](function(_0x372d57){if(_0x372d57){return _0x372d57?{'count':_0x2d81b6,'rows':_0x372d57}:null;}})[_0xd4c6('0x19')](respondWithResult(_0xf7a9f4,null))[_0xd4c6('0x65')](handleError(_0xf7a9f4,null));}; \ No newline at end of file +var _0x9957=['Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','DESC','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','applications','orderBy','priority','asc','account','list','Contacts','contact','threadId','closed','Writing\x20on\x20closed\x20interaction','externalUrl','interaction','ChatInteraction','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','unshift','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','Sequelize','no\x20available\x20attributes','difference','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','ChatOfflineMessage','fromString','originalname','mimetype','files','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','internal','Tags','color','tag','getSnippet','getProactiveActions','getLicense','virtual','License','increment','chatLicenseExceeded','3.13.0','headers','origin','http://localhost:9000','testWebsiteWithWildcard','remote','stringify','x-real-ip','connection','replace','alignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','addProactiveActions','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','lodash','querystring','html-to-text','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','undefined','limit','offset','count','Content-Range','update','destroy','ChatWebsites','end','name','send','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','%s\x20%s','version','unknown','format','device','vendor','%s\x20%s\x20%s','model','type','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','key','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','merge','options','include','findAll','show','params','includeAll','find','create','body','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','get','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','rows','removeDispositions','ChatWebsiteId','CannedAnswer','removeAnswers','ids','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','custom','isNil','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','includes'];(function(_0x28fb34,_0x1a1869){var _0x404a15=function(_0x35f155){while(--_0x35f155){_0x28fb34['push'](_0x28fb34['shift']());}};_0x404a15(++_0x1a1869);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var Mustache=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var ejs=require(_0x7995('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7995('0x4'));var querystring=require(_0x7995('0x5'));var htmlToText=require(_0x7995('0x6'));var Redis=require(_0x7995('0x7'));var jayson=require('jayson/promise');var qs=require(_0x7995('0x8'));var logger=require(_0x7995('0x9'))(_0x7995('0xa'));var config=require(_0x7995('0xb'));var APIBadRequestError=require(_0x7995('0xc'))[_0x7995('0xd')];var APINotFoundError=require('../../errors/api')[_0x7995('0xe')];var APIOutOfIntervalError=require(_0x7995('0xc'))['APIOutOfIntervalError'];var APIHandleError=require(_0x7995('0xc'))[_0x7995('0xf')];var APIConflictError=require(_0x7995('0xc'))[_0x7995('0x10')];var wildcardUtils=require(_0x7995('0x11'));var URL=require(_0x7995('0x12'))[_0x7995('0x13')];var db=require('../../mysqldb')['db'];config[_0x7995('0x14')]=_[_0x7995('0x15')](config['redis'],{'host':_0x7995('0x16'),'port':0x18eb});var socket=require(_0x7995('0x17'))(new Redis(config[_0x7995('0x14')]));require(_0x7995('0x18'))[_0x7995('0x19')](socket);var client=jayson[_0x7995('0x1a')][_0x7995('0x1b')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0x7995('0x1a')][_0x7995('0x1b')]({'port':0x232b});var client9001=jayson[_0x7995('0x1a')][_0x7995('0x1b')]({'port':0x2329});function respondWithRpcPromise(_0x3f1d3e,_0x1a5310,_0x2202ce,_0x41cbf0){return new Promise(function(_0x5377e5,_0x2eeacc){var _0x565d97=_0x41cbf0||client;return _0x565d97[_0x7995('0x1c')](_0x3f1d3e,_0x2202ce)[_0x7995('0x1d')](function(_0x43d4b8){logger[_0x7995('0x1e')](_0x7995('0x1f'),_0x1a5310,_0x7995('0x20'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1a5310,_0x7995('0x20'),JSON['stringify'](_0x43d4b8));if(_0x43d4b8['error']){if(_0x43d4b8[_0x7995('0x21')][_0x7995('0x22')]===0x1f4){logger['error'](_0x7995('0x1f'),_0x1a5310,_0x43d4b8['error']['message']);return _0x2eeacc(_0x43d4b8[_0x7995('0x21')][_0x7995('0x23')]);}logger[_0x7995('0x21')](_0x7995('0x1f'),_0x1a5310,_0x43d4b8[_0x7995('0x21')][_0x7995('0x23')]);return _0x5377e5(_0x43d4b8['error'][_0x7995('0x23')]);}else{logger[_0x7995('0x1e')](_0x7995('0x1f'),_0x1a5310,_0x7995('0x20'));_0x5377e5(_0x43d4b8[_0x7995('0x24')][_0x7995('0x23')]);}})[_0x7995('0x25')](function(_0x472195){logger['error'](_0x7995('0x1f'),_0x1a5310,_0x472195);_0x2eeacc(_0x472195);});});}function respondWithStatusCode(_0x34e70c,_0x401dc3){_0x401dc3=_0x401dc3||0xcc;return function(_0x268ce7){if(_0x268ce7){return _0x34e70c[_0x7995('0x26')](_0x401dc3);}return _0x34e70c[_0x7995('0x27')](_0x401dc3)['end']();};}function respondWithResult(_0x47625f,_0x5911c3){_0x5911c3=_0x5911c3||0xc8;return function(_0x229742){if(_0x229742){return _0x47625f[_0x7995('0x27')](_0x5911c3)[_0x7995('0x28')](_0x229742);}};}function respondWithFilteredResult(_0x132a42,_0x11c1eb){return function(_0x4b6f99){if(_0x4b6f99){var _0x9b2a15=typeof _0x11c1eb['offset']===_0x7995('0x29')&&typeof _0x11c1eb[_0x7995('0x2a')]===_0x7995('0x29');var _0x574574=_0x4b6f99['count'];var _0x48e573=_0x9b2a15?0x0:_0x11c1eb[_0x7995('0x2b')];var _0xe6b0b3=_0x9b2a15?_0x4b6f99[_0x7995('0x2c')]:_0x11c1eb[_0x7995('0x2b')]+_0x11c1eb[_0x7995('0x2a')];var _0x1ca460;if(_0xe6b0b3>=_0x574574){_0xe6b0b3=_0x574574;_0x1ca460=0xc8;}else{_0x1ca460=0xce;}_0x132a42['status'](_0x1ca460);return _0x132a42['set'](_0x7995('0x2d'),_0x48e573+'-'+_0xe6b0b3+'/'+_0x574574)['json'](_0x4b6f99);}return null;};}function saveUpdates(_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x2e')](_0x553671)[_0x7995('0x1d')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841){return function(_0x44309d){if(_0x44309d){return _0x44309d[_0x7995('0x2f')]()['then'](function(){var _0x48db25=_0x44309d['get']({'plain':!![]});var _0x45bc5e=_0x7995('0x30');return db['UserProfileResource'][_0x7995('0x2f')]({'where':{'type':_0x45bc5e,'resourceId':_0x48db25['id']}})['then'](function(){return _0x44309d;});})[_0x7995('0x1d')](function(){_0x510841[_0x7995('0x27')](0xcc)[_0x7995('0x31')]();});}};}function handleEntityNotFound(_0x5014d2){return function(_0x52d76d){if(!_0x52d76d){_0x5014d2[_0x7995('0x26')](0x194);}return _0x52d76d;};}function handleError(_0x5e67fe,_0x5d2428){_0x5d2428=_0x5d2428||0x1f4;return function(_0x3e99cd){logger[_0x7995('0x21')](_0x3e99cd['stack']);if(_0x3e99cd[_0x7995('0x32')]){delete _0x3e99cd[_0x7995('0x32')];}_0x5e67fe[_0x7995('0x27')](_0x5d2428)[_0x7995('0x33')](_0x3e99cd);};}function createInteractionObject(_0x1e3dbf,_0x53002a,_0x2d4285,_0x242713){var _0xf612e6=require(_0x7995('0x34'));var _0x4b1541=new _0xf612e6();var _0x2be2c0=_0x4b1541[_0x7995('0x35')](_0x2d4285[_0x7995('0x36')])[_0x7995('0x37')]();var _0x1f5bee=_0x53002a[_0x7995('0x38')];if(_0x2d4285['cf-connecting-ip']){_0x1f5bee=_0x2d4285[_0x7995('0x39')];}else if(_0x2d4285[_0x7995('0x3a')]){_0x1f5bee=_[_0x7995('0x3b')](_0x2d4285[_0x7995('0x3a')][_0x7995('0x3c')](','));}return{'ContactId':_0x242713['id'],'ChatWebsiteId':_0x1e3dbf,'from':(_0x242713[_0x7995('0x3d')]||'')+'\x20'+(_0x242713[_0x7995('0x3e')]||''),'customerIp':_0x1f5bee,'customerPort':_0x2d4285[_0x7995('0x3f')]?_0x2d4285[_0x7995('0x3f')]:null,'referer':_0x53002a[_0x7995('0x40')],'browserName':_0x2be2c0[_0x7995('0x41')][_0x7995('0x32')]&&_0x2be2c0[_0x7995('0x41')]['version']?util['format'](_0x7995('0x42'),_0x2be2c0[_0x7995('0x41')]['name'],_0x2be2c0['browser'][_0x7995('0x43')]):'unknown','browserVersion':_0x2be2c0['browser'][_0x7995('0x43')]||_0x7995('0x44'),'osName':util[_0x7995('0x45')]('%s\x20%s',_0x2be2c0['os'][_0x7995('0x32')],_0x2be2c0['os']['version']),'osVersion':_0x2be2c0['os'][_0x7995('0x43')],'deviceModel':_0x2be2c0['device']['model']&&_0x2be2c0[_0x7995('0x46')][_0x7995('0x47')]?util[_0x7995('0x45')](_0x7995('0x48'),_0x2be2c0['device'][_0x7995('0x49')],_0x2be2c0[_0x7995('0x46')][_0x7995('0x47')],_0x2be2c0[_0x7995('0x46')]['type']):null,'deviceVendor':_0x2be2c0['device'][_0x7995('0x47')],'deviceType':_0x2be2c0['device'][_0x7995('0x4a')],'formData':JSON['stringify'](_0x53002a)};}exports[_0x7995('0x4b')]=function(_0x4c1127,_0x1e795e){var _0x1b0373={'include':[{'model':db[_0x7995('0x4c')],'as':_0x7995('0x4d')}]},_0x4d9245={},_0x3e9e62={'count':0x0,'rows':[]};var _0xb70a51=_['map'](db[_0x7995('0x4e')][_0x7995('0x4f')],function(_0x237270){return{'name':_0x237270['fieldName'],'type':_0x237270[_0x7995('0x4a')][_0x7995('0x50')]};});_0x4d9245[_0x7995('0x49')]=_[_0x7995('0x51')](_0xb70a51,_0x7995('0x32'));_0x4d9245['query']=_[_0x7995('0x52')](_0x4c1127[_0x7995('0x53')]);_0x4d9245['filters']=_[_0x7995('0x54')](_0x4d9245['model'],_0x4d9245[_0x7995('0x53')]);_0x1b0373[_0x7995('0x55')]=_[_0x7995('0x54')](_0x4d9245[_0x7995('0x49')],qs[_0x7995('0x56')](_0x4c1127[_0x7995('0x53')][_0x7995('0x56')]));_0x1b0373['attributes']=_0x1b0373[_0x7995('0x55')][_0x7995('0x57')]?_0x1b0373[_0x7995('0x55')]:_0x4d9245['model'];if(!_0x4c1127[_0x7995('0x53')][_0x7995('0x58')](_0x7995('0x59'))){_0x1b0373['limit']=qs['limit'](_0x4c1127['query'][_0x7995('0x2a')]);_0x1b0373[_0x7995('0x2b')]=qs['offset'](_0x4c1127[_0x7995('0x53')][_0x7995('0x2b')]);}_0x1b0373[_0x7995('0x5a')]=qs[_0x7995('0x5b')](_0x4c1127[_0x7995('0x53')]['sort']);_0x1b0373[_0x7995('0x5c')]=qs['filters'](_[_0x7995('0x5d')](_0x4c1127[_0x7995('0x53')],_0x4d9245[_0x7995('0x5e')]),_0xb70a51);if(_0x4c1127['query']['filter']){_0x1b0373['where']=_['merge'](_0x1b0373[_0x7995('0x5c')],{'$or':_[_0x7995('0x51')](_0xb70a51,function(_0x1a861c){if(_0x1a861c[_0x7995('0x4a')]!==_0x7995('0x5f')){var _0x357e60={};_0x357e60[_0x1a861c[_0x7995('0x32')]]={'$like':'%'+_0x4c1127[_0x7995('0x53')][_0x7995('0x60')]+'%'};return _0x357e60;}})});}_0x1b0373=_[_0x7995('0x61')]({},_0x1b0373,_0x4c1127[_0x7995('0x62')]);var _0x133c63={'where':_0x1b0373[_0x7995('0x5c')]};return db[_0x7995('0x4e')][_0x7995('0x2c')](_0x133c63)[_0x7995('0x1d')](function(_0x447a2b){_0x3e9e62[_0x7995('0x2c')]=_0x447a2b;if(_0x4c1127[_0x7995('0x53')]['includeAll']){_0x1b0373[_0x7995('0x63')]=[{'all':!![]}];}return db[_0x7995('0x4e')][_0x7995('0x64')](_0x1b0373);})[_0x7995('0x1d')](function(_0x5d160d){_0x3e9e62['rows']=_0x5d160d;return _0x3e9e62;})[_0x7995('0x1d')](respondWithFilteredResult(_0x1e795e,_0x1b0373))[_0x7995('0x25')](handleError(_0x1e795e,null));};exports[_0x7995('0x65')]=function(_0x332a85,_0x51c50b){var _0x13cd7b={'raw':![],'where':{'id':_0x332a85[_0x7995('0x66')]['id']},'include':[{'model':db[_0x7995('0x4c')],'as':'mandatoryDispositionPause'}]},_0x74ff38={};_0x74ff38['model']=_[_0x7995('0x52')](db[_0x7995('0x4e')][_0x7995('0x4f')]);_0x74ff38[_0x7995('0x53')]=_[_0x7995('0x52')](_0x332a85[_0x7995('0x53')]);_0x74ff38[_0x7995('0x5e')]=_[_0x7995('0x54')](_0x74ff38[_0x7995('0x49')],_0x74ff38['query']);_0x13cd7b[_0x7995('0x55')]=_[_0x7995('0x54')](_0x74ff38[_0x7995('0x49')],qs[_0x7995('0x56')](_0x332a85['query']['fields']));_0x13cd7b[_0x7995('0x55')]=_0x13cd7b[_0x7995('0x55')]['length']?_0x13cd7b[_0x7995('0x55')]:_0x74ff38[_0x7995('0x49')];if(_0x332a85[_0x7995('0x53')][_0x7995('0x67')]){_0x13cd7b[_0x7995('0x63')]=[{'all':!![]}];}_0x13cd7b=_['merge']({},_0x13cd7b,_0x332a85[_0x7995('0x62')]);return db['ChatWebsite'][_0x7995('0x68')](_0x13cd7b)[_0x7995('0x1d')](handleEntityNotFound(_0x51c50b,null))[_0x7995('0x1d')](respondWithResult(_0x51c50b,null))[_0x7995('0x25')](handleError(_0x51c50b,null));};exports[_0x7995('0x69')]=function(_0xeb8920,_0x2b3c1d){var _0x44372a=null;_0xeb8920[_0x7995('0x6a')][_0x7995('0x6b')][_0x7995('0x3c')](',')[_0x7995('0x6c')](_0x56eb85=>{if(_0x56eb85[_0x7995('0x6d')]()!==''&&!wildcardUtils[_0x7995('0x6e')](_0x56eb85[_0x7995('0x6d')]())){_0x44372a=new APIBadRequestError('\x22'+_0x56eb85[_0x7995('0x6d')]()+_0x7995('0x6f'));}});if(_0x44372a){return handleError(_0x2b3c1d,null)(_0x44372a);}return db['ChatWebsite']['create'](_0xeb8920[_0x7995('0x6a')],{})[_0x7995('0x1d')](function(_0x221542){var _0xae6166=_0xeb8920['user'][_0x7995('0x70')]({'plain':!![]});if(!_0xae6166)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xae6166['role']===_0x7995('0x71')){var _0x36d27d=_0x221542[_0x7995('0x70')]({'plain':!![]});var _0x44bf2b=_0x7995('0x30');return db[_0x7995('0x72')][_0x7995('0x68')]({'where':{'name':_0x44bf2b,'userProfileId':_0xae6166[_0x7995('0x73')]},'raw':!![]})[_0x7995('0x1d')](function(_0x2466df){if(_0x2466df&&_0x2466df['autoAssociation']===0x0){return db[_0x7995('0x74')][_0x7995('0x69')]({'name':_0x36d27d[_0x7995('0x32')],'resourceId':_0x36d27d['id'],'type':_0x2466df['name'],'sectionId':_0x2466df['id']},{})[_0x7995('0x1d')](function(){return _0x221542;});}else{return _0x221542;}})[_0x7995('0x25')](function(_0x705f0){logger[_0x7995('0x21')](_0x7995('0x75'),_0x705f0);throw _0x705f0;});}return _0x221542;})[_0x7995('0x1d')](respondWithResult(_0x2b3c1d,0xc9))[_0x7995('0x25')](handleError(_0x2b3c1d,null));};exports[_0x7995('0x2e')]=function(_0x2f94c4,_0x1fdff6){var _0x435a1b=null;_0x2f94c4['body']['address'][_0x7995('0x3c')](',')[_0x7995('0x6c')](_0x39ebb6=>{if(_0x39ebb6[_0x7995('0x6d')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x39ebb6[_0x7995('0x6d')]())){_0x435a1b=new APIBadRequestError('\x22'+_0x39ebb6[_0x7995('0x6d')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x435a1b){return handleError(_0x1fdff6,null)(_0x435a1b);}if(_0x2f94c4['body']['id']){delete _0x2f94c4[_0x7995('0x6a')]['id'];}return db[_0x7995('0x4e')]['find']({'where':{'id':_0x2f94c4[_0x7995('0x66')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x4d')}]})[_0x7995('0x1d')](handleEntityNotFound(_0x1fdff6,null))['then'](saveUpdates(_0x2f94c4['body'],null))[_0x7995('0x1d')](respondWithResult(_0x1fdff6,null))['catch'](handleError(_0x1fdff6,null));};exports[_0x7995('0x2f')]=function(_0xa41fff,_0x3dd197){return db[_0x7995('0x4e')][_0x7995('0x68')]({'where':{'id':_0xa41fff[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x3dd197,null))[_0x7995('0x1d')](removeEntity(_0x3dd197,null))[_0x7995('0x25')](handleError(_0x3dd197,null));};exports[_0x7995('0x76')]=function(_0x1ab590,_0x16108c){return db[_0x7995('0x4e')][_0x7995('0x76')]()[_0x7995('0x1d')](respondWithResult(_0x16108c,null))[_0x7995('0x25')](handleError(_0x16108c,null));};exports[_0x7995('0x77')]=function(_0x251490,_0x2ff7ba){if(_0x251490[_0x7995('0x6a')]['id']){delete _0x251490[_0x7995('0x6a')]['id'];}return db[_0x7995('0x4e')][_0x7995('0x68')]({'where':{'id':_0x251490[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x2ff7ba,null))[_0x7995('0x1d')](function(_0x2f7f51){if(_0x2f7f51){_0x251490[_0x7995('0x6a')]['ChatWebsiteId']=_0x2f7f51['id'];return db[_0x7995('0x78')][_0x7995('0x69')](_0x251490['body']);}})['then'](respondWithResult(_0x2ff7ba,null))[_0x7995('0x25')](handleError(_0x2ff7ba,null));};exports[_0x7995('0x79')]=function(_0x2d45d5,_0x38acda){var _0xe1ce4={'raw':![],'where':{}};var _0x2491fe={};var _0x5507a0={'count':0x0,'rows':[]};return db[_0x7995('0x4e')][_0x7995('0x7a')]({'where':{'id':_0x2d45d5[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x38acda,null))[_0x7995('0x1d')](function(_0x3f0bff){if(_0x3f0bff){_0x2491fe[_0x7995('0x49')]=_[_0x7995('0x52')](db['Disposition'][_0x7995('0x4f')]);_0x2491fe[_0x7995('0x53')]=_['keys'](_0x2d45d5['query']);_0x2491fe[_0x7995('0x5e')]=_[_0x7995('0x54')](_0x2491fe[_0x7995('0x49')],_0x2491fe[_0x7995('0x53')]);_0xe1ce4[_0x7995('0x55')]=_['intersection'](_0x2491fe[_0x7995('0x49')],qs[_0x7995('0x56')](_0x2d45d5['query'][_0x7995('0x56')]));_0xe1ce4[_0x7995('0x55')]=_0xe1ce4['attributes'][_0x7995('0x57')]?_0xe1ce4['attributes']:_0x2491fe[_0x7995('0x49')];if(!_0x2d45d5[_0x7995('0x53')][_0x7995('0x58')](_0x7995('0x59'))){_0xe1ce4[_0x7995('0x2a')]=qs['limit'](_0x2d45d5[_0x7995('0x53')][_0x7995('0x2a')]);_0xe1ce4[_0x7995('0x2b')]=qs['offset'](_0x2d45d5[_0x7995('0x53')][_0x7995('0x2b')]);}_0xe1ce4[_0x7995('0x5a')]=qs[_0x7995('0x5b')](_0x2d45d5['query'][_0x7995('0x5b')]);_0xe1ce4[_0x7995('0x5c')]=qs[_0x7995('0x5e')](_['pick'](_0x2d45d5['query'],_0x2491fe[_0x7995('0x5e')]));_0xe1ce4[_0x7995('0x5c')]['ChatWebsiteId']=_0x3f0bff['id'];if(_0x2d45d5['query'][_0x7995('0x60')]){_0xe1ce4[_0x7995('0x5c')]=_[_0x7995('0x61')](_0xe1ce4[_0x7995('0x5c')],{'$or':_[_0x7995('0x51')](_0xe1ce4['attributes'],function(_0x56003d){var _0x393cb7={};_0x393cb7[_0x56003d]={'$like':'%'+_0x2d45d5['query']['filter']+'%'};return _0x393cb7;})});}_0xe1ce4=_[_0x7995('0x61')]({},_0xe1ce4,_0x2d45d5[_0x7995('0x62')]);return db[_0x7995('0x78')]['count']({'where':_0xe1ce4[_0x7995('0x5c')]})[_0x7995('0x1d')](function(_0x2b0b79){_0x5507a0[_0x7995('0x2c')]=_0x2b0b79;if(_0x2d45d5[_0x7995('0x53')]['includeAll']){_0xe1ce4[_0x7995('0x63')]=[{'all':!![]}];}return db[_0x7995('0x78')][_0x7995('0x64')](_0xe1ce4);})[_0x7995('0x1d')](function(_0x50bf9a){_0x5507a0[_0x7995('0x7b')]=_0x50bf9a;return _0x5507a0;});}})[_0x7995('0x1d')](respondWithFilteredResult(_0x38acda,_0xe1ce4))['catch'](handleError(_0x38acda,null));};exports[_0x7995('0x7c')]=function(_0x20683e,_0x5b1528){return db[_0x7995('0x4e')]['find']({'where':{'id':_0x20683e[_0x7995('0x66')]['id']}})['then'](handleEntityNotFound(_0x5b1528,null))[_0x7995('0x1d')](function(_0x4d12fd){if(_0x4d12fd){return _0x4d12fd[_0x7995('0x7c')](_0x20683e[_0x7995('0x53')]['ids']);}})[_0x7995('0x1d')](respondWithStatusCode(_0x5b1528,null))['catch'](handleError(_0x5b1528,null));};exports['addAnswer']=function(_0x7b9e26,_0x14812d){if(_0x7b9e26[_0x7995('0x6a')]['id']){delete _0x7b9e26[_0x7995('0x6a')]['id'];}return db['ChatWebsite'][_0x7995('0x68')]({'where':{'id':_0x7b9e26[_0x7995('0x66')]['id']}})['then'](handleEntityNotFound(_0x14812d,null))['then'](function(_0xc2648d){if(_0xc2648d){_0x7b9e26['body'][_0x7995('0x7d')]=_0xc2648d['id'];return db[_0x7995('0x7e')][_0x7995('0x69')](_0x7b9e26['body']);}})['then'](respondWithResult(_0x14812d,null))[_0x7995('0x25')](handleError(_0x14812d,null));};exports['getAnswers']=function(_0x12e9d9,_0x44891e){var _0x14449c={'raw':![],'where':{}};var _0x38bd35={};var _0x4ff5e7={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x12e9d9[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x44891e,null))[_0x7995('0x1d')](function(_0x2df7d3){if(_0x2df7d3){_0x38bd35[_0x7995('0x49')]=_[_0x7995('0x52')](db['CannedAnswer']['rawAttributes']);_0x38bd35[_0x7995('0x53')]=_['keys'](_0x12e9d9['query']);_0x38bd35[_0x7995('0x5e')]=_['intersection'](_0x38bd35['model'],_0x38bd35[_0x7995('0x53')]);_0x14449c[_0x7995('0x55')]=_[_0x7995('0x54')](_0x38bd35['model'],qs[_0x7995('0x56')](_0x12e9d9[_0x7995('0x53')][_0x7995('0x56')]));_0x14449c[_0x7995('0x55')]=_0x14449c[_0x7995('0x55')][_0x7995('0x57')]?_0x14449c[_0x7995('0x55')]:_0x38bd35[_0x7995('0x49')];if(!_0x12e9d9[_0x7995('0x53')]['hasOwnProperty'](_0x7995('0x59'))){_0x14449c[_0x7995('0x2a')]=qs[_0x7995('0x2a')](_0x12e9d9[_0x7995('0x53')][_0x7995('0x2a')]);_0x14449c['offset']=qs[_0x7995('0x2b')](_0x12e9d9[_0x7995('0x53')][_0x7995('0x2b')]);}_0x14449c['order']=qs['sort'](_0x12e9d9['query'][_0x7995('0x5b')]);_0x14449c[_0x7995('0x5c')]=qs[_0x7995('0x5e')](_[_0x7995('0x5d')](_0x12e9d9[_0x7995('0x53')],_0x38bd35[_0x7995('0x5e')]));_0x14449c['where'][_0x7995('0x7d')]=_0x2df7d3['id'];if(_0x12e9d9['query'][_0x7995('0x60')]){_0x14449c[_0x7995('0x5c')]=_[_0x7995('0x61')](_0x14449c[_0x7995('0x5c')],{'$or':_[_0x7995('0x51')](_0x14449c[_0x7995('0x55')],function(_0x4f929b){var _0x24a0e6={};_0x24a0e6[_0x4f929b]={'$like':'%'+_0x12e9d9[_0x7995('0x53')][_0x7995('0x60')]+'%'};return _0x24a0e6;})});}_0x14449c=_[_0x7995('0x61')]({},_0x14449c,_0x12e9d9['options']);return db[_0x7995('0x7e')]['count']({'where':_0x14449c[_0x7995('0x5c')]})[_0x7995('0x1d')](function(_0x592ae3){_0x4ff5e7['count']=_0x592ae3;if(_0x12e9d9[_0x7995('0x53')][_0x7995('0x67')]){_0x14449c[_0x7995('0x63')]=[{'all':!![]}];}return db[_0x7995('0x7e')][_0x7995('0x64')](_0x14449c);})[_0x7995('0x1d')](function(_0x281477){_0x4ff5e7[_0x7995('0x7b')]=_0x281477;return _0x4ff5e7;});}})[_0x7995('0x1d')](respondWithFilteredResult(_0x44891e,_0x14449c))[_0x7995('0x25')](handleError(_0x44891e,null));};exports[_0x7995('0x7f')]=function(_0x245ea6,_0x5eb2d9){return db['ChatWebsite'][_0x7995('0x68')]({'where':{'id':_0x245ea6[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x5eb2d9,null))[_0x7995('0x1d')](function(_0x100bde){if(_0x100bde){return _0x100bde['removeAnswers'](_0x245ea6[_0x7995('0x53')][_0x7995('0x80')]);}})['then'](respondWithStatusCode(_0x5eb2d9,null))[_0x7995('0x25')](handleError(_0x5eb2d9,null));};exports['addLogo']=function(_0x37416c,_0x30cda5){_0x37416c[_0x7995('0x6a')]['sitepic']=_0x37416c[_0x7995('0x81')][_0x7995('0x82')];return db[_0x7995('0x4e')][_0x7995('0x68')]({'where':{'id':_0x37416c[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x30cda5,null))[_0x7995('0x1d')](saveUpdates(_0x37416c['body'],null))['then'](respondWithResult(_0x30cda5,null))['catch'](handleError(_0x30cda5,null));};exports[_0x7995('0x83')]=function(_0x1b4915,_0x5a78e9){_0x1b4915['body'][_0x7995('0x84')]=_0x1b4915[_0x7995('0x81')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x1b4915['params']['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x5a78e9,null))[_0x7995('0x1d')](saveUpdates(_0x1b4915[_0x7995('0x6a')],null))[_0x7995('0x1d')](respondWithResult(_0x5a78e9,null))['catch'](handleError(_0x5a78e9,null));};exports[_0x7995('0x85')]=function(_0x248e7c,_0x58c3e8){_0x248e7c[_0x7995('0x6a')][_0x7995('0x86')]=_0x248e7c[_0x7995('0x81')]['filename'];return db[_0x7995('0x4e')][_0x7995('0x68')]({'where':{'id':_0x248e7c['params']['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x58c3e8,null))[_0x7995('0x1d')](saveUpdates(_0x248e7c[_0x7995('0x6a')],null))[_0x7995('0x1d')](respondWithResult(_0x58c3e8,null))[_0x7995('0x25')](handleError(_0x58c3e8,null));};exports[_0x7995('0x87')]=function(_0x8abd9a,_0x114f3c){_0x8abd9a[_0x7995('0x6a')][_0x7995('0x88')]=_0x8abd9a[_0x7995('0x81')][_0x7995('0x82')];return db[_0x7995('0x4e')]['find']({'where':{'id':_0x8abd9a[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x114f3c,null))[_0x7995('0x1d')](saveUpdates(_0x8abd9a[_0x7995('0x6a')],null))['then'](respondWithResult(_0x114f3c,null))[_0x7995('0x25')](handleError(_0x114f3c,null));};exports[_0x7995('0x89')]=function(_0x2bc931,_0x52af9b){var _0x1bcc6b=path[_0x7995('0x8a')](config[_0x7995('0x8b')],_0x7995('0x8c'));var _0x1dfc40={'where':{'id':_0x2bc931[_0x7995('0x66')]['id']},'attributes':['id',_0x7995('0x8d')],'raw':!![]};var _0x4f9d58=![];return require(_0x7995('0x8e'))['getLicense']()[_0x7995('0x1d')](function(_0x164c61){if(_0x164c61){_0x4f9d58=_0x164c61[_0x7995('0x8f')];}})['then'](function(){return db[_0x7995('0x4e')]['find'](_0x1dfc40);})['then'](handleEntityNotFound(_0x52af9b,null))['then'](function(_0x4b3170){if(_0x4b3170){if(!_[_0x7995('0x90')](_0x4b3170[_0x7995('0x8d')])){if(fs['existsSync'](path[_0x7995('0x8a')](config[_0x7995('0x8b')],'server/files/images/logos/',_0x4b3170[_0x7995('0x8d')]))&&_0x4f9d58){_0x1bcc6b=path[_0x7995('0x8a')](config[_0x7995('0x8b')],_0x7995('0x91'),_0x4b3170[_0x7995('0x8d')]);}}return _0x52af9b['download'](_0x1bcc6b);}})[_0x7995('0x25')](handleError(_0x52af9b,null));};exports[_0x7995('0x92')]=function(_0x12127d,_0x186ebe){var _0x55387b=path[_0x7995('0x8a')](config[_0x7995('0x8b')],_0x7995('0x93'));var _0x3ca281={'where':{'id':_0x12127d[_0x7995('0x66')]['id']},'attributes':['id',_0x7995('0x84')],'raw':!![]};return db[_0x7995('0x4e')][_0x7995('0x68')](_0x3ca281)[_0x7995('0x1d')](handleEntityNotFound(_0x186ebe,null))[_0x7995('0x1d')](function(_0x5e08fa){if(_0x5e08fa){if(!_[_0x7995('0x90')](_0x5e08fa['agentAvatar'])){if(fs[_0x7995('0x94')](path[_0x7995('0x8a')](config[_0x7995('0x8b')],'server/files/images/avatars/',_0x5e08fa['agentAvatar']))){_0x55387b=path[_0x7995('0x8a')](config[_0x7995('0x8b')],'server/files/images/avatars/',_0x5e08fa[_0x7995('0x84')]);}}return _0x186ebe['download'](_0x55387b);}})[_0x7995('0x25')](handleError(_0x186ebe,null));};exports[_0x7995('0x95')]=function(_0x27b1c2,_0x4e5667){var _0x5897df=path['join'](config[_0x7995('0x8b')],_0x7995('0x96'));var _0x365318={'where':{'id':_0x27b1c2[_0x7995('0x66')]['id']},'attributes':['id','customerAvatar',_0x7995('0x97')],'raw':!![]};return db[_0x7995('0x4e')][_0x7995('0x68')](_0x365318)[_0x7995('0x1d')](handleEntityNotFound(_0x4e5667,null))[_0x7995('0x1d')](function(_0x5104bf){if(_0x5104bf){if(!_['isNil'](_0x5104bf['customerAvatar'])){if(fs[_0x7995('0x94')](path[_0x7995('0x8a')](config['root'],_0x7995('0x98'),_0x5104bf['customerAvatar']))&&_0x5104bf[_0x7995('0x97')]){_0x5897df=path[_0x7995('0x8a')](config[_0x7995('0x8b')],_0x7995('0x98'),_0x5104bf['customerAvatar']);}}return _0x4e5667[_0x7995('0x99')](_0x5897df);}})[_0x7995('0x25')](handleError(_0x4e5667,null));};exports[_0x7995('0x9a')]=function(_0x1d7866,_0x2023a7){var _0x197adc=path[_0x7995('0x8a')](config[_0x7995('0x8b')],_0x7995('0x9b'));var _0x32e5f6={'where':{'id':_0x1d7866[_0x7995('0x66')]['id']},'attributes':['id',_0x7995('0x88')],'raw':!![]};return db[_0x7995('0x4e')][_0x7995('0x68')](_0x32e5f6)['then'](handleEntityNotFound(_0x2023a7,null))[_0x7995('0x1d')](function(_0x58e0c0){if(_0x58e0c0){if(!_[_0x7995('0x90')](_0x58e0c0[_0x7995('0x88')])){if(fs['existsSync'](path[_0x7995('0x8a')](config['root'],_0x7995('0x98'),_0x58e0c0[_0x7995('0x88')]))){_0x197adc=path['join'](config['root'],'server/files/images/avatars/',_0x58e0c0[_0x7995('0x88')]);}}return _0x2023a7[_0x7995('0x99')](_0x197adc);}})[_0x7995('0x25')](handleError(_0x2023a7,null));};function checkWebsiteInterval(_0x2b7bc2){var _0x566b48=_0x2b7bc2[_0x7995('0x9c')];if(!_0x566b48){return Promise[_0x7995('0x9d')](_0x2b7bc2);}var _0xc81297=_0x2b7bc2[_0x7995('0x9e')]||undefined;return _0x566b48[_0x7995('0x9f')](_0xc81297)[_0x7995('0x1d')](function(_0x3e8479){if(!_0x3e8479){throw new APIOutOfIntervalError();}return _0x2b7bc2;});}exports[_0x7995('0xa0')]=function(_0x47f0d9,_0x2e93a9){var _0x5e12c4={'body':_0x47f0d9[_0x7995('0x6a')],'channel':_0x7995('0xa1')};var _0x51ee98=[];var _0x3e90a5=[];var _0x3a2958={};var _0x448faa=![];if(_0x47f0d9[_0x7995('0x6a')]['id']){delete _0x47f0d9[_0x7995('0x6a')]['id'];}if(_[_0x7995('0x90')](_0x47f0d9['body'][_0x7995('0xa2')])){throw new APIBadRequestError(_0x7995('0xa3'));}if(_[_0x7995('0x90')](_0x47f0d9[_0x7995('0x6a')][_0x7995('0xa4')])){throw new APIBadRequestError(_0x7995('0xa5'));}if(_[_0x7995('0xa6')](_0x47f0d9[_0x7995('0x6a')][_0x7995('0x6a')])){throw new APIBadRequestError(_0x7995('0xa7'));}var _0x370e25=_0x47f0d9[_0x7995('0x6a')][_0x7995('0x38')]&&_0x47f0d9[_0x7995('0x6a')][_0x7995('0x40')];return db[_0x7995('0xa8')][_0x7995('0x76')]()[_0x7995('0x1d')](function(_0x40c06b){if(!_0x40c06b){throw new Error(_0x7995('0xa9'));}_0x51ee98=Object[_0x7995('0x52')](_0x40c06b)['filter'](function(_0x4cf7f1){return![_0x7995('0xaa'),_0x7995('0xab')]['includes'](_0x4cf7f1);});_0x3e90a5=Object[_0x7995('0x52')](_0x40c06b)['filter'](function(_0x2ce103){return!['createdAt',_0x7995('0xab'),_0x7995('0xac'),_0x7995('0xad')][_0x7995('0xae')](_0x2ce103);});if(!_[_0x7995('0xae')](_0x3e90a5,_0x47f0d9[_0x7995('0x6a')][_0x7995('0xa4')])){throw new APIBadRequestError(_0x7995('0xaf')+_0x3e90a5[_0x7995('0x8a')](',\x20'));}_0x3a2958[_0x47f0d9[_0x7995('0x6a')]['mapKey']]=_0x47f0d9[_0x7995('0x6a')][_0x7995('0xa2')];})[_0x7995('0x1d')](function(){return db[_0x7995('0x4e')]['find']({'where':{'id':_0x47f0d9[_0x7995('0x66')]['id']},'include':[{'model':db[_0x7995('0xb0')],'as':_0x7995('0xb1'),'include':[{'model':db[_0x7995('0xa8')],'as':'Contacts','where':_0x3a2958,'limit':0x1,'order':[[_0x7995('0xab'),_0x7995('0xb2')]]}]},{'model':db[_0x7995('0xb3')],'as':_0x7995('0xb4')},{'model':db[_0x7995('0x9c')],'as':_0x7995('0x9c'),'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xb5'),'attributes':['id',_0x7995('0xb6')],'raw':!![]}]}]});})['then'](function(_0x3c81cc){if(!_0x3c81cc){throw new APINotFoundError(util['format'](_0x7995('0xb7'),_0x47f0d9[_0x7995('0x66')]['id']));}if(_0x370e25){return checkWebsiteInterval(_0x3c81cc);}return _0x3c81cc;})[_0x7995('0x1d')](function(_0x19fa6d){_0x5e12c4['account']=_0x19fa6d;_0x5e12c4[_0x7995('0xb8')]=_[_0x7995('0xb9')](_0x19fa6d[_0x7995('0xb4')],[_0x7995('0xba')],[_0x7995('0xbb')]);if(_0x5e12c4[_0x7995('0xbc')][_0x7995('0xb4')]){delete _0x5e12c4[_0x7995('0xbc')][_0x7995('0xb4')];}_0x5e12c4[_0x7995('0xbd')]=_0x19fa6d[_0x7995('0xb1')]||{'id':_0x19fa6d[_0x7995('0xad')]};if(_0x5e12c4[_0x7995('0xbd')]&&_0x5e12c4[_0x7995('0xbd')]['Contacts']['length']){return _0x5e12c4[_0x7995('0xbd')][_0x7995('0xbe')][0x0];}var _0xceb704=_['defaults'](_0x47f0d9[_0x7995('0x6a')],{'firstName':_0x47f0d9[_0x7995('0x6a')][_0x7995('0xa2')],'ListId':_0x19fa6d['ListId']});_0xceb704[_0x47f0d9[_0x7995('0x6a')][_0x7995('0xa4')]]=_0x47f0d9[_0x7995('0x6a')][_0x7995('0xa2')];return db[_0x7995('0xa8')][_0x7995('0x69')](_0xceb704,{'fields':_0x51ee98,'raw':!![]});})[_0x7995('0x1d')](function(_0x503d2b){_0x5e12c4[_0x7995('0xbf')]=_0x503d2b;var _0x3e28b6=createInteractionObject(_0x47f0d9[_0x7995('0x66')]['id'],_0x47f0d9['body'],_0x47f0d9['headers'],_0x503d2b);var _0x23e2c8={'ChatWebsiteId':_0x47f0d9['params']['id']};if(_0x47f0d9[_0x7995('0x6a')][_0x7995('0xc0')]){_0x23e2c8[_0x7995('0xc0')]=_0x47f0d9[_0x7995('0x6a')][_0x7995('0xc0')];_0x23e2c8['closed']=![];return db['ChatInteraction'][_0x7995('0x68')]({'where':_0x23e2c8})[_0x7995('0x1d')](function(_0x1475f8){var _0x1eacbf=_0x47f0d9[_0x7995('0x6a')][_0x7995('0x38')]&&_0x47f0d9[_0x7995('0x6a')][_0x7995('0x40')];if(_0x1475f8){_0x448faa=!![];return _0x1475f8;}else if(!_0x1eacbf&&_0x1475f8&&_0x1475f8[_0x7995('0xc1')]){throw new APIConflictError(_0x7995('0xc2'));}_0x3e28b6['threadId']=_0x47f0d9[_0x7995('0x6a')][_0x7995('0xc0')];_0x3e28b6[_0x7995('0xc3')]=_0x47f0d9[_0x7995('0x6a')]['externalUrl'];return db['ChatInteraction']['create'](_0x3e28b6);});}_0x23e2c8['ContactId']=_0x503d2b['id'];if(_0x47f0d9['body'][_0x7995('0xc4')]&&_0x47f0d9['body']['interaction']['id']){_0x23e2c8['id']=_0x47f0d9[_0x7995('0x6a')][_0x7995('0xc4')]['id'];return db[_0x7995('0xc5')]['find']({'where':_0x23e2c8})[_0x7995('0x1d')](function(_0x4f008a){var _0x39dff0=_0x47f0d9[_0x7995('0x6a')][_0x7995('0x38')]&&_0x47f0d9['body'][_0x7995('0x40')];if(!_0x39dff0&&_0x4f008a&&_0x4f008a[_0x7995('0xc1')]){throw new APIConflictError(_0x7995('0xc2'));}else if(_0x4f008a){_0x448faa=!![];return _0x4f008a;}else{return db['ChatInteraction'][_0x7995('0x69')](_0x3e28b6);}});}return db[_0x7995('0xc5')][_0x7995('0x69')](_0x3e28b6);})[_0x7995('0x1d')](function(_0x17fbde){if(!_0x448faa){return _0x17fbde;}var _0x574e2a={'from':(_0x5e12c4[_0x7995('0xbf')][_0x7995('0x3d')]||'')+'\x20'+(_0x5e12c4[_0x7995('0xbf')]['lastName']||'')};if(_0x47f0d9[_0x7995('0x6a')][_0x7995('0xc0')]&&_0x47f0d9[_0x7995('0x6a')][_0x7995('0xc6')]&&_0x47f0d9[_0x7995('0x6a')]['threadId']!=_0x47f0d9[_0x7995('0x6a')][_0x7995('0xc6')]){_0x574e2a[_0x7995('0xc0')]=_0x47f0d9[_0x7995('0x6a')][_0x7995('0xc6')];}return _0x17fbde[_0x7995('0x2e')](_0x574e2a);})[_0x7995('0x1d')](function(_0x5baca7){_0x5e12c4['interaction']=_0x5baca7[_0x7995('0x70')]({'plain':!![]});_0x5e12c4[_0x7995('0xc4')]['created']=!_0x448faa;if(_0x5e12c4['interaction'][_0x7995('0xc7')]){if(_0x5e12c4[_0x7995('0xbc')][_0x7995('0xc8')]){_0x5e12c4[_0x7995('0xb8')][_0x7995('0xc9')]({'id':0x0,'priority':_0x5e12c4[_0x7995('0xb8')][_0x7995('0x57')]+0x1,'app':'close','appdata':_0x7995('0xca'),'interval':_0x7995('0xcb')});}}return db[_0x7995('0xcc')][_0x7995('0x69')]({'body':_0x47f0d9[_0x7995('0x6a')][_0x7995('0x6a')],'ChatWebsiteId':_0x47f0d9['params']['id'],'ChatInteractionId':_0x5baca7['id'],'direction':'in','ContactId':_0x5e12c4[_0x7995('0xbf')]['id'],'AttachmentId':_0x47f0d9[_0x7995('0x6a')][_0x7995('0xcd')]});})[_0x7995('0x1d')](function(_0x13c918){_0x5e12c4[_0x7995('0x23')]=_0x13c918;if(!_0x5e12c4[_0x7995('0xc4')]['UserId']){return;}return db[_0x7995('0xce')][_0x7995('0x68')]({'attributes':['id',_0x7995('0x32')],'where':{'id':_0x5e12c4[_0x7995('0xc4')]['UserId']}});})[_0x7995('0x1d')](function(_0x5c9894){if(_0x5c9894){_0x5e12c4[_0x7995('0xb8')][_0x7995('0xcf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5c9894['name']+','+(_0x5e12c4['account'][_0x7995('0xd0')]||0xa),'interval':_0x7995('0xcb')});_0x5e12c4[_0x7995('0xd1')]=!![];}if(!_0x5e12c4[_0x7995('0xc4')][_0x7995('0xd2')]){return;}return db[_0x7995('0xd3')][_0x7995('0x68')]({'attributes':['id',_0x7995('0x32')],'where':{'id':_0x5e12c4[_0x7995('0xc4')][_0x7995('0xd2')]}});})[_0x7995('0x1d')](function(_0x233f44){if(_0x233f44){_0x5e12c4['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x7995('0xd4'),'appdata':_0x233f44['name']+','+(_0x5e12c4['account'][_0x7995('0xd5')]||0x12c),'interval':_0x7995('0xcb')});}return respondWithRpcPromise(_0x7995('0xd6'),_0x7995('0xd7'),_0x5e12c4);})[_0x7995('0x1d')](function(_0x29b1cd){respondWithRpcPromise(_0x7995('0xd8'),_0x7995('0xd8'),{'event':_0x7995('0xa0'),'message':_0x29b1cd},client9002);return _0x29b1cd;})[_0x7995('0x1d')](respondWithResult(_0x2e93a9,null))[_0x7995('0x25')](APIHandleError(_0x2e93a9));};exports[_0x7995('0xd9')]=function(_0x511628,_0x3ad9ff){var _0x1a4919,_0x39f3d9,_0x2ec6c9;var _0x2ace90=[];var _0x17570a={};var _0x360022=_0x511628['files']||[];var _0x88334d=[];var _0x234832;return db[_0x7995('0xa8')][_0x7995('0x76')]()[_0x7995('0x1d')](function(_0x53a7a4){if(!_0x53a7a4){throw new db[(_0x7995('0xda'))]['ValidationError'](_0x7995('0xdb'));}_0x2ace90=_[_0x7995('0xdc')](_[_0x7995('0x52')](_0x53a7a4),['createdAt',_0x7995('0xab'),_0x7995('0xac'),_0x7995('0xad')]);if(_0x511628[_0x7995('0x6a')]['id']){delete _0x511628[_0x7995('0x6a')]['id'];}if(_[_0x7995('0x90')](_0x511628[_0x7995('0x6a')]['from'])){throw _0x3ad9ff['status'](0x1f4)[_0x7995('0x33')](new db[(_0x7995('0xda'))][(_0x7995('0xdd'))](_0x7995('0xde')));}if(_[_0x7995('0x90')](_0x511628[_0x7995('0x6a')]['body'])||_0x511628[_0x7995('0x6a')][_0x7995('0x6a')]===''){throw _0x3ad9ff[_0x7995('0x27')](0x1f4)[_0x7995('0x33')](new db['Sequelize']['ValidationError'](_0x7995('0xdf')));}if(_[_0x7995('0x90')](_0x511628['body'][_0x7995('0xe0')])){throw _0x3ad9ff[_0x7995('0x27')](0x1f4)['send'](new db[(_0x7995('0xda'))][(_0x7995('0xdd'))](_0x7995('0xe1')+_0x2ace90));}if(!_[_0x7995('0xae')](_0x2ace90,_0x511628[_0x7995('0x6a')]['mapKeyOffline'])){throw _0x3ad9ff['status'](0x1f4)[_0x7995('0x33')](new db[(_0x7995('0xda'))][(_0x7995('0xdd'))](_0x7995('0xe2')+_0x2ace90));}_0x17570a[_0x511628[_0x7995('0x6a')]['mapKeyOffline']]=_0x511628[_0x7995('0x6a')][_0x7995('0xa2')];})[_0x7995('0x1d')](function(){return db[_0x7995('0x4e')][_0x7995('0x68')]({'where':{'id':_0x511628['params']['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db['MailAccount'],'as':_0x7995('0xe3')}]});})[_0x7995('0x1d')](handleEntityNotFound(_0x3ad9ff,null))['then'](function(_0x382bd9){if(_0x382bd9&&_0x382bd9[_0x7995('0xb1')]){_0x39f3d9=_0x382bd9;var _0x5e8551=_['defaults'](_0x511628[_0x7995('0x6a')],{'firstName':_0x511628[_0x7995('0x6a')][_0x7995('0xa2')],'phone':_0x511628[_0x7995('0x6a')][_0x7995('0xa2')],'ListId':_0x382bd9[_0x7995('0xad')]});_0x5e8551[_0x511628[_0x7995('0x6a')]['mapKeyOffline']]=_0x511628['body'][_0x7995('0xa2')];return db[_0x7995('0xa8')][_0x7995('0xe4')]({'where':_0x17570a,'defaults':_0x5e8551});}})['spread'](function(_0x2f96fd){if(_0x2f96fd){_0x2ec6c9=_0x2f96fd;var _0x39cc1a=fs[_0x7995('0xe5')](path[_0x7995('0x8a')](config[_0x7995('0x8b')],_0x7995('0xe6')),_0x7995('0xe7'));var _0x1b4cab=ejs[_0x7995('0xe8')](_0x39cc1a,{'body':_['toPairs'](_0x511628['body'][_0x7995('0x6a')]),'bodyTitle':_0x39f3d9['offlineMessageBody']});return db[_0x7995('0xe9')]['create']({'body':_0x1b4cab,'plainBody':htmlToText[_0x7995('0xea')](_0x1b4cab),'ContactId':_0x2f96fd['id'],'ChatWebsiteId':_0x39f3d9['id']});}})[_0x7995('0x1d')](function(_0x2ab61c){_0x234832=_0x2ab61c;if(_0x360022['length']){var _0x4c810d=_0x360022[_0x7995('0x51')](function(_0xff0ee8){return{'name':_0xff0ee8[_0x7995('0xeb')],'basename':_0xff0ee8[_0x7995('0x82')],'type':_0xff0ee8[_0x7995('0xec')],'ChatOfflineMessageId':_0x2ab61c['id']};});_0x88334d=_0x4c810d[_0x7995('0x51')](_0xb0164a=>{var _0x294b73={'filename':_0xb0164a[_0x7995('0x32')],'path':path[_0x7995('0x8a')](config[_0x7995('0x8b')],'server',_0x7995('0xed'),_0x7995('0xee'),_0x7995('0xef'),_0xb0164a[_0x7995('0xf0')])};return _0x294b73;});if(!_0x39f3d9[_0x7995('0xf1')]){return db['sequelize'][_0x7995('0xf2')](function(_0x44068f){return db[_0x7995('0xf3')][_0x7995('0xf4')](_0x4c810d,{'transaction':_0x44068f});});}}})[_0x7995('0x1d')](function(){if(_0x234832){_0x1a4919=_0x234832;return db[_0x7995('0xe3')][_0x7995('0x7a')]({'where':{'service':!![]},'include':[{'model':db[_0x7995('0xf5')],'as':_0x7995('0xf6'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0x7995('0x1d')](function(_0x127b80){if(_0x127b80&&_0x127b80[_0x7995('0xf6')]&&_0x39f3d9[_0x7995('0xf7')]&&_0x39f3d9[_0x7995('0xf8')]){var _0x498d7c=_0x127b80[_0x7995('0xf9')]();return respondWithRpcPromise(_0x7995('0xfa'),_0x7995('0xfb'),{'account':_0x498d7c,'message':{'from':util[_0x7995('0x45')](_0x7995('0xfc'),_0x127b80[_0x7995('0x32')],_0x127b80[_0x7995('0xfd')]||_0x127b80[_0x7995('0xf6')][_0x7995('0x71')]),'to':_0x39f3d9['forwardOfflineAddress'],'subject':_0x39f3d9['offlineMessageSubject'],'html':_0x1a4919[_0x7995('0x6a')],'attachments':_0x88334d}},client9003)[_0x7995('0x1d')](function(){return _0x1a4919;})[_0x7995('0x25')](function(_0x296643){logger[_0x7995('0x21')](_0x296643);});}})[_0x7995('0x1d')](function(){if(_0x39f3d9&&_0x39f3d9[_0x7995('0xf1')]&&_0x39f3d9[_0x7995('0xfe')]){var _0x5f100f=[];if(_0x360022['length']){_0x5f100f=_0x360022[_0x7995('0x51')](function(_0x386081){return{'name':_0x386081[_0x7995('0xeb')],'basename':_0x386081[_0x7995('0x82')],'type':_0x386081['mimetype'],'ChatOfflineMessageId':_0x234832['id']};});}var _0x580476;if(!_[_0x7995('0x90')](_0x39f3d9[_0x7995('0xff')])){var _0x2c8cd6=_[_0x7995('0x51')](_0x511628[_0x7995('0x6a')],function(_0x166566){return _0x166566;});var _0x127b5b=_[_0x7995('0x100')](_0x2c8cd6)[0x0];var _0x273283=_[_0x7995('0x101')](_0x127b5b,function(_0x1c2899){return _0x1c2899;});_0x580476=_0x273283[0x1][_0x39f3d9[_0x7995('0xff')]];}var _0x56809d={'from':_0x2ec6c9['email'],'firstName':_0x2ec6c9[_0x7995('0x3d')],'lastName':_0x2ec6c9[_0x7995('0x3e')],'mapKey':_0x7995('0xfd'),'message':{'from':_0x2ec6c9[_0x7995('0xfd')],'to':_0x39f3d9['MailAccount'][_0x7995('0xfd')],'cc':'','subject':_['isNil'](_0x580476)?_0x39f3d9[_0x7995('0x102')]:_0x580476,'messageId':'','sentAt':new Date(),'attach':_0x5f100f[_0x7995('0x57')],'attachments':_0x5f100f,'originChannel':_0x7995('0x103'),'ChatWebsiteId':_0x39f3d9['id'],'ChatOfflineMessageId':_0x1a4919['id'],'originTo':_0x39f3d9[_0x7995('0xe3')][_0x7995('0xfd')]},'body':_0x1a4919[_0x7995('0x6a')]};var _0x570408={'account':{'id':_0x39f3d9[_0x7995('0xfe')]},'body':_0x56809d,'log':_0x7995('0x104')};return respondWithRpcPromise(_0x7995('0x104'),_0x7995('0x105'),_0x570408,client9001)['then'](function(){return _0x1a4919;})['catch'](function(_0x43b9d6){logger[_0x7995('0x21')](_0x43b9d6);});}return;})[_0x7995('0x1d')](function(){if(_0x1a4919){return _0x1a4919;}})[_0x7995('0x1d')](respondWithResult(_0x3ad9ff,null))['catch'](function(){for(var _0x2958e9 of _0x360022){var _0x4e72=path[_0x7995('0x8a')](config['root'],_0x7995('0x106'),_0x7995('0xed'),_0x7995('0xee'),'offline-chat',_0x2958e9[_0x7995('0x82')]);fs_extra[_0x7995('0x107')](_0x4e72)[_0x7995('0x25')](function(_0x36778f){logger[_0x7995('0x21')](_0x7995('0x108'),_0x4e72,_0x36778f);});}});};exports[_0x7995('0x109')]=function(_0x2c8459,_0x3a285b){return db['ChatInteraction'][_0x7995('0x68')]({'where':{'id':_0x2c8459[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x3a285b,null))[_0x7995('0x1d')](function(_0x5eb18f){if(_0x5eb18f){return _0x5eb18f[_0x7995('0x109')](_0x2c8459[_0x7995('0x6a')][_0x7995('0x80')],_[_0x7995('0x10a')](_0x2c8459['body'],[_0x7995('0x80'),'id'])||{});}})[_0x7995('0x1d')](respondWithResult(_0x3a285b,null))[_0x7995('0x25')](handleError(_0x3a285b,null));};exports[_0x7995('0x10b')]=function(_0x3c711e,_0x126d6e){var _0x31dae8={'raw':![],'where':{}};var _0x5e3421={};var _0x1a4089={'count':0x0,'rows':[]};return db[_0x7995('0x4e')][_0x7995('0x7a')]({'where':{'id':_0x3c711e[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x126d6e,null))['then'](function(_0x1f915b){if(_0x1f915b){_0x5e3421['model']=_[_0x7995('0x52')](db[_0x7995('0xc5')][_0x7995('0x4f')]);_0x5e3421['query']=_['keys'](_0x3c711e['query']);_0x5e3421[_0x7995('0x5e')]=_[_0x7995('0x54')](_0x5e3421[_0x7995('0x49')],_0x5e3421[_0x7995('0x53')]);_0x31dae8[_0x7995('0x55')]=_[_0x7995('0x54')](_0x5e3421['model'],qs[_0x7995('0x56')](_0x3c711e[_0x7995('0x53')][_0x7995('0x56')]));_0x31dae8[_0x7995('0x55')]=_0x31dae8['attributes'][_0x7995('0x57')]?_0x31dae8[_0x7995('0x55')]:_0x5e3421['model'];if(!_0x3c711e[_0x7995('0x53')]['hasOwnProperty'](_0x7995('0x59'))){_0x31dae8[_0x7995('0x2a')]=qs[_0x7995('0x2a')](_0x3c711e['query']['limit']);_0x31dae8[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x3c711e[_0x7995('0x53')][_0x7995('0x2b')]);}_0x31dae8[_0x7995('0x5a')]=qs[_0x7995('0x5b')](_0x3c711e[_0x7995('0x53')][_0x7995('0x5b')]);_0x31dae8[_0x7995('0x5c')]=qs[_0x7995('0x5e')](_[_0x7995('0x5d')](_0x3c711e['query'],_0x5e3421['filters']));_0x31dae8[_0x7995('0x5c')][_0x7995('0x7d')]=_0x1f915b['id'];if(_0x3c711e[_0x7995('0x53')][_0x7995('0x60')]){_0x31dae8['where']=_['merge'](_0x31dae8[_0x7995('0x5c')],{'$or':_[_0x7995('0x51')](_0x31dae8['attributes'],function(_0x4d0036){var _0x952d6c={};_0x952d6c[_0x4d0036]={'$like':'%'+_0x3c711e[_0x7995('0x53')][_0x7995('0x60')]+'%'};return _0x952d6c;})});}_0x31dae8=_[_0x7995('0x61')]({},_0x31dae8,_0x3c711e[_0x7995('0x62')]);return db['ChatInteraction'][_0x7995('0x2c')]({'where':_0x31dae8[_0x7995('0x5c')]})['then'](function(_0xf9859c){_0x1a4089[_0x7995('0x2c')]=_0xf9859c;if(_0x3c711e[_0x7995('0x53')]['includeAll']){_0x31dae8[_0x7995('0x63')]=[{'model':db[_0x7995('0xa8')],'as':_0x7995('0x10c'),'required':![]},{'model':db[_0x7995('0xce')],'as':_0x7995('0x10d'),'attributes':['name','fullname',_0x7995('0x10e')],'required':![]},{'model':db['Tag'],'as':_0x7995('0x10f'),'attributes':['id','name',_0x7995('0x110')],'where':_0x3c711e[_0x7995('0x53')][_0x7995('0x111')]?{'id':_0x3c711e['query']['tag']}:undefined,'required':_0x3c711e['query'][_0x7995('0x111')]?!![]:![]}];}return db[_0x7995('0xc5')][_0x7995('0x64')](_0x31dae8);})['then'](function(_0x2a9738){_0x1a4089[_0x7995('0x7b')]=_0x2a9738;return _0x1a4089;});}})['then'](respondWithFilteredResult(_0x126d6e,_0x31dae8))[_0x7995('0x25')](handleError(_0x126d6e,null));};exports[_0x7995('0x112')]=function(_0x34350f,_0x108aeb){var _0x3a9c19=0x0;var _0x4b3aa3=0x0;var _0x5a6bb5=![];var _0x19cdd8;var _0x2d72c2;return db[_0x7995('0x4e')][_0x7995('0x68')]({'where':{'id':_0x34350f[_0x7995('0x66')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0x9c'),'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xb5'),'attributes':['id',_0x7995('0xb6')]}]}]})['then'](handleEntityNotFound(_0x108aeb,null))[_0x7995('0x1d')](function(_0x1faf9b){if(_0x1faf9b){_0x19cdd8=_0x1faf9b;return _0x1faf9b[_0x7995('0x113')]({'raw':!![]});}})[_0x7995('0x1d')](function(_0x39ee00){if(_0x19cdd8){if(_0x39ee00){_0x2d72c2=_0x39ee00;}}return require(_0x7995('0x8e'))[_0x7995('0x114')]();})['then'](function(_0x5d0fe6){if(_0x5d0fe6){_0x4b3aa3=_0x5d0fe6[_0x7995('0x115')];_0x5a6bb5=_0x5d0fe6[_0x7995('0x8f')];}})[_0x7995('0x1d')](function(){return db[_0x7995('0xc5')]['count']({'where':{'closed':![]}});})['then'](function(_0x4b477a){_0x3a9c19=_0x4b477a;if(_0x4b3aa3&&_0x4b477a>_0x4b3aa3){return db[_0x7995('0x116')][_0x7995('0x7a')]({'where':{'id':0x1}})['then'](function(_0x3f908e){if(_0x3f908e){_0x3f908e[_0x7995('0x117')](_0x7995('0x118'));}});}})[_0x7995('0x1d')](function(){var _0x13fc64=_0x19cdd8[_0x7995('0x9c')];var _0x35229d=_0x19cdd8[_0x7995('0x9e')]||undefined;return _0x13fc64?_0x13fc64['ifTime'](_0x35229d):!![];})[_0x7995('0x1d')](function(_0x13d525){var _0x37b7e7=fs['readFileSync'](path[_0x7995('0x8a')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x507bf3=_0x7995('0x119');var _0x4c64a8=![];var _0x296af1,_0x2e1466;if(_0x34350f['headers'][_0x7995('0x40')]){_0x296af1=new URL(_0x34350f[_0x7995('0x11a')][_0x7995('0x40')])[_0x7995('0x11b')];}else if(_0x34350f['headers'][_0x7995('0x11b')]){_0x296af1=new URL(_0x34350f['headers'][_0x7995('0x11b')])[_0x7995('0x11b')];}else{_0x296af1=_0x7995('0x11c');}_0x2e1466=typeof _0x19cdd8[_0x7995('0x6b')][_0x7995('0x3c')](',')[_0x7995('0x68')](function(_0x30d2af){return wildcardUtils[_0x7995('0x11d')](_0x30d2af,_0x296af1);})!==_0x7995('0x29');var _0x281839={'chatVersion':_0x507bf3,'chatWebsiteAddressOrigin':_0x2e1466?_0x296af1:_0x19cdd8['address'],'remote':_0x19cdd8[_0x7995('0x11e')],'query':querystring[_0x7995('0x11f')](_['merge'](_0x19cdd8[_0x7995('0x70')]({'plain':!![]}),{'customerIp':_0x34350f[_0x7995('0x11a')][_0x7995('0x3a')]||_0x34350f[_0x7995('0x11a')][_0x7995('0x120')]||_0x34350f[_0x7995('0x121')]['remoteAddress']||_0x34350f['ip'],'referer':_0x34350f[_0x7995('0x11a')]['referer'],'openedInteractions':_0x3a9c19,'maxInteractions':_0x4b3aa3,'virtual':_0x5a6bb5[_0x7995('0x115')],'online':_0x13d525,'custom':_0x5a6bb5,'address':_0x2e1466?_0x296af1:null}))[_0x7995('0x122')](/'/g,'\x5c\x27')};_0x108aeb[_0x7995('0x33')](ejs[_0x7995('0xe8')](Mustache[_0x7995('0xe8')](_0x37b7e7,_0x281839),{'proactiveActions':_0x2d72c2,'alignment':_0x19cdd8[_0x7995('0x123')],'verticalAlignment':_0x19cdd8['verticalAlignment'],'div_color':_0x19cdd8[_0x7995('0x110')],'labelText':_0x19cdd8[_0x7995('0x124')],'text_color':_0x19cdd8[_0x7995('0x125')],'text_button_color':_0x19cdd8['textButtonColor'],'button_color':_0x19cdd8[_0x7995('0x126')],'background_color':_0x19cdd8[_0x7995('0x127')],'hideWhenOffline':_0x19cdd8[_0x7995('0x128')],'intervalId':_0x19cdd8[_0x7995('0x129')],'isDevelopment':_0x4c64a8,'chatVersion':_0x507bf3}));})[_0x7995('0x25')](handleError(_0x108aeb,null));};exports[_0x7995('0x12a')]=function(_0x346f52,_0x204974){var _0x2c10fd=_0x346f52[_0x7995('0x66')]['id'];var _0xaafd4=_0x346f52['body'];var _0x125233=0xc8;var _0x131fdc=null;return db['sequelize'][_0x7995('0xf2')]({'isolationLevel':db[_0x7995('0x12b')][_0x7995('0x12c')][_0x7995('0x12d')][_0x7995('0x12e')]},function(_0x5a5cc4){return db[_0x7995('0x4e')][_0x7995('0x7a')]({'where':{'id':_0x2c10fd},'transaction':_0x5a5cc4})[_0x7995('0x1d')](function(_0x2da304){if(_0x2da304){return db[_0x7995('0xb3')][_0x7995('0x2f')]({'where':{'ChatWebsiteId':_0x2c10fd},'transaction':_0x5a5cc4})[_0x7995('0x1d')](function(){var _0x3404a1=_[_0x7995('0x51')](_0xaafd4,function(_0x363e3b){_0x363e3b[_0x7995('0x7d')]=_0x2c10fd;return _0x363e3b;});return db[_0x7995('0xb3')][_0x7995('0xf4')](_0x3404a1,{'transaction':_0x5a5cc4});});}else{_0x125233=0x194;_0x131fdc=[];}});})['then'](function(){if(_0x125233!==0x194){return db[_0x7995('0xb3')][_0x7995('0x12f')]({'where':{'ChatWebsiteId':_0x2c10fd},'order':_0x7995('0xba')})[_0x7995('0x1d')](function(_0x4f9d28){_0x131fdc=_0x4f9d28;});}})[_0x7995('0x25')](function(_0x1d07e2){_0x125233=0x1f4;logger[_0x7995('0x21')](_0x1d07e2[_0x7995('0x130')]);if(_0x1d07e2[_0x7995('0x32')]){delete _0x1d07e2[_0x7995('0x32')];}_0x131fdc=_0x1d07e2;})[_0x7995('0x131')](function(){if(_0x131fdc===null){_0x204974['sendStatus'](_0x125233);}else{if(_0x125233===0x1f4){_0x204974[_0x7995('0x27')](_0x125233)['send'](_0x131fdc);}else{_0x204974[_0x7995('0x27')](_0x125233)[_0x7995('0x28')](_0x131fdc);}}});};exports[_0x7995('0x132')]=function(_0x491694,_0x4d13c0){var _0x26c46c={};var _0x2802cf={};var _0x4071bf;var _0x54a8ac;return db[_0x7995('0x4e')]['findOne']({'where':{'id':_0x491694[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x4d13c0,null))[_0x7995('0x1d')](function(_0x35ee8c){if(_0x35ee8c){_0x4071bf=_0x35ee8c;_0x2802cf[_0x7995('0x49')]=_[_0x7995('0x52')](db['ChatApplication'][_0x7995('0x4f')]);_0x2802cf[_0x7995('0x53')]=_['keys'](_0x491694[_0x7995('0x53')]);_0x2802cf[_0x7995('0x5e')]=_[_0x7995('0x54')](_0x2802cf[_0x7995('0x49')],_0x2802cf[_0x7995('0x53')]);_0x26c46c[_0x7995('0x55')]=_[_0x7995('0x54')](_0x2802cf[_0x7995('0x49')],qs[_0x7995('0x56')](_0x491694[_0x7995('0x53')][_0x7995('0x56')]));_0x26c46c[_0x7995('0x55')]=_0x26c46c[_0x7995('0x55')][_0x7995('0x57')]?_0x26c46c[_0x7995('0x55')]:_0x2802cf[_0x7995('0x49')];_0x26c46c[_0x7995('0x5a')]=qs['sort'](_0x491694['query'][_0x7995('0x5b')]);_0x26c46c[_0x7995('0x5c')]=qs['filters'](_[_0x7995('0x5d')](_0x491694[_0x7995('0x53')],_0x2802cf['filters']));if(_0x491694['query'][_0x7995('0x60')]){_0x26c46c[_0x7995('0x5c')]=_[_0x7995('0x61')](_0x26c46c[_0x7995('0x5c')],{'$or':_[_0x7995('0x51')](_0x26c46c[_0x7995('0x55')],function(_0x1b3920){var _0x3212a3={};_0x3212a3[_0x1b3920]={'$like':'%'+_0x491694[_0x7995('0x53')][_0x7995('0x60')]+'%'};return _0x3212a3;})});}_0x26c46c=_['merge']({},_0x26c46c,_0x491694[_0x7995('0x62')]);return _0x4071bf[_0x7995('0x132')](_0x26c46c);}})[_0x7995('0x1d')](function(_0x16df00){if(_0x16df00){_0x54a8ac=_0x16df00[_0x7995('0x57')];if(!_0x491694[_0x7995('0x53')][_0x7995('0x58')]('nolimit')){_0x26c46c[_0x7995('0x2a')]=qs[_0x7995('0x2a')](_0x491694[_0x7995('0x53')]['limit']);_0x26c46c[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x491694[_0x7995('0x53')][_0x7995('0x2b')]);}return _0x4071bf[_0x7995('0x132')](_0x26c46c);}})[_0x7995('0x1d')](function(_0x5dc448){if(_0x5dc448){return _0x5dc448?{'count':_0x54a8ac,'rows':_0x5dc448}:null;}})[_0x7995('0x1d')](respondWithResult(_0x4d13c0,null))['catch'](handleError(_0x4d13c0,null));};exports[_0x7995('0x133')]=function(_0x226991,_0x36f8a1){return db['chatProactiveAction']['find']({'where':{'id':_0x226991[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x36f8a1,null))[_0x7995('0x1d')](function(_0x586439){if(_0x586439){return _0x586439[_0x7995('0x133')](_0x226991[_0x7995('0x6a')][_0x7995('0x80')],_[_0x7995('0x10a')](_0x226991[_0x7995('0x6a')],['ids','id'])||{});}})[_0x7995('0x1d')](respondWithResult(_0x36f8a1,null))[_0x7995('0x25')](handleError(_0x36f8a1,null));};exports[_0x7995('0x113')]=function(_0x24d374,_0x132c1a){var _0x3366f7={};var _0x3e452b={};var _0x2436d7;var _0x4b9dd3;return db['ChatWebsite'][_0x7995('0x7a')]({'where':{'id':_0x24d374['params']['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x132c1a,null))[_0x7995('0x1d')](function(_0x47659d){if(_0x47659d){_0x2436d7=_0x47659d;_0x3e452b['model']=_['keys'](db['ChatProactiveAction'][_0x7995('0x4f')]);_0x3e452b[_0x7995('0x53')]=_[_0x7995('0x52')](_0x24d374[_0x7995('0x53')]);_0x3e452b[_0x7995('0x5e')]=_[_0x7995('0x54')](_0x3e452b[_0x7995('0x49')],_0x3e452b[_0x7995('0x53')]);_0x3366f7['attributes']=_['intersection'](_0x3e452b['model'],qs[_0x7995('0x56')](_0x24d374['query']['fields']));_0x3366f7['attributes']=_0x3366f7[_0x7995('0x55')][_0x7995('0x57')]?_0x3366f7[_0x7995('0x55')]:_0x3e452b[_0x7995('0x49')];_0x3366f7[_0x7995('0x5a')]=qs['sort'](_0x24d374[_0x7995('0x53')]['sort']);_0x3366f7[_0x7995('0x5c')]=qs[_0x7995('0x5e')](_[_0x7995('0x5d')](_0x24d374[_0x7995('0x53')],_0x3e452b[_0x7995('0x5e')]));if(_0x24d374[_0x7995('0x53')][_0x7995('0x60')]){_0x3366f7[_0x7995('0x5c')]=_['merge'](_0x3366f7[_0x7995('0x5c')],{'$or':_[_0x7995('0x51')](_0x3366f7['attributes'],function(_0x198ba5){var _0x328677={};_0x328677[_0x198ba5]={'$like':'%'+_0x24d374[_0x7995('0x53')][_0x7995('0x60')]+'%'};return _0x328677;})});}_0x3366f7=_[_0x7995('0x61')]({},_0x3366f7,_0x24d374[_0x7995('0x62')]);return _0x2436d7[_0x7995('0x113')](_0x3366f7);}})[_0x7995('0x1d')](function(_0x423751){if(_0x423751){_0x4b9dd3=_0x423751['length'];if(!_0x24d374['query']['hasOwnProperty'](_0x7995('0x59'))){_0x3366f7[_0x7995('0x2a')]=qs['limit'](_0x24d374['query']['limit']);_0x3366f7[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x24d374['query'][_0x7995('0x2b')]);}return _0x2436d7[_0x7995('0x113')](_0x3366f7);}})[_0x7995('0x1d')](function(_0x349351){if(_0x349351){return _0x349351?{'count':_0x4b9dd3,'rows':_0x349351}:null;}})['then'](respondWithResult(_0x132c1a,null))[_0x7995('0x25')](handleError(_0x132c1a,null));};exports['getFields']=function(_0x463f2c,_0x47ecf5){var _0x2ea80c=_0x463f2c[_0x7995('0x53')]['online']===_0x7995('0x134')?'offlineForm':_0x7995('0x135');return db[_0x7995('0x4e')][_0x7995('0x68')]({'attributes':['id',_0x2ea80c],'where':{'id':_0x463f2c[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x47ecf5,null))[_0x7995('0x1d')](function(_0x4a27e7){if(_0x4a27e7){var _0x58aa57=_0x4a27e7[_0x2ea80c];var _0x5b4201=_0x58aa57&&_0x58aa57['items']?_0x58aa57[_0x7995('0x136')]:[];_0x47ecf5['send']({'fromKey':_[_0x7995('0x90')](_0x58aa57[_0x7995('0x137')])?undefined:_0x58aa57['fromKey'],'count':_0x5b4201[_0x7995('0x57')],'rows':_0x5b4201});}})['catch'](handleError(_0x47ecf5,null));};exports[_0x7995('0x138')]=function(_0x5a0510,_0x3d9091){var _0x385396={'raw':![],'where':{}};var _0x3e86a9={};var _0x219fa6={'count':0x0,'rows':[]};return db[_0x7995('0x4e')][_0x7995('0x7a')]({'where':{'id':_0x5a0510[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x3d9091,null))[_0x7995('0x1d')](function(_0x4092e2){if(_0x4092e2){_0x3e86a9[_0x7995('0x49')]=_[_0x7995('0x52')](db[_0x7995('0xe9')][_0x7995('0x4f')]);_0x3e86a9[_0x7995('0x53')]=_[_0x7995('0x52')](_0x5a0510[_0x7995('0x53')]);_0x3e86a9['filters']=_[_0x7995('0x54')](_0x3e86a9[_0x7995('0x49')],_0x3e86a9[_0x7995('0x53')]);_0x385396['attributes']=_[_0x7995('0x54')](_0x3e86a9['model'],qs[_0x7995('0x56')](_0x5a0510[_0x7995('0x53')][_0x7995('0x56')]));_0x385396[_0x7995('0x55')]=_0x385396['attributes'][_0x7995('0x57')]?_0x385396[_0x7995('0x55')]:_0x3e86a9['model'];if(!_0x5a0510['query']['hasOwnProperty'](_0x7995('0x59'))){_0x385396[_0x7995('0x2a')]=qs['limit'](_0x5a0510[_0x7995('0x53')]['limit']);_0x385396[_0x7995('0x2b')]=qs['offset'](_0x5a0510[_0x7995('0x53')][_0x7995('0x2b')]);}_0x385396['order']=qs['sort'](_0x5a0510[_0x7995('0x53')][_0x7995('0x5b')]);_0x385396[_0x7995('0x5c')]=qs['filters'](_[_0x7995('0x5d')](_0x5a0510[_0x7995('0x53')],_0x3e86a9[_0x7995('0x5e')]));_0x385396[_0x7995('0x5c')][_0x7995('0x7d')]=_0x4092e2['id'];if(_0x5a0510[_0x7995('0x53')][_0x7995('0x60')]){_0x385396[_0x7995('0x5c')]=_[_0x7995('0x61')](_0x385396['where'],{'$or':_[_0x7995('0x51')](_0x385396[_0x7995('0x55')],function(_0x1ca931){var _0x4fb2af={};_0x4fb2af[_0x1ca931]={'$like':'%'+_0x5a0510[_0x7995('0x53')][_0x7995('0x60')]+'%'};return _0x4fb2af;})});}_0x385396=_['merge']({},_0x385396,_0x5a0510['options']);return db[_0x7995('0xe9')][_0x7995('0x2c')]({'where':_0x385396['where']})[_0x7995('0x1d')](function(_0x23b296){_0x219fa6['count']=_0x23b296;if(_0x5a0510[_0x7995('0x53')][_0x7995('0x67')]){_0x385396['include']=[{'all':!![]}];}else{_0x385396[_0x7995('0x63')]=[{'model':db[_0x7995('0xa8')],'as':_0x7995('0x10c'),'required':![]},{'model':db[_0x7995('0xf3')],'as':_0x7995('0x139'),'required':![]}];}return db[_0x7995('0xe9')][_0x7995('0x64')](_0x385396);})[_0x7995('0x1d')](function(_0x3ea53f){_0x219fa6[_0x7995('0x7b')]=_0x3ea53f;return _0x219fa6;});}})[_0x7995('0x1d')](respondWithFilteredResult(_0x3d9091,_0x385396))['catch'](handleError(_0x3d9091,null));};exports[_0x7995('0x13a')]=function(_0x318bf0,_0x80caf9){return db[_0x7995('0x4e')][_0x7995('0x68')]({'where':{'id':_0x318bf0[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x80caf9,null))[_0x7995('0x1d')](function(_0x3f3d05){if(_0x3f3d05){return _0x3f3d05[_0x7995('0x13a')](_0x318bf0[_0x7995('0x6a')]['ids'],_[_0x7995('0x10a')](_0x318bf0['body'],['ids','id'])||{})[_0x7995('0x13b')](function(_0x39394e){for(var _0x256c33=0x0;_0x256c33<_0x318bf0['body'][_0x7995('0x80')]['length'];_0x256c33+=0x1){socket[_0x7995('0x13c')](_0x7995('0x13d'),{'UserId':Number(_0x318bf0[_0x7995('0x6a')]['ids'][_0x256c33]),'ChatWebsiteId':Number(_0x318bf0[_0x7995('0x66')]['id'])});}return _0x39394e;});}})[_0x7995('0x1d')](respondWithResult(_0x80caf9,null))['catch'](handleError(_0x80caf9,null));};exports['removeAgents']=function(_0xfae12b,_0x22750a){return db[_0x7995('0x4e')][_0x7995('0x68')]({'where':{'id':_0xfae12b[_0x7995('0x66')]['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x22750a,null))[_0x7995('0x1d')](function(_0x456dc7){if(_0x456dc7){return _0x456dc7[_0x7995('0x13e')](_0xfae12b['query']['ids'])['then'](function(){if(_[_0x7995('0x13f')](_0xfae12b[_0x7995('0x53')]['ids'])){for(var _0x3a5d1f=0x0;_0x3a5d1f<_0xfae12b[_0x7995('0x53')][_0x7995('0x80')][_0x7995('0x57')];_0x3a5d1f+=0x1){socket[_0x7995('0x13c')](_0x7995('0x140'),{'UserId':Number(_0xfae12b[_0x7995('0x53')][_0x7995('0x80')][_0x3a5d1f]),'ChatWebsiteId':Number(_0xfae12b[_0x7995('0x66')]['id'])});}}else{socket[_0x7995('0x13c')](_0x7995('0x140'),{'UserId':Number(_0xfae12b[_0x7995('0x53')][_0x7995('0x80')]),'ChatWebsiteId':Number(_0xfae12b['params']['id'])});}});}})['then'](respondWithStatusCode(_0x22750a,null))[_0x7995('0x25')](handleError(_0x22750a,null));};exports['getAgents']=function(_0x5d1bbe,_0x4d2868){var _0x465147={};var _0x3aced8={};var _0x52c6ce;var _0x440306;return db[_0x7995('0x4e')][_0x7995('0x7a')]({'where':{'id':_0x5d1bbe['params']['id']}})[_0x7995('0x1d')](handleEntityNotFound(_0x4d2868,null))[_0x7995('0x1d')](function(_0x4a53f8){if(_0x4a53f8){_0x52c6ce=_0x4a53f8;_0x3aced8['model']=_[_0x7995('0x52')](db[_0x7995('0xce')]['rawAttributes']);_0x3aced8[_0x7995('0x53')]=_[_0x7995('0x52')](_0x5d1bbe[_0x7995('0x53')]);_0x3aced8[_0x7995('0x5e')]=_['intersection'](_0x3aced8[_0x7995('0x49')],_0x3aced8[_0x7995('0x53')]);_0x465147['attributes']=_[_0x7995('0x54')](_0x3aced8[_0x7995('0x49')],qs['fields'](_0x5d1bbe[_0x7995('0x53')][_0x7995('0x56')]));_0x465147[_0x7995('0x55')]=_0x465147[_0x7995('0x55')][_0x7995('0x57')]?_0x465147[_0x7995('0x55')]:_0x3aced8['model'];_0x465147[_0x7995('0x5a')]=qs['sort'](_0x5d1bbe[_0x7995('0x53')][_0x7995('0x5b')]);_0x465147[_0x7995('0x5c')]=qs[_0x7995('0x5e')](_[_0x7995('0x5d')](_0x5d1bbe[_0x7995('0x53')],_0x3aced8['filters']));if(_0x5d1bbe[_0x7995('0x53')][_0x7995('0x60')]){_0x465147[_0x7995('0x5c')]=_[_0x7995('0x61')](_0x465147['where'],{'$or':_[_0x7995('0x51')](_0x465147[_0x7995('0x55')],function(_0x21a1e0){var _0x319cf9={};_0x319cf9[_0x21a1e0]={'$like':'%'+_0x5d1bbe[_0x7995('0x53')][_0x7995('0x60')]+'%'};return _0x319cf9;})});}_0x465147=_[_0x7995('0x61')]({},_0x465147,_0x5d1bbe[_0x7995('0x62')]);return _0x52c6ce[_0x7995('0x141')](_0x465147);}})[_0x7995('0x1d')](function(_0x5dc2aa){if(_0x5dc2aa){_0x440306=_0x5dc2aa[_0x7995('0x57')];if(!_0x5d1bbe[_0x7995('0x53')]['hasOwnProperty'](_0x7995('0x59'))){_0x465147[_0x7995('0x2a')]=qs[_0x7995('0x2a')](_0x5d1bbe[_0x7995('0x53')][_0x7995('0x2a')]);_0x465147[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x5d1bbe['query']['offset']);}return _0x52c6ce[_0x7995('0x141')](_0x465147);}})[_0x7995('0x1d')](function(_0x2097f0){if(_0x2097f0){return _0x2097f0?{'count':_0x440306,'rows':_0x2097f0}:null;}})[_0x7995('0x1d')](respondWithResult(_0x4d2868,null))[_0x7995('0x25')](handleError(_0x4d2868,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 785879a..0922672 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 _0xbeea=['emit','exports','events','ChatWebsite','setMaxListeners','save','remove'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbeea,0xb1));var _0xabee=function(_0x1a2674,_0x247245){_0x1a2674=_0x1a2674-0x0;var _0x14ca43=_0xbeea[_0x1a2674];return _0x14ca43;};'use strict';var EventEmitter=require(_0xabee('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xabee('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xabee('0x2')](0x0);var events={'afterCreate':_0xabee('0x3'),'afterUpdate':'update','afterDestroy':_0xabee('0x4')};function emitEvent(_0x59e264){return function(_0x58afa7,_0x33571e,_0x2fb6d9){ChatWebsiteEvents[_0xabee('0x5')](_0x59e264+':'+_0x58afa7['id'],_0x58afa7);ChatWebsiteEvents[_0xabee('0x5')](_0x59e264,_0x58afa7);_0x2fb6d9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xabee('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0xbc8d=['emit','hasOwnProperty','exports','events','ChatWebsite','setMaxListeners','save','update'];(function(_0x127796,_0xd2a09b){var _0x2113eb=function(_0x34f9ef){while(--_0x34f9ef){_0x127796['push'](_0x127796['shift']());}};_0x2113eb(++_0xd2a09b);}(_0xbc8d,0x15b));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xdbc8('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xdbc8('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xdbc8('0x2')](0x0);var events={'afterCreate':_0xdbc8('0x3'),'afterUpdate':_0xdbc8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x287649){return function(_0x172112,_0x2dd539,_0x4e8c02){ChatWebsiteEvents[_0xdbc8('0x5')](_0x287649+':'+_0x172112['id'],_0x172112);ChatWebsiteEvents[_0xdbc8('0x5')](_0x287649,_0x172112);_0x4e8c02(null);};}for(var e in events){if(events[_0xdbc8('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xdbc8('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index ff3210a..169cae9 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 _0xda1e=['rimraf','exports','define','ChatWebsite','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x46a3ff,_0x470b9a){var _0x404bc2=function(_0x20f25f){while(--_0x20f25f){_0x46a3ff['push'](_0x46a3ff['shift']());}};_0x404bc2(++_0x470b9a);}(_0xda1e,0x130));var _0xeda1=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xda1e[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0xeda1('0x0'));var util=require(_0xeda1('0x1'));var logger=require(_0xeda1('0x2'))(_0xeda1('0x3'));var moment=require(_0xeda1('0x4'));var BPromise=require('bluebird');var rp=require(_0xeda1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeda1('0x6'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module[_0xeda1('0x7')]=function(_0x14f1f4,_0x5a1276){return _0x14f1f4[_0xeda1('0x8')](_0xeda1('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77f1=['define','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x30126e,_0x17339f){var _0x56ee2c=function(_0xc1dd88){while(--_0xc1dd88){_0x30126e['push'](_0x30126e['shift']());}};_0x56ee2c(++_0x17339f);}(_0x77f1,0x10b));var _0x177f=function(_0x44cfab,_0x599f0b){_0x44cfab=_0x44cfab-0x0;var _0x5cdb3b=_0x77f1[_0x44cfab];return _0x5cdb3b;};'use strict';var _=require(_0x177f('0x0'));var util=require('util');var logger=require(_0x177f('0x1'))(_0x177f('0x2'));var moment=require(_0x177f('0x3'));var BPromise=require('bluebird');var rp=require(_0x177f('0x4'));var fs=require('fs');var path=require(_0x177f('0x5'));var rimraf=require(_0x177f('0x6'));var config=require(_0x177f('0x7'));var attributes=require('./chatWebsite.attributes');module[_0x177f('0x8')]=function(_0x12828d,_0x11cac8){return _0x12828d[_0x177f('0x9')](_0x177f('0xa'),attributes,{'tableName':_0x177f('0xb'),'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 ca4aa91..6c8e050 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 _0xd9a7=['debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent'];(function(_0x77fcad,_0xeebb41){var _0x3d032e=function(_0x4f8c99){while(--_0x4f8c99){_0x77fcad['push'](_0x77fcad['shift']());}};_0x3d032e(++_0xeebb41);}(_0xd9a7,0x70));var _0x7d9a=function(_0xee2e7a,_0x58354d){_0xee2e7a=_0xee2e7a-0x0;var _0x319dd3=_0xd9a7[_0xee2e7a];return _0x319dd3;};'use strict';var _=require(_0x7d9a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7d9a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d9a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7d9a('0x3'));var logger=require(_0x7d9a('0x4'))(_0x7d9a('0x5'));var config=require(_0x7d9a('0x6'));var jayson=require(_0x7d9a('0x7'));var client=jayson['client'][_0x7d9a('0x8')]({'port':0x232a});config[_0x7d9a('0x9')]=_[_0x7d9a('0xa')](config[_0x7d9a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7d9a('0xb'))(new Redis(config[_0x7d9a('0x9')]));require(_0x7d9a('0xc'))[_0x7d9a('0xd')](socket);function respondWithRpcPromise(_0x2dfdf3,_0x57a724,_0x3d53a1){return new BPromise(function(_0x484e9d,_0x407134){return client[_0x7d9a('0xe')](_0x2dfdf3,_0x3d53a1)[_0x7d9a('0xf')](function(_0x23e6fc){logger['info'](_0x7d9a('0x10'),_0x57a724,_0x7d9a('0x11'));logger[_0x7d9a('0x12')](_0x7d9a('0x13'),_0x57a724,'request\x20sent',JSON[_0x7d9a('0x14')](_0x23e6fc));if(_0x23e6fc[_0x7d9a('0x15')]){if(_0x23e6fc[_0x7d9a('0x15')]['code']===0x1f4){logger[_0x7d9a('0x15')](_0x7d9a('0x10'),_0x57a724,_0x23e6fc[_0x7d9a('0x15')][_0x7d9a('0x16')]);return _0x407134(_0x23e6fc[_0x7d9a('0x15')][_0x7d9a('0x16')]);}logger[_0x7d9a('0x15')](_0x7d9a('0x10'),_0x57a724,_0x23e6fc[_0x7d9a('0x15')]['message']);return _0x484e9d(_0x23e6fc['error']['message']);}else{logger[_0x7d9a('0x17')](_0x7d9a('0x10'),_0x57a724,'request\x20sent');_0x484e9d(_0x23e6fc[_0x7d9a('0x18')]['message']);}})[_0x7d9a('0x19')](function(_0x59e6b2){logger[_0x7d9a('0x15')](_0x7d9a('0x10'),_0x57a724,_0x59e6b2);_0x407134(_0x59e6b2);});});} \ No newline at end of file +var _0x80ea=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','moment','bluebird','ioredis'];(function(_0x5418ad,_0x40742f){var _0x2cae56=function(_0x36d317){while(--_0x36d317){_0x5418ad['push'](_0x5418ad['shift']());}};_0x2cae56(++_0x40742f);}(_0x80ea,0x7f));var _0xa80e=function(_0x5e2ea7,_0x1f6528){_0x5e2ea7=_0x5e2ea7-0x0;var _0x51d948=_0x80ea[_0x5e2ea7];return _0x51d948;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa80e('0x0'));var BPromise=require(_0xa80e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa80e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa80e('0x3'));var logger=require(_0xa80e('0x4'))(_0xa80e('0x5'));var config=require(_0xa80e('0x6'));var jayson=require(_0xa80e('0x7'));var client=jayson[_0xa80e('0x8')][_0xa80e('0x9')]({'port':0x232a});config[_0xa80e('0xa')]=_[_0xa80e('0xb')](config[_0xa80e('0xa')],{'host':_0xa80e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa80e('0xa')]));require(_0xa80e('0xd'))[_0xa80e('0xe')](socket);function respondWithRpcPromise(_0x5c7259,_0x1b747d,_0x30c197){return new BPromise(function(_0x3eabc6,_0x48884c){return client[_0xa80e('0xf')](_0x5c7259,_0x30c197)[_0xa80e('0x10')](function(_0x357912){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1b747d,_0xa80e('0x11'));logger[_0xa80e('0x12')](_0xa80e('0x13'),_0x1b747d,_0xa80e('0x11'),JSON[_0xa80e('0x14')](_0x357912));if(_0x357912['error']){if(_0x357912[_0xa80e('0x15')][_0xa80e('0x16')]===0x1f4){logger[_0xa80e('0x15')](_0xa80e('0x17'),_0x1b747d,_0x357912[_0xa80e('0x15')][_0xa80e('0x18')]);return _0x48884c(_0x357912[_0xa80e('0x15')][_0xa80e('0x18')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1b747d,_0x357912[_0xa80e('0x15')]['message']);return _0x3eabc6(_0x357912['error'][_0xa80e('0x18')]);}else{logger['info'](_0xa80e('0x17'),_0x1b747d,_0xa80e('0x11'));_0x3eabc6(_0x357912['result'][_0xa80e('0x18')]);}})[_0xa80e('0x19')](function(_0x5def6b){logger[_0xa80e('0x15')](_0xa80e('0x17'),_0x1b747d,_0x5def6b);_0x48884c(_0x5def6b);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 16df4b4..c6f4f67 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 _0x25f3=['remove','update','removeListener','register','length'];(function(_0x5cb366,_0x2a3d54){var _0x4358cd=function(_0x1b1856){while(--_0x1b1856){_0x5cb366['push'](_0x5cb366['shift']());}};_0x4358cd(++_0x2a3d54);}(_0x25f3,0x15e));var _0x325f=function(_0x37814b,_0x38825b){_0x37814b=_0x37814b-0x0;var _0x482ed4=_0x25f3[_0x37814b];return _0x482ed4;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save',_0x325f('0x0'),_0x325f('0x1')];function createListener(_0x1484bb,_0x1fd755){return function(_0x3dfe7b){_0x1fd755['emit'](_0x1484bb,_0x3dfe7b);};}function removeListener(_0x407541,_0x39132b){return function(){ChatWebsiteEvents[_0x325f('0x2')](_0x407541,_0x39132b);};}exports[_0x325f('0x3')]=function(_0x299baf){for(var _0x16275e=0x0,_0x52333e=events[_0x325f('0x4')];_0x16275e<_0x52333e;_0x16275e++){var _0x524415=events[_0x16275e];var _0x1cdfdf=createListener('chatWebsite:'+_0x524415,_0x299baf);ChatWebsiteEvents['on'](_0x524415,_0x1cdfdf);}}; \ No newline at end of file +var _0xee87=['length','chatWebsite:','./chatWebsite.events','save','removeListener','register'];(function(_0x46dbc2,_0x276ffd){var _0xd57d08=function(_0x4da39c){while(--_0x4da39c){_0x46dbc2['push'](_0x46dbc2['shift']());}};_0xd57d08(++_0x276ffd);}(_0xee87,0x68));var _0x7ee8=function(_0x146a84,_0x5b5a25){_0x146a84=_0x146a84-0x0;var _0x496ac4=_0xee87[_0x146a84];return _0x496ac4;};'use strict';var ChatWebsiteEvents=require(_0x7ee8('0x0'));var events=[_0x7ee8('0x1'),'remove','update'];function createListener(_0xbdef93,_0x574d3d){return function(_0x37e951){_0x574d3d['emit'](_0xbdef93,_0x37e951);};}function removeListener(_0x18429f,_0x1197d9){return function(){ChatWebsiteEvents[_0x7ee8('0x2')](_0x18429f,_0x1197d9);};}exports[_0x7ee8('0x3')]=function(_0x487856){for(var _0x1ab390=0x0,_0x524464=events[_0x7ee8('0x4')];_0x1ab390<_0x524464;_0x1ab390++){var _0x581911=events[_0x1ab390];var _0x825645=createListener(_0x7ee8('0x5')+_0x581911,_0x487856);ChatWebsiteEvents['on'](_0x581911,_0x825645);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 3cf5b8c..b2f1a17 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd906=['([\x5cw]+)','exports','url','URL','replace','test','trim'];(function(_0x147fcb,_0x362d59){var _0x2297d2=function(_0x351eb9){while(--_0x351eb9){_0x147fcb['push'](_0x147fcb['shift']());}};_0x2297d2(++_0x362d59);}(_0xd906,0x6b));var _0x6d90=function(_0x5d6690,_0x29105c){_0x5d6690=_0x5d6690-0x0;var _0x1293fe=_0xd906[_0x5d6690];return _0x1293fe;};var escapeRegExp=require('../../../utils/misc')['escapeRegExp'];var URL=require(_0x6d90('0x0'))[_0x6d90('0x1')];function testWildcardValidity(_0xa9235a){var _0x149952=!![];try{new URL(_0xa9235a[_0x6d90('0x2')]('*','localhost'));}catch(_0x2ae140){_0x149952=![];}return _0x149952&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x6d90('0x3')](_0xa9235a);}function testWebsiteWithWildcard(_0x132c67,_0xe3335c){var _0x4fa119;var _0x8ee191=escapeRegExp(_0x132c67[_0x6d90('0x4')]()[_0x6d90('0x2')](/\/$/,''))[_0x6d90('0x2')]('\x5c*',_0x6d90('0x5'));try{new URL(_0x132c67['replace']('\x5c*','localhost'));_0x4fa119=new RegExp(_0x8ee191)['test'](_0xe3335c);}catch(_0x41c0a3){_0x4fa119=![];}return _0x4fa119;}module[_0x6d90('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x24bb=['test','exports','../../../utils/misc','url','localhost','replace','([\x5cw]+)'];(function(_0x1dece9,_0x2cd405){var _0x449378=function(_0x13b0ec){while(--_0x13b0ec){_0x1dece9['push'](_0x1dece9['shift']());}};_0x449378(++_0x2cd405);}(_0x24bb,0x19f));var _0xb24b=function(_0x35d182,_0x546ed3){_0x35d182=_0x35d182-0x0;var _0x4eb48a=_0x24bb[_0x35d182];return _0x4eb48a;};var escapeRegExp=require(_0xb24b('0x0'))['escapeRegExp'];var URL=require(_0xb24b('0x1'))['URL'];function testWildcardValidity(_0x2f062f){var _0x10f8ed=!![];try{new URL(_0x2f062f['replace']('*',_0xb24b('0x2')));}catch(_0x48ff68){_0x10f8ed=![];}return _0x10f8ed&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x2f062f);}function testWebsiteWithWildcard(_0x2af39f,_0x4062b5){var _0x45588a;var _0x51e19e=escapeRegExp(_0x2af39f['trim']()[_0xb24b('0x3')](/\/$/,''))[_0xb24b('0x3')]('\x5c*',_0xb24b('0x4'));try{new URL(_0x2af39f[_0xb24b('0x3')]('\x5c*',_0xb24b('0x2')));_0x45588a=new RegExp(_0x51e19e)[_0xb24b('0x5')](_0x4062b5);}catch(_0x268f76){_0x45588a=![];}return _0x45588a;}module[_0xb24b('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7c7fd16..f5e4acf 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 _0x40c7=['getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','join','root','%s-%s','now','originalname','single','file','addLogo','diskStorage','server/files/images/avatars/','format','/:id/customer_avatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','getSystemAvatar','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields'];(function(_0x4ebb4c,_0x433c5e){var _0x3beea0=function(_0xc62a4){while(--_0xc62a4){_0x4ebb4c['push'](_0x4ebb4c['shift']());}};_0x3beea0(++_0x433c5e);}(_0x40c7,0x73));var _0x740c=function(_0xe59443,_0x1c7fbc){_0xe59443=_0xe59443-0x0;var _0x155142=_0x40c7[_0xe59443];return _0x155142;};'use strict';var multer=require(_0x740c('0x0'));var util=require(_0x740c('0x1'));var path=require(_0x740c('0x2'));var timeout=require(_0x740c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x740c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x740c('0x5'));var config=require('../../config/environment');var controller=require(_0x740c('0x6'));router[_0x740c('0x7')]('/',auth[_0x740c('0x8')](),controller[_0x740c('0x9')]);router[_0x740c('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x740c('0x7')](_0x740c('0xa'),auth[_0x740c('0x8')](),controller[_0x740c('0xb')]);router[_0x740c('0x7')](_0x740c('0xc'),auth[_0x740c('0x8')](),controller[_0x740c('0xd')]);router[_0x740c('0x7')](_0x740c('0xe'),auth[_0x740c('0x8')](),controller['getAnswers']);router[_0x740c('0x7')](_0x740c('0xf'),controller[_0x740c('0x10')]);router[_0x740c('0x7')](_0x740c('0x11'),controller[_0x740c('0x12')]);router[_0x740c('0x7')]('/:id/customer_avatar',controller[_0x740c('0x13')]);router[_0x740c('0x7')]('/:id/system_avatar',controller[_0x740c('0x14')]);router[_0x740c('0x7')]('/:id/interactions',auth[_0x740c('0x8')](),controller[_0x740c('0x15')]);router['get']('/:id/snippet',controller[_0x740c('0x16')]);router[_0x740c('0x7')](_0x740c('0x17'),auth[_0x740c('0x8')](),controller[_0x740c('0x18')]);router[_0x740c('0x7')](_0x740c('0x19'),auth[_0x740c('0x8')](),controller['getProactiveActions']);router[_0x740c('0x7')](_0x740c('0x1a'),controller[_0x740c('0x1b')]);router[_0x740c('0x7')](_0x740c('0x1c'),auth['isAuthenticated'](),controller[_0x740c('0x1d')]);router[_0x740c('0x7')](_0x740c('0x1e'),auth['isAuthenticated'](),controller[_0x740c('0x1f')]);router[_0x740c('0x20')]('/',auth[_0x740c('0x8')](),controller[_0x740c('0x21')]);router[_0x740c('0x20')](_0x740c('0xc'),auth[_0x740c('0x8')](),controller[_0x740c('0x22')]);router[_0x740c('0x20')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x740c('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xcffe24,_0x2824d7,_0x333d4b){_0x333d4b(null,path[_0x740c('0x24')](config[_0x740c('0x25')],'server/files/images/logos/'));},'filename':function(_0x5daf42,_0x57be10,_0x1d4554){_0x1d4554(null,util['format'](_0x740c('0x26'),Date[_0x740c('0x27')](),_0x57be10[_0x740c('0x28')]));}})});router[_0x740c('0x20')]('/:id/logo',upload[_0x740c('0x29')](_0x740c('0x2a')),controller[_0x740c('0x2b')]);var upload=multer({'storage':multer[_0x740c('0x2c')]({'destination':function(_0x122d06,_0x1044e3,_0x5d3a1f){_0x5d3a1f(null,path[_0x740c('0x24')](config[_0x740c('0x25')],_0x740c('0x2d')));},'filename':function(_0x4db869,_0x42e26a,_0x4b1edc){_0x4b1edc(null,util[_0x740c('0x2e')](_0x740c('0x26'),Date[_0x740c('0x27')](),_0x42e26a['originalname']));}})});router['post'](_0x740c('0x11'),upload[_0x740c('0x29')](_0x740c('0x2a')),controller['addAvatar']);var upload=multer({'storage':multer[_0x740c('0x2c')]({'destination':function(_0x574444,_0x33b289,_0x4ab0cb){_0x4ab0cb(null,path[_0x740c('0x24')](config[_0x740c('0x25')],_0x740c('0x2d')));},'filename':function(_0x10111e,_0x48cffc,_0x4969c1){_0x4969c1(null,util[_0x740c('0x2e')](_0x740c('0x26'),Date[_0x740c('0x27')](),_0x48cffc[_0x740c('0x28')]));}})});router[_0x740c('0x20')](_0x740c('0x2f'),upload[_0x740c('0x29')](_0x740c('0x2a')),controller[_0x740c('0x30')]);var upload=multer({'storage':multer[_0x740c('0x2c')]({'destination':function(_0x384542,_0x4e8f3c,_0x1f0cdf){_0x1f0cdf(null,path[_0x740c('0x24')](config[_0x740c('0x25')],_0x740c('0x2d')));},'filename':function(_0x56f441,_0x19bdf0,_0x33eed5){_0x33eed5(null,util[_0x740c('0x2e')]('%s-%s',Date[_0x740c('0x27')](),_0x19bdf0['originalname']));}})});router['post'](_0x740c('0x31'),upload['single']('file'),controller[_0x740c('0x32')]);router[_0x740c('0x20')]('/:id/notify',controller[_0x740c('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0x740c('0x2c')]({'destination':function(_0x11ce98,_0x1f7cc1,_0x48f7b2){const _0x37c995=path[_0x740c('0x24')](config[_0x740c('0x25')],_0x740c('0x34'),_0x740c('0x35'),_0x740c('0x36'));fs_extra[_0x740c('0x37')](_0x37c995,function(){_0x48f7b2(null,_0x37c995);});},'filename':function(_0x2a36f1,_0x4bc2bb,_0x50e4f){const _0x5b7fe2=_0x4bc2bb['originalname'][_0x740c('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x25b3b4=path[_0x740c('0x39')](_0x5b7fe2);const _0x5568b3=Date[_0x740c('0x27')]()+'-'+_0x5b7fe2[_0x740c('0x38')](_0x25b3b4,'')+_0x25b3b4;_0x50e4f(null,_0x5568b3);}})});router[_0x740c('0x20')](_0x740c('0x3a'),offlineUploadMulter[_0x740c('0x3b')](),controller[_0x740c('0x3c')]);router[_0x740c('0x20')](_0x740c('0x3d'),auth[_0x740c('0x8')](),controller[_0x740c('0x3e')]);router[_0x740c('0x20')](_0x740c('0x17'),auth[_0x740c('0x8')](),controller['addApplications']);router[_0x740c('0x20')](_0x740c('0x19'),auth[_0x740c('0x8')](),controller['addProactiveActions']);router['post'](_0x740c('0x1e'),auth['isAuthenticated'](),controller[_0x740c('0x3f')]);router['put'](_0x740c('0xa'),auth[_0x740c('0x8')](),controller[_0x740c('0x40')]);router[_0x740c('0x41')](_0x740c('0xa'),auth[_0x740c('0x8')](),controller[_0x740c('0x42')]);router[_0x740c('0x41')](_0x740c('0xc'),auth['isAuthenticated'](),controller[_0x740c('0x43')]);router[_0x740c('0x41')](_0x740c('0xe'),auth['isAuthenticated'](),controller[_0x740c('0x44')]);router[_0x740c('0x41')](_0x740c('0x1e'),auth[_0x740c('0x8')](),controller[_0x740c('0x45')]);module[_0x740c('0x46')]=router; \ No newline at end of file +var _0xe290=['getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/proactive_actions','getProactiveActions','getFields','getOfflineMessages','post','create','/:id/canned_answers','diskStorage','join','root','format','%s-%s','single','server/files/images/avatars/','now','file','addAvatar','originalname','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any','offline','addInteraction','/:id/applications','addApplications','/:id/users','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','/:id/dispositions'];(function(_0x1de2e2,_0x55f13c){var _0x4f02e7=function(_0x415dee){while(--_0x415dee){_0x1de2e2['push'](_0x1de2e2['shift']());}};_0x4f02e7(++_0x55f13c);}(_0xe290,0xbb));var _0x0e29=function(_0x3fec1f,_0x563512){_0x3fec1f=_0x3fec1f-0x0;var _0x5cb79b=_0xe290[_0x3fec1f];return _0x5cb79b;};'use strict';var multer=require(_0x0e29('0x0'));var util=require(_0x0e29('0x1'));var path=require(_0x0e29('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e29('0x3'));var router=express[_0x0e29('0x4')]();var fs_extra=require(_0x0e29('0x5'));var auth=require(_0x0e29('0x6'));var interaction=require(_0x0e29('0x7'));var config=require(_0x0e29('0x8'));var controller=require('./chatWebsite.controller');router[_0x0e29('0x9')]('/',auth[_0x0e29('0xa')](),controller['index']);router[_0x0e29('0x9')]('/describe',auth[_0x0e29('0xa')](),controller[_0x0e29('0xb')]);router[_0x0e29('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0e29('0xc')]);router[_0x0e29('0x9')](_0x0e29('0xd'),auth[_0x0e29('0xa')](),controller['getDispositions']);router[_0x0e29('0x9')]('/:id/canned_answers',auth[_0x0e29('0xa')](),controller[_0x0e29('0xe')]);router[_0x0e29('0x9')](_0x0e29('0xf'),controller[_0x0e29('0x10')]);router[_0x0e29('0x9')](_0x0e29('0x11'),controller['getAvatar']);router['get'](_0x0e29('0x12'),controller[_0x0e29('0x13')]);router[_0x0e29('0x9')](_0x0e29('0x14'),controller[_0x0e29('0x15')]);router['get'](_0x0e29('0x16'),auth[_0x0e29('0xa')](),controller[_0x0e29('0x17')]);router[_0x0e29('0x9')](_0x0e29('0x18'),controller[_0x0e29('0x19')]);router[_0x0e29('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router['get'](_0x0e29('0x1a'),auth[_0x0e29('0xa')](),controller[_0x0e29('0x1b')]);router[_0x0e29('0x9')]('/:id/fields',controller[_0x0e29('0x1c')]);router[_0x0e29('0x9')]('/:id/offline_messages',auth[_0x0e29('0xa')](),controller[_0x0e29('0x1d')]);router[_0x0e29('0x9')]('/:id/users',auth[_0x0e29('0xa')](),controller['getAgents']);router[_0x0e29('0x1e')]('/',auth[_0x0e29('0xa')](),controller[_0x0e29('0x1f')]);router['post'](_0x0e29('0xd'),auth[_0x0e29('0xa')](),controller['addDisposition']);router[_0x0e29('0x1e')](_0x0e29('0x20'),auth[_0x0e29('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x0e29('0x21')]({'destination':function(_0x47cace,_0x544947,_0x5bf85c){_0x5bf85c(null,path[_0x0e29('0x22')](config[_0x0e29('0x23')],'server/files/images/logos/'));},'filename':function(_0x44d494,_0x4fa9af,_0x14a34c){_0x14a34c(null,util[_0x0e29('0x24')](_0x0e29('0x25'),Date['now'](),_0x4fa9af['originalname']));}})});router['post'](_0x0e29('0xf'),upload[_0x0e29('0x26')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x0e29('0x21')]({'destination':function(_0x1f3a7e,_0x19b20f,_0x1a3c10){_0x1a3c10(null,path['join'](config[_0x0e29('0x23')],_0x0e29('0x27')));},'filename':function(_0x14ff65,_0x2856ec,_0x23f490){_0x23f490(null,util[_0x0e29('0x24')](_0x0e29('0x25'),Date[_0x0e29('0x28')](),_0x2856ec['originalname']));}})});router[_0x0e29('0x1e')](_0x0e29('0x11'),upload[_0x0e29('0x26')](_0x0e29('0x29')),controller[_0x0e29('0x2a')]);var upload=multer({'storage':multer[_0x0e29('0x21')]({'destination':function(_0x329cae,_0x40e8f1,_0x4d3fa7){_0x4d3fa7(null,path[_0x0e29('0x22')](config[_0x0e29('0x23')],'server/files/images/avatars/'));},'filename':function(_0x35277d,_0x927f26,_0x2cfd71){_0x2cfd71(null,util[_0x0e29('0x24')](_0x0e29('0x25'),Date['now'](),_0x927f26[_0x0e29('0x2b')]));}})});router[_0x0e29('0x1e')](_0x0e29('0x12'),upload['single']('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x0e29('0x21')]({'destination':function(_0x9901c5,_0x5218b0,_0x49d918){_0x49d918(null,path[_0x0e29('0x22')](config[_0x0e29('0x23')],_0x0e29('0x27')));},'filename':function(_0x1d4ff7,_0x44188c,_0x41183e){_0x41183e(null,util[_0x0e29('0x24')](_0x0e29('0x25'),Date[_0x0e29('0x28')](),_0x44188c[_0x0e29('0x2b')]));}})});router[_0x0e29('0x1e')](_0x0e29('0x14'),upload[_0x0e29('0x26')]('file'),controller[_0x0e29('0x2c')]);router[_0x0e29('0x1e')](_0x0e29('0x2d'),controller[_0x0e29('0x2e')]);const offlineUploadMulter=multer({'storage':multer[_0x0e29('0x21')]({'destination':function(_0x25dea7,_0xcc17ca,_0x496d34){const _0x2e419e=path[_0x0e29('0x22')](config[_0x0e29('0x23')],_0x0e29('0x2f'),_0x0e29('0x30'),_0x0e29('0x31'));fs_extra[_0x0e29('0x32')](_0x2e419e,function(){_0x496d34(null,_0x2e419e);});},'filename':function(_0x14b7b3,_0x1a71a5,_0x42e364){const _0x7f5323=_0x1a71a5['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1dc8c1=path[_0x0e29('0x33')](_0x7f5323);const _0x1722af=Date['now']()+'-'+_0x7f5323[_0x0e29('0x34')](_0x1dc8c1,'')+_0x1dc8c1;_0x42e364(null,_0x1722af);}})});router[_0x0e29('0x1e')](_0x0e29('0x35'),offlineUploadMulter[_0x0e29('0x36')](),controller[_0x0e29('0x37')]);router['post'](_0x0e29('0x16'),auth['isAuthenticated'](),controller[_0x0e29('0x38')]);router['post'](_0x0e29('0x39'),auth[_0x0e29('0xa')](),controller[_0x0e29('0x3a')]);router[_0x0e29('0x1e')](_0x0e29('0x1a'),auth[_0x0e29('0xa')](),controller['addProactiveActions']);router['post'](_0x0e29('0x3b'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x0e29('0x3c'),auth[_0x0e29('0xa')](),controller[_0x0e29('0x3d')]);router[_0x0e29('0x3e')]('/:id',auth['isAuthenticated'](),controller[_0x0e29('0x3f')]);router['delete'](_0x0e29('0xd'),auth[_0x0e29('0xa')](),controller[_0x0e29('0x40')]);router[_0x0e29('0x3e')](_0x0e29('0x20'),auth['isAuthenticated'](),controller[_0x0e29('0x41')]);router[_0x0e29('0x3e')](_0x0e29('0x3b'),auth[_0x0e29('0xa')](),controller[_0x0e29('0x42')]);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 6d71c49..dda3679 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 _0x9cbc=['express','../components/auth/service','../config/environment','Router','env','production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','use','isAuthenticated','exports','beaver-logger/server'];(function(_0x54322c,_0x434113){var _0x18dc0a=function(_0x22cea6){while(--_0x22cea6){_0x54322c['push'](_0x54322c['shift']());}};_0x18dc0a(++_0x434113);}(_0x9cbc,0x1cd));var _0xc9cb=function(_0x1806d4,_0x47cc68){_0x1806d4=_0x1806d4-0x0;var _0x392c2c=_0x9cbc[_0x1806d4];return _0x392c2c;};var beaverLogger=require(_0xc9cb('0x0'));var express=require(_0xc9cb('0x1'));var auth=require(_0xc9cb('0x2'));var config=require(_0xc9cb('0x3'));var router=express[_0xc9cb('0x4')]();var isProduction=config[_0xc9cb('0x5')]===_0xc9cb('0x6')||![];function clientSideLogs(_0x42b872,_0x17846b,_0x492228){var _0x49f4ab=_0x42b872[_0xc9cb('0x7')]['get'](_0xc9cb('0x8'));if(!_0x49f4ab){throw new Error(_0xc9cb('0x9'));}return beaverLogger['expressEndpoint']({'uri':_0xc9cb('0xa'),'logger':_0x49f4ab,'enableCors':!isProduction})(_0x42b872,_0x17846b,_0x492228);}router[_0xc9cb('0xb')](auth[_0xc9cb('0xc')](),clientSideLogs);module[_0xc9cb('0xd')]=router; \ No newline at end of file +var _0xdd80=['beaver-logger/server','../components/auth/service','../config/environment','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','use','isAuthenticated','exports'];(function(_0x573992,_0x6e6ba8){var _0x56d21b=function(_0x46971e){while(--_0x46971e){_0x573992['push'](_0x573992['shift']());}};_0x56d21b(++_0x6e6ba8);}(_0xdd80,0xc4));var _0x0dd8=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xdd80[_0x501510];return _0x1e6ee5;};var beaverLogger=require(_0x0dd8('0x0'));var express=require('express');var auth=require(_0x0dd8('0x1'));var config=require(_0x0dd8('0x2'));var router=express[_0x0dd8('0x3')]();var isProduction=config[_0x0dd8('0x4')]===_0x0dd8('0x5')||![];function clientSideLogs(_0x566415,_0x4b9612,_0x109a1d){var _0x5cf904=_0x566415[_0x0dd8('0x6')][_0x0dd8('0x7')](_0x0dd8('0x8'));if(!_0x5cf904){throw new Error(_0x0dd8('0x9'));}return beaverLogger['expressEndpoint']({'uri':_0x0dd8('0xa'),'logger':_0x5cf904,'enableCors':!isProduction})(_0x566415,_0x4b9612,_0x109a1d);}router[_0x0dd8('0xb')](auth[_0x0dd8('0xc')](),clientSideLogs);module[_0x0dd8('0xd')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 29902bd..02cb996 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 _0xb8ec=['exports','STRING','Google','ENUM','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize'];(function(_0x57d0dc,_0x387f3e){var _0x177765=function(_0x1bbc9e){while(--_0x1bbc9e){_0x57d0dc['push'](_0x57d0dc['shift']());}};_0x177765(++_0x387f3e);}(_0xb8ec,0x1e9));var _0xcb8e=function(_0x365fe1,_0x570103){_0x365fe1=_0x365fe1-0x0;var _0x4174ae=_0xb8ec[_0x365fe1];return _0x4174ae;};'use strict';var Sequelize=require(_0xcb8e('0x0'));module[_0xcb8e('0x1')]={'name':{'type':Sequelize[_0xcb8e('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0xcb8e('0x3'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xcb8e('0x4')]('Outlook365',_0xcb8e('0x5'))},'data1':{'type':Sequelize[_0xcb8e('0x2')],'comment':_0xcb8e('0x6')},'data2':{'type':Sequelize[_0xcb8e('0x2')],'comment':_0xcb8e('0x7')},'data3':{'type':Sequelize[_0xcb8e('0x2')],'comment':_0xcb8e('0x8')},'data4':{'type':Sequelize[_0xcb8e('0x2')],'comment':_0xcb8e('0x9')},'data5':{'type':Sequelize[_0xcb8e('0xa')],'comment':_0xcb8e('0xb')},'data6':{'type':Sequelize['TEXT'],'comment':_0xcb8e('0xc')},'data7':{'type':Sequelize[_0xcb8e('0xa')],'comment':_0xcb8e('0xd')}}; \ No newline at end of file +var _0x3fa8=['MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x44c36f,_0x1f93f6){var _0x1e1c7a=function(_0x267646){while(--_0x267646){_0x44c36f['push'](_0x44c36f['shift']());}};_0x1e1c7a(++_0x1f93f6);}(_0x3fa8,0x8c));var _0x83fa=function(_0x155935,_0x46f524){_0x155935=_0x155935-0x0;var _0x44c310=_0x3fa8[_0x155935];return _0x44c310;};'use strict';var Sequelize=require('sequelize');module[_0x83fa('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x83fa('0x1')](_0x83fa('0x2'),_0x83fa('0x3'),_0x83fa('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x83fa('0x1')](_0x83fa('0x5'),_0x83fa('0x6'))},'data1':{'type':Sequelize[_0x83fa('0x7')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x83fa('0x7')],'comment':_0x83fa('0x8')},'data3':{'type':Sequelize[_0x83fa('0x7')],'comment':_0x83fa('0x9')},'data4':{'type':Sequelize[_0x83fa('0x7')],'comment':_0x83fa('0xa')},'data5':{'type':Sequelize[_0x83fa('0xb')],'comment':_0x83fa('0xc')},'data6':{'type':Sequelize[_0x83fa('0xb')],'comment':_0x83fa('0xd')},'data7':{'type':Sequelize[_0x83fa('0xb')],'comment':_0x83fa('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 80cad05..ec06fca 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 _0x1220=['then','destroy','error','stack','name','send','padEnd','index','map','CloudProvider','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','MicrosoftAzure','decryptString','data3','catch','show','params','include','service','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','create','find','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','base64','toString','ascii','parse','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','state','getOauth2MicrosoftAccessToken','code','data5','access_token','refresh_token','data6','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','update'];(function(_0x341b17,_0x36976a){var _0x407a3c=function(_0xef96e){while(--_0xef96e){_0x341b17['push'](_0x341b17['shift']());}};_0x407a3c(++_0x36976a);}(_0x1220,0xab));var _0x0122=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x1220[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x0122('0x0'));var Redis=require(_0x0122('0x1'));var qs=require(_0x0122('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0x0122('0x3'));var logger=require(_0x0122('0x4'))('api');var db=require(_0x0122('0x5'))['db'];var oauth=require(_0x0122('0x6'));config[_0x0122('0x7')]=_[_0x0122('0x8')](config[_0x0122('0x7')],{'host':_0x0122('0x9'),'port':0x18eb});var socket=require(_0x0122('0xa'))(new Redis(config['redis']));var redis=new Redis(config[_0x0122('0x7')]);function respondWithStatusCode(_0x595aa5,_0x5036fa){_0x5036fa=_0x5036fa||0xcc;return function(_0x39536a){if(_0x39536a){return _0x595aa5[_0x0122('0xb')](_0x5036fa);}return _0x595aa5[_0x0122('0xc')](_0x5036fa)['end']();};}function respondWithResult(_0x56dc09,_0x1f6bd5){_0x1f6bd5=_0x1f6bd5||0xc8;return function(_0x21dd5c){if(_0x21dd5c){return _0x56dc09[_0x0122('0xc')](_0x1f6bd5)['json'](_0x21dd5c);}};}function respondWithFilteredResult(_0x2f9c4c,_0x54f37e){return function(_0x1cae0a){if(_0x1cae0a){var _0xaf761e=typeof _0x54f37e['offset']===_0x0122('0xd')&&typeof _0x54f37e[_0x0122('0xe')]==='undefined';var _0x4b9909=_0x1cae0a[_0x0122('0xf')];var _0x584523=_0xaf761e?0x0:_0x54f37e[_0x0122('0x10')];var _0x5056a4=_0xaf761e?_0x1cae0a['count']:_0x54f37e[_0x0122('0x10')]+_0x54f37e[_0x0122('0xe')];var _0x10fb96;if(_0x5056a4>=_0x4b9909){_0x5056a4=_0x4b9909;_0x10fb96=0xc8;}else{_0x10fb96=0xce;}_0x2f9c4c['status'](_0x10fb96);return _0x2f9c4c[_0x0122('0x11')](_0x0122('0x12'),_0x584523+'-'+_0x5056a4+'/'+_0x4b9909)[_0x0122('0x13')](_0x1cae0a);}return null;};}function saveUpdates(_0x13af3c){return function(_0x501a12){if(_0x501a12){return _0x501a12[_0x0122('0x14')](_0x13af3c)[_0x0122('0x15')](function(_0x41c1fc){return _0x41c1fc;});}return null;};}function removeEntity(_0x327658){return function(_0x5c26bf){if(_0x5c26bf){return _0x5c26bf[_0x0122('0x16')]()['then'](function(){_0x327658[_0x0122('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21220d){return function(_0x339996){if(!_0x339996){_0x21220d[_0x0122('0xb')](0x194);}return _0x339996;};}function handleError(_0x13eaea,_0x3a7c66){_0x3a7c66=_0x3a7c66||0x1f4;return function(_0xbb9062){logger[_0x0122('0x17')](_0xbb9062[_0x0122('0x18')]);if(_0xbb9062[_0x0122('0x19')]){delete _0xbb9062[_0x0122('0x19')];}_0x13eaea[_0x0122('0xc')](_0x3a7c66)[_0x0122('0x1a')](_0xbb9062);};}function maskClientSecret(_0x4f7ad2){return _[_0x0122('0x1b')](_0x4f7ad2['slice'](0x0,0x3),0x14,'*');}exports[_0x0122('0x1c')]=function(_0xfd139d,_0x19906c){var _0xf9a84d={},_0x48616c={},_0x5352ed={'count':0x0,'rows':[]};var _0x515268=_[_0x0122('0x1d')](db[_0x0122('0x1e')][_0x0122('0x1f')],function(_0x511efa){return{'name':_0x511efa[_0x0122('0x20')],'type':_0x511efa['type'][_0x0122('0x21')]};});_0x48616c['model']=_[_0x0122('0x1d')](_0x515268,'name');_0x48616c[_0x0122('0x22')]=_[_0x0122('0x23')](_0xfd139d[_0x0122('0x22')]);_0x48616c[_0x0122('0x24')]=_[_0x0122('0x25')](_0x48616c[_0x0122('0x26')],_0x48616c[_0x0122('0x22')]);_0xf9a84d[_0x0122('0x27')]=_[_0x0122('0x25')](_0x48616c['model'],qs[_0x0122('0x28')](_0xfd139d[_0x0122('0x22')][_0x0122('0x28')]));_0xf9a84d[_0x0122('0x27')]=_0xf9a84d[_0x0122('0x27')][_0x0122('0x29')]?_0xf9a84d[_0x0122('0x27')]:_0x48616c[_0x0122('0x26')];if(!_0xfd139d[_0x0122('0x22')][_0x0122('0x2a')](_0x0122('0x2b'))){_0xf9a84d[_0x0122('0xe')]=qs[_0x0122('0xe')](_0xfd139d[_0x0122('0x22')][_0x0122('0xe')]);_0xf9a84d[_0x0122('0x10')]=qs[_0x0122('0x10')](_0xfd139d[_0x0122('0x22')][_0x0122('0x10')]);}_0xf9a84d['order']=qs[_0x0122('0x2c')](_0xfd139d[_0x0122('0x22')][_0x0122('0x2c')]);_0xf9a84d['where']=qs['filters'](_['pick'](_0xfd139d[_0x0122('0x22')],_0x48616c[_0x0122('0x24')]),_0x515268);if(_0xfd139d[_0x0122('0x22')][_0x0122('0x2d')]){_0xf9a84d[_0x0122('0x2e')]=_[_0x0122('0x2f')](_0xf9a84d[_0x0122('0x2e')],{'$or':_['map'](_0x515268,function(_0x45b419){if(_0x45b419['type']!==_0x0122('0x30')){var _0x101078={};_0x101078[_0x45b419['name']]={'$like':'%'+_0xfd139d[_0x0122('0x22')][_0x0122('0x2d')]+'%'};return _0x101078;}})});}_0xf9a84d=_['merge']({},_0xf9a84d,_0xfd139d[_0x0122('0x31')]);var _0x1952ca={'where':_0xf9a84d[_0x0122('0x2e')]};return db[_0x0122('0x1e')][_0x0122('0xf')](_0x1952ca)[_0x0122('0x15')](function(_0x43c8db){_0x5352ed[_0x0122('0xf')]=_0x43c8db;if(_0xfd139d[_0x0122('0x22')][_0x0122('0x32')]){_0xf9a84d['include']=[{'all':!![]}];}return db[_0x0122('0x1e')][_0x0122('0x33')](_0xf9a84d);})[_0x0122('0x15')](function(_0x42d48d){_0x5352ed[_0x0122('0x34')]=_[_0x0122('0x1d')](_0x42d48d,function(_0x5add6e){if(_0x5add6e['service']===_0x0122('0x35')){var _0x1d7eb0=encryptor[_0x0122('0x36')](_0x5add6e[_0x0122('0x37')]);_0x5add6e[_0x0122('0x37')]=maskClientSecret(_0x1d7eb0);}return _0x5add6e;});return _0x5352ed;})[_0x0122('0x15')](respondWithFilteredResult(_0x19906c,_0xf9a84d))[_0x0122('0x38')](handleError(_0x19906c,null));};exports[_0x0122('0x39')]=function(_0xe749e8,_0x78ebbd){var _0x53a6ea={'raw':!![],'where':{'id':_0xe749e8[_0x0122('0x3a')]['id']}},_0x35f676={};_0x35f676[_0x0122('0x26')]=_['keys'](db[_0x0122('0x1e')][_0x0122('0x1f')]);_0x35f676[_0x0122('0x22')]=_[_0x0122('0x23')](_0xe749e8['query']);_0x35f676['filters']=_[_0x0122('0x25')](_0x35f676[_0x0122('0x26')],_0x35f676[_0x0122('0x22')]);_0x53a6ea[_0x0122('0x27')]=_['intersection'](_0x35f676[_0x0122('0x26')],qs[_0x0122('0x28')](_0xe749e8['query'][_0x0122('0x28')]));_0x53a6ea[_0x0122('0x27')]=_0x53a6ea[_0x0122('0x27')][_0x0122('0x29')]?_0x53a6ea['attributes']:_0x35f676['model'];if(_0xe749e8[_0x0122('0x22')][_0x0122('0x32')]){_0x53a6ea[_0x0122('0x3b')]=[{'all':!![]}];}_0x53a6ea=_['merge']({},_0x53a6ea,_0xe749e8[_0x0122('0x31')]);return db['CloudProvider']['find'](_0x53a6ea)['then'](handleEntityNotFound(_0x78ebbd,null))['then'](function(_0x46027a){if(_0x46027a[_0x0122('0x3c')]==='MicrosoftAzure'){var _0x5c5f44=encryptor[_0x0122('0x36')](_0x46027a['data3']);_0x46027a[_0x0122('0x37')]=maskClientSecret(_0x5c5f44);}return _0x46027a;})[_0x0122('0x15')](respondWithResult(_0x78ebbd,null))[_0x0122('0x38')](handleError(_0x78ebbd,null));};exports['create']=function(_0x456ba1,_0x2722b6){if(!_0x456ba1[_0x0122('0x3d')][_0x0122('0x19')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x456ba1[_0x0122('0x3d')][_0x0122('0x3c')])throw new Error(_0x0122('0x3e'));var _0x19b183=db[_0x0122('0x1e')]['rawAttributes'][_0x0122('0x3c')][_0x0122('0x3f')];if(!_0x19b183[_0x0122('0x40')](_0x456ba1[_0x0122('0x3d')][_0x0122('0x3c')]))throw new Error(_0x0122('0x41')+_0x19b183['join'](',\x20'));if(_0x456ba1[_0x0122('0x3d')]['service']==='MicrosoftAzure'&&_0x456ba1['body']['data3']){_0x456ba1[_0x0122('0x3d')]['data3']=encryptor['encryptString'](_0x456ba1[_0x0122('0x3d')][_0x0122('0x37')]);}return db[_0x0122('0x1e')][_0x0122('0x42')](_0x456ba1[_0x0122('0x3d')],{})['then'](respondWithResult(_0x2722b6,0xc9))['catch'](handleError(_0x2722b6,null));};exports['update']=function(_0x34c99f,_0x4bfe52){if(_0x34c99f['body']['id']){delete _0x34c99f['body']['id'];}return db['CloudProvider'][_0x0122('0x43')]({'where':{'id':_0x34c99f[_0x0122('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4bfe52,null))[_0x0122('0x15')](function(_0x5721f5){if(_0x5721f5[_0x0122('0x3c')]==='MicrosoftAzure'&&_0x34c99f[_0x0122('0x3d')]['data3']){_0x34c99f[_0x0122('0x3d')][_0x0122('0x37')]=encryptor[_0x0122('0x44')](_0x34c99f[_0x0122('0x3d')][_0x0122('0x37')]);}return _0x5721f5;})[_0x0122('0x15')](saveUpdates(_0x34c99f[_0x0122('0x3d')],null))['then'](respondWithResult(_0x4bfe52,null))[_0x0122('0x38')](handleError(_0x4bfe52,null));};exports[_0x0122('0x16')]=function(_0x21b709,_0x333596){return db[_0x0122('0x1e')][_0x0122('0x43')]({'where':{'id':_0x21b709[_0x0122('0x3a')]['id']}})[_0x0122('0x15')](handleEntityNotFound(_0x333596,null))['then'](removeEntity(_0x333596,null))['catch'](handleError(_0x333596,null));};exports[_0x0122('0x45')]=function(_0x549999,_0x26022b){return db['CloudProvider']['findOne']({'where':{'id':_0x549999[_0x0122('0x3a')]['id']},'raw':!![]})[_0x0122('0x15')](function(_0x1552db){if(!_0x1552db)return _0x26022b['sendStatus'](0x194);return{'url':oauth[_0x0122('0x46')](_0x1552db,_0x549999[_0x0122('0x47')]['id'])};})['then'](respondWithResult(_0x26022b,null))[_0x0122('0x38')](handleError(_0x26022b,null));};exports[_0x0122('0x48')]=function(_0x59cdfa,_0x5f3dd9){var _0x3f9da5=_0x59cdfa['body'];var _0x3858b9;var _0x534b9a;if(_0x3f9da5[_0x0122('0x17')])throw _0x3f9da5;redis[_0x0122('0x49')](_0x3f9da5['state'])[_0x0122('0x15')](function(_0x1e1a71){if(!_0x1e1a71)throw new Error(_0x0122('0x4a'));_0x3858b9=JSON['parse'](_0x1e1a71);var _0xca404f=Buffer['from'](_0x3f9da5['state'],_0x0122('0x4b'))[_0x0122('0x4c')](_0x0122('0x4d'));_0x534b9a=JSON[_0x0122('0x4e')](_0xca404f);if(!oauth[_0x0122('0x4f')](_0x3f9da5['id_token'],_0x3858b9[_0x0122('0x50')]))throw new Error(_0x0122('0x51'));redis[_0x0122('0x52')](_0x3f9da5[_0x0122('0x53')]);return oauth[_0x0122('0x54')](_0x3f9da5[_0x0122('0x55')],_0x3858b9);})[_0x0122('0x15')](function(_0x358bc5){_0x3858b9[_0x0122('0x56')]=_0x358bc5[_0x0122('0x57')];_0x3858b9['data6']=_0x358bc5[_0x0122('0x58')];return db[_0x0122('0x1e')][_0x0122('0x14')]({'data5':_0x3858b9[_0x0122('0x56')],'data6':_0x3858b9[_0x0122('0x59')]},{'where':{'id':_0x3858b9['id']}});})[_0x0122('0x15')](function(){oauth[_0x0122('0x5a')](_0x3858b9);socket[_0x0122('0x5b')]('microsoftAuthorization:success',{'id':_0x534b9a['id']});return;})['then'](respondWithStatusCode(_0x5f3dd9,null))[_0x0122('0x38')](function(_0x11faad){if(_0x534b9a){socket['emit'](_0x0122('0x5c'),{'id':_0x534b9a['id']});}if(!_0x3858b9){logger['error'](_0x0122('0x5d'),_0x11faad);return _0x5f3dd9[_0x0122('0xc')](0x1f4)['send'](_0x11faad['message']);}logger[_0x0122('0x17')](_0x0122('0x5e'),_0x3858b9['id'],JSON[_0x0122('0x5f')](_0x11faad));});}; \ No newline at end of file +var _0x0642=['redis','defaults','localhost','socket.io-emitter','sendStatus','status','offset','undefined','count','set','Content-Range','json','update','then','error','stack','padEnd','slice','index','CloudProvider','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','map','merge','options','includeAll','findAll','service','decryptString','catch','show','params','include','find','MicrosoftAzure','data3','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','state','Invalid\x20state\x20parameter','parse','isValidIdToken','id_token','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','data6','refresh_token','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','send','message','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth'];(function(_0x462516,_0x5042bb){var _0x28f3bf=function(_0x11e8dc){while(--_0x11e8dc){_0x462516['push'](_0x462516['shift']());}};_0x28f3bf(++_0x5042bb);}(_0x0642,0x1c5));var _0x2064=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x0642[_0x3c4f1f];return _0x19cb69;};'use strict';var _=require('lodash');var Redis=require(_0x2064('0x0'));var qs=require(_0x2064('0x1'));var encryptor=require(_0x2064('0x2'));var config=require(_0x2064('0x3'));var logger=require(_0x2064('0x4'))(_0x2064('0x5'));var db=require('../../mysqldb')['db'];var oauth=require(_0x2064('0x6'));config[_0x2064('0x7')]=_[_0x2064('0x8')](config[_0x2064('0x7')],{'host':_0x2064('0x9'),'port':0x18eb});var socket=require(_0x2064('0xa'))(new Redis(config[_0x2064('0x7')]));var redis=new Redis(config[_0x2064('0x7')]);function respondWithStatusCode(_0x10e70e,_0x3be7a2){_0x3be7a2=_0x3be7a2||0xcc;return function(_0x20ba60){if(_0x20ba60){return _0x10e70e[_0x2064('0xb')](_0x3be7a2);}return _0x10e70e[_0x2064('0xc')](_0x3be7a2)['end']();};}function respondWithResult(_0x44adf1,_0x257376){_0x257376=_0x257376||0xc8;return function(_0x465e55){if(_0x465e55){return _0x44adf1[_0x2064('0xc')](_0x257376)['json'](_0x465e55);}};}function respondWithFilteredResult(_0x557ff6,_0x356cc3){return function(_0x6c048a){if(_0x6c048a){var _0x1508c8=typeof _0x356cc3[_0x2064('0xd')]===_0x2064('0xe')&&typeof _0x356cc3['limit']===_0x2064('0xe');var _0x2a9452=_0x6c048a[_0x2064('0xf')];var _0x2cfcc7=_0x1508c8?0x0:_0x356cc3[_0x2064('0xd')];var _0x4d1008=_0x1508c8?_0x6c048a[_0x2064('0xf')]:_0x356cc3[_0x2064('0xd')]+_0x356cc3['limit'];var _0x4ed761;if(_0x4d1008>=_0x2a9452){_0x4d1008=_0x2a9452;_0x4ed761=0xc8;}else{_0x4ed761=0xce;}_0x557ff6['status'](_0x4ed761);return _0x557ff6[_0x2064('0x10')](_0x2064('0x11'),_0x2cfcc7+'-'+_0x4d1008+'/'+_0x2a9452)[_0x2064('0x12')](_0x6c048a);}return null;};}function saveUpdates(_0x542116){return function(_0x43ce5c){if(_0x43ce5c){return _0x43ce5c[_0x2064('0x13')](_0x542116)['then'](function(_0x223b90){return _0x223b90;});}return null;};}function removeEntity(_0x50ec80){return function(_0x2e7422){if(_0x2e7422){return _0x2e7422['destroy']()[_0x2064('0x14')](function(){_0x50ec80[_0x2064('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16c2a0){return function(_0x359bb5){if(!_0x359bb5){_0x16c2a0[_0x2064('0xb')](0x194);}return _0x359bb5;};}function handleError(_0x135d5d,_0x7b86be){_0x7b86be=_0x7b86be||0x1f4;return function(_0x6ce682){logger[_0x2064('0x15')](_0x6ce682[_0x2064('0x16')]);if(_0x6ce682['name']){delete _0x6ce682['name'];}_0x135d5d[_0x2064('0xc')](_0x7b86be)['send'](_0x6ce682);};}function maskClientSecret(_0x48b5ad){return _[_0x2064('0x17')](_0x48b5ad[_0x2064('0x18')](0x0,0x3),0x14,'*');}exports[_0x2064('0x19')]=function(_0x335824,_0x9b3505){var _0x2284eb={},_0x5c3203={},_0x3292bf={'count':0x0,'rows':[]};var _0x5d1f69=_['map'](db[_0x2064('0x1a')][_0x2064('0x1b')],function(_0xf418d8){return{'name':_0xf418d8[_0x2064('0x1c')],'type':_0xf418d8[_0x2064('0x1d')][_0x2064('0x1e')]};});_0x5c3203[_0x2064('0x1f')]=_['map'](_0x5d1f69,_0x2064('0x20'));_0x5c3203[_0x2064('0x21')]=_[_0x2064('0x22')](_0x335824[_0x2064('0x21')]);_0x5c3203[_0x2064('0x23')]=_[_0x2064('0x24')](_0x5c3203['model'],_0x5c3203[_0x2064('0x21')]);_0x2284eb[_0x2064('0x25')]=_[_0x2064('0x24')](_0x5c3203['model'],qs['fields'](_0x335824[_0x2064('0x21')][_0x2064('0x26')]));_0x2284eb[_0x2064('0x25')]=_0x2284eb[_0x2064('0x25')][_0x2064('0x27')]?_0x2284eb[_0x2064('0x25')]:_0x5c3203[_0x2064('0x1f')];if(!_0x335824[_0x2064('0x21')][_0x2064('0x28')](_0x2064('0x29'))){_0x2284eb[_0x2064('0x2a')]=qs['limit'](_0x335824[_0x2064('0x21')][_0x2064('0x2a')]);_0x2284eb[_0x2064('0xd')]=qs[_0x2064('0xd')](_0x335824[_0x2064('0x21')][_0x2064('0xd')]);}_0x2284eb[_0x2064('0x2b')]=qs[_0x2064('0x2c')](_0x335824[_0x2064('0x21')][_0x2064('0x2c')]);_0x2284eb['where']=qs['filters'](_[_0x2064('0x2d')](_0x335824[_0x2064('0x21')],_0x5c3203[_0x2064('0x23')]),_0x5d1f69);if(_0x335824[_0x2064('0x21')][_0x2064('0x2e')]){_0x2284eb['where']=_['merge'](_0x2284eb['where'],{'$or':_[_0x2064('0x2f')](_0x5d1f69,function(_0x11f141){if(_0x11f141[_0x2064('0x1d')]!=='VIRTUAL'){var _0x52d43c={};_0x52d43c[_0x11f141[_0x2064('0x20')]]={'$like':'%'+_0x335824[_0x2064('0x21')][_0x2064('0x2e')]+'%'};return _0x52d43c;}})});}_0x2284eb=_[_0x2064('0x30')]({},_0x2284eb,_0x335824[_0x2064('0x31')]);var _0x177af2={'where':_0x2284eb['where']};return db['CloudProvider'][_0x2064('0xf')](_0x177af2)[_0x2064('0x14')](function(_0x370b64){_0x3292bf[_0x2064('0xf')]=_0x370b64;if(_0x335824[_0x2064('0x21')][_0x2064('0x32')]){_0x2284eb['include']=[{'all':!![]}];}return db[_0x2064('0x1a')][_0x2064('0x33')](_0x2284eb);})[_0x2064('0x14')](function(_0x2072a8){_0x3292bf['rows']=_[_0x2064('0x2f')](_0x2072a8,function(_0x1b5fa1){if(_0x1b5fa1[_0x2064('0x34')]==='MicrosoftAzure'){var _0xee72c1=encryptor[_0x2064('0x35')](_0x1b5fa1['data3']);_0x1b5fa1['data3']=maskClientSecret(_0xee72c1);}return _0x1b5fa1;});return _0x3292bf;})[_0x2064('0x14')](respondWithFilteredResult(_0x9b3505,_0x2284eb))[_0x2064('0x36')](handleError(_0x9b3505,null));};exports[_0x2064('0x37')]=function(_0x2cae1b,_0xa436fd){var _0x2d9c6b={'raw':!![],'where':{'id':_0x2cae1b[_0x2064('0x38')]['id']}},_0x280ce4={};_0x280ce4['model']=_[_0x2064('0x22')](db[_0x2064('0x1a')][_0x2064('0x1b')]);_0x280ce4[_0x2064('0x21')]=_[_0x2064('0x22')](_0x2cae1b[_0x2064('0x21')]);_0x280ce4['filters']=_[_0x2064('0x24')](_0x280ce4[_0x2064('0x1f')],_0x280ce4[_0x2064('0x21')]);_0x2d9c6b[_0x2064('0x25')]=_[_0x2064('0x24')](_0x280ce4[_0x2064('0x1f')],qs[_0x2064('0x26')](_0x2cae1b[_0x2064('0x21')][_0x2064('0x26')]));_0x2d9c6b['attributes']=_0x2d9c6b[_0x2064('0x25')]['length']?_0x2d9c6b['attributes']:_0x280ce4[_0x2064('0x1f')];if(_0x2cae1b[_0x2064('0x21')][_0x2064('0x32')]){_0x2d9c6b[_0x2064('0x39')]=[{'all':!![]}];}_0x2d9c6b=_[_0x2064('0x30')]({},_0x2d9c6b,_0x2cae1b[_0x2064('0x31')]);return db[_0x2064('0x1a')][_0x2064('0x3a')](_0x2d9c6b)[_0x2064('0x14')](handleEntityNotFound(_0xa436fd,null))[_0x2064('0x14')](function(_0xbff98f){if(_0xbff98f['service']===_0x2064('0x3b')){var _0x500322=encryptor[_0x2064('0x35')](_0xbff98f[_0x2064('0x3c')]);_0xbff98f[_0x2064('0x3c')]=maskClientSecret(_0x500322);}return _0xbff98f;})['then'](respondWithResult(_0xa436fd,null))[_0x2064('0x36')](handleError(_0xa436fd,null));};exports[_0x2064('0x3d')]=function(_0x3ac2ec,_0x38b6da){if(!_0x3ac2ec[_0x2064('0x3e')]['name'])throw new Error(_0x2064('0x3f'));if(!_0x3ac2ec['body'][_0x2064('0x34')])throw new Error(_0x2064('0x40'));var _0xa2030d=db[_0x2064('0x1a')][_0x2064('0x1b')][_0x2064('0x34')][_0x2064('0x41')];if(!_0xa2030d[_0x2064('0x42')](_0x3ac2ec[_0x2064('0x3e')][_0x2064('0x34')]))throw new Error(_0x2064('0x43')+_0xa2030d[_0x2064('0x44')](',\x20'));if(_0x3ac2ec[_0x2064('0x3e')][_0x2064('0x34')]===_0x2064('0x3b')&&_0x3ac2ec['body'][_0x2064('0x3c')]){_0x3ac2ec[_0x2064('0x3e')]['data3']=encryptor[_0x2064('0x45')](_0x3ac2ec[_0x2064('0x3e')][_0x2064('0x3c')]);}return db['CloudProvider'][_0x2064('0x3d')](_0x3ac2ec['body'],{})[_0x2064('0x14')](respondWithResult(_0x38b6da,0xc9))[_0x2064('0x36')](handleError(_0x38b6da,null));};exports[_0x2064('0x13')]=function(_0x30914e,_0x1e1f3e){if(_0x30914e[_0x2064('0x3e')]['id']){delete _0x30914e[_0x2064('0x3e')]['id'];}return db['CloudProvider'][_0x2064('0x3a')]({'where':{'id':_0x30914e[_0x2064('0x38')]['id']}})[_0x2064('0x14')](handleEntityNotFound(_0x1e1f3e,null))['then'](function(_0xd3b9d7){if(_0xd3b9d7[_0x2064('0x34')]==='MicrosoftAzure'&&_0x30914e[_0x2064('0x3e')][_0x2064('0x3c')]){_0x30914e[_0x2064('0x3e')][_0x2064('0x3c')]=encryptor['encryptString'](_0x30914e[_0x2064('0x3e')][_0x2064('0x3c')]);}return _0xd3b9d7;})['then'](saveUpdates(_0x30914e['body'],null))[_0x2064('0x14')](respondWithResult(_0x1e1f3e,null))[_0x2064('0x36')](handleError(_0x1e1f3e,null));};exports[_0x2064('0x46')]=function(_0x3dc715,_0x53fccf){return db[_0x2064('0x1a')][_0x2064('0x3a')]({'where':{'id':_0x3dc715['params']['id']}})['then'](handleEntityNotFound(_0x53fccf,null))[_0x2064('0x14')](removeEntity(_0x53fccf,null))[_0x2064('0x36')](handleError(_0x53fccf,null));};exports[_0x2064('0x47')]=function(_0x53ba72,_0x557088){return db[_0x2064('0x1a')][_0x2064('0x48')]({'where':{'id':_0x53ba72[_0x2064('0x38')]['id']},'raw':!![]})[_0x2064('0x14')](function(_0xac017a){if(!_0xac017a)return _0x557088[_0x2064('0xb')](0x194);return{'url':oauth[_0x2064('0x49')](_0xac017a,_0x53ba72[_0x2064('0x4a')]['id'])};})[_0x2064('0x14')](respondWithResult(_0x557088,null))[_0x2064('0x36')](handleError(_0x557088,null));};exports['oauth2MicrosoftCallback']=function(_0x38dda8,_0x2b5369){var _0x55ec6c=_0x38dda8[_0x2064('0x3e')];var _0x288676;var _0x1cc878;if(_0x55ec6c[_0x2064('0x15')])throw _0x55ec6c;redis['get'](_0x55ec6c[_0x2064('0x4b')])[_0x2064('0x14')](function(_0x13aab0){if(!_0x13aab0)throw new Error(_0x2064('0x4c'));_0x288676=JSON[_0x2064('0x4d')](_0x13aab0);var _0x161d1f=Buffer['from'](_0x55ec6c[_0x2064('0x4b')],'base64')['toString']('ascii');_0x1cc878=JSON[_0x2064('0x4d')](_0x161d1f);if(!oauth[_0x2064('0x4e')](_0x55ec6c[_0x2064('0x4f')],_0x288676[_0x2064('0x50')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x2064('0x51')](_0x55ec6c['state']);return oauth[_0x2064('0x52')](_0x55ec6c[_0x2064('0x53')],_0x288676);})[_0x2064('0x14')](function(_0x4e4232){_0x288676['data5']=_0x4e4232['access_token'];_0x288676[_0x2064('0x54')]=_0x4e4232[_0x2064('0x55')];return db[_0x2064('0x1a')]['update']({'data5':_0x288676['data5'],'data6':_0x288676[_0x2064('0x54')]},{'where':{'id':_0x288676['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x288676);socket[_0x2064('0x56')](_0x2064('0x57'),{'id':_0x1cc878['id']});return;})[_0x2064('0x14')](respondWithStatusCode(_0x2b5369,null))[_0x2064('0x36')](function(_0x133e4b){if(_0x1cc878){socket[_0x2064('0x56')]('microsoftAuthorization:error',{'id':_0x1cc878['id']});}if(!_0x288676){logger['error'](_0x2064('0x58'),_0x133e4b);return _0x2b5369[_0x2064('0xc')](0x1f4)[_0x2064('0x59')](_0x133e4b[_0x2064('0x5a')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x288676['id'],JSON[_0x2064('0x5b')](_0x133e4b));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 7e87940..f2d6603 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 _0xb028=['rimraf','./cloudProvider.attributes','define','cloud_providers','lodash','util','moment','bluebird','request-promise'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xb028,0x15a));var _0x8b02=function(_0x2bdd09,_0x4627f7){_0x2bdd09=_0x2bdd09-0x0;var _0x2728a6=_0xb028[_0x2bdd09];return _0x2728a6;};'use strict';var _=require(_0x8b02('0x0'));var util=require(_0x8b02('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8b02('0x2'));var BPromise=require(_0x8b02('0x3'));var rp=require(_0x8b02('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b02('0x5'));var config=require('../../config/environment');var attributes=require(_0x8b02('0x6'));module['exports']=function(_0x4fdf0f,_0x4b24f1){return _0x4fdf0f[_0x8b02('0x7')]('CloudProvider',attributes,{'tableName':_0x8b02('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96e1=['lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x96e1,0x90));var _0x196e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x96e1[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x196e('0x0'));var util=require(_0x196e('0x1'));var logger=require(_0x196e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x196e('0x3'));var rp=require(_0x196e('0x4'));var fs=require('fs');var path=require(_0x196e('0x5'));var rimraf=require('rimraf');var config=require(_0x196e('0x6'));var attributes=require('./cloudProvider.attributes');module[_0x196e('0x7')]=function(_0x5e0625,_0x19b473){return _0x5e0625['define']('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 78e94f0..57bc4b2 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 _0x3a39=['nonce','prompt','login','value','oauth2Claims','oauth2/','decode','payload','iss','issuer','audience','unix','resolve','then','data3','findOne','refresh_token','decryptString','POST','data2','data5','access_token','CloudProvider','update','data6','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','catch','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','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','push','data7','/.default','join','Outlook365','Dynamics365','replace','{TENANT_ID}','code','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state'];(function(_0x1f0658,_0x1e59e4){var _0x54edd3=function(_0x3d143f){while(--_0x3d143f){_0x1f0658['push'](_0x1f0658['shift']());}};_0x54edd3(++_0x1e59e4);}(_0x3a39,0x1cc));var _0x93a3=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x3a39[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x93a3('0x0'));var crypto=require('crypto');var jwt=require(_0x93a3('0x1'));var moment=require(_0x93a3('0x2'));var Redis=require(_0x93a3('0x3'));var rp=require(_0x93a3('0x4'));var util=require(_0x93a3('0x5'));var encryptor=require(_0x93a3('0x6'));var config=require('../../config/environment');var logger=require(_0x93a3('0x7'))(_0x93a3('0x8'));var schedule=require(_0x93a3('0x9'));var db=require(_0x93a3('0xa'))['db'];config[_0x93a3('0xb')]=_[_0x93a3('0xc')](config[_0x93a3('0xb')],{'host':_0x93a3('0xd'),'port':0x18eb});var redis=new Redis(config[_0x93a3('0xb')]);var MICROSOFT_AUTH_URL=_0x93a3('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0x93a3('0xf'),'profile',_0x93a3('0x10'),_0x93a3('0x11'),_0x93a3('0x12'),_0x93a3('0x13'),_0x93a3('0x14')],'Dynamics365':[_0x93a3('0xf'),_0x93a3('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0x93a3('0x15');var MICROSOFT_TOKEN_ENDPOINT=_0x93a3('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5aad7c){var _0x15b8cc=_[_0x93a3('0x17')](AZURE_AUTH_SCOPES[_0x5aad7c[_0x93a3('0x18')]]);if(_0x5aad7c[_0x93a3('0x18')]==='Dynamics365')_0x15b8cc[_0x93a3('0x19')](_0x5aad7c[_0x93a3('0x1a')]+_0x93a3('0x1b'));return _0x15b8cc[_0x93a3('0x1c')]('\x20');}function getAccessTokenScope(_0xee7e70){if(_0xee7e70[_0x93a3('0x18')]===_0x93a3('0x1d'))return _0x93a3('0x12');if(_0xee7e70[_0x93a3('0x18')]===_0x93a3('0x1e'))return _0xee7e70[_0x93a3('0x1a')]+_0x93a3('0x1b');}function generateMicrosoftAuthorizationUrl(_0x423184,_0xdda8a5){var _0x578f65=MICROSOFT_AUTH_URL[_0x93a3('0x1f')](_0x93a3('0x20'),_0x423184['data2']);var _0x4e8566=[_0x93a3('0x21'),_0x93a3('0x22')];var _0x199968=Buffer[_0x93a3('0x23')](JSON[_0x93a3('0x24')]({'id':_0xdda8a5}))[_0x93a3('0x25')](_0x93a3('0x26'));var _0x3f9c85=crypto[_0x93a3('0x27')](0x10)[_0x93a3('0x25')](_0x93a3('0x28'));var _0x5136d8=getAuthorizationScopes(_0x423184);var _0xe0e07a=[{'key':_0x93a3('0x29'),'value':_0x423184[_0x93a3('0x2a')]},{'key':_0x93a3('0x2b'),'value':encodeURIComponent(_0x4e8566[_0x93a3('0x1c')]('\x20'))},{'key':_0x93a3('0x2c'),'value':_0x423184[_0x93a3('0x2d')]},{'key':_0x93a3('0x2e'),'value':_0x93a3('0x2f')},{'key':_0x93a3('0x30'),'value':encodeURIComponent(_0x5136d8)},{'key':_0x93a3('0x31'),'value':_0x199968},{'key':_0x93a3('0x32'),'value':_0x3f9c85},{'key':_0x93a3('0x33'),'value':_0x93a3('0x34')}];var _0x5a40fa=_0x578f65+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x93a3('0x17')](_0xe0e07a,function(_0x3903a4){return _0x3903a4['key']+'='+_0x3903a4[_0x93a3('0x35')];})[_0x93a3('0x1c')]('&');_0x423184[_0x93a3('0x36')]={'issuer':_0x578f65['replace'](_0x93a3('0x37'),''),'audience':_0x423184[_0x93a3('0x2a')],'state':_0x199968,'nonce':_0x3f9c85};redis['set'](_0x199968,JSON[_0x93a3('0x24')](_0x423184));return _0x5a40fa;}function isValidIdToken(_0x47060d,_0x48aa98){try{var _0x1f2f88=jwt[_0x93a3('0x38')](_0x47060d,{'complete':!![]});var _0x4c4ddf=_0x1f2f88[_0x93a3('0x39')];if(_0x4c4ddf[_0x93a3('0x3a')]!==_0x48aa98[_0x93a3('0x3b')])return![];if(_0x4c4ddf['aud']!==_0x48aa98[_0x93a3('0x3c')])return![];if(_0x4c4ddf[_0x93a3('0x32')]!==_0x48aa98['nonce'])return![];if(moment()['isAfter'](moment[_0x93a3('0x3d')](_0x4c4ddf['exp'])))return![];return!![];}catch(_0x12577a){throw _0x12577a;}}function refreshOauth2MicrosoftAccessToken(_0x120edb){return Promise[_0x93a3('0x3e')]()[_0x93a3('0x3f')](function(){if(_0x120edb[_0x93a3('0x40')])return _0x120edb;return db['CloudProvider'][_0x93a3('0x41')]({'where':{'id':_0x120edb['id']},'raw':!![]});})[_0x93a3('0x3f')](function(_0x1b7dea){var _0x33b4db={'grant_type':_0x93a3('0x42'),'refresh_token':_0x1b7dea['data6'],'scope':getAccessTokenScope(_0x1b7dea),'redirect_uri':_0x1b7dea[_0x93a3('0x2d')],'client_id':_0x1b7dea[_0x93a3('0x2a')],'client_secret':encryptor[_0x93a3('0x43')](_0x1b7dea[_0x93a3('0x40')])};var _0x512281={'method':_0x93a3('0x44'),'uri':MICROSOFT_AUTH_URL[_0x93a3('0x1f')](_0x93a3('0x20'),_0x1b7dea[_0x93a3('0x45')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x33b4db,'json':!![]};return rp(_0x512281);})[_0x93a3('0x3f')](function(_0x21401d){_0x120edb[_0x93a3('0x46')]=_0x21401d[_0x93a3('0x47')];_0x120edb['data6']=_0x21401d[_0x93a3('0x42')];return db[_0x93a3('0x48')][_0x93a3('0x49')]({'data5':_0x120edb[_0x93a3('0x46')],'data6':_0x120edb[_0x93a3('0x4a')]},{'where':{'id':_0x120edb['id']}});})[_0x93a3('0x3f')](function(){return _0x120edb;})['catch'](function(_0x311236){logger[_0x93a3('0x4b')](_0x93a3('0x4c'),_0x120edb['id'],_0x311236);});}function getOauth2MicrosoftAccessToken(_0xa461ac,_0x21aaa9){var _0x26ee0f={'grant_type':_0x93a3('0x4d'),'code':_0xa461ac,'scope':getAccessTokenScope(_0x21aaa9),'redirect_uri':_0x21aaa9['data4'],'client_id':_0x21aaa9[_0x93a3('0x2a')],'client_secret':encryptor[_0x93a3('0x43')](_0x21aaa9[_0x93a3('0x40')])};var _0x350766={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x93a3('0x1f')]('{TENANT_ID}',_0x21aaa9[_0x93a3('0x45')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x26ee0f,'json':!![]};return rp(_0x350766);}function startRefreshInterval(_0x20ffbf){var _0x2da939=schedule[_0x93a3('0x4e')];if(_0x2da939[_0x20ffbf['id']])clearInterval(_0x2da939[_0x20ffbf['id']]);_0x2da939[_0x20ffbf['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x93a3('0x4f')](this,{'id':_0x20ffbf['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x2da939;}function startAllRefreshIntervals(){return db[_0x93a3('0x48')][_0x93a3('0x50')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x93a3('0x3f')](function(_0x23d9f1){var _0x5ce0e8=_0x23d9f1[_0x93a3('0x17')](function(_0x28c148){return refreshOauth2MicrosoftAccessToken(_0x28c148)[_0x93a3('0x3f')](function(_0x1a8cdc){startRefreshInterval(_0x1a8cdc);});});return Promise[_0x93a3('0x51')](_0x5ce0e8);})[_0x93a3('0x52')](function(_0x443bef){var _0x3235aa=_0x443bef?util['inspect'](_0x443bef,{'showHidden':![],'depth':null}):'';logger[_0x93a3('0x4b')](_0x93a3('0x53'),_0x3235aa);});}module[_0x93a3('0x54')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x589b=['/authorize','/token','type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace','{TENANT_ID}','id_token','from','toString','base64','randomBytes','hex','client_id','data1','data4','response_mode','form_post','scope','state','nonce','prompt','login','map','value','oauth2Claims','set','decode','payload','iss','isAfter','unix','exp','then','CloudProvider','findOne','refresh_token','data6','data2','access_token','update','data5','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data3','POST','intervals','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'];(function(_0x521b74,_0x3c9887){var _0x31dedf=function(_0x5b5d9c){while(--_0x5b5d9c){_0x521b74['push'](_0x521b74['shift']());}};_0x31dedf(++_0x3c9887);}(_0x589b,0x16e));var _0xb589=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x589b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb589('0x0'));var crypto=require(_0xb589('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0xb589('0x2'));var Redis=require(_0xb589('0x3'));var rp=require(_0xb589('0x4'));var util=require(_0xb589('0x5'));var encryptor=require(_0xb589('0x6'));var config=require(_0xb589('0x7'));var logger=require('../../config/logger')('api');var schedule=require(_0xb589('0x8'));var db=require(_0xb589('0x9'))['db'];config['redis']=_[_0xb589('0xa')](config[_0xb589('0xb')],{'host':_0xb589('0xc'),'port':0x18eb});var redis=new Redis(config[_0xb589('0xb')]);var MICROSOFT_AUTH_URL=_0xb589('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0xb589('0xe'),_0xb589('0xf'),'email',_0xb589('0x10'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0xb589('0x11'),_0xb589('0x12')],'Dynamics365':[_0xb589('0xe'),_0xb589('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0xb589('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0xb589('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5b12d8){var _0x15ecfd=_['map'](AZURE_AUTH_SCOPES[_0x5b12d8[_0xb589('0x15')]]);if(_0x5b12d8[_0xb589('0x15')]===_0xb589('0x16'))_0x15ecfd[_0xb589('0x17')](_0x5b12d8[_0xb589('0x18')]+_0xb589('0x19'));return _0x15ecfd[_0xb589('0x1a')]('\x20');}function getAccessTokenScope(_0xf320e8){if(_0xf320e8[_0xb589('0x15')]===_0xb589('0x1b'))return _0xb589('0x1c');if(_0xf320e8[_0xb589('0x15')]===_0xb589('0x16'))return _0xf320e8[_0xb589('0x18')]+_0xb589('0x19');}function generateMicrosoftAuthorizationUrl(_0x39cb99,_0x25e88a){var _0x64fff1=MICROSOFT_AUTH_URL[_0xb589('0x1d')](_0xb589('0x1e'),_0x39cb99['data2']);var _0x3545d2=['code',_0xb589('0x1f')];var _0x51c121=Buffer[_0xb589('0x20')](JSON['stringify']({'id':_0x25e88a}))[_0xb589('0x21')](_0xb589('0x22'));var _0x1ab46a=crypto[_0xb589('0x23')](0x10)[_0xb589('0x21')](_0xb589('0x24'));var _0x487187=getAuthorizationScopes(_0x39cb99);var _0x18f502=[{'key':_0xb589('0x25'),'value':_0x39cb99[_0xb589('0x26')]},{'key':'response_type','value':encodeURIComponent(_0x3545d2[_0xb589('0x1a')]('\x20'))},{'key':'redirect_uri','value':_0x39cb99[_0xb589('0x27')]},{'key':_0xb589('0x28'),'value':_0xb589('0x29')},{'key':_0xb589('0x2a'),'value':encodeURIComponent(_0x487187)},{'key':_0xb589('0x2b'),'value':_0x51c121},{'key':_0xb589('0x2c'),'value':_0x1ab46a},{'key':_0xb589('0x2d'),'value':_0xb589('0x2e')}];var _0x34df1c=_0x64fff1+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb589('0x2f')](_0x18f502,function(_0x36d708){return _0x36d708['key']+'='+_0x36d708[_0xb589('0x30')];})[_0xb589('0x1a')]('&');_0x39cb99[_0xb589('0x31')]={'issuer':_0x64fff1['replace']('oauth2/',''),'audience':_0x39cb99[_0xb589('0x26')],'state':_0x51c121,'nonce':_0x1ab46a};redis[_0xb589('0x32')](_0x51c121,JSON['stringify'](_0x39cb99));return _0x34df1c;}function isValidIdToken(_0x4107d6,_0xbc6ba8){try{var _0x762b35=jwt[_0xb589('0x33')](_0x4107d6,{'complete':!![]});var _0xe55c05=_0x762b35[_0xb589('0x34')];if(_0xe55c05[_0xb589('0x35')]!==_0xbc6ba8['issuer'])return![];if(_0xe55c05['aud']!==_0xbc6ba8['audience'])return![];if(_0xe55c05['nonce']!==_0xbc6ba8[_0xb589('0x2c')])return![];if(moment()[_0xb589('0x36')](moment[_0xb589('0x37')](_0xe55c05[_0xb589('0x38')])))return![];return!![];}catch(_0x4b3be3){throw _0x4b3be3;}}function refreshOauth2MicrosoftAccessToken(_0x11bba9){return Promise['resolve']()[_0xb589('0x39')](function(){if(_0x11bba9['data3'])return _0x11bba9;return db[_0xb589('0x3a')][_0xb589('0x3b')]({'where':{'id':_0x11bba9['id']},'raw':!![]});})[_0xb589('0x39')](function(_0x1fa1f9){var _0x35e946={'grant_type':_0xb589('0x3c'),'refresh_token':_0x1fa1f9[_0xb589('0x3d')],'scope':getAccessTokenScope(_0x1fa1f9),'redirect_uri':_0x1fa1f9[_0xb589('0x27')],'client_id':_0x1fa1f9['data1'],'client_secret':encryptor['decryptString'](_0x1fa1f9['data3'])};var _0x2fa5f6={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xb589('0x1d')]('{TENANT_ID}',_0x1fa1f9[_0xb589('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x35e946,'json':!![]};return rp(_0x2fa5f6);})[_0xb589('0x39')](function(_0xc0786){_0x11bba9['data5']=_0xc0786[_0xb589('0x3f')];_0x11bba9[_0xb589('0x3d')]=_0xc0786[_0xb589('0x3c')];return db[_0xb589('0x3a')][_0xb589('0x40')]({'data5':_0x11bba9[_0xb589('0x41')],'data6':_0x11bba9[_0xb589('0x3d')]},{'where':{'id':_0x11bba9['id']}});})[_0xb589('0x39')](function(){return _0x11bba9;})[_0xb589('0x42')](function(_0x4c7a95){logger['error'](_0xb589('0x43'),_0x11bba9['id'],_0x4c7a95);});}function getOauth2MicrosoftAccessToken(_0x54a185,_0x5a064c){var _0x332b95={'grant_type':_0xb589('0x44'),'code':_0x54a185,'scope':getAccessTokenScope(_0x5a064c),'redirect_uri':_0x5a064c[_0xb589('0x27')],'client_id':_0x5a064c['data1'],'client_secret':encryptor['decryptString'](_0x5a064c[_0xb589('0x45')])};var _0x44ad9c={'method':_0xb589('0x46'),'uri':MICROSOFT_AUTH_URL[_0xb589('0x1d')]('{TENANT_ID}',_0x5a064c[_0xb589('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x332b95,'json':!![]};return rp(_0x44ad9c);}function startRefreshInterval(_0x1c4fc0){var _0x4db916=schedule[_0xb589('0x47')];if(_0x4db916[_0x1c4fc0['id']])clearInterval(_0x4db916[_0x1c4fc0['id']]);_0x4db916[_0x1c4fc0['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x1c4fc0['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb589('0x47')]=_0x4db916;}function startAllRefreshIntervals(){return db[_0xb589('0x3a')][_0xb589('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x391e59){var _0x5ccb4c=_0x391e59['map'](function(_0x5afdca){return refreshOauth2MicrosoftAccessToken(_0x5afdca)[_0xb589('0x39')](function(_0x38fb2d){startRefreshInterval(_0x38fb2d);});});return Promise[_0xb589('0x49')](_0x5ccb4c);})[_0xb589('0x42')](function(_0x4add2e){var _0x35aa5b=_0x4add2e?util[_0xb589('0x4a')](_0x4add2e,{'showHidden':![],'depth':null}):'';logger[_0xb589('0x4b')](_0xb589('0x4c'),_0x35aa5b);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index e455788..f918bda 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 _0xdec3=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0xf41c01,_0x533dbf){var _0x332a52=function(_0x2ebdab){while(--_0x2ebdab){_0xf41c01['push'](_0xf41c01['shift']());}};_0x332a52(++_0x533dbf);}(_0xdec3,0x89));var _0x3dec=function(_0x4de749,_0xfd26c4){_0x4de749=_0x4de749-0x0;var _0x11855b=_0xdec3[_0x4de749];return _0x11855b;};'use strict';var _=require(_0x3dec('0x0'));var util=require('util');var moment=require(_0x3dec('0x1'));var BPromise=require(_0x3dec('0x2'));var rs=require(_0x3dec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3dec('0x4'))['db'];var utils=require(_0x3dec('0x5'));var logger=require(_0x3dec('0x6'))(_0x3dec('0x7'));var config=require('../../config/environment');var jayson=require(_0x3dec('0x8'));var client=jayson[_0x3dec('0x9')][_0x3dec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd3208e,_0x1826ab,_0x311a74){return new BPromise(function(_0x207dcf,_0x4b32d2){return client[_0x3dec('0xb')](_0xd3208e,_0x311a74)[_0x3dec('0xc')](function(_0x599552){logger[_0x3dec('0xd')]('CloudProvider,\x20%s,\x20%s',_0x1826ab,'request\x20sent');logger[_0x3dec('0xe')](_0x3dec('0xf'),_0x1826ab,'request\x20sent',JSON[_0x3dec('0x10')](_0x599552));if(_0x599552[_0x3dec('0x11')]){if(_0x599552['error'][_0x3dec('0x12')]===0x1f4){logger[_0x3dec('0x11')](_0x3dec('0x13'),_0x1826ab,_0x599552[_0x3dec('0x11')][_0x3dec('0x14')]);return _0x4b32d2(_0x599552[_0x3dec('0x11')]['message']);}logger['error'](_0x3dec('0x13'),_0x1826ab,_0x599552['error'][_0x3dec('0x14')]);return _0x207dcf(_0x599552[_0x3dec('0x11')]['message']);}else{logger['info'](_0x3dec('0x13'),_0x1826ab,'request\x20sent');_0x207dcf(_0x599552[_0x3dec('0x15')]['message']);}})[_0x3dec('0x16')](function(_0x51cb2c){logger[_0x3dec('0x11')](_0x3dec('0x13'),_0x1826ab,_0x51cb2c);_0x4b32d2(_0x51cb2c);});});} \ No newline at end of file +var _0xd7d1=['info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x16e4c4,_0x1e67a1){var _0x2896fe=function(_0x47429a){while(--_0x47429a){_0x16e4c4['push'](_0x16e4c4['shift']());}};_0x2896fe(++_0x1e67a1);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x2b96ed,_0x38ebf5){_0x2b96ed=_0x2b96ed-0x0;var _0x43a96a=_0xd7d1[_0x2b96ed];return _0x43a96a;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('CloudProvider,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index f12dd96..9be6a5b 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 _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x420513,_0x30eae3){var _0x1b44ec=function(_0x644f88){while(--_0x644f88){_0x420513['push'](_0x420513['shift']());}};_0x1b44ec(++_0x30eae3);}(_0x1261,0x144));var _0x1126=function(_0xe5d54f,_0x143d93){_0xe5d54f=_0xe5d54f-0x0;var _0x2a74bf=_0x1261[_0xe5d54f];return _0x2a74bf;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x7a54,0x106));var _0x47a5=function(_0x4596de,_0x555149){_0x4596de=_0x4596de-0x0;var _0x43d186=_0x7a54[_0x4596de];return _0x43d186;};'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 41fa2af..6accb4d 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 _0x1be9=['name','sequelize','exports','STRING'];(function(_0x1babb3,_0x4fe096){var _0x4f71ff=function(_0x350be1){while(--_0x350be1){_0x1babb3['push'](_0x1babb3['shift']());}};_0x4f71ff(++_0x4fe096);}(_0x1be9,0x13d));var _0x91be=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x1be9[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0x91be('0x0'));module[_0x91be('0x1')]={'name':{'type':Sequelize[_0x91be('0x2')],'unique':_0x91be('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x91be('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x91be('0x2')]},'phone':{'type':Sequelize[_0x91be('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x91be('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x91be('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x91be('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x91be('0x2')]},'sPostalCode':{'type':Sequelize[_0x91be('0x2')]},'sCity':{'type':Sequelize[_0x91be('0x2')]},'sCountry':{'type':Sequelize[_0x91be('0x2')]},'description':{'type':Sequelize[_0x91be('0x2')]}}; \ No newline at end of file +var _0x3f1a=['STRING','exports','name'];(function(_0x480f89,_0x5d304d){var _0x53400e=function(_0x36532d){while(--_0x36532d){_0x480f89['push'](_0x480f89['shift']());}};_0x53400e(++_0x5d304d);}(_0x3f1a,0x145));var _0xa3f1=function(_0x1d10c7,_0x50b734){_0x1d10c7=_0x1d10c7-0x0;var _0x4c5881=_0x3f1a[_0x1d10c7];return _0x4c5881;};'use strict';var Sequelize=require('sequelize');module[_0xa3f1('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xa3f1('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xa3f1('0x2')]},'companyId':{'type':Sequelize[_0xa3f1('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa3f1('0x2')]},'fax':{'type':Sequelize[_0xa3f1('0x2')]},'type':{'type':Sequelize[_0xa3f1('0x2')]},'street':{'type':Sequelize[_0xa3f1('0x2')]},'postalCode':{'type':Sequelize[_0xa3f1('0x2')]},'city':{'type':Sequelize[_0xa3f1('0x2')]},'country':{'type':Sequelize[_0xa3f1('0x2')]},'email':{'type':Sequelize[_0xa3f1('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xa3f1('0x2')]},'sStreet':{'type':Sequelize[_0xa3f1('0x2')]},'sPostalCode':{'type':Sequelize[_0xa3f1('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xa3f1('0x2')]},'description':{'type':Sequelize[_0xa3f1('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index de7fafc..29260b8 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 _0x36ee=['where','filter','includeAll','include','findAll','rows','catch','rawAttributes','merge','options','find','create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','CmContact','addContacts','ids','findOne','sort','getContacts','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick'];(function(_0x860a8,_0x1dacd8){var _0x5ab5ae=function(_0x547a0a){while(--_0x547a0a){_0x860a8['push'](_0x860a8['shift']());}};_0x5ab5ae(++_0x1dacd8);}(_0x36ee,0x123));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xe36e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x1'));var jsonpatch=require(_0xe36e('0x2'));var rp=require(_0xe36e('0x3'));var moment=require('moment');var BPromise=require(_0xe36e('0x4'));var Mustache=require('mustache');var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require(_0xe36e('0xd'));var jsforce=require(_0xe36e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require('querystring');var Papa=require(_0xe36e('0xf'));var Redis=require(_0xe36e('0x10'));var authService=require(_0xe36e('0x11'));var qs=require(_0xe36e('0x12'));var as=require(_0xe36e('0x13'));var hardwareService=require(_0xe36e('0x14'));var logger=require('../../config/logger')(_0xe36e('0x15'));var utils=require(_0xe36e('0x16'));var config=require(_0xe36e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe36e('0x18'))['db'];function respondWithStatusCode(_0x59eef2,_0x2a2df9){_0x2a2df9=_0x2a2df9||0xcc;return function(_0x18e39c){if(_0x18e39c){return _0x59eef2[_0xe36e('0x19')](_0x2a2df9);}return _0x59eef2[_0xe36e('0x1a')](_0x2a2df9)[_0xe36e('0x1b')]();};}function respondWithResult(_0x21cbb3,_0x4a5db6){_0x4a5db6=_0x4a5db6||0xc8;return function(_0xc9d0ca){if(_0xc9d0ca){return _0x21cbb3['status'](_0x4a5db6)[_0xe36e('0x1c')](_0xc9d0ca);}};}function respondWithFilteredResult(_0xceb981,_0x5ca0f1){return function(_0x5640d0){if(_0x5640d0){var _0x31e25e=typeof _0x5ca0f1[_0xe36e('0x1d')]==='undefined'&&typeof _0x5ca0f1['limit']===_0xe36e('0x1e');var _0x55bb97=_0x5640d0[_0xe36e('0x1f')];var _0x2e7747=_0x31e25e?0x0:_0x5ca0f1[_0xe36e('0x1d')];var _0x197dd5=_0x31e25e?_0x5640d0[_0xe36e('0x1f')]:_0x5ca0f1[_0xe36e('0x1d')]+_0x5ca0f1[_0xe36e('0x20')];var _0x1b7a98;if(_0x197dd5>=_0x55bb97){_0x197dd5=_0x55bb97;_0x1b7a98=0xc8;}else{_0x1b7a98=0xce;}_0xceb981[_0xe36e('0x1a')](_0x1b7a98);return _0xceb981[_0xe36e('0x21')](_0xe36e('0x22'),_0x2e7747+'-'+_0x197dd5+'/'+_0x55bb97)[_0xe36e('0x1c')](_0x5640d0);}return null;};}function patchUpdates(_0x4b880a){return function(_0x1cf0ea){try{jsonpatch[_0xe36e('0x23')](_0x1cf0ea,_0x4b880a,!![]);}catch(_0x205ebc){return BPromise[_0xe36e('0x24')](_0x205ebc);}return _0x1cf0ea[_0xe36e('0x25')]();};}function saveUpdates(_0x5ca115,_0x5f1991){return function(_0x4b07ce){if(_0x4b07ce){return _0x4b07ce[_0xe36e('0x26')](_0x5ca115)[_0xe36e('0x27')](function(_0x56b3cd){return _0x56b3cd;});}return null;};}function removeEntity(_0x383abd,_0xb5a3a0){return function(_0x1ec2e0){if(_0x1ec2e0){return _0x1ec2e0[_0xe36e('0x28')]()[_0xe36e('0x27')](function(){var _0x5d7173=_0x1ec2e0['get']({'plain':!![]});var _0xb1f015=_0xe36e('0x29');return db[_0xe36e('0x2a')][_0xe36e('0x28')]({'where':{'type':_0xb1f015,'resourceId':_0x5d7173['id']}})[_0xe36e('0x27')](function(){return _0x1ec2e0;});})[_0xe36e('0x27')](function(){_0x383abd['status'](0xcc)[_0xe36e('0x1b')]();});}};}function handleEntityNotFound(_0x50044d,_0x5b9d19){return function(_0x6575fd){if(!_0x6575fd){_0x50044d[_0xe36e('0x19')](0x194);}return _0x6575fd;};}function handleError(_0x309de1,_0x133408){_0x133408=_0x133408||0x1f4;return function(_0x308dfe){logger[_0xe36e('0x2b')](_0x308dfe[_0xe36e('0x2c')]);if(_0x308dfe[_0xe36e('0x2d')]){delete _0x308dfe[_0xe36e('0x2d')];}_0x309de1[_0xe36e('0x1a')](_0x133408)[_0xe36e('0x2e')](_0x308dfe);};}exports[_0xe36e('0x2f')]=function(_0x187907,_0x368ab9){var _0x13b339={},_0x1d81af={},_0x5679cd={'count':0x0,'rows':[]};return db[_0xe36e('0x30')]['describe']()[_0xe36e('0x27')](function(_0x49ba91){_0x1d81af[_0xe36e('0x31')]=_['keys'](_0x49ba91);_0x1d81af[_0xe36e('0x32')]=_[_0xe36e('0x33')](_0x187907[_0xe36e('0x32')]);_0x1d81af[_0xe36e('0x34')]=_[_0xe36e('0x35')](_0x1d81af['model'],_0x1d81af[_0xe36e('0x32')]);_0x13b339['attributes']=_['intersection'](_0x1d81af[_0xe36e('0x31')],qs[_0xe36e('0x36')](_0x187907[_0xe36e('0x32')]['fields']));_0x13b339[_0xe36e('0x37')]=_0x13b339[_0xe36e('0x37')][_0xe36e('0x38')]?_0x13b339[_0xe36e('0x37')]:_0x1d81af['model'];if(!_0x187907[_0xe36e('0x32')][_0xe36e('0x39')](_0xe36e('0x3a'))){_0x13b339[_0xe36e('0x20')]=qs[_0xe36e('0x20')](_0x187907[_0xe36e('0x32')][_0xe36e('0x20')]);_0x13b339['offset']=qs[_0xe36e('0x1d')](_0x187907[_0xe36e('0x32')][_0xe36e('0x1d')]);}_0x13b339[_0xe36e('0x3b')]=qs['sort'](_0x187907[_0xe36e('0x32')]['sort']);_0x13b339['where']=qs[_0xe36e('0x34')](_[_0xe36e('0x3c')](_0x187907[_0xe36e('0x32')],_0x1d81af[_0xe36e('0x34')]),_0x49ba91);if(_0x187907[_0xe36e('0x32')]['filter']){_0x13b339[_0xe36e('0x3d')]=_['merge'](_0x13b339['where'],{'$or':_['map'](_0x13b339[_0xe36e('0x37')],function(_0x537ced){var _0x383dbe={};_0x383dbe[_0x537ced]={'$like':'%'+_0x187907['query'][_0xe36e('0x3e')]+'%'};return _0x383dbe;})});}_0x13b339=_['merge']({},_0x13b339,_0x187907['options']);var _0x254257={'where':_0x13b339[_0xe36e('0x3d')]};return db[_0xe36e('0x30')][_0xe36e('0x1f')](_0x254257)[_0xe36e('0x27')](function(_0x5bd3f){_0x5679cd[_0xe36e('0x1f')]=_0x5bd3f;if(_0x187907[_0xe36e('0x32')][_0xe36e('0x3f')]){_0x13b339[_0xe36e('0x40')]=[{'all':!![]}];}return db[_0xe36e('0x30')][_0xe36e('0x41')](_0x13b339);})['then'](function(_0x22cf5a){_0x5679cd[_0xe36e('0x42')]=_0x22cf5a;return _0x5679cd;})[_0xe36e('0x27')](respondWithFilteredResult(_0x368ab9,_0x13b339))[_0xe36e('0x43')](handleError(_0x368ab9,null));})['catch'](handleError(_0x368ab9,null));};exports['show']=function(_0x1c449f,_0x2f5614){var _0x44bf41={'raw':![],'where':{'id':_0x1c449f['params']['id']}},_0x3bd4b7={};_0x3bd4b7[_0xe36e('0x31')]=_['keys'](db[_0xe36e('0x30')][_0xe36e('0x44')]);_0x3bd4b7[_0xe36e('0x32')]=_['keys'](_0x1c449f[_0xe36e('0x32')]);_0x3bd4b7[_0xe36e('0x34')]=_[_0xe36e('0x35')](_0x3bd4b7[_0xe36e('0x31')],_0x3bd4b7['query']);_0x44bf41[_0xe36e('0x37')]=_[_0xe36e('0x35')](_0x3bd4b7[_0xe36e('0x31')],qs[_0xe36e('0x36')](_0x1c449f[_0xe36e('0x32')][_0xe36e('0x36')]));_0x44bf41[_0xe36e('0x37')]=_0x44bf41[_0xe36e('0x37')][_0xe36e('0x38')]?_0x44bf41[_0xe36e('0x37')]:_0x3bd4b7[_0xe36e('0x31')];if(_0x1c449f['query']['includeAll']){_0x44bf41['include']=[{'all':!![]}];}_0x44bf41=_[_0xe36e('0x45')]({},_0x44bf41,_0x1c449f[_0xe36e('0x46')]);return db[_0xe36e('0x30')][_0xe36e('0x47')](_0x44bf41)[_0xe36e('0x27')](handleEntityNotFound(_0x2f5614,null))[_0xe36e('0x27')](respondWithResult(_0x2f5614,null))[_0xe36e('0x43')](handleError(_0x2f5614,null));};exports[_0xe36e('0x48')]=function(_0x31ae6c,_0x45331f){return db[_0xe36e('0x30')][_0xe36e('0x48')](_0x31ae6c[_0xe36e('0x49')],{})[_0xe36e('0x27')](function(_0x38d656){var _0xe2788d=_0x31ae6c[_0xe36e('0x4a')][_0xe36e('0x4b')]({'plain':!![]});if(!_0xe2788d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe2788d[_0xe36e('0x4c')]===_0xe36e('0x4a')){var _0x17a849=_0x38d656['get']({'plain':!![]});var _0x2b7594=_0xe36e('0x29');return db[_0xe36e('0x4d')]['find']({'where':{'name':_0x2b7594,'userProfileId':_0xe2788d[_0xe36e('0x4e')]},'raw':!![]})[_0xe36e('0x27')](function(_0x2abd02){if(_0x2abd02&&_0x2abd02['autoAssociation']===0x0){return db[_0xe36e('0x2a')][_0xe36e('0x48')]({'name':_0x17a849[_0xe36e('0x2d')],'resourceId':_0x17a849['id'],'type':_0x2abd02[_0xe36e('0x2d')],'sectionId':_0x2abd02['id']},{})[_0xe36e('0x27')](function(){return _0x38d656;});}else{return _0x38d656;}})['catch'](function(_0x1e48b3){logger[_0xe36e('0x2b')](_0xe36e('0x4f'),_0x1e48b3);throw _0x1e48b3;});}return _0x38d656;})['then'](respondWithResult(_0x45331f,0xc9))[_0xe36e('0x43')](handleError(_0x45331f,null));};exports['update']=function(_0x2b9e13,_0x47d54b){if(_0x2b9e13[_0xe36e('0x49')]['id']){delete _0x2b9e13['body']['id'];}return db[_0xe36e('0x30')][_0xe36e('0x47')]({'where':{'id':_0x2b9e13[_0xe36e('0x50')]['id']}})[_0xe36e('0x27')](handleEntityNotFound(_0x47d54b,null))[_0xe36e('0x27')](saveUpdates(_0x2b9e13[_0xe36e('0x49')],null))[_0xe36e('0x27')](respondWithResult(_0x47d54b,null))['catch'](handleError(_0x47d54b,null));};exports[_0xe36e('0x28')]=function(_0x1ca093,_0x40a049){return db[_0xe36e('0x30')][_0xe36e('0x47')]({'where':{'id':_0x1ca093[_0xe36e('0x50')]['id']}})['then'](handleEntityNotFound(_0x40a049,null))[_0xe36e('0x27')](removeEntity(_0x40a049,null))[_0xe36e('0x43')](handleError(_0x40a049,null));};exports[_0xe36e('0x51')]=function(_0x4edd2c,_0x3b8aad){return db[_0xe36e('0x30')][_0xe36e('0x51')]()[_0xe36e('0x27')](respondWithResult(_0x3b8aad,null))[_0xe36e('0x43')](handleError(_0x3b8aad,null));};exports['addContacts']=function(_0x566cee,_0x35fa21,_0x3477ae){return db[_0xe36e('0x52')][_0xe36e('0x47')]({'where':{'id':_0x566cee[_0xe36e('0x50')]['id']}})[_0xe36e('0x27')](handleEntityNotFound(_0x35fa21,null))['then'](function(_0x578946){if(_0x578946){return _0x578946[_0xe36e('0x53')](_0x566cee[_0xe36e('0x49')][_0xe36e('0x54')],_['omit'](_0x566cee[_0xe36e('0x49')],['ids','id'])||{});}})[_0xe36e('0x27')](respondWithResult(_0x35fa21,null))[_0xe36e('0x43')](handleError(_0x35fa21,null));};exports['getContacts']=function(_0x59a6f2,_0x5db35f,_0x12a528){var _0x7b1f26={};var _0x3dc432={};var _0x193df2;var _0x1e9385;return db['CmCompany'][_0xe36e('0x55')]({'where':{'id':_0x59a6f2[_0xe36e('0x50')]['id']}})[_0xe36e('0x27')](handleEntityNotFound(_0x5db35f,null))['then'](function(_0x589ca6){if(_0x589ca6){_0x193df2=_0x589ca6;_0x3dc432['model']=_[_0xe36e('0x33')](db[_0xe36e('0x52')][_0xe36e('0x44')]);_0x3dc432[_0xe36e('0x32')]=_[_0xe36e('0x33')](_0x59a6f2[_0xe36e('0x32')]);_0x3dc432[_0xe36e('0x34')]=_[_0xe36e('0x35')](_0x3dc432[_0xe36e('0x31')],_0x3dc432['query']);_0x7b1f26[_0xe36e('0x37')]=_[_0xe36e('0x35')](_0x3dc432['model'],qs[_0xe36e('0x36')](_0x59a6f2[_0xe36e('0x32')][_0xe36e('0x36')]));_0x7b1f26[_0xe36e('0x37')]=_0x7b1f26[_0xe36e('0x37')][_0xe36e('0x38')]?_0x7b1f26['attributes']:_0x3dc432[_0xe36e('0x31')];_0x7b1f26['order']=qs['sort'](_0x59a6f2[_0xe36e('0x32')][_0xe36e('0x56')]);_0x7b1f26['where']=qs[_0xe36e('0x34')](_[_0xe36e('0x3c')](_0x59a6f2['query'],_0x3dc432[_0xe36e('0x34')]));if(_0x59a6f2[_0xe36e('0x32')][_0xe36e('0x3e')]){_0x7b1f26[_0xe36e('0x3d')]=_[_0xe36e('0x45')](_0x7b1f26['where'],{'$or':_['map'](_0x7b1f26[_0xe36e('0x37')],function(_0x210f33){var _0xf806f8={};_0xf806f8[_0x210f33]={'$like':'%'+_0x59a6f2[_0xe36e('0x32')][_0xe36e('0x3e')]+'%'};return _0xf806f8;})});}_0x7b1f26=_['merge']({},_0x7b1f26,_0x59a6f2[_0xe36e('0x46')]);return _0x193df2[_0xe36e('0x57')](_0x7b1f26);}})['then'](function(_0x489bce){if(_0x489bce){_0x1e9385=_0x489bce[_0xe36e('0x38')];if(!_0x59a6f2[_0xe36e('0x32')]['hasOwnProperty']('nolimit')){_0x7b1f26[_0xe36e('0x20')]=qs['limit'](_0x59a6f2[_0xe36e('0x32')]['limit']);_0x7b1f26[_0xe36e('0x1d')]=qs[_0xe36e('0x1d')](_0x59a6f2[_0xe36e('0x32')][_0xe36e('0x1d')]);}return _0x193df2[_0xe36e('0x57')](_0x7b1f26);}})[_0xe36e('0x27')](function(_0x5148de){if(_0x5148de){return _0x5148de?{'count':_0x1e9385,'rows':_0x5148de}:null;}})[_0xe36e('0x27')](respondWithResult(_0x5db35f,null))[_0xe36e('0x43')](handleError(_0x5db35f,null));}; \ No newline at end of file +var _0x60d5=['params','intersection','fields','length','include','find','create','body','user','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','CmContact','ids','rawAttributes','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','end','json','undefined','limit','offset','status','set','Content-Range','reject','then','destroy','get','Companies','stack','name','index','CmCompany','describe','model','keys','query','filters','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','findAll','rows','catch','show'];(function(_0x2ec438,_0x4c25e2){var _0x3d1baa=function(_0x59f81c){while(--_0x59f81c){_0x2ec438['push'](_0x2ec438['shift']());}};_0x3d1baa(++_0x4c25e2);}(_0x60d5,0x16f));var _0x560d=function(_0x55c747,_0xc8e95a){_0x55c747=_0x55c747-0x0;var _0xb7c5c=_0x60d5[_0x55c747];return _0xb7c5c;};'use strict';var emlformat=require(_0x560d('0x0'));var rimraf=require(_0x560d('0x1'));var zipdir=require(_0x560d('0x2'));var jsonpatch=require(_0x560d('0x3'));var rp=require(_0x560d('0x4'));var moment=require(_0x560d('0x5'));var BPromise=require(_0x560d('0x6'));var Mustache=require(_0x560d('0x7'));var util=require(_0x560d('0x8'));var path=require(_0x560d('0x9'));var sox=require(_0x560d('0xa'));var csv=require(_0x560d('0xb'));var ejs=require(_0x560d('0xc'));var fs=require('fs');var fs_extra=require(_0x560d('0xd'));var _=require(_0x560d('0xe'));var squel=require(_0x560d('0xf'));var crypto=require(_0x560d('0x10'));var jsforce=require(_0x560d('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x560d('0xb'));var querystring=require(_0x560d('0x12'));var Papa=require(_0x560d('0x13'));var Redis=require(_0x560d('0x14'));var authService=require(_0x560d('0x15'));var qs=require(_0x560d('0x16'));var as=require(_0x560d('0x17'));var hardwareService=require(_0x560d('0x18'));var logger=require(_0x560d('0x19'))('api');var utils=require(_0x560d('0x1a'));var config=require(_0x560d('0x1b'));var licenseUtil=require(_0x560d('0x1c'));var db=require(_0x560d('0x1d'))['db'];function respondWithStatusCode(_0x558361,_0xf29b00){_0xf29b00=_0xf29b00||0xcc;return function(_0x47952b){if(_0x47952b){return _0x558361['sendStatus'](_0xf29b00);}return _0x558361['status'](_0xf29b00)[_0x560d('0x1e')]();};}function respondWithResult(_0x3ce734,_0x2a8a9c){_0x2a8a9c=_0x2a8a9c||0xc8;return function(_0x74280d){if(_0x74280d){return _0x3ce734['status'](_0x2a8a9c)[_0x560d('0x1f')](_0x74280d);}};}function respondWithFilteredResult(_0xc31961,_0x18ad09){return function(_0x5e462d){if(_0x5e462d){var _0x396136=typeof _0x18ad09['offset']===_0x560d('0x20')&&typeof _0x18ad09[_0x560d('0x21')]===_0x560d('0x20');var _0x4210bf=_0x5e462d['count'];var _0x1d9236=_0x396136?0x0:_0x18ad09[_0x560d('0x22')];var _0x22df66=_0x396136?_0x5e462d['count']:_0x18ad09[_0x560d('0x22')]+_0x18ad09[_0x560d('0x21')];var _0x3d6f13;if(_0x22df66>=_0x4210bf){_0x22df66=_0x4210bf;_0x3d6f13=0xc8;}else{_0x3d6f13=0xce;}_0xc31961[_0x560d('0x23')](_0x3d6f13);return _0xc31961[_0x560d('0x24')](_0x560d('0x25'),_0x1d9236+'-'+_0x22df66+'/'+_0x4210bf)[_0x560d('0x1f')](_0x5e462d);}return null;};}function patchUpdates(_0x155dab){return function(_0x2d6763){try{jsonpatch['apply'](_0x2d6763,_0x155dab,!![]);}catch(_0x4624f6){return BPromise[_0x560d('0x26')](_0x4624f6);}return _0x2d6763['save']();};}function saveUpdates(_0x47db16,_0x228b62){return function(_0x3810eb){if(_0x3810eb){return _0x3810eb['update'](_0x47db16)[_0x560d('0x27')](function(_0x591c0d){return _0x591c0d;});}return null;};}function removeEntity(_0x508f59,_0xe42cce){return function(_0xf873fd){if(_0xf873fd){return _0xf873fd[_0x560d('0x28')]()[_0x560d('0x27')](function(){var _0x27877e=_0xf873fd[_0x560d('0x29')]({'plain':!![]});var _0x4f7779=_0x560d('0x2a');return db['UserProfileResource'][_0x560d('0x28')]({'where':{'type':_0x4f7779,'resourceId':_0x27877e['id']}})[_0x560d('0x27')](function(){return _0xf873fd;});})[_0x560d('0x27')](function(){_0x508f59[_0x560d('0x23')](0xcc)[_0x560d('0x1e')]();});}};}function handleEntityNotFound(_0x4b49ba,_0x5e32d2){return function(_0x5769e3){if(!_0x5769e3){_0x4b49ba['sendStatus'](0x194);}return _0x5769e3;};}function handleError(_0x406bd9,_0x455b86){_0x455b86=_0x455b86||0x1f4;return function(_0x13206c){logger['error'](_0x13206c[_0x560d('0x2b')]);if(_0x13206c[_0x560d('0x2c')]){delete _0x13206c['name'];}_0x406bd9[_0x560d('0x23')](_0x455b86)['send'](_0x13206c);};}exports[_0x560d('0x2d')]=function(_0x383e10,_0x4f940d){var _0xcc988={},_0x560114={},_0x263ec7={'count':0x0,'rows':[]};return db[_0x560d('0x2e')][_0x560d('0x2f')]()['then'](function(_0x47acb4){_0x560114[_0x560d('0x30')]=_[_0x560d('0x31')](_0x47acb4);_0x560114[_0x560d('0x32')]=_[_0x560d('0x31')](_0x383e10[_0x560d('0x32')]);_0x560114[_0x560d('0x33')]=_['intersection'](_0x560114[_0x560d('0x30')],_0x560114[_0x560d('0x32')]);_0xcc988[_0x560d('0x34')]=_['intersection'](_0x560114[_0x560d('0x30')],qs['fields'](_0x383e10[_0x560d('0x32')]['fields']));_0xcc988[_0x560d('0x34')]=_0xcc988[_0x560d('0x34')]['length']?_0xcc988[_0x560d('0x34')]:_0x560114['model'];if(!_0x383e10[_0x560d('0x32')][_0x560d('0x35')](_0x560d('0x36'))){_0xcc988[_0x560d('0x21')]=qs['limit'](_0x383e10['query'][_0x560d('0x21')]);_0xcc988[_0x560d('0x22')]=qs[_0x560d('0x22')](_0x383e10[_0x560d('0x32')]['offset']);}_0xcc988[_0x560d('0x37')]=qs[_0x560d('0x38')](_0x383e10[_0x560d('0x32')][_0x560d('0x38')]);_0xcc988['where']=qs[_0x560d('0x33')](_[_0x560d('0x39')](_0x383e10[_0x560d('0x32')],_0x560114['filters']),_0x47acb4);if(_0x383e10[_0x560d('0x32')][_0x560d('0x3a')]){_0xcc988[_0x560d('0x3b')]=_[_0x560d('0x3c')](_0xcc988[_0x560d('0x3b')],{'$or':_['map'](_0xcc988[_0x560d('0x34')],function(_0x3e2d91){var _0x545386={};_0x545386[_0x3e2d91]={'$like':'%'+_0x383e10[_0x560d('0x32')][_0x560d('0x3a')]+'%'};return _0x545386;})});}_0xcc988=_[_0x560d('0x3c')]({},_0xcc988,_0x383e10[_0x560d('0x3d')]);var _0x162b70={'where':_0xcc988['where']};return db[_0x560d('0x2e')][_0x560d('0x3e')](_0x162b70)[_0x560d('0x27')](function(_0x23d617){_0x263ec7[_0x560d('0x3e')]=_0x23d617;if(_0x383e10[_0x560d('0x32')][_0x560d('0x3f')]){_0xcc988['include']=[{'all':!![]}];}return db[_0x560d('0x2e')][_0x560d('0x40')](_0xcc988);})['then'](function(_0x352460){_0x263ec7[_0x560d('0x41')]=_0x352460;return _0x263ec7;})[_0x560d('0x27')](respondWithFilteredResult(_0x4f940d,_0xcc988))[_0x560d('0x42')](handleError(_0x4f940d,null));})[_0x560d('0x42')](handleError(_0x4f940d,null));};exports[_0x560d('0x43')]=function(_0xda70ff,_0x129e66){var _0x4c1f2a={'raw':![],'where':{'id':_0xda70ff[_0x560d('0x44')]['id']}},_0x2bee73={};_0x2bee73[_0x560d('0x30')]=_[_0x560d('0x31')](db['CmCompany']['rawAttributes']);_0x2bee73[_0x560d('0x32')]=_[_0x560d('0x31')](_0xda70ff[_0x560d('0x32')]);_0x2bee73[_0x560d('0x33')]=_[_0x560d('0x45')](_0x2bee73[_0x560d('0x30')],_0x2bee73['query']);_0x4c1f2a[_0x560d('0x34')]=_[_0x560d('0x45')](_0x2bee73[_0x560d('0x30')],qs[_0x560d('0x46')](_0xda70ff[_0x560d('0x32')]['fields']));_0x4c1f2a[_0x560d('0x34')]=_0x4c1f2a['attributes'][_0x560d('0x47')]?_0x4c1f2a['attributes']:_0x2bee73['model'];if(_0xda70ff[_0x560d('0x32')]['includeAll']){_0x4c1f2a[_0x560d('0x48')]=[{'all':!![]}];}_0x4c1f2a=_[_0x560d('0x3c')]({},_0x4c1f2a,_0xda70ff[_0x560d('0x3d')]);return db[_0x560d('0x2e')][_0x560d('0x49')](_0x4c1f2a)[_0x560d('0x27')](handleEntityNotFound(_0x129e66,null))['then'](respondWithResult(_0x129e66,null))[_0x560d('0x42')](handleError(_0x129e66,null));};exports['create']=function(_0x59103a,_0x32cc66){return db[_0x560d('0x2e')][_0x560d('0x4a')](_0x59103a[_0x560d('0x4b')],{})[_0x560d('0x27')](function(_0x2774a9){var _0x3a4911=_0x59103a['user'][_0x560d('0x29')]({'plain':!![]});if(!_0x3a4911)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a4911['role']===_0x560d('0x4c')){var _0x5f53aa=_0x2774a9[_0x560d('0x29')]({'plain':!![]});var _0x465c71=_0x560d('0x2a');return db[_0x560d('0x4d')]['find']({'where':{'name':_0x465c71,'userProfileId':_0x3a4911['userProfileId']},'raw':!![]})[_0x560d('0x27')](function(_0x33d235){if(_0x33d235&&_0x33d235[_0x560d('0x4e')]===0x0){return db[_0x560d('0x4f')][_0x560d('0x4a')]({'name':_0x5f53aa[_0x560d('0x2c')],'resourceId':_0x5f53aa['id'],'type':_0x33d235[_0x560d('0x2c')],'sectionId':_0x33d235['id']},{})[_0x560d('0x27')](function(){return _0x2774a9;});}else{return _0x2774a9;}})['catch'](function(_0x6e0f06){logger[_0x560d('0x50')](_0x560d('0x51'),_0x6e0f06);throw _0x6e0f06;});}return _0x2774a9;})[_0x560d('0x27')](respondWithResult(_0x32cc66,0xc9))['catch'](handleError(_0x32cc66,null));};exports[_0x560d('0x52')]=function(_0x33e78a,_0x513e04){if(_0x33e78a['body']['id']){delete _0x33e78a['body']['id'];}return db[_0x560d('0x2e')][_0x560d('0x49')]({'where':{'id':_0x33e78a['params']['id']}})['then'](handleEntityNotFound(_0x513e04,null))[_0x560d('0x27')](saveUpdates(_0x33e78a[_0x560d('0x4b')],null))['then'](respondWithResult(_0x513e04,null))[_0x560d('0x42')](handleError(_0x513e04,null));};exports[_0x560d('0x28')]=function(_0x2d1a27,_0x1ef5ec){return db[_0x560d('0x2e')][_0x560d('0x49')]({'where':{'id':_0x2d1a27[_0x560d('0x44')]['id']}})[_0x560d('0x27')](handleEntityNotFound(_0x1ef5ec,null))[_0x560d('0x27')](removeEntity(_0x1ef5ec,null))['catch'](handleError(_0x1ef5ec,null));};exports['describe']=function(_0x3e0360,_0x3afc63){return db[_0x560d('0x2e')][_0x560d('0x2f')]()[_0x560d('0x27')](respondWithResult(_0x3afc63,null))[_0x560d('0x42')](handleError(_0x3afc63,null));};exports['addContacts']=function(_0x5997e1,_0x1ab704,_0x412f59){return db[_0x560d('0x53')][_0x560d('0x49')]({'where':{'id':_0x5997e1[_0x560d('0x44')]['id']}})[_0x560d('0x27')](handleEntityNotFound(_0x1ab704,null))['then'](function(_0x378021){if(_0x378021){return _0x378021['addContacts'](_0x5997e1['body'][_0x560d('0x54')],_['omit'](_0x5997e1[_0x560d('0x4b')],[_0x560d('0x54'),'id'])||{});}})['then'](respondWithResult(_0x1ab704,null))[_0x560d('0x42')](handleError(_0x1ab704,null));};exports['getContacts']=function(_0x5b1a2a,_0xf41644,_0x3f629a){var _0x177706={};var _0x311d97={};var _0x10152f;var _0x213173;return db[_0x560d('0x2e')]['findOne']({'where':{'id':_0x5b1a2a[_0x560d('0x44')]['id']}})[_0x560d('0x27')](handleEntityNotFound(_0xf41644,null))[_0x560d('0x27')](function(_0x427b38){if(_0x427b38){_0x10152f=_0x427b38;_0x311d97[_0x560d('0x30')]=_[_0x560d('0x31')](db[_0x560d('0x53')][_0x560d('0x55')]);_0x311d97[_0x560d('0x32')]=_[_0x560d('0x31')](_0x5b1a2a['query']);_0x311d97[_0x560d('0x33')]=_[_0x560d('0x45')](_0x311d97[_0x560d('0x30')],_0x311d97['query']);_0x177706['attributes']=_[_0x560d('0x45')](_0x311d97['model'],qs['fields'](_0x5b1a2a[_0x560d('0x32')][_0x560d('0x46')]));_0x177706[_0x560d('0x34')]=_0x177706[_0x560d('0x34')][_0x560d('0x47')]?_0x177706[_0x560d('0x34')]:_0x311d97[_0x560d('0x30')];_0x177706[_0x560d('0x37')]=qs['sort'](_0x5b1a2a[_0x560d('0x32')][_0x560d('0x38')]);_0x177706[_0x560d('0x3b')]=qs[_0x560d('0x33')](_[_0x560d('0x39')](_0x5b1a2a[_0x560d('0x32')],_0x311d97[_0x560d('0x33')]));if(_0x5b1a2a[_0x560d('0x32')][_0x560d('0x3a')]){_0x177706['where']=_[_0x560d('0x3c')](_0x177706[_0x560d('0x3b')],{'$or':_['map'](_0x177706[_0x560d('0x34')],function(_0x2b4f05){var _0x36f29c={};_0x36f29c[_0x2b4f05]={'$like':'%'+_0x5b1a2a[_0x560d('0x32')][_0x560d('0x3a')]+'%'};return _0x36f29c;})});}_0x177706=_[_0x560d('0x3c')]({},_0x177706,_0x5b1a2a[_0x560d('0x3d')]);return _0x10152f[_0x560d('0x56')](_0x177706);}})[_0x560d('0x27')](function(_0x5b626e){if(_0x5b626e){_0x213173=_0x5b626e['length'];if(!_0x5b1a2a[_0x560d('0x32')][_0x560d('0x35')](_0x560d('0x36'))){_0x177706[_0x560d('0x21')]=qs[_0x560d('0x21')](_0x5b1a2a[_0x560d('0x32')]['limit']);_0x177706[_0x560d('0x22')]=qs[_0x560d('0x22')](_0x5b1a2a[_0x560d('0x32')][_0x560d('0x22')]);}return _0x10152f[_0x560d('0x56')](_0x177706);}})[_0x560d('0x27')](function(_0x4eb089){if(_0x4eb089){return _0x4eb089?{'count':_0x213173,'rows':_0x4eb089}:null;}})[_0x560d('0x27')](respondWithResult(_0xf41644,null))[_0x560d('0x42')](handleError(_0xf41644,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 52bce49..646e5f3 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 _0x4957=['exports','CmCompany','cm_companies','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x8314d7,_0x11fc95){var _0x5d44df=function(_0x1b3fe7){while(--_0x1b3fe7){_0x8314d7['push'](_0x8314d7['shift']());}};_0x5d44df(++_0x11fc95);}(_0x4957,0x142));var _0x7495=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x4957[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0x7495('0x0'));var util=require('util');var logger=require(_0x7495('0x1'))(_0x7495('0x2'));var moment=require(_0x7495('0x3'));var BPromise=require(_0x7495('0x4'));var rp=require(_0x7495('0x5'));var fs=require('fs');var path=require(_0x7495('0x6'));var rimraf=require('rimraf');var config=require(_0x7495('0x7'));var attributes=require('./cmCompany.attributes');module[_0x7495('0x8')]=function(_0x716e3a,_0x1f5882){return _0x716e3a['define'](_0x7495('0x9'),attributes,{'tableName':_0x7495('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc235=['../../config/environment','./cmCompany.attributes','define','CmCompany','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1824c6,_0x79fcc3){var _0xbc0e9a=function(_0x4262ef){while(--_0x4262ef){_0x1824c6['push'](_0x1824c6['shift']());}};_0xbc0e9a(++_0x79fcc3);}(_0xc235,0x148));var _0x5c23=function(_0x517684,_0x398de8){_0x517684=_0x517684-0x0;var _0x277fd8=_0xc235[_0x517684];return _0x277fd8;};'use strict';var _=require(_0x5c23('0x0'));var util=require(_0x5c23('0x1'));var logger=require(_0x5c23('0x2'))(_0x5c23('0x3'));var moment=require(_0x5c23('0x4'));var BPromise=require(_0x5c23('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c23('0x6'));var rimraf=require(_0x5c23('0x7'));var config=require(_0x5c23('0x8'));var attributes=require(_0x5c23('0x9'));module['exports']=function(_0x2206fc,_0x3ee2ed){return _0x2206fc[_0x5c23('0xa')](_0x5c23('0xb'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 71fc7e3..cac0afd 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 _0xfced=['message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x5efc4e,_0x16a77b){var _0x47a4a7=function(_0x30c66d){while(--_0x30c66d){_0x5efc4e['push'](_0x5efc4e['shift']());}};_0x47a4a7(++_0x16a77b);}(_0xfced,0x7a));var _0xdfce=function(_0x59e748,_0x28c7bc){_0x59e748=_0x59e748-0x0;var _0x3e00d1=_0xfced[_0x59e748];return _0x3e00d1;};'use strict';var _=require(_0xdfce('0x0'));var util=require('util');var moment=require(_0xdfce('0x1'));var BPromise=require(_0xdfce('0x2'));var rs=require(_0xdfce('0x3'));var fs=require('fs');var Redis=require(_0xdfce('0x4'));var db=require(_0xdfce('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdfce('0x6'));var config=require(_0xdfce('0x7'));var jayson=require(_0xdfce('0x8'));var client=jayson[_0xdfce('0x9')][_0xdfce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x378e3e,_0x3199cd,_0x3a0e34){return new BPromise(function(_0x3b76f3,_0x532959){return client['request'](_0x378e3e,_0x3a0e34)['then'](function(_0x45f220){logger[_0xdfce('0xb')](_0xdfce('0xc'),_0x3199cd,_0xdfce('0xd'));logger[_0xdfce('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x3199cd,_0xdfce('0xd'),JSON[_0xdfce('0xf')](_0x45f220));if(_0x45f220[_0xdfce('0x10')]){if(_0x45f220[_0xdfce('0x10')][_0xdfce('0x11')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x3199cd,_0x45f220[_0xdfce('0x10')]['message']);return _0x532959(_0x45f220[_0xdfce('0x10')][_0xdfce('0x12')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x3199cd,_0x45f220[_0xdfce('0x10')]['message']);return _0x3b76f3(_0x45f220[_0xdfce('0x10')][_0xdfce('0x12')]);}else{logger['info'](_0xdfce('0xc'),_0x3199cd,_0xdfce('0xd'));_0x3b76f3(_0x45f220['result'][_0xdfce('0x12')]);}})[_0xdfce('0x13')](function(_0x102230){logger['error'](_0xdfce('0xc'),_0x3199cd,_0x102230);_0x532959(_0x102230);});});} \ No newline at end of file +var _0x7afa=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x244452,_0x4b6c43){var _0x4e48e2=function(_0x5aedcd){while(--_0x5aedcd){_0x244452['push'](_0x244452['shift']());}};_0x4e48e2(++_0x4b6c43);}(_0x7afa,0xe0));var _0xa7af=function(_0x499e1a,_0x5e6669){_0x499e1a=_0x499e1a-0x0;var _0x12ef82=_0x7afa[_0x499e1a];return _0x12ef82;};'use strict';var _=require(_0xa7af('0x0'));var util=require(_0xa7af('0x1'));var moment=require(_0xa7af('0x2'));var BPromise=require(_0xa7af('0x3'));var rs=require(_0xa7af('0x4'));var fs=require('fs');var Redis=require(_0xa7af('0x5'));var db=require(_0xa7af('0x6'))['db'];var utils=require(_0xa7af('0x7'));var logger=require(_0xa7af('0x8'))('rpc');var config=require(_0xa7af('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa7af('0xa')][_0xa7af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50da13,_0x34d56c,_0x1e1a2b){return new BPromise(function(_0x388fa1,_0x2f3841){return client[_0xa7af('0xc')](_0x50da13,_0x1e1a2b)['then'](function(_0x5046c0){logger['info'](_0xa7af('0xd'),_0x34d56c,'request\x20sent');logger[_0xa7af('0xe')](_0xa7af('0xf'),_0x34d56c,_0xa7af('0x10'),JSON[_0xa7af('0x11')](_0x5046c0));if(_0x5046c0[_0xa7af('0x12')]){if(_0x5046c0[_0xa7af('0x12')][_0xa7af('0x13')]===0x1f4){logger[_0xa7af('0x12')](_0xa7af('0xd'),_0x34d56c,_0x5046c0[_0xa7af('0x12')][_0xa7af('0x14')]);return _0x2f3841(_0x5046c0['error'][_0xa7af('0x14')]);}logger[_0xa7af('0x12')](_0xa7af('0xd'),_0x34d56c,_0x5046c0[_0xa7af('0x12')]['message']);return _0x388fa1(_0x5046c0['error']['message']);}else{logger[_0xa7af('0x15')](_0xa7af('0xd'),_0x34d56c,_0xa7af('0x10'));_0x388fa1(_0x5046c0[_0xa7af('0x16')][_0xa7af('0x14')]);}})['catch'](function(_0x53e7c){logger['error'](_0xa7af('0xd'),_0x34d56c,_0x53e7c);_0x2f3841(_0x53e7c);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index f775ad2..d14520c 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 _0xb167=['create','addContacts','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','/describe','isAuthenticated','describe','show','/:id/contacts','getContacts','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb167,0x164));var _0x7b16=function(_0x2f4e27,_0xa14e21){_0x2f4e27=_0x2f4e27-0x0;var _0x58ac5b=_0xb167[_0x2f4e27];return _0x58ac5b;};'use strict';var multer=require(_0x7b16('0x0'));var util=require(_0x7b16('0x1'));var path=require(_0x7b16('0x2'));var timeout=require(_0x7b16('0x3'));var express=require(_0x7b16('0x4'));var router=express[_0x7b16('0x5')]();var fs_extra=require(_0x7b16('0x6'));var auth=require(_0x7b16('0x7'));var interaction=require(_0x7b16('0x8'));var config=require(_0x7b16('0x9'));var controller=require(_0x7b16('0xa'));router[_0x7b16('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b16('0xb')](_0x7b16('0xc'),auth[_0x7b16('0xd')](),controller[_0x7b16('0xe')]);router['get']('/:id',auth[_0x7b16('0xd')](),controller[_0x7b16('0xf')]);router[_0x7b16('0xb')](_0x7b16('0x10'),auth[_0x7b16('0xd')](),controller[_0x7b16('0x11')]);router[_0x7b16('0x12')]('/',auth[_0x7b16('0xd')](),controller[_0x7b16('0x13')]);router[_0x7b16('0x12')](_0x7b16('0x10'),auth['isAuthenticated'](),controller[_0x7b16('0x14')]);router[_0x7b16('0x15')](_0x7b16('0x16'),auth[_0x7b16('0xd')](),controller[_0x7b16('0x17')]);router['delete']('/:id',auth[_0x7b16('0xd')](),controller[_0x7b16('0x18')]);module['exports']=router; \ No newline at end of file +var _0x7a75=['multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getContacts','post','/:id/contacts','addContacts','put','delete','destroy'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7a75,0x18f));var _0x57a7=function(_0x49608e,_0x4bebb2){_0x49608e=_0x49608e-0x0;var _0x5eca4f=_0x7a75[_0x49608e];return _0x5eca4f;};'use strict';var multer=require(_0x57a7('0x0'));var util=require(_0x57a7('0x1'));var path=require('path');var timeout=require(_0x57a7('0x2'));var express=require(_0x57a7('0x3'));var router=express['Router']();var fs_extra=require(_0x57a7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x57a7('0x5'));var config=require('../../config/environment');var controller=require(_0x57a7('0x6'));router[_0x57a7('0x7')]('/',auth[_0x57a7('0x8')](),controller[_0x57a7('0x9')]);router[_0x57a7('0x7')](_0x57a7('0xa'),auth[_0x57a7('0x8')](),controller[_0x57a7('0xb')]);router['get'](_0x57a7('0xc'),auth[_0x57a7('0x8')](),controller[_0x57a7('0xd')]);router[_0x57a7('0x7')]('/:id/contacts',auth[_0x57a7('0x8')](),controller[_0x57a7('0xe')]);router[_0x57a7('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x57a7('0x10'),auth['isAuthenticated'](),controller[_0x57a7('0x11')]);router[_0x57a7('0x12')](_0x57a7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x57a7('0x13')](_0x57a7('0xc'),auth[_0x57a7('0x8')](),controller[_0x57a7('0x14')]);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 cc7c2f8..8f07322 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 _0x7ce3=['STRING','INTEGER','UNSIGNED','DATE','lodash','sequelize','exports'];(function(_0x11dbe9,_0x5a0ade){var _0x1d3080=function(_0x21964e){while(--_0x21964e){_0x11dbe9['push'](_0x11dbe9['shift']());}};_0x1d3080(++_0x5a0ade);}(_0x7ce3,0x12a));var _0x37ce=function(_0x52782c,_0x2dc6b0){_0x52782c=_0x52782c-0x0;var _0x1da746=_0x7ce3[_0x52782c];return _0x1da746;};'use strict';var _=require(_0x37ce('0x0'));var Sequelize=require(_0x37ce('0x1'));module[_0x37ce('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x37ce('0x3')]},'street':{'type':Sequelize[_0x37ce('0x3')]},'postalCode':{'type':Sequelize[_0x37ce('0x3')]},'city':{'type':Sequelize[_0x37ce('0x3')]},'country':{'type':Sequelize[_0x37ce('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x37ce('0x3')]},'fax':{'type':Sequelize[_0x37ce('0x3')]},'email':{'type':Sequelize[_0x37ce('0x3')]},'url':{'type':Sequelize[_0x37ce('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x37ce('0x3')]},'skype':{'type':Sequelize[_0x37ce('0x3')]},'teams':{'type':Sequelize[_0x37ce('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x37ce('0x3')]},'UserId':{'type':Sequelize[_0x37ce('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x37ce('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x37ce('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x37ce('0x4')]}}; \ No newline at end of file +var _0x79a1=['STRING','TEXT','INTEGER','UNSIGNED','DATE','lodash','sequelize','exports'];(function(_0x549d16,_0x4d069a){var _0x344ccc=function(_0x1d992a){while(--_0x1d992a){_0x549d16['push'](_0x549d16['shift']());}};_0x344ccc(++_0x4d069a);}(_0x79a1,0xf5));var _0x179a=function(_0x27a9fa,_0x4e93e5){_0x27a9fa=_0x27a9fa-0x0;var _0x4f525d=_0x79a1[_0x27a9fa];return _0x4f525d;};'use strict';var _=require(_0x179a('0x0'));var Sequelize=require(_0x179a('0x1'));module[_0x179a('0x2')]={'firstName':{'type':Sequelize[_0x179a('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x179a('0x3')]},'street':{'type':Sequelize[_0x179a('0x3')]},'postalCode':{'type':Sequelize[_0x179a('0x3')]},'city':{'type':Sequelize[_0x179a('0x3')]},'country':{'type':Sequelize[_0x179a('0x3')]},'dateOfBirth':{'type':Sequelize[_0x179a('0x3')]},'description':{'type':Sequelize[_0x179a('0x4')]},'phone':{'type':Sequelize[_0x179a('0x3')]},'mobile':{'type':Sequelize[_0x179a('0x3')]},'fax':{'type':Sequelize[_0x179a('0x3')]},'email':{'type':Sequelize[_0x179a('0x3')]},'url':{'type':Sequelize[_0x179a('0x3')]},'facebook':{'type':Sequelize[_0x179a('0x3')]},'fb_data':{'type':Sequelize[_0x179a('0x3')]},'twitter':{'type':Sequelize[_0x179a('0x3')]},'skype':{'type':Sequelize[_0x179a('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x179a('0x3')]},'line':{'type':Sequelize[_0x179a('0x3')]},'wechat':{'type':Sequelize[_0x179a('0x3')]},'telegram':{'type':Sequelize[_0x179a('0x3')]},'UserId':{'type':Sequelize[_0x179a('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x179a('0x5')](0x2)[_0x179a('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x179a('0x7')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x179a('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 58db70d..e5a34a5 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 _0xe8ed=['Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','source','destination','callerid','starttime','endtime','note','createdAt','userDisposition','userSecondDisposition','UserId','User','alias','startCase','chat','Website','Account','closed','disposition','secondDisposition','thirdDisposition','key','Owner','fullname','DESC','customerIp','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','threadId','findAndCountAll','sortBy','reverse','value','slice','moment','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','json','undefined','count','set','Content-Range','update','then','end','sendStatus','stack','name','send','index','getOptions','findAll','query','user','catch','destroy','find','params','describe','CmContact','tags','keys','startsWith','cf_','analytics','CmCustomField','length','columnName','displayName','custom','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','merge','body','from','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','utcOffset','timezones','additionalPhones','bulkCreate','duplicates','where','$or','ListId','findOrCreate','hasOwnProperty','push','contact','show','Tag','Tags','color','tag','Phones','ContactItemType','literal','Phones.OrderBy','$and','omit','map','cf_%d','pickBy','format','isEmpty','table','cm_contacts','id\x20=\x20?','toParam','sequelize','text','values','CmHopper','phone','getTags','findOne','rawAttributes','filters','intersection','model','attributes','fields','order','pick','filter','nolimit','limit','offset','setTags','ids','setAdditionalPhones','all','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','item','ItemType','`ItemType`.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','sort','ContactId','options','include','rows','getHopperHistories','includeAll','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','createReadStream','file','parse','meta','import','agent','binding','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','message','getJourney','mail','sms','fax','whatsapp','-createdAt','resolve','channel','includes','toLowerCase'];(function(_0x5443ac,_0x2cb686){var _0x2e4780=function(_0x54addf){while(--_0x54addf){_0x5443ac['push'](_0x5443ac['shift']());}};_0x2e4780(++_0x2cb686);}(_0xe8ed,0x130));var _0xde8e=function(_0xe60376,_0x3208b6){_0xe60376=_0xe60376-0x0;var _0x48dd28=_0xe8ed[_0xe60376];return _0x48dd28;};'use strict';var moment=require(_0xde8e('0x0'));var BPromise=require(_0xde8e('0x1'));var util=require(_0xde8e('0x2'));var path=require(_0xde8e('0x3'));var fs=require('fs');var _=require(_0xde8e('0x4'));var squel=require(_0xde8e('0x5'));var Papa=require(_0xde8e('0x6'));var Redis=require(_0xde8e('0x7'));var contacts=require('../../components/contacts');var qs=require(_0xde8e('0x8'));var logger=require(_0xde8e('0x9'))('api');var config=require(_0xde8e('0xa'));var shared=require(_0xde8e('0xb'));var db=require(_0xde8e('0xc'))['db'];config[_0xde8e('0xd')]=_['defaults'](config[_0xde8e('0xd')],{'host':_0xde8e('0xe'),'port':0x18eb});var socket=require(_0xde8e('0xf'))(new Redis(config[_0xde8e('0xd')]));require(_0xde8e('0x10'))[_0xde8e('0x11')](socket);function respondWithResult(_0x592939,_0x320483){_0x320483=_0x320483||0xc8;return function(_0x1ca2d8){if(_0x1ca2d8){return _0x592939[_0xde8e('0x12')](_0x320483)[_0xde8e('0x13')](_0x1ca2d8);}};}function respondWithFilteredResult(_0x159eba,_0x305030){return function(_0x5239e5){if(_0x5239e5){var _0x38bcfd=typeof _0x305030['offset']==='undefined'&&typeof _0x305030['limit']===_0xde8e('0x14');var _0x1c4f28=_0x5239e5['count'];var _0x11b236=_0x38bcfd?0x0:_0x305030['offset'];var _0x406474=_0x38bcfd?_0x5239e5[_0xde8e('0x15')]:_0x305030['offset']+_0x305030['limit'];var _0x48bb01;if(_0x406474>=_0x1c4f28){_0x406474=_0x1c4f28;_0x48bb01=0xc8;}else{_0x48bb01=0xce;}_0x159eba['status'](_0x48bb01);return _0x159eba[_0xde8e('0x16')](_0xde8e('0x17'),_0x11b236+'-'+_0x406474+'/'+_0x1c4f28)[_0xde8e('0x13')](_0x5239e5);}return null;};}function saveUpdates(_0x4eddb1){return function(_0x2d2574){if(_0x2d2574){return _0x2d2574[_0xde8e('0x18')](_0x4eddb1)[_0xde8e('0x19')](function(_0x364a8f){return _0x364a8f;});}return null;};}function removeEntity(_0x986c7b){return function(_0x1e1cdf){if(_0x1e1cdf){return _0x1e1cdf['destroy']()['then'](function(){_0x986c7b[_0xde8e('0x12')](0xcc)[_0xde8e('0x1a')]();});}};}function handleEntityNotFound(_0x5296fb){return function(_0x45fd6b){if(!_0x45fd6b){_0x5296fb[_0xde8e('0x1b')](0x194);}return _0x45fd6b;};}function handleError(_0x123593,_0x30970a){_0x30970a=_0x30970a||0x1f4;return function(_0x3621a4){logger['error'](_0x3621a4[_0xde8e('0x1c')]);if(_0x3621a4[_0xde8e('0x1d')]){delete _0x3621a4['name'];}_0x123593[_0xde8e('0x12')](_0x30970a)[_0xde8e('0x1e')](_0x3621a4);};}exports[_0xde8e('0x1f')]=function(_0x3ecda7,_0x32c804){var _0x49b0b3={};return contacts['describe']()[_0xde8e('0x19')](function(_0x522146){_0x49b0b3=qs[_0xde8e('0x20')](_0x522146,_0x3ecda7);return contacts[_0xde8e('0x21')](_0x3ecda7[_0xde8e('0x22')],_0x3ecda7[_0xde8e('0x23')],_0x49b0b3,_0x522146);})[_0xde8e('0x19')](respondWithFilteredResult(_0x32c804,_0x49b0b3))[_0xde8e('0x24')](handleError(_0x32c804,null));};exports[_0xde8e('0x25')]=function(_0x5d0f88,_0x7e595){return db['CmContact'][_0xde8e('0x26')]({'where':{'id':_0x5d0f88[_0xde8e('0x27')]['id']}})[_0xde8e('0x19')](handleEntityNotFound(_0x7e595,null))[_0xde8e('0x19')](removeEntity(_0x7e595,null))[_0xde8e('0x24')](handleError(_0x7e595,null));};exports[_0xde8e('0x28')]=function(_0x25b5b4,_0x79bf7d){return db[_0xde8e('0x29')]['describe']()[_0xde8e('0x19')](function(_0x4f3f84){delete _0x4f3f84[_0xde8e('0x2a')];for(var _0x50e1c1=0x0;_0x50e1c10x0){return new Promise(function(_0x14962d){var _0x5c7333=[];for(var _0x5410e1=0x0;_0x5410e1<_0x165323[_0xde8e('0x30')];_0x5410e1++){_0x5c7333[_0xde8e('0x63')](insertAdditionalPhones(_0x165323[_0x5410e1][_0xde8e('0x64')],_0x165323[_0x5410e1]['additionalPhones']));}Promise['all'](_0x5c7333)['then'](function(){_0x14962d(0x1);});})['then'](function(){return{'success':_0x31c73f,'failure':_0x31c096,'duplicates':_0x3263be};});}else{return{'success':_0x31c73f,'failure':_0x31c096,'duplicates':_0x3263be};}}})[_0xde8e('0x19')](respondWithResult(_0x124add,0xc9))[_0xde8e('0x24')](handleError(_0x124add,null));};exports[_0xde8e('0x65')]=function(_0x33244b,_0x1c8cce){var _0x305438;return db[_0xde8e('0x29')][_0xde8e('0x28')]()[_0xde8e('0x19')](function(_0xeaa08e){return db[_0xde8e('0x29')][_0xde8e('0x26')]({'where':{'id':_0x33244b[_0xde8e('0x27')]['id']},'include':[{'model':db[_0xde8e('0x66')],'as':_0xde8e('0x67'),'attributes':['id',_0xde8e('0x1d'),_0xde8e('0x68')],'required':_0x33244b['query'][_0xde8e('0x69')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0xde8e('0x6a'),'where':{'CmContactId':_0x33244b[_0xde8e('0x27')]['id']},'required':![],'include':[{'model':db[_0xde8e('0x6b')],'as':'ItemType'}]}],'order':[db['sequelize'][_0xde8e('0x6c')](_0xde8e('0x6d'))],'attributes':_['keys'](_0xeaa08e)});})[_0xde8e('0x19')](function(_0x440f92){if(!_[_0xde8e('0x57')](_0x440f92)){_0x305438=_0x440f92['get']({'plain':!![]});var _0x1de554={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x440f92&&_0x440f92[_0xde8e('0x60')]){if(_0x440f92[_0xde8e('0x60')]){_0x1de554[_0xde8e('0x5e')][_0xde8e('0x6e')]['push']({'ListId':{'$ne':_0x440f92['ListId']}});}}return db[_0xde8e('0x2f')][_0xde8e('0x21')](_0x1de554);}})[_0xde8e('0x19')](function(_0xb50026){if(!_[_0xde8e('0x57')](_0xb50026)){return _[_0xde8e('0x6f')](_0x305438,_[_0xde8e('0x70')](_0xb50026,function(_0x2528a8){return util['format'](_0xde8e('0x71'),_0x2528a8['id']);}));}})[_0xde8e('0x19')](handleEntityNotFound(_0x1c8cce,null))[_0xde8e('0x19')](respondWithResult(_0x1c8cce,null))[_0xde8e('0x24')](handleError(_0x1c8cce,null));};exports[_0xde8e('0x18')]=function(_0x32e0f6,_0x3f7c46){var _0x13fb78;if(_0x32e0f6[_0xde8e('0x38')]['id']){delete _0x32e0f6[_0xde8e('0x38')]['id'];}if(!_[_0xde8e('0x57')](_0x32e0f6['body'][_0xde8e('0x58')])){var _0x398d8c=_0x32e0f6[_0xde8e('0x38')]['dialTimezone'];if(!_[_0xde8e('0x57')](shared[_0xde8e('0x5a')][_0x398d8c]))_0x32e0f6['body']['utcOffset']=shared[_0xde8e('0x5a')][_0x398d8c][_0xde8e('0x59')];}return db[_0xde8e('0x29')]['find']({'where':{'id':_0x32e0f6[_0xde8e('0x27')]['id']}})[_0xde8e('0x19')](handleEntityNotFound(_0x3f7c46,null))[_0xde8e('0x19')](saveUpdates(_0x32e0f6['body'],null))[_0xde8e('0x19')](function(_0x30a082){_0x13fb78=_0x30a082;var _0x4b0ead={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x30a082&&_0x30a082[_0xde8e('0x60')]){if(_0x30a082[_0xde8e('0x60')]){_0x4b0ead[_0xde8e('0x5e')][_0xde8e('0x6e')][_0xde8e('0x63')]({'ListId':{'$ne':_0x30a082[_0xde8e('0x60')]}});}}return db[_0xde8e('0x2f')]['findAll'](_0x4b0ead);})[_0xde8e('0x19')](function(_0x4cbee9){if(_0x4cbee9){return _[_0xde8e('0x6f')](_[_0xde8e('0x72')](_0x32e0f6[_0xde8e('0x38')],function(_0x56bd17,_0x7299b0){return _[_0xde8e('0x2c')](_0x7299b0,_0xde8e('0x2d'));}),_[_0xde8e('0x70')](_0x4cbee9,function(_0x4c0ba0){return util[_0xde8e('0x73')](_0xde8e('0x71'),_0x4c0ba0['id']);}));}})[_0xde8e('0x19')](function(_0x4797ca){if(_0x4797ca&&!_[_0xde8e('0x74')](_0x4797ca)){var _0x1d55ff=squel[_0xde8e('0x18')]()[_0xde8e('0x75')](_0xde8e('0x76'))['setFields'](_0x4797ca)[_0xde8e('0x5e')](_0xde8e('0x77'),_0x32e0f6[_0xde8e('0x27')]['id'])[_0xde8e('0x78')]();return db[_0xde8e('0x79')][_0xde8e('0x22')](_0x1d55ff[_0xde8e('0x7a')],{'replacements':_0x1d55ff[_0xde8e('0x7b')]});}})[_0xde8e('0x19')](function(){if(_0x32e0f6[_0xde8e('0x38')]['phone']&&_0x13fb78){return db[_0xde8e('0x7c')][_0xde8e('0x18')]({'phone':_0x32e0f6[_0xde8e('0x38')][_0xde8e('0x7d')],'OrderBy':0x0},{'where':{'ContactId':_0x13fb78['id']}});}})[_0xde8e('0x19')](function(){return _0x13fb78;})[_0xde8e('0x19')](respondWithResult(_0x3f7c46,null))[_0xde8e('0x24')](handleError(_0x3f7c46,null));};exports[_0xde8e('0x7e')]=function(_0x472902,_0x4fb306){var _0x40e623={};var _0x5ebbd0={};var _0x587082;var _0x37fed7;return db[_0xde8e('0x29')][_0xde8e('0x7f')]({'where':{'id':_0x472902[_0xde8e('0x27')]['id']}})['then'](handleEntityNotFound(_0x4fb306,null))[_0xde8e('0x19')](function(_0x2918d1){if(_0x2918d1){_0x587082=_0x2918d1;_0x5ebbd0['model']=_[_0xde8e('0x2b')](db[_0xde8e('0x66')][_0xde8e('0x80')]);_0x5ebbd0[_0xde8e('0x22')]=_[_0xde8e('0x2b')](_0x472902[_0xde8e('0x22')]);_0x5ebbd0[_0xde8e('0x81')]=_[_0xde8e('0x82')](_0x5ebbd0[_0xde8e('0x83')],_0x5ebbd0[_0xde8e('0x22')]);_0x40e623[_0xde8e('0x84')]=_[_0xde8e('0x82')](_0x5ebbd0[_0xde8e('0x83')],qs[_0xde8e('0x85')](_0x472902[_0xde8e('0x22')][_0xde8e('0x85')]));_0x40e623[_0xde8e('0x84')]=_0x40e623[_0xde8e('0x84')][_0xde8e('0x30')]?_0x40e623[_0xde8e('0x84')]:_0x5ebbd0['model'];_0x40e623[_0xde8e('0x86')]=qs['sort'](_0x472902[_0xde8e('0x22')]['sort']);_0x40e623['where']=qs[_0xde8e('0x81')](_[_0xde8e('0x87')](_0x472902[_0xde8e('0x22')],_0x5ebbd0[_0xde8e('0x81')]));if(_0x472902['query'][_0xde8e('0x88')]){_0x40e623[_0xde8e('0x5e')]=_[_0xde8e('0x37')](_0x40e623[_0xde8e('0x5e')],{'$or':_[_0xde8e('0x70')](_0x40e623[_0xde8e('0x84')],function(_0x1df09b){var _0x5bf34e={};_0x5bf34e[_0x1df09b]={'$like':'%'+_0x472902[_0xde8e('0x22')][_0xde8e('0x88')]+'%'};return _0x5bf34e;})});}_0x40e623=_['merge']({},_0x40e623,_0x472902['options']);return _0x587082[_0xde8e('0x7e')](_0x40e623);}})[_0xde8e('0x19')](function(_0x55713c){if(_0x55713c){_0x37fed7=_0x55713c['length'];if(!_0x472902['query'][_0xde8e('0x62')](_0xde8e('0x89'))){_0x40e623[_0xde8e('0x8a')]=qs[_0xde8e('0x8a')](_0x472902[_0xde8e('0x22')][_0xde8e('0x8a')]);_0x40e623[_0xde8e('0x8b')]=qs[_0xde8e('0x8b')](_0x472902['query'][_0xde8e('0x8b')]);}return _0x587082[_0xde8e('0x7e')](_0x40e623);}})[_0xde8e('0x19')](function(_0x3e6de2){if(_0x3e6de2){return _0x3e6de2?{'count':_0x37fed7,'rows':_0x3e6de2}:null;}})[_0xde8e('0x19')](respondWithResult(_0x4fb306,null))[_0xde8e('0x24')](handleError(_0x4fb306,null));};exports[_0xde8e('0x8c')]=function(_0x2aa77c,_0x5c407d){if(_0x2aa77c[_0xde8e('0x38')]['id']){delete _0x2aa77c[_0xde8e('0x38')]['id'];}return db[_0xde8e('0x29')][_0xde8e('0x7f')]({'where':{'id':_0x2aa77c[_0xde8e('0x27')]['id']}})[_0xde8e('0x19')](handleEntityNotFound(_0x5c407d,null))[_0xde8e('0x19')](function(_0x181a69){if(_0x181a69){return _0x181a69[_0xde8e('0x8c')](_0x2aa77c['body'][_0xde8e('0x8d')]||[]);}return null;})[_0xde8e('0x19')](respondWithResult(_0x5c407d,null))[_0xde8e('0x24')](handleError(_0x5c407d,null));};exports[_0xde8e('0x8e')]=function(_0x2be02a,_0xaa1a96){var _0x455686=[];_0x455686[_0xde8e('0x63')](addAdditionalPhones(_0x2be02a[_0xde8e('0x38')]));Promise[_0xde8e('0x8f')](_0x455686)['then'](function(){_0x455686=[];_0x455686['push'](deleteCmHopperPhones(_0x2be02a[_0xde8e('0x38')]['id']));_0x455686['push'](addCmHopperPhones(_0x2be02a[_0xde8e('0x38')]['id']));Promise[_0xde8e('0x8f')](_0x455686)[_0xde8e('0x19')](function(){return[0x1];})[_0xde8e('0x19')](respondWithResult(_0xaa1a96,null));});};function addAdditionalPhones(_0x107211){var _0x194a48;return new Promise(function(_0x2b20dd){return db[_0xde8e('0x4a')][_0xde8e('0x25')]({'where':{'CmContactId':_0x107211['id']}})[_0xde8e('0x19')](function(){db[_0xde8e('0x6b')][_0xde8e('0x21')]({'raw':!![],'attributes':['id',_0xde8e('0x90')]})['then'](function(_0x36160b){var _0x5eae3c=[];for(var _0x1782a6=0x0;_0x1782a6<_0x107211[_0xde8e('0x91')][_0xde8e('0x30')];_0x1782a6++){var _0x17ae13=_0x107211[_0xde8e('0x92')]?_[_0xde8e('0x57')](_0x107211['item_types'][_0x1782a6])?'':_0x107211[_0xde8e('0x92')][_0x1782a6]:_0x107211[_0xde8e('0x91')][_0x1782a6][_0xde8e('0x93')]?_0x107211[_0xde8e('0x91')][_0x1782a6]['ItemTypeId']:'';var _0xbd0bbc=_[_0xde8e('0x57')](_0x107211[_0xde8e('0x91')][_0x1782a6][_0xde8e('0x94')])?'':_0x107211['items'][_0x1782a6]['description'];var _0x46ce90=_0x17ae13+':'+_0x107211[_0xde8e('0x91')][_0x1782a6][_0xde8e('0x7d')]+'§'+_0xbd0bbc;if(_['isNil'](_0x194a48))_0x194a48=_0x46ce90;else _0x194a48+=';'+_0x46ce90;var _0x496a0e=null;var _0x3574f3=null;if(_0x107211[_0xde8e('0x92')]){if(!_['isNil'](_0x107211[_0xde8e('0x92')][_0x1782a6])){_0x3574f3=_['find'](_0x36160b,function(_0x23427b){return _0x23427b['id']===_0x107211[_0xde8e('0x92')][_0x1782a6];});if(!_[_0xde8e('0x57')](_0x3574f3)){_0x496a0e=_0x3574f3[_0xde8e('0x90')];}}}else{if(!_[_0xde8e('0x57')](_0x107211['items'][_0x1782a6])){_0x3574f3=_[_0xde8e('0x26')](_0x36160b,function(_0x502b4d){return _0x502b4d['id']===_0x107211[_0xde8e('0x91')][_0x1782a6][_0xde8e('0x93')];});if(!_[_0xde8e('0x57')](_0x3574f3)){_0x496a0e=_0x1782a6;}}}if(_['isNil'](_0x496a0e)){_0x496a0e=0x64;}_0x5eae3c[_0xde8e('0x63')](addAdditionalPhone(_0x107211['id'],_0x107211['items'][_0x1782a6][_0xde8e('0x7d')],_0x107211[_0xde8e('0x92')]?_[_0xde8e('0x57')](_0x107211[_0xde8e('0x92')][_0x1782a6])?null:_0x107211[_0xde8e('0x92')][_0x1782a6]:_0x107211[_0xde8e('0x91')][_0x1782a6][_0xde8e('0x93')]?_0x107211[_0xde8e('0x91')][_0x1782a6]['ItemTypeId']:null,_0x496a0e,_0xbd0bbc));}Promise[_0xde8e('0x8f')](_0x5eae3c)[_0xde8e('0x19')](function(){db[_0xde8e('0x29')][_0xde8e('0x18')]({'AdditionalPhones':_0x194a48},{'where':{'id':_0x107211['id']}})['then'](function(){_0x2b20dd(0x1);});});});});});}function addAdditionalPhone(_0x381633,_0x3dc5b5,_0x46bc8c,_0xc8f7d4,_0x263d84){return db[_0xde8e('0x4a')][_0xde8e('0x26')]({'where':{'CmContactId':_0x381633,'item':_0x3dc5b5}})['then'](function(_0x4f5c35){if(_0x4f5c35)logger[_0xde8e('0x35')](_0xde8e('0x95'),_0x4f5c35);else{db[_0xde8e('0x4a')]['create']({'CmContactId':_0x381633,'item':_0x3dc5b5,'ItemTypeId':_0x46bc8c,'OrderBy':_0xc8f7d4,'ItemClass':_0xde8e('0x96'),'description':_0x263d84});}});}function deleteCmHopperPhones(_0x185555){return new Promise(function(_0x487ccf){return db[_0xde8e('0x7c')][_0xde8e('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x185555}})[_0xde8e('0x19')](function(_0x355f35){db['CmHopperAdditionalPhone'][_0xde8e('0x25')]({'where':{'CmHopperId':{'$in':_['map'](_0x355f35,'id')}}});})['then'](function(){_0x487ccf(0x1);});});}function addCmHopperPhones(_0x127e2e){return new Promise(function(_0x3e05b7){return db['CmHopper'][_0xde8e('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x127e2e}})[_0xde8e('0x19')](function(_0x3c4e1c){var _0x506f2c=[];_[_0xde8e('0x70')](_0x3c4e1c,function(_0x4302f3){_0x506f2c[_0xde8e('0x63')](createCmHopperPhone(_0x127e2e,_0x4302f3['id']));});Promise['all'](_0x506f2c)[_0xde8e('0x19')](function(){_0x3e05b7(0x1);});});});}function createCmHopperPhone(_0x48221d,_0x401027){return new Promise(function(_0x4e7817){db['CmContactHasItem'][_0xde8e('0x21')]({'raw':!![],'attributes':[_0xde8e('0x97'),_0xde8e('0x90')],'where':{'CmContactId':_0x48221d,'ItemClass':_0xde8e('0x96')},'include':[{'model':db[_0xde8e('0x6b')],'attributes':['OrderBy'],'as':_0xde8e('0x98')}],'order':[_0xde8e('0x90'),db['sequelize'][_0xde8e('0x6c')](_0xde8e('0x99'))]})['then'](function(_0x3bfff3){var _0xf33640=0x1;var _0x43b274=_['map'](_0x3bfff3,function(_0x339de0){_0x339de0['CmHopperId']=_0x401027;_0x339de0[_0xde8e('0x7d')]=_0x339de0['item'];_0x339de0['OrderBy']=_0xf33640;delete _0x339de0['ItemType.OrderBy'];_0xf33640=_0xf33640+0x1;return _0x339de0;});return db[_0xde8e('0x9a')]['bulkCreate'](_0x43b274,{});})['then'](function(){_0x4e7817(0x1);});});}function insertAdditionalPhones(_0x141135,_0x46428e){return new Promise(function(_0x2b7c68){var _0x56b7e4=[];for(var _0x2b2936=0x0;_0x2b2936<_0x46428e[_0xde8e('0x30')];_0x2b2936++){var _0x119373=_0x46428e[_0x2b2936];_0x56b7e4['push'](parseContactItemType(_0x119373));}Promise[_0xde8e('0x8f')](_0x56b7e4)[_0xde8e('0x19')](function(){var _0x28d22e={'id':_0x141135['id'],'items':_0x46428e};return addAdditionalPhones(_0x28d22e)[_0xde8e('0x19')](function(){return addCmHopperPhones(_0x141135['id']);});})[_0xde8e('0x19')](function(){_0x2b7c68(_0x141135);});});}function parseContactItemType(_0x432049){return new Promise(function(_0x898f73){if(_0x432049[_0xde8e('0x62')](_0xde8e('0x93'))){_0x898f73(_0x432049);}else{return db[_0xde8e('0x6b')][_0xde8e('0x26')]({'where':{'name':_0x432049[_0xde8e('0x98')]}})[_0xde8e('0x19')](function(_0x3173f4){if(_['isNil'](_0x3173f4))_0x432049[_0xde8e('0x93')]=null;else _0x432049[_0xde8e('0x93')]=_0x3173f4['id'];_0x898f73(_0x432049);});}});}exports[_0xde8e('0x9b')]=function(_0x24375c,_0x5e23c5){return db[_0xde8e('0x4a')][_0xde8e('0x21')]({'raw':!![],'where':{'CmContactId':_0x24375c[_0xde8e('0x27')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0xde8e('0x6b')],'as':_0xde8e('0x98')}],'order':[['OrderBy'],[db['sequelize'][_0xde8e('0x6c')](_0xde8e('0x99'))]]})[_0xde8e('0x19')](function(_0x3a55e8){return _0x3a55e8;})['then'](respondWithResult(_0x5e23c5,null))[_0xde8e('0x24')](handleError(_0x5e23c5,null));};exports[_0xde8e('0x9c')]=function(_0x2bd43e,_0xaf00c6){return db[_0xde8e('0x4a')][_0xde8e('0x21')]({'raw':!![],'where':{'CmContactId':_0x2bd43e[_0xde8e('0x38')][_0xde8e('0x9d')]}})[_0xde8e('0x19')](function(_0x32739d){var _0x3cf5e9=_[_0xde8e('0x70')](_0x32739d,function(_0x47d968){_0x47d968[_0xde8e('0x9e')]=_0x2bd43e[_0xde8e('0x38')][_0xde8e('0x9f')];return _0x47d968;});return db[_0xde8e('0x4a')]['bulkCreate'](_0x3cf5e9,{});})[_0xde8e('0x19')](function(){return addCmHopperPhones(_0x2bd43e[_0xde8e('0x38')]['toContactId']);})[_0xde8e('0x19')](function(){return['ok'];})[_0xde8e('0x19')](respondWithResult(_0xaf00c6,null))[_0xde8e('0x24')](handleError(_0xaf00c6,null));};exports[_0xde8e('0xa0')]=function(_0x2830a4,_0x595e6c){var _0x885284=[];_0x885284[_0xde8e('0x63')](createCmHopperPhone(_0x2830a4['body']['id'],_0x2830a4[_0xde8e('0x38')][_0xde8e('0xa1')]));Promise[_0xde8e('0x8f')](_0x885284)['then'](function(){return[0x1];})[_0xde8e('0x19')](respondWithResult(_0x595e6c,null));};exports[_0xde8e('0xa2')]=function(_0x1f8f94,_0x42601d){var _0x15c952={'raw':![],'where':{}};var _0x53bac5={};var _0x2c8592={'count':0x0,'rows':[]};return db[_0xde8e('0x29')][_0xde8e('0x7f')]({'where':{'id':_0x1f8f94[_0xde8e('0x27')]['id']}})[_0xde8e('0x19')](handleEntityNotFound(_0x42601d,null))[_0xde8e('0x19')](function(_0x1f011e){if(_0x1f011e){_0x53bac5[_0xde8e('0x83')]=_[_0xde8e('0x2b')](db['CmHopper'][_0xde8e('0x80')]);_0x53bac5[_0xde8e('0x22')]=_['keys'](_0x1f8f94['query']);_0x53bac5[_0xde8e('0x81')]=_[_0xde8e('0x82')](_0x53bac5[_0xde8e('0x83')],_0x53bac5['query']);_0x15c952[_0xde8e('0x84')]=_[_0xde8e('0x82')](_0x53bac5['model'],qs[_0xde8e('0x85')](_0x1f8f94[_0xde8e('0x22')][_0xde8e('0x85')]));_0x15c952[_0xde8e('0x84')]=_0x15c952[_0xde8e('0x84')][_0xde8e('0x30')]?_0x15c952['attributes']:_0x53bac5[_0xde8e('0x83')];if(!_0x1f8f94[_0xde8e('0x22')][_0xde8e('0x62')](_0xde8e('0x89'))){_0x15c952[_0xde8e('0x8a')]=qs['limit'](_0x1f8f94[_0xde8e('0x22')][_0xde8e('0x8a')]);_0x15c952['offset']=qs[_0xde8e('0x8b')](_0x1f8f94[_0xde8e('0x22')]['offset']);}_0x15c952[_0xde8e('0x86')]=qs[_0xde8e('0xa3')](_0x1f8f94[_0xde8e('0x22')][_0xde8e('0xa3')]);_0x15c952['where']=qs['filters'](_[_0xde8e('0x87')](_0x1f8f94[_0xde8e('0x22')],_0x53bac5[_0xde8e('0x81')]));_0x15c952[_0xde8e('0x5e')][_0xde8e('0xa4')]=_0x1f011e['id'];if(_0x1f8f94[_0xde8e('0x22')][_0xde8e('0x88')]){_0x15c952['where']=_['merge'](_0x15c952[_0xde8e('0x5e')],{'$or':_[_0xde8e('0x70')](_0x15c952['attributes'],function(_0x4173c4){var _0x219d17={};_0x219d17[_0x4173c4]={'$like':'%'+_0x1f8f94[_0xde8e('0x22')][_0xde8e('0x88')]+'%'};return _0x219d17;})});}_0x15c952=_[_0xde8e('0x37')]({},_0x15c952,_0x1f8f94[_0xde8e('0xa5')]);return db['CmHopper']['count']({'where':_0x15c952[_0xde8e('0x5e')]})[_0xde8e('0x19')](function(_0x59afe5){_0x2c8592[_0xde8e('0x15')]=_0x59afe5;if(_0x1f8f94['query']['includeAll']){_0x15c952[_0xde8e('0xa6')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x15c952);})[_0xde8e('0x19')](function(_0x38c552){_0x2c8592[_0xde8e('0xa7')]=_0x38c552;return _0x2c8592;});}})[_0xde8e('0x19')](respondWithFilteredResult(_0x42601d,_0x15c952))[_0xde8e('0x24')](handleError(_0x42601d,null));};exports[_0xde8e('0xa8')]=function(_0x3be338,_0x5a9a49){var _0x42992f={'raw':!![],'where':{}};var _0x9698e8={};var _0x4be026={'count':0x0,'rows':[]};return db[_0xde8e('0x29')][_0xde8e('0x7f')]({'where':{'id':_0x3be338['params']['id']}})[_0xde8e('0x19')](handleEntityNotFound(_0x5a9a49,null))[_0xde8e('0x19')](function(_0x5d4469){if(_0x5d4469){_0x9698e8[_0xde8e('0x83')]=_['keys'](db[_0xde8e('0x4c')][_0xde8e('0x80')]);_0x9698e8[_0xde8e('0x22')]=_[_0xde8e('0x2b')](_0x3be338[_0xde8e('0x22')]);_0x9698e8[_0xde8e('0x81')]=_[_0xde8e('0x82')](_0x9698e8['model'],_0x9698e8[_0xde8e('0x22')]);_0x42992f[_0xde8e('0x84')]=_['intersection'](_0x9698e8[_0xde8e('0x83')],qs[_0xde8e('0x85')](_0x3be338['query'][_0xde8e('0x85')]));_0x42992f['attributes']=_0x42992f[_0xde8e('0x84')][_0xde8e('0x30')]?_0x42992f[_0xde8e('0x84')]:_0x9698e8['model'];if(!_0x3be338[_0xde8e('0x22')]['hasOwnProperty'](_0xde8e('0x89'))){_0x42992f['limit']=qs[_0xde8e('0x8a')](_0x3be338[_0xde8e('0x22')][_0xde8e('0x8a')]);_0x42992f[_0xde8e('0x8b')]=qs[_0xde8e('0x8b')](_0x3be338[_0xde8e('0x22')][_0xde8e('0x8b')]);}_0x42992f[_0xde8e('0x86')]=qs[_0xde8e('0xa3')](_0x3be338['query'][_0xde8e('0xa3')]);_0x42992f[_0xde8e('0x5e')]=qs[_0xde8e('0x81')](_['pick'](_0x3be338['query'],_0x9698e8[_0xde8e('0x81')]));_0x42992f[_0xde8e('0x5e')][_0xde8e('0xa4')]=_0x5d4469['id'];if(_0x3be338['query'][_0xde8e('0x88')]){_0x42992f[_0xde8e('0x5e')]=_[_0xde8e('0x37')](_0x42992f[_0xde8e('0x5e')],{'$or':_[_0xde8e('0x70')](_0x42992f[_0xde8e('0x84')],function(_0x47681a){var _0x358b9a={};_0x358b9a[_0x47681a]={'$like':'%'+_0x3be338[_0xde8e('0x22')][_0xde8e('0x88')]+'%'};return _0x358b9a;})});}_0x42992f=_['merge']({},_0x42992f,_0x3be338[_0xde8e('0xa5')]);return db['CmHopperHistory'][_0xde8e('0x15')]({'where':_0x42992f[_0xde8e('0x5e')]})[_0xde8e('0x19')](function(_0x46824d){_0x4be026[_0xde8e('0x15')]=_0x46824d;if(_0x3be338[_0xde8e('0x22')][_0xde8e('0xa9')]){_0x42992f['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xde8e('0x21')](_0x42992f);})[_0xde8e('0x19')](function(_0x5e75c0){_0x4be026[_0xde8e('0xa7')]=_0x5e75c0;return _0x4be026;});}})[_0xde8e('0x19')](respondWithFilteredResult(_0x5a9a49,_0x42992f))[_0xde8e('0x24')](handleError(_0x5a9a49,null));};exports['getHopperFinals']=function(_0x2361c8,_0x49e101){var _0x1eb3eb={'raw':!![],'where':{}};var _0x1dc89a={};var _0x54a5cc={'count':0x0,'rows':[]};return db['CmContact'][_0xde8e('0x7f')]({'where':{'id':_0x2361c8[_0xde8e('0x27')]['id']}})[_0xde8e('0x19')](handleEntityNotFound(_0x49e101,null))[_0xde8e('0x19')](function(_0x3466a4){if(_0x3466a4){_0x1dc89a[_0xde8e('0x83')]=_[_0xde8e('0x2b')](db[_0xde8e('0x4b')][_0xde8e('0x80')]);_0x1dc89a[_0xde8e('0x22')]=_[_0xde8e('0x2b')](_0x2361c8[_0xde8e('0x22')]);_0x1dc89a[_0xde8e('0x81')]=_[_0xde8e('0x82')](_0x1dc89a[_0xde8e('0x83')],_0x1dc89a[_0xde8e('0x22')]);_0x1eb3eb[_0xde8e('0x84')]=_[_0xde8e('0x82')](_0x1dc89a['model'],qs[_0xde8e('0x85')](_0x2361c8[_0xde8e('0x22')][_0xde8e('0x85')]));_0x1eb3eb[_0xde8e('0x84')]=_0x1eb3eb[_0xde8e('0x84')]['length']?_0x1eb3eb['attributes']:_0x1dc89a[_0xde8e('0x83')];if(!_0x2361c8['query'][_0xde8e('0x62')](_0xde8e('0x89'))){_0x1eb3eb[_0xde8e('0x8a')]=qs[_0xde8e('0x8a')](_0x2361c8['query'][_0xde8e('0x8a')]);_0x1eb3eb[_0xde8e('0x8b')]=qs[_0xde8e('0x8b')](_0x2361c8[_0xde8e('0x22')][_0xde8e('0x8b')]);}_0x1eb3eb['order']=qs['sort'](_0x2361c8[_0xde8e('0x22')][_0xde8e('0xa3')]);_0x1eb3eb[_0xde8e('0x5e')]=qs['filters'](_[_0xde8e('0x87')](_0x2361c8[_0xde8e('0x22')],_0x1dc89a[_0xde8e('0x81')]));_0x1eb3eb[_0xde8e('0x5e')][_0xde8e('0xa4')]=_0x3466a4['id'];if(_0x2361c8[_0xde8e('0x22')][_0xde8e('0x88')]){_0x1eb3eb[_0xde8e('0x5e')]=_[_0xde8e('0x37')](_0x1eb3eb[_0xde8e('0x5e')],{'$or':_['map'](_0x1eb3eb[_0xde8e('0x84')],function(_0x3fa112){var _0x115e05={};_0x115e05[_0x3fa112]={'$like':'%'+_0x2361c8[_0xde8e('0x22')][_0xde8e('0x88')]+'%'};return _0x115e05;})});}_0x1eb3eb=_[_0xde8e('0x37')]({},_0x1eb3eb,_0x2361c8[_0xde8e('0xa5')]);return db[_0xde8e('0x4b')][_0xde8e('0x15')]({'where':_0x1eb3eb[_0xde8e('0x5e')]})[_0xde8e('0x19')](function(_0x4f2a18){_0x54a5cc[_0xde8e('0x15')]=_0x4f2a18;if(_0x2361c8[_0xde8e('0x22')][_0xde8e('0xa9')]){_0x1eb3eb[_0xde8e('0xa6')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xde8e('0x21')](_0x1eb3eb);})[_0xde8e('0x19')](function(_0x28985b){_0x54a5cc['rows']=_0x28985b;return _0x54a5cc;});}})[_0xde8e('0x19')](respondWithFilteredResult(_0x49e101,_0x1eb3eb))['catch'](handleError(_0x49e101,null));};exports['getJscriptySessions']=function(_0x57d01f,_0x5414ff){var _0x4bbd58={'raw':!![],'where':{}};var _0x5f0b15={};var _0x215dec={'count':0x0,'rows':[]};return db[_0xde8e('0x29')][_0xde8e('0x7f')]({'where':{'id':_0x57d01f['params']['id']}})['then'](handleEntityNotFound(_0x5414ff,null))['then'](function(_0x4078d7){if(_0x4078d7){_0x5f0b15[_0xde8e('0x83')]=_[_0xde8e('0x2b')](db[_0xde8e('0x54')][_0xde8e('0x80')]);_0x5f0b15['query']=_[_0xde8e('0x2b')](_0x57d01f[_0xde8e('0x22')]);_0x5f0b15[_0xde8e('0x81')]=_[_0xde8e('0x82')](_0x5f0b15['model'],_0x5f0b15[_0xde8e('0x22')]);_0x4bbd58[_0xde8e('0x84')]=_[_0xde8e('0x82')](_0x5f0b15[_0xde8e('0x83')],qs[_0xde8e('0x85')](_0x57d01f[_0xde8e('0x22')][_0xde8e('0x85')]));_0x4bbd58[_0xde8e('0x84')]=_0x4bbd58[_0xde8e('0x84')][_0xde8e('0x30')]?_0x4bbd58[_0xde8e('0x84')]:_0x5f0b15[_0xde8e('0x83')];if(!_0x57d01f[_0xde8e('0x22')][_0xde8e('0x62')](_0xde8e('0x89'))){_0x4bbd58[_0xde8e('0x8a')]=qs[_0xde8e('0x8a')](_0x57d01f['query'][_0xde8e('0x8a')]);_0x4bbd58[_0xde8e('0x8b')]=qs[_0xde8e('0x8b')](_0x57d01f[_0xde8e('0x22')][_0xde8e('0x8b')]);}_0x4bbd58[_0xde8e('0x86')]=qs[_0xde8e('0xa3')](_0x57d01f[_0xde8e('0x22')][_0xde8e('0xa3')]);_0x4bbd58[_0xde8e('0x5e')]=qs['filters'](_[_0xde8e('0x87')](_0x57d01f[_0xde8e('0x22')],_0x5f0b15[_0xde8e('0x81')]));_0x4bbd58[_0xde8e('0x5e')][_0xde8e('0xa4')]=_0x4078d7['id'];if(_0x57d01f[_0xde8e('0x22')][_0xde8e('0x88')]){_0x4bbd58[_0xde8e('0x5e')]=_[_0xde8e('0x37')](_0x4bbd58['where'],{'$or':_[_0xde8e('0x70')](_0x4bbd58[_0xde8e('0x84')],function(_0x37b80c){var _0x1d5f02={};_0x1d5f02[_0x37b80c]={'$like':'%'+_0x57d01f['query'][_0xde8e('0x88')]+'%'};return _0x1d5f02;})});}_0x4bbd58=_[_0xde8e('0x37')]({},_0x4bbd58,_0x57d01f['options']);return db[_0xde8e('0x54')][_0xde8e('0x15')]({'where':_0x4bbd58[_0xde8e('0x5e')]})[_0xde8e('0x19')](function(_0x461b55){_0x215dec[_0xde8e('0x15')]=_0x461b55;if(_0x57d01f['query'][_0xde8e('0xa9')]){_0x4bbd58[_0xde8e('0xa6')]=[{'all':!![]}];}return db[_0xde8e('0x54')][_0xde8e('0x21')](_0x4bbd58);})[_0xde8e('0x19')](function(_0x2152b4){_0x215dec[_0xde8e('0xa7')]=_0x2152b4;return _0x215dec;});}})[_0xde8e('0x19')](respondWithFilteredResult(_0x5414ff,_0x4bbd58))['catch'](handleError(_0x5414ff,null));};exports['uploadCsv']=function(_0x5bdd7e,_0x55c50a){try{if(!_0x5bdd7e[_0xde8e('0x38')]['ListId']){throw new Error(_0xde8e('0xaa'));}if(!_0x5bdd7e[_0xde8e('0x38')][_0xde8e('0xab')]){throw new Error(_0xde8e('0xac'));}if(!_0x5bdd7e[_0xde8e('0x38')]['binding_values']){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x5bdd7e['body'][_0xde8e('0xad')]){throw new Error(_0xde8e('0xae'));}var _0x33a19a=_0x5bdd7e['body'][_0xde8e('0xab')][_0xde8e('0xaf')](',');var _0x4fa302=_0x5bdd7e[_0xde8e('0x38')][_0xde8e('0xb0')][_0xde8e('0xaf')](',');if(!_0x33a19a['length']||!_0x4fa302[_0xde8e('0x30')]||_0x33a19a[_0xde8e('0x30')]!==_0x4fa302[_0xde8e('0x30')]){throw new Error(_0xde8e('0xb1'));}_0x5bdd7e[_0xde8e('0x38')][_0xde8e('0x85')]=_['zipObject'](_0x33a19a,_0x4fa302);if(!_0x5bdd7e[_0xde8e('0x38')]['fields']['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x5bdd7e[_0xde8e('0x38')][_0xde8e('0x85')][_0xde8e('0xb2')]){throw new Error(_0xde8e('0xb3'));}var _0x1a62b9=path['join'](config[_0xde8e('0xb4')],_0xde8e('0xb5'),_0x5bdd7e['file'][_0xde8e('0xb6')]);fs['chmodSync'](_0x1a62b9,parseInt(_0xde8e('0xb7'),0x8));var _0x7eb09b=require(_0xde8e('0xb8'))[_0xde8e('0xb9')](path['join'](__dirname,_0xde8e('0xba')),[_0x1a62b9,_0x5bdd7e[_0xde8e('0x38')][_0xde8e('0xab')],_0x5bdd7e['body'][_0xde8e('0xb0')],_0x5bdd7e[_0xde8e('0x38')][_0xde8e('0x60')],_0x5bdd7e[_0xde8e('0x38')][_0xde8e('0xbb')],_0x5bdd7e[_0xde8e('0x38')]['duplicates'],_0x5bdd7e[_0xde8e('0x38')][_0xde8e('0xad')]]);return _0x55c50a['status'](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x7eb09b[_0xde8e('0xbc')]});}catch(_0xada76){return _0x55c50a['status'](0x1f4)[_0xde8e('0x1e')](_0xada76);}};exports['upload']=function(_0x181c24,_0x146929){var _0x33d9c1=fs[_0xde8e('0xbd')](_0x181c24[_0xde8e('0xbe')][_0xde8e('0x3')]);Papa[_0xde8e('0xbf')](_0x33d9c1,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x4d4837){return _0x146929['status'](0xc8)[_0xde8e('0x13')]({'file':_0x181c24[_0xde8e('0xbe')],'fields':_0x4d4837[_0xde8e('0xc0')][_0xde8e('0x85')]});}});};exports[_0xde8e('0xc1')]=function(_0x4a50a7,_0x727cea){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xde8e('0xc2')}})[_0xde8e('0x19')](function(_0x5ac537){var _0x7620e5=![];if(!_0x4a50a7['body'][_0xde8e('0x60')]){throw new Error(_0xde8e('0xaa'));}if(!_0x4a50a7[_0xde8e('0x38')][_0xde8e('0xc3')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x4a50a7['body'][_0xde8e('0xc3')][_0xde8e('0xb2')]){throw new Error(_0xde8e('0xb3'));}if(!_0x4a50a7[_0xde8e('0x38')][_0xde8e('0xad')]){throw new Error(_0xde8e('0xae'));}var _0x28280d=require(_0xde8e('0xb8'))[_0xde8e('0xb9')](path[_0xde8e('0x3c')](__dirname,'../../components/import/cm/csv2'),[_0x4a50a7[_0xde8e('0x27')]['id'],JSON[_0xde8e('0xc4')](_0x4a50a7['body']),JSON['stringify'](_0x5ac537)]);_0x28280d['on']('message',function(){_0x7620e5=!![];return _0x727cea[_0xde8e('0x12')](0xc8)[_0xde8e('0x13')]({'message':_0xde8e('0xc5'),'pid':_0x28280d[_0xde8e('0xbc')]});});_0x28280d['on'](_0xde8e('0xc6'),function(_0xf1cfec){if(_0xf1cfec&&!_0x7620e5){return _0x727cea[_0xde8e('0x12')](0x1f4)[_0xde8e('0x13')]({'message':_0xde8e('0xc7'),'pid':_0x28280d[_0xde8e('0xbc')]});}});})[_0xde8e('0x24')](handleError(_0x727cea,null));};exports[_0xde8e('0xc8')]=function(_0x4d1f6a,_0x3c099f){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xde8e('0xc2')}})['then'](function(_0x7cb8a0){var _0x417819=![];if(!_0x4d1f6a['body']['ListId']){throw new Error(_0xde8e('0xaa'));}if(!_0x4d1f6a[_0xde8e('0x38')][_0xde8e('0xc3')][_0xde8e('0x7d')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x4d1f6a[_0xde8e('0x38')][_0xde8e('0xc3')][_0xde8e('0xb2')]){throw new Error(_0xde8e('0xb3'));}if(!_0x4d1f6a[_0xde8e('0x38')][_0xde8e('0xad')]){throw new Error(_0xde8e('0xae'));}var _0x2289e7=require(_0xde8e('0xb8'))[_0xde8e('0xb9')](path[_0xde8e('0x3c')](__dirname,'../../components/import/cm/csvUpdates'),[_0x4d1f6a[_0xde8e('0x27')]['id'],JSON['stringify'](_0x4d1f6a[_0xde8e('0x38')]),JSON[_0xde8e('0xc4')](_0x7cb8a0)]);_0x2289e7['on'](_0xde8e('0xc9'),function(){_0x417819=!![];return _0x3c099f[_0xde8e('0x12')](0xc8)[_0xde8e('0x13')]({'message':_0xde8e('0xc5'),'pid':_0x2289e7['pid']});});_0x2289e7['on']('exit',function(_0x2dc423){if(_0x2dc423&&!_0x417819){return _0x3c099f[_0xde8e('0x12')](0x1f4)['json']({'message':_0xde8e('0xc7'),'pid':_0x2289e7[_0xde8e('0xbc')]});}});})[_0xde8e('0x24')](handleError(_0x3c099f,null));};exports[_0xde8e('0xca')]=function(_0x16ba09,_0x233527){var _0x387f62=[_0xde8e('0xcb'),'chat',_0xde8e('0xcc'),'openchannel',_0xde8e('0xcd'),_0xde8e('0xce'),'voice'];var _0x51622a={'offset':0x0,'order':qs[_0xde8e('0xa3')](_0xde8e('0xcf'))},_0x1274a3={'count':0x0,'rows':[]};Promise[_0xde8e('0xd0')]()['then'](function(){if(_0x16ba09[_0xde8e('0x22')][_0xde8e('0xd1')]){if(!_[_0xde8e('0xd2')](_0x387f62,_0x16ba09[_0xde8e('0x22')][_0xde8e('0xd1')][_0xde8e('0xd3')]())){throw new Error(_0xde8e('0xd4'));}_0x387f62=[_0x16ba09[_0xde8e('0x22')]['channel'][_0xde8e('0xd3')]()];}if(_0x16ba09[_0xde8e('0x22')][_0xde8e('0xd5')]){try{var _0x1ff567=JSON[_0xde8e('0xbf')](_0x16ba09['query'][_0xde8e('0xd5')]);if(!moment(_0x1ff567[_0xde8e('0x39')])[_0xde8e('0xd6')]()){throw new Error(_0xde8e('0xd7'));}if(!moment(_0x1ff567['to'])[_0xde8e('0xd6')]()){throw new Error(_0xde8e('0xd8'));}}catch(_0x4dc6e2){throw new Error(_0xde8e('0xd9'));}}if(!_0x16ba09['query'][_0xde8e('0x62')](_0xde8e('0x89'))){_0x51622a['limit']=qs[_0xde8e('0x8a')](_0x16ba09[_0xde8e('0x22')][_0xde8e('0x8a')]||0xa);_0x51622a[_0xde8e('0x8b')]=qs[_0xde8e('0x8b')](_0x16ba09['query'][_0xde8e('0x8b')]);}var _0x14d871=_0x387f62['map'](function(_0x4b8f9c){if(_0x4b8f9c===_0xde8e('0xda')){var _0x3af512={'attributes':['id',_0xde8e('0xdb'),'type',_0xde8e('0xdc'),_0xde8e('0xdd'),_0xde8e('0xde'),_0xde8e('0xdf'),_0xde8e('0xe0'),'duration',_0xde8e('0xe1'),_0xde8e('0xe2'),_0xde8e('0xe3'),_0xde8e('0xe4'),'userThirdDisposition',_0xde8e('0xe5')],'where':{'ContactId':_0x16ba09[_0xde8e('0x27')]['id']},'include':[{'model':db['User'],'as':_0xde8e('0xe6'),'attributes':['id',_0xde8e('0x1d'),'fullname','alias']}],'order':[[_0xde8e('0xe2'),'DESC']]};if(_0x16ba09['query'][_0xde8e('0xd5')]){_0x3af512['where'][_0xde8e('0xe2')]={'$gte':_0x1ff567[_0xde8e('0x39')],'$lte':_0x1ff567['to']};}return db[_0xde8e('0x4e')]['findAndCountAll'](_0x3af512)['then'](function(_0x329359){_0x1274a3[_0xde8e('0x15')]+=_0x329359[_0xde8e('0x15')];return _[_0xde8e('0x70')](_0x329359['rows'],function(_0x782f73){var _0x35027e=_0x782f73[_0xde8e('0x3a')]({'plain':!![]});_0x35027e['channel']=_0x4b8f9c;if(_0x35027e['User']){_0x35027e[_0xde8e('0xe6')]={'id':_0x35027e['User']['id'],'name':_0x35027e[_0xde8e('0xe6')][_0xde8e('0x1d')],'fullname':_0x35027e[_0xde8e('0xe6')]['fullname'],'alias':_0x35027e[_0xde8e('0xe6')][_0xde8e('0xe7')]};}return _0x35027e;});});}else{var _0x2ad7b5=_[_0xde8e('0xe8')](_0x4b8f9c)+(_0x4b8f9c===_0xde8e('0xe9')?_0xde8e('0xea'):_0xde8e('0xeb'));var _0x5409e6={'attributes':['id',_0xde8e('0xec'),'closedAt','createdAt',_0xde8e('0xe1'),_0xde8e('0xed'),_0xde8e('0xee'),_0xde8e('0xef'),_0xde8e('0xe5'),_0x2ad7b5+'Id'],'where':{'ContactId':_0x16ba09[_0xde8e('0x27')]['id']},'include':[{'model':db[_0x2ad7b5],'as':_0xde8e('0xeb'),'attributes':['id',_0xde8e('0x1d'),_0xde8e('0xf0')]},{'model':db[_0xde8e('0xe6')],'as':_0xde8e('0xf1'),'attributes':['id',_0xde8e('0x1d'),_0xde8e('0xf2')]},{'model':db['Tag'],'as':_0xde8e('0x67'),'attributes':['id',_0xde8e('0x1d'),_0xde8e('0x68')],'through':{'attributes':[]}}],'order':[[_0xde8e('0xe2'),_0xde8e('0xf3')]]};if(_0x16ba09[_0xde8e('0x22')][_0xde8e('0xd5')]){_0x5409e6['where'][_0xde8e('0xe2')]={'$gte':_0x1ff567[_0xde8e('0x39')],'$lte':_0x1ff567['to']};}switch(_0x4b8f9c){case'chat':_0x5409e6['attributes']['push']('browserName',_0xde8e('0xf4'),'customerPort',_0xde8e('0xf5'),_0xde8e('0xf6'),_0xde8e('0xf7'),_0xde8e('0xf8'),_0xde8e('0xf9'),_0xde8e('0xfa'));break;case _0xde8e('0xcb'):_0x5409e6[_0xde8e('0x84')][_0xde8e('0x63')](_0xde8e('0xfb'),'substatus');break;case'openchannel':_0x5409e6[_0xde8e('0x84')][_0xde8e('0x63')]('externalUrl',_0xde8e('0xfc'));break;}return db[_[_0xde8e('0xe8')](_0x4b8f9c)+'Interaction'][_0xde8e('0xfd')](_0x5409e6)['then'](function(_0x3d8aa4){_0x1274a3[_0xde8e('0x15')]+=_0x3d8aa4[_0xde8e('0x15')];return _[_0xde8e('0x70')](_0x3d8aa4[_0xde8e('0xa7')],function(_0x9e2e2e){var _0x45486e=_0x9e2e2e[_0xde8e('0x3a')]({'plain':!![]});_0x45486e['channel']=_0x4b8f9c;if(_0x45486e['Owner']){_0x45486e[_0xde8e('0xf1')]={'id':_0x45486e['Owner']['id'],'name':_0x45486e[_0xde8e('0xf1')][_0xde8e('0x1d')],'fullname':_0x45486e[_0xde8e('0xf1')][_0xde8e('0xf2')]};}return _0x45486e;});});}});return Promise[_0xde8e('0x8f')](_0x14d871);})[_0xde8e('0x19')](function(_0x1f7a9f){return _(_0x1f7a9f)['flatten']()[_0xde8e('0xfe')](_0xde8e('0xe2'))[_0xde8e('0xff')]()[_0xde8e('0x100')]();})[_0xde8e('0x19')](function(_0x263eb3){_0x1274a3[_0xde8e('0xa7')]=_0x51622a[_0xde8e('0x8a')]?_0x263eb3[_0xde8e('0x101')](_0x51622a[_0xde8e('0x8b')],_0x51622a[_0xde8e('0x8b')]+_0x51622a[_0xde8e('0x8a')]):_0x263eb3;return _0x1274a3;})[_0xde8e('0x19')](respondWithFilteredResult(_0x233527,_0x51622a))['catch'](handleError(_0x233527,null));}; \ No newline at end of file +var _0x54da=['isArray','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','spread','all','show','Tag','Tags','color','tag','CmContactHasItem','Phones','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','CmCustomField','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','phone','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','options','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','item','ContactItemType','`ItemType`.OrderBy','CmHopperId','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','nolimit','ContactId','count','includeAll','rows','getHopperHistories','include','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','zipObject','No\x20phone\x20column\x20specified','root','server/files/tmp','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','createReadStream','file','meta','import','User','agent','binding','firstName','../../components/import/cm/csv2','stringify','pid','exit','error\x20child\x20process','importUpdates','No\x20firstName\x20column\x20specified','start\x20child\x20process\x20correctly!','getJourney','mail','openchannel','voice','resolve','channel','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','findAndCountAll','fullname','startCase','Website','closedAt','disposition','thirdDisposition','UserId','key','Owner','chat','browserName','deviceModel','osName','ratingMessage','ratingType','referer','subject','substatus','externalUrl','threadId','sortBy','reverse','value','moment','bluebird','util','path','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','./cmContact.socket','register','status','offset','undefined','limit','set','Content-Range','update','then','end','error','stack','name','send','describe','getOptions','findAll','query','user','catch','destroy','CmContact','find','params','tags','keys','length','startsWith','cf_','columnName','displayName','analytics','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith'];(function(_0x295e0f,_0x1c4d1c){var _0x2745ba=function(_0x56a2a9){while(--_0x56a2a9){_0x295e0f['push'](_0x295e0f['shift']());}};_0x2745ba(++_0x1c4d1c);}(_0x54da,0x1c5));var _0xa54d=function(_0x2b37b5,_0x4f677b){_0x2b37b5=_0x2b37b5-0x0;var _0x36df6d=_0x54da[_0x2b37b5];return _0x36df6d;};'use strict';var moment=require(_0xa54d('0x0'));var BPromise=require(_0xa54d('0x1'));var util=require(_0xa54d('0x2'));var path=require(_0xa54d('0x3'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xa54d('0x4'));var contacts=require(_0xa54d('0x5'));var qs=require(_0xa54d('0x6'));var logger=require(_0xa54d('0x7'))('api');var config=require(_0xa54d('0x8'));var shared=require(_0xa54d('0x9'));var db=require(_0xa54d('0xa'))['db'];config[_0xa54d('0xb')]=_[_0xa54d('0xc')](config[_0xa54d('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa54d('0xb')]));require(_0xa54d('0xd'))[_0xa54d('0xe')](socket);function respondWithResult(_0x54824c,_0x2ae123){_0x2ae123=_0x2ae123||0xc8;return function(_0x9b94d3){if(_0x9b94d3){return _0x54824c[_0xa54d('0xf')](_0x2ae123)['json'](_0x9b94d3);}};}function respondWithFilteredResult(_0x3591f8,_0xbf698a){return function(_0x2621ef){if(_0x2621ef){var _0xea2e14=typeof _0xbf698a[_0xa54d('0x10')]===_0xa54d('0x11')&&typeof _0xbf698a[_0xa54d('0x12')]===_0xa54d('0x11');var _0x3c469f=_0x2621ef['count'];var _0x2edba4=_0xea2e14?0x0:_0xbf698a['offset'];var _0x1e73e8=_0xea2e14?_0x2621ef['count']:_0xbf698a[_0xa54d('0x10')]+_0xbf698a[_0xa54d('0x12')];var _0xf34acc;if(_0x1e73e8>=_0x3c469f){_0x1e73e8=_0x3c469f;_0xf34acc=0xc8;}else{_0xf34acc=0xce;}_0x3591f8['status'](_0xf34acc);return _0x3591f8[_0xa54d('0x13')](_0xa54d('0x14'),_0x2edba4+'-'+_0x1e73e8+'/'+_0x3c469f)['json'](_0x2621ef);}return null;};}function saveUpdates(_0x247102){return function(_0x3a2a0f){if(_0x3a2a0f){return _0x3a2a0f[_0xa54d('0x15')](_0x247102)['then'](function(_0x37c826){return _0x37c826;});}return null;};}function removeEntity(_0x216656){return function(_0x218fd0){if(_0x218fd0){return _0x218fd0['destroy']()[_0xa54d('0x16')](function(){_0x216656[_0xa54d('0xf')](0xcc)[_0xa54d('0x17')]();});}};}function handleEntityNotFound(_0x23e2ac){return function(_0x2e388a){if(!_0x2e388a){_0x23e2ac['sendStatus'](0x194);}return _0x2e388a;};}function handleError(_0x4aafea,_0x6da888){_0x6da888=_0x6da888||0x1f4;return function(_0x5662ea){logger[_0xa54d('0x18')](_0x5662ea[_0xa54d('0x19')]);if(_0x5662ea[_0xa54d('0x1a')]){delete _0x5662ea['name'];}_0x4aafea[_0xa54d('0xf')](_0x6da888)[_0xa54d('0x1b')](_0x5662ea);};}exports['index']=function(_0x59dc29,_0x76df9b){var _0x3e83a0={};return contacts[_0xa54d('0x1c')]()[_0xa54d('0x16')](function(_0x488de5){_0x3e83a0=qs[_0xa54d('0x1d')](_0x488de5,_0x59dc29);return contacts[_0xa54d('0x1e')](_0x59dc29[_0xa54d('0x1f')],_0x59dc29[_0xa54d('0x20')],_0x3e83a0,_0x488de5);})[_0xa54d('0x16')](respondWithFilteredResult(_0x76df9b,_0x3e83a0))[_0xa54d('0x21')](handleError(_0x76df9b,null));};exports[_0xa54d('0x22')]=function(_0x5ecfb5,_0x1f433c){return db[_0xa54d('0x23')][_0xa54d('0x24')]({'where':{'id':_0x5ecfb5[_0xa54d('0x25')]['id']}})[_0xa54d('0x16')](handleEntityNotFound(_0x1f433c,null))[_0xa54d('0x16')](removeEntity(_0x1f433c,null))[_0xa54d('0x21')](handleError(_0x1f433c,null));};exports[_0xa54d('0x1c')]=function(_0x242f2e,_0x539c26){return db[_0xa54d('0x23')][_0xa54d('0x1c')]()[_0xa54d('0x16')](function(_0x262dc0){delete _0x262dc0[_0xa54d('0x26')];for(var _0x5def55=0x0;_0x5def550x0){return new Promise(function(_0x26dc16){var _0x166673=[];for(var _0xc83e12=0x0;_0xc83e12<_0x49bb31['length'];_0xc83e12++){_0x166673[_0xa54d('0x64')](insertAdditionalPhones(_0x49bb31[_0xc83e12]['contact'],_0x49bb31[_0xc83e12][_0xa54d('0x5e')]));}Promise[_0xa54d('0x67')](_0x166673)['then'](function(){_0x26dc16(0x1);});})[_0xa54d('0x16')](function(){return{'success':_0x26af33,'failure':_0x4c6dc8,'duplicates':_0x1b108e};});}else{return{'success':_0x26af33,'failure':_0x4c6dc8,'duplicates':_0x1b108e};}}})['then'](respondWithResult(_0x5afe3e,0xc9))[_0xa54d('0x21')](handleError(_0x5afe3e,null));};exports[_0xa54d('0x68')]=function(_0x4f4ba0,_0x50a08b){var _0x445081;return db['CmContact'][_0xa54d('0x1c')]()[_0xa54d('0x16')](function(_0x1f01d4){return db['CmContact'][_0xa54d('0x24')]({'where':{'id':_0x4f4ba0[_0xa54d('0x25')]['id']},'include':[{'model':db[_0xa54d('0x69')],'as':_0xa54d('0x6a'),'attributes':['id',_0xa54d('0x1a'),_0xa54d('0x6b')],'required':_0x4f4ba0[_0xa54d('0x1f')][_0xa54d('0x6c')]?!![]:![]},{'model':db[_0xa54d('0x6d')],'as':_0xa54d('0x6e'),'where':{'CmContactId':_0x4f4ba0[_0xa54d('0x25')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xa54d('0x6f')}]}],'order':[db[_0xa54d('0x70')][_0xa54d('0x71')](_0xa54d('0x72'))],'attributes':_['keys'](_0x1f01d4)});})[_0xa54d('0x16')](function(_0x5f146a){if(!_[_0xa54d('0x5a')](_0x5f146a)){_0x445081=_0x5f146a[_0xa54d('0x39')]({'plain':!![]});var _0x41c569={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5f146a&&_0x5f146a[_0xa54d('0x65')]){if(_0x5f146a[_0xa54d('0x65')]){_0x41c569[_0xa54d('0x62')][_0xa54d('0x73')][_0xa54d('0x64')]({'ListId':{'$ne':_0x5f146a[_0xa54d('0x65')]}});}}return db['CmCustomField'][_0xa54d('0x1e')](_0x41c569);}})[_0xa54d('0x16')](function(_0x22861e){if(!_[_0xa54d('0x5a')](_0x22861e)){return _[_0xa54d('0x74')](_0x445081,_[_0xa54d('0x75')](_0x22861e,function(_0x3d8eb3){return util[_0xa54d('0x76')](_0xa54d('0x77'),_0x3d8eb3['id']);}));}})[_0xa54d('0x16')](handleEntityNotFound(_0x50a08b,null))[_0xa54d('0x16')](respondWithResult(_0x50a08b,null))[_0xa54d('0x21')](handleError(_0x50a08b,null));};exports[_0xa54d('0x15')]=function(_0x329a38,_0x456c41){var _0xabfa2;if(_0x329a38['body']['id']){delete _0x329a38[_0xa54d('0x37')]['id'];}if(!_[_0xa54d('0x5a')](_0x329a38[_0xa54d('0x37')][_0xa54d('0x5b')])){var _0x280f46=_0x329a38[_0xa54d('0x37')][_0xa54d('0x5b')];if(!_[_0xa54d('0x5a')](shared[_0xa54d('0x5c')][_0x280f46]))_0x329a38[_0xa54d('0x37')][_0xa54d('0x5d')]=shared[_0xa54d('0x5c')][_0x280f46][_0xa54d('0x5d')];}return db['CmContact']['find']({'where':{'id':_0x329a38[_0xa54d('0x25')]['id']}})[_0xa54d('0x16')](handleEntityNotFound(_0x456c41,null))[_0xa54d('0x16')](saveUpdates(_0x329a38[_0xa54d('0x37')],null))[_0xa54d('0x16')](function(_0x437f19){_0xabfa2=_0x437f19;var _0x362a03={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x437f19&&_0x437f19['ListId']){if(_0x437f19[_0xa54d('0x65')]){_0x362a03[_0xa54d('0x62')]['$and'][_0xa54d('0x64')]({'ListId':{'$ne':_0x437f19[_0xa54d('0x65')]}});}}return db[_0xa54d('0x78')][_0xa54d('0x1e')](_0x362a03);})[_0xa54d('0x16')](function(_0x14249a){if(_0x14249a){return _[_0xa54d('0x74')](_['pickBy'](_0x329a38[_0xa54d('0x37')],function(_0x1d6040,_0x150715){return _[_0xa54d('0x29')](_0x150715,_0xa54d('0x2a'));}),_[_0xa54d('0x75')](_0x14249a,function(_0x26fc81){return util['format'](_0xa54d('0x77'),_0x26fc81['id']);}));}})[_0xa54d('0x16')](function(_0x4741e7){if(_0x4741e7&&!_[_0xa54d('0x79')](_0x4741e7)){var _0x1b0c7a=squel[_0xa54d('0x15')]()[_0xa54d('0x7a')](_0xa54d('0x7b'))[_0xa54d('0x7c')](_0x4741e7)[_0xa54d('0x62')](_0xa54d('0x7d'),_0x329a38[_0xa54d('0x25')]['id'])[_0xa54d('0x7e')]();return db['sequelize']['query'](_0x1b0c7a['text'],{'replacements':_0x1b0c7a[_0xa54d('0x31')]});}})[_0xa54d('0x16')](function(){if(_0x329a38[_0xa54d('0x37')][_0xa54d('0x7f')]&&_0xabfa2){return db[_0xa54d('0x3d')][_0xa54d('0x15')]({'phone':_0x329a38['body'][_0xa54d('0x7f')],'OrderBy':0x0},{'where':{'ContactId':_0xabfa2['id']}});}})[_0xa54d('0x16')](function(){return _0xabfa2;})[_0xa54d('0x16')](respondWithResult(_0x456c41,null))['catch'](handleError(_0x456c41,null));};exports[_0xa54d('0x80')]=function(_0x543314,_0x185df7){var _0x200ad7={};var _0x49a0c4={};var _0x232fc1;var _0x4e17e9;return db[_0xa54d('0x23')][_0xa54d('0x81')]({'where':{'id':_0x543314[_0xa54d('0x25')]['id']}})[_0xa54d('0x16')](handleEntityNotFound(_0x185df7,null))['then'](function(_0x59b3b9){if(_0x59b3b9){_0x232fc1=_0x59b3b9;_0x49a0c4[_0xa54d('0x82')]=_[_0xa54d('0x27')](db[_0xa54d('0x69')][_0xa54d('0x83')]);_0x49a0c4[_0xa54d('0x1f')]=_['keys'](_0x543314[_0xa54d('0x1f')]);_0x49a0c4[_0xa54d('0x84')]=_[_0xa54d('0x85')](_0x49a0c4[_0xa54d('0x82')],_0x49a0c4[_0xa54d('0x1f')]);_0x200ad7[_0xa54d('0x86')]=_['intersection'](_0x49a0c4[_0xa54d('0x82')],qs[_0xa54d('0x87')](_0x543314[_0xa54d('0x1f')][_0xa54d('0x87')]));_0x200ad7[_0xa54d('0x86')]=_0x200ad7['attributes'][_0xa54d('0x28')]?_0x200ad7[_0xa54d('0x86')]:_0x49a0c4['model'];_0x200ad7[_0xa54d('0x88')]=qs[_0xa54d('0x89')](_0x543314['query'][_0xa54d('0x89')]);_0x200ad7[_0xa54d('0x62')]=qs[_0xa54d('0x84')](_[_0xa54d('0x8a')](_0x543314[_0xa54d('0x1f')],_0x49a0c4[_0xa54d('0x84')]));if(_0x543314[_0xa54d('0x1f')][_0xa54d('0x8b')]){_0x200ad7[_0xa54d('0x62')]=_['merge'](_0x200ad7[_0xa54d('0x62')],{'$or':_[_0xa54d('0x75')](_0x200ad7[_0xa54d('0x86')],function(_0x1b0afc){var _0x5641d1={};_0x5641d1[_0x1b0afc]={'$like':'%'+_0x543314['query'][_0xa54d('0x8b')]+'%'};return _0x5641d1;})});}_0x200ad7=_['merge']({},_0x200ad7,_0x543314[_0xa54d('0x8c')]);return _0x232fc1[_0xa54d('0x80')](_0x200ad7);}})[_0xa54d('0x16')](function(_0x4a8cad){if(_0x4a8cad){_0x4e17e9=_0x4a8cad[_0xa54d('0x28')];if(!_0x543314[_0xa54d('0x1f')]['hasOwnProperty']('nolimit')){_0x200ad7[_0xa54d('0x12')]=qs['limit'](_0x543314[_0xa54d('0x1f')][_0xa54d('0x12')]);_0x200ad7['offset']=qs[_0xa54d('0x10')](_0x543314[_0xa54d('0x1f')]['offset']);}return _0x232fc1[_0xa54d('0x80')](_0x200ad7);}})[_0xa54d('0x16')](function(_0x571b97){if(_0x571b97){return _0x571b97?{'count':_0x4e17e9,'rows':_0x571b97}:null;}})[_0xa54d('0x16')](respondWithResult(_0x185df7,null))[_0xa54d('0x21')](handleError(_0x185df7,null));};exports[_0xa54d('0x8d')]=function(_0x2ebd19,_0x286089){if(_0x2ebd19['body']['id']){delete _0x2ebd19[_0xa54d('0x37')]['id'];}return db['CmContact'][_0xa54d('0x81')]({'where':{'id':_0x2ebd19[_0xa54d('0x25')]['id']}})['then'](handleEntityNotFound(_0x286089,null))[_0xa54d('0x16')](function(_0x2e7036){if(_0x2e7036){return _0x2e7036[_0xa54d('0x8d')](_0x2ebd19[_0xa54d('0x37')][_0xa54d('0x8e')]||[]);}return null;})[_0xa54d('0x16')](respondWithResult(_0x286089,null))['catch'](handleError(_0x286089,null));};exports[_0xa54d('0x8f')]=function(_0x14a8a1,_0x2a398e){var _0x39aeb5=[];_0x39aeb5[_0xa54d('0x64')](addAdditionalPhones(_0x14a8a1[_0xa54d('0x37')]));Promise[_0xa54d('0x67')](_0x39aeb5)[_0xa54d('0x16')](function(){_0x39aeb5=[];_0x39aeb5[_0xa54d('0x64')](deleteCmHopperPhones(_0x14a8a1[_0xa54d('0x37')]['id']));_0x39aeb5[_0xa54d('0x64')](addCmHopperPhones(_0x14a8a1[_0xa54d('0x37')]['id']));Promise['all'](_0x39aeb5)[_0xa54d('0x16')](function(){return[0x1];})[_0xa54d('0x16')](respondWithResult(_0x2a398e,null));});};function addAdditionalPhones(_0x5969f2){var _0x247353;return new Promise(function(_0xb6d873){return db[_0xa54d('0x6d')]['destroy']({'where':{'CmContactId':_0x5969f2['id']}})['then'](function(){db['ContactItemType'][_0xa54d('0x1e')]({'raw':!![],'attributes':['id',_0xa54d('0x90')]})['then'](function(_0x58e1dd){var _0x4553e7=[];for(var _0x3469c2=0x0;_0x3469c2<_0x5969f2[_0xa54d('0x91')][_0xa54d('0x28')];_0x3469c2++){var _0x2db280=_0x5969f2[_0xa54d('0x92')]?_[_0xa54d('0x5a')](_0x5969f2['item_types'][_0x3469c2])?'':_0x5969f2[_0xa54d('0x92')][_0x3469c2]:_0x5969f2[_0xa54d('0x91')][_0x3469c2]['ItemTypeId']?_0x5969f2['items'][_0x3469c2][_0xa54d('0x93')]:'';var _0x51f7d9=_[_0xa54d('0x5a')](_0x5969f2[_0xa54d('0x91')][_0x3469c2][_0xa54d('0x94')])?'':_0x5969f2[_0xa54d('0x91')][_0x3469c2][_0xa54d('0x94')];var _0x532e73=_0x2db280+':'+_0x5969f2['items'][_0x3469c2][_0xa54d('0x7f')]+'§'+_0x51f7d9;if(_[_0xa54d('0x5a')](_0x247353))_0x247353=_0x532e73;else _0x247353+=';'+_0x532e73;var _0x25978f=null;var _0x2e029a=null;if(_0x5969f2[_0xa54d('0x92')]){if(!_[_0xa54d('0x5a')](_0x5969f2['item_types'][_0x3469c2])){_0x2e029a=_[_0xa54d('0x24')](_0x58e1dd,function(_0x484d85){return _0x484d85['id']===_0x5969f2[_0xa54d('0x92')][_0x3469c2];});if(!_[_0xa54d('0x5a')](_0x2e029a)){_0x25978f=_0x2e029a[_0xa54d('0x90')];}}}else{if(!_[_0xa54d('0x5a')](_0x5969f2['items'][_0x3469c2])){_0x2e029a=_['find'](_0x58e1dd,function(_0x2df766){return _0x2df766['id']===_0x5969f2[_0xa54d('0x91')][_0x3469c2][_0xa54d('0x93')];});if(!_[_0xa54d('0x5a')](_0x2e029a)){_0x25978f=_0x3469c2;}}}if(_[_0xa54d('0x5a')](_0x25978f)){_0x25978f=0x64;}_0x4553e7[_0xa54d('0x64')](addAdditionalPhone(_0x5969f2['id'],_0x5969f2[_0xa54d('0x91')][_0x3469c2][_0xa54d('0x7f')],_0x5969f2['item_types']?_[_0xa54d('0x5a')](_0x5969f2[_0xa54d('0x92')][_0x3469c2])?null:_0x5969f2[_0xa54d('0x92')][_0x3469c2]:_0x5969f2[_0xa54d('0x91')][_0x3469c2][_0xa54d('0x93')]?_0x5969f2[_0xa54d('0x91')][_0x3469c2][_0xa54d('0x93')]:null,_0x25978f,_0x51f7d9));}Promise[_0xa54d('0x67')](_0x4553e7)[_0xa54d('0x16')](function(){db[_0xa54d('0x23')][_0xa54d('0x15')]({'AdditionalPhones':_0x247353},{'where':{'id':_0x5969f2['id']}})[_0xa54d('0x16')](function(){_0xb6d873(0x1);});});});});});}function addAdditionalPhone(_0x46f058,_0x1f94a5,_0x2c6448,_0x241f87,_0x337ce0){return db[_0xa54d('0x6d')][_0xa54d('0x24')]({'where':{'CmContactId':_0x46f058,'item':_0x1f94a5}})[_0xa54d('0x16')](function(_0x44b7c5){if(_0x44b7c5)logger[_0xa54d('0x32')](_0xa54d('0x95'),_0x44b7c5);else{db[_0xa54d('0x6d')][_0xa54d('0x58')]({'CmContactId':_0x46f058,'item':_0x1f94a5,'ItemTypeId':_0x2c6448,'OrderBy':_0x241f87,'ItemClass':'PHONE','description':_0x337ce0});}});}function deleteCmHopperPhones(_0x193ac9){return new Promise(function(_0x3f62fb){return db[_0xa54d('0x3d')][_0xa54d('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x193ac9}})[_0xa54d('0x16')](function(_0x4aa056){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_['map'](_0x4aa056,'id')}}});})[_0xa54d('0x16')](function(){_0x3f62fb(0x1);});});}function addCmHopperPhones(_0x457309){return new Promise(function(_0x566c82){return db['CmHopper'][_0xa54d('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x457309}})[_0xa54d('0x16')](function(_0x534af3){var _0x389666=[];_[_0xa54d('0x75')](_0x534af3,function(_0x53d3a5){_0x389666[_0xa54d('0x64')](createCmHopperPhone(_0x457309,_0x53d3a5['id']));});Promise['all'](_0x389666)[_0xa54d('0x16')](function(){_0x566c82(0x1);});});});}function createCmHopperPhone(_0x326e04,_0x4afa5f){return new Promise(function(_0x557c4d){db['CmContactHasItem'][_0xa54d('0x1e')]({'raw':!![],'attributes':[_0xa54d('0x96'),_0xa54d('0x90')],'where':{'CmContactId':_0x326e04,'ItemClass':'PHONE'},'include':[{'model':db[_0xa54d('0x97')],'attributes':[_0xa54d('0x90')],'as':_0xa54d('0x6f')}],'order':[_0xa54d('0x90'),db[_0xa54d('0x70')][_0xa54d('0x71')](_0xa54d('0x98'))]})['then'](function(_0x17b389){var _0x500c0a=0x1;var _0x34897f=_['map'](_0x17b389,function(_0x39265c){_0x39265c[_0xa54d('0x99')]=_0x4afa5f;_0x39265c[_0xa54d('0x7f')]=_0x39265c[_0xa54d('0x96')];_0x39265c[_0xa54d('0x90')]=_0x500c0a;delete _0x39265c['ItemType.OrderBy'];_0x500c0a=_0x500c0a+0x1;return _0x39265c;});return db['CmHopperAdditionalPhone'][_0xa54d('0x5f')](_0x34897f,{});})[_0xa54d('0x16')](function(){_0x557c4d(0x1);});});}function insertAdditionalPhones(_0x222518,_0x293fb4){return new Promise(function(_0x132881){var _0x384582=[];for(var _0xe368aa=0x0;_0xe368aa<_0x293fb4[_0xa54d('0x28')];_0xe368aa++){var _0xb92ada=_0x293fb4[_0xe368aa];_0x384582[_0xa54d('0x64')](parseContactItemType(_0xb92ada));}Promise['all'](_0x384582)[_0xa54d('0x16')](function(){var _0x346162={'id':_0x222518['id'],'items':_0x293fb4};return addAdditionalPhones(_0x346162)['then'](function(){return addCmHopperPhones(_0x222518['id']);});})[_0xa54d('0x16')](function(){_0x132881(_0x222518);});});}function parseContactItemType(_0x276aac){return new Promise(function(_0x811925){if(_0x276aac[_0xa54d('0x35')](_0xa54d('0x93'))){_0x811925(_0x276aac);}else{return db[_0xa54d('0x97')][_0xa54d('0x24')]({'where':{'name':_0x276aac['ItemType']}})[_0xa54d('0x16')](function(_0x5d193c){if(_[_0xa54d('0x5a')](_0x5d193c))_0x276aac[_0xa54d('0x93')]=null;else _0x276aac[_0xa54d('0x93')]=_0x5d193c['id'];_0x811925(_0x276aac);});}});}exports[_0xa54d('0x9a')]=function(_0x477629,_0x44f02a){return db['CmContactHasItem'][_0xa54d('0x1e')]({'raw':!![],'where':{'CmContactId':_0x477629['params']['id'],'ItemClass':_0xa54d('0x9b')},'include':[{'model':db[_0xa54d('0x97')],'as':'ItemType'}],'order':[[_0xa54d('0x90')],[db[_0xa54d('0x70')][_0xa54d('0x71')](_0xa54d('0x98'))]]})[_0xa54d('0x16')](function(_0x13e21f){return _0x13e21f;})['then'](respondWithResult(_0x44f02a,null))['catch'](handleError(_0x44f02a,null));};exports[_0xa54d('0x9c')]=function(_0x1954e8,_0x147d7b){return db[_0xa54d('0x6d')]['findAll']({'raw':!![],'where':{'CmContactId':_0x1954e8[_0xa54d('0x37')]['fromContactId']}})[_0xa54d('0x16')](function(_0x1311b8){var _0x4bc55e=_[_0xa54d('0x75')](_0x1311b8,function(_0x239a2b){_0x239a2b[_0xa54d('0x9d')]=_0x1954e8['body'][_0xa54d('0x9e')];return _0x239a2b;});return db[_0xa54d('0x6d')][_0xa54d('0x5f')](_0x4bc55e,{});})[_0xa54d('0x16')](function(){return addCmHopperPhones(_0x1954e8[_0xa54d('0x37')][_0xa54d('0x9e')]);})['then'](function(){return['ok'];})[_0xa54d('0x16')](respondWithResult(_0x147d7b,null))['catch'](handleError(_0x147d7b,null));};exports[_0xa54d('0x9f')]=function(_0x58b104,_0x557f79){var _0x5b4a83=[];_0x5b4a83['push'](createCmHopperPhone(_0x58b104[_0xa54d('0x37')]['id'],_0x58b104[_0xa54d('0x37')]['hopperId']));Promise[_0xa54d('0x67')](_0x5b4a83)['then'](function(){return[0x1];})['then'](respondWithResult(_0x557f79,null));};exports[_0xa54d('0xa0')]=function(_0x18dc70,_0x1fb1cf){var _0x2d75ec={'raw':![],'where':{}};var _0x4042ea={};var _0x595123={'count':0x0,'rows':[]};return db[_0xa54d('0x23')][_0xa54d('0x81')]({'where':{'id':_0x18dc70[_0xa54d('0x25')]['id']}})[_0xa54d('0x16')](handleEntityNotFound(_0x1fb1cf,null))[_0xa54d('0x16')](function(_0x1b1f04){if(_0x1b1f04){_0x4042ea[_0xa54d('0x82')]=_[_0xa54d('0x27')](db[_0xa54d('0x3d')][_0xa54d('0x83')]);_0x4042ea[_0xa54d('0x1f')]=_[_0xa54d('0x27')](_0x18dc70[_0xa54d('0x1f')]);_0x4042ea['filters']=_['intersection'](_0x4042ea[_0xa54d('0x82')],_0x4042ea['query']);_0x2d75ec[_0xa54d('0x86')]=_[_0xa54d('0x85')](_0x4042ea[_0xa54d('0x82')],qs[_0xa54d('0x87')](_0x18dc70[_0xa54d('0x1f')]['fields']));_0x2d75ec[_0xa54d('0x86')]=_0x2d75ec[_0xa54d('0x86')]['length']?_0x2d75ec[_0xa54d('0x86')]:_0x4042ea['model'];if(!_0x18dc70[_0xa54d('0x1f')][_0xa54d('0x35')](_0xa54d('0xa1'))){_0x2d75ec[_0xa54d('0x12')]=qs[_0xa54d('0x12')](_0x18dc70[_0xa54d('0x1f')]['limit']);_0x2d75ec[_0xa54d('0x10')]=qs['offset'](_0x18dc70[_0xa54d('0x1f')][_0xa54d('0x10')]);}_0x2d75ec['order']=qs[_0xa54d('0x89')](_0x18dc70[_0xa54d('0x1f')][_0xa54d('0x89')]);_0x2d75ec[_0xa54d('0x62')]=qs[_0xa54d('0x84')](_[_0xa54d('0x8a')](_0x18dc70['query'],_0x4042ea[_0xa54d('0x84')]));_0x2d75ec[_0xa54d('0x62')][_0xa54d('0xa2')]=_0x1b1f04['id'];if(_0x18dc70['query'][_0xa54d('0x8b')]){_0x2d75ec[_0xa54d('0x62')]=_[_0xa54d('0x36')](_0x2d75ec[_0xa54d('0x62')],{'$or':_[_0xa54d('0x75')](_0x2d75ec['attributes'],function(_0xab0334){var _0x1fe7de={};_0x1fe7de[_0xab0334]={'$like':'%'+_0x18dc70[_0xa54d('0x1f')]['filter']+'%'};return _0x1fe7de;})});}_0x2d75ec=_[_0xa54d('0x36')]({},_0x2d75ec,_0x18dc70['options']);return db['CmHopper'][_0xa54d('0xa3')]({'where':_0x2d75ec[_0xa54d('0x62')]})['then'](function(_0x38580b){_0x595123[_0xa54d('0xa3')]=_0x38580b;if(_0x18dc70[_0xa54d('0x1f')][_0xa54d('0xa4')]){_0x2d75ec['include']=[{'all':!![]}];}return db[_0xa54d('0x3d')][_0xa54d('0x1e')](_0x2d75ec);})[_0xa54d('0x16')](function(_0xe3e72f){_0x595123[_0xa54d('0xa5')]=_0xe3e72f;return _0x595123;});}})[_0xa54d('0x16')](respondWithFilteredResult(_0x1fb1cf,_0x2d75ec))[_0xa54d('0x21')](handleError(_0x1fb1cf,null));};exports[_0xa54d('0xa6')]=function(_0x2e2a5b,_0x384abf){var _0x593144={'raw':!![],'where':{}};var _0x2eef68={};var _0x2dbf81={'count':0x0,'rows':[]};return db[_0xa54d('0x23')][_0xa54d('0x81')]({'where':{'id':_0x2e2a5b[_0xa54d('0x25')]['id']}})['then'](handleEntityNotFound(_0x384abf,null))[_0xa54d('0x16')](function(_0x3a19e6){if(_0x3a19e6){_0x2eef68[_0xa54d('0x82')]=_[_0xa54d('0x27')](db[_0xa54d('0x4c')]['rawAttributes']);_0x2eef68[_0xa54d('0x1f')]=_[_0xa54d('0x27')](_0x2e2a5b['query']);_0x2eef68[_0xa54d('0x84')]=_[_0xa54d('0x85')](_0x2eef68[_0xa54d('0x82')],_0x2eef68[_0xa54d('0x1f')]);_0x593144[_0xa54d('0x86')]=_['intersection'](_0x2eef68[_0xa54d('0x82')],qs[_0xa54d('0x87')](_0x2e2a5b['query'][_0xa54d('0x87')]));_0x593144['attributes']=_0x593144['attributes']['length']?_0x593144[_0xa54d('0x86')]:_0x2eef68[_0xa54d('0x82')];if(!_0x2e2a5b['query'][_0xa54d('0x35')](_0xa54d('0xa1'))){_0x593144[_0xa54d('0x12')]=qs[_0xa54d('0x12')](_0x2e2a5b[_0xa54d('0x1f')][_0xa54d('0x12')]);_0x593144[_0xa54d('0x10')]=qs['offset'](_0x2e2a5b['query'][_0xa54d('0x10')]);}_0x593144['order']=qs['sort'](_0x2e2a5b[_0xa54d('0x1f')][_0xa54d('0x89')]);_0x593144[_0xa54d('0x62')]=qs['filters'](_['pick'](_0x2e2a5b['query'],_0x2eef68[_0xa54d('0x84')]));_0x593144[_0xa54d('0x62')][_0xa54d('0xa2')]=_0x3a19e6['id'];if(_0x2e2a5b[_0xa54d('0x1f')][_0xa54d('0x8b')]){_0x593144['where']=_[_0xa54d('0x36')](_0x593144['where'],{'$or':_[_0xa54d('0x75')](_0x593144[_0xa54d('0x86')],function(_0x57fa8c){var _0x48e43a={};_0x48e43a[_0x57fa8c]={'$like':'%'+_0x2e2a5b['query'][_0xa54d('0x8b')]+'%'};return _0x48e43a;})});}_0x593144=_[_0xa54d('0x36')]({},_0x593144,_0x2e2a5b[_0xa54d('0x8c')]);return db[_0xa54d('0x4c')]['count']({'where':_0x593144['where']})[_0xa54d('0x16')](function(_0x19510e){_0x2dbf81[_0xa54d('0xa3')]=_0x19510e;if(_0x2e2a5b[_0xa54d('0x1f')][_0xa54d('0xa4')]){_0x593144[_0xa54d('0xa7')]=[{'all':!![]}];}return db[_0xa54d('0x4c')][_0xa54d('0x1e')](_0x593144);})[_0xa54d('0x16')](function(_0x3bdf75){_0x2dbf81[_0xa54d('0xa5')]=_0x3bdf75;return _0x2dbf81;});}})[_0xa54d('0x16')](respondWithFilteredResult(_0x384abf,_0x593144))[_0xa54d('0x21')](handleError(_0x384abf,null));};exports[_0xa54d('0xa8')]=function(_0xfb4050,_0x56385c){var _0x162d30={'raw':!![],'where':{}};var _0x74d90={};var _0x30b913={'count':0x0,'rows':[]};return db[_0xa54d('0x23')][_0xa54d('0x81')]({'where':{'id':_0xfb4050['params']['id']}})[_0xa54d('0x16')](handleEntityNotFound(_0x56385c,null))[_0xa54d('0x16')](function(_0x685d92){if(_0x685d92){_0x74d90['model']=_['keys'](db[_0xa54d('0x4b')][_0xa54d('0x83')]);_0x74d90[_0xa54d('0x1f')]=_['keys'](_0xfb4050[_0xa54d('0x1f')]);_0x74d90[_0xa54d('0x84')]=_[_0xa54d('0x85')](_0x74d90[_0xa54d('0x82')],_0x74d90[_0xa54d('0x1f')]);_0x162d30['attributes']=_[_0xa54d('0x85')](_0x74d90[_0xa54d('0x82')],qs[_0xa54d('0x87')](_0xfb4050[_0xa54d('0x1f')]['fields']));_0x162d30[_0xa54d('0x86')]=_0x162d30['attributes'][_0xa54d('0x28')]?_0x162d30[_0xa54d('0x86')]:_0x74d90[_0xa54d('0x82')];if(!_0xfb4050[_0xa54d('0x1f')]['hasOwnProperty']('nolimit')){_0x162d30[_0xa54d('0x12')]=qs[_0xa54d('0x12')](_0xfb4050[_0xa54d('0x1f')]['limit']);_0x162d30[_0xa54d('0x10')]=qs[_0xa54d('0x10')](_0xfb4050[_0xa54d('0x1f')][_0xa54d('0x10')]);}_0x162d30[_0xa54d('0x88')]=qs['sort'](_0xfb4050['query'][_0xa54d('0x89')]);_0x162d30[_0xa54d('0x62')]=qs[_0xa54d('0x84')](_['pick'](_0xfb4050['query'],_0x74d90[_0xa54d('0x84')]));_0x162d30[_0xa54d('0x62')][_0xa54d('0xa2')]=_0x685d92['id'];if(_0xfb4050[_0xa54d('0x1f')][_0xa54d('0x8b')]){_0x162d30['where']=_[_0xa54d('0x36')](_0x162d30[_0xa54d('0x62')],{'$or':_[_0xa54d('0x75')](_0x162d30[_0xa54d('0x86')],function(_0x3f2754){var _0x416d6e={};_0x416d6e[_0x3f2754]={'$like':'%'+_0xfb4050[_0xa54d('0x1f')][_0xa54d('0x8b')]+'%'};return _0x416d6e;})});}_0x162d30=_[_0xa54d('0x36')]({},_0x162d30,_0xfb4050[_0xa54d('0x8c')]);return db[_0xa54d('0x4b')][_0xa54d('0xa3')]({'where':_0x162d30['where']})['then'](function(_0x132084){_0x30b913[_0xa54d('0xa3')]=_0x132084;if(_0xfb4050['query'][_0xa54d('0xa4')]){_0x162d30['include']=[{'all':!![]}];}return db[_0xa54d('0x4b')][_0xa54d('0x1e')](_0x162d30);})[_0xa54d('0x16')](function(_0x578c5b){_0x30b913[_0xa54d('0xa5')]=_0x578c5b;return _0x30b913;});}})[_0xa54d('0x16')](respondWithFilteredResult(_0x56385c,_0x162d30))[_0xa54d('0x21')](handleError(_0x56385c,null));};exports[_0xa54d('0xa9')]=function(_0x2d0c47,_0x90da25){var _0xe2580f={'raw':!![],'where':{}};var _0x3a6d71={};var _0x307f84={'count':0x0,'rows':[]};return db[_0xa54d('0x23')][_0xa54d('0x81')]({'where':{'id':_0x2d0c47[_0xa54d('0x25')]['id']}})[_0xa54d('0x16')](handleEntityNotFound(_0x90da25,null))[_0xa54d('0x16')](function(_0x1c239a){if(_0x1c239a){_0x3a6d71[_0xa54d('0x82')]=_['keys'](db[_0xa54d('0x54')][_0xa54d('0x83')]);_0x3a6d71[_0xa54d('0x1f')]=_[_0xa54d('0x27')](_0x2d0c47[_0xa54d('0x1f')]);_0x3a6d71['filters']=_[_0xa54d('0x85')](_0x3a6d71[_0xa54d('0x82')],_0x3a6d71[_0xa54d('0x1f')]);_0xe2580f['attributes']=_[_0xa54d('0x85')](_0x3a6d71[_0xa54d('0x82')],qs[_0xa54d('0x87')](_0x2d0c47[_0xa54d('0x1f')][_0xa54d('0x87')]));_0xe2580f[_0xa54d('0x86')]=_0xe2580f['attributes'][_0xa54d('0x28')]?_0xe2580f['attributes']:_0x3a6d71['model'];if(!_0x2d0c47[_0xa54d('0x1f')][_0xa54d('0x35')](_0xa54d('0xa1'))){_0xe2580f[_0xa54d('0x12')]=qs[_0xa54d('0x12')](_0x2d0c47[_0xa54d('0x1f')][_0xa54d('0x12')]);_0xe2580f[_0xa54d('0x10')]=qs[_0xa54d('0x10')](_0x2d0c47[_0xa54d('0x1f')][_0xa54d('0x10')]);}_0xe2580f[_0xa54d('0x88')]=qs[_0xa54d('0x89')](_0x2d0c47[_0xa54d('0x1f')][_0xa54d('0x89')]);_0xe2580f[_0xa54d('0x62')]=qs[_0xa54d('0x84')](_['pick'](_0x2d0c47[_0xa54d('0x1f')],_0x3a6d71['filters']));_0xe2580f[_0xa54d('0x62')][_0xa54d('0xa2')]=_0x1c239a['id'];if(_0x2d0c47[_0xa54d('0x1f')][_0xa54d('0x8b')]){_0xe2580f[_0xa54d('0x62')]=_[_0xa54d('0x36')](_0xe2580f[_0xa54d('0x62')],{'$or':_[_0xa54d('0x75')](_0xe2580f['attributes'],function(_0x4b195b){var _0x4ea8e1={};_0x4ea8e1[_0x4b195b]={'$like':'%'+_0x2d0c47[_0xa54d('0x1f')]['filter']+'%'};return _0x4ea8e1;})});}_0xe2580f=_[_0xa54d('0x36')]({},_0xe2580f,_0x2d0c47[_0xa54d('0x8c')]);return db[_0xa54d('0x54')]['count']({'where':_0xe2580f[_0xa54d('0x62')]})[_0xa54d('0x16')](function(_0x1e378d){_0x307f84[_0xa54d('0xa3')]=_0x1e378d;if(_0x2d0c47[_0xa54d('0x1f')][_0xa54d('0xa4')]){_0xe2580f['include']=[{'all':!![]}];}return db[_0xa54d('0x54')][_0xa54d('0x1e')](_0xe2580f);})[_0xa54d('0x16')](function(_0x335f5d){_0x307f84[_0xa54d('0xa5')]=_0x335f5d;return _0x307f84;});}})[_0xa54d('0x16')](respondWithFilteredResult(_0x90da25,_0xe2580f))[_0xa54d('0x21')](handleError(_0x90da25,null));};exports[_0xa54d('0xaa')]=function(_0x4a1d06,_0x2d58a9){try{if(!_0x4a1d06[_0xa54d('0x37')]['ListId']){throw new Error(_0xa54d('0xab'));}if(!_0x4a1d06['body']['binding_keys']){throw new Error(_0xa54d('0xac'));}if(!_0x4a1d06[_0xa54d('0x37')][_0xa54d('0xad')]){throw new Error(_0xa54d('0xae'));}if(!_0x4a1d06[_0xa54d('0x37')][_0xa54d('0xaf')]){throw new Error(_0xa54d('0xb0'));}var _0x399e6a=_0x4a1d06[_0xa54d('0x37')][_0xa54d('0xb1')]['split'](',');var _0xe63542=_0x4a1d06[_0xa54d('0x37')][_0xa54d('0xad')][_0xa54d('0xb2')](',');if(!_0x399e6a[_0xa54d('0x28')]||!_0xe63542[_0xa54d('0x28')]||_0x399e6a[_0xa54d('0x28')]!==_0xe63542[_0xa54d('0x28')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x4a1d06[_0xa54d('0x37')][_0xa54d('0x87')]=_[_0xa54d('0xb3')](_0x399e6a,_0xe63542);if(!_0x4a1d06[_0xa54d('0x37')][_0xa54d('0x87')][_0xa54d('0x7f')]){throw new Error(_0xa54d('0xb4'));}if(!_0x4a1d06['body']['fields']['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x5e4fe7=path['join'](config[_0xa54d('0xb5')],_0xa54d('0xb6'),_0x4a1d06['file'][_0xa54d('0xb7')]);fs[_0xa54d('0xb8')](_0x5e4fe7,parseInt(_0xa54d('0xb9'),0x8));var _0x500daa=require(_0xa54d('0xba'))[_0xa54d('0xbb')](path[_0xa54d('0x59')](__dirname,_0xa54d('0xbc')),[_0x5e4fe7,_0x4a1d06['body'][_0xa54d('0xb1')],_0x4a1d06[_0xa54d('0x37')][_0xa54d('0xad')],_0x4a1d06[_0xa54d('0x37')][_0xa54d('0x65')],_0x4a1d06[_0xa54d('0x37')][_0xa54d('0xbd')],_0x4a1d06[_0xa54d('0x37')][_0xa54d('0x61')],_0x4a1d06[_0xa54d('0x37')][_0xa54d('0xaf')]]);return _0x2d58a9[_0xa54d('0xf')](0xc8)[_0xa54d('0xbe')]({'message':_0xa54d('0xbf'),'pid':_0x500daa['pid']});}catch(_0x283c21){return _0x2d58a9[_0xa54d('0xf')](0x1f4)[_0xa54d('0x1b')](_0x283c21);}};exports['upload']=function(_0x16701b,_0x5324f){var _0x47ee85=fs[_0xa54d('0xc0')](_0x16701b[_0xa54d('0xc1')][_0xa54d('0x3')]);Papa['parse'](_0x47ee85,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3c1c87){return _0x5324f[_0xa54d('0xf')](0xc8)[_0xa54d('0xbe')]({'file':_0x16701b[_0xa54d('0xc1')],'fields':_0x3c1c87[_0xa54d('0xc2')][_0xa54d('0x87')]});}});};exports[_0xa54d('0xc3')]=function(_0x135c2a,_0x4464aa){return db[_0xa54d('0xc4')][_0xa54d('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':_0xa54d('0xc5')}})['then'](function(_0x5b9495){var _0xbf178f=![];if(!_0x135c2a[_0xa54d('0x37')][_0xa54d('0x65')]){throw new Error(_0xa54d('0xab'));}if(!_0x135c2a[_0xa54d('0x37')]['binding']['phone']){throw new Error(_0xa54d('0xb4'));}if(!_0x135c2a[_0xa54d('0x37')][_0xa54d('0xc6')][_0xa54d('0xc7')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x135c2a['body'][_0xa54d('0xaf')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0xfd7ce2=require(_0xa54d('0xba'))[_0xa54d('0xbb')](path['join'](__dirname,_0xa54d('0xc8')),[_0x135c2a[_0xa54d('0x25')]['id'],JSON[_0xa54d('0xc9')](_0x135c2a['body']),JSON['stringify'](_0x5b9495)]);_0xfd7ce2['on']('message',function(){_0xbf178f=!![];return _0x4464aa[_0xa54d('0xf')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0xfd7ce2[_0xa54d('0xca')]});});_0xfd7ce2['on'](_0xa54d('0xcb'),function(_0x106fb0){if(_0x106fb0&&!_0xbf178f){return _0x4464aa[_0xa54d('0xf')](0x1f4)[_0xa54d('0xbe')]({'message':_0xa54d('0xcc'),'pid':_0xfd7ce2[_0xa54d('0xca')]});}});})[_0xa54d('0x21')](handleError(_0x4464aa,null));};exports[_0xa54d('0xcd')]=function(_0x266623,_0x36f164){return db['User'][_0xa54d('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':_0xa54d('0xc5')}})['then'](function(_0x1d4c18){var _0x33c4d7=![];if(!_0x266623[_0xa54d('0x37')][_0xa54d('0x65')]){throw new Error(_0xa54d('0xab'));}if(!_0x266623['body'][_0xa54d('0xc6')][_0xa54d('0x7f')]){throw new Error(_0xa54d('0xb4'));}if(!_0x266623['body'][_0xa54d('0xc6')][_0xa54d('0xc7')]){throw new Error(_0xa54d('0xce'));}if(!_0x266623[_0xa54d('0x37')]['socket_timestamp']){throw new Error(_0xa54d('0xb0'));}var _0x5c20be=require(_0xa54d('0xba'))[_0xa54d('0xbb')](path[_0xa54d('0x59')](__dirname,'../../components/import/cm/csvUpdates'),[_0x266623[_0xa54d('0x25')]['id'],JSON[_0xa54d('0xc9')](_0x266623[_0xa54d('0x37')]),JSON['stringify'](_0x1d4c18)]);_0x5c20be['on']('message',function(){_0x33c4d7=!![];return _0x36f164[_0xa54d('0xf')](0xc8)['json']({'message':_0xa54d('0xcf'),'pid':_0x5c20be[_0xa54d('0xca')]});});_0x5c20be['on'](_0xa54d('0xcb'),function(_0x1a5352){if(_0x1a5352&&!_0x33c4d7){return _0x36f164[_0xa54d('0xf')](0x1f4)['json']({'message':_0xa54d('0xcc'),'pid':_0x5c20be['pid']});}});})[_0xa54d('0x21')](handleError(_0x36f164,null));};exports[_0xa54d('0xd0')]=function(_0x9cec9a,_0x1b0f0d){var _0x6919ba=[_0xa54d('0xd1'),'chat','sms',_0xa54d('0xd2'),'fax','whatsapp',_0xa54d('0xd3')];var _0x59e159={'offset':0x0,'order':qs[_0xa54d('0x89')]('-createdAt')},_0x53ada7={'count':0x0,'rows':[]};Promise[_0xa54d('0xd4')]()[_0xa54d('0x16')](function(){if(_0x9cec9a[_0xa54d('0x1f')][_0xa54d('0xd5')]){if(!_['includes'](_0x6919ba,_0x9cec9a[_0xa54d('0x1f')][_0xa54d('0xd5')][_0xa54d('0xd6')]())){throw new Error(_0xa54d('0xd7'));}_0x6919ba=[_0x9cec9a['query'][_0xa54d('0xd5')][_0xa54d('0xd6')]()];}if(_0x9cec9a[_0xa54d('0x1f')][_0xa54d('0xd8')]){try{var _0x33d8c4=JSON[_0xa54d('0xd9')](_0x9cec9a[_0xa54d('0x1f')][_0xa54d('0xd8')]);if(!moment(_0x33d8c4[_0xa54d('0x38')])[_0xa54d('0xda')]()){throw new Error(_0xa54d('0xdb'));}if(!moment(_0x33d8c4['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x52f2ad){throw new Error(_0xa54d('0xdc'));}}if(!_0x9cec9a[_0xa54d('0x1f')][_0xa54d('0x35')]('nolimit')){_0x59e159[_0xa54d('0x12')]=qs['limit'](_0x9cec9a[_0xa54d('0x1f')][_0xa54d('0x12')]||0xa);_0x59e159[_0xa54d('0x10')]=qs[_0xa54d('0x10')](_0x9cec9a['query']['offset']);}var _0x30f91e=_0x6919ba[_0xa54d('0x75')](function(_0x1c7709){if(_0x1c7709===_0xa54d('0xd3')){var _0x45064b={'attributes':['id',_0xa54d('0xdd'),_0xa54d('0x30'),'source',_0xa54d('0xde'),_0xa54d('0xdf'),_0xa54d('0xe0'),_0xa54d('0xe1'),_0xa54d('0xe2'),_0xa54d('0xe3'),_0xa54d('0xe4'),_0xa54d('0xe5'),_0xa54d('0xe6'),_0xa54d('0xe7'),'UserId'],'where':{'ContactId':_0x9cec9a[_0xa54d('0x25')]['id']},'include':[{'model':db[_0xa54d('0xc4')],'as':_0xa54d('0xc4'),'attributes':['id',_0xa54d('0x1a'),'fullname',_0xa54d('0x2e')]}],'order':[[_0xa54d('0xe4'),'DESC']]};if(_0x9cec9a[_0xa54d('0x1f')]['range']){_0x45064b[_0xa54d('0x62')][_0xa54d('0xe4')]={'$gte':_0x33d8c4['from'],'$lte':_0x33d8c4['to']};}return db[_0xa54d('0x4e')][_0xa54d('0xe8')](_0x45064b)[_0xa54d('0x16')](function(_0x5e59b3){_0x53ada7[_0xa54d('0xa3')]+=_0x5e59b3[_0xa54d('0xa3')];return _['map'](_0x5e59b3['rows'],function(_0x20a0fe){var _0x29dee4=_0x20a0fe[_0xa54d('0x39')]({'plain':!![]});_0x29dee4[_0xa54d('0xd5')]=_0x1c7709;if(_0x29dee4[_0xa54d('0xc4')]){_0x29dee4[_0xa54d('0xc4')]={'id':_0x29dee4[_0xa54d('0xc4')]['id'],'name':_0x29dee4['User']['name'],'fullname':_0x29dee4['User'][_0xa54d('0xe9')],'alias':_0x29dee4[_0xa54d('0xc4')][_0xa54d('0x2e')]};}return _0x29dee4;});});}else{var _0x147f6d=_[_0xa54d('0xea')](_0x1c7709)+(_0x1c7709==='chat'?_0xa54d('0xeb'):'Account');var _0x48342a={'attributes':['id','closed',_0xa54d('0xec'),_0xa54d('0xe4'),_0xa54d('0xe3'),_0xa54d('0xed'),'secondDisposition',_0xa54d('0xee'),_0xa54d('0xef'),_0x147f6d+'Id'],'where':{'ContactId':_0x9cec9a[_0xa54d('0x25')]['id']},'include':[{'model':db[_0x147f6d],'as':'Account','attributes':['id',_0xa54d('0x1a'),_0xa54d('0xf0')]},{'model':db[_0xa54d('0xc4')],'as':_0xa54d('0xf1'),'attributes':['id',_0xa54d('0x1a'),_0xa54d('0xe9')]},{'model':db['Tag'],'as':_0xa54d('0x6a'),'attributes':['id',_0xa54d('0x1a'),'color'],'through':{'attributes':[]}}],'order':[[_0xa54d('0xe4'),'DESC']]};if(_0x9cec9a[_0xa54d('0x1f')]['range']){_0x48342a[_0xa54d('0x62')][_0xa54d('0xe4')]={'$gte':_0x33d8c4[_0xa54d('0x38')],'$lte':_0x33d8c4['to']};}switch(_0x1c7709){case _0xa54d('0xf2'):_0x48342a[_0xa54d('0x86')][_0xa54d('0x64')](_0xa54d('0xf3'),'customerIp','customerPort',_0xa54d('0xf4'),_0xa54d('0xf5'),_0xa54d('0xf6'),_0xa54d('0xf7'),'ratingValue',_0xa54d('0xf8'));break;case _0xa54d('0xd1'):_0x48342a['attributes'][_0xa54d('0x64')](_0xa54d('0xf9'),_0xa54d('0xfa'));break;case _0xa54d('0xd2'):_0x48342a[_0xa54d('0x86')][_0xa54d('0x64')](_0xa54d('0xfb'),_0xa54d('0xfc'));break;}return db[_[_0xa54d('0xea')](_0x1c7709)+'Interaction'][_0xa54d('0xe8')](_0x48342a)['then'](function(_0x235849){_0x53ada7[_0xa54d('0xa3')]+=_0x235849[_0xa54d('0xa3')];return _[_0xa54d('0x75')](_0x235849[_0xa54d('0xa5')],function(_0x4cb4ed){var _0x108f6b=_0x4cb4ed[_0xa54d('0x39')]({'plain':!![]});_0x108f6b['channel']=_0x1c7709;if(_0x108f6b[_0xa54d('0xf1')]){_0x108f6b[_0xa54d('0xf1')]={'id':_0x108f6b[_0xa54d('0xf1')]['id'],'name':_0x108f6b[_0xa54d('0xf1')][_0xa54d('0x1a')],'fullname':_0x108f6b['Owner'][_0xa54d('0xe9')]};}return _0x108f6b;});});}});return Promise[_0xa54d('0x67')](_0x30f91e);})[_0xa54d('0x16')](function(_0x44d3b5){return _(_0x44d3b5)['flatten']()[_0xa54d('0xfd')]('createdAt')[_0xa54d('0xfe')]()[_0xa54d('0xff')]();})[_0xa54d('0x16')](function(_0x4e0bc6){_0x53ada7[_0xa54d('0xa5')]=_0x59e159[_0xa54d('0x12')]?_0x4e0bc6['slice'](_0x59e159[_0xa54d('0x10')],_0x59e159[_0xa54d('0x10')]+_0x59e159[_0xa54d('0x12')]):_0x4e0bc6;return _0x53ada7;})['then'](respondWithFilteredResult(_0x1b0f0d,_0x59e159))[_0xa54d('0x21')](handleError(_0x1b0f0d,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index d6e7bf1..c177c87 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80cd=['emit','hasOwnProperty','hook','exports','../../mysqldb','CmContact','setMaxListeners','update'];(function(_0x4507de,_0x3f7682){var _0x55ce50=function(_0x5eb3a2){while(--_0x5eb3a2){_0x4507de['push'](_0x4507de['shift']());}};_0x55ce50(++_0x3f7682);}(_0x80cd,0xe4));var _0xd80c=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x80cd[_0x16de68];return _0x1c277e;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xd80c('0x0'))['db'][_0xd80c('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xd80c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd80c('0x3'),'afterDestroy':'remove'};function emitEvent(_0xddd352){return function(_0x176f09,_0x36434f,_0x334de4){CmContactEvents[_0xd80c('0x4')](_0xddd352+':'+_0x176f09['id'],_0x176f09);CmContactEvents['emit'](_0xddd352,_0x176f09);_0x334de4(null);};}for(var e in events){if(events[_0xd80c('0x5')](e)){var event=events[e];CmContact[_0xd80c('0x6')](e,emitEvent(event));}}module[_0xd80c('0x7')]=CmContactEvents; \ No newline at end of file +var _0x79cd=['../../mysqldb','CmContact','save','update','remove','emit','hook','events'];(function(_0x4eb1b3,_0x2c7e9f){var _0x2bd514=function(_0x4c3b8b){while(--_0x4c3b8b){_0x4eb1b3['push'](_0x4eb1b3['shift']());}};_0x2bd514(++_0x2c7e9f);}(_0x79cd,0x1a7));var _0xd79c=function(_0x504980,_0x3ac83a){_0x504980=_0x504980-0x0;var _0x5a6ed9=_0x79cd[_0x504980];return _0x5a6ed9;};'use strict';var EventEmitter=require(_0xd79c('0x0'));var CmContact=require(_0xd79c('0x1'))['db'][_0xd79c('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd79c('0x3'),'afterUpdate':_0xd79c('0x4'),'afterDestroy':_0xd79c('0x5')};function emitEvent(_0x65974){return function(_0x467234,_0x5b3918,_0x157918){CmContactEvents[_0xd79c('0x6')](_0x65974+':'+_0x467234['id'],_0x467234);CmContactEvents[_0xd79c('0x6')](_0x65974,_0x467234);_0x157918(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xd79c('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 5207995..0fe0589 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdce5=['util','../../config/logger','moment','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','format','isNil','resolve','then','dialTimezone','utcOffset','add','YYYY-MM-DD\x20HH:mm:ss','phone','ListId','scheduledat','priority','callbackUniqueid','assign','findOne','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','CmHopper','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','dialCheckDuplicateType','always','onlyIfOpen','outbound','CmList','Lists','map','findAll','all','BlackLists','CmHopperBlack','define','CmContact','cm_contacts','firstName','lastName','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message','get','length','destroy','ContactId','info','[CmContact][afterDestroy][Error]','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdce5,0x17f));var _0x5dce=function(_0x568469,_0x551ebd){_0x568469=_0x568469-0x0;var _0x1b8b2a=_0xdce5[_0x568469];return _0x1b8b2a;};'use strict';var _=require(_0x5dce('0x0'));var util=require(_0x5dce('0x1'));var logger=require(_0x5dce('0x2'))('api');var moment=require(_0x5dce('0x3'));var shared=require(_0x5dce('0x4'));var attributes=require(_0x5dce('0x5'));function getTimezoneCallbackAt(_0x34b45b,_0x6ea52,_0x480603,_0x186163){var _0x404176=_0x186163?_0x5dce('0x6'):_0x5dce('0x7');var _0x3c7cae=_0x480603['scheduledat']?_0x480603['scheduledat']:moment()[_0x5dce('0x8')]('YYYY-MM-DD\x20HH:mm:ss');if(_[_0x5dce('0x9')](_0x480603['dialTimezone'])){return Promise[_0x5dce('0xa')](_0x3c7cae);}return _0x34b45b[_0x404176]['findOne']({'where':{'id':_0x6ea52}})[_0x5dce('0xb')](function(_0x7db8b4){if(_[_0x5dce('0x9')](_0x7db8b4)||_[_0x5dce('0x9')](_0x7db8b4['dialTimezone'])){return Promise[_0x5dce('0xa')](_0x3c7cae);}var _0x1165cb=shared['timezones'];var _0x4374da=_0x1165cb[_0x7db8b4[_0x5dce('0xc')]];var _0x6b66cd=_0x1165cb[_0x480603['dialTimezone']];if(_[_0x5dce('0x9')](_0x4374da)&&_[_0x5dce('0x9')](_0x6b66cd)){return Promise[_0x5dce('0xa')](_0x3c7cae);}var _0x24079c=_0x4374da[_0x5dce('0xd')]-_0x6b66cd[_0x5dce('0xd')];var _0x516f97=_0x480603['scheduledat']?_0x480603['scheduledat']:moment();_0x3c7cae=moment(_0x516f97)[_0x5dce('0xe')](_0x24079c,'minutes')[_0x5dce('0x8')](_0x5dce('0xf'));return Promise[_0x5dce('0xa')](_0x3c7cae);});}function getNewHopperPayload(_0x5cb9bd){return{'phone':_0x5cb9bd[_0x5dce('0x10')],'ContactId':_0x5cb9bd['id'],'ListId':_0x5cb9bd[_0x5dce('0x11')],'scheduledat':_0x5cb9bd[_0x5dce('0x12')]?_0x5cb9bd[_0x5dce('0x12')]:moment()[_0x5dce('0x8')](_0x5dce('0xf')),'priority':_0x5cb9bd['priority']?_0x5cb9bd[_0x5dce('0x13')]:0x2,'callback':_0x5cb9bd[_0x5dce('0x14')]?!![]:![],'callbackuniqueid':_0x5cb9bd[_0x5dce('0x14')]?_0x5cb9bd[_0x5dce('0x14')]:undefined,'callbackat':_0x5cb9bd[_0x5dce('0x14')]?moment()[_0x5dce('0x8')](_0x5dce('0xf')):undefined};}function handleAlwaysCheckDuplicate(_0x1f9114,_0x37ba69,_0x155dc8,_0x6d33ca){var _0x6cf4b9={'phone':_0x155dc8['phone']};var _0x391484={'calleridnum':_0x155dc8[_0x5dce('0x10')]};if(_0x6d33ca){Object[_0x5dce('0x15')](_0x6cf4b9,{'CampaignId':_0x37ba69['id']});Object[_0x5dce('0x15')](_0x391484,{'CampaignId':_0x37ba69['id']});}else{Object[_0x5dce('0x15')](_0x6cf4b9,{'VoiceQueueId':_0x37ba69['id']});Object['assign'](_0x391484,{'VoiceQueueId':_0x37ba69['id']});}return _0x1f9114['CmHopper'][_0x5dce('0x16')]({'where':_0x6cf4b9})[_0x5dce('0xb')](function(_0x4bb1c5){if(_0x4bb1c5){throw new Error(_0x5dce('0x17')+_0x155dc8[_0x5dce('0x10')]+_0x5dce('0x18')+_0x37ba69['id']);}return _0x1f9114['CmHopperFinal'][_0x5dce('0x16')]({'where':_0x391484});})[_0x5dce('0xb')](function(_0x5df0ff){if(_0x5df0ff){throw new Error(_0x5dce('0x19')+_0x155dc8[_0x5dce('0x10')]+_0x5dce('0x18')+_0x37ba69['id']);}var _0x17daa1=getNewHopperPayload(_0x155dc8);if(_0x6d33ca){_0x17daa1[_0x5dce('0x1a')]=_0x37ba69['id'];}else{_0x17daa1['VoiceQueueId']=_0x37ba69['id'];}return _0x1f9114[_0x5dce('0x1b')][_0x5dce('0x1c')](_0x17daa1);});}function handleOnlyIfOpenCheckDuplicate(_0xdaad35,_0x18c753,_0x3324de,_0x384f1a){var _0x259d22={'phone':_0x3324de[_0x5dce('0x10')]};if(_0x384f1a){Object[_0x5dce('0x15')](_0x259d22,{'CampaignId':_0x18c753['id']});}else{Object[_0x5dce('0x15')](_0x259d22,{'VoiceQueueId':_0x18c753['id']});}return _0xdaad35['CmHopper'][_0x5dce('0x16')]({'where':_0x259d22})[_0x5dce('0xb')](function(_0x20064e){if(_0x20064e){throw new Error(_0x5dce('0x1d')+_0x3324de['phone']+'\x20in\x20Campaign\x20with\x20id\x20'+_0x18c753['id']);}var _0x53ca3e=getNewHopperPayload(_0x3324de);if(_0x384f1a){_0x53ca3e[_0x5dce('0x1a')]=_0x18c753['id'];}else{_0x53ca3e[_0x5dce('0x1e')]=_0x18c753['id'];}return _0xdaad35[_0x5dce('0x1b')]['create'](_0x53ca3e);});}function handleNeverCheckDuplicate(_0x227f1f,_0x58f31e,_0x41e22e){var _0x26a074=getNewHopperPayload(_0x41e22e);_0x26a074[_0x5dce('0x1e')]=_0x58f31e['id'];return _0x227f1f['CmHopper']['create'](_0x26a074);}function handleCheckDuplicate(_0x4bd1b6,_0x1864f4,_0x403eb1,_0x31a24a){return getTimezoneCallbackAt(_0x4bd1b6,_0x1864f4,_0x403eb1,_0x31a24a)[_0x5dce('0xb')](function(_0xaf9953){_0x403eb1['scheduledat']=_0xaf9953;switch(_0x1864f4[_0x5dce('0x1f')]){case _0x5dce('0x20'):return handleAlwaysCheckDuplicate(_0x4bd1b6,_0x1864f4,_0x403eb1,_0x31a24a);case _0x5dce('0x21'):return handleOnlyIfOpenCheckDuplicate(_0x4bd1b6,_0x1864f4,_0x403eb1,_0x31a24a);default:return handleNeverCheckDuplicate(_0x4bd1b6,_0x1864f4,_0x403eb1);}});}function createHopperForVoiceQueues(_0x244973,_0x439c33){return _0x244973[_0x5dce('0x7')]['findAll']({'where':{'type':_0x5dce('0x22')},'attributes':['id',_0x5dce('0x1f'),_0x5dce('0xc')],'include':[{'model':_0x244973[_0x5dce('0x23')],'as':_0x5dce('0x24'),'where':{'id':_0x439c33[_0x5dce('0x11')]}}],'raw':!![]})['then'](function(_0x1f4bfe){var _0x510f74=_0x1f4bfe[_0x5dce('0x25')](function(_0x42680a){return handleCheckDuplicate(_0x244973,_0x42680a,_0x439c33,![]);});return Promise['all'](_0x510f74);});}function createHopperForCampaigns(_0x2f5fcb,_0x4e3643){return _0x2f5fcb[_0x5dce('0x6')][_0x5dce('0x26')]({'attributes':['id',_0x5dce('0x1f'),'dialTimezone'],'include':[{'model':_0x2f5fcb['CmList'],'as':_0x5dce('0x24'),'where':{'id':_0x4e3643['ListId']}}],'raw':!![]})[_0x5dce('0xb')](function(_0x4e6347){var _0x35884d=_0x4e6347[_0x5dce('0x25')](function(_0x2ee796){return handleCheckDuplicate(_0x2f5fcb,_0x2ee796,_0x4e3643,!![]);});return Promise[_0x5dce('0x27')](_0x35884d);});}function createHopperBlackForVoiceQueues(_0x5d4eb4,_0x3bb7dc){return _0x5d4eb4[_0x5dce('0x7')]['findAll']({'where':{'type':_0x5dce('0x22')},'attributes':['id'],'include':[{'model':_0x5d4eb4[_0x5dce('0x23')],'as':_0x5dce('0x28'),'where':{'id':_0x3bb7dc[_0x5dce('0x11')]}}],'raw':!![]})[_0x5dce('0xb')](function(_0x45b29c){var _0xb57c2d=_0x45b29c['map'](function(_0xa35560){return _0x5d4eb4[_0x5dce('0x29')][_0x5dce('0x1c')]({'phone':_0x3bb7dc[_0x5dce('0x10')],'ContactId':_0x3bb7dc['id'],'ListId':_0x3bb7dc[_0x5dce('0x11')],'VoiceQueueId':_0xa35560['id']});});return Promise[_0x5dce('0x27')](_0xb57c2d);});}function createHopperBlackForCampaigns(_0x2a7bd5,_0x1d0ba4){return _0x2a7bd5['Campaign'][_0x5dce('0x26')]({'attributes':['id'],'include':[{'model':_0x2a7bd5[_0x5dce('0x23')],'as':'BlackLists','where':{'id':_0x1d0ba4['ListId']}}],'raw':!![]})[_0x5dce('0xb')](function(_0x1256c4){var _0x1a65a1=_0x1256c4[_0x5dce('0x25')](function(_0x1d4e4d){return _0x2a7bd5['CmHopperBlack'][_0x5dce('0x1c')]({'phone':_0x1d0ba4[_0x5dce('0x10')],'ContactId':_0x1d0ba4['id'],'ListId':_0x1d0ba4[_0x5dce('0x11')],'CampaignId':_0x1d4e4d['id']});});return Promise['all'](_0x1a65a1);});}module['exports']=function(_0x21e82c){return _0x21e82c[_0x5dce('0x2a')](_0x5dce('0x2b'),attributes,{'tableName':_0x5dce('0x2c'),'paranoid':!![],'indexes':[{'name':_0x5dce('0x10'),'fields':[_0x5dce('0x10')]},{'name':'fti_cm_contacts','fields':[_0x5dce('0x2d'),_0x5dce('0x2e'),_0x5dce('0x10'),'mobile',_0x5dce('0x2f'),_0x5dce('0x30')],'type':_0x5dce('0x31')}],'timestamps':!![],'charset':_0x5dce('0x32'),'collate':_0x5dce('0x33'),'hooks':{'afterCreate':function(_0x4d3226,_0x5960a4,_0x1f5ebc){var _0x25745e=_0x21e82c[_0x5dce('0x34')];var _0x3c688d=_0x4d3226['get']({'plain':!![]});if(!_0x3c688d[_0x5dce('0x11')]){logger[_0x5dce('0x35')](_0x5dce('0x36')+_0x3c688d['id']);return _0x1f5ebc();}if(!_0x3c688d[_0x5dce('0x10')]){return _0x1f5ebc();}return createHopperForVoiceQueues(_0x25745e,_0x3c688d)[_0x5dce('0xb')](function(){return createHopperBlackForVoiceQueues(_0x25745e,_0x3c688d);})[_0x5dce('0xb')](function(){return createHopperForCampaigns(_0x25745e,_0x3c688d);})[_0x5dce('0xb')](function(){return createHopperBlackForCampaigns(_0x25745e,_0x3c688d);})[_0x5dce('0xb')](function(){return _0x1f5ebc();})[_0x5dce('0x37')](function(_0x43598c){logger['error'](_0x5dce('0x38'),_0x43598c[_0x5dce('0x39')]);_0x1f5ebc();});},'afterDestroy':function(_0x292e25,_0x1d5fb3,_0x2c6622){var _0x1164bf=_0x21e82c['models'];var _0x5d39de=_0x292e25[_0x5dce('0x3a')]({'plain':!![]});return _0x1164bf['CmHopper'][_0x5dce('0x26')]({'raw':!![],'where':{'ListId':_0x5d39de[_0x5dce('0x11')],'ContactId':_0x5d39de['id']}})[_0x5dce('0xb')](function(_0x5b3c38){if(!_['isEmpty'](_0x5b3c38)){var _0x2db776=[];for(var _0x696dee=0x0;_0x696dee<_0x5b3c38[_0x5dce('0x3b')];_0x696dee+=0x1){var _0x1da772=_0x1164bf[_0x5dce('0x1b')][_0x5dce('0x3c')]({'where':{'ListId':_0x5b3c38[_0x696dee][_0x5dce('0x11')],'ContactId':_0x5b3c38[_0x696dee][_0x5dce('0x3d')],'VoiceQueueId':_0x5b3c38[_0x696dee][_0x5dce('0x1e')],'CampaignId':_0x5b3c38[_0x696dee]['CampaignId']}});_0x2db776['push'](_0x1da772);}return Promise[_0x5dce('0x27')](_0x2db776);}})[_0x5dce('0xb')](function(_0x1928d2){logger[_0x5dce('0x3e')]('[CmContact][afterDestroy][Succesfull]',util['inspect'](_0x1928d2,{'showHidden':![],'depth':null}));_0x2c6622();})[_0x5dce('0x37')](function(_0x26af79){logger[_0x5dce('0x35')](_0x5dce('0x3f'),util['inspect'](_0x26af79,{'showHidden':![],'depth':null}));_0x2c6622(_0x26af79);});}}});}; \ No newline at end of file +var _0xc852=['isEmpty','destroy','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','../../config/logger','api','moment','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','resolve','findOne','then','isNil','timezones','utcOffset','add','minutes','phone','ListId','format','priority','callbackUniqueid','assign','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','CmHopper','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','create','always','onlyIfOpen','findAll','outbound','dialCheckDuplicateType','Lists','map','all','CmList','BlackLists','CmHopperBlack','exports','define','CmContact','cm_contacts','mobile','fax','FULLTEXT','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xc852,0x14d));var _0x2c85=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc852[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2c85('0x0'))(_0x2c85('0x1'));var moment=require(_0x2c85('0x2'));var shared=require(_0x2c85('0x3'));var attributes=require(_0x2c85('0x4'));function getTimezoneCallbackAt(_0x4c0eca,_0x1cbf74,_0x17189c,_0x162593){var _0x2b86c0=_0x162593?_0x2c85('0x5'):_0x2c85('0x6');var _0x585513=_0x17189c[_0x2c85('0x7')]?_0x17189c[_0x2c85('0x7')]:moment()['format'](_0x2c85('0x8'));if(_['isNil'](_0x17189c[_0x2c85('0x9')])){return Promise[_0x2c85('0xa')](_0x585513);}return _0x4c0eca[_0x2b86c0][_0x2c85('0xb')]({'where':{'id':_0x1cbf74}})[_0x2c85('0xc')](function(_0x1df64f){if(_[_0x2c85('0xd')](_0x1df64f)||_[_0x2c85('0xd')](_0x1df64f[_0x2c85('0x9')])){return Promise[_0x2c85('0xa')](_0x585513);}var _0x1c1f4c=shared[_0x2c85('0xe')];var _0x351a55=_0x1c1f4c[_0x1df64f[_0x2c85('0x9')]];var _0x55c756=_0x1c1f4c[_0x17189c['dialTimezone']];if(_[_0x2c85('0xd')](_0x351a55)&&_['isNil'](_0x55c756)){return Promise[_0x2c85('0xa')](_0x585513);}var _0x443af4=_0x351a55[_0x2c85('0xf')]-_0x55c756['utcOffset'];var _0x2e4baa=_0x17189c[_0x2c85('0x7')]?_0x17189c[_0x2c85('0x7')]:moment();_0x585513=moment(_0x2e4baa)[_0x2c85('0x10')](_0x443af4,_0x2c85('0x11'))['format'](_0x2c85('0x8'));return Promise['resolve'](_0x585513);});}function getNewHopperPayload(_0x52a3e7){return{'phone':_0x52a3e7[_0x2c85('0x12')],'ContactId':_0x52a3e7['id'],'ListId':_0x52a3e7[_0x2c85('0x13')],'scheduledat':_0x52a3e7[_0x2c85('0x7')]?_0x52a3e7[_0x2c85('0x7')]:moment()[_0x2c85('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x52a3e7[_0x2c85('0x15')]?_0x52a3e7[_0x2c85('0x15')]:0x2,'callback':_0x52a3e7['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x52a3e7['callbackUniqueid']?_0x52a3e7[_0x2c85('0x16')]:undefined,'callbackat':_0x52a3e7[_0x2c85('0x16')]?moment()[_0x2c85('0x14')](_0x2c85('0x8')):undefined};}function handleAlwaysCheckDuplicate(_0xa1fa04,_0x5dbe4e,_0x5bbe19,_0x548452){var _0x1e3c44={'phone':_0x5bbe19['phone']};var _0x4d1f00={'calleridnum':_0x5bbe19[_0x2c85('0x12')]};if(_0x548452){Object['assign'](_0x1e3c44,{'CampaignId':_0x5dbe4e['id']});Object[_0x2c85('0x17')](_0x4d1f00,{'CampaignId':_0x5dbe4e['id']});}else{Object['assign'](_0x1e3c44,{'VoiceQueueId':_0x5dbe4e['id']});Object[_0x2c85('0x17')](_0x4d1f00,{'VoiceQueueId':_0x5dbe4e['id']});}return _0xa1fa04['CmHopper']['findOne']({'where':_0x1e3c44})['then'](function(_0x2abd14){if(_0x2abd14){throw new Error(_0x2c85('0x18')+_0x5bbe19[_0x2c85('0x12')]+_0x2c85('0x19')+_0x5dbe4e['id']);}return _0xa1fa04['CmHopperFinal'][_0x2c85('0xb')]({'where':_0x4d1f00});})[_0x2c85('0xc')](function(_0x31b525){if(_0x31b525){throw new Error('[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x5bbe19[_0x2c85('0x12')]+_0x2c85('0x19')+_0x5dbe4e['id']);}var _0x3af34b=getNewHopperPayload(_0x5bbe19);if(_0x548452){_0x3af34b[_0x2c85('0x1a')]=_0x5dbe4e['id'];}else{_0x3af34b['VoiceQueueId']=_0x5dbe4e['id'];}return _0xa1fa04[_0x2c85('0x1b')]['create'](_0x3af34b);});}function handleOnlyIfOpenCheckDuplicate(_0x2b19db,_0x2e3979,_0x256df6,_0x21d311){var _0x3d28ad={'phone':_0x256df6[_0x2c85('0x12')]};if(_0x21d311){Object[_0x2c85('0x17')](_0x3d28ad,{'CampaignId':_0x2e3979['id']});}else{Object[_0x2c85('0x17')](_0x3d28ad,{'VoiceQueueId':_0x2e3979['id']});}return _0x2b19db[_0x2c85('0x1b')][_0x2c85('0xb')]({'where':_0x3d28ad})[_0x2c85('0xc')](function(_0x5e05c5){if(_0x5e05c5){throw new Error(_0x2c85('0x1c')+_0x256df6[_0x2c85('0x12')]+_0x2c85('0x19')+_0x2e3979['id']);}var _0x1e3b2b=getNewHopperPayload(_0x256df6);if(_0x21d311){_0x1e3b2b[_0x2c85('0x1a')]=_0x2e3979['id'];}else{_0x1e3b2b[_0x2c85('0x1d')]=_0x2e3979['id'];}return _0x2b19db[_0x2c85('0x1b')][_0x2c85('0x1e')](_0x1e3b2b);});}function handleNeverCheckDuplicate(_0x47bdab,_0xf47b40,_0x3c8525){var _0x254ff2=getNewHopperPayload(_0x3c8525);_0x254ff2[_0x2c85('0x1d')]=_0xf47b40['id'];return _0x47bdab['CmHopper'][_0x2c85('0x1e')](_0x254ff2);}function handleCheckDuplicate(_0x2426c6,_0x57ded1,_0x19583f,_0x5c99a2){return getTimezoneCallbackAt(_0x2426c6,_0x57ded1,_0x19583f,_0x5c99a2)[_0x2c85('0xc')](function(_0xb5f091){_0x19583f[_0x2c85('0x7')]=_0xb5f091;switch(_0x57ded1['dialCheckDuplicateType']){case _0x2c85('0x1f'):return handleAlwaysCheckDuplicate(_0x2426c6,_0x57ded1,_0x19583f,_0x5c99a2);case _0x2c85('0x20'):return handleOnlyIfOpenCheckDuplicate(_0x2426c6,_0x57ded1,_0x19583f,_0x5c99a2);default:return handleNeverCheckDuplicate(_0x2426c6,_0x57ded1,_0x19583f);}});}function createHopperForVoiceQueues(_0x29b212,_0x303d91){return _0x29b212[_0x2c85('0x6')][_0x2c85('0x21')]({'where':{'type':_0x2c85('0x22')},'attributes':['id',_0x2c85('0x23'),_0x2c85('0x9')],'include':[{'model':_0x29b212['CmList'],'as':_0x2c85('0x24'),'where':{'id':_0x303d91[_0x2c85('0x13')]}}],'raw':!![]})[_0x2c85('0xc')](function(_0x800c60){var _0x1d2b4c=_0x800c60[_0x2c85('0x25')](function(_0x51a9ee){return handleCheckDuplicate(_0x29b212,_0x51a9ee,_0x303d91,![]);});return Promise[_0x2c85('0x26')](_0x1d2b4c);});}function createHopperForCampaigns(_0x2df187,_0x4bc809){return _0x2df187[_0x2c85('0x5')]['findAll']({'attributes':['id',_0x2c85('0x23'),_0x2c85('0x9')],'include':[{'model':_0x2df187[_0x2c85('0x27')],'as':'Lists','where':{'id':_0x4bc809[_0x2c85('0x13')]}}],'raw':!![]})[_0x2c85('0xc')](function(_0x41d1f3){var _0x4d98a1=_0x41d1f3['map'](function(_0x3f7919){return handleCheckDuplicate(_0x2df187,_0x3f7919,_0x4bc809,!![]);});return Promise[_0x2c85('0x26')](_0x4d98a1);});}function createHopperBlackForVoiceQueues(_0x6c7b34,_0xb70fef){return _0x6c7b34[_0x2c85('0x6')][_0x2c85('0x21')]({'where':{'type':_0x2c85('0x22')},'attributes':['id'],'include':[{'model':_0x6c7b34[_0x2c85('0x27')],'as':_0x2c85('0x28'),'where':{'id':_0xb70fef[_0x2c85('0x13')]}}],'raw':!![]})[_0x2c85('0xc')](function(_0x3843e1){var _0x55b28f=_0x3843e1[_0x2c85('0x25')](function(_0x3f6e2e){return _0x6c7b34[_0x2c85('0x29')][_0x2c85('0x1e')]({'phone':_0xb70fef[_0x2c85('0x12')],'ContactId':_0xb70fef['id'],'ListId':_0xb70fef['ListId'],'VoiceQueueId':_0x3f6e2e['id']});});return Promise['all'](_0x55b28f);});}function createHopperBlackForCampaigns(_0xbffdd0,_0x22cedc){return _0xbffdd0['Campaign'][_0x2c85('0x21')]({'attributes':['id'],'include':[{'model':_0xbffdd0[_0x2c85('0x27')],'as':_0x2c85('0x28'),'where':{'id':_0x22cedc[_0x2c85('0x13')]}}],'raw':!![]})[_0x2c85('0xc')](function(_0x5b7763){var _0x4c1e94=_0x5b7763[_0x2c85('0x25')](function(_0x5681d2){return _0xbffdd0['CmHopperBlack'][_0x2c85('0x1e')]({'phone':_0x22cedc[_0x2c85('0x12')],'ContactId':_0x22cedc['id'],'ListId':_0x22cedc['ListId'],'CampaignId':_0x5681d2['id']});});return Promise[_0x2c85('0x26')](_0x4c1e94);});}module[_0x2c85('0x2a')]=function(_0x1b0998){return _0x1b0998[_0x2c85('0x2b')](_0x2c85('0x2c'),attributes,{'tableName':_0x2c85('0x2d'),'paranoid':!![],'indexes':[{'name':_0x2c85('0x12'),'fields':[_0x2c85('0x12')]},{'name':'fti_cm_contacts','fields':['firstName','lastName',_0x2c85('0x12'),_0x2c85('0x2e'),_0x2c85('0x2f'),'email'],'type':_0x2c85('0x30')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x2c85('0x31'),'hooks':{'afterCreate':function(_0x4ee585,_0x33af7c,_0x2dc2f8){var _0x3e2fab=_0x1b0998[_0x2c85('0x32')];var _0x57487f=_0x4ee585[_0x2c85('0x33')]({'plain':!![]});if(!_0x57487f[_0x2c85('0x13')]){logger[_0x2c85('0x34')](_0x2c85('0x35')+_0x57487f['id']);return _0x2dc2f8();}if(!_0x57487f['phone']){return _0x2dc2f8();}return createHopperForVoiceQueues(_0x3e2fab,_0x57487f)[_0x2c85('0xc')](function(){return createHopperBlackForVoiceQueues(_0x3e2fab,_0x57487f);})[_0x2c85('0xc')](function(){return createHopperForCampaigns(_0x3e2fab,_0x57487f);})[_0x2c85('0xc')](function(){return createHopperBlackForCampaigns(_0x3e2fab,_0x57487f);})[_0x2c85('0xc')](function(){return _0x2dc2f8();})[_0x2c85('0x36')](function(_0x583d8b){logger[_0x2c85('0x34')](_0x2c85('0x37'),_0x583d8b[_0x2c85('0x38')]);_0x2dc2f8();});},'afterDestroy':function(_0x5266ca,_0x41ff28,_0x5a43af){var _0x55a304=_0x1b0998[_0x2c85('0x32')];var _0x3cf09b=_0x5266ca[_0x2c85('0x33')]({'plain':!![]});return _0x55a304[_0x2c85('0x1b')][_0x2c85('0x21')]({'raw':!![],'where':{'ListId':_0x3cf09b['ListId'],'ContactId':_0x3cf09b['id']}})[_0x2c85('0xc')](function(_0x596f86){if(!_[_0x2c85('0x39')](_0x596f86)){var _0x3262d1=[];for(var _0x3143a3=0x0;_0x3143a3<_0x596f86['length'];_0x3143a3+=0x1){var _0x51c11f=_0x55a304[_0x2c85('0x1b')][_0x2c85('0x3a')]({'where':{'ListId':_0x596f86[_0x3143a3][_0x2c85('0x13')],'ContactId':_0x596f86[_0x3143a3][_0x2c85('0x3b')],'VoiceQueueId':_0x596f86[_0x3143a3][_0x2c85('0x1d')],'CampaignId':_0x596f86[_0x3143a3][_0x2c85('0x1a')]}});_0x3262d1[_0x2c85('0x3c')](_0x51c11f);}return Promise[_0x2c85('0x26')](_0x3262d1);}})['then'](function(_0x43ba0a){logger[_0x2c85('0x3d')](_0x2c85('0x3e'),util[_0x2c85('0x3f')](_0x43ba0a,{'showHidden':![],'depth':null}));_0x5a43af();})[_0x2c85('0x36')](function(_0x5a99d4){logger[_0x2c85('0x34')](_0x2c85('0x40'),util[_0x2c85('0x3f')](_0x5a99d4,{'showHidden':![],'depth':null}));_0x5a43af(_0x5a99d4);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index db5a22f..e80d7ca 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x1ec0b2,_0x30e527){var _0x2b0199=function(_0x29228c){while(--_0x29228c){_0x1ec0b2['push'](_0x1ec0b2['shift']());}};_0x2b0199(++_0x30e527);}(_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 squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x317ff4,_0x43107c){var _0x36ae64=function(_0x3740c6){while(--_0x3740c6){_0x317ff4['push'](_0x317ff4['shift']());}};_0x36ae64(++_0x43107c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 9210195..d9ff261 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9de3=['STRING','PHONE','sequelize','INTEGER'];(function(_0x64cc35,_0x518c38){var _0xbe98db=function(_0x3d456e){while(--_0x3d456e){_0x64cc35['push'](_0x64cc35['shift']());}};_0xbe98db(++_0x518c38);}(_0x9de3,0xea));var _0x39de=function(_0x406ba4,_0x27eefd){_0x406ba4=_0x406ba4-0x0;var _0x106a95=_0x9de3[_0x406ba4];return _0x106a95;};'use strict';var Sequelize=require(_0x39de('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x39de('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x39de('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x39de('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x39de('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x39de('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x3299=['exports','INTEGER','STRING','PHONE'];(function(_0x57bfad,_0x5126cc){var _0x5d8e2f=function(_0xd5ce2b){while(--_0xd5ce2b){_0x57bfad['push'](_0x57bfad['shift']());}};_0x5d8e2f(++_0x5126cc);}(_0x3299,0x1bc));var _0x9329=function(_0x426c05,_0x2e2a00){_0x426c05=_0x426c05-0x0;var _0x124454=_0x3299[_0x426c05];return _0x124454;};'use strict';var Sequelize=require('sequelize');module[_0x9329('0x0')]={'CmContactId':{'type':Sequelize[_0x9329('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x9329('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x9329('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x9329('0x2')],'defaultValue':_0x9329('0x3')},'OrderBy':{'type':Sequelize[_0x9329('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x9329('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 7fa7756..8f03044 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21ed=['options','include','findAll','catch','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','get','UserProfileResource','sendStatus','error','name','index','CmContactHasItem','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map'];(function(_0x57d843,_0x2a95e0){var _0x42ba2d=function(_0x46cb71){while(--_0x46cb71){_0x57d843['push'](_0x57d843['shift']());}};_0x42ba2d(++_0x2a95e0);}(_0x21ed,0x186));var _0xd21e=function(_0x191fc1,_0x5055b6){_0x191fc1=_0x191fc1-0x0;var _0x4b0db9=_0x21ed[_0x191fc1];return _0x4b0db9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd21e('0x0'));var zipdir=require(_0xd21e('0x1'));var jsonpatch=require(_0xd21e('0x2'));var rp=require('request-promise');var moment=require(_0xd21e('0x3'));var BPromise=require(_0xd21e('0x4'));var Mustache=require(_0xd21e('0x5'));var util=require(_0xd21e('0x6'));var path=require(_0xd21e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd21e('0x8'));var fs=require('fs');var fs_extra=require(_0xd21e('0x9'));var _=require(_0xd21e('0xa'));var squel=require(_0xd21e('0xb'));var crypto=require('crypto');var jsforce=require(_0xd21e('0xc'));var deskjs=require(_0xd21e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd21e('0xe'));var Papa=require(_0xd21e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd21e('0x10'));var as=require(_0xd21e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd21e('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xd21e('0x13'));var licenseUtil=require(_0xd21e('0x14'));var db=require(_0xd21e('0x15'))['db'];function respondWithStatusCode(_0x212cda,_0xfae955){_0xfae955=_0xfae955||0xcc;return function(_0x3ca798){if(_0x3ca798){return _0x212cda['sendStatus'](_0xfae955);}return _0x212cda[_0xd21e('0x16')](_0xfae955)[_0xd21e('0x17')]();};}function respondWithResult(_0x146285,_0x3945f8){_0x3945f8=_0x3945f8||0xc8;return function(_0x5bb250){if(_0x5bb250){return _0x146285[_0xd21e('0x16')](_0x3945f8)[_0xd21e('0x18')](_0x5bb250);}};}function respondWithFilteredResult(_0x128456,_0x526ea9){return function(_0x5df7f6){if(_0x5df7f6){var _0x2574c7=typeof _0x526ea9[_0xd21e('0x19')]===_0xd21e('0x1a')&&typeof _0x526ea9[_0xd21e('0x1b')]===_0xd21e('0x1a');var _0x19f634=_0x5df7f6[_0xd21e('0x1c')];var _0x372ba1=_0x2574c7?0x0:_0x526ea9[_0xd21e('0x19')];var _0xe55e25=_0x2574c7?_0x5df7f6[_0xd21e('0x1c')]:_0x526ea9[_0xd21e('0x19')]+_0x526ea9[_0xd21e('0x1b')];var _0x1a07d3;if(_0xe55e25>=_0x19f634){_0xe55e25=_0x19f634;_0x1a07d3=0xc8;}else{_0x1a07d3=0xce;}_0x128456[_0xd21e('0x16')](_0x1a07d3);return _0x128456['set'](_0xd21e('0x1d'),_0x372ba1+'-'+_0xe55e25+'/'+_0x19f634)['json'](_0x5df7f6);}return null;};}function patchUpdates(_0x4b1da0){return function(_0x3c808c){try{jsonpatch[_0xd21e('0x1e')](_0x3c808c,_0x4b1da0,!![]);}catch(_0x45efea){return BPromise['reject'](_0x45efea);}return _0x3c808c['save']();};}function saveUpdates(_0x5bb29f,_0x53218c){return function(_0x4c08aa){if(_0x4c08aa){return _0x4c08aa[_0xd21e('0x1f')](_0x5bb29f)[_0xd21e('0x20')](function(_0x390e16){return _0x390e16;});}return null;};}function removeEntity(_0x21bc3e,_0xd42f05){return function(_0x3dafbe){if(_0x3dafbe){return _0x3dafbe[_0xd21e('0x21')]()[_0xd21e('0x20')](function(){var _0x1ad014=_0x3dafbe[_0xd21e('0x22')]({'plain':!![]});var _0x41377a='CmContactHasItems';return db[_0xd21e('0x23')][_0xd21e('0x21')]({'where':{'type':_0x41377a,'resourceId':_0x1ad014['id']}})[_0xd21e('0x20')](function(){return _0x3dafbe;});})[_0xd21e('0x20')](function(){_0x21bc3e['status'](0xcc)[_0xd21e('0x17')]();});}};}function handleEntityNotFound(_0x5b4117,_0xc70b48){return function(_0x4a3970){if(!_0x4a3970){_0x5b4117[_0xd21e('0x24')](0x194);}return _0x4a3970;};}function handleError(_0x1e0a56,_0x2a3ade){_0x2a3ade=_0x2a3ade||0x1f4;return function(_0x32872e){logger[_0xd21e('0x25')](_0x32872e['stack']);if(_0x32872e[_0xd21e('0x26')]){delete _0x32872e['name'];}_0x1e0a56[_0xd21e('0x16')](_0x2a3ade)['send'](_0x32872e);};}exports[_0xd21e('0x27')]=function(_0x4ebc9a,_0x4ee843){var _0x9e9522={},_0x4584df={},_0xb2e250={'count':0x0,'rows':[]};var _0x340c37=_['map'](db[_0xd21e('0x28')]['rawAttributes'],function(_0x18bab3){return{'name':_0x18bab3[_0xd21e('0x29')],'type':_0x18bab3['type'][_0xd21e('0x2a')]};});_0x4584df[_0xd21e('0x2b')]=_['map'](_0x340c37,_0xd21e('0x26'));_0x4584df[_0xd21e('0x2c')]=_[_0xd21e('0x2d')](_0x4ebc9a[_0xd21e('0x2c')]);_0x4584df[_0xd21e('0x2e')]=_[_0xd21e('0x2f')](_0x4584df['model'],_0x4584df[_0xd21e('0x2c')]);_0x9e9522['attributes']=_[_0xd21e('0x2f')](_0x4584df[_0xd21e('0x2b')],qs[_0xd21e('0x30')](_0x4ebc9a[_0xd21e('0x2c')]['fields']));_0x9e9522[_0xd21e('0x31')]=_0x9e9522[_0xd21e('0x31')][_0xd21e('0x32')]?_0x9e9522[_0xd21e('0x31')]:_0x4584df[_0xd21e('0x2b')];if(!_0x4ebc9a['query'][_0xd21e('0x33')](_0xd21e('0x34'))){_0x9e9522['limit']=qs[_0xd21e('0x1b')](_0x4ebc9a[_0xd21e('0x2c')][_0xd21e('0x1b')]);_0x9e9522[_0xd21e('0x19')]=qs[_0xd21e('0x19')](_0x4ebc9a[_0xd21e('0x2c')][_0xd21e('0x19')]);}_0x9e9522[_0xd21e('0x35')]=qs[_0xd21e('0x36')](_0x4ebc9a[_0xd21e('0x2c')][_0xd21e('0x36')]);_0x9e9522[_0xd21e('0x37')]=qs[_0xd21e('0x2e')](_[_0xd21e('0x38')](_0x4ebc9a[_0xd21e('0x2c')],_0x4584df[_0xd21e('0x2e')]),_0x340c37);if(_0x4ebc9a[_0xd21e('0x2c')][_0xd21e('0x39')]){_0x9e9522[_0xd21e('0x37')]=_[_0xd21e('0x3a')](_0x9e9522['where'],{'$or':_[_0xd21e('0x3b')](_0x340c37,function(_0x320fa5){if(_0x320fa5['type']!=='VIRTUAL'){var _0x4ce8a9={};_0x4ce8a9[_0x320fa5[_0xd21e('0x26')]]={'$like':'%'+_0x4ebc9a[_0xd21e('0x2c')][_0xd21e('0x39')]+'%'};return _0x4ce8a9;}})});}_0x9e9522=_[_0xd21e('0x3a')]({},_0x9e9522,_0x4ebc9a[_0xd21e('0x3c')]);var _0x344d70={'where':_0x9e9522[_0xd21e('0x37')]};return db[_0xd21e('0x28')][_0xd21e('0x1c')](_0x344d70)['then'](function(_0x59d4df){_0xb2e250[_0xd21e('0x1c')]=_0x59d4df;if(_0x4ebc9a[_0xd21e('0x2c')]['includeAll']){_0x9e9522[_0xd21e('0x3d')]=[{'all':!![]}];}return db[_0xd21e('0x28')][_0xd21e('0x3e')](_0x9e9522);})[_0xd21e('0x20')](function(_0x5072e0){_0xb2e250['rows']=_0x5072e0;return _0xb2e250;})['then'](respondWithFilteredResult(_0x4ee843,_0x9e9522))[_0xd21e('0x3f')](handleError(_0x4ee843,null));};exports['show']=function(_0x551299,_0x5c83f4){var _0x5e143b={'raw':!![],'where':{'id':_0x551299['params']['id']}},_0x2bb0d8={};_0x2bb0d8[_0xd21e('0x2b')]=_[_0xd21e('0x2d')](db['CmContactHasItem']['rawAttributes']);_0x2bb0d8[_0xd21e('0x2c')]=_[_0xd21e('0x2d')](_0x551299['query']);_0x2bb0d8[_0xd21e('0x2e')]=_['intersection'](_0x2bb0d8[_0xd21e('0x2b')],_0x2bb0d8[_0xd21e('0x2c')]);_0x5e143b[_0xd21e('0x31')]=_[_0xd21e('0x2f')](_0x2bb0d8['model'],qs['fields'](_0x551299[_0xd21e('0x2c')][_0xd21e('0x30')]));_0x5e143b[_0xd21e('0x31')]=_0x5e143b['attributes'][_0xd21e('0x32')]?_0x5e143b[_0xd21e('0x31')]:_0x2bb0d8['model'];if(_0x551299[_0xd21e('0x2c')][_0xd21e('0x40')]){_0x5e143b[_0xd21e('0x3d')]=[{'all':!![]}];}_0x5e143b=_[_0xd21e('0x3a')]({},_0x5e143b,_0x551299['options']);return db[_0xd21e('0x28')][_0xd21e('0x41')](_0x5e143b)[_0xd21e('0x20')](handleEntityNotFound(_0x5c83f4,null))['then'](respondWithResult(_0x5c83f4,null))['catch'](handleError(_0x5c83f4,null));};exports[_0xd21e('0x42')]=function(_0x430620,_0x51f063){return db[_0xd21e('0x28')][_0xd21e('0x42')](_0x430620['body'],{})[_0xd21e('0x20')](function(_0x21eb78){var _0x212d45=_0x430620[_0xd21e('0x43')][_0xd21e('0x22')]({'plain':!![]});if(!_0x212d45)throw new Error(_0xd21e('0x44'));if(_0x212d45[_0xd21e('0x45')]===_0xd21e('0x43')){var _0x3030d7=_0x21eb78['get']({'plain':!![]});var _0x4ca6ef=_0xd21e('0x46');return db[_0xd21e('0x47')][_0xd21e('0x41')]({'where':{'name':_0x4ca6ef,'userProfileId':_0x212d45['userProfileId']},'raw':!![]})[_0xd21e('0x20')](function(_0x454b99){if(_0x454b99&&_0x454b99['autoAssociation']===0x0){return db['UserProfileResource'][_0xd21e('0x42')]({'name':_0x3030d7[_0xd21e('0x26')],'resourceId':_0x3030d7['id'],'type':_0x454b99[_0xd21e('0x26')],'sectionId':_0x454b99['id']},{})[_0xd21e('0x20')](function(){return _0x21eb78;});}else{return _0x21eb78;}})[_0xd21e('0x3f')](function(_0x2a9b12){logger[_0xd21e('0x25')](_0xd21e('0x48'),_0x2a9b12);throw _0x2a9b12;});}return _0x21eb78;})['then'](respondWithResult(_0x51f063,0xc9))[_0xd21e('0x3f')](handleError(_0x51f063,null));};exports[_0xd21e('0x1f')]=function(_0x3a5312,_0x22a991){if(_0x3a5312[_0xd21e('0x49')]['id']){delete _0x3a5312[_0xd21e('0x49')]['id'];}return db[_0xd21e('0x28')]['find']({'where':{'id':_0x3a5312[_0xd21e('0x4a')]['id']}})[_0xd21e('0x20')](handleEntityNotFound(_0x22a991,null))[_0xd21e('0x20')](saveUpdates(_0x3a5312['body'],null))[_0xd21e('0x20')](respondWithResult(_0x22a991,null))[_0xd21e('0x3f')](handleError(_0x22a991,null));};exports[_0xd21e('0x21')]=function(_0x431b29,_0x4e7822){return db[_0xd21e('0x28')]['find']({'where':{'id':_0x431b29[_0xd21e('0x4a')]['id']}})[_0xd21e('0x20')](handleEntityNotFound(_0x4e7822,null))[_0xd21e('0x20')](removeEntity(_0x4e7822,null))['catch'](handleError(_0x4e7822,null));}; \ No newline at end of file +var _0x284d=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','send','CmContactHasItem','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x275890,_0x625a19){var _0x5347bc=function(_0x1b2642){while(--_0x1b2642){_0x275890['push'](_0x275890['shift']());}};_0x5347bc(++_0x625a19);}(_0x284d,0x194));var _0xd284=function(_0x478754,_0x1ceb87){_0x478754=_0x478754-0x0;var _0x30b765=_0x284d[_0x478754];return _0x30b765;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd284('0x0'));var jsonpatch=require(_0xd284('0x1'));var rp=require(_0xd284('0x2'));var moment=require(_0xd284('0x3'));var BPromise=require(_0xd284('0x4'));var Mustache=require(_0xd284('0x5'));var util=require(_0xd284('0x6'));var path=require(_0xd284('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd284('0x8'));var fs=require('fs');var fs_extra=require(_0xd284('0x9'));var _=require(_0xd284('0xa'));var squel=require(_0xd284('0xb'));var crypto=require(_0xd284('0xc'));var jsforce=require(_0xd284('0xd'));var deskjs=require(_0xd284('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd284('0xf'));var Papa=require(_0xd284('0x10'));var Redis=require(_0xd284('0x11'));var authService=require(_0xd284('0x12'));var qs=require(_0xd284('0x13'));var as=require(_0xd284('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd284('0x15'))(_0xd284('0x16'));var utils=require(_0xd284('0x17'));var config=require(_0xd284('0x18'));var licenseUtil=require(_0xd284('0x19'));var db=require(_0xd284('0x1a'))['db'];function respondWithStatusCode(_0x3df129,_0x49da2e){_0x49da2e=_0x49da2e||0xcc;return function(_0x33726e){if(_0x33726e){return _0x3df129[_0xd284('0x1b')](_0x49da2e);}return _0x3df129['status'](_0x49da2e)[_0xd284('0x1c')]();};}function respondWithResult(_0x35726c,_0x3c31d6){_0x3c31d6=_0x3c31d6||0xc8;return function(_0x3a9e1e){if(_0x3a9e1e){return _0x35726c[_0xd284('0x1d')](_0x3c31d6)[_0xd284('0x1e')](_0x3a9e1e);}};}function respondWithFilteredResult(_0x1a7432,_0x37b2f6){return function(_0x5b9b40){if(_0x5b9b40){var _0x3230a0=typeof _0x37b2f6['offset']===_0xd284('0x1f')&&typeof _0x37b2f6[_0xd284('0x20')]===_0xd284('0x1f');var _0x59dd6a=_0x5b9b40[_0xd284('0x21')];var _0x37cadd=_0x3230a0?0x0:_0x37b2f6[_0xd284('0x22')];var _0x16078e=_0x3230a0?_0x5b9b40[_0xd284('0x21')]:_0x37b2f6[_0xd284('0x22')]+_0x37b2f6[_0xd284('0x20')];var _0x216ad8;if(_0x16078e>=_0x59dd6a){_0x16078e=_0x59dd6a;_0x216ad8=0xc8;}else{_0x216ad8=0xce;}_0x1a7432[_0xd284('0x1d')](_0x216ad8);return _0x1a7432[_0xd284('0x23')](_0xd284('0x24'),_0x37cadd+'-'+_0x16078e+'/'+_0x59dd6a)['json'](_0x5b9b40);}return null;};}function patchUpdates(_0x5a8ce5){return function(_0x26c6cd){try{jsonpatch[_0xd284('0x25')](_0x26c6cd,_0x5a8ce5,!![]);}catch(_0x2a1c4b){return BPromise[_0xd284('0x26')](_0x2a1c4b);}return _0x26c6cd[_0xd284('0x27')]();};}function saveUpdates(_0x4984e9,_0x8bb085){return function(_0x4a64e9){if(_0x4a64e9){return _0x4a64e9[_0xd284('0x28')](_0x4984e9)[_0xd284('0x29')](function(_0x55753c){return _0x55753c;});}return null;};}function removeEntity(_0x389ed8,_0x59827d){return function(_0x427de9){if(_0x427de9){return _0x427de9[_0xd284('0x2a')]()['then'](function(){var _0x539cc1=_0x427de9['get']({'plain':!![]});var _0x494bbf=_0xd284('0x2b');return db[_0xd284('0x2c')]['destroy']({'where':{'type':_0x494bbf,'resourceId':_0x539cc1['id']}})[_0xd284('0x29')](function(){return _0x427de9;});})['then'](function(){_0x389ed8[_0xd284('0x1d')](0xcc)[_0xd284('0x1c')]();});}};}function handleEntityNotFound(_0x40715e,_0x404016){return function(_0x229c13){if(!_0x229c13){_0x40715e['sendStatus'](0x194);}return _0x229c13;};}function handleError(_0x207bb8,_0x143fa7){_0x143fa7=_0x143fa7||0x1f4;return function(_0x42f138){logger[_0xd284('0x2d')](_0x42f138[_0xd284('0x2e')]);if(_0x42f138[_0xd284('0x2f')]){delete _0x42f138['name'];}_0x207bb8[_0xd284('0x1d')](_0x143fa7)[_0xd284('0x30')](_0x42f138);};}exports['index']=function(_0x4df5fc,_0x447eab){var _0x408923={},_0xa7f5a4={},_0x1510f6={'count':0x0,'rows':[]};var _0x54396b=_['map'](db[_0xd284('0x31')][_0xd284('0x32')],function(_0x21dc4e){return{'name':_0x21dc4e[_0xd284('0x33')],'type':_0x21dc4e[_0xd284('0x34')][_0xd284('0x35')]};});_0xa7f5a4['model']=_[_0xd284('0x36')](_0x54396b,_0xd284('0x2f'));_0xa7f5a4[_0xd284('0x37')]=_['keys'](_0x4df5fc[_0xd284('0x37')]);_0xa7f5a4[_0xd284('0x38')]=_['intersection'](_0xa7f5a4[_0xd284('0x39')],_0xa7f5a4[_0xd284('0x37')]);_0x408923[_0xd284('0x3a')]=_[_0xd284('0x3b')](_0xa7f5a4[_0xd284('0x39')],qs['fields'](_0x4df5fc['query'][_0xd284('0x3c')]));_0x408923[_0xd284('0x3a')]=_0x408923[_0xd284('0x3a')][_0xd284('0x3d')]?_0x408923[_0xd284('0x3a')]:_0xa7f5a4[_0xd284('0x39')];if(!_0x4df5fc[_0xd284('0x37')][_0xd284('0x3e')]('nolimit')){_0x408923[_0xd284('0x20')]=qs[_0xd284('0x20')](_0x4df5fc[_0xd284('0x37')]['limit']);_0x408923[_0xd284('0x22')]=qs[_0xd284('0x22')](_0x4df5fc[_0xd284('0x37')][_0xd284('0x22')]);}_0x408923[_0xd284('0x3f')]=qs[_0xd284('0x40')](_0x4df5fc[_0xd284('0x37')][_0xd284('0x40')]);_0x408923['where']=qs[_0xd284('0x38')](_[_0xd284('0x41')](_0x4df5fc[_0xd284('0x37')],_0xa7f5a4[_0xd284('0x38')]),_0x54396b);if(_0x4df5fc[_0xd284('0x37')][_0xd284('0x42')]){_0x408923[_0xd284('0x43')]=_['merge'](_0x408923[_0xd284('0x43')],{'$or':_[_0xd284('0x36')](_0x54396b,function(_0x99baf4){if(_0x99baf4[_0xd284('0x34')]!==_0xd284('0x44')){var _0x2220cc={};_0x2220cc[_0x99baf4['name']]={'$like':'%'+_0x4df5fc['query'][_0xd284('0x42')]+'%'};return _0x2220cc;}})});}_0x408923=_[_0xd284('0x45')]({},_0x408923,_0x4df5fc[_0xd284('0x46')]);var _0x1f10d3={'where':_0x408923[_0xd284('0x43')]};return db[_0xd284('0x31')][_0xd284('0x21')](_0x1f10d3)[_0xd284('0x29')](function(_0x14f71f){_0x1510f6[_0xd284('0x21')]=_0x14f71f;if(_0x4df5fc[_0xd284('0x37')][_0xd284('0x47')]){_0x408923[_0xd284('0x48')]=[{'all':!![]}];}return db['CmContactHasItem'][_0xd284('0x49')](_0x408923);})['then'](function(_0x2ef6a7){_0x1510f6['rows']=_0x2ef6a7;return _0x1510f6;})[_0xd284('0x29')](respondWithFilteredResult(_0x447eab,_0x408923))[_0xd284('0x4a')](handleError(_0x447eab,null));};exports['show']=function(_0x4c4c38,_0x188b07){var _0x988dde={'raw':!![],'where':{'id':_0x4c4c38[_0xd284('0x4b')]['id']}},_0x310883={};_0x310883[_0xd284('0x39')]=_[_0xd284('0x4c')](db[_0xd284('0x31')][_0xd284('0x32')]);_0x310883[_0xd284('0x37')]=_[_0xd284('0x4c')](_0x4c4c38[_0xd284('0x37')]);_0x310883['filters']=_['intersection'](_0x310883[_0xd284('0x39')],_0x310883[_0xd284('0x37')]);_0x988dde[_0xd284('0x3a')]=_['intersection'](_0x310883[_0xd284('0x39')],qs[_0xd284('0x3c')](_0x4c4c38['query'][_0xd284('0x3c')]));_0x988dde['attributes']=_0x988dde[_0xd284('0x3a')]['length']?_0x988dde['attributes']:_0x310883['model'];if(_0x4c4c38['query'][_0xd284('0x47')]){_0x988dde['include']=[{'all':!![]}];}_0x988dde=_[_0xd284('0x45')]({},_0x988dde,_0x4c4c38[_0xd284('0x46')]);return db[_0xd284('0x31')][_0xd284('0x4d')](_0x988dde)[_0xd284('0x29')](handleEntityNotFound(_0x188b07,null))[_0xd284('0x29')](respondWithResult(_0x188b07,null))[_0xd284('0x4a')](handleError(_0x188b07,null));};exports[_0xd284('0x4e')]=function(_0x3434ae,_0x1853a3){return db[_0xd284('0x31')][_0xd284('0x4e')](_0x3434ae['body'],{})['then'](function(_0x361b9e){var _0x96aae7=_0x3434ae[_0xd284('0x4f')][_0xd284('0x50')]({'plain':!![]});if(!_0x96aae7)throw new Error(_0xd284('0x51'));if(_0x96aae7[_0xd284('0x52')]===_0xd284('0x4f')){var _0x3fa714=_0x361b9e[_0xd284('0x50')]({'plain':!![]});var _0x5ed8a2=_0xd284('0x2b');return db[_0xd284('0x53')][_0xd284('0x4d')]({'where':{'name':_0x5ed8a2,'userProfileId':_0x96aae7['userProfileId']},'raw':!![]})[_0xd284('0x29')](function(_0x4974cb){if(_0x4974cb&&_0x4974cb[_0xd284('0x54')]===0x0){return db['UserProfileResource'][_0xd284('0x4e')]({'name':_0x3fa714['name'],'resourceId':_0x3fa714['id'],'type':_0x4974cb[_0xd284('0x2f')],'sectionId':_0x4974cb['id']},{})[_0xd284('0x29')](function(){return _0x361b9e;});}else{return _0x361b9e;}})[_0xd284('0x4a')](function(_0x1abb4d){logger['error'](_0xd284('0x55'),_0x1abb4d);throw _0x1abb4d;});}return _0x361b9e;})[_0xd284('0x29')](respondWithResult(_0x1853a3,0xc9))[_0xd284('0x4a')](handleError(_0x1853a3,null));};exports[_0xd284('0x28')]=function(_0x51209c,_0x181f91){if(_0x51209c[_0xd284('0x56')]['id']){delete _0x51209c[_0xd284('0x56')]['id'];}return db[_0xd284('0x31')][_0xd284('0x4d')]({'where':{'id':_0x51209c[_0xd284('0x4b')]['id']}})['then'](handleEntityNotFound(_0x181f91,null))[_0xd284('0x29')](saveUpdates(_0x51209c[_0xd284('0x56')],null))[_0xd284('0x29')](respondWithResult(_0x181f91,null))[_0xd284('0x4a')](handleError(_0x181f91,null));};exports[_0xd284('0x2a')]=function(_0xa02ae7,_0xc3ef32){return db[_0xd284('0x31')]['find']({'where':{'id':_0xa02ae7[_0xd284('0x4b')]['id']}})[_0xd284('0x29')](handleEntityNotFound(_0xc3ef32,null))[_0xd284('0x29')](removeEntity(_0xc3ef32,null))[_0xd284('0x4a')](handleError(_0xc3ef32,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 87257c4..869ee67 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ac6=['path','./cmContactHasItem.attributes','exports','define','CmContactHasItem','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3a5b78,_0x31bb02){var _0x32479f=function(_0x49009f){while(--_0x49009f){_0x3a5b78['push'](_0x3a5b78['shift']());}};_0x32479f(++_0x31bb02);}(_0x9ac6,0x113));var _0x69ac=function(_0x4d5ca6,_0x583e94){_0x4d5ca6=_0x4d5ca6-0x0;var _0x4096fa=_0x9ac6[_0x4d5ca6];return _0x4096fa;};'use strict';var _=require('lodash');var util=require(_0x69ac('0x0'));var logger=require(_0x69ac('0x1'))('api');var moment=require(_0x69ac('0x2'));var BPromise=require(_0x69ac('0x3'));var rp=require(_0x69ac('0x4'));var fs=require('fs');var path=require(_0x69ac('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x69ac('0x6'));module[_0x69ac('0x7')]=function(_0x215efc,_0x2e9ab8){return _0x215efc[_0x69ac('0x8')](_0x69ac('0x9'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xceeb=['CmContactHasItem','cm_contact_has_items','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define'];(function(_0x47df8e,_0x43f857){var _0x392f57=function(_0x4b5992){while(--_0x4b5992){_0x47df8e['push'](_0x47df8e['shift']());}};_0x392f57(++_0x43f857);}(_0xceeb,0x147));var _0xbcee=function(_0x19d745,_0x234005){_0x19d745=_0x19d745-0x0;var _0x388814=_0xceeb[_0x19d745];return _0x388814;};'use strict';var _=require('lodash');var util=require(_0xbcee('0x0'));var logger=require('../../config/logger')(_0xbcee('0x1'));var moment=require(_0xbcee('0x2'));var BPromise=require(_0xbcee('0x3'));var rp=require(_0xbcee('0x4'));var fs=require('fs');var path=require(_0xbcee('0x5'));var rimraf=require(_0xbcee('0x6'));var config=require(_0xbcee('0x7'));var attributes=require(_0xbcee('0x8'));module[_0xbcee('0x9')]=function(_0x561b29,_0x377ed3){return _0x561b29[_0xbcee('0xa')](_0xbcee('0xb'),attributes,{'tableName':_0xbcee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index a97a7bf..2b3a1ba 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0097=['CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x5133d0,_0x23fcb1){var _0x370285=function(_0x435608){while(--_0x435608){_0x5133d0['push'](_0x5133d0['shift']());}};_0x370285(++_0x23fcb1);}(_0x0097,0xfe));var _0x7009=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0097[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7009('0x0'));var BPromise=require('bluebird');var rs=require(_0x7009('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7009('0x2'))['db'];var utils=require(_0x7009('0x3'));var logger=require(_0x7009('0x4'))(_0x7009('0x5'));var config=require(_0x7009('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7009('0x7')][_0x7009('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x61cf6e,_0x4f6468,_0xeff1b3){return new BPromise(function(_0x27bf5d,_0x193728){return client[_0x7009('0x9')](_0x61cf6e,_0xeff1b3)[_0x7009('0xa')](function(_0x47b462){logger[_0x7009('0xb')](_0x7009('0xc'),_0x4f6468,_0x7009('0xd'));logger['debug'](_0x7009('0xe'),_0x4f6468,_0x7009('0xd'),JSON[_0x7009('0xf')](_0x47b462));if(_0x47b462['error']){if(_0x47b462[_0x7009('0x10')]['code']===0x1f4){logger[_0x7009('0x10')](_0x7009('0xc'),_0x4f6468,_0x47b462[_0x7009('0x10')][_0x7009('0x11')]);return _0x193728(_0x47b462[_0x7009('0x10')][_0x7009('0x11')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4f6468,_0x47b462[_0x7009('0x10')][_0x7009('0x11')]);return _0x27bf5d(_0x47b462[_0x7009('0x10')][_0x7009('0x11')]);}else{logger[_0x7009('0xb')](_0x7009('0xc'),_0x4f6468,_0x7009('0xd'));_0x27bf5d(_0x47b462[_0x7009('0x12')][_0x7009('0x11')]);}})['catch'](function(_0x4f6e07){logger[_0x7009('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x4f6468,_0x4f6e07);_0x193728(_0x4f6e07);});});} \ No newline at end of file +var _0x65f9=['CmContactHasItem,\x20%s,\x20%s,\x20%s','error','CmContactHasItem,\x20%s,\x20%s','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x48ca40,_0x5d1655){var _0x38b379=function(_0x32cfff){while(--_0x32cfff){_0x48ca40['push'](_0x48ca40['shift']());}};_0x38b379(++_0x5d1655);}(_0x65f9,0x1d3));var _0x965f=function(_0x1b2aac,_0x23fe7a){_0x1b2aac=_0x1b2aac-0x0;var _0x33aec2=_0x65f9[_0x1b2aac];return _0x33aec2;};'use strict';var _=require(_0x965f('0x0'));var util=require(_0x965f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x965f('0x2'));var fs=require('fs');var Redis=require(_0x965f('0x3'));var db=require(_0x965f('0x4'))['db'];var utils=require(_0x965f('0x5'));var logger=require(_0x965f('0x6'))(_0x965f('0x7'));var config=require(_0x965f('0x8'));var jayson=require(_0x965f('0x9'));var client=jayson[_0x965f('0xa')][_0x965f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x401dba,_0x455617,_0x3fa2fd){return new BPromise(function(_0x3a6552,_0x3465a2){return client[_0x965f('0xc')](_0x401dba,_0x3fa2fd)[_0x965f('0xd')](function(_0x4a1119){logger[_0x965f('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x455617,_0x965f('0xf'));logger[_0x965f('0x10')](_0x965f('0x11'),_0x455617,_0x965f('0xf'),JSON['stringify'](_0x4a1119));if(_0x4a1119[_0x965f('0x12')]){if(_0x4a1119[_0x965f('0x12')]['code']===0x1f4){logger[_0x965f('0x12')](_0x965f('0x13'),_0x455617,_0x4a1119[_0x965f('0x12')][_0x965f('0x14')]);return _0x3465a2(_0x4a1119['error'][_0x965f('0x14')]);}logger[_0x965f('0x12')](_0x965f('0x13'),_0x455617,_0x4a1119['error'][_0x965f('0x14')]);return _0x3a6552(_0x4a1119[_0x965f('0x12')][_0x965f('0x14')]);}else{logger[_0x965f('0xe')](_0x965f('0x13'),_0x455617,'request\x20sent');_0x3a6552(_0x4a1119[_0x965f('0x15')][_0x965f('0x14')]);}})['catch'](function(_0x180df7){logger[_0x965f('0x12')](_0x965f('0x13'),_0x455617,_0x180df7);_0x3465a2(_0x180df7);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 3c35346..47b818e 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b3c=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x2fee9b,_0x27b9c3){var _0x184368=function(_0x2fcb5f){while(--_0x2fcb5f){_0x2fee9b['push'](_0x2fee9b['shift']());}};_0x184368(++_0x27b9c3);}(_0x3b3c,0x134));var _0xc3b3=function(_0x1198a7,_0x58ca47){_0x1198a7=_0x1198a7-0x0;var _0x34e937=_0x3b3c[_0x1198a7];return _0x34e937;};'use strict';var multer=require(_0xc3b3('0x0'));var util=require(_0xc3b3('0x1'));var path=require(_0xc3b3('0x2'));var timeout=require(_0xc3b3('0x3'));var express=require(_0xc3b3('0x4'));var router=express[_0xc3b3('0x5')]();var fs_extra=require(_0xc3b3('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc3b3('0x7'));var controller=require(_0xc3b3('0x8'));router[_0xc3b3('0x9')]('/',auth[_0xc3b3('0xa')](),controller[_0xc3b3('0xb')]);router[_0xc3b3('0x9')](_0xc3b3('0xc'),auth[_0xc3b3('0xa')](),controller['show']);router[_0xc3b3('0xd')]('/',auth[_0xc3b3('0xa')](),controller[_0xc3b3('0xe')]);router[_0xc3b3('0xf')](_0xc3b3('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xc3b3('0x10')](_0xc3b3('0xc'),auth[_0xc3b3('0xa')](),controller[_0xc3b3('0x11')]);module[_0xc3b3('0x12')]=router; \ No newline at end of file +var _0x1903=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./cmContactHasItem.controller','index','get','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x241164,_0x336838){var _0x297e72=function(_0x29bea7){while(--_0x29bea7){_0x241164['push'](_0x241164['shift']());}};_0x297e72(++_0x336838);}(_0x1903,0x7a));var _0x3190=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1903[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x3190('0x0'));var path=require(_0x3190('0x1'));var timeout=require(_0x3190('0x2'));var express=require(_0x3190('0x3'));var router=express[_0x3190('0x4')]();var fs_extra=require(_0x3190('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3190('0x6'));var controller=require(_0x3190('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3190('0x8')]);router[_0x3190('0x9')](_0x3190('0xa'),auth['isAuthenticated'](),controller[_0x3190('0xb')]);router[_0x3190('0xc')]('/',auth[_0x3190('0xd')](),controller[_0x3190('0xe')]);router[_0x3190('0xf')](_0x3190('0xa'),auth[_0x3190('0xd')](),controller[_0x3190('0x10')]);router[_0x3190('0x11')]('/:id',auth[_0x3190('0xd')](),controller[_0x3190('0x12')]);module[_0x3190('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 3d08fb0..cbdbc6a 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 _0x55fe=['parse','values','isArray','stringify','BOOLEAN','ENUM','voice','lodash','VIRTUAL','getDataValue','setDataValue','alias','name','STRING','TEXT'];(function(_0x2b49bc,_0x47b636){var _0x43cc65=function(_0x236ec3){while(--_0x236ec3){_0x2b49bc['push'](_0x2b49bc['shift']());}};_0x43cc65(++_0x47b636);}(_0x55fe,0xf7));var _0xe55f=function(_0x278a59,_0x11137c){_0x278a59=_0x278a59-0x0;var _0x4f24c7=_0x55fe[_0x278a59];return _0x4f24c7;};'use strict';var Sequelize=require('sequelize');var _=require(_0xe55f('0x0'));module['exports']={'name':{'type':Sequelize[_0xe55f('0x1')],'get':function(_0x3aec30){return this[_0xe55f('0x2')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3dad48){this[_0xe55f('0x3')](_0xe55f('0x4'),_0x3dad48?_0x3dad48:this[_0xe55f('0x2')](_0xe55f('0x5')));}},'type':{'type':Sequelize[_0xe55f('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xe55f('0x7')]('long'),'get':function(){if(this['getDataValue']('type')==='select'){return JSON[_0xe55f('0x8')](this['getDataValue'](_0xe55f('0x9')));}else{return this[_0xe55f('0x2')](_0xe55f('0x9'));}},'set':function(_0x386433){if(Array[_0xe55f('0xa')](_0x386433)){this['setDataValue']('values',JSON[_0xe55f('0xb')](_0x386433));}else{this[_0xe55f('0x3')](_0xe55f('0x9'),_0x386433);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe55f('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xe55f('0xd')](_0xe55f('0xe'))}}; \ No newline at end of file +var _0x5bf5=['BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','type','parse','values','isArray','stringify'];(function(_0x596649,_0x4773b1){var _0x26f5d8=function(_0x203e3e){while(--_0x203e3e){_0x596649['push'](_0x596649['shift']());}};_0x26f5d8(++_0x4773b1);}(_0x5bf5,0x1ab));var _0x55bf=function(_0x42eb44,_0x5b5a9a){_0x42eb44=_0x42eb44-0x0;var _0x4f6b13=_0x5bf5[_0x42eb44];return _0x4f6b13;};'use strict';var Sequelize=require(_0x55bf('0x0'));var _=require(_0x55bf('0x1'));module[_0x55bf('0x2')]={'name':{'type':Sequelize[_0x55bf('0x3')],'get':function(_0x1dc39d){return this[_0x55bf('0x4')](_0x55bf('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0xb90fb0){this[_0x55bf('0x6')](_0x55bf('0x5'),_0xb90fb0?_0xb90fb0:this['getDataValue'](_0x55bf('0x7')));}},'type':{'type':Sequelize[_0x55bf('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0x55bf('0x9')]('long'),'get':function(){if(this[_0x55bf('0x4')](_0x55bf('0xa'))==='select'){return JSON[_0x55bf('0xb')](this[_0x55bf('0x4')](_0x55bf('0xc')));}else{return this[_0x55bf('0x4')](_0x55bf('0xc'));}},'set':function(_0x57edf8){if(Array[_0x55bf('0xd')](_0x57edf8)){this['setDataValue'](_0x55bf('0xc'),JSON[_0x55bf('0xe')](_0x57edf8));}else{this[_0x55bf('0x6')](_0x55bf('0xc'),_0x57edf8);}}},'required':{'type':Sequelize[_0x55bf('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x55bf('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index d789106..6d17e07 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 _0xeef0=['catch','fields','length','include','body','find','params','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0x3b16c4,_0xa0b0d1){var _0x36b5bc=function(_0x2c8d11){while(--_0x2c8d11){_0x3b16c4['push'](_0x3b16c4['shift']());}};_0x36b5bc(++_0xa0b0d1);}(_0xeef0,0xc3));var _0x0eef=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xeef0[_0x4e7d25];return _0x526fe6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0eef('0x0'));var zipdir=require(_0x0eef('0x1'));var jsonpatch=require(_0x0eef('0x2'));var rp=require(_0x0eef('0x3'));var moment=require(_0x0eef('0x4'));var BPromise=require(_0x0eef('0x5'));var Mustache=require(_0x0eef('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0eef('0x7'));var csv=require(_0x0eef('0x8'));var ejs=require(_0x0eef('0x9'));var fs=require('fs');var fs_extra=require(_0x0eef('0xa'));var _=require('lodash');var squel=require(_0x0eef('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0eef('0xc'));var toCsv=require(_0x0eef('0x8'));var querystring=require(_0x0eef('0xd'));var Papa=require(_0x0eef('0xe'));var Redis=require(_0x0eef('0xf'));var authService=require(_0x0eef('0x10'));var qs=require(_0x0eef('0x11'));var as=require(_0x0eef('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0eef('0x13'))(_0x0eef('0x14'));var utils=require(_0x0eef('0x15'));var config=require(_0x0eef('0x16'));var licenseUtil=require(_0x0eef('0x17'));var db=require(_0x0eef('0x18'))['db'];function respondWithStatusCode(_0x7cba45,_0x226e0a){_0x226e0a=_0x226e0a||0xcc;return function(_0x172756){if(_0x172756){return _0x7cba45[_0x0eef('0x19')](_0x226e0a);}return _0x7cba45[_0x0eef('0x1a')](_0x226e0a)[_0x0eef('0x1b')]();};}function respondWithResult(_0x2e1c1c,_0x2c9b48){_0x2c9b48=_0x2c9b48||0xc8;return function(_0x54606f){if(_0x54606f){return _0x2e1c1c[_0x0eef('0x1a')](_0x2c9b48)['json'](_0x54606f);}};}function respondWithFilteredResult(_0x433c68,_0x4cb563){return function(_0x2df467){if(_0x2df467){var _0xcadcfd=typeof _0x4cb563[_0x0eef('0x1c')]==='undefined'&&typeof _0x4cb563[_0x0eef('0x1d')]===_0x0eef('0x1e');var _0x4c50ac=_0x2df467[_0x0eef('0x1f')];var _0x40d5b3=_0xcadcfd?0x0:_0x4cb563['offset'];var _0x40cad9=_0xcadcfd?_0x2df467[_0x0eef('0x1f')]:_0x4cb563['offset']+_0x4cb563['limit'];var _0x3b5bf6;if(_0x40cad9>=_0x4c50ac){_0x40cad9=_0x4c50ac;_0x3b5bf6=0xc8;}else{_0x3b5bf6=0xce;}_0x433c68[_0x0eef('0x1a')](_0x3b5bf6);return _0x433c68[_0x0eef('0x20')](_0x0eef('0x21'),_0x40d5b3+'-'+_0x40cad9+'/'+_0x4c50ac)[_0x0eef('0x22')](_0x2df467);}return null;};}function patchUpdates(_0x3ac8d7){return function(_0x35f293){try{jsonpatch[_0x0eef('0x23')](_0x35f293,_0x3ac8d7,!![]);}catch(_0x41b35a){return BPromise[_0x0eef('0x24')](_0x41b35a);}return _0x35f293[_0x0eef('0x25')]();};}function saveUpdates(_0x517629,_0x2e9a41){return function(_0x53384f){if(_0x53384f){return _0x53384f[_0x0eef('0x26')](_0x517629)[_0x0eef('0x27')](function(_0x29805c){return _0x29805c;});}return null;};}function removeEntity(_0x39ae17,_0x236736){return function(_0x26c8d0){if(_0x26c8d0){return _0x26c8d0[_0x0eef('0x28')]()[_0x0eef('0x27')](function(){_0x39ae17[_0x0eef('0x1a')](0xcc)[_0x0eef('0x1b')]();});}};}function handleEntityNotFound(_0x5ed22e,_0x32f438){return function(_0x48f45f){if(!_0x48f45f){_0x5ed22e[_0x0eef('0x19')](0x194);}return _0x48f45f;};}function handleError(_0x3e52f2,_0x1d1110){_0x1d1110=_0x1d1110||0x1f4;return function(_0x17d5b3){logger[_0x0eef('0x29')](_0x17d5b3[_0x0eef('0x2a')]);if(_0x17d5b3[_0x0eef('0x2b')]){delete _0x17d5b3[_0x0eef('0x2b')];}_0x3e52f2[_0x0eef('0x1a')](_0x1d1110)[_0x0eef('0x2c')](_0x17d5b3);};}exports[_0x0eef('0x2d')]=function(_0xc8d9b1,_0x4bcfff){var _0x22a740={},_0x11060f={},_0x3d311e={'count':0x0,'rows':[]};var _0x4c7e2b=_[_0x0eef('0x2e')](db[_0x0eef('0x2f')][_0x0eef('0x30')],function(_0x40c1d2){return{'name':_0x40c1d2[_0x0eef('0x31')],'type':_0x40c1d2[_0x0eef('0x32')][_0x0eef('0x33')]};});_0x11060f['model']=_['differenceBy'](_[_0x0eef('0x2e')](_0x4c7e2b,_0x0eef('0x2b')),[_0x0eef('0x2b')]);_0x11060f[_0x0eef('0x34')]=_[_0x0eef('0x35')](_0xc8d9b1[_0x0eef('0x34')]);_0x11060f[_0x0eef('0x36')]=_['intersection'](_0x11060f[_0x0eef('0x37')],_0x11060f[_0x0eef('0x34')]);_0x22a740[_0x0eef('0x38')]=_[_0x0eef('0x39')](_0x11060f[_0x0eef('0x37')],qs['fields'](_0xc8d9b1[_0x0eef('0x34')]['fields']));_0x22a740['attributes']=_0x22a740[_0x0eef('0x38')]['length']?_0x22a740[_0x0eef('0x38')]:_0x11060f[_0x0eef('0x37')];if(!_0xc8d9b1[_0x0eef('0x34')][_0x0eef('0x3a')](_0x0eef('0x3b'))){_0x22a740['limit']=qs[_0x0eef('0x1d')](_0xc8d9b1[_0x0eef('0x34')][_0x0eef('0x1d')]);_0x22a740[_0x0eef('0x1c')]=qs['offset'](_0xc8d9b1[_0x0eef('0x34')]['offset']);}_0x22a740[_0x0eef('0x3c')]=qs[_0x0eef('0x3d')](_0xc8d9b1[_0x0eef('0x34')][_0x0eef('0x3d')]);_0x22a740[_0x0eef('0x3e')]=qs['filters'](_['pick'](_0xc8d9b1['query'],_0x11060f[_0x0eef('0x36')]),_0x4c7e2b);if(_0xc8d9b1['query'][_0x0eef('0x3f')]){_0x22a740[_0x0eef('0x3e')]=_[_0x0eef('0x40')](_0x22a740[_0x0eef('0x3e')],{'$or':_['map'](_0x4c7e2b,function(_0x324cd9){if(_0x324cd9[_0x0eef('0x32')]!==_0x0eef('0x41')){var _0x55c525={};_0x55c525[_0x324cd9['name']]={'$like':'%'+_0xc8d9b1[_0x0eef('0x34')]['filter']+'%'};return _0x55c525;}})});}_0x22a740=_['merge']({},_0x22a740,_0xc8d9b1[_0x0eef('0x42')]);var _0x1146ab={'where':_0x22a740['where']};return db[_0x0eef('0x2f')][_0x0eef('0x1f')](_0x1146ab)['then'](function(_0x2f4070){_0x3d311e[_0x0eef('0x1f')]=_0x2f4070;if(_0xc8d9b1['query'][_0x0eef('0x43')]){_0x22a740['include']=[{'all':!![]}];}return db['CmCustomField'][_0x0eef('0x44')](_0x22a740);})[_0x0eef('0x27')](function(_0x4a0ffb){_0x3d311e['rows']=_0x4a0ffb;return _0x3d311e;})[_0x0eef('0x27')](respondWithFilteredResult(_0x4bcfff,_0x22a740))[_0x0eef('0x45')](handleError(_0x4bcfff,null));};exports['show']=function(_0x14552b,_0x405c83){var _0x57ca1d={'raw':!![],'where':{'id':_0x14552b['params']['id']}},_0x2e9e22={};_0x2e9e22['model']=_[_0x0eef('0x35')](db[_0x0eef('0x2f')][_0x0eef('0x30')]);_0x2e9e22['query']=_['keys'](_0x14552b[_0x0eef('0x34')]);_0x2e9e22[_0x0eef('0x36')]=_['intersection'](_0x2e9e22[_0x0eef('0x37')],_0x2e9e22[_0x0eef('0x34')]);_0x57ca1d[_0x0eef('0x38')]=_['intersection'](_0x2e9e22[_0x0eef('0x37')],qs[_0x0eef('0x46')](_0x14552b[_0x0eef('0x34')]['fields']));_0x57ca1d[_0x0eef('0x38')]=_0x57ca1d['attributes'][_0x0eef('0x47')]?_0x57ca1d[_0x0eef('0x38')]:_0x2e9e22[_0x0eef('0x37')];if(_0x14552b[_0x0eef('0x34')][_0x0eef('0x43')]){_0x57ca1d[_0x0eef('0x48')]=[{'all':!![]}];}_0x57ca1d=_[_0x0eef('0x40')]({},_0x57ca1d,_0x14552b[_0x0eef('0x42')]);return db[_0x0eef('0x2f')]['find'](_0x57ca1d)[_0x0eef('0x27')](handleEntityNotFound(_0x405c83,null))[_0x0eef('0x27')](respondWithResult(_0x405c83,null))[_0x0eef('0x45')](handleError(_0x405c83,null));};exports[_0x0eef('0x26')]=function(_0x29f559,_0x232aae){if(_0x29f559[_0x0eef('0x49')]['id']){delete _0x29f559[_0x0eef('0x49')]['id'];}return db[_0x0eef('0x2f')][_0x0eef('0x4a')]({'where':{'id':_0x29f559[_0x0eef('0x4b')]['id']}})[_0x0eef('0x27')](handleEntityNotFound(_0x232aae,null))[_0x0eef('0x27')](saveUpdates(_0x29f559[_0x0eef('0x49')],null))['then'](respondWithResult(_0x232aae,null))[_0x0eef('0x45')](handleError(_0x232aae,null));};exports[_0x0eef('0x28')]=function(_0x3935c0,_0x2b5031){return db['CmCustomField']['find']({'where':{'id':_0x3935c0['params']['id']}})[_0x0eef('0x27')](handleEntityNotFound(_0x2b5031,null))[_0x0eef('0x27')](removeEntity(_0x2b5031,null))[_0x0eef('0x45')](handleError(_0x2b5031,null));};exports[_0x0eef('0x4c')]=function(_0x447329,_0x10a337){var _0x3dc12e;return db[_0x0eef('0x4d')][_0x0eef('0x4e')](function(_0xd42020){return db['CmCustomField'][_0x0eef('0x4c')](_0x447329[_0x0eef('0x49')],{'transaction':_0xd42020})[_0x0eef('0x27')](function(_0x5066fa){_0x3dc12e=_0x5066fa;var _0x255d02={'type':db[_0x0eef('0x4f')][_0x0eef('0x50')],'transaction':_0xd42020};switch(_0x447329[_0x0eef('0x49')]['type']){case'text':_0x255d02['type']=db[_0x0eef('0x4f')][_0x0eef('0x50')];break;case _0x0eef('0x51'):_0x255d02[_0x0eef('0x32')]=db[_0x0eef('0x4f')][_0x0eef('0x52')];break;case _0x0eef('0x53'):_0x255d02['type']=db[_0x0eef('0x4f')][_0x0eef('0x54')];_0x255d02['defaultValue']=![];break;default:}return db[_0x0eef('0x4d')][_0x0eef('0x55')][_0x0eef('0x56')]('cm_contacts',util[_0x0eef('0x57')]('cf_%d',_0x3dc12e['id']),_0x255d02);})['then'](function(){return _0x3dc12e;});})[_0x0eef('0x27')](respondWithResult(_0x10a337,0xc9))['catch'](handleError(_0x10a337,null));}; \ No newline at end of file +var _0xb6ce=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','CmCustomField','findAll','rows','catch','options','body','find','params','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','query','keys','intersection','model','fields','attributes'];(function(_0x232795,_0x299c0b){var _0xe03ba2=function(_0x42b7db){while(--_0x42b7db){_0x232795['push'](_0x232795['shift']());}};_0xe03ba2(++_0x299c0b);}(_0xb6ce,0x130));var _0xeb6c=function(_0x7ac34d,_0x44f85b){_0x7ac34d=_0x7ac34d-0x0;var _0x440b94=_0xb6ce[_0x7ac34d];return _0x440b94;};'use strict';var emlformat=require(_0xeb6c('0x0'));var rimraf=require(_0xeb6c('0x1'));var zipdir=require(_0xeb6c('0x2'));var jsonpatch=require(_0xeb6c('0x3'));var rp=require('request-promise');var moment=require(_0xeb6c('0x4'));var BPromise=require(_0xeb6c('0x5'));var Mustache=require('mustache');var util=require(_0xeb6c('0x6'));var path=require(_0xeb6c('0x7'));var sox=require(_0xeb6c('0x8'));var csv=require(_0xeb6c('0x9'));var ejs=require(_0xeb6c('0xa'));var fs=require('fs');var fs_extra=require(_0xeb6c('0xb'));var _=require(_0xeb6c('0xc'));var squel=require('squel');var crypto=require(_0xeb6c('0xd'));var jsforce=require(_0xeb6c('0xe'));var deskjs=require(_0xeb6c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb6c('0x10'));var Papa=require(_0xeb6c('0x11'));var Redis=require(_0xeb6c('0x12'));var authService=require(_0xeb6c('0x13'));var qs=require(_0xeb6c('0x14'));var as=require(_0xeb6c('0x15'));var hardwareService=require(_0xeb6c('0x16'));var logger=require(_0xeb6c('0x17'))('api');var utils=require(_0xeb6c('0x18'));var config=require(_0xeb6c('0x19'));var licenseUtil=require(_0xeb6c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x369ccf,_0x4fc0f7){_0x4fc0f7=_0x4fc0f7||0xcc;return function(_0x77046){if(_0x77046){return _0x369ccf[_0xeb6c('0x1b')](_0x4fc0f7);}return _0x369ccf['status'](_0x4fc0f7)[_0xeb6c('0x1c')]();};}function respondWithResult(_0x573af1,_0xfdd00e){_0xfdd00e=_0xfdd00e||0xc8;return function(_0x441761){if(_0x441761){return _0x573af1[_0xeb6c('0x1d')](_0xfdd00e)[_0xeb6c('0x1e')](_0x441761);}};}function respondWithFilteredResult(_0x4f1270,_0x227b1f){return function(_0xd7a88d){if(_0xd7a88d){var _0x2a44a3=typeof _0x227b1f[_0xeb6c('0x1f')]==='undefined'&&typeof _0x227b1f[_0xeb6c('0x20')]===_0xeb6c('0x21');var _0x2e973c=_0xd7a88d[_0xeb6c('0x22')];var _0x1e1ef8=_0x2a44a3?0x0:_0x227b1f[_0xeb6c('0x1f')];var _0x1f6ea8=_0x2a44a3?_0xd7a88d[_0xeb6c('0x22')]:_0x227b1f[_0xeb6c('0x1f')]+_0x227b1f['limit'];var _0x1d690a;if(_0x1f6ea8>=_0x2e973c){_0x1f6ea8=_0x2e973c;_0x1d690a=0xc8;}else{_0x1d690a=0xce;}_0x4f1270[_0xeb6c('0x1d')](_0x1d690a);return _0x4f1270[_0xeb6c('0x23')](_0xeb6c('0x24'),_0x1e1ef8+'-'+_0x1f6ea8+'/'+_0x2e973c)[_0xeb6c('0x1e')](_0xd7a88d);}return null;};}function patchUpdates(_0x35ee05){return function(_0x56bd0d){try{jsonpatch[_0xeb6c('0x25')](_0x56bd0d,_0x35ee05,!![]);}catch(_0x44140f){return BPromise[_0xeb6c('0x26')](_0x44140f);}return _0x56bd0d['save']();};}function saveUpdates(_0x4bbe08,_0x946b13){return function(_0x29cf4c){if(_0x29cf4c){return _0x29cf4c[_0xeb6c('0x27')](_0x4bbe08)[_0xeb6c('0x28')](function(_0x4572d0){return _0x4572d0;});}return null;};}function removeEntity(_0x294b1d,_0x5db40d){return function(_0xe4e8b0){if(_0xe4e8b0){return _0xe4e8b0[_0xeb6c('0x29')]()[_0xeb6c('0x28')](function(){_0x294b1d[_0xeb6c('0x1d')](0xcc)[_0xeb6c('0x1c')]();});}};}function handleEntityNotFound(_0x775d91,_0x1e7e89){return function(_0x7ba3e){if(!_0x7ba3e){_0x775d91['sendStatus'](0x194);}return _0x7ba3e;};}function handleError(_0xb3b686,_0x27d0e7){_0x27d0e7=_0x27d0e7||0x1f4;return function(_0x5588ca){logger[_0xeb6c('0x2a')](_0x5588ca['stack']);if(_0x5588ca[_0xeb6c('0x2b')]){delete _0x5588ca['name'];}_0xb3b686[_0xeb6c('0x1d')](_0x27d0e7)[_0xeb6c('0x2c')](_0x5588ca);};}exports[_0xeb6c('0x2d')]=function(_0x3946b0,_0x1e4cc5){var _0x289d9c={},_0x3deced={},_0x96cdf7={'count':0x0,'rows':[]};var _0x4ca32f=_[_0xeb6c('0x2e')](db['CmCustomField'][_0xeb6c('0x2f')],function(_0x170922){return{'name':_0x170922['fieldName'],'type':_0x170922[_0xeb6c('0x30')][_0xeb6c('0x31')]};});_0x3deced['model']=_['differenceBy'](_[_0xeb6c('0x2e')](_0x4ca32f,_0xeb6c('0x2b')),['name']);_0x3deced[_0xeb6c('0x32')]=_[_0xeb6c('0x33')](_0x3946b0[_0xeb6c('0x32')]);_0x3deced['filters']=_[_0xeb6c('0x34')](_0x3deced[_0xeb6c('0x35')],_0x3deced[_0xeb6c('0x32')]);_0x289d9c['attributes']=_[_0xeb6c('0x34')](_0x3deced[_0xeb6c('0x35')],qs['fields'](_0x3946b0[_0xeb6c('0x32')][_0xeb6c('0x36')]));_0x289d9c[_0xeb6c('0x37')]=_0x289d9c['attributes']['length']?_0x289d9c[_0xeb6c('0x37')]:_0x3deced[_0xeb6c('0x35')];if(!_0x3946b0['query'][_0xeb6c('0x38')](_0xeb6c('0x39'))){_0x289d9c['limit']=qs[_0xeb6c('0x20')](_0x3946b0[_0xeb6c('0x32')][_0xeb6c('0x20')]);_0x289d9c[_0xeb6c('0x1f')]=qs[_0xeb6c('0x1f')](_0x3946b0['query'][_0xeb6c('0x1f')]);}_0x289d9c[_0xeb6c('0x3a')]=qs[_0xeb6c('0x3b')](_0x3946b0[_0xeb6c('0x32')][_0xeb6c('0x3b')]);_0x289d9c[_0xeb6c('0x3c')]=qs[_0xeb6c('0x3d')](_[_0xeb6c('0x3e')](_0x3946b0[_0xeb6c('0x32')],_0x3deced['filters']),_0x4ca32f);if(_0x3946b0[_0xeb6c('0x32')][_0xeb6c('0x3f')]){_0x289d9c[_0xeb6c('0x3c')]=_[_0xeb6c('0x40')](_0x289d9c[_0xeb6c('0x3c')],{'$or':_[_0xeb6c('0x2e')](_0x4ca32f,function(_0x4f9193){if(_0x4f9193[_0xeb6c('0x30')]!=='VIRTUAL'){var _0x5300a8={};_0x5300a8[_0x4f9193[_0xeb6c('0x2b')]]={'$like':'%'+_0x3946b0[_0xeb6c('0x32')][_0xeb6c('0x3f')]+'%'};return _0x5300a8;}})});}_0x289d9c=_['merge']({},_0x289d9c,_0x3946b0['options']);var _0x1c0c27={'where':_0x289d9c[_0xeb6c('0x3c')]};return db['CmCustomField'][_0xeb6c('0x22')](_0x1c0c27)[_0xeb6c('0x28')](function(_0x536894){_0x96cdf7[_0xeb6c('0x22')]=_0x536894;if(_0x3946b0[_0xeb6c('0x32')][_0xeb6c('0x41')]){_0x289d9c[_0xeb6c('0x42')]=[{'all':!![]}];}return db[_0xeb6c('0x43')][_0xeb6c('0x44')](_0x289d9c);})['then'](function(_0x24f4cd){_0x96cdf7[_0xeb6c('0x45')]=_0x24f4cd;return _0x96cdf7;})[_0xeb6c('0x28')](respondWithFilteredResult(_0x1e4cc5,_0x289d9c))[_0xeb6c('0x46')](handleError(_0x1e4cc5,null));};exports['show']=function(_0xd3009f,_0x4cdfca){var _0xdeaa27={'raw':!![],'where':{'id':_0xd3009f['params']['id']}},_0x4207eb={};_0x4207eb[_0xeb6c('0x35')]=_[_0xeb6c('0x33')](db[_0xeb6c('0x43')][_0xeb6c('0x2f')]);_0x4207eb[_0xeb6c('0x32')]=_[_0xeb6c('0x33')](_0xd3009f[_0xeb6c('0x32')]);_0x4207eb['filters']=_['intersection'](_0x4207eb[_0xeb6c('0x35')],_0x4207eb['query']);_0xdeaa27[_0xeb6c('0x37')]=_[_0xeb6c('0x34')](_0x4207eb[_0xeb6c('0x35')],qs['fields'](_0xd3009f[_0xeb6c('0x32')]['fields']));_0xdeaa27['attributes']=_0xdeaa27[_0xeb6c('0x37')]['length']?_0xdeaa27[_0xeb6c('0x37')]:_0x4207eb['model'];if(_0xd3009f['query'][_0xeb6c('0x41')]){_0xdeaa27['include']=[{'all':!![]}];}_0xdeaa27=_[_0xeb6c('0x40')]({},_0xdeaa27,_0xd3009f[_0xeb6c('0x47')]);return db[_0xeb6c('0x43')]['find'](_0xdeaa27)[_0xeb6c('0x28')](handleEntityNotFound(_0x4cdfca,null))['then'](respondWithResult(_0x4cdfca,null))[_0xeb6c('0x46')](handleError(_0x4cdfca,null));};exports['update']=function(_0x1e268c,_0x114e6c){if(_0x1e268c[_0xeb6c('0x48')]['id']){delete _0x1e268c[_0xeb6c('0x48')]['id'];}return db[_0xeb6c('0x43')][_0xeb6c('0x49')]({'where':{'id':_0x1e268c['params']['id']}})[_0xeb6c('0x28')](handleEntityNotFound(_0x114e6c,null))[_0xeb6c('0x28')](saveUpdates(_0x1e268c['body'],null))['then'](respondWithResult(_0x114e6c,null))[_0xeb6c('0x46')](handleError(_0x114e6c,null));};exports[_0xeb6c('0x29')]=function(_0x2dc5d5,_0x5c783a){return db[_0xeb6c('0x43')][_0xeb6c('0x49')]({'where':{'id':_0x2dc5d5[_0xeb6c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5c783a,null))['then'](removeEntity(_0x5c783a,null))['catch'](handleError(_0x5c783a,null));};exports[_0xeb6c('0x4b')]=function(_0x4171c8,_0x4aff02){var _0x1a9331;return db[_0xeb6c('0x4c')][_0xeb6c('0x4d')](function(_0x8412c7){return db[_0xeb6c('0x43')]['create'](_0x4171c8[_0xeb6c('0x48')],{'transaction':_0x8412c7})[_0xeb6c('0x28')](function(_0x3440f1){_0x1a9331=_0x3440f1;var _0x6cacee={'type':db[_0xeb6c('0x4e')][_0xeb6c('0x4f')],'transaction':_0x8412c7};switch(_0x4171c8[_0xeb6c('0x48')][_0xeb6c('0x30')]){case _0xeb6c('0x50'):_0x6cacee['type']=db[_0xeb6c('0x4e')][_0xeb6c('0x4f')];break;case _0xeb6c('0x51'):_0x6cacee[_0xeb6c('0x30')]=db[_0xeb6c('0x4e')][_0xeb6c('0x52')];break;case _0xeb6c('0x53'):_0x6cacee[_0xeb6c('0x30')]=db[_0xeb6c('0x4e')]['BOOLEAN'];_0x6cacee[_0xeb6c('0x54')]=![];break;default:}return db[_0xeb6c('0x4c')][_0xeb6c('0x55')][_0xeb6c('0x56')](_0xeb6c('0x57'),util[_0xeb6c('0x58')](_0xeb6c('0x59'),_0x1a9331['id']),_0x6cacee);})['then'](function(){return _0x1a9331;});})['then'](respondWithResult(_0x4aff02,0xc9))['catch'](handleError(_0x4aff02,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 5baf187..2c4790b 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 _0x118f=['request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','cm_custom_fields','../../config/logger','api','moment'];(function(_0x5714d4,_0x2f28ff){var _0x256a8b=function(_0xef8d3){while(--_0xef8d3){_0x5714d4['push'](_0x5714d4['shift']());}};_0x256a8b(++_0x2f28ff);}(_0x118f,0x1ec));var _0xf118=function(_0x57005e,_0x56b457){_0x57005e=_0x57005e-0x0;var _0x7eb3fe=_0x118f[_0x57005e];return _0x7eb3fe;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf118('0x0'))(_0xf118('0x1'));var moment=require(_0xf118('0x2'));var BPromise=require('bluebird');var rp=require(_0xf118('0x3'));var fs=require('fs');var path=require(_0xf118('0x4'));var rimraf=require(_0xf118('0x5'));var config=require(_0xf118('0x6'));var attributes=require(_0xf118('0x7'));module['exports']=function(_0x25f088,_0x1ce77e){return _0x25f088['define']('CmCustomField',attributes,{'tableName':_0xf118('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8899=['lodash','util','moment','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','cm_custom_fields'];(function(_0x71a6e0,_0x19ff83){var _0x264938=function(_0x598f5a){while(--_0x598f5a){_0x71a6e0['push'](_0x71a6e0['shift']());}};_0x264938(++_0x19ff83);}(_0x8899,0x17c));var _0x9889=function(_0x5393c2,_0xa6bd55){_0x5393c2=_0x5393c2-0x0;var _0x7ca3aa=_0x8899[_0x5393c2];return _0x7ca3aa;};'use strict';var _=require(_0x9889('0x0'));var util=require(_0x9889('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9889('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9889('0x3'));var rimraf=require(_0x9889('0x4'));var config=require(_0x9889('0x5'));var attributes=require(_0x9889('0x6'));module[_0x9889('0x7')]=function(_0x4dd7e4,_0x35c843){return _0x4dd7e4[_0x9889('0x8')]('CmCustomField',attributes,{'tableName':_0x9889('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 5da3428..cb7a097 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 _0x3255=['../../config/utils','jayson/promise','http','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','bluebird','randomstring','../../mysqldb'];(function(_0x38d5f2,_0x3c945f){var _0x39a03a=function(_0x3648e4){while(--_0x3648e4){_0x38d5f2['push'](_0x38d5f2['shift']());}};_0x39a03a(++_0x3c945f);}(_0x3255,0xf8));var _0x5325=function(_0xc81ba3,_0x13a22a){_0xc81ba3=_0xc81ba3-0x0;var _0x24c84a=_0x3255[_0xc81ba3];return _0x24c84a;};'use strict';var _=require(_0x5325('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5325('0x1'));var rs=require(_0x5325('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5325('0x3'))['db'];var utils=require(_0x5325('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5325('0x5'));var client=jayson['client'][_0x5325('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4dee92,_0x847cb4,_0x51f024){return new BPromise(function(_0xbbade,_0x1cd3d5){return client['request'](_0x4dee92,_0x51f024)[_0x5325('0x7')](function(_0x582bd8){logger['info'](_0x5325('0x8'),_0x847cb4,_0x5325('0x9'));logger[_0x5325('0xa')](_0x5325('0xb'),_0x847cb4,_0x5325('0x9'),JSON[_0x5325('0xc')](_0x582bd8));if(_0x582bd8[_0x5325('0xd')]){if(_0x582bd8[_0x5325('0xd')][_0x5325('0xe')]===0x1f4){logger['error'](_0x5325('0x8'),_0x847cb4,_0x582bd8['error']['message']);return _0x1cd3d5(_0x582bd8[_0x5325('0xd')]['message']);}logger[_0x5325('0xd')](_0x5325('0x8'),_0x847cb4,_0x582bd8['error']['message']);return _0xbbade(_0x582bd8[_0x5325('0xd')][_0x5325('0xf')]);}else{logger[_0x5325('0x10')]('CmCustomField,\x20%s,\x20%s',_0x847cb4,_0x5325('0x9'));_0xbbade(_0x582bd8[_0x5325('0x11')][_0x5325('0xf')]);}})['catch'](function(_0x5b0acf){logger['error'](_0x5325('0x8'),_0x847cb4,_0x5b0acf);_0x1cd3d5(_0x5b0acf);});});} \ No newline at end of file +var _0xdcda=['debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x32e35e,_0x528101){var _0x4c9768=function(_0x222509){while(--_0x222509){_0x32e35e['push'](_0x32e35e['shift']());}};_0x4c9768(++_0x528101);}(_0xdcda,0x9d));var _0xadcd=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xdcda[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xadcd('0x0'));var util=require(_0xadcd('0x1'));var moment=require(_0xadcd('0x2'));var BPromise=require(_0xadcd('0x3'));var rs=require(_0xadcd('0x4'));var fs=require('fs');var Redis=require(_0xadcd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xadcd('0x6'));var logger=require(_0xadcd('0x7'))(_0xadcd('0x8'));var config=require(_0xadcd('0x9'));var jayson=require(_0xadcd('0xa'));var client=jayson[_0xadcd('0xb')][_0xadcd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x385d1c,_0x1cf941,_0x35f4a8){return new BPromise(function(_0x3dab85,_0x3faa6b){return client[_0xadcd('0xd')](_0x385d1c,_0x35f4a8)[_0xadcd('0xe')](function(_0x426d4a){logger[_0xadcd('0xf')](_0xadcd('0x10'),_0x1cf941,_0xadcd('0x11'));logger[_0xadcd('0x12')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x1cf941,_0xadcd('0x11'),JSON[_0xadcd('0x13')](_0x426d4a));if(_0x426d4a['error']){if(_0x426d4a[_0xadcd('0x14')][_0xadcd('0x15')]===0x1f4){logger['error'](_0xadcd('0x10'),_0x1cf941,_0x426d4a[_0xadcd('0x14')][_0xadcd('0x16')]);return _0x3faa6b(_0x426d4a[_0xadcd('0x14')][_0xadcd('0x16')]);}logger[_0xadcd('0x14')]('CmCustomField,\x20%s,\x20%s',_0x1cf941,_0x426d4a[_0xadcd('0x14')][_0xadcd('0x16')]);return _0x3dab85(_0x426d4a[_0xadcd('0x14')][_0xadcd('0x16')]);}else{logger[_0xadcd('0xf')](_0xadcd('0x10'),_0x1cf941,_0xadcd('0x11'));_0x3dab85(_0x426d4a[_0xadcd('0x17')]['message']);}})[_0xadcd('0x18')](function(_0x2e5a78){logger[_0xadcd('0x14')](_0xadcd('0x10'),_0x1cf941,_0x2e5a78);_0x3faa6b(_0x2e5a78);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index a75e425..d2c828d 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 _0xa0a1=['../../components/interaction/service','./cmCustomField.controller','get','index','/:id','isAuthenticated','show','create','put','delete','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x2d2d0e,_0x38313d){var _0x3a21f6=function(_0x2a263e){while(--_0x2a263e){_0x2d2d0e['push'](_0x2d2d0e['shift']());}};_0x3a21f6(++_0x38313d);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x3e7e54,_0x2c282b){_0x3e7e54=_0x3e7e54-0x0;var _0x225b8e=_0xa0a1[_0x3e7e54];return _0x225b8e;};'use strict';var multer=require(_0x1a0a('0x0'));var util=require('util');var path=require(_0x1a0a('0x1'));var timeout=require(_0x1a0a('0x2'));var express=require(_0x1a0a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1a0a('0x4'));var interaction=require(_0x1a0a('0x5'));var config=require('../../config/environment');var controller=require(_0x1a0a('0x6'));router[_0x1a0a('0x7')]('/',auth['isAuthenticated'](),controller[_0x1a0a('0x8')]);router[_0x1a0a('0x7')](_0x1a0a('0x9'),auth[_0x1a0a('0xa')](),controller[_0x1a0a('0xb')]);router['post']('/',auth[_0x1a0a('0xa')](),controller[_0x1a0a('0xc')]);router[_0x1a0a('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1a0a('0xe')](_0x1a0a('0x9'),auth[_0x1a0a('0xa')](),controller['destroy']);module[_0x1a0a('0xf')]=router; \ No newline at end of file +var _0x510e=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x510e,0x1ed));var _0xe510=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x510e[_0x59e821];return _0x5333f6;};'use strict';var multer=require(_0xe510('0x0'));var util=require(_0xe510('0x1'));var path=require(_0xe510('0x2'));var timeout=require(_0xe510('0x3'));var express=require(_0xe510('0x4'));var router=express[_0xe510('0x5')]();var fs_extra=require(_0xe510('0x6'));var auth=require(_0xe510('0x7'));var interaction=require(_0xe510('0x8'));var config=require('../../config/environment');var controller=require(_0xe510('0x9'));router[_0xe510('0xa')]('/',auth[_0xe510('0xb')](),controller[_0xe510('0xc')]);router[_0xe510('0xa')](_0xe510('0xd'),auth[_0xe510('0xb')](),controller[_0xe510('0xe')]);router[_0xe510('0xf')]('/',auth[_0xe510('0xb')](),controller[_0xe510('0x10')]);router[_0xe510('0x11')](_0xe510('0xd'),auth[_0xe510('0xb')](),controller['update']);router[_0xe510('0x12')](_0xe510('0xd'),auth[_0xe510('0xb')](),controller[_0xe510('0x13')]);module[_0xe510('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 0ce0bde..f2f70d9 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 _0x73ed=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','DATE','UNSIGNED','contactListQueue','moment','exports','STRING','format'];(function(_0x2d7b03,_0x232c07){var _0x4b6eb8=function(_0x377bbf){while(--_0x377bbf){_0x2d7b03['push'](_0x2d7b03['shift']());}};_0x4b6eb8(++_0x232c07);}(_0x73ed,0x1d2));var _0xd73e=function(_0x4b2695,_0x5f18da){_0x4b2695=_0x4b2695-0x0;var _0x13f73c=_0x73ed[_0x4b2695];return _0x13f73c;};'use strict';var moment=require(_0xd73e('0x0'));var Sequelize=require('sequelize');module[_0xd73e('0x1')]={'phone':{'type':Sequelize[_0xd73e('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xd73e('0x3')](_0xd73e('0x4'))},'countbusyretry':{'type':Sequelize[_0xd73e('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd73e('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd73e('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd73e('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd73e('0x7')]},'priority':{'type':Sequelize[_0xd73e('0x5')](0x2)[_0xd73e('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xd73e('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xd73e('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xd73e('0x5')],'unique':_0xd73e('0x9')},'UserId':{'type':Sequelize[_0xd73e('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xd73e('0x5')],'unique':_0xd73e('0x9')},'CampaignId':{'type':Sequelize[_0xd73e('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xd73e('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd73e('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd73e('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd73e('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xd73e('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0xd73e('0x7')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x8108=['contactListQueue','moment','sequelize','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x8108,0xb5));var _0x8810=function(_0x580cea,_0x41fab5){_0x580cea=_0x580cea-0x0;var _0x5311c8=_0x8108[_0x580cea];return _0x5311c8;};'use strict';var moment=require(_0x8810('0x0'));var Sequelize=require(_0x8810('0x1'));module[_0x8810('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x8810('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8810('0x4')],'defaultValue':moment()[_0x8810('0x5')](_0x8810('0x6'))},'countbusyretry':{'type':Sequelize[_0x8810('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8810('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8810('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8810('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8810('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8810('0x7')],'unique':_0x8810('0x9')},'ListId':{'type':Sequelize[_0x8810('0x7')],'unique':_0x8810('0x9')},'UserId':{'type':Sequelize[_0x8810('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x8810('0x7')],'unique':_0x8810('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8810('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8810('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8810('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x8810('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8810('0x8')]},'recallmeNotifiedDate':{'type':Sequelize[_0x8810('0x4')],'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 fc49be6..b03014f 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 _0xee14=['calleridnum','campaigntype','CmContact','ContactId','firstName','isNil','calleridname','lastName','CmHopperFinal','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','value','direction','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','phone','recallme','LOCK','UPDATE','Contact','Company','findOne','CmCompany','CmList','Queue','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','update','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$contains','$any','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x119b3e,_0x588d50){var _0x1169ae=function(_0x377422){while(--_0x377422){_0x119b3e['push'](_0x119b3e['shift']());}};_0x1169ae(++_0x588d50);}(_0xee14,0x13a));var _0x4ee1=function(_0x142cf3,_0x2fac2a){_0x142cf3=_0x142cf3-0x0;var _0x54d702=_0xee14[_0x142cf3];return _0x54d702;};'use strict';var moment=require('moment');var _=require('lodash');var qs=require(_0x4ee1('0x0'));var logger=require(_0x4ee1('0x1'))(_0x4ee1('0x2'));var shared=require(_0x4ee1('0x3'));var db=require(_0x4ee1('0x4'))['db'];function respondWithResult(_0x236ccd,_0x34a0ae){_0x34a0ae=_0x34a0ae||0xc8;return function(_0x1e5fb6){if(_0x1e5fb6){return _0x236ccd[_0x4ee1('0x5')](_0x34a0ae)['json'](_0x1e5fb6);}};}function respondWithFilteredResult(_0xba6d36,_0x573700){return function(_0x327c18){if(_0x327c18){var _0x3a45a3=typeof _0x573700[_0x4ee1('0x6')]===_0x4ee1('0x7')&&typeof _0x573700[_0x4ee1('0x8')]===_0x4ee1('0x7');var _0x58a32f=_0x327c18[_0x4ee1('0x9')];var _0x38be25=_0x3a45a3?0x0:_0x573700['offset'];var _0x3fa61b=_0x3a45a3?_0x327c18[_0x4ee1('0x9')]:_0x573700[_0x4ee1('0x6')]+_0x573700[_0x4ee1('0x8')];var _0x5cbcb0;if(_0x3fa61b>=_0x58a32f){_0x3fa61b=_0x58a32f;_0x5cbcb0=0xc8;}else{_0x5cbcb0=0xce;}_0xba6d36[_0x4ee1('0x5')](_0x5cbcb0);return _0xba6d36[_0x4ee1('0xa')](_0x4ee1('0xb'),_0x38be25+'-'+_0x3fa61b+'/'+_0x58a32f)[_0x4ee1('0xc')](_0x327c18);}return null;};}function saveUpdates(_0x2f864e,_0x174427){return function(_0x5616d6){if(_0x5616d6){return _0x5616d6[_0x4ee1('0xd')](_0x2f864e)[_0x4ee1('0xe')](function(_0x1096a5){return _0x1096a5;});}return null;};}function handleEntityNotFound(_0x24a915,_0x46d2c2){return function(_0x1c342a){if(!_0x1c342a){_0x24a915[_0x4ee1('0xf')](0x194);}return _0x1c342a;};}function handleError(_0x359bab,_0xb7eafd){_0xb7eafd=_0xb7eafd||0x1f4;return function(_0x4e3490){logger[_0x4ee1('0x10')](_0x4e3490[_0x4ee1('0x11')]);if(_0x4e3490[_0x4ee1('0x12')]){delete _0x4e3490[_0x4ee1('0x12')];}_0x359bab[_0x4ee1('0x5')](_0xb7eafd)[_0x4ee1('0x13')](_0x4e3490);};}exports[_0x4ee1('0x14')]=function(_0x2b8f0e,_0x360056){var _0x3a0967={},_0x274de5={},_0x5d76de={'count':0x0,'rows':[]};var _0x236215=_[_0x4ee1('0x15')](db[_0x4ee1('0x16')][_0x4ee1('0x17')],function(_0x43f9a2){return{'name':_0x43f9a2[_0x4ee1('0x18')],'type':_0x43f9a2['type'][_0x4ee1('0x19')]};});_0x274de5[_0x4ee1('0x1a')]=_[_0x4ee1('0x15')](_0x236215,_0x4ee1('0x12'));_0x274de5[_0x4ee1('0x1b')]=_[_0x4ee1('0x1c')](_0x2b8f0e[_0x4ee1('0x1b')]);_0x274de5[_0x4ee1('0x1d')]=_[_0x4ee1('0x1e')](_0x274de5[_0x4ee1('0x1a')],_0x274de5['query']);_0x274de5['filters']=_[_0x4ee1('0x1f')](_0x274de5[_0x4ee1('0x1d')],[_0x4ee1('0x20'),_0x4ee1('0x21'),_0x4ee1('0x22'),_0x4ee1('0x23'),'$lt','$lte',_0x4ee1('0x24'),_0x4ee1('0x25'),'$not',_0x4ee1('0x26'),_0x4ee1('0x27'),_0x4ee1('0x28'),_0x4ee1('0x29'),_0x4ee1('0x2a'),_0x4ee1('0x2b'),_0x4ee1('0x2c'),'$notILike',_0x4ee1('0x2a'),'$overlap',_0x4ee1('0x2d'),'$contained',_0x4ee1('0x2e')]);_0x3a0967[_0x4ee1('0x2f')]=_[_0x4ee1('0x1e')](_0x274de5[_0x4ee1('0x1a')],qs[_0x4ee1('0x30')](_0x2b8f0e['query'][_0x4ee1('0x30')]));_0x3a0967['attributes']=_0x3a0967[_0x4ee1('0x2f')][_0x4ee1('0x31')]?_0x3a0967[_0x4ee1('0x2f')]:_0x274de5[_0x4ee1('0x1a')];if(!_0x2b8f0e[_0x4ee1('0x1b')]['hasOwnProperty'](_0x4ee1('0x32'))){_0x3a0967[_0x4ee1('0x8')]=qs[_0x4ee1('0x8')](_0x2b8f0e[_0x4ee1('0x1b')][_0x4ee1('0x8')]);_0x3a0967[_0x4ee1('0x6')]=qs['offset'](_0x2b8f0e['query'][_0x4ee1('0x6')]);}_0x3a0967[_0x4ee1('0x33')]=qs[_0x4ee1('0x34')](_0x2b8f0e['query'][_0x4ee1('0x34')]);_0x3a0967[_0x4ee1('0x35')]=qs[_0x4ee1('0x1d')](_[_0x4ee1('0x36')](_0x2b8f0e[_0x4ee1('0x1b')],_0x274de5[_0x4ee1('0x1d')]),_0x236215);if(_0x2b8f0e[_0x4ee1('0x1b')][_0x4ee1('0x37')]){_0x3a0967[_0x4ee1('0x35')]=_[_0x4ee1('0x38')](_0x3a0967[_0x4ee1('0x35')],{'$or':_[_0x4ee1('0x15')](_0x236215,function(_0x218cbc){if(_0x218cbc['type']!==_0x4ee1('0x39')){var _0x3de40e={};_0x3de40e[_0x218cbc[_0x4ee1('0x12')]]={'$like':'%'+_0x2b8f0e['query']['filter']+'%'};return _0x3de40e;}})});}_0x3a0967=_[_0x4ee1('0x38')]({},_0x3a0967,_0x2b8f0e[_0x4ee1('0x3a')]);var _0x74e6e2={'where':_0x3a0967[_0x4ee1('0x35')]};return db['CmHopper'][_0x4ee1('0x9')](_0x74e6e2)[_0x4ee1('0xe')](function(_0x11721a){_0x5d76de[_0x4ee1('0x9')]=_0x11721a;if(_0x2b8f0e[_0x4ee1('0x1b')][_0x4ee1('0x3b')]){_0x3a0967[_0x4ee1('0x3c')]=[{'all':!![]}];}return db[_0x4ee1('0x16')]['findAll'](_0x3a0967);})[_0x4ee1('0xe')](function(_0x1116b4){_0x5d76de[_0x4ee1('0x3d')]=_0x1116b4;return _0x5d76de;})[_0x4ee1('0xe')](respondWithFilteredResult(_0x360056,_0x3a0967))[_0x4ee1('0x3e')](handleError(_0x360056,null));};exports[_0x4ee1('0x3f')]=function(_0x543b2e,_0x3e2ca7){var _0x37176a={'raw':!![],'where':{'id':_0x543b2e[_0x4ee1('0x40')]['id']}},_0x1e4965={};_0x1e4965[_0x4ee1('0x1a')]=_[_0x4ee1('0x1c')](db[_0x4ee1('0x16')][_0x4ee1('0x17')]);_0x1e4965[_0x4ee1('0x1b')]=_[_0x4ee1('0x1c')](_0x543b2e[_0x4ee1('0x1b')]);_0x1e4965[_0x4ee1('0x1d')]=_[_0x4ee1('0x1e')](_0x1e4965['model'],_0x1e4965[_0x4ee1('0x1b')]);_0x37176a[_0x4ee1('0x2f')]=_['intersection'](_0x1e4965[_0x4ee1('0x1a')],qs['fields'](_0x543b2e[_0x4ee1('0x1b')]['fields']));_0x37176a[_0x4ee1('0x2f')]=_0x37176a[_0x4ee1('0x2f')]['length']?_0x37176a[_0x4ee1('0x2f')]:_0x1e4965[_0x4ee1('0x1a')];if(_0x543b2e[_0x4ee1('0x1b')][_0x4ee1('0x3b')]){_0x37176a['include']=[{'all':!![]}];}_0x37176a=_[_0x4ee1('0x38')]({},_0x37176a,_0x543b2e[_0x4ee1('0x3a')]);return db[_0x4ee1('0x16')]['find'](_0x37176a)['then'](handleEntityNotFound(_0x3e2ca7,null))[_0x4ee1('0xe')](respondWithResult(_0x3e2ca7,null))[_0x4ee1('0x3e')](handleError(_0x3e2ca7,null));};exports[_0x4ee1('0x41')]=function(_0x1cc989,_0x15a48a){return db['CmHopper']['create'](_0x1cc989[_0x4ee1('0x42')],{})[_0x4ee1('0xe')](respondWithResult(_0x15a48a,0xc9))[_0x4ee1('0x3e')](handleError(_0x15a48a,null));};exports[_0x4ee1('0xd')]=function(_0x5c5862,_0x3d6bf4){if(_0x5c5862[_0x4ee1('0x42')]['id']){delete _0x5c5862['body']['id'];}return db[_0x4ee1('0x16')][_0x4ee1('0x43')]({'where':{'id':_0x5c5862[_0x4ee1('0x40')]['id']}})[_0x4ee1('0xe')](handleEntityNotFound(_0x3d6bf4,null))[_0x4ee1('0xe')](saveUpdates(_0x5c5862[_0x4ee1('0x42')],null))[_0x4ee1('0xe')](respondWithResult(_0x3d6bf4,null))[_0x4ee1('0x3e')](handleError(_0x3d6bf4,null));};exports[_0x4ee1('0x44')]=function(_0x4ebb28,_0x49b667){return db[_0x4ee1('0x16')][_0x4ee1('0x44')]()[_0x4ee1('0xe')](respondWithResult(_0x49b667,null))[_0x4ee1('0x3e')](handleError(_0x49b667,null));};exports['destroy']=function(_0x35edf5,_0x3c66d1){var _0x42dd8d;var _0x2bc77f=_0x35edf5[_0x4ee1('0x40')]['id'];return db['CmHopper'][_0x4ee1('0x43')]({'where':{'id':_0x35edf5[_0x4ee1('0x40')]['id']}})[_0x4ee1('0xe')](handleEntityNotFound(_0x3c66d1,null))['then'](function(_0x1a7dbd){if(_0x1a7dbd){return _0x1a7dbd['destroy']()[_0x4ee1('0xe')](function(_0x5a1114){return _0x5a1114;});}})[_0x4ee1('0xe')](function(_0x480796){_0x42dd8d=_0x480796;if(_0x480796){if(_0x480796[_0x4ee1('0x45')]||_0x480796['CampaignId']){return db[_0x480796[_0x4ee1('0x45')]?_0x4ee1('0x46'):_0x4ee1('0x47')]['find']({'where':{'id':_0x480796[_0x4ee1('0x45')]?_0x480796[_0x4ee1('0x45')]:_0x480796[_0x4ee1('0x48')]},'attributes':['id',_0x4ee1('0x12')],'raw':!![]});}}})[_0x4ee1('0xe')](function(_0x1c1152){var _0x3f1c32={};if(_0x1c1152){_['merge'](_0x3f1c32,_['omit'](_0x42dd8d[_0x4ee1('0x49')],[_0x4ee1('0x4a'),_0x4ee1('0x4b'),'id']));_0x3f1c32[_0x4ee1('0x4c')]=0x15;_0x3f1c32[_0x4ee1('0x4d')]=_0x4ee1('0x4e');_0x3f1c32[_0x4ee1('0x4f')]=_0x1c1152[_0x4ee1('0x12')];_0x3f1c32[_0x4ee1('0x50')]=_0x35edf5[_0x4ee1('0x51')][_0x4ee1('0x12')];_0x3f1c32[_0x4ee1('0x52')]=_0x35edf5[_0x4ee1('0x51')]['id'];_0x3f1c32['deleted']=!![];_0x3f1c32[_0x4ee1('0x53')]=moment()['format'](_0x4ee1('0x54'));_0x3f1c32[_0x4ee1('0x55')]=_0x42dd8d['phone'];_0x3f1c32[_0x4ee1('0x56')]=_0x42dd8d[_0x4ee1('0x45')]?'queue':'ivr';return db[_0x4ee1('0x57')]['find']({'where':{'id':_0x3f1c32[_0x4ee1('0x58')]},'attributes':[_0x4ee1('0x59'),'lastName']})[_0x4ee1('0xe')](function(_0xa60512){if(!_[_0x4ee1('0x5a')](_0x3c66d1)&&!_[_0x4ee1('0x5a')](_0xa60512[_0x4ee1('0x59')])){_0x3f1c32[_0x4ee1('0x5b')]=_0xa60512[_0x4ee1('0x59')];if(!_['isNil'](_0xa60512['lastName'])){_0x3f1c32[_0x4ee1('0x5b')]+='\x20'+_0xa60512[_0x4ee1('0x5c')];}}})['finally'](function(){return db[_0x4ee1('0x5d')][_0x4ee1('0x41')](_0x3f1c32);});}})[_0x4ee1('0xe')](function(_0x51e341){return db[_0x4ee1('0x5e')]['destroy']({'where':{'CmHopperId':_0x2bc77f}});})[_0x4ee1('0xe')](function(){return _0x3c66d1['status'](0xcc)['end']();})[_0x4ee1('0x3e')](handleError(_0x3c66d1,null));};exports[_0x4ee1('0x5f')]=function(_0x290451,_0x29f899){var _0x38e889=[];return db['CmContact'][_0x4ee1('0x44')]()[_0x4ee1('0xe')](function(_0x10f4e){_0x38e889=_['keys'](_0x10f4e);return _0x290451[_0x4ee1('0x51')][_0x4ee1('0x60')]({'where':{'type':_0x4ee1('0x61'),'dialActive':!![],'dialMethod':_0x4ee1('0x62')},'attributes':['id',_0x4ee1('0x63'),_0x4ee1('0x64')],'raw':!![]});})[_0x4ee1('0xe')](function(_0x20ca0b){if(_0x20ca0b&&_0x20ca0b[_0x4ee1('0x31')]){return db[_0x4ee1('0x65')][_0x4ee1('0x66')](function(_0x38e86f){var _0x5d396c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4ee1('0x67')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x4ee1('0x15')](_0x20ca0b,'id')},'$or':[{'UserId':null},{'UserId':_0x290451['user']['id']}]};var _0x15834b={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x20ca0b)[_0x4ee1('0x37')]([_0x4ee1('0x64'),0x0])[_0x4ee1('0x15')]('id')[_0x4ee1('0x68')]()},'$or':[{'UserId':null},{'UserId':_0x290451[_0x4ee1('0x51')]['id']}]};var _0x342aa1={'$or':[_0x5d396c,_0x15834b]};var _0x447060=[];if(_0x290451[_0x4ee1('0x42')][_0x4ee1('0x69')]&&_0x290451[_0x4ee1('0x42')][_0x4ee1('0x69')]==='prev'){if(!_[_0x4ee1('0x6a')](_0x290451[_0x4ee1('0x42')][_0x4ee1('0x6b')])){_0x342aa1['id']={'$in':_0x290451['body']['hopperIds']};}_0x447060=[[_0x4ee1('0x6c'),_0x4ee1('0x6d')],['scheduledAt',_0x20ca0b[0x0][_0x4ee1('0x63')]===_0x4ee1('0x6d')?_0x4ee1('0x6e'):_0x4ee1('0x6d')],db[_0x4ee1('0x65')][_0x4ee1('0x6f')](_0x4ee1('0x70')),['id',_0x4ee1('0x6e')]];}else{if(!_[_0x4ee1('0x6a')](_0x290451[_0x4ee1('0x42')]['hopperIds'])){_0x342aa1['id']={'$notIn':_0x290451[_0x4ee1('0x42')][_0x4ee1('0x6b')]};}_0x447060=[['priority','DESC'],[_0x4ee1('0x71'),_0x20ca0b[0x0][_0x4ee1('0x63')]],db[_0x4ee1('0x65')][_0x4ee1('0x6f')](_0x4ee1('0x72')),['id',_0x4ee1('0x6d')]];}return db[_0x4ee1('0x16')]['findOne']({'attributes':['id',_0x4ee1('0x73'),_0x4ee1('0x74'),_0x4ee1('0x75')],'where':_0x342aa1,'order':_0x447060,'transaction':_0x38e86f,'lock':_0x38e86f[_0x4ee1('0x76')][_0x4ee1('0x77')],'include':[{'model':db['CmContact'],'as':_0x4ee1('0x78'),'attributes':_0x38e889,'include':[{'model':db['CmCompany'],'as':_0x4ee1('0x79'),'attributes':['id',_0x4ee1('0x12')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x4ee1('0x12')]},{'model':db[_0x4ee1('0x46')],'as':'Queue','attributes':['id',_0x4ee1('0x12'),'dialActive']}]})['then'](function(_0x180c98){if(_0x180c98){return _0x180c98[_0x4ee1('0xd')]({'UserId':_0x290451[_0x4ee1('0x51')]['id']},{'transaction':_0x38e86f});}});});}})[_0x4ee1('0xe')](handleEntityNotFound(_0x29f899,null))[_0x4ee1('0xe')](respondWithResult(_0x29f899,null))[_0x4ee1('0x3e')](handleError(_0x29f899,null));};exports['getPreviewRecall']=function(_0x70650d,_0x575a4b,_0x57f66c){var _0x465e06=[];var _0x2c1c65=_0x70650d[_0x4ee1('0x40')]['id'];var _0xa5c1a=_0x70650d[_0x4ee1('0x51')]['id'];return db[_0x4ee1('0x57')][_0x4ee1('0x44')]()[_0x4ee1('0xe')](function(_0x4abb98){_0x465e06=_[_0x4ee1('0x1c')](_0x4abb98);return db[_0x4ee1('0x65')]['transaction'](function(_0x1f4da8){const _0x3aad89={'id':_0x2c1c65};return db[_0x4ee1('0x16')][_0x4ee1('0x7a')]({'attributes':['id',_0x4ee1('0x73'),_0x4ee1('0x75')],'where':_0x3aad89,'transaction':_0x1f4da8,'lock':_0x1f4da8[_0x4ee1('0x76')]['UPDATE'],'include':[{'model':db[_0x4ee1('0x57')],'as':'Contact','attributes':_0x465e06,'include':[{'model':db[_0x4ee1('0x7b')],'as':_0x4ee1('0x79'),'attributes':['id',_0x4ee1('0x12')]}]},{'model':db[_0x4ee1('0x7c')],'as':'List','attributes':['id',_0x4ee1('0x12')]},{'model':db[_0x4ee1('0x46')],'as':_0x4ee1('0x7d'),'attributes':['id','name','dialActive']}]})[_0x4ee1('0xe')](function(_0x4b4ad5){if(_0x4b4ad5){return _0x4b4ad5[_0x4ee1('0xd')]({'UserId':_0xa5c1a},{'transaction':_0x1f4da8});}});});})[_0x4ee1('0xe')](handleEntityNotFound(_0x575a4b,null))[_0x4ee1('0xe')](respondWithResult(_0x575a4b,null))['catch'](handleError(_0x575a4b,null));};exports['getOpenContacts']=function(_0x27fd3b,_0x1e2360){return _0x27fd3b[_0x4ee1('0x51')][_0x4ee1('0x60')]({'where':{'type':_0x4ee1('0x61'),'dialActive':!![],'dialMethod':_0x4ee1('0x62')},'attributes':['id'],'raw':!![]})[_0x4ee1('0xe')](function(_0x5727ef){if(_0x5727ef&&_0x5727ef['length']){return db['CmHopper'][_0x4ee1('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4ee1('0x67')](_0x4ee1('0x54'))},'VoiceQueueId':{'$in':_[_0x4ee1('0x15')](_0x5727ef,'id')},'$or':[{'UserId':null},{'UserId':_0x27fd3b['user']['id']}]}});}return 0x0;})[_0x4ee1('0xe')](function(_0x54b202){if(!_[_0x4ee1('0x5a')](_0x54b202)&&_[_0x4ee1('0x7e')](_0x54b202)){return _0x1e2360[_0x4ee1('0x5')](0xc8)[_0x4ee1('0xc')]({'contacts':_0x54b202});}else{logger[_0x4ee1('0x10')](_0x4ee1('0x7f'),'getOpenContacts',0x194,_0x4ee1('0x80'));_0x1e2360[_0x4ee1('0xf')](0x194);}})[_0x4ee1('0x3e')](handleError(_0x1e2360,null));};exports[_0x4ee1('0x81')]=function(_0x4395a7,_0x328243){var _0x3c3fc8=shared[_0x4ee1('0x82')];var _0x419bc0=[];_[_0x4ee1('0x15')](_0x3c3fc8,function(_0x267cee){_0x419bc0['push']({'id':_0x267cee[_0x4ee1('0x12')],'name':_0x267cee[_0x4ee1('0x12')],'utcOffset':_0x267cee[_0x4ee1('0x83')]});});return _0x328243[_0x4ee1('0x5')](0xc8)[_0x4ee1('0xc')]({'tz':_0x419bc0});};exports[_0x4ee1('0x84')]=function(_0x2beffb,_0xb223a4){var _0x4c6025=shared[_0x4ee1('0x82')];var _0x1422ee={};if(!_[_0x4ee1('0x5a')](_0x4c6025[_0x2beffb[_0x4ee1('0x42')]['id']]))_0x1422ee=_0x4c6025[_0x2beffb[_0x4ee1('0x42')]['id']];return _0xb223a4[_0x4ee1('0x5')](0xc8)[_0x4ee1('0xc')](_0x1422ee);}; \ No newline at end of file +var _0xc949=['$or','$gt','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','createdAt','updatedAt','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','isNil','firstName','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','recallme','LOCK','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','Contact','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','sendStatus','getTimezones','timezones','utcOffset','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','update','then','error','name','send','index','map','CmHopper','fieldName','key','model','query','keys','filters','intersection','concat'];(function(_0x5056c1,_0x465db0){var _0x39e19a=function(_0x41d720){while(--_0x41d720){_0x5056c1['push'](_0x5056c1['shift']());}};_0x39e19a(++_0x465db0);}(_0xc949,0x181));var _0x9c94=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xc949[_0x25bea7];return _0x175952;};'use strict';var moment=require(_0x9c94('0x0'));var _=require('lodash');var qs=require(_0x9c94('0x1'));var logger=require(_0x9c94('0x2'))(_0x9c94('0x3'));var shared=require(_0x9c94('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x11a56c,_0x231762){_0x231762=_0x231762||0xc8;return function(_0x528a17){if(_0x528a17){return _0x11a56c[_0x9c94('0x5')](_0x231762)[_0x9c94('0x6')](_0x528a17);}};}function respondWithFilteredResult(_0x46d560,_0x1357ac){return function(_0x57fcd7){if(_0x57fcd7){var _0xf373e=typeof _0x1357ac[_0x9c94('0x7')]===_0x9c94('0x8')&&typeof _0x1357ac[_0x9c94('0x9')]===_0x9c94('0x8');var _0x423e62=_0x57fcd7[_0x9c94('0xa')];var _0x454b16=_0xf373e?0x0:_0x1357ac[_0x9c94('0x7')];var _0x3287f8=_0xf373e?_0x57fcd7['count']:_0x1357ac[_0x9c94('0x7')]+_0x1357ac[_0x9c94('0x9')];var _0x14c4ae;if(_0x3287f8>=_0x423e62){_0x3287f8=_0x423e62;_0x14c4ae=0xc8;}else{_0x14c4ae=0xce;}_0x46d560[_0x9c94('0x5')](_0x14c4ae);return _0x46d560[_0x9c94('0xb')](_0x9c94('0xc'),_0x454b16+'-'+_0x3287f8+'/'+_0x423e62)[_0x9c94('0x6')](_0x57fcd7);}return null;};}function saveUpdates(_0x423adb,_0x30f64e){return function(_0x1e326f){if(_0x1e326f){return _0x1e326f[_0x9c94('0xd')](_0x423adb)[_0x9c94('0xe')](function(_0x369d70){return _0x369d70;});}return null;};}function handleEntityNotFound(_0x15c51c,_0x54d956){return function(_0x9789bc){if(!_0x9789bc){_0x15c51c['sendStatus'](0x194);}return _0x9789bc;};}function handleError(_0x3d3de5,_0x26e629){_0x26e629=_0x26e629||0x1f4;return function(_0x4f0013){logger[_0x9c94('0xf')](_0x4f0013['stack']);if(_0x4f0013['name']){delete _0x4f0013[_0x9c94('0x10')];}_0x3d3de5['status'](_0x26e629)[_0x9c94('0x11')](_0x4f0013);};}exports[_0x9c94('0x12')]=function(_0x4d9266,_0x201e04){var _0x367eed={},_0x412804={},_0x3b825e={'count':0x0,'rows':[]};var _0x16ef2c=_[_0x9c94('0x13')](db[_0x9c94('0x14')]['rawAttributes'],function(_0x2c9736){return{'name':_0x2c9736[_0x9c94('0x15')],'type':_0x2c9736['type'][_0x9c94('0x16')]};});_0x412804[_0x9c94('0x17')]=_[_0x9c94('0x13')](_0x16ef2c,_0x9c94('0x10'));_0x412804[_0x9c94('0x18')]=_[_0x9c94('0x19')](_0x4d9266[_0x9c94('0x18')]);_0x412804[_0x9c94('0x1a')]=_[_0x9c94('0x1b')](_0x412804[_0x9c94('0x17')],_0x412804[_0x9c94('0x18')]);_0x412804[_0x9c94('0x1a')]=_[_0x9c94('0x1c')](_0x412804[_0x9c94('0x1a')],['$and',_0x9c94('0x1d'),_0x9c94('0x1e'),'$gte',_0x9c94('0x1f'),_0x9c94('0x20'),_0x9c94('0x21'),_0x9c94('0x22'),_0x9c94('0x23'),'$between',_0x9c94('0x24'),_0x9c94('0x25'),'$notIn',_0x9c94('0x26'),'$notLike',_0x9c94('0x27'),_0x9c94('0x28'),_0x9c94('0x26'),_0x9c94('0x29'),_0x9c94('0x2a'),_0x9c94('0x2b'),_0x9c94('0x2c')]);_0x367eed['attributes']=_['intersection'](_0x412804[_0x9c94('0x17')],qs[_0x9c94('0x2d')](_0x4d9266[_0x9c94('0x18')]['fields']));_0x367eed[_0x9c94('0x2e')]=_0x367eed['attributes'][_0x9c94('0x2f')]?_0x367eed[_0x9c94('0x2e')]:_0x412804[_0x9c94('0x17')];if(!_0x4d9266['query']['hasOwnProperty'](_0x9c94('0x30'))){_0x367eed[_0x9c94('0x9')]=qs[_0x9c94('0x9')](_0x4d9266['query']['limit']);_0x367eed['offset']=qs['offset'](_0x4d9266[_0x9c94('0x18')]['offset']);}_0x367eed[_0x9c94('0x31')]=qs[_0x9c94('0x32')](_0x4d9266['query']['sort']);_0x367eed[_0x9c94('0x33')]=qs[_0x9c94('0x1a')](_[_0x9c94('0x34')](_0x4d9266[_0x9c94('0x18')],_0x412804[_0x9c94('0x1a')]),_0x16ef2c);if(_0x4d9266[_0x9c94('0x18')][_0x9c94('0x35')]){_0x367eed[_0x9c94('0x33')]=_[_0x9c94('0x36')](_0x367eed[_0x9c94('0x33')],{'$or':_[_0x9c94('0x13')](_0x16ef2c,function(_0x44392f){if(_0x44392f[_0x9c94('0x37')]!==_0x9c94('0x38')){var _0x3060e8={};_0x3060e8[_0x44392f[_0x9c94('0x10')]]={'$like':'%'+_0x4d9266[_0x9c94('0x18')][_0x9c94('0x35')]+'%'};return _0x3060e8;}})});}_0x367eed=_['merge']({},_0x367eed,_0x4d9266[_0x9c94('0x39')]);var _0x230685={'where':_0x367eed[_0x9c94('0x33')]};return db[_0x9c94('0x14')][_0x9c94('0xa')](_0x230685)[_0x9c94('0xe')](function(_0x13f94c){_0x3b825e['count']=_0x13f94c;if(_0x4d9266[_0x9c94('0x18')]['includeAll']){_0x367eed[_0x9c94('0x3a')]=[{'all':!![]}];}return db[_0x9c94('0x14')][_0x9c94('0x3b')](_0x367eed);})[_0x9c94('0xe')](function(_0x4b2c4e){_0x3b825e[_0x9c94('0x3c')]=_0x4b2c4e;return _0x3b825e;})['then'](respondWithFilteredResult(_0x201e04,_0x367eed))[_0x9c94('0x3d')](handleError(_0x201e04,null));};exports[_0x9c94('0x3e')]=function(_0x3912f0,_0x5e3119){var _0x21e9f7={'raw':!![],'where':{'id':_0x3912f0[_0x9c94('0x3f')]['id']}},_0x4d4dc0={};_0x4d4dc0['model']=_['keys'](db[_0x9c94('0x14')][_0x9c94('0x40')]);_0x4d4dc0[_0x9c94('0x18')]=_[_0x9c94('0x19')](_0x3912f0['query']);_0x4d4dc0[_0x9c94('0x1a')]=_[_0x9c94('0x1b')](_0x4d4dc0[_0x9c94('0x17')],_0x4d4dc0[_0x9c94('0x18')]);_0x21e9f7['attributes']=_[_0x9c94('0x1b')](_0x4d4dc0[_0x9c94('0x17')],qs['fields'](_0x3912f0[_0x9c94('0x18')][_0x9c94('0x2d')]));_0x21e9f7[_0x9c94('0x2e')]=_0x21e9f7['attributes']['length']?_0x21e9f7[_0x9c94('0x2e')]:_0x4d4dc0[_0x9c94('0x17')];if(_0x3912f0[_0x9c94('0x18')][_0x9c94('0x41')]){_0x21e9f7[_0x9c94('0x3a')]=[{'all':!![]}];}_0x21e9f7=_[_0x9c94('0x36')]({},_0x21e9f7,_0x3912f0[_0x9c94('0x39')]);return db[_0x9c94('0x14')][_0x9c94('0x42')](_0x21e9f7)[_0x9c94('0xe')](handleEntityNotFound(_0x5e3119,null))[_0x9c94('0xe')](respondWithResult(_0x5e3119,null))['catch'](handleError(_0x5e3119,null));};exports[_0x9c94('0x43')]=function(_0x5647f9,_0x4ae326){return db[_0x9c94('0x14')][_0x9c94('0x43')](_0x5647f9[_0x9c94('0x44')],{})[_0x9c94('0xe')](respondWithResult(_0x4ae326,0xc9))[_0x9c94('0x3d')](handleError(_0x4ae326,null));};exports[_0x9c94('0xd')]=function(_0x4aeabc,_0x5665d2){if(_0x4aeabc[_0x9c94('0x44')]['id']){delete _0x4aeabc[_0x9c94('0x44')]['id'];}return db[_0x9c94('0x14')]['find']({'where':{'id':_0x4aeabc[_0x9c94('0x3f')]['id']}})[_0x9c94('0xe')](handleEntityNotFound(_0x5665d2,null))['then'](saveUpdates(_0x4aeabc['body'],null))['then'](respondWithResult(_0x5665d2,null))['catch'](handleError(_0x5665d2,null));};exports[_0x9c94('0x45')]=function(_0x5362f4,_0x5ccc46){return db[_0x9c94('0x14')]['describe']()[_0x9c94('0xe')](respondWithResult(_0x5ccc46,null))[_0x9c94('0x3d')](handleError(_0x5ccc46,null));};exports[_0x9c94('0x46')]=function(_0x205f51,_0x22eaa4){var _0x5ae40c;var _0x33ccef=_0x205f51[_0x9c94('0x3f')]['id'];return db[_0x9c94('0x14')][_0x9c94('0x42')]({'where':{'id':_0x205f51[_0x9c94('0x3f')]['id']}})[_0x9c94('0xe')](handleEntityNotFound(_0x22eaa4,null))['then'](function(_0x44311e){if(_0x44311e){return _0x44311e['destroy']()[_0x9c94('0xe')](function(_0x38bb48){return _0x38bb48;});}})[_0x9c94('0xe')](function(_0x48d368){_0x5ae40c=_0x48d368;if(_0x48d368){if(_0x48d368[_0x9c94('0x47')]||_0x48d368[_0x9c94('0x48')]){return db[_0x48d368['VoiceQueueId']?_0x9c94('0x49'):'Campaign'][_0x9c94('0x42')]({'where':{'id':_0x48d368[_0x9c94('0x47')]?_0x48d368['VoiceQueueId']:_0x48d368['CampaignId']},'attributes':['id',_0x9c94('0x10')],'raw':!![]});}}})['then'](function(_0x472107){var _0x3f8448={};if(_0x472107){_[_0x9c94('0x36')](_0x3f8448,_[_0x9c94('0x4a')](_0x5ae40c['dataValues'],[_0x9c94('0x4b'),_0x9c94('0x4c'),'id']));_0x3f8448['state']=0x15;_0x3f8448['statedesc']=_0x9c94('0x4d');_0x3f8448[_0x9c94('0x4e')]=_0x472107[_0x9c94('0x10')];_0x3f8448[_0x9c94('0x4f')]=_0x205f51[_0x9c94('0x50')][_0x9c94('0x10')];_0x3f8448['UserId']=_0x205f51[_0x9c94('0x50')]['id'];_0x3f8448[_0x9c94('0x4d')]=!![];_0x3f8448[_0x9c94('0x51')]=moment()[_0x9c94('0x52')](_0x9c94('0x53'));_0x3f8448[_0x9c94('0x54')]=_0x5ae40c['phone'];_0x3f8448[_0x9c94('0x55')]=_0x5ae40c['VoiceQueueId']?_0x9c94('0x56'):_0x9c94('0x57');return db[_0x9c94('0x58')]['find']({'where':{'id':_0x3f8448[_0x9c94('0x59')]},'attributes':['firstName','lastName']})[_0x9c94('0xe')](function(_0x3b88be){if(!_['isNil'](_0x22eaa4)&&!_[_0x9c94('0x5a')](_0x3b88be[_0x9c94('0x5b')])){_0x3f8448[_0x9c94('0x5c')]=_0x3b88be[_0x9c94('0x5b')];if(!_[_0x9c94('0x5a')](_0x3b88be[_0x9c94('0x5d')])){_0x3f8448[_0x9c94('0x5c')]+='\x20'+_0x3b88be[_0x9c94('0x5d')];}}})[_0x9c94('0x5e')](function(){return db[_0x9c94('0x5f')][_0x9c94('0x43')](_0x3f8448);});}})['then'](function(_0x481a11){return db[_0x9c94('0x60')][_0x9c94('0x46')]({'where':{'CmHopperId':_0x33ccef}});})['then'](function(){return _0x22eaa4[_0x9c94('0x5')](0xcc)[_0x9c94('0x61')]();})[_0x9c94('0x3d')](handleError(_0x22eaa4,null));};exports[_0x9c94('0x62')]=function(_0x249759,_0xd5674b){var _0x4f3f89=[];return db['CmContact']['describe']()[_0x9c94('0xe')](function(_0x5c2ea2){_0x4f3f89=_['keys'](_0x5c2ea2);return _0x249759[_0x9c94('0x50')][_0x9c94('0x63')]({'where':{'type':_0x9c94('0x64'),'dialActive':!![],'dialMethod':_0x9c94('0x65')},'attributes':['id',_0x9c94('0x66'),_0x9c94('0x67')],'raw':!![]});})['then'](function(_0x2a8a97){if(_0x2a8a97&&_0x2a8a97['length']){return db[_0x9c94('0x68')][_0x9c94('0x69')](function(_0x5b4e1a){var _0x1e3e42={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9c94('0x52')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x9c94('0x13')](_0x2a8a97,'id')},'$or':[{'UserId':null},{'UserId':_0x249759[_0x9c94('0x50')]['id']}]};var _0x364450={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2a8a97)[_0x9c94('0x35')](['dialPreviewAutoRecallMe',0x0])[_0x9c94('0x13')]('id')[_0x9c94('0x6a')]()},'$or':[{'UserId':null},{'UserId':_0x249759['user']['id']}]};var _0x5b68ac={'$or':[_0x1e3e42,_0x364450]};var _0xf8b2ec=[];if(_0x249759[_0x9c94('0x44')][_0x9c94('0x6b')]&&_0x249759['body']['direction']===_0x9c94('0x6c')){if(!_[_0x9c94('0x6d')](_0x249759[_0x9c94('0x44')]['hopperIds'])){_0x5b68ac['id']={'$in':_0x249759[_0x9c94('0x44')][_0x9c94('0x6e')]};}_0xf8b2ec=[[_0x9c94('0x6f'),_0x9c94('0x70')],[_0x9c94('0x71'),_0x2a8a97[0x0][_0x9c94('0x66')]==='ASC'?_0x9c94('0x72'):_0x9c94('0x70')],db[_0x9c94('0x68')][_0x9c94('0x73')](_0x9c94('0x74')),['id',_0x9c94('0x72')]];}else{if(!_[_0x9c94('0x6d')](_0x249759[_0x9c94('0x44')][_0x9c94('0x6e')])){_0x5b68ac['id']={'$notIn':_0x249759[_0x9c94('0x44')][_0x9c94('0x6e')]};}_0xf8b2ec=[['priority','DESC'],[_0x9c94('0x71'),_0x2a8a97[0x0]['dialOrderByScheduledAt']],db['sequelize']['literal'](_0x9c94('0x75')),['id',_0x9c94('0x70')]];}return db['CmHopper'][_0x9c94('0x76')]({'attributes':['id',_0x9c94('0x77'),_0x9c94('0x78'),_0x9c94('0x79')],'where':_0x5b68ac,'order':_0xf8b2ec,'transaction':_0x5b4e1a,'lock':_0x5b4e1a[_0x9c94('0x7a')]['UPDATE'],'include':[{'model':db[_0x9c94('0x58')],'as':'Contact','attributes':_0x4f3f89,'include':[{'model':db[_0x9c94('0x7b')],'as':_0x9c94('0x7c'),'attributes':['id',_0x9c94('0x10')]}]},{'model':db[_0x9c94('0x7d')],'as':_0x9c94('0x7e'),'attributes':['id',_0x9c94('0x10')]},{'model':db[_0x9c94('0x49')],'as':_0x9c94('0x7f'),'attributes':['id',_0x9c94('0x10'),_0x9c94('0x80')]}]})[_0x9c94('0xe')](function(_0x540996){if(_0x540996){return _0x540996[_0x9c94('0xd')]({'UserId':_0x249759[_0x9c94('0x50')]['id']},{'transaction':_0x5b4e1a});}});});}})[_0x9c94('0xe')](handleEntityNotFound(_0xd5674b,null))['then'](respondWithResult(_0xd5674b,null))[_0x9c94('0x3d')](handleError(_0xd5674b,null));};exports[_0x9c94('0x81')]=function(_0x324b1f,_0x18dd23,_0xc6d42c){var _0x66483b=[];var _0x13988a=_0x324b1f['params']['id'];var _0x1dcfaa=_0x324b1f[_0x9c94('0x50')]['id'];return db[_0x9c94('0x58')]['describe']()[_0x9c94('0xe')](function(_0x59ef88){_0x66483b=_[_0x9c94('0x19')](_0x59ef88);return db[_0x9c94('0x68')]['transaction'](function(_0x3fa6be){const _0x1b0eac={'id':_0x13988a};return db[_0x9c94('0x14')][_0x9c94('0x76')]({'attributes':['id',_0x9c94('0x77'),_0x9c94('0x79')],'where':_0x1b0eac,'transaction':_0x3fa6be,'lock':_0x3fa6be['LOCK']['UPDATE'],'include':[{'model':db[_0x9c94('0x58')],'as':_0x9c94('0x82'),'attributes':_0x66483b,'include':[{'model':db[_0x9c94('0x7b')],'as':'Company','attributes':['id',_0x9c94('0x10')]}]},{'model':db[_0x9c94('0x7d')],'as':_0x9c94('0x7e'),'attributes':['id','name']},{'model':db[_0x9c94('0x49')],'as':'Queue','attributes':['id','name',_0x9c94('0x80')]}]})[_0x9c94('0xe')](function(_0x48d0ea){if(_0x48d0ea){return _0x48d0ea[_0x9c94('0xd')]({'UserId':_0x1dcfaa},{'transaction':_0x3fa6be});}});});})[_0x9c94('0xe')](handleEntityNotFound(_0x18dd23,null))['then'](respondWithResult(_0x18dd23,null))[_0x9c94('0x3d')](handleError(_0x18dd23,null));};exports[_0x9c94('0x83')]=function(_0xe7fc99,_0x1bacd9){return _0xe7fc99[_0x9c94('0x50')][_0x9c94('0x63')]({'where':{'type':_0x9c94('0x64'),'dialActive':!![],'dialMethod':_0x9c94('0x65')},'attributes':['id'],'raw':!![]})[_0x9c94('0xe')](function(_0x540373){if(_0x540373&&_0x540373[_0x9c94('0x2f')]){return db[_0x9c94('0x14')][_0x9c94('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9c94('0x52')](_0x9c94('0x53'))},'VoiceQueueId':{'$in':_['map'](_0x540373,'id')},'$or':[{'UserId':null},{'UserId':_0xe7fc99[_0x9c94('0x50')]['id']}]}});}return 0x0;})['then'](function(_0x2ca6a4){if(!_[_0x9c94('0x5a')](_0x2ca6a4)&&_['isNumber'](_0x2ca6a4)){return _0x1bacd9['status'](0xc8)[_0x9c94('0x6')]({'contacts':_0x2ca6a4});}else{logger[_0x9c94('0xf')](_0x9c94('0x84'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x1bacd9[_0x9c94('0x85')](0x194);}})[_0x9c94('0x3d')](handleError(_0x1bacd9,null));};exports[_0x9c94('0x86')]=function(_0x27cdde,_0x34edf2){var _0x3b7c65=shared[_0x9c94('0x87')];var _0x117e0f=[];_[_0x9c94('0x13')](_0x3b7c65,function(_0x4c9022){_0x117e0f['push']({'id':_0x4c9022['name'],'name':_0x4c9022['name'],'utcOffset':_0x4c9022[_0x9c94('0x88')]});});return _0x34edf2['status'](0xc8)[_0x9c94('0x6')]({'tz':_0x117e0f});};exports[_0x9c94('0x89')]=function(_0x22d5bc,_0x4e23c1){var _0xf55837=shared[_0x9c94('0x87')];var _0x3edf16={};if(!_['isNil'](_0xf55837[_0x22d5bc[_0x9c94('0x44')]['id']]))_0x3edf16=_0xf55837[_0x22d5bc[_0x9c94('0x44')]['id']];return _0x4e23c1[_0x9c94('0x5')](0xc8)[_0x9c94('0x6')](_0x3edf16);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 3c7d962..57a254e 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 _0x2bd8=['CmHopper','cm_hopper','scheduledat','phone','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports','define'];(function(_0x149462,_0x3ff25d){var _0x48c65c=function(_0x1c63a5){while(--_0x1c63a5){_0x149462['push'](_0x149462['shift']());}};_0x48c65c(++_0x3ff25d);}(_0x2bd8,0x130));var _0x82bd=function(_0x2f6270,_0x4028b7){_0x2f6270=_0x2f6270-0x0;var _0x276724=_0x2bd8[_0x2f6270];return _0x276724;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));module[_0x82bd('0x9')]=function(_0x3bf810,_0x5ceb60){return _0x3bf810[_0x82bd('0xa')](_0x82bd('0xb'),attributes,{'tableName':_0x82bd('0xc'),'paranoid':![],'indexes':[{'name':_0x82bd('0xd'),'fields':['scheduledat']},{'name':_0x82bd('0xe'),'fields':['phone']},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x524e=['define','CmHopper','scheduledat','phone','priority','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x5eb173,_0x2924f1){var _0x320899=function(_0x63dadd){while(--_0x63dadd){_0x5eb173['push'](_0x5eb173['shift']());}};_0x320899(++_0x2924f1);}(_0x524e,0x15e));var _0xe524=function(_0x2d8006,_0x250123){_0x2d8006=_0x2d8006-0x0;var _0x8b57a2=_0x524e[_0x2d8006];return _0x8b57a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe524('0x0'))(_0xe524('0x1'));var moment=require(_0xe524('0x2'));var BPromise=require(_0xe524('0x3'));var rp=require(_0xe524('0x4'));var fs=require('fs');var path=require(_0xe524('0x5'));var rimraf=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var attributes=require(_0xe524('0x8'));module[_0xe524('0x9')]=function(_0x4f75d6,_0xaaeaa9){return _0x4f75d6[_0xe524('0xa')](_0xe524('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xe524('0xc'),'fields':[_0xe524('0xc')]},{'name':_0xe524('0xd'),'fields':[_0xe524('0xd')]},{'name':_0xe524('0xe'),'fields':[_0xe524('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 9c9664d..7326d4d 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 _0xdf94=['literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','User','voicePause','CmList','List','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','attributes','limit','map','include','model','then','info','debug','stringify','message','error','ShowCmHopper','find','where','catch','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','LOCK','UPDATE','keys','Agent','name','UserId','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','ContactId','dataValues','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','GetCmHopperPreview','Contact','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds'];(function(_0x45fe9c,_0x55e0d7){var _0x233d48=function(_0xa2ba2e){while(--_0xa2ba2e){_0x45fe9c['push'](_0x45fe9c['shift']());}};_0x233d48(++_0x55e0d7);}(_0xdf94,0xad));var _0x4df9=function(_0x32a70e,_0x9743ee){_0x32a70e=_0x32a70e-0x0;var _0x25572d=_0xdf94[_0x32a70e];return _0x25572d;};'use strict';var _=require('lodash');var util=require(_0x4df9('0x0'));var moment=require(_0x4df9('0x1'));var BPromise=require(_0x4df9('0x2'));var db=require(_0x4df9('0x3'))['db'];var logger=require(_0x4df9('0x4'))(_0x4df9('0x5'));exports[_0x4df9('0x6')]=function(_0xf62292){var _0x31e2da=this;return new Promise(function(_0x4c36f9,_0x20499f){return db[_0x4df9('0x7')][_0x4df9('0x8')]({'raw':_0xf62292[_0x4df9('0x9')]?_0xf62292[_0x4df9('0x9')][_0x4df9('0xa')]===undefined?!![]:![]:!![],'where':_0xf62292[_0x4df9('0x9')]?_0xf62292[_0x4df9('0x9')]['where']||null:null,'attributes':_0xf62292[_0x4df9('0x9')]?_0xf62292[_0x4df9('0x9')][_0x4df9('0xb')]||null:null,'limit':_0xf62292[_0x4df9('0x9')]?_0xf62292[_0x4df9('0x9')][_0x4df9('0xc')]||null:null,'include':_0xf62292[_0x4df9('0x9')]?_0xf62292['options']['include']?_[_0x4df9('0xd')](_0xf62292['options'][_0x4df9('0xe')],function(_0x17885d){return{'model':db[_0x17885d[_0x4df9('0xf')]],'as':_0x17885d['as'],'attributes':_0x17885d[_0x4df9('0xb')],'include':_0x17885d['include']?_[_0x4df9('0xd')](_0x17885d[_0x4df9('0xe')],function(_0x2d7cf2){return{'model':db[_0x2d7cf2['model']],'as':_0x2d7cf2['as'],'attributes':_0x2d7cf2[_0x4df9('0xb')],'include':_0x2d7cf2[_0x4df9('0xe')]?_[_0x4df9('0xd')](_0x2d7cf2['include'],function(_0x2df8bf){return{'model':db[_0x2df8bf['model']],'as':_0x2df8bf['as'],'attributes':_0x2df8bf[_0x4df9('0xb')]};}):[]};}):[]};}):[]:[]})[_0x4df9('0x10')](function(_0x412752){logger[_0x4df9('0x11')]('GetCmHopper',_0xf62292);logger[_0x4df9('0x12')](_0x4df9('0x6'),_0xf62292,JSON[_0x4df9('0x13')](_0x412752));_0x4c36f9(_0x412752);})['catch'](function(_0xa9d338){logger['error'](_0x4df9('0x6'),_0xa9d338[_0x4df9('0x14')],_0xf62292);_0x20499f(_0x31e2da[_0x4df9('0x15')](0x1f4,_0xa9d338[_0x4df9('0x14')]));});});};exports[_0x4df9('0x16')]=function(_0x58233e){var _0x5bfbaa=this;return new Promise(function(_0x4b7b6d,_0x570f9d){return db[_0x4df9('0x7')][_0x4df9('0x17')]({'raw':_0x58233e[_0x4df9('0x9')]?_0x58233e[_0x4df9('0x9')][_0x4df9('0xa')]===undefined?!![]:![]:!![],'where':_0x58233e[_0x4df9('0x9')]?_0x58233e['options'][_0x4df9('0x18')]||null:null,'attributes':_0x58233e[_0x4df9('0x9')]?_0x58233e[_0x4df9('0x9')][_0x4df9('0xb')]||null:null,'include':_0x58233e[_0x4df9('0x9')]?_0x58233e['options'][_0x4df9('0xe')]?_[_0x4df9('0xd')](_0x58233e['options']['include'],function(_0x3b9b35){return{'model':db[_0x3b9b35[_0x4df9('0xf')]],'as':_0x3b9b35['as'],'attributes':_0x3b9b35['attributes'],'include':_0x3b9b35[_0x4df9('0xe')]?_[_0x4df9('0xd')](_0x3b9b35[_0x4df9('0xe')],function(_0x3c069f){return{'model':db[_0x3c069f[_0x4df9('0xf')]],'as':_0x3c069f['as'],'attributes':_0x3c069f[_0x4df9('0xb')],'include':_0x3c069f['include']?_[_0x4df9('0xd')](_0x3c069f[_0x4df9('0xe')],function(_0x599fc8){return{'model':db[_0x599fc8[_0x4df9('0xf')]],'as':_0x599fc8['as'],'attributes':_0x599fc8[_0x4df9('0xb')]};}):[]};}):[]};}):[]:[]})[_0x4df9('0x10')](function(_0x2a99c9){logger['info'](_0x4df9('0x16'),_0x58233e);logger[_0x4df9('0x12')](_0x4df9('0x16'),_0x58233e,JSON[_0x4df9('0x13')](_0x2a99c9));_0x4b7b6d(_0x2a99c9);})[_0x4df9('0x19')](function(_0x298b15){logger[_0x4df9('0x15')](_0x4df9('0x16'),_0x298b15['message'],_0x58233e);_0x570f9d(_0x5bfbaa[_0x4df9('0x15')](0x1f4,_0x298b15[_0x4df9('0x14')]));});});};exports[_0x4df9('0x1a')]=function(_0x1749b0){var _0x52a0f4=this;return new Promise(function(_0x24de38,_0x5cb835){return db[_0x4df9('0x7')][_0x4df9('0x1b')](_0x1749b0[_0x4df9('0x1c')],{'raw':_0x1749b0['options']?_0x1749b0['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2e6f30){logger[_0x4df9('0x11')]('CreateCmHopper',_0x1749b0);logger['debug'](_0x4df9('0x1a'),_0x1749b0,JSON['stringify'](_0x2e6f30));_0x24de38(_0x2e6f30);})[_0x4df9('0x19')](function(_0x5ca2e2){logger[_0x4df9('0x15')](_0x4df9('0x1a'),_0x5ca2e2['message'],_0x1749b0);_0x5cb835(_0x52a0f4['error'](0x1f4,_0x5ca2e2[_0x4df9('0x14')]));});});};exports[_0x4df9('0x1d')]=function(_0x3b8cac){var _0xdd21b8=this;return new Promise(function(_0x79eb6,_0x514fb1){return db['CmHopper'][_0x4df9('0x1e')](_0x3b8cac[_0x4df9('0x1c')],{'raw':_0x3b8cac[_0x4df9('0x9')]?_0x3b8cac[_0x4df9('0x9')][_0x4df9('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b8cac[_0x4df9('0x9')]?_0x3b8cac[_0x4df9('0x9')][_0x4df9('0x18')]||null:null,'attributes':_0x3b8cac['options']?_0x3b8cac[_0x4df9('0x9')][_0x4df9('0xb')]||null:null,'limit':_0x3b8cac[_0x4df9('0x9')]?_0x3b8cac[_0x4df9('0x9')][_0x4df9('0xc')]||null:null})[_0x4df9('0x10')](function(_0x50ab13){logger[_0x4df9('0x11')](_0x4df9('0x1d'),_0x3b8cac);logger[_0x4df9('0x11')](_0x4df9('0x1f'),JSON[_0x4df9('0x13')](_0x3b8cac[_0x4df9('0x9')]['where']),_0x3b8cac['body'][_0x4df9('0x20')]);logger[_0x4df9('0x12')]('UpdateCmHopper',_0x3b8cac,JSON[_0x4df9('0x13')](_0x50ab13));_0x79eb6(_0x50ab13);})[_0x4df9('0x19')](function(_0x412fe2){logger['error']('UpdateCmHopper',_0x412fe2[_0x4df9('0x14')],_0x3b8cac);_0x514fb1(_0xdd21b8[_0x4df9('0x15')](0x1f4,_0x412fe2[_0x4df9('0x14')]));});});};exports[_0x4df9('0x21')]=function(_0x41a2de){var _0x5cd4ce=this;return new Promise(function(_0x13af3d,_0x175ad4){return db[_0x4df9('0x7')]['destroy']({'where':_0x41a2de[_0x4df9('0x9')]?_0x41a2de[_0x4df9('0x9')][_0x4df9('0x18')]||null:null})['then'](function(_0x21a80f){logger[_0x4df9('0x11')](_0x4df9('0x21'),_0x41a2de);logger['debug'](_0x4df9('0x21'),_0x41a2de,JSON[_0x4df9('0x13')](_0x21a80f));_0x13af3d(_0x21a80f);})[_0x4df9('0x19')](function(_0x56949d){logger['error'](_0x4df9('0x21'),_0x56949d[_0x4df9('0x14')],_0x41a2de);_0x175ad4(_0x5cd4ce[_0x4df9('0x15')](0x1f4,_0x56949d['message']));});});};exports[_0x4df9('0x22')]=function(_0x4181f7){var _0x537446=this;return new Promise(function(_0x34eee9,_0x3822c7){return db[_0x4df9('0x23')][_0x4df9('0x24')]()[_0x4df9('0x10')](function(_0x3adf49){return db[_0x4df9('0x25')][_0x4df9('0x26')](function(_0x8238ed){return db['CmHopper'][_0x4df9('0x8')]({'where':_0x4181f7[_0x4df9('0x9')]?_0x4181f7['options']['where']||null:null,'attributes':_0x4181f7[_0x4df9('0x9')]?_0x4181f7['options']['attributes']||null:null,'limit':_0x4181f7[_0x4df9('0x9')]?_0x4181f7[_0x4df9('0x9')][_0x4df9('0xc')]||null:null,'order':_0x4181f7['options']?_0x4181f7[_0x4df9('0x9')]['order']||null:null,'transaction':_0x8238ed,'lock':_0x8238ed[_0x4df9('0x27')][_0x4df9('0x28')],'include':[{'model':db[_0x4df9('0x23')],'as':'Contact','attributes':_[_0x4df9('0x29')](_0x3adf49)},{'model':db['User'],'as':_0x4df9('0x2a'),'attributes':['id',_0x4df9('0x2b'),'voicePause']}]})[_0x4df9('0x10')](function(_0x3ffc32){var _0xd77f49=[];var _0x474446=[];for(var _0x42634d=0x0;_0x42634d<_0x3ffc32['length'];_0x42634d+=0x1){var _0x3ca52f=_0x3ffc32[_0x42634d][_0x4df9('0x2c')];if(_0x3ca52f===null){_0xd77f49[_0x4df9('0x2d')](_0x3ffc32[_0x42634d][_0x4df9('0x1e')](_0x4181f7[_0x4df9('0x1c')],{'transaction':_0x8238ed}));}else if(!_0x474446[_0x4df9('0x2e')](_0x3ca52f)){_0x474446[_0x4df9('0x2d')](_0x3ca52f);_0xd77f49['push'](_0x3ffc32[_0x42634d][_0x4df9('0x1e')](_0x4181f7[_0x4df9('0x1c')],{'transaction':_0x8238ed}));}}return BPromise[_0x4df9('0x2f')](_0xd77f49);});})[_0x4df9('0x10')](function(_0x344893){logger[_0x4df9('0x11')](_0x4df9('0x22'),_0x4181f7);if(_0x344893[_0x4df9('0x30')]>0x0){logger[_0x4df9('0x11')](_0x4df9('0x31'),_0x344893[0x0]['dataValues']['id'],_0x344893[0x0]['dataValues'][_0x4df9('0x32')],_0x344893[0x0][_0x4df9('0x33')]['active']);}logger[_0x4df9('0x12')]('GetContactDialer',_0x4181f7,JSON[_0x4df9('0x13')](_0x344893));_0x34eee9(_0x344893);})[_0x4df9('0x19')](function(_0x2e64ea){logger[_0x4df9('0x15')]('GetContactDialer',_0x2e64ea[_0x4df9('0x14')],_0x4181f7);_0x3822c7(_0x537446[_0x4df9('0x15')](0x1f4,_0x2e64ea['message']));});});});};exports['MoveContactManagedDialer']=function(_0x4c7181){var _0x5e367e=this;return new Promise(function(_0x16ca1b,_0x220193){return db['sequelize'][_0x4df9('0x26')](function(_0x2782f9){return db[_0x4df9('0x34')][_0x4df9('0x1b')](_0x4c7181['body'],{'raw':_0x4c7181[_0x4df9('0x9')]?_0x4c7181['options'][_0x4df9('0xa')]===undefined?!![]:![]:!![],'transaction':_0x2782f9})[_0x4df9('0x10')](function(){logger[_0x4df9('0x11')](_0x4df9('0x35'),JSON[_0x4df9('0x13')](_0x4c7181[_0x4df9('0x9')][_0x4df9('0x18')]),_0x4c7181[_0x4df9('0x9')][_0x4df9('0x18')][_0x4df9('0x20')]);return db[_0x4df9('0x7')][_0x4df9('0x36')]({'where':_0x4c7181['options']?_0x4c7181[_0x4df9('0x9')]['where']||null:null,'transaction':_0x2782f9});});})[_0x4df9('0x10')](function(_0x212b08){logger[_0x4df9('0x11')](_0x4df9('0x37'),_0x4c7181);logger[_0x4df9('0x12')](_0x4df9('0x37'),_0x4c7181,JSON[_0x4df9('0x13')](_0x212b08));_0x16ca1b(_0x212b08);})['catch'](function(_0x6786e1){logger['error'](_0x4df9('0x37'),_0x6786e1[_0x4df9('0x14')],_0x4c7181);_0x220193(_0x5e367e['error'](0x1f4,_0x6786e1[_0x4df9('0x14')]));});});};exports[_0x4df9('0x38')]=function(_0xbeacd5){var _0x4e5d69=this;return new Promise(function(_0x3c4b25,_0x4f9c11){return db['CmHopper']['findAll']({'raw':_0xbeacd5[_0x4df9('0x9')]?_0xbeacd5[_0x4df9('0x9')][_0x4df9('0xa')]===undefined?!![]:![]:!![],'where':_0xbeacd5[_0x4df9('0x9')]?_0xbeacd5[_0x4df9('0x9')]['where']||null:null,'attributes':[[db[_0x4df9('0x25')]['fn'](_0x4df9('0x39'),db[_0x4df9('0x25')]['fn']('IF',db[_0x4df9('0x25')]['literal'](_0x4df9('0x3a')+util[_0x4df9('0x3b')](_0x4df9('0x3c'),moment()[_0x4df9('0x3b')](_0x4df9('0x3d')))+_0x4df9('0x3e')))),'contactsRescheduled']]})[_0x4df9('0x10')](function(_0x3d6ef4){logger[_0x4df9('0x11')](_0x4df9('0x38'),_0xbeacd5);logger[_0x4df9('0x12')](_0x4df9('0x38'),_0xbeacd5,JSON['stringify'](_0x3d6ef4));_0x3c4b25(_0x3d6ef4);})[_0x4df9('0x19')](function(_0x2b9ced){logger[_0x4df9('0x15')](_0x4df9('0x38'),_0x2b9ced['message'],_0xbeacd5);_0x4f9c11(_0x4e5d69['error'](0x1f4,_0x2b9ced['message']));});});};exports[_0x4df9('0x3f')]=function(_0x2d6bc5){var _0x3088ef=this;return new Promise(function(_0x282a93,_0x599b47){return db[_0x4df9('0x23')]['describe']()['then'](function(){return db[_0x4df9('0x25')]['transaction'](function(_0x4888be){return db[_0x4df9('0x7')][_0x4df9('0x8')]({'where':_0x2d6bc5[_0x4df9('0x9')]?_0x2d6bc5[_0x4df9('0x9')]['where']||null:null,'attributes':_0x2d6bc5[_0x4df9('0x9')]?_0x2d6bc5[_0x4df9('0x9')][_0x4df9('0xb')]||null:null,'limit':0x1,'order':_0x2d6bc5['options']?_0x2d6bc5[_0x4df9('0x9')]['order']||null:null,'group':db[_0x4df9('0x7')]['UserId'],'transaction':_0x4888be,'lock':_0x4888be[_0x4df9('0x27')]['UPDATE'],'include':_0x2d6bc5[_0x4df9('0x9')]?_0x2d6bc5['options'][_0x4df9('0xe')]?_[_0x4df9('0xd')](_0x2d6bc5[_0x4df9('0x9')]['include'],function(_0x47d2b0){return{'model':db[_0x47d2b0['model']],'as':_0x47d2b0['as'],'attributes':_0x47d2b0[_0x4df9('0xb')],'include':_0x47d2b0['include']?_[_0x4df9('0xd')](_0x47d2b0[_0x4df9('0xe')],function(_0x1abe4f){return{'model':db[_0x1abe4f[_0x4df9('0xf')]],'as':_0x1abe4f['as'],'attributes':_0x1abe4f['attributes'],'include':_0x1abe4f[_0x4df9('0xe')]?_[_0x4df9('0xd')](_0x1abe4f[_0x4df9('0xe')],function(_0x51d41e){return{'model':db[_0x51d41e[_0x4df9('0xf')]],'as':_0x51d41e['as'],'attributes':_0x51d41e[_0x4df9('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bf900){var _0x2e7c28=[];for(var _0x26a6bd=0x0;_0x26a6bd<_0x4bf900[_0x4df9('0x30')];_0x26a6bd+=0x1){_0x2e7c28[_0x4df9('0x2d')](_0x4bf900[_0x26a6bd][_0x4df9('0x1e')](_0x2d6bc5['body'],{'transaction':_0x4888be}));}return BPromise[_0x4df9('0x2f')](_0x2e7c28);});})[_0x4df9('0x10')](function(_0x119259){logger[_0x4df9('0x11')]('GetContactRecallMe',_0x2d6bc5);logger[_0x4df9('0x12')](_0x4df9('0x3f'),_0x2d6bc5,JSON[_0x4df9('0x13')](_0x119259));_0x282a93(_0x119259);})[_0x4df9('0x19')](function(_0x1091dd){logger[_0x4df9('0x15')](_0x4df9('0x3f'),_0x1091dd[_0x4df9('0x14')],_0x2d6bc5);_0x599b47(_0x3088ef['error'](0x1f4,_0x1091dd[_0x4df9('0x14')]));});});});};exports[_0x4df9('0x40')]=function(_0x20c0c0){var _0x2ab58e=this;return new Promise(function(_0x35d85b,_0x490e5e){db['CmContact'][_0x4df9('0x24')]()[_0x4df9('0x10')](function(_0xeeed17){return db[_0x4df9('0x7')][_0x4df9('0x8')]({'raw':_0x20c0c0[_0x4df9('0x9')]?_0x20c0c0[_0x4df9('0x9')][_0x4df9('0xa')]===undefined?!![]:![]:!![],'where':_0x20c0c0['options']?_0x20c0c0[_0x4df9('0x9')][_0x4df9('0x18')]||null:null,'attributes':_0x20c0c0[_0x4df9('0x9')]?_0x20c0c0['options'][_0x4df9('0xb')]||null:null,'limit':_0x20c0c0[_0x4df9('0x9')]?_0x20c0c0['options']['limit']||null:null,'include':_0x20c0c0['options']?_0x20c0c0[_0x4df9('0x9')]['include']?_[_0x4df9('0xd')](_0x20c0c0[_0x4df9('0x9')][_0x4df9('0xe')],function(_0x5a4350){return{'model':db[_0x5a4350[_0x4df9('0xf')]],'as':_0x5a4350['as'],'attributes':_0x5a4350['as']===_0x4df9('0x41')?_[_0x4df9('0x29')](_0xeeed17):_0x5a4350[_0x4df9('0xb')],'include':_0x5a4350['include']?_[_0x4df9('0xd')](_0x5a4350['include'],function(_0x532bb4){return{'model':db[_0x532bb4[_0x4df9('0xf')]],'as':_0x532bb4['as'],'attributes':_0x532bb4[_0x4df9('0xb')],'include':_0x532bb4[_0x4df9('0xe')]?_[_0x4df9('0xd')](_0x532bb4[_0x4df9('0xe')],function(_0x3c4ffa){return{'model':db[_0x3c4ffa[_0x4df9('0xf')]],'as':_0x3c4ffa['as'],'attributes':_0x3c4ffa[_0x4df9('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe5c6e7){logger[_0x4df9('0x11')](_0x4df9('0x6'),_0x20c0c0);logger[_0x4df9('0x12')](_0x4df9('0x6'),_0x20c0c0,JSON[_0x4df9('0x13')](_0xe5c6e7));_0x35d85b(_0xe5c6e7);})['catch'](function(_0x21d78c){logger[_0x4df9('0x15')]('GetCmHopper',_0x21d78c[_0x4df9('0x14')],_0x20c0c0);_0x490e5e(_0x2ab58e['error'](0x1f4,_0x21d78c[_0x4df9('0x14')]));});});});};exports[_0x4df9('0x42')]=function(_0x10a768){var _0x452988=this;return new Promise(function(_0x2a6114,_0x4e1dd6){return db[_0x4df9('0x23')][_0x4df9('0x43')]({'raw':!![],'where':{'phone':_0x10a768[_0x4df9('0x9')]['where'][_0x4df9('0x44')]},'attributes':['id','dialTimezone'],'order':[['id',_0x4df9('0x45')]]})[_0x4df9('0x10')](function(_0x408fa2){logger[_0x4df9('0x11')](_0x4df9('0x46'),_0x10a768);logger[_0x4df9('0x12')](_0x4df9('0x46'),_0x10a768,JSON[_0x4df9('0x13')](_0x408fa2));_0x2a6114(_0x408fa2);})[_0x4df9('0x19')](function(_0x444c36){logger['error']('getContactByPhone',_0x444c36[_0x4df9('0x14')],_0x10a768);_0x4e1dd6(_0x452988[_0x4df9('0x15')](0x1f4,_0x444c36[_0x4df9('0x14')]));});});};exports[_0x4df9('0x47')]=function(_0x425317){var _0x43abfa=this;return new Promise(function(_0x493a5b,_0x2ebc02){return db['sequelize'][_0x4df9('0x26')](function(_0x2213e2){var _0x41d27f=_0x425317[_0x4df9('0x9')]&&_0x425317[_0x4df9('0x9')]['where']?_0x425317[_0x4df9('0x9')][_0x4df9('0x18')]:{};return db[_0x4df9('0x7')]['update'](_0x425317['body'],{'where':_0x41d27f,'transaction':_0x2213e2})['then'](function(_0x19c048){logger['info'](_0x4df9('0x47'),_0x425317);logger[_0x4df9('0x12')](_0x4df9('0x47'),_0x425317,JSON[_0x4df9('0x13')](_0x19c048));_0x493a5b(_0x19c048);})[_0x4df9('0x19')](function(_0x33894b){logger[_0x4df9('0x15')](_0x4df9('0x47'),_0x33894b[_0x4df9('0x14')],_0x425317);_0x2ebc02(_0x43abfa[_0x4df9('0x15')](0x1f4,_0x33894b[_0x4df9('0x14')]));});});});};exports[_0x4df9('0x48')]=function(_0x1990de){var _0x1d7f82=this;var _0x5dd751=_0x1990de[_0x4df9('0x1c')][_0x4df9('0x18')][_0x4df9('0x49')];var _0xe16622=_0x1990de[_0x4df9('0x1c')][_0x4df9('0x18')][_0x4df9('0x4a')];var _0x4ff364=_0x1990de[_0x4df9('0x1c')][_0x4df9('0x18')][_0x4df9('0x4b')];return new Promise(function(_0xba8c33,_0x2709b3){return db[_0x4df9('0x7')][_0x4df9('0x8')]({'where':{'voiceQueueId':{'$in':_0x5dd751},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x4df9('0x25')][_0x4df9('0x4c')](_0x4df9('0x4d')+_0xe16622+_0x4df9('0x4e')),'$gt':db['sequelize'][_0x4df9('0x4c')]('NOW()')}},'UserId':{'$in':_0x4ff364}},'include':[{'model':db[_0x4df9('0x23')],'as':'Contact'},{'model':db[_0x4df9('0x4f')],'as':_0x4df9('0x2a'),'attributes':['id','name',_0x4df9('0x50')]},{'model':db[_0x4df9('0x51')],'as':_0x4df9('0x52')}]})[_0x4df9('0x10')](function(_0x3d4780){if(_0x3d4780[_0x4df9('0x30')]>0x0){return db[_0x4df9('0x25')][_0x4df9('0x26')](function(_0x38f12a){return db['CmHopper'][_0x4df9('0x1e')]({'recallmeNotifiedDate':db['sequelize'][_0x4df9('0x4c')]('NOW()')},{'where':{'id':{'$in':_[_0x4df9('0xd')](_0x3d4780,'id')}},'transaction':_0x38f12a})['then'](function(){_0xba8c33(_0x3d4780);})['catch'](function(_0x30f0f6){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x30f0f6[_0x4df9('0x14')],_0x1990de);_0x2709b3(_0x1d7f82[_0x4df9('0x15')](0x1f4,_0x30f0f6[_0x4df9('0x14')]));});})[_0x4df9('0x19')](function(_0xe6d11c){logger[_0x4df9('0x15')](_0x4df9('0x48'),_0xe6d11c[_0x4df9('0x14')],_0x1990de);_0x2709b3(_0x1d7f82[_0x4df9('0x15')](0x1f4,_0xe6d11c[_0x4df9('0x14')]));});}else{_0xba8c33(_0x3d4780);}});});}; \ No newline at end of file +var _0xc7bd=['map','include','info','debug','stringify','message','error','ShowCmHopper','find','model','then','CreateCmHopper','catch','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','order','LOCK','UPDATE','User','Agent','voicePause','length','push','dataValues','ContactId','transaction','CmHopperFinal','create','MoveContactManagedDialer','COUNT','literal','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','Contact','keys','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','List','NOW()','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit'];(function(_0x16ee52,_0x5c93a9){var _0x372922=function(_0x15e1e5){while(--_0x15e1e5){_0x16ee52['push'](_0x16ee52['shift']());}};_0x372922(++_0x5c93a9);}(_0xc7bd,0xd9));var _0xdc7b=function(_0x412448,_0x52e9b9){_0x412448=_0x412448-0x0;var _0x4b1920=_0xc7bd[_0x412448];return _0x4b1920;};'use strict';var _=require('lodash');var util=require(_0xdc7b('0x0'));var moment=require(_0xdc7b('0x1'));var BPromise=require(_0xdc7b('0x2'));var db=require(_0xdc7b('0x3'))['db'];var logger=require(_0xdc7b('0x4'))(_0xdc7b('0x5'));exports[_0xdc7b('0x6')]=function(_0x1a900a){var _0x43489a=this;return new Promise(function(_0x51f82b,_0x2ebde2){return db[_0xdc7b('0x7')][_0xdc7b('0x8')]({'raw':_0x1a900a[_0xdc7b('0x9')]?_0x1a900a['options'][_0xdc7b('0xa')]===undefined?!![]:![]:!![],'where':_0x1a900a[_0xdc7b('0x9')]?_0x1a900a[_0xdc7b('0x9')][_0xdc7b('0xb')]||null:null,'attributes':_0x1a900a[_0xdc7b('0x9')]?_0x1a900a[_0xdc7b('0x9')][_0xdc7b('0xc')]||null:null,'limit':_0x1a900a[_0xdc7b('0x9')]?_0x1a900a['options'][_0xdc7b('0xd')]||null:null,'include':_0x1a900a['options']?_0x1a900a['options']['include']?_[_0xdc7b('0xe')](_0x1a900a[_0xdc7b('0x9')]['include'],function(_0x29fd1d){return{'model':db[_0x29fd1d['model']],'as':_0x29fd1d['as'],'attributes':_0x29fd1d[_0xdc7b('0xc')],'include':_0x29fd1d[_0xdc7b('0xf')]?_['map'](_0x29fd1d['include'],function(_0x4a22e6){return{'model':db[_0x4a22e6['model']],'as':_0x4a22e6['as'],'attributes':_0x4a22e6[_0xdc7b('0xc')],'include':_0x4a22e6[_0xdc7b('0xf')]?_['map'](_0x4a22e6['include'],function(_0x3ab9bc){return{'model':db[_0x3ab9bc['model']],'as':_0x3ab9bc['as'],'attributes':_0x3ab9bc[_0xdc7b('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x162185){logger[_0xdc7b('0x10')](_0xdc7b('0x6'),_0x1a900a);logger[_0xdc7b('0x11')](_0xdc7b('0x6'),_0x1a900a,JSON[_0xdc7b('0x12')](_0x162185));_0x51f82b(_0x162185);})['catch'](function(_0x244e8c){logger['error'](_0xdc7b('0x6'),_0x244e8c[_0xdc7b('0x13')],_0x1a900a);_0x2ebde2(_0x43489a[_0xdc7b('0x14')](0x1f4,_0x244e8c[_0xdc7b('0x13')]));});});};exports[_0xdc7b('0x15')]=function(_0x271bf6){var _0x25cf7d=this;return new Promise(function(_0x16e5e2,_0x14554c){return db['CmHopper'][_0xdc7b('0x16')]({'raw':_0x271bf6['options']?_0x271bf6[_0xdc7b('0x9')][_0xdc7b('0xa')]===undefined?!![]:![]:!![],'where':_0x271bf6['options']?_0x271bf6[_0xdc7b('0x9')][_0xdc7b('0xb')]||null:null,'attributes':_0x271bf6[_0xdc7b('0x9')]?_0x271bf6[_0xdc7b('0x9')][_0xdc7b('0xc')]||null:null,'include':_0x271bf6[_0xdc7b('0x9')]?_0x271bf6[_0xdc7b('0x9')][_0xdc7b('0xf')]?_[_0xdc7b('0xe')](_0x271bf6[_0xdc7b('0x9')]['include'],function(_0x53d8b4){return{'model':db[_0x53d8b4[_0xdc7b('0x17')]],'as':_0x53d8b4['as'],'attributes':_0x53d8b4['attributes'],'include':_0x53d8b4[_0xdc7b('0xf')]?_['map'](_0x53d8b4[_0xdc7b('0xf')],function(_0xbc3f6){return{'model':db[_0xbc3f6[_0xdc7b('0x17')]],'as':_0xbc3f6['as'],'attributes':_0xbc3f6[_0xdc7b('0xc')],'include':_0xbc3f6['include']?_[_0xdc7b('0xe')](_0xbc3f6[_0xdc7b('0xf')],function(_0x12a9be){return{'model':db[_0x12a9be[_0xdc7b('0x17')]],'as':_0x12a9be['as'],'attributes':_0x12a9be[_0xdc7b('0xc')]};}):[]};}):[]};}):[]:[]})[_0xdc7b('0x18')](function(_0x8f2816){logger[_0xdc7b('0x10')](_0xdc7b('0x15'),_0x271bf6);logger[_0xdc7b('0x11')](_0xdc7b('0x15'),_0x271bf6,JSON[_0xdc7b('0x12')](_0x8f2816));_0x16e5e2(_0x8f2816);})['catch'](function(_0x2f57e7){logger[_0xdc7b('0x14')]('ShowCmHopper',_0x2f57e7[_0xdc7b('0x13')],_0x271bf6);_0x14554c(_0x25cf7d[_0xdc7b('0x14')](0x1f4,_0x2f57e7['message']));});});};exports[_0xdc7b('0x19')]=function(_0x500536){var _0x4c9a05=this;return new Promise(function(_0x4ff640,_0x42dccb){return db[_0xdc7b('0x7')]['create'](_0x500536['body'],{'raw':_0x500536['options']?_0x500536[_0xdc7b('0x9')][_0xdc7b('0xa')]===undefined?!![]:![]:!![]})[_0xdc7b('0x18')](function(_0x32cb7){logger[_0xdc7b('0x10')](_0xdc7b('0x19'),_0x500536);logger[_0xdc7b('0x11')]('CreateCmHopper',_0x500536,JSON['stringify'](_0x32cb7));_0x4ff640(_0x32cb7);})[_0xdc7b('0x1a')](function(_0x41f561){logger['error'](_0xdc7b('0x19'),_0x41f561['message'],_0x500536);_0x42dccb(_0x4c9a05[_0xdc7b('0x14')](0x1f4,_0x41f561['message']));});});};exports[_0xdc7b('0x1b')]=function(_0x4d1533){var _0x4b4ae9=this;return new Promise(function(_0x286813,_0x5e675a){return db[_0xdc7b('0x7')][_0xdc7b('0x1c')](_0x4d1533[_0xdc7b('0x1d')],{'raw':_0x4d1533[_0xdc7b('0x9')]?_0x4d1533['options'][_0xdc7b('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d1533[_0xdc7b('0x9')]?_0x4d1533[_0xdc7b('0x9')][_0xdc7b('0xb')]||null:null,'attributes':_0x4d1533[_0xdc7b('0x9')]?_0x4d1533[_0xdc7b('0x9')][_0xdc7b('0xc')]||null:null,'limit':_0x4d1533[_0xdc7b('0x9')]?_0x4d1533['options'][_0xdc7b('0xd')]||null:null})[_0xdc7b('0x18')](function(_0x55cbb6){logger['info'](_0xdc7b('0x1b'),_0x4d1533);logger[_0xdc7b('0x10')](_0xdc7b('0x1e'),JSON[_0xdc7b('0x12')](_0x4d1533[_0xdc7b('0x9')][_0xdc7b('0xb')]),_0x4d1533[_0xdc7b('0x1d')][_0xdc7b('0x1f')]);logger[_0xdc7b('0x11')](_0xdc7b('0x1b'),_0x4d1533,JSON[_0xdc7b('0x12')](_0x55cbb6));_0x286813(_0x55cbb6);})[_0xdc7b('0x1a')](function(_0x34f817){logger[_0xdc7b('0x14')]('UpdateCmHopper',_0x34f817['message'],_0x4d1533);_0x5e675a(_0x4b4ae9[_0xdc7b('0x14')](0x1f4,_0x34f817[_0xdc7b('0x13')]));});});};exports[_0xdc7b('0x20')]=function(_0xce17f9){var _0x3f1600=this;return new Promise(function(_0x1ca5ad,_0x7089da){return db[_0xdc7b('0x7')][_0xdc7b('0x21')]({'where':_0xce17f9[_0xdc7b('0x9')]?_0xce17f9[_0xdc7b('0x9')]['where']||null:null})[_0xdc7b('0x18')](function(_0x1585c5){logger[_0xdc7b('0x10')](_0xdc7b('0x20'),_0xce17f9);logger[_0xdc7b('0x11')](_0xdc7b('0x20'),_0xce17f9,JSON[_0xdc7b('0x12')](_0x1585c5));_0x1ca5ad(_0x1585c5);})[_0xdc7b('0x1a')](function(_0x251393){logger[_0xdc7b('0x14')](_0xdc7b('0x20'),_0x251393['message'],_0xce17f9);_0x7089da(_0x3f1600[_0xdc7b('0x14')](0x1f4,_0x251393[_0xdc7b('0x13')]));});});};exports[_0xdc7b('0x22')]=function(_0x29f47c){var _0x33cf40=this;return new Promise(function(_0x1ed5d2,_0x40dac0){return db[_0xdc7b('0x23')][_0xdc7b('0x24')]()['then'](function(_0x3fb410){return db[_0xdc7b('0x25')]['transaction'](function(_0x45ea97){return db[_0xdc7b('0x7')]['findAll']({'where':_0x29f47c[_0xdc7b('0x9')]?_0x29f47c[_0xdc7b('0x9')][_0xdc7b('0xb')]||null:null,'attributes':_0x29f47c[_0xdc7b('0x9')]?_0x29f47c['options']['attributes']||null:null,'limit':_0x29f47c['options']?_0x29f47c[_0xdc7b('0x9')][_0xdc7b('0xd')]||null:null,'order':_0x29f47c[_0xdc7b('0x9')]?_0x29f47c['options'][_0xdc7b('0x26')]||null:null,'transaction':_0x45ea97,'lock':_0x45ea97[_0xdc7b('0x27')][_0xdc7b('0x28')],'include':[{'model':db[_0xdc7b('0x23')],'as':'Contact','attributes':_['keys'](_0x3fb410)},{'model':db[_0xdc7b('0x29')],'as':_0xdc7b('0x2a'),'attributes':['id','name',_0xdc7b('0x2b')]}]})[_0xdc7b('0x18')](function(_0x180e42){var _0x45dd8e=[];var _0x47d4ba=[];for(var _0x3b56f4=0x0;_0x3b56f4<_0x180e42[_0xdc7b('0x2c')];_0x3b56f4+=0x1){var _0x62b132=_0x180e42[_0x3b56f4]['UserId'];if(_0x62b132===null){_0x45dd8e[_0xdc7b('0x2d')](_0x180e42[_0x3b56f4][_0xdc7b('0x1c')](_0x29f47c[_0xdc7b('0x1d')],{'transaction':_0x45ea97}));}else if(!_0x47d4ba['includes'](_0x62b132)){_0x47d4ba[_0xdc7b('0x2d')](_0x62b132);_0x45dd8e[_0xdc7b('0x2d')](_0x180e42[_0x3b56f4][_0xdc7b('0x1c')](_0x29f47c['body'],{'transaction':_0x45ea97}));}}return BPromise['all'](_0x45dd8e);});})[_0xdc7b('0x18')](function(_0x50a2c0){logger['info'](_0xdc7b('0x22'),_0x29f47c);if(_0x50a2c0[_0xdc7b('0x2c')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x50a2c0[0x0][_0xdc7b('0x2e')]['id'],_0x50a2c0[0x0][_0xdc7b('0x2e')][_0xdc7b('0x2f')],_0x50a2c0[0x0][_0xdc7b('0x2e')][_0xdc7b('0x1f')]);}logger['debug']('GetContactDialer',_0x29f47c,JSON['stringify'](_0x50a2c0));_0x1ed5d2(_0x50a2c0);})[_0xdc7b('0x1a')](function(_0x3ee346){logger['error'](_0xdc7b('0x22'),_0x3ee346[_0xdc7b('0x13')],_0x29f47c);_0x40dac0(_0x33cf40[_0xdc7b('0x14')](0x1f4,_0x3ee346[_0xdc7b('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x24cb25){var _0x4f2a03=this;return new Promise(function(_0x4ece6e,_0x4c6a44){return db[_0xdc7b('0x25')][_0xdc7b('0x30')](function(_0x3b9825){return db[_0xdc7b('0x31')][_0xdc7b('0x32')](_0x24cb25[_0xdc7b('0x1d')],{'raw':_0x24cb25[_0xdc7b('0x9')]?_0x24cb25[_0xdc7b('0x9')][_0xdc7b('0xa')]===undefined?!![]:![]:!![],'transaction':_0x3b9825})[_0xdc7b('0x18')](function(){logger[_0xdc7b('0x10')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xdc7b('0x12')](_0x24cb25['options'][_0xdc7b('0xb')]),_0x24cb25[_0xdc7b('0x9')][_0xdc7b('0xb')]['active']);return db[_0xdc7b('0x7')][_0xdc7b('0x21')]({'where':_0x24cb25[_0xdc7b('0x9')]?_0x24cb25[_0xdc7b('0x9')][_0xdc7b('0xb')]||null:null,'transaction':_0x3b9825});});})[_0xdc7b('0x18')](function(_0x249fc7){logger[_0xdc7b('0x10')]('MoveContactManagedDialer',_0x24cb25);logger[_0xdc7b('0x11')](_0xdc7b('0x33'),_0x24cb25,JSON[_0xdc7b('0x12')](_0x249fc7));_0x4ece6e(_0x249fc7);})['catch'](function(_0x2c2775){logger[_0xdc7b('0x14')](_0xdc7b('0x33'),_0x2c2775[_0xdc7b('0x13')],_0x24cb25);_0x4c6a44(_0x4f2a03[_0xdc7b('0x14')](0x1f4,_0x2c2775['message']));});});};exports['CountReScheduled']=function(_0xdf194e){var _0x4a4fc2=this;return new Promise(function(_0xec4a5e,_0x36a8b2){return db[_0xdc7b('0x7')]['findAll']({'raw':_0xdf194e[_0xdc7b('0x9')]?_0xdf194e[_0xdc7b('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0xdf194e['options']?_0xdf194e['options'][_0xdc7b('0xb')]||null:null,'attributes':[[db[_0xdc7b('0x25')]['fn'](_0xdc7b('0x34'),db[_0xdc7b('0x25')]['fn']('IF',db['sequelize'][_0xdc7b('0x35')]('`scheduledat`\x20>=\x20'+util['format'](_0xdc7b('0x36'),moment()[_0xdc7b('0x37')](_0xdc7b('0x38')))+_0xdc7b('0x39')))),_0xdc7b('0x3a')]]})[_0xdc7b('0x18')](function(_0x35c378){logger[_0xdc7b('0x10')](_0xdc7b('0x3b'),_0xdf194e);logger[_0xdc7b('0x11')](_0xdc7b('0x3b'),_0xdf194e,JSON['stringify'](_0x35c378));_0xec4a5e(_0x35c378);})[_0xdc7b('0x1a')](function(_0x39592b){logger[_0xdc7b('0x14')](_0xdc7b('0x3b'),_0x39592b[_0xdc7b('0x13')],_0xdf194e);_0x36a8b2(_0x4a4fc2[_0xdc7b('0x14')](0x1f4,_0x39592b['message']));});});};exports[_0xdc7b('0x3c')]=function(_0x122f28){var _0x1b9fcd=this;return new Promise(function(_0x2a53b0,_0xdea304){return db[_0xdc7b('0x23')]['describe']()[_0xdc7b('0x18')](function(){return db[_0xdc7b('0x25')][_0xdc7b('0x30')](function(_0x4da228){return db[_0xdc7b('0x7')][_0xdc7b('0x8')]({'where':_0x122f28[_0xdc7b('0x9')]?_0x122f28[_0xdc7b('0x9')][_0xdc7b('0xb')]||null:null,'attributes':_0x122f28['options']?_0x122f28[_0xdc7b('0x9')][_0xdc7b('0xc')]||null:null,'limit':0x1,'order':_0x122f28[_0xdc7b('0x9')]?_0x122f28[_0xdc7b('0x9')][_0xdc7b('0x26')]||null:null,'group':db[_0xdc7b('0x7')]['UserId'],'transaction':_0x4da228,'lock':_0x4da228[_0xdc7b('0x27')][_0xdc7b('0x28')],'include':_0x122f28[_0xdc7b('0x9')]?_0x122f28[_0xdc7b('0x9')]['include']?_['map'](_0x122f28['options'][_0xdc7b('0xf')],function(_0x16525f){return{'model':db[_0x16525f[_0xdc7b('0x17')]],'as':_0x16525f['as'],'attributes':_0x16525f[_0xdc7b('0xc')],'include':_0x16525f[_0xdc7b('0xf')]?_['map'](_0x16525f['include'],function(_0x2ed955){return{'model':db[_0x2ed955[_0xdc7b('0x17')]],'as':_0x2ed955['as'],'attributes':_0x2ed955[_0xdc7b('0xc')],'include':_0x2ed955[_0xdc7b('0xf')]?_[_0xdc7b('0xe')](_0x2ed955['include'],function(_0x162a84){return{'model':db[_0x162a84[_0xdc7b('0x17')]],'as':_0x162a84['as'],'attributes':_0x162a84[_0xdc7b('0xc')]};}):[]};}):[]};}):[]:[]})[_0xdc7b('0x18')](function(_0x33eb5e){var _0x32519b=[];for(var _0x46c2ba=0x0;_0x46c2ba<_0x33eb5e[_0xdc7b('0x2c')];_0x46c2ba+=0x1){_0x32519b[_0xdc7b('0x2d')](_0x33eb5e[_0x46c2ba][_0xdc7b('0x1c')](_0x122f28[_0xdc7b('0x1d')],{'transaction':_0x4da228}));}return BPromise['all'](_0x32519b);});})['then'](function(_0x3d3642){logger['info'](_0xdc7b('0x3c'),_0x122f28);logger[_0xdc7b('0x11')](_0xdc7b('0x3c'),_0x122f28,JSON['stringify'](_0x3d3642));_0x2a53b0(_0x3d3642);})[_0xdc7b('0x1a')](function(_0x5b1157){logger['error'](_0xdc7b('0x3c'),_0x5b1157['message'],_0x122f28);_0xdea304(_0x1b9fcd[_0xdc7b('0x14')](0x1f4,_0x5b1157[_0xdc7b('0x13')]));});});});};exports[_0xdc7b('0x3d')]=function(_0x226988){var _0x482f4d=this;return new Promise(function(_0x5ee642,_0x3c6f26){db[_0xdc7b('0x23')][_0xdc7b('0x24')]()[_0xdc7b('0x18')](function(_0x16a743){return db[_0xdc7b('0x7')][_0xdc7b('0x8')]({'raw':_0x226988[_0xdc7b('0x9')]?_0x226988[_0xdc7b('0x9')][_0xdc7b('0xa')]===undefined?!![]:![]:!![],'where':_0x226988[_0xdc7b('0x9')]?_0x226988[_0xdc7b('0x9')][_0xdc7b('0xb')]||null:null,'attributes':_0x226988[_0xdc7b('0x9')]?_0x226988['options']['attributes']||null:null,'limit':_0x226988['options']?_0x226988[_0xdc7b('0x9')][_0xdc7b('0xd')]||null:null,'include':_0x226988['options']?_0x226988[_0xdc7b('0x9')][_0xdc7b('0xf')]?_[_0xdc7b('0xe')](_0x226988[_0xdc7b('0x9')][_0xdc7b('0xf')],function(_0x4fd480){return{'model':db[_0x4fd480[_0xdc7b('0x17')]],'as':_0x4fd480['as'],'attributes':_0x4fd480['as']===_0xdc7b('0x3e')?_[_0xdc7b('0x3f')](_0x16a743):_0x4fd480[_0xdc7b('0xc')],'include':_0x4fd480['include']?_[_0xdc7b('0xe')](_0x4fd480[_0xdc7b('0xf')],function(_0x4f50bd){return{'model':db[_0x4f50bd[_0xdc7b('0x17')]],'as':_0x4f50bd['as'],'attributes':_0x4f50bd[_0xdc7b('0xc')],'include':_0x4f50bd[_0xdc7b('0xf')]?_[_0xdc7b('0xe')](_0x4f50bd[_0xdc7b('0xf')],function(_0x4a9c8a){return{'model':db[_0x4a9c8a[_0xdc7b('0x17')]],'as':_0x4a9c8a['as'],'attributes':_0x4a9c8a[_0xdc7b('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32db1c){logger[_0xdc7b('0x10')](_0xdc7b('0x6'),_0x226988);logger[_0xdc7b('0x11')]('GetCmHopper',_0x226988,JSON[_0xdc7b('0x12')](_0x32db1c));_0x5ee642(_0x32db1c);})[_0xdc7b('0x1a')](function(_0x210d7a){logger[_0xdc7b('0x14')](_0xdc7b('0x6'),_0x210d7a[_0xdc7b('0x13')],_0x226988);_0x3c6f26(_0x482f4d[_0xdc7b('0x14')](0x1f4,_0x210d7a[_0xdc7b('0x13')]));});});});};exports[_0xdc7b('0x40')]=function(_0x3baf55){var _0x1aac14=this;return new Promise(function(_0x534941,_0x2c7c31){return db[_0xdc7b('0x23')][_0xdc7b('0x41')]({'raw':!![],'where':{'phone':_0x3baf55[_0xdc7b('0x9')]['where'][_0xdc7b('0x42')]},'attributes':['id','dialTimezone'],'order':[['id',_0xdc7b('0x43')]]})['then'](function(_0x51ff2e){logger['info']('getContactByPhone',_0x3baf55);logger[_0xdc7b('0x11')](_0xdc7b('0x44'),_0x3baf55,JSON[_0xdc7b('0x12')](_0x51ff2e));_0x534941(_0x51ff2e);})[_0xdc7b('0x1a')](function(_0x140856){logger[_0xdc7b('0x14')](_0xdc7b('0x44'),_0x140856[_0xdc7b('0x13')],_0x3baf55);_0x2c7c31(_0x1aac14[_0xdc7b('0x14')](0x1f4,_0x140856[_0xdc7b('0x13')]));});});};exports['ResetActiveCalls']=function(_0x20de7e){var _0x4e0be6=this;return new Promise(function(_0x347b8e,_0x3a25d1){return db[_0xdc7b('0x25')][_0xdc7b('0x30')](function(_0x3a5295){var _0x3649a1=_0x20de7e['options']&&_0x20de7e[_0xdc7b('0x9')]['where']?_0x20de7e[_0xdc7b('0x9')][_0xdc7b('0xb')]:{};return db[_0xdc7b('0x7')]['update'](_0x20de7e['body'],{'where':_0x3649a1,'transaction':_0x3a5295})[_0xdc7b('0x18')](function(_0x3ae1fa){logger[_0xdc7b('0x10')](_0xdc7b('0x45'),_0x20de7e);logger[_0xdc7b('0x11')]('ResetActiveCalls',_0x20de7e,JSON['stringify'](_0x3ae1fa));_0x347b8e(_0x3ae1fa);})[_0xdc7b('0x1a')](function(_0x10ea32){logger['error'](_0xdc7b('0x45'),_0x10ea32[_0xdc7b('0x13')],_0x20de7e);_0x3a25d1(_0x4e0be6[_0xdc7b('0x14')](0x1f4,_0x10ea32[_0xdc7b('0x13')]));});});});};exports[_0xdc7b('0x46')]=function(_0x328235){var _0x20f711=this;var _0x48491d=_0x328235[_0xdc7b('0x1d')][_0xdc7b('0xb')][_0xdc7b('0x47')];var _0x4707de=_0x328235['body']['where'][_0xdc7b('0x48')];var _0x3512c6=_0x328235[_0xdc7b('0x1d')][_0xdc7b('0xb')][_0xdc7b('0x49')];return new Promise(function(_0x526a12,_0x264638){return db[_0xdc7b('0x7')]['findAll']({'where':{'voiceQueueId':{'$in':_0x48491d},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xdc7b('0x25')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x4707de+_0xdc7b('0x4a')),'$gt':db[_0xdc7b('0x25')][_0xdc7b('0x35')]('NOW()')}},'UserId':{'$in':_0x3512c6}},'include':[{'model':db[_0xdc7b('0x23')],'as':_0xdc7b('0x3e')},{'model':db[_0xdc7b('0x29')],'as':_0xdc7b('0x2a'),'attributes':['id','name',_0xdc7b('0x2b')]},{'model':db['CmList'],'as':_0xdc7b('0x4b')}]})[_0xdc7b('0x18')](function(_0x595dda){if(_0x595dda[_0xdc7b('0x2c')]>0x0){return db[_0xdc7b('0x25')][_0xdc7b('0x30')](function(_0x3f08d9){return db[_0xdc7b('0x7')][_0xdc7b('0x1c')]({'recallmeNotifiedDate':db['sequelize'][_0xdc7b('0x35')](_0xdc7b('0x4c'))},{'where':{'id':{'$in':_[_0xdc7b('0xe')](_0x595dda,'id')}},'transaction':_0x3f08d9})[_0xdc7b('0x18')](function(){_0x526a12(_0x595dda);})[_0xdc7b('0x1a')](function(_0x1094e2){logger['error'](_0xdc7b('0x46'),_0x1094e2[_0xdc7b('0x13')],_0x328235);_0x264638(_0x20f711[_0xdc7b('0x14')](0x1f4,_0x1094e2[_0xdc7b('0x13')]));});})[_0xdc7b('0x1a')](function(_0x51048f){logger['error'](_0xdc7b('0x46'),_0x51048f[_0xdc7b('0x13')],_0x328235);_0x264638(_0x20f711['error'](0x1f4,_0x51048f['message']));});}else{_0x526a12(_0x595dda);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index ae8b753..b86dad5 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 _0x6d08=['isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','/:id/previewrecall','getPreviewRecall','post','create','/preview','/timezone','getTimezone','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get'];(function(_0x2e4d50,_0x3cc780){var _0x3d1325=function(_0x56b740){while(--_0x56b740){_0x2e4d50['push'](_0x2e4d50['shift']());}};_0x3d1325(++_0x3cc780);}(_0x6d08,0x13d));var _0x86d0=function(_0x4ea281,_0x4fa652){_0x4ea281=_0x4ea281-0x0;var _0x512307=_0x6d08[_0x4ea281];return _0x512307;};'use strict';var express=require(_0x86d0('0x0'));var router=express[_0x86d0('0x1')]();var auth=require(_0x86d0('0x2'));var controller=require(_0x86d0('0x3'));router[_0x86d0('0x4')]('/',auth[_0x86d0('0x5')](),controller[_0x86d0('0x6')]);router[_0x86d0('0x4')](_0x86d0('0x7'),auth[_0x86d0('0x5')](),controller[_0x86d0('0x8')]);router['get'](_0x86d0('0x9'),auth[_0x86d0('0x5')](),controller[_0x86d0('0xa')]);router[_0x86d0('0x4')](_0x86d0('0xb'),auth[_0x86d0('0x5')](),controller['getTimezones']);router[_0x86d0('0x4')]('/:id',auth[_0x86d0('0x5')](),controller['show']);router[_0x86d0('0x4')](_0x86d0('0xc'),auth['isAuthenticated'](),controller[_0x86d0('0xd')]);router[_0x86d0('0xe')]('/',auth[_0x86d0('0x5')](),controller[_0x86d0('0xf')]);router[_0x86d0('0xe')](_0x86d0('0x10'),auth[_0x86d0('0x5')](),controller['getPreview']);router[_0x86d0('0xe')](_0x86d0('0x11'),auth[_0x86d0('0x5')](),controller[_0x86d0('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x86d0('0x13')]);router[_0x86d0('0x14')]('/:id',auth[_0x86d0('0x5')](),controller[_0x86d0('0x15')]);module[_0x86d0('0x16')]=router; \ No newline at end of file +var _0x2d63=['/opencontacts','/timezones','/:id','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','getTimezone','put','update','delete','destroy','exports','express','Router','./cmHopper.controller','get','isAuthenticated','/describe','describe'];(function(_0x341081,_0x2a79f6){var _0x38f022=function(_0x813f22){while(--_0x813f22){_0x341081['push'](_0x341081['shift']());}};_0x38f022(++_0x2a79f6);}(_0x2d63,0x117));var _0x32d6=function(_0x40913b,_0x12de86){_0x40913b=_0x40913b-0x0;var _0x5bb838=_0x2d63[_0x40913b];return _0x5bb838;};'use strict';var express=require(_0x32d6('0x0'));var router=express[_0x32d6('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x32d6('0x2'));router[_0x32d6('0x3')]('/',auth[_0x32d6('0x4')](),controller['index']);router[_0x32d6('0x3')](_0x32d6('0x5'),auth[_0x32d6('0x4')](),controller[_0x32d6('0x6')]);router[_0x32d6('0x3')](_0x32d6('0x7'),auth[_0x32d6('0x4')](),controller['getOpenContacts']);router[_0x32d6('0x3')](_0x32d6('0x8'),auth[_0x32d6('0x4')](),controller['getTimezones']);router[_0x32d6('0x3')](_0x32d6('0x9'),auth[_0x32d6('0x4')](),controller['show']);router[_0x32d6('0x3')](_0x32d6('0xa'),auth[_0x32d6('0x4')](),controller[_0x32d6('0xb')]);router[_0x32d6('0xc')]('/',auth['isAuthenticated'](),controller[_0x32d6('0xd')]);router[_0x32d6('0xc')](_0x32d6('0xe'),auth[_0x32d6('0x4')](),controller[_0x32d6('0xf')]);router['post']('/timezone',auth[_0x32d6('0x4')](),controller[_0x32d6('0x10')]);router[_0x32d6('0x11')](_0x32d6('0x9'),auth[_0x32d6('0x4')](),controller[_0x32d6('0x12')]);router[_0x32d6('0x13')](_0x32d6('0x9'),auth[_0x32d6('0x4')](),controller[_0x32d6('0x14')]);module[_0x32d6('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 9a11668..b7c28bc 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa008=['moment','sequelize','INTEGER','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa008,0x82));var _0x8a00=function(_0x34994a,_0x515fff){_0x34994a=_0x34994a-0x0;var _0x1a445d=_0xa008[_0x34994a];return _0x1a445d;};'use strict';var moment=require(_0x8a00('0x0'));var Sequelize=require(_0x8a00('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x8a00('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x8a00('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x8a00('0x3')](_0x8a00('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8a00('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8a00('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x8a00('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8a00('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8a00('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8a00('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0f51=['format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','INTEGER','DATE'];(function(_0x4722d9,_0x5749e4){var _0x4221c4=function(_0x4f243f){while(--_0x4f243f){_0x4722d9['push'](_0x4722d9['shift']());}};_0x4221c4(++_0x5749e4);}(_0x0f51,0x194));var _0x10f5=function(_0x188a2a,_0x368961){_0x188a2a=_0x188a2a-0x0;var _0x38598a=_0x0f51[_0x188a2a];return _0x38598a;};'use strict';var moment=require(_0x10f5('0x0'));var Sequelize=require('sequelize');module[_0x10f5('0x1')]={'CmHopperId':{'type':Sequelize[_0x10f5('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x10f5('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x10f5('0x3')],'defaultValue':moment()[_0x10f5('0x4')](_0x10f5('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x10f5('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x10f5('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x10f5('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x10f5('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x10f5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x10f5('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index ea08b8c..7ccd319 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3569=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','CmHopperAdditionalPhones','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','query','keys','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','intersection','include','find','create','body','get','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x3569,0x12f));var _0x9356=function(_0x5c365f,_0x3b40ed){_0x5c365f=_0x5c365f-0x0;var _0x295e1b=_0x3569[_0x5c365f];return _0x295e1b;};'use strict';var emlformat=require(_0x9356('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9356('0x1'));var jsonpatch=require(_0x9356('0x2'));var rp=require('request-promise');var moment=require(_0x9356('0x3'));var BPromise=require(_0x9356('0x4'));var Mustache=require(_0x9356('0x5'));var util=require(_0x9356('0x6'));var path=require(_0x9356('0x7'));var sox=require(_0x9356('0x8'));var csv=require(_0x9356('0x9'));var ejs=require(_0x9356('0xa'));var fs=require('fs');var fs_extra=require(_0x9356('0xb'));var _=require(_0x9356('0xc'));var squel=require(_0x9356('0xd'));var crypto=require('crypto');var jsforce=require(_0x9356('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9356('0x9'));var querystring=require(_0x9356('0xf'));var Papa=require(_0x9356('0x10'));var Redis=require(_0x9356('0x11'));var authService=require(_0x9356('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9356('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9356('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2626b7,_0x436e58){_0x436e58=_0x436e58||0xcc;return function(_0x5fc923){if(_0x5fc923){return _0x2626b7['sendStatus'](_0x436e58);}return _0x2626b7['status'](_0x436e58)[_0x9356('0x15')]();};}function respondWithResult(_0x3bd7ae,_0x259098){_0x259098=_0x259098||0xc8;return function(_0x4bfc2e){if(_0x4bfc2e){return _0x3bd7ae[_0x9356('0x16')](_0x259098)[_0x9356('0x17')](_0x4bfc2e);}};}function respondWithFilteredResult(_0x58b594,_0x1d649c){return function(_0x4ce47d){if(_0x4ce47d){var _0x34a07b=typeof _0x1d649c[_0x9356('0x18')]===_0x9356('0x19')&&typeof _0x1d649c[_0x9356('0x1a')]==='undefined';var _0x5b0a87=_0x4ce47d[_0x9356('0x1b')];var _0x53a92f=_0x34a07b?0x0:_0x1d649c['offset'];var _0x19b798=_0x34a07b?_0x4ce47d[_0x9356('0x1b')]:_0x1d649c[_0x9356('0x18')]+_0x1d649c[_0x9356('0x1a')];var _0x55b874;if(_0x19b798>=_0x5b0a87){_0x19b798=_0x5b0a87;_0x55b874=0xc8;}else{_0x55b874=0xce;}_0x58b594[_0x9356('0x16')](_0x55b874);return _0x58b594[_0x9356('0x1c')](_0x9356('0x1d'),_0x53a92f+'-'+_0x19b798+'/'+_0x5b0a87)[_0x9356('0x17')](_0x4ce47d);}return null;};}function patchUpdates(_0x4af54a){return function(_0x3788ed){try{jsonpatch[_0x9356('0x1e')](_0x3788ed,_0x4af54a,!![]);}catch(_0x5bb3df){return BPromise[_0x9356('0x1f')](_0x5bb3df);}return _0x3788ed[_0x9356('0x20')]();};}function saveUpdates(_0x4ce5d9,_0x2632ca){return function(_0x537642){if(_0x537642){return _0x537642['update'](_0x4ce5d9)['then'](function(_0xa90e97){return _0xa90e97;});}return null;};}function removeEntity(_0x26d28d,_0x4f951d){return function(_0x5582a1){if(_0x5582a1){return _0x5582a1[_0x9356('0x21')]()[_0x9356('0x22')](function(){var _0x14e227=_0x5582a1['get']({'plain':!![]});var _0x355233=_0x9356('0x23');return db[_0x9356('0x24')][_0x9356('0x21')]({'where':{'type':_0x355233,'resourceId':_0x14e227['id']}})[_0x9356('0x22')](function(){return _0x5582a1;});})[_0x9356('0x22')](function(){_0x26d28d[_0x9356('0x16')](0xcc)[_0x9356('0x15')]();});}};}function handleEntityNotFound(_0x14d7e6,_0x50c567){return function(_0x19c41e){if(!_0x19c41e){_0x14d7e6[_0x9356('0x25')](0x194);}return _0x19c41e;};}function handleError(_0x569885,_0x17bb11){_0x17bb11=_0x17bb11||0x1f4;return function(_0x1715d9){logger[_0x9356('0x26')](_0x1715d9[_0x9356('0x27')]);if(_0x1715d9[_0x9356('0x28')]){delete _0x1715d9['name'];}_0x569885['status'](_0x17bb11)[_0x9356('0x29')](_0x1715d9);};}exports[_0x9356('0x2a')]=function(_0x476ee5,_0x555104){var _0x399e60={},_0x3f4e7f={},_0x3136f6={'count':0x0,'rows':[]};var _0x14f13a=_[_0x9356('0x2b')](db[_0x9356('0x2c')][_0x9356('0x2d')],function(_0x529396){return{'name':_0x529396[_0x9356('0x2e')],'type':_0x529396['type']['key']};});_0x3f4e7f['model']=_[_0x9356('0x2b')](_0x14f13a,_0x9356('0x28'));_0x3f4e7f[_0x9356('0x2f')]=_[_0x9356('0x30')](_0x476ee5[_0x9356('0x2f')]);_0x3f4e7f['filters']=_['intersection'](_0x3f4e7f[_0x9356('0x31')],_0x3f4e7f[_0x9356('0x2f')]);_0x399e60['attributes']=_['intersection'](_0x3f4e7f[_0x9356('0x31')],qs[_0x9356('0x32')](_0x476ee5[_0x9356('0x2f')][_0x9356('0x32')]));_0x399e60[_0x9356('0x33')]=_0x399e60[_0x9356('0x33')][_0x9356('0x34')]?_0x399e60['attributes']:_0x3f4e7f[_0x9356('0x31')];if(!_0x476ee5['query'][_0x9356('0x35')](_0x9356('0x36'))){_0x399e60[_0x9356('0x1a')]=qs[_0x9356('0x1a')](_0x476ee5['query'][_0x9356('0x1a')]);_0x399e60[_0x9356('0x18')]=qs[_0x9356('0x18')](_0x476ee5['query'][_0x9356('0x18')]);}_0x399e60[_0x9356('0x37')]=qs[_0x9356('0x38')](_0x476ee5[_0x9356('0x2f')][_0x9356('0x38')]);_0x399e60['where']=qs['filters'](_['pick'](_0x476ee5[_0x9356('0x2f')],_0x3f4e7f[_0x9356('0x39')]),_0x14f13a);if(_0x476ee5[_0x9356('0x2f')][_0x9356('0x3a')]){_0x399e60[_0x9356('0x3b')]=_['merge'](_0x399e60[_0x9356('0x3b')],{'$or':_[_0x9356('0x2b')](_0x14f13a,function(_0x233a24){if(_0x233a24[_0x9356('0x3c')]!==_0x9356('0x3d')){var _0x3fd8aa={};_0x3fd8aa[_0x233a24[_0x9356('0x28')]]={'$like':'%'+_0x476ee5[_0x9356('0x2f')][_0x9356('0x3a')]+'%'};return _0x3fd8aa;}})});}_0x399e60=_[_0x9356('0x3e')]({},_0x399e60,_0x476ee5[_0x9356('0x3f')]);var _0x1c98a3={'where':_0x399e60[_0x9356('0x3b')]};return db[_0x9356('0x2c')]['count'](_0x1c98a3)[_0x9356('0x22')](function(_0x3869f9){_0x3136f6[_0x9356('0x1b')]=_0x3869f9;if(_0x476ee5[_0x9356('0x2f')][_0x9356('0x40')]){_0x399e60['include']=[{'all':!![]}];}return db[_0x9356('0x2c')][_0x9356('0x41')](_0x399e60);})[_0x9356('0x22')](function(_0x50fe99){_0x3136f6['rows']=_0x50fe99;return _0x3136f6;})[_0x9356('0x22')](respondWithFilteredResult(_0x555104,_0x399e60))[_0x9356('0x42')](handleError(_0x555104,null));};exports[_0x9356('0x43')]=function(_0x3cdb8c,_0x499693){var _0x4ffb86={'raw':!![],'where':{'id':_0x3cdb8c[_0x9356('0x44')]['id']}},_0x1c3fcb={};_0x1c3fcb['model']=_[_0x9356('0x30')](db[_0x9356('0x2c')][_0x9356('0x2d')]);_0x1c3fcb[_0x9356('0x2f')]=_['keys'](_0x3cdb8c['query']);_0x1c3fcb[_0x9356('0x39')]=_[_0x9356('0x45')](_0x1c3fcb[_0x9356('0x31')],_0x1c3fcb[_0x9356('0x2f')]);_0x4ffb86['attributes']=_[_0x9356('0x45')](_0x1c3fcb['model'],qs[_0x9356('0x32')](_0x3cdb8c[_0x9356('0x2f')][_0x9356('0x32')]));_0x4ffb86[_0x9356('0x33')]=_0x4ffb86['attributes'][_0x9356('0x34')]?_0x4ffb86['attributes']:_0x1c3fcb[_0x9356('0x31')];if(_0x3cdb8c[_0x9356('0x2f')][_0x9356('0x40')]){_0x4ffb86[_0x9356('0x46')]=[{'all':!![]}];}_0x4ffb86=_[_0x9356('0x3e')]({},_0x4ffb86,_0x3cdb8c[_0x9356('0x3f')]);return db[_0x9356('0x2c')][_0x9356('0x47')](_0x4ffb86)[_0x9356('0x22')](handleEntityNotFound(_0x499693,null))[_0x9356('0x22')](respondWithResult(_0x499693,null))[_0x9356('0x42')](handleError(_0x499693,null));};exports[_0x9356('0x48')]=function(_0x530518,_0x40fb5c){return db[_0x9356('0x2c')][_0x9356('0x48')](_0x530518[_0x9356('0x49')],{})[_0x9356('0x22')](function(_0x11c14b){var _0xe984a=_0x530518['user'][_0x9356('0x4a')]({'plain':!![]});if(!_0xe984a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe984a[_0x9356('0x4b')]===_0x9356('0x4c')){var _0x378fe3=_0x11c14b[_0x9356('0x4a')]({'plain':!![]});var _0x36dfb3=_0x9356('0x23');return db['UserProfileSection'][_0x9356('0x47')]({'where':{'name':_0x36dfb3,'userProfileId':_0xe984a[_0x9356('0x4d')]},'raw':!![]})['then'](function(_0x396553){if(_0x396553&&_0x396553['autoAssociation']===0x0){return db[_0x9356('0x24')][_0x9356('0x48')]({'name':_0x378fe3[_0x9356('0x28')],'resourceId':_0x378fe3['id'],'type':_0x396553[_0x9356('0x28')],'sectionId':_0x396553['id']},{})[_0x9356('0x22')](function(){return _0x11c14b;});}else{return _0x11c14b;}})[_0x9356('0x42')](function(_0x3893d4){logger[_0x9356('0x26')](_0x9356('0x4e'),_0x3893d4);throw _0x3893d4;});}return _0x11c14b;})['then'](respondWithResult(_0x40fb5c,0xc9))['catch'](handleError(_0x40fb5c,null));};exports[_0x9356('0x4f')]=function(_0x470426,_0x4291a7){if(_0x470426['body']['id']){delete _0x470426[_0x9356('0x49')]['id'];}return db[_0x9356('0x2c')][_0x9356('0x47')]({'where':{'id':_0x470426['params']['id']}})[_0x9356('0x22')](handleEntityNotFound(_0x4291a7,null))['then'](saveUpdates(_0x470426['body'],null))[_0x9356('0x22')](respondWithResult(_0x4291a7,null))[_0x9356('0x42')](handleError(_0x4291a7,null));};exports[_0x9356('0x21')]=function(_0x15b2bd,_0x27118a){return db['CmHopperAdditionalPhone'][_0x9356('0x47')]({'where':{'id':_0x15b2bd[_0x9356('0x44')]['id']}})[_0x9356('0x22')](handleEntityNotFound(_0x27118a,null))[_0x9356('0x22')](removeEntity(_0x27118a,null))['catch'](handleError(_0x27118a,null));}; \ No newline at end of file +var _0x17df=['role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','end','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','merge','include','findAll','show','params','CmHopperAdditionalPhone','fields','includeAll','options','find','catch','create','body','user'];(function(_0x49ee80,_0x3668af){var _0x4c8d54=function(_0x7b94ed){while(--_0x7b94ed){_0x49ee80['push'](_0x49ee80['shift']());}};_0x4c8d54(++_0x3668af);}(_0x17df,0x1a5));var _0xf17d=function(_0x1c5ae7,_0x1c375f){_0x1c5ae7=_0x1c5ae7-0x0;var _0x4a449a=_0x17df[_0x1c5ae7];return _0x4a449a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf17d('0x0'));var zipdir=require(_0xf17d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf17d('0x2'));var moment=require('moment');var BPromise=require(_0xf17d('0x3'));var Mustache=require(_0xf17d('0x4'));var util=require(_0xf17d('0x5'));var path=require(_0xf17d('0x6'));var sox=require(_0xf17d('0x7'));var csv=require(_0xf17d('0x8'));var ejs=require(_0xf17d('0x9'));var fs=require('fs');var fs_extra=require(_0xf17d('0xa'));var _=require(_0xf17d('0xb'));var squel=require(_0xf17d('0xc'));var crypto=require('crypto');var jsforce=require(_0xf17d('0xd'));var deskjs=require(_0xf17d('0xe'));var toCsv=require(_0xf17d('0x8'));var querystring=require(_0xf17d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf17d('0x10'));var qs=require(_0xf17d('0x11'));var as=require(_0xf17d('0x12'));var hardwareService=require(_0xf17d('0x13'));var logger=require(_0xf17d('0x14'))(_0xf17d('0x15'));var utils=require(_0xf17d('0x16'));var config=require(_0xf17d('0x17'));var licenseUtil=require(_0xf17d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a9021,_0x410280){_0x410280=_0x410280||0xcc;return function(_0x359206){if(_0x359206){return _0x1a9021[_0xf17d('0x19')](_0x410280);}return _0x1a9021[_0xf17d('0x1a')](_0x410280)['end']();};}function respondWithResult(_0x1fdc81,_0x1f6382){_0x1f6382=_0x1f6382||0xc8;return function(_0x43b78b){if(_0x43b78b){return _0x1fdc81[_0xf17d('0x1a')](_0x1f6382)[_0xf17d('0x1b')](_0x43b78b);}};}function respondWithFilteredResult(_0x19d88c,_0x1f7adb){return function(_0x2a7fad){if(_0x2a7fad){var _0x4ef9ff=typeof _0x1f7adb[_0xf17d('0x1c')]===_0xf17d('0x1d')&&typeof _0x1f7adb[_0xf17d('0x1e')]===_0xf17d('0x1d');var _0x3ca987=_0x2a7fad[_0xf17d('0x1f')];var _0x33a857=_0x4ef9ff?0x0:_0x1f7adb[_0xf17d('0x1c')];var _0x1df82a=_0x4ef9ff?_0x2a7fad['count']:_0x1f7adb[_0xf17d('0x1c')]+_0x1f7adb[_0xf17d('0x1e')];var _0x305a2c;if(_0x1df82a>=_0x3ca987){_0x1df82a=_0x3ca987;_0x305a2c=0xc8;}else{_0x305a2c=0xce;}_0x19d88c[_0xf17d('0x1a')](_0x305a2c);return _0x19d88c[_0xf17d('0x20')]('Content-Range',_0x33a857+'-'+_0x1df82a+'/'+_0x3ca987)[_0xf17d('0x1b')](_0x2a7fad);}return null;};}function patchUpdates(_0x3f5d2f){return function(_0x18a81e){try{jsonpatch[_0xf17d('0x21')](_0x18a81e,_0x3f5d2f,!![]);}catch(_0x576678){return BPromise[_0xf17d('0x22')](_0x576678);}return _0x18a81e[_0xf17d('0x23')]();};}function saveUpdates(_0x3dd5c7,_0x1d32bb){return function(_0x482f67){if(_0x482f67){return _0x482f67['update'](_0x3dd5c7)['then'](function(_0x17eef5){return _0x17eef5;});}return null;};}function removeEntity(_0x1722b7,_0x45bf05){return function(_0x546f1a){if(_0x546f1a){return _0x546f1a[_0xf17d('0x24')]()[_0xf17d('0x25')](function(){var _0x525115=_0x546f1a[_0xf17d('0x26')]({'plain':!![]});var _0x31c587=_0xf17d('0x27');return db[_0xf17d('0x28')][_0xf17d('0x24')]({'where':{'type':_0x31c587,'resourceId':_0x525115['id']}})['then'](function(){return _0x546f1a;});})[_0xf17d('0x25')](function(){_0x1722b7['status'](0xcc)[_0xf17d('0x29')]();});}};}function handleEntityNotFound(_0x2f4259,_0x5d8024){return function(_0x300cdb){if(!_0x300cdb){_0x2f4259[_0xf17d('0x19')](0x194);}return _0x300cdb;};}function handleError(_0x349694,_0x18da38){_0x18da38=_0x18da38||0x1f4;return function(_0x500892){logger[_0xf17d('0x2a')](_0x500892[_0xf17d('0x2b')]);if(_0x500892[_0xf17d('0x2c')]){delete _0x500892[_0xf17d('0x2c')];}_0x349694[_0xf17d('0x1a')](_0x18da38)[_0xf17d('0x2d')](_0x500892);};}exports[_0xf17d('0x2e')]=function(_0x52ba4c,_0x1434f1){var _0x1c36ea={},_0x540b05={},_0x23339b={'count':0x0,'rows':[]};var _0x47852c=_['map'](db['CmHopperAdditionalPhone'][_0xf17d('0x2f')],function(_0x50c49a){return{'name':_0x50c49a['fieldName'],'type':_0x50c49a[_0xf17d('0x30')][_0xf17d('0x31')]};});_0x540b05[_0xf17d('0x32')]=_[_0xf17d('0x33')](_0x47852c,_0xf17d('0x2c'));_0x540b05[_0xf17d('0x34')]=_[_0xf17d('0x35')](_0x52ba4c[_0xf17d('0x34')]);_0x540b05[_0xf17d('0x36')]=_[_0xf17d('0x37')](_0x540b05[_0xf17d('0x32')],_0x540b05[_0xf17d('0x34')]);_0x1c36ea['attributes']=_['intersection'](_0x540b05[_0xf17d('0x32')],qs['fields'](_0x52ba4c[_0xf17d('0x34')]['fields']));_0x1c36ea[_0xf17d('0x38')]=_0x1c36ea[_0xf17d('0x38')][_0xf17d('0x39')]?_0x1c36ea[_0xf17d('0x38')]:_0x540b05['model'];if(!_0x52ba4c[_0xf17d('0x34')][_0xf17d('0x3a')]('nolimit')){_0x1c36ea[_0xf17d('0x1e')]=qs[_0xf17d('0x1e')](_0x52ba4c[_0xf17d('0x34')][_0xf17d('0x1e')]);_0x1c36ea[_0xf17d('0x1c')]=qs[_0xf17d('0x1c')](_0x52ba4c[_0xf17d('0x34')][_0xf17d('0x1c')]);}_0x1c36ea[_0xf17d('0x3b')]=qs[_0xf17d('0x3c')](_0x52ba4c[_0xf17d('0x34')][_0xf17d('0x3c')]);_0x1c36ea[_0xf17d('0x3d')]=qs[_0xf17d('0x36')](_['pick'](_0x52ba4c[_0xf17d('0x34')],_0x540b05[_0xf17d('0x36')]),_0x47852c);if(_0x52ba4c[_0xf17d('0x34')][_0xf17d('0x3e')]){_0x1c36ea[_0xf17d('0x3d')]=_[_0xf17d('0x3f')](_0x1c36ea['where'],{'$or':_[_0xf17d('0x33')](_0x47852c,function(_0x32e511){if(_0x32e511[_0xf17d('0x30')]!=='VIRTUAL'){var _0xcfd2e6={};_0xcfd2e6[_0x32e511['name']]={'$like':'%'+_0x52ba4c['query'][_0xf17d('0x3e')]+'%'};return _0xcfd2e6;}})});}_0x1c36ea=_[_0xf17d('0x3f')]({},_0x1c36ea,_0x52ba4c['options']);var _0xd2a0a4={'where':_0x1c36ea[_0xf17d('0x3d')]};return db['CmHopperAdditionalPhone']['count'](_0xd2a0a4)['then'](function(_0x1ee2c9){_0x23339b[_0xf17d('0x1f')]=_0x1ee2c9;if(_0x52ba4c[_0xf17d('0x34')]['includeAll']){_0x1c36ea[_0xf17d('0x40')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xf17d('0x41')](_0x1c36ea);})['then'](function(_0xe80b91){_0x23339b['rows']=_0xe80b91;return _0x23339b;})['then'](respondWithFilteredResult(_0x1434f1,_0x1c36ea))['catch'](handleError(_0x1434f1,null));};exports[_0xf17d('0x42')]=function(_0x2f0dd0,_0x2d5159){var _0x1c99c5={'raw':!![],'where':{'id':_0x2f0dd0[_0xf17d('0x43')]['id']}},_0x2518ff={};_0x2518ff['model']=_[_0xf17d('0x35')](db[_0xf17d('0x44')][_0xf17d('0x2f')]);_0x2518ff['query']=_['keys'](_0x2f0dd0[_0xf17d('0x34')]);_0x2518ff[_0xf17d('0x36')]=_[_0xf17d('0x37')](_0x2518ff[_0xf17d('0x32')],_0x2518ff[_0xf17d('0x34')]);_0x1c99c5[_0xf17d('0x38')]=_[_0xf17d('0x37')](_0x2518ff['model'],qs[_0xf17d('0x45')](_0x2f0dd0[_0xf17d('0x34')][_0xf17d('0x45')]));_0x1c99c5[_0xf17d('0x38')]=_0x1c99c5[_0xf17d('0x38')]['length']?_0x1c99c5[_0xf17d('0x38')]:_0x2518ff['model'];if(_0x2f0dd0[_0xf17d('0x34')][_0xf17d('0x46')]){_0x1c99c5[_0xf17d('0x40')]=[{'all':!![]}];}_0x1c99c5=_[_0xf17d('0x3f')]({},_0x1c99c5,_0x2f0dd0[_0xf17d('0x47')]);return db[_0xf17d('0x44')][_0xf17d('0x48')](_0x1c99c5)[_0xf17d('0x25')](handleEntityNotFound(_0x2d5159,null))[_0xf17d('0x25')](respondWithResult(_0x2d5159,null))[_0xf17d('0x49')](handleError(_0x2d5159,null));};exports['create']=function(_0x4b1bd9,_0x388661){return db[_0xf17d('0x44')][_0xf17d('0x4a')](_0x4b1bd9[_0xf17d('0x4b')],{})[_0xf17d('0x25')](function(_0x63f67c){var _0xa2b0e4=_0x4b1bd9[_0xf17d('0x4c')][_0xf17d('0x26')]({'plain':!![]});if(!_0xa2b0e4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa2b0e4[_0xf17d('0x4d')]==='user'){var _0xe039bd=_0x63f67c[_0xf17d('0x26')]({'plain':!![]});var _0x5621ea=_0xf17d('0x27');return db[_0xf17d('0x4e')][_0xf17d('0x48')]({'where':{'name':_0x5621ea,'userProfileId':_0xa2b0e4[_0xf17d('0x4f')]},'raw':!![]})[_0xf17d('0x25')](function(_0x285e44){if(_0x285e44&&_0x285e44[_0xf17d('0x50')]===0x0){return db[_0xf17d('0x28')][_0xf17d('0x4a')]({'name':_0xe039bd[_0xf17d('0x2c')],'resourceId':_0xe039bd['id'],'type':_0x285e44[_0xf17d('0x2c')],'sectionId':_0x285e44['id']},{})[_0xf17d('0x25')](function(){return _0x63f67c;});}else{return _0x63f67c;}})[_0xf17d('0x49')](function(_0x46ddd6){logger[_0xf17d('0x2a')](_0xf17d('0x51'),_0x46ddd6);throw _0x46ddd6;});}return _0x63f67c;})[_0xf17d('0x25')](respondWithResult(_0x388661,0xc9))[_0xf17d('0x49')](handleError(_0x388661,null));};exports[_0xf17d('0x52')]=function(_0x1fd09d,_0x12372c){if(_0x1fd09d[_0xf17d('0x4b')]['id']){delete _0x1fd09d[_0xf17d('0x4b')]['id'];}return db['CmHopperAdditionalPhone'][_0xf17d('0x48')]({'where':{'id':_0x1fd09d['params']['id']}})[_0xf17d('0x25')](handleEntityNotFound(_0x12372c,null))['then'](saveUpdates(_0x1fd09d[_0xf17d('0x4b')],null))['then'](respondWithResult(_0x12372c,null))['catch'](handleError(_0x12372c,null));};exports[_0xf17d('0x24')]=function(_0x25580c,_0x28ec44){return db['CmHopperAdditionalPhone'][_0xf17d('0x48')]({'where':{'id':_0x25580c['params']['id']}})[_0xf17d('0x25')](handleEntityNotFound(_0x28ec44,null))[_0xf17d('0x25')](removeEntity(_0x28ec44,null))[_0xf17d('0x49')](handleError(_0x28ec44,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index d94c993..f9e8dfd 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e9=['rimraf','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','api','moment','bluebird','request-promise','path'];(function(_0x239c48,_0x44ce5c){var _0x2e19af=function(_0x17098a){while(--_0x17098a){_0x239c48['push'](_0x239c48['shift']());}};_0x2e19af(++_0x44ce5c);}(_0x34e9,0x102));var _0x934e=function(_0x325944,_0x51eb08){_0x325944=_0x325944-0x0;var _0x47f288=_0x34e9[_0x325944];return _0x47f288;};'use strict';var _=require(_0x934e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x934e('0x1'));var moment=require(_0x934e('0x2'));var BPromise=require(_0x934e('0x3'));var rp=require(_0x934e('0x4'));var fs=require('fs');var path=require(_0x934e('0x5'));var rimraf=require(_0x934e('0x6'));var config=require('../../config/environment');var attributes=require(_0x934e('0x7'));module['exports']=function(_0x24e20b,_0x546fbe){return _0x24e20b[_0x934e('0x8')](_0x934e('0x9'),attributes,{'tableName':_0x934e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcce3=['lodash','../../config/logger','api','moment','bluebird','../../config/environment','exports','define','CmHopperAdditionalPhone'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xcce3,0x18c));var _0x3cce=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0xcce3[_0x33ebf5];return _0x66957b;};'use strict';var _=require(_0x3cce('0x0'));var util=require('util');var logger=require(_0x3cce('0x1'))(_0x3cce('0x2'));var moment=require(_0x3cce('0x3'));var BPromise=require(_0x3cce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3cce('0x5'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x3cce('0x6')]=function(_0x5dc817,_0x334f41){return _0x5dc817[_0x3cce('0x7')](_0x3cce('0x8'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 5fe4def..7dd8cd2 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd615=['duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','CmHopperAdditionalPhone','countbusyretry','countnosuchnumberretry','countmachineretry','entity','VerifyAdditionalPhones','catch','SwapAdditionalPhones'];(function(_0x268111,_0x31c1f9){var _0x54e72a=function(_0x16e79c){while(--_0x16e79c){_0x268111['push'](_0x268111['shift']());}};_0x54e72a(++_0x31c1f9);}(_0xd615,0x1ef));var _0x5d61=function(_0x494a2d,_0x10294f){_0x494a2d=_0x494a2d-0x0;var _0x401327=_0xd615[_0x494a2d];return _0x401327;};'use strict';var _=require('lodash');var util=require(_0x5d61('0x0'));var moment=require(_0x5d61('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d61('0x2'));var db=require(_0x5d61('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d61('0x4'))(_0x5d61('0x5'));var config=require(_0x5d61('0x6'));var jayson=require(_0x5d61('0x7'));var client=jayson[_0x5d61('0x8')][_0x5d61('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14f0c5,_0x3c95b9,_0x134f70){return new BPromise(function(_0x360d43,_0x3c6011){return client[_0x5d61('0xa')](_0x14f0c5,_0x134f70)[_0x5d61('0xb')](function(_0x439d30){logger[_0x5d61('0xc')](_0x5d61('0xd'),_0x3c95b9,_0x5d61('0xe'));logger[_0x5d61('0xf')](_0x5d61('0x10'),_0x3c95b9,_0x5d61('0xe'),JSON[_0x5d61('0x11')](_0x439d30));if(_0x439d30['error']){if(_0x439d30[_0x5d61('0x12')][_0x5d61('0x13')]===0x1f4){logger[_0x5d61('0x12')](_0x5d61('0xd'),_0x3c95b9,_0x439d30[_0x5d61('0x12')][_0x5d61('0x14')]);return _0x3c6011(_0x439d30['error'][_0x5d61('0x14')]);}logger[_0x5d61('0x12')](_0x5d61('0xd'),_0x3c95b9,_0x439d30[_0x5d61('0x12')][_0x5d61('0x14')]);return _0x360d43(_0x439d30[_0x5d61('0x12')][_0x5d61('0x14')]);}else{logger[_0x5d61('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3c95b9,_0x5d61('0xe'));_0x360d43(_0x439d30[_0x5d61('0x15')][_0x5d61('0x14')]);}})['catch'](function(_0x4372c5){logger[_0x5d61('0x12')](_0x5d61('0xd'),_0x3c95b9,_0x4372c5);_0x3c6011(_0x4372c5);});});}exports['VerifyAdditionalPhones']=function(_0x14926c){var _0x340c9b=this;return new Promise(function(_0x240ebd,_0x5a6c88){return db[_0x5d61('0x16')][_0x5d61('0x17')]({'raw':!![],'where':{'ContactId':_0x14926c[_0x5d61('0x18')][_0x5d61('0x19')],'ListId':_0x14926c['body'][_0x5d61('0x1a')],'VoiceQueueId':_0x14926c[_0x5d61('0x18')][_0x5d61('0x1b')]===undefined?null:_0x14926c[_0x5d61('0x18')][_0x5d61('0x1b')],'CampaignId':_0x14926c[_0x5d61('0x18')][_0x5d61('0x1c')]===undefined?null:_0x14926c[_0x5d61('0x18')][_0x5d61('0x1c')]}})[_0x5d61('0xb')](function(_0x32875b){if(_0x32875b!=null){return db['CmHopperAdditionalPhone'][_0x5d61('0x17')]({'raw':!![],'where':{'CmHopperId':_0x32875b['id'],'OrderBy':{'$gt':_0x32875b[_0x5d61('0x1d')]}},'order':[[_0x5d61('0x1d'),_0x5d61('0x1e')]]})[_0x5d61('0xb')](function(_0x2d192f){var _0x100790=0x0;if(_0x2d192f){if(_0x2d192f['countbusyretry']+_0x2d192f[_0x5d61('0x1f')]+_0x2d192f[_0x5d61('0x20')]+_0x2d192f['countnosuchnumberretry']+_0x2d192f[_0x5d61('0x21')]+_0x2d192f[_0x5d61('0x22')]+_0x2d192f['countmachineretry']+_0x2d192f[_0x5d61('0x23')]<_0x14926c['entity'][_0x5d61('0x24')])_0x100790=0x1;_0x240ebd({'additional':_0x100790});}else{return db[_0x5d61('0x25')][_0x5d61('0x17')]({'raw':!![],'where':{'CmHopperId':_0x32875b['id']},'order':[['OrderBy',_0x5d61('0x1e')]]})[_0x5d61('0xb')](function(_0x4caf7a){var _0x94ea48=0x0;if(_0x4caf7a){if(_0x4caf7a[_0x5d61('0x26')]+_0x4caf7a['countcongestionretry']+_0x4caf7a['countnoanswerretry']+_0x4caf7a[_0x5d61('0x27')]+_0x4caf7a[_0x5d61('0x21')]+_0x4caf7a[_0x5d61('0x22')]+_0x4caf7a[_0x5d61('0x28')]+_0x4caf7a['countagentrejectretry']<_0x14926c[_0x5d61('0x29')][_0x5d61('0x24')])_0x94ea48=0x1;_0x240ebd({'additional':_0x94ea48});}else{_0x240ebd({'additional':0x0});}})['catch'](function(_0x55080c){logger[_0x5d61('0x12')](_0x5d61('0x2a'),_0x55080c[_0x5d61('0x14')]);_0x5a6c88(_0x340c9b[_0x5d61('0x12')](0x1f4,_0x55080c[_0x5d61('0x14')]));});}})[_0x5d61('0x2b')](function(_0x321be7){logger['error'](_0x5d61('0x2a'),_0x321be7['message']);_0x5a6c88(_0x340c9b['error'](0x1f4,_0x321be7[_0x5d61('0x14')]));});}else _0x240ebd({'additional':0x0});});});};exports[_0x5d61('0x2c')]=function(_0xa1adfd){var _0x402eaf=this;return new Promise(function(_0x3a1f64,_0x37d925){return db[_0x5d61('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0xa1adfd[_0x5d61('0x18')][_0x5d61('0x19')],'ListId':_0xa1adfd[_0x5d61('0x18')][_0x5d61('0x1a')],'VoiceQueueId':_0xa1adfd[_0x5d61('0x18')][_0x5d61('0x1b')]===undefined?null:_0xa1adfd[_0x5d61('0x18')]['VoiceQueueId'],'CampaignId':_0xa1adfd[_0x5d61('0x18')][_0x5d61('0x1c')]===undefined?null:_0xa1adfd['body'][_0x5d61('0x1c')]}})['then'](function(_0x155ec4){if(_0x155ec4!=null){return db[_0x5d61('0x25')][_0x5d61('0x17')]({'raw':!![],'where':{'CmHopperId':_0x155ec4['id'],'OrderBy':{'$gte':_0x155ec4[_0x5d61('0x1d')]}},'order':[[_0x5d61('0x1d'),_0x5d61('0x1e')]]})[_0x5d61('0xb')](function(_0x22cc93){if(_0x22cc93)return activateAdditionalPhone(_0x155ec4,_0xa1adfd[_0x5d61('0x18')],_0x22cc93,_0xa1adfd[_0x5d61('0x2d')],_0xa1adfd[_0x5d61('0x2e')])[_0x5d61('0xb')](function(_0x4516d8){_0x3a1f64(_0x4516d8);});else{return db[_0x5d61('0x25')][_0x5d61('0x17')]({'raw':!![],'where':{'CmHopperId':_0x155ec4['id']},'order':[[_0x5d61('0x1d'),_0x5d61('0x1e')]]})['then'](function(_0x204499){if(_0x204499)return activateAdditionalPhone(_0x155ec4,_0xa1adfd[_0x5d61('0x18')],_0x204499,_0xa1adfd[_0x5d61('0x2d')],_0xa1adfd[_0x5d61('0x2e')])['then'](function(_0x1abc26){_0x3a1f64(_0x1abc26);});else{_0x3a1f64({'id':_0x155ec4['id'],'phone':''});}})[_0x5d61('0x2b')](function(_0x3428ff){logger[_0x5d61('0x12')](_0x5d61('0x2a'),_0x3428ff['message']);_0x37d925(_0x402eaf[_0x5d61('0x12')](0x1f4,_0x3428ff['message']));});}})['catch'](function(_0x2929ba){logger['error'](_0x5d61('0x2a'),_0x2929ba[_0x5d61('0x14')]);_0x37d925(_0x402eaf[_0x5d61('0x12')](0x1f4,_0x2929ba[_0x5d61('0x14')]));});}else _0x3a1f64(0x1);});});};function activateAdditionalPhone(_0x22041a,_0x5096d4,_0x18c2a0,_0x4d511a,_0x1b7f5d){return new Promise(function(_0x219268,_0x2e5e29){var _0x5ac506;if(_[_0x5d61('0x2f')](_0x18c2a0['scheduledat'])){_0x18c2a0['scheduledat']=moment();}if(moment()>moment(_0x18c2a0[_0x5d61('0x30')])){_0x5ac506=moment()[_0x5d61('0x31')](_0x1b7f5d||0x3,'minutes');}else{if(_0x18c2a0['OrderBy']==0x0){_0x5ac506=moment(_0x18c2a0[_0x5d61('0x30')]);}else{_0x5ac506=moment()[_0x5d61('0x31')](_0x1b7f5d||0x3,_0x5d61('0x32'));}}if(_[_0x5d61('0x2f')](_0x5ac506)){_0x5ac506=moment()['add'](_0x1b7f5d||0x3,_0x5d61('0x32'));}var _0x382ce1={'phone':_0x22041a[_0x5d61('0x33')],'active':0x0,'OrderBy':_[_0x5d61('0x2f')](_0x22041a['OrderBy'])?0x0:_0x22041a[_0x5d61('0x1d')],'scheduledat':moment()['add'](_0x4d511a||0x1,'minutes'),'countbusyretry':_0x5096d4[_0x5d61('0x26')],'countcongestionretry':_0x5096d4['countcongestionretry'],'countnoanswerretry':_0x5096d4[_0x5d61('0x20')],'countnosuchnumberretry':_0x5096d4[_0x5d61('0x27')],'countdropretry':_0x5096d4['countdropretry'],'countabandonedretry':_0x5096d4[_0x5d61('0x22')],'countmachineretry':_0x5096d4['countmachineretry'],'countagentrejectretry':_0x5096d4[_0x5d61('0x23')],'createdAt':_0x5096d4[_0x5d61('0x34')],'updatedAt':_0x5096d4[_0x5d61('0x35')]};var _0x240d9d={'CmHopperId':_0x22041a['id'],'phone':_0x18c2a0[_0x5d61('0x33')],'active':0x0,'OrderBy':_['isNil'](_0x18c2a0['OrderBy'])?0x0:_0x18c2a0[_0x5d61('0x1d')],'scheduledat':_0x5ac506,'countbusyretry':_0x18c2a0[_0x5d61('0x26')],'countcongestionretry':_0x18c2a0['countcongestionretry'],'countnoanswerretry':_0x18c2a0[_0x5d61('0x20')],'countnosuchnumberretry':_0x18c2a0[_0x5d61('0x27')],'countdropretry':_0x18c2a0['countdropretry'],'countabandonedretry':_0x18c2a0[_0x5d61('0x22')],'countmachineretry':_0x18c2a0[_0x5d61('0x28')],'countagentrejectretry':_0x18c2a0['countagentrejectretry'],'createdAt':_0x18c2a0[_0x5d61('0x34')],'updatedAt':_0x18c2a0[_0x5d61('0x35')]};return db[_0x5d61('0x36')][_0x5d61('0x37')](function(_0x4ec0e0){return db['CmHopperAdditionalPhone'][_0x5d61('0x38')](_0x382ce1,{'where':{'id':_0x18c2a0['id']}},{'transaction':_0x4ec0e0})[_0x5d61('0xb')](function(){return db[_0x5d61('0x16')][_0x5d61('0x38')](_0x240d9d,{'where':{'id':_0x22041a['id']}},{'transaction':_0x4ec0e0});});})['then'](function(_0x315125){_0x219268({'id':_0x22041a['id'],'phone':_0x18c2a0[_0x5d61('0x33')]});})[_0x5d61('0x2b')](function(_0x154ddc){logger[_0x5d61('0x12')](_0x5d61('0x39'),_0x154ddc[_0x5d61('0x14')]);_0x2e5e29({'error':_0x154ddc[_0x5d61('0x14')]});});});}exports[_0x5d61('0x3a')]=function(_0x25f8ce){var _0x57b579=this;return new Promise(function(_0x31fe14,_0x4661ff){return db[_0x5d61('0x16')][_0x5d61('0x38')](_0x25f8ce['body'][_0x5d61('0x3b')],{'where':{'id':_0x25f8ce[_0x5d61('0x18')]['id']}})[_0x5d61('0xb')](function(_0x24ac17){_0x31fe14(_0x24ac17);})[_0x5d61('0x2b')](function(_0x4ee441){logger[_0x5d61('0x12')](_0x5d61('0x3a'),_0x4ee441[_0x5d61('0x14')]);_0x4661ff(_0x57b579[_0x5d61('0x12')](0x1f4,_0x4ee441['message']));});});}; \ No newline at end of file +var _0x0cf4=['message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countnoanswerretry','countabandonedretry','SwapAdditionalPhones','ListId','waitTime','duration','isNil','scheduledat','add','minutes','phone','countcongestionretry','createdAt','updatedAt','sequelize','transaction','update','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x124157,_0x13d8f6){var _0x475783=function(_0x997985){while(--_0x997985){_0x124157['push'](_0x124157['shift']());}};_0x475783(++_0x13d8f6);}(_0x0cf4,0x142));var _0x40cf=function(_0x411289,_0x36dbc8){_0x411289=_0x411289-0x0;var _0x5e72ec=_0x0cf4[_0x411289];return _0x5e72ec;};'use strict';var _=require(_0x40cf('0x0'));var util=require(_0x40cf('0x1'));var moment=require(_0x40cf('0x2'));var BPromise=require(_0x40cf('0x3'));var rs=require(_0x40cf('0x4'));var fs=require('fs');var Redis=require(_0x40cf('0x5'));var db=require(_0x40cf('0x6'))['db'];var utils=require(_0x40cf('0x7'));var logger=require(_0x40cf('0x8'))(_0x40cf('0x9'));var config=require(_0x40cf('0xa'));var jayson=require(_0x40cf('0xb'));var client=jayson[_0x40cf('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37a34a,_0x30703e,_0x2852f7){return new BPromise(function(_0x2c9952,_0xe58832){return client[_0x40cf('0xd')](_0x37a34a,_0x2852f7)[_0x40cf('0xe')](function(_0x3fc1d){logger[_0x40cf('0xf')](_0x40cf('0x10'),_0x30703e,_0x40cf('0x11'));logger['debug']('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x30703e,'request\x20sent',JSON['stringify'](_0x3fc1d));if(_0x3fc1d[_0x40cf('0x12')]){if(_0x3fc1d['error'][_0x40cf('0x13')]===0x1f4){logger[_0x40cf('0x12')](_0x40cf('0x10'),_0x30703e,_0x3fc1d[_0x40cf('0x12')][_0x40cf('0x14')]);return _0xe58832(_0x3fc1d['error'][_0x40cf('0x14')]);}logger[_0x40cf('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x30703e,_0x3fc1d[_0x40cf('0x12')]['message']);return _0x2c9952(_0x3fc1d[_0x40cf('0x12')][_0x40cf('0x14')]);}else{logger[_0x40cf('0xf')](_0x40cf('0x10'),_0x30703e,_0x40cf('0x11'));_0x2c9952(_0x3fc1d[_0x40cf('0x15')][_0x40cf('0x14')]);}})[_0x40cf('0x16')](function(_0x119e95){logger[_0x40cf('0x12')](_0x40cf('0x10'),_0x30703e,_0x119e95);_0xe58832(_0x119e95);});});}exports[_0x40cf('0x17')]=function(_0x2553ae){var _0x4d096c=this;return new Promise(function(_0x20061b,_0x2fd337){return db[_0x40cf('0x18')][_0x40cf('0x19')]({'raw':!![],'where':{'ContactId':_0x2553ae[_0x40cf('0x1a')]['ContactId'],'ListId':_0x2553ae['body']['ListId'],'VoiceQueueId':_0x2553ae['body']['VoiceQueueId']===undefined?null:_0x2553ae[_0x40cf('0x1a')][_0x40cf('0x1b')],'CampaignId':_0x2553ae[_0x40cf('0x1a')][_0x40cf('0x1c')]===undefined?null:_0x2553ae[_0x40cf('0x1a')][_0x40cf('0x1c')]}})[_0x40cf('0xe')](function(_0x4fd6dc){if(_0x4fd6dc!=null){return db['CmHopperAdditionalPhone'][_0x40cf('0x19')]({'raw':!![],'where':{'CmHopperId':_0x4fd6dc['id'],'OrderBy':{'$gt':_0x4fd6dc['OrderBy']}},'order':[[_0x40cf('0x1d'),_0x40cf('0x1e')]]})['then'](function(_0x5e8809){var _0x50a67c=0x0;if(_0x5e8809){if(_0x5e8809[_0x40cf('0x1f')]+_0x5e8809['countcongestionretry']+_0x5e8809['countnoanswerretry']+_0x5e8809[_0x40cf('0x20')]+_0x5e8809[_0x40cf('0x21')]+_0x5e8809['countabandonedretry']+_0x5e8809[_0x40cf('0x22')]+_0x5e8809[_0x40cf('0x23')]<_0x2553ae[_0x40cf('0x24')][_0x40cf('0x25')])_0x50a67c=0x1;_0x20061b({'additional':_0x50a67c});}else{return db[_0x40cf('0x26')][_0x40cf('0x19')]({'raw':!![],'where':{'CmHopperId':_0x4fd6dc['id']},'order':[['OrderBy',_0x40cf('0x1e')]]})[_0x40cf('0xe')](function(_0x4e1449){var _0x4692da=0x0;if(_0x4e1449){if(_0x4e1449[_0x40cf('0x1f')]+_0x4e1449['countcongestionretry']+_0x4e1449[_0x40cf('0x27')]+_0x4e1449[_0x40cf('0x20')]+_0x4e1449['countdropretry']+_0x4e1449[_0x40cf('0x28')]+_0x4e1449[_0x40cf('0x22')]+_0x4e1449[_0x40cf('0x23')]<_0x2553ae[_0x40cf('0x24')]['dialGlobalMaxRetry'])_0x4692da=0x1;_0x20061b({'additional':_0x4692da});}else{_0x20061b({'additional':0x0});}})['catch'](function(_0x384943){logger[_0x40cf('0x12')](_0x40cf('0x17'),_0x384943['message']);_0x2fd337(_0x4d096c[_0x40cf('0x12')](0x1f4,_0x384943[_0x40cf('0x14')]));});}})[_0x40cf('0x16')](function(_0x40cff7){logger['error'](_0x40cf('0x17'),_0x40cff7[_0x40cf('0x14')]);_0x2fd337(_0x4d096c[_0x40cf('0x12')](0x1f4,_0x40cff7[_0x40cf('0x14')]));});}else _0x20061b({'additional':0x0});});});};exports[_0x40cf('0x29')]=function(_0x5a5f63){var _0x3456a0=this;return new Promise(function(_0x4a7cf7,_0x3c0747){return db[_0x40cf('0x18')][_0x40cf('0x19')]({'raw':!![],'where':{'ContactId':_0x5a5f63['body']['ContactId'],'ListId':_0x5a5f63['body'][_0x40cf('0x2a')],'VoiceQueueId':_0x5a5f63['body'][_0x40cf('0x1b')]===undefined?null:_0x5a5f63[_0x40cf('0x1a')]['VoiceQueueId'],'CampaignId':_0x5a5f63[_0x40cf('0x1a')]['CampaignId']===undefined?null:_0x5a5f63['body'][_0x40cf('0x1c')]}})['then'](function(_0x550db2){if(_0x550db2!=null){return db[_0x40cf('0x26')][_0x40cf('0x19')]({'raw':!![],'where':{'CmHopperId':_0x550db2['id'],'OrderBy':{'$gte':_0x550db2[_0x40cf('0x1d')]}},'order':[['OrderBy','ASC']]})['then'](function(_0xd03f48){if(_0xd03f48)return activateAdditionalPhone(_0x550db2,_0x5a5f63[_0x40cf('0x1a')],_0xd03f48,_0x5a5f63['duration'],_0x5a5f63[_0x40cf('0x2b')])['then'](function(_0x9cdaec){_0x4a7cf7(_0x9cdaec);});else{return db[_0x40cf('0x26')][_0x40cf('0x19')]({'raw':!![],'where':{'CmHopperId':_0x550db2['id']},'order':[[_0x40cf('0x1d'),_0x40cf('0x1e')]]})['then'](function(_0x375969){if(_0x375969)return activateAdditionalPhone(_0x550db2,_0x5a5f63[_0x40cf('0x1a')],_0x375969,_0x5a5f63[_0x40cf('0x2c')],_0x5a5f63[_0x40cf('0x2b')])['then'](function(_0x505fda){_0x4a7cf7(_0x505fda);});else{_0x4a7cf7({'id':_0x550db2['id'],'phone':''});}})[_0x40cf('0x16')](function(_0x4ae74c){logger['error'](_0x40cf('0x17'),_0x4ae74c['message']);_0x3c0747(_0x3456a0[_0x40cf('0x12')](0x1f4,_0x4ae74c[_0x40cf('0x14')]));});}})[_0x40cf('0x16')](function(_0x3c8411){logger['error'](_0x40cf('0x17'),_0x3c8411[_0x40cf('0x14')]);_0x3c0747(_0x3456a0[_0x40cf('0x12')](0x1f4,_0x3c8411[_0x40cf('0x14')]));});}else _0x4a7cf7(0x1);});});};function activateAdditionalPhone(_0x4c4ca6,_0x3c76dc,_0x390022,_0x234305,_0x43e402){return new Promise(function(_0x341d5c,_0xd4116a){var _0x1a3a6d;if(_[_0x40cf('0x2d')](_0x390022[_0x40cf('0x2e')])){_0x390022[_0x40cf('0x2e')]=moment();}if(moment()>moment(_0x390022['scheduledat'])){_0x1a3a6d=moment()[_0x40cf('0x2f')](_0x43e402||0x3,_0x40cf('0x30'));}else{if(_0x390022[_0x40cf('0x1d')]==0x0){_0x1a3a6d=moment(_0x390022['scheduledat']);}else{_0x1a3a6d=moment()[_0x40cf('0x2f')](_0x43e402||0x3,_0x40cf('0x30'));}}if(_[_0x40cf('0x2d')](_0x1a3a6d)){_0x1a3a6d=moment()[_0x40cf('0x2f')](_0x43e402||0x3,'minutes');}var _0x10fdc2={'phone':_0x4c4ca6[_0x40cf('0x31')],'active':0x0,'OrderBy':_[_0x40cf('0x2d')](_0x4c4ca6['OrderBy'])?0x0:_0x4c4ca6[_0x40cf('0x1d')],'scheduledat':moment()['add'](_0x234305||0x1,_0x40cf('0x30')),'countbusyretry':_0x3c76dc[_0x40cf('0x1f')],'countcongestionretry':_0x3c76dc[_0x40cf('0x32')],'countnoanswerretry':_0x3c76dc['countnoanswerretry'],'countnosuchnumberretry':_0x3c76dc[_0x40cf('0x20')],'countdropretry':_0x3c76dc[_0x40cf('0x21')],'countabandonedretry':_0x3c76dc['countabandonedretry'],'countmachineretry':_0x3c76dc[_0x40cf('0x22')],'countagentrejectretry':_0x3c76dc[_0x40cf('0x23')],'createdAt':_0x3c76dc[_0x40cf('0x33')],'updatedAt':_0x3c76dc[_0x40cf('0x34')]};var _0x1a115e={'CmHopperId':_0x4c4ca6['id'],'phone':_0x390022[_0x40cf('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x390022[_0x40cf('0x1d')])?0x0:_0x390022[_0x40cf('0x1d')],'scheduledat':_0x1a3a6d,'countbusyretry':_0x390022[_0x40cf('0x1f')],'countcongestionretry':_0x390022['countcongestionretry'],'countnoanswerretry':_0x390022['countnoanswerretry'],'countnosuchnumberretry':_0x390022[_0x40cf('0x20')],'countdropretry':_0x390022[_0x40cf('0x21')],'countabandonedretry':_0x390022[_0x40cf('0x28')],'countmachineretry':_0x390022[_0x40cf('0x22')],'countagentrejectretry':_0x390022['countagentrejectretry'],'createdAt':_0x390022['createdAt'],'updatedAt':_0x390022[_0x40cf('0x34')]};return db[_0x40cf('0x35')][_0x40cf('0x36')](function(_0x542ad8){return db[_0x40cf('0x26')][_0x40cf('0x37')](_0x10fdc2,{'where':{'id':_0x390022['id']}},{'transaction':_0x542ad8})['then'](function(){return db[_0x40cf('0x18')][_0x40cf('0x37')](_0x1a115e,{'where':{'id':_0x4c4ca6['id']}},{'transaction':_0x542ad8});});})[_0x40cf('0xe')](function(_0x403e9b){_0x341d5c({'id':_0x4c4ca6['id'],'phone':_0x390022[_0x40cf('0x31')]});})['catch'](function(_0x27e1c2){logger[_0x40cf('0x12')]('activateAdditionalPhone',_0x27e1c2[_0x40cf('0x14')]);_0xd4116a({'error':_0x27e1c2['message']});});});}exports[_0x40cf('0x38')]=function(_0x5cc4f6){var _0x520210=this;return new Promise(function(_0x759f30,_0x15bd20){return db[_0x40cf('0x18')]['update'](_0x5cc4f6['body']['field'],{'where':{'id':_0x5cc4f6['body']['id']}})[_0x40cf('0xe')](function(_0xfb10a2){_0x759f30(_0xfb10a2);})[_0x40cf('0x16')](function(_0x449cba){logger[_0x40cf('0x12')](_0x40cf('0x38'),_0x449cba[_0x40cf('0x14')]);_0x15bd20(_0x520210[_0x40cf('0x12')](0x1f4,_0x449cba[_0x40cf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 134fdfc..e061e22 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4443=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x133965,_0x26cd54){var _0xe9b1c0=function(_0x533d3b){while(--_0x533d3b){_0x133965['push'](_0x133965['shift']());}};_0xe9b1c0(++_0x26cd54);}(_0x4443,0x71));var _0x3444=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x4443[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0x3444('0x0'));var util=require('util');var path=require(_0x3444('0x1'));var timeout=require(_0x3444('0x2'));var express=require(_0x3444('0x3'));var router=express[_0x3444('0x4')]();var fs_extra=require(_0x3444('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3444('0x6'));var config=require(_0x3444('0x7'));var controller=require(_0x3444('0x8'));router[_0x3444('0x9')]('/',auth[_0x3444('0xa')](),controller[_0x3444('0xb')]);router[_0x3444('0x9')](_0x3444('0xc'),auth['isAuthenticated'](),controller[_0x3444('0xd')]);router[_0x3444('0xe')]('/',auth[_0x3444('0xa')](),controller['create']);router[_0x3444('0xf')](_0x3444('0xc'),auth[_0x3444('0xa')](),controller[_0x3444('0x10')]);router[_0x3444('0x11')]('/:id',auth[_0x3444('0xa')](),controller['destroy']);module[_0x3444('0x12')]=router; \ No newline at end of file +var _0x269e=['get','isAuthenticated','index','/:id','show','put','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller'];(function(_0x1638a8,_0x2ab38c){var _0x5e3e42=function(_0x280c71){while(--_0x280c71){_0x1638a8['push'](_0x1638a8['shift']());}};_0x5e3e42(++_0x2ab38c);}(_0x269e,0xc8));var _0xe269=function(_0x331fc4,_0x5daaa2){_0x331fc4=_0x331fc4-0x0;var _0x57b8cd=_0x269e[_0x331fc4];return _0x57b8cd;};'use strict';var multer=require(_0xe269('0x0'));var util=require(_0xe269('0x1'));var path=require('path');var timeout=require(_0xe269('0x2'));var express=require(_0xe269('0x3'));var router=express[_0xe269('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe269('0x5'));var config=require(_0xe269('0x6'));var controller=require(_0xe269('0x7'));router[_0xe269('0x8')]('/',auth[_0xe269('0x9')](),controller[_0xe269('0xa')]);router[_0xe269('0x8')](_0xe269('0xb'),auth['isAuthenticated'](),controller[_0xe269('0xc')]);router['post']('/',auth[_0xe269('0x9')](),controller['create']);router[_0xe269('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xe269('0xb'),auth['isAuthenticated'](),controller[_0xe269('0xe')]);module[_0xe269('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 5a1a9d4..eb4867f 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 _0xae1c=['contactListQueue','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae1c,0xff));var _0xcae1=function(_0x541fdf,_0x268606){_0x541fdf=_0x541fdf-0x0;var _0x3f11cf=_0xae1c[_0x541fdf];return _0x3f11cf;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xcae1('0x0')],'unique':_0xcae1('0x1')},'ListId':{'type':Sequelize[_0xcae1('0x0')],'unique':_0xcae1('0x1')},'VoiceQueueId':{'type':Sequelize[_0xcae1('0x0')],'unique':_0xcae1('0x1')}}; \ No newline at end of file +var _0xb194=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x96a34a,_0x48b3c6){var _0x4e325e=function(_0x20e343){while(--_0x20e343){_0x96a34a['push'](_0x96a34a['shift']());}};_0x4e325e(++_0x48b3c6);}(_0xb194,0x1b2));var _0x4b19=function(_0x540511,_0x201e3b){_0x540511=_0x540511-0x0;var _0x5c1ac6=_0xb194[_0x540511];return _0x5c1ac6;};'use strict';var moment=require(_0x4b19('0x0'));var Sequelize=require('sequelize');module[_0x4b19('0x1')]={'phone':{'type':Sequelize[_0x4b19('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x4b19('0x3')],'unique':_0x4b19('0x4')},'ListId':{'type':Sequelize[_0x4b19('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x4b19('0x3')],'unique':_0x4b19('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 7e129d2..e904052 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 _0xdb1c=['api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','CmHopperBlack','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','length','options','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4dea61,_0xd7a604){var _0x140169=function(_0x40b5ca){while(--_0x40b5ca){_0x4dea61['push'](_0x4dea61['shift']());}};_0x140169(++_0xd7a604);}(_0xdb1c,0xcf));var _0xcdb1=function(_0xe7c36a,_0x641105){_0xe7c36a=_0xe7c36a-0x0;var _0x8b1186=_0xdb1c[_0xe7c36a];return _0x8b1186;};'use strict';var emlformat=require(_0xcdb1('0x0'));var rimraf=require(_0xcdb1('0x1'));var zipdir=require(_0xcdb1('0x2'));var jsonpatch=require(_0xcdb1('0x3'));var rp=require(_0xcdb1('0x4'));var moment=require(_0xcdb1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcdb1('0x6'));var util=require(_0xcdb1('0x7'));var path=require(_0xcdb1('0x8'));var sox=require(_0xcdb1('0x9'));var csv=require(_0xcdb1('0xa'));var ejs=require(_0xcdb1('0xb'));var fs=require('fs');var fs_extra=require(_0xcdb1('0xc'));var _=require('lodash');var squel=require(_0xcdb1('0xd'));var crypto=require(_0xcdb1('0xe'));var jsforce=require(_0xcdb1('0xf'));var deskjs=require(_0xcdb1('0x10'));var toCsv=require(_0xcdb1('0xa'));var querystring=require(_0xcdb1('0x11'));var Papa=require('papaparse');var Redis=require(_0xcdb1('0x12'));var authService=require(_0xcdb1('0x13'));var qs=require(_0xcdb1('0x14'));var as=require(_0xcdb1('0x15'));var hardwareService=require(_0xcdb1('0x16'));var logger=require(_0xcdb1('0x17'))(_0xcdb1('0x18'));var utils=require(_0xcdb1('0x19'));var config=require(_0xcdb1('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xcdb1('0x1b'))['db'];function respondWithStatusCode(_0xc40aa4,_0xe3b160){_0xe3b160=_0xe3b160||0xcc;return function(_0x280a39){if(_0x280a39){return _0xc40aa4['sendStatus'](_0xe3b160);}return _0xc40aa4[_0xcdb1('0x1c')](_0xe3b160)['end']();};}function respondWithResult(_0x50fb78,_0x450f0b){_0x450f0b=_0x450f0b||0xc8;return function(_0x568cd3){if(_0x568cd3){return _0x50fb78[_0xcdb1('0x1c')](_0x450f0b)[_0xcdb1('0x1d')](_0x568cd3);}};}function respondWithFilteredResult(_0x30b8c9,_0x49a5da){return function(_0x547749){if(_0x547749){var _0x8b0326=typeof _0x49a5da[_0xcdb1('0x1e')]===_0xcdb1('0x1f')&&typeof _0x49a5da[_0xcdb1('0x20')]===_0xcdb1('0x1f');var _0x15eba8=_0x547749[_0xcdb1('0x21')];var _0x307e76=_0x8b0326?0x0:_0x49a5da[_0xcdb1('0x1e')];var _0x556828=_0x8b0326?_0x547749[_0xcdb1('0x21')]:_0x49a5da[_0xcdb1('0x1e')]+_0x49a5da[_0xcdb1('0x20')];var _0x79679b;if(_0x556828>=_0x15eba8){_0x556828=_0x15eba8;_0x79679b=0xc8;}else{_0x79679b=0xce;}_0x30b8c9[_0xcdb1('0x1c')](_0x79679b);return _0x30b8c9[_0xcdb1('0x22')](_0xcdb1('0x23'),_0x307e76+'-'+_0x556828+'/'+_0x15eba8)[_0xcdb1('0x1d')](_0x547749);}return null;};}function patchUpdates(_0xcf855b){return function(_0x2d60e3){try{jsonpatch['apply'](_0x2d60e3,_0xcf855b,!![]);}catch(_0x41df54){return BPromise['reject'](_0x41df54);}return _0x2d60e3[_0xcdb1('0x24')]();};}function saveUpdates(_0x161a8f,_0x5552b1){return function(_0x5092b2){if(_0x5092b2){return _0x5092b2[_0xcdb1('0x25')](_0x161a8f)[_0xcdb1('0x26')](function(_0x455fea){return _0x455fea;});}return null;};}function removeEntity(_0x1fa8b1,_0x2f034f){return function(_0x592e65){if(_0x592e65){return _0x592e65[_0xcdb1('0x27')]()[_0xcdb1('0x26')](function(){_0x1fa8b1[_0xcdb1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11f5c7,_0x372ca9){return function(_0x85139d){if(!_0x85139d){_0x11f5c7['sendStatus'](0x194);}return _0x85139d;};}function handleError(_0x26d407,_0x40160b){_0x40160b=_0x40160b||0x1f4;return function(_0x119dec){logger[_0xcdb1('0x28')](_0x119dec[_0xcdb1('0x29')]);if(_0x119dec[_0xcdb1('0x2a')]){delete _0x119dec[_0xcdb1('0x2a')];}_0x26d407[_0xcdb1('0x1c')](_0x40160b)['send'](_0x119dec);};}exports[_0xcdb1('0x2b')]=function(_0x49383e,_0x56a849){var _0x87fad4={},_0x3d6ef1={},_0x286cb8={'count':0x0,'rows':[]};var _0x545a76=_[_0xcdb1('0x2c')](db[_0xcdb1('0x2d')]['rawAttributes'],function(_0x5ce20e){return{'name':_0x5ce20e[_0xcdb1('0x2e')],'type':_0x5ce20e[_0xcdb1('0x2f')][_0xcdb1('0x30')]};});_0x3d6ef1[_0xcdb1('0x31')]=_[_0xcdb1('0x2c')](_0x545a76,_0xcdb1('0x2a'));_0x3d6ef1['query']=_['keys'](_0x49383e[_0xcdb1('0x32')]);_0x3d6ef1[_0xcdb1('0x33')]=_[_0xcdb1('0x34')](_0x3d6ef1[_0xcdb1('0x31')],_0x3d6ef1[_0xcdb1('0x32')]);_0x87fad4['attributes']=_[_0xcdb1('0x34')](_0x3d6ef1[_0xcdb1('0x31')],qs[_0xcdb1('0x35')](_0x49383e[_0xcdb1('0x32')][_0xcdb1('0x35')]));_0x87fad4[_0xcdb1('0x36')]=_0x87fad4['attributes']['length']?_0x87fad4[_0xcdb1('0x36')]:_0x3d6ef1[_0xcdb1('0x31')];if(!_0x49383e[_0xcdb1('0x32')]['hasOwnProperty'](_0xcdb1('0x37'))){_0x87fad4[_0xcdb1('0x20')]=qs[_0xcdb1('0x20')](_0x49383e['query']['limit']);_0x87fad4[_0xcdb1('0x1e')]=qs['offset'](_0x49383e['query'][_0xcdb1('0x1e')]);}_0x87fad4[_0xcdb1('0x38')]=qs[_0xcdb1('0x39')](_0x49383e[_0xcdb1('0x32')]['sort']);_0x87fad4[_0xcdb1('0x3a')]=qs[_0xcdb1('0x33')](_[_0xcdb1('0x3b')](_0x49383e[_0xcdb1('0x32')],_0x3d6ef1[_0xcdb1('0x33')]),_0x545a76);if(_0x49383e[_0xcdb1('0x32')][_0xcdb1('0x3c')]){_0x87fad4['where']=_['merge'](_0x87fad4['where'],{'$or':_['map'](_0x545a76,function(_0x2b692b){if(_0x2b692b['type']!==_0xcdb1('0x3d')){var _0x32c8d3={};_0x32c8d3[_0x2b692b[_0xcdb1('0x2a')]]={'$like':'%'+_0x49383e['query'][_0xcdb1('0x3c')]+'%'};return _0x32c8d3;}})});}_0x87fad4=_[_0xcdb1('0x3e')]({},_0x87fad4,_0x49383e['options']);var _0x3946fa={'where':_0x87fad4[_0xcdb1('0x3a')]};return db[_0xcdb1('0x2d')][_0xcdb1('0x21')](_0x3946fa)['then'](function(_0xffb390){_0x286cb8[_0xcdb1('0x21')]=_0xffb390;if(_0x49383e[_0xcdb1('0x32')][_0xcdb1('0x3f')]){_0x87fad4[_0xcdb1('0x40')]=[{'all':!![]}];}return db[_0xcdb1('0x2d')][_0xcdb1('0x41')](_0x87fad4);})[_0xcdb1('0x26')](function(_0x24dd19){_0x286cb8[_0xcdb1('0x42')]=_0x24dd19;return _0x286cb8;})[_0xcdb1('0x26')](respondWithFilteredResult(_0x56a849,_0x87fad4))[_0xcdb1('0x43')](handleError(_0x56a849,null));};exports[_0xcdb1('0x44')]=function(_0x1bd58d,_0x5de169){var _0x4a4ead={'raw':!![],'where':{'id':_0x1bd58d['params']['id']}},_0x3df3a7={};_0x3df3a7[_0xcdb1('0x31')]=_[_0xcdb1('0x45')](db['CmHopperBlack'][_0xcdb1('0x46')]);_0x3df3a7[_0xcdb1('0x32')]=_[_0xcdb1('0x45')](_0x1bd58d[_0xcdb1('0x32')]);_0x3df3a7[_0xcdb1('0x33')]=_[_0xcdb1('0x34')](_0x3df3a7[_0xcdb1('0x31')],_0x3df3a7['query']);_0x4a4ead[_0xcdb1('0x36')]=_[_0xcdb1('0x34')](_0x3df3a7[_0xcdb1('0x31')],qs[_0xcdb1('0x35')](_0x1bd58d['query'][_0xcdb1('0x35')]));_0x4a4ead[_0xcdb1('0x36')]=_0x4a4ead['attributes'][_0xcdb1('0x47')]?_0x4a4ead[_0xcdb1('0x36')]:_0x3df3a7[_0xcdb1('0x31')];if(_0x1bd58d['query'][_0xcdb1('0x3f')]){_0x4a4ead['include']=[{'all':!![]}];}_0x4a4ead=_[_0xcdb1('0x3e')]({},_0x4a4ead,_0x1bd58d[_0xcdb1('0x48')]);return db[_0xcdb1('0x2d')][_0xcdb1('0x49')](_0x4a4ead)[_0xcdb1('0x26')](handleEntityNotFound(_0x5de169,null))[_0xcdb1('0x26')](respondWithResult(_0x5de169,null))[_0xcdb1('0x43')](handleError(_0x5de169,null));};exports['update']=function(_0x3a9c53,_0x2ab2d9){if(_0x3a9c53[_0xcdb1('0x4a')]['id']){delete _0x3a9c53[_0xcdb1('0x4a')]['id'];}return db[_0xcdb1('0x2d')][_0xcdb1('0x49')]({'where':{'id':_0x3a9c53[_0xcdb1('0x4b')]['id']}})[_0xcdb1('0x26')](handleEntityNotFound(_0x2ab2d9,null))[_0xcdb1('0x26')](saveUpdates(_0x3a9c53[_0xcdb1('0x4a')],null))[_0xcdb1('0x26')](respondWithResult(_0x2ab2d9,null))[_0xcdb1('0x43')](handleError(_0x2ab2d9,null));};exports[_0xcdb1('0x27')]=function(_0x4fca19,_0x43700c){return db[_0xcdb1('0x2d')][_0xcdb1('0x49')]({'where':{'id':_0x4fca19[_0xcdb1('0x4b')]['id']}})[_0xcdb1('0x26')](handleEntityNotFound(_0x43700c,null))[_0xcdb1('0x26')](removeEntity(_0x43700c,null))['catch'](handleError(_0x43700c,null));};exports[_0xcdb1('0x4c')]=function(_0x390517,_0x1a2538){return db[_0xcdb1('0x2d')][_0xcdb1('0x4c')]()[_0xcdb1('0x26')](respondWithResult(_0x1a2538,null))[_0xcdb1('0x43')](handleError(_0x1a2538,null));}; \ No newline at end of file +var _0x1c87=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','index','map','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where','VIRTUAL','merge','CmHopperBlack','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','update','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x40927b,_0xf9b0a0){var _0x2635e8=function(_0x1f2b8c){while(--_0x1f2b8c){_0x40927b['push'](_0x40927b['shift']());}};_0x2635e8(++_0xf9b0a0);}(_0x1c87,0x92));var _0x71c8=function(_0x5a65e9,_0x5caf5d){_0x5a65e9=_0x5a65e9-0x0;var _0x95de87=_0x1c87[_0x5a65e9];return _0x95de87;};'use strict';var emlformat=require(_0x71c8('0x0'));var rimraf=require(_0x71c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x71c8('0x2'));var rp=require(_0x71c8('0x3'));var moment=require(_0x71c8('0x4'));var BPromise=require(_0x71c8('0x5'));var Mustache=require(_0x71c8('0x6'));var util=require(_0x71c8('0x7'));var path=require(_0x71c8('0x8'));var sox=require(_0x71c8('0x9'));var csv=require(_0x71c8('0xa'));var ejs=require(_0x71c8('0xb'));var fs=require('fs');var fs_extra=require(_0x71c8('0xc'));var _=require(_0x71c8('0xd'));var squel=require('squel');var crypto=require(_0x71c8('0xe'));var jsforce=require(_0x71c8('0xf'));var deskjs=require(_0x71c8('0x10'));var toCsv=require('to-csv');var querystring=require(_0x71c8('0x11'));var Papa=require(_0x71c8('0x12'));var Redis=require(_0x71c8('0x13'));var authService=require(_0x71c8('0x14'));var qs=require(_0x71c8('0x15'));var as=require(_0x71c8('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x71c8('0x17'));var utils=require('../../config/utils');var config=require(_0x71c8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x71c8('0x19'))['db'];function respondWithStatusCode(_0x28e0ca,_0x17b2cd){_0x17b2cd=_0x17b2cd||0xcc;return function(_0x141901){if(_0x141901){return _0x28e0ca['sendStatus'](_0x17b2cd);}return _0x28e0ca['status'](_0x17b2cd)[_0x71c8('0x1a')]();};}function respondWithResult(_0x5352cc,_0x163ac7){_0x163ac7=_0x163ac7||0xc8;return function(_0xd9689a){if(_0xd9689a){return _0x5352cc[_0x71c8('0x1b')](_0x163ac7)[_0x71c8('0x1c')](_0xd9689a);}};}function respondWithFilteredResult(_0x32e07c,_0x40b054){return function(_0x3b2095){if(_0x3b2095){var _0x418de6=typeof _0x40b054[_0x71c8('0x1d')]===_0x71c8('0x1e')&&typeof _0x40b054['limit']==='undefined';var _0x1a9f38=_0x3b2095[_0x71c8('0x1f')];var _0x3e73fb=_0x418de6?0x0:_0x40b054[_0x71c8('0x1d')];var _0x32eab4=_0x418de6?_0x3b2095[_0x71c8('0x1f')]:_0x40b054[_0x71c8('0x1d')]+_0x40b054['limit'];var _0x554ffa;if(_0x32eab4>=_0x1a9f38){_0x32eab4=_0x1a9f38;_0x554ffa=0xc8;}else{_0x554ffa=0xce;}_0x32e07c['status'](_0x554ffa);return _0x32e07c[_0x71c8('0x20')](_0x71c8('0x21'),_0x3e73fb+'-'+_0x32eab4+'/'+_0x1a9f38)['json'](_0x3b2095);}return null;};}function patchUpdates(_0xb8869d){return function(_0x46483a){try{jsonpatch[_0x71c8('0x22')](_0x46483a,_0xb8869d,!![]);}catch(_0x4a9eac){return BPromise[_0x71c8('0x23')](_0x4a9eac);}return _0x46483a[_0x71c8('0x24')]();};}function saveUpdates(_0x1a05d8,_0x191713){return function(_0x58c861){if(_0x58c861){return _0x58c861['update'](_0x1a05d8)[_0x71c8('0x25')](function(_0x57a8e0){return _0x57a8e0;});}return null;};}function removeEntity(_0x23db9c,_0x4a8a77){return function(_0x59bb25){if(_0x59bb25){return _0x59bb25[_0x71c8('0x26')]()[_0x71c8('0x25')](function(){_0x23db9c[_0x71c8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48bd1d,_0xfd37ea){return function(_0x322700){if(!_0x322700){_0x48bd1d[_0x71c8('0x27')](0x194);}return _0x322700;};}function handleError(_0x30346e,_0x3301d6){_0x3301d6=_0x3301d6||0x1f4;return function(_0x14d649){logger[_0x71c8('0x28')](_0x14d649['stack']);if(_0x14d649[_0x71c8('0x29')]){delete _0x14d649[_0x71c8('0x29')];}_0x30346e[_0x71c8('0x1b')](_0x3301d6)['send'](_0x14d649);};}exports[_0x71c8('0x2a')]=function(_0x13984c,_0x53c5ff){var _0x2c53a5={},_0x1e800c={},_0x2e356c={'count':0x0,'rows':[]};var _0x521634=_[_0x71c8('0x2b')](db['CmHopperBlack']['rawAttributes'],function(_0x104af5){return{'name':_0x104af5[_0x71c8('0x2c')],'type':_0x104af5[_0x71c8('0x2d')][_0x71c8('0x2e')]};});_0x1e800c[_0x71c8('0x2f')]=_[_0x71c8('0x2b')](_0x521634,_0x71c8('0x29'));_0x1e800c['query']=_[_0x71c8('0x30')](_0x13984c['query']);_0x1e800c['filters']=_[_0x71c8('0x31')](_0x1e800c[_0x71c8('0x2f')],_0x1e800c[_0x71c8('0x32')]);_0x2c53a5[_0x71c8('0x33')]=_['intersection'](_0x1e800c[_0x71c8('0x2f')],qs[_0x71c8('0x34')](_0x13984c[_0x71c8('0x32')][_0x71c8('0x34')]));_0x2c53a5['attributes']=_0x2c53a5[_0x71c8('0x33')][_0x71c8('0x35')]?_0x2c53a5['attributes']:_0x1e800c[_0x71c8('0x2f')];if(!_0x13984c[_0x71c8('0x32')][_0x71c8('0x36')](_0x71c8('0x37'))){_0x2c53a5[_0x71c8('0x38')]=qs[_0x71c8('0x38')](_0x13984c[_0x71c8('0x32')][_0x71c8('0x38')]);_0x2c53a5[_0x71c8('0x1d')]=qs[_0x71c8('0x1d')](_0x13984c[_0x71c8('0x32')][_0x71c8('0x1d')]);}_0x2c53a5[_0x71c8('0x39')]=qs[_0x71c8('0x3a')](_0x13984c[_0x71c8('0x32')]['sort']);_0x2c53a5['where']=qs[_0x71c8('0x3b')](_['pick'](_0x13984c[_0x71c8('0x32')],_0x1e800c[_0x71c8('0x3b')]),_0x521634);if(_0x13984c[_0x71c8('0x32')][_0x71c8('0x3c')]){_0x2c53a5[_0x71c8('0x3d')]=_['merge'](_0x2c53a5['where'],{'$or':_[_0x71c8('0x2b')](_0x521634,function(_0x2a6bb8){if(_0x2a6bb8[_0x71c8('0x2d')]!==_0x71c8('0x3e')){var _0x2f0ebc={};_0x2f0ebc[_0x2a6bb8['name']]={'$like':'%'+_0x13984c['query'][_0x71c8('0x3c')]+'%'};return _0x2f0ebc;}})});}_0x2c53a5=_[_0x71c8('0x3f')]({},_0x2c53a5,_0x13984c['options']);var _0x267446={'where':_0x2c53a5[_0x71c8('0x3d')]};return db[_0x71c8('0x40')][_0x71c8('0x1f')](_0x267446)[_0x71c8('0x25')](function(_0x532a10){_0x2e356c[_0x71c8('0x1f')]=_0x532a10;if(_0x13984c[_0x71c8('0x32')]['includeAll']){_0x2c53a5[_0x71c8('0x41')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x71c8('0x42')](_0x2c53a5);})[_0x71c8('0x25')](function(_0x5de8b3){_0x2e356c[_0x71c8('0x43')]=_0x5de8b3;return _0x2e356c;})['then'](respondWithFilteredResult(_0x53c5ff,_0x2c53a5))[_0x71c8('0x44')](handleError(_0x53c5ff,null));};exports[_0x71c8('0x45')]=function(_0x1c0e06,_0x47a9b2){var _0x2674b2={'raw':!![],'where':{'id':_0x1c0e06[_0x71c8('0x46')]['id']}},_0x210668={};_0x210668['model']=_[_0x71c8('0x30')](db['CmHopperBlack'][_0x71c8('0x47')]);_0x210668[_0x71c8('0x32')]=_[_0x71c8('0x30')](_0x1c0e06[_0x71c8('0x32')]);_0x210668[_0x71c8('0x3b')]=_[_0x71c8('0x31')](_0x210668[_0x71c8('0x2f')],_0x210668[_0x71c8('0x32')]);_0x2674b2['attributes']=_[_0x71c8('0x31')](_0x210668[_0x71c8('0x2f')],qs[_0x71c8('0x34')](_0x1c0e06[_0x71c8('0x32')][_0x71c8('0x34')]));_0x2674b2[_0x71c8('0x33')]=_0x2674b2['attributes'][_0x71c8('0x35')]?_0x2674b2[_0x71c8('0x33')]:_0x210668[_0x71c8('0x2f')];if(_0x1c0e06['query'][_0x71c8('0x48')]){_0x2674b2['include']=[{'all':!![]}];}_0x2674b2=_[_0x71c8('0x3f')]({},_0x2674b2,_0x1c0e06[_0x71c8('0x49')]);return db[_0x71c8('0x40')][_0x71c8('0x4a')](_0x2674b2)[_0x71c8('0x25')](handleEntityNotFound(_0x47a9b2,null))[_0x71c8('0x25')](respondWithResult(_0x47a9b2,null))['catch'](handleError(_0x47a9b2,null));};exports[_0x71c8('0x4b')]=function(_0x2bf95a,_0x29c3ed){if(_0x2bf95a[_0x71c8('0x4c')]['id']){delete _0x2bf95a[_0x71c8('0x4c')]['id'];}return db[_0x71c8('0x40')][_0x71c8('0x4a')]({'where':{'id':_0x2bf95a[_0x71c8('0x46')]['id']}})[_0x71c8('0x25')](handleEntityNotFound(_0x29c3ed,null))[_0x71c8('0x25')](saveUpdates(_0x2bf95a['body'],null))[_0x71c8('0x25')](respondWithResult(_0x29c3ed,null))[_0x71c8('0x44')](handleError(_0x29c3ed,null));};exports[_0x71c8('0x26')]=function(_0x4b46f7,_0x5d4377){return db[_0x71c8('0x40')][_0x71c8('0x4a')]({'where':{'id':_0x4b46f7['params']['id']}})[_0x71c8('0x25')](handleEntityNotFound(_0x5d4377,null))[_0x71c8('0x25')](removeEntity(_0x5d4377,null))['catch'](handleError(_0x5d4377,null));};exports[_0x71c8('0x4d')]=function(_0x3539e6,_0x1d6c88){return db['CmHopperBlack'][_0x71c8('0x4d')]()['then'](respondWithResult(_0x1d6c88,null))[_0x71c8('0x44')](handleError(_0x1d6c88,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 493d70b..cd2f392 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 _0x3005=['../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x120351,_0x40817a){var _0x51d31c=function(_0x3f38c7){while(--_0x3f38c7){_0x120351['push'](_0x120351['shift']());}};_0x51d31c(++_0x40817a);}(_0x3005,0x13d));var _0x5300=function(_0x41c866,_0x424e99){_0x41c866=_0x41c866-0x0;var _0xa2c316=_0x3005[_0x41c866];return _0xa2c316;};'use strict';var _=require(_0x5300('0x0'));var util=require(_0x5300('0x1'));var logger=require(_0x5300('0x2'))(_0x5300('0x3'));var moment=require(_0x5300('0x4'));var BPromise=require(_0x5300('0x5'));var rp=require(_0x5300('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5300('0x7'));var config=require(_0x5300('0x8'));var attributes=require(_0x5300('0x9'));module[_0x5300('0xa')]=function(_0x7c00ef,_0x17bbda){return _0x7c00ef[_0x5300('0xb')](_0x5300('0xc'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3fb=['api','moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger'];(function(_0x4c70c4,_0x963969){var _0x437865=function(_0x54e323){while(--_0x54e323){_0x4c70c4['push'](_0x4c70c4['shift']());}};_0x437865(++_0x963969);}(_0xb3fb,0x15b));var _0xbb3f=function(_0x3355c0,_0x4b530b){_0x3355c0=_0x3355c0-0x0;var _0x5a3288=_0xb3fb[_0x3355c0];return _0x5a3288;};'use strict';var _=require(_0xbb3f('0x0'));var util=require(_0xbb3f('0x1'));var logger=require(_0xbb3f('0x2'))(_0xbb3f('0x3'));var moment=require(_0xbb3f('0x4'));var BPromise=require(_0xbb3f('0x5'));var rp=require(_0xbb3f('0x6'));var fs=require('fs');var path=require(_0xbb3f('0x7'));var rimraf=require(_0xbb3f('0x8'));var config=require('../../config/environment');var attributes=require(_0xbb3f('0x9'));module[_0xbb3f('0xa')]=function(_0x28b422,_0x306625){return _0x28b422[_0xbb3f('0xb')](_0xbb3f('0xc'),attributes,{'tableName':_0xbb3f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 2299b90..55ea1ba 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 _0x95a0=['map','catch','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','model'];(function(_0x54b853,_0x1683fa){var _0x27b9c3=function(_0x55cab6){while(--_0x55cab6){_0x54b853['push'](_0x54b853['shift']());}};_0x27b9c3(++_0x1683fa);}(_0x95a0,0x148));var _0x095a=function(_0xd0fd44,_0x7b2aba){_0xd0fd44=_0xd0fd44-0x0;var _0x2f8d6b=_0x95a0[_0xd0fd44];return _0x2f8d6b;};'use strict';var _=require(_0x095a('0x0'));var util=require(_0x095a('0x1'));var moment=require(_0x095a('0x2'));var BPromise=require(_0x095a('0x3'));var rs=require(_0x095a('0x4'));var fs=require('fs');var Redis=require(_0x095a('0x5'));var db=require(_0x095a('0x6'))['db'];var utils=require(_0x095a('0x7'));var logger=require(_0x095a('0x8'))(_0x095a('0x9'));var config=require(_0x095a('0xa'));var jayson=require(_0x095a('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a0545,_0x19d242,_0xf002ed){return new BPromise(function(_0x5edacf,_0x53c33e){return client[_0x095a('0xc')](_0x4a0545,_0xf002ed)[_0x095a('0xd')](function(_0x2f948b){logger[_0x095a('0xe')](_0x095a('0xf'),_0x19d242,'request\x20sent');logger[_0x095a('0x10')](_0x095a('0x11'),_0x19d242,'request\x20sent',JSON['stringify'](_0x2f948b));if(_0x2f948b['error']){if(_0x2f948b[_0x095a('0x12')][_0x095a('0x13')]===0x1f4){logger[_0x095a('0x12')](_0x095a('0xf'),_0x19d242,_0x2f948b['error'][_0x095a('0x14')]);return _0x53c33e(_0x2f948b['error']['message']);}logger[_0x095a('0x12')](_0x095a('0xf'),_0x19d242,_0x2f948b[_0x095a('0x12')][_0x095a('0x14')]);return _0x5edacf(_0x2f948b[_0x095a('0x12')][_0x095a('0x14')]);}else{logger[_0x095a('0xe')](_0x095a('0xf'),_0x19d242,_0x095a('0x15'));_0x5edacf(_0x2f948b[_0x095a('0x16')][_0x095a('0x14')]);}})['catch'](function(_0x4b4f27){logger['error'](_0x095a('0xf'),_0x19d242,_0x4b4f27);_0x53c33e(_0x4b4f27);});});}exports[_0x095a('0x17')]=function(_0x5c5a2b){var _0x18584b=this;return new Promise(function(_0x2ab41e,_0x54df3d){return db[_0x095a('0x18')]['findAll']({'raw':_0x5c5a2b[_0x095a('0x19')]?_0x5c5a2b[_0x095a('0x19')][_0x095a('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c5a2b[_0x095a('0x19')]?_0x5c5a2b[_0x095a('0x19')][_0x095a('0x1b')]||null:null,'attributes':_0x5c5a2b[_0x095a('0x19')]?_0x5c5a2b[_0x095a('0x19')][_0x095a('0x1c')]||null:null,'limit':_0x5c5a2b[_0x095a('0x19')]?_0x5c5a2b[_0x095a('0x19')][_0x095a('0x1d')]||null:null,'include':_0x5c5a2b['options']?_0x5c5a2b[_0x095a('0x19')]['include']?_['map'](_0x5c5a2b[_0x095a('0x19')][_0x095a('0x1e')],function(_0x2f4a5f){return{'model':db[_0x2f4a5f[_0x095a('0x1f')]],'as':_0x2f4a5f['as'],'attributes':_0x2f4a5f[_0x095a('0x1c')],'include':_0x2f4a5f[_0x095a('0x1e')]?_[_0x095a('0x20')](_0x2f4a5f[_0x095a('0x1e')],function(_0x2c55b6){return{'model':db[_0x2c55b6[_0x095a('0x1f')]],'as':_0x2c55b6['as'],'attributes':_0x2c55b6[_0x095a('0x1c')],'include':_0x2c55b6[_0x095a('0x1e')]?_[_0x095a('0x20')](_0x2c55b6[_0x095a('0x1e')],function(_0x47e375){return{'model':db[_0x47e375[_0x095a('0x1f')]],'as':_0x47e375['as'],'attributes':_0x47e375[_0x095a('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x149192){logger[_0x095a('0xe')](_0x095a('0x17'),_0x5c5a2b);logger[_0x095a('0x10')](_0x095a('0x17'),_0x5c5a2b,JSON['stringify'](_0x149192));_0x2ab41e(_0x149192);})[_0x095a('0x21')](function(_0x54ae06){logger[_0x095a('0x12')](_0x095a('0x17'),_0x54ae06[_0x095a('0x14')],_0x5c5a2b);_0x54df3d(_0x18584b[_0x095a('0x12')](0x1f4,_0x54ae06['message']));});});};exports[_0x095a('0x22')]=function(_0x321a9f){var _0x410e8c=this;return new Promise(function(_0x4eba92,_0x25d561){return db[_0x095a('0x18')][_0x095a('0x23')](_0x321a9f[_0x095a('0x24')],{'raw':_0x321a9f[_0x095a('0x19')]?_0x321a9f[_0x095a('0x19')][_0x095a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x321a9f[_0x095a('0x19')]?_0x321a9f['options'][_0x095a('0x1b')]||null:null,'attributes':_0x321a9f[_0x095a('0x19')]?_0x321a9f[_0x095a('0x19')][_0x095a('0x1c')]||null:null,'limit':_0x321a9f[_0x095a('0x19')]?_0x321a9f[_0x095a('0x19')][_0x095a('0x1d')]||null:null})[_0x095a('0xd')](function(_0x42f66d){logger['info'](_0x095a('0x22'),_0x321a9f);logger['debug'](_0x095a('0x22'),_0x321a9f,JSON['stringify'](_0x42f66d));_0x4eba92(_0x42f66d);})[_0x095a('0x21')](function(_0x47f7d5){logger['error']('UpdateCmHopperBlack',_0x47f7d5['message'],_0x321a9f);_0x25d561(_0x410e8c['error'](0x1f4,_0x47f7d5[_0x095a('0x14')]));});});};exports[_0x095a('0x25')]=function(_0x48fe5c){var _0x227c52=this;return new Promise(function(_0x312d68,_0x13a1ba){return db[_0x095a('0x18')][_0x095a('0x26')]({'where':_0x48fe5c['options']?_0x48fe5c[_0x095a('0x19')][_0x095a('0x1b')]||null:null})['then'](function(_0x463239){logger[_0x095a('0xe')]('DestroyCmHopperBlack',_0x48fe5c);logger['debug'](_0x095a('0x25'),_0x48fe5c,JSON[_0x095a('0x27')](_0x463239));_0x312d68(_0x463239);})[_0x095a('0x21')](function(_0x28004e){logger['error'](_0x095a('0x25'),_0x28004e[_0x095a('0x14')],_0x48fe5c);_0x13a1ba(_0x227c52['error'](0x1f4,_0x28004e[_0x095a('0x14')]));});});}; \ No newline at end of file +var _0xe943=['catch','options','attributes','limit','include','model','map','GetCmHopperBlack','UpdateCmHopperBlack','CmHopperBlack','update','raw','destroy','where','DestroyCmHopperBlack','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','client','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0xe943,0x75));var _0x3e94=function(_0x367361,_0x311488){_0x367361=_0x367361-0x0;var _0x195d2d=_0xe943[_0x367361];return _0x195d2d;};'use strict';var _=require('lodash');var util=require(_0x3e94('0x0'));var moment=require(_0x3e94('0x1'));var BPromise=require(_0x3e94('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e94('0x3'));var db=require(_0x3e94('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e94('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3e94('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c37f8,_0x4f6095,_0x5b860e){return new BPromise(function(_0x59da97,_0x15ec5b){return client[_0x3e94('0x7')](_0x5c37f8,_0x5b860e)[_0x3e94('0x8')](function(_0x22f153){logger[_0x3e94('0x9')]('CmHopperBlack,\x20%s,\x20%s',_0x4f6095,_0x3e94('0xa'));logger[_0x3e94('0xb')](_0x3e94('0xc'),_0x4f6095,'request\x20sent',JSON[_0x3e94('0xd')](_0x22f153));if(_0x22f153[_0x3e94('0xe')]){if(_0x22f153[_0x3e94('0xe')][_0x3e94('0xf')]===0x1f4){logger[_0x3e94('0xe')](_0x3e94('0x10'),_0x4f6095,_0x22f153['error']['message']);return _0x15ec5b(_0x22f153[_0x3e94('0xe')][_0x3e94('0x11')]);}logger[_0x3e94('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x4f6095,_0x22f153[_0x3e94('0xe')][_0x3e94('0x11')]);return _0x59da97(_0x22f153[_0x3e94('0xe')]['message']);}else{logger[_0x3e94('0x9')](_0x3e94('0x10'),_0x4f6095,_0x3e94('0xa'));_0x59da97(_0x22f153[_0x3e94('0x12')][_0x3e94('0x11')]);}})[_0x3e94('0x13')](function(_0x418036){logger[_0x3e94('0xe')](_0x3e94('0x10'),_0x4f6095,_0x418036);_0x15ec5b(_0x418036);});});}exports['GetCmHopperBlack']=function(_0x26ff00){var _0x53cd35=this;return new Promise(function(_0x5252e8,_0x4c8ebb){return db['CmHopperBlack']['findAll']({'raw':_0x26ff00[_0x3e94('0x14')]?_0x26ff00[_0x3e94('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x26ff00[_0x3e94('0x14')]?_0x26ff00['options']['where']||null:null,'attributes':_0x26ff00['options']?_0x26ff00[_0x3e94('0x14')][_0x3e94('0x15')]||null:null,'limit':_0x26ff00[_0x3e94('0x14')]?_0x26ff00[_0x3e94('0x14')][_0x3e94('0x16')]||null:null,'include':_0x26ff00[_0x3e94('0x14')]?_0x26ff00[_0x3e94('0x14')][_0x3e94('0x17')]?_['map'](_0x26ff00[_0x3e94('0x14')]['include'],function(_0x33ab2d){return{'model':db[_0x33ab2d[_0x3e94('0x18')]],'as':_0x33ab2d['as'],'attributes':_0x33ab2d[_0x3e94('0x15')],'include':_0x33ab2d[_0x3e94('0x17')]?_['map'](_0x33ab2d['include'],function(_0x73dc56){return{'model':db[_0x73dc56['model']],'as':_0x73dc56['as'],'attributes':_0x73dc56['attributes'],'include':_0x73dc56[_0x3e94('0x17')]?_[_0x3e94('0x19')](_0x73dc56[_0x3e94('0x17')],function(_0x1a86e4){return{'model':db[_0x1a86e4[_0x3e94('0x18')]],'as':_0x1a86e4['as'],'attributes':_0x1a86e4[_0x3e94('0x15')]};}):[]};}):[]};}):[]:[]})[_0x3e94('0x8')](function(_0x10681d){logger['info'](_0x3e94('0x1a'),_0x26ff00);logger[_0x3e94('0xb')](_0x3e94('0x1a'),_0x26ff00,JSON[_0x3e94('0xd')](_0x10681d));_0x5252e8(_0x10681d);})[_0x3e94('0x13')](function(_0x29166b){logger['error'](_0x3e94('0x1a'),_0x29166b[_0x3e94('0x11')],_0x26ff00);_0x4c8ebb(_0x53cd35[_0x3e94('0xe')](0x1f4,_0x29166b[_0x3e94('0x11')]));});});};exports[_0x3e94('0x1b')]=function(_0x7d8081){var _0xd3e8e1=this;return new Promise(function(_0x3f1a08,_0x46503e){return db[_0x3e94('0x1c')][_0x3e94('0x1d')](_0x7d8081['body'],{'raw':_0x7d8081[_0x3e94('0x14')]?_0x7d8081['options'][_0x3e94('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7d8081[_0x3e94('0x14')]?_0x7d8081['options']['where']||null:null,'attributes':_0x7d8081['options']?_0x7d8081[_0x3e94('0x14')]['attributes']||null:null,'limit':_0x7d8081[_0x3e94('0x14')]?_0x7d8081['options'][_0x3e94('0x16')]||null:null})[_0x3e94('0x8')](function(_0x210645){logger[_0x3e94('0x9')](_0x3e94('0x1b'),_0x7d8081);logger['debug'](_0x3e94('0x1b'),_0x7d8081,JSON[_0x3e94('0xd')](_0x210645));_0x3f1a08(_0x210645);})[_0x3e94('0x13')](function(_0x582981){logger['error'](_0x3e94('0x1b'),_0x582981[_0x3e94('0x11')],_0x7d8081);_0x46503e(_0xd3e8e1[_0x3e94('0xe')](0x1f4,_0x582981[_0x3e94('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0x5995f6){var _0x16e1ad=this;return new Promise(function(_0x4d4c99,_0x850132){return db[_0x3e94('0x1c')][_0x3e94('0x1f')]({'where':_0x5995f6[_0x3e94('0x14')]?_0x5995f6[_0x3e94('0x14')][_0x3e94('0x20')]||null:null})[_0x3e94('0x8')](function(_0x1fccd0){logger[_0x3e94('0x9')]('DestroyCmHopperBlack',_0x5995f6);logger[_0x3e94('0xb')](_0x3e94('0x21'),_0x5995f6,JSON['stringify'](_0x1fccd0));_0x4d4c99(_0x1fccd0);})[_0x3e94('0x13')](function(_0x40f7e2){logger['error'](_0x3e94('0x21'),_0x40f7e2[_0x3e94('0x11')],_0x5995f6);_0x850132(_0x16e1ad['error'](0x1f4,_0x40f7e2[_0x3e94('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index c75ac29..169937f 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 _0xa46e=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','/:id','update','destroy','multer','util'];(function(_0x4e681d,_0x22fa7e){var _0x56c535=function(_0x211a81){while(--_0x211a81){_0x4e681d['push'](_0x4e681d['shift']());}};_0x56c535(++_0x22fa7e);}(_0xa46e,0x8a));var _0xea46=function(_0x492af5,_0xd51471){_0x492af5=_0x492af5-0x0;var _0x59f529=_0xa46e[_0x492af5];return _0x59f529;};'use strict';var multer=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var path=require('path');var timeout=require(_0xea46('0x2'));var express=require(_0xea46('0x3'));var router=express[_0xea46('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xea46('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea46('0x6'));var controller=require('./cmHopperBlack.controller');router[_0xea46('0x7')]('/',auth['isAuthenticated'](),controller[_0xea46('0x8')]);router[_0xea46('0x7')]('/describe',auth[_0xea46('0x9')](),controller[_0xea46('0xa')]);router[_0xea46('0x7')](_0xea46('0xb'),auth[_0xea46('0x9')](),controller['show']);router['put']('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0xc')]);router['delete'](_0xea46('0xb'),auth[_0xea46('0x9')](),controller[_0xea46('0xd')]);module['exports']=router; \ No newline at end of file +var _0xba34=['./cmHopperBlack.controller','get','isAuthenticated','index','describe','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x2fe301,_0x49a268){var _0x568b3d=function(_0x263943){while(--_0x263943){_0x2fe301['push'](_0x2fe301['shift']());}};_0x568b3d(++_0x49a268);}(_0xba34,0x119));var _0x4ba3=function(_0x3b95a9,_0xcd72c0){_0x3b95a9=_0x3b95a9-0x0;var _0x4bd589=_0xba34[_0x3b95a9];return _0x4bd589;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')]('/:id',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 8a8125e..e1df611 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 _0x33c5=['setDataValue','seconds','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0x5b160a,_0xe604f){var _0x4a6047=function(_0xee7b7c){while(--_0xee7b7c){_0x5b160a['push'](_0x5b160a['shift']());}};_0x4a6047(++_0xe604f);}(_0x33c5,0xad));var _0x533c=function(_0x47d6dc,_0xc036cc){_0x47d6dc=_0x47d6dc-0x0;var _0x1a1c93=_0x33c5[_0x47d6dc];return _0x1a1c93;};'use strict';var Sequelize=require(_0x533c('0x0'));var moment=require('moment');module[_0x533c('0x1')]={'state':{'type':Sequelize[_0x533c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x533c('0x3')]},'scheduledat':{'type':Sequelize[_0x533c('0x4')]},'countbusyretry':{'type':Sequelize[_0x533c('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x533c('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x533c('0x3')]},'originatecalleridname':{'type':Sequelize[_0x533c('0x3')]},'calleridnum':{'type':Sequelize[_0x533c('0x3')]},'calleridname':{'type':Sequelize[_0x533c('0x3')]},'starttime':{'type':Sequelize[_0x533c('0x4')]},'responsetime':{'type':Sequelize[_0x533c('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x533c('0x4')]},'endtime':{'type':Sequelize[_0x533c('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x533c('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x533c('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x533c('0x3')]},'campaign':{'type':Sequelize[_0x533c('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x533c('0x3')]},'disposition':{'type':Sequelize[_0x533c('0x3')]},'secondDisposition':{'type':Sequelize[_0x533c('0x3')]},'thirdDisposition':{'type':Sequelize[_0x533c('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x321157){var _0x3aa364=this[_0x533c('0x5')](_0x533c('0x6'));if(_0x3aa364&&_0x321157){this[_0x533c('0x7')]('followuptime',moment(_0x321157)['diff'](moment(_0x3aa364),_0x533c('0x8')));}}},'amd':{'type':Sequelize[_0x533c('0x9')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x533c('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x533c('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x533c('0x4')]},'callback':{'type':Sequelize[_0x533c('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x533c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x533c('0x4')]},'deleted':{'type':Sequelize[_0x533c('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x533c('0x4')]},'recallme':{'type':Sequelize[_0x533c('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x533c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x533c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x533c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x533c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9d46=['BOOLEAN','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds'];(function(_0x2ba0fd,_0x28fb94){var _0x147e20=function(_0x3e1791){while(--_0x3e1791){_0x2ba0fd['push'](_0x2ba0fd['shift']());}};_0x147e20(++_0x28fb94);}(_0x9d46,0xfe));var _0x69d4=function(_0x3def7f,_0x3af1d7){_0x3def7f=_0x3def7f-0x0;var _0xcbd22c=_0x9d46[_0x3def7f];return _0xcbd22c;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x69d4('0x0')]={'state':{'type':Sequelize[_0x69d4('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x69d4('0x2')]},'scheduledat':{'type':Sequelize[_0x69d4('0x3')]},'countbusyretry':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x69d4('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x69d4('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x69d4('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x69d4('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x69d4('0x3')]},'droptime':{'type':Sequelize[_0x69d4('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x69d4('0x2')]},'campaign':{'type':Sequelize[_0x69d4('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x69d4('0x2')]},'disposition':{'type':Sequelize[_0x69d4('0x2')]},'secondDisposition':{'type':Sequelize[_0x69d4('0x2')]},'thirdDisposition':{'type':Sequelize[_0x69d4('0x2')]},'dispositionat':{'type':Sequelize[_0x69d4('0x3')],'set':function(_0x3a942f){var _0x5016ca=this[_0x69d4('0x4')](_0x69d4('0x5'));if(_0x5016ca&&_0x3a942f){this[_0x69d4('0x6')](_0x69d4('0x7'),moment(_0x3a942f)[_0x69d4('0x8')](moment(_0x5016ca),_0x69d4('0x9')));}}},'amd':{'type':Sequelize[_0x69d4('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x69d4('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x69d4('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x69d4('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x69d4('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x69d4('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x69d4('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 39ae74d..2d54352 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 _0x71ab=['json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','CmHopperFinal','findAll','rows','catch','show','params','rawAttributes','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x203,\x201,\x20null','dropContacts','VoiceQueue','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','state','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x255dd3,_0x649846){var _0x57ebe8=function(_0x190bee){while(--_0x190bee){_0x255dd3['push'](_0x255dd3['shift']());}};_0x57ebe8(++_0x649846);}(_0x71ab,0x64));var _0xb71a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x71ab[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb71a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb71a('0x1'));var rp=require('request-promise');var moment=require(_0xb71a('0x2'));var BPromise=require(_0xb71a('0x3'));var Mustache=require(_0xb71a('0x4'));var util=require(_0xb71a('0x5'));var path=require(_0xb71a('0x6'));var sox=require(_0xb71a('0x7'));var csv=require(_0xb71a('0x8'));var ejs=require(_0xb71a('0x9'));var fs=require('fs');var fs_extra=require(_0xb71a('0xa'));var _=require(_0xb71a('0xb'));var squel=require(_0xb71a('0xc'));var crypto=require(_0xb71a('0xd'));var jsforce=require(_0xb71a('0xe'));var deskjs=require(_0xb71a('0xf'));var toCsv=require(_0xb71a('0x8'));var querystring=require(_0xb71a('0x10'));var Papa=require(_0xb71a('0x11'));var Redis=require(_0xb71a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb71a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb71a('0x14'));var logger=require(_0xb71a('0x15'))(_0xb71a('0x16'));var utils=require('../../config/utils');var config=require(_0xb71a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb71a('0x18'))['db'];function respondWithStatusCode(_0x50030d,_0x50b43b){_0x50b43b=_0x50b43b||0xcc;return function(_0x3346a5){if(_0x3346a5){return _0x50030d[_0xb71a('0x19')](_0x50b43b);}return _0x50030d[_0xb71a('0x1a')](_0x50b43b)[_0xb71a('0x1b')]();};}function respondWithResult(_0x483d77,_0x47ee48){_0x47ee48=_0x47ee48||0xc8;return function(_0x5364e3){if(_0x5364e3){return _0x483d77[_0xb71a('0x1a')](_0x47ee48)[_0xb71a('0x1c')](_0x5364e3);}};}function respondWithFilteredResult(_0x15252a,_0x42fc55){return function(_0x3cd0f0){if(_0x3cd0f0){var _0x1e9363=typeof _0x42fc55[_0xb71a('0x1d')]===_0xb71a('0x1e')&&typeof _0x42fc55[_0xb71a('0x1f')]==='undefined';var _0x1ca65e=_0x3cd0f0[_0xb71a('0x20')];var _0x374c8c=_0x1e9363?0x0:_0x42fc55[_0xb71a('0x1d')];var _0x2bdb61=_0x1e9363?_0x3cd0f0[_0xb71a('0x20')]:_0x42fc55[_0xb71a('0x1d')]+_0x42fc55[_0xb71a('0x1f')];var _0x20bdfe;if(_0x2bdb61>=_0x1ca65e){_0x2bdb61=_0x1ca65e;_0x20bdfe=0xc8;}else{_0x20bdfe=0xce;}_0x15252a[_0xb71a('0x1a')](_0x20bdfe);return _0x15252a[_0xb71a('0x21')]('Content-Range',_0x374c8c+'-'+_0x2bdb61+'/'+_0x1ca65e)['json'](_0x3cd0f0);}return null;};}function patchUpdates(_0x1358f2){return function(_0x578fe4){try{jsonpatch['apply'](_0x578fe4,_0x1358f2,!![]);}catch(_0x4d8871){return BPromise[_0xb71a('0x22')](_0x4d8871);}return _0x578fe4['save']();};}function saveUpdates(_0x76d6dc,_0x4227c7){return function(_0x3ac77b){if(_0x3ac77b){return _0x3ac77b[_0xb71a('0x23')](_0x76d6dc)[_0xb71a('0x24')](function(_0x14b2a1){return _0x14b2a1;});}return null;};}function removeEntity(_0x2f4fac,_0x14aac7){return function(_0x5f3f19){if(_0x5f3f19){return _0x5f3f19[_0xb71a('0x25')]()[_0xb71a('0x24')](function(){_0x2f4fac[_0xb71a('0x1a')](0xcc)[_0xb71a('0x1b')]();});}};}function handleEntityNotFound(_0x3401f7,_0x1a010d){return function(_0x20ed75){if(!_0x20ed75){_0x3401f7[_0xb71a('0x19')](0x194);}return _0x20ed75;};}function handleError(_0x31085b,_0x2a847a){_0x2a847a=_0x2a847a||0x1f4;return function(_0x45b849){logger[_0xb71a('0x26')](_0x45b849[_0xb71a('0x27')]);if(_0x45b849['name']){delete _0x45b849[_0xb71a('0x28')];}_0x31085b[_0xb71a('0x1a')](_0x2a847a)[_0xb71a('0x29')](_0x45b849);};}exports[_0xb71a('0x2a')]=function(_0x2fbd73,_0x38178c){var _0x44826e={},_0x25364c={},_0x42c086={'count':0x0,'rows':[]};var _0x421fcf=_[_0xb71a('0x2b')](db['CmHopperFinal']['rawAttributes'],function(_0x3112d3){return{'name':_0x3112d3['fieldName'],'type':_0x3112d3[_0xb71a('0x2c')][_0xb71a('0x2d')]};});_0x25364c['model']=_[_0xb71a('0x2b')](_0x421fcf,_0xb71a('0x28'));_0x25364c[_0xb71a('0x2e')]=_[_0xb71a('0x2f')](_0x2fbd73[_0xb71a('0x2e')]);_0x25364c[_0xb71a('0x30')]=_['intersection'](_0x25364c[_0xb71a('0x31')],_0x25364c[_0xb71a('0x2e')]);_0x44826e[_0xb71a('0x32')]=_[_0xb71a('0x33')](_0x25364c['model'],qs[_0xb71a('0x34')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x34')]));_0x44826e[_0xb71a('0x32')]=_0x44826e[_0xb71a('0x32')][_0xb71a('0x35')]?_0x44826e[_0xb71a('0x32')]:_0x25364c[_0xb71a('0x31')];if(!_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x36')]('nolimit')){_0x44826e['limit']=qs[_0xb71a('0x1f')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1f')]);_0x44826e[_0xb71a('0x1d')]=qs[_0xb71a('0x1d')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1d')]);}_0x44826e['order']=qs[_0xb71a('0x37')](_0x2fbd73['query'][_0xb71a('0x37')]);_0x44826e[_0xb71a('0x38')]=qs[_0xb71a('0x30')](_[_0xb71a('0x39')](_0x2fbd73['query'],_0x25364c[_0xb71a('0x30')]),_0x421fcf);if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]){_0x44826e[_0xb71a('0x38')]=_[_0xb71a('0x3b')](_0x44826e[_0xb71a('0x38')],{'$or':_[_0xb71a('0x2b')](_0x421fcf,function(_0x2756b9){if(_0x2756b9[_0xb71a('0x2c')]!=='VIRTUAL'){var _0x24a3af={};_0x24a3af[_0x2756b9['name']]={'$like':'%'+_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]+'%'};return _0x24a3af;}})});}_0x44826e=_[_0xb71a('0x3b')]({},_0x44826e,_0x2fbd73[_0xb71a('0x3c')]);var _0xce7b8a={'where':_0x44826e[_0xb71a('0x38')]};return db['CmHopperFinal']['count'](_0xce7b8a)['then'](function(_0x35fea9){_0x42c086['count']=_0x35fea9;if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x44826e[_0xb71a('0x3e')]=[{'all':!![]}];}return db[_0xb71a('0x3f')][_0xb71a('0x40')](_0x44826e);})[_0xb71a('0x24')](function(_0x59530a){_0x42c086[_0xb71a('0x41')]=_0x59530a;return _0x42c086;})[_0xb71a('0x24')](respondWithFilteredResult(_0x38178c,_0x44826e))[_0xb71a('0x42')](handleError(_0x38178c,null));};exports[_0xb71a('0x43')]=function(_0x7d305,_0x2f08d2){var _0x55cbca={'raw':!![],'where':{'id':_0x7d305[_0xb71a('0x44')]['id']}},_0x2afff3={};_0x2afff3[_0xb71a('0x31')]=_[_0xb71a('0x2f')](db[_0xb71a('0x3f')][_0xb71a('0x45')]);_0x2afff3[_0xb71a('0x2e')]=_['keys'](_0x7d305['query']);_0x2afff3[_0xb71a('0x30')]=_[_0xb71a('0x33')](_0x2afff3[_0xb71a('0x31')],_0x2afff3[_0xb71a('0x2e')]);_0x55cbca['attributes']=_[_0xb71a('0x33')](_0x2afff3['model'],qs[_0xb71a('0x34')](_0x7d305[_0xb71a('0x2e')]['fields']));_0x55cbca[_0xb71a('0x32')]=_0x55cbca[_0xb71a('0x32')][_0xb71a('0x35')]?_0x55cbca[_0xb71a('0x32')]:_0x2afff3['model'];if(_0x7d305[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x55cbca[_0xb71a('0x3e')]=[{'all':!![]}];}_0x55cbca=_['merge']({},_0x55cbca,_0x7d305[_0xb71a('0x3c')]);return db[_0xb71a('0x3f')][_0xb71a('0x46')](_0x55cbca)['then'](handleEntityNotFound(_0x2f08d2,null))[_0xb71a('0x24')](respondWithResult(_0x2f08d2,null))[_0xb71a('0x42')](handleError(_0x2f08d2,null));};exports[_0xb71a('0x47')]=function(_0x1f29b7,_0x365bed){return db['CmHopperFinal'][_0xb71a('0x47')]()[_0xb71a('0x24')](respondWithResult(_0x365bed,null))[_0xb71a('0x42')](handleError(_0x365bed,null));};exports[_0xb71a('0x23')]=function(_0x489c1f,_0x48fbde){if(_0x489c1f[_0xb71a('0x48')][_0xb71a('0x49')]){delete _0x489c1f[_0xb71a('0x48')][_0xb71a('0x49')];}return db[_0xb71a('0x3f')][_0xb71a('0x46')]({'where':{'uniqueid':_0x489c1f[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x48fbde,null))[_0xb71a('0x24')](saveUpdates(_0x489c1f[_0xb71a('0x48')],null))['then'](respondWithResult(_0x48fbde,null))[_0xb71a('0x42')](handleError(_0x48fbde,null));};exports[_0xb71a('0x4a')]=function(_0x500196,_0x1c0536,_0x58116c){return db[_0xb71a('0x3f')][_0xb71a('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x500196[_0xb71a('0x44')]['id']},'attributes':[[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x4d')))),_0xb71a('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0xb71a('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x50')))),_0xb71a('0x51')],[db['sequelize']['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x52')))),_0xb71a('0x53')],[db['sequelize']['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x54')))),'dropContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x55')))),_0xb71a('0x56')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x57')))),_0xb71a('0x58')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x59')))),_0xb71a('0x5a')]]})['then'](handleEntityNotFound(_0x1c0536,null))[_0xb71a('0x24')](respondWithResult(_0x1c0536,null))[_0xb71a('0x42')](handleError(_0x1c0536,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x181a9f,_0xe55672,_0x38de3a){return db[_0xb71a('0x3f')]['findAll']({'raw':![],'where':{'CampaignId':_0x181a9f[_0xb71a('0x44')]['id']},'attributes':[[db[_0xb71a('0x4b')]['fn']('COUNT',db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x4d')))),_0xb71a('0x4e')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x5b')))),'noAnswerContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x50')))),_0xb71a('0x51')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x52')))),_0xb71a('0x53')],[db['sequelize']['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb71a('0x5c')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x55')))),'abandonedContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x57')))),_0xb71a('0x58')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x59')))),_0xb71a('0x5a')]]})[_0xb71a('0x24')](handleEntityNotFound(_0xe55672,null))[_0xb71a('0x24')](respondWithResult(_0xe55672,null))['catch'](handleError(_0xe55672,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x15b8be,_0x2dd470,_0x38a8a1){return db[_0xb71a('0x5d')][_0xb71a('0x46')]({'where':{'id':_0x15b8be[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x2dd470,null))['then'](function(_0x45f4b2){var _0x27c15e;if(_0x45f4b2){_0x27c15e=squel['insert']()[_0xb71a('0x5e')](_0xb71a('0x5f'))[_0xb71a('0x60')](['phone',_0xb71a('0x61'),_0xb71a('0x62'),_0xb71a('0x63'),'VoiceQueueId',_0xb71a('0x64'),_0xb71a('0x65')],squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x68'),_0xb71a('0x69'))[_0xb71a('0x67')](_0xb71a('0x6a'),'scheduledAt')[_0xb71a('0x67')](_0xb71a('0x6b'),_0xb71a('0x62'))[_0xb71a('0x67')](_0xb71a('0x6c'),_0xb71a('0x63'))[_0xb71a('0x67')]('ANY_VALUE(VoiceQueueId)',_0xb71a('0x6d'))['field'](_0xb71a('0x6a'),_0xb71a('0x64'))['field'](_0xb71a('0x6a'),'updatedAt')[_0xb71a('0x6e')]('cm_hopper_final')[_0xb71a('0x38')](_0xb71a('0x6f'),_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x71'),_0x15b8be[_0xb71a('0x48')]['state'][_0xb71a('0x70')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x69'))['from'](_0xb71a('0x5f'))[_0xb71a('0x38')]('VoiceQueueId\x20=\x20?',_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]()))[_0xb71a('0x38')](_0xb71a('0x72'),squel[_0xb71a('0x66')]()[_0xb71a('0x67')]('calleridnum')[_0xb71a('0x6e')](_0xb71a('0x73'))[_0xb71a('0x38')](_0xb71a('0x6f'),_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x74')))[_0xb71a('0x75')]('ContactId'))[_0xb71a('0x70')]();return db[_0xb71a('0x4b')][_0xb71a('0x2e')](_0x27c15e);}return[];})['then'](respondWithResult(_0x2dd470,null))[_0xb71a('0x42')](handleError(_0x2dd470,null));};exports[_0xb71a('0x76')]=function(_0x28bc74,_0x575a0a,_0x1a658e){return db[_0xb71a('0x77')]['find']({'where':{'id':_0x28bc74[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x575a0a,null))[_0xb71a('0x24')](function(_0x21b9b5){var _0x4abfd6;if(_0x21b9b5){_0x4abfd6=squel[_0xb71a('0x78')]()[_0xb71a('0x5e')](_0xb71a('0x5f'))[_0xb71a('0x60')](['phone',_0xb71a('0x61'),_0xb71a('0x62'),'ListId',_0xb71a('0x79'),_0xb71a('0x64'),'updatedAt'],squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x68'),'phone')[_0xb71a('0x67')](_0xb71a('0x6a'),_0xb71a('0x61'))[_0xb71a('0x67')](_0xb71a('0x6b'),_0xb71a('0x62'))[_0xb71a('0x67')](_0xb71a('0x6c'),_0xb71a('0x63'))['field']('ANY_VALUE(CampaignId)',_0xb71a('0x79'))[_0xb71a('0x67')](_0xb71a('0x6a'),_0xb71a('0x64'))[_0xb71a('0x67')](_0xb71a('0x6a'),'updatedAt')[_0xb71a('0x6e')]('cm_hopper_final')[_0xb71a('0x38')]('CampaignId\x20=\x20?',_0x28bc74[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x71'),_0x28bc74[_0xb71a('0x48')][_0xb71a('0x7a')][_0xb71a('0x70')]())[_0xb71a('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xb71a('0x38')](_0xb71a('0x72'),squel['select']()[_0xb71a('0x67')](_0xb71a('0x69'))['from'](_0xb71a('0x5f'))[_0xb71a('0x38')](_0xb71a('0x7b'),_0x28bc74['params']['id'][_0xb71a('0x70')]()))[_0xb71a('0x38')](_0xb71a('0x72'),squel['select']()[_0xb71a('0x67')](_0xb71a('0x7c'))[_0xb71a('0x6e')](_0xb71a('0x73'))[_0xb71a('0x38')]('CampaignId\x20=\x20?',_0x28bc74[_0xb71a('0x44')]['id']['toString']())[_0xb71a('0x38')](_0xb71a('0x74')))[_0xb71a('0x75')]('ContactId'))['toString']();return db[_0xb71a('0x4b')][_0xb71a('0x2e')](_0x4abfd6);}return[];})[_0xb71a('0x24')](respondWithResult(_0x575a0a,null))[_0xb71a('0x42')](handleError(_0x575a0a,null));};exports[_0xb71a('0x7d')]=function(_0x18dfb3,_0x38ffc1,_0x442ec0){return db[_0xb71a('0x7e')][_0xb71a('0x7f')]({'where':{'VoiceQueueId':_0x18dfb3[_0xb71a('0x48')][_0xb71a('0x6d')],'CampaignId':_0x18dfb3[_0xb71a('0x48')][_0xb71a('0x79')],'ContactId':_0x18dfb3[_0xb71a('0x48')]['ContactId']}})[_0xb71a('0x24')](handleEntityNotFound(_0x38ffc1,null))[_0xb71a('0x24')](function(_0x243c90){if(_0x243c90){return _0x243c90;}return null;})['then'](respondWithResult(_0x38ffc1,null))['catch'](handleError(_0x38ffc1,null));}; \ No newline at end of file +var _0xadb5=['`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','VoiceQueue','find','insert','cm_hopper','fromQuery','phone','ContactId','ListId','createdAt','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','Campaign','into','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','VoiceQueueId','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','CmHopperFinal','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts'];(function(_0x50a4a4,_0x366a00){var _0x2d4444=function(_0x94408d){while(--_0x94408d){_0x50a4a4['push'](_0x50a4a4['shift']());}};_0x2d4444(++_0x366a00);}(_0xadb5,0xad));var _0x5adb=function(_0x18b682,_0xfc7e60){_0x18b682=_0x18b682-0x0;var _0x18d993=_0xadb5[_0x18b682];return _0x18d993;};'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['CmHopperFinal']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':!![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')]()['then'](respondWithResult(_0x3a5409,null))[_0x5adb('0x42')](handleError(_0x3a5409,null));};exports['update']=function(_0x51bc49,_0x5015ee){if(_0x51bc49[_0x5adb('0x47')][_0x5adb('0x48')]){delete _0x51bc49[_0x5adb('0x47')]['uniqueid'];}return db[_0x5adb('0x2a')]['find']({'where':{'uniqueid':_0x51bc49[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x5015ee,null))[_0x5adb('0x22')](saveUpdates(_0x51bc49['body'],null))[_0x5adb('0x22')](respondWithResult(_0x5015ee,null))['catch'](handleError(_0x5015ee,null));};exports[_0x5adb('0x49')]=function(_0x6dc067,_0x55c535,_0x2402a3){return db[_0x5adb('0x2a')][_0x5adb('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x6dc067[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x4c')))),'noSuchContacts'],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize'][_0x5adb('0x4b')](_0x5adb('0x4e')))),_0x5adb('0x4f')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x52')))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),_0x5adb('0x58')],[db[_0x5adb('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})['then'](handleEntityNotFound(_0x55c535,null))[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x42')](handleError(_0x55c535,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x5cb50e,_0x476e62,_0x1505f7){return db['CmHopperFinal'][_0x5adb('0x40')]({'raw':![],'where':{'CampaignId':_0x5cb50e[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x4c')))),_0x5adb('0x5b')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0x5adb('0x4f')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})[_0x5adb('0x22')](handleEntityNotFound(_0x476e62,null))[_0x5adb('0x22')](respondWithResult(_0x476e62,null))[_0x5adb('0x42')](handleError(_0x476e62,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x5e55c2,_0x1fc73b,_0x56df90){return db[_0x5adb('0x5c')][_0x5adb('0x5d')]({'where':{'id':_0x5e55c2[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x1fc73b,null))[_0x5adb('0x22')](function(_0x236f59){var _0x338aee;if(_0x236f59){_0x338aee=squel[_0x5adb('0x5e')]()['into'](_0x5adb('0x5f'))[_0x5adb('0x60')]([_0x5adb('0x61'),'scheduledAt',_0x5adb('0x62'),_0x5adb('0x63'),'VoiceQueueId',_0x5adb('0x64'),'updatedAt'],squel[_0x5adb('0x65')]()[_0x5adb('0x66')]('ANY_VALUE(calleridnum)',_0x5adb('0x61'))[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')]('ANY_VALUE(ListId)',_0x5adb('0x63'))[_0x5adb('0x66')](_0x5adb('0x6a'),'VoiceQueueId')['field'](_0x5adb('0x67'),'createdAt')[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x6b'))['from'](_0x5adb('0x6c'))[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())['where'](_0x5adb('0x6f'),_0x5e55c2[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())['where'](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x61'))[_0x5adb('0x73')]('cm_hopper')[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2['params']['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5adb('0x65')]()['field'](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')]('VoiceQueueId\x20=\x20?',_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')]('ContactId'))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')][_0x5adb('0x2f')](_0x338aee);}return[];})[_0x5adb('0x22')](respondWithResult(_0x1fc73b,null))['catch'](handleError(_0x1fc73b,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x3f3db9,_0x461a07,_0x2e5c96){return db[_0x5adb('0x77')][_0x5adb('0x5d')]({'where':{'id':_0x3f3db9[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x461a07,null))['then'](function(_0xda26cc){var _0x14bada;if(_0xda26cc){_0x14bada=squel[_0x5adb('0x5e')]()[_0x5adb('0x78')]('cm_hopper')[_0x5adb('0x60')]([_0x5adb('0x61'),_0x5adb('0x68'),_0x5adb('0x62'),_0x5adb('0x63'),_0x5adb('0x79'),_0x5adb('0x64'),_0x5adb('0x6b')],squel[_0x5adb('0x65')]()['field'](_0x5adb('0x7a'),_0x5adb('0x61'))['field'](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')](_0x5adb('0x7b'),_0x5adb('0x63'))['field'](_0x5adb('0x7c'),_0x5adb('0x79'))['field'](_0x5adb('0x67'),_0x5adb('0x64'))[_0x5adb('0x66')]('NOW()','updatedAt')[_0x5adb('0x73')](_0x5adb('0x6c'))[_0x5adb('0x37')]('CampaignId\x20=\x20?',_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x6f'),_0x3f3db9[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()['field']('phone')[_0x5adb('0x73')](_0x5adb('0x5f'))['where'](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id']['toString']())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')](_0x5adb('0x62')))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')]['query'](_0x14bada);}return[];})[_0x5adb('0x22')](respondWithResult(_0x461a07,null))[_0x5adb('0x42')](handleError(_0x461a07,null));};exports[_0x5adb('0x7e')]=function(_0x1e5532,_0x2c3af8,_0x3a201a){return db[_0x5adb('0x7f')][_0x5adb('0x80')]({'where':{'VoiceQueueId':_0x1e5532[_0x5adb('0x47')][_0x5adb('0x81')],'CampaignId':_0x1e5532['body'][_0x5adb('0x79')],'ContactId':_0x1e5532['body'][_0x5adb('0x62')]}})[_0x5adb('0x22')](handleEntityNotFound(_0x2c3af8,null))[_0x5adb('0x22')](function(_0x193a29){if(_0x193a29){return _0x193a29;}return null;})[_0x5adb('0x22')](respondWithResult(_0x2c3af8,null))['catch'](handleError(_0x2c3af8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 8790697..87c14bc 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 _0x3bb9=['define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','./cmHopperFinal.attributes','exports'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x3bb9,0x12b));var _0x93bb=function(_0x2674ee,_0x54afc9){_0x2674ee=_0x2674ee-0x0;var _0x193c8f=_0x3bb9[_0x2674ee];return _0x193c8f;};'use strict';var _=require(_0x93bb('0x0'));var util=require(_0x93bb('0x1'));var logger=require(_0x93bb('0x2'))(_0x93bb('0x3'));var moment=require(_0x93bb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x93bb('0x5'));var rimraf=require(_0x93bb('0x6'));var config=require('../../config/environment');var attributes=require(_0x93bb('0x7'));module[_0x93bb('0x8')]=function(_0x890cc8,_0xeba256){return _0x890cc8[_0x93bb('0x9')](_0x93bb('0xa'),attributes,{'tableName':_0x93bb('0xb'),'paranoid':![],'indexes':[{'name':_0x93bb('0xc'),'fields':['calleridnum']},{'name':_0x93bb('0xd'),'fields':[_0x93bb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa2b7=['uniqueid','lodash','util','../../config/logger','api','moment','path','../../config/environment','exports','define','cm_hopper_final','calleridnum'];(function(_0x51a84c,_0x5eae5e){var _0x288f27=function(_0x5b7f7c){while(--_0x5b7f7c){_0x51a84c['push'](_0x51a84c['shift']());}};_0x288f27(++_0x5eae5e);}(_0xa2b7,0x1c9));var _0x7a2b=function(_0x18f76d,_0x534402){_0x18f76d=_0x18f76d-0x0;var _0xb70ebd=_0xa2b7[_0x18f76d];return _0xb70ebd;};'use strict';var _=require(_0x7a2b('0x0'));var util=require(_0x7a2b('0x1'));var logger=require(_0x7a2b('0x2'))(_0x7a2b('0x3'));var moment=require(_0x7a2b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a2b('0x5'));var rimraf=require('rimraf');var config=require(_0x7a2b('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0x7a2b('0x7')]=function(_0x236a70,_0x1155dd){return _0x236a70[_0x7a2b('0x8')]('CmHopperFinal',attributes,{'tableName':_0x7a2b('0x9'),'paranoid':![],'indexes':[{'name':_0x7a2b('0xa'),'fields':[_0x7a2b('0xa')]},{'name':_0x7a2b('0xb'),'fields':[_0x7a2b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 666672d..36a3553 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(_0x2bbfb9,_0x43c15b){var _0x329422=function(_0x538498){while(--_0x538498){_0x2bbfb9['push'](_0x2bbfb9['shift']());}};_0x329422(++_0x43c15b);}(_0x7a54,0x106));var _0x47a5=function(_0x1777e3,_0x1f2c2a){_0x1777e3=_0x1777e3-0x0;var _0x31f436=_0x7a54[_0x1777e3];return _0x31f436;};'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 _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x27b45e,_0x25a138){var _0x2b6522=function(_0x286a4d){while(--_0x286a4d){_0x27b45e['push'](_0x27b45e['shift']());}};_0x2b6522(++_0x25a138);}(_0xb10b,0x12a));var _0xbb10=function(_0x30eb36,_0x4f7dab){_0x30eb36=_0x30eb36-0x0;var _0x1b33d1=_0xb10b[_0x30eb36];return _0x1b33d1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 039de87..aa4d4f8 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 _0x130b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','describe','/:id','isAuthenticated','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','exports'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0x130b,0x187));var _0xb130=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x130b[_0x31e29a];return _0x32d892;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb130('0x0'));var timeout=require(_0xb130('0x1'));var express=require(_0xb130('0x2'));var router=express[_0xb130('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb130('0x4'));var config=require(_0xb130('0x5'));var controller=require(_0xb130('0x6'));router[_0xb130('0x7')]('/',auth['isAuthenticated'](),controller[_0xb130('0x8')]);router[_0xb130('0x7')](_0xb130('0x9'),auth['isAuthenticated'](),controller[_0xb130('0xa')]);router['get'](_0xb130('0xb'),auth[_0xb130('0xc')](),controller['show']);router[_0xb130('0x7')](_0xb130('0xd'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0xb130('0x7')](_0xb130('0xe'),auth[_0xb130('0xc')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xb130('0xf')](_0xb130('0x10'),auth[_0xb130('0xc')](),controller[_0xb130('0x11')]);router[_0xb130('0xf')](_0xb130('0x12'),auth[_0xb130('0xc')](),controller[_0xb130('0x13')]);router['post'](_0xb130('0x14'),auth['isAuthenticated'](),controller[_0xb130('0x15')]);router['put'](_0xb130('0xb'),auth['isAuthenticated'](),controller['update']);module[_0xb130('0x16')]=router; \ No newline at end of file +var _0x1a22=['./cmHopperFinal.controller','get','isAuthenticated','index','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1cc408,_0x30d40a){var _0x5d0d1a=function(_0x4cd765){while(--_0x4cd765){_0x1cc408['push'](_0x1cc408['shift']());}};_0x5d0d1a(++_0x30d40a);}(_0x1a22,0x125));var _0x21a2=function(_0x38db77,_0x18239f){_0x38db77=_0x38db77-0x0;var _0x916e60=_0x1a22[_0x38db77];return _0x916e60;};'use strict';var multer=require(_0x21a2('0x0'));var util=require(_0x21a2('0x1'));var path=require('path');var timeout=require(_0x21a2('0x2'));var express=require(_0x21a2('0x3'));var router=express[_0x21a2('0x4')]();var fs_extra=require(_0x21a2('0x5'));var auth=require(_0x21a2('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x21a2('0x7'));router[_0x21a2('0x8')]('/',auth[_0x21a2('0x9')](),controller[_0x21a2('0xa')]);router[_0x21a2('0x8')]('/describe',auth[_0x21a2('0x9')](),controller['describe']);router[_0x21a2('0x8')](_0x21a2('0xb'),auth[_0x21a2('0x9')](),controller[_0x21a2('0xc')]);router['get'](_0x21a2('0xd'),auth[_0x21a2('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0x21a2('0xe'),auth[_0x21a2('0x9')](),controller[_0x21a2('0xf')]);router[_0x21a2('0x10')](_0x21a2('0x11'),auth['isAuthenticated'](),controller[_0x21a2('0x12')]);router[_0x21a2('0x10')](_0x21a2('0x13'),auth['isAuthenticated'](),controller[_0x21a2('0x14')]);router[_0x21a2('0x10')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0x21a2('0x15')]);router[_0x21a2('0x16')](_0x21a2('0xb'),auth[_0x21a2('0x9')](),controller[_0x21a2('0x17')]);module[_0x21a2('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index feb70d9..96a44ae 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 _0x8ad3=['DATE','BOOLEAN','sequelize','INTEGER','STRING'];(function(_0x334e99,_0x34b383){var _0x46d6a2=function(_0x1faeb1){while(--_0x1faeb1){_0x334e99['push'](_0x334e99['shift']());}};_0x46d6a2(++_0x34b383);}(_0x8ad3,0xe8));var _0x38ad=function(_0xab9727,_0x5d287c){_0xab9727=_0xab9727-0x0;var _0x185615=_0x8ad3[_0xab9727];return _0x185615;};'use strict';var Sequelize=require(_0x38ad('0x0'));module['exports']={'state':{'type':Sequelize[_0x38ad('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x38ad('0x2')]},'scheduledat':{'type':Sequelize[_0x38ad('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x38ad('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x38ad('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x38ad('0x3')]},'answertime':{'type':Sequelize[_0x38ad('0x3')]},'droptime':{'type':Sequelize[_0x38ad('0x3')]},'endtime':{'type':Sequelize[_0x38ad('0x3')]},'ringtime':{'type':Sequelize[_0x38ad('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x38ad('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x38ad('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x38ad('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x38ad('0x2')]},'campaign':{'type':Sequelize[_0x38ad('0x2')]},'campaigntype':{'type':Sequelize[_0x38ad('0x2')]},'membername':{'type':Sequelize[_0x38ad('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x38ad('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x38ad('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x38ad('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x38ad('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x38ad('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x38ad('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x38ad('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x38ad('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x38ad('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x38ad('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x38ad('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x38ad('0x2')]}}; \ No newline at end of file +var _0x9e2e=['INTEGER','DATE','STRING','BOOLEAN','sequelize','exports'];(function(_0x59b9c4,_0x1a853d){var _0x43893e=function(_0x2657ff){while(--_0x2657ff){_0x59b9c4['push'](_0x59b9c4['shift']());}};_0x43893e(++_0x1a853d);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x58006e,_0x6c6cc1){_0x58006e=_0x58006e-0x0;var _0x2c07de=_0x9e2e[_0x58006e];return _0x2c07de;};'use strict';var Sequelize=require(_0xe9e2('0x0'));module[_0xe9e2('0x1')]={'state':{'type':Sequelize[_0xe9e2('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xe9e2('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe9e2('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xe9e2('0x4')]},'originatecalleridname':{'type':Sequelize[_0xe9e2('0x4')]},'calleridnum':{'type':Sequelize[_0xe9e2('0x4')]},'calleridname':{'type':Sequelize[_0xe9e2('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xe9e2('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xe9e2('0x3')]},'endtime':{'type':Sequelize[_0xe9e2('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe9e2('0x4')]},'campaign':{'type':Sequelize[_0xe9e2('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xe9e2('0x4')]},'amd':{'type':Sequelize[_0xe9e2('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe9e2('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe9e2('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xe9e2('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xe9e2('0x3')]},'edited':{'type':Sequelize[_0xe9e2('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe9e2('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe9e2('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 8dfb0cb..746325d 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 _0xdb40=['moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','save','update','then','destroy','end','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','uniqueid','eml-format','zip-dir','fast-json-patch'];(function(_0x6a4d8f,_0x1fce8c){var _0x4844ca=function(_0xa3f757){while(--_0xa3f757){_0x6a4d8f['push'](_0x6a4d8f['shift']());}};_0x4844ca(++_0x1fce8c);}(_0xdb40,0x1c5));var _0x0db4=function(_0x3eafb3,_0x31dce9){_0x3eafb3=_0x3eafb3-0x0;var _0x5347f8=_0xdb40[_0x3eafb3];return _0x5347f8;};'use strict';var emlformat=require(_0x0db4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0db4('0x1'));var jsonpatch=require(_0x0db4('0x2'));var rp=require('request-promise');var moment=require(_0x0db4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0db4('0x4'));var util=require(_0x0db4('0x5'));var path=require(_0x0db4('0x6'));var sox=require(_0x0db4('0x7'));var csv=require(_0x0db4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0db4('0x9'));var _=require(_0x0db4('0xa'));var squel=require(_0x0db4('0xb'));var crypto=require('crypto');var jsforce=require(_0x0db4('0xc'));var deskjs=require(_0x0db4('0xd'));var toCsv=require(_0x0db4('0x8'));var querystring=require(_0x0db4('0xe'));var Papa=require(_0x0db4('0xf'));var Redis=require(_0x0db4('0x10'));var authService=require(_0x0db4('0x11'));var qs=require(_0x0db4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0db4('0x13'));var logger=require('../../config/logger')(_0x0db4('0x14'));var utils=require(_0x0db4('0x15'));var config=require(_0x0db4('0x16'));var licenseUtil=require(_0x0db4('0x17'));var db=require(_0x0db4('0x18'))['db'];function respondWithStatusCode(_0x2eea8f,_0x521cfe){_0x521cfe=_0x521cfe||0xcc;return function(_0x1f7e8a){if(_0x1f7e8a){return _0x2eea8f[_0x0db4('0x19')](_0x521cfe);}return _0x2eea8f[_0x0db4('0x1a')](_0x521cfe)['end']();};}function respondWithResult(_0x1c01f5,_0x3e3229){_0x3e3229=_0x3e3229||0xc8;return function(_0x3b2707){if(_0x3b2707){return _0x1c01f5['status'](_0x3e3229)[_0x0db4('0x1b')](_0x3b2707);}};}function respondWithFilteredResult(_0xb85bac,_0x51efc2){return function(_0x1ed7a9){if(_0x1ed7a9){var _0x48ac32=typeof _0x51efc2['offset']===_0x0db4('0x1c')&&typeof _0x51efc2[_0x0db4('0x1d')]==='undefined';var _0x2ba8ae=_0x1ed7a9['count'];var _0xadc7cd=_0x48ac32?0x0:_0x51efc2[_0x0db4('0x1e')];var _0xd980d4=_0x48ac32?_0x1ed7a9['count']:_0x51efc2[_0x0db4('0x1e')]+_0x51efc2['limit'];var _0xdb04d1;if(_0xd980d4>=_0x2ba8ae){_0xd980d4=_0x2ba8ae;_0xdb04d1=0xc8;}else{_0xdb04d1=0xce;}_0xb85bac[_0x0db4('0x1a')](_0xdb04d1);return _0xb85bac[_0x0db4('0x1f')]('Content-Range',_0xadc7cd+'-'+_0xd980d4+'/'+_0x2ba8ae)['json'](_0x1ed7a9);}return null;};}function patchUpdates(_0x57847d){return function(_0x146ecd){try{jsonpatch['apply'](_0x146ecd,_0x57847d,!![]);}catch(_0x301631){return BPromise['reject'](_0x301631);}return _0x146ecd[_0x0db4('0x20')]();};}function saveUpdates(_0x51a3db,_0x2876de){return function(_0x146580){if(_0x146580){return _0x146580[_0x0db4('0x21')](_0x51a3db)[_0x0db4('0x22')](function(_0x2fd092){return _0x2fd092;});}return null;};}function removeEntity(_0x14fd88,_0x1d4ca0){return function(_0x42ed59){if(_0x42ed59){return _0x42ed59[_0x0db4('0x23')]()['then'](function(){_0x14fd88[_0x0db4('0x1a')](0xcc)[_0x0db4('0x24')]();});}};}function handleEntityNotFound(_0x4d0172,_0x3a1df6){return function(_0x303a17){if(!_0x303a17){_0x4d0172[_0x0db4('0x19')](0x194);}return _0x303a17;};}function handleError(_0x33ccbd,_0x26d8c8){_0x26d8c8=_0x26d8c8||0x1f4;return function(_0x4793f6){logger['error'](_0x4793f6[_0x0db4('0x25')]);if(_0x4793f6[_0x0db4('0x26')]){delete _0x4793f6[_0x0db4('0x26')];}_0x33ccbd[_0x0db4('0x1a')](_0x26d8c8)[_0x0db4('0x27')](_0x4793f6);};}exports[_0x0db4('0x28')]=function(_0x99f8c5,_0x864f58){var _0x812b83={},_0x59ea03={},_0x214161={'count':0x0,'rows':[]};var _0x30e432=_[_0x0db4('0x29')](db[_0x0db4('0x2a')][_0x0db4('0x2b')],function(_0x2c8b0a){return{'name':_0x2c8b0a[_0x0db4('0x2c')],'type':_0x2c8b0a['type'][_0x0db4('0x2d')]};});_0x59ea03[_0x0db4('0x2e')]=_[_0x0db4('0x29')](_0x30e432,_0x0db4('0x26'));_0x59ea03['query']=_['keys'](_0x99f8c5[_0x0db4('0x2f')]);_0x59ea03[_0x0db4('0x30')]=_[_0x0db4('0x31')](_0x59ea03[_0x0db4('0x2e')],_0x59ea03[_0x0db4('0x2f')]);_0x812b83[_0x0db4('0x32')]=_[_0x0db4('0x31')](_0x59ea03['model'],qs['fields'](_0x99f8c5[_0x0db4('0x2f')][_0x0db4('0x33')]));_0x812b83[_0x0db4('0x32')]=_0x812b83[_0x0db4('0x32')][_0x0db4('0x34')]?_0x812b83[_0x0db4('0x32')]:_0x59ea03[_0x0db4('0x2e')];if(!_0x99f8c5[_0x0db4('0x2f')][_0x0db4('0x35')](_0x0db4('0x36'))){_0x812b83[_0x0db4('0x1d')]=qs[_0x0db4('0x1d')](_0x99f8c5[_0x0db4('0x2f')][_0x0db4('0x1d')]);_0x812b83['offset']=qs['offset'](_0x99f8c5[_0x0db4('0x2f')][_0x0db4('0x1e')]);}_0x812b83[_0x0db4('0x37')]=qs[_0x0db4('0x38')](_0x99f8c5[_0x0db4('0x2f')][_0x0db4('0x38')]);_0x812b83[_0x0db4('0x39')]=qs['filters'](_['pick'](_0x99f8c5[_0x0db4('0x2f')],_0x59ea03[_0x0db4('0x30')]),_0x30e432);if(_0x99f8c5[_0x0db4('0x2f')][_0x0db4('0x3a')]){_0x812b83['where']=_[_0x0db4('0x3b')](_0x812b83[_0x0db4('0x39')],{'$or':_[_0x0db4('0x29')](_0x30e432,function(_0x146c03){if(_0x146c03['type']!==_0x0db4('0x3c')){var _0x296393={};_0x296393[_0x146c03[_0x0db4('0x26')]]={'$like':'%'+_0x99f8c5[_0x0db4('0x2f')][_0x0db4('0x3a')]+'%'};return _0x296393;}})});}_0x812b83=_[_0x0db4('0x3b')]({},_0x812b83,_0x99f8c5['options']);var _0x55d149={'where':_0x812b83['where']};return db[_0x0db4('0x2a')][_0x0db4('0x3d')](_0x55d149)[_0x0db4('0x22')](function(_0x967b89){_0x214161[_0x0db4('0x3d')]=_0x967b89;if(_0x99f8c5[_0x0db4('0x2f')][_0x0db4('0x3e')]){_0x812b83[_0x0db4('0x3f')]=[{'all':!![]}];}return db[_0x0db4('0x2a')][_0x0db4('0x40')](_0x812b83);})[_0x0db4('0x22')](function(_0x31601c){_0x214161[_0x0db4('0x41')]=_0x31601c;return _0x214161;})['then'](respondWithFilteredResult(_0x864f58,_0x812b83))[_0x0db4('0x42')](handleError(_0x864f58,null));};exports[_0x0db4('0x43')]=function(_0x46adc4,_0x1b804a){var _0x1350a8={'raw':!![],'where':{'id':_0x46adc4[_0x0db4('0x44')]['id']}},_0x3ca9c8={};_0x3ca9c8[_0x0db4('0x2e')]=_['keys'](db[_0x0db4('0x2a')][_0x0db4('0x2b')]);_0x3ca9c8[_0x0db4('0x2f')]=_[_0x0db4('0x45')](_0x46adc4[_0x0db4('0x2f')]);_0x3ca9c8['filters']=_[_0x0db4('0x31')](_0x3ca9c8['model'],_0x3ca9c8[_0x0db4('0x2f')]);_0x1350a8['attributes']=_[_0x0db4('0x31')](_0x3ca9c8[_0x0db4('0x2e')],qs[_0x0db4('0x33')](_0x46adc4[_0x0db4('0x2f')][_0x0db4('0x33')]));_0x1350a8[_0x0db4('0x32')]=_0x1350a8['attributes']['length']?_0x1350a8[_0x0db4('0x32')]:_0x3ca9c8[_0x0db4('0x2e')];if(_0x46adc4['query'][_0x0db4('0x3e')]){_0x1350a8[_0x0db4('0x3f')]=[{'all':!![]}];}_0x1350a8=_['merge']({},_0x1350a8,_0x46adc4[_0x0db4('0x46')]);return db[_0x0db4('0x2a')][_0x0db4('0x47')](_0x1350a8)['then'](handleEntityNotFound(_0x1b804a,null))[_0x0db4('0x22')](respondWithResult(_0x1b804a,null))[_0x0db4('0x42')](handleError(_0x1b804a,null));};exports['create']=function(_0x3afdcf,_0x1bd0a1){return db['CmHopperHistory'][_0x0db4('0x48')](_0x3afdcf[_0x0db4('0x49')],{})[_0x0db4('0x22')](respondWithResult(_0x1bd0a1,0xc9))[_0x0db4('0x42')](handleError(_0x1bd0a1,null));};exports[_0x0db4('0x4a')]=function(_0x4155bf,_0x4d0245){return db[_0x0db4('0x2a')][_0x0db4('0x4a')]()[_0x0db4('0x22')](respondWithResult(_0x4d0245,null))[_0x0db4('0x42')](handleError(_0x4d0245,null));};exports[_0x0db4('0x21')]=function(_0x28a3ed,_0x23bcfa){if(_0x28a3ed[_0x0db4('0x49')][_0x0db4('0x4b')]){delete _0x28a3ed[_0x0db4('0x49')][_0x0db4('0x4b')];}return db[_0x0db4('0x2a')][_0x0db4('0x47')]({'where':{'uniqueid':_0x28a3ed[_0x0db4('0x44')]['id']}})[_0x0db4('0x22')](handleEntityNotFound(_0x23bcfa,null))['then'](saveUpdates(_0x28a3ed[_0x0db4('0x49')],null))['then'](respondWithResult(_0x23bcfa,null))[_0x0db4('0x42')](handleError(_0x23bcfa,null));}; \ No newline at end of file +var _0x80ab=['error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','reject','save','update','then'];(function(_0x4ef7e2,_0x257e37){var _0x84fa8=function(_0x2c967b){while(--_0x2c967b){_0x4ef7e2['push'](_0x4ef7e2['shift']());}};_0x84fa8(++_0x257e37);}(_0x80ab,0x18a));var _0xb80a=function(_0x3d9edb,_0x343e9c){_0x3d9edb=_0x3d9edb-0x0;var _0xede284=_0x80ab[_0x3d9edb];return _0xede284;};'use strict';var emlformat=require(_0xb80a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb80a('0x1'));var jsonpatch=require(_0xb80a('0x2'));var rp=require('request-promise');var moment=require(_0xb80a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb80a('0x4'));var util=require(_0xb80a('0x5'));var path=require(_0xb80a('0x6'));var sox=require('sox');var csv=require(_0xb80a('0x7'));var ejs=require(_0xb80a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb80a('0x9'));var squel=require(_0xb80a('0xa'));var crypto=require(_0xb80a('0xb'));var jsforce=require(_0xb80a('0xc'));var deskjs=require(_0xb80a('0xd'));var toCsv=require(_0xb80a('0x7'));var querystring=require(_0xb80a('0xe'));var Papa=require(_0xb80a('0xf'));var Redis=require(_0xb80a('0x10'));var authService=require(_0xb80a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb80a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb80a('0x13'))(_0xb80a('0x14'));var utils=require(_0xb80a('0x15'));var config=require(_0xb80a('0x16'));var licenseUtil=require(_0xb80a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20e756,_0x27ebf1){_0x27ebf1=_0x27ebf1||0xcc;return function(_0x566703){if(_0x566703){return _0x20e756[_0xb80a('0x18')](_0x27ebf1);}return _0x20e756['status'](_0x27ebf1)[_0xb80a('0x19')]();};}function respondWithResult(_0x50d379,_0x4d9991){_0x4d9991=_0x4d9991||0xc8;return function(_0x3fd80e){if(_0x3fd80e){return _0x50d379['status'](_0x4d9991)['json'](_0x3fd80e);}};}function respondWithFilteredResult(_0x2d7ba0,_0x3f02ad){return function(_0xea6c1c){if(_0xea6c1c){var _0x108390=typeof _0x3f02ad['offset']===_0xb80a('0x1a')&&typeof _0x3f02ad[_0xb80a('0x1b')]===_0xb80a('0x1a');var _0x133cb9=_0xea6c1c[_0xb80a('0x1c')];var _0x5bd8f4=_0x108390?0x0:_0x3f02ad[_0xb80a('0x1d')];var _0x125d11=_0x108390?_0xea6c1c[_0xb80a('0x1c')]:_0x3f02ad[_0xb80a('0x1d')]+_0x3f02ad[_0xb80a('0x1b')];var _0x3974e7;if(_0x125d11>=_0x133cb9){_0x125d11=_0x133cb9;_0x3974e7=0xc8;}else{_0x3974e7=0xce;}_0x2d7ba0[_0xb80a('0x1e')](_0x3974e7);return _0x2d7ba0[_0xb80a('0x1f')](_0xb80a('0x20'),_0x5bd8f4+'-'+_0x125d11+'/'+_0x133cb9)[_0xb80a('0x21')](_0xea6c1c);}return null;};}function patchUpdates(_0x2add9d){return function(_0x3c4d4d){try{jsonpatch['apply'](_0x3c4d4d,_0x2add9d,!![]);}catch(_0x5ab6cc){return BPromise[_0xb80a('0x22')](_0x5ab6cc);}return _0x3c4d4d[_0xb80a('0x23')]();};}function saveUpdates(_0x3ee135,_0x48e4a7){return function(_0x3e3602){if(_0x3e3602){return _0x3e3602[_0xb80a('0x24')](_0x3ee135)[_0xb80a('0x25')](function(_0x4f7066){return _0x4f7066;});}return null;};}function removeEntity(_0x3d30e1,_0x23e05c){return function(_0x282409){if(_0x282409){return _0x282409['destroy']()[_0xb80a('0x25')](function(){_0x3d30e1[_0xb80a('0x1e')](0xcc)[_0xb80a('0x19')]();});}};}function handleEntityNotFound(_0x361974,_0x568baf){return function(_0x4713b7){if(!_0x4713b7){_0x361974[_0xb80a('0x18')](0x194);}return _0x4713b7;};}function handleError(_0x598ae1,_0x29a12e){_0x29a12e=_0x29a12e||0x1f4;return function(_0x363c6e){logger[_0xb80a('0x26')](_0x363c6e[_0xb80a('0x27')]);if(_0x363c6e[_0xb80a('0x28')]){delete _0x363c6e['name'];}_0x598ae1[_0xb80a('0x1e')](_0x29a12e)[_0xb80a('0x29')](_0x363c6e);};}exports[_0xb80a('0x2a')]=function(_0xc6a00b,_0x3b7f9a){var _0x5541b3={},_0xbf1486={},_0x5aa0f4={'count':0x0,'rows':[]};var _0x796a1d=_[_0xb80a('0x2b')](db[_0xb80a('0x2c')][_0xb80a('0x2d')],function(_0x35137b){return{'name':_0x35137b[_0xb80a('0x2e')],'type':_0x35137b[_0xb80a('0x2f')]['key']};});_0xbf1486[_0xb80a('0x30')]=_['map'](_0x796a1d,'name');_0xbf1486[_0xb80a('0x31')]=_[_0xb80a('0x32')](_0xc6a00b[_0xb80a('0x31')]);_0xbf1486[_0xb80a('0x33')]=_[_0xb80a('0x34')](_0xbf1486[_0xb80a('0x30')],_0xbf1486[_0xb80a('0x31')]);_0x5541b3[_0xb80a('0x35')]=_['intersection'](_0xbf1486[_0xb80a('0x30')],qs[_0xb80a('0x36')](_0xc6a00b['query'][_0xb80a('0x36')]));_0x5541b3[_0xb80a('0x35')]=_0x5541b3[_0xb80a('0x35')][_0xb80a('0x37')]?_0x5541b3[_0xb80a('0x35')]:_0xbf1486['model'];if(!_0xc6a00b[_0xb80a('0x31')]['hasOwnProperty']('nolimit')){_0x5541b3[_0xb80a('0x1b')]=qs[_0xb80a('0x1b')](_0xc6a00b[_0xb80a('0x31')][_0xb80a('0x1b')]);_0x5541b3[_0xb80a('0x1d')]=qs[_0xb80a('0x1d')](_0xc6a00b['query'][_0xb80a('0x1d')]);}_0x5541b3[_0xb80a('0x38')]=qs[_0xb80a('0x39')](_0xc6a00b['query'][_0xb80a('0x39')]);_0x5541b3['where']=qs[_0xb80a('0x33')](_[_0xb80a('0x3a')](_0xc6a00b[_0xb80a('0x31')],_0xbf1486[_0xb80a('0x33')]),_0x796a1d);if(_0xc6a00b['query'][_0xb80a('0x3b')]){_0x5541b3[_0xb80a('0x3c')]=_[_0xb80a('0x3d')](_0x5541b3['where'],{'$or':_[_0xb80a('0x2b')](_0x796a1d,function(_0x466d35){if(_0x466d35['type']!=='VIRTUAL'){var _0x118a5a={};_0x118a5a[_0x466d35['name']]={'$like':'%'+_0xc6a00b[_0xb80a('0x31')][_0xb80a('0x3b')]+'%'};return _0x118a5a;}})});}_0x5541b3=_['merge']({},_0x5541b3,_0xc6a00b['options']);var _0x3ac58f={'where':_0x5541b3['where']};return db[_0xb80a('0x2c')][_0xb80a('0x1c')](_0x3ac58f)['then'](function(_0x5a9b4f){_0x5aa0f4[_0xb80a('0x1c')]=_0x5a9b4f;if(_0xc6a00b[_0xb80a('0x31')][_0xb80a('0x3e')]){_0x5541b3[_0xb80a('0x3f')]=[{'all':!![]}];}return db[_0xb80a('0x2c')][_0xb80a('0x40')](_0x5541b3);})[_0xb80a('0x25')](function(_0x2afb31){_0x5aa0f4[_0xb80a('0x41')]=_0x2afb31;return _0x5aa0f4;})['then'](respondWithFilteredResult(_0x3b7f9a,_0x5541b3))[_0xb80a('0x42')](handleError(_0x3b7f9a,null));};exports['show']=function(_0x6b5679,_0x5c2eca){var _0x42aebe={'raw':!![],'where':{'id':_0x6b5679[_0xb80a('0x43')]['id']}},_0xecf3e1={};_0xecf3e1[_0xb80a('0x30')]=_[_0xb80a('0x32')](db['CmHopperHistory'][_0xb80a('0x2d')]);_0xecf3e1[_0xb80a('0x31')]=_[_0xb80a('0x32')](_0x6b5679[_0xb80a('0x31')]);_0xecf3e1['filters']=_[_0xb80a('0x34')](_0xecf3e1[_0xb80a('0x30')],_0xecf3e1[_0xb80a('0x31')]);_0x42aebe[_0xb80a('0x35')]=_[_0xb80a('0x34')](_0xecf3e1[_0xb80a('0x30')],qs[_0xb80a('0x36')](_0x6b5679[_0xb80a('0x31')][_0xb80a('0x36')]));_0x42aebe[_0xb80a('0x35')]=_0x42aebe['attributes'][_0xb80a('0x37')]?_0x42aebe[_0xb80a('0x35')]:_0xecf3e1[_0xb80a('0x30')];if(_0x6b5679['query'][_0xb80a('0x3e')]){_0x42aebe[_0xb80a('0x3f')]=[{'all':!![]}];}_0x42aebe=_['merge']({},_0x42aebe,_0x6b5679['options']);return db[_0xb80a('0x2c')][_0xb80a('0x44')](_0x42aebe)[_0xb80a('0x25')](handleEntityNotFound(_0x5c2eca,null))['then'](respondWithResult(_0x5c2eca,null))['catch'](handleError(_0x5c2eca,null));};exports[_0xb80a('0x45')]=function(_0x5cf3b6,_0x4b54c0){return db['CmHopperHistory'][_0xb80a('0x45')](_0x5cf3b6[_0xb80a('0x46')],{})[_0xb80a('0x25')](respondWithResult(_0x4b54c0,0xc9))[_0xb80a('0x42')](handleError(_0x4b54c0,null));};exports['describe']=function(_0x37ee2f,_0x24ac31){return db[_0xb80a('0x2c')][_0xb80a('0x47')]()[_0xb80a('0x25')](respondWithResult(_0x24ac31,null))[_0xb80a('0x42')](handleError(_0x24ac31,null));};exports[_0xb80a('0x24')]=function(_0x4af0b2,_0x1e5f96){if(_0x4af0b2[_0xb80a('0x46')]['uniqueid']){delete _0x4af0b2[_0xb80a('0x46')]['uniqueid'];}return db[_0xb80a('0x2c')]['find']({'where':{'uniqueid':_0x4af0b2[_0xb80a('0x43')]['id']}})[_0xb80a('0x25')](handleEntityNotFound(_0x1e5f96,null))[_0xb80a('0x25')](saveUpdates(_0x4af0b2[_0xb80a('0x46')],null))['then'](respondWithResult(_0x1e5f96,null))[_0xb80a('0x42')](handleError(_0x1e5f96,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index c2d4bbf..4d69fc3 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 _0xb458=['define','CmHopperHistory','cm_hopper_history','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes'];(function(_0x259f26,_0x1e8d76){var _0x2f9f8c=function(_0x471569){while(--_0x471569){_0x259f26['push'](_0x259f26['shift']());}};_0x2f9f8c(++_0x1e8d76);}(_0xb458,0x94));var _0x8b45=function(_0x73eae,_0x4aef6d){_0x73eae=_0x73eae-0x0;var _0x183e17=_0xb458[_0x73eae];return _0x183e17;};'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('request-promise');var fs=require('fs');var path=require(_0x8b45('0x4'));var rimraf=require(_0x8b45('0x5'));var config=require(_0x8b45('0x6'));var attributes=require(_0x8b45('0x7'));module['exports']=function(_0xfe8757,_0xd23b88){return _0xfe8757[_0x8b45('0x8')](_0x8b45('0x9'),attributes,{'tableName':_0x8b45('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x8b45('0xb'),'fields':[_0x8b45('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2bab=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','define','cm_hopper_history','uniqueid','lodash','util'];(function(_0x38da37,_0x55b675){var _0x1e3a85=function(_0x15f63e){while(--_0x15f63e){_0x38da37['push'](_0x38da37['shift']());}};_0x1e3a85(++_0x55b675);}(_0x2bab,0x1ba));var _0xb2ba=function(_0x2d3ae4,_0x3d3f2c){_0x2d3ae4=_0x2d3ae4-0x0;var _0x3da84e=_0x2bab[_0x2d3ae4];return _0x3da84e;};'use strict';var _=require(_0xb2ba('0x0'));var util=require(_0xb2ba('0x1'));var logger=require(_0xb2ba('0x2'))(_0xb2ba('0x3'));var moment=require('moment');var BPromise=require(_0xb2ba('0x4'));var rp=require(_0xb2ba('0x5'));var fs=require('fs');var path=require(_0xb2ba('0x6'));var rimraf=require('rimraf');var config=require(_0xb2ba('0x7'));var attributes=require(_0xb2ba('0x8'));module['exports']=function(_0x5ea667,_0x5ab92f){return _0x5ea667[_0xb2ba('0x9')]('CmHopperHistory',attributes,{'tableName':_0xb2ba('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0xb2ba('0xb'),'fields':[_0xb2ba('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 9565383..cf90f42 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 _0xdd1d=['findAll','where','sequelize','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','literal','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperHistory','create','options','raw','debug','AvgHandleTime','CmHopperHistory'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xdd1d,0xb2));var _0xddd1=function(_0x43f585,_0x3f8ba8){_0x43f585=_0x43f585-0x0;var _0x399005=_0xdd1d[_0x43f585];return _0x399005;};'use strict';var _=require(_0xddd1('0x0'));var util=require(_0xddd1('0x1'));var moment=require(_0xddd1('0x2'));var BPromise=require(_0xddd1('0x3'));var rs=require(_0xddd1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xddd1('0x5'))['db'];var utils=require(_0xddd1('0x6'));var logger=require(_0xddd1('0x7'))('rpc');var config=require(_0xddd1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xddd1('0x9')][_0xddd1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x268896,_0x54e2e2,_0x5684e8){return new BPromise(function(_0xa68d3f,_0x2e6884){return client[_0xddd1('0xb')](_0x268896,_0x5684e8)[_0xddd1('0xc')](function(_0x3f6e29){logger[_0xddd1('0xd')](_0xddd1('0xe'),_0x54e2e2,_0xddd1('0xf'));logger['debug'](_0xddd1('0x10'),_0x54e2e2,'request\x20sent',JSON[_0xddd1('0x11')](_0x3f6e29));if(_0x3f6e29['error']){if(_0x3f6e29[_0xddd1('0x12')]['code']===0x1f4){logger['error'](_0xddd1('0xe'),_0x54e2e2,_0x3f6e29[_0xddd1('0x12')][_0xddd1('0x13')]);return _0x2e6884(_0x3f6e29['error'][_0xddd1('0x13')]);}logger['error'](_0xddd1('0xe'),_0x54e2e2,_0x3f6e29[_0xddd1('0x12')][_0xddd1('0x13')]);return _0xa68d3f(_0x3f6e29[_0xddd1('0x12')][_0xddd1('0x13')]);}else{logger[_0xddd1('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x54e2e2,_0xddd1('0xf'));_0xa68d3f(_0x3f6e29[_0xddd1('0x14')][_0xddd1('0x13')]);}})[_0xddd1('0x15')](function(_0x55aed4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x54e2e2,_0x55aed4);_0x2e6884(_0x55aed4);});});}exports[_0xddd1('0x16')]=function(_0x5e5685){var _0x4b61fc=this;return new Promise(function(_0x1e02e6,_0x16ec27){return db['CmHopperHistory'][_0xddd1('0x17')](_0x5e5685['body'],{'raw':_0x5e5685[_0xddd1('0x18')]?_0x5e5685['options'][_0xddd1('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x29c843){logger['info'](_0xddd1('0x16'),_0x5e5685);logger[_0xddd1('0x1a')](_0xddd1('0x16'),_0x5e5685,JSON[_0xddd1('0x11')](_0x29c843));_0x1e02e6(_0x29c843);})[_0xddd1('0x15')](function(_0x380899){logger['error'](_0xddd1('0x16'),_0x380899[_0xddd1('0x13')],_0x5e5685);_0x16ec27(_0x4b61fc[_0xddd1('0x12')](0x1f4,_0x380899[_0xddd1('0x13')]));});});};exports[_0xddd1('0x1b')]=function(_0x3982f7){var _0x426451=this;return new Promise(function(_0x33e2f8,_0x5295dd){return db[_0xddd1('0x1c')][_0xddd1('0x1d')]({'raw':_0x3982f7[_0xddd1('0x18')]?_0x3982f7[_0xddd1('0x18')][_0xddd1('0x19')]===undefined?!![]:![]:!![],'where':_0x3982f7[_0xddd1('0x18')]?_0x3982f7['options'][_0xddd1('0x1e')]||null:null,'attributes':[[db[_0xddd1('0x1f')]['fn'](_0xddd1('0x20'),db[_0xddd1('0x1f')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0xddd1('0x1f')]['fn'](_0xddd1('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xddd1('0x21')))),_0xddd1('0x22')],[db['sequelize']['fn']('COUNT',db[_0xddd1('0x1f')]['fn']('IF',db[_0xddd1('0x1f')]['literal'](_0xddd1('0x23')))),_0xddd1('0x24')],[db['sequelize']['fn'](_0xddd1('0x20'),db['sequelize']['fn']('IF',db[_0xddd1('0x1f')][_0xddd1('0x25')]('`state`\x20=\x2011,\x201,\x20null'))),_0xddd1('0x26')],[db['sequelize']['fn'](_0xddd1('0x27'),db[_0xddd1('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xddd1('0x28')))),'predictiveIntervalAvgHoldtime'],[db[_0xddd1('0x1f')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xddd1('0x1f')][_0xddd1('0x25')](_0xddd1('0x29')))),'predictiveIntervalAvgTalktime']]})[_0xddd1('0xc')](function(_0x50d56b){logger[_0xddd1('0xd')]('AvgHandleTime',_0x3982f7);logger[_0xddd1('0x1a')](_0xddd1('0x1b'),_0x3982f7,JSON[_0xddd1('0x11')](_0x50d56b));_0x33e2f8(_0x50d56b);})['catch'](function(_0x5b872f){logger['error'](_0xddd1('0x1b'),_0x5b872f[_0xddd1('0x13')],_0x3982f7);_0x5295dd(_0x426451[_0xddd1('0x12')](0x1f4,_0x5b872f[_0xddd1('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x1537f1){var _0x2b2699=this;return new Promise(function(_0x249b2f,_0x82ffaf){return db[_0xddd1('0x1c')][_0xddd1('0x1d')]({'raw':_0x1537f1[_0xddd1('0x18')]?_0x1537f1['options']['raw']===undefined?!![]:![]:!![],'where':_0x1537f1['options']?_0x1537f1[_0xddd1('0x18')][_0xddd1('0x1e')]||null:null,'attributes':[[_0xddd1('0x2a'),_0xddd1('0x2b')],[db[_0xddd1('0x1f')]['fn']('COUNT',db[_0xddd1('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xddd1('0x2c')],[db[_0xddd1('0x1f')]['fn'](_0xddd1('0x20'),db['sequelize']['fn']('IF',db[_0xddd1('0x1f')][_0xddd1('0x25')](_0xddd1('0x2d')))),_0xddd1('0x2e')],[db[_0xddd1('0x1f')]['fn'](_0xddd1('0x20'),db[_0xddd1('0x1f')]['fn']('IF',db[_0xddd1('0x1f')][_0xddd1('0x25')](_0xddd1('0x21')))),_0xddd1('0x2f')],[db['sequelize']['fn'](_0xddd1('0x20'),db[_0xddd1('0x1f')]['fn']('IF',db[_0xddd1('0x1f')][_0xddd1('0x25')](_0xddd1('0x30')))),'outboundBusyCallsDay'],[db[_0xddd1('0x1f')]['fn'](_0xddd1('0x20'),db[_0xddd1('0x1f')]['fn']('IF',db[_0xddd1('0x1f')]['literal'](_0xddd1('0x31')))),_0xddd1('0x32')],[db[_0xddd1('0x1f')]['fn']('COUNT',db[_0xddd1('0x1f')]['fn']('IF',db[_0xddd1('0x1f')]['literal'](_0xddd1('0x33')))),_0xddd1('0x34')],[db[_0xddd1('0x1f')]['fn'](_0xddd1('0x20'),db[_0xddd1('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xddd1('0x35')))),_0xddd1('0x36')],[db[_0xddd1('0x1f')]['fn'](_0xddd1('0x20'),db[_0xddd1('0x1f')]['fn']('IF',db['sequelize'][_0xddd1('0x25')](_0xddd1('0x37')))),_0xddd1('0x38')],[db[_0xddd1('0x1f')]['fn'](_0xddd1('0x20'),db[_0xddd1('0x1f')]['fn']('IF',db[_0xddd1('0x1f')][_0xddd1('0x25')](_0xddd1('0x39')))),'outboundBlacklistCallsDay'],[db[_0xddd1('0x1f')]['fn'](_0xddd1('0x20'),db[_0xddd1('0x1f')]['fn']('IF',db[_0xddd1('0x1f')][_0xddd1('0x25')](_0xddd1('0x3a')))),_0xddd1('0x3b')],[db[_0xddd1('0x1f')]['fn'](_0xddd1('0x20'),db[_0xddd1('0x1f')]['fn']('IF',db[_0xddd1('0x1f')][_0xddd1('0x25')](_0xddd1('0x3c')))),_0xddd1('0x3d')],[db[_0xddd1('0x1f')]['fn'](_0xddd1('0x20'),db['sequelize']['fn']('IF',db[_0xddd1('0x1f')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0xddd1('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xddd1('0x1f')][_0xddd1('0x25')]('`state`\x20=\x2020,\x201,\x20null'))),_0xddd1('0x3d')],[db[_0xddd1('0x1f')]['fn'](_0xddd1('0x20'),db[_0xddd1('0x1f')]['fn']('IF',db[_0xddd1('0x1f')][_0xddd1('0x25')](_0xddd1('0x3e')))),_0xddd1('0x3f')]],'group':['campaign']})[_0xddd1('0xc')](function(_0x4f89e4){logger[_0xddd1('0xd')](_0xddd1('0x40'),_0x1537f1);logger[_0xddd1('0x1a')](_0xddd1('0x40'),_0x1537f1,JSON['stringify'](_0x4f89e4));_0x249b2f(_0x4f89e4);})[_0xddd1('0x15')](function(_0x53ec0d){logger[_0xddd1('0x12')](_0xddd1('0x40'),_0x53ec0d[_0xddd1('0x13')],_0x1537f1);_0x82ffaf(_0x2b2699[_0xddd1('0x12')](0x1f4,_0x53ec0d['message']));});});};exports['GetCampaignHopperHistory']=function(_0x65c4d9){var _0x5a323a=this;return new Promise(function(_0x8a3e69,_0xf4bcef){return db['CmHopperHistory'][_0xddd1('0x1d')]({'raw':_0x65c4d9[_0xddd1('0x18')]?_0x65c4d9['options']['raw']===undefined?!![]:![]:!![],'where':_0x65c4d9[_0xddd1('0x18')]?_0x65c4d9[_0xddd1('0x18')][_0xddd1('0x1e')]||null:null,'attributes':[[_0xddd1('0x2a'),_0xddd1('0x2b')],[db[_0xddd1('0x1f')]['fn'](_0xddd1('0x20'),db[_0xddd1('0x1f')][_0xddd1('0x41')]('id')),_0xddd1('0x42')],[db[_0xddd1('0x1f')]['fn'](_0xddd1('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0xddd1('0x25')](_0xddd1('0x21')))),_0xddd1('0x43')]],'group':[_0xddd1('0x2a')]})['then'](function(_0x491022){logger['info'](_0xddd1('0x44'),_0x65c4d9);logger[_0xddd1('0x1a')]('GetCampaignHopperHistory',_0x65c4d9,JSON[_0xddd1('0x11')](_0x491022));_0x8a3e69(_0x491022);})['catch'](function(_0x2c71b2){logger[_0xddd1('0x12')](_0xddd1('0x44'),_0x2c71b2[_0xddd1('0x13')],_0x65c4d9);_0xf4bcef(_0x5a323a[_0xddd1('0x12')](0x1f4,_0x2c71b2['message']));});});}; \ No newline at end of file +var _0xbee3=['outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\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','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','stringify','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null'];(function(_0x46adcd,_0x15c37b){var _0x2f9454=function(_0x49234a){while(--_0x49234a){_0x46adcd['push'](_0x46adcd['shift']());}};_0x2f9454(++_0x15c37b);}(_0xbee3,0xd5));var _0x3bee=function(_0x133673,_0x3b50c9){_0x133673=_0x133673-0x0;var _0x6ac4cc=_0xbee3[_0x133673];return _0x6ac4cc;};'use strict';var _=require('lodash');var util=require(_0x3bee('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3bee('0x1'));var fs=require('fs');var Redis=require(_0x3bee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3bee('0x3'));var logger=require(_0x3bee('0x4'))(_0x3bee('0x5'));var config=require('../../config/environment');var jayson=require(_0x3bee('0x6'));var client=jayson[_0x3bee('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fdeec,_0x28d912,_0x1b510d){return new BPromise(function(_0x339223,_0xbdd5d5){return client[_0x3bee('0x8')](_0x2fdeec,_0x1b510d)[_0x3bee('0x9')](function(_0x518e2d){logger[_0x3bee('0xa')](_0x3bee('0xb'),_0x28d912,_0x3bee('0xc'));logger[_0x3bee('0xd')](_0x3bee('0xe'),_0x28d912,_0x3bee('0xc'),JSON['stringify'](_0x518e2d));if(_0x518e2d[_0x3bee('0xf')]){if(_0x518e2d['error'][_0x3bee('0x10')]===0x1f4){logger[_0x3bee('0xf')](_0x3bee('0xb'),_0x28d912,_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);return _0xbdd5d5(_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);}logger['error'](_0x3bee('0xb'),_0x28d912,_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);return _0x339223(_0x518e2d[_0x3bee('0xf')][_0x3bee('0x11')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x28d912,_0x3bee('0xc'));_0x339223(_0x518e2d['result'][_0x3bee('0x11')]);}})[_0x3bee('0x12')](function(_0x57d42c){logger['error'](_0x3bee('0xb'),_0x28d912,_0x57d42c);_0xbdd5d5(_0x57d42c);});});}exports[_0x3bee('0x13')]=function(_0xfdba3b){var _0x631ff8=this;return new Promise(function(_0x49095a,_0x30a1de){return db[_0x3bee('0x14')][_0x3bee('0x15')](_0xfdba3b[_0x3bee('0x16')],{'raw':_0xfdba3b[_0x3bee('0x17')]?_0xfdba3b[_0x3bee('0x17')][_0x3bee('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4f36af){logger[_0x3bee('0xa')](_0x3bee('0x13'),_0xfdba3b);logger['debug'](_0x3bee('0x13'),_0xfdba3b,JSON[_0x3bee('0x19')](_0x4f36af));_0x49095a(_0x4f36af);})[_0x3bee('0x12')](function(_0x179e62){logger[_0x3bee('0xf')](_0x3bee('0x13'),_0x179e62[_0x3bee('0x11')],_0xfdba3b);_0x30a1de(_0x631ff8['error'](0x1f4,_0x179e62[_0x3bee('0x11')]));});});};exports[_0x3bee('0x1a')]=function(_0x1fed5a){var _0x3bb884=this;return new Promise(function(_0x500664,_0x45249c){return db[_0x3bee('0x14')][_0x3bee('0x1b')]({'raw':_0x1fed5a['options']?_0x1fed5a['options'][_0x3bee('0x18')]===undefined?!![]:![]:!![],'where':_0x1fed5a[_0x3bee('0x17')]?_0x1fed5a['options'][_0x3bee('0x1c')]||null:null,'attributes':[[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db['sequelize'][_0x3bee('0x1f')]('id')),_0x3bee('0x20')],[db[_0x3bee('0x1d')]['fn']('COUNT',db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x3bee('0x22')],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x3bee('0x23')],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x3bee('0x24')))),_0x3bee('0x25')],[db['sequelize']['fn']('AVG',db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')](_0x3bee('0x26')))),_0x3bee('0x27')],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x28'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0x3bee('0x9')](function(_0x4a4706){logger['info'](_0x3bee('0x1a'),_0x1fed5a);logger[_0x3bee('0xd')](_0x3bee('0x1a'),_0x1fed5a,JSON[_0x3bee('0x19')](_0x4a4706));_0x500664(_0x4a4706);})[_0x3bee('0x12')](function(_0x232fac){logger[_0x3bee('0xf')](_0x3bee('0x1a'),_0x232fac['message'],_0x1fed5a);_0x45249c(_0x3bb884[_0x3bee('0xf')](0x1f4,_0x232fac[_0x3bee('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x3711e4){var _0x28181b=this;return new Promise(function(_0x106ce6,_0x13d2d5){return db[_0x3bee('0x14')]['findAll']({'raw':_0x3711e4['options']?_0x3711e4[_0x3bee('0x17')][_0x3bee('0x18')]===undefined?!![]:![]:!![],'where':_0x3711e4[_0x3bee('0x17')]?_0x3711e4[_0x3bee('0x17')][_0x3bee('0x1c')]||null:null,'attributes':[[_0x3bee('0x29'),_0x3bee('0x2a')],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0x3bee('0x2b')],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')](_0x3bee('0x2c')))),_0x3bee('0x2d')],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x3bee('0x2e')],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')](_0x3bee('0x2f')))),_0x3bee('0x30')],[db['sequelize']['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')]['literal'](_0x3bee('0x31')))),'outboundCongestionCallsDay'],[db[_0x3bee('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')](_0x3bee('0x32')))),_0x3bee('0x33')],[db[_0x3bee('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3bee('0x1d')]['literal'](_0x3bee('0x34')))),'outboundDropCallsDayCallersExit'],[db[_0x3bee('0x1d')]['fn']('COUNT',db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')](_0x3bee('0x35')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x3bee('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3bee('0x36')))),'outboundBlacklistCallsDay'],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db['sequelize'][_0x3bee('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),_0x3bee('0x37')],[db['sequelize']['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')]['literal'](_0x3bee('0x38')))),_0x3bee('0x39')],[db[_0x3bee('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')](_0x3bee('0x3a')))),_0x3bee('0x3b')],[db[_0x3bee('0x1d')]['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db['sequelize'][_0x3bee('0x21')](_0x3bee('0x3c')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x3bee('0x1e'),db['sequelize']['fn']('IF',db[_0x3bee('0x1d')][_0x3bee('0x21')](_0x3bee('0x3d')))),'outboundReCallsDay']],'group':[_0x3bee('0x29')]})[_0x3bee('0x9')](function(_0x127cb8){logger['info'](_0x3bee('0x3e'),_0x3711e4);logger[_0x3bee('0xd')]('GetVoiceQueueHopperHistory',_0x3711e4,JSON[_0x3bee('0x19')](_0x127cb8));_0x106ce6(_0x127cb8);})[_0x3bee('0x12')](function(_0x53c881){logger[_0x3bee('0xf')](_0x3bee('0x3e'),_0x53c881[_0x3bee('0x11')],_0x3711e4);_0x13d2d5(_0x28181b[_0x3bee('0xf')](0x1f4,_0x53c881[_0x3bee('0x11')]));});});};exports[_0x3bee('0x3f')]=function(_0xf7f9c3){var _0x72c2c4=this;return new Promise(function(_0x4c981f,_0x51fd46){return db[_0x3bee('0x14')]['findAll']({'raw':_0xf7f9c3[_0x3bee('0x17')]?_0xf7f9c3[_0x3bee('0x17')][_0x3bee('0x18')]===undefined?!![]:![]:!![],'where':_0xf7f9c3['options']?_0xf7f9c3[_0x3bee('0x17')][_0x3bee('0x1c')]||null:null,'attributes':[[_0x3bee('0x29'),'name'],[db[_0x3bee('0x1d')]['fn']('COUNT',db[_0x3bee('0x1d')][_0x3bee('0x1f')]('id')),_0x3bee('0x40')],[db['sequelize']['fn'](_0x3bee('0x1e'),db[_0x3bee('0x1d')]['fn']('IF',db[_0x3bee('0x1d')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x3bee('0x41')]],'group':[_0x3bee('0x29')]})[_0x3bee('0x9')](function(_0x4e6b22){logger['info'](_0x3bee('0x3f'),_0xf7f9c3);logger['debug']('GetCampaignHopperHistory',_0xf7f9c3,JSON[_0x3bee('0x19')](_0x4e6b22));_0x4c981f(_0x4e6b22);})[_0x3bee('0x12')](function(_0x43d3bc){logger['error']('GetCampaignHopperHistory',_0x43d3bc[_0x3bee('0x11')],_0xf7f9c3);_0x51fd46(_0x72c2c4[_0x3bee('0xf')](0x1f4,_0x43d3bc['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 122aa62..f060ece 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 _0xcb59=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','show','put','update','exports'];(function(_0x296a96,_0x54f253){var _0x2de68a=function(_0x1ae144){while(--_0x1ae144){_0x296a96['push'](_0x296a96['shift']());}};_0x2de68a(++_0x54f253);}(_0xcb59,0x190));var _0x9cb5=function(_0x1a846e,_0x261718){_0x1a846e=_0x1a846e-0x0;var _0x1e5da1=_0xcb59[_0x1a846e];return _0x1e5da1;};'use strict';var multer=require(_0x9cb5('0x0'));var util=require(_0x9cb5('0x1'));var path=require(_0x9cb5('0x2'));var timeout=require(_0x9cb5('0x3'));var express=require(_0x9cb5('0x4'));var router=express[_0x9cb5('0x5')]();var fs_extra=require(_0x9cb5('0x6'));var auth=require(_0x9cb5('0x7'));var interaction=require(_0x9cb5('0x8'));var config=require(_0x9cb5('0x9'));var controller=require(_0x9cb5('0xa'));router[_0x9cb5('0xb')]('/',auth[_0x9cb5('0xc')](),controller['index']);router[_0x9cb5('0xb')](_0x9cb5('0xd'),auth[_0x9cb5('0xc')](),controller[_0x9cb5('0xe')]);router[_0x9cb5('0xb')](_0x9cb5('0xf'),auth['isAuthenticated'](),controller[_0x9cb5('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9cb5('0x11')](_0x9cb5('0xf'),auth[_0x9cb5('0xc')](),controller[_0x9cb5('0x12')]);module[_0x9cb5('0x13')]=router; \ No newline at end of file +var _0x2ca8=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show','post','put','update'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0x2ca8,0x166));var _0x82ca=function(_0x590371,_0x1b2c96){_0x590371=_0x590371-0x0;var _0x4e830f=_0x2ca8[_0x590371];return _0x4e830f;};'use strict';var multer=require('multer');var util=require(_0x82ca('0x0'));var path=require(_0x82ca('0x1'));var timeout=require(_0x82ca('0x2'));var express=require(_0x82ca('0x3'));var router=express[_0x82ca('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x82ca('0x5'));var interaction=require(_0x82ca('0x6'));var config=require(_0x82ca('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x82ca('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x82ca('0x8')](_0x82ca('0x9'),auth[_0x82ca('0xa')](),controller['describe']);router['get'](_0x82ca('0xb'),auth['isAuthenticated'](),controller[_0x82ca('0xc')]);router[_0x82ca('0xd')]('/',auth[_0x82ca('0xa')](),controller['create']);router[_0x82ca('0xe')](_0x82ca('0xb'),auth[_0x82ca('0xa')](),controller[_0x82ca('0xf')]);module[_0x82ca('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 8ba0ed5..576841a 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 _0xff16=['exports','name','STRING','sequelize'];(function(_0x3900c6,_0x158986){var _0x2ec886=function(_0x30a78a){while(--_0x30a78a){_0x3900c6['push'](_0x3900c6['shift']());}};_0x2ec886(++_0x158986);}(_0xff16,0x7f));var _0x6ff1=function(_0x5af2c0,_0x331dbb){_0x5af2c0=_0x5af2c0-0x0;var _0x131958=_0xff16[_0x5af2c0];return _0x131958;};'use strict';var Sequelize=require(_0x6ff1('0x0'));module[_0x6ff1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6ff1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6ff1('0x3')]},'dialPrefix':{'type':Sequelize[_0x6ff1('0x3')]}}; \ No newline at end of file +var _0x28e3=['STRING','name','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x28e3,0x106));var _0x328e=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0x28e3[_0x5ac84c];return _0x3c53d2;};'use strict';var Sequelize=require(_0x328e('0x0'));module[_0x328e('0x1')]={'name':{'type':Sequelize[_0x328e('0x2')],'unique':_0x328e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x328e('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index f740206..5fa06d6 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 _0x853f=['UserProfileResource','end','error','stack','name','index','map','CmList','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Disposition','getDispositions','findOne','keys','hasOwnProperty','sort','ListId','options','removeDispositions','ids','addContacts','CmContact','describe','tags','isArray','join','push','each','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','getContactsCsv','ContactItemType','findAll','alias','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','select','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','cm_contact_has_items','description_additionalPhone_','toString','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','list_%d_%s.csv','setHeader','Content-type','text/csv','addCustomField','sequelize','transaction','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','userCmList:save','removeAgents','emit','getAgents','info','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','get','Lists'];(function(_0x4e77c6,_0x4c359c){var _0x3e326c=function(_0x50e425){while(--_0x50e425){_0x4e77c6['push'](_0x4e77c6['shift']());}};_0x3e326c(++_0x4c359c);}(_0x853f,0x1b6));var _0xf853=function(_0x1f182f,_0x3a461b){_0x1f182f=_0x1f182f-0x0;var _0x1671dd=_0x853f[_0x1f182f];return _0x1671dd;};'use strict';var emlformat=require(_0xf853('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf853('0x1'));var moment=require(_0xf853('0x2'));var BPromise=require(_0xf853('0x3'));var Mustache=require(_0xf853('0x4'));var util=require(_0xf853('0x5'));var path=require(_0xf853('0x6'));var sox=require(_0xf853('0x7'));var csv=require(_0xf853('0x8'));var ejs=require(_0xf853('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf853('0xa'));var squel=require(_0xf853('0xb'));var crypto=require(_0xf853('0xc'));var jsforce=require(_0xf853('0xd'));var deskjs=require(_0xf853('0xe'));var toCsv=require(_0xf853('0x8'));var querystring=require('querystring');var Papa=require(_0xf853('0xf'));var Redis=require(_0xf853('0x10'));var authService=require(_0xf853('0x11'));var qs=require(_0xf853('0x12'));var as=require(_0xf853('0x13'));var hardwareService=require(_0xf853('0x14'));var logger=require(_0xf853('0x15'))('api');var utils=require(_0xf853('0x16'));var config=require(_0xf853('0x17'));var licenseUtil=require(_0xf853('0x18'));var db=require('../../mysqldb')['db'];var csv_results;config[_0xf853('0x19')]=_[_0xf853('0x1a')](config[_0xf853('0x19')],{'host':_0xf853('0x1b'),'port':0x18eb});var socket=require(_0xf853('0x1c'))(new Redis(config[_0xf853('0x19')]));require(_0xf853('0x1d'))['register'](socket);function respondWithStatusCode(_0x177e5b,_0x42a27a){_0x42a27a=_0x42a27a||0xcc;return function(_0xa686e9){if(_0xa686e9){return _0x177e5b[_0xf853('0x1e')](_0x42a27a);}return _0x177e5b[_0xf853('0x1f')](_0x42a27a)['end']();};}function respondWithResult(_0x5a92fa,_0x48f88f){_0x48f88f=_0x48f88f||0xc8;return function(_0x496dc2){if(_0x496dc2){return _0x5a92fa[_0xf853('0x1f')](_0x48f88f)[_0xf853('0x20')](_0x496dc2);}};}function respondWithFilteredResult(_0x31c224,_0x57d8eb){return function(_0x34997c){if(_0x34997c){var _0x4d51ba=typeof _0x57d8eb[_0xf853('0x21')]===_0xf853('0x22')&&typeof _0x57d8eb[_0xf853('0x23')]===_0xf853('0x22');var _0x1d2ade=_0x34997c[_0xf853('0x24')];var _0x2d28c2=_0x4d51ba?0x0:_0x57d8eb[_0xf853('0x21')];var _0x2343ef=_0x4d51ba?_0x34997c[_0xf853('0x24')]:_0x57d8eb[_0xf853('0x21')]+_0x57d8eb[_0xf853('0x23')];var _0x217428;if(_0x2343ef>=_0x1d2ade){_0x2343ef=_0x1d2ade;_0x217428=0xc8;}else{_0x217428=0xce;}_0x31c224[_0xf853('0x1f')](_0x217428);return _0x31c224[_0xf853('0x25')](_0xf853('0x26'),_0x2d28c2+'-'+_0x2343ef+'/'+_0x1d2ade)['json'](_0x34997c);}return null;};}function patchUpdates(_0x30c73d){return function(_0x519539){try{jsonpatch['apply'](_0x519539,_0x30c73d,!![]);}catch(_0x3c7313){return BPromise['reject'](_0x3c7313);}return _0x519539[_0xf853('0x27')]();};}function saveUpdates(_0x4049c7,_0x3f404f){return function(_0x2bd230){if(_0x2bd230){return _0x2bd230[_0xf853('0x28')](_0x4049c7)[_0xf853('0x29')](function(_0x1d9c17){return _0x1d9c17;});}return null;};}function removeEntity(_0x4329e8,_0xa89ae){return function(_0x419cdc){if(_0x419cdc){return _0x419cdc[_0xf853('0x2a')]()[_0xf853('0x29')](function(){var _0xe74191=_0x419cdc[_0xf853('0x2b')]({'plain':!![]});var _0x558726=_0xf853('0x2c');return db[_0xf853('0x2d')][_0xf853('0x2a')]({'where':{'type':_0x558726,'resourceId':_0xe74191['id']}})[_0xf853('0x29')](function(){return _0x419cdc;});})['then'](function(){_0x4329e8[_0xf853('0x1f')](0xcc)[_0xf853('0x2e')]();});}};}function handleEntityNotFound(_0xa13d62,_0x30ce2e){return function(_0x27e257){if(!_0x27e257){_0xa13d62['sendStatus'](0x194);}return _0x27e257;};}function handleError(_0xc22042,_0x385df7){_0x385df7=_0x385df7||0x1f4;return function(_0x544526){logger[_0xf853('0x2f')](_0x544526[_0xf853('0x30')]);if(_0x544526[_0xf853('0x31')]){delete _0x544526['name'];}_0xc22042[_0xf853('0x1f')](_0x385df7)['send'](_0x544526);};}exports[_0xf853('0x32')]=function(_0x39ccaa,_0x4e3994){var _0x4f7310={},_0x2b4ca5={},_0xf38f14={'count':0x0,'rows':[]};var _0x48b5f4=_[_0xf853('0x33')](db[_0xf853('0x34')]['rawAttributes'],function(_0x56428e){return{'name':_0x56428e['fieldName'],'type':_0x56428e[_0xf853('0x35')][_0xf853('0x36')]};});_0x2b4ca5[_0xf853('0x37')]=_[_0xf853('0x33')](_0x48b5f4,'name');_0x2b4ca5[_0xf853('0x38')]=_['keys'](_0x39ccaa[_0xf853('0x38')]);_0x2b4ca5[_0xf853('0x39')]=_[_0xf853('0x3a')](_0x2b4ca5[_0xf853('0x37')],_0x2b4ca5[_0xf853('0x38')]);_0x4f7310[_0xf853('0x3b')]=_[_0xf853('0x3a')](_0x2b4ca5[_0xf853('0x37')],qs[_0xf853('0x3c')](_0x39ccaa[_0xf853('0x38')][_0xf853('0x3c')]));_0x4f7310['attributes']=_0x4f7310[_0xf853('0x3b')][_0xf853('0x3d')]?_0x4f7310[_0xf853('0x3b')]:_0x2b4ca5[_0xf853('0x37')];if(!_0x39ccaa['query']['hasOwnProperty'](_0xf853('0x3e'))){_0x4f7310[_0xf853('0x23')]=qs[_0xf853('0x23')](_0x39ccaa[_0xf853('0x38')][_0xf853('0x23')]);_0x4f7310[_0xf853('0x21')]=qs[_0xf853('0x21')](_0x39ccaa['query'][_0xf853('0x21')]);}_0x4f7310[_0xf853('0x3f')]=qs['sort'](_0x39ccaa[_0xf853('0x38')]['sort']);_0x4f7310[_0xf853('0x40')]=qs[_0xf853('0x39')](_[_0xf853('0x41')](_0x39ccaa['query'],_0x2b4ca5[_0xf853('0x39')]),_0x48b5f4);if(_0x39ccaa['query'][_0xf853('0x42')]){_0x4f7310[_0xf853('0x40')]=_[_0xf853('0x43')](_0x4f7310[_0xf853('0x40')],{'$or':_[_0xf853('0x33')](_0x48b5f4,function(_0x365354){if(_0x365354[_0xf853('0x35')]!==_0xf853('0x44')){var _0x4dd437={};_0x4dd437[_0x365354[_0xf853('0x31')]]={'$like':'%'+_0x39ccaa['query'][_0xf853('0x42')]+'%'};return _0x4dd437;}})});}_0x4f7310=_[_0xf853('0x43')]({},_0x4f7310,_0x39ccaa['options']);var _0x50e666={'where':_0x4f7310[_0xf853('0x40')]};return db[_0xf853('0x34')]['count'](_0x50e666)['then'](function(_0x4cc099){_0xf38f14[_0xf853('0x24')]=_0x4cc099;if(_0x39ccaa[_0xf853('0x38')][_0xf853('0x45')]){_0x4f7310[_0xf853('0x46')]=[{'all':!![]}];}return db[_0xf853('0x34')]['findAll'](_0x4f7310);})[_0xf853('0x29')](function(_0x31dd66){_0xf38f14['rows']=_0x31dd66;return _0xf38f14;})[_0xf853('0x29')](respondWithFilteredResult(_0x4e3994,_0x4f7310))[_0xf853('0x47')](handleError(_0x4e3994,null));};exports[_0xf853('0x48')]=function(_0x29d2af,_0xa9d063){var _0x530540={'raw':![],'where':{'id':_0x29d2af[_0xf853('0x49')]['id']}},_0xdca133={};_0xdca133[_0xf853('0x37')]=_['keys'](db[_0xf853('0x34')][_0xf853('0x4a')]);_0xdca133[_0xf853('0x38')]=_['keys'](_0x29d2af[_0xf853('0x38')]);_0xdca133['filters']=_[_0xf853('0x3a')](_0xdca133[_0xf853('0x37')],_0xdca133[_0xf853('0x38')]);_0x530540['attributes']=_['intersection'](_0xdca133[_0xf853('0x37')],qs[_0xf853('0x3c')](_0x29d2af['query'][_0xf853('0x3c')]));_0x530540[_0xf853('0x3b')]=_0x530540['attributes'][_0xf853('0x3d')]?_0x530540[_0xf853('0x3b')]:_0xdca133[_0xf853('0x37')];if(_0x29d2af[_0xf853('0x38')][_0xf853('0x45')]){_0x530540[_0xf853('0x46')]=[{'all':!![]}];}_0x530540=_[_0xf853('0x43')]({},_0x530540,_0x29d2af['options']);return db['CmList'][_0xf853('0x4b')](_0x530540)[_0xf853('0x29')](handleEntityNotFound(_0xa9d063,null))[_0xf853('0x29')](respondWithResult(_0xa9d063,null))[_0xf853('0x47')](handleError(_0xa9d063,null));};exports[_0xf853('0x4c')]=function(_0x4867f3,_0x1ea6ee){return db[_0xf853('0x34')]['create'](_0x4867f3['body'],{})[_0xf853('0x29')](function(_0x43dc69){var _0x4ab28a=_0x4867f3[_0xf853('0x4d')]['get']({'plain':!![]});if(!_0x4ab28a)throw new Error(_0xf853('0x4e'));if(_0x4ab28a[_0xf853('0x4f')]===_0xf853('0x4d')){var _0x10e4c0=_0x43dc69['get']({'plain':!![]});var _0x1eae0b=_0xf853('0x2c');return db[_0xf853('0x50')][_0xf853('0x4b')]({'where':{'name':_0x1eae0b,'userProfileId':_0x4ab28a[_0xf853('0x51')]},'raw':!![]})[_0xf853('0x29')](function(_0x143703){if(_0x143703&&_0x143703['autoAssociation']===0x0){return db[_0xf853('0x2d')]['create']({'name':_0x10e4c0[_0xf853('0x31')],'resourceId':_0x10e4c0['id'],'type':_0x143703['name'],'sectionId':_0x143703['id']},{})[_0xf853('0x29')](function(){return _0x43dc69;});}else{return _0x43dc69;}})[_0xf853('0x47')](function(_0x216955){logger[_0xf853('0x2f')](_0xf853('0x52'),_0x216955);throw _0x216955;});}return _0x43dc69;})['then'](respondWithResult(_0x1ea6ee,0xc9))[_0xf853('0x47')](handleError(_0x1ea6ee,null));};exports[_0xf853('0x28')]=function(_0x353df0,_0x1334eb){if(_0x353df0['body']['id']){delete _0x353df0[_0xf853('0x53')]['id'];}return db[_0xf853('0x34')][_0xf853('0x4b')]({'where':{'id':_0x353df0['params']['id']}})[_0xf853('0x29')](handleEntityNotFound(_0x1334eb,null))[_0xf853('0x29')](saveUpdates(_0x353df0[_0xf853('0x53')],null))[_0xf853('0x29')](respondWithResult(_0x1334eb,null))[_0xf853('0x47')](handleError(_0x1334eb,null));};exports['destroy']=function(_0x256884,_0x14539a){return db['CmList'][_0xf853('0x4b')]({'where':{'id':_0x256884[_0xf853('0x49')]['id']}})[_0xf853('0x29')](handleEntityNotFound(_0x14539a,null))[_0xf853('0x29')](removeEntity(_0x14539a,null))['catch'](handleError(_0x14539a,null));};exports['describe']=function(_0x286e1d,_0x623fa){return db['CmList']['describe']()[_0xf853('0x29')](respondWithResult(_0x623fa,null))[_0xf853('0x47')](handleError(_0x623fa,null));};exports['addDisposition']=function(_0x411014,_0x488504,_0x4f0d87){if(_0x411014[_0xf853('0x53')]['id']){delete _0x411014[_0xf853('0x53')]['id'];}return db[_0xf853('0x34')][_0xf853('0x4b')]({'where':{'id':_0x411014['params']['id']}})[_0xf853('0x29')](handleEntityNotFound(_0x488504,null))[_0xf853('0x29')](function(_0x21c92e){if(_0x21c92e){_0x411014[_0xf853('0x53')]['ListId']=_0x21c92e['id'];return db[_0xf853('0x54')][_0xf853('0x4c')](_0x411014[_0xf853('0x53')]);}})[_0xf853('0x29')](respondWithResult(_0x488504,null))[_0xf853('0x47')](handleError(_0x488504,null));};exports[_0xf853('0x55')]=function(_0x126853,_0xe9578b,_0x48fa7f){var _0x261b3b={'raw':![],'where':{}};var _0x748f9e={};var _0xbac05a={'count':0x0,'rows':[]};return db['CmList'][_0xf853('0x56')]({'where':{'id':_0x126853[_0xf853('0x49')]['id']}})[_0xf853('0x29')](handleEntityNotFound(_0xe9578b,null))[_0xf853('0x29')](function(_0x5e05eb){if(_0x5e05eb){_0x748f9e['model']=_[_0xf853('0x57')](db[_0xf853('0x54')][_0xf853('0x4a')]);_0x748f9e[_0xf853('0x38')]=_[_0xf853('0x57')](_0x126853[_0xf853('0x38')]);_0x748f9e['filters']=_[_0xf853('0x3a')](_0x748f9e[_0xf853('0x37')],_0x748f9e[_0xf853('0x38')]);_0x261b3b[_0xf853('0x3b')]=_[_0xf853('0x3a')](_0x748f9e[_0xf853('0x37')],qs[_0xf853('0x3c')](_0x126853[_0xf853('0x38')][_0xf853('0x3c')]));_0x261b3b[_0xf853('0x3b')]=_0x261b3b[_0xf853('0x3b')][_0xf853('0x3d')]?_0x261b3b[_0xf853('0x3b')]:_0x748f9e['model'];if(!_0x126853[_0xf853('0x38')][_0xf853('0x58')]('nolimit')){_0x261b3b[_0xf853('0x23')]=qs[_0xf853('0x23')](_0x126853[_0xf853('0x38')][_0xf853('0x23')]);_0x261b3b[_0xf853('0x21')]=qs[_0xf853('0x21')](_0x126853['query'][_0xf853('0x21')]);}_0x261b3b[_0xf853('0x3f')]=qs[_0xf853('0x59')](_0x126853[_0xf853('0x38')]['sort']);_0x261b3b[_0xf853('0x40')]=qs[_0xf853('0x39')](_['pick'](_0x126853[_0xf853('0x38')],_0x748f9e[_0xf853('0x39')]));_0x261b3b[_0xf853('0x40')][_0xf853('0x5a')]=_0x5e05eb['id'];if(_0x126853['query'][_0xf853('0x42')]){_0x261b3b['where']=_[_0xf853('0x43')](_0x261b3b['where'],{'$or':_[_0xf853('0x33')](_0x261b3b[_0xf853('0x3b')],function(_0x4f5f11){var _0x492d6e={};_0x492d6e[_0x4f5f11]={'$like':'%'+_0x126853[_0xf853('0x38')]['filter']+'%'};return _0x492d6e;})});}_0x261b3b=_[_0xf853('0x43')]({},_0x261b3b,_0x126853[_0xf853('0x5b')]);return db[_0xf853('0x54')][_0xf853('0x24')]({'where':_0x261b3b[_0xf853('0x40')]})[_0xf853('0x29')](function(_0x4e4424){_0xbac05a[_0xf853('0x24')]=_0x4e4424;if(_0x126853[_0xf853('0x38')][_0xf853('0x45')]){_0x261b3b[_0xf853('0x46')]=[{'all':!![]}];}return db[_0xf853('0x54')]['findAll'](_0x261b3b);})[_0xf853('0x29')](function(_0x5388ff){_0xbac05a['rows']=_0x5388ff;return _0xbac05a;});}})[_0xf853('0x29')](respondWithFilteredResult(_0xe9578b,_0x261b3b))[_0xf853('0x47')](handleError(_0xe9578b,null));};exports[_0xf853('0x5c')]=function(_0x981ebc,_0x42c16c,_0x1ee1f5){return db[_0xf853('0x34')][_0xf853('0x4b')]({'where':{'id':_0x981ebc[_0xf853('0x49')]['id']}})[_0xf853('0x29')](handleEntityNotFound(_0x42c16c,null))[_0xf853('0x29')](function(_0x3cd3bd){if(_0x3cd3bd){return _0x3cd3bd[_0xf853('0x5c')](_0x981ebc[_0xf853('0x38')][_0xf853('0x5d')]);}})[_0xf853('0x29')](respondWithStatusCode(_0x42c16c,null))[_0xf853('0x47')](handleError(_0x42c16c,null));};exports[_0xf853('0x5e')]=function(_0x590d2c,_0x163f83,_0x1a01c3){return db[_0xf853('0x34')][_0xf853('0x4b')]({'where':{'id':_0x590d2c['params']['id']}})[_0xf853('0x29')](handleEntityNotFound(_0x163f83,null))['then'](function(_0x5419f9){if(_0x5419f9){var _0x2bb4a0=[];var _0x4c17b8={'success':[],'errors':[]};return db[_0xf853('0x5f')][_0xf853('0x60')]()['then'](function(_0x4141ec){if(_0x590d2c[_0xf853('0x53')][_0xf853('0x61')]&&_[_0xf853('0x62')](_0x590d2c['body'][_0xf853('0x61')])){if(_0x590d2c['body'][_0xf853('0x61')][_0xf853('0x3d')]){_0x590d2c[_0xf853('0x53')]['tags']=_0x590d2c[_0xf853('0x53')][_0xf853('0x61')][_0xf853('0x63')](';')+';';}else{_0x590d2c[_0xf853('0x53')][_0xf853('0x61')]=null;}}else{_0x590d2c['body']['tags']=null;}if(_0x590d2c[_0xf853('0x53')]&&_[_0xf853('0x62')](_0x590d2c[_0xf853('0x53')])){for(var _0x122308=0x0;_0x122308<_0x590d2c[_0xf853('0x53')][_0xf853('0x3d')];_0x122308+=0x1){_0x590d2c[_0xf853('0x53')][_0x122308]['ListId']=_0x590d2c['params']['id'];_0x2bb4a0[_0xf853('0x64')](_0x590d2c[_0xf853('0x53')][_0x122308]);}return BPromise[_0xf853('0x65')](_0x2bb4a0,function(_0x45bd76){return db[_0xf853('0x5f')]['create'](_[_0xf853('0x66')](_0x45bd76,['ids','id'])||{},{'fields':_[_0xf853('0x57')](_0x4141ec),'raw':!![]})[_0xf853('0x29')](function(_0x13836e){_0x4c17b8['success'][_0xf853('0x64')](_0x13836e[_0xf853('0x67')]);})[_0xf853('0x47')](function(_0x43bf91){_0x4c17b8[_0xf853('0x68')]['push']({'data':_0x45bd76,'error':_0x43bf91[_0xf853('0x69')]});});})[_0xf853('0x29')](function(_0x26464c){return _0x4c17b8;})[_0xf853('0x47')](function(_0x5ace75){return _0x5ace75;});}else{_0x163f83[_0xf853('0x1f')](0x190)[_0xf853('0x20')]({'message':_0xf853('0x6a')});}});}})[_0xf853('0x29')](respondWithResult(_0x163f83,null))[_0xf853('0x47')](handleError(_0x163f83,null));};exports[_0xf853('0x6b')]=function(_0x499a75,_0x40ef39,_0x278a12){var _0x2d772b;return db[_0xf853('0x34')][_0xf853('0x4b')]({'where':{'id':_0x499a75[_0xf853('0x49')]['id']},'include':[{'model':db[_0xf853('0x6c')],'as':'CustomFields'}]})[_0xf853('0x29')](handleEntityNotFound(_0x40ef39,null))['then'](function(_0x5df7e4){if(_0x5df7e4){_0x2d772b=_0x5df7e4;return db[_0xf853('0x5f')]['rawAttributes'];}})[_0xf853('0x29')](function(_0x5a3025){if(_0x5a3025){var _0x54889b={};var _0x482b84={};_0x482b84[_0xf853('0x37')]=_[_0xf853('0x6d')](_[_0xf853('0x57')](_0x5a3025),_[_0xf853('0x33')](_0x2d772b[_0xf853('0x6e')],function(_0x4a393e){return util[_0xf853('0x6f')]('cf_%d',_0x4a393e['id']);}));_0x482b84[_0xf853('0x38')]=_['keys'](_0x499a75['query']);_0x482b84[_0xf853('0x39')]=_['intersection'](_0x482b84['model'],_0x482b84[_0xf853('0x38')]);_0x54889b[_0xf853('0x3b')]=_['intersection'](_0x482b84['model'],qs[_0xf853('0x3c')](_0x499a75['query'][_0xf853('0x3c')]));_0x54889b[_0xf853('0x3b')]=_0x54889b[_0xf853('0x3b')][_0xf853('0x3d')]?_0x54889b[_0xf853('0x3b')]:_0x482b84['model'];if(!_0x499a75['query'][_0xf853('0x58')](_0xf853('0x3e'))){_0x54889b[_0xf853('0x23')]=qs[_0xf853('0x23')](_0x499a75[_0xf853('0x38')][_0xf853('0x23')]);_0x54889b[_0xf853('0x21')]=qs[_0xf853('0x21')](_0x499a75[_0xf853('0x38')][_0xf853('0x21')]);}_0x54889b[_0xf853('0x3f')]=qs[_0xf853('0x59')](_0x499a75[_0xf853('0x38')][_0xf853('0x59')]);_0x54889b[_0xf853('0x40')]=qs[_0xf853('0x39')](_['pick'](_0x499a75[_0xf853('0x38')],_0x482b84[_0xf853('0x39')]));_0x54889b['raw']=!![];if(_0x499a75[_0xf853('0x38')]['filter']){_0x54889b[_0xf853('0x40')]=_[_0xf853('0x43')](_0x54889b[_0xf853('0x40')],{'$or':_[_0xf853('0x33')](_0x54889b['attributes'],function(_0x25c003){var _0x9d6335={};_0x9d6335[_0x25c003]={'$like':'%'+_0x499a75[_0xf853('0x38')][_0xf853('0x42')]+'%'};return _0x9d6335;})});}_0x54889b=_[_0xf853('0x43')]({},_0x54889b,_0x499a75[_0xf853('0x5b')]);return _0x2d772b['getContacts'](_0x54889b);}})[_0xf853('0x29')](respondWithResult(_0x40ef39,null))[_0xf853('0x47')](handleError(_0x40ef39,null));};exports[_0xf853('0x70')]=function(_0x4e2d18,_0x41b05a,_0x25d395){var _0x9c3060;var _0x35b8c6;var _0x2c78e0;var _0x10dec4=_0x4e2d18[_0xf853('0x49')]['id'];csv_results=[];return db[_0xf853('0x71')]['findAll']({'attributes':['id',_0xf853('0x31')],'raw':!![],'order':['OrderBy']})[_0xf853('0x29')](function(_0x1c7c56){_0x9c3060=_0x1c7c56;var _0x3989fb=_[_0xf853('0x57')](db[_0xf853('0x5f')][_0xf853('0x4a')]);return db[_0xf853('0x6c')][_0xf853('0x72')]({'raw':!![],'attributes':['id',_0xf853('0x73')]})[_0xf853('0x29')](function(_0x4c0f96){_0x35b8c6=_0x4c0f96;var _0x2f689e=squel['select']()[_0xf853('0x3c')](_0x3989fb)['from'](_0xf853('0x74'),'c')[_0xf853('0x40')](_0xf853('0x75'),_0x10dec4)[_0xf853('0x40')](_0xf853('0x76'))[_0xf853('0x77')]();for(var _0x5ac24d=0x0;_0x5ac24d<_0x35b8c6[_0xf853('0x3d')];_0x5ac24d++){_0x2f689e[_0xf853('0x78')](_0xf853('0x79')+_0x35b8c6[_0x5ac24d]['id'],_0xf853('0x7a')+_0x35b8c6[_0x5ac24d][_0xf853('0x73')]);}for(var _0x5ac24d=0x0;_0x5ac24d<_0x9c3060[_0xf853('0x3d')];_0x5ac24d++){_0x2f689e['field'](squel[_0xf853('0x7b')]()[_0xf853('0x78')](_0xf853('0x7c'))['from']('cm_contact_has_items')[_0xf853('0x40')](_0xf853('0x7d'),_0x9c3060[_0x5ac24d]['id'])[_0xf853('0x40')](_0xf853('0x7e')),_0xf853('0x7f')+_0x9c3060[_0x5ac24d][_0xf853('0x31')]);_0x2f689e[_0xf853('0x78')](squel[_0xf853('0x7b')]()[_0xf853('0x78')]('description')['from'](_0xf853('0x80'))[_0xf853('0x40')](_0xf853('0x7d'),_0x9c3060[_0x5ac24d]['id'])[_0xf853('0x40')]('CmContactId\x20=\x20c.id'),_0xf853('0x81')+_0x9c3060[_0x5ac24d][_0xf853('0x31')]);}var _0x3136c6=[];_0x3136c6[_0xf853('0x64')](_0x2f689e[_0xf853('0x82')]());BPromise['each'](_0x3136c6,handleQuery)[_0xf853('0x29')](function(_0x1be978){handleQuery(_0x2f689e[_0xf853('0x82')]());var _0x20d72b=csv_results[0x0];if(!_['isEmpty'](_0x20d72b)){var _0x262a16=toCsv(_0x20d72b);var _0x6320e7=Date['now']();fs[_0xf853('0x83')](util[_0xf853('0x6f')](_0xf853('0x84'),_0x10dec4,_0x6320e7),_0x262a16);_0x41b05a['setHeader'](_0xf853('0x85'),'attachment;\x20filename='+util[_0xf853('0x6f')](_0xf853('0x86'),_0x10dec4,_0x6320e7));_0x41b05a[_0xf853('0x87')](_0xf853('0x88'),_0xf853('0x89'));return _0x41b05a['download'](util[_0xf853('0x6f')]('/tmp/list_%d_%s.csv',_0x10dec4,_0x6320e7));}else{return _0x41b05a[_0xf853('0x1e')](0xcc);}});});});};exports[_0xf853('0x8a')]=function(_0x49612e,_0x5b763e,_0x1d060c){var _0xdae17a;delete _0x49612e[_0xf853('0x53')]['id'];return db[_0xf853('0x34')]['findOne']({'where':{'id':_0x49612e[_0xf853('0x49')]['id']}})[_0xf853('0x29')](handleEntityNotFound(_0x5b763e,null))[_0xf853('0x29')](function(_0x869646){if(_0x869646){return db[_0xf853('0x8b')][_0xf853('0x8c')](function(_0x1b6b17){return db['CmCustomField'][_0xf853('0x4c')](_0x49612e[_0xf853('0x53')],{'transaction':_0x1b6b17})[_0xf853('0x29')](function(_0x4e7c2f){_0xdae17a=_0x4e7c2f;return _0x869646['addCustomFields'](_0x4e7c2f,{'transaction':_0x1b6b17});})[_0xf853('0x29')](function(){var _0x5eb886={'type':db['Sequelize'][_0xf853('0x8d')],'transaction':_0x1b6b17};switch(_0x49612e[_0xf853('0x53')][_0xf853('0x35')]){case _0xf853('0x8e'):_0x5eb886[_0xf853('0x35')]=db[_0xf853('0x8f')][_0xf853('0x8d')];break;case _0xf853('0x90'):_0x5eb886[_0xf853('0x35')]=db[_0xf853('0x8f')][_0xf853('0x91')];break;case _0xf853('0x92'):_0x5eb886[_0xf853('0x35')]=db[_0xf853('0x8f')][_0xf853('0x93')];_0x5eb886['defaultValue']=![];break;default:}return db[_0xf853('0x8b')][_0xf853('0x94')][_0xf853('0x95')](_0xf853('0x74'),util[_0xf853('0x6f')](_0xf853('0x96'),_0xdae17a['id']),_0x5eb886);})[_0xf853('0x29')](function(){return _0xdae17a;});});}})['then'](respondWithResult(_0x5b763e,null))[_0xf853('0x47')](handleError(_0x5b763e,null));};exports[_0xf853('0x97')]=function(_0x286405,_0xc214a8,_0x570cb1){var _0x485ef7={};var _0x5cea22={};var _0x43acbc;var _0x3de3af;return db[_0xf853('0x34')][_0xf853('0x56')]({'where':{'id':_0x286405[_0xf853('0x49')]['id']}})['then'](handleEntityNotFound(_0xc214a8,null))['then'](function(_0x5db012){if(_0x5db012){_0x43acbc=_0x5db012;_0x5cea22[_0xf853('0x37')]=_['keys'](db['CmCustomField'][_0xf853('0x4a')]);_0x5cea22[_0xf853('0x38')]=_[_0xf853('0x57')](_0x286405['query']);_0x5cea22[_0xf853('0x39')]=_[_0xf853('0x3a')](_0x5cea22[_0xf853('0x37')],_0x5cea22['query']);_0x485ef7[_0xf853('0x3b')]=_[_0xf853('0x3a')](_0x5cea22[_0xf853('0x37')],qs[_0xf853('0x3c')](_0x286405[_0xf853('0x38')][_0xf853('0x3c')]));_0x485ef7[_0xf853('0x3b')]=_0x485ef7[_0xf853('0x3b')]['length']?_0x485ef7['attributes']:_0x5cea22[_0xf853('0x37')];_0x485ef7[_0xf853('0x3f')]=qs[_0xf853('0x59')](_0x286405[_0xf853('0x38')][_0xf853('0x59')]);_0x485ef7[_0xf853('0x40')]=qs['filters'](_[_0xf853('0x41')](_0x286405[_0xf853('0x38')],_0x5cea22['filters']));_0x485ef7[_0xf853('0x40')]=_[_0xf853('0x43')](_0x485ef7['where'],{'$or':[{'ListId':_0x5db012['id']},{'ListId':null}]});if(_0x286405[_0xf853('0x38')][_0xf853('0x42')]){_0x485ef7[_0xf853('0x40')]=_['merge'](_0x485ef7[_0xf853('0x40')],{'$or':_[_0xf853('0x33')](_0x485ef7[_0xf853('0x3b')],function(_0x212c00){var _0x4a65dc={};_0x4a65dc[_0x212c00]={'$like':'%'+_0x286405[_0xf853('0x38')][_0xf853('0x42')]+'%'};return _0x4a65dc;})});}_0x485ef7=_[_0xf853('0x43')]({},_0x485ef7,_0x286405['options']);return db[_0xf853('0x6c')][_0xf853('0x98')](_0x485ef7);}})[_0xf853('0x29')](respondWithResult(_0xc214a8,null))['catch'](handleError(_0xc214a8,null));};exports[_0xf853('0x99')]=function(_0x34ef0a,_0x17874e){return db[_0xf853('0x6c')][_0xf853('0x98')]({'where':{'ListId':null}})[_0xf853('0x29')](handleEntityNotFound(_0x17874e,null))[_0xf853('0x29')](function(_0x185b1c){return _0x185b1c;})[_0xf853('0x29')](respondWithResult(_0x17874e,null))['catch'](handleError(_0x17874e,null));};exports[_0xf853('0x9a')]=function(_0x42cd92,_0x140285,_0x24fdbb){return db[_0xf853('0x34')][_0xf853('0x4b')]({'where':{'id':_0x42cd92[_0xf853('0x49')]['id']}})[_0xf853('0x29')](handleEntityNotFound(_0x140285,null))[_0xf853('0x29')](function(_0x389345){if(_0x389345){return _0x389345[_0xf853('0x9a')](_0x42cd92[_0xf853('0x53')][_0xf853('0x5d')],_['omit'](_0x42cd92['body'],[_0xf853('0x5d'),'id'])||{})[_0xf853('0x9b')](function(_0x2aba32){for(var _0x43a204=0x0;_0x43a204<_0x42cd92[_0xf853('0x53')][_0xf853('0x5d')][_0xf853('0x3d')];_0x43a204+=0x1){socket['emit'](_0xf853('0x9c'),{'UserId':Number(_0x42cd92['body'][_0xf853('0x5d')][_0x43a204]),'CmListId':Number(_0x42cd92[_0xf853('0x49')]['id'])});}return _0x2aba32;});}})[_0xf853('0x29')](respondWithResult(_0x140285,null))['catch'](handleError(_0x140285,null));};exports[_0xf853('0x9d')]=function(_0x4f857e,_0x364ace,_0x303db2){return db[_0xf853('0x34')][_0xf853('0x4b')]({'where':{'id':_0x4f857e[_0xf853('0x49')]['id']}})[_0xf853('0x29')](handleEntityNotFound(_0x364ace,null))[_0xf853('0x29')](function(_0x2f0169){if(_0x2f0169){return _0x2f0169['removeAgents'](_0x4f857e[_0xf853('0x38')][_0xf853('0x5d')])['then'](function(){if(_[_0xf853('0x62')](_0x4f857e[_0xf853('0x38')][_0xf853('0x5d')])){for(var _0x1a1fd8=0x0;_0x1a1fd8<_0x4f857e[_0xf853('0x38')][_0xf853('0x5d')][_0xf853('0x3d')];_0x1a1fd8+=0x1){socket[_0xf853('0x9e')]('userCmList:remove',{'UserId':Number(_0x4f857e[_0xf853('0x38')][_0xf853('0x5d')][_0x1a1fd8]),'CmListId':Number(_0x4f857e[_0xf853('0x49')]['id'])});}}else{socket[_0xf853('0x9e')]('userCmList:remove',{'UserId':Number(_0x4f857e[_0xf853('0x38')][_0xf853('0x5d')]),'CmListId':Number(_0x4f857e[_0xf853('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x364ace,null))[_0xf853('0x47')](handleError(_0x364ace,null));};exports[_0xf853('0x9f')]=function(_0x17ed5b,_0x2d8f7c,_0x5952f1){var _0x23d643={};var _0x39c56d={};var _0x2c81cb;var _0x3eb82c;return db['CmList'][_0xf853('0x56')]({'where':{'id':_0x17ed5b[_0xf853('0x49')]['id']}})[_0xf853('0x29')](handleEntityNotFound(_0x2d8f7c,null))['then'](function(_0x4e5f4e){if(_0x4e5f4e){_0x2c81cb=_0x4e5f4e;_0x39c56d['model']=_['keys'](db['User'][_0xf853('0x4a')]);_0x39c56d[_0xf853('0x38')]=_[_0xf853('0x57')](_0x17ed5b['query']);_0x39c56d[_0xf853('0x39')]=_[_0xf853('0x3a')](_0x39c56d[_0xf853('0x37')],_0x39c56d[_0xf853('0x38')]);_0x23d643[_0xf853('0x3b')]=_[_0xf853('0x3a')](_0x39c56d[_0xf853('0x37')],qs['fields'](_0x17ed5b['query'][_0xf853('0x3c')]));_0x23d643[_0xf853('0x3b')]=_0x23d643[_0xf853('0x3b')]['length']?_0x23d643[_0xf853('0x3b')]:_0x39c56d[_0xf853('0x37')];_0x23d643[_0xf853('0x3f')]=qs[_0xf853('0x59')](_0x17ed5b[_0xf853('0x38')]['sort']);_0x23d643[_0xf853('0x40')]=qs[_0xf853('0x39')](_['pick'](_0x17ed5b[_0xf853('0x38')],_0x39c56d[_0xf853('0x39')]));if(_0x17ed5b[_0xf853('0x38')][_0xf853('0x42')]){_0x23d643[_0xf853('0x40')]=_[_0xf853('0x43')](_0x23d643[_0xf853('0x40')],{'$or':_[_0xf853('0x33')](_0x23d643[_0xf853('0x3b')],function(_0x4de40c){var _0x2ffa36={};_0x2ffa36[_0x4de40c]={'$like':'%'+_0x17ed5b[_0xf853('0x38')][_0xf853('0x42')]+'%'};return _0x2ffa36;})});}_0x23d643=_[_0xf853('0x43')]({},_0x23d643,_0x17ed5b['options']);return _0x2c81cb['getAgents'](_0x23d643);}})[_0xf853('0x29')](function(_0x11fe10){if(_0x11fe10){_0x3eb82c=_0x11fe10['length'];if(!_0x17ed5b[_0xf853('0x38')][_0xf853('0x58')](_0xf853('0x3e'))){_0x23d643[_0xf853('0x23')]=qs[_0xf853('0x23')](_0x17ed5b['query'][_0xf853('0x23')]);_0x23d643[_0xf853('0x21')]=qs[_0xf853('0x21')](_0x17ed5b['query']['offset']);}return _0x2c81cb[_0xf853('0x9f')](_0x23d643);}})['then'](function(_0x41cae3){if(_0x41cae3){return _0x41cae3?{'count':_0x3eb82c,'rows':_0x41cae3}:null;}})[_0xf853('0x29')](respondWithResult(_0x2d8f7c,null))['catch'](handleError(_0x2d8f7c,null));};function handleQuery(_0x4f006d){logger[_0xf853('0xa0')](_0x4f006d);return db[_0xf853('0x8b')][_0xf853('0x38')](_0x4f006d)[_0xf853('0x9b')](function(_0x4dcd89){csv_results[_0xf853('0x64')](_0x4dcd89);})['catch'](function(_0x32108e){logger[_0xf853('0x2f')](_0x32108e[_0xf853('0x69')]);});} \ No newline at end of file +var _0xcf6b=['model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','ListId','Disposition','getDispositions','findOne','rawAttributes','pick','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','cf_%d','hasOwnProperty','raw','ContactItemType','OrderBy','CmCustomField','alias','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','select','description_additionalPhone_','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','format','list_%d_%s.csv','Content-type','text/csv','download','sendStatus','addCustomField','sequelize','transaction','addCustomFields','TEXT','text','number','Sequelize','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','spread','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','get','Lists','UserProfileResource','destroy','stack','name','CmList','fieldName','type','key'];(function(_0x3ad7be,_0x224585){var _0x2b6c8a=function(_0xa09237){while(--_0xa09237){_0x3ad7be['push'](_0x3ad7be['shift']());}};_0x2b6c8a(++_0x224585);}(_0xcf6b,0x72));var _0xbcf6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcf6b[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xbcf6('0x0'));var rimraf=require(_0xbcf6('0x1'));var zipdir=require(_0xbcf6('0x2'));var jsonpatch=require(_0xbcf6('0x3'));var rp=require('request-promise');var moment=require(_0xbcf6('0x4'));var BPromise=require(_0xbcf6('0x5'));var Mustache=require(_0xbcf6('0x6'));var util=require(_0xbcf6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xbcf6('0x8'));var ejs=require(_0xbcf6('0x9'));var fs=require('fs');var fs_extra=require(_0xbcf6('0xa'));var _=require(_0xbcf6('0xb'));var squel=require(_0xbcf6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbcf6('0xd'));var toCsv=require(_0xbcf6('0x8'));var querystring=require(_0xbcf6('0xe'));var Papa=require('papaparse');var Redis=require(_0xbcf6('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbcf6('0x10'));var hardwareService=require(_0xbcf6('0x11'));var logger=require(_0xbcf6('0x12'))(_0xbcf6('0x13'));var utils=require('../../config/utils');var config=require(_0xbcf6('0x14'));var licenseUtil=require(_0xbcf6('0x15'));var db=require(_0xbcf6('0x16'))['db'];var csv_results;config[_0xbcf6('0x17')]=_[_0xbcf6('0x18')](config[_0xbcf6('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xbcf6('0x19'))(new Redis(config[_0xbcf6('0x17')]));require('./cmList.socket')[_0xbcf6('0x1a')](socket);function respondWithStatusCode(_0xaa2d54,_0x26c683){_0x26c683=_0x26c683||0xcc;return function(_0x157db6){if(_0x157db6){return _0xaa2d54['sendStatus'](_0x26c683);}return _0xaa2d54['status'](_0x26c683)['end']();};}function respondWithResult(_0x51537f,_0xdc824d){_0xdc824d=_0xdc824d||0xc8;return function(_0x11e87a){if(_0x11e87a){return _0x51537f[_0xbcf6('0x1b')](_0xdc824d)[_0xbcf6('0x1c')](_0x11e87a);}};}function respondWithFilteredResult(_0x48aa84,_0x1dc6c9){return function(_0x992387){if(_0x992387){var _0x39388e=typeof _0x1dc6c9[_0xbcf6('0x1d')]===_0xbcf6('0x1e')&&typeof _0x1dc6c9['limit']===_0xbcf6('0x1e');var _0x5f1d52=_0x992387[_0xbcf6('0x1f')];var _0x9153c2=_0x39388e?0x0:_0x1dc6c9[_0xbcf6('0x1d')];var _0x340890=_0x39388e?_0x992387[_0xbcf6('0x1f')]:_0x1dc6c9['offset']+_0x1dc6c9[_0xbcf6('0x20')];var _0x5b4061;if(_0x340890>=_0x5f1d52){_0x340890=_0x5f1d52;_0x5b4061=0xc8;}else{_0x5b4061=0xce;}_0x48aa84[_0xbcf6('0x1b')](_0x5b4061);return _0x48aa84['set'](_0xbcf6('0x21'),_0x9153c2+'-'+_0x340890+'/'+_0x5f1d52)[_0xbcf6('0x1c')](_0x992387);}return null;};}function patchUpdates(_0x5b6273){return function(_0x5f03a3){try{jsonpatch[_0xbcf6('0x22')](_0x5f03a3,_0x5b6273,!![]);}catch(_0x34fb4e){return BPromise['reject'](_0x34fb4e);}return _0x5f03a3[_0xbcf6('0x23')]();};}function saveUpdates(_0x95b32c,_0x445d8e){return function(_0x1fbac6){if(_0x1fbac6){return _0x1fbac6[_0xbcf6('0x24')](_0x95b32c)['then'](function(_0x398fe8){return _0x398fe8;});}return null;};}function removeEntity(_0x323021,_0x3bf80a){return function(_0xbc32ec){if(_0xbc32ec){return _0xbc32ec['destroy']()[_0xbcf6('0x25')](function(){var _0x3ea3ad=_0xbc32ec[_0xbcf6('0x26')]({'plain':!![]});var _0x4d0796=_0xbcf6('0x27');return db[_0xbcf6('0x28')][_0xbcf6('0x29')]({'where':{'type':_0x4d0796,'resourceId':_0x3ea3ad['id']}})['then'](function(){return _0xbc32ec;});})[_0xbcf6('0x25')](function(){_0x323021['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c1f8d,_0x563bdf){return function(_0x33ad06){if(!_0x33ad06){_0x2c1f8d['sendStatus'](0x194);}return _0x33ad06;};}function handleError(_0x4e894e,_0x4048ed){_0x4048ed=_0x4048ed||0x1f4;return function(_0x1788ea){logger['error'](_0x1788ea[_0xbcf6('0x2a')]);if(_0x1788ea['name']){delete _0x1788ea[_0xbcf6('0x2b')];}_0x4e894e[_0xbcf6('0x1b')](_0x4048ed)['send'](_0x1788ea);};}exports['index']=function(_0x5c44a1,_0x4c859d){var _0x72e391={},_0x242f25={},_0x44a292={'count':0x0,'rows':[]};var _0x2206d3=_['map'](db[_0xbcf6('0x2c')]['rawAttributes'],function(_0x2f9e9f){return{'name':_0x2f9e9f[_0xbcf6('0x2d')],'type':_0x2f9e9f[_0xbcf6('0x2e')][_0xbcf6('0x2f')]};});_0x242f25[_0xbcf6('0x30')]=_[_0xbcf6('0x31')](_0x2206d3,_0xbcf6('0x2b'));_0x242f25[_0xbcf6('0x32')]=_[_0xbcf6('0x33')](_0x5c44a1['query']);_0x242f25['filters']=_[_0xbcf6('0x34')](_0x242f25[_0xbcf6('0x30')],_0x242f25[_0xbcf6('0x32')]);_0x72e391['attributes']=_[_0xbcf6('0x34')](_0x242f25[_0xbcf6('0x30')],qs[_0xbcf6('0x35')](_0x5c44a1['query'][_0xbcf6('0x35')]));_0x72e391[_0xbcf6('0x36')]=_0x72e391[_0xbcf6('0x36')][_0xbcf6('0x37')]?_0x72e391['attributes']:_0x242f25[_0xbcf6('0x30')];if(!_0x5c44a1[_0xbcf6('0x32')]['hasOwnProperty'](_0xbcf6('0x38'))){_0x72e391[_0xbcf6('0x20')]=qs[_0xbcf6('0x20')](_0x5c44a1[_0xbcf6('0x32')][_0xbcf6('0x20')]);_0x72e391[_0xbcf6('0x1d')]=qs[_0xbcf6('0x1d')](_0x5c44a1[_0xbcf6('0x32')]['offset']);}_0x72e391[_0xbcf6('0x39')]=qs[_0xbcf6('0x3a')](_0x5c44a1['query'][_0xbcf6('0x3a')]);_0x72e391['where']=qs[_0xbcf6('0x3b')](_['pick'](_0x5c44a1[_0xbcf6('0x32')],_0x242f25[_0xbcf6('0x3b')]),_0x2206d3);if(_0x5c44a1[_0xbcf6('0x32')][_0xbcf6('0x3c')]){_0x72e391[_0xbcf6('0x3d')]=_['merge'](_0x72e391[_0xbcf6('0x3d')],{'$or':_[_0xbcf6('0x31')](_0x2206d3,function(_0x4c58f5){if(_0x4c58f5[_0xbcf6('0x2e')]!==_0xbcf6('0x3e')){var _0x2055c4={};_0x2055c4[_0x4c58f5['name']]={'$like':'%'+_0x5c44a1[_0xbcf6('0x32')][_0xbcf6('0x3c')]+'%'};return _0x2055c4;}})});}_0x72e391=_[_0xbcf6('0x3f')]({},_0x72e391,_0x5c44a1[_0xbcf6('0x40')]);var _0xeaa133={'where':_0x72e391[_0xbcf6('0x3d')]};return db[_0xbcf6('0x2c')][_0xbcf6('0x1f')](_0xeaa133)[_0xbcf6('0x25')](function(_0x472148){_0x44a292[_0xbcf6('0x1f')]=_0x472148;if(_0x5c44a1['query'][_0xbcf6('0x41')]){_0x72e391[_0xbcf6('0x42')]=[{'all':!![]}];}return db[_0xbcf6('0x2c')][_0xbcf6('0x43')](_0x72e391);})[_0xbcf6('0x25')](function(_0x5eb4c9){_0x44a292[_0xbcf6('0x44')]=_0x5eb4c9;return _0x44a292;})[_0xbcf6('0x25')](respondWithFilteredResult(_0x4c859d,_0x72e391))[_0xbcf6('0x45')](handleError(_0x4c859d,null));};exports[_0xbcf6('0x46')]=function(_0x501c63,_0x25a2a1){var _0x2f4f44={'raw':![],'where':{'id':_0x501c63[_0xbcf6('0x47')]['id']}},_0x5e61af={};_0x5e61af[_0xbcf6('0x30')]=_[_0xbcf6('0x33')](db[_0xbcf6('0x2c')]['rawAttributes']);_0x5e61af[_0xbcf6('0x32')]=_['keys'](_0x501c63[_0xbcf6('0x32')]);_0x5e61af['filters']=_['intersection'](_0x5e61af[_0xbcf6('0x30')],_0x5e61af['query']);_0x2f4f44[_0xbcf6('0x36')]=_[_0xbcf6('0x34')](_0x5e61af[_0xbcf6('0x30')],qs[_0xbcf6('0x35')](_0x501c63['query']['fields']));_0x2f4f44['attributes']=_0x2f4f44[_0xbcf6('0x36')][_0xbcf6('0x37')]?_0x2f4f44[_0xbcf6('0x36')]:_0x5e61af[_0xbcf6('0x30')];if(_0x501c63[_0xbcf6('0x32')]['includeAll']){_0x2f4f44[_0xbcf6('0x42')]=[{'all':!![]}];}_0x2f4f44=_[_0xbcf6('0x3f')]({},_0x2f4f44,_0x501c63[_0xbcf6('0x40')]);return db[_0xbcf6('0x2c')]['find'](_0x2f4f44)['then'](handleEntityNotFound(_0x25a2a1,null))[_0xbcf6('0x25')](respondWithResult(_0x25a2a1,null))[_0xbcf6('0x45')](handleError(_0x25a2a1,null));};exports[_0xbcf6('0x48')]=function(_0x3782ef,_0x4732ee){return db['CmList']['create'](_0x3782ef[_0xbcf6('0x49')],{})[_0xbcf6('0x25')](function(_0x135bfe){var _0x401e7f=_0x3782ef[_0xbcf6('0x4a')][_0xbcf6('0x26')]({'plain':!![]});if(!_0x401e7f)throw new Error(_0xbcf6('0x4b'));if(_0x401e7f[_0xbcf6('0x4c')]===_0xbcf6('0x4a')){var _0x3b9ee7=_0x135bfe['get']({'plain':!![]});var _0x4950f5='Lists';return db[_0xbcf6('0x4d')]['find']({'where':{'name':_0x4950f5,'userProfileId':_0x401e7f[_0xbcf6('0x4e')]},'raw':!![]})[_0xbcf6('0x25')](function(_0x457c83){if(_0x457c83&&_0x457c83['autoAssociation']===0x0){return db['UserProfileResource'][_0xbcf6('0x48')]({'name':_0x3b9ee7['name'],'resourceId':_0x3b9ee7['id'],'type':_0x457c83[_0xbcf6('0x2b')],'sectionId':_0x457c83['id']},{})['then'](function(){return _0x135bfe;});}else{return _0x135bfe;}})['catch'](function(_0x1c48f6){logger[_0xbcf6('0x4f')](_0xbcf6('0x50'),_0x1c48f6);throw _0x1c48f6;});}return _0x135bfe;})[_0xbcf6('0x25')](respondWithResult(_0x4732ee,0xc9))[_0xbcf6('0x45')](handleError(_0x4732ee,null));};exports[_0xbcf6('0x24')]=function(_0x739b82,_0x1724e4){if(_0x739b82[_0xbcf6('0x49')]['id']){delete _0x739b82[_0xbcf6('0x49')]['id'];}return db[_0xbcf6('0x2c')][_0xbcf6('0x51')]({'where':{'id':_0x739b82[_0xbcf6('0x47')]['id']}})[_0xbcf6('0x25')](handleEntityNotFound(_0x1724e4,null))['then'](saveUpdates(_0x739b82[_0xbcf6('0x49')],null))[_0xbcf6('0x25')](respondWithResult(_0x1724e4,null))['catch'](handleError(_0x1724e4,null));};exports[_0xbcf6('0x29')]=function(_0x5b5be0,_0x5dc5dc){return db['CmList'][_0xbcf6('0x51')]({'where':{'id':_0x5b5be0[_0xbcf6('0x47')]['id']}})[_0xbcf6('0x25')](handleEntityNotFound(_0x5dc5dc,null))[_0xbcf6('0x25')](removeEntity(_0x5dc5dc,null))[_0xbcf6('0x45')](handleError(_0x5dc5dc,null));};exports[_0xbcf6('0x52')]=function(_0x5b67fd,_0x180edb){return db['CmList'][_0xbcf6('0x52')]()[_0xbcf6('0x25')](respondWithResult(_0x180edb,null))[_0xbcf6('0x45')](handleError(_0x180edb,null));};exports['addDisposition']=function(_0x35f862,_0x1f423e,_0x21da89){if(_0x35f862[_0xbcf6('0x49')]['id']){delete _0x35f862['body']['id'];}return db[_0xbcf6('0x2c')][_0xbcf6('0x51')]({'where':{'id':_0x35f862[_0xbcf6('0x47')]['id']}})[_0xbcf6('0x25')](handleEntityNotFound(_0x1f423e,null))[_0xbcf6('0x25')](function(_0x234809){if(_0x234809){_0x35f862[_0xbcf6('0x49')][_0xbcf6('0x53')]=_0x234809['id'];return db[_0xbcf6('0x54')][_0xbcf6('0x48')](_0x35f862[_0xbcf6('0x49')]);}})[_0xbcf6('0x25')](respondWithResult(_0x1f423e,null))[_0xbcf6('0x45')](handleError(_0x1f423e,null));};exports[_0xbcf6('0x55')]=function(_0x5d42b0,_0x4edb30,_0x3d433a){var _0x55175b={'raw':![],'where':{}};var _0x441a42={};var _0x1ea029={'count':0x0,'rows':[]};return db['CmList'][_0xbcf6('0x56')]({'where':{'id':_0x5d42b0[_0xbcf6('0x47')]['id']}})[_0xbcf6('0x25')](handleEntityNotFound(_0x4edb30,null))[_0xbcf6('0x25')](function(_0x1670e6){if(_0x1670e6){_0x441a42[_0xbcf6('0x30')]=_[_0xbcf6('0x33')](db['Disposition'][_0xbcf6('0x57')]);_0x441a42['query']=_[_0xbcf6('0x33')](_0x5d42b0[_0xbcf6('0x32')]);_0x441a42[_0xbcf6('0x3b')]=_[_0xbcf6('0x34')](_0x441a42['model'],_0x441a42[_0xbcf6('0x32')]);_0x55175b['attributes']=_[_0xbcf6('0x34')](_0x441a42[_0xbcf6('0x30')],qs[_0xbcf6('0x35')](_0x5d42b0[_0xbcf6('0x32')][_0xbcf6('0x35')]));_0x55175b[_0xbcf6('0x36')]=_0x55175b[_0xbcf6('0x36')][_0xbcf6('0x37')]?_0x55175b[_0xbcf6('0x36')]:_0x441a42[_0xbcf6('0x30')];if(!_0x5d42b0[_0xbcf6('0x32')]['hasOwnProperty'](_0xbcf6('0x38'))){_0x55175b[_0xbcf6('0x20')]=qs['limit'](_0x5d42b0['query'][_0xbcf6('0x20')]);_0x55175b[_0xbcf6('0x1d')]=qs[_0xbcf6('0x1d')](_0x5d42b0[_0xbcf6('0x32')][_0xbcf6('0x1d')]);}_0x55175b[_0xbcf6('0x39')]=qs[_0xbcf6('0x3a')](_0x5d42b0['query'][_0xbcf6('0x3a')]);_0x55175b[_0xbcf6('0x3d')]=qs[_0xbcf6('0x3b')](_[_0xbcf6('0x58')](_0x5d42b0[_0xbcf6('0x32')],_0x441a42[_0xbcf6('0x3b')]));_0x55175b[_0xbcf6('0x3d')]['ListId']=_0x1670e6['id'];if(_0x5d42b0[_0xbcf6('0x32')][_0xbcf6('0x3c')]){_0x55175b[_0xbcf6('0x3d')]=_[_0xbcf6('0x3f')](_0x55175b['where'],{'$or':_[_0xbcf6('0x31')](_0x55175b[_0xbcf6('0x36')],function(_0x52695c){var _0x3d7a8d={};_0x3d7a8d[_0x52695c]={'$like':'%'+_0x5d42b0[_0xbcf6('0x32')]['filter']+'%'};return _0x3d7a8d;})});}_0x55175b=_[_0xbcf6('0x3f')]({},_0x55175b,_0x5d42b0[_0xbcf6('0x40')]);return db['Disposition'][_0xbcf6('0x1f')]({'where':_0x55175b['where']})[_0xbcf6('0x25')](function(_0x4406c6){_0x1ea029[_0xbcf6('0x1f')]=_0x4406c6;if(_0x5d42b0['query']['includeAll']){_0x55175b[_0xbcf6('0x42')]=[{'all':!![]}];}return db[_0xbcf6('0x54')]['findAll'](_0x55175b);})[_0xbcf6('0x25')](function(_0xfedc7c){_0x1ea029['rows']=_0xfedc7c;return _0x1ea029;});}})[_0xbcf6('0x25')](respondWithFilteredResult(_0x4edb30,_0x55175b))['catch'](handleError(_0x4edb30,null));};exports[_0xbcf6('0x59')]=function(_0x4664a8,_0x2f1f6a,_0x3e9817){return db[_0xbcf6('0x2c')][_0xbcf6('0x51')]({'where':{'id':_0x4664a8[_0xbcf6('0x47')]['id']}})[_0xbcf6('0x25')](handleEntityNotFound(_0x2f1f6a,null))[_0xbcf6('0x25')](function(_0x1b89d2){if(_0x1b89d2){return _0x1b89d2[_0xbcf6('0x59')](_0x4664a8[_0xbcf6('0x32')][_0xbcf6('0x5a')]);}})[_0xbcf6('0x25')](respondWithStatusCode(_0x2f1f6a,null))[_0xbcf6('0x45')](handleError(_0x2f1f6a,null));};exports[_0xbcf6('0x5b')]=function(_0x5cc8f1,_0x2b49ea,_0x26abcc){return db[_0xbcf6('0x2c')][_0xbcf6('0x51')]({'where':{'id':_0x5cc8f1[_0xbcf6('0x47')]['id']}})[_0xbcf6('0x25')](handleEntityNotFound(_0x2b49ea,null))[_0xbcf6('0x25')](function(_0x20af64){if(_0x20af64){var _0x129136=[];var _0x1b0871={'success':[],'errors':[]};return db[_0xbcf6('0x5c')][_0xbcf6('0x52')]()[_0xbcf6('0x25')](function(_0xa66bac){if(_0x5cc8f1['body'][_0xbcf6('0x5d')]&&_[_0xbcf6('0x5e')](_0x5cc8f1[_0xbcf6('0x49')][_0xbcf6('0x5d')])){if(_0x5cc8f1['body']['tags'][_0xbcf6('0x37')]){_0x5cc8f1[_0xbcf6('0x49')][_0xbcf6('0x5d')]=_0x5cc8f1['body'][_0xbcf6('0x5d')][_0xbcf6('0x5f')](';')+';';}else{_0x5cc8f1[_0xbcf6('0x49')]['tags']=null;}}else{_0x5cc8f1[_0xbcf6('0x49')][_0xbcf6('0x5d')]=null;}if(_0x5cc8f1[_0xbcf6('0x49')]&&_[_0xbcf6('0x5e')](_0x5cc8f1[_0xbcf6('0x49')])){for(var _0x1f9fa5=0x0;_0x1f9fa5<_0x5cc8f1[_0xbcf6('0x49')][_0xbcf6('0x37')];_0x1f9fa5+=0x1){_0x5cc8f1['body'][_0x1f9fa5]['ListId']=_0x5cc8f1[_0xbcf6('0x47')]['id'];_0x129136[_0xbcf6('0x60')](_0x5cc8f1[_0xbcf6('0x49')][_0x1f9fa5]);}return BPromise[_0xbcf6('0x61')](_0x129136,function(_0x2c9b1d){return db[_0xbcf6('0x5c')]['create'](_[_0xbcf6('0x62')](_0x2c9b1d,[_0xbcf6('0x5a'),'id'])||{},{'fields':_[_0xbcf6('0x33')](_0xa66bac),'raw':!![]})[_0xbcf6('0x25')](function(_0x3f989a){_0x1b0871['success'][_0xbcf6('0x60')](_0x3f989a[_0xbcf6('0x63')]);})['catch'](function(_0x2d354e){_0x1b0871[_0xbcf6('0x64')][_0xbcf6('0x60')]({'data':_0x2c9b1d,'error':_0x2d354e['message']});});})['then'](function(_0x5e4d24){return _0x1b0871;})[_0xbcf6('0x45')](function(_0x1c7f57){return _0x1c7f57;});}else{_0x2b49ea[_0xbcf6('0x1b')](0x190)['json']({'message':_0xbcf6('0x65')});}});}})[_0xbcf6('0x25')](respondWithResult(_0x2b49ea,null))[_0xbcf6('0x45')](handleError(_0x2b49ea,null));};exports[_0xbcf6('0x66')]=function(_0x5f2ed0,_0x25e1ed,_0x27d3a9){var _0x11ce27;return db['CmList'][_0xbcf6('0x51')]({'where':{'id':_0x5f2ed0[_0xbcf6('0x47')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xbcf6('0x67')}]})[_0xbcf6('0x25')](handleEntityNotFound(_0x25e1ed,null))[_0xbcf6('0x25')](function(_0x17b22a){if(_0x17b22a){_0x11ce27=_0x17b22a;return db[_0xbcf6('0x5c')][_0xbcf6('0x57')];}})['then'](function(_0x442ccb){if(_0x442ccb){var _0x55e325={};var _0x1911b5={};_0x1911b5[_0xbcf6('0x30')]=_[_0xbcf6('0x68')](_[_0xbcf6('0x33')](_0x442ccb),_[_0xbcf6('0x31')](_0x11ce27[_0xbcf6('0x67')],function(_0x3c71d0){return util['format'](_0xbcf6('0x69'),_0x3c71d0['id']);}));_0x1911b5['query']=_[_0xbcf6('0x33')](_0x5f2ed0[_0xbcf6('0x32')]);_0x1911b5[_0xbcf6('0x3b')]=_['intersection'](_0x1911b5['model'],_0x1911b5[_0xbcf6('0x32')]);_0x55e325[_0xbcf6('0x36')]=_['intersection'](_0x1911b5[_0xbcf6('0x30')],qs[_0xbcf6('0x35')](_0x5f2ed0[_0xbcf6('0x32')][_0xbcf6('0x35')]));_0x55e325[_0xbcf6('0x36')]=_0x55e325[_0xbcf6('0x36')][_0xbcf6('0x37')]?_0x55e325[_0xbcf6('0x36')]:_0x1911b5[_0xbcf6('0x30')];if(!_0x5f2ed0[_0xbcf6('0x32')][_0xbcf6('0x6a')](_0xbcf6('0x38'))){_0x55e325[_0xbcf6('0x20')]=qs[_0xbcf6('0x20')](_0x5f2ed0[_0xbcf6('0x32')][_0xbcf6('0x20')]);_0x55e325[_0xbcf6('0x1d')]=qs[_0xbcf6('0x1d')](_0x5f2ed0[_0xbcf6('0x32')][_0xbcf6('0x1d')]);}_0x55e325[_0xbcf6('0x39')]=qs[_0xbcf6('0x3a')](_0x5f2ed0[_0xbcf6('0x32')][_0xbcf6('0x3a')]);_0x55e325[_0xbcf6('0x3d')]=qs['filters'](_[_0xbcf6('0x58')](_0x5f2ed0[_0xbcf6('0x32')],_0x1911b5[_0xbcf6('0x3b')]));_0x55e325[_0xbcf6('0x6b')]=!![];if(_0x5f2ed0[_0xbcf6('0x32')]['filter']){_0x55e325[_0xbcf6('0x3d')]=_['merge'](_0x55e325[_0xbcf6('0x3d')],{'$or':_['map'](_0x55e325[_0xbcf6('0x36')],function(_0x48c185){var _0x682b11={};_0x682b11[_0x48c185]={'$like':'%'+_0x5f2ed0['query'][_0xbcf6('0x3c')]+'%'};return _0x682b11;})});}_0x55e325=_[_0xbcf6('0x3f')]({},_0x55e325,_0x5f2ed0[_0xbcf6('0x40')]);return _0x11ce27['getContacts'](_0x55e325);}})['then'](respondWithResult(_0x25e1ed,null))[_0xbcf6('0x45')](handleError(_0x25e1ed,null));};exports['getContactsCsv']=function(_0x3af64f,_0x5bead3,_0x1a7261){var _0x104ca0;var _0x4dda76;var _0x1edc1d;var _0x44039a=_0x3af64f['params']['id'];csv_results=[];return db[_0xbcf6('0x6c')][_0xbcf6('0x43')]({'attributes':['id',_0xbcf6('0x2b')],'raw':!![],'order':[_0xbcf6('0x6d')]})[_0xbcf6('0x25')](function(_0x368c61){_0x104ca0=_0x368c61;var _0x199cd7=_[_0xbcf6('0x33')](db[_0xbcf6('0x5c')]['rawAttributes']);return db[_0xbcf6('0x6e')][_0xbcf6('0x43')]({'raw':!![],'attributes':['id',_0xbcf6('0x6f')]})[_0xbcf6('0x25')](function(_0x41e03d){_0x4dda76=_0x41e03d;var _0x24c31b=squel['select']()[_0xbcf6('0x35')](_0x199cd7)[_0xbcf6('0x70')]('cm_contacts','c')[_0xbcf6('0x3d')](_0xbcf6('0x71'),_0x44039a)['where'](_0xbcf6('0x72'))['distinct']();for(var _0x1ca7c7=0x0;_0x1ca7c7<_0x4dda76[_0xbcf6('0x37')];_0x1ca7c7++){_0x24c31b[_0xbcf6('0x73')](_0xbcf6('0x74')+_0x4dda76[_0x1ca7c7]['id'],_0xbcf6('0x75')+_0x4dda76[_0x1ca7c7][_0xbcf6('0x6f')]);}for(var _0x1ca7c7=0x0;_0x1ca7c7<_0x104ca0[_0xbcf6('0x37')];_0x1ca7c7++){_0x24c31b[_0xbcf6('0x73')](squel['select']()['field']('item')[_0xbcf6('0x70')](_0xbcf6('0x76'))[_0xbcf6('0x3d')](_0xbcf6('0x77'),_0x104ca0[_0x1ca7c7]['id'])[_0xbcf6('0x3d')](_0xbcf6('0x78')),_0xbcf6('0x79')+_0x104ca0[_0x1ca7c7][_0xbcf6('0x2b')]);_0x24c31b[_0xbcf6('0x73')](squel[_0xbcf6('0x7a')]()[_0xbcf6('0x73')]('description')['from'](_0xbcf6('0x76'))[_0xbcf6('0x3d')]('ItemTypeId\x20=\x20?',_0x104ca0[_0x1ca7c7]['id'])[_0xbcf6('0x3d')](_0xbcf6('0x78')),_0xbcf6('0x7b')+_0x104ca0[_0x1ca7c7]['name']);}var _0x45ec84=[];_0x45ec84['push'](_0x24c31b['toString']());BPromise['each'](_0x45ec84,handleQuery)[_0xbcf6('0x25')](function(_0x384e4c){handleQuery(_0x24c31b[_0xbcf6('0x7c')]());var _0x5664c4=csv_results[0x0];if(!_['isEmpty'](_0x5664c4)){var _0x279320=toCsv(_0x5664c4);var _0x19be5f=Date[_0xbcf6('0x7d')]();fs[_0xbcf6('0x7e')](util['format'](_0xbcf6('0x7f'),_0x44039a,_0x19be5f),_0x279320);_0x5bead3[_0xbcf6('0x80')](_0xbcf6('0x81'),_0xbcf6('0x82')+util[_0xbcf6('0x83')](_0xbcf6('0x84'),_0x44039a,_0x19be5f));_0x5bead3[_0xbcf6('0x80')](_0xbcf6('0x85'),_0xbcf6('0x86'));return _0x5bead3[_0xbcf6('0x87')](util[_0xbcf6('0x83')](_0xbcf6('0x7f'),_0x44039a,_0x19be5f));}else{return _0x5bead3[_0xbcf6('0x88')](0xcc);}});});});};exports[_0xbcf6('0x89')]=function(_0x537b55,_0x1e9810,_0xb3c1d7){var _0x32ff0a;delete _0x537b55[_0xbcf6('0x49')]['id'];return db[_0xbcf6('0x2c')][_0xbcf6('0x56')]({'where':{'id':_0x537b55[_0xbcf6('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e9810,null))['then'](function(_0x1d3de2){if(_0x1d3de2){return db[_0xbcf6('0x8a')][_0xbcf6('0x8b')](function(_0x3874b6){return db[_0xbcf6('0x6e')][_0xbcf6('0x48')](_0x537b55[_0xbcf6('0x49')],{'transaction':_0x3874b6})[_0xbcf6('0x25')](function(_0x518f61){_0x32ff0a=_0x518f61;return _0x1d3de2[_0xbcf6('0x8c')](_0x518f61,{'transaction':_0x3874b6});})[_0xbcf6('0x25')](function(){var _0x4b4f52={'type':db['Sequelize'][_0xbcf6('0x8d')],'transaction':_0x3874b6};switch(_0x537b55[_0xbcf6('0x49')][_0xbcf6('0x2e')]){case _0xbcf6('0x8e'):_0x4b4f52['type']=db['Sequelize']['TEXT'];break;case _0xbcf6('0x8f'):_0x4b4f52[_0xbcf6('0x2e')]=db[_0xbcf6('0x90')]['INTEGER'];break;case _0xbcf6('0x91'):_0x4b4f52['type']=db[_0xbcf6('0x90')][_0xbcf6('0x92')];_0x4b4f52[_0xbcf6('0x93')]=![];break;default:}return db[_0xbcf6('0x8a')][_0xbcf6('0x94')]['addColumn'](_0xbcf6('0x95'),util[_0xbcf6('0x83')](_0xbcf6('0x96'),_0x32ff0a['id']),_0x4b4f52);})[_0xbcf6('0x25')](function(){return _0x32ff0a;});});}})[_0xbcf6('0x25')](respondWithResult(_0x1e9810,null))['catch'](handleError(_0x1e9810,null));};exports[_0xbcf6('0x97')]=function(_0x24f510,_0x40e3d2,_0x5868ee){var _0x5894bc={};var _0x16a806={};var _0x13bef7;var _0x3f3f94;return db[_0xbcf6('0x2c')][_0xbcf6('0x56')]({'where':{'id':_0x24f510['params']['id']}})[_0xbcf6('0x25')](handleEntityNotFound(_0x40e3d2,null))['then'](function(_0xe069d9){if(_0xe069d9){_0x13bef7=_0xe069d9;_0x16a806[_0xbcf6('0x30')]=_[_0xbcf6('0x33')](db[_0xbcf6('0x6e')][_0xbcf6('0x57')]);_0x16a806[_0xbcf6('0x32')]=_[_0xbcf6('0x33')](_0x24f510[_0xbcf6('0x32')]);_0x16a806[_0xbcf6('0x3b')]=_[_0xbcf6('0x34')](_0x16a806['model'],_0x16a806[_0xbcf6('0x32')]);_0x5894bc[_0xbcf6('0x36')]=_[_0xbcf6('0x34')](_0x16a806[_0xbcf6('0x30')],qs[_0xbcf6('0x35')](_0x24f510[_0xbcf6('0x32')]['fields']));_0x5894bc[_0xbcf6('0x36')]=_0x5894bc[_0xbcf6('0x36')][_0xbcf6('0x37')]?_0x5894bc[_0xbcf6('0x36')]:_0x16a806[_0xbcf6('0x30')];_0x5894bc[_0xbcf6('0x39')]=qs['sort'](_0x24f510[_0xbcf6('0x32')][_0xbcf6('0x3a')]);_0x5894bc[_0xbcf6('0x3d')]=qs[_0xbcf6('0x3b')](_['pick'](_0x24f510[_0xbcf6('0x32')],_0x16a806[_0xbcf6('0x3b')]));_0x5894bc[_0xbcf6('0x3d')]=_[_0xbcf6('0x3f')](_0x5894bc[_0xbcf6('0x3d')],{'$or':[{'ListId':_0xe069d9['id']},{'ListId':null}]});if(_0x24f510[_0xbcf6('0x32')][_0xbcf6('0x3c')]){_0x5894bc[_0xbcf6('0x3d')]=_['merge'](_0x5894bc[_0xbcf6('0x3d')],{'$or':_[_0xbcf6('0x31')](_0x5894bc[_0xbcf6('0x36')],function(_0x57974f){var _0x518ce1={};_0x518ce1[_0x57974f]={'$like':'%'+_0x24f510[_0xbcf6('0x32')][_0xbcf6('0x3c')]+'%'};return _0x518ce1;})});}_0x5894bc=_[_0xbcf6('0x3f')]({},_0x5894bc,_0x24f510[_0xbcf6('0x40')]);return db['CmCustomField']['findAndCountAll'](_0x5894bc);}})[_0xbcf6('0x25')](respondWithResult(_0x40e3d2,null))['catch'](handleError(_0x40e3d2,null));};exports[_0xbcf6('0x98')]=function(_0x5ddedc,_0x5e1490){return db[_0xbcf6('0x6e')][_0xbcf6('0x99')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x5e1490,null))[_0xbcf6('0x25')](function(_0x43a787){return _0x43a787;})[_0xbcf6('0x25')](respondWithResult(_0x5e1490,null))[_0xbcf6('0x45')](handleError(_0x5e1490,null));};exports[_0xbcf6('0x9a')]=function(_0x22931e,_0x34760d,_0x19ee15){return db[_0xbcf6('0x2c')][_0xbcf6('0x51')]({'where':{'id':_0x22931e[_0xbcf6('0x47')]['id']}})['then'](handleEntityNotFound(_0x34760d,null))[_0xbcf6('0x25')](function(_0x4b95fc){if(_0x4b95fc){return _0x4b95fc[_0xbcf6('0x9a')](_0x22931e['body'][_0xbcf6('0x5a')],_[_0xbcf6('0x62')](_0x22931e[_0xbcf6('0x49')],[_0xbcf6('0x5a'),'id'])||{})['spread'](function(_0x11995a){for(var _0x5de09b=0x0;_0x5de09b<_0x22931e[_0xbcf6('0x49')][_0xbcf6('0x5a')][_0xbcf6('0x37')];_0x5de09b+=0x1){socket[_0xbcf6('0x9b')](_0xbcf6('0x9c'),{'UserId':Number(_0x22931e[_0xbcf6('0x49')]['ids'][_0x5de09b]),'CmListId':Number(_0x22931e[_0xbcf6('0x47')]['id'])});}return _0x11995a;});}})[_0xbcf6('0x25')](respondWithResult(_0x34760d,null))['catch'](handleError(_0x34760d,null));};exports[_0xbcf6('0x9d')]=function(_0x2a6eb5,_0x211934,_0x314a34){return db[_0xbcf6('0x2c')]['find']({'where':{'id':_0x2a6eb5['params']['id']}})['then'](handleEntityNotFound(_0x211934,null))[_0xbcf6('0x25')](function(_0x336bca){if(_0x336bca){return _0x336bca['removeAgents'](_0x2a6eb5[_0xbcf6('0x32')]['ids'])['then'](function(){if(_['isArray'](_0x2a6eb5[_0xbcf6('0x32')]['ids'])){for(var _0x2a8d1a=0x0;_0x2a8d1a<_0x2a6eb5[_0xbcf6('0x32')][_0xbcf6('0x5a')][_0xbcf6('0x37')];_0x2a8d1a+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x2a6eb5['query']['ids'][_0x2a8d1a]),'CmListId':Number(_0x2a6eb5[_0xbcf6('0x47')]['id'])});}}else{socket['emit'](_0xbcf6('0x9e'),{'UserId':Number(_0x2a6eb5[_0xbcf6('0x32')][_0xbcf6('0x5a')]),'CmListId':Number(_0x2a6eb5[_0xbcf6('0x47')]['id'])});}});}})[_0xbcf6('0x25')](respondWithStatusCode(_0x211934,null))[_0xbcf6('0x45')](handleError(_0x211934,null));};exports[_0xbcf6('0x9f')]=function(_0x28c00b,_0x1629d7,_0x4c9775){var _0x3b4dde={};var _0x41fd2d={};var _0x126973;var _0xc03834;return db[_0xbcf6('0x2c')][_0xbcf6('0x56')]({'where':{'id':_0x28c00b[_0xbcf6('0x47')]['id']}})[_0xbcf6('0x25')](handleEntityNotFound(_0x1629d7,null))[_0xbcf6('0x25')](function(_0x4f0fda){if(_0x4f0fda){_0x126973=_0x4f0fda;_0x41fd2d[_0xbcf6('0x30')]=_[_0xbcf6('0x33')](db[_0xbcf6('0xa0')][_0xbcf6('0x57')]);_0x41fd2d[_0xbcf6('0x32')]=_[_0xbcf6('0x33')](_0x28c00b[_0xbcf6('0x32')]);_0x41fd2d['filters']=_[_0xbcf6('0x34')](_0x41fd2d['model'],_0x41fd2d['query']);_0x3b4dde['attributes']=_[_0xbcf6('0x34')](_0x41fd2d['model'],qs[_0xbcf6('0x35')](_0x28c00b['query'][_0xbcf6('0x35')]));_0x3b4dde[_0xbcf6('0x36')]=_0x3b4dde['attributes']['length']?_0x3b4dde[_0xbcf6('0x36')]:_0x41fd2d['model'];_0x3b4dde[_0xbcf6('0x39')]=qs[_0xbcf6('0x3a')](_0x28c00b['query']['sort']);_0x3b4dde['where']=qs[_0xbcf6('0x3b')](_['pick'](_0x28c00b[_0xbcf6('0x32')],_0x41fd2d[_0xbcf6('0x3b')]));if(_0x28c00b[_0xbcf6('0x32')][_0xbcf6('0x3c')]){_0x3b4dde[_0xbcf6('0x3d')]=_[_0xbcf6('0x3f')](_0x3b4dde[_0xbcf6('0x3d')],{'$or':_['map'](_0x3b4dde[_0xbcf6('0x36')],function(_0x35fa00){var _0x44d77e={};_0x44d77e[_0x35fa00]={'$like':'%'+_0x28c00b[_0xbcf6('0x32')][_0xbcf6('0x3c')]+'%'};return _0x44d77e;})});}_0x3b4dde=_[_0xbcf6('0x3f')]({},_0x3b4dde,_0x28c00b[_0xbcf6('0x40')]);return _0x126973[_0xbcf6('0x9f')](_0x3b4dde);}})['then'](function(_0xc2a5e4){if(_0xc2a5e4){_0xc03834=_0xc2a5e4[_0xbcf6('0x37')];if(!_0x28c00b['query']['hasOwnProperty']('nolimit')){_0x3b4dde['limit']=qs[_0xbcf6('0x20')](_0x28c00b['query']['limit']);_0x3b4dde['offset']=qs['offset'](_0x28c00b[_0xbcf6('0x32')]['offset']);}return _0x126973[_0xbcf6('0x9f')](_0x3b4dde);}})[_0xbcf6('0x25')](function(_0x110bfb){if(_0x110bfb){return _0x110bfb?{'count':_0xc03834,'rows':_0x110bfb}:null;}})[_0xbcf6('0x25')](respondWithResult(_0x1629d7,null))['catch'](handleError(_0x1629d7,null));};function handleQuery(_0x436090){logger['info'](_0x436090);return db['sequelize']['query'](_0x436090)[_0xbcf6('0xa1')](function(_0x15f2aa){csv_results['push'](_0x15f2aa);})[_0xbcf6('0x45')](function(_0x42d753){logger[_0xbcf6('0x4f')](_0x42d753['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index b494ad5..86d47e8 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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e74,0x175));var _0x43e7=function(_0x4c344f,_0x5e2f2a){_0x4c344f=_0x4c344f-0x0;var _0x3a8c1a=_0x3e74[_0x4c344f];return _0x3a8c1a;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x4f2801,_0x366dd1){var _0x3ac22a=function(_0x39862a){while(--_0x39862a){_0x4f2801['push'](_0x4f2801['shift']());}};_0x3ac22a(++_0x366dd1);}(_0x7217,0x19e));var _0x7721=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x7217[_0x491a7f];return _0x3d8f44;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index bc1e796..da49c9a 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 _0x5ff3=['cm_lists','util','api','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','define'];(function(_0x2c9a85,_0x3698d0){var _0x35bdb2=function(_0x24e043){while(--_0x24e043){_0x2c9a85['push'](_0x2c9a85['shift']());}};_0x35bdb2(++_0x3698d0);}(_0x5ff3,0x17d));var _0x35ff=function(_0x2c8976,_0x5f16ac){_0x2c8976=_0x2c8976-0x0;var _0x350817=_0x5ff3[_0x2c8976];return _0x350817;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var moment=require('moment');var BPromise=require(_0x35ff('0x2'));var rp=require(_0x35ff('0x3'));var fs=require('fs');var path=require(_0x35ff('0x4'));var rimraf=require(_0x35ff('0x5'));var config=require('../../config/environment');var attributes=require(_0x35ff('0x6'));module[_0x35ff('0x7')]=function(_0x2e9873,_0x11e738){return _0x2e9873[_0x35ff('0x8')]('CmList',attributes,{'tableName':_0x35ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb43b=['rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash','util','api','moment','bluebird','path'];(function(_0x163f5d,_0x4b45e8){var _0x5f4247=function(_0x5708e9){while(--_0x5708e9){_0x163f5d['push'](_0x163f5d['shift']());}};_0x5f4247(++_0x4b45e8);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5460ff,_0x893258){_0x5460ff=_0x5460ff-0x0;var _0x551a44=_0xb43b[_0x5460ff];return _0x551a44;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 9e76819..76dddf5 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 _0x04d9=['CmList,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','info','CmList,\x20%s,\x20%s','debug'];(function(_0x4c6dcf,_0x2a672a){var _0x5ede9f=function(_0x54b7e3){while(--_0x54b7e3){_0x4c6dcf['push'](_0x4c6dcf['shift']());}};_0x5ede9f(++_0x2a672a);}(_0x04d9,0x156));var _0x904d=function(_0xec77fe,_0x5eafd0){_0xec77fe=_0xec77fe-0x0;var _0xecf67e=_0x04d9[_0xec77fe];return _0xecf67e;};'use strict';var _=require(_0x904d('0x0'));var util=require(_0x904d('0x1'));var moment=require(_0x904d('0x2'));var BPromise=require('bluebird');var rs=require(_0x904d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x904d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x904d('0x5'))('rpc');var config=require(_0x904d('0x6'));var jayson=require(_0x904d('0x7'));var client=jayson[_0x904d('0x8')][_0x904d('0x9')]({'port':0x232a});config[_0x904d('0xa')]=_[_0x904d('0xb')](config[_0x904d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x904d('0xc'))(new Redis(config[_0x904d('0xa')]));require('./cmList.socket')[_0x904d('0xd')](socket);function respondWithRpcPromise(_0x388b43,_0x14ed7b,_0x364c45){return new BPromise(function(_0x3d8da9,_0x27e5a3){return client['request'](_0x388b43,_0x364c45)[_0x904d('0xe')](function(_0x1d39b2){logger[_0x904d('0xf')](_0x904d('0x10'),_0x14ed7b,'request\x20sent');logger[_0x904d('0x11')](_0x904d('0x12'),_0x14ed7b,_0x904d('0x13'),JSON['stringify'](_0x1d39b2));if(_0x1d39b2[_0x904d('0x14')]){if(_0x1d39b2['error'][_0x904d('0x15')]===0x1f4){logger[_0x904d('0x14')](_0x904d('0x10'),_0x14ed7b,_0x1d39b2[_0x904d('0x14')][_0x904d('0x16')]);return _0x27e5a3(_0x1d39b2[_0x904d('0x14')][_0x904d('0x16')]);}logger[_0x904d('0x14')](_0x904d('0x10'),_0x14ed7b,_0x1d39b2[_0x904d('0x14')][_0x904d('0x16')]);return _0x3d8da9(_0x1d39b2['error'][_0x904d('0x16')]);}else{logger[_0x904d('0xf')]('CmList,\x20%s,\x20%s',_0x14ed7b,_0x904d('0x13'));_0x3d8da9(_0x1d39b2[_0x904d('0x17')]['message']);}})['catch'](function(_0x31ab8b){logger[_0x904d('0x14')](_0x904d('0x10'),_0x14ed7b,_0x31ab8b);_0x27e5a3(_0x31ab8b);});});} \ No newline at end of file +var _0x423c=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x423c,0x1b4));var _0xc423=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x423c[_0x279d37];return _0x530173;};'use strict';var _=require(_0xc423('0x0'));var util=require(_0xc423('0x1'));var moment=require('moment');var BPromise=require(_0xc423('0x2'));var rs=require(_0xc423('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc423('0x4'))['db'];var utils=require(_0xc423('0x5'));var logger=require(_0xc423('0x6'))('rpc');var config=require(_0xc423('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc423('0x8')][_0xc423('0x9')]({'port':0x232a});config[_0xc423('0xa')]=_[_0xc423('0xb')](config[_0xc423('0xa')],{'host':_0xc423('0xc'),'port':0x18eb});var socket=require(_0xc423('0xd'))(new Redis(config[_0xc423('0xa')]));require(_0xc423('0xe'))[_0xc423('0xf')](socket);function respondWithRpcPromise(_0x13db4a,_0x39e69a,_0x4ef0c9){return new BPromise(function(_0x2dca62,_0xcebfdf){return client[_0xc423('0x10')](_0x13db4a,_0x4ef0c9)[_0xc423('0x11')](function(_0x445e95){logger[_0xc423('0x12')](_0xc423('0x13'),_0x39e69a,_0xc423('0x14'));logger[_0xc423('0x15')](_0xc423('0x16'),_0x39e69a,_0xc423('0x14'),JSON[_0xc423('0x17')](_0x445e95));if(_0x445e95[_0xc423('0x18')]){if(_0x445e95[_0xc423('0x18')][_0xc423('0x19')]===0x1f4){logger[_0xc423('0x18')](_0xc423('0x13'),_0x39e69a,_0x445e95[_0xc423('0x18')][_0xc423('0x1a')]);return _0xcebfdf(_0x445e95[_0xc423('0x18')][_0xc423('0x1a')]);}logger[_0xc423('0x18')]('CmList,\x20%s,\x20%s',_0x39e69a,_0x445e95['error'][_0xc423('0x1a')]);return _0x2dca62(_0x445e95['error'][_0xc423('0x1a')]);}else{logger[_0xc423('0x12')](_0xc423('0x13'),_0x39e69a,'request\x20sent');_0x2dca62(_0x445e95[_0xc423('0x1b')][_0xc423('0x1a')]);}})[_0xc423('0x1c')](function(_0x5f3855){logger[_0xc423('0x18')](_0xc423('0x13'),_0x39e69a,_0x5f3855);_0xcebfdf(_0x5f3855);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 5257835..60fb2cf 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 _0xb0bf=['removeListener','register','length','cmList:','save','remove','update'];(function(_0x143d6b,_0x2688ca){var _0x2d2fef=function(_0x31e4fe){while(--_0x31e4fe){_0x143d6b['push'](_0x143d6b['shift']());}};_0x2d2fef(++_0x2688ca);}(_0xb0bf,0x18c));var _0xfb0b=function(_0x3a4720,_0x5143a9){_0x3a4720=_0x3a4720-0x0;var _0x4cb457=_0xb0bf[_0x3a4720];return _0x4cb457;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xfb0b('0x0'),_0xfb0b('0x1'),_0xfb0b('0x2')];function createListener(_0x2e7e7f,_0x2e3fa8){return function(_0x5f5cb2){_0x2e3fa8['emit'](_0x2e7e7f,_0x5f5cb2);};}function removeListener(_0x3bcb3b,_0x5dcf21){return function(){CmListEvents[_0xfb0b('0x3')](_0x3bcb3b,_0x5dcf21);};}exports[_0xfb0b('0x4')]=function(_0x525288){for(var _0x4a6209=0x0,_0x4be95e=events[_0xfb0b('0x5')];_0x4a6209<_0x4be95e;_0x4a6209++){var _0x4d4635=events[_0x4a6209];var _0x25a887=createListener(_0xfb0b('0x6')+_0x4d4635,_0x525288);CmListEvents['on'](_0x4d4635,_0x25a887);}}; \ No newline at end of file +var _0x4ce6=['./cmList.events','remove','update','emit','length','cmList:'];(function(_0x1e84ba,_0x5d949c){var _0x1517af=function(_0x57abdf){while(--_0x57abdf){_0x1e84ba['push'](_0x1e84ba['shift']());}};_0x1517af(++_0x5d949c);}(_0x4ce6,0x108));var _0x64ce=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x4ce6[_0x125ff8];return _0x2d9ef;};'use strict';var CmListEvents=require(_0x64ce('0x0'));var events=['save',_0x64ce('0x1'),_0x64ce('0x2')];function createListener(_0x3f9718,_0x11bca6){return function(_0x3f0983){_0x11bca6[_0x64ce('0x3')](_0x3f9718,_0x3f0983);};}function removeListener(_0x4a8899,_0x469aa){return function(){CmListEvents['removeListener'](_0x4a8899,_0x469aa);};}exports['register']=function(_0x31bc0f){for(var _0x262751=0x0,_0x5b8f2d=events[_0x64ce('0x4')];_0x262751<_0x5b8f2d;_0x262751++){var _0x3c279f=events[_0x262751];var _0x134230=createListener(_0x64ce('0x5')+_0x3c279f,_0x31bc0f);CmListEvents['on'](_0x3c279f,_0x134230);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 7a9ed05..689affb 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 _0xe9ff=['update','delete','destroy','removeDispositions','removeAgents','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','/global_fields','getGlobalCustomFields','/:id','show','getDispositions','/:id/contacts','getContacts','getContactsCsv','/:id/fields','/:id/users','post','create','/:id/dispositions','addDisposition','addCustomField','addAgents','put'];(function(_0x341faf,_0x4738d7){var _0x53a57f=function(_0x4decd1){while(--_0x4decd1){_0x341faf['push'](_0x341faf['shift']());}};_0x53a57f(++_0x4738d7);}(_0xe9ff,0x17c));var _0xfe9f=function(_0x215102,_0x44eaeb){_0x215102=_0x215102-0x0;var _0x172d3b=_0xe9ff[_0x215102];return _0x172d3b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfe9f('0x0'));var express=require('express');var router=express[_0xfe9f('0x1')]();var fs_extra=require(_0xfe9f('0x2'));var auth=require(_0xfe9f('0x3'));var interaction=require(_0xfe9f('0x4'));var config=require(_0xfe9f('0x5'));var controller=require(_0xfe9f('0x6'));router[_0xfe9f('0x7')]('/',auth[_0xfe9f('0x8')](),controller[_0xfe9f('0x9')]);router[_0xfe9f('0x7')](_0xfe9f('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xfe9f('0x7')](_0xfe9f('0xb'),auth[_0xfe9f('0x8')](),controller[_0xfe9f('0xc')]);router['get'](_0xfe9f('0xd'),auth[_0xfe9f('0x8')](),controller[_0xfe9f('0xe')]);router[_0xfe9f('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xfe9f('0xf')]);router[_0xfe9f('0x7')](_0xfe9f('0x10'),auth[_0xfe9f('0x8')](),controller[_0xfe9f('0x11')]);router[_0xfe9f('0x7')]('/:id/contacts/csv',auth[_0xfe9f('0x8')](),controller[_0xfe9f('0x12')]);router[_0xfe9f('0x7')](_0xfe9f('0x13'),auth[_0xfe9f('0x8')](),controller['getCustomFields']);router[_0xfe9f('0x7')](_0xfe9f('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0xfe9f('0x15')]('/',auth[_0xfe9f('0x8')](),controller[_0xfe9f('0x16')]);router[_0xfe9f('0x15')](_0xfe9f('0x17'),auth['isAuthenticated'](),controller[_0xfe9f('0x18')]);router[_0xfe9f('0x15')](_0xfe9f('0x10'),auth[_0xfe9f('0x8')](),controller['addContacts']);router[_0xfe9f('0x15')](_0xfe9f('0x13'),auth[_0xfe9f('0x8')](),controller[_0xfe9f('0x19')]);router[_0xfe9f('0x15')](_0xfe9f('0x14'),auth[_0xfe9f('0x8')](),controller[_0xfe9f('0x1a')]);router[_0xfe9f('0x1b')](_0xfe9f('0xd'),auth[_0xfe9f('0x8')](),controller[_0xfe9f('0x1c')]);router[_0xfe9f('0x1d')](_0xfe9f('0xd'),auth[_0xfe9f('0x8')](),controller[_0xfe9f('0x1e')]);router[_0xfe9f('0x1d')](_0xfe9f('0x17'),auth[_0xfe9f('0x8')](),controller[_0xfe9f('0x1f')]);router[_0xfe9f('0x1d')]('/:id/users',auth['isAuthenticated'](),controller[_0xfe9f('0x20')]);module[_0xfe9f('0x21')]=router; \ No newline at end of file +var _0x75f0=['getCustomFields','/:id/users','getAgents','create','post','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','/describe','describe','getGlobalCustomFields','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields'];(function(_0x4caf5f,_0x3d8397){var _0x21dbdc=function(_0x57a86a){while(--_0x57a86a){_0x4caf5f['push'](_0x4caf5f['shift']());}};_0x21dbdc(++_0x3d8397);}(_0x75f0,0x196));var _0x075f=function(_0x754f7f,_0x5a0753){_0x754f7f=_0x754f7f-0x0;var _0x20d21b=_0x75f0[_0x754f7f];return _0x20d21b;};'use strict';var multer=require(_0x075f('0x0'));var util=require(_0x075f('0x1'));var path=require(_0x075f('0x2'));var timeout=require(_0x075f('0x3'));var express=require(_0x075f('0x4'));var router=express[_0x075f('0x5')]();var fs_extra=require(_0x075f('0x6'));var auth=require(_0x075f('0x7'));var interaction=require(_0x075f('0x8'));var config=require('../../config/environment');var controller=require(_0x075f('0x9'));router[_0x075f('0xa')]('/',auth[_0x075f('0xb')](),controller['index']);router['get'](_0x075f('0xc'),auth['isAuthenticated'](),controller[_0x075f('0xd')]);router[_0x075f('0xa')]('/global_fields',auth[_0x075f('0xb')](),controller[_0x075f('0xe')]);router[_0x075f('0xa')](_0x075f('0xf'),auth[_0x075f('0xb')](),controller['show']);router['get'](_0x075f('0x10'),auth[_0x075f('0xb')](),controller[_0x075f('0x11')]);router[_0x075f('0xa')](_0x075f('0x12'),auth[_0x075f('0xb')](),controller[_0x075f('0x13')]);router[_0x075f('0xa')](_0x075f('0x14'),auth[_0x075f('0xb')](),controller[_0x075f('0x15')]);router[_0x075f('0xa')](_0x075f('0x16'),auth[_0x075f('0xb')](),controller[_0x075f('0x17')]);router[_0x075f('0xa')](_0x075f('0x18'),auth['isAuthenticated'](),controller[_0x075f('0x19')]);router['post']('/',auth['isAuthenticated'](),controller[_0x075f('0x1a')]);router[_0x075f('0x1b')](_0x075f('0x10'),auth['isAuthenticated'](),controller[_0x075f('0x1c')]);router[_0x075f('0x1b')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x075f('0x1d')]);router['post']('/:id/fields',auth[_0x075f('0xb')](),controller[_0x075f('0x1e')]);router[_0x075f('0x1b')](_0x075f('0x18'),auth[_0x075f('0xb')](),controller[_0x075f('0x1f')]);router[_0x075f('0x20')](_0x075f('0xf'),auth[_0x075f('0xb')](),controller[_0x075f('0x21')]);router[_0x075f('0x22')]('/:id',auth[_0x075f('0xb')](),controller[_0x075f('0x23')]);router[_0x075f('0x22')](_0x075f('0x10'),auth[_0x075f('0xb')](),controller[_0x075f('0x24')]);router[_0x075f('0x22')](_0x075f('0x18'),auth[_0x075f('0xb')](),controller[_0x075f('0x25')]);module[_0x075f('0x26')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 5738e8f..55df921 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 _0xc843=['VIRTUAL','getDataValue','field','STRING'];(function(_0x2491cf,_0x559651){var _0x5c31fe=function(_0xf3f032){while(--_0xf3f032){_0x2491cf['push'](_0x2491cf['shift']());}};_0x5c31fe(++_0x559651);}(_0xc843,0x19c));var _0x3c84=function(_0xca1091,_0x539dbf){_0xca1091=_0xca1091-0x0;var _0xd3019c=_0xc843[_0xca1091];return _0xd3019c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3c84('0x0')],'get':function(_0x5e792b){return this[_0x3c84('0x1')](_0x3c84('0x2'));}},'field':{'type':Sequelize[_0x3c84('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x3c84('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xb46b=['VIRTUAL','getDataValue','STRING','sequelize','exports'];(function(_0x87ef7e,_0x4502e5){var _0x4fbad9=function(_0x8634de){while(--_0x8634de){_0x87ef7e['push'](_0x87ef7e['shift']());}};_0x4fbad9(++_0x4502e5);}(_0xb46b,0x8a));var _0xbb46=function(_0x58e9c7,_0x31b4a3){_0x58e9c7=_0x58e9c7-0x0;var _0x251bed=_0xb46b[_0x58e9c7];return _0x251bed;};'use strict';var Sequelize=require(_0xbb46('0x0'));module[_0xbb46('0x1')]={'name':{'type':Sequelize[_0xbb46('0x2')],'get':function(_0x5ad7fe){return this[_0xbb46('0x3')]('field');}},'field':{'type':Sequelize[_0xbb46('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xbb46('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xbb46('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 6ac0de8..2886293 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(_0x3b0145,_0x2fa626){var _0x4ea35d=function(_0x418543){while(--_0x418543){_0x3b0145['push'](_0x3b0145['shift']());}};_0x4ea35d(++_0x2fa626);}(_0x7a54,0x106));var _0x47a5=function(_0x4052e2,_0x19106d){_0x4052e2=_0x4052e2-0x0;var _0x128ff7=_0x7a54[_0x4052e2];return _0x128ff7;};'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(_0x513c55,_0x3d0461){var _0x1da56b=function(_0x570ee1){while(--_0x570ee1){_0x513c55['push'](_0x513c55['shift']());}};_0x1da56b(++_0x3d0461);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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 efc54ef..1b6e1b4 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 _0x060f=['exports','define','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x060f,0x156));var _0xf060=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0x060f[_0x4d7f3f];return _0x5d67cc;};'use strict';var _=require(_0xf060('0x0'));var util=require(_0xf060('0x1'));var logger=require(_0xf060('0x2'))('api');var moment=require(_0xf060('0x3'));var BPromise=require('bluebird');var rp=require(_0xf060('0x4'));var fs=require('fs');var path=require(_0xf060('0x5'));var rimraf=require(_0xf060('0x6'));var config=require(_0xf060('0x7'));var attributes=require('./condition.attributes');module[_0xf060('0x8')]=function(_0x404680,_0x664e34){return _0x404680[_0xf060('0x9')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdda5=['rimraf','../../config/environment','define','tools_conditions','util','api','moment','request-promise'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xdda5,0x19c));var _0x5dda=function(_0x474683,_0x16c3b9){_0x474683=_0x474683-0x0;var _0x3c7ab2=_0xdda5[_0x474683];return _0x3c7ab2;};'use strict';var _=require('lodash');var util=require(_0x5dda('0x0'));var logger=require('../../config/logger')(_0x5dda('0x1'));var moment=require(_0x5dda('0x2'));var BPromise=require('bluebird');var rp=require(_0x5dda('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5dda('0x4'));var config=require(_0x5dda('0x5'));var attributes=require('./condition.attributes');module['exports']=function(_0x3ea651,_0x41f65d){return _0x3ea651[_0x5dda('0x6')]('Condition',attributes,{'tableName':_0x5dda('0x7'),'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 ae5045e..a7efc8c 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 _0xf8e3=['Condition,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info'];(function(_0x4f11a3,_0x2a20d5){var _0x256d6f=function(_0x6d4eb7){while(--_0x6d4eb7){_0x4f11a3['push'](_0x4f11a3['shift']());}};_0x256d6f(++_0x2a20d5);}(_0xf8e3,0x134));var _0x3f8e=function(_0x243a39,_0x4c9b51){_0x243a39=_0x243a39-0x0;var _0x5620a2=_0xf8e3[_0x243a39];return _0x5620a2;};'use strict';var _=require(_0x3f8e('0x0'));var util=require(_0x3f8e('0x1'));var moment=require('moment');var BPromise=require(_0x3f8e('0x2'));var rs=require(_0x3f8e('0x3'));var fs=require('fs');var Redis=require(_0x3f8e('0x4'));var db=require(_0x3f8e('0x5'))['db'];var utils=require(_0x3f8e('0x6'));var logger=require(_0x3f8e('0x7'))(_0x3f8e('0x8'));var config=require(_0x3f8e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3f8e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x627d45,_0x37632c,_0x1feeaf){return new BPromise(function(_0x2e733a,_0x50e008){return client[_0x3f8e('0xb')](_0x627d45,_0x1feeaf)[_0x3f8e('0xc')](function(_0x367795){logger[_0x3f8e('0xd')](_0x3f8e('0xe'),_0x37632c,'request\x20sent');logger[_0x3f8e('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x37632c,_0x3f8e('0x10'),JSON[_0x3f8e('0x11')](_0x367795));if(_0x367795[_0x3f8e('0x12')]){if(_0x367795[_0x3f8e('0x12')][_0x3f8e('0x13')]===0x1f4){logger[_0x3f8e('0x12')](_0x3f8e('0xe'),_0x37632c,_0x367795['error']['message']);return _0x50e008(_0x367795[_0x3f8e('0x12')][_0x3f8e('0x14')]);}logger['error'](_0x3f8e('0xe'),_0x37632c,_0x367795[_0x3f8e('0x12')][_0x3f8e('0x14')]);return _0x2e733a(_0x367795[_0x3f8e('0x12')][_0x3f8e('0x14')]);}else{logger[_0x3f8e('0xd')]('Condition,\x20%s,\x20%s',_0x37632c,_0x3f8e('0x10'));_0x2e733a(_0x367795[_0x3f8e('0x15')][_0x3f8e('0x14')]);}})[_0x3f8e('0x16')](function(_0x13723a){logger[_0x3f8e('0x12')]('Condition,\x20%s,\x20%s',_0x37632c,_0x13723a);_0x50e008(_0x13723a);});});} \ No newline at end of file +var _0xef6a=['request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','Condition,\x20%s,\x20%s'];(function(_0x2223b5,_0x8d79dd){var _0x3b9802=function(_0x4f9549){while(--_0x4f9549){_0x2223b5['push'](_0x2223b5['shift']());}};_0x3b9802(++_0x8d79dd);}(_0xef6a,0x8d));var _0xaef6=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xef6a[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xaef6('0x0'));var util=require(_0xaef6('0x1'));var moment=require(_0xaef6('0x2'));var BPromise=require(_0xaef6('0x3'));var rs=require(_0xaef6('0x4'));var fs=require('fs');var Redis=require(_0xaef6('0x5'));var db=require(_0xaef6('0x6'))['db'];var utils=require(_0xaef6('0x7'));var logger=require(_0xaef6('0x8'))('rpc');var config=require(_0xaef6('0x9'));var jayson=require(_0xaef6('0xa'));var client=jayson['client'][_0xaef6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ed6c7,_0x415a6c,_0x237c76){return new BPromise(function(_0xb5f118,_0x27e23b){return client['request'](_0x4ed6c7,_0x237c76)['then'](function(_0x85e031){logger['info'](_0xaef6('0xc'),_0x415a6c,_0xaef6('0xd'));logger[_0xaef6('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x415a6c,_0xaef6('0xd'),JSON[_0xaef6('0xf')](_0x85e031));if(_0x85e031['error']){if(_0x85e031[_0xaef6('0x10')][_0xaef6('0x11')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x415a6c,_0x85e031[_0xaef6('0x10')]['message']);return _0x27e23b(_0x85e031['error'][_0xaef6('0x12')]);}logger[_0xaef6('0x10')]('Condition,\x20%s,\x20%s',_0x415a6c,_0x85e031[_0xaef6('0x10')][_0xaef6('0x12')]);return _0xb5f118(_0x85e031[_0xaef6('0x10')][_0xaef6('0x12')]);}else{logger[_0xaef6('0x13')]('Condition,\x20%s,\x20%s',_0x415a6c,_0xaef6('0xd'));_0xb5f118(_0x85e031[_0xaef6('0x14')]['message']);}})[_0xaef6('0x15')](function(_0x5522d8){logger['error'](_0xaef6('0xc'),_0x415a6c,_0x5522d8);_0x27e23b(_0x5522d8);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 277646e..21d71e3 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 _0x1779=['destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','update','delete'];(function(_0x1af71f,_0x48f621){var _0x2add7f=function(_0x5d11aa){while(--_0x5d11aa){_0x1af71f['push'](_0x1af71f['shift']());}};_0x2add7f(++_0x48f621);}(_0x1779,0x1f0));var _0x9177=function(_0x2463d2,_0x17dd82){_0x2463d2=_0x2463d2-0x0;var _0x490bbf=_0x1779[_0x2463d2];return _0x490bbf;};'use strict';var multer=require(_0x9177('0x0'));var util=require(_0x9177('0x1'));var path=require(_0x9177('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9177('0x3'));var interaction=require(_0x9177('0x4'));var config=require(_0x9177('0x5'));var controller=require(_0x9177('0x6'));router['put'](_0x9177('0x7'),auth[_0x9177('0x8')](),controller[_0x9177('0x9')]);router[_0x9177('0xa')](_0x9177('0x7'),auth['isAuthenticated'](),controller[_0x9177('0xb')]);module[_0x9177('0xc')]=router; \ No newline at end of file +var _0x6a2f=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x22ac67,_0xef7b3d){var _0x14a172=function(_0x5698d0){while(--_0x5698d0){_0x22ac67['push'](_0x22ac67['shift']());}};_0x14a172(++_0xef7b3d);}(_0x6a2f,0x1ce));var _0xf6a2=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0x6a2f[_0x43d16c];return _0x208cce;};'use strict';var multer=require(_0xf6a2('0x0'));var util=require(_0xf6a2('0x1'));var path=require('path');var timeout=require(_0xf6a2('0x2'));var express=require(_0xf6a2('0x3'));var router=express[_0xf6a2('0x4')]();var fs_extra=require(_0xf6a2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf6a2('0x6'));var config=require(_0xf6a2('0x7'));var controller=require('./condition.controller');router[_0xf6a2('0x8')](_0xf6a2('0x9'),auth[_0xf6a2('0xa')](),controller[_0xf6a2('0xb')]);router[_0xf6a2('0xc')](_0xf6a2('0x9'),auth[_0xf6a2('0xa')](),controller[_0xf6a2('0xd')]);module[_0xf6a2('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 1ac1931..ed3a2ff 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4290=['STRING','INTEGER','exports'];(function(_0x2d7ed0,_0x148fe8){var _0x1e962f=function(_0x20bc54){while(--_0x20bc54){_0x2d7ed0['push'](_0x2d7ed0['shift']());}};_0x1e962f(++_0x148fe8);}(_0x4290,0x1bb));var _0x0429=function(_0x14ddf1,_0x398edd){_0x14ddf1=_0x14ddf1-0x0;var _0x547b90=_0x4290[_0x14ddf1];return _0x547b90;};'use strict';var Sequelize=require('sequelize');module[_0x0429('0x0')]={'name':{'type':Sequelize[_0x0429('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x0429('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x0429('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xf76a=['STRING','name','sequelize','exports'];(function(_0x263cb4,_0x53ce57){var _0x32a04b=function(_0x31e87b){while(--_0x31e87b){_0x263cb4['push'](_0x263cb4['shift']());}};_0x32a04b(++_0x53ce57);}(_0xf76a,0xfa));var _0xaf76=function(_0x59653f,_0x3f2fe4){_0x59653f=_0x59653f-0x0;var _0x3de0c4=_0xf76a[_0x59653f];return _0x3de0c4;};'use strict';var Sequelize=require(_0xaf76('0x0'));module[_0xaf76('0x1')]={'name':{'type':Sequelize[_0xaf76('0x2')],'allowNull':![],'unique':_0xaf76('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xaf76('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 699d21c..42c75cb 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x236c=['CmContactHasItem','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','ContactItemTypes','UserProfileResource','error','name','send','index','map','ContactItemType','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x3fa41b,_0x3f1931){var _0x5da671=function(_0x42a363){while(--_0x42a363){_0x3fa41b['push'](_0x3fa41b['shift']());}};_0x5da671(++_0x3f1931);}(_0x236c,0x155));var _0xc236=function(_0x10f50f,_0x59b602){_0x10f50f=_0x10f50f-0x0;var _0x9a6f45=_0x236c[_0x10f50f];return _0x9a6f45;};'use strict';var emlformat=require(_0xc236('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc236('0x1'));var jsonpatch=require(_0xc236('0x2'));var rp=require(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var BPromise=require(_0xc236('0x5'));var Mustache=require('mustache');var util=require(_0xc236('0x6'));var path=require(_0xc236('0x7'));var sox=require(_0xc236('0x8'));var csv=require(_0xc236('0x9'));var ejs=require(_0xc236('0xa'));var fs=require('fs');var fs_extra=require(_0xc236('0xb'));var _=require('lodash');var squel=require(_0xc236('0xc'));var crypto=require(_0xc236('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc236('0xe'));var Papa=require('papaparse');var Redis=require(_0xc236('0xf'));var authService=require(_0xc236('0x10'));var qs=require(_0xc236('0x11'));var as=require(_0xc236('0x12'));var hardwareService=require(_0xc236('0x13'));var logger=require('../../config/logger')(_0xc236('0x14'));var utils=require(_0xc236('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc236('0x16'));var db=require(_0xc236('0x17'))['db'];function respondWithStatusCode(_0x5ee3a5,_0x5b9638){_0x5b9638=_0x5b9638||0xcc;return function(_0x5bce83){if(_0x5bce83){return _0x5ee3a5['sendStatus'](_0x5b9638);}return _0x5ee3a5[_0xc236('0x18')](_0x5b9638)[_0xc236('0x19')]();};}function respondWithResult(_0x2184c9,_0x71bce2){_0x71bce2=_0x71bce2||0xc8;return function(_0x5052db){if(_0x5052db){return _0x2184c9[_0xc236('0x18')](_0x71bce2)['json'](_0x5052db);}};}function respondWithFilteredResult(_0x5221bf,_0x9a65e8){return function(_0x32f2fd){if(_0x32f2fd){var _0x443a46=typeof _0x9a65e8[_0xc236('0x1a')]===_0xc236('0x1b')&&typeof _0x9a65e8['limit']==='undefined';var _0x57355b=_0x32f2fd[_0xc236('0x1c')];var _0x76f45=_0x443a46?0x0:_0x9a65e8[_0xc236('0x1a')];var _0x541a20=_0x443a46?_0x32f2fd[_0xc236('0x1c')]:_0x9a65e8['offset']+_0x9a65e8['limit'];var _0x1eafba;if(_0x541a20>=_0x57355b){_0x541a20=_0x57355b;_0x1eafba=0xc8;}else{_0x1eafba=0xce;}_0x5221bf[_0xc236('0x18')](_0x1eafba);return _0x5221bf[_0xc236('0x1d')](_0xc236('0x1e'),_0x76f45+'-'+_0x541a20+'/'+_0x57355b)[_0xc236('0x1f')](_0x32f2fd);}return null;};}function patchUpdates(_0x27c6ab){return function(_0x3f0e2f){try{jsonpatch[_0xc236('0x20')](_0x3f0e2f,_0x27c6ab,!![]);}catch(_0x54ffac){return BPromise[_0xc236('0x21')](_0x54ffac);}return _0x3f0e2f[_0xc236('0x22')]();};}function saveUpdates(_0x4a9006,_0x208c3f){return function(_0x34d73a){if(_0x34d73a){return _0x34d73a[_0xc236('0x23')](_0x4a9006)[_0xc236('0x24')](function(_0x27afba){return _0x27afba;});}return null;};}function removeEntity(_0x21fab8,_0x3a315b){return function(_0xf921e6){if(_0xf921e6){return _0xf921e6[_0xc236('0x25')]()[_0xc236('0x24')](function(){var _0x17cb3b=_0xf921e6['get']({'plain':!![]});var _0x308cd6=_0xc236('0x26');return db[_0xc236('0x27')][_0xc236('0x25')]({'where':{'type':_0x308cd6,'resourceId':_0x17cb3b['id']}})['then'](function(){return _0xf921e6;});})[_0xc236('0x24')](function(){_0x21fab8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15ead8,_0x4eace8){return function(_0x36e578){if(!_0x36e578){_0x15ead8['sendStatus'](0x194);}return _0x36e578;};}function handleError(_0x54365,_0x5c79d6){_0x5c79d6=_0x5c79d6||0x1f4;return function(_0x423842){logger[_0xc236('0x28')](_0x423842['stack']);if(_0x423842['name']){delete _0x423842[_0xc236('0x29')];}_0x54365[_0xc236('0x18')](_0x5c79d6)[_0xc236('0x2a')](_0x423842);};}exports[_0xc236('0x2b')]=function(_0x5f3891,_0x4e3262){var _0x28ffa5={},_0x53b767={},_0x2c756f={'count':0x0,'rows':[]};var _0x4ddc87=_[_0xc236('0x2c')](db[_0xc236('0x2d')]['rawAttributes'],function(_0x5a5ec3){return{'name':_0x5a5ec3[_0xc236('0x2e')],'type':_0x5a5ec3[_0xc236('0x2f')][_0xc236('0x30')]};});_0x53b767[_0xc236('0x31')]=_[_0xc236('0x2c')](_0x4ddc87,_0xc236('0x29'));_0x53b767[_0xc236('0x32')]=_[_0xc236('0x33')](_0x5f3891[_0xc236('0x32')]);_0x53b767['filters']=_['intersection'](_0x53b767['model'],_0x53b767[_0xc236('0x32')]);_0x28ffa5[_0xc236('0x34')]=_[_0xc236('0x35')](_0x53b767[_0xc236('0x31')],qs[_0xc236('0x36')](_0x5f3891[_0xc236('0x32')][_0xc236('0x36')]));_0x28ffa5['attributes']=_0x28ffa5[_0xc236('0x34')][_0xc236('0x37')]?_0x28ffa5[_0xc236('0x34')]:_0x53b767['model'];if(!_0x5f3891[_0xc236('0x32')][_0xc236('0x38')](_0xc236('0x39'))){_0x28ffa5[_0xc236('0x3a')]=qs['limit'](_0x5f3891[_0xc236('0x32')][_0xc236('0x3a')]);_0x28ffa5[_0xc236('0x1a')]=qs[_0xc236('0x1a')](_0x5f3891[_0xc236('0x32')][_0xc236('0x1a')]);}_0x28ffa5[_0xc236('0x3b')]=qs[_0xc236('0x3c')](_0x5f3891[_0xc236('0x32')][_0xc236('0x3c')]);_0x28ffa5[_0xc236('0x3d')]=qs[_0xc236('0x3e')](_[_0xc236('0x3f')](_0x5f3891[_0xc236('0x32')],_0x53b767[_0xc236('0x3e')]),_0x4ddc87);if(_0x5f3891[_0xc236('0x32')][_0xc236('0x40')]){_0x28ffa5['where']=_['merge'](_0x28ffa5['where'],{'$or':_['map'](_0x4ddc87,function(_0x369a79){if(_0x369a79['type']!==_0xc236('0x41')){var _0x361526={};_0x361526[_0x369a79[_0xc236('0x29')]]={'$like':'%'+_0x5f3891[_0xc236('0x32')][_0xc236('0x40')]+'%'};return _0x361526;}})});}_0x28ffa5=_[_0xc236('0x42')]({},_0x28ffa5,_0x5f3891[_0xc236('0x43')]);var _0x201ba3={'where':_0x28ffa5[_0xc236('0x3d')]};return db[_0xc236('0x2d')][_0xc236('0x1c')](_0x201ba3)[_0xc236('0x24')](function(_0x3b2f2f){_0x2c756f[_0xc236('0x1c')]=_0x3b2f2f;if(_0x5f3891[_0xc236('0x32')]['includeAll']){_0x28ffa5[_0xc236('0x44')]=[{'all':!![]}];}return db[_0xc236('0x2d')]['findAll'](_0x28ffa5);})[_0xc236('0x24')](function(_0x5b0bc5){_0x2c756f[_0xc236('0x45')]=_0x5b0bc5;return _0x2c756f;})['then'](respondWithFilteredResult(_0x4e3262,_0x28ffa5))[_0xc236('0x46')](handleError(_0x4e3262,null));};exports[_0xc236('0x47')]=function(_0x8d04c9,_0x479e02){var _0x11e3dd={'raw':!![],'where':{'id':_0x8d04c9[_0xc236('0x48')]['id']}},_0x429e08={};_0x429e08['model']=_[_0xc236('0x33')](db[_0xc236('0x2d')][_0xc236('0x49')]);_0x429e08[_0xc236('0x32')]=_[_0xc236('0x33')](_0x8d04c9[_0xc236('0x32')]);_0x429e08['filters']=_[_0xc236('0x35')](_0x429e08['model'],_0x429e08[_0xc236('0x32')]);_0x11e3dd[_0xc236('0x34')]=_[_0xc236('0x35')](_0x429e08[_0xc236('0x31')],qs[_0xc236('0x36')](_0x8d04c9[_0xc236('0x32')][_0xc236('0x36')]));_0x11e3dd['attributes']=_0x11e3dd[_0xc236('0x34')]['length']?_0x11e3dd[_0xc236('0x34')]:_0x429e08[_0xc236('0x31')];if(_0x8d04c9['query'][_0xc236('0x4a')]){_0x11e3dd[_0xc236('0x44')]=[{'all':!![]}];}_0x11e3dd=_[_0xc236('0x42')]({},_0x11e3dd,_0x8d04c9[_0xc236('0x43')]);return db[_0xc236('0x2d')][_0xc236('0x4b')](_0x11e3dd)[_0xc236('0x24')](handleEntityNotFound(_0x479e02,null))['then'](respondWithResult(_0x479e02,null))['catch'](handleError(_0x479e02,null));};exports[_0xc236('0x4c')]=function(_0x2afed2,_0x510f7f){return db[_0xc236('0x2d')][_0xc236('0x4c')](_0x2afed2[_0xc236('0x4d')],{})[_0xc236('0x24')](function(_0x45fa20){var _0x1683f4=_0x2afed2[_0xc236('0x4e')][_0xc236('0x4f')]({'plain':!![]});if(!_0x1683f4)throw new Error(_0xc236('0x50'));if(_0x1683f4['role']===_0xc236('0x4e')){var _0x307663=_0x45fa20[_0xc236('0x4f')]({'plain':!![]});var _0x447a83=_0xc236('0x26');return db[_0xc236('0x51')][_0xc236('0x4b')]({'where':{'name':_0x447a83,'userProfileId':_0x1683f4['userProfileId']},'raw':!![]})[_0xc236('0x24')](function(_0x3788ff){if(_0x3788ff&&_0x3788ff[_0xc236('0x52')]===0x0){return db[_0xc236('0x27')]['create']({'name':_0x307663[_0xc236('0x29')],'resourceId':_0x307663['id'],'type':_0x3788ff[_0xc236('0x29')],'sectionId':_0x3788ff['id']},{})[_0xc236('0x24')](function(){return _0x45fa20;});}else{return _0x45fa20;}})[_0xc236('0x46')](function(_0x9d81c8){logger['error'](_0xc236('0x53'),_0x9d81c8);throw _0x9d81c8;});}return _0x45fa20;})['then'](respondWithResult(_0x510f7f,0xc9))[_0xc236('0x46')](handleError(_0x510f7f,null));};exports[_0xc236('0x23')]=function(_0x3f9e85,_0x15defc){if(_0x3f9e85[_0xc236('0x4d')]['id']){delete _0x3f9e85['body']['id'];}return db['ContactItemType'][_0xc236('0x4b')]({'where':{'id':_0x3f9e85[_0xc236('0x48')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x15defc,null))[_0xc236('0x24')](saveUpdates(_0x3f9e85[_0xc236('0x4d')],null))[_0xc236('0x24')](respondWithResult(_0x15defc,null))[_0xc236('0x46')](handleError(_0x15defc,null));};exports[_0xc236('0x25')]=function(_0x24af08,_0x2d27e7){return db['ContactItemType']['find']({'where':{'id':_0x24af08[_0xc236('0x48')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x2d27e7,null))[_0xc236('0x24')](db[_0xc236('0x54')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x24af08[_0xc236('0x48')]['id']}}))[_0xc236('0x24')](removeEntity(_0x2d27e7,null))['catch'](handleError(_0x2d27e7,null));}; \ No newline at end of file +var _0xb78e=['find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','CmContactHasItem','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','json','apply','reject','save','destroy','ContactItemTypes','UserProfileResource','then','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show'];(function(_0x4a70c3,_0x6b0d4f){var _0x3e0aec=function(_0x3a96cf){while(--_0x3a96cf){_0x4a70c3['push'](_0x4a70c3['shift']());}};_0x3e0aec(++_0x6b0d4f);}(_0xb78e,0x1c9));var _0xeb78=function(_0x5a9aff,_0x11e48c){_0x5a9aff=_0x5a9aff-0x0;var _0x4824d1=_0xb78e[_0x5a9aff];return _0x4824d1;};'use strict';var emlformat=require(_0xeb78('0x0'));var rimraf=require(_0xeb78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb78('0x2'));var rp=require(_0xeb78('0x3'));var moment=require(_0xeb78('0x4'));var BPromise=require(_0xeb78('0x5'));var Mustache=require(_0xeb78('0x6'));var util=require(_0xeb78('0x7'));var path=require(_0xeb78('0x8'));var sox=require(_0xeb78('0x9'));var csv=require('to-csv');var ejs=require(_0xeb78('0xa'));var fs=require('fs');var fs_extra=require(_0xeb78('0xb'));var _=require(_0xeb78('0xc'));var squel=require(_0xeb78('0xd'));var crypto=require(_0xeb78('0xe'));var jsforce=require(_0xeb78('0xf'));var deskjs=require(_0xeb78('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeb78('0x11'));var Papa=require(_0xeb78('0x12'));var Redis=require(_0xeb78('0x13'));var authService=require(_0xeb78('0x14'));var qs=require(_0xeb78('0x15'));var as=require(_0xeb78('0x16'));var hardwareService=require(_0xeb78('0x17'));var logger=require(_0xeb78('0x18'))(_0xeb78('0x19'));var utils=require('../../config/utils');var config=require(_0xeb78('0x1a'));var licenseUtil=require(_0xeb78('0x1b'));var db=require(_0xeb78('0x1c'))['db'];function respondWithStatusCode(_0x259df2,_0x9dbe51){_0x9dbe51=_0x9dbe51||0xcc;return function(_0x28c58c){if(_0x28c58c){return _0x259df2[_0xeb78('0x1d')](_0x9dbe51);}return _0x259df2[_0xeb78('0x1e')](_0x9dbe51)[_0xeb78('0x1f')]();};}function respondWithResult(_0x9bcc79,_0x5d50cf){_0x5d50cf=_0x5d50cf||0xc8;return function(_0x315914){if(_0x315914){return _0x9bcc79[_0xeb78('0x1e')](_0x5d50cf)['json'](_0x315914);}};}function respondWithFilteredResult(_0x538485,_0x53be89){return function(_0x23a0d0){if(_0x23a0d0){var _0x50ebae=typeof _0x53be89[_0xeb78('0x20')]===_0xeb78('0x21')&&typeof _0x53be89['limit']===_0xeb78('0x21');var _0x53c811=_0x23a0d0[_0xeb78('0x22')];var _0x92e410=_0x50ebae?0x0:_0x53be89['offset'];var _0x45176e=_0x50ebae?_0x23a0d0[_0xeb78('0x22')]:_0x53be89[_0xeb78('0x20')]+_0x53be89['limit'];var _0x24d845;if(_0x45176e>=_0x53c811){_0x45176e=_0x53c811;_0x24d845=0xc8;}else{_0x24d845=0xce;}_0x538485[_0xeb78('0x1e')](_0x24d845);return _0x538485['set']('Content-Range',_0x92e410+'-'+_0x45176e+'/'+_0x53c811)[_0xeb78('0x23')](_0x23a0d0);}return null;};}function patchUpdates(_0x106c5d){return function(_0x42eacb){try{jsonpatch[_0xeb78('0x24')](_0x42eacb,_0x106c5d,!![]);}catch(_0x432b18){return BPromise[_0xeb78('0x25')](_0x432b18);}return _0x42eacb[_0xeb78('0x26')]();};}function saveUpdates(_0x3ea071,_0x18f08d){return function(_0x52b8c1){if(_0x52b8c1){return _0x52b8c1['update'](_0x3ea071)['then'](function(_0x5c9e0d){return _0x5c9e0d;});}return null;};}function removeEntity(_0x3c8e66,_0x5b15d8){return function(_0x2159c1){if(_0x2159c1){return _0x2159c1[_0xeb78('0x27')]()['then'](function(){var _0x777ca3=_0x2159c1['get']({'plain':!![]});var _0x9a00b=_0xeb78('0x28');return db[_0xeb78('0x29')][_0xeb78('0x27')]({'where':{'type':_0x9a00b,'resourceId':_0x777ca3['id']}})['then'](function(){return _0x2159c1;});})[_0xeb78('0x2a')](function(){_0x3c8e66['status'](0xcc)[_0xeb78('0x1f')]();});}};}function handleEntityNotFound(_0x23295a,_0x4493bb){return function(_0x5263fc){if(!_0x5263fc){_0x23295a[_0xeb78('0x1d')](0x194);}return _0x5263fc;};}function handleError(_0x1e7d56,_0x1c04dd){_0x1c04dd=_0x1c04dd||0x1f4;return function(_0x381b2f){logger[_0xeb78('0x2b')](_0x381b2f[_0xeb78('0x2c')]);if(_0x381b2f[_0xeb78('0x2d')]){delete _0x381b2f[_0xeb78('0x2d')];}_0x1e7d56[_0xeb78('0x1e')](_0x1c04dd)[_0xeb78('0x2e')](_0x381b2f);};}exports[_0xeb78('0x2f')]=function(_0x505468,_0x555d89){var _0x4d12a3={},_0xb3a935={},_0x4253ea={'count':0x0,'rows':[]};var _0x15327f=_['map'](db[_0xeb78('0x30')][_0xeb78('0x31')],function(_0x3de59f){return{'name':_0x3de59f[_0xeb78('0x32')],'type':_0x3de59f[_0xeb78('0x33')][_0xeb78('0x34')]};});_0xb3a935[_0xeb78('0x35')]=_[_0xeb78('0x36')](_0x15327f,_0xeb78('0x2d'));_0xb3a935['query']=_[_0xeb78('0x37')](_0x505468['query']);_0xb3a935[_0xeb78('0x38')]=_[_0xeb78('0x39')](_0xb3a935[_0xeb78('0x35')],_0xb3a935[_0xeb78('0x3a')]);_0x4d12a3[_0xeb78('0x3b')]=_[_0xeb78('0x39')](_0xb3a935['model'],qs['fields'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x3c')]));_0x4d12a3[_0xeb78('0x3b')]=_0x4d12a3[_0xeb78('0x3b')][_0xeb78('0x3d')]?_0x4d12a3['attributes']:_0xb3a935[_0xeb78('0x35')];if(!_0x505468[_0xeb78('0x3a')][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x4d12a3[_0xeb78('0x40')]=qs[_0xeb78('0x40')](_0x505468['query']['limit']);_0x4d12a3['offset']=qs['offset'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x20')]);}_0x4d12a3[_0xeb78('0x41')]=qs['sort'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x42')]);_0x4d12a3['where']=qs['filters'](_['pick'](_0x505468[_0xeb78('0x3a')],_0xb3a935[_0xeb78('0x38')]),_0x15327f);if(_0x505468[_0xeb78('0x3a')]['filter']){_0x4d12a3[_0xeb78('0x43')]=_[_0xeb78('0x44')](_0x4d12a3[_0xeb78('0x43')],{'$or':_['map'](_0x15327f,function(_0xf0f13c){if(_0xf0f13c[_0xeb78('0x33')]!==_0xeb78('0x45')){var _0x437590={};_0x437590[_0xf0f13c['name']]={'$like':'%'+_0x505468['query'][_0xeb78('0x46')]+'%'};return _0x437590;}})});}_0x4d12a3=_[_0xeb78('0x44')]({},_0x4d12a3,_0x505468[_0xeb78('0x47')]);var _0x183095={'where':_0x4d12a3[_0xeb78('0x43')]};return db[_0xeb78('0x30')][_0xeb78('0x22')](_0x183095)[_0xeb78('0x2a')](function(_0x47567d){_0x4253ea['count']=_0x47567d;if(_0x505468[_0xeb78('0x3a')][_0xeb78('0x48')]){_0x4d12a3[_0xeb78('0x49')]=[{'all':!![]}];}return db['ContactItemType'][_0xeb78('0x4a')](_0x4d12a3);})['then'](function(_0x21f81b){_0x4253ea[_0xeb78('0x4b')]=_0x21f81b;return _0x4253ea;})[_0xeb78('0x2a')](respondWithFilteredResult(_0x555d89,_0x4d12a3))['catch'](handleError(_0x555d89,null));};exports[_0xeb78('0x4c')]=function(_0x3ab487,_0x390051){var _0x2944d8={'raw':!![],'where':{'id':_0x3ab487['params']['id']}},_0x2dc9f7={};_0x2dc9f7[_0xeb78('0x35')]=_[_0xeb78('0x37')](db['ContactItemType'][_0xeb78('0x31')]);_0x2dc9f7[_0xeb78('0x3a')]=_[_0xeb78('0x37')](_0x3ab487['query']);_0x2dc9f7[_0xeb78('0x38')]=_[_0xeb78('0x39')](_0x2dc9f7[_0xeb78('0x35')],_0x2dc9f7[_0xeb78('0x3a')]);_0x2944d8[_0xeb78('0x3b')]=_[_0xeb78('0x39')](_0x2dc9f7['model'],qs['fields'](_0x3ab487[_0xeb78('0x3a')][_0xeb78('0x3c')]));_0x2944d8['attributes']=_0x2944d8[_0xeb78('0x3b')][_0xeb78('0x3d')]?_0x2944d8[_0xeb78('0x3b')]:_0x2dc9f7[_0xeb78('0x35')];if(_0x3ab487[_0xeb78('0x3a')][_0xeb78('0x48')]){_0x2944d8[_0xeb78('0x49')]=[{'all':!![]}];}_0x2944d8=_[_0xeb78('0x44')]({},_0x2944d8,_0x3ab487[_0xeb78('0x47')]);return db[_0xeb78('0x30')][_0xeb78('0x4d')](_0x2944d8)[_0xeb78('0x2a')](handleEntityNotFound(_0x390051,null))[_0xeb78('0x2a')](respondWithResult(_0x390051,null))[_0xeb78('0x4e')](handleError(_0x390051,null));};exports[_0xeb78('0x4f')]=function(_0x58e361,_0x2c4616){return db[_0xeb78('0x30')][_0xeb78('0x4f')](_0x58e361[_0xeb78('0x50')],{})['then'](function(_0x35cedb){var _0x135106=_0x58e361[_0xeb78('0x51')][_0xeb78('0x52')]({'plain':!![]});if(!_0x135106)throw new Error(_0xeb78('0x53'));if(_0x135106['role']==='user'){var _0x553f6d=_0x35cedb[_0xeb78('0x52')]({'plain':!![]});var _0x21ee21='ContactItemTypes';return db[_0xeb78('0x54')][_0xeb78('0x4d')]({'where':{'name':_0x21ee21,'userProfileId':_0x135106[_0xeb78('0x55')]},'raw':!![]})['then'](function(_0x4d6a21){if(_0x4d6a21&&_0x4d6a21[_0xeb78('0x56')]===0x0){return db[_0xeb78('0x29')][_0xeb78('0x4f')]({'name':_0x553f6d['name'],'resourceId':_0x553f6d['id'],'type':_0x4d6a21[_0xeb78('0x2d')],'sectionId':_0x4d6a21['id']},{})[_0xeb78('0x2a')](function(){return _0x35cedb;});}else{return _0x35cedb;}})[_0xeb78('0x4e')](function(_0x4a3c91){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a3c91);throw _0x4a3c91;});}return _0x35cedb;})[_0xeb78('0x2a')](respondWithResult(_0x2c4616,0xc9))[_0xeb78('0x4e')](handleError(_0x2c4616,null));};exports['update']=function(_0x2b42f6,_0x31eb10){if(_0x2b42f6[_0xeb78('0x50')]['id']){delete _0x2b42f6['body']['id'];}return db[_0xeb78('0x30')]['find']({'where':{'id':_0x2b42f6[_0xeb78('0x57')]['id']}})[_0xeb78('0x2a')](handleEntityNotFound(_0x31eb10,null))[_0xeb78('0x2a')](saveUpdates(_0x2b42f6['body'],null))['then'](respondWithResult(_0x31eb10,null))['catch'](handleError(_0x31eb10,null));};exports['destroy']=function(_0x3238e9,_0x51f51f){return db[_0xeb78('0x30')][_0xeb78('0x4d')]({'where':{'id':_0x3238e9[_0xeb78('0x57')]['id']}})[_0xeb78('0x2a')](handleEntityNotFound(_0x51f51f,null))[_0xeb78('0x2a')](db[_0xeb78('0x58')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3238e9['params']['id']}}))[_0xeb78('0x2a')](removeEntity(_0x51f51f,null))[_0xeb78('0x4e')](handleError(_0x51f51f,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index cf12e77..c1d49c6 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e09=['./contactItemType.attributes','define','tools_contact_item_types','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x31df6f,_0x380e73){var _0x31e353=function(_0x3a434b){while(--_0x3a434b){_0x31df6f['push'](_0x31df6f['shift']());}};_0x31e353(++_0x380e73);}(_0x7e09,0x1dc));var _0x97e0=function(_0x531ae7,_0x2d8d13){_0x531ae7=_0x531ae7-0x0;var _0x5f2a6f=_0x7e09[_0x531ae7];return _0x5f2a6f;};'use strict';var _=require(_0x97e0('0x0'));var util=require(_0x97e0('0x1'));var logger=require(_0x97e0('0x2'))(_0x97e0('0x3'));var moment=require('moment');var BPromise=require(_0x97e0('0x4'));var rp=require(_0x97e0('0x5'));var fs=require('fs');var path=require(_0x97e0('0x6'));var rimraf=require(_0x97e0('0x7'));var config=require('../../config/environment');var attributes=require(_0x97e0('0x8'));module['exports']=function(_0x58db69,_0x1daaba){return _0x58db69[_0x97e0('0x9')]('ContactItemType',attributes,{'tableName':_0x97e0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69cf=['./contactItemType.attributes','exports','define','ContactItemType','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x69cf,0x1d8));var _0xf69c=function(_0x300915,_0x320ae4){_0x300915=_0x300915-0x0;var _0x5887ed=_0x69cf[_0x300915];return _0x5887ed;};'use strict';var _=require(_0xf69c('0x0'));var util=require(_0xf69c('0x1'));var logger=require('../../config/logger')(_0xf69c('0x2'));var moment=require(_0xf69c('0x3'));var BPromise=require(_0xf69c('0x4'));var rp=require(_0xf69c('0x5'));var fs=require('fs');var path=require(_0xf69c('0x6'));var rimraf=require(_0xf69c('0x7'));var config=require(_0xf69c('0x8'));var attributes=require(_0xf69c('0x9'));module[_0xf69c('0xa')]=function(_0x5883b3,_0x5d7eb7){return _0x5883b3[_0xf69c('0xb')](_0xf69c('0xc'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 48df462..bf9d9f0 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72ee=['then','info','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0xf8f8ff,_0x485a3c){var _0x2b47e3=function(_0x563f04){while(--_0x563f04){_0xf8f8ff['push'](_0xf8f8ff['shift']());}};_0x2b47e3(++_0x485a3c);}(_0x72ee,0x1ac));var _0xe72e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x72ee[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe72e('0x0'));var util=require(_0xe72e('0x1'));var moment=require(_0xe72e('0x2'));var BPromise=require(_0xe72e('0x3'));var rs=require(_0xe72e('0x4'));var fs=require('fs');var Redis=require(_0xe72e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe72e('0x6'));var logger=require(_0xe72e('0x7'))('rpc');var config=require(_0xe72e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe72e('0x9')][_0xe72e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e5ddf,_0x212708,_0x2fe66c){return new BPromise(function(_0x1ca27c,_0x5d8777){return client[_0xe72e('0xb')](_0x3e5ddf,_0x2fe66c)[_0xe72e('0xc')](function(_0x3839e4){logger[_0xe72e('0xd')]('ContactItemType,\x20%s,\x20%s',_0x212708,_0xe72e('0xe'));logger['debug'](_0xe72e('0xf'),_0x212708,_0xe72e('0xe'),JSON[_0xe72e('0x10')](_0x3839e4));if(_0x3839e4['error']){if(_0x3839e4[_0xe72e('0x11')][_0xe72e('0x12')]===0x1f4){logger[_0xe72e('0x11')](_0xe72e('0x13'),_0x212708,_0x3839e4[_0xe72e('0x11')][_0xe72e('0x14')]);return _0x5d8777(_0x3839e4[_0xe72e('0x11')]['message']);}logger['error']('ContactItemType,\x20%s,\x20%s',_0x212708,_0x3839e4[_0xe72e('0x11')]['message']);return _0x1ca27c(_0x3839e4[_0xe72e('0x11')][_0xe72e('0x14')]);}else{logger[_0xe72e('0xd')](_0xe72e('0x13'),_0x212708,_0xe72e('0xe'));_0x1ca27c(_0x3839e4['result'][_0xe72e('0x14')]);}})[_0xe72e('0x15')](function(_0x261636){logger[_0xe72e('0x11')](_0xe72e('0x13'),_0x212708,_0x261636);_0x5d8777(_0x261636);});});} \ No newline at end of file +var _0xd786=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x110108,_0x141dec){var _0x3de16e=function(_0x4d9352){while(--_0x4d9352){_0x110108['push'](_0x110108['shift']());}};_0x3de16e(++_0x141dec);}(_0xd786,0x1dc));var _0x6d78=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xd786[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x6d78('0x0'));var util=require(_0x6d78('0x1'));var moment=require(_0x6d78('0x2'));var BPromise=require(_0x6d78('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d78('0x4'));var db=require(_0x6d78('0x5'))['db'];var utils=require(_0x6d78('0x6'));var logger=require(_0x6d78('0x7'))(_0x6d78('0x8'));var config=require(_0x6d78('0x9'));var jayson=require(_0x6d78('0xa'));var client=jayson['client'][_0x6d78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30e9e5,_0x5c3f38,_0x44db98){return new BPromise(function(_0x33b85e,_0x10f58a){return client[_0x6d78('0xc')](_0x30e9e5,_0x44db98)['then'](function(_0x3198b6){logger[_0x6d78('0xd')](_0x6d78('0xe'),_0x5c3f38,'request\x20sent');logger[_0x6d78('0xf')](_0x6d78('0x10'),_0x5c3f38,_0x6d78('0x11'),JSON[_0x6d78('0x12')](_0x3198b6));if(_0x3198b6[_0x6d78('0x13')]){if(_0x3198b6[_0x6d78('0x13')][_0x6d78('0x14')]===0x1f4){logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x3198b6[_0x6d78('0x13')]['message']);return _0x10f58a(_0x3198b6[_0x6d78('0x13')][_0x6d78('0x15')]);}logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x3198b6[_0x6d78('0x13')]['message']);return _0x33b85e(_0x3198b6['error'][_0x6d78('0x15')]);}else{logger['info'](_0x6d78('0xe'),_0x5c3f38,'request\x20sent');_0x33b85e(_0x3198b6[_0x6d78('0x16')]['message']);}})[_0x6d78('0x17')](function(_0x378c59){logger[_0x6d78('0x13')](_0x6d78('0xe'),_0x5c3f38,_0x378c59);_0x10f58a(_0x378c59);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 99dc2ad..6643843 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec1f=['path','express','Router','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','util'];(function(_0x269d11,_0x2df4b6){var _0x369aa1=function(_0x179d79){while(--_0x179d79){_0x269d11['push'](_0x269d11['shift']());}};_0x369aa1(++_0x2df4b6);}(_0xec1f,0x1af));var _0xfec1=function(_0x50c373,_0xbc2126){_0x50c373=_0x50c373-0x0;var _0x5e44a9=_0xec1f[_0x50c373];return _0x5e44a9;};'use strict';var multer=require('multer');var util=require(_0xfec1('0x0'));var path=require(_0xfec1('0x1'));var timeout=require('connect-timeout');var express=require(_0xfec1('0x2'));var router=express[_0xfec1('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfec1('0x4'));var config=require(_0xfec1('0x5'));var controller=require(_0xfec1('0x6'));router['get']('/',auth[_0xfec1('0x7')](),controller[_0xfec1('0x8')]);router['get'](_0xfec1('0x9'),auth[_0xfec1('0x7')](),controller[_0xfec1('0xa')]);router[_0xfec1('0xb')]('/',auth[_0xfec1('0x7')](),controller[_0xfec1('0xc')]);router[_0xfec1('0xd')](_0xfec1('0x9'),auth[_0xfec1('0x7')](),controller['update']);router['delete'](_0xfec1('0x9'),auth['isAuthenticated'](),controller[_0xfec1('0xe')]);module[_0xfec1('0xf')]=router; \ No newline at end of file +var _0x64ad=['fs-extra','../../components/auth/service','./contactItemType.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x2f35ce,_0x56dd4a){var _0x11bd3e=function(_0x5b4d5a){while(--_0x5b4d5a){_0x2f35ce['push'](_0x2f35ce['shift']());}};_0x11bd3e(++_0x56dd4a);}(_0x64ad,0x176));var _0xd64a=function(_0x458363,_0x1675db){_0x458363=_0x458363-0x0;var _0x4d0290=_0x64ad[_0x458363];return _0x4d0290;};'use strict';var multer=require('multer');var util=require(_0xd64a('0x0'));var path=require(_0xd64a('0x1'));var timeout=require(_0xd64a('0x2'));var express=require(_0xd64a('0x3'));var router=express['Router']();var fs_extra=require(_0xd64a('0x4'));var auth=require(_0xd64a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd64a('0x6'));router['get']('/',auth[_0xd64a('0x7')](),controller[_0xd64a('0x8')]);router[_0xd64a('0x9')](_0xd64a('0xa'),auth[_0xd64a('0x7')](),controller[_0xd64a('0xb')]);router[_0xd64a('0xc')]('/',auth[_0xd64a('0x7')](),controller[_0xd64a('0xd')]);router[_0xd64a('0xe')](_0xd64a('0xa'),auth[_0xd64a('0x7')](),controller[_0xd64a('0xf')]);router[_0xd64a('0x10')](_0xd64a('0xa'),auth[_0xd64a('0x7')](),controller[_0xd64a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 0134cd6..282ba85 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0x13e300,_0x1bcb41){var _0x5a3eea=function(_0x2dfd2a){while(--_0x2dfd2a){_0x13e300['push'](_0x13e300['shift']());}};_0x5a3eea(++_0x1bcb41);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x30cac2,_0x279f1b){var _0x1c8eef=function(_0x52e470){while(--_0x52e470){_0x30cac2['push'](_0x30cac2['shift']());}};_0x1c8eef(++_0x279f1b);}(_0x757a,0xde));var _0xa757=function(_0x51d147,_0x10b23d){_0x51d147=_0x51d147-0x0;var _0x282973=_0x757a[_0x51d147];return _0x282973;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 78c950e..d534661 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 _0x8af6=['pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','order','pick','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./dashboard.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','CustomDashboards','UserProfileResource','destroy','stack','name','send','map','Dashboard','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','create','body','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','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'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x8af6,0x92));var _0x68af=function(_0x13d018,_0x36d587){_0x13d018=_0x13d018-0x0;var _0x3b7671=_0x8af6[_0x13d018];return _0x3b7671;};'use strict';var emlformat=require(_0x68af('0x0'));var rimraf=require(_0x68af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x68af('0x2'));var rp=require(_0x68af('0x3'));var moment=require(_0x68af('0x4'));var BPromise=require(_0x68af('0x5'));var Mustache=require(_0x68af('0x6'));var util=require('util');var path=require(_0x68af('0x7'));var sox=require(_0x68af('0x8'));var csv=require('to-csv');var ejs=require(_0x68af('0x9'));var fs=require('fs');var fs_extra=require(_0x68af('0xa'));var _=require(_0x68af('0xb'));var squel=require(_0x68af('0xc'));var crypto=require(_0x68af('0xd'));var jsforce=require(_0x68af('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x68af('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x68af('0x10'));var as=require(_0x68af('0x11'));var hardwareService=require(_0x68af('0x12'));var logger=require(_0x68af('0x13'))(_0x68af('0x14'));var utils=require('../../config/utils');var config=require(_0x68af('0x15'));var licenseUtil=require(_0x68af('0x16'));var db=require(_0x68af('0x17'))['db'];config['redis']=_[_0x68af('0x18')](config[_0x68af('0x19')],{'host':_0x68af('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x68af('0x19')]));require(_0x68af('0x1b'))[_0x68af('0x1c')](socket);function respondWithStatusCode(_0x320bef,_0x6ab408){_0x6ab408=_0x6ab408||0xcc;return function(_0x4b4cfa){if(_0x4b4cfa){return _0x320bef[_0x68af('0x1d')](_0x6ab408);}return _0x320bef['status'](_0x6ab408)[_0x68af('0x1e')]();};}function respondWithResult(_0x4c1db9,_0xc0f2ab){_0xc0f2ab=_0xc0f2ab||0xc8;return function(_0x5607d2){if(_0x5607d2){return _0x4c1db9[_0x68af('0x1f')](_0xc0f2ab)[_0x68af('0x20')](_0x5607d2);}};}function respondWithFilteredResult(_0x1cdf06,_0x38bd2d){return function(_0x7c6961){if(_0x7c6961){var _0x3fc08f=typeof _0x38bd2d[_0x68af('0x21')]===_0x68af('0x22')&&typeof _0x38bd2d[_0x68af('0x23')]===_0x68af('0x22');var _0x2f0c0e=_0x7c6961[_0x68af('0x24')];var _0x2a760e=_0x3fc08f?0x0:_0x38bd2d[_0x68af('0x21')];var _0x247048=_0x3fc08f?_0x7c6961[_0x68af('0x24')]:_0x38bd2d[_0x68af('0x21')]+_0x38bd2d[_0x68af('0x23')];var _0x29322d;if(_0x247048>=_0x2f0c0e){_0x247048=_0x2f0c0e;_0x29322d=0xc8;}else{_0x29322d=0xce;}_0x1cdf06['status'](_0x29322d);return _0x1cdf06[_0x68af('0x25')](_0x68af('0x26'),_0x2a760e+'-'+_0x247048+'/'+_0x2f0c0e)[_0x68af('0x20')](_0x7c6961);}return null;};}function patchUpdates(_0x4512ce){return function(_0x3ee0aa){try{jsonpatch[_0x68af('0x27')](_0x3ee0aa,_0x4512ce,!![]);}catch(_0x274eb3){return BPromise[_0x68af('0x28')](_0x274eb3);}return _0x3ee0aa['save']();};}function saveUpdates(_0x1030ce,_0x5a3701){return function(_0x5dacf1){if(_0x5dacf1){return _0x5dacf1[_0x68af('0x29')](_0x1030ce)['then'](function(_0x28f599){return _0x28f599;});}return null;};}function removeEntity(_0x384c0e,_0x1cb4e5){return function(_0x43f17d){if(_0x43f17d){return _0x43f17d['destroy']()[_0x68af('0x2a')](function(){var _0x20bd75=_0x43f17d['get']({'plain':!![]});var _0xb5f5cf=_0x68af('0x2b');return db[_0x68af('0x2c')][_0x68af('0x2d')]({'where':{'type':_0xb5f5cf,'resourceId':_0x20bd75['id']}})[_0x68af('0x2a')](function(){return _0x43f17d;});})[_0x68af('0x2a')](function(){_0x384c0e[_0x68af('0x1f')](0xcc)[_0x68af('0x1e')]();});}};}function handleEntityNotFound(_0x5a75d1,_0x204df9){return function(_0x4ca6c8){if(!_0x4ca6c8){_0x5a75d1[_0x68af('0x1d')](0x194);}return _0x4ca6c8;};}function handleError(_0x1ada35,_0x2142ab){_0x2142ab=_0x2142ab||0x1f4;return function(_0x2e267c){logger['error'](_0x2e267c[_0x68af('0x2e')]);if(_0x2e267c[_0x68af('0x2f')]){delete _0x2e267c[_0x68af('0x2f')];}_0x1ada35['status'](_0x2142ab)[_0x68af('0x30')](_0x2e267c);};}exports['index']=function(_0x1ebcd7,_0x1c4758){var _0x34f050={},_0x16f6d6={},_0x27c96e={'count':0x0,'rows':[]};var _0x577827=_[_0x68af('0x31')](db[_0x68af('0x32')]['rawAttributes'],function(_0x4389a7){return{'name':_0x4389a7[_0x68af('0x33')],'type':_0x4389a7['type']['key']};});_0x16f6d6['model']=_[_0x68af('0x31')](_0x577827,_0x68af('0x2f'));_0x16f6d6[_0x68af('0x34')]=_['keys'](_0x1ebcd7[_0x68af('0x34')]);_0x16f6d6[_0x68af('0x35')]=_[_0x68af('0x36')](_0x16f6d6[_0x68af('0x37')],_0x16f6d6[_0x68af('0x34')]);_0x34f050[_0x68af('0x38')]=_['intersection'](_0x16f6d6[_0x68af('0x37')],qs[_0x68af('0x39')](_0x1ebcd7[_0x68af('0x34')][_0x68af('0x39')]));_0x34f050[_0x68af('0x38')]=_0x34f050[_0x68af('0x38')][_0x68af('0x3a')]?_0x34f050[_0x68af('0x38')]:_0x16f6d6[_0x68af('0x37')];if(!_0x1ebcd7[_0x68af('0x34')][_0x68af('0x3b')](_0x68af('0x3c'))){_0x34f050[_0x68af('0x23')]=qs[_0x68af('0x23')](_0x1ebcd7[_0x68af('0x34')][_0x68af('0x23')]);_0x34f050['offset']=qs[_0x68af('0x21')](_0x1ebcd7[_0x68af('0x34')][_0x68af('0x21')]);}_0x34f050['order']=qs[_0x68af('0x3d')](_0x1ebcd7[_0x68af('0x34')][_0x68af('0x3d')]);_0x34f050[_0x68af('0x3e')]=qs['filters'](_['pick'](_0x1ebcd7[_0x68af('0x34')],_0x16f6d6['filters']),_0x577827);if(_0x1ebcd7[_0x68af('0x34')][_0x68af('0x3f')]){_0x34f050['where']=_[_0x68af('0x40')](_0x34f050[_0x68af('0x3e')],{'$or':_['map'](_0x577827,function(_0x411479){if(_0x411479[_0x68af('0x41')]!==_0x68af('0x42')){var _0x497dca={};_0x497dca[_0x411479[_0x68af('0x2f')]]={'$like':'%'+_0x1ebcd7[_0x68af('0x34')][_0x68af('0x3f')]+'%'};return _0x497dca;}})});}_0x34f050=_[_0x68af('0x40')]({},_0x34f050,_0x1ebcd7[_0x68af('0x43')]);var _0x415fcd={'where':_0x34f050[_0x68af('0x3e')]};return db[_0x68af('0x32')][_0x68af('0x24')](_0x415fcd)[_0x68af('0x2a')](function(_0x2e0a12){_0x27c96e['count']=_0x2e0a12;if(_0x1ebcd7[_0x68af('0x34')][_0x68af('0x44')]){_0x34f050['include']=[{'all':!![]}];}return db[_0x68af('0x32')][_0x68af('0x45')](_0x34f050);})[_0x68af('0x2a')](function(_0x36cf9f){_0x27c96e[_0x68af('0x46')]=_0x36cf9f;return _0x27c96e;})[_0x68af('0x2a')](respondWithFilteredResult(_0x1c4758,_0x34f050))[_0x68af('0x47')](handleError(_0x1c4758,null));};exports[_0x68af('0x48')]=function(_0x4c8dc1,_0xb32093){var _0x258985={'raw':![],'where':{'id':_0x4c8dc1[_0x68af('0x49')]['id']}},_0x79d09b={};_0x79d09b['model']=_[_0x68af('0x4a')](db[_0x68af('0x32')][_0x68af('0x4b')]);_0x79d09b[_0x68af('0x34')]=_[_0x68af('0x4a')](_0x4c8dc1[_0x68af('0x34')]);_0x79d09b[_0x68af('0x35')]=_[_0x68af('0x36')](_0x79d09b[_0x68af('0x37')],_0x79d09b[_0x68af('0x34')]);_0x258985[_0x68af('0x38')]=_[_0x68af('0x36')](_0x79d09b[_0x68af('0x37')],qs[_0x68af('0x39')](_0x4c8dc1[_0x68af('0x34')][_0x68af('0x39')]));_0x258985[_0x68af('0x38')]=_0x258985[_0x68af('0x38')][_0x68af('0x3a')]?_0x258985[_0x68af('0x38')]:_0x79d09b['model'];if(_0x4c8dc1['query']['includeAll']){_0x258985[_0x68af('0x4c')]=[{'all':!![]}];}_0x258985=_[_0x68af('0x40')]({},_0x258985,_0x4c8dc1[_0x68af('0x43')]);return db[_0x68af('0x32')]['find'](_0x258985)[_0x68af('0x2a')](handleEntityNotFound(_0xb32093,null))['then'](respondWithResult(_0xb32093,null))[_0x68af('0x47')](handleError(_0xb32093,null));};exports[_0x68af('0x4d')]=function(_0x275c74,_0x46d8b4){return db['Dashboard'][_0x68af('0x4d')](_0x275c74[_0x68af('0x4e')],{})['then'](function(_0x347706){var _0x665289=_0x275c74[_0x68af('0x4f')][_0x68af('0x50')]({'plain':!![]});if(!_0x665289)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x665289[_0x68af('0x51')]===_0x68af('0x4f')){var _0x29853d=_0x347706[_0x68af('0x50')]({'plain':!![]});var _0x5c7c7d=_0x68af('0x2b');return db[_0x68af('0x52')][_0x68af('0x53')]({'where':{'name':_0x5c7c7d,'userProfileId':_0x665289[_0x68af('0x54')]},'raw':!![]})[_0x68af('0x2a')](function(_0x55a7e3){if(_0x55a7e3&&_0x55a7e3[_0x68af('0x55')]===0x0){return db[_0x68af('0x2c')][_0x68af('0x4d')]({'name':_0x29853d['name'],'resourceId':_0x29853d['id'],'type':_0x55a7e3['name'],'sectionId':_0x55a7e3['id']},{})[_0x68af('0x2a')](function(){return _0x347706;});}else{return _0x347706;}})[_0x68af('0x47')](function(_0x54f697){logger[_0x68af('0x56')](_0x68af('0x57'),_0x54f697);throw _0x54f697;});}return _0x347706;})[_0x68af('0x2a')](respondWithResult(_0x46d8b4,0xc9))[_0x68af('0x47')](handleError(_0x46d8b4,null));};exports[_0x68af('0x58')]=function(_0x1bdcd1,_0x287423){var _0x1e8060={'where':{'id':_0x1bdcd1[_0x68af('0x49')]['id']}},_0x44747f={};_0x44747f['model']=_[_0x68af('0x4a')](db[_0x68af('0x32')]['rawAttributes']);_0x1e8060[_0x68af('0x38')]=_[_0x68af('0x36')](_0x44747f[_0x68af('0x37')],qs[_0x68af('0x39')](_0x1bdcd1[_0x68af('0x34')][_0x68af('0x39')]));_0x1e8060['attributes']=_0x1e8060[_0x68af('0x38')][_0x68af('0x3a')]?_0x1e8060['attributes']:_0x44747f['model'];if(_0x1bdcd1['query']['includeAll']){_0x1e8060[_0x68af('0x4c')]=[{'all':!![]}];}_0x1e8060=_['merge']({},_0x1e8060,_0x1bdcd1['options']);return db['Dashboard'][_0x68af('0x53')](_0x1e8060)['then'](handleEntityNotFound(_0x287423,null))['then'](function(_0x2c2c4a){if(_0x2c2c4a){var _0x1ff07d=_0x2c2c4a[_0x68af('0x50')]({'plain':!![]});_0x1ff07d=qs[_0x68af('0x59')](_0x1ff07d,['id',_0x68af('0x5a'),'updatedAt']);_0x1bdcd1[_0x68af('0x4e')]=_['omit'](_0x1bdcd1[_0x68af('0x4e')],['id',_0x68af('0x5a'),_0x68af('0x5b')]);return db[_0x68af('0x32')][_0x68af('0x4d')](_[_0x68af('0x40')](_0x1ff07d,_0x1bdcd1[_0x68af('0x4e')]),{'include':_0x1bdcd1[_0x68af('0x34')][_0x68af('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x4efbe0){var _0x515d2e=_0x1bdcd1[_0x68af('0x4f')][_0x68af('0x50')]({'plain':!![]});if(!_0x515d2e)throw new Error(_0x68af('0x5c'));if(_0x515d2e['role']===_0x68af('0x4f')){var _0x69a4ac=_0x4efbe0[_0x68af('0x50')]({'plain':!![]});var _0x4ea09d='CustomDashboards';return db['UserProfileSection'][_0x68af('0x53')]({'where':{'name':_0x4ea09d,'userProfileId':_0x515d2e[_0x68af('0x54')]},'raw':!![]})['then'](function(_0x14b82d){if(_0x14b82d&&_0x14b82d['autoAssociation']===0x0){return db['UserProfileResource'][_0x68af('0x4d')]({'name':_0x69a4ac[_0x68af('0x2f')],'resourceId':_0x69a4ac['id'],'type':_0x14b82d[_0x68af('0x2f')],'sectionId':_0x14b82d['id']},{})[_0x68af('0x2a')](function(){return _0x4efbe0;});}else{return _0x4efbe0;}})[_0x68af('0x47')](function(_0x59d346){logger[_0x68af('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59d346);throw _0x59d346;});}return _0x4efbe0;});}})[_0x68af('0x2a')](respondWithResult(_0x287423,0xc9))[_0x68af('0x47')](handleError(_0x287423,null));};exports[_0x68af('0x29')]=function(_0x534114,_0x4f7b42){if(_0x534114[_0x68af('0x4e')]['id']){delete _0x534114[_0x68af('0x4e')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x534114[_0x68af('0x49')]['id']}})[_0x68af('0x2a')](handleEntityNotFound(_0x4f7b42,null))['then'](saveUpdates(_0x534114[_0x68af('0x4e')],null))[_0x68af('0x2a')](respondWithResult(_0x4f7b42,null))[_0x68af('0x47')](handleError(_0x4f7b42,null));};exports[_0x68af('0x2d')]=function(_0x58659a,_0xff87db){return db[_0x68af('0x32')][_0x68af('0x53')]({'where':{'id':_0x58659a[_0x68af('0x49')]['id']}})['then'](handleEntityNotFound(_0xff87db,null))[_0x68af('0x2a')](removeEntity(_0xff87db,null))['catch'](handleError(_0xff87db,null));};function widgetAttributes(_0x10af21){try{switch(_0x10af21[_0x68af('0x41')]){case'iframe':return[{'name':_0x68af('0x5d'),'value':_0x10af21['attrUrl']||(_0x10af21[_0x68af('0x5e')]&&_0x10af21[_0x68af('0x5e')][0x0]?_0x10af21['attrs'][0x0][_0x68af('0x5f')]:undefined)||_0x68af('0x60')}];case _0x68af('0x61'):return[{'name':_0x68af('0x62'),'value':_0x10af21[_0x68af('0x62')]||(_0x10af21[_0x68af('0x5e')]&&_0x10af21['attrs'][0x0]?_0x10af21['attrs'][0x0][_0x68af('0x5f')]:undefined)||''}];case _0x68af('0x63'):return[{'name':_0x68af('0x64'),'value':_0x10af21['attrHourFormat']||(_0x10af21[_0x68af('0x5e')]&&_0x10af21[_0x68af('0x5e')][0x0]?_0x10af21[_0x68af('0x5e')][0x0][_0x68af('0x5f')]:undefined)||_0x68af('0x65')},{'name':_0x68af('0x66'),'value':_0x10af21[_0x68af('0x66')]||(_0x10af21[_0x68af('0x5e')]&&_0x10af21[_0x68af('0x5e')][0x1]?_0x10af21[_0x68af('0x5e')][0x1][_0x68af('0x5f')]:undefined)||_0x68af('0x67')},{'name':'attrFontSize','value':_0x10af21[_0x68af('0x68')]||(_0x10af21['attrs']&&_0x10af21[_0x68af('0x5e')][0x2]?_0x10af21['attrs'][0x2][_0x68af('0x5f')]:undefined)||0xc}];case _0x68af('0x69'):return[{'name':'attrMetric','value':_0x10af21[_0x68af('0x6a')]||(_0x10af21[_0x68af('0x5e')]&&_0x10af21[_0x68af('0x5e')][0x0]?_0x10af21[_0x68af('0x5e')][0x0]['value']:undefined)||_0x68af('0x6b')},{'name':'attrVoiceQueues','value':_0x10af21[_0x68af('0x6c')]||(_0x10af21[_0x68af('0x5e')]&&_0x10af21[_0x68af('0x5e')][0x1]?_0x10af21[_0x68af('0x5e')][0x1]['value']:undefined)||[]},{'name':_0x68af('0x68'),'value':_0x10af21[_0x68af('0x68')]||(_0x10af21[_0x68af('0x5e')]&&_0x10af21[_0x68af('0x5e')][0x2]?_0x10af21[_0x68af('0x5e')][0x2]['value']:undefined)||0x14},{'name':_0x68af('0x6d'),'value':_0x10af21[_0x68af('0x6d')]||(_0x10af21[_0x68af('0x5e')]&&_0x10af21[_0x68af('0x5e')][0x3]?_0x10af21['attrs'][0x3][_0x68af('0x5f')]:undefined)||_0x68af('0x6e')},{'name':_0x68af('0x6f'),'value':_0x10af21[_0x68af('0x6f')]||(_0x10af21[_0x68af('0x5e')]&&_0x10af21[_0x68af('0x5e')][0x4]?_0x10af21[_0x68af('0x5e')][0x4][_0x68af('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x10af21[_0x68af('0x70')]||(_0x10af21[_0x68af('0x5e')]&&_0x10af21['attrs'][0x5]?_0x10af21['attrs'][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x10af21[_0x68af('0x71')]||(_0x10af21[_0x68af('0x5e')]&&_0x10af21[_0x68af('0x5e')][0x6]?_0x10af21[_0x68af('0x5e')][0x6]['value']:undefined)||''},{'name':_0x68af('0x72'),'value':_0x10af21[_0x68af('0x72')]||(_0x10af21[_0x68af('0x5e')]&&_0x10af21[_0x68af('0x5e')][0x7]?_0x10af21[_0x68af('0x5e')][0x7]['value']:undefined)||''},{'name':_0x68af('0x73'),'value':_0x10af21['attrWhatsappAccounts']||(_0x10af21[_0x68af('0x5e')]&&_0x10af21[_0x68af('0x5e')][0x8]?_0x10af21[_0x68af('0x5e')][0x8][_0x68af('0x5f')]:undefined)||''},{'name':_0x68af('0x74'),'value':_0x10af21[_0x68af('0x74')]||(_0x10af21[_0x68af('0x5e')]&&_0x10af21[_0x68af('0x5e')][0x9]?_0x10af21[_0x68af('0x5e')][0x9][_0x68af('0x5f')]:undefined)||''}];case _0x68af('0x75'):case _0x68af('0x76'):return[{'name':_0x68af('0x77'),'value':_0x10af21['attrSerie1']||(_0x10af21[_0x68af('0x5e')]&&_0x10af21[_0x68af('0x5e')][0x0]?_0x10af21['attrs'][0x0]['value']:undefined)||_0x68af('0x6b')},{'name':'attrSerie2','value':_0x10af21[_0x68af('0x78')]||(_0x10af21['attrs']&&_0x10af21['attrs'][0x1]?_0x10af21[_0x68af('0x5e')][0x1][_0x68af('0x5f')]:undefined)||null},{'name':'attrSerie3','value':_0x10af21[_0x68af('0x79')]||(_0x10af21[_0x68af('0x5e')]&&_0x10af21[_0x68af('0x5e')][0x2]?_0x10af21[_0x68af('0x5e')][0x2][_0x68af('0x5f')]:undefined)||null},{'name':_0x68af('0x6c'),'value':_0x10af21[_0x68af('0x6c')]||(_0x10af21[_0x68af('0x5e')]&&_0x10af21['attrs'][0x3]?_0x10af21[_0x68af('0x5e')][0x3][_0x68af('0x5f')]:undefined)||[]},{'name':_0x68af('0x6d'),'value':_0x10af21['attrChannel']||(_0x10af21[_0x68af('0x5e')]&&_0x10af21['attrs'][0x4]?_0x10af21[_0x68af('0x5e')][0x4][_0x68af('0x5f')]:undefined)||_0x68af('0x6e')},{'name':_0x68af('0x6f'),'value':_0x10af21['attrEmailAccounts']||(_0x10af21[_0x68af('0x5e')]&&_0x10af21['attrs'][0x5]?_0x10af21[_0x68af('0x5e')][0x5][_0x68af('0x5f')]:undefined)||''},{'name':_0x68af('0x70'),'value':_0x10af21[_0x68af('0x70')]||(_0x10af21['attrs']&&_0x10af21[_0x68af('0x5e')][0x6]?_0x10af21[_0x68af('0x5e')][0x6]['value']:undefined)||''},{'name':_0x68af('0x71'),'value':_0x10af21['attrSmsAccounts']||(_0x10af21[_0x68af('0x5e')]&&_0x10af21[_0x68af('0x5e')][0x7]?_0x10af21[_0x68af('0x5e')][0x7][_0x68af('0x5f')]:undefined)||''},{'name':_0x68af('0x72'),'value':_0x10af21[_0x68af('0x72')]||(_0x10af21['attrs']&&_0x10af21[_0x68af('0x5e')][0x8]?_0x10af21['attrs'][0x8][_0x68af('0x5f')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x10af21['attrWhatsappAccounts']||(_0x10af21[_0x68af('0x5e')]&&_0x10af21['attrs'][0x9]?_0x10af21[_0x68af('0x5e')][0x9][_0x68af('0x5f')]:undefined)||''},{'name':_0x68af('0x74'),'value':_0x10af21[_0x68af('0x74')]||(_0x10af21[_0x68af('0x5e')]&&_0x10af21['attrs'][0xa]?_0x10af21[_0x68af('0x5e')][0xa]['value']:undefined)||''}];case _0x68af('0x7a'):return[{'name':_0x68af('0x7b'),'type':_0x10af21['reportType']||(_0x10af21['attrs']&&_0x10af21['attrs'][0x0]?_0x10af21[_0x68af('0x5e')][0x0][_0x68af('0x41')]:undefined)||null,'value':_0x10af21['attrReport']||(_0x10af21[_0x68af('0x5e')]&&_0x10af21['attrs'][0x0]?_0x10af21[_0x68af('0x5e')][0x0][_0x68af('0x5f')]:undefined)||null},{'name':_0x68af('0x7c'),'value':_0x10af21['attrRefresh']||(_0x10af21[_0x68af('0x5e')]&&_0x10af21[_0x68af('0x5e')][0x1]?_0x10af21[_0x68af('0x5e')][0x1][_0x68af('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x4a6ac2){logger[_0x68af('0x56')]('widgetAttributes:\x20%s',JSON[_0x68af('0x7d')](_0x4a6ac2));return[];}}exports[_0x68af('0x7e')]=function(_0x35d775,_0x57aacb,_0x5c9971){if(_0x35d775[_0x68af('0x4e')]['id']){delete _0x35d775[_0x68af('0x4e')]['id'];}return db[_0x68af('0x32')][_0x68af('0x53')]({'where':{'id':_0x35d775['params']['id']}})[_0x68af('0x2a')](handleEntityNotFound(_0x57aacb,null))[_0x68af('0x2a')](function(_0x4f7b98){if(_0x4f7b98){_0x35d775[_0x68af('0x4e')][_0x68af('0x7f')]=_0x4f7b98['id'];_0x35d775['body'][_0x68af('0x5e')]=widgetAttributes(_0x35d775[_0x68af('0x4e')]);return db[_0x68af('0x80')][_0x68af('0x4d')](_0x35d775[_0x68af('0x4e')]);}})[_0x68af('0x2a')](respondWithResult(_0x57aacb,null))['catch'](handleError(_0x57aacb,null));};exports[_0x68af('0x81')]=function(_0x5d8381,_0x320768,_0x3cdf2d){var _0x292a49={};var _0x573f09={};var _0x19aac5;var _0x575890;return db['Dashboard']['findOne']({'where':{'id':_0x5d8381['params']['id']}})[_0x68af('0x2a')](handleEntityNotFound(_0x320768,null))['then'](function(_0x275ef4){if(_0x275ef4){_0x19aac5=_0x275ef4;_0x573f09[_0x68af('0x37')]=_[_0x68af('0x4a')](db[_0x68af('0x80')][_0x68af('0x4b')]);_0x573f09[_0x68af('0x34')]=_['keys'](_0x5d8381[_0x68af('0x34')]);_0x573f09[_0x68af('0x35')]=_[_0x68af('0x36')](_0x573f09[_0x68af('0x37')],_0x573f09[_0x68af('0x34')]);_0x292a49[_0x68af('0x38')]=_[_0x68af('0x36')](_0x573f09[_0x68af('0x37')],qs[_0x68af('0x39')](_0x5d8381['query'][_0x68af('0x39')]));_0x292a49['attributes']=_0x292a49['attributes'][_0x68af('0x3a')]?_0x292a49[_0x68af('0x38')]:_0x573f09[_0x68af('0x37')];_0x292a49[_0x68af('0x82')]=qs[_0x68af('0x3d')](_0x5d8381[_0x68af('0x34')][_0x68af('0x3d')]);_0x292a49[_0x68af('0x3e')]=qs[_0x68af('0x35')](_[_0x68af('0x83')](_0x5d8381[_0x68af('0x34')],_0x573f09[_0x68af('0x35')]));if(_0x5d8381[_0x68af('0x34')][_0x68af('0x3f')]){_0x292a49[_0x68af('0x3e')]=_[_0x68af('0x40')](_0x292a49[_0x68af('0x3e')],{'$or':_[_0x68af('0x31')](_0x292a49[_0x68af('0x38')],function(_0x2a1030){var _0x4dd1f5={};_0x4dd1f5[_0x2a1030]={'$like':'%'+_0x5d8381[_0x68af('0x34')][_0x68af('0x3f')]+'%'};return _0x4dd1f5;})});}_0x292a49=_[_0x68af('0x40')]({},_0x292a49,_0x5d8381[_0x68af('0x43')]);return _0x19aac5[_0x68af('0x81')](_0x292a49);}})[_0x68af('0x2a')](function(_0xb8f688){if(_0xb8f688){_0x575890=_0xb8f688['length'];if(!_0x5d8381['query'][_0x68af('0x3b')](_0x68af('0x3c'))){_0x292a49['limit']=qs[_0x68af('0x23')](_0x5d8381[_0x68af('0x34')][_0x68af('0x23')]);_0x292a49[_0x68af('0x21')]=qs[_0x68af('0x21')](_0x5d8381['query'][_0x68af('0x21')]);}return _0x19aac5['getItems'](_0x292a49);}})[_0x68af('0x2a')](function(_0x39380d){if(_0x39380d){return _0x39380d?{'count':_0x575890,'rows':_0x39380d}:null;}})[_0x68af('0x2a')](respondWithResult(_0x320768,null))[_0x68af('0x47')](handleError(_0x320768,null));}; \ No newline at end of file +var _0x4ef8=['clock','attrHourFormat','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','nolimit','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','undefined','count','Content-Range','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','find','create','Dashboard','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','user','CustomDashboards','update','attrUrl','attrs','value','https://','custom','attrPath'];(function(_0x76d145,_0x334088){var _0x1b541b=function(_0x596ee1){while(--_0x596ee1){_0x76d145['push'](_0x76d145['shift']());}};_0x1b541b(++_0x334088);}(_0x4ef8,0x18a));var _0x84ef=function(_0x5d3bac,_0x2eb657){_0x5d3bac=_0x5d3bac-0x0;var _0x2c8242=_0x4ef8[_0x5d3bac];return _0x2c8242;};'use strict';var emlformat=require(_0x84ef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x84ef('0x1'));var jsonpatch=require(_0x84ef('0x2'));var rp=require('request-promise');var moment=require(_0x84ef('0x3'));var BPromise=require(_0x84ef('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x84ef('0x5'));var sox=require('sox');var csv=require(_0x84ef('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x84ef('0x7'));var _=require(_0x84ef('0x8'));var squel=require('squel');var crypto=require(_0x84ef('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x84ef('0xa'));var toCsv=require('to-csv');var querystring=require(_0x84ef('0xb'));var Papa=require(_0x84ef('0xc'));var Redis=require(_0x84ef('0xd'));var authService=require(_0x84ef('0xe'));var qs=require(_0x84ef('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84ef('0x10'));var logger=require(_0x84ef('0x11'))('api');var utils=require(_0x84ef('0x12'));var config=require(_0x84ef('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x84ef('0x14'))['db'];config[_0x84ef('0x15')]=_['defaults'](config[_0x84ef('0x15')],{'host':_0x84ef('0x16'),'port':0x18eb});var socket=require(_0x84ef('0x17'))(new Redis(config[_0x84ef('0x15')]));require(_0x84ef('0x18'))[_0x84ef('0x19')](socket);function respondWithStatusCode(_0x470387,_0x1b296d){_0x1b296d=_0x1b296d||0xcc;return function(_0x3689a7){if(_0x3689a7){return _0x470387['sendStatus'](_0x1b296d);}return _0x470387[_0x84ef('0x1a')](_0x1b296d)[_0x84ef('0x1b')]();};}function respondWithResult(_0xbee217,_0x44e126){_0x44e126=_0x44e126||0xc8;return function(_0x20afff){if(_0x20afff){return _0xbee217[_0x84ef('0x1a')](_0x44e126)[_0x84ef('0x1c')](_0x20afff);}};}function respondWithFilteredResult(_0x566b0b,_0x37db65){return function(_0x35942f){if(_0x35942f){var _0x252114=typeof _0x37db65[_0x84ef('0x1d')]===_0x84ef('0x1e')&&typeof _0x37db65['limit']===_0x84ef('0x1e');var _0x2112ca=_0x35942f[_0x84ef('0x1f')];var _0x191192=_0x252114?0x0:_0x37db65[_0x84ef('0x1d')];var _0x3f5ecc=_0x252114?_0x35942f['count']:_0x37db65['offset']+_0x37db65['limit'];var _0x20232f;if(_0x3f5ecc>=_0x2112ca){_0x3f5ecc=_0x2112ca;_0x20232f=0xc8;}else{_0x20232f=0xce;}_0x566b0b[_0x84ef('0x1a')](_0x20232f);return _0x566b0b['set'](_0x84ef('0x20'),_0x191192+'-'+_0x3f5ecc+'/'+_0x2112ca)[_0x84ef('0x1c')](_0x35942f);}return null;};}function patchUpdates(_0x169547){return function(_0xaff6c5){try{jsonpatch['apply'](_0xaff6c5,_0x169547,!![]);}catch(_0x5dc379){return BPromise[_0x84ef('0x21')](_0x5dc379);}return _0xaff6c5[_0x84ef('0x22')]();};}function saveUpdates(_0x351b25,_0x56de68){return function(_0x5acf04){if(_0x5acf04){return _0x5acf04['update'](_0x351b25)[_0x84ef('0x23')](function(_0x48b8ff){return _0x48b8ff;});}return null;};}function removeEntity(_0x2a580e,_0x2c54ec){return function(_0x4965d0){if(_0x4965d0){return _0x4965d0[_0x84ef('0x24')]()['then'](function(){var _0x5a3e2f=_0x4965d0[_0x84ef('0x25')]({'plain':!![]});var _0x17e3ed='CustomDashboards';return db[_0x84ef('0x26')]['destroy']({'where':{'type':_0x17e3ed,'resourceId':_0x5a3e2f['id']}})['then'](function(){return _0x4965d0;});})[_0x84ef('0x23')](function(){_0x2a580e[_0x84ef('0x1a')](0xcc)[_0x84ef('0x1b')]();});}};}function handleEntityNotFound(_0x228418,_0xbe7b39){return function(_0x26f7f4){if(!_0x26f7f4){_0x228418['sendStatus'](0x194);}return _0x26f7f4;};}function handleError(_0x17a847,_0x5d7f4c){_0x5d7f4c=_0x5d7f4c||0x1f4;return function(_0x25ef9c){logger[_0x84ef('0x27')](_0x25ef9c[_0x84ef('0x28')]);if(_0x25ef9c[_0x84ef('0x29')]){delete _0x25ef9c['name'];}_0x17a847[_0x84ef('0x1a')](_0x5d7f4c)['send'](_0x25ef9c);};}exports[_0x84ef('0x2a')]=function(_0x58dee7,_0x24ce5f){var _0x52060f={},_0x16701f={},_0x5a5960={'count':0x0,'rows':[]};var _0x352dac=_[_0x84ef('0x2b')](db['Dashboard'][_0x84ef('0x2c')],function(_0xb45098){return{'name':_0xb45098[_0x84ef('0x2d')],'type':_0xb45098[_0x84ef('0x2e')]['key']};});_0x16701f[_0x84ef('0x2f')]=_['map'](_0x352dac,_0x84ef('0x29'));_0x16701f['query']=_[_0x84ef('0x30')](_0x58dee7[_0x84ef('0x31')]);_0x16701f[_0x84ef('0x32')]=_[_0x84ef('0x33')](_0x16701f[_0x84ef('0x2f')],_0x16701f[_0x84ef('0x31')]);_0x52060f[_0x84ef('0x34')]=_['intersection'](_0x16701f[_0x84ef('0x2f')],qs[_0x84ef('0x35')](_0x58dee7[_0x84ef('0x31')][_0x84ef('0x35')]));_0x52060f[_0x84ef('0x34')]=_0x52060f['attributes'][_0x84ef('0x36')]?_0x52060f[_0x84ef('0x34')]:_0x16701f['model'];if(!_0x58dee7[_0x84ef('0x31')][_0x84ef('0x37')]('nolimit')){_0x52060f[_0x84ef('0x38')]=qs[_0x84ef('0x38')](_0x58dee7[_0x84ef('0x31')][_0x84ef('0x38')]);_0x52060f[_0x84ef('0x1d')]=qs[_0x84ef('0x1d')](_0x58dee7[_0x84ef('0x31')]['offset']);}_0x52060f[_0x84ef('0x39')]=qs[_0x84ef('0x3a')](_0x58dee7[_0x84ef('0x31')][_0x84ef('0x3a')]);_0x52060f[_0x84ef('0x3b')]=qs[_0x84ef('0x32')](_[_0x84ef('0x3c')](_0x58dee7[_0x84ef('0x31')],_0x16701f['filters']),_0x352dac);if(_0x58dee7[_0x84ef('0x31')][_0x84ef('0x3d')]){_0x52060f[_0x84ef('0x3b')]=_[_0x84ef('0x3e')](_0x52060f[_0x84ef('0x3b')],{'$or':_[_0x84ef('0x2b')](_0x352dac,function(_0x56c7e1){if(_0x56c7e1[_0x84ef('0x2e')]!==_0x84ef('0x3f')){var _0x109c35={};_0x109c35[_0x56c7e1['name']]={'$like':'%'+_0x58dee7[_0x84ef('0x31')][_0x84ef('0x3d')]+'%'};return _0x109c35;}})});}_0x52060f=_[_0x84ef('0x3e')]({},_0x52060f,_0x58dee7[_0x84ef('0x40')]);var _0x444cf6={'where':_0x52060f[_0x84ef('0x3b')]};return db['Dashboard']['count'](_0x444cf6)[_0x84ef('0x23')](function(_0x5a7561){_0x5a5960[_0x84ef('0x1f')]=_0x5a7561;if(_0x58dee7[_0x84ef('0x31')][_0x84ef('0x41')]){_0x52060f['include']=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x52060f);})['then'](function(_0x4d2d8d){_0x5a5960[_0x84ef('0x42')]=_0x4d2d8d;return _0x5a5960;})[_0x84ef('0x23')](respondWithFilteredResult(_0x24ce5f,_0x52060f))[_0x84ef('0x43')](handleError(_0x24ce5f,null));};exports[_0x84ef('0x44')]=function(_0x5cf36f,_0x436726){var _0x178351={'raw':![],'where':{'id':_0x5cf36f[_0x84ef('0x45')]['id']}},_0x2bd4f3={};_0x2bd4f3['model']=_['keys'](db['Dashboard'][_0x84ef('0x2c')]);_0x2bd4f3[_0x84ef('0x31')]=_[_0x84ef('0x30')](_0x5cf36f[_0x84ef('0x31')]);_0x2bd4f3['filters']=_[_0x84ef('0x33')](_0x2bd4f3[_0x84ef('0x2f')],_0x2bd4f3[_0x84ef('0x31')]);_0x178351[_0x84ef('0x34')]=_[_0x84ef('0x33')](_0x2bd4f3[_0x84ef('0x2f')],qs[_0x84ef('0x35')](_0x5cf36f[_0x84ef('0x31')][_0x84ef('0x35')]));_0x178351[_0x84ef('0x34')]=_0x178351[_0x84ef('0x34')]['length']?_0x178351[_0x84ef('0x34')]:_0x2bd4f3['model'];if(_0x5cf36f['query'][_0x84ef('0x41')]){_0x178351['include']=[{'all':!![]}];}_0x178351=_[_0x84ef('0x3e')]({},_0x178351,_0x5cf36f[_0x84ef('0x40')]);return db['Dashboard'][_0x84ef('0x46')](_0x178351)['then'](handleEntityNotFound(_0x436726,null))[_0x84ef('0x23')](respondWithResult(_0x436726,null))[_0x84ef('0x43')](handleError(_0x436726,null));};exports[_0x84ef('0x47')]=function(_0x2ef82f,_0x4ac6eb){return db[_0x84ef('0x48')][_0x84ef('0x47')](_0x2ef82f[_0x84ef('0x49')],{})[_0x84ef('0x23')](function(_0x2239a4){var _0x134ae8=_0x2ef82f['user'][_0x84ef('0x25')]({'plain':!![]});if(!_0x134ae8)throw new Error(_0x84ef('0x4a'));if(_0x134ae8[_0x84ef('0x4b')]==='user'){var _0x4e7459=_0x2239a4[_0x84ef('0x25')]({'plain':!![]});var _0x3596dc='CustomDashboards';return db[_0x84ef('0x4c')]['find']({'where':{'name':_0x3596dc,'userProfileId':_0x134ae8[_0x84ef('0x4d')]},'raw':!![]})['then'](function(_0x5aa457){if(_0x5aa457&&_0x5aa457[_0x84ef('0x4e')]===0x0){return db['UserProfileResource'][_0x84ef('0x47')]({'name':_0x4e7459[_0x84ef('0x29')],'resourceId':_0x4e7459['id'],'type':_0x5aa457[_0x84ef('0x29')],'sectionId':_0x5aa457['id']},{})[_0x84ef('0x23')](function(){return _0x2239a4;});}else{return _0x2239a4;}})[_0x84ef('0x43')](function(_0x15dddb){logger[_0x84ef('0x27')](_0x84ef('0x4f'),_0x15dddb);throw _0x15dddb;});}return _0x2239a4;})[_0x84ef('0x23')](respondWithResult(_0x4ac6eb,0xc9))[_0x84ef('0x43')](handleError(_0x4ac6eb,null));};exports[_0x84ef('0x50')]=function(_0x1cefd4,_0x52d7ae){var _0x18c99d={'where':{'id':_0x1cefd4[_0x84ef('0x45')]['id']}},_0x14f325={};_0x14f325['model']=_[_0x84ef('0x30')](db[_0x84ef('0x48')][_0x84ef('0x2c')]);_0x18c99d[_0x84ef('0x34')]=_[_0x84ef('0x33')](_0x14f325[_0x84ef('0x2f')],qs['fields'](_0x1cefd4[_0x84ef('0x31')][_0x84ef('0x35')]));_0x18c99d[_0x84ef('0x34')]=_0x18c99d[_0x84ef('0x34')][_0x84ef('0x36')]?_0x18c99d['attributes']:_0x14f325['model'];if(_0x1cefd4['query'][_0x84ef('0x41')]){_0x18c99d[_0x84ef('0x51')]=[{'all':!![]}];}_0x18c99d=_[_0x84ef('0x3e')]({},_0x18c99d,_0x1cefd4[_0x84ef('0x40')]);return db[_0x84ef('0x48')][_0x84ef('0x46')](_0x18c99d)[_0x84ef('0x23')](handleEntityNotFound(_0x52d7ae,null))[_0x84ef('0x23')](function(_0x58a7b9){if(_0x58a7b9){var _0x51df03=_0x58a7b9['get']({'plain':!![]});_0x51df03=qs[_0x84ef('0x52')](_0x51df03,['id',_0x84ef('0x53'),_0x84ef('0x54')]);_0x1cefd4['body']=_['omit'](_0x1cefd4[_0x84ef('0x49')],['id','createdAt','updatedAt']);return db[_0x84ef('0x48')][_0x84ef('0x47')](_[_0x84ef('0x3e')](_0x51df03,_0x1cefd4[_0x84ef('0x49')]),{'include':_0x1cefd4['query'][_0x84ef('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0xc05426){var _0x960fc8=_0x1cefd4[_0x84ef('0x55')][_0x84ef('0x25')]({'plain':!![]});if(!_0x960fc8)throw new Error(_0x84ef('0x4a'));if(_0x960fc8['role']===_0x84ef('0x55')){var _0x512750=_0xc05426['get']({'plain':!![]});var _0x24b58c=_0x84ef('0x56');return db[_0x84ef('0x4c')][_0x84ef('0x46')]({'where':{'name':_0x24b58c,'userProfileId':_0x960fc8['userProfileId']},'raw':!![]})[_0x84ef('0x23')](function(_0x523d95){if(_0x523d95&&_0x523d95[_0x84ef('0x4e')]===0x0){return db[_0x84ef('0x26')][_0x84ef('0x47')]({'name':_0x512750[_0x84ef('0x29')],'resourceId':_0x512750['id'],'type':_0x523d95[_0x84ef('0x29')],'sectionId':_0x523d95['id']},{})[_0x84ef('0x23')](function(){return _0xc05426;});}else{return _0xc05426;}})[_0x84ef('0x43')](function(_0x4627c0){logger[_0x84ef('0x27')](_0x84ef('0x4f'),_0x4627c0);throw _0x4627c0;});}return _0xc05426;});}})['then'](respondWithResult(_0x52d7ae,0xc9))[_0x84ef('0x43')](handleError(_0x52d7ae,null));};exports[_0x84ef('0x57')]=function(_0x15ddfb,_0x38ad98){if(_0x15ddfb['body']['id']){delete _0x15ddfb[_0x84ef('0x49')]['id'];}return db[_0x84ef('0x48')][_0x84ef('0x46')]({'where':{'id':_0x15ddfb[_0x84ef('0x45')]['id']}})['then'](handleEntityNotFound(_0x38ad98,null))['then'](saveUpdates(_0x15ddfb['body'],null))['then'](respondWithResult(_0x38ad98,null))['catch'](handleError(_0x38ad98,null));};exports[_0x84ef('0x24')]=function(_0x29ae4f,_0x403e51){return db['Dashboard']['find']({'where':{'id':_0x29ae4f[_0x84ef('0x45')]['id']}})[_0x84ef('0x23')](handleEntityNotFound(_0x403e51,null))[_0x84ef('0x23')](removeEntity(_0x403e51,null))['catch'](handleError(_0x403e51,null));};function widgetAttributes(_0x2a7019){try{switch(_0x2a7019[_0x84ef('0x2e')]){case'iframe':return[{'name':_0x84ef('0x58'),'value':_0x2a7019['attrUrl']||(_0x2a7019['attrs']&&_0x2a7019['attrs'][0x0]?_0x2a7019[_0x84ef('0x59')][0x0][_0x84ef('0x5a')]:undefined)||_0x84ef('0x5b')}];case _0x84ef('0x5c'):return[{'name':_0x84ef('0x5d'),'value':_0x2a7019['attrPath']||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x0]?_0x2a7019[_0x84ef('0x59')][0x0][_0x84ef('0x5a')]:undefined)||''}];case _0x84ef('0x5e'):return[{'name':'attrHourFormat','value':_0x2a7019[_0x84ef('0x5f')]||(_0x2a7019['attrs']&&_0x2a7019['attrs'][0x0]?_0x2a7019[_0x84ef('0x59')][0x0][_0x84ef('0x5a')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x2a7019['attrTimezone']||(_0x2a7019['attrs']&&_0x2a7019['attrs'][0x1]?_0x2a7019['attrs'][0x1][_0x84ef('0x5a')]:undefined)||'0.00'},{'name':_0x84ef('0x60'),'value':_0x2a7019['attrFontSize']||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x2]?_0x2a7019[_0x84ef('0x59')][0x2][_0x84ef('0x5a')]:undefined)||0xc}];case _0x84ef('0x61'):return[{'name':'attrMetric','value':_0x2a7019[_0x84ef('0x62')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x0]?_0x2a7019[_0x84ef('0x59')][0x0][_0x84ef('0x5a')]:undefined)||_0x84ef('0x63')},{'name':'attrVoiceQueues','value':_0x2a7019[_0x84ef('0x64')]||(_0x2a7019['attrs']&&_0x2a7019[_0x84ef('0x59')][0x1]?_0x2a7019[_0x84ef('0x59')][0x1][_0x84ef('0x5a')]:undefined)||[]},{'name':_0x84ef('0x60'),'value':_0x2a7019[_0x84ef('0x60')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x2]?_0x2a7019[_0x84ef('0x59')][0x2][_0x84ef('0x5a')]:undefined)||0x14},{'name':_0x84ef('0x65'),'value':_0x2a7019[_0x84ef('0x65')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x3]?_0x2a7019['attrs'][0x3][_0x84ef('0x5a')]:undefined)||_0x84ef('0x66')},{'name':_0x84ef('0x67'),'value':_0x2a7019[_0x84ef('0x67')]||(_0x2a7019['attrs']&&_0x2a7019[_0x84ef('0x59')][0x4]?_0x2a7019[_0x84ef('0x59')][0x4][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x68'),'value':_0x2a7019[_0x84ef('0x68')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x5]?_0x2a7019[_0x84ef('0x59')][0x5][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x69'),'value':_0x2a7019[_0x84ef('0x69')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x6]?_0x2a7019[_0x84ef('0x59')][0x6][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x6a'),'value':_0x2a7019[_0x84ef('0x6a')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x7]?_0x2a7019[_0x84ef('0x59')][0x7][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x6b'),'value':_0x2a7019[_0x84ef('0x6b')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019['attrs'][0x8]?_0x2a7019[_0x84ef('0x59')][0x8]['value']:undefined)||''},{'name':_0x84ef('0x6c'),'value':_0x2a7019[_0x84ef('0x6c')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x9]?_0x2a7019[_0x84ef('0x59')][0x9][_0x84ef('0x5a')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x84ef('0x6d'),'value':_0x2a7019['attrSerie1']||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x0]?_0x2a7019[_0x84ef('0x59')][0x0][_0x84ef('0x5a')]:undefined)||'total'},{'name':_0x84ef('0x6e'),'value':_0x2a7019[_0x84ef('0x6e')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019['attrs'][0x1]?_0x2a7019[_0x84ef('0x59')][0x1][_0x84ef('0x5a')]:undefined)||null},{'name':'attrSerie3','value':_0x2a7019[_0x84ef('0x6f')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x2]?_0x2a7019['attrs'][0x2][_0x84ef('0x5a')]:undefined)||null},{'name':_0x84ef('0x64'),'value':_0x2a7019[_0x84ef('0x64')]||(_0x2a7019['attrs']&&_0x2a7019[_0x84ef('0x59')][0x3]?_0x2a7019[_0x84ef('0x59')][0x3][_0x84ef('0x5a')]:undefined)||[]},{'name':_0x84ef('0x65'),'value':_0x2a7019[_0x84ef('0x65')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x4]?_0x2a7019[_0x84ef('0x59')][0x4][_0x84ef('0x5a')]:undefined)||_0x84ef('0x66')},{'name':_0x84ef('0x67'),'value':_0x2a7019[_0x84ef('0x67')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019['attrs'][0x5]?_0x2a7019['attrs'][0x5][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x68'),'value':_0x2a7019[_0x84ef('0x68')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x6]?_0x2a7019[_0x84ef('0x59')][0x6][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x69'),'value':_0x2a7019[_0x84ef('0x69')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x7]?_0x2a7019[_0x84ef('0x59')][0x7][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x6a'),'value':_0x2a7019['attrOpenchannelAccounts']||(_0x2a7019['attrs']&&_0x2a7019[_0x84ef('0x59')][0x8]?_0x2a7019[_0x84ef('0x59')][0x8][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x6b'),'value':_0x2a7019[_0x84ef('0x6b')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x9]?_0x2a7019[_0x84ef('0x59')][0x9][_0x84ef('0x5a')]:undefined)||''},{'name':_0x84ef('0x6c'),'value':_0x2a7019['attrChatWebsites']||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0xa]?_0x2a7019[_0x84ef('0x59')][0xa]['value']:undefined)||''}];case _0x84ef('0x70'):return[{'name':_0x84ef('0x71'),'type':_0x2a7019['reportType']||(_0x2a7019['attrs']&&_0x2a7019[_0x84ef('0x59')][0x0]?_0x2a7019['attrs'][0x0][_0x84ef('0x2e')]:undefined)||null,'value':_0x2a7019[_0x84ef('0x71')]||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x0]?_0x2a7019[_0x84ef('0x59')][0x0][_0x84ef('0x5a')]:undefined)||null},{'name':_0x84ef('0x72'),'value':_0x2a7019['attrRefresh']||(_0x2a7019[_0x84ef('0x59')]&&_0x2a7019[_0x84ef('0x59')][0x1]?_0x2a7019[_0x84ef('0x59')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x30b54d){logger[_0x84ef('0x27')]('widgetAttributes:\x20%s',JSON[_0x84ef('0x73')](_0x30b54d));return[];}}exports[_0x84ef('0x74')]=function(_0x596fc2,_0x314bbf,_0x567d45){if(_0x596fc2[_0x84ef('0x49')]['id']){delete _0x596fc2[_0x84ef('0x49')]['id'];}return db[_0x84ef('0x48')][_0x84ef('0x46')]({'where':{'id':_0x596fc2['params']['id']}})['then'](handleEntityNotFound(_0x314bbf,null))['then'](function(_0x26d54e){if(_0x26d54e){_0x596fc2[_0x84ef('0x49')][_0x84ef('0x75')]=_0x26d54e['id'];_0x596fc2[_0x84ef('0x49')][_0x84ef('0x59')]=widgetAttributes(_0x596fc2[_0x84ef('0x49')]);return db[_0x84ef('0x76')][_0x84ef('0x47')](_0x596fc2[_0x84ef('0x49')]);}})[_0x84ef('0x23')](respondWithResult(_0x314bbf,null))[_0x84ef('0x43')](handleError(_0x314bbf,null));};exports[_0x84ef('0x77')]=function(_0x1c33f1,_0x33880c,_0x264282){var _0x32842f={};var _0x1a0a82={};var _0x2f008a;var _0x23e7cf;return db[_0x84ef('0x48')][_0x84ef('0x78')]({'where':{'id':_0x1c33f1[_0x84ef('0x45')]['id']}})['then'](handleEntityNotFound(_0x33880c,null))['then'](function(_0x1af373){if(_0x1af373){_0x2f008a=_0x1af373;_0x1a0a82['model']=_[_0x84ef('0x30')](db[_0x84ef('0x76')][_0x84ef('0x2c')]);_0x1a0a82[_0x84ef('0x31')]=_[_0x84ef('0x30')](_0x1c33f1[_0x84ef('0x31')]);_0x1a0a82[_0x84ef('0x32')]=_['intersection'](_0x1a0a82[_0x84ef('0x2f')],_0x1a0a82[_0x84ef('0x31')]);_0x32842f[_0x84ef('0x34')]=_[_0x84ef('0x33')](_0x1a0a82['model'],qs[_0x84ef('0x35')](_0x1c33f1[_0x84ef('0x31')][_0x84ef('0x35')]));_0x32842f[_0x84ef('0x34')]=_0x32842f[_0x84ef('0x34')][_0x84ef('0x36')]?_0x32842f[_0x84ef('0x34')]:_0x1a0a82[_0x84ef('0x2f')];_0x32842f[_0x84ef('0x39')]=qs[_0x84ef('0x3a')](_0x1c33f1[_0x84ef('0x31')][_0x84ef('0x3a')]);_0x32842f[_0x84ef('0x3b')]=qs[_0x84ef('0x32')](_[_0x84ef('0x3c')](_0x1c33f1[_0x84ef('0x31')],_0x1a0a82[_0x84ef('0x32')]));if(_0x1c33f1[_0x84ef('0x31')][_0x84ef('0x3d')]){_0x32842f[_0x84ef('0x3b')]=_[_0x84ef('0x3e')](_0x32842f['where'],{'$or':_[_0x84ef('0x2b')](_0x32842f[_0x84ef('0x34')],function(_0x49640){var _0x334bf1={};_0x334bf1[_0x49640]={'$like':'%'+_0x1c33f1[_0x84ef('0x31')]['filter']+'%'};return _0x334bf1;})});}_0x32842f=_[_0x84ef('0x3e')]({},_0x32842f,_0x1c33f1[_0x84ef('0x40')]);return _0x2f008a[_0x84ef('0x77')](_0x32842f);}})[_0x84ef('0x23')](function(_0x1480b2){if(_0x1480b2){_0x23e7cf=_0x1480b2[_0x84ef('0x36')];if(!_0x1c33f1[_0x84ef('0x31')][_0x84ef('0x37')](_0x84ef('0x79'))){_0x32842f[_0x84ef('0x38')]=qs[_0x84ef('0x38')](_0x1c33f1['query'][_0x84ef('0x38')]);_0x32842f[_0x84ef('0x1d')]=qs[_0x84ef('0x1d')](_0x1c33f1['query'][_0x84ef('0x1d')]);}return _0x2f008a[_0x84ef('0x77')](_0x32842f);}})[_0x84ef('0x23')](function(_0x28d678){if(_0x28d678){return _0x28d678?{'count':_0x23e7cf,'rows':_0x28d678}:null;}})['then'](respondWithResult(_0x33880c,null))[_0x84ef('0x43')](handleError(_0x33880c,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 080b688..74c2128 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 _0xa71f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Dashboard'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xa71f,0x166));var _0xfa71=function(_0x588eed,_0x255edb){_0x588eed=_0x588eed-0x0;var _0x54bb9e=_0xa71f[_0x588eed];return _0x54bb9e;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xfa71('0x0'))['db'][_0xfa71('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xfa71('0x2')](0x0);var events={'afterCreate':_0xfa71('0x3'),'afterUpdate':_0xfa71('0x4'),'afterDestroy':_0xfa71('0x5')};function emitEvent(_0x10995a){return function(_0x437c35,_0x183b4d,_0x256ae9){DashboardEvents[_0xfa71('0x6')](_0x10995a+':'+_0x437c35['id'],_0x437c35);DashboardEvents['emit'](_0x10995a,_0x437c35);_0x256ae9(null);};}for(var e in events){if(events[_0xfa71('0x7')](e)){var event=events[e];Dashboard[_0xfa71('0x8')](e,emitEvent(event));}}module[_0xfa71('0x9')]=DashboardEvents; \ No newline at end of file +var _0xce2f=['../../mysqldb','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xce2f,0x1ef));var _0xfce2=function(_0x8c5648,_0x6a34b){_0x8c5648=_0x8c5648-0x0;var _0x19a4d6=_0xce2f[_0x8c5648];return _0x19a4d6;};'use strict';var EventEmitter=require(_0xfce2('0x0'));var Dashboard=require(_0xfce2('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xfce2('0x2')](0x0);var events={'afterCreate':_0xfce2('0x3'),'afterUpdate':_0xfce2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4170fc){return function(_0x8e48f1,_0x5a6aac,_0x124616){DashboardEvents[_0xfce2('0x5')](_0x4170fc+':'+_0x8e48f1['id'],_0x8e48f1);DashboardEvents[_0xfce2('0x5')](_0x4170fc,_0x8e48f1);_0x124616(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xfce2('0x6')](e,emitEvent(event));}}module[_0xfce2('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index cdd2cb4..f41a923 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 _0xbdee=['rimraf','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','../../config/logger','api','path'];(function(_0x31de6d,_0x183466){var _0x310e0b=function(_0x2c1d7e){while(--_0x2c1d7e){_0x31de6d['push'](_0x31de6d['shift']());}};_0x310e0b(++_0x183466);}(_0xbdee,0xc4));var _0xebde=function(_0xe57550,_0x2a34d9){_0xe57550=_0xe57550-0x0;var _0xb9a5f4=_0xbdee[_0xe57550];return _0xb9a5f4;};'use strict';var _=require(_0xebde('0x0'));var util=require('util');var logger=require(_0xebde('0x1'))(_0xebde('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xebde('0x3'));var rimraf=require(_0xebde('0x4'));var config=require('../../config/environment');var attributes=require(_0xebde('0x5'));module[_0xebde('0x6')]=function(_0x238aae,_0x3beec5){return _0x238aae[_0xebde('0x7')](_0xebde('0x8'),attributes,{'tableName':_0xebde('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9795=['../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','../../config/logger','moment','bluebird','path'];(function(_0x5864c6,_0x35552f){var _0x393ade=function(_0x117da7){while(--_0x117da7){_0x5864c6['push'](_0x5864c6['shift']());}};_0x393ade(++_0x35552f);}(_0x9795,0x92));var _0x5979=function(_0x3f7f82,_0x46ad7f){_0x3f7f82=_0x3f7f82-0x0;var _0x3ab8b6=_0x9795[_0x3f7f82];return _0x3ab8b6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5979('0x0'))('api');var moment=require(_0x5979('0x1'));var BPromise=require(_0x5979('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5979('0x3'));var rimraf=require('rimraf');var config=require(_0x5979('0x4'));var attributes=require(_0x5979('0x5'));module[_0x5979('0x6')]=function(_0x25da2a,_0x37acba){return _0x25da2a[_0x5979('0x7')](_0x5979('0x8'),attributes,{'tableName':_0x5979('0x9'),'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 6771a42..92be784 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 _0xbbea=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xbbea,0xda));var _0xabbe=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xbbea[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xabbe('0x0'));var util=require(_0xabbe('0x1'));var moment=require(_0xabbe('0x2'));var BPromise=require(_0xabbe('0x3'));var rs=require(_0xabbe('0x4'));var fs=require('fs');var Redis=require(_0xabbe('0x5'));var db=require(_0xabbe('0x6'))['db'];var utils=require(_0xabbe('0x7'));var logger=require(_0xabbe('0x8'))(_0xabbe('0x9'));var config=require(_0xabbe('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xabbe('0xb')]({'port':0x232a});config[_0xabbe('0xc')]=_[_0xabbe('0xd')](config[_0xabbe('0xc')],{'host':_0xabbe('0xe'),'port':0x18eb});var socket=require(_0xabbe('0xf'))(new Redis(config['redis']));require(_0xabbe('0x10'))[_0xabbe('0x11')](socket);function respondWithRpcPromise(_0x34fd4b,_0x512e7d,_0x228300){return new BPromise(function(_0x6b728c,_0x1002f6){return client[_0xabbe('0x12')](_0x34fd4b,_0x228300)[_0xabbe('0x13')](function(_0x413247){logger[_0xabbe('0x14')](_0xabbe('0x15'),_0x512e7d,_0xabbe('0x16'));logger[_0xabbe('0x17')](_0xabbe('0x18'),_0x512e7d,_0xabbe('0x16'),JSON['stringify'](_0x413247));if(_0x413247['error']){if(_0x413247['error']['code']===0x1f4){logger[_0xabbe('0x19')](_0xabbe('0x15'),_0x512e7d,_0x413247['error'][_0xabbe('0x1a')]);return _0x1002f6(_0x413247[_0xabbe('0x19')][_0xabbe('0x1a')]);}logger[_0xabbe('0x19')](_0xabbe('0x15'),_0x512e7d,_0x413247[_0xabbe('0x19')][_0xabbe('0x1a')]);return _0x6b728c(_0x413247[_0xabbe('0x19')][_0xabbe('0x1a')]);}else{logger[_0xabbe('0x14')]('Dashboard,\x20%s,\x20%s',_0x512e7d,_0xabbe('0x16'));_0x6b728c(_0x413247['result']['message']);}})[_0xabbe('0x1b')](function(_0x3f1c12){logger[_0xabbe('0x19')](_0xabbe('0x15'),_0x512e7d,_0x3f1c12);_0x1002f6(_0x3f1c12);});});} \ No newline at end of file +var _0x2cbe=['redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Dashboard,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','client','http'];(function(_0x7cb073,_0x3fcc51){var _0x428a5d=function(_0x6f5779){while(--_0x6f5779){_0x7cb073['push'](_0x7cb073['shift']());}};_0x428a5d(++_0x3fcc51);}(_0x2cbe,0xf5));var _0xe2cb=function(_0x1075b8,_0xd606e2){_0x1075b8=_0x1075b8-0x0;var _0x5d047f=_0x2cbe[_0x1075b8];return _0x5d047f;};'use strict';var _=require(_0xe2cb('0x0'));var util=require(_0xe2cb('0x1'));var moment=require(_0xe2cb('0x2'));var BPromise=require(_0xe2cb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe2cb('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe2cb('0x6')][_0xe2cb('0x7')]({'port':0x232a});config[_0xe2cb('0x8')]=_[_0xe2cb('0x9')](config[_0xe2cb('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xe2cb('0xa'))(new Redis(config[_0xe2cb('0x8')]));require(_0xe2cb('0xb'))[_0xe2cb('0xc')](socket);function respondWithRpcPromise(_0x30d116,_0x2829e5,_0x3ebd53){return new BPromise(function(_0x114989,_0x2877e3){return client[_0xe2cb('0xd')](_0x30d116,_0x3ebd53)[_0xe2cb('0xe')](function(_0x125897){logger[_0xe2cb('0xf')]('Dashboard,\x20%s,\x20%s',_0x2829e5,'request\x20sent');logger['debug'](_0xe2cb('0x10'),_0x2829e5,_0xe2cb('0x11'),JSON[_0xe2cb('0x12')](_0x125897));if(_0x125897[_0xe2cb('0x13')]){if(_0x125897[_0xe2cb('0x13')]['code']===0x1f4){logger[_0xe2cb('0x13')](_0xe2cb('0x14'),_0x2829e5,_0x125897[_0xe2cb('0x13')][_0xe2cb('0x15')]);return _0x2877e3(_0x125897[_0xe2cb('0x13')]['message']);}logger[_0xe2cb('0x13')]('Dashboard,\x20%s,\x20%s',_0x2829e5,_0x125897[_0xe2cb('0x13')][_0xe2cb('0x15')]);return _0x114989(_0x125897[_0xe2cb('0x13')]['message']);}else{logger['info'](_0xe2cb('0x14'),_0x2829e5,'request\x20sent');_0x114989(_0x125897['result'][_0xe2cb('0x15')]);}})[_0xe2cb('0x16')](function(_0x5c34a6){logger[_0xe2cb('0x13')](_0xe2cb('0x14'),_0x2829e5,_0x5c34a6);_0x2877e3(_0x5c34a6);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index bf7a6f6..de4d6ba 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 _0x20f0=['save','update','emit','removeListener','length','dashboard:','./dashboard.events'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x20f0,0x92));var _0x020f=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x20f0[_0x81dcac];return _0xc7803b;};'use strict';var DashboardEvents=require(_0x020f('0x0'));var events=[_0x020f('0x1'),'remove',_0x020f('0x2')];function createListener(_0xebe7ed,_0x27c67c){return function(_0x549e30){_0x27c67c[_0x020f('0x3')](_0xebe7ed,_0x549e30);};}function removeListener(_0x4d04b3,_0x55f0a3){return function(){DashboardEvents[_0x020f('0x4')](_0x4d04b3,_0x55f0a3);};}exports['register']=function(_0x114946){for(var _0x135cf3=0x0,_0x217352=events[_0x020f('0x5')];_0x135cf3<_0x217352;_0x135cf3++){var _0x91687b=events[_0x135cf3];var _0x37d4c9=createListener(_0x020f('0x6')+_0x91687b,_0x114946);DashboardEvents['on'](_0x91687b,_0x37d4c9);}}; \ No newline at end of file +var _0x9b5f=['update','emit','register','length','dashboard:','./dashboard.events','save'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x9b5f,0x163));var _0xf9b5=function(_0x414f45,_0x1ee7d3){_0x414f45=_0x414f45-0x0;var _0x3bc907=_0x9b5f[_0x414f45];return _0x3bc907;};'use strict';var DashboardEvents=require(_0xf9b5('0x0'));var events=[_0xf9b5('0x1'),'remove',_0xf9b5('0x2')];function createListener(_0x2ded06,_0x5da0d4){return function(_0x2399b5){_0x5da0d4[_0xf9b5('0x3')](_0x2ded06,_0x2399b5);};}function removeListener(_0x428bca,_0x54fa7d){return function(){DashboardEvents['removeListener'](_0x428bca,_0x54fa7d);};}exports[_0xf9b5('0x4')]=function(_0x3e9abe){for(var _0x56a38a=0x0,_0x5dc49b=events[_0xf9b5('0x5')];_0x56a38a<_0x5dc49b;_0x56a38a++){var _0x8ec2a6=events[_0x56a38a];var _0x3a8859=createListener(_0xf9b5('0x6')+_0x8ec2a6,_0x3e9abe);DashboardEvents['on'](_0x8ec2a6,_0x3a8859);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 97dc2e8..92f8394 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 _0x8f14=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8f14,0x120));var _0x48f1=function(_0x35f393,_0x2720cb){_0x35f393=_0x35f393-0x0;var _0x4c05b1=_0x8f14[_0x35f393];return _0x4c05b1;};'use strict';var multer=require(_0x48f1('0x0'));var util=require('util');var path=require(_0x48f1('0x1'));var timeout=require(_0x48f1('0x2'));var express=require(_0x48f1('0x3'));var router=express[_0x48f1('0x4')]();var fs_extra=require(_0x48f1('0x5'));var auth=require(_0x48f1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x48f1('0x7'));var controller=require(_0x48f1('0x8'));router[_0x48f1('0x9')]('/',auth[_0x48f1('0xa')](),controller[_0x48f1('0xb')]);router[_0x48f1('0x9')](_0x48f1('0xc'),auth[_0x48f1('0xa')](),controller[_0x48f1('0xd')]);router[_0x48f1('0x9')]('/:id/items',auth[_0x48f1('0xa')](),controller[_0x48f1('0xe')]);router[_0x48f1('0xf')]('/',auth[_0x48f1('0xa')](),controller[_0x48f1('0x10')]);router[_0x48f1('0xf')](_0x48f1('0x11'),auth['isAuthenticated'](),controller['clone']);router['post']('/:id/items',auth['isAuthenticated'](),controller[_0x48f1('0x12')]);router[_0x48f1('0x13')](_0x48f1('0xc'),auth[_0x48f1('0xa')](),controller[_0x48f1('0x14')]);router[_0x48f1('0x15')](_0x48f1('0xc'),auth[_0x48f1('0xa')](),controller[_0x48f1('0x16')]);module[_0x48f1('0x17')]=router; \ No newline at end of file +var _0x8124=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','update','destroy'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x8124,0x1b1));var _0x4812=function(_0x1ba691,_0x59087e){_0x1ba691=_0x1ba691-0x0;var _0xa6091c=_0x8124[_0x1ba691];return _0xa6091c;};'use strict';var multer=require(_0x4812('0x0'));var util=require(_0x4812('0x1'));var path=require(_0x4812('0x2'));var timeout=require(_0x4812('0x3'));var express=require(_0x4812('0x4'));var router=express[_0x4812('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4812('0x6'));var interaction=require(_0x4812('0x7'));var config=require(_0x4812('0x8'));var controller=require(_0x4812('0x9'));router[_0x4812('0xa')]('/',auth[_0x4812('0xb')](),controller[_0x4812('0xc')]);router[_0x4812('0xa')](_0x4812('0xd'),auth[_0x4812('0xb')](),controller[_0x4812('0xe')]);router[_0x4812('0xa')](_0x4812('0xf'),auth[_0x4812('0xb')](),controller[_0x4812('0x10')]);router[_0x4812('0x11')]('/',auth[_0x4812('0xb')](),controller[_0x4812('0x12')]);router[_0x4812('0x11')](_0x4812('0x13'),auth[_0x4812('0xb')](),controller[_0x4812('0x14')]);router[_0x4812('0x11')](_0x4812('0xf'),auth[_0x4812('0xb')](),controller['addItem']);router['put'](_0x4812('0xd'),auth['isAuthenticated'](),controller[_0x4812('0x15')]);router['delete']('/:id',auth[_0x4812('0xb')](),controller[_0x4812('0x16')]);module[_0x4812('0x17')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 04bf8a7..526b26a 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 _0x5fab=['STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','exports'];(function(_0x23d4b9,_0x29e096){var _0x4d444e=function(_0x25473e){while(--_0x25473e){_0x23d4b9['push'](_0x23d4b9['shift']());}};_0x4d444e(++_0x29e096);}(_0x5fab,0x177));var _0xb5fa=function(_0x47d4df,_0x437fa4){_0x47d4df=_0x47d4df-0x0;var _0x5e0ec7=_0x5fab[_0x47d4df];return _0x5e0ec7;};'use strict';var Sequelize=require(_0xb5fa('0x0'));var squel=require(_0xb5fa('0x1'));var _=require('lodash');module[_0xb5fa('0x2')]={'title':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb5fa('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb5fa('0x4')](_0xb5fa('0x5')),'get':function(){try{return JSON[_0xb5fa('0x6')](this[_0xb5fa('0x7')](_0xb5fa('0x8')));}catch(_0x10361d){return[];}},'set':function(_0x44df89){try{this['setDataValue']('attrs',JSON[_0xb5fa('0x9')](_0x44df89));}catch(_0x1aec3e){this[_0xb5fa('0xa')]('attrs',JSON[_0xb5fa('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb5fa('0x3')]},'titleFontSize':{'type':Sequelize[_0xb5fa('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0xd8fb=['exports','long','parse','attrs','setDataValue','stringify','INTEGER','#ffffff','STRING','sequelize','squel','lodash'];(function(_0x5e738a,_0x2b0ab4){var _0x27d917=function(_0x35ffb5){while(--_0x35ffb5){_0x5e738a['push'](_0x5e738a['shift']());}};_0x27d917(++_0x2b0ab4);}(_0xd8fb,0x99));var _0xbd8f=function(_0x1d0cf6,_0x27b01f){_0x1d0cf6=_0x1d0cf6-0x0;var _0x181fb1=_0xd8fb[_0x1d0cf6];return _0x181fb1;};'use strict';var Sequelize=require(_0xbd8f('0x0'));var squel=require(_0xbd8f('0x1'));var _=require(_0xbd8f('0x2'));module[_0xbd8f('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xbd8f('0x4')),'get':function(){try{return JSON[_0xbd8f('0x5')](this['getDataValue'](_0xbd8f('0x6')));}catch(_0x2343bf){return[];}},'set':function(_0x5543b2){try{this[_0xbd8f('0x7')]('attrs',JSON[_0xbd8f('0x8')](_0x5543b2));}catch(_0x578499){this[_0xbd8f('0x7')](_0xbd8f('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xbd8f('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xbd8f('0x9')]},'col':{'type':Sequelize[_0xbd8f('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbd8f('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xbd8f('0xb')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xbd8f('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 675b1a7..f9204b5 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 _0x9ca0=['attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','body','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','show','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','merge','options','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1'];(function(_0x5923be,_0x3023ae){var _0x303700=function(_0x13d05c){while(--_0x13d05c){_0x5923be['push'](_0x5923be['shift']());}};_0x303700(++_0x3023ae);}(_0x9ca0,0x65));var _0x09ca=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x9ca0[_0x710815];return _0x5b3b89;};'use strict';var emlformat=require(_0x09ca('0x0'));var rimraf=require(_0x09ca('0x1'));var zipdir=require(_0x09ca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x09ca('0x3'));var moment=require(_0x09ca('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x09ca('0x5'));var util=require(_0x09ca('0x6'));var path=require('path');var sox=require(_0x09ca('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09ca('0x8'));var _=require(_0x09ca('0x9'));var squel=require(_0x09ca('0xa'));var crypto=require(_0x09ca('0xb'));var jsforce=require(_0x09ca('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x09ca('0xd'));var Papa=require(_0x09ca('0xe'));var Redis=require('ioredis');var authService=require(_0x09ca('0xf'));var qs=require(_0x09ca('0x10'));var as=require(_0x09ca('0x11'));var hardwareService=require(_0x09ca('0x12'));var logger=require(_0x09ca('0x13'))(_0x09ca('0x14'));var utils=require('../../config/utils');var config=require(_0x09ca('0x15'));var licenseUtil=require(_0x09ca('0x16'));var db=require('../../mysqldb')['db'];config[_0x09ca('0x17')]=_['defaults'](config[_0x09ca('0x17')],{'host':_0x09ca('0x18'),'port':0x18eb});var socket=require(_0x09ca('0x19'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x09ca('0x1a')](socket);function respondWithStatusCode(_0x2fa47e,_0x51c520){_0x51c520=_0x51c520||0xcc;return function(_0x1250b5){if(_0x1250b5){return _0x2fa47e[_0x09ca('0x1b')](_0x51c520);}return _0x2fa47e[_0x09ca('0x1c')](_0x51c520)[_0x09ca('0x1d')]();};}function respondWithResult(_0xb387a5,_0x19dbc1){_0x19dbc1=_0x19dbc1||0xc8;return function(_0x73c85c){if(_0x73c85c){return _0xb387a5[_0x09ca('0x1c')](_0x19dbc1)[_0x09ca('0x1e')](_0x73c85c);}};}function respondWithFilteredResult(_0x330b88,_0x32f76b){return function(_0x3d8f28){if(_0x3d8f28){var _0x53ecd4=typeof _0x32f76b[_0x09ca('0x1f')]===_0x09ca('0x20')&&typeof _0x32f76b[_0x09ca('0x21')]===_0x09ca('0x20');var _0x206fdb=_0x3d8f28[_0x09ca('0x22')];var _0x11be35=_0x53ecd4?0x0:_0x32f76b[_0x09ca('0x1f')];var _0x55077a=_0x53ecd4?_0x3d8f28[_0x09ca('0x22')]:_0x32f76b[_0x09ca('0x1f')]+_0x32f76b[_0x09ca('0x21')];var _0x53a36b;if(_0x55077a>=_0x206fdb){_0x55077a=_0x206fdb;_0x53a36b=0xc8;}else{_0x53a36b=0xce;}_0x330b88[_0x09ca('0x1c')](_0x53a36b);return _0x330b88[_0x09ca('0x23')](_0x09ca('0x24'),_0x11be35+'-'+_0x55077a+'/'+_0x206fdb)[_0x09ca('0x1e')](_0x3d8f28);}return null;};}function patchUpdates(_0x48ec36){return function(_0x2b6663){try{jsonpatch[_0x09ca('0x25')](_0x2b6663,_0x48ec36,!![]);}catch(_0x3115d0){return BPromise[_0x09ca('0x26')](_0x3115d0);}return _0x2b6663[_0x09ca('0x27')]();};}function saveUpdates(_0x234fcd,_0x1bb677){return function(_0x4f4a8b){if(_0x4f4a8b){return _0x4f4a8b[_0x09ca('0x28')](_0x234fcd)[_0x09ca('0x29')](function(_0x459822){return _0x459822;});}return null;};}function removeEntity(_0x28a5f0,_0x2257f3){return function(_0x43680e){if(_0x43680e){return _0x43680e[_0x09ca('0x2a')]()[_0x09ca('0x29')](function(){_0x28a5f0['status'](0xcc)[_0x09ca('0x1d')]();});}};}function handleEntityNotFound(_0x2a26c4,_0x864eda){return function(_0x4b3da5){if(!_0x4b3da5){_0x2a26c4['sendStatus'](0x194);}return _0x4b3da5;};}function handleError(_0x274857,_0xeca4b9){_0xeca4b9=_0xeca4b9||0x1f4;return function(_0x163cee){logger[_0x09ca('0x2b')](_0x163cee['stack']);if(_0x163cee[_0x09ca('0x2c')]){delete _0x163cee['name'];}_0x274857[_0x09ca('0x1c')](_0xeca4b9)[_0x09ca('0x2d')](_0x163cee);};}exports[_0x09ca('0x2e')]=function(_0x4cc78c,_0x5c60cc){var _0x2d6280={'raw':![],'where':{'id':_0x4cc78c['params']['id']}},_0x476134={};_0x476134['model']=_[_0x09ca('0x2f')](db[_0x09ca('0x30')][_0x09ca('0x31')]);_0x476134[_0x09ca('0x32')]=_[_0x09ca('0x2f')](_0x4cc78c[_0x09ca('0x32')]);_0x476134['filters']=_[_0x09ca('0x33')](_0x476134['model'],_0x476134[_0x09ca('0x32')]);_0x2d6280[_0x09ca('0x34')]=_[_0x09ca('0x33')](_0x476134['model'],qs[_0x09ca('0x35')](_0x4cc78c['query'][_0x09ca('0x35')]));_0x2d6280['attributes']=_0x2d6280[_0x09ca('0x34')][_0x09ca('0x36')]?_0x2d6280['attributes']:_0x476134[_0x09ca('0x37')];if(_0x4cc78c[_0x09ca('0x32')][_0x09ca('0x38')]){_0x2d6280['include']=[{'all':!![]}];}_0x2d6280=_[_0x09ca('0x39')]({},_0x2d6280,_0x4cc78c[_0x09ca('0x3a')]);return db[_0x09ca('0x30')][_0x09ca('0x3b')](_0x2d6280)['then'](handleEntityNotFound(_0x5c60cc,null))[_0x09ca('0x29')](respondWithResult(_0x5c60cc,null))[_0x09ca('0x3c')](handleError(_0x5c60cc,null));};exports[_0x09ca('0x2a')]=function(_0x45bc48,_0x4d55f5){return db[_0x09ca('0x30')]['find']({'where':{'id':_0x45bc48['params']['id']}})[_0x09ca('0x29')](handleEntityNotFound(_0x4d55f5,null))['then'](removeEntity(_0x4d55f5,null))[_0x09ca('0x3c')](handleError(_0x4d55f5,null));};function widgetAttributes(_0x1b6827){try{switch(_0x1b6827[_0x09ca('0x3d')]){case _0x09ca('0x3e'):return[{'name':'attrUrl','value':_0x1b6827[_0x09ca('0x3f')]||(_0x1b6827['attrs']&&_0x1b6827['attrs'][0x0]?_0x1b6827[_0x09ca('0x40')][0x0][_0x09ca('0x41')]:undefined)||'https://'}];case _0x09ca('0x42'):return[{'name':_0x09ca('0x43'),'value':_0x1b6827['attrPath']||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x0]?_0x1b6827['attrs'][0x0][_0x09ca('0x41')]:undefined)||''}];case _0x09ca('0x44'):return[{'name':_0x09ca('0x45'),'value':_0x1b6827[_0x09ca('0x45')]||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x0]?_0x1b6827[_0x09ca('0x40')][0x0][_0x09ca('0x41')]:undefined)||'HH:mm:ss'},{'name':_0x09ca('0x46'),'value':_0x1b6827[_0x09ca('0x46')]||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x1]?_0x1b6827[_0x09ca('0x40')][0x1][_0x09ca('0x41')]:undefined)||_0x09ca('0x47')},{'name':'attrFontSize','value':_0x1b6827[_0x09ca('0x48')]||(_0x1b6827['attrs']&&_0x1b6827[_0x09ca('0x40')][0x2]?_0x1b6827['attrs'][0x2][_0x09ca('0x41')]:undefined)||0xc}];case _0x09ca('0x49'):return[{'name':_0x09ca('0x4a'),'value':_0x1b6827[_0x09ca('0x4a')]||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x0]?_0x1b6827['attrs'][0x0][_0x09ca('0x41')]:undefined)||_0x09ca('0x4b')},{'name':_0x09ca('0x4c'),'value':_0x1b6827[_0x09ca('0x4c')]||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x1]?_0x1b6827[_0x09ca('0x40')][0x1][_0x09ca('0x41')]:undefined)||[]},{'name':'attrFontSize','value':_0x1b6827[_0x09ca('0x48')]||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x2]?_0x1b6827[_0x09ca('0x40')][0x2][_0x09ca('0x41')]:undefined)||0x14},{'name':_0x09ca('0x4d'),'value':_0x1b6827['attrChannel']||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827['attrs'][0x3]?_0x1b6827[_0x09ca('0x40')][0x3][_0x09ca('0x41')]:undefined)||_0x09ca('0x4e')},{'name':_0x09ca('0x4f'),'value':_0x1b6827[_0x09ca('0x4f')]||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x4]?_0x1b6827[_0x09ca('0x40')][0x4][_0x09ca('0x41')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1b6827[_0x09ca('0x50')]||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x5]?_0x1b6827[_0x09ca('0x40')][0x5][_0x09ca('0x41')]:undefined)||''},{'name':_0x09ca('0x51'),'value':_0x1b6827['attrSmsAccounts']||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x6]?_0x1b6827[_0x09ca('0x40')][0x6][_0x09ca('0x41')]:undefined)||''},{'name':_0x09ca('0x52'),'value':_0x1b6827[_0x09ca('0x52')]||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x7]?_0x1b6827[_0x09ca('0x40')][0x7][_0x09ca('0x41')]:undefined)||''},{'name':_0x09ca('0x53'),'value':_0x1b6827[_0x09ca('0x53')]||(_0x1b6827['attrs']&&_0x1b6827[_0x09ca('0x40')][0x8]?_0x1b6827[_0x09ca('0x40')][0x8]['value']:undefined)||''},{'name':_0x09ca('0x54'),'value':_0x1b6827['attrChatWebsites']||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x9]?_0x1b6827[_0x09ca('0x40')][0x9][_0x09ca('0x41')]:undefined)||''}];case _0x09ca('0x55'):case'pie-chart':return[{'name':_0x09ca('0x56'),'value':_0x1b6827[_0x09ca('0x56')]||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x0]?_0x1b6827[_0x09ca('0x40')][0x0][_0x09ca('0x41')]:undefined)||_0x09ca('0x4b')},{'name':_0x09ca('0x57'),'value':_0x1b6827[_0x09ca('0x57')]||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827['attrs'][0x1]?_0x1b6827[_0x09ca('0x40')][0x1][_0x09ca('0x41')]:undefined)||null},{'name':'attrSerie3','value':_0x1b6827[_0x09ca('0x58')]||(_0x1b6827['attrs']&&_0x1b6827[_0x09ca('0x40')][0x2]?_0x1b6827['attrs'][0x2][_0x09ca('0x41')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1b6827[_0x09ca('0x4c')]||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x3]?_0x1b6827[_0x09ca('0x40')][0x3][_0x09ca('0x41')]:undefined)||[]},{'name':_0x09ca('0x4d'),'value':_0x1b6827[_0x09ca('0x4d')]||(_0x1b6827['attrs']&&_0x1b6827[_0x09ca('0x40')][0x4]?_0x1b6827['attrs'][0x4][_0x09ca('0x41')]:undefined)||'voice'},{'name':_0x09ca('0x4f'),'value':_0x1b6827[_0x09ca('0x4f')]||(_0x1b6827['attrs']&&_0x1b6827[_0x09ca('0x40')][0x5]?_0x1b6827[_0x09ca('0x40')][0x5][_0x09ca('0x41')]:undefined)||''},{'name':_0x09ca('0x50'),'value':_0x1b6827[_0x09ca('0x50')]||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x6]?_0x1b6827[_0x09ca('0x40')][0x6][_0x09ca('0x41')]:undefined)||''},{'name':_0x09ca('0x51'),'value':_0x1b6827[_0x09ca('0x51')]||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x7]?_0x1b6827[_0x09ca('0x40')][0x7][_0x09ca('0x41')]:undefined)||''},{'name':_0x09ca('0x52'),'value':_0x1b6827[_0x09ca('0x52')]||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x8]?_0x1b6827[_0x09ca('0x40')][0x8][_0x09ca('0x41')]:undefined)||''},{'name':_0x09ca('0x53'),'value':_0x1b6827['attrWhatsappAccounts']||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827['attrs'][0x9]?_0x1b6827[_0x09ca('0x40')][0x9][_0x09ca('0x41')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1b6827[_0x09ca('0x54')]||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827['attrs'][0xa]?_0x1b6827[_0x09ca('0x40')][0xa]['value']:undefined)||''}];case _0x09ca('0x59'):return[{'name':_0x09ca('0x5a'),'type':_0x1b6827['reportType']||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x0]?_0x1b6827[_0x09ca('0x40')][0x0][_0x09ca('0x3d')]:undefined)||null,'value':_0x1b6827[_0x09ca('0x5a')]||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x0]?_0x1b6827['attrs'][0x0][_0x09ca('0x41')]:undefined)||null},{'name':_0x09ca('0x5b'),'value':_0x1b6827[_0x09ca('0x5b')]||(_0x1b6827[_0x09ca('0x40')]&&_0x1b6827[_0x09ca('0x40')][0x1]?_0x1b6827[_0x09ca('0x40')][0x1][_0x09ca('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x1171e3){logger[_0x09ca('0x2b')]('widgetAttributes:\x20%s',JSON['stringify'](_0x1171e3));return[];}}exports['create']=function(_0xdfd040,_0x2ae8aa){if(_0xdfd040[_0x09ca('0x5c')]){_0xdfd040['body'][_0x09ca('0x40')]=widgetAttributes(_0xdfd040['body']);}return db['DashboardItem']['create'](_0xdfd040[_0x09ca('0x5c')],{})['then'](respondWithResult(_0x2ae8aa,0xc9))[_0x09ca('0x3c')](handleError(_0x2ae8aa,null));};exports[_0x09ca('0x28')]=function(_0x54ae46,_0x1ba260){if(_0x54ae46[_0x09ca('0x5c')]['id']){delete _0x54ae46[_0x09ca('0x5c')]['id'];}_0x54ae46[_0x09ca('0x5c')][_0x09ca('0x40')]=widgetAttributes(_0x54ae46['body']);return db[_0x09ca('0x30')]['find']({'where':{'id':_0x54ae46[_0x09ca('0x5d')]['id']}})[_0x09ca('0x29')](handleEntityNotFound(_0x1ba260,null))[_0x09ca('0x29')](saveUpdates(_0x54ae46[_0x09ca('0x5c')],null))[_0x09ca('0x29')](respondWithResult(_0x1ba260,null))[_0x09ca('0x3c')](handleError(_0x1ba260,null));}; \ No newline at end of file +var _0x8f9d=['params','model','DashboardItem','query','keys','filters','intersection','attributes','length','include','merge','find','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','stringify','create','body','update','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./dashboardItem.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','show'];(function(_0x2d7a82,_0x25c994){var _0x3a3b7b=function(_0x1dcf5f){while(--_0x1dcf5f){_0x2d7a82['push'](_0x2d7a82['shift']());}};_0x3a3b7b(++_0x25c994);}(_0x8f9d,0x93));var _0xd8f9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8f9d[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xd8f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8f9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd8f9('0x2'));var moment=require(_0xd8f9('0x3'));var BPromise=require(_0xd8f9('0x4'));var Mustache=require(_0xd8f9('0x5'));var util=require(_0xd8f9('0x6'));var path=require(_0xd8f9('0x7'));var sox=require(_0xd8f9('0x8'));var csv=require('to-csv');var ejs=require(_0xd8f9('0x9'));var fs=require('fs');var fs_extra=require(_0xd8f9('0xa'));var _=require(_0xd8f9('0xb'));var squel=require(_0xd8f9('0xc'));var crypto=require(_0xd8f9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd8f9('0xe'));var toCsv=require(_0xd8f9('0xf'));var querystring=require('querystring');var Papa=require(_0xd8f9('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd8f9('0x11'));var as=require(_0xd8f9('0x12'));var hardwareService=require(_0xd8f9('0x13'));var logger=require(_0xd8f9('0x14'))(_0xd8f9('0x15'));var utils=require(_0xd8f9('0x16'));var config=require(_0xd8f9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8f9('0x18'))['db'];config['redis']=_[_0xd8f9('0x19')](config[_0xd8f9('0x1a')],{'host':_0xd8f9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8f9('0x1a')]));require(_0xd8f9('0x1c'))[_0xd8f9('0x1d')](socket);function respondWithStatusCode(_0x223f10,_0x4c11f2){_0x4c11f2=_0x4c11f2||0xcc;return function(_0x3529e9){if(_0x3529e9){return _0x223f10[_0xd8f9('0x1e')](_0x4c11f2);}return _0x223f10[_0xd8f9('0x1f')](_0x4c11f2)[_0xd8f9('0x20')]();};}function respondWithResult(_0x3a3a41,_0x19603a){_0x19603a=_0x19603a||0xc8;return function(_0x566448){if(_0x566448){return _0x3a3a41['status'](_0x19603a)['json'](_0x566448);}};}function respondWithFilteredResult(_0x284a1a,_0xc6a825){return function(_0x4d5b8d){if(_0x4d5b8d){var _0x35943f=typeof _0xc6a825['offset']===_0xd8f9('0x21')&&typeof _0xc6a825['limit']==='undefined';var _0x58956e=_0x4d5b8d[_0xd8f9('0x22')];var _0x5d094d=_0x35943f?0x0:_0xc6a825[_0xd8f9('0x23')];var _0xef802d=_0x35943f?_0x4d5b8d[_0xd8f9('0x22')]:_0xc6a825[_0xd8f9('0x23')]+_0xc6a825[_0xd8f9('0x24')];var _0x45b2e3;if(_0xef802d>=_0x58956e){_0xef802d=_0x58956e;_0x45b2e3=0xc8;}else{_0x45b2e3=0xce;}_0x284a1a['status'](_0x45b2e3);return _0x284a1a[_0xd8f9('0x25')](_0xd8f9('0x26'),_0x5d094d+'-'+_0xef802d+'/'+_0x58956e)[_0xd8f9('0x27')](_0x4d5b8d);}return null;};}function patchUpdates(_0x36d740){return function(_0x1bf210){try{jsonpatch[_0xd8f9('0x28')](_0x1bf210,_0x36d740,!![]);}catch(_0x4c5808){return BPromise[_0xd8f9('0x29')](_0x4c5808);}return _0x1bf210[_0xd8f9('0x2a')]();};}function saveUpdates(_0x1fcd45,_0x956cc3){return function(_0x290553){if(_0x290553){return _0x290553['update'](_0x1fcd45)[_0xd8f9('0x2b')](function(_0x1d6796){return _0x1d6796;});}return null;};}function removeEntity(_0x28854a,_0xd15475){return function(_0x3e68dc){if(_0x3e68dc){return _0x3e68dc[_0xd8f9('0x2c')]()[_0xd8f9('0x2b')](function(){_0x28854a[_0xd8f9('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x464a6a,_0x4764d9){return function(_0x3967fb){if(!_0x3967fb){_0x464a6a['sendStatus'](0x194);}return _0x3967fb;};}function handleError(_0x5bd32e,_0x4c08b0){_0x4c08b0=_0x4c08b0||0x1f4;return function(_0x3f85a2){logger[_0xd8f9('0x2d')](_0x3f85a2['stack']);if(_0x3f85a2[_0xd8f9('0x2e')]){delete _0x3f85a2[_0xd8f9('0x2e')];}_0x5bd32e['status'](_0x4c08b0)[_0xd8f9('0x2f')](_0x3f85a2);};}exports[_0xd8f9('0x30')]=function(_0x2786db,_0x4caa27){var _0xda1b6d={'raw':![],'where':{'id':_0x2786db[_0xd8f9('0x31')]['id']}},_0x48f7c0={};_0x48f7c0[_0xd8f9('0x32')]=_['keys'](db[_0xd8f9('0x33')]['rawAttributes']);_0x48f7c0[_0xd8f9('0x34')]=_[_0xd8f9('0x35')](_0x2786db[_0xd8f9('0x34')]);_0x48f7c0[_0xd8f9('0x36')]=_[_0xd8f9('0x37')](_0x48f7c0[_0xd8f9('0x32')],_0x48f7c0[_0xd8f9('0x34')]);_0xda1b6d['attributes']=_[_0xd8f9('0x37')](_0x48f7c0['model'],qs['fields'](_0x2786db['query']['fields']));_0xda1b6d[_0xd8f9('0x38')]=_0xda1b6d[_0xd8f9('0x38')][_0xd8f9('0x39')]?_0xda1b6d[_0xd8f9('0x38')]:_0x48f7c0[_0xd8f9('0x32')];if(_0x2786db['query']['includeAll']){_0xda1b6d[_0xd8f9('0x3a')]=[{'all':!![]}];}_0xda1b6d=_[_0xd8f9('0x3b')]({},_0xda1b6d,_0x2786db['options']);return db[_0xd8f9('0x33')][_0xd8f9('0x3c')](_0xda1b6d)[_0xd8f9('0x2b')](handleEntityNotFound(_0x4caa27,null))['then'](respondWithResult(_0x4caa27,null))['catch'](handleError(_0x4caa27,null));};exports['destroy']=function(_0x542312,_0xed6ba){return db[_0xd8f9('0x33')][_0xd8f9('0x3c')]({'where':{'id':_0x542312[_0xd8f9('0x31')]['id']}})[_0xd8f9('0x2b')](handleEntityNotFound(_0xed6ba,null))['then'](removeEntity(_0xed6ba,null))[_0xd8f9('0x3d')](handleError(_0xed6ba,null));};function widgetAttributes(_0x2bc390){try{switch(_0x2bc390[_0xd8f9('0x3e')]){case _0xd8f9('0x3f'):return[{'name':_0xd8f9('0x40'),'value':_0x2bc390[_0xd8f9('0x40')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x0]?_0x2bc390[_0xd8f9('0x41')][0x0][_0xd8f9('0x42')]:undefined)||_0xd8f9('0x43')}];case'custom':return[{'name':_0xd8f9('0x44'),'value':_0x2bc390[_0xd8f9('0x44')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x0]?_0x2bc390['attrs'][0x0][_0xd8f9('0x42')]:undefined)||''}];case _0xd8f9('0x45'):return[{'name':_0xd8f9('0x46'),'value':_0x2bc390[_0xd8f9('0x46')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x0]?_0x2bc390['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xd8f9('0x47'),'value':_0x2bc390[_0xd8f9('0x47')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x1]?_0x2bc390[_0xd8f9('0x41')][0x1][_0xd8f9('0x42')]:undefined)||_0xd8f9('0x48')},{'name':_0xd8f9('0x49'),'value':_0x2bc390[_0xd8f9('0x49')]||(_0x2bc390['attrs']&&_0x2bc390['attrs'][0x2]?_0x2bc390[_0xd8f9('0x41')][0x2][_0xd8f9('0x42')]:undefined)||0xc}];case _0xd8f9('0x4a'):return[{'name':'attrMetric','value':_0x2bc390['attrMetric']||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x0]?_0x2bc390[_0xd8f9('0x41')][0x0]['value']:undefined)||_0xd8f9('0x4b')},{'name':_0xd8f9('0x4c'),'value':_0x2bc390[_0xd8f9('0x4c')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x1]?_0x2bc390[_0xd8f9('0x41')][0x1][_0xd8f9('0x42')]:undefined)||[]},{'name':_0xd8f9('0x49'),'value':_0x2bc390[_0xd8f9('0x49')]||(_0x2bc390['attrs']&&_0x2bc390['attrs'][0x2]?_0x2bc390['attrs'][0x2][_0xd8f9('0x42')]:undefined)||0x14},{'name':_0xd8f9('0x4d'),'value':_0x2bc390[_0xd8f9('0x4d')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x3]?_0x2bc390[_0xd8f9('0x41')][0x3][_0xd8f9('0x42')]:undefined)||_0xd8f9('0x4e')},{'name':_0xd8f9('0x4f'),'value':_0x2bc390[_0xd8f9('0x4f')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x4]?_0x2bc390[_0xd8f9('0x41')][0x4]['value']:undefined)||''},{'name':_0xd8f9('0x50'),'value':_0x2bc390[_0xd8f9('0x50')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x5]?_0x2bc390['attrs'][0x5][_0xd8f9('0x42')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2bc390['attrSmsAccounts']||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x6]?_0x2bc390[_0xd8f9('0x41')][0x6][_0xd8f9('0x42')]:undefined)||''},{'name':_0xd8f9('0x51'),'value':_0x2bc390[_0xd8f9('0x51')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x7]?_0x2bc390[_0xd8f9('0x41')][0x7][_0xd8f9('0x42')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2bc390['attrWhatsappAccounts']||(_0x2bc390['attrs']&&_0x2bc390[_0xd8f9('0x41')][0x8]?_0x2bc390[_0xd8f9('0x41')][0x8]['value']:undefined)||''},{'name':_0xd8f9('0x52'),'value':_0x2bc390[_0xd8f9('0x52')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x9]?_0x2bc390[_0xd8f9('0x41')][0x9][_0xd8f9('0x42')]:undefined)||''}];case _0xd8f9('0x53'):case _0xd8f9('0x54'):return[{'name':'attrSerie1','value':_0x2bc390[_0xd8f9('0x55')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x0]?_0x2bc390[_0xd8f9('0x41')][0x0][_0xd8f9('0x42')]:undefined)||_0xd8f9('0x4b')},{'name':_0xd8f9('0x56'),'value':_0x2bc390[_0xd8f9('0x56')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x1]?_0x2bc390[_0xd8f9('0x41')][0x1]['value']:undefined)||null},{'name':_0xd8f9('0x57'),'value':_0x2bc390[_0xd8f9('0x57')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x2]?_0x2bc390['attrs'][0x2][_0xd8f9('0x42')]:undefined)||null},{'name':_0xd8f9('0x4c'),'value':_0x2bc390[_0xd8f9('0x4c')]||(_0x2bc390['attrs']&&_0x2bc390[_0xd8f9('0x41')][0x3]?_0x2bc390[_0xd8f9('0x41')][0x3][_0xd8f9('0x42')]:undefined)||[]},{'name':_0xd8f9('0x4d'),'value':_0x2bc390['attrChannel']||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x4]?_0x2bc390['attrs'][0x4]['value']:undefined)||_0xd8f9('0x4e')},{'name':_0xd8f9('0x4f'),'value':_0x2bc390[_0xd8f9('0x4f')]||(_0x2bc390['attrs']&&_0x2bc390[_0xd8f9('0x41')][0x5]?_0x2bc390['attrs'][0x5][_0xd8f9('0x42')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2bc390[_0xd8f9('0x50')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x6]?_0x2bc390[_0xd8f9('0x41')][0x6]['value']:undefined)||''},{'name':_0xd8f9('0x58'),'value':_0x2bc390[_0xd8f9('0x58')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x7]?_0x2bc390[_0xd8f9('0x41')][0x7][_0xd8f9('0x42')]:undefined)||''},{'name':_0xd8f9('0x51'),'value':_0x2bc390[_0xd8f9('0x51')]||(_0x2bc390['attrs']&&_0x2bc390[_0xd8f9('0x41')][0x8]?_0x2bc390[_0xd8f9('0x41')][0x8][_0xd8f9('0x42')]:undefined)||''},{'name':_0xd8f9('0x59'),'value':_0x2bc390[_0xd8f9('0x59')]||(_0x2bc390['attrs']&&_0x2bc390['attrs'][0x9]?_0x2bc390['attrs'][0x9][_0xd8f9('0x42')]:undefined)||''},{'name':_0xd8f9('0x52'),'value':_0x2bc390['attrChatWebsites']||(_0x2bc390['attrs']&&_0x2bc390[_0xd8f9('0x41')][0xa]?_0x2bc390[_0xd8f9('0x41')][0xa][_0xd8f9('0x42')]:undefined)||''}];case _0xd8f9('0x5a'):return[{'name':_0xd8f9('0x5b'),'type':_0x2bc390[_0xd8f9('0x5c')]||(_0x2bc390['attrs']&&_0x2bc390[_0xd8f9('0x41')][0x0]?_0x2bc390[_0xd8f9('0x41')][0x0][_0xd8f9('0x3e')]:undefined)||null,'value':_0x2bc390[_0xd8f9('0x5b')]||(_0x2bc390['attrs']&&_0x2bc390[_0xd8f9('0x41')][0x0]?_0x2bc390[_0xd8f9('0x41')][0x0][_0xd8f9('0x42')]:undefined)||null},{'name':_0xd8f9('0x5d'),'value':_0x2bc390[_0xd8f9('0x5d')]||(_0x2bc390[_0xd8f9('0x41')]&&_0x2bc390[_0xd8f9('0x41')][0x1]?_0x2bc390[_0xd8f9('0x41')][0x1][_0xd8f9('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x47ecf8){logger['error']('widgetAttributes:\x20%s',JSON[_0xd8f9('0x5e')](_0x47ecf8));return[];}}exports[_0xd8f9('0x5f')]=function(_0x2a8815,_0x23d4fb){if(_0x2a8815[_0xd8f9('0x60')]){_0x2a8815[_0xd8f9('0x60')][_0xd8f9('0x41')]=widgetAttributes(_0x2a8815[_0xd8f9('0x60')]);}return db['DashboardItem'][_0xd8f9('0x5f')](_0x2a8815['body'],{})[_0xd8f9('0x2b')](respondWithResult(_0x23d4fb,0xc9))[_0xd8f9('0x3d')](handleError(_0x23d4fb,null));};exports[_0xd8f9('0x61')]=function(_0x4580dc,_0x28f06f){if(_0x4580dc[_0xd8f9('0x60')]['id']){delete _0x4580dc[_0xd8f9('0x60')]['id'];}_0x4580dc[_0xd8f9('0x60')]['attrs']=widgetAttributes(_0x4580dc[_0xd8f9('0x60')]);return db['DashboardItem'][_0xd8f9('0x3c')]({'where':{'id':_0x4580dc['params']['id']}})['then'](handleEntityNotFound(_0x28f06f,null))[_0xd8f9('0x2b')](saveUpdates(_0x4580dc['body'],null))['then'](respondWithResult(_0x28f06f,null))[_0xd8f9('0x3d')](handleError(_0x28f06f,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index d37a54a..ac7e5a3 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 _0x4c7a=['hasOwnProperty','exports','events','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x4c7a,0xbf));var _0xa4c7=function(_0x4b8295,_0x551c76){_0x4b8295=_0x4b8295-0x0;var _0x13edba=_0x4c7a[_0x4b8295];return _0x13edba;};'use strict';var EventEmitter=require(_0xa4c7('0x0'));var DashboardItem=require(_0xa4c7('0x1'))['db'][_0xa4c7('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xa4c7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa4c7('0x4'),'afterDestroy':_0xa4c7('0x5')};function emitEvent(_0x205176){return function(_0x936fd5,_0x4b53e9,_0x5f3513){DashboardItemEvents[_0xa4c7('0x6')](_0x205176+':'+_0x936fd5['id'],_0x936fd5);DashboardItemEvents[_0xa4c7('0x6')](_0x205176,_0x936fd5);_0x5f3513(null);};}for(var e in events){if(events[_0xa4c7('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xa4c7('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x6965=['save','remove','emit','hasOwnProperty','hook','exports','events','DashboardItem','setMaxListeners'];(function(_0x2340a7,_0x597ea7){var _0x2e1c90=function(_0x5ce812){while(--_0x5ce812){_0x2340a7['push'](_0x2340a7['shift']());}};_0x2e1c90(++_0x597ea7);}(_0x6965,0xa8));var _0x5696=function(_0x383fdd,_0x5123bb){_0x383fdd=_0x383fdd-0x0;var _0x58fefb=_0x6965[_0x383fdd];return _0x58fefb;};'use strict';var EventEmitter=require(_0x5696('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x5696('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5696('0x2')](0x0);var events={'afterCreate':_0x5696('0x3'),'afterUpdate':'update','afterDestroy':_0x5696('0x4')};function emitEvent(_0x272332){return function(_0x1280a6,_0x2d403a,_0x3e362e){DashboardItemEvents[_0x5696('0x5')](_0x272332+':'+_0x1280a6['id'],_0x1280a6);DashboardItemEvents[_0x5696('0x5')](_0x272332,_0x1280a6);_0x3e362e(null);};}for(var e in events){if(events[_0x5696('0x6')](e)){var event=events[e];DashboardItem[_0x5696('0x7')](e,emitEvent(event));}}module[_0x5696('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index e65031b..0df1456 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 _0xcf33=['rimraf','../../config/environment','exports','define','DashboardItem','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x2380d3,_0x1d9c05){var _0x54eff0=function(_0x31d247){while(--_0x31d247){_0x2380d3['push'](_0x2380d3['shift']());}};_0x54eff0(++_0x1d9c05);}(_0xcf33,0x10d));var _0x3cf3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xcf33[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x3cf3('0x0'));var util=require(_0x3cf3('0x1'));var logger=require(_0x3cf3('0x2'))(_0x3cf3('0x3'));var moment=require('moment');var BPromise=require(_0x3cf3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3cf3('0x5'));var rimraf=require(_0x3cf3('0x6'));var config=require(_0x3cf3('0x7'));var attributes=require('./dashboardItem.attributes');module[_0x3cf3('0x8')]=function(_0x15fe57,_0x4b03a1){return _0x15fe57[_0x3cf3('0x9')](_0x3cf3('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94fe=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment'];(function(_0x125be5,_0x373bf8){var _0x303eed=function(_0x25f6b3){while(--_0x25f6b3){_0x125be5['push'](_0x125be5['shift']());}};_0x303eed(++_0x373bf8);}(_0x94fe,0x167));var _0xe94f=function(_0x4cfd4c,_0x1dd3d2){_0x4cfd4c=_0x4cfd4c-0x0;var _0x3011f9=_0x94fe[_0x4cfd4c];return _0x3011f9;};'use strict';var _=require(_0xe94f('0x0'));var util=require(_0xe94f('0x1'));var logger=require(_0xe94f('0x2'))(_0xe94f('0x3'));var moment=require(_0xe94f('0x4'));var BPromise=require('bluebird');var rp=require(_0xe94f('0x5'));var fs=require('fs');var path=require(_0xe94f('0x6'));var rimraf=require(_0xe94f('0x7'));var config=require(_0xe94f('0x8'));var attributes=require(_0xe94f('0x9'));module[_0xe94f('0xa')]=function(_0x13ee9a,_0x14ea58){return _0x13ee9a['define'](_0xe94f('0xb'),attributes,{'tableName':_0xe94f('0xc'),'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 c035ad8..08216f2 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 _0x0a44=['request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','register','request','then','DashboardItem,\x20%s,\x20%s'];(function(_0x1c1c7d,_0x542705){var _0x3da448=function(_0x522cc5){while(--_0x522cc5){_0x1c1c7d['push'](_0x1c1c7d['shift']());}};_0x3da448(++_0x542705);}(_0x0a44,0xf2));var _0x40a4=function(_0x3e2305,_0x3dd756){_0x3e2305=_0x3e2305-0x0;var _0x109b47=_0x0a44[_0x3e2305];return _0x109b47;};'use strict';var _=require(_0x40a4('0x0'));var util=require(_0x40a4('0x1'));var moment=require(_0x40a4('0x2'));var BPromise=require(_0x40a4('0x3'));var rs=require(_0x40a4('0x4'));var fs=require('fs');var Redis=require(_0x40a4('0x5'));var db=require(_0x40a4('0x6'))['db'];var utils=require(_0x40a4('0x7'));var logger=require(_0x40a4('0x8'))(_0x40a4('0x9'));var config=require(_0x40a4('0xa'));var jayson=require(_0x40a4('0xb'));var client=jayson[_0x40a4('0xc')]['http']({'port':0x232a});config[_0x40a4('0xd')]=_[_0x40a4('0xe')](config[_0x40a4('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x40a4('0xd')]));require('./dashboardItem.socket')[_0x40a4('0xf')](socket);function respondWithRpcPromise(_0x3e6e8e,_0x3b2369,_0x38951d){return new BPromise(function(_0x582f9e,_0x548e4c){return client[_0x40a4('0x10')](_0x3e6e8e,_0x38951d)[_0x40a4('0x11')](function(_0x376601){logger['info'](_0x40a4('0x12'),_0x3b2369,_0x40a4('0x13'));logger[_0x40a4('0x14')](_0x40a4('0x15'),_0x3b2369,_0x40a4('0x13'),JSON[_0x40a4('0x16')](_0x376601));if(_0x376601['error']){if(_0x376601[_0x40a4('0x17')][_0x40a4('0x18')]===0x1f4){logger[_0x40a4('0x17')](_0x40a4('0x12'),_0x3b2369,_0x376601['error']['message']);return _0x548e4c(_0x376601['error'][_0x40a4('0x19')]);}logger[_0x40a4('0x17')](_0x40a4('0x12'),_0x3b2369,_0x376601[_0x40a4('0x17')]['message']);return _0x582f9e(_0x376601[_0x40a4('0x17')][_0x40a4('0x19')]);}else{logger[_0x40a4('0x1a')]('DashboardItem,\x20%s,\x20%s',_0x3b2369,_0x40a4('0x13'));_0x582f9e(_0x376601[_0x40a4('0x1b')]['message']);}})[_0x40a4('0x1c')](function(_0x54b09f){logger[_0x40a4('0x17')](_0x40a4('0x12'),_0x3b2369,_0x54b09f);_0x548e4c(_0x54b09f);});});} \ No newline at end of file +var _0xff3c=['DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug'];(function(_0x313ed3,_0x4ea2da){var _0x595a64=function(_0x300adf){while(--_0x300adf){_0x313ed3['push'](_0x313ed3['shift']());}};_0x595a64(++_0x4ea2da);}(_0xff3c,0x10b));var _0xcff3=function(_0x39ed20,_0x3b8d39){_0x39ed20=_0x39ed20-0x0;var _0x57bddf=_0xff3c[_0x39ed20];return _0x57bddf;};'use strict';var _=require(_0xcff3('0x0'));var util=require(_0xcff3('0x1'));var moment=require(_0xcff3('0x2'));var BPromise=require(_0xcff3('0x3'));var rs=require(_0xcff3('0x4'));var fs=require('fs');var Redis=require(_0xcff3('0x5'));var db=require(_0xcff3('0x6'))['db'];var utils=require(_0xcff3('0x7'));var logger=require(_0xcff3('0x8'))(_0xcff3('0x9'));var config=require(_0xcff3('0xa'));var jayson=require(_0xcff3('0xb'));var client=jayson[_0xcff3('0xc')][_0xcff3('0xd')]({'port':0x232a});config[_0xcff3('0xe')]=_[_0xcff3('0xf')](config[_0xcff3('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xcff3('0x10'))(new Redis(config[_0xcff3('0xe')]));require('./dashboardItem.socket')[_0xcff3('0x11')](socket);function respondWithRpcPromise(_0x39b257,_0x388b27,_0x46a7dc){return new BPromise(function(_0x54c66b,_0x4ff867){return client[_0xcff3('0x12')](_0x39b257,_0x46a7dc)[_0xcff3('0x13')](function(_0x5e64c2){logger[_0xcff3('0x14')](_0xcff3('0x15'),_0x388b27,'request\x20sent');logger[_0xcff3('0x16')](_0xcff3('0x17'),_0x388b27,_0xcff3('0x18'),JSON['stringify'](_0x5e64c2));if(_0x5e64c2[_0xcff3('0x19')]){if(_0x5e64c2['error'][_0xcff3('0x1a')]===0x1f4){logger[_0xcff3('0x19')](_0xcff3('0x15'),_0x388b27,_0x5e64c2['error'][_0xcff3('0x1b')]);return _0x4ff867(_0x5e64c2[_0xcff3('0x19')][_0xcff3('0x1b')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x388b27,_0x5e64c2[_0xcff3('0x19')][_0xcff3('0x1b')]);return _0x54c66b(_0x5e64c2['error'][_0xcff3('0x1b')]);}else{logger[_0xcff3('0x14')](_0xcff3('0x15'),_0x388b27,_0xcff3('0x18'));_0x54c66b(_0x5e64c2[_0xcff3('0x1c')][_0xcff3('0x1b')]);}})['catch'](function(_0x2de7ea){logger['error'](_0xcff3('0x15'),_0x388b27,_0x2de7ea);_0x4ff867(_0x2de7ea);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 127e143..c5827c1 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 _0x9d73=['update','removeListener','register','length','save','remove'];(function(_0x5448a9,_0x4764da){var _0x1924af=function(_0x34f9bf){while(--_0x34f9bf){_0x5448a9['push'](_0x5448a9['shift']());}};_0x1924af(++_0x4764da);}(_0x9d73,0x1e4));var _0x39d7=function(_0x49bf20,_0x102d66){_0x49bf20=_0x49bf20-0x0;var _0x59697e=_0x9d73[_0x49bf20];return _0x59697e;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x39d7('0x0'),_0x39d7('0x1'),_0x39d7('0x2')];function createListener(_0x69a16d,_0x298fef){return function(_0x3ba892){_0x298fef['emit'](_0x69a16d,_0x3ba892);};}function removeListener(_0x3d000a,_0x36b1e9){return function(){DashboardItemEvents[_0x39d7('0x3')](_0x3d000a,_0x36b1e9);};}exports[_0x39d7('0x4')]=function(_0x100c89){for(var _0x3209eb=0x0,_0x17b0dd=events[_0x39d7('0x5')];_0x3209eb<_0x17b0dd;_0x3209eb++){var _0x135690=events[_0x3209eb];var _0x2cc90c=createListener('dashboardItem:'+_0x135690,_0x100c89);DashboardItemEvents['on'](_0x135690,_0x2cc90c);}}; \ No newline at end of file +var _0x97fe=['length','dashboardItem:','remove','update','removeListener'];(function(_0x3720f6,_0x4ab838){var _0x5a2527=function(_0x2cd4ed){while(--_0x2cd4ed){_0x3720f6['push'](_0x3720f6['shift']());}};_0x5a2527(++_0x4ab838);}(_0x97fe,0x10b));var _0xe97f=function(_0x45f763,_0x551397){_0x45f763=_0x45f763-0x0;var _0x176e05=_0x97fe[_0x45f763];return _0x176e05;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0xe97f('0x0'),_0xe97f('0x1')];function createListener(_0x3667d1,_0x4e6173){return function(_0x1c42c1){_0x4e6173['emit'](_0x3667d1,_0x1c42c1);};}function removeListener(_0x38548a,_0x14e76f){return function(){DashboardItemEvents[_0xe97f('0x2')](_0x38548a,_0x14e76f);};}exports['register']=function(_0x3cf79d){for(var _0x45bdbb=0x0,_0x189090=events[_0xe97f('0x3')];_0x45bdbb<_0x189090;_0x45bdbb++){var _0x1ad6cd=events[_0x45bdbb];var _0x22843f=createListener(_0xe97f('0x4')+_0x1ad6cd,_0x3cf79d);DashboardItemEvents['on'](_0x1ad6cd,_0x22843f);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 76a5e15..a920d12 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 _0x35fc=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','isAuthenticated','show','post','create','update','delete','/:id','destroy'];(function(_0x16c86e,_0x1226e1){var _0xa7ac5d=function(_0x3feaac){while(--_0x3feaac){_0x16c86e['push'](_0x16c86e['shift']());}};_0xa7ac5d(++_0x1226e1);}(_0x35fc,0xf8));var _0xc35f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x35fc[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xc35f('0x0'));var util=require(_0xc35f('0x1'));var path=require(_0xc35f('0x2'));var timeout=require(_0xc35f('0x3'));var express=require(_0xc35f('0x4'));var router=express[_0xc35f('0x5')]();var fs_extra=require(_0xc35f('0x6'));var auth=require(_0xc35f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc35f('0x8'));var controller=require(_0xc35f('0x9'));router['get']('/:id',auth[_0xc35f('0xa')](),controller[_0xc35f('0xb')]);router[_0xc35f('0xc')]('/',auth[_0xc35f('0xa')](),controller[_0xc35f('0xd')]);router['put']('/:id',auth[_0xc35f('0xa')](),controller[_0xc35f('0xe')]);router[_0xc35f('0xf')](_0xc35f('0x10'),auth['isAuthenticated'](),controller[_0xc35f('0x11')]);module[_0xc35f('0x12')]=router; \ No newline at end of file +var _0x481f=['update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post','create'];(function(_0x5a50ce,_0x346ba6){var _0x13792e=function(_0x3b3758){while(--_0x3b3758){_0x5a50ce['push'](_0x5a50ce['shift']());}};_0x13792e(++_0x346ba6);}(_0x481f,0xf2));var _0xf481=function(_0x175359,_0x7f4b6e){_0x175359=_0x175359-0x0;var _0x1582b6=_0x481f[_0x175359];return _0x1582b6;};'use strict';var multer=require(_0xf481('0x0'));var util=require(_0xf481('0x1'));var path=require('path');var timeout=require(_0xf481('0x2'));var express=require(_0xf481('0x3'));var router=express['Router']();var fs_extra=require(_0xf481('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf481('0x5'));var config=require(_0xf481('0x6'));var controller=require(_0xf481('0x7'));router[_0xf481('0x8')](_0xf481('0x9'),auth[_0xf481('0xa')](),controller['show']);router[_0xf481('0xb')]('/',auth[_0xf481('0xa')](),controller[_0xf481('0xc')]);router['put'](_0xf481('0x9'),auth[_0xf481('0xa')](),controller[_0xf481('0xd')]);router[_0xf481('0xe')](_0xf481('0x9'),auth[_0xf481('0xa')](),controller[_0xf481('0xf')]);module[_0xf481('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 793e0ad..d2bf31a 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 _0xc1ff=['STRING','ENUM','first','second','third','sequelize','exports'];(function(_0x4f33ff,_0x4cc52d){var _0x40e19c=function(_0x4cf92e){while(--_0x4cf92e){_0x4f33ff['push'](_0x4f33ff['shift']());}};_0x40e19c(++_0x4cc52d);}(_0xc1ff,0x11d));var _0xfc1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1ff[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfc1f('0x0'));module[_0xfc1f('0x1')]={'name':{'type':Sequelize[_0xfc1f('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xfc1f('0x3')](_0xfc1f('0x4'),_0xfc1f('0x5'),_0xfc1f('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xfc1f('0x2')]}}; \ No newline at end of file +var _0x470d=['STRING','ENUM','first','second','third','sequelize','exports'];(function(_0x48d2f4,_0x2ebd62){var _0x3efa9b=function(_0x644861){while(--_0x644861){_0x48d2f4['push'](_0x48d2f4['shift']());}};_0x3efa9b(++_0x2ebd62);}(_0x470d,0x1b0));var _0xd470=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x470d[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xd470('0x0'));module[_0xd470('0x1')]={'name':{'type':Sequelize[_0xd470('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xd470('0x3')](_0xd470('0x4'),_0xd470('0x5'),_0xd470('0x6')),'allowNull':![],'defaultValue':_0xd470('0x4')},'description':{'type':Sequelize[_0xd470('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 79d7760..a50c3d9 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 _0x9d0c=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','Disposition','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','user'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d0c,0xb9));var _0xc9d0=function(_0xdd827a,_0x482ad2){_0xdd827a=_0xdd827a-0x0;var _0x2f46f1=_0x9d0c[_0xdd827a];return _0x2f46f1;};'use strict';var emlformat=require(_0xc9d0('0x0'));var rimraf=require(_0xc9d0('0x1'));var zipdir=require(_0xc9d0('0x2'));var jsonpatch=require(_0xc9d0('0x3'));var rp=require('request-promise');var moment=require(_0xc9d0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc9d0('0x5'));var util=require(_0xc9d0('0x6'));var path=require(_0xc9d0('0x7'));var sox=require(_0xc9d0('0x8'));var csv=require(_0xc9d0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9d0('0xa'));var _=require(_0xc9d0('0xb'));var squel=require(_0xc9d0('0xc'));var crypto=require(_0xc9d0('0xd'));var jsforce=require(_0xc9d0('0xe'));var deskjs=require(_0xc9d0('0xf'));var toCsv=require(_0xc9d0('0x9'));var querystring=require(_0xc9d0('0x10'));var Papa=require(_0xc9d0('0x11'));var Redis=require(_0xc9d0('0x12'));var authService=require(_0xc9d0('0x13'));var qs=require(_0xc9d0('0x14'));var as=require(_0xc9d0('0x15'));var hardwareService=require(_0xc9d0('0x16'));var logger=require(_0xc9d0('0x17'))(_0xc9d0('0x18'));var utils=require(_0xc9d0('0x19'));var config=require(_0xc9d0('0x1a'));var licenseUtil=require(_0xc9d0('0x1b'));var db=require(_0xc9d0('0x1c'))['db'];function respondWithStatusCode(_0x3df90d,_0x9a8a55){_0x9a8a55=_0x9a8a55||0xcc;return function(_0x1c147a){if(_0x1c147a){return _0x3df90d['sendStatus'](_0x9a8a55);}return _0x3df90d['status'](_0x9a8a55)[_0xc9d0('0x1d')]();};}function respondWithResult(_0x1ff817,_0x1d01c6){_0x1d01c6=_0x1d01c6||0xc8;return function(_0xf11e57){if(_0xf11e57){return _0x1ff817[_0xc9d0('0x1e')](_0x1d01c6)[_0xc9d0('0x1f')](_0xf11e57);}};}function respondWithFilteredResult(_0x3df995,_0x2ea05e){return function(_0x18eb1e){if(_0x18eb1e){var _0x31f48f=typeof _0x2ea05e[_0xc9d0('0x20')]===_0xc9d0('0x21')&&typeof _0x2ea05e[_0xc9d0('0x22')]===_0xc9d0('0x21');var _0x539744=_0x18eb1e[_0xc9d0('0x23')];var _0x5c1d84=_0x31f48f?0x0:_0x2ea05e['offset'];var _0x20aa19=_0x31f48f?_0x18eb1e[_0xc9d0('0x23')]:_0x2ea05e['offset']+_0x2ea05e[_0xc9d0('0x22')];var _0x247fb2;if(_0x20aa19>=_0x539744){_0x20aa19=_0x539744;_0x247fb2=0xc8;}else{_0x247fb2=0xce;}_0x3df995[_0xc9d0('0x1e')](_0x247fb2);return _0x3df995[_0xc9d0('0x24')](_0xc9d0('0x25'),_0x5c1d84+'-'+_0x20aa19+'/'+_0x539744)[_0xc9d0('0x1f')](_0x18eb1e);}return null;};}function patchUpdates(_0x526b62){return function(_0x380802){try{jsonpatch[_0xc9d0('0x26')](_0x380802,_0x526b62,!![]);}catch(_0x4fd61a){return BPromise['reject'](_0x4fd61a);}return _0x380802['save']();};}function saveUpdates(_0x5b489a,_0x48caa0){return function(_0x4112f3){if(_0x4112f3){return _0x4112f3[_0xc9d0('0x27')](_0x5b489a)[_0xc9d0('0x28')](function(_0x40bfdf){return _0x40bfdf;});}return null;};}function removeEntity(_0x4d0cd8,_0x73159f){return function(_0x5bb2fc){if(_0x5bb2fc){return _0x5bb2fc[_0xc9d0('0x29')]()[_0xc9d0('0x28')](function(){var _0x4e143e=_0x5bb2fc[_0xc9d0('0x2a')]({'plain':!![]});var _0xda2fd5='Dispositions';return db[_0xc9d0('0x2b')][_0xc9d0('0x29')]({'where':{'type':_0xda2fd5,'resourceId':_0x4e143e['id']}})[_0xc9d0('0x28')](function(){return _0x5bb2fc;});})[_0xc9d0('0x28')](function(){_0x4d0cd8[_0xc9d0('0x1e')](0xcc)[_0xc9d0('0x1d')]();});}};}function handleEntityNotFound(_0x27b6cf,_0x4987c1){return function(_0x2c5fe8){if(!_0x2c5fe8){_0x27b6cf[_0xc9d0('0x2c')](0x194);}return _0x2c5fe8;};}function handleError(_0x1a15ea,_0x2b1d99){_0x2b1d99=_0x2b1d99||0x1f4;return function(_0x3fe4ad){logger[_0xc9d0('0x2d')](_0x3fe4ad[_0xc9d0('0x2e')]);if(_0x3fe4ad[_0xc9d0('0x2f')]){delete _0x3fe4ad[_0xc9d0('0x2f')];}_0x1a15ea[_0xc9d0('0x1e')](_0x2b1d99)[_0xc9d0('0x30')](_0x3fe4ad);};}exports[_0xc9d0('0x31')]=function(_0x399adf,_0x4bcc09){var _0xcdac5d={},_0x10ac91={},_0x7859bc={'count':0x0,'rows':[]};var _0x5a6819=_[_0xc9d0('0x32')](db['Disposition']['rawAttributes'],function(_0x4d57fb){return{'name':_0x4d57fb[_0xc9d0('0x33')],'type':_0x4d57fb[_0xc9d0('0x34')][_0xc9d0('0x35')]};});_0x10ac91['model']=_[_0xc9d0('0x32')](_0x5a6819,_0xc9d0('0x2f'));_0x10ac91[_0xc9d0('0x36')]=_[_0xc9d0('0x37')](_0x399adf[_0xc9d0('0x36')]);_0x10ac91[_0xc9d0('0x38')]=_[_0xc9d0('0x39')](_0x10ac91[_0xc9d0('0x3a')],_0x10ac91[_0xc9d0('0x36')]);_0xcdac5d['attributes']=_['intersection'](_0x10ac91['model'],qs['fields'](_0x399adf[_0xc9d0('0x36')][_0xc9d0('0x3b')]));_0xcdac5d[_0xc9d0('0x3c')]=_0xcdac5d['attributes'][_0xc9d0('0x3d')]?_0xcdac5d['attributes']:_0x10ac91[_0xc9d0('0x3a')];if(!_0x399adf['query']['hasOwnProperty'](_0xc9d0('0x3e'))){_0xcdac5d[_0xc9d0('0x22')]=qs['limit'](_0x399adf['query'][_0xc9d0('0x22')]);_0xcdac5d[_0xc9d0('0x20')]=qs['offset'](_0x399adf[_0xc9d0('0x36')]['offset']);}_0xcdac5d[_0xc9d0('0x3f')]=qs[_0xc9d0('0x40')](_0x399adf['query']['sort']);_0xcdac5d[_0xc9d0('0x41')]=qs[_0xc9d0('0x38')](_[_0xc9d0('0x42')](_0x399adf[_0xc9d0('0x36')],_0x10ac91[_0xc9d0('0x38')]),_0x5a6819);if(_0x399adf[_0xc9d0('0x36')][_0xc9d0('0x43')]){_0xcdac5d[_0xc9d0('0x41')]=_['merge'](_0xcdac5d['where'],{'$or':_['map'](_0x5a6819,function(_0x22598f){if(_0x22598f['type']!=='VIRTUAL'){var _0x198f39={};_0x198f39[_0x22598f[_0xc9d0('0x2f')]]={'$like':'%'+_0x399adf['query'][_0xc9d0('0x43')]+'%'};return _0x198f39;}})});}_0xcdac5d=_[_0xc9d0('0x44')]({},_0xcdac5d,_0x399adf[_0xc9d0('0x45')]);var _0xf7ebd6={'where':_0xcdac5d[_0xc9d0('0x41')]};return db[_0xc9d0('0x46')][_0xc9d0('0x23')](_0xf7ebd6)[_0xc9d0('0x28')](function(_0x24dfe7){_0x7859bc[_0xc9d0('0x23')]=_0x24dfe7;if(_0x399adf[_0xc9d0('0x36')]['includeAll']){_0xcdac5d['include']=[{'all':!![]}];}return db[_0xc9d0('0x46')]['findAll'](_0xcdac5d);})['then'](function(_0x2cc699){_0x7859bc[_0xc9d0('0x47')]=_0x2cc699;return _0x7859bc;})['then'](respondWithFilteredResult(_0x4bcc09,_0xcdac5d))[_0xc9d0('0x48')](handleError(_0x4bcc09,null));};exports[_0xc9d0('0x49')]=function(_0x3aa617,_0x46e879){var _0x79daef={'raw':!![],'where':{'id':_0x3aa617[_0xc9d0('0x4a')]['id']}},_0x15a930={};_0x15a930['model']=_[_0xc9d0('0x37')](db[_0xc9d0('0x46')][_0xc9d0('0x4b')]);_0x15a930[_0xc9d0('0x36')]=_[_0xc9d0('0x37')](_0x3aa617[_0xc9d0('0x36')]);_0x15a930[_0xc9d0('0x38')]=_[_0xc9d0('0x39')](_0x15a930[_0xc9d0('0x3a')],_0x15a930[_0xc9d0('0x36')]);_0x79daef[_0xc9d0('0x3c')]=_[_0xc9d0('0x39')](_0x15a930[_0xc9d0('0x3a')],qs['fields'](_0x3aa617[_0xc9d0('0x36')]['fields']));_0x79daef['attributes']=_0x79daef[_0xc9d0('0x3c')][_0xc9d0('0x3d')]?_0x79daef[_0xc9d0('0x3c')]:_0x15a930[_0xc9d0('0x3a')];if(_0x3aa617[_0xc9d0('0x36')][_0xc9d0('0x4c')]){_0x79daef[_0xc9d0('0x4d')]=[{'all':!![]}];}_0x79daef=_['merge']({},_0x79daef,_0x3aa617[_0xc9d0('0x45')]);return db[_0xc9d0('0x46')][_0xc9d0('0x4e')](_0x79daef)[_0xc9d0('0x28')](handleEntityNotFound(_0x46e879,null))[_0xc9d0('0x28')](respondWithResult(_0x46e879,null))[_0xc9d0('0x48')](handleError(_0x46e879,null));};exports[_0xc9d0('0x4f')]=function(_0x27b5e5,_0x3fa59f){return db['Disposition'][_0xc9d0('0x4f')](_0x27b5e5[_0xc9d0('0x50')],{})[_0xc9d0('0x28')](function(_0x5396ff){var _0x103e87=_0x27b5e5[_0xc9d0('0x51')]['get']({'plain':!![]});if(!_0x103e87)throw new Error(_0xc9d0('0x52'));if(_0x103e87[_0xc9d0('0x53')]===_0xc9d0('0x51')){var _0x2f532f=_0x5396ff[_0xc9d0('0x2a')]({'plain':!![]});var _0x23da9b=_0xc9d0('0x54');return db[_0xc9d0('0x55')]['find']({'where':{'name':_0x23da9b,'userProfileId':_0x103e87[_0xc9d0('0x56')]},'raw':!![]})[_0xc9d0('0x28')](function(_0x2a2334){if(_0x2a2334&&_0x2a2334[_0xc9d0('0x57')]===0x0){return db[_0xc9d0('0x2b')][_0xc9d0('0x4f')]({'name':_0x2f532f[_0xc9d0('0x2f')],'resourceId':_0x2f532f['id'],'type':_0x2a2334[_0xc9d0('0x2f')],'sectionId':_0x2a2334['id']},{})[_0xc9d0('0x28')](function(){return _0x5396ff;});}else{return _0x5396ff;}})['catch'](function(_0xff76f){logger[_0xc9d0('0x2d')](_0xc9d0('0x58'),_0xff76f);throw _0xff76f;});}return _0x5396ff;})[_0xc9d0('0x28')](respondWithResult(_0x3fa59f,0xc9))[_0xc9d0('0x48')](handleError(_0x3fa59f,null));};exports[_0xc9d0('0x27')]=function(_0x4959e0,_0x58e550){if(_0x4959e0[_0xc9d0('0x50')]['id']){delete _0x4959e0['body']['id'];}return db[_0xc9d0('0x46')][_0xc9d0('0x4e')]({'where':{'id':_0x4959e0[_0xc9d0('0x4a')]['id']}})[_0xc9d0('0x28')](handleEntityNotFound(_0x58e550,null))[_0xc9d0('0x28')](saveUpdates(_0x4959e0[_0xc9d0('0x50')],null))[_0xc9d0('0x28')](respondWithResult(_0x58e550,null))['catch'](handleError(_0x58e550,null));};exports[_0xc9d0('0x29')]=function(_0x56e0d8,_0x589864){return db[_0xc9d0('0x46')][_0xc9d0('0x4e')]({'where':{'id':_0x56e0d8['params']['id']}})[_0xc9d0('0x28')](handleEntityNotFound(_0x589864,null))['then'](removeEntity(_0x589864,null))[_0xc9d0('0x48')](handleError(_0x589864,null));}; \ No newline at end of file +var _0xaa65=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','get','Dispositions','UserProfileResource','error','name','index','map','Disposition','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','include','rows','catch','show','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','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'];(function(_0x51639a,_0x35f006){var _0x3abae4=function(_0x89b35e){while(--_0x89b35e){_0x51639a['push'](_0x51639a['shift']());}};_0x3abae4(++_0x35f006);}(_0xaa65,0x90));var _0x5aa6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa65[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5aa6('0x0'));var rimraf=require(_0x5aa6('0x1'));var zipdir=require(_0x5aa6('0x2'));var jsonpatch=require(_0x5aa6('0x3'));var rp=require('request-promise');var moment=require(_0x5aa6('0x4'));var BPromise=require(_0x5aa6('0x5'));var Mustache=require(_0x5aa6('0x6'));var util=require(_0x5aa6('0x7'));var path=require(_0x5aa6('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5aa6('0x9'));var fs=require('fs');var fs_extra=require(_0x5aa6('0xa'));var _=require(_0x5aa6('0xb'));var squel=require(_0x5aa6('0xc'));var crypto=require('crypto');var jsforce=require(_0x5aa6('0xd'));var deskjs=require(_0x5aa6('0xe'));var toCsv=require(_0x5aa6('0xf'));var querystring=require(_0x5aa6('0x10'));var Papa=require(_0x5aa6('0x11'));var Redis=require(_0x5aa6('0x12'));var authService=require(_0x5aa6('0x13'));var qs=require(_0x5aa6('0x14'));var as=require(_0x5aa6('0x15'));var hardwareService=require(_0x5aa6('0x16'));var logger=require(_0x5aa6('0x17'))(_0x5aa6('0x18'));var utils=require('../../config/utils');var config=require(_0x5aa6('0x19'));var licenseUtil=require(_0x5aa6('0x1a'));var db=require(_0x5aa6('0x1b'))['db'];function respondWithStatusCode(_0x2705c1,_0x35f52a){_0x35f52a=_0x35f52a||0xcc;return function(_0x4eb241){if(_0x4eb241){return _0x2705c1[_0x5aa6('0x1c')](_0x35f52a);}return _0x2705c1['status'](_0x35f52a)[_0x5aa6('0x1d')]();};}function respondWithResult(_0x3b9975,_0x37b20b){_0x37b20b=_0x37b20b||0xc8;return function(_0xbe2686){if(_0xbe2686){return _0x3b9975['status'](_0x37b20b)['json'](_0xbe2686);}};}function respondWithFilteredResult(_0x54d11f,_0x434bb8){return function(_0x49bc20){if(_0x49bc20){var _0x29c809=typeof _0x434bb8[_0x5aa6('0x1e')]===_0x5aa6('0x1f')&&typeof _0x434bb8[_0x5aa6('0x20')]===_0x5aa6('0x1f');var _0x2dc6b5=_0x49bc20[_0x5aa6('0x21')];var _0x5370dd=_0x29c809?0x0:_0x434bb8['offset'];var _0x16f7e0=_0x29c809?_0x49bc20['count']:_0x434bb8[_0x5aa6('0x1e')]+_0x434bb8['limit'];var _0x223cc6;if(_0x16f7e0>=_0x2dc6b5){_0x16f7e0=_0x2dc6b5;_0x223cc6=0xc8;}else{_0x223cc6=0xce;}_0x54d11f[_0x5aa6('0x22')](_0x223cc6);return _0x54d11f[_0x5aa6('0x23')](_0x5aa6('0x24'),_0x5370dd+'-'+_0x16f7e0+'/'+_0x2dc6b5)['json'](_0x49bc20);}return null;};}function patchUpdates(_0x55d786){return function(_0x313b4b){try{jsonpatch[_0x5aa6('0x25')](_0x313b4b,_0x55d786,!![]);}catch(_0xdc492e){return BPromise[_0x5aa6('0x26')](_0xdc492e);}return _0x313b4b[_0x5aa6('0x27')]();};}function saveUpdates(_0x136f00,_0x27c317){return function(_0x535692){if(_0x535692){return _0x535692[_0x5aa6('0x28')](_0x136f00)['then'](function(_0x5eaddd){return _0x5eaddd;});}return null;};}function removeEntity(_0x296a11,_0x1e74d2){return function(_0x8c7319){if(_0x8c7319){return _0x8c7319[_0x5aa6('0x29')]()[_0x5aa6('0x2a')](function(){var _0x3066a6=_0x8c7319[_0x5aa6('0x2b')]({'plain':!![]});var _0x30a7da=_0x5aa6('0x2c');return db[_0x5aa6('0x2d')][_0x5aa6('0x29')]({'where':{'type':_0x30a7da,'resourceId':_0x3066a6['id']}})[_0x5aa6('0x2a')](function(){return _0x8c7319;});})[_0x5aa6('0x2a')](function(){_0x296a11[_0x5aa6('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x540789,_0x3f0623){return function(_0x546337){if(!_0x546337){_0x540789[_0x5aa6('0x1c')](0x194);}return _0x546337;};}function handleError(_0x35b48b,_0x26c401){_0x26c401=_0x26c401||0x1f4;return function(_0x5c3b1f){logger[_0x5aa6('0x2e')](_0x5c3b1f['stack']);if(_0x5c3b1f['name']){delete _0x5c3b1f[_0x5aa6('0x2f')];}_0x35b48b['status'](_0x26c401)['send'](_0x5c3b1f);};}exports[_0x5aa6('0x30')]=function(_0x33bd51,_0x4ac7c0){var _0x1ce7d1={},_0x407958={},_0x58ec31={'count':0x0,'rows':[]};var _0x5b9aff=_[_0x5aa6('0x31')](db[_0x5aa6('0x32')][_0x5aa6('0x33')],function(_0x39914f){return{'name':_0x39914f[_0x5aa6('0x34')],'type':_0x39914f[_0x5aa6('0x35')][_0x5aa6('0x36')]};});_0x407958[_0x5aa6('0x37')]=_[_0x5aa6('0x31')](_0x5b9aff,'name');_0x407958['query']=_[_0x5aa6('0x38')](_0x33bd51['query']);_0x407958['filters']=_['intersection'](_0x407958[_0x5aa6('0x37')],_0x407958['query']);_0x1ce7d1['attributes']=_[_0x5aa6('0x39')](_0x407958['model'],qs['fields'](_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x3b')]));_0x1ce7d1[_0x5aa6('0x3c')]=_0x1ce7d1[_0x5aa6('0x3c')]['length']?_0x1ce7d1[_0x5aa6('0x3c')]:_0x407958['model'];if(!_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x3d')](_0x5aa6('0x3e'))){_0x1ce7d1[_0x5aa6('0x20')]=qs[_0x5aa6('0x20')](_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x20')]);_0x1ce7d1[_0x5aa6('0x1e')]=qs[_0x5aa6('0x1e')](_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x1e')]);}_0x1ce7d1[_0x5aa6('0x3f')]=qs[_0x5aa6('0x40')](_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x40')]);_0x1ce7d1[_0x5aa6('0x41')]=qs[_0x5aa6('0x42')](_['pick'](_0x33bd51[_0x5aa6('0x3a')],_0x407958[_0x5aa6('0x42')]),_0x5b9aff);if(_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x43')]){_0x1ce7d1['where']=_['merge'](_0x1ce7d1[_0x5aa6('0x41')],{'$or':_[_0x5aa6('0x31')](_0x5b9aff,function(_0x372c95){if(_0x372c95[_0x5aa6('0x35')]!=='VIRTUAL'){var _0x4d19f9={};_0x4d19f9[_0x372c95[_0x5aa6('0x2f')]]={'$like':'%'+_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x43')]+'%'};return _0x4d19f9;}})});}_0x1ce7d1=_[_0x5aa6('0x44')]({},_0x1ce7d1,_0x33bd51['options']);var _0x57b48d={'where':_0x1ce7d1[_0x5aa6('0x41')]};return db[_0x5aa6('0x32')][_0x5aa6('0x21')](_0x57b48d)['then'](function(_0x5b6595){_0x58ec31[_0x5aa6('0x21')]=_0x5b6595;if(_0x33bd51[_0x5aa6('0x3a')][_0x5aa6('0x45')]){_0x1ce7d1[_0x5aa6('0x46')]=[{'all':!![]}];}return db[_0x5aa6('0x32')]['findAll'](_0x1ce7d1);})[_0x5aa6('0x2a')](function(_0x568afd){_0x58ec31[_0x5aa6('0x47')]=_0x568afd;return _0x58ec31;})[_0x5aa6('0x2a')](respondWithFilteredResult(_0x4ac7c0,_0x1ce7d1))[_0x5aa6('0x48')](handleError(_0x4ac7c0,null));};exports[_0x5aa6('0x49')]=function(_0x24665d,_0x4bb169){var _0x4e2487={'raw':!![],'where':{'id':_0x24665d['params']['id']}},_0x471d2c={};_0x471d2c[_0x5aa6('0x37')]=_['keys'](db[_0x5aa6('0x32')][_0x5aa6('0x33')]);_0x471d2c[_0x5aa6('0x3a')]=_[_0x5aa6('0x38')](_0x24665d[_0x5aa6('0x3a')]);_0x471d2c[_0x5aa6('0x42')]=_['intersection'](_0x471d2c[_0x5aa6('0x37')],_0x471d2c[_0x5aa6('0x3a')]);_0x4e2487[_0x5aa6('0x3c')]=_[_0x5aa6('0x39')](_0x471d2c[_0x5aa6('0x37')],qs['fields'](_0x24665d[_0x5aa6('0x3a')]['fields']));_0x4e2487[_0x5aa6('0x3c')]=_0x4e2487[_0x5aa6('0x3c')]['length']?_0x4e2487['attributes']:_0x471d2c[_0x5aa6('0x37')];if(_0x24665d[_0x5aa6('0x3a')][_0x5aa6('0x45')]){_0x4e2487[_0x5aa6('0x46')]=[{'all':!![]}];}_0x4e2487=_[_0x5aa6('0x44')]({},_0x4e2487,_0x24665d[_0x5aa6('0x4a')]);return db[_0x5aa6('0x32')][_0x5aa6('0x4b')](_0x4e2487)[_0x5aa6('0x2a')](handleEntityNotFound(_0x4bb169,null))[_0x5aa6('0x2a')](respondWithResult(_0x4bb169,null))[_0x5aa6('0x48')](handleError(_0x4bb169,null));};exports['create']=function(_0x5cfb93,_0xc33a2){return db[_0x5aa6('0x32')][_0x5aa6('0x4c')](_0x5cfb93[_0x5aa6('0x4d')],{})[_0x5aa6('0x2a')](function(_0x27bdf4){var _0xb62d69=_0x5cfb93[_0x5aa6('0x4e')][_0x5aa6('0x2b')]({'plain':!![]});if(!_0xb62d69)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb62d69[_0x5aa6('0x4f')]===_0x5aa6('0x4e')){var _0x28c4d7=_0x27bdf4[_0x5aa6('0x2b')]({'plain':!![]});var _0x22ae33=_0x5aa6('0x2c');return db[_0x5aa6('0x50')][_0x5aa6('0x4b')]({'where':{'name':_0x22ae33,'userProfileId':_0xb62d69[_0x5aa6('0x51')]},'raw':!![]})[_0x5aa6('0x2a')](function(_0xf56e54){if(_0xf56e54&&_0xf56e54[_0x5aa6('0x52')]===0x0){return db[_0x5aa6('0x2d')][_0x5aa6('0x4c')]({'name':_0x28c4d7[_0x5aa6('0x2f')],'resourceId':_0x28c4d7['id'],'type':_0xf56e54['name'],'sectionId':_0xf56e54['id']},{})['then'](function(){return _0x27bdf4;});}else{return _0x27bdf4;}})[_0x5aa6('0x48')](function(_0x385966){logger[_0x5aa6('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x385966);throw _0x385966;});}return _0x27bdf4;})[_0x5aa6('0x2a')](respondWithResult(_0xc33a2,0xc9))[_0x5aa6('0x48')](handleError(_0xc33a2,null));};exports[_0x5aa6('0x28')]=function(_0x2b5276,_0x451304){if(_0x2b5276[_0x5aa6('0x4d')]['id']){delete _0x2b5276[_0x5aa6('0x4d')]['id'];}return db[_0x5aa6('0x32')][_0x5aa6('0x4b')]({'where':{'id':_0x2b5276[_0x5aa6('0x53')]['id']}})[_0x5aa6('0x2a')](handleEntityNotFound(_0x451304,null))[_0x5aa6('0x2a')](saveUpdates(_0x2b5276[_0x5aa6('0x4d')],null))[_0x5aa6('0x2a')](respondWithResult(_0x451304,null))[_0x5aa6('0x48')](handleError(_0x451304,null));};exports[_0x5aa6('0x29')]=function(_0x205ac0,_0x2844f8){return db[_0x5aa6('0x32')][_0x5aa6('0x4b')]({'where':{'id':_0x205ac0[_0x5aa6('0x53')]['id']}})[_0x5aa6('0x2a')](handleEntityNotFound(_0x2844f8,null))[_0x5aa6('0x2a')](removeEntity(_0x2844f8,null))[_0x5aa6('0x48')](handleError(_0x2844f8,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index a2ddc89..30c78ea 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 _0xbe86=['request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice','ListId','ChatWebsiteId','name','MailAccountId','name_fax','FaxAccountId','name_openchannel','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x45bb8b,_0x411b88){var _0x4394db=function(_0xca5928){while(--_0xca5928){_0x45bb8b['push'](_0x45bb8b['shift']());}};_0x4394db(++_0x411b88);}(_0xbe86,0x1f4));var _0x6be8=function(_0x2962b4,_0x4b0786){_0x2962b4=_0x2962b4-0x0;var _0x411b7d=_0xbe86[_0x2962b4];return _0x411b7d;};'use strict';var _=require(_0x6be8('0x0'));var util=require(_0x6be8('0x1'));var logger=require(_0x6be8('0x2'))(_0x6be8('0x3'));var moment=require(_0x6be8('0x4'));var BPromise=require(_0x6be8('0x5'));var rp=require(_0x6be8('0x6'));var fs=require('fs');var path=require(_0x6be8('0x7'));var rimraf=require(_0x6be8('0x8'));var config=require(_0x6be8('0x9'));var attributes=require(_0x6be8('0xa'));module[_0x6be8('0xb')]=function(_0x42c020,_0x251d41){return _0x42c020[_0x6be8('0xc')]('Disposition',attributes,{'tableName':_0x6be8('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x6be8('0xe'),'fields':['name',_0x6be8('0xf')]},{'unique':!![],'name':'name_chat','fields':['name',_0x6be8('0x10')]},{'unique':!![],'name':'name_mail','fields':[_0x6be8('0x11'),_0x6be8('0x12')]},{'unique':!![],'name':'name_sms','fields':['name','SmsAccountId']},{'unique':!![],'name':_0x6be8('0x13'),'fields':[_0x6be8('0x11'),_0x6be8('0x14')]},{'unique':!![],'name':_0x6be8('0x15'),'fields':[_0x6be8('0x11'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x6be8('0x11'),_0x6be8('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdc9e=['FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','exports','define','tools_dispositions','name_voice','name','name_chat','MailAccountId','name_sms','name_fax'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdc9e,0x6e));var _0xedc9=function(_0x3cc912,_0x144b91){_0x3cc912=_0x3cc912-0x0;var _0x29024d=_0xdc9e[_0x3cc912];return _0x29024d;};'use strict';var _=require(_0xedc9('0x0'));var util=require(_0xedc9('0x1'));var logger=require(_0xedc9('0x2'))('api');var moment=require('moment');var BPromise=require(_0xedc9('0x3'));var rp=require(_0xedc9('0x4'));var fs=require('fs');var path=require(_0xedc9('0x5'));var rimraf=require(_0xedc9('0x6'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0xedc9('0x7')]=function(_0x18aeb8,_0x1042a9){return _0x18aeb8[_0xedc9('0x8')]('Disposition',attributes,{'tableName':_0xedc9('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xedc9('0xa'),'fields':[_0xedc9('0xb'),'ListId']},{'unique':!![],'name':_0xedc9('0xc'),'fields':[_0xedc9('0xb'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0xedc9('0xb'),_0xedc9('0xd')]},{'unique':!![],'name':_0xedc9('0xe'),'fields':[_0xedc9('0xb'),'SmsAccountId']},{'unique':!![],'name':_0xedc9('0xf'),'fields':[_0xedc9('0xb'),_0xedc9('0x10')]},{'unique':!![],'name':_0xedc9('0x11'),'fields':['name',_0xedc9('0x12')]},{'unique':!![],'name':_0xedc9('0x13'),'fields':[_0xedc9('0xb'),_0xedc9('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 2b47cab..66fc795 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(_0x26f262,_0x1472e1){var _0x138a77=function(_0x31d40a){while(--_0x31d40a){_0x26f262['push'](_0x26f262['shift']());}};_0x138a77(++_0x1472e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x414e30,_0x379e16){var _0x5d14c3=function(_0x114a5d){while(--_0x114a5d){_0x414e30['push'](_0x414e30['shift']());}};_0x5d14c3(++_0x379e16);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 16c8ddd..8261eb1 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 _0xa3fd=['../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1ed034,_0x5d495d){var _0x4a82b7=function(_0x348231){while(--_0x348231){_0x1ed034['push'](_0x1ed034['shift']());}};_0x4a82b7(++_0x5d495d);}(_0xa3fd,0x1c2));var _0xda3f=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0xa3fd[_0x276468];return _0x36dc3a;};'use strict';var multer=require('multer');var util=require(_0xda3f('0x0'));var path=require('path');var timeout=require(_0xda3f('0x1'));var express=require(_0xda3f('0x2'));var router=express[_0xda3f('0x3')]();var fs_extra=require(_0xda3f('0x4'));var auth=require(_0xda3f('0x5'));var interaction=require(_0xda3f('0x6'));var config=require(_0xda3f('0x7'));var controller=require(_0xda3f('0x8'));router[_0xda3f('0x9')]('/',auth[_0xda3f('0xa')](),controller[_0xda3f('0xb')]);router['get'](_0xda3f('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xda3f('0xd')]('/',auth[_0xda3f('0xa')](),controller[_0xda3f('0xe')]);router['put'](_0xda3f('0xc'),auth[_0xda3f('0xa')](),controller[_0xda3f('0xf')]);router[_0xda3f('0x10')]('/:id',auth[_0xda3f('0xa')](),controller[_0xda3f('0x11')]);module[_0xda3f('0x12')]=router; \ No newline at end of file +var _0x2af7=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get'];(function(_0x183279,_0x4e7670){var _0x50e121=function(_0x2508a0){while(--_0x2508a0){_0x183279['push'](_0x183279['shift']());}};_0x50e121(++_0x4e7670);}(_0x2af7,0x199));var _0x72af=function(_0x4b5b22,_0x2d93f5){_0x4b5b22=_0x4b5b22-0x0;var _0x2285e8=_0x2af7[_0x4b5b22];return _0x2285e8;};'use strict';var multer=require(_0x72af('0x0'));var util=require(_0x72af('0x1'));var path=require('path');var timeout=require(_0x72af('0x2'));var express=require(_0x72af('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x72af('0x4'));var interaction=require(_0x72af('0x5'));var config=require(_0x72af('0x6'));var controller=require(_0x72af('0x7'));router[_0x72af('0x8')]('/',auth[_0x72af('0x9')](),controller[_0x72af('0xa')]);router[_0x72af('0x8')](_0x72af('0xb'),auth[_0x72af('0x9')](),controller[_0x72af('0xc')]);router[_0x72af('0xd')]('/',auth['isAuthenticated'](),controller[_0x72af('0xe')]);router[_0x72af('0xf')](_0x72af('0xb'),auth[_0x72af('0x9')](),controller['update']);router[_0x72af('0x10')](_0x72af('0xb'),auth[_0x72af('0x9')](),controller[_0x72af('0x11')]);module[_0x72af('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 888bed7..9ea903e 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 _0x4074=['INTEGER','SIP','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','14400','12000','v17,v27,v29'];(function(_0x1e3e30,_0x5547cd){var _0x4929c8=function(_0x2b61e4){while(--_0x2b61e4){_0x1e3e30['push'](_0x1e3e30['shift']());}};_0x4929c8(++_0x5547cd);}(_0x4074,0xf0));var _0x4407=function(_0x4e54f0,_0x2c6802){_0x4e54f0=_0x4e54f0-0x0;var _0x35b25a=_0x4074[_0x4e54f0];return _0x35b25a;};'use strict';var Sequelize=require(_0x4407('0x0'));module[_0x4407('0x1')]={'name':{'type':Sequelize[_0x4407('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x4407('0x3')](_0x4407('0x4'),'no'),'defaultValue':_0x4407('0x4')},'headerinfo':{'type':Sequelize[_0x4407('0x2')],'defaultValue':_0x4407('0x5')},'localstationid':{'type':Sequelize[_0x4407('0x2')],'unique':_0x4407('0x6')},'minrate':{'type':Sequelize[_0x4407('0x3')](_0x4407('0x7'),_0x4407('0x8'),'7200',_0x4407('0x9'),'12000',_0x4407('0xa')),'defaultValue':_0x4407('0x8')},'maxrate':{'type':Sequelize[_0x4407('0x3')]('2400','4800','7200',_0x4407('0x9'),_0x4407('0xb'),_0x4407('0xa')),'defaultValue':_0x4407('0xa')},'modem':{'type':Sequelize[_0x4407('0x2')],'defaultValue':_0x4407('0xc')},'gateway':{'type':Sequelize[_0x4407('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4407('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x4407('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4407('0x3')](_0x4407('0xe'),'IAX',_0x4407('0xf'),_0x4407('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x4407('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4407('0x11');}},'notificationSound':{'type':Sequelize[_0x4407('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4407('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4407('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4407('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4407('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4407('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4407('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4407('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x4407('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x4407('0x12')],'defaultValue':![],'comment':_0x4407('0x14'),'set':function(_0x12952e){if(!_0x12952e)this['setDataValue'](_0x4407('0x15'),null);this['setDataValue'](_0x4407('0x16'),_0x12952e);}}}; \ No newline at end of file +var _0xe3da=['INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','14400','12000','v17,v27,v29'];(function(_0x138d06,_0x33edf2){var _0x1a01eb=function(_0x387acb){while(--_0x387acb){_0x138d06['push'](_0x138d06['shift']());}};_0x1a01eb(++_0x33edf2);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xae3d('0x0'));module[_0xae3d('0x1')]={'name':{'type':Sequelize[_0xae3d('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xae3d('0x2')]},'ecm':{'type':Sequelize[_0xae3d('0x3')](_0xae3d('0x4'),'no'),'defaultValue':_0xae3d('0x4')},'headerinfo':{'type':Sequelize[_0xae3d('0x2')],'defaultValue':_0xae3d('0x5')},'localstationid':{'type':Sequelize[_0xae3d('0x2')],'unique':_0xae3d('0x6')},'minrate':{'type':Sequelize[_0xae3d('0x3')](_0xae3d('0x7'),_0xae3d('0x8'),_0xae3d('0x9'),_0xae3d('0xa'),'12000',_0xae3d('0xb')),'defaultValue':_0xae3d('0x8')},'maxrate':{'type':Sequelize['ENUM']('2400',_0xae3d('0x8'),_0xae3d('0x9'),_0xae3d('0xa'),_0xae3d('0xc'),_0xae3d('0xb')),'defaultValue':_0xae3d('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xae3d('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xae3d('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xae3d('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xae3d('0x3')](_0xae3d('0xf'),'IAX',_0xae3d('0x10'),_0xae3d('0x11')),'defaultValue':_0xae3d('0xf')},'key':{'type':Sequelize[_0xae3d('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xae3d('0x12')],'defaultValue':function(){return _0xae3d('0x13');}},'notificationSound':{'type':Sequelize[_0xae3d('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xae3d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xae3d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xae3d('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xae3d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xae3d('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xae3d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xae3d('0x15')},'mandatoryDisposition':{'type':Sequelize[_0xae3d('0x14')],'defaultValue':![],'comment':_0xae3d('0x16'),'set':function(_0x5303c2){if(!_0x5303c2)this[_0xae3d('0x17')](_0xae3d('0x18'),null);this['setDataValue']('mandatoryDisposition',_0x5303c2);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 8459932..1c49db5 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 _0x3d11=['fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./faxAccount.socket','register','jayson/promise','client','http','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','status','json','undefined','limit','count','offset','Content-Range','reject','update','destroy','get','FaxAccounts','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','user','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','nolimit','FaxAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','getApplications','from-voip-provider','exten','localstationid','app','system','description','Answer','push','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','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','omit','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from'];(function(_0x4c2ac0,_0x2371b9){var _0x2eee06=function(_0x524478){while(--_0x524478){_0x4c2ac0['push'](_0x4c2ac0['shift']());}};_0x2eee06(++_0x2371b9);}(_0x3d11,0x195));var _0x13d1=function(_0x17e005,_0x961d3){_0x17e005=_0x17e005-0x0;var _0x6d0f1a=_0x3d11[_0x17e005];return _0x6d0f1a;};'use strict';var emlformat=require(_0x13d1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x13d1('0x1'));var rp=require('request-promise');var moment=require(_0x13d1('0x2'));var BPromise=require(_0x13d1('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x13d1('0x4'));var sox=require(_0x13d1('0x5'));var csv=require(_0x13d1('0x6'));var ejs=require(_0x13d1('0x7'));var fs=require('fs');var fs_extra=require(_0x13d1('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x13d1('0x9'));var jsforce=require(_0x13d1('0xa'));var deskjs=require(_0x13d1('0xb'));var toCsv=require('to-csv');var querystring=require(_0x13d1('0xc'));var Papa=require(_0x13d1('0xd'));var Redis=require(_0x13d1('0xe'));var authService=require(_0x13d1('0xf'));var qs=require(_0x13d1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x13d1('0x11'));var logger=require(_0x13d1('0x12'))(_0x13d1('0x13'));var utils=require(_0x13d1('0x14'));var config=require(_0x13d1('0x15'));var licenseUtil=require(_0x13d1('0x16'));var db=require('../../mysqldb')['db'];config[_0x13d1('0x17')]=_['defaults'](config['redis'],{'host':_0x13d1('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x13d1('0x17')]));require(_0x13d1('0x19'))[_0x13d1('0x1a')](socket);var jayson=require(_0x13d1('0x1b'));var client=jayson[_0x13d1('0x1c')][_0x13d1('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x13d1('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x53ba30,_0x3fe42b,_0xfd2ddf,_0x2682c5){return new BPromise(function(_0x36f779,_0x40a5a1){var _0x11fa82=_0x2682c5||client;return _0x11fa82['request'](_0x53ba30,_0xfd2ddf)[_0x13d1('0x1e')](function(_0x5c7f73){logger[_0x13d1('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x3fe42b,'request\x20sent');logger[_0x13d1('0x20')](_0x13d1('0x21'),_0x3fe42b,_0x13d1('0x22'),JSON[_0x13d1('0x23')](_0x5c7f73));if(_0x5c7f73['error']){if(_0x5c7f73[_0x13d1('0x24')]['code']===0x1f4){logger['error'](_0x13d1('0x25'),_0x3fe42b,_0x5c7f73[_0x13d1('0x24')][_0x13d1('0x26')]);return _0x40a5a1(_0x5c7f73[_0x13d1('0x24')][_0x13d1('0x26')]);}logger[_0x13d1('0x24')]('FaxAccount,\x20%s,\x20%s',_0x3fe42b,_0x5c7f73['error'][_0x13d1('0x26')]);return _0x36f779(_0x5c7f73[_0x13d1('0x24')]['message']);}else{logger[_0x13d1('0x1f')](_0x13d1('0x25'),_0x3fe42b,_0x13d1('0x22'));_0x36f779(_0x5c7f73[_0x13d1('0x27')][_0x13d1('0x26')]);}})[_0x13d1('0x28')](function(_0x49ca56){logger[_0x13d1('0x24')]('FaxAccount,\x20%s,\x20%s',_0x3fe42b,_0x49ca56);_0x40a5a1(_0x49ca56);});});}function respondWithStatusCode(_0x54d792,_0x1fa50a){_0x1fa50a=_0x1fa50a||0xcc;return function(_0x1a7769){if(_0x1a7769){return _0x54d792['sendStatus'](_0x1fa50a);}return _0x54d792[_0x13d1('0x29')](_0x1fa50a)['end']();};}function respondWithResult(_0xde1058,_0x1160b1){_0x1160b1=_0x1160b1||0xc8;return function(_0x392b20){if(_0x392b20){return _0xde1058[_0x13d1('0x29')](_0x1160b1)[_0x13d1('0x2a')](_0x392b20);}};}function respondWithFilteredResult(_0x359ce4,_0x336d68){return function(_0x5bf6c1){if(_0x5bf6c1){var _0x6822d8=typeof _0x336d68['offset']===_0x13d1('0x2b')&&typeof _0x336d68[_0x13d1('0x2c')]===_0x13d1('0x2b');var _0x4664f7=_0x5bf6c1[_0x13d1('0x2d')];var _0x2ad4bf=_0x6822d8?0x0:_0x336d68[_0x13d1('0x2e')];var _0xdc1110=_0x6822d8?_0x5bf6c1[_0x13d1('0x2d')]:_0x336d68[_0x13d1('0x2e')]+_0x336d68[_0x13d1('0x2c')];var _0x212455;if(_0xdc1110>=_0x4664f7){_0xdc1110=_0x4664f7;_0x212455=0xc8;}else{_0x212455=0xce;}_0x359ce4['status'](_0x212455);return _0x359ce4['set'](_0x13d1('0x2f'),_0x2ad4bf+'-'+_0xdc1110+'/'+_0x4664f7)[_0x13d1('0x2a')](_0x5bf6c1);}return null;};}function patchUpdates(_0x11da38){return function(_0x156549){try{jsonpatch['apply'](_0x156549,_0x11da38,!![]);}catch(_0x1ef0bc){return BPromise[_0x13d1('0x30')](_0x1ef0bc);}return _0x156549['save']();};}function saveUpdates(_0x2a4dc1,_0x48d1ff){return function(_0x3c60ab){if(_0x3c60ab){return _0x3c60ab[_0x13d1('0x31')](_0x2a4dc1)['then'](function(_0x66541a){return _0x66541a;});}return null;};}function removeEntity(_0x2b0a66,_0x4dbb56){return function(_0x459cd6){if(_0x459cd6){return _0x459cd6[_0x13d1('0x32')]()[_0x13d1('0x1e')](function(){var _0xaa796c=_0x459cd6[_0x13d1('0x33')]({'plain':!![]});var _0x169f71=_0x13d1('0x34');return db['UserProfileResource'][_0x13d1('0x32')]({'where':{'type':_0x169f71,'resourceId':_0xaa796c['id']}})[_0x13d1('0x1e')](function(){return _0x459cd6;});})[_0x13d1('0x1e')](function(){_0x2b0a66['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f9e3b,_0x49f9fd){return function(_0x33523a){if(!_0x33523a){_0x1f9e3b[_0x13d1('0x35')](0x194);}return _0x33523a;};}function handleError(_0x21e8d1,_0x203191){_0x203191=_0x203191||0x1f4;return function(_0x38edf9){logger[_0x13d1('0x24')](_0x38edf9[_0x13d1('0x36')]);if(_0x38edf9[_0x13d1('0x37')]){delete _0x38edf9['name'];}_0x21e8d1[_0x13d1('0x29')](_0x203191)[_0x13d1('0x38')](_0x38edf9);};}exports['index']=function(_0x320d0c,_0x1a3248){var _0x4bc2c0={'include':[{'model':db[_0x13d1('0x39')],'as':_0x13d1('0x3a')}]},_0x5764c7={},_0x555755={'count':0x0,'rows':[]};var _0x54dc9b=_[_0x13d1('0x3b')](db[_0x13d1('0x3c')]['rawAttributes'],function(_0x568777){return{'name':_0x568777['fieldName'],'type':_0x568777['type'][_0x13d1('0x3d')]};});_0x5764c7['model']=_[_0x13d1('0x3b')](_0x54dc9b,_0x13d1('0x37'));_0x5764c7[_0x13d1('0x3e')]=_[_0x13d1('0x3f')](_0x320d0c['query']);_0x5764c7['filters']=_[_0x13d1('0x40')](_0x5764c7[_0x13d1('0x41')],_0x5764c7[_0x13d1('0x3e')]);_0x4bc2c0[_0x13d1('0x42')]=_[_0x13d1('0x40')](_0x5764c7[_0x13d1('0x41')],qs[_0x13d1('0x43')](_0x320d0c[_0x13d1('0x3e')][_0x13d1('0x43')]));_0x4bc2c0[_0x13d1('0x42')]=_0x4bc2c0[_0x13d1('0x42')][_0x13d1('0x44')]?_0x4bc2c0[_0x13d1('0x42')]:_0x5764c7[_0x13d1('0x41')];if(!_0x320d0c[_0x13d1('0x3e')][_0x13d1('0x45')]('nolimit')){_0x4bc2c0[_0x13d1('0x2c')]=qs[_0x13d1('0x2c')](_0x320d0c[_0x13d1('0x3e')][_0x13d1('0x2c')]);_0x4bc2c0['offset']=qs[_0x13d1('0x2e')](_0x320d0c[_0x13d1('0x3e')][_0x13d1('0x2e')]);}_0x4bc2c0[_0x13d1('0x46')]=qs[_0x13d1('0x47')](_0x320d0c[_0x13d1('0x3e')][_0x13d1('0x47')]);_0x4bc2c0['where']=qs[_0x13d1('0x48')](_[_0x13d1('0x49')](_0x320d0c['query'],_0x5764c7[_0x13d1('0x48')]),_0x54dc9b);if(_0x320d0c[_0x13d1('0x3e')][_0x13d1('0x4a')]){_0x4bc2c0['where']=_['merge'](_0x4bc2c0[_0x13d1('0x4b')],{'$or':_[_0x13d1('0x3b')](_0x54dc9b,function(_0x5d38d2){if(_0x5d38d2[_0x13d1('0x4c')]!==_0x13d1('0x4d')){var _0x15d19b={};_0x15d19b[_0x5d38d2['name']]={'$like':'%'+_0x320d0c[_0x13d1('0x3e')][_0x13d1('0x4a')]+'%'};return _0x15d19b;}})});}_0x4bc2c0=_[_0x13d1('0x4e')]({},_0x4bc2c0,_0x320d0c[_0x13d1('0x4f')]);var _0x3c63fc={'where':_0x4bc2c0['where']};return db[_0x13d1('0x3c')][_0x13d1('0x2d')](_0x3c63fc)['then'](function(_0x51306e){_0x555755[_0x13d1('0x2d')]=_0x51306e;if(_0x320d0c[_0x13d1('0x3e')][_0x13d1('0x50')]){_0x4bc2c0[_0x13d1('0x51')]=[{'all':!![]}];}return db[_0x13d1('0x3c')][_0x13d1('0x52')](_0x4bc2c0);})['then'](function(_0xb322d9){_0x555755[_0x13d1('0x53')]=_0xb322d9;return _0x555755;})[_0x13d1('0x1e')](respondWithFilteredResult(_0x1a3248,_0x4bc2c0))[_0x13d1('0x28')](handleError(_0x1a3248,null));};exports[_0x13d1('0x54')]=function(_0x25f3c8,_0x1c6975){var _0x5cfb1c={'raw':![],'where':{'id':_0x25f3c8[_0x13d1('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x13d1('0x3a')}]},_0x51fd3c={};_0x51fd3c['model']=_[_0x13d1('0x3f')](db[_0x13d1('0x3c')][_0x13d1('0x56')]);_0x51fd3c[_0x13d1('0x3e')]=_[_0x13d1('0x3f')](_0x25f3c8['query']);_0x51fd3c[_0x13d1('0x48')]=_[_0x13d1('0x40')](_0x51fd3c[_0x13d1('0x41')],_0x51fd3c[_0x13d1('0x3e')]);_0x5cfb1c['attributes']=_[_0x13d1('0x40')](_0x51fd3c[_0x13d1('0x41')],qs[_0x13d1('0x43')](_0x25f3c8[_0x13d1('0x3e')][_0x13d1('0x43')]));_0x5cfb1c[_0x13d1('0x42')]=_0x5cfb1c[_0x13d1('0x42')][_0x13d1('0x44')]?_0x5cfb1c[_0x13d1('0x42')]:_0x51fd3c[_0x13d1('0x41')];if(_0x25f3c8[_0x13d1('0x3e')][_0x13d1('0x50')]){_0x5cfb1c[_0x13d1('0x51')]=[{'all':!![]}];}_0x5cfb1c=_[_0x13d1('0x4e')]({},_0x5cfb1c,_0x25f3c8[_0x13d1('0x4f')]);return db['FaxAccount'][_0x13d1('0x57')](_0x5cfb1c)[_0x13d1('0x1e')](handleEntityNotFound(_0x1c6975,null))['then'](respondWithResult(_0x1c6975,null))['catch'](handleError(_0x1c6975,null));};exports['create']=function(_0x20a369,_0x32faa5){return db[_0x13d1('0x3c')]['create'](_0x20a369[_0x13d1('0x58')],{})[_0x13d1('0x1e')](function(_0x30d652){var _0x1d4ae8=_0x20a369[_0x13d1('0x59')]['get']({'plain':!![]});if(!_0x1d4ae8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d4ae8['role']==='user'){var _0x4360a0=_0x30d652[_0x13d1('0x33')]({'plain':!![]});var _0x80ce27=_0x13d1('0x34');return db[_0x13d1('0x5a')][_0x13d1('0x57')]({'where':{'name':_0x80ce27,'userProfileId':_0x1d4ae8[_0x13d1('0x5b')]},'raw':!![]})[_0x13d1('0x1e')](function(_0x31f819){if(_0x31f819&&_0x31f819['autoAssociation']===0x0){return db[_0x13d1('0x5c')][_0x13d1('0x5d')]({'name':_0x4360a0['name'],'resourceId':_0x4360a0['id'],'type':_0x31f819[_0x13d1('0x37')],'sectionId':_0x31f819['id']},{})[_0x13d1('0x1e')](function(){return _0x30d652;});}else{return _0x30d652;}})[_0x13d1('0x28')](function(_0x13c2f5){logger[_0x13d1('0x24')](_0x13d1('0x5e'),_0x13c2f5);throw _0x13c2f5;});}return _0x30d652;})[_0x13d1('0x1e')](respondWithResult(_0x32faa5,0xc9))[_0x13d1('0x28')](handleError(_0x32faa5,null));};exports['update']=function(_0x1dc6a2,_0x3d5e1f){if(_0x1dc6a2[_0x13d1('0x58')]['id']){delete _0x1dc6a2[_0x13d1('0x58')]['id'];}return db[_0x13d1('0x3c')][_0x13d1('0x57')]({'where':{'id':_0x1dc6a2[_0x13d1('0x55')]['id']},'include':[{'model':db[_0x13d1('0x39')],'as':_0x13d1('0x3a')}]})[_0x13d1('0x1e')](handleEntityNotFound(_0x3d5e1f,null))[_0x13d1('0x1e')](saveUpdates(_0x1dc6a2[_0x13d1('0x58')],null))[_0x13d1('0x1e')](respondWithResult(_0x3d5e1f,null))[_0x13d1('0x28')](handleError(_0x3d5e1f,null));};exports[_0x13d1('0x32')]=function(_0x17f156,_0x23f7ba){return db['FaxAccount'][_0x13d1('0x57')]({'where':{'id':_0x17f156[_0x13d1('0x55')]['id']}})[_0x13d1('0x1e')](handleEntityNotFound(_0x23f7ba,null))['then'](removeEntity(_0x23f7ba,null))[_0x13d1('0x28')](handleError(_0x23f7ba,null));};exports[_0x13d1('0x5f')]=function(_0x25f41e,_0x1a1cf0){return db[_0x13d1('0x3c')][_0x13d1('0x5f')]()[_0x13d1('0x1e')](respondWithResult(_0x1a1cf0,null))[_0x13d1('0x28')](handleError(_0x1a1cf0,null));};exports[_0x13d1('0x60')]=function(_0x18bbd5,_0xb83e00,_0x5b8c28){if(_0x18bbd5[_0x13d1('0x58')]['id']){delete _0x18bbd5[_0x13d1('0x58')]['id'];}return db[_0x13d1('0x3c')]['find']({'where':{'id':_0x18bbd5[_0x13d1('0x55')]['id']}})[_0x13d1('0x1e')](handleEntityNotFound(_0xb83e00,null))[_0x13d1('0x1e')](function(_0x4605bf){if(_0x4605bf){_0x18bbd5['body']['FaxAccountId']=_0x4605bf['id'];return db['Disposition'][_0x13d1('0x5d')](_0x18bbd5[_0x13d1('0x58')]);}})[_0x13d1('0x1e')](respondWithResult(_0xb83e00,null))[_0x13d1('0x28')](handleError(_0xb83e00,null));};exports[_0x13d1('0x61')]=function(_0x57482b,_0x364492,_0x13efad){var _0x50fd90={'raw':![],'where':{}};var _0x222dc4={};var _0x4043af={'count':0x0,'rows':[]};return db['FaxAccount'][_0x13d1('0x62')]({'where':{'id':_0x57482b['params']['id']}})[_0x13d1('0x1e')](handleEntityNotFound(_0x364492,null))[_0x13d1('0x1e')](function(_0x3eed9d){if(_0x3eed9d){_0x222dc4[_0x13d1('0x41')]=_['keys'](db[_0x13d1('0x63')][_0x13d1('0x56')]);_0x222dc4['query']=_[_0x13d1('0x3f')](_0x57482b[_0x13d1('0x3e')]);_0x222dc4[_0x13d1('0x48')]=_[_0x13d1('0x40')](_0x222dc4['model'],_0x222dc4[_0x13d1('0x3e')]);_0x50fd90[_0x13d1('0x42')]=_['intersection'](_0x222dc4[_0x13d1('0x41')],qs['fields'](_0x57482b[_0x13d1('0x3e')][_0x13d1('0x43')]));_0x50fd90[_0x13d1('0x42')]=_0x50fd90[_0x13d1('0x42')][_0x13d1('0x44')]?_0x50fd90[_0x13d1('0x42')]:_0x222dc4[_0x13d1('0x41')];if(!_0x57482b[_0x13d1('0x3e')]['hasOwnProperty'](_0x13d1('0x64'))){_0x50fd90[_0x13d1('0x2c')]=qs[_0x13d1('0x2c')](_0x57482b[_0x13d1('0x3e')][_0x13d1('0x2c')]);_0x50fd90['offset']=qs[_0x13d1('0x2e')](_0x57482b['query'][_0x13d1('0x2e')]);}_0x50fd90[_0x13d1('0x46')]=qs[_0x13d1('0x47')](_0x57482b['query'][_0x13d1('0x47')]);_0x50fd90[_0x13d1('0x4b')]=qs[_0x13d1('0x48')](_[_0x13d1('0x49')](_0x57482b[_0x13d1('0x3e')],_0x222dc4['filters']));_0x50fd90[_0x13d1('0x4b')][_0x13d1('0x65')]=_0x3eed9d['id'];if(_0x57482b[_0x13d1('0x3e')][_0x13d1('0x4a')]){_0x50fd90[_0x13d1('0x4b')]=_['merge'](_0x50fd90[_0x13d1('0x4b')],{'$or':_[_0x13d1('0x3b')](_0x50fd90[_0x13d1('0x42')],function(_0x4d29bb){var _0x3641d7={};_0x3641d7[_0x4d29bb]={'$like':'%'+_0x57482b[_0x13d1('0x3e')][_0x13d1('0x4a')]+'%'};return _0x3641d7;})});}_0x50fd90=_[_0x13d1('0x4e')]({},_0x50fd90,_0x57482b[_0x13d1('0x4f')]);return db[_0x13d1('0x63')][_0x13d1('0x2d')]({'where':_0x50fd90['where']})[_0x13d1('0x1e')](function(_0x2d760c){_0x4043af['count']=_0x2d760c;if(_0x57482b[_0x13d1('0x3e')][_0x13d1('0x50')]){_0x50fd90[_0x13d1('0x51')]=[{'all':!![]}];}return db[_0x13d1('0x63')][_0x13d1('0x52')](_0x50fd90);})[_0x13d1('0x1e')](function(_0x56331c){_0x4043af[_0x13d1('0x53')]=_0x56331c;return _0x4043af;});}})[_0x13d1('0x1e')](respondWithFilteredResult(_0x364492,_0x50fd90))[_0x13d1('0x28')](handleError(_0x364492,null));};exports[_0x13d1('0x66')]=function(_0x29b9ac,_0x4ab881,_0x570828){return db[_0x13d1('0x3c')][_0x13d1('0x57')]({'where':{'id':_0x29b9ac[_0x13d1('0x55')]['id']}})[_0x13d1('0x1e')](handleEntityNotFound(_0x4ab881,null))[_0x13d1('0x1e')](function(_0x4f515b){if(_0x4f515b){return _0x4f515b[_0x13d1('0x66')](_0x29b9ac[_0x13d1('0x3e')][_0x13d1('0x67')]);}})[_0x13d1('0x1e')](respondWithStatusCode(_0x4ab881,null))['catch'](handleError(_0x4ab881,null));};exports[_0x13d1('0x68')]=function(_0x5824de,_0xb785e0,_0x2695de){if(_0x5824de[_0x13d1('0x58')]['id']){delete _0x5824de['body']['id'];}return db[_0x13d1('0x3c')][_0x13d1('0x57')]({'where':{'id':_0x5824de['params']['id']}})[_0x13d1('0x1e')](handleEntityNotFound(_0xb785e0,null))[_0x13d1('0x1e')](function(_0x49837f){if(_0x49837f){_0x5824de[_0x13d1('0x58')][_0x13d1('0x65')]=_0x49837f['id'];return db[_0x13d1('0x69')]['create'](_0x5824de[_0x13d1('0x58')]);}})[_0x13d1('0x1e')](respondWithResult(_0xb785e0,null))[_0x13d1('0x28')](handleError(_0xb785e0,null));};exports[_0x13d1('0x6a')]=function(_0x3121fb,_0x57fdf6,_0x293920){var _0x292207={'raw':![],'where':{}};var _0x4d4e40={};var _0x3006bb={'count':0x0,'rows':[]};return db[_0x13d1('0x3c')][_0x13d1('0x62')]({'where':{'id':_0x3121fb['params']['id']}})[_0x13d1('0x1e')](handleEntityNotFound(_0x57fdf6,null))[_0x13d1('0x1e')](function(_0x5367d3){if(_0x5367d3){_0x4d4e40[_0x13d1('0x41')]=_[_0x13d1('0x3f')](db['CannedAnswer'][_0x13d1('0x56')]);_0x4d4e40[_0x13d1('0x3e')]=_['keys'](_0x3121fb[_0x13d1('0x3e')]);_0x4d4e40[_0x13d1('0x48')]=_[_0x13d1('0x40')](_0x4d4e40[_0x13d1('0x41')],_0x4d4e40[_0x13d1('0x3e')]);_0x292207[_0x13d1('0x42')]=_[_0x13d1('0x40')](_0x4d4e40[_0x13d1('0x41')],qs[_0x13d1('0x43')](_0x3121fb[_0x13d1('0x3e')]['fields']));_0x292207[_0x13d1('0x42')]=_0x292207[_0x13d1('0x42')][_0x13d1('0x44')]?_0x292207[_0x13d1('0x42')]:_0x4d4e40[_0x13d1('0x41')];if(!_0x3121fb[_0x13d1('0x3e')]['hasOwnProperty'](_0x13d1('0x64'))){_0x292207[_0x13d1('0x2c')]=qs[_0x13d1('0x2c')](_0x3121fb['query']['limit']);_0x292207['offset']=qs['offset'](_0x3121fb['query'][_0x13d1('0x2e')]);}_0x292207[_0x13d1('0x46')]=qs[_0x13d1('0x47')](_0x3121fb[_0x13d1('0x3e')][_0x13d1('0x47')]);_0x292207['where']=qs[_0x13d1('0x48')](_['pick'](_0x3121fb[_0x13d1('0x3e')],_0x4d4e40[_0x13d1('0x48')]));_0x292207['where'][_0x13d1('0x65')]=_0x5367d3['id'];if(_0x3121fb[_0x13d1('0x3e')][_0x13d1('0x4a')]){_0x292207[_0x13d1('0x4b')]=_[_0x13d1('0x4e')](_0x292207[_0x13d1('0x4b')],{'$or':_[_0x13d1('0x3b')](_0x292207[_0x13d1('0x42')],function(_0x597a61){var _0x5b3195={};_0x5b3195[_0x597a61]={'$like':'%'+_0x3121fb[_0x13d1('0x3e')][_0x13d1('0x4a')]+'%'};return _0x5b3195;})});}_0x292207=_[_0x13d1('0x4e')]({},_0x292207,_0x3121fb[_0x13d1('0x4f')]);return db['CannedAnswer'][_0x13d1('0x2d')]({'where':_0x292207[_0x13d1('0x4b')]})[_0x13d1('0x1e')](function(_0x1d36ae){_0x3006bb['count']=_0x1d36ae;if(_0x3121fb[_0x13d1('0x3e')][_0x13d1('0x50')]){_0x292207['include']=[{'all':!![]}];}return db[_0x13d1('0x69')][_0x13d1('0x52')](_0x292207);})[_0x13d1('0x1e')](function(_0x44a950){_0x3006bb[_0x13d1('0x53')]=_0x44a950;return _0x3006bb;});}})[_0x13d1('0x1e')](respondWithFilteredResult(_0x57fdf6,_0x292207))['catch'](handleError(_0x57fdf6,null));};exports[_0x13d1('0x6b')]=function(_0x33be12,_0x4245c3,_0x164b11){return db[_0x13d1('0x3c')][_0x13d1('0x57')]({'where':{'id':_0x33be12['params']['id']}})[_0x13d1('0x1e')](handleEntityNotFound(_0x4245c3,null))['then'](function(_0x34d551){if(_0x34d551){return _0x34d551['removeAnswers'](_0x33be12['query'][_0x13d1('0x67')]);}})[_0x13d1('0x1e')](respondWithStatusCode(_0x4245c3,null))[_0x13d1('0x28')](handleError(_0x4245c3,null));};exports[_0x13d1('0x6c')]=function(_0x469f9d,_0x4eb498,_0x3da187){return db[_0x13d1('0x6d')][_0x13d1('0x57')]({'where':{'id':_0x469f9d[_0x13d1('0x55')]['id']}})[_0x13d1('0x1e')](handleEntityNotFound(_0x4eb498,null))['then'](function(_0x1649ad){if(_0x1649ad){return _0x1649ad[_0x13d1('0x6c')](_0x469f9d[_0x13d1('0x58')][_0x13d1('0x67')],_['omit'](_0x469f9d[_0x13d1('0x58')],[_0x13d1('0x67'),'id'])||{});}})[_0x13d1('0x1e')](respondWithResult(_0x4eb498,null))[_0x13d1('0x28')](handleError(_0x4eb498,null));};exports[_0x13d1('0x6e')]=function(_0x2c68ae,_0x2b148b,_0x2b0e4a){var _0x4b91ae={'raw':![],'where':{}};var _0x557e74={};var _0x4d47bd={'count':0x0,'rows':[]};return db[_0x13d1('0x3c')][_0x13d1('0x62')]({'where':{'id':_0x2c68ae[_0x13d1('0x55')]['id']}})[_0x13d1('0x1e')](handleEntityNotFound(_0x2b148b,null))[_0x13d1('0x1e')](function(_0x258a83){if(_0x258a83){_0x557e74[_0x13d1('0x41')]=_[_0x13d1('0x3f')](db[_0x13d1('0x6d')][_0x13d1('0x56')]);_0x557e74[_0x13d1('0x3e')]=_['keys'](_0x2c68ae[_0x13d1('0x3e')]);_0x557e74[_0x13d1('0x48')]=_[_0x13d1('0x40')](_0x557e74[_0x13d1('0x41')],_0x557e74['query']);_0x4b91ae[_0x13d1('0x42')]=_['intersection'](_0x557e74['model'],qs[_0x13d1('0x43')](_0x2c68ae['query'][_0x13d1('0x43')]));_0x4b91ae[_0x13d1('0x42')]=_0x4b91ae[_0x13d1('0x42')]['length']?_0x4b91ae[_0x13d1('0x42')]:_0x557e74['model'];if(!_0x2c68ae['query'][_0x13d1('0x45')]('nolimit')){_0x4b91ae['limit']=qs['limit'](_0x2c68ae[_0x13d1('0x3e')][_0x13d1('0x2c')]);_0x4b91ae[_0x13d1('0x2e')]=qs[_0x13d1('0x2e')](_0x2c68ae['query'][_0x13d1('0x2e')]);}_0x4b91ae['order']=qs[_0x13d1('0x47')](_0x2c68ae[_0x13d1('0x3e')][_0x13d1('0x47')]);_0x4b91ae['where']=qs[_0x13d1('0x48')](_['pick'](_0x2c68ae['query'],_0x557e74['filters']));_0x4b91ae['where'][_0x13d1('0x65')]=_0x258a83['id'];if(_0x2c68ae[_0x13d1('0x3e')][_0x13d1('0x4a')]){_0x4b91ae[_0x13d1('0x4b')]=_[_0x13d1('0x4e')](_0x4b91ae[_0x13d1('0x4b')],{'$or':_['map'](_0x4b91ae[_0x13d1('0x42')],function(_0x3a2d32){var _0x203547={};_0x203547[_0x3a2d32]={'$like':'%'+_0x2c68ae['query'][_0x13d1('0x4a')]+'%'};return _0x203547;})});}_0x4b91ae=_['merge']({},_0x4b91ae,_0x2c68ae[_0x13d1('0x4f')]);return db[_0x13d1('0x6d')]['count']({'where':_0x4b91ae['where']})[_0x13d1('0x1e')](function(_0xbe240d){_0x4d47bd['count']=_0xbe240d;if(_0x2c68ae[_0x13d1('0x3e')]['includeAll']){_0x4b91ae[_0x13d1('0x51')]=[{'model':db[_0x13d1('0x6f')],'as':_0x13d1('0x70'),'required':![]},{'model':db[_0x13d1('0x71')],'as':_0x13d1('0x72'),'attributes':[_0x13d1('0x37'),_0x13d1('0x73'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x13d1('0x74'),'attributes':['id','name',_0x13d1('0x75')],'where':_0x2c68ae[_0x13d1('0x3e')][_0x13d1('0x76')]?{'id':_0x2c68ae[_0x13d1('0x3e')][_0x13d1('0x76')]}:undefined,'required':_0x2c68ae[_0x13d1('0x3e')][_0x13d1('0x76')]?!![]:![]}];}return db['FaxInteraction'][_0x13d1('0x52')](_0x4b91ae);})[_0x13d1('0x1e')](function(_0x5e8794){_0x4d47bd[_0x13d1('0x53')]=_0x5e8794;return _0x4d47bd;});}})[_0x13d1('0x1e')](respondWithFilteredResult(_0x2b148b,_0x4b91ae))[_0x13d1('0x28')](handleError(_0x2b148b,null));};exports[_0x13d1('0x77')]=function(_0x178a8a,_0x585716){var _0x19aaa4=_0x178a8a['params']['id'];var _0x178f5c=_0x178a8a[_0x13d1('0x58')];var _0x4886c3=0xc8;var _0x37668a=null;return db[_0x13d1('0x78')][_0x13d1('0x79')]({'isolationLevel':db[_0x13d1('0x78')][_0x13d1('0x7a')][_0x13d1('0x7b')][_0x13d1('0x7c')]},function(_0x530e2f){return db['FaxAccount'][_0x13d1('0x62')]({'where':{'id':_0x19aaa4},'transaction':_0x530e2f})['then'](function(_0x39b6b1){if(_0x39b6b1){return db[_0x13d1('0x7d')]['destroy']({'where':{'FaxAccountId':_0x19aaa4},'transaction':_0x530e2f})[_0x13d1('0x1e')](function(){var _0x5c4615=_[_0x13d1('0x3b')](_0x178f5c,function(_0x58b4e3){_0x58b4e3['FaxAccountId']=_0x19aaa4;return _0x58b4e3;});return db['FaxApplication'][_0x13d1('0x7e')](_0x5c4615,{'transaction':_0x530e2f});});}else{_0x4886c3=0x194;_0x37668a=[];}});})['then'](function(){if(_0x4886c3!==0x194){return db[_0x13d1('0x7d')]['findAndCountAll']({'where':{'FaxAccountId':_0x19aaa4},'order':_0x13d1('0x7f')})['then'](function(_0x1da71c){_0x37668a=_0x1da71c;});}})[_0x13d1('0x28')](function(_0x2e012b){_0x4886c3=0x1f4;logger[_0x13d1('0x24')](_0x2e012b[_0x13d1('0x36')]);if(_0x2e012b['name']){delete _0x2e012b[_0x13d1('0x37')];}_0x37668a=_0x2e012b;})[_0x13d1('0x80')](function(){if(_0x37668a===null){_0x585716['sendStatus'](_0x4886c3);}else{if(_0x4886c3===0x1f4){_0x585716[_0x13d1('0x29')](_0x4886c3)[_0x13d1('0x38')](_0x37668a);}else{_0x585716[_0x13d1('0x29')](_0x4886c3)[_0x13d1('0x2a')](_0x37668a);}}});};exports[_0x13d1('0x81')]=function(_0x2ef4a5,_0x487c39,_0x36c82d){var _0x545837={};var _0x55f337={};var _0x1e11cb;var _0x5761c3;return db[_0x13d1('0x3c')][_0x13d1('0x62')]({'where':{'id':_0x2ef4a5['params']['id']}})[_0x13d1('0x1e')](handleEntityNotFound(_0x487c39,null))[_0x13d1('0x1e')](function(_0x2652ed){if(_0x2652ed){_0x1e11cb=_0x2652ed;_0x55f337['model']=_[_0x13d1('0x3f')](db[_0x13d1('0x7d')]['rawAttributes']);_0x55f337['query']=_[_0x13d1('0x3f')](_0x2ef4a5[_0x13d1('0x3e')]);_0x55f337['filters']=_[_0x13d1('0x40')](_0x55f337[_0x13d1('0x41')],_0x55f337['query']);_0x545837[_0x13d1('0x42')]=_[_0x13d1('0x40')](_0x55f337[_0x13d1('0x41')],qs[_0x13d1('0x43')](_0x2ef4a5[_0x13d1('0x3e')][_0x13d1('0x43')]));_0x545837[_0x13d1('0x42')]=_0x545837[_0x13d1('0x42')][_0x13d1('0x44')]?_0x545837[_0x13d1('0x42')]:_0x55f337[_0x13d1('0x41')];_0x545837[_0x13d1('0x46')]=qs[_0x13d1('0x47')](_0x2ef4a5[_0x13d1('0x3e')][_0x13d1('0x47')]);_0x545837['where']=qs[_0x13d1('0x48')](_[_0x13d1('0x49')](_0x2ef4a5[_0x13d1('0x3e')],_0x55f337[_0x13d1('0x48')]));if(_0x2ef4a5['query'][_0x13d1('0x4a')]){_0x545837['where']=_['merge'](_0x545837['where'],{'$or':_[_0x13d1('0x3b')](_0x545837[_0x13d1('0x42')],function(_0x2fd58d){var _0x47718d={};_0x47718d[_0x2fd58d]={'$like':'%'+_0x2ef4a5[_0x13d1('0x3e')]['filter']+'%'};return _0x47718d;})});}_0x545837=_[_0x13d1('0x4e')]({},_0x545837,_0x2ef4a5['options']);return _0x1e11cb['getApplications'](_0x545837);}})[_0x13d1('0x1e')](function(_0xe053d3){if(_0xe053d3){_0x5761c3=_0xe053d3[_0x13d1('0x44')];if(!_0x2ef4a5[_0x13d1('0x3e')][_0x13d1('0x45')](_0x13d1('0x64'))){_0x545837[_0x13d1('0x2c')]=qs['limit'](_0x2ef4a5[_0x13d1('0x3e')][_0x13d1('0x2c')]);_0x545837[_0x13d1('0x2e')]=qs[_0x13d1('0x2e')](_0x2ef4a5[_0x13d1('0x3e')][_0x13d1('0x2e')]);}return _0x1e11cb['getApplications'](_0x545837);}})['then'](function(_0x358a1c){if(_0x358a1c){return _0x358a1c?{'count':_0x5761c3,'rows':_0x358a1c}:null;}})[_0x13d1('0x1e')](respondWithResult(_0x487c39,null))['catch'](handleError(_0x487c39,null));};function Extension(_0x56719d,_0x568126,_0x44b3c7,_0x406460){this['context']=_0x13d1('0x82');this[_0x13d1('0x83')]=_0x56719d[_0x13d1('0x84')];this[_0x13d1('0x85')]=_0x406460;this[_0x13d1('0x4c')]=_0x13d1('0x86');this[_0x13d1('0x87')]='Fax\x20Extension';this[_0x13d1('0x65')]=_0x56719d['id'];this[_0x13d1('0x7f')]=_0x568126;this['appdata']=_0x44b3c7;}function createExtensionsReciveFax(_0x36de74){var _0x4d33bd=0x1;var _0x3a5400=[];_0x3a5400['push'](new Extension(_0x36de74,_0x4d33bd,'',_0x13d1('0x88')));_0x4d33bd+=0x1;_0x3a5400[_0x13d1('0x89')](new Extension(_0x36de74,_0x4d33bd,'CDR(type)=inbound-fax',_0x13d1('0x8a')));_0x4d33bd+=0x1;for(var _0xa49ca6 in _0x36de74){if(_0x36de74['hasOwnProperty'](_0xa49ca6)&&(_0xa49ca6===_0x13d1('0x8b')||_0xa49ca6==='localstationid'||_0xa49ca6===_0x13d1('0x8c')||_0xa49ca6===_0x13d1('0x8d')||_0xa49ca6===_0x13d1('0x8e')||_0xa49ca6===_0x13d1('0x8f')||_0xa49ca6===_0x13d1('0x90')||_0xa49ca6==='modem'||_0xa49ca6===_0x13d1('0x91'))){_0x3a5400[_0x13d1('0x89')](new Extension(_0x36de74,_0x4d33bd,_0x13d1('0x92')+_0xa49ca6+')='+_0x36de74[_0xa49ca6],'Set'));_0x4d33bd+=0x1;}}_0x3a5400[_0x13d1('0x89')](new Extension(_0x36de74,_0x4d33bd,'6',_0x13d1('0x93')));_0x4d33bd+=0x1;_0x3a5400['push'](new Extension(_0x36de74,_0x4d33bd,_0x13d1('0x94'),_0x13d1('0x95')));_0x4d33bd=0x0;return _0x3a5400;}exports[_0x13d1('0x96')]=function(_0x22d7d7,_0x56b3e3,_0x11b796){var _0x2900aa;return db[_0x13d1('0x78')][_0x13d1('0x79')](function(_0x56d8f8){return db[_0x13d1('0x3c')][_0x13d1('0x5d')](_0x22d7d7[_0x13d1('0x58')],{'transaction':_0x56d8f8})[_0x13d1('0x1e')](function(_0x2c6b05){_0x2900aa=_0x2c6b05[_0x13d1('0x33')]({'plain':!![]});return db[_0x13d1('0x97')]['bulkCreate'](createExtensionsReciveFax(_0x2900aa),{'transaction':_0x56d8f8});});})['then'](function(){return _0x2900aa;})['then'](respondWithResult(_0x56b3e3,null))[_0x13d1('0x28')](handleError(_0x56b3e3,null));};exports[_0x13d1('0x98')]=function(_0xe3e87c,_0x2ea5b1,_0x3dc4f0){var _0x1d9cc6;return db['sequelize'][_0x13d1('0x79')](function(_0x530c29){return db[_0x13d1('0x3c')][_0x13d1('0x31')](_0xe3e87c['body'],{'where':{'id':_0xe3e87c[_0x13d1('0x58')]['id']},'transaction':_0x530c29})['then'](function(_0x44a863){return db[_0x13d1('0x97')][_0x13d1('0x32')]({'where':{'FaxAccountId':_0xe3e87c[_0x13d1('0x58')]['id']},'transaction':_0x530c29})[_0x13d1('0x1e')](function(_0x58d666){return db['VoiceExtension'][_0x13d1('0x7e')](createExtensionsReciveFax(_[_0x13d1('0x99')](_0xe3e87c[_0x13d1('0x58')],[_0x13d1('0x9a'),_0x13d1('0x3d'),_0x13d1('0x9b'),_0x13d1('0x9c'),_0x13d1('0x9d'),_0x13d1('0x9e')])),{'transaction':_0x530c29});});});})['then'](function(){return db[_0x13d1('0x3c')]['findById'](_0xe3e87c[_0x13d1('0x58')]['id']);})[_0x13d1('0x1e')](respondWithResult(_0x2ea5b1,null))['catch'](handleError(_0x2ea5b1,null));};exports[_0x13d1('0x9f')]=function(_0x27395e,_0x1ca963,_0x50a8c3){var _0x5861f9={'raw':!![],'where':{}};var _0x5d3870={};var _0x1b7369={'count':0x0,'rows':[]};return db[_0x13d1('0x3c')][_0x13d1('0x62')]({'where':{'id':_0x27395e[_0x13d1('0x55')]['id']}})[_0x13d1('0x1e')](handleEntityNotFound(_0x1ca963,null))['then'](function(_0x2dc6e6){if(_0x2dc6e6){_0x5d3870[_0x13d1('0x41')]=_[_0x13d1('0x3f')](db[_0x13d1('0xa0')][_0x13d1('0x56')]);_0x5d3870[_0x13d1('0x3e')]=_[_0x13d1('0x3f')](_0x27395e[_0x13d1('0x3e')]);_0x5d3870[_0x13d1('0x48')]=_[_0x13d1('0x40')](_0x5d3870[_0x13d1('0x41')],_0x5d3870[_0x13d1('0x3e')]);_0x5861f9['attributes']=_[_0x13d1('0x40')](_0x5d3870[_0x13d1('0x41')],qs[_0x13d1('0x43')](_0x27395e[_0x13d1('0x3e')]['fields']));_0x5861f9[_0x13d1('0x42')]=_0x5861f9[_0x13d1('0x42')][_0x13d1('0x44')]?_0x5861f9[_0x13d1('0x42')]:_0x5d3870[_0x13d1('0x41')];if(!_0x27395e['query']['hasOwnProperty'](_0x13d1('0x64'))){_0x5861f9[_0x13d1('0x2c')]=qs[_0x13d1('0x2c')](_0x27395e[_0x13d1('0x3e')][_0x13d1('0x2c')]);_0x5861f9[_0x13d1('0x2e')]=qs[_0x13d1('0x2e')](_0x27395e[_0x13d1('0x3e')]['offset']);}_0x5861f9[_0x13d1('0x46')]=qs[_0x13d1('0x47')](_0x27395e[_0x13d1('0x3e')][_0x13d1('0x47')]);_0x5861f9['where']=qs[_0x13d1('0x48')](_[_0x13d1('0x49')](_0x27395e[_0x13d1('0x3e')],_0x5d3870[_0x13d1('0x48')]));_0x5861f9['where'][_0x13d1('0x65')]=_0x2dc6e6['id'];if(_0x27395e[_0x13d1('0x3e')]['filter']){_0x5861f9[_0x13d1('0x4b')]=_[_0x13d1('0x4e')](_0x5861f9[_0x13d1('0x4b')],{'$or':_[_0x13d1('0x3b')](_0x5861f9[_0x13d1('0x42')],function(_0x161df8){var _0x74ba76={};_0x74ba76[_0x161df8]={'$like':'%'+_0x27395e[_0x13d1('0x3e')][_0x13d1('0x4a')]+'%'};return _0x74ba76;})});}if(_0x27395e[_0x13d1('0x3e')][_0x13d1('0xa1')]){var _0x4e3dda=_0x27395e[_0x13d1('0x3e')][_0x13d1('0xa1')]['split'](',');var _0x1de42d={};_0x1de42d[_0x4e3dda[0x0]]={'$gte':moment(_0x4e3dda[0x1])['format'](_0x13d1('0xa2'))};_0x5861f9['where']=_[_0x13d1('0x4e')](_0x5861f9[_0x13d1('0x4b')],_0x1de42d);}_0x5861f9=_[_0x13d1('0x4e')]({},_0x5861f9,_0x27395e[_0x13d1('0x4f')]);return db[_0x13d1('0xa0')]['count']({'where':_0x5861f9[_0x13d1('0x4b')]})[_0x13d1('0x1e')](function(_0x581733){_0x1b7369[_0x13d1('0x2d')]=_0x581733;if(_0x27395e[_0x13d1('0x3e')]['includeAll']){_0x5861f9['include']=[{'all':!![]}];}return db['FaxMessage'][_0x13d1('0x52')](_0x5861f9);})[_0x13d1('0x1e')](function(_0x6aa45a){_0x1b7369['rows']=_0x6aa45a;return _0x1b7369;});}})[_0x13d1('0x1e')](respondWithFilteredResult(_0x1ca963,_0x5861f9))[_0x13d1('0x28')](handleError(_0x1ca963,null));};exports[_0x13d1('0x38')]=function(_0x4e606b,_0x370044,_0x41910d){var _0x363887,_0x3fd259={},_0x569a6c;if(_0x4e606b[_0x13d1('0x58')]['to']){_0x569a6c=_0x4e606b[_0x13d1('0x58')]['to'][0x0];}return db[_0x13d1('0x3c')]['find']({'where':{'id':_0x4e606b[_0x13d1('0x55')]['id']},'include':[{'model':db[_0x13d1('0xa3')],'as':_0x13d1('0xa4'),'include':[{'model':db[_0x13d1('0x6f')],'as':_0x13d1('0xa5'),'where':{'fax':_0x569a6c},'limit':0x1,'order':[[_0x13d1('0x9c'),_0x13d1('0xa6')]]}]}]})['then'](handleEntityNotFound(_0x370044,null))[_0x13d1('0x1e')](function(_0x52579c){_0x363887=_0x52579c;if(_0x4e606b['body'][_0x13d1('0xa7')]&&_0x4e606b[_0x13d1('0x58')][_0x13d1('0xa7')][_0x13d1('0x44')]){for(var _0x4d4242=0x0;_0x4d4242<_0x4e606b[_0x13d1('0x58')][_0x13d1('0xa7')][_0x13d1('0x44')];_0x4d4242+=0x1){_0x4e606b[_0x13d1('0x58')][_0x13d1('0xa7')][_0x4d4242]={'filename':_0x4e606b['body'][_0x13d1('0xa7')][_0x4d4242]['name'],'id':_0x4e606b[_0x13d1('0x58')][_0x13d1('0xa7')][_0x4d4242]['id'],'path':path['join'](config[_0x13d1('0xa8')],_0x13d1('0xa9'),_0x4e606b['body']['attachments'][_0x4d4242][_0x13d1('0xaa')])};}}return respondWithRpcPromise('CheckAfterSend',_0x13d1('0xab'),{'FaxAccountId':_[_0x13d1('0xac')](_0x4e606b[_0x13d1('0x55')]['id'])?undefined:_0x4e606b[_0x13d1('0x55')]['id'],'path':_['isNil'](_0x4e606b['body'][_0x13d1('0xa7')][0x0][_0x13d1('0x4')])?undefined:_0x4e606b[_0x13d1('0x58')][_0x13d1('0xa7')][0x0][_0x13d1('0x4')],'fax':_[_0x13d1('0xac')](_0x4e606b[_0x13d1('0x58')]['to'][0x0])?undefined:_0x4e606b['body']['to'][0x0]},client9002);})[_0x13d1('0x1e')](function(){if(_0x363887){if(_[_0x13d1('0xac')](_0x4e606b[_0x13d1('0x58')][_0x13d1('0xad')])){_0x4e606b[_0x13d1('0x58')][_0x13d1('0xad')]=util['format']('\x22%s\x22\x20<%s>',_0x363887[_0x13d1('0x37')],_0x363887[_0x13d1('0xae')]);}if(_0x363887['List']){if(_0x363887['List'][_0x13d1('0xa5')][_0x13d1('0x44')]){return _0x363887['List'][_0x13d1('0xa5')][0x0];}else{return db[_0x13d1('0x6f')]['create'](_[_0x13d1('0xaf')](_0x4e606b[_0x13d1('0x58')],{'firstName':_0x4e606b['body']['to'][0x0],'phone':_0x4e606b[_0x13d1('0x58')]['to'][0x0],'fax':_0x4e606b[_0x13d1('0x58')]['to'][0x0],'ListId':_0x363887[_0x13d1('0x9e')]}));}}else{throw new Error(_0x13d1('0xb0'));}}else{throw new Error(_0x13d1('0xb1'));}})[_0x13d1('0x1e')](function(_0x15aa61){if(_0x15aa61){return db['FaxInteraction'][_0x13d1('0x57')]({'where':{'ContactId':_0x15aa61['id'],'closed':![],'FaxAccountId':_0x363887['id']}})[_0x13d1('0x1e')](function(_0x4a2bc6){if(_0x4a2bc6){return[_0x4a2bc6,![]];}return db[_0x13d1('0x6d')][_0x13d1('0x5d')]({'UserId':_0x4e606b[_0x13d1('0x59')]['id'],'ContactId':_0x15aa61['id'],'FaxAccountId':_0x363887['id'],'fax':_0x4e606b[_0x13d1('0x58')]['to'][0x0],'firstMsgDirection':_0x13d1('0xb2'),'Messages':[_[_0x13d1('0x4e')](_0x4e606b[_0x13d1('0x58')],{'read':![],'body':_0x4e606b[_0x13d1('0x58')][_0x13d1('0xa7')][0x0][_0x13d1('0xb3')],'FaxAccountId':_0x363887['id'],'UserId':_0x4e606b[_0x13d1('0x59')]['id'],'ContactId':_0x15aa61['id'],'AttachmentId':_0x4e606b[_0x13d1('0x58')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x13d1('0xa0')],'as':_0x13d1('0xb4')}]})[_0x13d1('0x1e')](function(_0x912320){return[_0x912320,!![]];});});}else{throw new Error(_0x13d1('0xb5'));}})[_0x13d1('0xb6')](function(_0x2f462a,_0x4903d2){if(_0x4903d2){return _0x2f462a;}return db[_0x13d1('0xa0')]['create']({'direction':_0x13d1('0xb2'),'read':![],'body':_0x4e606b[_0x13d1('0x58')][_0x13d1('0xa7')][0x0][_0x13d1('0xb3')],'FaxAccountId':_0x363887['id'],'FaxInteractionId':_0x2f462a['id'],'UserId':_0x4e606b[_0x13d1('0x59')]['id'],'ContactId':_0x2f462a[_0x13d1('0xb7')],'AttachmentId':_0x4e606b[_0x13d1('0x58')][_0x13d1('0xa7')][0x0]['id']})['then'](function(_0x225786){_0x2f462a[_0x13d1('0xb8')][_0x13d1('0xb4')]=[];_0x2f462a[_0x13d1('0xb8')][_0x13d1('0xb4')][_0x13d1('0x89')](_0x225786[_0x13d1('0xb8')]);return _0x2f462a;});})[_0x13d1('0x1e')](function(_0x3d4f3a){respondWithRpcPromise(_0x13d1('0xb9'),_0x13d1('0xb9'),{'FaxAccountId':_[_0x13d1('0xac')](_0x4e606b[_0x13d1('0x55')]['id'])?undefined:_0x4e606b['params']['id'],'path':_[_0x13d1('0xac')](_0x4e606b[_0x13d1('0x58')][_0x13d1('0xa7')][0x0][_0x13d1('0x4')])?undefined:_0x4e606b[_0x13d1('0x58')][_0x13d1('0xa7')][0x0]['path'],'fax':_[_0x13d1('0xac')](_0x4e606b[_0x13d1('0x58')]['to'][0x0])?undefined:_0x4e606b[_0x13d1('0x58')]['to'][0x0],'AttachmentId':_0x4e606b[_0x13d1('0x58')][_0x13d1('0xa7')][0x0]['id']},client9002)[_0x13d1('0x1e')](function(_0xdedc5d){logger[_0x13d1('0x1f')](_0x13d1('0xba'),_0xdedc5d);})['catch'](function(_0xccb12b){logger['info'](_0x13d1('0xba'),_0xccb12b);});return _0x3d4f3a;})[_0x13d1('0x1e')](respondWithResult(_0x370044,null))['catch'](handleError(_0x370044,null));};exports[_0x13d1('0xbb')]=function(_0x2932e2,_0x2c1668,_0x2f1bb1){return db['FaxAccount'][_0x13d1('0x57')]({'where':{'id':_0x2932e2[_0x13d1('0x55')]['id']}})[_0x13d1('0x1e')](handleEntityNotFound(_0x2c1668,null))[_0x13d1('0x1e')](function(_0x35c8a3){if(_0x35c8a3){return _0x35c8a3[_0x13d1('0xbb')](_0x2932e2[_0x13d1('0x58')][_0x13d1('0x67')],_['omit'](_0x2932e2[_0x13d1('0x58')],[_0x13d1('0x67'),'id'])||{})['spread'](function(_0x20286e){for(var _0xd62698=0x0;_0xd62698<_0x2932e2[_0x13d1('0x58')]['ids']['length'];_0xd62698+=0x1){socket[_0x13d1('0xbc')]('userFaxAccount:save',{'UserId':Number(_0x2932e2[_0x13d1('0x58')][_0x13d1('0x67')][_0xd62698]),'FaxAccountId':Number(_0x2932e2[_0x13d1('0x55')]['id'])});}return _0x20286e;});}})['then'](respondWithResult(_0x2c1668,null))['catch'](handleError(_0x2c1668,null));};exports[_0x13d1('0xbd')]=function(_0x39911b,_0x4f24f9,_0x1b6b1d){return db[_0x13d1('0x3c')][_0x13d1('0x57')]({'where':{'id':_0x39911b[_0x13d1('0x55')]['id']}})[_0x13d1('0x1e')](handleEntityNotFound(_0x4f24f9,null))[_0x13d1('0x1e')](function(_0x5bd5c7){if(_0x5bd5c7){return _0x5bd5c7[_0x13d1('0xbd')](_0x39911b['query'][_0x13d1('0x67')])['then'](function(){if(_[_0x13d1('0xbe')](_0x39911b[_0x13d1('0x3e')][_0x13d1('0x67')])){for(var _0x30ddf9=0x0;_0x30ddf9<_0x39911b[_0x13d1('0x3e')][_0x13d1('0x67')][_0x13d1('0x44')];_0x30ddf9+=0x1){socket[_0x13d1('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0x39911b[_0x13d1('0x3e')][_0x13d1('0x67')][_0x30ddf9]),'FaxAccountId':Number(_0x39911b[_0x13d1('0x55')]['id'])});}}else{socket[_0x13d1('0xbc')](_0x13d1('0xbf'),{'UserId':Number(_0x39911b[_0x13d1('0x3e')]['ids']),'FaxAccountId':Number(_0x39911b['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4f24f9,null))[_0x13d1('0x28')](handleError(_0x4f24f9,null));};exports[_0x13d1('0xc0')]=function(_0x32d4f5,_0x1b3ebc,_0x4d467b){var _0x2066bf={};var _0x17e1b9={};var _0x49f83b;var _0x59a5d3;return db[_0x13d1('0x3c')][_0x13d1('0x62')]({'where':{'id':_0x32d4f5[_0x13d1('0x55')]['id']}})['then'](handleEntityNotFound(_0x1b3ebc,null))[_0x13d1('0x1e')](function(_0x16c306){if(_0x16c306){_0x49f83b=_0x16c306;_0x17e1b9[_0x13d1('0x41')]=_[_0x13d1('0x3f')](db['User'][_0x13d1('0x56')]);_0x17e1b9[_0x13d1('0x3e')]=_[_0x13d1('0x3f')](_0x32d4f5['query']);_0x17e1b9['filters']=_[_0x13d1('0x40')](_0x17e1b9[_0x13d1('0x41')],_0x17e1b9['query']);_0x2066bf[_0x13d1('0x42')]=_[_0x13d1('0x40')](_0x17e1b9[_0x13d1('0x41')],qs[_0x13d1('0x43')](_0x32d4f5[_0x13d1('0x3e')][_0x13d1('0x43')]));_0x2066bf[_0x13d1('0x42')]=_0x2066bf['attributes'][_0x13d1('0x44')]?_0x2066bf[_0x13d1('0x42')]:_0x17e1b9['model'];_0x2066bf[_0x13d1('0x46')]=qs['sort'](_0x32d4f5[_0x13d1('0x3e')][_0x13d1('0x47')]);_0x2066bf['where']=qs[_0x13d1('0x48')](_[_0x13d1('0x49')](_0x32d4f5['query'],_0x17e1b9[_0x13d1('0x48')]));if(_0x32d4f5[_0x13d1('0x3e')]['filter']){_0x2066bf['where']=_['merge'](_0x2066bf[_0x13d1('0x4b')],{'$or':_[_0x13d1('0x3b')](_0x2066bf['attributes'],function(_0x5dea4e){var _0x34a443={};_0x34a443[_0x5dea4e]={'$like':'%'+_0x32d4f5['query'][_0x13d1('0x4a')]+'%'};return _0x34a443;})});}_0x2066bf=_['merge']({},_0x2066bf,_0x32d4f5[_0x13d1('0x4f')]);return _0x49f83b[_0x13d1('0xc0')](_0x2066bf);}})[_0x13d1('0x1e')](function(_0x178f8c){if(_0x178f8c){_0x59a5d3=_0x178f8c[_0x13d1('0x44')];if(!_0x32d4f5[_0x13d1('0x3e')][_0x13d1('0x45')](_0x13d1('0x64'))){_0x2066bf[_0x13d1('0x2c')]=qs[_0x13d1('0x2c')](_0x32d4f5['query']['limit']);_0x2066bf['offset']=qs[_0x13d1('0x2e')](_0x32d4f5[_0x13d1('0x3e')][_0x13d1('0x2e')]);}return _0x49f83b[_0x13d1('0xc0')](_0x2066bf);}})[_0x13d1('0x1e')](function(_0xf82fd4){if(_0xf82fd4){return _0xf82fd4?{'count':_0x59a5d3,'rows':_0xf82fd4}:null;}})['then'](respondWithResult(_0x1b3ebc,null))[_0x13d1('0x28')](handleError(_0x1b3ebc,null));}; \ No newline at end of file +var _0xdc54=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','./faxAccount.socket','client','http','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','map','rawAttributes','type','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','FaxAccount','includeAll','include','findAll','show','params','mandatoryDispositionPause','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','internal','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','minrate','modem','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','key','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','filename','Messages','spread','out','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x3223e8,_0x5d1dc5){var _0x5aabcc=function(_0x125d53){while(--_0x125d53){_0x3223e8['push'](_0x3223e8['shift']());}};_0x5aabcc(++_0x5d1dc5);}(_0xdc54,0xb2));var _0x4dc5=function(_0x2e9855,_0xc91f78){_0x2e9855=_0x2e9855-0x0;var _0x2e8dfc=_0xdc54[_0x2e9855];return _0x2e8dfc;};'use strict';var emlformat=require(_0x4dc5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4dc5('0x1'));var jsonpatch=require(_0x4dc5('0x2'));var rp=require(_0x4dc5('0x3'));var moment=require(_0x4dc5('0x4'));var BPromise=require(_0x4dc5('0x5'));var Mustache=require(_0x4dc5('0x6'));var util=require(_0x4dc5('0x7'));var path=require('path');var sox=require(_0x4dc5('0x8'));var csv=require('to-csv');var ejs=require(_0x4dc5('0x9'));var fs=require('fs');var fs_extra=require(_0x4dc5('0xa'));var _=require(_0x4dc5('0xb'));var squel=require(_0x4dc5('0xc'));var crypto=require(_0x4dc5('0xd'));var jsforce=require(_0x4dc5('0xe'));var deskjs=require(_0x4dc5('0xf'));var toCsv=require(_0x4dc5('0x10'));var querystring=require(_0x4dc5('0x11'));var Papa=require('papaparse');var Redis=require(_0x4dc5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4dc5('0x13'));var as=require(_0x4dc5('0x14'));var hardwareService=require(_0x4dc5('0x15'));var logger=require(_0x4dc5('0x16'))(_0x4dc5('0x17'));var utils=require(_0x4dc5('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4dc5('0x19')]=_[_0x4dc5('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4dc5('0x1b'))(new Redis(config[_0x4dc5('0x19')]));require(_0x4dc5('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x4dc5('0x1d')][_0x4dc5('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x4dc5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5ef38e,_0x10485b,_0x1ccc17,_0x45ec03){return new BPromise(function(_0x50827b,_0x266637){var _0x4ee8dd=_0x45ec03||client;return _0x4ee8dd[_0x4dc5('0x1f')](_0x5ef38e,_0x1ccc17)[_0x4dc5('0x20')](function(_0x26349d){logger['info']('FaxAccount,\x20%s,\x20%s',_0x10485b,_0x4dc5('0x21'));logger[_0x4dc5('0x22')](_0x4dc5('0x23'),_0x10485b,_0x4dc5('0x21'),JSON[_0x4dc5('0x24')](_0x26349d));if(_0x26349d[_0x4dc5('0x25')]){if(_0x26349d['error'][_0x4dc5('0x26')]===0x1f4){logger[_0x4dc5('0x25')](_0x4dc5('0x27'),_0x10485b,_0x26349d[_0x4dc5('0x25')][_0x4dc5('0x28')]);return _0x266637(_0x26349d[_0x4dc5('0x25')][_0x4dc5('0x28')]);}logger[_0x4dc5('0x25')]('FaxAccount,\x20%s,\x20%s',_0x10485b,_0x26349d[_0x4dc5('0x25')][_0x4dc5('0x28')]);return _0x50827b(_0x26349d[_0x4dc5('0x25')][_0x4dc5('0x28')]);}else{logger[_0x4dc5('0x29')](_0x4dc5('0x27'),_0x10485b,_0x4dc5('0x21'));_0x50827b(_0x26349d[_0x4dc5('0x2a')]['message']);}})['catch'](function(_0x11d5ef){logger[_0x4dc5('0x25')](_0x4dc5('0x27'),_0x10485b,_0x11d5ef);_0x266637(_0x11d5ef);});});}function respondWithStatusCode(_0x53e98f,_0x39de69){_0x39de69=_0x39de69||0xcc;return function(_0x4c742f){if(_0x4c742f){return _0x53e98f[_0x4dc5('0x2b')](_0x39de69);}return _0x53e98f[_0x4dc5('0x2c')](_0x39de69)[_0x4dc5('0x2d')]();};}function respondWithResult(_0x1e53a7,_0x2af058){_0x2af058=_0x2af058||0xc8;return function(_0x16b82d){if(_0x16b82d){return _0x1e53a7['status'](_0x2af058)['json'](_0x16b82d);}};}function respondWithFilteredResult(_0x2c7445,_0x25bf80){return function(_0x18f89c){if(_0x18f89c){var _0x13a8a0=typeof _0x25bf80['offset']===_0x4dc5('0x2e')&&typeof _0x25bf80[_0x4dc5('0x2f')]===_0x4dc5('0x2e');var _0x3e3c37=_0x18f89c[_0x4dc5('0x30')];var _0x4a8f32=_0x13a8a0?0x0:_0x25bf80['offset'];var _0x702244=_0x13a8a0?_0x18f89c[_0x4dc5('0x30')]:_0x25bf80[_0x4dc5('0x31')]+_0x25bf80[_0x4dc5('0x2f')];var _0x50c55a;if(_0x702244>=_0x3e3c37){_0x702244=_0x3e3c37;_0x50c55a=0xc8;}else{_0x50c55a=0xce;}_0x2c7445[_0x4dc5('0x2c')](_0x50c55a);return _0x2c7445[_0x4dc5('0x32')](_0x4dc5('0x33'),_0x4a8f32+'-'+_0x702244+'/'+_0x3e3c37)[_0x4dc5('0x34')](_0x18f89c);}return null;};}function patchUpdates(_0x5d170b){return function(_0x12fe94){try{jsonpatch[_0x4dc5('0x35')](_0x12fe94,_0x5d170b,!![]);}catch(_0x2f6e1c){return BPromise['reject'](_0x2f6e1c);}return _0x12fe94[_0x4dc5('0x36')]();};}function saveUpdates(_0x39f175,_0x1e4a86){return function(_0x51fa7b){if(_0x51fa7b){return _0x51fa7b[_0x4dc5('0x37')](_0x39f175)[_0x4dc5('0x20')](function(_0x533868){return _0x533868;});}return null;};}function removeEntity(_0x2f6958,_0x552d8d){return function(_0x38b4b){if(_0x38b4b){return _0x38b4b[_0x4dc5('0x38')]()[_0x4dc5('0x20')](function(){var _0x58af46=_0x38b4b[_0x4dc5('0x39')]({'plain':!![]});var _0x25102d=_0x4dc5('0x3a');return db[_0x4dc5('0x3b')][_0x4dc5('0x38')]({'where':{'type':_0x25102d,'resourceId':_0x58af46['id']}})[_0x4dc5('0x20')](function(){return _0x38b4b;});})[_0x4dc5('0x20')](function(){_0x2f6958[_0x4dc5('0x2c')](0xcc)[_0x4dc5('0x2d')]();});}};}function handleEntityNotFound(_0x247e47,_0x5444f6){return function(_0x3c6d2b){if(!_0x3c6d2b){_0x247e47[_0x4dc5('0x2b')](0x194);}return _0x3c6d2b;};}function handleError(_0x242cb7,_0x186093){_0x186093=_0x186093||0x1f4;return function(_0x3b8ec3){logger[_0x4dc5('0x25')](_0x3b8ec3[_0x4dc5('0x3c')]);if(_0x3b8ec3[_0x4dc5('0x3d')]){delete _0x3b8ec3[_0x4dc5('0x3d')];}_0x242cb7['status'](_0x186093)[_0x4dc5('0x3e')](_0x3b8ec3);};}exports[_0x4dc5('0x3f')]=function(_0x3e20b6,_0x141d4b){var _0x494f75={'include':[{'model':db[_0x4dc5('0x40')],'as':'mandatoryDispositionPause'}]},_0x4b1b41={},_0x369af7={'count':0x0,'rows':[]};var _0x5cf7d3=_[_0x4dc5('0x41')](db['FaxAccount'][_0x4dc5('0x42')],function(_0x488deb){return{'name':_0x488deb['fieldName'],'type':_0x488deb[_0x4dc5('0x43')]['key']};});_0x4b1b41[_0x4dc5('0x44')]=_['map'](_0x5cf7d3,_0x4dc5('0x3d'));_0x4b1b41[_0x4dc5('0x45')]=_['keys'](_0x3e20b6[_0x4dc5('0x45')]);_0x4b1b41['filters']=_['intersection'](_0x4b1b41[_0x4dc5('0x44')],_0x4b1b41[_0x4dc5('0x45')]);_0x494f75[_0x4dc5('0x46')]=_[_0x4dc5('0x47')](_0x4b1b41[_0x4dc5('0x44')],qs[_0x4dc5('0x48')](_0x3e20b6[_0x4dc5('0x45')][_0x4dc5('0x48')]));_0x494f75['attributes']=_0x494f75['attributes'][_0x4dc5('0x49')]?_0x494f75[_0x4dc5('0x46')]:_0x4b1b41['model'];if(!_0x3e20b6[_0x4dc5('0x45')]['hasOwnProperty'](_0x4dc5('0x4a'))){_0x494f75[_0x4dc5('0x2f')]=qs['limit'](_0x3e20b6['query'][_0x4dc5('0x2f')]);_0x494f75[_0x4dc5('0x31')]=qs[_0x4dc5('0x31')](_0x3e20b6[_0x4dc5('0x45')]['offset']);}_0x494f75[_0x4dc5('0x4b')]=qs[_0x4dc5('0x4c')](_0x3e20b6[_0x4dc5('0x45')]['sort']);_0x494f75[_0x4dc5('0x4d')]=qs[_0x4dc5('0x4e')](_[_0x4dc5('0x4f')](_0x3e20b6[_0x4dc5('0x45')],_0x4b1b41[_0x4dc5('0x4e')]),_0x5cf7d3);if(_0x3e20b6['query'][_0x4dc5('0x50')]){_0x494f75['where']=_[_0x4dc5('0x51')](_0x494f75[_0x4dc5('0x4d')],{'$or':_['map'](_0x5cf7d3,function(_0x38eb12){if(_0x38eb12['type']!==_0x4dc5('0x52')){var _0x1dab66={};_0x1dab66[_0x38eb12[_0x4dc5('0x3d')]]={'$like':'%'+_0x3e20b6[_0x4dc5('0x45')][_0x4dc5('0x50')]+'%'};return _0x1dab66;}})});}_0x494f75=_[_0x4dc5('0x51')]({},_0x494f75,_0x3e20b6['options']);var _0x339a5d={'where':_0x494f75[_0x4dc5('0x4d')]};return db[_0x4dc5('0x53')][_0x4dc5('0x30')](_0x339a5d)[_0x4dc5('0x20')](function(_0x984b01){_0x369af7[_0x4dc5('0x30')]=_0x984b01;if(_0x3e20b6[_0x4dc5('0x45')][_0x4dc5('0x54')]){_0x494f75[_0x4dc5('0x55')]=[{'all':!![]}];}return db[_0x4dc5('0x53')][_0x4dc5('0x56')](_0x494f75);})[_0x4dc5('0x20')](function(_0x37ee68){_0x369af7['rows']=_0x37ee68;return _0x369af7;})[_0x4dc5('0x20')](respondWithFilteredResult(_0x141d4b,_0x494f75))['catch'](handleError(_0x141d4b,null));};exports[_0x4dc5('0x57')]=function(_0x1b7fc6,_0x24d601){var _0xcb8cab={'raw':![],'where':{'id':_0x1b7fc6[_0x4dc5('0x58')]['id']},'include':[{'model':db[_0x4dc5('0x40')],'as':_0x4dc5('0x59')}]},_0x486185={};_0x486185['model']=_['keys'](db[_0x4dc5('0x53')][_0x4dc5('0x42')]);_0x486185['query']=_[_0x4dc5('0x5a')](_0x1b7fc6[_0x4dc5('0x45')]);_0x486185['filters']=_[_0x4dc5('0x47')](_0x486185[_0x4dc5('0x44')],_0x486185[_0x4dc5('0x45')]);_0xcb8cab['attributes']=_[_0x4dc5('0x47')](_0x486185[_0x4dc5('0x44')],qs[_0x4dc5('0x48')](_0x1b7fc6[_0x4dc5('0x45')][_0x4dc5('0x48')]));_0xcb8cab[_0x4dc5('0x46')]=_0xcb8cab[_0x4dc5('0x46')][_0x4dc5('0x49')]?_0xcb8cab[_0x4dc5('0x46')]:_0x486185[_0x4dc5('0x44')];if(_0x1b7fc6[_0x4dc5('0x45')][_0x4dc5('0x54')]){_0xcb8cab['include']=[{'all':!![]}];}_0xcb8cab=_[_0x4dc5('0x51')]({},_0xcb8cab,_0x1b7fc6[_0x4dc5('0x5b')]);return db['FaxAccount'][_0x4dc5('0x5c')](_0xcb8cab)[_0x4dc5('0x20')](handleEntityNotFound(_0x24d601,null))['then'](respondWithResult(_0x24d601,null))['catch'](handleError(_0x24d601,null));};exports[_0x4dc5('0x5d')]=function(_0x42fc36,_0xc4bb01){return db[_0x4dc5('0x53')][_0x4dc5('0x5d')](_0x42fc36[_0x4dc5('0x5e')],{})[_0x4dc5('0x20')](function(_0x517c56){var _0x51e2b8=_0x42fc36[_0x4dc5('0x5f')][_0x4dc5('0x39')]({'plain':!![]});if(!_0x51e2b8)throw new Error(_0x4dc5('0x60'));if(_0x51e2b8[_0x4dc5('0x61')]===_0x4dc5('0x5f')){var _0x2cbab9=_0x517c56[_0x4dc5('0x39')]({'plain':!![]});var _0x12f925=_0x4dc5('0x3a');return db[_0x4dc5('0x62')][_0x4dc5('0x5c')]({'where':{'name':_0x12f925,'userProfileId':_0x51e2b8[_0x4dc5('0x63')]},'raw':!![]})['then'](function(_0x7003e9){if(_0x7003e9&&_0x7003e9[_0x4dc5('0x64')]===0x0){return db['UserProfileResource'][_0x4dc5('0x5d')]({'name':_0x2cbab9[_0x4dc5('0x3d')],'resourceId':_0x2cbab9['id'],'type':_0x7003e9['name'],'sectionId':_0x7003e9['id']},{})[_0x4dc5('0x20')](function(){return _0x517c56;});}else{return _0x517c56;}})[_0x4dc5('0x65')](function(_0xf7c43a){logger[_0x4dc5('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf7c43a);throw _0xf7c43a;});}return _0x517c56;})[_0x4dc5('0x20')](respondWithResult(_0xc4bb01,0xc9))[_0x4dc5('0x65')](handleError(_0xc4bb01,null));};exports['update']=function(_0x121c08,_0x3fe962){if(_0x121c08[_0x4dc5('0x5e')]['id']){delete _0x121c08[_0x4dc5('0x5e')]['id'];}return db['FaxAccount'][_0x4dc5('0x5c')]({'where':{'id':_0x121c08['params']['id']},'include':[{'model':db['Pause'],'as':_0x4dc5('0x59')}]})[_0x4dc5('0x20')](handleEntityNotFound(_0x3fe962,null))[_0x4dc5('0x20')](saveUpdates(_0x121c08['body'],null))[_0x4dc5('0x20')](respondWithResult(_0x3fe962,null))[_0x4dc5('0x65')](handleError(_0x3fe962,null));};exports[_0x4dc5('0x38')]=function(_0x5545a8,_0x2e66e0){return db['FaxAccount'][_0x4dc5('0x5c')]({'where':{'id':_0x5545a8['params']['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x2e66e0,null))['then'](removeEntity(_0x2e66e0,null))['catch'](handleError(_0x2e66e0,null));};exports['describe']=function(_0x2bf117,_0xe028d5){return db[_0x4dc5('0x53')][_0x4dc5('0x66')]()['then'](respondWithResult(_0xe028d5,null))['catch'](handleError(_0xe028d5,null));};exports[_0x4dc5('0x67')]=function(_0x39c5ee,_0x128de2,_0x1e8a5a){if(_0x39c5ee[_0x4dc5('0x5e')]['id']){delete _0x39c5ee['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x39c5ee['params']['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x128de2,null))['then'](function(_0x57722d){if(_0x57722d){_0x39c5ee['body'][_0x4dc5('0x68')]=_0x57722d['id'];return db['Disposition'][_0x4dc5('0x5d')](_0x39c5ee['body']);}})[_0x4dc5('0x20')](respondWithResult(_0x128de2,null))['catch'](handleError(_0x128de2,null));};exports[_0x4dc5('0x69')]=function(_0x756668,_0x337395,_0x32617a){var _0x429ea6={'raw':![],'where':{}};var _0x1dfd2b={};var _0x4f7354={'count':0x0,'rows':[]};return db[_0x4dc5('0x53')][_0x4dc5('0x6a')]({'where':{'id':_0x756668[_0x4dc5('0x58')]['id']}})['then'](handleEntityNotFound(_0x337395,null))['then'](function(_0x408623){if(_0x408623){_0x1dfd2b[_0x4dc5('0x44')]=_[_0x4dc5('0x5a')](db[_0x4dc5('0x6b')][_0x4dc5('0x42')]);_0x1dfd2b[_0x4dc5('0x45')]=_['keys'](_0x756668[_0x4dc5('0x45')]);_0x1dfd2b[_0x4dc5('0x4e')]=_[_0x4dc5('0x47')](_0x1dfd2b[_0x4dc5('0x44')],_0x1dfd2b[_0x4dc5('0x45')]);_0x429ea6[_0x4dc5('0x46')]=_[_0x4dc5('0x47')](_0x1dfd2b[_0x4dc5('0x44')],qs['fields'](_0x756668[_0x4dc5('0x45')][_0x4dc5('0x48')]));_0x429ea6[_0x4dc5('0x46')]=_0x429ea6['attributes'][_0x4dc5('0x49')]?_0x429ea6['attributes']:_0x1dfd2b['model'];if(!_0x756668[_0x4dc5('0x45')][_0x4dc5('0x6c')](_0x4dc5('0x4a'))){_0x429ea6['limit']=qs[_0x4dc5('0x2f')](_0x756668['query'][_0x4dc5('0x2f')]);_0x429ea6[_0x4dc5('0x31')]=qs['offset'](_0x756668[_0x4dc5('0x45')][_0x4dc5('0x31')]);}_0x429ea6[_0x4dc5('0x4b')]=qs[_0x4dc5('0x4c')](_0x756668[_0x4dc5('0x45')][_0x4dc5('0x4c')]);_0x429ea6[_0x4dc5('0x4d')]=qs[_0x4dc5('0x4e')](_['pick'](_0x756668[_0x4dc5('0x45')],_0x1dfd2b[_0x4dc5('0x4e')]));_0x429ea6[_0x4dc5('0x4d')]['FaxAccountId']=_0x408623['id'];if(_0x756668[_0x4dc5('0x45')][_0x4dc5('0x50')]){_0x429ea6[_0x4dc5('0x4d')]=_[_0x4dc5('0x51')](_0x429ea6[_0x4dc5('0x4d')],{'$or':_[_0x4dc5('0x41')](_0x429ea6[_0x4dc5('0x46')],function(_0x46864e){var _0x1a41b3={};_0x1a41b3[_0x46864e]={'$like':'%'+_0x756668[_0x4dc5('0x45')][_0x4dc5('0x50')]+'%'};return _0x1a41b3;})});}_0x429ea6=_[_0x4dc5('0x51')]({},_0x429ea6,_0x756668[_0x4dc5('0x5b')]);return db['Disposition'][_0x4dc5('0x30')]({'where':_0x429ea6[_0x4dc5('0x4d')]})[_0x4dc5('0x20')](function(_0x4ba688){_0x4f7354[_0x4dc5('0x30')]=_0x4ba688;if(_0x756668['query'][_0x4dc5('0x54')]){_0x429ea6[_0x4dc5('0x55')]=[{'all':!![]}];}return db['Disposition'][_0x4dc5('0x56')](_0x429ea6);})[_0x4dc5('0x20')](function(_0x3f97a6){_0x4f7354['rows']=_0x3f97a6;return _0x4f7354;});}})[_0x4dc5('0x20')](respondWithFilteredResult(_0x337395,_0x429ea6))[_0x4dc5('0x65')](handleError(_0x337395,null));};exports[_0x4dc5('0x6d')]=function(_0x5ec462,_0x5acf18,_0x5a3262){return db[_0x4dc5('0x53')][_0x4dc5('0x5c')]({'where':{'id':_0x5ec462[_0x4dc5('0x58')]['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x5acf18,null))[_0x4dc5('0x20')](function(_0x4b5ed2){if(_0x4b5ed2){return _0x4b5ed2[_0x4dc5('0x6d')](_0x5ec462[_0x4dc5('0x45')][_0x4dc5('0x6e')]);}})[_0x4dc5('0x20')](respondWithStatusCode(_0x5acf18,null))[_0x4dc5('0x65')](handleError(_0x5acf18,null));};exports[_0x4dc5('0x6f')]=function(_0x125cf4,_0x5ed515,_0x3aee04){if(_0x125cf4[_0x4dc5('0x5e')]['id']){delete _0x125cf4[_0x4dc5('0x5e')]['id'];}return db[_0x4dc5('0x53')][_0x4dc5('0x5c')]({'where':{'id':_0x125cf4[_0x4dc5('0x58')]['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x5ed515,null))[_0x4dc5('0x20')](function(_0x9a503b){if(_0x9a503b){_0x125cf4[_0x4dc5('0x5e')][_0x4dc5('0x68')]=_0x9a503b['id'];return db[_0x4dc5('0x70')][_0x4dc5('0x5d')](_0x125cf4[_0x4dc5('0x5e')]);}})[_0x4dc5('0x20')](respondWithResult(_0x5ed515,null))[_0x4dc5('0x65')](handleError(_0x5ed515,null));};exports[_0x4dc5('0x71')]=function(_0x16cf0e,_0x4d6051,_0x50b9c1){var _0x5c8352={'raw':![],'where':{}};var _0x231bc5={};var _0x4293ae={'count':0x0,'rows':[]};return db[_0x4dc5('0x53')][_0x4dc5('0x6a')]({'where':{'id':_0x16cf0e[_0x4dc5('0x58')]['id']}})['then'](handleEntityNotFound(_0x4d6051,null))[_0x4dc5('0x20')](function(_0x3b3c2a){if(_0x3b3c2a){_0x231bc5[_0x4dc5('0x44')]=_[_0x4dc5('0x5a')](db[_0x4dc5('0x70')]['rawAttributes']);_0x231bc5[_0x4dc5('0x45')]=_['keys'](_0x16cf0e['query']);_0x231bc5[_0x4dc5('0x4e')]=_[_0x4dc5('0x47')](_0x231bc5[_0x4dc5('0x44')],_0x231bc5['query']);_0x5c8352['attributes']=_['intersection'](_0x231bc5[_0x4dc5('0x44')],qs[_0x4dc5('0x48')](_0x16cf0e[_0x4dc5('0x45')][_0x4dc5('0x48')]));_0x5c8352[_0x4dc5('0x46')]=_0x5c8352[_0x4dc5('0x46')][_0x4dc5('0x49')]?_0x5c8352['attributes']:_0x231bc5['model'];if(!_0x16cf0e[_0x4dc5('0x45')]['hasOwnProperty']('nolimit')){_0x5c8352[_0x4dc5('0x2f')]=qs[_0x4dc5('0x2f')](_0x16cf0e[_0x4dc5('0x45')][_0x4dc5('0x2f')]);_0x5c8352['offset']=qs[_0x4dc5('0x31')](_0x16cf0e[_0x4dc5('0x45')]['offset']);}_0x5c8352[_0x4dc5('0x4b')]=qs[_0x4dc5('0x4c')](_0x16cf0e['query'][_0x4dc5('0x4c')]);_0x5c8352[_0x4dc5('0x4d')]=qs[_0x4dc5('0x4e')](_['pick'](_0x16cf0e[_0x4dc5('0x45')],_0x231bc5[_0x4dc5('0x4e')]));_0x5c8352['where'][_0x4dc5('0x68')]=_0x3b3c2a['id'];if(_0x16cf0e[_0x4dc5('0x45')][_0x4dc5('0x50')]){_0x5c8352[_0x4dc5('0x4d')]=_[_0x4dc5('0x51')](_0x5c8352['where'],{'$or':_['map'](_0x5c8352[_0x4dc5('0x46')],function(_0x5a7f77){var _0x1b3316={};_0x1b3316[_0x5a7f77]={'$like':'%'+_0x16cf0e[_0x4dc5('0x45')][_0x4dc5('0x50')]+'%'};return _0x1b3316;})});}_0x5c8352=_['merge']({},_0x5c8352,_0x16cf0e['options']);return db[_0x4dc5('0x70')][_0x4dc5('0x30')]({'where':_0x5c8352[_0x4dc5('0x4d')]})[_0x4dc5('0x20')](function(_0x8b5217){_0x4293ae[_0x4dc5('0x30')]=_0x8b5217;if(_0x16cf0e['query'][_0x4dc5('0x54')]){_0x5c8352[_0x4dc5('0x55')]=[{'all':!![]}];}return db[_0x4dc5('0x70')]['findAll'](_0x5c8352);})[_0x4dc5('0x20')](function(_0xd02a02){_0x4293ae[_0x4dc5('0x72')]=_0xd02a02;return _0x4293ae;});}})['then'](respondWithFilteredResult(_0x4d6051,_0x5c8352))[_0x4dc5('0x65')](handleError(_0x4d6051,null));};exports[_0x4dc5('0x73')]=function(_0x4917ee,_0x2feeff,_0x3807ee){return db[_0x4dc5('0x53')][_0x4dc5('0x5c')]({'where':{'id':_0x4917ee[_0x4dc5('0x58')]['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x2feeff,null))[_0x4dc5('0x20')](function(_0x2da198){if(_0x2da198){return _0x2da198[_0x4dc5('0x73')](_0x4917ee[_0x4dc5('0x45')][_0x4dc5('0x6e')]);}})[_0x4dc5('0x20')](respondWithStatusCode(_0x2feeff,null))[_0x4dc5('0x65')](handleError(_0x2feeff,null));};exports[_0x4dc5('0x74')]=function(_0x1d9ae4,_0x35faf3,_0x5531b3){return db[_0x4dc5('0x75')][_0x4dc5('0x5c')]({'where':{'id':_0x1d9ae4[_0x4dc5('0x58')]['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x35faf3,null))[_0x4dc5('0x20')](function(_0x3fde66){if(_0x3fde66){return _0x3fde66[_0x4dc5('0x74')](_0x1d9ae4[_0x4dc5('0x5e')][_0x4dc5('0x6e')],_[_0x4dc5('0x76')](_0x1d9ae4[_0x4dc5('0x5e')],['ids','id'])||{});}})[_0x4dc5('0x20')](respondWithResult(_0x35faf3,null))['catch'](handleError(_0x35faf3,null));};exports[_0x4dc5('0x77')]=function(_0x39aabe,_0x44d3cb,_0x388d98){var _0x30c107={'raw':![],'where':{}};var _0x20b0e7={};var _0x589f8e={'count':0x0,'rows':[]};return db[_0x4dc5('0x53')][_0x4dc5('0x6a')]({'where':{'id':_0x39aabe[_0x4dc5('0x58')]['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x44d3cb,null))[_0x4dc5('0x20')](function(_0x301c28){if(_0x301c28){_0x20b0e7[_0x4dc5('0x44')]=_[_0x4dc5('0x5a')](db[_0x4dc5('0x75')][_0x4dc5('0x42')]);_0x20b0e7['query']=_[_0x4dc5('0x5a')](_0x39aabe[_0x4dc5('0x45')]);_0x20b0e7[_0x4dc5('0x4e')]=_[_0x4dc5('0x47')](_0x20b0e7[_0x4dc5('0x44')],_0x20b0e7[_0x4dc5('0x45')]);_0x30c107['attributes']=_[_0x4dc5('0x47')](_0x20b0e7['model'],qs[_0x4dc5('0x48')](_0x39aabe[_0x4dc5('0x45')][_0x4dc5('0x48')]));_0x30c107[_0x4dc5('0x46')]=_0x30c107[_0x4dc5('0x46')][_0x4dc5('0x49')]?_0x30c107[_0x4dc5('0x46')]:_0x20b0e7[_0x4dc5('0x44')];if(!_0x39aabe[_0x4dc5('0x45')][_0x4dc5('0x6c')](_0x4dc5('0x4a'))){_0x30c107[_0x4dc5('0x2f')]=qs[_0x4dc5('0x2f')](_0x39aabe[_0x4dc5('0x45')][_0x4dc5('0x2f')]);_0x30c107[_0x4dc5('0x31')]=qs[_0x4dc5('0x31')](_0x39aabe[_0x4dc5('0x45')]['offset']);}_0x30c107[_0x4dc5('0x4b')]=qs['sort'](_0x39aabe[_0x4dc5('0x45')][_0x4dc5('0x4c')]);_0x30c107[_0x4dc5('0x4d')]=qs[_0x4dc5('0x4e')](_[_0x4dc5('0x4f')](_0x39aabe['query'],_0x20b0e7[_0x4dc5('0x4e')]));_0x30c107[_0x4dc5('0x4d')][_0x4dc5('0x68')]=_0x301c28['id'];if(_0x39aabe[_0x4dc5('0x45')]['filter']){_0x30c107[_0x4dc5('0x4d')]=_['merge'](_0x30c107['where'],{'$or':_[_0x4dc5('0x41')](_0x30c107[_0x4dc5('0x46')],function(_0x31078b){var _0x100c87={};_0x100c87[_0x31078b]={'$like':'%'+_0x39aabe[_0x4dc5('0x45')]['filter']+'%'};return _0x100c87;})});}_0x30c107=_['merge']({},_0x30c107,_0x39aabe[_0x4dc5('0x5b')]);return db[_0x4dc5('0x75')][_0x4dc5('0x30')]({'where':_0x30c107[_0x4dc5('0x4d')]})['then'](function(_0x1b3bb0){_0x589f8e['count']=_0x1b3bb0;if(_0x39aabe[_0x4dc5('0x45')]['includeAll']){_0x30c107[_0x4dc5('0x55')]=[{'model':db[_0x4dc5('0x78')],'as':_0x4dc5('0x79'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x4dc5('0x3d'),'fullname',_0x4dc5('0x7a')],'required':![]},{'model':db['Tag'],'as':_0x4dc5('0x7b'),'attributes':['id',_0x4dc5('0x3d'),_0x4dc5('0x7c')],'where':_0x39aabe[_0x4dc5('0x45')][_0x4dc5('0x7d')]?{'id':_0x39aabe[_0x4dc5('0x45')][_0x4dc5('0x7d')]}:undefined,'required':_0x39aabe[_0x4dc5('0x45')]['tag']?!![]:![]}];}return db[_0x4dc5('0x75')][_0x4dc5('0x56')](_0x30c107);})[_0x4dc5('0x20')](function(_0x2ad131){_0x589f8e[_0x4dc5('0x72')]=_0x2ad131;return _0x589f8e;});}})[_0x4dc5('0x20')](respondWithFilteredResult(_0x44d3cb,_0x30c107))[_0x4dc5('0x65')](handleError(_0x44d3cb,null));};exports[_0x4dc5('0x7e')]=function(_0x291350,_0x4f3ce5){var _0x410bb5=_0x291350['params']['id'];var _0x1954e5=_0x291350[_0x4dc5('0x5e')];var _0x42ace1=0xc8;var _0x1a8c78=null;return db[_0x4dc5('0x7f')][_0x4dc5('0x80')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x35e90){return db[_0x4dc5('0x53')]['findOne']({'where':{'id':_0x410bb5},'transaction':_0x35e90})[_0x4dc5('0x20')](function(_0x2f512a){if(_0x2f512a){return db[_0x4dc5('0x81')][_0x4dc5('0x38')]({'where':{'FaxAccountId':_0x410bb5},'transaction':_0x35e90})[_0x4dc5('0x20')](function(){var _0x11c83d=_['map'](_0x1954e5,function(_0x1371e0){_0x1371e0['FaxAccountId']=_0x410bb5;return _0x1371e0;});return db['FaxApplication'][_0x4dc5('0x82')](_0x11c83d,{'transaction':_0x35e90});});}else{_0x42ace1=0x194;_0x1a8c78=[];}});})['then'](function(){if(_0x42ace1!==0x194){return db[_0x4dc5('0x81')]['findAndCountAll']({'where':{'FaxAccountId':_0x410bb5},'order':_0x4dc5('0x83')})['then'](function(_0x9b571a){_0x1a8c78=_0x9b571a;});}})['catch'](function(_0x5da81d){_0x42ace1=0x1f4;logger['error'](_0x5da81d[_0x4dc5('0x3c')]);if(_0x5da81d[_0x4dc5('0x3d')]){delete _0x5da81d[_0x4dc5('0x3d')];}_0x1a8c78=_0x5da81d;})['finally'](function(){if(_0x1a8c78===null){_0x4f3ce5['sendStatus'](_0x42ace1);}else{if(_0x42ace1===0x1f4){_0x4f3ce5[_0x4dc5('0x2c')](_0x42ace1)[_0x4dc5('0x3e')](_0x1a8c78);}else{_0x4f3ce5['status'](_0x42ace1)['json'](_0x1a8c78);}}});};exports[_0x4dc5('0x84')]=function(_0x59d1a2,_0x20d2a4,_0x42d080){var _0x70a9e5={};var _0x57f9a3={};var _0x53806c;var _0x157166;return db['FaxAccount'][_0x4dc5('0x6a')]({'where':{'id':_0x59d1a2['params']['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x20d2a4,null))[_0x4dc5('0x20')](function(_0x28e14c){if(_0x28e14c){_0x53806c=_0x28e14c;_0x57f9a3['model']=_[_0x4dc5('0x5a')](db[_0x4dc5('0x81')]['rawAttributes']);_0x57f9a3[_0x4dc5('0x45')]=_[_0x4dc5('0x5a')](_0x59d1a2[_0x4dc5('0x45')]);_0x57f9a3[_0x4dc5('0x4e')]=_[_0x4dc5('0x47')](_0x57f9a3[_0x4dc5('0x44')],_0x57f9a3[_0x4dc5('0x45')]);_0x70a9e5[_0x4dc5('0x46')]=_[_0x4dc5('0x47')](_0x57f9a3[_0x4dc5('0x44')],qs[_0x4dc5('0x48')](_0x59d1a2['query'][_0x4dc5('0x48')]));_0x70a9e5['attributes']=_0x70a9e5[_0x4dc5('0x46')]['length']?_0x70a9e5[_0x4dc5('0x46')]:_0x57f9a3['model'];_0x70a9e5[_0x4dc5('0x4b')]=qs[_0x4dc5('0x4c')](_0x59d1a2[_0x4dc5('0x45')][_0x4dc5('0x4c')]);_0x70a9e5[_0x4dc5('0x4d')]=qs[_0x4dc5('0x4e')](_[_0x4dc5('0x4f')](_0x59d1a2[_0x4dc5('0x45')],_0x57f9a3[_0x4dc5('0x4e')]));if(_0x59d1a2[_0x4dc5('0x45')][_0x4dc5('0x50')]){_0x70a9e5[_0x4dc5('0x4d')]=_[_0x4dc5('0x51')](_0x70a9e5[_0x4dc5('0x4d')],{'$or':_['map'](_0x70a9e5[_0x4dc5('0x46')],function(_0x4ca8a0){var _0x55a472={};_0x55a472[_0x4ca8a0]={'$like':'%'+_0x59d1a2['query'][_0x4dc5('0x50')]+'%'};return _0x55a472;})});}_0x70a9e5=_[_0x4dc5('0x51')]({},_0x70a9e5,_0x59d1a2[_0x4dc5('0x5b')]);return _0x53806c[_0x4dc5('0x84')](_0x70a9e5);}})[_0x4dc5('0x20')](function(_0x537eaa){if(_0x537eaa){_0x157166=_0x537eaa[_0x4dc5('0x49')];if(!_0x59d1a2['query']['hasOwnProperty']('nolimit')){_0x70a9e5[_0x4dc5('0x2f')]=qs[_0x4dc5('0x2f')](_0x59d1a2[_0x4dc5('0x45')][_0x4dc5('0x2f')]);_0x70a9e5['offset']=qs['offset'](_0x59d1a2[_0x4dc5('0x45')][_0x4dc5('0x31')]);}return _0x53806c[_0x4dc5('0x84')](_0x70a9e5);}})[_0x4dc5('0x20')](function(_0x14bd93){if(_0x14bd93){return _0x14bd93?{'count':_0x157166,'rows':_0x14bd93}:null;}})[_0x4dc5('0x20')](respondWithResult(_0x20d2a4,null))[_0x4dc5('0x65')](handleError(_0x20d2a4,null));};function Extension(_0x45092b,_0x94f887,_0x249e81,_0x53cf8d){this[_0x4dc5('0x85')]='from-voip-provider';this[_0x4dc5('0x86')]=_0x45092b[_0x4dc5('0x87')];this[_0x4dc5('0x88')]=_0x53cf8d;this[_0x4dc5('0x43')]=_0x4dc5('0x89');this[_0x4dc5('0x8a')]=_0x4dc5('0x8b');this[_0x4dc5('0x68')]=_0x45092b['id'];this['priority']=_0x94f887;this[_0x4dc5('0x8c')]=_0x249e81;}function createExtensionsReciveFax(_0x5eb84a){var _0x35507f=0x1;var _0x19dd48=[];_0x19dd48[_0x4dc5('0x8d')](new Extension(_0x5eb84a,_0x35507f,'',_0x4dc5('0x8e')));_0x35507f+=0x1;_0x19dd48['push'](new Extension(_0x5eb84a,_0x35507f,_0x4dc5('0x8f'),_0x4dc5('0x90')));_0x35507f+=0x1;for(var _0x54a658 in _0x5eb84a){if(_0x5eb84a[_0x4dc5('0x6c')](_0x54a658)&&(_0x54a658===_0x4dc5('0x91')||_0x54a658===_0x4dc5('0x87')||_0x54a658===_0x4dc5('0x92')||_0x54a658==='faxdetect'||_0x54a658===_0x4dc5('0x93')||_0x54a658==='maxrate'||_0x54a658===_0x4dc5('0x94')||_0x54a658===_0x4dc5('0x95')||_0x54a658==='t38timeout')){_0x19dd48['push'](new Extension(_0x5eb84a,_0x35507f,'FAXOPT('+_0x54a658+')='+_0x5eb84a[_0x54a658],_0x4dc5('0x90')));_0x35507f+=0x1;}}_0x19dd48[_0x4dc5('0x8d')](new Extension(_0x5eb84a,_0x35507f,'6',_0x4dc5('0x96')));_0x35507f+=0x1;_0x19dd48[_0x4dc5('0x8d')](new Extension(_0x5eb84a,_0x35507f,'/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',_0x4dc5('0x97')));_0x35507f=0x0;return _0x19dd48;}exports[_0x4dc5('0x98')]=function(_0x1703f0,_0x5ae7d9,_0x1b5018){var _0x5b01b2;return db[_0x4dc5('0x7f')]['transaction'](function(_0x4a7cf1){return db['FaxAccount'][_0x4dc5('0x5d')](_0x1703f0[_0x4dc5('0x5e')],{'transaction':_0x4a7cf1})[_0x4dc5('0x20')](function(_0x213a1d){_0x5b01b2=_0x213a1d[_0x4dc5('0x39')]({'plain':!![]});return db[_0x4dc5('0x99')][_0x4dc5('0x82')](createExtensionsReciveFax(_0x5b01b2),{'transaction':_0x4a7cf1});});})['then'](function(){return _0x5b01b2;})['then'](respondWithResult(_0x5ae7d9,null))[_0x4dc5('0x65')](handleError(_0x5ae7d9,null));};exports[_0x4dc5('0x9a')]=function(_0x340dbd,_0x5a25d4,_0x379c78){var _0x306761;return db[_0x4dc5('0x7f')][_0x4dc5('0x80')](function(_0x591fc5){return db['FaxAccount'][_0x4dc5('0x37')](_0x340dbd['body'],{'where':{'id':_0x340dbd[_0x4dc5('0x5e')]['id']},'transaction':_0x591fc5})[_0x4dc5('0x20')](function(_0x568fdb){return db[_0x4dc5('0x99')][_0x4dc5('0x38')]({'where':{'FaxAccountId':_0x340dbd[_0x4dc5('0x5e')]['id']},'transaction':_0x591fc5})[_0x4dc5('0x20')](function(_0x150fa9){return db[_0x4dc5('0x99')][_0x4dc5('0x82')](createExtensionsReciveFax(_[_0x4dc5('0x76')](_0x340dbd[_0x4dc5('0x5e')],['tech',_0x4dc5('0x9b'),'createdAt',_0x4dc5('0x9c'),_0x4dc5('0x9d'),_0x4dc5('0x9e')])),{'transaction':_0x591fc5});});});})[_0x4dc5('0x20')](function(){return db[_0x4dc5('0x53')][_0x4dc5('0x9f')](_0x340dbd[_0x4dc5('0x5e')]['id']);})[_0x4dc5('0x20')](respondWithResult(_0x5a25d4,null))[_0x4dc5('0x65')](handleError(_0x5a25d4,null));};exports['getMessages']=function(_0x24e6d0,_0x3b39b6,_0x209542){var _0x4b911a={'raw':!![],'where':{}};var _0x2e2b63={};var _0x47d27d={'count':0x0,'rows':[]};return db[_0x4dc5('0x53')][_0x4dc5('0x6a')]({'where':{'id':_0x24e6d0[_0x4dc5('0x58')]['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x3b39b6,null))[_0x4dc5('0x20')](function(_0x3eb77e){if(_0x3eb77e){_0x2e2b63[_0x4dc5('0x44')]=_[_0x4dc5('0x5a')](db[_0x4dc5('0xa0')][_0x4dc5('0x42')]);_0x2e2b63[_0x4dc5('0x45')]=_[_0x4dc5('0x5a')](_0x24e6d0[_0x4dc5('0x45')]);_0x2e2b63['filters']=_['intersection'](_0x2e2b63['model'],_0x2e2b63[_0x4dc5('0x45')]);_0x4b911a['attributes']=_[_0x4dc5('0x47')](_0x2e2b63['model'],qs[_0x4dc5('0x48')](_0x24e6d0['query']['fields']));_0x4b911a[_0x4dc5('0x46')]=_0x4b911a[_0x4dc5('0x46')][_0x4dc5('0x49')]?_0x4b911a[_0x4dc5('0x46')]:_0x2e2b63[_0x4dc5('0x44')];if(!_0x24e6d0[_0x4dc5('0x45')][_0x4dc5('0x6c')](_0x4dc5('0x4a'))){_0x4b911a[_0x4dc5('0x2f')]=qs[_0x4dc5('0x2f')](_0x24e6d0['query']['limit']);_0x4b911a[_0x4dc5('0x31')]=qs['offset'](_0x24e6d0[_0x4dc5('0x45')][_0x4dc5('0x31')]);}_0x4b911a[_0x4dc5('0x4b')]=qs[_0x4dc5('0x4c')](_0x24e6d0['query'][_0x4dc5('0x4c')]);_0x4b911a[_0x4dc5('0x4d')]=qs['filters'](_['pick'](_0x24e6d0[_0x4dc5('0x45')],_0x2e2b63[_0x4dc5('0x4e')]));_0x4b911a[_0x4dc5('0x4d')][_0x4dc5('0x68')]=_0x3eb77e['id'];if(_0x24e6d0[_0x4dc5('0x45')][_0x4dc5('0x50')]){_0x4b911a[_0x4dc5('0x4d')]=_[_0x4dc5('0x51')](_0x4b911a['where'],{'$or':_[_0x4dc5('0x41')](_0x4b911a['attributes'],function(_0x43d01b){var _0x119c0c={};_0x119c0c[_0x43d01b]={'$like':'%'+_0x24e6d0[_0x4dc5('0x45')][_0x4dc5('0x50')]+'%'};return _0x119c0c;})});}if(_0x24e6d0[_0x4dc5('0x45')][_0x4dc5('0xa1')]){var _0x1935cd=_0x24e6d0[_0x4dc5('0x45')][_0x4dc5('0xa1')][_0x4dc5('0xa2')](',');var _0x19357a={};_0x19357a[_0x1935cd[0x0]]={'$gte':moment(_0x1935cd[0x1])[_0x4dc5('0xa3')](_0x4dc5('0xa4'))};_0x4b911a[_0x4dc5('0x4d')]=_['merge'](_0x4b911a[_0x4dc5('0x4d')],_0x19357a);}_0x4b911a=_[_0x4dc5('0x51')]({},_0x4b911a,_0x24e6d0[_0x4dc5('0x5b')]);return db[_0x4dc5('0xa0')][_0x4dc5('0x30')]({'where':_0x4b911a[_0x4dc5('0x4d')]})[_0x4dc5('0x20')](function(_0x4a6f15){_0x47d27d[_0x4dc5('0x30')]=_0x4a6f15;if(_0x24e6d0['query'][_0x4dc5('0x54')]){_0x4b911a[_0x4dc5('0x55')]=[{'all':!![]}];}return db[_0x4dc5('0xa0')]['findAll'](_0x4b911a);})[_0x4dc5('0x20')](function(_0x538252){_0x47d27d[_0x4dc5('0x72')]=_0x538252;return _0x47d27d;});}})['then'](respondWithFilteredResult(_0x3b39b6,_0x4b911a))[_0x4dc5('0x65')](handleError(_0x3b39b6,null));};exports[_0x4dc5('0x3e')]=function(_0x2bebe6,_0x3c9ddd,_0x2a8bac){var _0x2cab83,_0x3efbea={},_0x404f9f;if(_0x2bebe6[_0x4dc5('0x5e')]['to']){_0x404f9f=_0x2bebe6[_0x4dc5('0x5e')]['to'][0x0];}return db[_0x4dc5('0x53')][_0x4dc5('0x5c')]({'where':{'id':_0x2bebe6[_0x4dc5('0x58')]['id']},'include':[{'model':db[_0x4dc5('0xa5')],'as':_0x4dc5('0xa6'),'include':[{'model':db['CmContact'],'as':_0x4dc5('0xa7'),'where':{'fax':_0x404f9f},'limit':0x1,'order':[[_0x4dc5('0x9c'),'DESC']]}]}]})[_0x4dc5('0x20')](handleEntityNotFound(_0x3c9ddd,null))[_0x4dc5('0x20')](function(_0x471816){_0x2cab83=_0x471816;if(_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')]&&_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][_0x4dc5('0x49')]){for(var _0x129cd8=0x0;_0x129cd8<_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][_0x4dc5('0x49')];_0x129cd8+=0x1){_0x2bebe6[_0x4dc5('0x5e')]['attachments'][_0x129cd8]={'filename':_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][_0x129cd8][_0x4dc5('0x3d')],'id':_0x2bebe6[_0x4dc5('0x5e')]['attachments'][_0x129cd8]['id'],'path':path[_0x4dc5('0xa9')](config[_0x4dc5('0xaa')],_0x4dc5('0xab'),_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][_0x129cd8][_0x4dc5('0xac')])};}}return respondWithRpcPromise(_0x4dc5('0xad'),_0x4dc5('0xad'),{'FaxAccountId':_[_0x4dc5('0xae')](_0x2bebe6['params']['id'])?undefined:_0x2bebe6[_0x4dc5('0x58')]['id'],'path':_['isNil'](_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][0x0]['path'])?undefined:_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][0x0][_0x4dc5('0xaf')],'fax':_[_0x4dc5('0xae')](_0x2bebe6['body']['to'][0x0])?undefined:_0x2bebe6[_0x4dc5('0x5e')]['to'][0x0]},client9002);})[_0x4dc5('0x20')](function(){if(_0x2cab83){if(_[_0x4dc5('0xae')](_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xb0')])){_0x2bebe6[_0x4dc5('0x5e')]['from']=util['format'](_0x4dc5('0xb1'),_0x2cab83[_0x4dc5('0x3d')],_0x2cab83[_0x4dc5('0xb2')]);}if(_0x2cab83[_0x4dc5('0xa6')]){if(_0x2cab83[_0x4dc5('0xa6')][_0x4dc5('0xa7')][_0x4dc5('0x49')]){return _0x2cab83[_0x4dc5('0xa6')][_0x4dc5('0xa7')][0x0];}else{return db['CmContact']['create'](_[_0x4dc5('0x1a')](_0x2bebe6[_0x4dc5('0x5e')],{'firstName':_0x2bebe6[_0x4dc5('0x5e')]['to'][0x0],'phone':_0x2bebe6[_0x4dc5('0x5e')]['to'][0x0],'fax':_0x2bebe6[_0x4dc5('0x5e')]['to'][0x0],'ListId':_0x2cab83[_0x4dc5('0x9e')]}));}}else{throw new Error(_0x4dc5('0xb3'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x4dc5('0x20')](function(_0x55bc88){if(_0x55bc88){return db[_0x4dc5('0x75')]['find']({'where':{'ContactId':_0x55bc88['id'],'closed':![],'FaxAccountId':_0x2cab83['id']}})[_0x4dc5('0x20')](function(_0x28ad20){if(_0x28ad20){return[_0x28ad20,![]];}return db[_0x4dc5('0x75')][_0x4dc5('0x5d')]({'UserId':_0x2bebe6[_0x4dc5('0x5f')]['id'],'ContactId':_0x55bc88['id'],'FaxAccountId':_0x2cab83['id'],'fax':_0x2bebe6[_0x4dc5('0x5e')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x4dc5('0x51')](_0x2bebe6[_0x4dc5('0x5e')],{'read':![],'body':_0x2bebe6['body'][_0x4dc5('0xa8')][0x0][_0x4dc5('0xb4')],'FaxAccountId':_0x2cab83['id'],'UserId':_0x2bebe6['user']['id'],'ContactId':_0x55bc88['id'],'AttachmentId':_0x2bebe6[_0x4dc5('0x5e')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x4dc5('0xa0')],'as':_0x4dc5('0xb5')}]})[_0x4dc5('0x20')](function(_0x5d1566){return[_0x5d1566,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4dc5('0xb6')](function(_0x6d4e0b,_0xa3587a){if(_0xa3587a){return _0x6d4e0b;}return db[_0x4dc5('0xa0')][_0x4dc5('0x5d')]({'direction':_0x4dc5('0xb7'),'read':![],'body':_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][0x0][_0x4dc5('0xb4')],'FaxAccountId':_0x2cab83['id'],'FaxInteractionId':_0x6d4e0b['id'],'UserId':_0x2bebe6['user']['id'],'ContactId':_0x6d4e0b['ContactId'],'AttachmentId':_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][0x0]['id']})['then'](function(_0x2bbb8e){_0x6d4e0b[_0x4dc5('0xb8')][_0x4dc5('0xb5')]=[];_0x6d4e0b['dataValues'][_0x4dc5('0xb5')][_0x4dc5('0x8d')](_0x2bbb8e[_0x4dc5('0xb8')]);return _0x6d4e0b;});})[_0x4dc5('0x20')](function(_0x28bea6){respondWithRpcPromise(_0x4dc5('0xb9'),_0x4dc5('0xb9'),{'FaxAccountId':_[_0x4dc5('0xae')](_0x2bebe6[_0x4dc5('0x58')]['id'])?undefined:_0x2bebe6['params']['id'],'path':_[_0x4dc5('0xae')](_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][0x0][_0x4dc5('0xaf')])?undefined:_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][0x0]['path'],'fax':_[_0x4dc5('0xae')](_0x2bebe6['body']['to'][0x0])?undefined:_0x2bebe6['body']['to'][0x0],'AttachmentId':_0x2bebe6[_0x4dc5('0x5e')][_0x4dc5('0xa8')][0x0]['id']},client9002)[_0x4dc5('0x20')](function(_0x27556e){logger[_0x4dc5('0x29')]('SendFaxRpc,\x20%s',_0x27556e);})[_0x4dc5('0x65')](function(_0x233d51){logger[_0x4dc5('0x29')](_0x4dc5('0xba'),_0x233d51);});return _0x28bea6;})[_0x4dc5('0x20')](respondWithResult(_0x3c9ddd,null))[_0x4dc5('0x65')](handleError(_0x3c9ddd,null));};exports[_0x4dc5('0xbb')]=function(_0x93dfaf,_0x35940b,_0x2bfb6e){return db[_0x4dc5('0x53')][_0x4dc5('0x5c')]({'where':{'id':_0x93dfaf[_0x4dc5('0x58')]['id']}})['then'](handleEntityNotFound(_0x35940b,null))[_0x4dc5('0x20')](function(_0x17d70e){if(_0x17d70e){return _0x17d70e['addAgents'](_0x93dfaf['body']['ids'],_[_0x4dc5('0x76')](_0x93dfaf[_0x4dc5('0x5e')],[_0x4dc5('0x6e'),'id'])||{})[_0x4dc5('0xb6')](function(_0x5d071a){for(var _0x47980b=0x0;_0x47980b<_0x93dfaf[_0x4dc5('0x5e')][_0x4dc5('0x6e')][_0x4dc5('0x49')];_0x47980b+=0x1){socket[_0x4dc5('0xbc')](_0x4dc5('0xbd'),{'UserId':Number(_0x93dfaf[_0x4dc5('0x5e')][_0x4dc5('0x6e')][_0x47980b]),'FaxAccountId':Number(_0x93dfaf['params']['id'])});}return _0x5d071a;});}})[_0x4dc5('0x20')](respondWithResult(_0x35940b,null))[_0x4dc5('0x65')](handleError(_0x35940b,null));};exports['removeAgents']=function(_0x24ad90,_0x1b5100,_0x3aedf9){return db[_0x4dc5('0x53')][_0x4dc5('0x5c')]({'where':{'id':_0x24ad90[_0x4dc5('0x58')]['id']}})[_0x4dc5('0x20')](handleEntityNotFound(_0x1b5100,null))[_0x4dc5('0x20')](function(_0xc6bf9e){if(_0xc6bf9e){return _0xc6bf9e[_0x4dc5('0xbe')](_0x24ad90[_0x4dc5('0x45')][_0x4dc5('0x6e')])[_0x4dc5('0x20')](function(){if(_[_0x4dc5('0xbf')](_0x24ad90[_0x4dc5('0x45')][_0x4dc5('0x6e')])){for(var _0x388c72=0x0;_0x388c72<_0x24ad90[_0x4dc5('0x45')][_0x4dc5('0x6e')][_0x4dc5('0x49')];_0x388c72+=0x1){socket[_0x4dc5('0xbc')](_0x4dc5('0xc0'),{'UserId':Number(_0x24ad90['query']['ids'][_0x388c72]),'FaxAccountId':Number(_0x24ad90[_0x4dc5('0x58')]['id'])});}}else{socket['emit'](_0x4dc5('0xc0'),{'UserId':Number(_0x24ad90['query'][_0x4dc5('0x6e')]),'FaxAccountId':Number(_0x24ad90[_0x4dc5('0x58')]['id'])});}});}})[_0x4dc5('0x20')](respondWithStatusCode(_0x1b5100,null))[_0x4dc5('0x65')](handleError(_0x1b5100,null));};exports[_0x4dc5('0xc1')]=function(_0x3fab35,_0xd003c7,_0x2b0d8b){var _0x4161b6={};var _0x5cb34a={};var _0x5a26b8;var _0x43ea9d;return db[_0x4dc5('0x53')]['findOne']({'where':{'id':_0x3fab35[_0x4dc5('0x58')]['id']}})['then'](handleEntityNotFound(_0xd003c7,null))[_0x4dc5('0x20')](function(_0x4b1d91){if(_0x4b1d91){_0x5a26b8=_0x4b1d91;_0x5cb34a[_0x4dc5('0x44')]=_[_0x4dc5('0x5a')](db[_0x4dc5('0xc2')][_0x4dc5('0x42')]);_0x5cb34a[_0x4dc5('0x45')]=_[_0x4dc5('0x5a')](_0x3fab35['query']);_0x5cb34a['filters']=_['intersection'](_0x5cb34a['model'],_0x5cb34a[_0x4dc5('0x45')]);_0x4161b6['attributes']=_[_0x4dc5('0x47')](_0x5cb34a[_0x4dc5('0x44')],qs['fields'](_0x3fab35['query'][_0x4dc5('0x48')]));_0x4161b6[_0x4dc5('0x46')]=_0x4161b6['attributes']['length']?_0x4161b6['attributes']:_0x5cb34a[_0x4dc5('0x44')];_0x4161b6[_0x4dc5('0x4b')]=qs[_0x4dc5('0x4c')](_0x3fab35[_0x4dc5('0x45')][_0x4dc5('0x4c')]);_0x4161b6[_0x4dc5('0x4d')]=qs['filters'](_['pick'](_0x3fab35[_0x4dc5('0x45')],_0x5cb34a[_0x4dc5('0x4e')]));if(_0x3fab35[_0x4dc5('0x45')][_0x4dc5('0x50')]){_0x4161b6['where']=_['merge'](_0x4161b6[_0x4dc5('0x4d')],{'$or':_[_0x4dc5('0x41')](_0x4161b6[_0x4dc5('0x46')],function(_0x279f97){var _0x1b765c={};_0x1b765c[_0x279f97]={'$like':'%'+_0x3fab35['query'][_0x4dc5('0x50')]+'%'};return _0x1b765c;})});}_0x4161b6=_[_0x4dc5('0x51')]({},_0x4161b6,_0x3fab35[_0x4dc5('0x5b')]);return _0x5a26b8['getAgents'](_0x4161b6);}})[_0x4dc5('0x20')](function(_0x3e059e){if(_0x3e059e){_0x43ea9d=_0x3e059e[_0x4dc5('0x49')];if(!_0x3fab35[_0x4dc5('0x45')][_0x4dc5('0x6c')]('nolimit')){_0x4161b6[_0x4dc5('0x2f')]=qs[_0x4dc5('0x2f')](_0x3fab35['query']['limit']);_0x4161b6[_0x4dc5('0x31')]=qs[_0x4dc5('0x31')](_0x3fab35['query'][_0x4dc5('0x31')]);}return _0x5a26b8[_0x4dc5('0xc1')](_0x4161b6);}})[_0x4dc5('0x20')](function(_0x3f8406){if(_0x3f8406){return _0x3f8406?{'count':_0x43ea9d,'rows':_0x3f8406}:null;}})[_0x4dc5('0x20')](respondWithResult(_0xd003c7,null))[_0x4dc5('0x65')](handleError(_0xd003c7,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 53eb624..fd35a35 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 _0x2786=['exports','events','../../mysqldb','FaxAccount','save','update','emit','hasOwnProperty'];(function(_0x2b50f8,_0x1464ed){var _0x1a28ad=function(_0x19bd34){while(--_0x19bd34){_0x2b50f8['push'](_0x2b50f8['shift']());}};_0x1a28ad(++_0x1464ed);}(_0x2786,0xc1));var _0x6278=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2786[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x6278('0x0'));var FaxAccount=require(_0x6278('0x1'))['db'][_0x6278('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6278('0x3'),'afterUpdate':_0x6278('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5458ff){return function(_0x4ef4bf,_0x1eed5a,_0x12e559){FaxAccountEvents['emit'](_0x5458ff+':'+_0x4ef4bf['id'],_0x4ef4bf);FaxAccountEvents[_0x6278('0x5')](_0x5458ff,_0x4ef4bf);_0x12e559(null);};}for(var e in events){if(events[_0x6278('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x6278('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x77ec=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxAccount'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x77ec,0x1ab));var _0xc77e=function(_0x4749cc,_0x43be3f){_0x4749cc=_0x4749cc-0x0;var _0x16c4e5=_0x77ec[_0x4749cc];return _0x16c4e5;};'use strict';var EventEmitter=require(_0xc77e('0x0'));var FaxAccount=require(_0xc77e('0x1'))['db'][_0xc77e('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xc77e('0x3')](0x0);var events={'afterCreate':_0xc77e('0x4'),'afterUpdate':_0xc77e('0x5'),'afterDestroy':_0xc77e('0x6')};function emitEvent(_0x3d6374){return function(_0x3f56fa,_0x5656e2,_0x12007e){FaxAccountEvents[_0xc77e('0x7')](_0x3d6374+':'+_0x3f56fa['id'],_0x3f56fa);FaxAccountEvents[_0xc77e('0x7')](_0x3d6374,_0x3f56fa);_0x12007e(null);};}for(var e in events){if(events[_0xc77e('0x8')](e)){var event=events[e];FaxAccount[_0xc77e('0x9')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 900bc68..b910a8b 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 _0x7e99=['path','rimraf','./faxAccount.attributes','exports','define','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x247979,_0x544661){var _0x53319e=function(_0x20a06c){while(--_0x20a06c){_0x247979['push'](_0x247979['shift']());}};_0x53319e(++_0x544661);}(_0x7e99,0x1e7));var _0x97e9=function(_0x5ce15c,_0x19c917){_0x5ce15c=_0x5ce15c-0x0;var _0x36e4f5=_0x7e99[_0x5ce15c];return _0x36e4f5;};'use strict';var _=require(_0x97e9('0x0'));var util=require(_0x97e9('0x1'));var logger=require(_0x97e9('0x2'))(_0x97e9('0x3'));var moment=require(_0x97e9('0x4'));var BPromise=require(_0x97e9('0x5'));var rp=require(_0x97e9('0x6'));var fs=require('fs');var path=require(_0x97e9('0x7'));var rimraf=require(_0x97e9('0x8'));var config=require('../../config/environment');var attributes=require(_0x97e9('0x9'));module[_0x97e9('0xa')]=function(_0x3abbba,_0x405d2e){return _0x3abbba[_0x97e9('0xb')]('FaxAccount',attributes,{'tableName':_0x97e9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1be=['define','FaxAccount','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x1de4b8,_0x529b41){var _0x557699=function(_0xb10c18){while(--_0xb10c18){_0x1de4b8['push'](_0x1de4b8['shift']());}};_0x557699(++_0x529b41);}(_0xa1be,0xbd));var _0xea1b=function(_0x510c74,_0x4702f3){_0x510c74=_0x510c74-0x0;var _0x6c31fa=_0xa1be[_0x510c74];return _0x6c31fa;};'use strict';var _=require('lodash');var util=require(_0xea1b('0x0'));var logger=require(_0xea1b('0x1'))(_0xea1b('0x2'));var moment=require(_0xea1b('0x3'));var BPromise=require(_0xea1b('0x4'));var rp=require(_0xea1b('0x5'));var fs=require('fs');var path=require(_0xea1b('0x6'));var rimraf=require(_0xea1b('0x7'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0xea1b('0x8')]=function(_0x1e035d,_0x24c141){return _0x1e035d[_0xea1b('0x9')](_0xea1b('0xa'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 16814d8..937c729 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 _0x247d=['CmContact','describe','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','FaxApplication','Applications','get','applications','list','priority','asc','length','contact','fax','FaxInteraction','find','create','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','name','unshift','agent','queueId','FaxQueue','queue','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./faxAccount.socket','register','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','FaxAccount,\x20%s,\x20%s','message','result','catch','FaxAccount','findAll','options','where','attributes','limit','include','model','GetFaxAccount','stringify','NotifyFaxAccount','body'];(function(_0x42e433,_0x4ad5ad){var _0x100f1f=function(_0x297228){while(--_0x297228){_0x42e433['push'](_0x42e433['shift']());}};_0x100f1f(++_0x4ad5ad);}(_0x247d,0x94));var _0xd247=function(_0x983f45,_0x440680){_0x983f45=_0x983f45-0x0;var _0x3ebde8=_0x247d[_0x983f45];return _0x3ebde8;};'use strict';var _=require(_0xd247('0x0'));var util=require(_0xd247('0x1'));var moment=require(_0xd247('0x2'));var BPromise=require(_0xd247('0x3'));var rs=require(_0xd247('0x4'));var fs=require('fs');var Redis=require(_0xd247('0x5'));var db=require(_0xd247('0x6'))['db'];var utils=require(_0xd247('0x7'));var logger=require(_0xd247('0x8'))(_0xd247('0x9'));var config=require(_0xd247('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd247('0xb')]['http']({'port':0x232c});config[_0xd247('0xc')]=_[_0xd247('0xd')](config[_0xd247('0xc')],{'host':_0xd247('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd247('0xc')]));require(_0xd247('0xf'))[_0xd247('0x10')](socket);function respondWithRpcPromise(_0x18b220,_0x3e292a,_0x5196f2){return new BPromise(function(_0x22128d,_0x1a5c75){return client[_0xd247('0x11')](_0x18b220,_0x5196f2)[_0xd247('0x12')](function(_0x4c5f03){logger[_0xd247('0x13')]('FaxAccount,\x20%s,\x20%s',_0x3e292a,_0xd247('0x14'));logger[_0xd247('0x15')](_0xd247('0x16'),_0x3e292a,_0xd247('0x14'),JSON['stringify'](_0x4c5f03));if(_0x4c5f03[_0xd247('0x17')]){if(_0x4c5f03[_0xd247('0x17')]['code']===0x1f4){logger[_0xd247('0x17')](_0xd247('0x18'),_0x3e292a,_0x4c5f03[_0xd247('0x17')]['message']);return _0x1a5c75(_0x4c5f03[_0xd247('0x17')][_0xd247('0x19')]);}logger['error'](_0xd247('0x18'),_0x3e292a,_0x4c5f03['error'][_0xd247('0x19')]);return _0x22128d(_0x4c5f03['error']['message']);}else{logger[_0xd247('0x13')](_0xd247('0x18'),_0x3e292a,_0xd247('0x14'));_0x22128d(_0x4c5f03[_0xd247('0x1a')][_0xd247('0x19')]);}})[_0xd247('0x1b')](function(_0x441e72){logger[_0xd247('0x17')](_0xd247('0x18'),_0x3e292a,_0x441e72);_0x1a5c75(_0x441e72);});});}exports['GetFaxAccount']=function(_0x1675a2){var _0x30e30b=this;return new Promise(function(_0x151f40,_0x505244){return db[_0xd247('0x1c')][_0xd247('0x1d')]({'raw':_0x1675a2[_0xd247('0x1e')]?_0x1675a2[_0xd247('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1675a2[_0xd247('0x1e')]?_0x1675a2[_0xd247('0x1e')][_0xd247('0x1f')]||null:null,'attributes':_0x1675a2[_0xd247('0x1e')]?_0x1675a2[_0xd247('0x1e')][_0xd247('0x20')]||null:null,'limit':_0x1675a2[_0xd247('0x1e')]?_0x1675a2[_0xd247('0x1e')][_0xd247('0x21')]||null:null,'include':_0x1675a2[_0xd247('0x1e')]?_0x1675a2['options'][_0xd247('0x22')]?_['map'](_0x1675a2[_0xd247('0x1e')][_0xd247('0x22')],function(_0x4bfbb6){return{'model':db[_0x4bfbb6[_0xd247('0x23')]],'as':_0x4bfbb6['as'],'attributes':_0x4bfbb6['attributes'],'include':_0x4bfbb6['include']?_['map'](_0x4bfbb6[_0xd247('0x22')],function(_0x287c3d){return{'model':db[_0x287c3d['model']],'as':_0x287c3d['as'],'attributes':_0x287c3d['attributes'],'include':_0x287c3d[_0xd247('0x22')]?_['map'](_0x287c3d[_0xd247('0x22')],function(_0x449931){return{'model':db[_0x449931[_0xd247('0x23')]],'as':_0x449931['as'],'attributes':_0x449931[_0xd247('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd247('0x12')](function(_0x2dd2ec){logger['info'](_0xd247('0x24'),_0x1675a2);logger[_0xd247('0x15')]('GetFaxAccount',_0x1675a2,JSON[_0xd247('0x25')](_0x2dd2ec));_0x151f40(_0x2dd2ec);})['catch'](function(_0x174613){logger[_0xd247('0x17')](_0xd247('0x24'),_0x174613['message'],_0x1675a2);_0x505244(_0x30e30b['error'](0x1f4,_0x174613[_0xd247('0x19')]));});});};exports[_0xd247('0x26')]=function(_0x1504bb,_0x371fd1,_0x657902){var _0x610f2c=this;return new Promise(function(_0x25c3bc,_0x2a9e97){var _0x272480={'body':_0x1504bb[_0xd247('0x27')],'channel':'fax'};var _0xbf4409=[];var _0x4c7579=[];var _0x177edf={};return db[_0xd247('0x28')][_0xd247('0x29')]()[_0xd247('0x12')](function(_0x23dd00){if(!_0x23dd00){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0xbf4409=_[_0xd247('0x2a')](_[_0xd247('0x2b')](_0x23dd00),[_0xd247('0x2c'),'updatedAt']);_0x4c7579=_['difference'](_[_0xd247('0x2b')](_0x23dd00),[_0xd247('0x2c'),_0xd247('0x2d'),_0xd247('0x2e'),_0xd247('0x2f')]);if(_0x1504bb[_0xd247('0x27')]['id']){delete _0x1504bb[_0xd247('0x27')]['id'];}if(_[_0xd247('0x30')](_0x1504bb[_0xd247('0x27')][_0xd247('0x31')])){throw new db['Sequelize'][(_0xd247('0x32'))](_0xd247('0x33'));}if(_[_0xd247('0x30')](_0x1504bb[_0xd247('0x27')]['body'])||_0x1504bb[_0xd247('0x27')]['body']===''){throw new db[(_0xd247('0x34'))]['ValidationError'](_0xd247('0x35'));}if(_[_0xd247('0x30')](_0x1504bb[_0xd247('0x27')][_0xd247('0x36')])){throw new db['Sequelize'][(_0xd247('0x32'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4c7579);}if(!_[_0xd247('0x37')](_0x4c7579,_0x1504bb[_0xd247('0x27')]['mapKey'])){throw new db[(_0xd247('0x34'))][(_0xd247('0x32'))](_0xd247('0x38')+_0x4c7579);}_0x177edf[_0x1504bb[_0xd247('0x27')][_0xd247('0x36')]]=_0x1504bb[_0xd247('0x27')][_0xd247('0x31')];})[_0xd247('0x12')](function(){return db['FaxAccount']['find']({'where':{'id':_0x1504bb[_0xd247('0x39')]['id']},'include':[{'model':db[_0xd247('0x3a')],'as':_0xd247('0x3b'),'include':[{'model':db[_0xd247('0x28')],'as':_0xd247('0x3c'),'where':_0x177edf,'limit':0x1,'order':[[_0xd247('0x2d'),'DESC']]}]},{'model':db[_0xd247('0x3d')],'as':_0xd247('0x3e')}]});})[_0xd247('0x12')](function(_0x199afc){if(_0x199afc&&_0x199afc[_0xd247('0x3b')]){var _0x4a6f0d=_0x199afc[_0xd247('0x3f')]({'plain':!![]});_0x272480[_0xd247('0x39')]=_0x4a6f0d;_0x272480[_0xd247('0x40')]=_0x4a6f0d[_0xd247('0x3e')];_0x272480[_0xd247('0x41')]=_0x4a6f0d[_0xd247('0x3b')];_0x272480[_0xd247('0x40')]=_['orderBy'](_0x272480[_0xd247('0x40')],[_0xd247('0x42')],[_0xd247('0x43')]);if(_0x272480[_0xd247('0x39')]['Applications']){delete _0x272480[_0xd247('0x39')][_0xd247('0x3e')];}if(_0x272480['account']['List']&&_0x272480[_0xd247('0x39')]['List'][_0xd247('0x3c')][_0xd247('0x44')]){return _0x272480['account'][_0xd247('0x3b')]['Contacts'][0x0];}var _0x1c4a85=_['defaults'](_0x1504bb[_0xd247('0x27')],{'firstName':_0x1504bb[_0xd247('0x27')][_0xd247('0x31')],'ListId':_0x4a6f0d['ListId']});_0x1c4a85[_0x1504bb[_0xd247('0x27')][_0xd247('0x36')]]=_0x1504bb[_0xd247('0x27')][_0xd247('0x31')];return db[_0xd247('0x28')]['create'](_0x1c4a85,{'fields':_0xbf4409,'raw':!![]});}})['then'](function(_0x2a1481){_0x272480[_0xd247('0x45')]=_0x2a1481;if(_0x2a1481){var _0x2e2706={'ContactId':_0x2a1481['id'],'FaxAccountId':_0x1504bb[_0xd247('0x39')]['id'],'fax':_0x2a1481[_0xd247('0x46')]};return db[_0xd247('0x47')][_0xd247('0x48')]({'where':{'ContactId':_0x2a1481['id'],'closed':![],'FaxAccountId':_0x1504bb[_0xd247('0x39')]['id']}})[_0xd247('0x12')](function(_0x5c48e9){if(_0x5c48e9){return[_0x5c48e9,![]];}return db['FaxInteraction'][_0xd247('0x49')](_0x2e2706)[_0xd247('0x12')](function(_0x3fa094){return[_0x3fa094,!![]];});});}else{throw new Error(_0xd247('0x4a'));}})[_0xd247('0x4b')](function(_0xbb49db,_0x21449b){var _0x1754ba=_0xbb49db[_0xd247('0x3f')]({'plain':!![]});if(_0x21449b){if(_0x272480['account'][_0xd247('0x4c')]){_0x272480[_0xd247('0x40')][_0xd247('0x4d')]({'id':0x0,'priority':_0x272480['applications'][_0xd247('0x44')]+0x1,'app':_0xd247('0x4e'),'appdata':'unmanaged','interval':_0xd247('0x4f')});}_0x1754ba[_0xd247('0x50')]=!![];}else{_0x1754ba['created']=![];}_0x272480[_0xd247('0x51')]=_0x1754ba;return db[_0xd247('0x52')][_0xd247('0x49')]({'body':_0x1504bb[_0xd247('0x27')]['body'],'FaxAccountId':_0x1504bb[_0xd247('0x39')]['id'],'FaxInteractionId':_0xbb49db['id'],'direction':'in','ContactId':_0xbb49db[_0xd247('0x53')],'AttachmentId':_0x1504bb['body']['AttachmentId']});})['then'](function(_0x1e61d0){_0x272480['message']=_0x1e61d0;if(!_0x272480[_0xd247('0x51')][_0xd247('0x54')])return;return db[_0xd247('0x55')]['find']({'attributes':['id',_0xd247('0x56')],'where':{'id':_0x272480[_0xd247('0x51')]['UserId']}});})[_0xd247('0x12')](function(_0x52b579){if(_0x52b579){_0x272480['applications'][_0xd247('0x57')]({'id':0x0,'priority':0x0,'app':_0xd247('0x58'),'appdata':_0x52b579[_0xd247('0x56')]+','+(_0x272480['account']['waitForTheAssignedAgent']||0xa),'interval':_0xd247('0x4f')});}if(!_0x272480['interaction'][_0xd247('0x59')])return;return db[_0xd247('0x5a')][_0xd247('0x48')]({'attributes':['id','name'],'where':{'id':_0x272480[_0xd247('0x51')][_0xd247('0x59')]}});})[_0xd247('0x12')](function(_0x5babc8){if(_0x5babc8){_0x272480[_0xd247('0x40')][_0xd247('0x57')]({'id':0x0,'priority':0x1,'app':_0xd247('0x5b'),'appdata':_0x5babc8['name']+','+(_0x272480[_0xd247('0x39')]['waitForTheAssignedQueue']||0x12c),'interval':_0xd247('0x4f')});}return respondWithRpcPromise(_0xd247('0x5c'),_0xd247('0x5d'),_0x272480);})['then'](function(_0x35668a){_0x25c3bc(_0x35668a);})[_0xd247('0x1b')](function(_0x2a8724){_0x2a9e97(_0x610f2c[_0xd247('0x17')](0x1f4,_0x2a8724[_0xd247('0x19')]));});});}; \ No newline at end of file +var _0x0ff7=['CmList','List','Contacts','DESC','Applications','get','list','applications','priority','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','length','close','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','FaxQueue','queue','waitForTheAssignedQueue','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','FaxAccount,\x20%s,\x20%s','error','message','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','include','map','model','attributes','then','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account'];(function(_0x407d38,_0x3f0578){var _0x5d0978=function(_0x265fef){while(--_0x265fef){_0x407d38['push'](_0x407d38['shift']());}};_0x5d0978(++_0x3f0578);}(_0x0ff7,0xdf));var _0x70ff=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x0ff7[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x70ff('0x0'));var BPromise=require(_0x70ff('0x1'));var rs=require(_0x70ff('0x2'));var fs=require('fs');var Redis=require(_0x70ff('0x3'));var db=require(_0x70ff('0x4'))['db'];var utils=require(_0x70ff('0x5'));var logger=require('../../config/logger')(_0x70ff('0x6'));var config=require(_0x70ff('0x7'));var jayson=require(_0x70ff('0x8'));var client=jayson[_0x70ff('0x9')][_0x70ff('0xa')]({'port':0x232c});config[_0x70ff('0xb')]=_['defaults'](config[_0x70ff('0xb')],{'host':_0x70ff('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')[_0x70ff('0xd')](socket);function respondWithRpcPromise(_0x442755,_0x56d48e,_0x484283){return new BPromise(function(_0x456497,_0xb84664){return client[_0x70ff('0xe')](_0x442755,_0x484283)['then'](function(_0x541a04){logger[_0x70ff('0xf')]('FaxAccount,\x20%s,\x20%s',_0x56d48e,_0x70ff('0x10'));logger[_0x70ff('0x11')](_0x70ff('0x12'),_0x56d48e,_0x70ff('0x10'),JSON[_0x70ff('0x13')](_0x541a04));if(_0x541a04['error']){if(_0x541a04['error'][_0x70ff('0x14')]===0x1f4){logger['error'](_0x70ff('0x15'),_0x56d48e,_0x541a04[_0x70ff('0x16')][_0x70ff('0x17')]);return _0xb84664(_0x541a04[_0x70ff('0x16')][_0x70ff('0x17')]);}logger[_0x70ff('0x16')]('FaxAccount,\x20%s,\x20%s',_0x56d48e,_0x541a04[_0x70ff('0x16')]['message']);return _0x456497(_0x541a04[_0x70ff('0x16')][_0x70ff('0x17')]);}else{logger[_0x70ff('0xf')]('FaxAccount,\x20%s,\x20%s',_0x56d48e,_0x70ff('0x10'));_0x456497(_0x541a04['result']['message']);}})[_0x70ff('0x18')](function(_0x49bc82){logger[_0x70ff('0x16')]('FaxAccount,\x20%s,\x20%s',_0x56d48e,_0x49bc82);_0xb84664(_0x49bc82);});});}exports[_0x70ff('0x19')]=function(_0x3e7fdd){var _0x44584f=this;return new Promise(function(_0x332d00,_0x44624a){return db[_0x70ff('0x1a')][_0x70ff('0x1b')]({'raw':_0x3e7fdd[_0x70ff('0x1c')]?_0x3e7fdd[_0x70ff('0x1c')][_0x70ff('0x1d')]===undefined?!![]:![]:!![],'where':_0x3e7fdd[_0x70ff('0x1c')]?_0x3e7fdd[_0x70ff('0x1c')][_0x70ff('0x1e')]||null:null,'attributes':_0x3e7fdd[_0x70ff('0x1c')]?_0x3e7fdd[_0x70ff('0x1c')]['attributes']||null:null,'limit':_0x3e7fdd[_0x70ff('0x1c')]?_0x3e7fdd[_0x70ff('0x1c')]['limit']||null:null,'include':_0x3e7fdd[_0x70ff('0x1c')]?_0x3e7fdd[_0x70ff('0x1c')][_0x70ff('0x1f')]?_[_0x70ff('0x20')](_0x3e7fdd[_0x70ff('0x1c')][_0x70ff('0x1f')],function(_0xc52964){return{'model':db[_0xc52964[_0x70ff('0x21')]],'as':_0xc52964['as'],'attributes':_0xc52964[_0x70ff('0x22')],'include':_0xc52964[_0x70ff('0x1f')]?_[_0x70ff('0x20')](_0xc52964[_0x70ff('0x1f')],function(_0x227fe4){return{'model':db[_0x227fe4[_0x70ff('0x21')]],'as':_0x227fe4['as'],'attributes':_0x227fe4[_0x70ff('0x22')],'include':_0x227fe4['include']?_['map'](_0x227fe4[_0x70ff('0x1f')],function(_0x5ee1a1){return{'model':db[_0x5ee1a1['model']],'as':_0x5ee1a1['as'],'attributes':_0x5ee1a1[_0x70ff('0x22')]};}):[]};}):[]};}):[]:[]})[_0x70ff('0x23')](function(_0x39876f){logger[_0x70ff('0xf')](_0x70ff('0x19'),_0x3e7fdd);logger[_0x70ff('0x11')](_0x70ff('0x19'),_0x3e7fdd,JSON[_0x70ff('0x13')](_0x39876f));_0x332d00(_0x39876f);})['catch'](function(_0x168035){logger[_0x70ff('0x16')](_0x70ff('0x19'),_0x168035[_0x70ff('0x17')],_0x3e7fdd);_0x44624a(_0x44584f[_0x70ff('0x16')](0x1f4,_0x168035['message']));});});};exports[_0x70ff('0x24')]=function(_0x10bfad,_0x25a349,_0xdd2d56){var _0x40a0ec=this;return new Promise(function(_0x16f29c,_0x428b1e){var _0x484cf4={'body':_0x10bfad[_0x70ff('0x25')],'channel':_0x70ff('0x26')};var _0x5dd9e7=[];var _0x28731=[];var _0x190a5b={};return db[_0x70ff('0x27')][_0x70ff('0x28')]()['then'](function(_0xf60ca9){if(!_0xf60ca9){throw new db[(_0x70ff('0x29'))][(_0x70ff('0x2a'))]('no\x20available\x20attributes');}_0x5dd9e7=_[_0x70ff('0x2b')](_[_0x70ff('0x2c')](_0xf60ca9),[_0x70ff('0x2d'),_0x70ff('0x2e')]);_0x28731=_[_0x70ff('0x2b')](_[_0x70ff('0x2c')](_0xf60ca9),['createdAt',_0x70ff('0x2e'),_0x70ff('0x2f'),_0x70ff('0x30')]);if(_0x10bfad[_0x70ff('0x25')]['id']){delete _0x10bfad[_0x70ff('0x25')]['id'];}if(_[_0x70ff('0x31')](_0x10bfad['body'][_0x70ff('0x32')])){throw new db[(_0x70ff('0x29'))][(_0x70ff('0x2a'))](_0x70ff('0x33'));}if(_['isNil'](_0x10bfad['body'][_0x70ff('0x25')])||_0x10bfad['body'][_0x70ff('0x25')]===''){throw new db['Sequelize'][(_0x70ff('0x2a'))](_0x70ff('0x34'));}if(_['isNil'](_0x10bfad[_0x70ff('0x25')][_0x70ff('0x35')])){throw new db[(_0x70ff('0x29'))][(_0x70ff('0x2a'))](_0x70ff('0x36')+_0x28731);}if(!_[_0x70ff('0x37')](_0x28731,_0x10bfad[_0x70ff('0x25')]['mapKey'])){throw new db[(_0x70ff('0x29'))][(_0x70ff('0x2a'))](_0x70ff('0x38')+_0x28731);}_0x190a5b[_0x10bfad[_0x70ff('0x25')][_0x70ff('0x35')]]=_0x10bfad['body'][_0x70ff('0x32')];})['then'](function(){return db[_0x70ff('0x1a')][_0x70ff('0x39')]({'where':{'id':_0x10bfad[_0x70ff('0x3a')]['id']},'include':[{'model':db[_0x70ff('0x3b')],'as':_0x70ff('0x3c'),'include':[{'model':db['CmContact'],'as':_0x70ff('0x3d'),'where':_0x190a5b,'limit':0x1,'order':[[_0x70ff('0x2e'),_0x70ff('0x3e')]]}]},{'model':db['FaxApplication'],'as':_0x70ff('0x3f')}]});})[_0x70ff('0x23')](function(_0x12c23e){if(_0x12c23e&&_0x12c23e['List']){var _0x38145b=_0x12c23e[_0x70ff('0x40')]({'plain':!![]});_0x484cf4[_0x70ff('0x3a')]=_0x38145b;_0x484cf4['applications']=_0x38145b[_0x70ff('0x3f')];_0x484cf4[_0x70ff('0x41')]=_0x38145b[_0x70ff('0x3c')];_0x484cf4[_0x70ff('0x42')]=_['orderBy'](_0x484cf4[_0x70ff('0x42')],[_0x70ff('0x43')],['asc']);if(_0x484cf4[_0x70ff('0x3a')]['Applications']){delete _0x484cf4['account'][_0x70ff('0x3f')];}if(_0x484cf4[_0x70ff('0x3a')]['List']&&_0x484cf4[_0x70ff('0x3a')]['List'][_0x70ff('0x3d')]['length']){return _0x484cf4['account'][_0x70ff('0x3c')][_0x70ff('0x3d')][0x0];}var _0x3fa118=_[_0x70ff('0x44')](_0x10bfad[_0x70ff('0x25')],{'firstName':_0x10bfad[_0x70ff('0x25')][_0x70ff('0x32')],'ListId':_0x38145b['ListId']});_0x3fa118[_0x10bfad['body'][_0x70ff('0x35')]]=_0x10bfad['body'][_0x70ff('0x32')];return db[_0x70ff('0x27')][_0x70ff('0x45')](_0x3fa118,{'fields':_0x5dd9e7,'raw':!![]});}})[_0x70ff('0x23')](function(_0x319ff7){_0x484cf4[_0x70ff('0x46')]=_0x319ff7;if(_0x319ff7){var _0x4f71aa={'ContactId':_0x319ff7['id'],'FaxAccountId':_0x10bfad[_0x70ff('0x3a')]['id'],'fax':_0x319ff7[_0x70ff('0x26')]};return db[_0x70ff('0x47')][_0x70ff('0x39')]({'where':{'ContactId':_0x319ff7['id'],'closed':![],'FaxAccountId':_0x10bfad[_0x70ff('0x3a')]['id']}})[_0x70ff('0x23')](function(_0x1a452f){if(_0x1a452f){return[_0x1a452f,![]];}return db[_0x70ff('0x47')]['create'](_0x4f71aa)[_0x70ff('0x23')](function(_0xe89631){return[_0xe89631,!![]];});});}else{throw new Error(_0x70ff('0x48'));}})[_0x70ff('0x49')](function(_0x51cbf9,_0x2e448b){var _0x2deb67=_0x51cbf9[_0x70ff('0x40')]({'plain':!![]});if(_0x2e448b){if(_0x484cf4[_0x70ff('0x3a')][_0x70ff('0x4a')]){_0x484cf4[_0x70ff('0x42')][_0x70ff('0x4b')]({'id':0x0,'priority':_0x484cf4['applications'][_0x70ff('0x4c')]+0x1,'app':_0x70ff('0x4d'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x2deb67[_0x70ff('0x4e')]=!![];}else{_0x2deb67[_0x70ff('0x4e')]=![];}_0x484cf4[_0x70ff('0x4f')]=_0x2deb67;return db[_0x70ff('0x50')][_0x70ff('0x45')]({'body':_0x10bfad[_0x70ff('0x25')]['body'],'FaxAccountId':_0x10bfad[_0x70ff('0x3a')]['id'],'FaxInteractionId':_0x51cbf9['id'],'direction':'in','ContactId':_0x51cbf9['ContactId'],'AttachmentId':_0x10bfad[_0x70ff('0x25')][_0x70ff('0x51')]});})[_0x70ff('0x23')](function(_0x27d56f){_0x484cf4[_0x70ff('0x17')]=_0x27d56f;if(!_0x484cf4['interaction'][_0x70ff('0x52')])return;return db[_0x70ff('0x53')][_0x70ff('0x39')]({'attributes':['id',_0x70ff('0x54')],'where':{'id':_0x484cf4[_0x70ff('0x4f')]['UserId']}});})[_0x70ff('0x23')](function(_0x2a7f50){if(_0x2a7f50){_0x484cf4[_0x70ff('0x42')][_0x70ff('0x55')]({'id':0x0,'priority':0x0,'app':_0x70ff('0x56'),'appdata':_0x2a7f50[_0x70ff('0x54')]+','+(_0x484cf4[_0x70ff('0x3a')][_0x70ff('0x57')]||0xa),'interval':_0x70ff('0x58')});}if(!_0x484cf4[_0x70ff('0x4f')][_0x70ff('0x59')])return;return db[_0x70ff('0x5a')][_0x70ff('0x39')]({'attributes':['id',_0x70ff('0x54')],'where':{'id':_0x484cf4[_0x70ff('0x4f')][_0x70ff('0x59')]}});})[_0x70ff('0x23')](function(_0x4266b8){if(_0x4266b8){_0x484cf4[_0x70ff('0x42')][_0x70ff('0x55')]({'id':0x0,'priority':0x1,'app':_0x70ff('0x5b'),'appdata':_0x4266b8[_0x70ff('0x54')]+','+(_0x484cf4[_0x70ff('0x3a')][_0x70ff('0x5c')]||0x12c),'interval':_0x70ff('0x58')});}return respondWithRpcPromise('Start',_0x70ff('0x5d'),_0x484cf4);})[_0x70ff('0x23')](function(_0x23c895){_0x16f29c(_0x23c895);})['catch'](function(_0xe88f42){_0x428b1e(_0x40a0ec[_0x70ff('0x16')](0x1f4,_0xe88f42[_0x70ff('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 541af5f..34cf35b 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 _0x1e5c=['emit','removeListener','register','faxAccount:','save','update'];(function(_0xd2730e,_0x32b64f){var _0x8fc68a=function(_0x3ec827){while(--_0x3ec827){_0xd2730e['push'](_0xd2730e['shift']());}};_0x8fc68a(++_0x32b64f);}(_0x1e5c,0xe8));var _0xc1e5=function(_0x157f81,_0x5ef4a3){_0x157f81=_0x157f81-0x0;var _0x27de15=_0x1e5c[_0x157f81];return _0x27de15;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xc1e5('0x0'),'remove',_0xc1e5('0x1')];function createListener(_0x480418,_0x28dcb2){return function(_0x268786){_0x28dcb2[_0xc1e5('0x2')](_0x480418,_0x268786);};}function removeListener(_0x12e750,_0x21b94b){return function(){FaxAccountEvents[_0xc1e5('0x3')](_0x12e750,_0x21b94b);};}exports[_0xc1e5('0x4')]=function(_0x1edc7d){for(var _0x270ec0=0x0,_0x46df9b=events['length'];_0x270ec0<_0x46df9b;_0x270ec0++){var _0x3967d1=events[_0x270ec0];var _0x572425=createListener(_0xc1e5('0x5')+_0x3967d1,_0x1edc7d);FaxAccountEvents['on'](_0x3967d1,_0x572425);}}; \ No newline at end of file +var _0xb35f=['register','length','faxAccount:','./faxAccount.events','save','emit','removeListener'];(function(_0x4fea6f,_0x525c40){var _0x4d148b=function(_0x464a53){while(--_0x464a53){_0x4fea6f['push'](_0x4fea6f['shift']());}};_0x4d148b(++_0x525c40);}(_0xb35f,0x73));var _0xfb35=function(_0x408a25,_0x3d8918){_0x408a25=_0x408a25-0x0;var _0x2d5217=_0xb35f[_0x408a25];return _0x2d5217;};'use strict';var FaxAccountEvents=require(_0xfb35('0x0'));var events=[_0xfb35('0x1'),'remove','update'];function createListener(_0x53401f,_0x156c4f){return function(_0x5aaa13){_0x156c4f[_0xfb35('0x2')](_0x53401f,_0x5aaa13);};}function removeListener(_0x5a8ec8,_0x196149){return function(){FaxAccountEvents[_0xfb35('0x3')](_0x5a8ec8,_0x196149);};}exports[_0xfb35('0x4')]=function(_0x552ec4){for(var _0xb705dc=0x0,_0x250a36=events[_0xfb35('0x5')];_0xb705dc<_0x250a36;_0xb705dc++){var _0x5a2453=events[_0xb705dc];var _0x4c7fa3=createListener(_0xfb35('0x6')+_0x5a2453,_0x552ec4);FaxAccountEvents['on'](_0x5a2453,_0x4c7fa3);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index eb27b2b..c72d03e 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 _0xd1fe=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/users','getAgents','post','addDisposition','addAnswer','addInteraction','/addaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0xd1fe,0x10b));var _0xed1f=function(_0x595038,_0xc62f9e){_0x595038=_0x595038-0x0;var _0x353f51=_0xd1fe[_0x595038];return _0x353f51;};'use strict';var multer=require(_0xed1f('0x0'));var util=require(_0xed1f('0x1'));var path=require(_0xed1f('0x2'));var timeout=require(_0xed1f('0x3'));var express=require(_0xed1f('0x4'));var router=express[_0xed1f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xed1f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xed1f('0x7'));var controller=require('./faxAccount.controller');router['get']('/',auth[_0xed1f('0x8')](),controller[_0xed1f('0x9')]);router[_0xed1f('0xa')](_0xed1f('0xb'),auth[_0xed1f('0x8')](),controller[_0xed1f('0xc')]);router[_0xed1f('0xa')](_0xed1f('0xd'),auth[_0xed1f('0x8')](),controller[_0xed1f('0xe')]);router[_0xed1f('0xa')](_0xed1f('0xf'),auth[_0xed1f('0x8')](),controller[_0xed1f('0x10')]);router['get'](_0xed1f('0x11'),auth[_0xed1f('0x8')](),controller['getAnswers']);router['get'](_0xed1f('0x12'),auth[_0xed1f('0x8')](),controller[_0xed1f('0x13')]);router[_0xed1f('0xa')](_0xed1f('0x14'),auth[_0xed1f('0x8')](),controller[_0xed1f('0x15')]);router['get']('/:id/messages',auth[_0xed1f('0x8')](),controller[_0xed1f('0x16')]);router[_0xed1f('0xa')](_0xed1f('0x17'),auth[_0xed1f('0x8')](),controller[_0xed1f('0x18')]);router[_0xed1f('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0xed1f('0x19')]('/:id/dispositions',auth[_0xed1f('0x8')](),controller[_0xed1f('0x1a')]);router['post'](_0xed1f('0x11'),auth[_0xed1f('0x8')](),controller[_0xed1f('0x1b')]);router[_0xed1f('0x19')]('/:id/interactions',auth[_0xed1f('0x8')](),controller[_0xed1f('0x1c')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0xed1f('0x19')](_0xed1f('0x1d'),auth[_0xed1f('0x8')](),controller['addAccountApplications']);router[_0xed1f('0x19')]('/updateaccountapplications',auth[_0xed1f('0x8')](),controller[_0xed1f('0x1e')]);router[_0xed1f('0x19')](_0xed1f('0x1f'),auth[_0xed1f('0x8')](),controller[_0xed1f('0x20')]);router[_0xed1f('0x19')](_0xed1f('0x17'),auth['isAuthenticated'](),controller[_0xed1f('0x21')]);router[_0xed1f('0x22')]('/:id',auth[_0xed1f('0x8')](),controller['update']);router[_0xed1f('0x23')](_0xed1f('0xd'),auth['isAuthenticated'](),controller[_0xed1f('0x24')]);router[_0xed1f('0x23')](_0xed1f('0xf'),auth[_0xed1f('0x8')](),controller[_0xed1f('0x25')]);router['delete'](_0xed1f('0x11'),auth[_0xed1f('0x8')](),controller[_0xed1f('0x26')]);router[_0xed1f('0x23')]('/:id/users',auth[_0xed1f('0x8')](),controller[_0xed1f('0x27')]);module['exports']=router; \ No newline at end of file +var _0x29c0=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','/:id/users','post','create','addDisposition','addInteraction','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller'];(function(_0x46a267,_0x3fa3a0){var _0x8c4854=function(_0x42fa90){while(--_0x42fa90){_0x46a267['push'](_0x46a267['shift']());}};_0x8c4854(++_0x3fa3a0);}(_0x29c0,0x11b));var _0x029c=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x29c0[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0x029c('0x0'));var util=require(_0x029c('0x1'));var path=require(_0x029c('0x2'));var timeout=require(_0x029c('0x3'));var express=require(_0x029c('0x4'));var router=express[_0x029c('0x5')]();var fs_extra=require(_0x029c('0x6'));var auth=require(_0x029c('0x7'));var interaction=require(_0x029c('0x8'));var config=require(_0x029c('0x9'));var controller=require(_0x029c('0xa'));router[_0x029c('0xb')]('/',auth[_0x029c('0xc')](),controller[_0x029c('0xd')]);router[_0x029c('0xb')](_0x029c('0xe'),auth[_0x029c('0xc')](),controller[_0x029c('0xf')]);router[_0x029c('0xb')](_0x029c('0x10'),auth[_0x029c('0xc')](),controller[_0x029c('0x11')]);router[_0x029c('0xb')](_0x029c('0x12'),auth[_0x029c('0xc')](),controller[_0x029c('0x13')]);router['get'](_0x029c('0x14'),auth[_0x029c('0xc')](),controller['getAnswers']);router[_0x029c('0xb')](_0x029c('0x15'),auth[_0x029c('0xc')](),controller[_0x029c('0x16')]);router[_0x029c('0xb')](_0x029c('0x17'),auth[_0x029c('0xc')](),controller['getApplications']);router[_0x029c('0xb')]('/:id/messages',auth[_0x029c('0xc')](),controller['getMessages']);router['get'](_0x029c('0x18'),auth['isAuthenticated'](),controller['getAgents']);router[_0x029c('0x19')]('/',auth[_0x029c('0xc')](),controller[_0x029c('0x1a')]);router['post']('/:id/dispositions',auth[_0x029c('0xc')](),controller[_0x029c('0x1b')]);router['post'](_0x029c('0x14'),auth[_0x029c('0xc')](),controller['addAnswer']);router[_0x029c('0x19')](_0x029c('0x15'),auth[_0x029c('0xc')](),controller[_0x029c('0x1c')]);router[_0x029c('0x19')]('/:id/applications',auth[_0x029c('0xc')](),controller[_0x029c('0x1d')]);router[_0x029c('0x19')](_0x029c('0x1e'),auth[_0x029c('0xc')](),controller['addAccountApplications']);router[_0x029c('0x19')](_0x029c('0x1f'),auth[_0x029c('0xc')](),controller[_0x029c('0x20')]);router[_0x029c('0x19')](_0x029c('0x21'),auth[_0x029c('0xc')](),controller[_0x029c('0x22')]);router[_0x029c('0x19')](_0x029c('0x18'),auth[_0x029c('0xc')](),controller[_0x029c('0x23')]);router['put'](_0x029c('0x10'),auth[_0x029c('0xc')](),controller[_0x029c('0x24')]);router[_0x029c('0x25')]('/:id',auth[_0x029c('0xc')](),controller[_0x029c('0x26')]);router[_0x029c('0x25')]('/:id/dispositions',auth[_0x029c('0xc')](),controller[_0x029c('0x27')]);router[_0x029c('0x25')](_0x029c('0x14'),auth[_0x029c('0xc')](),controller[_0x029c('0x28')]);router[_0x029c('0x25')](_0x029c('0x18'),auth[_0x029c('0xc')](),controller[_0x029c('0x29')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 96626ef..c7beb97 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 _0x6b82=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x529f1c,_0x437ed1){var _0x4d57ab=function(_0x39d479){while(--_0x39d479){_0x529f1c['push'](_0x529f1c['shift']());}};_0x4d57ab(++_0x437ed1);}(_0x6b82,0x1de));var _0x26b8=function(_0x3f5522,_0x28e324){_0x3f5522=_0x3f5522-0x0;var _0x4731f1=_0x6b82[_0x3f5522];return _0x4731f1;};'use strict';var Sequelize=require(_0x26b8('0x0'));module['exports']={'priority':{'type':Sequelize[_0x26b8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x26b8('0x2')],'allowNull':![],'defaultValue':_0x26b8('0x3')},'appdata':{'type':Sequelize[_0x26b8('0x4')]()},'description':{'type':Sequelize[_0x26b8('0x2')]},'interval':{'type':Sequelize[_0x26b8('0x2')],'defaultValue':_0x26b8('0x5')}}; \ No newline at end of file +var _0xfb46=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xfb46,0x1dd));var _0x6fb4=function(_0x2f1d2f,_0x527d85){_0x2f1d2f=_0x2f1d2f-0x0;var _0x2874cf=_0xfb46[_0x2f1d2f];return _0x2874cf;};'use strict';var Sequelize=require(_0x6fb4('0x0'));module[_0x6fb4('0x1')]={'priority':{'type':Sequelize[_0x6fb4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6fb4('0x3')],'allowNull':![],'defaultValue':_0x6fb4('0x4')},'appdata':{'type':Sequelize[_0x6fb4('0x5')]()},'description':{'type':Sequelize[_0x6fb4('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 1735978..9e6a909 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 _0x5327=['keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','find','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','model'];(function(_0x11a05f,_0x38a6af){var _0xdfea63=function(_0x53d39c){while(--_0x53d39c){_0x11a05f['push'](_0x11a05f['shift']());}};_0xdfea63(++_0x38a6af);}(_0x5327,0xef));var _0x7532=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5327[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7532('0x0'));var rimraf=require(_0x7532('0x1'));var zipdir=require(_0x7532('0x2'));var jsonpatch=require(_0x7532('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7532('0x4'));var Mustache=require(_0x7532('0x5'));var util=require(_0x7532('0x6'));var path=require(_0x7532('0x7'));var sox=require(_0x7532('0x8'));var csv=require(_0x7532('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7532('0xa'));var _=require(_0x7532('0xb'));var squel=require('squel');var crypto=require(_0x7532('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7532('0xd'));var toCsv=require(_0x7532('0x9'));var querystring=require(_0x7532('0xe'));var Papa=require(_0x7532('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7532('0x10'));var hardwareService=require(_0x7532('0x11'));var logger=require(_0x7532('0x12'))(_0x7532('0x13'));var utils=require(_0x7532('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7532('0x15'));var db=require(_0x7532('0x16'))['db'];function respondWithStatusCode(_0x2377bb,_0x529bce){_0x529bce=_0x529bce||0xcc;return function(_0x511867){if(_0x511867){return _0x2377bb[_0x7532('0x17')](_0x529bce);}return _0x2377bb['status'](_0x529bce)[_0x7532('0x18')]();};}function respondWithResult(_0x430321,_0xa5cdf8){_0xa5cdf8=_0xa5cdf8||0xc8;return function(_0x58c91f){if(_0x58c91f){return _0x430321[_0x7532('0x19')](_0xa5cdf8)[_0x7532('0x1a')](_0x58c91f);}};}function respondWithFilteredResult(_0x226d5e,_0x449227){return function(_0x5902a4){if(_0x5902a4){var _0x4a216d=typeof _0x449227[_0x7532('0x1b')]===_0x7532('0x1c')&&typeof _0x449227[_0x7532('0x1d')]===_0x7532('0x1c');var _0x31eece=_0x5902a4[_0x7532('0x1e')];var _0x2e965e=_0x4a216d?0x0:_0x449227[_0x7532('0x1b')];var _0x517fe2=_0x4a216d?_0x5902a4[_0x7532('0x1e')]:_0x449227['offset']+_0x449227[_0x7532('0x1d')];var _0x59cdb5;if(_0x517fe2>=_0x31eece){_0x517fe2=_0x31eece;_0x59cdb5=0xc8;}else{_0x59cdb5=0xce;}_0x226d5e['status'](_0x59cdb5);return _0x226d5e[_0x7532('0x1f')](_0x7532('0x20'),_0x2e965e+'-'+_0x517fe2+'/'+_0x31eece)['json'](_0x5902a4);}return null;};}function patchUpdates(_0x30f45f){return function(_0x463fed){try{jsonpatch[_0x7532('0x21')](_0x463fed,_0x30f45f,!![]);}catch(_0x517d7b){return BPromise[_0x7532('0x22')](_0x517d7b);}return _0x463fed[_0x7532('0x23')]();};}function saveUpdates(_0x5978ba,_0xb33cf6){return function(_0x37ca92){if(_0x37ca92){return _0x37ca92[_0x7532('0x24')](_0x5978ba)[_0x7532('0x25')](function(_0x587d61){return _0x587d61;});}return null;};}function removeEntity(_0x4d6272,_0x1205fa){return function(_0x141b71){if(_0x141b71){return _0x141b71[_0x7532('0x26')]()[_0x7532('0x25')](function(){_0x4d6272[_0x7532('0x19')](0xcc)[_0x7532('0x18')]();});}};}function handleEntityNotFound(_0x1461cb,_0x22710e){return function(_0x1157a6){if(!_0x1157a6){_0x1461cb[_0x7532('0x17')](0x194);}return _0x1157a6;};}function handleError(_0x2fbe1b,_0x44f4be){_0x44f4be=_0x44f4be||0x1f4;return function(_0x44e49b){logger['error'](_0x44e49b[_0x7532('0x27')]);if(_0x44e49b[_0x7532('0x28')]){delete _0x44e49b['name'];}_0x2fbe1b['status'](_0x44f4be)[_0x7532('0x29')](_0x44e49b);};}exports[_0x7532('0x2a')]=function(_0x5b80a3,_0x1ca14c){var _0x1d42e2={},_0x3c7114={},_0x173761={'count':0x0,'rows':[]};var _0x243822=_[_0x7532('0x2b')](db[_0x7532('0x2c')][_0x7532('0x2d')],function(_0x3d21df){return{'name':_0x3d21df[_0x7532('0x2e')],'type':_0x3d21df[_0x7532('0x2f')]['key']};});_0x3c7114[_0x7532('0x30')]=_[_0x7532('0x2b')](_0x243822,'name');_0x3c7114['query']=_[_0x7532('0x31')](_0x5b80a3[_0x7532('0x32')]);_0x3c7114[_0x7532('0x33')]=_[_0x7532('0x34')](_0x3c7114[_0x7532('0x30')],_0x3c7114['query']);_0x1d42e2[_0x7532('0x35')]=_['intersection'](_0x3c7114[_0x7532('0x30')],qs[_0x7532('0x36')](_0x5b80a3['query'][_0x7532('0x36')]));_0x1d42e2[_0x7532('0x35')]=_0x1d42e2[_0x7532('0x35')]['length']?_0x1d42e2[_0x7532('0x35')]:_0x3c7114[_0x7532('0x30')];if(!_0x5b80a3[_0x7532('0x32')][_0x7532('0x37')](_0x7532('0x38'))){_0x1d42e2['limit']=qs[_0x7532('0x1d')](_0x5b80a3['query'][_0x7532('0x1d')]);_0x1d42e2[_0x7532('0x1b')]=qs[_0x7532('0x1b')](_0x5b80a3[_0x7532('0x32')][_0x7532('0x1b')]);}_0x1d42e2[_0x7532('0x39')]=qs[_0x7532('0x3a')](_0x5b80a3[_0x7532('0x32')][_0x7532('0x3a')]);_0x1d42e2[_0x7532('0x3b')]=qs[_0x7532('0x33')](_['pick'](_0x5b80a3[_0x7532('0x32')],_0x3c7114[_0x7532('0x33')]),_0x243822);if(_0x5b80a3[_0x7532('0x32')][_0x7532('0x3c')]){_0x1d42e2[_0x7532('0x3b')]=_[_0x7532('0x3d')](_0x1d42e2[_0x7532('0x3b')],{'$or':_[_0x7532('0x2b')](_0x243822,function(_0x228b59){if(_0x228b59['type']!==_0x7532('0x3e')){var _0x2bdeb9={};_0x2bdeb9[_0x228b59[_0x7532('0x28')]]={'$like':'%'+_0x5b80a3['query'][_0x7532('0x3c')]+'%'};return _0x2bdeb9;}})});}_0x1d42e2=_[_0x7532('0x3d')]({},_0x1d42e2,_0x5b80a3[_0x7532('0x3f')]);var _0xfc3233={'where':_0x1d42e2[_0x7532('0x3b')]};return db['FaxApplication'][_0x7532('0x1e')](_0xfc3233)[_0x7532('0x25')](function(_0x5a457c){_0x173761['count']=_0x5a457c;if(_0x5b80a3[_0x7532('0x32')][_0x7532('0x40')]){_0x1d42e2['include']=[{'all':!![]}];}return db[_0x7532('0x2c')]['findAll'](_0x1d42e2);})[_0x7532('0x25')](function(_0x406b1a){_0x173761[_0x7532('0x41')]=_0x406b1a;return _0x173761;})['then'](respondWithFilteredResult(_0x1ca14c,_0x1d42e2))[_0x7532('0x42')](handleError(_0x1ca14c,null));};exports[_0x7532('0x43')]=function(_0x304796,_0x3f5f25){var _0x280a9a={'raw':!![],'where':{'id':_0x304796['params']['id']}},_0x1d46d4={};_0x1d46d4[_0x7532('0x30')]=_[_0x7532('0x31')](db['FaxApplication'][_0x7532('0x2d')]);_0x1d46d4[_0x7532('0x32')]=_['keys'](_0x304796[_0x7532('0x32')]);_0x1d46d4['filters']=_['intersection'](_0x1d46d4['model'],_0x1d46d4['query']);_0x280a9a['attributes']=_[_0x7532('0x34')](_0x1d46d4['model'],qs[_0x7532('0x36')](_0x304796[_0x7532('0x32')]['fields']));_0x280a9a[_0x7532('0x35')]=_0x280a9a['attributes'][_0x7532('0x44')]?_0x280a9a[_0x7532('0x35')]:_0x1d46d4['model'];if(_0x304796[_0x7532('0x32')][_0x7532('0x40')]){_0x280a9a['include']=[{'all':!![]}];}_0x280a9a=_[_0x7532('0x3d')]({},_0x280a9a,_0x304796[_0x7532('0x3f')]);return db[_0x7532('0x2c')][_0x7532('0x45')](_0x280a9a)[_0x7532('0x25')](handleEntityNotFound(_0x3f5f25,null))[_0x7532('0x25')](respondWithResult(_0x3f5f25,null))['catch'](handleError(_0x3f5f25,null));};exports['create']=function(_0xda6545,_0x261bf5){return db[_0x7532('0x2c')]['create'](_0xda6545[_0x7532('0x46')],{})[_0x7532('0x25')](respondWithResult(_0x261bf5,0xc9))[_0x7532('0x42')](handleError(_0x261bf5,null));};exports['update']=function(_0x52734c,_0x50c52c){if(_0x52734c[_0x7532('0x46')]['id']){delete _0x52734c[_0x7532('0x46')]['id'];}return db[_0x7532('0x2c')][_0x7532('0x45')]({'where':{'id':_0x52734c['params']['id']}})[_0x7532('0x25')](handleEntityNotFound(_0x50c52c,null))[_0x7532('0x25')](saveUpdates(_0x52734c[_0x7532('0x46')],null))[_0x7532('0x25')](respondWithResult(_0x50c52c,null))[_0x7532('0x42')](handleError(_0x50c52c,null));};exports[_0x7532('0x26')]=function(_0xe474ed,_0x221971){return db[_0x7532('0x2c')][_0x7532('0x45')]({'where':{'id':_0xe474ed[_0x7532('0x47')]['id']}})[_0x7532('0x25')](handleEntityNotFound(_0x221971,null))[_0x7532('0x25')](removeEntity(_0x221971,null))[_0x7532('0x42')](handleError(_0x221971,null));}; \ No newline at end of file +var _0xd0ed=['rows','catch','show','params','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply','update','then','destroy','end','error','stack','name','send','index','map','FaxApplication','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd0ed,0x12e));var _0xdd0e=function(_0x5f48f0,_0x2c75aa){_0x5f48f0=_0x5f48f0-0x0;var _0x1d5f5a=_0xd0ed[_0x5f48f0];return _0x1d5f5a;};'use strict';var emlformat=require(_0xdd0e('0x0'));var rimraf=require(_0xdd0e('0x1'));var zipdir=require(_0xdd0e('0x2'));var jsonpatch=require(_0xdd0e('0x3'));var rp=require(_0xdd0e('0x4'));var moment=require(_0xdd0e('0x5'));var BPromise=require(_0xdd0e('0x6'));var Mustache=require(_0xdd0e('0x7'));var util=require(_0xdd0e('0x8'));var path=require(_0xdd0e('0x9'));var sox=require(_0xdd0e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd0e('0xb'));var squel=require('squel');var crypto=require(_0xdd0e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdd0e('0xd'));var querystring=require(_0xdd0e('0xe'));var Papa=require(_0xdd0e('0xf'));var Redis=require(_0xdd0e('0x10'));var authService=require(_0xdd0e('0x11'));var qs=require(_0xdd0e('0x12'));var as=require(_0xdd0e('0x13'));var hardwareService=require(_0xdd0e('0x14'));var logger=require(_0xdd0e('0x15'))(_0xdd0e('0x16'));var utils=require(_0xdd0e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xdd0e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20af68,_0x4dea6b){_0x4dea6b=_0x4dea6b||0xcc;return function(_0x406339){if(_0x406339){return _0x20af68[_0xdd0e('0x19')](_0x4dea6b);}return _0x20af68[_0xdd0e('0x1a')](_0x4dea6b)['end']();};}function respondWithResult(_0x97e751,_0x2cbce1){_0x2cbce1=_0x2cbce1||0xc8;return function(_0x28b8d8){if(_0x28b8d8){return _0x97e751['status'](_0x2cbce1)['json'](_0x28b8d8);}};}function respondWithFilteredResult(_0x1d3d97,_0x3c08a7){return function(_0x13d6c6){if(_0x13d6c6){var _0x5627bc=typeof _0x3c08a7[_0xdd0e('0x1b')]===_0xdd0e('0x1c')&&typeof _0x3c08a7['limit']==='undefined';var _0xfbbb8f=_0x13d6c6['count'];var _0x49353e=_0x5627bc?0x0:_0x3c08a7[_0xdd0e('0x1b')];var _0x3eacf8=_0x5627bc?_0x13d6c6[_0xdd0e('0x1d')]:_0x3c08a7[_0xdd0e('0x1b')]+_0x3c08a7[_0xdd0e('0x1e')];var _0x4f8429;if(_0x3eacf8>=_0xfbbb8f){_0x3eacf8=_0xfbbb8f;_0x4f8429=0xc8;}else{_0x4f8429=0xce;}_0x1d3d97['status'](_0x4f8429);return _0x1d3d97['set'](_0xdd0e('0x1f'),_0x49353e+'-'+_0x3eacf8+'/'+_0xfbbb8f)[_0xdd0e('0x20')](_0x13d6c6);}return null;};}function patchUpdates(_0x5b88fe){return function(_0x20ea22){try{jsonpatch[_0xdd0e('0x21')](_0x20ea22,_0x5b88fe,!![]);}catch(_0x409ea0){return BPromise['reject'](_0x409ea0);}return _0x20ea22['save']();};}function saveUpdates(_0x423ded,_0x3b675d){return function(_0x317d26){if(_0x317d26){return _0x317d26[_0xdd0e('0x22')](_0x423ded)[_0xdd0e('0x23')](function(_0x1bee6b){return _0x1bee6b;});}return null;};}function removeEntity(_0x172cb6,_0x9c1ad1){return function(_0x26cab7){if(_0x26cab7){return _0x26cab7[_0xdd0e('0x24')]()[_0xdd0e('0x23')](function(){_0x172cb6[_0xdd0e('0x1a')](0xcc)[_0xdd0e('0x25')]();});}};}function handleEntityNotFound(_0x2383f6,_0x415fbb){return function(_0x5313b8){if(!_0x5313b8){_0x2383f6[_0xdd0e('0x19')](0x194);}return _0x5313b8;};}function handleError(_0x2875f9,_0x485745){_0x485745=_0x485745||0x1f4;return function(_0x4d33e3){logger[_0xdd0e('0x26')](_0x4d33e3[_0xdd0e('0x27')]);if(_0x4d33e3[_0xdd0e('0x28')]){delete _0x4d33e3[_0xdd0e('0x28')];}_0x2875f9[_0xdd0e('0x1a')](_0x485745)[_0xdd0e('0x29')](_0x4d33e3);};}exports[_0xdd0e('0x2a')]=function(_0x32103d,_0x400c79){var _0x35bd85={},_0x409e62={},_0x26ea38={'count':0x0,'rows':[]};var _0x352030=_[_0xdd0e('0x2b')](db[_0xdd0e('0x2c')][_0xdd0e('0x2d')],function(_0x2fc11b){return{'name':_0x2fc11b['fieldName'],'type':_0x2fc11b[_0xdd0e('0x2e')]['key']};});_0x409e62[_0xdd0e('0x2f')]=_[_0xdd0e('0x2b')](_0x352030,_0xdd0e('0x28'));_0x409e62[_0xdd0e('0x30')]=_[_0xdd0e('0x31')](_0x32103d[_0xdd0e('0x30')]);_0x409e62['filters']=_[_0xdd0e('0x32')](_0x409e62[_0xdd0e('0x2f')],_0x409e62[_0xdd0e('0x30')]);_0x35bd85[_0xdd0e('0x33')]=_[_0xdd0e('0x32')](_0x409e62[_0xdd0e('0x2f')],qs[_0xdd0e('0x34')](_0x32103d['query'][_0xdd0e('0x34')]));_0x35bd85[_0xdd0e('0x33')]=_0x35bd85['attributes'][_0xdd0e('0x35')]?_0x35bd85['attributes']:_0x409e62[_0xdd0e('0x2f')];if(!_0x32103d[_0xdd0e('0x30')][_0xdd0e('0x36')](_0xdd0e('0x37'))){_0x35bd85[_0xdd0e('0x1e')]=qs['limit'](_0x32103d[_0xdd0e('0x30')][_0xdd0e('0x1e')]);_0x35bd85['offset']=qs[_0xdd0e('0x1b')](_0x32103d[_0xdd0e('0x30')][_0xdd0e('0x1b')]);}_0x35bd85[_0xdd0e('0x38')]=qs[_0xdd0e('0x39')](_0x32103d['query'][_0xdd0e('0x39')]);_0x35bd85[_0xdd0e('0x3a')]=qs['filters'](_[_0xdd0e('0x3b')](_0x32103d[_0xdd0e('0x30')],_0x409e62[_0xdd0e('0x3c')]),_0x352030);if(_0x32103d['query'][_0xdd0e('0x3d')]){_0x35bd85[_0xdd0e('0x3a')]=_[_0xdd0e('0x3e')](_0x35bd85['where'],{'$or':_[_0xdd0e('0x2b')](_0x352030,function(_0x1ab35d){if(_0x1ab35d[_0xdd0e('0x2e')]!==_0xdd0e('0x3f')){var _0x5243b2={};_0x5243b2[_0x1ab35d['name']]={'$like':'%'+_0x32103d[_0xdd0e('0x30')][_0xdd0e('0x3d')]+'%'};return _0x5243b2;}})});}_0x35bd85=_[_0xdd0e('0x3e')]({},_0x35bd85,_0x32103d[_0xdd0e('0x40')]);var _0x53c9d9={'where':_0x35bd85[_0xdd0e('0x3a')]};return db[_0xdd0e('0x2c')][_0xdd0e('0x1d')](_0x53c9d9)['then'](function(_0x269dbe){_0x26ea38[_0xdd0e('0x1d')]=_0x269dbe;if(_0x32103d[_0xdd0e('0x30')][_0xdd0e('0x41')]){_0x35bd85[_0xdd0e('0x42')]=[{'all':!![]}];}return db[_0xdd0e('0x2c')][_0xdd0e('0x43')](_0x35bd85);})['then'](function(_0x264a07){_0x26ea38[_0xdd0e('0x44')]=_0x264a07;return _0x26ea38;})['then'](respondWithFilteredResult(_0x400c79,_0x35bd85))[_0xdd0e('0x45')](handleError(_0x400c79,null));};exports[_0xdd0e('0x46')]=function(_0x52f067,_0x38f30d){var _0x559b3b={'raw':!![],'where':{'id':_0x52f067[_0xdd0e('0x47')]['id']}},_0x5d796e={};_0x5d796e[_0xdd0e('0x2f')]=_['keys'](db[_0xdd0e('0x2c')][_0xdd0e('0x2d')]);_0x5d796e[_0xdd0e('0x30')]=_[_0xdd0e('0x31')](_0x52f067[_0xdd0e('0x30')]);_0x5d796e['filters']=_['intersection'](_0x5d796e[_0xdd0e('0x2f')],_0x5d796e['query']);_0x559b3b[_0xdd0e('0x33')]=_[_0xdd0e('0x32')](_0x5d796e['model'],qs[_0xdd0e('0x34')](_0x52f067['query'][_0xdd0e('0x34')]));_0x559b3b[_0xdd0e('0x33')]=_0x559b3b[_0xdd0e('0x33')]['length']?_0x559b3b[_0xdd0e('0x33')]:_0x5d796e[_0xdd0e('0x2f')];if(_0x52f067[_0xdd0e('0x30')][_0xdd0e('0x41')]){_0x559b3b[_0xdd0e('0x42')]=[{'all':!![]}];}_0x559b3b=_[_0xdd0e('0x3e')]({},_0x559b3b,_0x52f067[_0xdd0e('0x40')]);return db[_0xdd0e('0x2c')][_0xdd0e('0x48')](_0x559b3b)['then'](handleEntityNotFound(_0x38f30d,null))['then'](respondWithResult(_0x38f30d,null))[_0xdd0e('0x45')](handleError(_0x38f30d,null));};exports['create']=function(_0x1246a6,_0x2b3c54){return db['FaxApplication']['create'](_0x1246a6[_0xdd0e('0x49')],{})[_0xdd0e('0x23')](respondWithResult(_0x2b3c54,0xc9))['catch'](handleError(_0x2b3c54,null));};exports[_0xdd0e('0x22')]=function(_0x5b6dd6,_0x4e6579){if(_0x5b6dd6[_0xdd0e('0x49')]['id']){delete _0x5b6dd6[_0xdd0e('0x49')]['id'];}return db[_0xdd0e('0x2c')][_0xdd0e('0x48')]({'where':{'id':_0x5b6dd6[_0xdd0e('0x47')]['id']}})[_0xdd0e('0x23')](handleEntityNotFound(_0x4e6579,null))['then'](saveUpdates(_0x5b6dd6[_0xdd0e('0x49')],null))[_0xdd0e('0x23')](respondWithResult(_0x4e6579,null))[_0xdd0e('0x45')](handleError(_0x4e6579,null));};exports['destroy']=function(_0x49050f,_0xad1454){return db[_0xdd0e('0x2c')][_0xdd0e('0x48')]({'where':{'id':_0x49050f[_0xdd0e('0x47')]['id']}})[_0xdd0e('0x23')](handleEntityNotFound(_0xad1454,null))[_0xdd0e('0x23')](removeEntity(_0xad1454,null))[_0xdd0e('0x45')](handleError(_0xad1454,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 03bc11c..d154855 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 _0x9c78=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4'];(function(_0x5390b8,_0x2e31ef){var _0x36aea0=function(_0x520774){while(--_0x520774){_0x5390b8['push'](_0x5390b8['shift']());}};_0x36aea0(++_0x2e31ef);}(_0x9c78,0x1e1));var _0x89c7=function(_0x1b267d,_0x1303b1){_0x1b267d=_0x1b267d-0x0;var _0x160ced=_0x9c78[_0x1b267d];return _0x160ced;};'use strict';var _=require(_0x89c7('0x0'));var util=require('util');var logger=require(_0x89c7('0x1'))(_0x89c7('0x2'));var moment=require(_0x89c7('0x3'));var BPromise=require(_0x89c7('0x4'));var rp=require(_0x89c7('0x5'));var fs=require('fs');var path=require(_0x89c7('0x6'));var rimraf=require('rimraf');var config=require(_0x89c7('0x7'));var attributes=require(_0x89c7('0x8'));module['exports']=function(_0x1c9fed,_0x3e66ee){return _0x1c9fed[_0x89c7('0x9')](_0x89c7('0xa'),attributes,{'tableName':_0x89c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x89c7('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x35b9=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x26a8e5,_0xacbc6e){var _0x1bc013=function(_0x430ec1){while(--_0x430ec1){_0x26a8e5['push'](_0x26a8e5['shift']());}};_0x1bc013(++_0xacbc6e);}(_0x35b9,0x12e));var _0x935b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x35b9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x935b('0x0'));var util=require('util');var logger=require(_0x935b('0x1'))(_0x935b('0x2'));var moment=require(_0x935b('0x3'));var BPromise=require(_0x935b('0x4'));var rp=require(_0x935b('0x5'));var fs=require('fs');var path=require(_0x935b('0x6'));var rimraf=require(_0x935b('0x7'));var config=require(_0x935b('0x8'));var attributes=require(_0x935b('0x9'));module[_0x935b('0xa')]=function(_0x24f4dd,_0x1d35e5){return _0x24f4dd[_0x935b('0xb')]('FaxApplication',attributes,{'tableName':_0x935b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x935b('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index ca7db88..d803efc 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 _0x0db9=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateFaxApplication','FaxApplication','update','options','where','attributes','lodash','util','bluebird'];(function(_0x7e81c4,_0x3ca1ff){var _0x1b10e3=function(_0x3b0a42){while(--_0x3b0a42){_0x7e81c4['push'](_0x7e81c4['shift']());}};_0x1b10e3(++_0x3ca1ff);}(_0x0db9,0x69));var _0x90db=function(_0x440917,_0x20ea7b){_0x440917=_0x440917-0x0;var _0x5e906b=_0x0db9[_0x440917];return _0x5e906b;};'use strict';var _=require(_0x90db('0x0'));var util=require(_0x90db('0x1'));var moment=require('moment');var BPromise=require(_0x90db('0x2'));var rs=require(_0x90db('0x3'));var fs=require('fs');var Redis=require(_0x90db('0x4'));var db=require(_0x90db('0x5'))['db'];var utils=require(_0x90db('0x6'));var logger=require(_0x90db('0x7'))('rpc');var config=require(_0x90db('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x90db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d2012,_0x369112,_0xde0986){return new BPromise(function(_0x309339,_0x43b9da){return client[_0x90db('0xa')](_0x2d2012,_0xde0986)[_0x90db('0xb')](function(_0x1e5d2f){logger[_0x90db('0xc')](_0x90db('0xd'),_0x369112,_0x90db('0xe'));logger[_0x90db('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x369112,_0x90db('0xe'),JSON[_0x90db('0x10')](_0x1e5d2f));if(_0x1e5d2f[_0x90db('0x11')]){if(_0x1e5d2f[_0x90db('0x11')][_0x90db('0x12')]===0x1f4){logger[_0x90db('0x11')](_0x90db('0xd'),_0x369112,_0x1e5d2f[_0x90db('0x11')][_0x90db('0x13')]);return _0x43b9da(_0x1e5d2f[_0x90db('0x11')][_0x90db('0x13')]);}logger[_0x90db('0x11')](_0x90db('0xd'),_0x369112,_0x1e5d2f[_0x90db('0x11')]['message']);return _0x309339(_0x1e5d2f['error'][_0x90db('0x13')]);}else{logger[_0x90db('0xc')](_0x90db('0xd'),_0x369112,'request\x20sent');_0x309339(_0x1e5d2f['result'][_0x90db('0x13')]);}})[_0x90db('0x14')](function(_0x82886){logger[_0x90db('0x11')]('FaxApplication,\x20%s,\x20%s',_0x369112,_0x82886);_0x43b9da(_0x82886);});});}exports[_0x90db('0x15')]=function(_0x114db5){var _0xf27a34=this;return new Promise(function(_0x2ee7c6,_0x2c6117){return db[_0x90db('0x16')][_0x90db('0x17')](_0x114db5['body'],{'raw':_0x114db5['options']?_0x114db5[_0x90db('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x114db5['options']?_0x114db5[_0x90db('0x18')][_0x90db('0x19')]||null:null,'attributes':_0x114db5[_0x90db('0x18')]?_0x114db5[_0x90db('0x18')][_0x90db('0x1a')]||null:null,'limit':_0x114db5[_0x90db('0x18')]?_0x114db5['options']['limit']||null:null})['then'](function(_0xfa445c){logger[_0x90db('0xc')]('UpdateFaxApplication',_0x114db5);logger[_0x90db('0xf')](_0x90db('0x15'),_0x114db5,JSON[_0x90db('0x10')](_0xfa445c));_0x2ee7c6(_0xfa445c);})[_0x90db('0x14')](function(_0x527bb9){logger[_0x90db('0x11')]('UpdateFaxApplication',_0x527bb9[_0x90db('0x13')],_0x114db5);_0x2c6117(_0xf27a34[_0x90db('0x11')](0x1f4,_0x527bb9['message']));});});}; \ No newline at end of file +var _0x5646=['request','info','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxApplication,\x20%s,\x20%s','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','limit','then','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1e46d8,_0x44fe74){var _0x52bd0f=function(_0x30e28a){while(--_0x30e28a){_0x1e46d8['push'](_0x1e46d8['shift']());}};_0x52bd0f(++_0x44fe74);}(_0x5646,0x1b8));var _0x6564=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0x5646[_0x421196];return _0x2738af;};'use strict';var _=require(_0x6564('0x0'));var util=require(_0x6564('0x1'));var moment=require(_0x6564('0x2'));var BPromise=require(_0x6564('0x3'));var rs=require(_0x6564('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6564('0x5'))(_0x6564('0x6'));var config=require(_0x6564('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6564('0x8')][_0x6564('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x476edc,_0x296800,_0x308026){return new BPromise(function(_0x4b6c9f,_0x4e9227){return client[_0x6564('0xa')](_0x476edc,_0x308026)['then'](function(_0x4826cf){logger[_0x6564('0xb')]('FaxApplication,\x20%s,\x20%s',_0x296800,'request\x20sent');logger[_0x6564('0xc')](_0x6564('0xd'),_0x296800,_0x6564('0xe'),JSON[_0x6564('0xf')](_0x4826cf));if(_0x4826cf[_0x6564('0x10')]){if(_0x4826cf[_0x6564('0x10')][_0x6564('0x11')]===0x1f4){logger[_0x6564('0x10')]('FaxApplication,\x20%s,\x20%s',_0x296800,_0x4826cf['error'][_0x6564('0x12')]);return _0x4e9227(_0x4826cf['error']['message']);}logger[_0x6564('0x10')](_0x6564('0x13'),_0x296800,_0x4826cf[_0x6564('0x10')][_0x6564('0x12')]);return _0x4b6c9f(_0x4826cf[_0x6564('0x10')][_0x6564('0x12')]);}else{logger['info'](_0x6564('0x13'),_0x296800,_0x6564('0xe'));_0x4b6c9f(_0x4826cf['result'][_0x6564('0x12')]);}})[_0x6564('0x14')](function(_0x175a91){logger[_0x6564('0x10')](_0x6564('0x13'),_0x296800,_0x175a91);_0x4e9227(_0x175a91);});});}exports[_0x6564('0x15')]=function(_0xf58bc){var _0x5dc108=this;return new Promise(function(_0x2596b8,_0x4cabde){return db[_0x6564('0x16')][_0x6564('0x17')](_0xf58bc[_0x6564('0x18')],{'raw':_0xf58bc[_0x6564('0x19')]?_0xf58bc['options'][_0x6564('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf58bc[_0x6564('0x19')]?_0xf58bc[_0x6564('0x19')][_0x6564('0x1b')]||null:null,'attributes':_0xf58bc[_0x6564('0x19')]?_0xf58bc[_0x6564('0x19')]['attributes']||null:null,'limit':_0xf58bc[_0x6564('0x19')]?_0xf58bc[_0x6564('0x19')][_0x6564('0x1c')]||null:null})[_0x6564('0x1d')](function(_0x550e0c){logger[_0x6564('0xb')]('UpdateFaxApplication',_0xf58bc);logger[_0x6564('0xc')](_0x6564('0x15'),_0xf58bc,JSON[_0x6564('0xf')](_0x550e0c));_0x2596b8(_0x550e0c);})[_0x6564('0x14')](function(_0x9f1920){logger[_0x6564('0x10')](_0x6564('0x15'),_0x9f1920[_0x6564('0x12')],_0xf58bc);_0x4cabde(_0x5dc108['error'](0x1f4,_0x9f1920['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index bb7c67d..233a2fc 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 _0x955f=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x955f,0x1eb));var _0xf955=function(_0x1f3200,_0x2071ef){_0x1f3200=_0x1f3200-0x0;var _0x1dbc7d=_0x955f[_0x1f3200];return _0x1dbc7d;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./faxApplication.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['show']);router[_0xf955('0xb')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')](_0xf955('0xa'),auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['delete'](_0xf955('0xa'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);module[_0xf955('0x10')]=router; \ No newline at end of file +var _0x8f4c=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0x8f4c,0x113));var _0xc8f4=function(_0x1546c2,_0x22e822){_0x1546c2=_0x1546c2-0x0;var _0x24583c=_0x8f4c[_0x1546c2];return _0x24583c;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8f4('0x6'));var interaction=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var controller=require('./faxApplication.controller');router[_0xc8f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0xb')]);router[_0xc8f4('0xc')]('/',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0xe')]);router[_0xc8f4('0xf')]('/:id',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x10')]);router[_0xc8f4('0x11')](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 75ab02e..c1fd7c2 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 _0x4b17=['STRING','ENUM','out','DATE','INTEGER','sequelize','BOOLEAN'];(function(_0x4e395b,_0x123684){var _0x7dd261=function(_0x5ef081){while(--_0x5ef081){_0x4e395b['push'](_0x4e395b['shift']());}};_0x7dd261(++_0x123684);}(_0x4b17,0x10f));var _0x74b1=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0x4b17[_0x438fe1];return _0x3c8e1b;};'use strict';var Sequelize=require(_0x74b1('0x0'));module['exports']={'closed':{'type':Sequelize[_0x74b1('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x74b1('0x2')]},'secondDisposition':{'type':Sequelize[_0x74b1('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x74b1('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x74b1('0x3')]('in',_0x74b1('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x74b1('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x74b1('0x3')]('in',_0x74b1('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x74b1('0x6')]}}; \ No newline at end of file +var _0x7b84=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x7b84,0x17c));var _0x47b8=function(_0x3af621,_0x118b69){_0x3af621=_0x3af621-0x0;var _0x380a29=_0x7b84[_0x3af621];return _0x380a29;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'closed':{'type':Sequelize[_0x47b8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x47b8('0x3')]},'disposition':{'type':Sequelize[_0x47b8('0x4')]},'secondDisposition':{'type':Sequelize[_0x47b8('0x4')]},'thirdDisposition':{'type':Sequelize[_0x47b8('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x47b8('0x3')]},'fax':{'type':Sequelize[_0x47b8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x47b8('0x5')]('in',_0x47b8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x47b8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x47b8('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x47b8('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index b66ff53..edb87a4 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 _0x5cde=['length','hasOwnProperty','nolimit','sort','pick','FaxInteractionId','filter','where','merge','format','options','FaxMessage','findAll','rows','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','push','Attachment','Messages','createdAt','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','rimraf','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','key','getOptions','query','user','show','params','keys','FaxInteraction','filters','intersection','model','attributes','fields','includeAll','include','find','body','catch','addMessage','ids','omit','findOne'];(function(_0x1e29c9,_0x465a70){var _0x4baa01=function(_0xae05cc){while(--_0xae05cc){_0x1e29c9['push'](_0x1e29c9['shift']());}};_0x4baa01(++_0x465a70);}(_0x5cde,0x15d));var _0xe5cd=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x5cde[_0x101e7b];return _0x4995c0;};'use strict';var rimraf=require(_0xe5cd('0x0'));var zipdir=require('zip-dir');var moment=require(_0xe5cd('0x1'));var BPromise=require(_0xe5cd('0x2'));var util=require('util');var path=require(_0xe5cd('0x3'));var fs=require('fs');var _=require(_0xe5cd('0x4'));var Redis=require(_0xe5cd('0x5'));var interaction=require(_0xe5cd('0x6'));var qs=require(_0xe5cd('0x7'));var logger=require(_0xe5cd('0x8'))(_0xe5cd('0x9'));var config=require('../../config/environment');var db=require(_0xe5cd('0xa'))['db'];config[_0xe5cd('0xb')]=_[_0xe5cd('0xc')](config['redis'],{'host':_0xe5cd('0xd'),'port':0x18eb});var socket=require(_0xe5cd('0xe'))(new Redis(config[_0xe5cd('0xb')]));require(_0xe5cd('0xf'))[_0xe5cd('0x10')](socket);function respondWithStatusCode(_0x58fc70,_0x7b1a5c){_0x7b1a5c=_0x7b1a5c||0xcc;return function(_0x424577){if(_0x424577){return _0x58fc70['sendStatus'](_0x7b1a5c);}return _0x58fc70[_0xe5cd('0x11')](_0x7b1a5c)[_0xe5cd('0x12')]();};}function respondWithResult(_0xcc537a,_0x50ec26){_0x50ec26=_0x50ec26||0xc8;return function(_0x1ccab4){if(_0x1ccab4){return _0xcc537a['status'](_0x50ec26)[_0xe5cd('0x13')](_0x1ccab4);}};}function respondWithFilteredResult(_0x39bab2,_0x5b41b8){return function(_0xbc9403){if(_0xbc9403){var _0x224306=typeof _0x5b41b8[_0xe5cd('0x14')]==='undefined'&&typeof _0x5b41b8[_0xe5cd('0x15')]===_0xe5cd('0x16');var _0x59151d=_0xbc9403[_0xe5cd('0x17')];var _0x4bf63d=_0x224306?0x0:_0x5b41b8[_0xe5cd('0x14')];var _0x4b04ee=_0x224306?_0xbc9403[_0xe5cd('0x17')]:_0x5b41b8[_0xe5cd('0x14')]+_0x5b41b8[_0xe5cd('0x15')];var _0x5f5d49;if(_0x4b04ee>=_0x59151d){_0x4b04ee=_0x59151d;_0x5f5d49=0xc8;}else{_0x5f5d49=0xce;}_0x39bab2['status'](_0x5f5d49);return _0x39bab2[_0xe5cd('0x18')](_0xe5cd('0x19'),_0x4bf63d+'-'+_0x4b04ee+'/'+_0x59151d)[_0xe5cd('0x13')](_0xbc9403);}return null;};}function saveUpdates(_0xd3c0ae){return function(_0x3cf55b){if(_0x3cf55b){return _0x3cf55b[_0xe5cd('0x1a')](_0xd3c0ae)[_0xe5cd('0x1b')](function(_0x3341b1){return _0x3341b1;});}return null;};}function removeEntity(_0x2487ae){return function(_0x5daa2f){if(_0x5daa2f){return _0x5daa2f[_0xe5cd('0x1c')]()['then'](function(){_0x2487ae[_0xe5cd('0x11')](0xcc)[_0xe5cd('0x12')]();});}};}function handleEntityNotFound(_0x328f3c){return function(_0x1102bc){if(!_0x1102bc){_0x328f3c[_0xe5cd('0x1d')](0x194);}return _0x1102bc;};}function handleError(_0x30708a,_0x2b8e9c){_0x2b8e9c=_0x2b8e9c||0x1f4;return function(_0x117eb2){logger[_0xe5cd('0x1e')](_0x117eb2['stack']);if(_0x117eb2[_0xe5cd('0x1f')]){delete _0x117eb2['name'];}_0x30708a['status'](_0x2b8e9c)[_0xe5cd('0x20')](_0x117eb2);};}exports['index']=function(_0x4e5ff5,_0x2eaab5){var _0x330aa8={};var _0x29e1d4=_[_0xe5cd('0x21')](db['FaxInteraction'][_0xe5cd('0x22')],function(_0x501d3a){return{'name':_0x501d3a[_0xe5cd('0x23')],'type':_0x501d3a[_0xe5cd('0x24')][_0xe5cd('0x25')]};});_0x330aa8=qs[_0xe5cd('0x26')](_0x29e1d4,_0x4e5ff5);return interaction['findAll']('fax',_0x4e5ff5[_0xe5cd('0x27')],_0x4e5ff5[_0xe5cd('0x28')],_0x330aa8,_0x29e1d4)[_0xe5cd('0x1b')](respondWithFilteredResult(_0x2eaab5,_0x330aa8))['catch'](handleError(_0x2eaab5,null));};exports[_0xe5cd('0x29')]=function(_0x375094,_0x596ec3){var _0x485ee8={'raw':![],'where':{'id':_0x375094[_0xe5cd('0x2a')]['id']}},_0x2b041b={};_0x2b041b['model']=_[_0xe5cd('0x2b')](db[_0xe5cd('0x2c')][_0xe5cd('0x22')]);_0x2b041b[_0xe5cd('0x27')]=_[_0xe5cd('0x2b')](_0x375094[_0xe5cd('0x27')]);_0x2b041b[_0xe5cd('0x2d')]=_[_0xe5cd('0x2e')](_0x2b041b[_0xe5cd('0x2f')],_0x2b041b[_0xe5cd('0x27')]);_0x485ee8[_0xe5cd('0x30')]=_['intersection'](_0x2b041b['model'],qs[_0xe5cd('0x31')](_0x375094['query'][_0xe5cd('0x31')]));_0x485ee8[_0xe5cd('0x30')]=_0x485ee8[_0xe5cd('0x30')]['length']?_0x485ee8[_0xe5cd('0x30')]:_0x2b041b[_0xe5cd('0x2f')];if(_0x375094['query'][_0xe5cd('0x32')]){_0x485ee8[_0xe5cd('0x33')]=[{'all':!![]}];}_0x485ee8=_['merge']({},_0x485ee8,_0x375094['options']);return db[_0xe5cd('0x2c')][_0xe5cd('0x34')](_0x485ee8)[_0xe5cd('0x1b')](handleEntityNotFound(_0x596ec3,null))[_0xe5cd('0x1b')](respondWithResult(_0x596ec3,null))['catch'](handleError(_0x596ec3,null));};exports['create']=function(_0x1a58c4,_0xcfdb28){return db[_0xe5cd('0x2c')]['create'](_0x1a58c4[_0xe5cd('0x35')],{})[_0xe5cd('0x1b')](respondWithResult(_0xcfdb28,0xc9))[_0xe5cd('0x36')](handleError(_0xcfdb28,null));};exports[_0xe5cd('0x1a')]=function(_0x39613,_0x332810){if(_0x39613[_0xe5cd('0x35')]['id']){delete _0x39613[_0xe5cd('0x35')]['id'];}return db['FaxInteraction'][_0xe5cd('0x34')]({'where':{'id':_0x39613[_0xe5cd('0x2a')]['id']}})[_0xe5cd('0x1b')](handleEntityNotFound(_0x332810,null))[_0xe5cd('0x1b')](saveUpdates(_0x39613['body'],null))[_0xe5cd('0x1b')](respondWithResult(_0x332810,null))[_0xe5cd('0x36')](handleError(_0x332810,null));};exports[_0xe5cd('0x1c')]=function(_0x5406db,_0x6d1d0f){return db[_0xe5cd('0x2c')]['find']({'where':{'id':_0x5406db[_0xe5cd('0x2a')]['id']}})[_0xe5cd('0x1b')](handleEntityNotFound(_0x6d1d0f,null))[_0xe5cd('0x1b')](removeEntity(_0x6d1d0f,null))[_0xe5cd('0x36')](handleError(_0x6d1d0f,null));};exports['describe']=function(_0x2dcd34,_0x591e4b){return db[_0xe5cd('0x2c')]['describe']()[_0xe5cd('0x1b')](respondWithResult(_0x591e4b,null))['catch'](handleError(_0x591e4b,null));};exports[_0xe5cd('0x37')]=function(_0x15fee8,_0x4fdc54){return db['FaxMessage'][_0xe5cd('0x34')]({'where':{'id':_0x15fee8[_0xe5cd('0x2a')]['id']}})[_0xe5cd('0x1b')](handleEntityNotFound(_0x4fdc54,null))['then'](function(_0x419e9e){if(_0x419e9e){return _0x419e9e['addMessage'](_0x15fee8[_0xe5cd('0x35')][_0xe5cd('0x38')],_[_0xe5cd('0x39')](_0x15fee8[_0xe5cd('0x35')],[_0xe5cd('0x38'),'id'])||{});}})[_0xe5cd('0x1b')](respondWithResult(_0x4fdc54,null))[_0xe5cd('0x36')](handleError(_0x4fdc54,null));};exports['getMessages']=function(_0x3ca54e,_0x2c9db1){var _0x55b681={'raw':![],'where':{}};var _0x2d05e0={};var _0x4d35f7={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xe5cd('0x3a')]({'where':{'id':_0x3ca54e[_0xe5cd('0x2a')]['id']}})[_0xe5cd('0x1b')](handleEntityNotFound(_0x2c9db1,null))[_0xe5cd('0x1b')](function(_0x18ea44){if(_0x18ea44){_0x2d05e0[_0xe5cd('0x2f')]=_[_0xe5cd('0x2b')](db['FaxMessage'][_0xe5cd('0x22')]);_0x2d05e0['query']=_[_0xe5cd('0x2b')](_0x3ca54e['query']);_0x2d05e0[_0xe5cd('0x2d')]=_['intersection'](_0x2d05e0[_0xe5cd('0x2f')],_0x2d05e0[_0xe5cd('0x27')]);_0x55b681['attributes']=_[_0xe5cd('0x2e')](_0x2d05e0['model'],qs[_0xe5cd('0x31')](_0x3ca54e[_0xe5cd('0x27')][_0xe5cd('0x31')]));_0x55b681[_0xe5cd('0x30')]=_0x55b681[_0xe5cd('0x30')][_0xe5cd('0x3b')]?_0x55b681[_0xe5cd('0x30')]:_0x2d05e0[_0xe5cd('0x2f')];if(!_0x3ca54e[_0xe5cd('0x27')][_0xe5cd('0x3c')](_0xe5cd('0x3d'))){_0x55b681['limit']=qs[_0xe5cd('0x15')](_0x3ca54e['query'][_0xe5cd('0x15')]);_0x55b681['offset']=qs['offset'](_0x3ca54e[_0xe5cd('0x27')][_0xe5cd('0x14')]);}_0x55b681['order']=qs['sort'](_0x3ca54e[_0xe5cd('0x27')][_0xe5cd('0x3e')]);_0x55b681['where']=qs[_0xe5cd('0x2d')](_[_0xe5cd('0x3f')](_0x3ca54e['query'],_0x2d05e0[_0xe5cd('0x2d')]));_0x55b681['where'][_0xe5cd('0x40')]=_0x18ea44['id'];if(_0x3ca54e[_0xe5cd('0x27')][_0xe5cd('0x41')]){_0x55b681[_0xe5cd('0x42')]=_[_0xe5cd('0x43')](_0x55b681[_0xe5cd('0x42')],{'$or':_[_0xe5cd('0x21')](_0x55b681[_0xe5cd('0x30')],function(_0x2477d0){var _0x2c9077={};_0x2c9077[_0x2477d0]={'$like':'%'+_0x3ca54e[_0xe5cd('0x27')][_0xe5cd('0x41')]+'%'};return _0x2c9077;})});}if(_0x3ca54e[_0xe5cd('0x27')]['$gte']){var _0x2a151c=_0x3ca54e[_0xe5cd('0x27')]['$gte']['split'](',');var _0xa00f9b={};_0xa00f9b[_0x2a151c[0x0]]={'$gte':moment(_0x2a151c[0x1])[_0xe5cd('0x44')]('YYYY-MM-DD\x20HH:mm:ss')};_0x55b681[_0xe5cd('0x42')]=_['merge'](_0x55b681[_0xe5cd('0x42')],_0xa00f9b);}_0x55b681=_['merge']({},_0x55b681,_0x3ca54e[_0xe5cd('0x45')]);return db[_0xe5cd('0x46')][_0xe5cd('0x17')]({'where':_0x55b681['where']})[_0xe5cd('0x1b')](function(_0xee04c4){_0x4d35f7[_0xe5cd('0x17')]=_0xee04c4;if(_0x3ca54e[_0xe5cd('0x27')][_0xe5cd('0x32')]){_0x55b681[_0xe5cd('0x33')]=[{'all':!![]}];}return db['FaxMessage'][_0xe5cd('0x47')](_0x55b681);})[_0xe5cd('0x1b')](function(_0x2ab05c){_0x4d35f7[_0xe5cd('0x48')]=_0x2ab05c;return _0x4d35f7;});}})[_0xe5cd('0x1b')](respondWithFilteredResult(_0x2c9db1,_0x55b681))[_0xe5cd('0x36')](handleError(_0x2c9db1,null));};exports[_0xe5cd('0x49')]=function(_0x1a5e8e,_0x9c5b67){return db[_0xe5cd('0x2c')][_0xe5cd('0x34')]({'where':{'id':_0x1a5e8e[_0xe5cd('0x2a')]['id']}})[_0xe5cd('0x1b')](handleEntityNotFound(_0x9c5b67,null))[_0xe5cd('0x1b')](function(_0x26d63d){if(_0x26d63d){return _0x26d63d[_0xe5cd('0x4a')](_0x1a5e8e[_0xe5cd('0x35')]['ids'],_[_0xe5cd('0x39')](_0x1a5e8e[_0xe5cd('0x35')],[_0xe5cd('0x38'),'id'])||{})[_0xe5cd('0x4b')](function(){return db[_0xe5cd('0x4c')][_0xe5cd('0x47')]({'attributes':['id',_0xe5cd('0x1f'),_0xe5cd('0x4d')],'where':{'id':_0x1a5e8e[_0xe5cd('0x35')][_0xe5cd('0x38')]}});})[_0xe5cd('0x1b')](function(_0x3a8503){socket[_0xe5cd('0x4e')](_0xe5cd('0x4f'),{'id':Number(_0x1a5e8e[_0xe5cd('0x2a')]['id']),'tags':_0x3a8503||[]});return{'id':Number(_0x1a5e8e[_0xe5cd('0x2a')]['id']),'tags':_0x3a8503||[]};});}})['then'](respondWithResult(_0x9c5b67,null))[_0xe5cd('0x36')](handleError(_0x9c5b67,null));};exports['removeTags']=function(_0x103c24,_0x2d4534){return db[_0xe5cd('0x2c')][_0xe5cd('0x34')]({'where':{'id':_0x103c24['params']['id']}})[_0xe5cd('0x1b')](handleEntityNotFound(_0x2d4534,null))[_0xe5cd('0x1b')](function(_0x3e303d){if(_0x3e303d){return _0x3e303d[_0xe5cd('0x50')](_0x103c24[_0xe5cd('0x27')][_0xe5cd('0x38')]);}})[_0xe5cd('0x1b')](respondWithStatusCode(_0x2d4534,null))[_0xe5cd('0x36')](handleError(_0x2d4534,null));};exports[_0xe5cd('0x51')]=function(_0x1cf3c4,_0x17cc5d){var _0x14ed18=moment()[_0xe5cd('0x52')]()[_0xe5cd('0x53')]();var _0x35a81d=path[_0xe5cd('0x54')](config[_0xe5cd('0x55')],_0xe5cd('0x56'),_0xe5cd('0x57'),_0xe5cd('0x58'));var _0x1bf546=path[_0xe5cd('0x54')](config[_0xe5cd('0x55')],_0xe5cd('0x56'),_0xe5cd('0x57'),_0xe5cd('0x59'));var _0x138d08=path[_0xe5cd('0x54')](_0x35a81d,_0x14ed18);var _0x2f9491=util[_0xe5cd('0x44')]('transcript-%d-%s.zip',_0x1cf3c4[_0xe5cd('0x2a')]['id'],_0x14ed18);var _0x2efbcb=path[_0xe5cd('0x54')](_0x35a81d,_0x2f9491);var _0x4d33a7=[];_0x4d33a7[_0xe5cd('0x5a')]({'model':db[_0xe5cd('0x5b')],'as':_0xe5cd('0x5b'),'raw':!![]});var _0xbf5a54=[{'model':db[_0xe5cd('0x46')],'as':_0xe5cd('0x5c'),'attributes':['id',_0xe5cd('0x35'),_0xe5cd('0x5d')],'include':_0x4d33a7}];return db[_0xe5cd('0x2c')]['find']({'where':{'id':_0x1cf3c4['params']['id']},'include':_0xbf5a54})['then'](handleEntityNotFound(_0x17cc5d,null))[_0xe5cd('0x1b')](function(_0x406807){if(_0x406807&&_0x406807['Messages']){var _0x5c90d7=_0x406807['get']({'plain':!![]});fs['mkdirSync'](_0x138d08);for(var _0x259247=0x0;_0x259247<_0x5c90d7['Messages'][_0xe5cd('0x3b')];_0x259247++){var _0x1f855f=_0x5c90d7[_0xe5cd('0x5c')][_0x259247][_0xe5cd('0x5b')];if(_0x1f855f){var _0x3ce718=path['join'](_0x1bf546,_0x1f855f[_0xe5cd('0x5e')]);if(fs[_0xe5cd('0x5f')](_0x3ce718)){fs[_0xe5cd('0x60')](_0x3ce718)[_0xe5cd('0x61')](fs[_0xe5cd('0x62')](path['join'](_0x138d08,_0x1f855f[_0xe5cd('0x5e')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x318722,_0x2d51f8){zipdir(_0x138d08,{'saveTo':_0x2efbcb},function(_0x211553,_0x2d4f04){if(_0x211553)return _0x2d51f8(_0x211553);return _0x318722(_0x2d4f04);});})[_0xe5cd('0x1b')](function(){return new BPromise(function(_0x2cd3b1,_0x46678a){rimraf(_0x138d08,function(_0x2cad5d){if(_0x2cad5d)_0x46678a(_0x2cad5d);return _0x2cd3b1();});});})['then'](function(){return _0x17cc5d[_0xe5cd('0x51')](_0x2efbcb,_0x2f9491,function(_0xf312d1){if(_0xf312d1){console[_0xe5cd('0x63')](_0xe5cd('0x64'),_0xf312d1);}else{fs[_0xe5cd('0x65')](_0x2efbcb);}});});});}else{return _0x17cc5d[_0xe5cd('0x1d')](0xc8);}})[_0xe5cd('0x36')](handleError(_0x17cc5d,null));}; \ No newline at end of file +var _0xd9b2=['count','set','Content-Range','destroy','then','stack','name','index','rawAttributes','fieldName','type','getOptions','findAll','fax','user','catch','show','params','model','keys','FaxInteraction','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','FaxMessage','hasOwnProperty','nolimit','order','sort','where','filters','pick','FaxInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','color','emit','removeTags','download','unix','toString','root','tmp','join','server','files','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','moment','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x3d5638,_0xa26995){var _0x2c2455=function(_0x5384e0){while(--_0x5384e0){_0x3d5638['push'](_0x3d5638['shift']());}};_0x2c2455(++_0xa26995);}(_0xd9b2,0xb4));var _0x2d9b=function(_0x2d2258,_0x2ce510){_0x2d2258=_0x2d2258-0x0;var _0x18e155=_0xd9b2[_0x2d2258];return _0x18e155;};'use strict';var rimraf=require(_0x2d9b('0x0'));var zipdir=require('zip-dir');var moment=require(_0x2d9b('0x1'));var BPromise=require('bluebird');var util=require(_0x2d9b('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x2d9b('0x3'));var Redis=require(_0x2d9b('0x4'));var interaction=require(_0x2d9b('0x5'));var qs=require(_0x2d9b('0x6'));var logger=require(_0x2d9b('0x7'))(_0x2d9b('0x8'));var config=require('../../config/environment');var db=require(_0x2d9b('0x9'))['db'];config[_0x2d9b('0xa')]=_[_0x2d9b('0xb')](config[_0x2d9b('0xa')],{'host':_0x2d9b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2d9b('0xa')]));require(_0x2d9b('0xd'))[_0x2d9b('0xe')](socket);function respondWithStatusCode(_0x5d727b,_0x28a2d5){_0x28a2d5=_0x28a2d5||0xcc;return function(_0x493bed){if(_0x493bed){return _0x5d727b[_0x2d9b('0xf')](_0x28a2d5);}return _0x5d727b[_0x2d9b('0x10')](_0x28a2d5)[_0x2d9b('0x11')]();};}function respondWithResult(_0x182b3a,_0x1d6d67){_0x1d6d67=_0x1d6d67||0xc8;return function(_0x202a28){if(_0x202a28){return _0x182b3a[_0x2d9b('0x10')](_0x1d6d67)[_0x2d9b('0x12')](_0x202a28);}};}function respondWithFilteredResult(_0x5ba3c7,_0x5e299c){return function(_0xc71899){if(_0xc71899){var _0xd4b89d=typeof _0x5e299c[_0x2d9b('0x13')]===_0x2d9b('0x14')&&typeof _0x5e299c[_0x2d9b('0x15')]==='undefined';var _0x2f1b56=_0xc71899['count'];var _0x484164=_0xd4b89d?0x0:_0x5e299c[_0x2d9b('0x13')];var _0x102aec=_0xd4b89d?_0xc71899[_0x2d9b('0x16')]:_0x5e299c['offset']+_0x5e299c['limit'];var _0x1d02a0;if(_0x102aec>=_0x2f1b56){_0x102aec=_0x2f1b56;_0x1d02a0=0xc8;}else{_0x1d02a0=0xce;}_0x5ba3c7[_0x2d9b('0x10')](_0x1d02a0);return _0x5ba3c7[_0x2d9b('0x17')](_0x2d9b('0x18'),_0x484164+'-'+_0x102aec+'/'+_0x2f1b56)[_0x2d9b('0x12')](_0xc71899);}return null;};}function saveUpdates(_0xc23202){return function(_0x2b13d3){if(_0x2b13d3){return _0x2b13d3['update'](_0xc23202)['then'](function(_0x542b16){return _0x542b16;});}return null;};}function removeEntity(_0x50fd02){return function(_0x3612f8){if(_0x3612f8){return _0x3612f8[_0x2d9b('0x19')]()[_0x2d9b('0x1a')](function(){_0x50fd02[_0x2d9b('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f6c4e){return function(_0x2d8ff1){if(!_0x2d8ff1){_0x2f6c4e[_0x2d9b('0xf')](0x194);}return _0x2d8ff1;};}function handleError(_0x1da875,_0x3346c5){_0x3346c5=_0x3346c5||0x1f4;return function(_0x3d946a){logger['error'](_0x3d946a[_0x2d9b('0x1b')]);if(_0x3d946a[_0x2d9b('0x1c')]){delete _0x3d946a[_0x2d9b('0x1c')];}_0x1da875['status'](_0x3346c5)['send'](_0x3d946a);};}exports[_0x2d9b('0x1d')]=function(_0x3dc29c,_0x30b097){var _0x19eddb={};var _0x39473b=_['map'](db['FaxInteraction'][_0x2d9b('0x1e')],function(_0x39f2b4){return{'name':_0x39f2b4[_0x2d9b('0x1f')],'type':_0x39f2b4[_0x2d9b('0x20')]['key']};});_0x19eddb=qs[_0x2d9b('0x21')](_0x39473b,_0x3dc29c);return interaction[_0x2d9b('0x22')](_0x2d9b('0x23'),_0x3dc29c['query'],_0x3dc29c[_0x2d9b('0x24')],_0x19eddb,_0x39473b)['then'](respondWithFilteredResult(_0x30b097,_0x19eddb))[_0x2d9b('0x25')](handleError(_0x30b097,null));};exports[_0x2d9b('0x26')]=function(_0xd589da,_0x10a8b0){var _0x1e7cba={'raw':![],'where':{'id':_0xd589da[_0x2d9b('0x27')]['id']}},_0x226a3d={};_0x226a3d[_0x2d9b('0x28')]=_[_0x2d9b('0x29')](db[_0x2d9b('0x2a')]['rawAttributes']);_0x226a3d[_0x2d9b('0x2b')]=_['keys'](_0xd589da[_0x2d9b('0x2b')]);_0x226a3d['filters']=_['intersection'](_0x226a3d[_0x2d9b('0x28')],_0x226a3d[_0x2d9b('0x2b')]);_0x1e7cba[_0x2d9b('0x2c')]=_[_0x2d9b('0x2d')](_0x226a3d[_0x2d9b('0x28')],qs['fields'](_0xd589da['query'][_0x2d9b('0x2e')]));_0x1e7cba['attributes']=_0x1e7cba[_0x2d9b('0x2c')][_0x2d9b('0x2f')]?_0x1e7cba[_0x2d9b('0x2c')]:_0x226a3d[_0x2d9b('0x28')];if(_0xd589da[_0x2d9b('0x2b')][_0x2d9b('0x30')]){_0x1e7cba[_0x2d9b('0x31')]=[{'all':!![]}];}_0x1e7cba=_[_0x2d9b('0x32')]({},_0x1e7cba,_0xd589da[_0x2d9b('0x33')]);return db['FaxInteraction'][_0x2d9b('0x34')](_0x1e7cba)['then'](handleEntityNotFound(_0x10a8b0,null))[_0x2d9b('0x1a')](respondWithResult(_0x10a8b0,null))[_0x2d9b('0x25')](handleError(_0x10a8b0,null));};exports[_0x2d9b('0x35')]=function(_0x145338,_0x1f0f3a){return db[_0x2d9b('0x2a')][_0x2d9b('0x35')](_0x145338[_0x2d9b('0x36')],{})[_0x2d9b('0x1a')](respondWithResult(_0x1f0f3a,0xc9))[_0x2d9b('0x25')](handleError(_0x1f0f3a,null));};exports['update']=function(_0x129b80,_0x19b3ce){if(_0x129b80['body']['id']){delete _0x129b80[_0x2d9b('0x36')]['id'];}return db[_0x2d9b('0x2a')][_0x2d9b('0x34')]({'where':{'id':_0x129b80[_0x2d9b('0x27')]['id']}})['then'](handleEntityNotFound(_0x19b3ce,null))[_0x2d9b('0x1a')](saveUpdates(_0x129b80[_0x2d9b('0x36')],null))[_0x2d9b('0x1a')](respondWithResult(_0x19b3ce,null))['catch'](handleError(_0x19b3ce,null));};exports[_0x2d9b('0x19')]=function(_0x334924,_0x427064){return db[_0x2d9b('0x2a')][_0x2d9b('0x34')]({'where':{'id':_0x334924[_0x2d9b('0x27')]['id']}})[_0x2d9b('0x1a')](handleEntityNotFound(_0x427064,null))['then'](removeEntity(_0x427064,null))['catch'](handleError(_0x427064,null));};exports[_0x2d9b('0x37')]=function(_0x529f9b,_0x57611b){return db[_0x2d9b('0x2a')]['describe']()[_0x2d9b('0x1a')](respondWithResult(_0x57611b,null))[_0x2d9b('0x25')](handleError(_0x57611b,null));};exports[_0x2d9b('0x38')]=function(_0x2b7eb3,_0x40a577){return db['FaxMessage'][_0x2d9b('0x34')]({'where':{'id':_0x2b7eb3['params']['id']}})[_0x2d9b('0x1a')](handleEntityNotFound(_0x40a577,null))[_0x2d9b('0x1a')](function(_0x24b17b){if(_0x24b17b){return _0x24b17b[_0x2d9b('0x38')](_0x2b7eb3['body'][_0x2d9b('0x39')],_[_0x2d9b('0x3a')](_0x2b7eb3[_0x2d9b('0x36')],[_0x2d9b('0x39'),'id'])||{});}})[_0x2d9b('0x1a')](respondWithResult(_0x40a577,null))[_0x2d9b('0x25')](handleError(_0x40a577,null));};exports[_0x2d9b('0x3b')]=function(_0x23fbfc,_0x1e728e){var _0x10eefd={'raw':![],'where':{}};var _0x477d44={};var _0x5b328c={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x23fbfc[_0x2d9b('0x27')]['id']}})[_0x2d9b('0x1a')](handleEntityNotFound(_0x1e728e,null))['then'](function(_0x5635c1){if(_0x5635c1){_0x477d44[_0x2d9b('0x28')]=_[_0x2d9b('0x29')](db[_0x2d9b('0x3c')][_0x2d9b('0x1e')]);_0x477d44[_0x2d9b('0x2b')]=_[_0x2d9b('0x29')](_0x23fbfc[_0x2d9b('0x2b')]);_0x477d44['filters']=_[_0x2d9b('0x2d')](_0x477d44['model'],_0x477d44[_0x2d9b('0x2b')]);_0x10eefd[_0x2d9b('0x2c')]=_['intersection'](_0x477d44[_0x2d9b('0x28')],qs[_0x2d9b('0x2e')](_0x23fbfc['query'][_0x2d9b('0x2e')]));_0x10eefd[_0x2d9b('0x2c')]=_0x10eefd[_0x2d9b('0x2c')][_0x2d9b('0x2f')]?_0x10eefd[_0x2d9b('0x2c')]:_0x477d44[_0x2d9b('0x28')];if(!_0x23fbfc[_0x2d9b('0x2b')][_0x2d9b('0x3d')](_0x2d9b('0x3e'))){_0x10eefd[_0x2d9b('0x15')]=qs[_0x2d9b('0x15')](_0x23fbfc['query']['limit']);_0x10eefd[_0x2d9b('0x13')]=qs[_0x2d9b('0x13')](_0x23fbfc[_0x2d9b('0x2b')][_0x2d9b('0x13')]);}_0x10eefd[_0x2d9b('0x3f')]=qs[_0x2d9b('0x40')](_0x23fbfc[_0x2d9b('0x2b')][_0x2d9b('0x40')]);_0x10eefd[_0x2d9b('0x41')]=qs[_0x2d9b('0x42')](_[_0x2d9b('0x43')](_0x23fbfc[_0x2d9b('0x2b')],_0x477d44['filters']));_0x10eefd[_0x2d9b('0x41')][_0x2d9b('0x44')]=_0x5635c1['id'];if(_0x23fbfc[_0x2d9b('0x2b')][_0x2d9b('0x45')]){_0x10eefd['where']=_['merge'](_0x10eefd[_0x2d9b('0x41')],{'$or':_[_0x2d9b('0x46')](_0x10eefd['attributes'],function(_0x876afc){var _0x217042={};_0x217042[_0x876afc]={'$like':'%'+_0x23fbfc[_0x2d9b('0x2b')][_0x2d9b('0x45')]+'%'};return _0x217042;})});}if(_0x23fbfc['query'][_0x2d9b('0x47')]){var _0x5d1317=_0x23fbfc[_0x2d9b('0x2b')]['$gte'][_0x2d9b('0x48')](',');var _0x50c09f={};_0x50c09f[_0x5d1317[0x0]]={'$gte':moment(_0x5d1317[0x1])['format'](_0x2d9b('0x49'))};_0x10eefd[_0x2d9b('0x41')]=_[_0x2d9b('0x32')](_0x10eefd['where'],_0x50c09f);}_0x10eefd=_['merge']({},_0x10eefd,_0x23fbfc['options']);return db['FaxMessage'][_0x2d9b('0x16')]({'where':_0x10eefd['where']})['then'](function(_0x172444){_0x5b328c['count']=_0x172444;if(_0x23fbfc['query'][_0x2d9b('0x30')]){_0x10eefd[_0x2d9b('0x31')]=[{'all':!![]}];}return db[_0x2d9b('0x3c')]['findAll'](_0x10eefd);})['then'](function(_0x2f98a4){_0x5b328c[_0x2d9b('0x4a')]=_0x2f98a4;return _0x5b328c;});}})['then'](respondWithFilteredResult(_0x1e728e,_0x10eefd))[_0x2d9b('0x25')](handleError(_0x1e728e,null));};exports['addTags']=function(_0x240f95,_0x1aebbb){return db[_0x2d9b('0x2a')][_0x2d9b('0x34')]({'where':{'id':_0x240f95[_0x2d9b('0x27')]['id']}})[_0x2d9b('0x1a')](handleEntityNotFound(_0x1aebbb,null))[_0x2d9b('0x1a')](function(_0x243524){if(_0x243524){return _0x243524[_0x2d9b('0x4b')](_0x240f95[_0x2d9b('0x36')][_0x2d9b('0x39')],_['omit'](_0x240f95['body'],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x2d9b('0x22')]({'attributes':['id',_0x2d9b('0x1c'),_0x2d9b('0x4c')],'where':{'id':_0x240f95[_0x2d9b('0x36')]['ids']}});})[_0x2d9b('0x1a')](function(_0x560375){socket[_0x2d9b('0x4d')]('faxInteractionTags:save',{'id':Number(_0x240f95['params']['id']),'tags':_0x560375||[]});return{'id':Number(_0x240f95['params']['id']),'tags':_0x560375||[]};});}})[_0x2d9b('0x1a')](respondWithResult(_0x1aebbb,null))[_0x2d9b('0x25')](handleError(_0x1aebbb,null));};exports['removeTags']=function(_0x6d63b6,_0x59af83){return db['FaxInteraction'][_0x2d9b('0x34')]({'where':{'id':_0x6d63b6[_0x2d9b('0x27')]['id']}})[_0x2d9b('0x1a')](handleEntityNotFound(_0x59af83,null))[_0x2d9b('0x1a')](function(_0x12053b){if(_0x12053b){return _0x12053b[_0x2d9b('0x4e')](_0x6d63b6[_0x2d9b('0x2b')][_0x2d9b('0x39')]);}})[_0x2d9b('0x1a')](respondWithStatusCode(_0x59af83,null))[_0x2d9b('0x25')](handleError(_0x59af83,null));};exports[_0x2d9b('0x4f')]=function(_0x2f93b6,_0x2b4828){var _0xe8cd5=moment()[_0x2d9b('0x50')]()[_0x2d9b('0x51')]();var _0x19ce12=path['join'](config[_0x2d9b('0x52')],'server','files',_0x2d9b('0x53'));var _0x2fb4a9=path[_0x2d9b('0x54')](config['root'],_0x2d9b('0x55'),_0x2d9b('0x56'),'attachments');var _0x231877=path[_0x2d9b('0x54')](_0x19ce12,_0xe8cd5);var _0x4fa29a=util['format'](_0x2d9b('0x57'),_0x2f93b6['params']['id'],_0xe8cd5);var _0x1a1d89=path[_0x2d9b('0x54')](_0x19ce12,_0x4fa29a);var _0xe36156=[];_0xe36156[_0x2d9b('0x58')]({'model':db['Attachment'],'as':_0x2d9b('0x59'),'raw':!![]});var _0x14f631=[{'model':db[_0x2d9b('0x3c')],'as':_0x2d9b('0x5a'),'attributes':['id',_0x2d9b('0x36'),_0x2d9b('0x5b')],'include':_0xe36156}];return db[_0x2d9b('0x2a')]['find']({'where':{'id':_0x2f93b6[_0x2d9b('0x27')]['id']},'include':_0x14f631})['then'](handleEntityNotFound(_0x2b4828,null))[_0x2d9b('0x1a')](function(_0x57712e){if(_0x57712e&&_0x57712e[_0x2d9b('0x5a')]){var _0xa742d8=_0x57712e['get']({'plain':!![]});fs['mkdirSync'](_0x231877);for(var _0x4c307b=0x0;_0x4c307b<_0xa742d8[_0x2d9b('0x5a')]['length'];_0x4c307b++){var _0x4a3dbd=_0xa742d8['Messages'][_0x4c307b][_0x2d9b('0x59')];if(_0x4a3dbd){var _0x1be946=path[_0x2d9b('0x54')](_0x2fb4a9,_0x4a3dbd[_0x2d9b('0x5c')]);if(fs[_0x2d9b('0x5d')](_0x1be946)){fs[_0x2d9b('0x5e')](_0x1be946)[_0x2d9b('0x5f')](fs[_0x2d9b('0x60')](path[_0x2d9b('0x54')](_0x231877,_0x4a3dbd[_0x2d9b('0x5c')])));}}}return BPromise[_0x2d9b('0x61')]()['then'](function(){return new BPromise(function(_0x289b0d,_0x29c08b){zipdir(_0x231877,{'saveTo':_0x1a1d89},function(_0x41b26f,_0x23bbd7){if(_0x41b26f)return _0x29c08b(_0x41b26f);return _0x289b0d(_0x23bbd7);});})[_0x2d9b('0x1a')](function(){return new BPromise(function(_0x46a1a4,_0x304384){rimraf(_0x231877,function(_0x52fc81){if(_0x52fc81)_0x304384(_0x52fc81);return _0x46a1a4();});});})[_0x2d9b('0x1a')](function(){return _0x2b4828[_0x2d9b('0x4f')](_0x1a1d89,_0x4fa29a,function(_0x1f3f23){if(_0x1f3f23){console[_0x2d9b('0x62')](_0x2d9b('0x63'),_0x1f3f23);}else{fs[_0x2d9b('0x64')](_0x1a1d89);}});});});}else{return _0x2b4828[_0x2d9b('0xf')](0xc8);}})['catch'](handleError(_0x2b4828,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 9a3dae5..bef5eaa 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 _0x4fad=['then','unreadMessages','length','emit','catch','hook','exports','../../mysqldb','FaxMessage','setMaxListeners','update','getUsers','setDataValue','Users','map','findAll'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x4fad,0xa7));var _0xd4fa=function(_0xadf78e,_0x54ab08){_0xadf78e=_0xadf78e-0x0;var _0x403a9d=_0x4fad[_0xadf78e];return _0x403a9d;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xd4fa('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0xd4fa('0x0'))['db'][_0xd4fa('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xd4fa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd4fa('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2826d0){return function(_0x39560d,_0x10a6a1,_0x136746){_0x39560d[_0xd4fa('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2ad637){_0x39560d[_0xd4fa('0x5')](_0xd4fa('0x6'),_0x2ad637[_0xd4fa('0x7')](function(_0x33d441){return{'id':_0x33d441['id']};}));return FaxMessage[_0xd4fa('0x8')]({'where':{'FaxInteractionId':_0x39560d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd4fa('0x9')](function(_0x52a324){_0x39560d[_0xd4fa('0x5')](_0xd4fa('0xa'),_0x52a324[_0xd4fa('0xb')]);FaxInteractionEvents['emit'](_0x2826d0+':'+_0x39560d['id'],_0x39560d);FaxInteractionEvents[_0xd4fa('0xc')](_0x2826d0,_0x39560d);_0x136746(null);})[_0xd4fa('0xd')](_0x136746(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xd4fa('0xe')](e,emitEvent(event));}}module[_0xd4fa('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x7d5e=['update','getUsers','then','setDataValue','findAll','length','emit','hasOwnProperty','hook','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save'];(function(_0x309991,_0x457e73){var _0x4ca94d=function(_0x294acc){while(--_0x294acc){_0x309991['push'](_0x309991['shift']());}};_0x4ca94d(++_0x457e73);}(_0x7d5e,0xbf));var _0xe7d5=function(_0x5a9781,_0x560943){_0x5a9781=_0x5a9781-0x0;var _0xa8a685=_0x7d5e[_0x5a9781];return _0xa8a685;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xe7d5('0x0'))['db'][_0xe7d5('0x1')];var FaxMessage=require(_0xe7d5('0x0'))['db'][_0xe7d5('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xe7d5('0x3')](0x0);var events={'afterCreate':_0xe7d5('0x4'),'afterUpdate':_0xe7d5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x506d76){return function(_0x3d0638,_0x4b540c,_0x3c8d87){_0x3d0638[_0xe7d5('0x6')]({'attributes':['id'],'raw':!![]})[_0xe7d5('0x7')](function(_0x2919c1){_0x3d0638[_0xe7d5('0x8')]('Users',_0x2919c1['map'](function(_0x1583cf){return{'id':_0x1583cf['id']};}));return FaxMessage[_0xe7d5('0x9')]({'where':{'FaxInteractionId':_0x3d0638['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3feb1d){_0x3d0638[_0xe7d5('0x8')]('unreadMessages',_0x3feb1d[_0xe7d5('0xa')]);FaxInteractionEvents[_0xe7d5('0xb')](_0x506d76+':'+_0x3d0638['id'],_0x3d0638);FaxInteractionEvents[_0xe7d5('0xb')](_0x506d76,_0x3d0638);_0x3c8d87(null);})['catch'](_0x3c8d87(null));};}for(var e in events){if(events[_0xe7d5('0xc')](e)){var event=events[e];FaxInteraction[_0xe7d5('0xd')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 36769be..a6bc096 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 _0x07ce=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','fax_interactions','closed'];(function(_0x1b0d63,_0x1f987b){var _0x4d91f4=function(_0x42eb6a){while(--_0x42eb6a){_0x1b0d63['push'](_0x1b0d63['shift']());}};_0x4d91f4(++_0x1f987b);}(_0x07ce,0x1ce));var _0xe07c=function(_0x3e97e9,_0x321571){_0x3e97e9=_0x3e97e9-0x0;var _0x13ec73=_0x07ce[_0x3e97e9];return _0x13ec73;};'use strict';var _=require('lodash');var util=require(_0xe07c('0x0'));var logger=require(_0xe07c('0x1'))(_0xe07c('0x2'));var moment=require(_0xe07c('0x3'));var BPromise=require(_0xe07c('0x4'));var rp=require(_0xe07c('0x5'));var fs=require('fs');var path=require(_0xe07c('0x6'));var rimraf=require(_0xe07c('0x7'));var config=require(_0xe07c('0x8'));var attributes=require(_0xe07c('0x9'));module[_0xe07c('0xa')]=function(_0x43e8fc,_0x11cc7b){return _0x43e8fc[_0xe07c('0xb')]('FaxInteraction',attributes,{'tableName':_0xe07c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x45f446,_0xb6dd0e,_0x4e9d43){if(_0x45f446['changed'](_0xe07c('0xd'))){_0x45f446[_0xe07c('0xe')]=moment()[_0xe07c('0xf')](_0xe07c('0x10'));}_0x4e9d43(null,_0x45f446);}}});}; \ No newline at end of file +var _0x9af6=['changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions'];(function(_0x120b46,_0xdcecb){var _0x4c444e=function(_0x2fc9c4){while(--_0x2fc9c4){_0x120b46['push'](_0x120b46['shift']());}};_0x4c444e(++_0xdcecb);}(_0x9af6,0x1d7));var _0x69af=function(_0x120b23,_0xb9810f){_0x120b23=_0x120b23-0x0;var _0x2958eb=_0x9af6[_0x120b23];return _0x2958eb;};'use strict';var _=require(_0x69af('0x0'));var util=require(_0x69af('0x1'));var logger=require(_0x69af('0x2'))('api');var moment=require('moment');var BPromise=require(_0x69af('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x69af('0x4'));var config=require(_0x69af('0x5'));var attributes=require(_0x69af('0x6'));module['exports']=function(_0x3848c6,_0x54e2f1){return _0x3848c6[_0x69af('0x7')](_0x69af('0x8'),attributes,{'tableName':_0x69af('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x17353a,_0x26ecde,_0x6b494a){if(_0x17353a[_0x69af('0xa')](_0x69af('0xb'))){_0x17353a['closedAt']=moment()['format'](_0x69af('0xc'));}_0x6b494a(null,_0x17353a);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 9ca5999..fff8cd3 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 _0xe06c=['FaxInteraction','where','addTags','ids','omit','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxInteraction','update','body','options','attributes','limit','stringify','AddTagsToFaxInteraction'];(function(_0x5c63d1,_0x55cb86){var _0x2eb8fa=function(_0x420a71){while(--_0x420a71){_0x5c63d1['push'](_0x5c63d1['shift']());}};_0x2eb8fa(++_0x55cb86);}(_0xe06c,0x1b4));var _0xce06=function(_0x37f148,_0x1edd34){_0x37f148=_0x37f148-0x0;var _0x45959e=_0xe06c[_0x37f148];return _0x45959e;};'use strict';var _=require(_0xce06('0x0'));var util=require(_0xce06('0x1'));var moment=require('moment');var BPromise=require(_0xce06('0x2'));var rs=require(_0xce06('0x3'));var fs=require('fs');var Redis=require(_0xce06('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xce06('0x5'));var logger=require(_0xce06('0x6'))(_0xce06('0x7'));var config=require('../../config/environment');var jayson=require(_0xce06('0x8'));var client=jayson[_0xce06('0x9')][_0xce06('0xa')]({'port':0x232a});config[_0xce06('0xb')]=_[_0xce06('0xc')](config[_0xce06('0xb')],{'host':_0xce06('0xd'),'port':0x18eb});var socket=require(_0xce06('0xe'))(new Redis(config['redis']));require(_0xce06('0xf'))[_0xce06('0x10')](socket);function respondWithRpcPromise(_0x3fd7c5,_0x5f3e63,_0x1aaa60){return new BPromise(function(_0x4769ca,_0x34b86f){return client[_0xce06('0x11')](_0x3fd7c5,_0x1aaa60)[_0xce06('0x12')](function(_0x5125c5){logger[_0xce06('0x13')](_0xce06('0x14'),_0x5f3e63,_0xce06('0x15'));logger[_0xce06('0x16')](_0xce06('0x17'),_0x5f3e63,_0xce06('0x15'),JSON['stringify'](_0x5125c5));if(_0x5125c5['error']){if(_0x5125c5[_0xce06('0x18')][_0xce06('0x19')]===0x1f4){logger[_0xce06('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x5f3e63,_0x5125c5[_0xce06('0x18')][_0xce06('0x1a')]);return _0x34b86f(_0x5125c5[_0xce06('0x18')][_0xce06('0x1a')]);}logger[_0xce06('0x18')](_0xce06('0x14'),_0x5f3e63,_0x5125c5['error'][_0xce06('0x1a')]);return _0x4769ca(_0x5125c5[_0xce06('0x18')][_0xce06('0x1a')]);}else{logger[_0xce06('0x13')](_0xce06('0x14'),_0x5f3e63,_0xce06('0x15'));_0x4769ca(_0x5125c5[_0xce06('0x1b')][_0xce06('0x1a')]);}})[_0xce06('0x1c')](function(_0x143cf8){logger[_0xce06('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x5f3e63,_0x143cf8);_0x34b86f(_0x143cf8);});});}exports[_0xce06('0x1d')]=function(_0x170709){var _0x1c8238=this;return new Promise(function(_0x8bb43a,_0x3a347c){return db['FaxInteraction'][_0xce06('0x1e')](_0x170709[_0xce06('0x1f')],{'raw':_0x170709[_0xce06('0x20')]?_0x170709[_0xce06('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x170709[_0xce06('0x20')]?_0x170709[_0xce06('0x20')]['where']||null:null,'attributes':_0x170709[_0xce06('0x20')]?_0x170709[_0xce06('0x20')][_0xce06('0x21')]||null:null,'limit':_0x170709[_0xce06('0x20')]?_0x170709[_0xce06('0x20')][_0xce06('0x22')]||null:null})[_0xce06('0x12')](function(_0x9246aa){logger['info']('UpdateFaxInteraction',_0x170709);logger[_0xce06('0x16')](_0xce06('0x1d'),_0x170709,JSON[_0xce06('0x23')](_0x9246aa));_0x8bb43a(_0x9246aa);})[_0xce06('0x1c')](function(_0x2ff32f){logger[_0xce06('0x18')](_0xce06('0x1d'),_0x2ff32f['message'],_0x170709);_0x3a347c(_0x1c8238['error'](0x1f4,_0x2ff32f['message']));});});};exports[_0xce06('0x24')]=function(_0x2e6078){return new Promise(function(_0x278d97,_0x41c17a){return db[_0xce06('0x25')]['find']({'where':_0x2e6078[_0xce06('0x20')]?_0x2e6078[_0xce06('0x20')][_0xce06('0x26')]||null:null})['then'](function(_0x386102){if(_0x386102){return _0x386102[_0xce06('0x27')](_0x2e6078[_0xce06('0x1f')][_0xce06('0x28')],_[_0xce06('0x29')](_0x2e6078[_0xce06('0x1f')],[_0xce06('0x28'),'id'])||{});}})['spread'](function(_0x5e3f77){logger[_0xce06('0x13')]('AddTags',_0x2e6078);logger[_0xce06('0x16')](_0xce06('0x2a'),_0x2e6078,JSON[_0xce06('0x23')](_0x5e3f77));_0x278d97(_0x5e3f77);})[_0xce06('0x1c')](function(_0x3c2355){logger[_0xce06('0x18')]('AddTags',_0x3c2355[_0xce06('0x1a')],_0x2e6078);_0x41c17a(_this[_0xce06('0x18')](0x1f4,_0x3c2355[_0xce06('0x1a')]));});});}; \ No newline at end of file +var _0x23e1=['AddTagsToFaxInteraction','find','addTags','ids','spread','AddTags','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateFaxInteraction','FaxInteraction','body','options','where','attributes','limit','debug'];(function(_0x378bba,_0x40a1b1){var _0x2c4353=function(_0x5bc05d){while(--_0x5bc05d){_0x378bba['push'](_0x378bba['shift']());}};_0x2c4353(++_0x40a1b1);}(_0x23e1,0x1da));var _0x123e=function(_0x3492db,_0x169548){_0x3492db=_0x3492db-0x0;var _0xcc12cf=_0x23e1[_0x3492db];return _0xcc12cf;};'use strict';var _=require('lodash');var util=require(_0x123e('0x0'));var moment=require(_0x123e('0x1'));var BPromise=require(_0x123e('0x2'));var rs=require(_0x123e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x123e('0x4'));var logger=require(_0x123e('0x5'))(_0x123e('0x6'));var config=require('../../config/environment');var jayson=require(_0x123e('0x7'));var client=jayson[_0x123e('0x8')][_0x123e('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x123e('0xa')],{'host':_0x123e('0xb'),'port':0x18eb});var socket=require(_0x123e('0xc'))(new Redis(config[_0x123e('0xa')]));require(_0x123e('0xd'))[_0x123e('0xe')](socket);function respondWithRpcPromise(_0x3bc2b2,_0x1ba104,_0x30e4f6){return new BPromise(function(_0x2e7d30,_0xa210ea){return client[_0x123e('0xf')](_0x3bc2b2,_0x30e4f6)[_0x123e('0x10')](function(_0x172495){logger[_0x123e('0x11')](_0x123e('0x12'),_0x1ba104,_0x123e('0x13'));logger['debug'](_0x123e('0x14'),_0x1ba104,_0x123e('0x13'),JSON[_0x123e('0x15')](_0x172495));if(_0x172495['error']){if(_0x172495[_0x123e('0x16')]['code']===0x1f4){logger['error'](_0x123e('0x12'),_0x1ba104,_0x172495[_0x123e('0x16')][_0x123e('0x17')]);return _0xa210ea(_0x172495[_0x123e('0x16')][_0x123e('0x17')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x1ba104,_0x172495[_0x123e('0x16')][_0x123e('0x17')]);return _0x2e7d30(_0x172495[_0x123e('0x16')][_0x123e('0x17')]);}else{logger[_0x123e('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x1ba104,'request\x20sent');_0x2e7d30(_0x172495['result']['message']);}})[_0x123e('0x18')](function(_0x38429d){logger['error'](_0x123e('0x12'),_0x1ba104,_0x38429d);_0xa210ea(_0x38429d);});});}exports[_0x123e('0x19')]=function(_0x91aeb6){var _0x35e6f6=this;return new Promise(function(_0x3eb8ea,_0x540ed4){return db[_0x123e('0x1a')]['update'](_0x91aeb6[_0x123e('0x1b')],{'raw':_0x91aeb6[_0x123e('0x1c')]?_0x91aeb6[_0x123e('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x91aeb6[_0x123e('0x1c')]?_0x91aeb6['options'][_0x123e('0x1d')]||null:null,'attributes':_0x91aeb6[_0x123e('0x1c')]?_0x91aeb6['options'][_0x123e('0x1e')]||null:null,'limit':_0x91aeb6[_0x123e('0x1c')]?_0x91aeb6[_0x123e('0x1c')][_0x123e('0x1f')]||null:null})[_0x123e('0x10')](function(_0x5df034){logger[_0x123e('0x11')]('UpdateFaxInteraction',_0x91aeb6);logger[_0x123e('0x20')](_0x123e('0x19'),_0x91aeb6,JSON['stringify'](_0x5df034));_0x3eb8ea(_0x5df034);})[_0x123e('0x18')](function(_0x13c0c2){logger[_0x123e('0x16')](_0x123e('0x19'),_0x13c0c2[_0x123e('0x17')],_0x91aeb6);_0x540ed4(_0x35e6f6[_0x123e('0x16')](0x1f4,_0x13c0c2[_0x123e('0x17')]));});});};exports[_0x123e('0x21')]=function(_0x2c8ff5){return new Promise(function(_0x48caab,_0x162b21){return db[_0x123e('0x1a')][_0x123e('0x22')]({'where':_0x2c8ff5[_0x123e('0x1c')]?_0x2c8ff5[_0x123e('0x1c')]['where']||null:null})[_0x123e('0x10')](function(_0x543854){if(_0x543854){return _0x543854[_0x123e('0x23')](_0x2c8ff5[_0x123e('0x1b')][_0x123e('0x24')],_['omit'](_0x2c8ff5[_0x123e('0x1b')],[_0x123e('0x24'),'id'])||{});}})[_0x123e('0x25')](function(_0x18644a){logger[_0x123e('0x11')](_0x123e('0x26'),_0x2c8ff5);logger[_0x123e('0x20')]('AddTags',_0x2c8ff5,JSON[_0x123e('0x15')](_0x18644a));_0x48caab(_0x18644a);})[_0x123e('0x18')](function(_0x3282d1){logger['error']('AddTags',_0x3282d1['message'],_0x2c8ff5);_0x162b21(_this['error'](0x1f4,_0x3282d1['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 68964f7..67d25e3 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 _0x6821=['save','remove','emit','removeListener','register','./faxInteraction.events'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0x6821,0x16d));var _0x1682=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x6821[_0x725b8e];return _0x43ac45;};'use strict';var FaxInteractionEvents=require(_0x1682('0x0'));var events=[_0x1682('0x1'),_0x1682('0x2'),'update'];function createListener(_0xf2483c,_0x4e36de){return function(_0x3e5aac){_0x4e36de[_0x1682('0x3')](_0xf2483c,_0x3e5aac);};}function removeListener(_0x1592ba,_0x15a8c9){return function(){FaxInteractionEvents[_0x1682('0x4')](_0x1592ba,_0x15a8c9);};}exports[_0x1682('0x5')]=function(_0x17756b){for(var _0x2c052f=0x0,_0x2821e6=events['length'];_0x2c052f<_0x2821e6;_0x2c052f++){var _0x3dc0c5=events[_0x2c052f];var _0x17662d=createListener('faxInteraction:'+_0x3dc0c5,_0x17756b);FaxInteractionEvents['on'](_0x3dc0c5,_0x17662d);}}; \ No newline at end of file +var _0xe7c6=['./faxInteraction.events','save','remove','register','faxInteraction:'];(function(_0xfe5ffa,_0x19c4ed){var _0x58c97f=function(_0x2a063e){while(--_0x2a063e){_0xfe5ffa['push'](_0xfe5ffa['shift']());}};_0x58c97f(++_0x19c4ed);}(_0xe7c6,0xa5));var _0x6e7c=function(_0x49b205,_0x422fb3){_0x49b205=_0x49b205-0x0;var _0x37b4d4=_0xe7c6[_0x49b205];return _0x37b4d4;};'use strict';var FaxInteractionEvents=require(_0x6e7c('0x0'));var events=[_0x6e7c('0x1'),_0x6e7c('0x2'),'update'];function createListener(_0x3f5829,_0x2fe8b2){return function(_0x13f017){_0x2fe8b2['emit'](_0x3f5829,_0x13f017);};}function removeListener(_0x51ca9c,_0x4f34c7){return function(){FaxInteractionEvents['removeListener'](_0x51ca9c,_0x4f34c7);};}exports[_0x6e7c('0x3')]=function(_0x144948){for(var _0x1a0373=0x0,_0x40f549=events['length'];_0x1a0373<_0x40f549;_0x1a0373++){var _0x5738a3=events[_0x1a0373];var _0x59b06d=createListener(_0x6e7c('0x4')+_0x5738a3,_0x144948);FaxInteractionEvents['on'](_0x5738a3,_0x59b06d);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 28faa3b..7d47889 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 _0x9ac8=['addMessage','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create'];(function(_0x3771ce,_0x350474){var _0x478ba9=function(_0x4bf10f){while(--_0x4bf10f){_0x3771ce['push'](_0x3771ce['shift']());}};_0x478ba9(++_0x350474);}(_0x9ac8,0x184));var _0x89ac=function(_0x135488,_0x425da5){_0x135488=_0x135488-0x0;var _0x2bb24f=_0x9ac8[_0x135488];return _0x2bb24f;};'use strict';var multer=require(_0x89ac('0x0'));var util=require(_0x89ac('0x1'));var path=require(_0x89ac('0x2'));var timeout=require('connect-timeout');var express=require(_0x89ac('0x3'));var router=express[_0x89ac('0x4')]();var fs_extra=require(_0x89ac('0x5'));var auth=require(_0x89ac('0x6'));var interaction=require(_0x89ac('0x7'));var config=require(_0x89ac('0x8'));var controller=require('./faxInteraction.controller');router[_0x89ac('0x9')]('/',auth[_0x89ac('0xa')](),controller[_0x89ac('0xb')]);router[_0x89ac('0x9')](_0x89ac('0xc'),auth[_0x89ac('0xa')](),controller['describe']);router[_0x89ac('0x9')](_0x89ac('0xd'),auth['isAuthenticated'](),controller[_0x89ac('0xe')]);router['get'](_0x89ac('0xf'),auth[_0x89ac('0xa')](),controller[_0x89ac('0x10')]);router['get'](_0x89ac('0x11'),auth[_0x89ac('0xa')](),controller['download']);router[_0x89ac('0x12')]('/',auth['isAuthenticated'](),controller[_0x89ac('0x13')]);router[_0x89ac('0x12')](_0x89ac('0xf'),auth[_0x89ac('0xa')](),controller[_0x89ac('0x14')]);router[_0x89ac('0x12')]('/:id/tags',auth[_0x89ac('0xa')](),interaction[_0x89ac('0x15')](_0x89ac('0x16'),_0x89ac('0x17')),controller[_0x89ac('0x18')]);router[_0x89ac('0x19')](_0x89ac('0xd'),auth[_0x89ac('0xa')](),interaction['tracked']('fax',_0x89ac('0x1a')),controller[_0x89ac('0x1b')]);router[_0x89ac('0x1c')](_0x89ac('0xd'),auth[_0x89ac('0xa')](),interaction['tracked'](_0x89ac('0x16'),_0x89ac('0x1d')),controller[_0x89ac('0x1e')]);router[_0x89ac('0x1c')](_0x89ac('0x1f'),auth[_0x89ac('0xa')](),controller[_0x89ac('0x20')]);module[_0x89ac('0x21')]=router; \ No newline at end of file +var _0x3733=['getMessages','/:id/download','download','post','addMessage','fax','faxinteraction:addtags','tracked','update','delete','destroy','removeTags','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages'];(function(_0x426c40,_0x2ae5b8){var _0x536376=function(_0x5ca7c6){while(--_0x5ca7c6){_0x426c40['push'](_0x426c40['shift']());}};_0x536376(++_0x2ae5b8);}(_0x3733,0x93));var _0x3373=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3733[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3373('0x0'));var util=require(_0x3373('0x1'));var path=require(_0x3373('0x2'));var timeout=require(_0x3373('0x3'));var express=require(_0x3373('0x4'));var router=express['Router']();var fs_extra=require(_0x3373('0x5'));var auth=require(_0x3373('0x6'));var interaction=require(_0x3373('0x7'));var config=require('../../config/environment');var controller=require(_0x3373('0x8'));router[_0x3373('0x9')]('/',auth[_0x3373('0xa')](),controller[_0x3373('0xb')]);router[_0x3373('0x9')](_0x3373('0xc'),auth[_0x3373('0xa')](),controller['describe']);router[_0x3373('0x9')](_0x3373('0xd'),auth[_0x3373('0xa')](),controller['show']);router[_0x3373('0x9')](_0x3373('0xe'),auth[_0x3373('0xa')](),controller[_0x3373('0xf')]);router[_0x3373('0x9')](_0x3373('0x10'),auth[_0x3373('0xa')](),controller[_0x3373('0x11')]);router[_0x3373('0x12')]('/',auth[_0x3373('0xa')](),controller['create']);router['post'](_0x3373('0xe'),auth[_0x3373('0xa')](),controller[_0x3373('0x13')]);router['post']('/:id/tags',auth[_0x3373('0xa')](),interaction['tracked'](_0x3373('0x14'),_0x3373('0x15')),controller['addTags']);router['put'](_0x3373('0xd'),auth[_0x3373('0xa')](),interaction[_0x3373('0x16')](_0x3373('0x14'),'faxinteraction:update'),controller[_0x3373('0x17')]);router[_0x3373('0x18')](_0x3373('0xd'),auth[_0x3373('0xa')](),interaction[_0x3373('0x16')]('fax','faxinteraction:destroy'),controller[_0x3373('0x19')]);router[_0x3373('0x18')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3373('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 5e79276..a42b5b0 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 _0x919e=['BOOLEAN','out','DATE','sequelize','exports','TEXT'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x919e,0x1d7));var _0xe919=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x919e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe919('0x0'));module[_0xe919('0x1')]={'body':{'type':Sequelize[_0xe919('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe919('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xe919('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xe919('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xe919('0x5')]}}; \ No newline at end of file +var _0x6fad=['DATE','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x2859be,_0x4a4356){var _0x21dad2=function(_0x500d17){while(--_0x500d17){_0x2859be['push'](_0x2859be['shift']());}};_0x21dad2(++_0x4a4356);}(_0x6fad,0x174));var _0xd6fa=function(_0x176c4d,_0x428fe7){_0x176c4d=_0x176c4d-0x0;var _0x3ef765=_0x6fad[_0x176c4d];return _0x3ef765;};'use strict';var Sequelize=require(_0xd6fa('0x0'));module[_0xd6fa('0x1')]={'body':{'type':Sequelize[_0xd6fa('0x2')](_0xd6fa('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd6fa('0x4')]('in','out'),'defaultValue':_0xd6fa('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xd6fa('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index edad892..1e39443 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 _0xc771=['null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','create','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','basename','download','root','attachments','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxMessage,\x20%s,\x20%s','result','catch','status','json','undefined','count','offset','limit','Content-Range','destroy','end','sendStatus','name','send','index','map','FaxMessage','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','update','body','params','find','describe','accept','sms','acceptMessage','fax','reject','UserId','user','agent','get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role'];(function(_0x263204,_0x19286b){var _0xed3987=function(_0x282bf1){while(--_0x282bf1){_0x263204['push'](_0x263204['shift']());}};_0xed3987(++_0x19286b);}(_0xc771,0x181));var _0x1c77=function(_0x15d6fc,_0x251679){_0x15d6fc=_0x15d6fc-0x0;var _0x3bff7f=_0xc771[_0x15d6fc];return _0x3bff7f;};'use strict';var util=require('util');var path=require(_0x1c77('0x0'));var _=require(_0x1c77('0x1'));var Redis=require(_0x1c77('0x2'));var interactionService=require(_0x1c77('0x3'));var qs=require(_0x1c77('0x4'));var logger=require(_0x1c77('0x5'))(_0x1c77('0x6'));var config=require(_0x1c77('0x7'));var db=require(_0x1c77('0x8'))['db'];config[_0x1c77('0x9')]=_[_0x1c77('0xa')](config[_0x1c77('0x9')],{'host':_0x1c77('0xb'),'port':0x18eb});var socket=require(_0x1c77('0xc'))(new Redis(config[_0x1c77('0x9')]));require(_0x1c77('0xd'))[_0x1c77('0xe')](socket);var jayson=require(_0x1c77('0xf'));var client=jayson[_0x1c77('0x10')][_0x1c77('0x11')]({'port':0x232c});var client9002=jayson['client'][_0x1c77('0x11')]({'port':0x232a});var interaction_log=require(_0x1c77('0x5'))('fax-interactions');function respondWithRpcPromise(_0x2014ef,_0x55d5ab,_0x3ff440,_0x138c5e){return new Promise(function(_0x1b4cc6,_0x1c0010){var _0x381190=_0x138c5e||client;return _0x381190[_0x1c77('0x12')](_0x2014ef,_0x3ff440)[_0x1c77('0x13')](function(_0xfbf41a){logger[_0x1c77('0x14')]('FaxMessage,\x20%s,\x20%s',_0x55d5ab,_0x1c77('0x15'));logger[_0x1c77('0x16')](_0x1c77('0x17'),_0x55d5ab,_0x1c77('0x15'),JSON[_0x1c77('0x18')](_0xfbf41a));if(_0xfbf41a[_0x1c77('0x19')]){if(_0xfbf41a[_0x1c77('0x19')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x55d5ab,_0xfbf41a[_0x1c77('0x19')][_0x1c77('0x1a')]);return _0x1c0010(_0xfbf41a['error'][_0x1c77('0x1a')]);}logger[_0x1c77('0x19')](_0x1c77('0x1b'),_0x55d5ab,_0xfbf41a[_0x1c77('0x19')][_0x1c77('0x1a')]);return _0x1b4cc6(_0xfbf41a[_0x1c77('0x19')][_0x1c77('0x1a')]);}else{logger['info'](_0x1c77('0x1b'),_0x55d5ab,_0x1c77('0x15'));_0x1b4cc6(_0xfbf41a[_0x1c77('0x1c')][_0x1c77('0x1a')]);}})[_0x1c77('0x1d')](function(_0x397afa){logger['error'](_0x1c77('0x1b'),_0x55d5ab,_0x397afa);_0x1c0010(_0x397afa);});});}function respondWithResult(_0x354623,_0x2e5bd5){_0x2e5bd5=_0x2e5bd5||0xc8;return function(_0x53cefb){if(_0x53cefb){return _0x354623[_0x1c77('0x1e')](_0x2e5bd5)[_0x1c77('0x1f')](_0x53cefb);}};}function respondWithFilteredResult(_0x4bff2f,_0xc189a6){return function(_0x42bd9e){if(_0x42bd9e){var _0x118f64=typeof _0xc189a6['offset']===_0x1c77('0x20')&&typeof _0xc189a6['limit']===_0x1c77('0x20');var _0x142e55=_0x42bd9e[_0x1c77('0x21')];var _0x36540b=_0x118f64?0x0:_0xc189a6['offset'];var _0x25d741=_0x118f64?_0x42bd9e[_0x1c77('0x21')]:_0xc189a6[_0x1c77('0x22')]+_0xc189a6[_0x1c77('0x23')];var _0x1fb893;if(_0x25d741>=_0x142e55){_0x25d741=_0x142e55;_0x1fb893=0xc8;}else{_0x1fb893=0xce;}_0x4bff2f[_0x1c77('0x1e')](_0x1fb893);return _0x4bff2f['set'](_0x1c77('0x24'),_0x36540b+'-'+_0x25d741+'/'+_0x142e55)[_0x1c77('0x1f')](_0x42bd9e);}return null;};}function saveUpdates(_0xbe0936){return function(_0x5d82b9){if(_0x5d82b9){return _0x5d82b9['update'](_0xbe0936)[_0x1c77('0x13')](function(_0x3f1d63){return _0x3f1d63;});}return null;};}function removeEntity(_0x5d418f){return function(_0x1340b8){if(_0x1340b8){return _0x1340b8[_0x1c77('0x25')]()[_0x1c77('0x13')](function(){_0x5d418f[_0x1c77('0x1e')](0xcc)[_0x1c77('0x26')]();});}};}function handleEntityNotFound(_0x3dd8ff){return function(_0x1fe64e){if(!_0x1fe64e){_0x3dd8ff[_0x1c77('0x27')](0x194);}return _0x1fe64e;};}function handleError(_0x50490f,_0x5c58db){_0x5c58db=_0x5c58db||0x1f4;return function(_0x190cfb){logger[_0x1c77('0x19')](_0x190cfb['stack']);if(_0x190cfb[_0x1c77('0x28')]){delete _0x190cfb[_0x1c77('0x28')];}_0x50490f[_0x1c77('0x1e')](_0x5c58db)[_0x1c77('0x29')](_0x190cfb);};}exports[_0x1c77('0x2a')]=function(_0x3401c5,_0x23e6a6){var _0x269293={},_0x53a3f4={},_0x366e80={'count':0x0,'rows':[]};var _0x4908d2=_[_0x1c77('0x2b')](db[_0x1c77('0x2c')][_0x1c77('0x2d')],function(_0x38d8ef){return{'name':_0x38d8ef['fieldName'],'type':_0x38d8ef[_0x1c77('0x2e')][_0x1c77('0x2f')]};});_0x53a3f4[_0x1c77('0x30')]=_[_0x1c77('0x2b')](_0x4908d2,'name');_0x53a3f4['query']=_[_0x1c77('0x31')](_0x3401c5[_0x1c77('0x32')]);_0x53a3f4['filters']=_[_0x1c77('0x33')](_0x53a3f4[_0x1c77('0x30')],_0x53a3f4[_0x1c77('0x32')]);_0x269293[_0x1c77('0x34')]=_[_0x1c77('0x33')](_0x53a3f4['model'],qs[_0x1c77('0x35')](_0x3401c5[_0x1c77('0x32')][_0x1c77('0x35')]));_0x269293[_0x1c77('0x34')]=_0x269293[_0x1c77('0x34')][_0x1c77('0x36')]?_0x269293[_0x1c77('0x34')]:_0x53a3f4[_0x1c77('0x30')];if(!_0x3401c5[_0x1c77('0x32')][_0x1c77('0x37')](_0x1c77('0x38'))){_0x269293['limit']=qs[_0x1c77('0x23')](_0x3401c5[_0x1c77('0x32')][_0x1c77('0x23')]);_0x269293[_0x1c77('0x22')]=qs[_0x1c77('0x22')](_0x3401c5[_0x1c77('0x32')][_0x1c77('0x22')]);}_0x269293['order']=qs[_0x1c77('0x39')](_0x3401c5[_0x1c77('0x32')][_0x1c77('0x39')]);_0x269293[_0x1c77('0x3a')]=qs[_0x1c77('0x3b')](_[_0x1c77('0x3c')](_0x3401c5['query'],_0x53a3f4[_0x1c77('0x3b')]),_0x4908d2);if(_0x3401c5[_0x1c77('0x32')][_0x1c77('0x3d')]){_0x269293[_0x1c77('0x3a')]=_[_0x1c77('0x3e')](_0x269293[_0x1c77('0x3a')],{'$or':_[_0x1c77('0x2b')](_0x4908d2,function(_0x49e53b){if(_0x49e53b[_0x1c77('0x2e')]!==_0x1c77('0x3f')){var _0x4224fa={};_0x4224fa[_0x49e53b[_0x1c77('0x28')]]={'$like':'%'+_0x3401c5[_0x1c77('0x32')][_0x1c77('0x3d')]+'%'};return _0x4224fa;}})});}_0x269293=_[_0x1c77('0x3e')]({},_0x269293,_0x3401c5[_0x1c77('0x40')]);var _0x3ff809={'where':_0x269293[_0x1c77('0x3a')]};return db['FaxMessage'][_0x1c77('0x21')](_0x3ff809)[_0x1c77('0x13')](function(_0x51891c){_0x366e80[_0x1c77('0x21')]=_0x51891c;if(_0x3401c5[_0x1c77('0x32')][_0x1c77('0x41')]){_0x269293['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x269293);})[_0x1c77('0x13')](function(_0x17ecc7){_0x366e80[_0x1c77('0x42')]=_0x17ecc7;return _0x366e80;})[_0x1c77('0x13')](respondWithFilteredResult(_0x23e6a6,_0x269293))[_0x1c77('0x1d')](handleError(_0x23e6a6,null));};exports[_0x1c77('0x43')]=function(_0xfcd1d7,_0x3ce6eb){var _0x2e193a={'raw':!![],'where':{'id':_0xfcd1d7['params']['id']}},_0x135e70={};_0x135e70[_0x1c77('0x30')]=_['keys'](db['FaxMessage'][_0x1c77('0x2d')]);_0x135e70[_0x1c77('0x32')]=_['keys'](_0xfcd1d7[_0x1c77('0x32')]);_0x135e70[_0x1c77('0x3b')]=_[_0x1c77('0x33')](_0x135e70[_0x1c77('0x30')],_0x135e70[_0x1c77('0x32')]);_0x2e193a[_0x1c77('0x34')]=_[_0x1c77('0x33')](_0x135e70[_0x1c77('0x30')],qs[_0x1c77('0x35')](_0xfcd1d7[_0x1c77('0x32')][_0x1c77('0x35')]));_0x2e193a[_0x1c77('0x34')]=_0x2e193a[_0x1c77('0x34')][_0x1c77('0x36')]?_0x2e193a['attributes']:_0x135e70[_0x1c77('0x30')];if(_0xfcd1d7[_0x1c77('0x32')][_0x1c77('0x41')]){_0x2e193a['include']=[{'all':!![]}];}_0x2e193a=_[_0x1c77('0x3e')]({},_0x2e193a,_0xfcd1d7[_0x1c77('0x40')]);return db['FaxMessage']['find'](_0x2e193a)[_0x1c77('0x13')](handleEntityNotFound(_0x3ce6eb,null))[_0x1c77('0x13')](respondWithResult(_0x3ce6eb,null))[_0x1c77('0x1d')](handleError(_0x3ce6eb,null));};exports[_0x1c77('0x44')]=function(_0x218537,_0x4ffb64){if(_0x218537[_0x1c77('0x45')]['id']){delete _0x218537[_0x1c77('0x45')]['id'];}return db[_0x1c77('0x2c')]['find']({'where':{'id':_0x218537[_0x1c77('0x46')]['id']}})[_0x1c77('0x13')](handleEntityNotFound(_0x4ffb64,null))[_0x1c77('0x13')](saveUpdates(_0x218537[_0x1c77('0x45')],null))['then'](respondWithResult(_0x4ffb64,null))[_0x1c77('0x1d')](handleError(_0x4ffb64,null));};exports['destroy']=function(_0x24be68,_0x943de3){return db['FaxMessage'][_0x1c77('0x47')]({'where':{'id':_0x24be68['params']['id']}})[_0x1c77('0x13')](handleEntityNotFound(_0x943de3,null))[_0x1c77('0x13')](removeEntity(_0x943de3,null))['catch'](handleError(_0x943de3,null));};exports[_0x1c77('0x48')]=function(_0x38c7be,_0x1b12d0){return db[_0x1c77('0x2c')][_0x1c77('0x48')]()[_0x1c77('0x13')](respondWithResult(_0x1b12d0,null))[_0x1c77('0x1d')](handleError(_0x1b12d0,null));};exports[_0x1c77('0x49')]=function(_0x3fb592,_0x22d4c5){var _0x45fa06=_0x1c77('0x4a');return interactionService[_0x1c77('0x4b')](_0x3fb592,_0x45fa06)[_0x1c77('0x13')](respondWithResult(_0x22d4c5,null))['catch'](handleError(_0x22d4c5,null));};exports[_0x1c77('0x49')]=function(_0x4c5c23,_0x1d0a9e){var _0x38ce98=_0x1c77('0x4c');return interactionService[_0x1c77('0x4b')](_0x4c5c23,_0x38ce98)[_0x1c77('0x13')](respondWithResult(_0x1d0a9e,null))[_0x1c77('0x1d')](handleError(_0x1d0a9e,null));};exports[_0x1c77('0x4d')]=function(_0x18a270,_0x33b379){var _0x31edf6={'agent':{},'channel':_0x1c77('0x4c')};if(_0x18a270[_0x1c77('0x45')]['id']){delete _0x18a270['body']['id'];}_0x18a270['body'][_0x1c77('0x4e')]=_0x18a270[_0x1c77('0x45')]['UserId']||_0x18a270[_0x1c77('0x4f')]['id'];_0x31edf6[_0x1c77('0x50')]['id']=_0x18a270[_0x1c77('0x45')]['UserId'];return db[_0x1c77('0x2c')][_0x1c77('0x47')]({'where':{'id':_0x18a270[_0x1c77('0x46')]['id'],'UserId':null}})[_0x1c77('0x13')](handleEntityNotFound(_0x33b379,null))[_0x1c77('0x13')](function(_0x39bfe7){if(_0x39bfe7){_0x31edf6[_0x1c77('0x1a')]=_0x39bfe7[_0x1c77('0x51')]({'plain':!![]});return db[_0x1c77('0x52')][_0x1c77('0x47')]({'where':{'id':_0x39bfe7[_0x1c77('0x53')]}});}return null;})[_0x1c77('0x13')](handleEntityNotFound(_0x33b379,null))[_0x1c77('0x13')](function(_0x348ba8){if(_0x348ba8){_0x31edf6[_0x1c77('0x54')]=_0x348ba8[_0x1c77('0x51')]({'plain':!![]});interaction_log[_0x1c77('0x14')](_0x1c77('0x55'),_0x18a270[_0x1c77('0x4f')]['id'],_0x18a270['user'][_0x1c77('0x28')],_0x18a270['user'][_0x1c77('0x56')],_0x31edf6['interaction']['id'],_0x18a270[_0x1c77('0x45')]?JSON[_0x1c77('0x18')](_0x18a270['body']):_0x1c77('0x57'));return respondWithRpcPromise('RejectMessage',_0x1c77('0x58'),_0x31edf6);}return null;})[_0x1c77('0x13')](function(_0x4de814){var _0x3d0198=_0x1c77('0x59')+_0x4de814[_0x1c77('0x1a')][_0x1c77('0x5a')];return db[_0x1c77('0x5b')][_0x1c77('0x32')](_0x3d0198,{'type':db[_0x1c77('0x5c')][_0x1c77('0x5d')][_0x1c77('0x5e')],'raw':!![]})[_0x1c77('0x13')](function(_0x1ccb7e){return _0x1ccb7e;});})['then'](function(_0x2947bd){if(_0x2947bd){_0x31edf6['message'][_0x1c77('0x5f')]=_0x2947bd[0x0];if(!_0x18a270[_0x1c77('0x45')][_0x1c77('0x4e')])return;return db[_0x1c77('0x60')][_0x1c77('0x47')]({'where':{'id':_0x18a270[_0x1c77('0x45')]['UserId'],'role':'agent'},'attributes':['id',_0x1c77('0x28'),_0x1c77('0x61'),_0x1c77('0x62'),'internal'],'raw':!![]});}return null;})['then'](function(_0x5daba9){if(!_0x5daba9)return null;_0x31edf6['message'][_0x1c77('0x50')]=_0x5daba9;return _0x31edf6;})[_0x1c77('0x13')](function(_0x3130db){if(_0x3130db){_0x3130db[_0x1c77('0x1a')]['interface']=util[_0x1c77('0x63')](_0x1c77('0x64'),_0x18a270['user']['name']);_0x3130db['message'][_0x1c77('0x65')]=_0x31edf6['channel'];_0x3130db['message'][_0x1c77('0x66')]=_0x31edf6[_0x1c77('0x65')];_0x3130db[_0x1c77('0x1a')][_0x1c77('0x67')]=_0x1c77('0x4d');respondWithRpcPromise(_0x1c77('0x68'),_0x1c77('0x68'),{'event':_0x1c77('0x69'),'message':_0x3130db[_0x1c77('0x1a')]},client9002);return _0x31edf6;}return null;})[_0x1c77('0x13')](respondWithResult(_0x33b379,null))[_0x1c77('0x1d')](handleError(_0x33b379,null));};exports['create']=function(_0x328ed0,_0x4ea0c1){var _0x58dcdb;return db[_0x1c77('0x2c')][_0x1c77('0x6a')](_0x328ed0[_0x1c77('0x45')],{})[_0x1c77('0x13')](function(_0x4e45a6){_0x58dcdb=_0x4e45a6;return db[_0x1c77('0x6b')][_0x1c77('0x6c')]({'where':{'id':_0x58dcdb[_0x1c77('0x5a')]}});})[_0x1c77('0x13')](function(_0x1f5f0e){if(_[_0x1c77('0x6d')](_0x1f5f0e)){return;}else{_0x58dcdb[_0x1c77('0x4c')]=_0x1f5f0e[_0x1c77('0x4c')];return db[_0x1c77('0x6e')]['findOne']({'where':{'id':_0x58dcdb[_0x1c77('0x6f')]}});}})[_0x1c77('0x13')](function(_0x3f70d8){return respondWithRpcPromise(_0x1c77('0x70'),'SendFax',{'FaxAccountId':_['isNil'](_0x328ed0['body'])?undefined:_0x328ed0[_0x1c77('0x45')][_0x1c77('0x71')],'path':_[_0x1c77('0x6d')](_0x3f70d8)?undefined:util[_0x1c77('0x63')]('/var/opt/motion2/server/files/attachments/%s',_0x3f70d8[_0x1c77('0x72')]),'fax':_[_0x1c77('0x6d')](_0x58dcdb[_0x1c77('0x4c')])?undefined:_0x58dcdb[_0x1c77('0x4c')],'AttachmentId':_0x58dcdb[_0x1c77('0x6f')]},client9002);})['then'](respondWithResult(_0x4ea0c1,0xc9))[_0x1c77('0x1d')](handleError(_0x4ea0c1,null));};exports[_0x1c77('0x73')]=function(_0x77a8e6,_0x586707){var _0x5dec66=path['join'](config[_0x1c77('0x74')],'server','files',_0x1c77('0x75'));return db[_0x1c77('0x2c')][_0x1c77('0x47')]({'where':{'id':_0x77a8e6[_0x1c77('0x46')]['id']},'include':[{'model':db[_0x1c77('0x6e')],'as':_0x1c77('0x6e')}]})[_0x1c77('0x13')](handleEntityNotFound(_0x586707,null))[_0x1c77('0x13')](function(_0x4df4a4){if(_0x4df4a4){return _0x586707[_0x1c77('0x73')](path['join'](_0x5dec66,_0x4df4a4[_0x1c77('0x6e')]['basename']));}})['catch'](handleError(_0x586707,null));}; \ No newline at end of file +var _0xa96b=['UserId','user','agent','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','ContactId','sequelize','QueryTypes','SELECT','contact','email','format','SIP/%s','channel','motionChannel','EventManager','create','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','basename','download','join','server','attachments','util','path','ioredis','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','fax-interactions','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','status','offset','undefined','count','set','json','update','destroy','end','sendStatus','stack','name','send','index','map','FaxMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','body','find','describe','accept','sms','acceptMessage','fax','reject'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa96b,0x1d5));var _0xba96=function(_0x48a868,_0x2cf98a){_0x48a868=_0x48a868-0x0;var _0x1de308=_0xa96b[_0x48a868];return _0x1de308;};'use strict';var util=require(_0xba96('0x0'));var path=require(_0xba96('0x1'));var _=require('lodash');var Redis=require(_0xba96('0x2'));var interactionService=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0xba96('0x3'))(_0xba96('0x4'));var config=require(_0xba96('0x5'));var db=require('../../mysqldb')['db'];config[_0xba96('0x6')]=_['defaults'](config[_0xba96('0x6')],{'host':_0xba96('0x7'),'port':0x18eb});var socket=require(_0xba96('0x8'))(new Redis(config['redis']));require(_0xba96('0x9'))[_0xba96('0xa')](socket);var jayson=require(_0xba96('0xb'));var client=jayson[_0xba96('0xc')]['http']({'port':0x232c});var client9002=jayson[_0xba96('0xc')][_0xba96('0xd')]({'port':0x232a});var interaction_log=require(_0xba96('0x3'))(_0xba96('0xe'));function respondWithRpcPromise(_0x305757,_0x33adab,_0x56c2e3,_0x1ebf75){return new Promise(function(_0x505b45,_0x59b6b3){var _0x5757dd=_0x1ebf75||client;return _0x5757dd[_0xba96('0xf')](_0x305757,_0x56c2e3)[_0xba96('0x10')](function(_0xe241bf){logger[_0xba96('0x11')]('FaxMessage,\x20%s,\x20%s',_0x33adab,_0xba96('0x12'));logger['debug'](_0xba96('0x13'),_0x33adab,_0xba96('0x12'),JSON[_0xba96('0x14')](_0xe241bf));if(_0xe241bf[_0xba96('0x15')]){if(_0xe241bf[_0xba96('0x15')][_0xba96('0x16')]===0x1f4){logger['error'](_0xba96('0x17'),_0x33adab,_0xe241bf[_0xba96('0x15')][_0xba96('0x18')]);return _0x59b6b3(_0xe241bf['error']['message']);}logger['error'](_0xba96('0x17'),_0x33adab,_0xe241bf[_0xba96('0x15')]['message']);return _0x505b45(_0xe241bf[_0xba96('0x15')][_0xba96('0x18')]);}else{logger[_0xba96('0x11')](_0xba96('0x17'),_0x33adab,_0xba96('0x12'));_0x505b45(_0xe241bf[_0xba96('0x19')]['message']);}})[_0xba96('0x1a')](function(_0x393515){logger[_0xba96('0x15')](_0xba96('0x17'),_0x33adab,_0x393515);_0x59b6b3(_0x393515);});});}function respondWithResult(_0x19f05d,_0x453e42){_0x453e42=_0x453e42||0xc8;return function(_0x172b83){if(_0x172b83){return _0x19f05d[_0xba96('0x1b')](_0x453e42)['json'](_0x172b83);}};}function respondWithFilteredResult(_0x224e61,_0xb983af){return function(_0xa01d53){if(_0xa01d53){var _0x3fd382=typeof _0xb983af[_0xba96('0x1c')]===_0xba96('0x1d')&&typeof _0xb983af['limit']===_0xba96('0x1d');var _0x3a7110=_0xa01d53['count'];var _0x3afc59=_0x3fd382?0x0:_0xb983af[_0xba96('0x1c')];var _0x2f0ce5=_0x3fd382?_0xa01d53[_0xba96('0x1e')]:_0xb983af['offset']+_0xb983af['limit'];var _0x19f483;if(_0x2f0ce5>=_0x3a7110){_0x2f0ce5=_0x3a7110;_0x19f483=0xc8;}else{_0x19f483=0xce;}_0x224e61[_0xba96('0x1b')](_0x19f483);return _0x224e61[_0xba96('0x1f')]('Content-Range',_0x3afc59+'-'+_0x2f0ce5+'/'+_0x3a7110)[_0xba96('0x20')](_0xa01d53);}return null;};}function saveUpdates(_0x3009b3){return function(_0x381ead){if(_0x381ead){return _0x381ead[_0xba96('0x21')](_0x3009b3)[_0xba96('0x10')](function(_0xa03680){return _0xa03680;});}return null;};}function removeEntity(_0x420acc){return function(_0x11d224){if(_0x11d224){return _0x11d224[_0xba96('0x22')]()[_0xba96('0x10')](function(){_0x420acc[_0xba96('0x1b')](0xcc)[_0xba96('0x23')]();});}};}function handleEntityNotFound(_0x557ee3){return function(_0x36cf6b){if(!_0x36cf6b){_0x557ee3[_0xba96('0x24')](0x194);}return _0x36cf6b;};}function handleError(_0x371493,_0x297fa4){_0x297fa4=_0x297fa4||0x1f4;return function(_0xe685a8){logger['error'](_0xe685a8[_0xba96('0x25')]);if(_0xe685a8[_0xba96('0x26')]){delete _0xe685a8[_0xba96('0x26')];}_0x371493[_0xba96('0x1b')](_0x297fa4)[_0xba96('0x27')](_0xe685a8);};}exports[_0xba96('0x28')]=function(_0x158801,_0x53fa93){var _0x3b25bf={},_0x264226={},_0x1efbaa={'count':0x0,'rows':[]};var _0x2315ce=_[_0xba96('0x29')](db[_0xba96('0x2a')][_0xba96('0x2b')],function(_0xace930){return{'name':_0xace930['fieldName'],'type':_0xace930[_0xba96('0x2c')][_0xba96('0x2d')]};});_0x264226[_0xba96('0x2e')]=_['map'](_0x2315ce,_0xba96('0x26'));_0x264226[_0xba96('0x2f')]=_[_0xba96('0x30')](_0x158801[_0xba96('0x2f')]);_0x264226['filters']=_[_0xba96('0x31')](_0x264226[_0xba96('0x2e')],_0x264226['query']);_0x3b25bf[_0xba96('0x32')]=_['intersection'](_0x264226[_0xba96('0x2e')],qs[_0xba96('0x33')](_0x158801[_0xba96('0x2f')][_0xba96('0x33')]));_0x3b25bf[_0xba96('0x32')]=_0x3b25bf['attributes'][_0xba96('0x34')]?_0x3b25bf[_0xba96('0x32')]:_0x264226[_0xba96('0x2e')];if(!_0x158801[_0xba96('0x2f')]['hasOwnProperty'](_0xba96('0x35'))){_0x3b25bf['limit']=qs[_0xba96('0x36')](_0x158801['query'][_0xba96('0x36')]);_0x3b25bf[_0xba96('0x1c')]=qs[_0xba96('0x1c')](_0x158801[_0xba96('0x2f')][_0xba96('0x1c')]);}_0x3b25bf[_0xba96('0x37')]=qs[_0xba96('0x38')](_0x158801[_0xba96('0x2f')]['sort']);_0x3b25bf[_0xba96('0x39')]=qs[_0xba96('0x3a')](_['pick'](_0x158801[_0xba96('0x2f')],_0x264226[_0xba96('0x3a')]),_0x2315ce);if(_0x158801[_0xba96('0x2f')][_0xba96('0x3b')]){_0x3b25bf[_0xba96('0x39')]=_[_0xba96('0x3c')](_0x3b25bf['where'],{'$or':_[_0xba96('0x29')](_0x2315ce,function(_0x3adcaa){if(_0x3adcaa['type']!==_0xba96('0x3d')){var _0x4470b7={};_0x4470b7[_0x3adcaa[_0xba96('0x26')]]={'$like':'%'+_0x158801['query'][_0xba96('0x3b')]+'%'};return _0x4470b7;}})});}_0x3b25bf=_[_0xba96('0x3c')]({},_0x3b25bf,_0x158801[_0xba96('0x3e')]);var _0x2f99ad={'where':_0x3b25bf[_0xba96('0x39')]};return db[_0xba96('0x2a')][_0xba96('0x1e')](_0x2f99ad)[_0xba96('0x10')](function(_0xf11a45){_0x1efbaa[_0xba96('0x1e')]=_0xf11a45;if(_0x158801[_0xba96('0x2f')][_0xba96('0x3f')]){_0x3b25bf[_0xba96('0x40')]=[{'all':!![]}];}return db[_0xba96('0x2a')][_0xba96('0x41')](_0x3b25bf);})[_0xba96('0x10')](function(_0x10a5ab){_0x1efbaa[_0xba96('0x42')]=_0x10a5ab;return _0x1efbaa;})[_0xba96('0x10')](respondWithFilteredResult(_0x53fa93,_0x3b25bf))['catch'](handleError(_0x53fa93,null));};exports['show']=function(_0x44cf19,_0x462502){var _0x529a3d={'raw':!![],'where':{'id':_0x44cf19[_0xba96('0x43')]['id']}},_0x4f598c={};_0x4f598c['model']=_[_0xba96('0x30')](db[_0xba96('0x2a')][_0xba96('0x2b')]);_0x4f598c[_0xba96('0x2f')]=_[_0xba96('0x30')](_0x44cf19[_0xba96('0x2f')]);_0x4f598c['filters']=_[_0xba96('0x31')](_0x4f598c[_0xba96('0x2e')],_0x4f598c['query']);_0x529a3d[_0xba96('0x32')]=_['intersection'](_0x4f598c['model'],qs[_0xba96('0x33')](_0x44cf19[_0xba96('0x2f')][_0xba96('0x33')]));_0x529a3d[_0xba96('0x32')]=_0x529a3d['attributes']['length']?_0x529a3d[_0xba96('0x32')]:_0x4f598c[_0xba96('0x2e')];if(_0x44cf19['query'][_0xba96('0x3f')]){_0x529a3d[_0xba96('0x40')]=[{'all':!![]}];}_0x529a3d=_[_0xba96('0x3c')]({},_0x529a3d,_0x44cf19[_0xba96('0x3e')]);return db[_0xba96('0x2a')]['find'](_0x529a3d)['then'](handleEntityNotFound(_0x462502,null))[_0xba96('0x10')](respondWithResult(_0x462502,null))[_0xba96('0x1a')](handleError(_0x462502,null));};exports[_0xba96('0x21')]=function(_0x21c1e2,_0x39dce6){if(_0x21c1e2[_0xba96('0x44')]['id']){delete _0x21c1e2['body']['id'];}return db[_0xba96('0x2a')][_0xba96('0x45')]({'where':{'id':_0x21c1e2['params']['id']}})[_0xba96('0x10')](handleEntityNotFound(_0x39dce6,null))[_0xba96('0x10')](saveUpdates(_0x21c1e2['body'],null))['then'](respondWithResult(_0x39dce6,null))[_0xba96('0x1a')](handleError(_0x39dce6,null));};exports[_0xba96('0x22')]=function(_0x68840e,_0x235479){return db[_0xba96('0x2a')]['find']({'where':{'id':_0x68840e[_0xba96('0x43')]['id']}})[_0xba96('0x10')](handleEntityNotFound(_0x235479,null))[_0xba96('0x10')](removeEntity(_0x235479,null))[_0xba96('0x1a')](handleError(_0x235479,null));};exports[_0xba96('0x46')]=function(_0x4b597d,_0x1c3533){return db['FaxMessage'][_0xba96('0x46')]()[_0xba96('0x10')](respondWithResult(_0x1c3533,null))[_0xba96('0x1a')](handleError(_0x1c3533,null));};exports[_0xba96('0x47')]=function(_0x2254ea,_0x26f44f){var _0x426a45=_0xba96('0x48');return interactionService[_0xba96('0x49')](_0x2254ea,_0x426a45)[_0xba96('0x10')](respondWithResult(_0x26f44f,null))['catch'](handleError(_0x26f44f,null));};exports[_0xba96('0x47')]=function(_0x3826e3,_0x1ba88c){var _0x3f1af6=_0xba96('0x4a');return interactionService[_0xba96('0x49')](_0x3826e3,_0x3f1af6)[_0xba96('0x10')](respondWithResult(_0x1ba88c,null))['catch'](handleError(_0x1ba88c,null));};exports[_0xba96('0x4b')]=function(_0x173cf7,_0x432bc5){var _0x5b6a61={'agent':{},'channel':_0xba96('0x4a')};if(_0x173cf7['body']['id']){delete _0x173cf7[_0xba96('0x44')]['id'];}_0x173cf7[_0xba96('0x44')][_0xba96('0x4c')]=_0x173cf7[_0xba96('0x44')]['UserId']||_0x173cf7[_0xba96('0x4d')]['id'];_0x5b6a61[_0xba96('0x4e')]['id']=_0x173cf7['body'][_0xba96('0x4c')];return db[_0xba96('0x2a')][_0xba96('0x45')]({'where':{'id':_0x173cf7[_0xba96('0x43')]['id'],'UserId':null}})[_0xba96('0x10')](handleEntityNotFound(_0x432bc5,null))[_0xba96('0x10')](function(_0x50fc7d){if(_0x50fc7d){_0x5b6a61[_0xba96('0x18')]=_0x50fc7d['get']({'plain':!![]});return db[_0xba96('0x4f')][_0xba96('0x45')]({'where':{'id':_0x50fc7d[_0xba96('0x50')]}});}return null;})[_0xba96('0x10')](handleEntityNotFound(_0x432bc5,null))[_0xba96('0x10')](function(_0x323def){if(_0x323def){_0x5b6a61[_0xba96('0x51')]=_0x323def['get']({'plain':!![]});interaction_log['info'](_0xba96('0x52'),_0x173cf7[_0xba96('0x4d')]['id'],_0x173cf7[_0xba96('0x4d')]['name'],_0x173cf7[_0xba96('0x4d')][_0xba96('0x53')],_0x5b6a61[_0xba96('0x51')]['id'],_0x173cf7['body']?JSON[_0xba96('0x14')](_0x173cf7[_0xba96('0x44')]):_0xba96('0x54'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x5b6a61);}return null;})[_0xba96('0x10')](function(_0x49583c){var _0x4fada7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x49583c[_0xba96('0x18')][_0xba96('0x55')];return db[_0xba96('0x56')]['query'](_0x4fada7,{'type':db['Sequelize'][_0xba96('0x57')][_0xba96('0x58')],'raw':!![]})[_0xba96('0x10')](function(_0x264fc5){return _0x264fc5;});})[_0xba96('0x10')](function(_0x5a3834){if(_0x5a3834){_0x5b6a61[_0xba96('0x18')][_0xba96('0x59')]=_0x5a3834[0x0];if(!_0x173cf7[_0xba96('0x44')][_0xba96('0x4c')])return;return db['User'][_0xba96('0x45')]({'where':{'id':_0x173cf7['body'][_0xba96('0x4c')],'role':_0xba96('0x4e')},'attributes':['id',_0xba96('0x26'),'fullname',_0xba96('0x5a'),'internal'],'raw':!![]});}return null;})['then'](function(_0x22d832){if(!_0x22d832)return null;_0x5b6a61[_0xba96('0x18')]['agent']=_0x22d832;return _0x5b6a61;})[_0xba96('0x10')](function(_0x2691ec){if(_0x2691ec){_0x2691ec['message']['interface']=util[_0xba96('0x5b')](_0xba96('0x5c'),_0x173cf7[_0xba96('0x4d')][_0xba96('0x26')]);_0x2691ec[_0xba96('0x18')][_0xba96('0x5d')]=_0x5b6a61['channel'];_0x2691ec[_0xba96('0x18')][_0xba96('0x5e')]=_0x5b6a61[_0xba96('0x5d')];_0x2691ec['message']['event']=_0xba96('0x4b');respondWithRpcPromise(_0xba96('0x5f'),_0xba96('0x5f'),{'event':'rejectmessage','message':_0x2691ec[_0xba96('0x18')]},client9002);return _0x5b6a61;}return null;})[_0xba96('0x10')](respondWithResult(_0x432bc5,null))[_0xba96('0x1a')](handleError(_0x432bc5,null));};exports[_0xba96('0x60')]=function(_0x41644a,_0x1f638b){var _0x134f3f;return db[_0xba96('0x2a')][_0xba96('0x60')](_0x41644a[_0xba96('0x44')],{})[_0xba96('0x10')](function(_0x5cee5c){_0x134f3f=_0x5cee5c;return db[_0xba96('0x61')][_0xba96('0x62')]({'where':{'id':_0x134f3f['ContactId']}});})[_0xba96('0x10')](function(_0x2c5875){if(_[_0xba96('0x63')](_0x2c5875)){return;}else{_0x134f3f[_0xba96('0x4a')]=_0x2c5875[_0xba96('0x4a')];return db[_0xba96('0x64')]['findOne']({'where':{'id':_0x134f3f[_0xba96('0x65')]}});}})[_0xba96('0x10')](function(_0x268fc3){return respondWithRpcPromise('SendFax',_0xba96('0x66'),{'FaxAccountId':_['isNil'](_0x41644a[_0xba96('0x44')])?undefined:_0x41644a['body'][_0xba96('0x67')],'path':_[_0xba96('0x63')](_0x268fc3)?undefined:util[_0xba96('0x5b')]('/var/opt/motion2/server/files/attachments/%s',_0x268fc3[_0xba96('0x68')]),'fax':_[_0xba96('0x63')](_0x134f3f['fax'])?undefined:_0x134f3f['fax'],'AttachmentId':_0x134f3f['AttachmentId']},client9002);})[_0xba96('0x10')](respondWithResult(_0x1f638b,0xc9))[_0xba96('0x1a')](handleError(_0x1f638b,null));};exports[_0xba96('0x69')]=function(_0x24cad6,_0x42e30a){var _0x238f21=path[_0xba96('0x6a')](config['root'],_0xba96('0x6b'),'files',_0xba96('0x6c'));return db[_0xba96('0x2a')][_0xba96('0x45')]({'where':{'id':_0x24cad6['params']['id']},'include':[{'model':db[_0xba96('0x64')],'as':_0xba96('0x64')}]})['then'](handleEntityNotFound(_0x42e30a,null))[_0xba96('0x10')](function(_0x23e918){if(_0x23e918){return _0x42e30a['download'](path[_0xba96('0x6a')](_0x238f21,_0x23e918[_0xba96('0x64')][_0xba96('0x68')]));}})[_0xba96('0x1a')](handleError(_0x42e30a,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index f8884fd..c571698 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 _0x07d7=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x467d55,_0x4d39ae){var _0x14a8ed=function(_0x1d3b4c){while(--_0x1d3b4c){_0x467d55['push'](_0x467d55['shift']());}};_0x14a8ed(++_0x4d39ae);}(_0x07d7,0x85));var _0x707d=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0x07d7[_0x128450];return _0x4d80ed;};'use strict';var EventEmitter=require(_0x707d('0x0'));var FaxMessage=require(_0x707d('0x1'))['db'][_0x707d('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x707d('0x3')](0x0);var events={'afterCreate':_0x707d('0x4'),'afterUpdate':_0x707d('0x5'),'afterDestroy':_0x707d('0x6')};function emitEvent(_0x3d6fed){return function(_0x38c520,_0x2a5ddd,_0x3b44c7){FaxMessageEvents[_0x707d('0x7')](_0x3d6fed+':'+_0x38c520['id'],_0x38c520);FaxMessageEvents[_0x707d('0x7')](_0x3d6fed,_0x38c520);_0x3b44c7(null);};}for(var e in events){if(events[_0x707d('0x8')](e)){var event=events[e];FaxMessage[_0x707d('0x9')](e,emitEvent(event));}}module[_0x707d('0xa')]=FaxMessageEvents; \ No newline at end of file +var _0x8b52=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','save','update'];(function(_0x49e4a3,_0x5c81ce){var _0x59d414=function(_0x1d5d29){while(--_0x1d5d29){_0x49e4a3['push'](_0x49e4a3['shift']());}};_0x59d414(++_0x5c81ce);}(_0x8b52,0x151));var _0x28b5=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8b52[_0x53ccf2];return _0x5a2964;};'use strict';var EventEmitter=require(_0x28b5('0x0'));var FaxMessage=require(_0x28b5('0x1'))['db'][_0x28b5('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x28b5('0x3'),'afterUpdate':_0x28b5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4110e8){return function(_0x3d0e93,_0x3a762e,_0x226981){FaxMessageEvents[_0x28b5('0x5')](_0x4110e8+':'+_0x3d0e93['id'],_0x3d0e93);FaxMessageEvents[_0x28b5('0x5')](_0x4110e8,_0x3d0e93);_0x226981(null);};}for(var e in events){if(events[_0x28b5('0x6')](e)){var event=events[e];FaxMessage[_0x28b5('0x7')](e,emitEvent(event));}}module[_0x28b5('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 9026541..8531741 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 _0xaea4=['./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3c3332,_0x550573){var _0x57c815=function(_0x19556b){while(--_0x19556b){_0x3c3332['push'](_0x3c3332['shift']());}};_0x57c815(++_0x550573);}(_0xaea4,0xca));var _0x4aea=function(_0x58cb42,_0x431346){_0x58cb42=_0x58cb42-0x0;var _0x1edb4c=_0xaea4[_0x58cb42];return _0x1edb4c;};'use strict';var _=require('lodash');var util=require(_0x4aea('0x0'));var logger=require(_0x4aea('0x1'))('api');var moment=require(_0x4aea('0x2'));var BPromise=require(_0x4aea('0x3'));var rp=require(_0x4aea('0x4'));var fs=require('fs');var path=require(_0x4aea('0x5'));var rimraf=require(_0x4aea('0x6'));var config=require(_0x4aea('0x7'));var attributes=require(_0x4aea('0x8'));module[_0x4aea('0x9')]=function(_0x5a788b,_0x10ea8d){return _0x5a788b['define'](_0x4aea('0xa'),attributes,{'tableName':_0x4aea('0xb'),'paranoid':![],'indexes':[{'name':_0x4aea('0xc'),'fields':[_0x4aea('0xd')],'type':_0x4aea('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x52c9a6,_0x283ba8,_0x5bec26){var _0x2629b9=_0x5a788b[_0x4aea('0xf')];var _0x2b5b99=_0x52c9a6[_0x4aea('0x10')]({'plain':!![]});if(_0x2b5b99['direction'][_0x4aea('0x11')]()==='in'||_0x2b5b99[_0x4aea('0x12')]['toLowerCase']()===_0x4aea('0x13')&&!_0x2b5b99[_0x4aea('0x14')]&&!_['isNil'](_0x2b5b99['UserId'])){_0x2629b9[_0x4aea('0x15')][_0x4aea('0x16')]({'where':{'id':_0x2b5b99[_0x4aea('0x17')]}})[_0x4aea('0x18')](function(_0xff309a){if(_0xff309a){_0xff309a[_0x4aea('0x19')]({'lastMsgAt':_0x2b5b99[_0x4aea('0x1a')],'lastMsgDirection':_0x2b5b99['direction'][_0x4aea('0x11')]()});}})['catch'](function(_0x5e10b5){console[_0x4aea('0x1b')](_0x5e10b5);});}_0x5bec26();}},'charset':_0x4aea('0x1c'),'collate':_0x4aea('0x1d')});}; \ No newline at end of file +var _0xf772=['direction','toLowerCase','out','secret','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','utf8mb4','lodash','util','api','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','get'];(function(_0x28ffee,_0x230a50){var _0x2b4cf1=function(_0x2be533){while(--_0x2be533){_0x28ffee['push'](_0x28ffee['shift']());}};_0x2b4cf1(++_0x230a50);}(_0xf772,0x143));var _0x2f77=function(_0xebc6bf,_0x457124){_0xebc6bf=_0xebc6bf-0x0;var _0x3cc4a5=_0xf772[_0xebc6bf];return _0x3cc4a5;};'use strict';var _=require(_0x2f77('0x0'));var util=require(_0x2f77('0x1'));var logger=require('../../config/logger')(_0x2f77('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f77('0x3'));var fs=require('fs');var path=require(_0x2f77('0x4'));var rimraf=require('rimraf');var config=require(_0x2f77('0x5'));var attributes=require(_0x2f77('0x6'));module[_0x2f77('0x7')]=function(_0x2149c1,_0x1d5c23){return _0x2149c1[_0x2f77('0x8')]('FaxMessage',attributes,{'tableName':_0x2f77('0x9'),'paranoid':![],'indexes':[{'name':_0x2f77('0xa'),'fields':[_0x2f77('0xb')],'type':_0x2f77('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a24bc,_0x4b11ec,_0x2bb6ea){var _0x202b69=_0x2149c1[_0x2f77('0xd')];var _0x46e56b=_0x1a24bc[_0x2f77('0xe')]({'plain':!![]});if(_0x46e56b[_0x2f77('0xf')][_0x2f77('0x10')]()==='in'||_0x46e56b['direction'][_0x2f77('0x10')]()===_0x2f77('0x11')&&!_0x46e56b[_0x2f77('0x12')]&&!_['isNil'](_0x46e56b['UserId'])){_0x202b69[_0x2f77('0x13')][_0x2f77('0x14')]({'where':{'id':_0x46e56b[_0x2f77('0x15')]}})['then'](function(_0x533076){if(_0x533076){_0x533076[_0x2f77('0x16')]({'lastMsgAt':_0x46e56b[_0x2f77('0x17')],'lastMsgDirection':_0x46e56b[_0x2f77('0xf')][_0x2f77('0x10')]()});}})[_0x2f77('0x18')](function(_0x1b51cb){console['error'](_0x1b51cb);});}_0x2bb6ea();}},'charset':_0x2f77('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 8ec7aa1..be1c1fe 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x032e=['FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','where','attributes','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info'];(function(_0x504cde,_0x24e3cd){var _0x3b8554=function(_0x1508df){while(--_0x1508df){_0x504cde['push'](_0x504cde['shift']());}};_0x3b8554(++_0x24e3cd);}(_0x032e,0x124));var _0xe032=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x032e[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});config[_0xe032('0xb')]=_[_0xe032('0xc')](config[_0xe032('0xb')],{'host':_0xe032('0xd'),'port':0x18eb});var socket=require(_0xe032('0xe'))(new Redis(config[_0xe032('0xb')]));require(_0xe032('0xf'))[_0xe032('0x10')](socket);function respondWithRpcPromise(_0x2dc9e5,_0x167bd9,_0x4aec53){return new BPromise(function(_0x1382e1,_0x1ce2ae){return client[_0xe032('0x11')](_0x2dc9e5,_0x4aec53)[_0xe032('0x12')](function(_0x244f93){logger[_0xe032('0x13')](_0xe032('0x14'),_0x167bd9,'request\x20sent');logger[_0xe032('0x15')](_0xe032('0x16'),_0x167bd9,_0xe032('0x17'),JSON[_0xe032('0x18')](_0x244f93));if(_0x244f93['error']){if(_0x244f93[_0xe032('0x19')][_0xe032('0x1a')]===0x1f4){logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1ce2ae(_0x244f93[_0xe032('0x19')]['message']);}logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1382e1(_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);}else{logger['info'](_0xe032('0x14'),_0x167bd9,_0xe032('0x17'));_0x1382e1(_0x244f93[_0xe032('0x1c')][_0xe032('0x1b')]);}})[_0xe032('0x1d')](function(_0x5721ce){logger['error']('FaxMessage,\x20%s,\x20%s',_0x167bd9,_0x5721ce);_0x1ce2ae(_0x5721ce);});});}exports[_0xe032('0x1e')]=function(_0x505d8c){var _0x46dc27=this;return new Promise(function(_0x4608e4,_0x3f0257){return db[_0xe032('0x1f')][_0xe032('0x20')](_0x505d8c[_0xe032('0x21')],{'raw':_0x505d8c[_0xe032('0x22')]?_0x505d8c['options'][_0xe032('0x23')]===undefined?!![]:![]:!![]})[_0xe032('0x12')](function(_0x232e8f){logger[_0xe032('0x13')](_0xe032('0x1e'),_0x505d8c);logger[_0xe032('0x15')](_0xe032('0x1e'),_0x505d8c,JSON[_0xe032('0x18')](_0x232e8f));_0x4608e4(_0x232e8f);})['catch'](function(_0x4f1aa3){logger['error'](_0xe032('0x1e'),_0x4f1aa3[_0xe032('0x1b')],_0x505d8c);_0x3f0257(_0x46dc27[_0xe032('0x19')](0x1f4,_0x4f1aa3[_0xe032('0x1b')]));});});};exports[_0xe032('0x24')]=function(_0x200671){var _0x36ece7=this;return new Promise(function(_0x2b6ffa,_0x4dcbf1){return db[_0xe032('0x1f')]['update'](_0x200671[_0xe032('0x21')],{'raw':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x200671['options']?_0x200671['options'][_0xe032('0x25')]||null:null,'attributes':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x26')]||null:null,'limit':_0x200671['options']?_0x200671['options']['limit']||null:null})[_0xe032('0x12')](function(_0x1dd34f){logger[_0xe032('0x13')](_0xe032('0x24'),_0x200671);logger['debug'](_0xe032('0x24'),_0x200671,JSON[_0xe032('0x18')](_0x1dd34f));_0x2b6ffa(_0x1dd34f);})[_0xe032('0x1d')](function(_0x4348f8){logger[_0xe032('0x19')]('UpdateFaxMessage',_0x4348f8[_0xe032('0x1b')],_0x200671);_0x4dcbf1(_0x36ece7[_0xe032('0x19')](0x1f4,_0x4348f8[_0xe032('0x1b')]));});});}; \ No newline at end of file +var _0x0a9a=['error','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','CreateFaxMessage','debug','UpdateFaxMessage','update','raw','where','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./faxMessage.socket','register','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1bc933,_0x46c2de){var _0x238bba=function(_0x5399ef){while(--_0x5399ef){_0x1bc933['push'](_0x1bc933['shift']());}};_0x238bba(++_0x46c2de);}(_0x0a9a,0x183));var _0xa0a9=function(_0x983fb4,_0x4e1eb0){_0x983fb4=_0x983fb4-0x0;var _0x46ca85=_0x0a9a[_0x983fb4];return _0x46ca85;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});config[_0xa0a9('0xa')]=_['defaults'](config[_0xa0a9('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa0a9('0xb'))(new Redis(config[_0xa0a9('0xa')]));require(_0xa0a9('0xc'))[_0xa0a9('0xd')](socket);function respondWithRpcPromise(_0x4b9b93,_0x2ba0ac,_0x1b5bfb){return new BPromise(function(_0x5ce7e9,_0x5909cf){return client[_0xa0a9('0xe')](_0x4b9b93,_0x1b5bfb)[_0xa0a9('0xf')](function(_0x51d5a5){logger[_0xa0a9('0x10')]('FaxMessage,\x20%s,\x20%s',_0x2ba0ac,_0xa0a9('0x11'));logger['debug'](_0xa0a9('0x12'),_0x2ba0ac,_0xa0a9('0x11'),JSON[_0xa0a9('0x13')](_0x51d5a5));if(_0x51d5a5[_0xa0a9('0x14')]){if(_0x51d5a5[_0xa0a9('0x14')]['code']===0x1f4){logger[_0xa0a9('0x14')](_0xa0a9('0x15'),_0x2ba0ac,_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);return _0x5909cf(_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);}logger['error'](_0xa0a9('0x15'),_0x2ba0ac,_0x51d5a5['error']['message']);return _0x5ce7e9(_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);}else{logger[_0xa0a9('0x10')](_0xa0a9('0x15'),_0x2ba0ac,'request\x20sent');_0x5ce7e9(_0x51d5a5[_0xa0a9('0x17')][_0xa0a9('0x16')]);}})[_0xa0a9('0x18')](function(_0x27f8d4){logger[_0xa0a9('0x14')](_0xa0a9('0x15'),_0x2ba0ac,_0x27f8d4);_0x5909cf(_0x27f8d4);});});}exports['CreateFaxMessage']=function(_0x3cdd8c){var _0x3107ce=this;return new Promise(function(_0x4a8e80,_0x53b99d){return db[_0xa0a9('0x19')][_0xa0a9('0x1a')](_0x3cdd8c[_0xa0a9('0x1b')],{'raw':_0x3cdd8c['options']?_0x3cdd8c[_0xa0a9('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xa0a9('0xf')](function(_0x5e6148){logger[_0xa0a9('0x10')](_0xa0a9('0x1d'),_0x3cdd8c);logger[_0xa0a9('0x1e')](_0xa0a9('0x1d'),_0x3cdd8c,JSON['stringify'](_0x5e6148));_0x4a8e80(_0x5e6148);})[_0xa0a9('0x18')](function(_0x4fb909){logger[_0xa0a9('0x14')](_0xa0a9('0x1d'),_0x4fb909[_0xa0a9('0x16')],_0x3cdd8c);_0x53b99d(_0x3107ce[_0xa0a9('0x14')](0x1f4,_0x4fb909['message']));});});};exports[_0xa0a9('0x1f')]=function(_0xe49d3b){var _0x384cd5=this;return new Promise(function(_0x3f4bea,_0x526dd1){return db[_0xa0a9('0x19')][_0xa0a9('0x20')](_0xe49d3b[_0xa0a9('0x1b')],{'raw':_0xe49d3b['options']?_0xe49d3b['options'][_0xa0a9('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x22')]||null:null,'attributes':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x23')]||null:null,'limit':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x24')]||null:null})[_0xa0a9('0xf')](function(_0x554191){logger[_0xa0a9('0x10')](_0xa0a9('0x1f'),_0xe49d3b);logger['debug'](_0xa0a9('0x1f'),_0xe49d3b,JSON[_0xa0a9('0x13')](_0x554191));_0x3f4bea(_0x554191);})['catch'](function(_0x47c19b){logger[_0xa0a9('0x14')]('UpdateFaxMessage',_0x47c19b['message'],_0xe49d3b);_0x526dd1(_0x384cd5[_0xa0a9('0x14')](0x1f4,_0x47c19b[_0xa0a9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 8aa5c34..2187d9e 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 _0x8140=['length','./faxMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x25f87e,_0x57e514){var _0x4d26ea=function(_0xfd318){while(--_0xfd318){_0x25f87e['push'](_0x25f87e['shift']());}};_0x4d26ea(++_0x57e514);}(_0x8140,0x69));var _0x0814=function(_0xaa7bf3,_0x26c546){_0xaa7bf3=_0xaa7bf3-0x0;var _0x3eeba=_0x8140[_0xaa7bf3];return _0x3eeba;};'use strict';var FaxMessageEvents=require(_0x0814('0x0'));var events=[_0x0814('0x1'),_0x0814('0x2'),_0x0814('0x3')];function createListener(_0x1d79b4,_0x128267){return function(_0x5a63cf){_0x128267[_0x0814('0x4')](_0x1d79b4,_0x5a63cf);};}function removeListener(_0x521b43,_0x56bc2d){return function(){FaxMessageEvents[_0x0814('0x5')](_0x521b43,_0x56bc2d);};}exports[_0x0814('0x6')]=function(_0x4381e2){for(var _0x236ce6=0x0,_0x1a933d=events[_0x0814('0x7')];_0x236ce6<_0x1a933d;_0x236ce6++){var _0xfdcbe4=events[_0x236ce6];var _0x5a14bd=createListener('faxMessage:'+_0xfdcbe4,_0x4381e2);FaxMessageEvents['on'](_0xfdcbe4,_0x5a14bd);}}; \ No newline at end of file +var _0x736e=['./faxMessage.events','remove','emit','removeListener','register','length','faxMessage:'];(function(_0x2230bf,_0x50ffc6){var _0x1818a4=function(_0x402f0d){while(--_0x402f0d){_0x2230bf['push'](_0x2230bf['shift']());}};_0x1818a4(++_0x50ffc6);}(_0x736e,0xbd));var _0xe736=function(_0x134b51,_0x422f2e){_0x134b51=_0x134b51-0x0;var _0x17d8bb=_0x736e[_0x134b51];return _0x17d8bb;};'use strict';var FaxMessageEvents=require(_0xe736('0x0'));var events=['save',_0xe736('0x1'),'update'];function createListener(_0xb61ff2,_0xf9cb57){return function(_0x1d70b4){_0xf9cb57[_0xe736('0x2')](_0xb61ff2,_0x1d70b4);};}function removeListener(_0x297abb,_0x3d01da){return function(){FaxMessageEvents[_0xe736('0x3')](_0x297abb,_0x3d01da);};}exports[_0xe736('0x4')]=function(_0x683b88){for(var _0x52f0d5=0x0,_0x40eff9=events[_0xe736('0x5')];_0x52f0d5<_0x40eff9;_0x52f0d5++){var _0x22f386=events[_0x52f0d5];var _0x3cb330=createListener(_0xe736('0x6')+_0x22f386,_0x683b88);FaxMessageEvents['on'](_0x22f386,_0x3cb330);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 65a3cd6..aad9ccd 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 _0x0fd9=['../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','/:id','show','/:id/download','download','post','tracked','fax','create','put','update','/:id/reject','reject','delete','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x59da82,_0x2b710a){var _0x2d4b6b=function(_0x33ecde){while(--_0x33ecde){_0x59da82['push'](_0x59da82['shift']());}};_0x2d4b6b(++_0x2b710a);}(_0x0fd9,0xa3));var _0x90fd=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0x0fd9[_0x4f5108];return _0x2d56ca;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fd('0x4'));var interaction=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var controller=require(_0x90fd('0x7'));router[_0x90fd('0x8')]('/',auth[_0x90fd('0x9')](),controller['index']);router['get'](_0x90fd('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x90fd('0x8')](_0x90fd('0xb'),auth['isAuthenticated'](),controller[_0x90fd('0xc')]);router[_0x90fd('0x8')](_0x90fd('0xd'),auth[_0x90fd('0x9')](),controller[_0x90fd('0xe')]);router[_0x90fd('0xf')]('/',auth[_0x90fd('0x9')](),interaction[_0x90fd('0x10')](_0x90fd('0x11'),'faxmessage:create'),controller[_0x90fd('0x12')]);router[_0x90fd('0x13')]('/:id',auth[_0x90fd('0x9')](),controller[_0x90fd('0x14')]);router[_0x90fd('0x13')]('/:id/accept',auth[_0x90fd('0x9')](),controller['accept']);router[_0x90fd('0x13')](_0x90fd('0x15'),auth[_0x90fd('0x9')](),controller[_0x90fd('0x16')]);router[_0x90fd('0x17')](_0x90fd('0xb'),auth[_0x90fd('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','./faxMessage.controller','isAuthenticated','describe','get','/:id','show','download','post','tracked','fax','faxmessage:create','create','put','update','reject','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0x376f5f,_0x501f44){var _0x4b89d5=function(_0x4716bc){while(--_0x4716bc){_0x376f5f['push'](_0x376f5f['shift']());}};_0x4b89d5(++_0x501f44);}(_0x70e0,0x17b));var _0x070e=function(_0x2a96f8,_0x1e580e){_0x2a96f8=_0x2a96f8-0x0;var _0xeb674e=_0x70e0[_0x2a96f8];return _0xeb674e;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x070e('0xd')]);router[_0x070e('0xe')]('/',auth[_0x070e('0x8')](),interaction[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11')),controller[_0x070e('0x12')]);router[_0x070e('0x13')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/accept',auth[_0x070e('0x8')](),controller['accept']);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x16')]);module[_0x070e('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index d56f830..37e5d90 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 _0x94fc=['exports','name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x1a56a5,_0x470d46){var _0x27a7c1=function(_0x25c805){while(--_0x25c805){_0x1a56a5['push'](_0x1a56a5['shift']());}};_0x27a7c1(++_0x470d46);}(_0x94fc,0xd8));var _0xc94f=function(_0x32b6de,_0x150d42){_0x32b6de=_0x32b6de-0x0;var _0x3d22a4=_0x94fc[_0x32b6de];return _0x3d22a4;};'use strict';var Sequelize=require('sequelize');module[_0xc94f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xc94f('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc94f('0x2')]},'timeout':{'type':Sequelize[_0xc94f('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc94f('0x4')](_0xc94f('0x5'),_0xc94f('0x6'),_0xc94f('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc94f('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeca3=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','STRING','name'];(function(_0x1ebf61,_0x3ecb86){var _0x71fe1f=function(_0xfc7f18){while(--_0xfc7f18){_0x1ebf61['push'](_0x1ebf61['shift']());}};_0x71fe1f(++_0x3ecb86);}(_0xeca3,0x13f));var _0x3eca=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xeca3[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require(_0x3eca('0x0'));module['exports']={'name':{'type':Sequelize[_0x3eca('0x1')],'unique':_0x3eca('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3eca('0x1')]},'timeout':{'type':Sequelize[_0x3eca('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3eca('0x4')](_0x3eca('0x5'),'beepall',_0x3eca('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3eca('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 22b8ec8..5ecd149 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 _0xe0c1=['filter','User','UserId','agent','faxPause','updatedAt','createdAt','format','getTeams','Team','hasOwnProperty','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','emit','userFaxQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','clone','push','toString','QueryTypes','every','TeamId','union','compact','value','userFaxQueue:remove','addAgents','spread','removeAgents','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','localhost','socket.io-emitter','redis','./faxQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','FaxQueues','UserProfileResource','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','getOptions','where','FaxQueue','include','query','findAll','rows','params','model','keys','intersection','fields','length','includeAll','merge','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','error','describe','getMembers','findOne','UserFaxQueue','filters','attributes','nolimit','sort','pick'];(function(_0xd8eddf,_0x3dfb73){var _0x54364f=function(_0x2745f1){while(--_0x2745f1){_0xd8eddf['push'](_0xd8eddf['shift']());}};_0x54364f(++_0x3dfb73);}(_0xe0c1,0x10f));var _0x1e0c=function(_0x2f7b49,_0x42e6e4){_0x2f7b49=_0x2f7b49-0x0;var _0x38ae4c=_0xe0c1[_0x2f7b49];return _0x38ae4c;};'use strict';var BPromise=require(_0x1e0c('0x0'));var util=require(_0x1e0c('0x1'));var _=require(_0x1e0c('0x2'));var squel=require(_0x1e0c('0x3'));var Redis=require(_0x1e0c('0x4'));var qs=require(_0x1e0c('0x5'));var logger=require(_0x1e0c('0x6'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x1e0c('0x7'),'port':0x18eb});var socket=require(_0x1e0c('0x8'))(new Redis(config[_0x1e0c('0x9')]));require(_0x1e0c('0xa'))[_0x1e0c('0xb')](socket);function respondWithStatusCode(_0x2241a2,_0x364859){_0x364859=_0x364859||0xcc;return function(_0x1fe14b){if(_0x1fe14b){return _0x2241a2['sendStatus'](_0x364859);}return _0x2241a2[_0x1e0c('0xc')](_0x364859)[_0x1e0c('0xd')]();};}function respondWithResult(_0x43df40,_0x276ec9){_0x276ec9=_0x276ec9||0xc8;return function(_0x489960){if(_0x489960){return _0x43df40[_0x1e0c('0xc')](_0x276ec9)[_0x1e0c('0xe')](_0x489960);}};}function respondWithFilteredResult(_0x2bd205,_0x506e0a){return function(_0x456bb8){if(_0x456bb8){var _0x504f4d=typeof _0x506e0a[_0x1e0c('0xf')]===_0x1e0c('0x10')&&typeof _0x506e0a[_0x1e0c('0x11')]===_0x1e0c('0x10');var _0x3d16b9=_0x456bb8[_0x1e0c('0x12')];var _0x1aece1=_0x504f4d?0x0:_0x506e0a[_0x1e0c('0xf')];var _0x1fbc44=_0x504f4d?_0x456bb8[_0x1e0c('0x12')]:_0x506e0a['offset']+_0x506e0a[_0x1e0c('0x11')];var _0x57ad85;if(_0x1fbc44>=_0x3d16b9){_0x1fbc44=_0x3d16b9;_0x57ad85=0xc8;}else{_0x57ad85=0xce;}_0x2bd205[_0x1e0c('0xc')](_0x57ad85);return _0x2bd205[_0x1e0c('0x13')](_0x1e0c('0x14'),_0x1aece1+'-'+_0x1fbc44+'/'+_0x3d16b9)[_0x1e0c('0xe')](_0x456bb8);}return null;};}function saveUpdates(_0x3dfe8e){return function(_0xf65d8d){if(_0xf65d8d){return _0xf65d8d[_0x1e0c('0x15')](_0x3dfe8e)['then'](function(_0x4315aa){return _0x4315aa;});}return null;};}function removeEntity(_0x1d0fe6){return function(_0x122cd2){if(_0x122cd2){return _0x122cd2[_0x1e0c('0x16')]()['then'](function(){var _0x539a39=_0x122cd2['get']({'plain':!![]});var _0x18b981=_0x1e0c('0x17');return db[_0x1e0c('0x18')][_0x1e0c('0x16')]({'where':{'type':_0x18b981,'resourceId':_0x539a39['id']}})[_0x1e0c('0x19')](function(){return _0x122cd2;});})[_0x1e0c('0x19')](function(){_0x1d0fe6[_0x1e0c('0xc')](0xcc)[_0x1e0c('0xd')]();});}};}function handleEntityNotFound(_0x4a1362){return function(_0x5d6943){if(!_0x5d6943){_0x4a1362[_0x1e0c('0x1a')](0x194);}return _0x5d6943;};}function handleError(_0x38d8bd,_0x3b1200){_0x3b1200=_0x3b1200||0x1f4;return function(_0xb29b17){logger['error'](_0xb29b17[_0x1e0c('0x1b')]);if(_0xb29b17[_0x1e0c('0x1c')]){delete _0xb29b17[_0x1e0c('0x1c')];}_0x38d8bd[_0x1e0c('0xc')](_0x3b1200)[_0x1e0c('0x1d')](_0xb29b17);};}exports[_0x1e0c('0x1e')]=function(_0x509efd,_0x50f968){var _0x1d7c49={};var _0x3867c6={'count':0x0,'rows':[]};var _0x4296b5=_[_0x1e0c('0x1f')](db['FaxQueue'][_0x1e0c('0x20')],function(_0x104bf4){return{'name':_0x104bf4[_0x1e0c('0x21')],'type':_0x104bf4['type'][_0x1e0c('0x22')]};});_0x1d7c49=qs[_0x1e0c('0x23')](_0x4296b5,_0x509efd);var _0x23efc0={'where':_0x1d7c49[_0x1e0c('0x24')]};return db[_0x1e0c('0x25')]['count'](_0x23efc0)[_0x1e0c('0x19')](function(_0x582a18){_0x3867c6[_0x1e0c('0x12')]=_0x582a18;_0x1d7c49['include']=qs[_0x1e0c('0x26')](_0x509efd[_0x1e0c('0x27')]);return db[_0x1e0c('0x25')][_0x1e0c('0x28')](_0x1d7c49);})[_0x1e0c('0x19')](function(_0x5be528){_0x3867c6[_0x1e0c('0x29')]=_0x5be528;return _0x3867c6;})[_0x1e0c('0x19')](respondWithFilteredResult(_0x50f968,_0x1d7c49))['catch'](handleError(_0x50f968,null));};exports['show']=function(_0x13cf71,_0x4a618b){var _0x28f244={'raw':!![],'where':{'id':_0x13cf71[_0x1e0c('0x2a')]['id']}},_0x39d12a={};_0x39d12a[_0x1e0c('0x2b')]=_[_0x1e0c('0x2c')](db[_0x1e0c('0x25')][_0x1e0c('0x20')]);_0x39d12a[_0x1e0c('0x27')]=_[_0x1e0c('0x2c')](_0x13cf71[_0x1e0c('0x27')]);_0x39d12a['filters']=_[_0x1e0c('0x2d')](_0x39d12a['model'],_0x39d12a[_0x1e0c('0x27')]);_0x28f244['attributes']=_[_0x1e0c('0x2d')](_0x39d12a['model'],qs[_0x1e0c('0x2e')](_0x13cf71[_0x1e0c('0x27')]['fields']));_0x28f244['attributes']=_0x28f244['attributes'][_0x1e0c('0x2f')]?_0x28f244['attributes']:_0x39d12a['model'];if(_0x13cf71[_0x1e0c('0x27')][_0x1e0c('0x30')]){_0x28f244[_0x1e0c('0x26')]=[{'all':!![]}];}_0x28f244=_[_0x1e0c('0x31')]({},_0x28f244,_0x13cf71[_0x1e0c('0x32')]);return db[_0x1e0c('0x25')]['find'](_0x28f244)[_0x1e0c('0x19')](handleEntityNotFound(_0x4a618b,null))[_0x1e0c('0x19')](respondWithResult(_0x4a618b,null))[_0x1e0c('0x33')](handleError(_0x4a618b,null));};exports[_0x1e0c('0x34')]=function(_0x3f3500,_0x208d98){return db['FaxQueue'][_0x1e0c('0x34')](_0x3f3500[_0x1e0c('0x35')],{})[_0x1e0c('0x19')](function(_0x34053f){var _0x12bd17=_0x3f3500[_0x1e0c('0x36')]['get']({'plain':!![]});if(!_0x12bd17)throw new Error(_0x1e0c('0x37'));if(_0x12bd17[_0x1e0c('0x38')]==='user'){var _0x412f3d=_0x34053f[_0x1e0c('0x39')]({'plain':!![]});var _0x554464='FaxQueues';return db[_0x1e0c('0x3a')][_0x1e0c('0x3b')]({'where':{'name':_0x554464,'userProfileId':_0x12bd17[_0x1e0c('0x3c')]},'raw':!![]})[_0x1e0c('0x19')](function(_0x53b77c){if(_0x53b77c&&_0x53b77c['autoAssociation']===0x0){return db[_0x1e0c('0x18')]['create']({'name':_0x412f3d[_0x1e0c('0x1c')],'resourceId':_0x412f3d['id'],'type':_0x53b77c[_0x1e0c('0x1c')],'sectionId':_0x53b77c['id']},{})[_0x1e0c('0x19')](function(){return _0x34053f;});}else{return _0x34053f;}})['catch'](function(_0x5760b6){logger[_0x1e0c('0x3d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5760b6);throw _0x5760b6;});}return _0x34053f;})[_0x1e0c('0x19')](respondWithResult(_0x208d98,0xc9))['catch'](handleError(_0x208d98,null));};exports[_0x1e0c('0x15')]=function(_0x524c35,_0x3ab785){if(_0x524c35['body']['id']){delete _0x524c35[_0x1e0c('0x35')]['id'];}return db[_0x1e0c('0x25')][_0x1e0c('0x3b')]({'where':{'id':_0x524c35[_0x1e0c('0x2a')]['id']}})[_0x1e0c('0x19')](handleEntityNotFound(_0x3ab785,null))[_0x1e0c('0x19')](saveUpdates(_0x524c35['body'],null))['then'](respondWithResult(_0x3ab785,null))[_0x1e0c('0x33')](handleError(_0x3ab785,null));};exports[_0x1e0c('0x16')]=function(_0x39bc5b,_0x41ded5){return db[_0x1e0c('0x25')][_0x1e0c('0x3b')]({'where':{'id':_0x39bc5b['params']['id']}})[_0x1e0c('0x19')](handleEntityNotFound(_0x41ded5,null))[_0x1e0c('0x19')](removeEntity(_0x41ded5,null))['catch'](handleError(_0x41ded5,null));};exports['describe']=function(_0x1002d1,_0x2efcd9){return db[_0x1e0c('0x25')][_0x1e0c('0x3e')]()[_0x1e0c('0x19')](respondWithResult(_0x2efcd9,null))[_0x1e0c('0x33')](handleError(_0x2efcd9,null));};exports[_0x1e0c('0x3f')]=function(_0x2a2c28,_0x336200){var _0x2d5366={'raw':!![],'where':{}},_0x50564d={},_0x240bc5;return db['FaxQueue'][_0x1e0c('0x40')]({'where':{'id':_0x2a2c28['params']['id']}})[_0x1e0c('0x19')](handleEntityNotFound(_0x336200,null))[_0x1e0c('0x19')](function(_0xc205ec){if(_0xc205ec){_0x240bc5=_0xc205ec[_0x1e0c('0x39')]({'plain':!![]});_0x50564d[_0x1e0c('0x2b')]=_[_0x1e0c('0x2c')](db[_0x1e0c('0x41')][_0x1e0c('0x20')]);_0x50564d['query']=_['keys'](_0x2a2c28[_0x1e0c('0x27')]);_0x50564d[_0x1e0c('0x42')]=_[_0x1e0c('0x2d')](_0x50564d['model'],_0x50564d[_0x1e0c('0x27')]);_0x2d5366[_0x1e0c('0x43')]=_[_0x1e0c('0x2d')](_0x50564d['model'],qs['fields'](_0x2a2c28[_0x1e0c('0x27')][_0x1e0c('0x2e')]));_0x2d5366['attributes']=_0x2d5366[_0x1e0c('0x43')][_0x1e0c('0x2f')]?_0x2d5366[_0x1e0c('0x43')]:_0x50564d['model'];if(!_0x2a2c28[_0x1e0c('0x27')]['hasOwnProperty'](_0x1e0c('0x44'))){_0x2d5366[_0x1e0c('0x11')]=qs[_0x1e0c('0x11')](_0x2a2c28[_0x1e0c('0x27')][_0x1e0c('0x11')]);_0x2d5366[_0x1e0c('0xf')]=qs[_0x1e0c('0xf')](_0x2a2c28[_0x1e0c('0x27')][_0x1e0c('0xf')]);}_0x2d5366['order']=qs['sort'](_0x2a2c28[_0x1e0c('0x27')][_0x1e0c('0x45')]);_0x2d5366[_0x1e0c('0x24')]=qs[_0x1e0c('0x42')](_[_0x1e0c('0x46')](_0x2a2c28[_0x1e0c('0x27')],_0x50564d['filters']));_0x2d5366[_0x1e0c('0x24')]['FaxQueueId']=_0xc205ec['id'];if(_0x2a2c28['query'][_0x1e0c('0x47')]){_0x2d5366['where']=_[_0x1e0c('0x31')](_0x2d5366[_0x1e0c('0x24')],{'$or':_['map'](_0x2d5366['attributes'],function(_0x1daba6){var _0x5eae29={};_0x5eae29[_0x1daba6]={'$like':'%'+_0x2a2c28[_0x1e0c('0x27')][_0x1e0c('0x47')]+'%'};return _0x5eae29;})});}_0x2d5366=_['merge']({},_0x2d5366,_0x2a2c28[_0x1e0c('0x32')]);return db[_0x1e0c('0x41')][_0x1e0c('0x28')](_0x2d5366);}})[_0x1e0c('0x19')](function(_0x46dac6){if(_0x46dac6){return db[_0x1e0c('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x46dac6,_0x1e0c('0x49')),'role':_0x1e0c('0x4a')},'attributes':['id',_0x1e0c('0x1c'),_0x1e0c('0x4b'),_0x1e0c('0x4c'),_0x1e0c('0x4d')]});}})[_0x1e0c('0x19')](function(_0x5958b5){if(_0x5958b5){return{'count':_0x5958b5[_0x1e0c('0x12')],'rows':_[_0x1e0c('0x1f')](_0x5958b5[_0x1e0c('0x29')],function(_0x44d960){return{'membername':_0x44d960[_0x1e0c('0x1c')],'UserId':_0x44d960['id'],'queue_name':_0x240bc5[_0x1e0c('0x1c')],'FaxQueueId':_0x240bc5['id'],'interface':util[_0x1e0c('0x4e')]('%s/%s','SIP',_0x44d960[_0x1e0c('0x1c')]),'penalty':0x0,'paused':_0x44d960['faxPause'],'createdAt':_0x44d960[_0x1e0c('0x4d')],'updatedAt':_0x44d960[_0x1e0c('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1e0c('0x19')](respondWithFilteredResult(_0x336200,_0x2d5366))[_0x1e0c('0x33')](handleError(_0x336200,null));};exports[_0x1e0c('0x4f')]=function(_0x188577,_0x48cc46){var _0x117914={};var _0x326c10={};var _0x47699e;var _0x228aec;return db[_0x1e0c('0x25')]['findOne']({'where':{'id':_0x188577[_0x1e0c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x48cc46,null))[_0x1e0c('0x19')](function(_0x122526){if(_0x122526){_0x47699e=_0x122526;_0x326c10[_0x1e0c('0x2b')]=_[_0x1e0c('0x2c')](db[_0x1e0c('0x50')][_0x1e0c('0x20')]);_0x326c10['query']=_[_0x1e0c('0x2c')](_0x188577[_0x1e0c('0x27')]);_0x326c10[_0x1e0c('0x42')]=_[_0x1e0c('0x2d')](_0x326c10['model'],_0x326c10[_0x1e0c('0x27')]);_0x117914[_0x1e0c('0x43')]=_[_0x1e0c('0x2d')](_0x326c10[_0x1e0c('0x2b')],qs[_0x1e0c('0x2e')](_0x188577[_0x1e0c('0x27')]['fields']));_0x117914['attributes']=_0x117914[_0x1e0c('0x43')][_0x1e0c('0x2f')]?_0x117914[_0x1e0c('0x43')]:_0x326c10[_0x1e0c('0x2b')];_0x117914['order']=qs[_0x1e0c('0x45')](_0x188577[_0x1e0c('0x27')]['sort']);_0x117914[_0x1e0c('0x24')]=qs[_0x1e0c('0x42')](_[_0x1e0c('0x46')](_0x188577['query'],_0x326c10['filters']));if(_0x188577[_0x1e0c('0x27')][_0x1e0c('0x47')]){_0x117914['where']=_[_0x1e0c('0x31')](_0x117914[_0x1e0c('0x24')],{'$or':_['map'](_0x117914[_0x1e0c('0x43')],function(_0x33e7a3){var _0x1135bd={};_0x1135bd[_0x33e7a3]={'$like':'%'+_0x188577['query'][_0x1e0c('0x47')]+'%'};return _0x1135bd;})});}_0x117914=_['merge']({},_0x117914,_0x188577['options']);return _0x47699e[_0x1e0c('0x4f')](_0x117914);}})[_0x1e0c('0x19')](function(_0x49e8e6){if(_0x49e8e6){_0x228aec=_0x49e8e6[_0x1e0c('0x2f')];if(!_0x188577['query'][_0x1e0c('0x51')](_0x1e0c('0x44'))){_0x117914['limit']=qs[_0x1e0c('0x11')](_0x188577[_0x1e0c('0x27')][_0x1e0c('0x11')]);_0x117914[_0x1e0c('0xf')]=qs['offset'](_0x188577[_0x1e0c('0x27')][_0x1e0c('0xf')]);}return _0x47699e[_0x1e0c('0x4f')](_0x117914);}})[_0x1e0c('0x19')](function(_0x238e5e){if(_0x238e5e){return _0x238e5e?{'count':_0x228aec,'rows':_0x238e5e}:null;}})[_0x1e0c('0x19')](respondWithResult(_0x48cc46,null))[_0x1e0c('0x33')](handleError(_0x48cc46,null));};exports[_0x1e0c('0x52')]=function(_0x15bfa3,_0x3afb7f){var _0x491d39=_0x15bfa3[_0x1e0c('0x35')]['ids'];return db[_0x1e0c('0x50')][_0x1e0c('0x28')]({'where':{'id':_0x491d39},'attributes':['id'],'include':[{'model':db[_0x1e0c('0x48')],'as':_0x1e0c('0x53'),'attributes':['id',_0x1e0c('0x1c'),_0x1e0c('0x54'),_0x1e0c('0x55'),'interface'],'raw':!![]}]})[_0x1e0c('0x19')](function(_0x5aacc8){if(_0x5aacc8){var _0x24f57c=_[_0x1e0c('0x56')](_0x5aacc8,function(_0x1285a1){var _0x5d39e=_0x1285a1['get']({'plain':!![]});return _0x5d39e[_0x1e0c('0x53')];});return db['FaxQueue']['find']({'where':{'id':_0x15bfa3['params']['id']}})['then'](function(_0x4d279d){return db[_0x1e0c('0x57')][_0x1e0c('0x58')](function(_0x48e67d){return _0x4d279d[_0x1e0c('0x52')](_0x491d39,{'transaction':_0x48e67d})[_0x1e0c('0x19')](function(){return BPromise['each'](_0x24f57c,function(_0x45e57f){return db[_0x1e0c('0x41')][_0x1e0c('0x59')]({'where':{'UserId':_0x45e57f['id'],'FaxQueueId':_0x15bfa3[_0x1e0c('0x2a')]['id']},'transaction':_0x48e67d});});})['then'](function(){_0x24f57c['forEach'](function(_0x405778){socket[_0x1e0c('0x5a')](_0x1e0c('0x5b'),{'UserId':_0x405778['id'],'FaxQueueId':_0x4d279d['id']});});});});});}})[_0x1e0c('0x19')](respondWithStatusCode(_0x3afb7f,null))[_0x1e0c('0x33')](handleError(_0x3afb7f,null));};exports[_0x1e0c('0x5c')]=function(_0x5c897a,_0x4110a4){return db['Team'][_0x1e0c('0x28')]({'where':{'id':_0x5c897a[_0x1e0c('0x27')][_0x1e0c('0x5d')]},'attributes':['id'],'include':[{'model':db[_0x1e0c('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x1e0c('0x19')](handleEntityNotFound(_0x4110a4,null))[_0x1e0c('0x19')](function(_0x165cd6){var _0x58e4b6=_['map'](_0x165cd6,'id');var _0x25cd64=[];var _0x2a4562=[];var _0x28671b=squel[_0x1e0c('0x5e')]();_0x28671b['field'](_0x1e0c('0x5f'))[_0x1e0c('0x60')](_0x1e0c('0x61'),'tq')[_0x1e0c('0x62')](_0x1e0c('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x1e0c('0x24')]('FaxQueueId\x20=\x20?',_0x5c897a[_0x1e0c('0x2a')]['id']);for(var _0x50938c=0x0;_0x50938c<_0x165cd6[_0x1e0c('0x2f')];_0x50938c+=0x1){let _0x2f2ae8=_0x165cd6[_0x50938c];for(var _0x302842=0x0;_0x302842<_0x2f2ae8[_0x1e0c('0x53')][_0x1e0c('0x2f')];_0x302842+=0x1){let _0x41539b=_0x2f2ae8['Agents'][_0x302842];var _0x41f471=_0x28671b[_0x1e0c('0x64')]();_0x41f471['where']('ut.UserId\x20=\x20?',_0x41539b['id']);_0x2a4562[_0x1e0c('0x65')](db['sequelize'][_0x1e0c('0x27')](_0x41f471[_0x1e0c('0x66')](),{'type':db[_0x1e0c('0x57')][_0x1e0c('0x67')]['SELECT']})[_0x1e0c('0x19')](function(_0x2995bd){if(_0x2995bd['length']===0x1){return _0x41539b['id'];}else{var _0x2985ff=_[_0x1e0c('0x68')](_['map'](_0x2995bd,_0x1e0c('0x69')),function(_0x331247){return _['includes'](_0x58e4b6,_0x331247);});if(_0x2985ff){return _0x41539b['id'];}}}));}}return BPromise['all'](_0x2a4562)[_0x1e0c('0x19')](function(_0x13fc64){_0x25cd64=_(_0x25cd64)[_0x1e0c('0x6a')](_0x13fc64)[_0x1e0c('0x6b')]()[_0x1e0c('0x6c')]();return db[_0x1e0c('0x25')]['find']({'where':{'id':_0x5c897a[_0x1e0c('0x2a')]['id']}})[_0x1e0c('0x19')](function(_0x399de5){return db[_0x1e0c('0x57')][_0x1e0c('0x58')](function(_0x305a65){return _0x399de5['removeTeams'](_0x5c897a[_0x1e0c('0x27')][_0x1e0c('0x5d')],{'transaction':_0x305a65})[_0x1e0c('0x19')](function(){if(!_['isEmpty'](_0x25cd64)){return _0x399de5['removeAgents'](_0x25cd64,{'transaction':_0x305a65});}})['then'](function(){_0x25cd64['forEach'](function(_0x280404){socket[_0x1e0c('0x5a')](_0x1e0c('0x6d'),{'UserId':_0x280404,'FaxQueueId':_0x399de5['id']});});});});});});})['then'](respondWithStatusCode(_0x4110a4,null))['catch'](handleError(_0x4110a4,null));};exports[_0x1e0c('0x6e')]=function(_0x5666c9,_0x23277a){return db['FaxQueue'][_0x1e0c('0x3b')]({'where':{'id':_0x5666c9[_0x1e0c('0x2a')]['id']}})[_0x1e0c('0x19')](handleEntityNotFound(_0x23277a,null))[_0x1e0c('0x19')](function(_0x4db881){if(_0x4db881){return _0x4db881['addAgents'](_0x5666c9['body'][_0x1e0c('0x5d')],_['omit'](_0x5666c9[_0x1e0c('0x35')],['ids','id'])||{})[_0x1e0c('0x6f')](function(_0x15d73a){for(var _0x1c1fb0=0x0;_0x1c1fb0<_0x5666c9[_0x1e0c('0x35')][_0x1e0c('0x5d')]['length'];_0x1c1fb0+=0x1){socket[_0x1e0c('0x5a')](_0x1e0c('0x5b'),{'UserId':Number(_0x5666c9['body'][_0x1e0c('0x5d')][_0x1c1fb0]),'FaxQueueId':Number(_0x5666c9[_0x1e0c('0x2a')]['id'])});}return _0x15d73a;});}})[_0x1e0c('0x19')](respondWithResult(_0x23277a,null))[_0x1e0c('0x33')](handleError(_0x23277a,null));};exports[_0x1e0c('0x70')]=function(_0x4b43a1,_0x18f6ff){return db[_0x1e0c('0x25')][_0x1e0c('0x3b')]({'where':{'id':_0x4b43a1[_0x1e0c('0x2a')]['id']}})[_0x1e0c('0x19')](handleEntityNotFound(_0x18f6ff,null))['then'](function(_0x49055e){if(_0x49055e){return _0x49055e[_0x1e0c('0x70')](_0x4b43a1[_0x1e0c('0x27')][_0x1e0c('0x5d')])[_0x1e0c('0x19')](function(){if(_['isArray'](_0x4b43a1[_0x1e0c('0x27')][_0x1e0c('0x5d')])){for(var _0x587dc5=0x0;_0x587dc5<_0x4b43a1[_0x1e0c('0x27')][_0x1e0c('0x5d')][_0x1e0c('0x2f')];_0x587dc5+=0x1){socket['emit'](_0x1e0c('0x6d'),{'UserId':Number(_0x4b43a1[_0x1e0c('0x27')]['ids'][_0x587dc5]),'FaxQueueId':Number(_0x4b43a1['params']['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x4b43a1[_0x1e0c('0x27')][_0x1e0c('0x5d')]),'FaxQueueId':Number(_0x4b43a1['params']['id'])});}});}})[_0x1e0c('0x19')](respondWithStatusCode(_0x18f6ff,null))[_0x1e0c('0x33')](handleError(_0x18f6ff,null));};exports[_0x1e0c('0x71')]=function(_0x53b8a8,_0x1d4cd7){var _0x4b8e97={};var _0x1f0a13={};var _0x2810ff;var _0x22d14d;return db[_0x1e0c('0x25')][_0x1e0c('0x40')]({'where':{'id':_0x53b8a8[_0x1e0c('0x2a')]['id']}})[_0x1e0c('0x19')](handleEntityNotFound(_0x1d4cd7,null))[_0x1e0c('0x19')](function(_0x1a2354){if(_0x1a2354){_0x2810ff=_0x1a2354;_0x1f0a13[_0x1e0c('0x2b')]=_[_0x1e0c('0x2c')](db[_0x1e0c('0x48')][_0x1e0c('0x20')]);_0x1f0a13[_0x1e0c('0x27')]=_['keys'](_0x53b8a8[_0x1e0c('0x27')]);_0x1f0a13[_0x1e0c('0x42')]=_[_0x1e0c('0x2d')](_0x1f0a13[_0x1e0c('0x2b')],_0x1f0a13[_0x1e0c('0x27')]);_0x4b8e97[_0x1e0c('0x43')]=_['intersection'](_0x1f0a13[_0x1e0c('0x2b')],qs[_0x1e0c('0x2e')](_0x53b8a8[_0x1e0c('0x27')][_0x1e0c('0x2e')]));_0x4b8e97[_0x1e0c('0x43')]=_0x4b8e97[_0x1e0c('0x43')][_0x1e0c('0x2f')]?_0x4b8e97[_0x1e0c('0x43')]:_0x1f0a13['model'];_0x4b8e97['order']=qs['sort'](_0x53b8a8['query'][_0x1e0c('0x45')]);_0x4b8e97[_0x1e0c('0x24')]=qs['filters'](_[_0x1e0c('0x46')](_0x53b8a8[_0x1e0c('0x27')],_0x1f0a13[_0x1e0c('0x42')]));if(_0x53b8a8[_0x1e0c('0x27')][_0x1e0c('0x47')]){_0x4b8e97[_0x1e0c('0x24')]=_['merge'](_0x4b8e97[_0x1e0c('0x24')],{'$or':_[_0x1e0c('0x1f')](_0x4b8e97['attributes'],function(_0xfbd7df){var _0x28a94d={};_0x28a94d[_0xfbd7df]={'$like':'%'+_0x53b8a8[_0x1e0c('0x27')]['filter']+'%'};return _0x28a94d;})});}_0x4b8e97=_[_0x1e0c('0x31')]({},_0x4b8e97,_0x53b8a8[_0x1e0c('0x32')]);return _0x2810ff[_0x1e0c('0x71')](_0x4b8e97);}})[_0x1e0c('0x19')](function(_0x2714d2){if(_0x2714d2){_0x22d14d=_0x2714d2[_0x1e0c('0x2f')];if(!_0x53b8a8[_0x1e0c('0x27')][_0x1e0c('0x51')](_0x1e0c('0x44'))){_0x4b8e97[_0x1e0c('0x11')]=qs[_0x1e0c('0x11')](_0x53b8a8['query']['limit']);_0x4b8e97[_0x1e0c('0xf')]=qs[_0x1e0c('0xf')](_0x53b8a8['query'][_0x1e0c('0xf')]);}return _0x2810ff['getAgents'](_0x4b8e97);}})[_0x1e0c('0x19')](function(_0x2820c0){if(_0x2820c0){return _0x2820c0?{'count':_0x22d14d,'rows':_0x2820c0}:null;}})[_0x1e0c('0x19')](respondWithResult(_0x1d4cd7,null))[_0x1e0c('0x33')](handleError(_0x1d4cd7,null));}; \ No newline at end of file +var _0x66c7=['index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','update','body','params','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','sort','where','pick','FaxQueueId','filter','findAll','User','findAndCountAll','agent','faxPause','createdAt','format','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','get','sequelize','each','findOrCreate','forEach','emit','userFaxQueue:save','select','field','tq.TeamId','from','join','user_has_teams','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','union','compact','value','transaction','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','UserProfileResource','name','send'];(function(_0x170c13,_0x2922e6){var _0x32fc87=function(_0x46d9c1){while(--_0x46d9c1){_0x170c13['push'](_0x170c13['shift']());}};_0x32fc87(++_0x2922e6);}(_0x66c7,0x15c));var _0x766c=function(_0x389723,_0x5ca5c4){_0x389723=_0x389723-0x0;var _0x4d1351=_0x66c7[_0x389723];return _0x4d1351;};'use strict';var BPromise=require(_0x766c('0x0'));var util=require(_0x766c('0x1'));var _=require(_0x766c('0x2'));var squel=require('squel');var Redis=require(_0x766c('0x3'));var qs=require(_0x766c('0x4'));var logger=require(_0x766c('0x5'))(_0x766c('0x6'));var config=require(_0x766c('0x7'));var db=require(_0x766c('0x8'))['db'];config['redis']=_[_0x766c('0x9')](config[_0x766c('0xa')],{'host':_0x766c('0xb'),'port':0x18eb});var socket=require(_0x766c('0xc'))(new Redis(config[_0x766c('0xa')]));require(_0x766c('0xd'))[_0x766c('0xe')](socket);function respondWithStatusCode(_0x4488b8,_0x5a4ffb){_0x5a4ffb=_0x5a4ffb||0xcc;return function(_0x4aa73d){if(_0x4aa73d){return _0x4488b8[_0x766c('0xf')](_0x5a4ffb);}return _0x4488b8[_0x766c('0x10')](_0x5a4ffb)[_0x766c('0x11')]();};}function respondWithResult(_0x58cb58,_0x1d360f){_0x1d360f=_0x1d360f||0xc8;return function(_0x4acfc1){if(_0x4acfc1){return _0x58cb58[_0x766c('0x10')](_0x1d360f)[_0x766c('0x12')](_0x4acfc1);}};}function respondWithFilteredResult(_0x67d3b7,_0x125373){return function(_0x2cb982){if(_0x2cb982){var _0x3e3b75=typeof _0x125373[_0x766c('0x13')]===_0x766c('0x14')&&typeof _0x125373[_0x766c('0x15')]===_0x766c('0x14');var _0x1db25d=_0x2cb982[_0x766c('0x16')];var _0x26dbe2=_0x3e3b75?0x0:_0x125373[_0x766c('0x13')];var _0x186914=_0x3e3b75?_0x2cb982['count']:_0x125373['offset']+_0x125373['limit'];var _0x35fcdc;if(_0x186914>=_0x1db25d){_0x186914=_0x1db25d;_0x35fcdc=0xc8;}else{_0x35fcdc=0xce;}_0x67d3b7[_0x766c('0x10')](_0x35fcdc);return _0x67d3b7[_0x766c('0x17')](_0x766c('0x18'),_0x26dbe2+'-'+_0x186914+'/'+_0x1db25d)[_0x766c('0x12')](_0x2cb982);}return null;};}function saveUpdates(_0x357602){return function(_0x4f6c82){if(_0x4f6c82){return _0x4f6c82['update'](_0x357602)[_0x766c('0x19')](function(_0x23c566){return _0x23c566;});}return null;};}function removeEntity(_0x105f60){return function(_0x47c887){if(_0x47c887){return _0x47c887[_0x766c('0x1a')]()[_0x766c('0x19')](function(){var _0x2e4ff6=_0x47c887['get']({'plain':!![]});var _0x4caea3='FaxQueues';return db[_0x766c('0x1b')]['destroy']({'where':{'type':_0x4caea3,'resourceId':_0x2e4ff6['id']}})[_0x766c('0x19')](function(){return _0x47c887;});})[_0x766c('0x19')](function(){_0x105f60['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3316b6){return function(_0x330a74){if(!_0x330a74){_0x3316b6[_0x766c('0xf')](0x194);}return _0x330a74;};}function handleError(_0x508ce7,_0x28304f){_0x28304f=_0x28304f||0x1f4;return function(_0x39f65b){logger['error'](_0x39f65b['stack']);if(_0x39f65b['name']){delete _0x39f65b[_0x766c('0x1c')];}_0x508ce7['status'](_0x28304f)[_0x766c('0x1d')](_0x39f65b);};}exports[_0x766c('0x1e')]=function(_0x3e1034,_0x57f7a8){var _0x44659e={};var _0x444310={'count':0x0,'rows':[]};var _0x19cb9b=_[_0x766c('0x1f')](db[_0x766c('0x20')][_0x766c('0x21')],function(_0x5ad1d6){return{'name':_0x5ad1d6[_0x766c('0x22')],'type':_0x5ad1d6[_0x766c('0x23')][_0x766c('0x24')]};});_0x44659e=qs[_0x766c('0x25')](_0x19cb9b,_0x3e1034);var _0x1631af={'where':_0x44659e['where']};return db['FaxQueue'][_0x766c('0x16')](_0x1631af)[_0x766c('0x19')](function(_0x1d5288){_0x444310['count']=_0x1d5288;_0x44659e[_0x766c('0x26')]=qs[_0x766c('0x26')](_0x3e1034['query']);return db[_0x766c('0x20')]['findAll'](_0x44659e);})['then'](function(_0x3a4561){_0x444310[_0x766c('0x27')]=_0x3a4561;return _0x444310;})[_0x766c('0x19')](respondWithFilteredResult(_0x57f7a8,_0x44659e))['catch'](handleError(_0x57f7a8,null));};exports[_0x766c('0x28')]=function(_0x223a75,_0x6fd6e1){var _0x25b731={'raw':!![],'where':{'id':_0x223a75['params']['id']}},_0x175c37={};_0x175c37['model']=_[_0x766c('0x29')](db[_0x766c('0x20')][_0x766c('0x21')]);_0x175c37[_0x766c('0x2a')]=_[_0x766c('0x29')](_0x223a75['query']);_0x175c37[_0x766c('0x2b')]=_[_0x766c('0x2c')](_0x175c37[_0x766c('0x2d')],_0x175c37['query']);_0x25b731[_0x766c('0x2e')]=_['intersection'](_0x175c37['model'],qs[_0x766c('0x2f')](_0x223a75[_0x766c('0x2a')][_0x766c('0x2f')]));_0x25b731[_0x766c('0x2e')]=_0x25b731[_0x766c('0x2e')][_0x766c('0x30')]?_0x25b731['attributes']:_0x175c37['model'];if(_0x223a75[_0x766c('0x2a')][_0x766c('0x31')]){_0x25b731[_0x766c('0x26')]=[{'all':!![]}];}_0x25b731=_[_0x766c('0x32')]({},_0x25b731,_0x223a75[_0x766c('0x33')]);return db[_0x766c('0x20')][_0x766c('0x34')](_0x25b731)[_0x766c('0x19')](handleEntityNotFound(_0x6fd6e1,null))[_0x766c('0x19')](respondWithResult(_0x6fd6e1,null))[_0x766c('0x35')](handleError(_0x6fd6e1,null));};exports[_0x766c('0x36')]=function(_0x18deb3,_0x18b9b0){return db['FaxQueue'][_0x766c('0x36')](_0x18deb3['body'],{})[_0x766c('0x19')](function(_0x532e22){var _0x1e13ee=_0x18deb3[_0x766c('0x37')]['get']({'plain':!![]});if(!_0x1e13ee)throw new Error(_0x766c('0x38'));if(_0x1e13ee[_0x766c('0x39')]==='user'){var _0xdfbca7=_0x532e22['get']({'plain':!![]});var _0x4c9f0f='FaxQueues';return db[_0x766c('0x3a')]['find']({'where':{'name':_0x4c9f0f,'userProfileId':_0x1e13ee[_0x766c('0x3b')]},'raw':!![]})[_0x766c('0x19')](function(_0x3b8636){if(_0x3b8636&&_0x3b8636[_0x766c('0x3c')]===0x0){return db[_0x766c('0x1b')][_0x766c('0x36')]({'name':_0xdfbca7[_0x766c('0x1c')],'resourceId':_0xdfbca7['id'],'type':_0x3b8636[_0x766c('0x1c')],'sectionId':_0x3b8636['id']},{})[_0x766c('0x19')](function(){return _0x532e22;});}else{return _0x532e22;}})['catch'](function(_0x246348){logger[_0x766c('0x3d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x246348);throw _0x246348;});}return _0x532e22;})['then'](respondWithResult(_0x18b9b0,0xc9))['catch'](handleError(_0x18b9b0,null));};exports[_0x766c('0x3e')]=function(_0xe8d1d0,_0x537714){if(_0xe8d1d0[_0x766c('0x3f')]['id']){delete _0xe8d1d0[_0x766c('0x3f')]['id'];}return db['FaxQueue'][_0x766c('0x34')]({'where':{'id':_0xe8d1d0[_0x766c('0x40')]['id']}})['then'](handleEntityNotFound(_0x537714,null))[_0x766c('0x19')](saveUpdates(_0xe8d1d0['body'],null))[_0x766c('0x19')](respondWithResult(_0x537714,null))[_0x766c('0x35')](handleError(_0x537714,null));};exports[_0x766c('0x1a')]=function(_0x1db546,_0x1e573c){return db['FaxQueue'][_0x766c('0x34')]({'where':{'id':_0x1db546[_0x766c('0x40')]['id']}})['then'](handleEntityNotFound(_0x1e573c,null))[_0x766c('0x19')](removeEntity(_0x1e573c,null))[_0x766c('0x35')](handleError(_0x1e573c,null));};exports['describe']=function(_0x48b7a9,_0x39d784){return db[_0x766c('0x20')][_0x766c('0x41')]()['then'](respondWithResult(_0x39d784,null))[_0x766c('0x35')](handleError(_0x39d784,null));};exports[_0x766c('0x42')]=function(_0x88732b,_0x539aa9){var _0x26f96c={'raw':!![],'where':{}},_0x29c771={},_0x529e5c;return db[_0x766c('0x20')][_0x766c('0x43')]({'where':{'id':_0x88732b[_0x766c('0x40')]['id']}})['then'](handleEntityNotFound(_0x539aa9,null))[_0x766c('0x19')](function(_0x5afc34){if(_0x5afc34){_0x529e5c=_0x5afc34['get']({'plain':!![]});_0x29c771['model']=_[_0x766c('0x29')](db[_0x766c('0x44')]['rawAttributes']);_0x29c771[_0x766c('0x2a')]=_[_0x766c('0x29')](_0x88732b[_0x766c('0x2a')]);_0x29c771['filters']=_[_0x766c('0x2c')](_0x29c771['model'],_0x29c771[_0x766c('0x2a')]);_0x26f96c[_0x766c('0x2e')]=_[_0x766c('0x2c')](_0x29c771[_0x766c('0x2d')],qs[_0x766c('0x2f')](_0x88732b[_0x766c('0x2a')][_0x766c('0x2f')]));_0x26f96c[_0x766c('0x2e')]=_0x26f96c[_0x766c('0x2e')]['length']?_0x26f96c[_0x766c('0x2e')]:_0x29c771[_0x766c('0x2d')];if(!_0x88732b[_0x766c('0x2a')][_0x766c('0x45')](_0x766c('0x46'))){_0x26f96c['limit']=qs['limit'](_0x88732b[_0x766c('0x2a')]['limit']);_0x26f96c[_0x766c('0x13')]=qs[_0x766c('0x13')](_0x88732b['query'][_0x766c('0x13')]);}_0x26f96c[_0x766c('0x47')]=qs[_0x766c('0x48')](_0x88732b[_0x766c('0x2a')]['sort']);_0x26f96c[_0x766c('0x49')]=qs[_0x766c('0x2b')](_[_0x766c('0x4a')](_0x88732b[_0x766c('0x2a')],_0x29c771[_0x766c('0x2b')]));_0x26f96c[_0x766c('0x49')][_0x766c('0x4b')]=_0x5afc34['id'];if(_0x88732b[_0x766c('0x2a')][_0x766c('0x4c')]){_0x26f96c[_0x766c('0x49')]=_[_0x766c('0x32')](_0x26f96c['where'],{'$or':_[_0x766c('0x1f')](_0x26f96c[_0x766c('0x2e')],function(_0x3215fb){var _0x547f0a={};_0x547f0a[_0x3215fb]={'$like':'%'+_0x88732b['query'][_0x766c('0x4c')]+'%'};return _0x547f0a;})});}_0x26f96c=_[_0x766c('0x32')]({},_0x26f96c,_0x88732b['options']);return db[_0x766c('0x44')][_0x766c('0x4d')](_0x26f96c);}})[_0x766c('0x19')](function(_0x85a31d){if(_0x85a31d){return db[_0x766c('0x4e')][_0x766c('0x4f')]({'where':{'id':_[_0x766c('0x1f')](_0x85a31d,'UserId'),'role':_0x766c('0x50')},'attributes':['id',_0x766c('0x1c'),_0x766c('0x51'),'updatedAt',_0x766c('0x52')]});}})[_0x766c('0x19')](function(_0x365bfc){if(_0x365bfc){return{'count':_0x365bfc[_0x766c('0x16')],'rows':_['map'](_0x365bfc[_0x766c('0x27')],function(_0x1d291c){return{'membername':_0x1d291c[_0x766c('0x1c')],'UserId':_0x1d291c['id'],'queue_name':_0x529e5c[_0x766c('0x1c')],'FaxQueueId':_0x529e5c['id'],'interface':util[_0x766c('0x53')]('%s/%s',_0x766c('0x54'),_0x1d291c[_0x766c('0x1c')]),'penalty':0x0,'paused':_0x1d291c[_0x766c('0x51')],'createdAt':_0x1d291c['createdAt'],'updatedAt':_0x1d291c[_0x766c('0x55')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x766c('0x19')](respondWithFilteredResult(_0x539aa9,_0x26f96c))[_0x766c('0x35')](handleError(_0x539aa9,null));};exports[_0x766c('0x56')]=function(_0x701a17,_0x16345b){var _0x56c8ed={};var _0x45fdf0={};var _0x3d19d0;var _0x4ed1da;return db[_0x766c('0x20')]['findOne']({'where':{'id':_0x701a17[_0x766c('0x40')]['id']}})[_0x766c('0x19')](handleEntityNotFound(_0x16345b,null))[_0x766c('0x19')](function(_0x4d3e45){if(_0x4d3e45){_0x3d19d0=_0x4d3e45;_0x45fdf0[_0x766c('0x2d')]=_[_0x766c('0x29')](db[_0x766c('0x57')][_0x766c('0x21')]);_0x45fdf0[_0x766c('0x2a')]=_['keys'](_0x701a17['query']);_0x45fdf0['filters']=_[_0x766c('0x2c')](_0x45fdf0[_0x766c('0x2d')],_0x45fdf0[_0x766c('0x2a')]);_0x56c8ed[_0x766c('0x2e')]=_[_0x766c('0x2c')](_0x45fdf0[_0x766c('0x2d')],qs['fields'](_0x701a17['query'][_0x766c('0x2f')]));_0x56c8ed[_0x766c('0x2e')]=_0x56c8ed['attributes'][_0x766c('0x30')]?_0x56c8ed[_0x766c('0x2e')]:_0x45fdf0['model'];_0x56c8ed['order']=qs[_0x766c('0x48')](_0x701a17[_0x766c('0x2a')][_0x766c('0x48')]);_0x56c8ed[_0x766c('0x49')]=qs['filters'](_[_0x766c('0x4a')](_0x701a17[_0x766c('0x2a')],_0x45fdf0[_0x766c('0x2b')]));if(_0x701a17[_0x766c('0x2a')]['filter']){_0x56c8ed['where']=_[_0x766c('0x32')](_0x56c8ed[_0x766c('0x49')],{'$or':_['map'](_0x56c8ed[_0x766c('0x2e')],function(_0x53a84a){var _0x3a7c4e={};_0x3a7c4e[_0x53a84a]={'$like':'%'+_0x701a17[_0x766c('0x2a')]['filter']+'%'};return _0x3a7c4e;})});}_0x56c8ed=_[_0x766c('0x32')]({},_0x56c8ed,_0x701a17[_0x766c('0x33')]);return _0x3d19d0[_0x766c('0x56')](_0x56c8ed);}})['then'](function(_0x43154b){if(_0x43154b){_0x4ed1da=_0x43154b['length'];if(!_0x701a17[_0x766c('0x2a')][_0x766c('0x45')](_0x766c('0x46'))){_0x56c8ed[_0x766c('0x15')]=qs['limit'](_0x701a17[_0x766c('0x2a')][_0x766c('0x15')]);_0x56c8ed[_0x766c('0x13')]=qs['offset'](_0x701a17[_0x766c('0x2a')][_0x766c('0x13')]);}return _0x3d19d0[_0x766c('0x56')](_0x56c8ed);}})['then'](function(_0x492286){if(_0x492286){return _0x492286?{'count':_0x4ed1da,'rows':_0x492286}:null;}})['then'](respondWithResult(_0x16345b,null))[_0x766c('0x35')](handleError(_0x16345b,null));};exports[_0x766c('0x58')]=function(_0x36632e,_0x4003e5){var _0x309751=_0x36632e['body'][_0x766c('0x59')];return db[_0x766c('0x57')]['findAll']({'where':{'id':_0x309751},'attributes':['id'],'include':[{'model':db[_0x766c('0x4e')],'as':_0x766c('0x5a'),'attributes':['id',_0x766c('0x1c'),_0x766c('0x5b'),_0x766c('0x5c'),'interface'],'raw':!![]}]})['then'](function(_0x5a5f8d){if(_0x5a5f8d){var _0x526c7c=_['flatMap'](_0x5a5f8d,function(_0x5a8203){var _0x3d6032=_0x5a8203[_0x766c('0x5d')]({'plain':!![]});return _0x3d6032[_0x766c('0x5a')];});return db['FaxQueue'][_0x766c('0x34')]({'where':{'id':_0x36632e[_0x766c('0x40')]['id']}})[_0x766c('0x19')](function(_0x3d9851){return db[_0x766c('0x5e')]['transaction'](function(_0x2f4792){return _0x3d9851[_0x766c('0x58')](_0x309751,{'transaction':_0x2f4792})[_0x766c('0x19')](function(){return BPromise[_0x766c('0x5f')](_0x526c7c,function(_0xc23b5e){return db['UserFaxQueue'][_0x766c('0x60')]({'where':{'UserId':_0xc23b5e['id'],'FaxQueueId':_0x36632e['params']['id']},'transaction':_0x2f4792});});})[_0x766c('0x19')](function(){_0x526c7c[_0x766c('0x61')](function(_0xdd0045){socket[_0x766c('0x62')](_0x766c('0x63'),{'UserId':_0xdd0045['id'],'FaxQueueId':_0x3d9851['id']});});});});});}})['then'](respondWithStatusCode(_0x4003e5,null))[_0x766c('0x35')](handleError(_0x4003e5,null));};exports['removeTeams']=function(_0x5c771,_0x48980a){return db[_0x766c('0x57')]['findAll']({'where':{'id':_0x5c771[_0x766c('0x2a')][_0x766c('0x59')]},'attributes':['id'],'include':[{'model':db[_0x766c('0x4e')],'as':_0x766c('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x766c('0x19')](handleEntityNotFound(_0x48980a,null))[_0x766c('0x19')](function(_0x47b4ab){var _0x1c03b7=_[_0x766c('0x1f')](_0x47b4ab,'id');var _0x266593=[];var _0x175abf=[];var _0x316d99=squel[_0x766c('0x64')]();_0x316d99[_0x766c('0x65')](_0x766c('0x66'))[_0x766c('0x67')]('team_has_fax_queues','tq')[_0x766c('0x68')](_0x766c('0x69'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x766c('0x49')](_0x766c('0x6a'),_0x5c771[_0x766c('0x40')]['id']);for(var _0x4b794c=0x0;_0x4b794c<_0x47b4ab[_0x766c('0x30')];_0x4b794c+=0x1){let _0x53af90=_0x47b4ab[_0x4b794c];for(var _0x21e4d1=0x0;_0x21e4d1<_0x53af90['Agents'][_0x766c('0x30')];_0x21e4d1+=0x1){let _0x467214=_0x53af90['Agents'][_0x21e4d1];var _0x13b9b=_0x316d99['clone']();_0x13b9b['where'](_0x766c('0x6b'),_0x467214['id']);_0x175abf[_0x766c('0x6c')](db[_0x766c('0x5e')][_0x766c('0x2a')](_0x13b9b[_0x766c('0x6d')](),{'type':db['sequelize'][_0x766c('0x6e')]['SELECT']})[_0x766c('0x19')](function(_0x3b3f04){if(_0x3b3f04['length']===0x1){return _0x467214['id'];}else{var _0x33c83c=_['every'](_[_0x766c('0x1f')](_0x3b3f04,_0x766c('0x6f')),function(_0x42ae7e){return _[_0x766c('0x70')](_0x1c03b7,_0x42ae7e);});if(_0x33c83c){return _0x467214['id'];}}}));}}return BPromise['all'](_0x175abf)[_0x766c('0x19')](function(_0x4c7c9f){_0x266593=_(_0x266593)[_0x766c('0x71')](_0x4c7c9f)[_0x766c('0x72')]()[_0x766c('0x73')]();return db['FaxQueue']['find']({'where':{'id':_0x5c771[_0x766c('0x40')]['id']}})[_0x766c('0x19')](function(_0x116c30){return db[_0x766c('0x5e')][_0x766c('0x74')](function(_0x560386){return _0x116c30[_0x766c('0x75')](_0x5c771[_0x766c('0x2a')][_0x766c('0x59')],{'transaction':_0x560386})[_0x766c('0x19')](function(){if(!_[_0x766c('0x76')](_0x266593)){return _0x116c30[_0x766c('0x77')](_0x266593,{'transaction':_0x560386});}})['then'](function(){_0x266593[_0x766c('0x61')](function(_0x3bc31){socket[_0x766c('0x62')](_0x766c('0x78'),{'UserId':_0x3bc31,'FaxQueueId':_0x116c30['id']});});});});});});})[_0x766c('0x19')](respondWithStatusCode(_0x48980a,null))[_0x766c('0x35')](handleError(_0x48980a,null));};exports[_0x766c('0x79')]=function(_0x20c72f,_0x102fff){return db[_0x766c('0x20')][_0x766c('0x34')]({'where':{'id':_0x20c72f[_0x766c('0x40')]['id']}})[_0x766c('0x19')](handleEntityNotFound(_0x102fff,null))['then'](function(_0x1b016e){if(_0x1b016e){return _0x1b016e[_0x766c('0x79')](_0x20c72f['body']['ids'],_[_0x766c('0x7a')](_0x20c72f[_0x766c('0x3f')],[_0x766c('0x59'),'id'])||{})[_0x766c('0x7b')](function(_0x2d3c1c){for(var _0x1f576f=0x0;_0x1f576f<_0x20c72f[_0x766c('0x3f')][_0x766c('0x59')][_0x766c('0x30')];_0x1f576f+=0x1){socket[_0x766c('0x62')](_0x766c('0x63'),{'UserId':Number(_0x20c72f[_0x766c('0x3f')][_0x766c('0x59')][_0x1f576f]),'FaxQueueId':Number(_0x20c72f[_0x766c('0x40')]['id'])});}return _0x2d3c1c;});}})[_0x766c('0x19')](respondWithResult(_0x102fff,null))['catch'](handleError(_0x102fff,null));};exports['removeAgents']=function(_0xca2042,_0xabcd0c){return db[_0x766c('0x20')]['find']({'where':{'id':_0xca2042['params']['id']}})['then'](handleEntityNotFound(_0xabcd0c,null))[_0x766c('0x19')](function(_0x1df434){if(_0x1df434){return _0x1df434[_0x766c('0x77')](_0xca2042[_0x766c('0x2a')][_0x766c('0x59')])['then'](function(){if(_[_0x766c('0x7c')](_0xca2042[_0x766c('0x2a')][_0x766c('0x59')])){for(var _0x6282db=0x0;_0x6282db<_0xca2042[_0x766c('0x2a')]['ids']['length'];_0x6282db+=0x1){socket[_0x766c('0x62')](_0x766c('0x78'),{'UserId':Number(_0xca2042['query'][_0x766c('0x59')][_0x6282db]),'FaxQueueId':Number(_0xca2042[_0x766c('0x40')]['id'])});}}else{socket[_0x766c('0x62')](_0x766c('0x78'),{'UserId':Number(_0xca2042[_0x766c('0x2a')][_0x766c('0x59')]),'FaxQueueId':Number(_0xca2042[_0x766c('0x40')]['id'])});}});}})[_0x766c('0x19')](respondWithStatusCode(_0xabcd0c,null))[_0x766c('0x35')](handleError(_0xabcd0c,null));};exports[_0x766c('0x7d')]=function(_0x4c4d13,_0x412a96){var _0x2f99a6={};var _0x4330c4={};var _0x19744a;var _0x4248be;return db['FaxQueue']['findOne']({'where':{'id':_0x4c4d13[_0x766c('0x40')]['id']}})[_0x766c('0x19')](handleEntityNotFound(_0x412a96,null))[_0x766c('0x19')](function(_0x386a49){if(_0x386a49){_0x19744a=_0x386a49;_0x4330c4[_0x766c('0x2d')]=_[_0x766c('0x29')](db['User'][_0x766c('0x21')]);_0x4330c4[_0x766c('0x2a')]=_[_0x766c('0x29')](_0x4c4d13[_0x766c('0x2a')]);_0x4330c4[_0x766c('0x2b')]=_[_0x766c('0x2c')](_0x4330c4['model'],_0x4330c4[_0x766c('0x2a')]);_0x2f99a6[_0x766c('0x2e')]=_[_0x766c('0x2c')](_0x4330c4['model'],qs[_0x766c('0x2f')](_0x4c4d13['query']['fields']));_0x2f99a6[_0x766c('0x2e')]=_0x2f99a6[_0x766c('0x2e')][_0x766c('0x30')]?_0x2f99a6[_0x766c('0x2e')]:_0x4330c4['model'];_0x2f99a6[_0x766c('0x47')]=qs['sort'](_0x4c4d13[_0x766c('0x2a')][_0x766c('0x48')]);_0x2f99a6[_0x766c('0x49')]=qs[_0x766c('0x2b')](_[_0x766c('0x4a')](_0x4c4d13[_0x766c('0x2a')],_0x4330c4[_0x766c('0x2b')]));if(_0x4c4d13['query'][_0x766c('0x4c')]){_0x2f99a6[_0x766c('0x49')]=_[_0x766c('0x32')](_0x2f99a6[_0x766c('0x49')],{'$or':_[_0x766c('0x1f')](_0x2f99a6['attributes'],function(_0x2fb40d){var _0x2713e1={};_0x2713e1[_0x2fb40d]={'$like':'%'+_0x4c4d13[_0x766c('0x2a')][_0x766c('0x4c')]+'%'};return _0x2713e1;})});}_0x2f99a6=_['merge']({},_0x2f99a6,_0x4c4d13[_0x766c('0x33')]);return _0x19744a['getAgents'](_0x2f99a6);}})[_0x766c('0x19')](function(_0x504b8f){if(_0x504b8f){_0x4248be=_0x504b8f[_0x766c('0x30')];if(!_0x4c4d13[_0x766c('0x2a')][_0x766c('0x45')](_0x766c('0x46'))){_0x2f99a6[_0x766c('0x15')]=qs[_0x766c('0x15')](_0x4c4d13['query'][_0x766c('0x15')]);_0x2f99a6[_0x766c('0x13')]=qs[_0x766c('0x13')](_0x4c4d13[_0x766c('0x2a')][_0x766c('0x13')]);}return _0x19744a[_0x766c('0x7d')](_0x2f99a6);}})[_0x766c('0x19')](function(_0x52f065){if(_0x52f065){return _0x52f065?{'count':_0x4248be,'rows':_0x52f065}:null;}})[_0x766c('0x19')](respondWithResult(_0x412a96,null))[_0x766c('0x35')](handleError(_0x412a96,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 0d86103..e9eb765 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 _0xbc88=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5aa8ac,_0x37f6e8){var _0x4b382d=function(_0x284062){while(--_0x284062){_0x5aa8ac['push'](_0x5aa8ac['shift']());}};_0x4b382d(++_0x37f6e8);}(_0xbc88,0x18a));var _0x8bc8=function(_0x50cfba,_0x342c17){_0x50cfba=_0x50cfba-0x0;var _0x511c60=_0xbc88[_0x50cfba];return _0x511c60;};'use strict';var EventEmitter=require(_0x8bc8('0x0'));var FaxQueue=require(_0x8bc8('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8bc8('0x2'),'afterUpdate':_0x8bc8('0x3'),'afterDestroy':_0x8bc8('0x4')};function emitEvent(_0x47f960){return function(_0x27aee3,_0x2bd2c0,_0x50a8ed){FaxQueueEvents['emit'](_0x47f960+':'+_0x27aee3['id'],_0x27aee3);FaxQueueEvents[_0x8bc8('0x5')](_0x47f960,_0x27aee3);_0x50a8ed(null);};}for(var e in events){if(events[_0x8bc8('0x6')](e)){var event=events[e];FaxQueue[_0x8bc8('0x7')](e,emitEvent(event));}}module[_0x8bc8('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xad5a=['exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x2c5042,_0x50fa14){var _0x36edcb=function(_0x31453f){while(--_0x31453f){_0x2c5042['push'](_0x2c5042['shift']());}};_0x36edcb(++_0x50fa14);}(_0xad5a,0x71));var _0xaad5=function(_0x35a961,_0x59aea6){_0x35a961=_0x35a961-0x0;var _0x5819d=_0xad5a[_0x35a961];return _0x5819d;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xaad5('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xaad5('0x1')](0x0);var events={'afterCreate':_0xaad5('0x2'),'afterUpdate':_0xaad5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x71ffa8){return function(_0x5ad0af,_0x30a417,_0x413c80){FaxQueueEvents['emit'](_0x71ffa8+':'+_0x5ad0af['id'],_0x5ad0af);FaxQueueEvents[_0xaad5('0x4')](_0x71ffa8,_0x5ad0af);_0x413c80(null);};}for(var e in events){if(events[_0xaad5('0x5')](e)){var event=events[e];FaxQueue[_0xaad5('0x6')](e,emitEvent(event));}}module[_0xaad5('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 2adcc2b..a3ce142 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 _0xd5e0=['exports','define','FaxQueue','fax_queues','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0x349915,_0x124261){var _0x8be4f3=function(_0x3a82a9){while(--_0x3a82a9){_0x349915['push'](_0x349915['shift']());}};_0x8be4f3(++_0x124261);}(_0xd5e0,0x148));var _0x0d5e=function(_0x507c80,_0x4774b7){_0x507c80=_0x507c80-0x0;var _0x2c1cd3=_0xd5e0[_0x507c80];return _0x2c1cd3;};'use strict';var _=require(_0x0d5e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0d5e('0x1'));var moment=require(_0x0d5e('0x2'));var BPromise=require(_0x0d5e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d5e('0x4'));var rimraf=require(_0x0d5e('0x5'));var config=require(_0x0d5e('0x6'));var attributes=require(_0x0d5e('0x7'));module[_0x0d5e('0x8')]=function(_0x2d23e6,_0x1e2179){return _0x2d23e6[_0x0d5e('0x9')](_0x0d5e('0xa'),attributes,{'tableName':_0x0d5e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a38=['define','FaxQueue','fax_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0x4a38,0xb7));var _0x84a3=function(_0x2dd413,_0x572887){_0x2dd413=_0x2dd413-0x0;var _0x2ca759=_0x4a38[_0x2dd413];return _0x2ca759;};'use strict';var _=require(_0x84a3('0x0'));var util=require(_0x84a3('0x1'));var logger=require(_0x84a3('0x2'))('api');var moment=require(_0x84a3('0x3'));var BPromise=require(_0x84a3('0x4'));var rp=require(_0x84a3('0x5'));var fs=require('fs');var path=require(_0x84a3('0x6'));var rimraf=require(_0x84a3('0x7'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x84a3('0x8')]=function(_0x1bccc2,_0x728dee){return _0x1bccc2[_0x84a3('0x9')](_0x84a3('0xa'),attributes,{'tableName':_0x84a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 31b2cb1..0f598f7 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 _0x3078=['error','message','result','catch','GetFaxQueue','FaxQueue','options','where','attributes','limit','include','map','model','ShowFaxQueue','find','raw','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x40071c,_0x482e30){var _0x30f9c6=function(_0x4e05c1){while(--_0x4e05c1){_0x40071c['push'](_0x40071c['shift']());}};_0x30f9c6(++_0x482e30);}(_0x3078,0x138));var _0x8307=function(_0x1443d5,_0x21f839){_0x1443d5=_0x1443d5-0x0;var _0x3f8e34=_0x3078[_0x1443d5];return _0x3f8e34;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8307('0x0'));var rs=require(_0x8307('0x1'));var fs=require('fs');var Redis=require(_0x8307('0x2'));var db=require(_0x8307('0x3'))['db'];var utils=require(_0x8307('0x4'));var logger=require('../../config/logger')(_0x8307('0x5'));var config=require(_0x8307('0x6'));var jayson=require(_0x8307('0x7'));var client=jayson[_0x8307('0x8')][_0x8307('0x9')]({'port':0x232a});config['redis']=_[_0x8307('0xa')](config['redis'],{'host':_0x8307('0xb'),'port':0x18eb});var socket=require(_0x8307('0xc'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x8307('0xd')](socket);function respondWithRpcPromise(_0x3db6db,_0x72ef5a,_0x279383){return new BPromise(function(_0x3aa7fa,_0x3c0a22){return client['request'](_0x3db6db,_0x279383)[_0x8307('0xe')](function(_0x13bd93){logger[_0x8307('0xf')](_0x8307('0x10'),_0x72ef5a,_0x8307('0x11'));logger[_0x8307('0x12')](_0x8307('0x13'),_0x72ef5a,_0x8307('0x11'),JSON[_0x8307('0x14')](_0x13bd93));if(_0x13bd93[_0x8307('0x15')]){if(_0x13bd93[_0x8307('0x15')]['code']===0x1f4){logger[_0x8307('0x15')]('FaxQueue,\x20%s,\x20%s',_0x72ef5a,_0x13bd93[_0x8307('0x15')]['message']);return _0x3c0a22(_0x13bd93[_0x8307('0x15')][_0x8307('0x16')]);}logger[_0x8307('0x15')]('FaxQueue,\x20%s,\x20%s',_0x72ef5a,_0x13bd93['error'][_0x8307('0x16')]);return _0x3aa7fa(_0x13bd93[_0x8307('0x15')]['message']);}else{logger[_0x8307('0xf')](_0x8307('0x10'),_0x72ef5a,_0x8307('0x11'));_0x3aa7fa(_0x13bd93[_0x8307('0x17')]['message']);}})[_0x8307('0x18')](function(_0x5eee8f){logger['error'](_0x8307('0x10'),_0x72ef5a,_0x5eee8f);_0x3c0a22(_0x5eee8f);});});}exports[_0x8307('0x19')]=function(_0x2f0b74){var _0x344e53=this;return new Promise(function(_0x110461,_0x146fd3){return db[_0x8307('0x1a')]['findAll']({'raw':_0x2f0b74[_0x8307('0x1b')]?_0x2f0b74['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f0b74[_0x8307('0x1b')]?_0x2f0b74[_0x8307('0x1b')][_0x8307('0x1c')]||null:null,'attributes':_0x2f0b74[_0x8307('0x1b')]?_0x2f0b74[_0x8307('0x1b')][_0x8307('0x1d')]||null:null,'limit':_0x2f0b74[_0x8307('0x1b')]?_0x2f0b74[_0x8307('0x1b')][_0x8307('0x1e')]||null:null,'include':_0x2f0b74[_0x8307('0x1b')]?_0x2f0b74[_0x8307('0x1b')][_0x8307('0x1f')]?_[_0x8307('0x20')](_0x2f0b74[_0x8307('0x1b')]['include'],function(_0x502a25){return{'model':db[_0x502a25[_0x8307('0x21')]],'as':_0x502a25['as'],'attributes':_0x502a25[_0x8307('0x1d')],'include':_0x502a25[_0x8307('0x1f')]?_[_0x8307('0x20')](_0x502a25['include'],function(_0x4a788d){return{'model':db[_0x4a788d[_0x8307('0x21')]],'as':_0x4a788d['as'],'attributes':_0x4a788d[_0x8307('0x1d')],'include':_0x4a788d[_0x8307('0x1f')]?_['map'](_0x4a788d[_0x8307('0x1f')],function(_0x5598be){return{'model':db[_0x5598be[_0x8307('0x21')]],'as':_0x5598be['as'],'attributes':_0x5598be[_0x8307('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x429945){logger[_0x8307('0xf')](_0x8307('0x19'),_0x2f0b74);logger[_0x8307('0x12')](_0x8307('0x19'),_0x2f0b74,JSON[_0x8307('0x14')](_0x429945));_0x110461(_0x429945);})[_0x8307('0x18')](function(_0x343133){logger[_0x8307('0x15')](_0x8307('0x19'),_0x343133[_0x8307('0x16')],_0x2f0b74);_0x146fd3(_0x344e53[_0x8307('0x15')](0x1f4,_0x343133['message']));});});};exports[_0x8307('0x22')]=function(_0x492153){var _0x25ff24=this;return new Promise(function(_0x4a200a,_0x111fad){return db[_0x8307('0x1a')][_0x8307('0x23')]({'raw':_0x492153['options']?_0x492153[_0x8307('0x1b')][_0x8307('0x24')]===undefined?!![]:![]:!![],'where':_0x492153[_0x8307('0x1b')]?_0x492153['options'][_0x8307('0x1c')]||null:null,'attributes':_0x492153[_0x8307('0x1b')]?_0x492153[_0x8307('0x1b')][_0x8307('0x1d')]||null:null,'include':_0x492153[_0x8307('0x1b')]?_0x492153[_0x8307('0x1b')][_0x8307('0x1f')]?_[_0x8307('0x20')](_0x492153[_0x8307('0x1b')]['include'],function(_0x1fc5c0){return{'model':db[_0x1fc5c0['model']],'as':_0x1fc5c0['as'],'attributes':_0x1fc5c0[_0x8307('0x1d')],'include':_0x1fc5c0[_0x8307('0x1f')]?_[_0x8307('0x20')](_0x1fc5c0['include'],function(_0x34a6a1){return{'model':db[_0x34a6a1[_0x8307('0x21')]],'as':_0x34a6a1['as'],'attributes':_0x34a6a1[_0x8307('0x1d')],'include':_0x34a6a1[_0x8307('0x1f')]?_['map'](_0x34a6a1[_0x8307('0x1f')],function(_0x50b2b6){return{'model':db[_0x50b2b6['model']],'as':_0x50b2b6['as'],'attributes':_0x50b2b6[_0x8307('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3da74c){logger['info'](_0x8307('0x22'),_0x492153);logger[_0x8307('0x12')](_0x8307('0x22'),_0x492153,JSON['stringify'](_0x3da74c));_0x4a200a(_0x3da74c);})[_0x8307('0x18')](function(_0x406420){logger[_0x8307('0x15')]('ShowFaxQueue',_0x406420[_0x8307('0x16')],_0x492153);_0x111fad(_0x25ff24[_0x8307('0x15')](0x1f4,_0x406420['message']));});});}; \ No newline at end of file +var _0x8b26=['socket.io-emitter','./faxQueue.socket','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x398f3c,_0x36a5f7){var _0x576b50=function(_0x241331){while(--_0x241331){_0x398f3c['push'](_0x398f3c['shift']());}};_0x576b50(++_0x36a5f7);}(_0x8b26,0x150));var _0x68b2=function(_0x174283,_0x3fd836){_0x174283=_0x174283-0x0;var _0x139f1a=_0x8b26[_0x174283];return _0x139f1a;};'use strict';var _=require(_0x68b2('0x0'));var util=require(_0x68b2('0x1'));var moment=require(_0x68b2('0x2'));var BPromise=require(_0x68b2('0x3'));var rs=require(_0x68b2('0x4'));var fs=require('fs');var Redis=require(_0x68b2('0x5'));var db=require(_0x68b2('0x6'))['db'];var utils=require(_0x68b2('0x7'));var logger=require('../../config/logger')(_0x68b2('0x8'));var config=require(_0x68b2('0x9'));var jayson=require(_0x68b2('0xa'));var client=jayson['client'][_0x68b2('0xb')]({'port':0x232a});config[_0x68b2('0xc')]=_[_0x68b2('0xd')](config[_0x68b2('0xc')],{'host':_0x68b2('0xe'),'port':0x18eb});var socket=require(_0x68b2('0xf'))(new Redis(config[_0x68b2('0xc')]));require(_0x68b2('0x10'))['register'](socket);function respondWithRpcPromise(_0x3a97eb,_0x1d8dc6,_0x479cf9){return new BPromise(function(_0x2735d1,_0x3925b0){return client[_0x68b2('0x11')](_0x3a97eb,_0x479cf9)['then'](function(_0x4379e6){logger[_0x68b2('0x12')](_0x68b2('0x13'),_0x1d8dc6,_0x68b2('0x14'));logger[_0x68b2('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x1d8dc6,'request\x20sent',JSON[_0x68b2('0x16')](_0x4379e6));if(_0x4379e6[_0x68b2('0x17')]){if(_0x4379e6[_0x68b2('0x17')]['code']===0x1f4){logger['error'](_0x68b2('0x13'),_0x1d8dc6,_0x4379e6[_0x68b2('0x17')][_0x68b2('0x18')]);return _0x3925b0(_0x4379e6['error'][_0x68b2('0x18')]);}logger[_0x68b2('0x17')](_0x68b2('0x13'),_0x1d8dc6,_0x4379e6[_0x68b2('0x17')]['message']);return _0x2735d1(_0x4379e6['error'][_0x68b2('0x18')]);}else{logger[_0x68b2('0x12')]('FaxQueue,\x20%s,\x20%s',_0x1d8dc6,_0x68b2('0x14'));_0x2735d1(_0x4379e6['result'][_0x68b2('0x18')]);}})[_0x68b2('0x19')](function(_0x5a99fb){logger[_0x68b2('0x17')](_0x68b2('0x13'),_0x1d8dc6,_0x5a99fb);_0x3925b0(_0x5a99fb);});});}exports[_0x68b2('0x1a')]=function(_0x2ddb54){var _0x1ff84b=this;return new Promise(function(_0x5a911f,_0x182f06){return db[_0x68b2('0x1b')][_0x68b2('0x1c')]({'raw':_0x2ddb54[_0x68b2('0x1d')]?_0x2ddb54[_0x68b2('0x1d')][_0x68b2('0x1e')]===undefined?!![]:![]:!![],'where':_0x2ddb54[_0x68b2('0x1d')]?_0x2ddb54[_0x68b2('0x1d')][_0x68b2('0x1f')]||null:null,'attributes':_0x2ddb54['options']?_0x2ddb54[_0x68b2('0x1d')][_0x68b2('0x20')]||null:null,'limit':_0x2ddb54[_0x68b2('0x1d')]?_0x2ddb54['options'][_0x68b2('0x21')]||null:null,'include':_0x2ddb54[_0x68b2('0x1d')]?_0x2ddb54[_0x68b2('0x1d')]['include']?_[_0x68b2('0x22')](_0x2ddb54[_0x68b2('0x1d')]['include'],function(_0x25e164){return{'model':db[_0x25e164['model']],'as':_0x25e164['as'],'attributes':_0x25e164[_0x68b2('0x20')],'include':_0x25e164[_0x68b2('0x23')]?_[_0x68b2('0x22')](_0x25e164[_0x68b2('0x23')],function(_0x5d5c03){return{'model':db[_0x5d5c03['model']],'as':_0x5d5c03['as'],'attributes':_0x5d5c03['attributes'],'include':_0x5d5c03[_0x68b2('0x23')]?_[_0x68b2('0x22')](_0x5d5c03[_0x68b2('0x23')],function(_0x20709e){return{'model':db[_0x20709e[_0x68b2('0x24')]],'as':_0x20709e['as'],'attributes':_0x20709e[_0x68b2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x68b2('0x25')](function(_0x2b8511){logger[_0x68b2('0x12')]('GetFaxQueue',_0x2ddb54);logger[_0x68b2('0x15')](_0x68b2('0x1a'),_0x2ddb54,JSON['stringify'](_0x2b8511));_0x5a911f(_0x2b8511);})[_0x68b2('0x19')](function(_0x2a32c6){logger[_0x68b2('0x17')]('GetFaxQueue',_0x2a32c6[_0x68b2('0x18')],_0x2ddb54);_0x182f06(_0x1ff84b[_0x68b2('0x17')](0x1f4,_0x2a32c6[_0x68b2('0x18')]));});});};exports[_0x68b2('0x26')]=function(_0x4e6e94){var _0x1bb30d=this;return new Promise(function(_0x9bd5ba,_0x215d9b){return db[_0x68b2('0x1b')]['find']({'raw':_0x4e6e94[_0x68b2('0x1d')]?_0x4e6e94[_0x68b2('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4e6e94[_0x68b2('0x1d')]?_0x4e6e94['options'][_0x68b2('0x1f')]||null:null,'attributes':_0x4e6e94[_0x68b2('0x1d')]?_0x4e6e94[_0x68b2('0x1d')][_0x68b2('0x20')]||null:null,'include':_0x4e6e94[_0x68b2('0x1d')]?_0x4e6e94[_0x68b2('0x1d')][_0x68b2('0x23')]?_['map'](_0x4e6e94[_0x68b2('0x1d')][_0x68b2('0x23')],function(_0x5cdf3c){return{'model':db[_0x5cdf3c[_0x68b2('0x24')]],'as':_0x5cdf3c['as'],'attributes':_0x5cdf3c[_0x68b2('0x20')],'include':_0x5cdf3c[_0x68b2('0x23')]?_[_0x68b2('0x22')](_0x5cdf3c[_0x68b2('0x23')],function(_0xb26da){return{'model':db[_0xb26da[_0x68b2('0x24')]],'as':_0xb26da['as'],'attributes':_0xb26da[_0x68b2('0x20')],'include':_0xb26da[_0x68b2('0x23')]?_[_0x68b2('0x22')](_0xb26da['include'],function(_0x43bdf6){return{'model':db[_0x43bdf6['model']],'as':_0x43bdf6['as'],'attributes':_0x43bdf6[_0x68b2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x68b2('0x25')](function(_0x35bc7c){logger[_0x68b2('0x12')](_0x68b2('0x26'),_0x4e6e94);logger[_0x68b2('0x15')](_0x68b2('0x26'),_0x4e6e94,JSON[_0x68b2('0x16')](_0x35bc7c));_0x9bd5ba(_0x35bc7c);})[_0x68b2('0x19')](function(_0x5ed710){logger['error'](_0x68b2('0x26'),_0x5ed710[_0x68b2('0x18')],_0x4e6e94);_0x215d9b(_0x1bb30d[_0x68b2('0x17')](0x1f4,_0x5ed710['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 6705fb6..099f649 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 _0x8810=['faxQueue:','./faxQueue.events','save','update','register','length'];(function(_0x268c4c,_0x5cce8d){var _0x37e96e=function(_0x59d4c2){while(--_0x59d4c2){_0x268c4c['push'](_0x268c4c['shift']());}};_0x37e96e(++_0x5cce8d);}(_0x8810,0x85));var _0x0881=function(_0x50b3cb,_0x4843b7){_0x50b3cb=_0x50b3cb-0x0;var _0x4f7eda=_0x8810[_0x50b3cb];return _0x4f7eda;};'use strict';var FaxQueueEvents=require(_0x0881('0x0'));var events=[_0x0881('0x1'),'remove',_0x0881('0x2')];function createListener(_0x44975f,_0x59e38f){return function(_0x41bfbd){_0x59e38f['emit'](_0x44975f,_0x41bfbd);};}function removeListener(_0x17cb11,_0x2894a1){return function(){FaxQueueEvents['removeListener'](_0x17cb11,_0x2894a1);};}exports[_0x0881('0x3')]=function(_0x191c84){for(var _0xb43a46=0x0,_0x2de355=events[_0x0881('0x4')];_0xb43a46<_0x2de355;_0xb43a46++){var _0x3a9f50=events[_0xb43a46];var _0x1d3a78=createListener(_0x0881('0x5')+_0x3a9f50,_0x191c84);FaxQueueEvents['on'](_0x3a9f50,_0x1d3a78);}}; \ No newline at end of file +var _0x3bcf=['update','emit','removeListener','length','./faxQueue.events','save','remove'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x3bcf,0xdd));var _0xf3bc=function(_0x191a35,_0x2140be){_0x191a35=_0x191a35-0x0;var _0x1220f3=_0x3bcf[_0x191a35];return _0x1220f3;};'use strict';var FaxQueueEvents=require(_0xf3bc('0x0'));var events=[_0xf3bc('0x1'),_0xf3bc('0x2'),_0xf3bc('0x3')];function createListener(_0x13021e,_0x3a7b98){return function(_0x47c1d5){_0x3a7b98[_0xf3bc('0x4')](_0x13021e,_0x47c1d5);};}function removeListener(_0x412e93,_0x31d88a){return function(){FaxQueueEvents[_0xf3bc('0x5')](_0x412e93,_0x31d88a);};}exports['register']=function(_0x403472){for(var _0x3456d0=0x0,_0x37bae7=events[_0xf3bc('0x6')];_0x3456d0<_0x37bae7;_0x3456d0++){var _0x137de6=events[_0x3456d0];var _0x26960c=createListener('faxQueue:'+_0x137de6,_0x403472);FaxQueueEvents['on'](_0x137de6,_0x26960c);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 2e3e603..ee90118 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 _0x553a=['/:id/users','getAgents','create','post','addTeams','put','/:id','destroy','delete','removeTeams','removeAgents','util','connect-timeout','express','Router','../../components/interaction/service','get','/describe','isAuthenticated','show','getMembers','/:id/teams','getTeams'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x553a,0x192));var _0xa553=function(_0x2f4f25,_0x592d31){_0x2f4f25=_0x2f4f25-0x0;var _0x6a112a=_0x553a[_0x2f4f25];return _0x6a112a;};'use strict';var multer=require('multer');var util=require(_0xa553('0x0'));var path=require('path');var timeout=require(_0xa553('0x1'));var express=require(_0xa553('0x2'));var router=express[_0xa553('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa553('0x4'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0xa553('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa553('0x5')](_0xa553('0x6'),auth[_0xa553('0x7')](),controller['describe']);router[_0xa553('0x5')]('/:id',auth[_0xa553('0x7')](),controller[_0xa553('0x8')]);router[_0xa553('0x5')]('/:id/members',auth['isAuthenticated'](),controller[_0xa553('0x9')]);router['get'](_0xa553('0xa'),auth[_0xa553('0x7')](),controller[_0xa553('0xb')]);router['get'](_0xa553('0xc'),auth[_0xa553('0x7')](),controller[_0xa553('0xd')]);router['post']('/',auth[_0xa553('0x7')](),controller[_0xa553('0xe')]);router[_0xa553('0xf')]('/:id/teams',auth['isAuthenticated'](),controller[_0xa553('0x10')]);router[_0xa553('0xf')](_0xa553('0xc'),auth[_0xa553('0x7')](),controller['addAgents']);router[_0xa553('0x11')]('/:id',auth[_0xa553('0x7')](),controller['update']);router['delete'](_0xa553('0x12'),auth['isAuthenticated'](),controller[_0xa553('0x13')]);router[_0xa553('0x14')](_0xa553('0xa'),auth['isAuthenticated'](),controller[_0xa553('0x15')]);router[_0xa553('0x14')]('/:id/users',auth[_0xa553('0x7')](),controller[_0xa553('0x16')]);module['exports']=router; \ No newline at end of file +var _0xc2c7=['describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','update','destroy','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x1ecb71,_0x370253){var _0x402229=function(_0x25796a){while(--_0x25796a){_0x1ecb71['push'](_0x1ecb71['shift']());}};_0x402229(++_0x370253);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3e76f0,_0x41414c){_0x3e76f0=_0x3e76f0-0x0;var _0x188517=_0xc2c7[_0x3e76f0];return _0x188517;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['get'](_0x7c2c('0xe'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xf')]);router[_0x7c2c('0x8')](_0x7c2c('0x10'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x11')]);router[_0x7c2c('0x8')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x13')]);router[_0x7c2c('0x14')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x15')]);router[_0x7c2c('0x14')](_0x7c2c('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0x7c2c('0x14')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller['addAgents']);router[_0x7c2c('0x16')](_0x7c2c('0xc'),auth['isAuthenticated'](),controller[_0x7c2c('0x17')]);router['delete'](_0x7c2c('0xc'),auth['isAuthenticated'](),controller[_0x7c2c('0x18')]);router[_0x7c2c('0x19')](_0x7c2c('0x10'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1a')]);router[_0x7c2c('0x19')](_0x7c2c('0x12'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x1b')]);module[_0x7c2c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 5176226..e022f57 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 _0xf006=['STRING','DATE','exports'];(function(_0x24ad48,_0x31c1d6){var _0x6b5cc1=function(_0x597f57){while(--_0x597f57){_0x24ad48['push'](_0x24ad48['shift']());}};_0x6b5cc1(++_0x31c1d6);}(_0xf006,0x146));var _0x6f00=function(_0x54df5e,_0x299844){_0x54df5e=_0x54df5e-0x0;var _0x2cee81=_0xf006[_0x54df5e];return _0x2cee81;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x6f00('0x0')]={'uniqueid':{'type':Sequelize[_0x6f00('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6f00('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6f00('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x088d=['sequelize','exports','STRING','DATE','moment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x088d,0xa9));var _0xd088=function(_0x388f42,_0x42bd67){_0x388f42=_0x388f42-0x0;var _0x563058=_0x088d[_0x388f42];return _0x563058;};'use strict';var moment=require(_0xd088('0x0'));var Sequelize=require(_0xd088('0x1'));module[_0xd088('0x2')]={'uniqueid':{'type':Sequelize[_0xd088('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd088('0x3')]},'joinAt':{'type':Sequelize[_0xd088('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd088('0x4')]},'exitAt':{'type':Sequelize[_0xd088('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 2240ab1..66e92fa 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 _0x8b7c=['end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FaxQueueReport','findAll','rows','catch','show','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0xe0f8d0,_0x63c5ed){var _0x3e047c=function(_0x1eab6b){while(--_0x1eab6b){_0xe0f8d0['push'](_0xe0f8d0['shift']());}};_0x3e047c(++_0x63c5ed);}(_0x8b7c,0x119));var _0xc8b7=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x8b7c[_0x4baae2];return _0x1a2285;};'use strict';var emlformat=require(_0xc8b7('0x0'));var rimraf=require(_0xc8b7('0x1'));var zipdir=require(_0xc8b7('0x2'));var jsonpatch=require(_0xc8b7('0x3'));var rp=require(_0xc8b7('0x4'));var moment=require(_0xc8b7('0x5'));var BPromise=require(_0xc8b7('0x6'));var Mustache=require(_0xc8b7('0x7'));var util=require('util');var path=require(_0xc8b7('0x8'));var sox=require(_0xc8b7('0x9'));var csv=require(_0xc8b7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc8b7('0xb'));var _=require(_0xc8b7('0xc'));var squel=require(_0xc8b7('0xd'));var crypto=require(_0xc8b7('0xe'));var jsforce=require(_0xc8b7('0xf'));var deskjs=require(_0xc8b7('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc8b7('0x11'));var Papa=require('papaparse');var Redis=require(_0xc8b7('0x12'));var authService=require(_0xc8b7('0x13'));var qs=require(_0xc8b7('0x14'));var as=require(_0xc8b7('0x15'));var hardwareService=require(_0xc8b7('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc8b7('0x17'));var licenseUtil=require(_0xc8b7('0x18'));var db=require(_0xc8b7('0x19'))['db'];function respondWithStatusCode(_0x21ec4f,_0x5063ad){_0x5063ad=_0x5063ad||0xcc;return function(_0x5495e9){if(_0x5495e9){return _0x21ec4f['sendStatus'](_0x5063ad);}return _0x21ec4f[_0xc8b7('0x1a')](_0x5063ad)[_0xc8b7('0x1b')]();};}function respondWithResult(_0x38da92,_0x5c6e5b){_0x5c6e5b=_0x5c6e5b||0xc8;return function(_0x19d3ea){if(_0x19d3ea){return _0x38da92[_0xc8b7('0x1a')](_0x5c6e5b)[_0xc8b7('0x1c')](_0x19d3ea);}};}function respondWithFilteredResult(_0x1b7dc0,_0x3d189e){return function(_0x5d412e){if(_0x5d412e){var _0xb53183=typeof _0x3d189e[_0xc8b7('0x1d')]===_0xc8b7('0x1e')&&typeof _0x3d189e[_0xc8b7('0x1f')]===_0xc8b7('0x1e');var _0x186dbd=_0x5d412e[_0xc8b7('0x20')];var _0x485415=_0xb53183?0x0:_0x3d189e['offset'];var _0x1cf47c=_0xb53183?_0x5d412e[_0xc8b7('0x20')]:_0x3d189e[_0xc8b7('0x1d')]+_0x3d189e['limit'];var _0x5df9f7;if(_0x1cf47c>=_0x186dbd){_0x1cf47c=_0x186dbd;_0x5df9f7=0xc8;}else{_0x5df9f7=0xce;}_0x1b7dc0[_0xc8b7('0x1a')](_0x5df9f7);return _0x1b7dc0['set'](_0xc8b7('0x21'),_0x485415+'-'+_0x1cf47c+'/'+_0x186dbd)['json'](_0x5d412e);}return null;};}function patchUpdates(_0x462cce){return function(_0x3b39a3){try{jsonpatch['apply'](_0x3b39a3,_0x462cce,!![]);}catch(_0x298e69){return BPromise['reject'](_0x298e69);}return _0x3b39a3[_0xc8b7('0x22')]();};}function saveUpdates(_0x431163,_0x456eea){return function(_0x5e11cd){if(_0x5e11cd){return _0x5e11cd[_0xc8b7('0x23')](_0x431163)[_0xc8b7('0x24')](function(_0x4065d9){return _0x4065d9;});}return null;};}function removeEntity(_0x5b28ad,_0x3b0e47){return function(_0x191c12){if(_0x191c12){return _0x191c12[_0xc8b7('0x25')]()[_0xc8b7('0x24')](function(){_0x5b28ad[_0xc8b7('0x1a')](0xcc)[_0xc8b7('0x1b')]();});}};}function handleEntityNotFound(_0x2acda2,_0x1c119f){return function(_0x11f863){if(!_0x11f863){_0x2acda2[_0xc8b7('0x26')](0x194);}return _0x11f863;};}function handleError(_0x1439ee,_0x50a33d){_0x50a33d=_0x50a33d||0x1f4;return function(_0x28e65d){logger[_0xc8b7('0x27')](_0x28e65d[_0xc8b7('0x28')]);if(_0x28e65d[_0xc8b7('0x29')]){delete _0x28e65d[_0xc8b7('0x29')];}_0x1439ee[_0xc8b7('0x1a')](_0x50a33d)['send'](_0x28e65d);};}exports['index']=function(_0x16cc83,_0x13ac30){var _0x1eff90={},_0x2a2b25={},_0x24b0b1={'count':0x0,'rows':[]};var _0x17cae3=_[_0xc8b7('0x2a')](db['FaxQueueReport'][_0xc8b7('0x2b')],function(_0x3d6f00){return{'name':_0x3d6f00[_0xc8b7('0x2c')],'type':_0x3d6f00[_0xc8b7('0x2d')][_0xc8b7('0x2e')]};});_0x2a2b25[_0xc8b7('0x2f')]=_[_0xc8b7('0x2a')](_0x17cae3,_0xc8b7('0x29'));_0x2a2b25['query']=_[_0xc8b7('0x30')](_0x16cc83[_0xc8b7('0x31')]);_0x2a2b25[_0xc8b7('0x32')]=_[_0xc8b7('0x33')](_0x2a2b25[_0xc8b7('0x2f')],_0x2a2b25[_0xc8b7('0x31')]);_0x1eff90[_0xc8b7('0x34')]=_[_0xc8b7('0x33')](_0x2a2b25[_0xc8b7('0x2f')],qs[_0xc8b7('0x35')](_0x16cc83[_0xc8b7('0x31')][_0xc8b7('0x35')]));_0x1eff90[_0xc8b7('0x34')]=_0x1eff90['attributes']['length']?_0x1eff90[_0xc8b7('0x34')]:_0x2a2b25['model'];if(!_0x16cc83[_0xc8b7('0x31')][_0xc8b7('0x36')](_0xc8b7('0x37'))){_0x1eff90[_0xc8b7('0x1f')]=qs[_0xc8b7('0x1f')](_0x16cc83['query'][_0xc8b7('0x1f')]);_0x1eff90['offset']=qs[_0xc8b7('0x1d')](_0x16cc83[_0xc8b7('0x31')][_0xc8b7('0x1d')]);}_0x1eff90[_0xc8b7('0x38')]=qs[_0xc8b7('0x39')](_0x16cc83[_0xc8b7('0x31')][_0xc8b7('0x39')]);_0x1eff90[_0xc8b7('0x3a')]=qs[_0xc8b7('0x32')](_[_0xc8b7('0x3b')](_0x16cc83[_0xc8b7('0x31')],_0x2a2b25[_0xc8b7('0x32')]),_0x17cae3);if(_0x16cc83[_0xc8b7('0x31')][_0xc8b7('0x3c')]){_0x1eff90[_0xc8b7('0x3a')]=_[_0xc8b7('0x3d')](_0x1eff90['where'],{'$or':_[_0xc8b7('0x2a')](_0x17cae3,function(_0x4a7169){if(_0x4a7169[_0xc8b7('0x2d')]!==_0xc8b7('0x3e')){var _0x2c2cf4={};_0x2c2cf4[_0x4a7169[_0xc8b7('0x29')]]={'$like':'%'+_0x16cc83['query'][_0xc8b7('0x3c')]+'%'};return _0x2c2cf4;}})});}_0x1eff90=_[_0xc8b7('0x3d')]({},_0x1eff90,_0x16cc83[_0xc8b7('0x3f')]);var _0x31f1c4={'where':_0x1eff90['where']};return db['FaxQueueReport'][_0xc8b7('0x20')](_0x31f1c4)[_0xc8b7('0x24')](function(_0x3a9551){_0x24b0b1['count']=_0x3a9551;if(_0x16cc83['query'][_0xc8b7('0x40')]){_0x1eff90[_0xc8b7('0x41')]=[{'all':!![]}];}return db[_0xc8b7('0x42')][_0xc8b7('0x43')](_0x1eff90);})[_0xc8b7('0x24')](function(_0x3ab722){_0x24b0b1[_0xc8b7('0x44')]=_0x3ab722;return _0x24b0b1;})[_0xc8b7('0x24')](respondWithFilteredResult(_0x13ac30,_0x1eff90))[_0xc8b7('0x45')](handleError(_0x13ac30,null));};exports[_0xc8b7('0x46')]=function(_0x131ae2,_0x53beea){var _0xf33dae={'raw':!![],'where':{'id':_0x131ae2['params']['id']}},_0x3d86af={};_0x3d86af['model']=_[_0xc8b7('0x30')](db[_0xc8b7('0x42')]['rawAttributes']);_0x3d86af[_0xc8b7('0x31')]=_[_0xc8b7('0x30')](_0x131ae2[_0xc8b7('0x31')]);_0x3d86af[_0xc8b7('0x32')]=_[_0xc8b7('0x33')](_0x3d86af[_0xc8b7('0x2f')],_0x3d86af[_0xc8b7('0x31')]);_0xf33dae[_0xc8b7('0x34')]=_[_0xc8b7('0x33')](_0x3d86af[_0xc8b7('0x2f')],qs[_0xc8b7('0x35')](_0x131ae2['query']['fields']));_0xf33dae[_0xc8b7('0x34')]=_0xf33dae['attributes'][_0xc8b7('0x47')]?_0xf33dae[_0xc8b7('0x34')]:_0x3d86af[_0xc8b7('0x2f')];if(_0x131ae2[_0xc8b7('0x31')][_0xc8b7('0x40')]){_0xf33dae[_0xc8b7('0x41')]=[{'all':!![]}];}_0xf33dae=_[_0xc8b7('0x3d')]({},_0xf33dae,_0x131ae2['options']);return db[_0xc8b7('0x42')][_0xc8b7('0x48')](_0xf33dae)[_0xc8b7('0x24')](handleEntityNotFound(_0x53beea,null))[_0xc8b7('0x24')](respondWithResult(_0x53beea,null))[_0xc8b7('0x45')](handleError(_0x53beea,null));};exports[_0xc8b7('0x49')]=function(_0x32d826,_0xccb0da){return db[_0xc8b7('0x42')][_0xc8b7('0x49')](_0x32d826[_0xc8b7('0x4a')],{})[_0xc8b7('0x24')](respondWithResult(_0xccb0da,0xc9))[_0xc8b7('0x45')](handleError(_0xccb0da,null));};exports[_0xc8b7('0x23')]=function(_0x493681,_0x3bd1c8){if(_0x493681[_0xc8b7('0x4a')]['id']){delete _0x493681[_0xc8b7('0x4a')]['id'];}return db[_0xc8b7('0x42')][_0xc8b7('0x48')]({'where':{'id':_0x493681['params']['id']}})[_0xc8b7('0x24')](handleEntityNotFound(_0x3bd1c8,null))[_0xc8b7('0x24')](saveUpdates(_0x493681['body'],null))[_0xc8b7('0x24')](respondWithResult(_0x3bd1c8,null))[_0xc8b7('0x45')](handleError(_0x3bd1c8,null));};exports[_0xc8b7('0x25')]=function(_0x7941a1,_0xc72a6){return db[_0xc8b7('0x42')]['find']({'where':{'id':_0x7941a1[_0xc8b7('0x4b')]['id']}})[_0xc8b7('0x24')](handleEntityNotFound(_0xc72a6,null))['then'](removeEntity(_0xc72a6,null))[_0xc8b7('0x45')](handleError(_0xc72a6,null));};exports[_0xc8b7('0x4c')]=function(_0x538958,_0x47e42c){return db[_0xc8b7('0x42')]['describe']()['then'](respondWithResult(_0x47e42c,null))[_0xc8b7('0x45')](handleError(_0x47e42c,null));}; \ No newline at end of file +var _0x1306=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','type','VIRTUAL','filter','then','includeAll','include','findAll','rows','show','params','keys','length','options','find','catch','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1306,0x17a));var _0x6130=function(_0x372960,_0x7e7203){_0x372960=_0x372960-0x0;var _0x34142c=_0x1306[_0x372960];return _0x34142c;};'use strict';var emlformat=require(_0x6130('0x0'));var rimraf=require(_0x6130('0x1'));var zipdir=require(_0x6130('0x2'));var jsonpatch=require(_0x6130('0x3'));var rp=require(_0x6130('0x4'));var moment=require(_0x6130('0x5'));var BPromise=require(_0x6130('0x6'));var Mustache=require(_0x6130('0x7'));var util=require(_0x6130('0x8'));var path=require(_0x6130('0x9'));var sox=require(_0x6130('0xa'));var csv=require(_0x6130('0xb'));var ejs=require(_0x6130('0xc'));var fs=require('fs');var fs_extra=require(_0x6130('0xd'));var _=require(_0x6130('0xe'));var squel=require(_0x6130('0xf'));var crypto=require(_0x6130('0x10'));var jsforce=require(_0x6130('0x11'));var deskjs=require(_0x6130('0x12'));var toCsv=require(_0x6130('0xb'));var querystring=require(_0x6130('0x13'));var Papa=require(_0x6130('0x14'));var Redis=require(_0x6130('0x15'));var authService=require(_0x6130('0x16'));var qs=require(_0x6130('0x17'));var as=require(_0x6130('0x18'));var hardwareService=require(_0x6130('0x19'));var logger=require(_0x6130('0x1a'))(_0x6130('0x1b'));var utils=require('../../config/utils');var config=require(_0x6130('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x6130('0x1d'))['db'];function respondWithStatusCode(_0x2fbf3d,_0x5e0234){_0x5e0234=_0x5e0234||0xcc;return function(_0x1c0339){if(_0x1c0339){return _0x2fbf3d[_0x6130('0x1e')](_0x5e0234);}return _0x2fbf3d[_0x6130('0x1f')](_0x5e0234)[_0x6130('0x20')]();};}function respondWithResult(_0x1d736c,_0x3470e8){_0x3470e8=_0x3470e8||0xc8;return function(_0x4cdac6){if(_0x4cdac6){return _0x1d736c[_0x6130('0x1f')](_0x3470e8)[_0x6130('0x21')](_0x4cdac6);}};}function respondWithFilteredResult(_0x3ef4c1,_0x401a70){return function(_0x4626a2){if(_0x4626a2){var _0x39b444=typeof _0x401a70[_0x6130('0x22')]===_0x6130('0x23')&&typeof _0x401a70[_0x6130('0x24')]==='undefined';var _0x4b9a20=_0x4626a2[_0x6130('0x25')];var _0x49803e=_0x39b444?0x0:_0x401a70[_0x6130('0x22')];var _0xb6575d=_0x39b444?_0x4626a2[_0x6130('0x25')]:_0x401a70[_0x6130('0x22')]+_0x401a70[_0x6130('0x24')];var _0x4b4b35;if(_0xb6575d>=_0x4b9a20){_0xb6575d=_0x4b9a20;_0x4b4b35=0xc8;}else{_0x4b4b35=0xce;}_0x3ef4c1[_0x6130('0x1f')](_0x4b4b35);return _0x3ef4c1['set'](_0x6130('0x26'),_0x49803e+'-'+_0xb6575d+'/'+_0x4b9a20)[_0x6130('0x21')](_0x4626a2);}return null;};}function patchUpdates(_0x18bb78){return function(_0x1839db){try{jsonpatch[_0x6130('0x27')](_0x1839db,_0x18bb78,!![]);}catch(_0x5c8b08){return BPromise['reject'](_0x5c8b08);}return _0x1839db[_0x6130('0x28')]();};}function saveUpdates(_0x534390,_0x30b4f2){return function(_0x289c7b){if(_0x289c7b){return _0x289c7b['update'](_0x534390)['then'](function(_0x54fc67){return _0x54fc67;});}return null;};}function removeEntity(_0x2a8aad,_0x5369e3){return function(_0x371b84){if(_0x371b84){return _0x371b84['destroy']()['then'](function(){_0x2a8aad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5069bf,_0x140468){return function(_0x1ba07d){if(!_0x1ba07d){_0x5069bf['sendStatus'](0x194);}return _0x1ba07d;};}function handleError(_0x188657,_0x552c54){_0x552c54=_0x552c54||0x1f4;return function(_0x306935){logger['error'](_0x306935['stack']);if(_0x306935[_0x6130('0x29')]){delete _0x306935[_0x6130('0x29')];}_0x188657[_0x6130('0x1f')](_0x552c54)[_0x6130('0x2a')](_0x306935);};}exports[_0x6130('0x2b')]=function(_0x392386,_0x2aa0e3){var _0x19eb47={},_0x14dff0={},_0x5809e4={'count':0x0,'rows':[]};var _0x5363cc=_[_0x6130('0x2c')](db[_0x6130('0x2d')][_0x6130('0x2e')],function(_0x4345ac){return{'name':_0x4345ac[_0x6130('0x2f')],'type':_0x4345ac['type'][_0x6130('0x30')]};});_0x14dff0[_0x6130('0x31')]=_[_0x6130('0x2c')](_0x5363cc,_0x6130('0x29'));_0x14dff0[_0x6130('0x32')]=_['keys'](_0x392386[_0x6130('0x32')]);_0x14dff0[_0x6130('0x33')]=_[_0x6130('0x34')](_0x14dff0['model'],_0x14dff0[_0x6130('0x32')]);_0x19eb47[_0x6130('0x35')]=_[_0x6130('0x34')](_0x14dff0[_0x6130('0x31')],qs[_0x6130('0x36')](_0x392386[_0x6130('0x32')][_0x6130('0x36')]));_0x19eb47[_0x6130('0x35')]=_0x19eb47[_0x6130('0x35')]['length']?_0x19eb47[_0x6130('0x35')]:_0x14dff0['model'];if(!_0x392386['query']['hasOwnProperty'](_0x6130('0x37'))){_0x19eb47[_0x6130('0x24')]=qs[_0x6130('0x24')](_0x392386[_0x6130('0x32')][_0x6130('0x24')]);_0x19eb47[_0x6130('0x22')]=qs[_0x6130('0x22')](_0x392386[_0x6130('0x32')]['offset']);}_0x19eb47[_0x6130('0x38')]=qs[_0x6130('0x39')](_0x392386['query'][_0x6130('0x39')]);_0x19eb47[_0x6130('0x3a')]=qs[_0x6130('0x33')](_['pick'](_0x392386[_0x6130('0x32')],_0x14dff0[_0x6130('0x33')]),_0x5363cc);if(_0x392386['query']['filter']){_0x19eb47[_0x6130('0x3a')]=_[_0x6130('0x3b')](_0x19eb47[_0x6130('0x3a')],{'$or':_['map'](_0x5363cc,function(_0x596c98){if(_0x596c98[_0x6130('0x3c')]!==_0x6130('0x3d')){var _0x3c6aac={};_0x3c6aac[_0x596c98[_0x6130('0x29')]]={'$like':'%'+_0x392386[_0x6130('0x32')][_0x6130('0x3e')]+'%'};return _0x3c6aac;}})});}_0x19eb47=_[_0x6130('0x3b')]({},_0x19eb47,_0x392386['options']);var _0x45bfe0={'where':_0x19eb47[_0x6130('0x3a')]};return db[_0x6130('0x2d')][_0x6130('0x25')](_0x45bfe0)[_0x6130('0x3f')](function(_0x3249f2){_0x5809e4[_0x6130('0x25')]=_0x3249f2;if(_0x392386['query'][_0x6130('0x40')]){_0x19eb47[_0x6130('0x41')]=[{'all':!![]}];}return db[_0x6130('0x2d')][_0x6130('0x42')](_0x19eb47);})[_0x6130('0x3f')](function(_0x142385){_0x5809e4[_0x6130('0x43')]=_0x142385;return _0x5809e4;})[_0x6130('0x3f')](respondWithFilteredResult(_0x2aa0e3,_0x19eb47))['catch'](handleError(_0x2aa0e3,null));};exports[_0x6130('0x44')]=function(_0x154891,_0x6eebc6){var _0x4c727b={'raw':!![],'where':{'id':_0x154891[_0x6130('0x45')]['id']}},_0x176506={};_0x176506[_0x6130('0x31')]=_['keys'](db['FaxQueueReport'][_0x6130('0x2e')]);_0x176506[_0x6130('0x32')]=_[_0x6130('0x46')](_0x154891[_0x6130('0x32')]);_0x176506[_0x6130('0x33')]=_['intersection'](_0x176506[_0x6130('0x31')],_0x176506[_0x6130('0x32')]);_0x4c727b['attributes']=_[_0x6130('0x34')](_0x176506[_0x6130('0x31')],qs[_0x6130('0x36')](_0x154891[_0x6130('0x32')][_0x6130('0x36')]));_0x4c727b[_0x6130('0x35')]=_0x4c727b[_0x6130('0x35')][_0x6130('0x47')]?_0x4c727b['attributes']:_0x176506['model'];if(_0x154891[_0x6130('0x32')]['includeAll']){_0x4c727b[_0x6130('0x41')]=[{'all':!![]}];}_0x4c727b=_[_0x6130('0x3b')]({},_0x4c727b,_0x154891[_0x6130('0x48')]);return db[_0x6130('0x2d')][_0x6130('0x49')](_0x4c727b)[_0x6130('0x3f')](handleEntityNotFound(_0x6eebc6,null))[_0x6130('0x3f')](respondWithResult(_0x6eebc6,null))[_0x6130('0x4a')](handleError(_0x6eebc6,null));};exports[_0x6130('0x4b')]=function(_0x19dcb7,_0x3936a8){return db['FaxQueueReport'][_0x6130('0x4b')](_0x19dcb7[_0x6130('0x4c')],{})[_0x6130('0x3f')](respondWithResult(_0x3936a8,0xc9))[_0x6130('0x4a')](handleError(_0x3936a8,null));};exports[_0x6130('0x4d')]=function(_0x13f591,_0x35939b){if(_0x13f591[_0x6130('0x4c')]['id']){delete _0x13f591[_0x6130('0x4c')]['id'];}return db[_0x6130('0x2d')]['find']({'where':{'id':_0x13f591[_0x6130('0x45')]['id']}})[_0x6130('0x3f')](handleEntityNotFound(_0x35939b,null))[_0x6130('0x3f')](saveUpdates(_0x13f591[_0x6130('0x4c')],null))[_0x6130('0x3f')](respondWithResult(_0x35939b,null))[_0x6130('0x4a')](handleError(_0x35939b,null));};exports[_0x6130('0x4e')]=function(_0x37ee0c,_0x3a64ef){return db['FaxQueueReport'][_0x6130('0x49')]({'where':{'id':_0x37ee0c[_0x6130('0x45')]['id']}})[_0x6130('0x3f')](handleEntityNotFound(_0x3a64ef,null))[_0x6130('0x3f')](removeEntity(_0x3a64ef,null))[_0x6130('0x4a')](handleError(_0x3a64ef,null));};exports[_0x6130('0x4f')]=function(_0x50960d,_0x14e02d){return db[_0x6130('0x2d')][_0x6130('0x4f')]()['then'](respondWithResult(_0x14e02d,null))['catch'](handleError(_0x14e02d,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 4268db5..0a00e3d 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 _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x5187d1,_0x138df9){var _0x1c00d3=function(_0x473d24){while(--_0x473d24){_0x5187d1['push'](_0x5187d1['shift']());}};_0x1c00d3(++_0x138df9);}(_0xf494,0x1c6));var _0x4f49=function(_0x5424d1,_0x21733d){_0x5424d1=_0x5424d1-0x0;var _0x3eeb7e=_0xf494[_0x5424d1];return _0x3eeb7e;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('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(_0x3d398b,_0x542808){var _0xaf8fd4=function(_0x112ac6){while(--_0x112ac6){_0x3d398b['push'](_0x3d398b['shift']());}};_0xaf8fd4(++_0x542808);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3ff685,_0x304b9e){_0x3ff685=_0x3ff685-0x0;var _0x2046c9=_0x5fc3[_0x3ff685];return _0x2046c9;};'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 32985e6..753e537 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 _0x01b2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring'];(function(_0x39ccac,_0x280fd7){var _0x434603=function(_0x56ca60){while(--_0x56ca60){_0x39ccac['push'](_0x39ccac['shift']());}};_0x434603(++_0x280fd7);}(_0x01b2,0xc8));var _0x201b=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x01b2[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0x201b('0x0'));var util=require('util');var moment=require(_0x201b('0x1'));var BPromise=require(_0x201b('0x2'));var rs=require(_0x201b('0x3'));var fs=require('fs');var Redis=require(_0x201b('0x4'));var db=require(_0x201b('0x5'))['db'];var utils=require(_0x201b('0x6'));var logger=require(_0x201b('0x7'))(_0x201b('0x8'));var config=require('../../config/environment');var jayson=require(_0x201b('0x9'));var client=jayson['client'][_0x201b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4216cd,_0x4c0089,_0x45bb41){return new BPromise(function(_0x9e42a0,_0x71b57e){return client[_0x201b('0xb')](_0x4216cd,_0x45bb41)[_0x201b('0xc')](function(_0x353219){logger[_0x201b('0xd')](_0x201b('0xe'),_0x4c0089,'request\x20sent');logger[_0x201b('0xf')](_0x201b('0x10'),_0x4c0089,_0x201b('0x11'),JSON['stringify'](_0x353219));if(_0x353219['error']){if(_0x353219[_0x201b('0x12')][_0x201b('0x13')]===0x1f4){logger[_0x201b('0x12')](_0x201b('0xe'),_0x4c0089,_0x353219[_0x201b('0x12')]['message']);return _0x71b57e(_0x353219['error'][_0x201b('0x14')]);}logger[_0x201b('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x4c0089,_0x353219['error']['message']);return _0x9e42a0(_0x353219[_0x201b('0x12')]['message']);}else{logger[_0x201b('0xd')](_0x201b('0xe'),_0x4c0089,'request\x20sent');_0x9e42a0(_0x353219[_0x201b('0x15')][_0x201b('0x14')]);}})[_0x201b('0x16')](function(_0xda83bd){logger[_0x201b('0x12')](_0x201b('0xe'),_0x4c0089,_0xda83bd);_0x71b57e(_0xda83bd);});});}exports['CreateFaxQueueReport']=function(_0x3a113e){var _0x230f0e=this;return new Promise(function(_0x1b4492,_0x120d3f){return db[_0x201b('0x17')][_0x201b('0x18')](_0x3a113e[_0x201b('0x19')],{'raw':_0x3a113e[_0x201b('0x1a')]?_0x3a113e['options'][_0x201b('0x1b')]===undefined?!![]:![]:!![]})[_0x201b('0xc')](function(_0x42f997){logger[_0x201b('0xd')](_0x201b('0x1c'),_0x3a113e);logger[_0x201b('0xf')](_0x201b('0x1c'),_0x3a113e,JSON['stringify'](_0x42f997));_0x1b4492(_0x42f997);})['catch'](function(_0x3d041a){logger['error'](_0x201b('0x1c'),_0x3d041a[_0x201b('0x14')],_0x3a113e);_0x120d3f(_0x230f0e[_0x201b('0x12')](0x1f4,_0x3d041a[_0x201b('0x14')]));});});};exports[_0x201b('0x1d')]=function(_0xf60525){var _0xfc88=this;return new Promise(function(_0x28fd03,_0x2324af){return db[_0x201b('0x17')][_0x201b('0x1e')](_0xf60525[_0x201b('0x19')],{'raw':_0xf60525[_0x201b('0x1a')]?_0xf60525[_0x201b('0x1a')][_0x201b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf60525[_0x201b('0x1a')]?_0xf60525[_0x201b('0x1a')][_0x201b('0x1f')]||null:null,'attributes':_0xf60525[_0x201b('0x1a')]?_0xf60525[_0x201b('0x1a')][_0x201b('0x20')]||null:null,'limit':_0xf60525[_0x201b('0x1a')]?_0xf60525['options'][_0x201b('0x21')]||null:null})[_0x201b('0xc')](function(_0x1ab2a0){logger[_0x201b('0xd')](_0x201b('0x1d'),_0xf60525);logger[_0x201b('0xf')](_0x201b('0x1d'),_0xf60525,JSON['stringify'](_0x1ab2a0));_0x28fd03(_0x1ab2a0);})[_0x201b('0x16')](function(_0x3ed913){logger[_0x201b('0x12')](_0x201b('0x1d'),_0x3ed913[_0x201b('0x14')],_0xf60525);_0x2324af(_0xfc88[_0x201b('0x12')](0x1f4,_0x3ed913[_0x201b('0x14')]));});});}; \ No newline at end of file +var _0xbe04=['FaxQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','stringify','UpdateFaxQueueReport','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2f3968,_0x596606){var _0x35d098=function(_0x56f450){while(--_0x56f450){_0x2f3968['push'](_0x2f3968['shift']());}};_0x35d098(++_0x596606);}(_0xbe04,0xe8));var _0x4be0=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0xbe04[_0xa9a245];return _0x2d0eaa;};'use strict';var _=require(_0x4be0('0x0'));var util=require('util');var moment=require(_0x4be0('0x1'));var BPromise=require(_0x4be0('0x2'));var rs=require(_0x4be0('0x3'));var fs=require('fs');var Redis=require(_0x4be0('0x4'));var db=require(_0x4be0('0x5'))['db'];var utils=require(_0x4be0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4be0('0x7'));var jayson=require(_0x4be0('0x8'));var client=jayson[_0x4be0('0x9')][_0x4be0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46d65e,_0x1912bf,_0x2d3cb4){return new BPromise(function(_0x2b69ec,_0x3b939c){return client[_0x4be0('0xb')](_0x46d65e,_0x2d3cb4)[_0x4be0('0xc')](function(_0x399d7e){logger['info'](_0x4be0('0xd'),_0x1912bf,_0x4be0('0xe'));logger[_0x4be0('0xf')](_0x4be0('0x10'),_0x1912bf,_0x4be0('0xe'),JSON['stringify'](_0x399d7e));if(_0x399d7e[_0x4be0('0x11')]){if(_0x399d7e[_0x4be0('0x11')]['code']===0x1f4){logger[_0x4be0('0x11')](_0x4be0('0xd'),_0x1912bf,_0x399d7e[_0x4be0('0x11')][_0x4be0('0x12')]);return _0x3b939c(_0x399d7e[_0x4be0('0x11')][_0x4be0('0x12')]);}logger[_0x4be0('0x11')](_0x4be0('0xd'),_0x1912bf,_0x399d7e[_0x4be0('0x11')][_0x4be0('0x12')]);return _0x2b69ec(_0x399d7e[_0x4be0('0x11')][_0x4be0('0x12')]);}else{logger[_0x4be0('0x13')](_0x4be0('0xd'),_0x1912bf,'request\x20sent');_0x2b69ec(_0x399d7e[_0x4be0('0x14')][_0x4be0('0x12')]);}})[_0x4be0('0x15')](function(_0x38b034){logger[_0x4be0('0x11')](_0x4be0('0xd'),_0x1912bf,_0x38b034);_0x3b939c(_0x38b034);});});}exports[_0x4be0('0x16')]=function(_0x50625c){var _0x1e1177=this;return new Promise(function(_0x542fdb,_0x462823){return db[_0x4be0('0x17')]['create'](_0x50625c[_0x4be0('0x18')],{'raw':_0x50625c[_0x4be0('0x19')]?_0x50625c[_0x4be0('0x19')][_0x4be0('0x1a')]===undefined?!![]:![]:!![]})[_0x4be0('0xc')](function(_0x5593ea){logger[_0x4be0('0x13')]('CreateFaxQueueReport',_0x50625c);logger[_0x4be0('0xf')](_0x4be0('0x16'),_0x50625c,JSON[_0x4be0('0x1b')](_0x5593ea));_0x542fdb(_0x5593ea);})[_0x4be0('0x15')](function(_0xd944ec){logger['error'](_0x4be0('0x16'),_0xd944ec['message'],_0x50625c);_0x462823(_0x1e1177[_0x4be0('0x11')](0x1f4,_0xd944ec[_0x4be0('0x12')]));});});};exports[_0x4be0('0x1c')]=function(_0x4a39ef){var _0x47f9fd=this;return new Promise(function(_0x5c01a3,_0x421fa3){return db[_0x4be0('0x17')]['update'](_0x4a39ef[_0x4be0('0x18')],{'raw':_0x4a39ef[_0x4be0('0x19')]?_0x4a39ef[_0x4be0('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a39ef[_0x4be0('0x19')]?_0x4a39ef['options'][_0x4be0('0x1d')]||null:null,'attributes':_0x4a39ef[_0x4be0('0x19')]?_0x4a39ef[_0x4be0('0x19')]['attributes']||null:null,'limit':_0x4a39ef[_0x4be0('0x19')]?_0x4a39ef[_0x4be0('0x19')][_0x4be0('0x1e')]||null:null})['then'](function(_0x2bf3a1){logger[_0x4be0('0x13')]('UpdateFaxQueueReport',_0x4a39ef);logger['debug'](_0x4be0('0x1c'),_0x4a39ef,JSON['stringify'](_0x2bf3a1));_0x5c01a3(_0x2bf3a1);})['catch'](function(_0xb9b315){logger[_0x4be0('0x11')](_0x4be0('0x1c'),_0xb9b315[_0x4be0('0x12')],_0x4a39ef);_0x421fa3(_0x47f9fd[_0x4be0('0x11')](0x1f4,_0xb9b315[_0x4be0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index c8d60d5..25b5a59 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 _0xe24e=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','post','create','put','update','delete','/:id'];(function(_0x21c78f,_0x5eb9a3){var _0x1fdd8d=function(_0x57f69c){while(--_0x57f69c){_0x21c78f['push'](_0x21c78f['shift']());}};_0x1fdd8d(++_0x5eb9a3);}(_0xe24e,0x14c));var _0xee24=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0xe24e[_0x5eef05];return _0x56d4b8;};'use strict';var multer=require(_0xee24('0x0'));var util=require(_0xee24('0x1'));var path=require(_0xee24('0x2'));var timeout=require(_0xee24('0x3'));var express=require(_0xee24('0x4'));var router=express[_0xee24('0x5')]();var fs_extra=require(_0xee24('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xee24('0x7'));var controller=require(_0xee24('0x8'));router[_0xee24('0x9')]('/',auth['isAuthenticated'](),controller[_0xee24('0xa')]);router[_0xee24('0x9')](_0xee24('0xb'),auth[_0xee24('0xc')](),controller[_0xee24('0xd')]);router['get']('/:id',auth[_0xee24('0xc')](),controller['show']);router[_0xee24('0xe')]('/',auth[_0xee24('0xc')](),controller[_0xee24('0xf')]);router[_0xee24('0x10')]('/:id',auth[_0xee24('0xc')](),controller[_0xee24('0x11')]);router[_0xee24('0x12')](_0xee24('0x13'),auth[_0xee24('0xc')](),controller[_0xee24('0x14')]);module[_0xee24('0x15')]=router; \ No newline at end of file +var _0x30fc=['show','put','/:id','update','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe'];(function(_0x2d9eaa,_0x272c56){var _0x5bf0f8=function(_0x28d427){while(--_0x28d427){_0x2d9eaa['push'](_0x2d9eaa['shift']());}};_0x5bf0f8(++_0x272c56);}(_0x30fc,0x1a3));var _0xc30f=function(_0x5694d3,_0x2e3008){_0x5694d3=_0x5694d3-0x0;var _0x1ca96e=_0x30fc[_0x5694d3];return _0x1ca96e;};'use strict';var multer=require('multer');var util=require(_0xc30f('0x0'));var path=require(_0xc30f('0x1'));var timeout=require('connect-timeout');var express=require(_0xc30f('0x2'));var router=express[_0xc30f('0x3')]();var fs_extra=require(_0xc30f('0x4'));var auth=require(_0xc30f('0x5'));var interaction=require(_0xc30f('0x6'));var config=require(_0xc30f('0x7'));var controller=require(_0xc30f('0x8'));router[_0xc30f('0x9')]('/',auth[_0xc30f('0xa')](),controller[_0xc30f('0xb')]);router[_0xc30f('0x9')]('/describe',auth[_0xc30f('0xa')](),controller[_0xc30f('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc30f('0xd')]);router['post']('/',auth[_0xc30f('0xa')](),controller['create']);router[_0xc30f('0xe')](_0xc30f('0xf'),auth[_0xc30f('0xa')](),controller[_0xc30f('0x10')]);router['delete'](_0xc30f('0xf'),auth[_0xc30f('0xa')](),controller[_0xc30f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 83c30e4..e209809 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x9e505,_0x535df6){var _0x408f96=function(_0x504a32){while(--_0x504a32){_0x9e505['push'](_0x9e505['shift']());}};_0x408f96(++_0x535df6);}(_0x70e0,0x17b));var _0x070e=function(_0x3985c6,_0x106a46){_0x3985c6=_0x3985c6-0x0;var _0xeda21a=_0x70e0[_0x3985c6];return _0xeda21a;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x57d2a9,_0x1e834f){var _0x223a1=function(_0x426046){while(--_0x426046){_0x57d2a9['push'](_0x57d2a9['shift']());}};_0x223a1(++_0x1e834f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0xf3cd[_0x2d344f];return _0x2e796b;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index afff16f..966081e 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 _0x7df9=['model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','filter','options','findAll','rows','catch','params','includeAll','include','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','map','FaxTransferReport','rawAttributes','fieldName','type','key'];(function(_0x1d22c0,_0x4dd473){var _0x3f9df7=function(_0x9f9153){while(--_0x9f9153){_0x1d22c0['push'](_0x1d22c0['shift']());}};_0x3f9df7(++_0x4dd473);}(_0x7df9,0x195));var _0x97df=function(_0x233c20,_0x39082d){_0x233c20=_0x233c20-0x0;var _0x296971=_0x7df9[_0x233c20];return _0x296971;};'use strict';var emlformat=require(_0x97df('0x0'));var rimraf=require(_0x97df('0x1'));var zipdir=require(_0x97df('0x2'));var jsonpatch=require(_0x97df('0x3'));var rp=require(_0x97df('0x4'));var moment=require(_0x97df('0x5'));var BPromise=require(_0x97df('0x6'));var Mustache=require(_0x97df('0x7'));var util=require(_0x97df('0x8'));var path=require(_0x97df('0x9'));var sox=require('sox');var csv=require(_0x97df('0xa'));var ejs=require(_0x97df('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97df('0xc'));var squel=require(_0x97df('0xd'));var crypto=require(_0x97df('0xe'));var jsforce=require(_0x97df('0xf'));var deskjs=require(_0x97df('0x10'));var toCsv=require(_0x97df('0xa'));var querystring=require(_0x97df('0x11'));var Papa=require(_0x97df('0x12'));var Redis=require('ioredis');var authService=require(_0x97df('0x13'));var qs=require(_0x97df('0x14'));var as=require(_0x97df('0x15'));var hardwareService=require(_0x97df('0x16'));var logger=require(_0x97df('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x97df('0x18'));var licenseUtil=require(_0x97df('0x19'));var db=require(_0x97df('0x1a'))['db'];function respondWithStatusCode(_0x5aa17f,_0x115d60){_0x115d60=_0x115d60||0xcc;return function(_0x50a153){if(_0x50a153){return _0x5aa17f[_0x97df('0x1b')](_0x115d60);}return _0x5aa17f[_0x97df('0x1c')](_0x115d60)['end']();};}function respondWithResult(_0x5f4e8e,_0xa0cda0){_0xa0cda0=_0xa0cda0||0xc8;return function(_0x46f6aa){if(_0x46f6aa){return _0x5f4e8e['status'](_0xa0cda0)[_0x97df('0x1d')](_0x46f6aa);}};}function respondWithFilteredResult(_0x226a99,_0x48bdee){return function(_0xd20c1){if(_0xd20c1){var _0x2b8e0c=typeof _0x48bdee[_0x97df('0x1e')]==='undefined'&&typeof _0x48bdee[_0x97df('0x1f')]===_0x97df('0x20');var _0x5cb947=_0xd20c1[_0x97df('0x21')];var _0x42d4f5=_0x2b8e0c?0x0:_0x48bdee[_0x97df('0x1e')];var _0x1cb62d=_0x2b8e0c?_0xd20c1['count']:_0x48bdee[_0x97df('0x1e')]+_0x48bdee[_0x97df('0x1f')];var _0x13289a;if(_0x1cb62d>=_0x5cb947){_0x1cb62d=_0x5cb947;_0x13289a=0xc8;}else{_0x13289a=0xce;}_0x226a99['status'](_0x13289a);return _0x226a99[_0x97df('0x22')](_0x97df('0x23'),_0x42d4f5+'-'+_0x1cb62d+'/'+_0x5cb947)[_0x97df('0x1d')](_0xd20c1);}return null;};}function patchUpdates(_0x9f1671){return function(_0x365b82){try{jsonpatch[_0x97df('0x24')](_0x365b82,_0x9f1671,!![]);}catch(_0x506f89){return BPromise[_0x97df('0x25')](_0x506f89);}return _0x365b82[_0x97df('0x26')]();};}function saveUpdates(_0x1b0360,_0x419a2a){return function(_0x225ef8){if(_0x225ef8){return _0x225ef8[_0x97df('0x27')](_0x1b0360)['then'](function(_0x2d7064){return _0x2d7064;});}return null;};}function removeEntity(_0x2cd023,_0x4e8ed5){return function(_0x306109){if(_0x306109){return _0x306109[_0x97df('0x28')]()[_0x97df('0x29')](function(){_0x2cd023[_0x97df('0x1c')](0xcc)[_0x97df('0x2a')]();});}};}function handleEntityNotFound(_0x19cdea,_0x318e57){return function(_0xd4e65b){if(!_0xd4e65b){_0x19cdea['sendStatus'](0x194);}return _0xd4e65b;};}function handleError(_0x4fd41f,_0x226afb){_0x226afb=_0x226afb||0x1f4;return function(_0x159872){logger[_0x97df('0x2b')](_0x159872['stack']);if(_0x159872[_0x97df('0x2c')]){delete _0x159872['name'];}_0x4fd41f[_0x97df('0x1c')](_0x226afb)['send'](_0x159872);};}exports['index']=function(_0x52342d,_0x48391d){var _0x35fcdf={},_0x2fc24e={},_0x359c34={'count':0x0,'rows':[]};var _0x122bf4=_[_0x97df('0x2d')](db[_0x97df('0x2e')][_0x97df('0x2f')],function(_0x5e3574){return{'name':_0x5e3574[_0x97df('0x30')],'type':_0x5e3574[_0x97df('0x31')][_0x97df('0x32')]};});_0x2fc24e[_0x97df('0x33')]=_['map'](_0x122bf4,_0x97df('0x2c'));_0x2fc24e[_0x97df('0x34')]=_[_0x97df('0x35')](_0x52342d[_0x97df('0x34')]);_0x2fc24e[_0x97df('0x36')]=_[_0x97df('0x37')](_0x2fc24e[_0x97df('0x33')],_0x2fc24e[_0x97df('0x34')]);_0x35fcdf['attributes']=_['intersection'](_0x2fc24e[_0x97df('0x33')],qs[_0x97df('0x38')](_0x52342d[_0x97df('0x34')][_0x97df('0x38')]));_0x35fcdf[_0x97df('0x39')]=_0x35fcdf[_0x97df('0x39')][_0x97df('0x3a')]?_0x35fcdf[_0x97df('0x39')]:_0x2fc24e[_0x97df('0x33')];if(!_0x52342d[_0x97df('0x34')]['hasOwnProperty'](_0x97df('0x3b'))){_0x35fcdf[_0x97df('0x1f')]=qs[_0x97df('0x1f')](_0x52342d['query'][_0x97df('0x1f')]);_0x35fcdf['offset']=qs[_0x97df('0x1e')](_0x52342d['query'][_0x97df('0x1e')]);}_0x35fcdf[_0x97df('0x3c')]=qs[_0x97df('0x3d')](_0x52342d[_0x97df('0x34')][_0x97df('0x3d')]);_0x35fcdf[_0x97df('0x3e')]=qs[_0x97df('0x36')](_[_0x97df('0x3f')](_0x52342d['query'],_0x2fc24e[_0x97df('0x36')]),_0x122bf4);if(_0x52342d[_0x97df('0x34')]['filter']){_0x35fcdf[_0x97df('0x3e')]=_[_0x97df('0x40')](_0x35fcdf['where'],{'$or':_[_0x97df('0x2d')](_0x122bf4,function(_0x1655e7){if(_0x1655e7['type']!=='VIRTUAL'){var _0x3e6d0a={};_0x3e6d0a[_0x1655e7[_0x97df('0x2c')]]={'$like':'%'+_0x52342d[_0x97df('0x34')][_0x97df('0x41')]+'%'};return _0x3e6d0a;}})});}_0x35fcdf=_[_0x97df('0x40')]({},_0x35fcdf,_0x52342d[_0x97df('0x42')]);var _0x5c4ae3={'where':_0x35fcdf[_0x97df('0x3e')]};return db['FaxTransferReport'][_0x97df('0x21')](_0x5c4ae3)[_0x97df('0x29')](function(_0x3604f6){_0x359c34[_0x97df('0x21')]=_0x3604f6;if(_0x52342d[_0x97df('0x34')]['includeAll']){_0x35fcdf['include']=[{'all':!![]}];}return db[_0x97df('0x2e')][_0x97df('0x43')](_0x35fcdf);})['then'](function(_0x4ca8ce){_0x359c34[_0x97df('0x44')]=_0x4ca8ce;return _0x359c34;})['then'](respondWithFilteredResult(_0x48391d,_0x35fcdf))[_0x97df('0x45')](handleError(_0x48391d,null));};exports['show']=function(_0x336b53,_0x38bc00){var _0x561e60={'raw':!![],'where':{'id':_0x336b53[_0x97df('0x46')]['id']}},_0xb8f79={};_0xb8f79[_0x97df('0x33')]=_[_0x97df('0x35')](db[_0x97df('0x2e')]['rawAttributes']);_0xb8f79[_0x97df('0x34')]=_[_0x97df('0x35')](_0x336b53['query']);_0xb8f79[_0x97df('0x36')]=_[_0x97df('0x37')](_0xb8f79[_0x97df('0x33')],_0xb8f79[_0x97df('0x34')]);_0x561e60[_0x97df('0x39')]=_[_0x97df('0x37')](_0xb8f79[_0x97df('0x33')],qs[_0x97df('0x38')](_0x336b53[_0x97df('0x34')]['fields']));_0x561e60[_0x97df('0x39')]=_0x561e60[_0x97df('0x39')][_0x97df('0x3a')]?_0x561e60[_0x97df('0x39')]:_0xb8f79['model'];if(_0x336b53[_0x97df('0x34')][_0x97df('0x47')]){_0x561e60[_0x97df('0x48')]=[{'all':!![]}];}_0x561e60=_[_0x97df('0x40')]({},_0x561e60,_0x336b53[_0x97df('0x42')]);return db[_0x97df('0x2e')][_0x97df('0x49')](_0x561e60)['then'](handleEntityNotFound(_0x38bc00,null))[_0x97df('0x29')](respondWithResult(_0x38bc00,null))[_0x97df('0x45')](handleError(_0x38bc00,null));};exports['create']=function(_0x19d6d4,_0x2d3492){return db[_0x97df('0x2e')]['create'](_0x19d6d4[_0x97df('0x4a')],{})[_0x97df('0x29')](respondWithResult(_0x2d3492,0xc9))[_0x97df('0x45')](handleError(_0x2d3492,null));};exports[_0x97df('0x27')]=function(_0x3d09d6,_0x7f7fd5){if(_0x3d09d6[_0x97df('0x4a')]['id']){delete _0x3d09d6['body']['id'];}return db['FaxTransferReport'][_0x97df('0x49')]({'where':{'id':_0x3d09d6[_0x97df('0x46')]['id']}})[_0x97df('0x29')](handleEntityNotFound(_0x7f7fd5,null))[_0x97df('0x29')](saveUpdates(_0x3d09d6[_0x97df('0x4a')],null))[_0x97df('0x29')](respondWithResult(_0x7f7fd5,null))[_0x97df('0x45')](handleError(_0x7f7fd5,null));};exports[_0x97df('0x28')]=function(_0x4cc68b,_0x1e31f3){return db[_0x97df('0x2e')][_0x97df('0x49')]({'where':{'id':_0x4cc68b[_0x97df('0x46')]['id']}})[_0x97df('0x29')](handleEntityNotFound(_0x1e31f3,null))[_0x97df('0x29')](removeEntity(_0x1e31f3,null))[_0x97df('0x45')](handleError(_0x1e31f3,null));};exports[_0x97df('0x4b')]=function(_0x29619d,_0x2c5cd6){return db[_0x97df('0x2e')][_0x97df('0x4b')]()[_0x97df('0x29')](respondWithResult(_0x2c5cd6,null))[_0x97df('0x45')](handleError(_0x2c5cd6,null));}; \ No newline at end of file +var _0x0787=['api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','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'];(function(_0x5857a7,_0x3f8601){var _0x2c35e4=function(_0x1e3492){while(--_0x1e3492){_0x5857a7['push'](_0x5857a7['shift']());}};_0x2c35e4(++_0x3f8601);}(_0x0787,0x123));var _0x7078=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0x0787[_0x1f5a63];return _0x30bb7a;};'use strict';var emlformat=require(_0x7078('0x0'));var rimraf=require(_0x7078('0x1'));var zipdir=require(_0x7078('0x2'));var jsonpatch=require(_0x7078('0x3'));var rp=require(_0x7078('0x4'));var moment=require(_0x7078('0x5'));var BPromise=require(_0x7078('0x6'));var Mustache=require('mustache');var util=require(_0x7078('0x7'));var path=require(_0x7078('0x8'));var sox=require(_0x7078('0x9'));var csv=require('to-csv');var ejs=require(_0x7078('0xa'));var fs=require('fs');var fs_extra=require(_0x7078('0xb'));var _=require(_0x7078('0xc'));var squel=require(_0x7078('0xd'));var crypto=require(_0x7078('0xe'));var jsforce=require(_0x7078('0xf'));var deskjs=require(_0x7078('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7078('0x11'));var Papa=require(_0x7078('0x12'));var Redis=require(_0x7078('0x13'));var authService=require(_0x7078('0x14'));var qs=require(_0x7078('0x15'));var as=require(_0x7078('0x16'));var hardwareService=require(_0x7078('0x17'));var logger=require(_0x7078('0x18'))(_0x7078('0x19'));var utils=require(_0x7078('0x1a'));var config=require(_0x7078('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x7078('0x1c'))['db'];function respondWithStatusCode(_0x233a4b,_0x1cd03f){_0x1cd03f=_0x1cd03f||0xcc;return function(_0x2b11e2){if(_0x2b11e2){return _0x233a4b['sendStatus'](_0x1cd03f);}return _0x233a4b[_0x7078('0x1d')](_0x1cd03f)[_0x7078('0x1e')]();};}function respondWithResult(_0x21c7b6,_0x33ece1){_0x33ece1=_0x33ece1||0xc8;return function(_0x93dae0){if(_0x93dae0){return _0x21c7b6[_0x7078('0x1d')](_0x33ece1)['json'](_0x93dae0);}};}function respondWithFilteredResult(_0x3ccfb7,_0x4a49bb){return function(_0x389263){if(_0x389263){var _0x2ad899=typeof _0x4a49bb[_0x7078('0x1f')]==='undefined'&&typeof _0x4a49bb[_0x7078('0x20')]===_0x7078('0x21');var _0x48afce=_0x389263[_0x7078('0x22')];var _0xe6babf=_0x2ad899?0x0:_0x4a49bb[_0x7078('0x1f')];var _0x354d12=_0x2ad899?_0x389263[_0x7078('0x22')]:_0x4a49bb['offset']+_0x4a49bb[_0x7078('0x20')];var _0x4ae8d8;if(_0x354d12>=_0x48afce){_0x354d12=_0x48afce;_0x4ae8d8=0xc8;}else{_0x4ae8d8=0xce;}_0x3ccfb7['status'](_0x4ae8d8);return _0x3ccfb7['set'](_0x7078('0x23'),_0xe6babf+'-'+_0x354d12+'/'+_0x48afce)[_0x7078('0x24')](_0x389263);}return null;};}function patchUpdates(_0x2d785a){return function(_0x3deec3){try{jsonpatch['apply'](_0x3deec3,_0x2d785a,!![]);}catch(_0x3f5f42){return BPromise[_0x7078('0x25')](_0x3f5f42);}return _0x3deec3[_0x7078('0x26')]();};}function saveUpdates(_0x165337,_0x3b70b6){return function(_0x2d7f15){if(_0x2d7f15){return _0x2d7f15[_0x7078('0x27')](_0x165337)[_0x7078('0x28')](function(_0x3d1b9c){return _0x3d1b9c;});}return null;};}function removeEntity(_0x3c862d,_0x4b480c){return function(_0x312ba){if(_0x312ba){return _0x312ba[_0x7078('0x29')]()[_0x7078('0x28')](function(){_0x3c862d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49df1e,_0x2f7ea0){return function(_0x3594ea){if(!_0x3594ea){_0x49df1e[_0x7078('0x2a')](0x194);}return _0x3594ea;};}function handleError(_0x7e3bbc,_0x22ff15){_0x22ff15=_0x22ff15||0x1f4;return function(_0x53c762){logger[_0x7078('0x2b')](_0x53c762[_0x7078('0x2c')]);if(_0x53c762[_0x7078('0x2d')]){delete _0x53c762['name'];}_0x7e3bbc[_0x7078('0x1d')](_0x22ff15)[_0x7078('0x2e')](_0x53c762);};}exports[_0x7078('0x2f')]=function(_0x1d2dd0,_0x2f203c){var _0x465c89={},_0x22e0b5={},_0xe14d84={'count':0x0,'rows':[]};var _0x19e5e6=_[_0x7078('0x30')](db[_0x7078('0x31')][_0x7078('0x32')],function(_0x47db47){return{'name':_0x47db47[_0x7078('0x33')],'type':_0x47db47[_0x7078('0x34')][_0x7078('0x35')]};});_0x22e0b5[_0x7078('0x36')]=_['map'](_0x19e5e6,_0x7078('0x2d'));_0x22e0b5[_0x7078('0x37')]=_['keys'](_0x1d2dd0[_0x7078('0x37')]);_0x22e0b5[_0x7078('0x38')]=_[_0x7078('0x39')](_0x22e0b5[_0x7078('0x36')],_0x22e0b5['query']);_0x465c89[_0x7078('0x3a')]=_[_0x7078('0x39')](_0x22e0b5[_0x7078('0x36')],qs['fields'](_0x1d2dd0['query'][_0x7078('0x3b')]));_0x465c89[_0x7078('0x3a')]=_0x465c89[_0x7078('0x3a')][_0x7078('0x3c')]?_0x465c89[_0x7078('0x3a')]:_0x22e0b5[_0x7078('0x36')];if(!_0x1d2dd0['query']['hasOwnProperty'](_0x7078('0x3d'))){_0x465c89[_0x7078('0x20')]=qs[_0x7078('0x20')](_0x1d2dd0[_0x7078('0x37')][_0x7078('0x20')]);_0x465c89['offset']=qs['offset'](_0x1d2dd0[_0x7078('0x37')]['offset']);}_0x465c89[_0x7078('0x3e')]=qs[_0x7078('0x3f')](_0x1d2dd0['query'][_0x7078('0x3f')]);_0x465c89[_0x7078('0x40')]=qs['filters'](_[_0x7078('0x41')](_0x1d2dd0[_0x7078('0x37')],_0x22e0b5[_0x7078('0x38')]),_0x19e5e6);if(_0x1d2dd0[_0x7078('0x37')]['filter']){_0x465c89[_0x7078('0x40')]=_[_0x7078('0x42')](_0x465c89['where'],{'$or':_[_0x7078('0x30')](_0x19e5e6,function(_0x3ffef7){if(_0x3ffef7[_0x7078('0x34')]!==_0x7078('0x43')){var _0x721054={};_0x721054[_0x3ffef7[_0x7078('0x2d')]]={'$like':'%'+_0x1d2dd0[_0x7078('0x37')]['filter']+'%'};return _0x721054;}})});}_0x465c89=_[_0x7078('0x42')]({},_0x465c89,_0x1d2dd0['options']);var _0x462343={'where':_0x465c89[_0x7078('0x40')]};return db[_0x7078('0x31')][_0x7078('0x22')](_0x462343)['then'](function(_0x20aa14){_0xe14d84[_0x7078('0x22')]=_0x20aa14;if(_0x1d2dd0[_0x7078('0x37')][_0x7078('0x44')]){_0x465c89[_0x7078('0x45')]=[{'all':!![]}];}return db[_0x7078('0x31')][_0x7078('0x46')](_0x465c89);})[_0x7078('0x28')](function(_0x2f90fb){_0xe14d84['rows']=_0x2f90fb;return _0xe14d84;})['then'](respondWithFilteredResult(_0x2f203c,_0x465c89))[_0x7078('0x47')](handleError(_0x2f203c,null));};exports[_0x7078('0x48')]=function(_0x2315bf,_0x29bc63){var _0x26b1af={'raw':!![],'where':{'id':_0x2315bf[_0x7078('0x49')]['id']}},_0x585ae1={};_0x585ae1[_0x7078('0x36')]=_[_0x7078('0x4a')](db[_0x7078('0x31')]['rawAttributes']);_0x585ae1['query']=_[_0x7078('0x4a')](_0x2315bf[_0x7078('0x37')]);_0x585ae1[_0x7078('0x38')]=_['intersection'](_0x585ae1[_0x7078('0x36')],_0x585ae1['query']);_0x26b1af[_0x7078('0x3a')]=_[_0x7078('0x39')](_0x585ae1[_0x7078('0x36')],qs[_0x7078('0x3b')](_0x2315bf[_0x7078('0x37')][_0x7078('0x3b')]));_0x26b1af[_0x7078('0x3a')]=_0x26b1af[_0x7078('0x3a')][_0x7078('0x3c')]?_0x26b1af['attributes']:_0x585ae1[_0x7078('0x36')];if(_0x2315bf[_0x7078('0x37')][_0x7078('0x44')]){_0x26b1af[_0x7078('0x45')]=[{'all':!![]}];}_0x26b1af=_[_0x7078('0x42')]({},_0x26b1af,_0x2315bf['options']);return db[_0x7078('0x31')]['find'](_0x26b1af)[_0x7078('0x28')](handleEntityNotFound(_0x29bc63,null))[_0x7078('0x28')](respondWithResult(_0x29bc63,null))[_0x7078('0x47')](handleError(_0x29bc63,null));};exports[_0x7078('0x4b')]=function(_0x25b58c,_0x1c3c9d){return db[_0x7078('0x31')][_0x7078('0x4b')](_0x25b58c[_0x7078('0x4c')],{})[_0x7078('0x28')](respondWithResult(_0x1c3c9d,0xc9))[_0x7078('0x47')](handleError(_0x1c3c9d,null));};exports[_0x7078('0x27')]=function(_0x93bbb0,_0x3cd32c){if(_0x93bbb0[_0x7078('0x4c')]['id']){delete _0x93bbb0[_0x7078('0x4c')]['id'];}return db[_0x7078('0x31')]['find']({'where':{'id':_0x93bbb0[_0x7078('0x49')]['id']}})['then'](handleEntityNotFound(_0x3cd32c,null))[_0x7078('0x28')](saveUpdates(_0x93bbb0[_0x7078('0x4c')],null))[_0x7078('0x28')](respondWithResult(_0x3cd32c,null))[_0x7078('0x47')](handleError(_0x3cd32c,null));};exports[_0x7078('0x29')]=function(_0x393b8f,_0x25786f){return db[_0x7078('0x31')][_0x7078('0x4d')]({'where':{'id':_0x393b8f[_0x7078('0x49')]['id']}})[_0x7078('0x28')](handleEntityNotFound(_0x25786f,null))[_0x7078('0x28')](removeEntity(_0x25786f,null))[_0x7078('0x47')](handleError(_0x25786f,null));};exports['describe']=function(_0x1db964,_0x5a8031){return db[_0x7078('0x31')][_0x7078('0x4e')]()[_0x7078('0x28')](respondWithResult(_0x5a8031,null))[_0x7078('0x47')](handleError(_0x5a8031,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 503ad02..56b6271 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 _0x4628=['define','report_fax_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports'];(function(_0x3aa86a,_0x42f018){var _0x50641d=function(_0x28efda){while(--_0x28efda){_0x3aa86a['push'](_0x3aa86a['shift']());}};_0x50641d(++_0x42f018);}(_0x4628,0xd3));var _0x8462=function(_0xc8074,_0x22af30){_0xc8074=_0xc8074-0x0;var _0x47e950=_0x4628[_0xc8074];return _0x47e950;};'use strict';var _=require(_0x8462('0x0'));var util=require(_0x8462('0x1'));var logger=require('../../config/logger')(_0x8462('0x2'));var moment=require(_0x8462('0x3'));var BPromise=require(_0x8462('0x4'));var rp=require(_0x8462('0x5'));var fs=require('fs');var path=require(_0x8462('0x6'));var rimraf=require('rimraf');var config=require(_0x8462('0x7'));var attributes=require(_0x8462('0x8'));module[_0x8462('0x9')]=function(_0x1244f1,_0x56e732){return _0x1244f1[_0x8462('0xa')]('FaxTransferReport',attributes,{'tableName':_0x8462('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8462('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x85ed=['../../config/logger','bluebird','path','rimraf','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x15de42,_0x5b89ba){var _0x33e374=function(_0x592df2){while(--_0x592df2){_0x15de42['push'](_0x15de42['shift']());}};_0x33e374(++_0x5b89ba);}(_0x85ed,0x18f));var _0xd85e=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x85ed[_0x999b85];return _0x1d7124;};'use strict';var _=require(_0xd85e('0x0'));var util=require('util');var logger=require(_0xd85e('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd85e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd85e('0x3'));var rimraf=require(_0xd85e('0x4'));var config=require('../../config/environment');var attributes=require(_0xd85e('0x5'));module['exports']=function(_0x3aa9f6,_0x410564){return _0x3aa9f6[_0xd85e('0x6')](_0xd85e('0x7'),attributes,{'tableName':_0xd85e('0x8'),'paranoid':![],'indexes':[{'name':_0xd85e('0x9'),'fields':[_0xd85e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index ac3a9aa..843fe1c 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 _0x9fb6=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','lodash','util','bluebird'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x9fb6,0x147));var _0x69fb=function(_0x32b231,_0x3f586f){_0x32b231=_0x32b231-0x0;var _0x178508=_0x9fb6[_0x32b231];return _0x178508;};'use strict';var _=require(_0x69fb('0x0'));var util=require(_0x69fb('0x1'));var moment=require('moment');var BPromise=require(_0x69fb('0x2'));var rs=require(_0x69fb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x69fb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x69fb('0x5'))(_0x69fb('0x6'));var config=require(_0x69fb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x69fb('0x8')][_0x69fb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4058ef,_0x6e6fa1,_0x2c7971){return new BPromise(function(_0x28ae75,_0x4b2e2c){return client[_0x69fb('0xa')](_0x4058ef,_0x2c7971)[_0x69fb('0xb')](function(_0x1e5af8){logger['info'](_0x69fb('0xc'),_0x6e6fa1,_0x69fb('0xd'));logger[_0x69fb('0xe')](_0x69fb('0xf'),_0x6e6fa1,'request\x20sent',JSON['stringify'](_0x1e5af8));if(_0x1e5af8['error']){if(_0x1e5af8['error'][_0x69fb('0x10')]===0x1f4){logger[_0x69fb('0x11')](_0x69fb('0xc'),_0x6e6fa1,_0x1e5af8[_0x69fb('0x11')]['message']);return _0x4b2e2c(_0x1e5af8[_0x69fb('0x11')][_0x69fb('0x12')]);}logger[_0x69fb('0x11')](_0x69fb('0xc'),_0x6e6fa1,_0x1e5af8['error']['message']);return _0x28ae75(_0x1e5af8[_0x69fb('0x11')]['message']);}else{logger[_0x69fb('0x13')](_0x69fb('0xc'),_0x6e6fa1,_0x69fb('0xd'));_0x28ae75(_0x1e5af8[_0x69fb('0x14')][_0x69fb('0x12')]);}})[_0x69fb('0x15')](function(_0x393649){logger[_0x69fb('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x6e6fa1,_0x393649);_0x4b2e2c(_0x393649);});});} \ No newline at end of file +var _0x37c8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x569998,_0x361b8d){var _0x2f8256=function(_0x3354f1){while(--_0x3354f1){_0x569998['push'](_0x569998['shift']());}};_0x2f8256(++_0x361b8d);}(_0x37c8,0x78));var _0x837c=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x37c8[_0x4c184d];return _0x23d997;};'use strict';var _=require(_0x837c('0x0'));var util=require(_0x837c('0x1'));var moment=require(_0x837c('0x2'));var BPromise=require(_0x837c('0x3'));var rs=require(_0x837c('0x4'));var fs=require('fs');var Redis=require(_0x837c('0x5'));var db=require(_0x837c('0x6'))['db'];var utils=require(_0x837c('0x7'));var logger=require(_0x837c('0x8'))(_0x837c('0x9'));var config=require(_0x837c('0xa'));var jayson=require(_0x837c('0xb'));var client=jayson[_0x837c('0xc')][_0x837c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2ce3a3,_0x446465,_0x5035d1){return new BPromise(function(_0xb76850,_0x560609){return client[_0x837c('0xe')](_0x2ce3a3,_0x5035d1)[_0x837c('0xf')](function(_0xcd365f){logger[_0x837c('0x10')](_0x837c('0x11'),_0x446465,_0x837c('0x12'));logger[_0x837c('0x13')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x446465,_0x837c('0x12'),JSON[_0x837c('0x14')](_0xcd365f));if(_0xcd365f[_0x837c('0x15')]){if(_0xcd365f['error']['code']===0x1f4){logger['error'](_0x837c('0x11'),_0x446465,_0xcd365f[_0x837c('0x15')]['message']);return _0x560609(_0xcd365f[_0x837c('0x15')]['message']);}logger[_0x837c('0x15')](_0x837c('0x11'),_0x446465,_0xcd365f[_0x837c('0x15')][_0x837c('0x16')]);return _0xb76850(_0xcd365f['error'][_0x837c('0x16')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x446465,_0x837c('0x12'));_0xb76850(_0xcd365f[_0x837c('0x17')]['message']);}})[_0x837c('0x18')](function(_0x45b944){logger[_0x837c('0x15')]('FaxTransferReport,\x20%s,\x20%s',_0x446465,_0x45b944);_0x560609(_0x45b944);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 257613d..1d23306 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 _0x6e14=['../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e14,0x174));var _0x46e1=function(_0x4a1808,_0x3bc100){_0x4a1808=_0x4a1808-0x0;var _0x5a09e3=_0x6e14[_0x4a1808];return _0x5a09e3;};'use strict';var multer=require(_0x46e1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x46e1('0x1'));var express=require(_0x46e1('0x2'));var router=express[_0x46e1('0x3')]();var fs_extra=require(_0x46e1('0x4'));var auth=require(_0x46e1('0x5'));var interaction=require(_0x46e1('0x6'));var config=require(_0x46e1('0x7'));var controller=require(_0x46e1('0x8'));router[_0x46e1('0x9')]('/',auth[_0x46e1('0xa')](),controller[_0x46e1('0xb')]);router[_0x46e1('0x9')](_0x46e1('0xc'),auth[_0x46e1('0xa')](),controller['describe']);router['get'](_0x46e1('0xd'),auth[_0x46e1('0xa')](),controller[_0x46e1('0xe')]);router[_0x46e1('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x46e1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x46e1('0x11')]);router[_0x46e1('0x12')](_0x46e1('0xd'),auth[_0x46e1('0xa')](),controller[_0x46e1('0x13')]);module[_0x46e1('0x14')]=router; \ No newline at end of file +var _0x73ed=['describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated'];(function(_0x270af6,_0x87f513){var _0x55a014=function(_0x10f83b){while(--_0x10f83b){_0x270af6['push'](_0x270af6['shift']());}};_0x55a014(++_0x87f513);}(_0x73ed,0x93));var _0xd73e=function(_0x545191,_0x4b8ccc){_0x545191=_0x545191-0x0;var _0xb66167=_0x73ed[_0x545191];return _0xb66167;};'use strict';var multer=require(_0xd73e('0x0'));var util=require(_0xd73e('0x1'));var path=require(_0xd73e('0x2'));var timeout=require(_0xd73e('0x3'));var express=require(_0xd73e('0x4'));var router=express[_0xd73e('0x5')]();var fs_extra=require(_0xd73e('0x6'));var auth=require(_0xd73e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd73e('0x8'));var controller=require(_0xd73e('0x9'));router[_0xd73e('0xa')]('/',auth['isAuthenticated'](),controller[_0xd73e('0xb')]);router[_0xd73e('0xa')](_0xd73e('0xc'),auth[_0xd73e('0xd')](),controller[_0xd73e('0xe')]);router[_0xd73e('0xa')](_0xd73e('0xf'),auth[_0xd73e('0xd')](),controller[_0xd73e('0x10')]);router[_0xd73e('0x11')]('/',auth[_0xd73e('0xd')](),controller[_0xd73e('0x12')]);router[_0xd73e('0x13')](_0xd73e('0xf'),auth[_0xd73e('0xd')](),controller[_0xd73e('0x14')]);router[_0xd73e('0x15')](_0xd73e('0xf'),auth['isAuthenticated'](),controller[_0xd73e('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 8a00b10..dfd4b5c 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 _0x9c7c=['create','addConfiguration','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x2ce964,_0x56480b){var _0x3289f6=function(_0x29308e){while(--_0x29308e){_0x2ce964['push'](_0x2ce964['shift']());}};_0x3289f6(++_0x56480b);}(_0x9c7c,0xd4));var _0xc9c7=function(_0x579fd6,_0x17e49f){_0x579fd6=_0x579fd6-0x0;var _0x41163c=_0x9c7c[_0x579fd6];return _0x41163c;};'use strict';var multer=require(_0xc9c7('0x0'));var util=require(_0xc9c7('0x1'));var path=require(_0xc9c7('0x2'));var timeout=require(_0xc9c7('0x3'));var express=require(_0xc9c7('0x4'));var router=express[_0xc9c7('0x5')]();var fs_extra=require(_0xc9c7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc9c7('0x7'));var config=require(_0xc9c7('0x8'));var controller=require('./intDeskAccount.controller');router[_0xc9c7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc9c7('0x9')](_0xc9c7('0xa'),auth[_0xc9c7('0xb')](),controller[_0xc9c7('0xc')]);router[_0xc9c7('0x9')](_0xc9c7('0xd'),auth[_0xc9c7('0xb')](),controller[_0xc9c7('0xe')]);router['get'](_0xc9c7('0xf'),auth['isAuthenticated'](),controller[_0xc9c7('0x10')]);router[_0xc9c7('0x11')]('/',auth['isAuthenticated'](),controller[_0xc9c7('0x12')]);router[_0xc9c7('0x11')]('/:id/configurations',auth[_0xc9c7('0xb')](),controller[_0xc9c7('0x13')]);router[_0xc9c7('0x14')](_0xc9c7('0xa'),auth[_0xc9c7('0xb')](),controller['update']);router[_0xc9c7('0x15')](_0xc9c7('0xa'),auth[_0xc9c7('0xb')](),controller['destroy']);module[_0xc9c7('0x16')]=router; \ No newline at end of file +var _0x8263=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','create','/:id/configurations','put','update','destroy','exports','util'];(function(_0x4f2fd1,_0x84cc3e){var _0x3918ed=function(_0x672cec){while(--_0x672cec){_0x4f2fd1['push'](_0x4f2fd1['shift']());}};_0x3918ed(++_0x84cc3e);}(_0x8263,0xef));var _0x3826=function(_0x4a075d,_0x250369){_0x4a075d=_0x4a075d-0x0;var _0x275847=_0x8263[_0x4a075d];return _0x275847;};'use strict';var multer=require('multer');var util=require(_0x3826('0x0'));var path=require(_0x3826('0x1'));var timeout=require(_0x3826('0x2'));var express=require(_0x3826('0x3'));var router=express[_0x3826('0x4')]();var fs_extra=require(_0x3826('0x5'));var auth=require(_0x3826('0x6'));var interaction=require(_0x3826('0x7'));var config=require(_0x3826('0x8'));var controller=require(_0x3826('0x9'));router[_0x3826('0xa')]('/',auth[_0x3826('0xb')](),controller[_0x3826('0xc')]);router[_0x3826('0xa')](_0x3826('0xd'),auth[_0x3826('0xb')](),controller[_0x3826('0xe')]);router[_0x3826('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x3826('0xa')](_0x3826('0xf'),auth['isAuthenticated'](),controller[_0x3826('0x10')]);router[_0x3826('0x11')]('/',auth[_0x3826('0xb')](),controller[_0x3826('0x12')]);router[_0x3826('0x11')](_0x3826('0x13'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x3826('0x14')]('/:id',auth[_0x3826('0xb')](),controller[_0x3826('0x15')]);router['delete'](_0x3826('0xd'),auth[_0x3826('0xb')](),controller[_0x3826('0x16')]);module[_0x3826('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 491ace5..fb15f11 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 _0xe9e4=['sequelize','exports','STRING','basic','ENUM','newTab','integrationTab'];(function(_0x2236ab,_0x17d392){var _0x1fbdf9=function(_0x4da1e7){while(--_0x4da1e7){_0x2236ab['push'](_0x2236ab['shift']());}};_0x1fbdf9(++_0x17d392);}(_0xe9e4,0xfc));var _0x4e9e=function(_0x1f838f,_0x55b31e){_0x1f838f=_0x1f838f-0x0;var _0x56cd70=_0xe9e4[_0x1f838f];return _0x56cd70;};'use strict';var Sequelize=require(_0x4e9e('0x0'));module[_0x4e9e('0x1')]={'name':{'type':Sequelize[_0x4e9e('0x2')]},'description':{'type':Sequelize[_0x4e9e('0x2')]},'username':{'type':Sequelize[_0x4e9e('0x2')]},'remoteUri':{'type':Sequelize[_0x4e9e('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x4e9e('0x3')),'defaultValue':_0x4e9e('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x4e9e('0x2')]},'token':{'type':Sequelize[_0x4e9e('0x2')]},'tokenSecret':{'type':Sequelize[_0x4e9e('0x2')]},'serverUrl':{'type':Sequelize[_0x4e9e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4e9e('0x4')]('integrationTab',_0x4e9e('0x5')),'defaultValue':_0x4e9e('0x6')}}; \ No newline at end of file +var _0x3c58=['integrationTab','sequelize','exports','STRING','basic','ENUM','newTab'];(function(_0x23ab27,_0x33b148){var _0x212bc7=function(_0xe0d563){while(--_0xe0d563){_0x23ab27['push'](_0x23ab27['shift']());}};_0x212bc7(++_0x33b148);}(_0x3c58,0x190));var _0x83c5=function(_0x5e2729,_0x1afa6d){_0x5e2729=_0x5e2729-0x0;var _0x2d51dc=_0x3c58[_0x5e2729];return _0x2d51dc;};'use strict';var Sequelize=require(_0x83c5('0x0'));module[_0x83c5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x83c5('0x2')]},'username':{'type':Sequelize[_0x83c5('0x2')]},'remoteUri':{'type':Sequelize[_0x83c5('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x83c5('0x3')),'defaultValue':_0x83c5('0x3')},'password':{'type':Sequelize[_0x83c5('0x2')]},'consumerKey':{'type':Sequelize[_0x83c5('0x2')]},'consumerSecret':{'type':Sequelize[_0x83c5('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x83c5('0x2')]},'serverUrl':{'type':Sequelize[_0x83c5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x83c5('0x4')]('integrationTab',_0x83c5('0x5')),'defaultValue':_0x83c5('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index ed14932..4a26e63 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 _0x3a51=['password','consumerKey','consumerSecret','token','slice','substring','GET','application/json','basic','headers','Authorization','format','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','active','label','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','Content-Range','update','error','stack','name','send','rawAttributes','fieldName','type','model','map','query','filters','attributes','intersection','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','DeskAccount','rows','show','params','keys','find','create','catch','body','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','Subjects','Descriptions','channel','DeskField','getFields','remoteUri'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3a51,0x1bf));var _0x13a5=function(_0x41cae4,_0x460963){_0x41cae4=_0x41cae4-0x0;var _0x95f578=_0x3a51[_0x41cae4];return _0x95f578;};'use strict';var emlformat=require(_0x13a5('0x0'));var rimraf=require(_0x13a5('0x1'));var zipdir=require(_0x13a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x13a5('0x3'));var moment=require(_0x13a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x13a5('0x5'));var util=require(_0x13a5('0x6'));var path=require(_0x13a5('0x7'));var sox=require(_0x13a5('0x8'));var csv=require(_0x13a5('0x9'));var ejs=require(_0x13a5('0xa'));var fs=require('fs');var fs_extra=require(_0x13a5('0xb'));var _=require(_0x13a5('0xc'));var squel=require(_0x13a5('0xd'));var crypto=require(_0x13a5('0xe'));var jsforce=require(_0x13a5('0xf'));var deskjs=require(_0x13a5('0x10'));var toCsv=require(_0x13a5('0x9'));var querystring=require('querystring');var Papa=require(_0x13a5('0x11'));var Redis=require(_0x13a5('0x12'));var authService=require(_0x13a5('0x13'));var qs=require(_0x13a5('0x14'));var as=require(_0x13a5('0x15'));var hardwareService=require(_0x13a5('0x16'));var logger=require(_0x13a5('0x17'))(_0x13a5('0x18'));var utils=require(_0x13a5('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x13a5('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x13a5('0x1b'));function respondWithStatusCode(_0x5011d7,_0x1d099d){_0x1d099d=_0x1d099d||0xcc;return function(_0x575622){if(_0x575622){return _0x5011d7[_0x13a5('0x1c')](_0x1d099d);}return _0x5011d7[_0x13a5('0x1d')](_0x1d099d)[_0x13a5('0x1e')]();};}function respondWithResult(_0x251e62,_0x3e3e5f){_0x3e3e5f=_0x3e3e5f||0xc8;return function(_0x101b4c){if(_0x101b4c){return _0x251e62[_0x13a5('0x1d')](_0x3e3e5f)['json'](_0x101b4c);}};}function respondWithFilteredResult(_0x5e90db,_0x6cd3f7){return function(_0x5ed49b){if(_0x5ed49b){var _0x2d1cb0=typeof _0x6cd3f7['offset']===_0x13a5('0x1f')&&typeof _0x6cd3f7[_0x13a5('0x20')]===_0x13a5('0x1f');var _0x5e1131=_0x5ed49b[_0x13a5('0x21')];var _0x47d4f6=_0x2d1cb0?0x0:_0x6cd3f7['offset'];var _0x23640b=_0x2d1cb0?_0x5ed49b[_0x13a5('0x21')]:_0x6cd3f7['offset']+_0x6cd3f7[_0x13a5('0x20')];var _0x293361;if(_0x23640b>=_0x5e1131){_0x23640b=_0x5e1131;_0x293361=0xc8;}else{_0x293361=0xce;}_0x5e90db[_0x13a5('0x1d')](_0x293361);return _0x5e90db['set'](_0x13a5('0x22'),_0x47d4f6+'-'+_0x23640b+'/'+_0x5e1131)['json'](_0x5ed49b);}return null;};}function patchUpdates(_0xe6a7f4){return function(_0x4287d9){try{jsonpatch['apply'](_0x4287d9,_0xe6a7f4,!![]);}catch(_0x2f3a26){return BPromise['reject'](_0x2f3a26);}return _0x4287d9['save']();};}function saveUpdates(_0x106f08,_0x3dc85b){return function(_0x106044){if(_0x106044){return _0x106044[_0x13a5('0x23')](_0x106f08)['then'](function(_0x1b8a8f){return _0x1b8a8f;});}return null;};}function removeEntity(_0x51c386,_0x22f21b){return function(_0x1a977b){if(_0x1a977b){return _0x1a977b['destroy']()['then'](function(){_0x51c386[_0x13a5('0x1d')](0xcc)[_0x13a5('0x1e')]();});}};}function handleEntityNotFound(_0x5dc7e4,_0x47f7ee){return function(_0x2ccbf3){if(!_0x2ccbf3){_0x5dc7e4[_0x13a5('0x1c')](0x194);}return _0x2ccbf3;};}function handleError(_0x188f69,_0x2a5c2a){_0x2a5c2a=_0x2a5c2a||0x1f4;return function(_0x36c943){logger[_0x13a5('0x24')](_0x36c943[_0x13a5('0x25')]);if(_0x36c943[_0x13a5('0x26')]){delete _0x36c943[_0x13a5('0x26')];}_0x188f69[_0x13a5('0x1d')](_0x2a5c2a)[_0x13a5('0x27')](_0x36c943);};}exports['index']=function(_0x4f8a68,_0x1581ec){var _0x160212={},_0x3f0d5d={},_0x2823ea={'count':0x0,'rows':[]};var _0x1d81f9=_['map'](db['DeskAccount'][_0x13a5('0x28')],function(_0x2f57ca){return{'name':_0x2f57ca[_0x13a5('0x29')],'type':_0x2f57ca[_0x13a5('0x2a')]['key']};});_0x3f0d5d[_0x13a5('0x2b')]=_[_0x13a5('0x2c')](_0x1d81f9,_0x13a5('0x26'));_0x3f0d5d[_0x13a5('0x2d')]=_['keys'](_0x4f8a68[_0x13a5('0x2d')]);_0x3f0d5d[_0x13a5('0x2e')]=_['intersection'](_0x3f0d5d['model'],_0x3f0d5d[_0x13a5('0x2d')]);_0x160212[_0x13a5('0x2f')]=_[_0x13a5('0x30')](_0x3f0d5d[_0x13a5('0x2b')],qs[_0x13a5('0x31')](_0x4f8a68[_0x13a5('0x2d')][_0x13a5('0x31')]));_0x160212[_0x13a5('0x2f')]=_0x160212[_0x13a5('0x2f')][_0x13a5('0x32')]?_0x160212[_0x13a5('0x2f')]:_0x3f0d5d['model'];if(!_0x4f8a68[_0x13a5('0x2d')]['hasOwnProperty'](_0x13a5('0x33'))){_0x160212[_0x13a5('0x20')]=qs['limit'](_0x4f8a68[_0x13a5('0x2d')][_0x13a5('0x20')]);_0x160212[_0x13a5('0x34')]=qs['offset'](_0x4f8a68['query']['offset']);}_0x160212[_0x13a5('0x35')]=qs[_0x13a5('0x36')](_0x4f8a68[_0x13a5('0x2d')][_0x13a5('0x36')]);_0x160212[_0x13a5('0x37')]=qs[_0x13a5('0x2e')](_[_0x13a5('0x38')](_0x4f8a68[_0x13a5('0x2d')],_0x3f0d5d[_0x13a5('0x2e')]),_0x1d81f9);if(_0x4f8a68[_0x13a5('0x2d')][_0x13a5('0x39')]){_0x160212['where']=_[_0x13a5('0x3a')](_0x160212[_0x13a5('0x37')],{'$or':_[_0x13a5('0x2c')](_0x1d81f9,function(_0x4bdb96){if(_0x4bdb96['type']!==_0x13a5('0x3b')){var _0x499841={};_0x499841[_0x4bdb96[_0x13a5('0x26')]]={'$like':'%'+_0x4f8a68[_0x13a5('0x2d')][_0x13a5('0x39')]+'%'};return _0x499841;}})});}_0x160212=_[_0x13a5('0x3a')]({},_0x160212,_0x4f8a68[_0x13a5('0x3c')]);var _0x2dc63f={'where':_0x160212['where']};return db['DeskAccount'][_0x13a5('0x21')](_0x2dc63f)[_0x13a5('0x3d')](function(_0x1806ee){_0x2823ea[_0x13a5('0x21')]=_0x1806ee;if(_0x4f8a68['query'][_0x13a5('0x3e')]){_0x160212[_0x13a5('0x3f')]=[{'all':!![]}];}return db[_0x13a5('0x40')]['findAll'](_0x160212);})['then'](function(_0x33806f){_0x2823ea[_0x13a5('0x41')]=_0x33806f;return _0x2823ea;})['then'](respondWithFilteredResult(_0x1581ec,_0x160212))['catch'](handleError(_0x1581ec,null));};exports[_0x13a5('0x42')]=function(_0x1c1f04,_0x2f3227){var _0x1ad795={'raw':![],'where':{'id':_0x1c1f04[_0x13a5('0x43')]['id']}},_0x4fb42d={};_0x4fb42d['model']=_[_0x13a5('0x44')](db[_0x13a5('0x40')]['rawAttributes']);_0x4fb42d['query']=_['keys'](_0x1c1f04[_0x13a5('0x2d')]);_0x4fb42d[_0x13a5('0x2e')]=_[_0x13a5('0x30')](_0x4fb42d['model'],_0x4fb42d[_0x13a5('0x2d')]);_0x1ad795[_0x13a5('0x2f')]=_[_0x13a5('0x30')](_0x4fb42d[_0x13a5('0x2b')],qs['fields'](_0x1c1f04[_0x13a5('0x2d')][_0x13a5('0x31')]));_0x1ad795[_0x13a5('0x2f')]=_0x1ad795[_0x13a5('0x2f')][_0x13a5('0x32')]?_0x1ad795[_0x13a5('0x2f')]:_0x4fb42d[_0x13a5('0x2b')];if(_0x1c1f04['query'][_0x13a5('0x3e')]){_0x1ad795[_0x13a5('0x3f')]=[{'all':!![]}];}_0x1ad795=_['merge']({},_0x1ad795,_0x1c1f04[_0x13a5('0x3c')]);return db[_0x13a5('0x40')][_0x13a5('0x45')](_0x1ad795)[_0x13a5('0x3d')](handleEntityNotFound(_0x2f3227,null))[_0x13a5('0x3d')](respondWithResult(_0x2f3227,null))['catch'](handleError(_0x2f3227,null));};exports[_0x13a5('0x46')]=function(_0x401673,_0x3b40d9){return db['DeskAccount'][_0x13a5('0x46')](_0x401673['body'],{})['then'](respondWithResult(_0x3b40d9,0xc9))[_0x13a5('0x47')](handleError(_0x3b40d9,null));};exports[_0x13a5('0x23')]=function(_0x23a1b7,_0x66449d){if(_0x23a1b7[_0x13a5('0x48')]['id']){delete _0x23a1b7[_0x13a5('0x48')]['id'];}return db[_0x13a5('0x40')][_0x13a5('0x45')]({'where':{'id':_0x23a1b7['params']['id']}})['then'](handleEntityNotFound(_0x66449d,null))[_0x13a5('0x3d')](saveUpdates(_0x23a1b7[_0x13a5('0x48')],null))['then'](respondWithResult(_0x66449d,null))['catch'](handleError(_0x66449d,null));};exports['destroy']=function(_0x8effe,_0x2ced5a){return db[_0x13a5('0x40')][_0x13a5('0x45')]({'where':{'id':_0x8effe[_0x13a5('0x43')]['id']}})[_0x13a5('0x3d')](handleEntityNotFound(_0x2ced5a,null))[_0x13a5('0x3d')](removeEntity(_0x2ced5a,null))[_0x13a5('0x47')](handleError(_0x2ced5a,null));};exports[_0x13a5('0x49')]=function(_0x45db3d,_0x2fb938,_0xe36ae1){var _0x2c0239={};var _0x5ed918={};var _0x1a36e9;var _0x39ddc3;return db['DeskAccount'][_0x13a5('0x4a')]({'where':{'id':_0x45db3d[_0x13a5('0x43')]['id']}})[_0x13a5('0x3d')](handleEntityNotFound(_0x2fb938,null))['then'](function(_0x39dc90){if(_0x39dc90){_0x1a36e9=_0x39dc90;_0x5ed918['model']=_[_0x13a5('0x44')](db[_0x13a5('0x4b')][_0x13a5('0x28')]);_0x5ed918[_0x13a5('0x2d')]=_[_0x13a5('0x44')](_0x45db3d['query']);_0x5ed918[_0x13a5('0x2e')]=_[_0x13a5('0x30')](_0x5ed918[_0x13a5('0x2b')],_0x5ed918['query']);_0x2c0239[_0x13a5('0x2f')]=_[_0x13a5('0x30')](_0x5ed918[_0x13a5('0x2b')],qs[_0x13a5('0x31')](_0x45db3d[_0x13a5('0x2d')][_0x13a5('0x31')]));_0x2c0239['attributes']=_0x2c0239['attributes'][_0x13a5('0x32')]?_0x2c0239[_0x13a5('0x2f')]:_0x5ed918['model'];_0x2c0239[_0x13a5('0x35')]=qs[_0x13a5('0x36')](_0x45db3d['query']['sort']);_0x2c0239['where']=qs[_0x13a5('0x2e')](_['pick'](_0x45db3d[_0x13a5('0x2d')],_0x5ed918['filters']));if(_0x45db3d[_0x13a5('0x2d')][_0x13a5('0x39')]){_0x2c0239[_0x13a5('0x37')]=_[_0x13a5('0x3a')](_0x2c0239['where'],{'$or':_[_0x13a5('0x2c')](_0x2c0239[_0x13a5('0x2f')],function(_0x307a6a){var _0x47e83b={};_0x47e83b[_0x307a6a]={'$like':'%'+_0x45db3d[_0x13a5('0x2d')][_0x13a5('0x39')]+'%'};return _0x47e83b;})});}_0x2c0239=_[_0x13a5('0x3a')]({},_0x2c0239,_0x45db3d['options']);return _0x1a36e9[_0x13a5('0x49')](_0x2c0239);}})['then'](function(_0x241763){if(_0x241763){_0x39ddc3=_0x241763[_0x13a5('0x32')];if(!_0x45db3d['query'][_0x13a5('0x4c')](_0x13a5('0x33'))){_0x2c0239[_0x13a5('0x20')]=qs['limit'](_0x45db3d[_0x13a5('0x2d')][_0x13a5('0x20')]);_0x2c0239['offset']=qs['offset'](_0x45db3d[_0x13a5('0x2d')][_0x13a5('0x34')]);}return _0x1a36e9[_0x13a5('0x49')](_0x2c0239);}})['then'](function(_0x223757){if(_0x223757){return _0x223757?{'count':_0x39ddc3,'rows':_0x223757}:null;}})[_0x13a5('0x3d')](respondWithResult(_0x2fb938,null))[_0x13a5('0x47')](handleError(_0x2fb938,null));};exports['addConfiguration']=function(_0x653791,_0x5f3011,_0x178df9){if(_0x653791[_0x13a5('0x48')]['id']){delete _0x653791[_0x13a5('0x48')]['id'];}return db[_0x13a5('0x40')]['findOne']({'where':{'id':_0x653791[_0x13a5('0x43')]['id']}})[_0x13a5('0x3d')](handleEntityNotFound(_0x5f3011,null))[_0x13a5('0x3d')](function(_0x33c129){if(_0x33c129){_0x653791[_0x13a5('0x48')]['AccountId']=_0x33c129['id'];_0x653791[_0x13a5('0x48')][_0x13a5('0x4d')]=integrations['getSubjects'](_0x653791[_0x13a5('0x48')]['channel'],_0x653791[_0x13a5('0x48')][_0x13a5('0x2a')]);_0x653791['body'][_0x13a5('0x4e')]=integrations['getDescriptions'](_0x653791[_0x13a5('0x48')][_0x13a5('0x4f')],_0x653791[_0x13a5('0x48')][_0x13a5('0x2a')]);return db[_0x13a5('0x4b')][_0x13a5('0x46')](_0x653791['body'],{'include':[{'model':db[_0x13a5('0x50')],'as':_0x13a5('0x4d')},{'model':db[_0x13a5('0x50')],'as':_0x13a5('0x4e')}]});}return null;})[_0x13a5('0x3d')](respondWithResult(_0x5f3011,null))['catch'](handleError(_0x5f3011,null));};exports[_0x13a5('0x51')]=function(_0x141248,_0x3390e8,_0x5667a3){var _0x11c832=[{'name':'priority','label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x28ea70='';return db[_0x13a5('0x40')][_0x13a5('0x4a')]({'where':{'id':_0x141248[_0x13a5('0x43')]['id']},'attributes':['id',_0x13a5('0x52'),'authType','username',_0x13a5('0x53'),_0x13a5('0x54'),_0x13a5('0x55'),_0x13a5('0x56'),'tokenSecret']})['then'](handleEntityNotFound(_0x3390e8,null))[_0x13a5('0x3d')](function(_0x1cff82){if(_0x1cff82){_0x28ea70=_0x1cff82['remoteUri'];var _0x262b11=_0x28ea70[_0x13a5('0x57')](-0x1);if(_0x262b11==='/'){_0x28ea70=_0x28ea70[_0x13a5('0x58')](0x0,_0x28ea70['lastIndexOf'](_0x262b11));}var _0x4f5661={'method':_0x13a5('0x59'),'uri':util['format']('%s/custom_fields',_0x28ea70),'headers':{'Content-Type':'application/json','Accept':_0x13a5('0x5a')},'json':!![]};if(_0x1cff82['authType']===_0x13a5('0x5b')){_0x4f5661[_0x13a5('0x5c')][_0x13a5('0x5d')]=util[_0x13a5('0x5e')](_0x13a5('0x5f'),new Buffer(util[_0x13a5('0x5e')](_0x13a5('0x60'),_0x1cff82['username'],_0x1cff82[_0x13a5('0x53')]))[_0x13a5('0x61')](_0x13a5('0x62')));}return rp(_0x4f5661)[_0x13a5('0x3d')](function(_0x24d6b7){return _0x11c832[_0x13a5('0x63')](_[_0x13a5('0x2c')](_0x24d6b7[_0x13a5('0x64')]['entries'],function(_0x2b2e59){return{'id':_0x2b2e59['name'],'name':_0x2b2e59[_0x13a5('0x26')],'type':_0x2b2e59['type'],'active':_0x2b2e59[_0x13a5('0x65')],'label':_0x2b2e59[_0x13a5('0x66')],'custom':!![]};}));});}})['then'](function(_0x3e02cd){return{'count':_0x3e02cd[_0x13a5('0x32')],'rows':_0x3e02cd};})[_0x13a5('0x3d')](respondWithResult(_0x3390e8,null))['catch'](function(_0x112424){var _0x13432c=_0x141248['query'][_0x13a5('0x67')]?0x1f4:_0x112424[_0x13a5('0x68')]||0x1f4;logger[_0x13a5('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x13a5('0x51'),_0x13432c,JSON['stringify'](_0x112424));delete _0x112424['name'];if(_0x13432c===0x191){_0x13432c=0x190;}_0x3390e8[_0x13a5('0x1d')](_0x13432c)[_0x13a5('0x27')](_0x141248[_0x13a5('0x2d')]['test']?{'message':_0x13a5('0x69'),'statusCode':_0x112424[_0x13a5('0x68')]}:_0x112424);});}; \ No newline at end of file +var _0xd7c0=['addConfiguration','getSubjects','getDescriptions','DeskField','getFields','priority','authType','username','password','consumerSecret','token','tokenSecret','remoteUri','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','active','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','offset','count','Content-Range','apply','save','update','then','destroy','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','findOne','DeskConfiguration','pick','getConfigurations'];(function(_0x3d29ec,_0x4f103f){var _0x10f26=function(_0x51a4d2){while(--_0x51a4d2){_0x3d29ec['push'](_0x3d29ec['shift']());}};_0x10f26(++_0x4f103f);}(_0xd7c0,0x16f));var _0x0d7c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd7c0[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x0d7c('0x0'));var rimraf=require(_0x0d7c('0x1'));var zipdir=require(_0x0d7c('0x2'));var jsonpatch=require(_0x0d7c('0x3'));var rp=require('request-promise');var moment=require(_0x0d7c('0x4'));var BPromise=require(_0x0d7c('0x5'));var Mustache=require(_0x0d7c('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0d7c('0x7'));var csv=require(_0x0d7c('0x8'));var ejs=require(_0x0d7c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0d7c('0xa'));var crypto=require(_0x0d7c('0xb'));var jsforce=require(_0x0d7c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0d7c('0x8'));var querystring=require(_0x0d7c('0xd'));var Papa=require(_0x0d7c('0xe'));var Redis=require(_0x0d7c('0xf'));var authService=require(_0x0d7c('0x10'));var qs=require(_0x0d7c('0x11'));var as=require(_0x0d7c('0x12'));var hardwareService=require(_0x0d7c('0x13'));var logger=require('../../config/logger')(_0x0d7c('0x14'));var utils=require(_0x0d7c('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0d7c('0x16'))['db'];var integrations=require(_0x0d7c('0x17'));function respondWithStatusCode(_0x30d5b1,_0x450565){_0x450565=_0x450565||0xcc;return function(_0x2465a0){if(_0x2465a0){return _0x30d5b1['sendStatus'](_0x450565);}return _0x30d5b1[_0x0d7c('0x18')](_0x450565)[_0x0d7c('0x19')]();};}function respondWithResult(_0x3f9e97,_0x2e5009){_0x2e5009=_0x2e5009||0xc8;return function(_0x12c030){if(_0x12c030){return _0x3f9e97[_0x0d7c('0x18')](_0x2e5009)[_0x0d7c('0x1a')](_0x12c030);}};}function respondWithFilteredResult(_0x1ec8ca,_0x16853e){return function(_0x80b8c7){if(_0x80b8c7){var _0x53b9e8=typeof _0x16853e['offset']===_0x0d7c('0x1b')&&typeof _0x16853e[_0x0d7c('0x1c')]===_0x0d7c('0x1b');var _0x405a2e=_0x80b8c7['count'];var _0x5c7cb1=_0x53b9e8?0x0:_0x16853e[_0x0d7c('0x1d')];var _0x494c3a=_0x53b9e8?_0x80b8c7[_0x0d7c('0x1e')]:_0x16853e[_0x0d7c('0x1d')]+_0x16853e[_0x0d7c('0x1c')];var _0x34cca2;if(_0x494c3a>=_0x405a2e){_0x494c3a=_0x405a2e;_0x34cca2=0xc8;}else{_0x34cca2=0xce;}_0x1ec8ca[_0x0d7c('0x18')](_0x34cca2);return _0x1ec8ca['set'](_0x0d7c('0x1f'),_0x5c7cb1+'-'+_0x494c3a+'/'+_0x405a2e)[_0x0d7c('0x1a')](_0x80b8c7);}return null;};}function patchUpdates(_0x46fa24){return function(_0xd00bec){try{jsonpatch[_0x0d7c('0x20')](_0xd00bec,_0x46fa24,!![]);}catch(_0x165dc3){return BPromise['reject'](_0x165dc3);}return _0xd00bec[_0x0d7c('0x21')]();};}function saveUpdates(_0x1b22bf,_0x4d8acd){return function(_0x1c43ad){if(_0x1c43ad){return _0x1c43ad[_0x0d7c('0x22')](_0x1b22bf)[_0x0d7c('0x23')](function(_0x3568b3){return _0x3568b3;});}return null;};}function removeEntity(_0x994a1,_0x5b0a63){return function(_0x1b2319){if(_0x1b2319){return _0x1b2319[_0x0d7c('0x24')]()[_0x0d7c('0x23')](function(){_0x994a1[_0x0d7c('0x18')](0xcc)[_0x0d7c('0x19')]();});}};}function handleEntityNotFound(_0x423986,_0x2a5ff4){return function(_0x2cc354){if(!_0x2cc354){_0x423986['sendStatus'](0x194);}return _0x2cc354;};}function handleError(_0x392303,_0x5ba347){_0x5ba347=_0x5ba347||0x1f4;return function(_0x1f121c){logger['error'](_0x1f121c[_0x0d7c('0x25')]);if(_0x1f121c[_0x0d7c('0x26')]){delete _0x1f121c['name'];}_0x392303[_0x0d7c('0x18')](_0x5ba347)[_0x0d7c('0x27')](_0x1f121c);};}exports[_0x0d7c('0x28')]=function(_0x45a173,_0x4cebea){var _0x1b7528={},_0x3f225a={},_0xa0faa0={'count':0x0,'rows':[]};var _0x40a672=_['map'](db[_0x0d7c('0x29')][_0x0d7c('0x2a')],function(_0x4067d0){return{'name':_0x4067d0[_0x0d7c('0x2b')],'type':_0x4067d0[_0x0d7c('0x2c')][_0x0d7c('0x2d')]};});_0x3f225a[_0x0d7c('0x2e')]=_[_0x0d7c('0x2f')](_0x40a672,_0x0d7c('0x26'));_0x3f225a[_0x0d7c('0x30')]=_[_0x0d7c('0x31')](_0x45a173[_0x0d7c('0x30')]);_0x3f225a['filters']=_[_0x0d7c('0x32')](_0x3f225a[_0x0d7c('0x2e')],_0x3f225a[_0x0d7c('0x30')]);_0x1b7528[_0x0d7c('0x33')]=_[_0x0d7c('0x32')](_0x3f225a[_0x0d7c('0x2e')],qs[_0x0d7c('0x34')](_0x45a173[_0x0d7c('0x30')]['fields']));_0x1b7528[_0x0d7c('0x33')]=_0x1b7528['attributes']['length']?_0x1b7528['attributes']:_0x3f225a[_0x0d7c('0x2e')];if(!_0x45a173[_0x0d7c('0x30')][_0x0d7c('0x35')](_0x0d7c('0x36'))){_0x1b7528[_0x0d7c('0x1c')]=qs[_0x0d7c('0x1c')](_0x45a173['query']['limit']);_0x1b7528['offset']=qs[_0x0d7c('0x1d')](_0x45a173[_0x0d7c('0x30')][_0x0d7c('0x1d')]);}_0x1b7528[_0x0d7c('0x37')]=qs['sort'](_0x45a173[_0x0d7c('0x30')][_0x0d7c('0x38')]);_0x1b7528['where']=qs[_0x0d7c('0x39')](_['pick'](_0x45a173['query'],_0x3f225a[_0x0d7c('0x39')]),_0x40a672);if(_0x45a173['query'][_0x0d7c('0x3a')]){_0x1b7528[_0x0d7c('0x3b')]=_[_0x0d7c('0x3c')](_0x1b7528[_0x0d7c('0x3b')],{'$or':_[_0x0d7c('0x2f')](_0x40a672,function(_0x1b0e4b){if(_0x1b0e4b[_0x0d7c('0x2c')]!==_0x0d7c('0x3d')){var _0x32b521={};_0x32b521[_0x1b0e4b[_0x0d7c('0x26')]]={'$like':'%'+_0x45a173[_0x0d7c('0x30')][_0x0d7c('0x3a')]+'%'};return _0x32b521;}})});}_0x1b7528=_[_0x0d7c('0x3c')]({},_0x1b7528,_0x45a173[_0x0d7c('0x3e')]);var _0xf9515d={'where':_0x1b7528[_0x0d7c('0x3b')]};return db[_0x0d7c('0x29')][_0x0d7c('0x1e')](_0xf9515d)[_0x0d7c('0x23')](function(_0x1b88a5){_0xa0faa0[_0x0d7c('0x1e')]=_0x1b88a5;if(_0x45a173['query'][_0x0d7c('0x3f')]){_0x1b7528[_0x0d7c('0x40')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x1b7528);})[_0x0d7c('0x23')](function(_0x1b847b){_0xa0faa0[_0x0d7c('0x41')]=_0x1b847b;return _0xa0faa0;})[_0x0d7c('0x23')](respondWithFilteredResult(_0x4cebea,_0x1b7528))[_0x0d7c('0x42')](handleError(_0x4cebea,null));};exports[_0x0d7c('0x43')]=function(_0x581599,_0x33c6cf){var _0x18337e={'raw':![],'where':{'id':_0x581599[_0x0d7c('0x44')]['id']}},_0x2a6fd5={};_0x2a6fd5[_0x0d7c('0x2e')]=_['keys'](db[_0x0d7c('0x29')][_0x0d7c('0x2a')]);_0x2a6fd5[_0x0d7c('0x30')]=_[_0x0d7c('0x31')](_0x581599['query']);_0x2a6fd5[_0x0d7c('0x39')]=_[_0x0d7c('0x32')](_0x2a6fd5[_0x0d7c('0x2e')],_0x2a6fd5['query']);_0x18337e['attributes']=_['intersection'](_0x2a6fd5[_0x0d7c('0x2e')],qs['fields'](_0x581599[_0x0d7c('0x30')][_0x0d7c('0x34')]));_0x18337e['attributes']=_0x18337e[_0x0d7c('0x33')][_0x0d7c('0x45')]?_0x18337e[_0x0d7c('0x33')]:_0x2a6fd5[_0x0d7c('0x2e')];if(_0x581599[_0x0d7c('0x30')][_0x0d7c('0x3f')]){_0x18337e[_0x0d7c('0x40')]=[{'all':!![]}];}_0x18337e=_[_0x0d7c('0x3c')]({},_0x18337e,_0x581599[_0x0d7c('0x3e')]);return db[_0x0d7c('0x29')][_0x0d7c('0x46')](_0x18337e)['then'](handleEntityNotFound(_0x33c6cf,null))[_0x0d7c('0x23')](respondWithResult(_0x33c6cf,null))[_0x0d7c('0x42')](handleError(_0x33c6cf,null));};exports[_0x0d7c('0x47')]=function(_0x343ae4,_0x3596b7){return db['DeskAccount'][_0x0d7c('0x47')](_0x343ae4['body'],{})[_0x0d7c('0x23')](respondWithResult(_0x3596b7,0xc9))[_0x0d7c('0x42')](handleError(_0x3596b7,null));};exports['update']=function(_0xc16c95,_0x49baff){if(_0xc16c95[_0x0d7c('0x48')]['id']){delete _0xc16c95['body']['id'];}return db['DeskAccount']['find']({'where':{'id':_0xc16c95[_0x0d7c('0x44')]['id']}})[_0x0d7c('0x23')](handleEntityNotFound(_0x49baff,null))[_0x0d7c('0x23')](saveUpdates(_0xc16c95[_0x0d7c('0x48')],null))[_0x0d7c('0x23')](respondWithResult(_0x49baff,null))[_0x0d7c('0x42')](handleError(_0x49baff,null));};exports[_0x0d7c('0x24')]=function(_0x4376dd,_0x4d67c5){return db[_0x0d7c('0x29')][_0x0d7c('0x46')]({'where':{'id':_0x4376dd[_0x0d7c('0x44')]['id']}})[_0x0d7c('0x23')](handleEntityNotFound(_0x4d67c5,null))[_0x0d7c('0x23')](removeEntity(_0x4d67c5,null))[_0x0d7c('0x42')](handleError(_0x4d67c5,null));};exports['getConfigurations']=function(_0x2bad6b,_0x562590,_0x1d4a02){var _0x35a9a2={};var _0x1b5ac6={};var _0x3586c6;var _0x50de4a;return db[_0x0d7c('0x29')][_0x0d7c('0x49')]({'where':{'id':_0x2bad6b[_0x0d7c('0x44')]['id']}})[_0x0d7c('0x23')](handleEntityNotFound(_0x562590,null))[_0x0d7c('0x23')](function(_0x547704){if(_0x547704){_0x3586c6=_0x547704;_0x1b5ac6[_0x0d7c('0x2e')]=_['keys'](db[_0x0d7c('0x4a')][_0x0d7c('0x2a')]);_0x1b5ac6['query']=_['keys'](_0x2bad6b[_0x0d7c('0x30')]);_0x1b5ac6[_0x0d7c('0x39')]=_['intersection'](_0x1b5ac6[_0x0d7c('0x2e')],_0x1b5ac6[_0x0d7c('0x30')]);_0x35a9a2[_0x0d7c('0x33')]=_['intersection'](_0x1b5ac6[_0x0d7c('0x2e')],qs['fields'](_0x2bad6b[_0x0d7c('0x30')][_0x0d7c('0x34')]));_0x35a9a2[_0x0d7c('0x33')]=_0x35a9a2['attributes'][_0x0d7c('0x45')]?_0x35a9a2['attributes']:_0x1b5ac6[_0x0d7c('0x2e')];_0x35a9a2['order']=qs[_0x0d7c('0x38')](_0x2bad6b['query'][_0x0d7c('0x38')]);_0x35a9a2['where']=qs[_0x0d7c('0x39')](_[_0x0d7c('0x4b')](_0x2bad6b[_0x0d7c('0x30')],_0x1b5ac6['filters']));if(_0x2bad6b[_0x0d7c('0x30')][_0x0d7c('0x3a')]){_0x35a9a2[_0x0d7c('0x3b')]=_[_0x0d7c('0x3c')](_0x35a9a2['where'],{'$or':_[_0x0d7c('0x2f')](_0x35a9a2[_0x0d7c('0x33')],function(_0x174819){var _0x21bf85={};_0x21bf85[_0x174819]={'$like':'%'+_0x2bad6b[_0x0d7c('0x30')][_0x0d7c('0x3a')]+'%'};return _0x21bf85;})});}_0x35a9a2=_[_0x0d7c('0x3c')]({},_0x35a9a2,_0x2bad6b[_0x0d7c('0x3e')]);return _0x3586c6[_0x0d7c('0x4c')](_0x35a9a2);}})[_0x0d7c('0x23')](function(_0x37b034){if(_0x37b034){_0x50de4a=_0x37b034['length'];if(!_0x2bad6b['query'][_0x0d7c('0x35')](_0x0d7c('0x36'))){_0x35a9a2['limit']=qs['limit'](_0x2bad6b[_0x0d7c('0x30')][_0x0d7c('0x1c')]);_0x35a9a2[_0x0d7c('0x1d')]=qs[_0x0d7c('0x1d')](_0x2bad6b[_0x0d7c('0x30')]['offset']);}return _0x3586c6['getConfigurations'](_0x35a9a2);}})[_0x0d7c('0x23')](function(_0xe8211){if(_0xe8211){return _0xe8211?{'count':_0x50de4a,'rows':_0xe8211}:null;}})['then'](respondWithResult(_0x562590,null))[_0x0d7c('0x42')](handleError(_0x562590,null));};exports[_0x0d7c('0x4d')]=function(_0x239525,_0x2b4bdb,_0x1bd191){if(_0x239525[_0x0d7c('0x48')]['id']){delete _0x239525[_0x0d7c('0x48')]['id'];}return db['DeskAccount'][_0x0d7c('0x49')]({'where':{'id':_0x239525['params']['id']}})[_0x0d7c('0x23')](handleEntityNotFound(_0x2b4bdb,null))[_0x0d7c('0x23')](function(_0x386fa3){if(_0x386fa3){_0x239525['body']['AccountId']=_0x386fa3['id'];_0x239525[_0x0d7c('0x48')]['Subjects']=integrations[_0x0d7c('0x4e')](_0x239525['body']['channel'],_0x239525[_0x0d7c('0x48')][_0x0d7c('0x2c')]);_0x239525[_0x0d7c('0x48')]['Descriptions']=integrations[_0x0d7c('0x4f')](_0x239525[_0x0d7c('0x48')]['channel'],_0x239525[_0x0d7c('0x48')][_0x0d7c('0x2c')]);return db[_0x0d7c('0x4a')][_0x0d7c('0x47')](_0x239525['body'],{'include':[{'model':db[_0x0d7c('0x50')],'as':'Subjects'},{'model':db[_0x0d7c('0x50')],'as':'Descriptions'}]});}return null;})[_0x0d7c('0x23')](respondWithResult(_0x2b4bdb,null))[_0x0d7c('0x42')](handleError(_0x2b4bdb,null));};exports[_0x0d7c('0x51')]=function(_0x3e7e29,_0x410598,_0x31b960){var _0x4935a8=[{'name':'priority','label':_0x0d7c('0x52'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x54ad5f='';return db[_0x0d7c('0x29')]['findOne']({'where':{'id':_0x3e7e29[_0x0d7c('0x44')]['id']},'attributes':['id','remoteUri',_0x0d7c('0x53'),_0x0d7c('0x54'),_0x0d7c('0x55'),'consumerKey',_0x0d7c('0x56'),_0x0d7c('0x57'),_0x0d7c('0x58')]})['then'](handleEntityNotFound(_0x410598,null))[_0x0d7c('0x23')](function(_0x298479){if(_0x298479){_0x54ad5f=_0x298479[_0x0d7c('0x59')];var _0x225acd=_0x54ad5f[_0x0d7c('0x5a')](-0x1);if(_0x225acd==='/'){_0x54ad5f=_0x54ad5f['substring'](0x0,_0x54ad5f[_0x0d7c('0x5b')](_0x225acd));}var _0x243617={'method':_0x0d7c('0x5c'),'uri':util[_0x0d7c('0x5d')](_0x0d7c('0x5e'),_0x54ad5f),'headers':{'Content-Type':_0x0d7c('0x5f'),'Accept':_0x0d7c('0x5f')},'json':!![]};if(_0x298479[_0x0d7c('0x53')]===_0x0d7c('0x60')){_0x243617['headers'][_0x0d7c('0x61')]=util[_0x0d7c('0x5d')](_0x0d7c('0x62'),new Buffer(util[_0x0d7c('0x5d')](_0x0d7c('0x63'),_0x298479[_0x0d7c('0x54')],_0x298479[_0x0d7c('0x55')]))[_0x0d7c('0x64')](_0x0d7c('0x65')));}return rp(_0x243617)[_0x0d7c('0x23')](function(_0xd95681){return _0x4935a8[_0x0d7c('0x66')](_[_0x0d7c('0x2f')](_0xd95681[_0x0d7c('0x67')]['entries'],function(_0x5f5811){return{'id':_0x5f5811[_0x0d7c('0x26')],'name':_0x5f5811['name'],'type':_0x5f5811[_0x0d7c('0x2c')],'active':_0x5f5811[_0x0d7c('0x68')],'label':_0x5f5811[_0x0d7c('0x69')],'custom':!![]};}));});}})['then'](function(_0x50adec){return{'count':_0x50adec[_0x0d7c('0x45')],'rows':_0x50adec};})['then'](respondWithResult(_0x410598,null))['catch'](function(_0x3ee2e4){var _0x36962d=_0x3e7e29['query'][_0x0d7c('0x6a')]?0x1f4:_0x3ee2e4[_0x0d7c('0x6b')]||0x1f4;logger[_0x0d7c('0x6c')](_0x0d7c('0x6d'),_0x0d7c('0x51'),_0x36962d,JSON[_0x0d7c('0x6e')](_0x3ee2e4));delete _0x3ee2e4[_0x0d7c('0x26')];if(_0x36962d===0x191){_0x36962d=0x190;}_0x410598[_0x0d7c('0x18')](_0x36962d)[_0x0d7c('0x27')](_0x3e7e29[_0x0d7c('0x30')][_0x0d7c('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x3ee2e4[_0x0d7c('0x6b')]}:_0x3ee2e4);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 2fe743f..3c6d54a 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 _0x17e7=['moment','bluebird','path','../../components/integrations/configuration','exports','define','DeskAccount','lodash','../../config/logger','api'];(function(_0x57b733,_0x5df5f9){var _0x332322=function(_0x4abf18){while(--_0x4abf18){_0x57b733['push'](_0x57b733['shift']());}};_0x332322(++_0x5df5f9);}(_0x17e7,0x1e7));var _0x717e=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0x17e7[_0x3e7e96];return _0x13f6f0;};'use strict';var _=require(_0x717e('0x0'));var util=require('util');var logger=require(_0x717e('0x1'))(_0x717e('0x2'));var moment=require(_0x717e('0x3'));var BPromise=require(_0x717e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x717e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x717e('0x6'));module[_0x717e('0x7')]=function(_0x5e8a5a,_0x24a9eb){return _0x5e8a5a[_0x717e('0x8')](_0x717e('0x9'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa263=['moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','../../config/logger','api'];(function(_0xc6857,_0x1ddbcc){var _0x2a650d=function(_0x1f93bf){while(--_0x1f93bf){_0xc6857['push'](_0xc6857['shift']());}};_0x2a650d(++_0x1ddbcc);}(_0xa263,0x1af));var _0x3a26=function(_0x33ae4d,_0x453318){_0x33ae4d=_0x33ae4d-0x0;var _0x1801d6=_0xa263[_0x33ae4d];return _0x1801d6;};'use strict';var _=require('lodash');var util=require(_0x3a26('0x0'));var logger=require(_0x3a26('0x1'))(_0x3a26('0x2'));var moment=require(_0x3a26('0x3'));var BPromise=require('bluebird');var rp=require(_0x3a26('0x4'));var fs=require('fs');var path=require(_0x3a26('0x5'));var rimraf=require(_0x3a26('0x6'));var config=require(_0x3a26('0x7'));var attributes=require(_0x3a26('0x8'));var integrations=require(_0x3a26('0x9'));module[_0x3a26('0xa')]=function(_0x42b379,_0x6a7391){return _0x42b379[_0x3a26('0xb')](_0x3a26('0xc'),attributes,{'tableName':_0x3a26('0xd'),'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 c64289f..4acb833 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 _0x5dc9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','DeskAccount,\x20%s,\x20%s','catch','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','include','map','model','info','ShowDeskAccount','find','where','util','moment','bluebird','randomstring'];(function(_0x2ee1fe,_0x232a2){var _0x21ec79=function(_0x4334d8){while(--_0x4334d8){_0x2ee1fe['push'](_0x2ee1fe['shift']());}};_0x21ec79(++_0x232a2);}(_0x5dc9,0x1a0));var _0x95dc=function(_0x5efbcc,_0xc86234){_0x5efbcc=_0x5efbcc-0x0;var _0x465109=_0x5dc9[_0x5efbcc];return _0x465109;};'use strict';var _=require('lodash');var util=require(_0x95dc('0x0'));var moment=require(_0x95dc('0x1'));var BPromise=require(_0x95dc('0x2'));var rs=require(_0x95dc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95dc('0x4'))['db'];var utils=require(_0x95dc('0x5'));var logger=require(_0x95dc('0x6'))(_0x95dc('0x7'));var config=require(_0x95dc('0x8'));var jayson=require(_0x95dc('0x9'));var client=jayson[_0x95dc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c1ed4,_0x44f243,_0x4b0fe2){return new BPromise(function(_0x299165,_0x4ec421){return client[_0x95dc('0xb')](_0x2c1ed4,_0x4b0fe2)[_0x95dc('0xc')](function(_0x2ae521){logger['info']('DeskAccount,\x20%s,\x20%s',_0x44f243,_0x95dc('0xd'));logger[_0x95dc('0xe')](_0x95dc('0xf'),_0x44f243,_0x95dc('0xd'),JSON[_0x95dc('0x10')](_0x2ae521));if(_0x2ae521[_0x95dc('0x11')]){if(_0x2ae521[_0x95dc('0x11')]['code']===0x1f4){logger[_0x95dc('0x11')]('DeskAccount,\x20%s,\x20%s',_0x44f243,_0x2ae521[_0x95dc('0x11')][_0x95dc('0x12')]);return _0x4ec421(_0x2ae521[_0x95dc('0x11')][_0x95dc('0x12')]);}logger[_0x95dc('0x11')]('DeskAccount,\x20%s,\x20%s',_0x44f243,_0x2ae521[_0x95dc('0x11')][_0x95dc('0x12')]);return _0x299165(_0x2ae521[_0x95dc('0x11')][_0x95dc('0x12')]);}else{logger['info'](_0x95dc('0x13'),_0x44f243,_0x95dc('0xd'));_0x299165(_0x2ae521['result'][_0x95dc('0x12')]);}})[_0x95dc('0x14')](function(_0x125d9d){logger[_0x95dc('0x11')]('DeskAccount,\x20%s,\x20%s',_0x44f243,_0x125d9d);_0x4ec421(_0x125d9d);});});}exports[_0x95dc('0x15')]=function(_0x5e9c56){var _0x1a1c09=this;return new Promise(function(_0x3ca6da,_0x454811){return db[_0x95dc('0x16')][_0x95dc('0x17')]({'raw':_0x5e9c56[_0x95dc('0x18')]?_0x5e9c56[_0x95dc('0x18')][_0x95dc('0x19')]===undefined?!![]:![]:!![],'where':_0x5e9c56[_0x95dc('0x18')]?_0x5e9c56[_0x95dc('0x18')]['where']||null:null,'attributes':_0x5e9c56[_0x95dc('0x18')]?_0x5e9c56[_0x95dc('0x18')][_0x95dc('0x1a')]||null:null,'limit':_0x5e9c56[_0x95dc('0x18')]?_0x5e9c56[_0x95dc('0x18')][_0x95dc('0x1b')]||null:null,'include':_0x5e9c56[_0x95dc('0x18')]?_0x5e9c56[_0x95dc('0x18')][_0x95dc('0x1c')]?_[_0x95dc('0x1d')](_0x5e9c56[_0x95dc('0x18')]['include'],function(_0x5ae635){return{'model':db[_0x5ae635[_0x95dc('0x1e')]],'as':_0x5ae635['as'],'attributes':_0x5ae635['attributes'],'include':_0x5ae635[_0x95dc('0x1c')]?_[_0x95dc('0x1d')](_0x5ae635[_0x95dc('0x1c')],function(_0x42669d){return{'model':db[_0x42669d[_0x95dc('0x1e')]],'as':_0x42669d['as'],'attributes':_0x42669d[_0x95dc('0x1a')],'include':_0x42669d[_0x95dc('0x1c')]?_[_0x95dc('0x1d')](_0x42669d[_0x95dc('0x1c')],function(_0x1fae1e){return{'model':db[_0x1fae1e['model']],'as':_0x1fae1e['as'],'attributes':_0x1fae1e[_0x95dc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x95dc('0xc')](function(_0x57cdd7){logger[_0x95dc('0x1f')](_0x95dc('0x15'),_0x5e9c56);logger[_0x95dc('0xe')](_0x95dc('0x15'),_0x5e9c56,JSON[_0x95dc('0x10')](_0x57cdd7));_0x3ca6da(_0x57cdd7);})[_0x95dc('0x14')](function(_0x5cd2b0){logger[_0x95dc('0x11')](_0x95dc('0x15'),_0x5cd2b0['message'],_0x5e9c56);_0x454811(_0x1a1c09[_0x95dc('0x11')](0x1f4,_0x5cd2b0[_0x95dc('0x12')]));});});};exports[_0x95dc('0x20')]=function(_0xcdbd4b){var _0x346d6f=this;return new Promise(function(_0x181247,_0x656ace){return db[_0x95dc('0x16')][_0x95dc('0x21')]({'raw':_0xcdbd4b[_0x95dc('0x18')]?_0xcdbd4b[_0x95dc('0x18')][_0x95dc('0x19')]===undefined?!![]:![]:!![],'where':_0xcdbd4b[_0x95dc('0x18')]?_0xcdbd4b[_0x95dc('0x18')][_0x95dc('0x22')]||null:null,'attributes':_0xcdbd4b[_0x95dc('0x18')]?_0xcdbd4b[_0x95dc('0x18')][_0x95dc('0x1a')]||null:null,'include':_0xcdbd4b[_0x95dc('0x18')]?_0xcdbd4b['options'][_0x95dc('0x1c')]?_[_0x95dc('0x1d')](_0xcdbd4b['options'][_0x95dc('0x1c')],function(_0x526163){return{'model':db[_0x526163[_0x95dc('0x1e')]],'as':_0x526163['as'],'attributes':_0x526163[_0x95dc('0x1a')],'include':_0x526163['include']?_['map'](_0x526163[_0x95dc('0x1c')],function(_0x419391){return{'model':db[_0x419391[_0x95dc('0x1e')]],'as':_0x419391['as'],'attributes':_0x419391[_0x95dc('0x1a')],'include':_0x419391['include']?_['map'](_0x419391['include'],function(_0x102718){return{'model':db[_0x102718['model']],'as':_0x102718['as'],'attributes':_0x102718[_0x95dc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x95dc('0xc')](function(_0x2a9dc7){logger[_0x95dc('0x1f')](_0x95dc('0x20'),_0xcdbd4b);logger['debug'](_0x95dc('0x20'),_0xcdbd4b,JSON[_0x95dc('0x10')](_0x2a9dc7));_0x181247(_0x2a9dc7);})['catch'](function(_0x3d946f){logger['error'](_0x95dc('0x20'),_0x3d946f[_0x95dc('0x12')],_0xcdbd4b);_0x656ace(_0x346d6f[_0x95dc('0x11')](0x1f4,_0x3d946f[_0x95dc('0x12')]));});});}; \ No newline at end of file +var _0xbda0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowDeskAccount','find','lodash','util'];(function(_0x2ba445,_0x51829d){var _0x193e60=function(_0x2bbe84){while(--_0x2bbe84){_0x2ba445['push'](_0x2ba445['shift']());}};_0x193e60(++_0x51829d);}(_0xbda0,0xc1));var _0x0bda=function(_0xe6e723,_0x5af822){_0xe6e723=_0xe6e723-0x0;var _0x1585b3=_0xbda0[_0xe6e723];return _0x1585b3;};'use strict';var _=require(_0x0bda('0x0'));var util=require(_0x0bda('0x1'));var moment=require(_0x0bda('0x2'));var BPromise=require(_0x0bda('0x3'));var rs=require(_0x0bda('0x4'));var fs=require('fs');var Redis=require(_0x0bda('0x5'));var db=require(_0x0bda('0x6'))['db'];var utils=require(_0x0bda('0x7'));var logger=require(_0x0bda('0x8'))(_0x0bda('0x9'));var config=require('../../config/environment');var jayson=require(_0x0bda('0xa'));var client=jayson[_0x0bda('0xb')][_0x0bda('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b68d2,_0x352df3,_0x17f428){return new BPromise(function(_0x51c959,_0x59731a){return client[_0x0bda('0xd')](_0x5b68d2,_0x17f428)[_0x0bda('0xe')](function(_0x3ad022){logger[_0x0bda('0xf')](_0x0bda('0x10'),_0x352df3,_0x0bda('0x11'));logger[_0x0bda('0x12')](_0x0bda('0x13'),_0x352df3,_0x0bda('0x11'),JSON[_0x0bda('0x14')](_0x3ad022));if(_0x3ad022['error']){if(_0x3ad022[_0x0bda('0x15')][_0x0bda('0x16')]===0x1f4){logger[_0x0bda('0x15')](_0x0bda('0x10'),_0x352df3,_0x3ad022[_0x0bda('0x15')][_0x0bda('0x17')]);return _0x59731a(_0x3ad022[_0x0bda('0x15')][_0x0bda('0x17')]);}logger[_0x0bda('0x15')](_0x0bda('0x10'),_0x352df3,_0x3ad022[_0x0bda('0x15')][_0x0bda('0x17')]);return _0x51c959(_0x3ad022[_0x0bda('0x15')]['message']);}else{logger[_0x0bda('0xf')](_0x0bda('0x10'),_0x352df3,_0x0bda('0x11'));_0x51c959(_0x3ad022[_0x0bda('0x18')][_0x0bda('0x17')]);}})[_0x0bda('0x19')](function(_0x876149){logger['error']('DeskAccount,\x20%s,\x20%s',_0x352df3,_0x876149);_0x59731a(_0x876149);});});}exports[_0x0bda('0x1a')]=function(_0x1a2444){var _0x3249ba=this;return new Promise(function(_0x315ed3,_0x3526dd){return db[_0x0bda('0x1b')][_0x0bda('0x1c')]({'raw':_0x1a2444['options']?_0x1a2444[_0x0bda('0x1d')][_0x0bda('0x1e')]===undefined?!![]:![]:!![],'where':_0x1a2444[_0x0bda('0x1d')]?_0x1a2444[_0x0bda('0x1d')][_0x0bda('0x1f')]||null:null,'attributes':_0x1a2444[_0x0bda('0x1d')]?_0x1a2444['options']['attributes']||null:null,'limit':_0x1a2444[_0x0bda('0x1d')]?_0x1a2444[_0x0bda('0x1d')][_0x0bda('0x20')]||null:null,'include':_0x1a2444[_0x0bda('0x1d')]?_0x1a2444[_0x0bda('0x1d')][_0x0bda('0x21')]?_['map'](_0x1a2444[_0x0bda('0x1d')]['include'],function(_0x203678){return{'model':db[_0x203678['model']],'as':_0x203678['as'],'attributes':_0x203678['attributes'],'include':_0x203678['include']?_[_0x0bda('0x22')](_0x203678['include'],function(_0x3b5f70){return{'model':db[_0x3b5f70[_0x0bda('0x23')]],'as':_0x3b5f70['as'],'attributes':_0x3b5f70[_0x0bda('0x24')],'include':_0x3b5f70[_0x0bda('0x21')]?_[_0x0bda('0x22')](_0x3b5f70[_0x0bda('0x21')],function(_0x33b007){return{'model':db[_0x33b007[_0x0bda('0x23')]],'as':_0x33b007['as'],'attributes':_0x33b007[_0x0bda('0x24')]};}):[]};}):[]};}):[]:[]})[_0x0bda('0xe')](function(_0x122967){logger[_0x0bda('0xf')](_0x0bda('0x1a'),_0x1a2444);logger['debug'](_0x0bda('0x1a'),_0x1a2444,JSON[_0x0bda('0x14')](_0x122967));_0x315ed3(_0x122967);})[_0x0bda('0x19')](function(_0x186ef8){logger[_0x0bda('0x15')](_0x0bda('0x1a'),_0x186ef8[_0x0bda('0x17')],_0x1a2444);_0x3526dd(_0x3249ba[_0x0bda('0x15')](0x1f4,_0x186ef8[_0x0bda('0x17')]));});});};exports[_0x0bda('0x25')]=function(_0x1fb2d3){var _0x145798=this;return new Promise(function(_0x4ffe67,_0x33e8b1){return db[_0x0bda('0x1b')][_0x0bda('0x26')]({'raw':_0x1fb2d3[_0x0bda('0x1d')]?_0x1fb2d3[_0x0bda('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1fb2d3[_0x0bda('0x1d')]?_0x1fb2d3['options'][_0x0bda('0x1f')]||null:null,'attributes':_0x1fb2d3[_0x0bda('0x1d')]?_0x1fb2d3['options'][_0x0bda('0x24')]||null:null,'include':_0x1fb2d3[_0x0bda('0x1d')]?_0x1fb2d3['options'][_0x0bda('0x21')]?_[_0x0bda('0x22')](_0x1fb2d3[_0x0bda('0x1d')]['include'],function(_0x43671e){return{'model':db[_0x43671e[_0x0bda('0x23')]],'as':_0x43671e['as'],'attributes':_0x43671e[_0x0bda('0x24')],'include':_0x43671e[_0x0bda('0x21')]?_[_0x0bda('0x22')](_0x43671e[_0x0bda('0x21')],function(_0x5f30f9){return{'model':db[_0x5f30f9[_0x0bda('0x23')]],'as':_0x5f30f9['as'],'attributes':_0x5f30f9[_0x0bda('0x24')],'include':_0x5f30f9[_0x0bda('0x21')]?_[_0x0bda('0x22')](_0x5f30f9[_0x0bda('0x21')],function(_0x1d4d94){return{'model':db[_0x1d4d94[_0x0bda('0x23')]],'as':_0x1d4d94['as'],'attributes':_0x1d4d94[_0x0bda('0x24')]};}):[]};}):[]};}):[]:[]})[_0x0bda('0xe')](function(_0x6415f4){logger['info']('ShowDeskAccount',_0x1fb2d3);logger[_0x0bda('0x12')]('ShowDeskAccount',_0x1fb2d3,JSON[_0x0bda('0x14')](_0x6415f4));_0x4ffe67(_0x6415f4);})[_0x0bda('0x19')](function(_0x33ee95){logger[_0x0bda('0x15')]('ShowDeskAccount',_0x33ee95[_0x0bda('0x17')],_0x1fb2d3);_0x33e8b1(_0x145798[_0x0bda('0x15')](0x1f4,_0x33ee95[_0x0bda('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index ed9927d..338d391 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(_0x5c480e,_0xd0d491){var _0x314bf1=function(_0x40b3d3){while(--_0x40b3d3){_0x5c480e['push'](_0x5c480e['shift']());}};_0x314bf1(++_0xd0d491);}(_0x008c,0x188));var _0xc008=function(_0xbf802e,_0x329296){_0xbf802e=_0xbf802e-0x0;var _0x19e99b=_0x008c[_0xbf802e];return _0x19e99b;};'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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x55ca,0x126));var _0xa55c=function(_0x1e2072,_0xe3cc90){_0x1e2072=_0x1e2072-0x0;var _0x22956b=_0x55ca[_0x1e2072];return _0x22956b;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index e49c491..7588be3 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 _0xe8f0=['exports','STRING','sequelize'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0xe8f0,0x77));var _0x0e8f=function(_0x56075e,_0x46683a){_0x56075e=_0x56075e-0x0;var _0x2ac212=_0xe8f0[_0x56075e];return _0x2ac212;};'use strict';var Sequelize=require(_0x0e8f('0x0'));module[_0x0e8f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0e8f('0x2')]}}; \ No newline at end of file +var _0xd19b=['exports','STRING','sequelize'];(function(_0x31da7e,_0x1068d7){var _0x2f2b06=function(_0x5b2ef7){while(--_0x5b2ef7){_0x31da7e['push'](_0x31da7e['shift']());}};_0x2f2b06(++_0x1068d7);}(_0xd19b,0x18b));var _0xbd19=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0xd19b[_0x2077c2];return _0x312f9f;};'use strict';var Sequelize=require(_0xbd19('0x0'));module[_0xbd19('0x1')]={'name':{'type':Sequelize[_0xbd19('0x2')]},'description':{'type':Sequelize[_0xbd19('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 64a5299..b34fc15 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 _0xb905=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','sendStatus','error','name','status','send','index','map','DeskConfiguration','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','create','body','update','getFields','findOne','DeskField','getSubjects','nolimit','getDescriptions','getTags','setTags','ids','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x726489,_0x13c760){var _0x1b9def=function(_0x5f0022){while(--_0x5f0022){_0x726489['push'](_0x726489['shift']());}};_0x1b9def(++_0x13c760);}(_0xb905,0x1df));var _0x5b90=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xb905[_0x21549c];return _0x426cbd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5b90('0x0'));var jsonpatch=require(_0x5b90('0x1'));var rp=require('request-promise');var moment=require(_0x5b90('0x2'));var BPromise=require(_0x5b90('0x3'));var Mustache=require(_0x5b90('0x4'));var util=require(_0x5b90('0x5'));var path=require(_0x5b90('0x6'));var sox=require(_0x5b90('0x7'));var csv=require(_0x5b90('0x8'));var ejs=require(_0x5b90('0x9'));var fs=require('fs');var fs_extra=require(_0x5b90('0xa'));var _=require(_0x5b90('0xb'));var squel=require(_0x5b90('0xc'));var crypto=require(_0x5b90('0xd'));var jsforce=require(_0x5b90('0xe'));var deskjs=require(_0x5b90('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5b90('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5b90('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b90('0x12'));var logger=require('../../config/logger')(_0x5b90('0x13'));var utils=require('../../config/utils');var config=require(_0x5b90('0x14'));var licenseUtil=require(_0x5b90('0x15'));var db=require(_0x5b90('0x16'))['db'];function respondWithStatusCode(_0x33a18c,_0x5b5c61){_0x5b5c61=_0x5b5c61||0xcc;return function(_0x7c62c2){if(_0x7c62c2){return _0x33a18c['sendStatus'](_0x5b5c61);}return _0x33a18c['status'](_0x5b5c61)[_0x5b90('0x17')]();};}function respondWithResult(_0x89fb76,_0x5bd179){_0x5bd179=_0x5bd179||0xc8;return function(_0x482086){if(_0x482086){return _0x89fb76['status'](_0x5bd179)[_0x5b90('0x18')](_0x482086);}};}function respondWithFilteredResult(_0x4febfc,_0x1eda2d){return function(_0x122353){if(_0x122353){var _0x386d41=typeof _0x1eda2d[_0x5b90('0x19')]===_0x5b90('0x1a')&&typeof _0x1eda2d[_0x5b90('0x1b')]===_0x5b90('0x1a');var _0x824542=_0x122353[_0x5b90('0x1c')];var _0x3b0502=_0x386d41?0x0:_0x1eda2d['offset'];var _0xd6f676=_0x386d41?_0x122353[_0x5b90('0x1c')]:_0x1eda2d[_0x5b90('0x19')]+_0x1eda2d['limit'];var _0x5bcb0c;if(_0xd6f676>=_0x824542){_0xd6f676=_0x824542;_0x5bcb0c=0xc8;}else{_0x5bcb0c=0xce;}_0x4febfc['status'](_0x5bcb0c);return _0x4febfc[_0x5b90('0x1d')](_0x5b90('0x1e'),_0x3b0502+'-'+_0xd6f676+'/'+_0x824542)['json'](_0x122353);}return null;};}function patchUpdates(_0x341cd6){return function(_0x3b7c04){try{jsonpatch['apply'](_0x3b7c04,_0x341cd6,!![]);}catch(_0x57f752){return BPromise['reject'](_0x57f752);}return _0x3b7c04[_0x5b90('0x1f')]();};}function saveUpdates(_0x52ce9f,_0x34ec0d){return function(_0x45865f){if(_0x45865f){return _0x45865f['update'](_0x52ce9f)[_0x5b90('0x20')](function(_0xa0cafe){return _0xa0cafe;});}return null;};}function removeEntity(_0x80e54b,_0x39ffd5){return function(_0xe612d1){if(_0xe612d1){return _0xe612d1[_0x5b90('0x21')]()['then'](function(){_0x80e54b['status'](0xcc)[_0x5b90('0x17')]();});}};}function handleEntityNotFound(_0x3f2693,_0x5188f7){return function(_0x5ac007){if(!_0x5ac007){_0x3f2693[_0x5b90('0x22')](0x194);}return _0x5ac007;};}function handleError(_0x4fa6b6,_0x1bfcf5){_0x1bfcf5=_0x1bfcf5||0x1f4;return function(_0x1ea54d){logger[_0x5b90('0x23')](_0x1ea54d['stack']);if(_0x1ea54d[_0x5b90('0x24')]){delete _0x1ea54d[_0x5b90('0x24')];}_0x4fa6b6[_0x5b90('0x25')](_0x1bfcf5)[_0x5b90('0x26')](_0x1ea54d);};}exports[_0x5b90('0x27')]=function(_0x191bc8,_0x4fc6d1){var _0x577bdf={},_0x484bfe={},_0xd0bb91={'count':0x0,'rows':[]};var _0x4485c6=_[_0x5b90('0x28')](db[_0x5b90('0x29')][_0x5b90('0x2a')],function(_0x1fdb11){return{'name':_0x1fdb11['fieldName'],'type':_0x1fdb11['type']['key']};});_0x484bfe[_0x5b90('0x2b')]=_['map'](_0x4485c6,_0x5b90('0x24'));_0x484bfe[_0x5b90('0x2c')]=_['keys'](_0x191bc8[_0x5b90('0x2c')]);_0x484bfe[_0x5b90('0x2d')]=_[_0x5b90('0x2e')](_0x484bfe['model'],_0x484bfe['query']);_0x577bdf[_0x5b90('0x2f')]=_['intersection'](_0x484bfe[_0x5b90('0x2b')],qs[_0x5b90('0x30')](_0x191bc8[_0x5b90('0x2c')][_0x5b90('0x30')]));_0x577bdf[_0x5b90('0x2f')]=_0x577bdf['attributes'][_0x5b90('0x31')]?_0x577bdf[_0x5b90('0x2f')]:_0x484bfe['model'];if(!_0x191bc8['query'][_0x5b90('0x32')]('nolimit')){_0x577bdf[_0x5b90('0x1b')]=qs[_0x5b90('0x1b')](_0x191bc8['query'][_0x5b90('0x1b')]);_0x577bdf['offset']=qs[_0x5b90('0x19')](_0x191bc8[_0x5b90('0x2c')][_0x5b90('0x19')]);}_0x577bdf[_0x5b90('0x33')]=qs[_0x5b90('0x34')](_0x191bc8[_0x5b90('0x2c')][_0x5b90('0x34')]);_0x577bdf[_0x5b90('0x35')]=qs[_0x5b90('0x2d')](_[_0x5b90('0x36')](_0x191bc8[_0x5b90('0x2c')],_0x484bfe[_0x5b90('0x2d')]),_0x4485c6);if(_0x191bc8[_0x5b90('0x2c')]['filter']){_0x577bdf[_0x5b90('0x35')]=_['merge'](_0x577bdf[_0x5b90('0x35')],{'$or':_['map'](_0x4485c6,function(_0x311446){if(_0x311446[_0x5b90('0x37')]!==_0x5b90('0x38')){var _0x310e8e={};_0x310e8e[_0x311446[_0x5b90('0x24')]]={'$like':'%'+_0x191bc8[_0x5b90('0x2c')][_0x5b90('0x39')]+'%'};return _0x310e8e;}})});}_0x577bdf=_['merge']({},_0x577bdf,_0x191bc8[_0x5b90('0x3a')]);var _0x121b29={'where':_0x577bdf[_0x5b90('0x35')]};return db[_0x5b90('0x29')][_0x5b90('0x1c')](_0x121b29)[_0x5b90('0x20')](function(_0x2e267e){_0xd0bb91[_0x5b90('0x1c')]=_0x2e267e;if(_0x191bc8[_0x5b90('0x2c')][_0x5b90('0x3b')]){_0x577bdf[_0x5b90('0x3c')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x5b90('0x3d')](_0x577bdf);})['then'](function(_0x4a2c99){_0xd0bb91[_0x5b90('0x3e')]=_0x4a2c99;return _0xd0bb91;})[_0x5b90('0x20')](respondWithFilteredResult(_0x4fc6d1,_0x577bdf))[_0x5b90('0x3f')](handleError(_0x4fc6d1,null));};exports[_0x5b90('0x40')]=function(_0x7cab0b,_0x21630c){var _0x1e58b1={'raw':![],'where':{'id':_0x7cab0b[_0x5b90('0x41')]['id']}},_0x234a91={};_0x234a91[_0x5b90('0x2b')]=_[_0x5b90('0x42')](db[_0x5b90('0x29')][_0x5b90('0x2a')]);_0x234a91[_0x5b90('0x2c')]=_[_0x5b90('0x42')](_0x7cab0b[_0x5b90('0x2c')]);_0x234a91['filters']=_[_0x5b90('0x2e')](_0x234a91[_0x5b90('0x2b')],_0x234a91[_0x5b90('0x2c')]);_0x1e58b1[_0x5b90('0x2f')]=_[_0x5b90('0x2e')](_0x234a91[_0x5b90('0x2b')],qs[_0x5b90('0x30')](_0x7cab0b['query'][_0x5b90('0x30')]));_0x1e58b1['attributes']=_0x1e58b1[_0x5b90('0x2f')]['length']?_0x1e58b1[_0x5b90('0x2f')]:_0x234a91[_0x5b90('0x2b')];if(_0x7cab0b['query'][_0x5b90('0x3b')]){_0x1e58b1[_0x5b90('0x3c')]=[{'all':!![]}];}_0x1e58b1=_[_0x5b90('0x43')]({},_0x1e58b1,_0x7cab0b['options']);return db['DeskConfiguration'][_0x5b90('0x44')](_0x1e58b1)[_0x5b90('0x20')](handleEntityNotFound(_0x21630c,null))[_0x5b90('0x20')](respondWithResult(_0x21630c,null))[_0x5b90('0x3f')](handleError(_0x21630c,null));};exports['create']=function(_0x4756ce,_0x1a6ede){return db[_0x5b90('0x29')][_0x5b90('0x45')](_0x4756ce[_0x5b90('0x46')],{})[_0x5b90('0x20')](respondWithResult(_0x1a6ede,0xc9))[_0x5b90('0x3f')](handleError(_0x1a6ede,null));};exports[_0x5b90('0x47')]=function(_0x247c74,_0x595308){if(_0x247c74['body']['id']){delete _0x247c74[_0x5b90('0x46')]['id'];}return db['DeskConfiguration'][_0x5b90('0x44')]({'where':{'id':_0x247c74['params']['id']}})[_0x5b90('0x20')](handleEntityNotFound(_0x595308,null))[_0x5b90('0x20')](saveUpdates(_0x247c74['body'],null))[_0x5b90('0x20')](respondWithResult(_0x595308,null))['catch'](handleError(_0x595308,null));};exports[_0x5b90('0x21')]=function(_0x377753,_0x170596){return db[_0x5b90('0x29')]['find']({'where':{'id':_0x377753[_0x5b90('0x41')]['id']}})[_0x5b90('0x20')](handleEntityNotFound(_0x170596,null))[_0x5b90('0x20')](removeEntity(_0x170596,null))[_0x5b90('0x3f')](handleError(_0x170596,null));};exports[_0x5b90('0x48')]=function(_0x465d13,_0x151eca,_0x3fa10f){var _0x3f5c09={};var _0x12a2c4={};var _0x333476;var _0x1cefe5;return db[_0x5b90('0x29')][_0x5b90('0x49')]({'where':{'id':_0x465d13[_0x5b90('0x41')]['id']}})[_0x5b90('0x20')](handleEntityNotFound(_0x151eca,null))[_0x5b90('0x20')](function(_0x20daa5){if(_0x20daa5){_0x333476=_0x20daa5;_0x12a2c4[_0x5b90('0x2b')]=_[_0x5b90('0x42')](db[_0x5b90('0x4a')][_0x5b90('0x2a')]);_0x12a2c4[_0x5b90('0x2c')]=_[_0x5b90('0x42')](_0x465d13[_0x5b90('0x2c')]);_0x12a2c4[_0x5b90('0x2d')]=_[_0x5b90('0x2e')](_0x12a2c4['model'],_0x12a2c4[_0x5b90('0x2c')]);_0x3f5c09[_0x5b90('0x2f')]=_['intersection'](_0x12a2c4[_0x5b90('0x2b')],qs[_0x5b90('0x30')](_0x465d13[_0x5b90('0x2c')][_0x5b90('0x30')]));_0x3f5c09[_0x5b90('0x2f')]=_0x3f5c09[_0x5b90('0x2f')][_0x5b90('0x31')]?_0x3f5c09['attributes']:_0x12a2c4[_0x5b90('0x2b')];_0x3f5c09[_0x5b90('0x33')]=qs['sort'](_0x465d13[_0x5b90('0x2c')]['sort']);_0x3f5c09[_0x5b90('0x35')]=qs[_0x5b90('0x2d')](_['pick'](_0x465d13[_0x5b90('0x2c')],_0x12a2c4[_0x5b90('0x2d')]));if(_0x465d13['query'][_0x5b90('0x39')]){_0x3f5c09[_0x5b90('0x35')]=_[_0x5b90('0x43')](_0x3f5c09['where'],{'$or':_[_0x5b90('0x28')](_0x3f5c09['attributes'],function(_0x44f777){var _0xdace1f={};_0xdace1f[_0x44f777]={'$like':'%'+_0x465d13[_0x5b90('0x2c')][_0x5b90('0x39')]+'%'};return _0xdace1f;})});}_0x3f5c09=_[_0x5b90('0x43')]({},_0x3f5c09,_0x465d13[_0x5b90('0x3a')]);return _0x333476[_0x5b90('0x48')](_0x3f5c09);}})[_0x5b90('0x20')](function(_0x46c59c){if(_0x46c59c){_0x1cefe5=_0x46c59c[_0x5b90('0x31')];if(!_0x465d13[_0x5b90('0x2c')]['hasOwnProperty']('nolimit')){_0x3f5c09['limit']=qs[_0x5b90('0x1b')](_0x465d13[_0x5b90('0x2c')][_0x5b90('0x1b')]);_0x3f5c09[_0x5b90('0x19')]=qs[_0x5b90('0x19')](_0x465d13[_0x5b90('0x2c')][_0x5b90('0x19')]);}return _0x333476[_0x5b90('0x48')](_0x3f5c09);}})['then'](function(_0x3d10fb){if(_0x3d10fb){return _0x3d10fb?{'count':_0x1cefe5,'rows':_0x3d10fb}:null;}})[_0x5b90('0x20')](respondWithResult(_0x151eca,null))[_0x5b90('0x3f')](handleError(_0x151eca,null));};exports[_0x5b90('0x4b')]=function(_0x3360ba,_0x507b5f,_0x467ab6){var _0x59f4ec={};var _0x1c2d4a={};var _0x37ecf5;var _0x582b82;return db[_0x5b90('0x29')][_0x5b90('0x49')]({'where':{'id':_0x3360ba['params']['id']}})[_0x5b90('0x20')](handleEntityNotFound(_0x507b5f,null))[_0x5b90('0x20')](function(_0x6af349){if(_0x6af349){_0x37ecf5=_0x6af349;_0x1c2d4a[_0x5b90('0x2b')]=_[_0x5b90('0x42')](db[_0x5b90('0x4a')][_0x5b90('0x2a')]);_0x1c2d4a[_0x5b90('0x2c')]=_[_0x5b90('0x42')](_0x3360ba[_0x5b90('0x2c')]);_0x1c2d4a[_0x5b90('0x2d')]=_[_0x5b90('0x2e')](_0x1c2d4a['model'],_0x1c2d4a[_0x5b90('0x2c')]);_0x59f4ec[_0x5b90('0x2f')]=_[_0x5b90('0x2e')](_0x1c2d4a[_0x5b90('0x2b')],qs[_0x5b90('0x30')](_0x3360ba[_0x5b90('0x2c')][_0x5b90('0x30')]));_0x59f4ec[_0x5b90('0x2f')]=_0x59f4ec[_0x5b90('0x2f')][_0x5b90('0x31')]?_0x59f4ec[_0x5b90('0x2f')]:_0x1c2d4a[_0x5b90('0x2b')];_0x59f4ec[_0x5b90('0x33')]=qs[_0x5b90('0x34')](_0x3360ba[_0x5b90('0x2c')][_0x5b90('0x34')]);_0x59f4ec[_0x5b90('0x35')]=qs['filters'](_[_0x5b90('0x36')](_0x3360ba['query'],_0x1c2d4a[_0x5b90('0x2d')]));if(_0x3360ba['query'][_0x5b90('0x39')]){_0x59f4ec[_0x5b90('0x35')]=_['merge'](_0x59f4ec[_0x5b90('0x35')],{'$or':_[_0x5b90('0x28')](_0x59f4ec[_0x5b90('0x2f')],function(_0x47cc25){var _0x4446b9={};_0x4446b9[_0x47cc25]={'$like':'%'+_0x3360ba[_0x5b90('0x2c')][_0x5b90('0x39')]+'%'};return _0x4446b9;})});}_0x59f4ec=_[_0x5b90('0x43')]({},_0x59f4ec,_0x3360ba[_0x5b90('0x3a')]);return _0x37ecf5['getSubjects'](_0x59f4ec);}})[_0x5b90('0x20')](function(_0x527d9f){if(_0x527d9f){_0x582b82=_0x527d9f[_0x5b90('0x31')];if(!_0x3360ba[_0x5b90('0x2c')][_0x5b90('0x32')](_0x5b90('0x4c'))){_0x59f4ec[_0x5b90('0x1b')]=qs[_0x5b90('0x1b')](_0x3360ba[_0x5b90('0x2c')]['limit']);_0x59f4ec[_0x5b90('0x19')]=qs[_0x5b90('0x19')](_0x3360ba[_0x5b90('0x2c')][_0x5b90('0x19')]);}return _0x37ecf5[_0x5b90('0x4b')](_0x59f4ec);}})[_0x5b90('0x20')](function(_0x1a80e5){if(_0x1a80e5){return _0x1a80e5?{'count':_0x582b82,'rows':_0x1a80e5}:null;}})['then'](respondWithResult(_0x507b5f,null))['catch'](handleError(_0x507b5f,null));};exports[_0x5b90('0x4d')]=function(_0x273c51,_0x248b1a,_0x39b44a){var _0x1ee100={};var _0x4bf377={};var _0x220362;var _0x232f69;return db['DeskConfiguration'][_0x5b90('0x49')]({'where':{'id':_0x273c51[_0x5b90('0x41')]['id']}})[_0x5b90('0x20')](handleEntityNotFound(_0x248b1a,null))[_0x5b90('0x20')](function(_0x3bdf18){if(_0x3bdf18){_0x220362=_0x3bdf18;_0x4bf377[_0x5b90('0x2b')]=_[_0x5b90('0x42')](db[_0x5b90('0x4a')][_0x5b90('0x2a')]);_0x4bf377[_0x5b90('0x2c')]=_[_0x5b90('0x42')](_0x273c51[_0x5b90('0x2c')]);_0x4bf377[_0x5b90('0x2d')]=_[_0x5b90('0x2e')](_0x4bf377['model'],_0x4bf377[_0x5b90('0x2c')]);_0x1ee100[_0x5b90('0x2f')]=_['intersection'](_0x4bf377[_0x5b90('0x2b')],qs[_0x5b90('0x30')](_0x273c51[_0x5b90('0x2c')]['fields']));_0x1ee100[_0x5b90('0x2f')]=_0x1ee100[_0x5b90('0x2f')]['length']?_0x1ee100['attributes']:_0x4bf377[_0x5b90('0x2b')];_0x1ee100[_0x5b90('0x33')]=qs[_0x5b90('0x34')](_0x273c51['query'][_0x5b90('0x34')]);_0x1ee100['where']=qs[_0x5b90('0x2d')](_[_0x5b90('0x36')](_0x273c51[_0x5b90('0x2c')],_0x4bf377['filters']));if(_0x273c51[_0x5b90('0x2c')]['filter']){_0x1ee100[_0x5b90('0x35')]=_[_0x5b90('0x43')](_0x1ee100[_0x5b90('0x35')],{'$or':_[_0x5b90('0x28')](_0x1ee100[_0x5b90('0x2f')],function(_0x13cb67){var _0x1ee8c1={};_0x1ee8c1[_0x13cb67]={'$like':'%'+_0x273c51[_0x5b90('0x2c')][_0x5b90('0x39')]+'%'};return _0x1ee8c1;})});}_0x1ee100=_[_0x5b90('0x43')]({},_0x1ee100,_0x273c51['options']);return _0x220362[_0x5b90('0x4d')](_0x1ee100);}})['then'](function(_0x4419bc){if(_0x4419bc){_0x232f69=_0x4419bc[_0x5b90('0x31')];if(!_0x273c51[_0x5b90('0x2c')][_0x5b90('0x32')](_0x5b90('0x4c'))){_0x1ee100[_0x5b90('0x1b')]=qs[_0x5b90('0x1b')](_0x273c51[_0x5b90('0x2c')]['limit']);_0x1ee100[_0x5b90('0x19')]=qs['offset'](_0x273c51[_0x5b90('0x2c')]['offset']);}return _0x220362[_0x5b90('0x4d')](_0x1ee100);}})[_0x5b90('0x20')](function(_0x550ea1){if(_0x550ea1){return _0x550ea1?{'count':_0x232f69,'rows':_0x550ea1}:null;}})[_0x5b90('0x20')](respondWithResult(_0x248b1a,null))[_0x5b90('0x3f')](handleError(_0x248b1a,null));};exports[_0x5b90('0x4e')]=function(_0x169c56,_0x2edb52,_0x4cee51){var _0x5e58e6={};var _0x41ecfc={};var _0x239516;var _0x2dbc90;return db[_0x5b90('0x29')][_0x5b90('0x49')]({'where':{'id':_0x169c56[_0x5b90('0x41')]['id']}})[_0x5b90('0x20')](handleEntityNotFound(_0x2edb52,null))[_0x5b90('0x20')](function(_0x377698){if(_0x377698){_0x239516=_0x377698;_0x41ecfc[_0x5b90('0x2b')]=_[_0x5b90('0x42')](db['Tag']['rawAttributes']);_0x41ecfc[_0x5b90('0x2c')]=_[_0x5b90('0x42')](_0x169c56[_0x5b90('0x2c')]);_0x41ecfc['filters']=_[_0x5b90('0x2e')](_0x41ecfc[_0x5b90('0x2b')],_0x41ecfc[_0x5b90('0x2c')]);_0x5e58e6[_0x5b90('0x2f')]=_[_0x5b90('0x2e')](_0x41ecfc[_0x5b90('0x2b')],qs[_0x5b90('0x30')](_0x169c56[_0x5b90('0x2c')]['fields']));_0x5e58e6[_0x5b90('0x2f')]=_0x5e58e6[_0x5b90('0x2f')][_0x5b90('0x31')]?_0x5e58e6[_0x5b90('0x2f')]:_0x41ecfc[_0x5b90('0x2b')];_0x5e58e6[_0x5b90('0x33')]=qs[_0x5b90('0x34')](_0x169c56[_0x5b90('0x2c')][_0x5b90('0x34')]);_0x5e58e6[_0x5b90('0x35')]=qs[_0x5b90('0x2d')](_[_0x5b90('0x36')](_0x169c56[_0x5b90('0x2c')],_0x41ecfc['filters']));if(_0x169c56[_0x5b90('0x2c')][_0x5b90('0x39')]){_0x5e58e6[_0x5b90('0x35')]=_[_0x5b90('0x43')](_0x5e58e6[_0x5b90('0x35')],{'$or':_['map'](_0x5e58e6['attributes'],function(_0x2ee581){var _0x571dae={};_0x571dae[_0x2ee581]={'$like':'%'+_0x169c56[_0x5b90('0x2c')][_0x5b90('0x39')]+'%'};return _0x571dae;})});}_0x5e58e6=_[_0x5b90('0x43')]({},_0x5e58e6,_0x169c56['options']);return _0x239516[_0x5b90('0x4e')](_0x5e58e6);}})[_0x5b90('0x20')](function(_0x26ff66){if(_0x26ff66){_0x2dbc90=_0x26ff66[_0x5b90('0x31')];if(!_0x169c56['query'][_0x5b90('0x32')]('nolimit')){_0x5e58e6[_0x5b90('0x1b')]=qs[_0x5b90('0x1b')](_0x169c56[_0x5b90('0x2c')][_0x5b90('0x1b')]);_0x5e58e6['offset']=qs[_0x5b90('0x19')](_0x169c56[_0x5b90('0x2c')]['offset']);}return _0x239516[_0x5b90('0x4e')](_0x5e58e6);}})[_0x5b90('0x20')](function(_0x1c9cb0){if(_0x1c9cb0){return _0x1c9cb0?{'count':_0x2dbc90,'rows':_0x1c9cb0}:null;}})[_0x5b90('0x20')](respondWithResult(_0x2edb52,null))[_0x5b90('0x3f')](handleError(_0x2edb52,null));};exports[_0x5b90('0x4f')]=function(_0x533967,_0x3e12b6,_0x2b7cc1){if(_0x533967[_0x5b90('0x46')]['id']){delete _0x533967[_0x5b90('0x46')]['id'];}return db[_0x5b90('0x29')]['findOne']({'where':{'id':_0x533967['params']['id']}})[_0x5b90('0x20')](handleEntityNotFound(_0x3e12b6,null))[_0x5b90('0x20')](function(_0x3070e7){if(_0x3070e7){return _0x3070e7[_0x5b90('0x4f')](_0x533967[_0x5b90('0x46')][_0x5b90('0x50')]||[]);}return null;})['then'](respondWithResult(_0x3e12b6,null))[_0x5b90('0x3f')](handleError(_0x3e12b6,null));}; \ No newline at end of file +var _0x1e9e=['keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','merge','create','body','find','findOne','DeskField','getFields','hasOwnProperty','getSubjects','getDescriptions','Tag','setTags','ids','eml-format','rimraf','request-promise','moment','util','sox','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','DeskConfiguration','rawAttributes','fieldName','type','key','model','query'];(function(_0x51c4a4,_0x57383a){var _0x393e9a=function(_0x4f5108){while(--_0x4f5108){_0x51c4a4['push'](_0x51c4a4['shift']());}};_0x393e9a(++_0x57383a);}(_0x1e9e,0x15e));var _0xe1e9=function(_0x52d1e7,_0x10d8ef){_0x52d1e7=_0x52d1e7-0x0;var _0x42b16f=_0x1e9e[_0x52d1e7];return _0x42b16f;};'use strict';var emlformat=require(_0xe1e9('0x0'));var rimraf=require(_0xe1e9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe1e9('0x2'));var moment=require(_0xe1e9('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe1e9('0x4'));var path=require('path');var sox=require(_0xe1e9('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe1e9('0x6'));var jsforce=require(_0xe1e9('0x7'));var deskjs=require('desk.js');var toCsv=require(_0xe1e9('0x8'));var querystring=require(_0xe1e9('0x9'));var Papa=require(_0xe1e9('0xa'));var Redis=require(_0xe1e9('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xe1e9('0xc'));var as=require(_0xe1e9('0xd'));var hardwareService=require(_0xe1e9('0xe'));var logger=require(_0xe1e9('0xf'))(_0xe1e9('0x10'));var utils=require('../../config/utils');var config=require(_0xe1e9('0x11'));var licenseUtil=require(_0xe1e9('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x522d21,_0x1eebcb){_0x1eebcb=_0x1eebcb||0xcc;return function(_0x4a50bc){if(_0x4a50bc){return _0x522d21['sendStatus'](_0x1eebcb);}return _0x522d21[_0xe1e9('0x13')](_0x1eebcb)[_0xe1e9('0x14')]();};}function respondWithResult(_0x286e13,_0x373e3e){_0x373e3e=_0x373e3e||0xc8;return function(_0xcf251a){if(_0xcf251a){return _0x286e13['status'](_0x373e3e)[_0xe1e9('0x15')](_0xcf251a);}};}function respondWithFilteredResult(_0xf45f20,_0x403587){return function(_0x55fb32){if(_0x55fb32){var _0x4e44ee=typeof _0x403587['offset']===_0xe1e9('0x16')&&typeof _0x403587[_0xe1e9('0x17')]==='undefined';var _0x1ee136=_0x55fb32[_0xe1e9('0x18')];var _0xa478e=_0x4e44ee?0x0:_0x403587[_0xe1e9('0x19')];var _0x27e780=_0x4e44ee?_0x55fb32[_0xe1e9('0x18')]:_0x403587[_0xe1e9('0x19')]+_0x403587['limit'];var _0x29471a;if(_0x27e780>=_0x1ee136){_0x27e780=_0x1ee136;_0x29471a=0xc8;}else{_0x29471a=0xce;}_0xf45f20[_0xe1e9('0x13')](_0x29471a);return _0xf45f20[_0xe1e9('0x1a')]('Content-Range',_0xa478e+'-'+_0x27e780+'/'+_0x1ee136)[_0xe1e9('0x15')](_0x55fb32);}return null;};}function patchUpdates(_0xe86ce1){return function(_0x2f8401){try{jsonpatch[_0xe1e9('0x1b')](_0x2f8401,_0xe86ce1,!![]);}catch(_0x300188){return BPromise[_0xe1e9('0x1c')](_0x300188);}return _0x2f8401[_0xe1e9('0x1d')]();};}function saveUpdates(_0x6cd0c8,_0x181e76){return function(_0x37266f){if(_0x37266f){return _0x37266f[_0xe1e9('0x1e')](_0x6cd0c8)[_0xe1e9('0x1f')](function(_0x16195c){return _0x16195c;});}return null;};}function removeEntity(_0x4bb443,_0xee837d){return function(_0x102b47){if(_0x102b47){return _0x102b47[_0xe1e9('0x20')]()['then'](function(){_0x4bb443['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x171b4a,_0xdb072e){return function(_0x4214fa){if(!_0x4214fa){_0x171b4a[_0xe1e9('0x21')](0x194);}return _0x4214fa;};}function handleError(_0x1a0005,_0x15653b){_0x15653b=_0x15653b||0x1f4;return function(_0x9cb9cd){logger[_0xe1e9('0x22')](_0x9cb9cd[_0xe1e9('0x23')]);if(_0x9cb9cd[_0xe1e9('0x24')]){delete _0x9cb9cd[_0xe1e9('0x24')];}_0x1a0005[_0xe1e9('0x13')](_0x15653b)[_0xe1e9('0x25')](_0x9cb9cd);};}exports['index']=function(_0x5f4eb0,_0x11d809){var _0x3d6d7a={},_0x53ce2f={},_0x28e501={'count':0x0,'rows':[]};var _0x95f842=_['map'](db[_0xe1e9('0x26')][_0xe1e9('0x27')],function(_0x477002){return{'name':_0x477002[_0xe1e9('0x28')],'type':_0x477002[_0xe1e9('0x29')][_0xe1e9('0x2a')]};});_0x53ce2f[_0xe1e9('0x2b')]=_['map'](_0x95f842,'name');_0x53ce2f[_0xe1e9('0x2c')]=_[_0xe1e9('0x2d')](_0x5f4eb0['query']);_0x53ce2f[_0xe1e9('0x2e')]=_['intersection'](_0x53ce2f[_0xe1e9('0x2b')],_0x53ce2f['query']);_0x3d6d7a[_0xe1e9('0x2f')]=_[_0xe1e9('0x30')](_0x53ce2f['model'],qs[_0xe1e9('0x31')](_0x5f4eb0['query'][_0xe1e9('0x31')]));_0x3d6d7a[_0xe1e9('0x2f')]=_0x3d6d7a[_0xe1e9('0x2f')]['length']?_0x3d6d7a[_0xe1e9('0x2f')]:_0x53ce2f['model'];if(!_0x5f4eb0[_0xe1e9('0x2c')]['hasOwnProperty'](_0xe1e9('0x32'))){_0x3d6d7a[_0xe1e9('0x17')]=qs[_0xe1e9('0x17')](_0x5f4eb0[_0xe1e9('0x2c')][_0xe1e9('0x17')]);_0x3d6d7a[_0xe1e9('0x19')]=qs[_0xe1e9('0x19')](_0x5f4eb0['query']['offset']);}_0x3d6d7a[_0xe1e9('0x33')]=qs[_0xe1e9('0x34')](_0x5f4eb0['query']['sort']);_0x3d6d7a[_0xe1e9('0x35')]=qs[_0xe1e9('0x2e')](_[_0xe1e9('0x36')](_0x5f4eb0[_0xe1e9('0x2c')],_0x53ce2f[_0xe1e9('0x2e')]),_0x95f842);if(_0x5f4eb0[_0xe1e9('0x2c')][_0xe1e9('0x37')]){_0x3d6d7a[_0xe1e9('0x35')]=_['merge'](_0x3d6d7a[_0xe1e9('0x35')],{'$or':_[_0xe1e9('0x38')](_0x95f842,function(_0xcebfa5){if(_0xcebfa5['type']!==_0xe1e9('0x39')){var _0x162927={};_0x162927[_0xcebfa5[_0xe1e9('0x24')]]={'$like':'%'+_0x5f4eb0[_0xe1e9('0x2c')][_0xe1e9('0x37')]+'%'};return _0x162927;}})});}_0x3d6d7a=_['merge']({},_0x3d6d7a,_0x5f4eb0[_0xe1e9('0x3a')]);var _0x3a2377={'where':_0x3d6d7a[_0xe1e9('0x35')]};return db[_0xe1e9('0x26')][_0xe1e9('0x18')](_0x3a2377)[_0xe1e9('0x1f')](function(_0x27c174){_0x28e501[_0xe1e9('0x18')]=_0x27c174;if(_0x5f4eb0[_0xe1e9('0x2c')][_0xe1e9('0x3b')]){_0x3d6d7a[_0xe1e9('0x3c')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xe1e9('0x3d')](_0x3d6d7a);})[_0xe1e9('0x1f')](function(_0x242f31){_0x28e501[_0xe1e9('0x3e')]=_0x242f31;return _0x28e501;})[_0xe1e9('0x1f')](respondWithFilteredResult(_0x11d809,_0x3d6d7a))[_0xe1e9('0x3f')](handleError(_0x11d809,null));};exports['show']=function(_0x3715b3,_0x3f95a9){var _0x47ffa9={'raw':![],'where':{'id':_0x3715b3[_0xe1e9('0x40')]['id']}},_0x73a410={};_0x73a410[_0xe1e9('0x2b')]=_[_0xe1e9('0x2d')](db[_0xe1e9('0x26')]['rawAttributes']);_0x73a410[_0xe1e9('0x2c')]=_[_0xe1e9('0x2d')](_0x3715b3[_0xe1e9('0x2c')]);_0x73a410[_0xe1e9('0x2e')]=_['intersection'](_0x73a410[_0xe1e9('0x2b')],_0x73a410[_0xe1e9('0x2c')]);_0x47ffa9['attributes']=_[_0xe1e9('0x30')](_0x73a410[_0xe1e9('0x2b')],qs[_0xe1e9('0x31')](_0x3715b3[_0xe1e9('0x2c')][_0xe1e9('0x31')]));_0x47ffa9['attributes']=_0x47ffa9['attributes'][_0xe1e9('0x41')]?_0x47ffa9['attributes']:_0x73a410[_0xe1e9('0x2b')];if(_0x3715b3[_0xe1e9('0x2c')][_0xe1e9('0x3b')]){_0x47ffa9[_0xe1e9('0x3c')]=[{'all':!![]}];}_0x47ffa9=_[_0xe1e9('0x42')]({},_0x47ffa9,_0x3715b3[_0xe1e9('0x3a')]);return db[_0xe1e9('0x26')]['find'](_0x47ffa9)[_0xe1e9('0x1f')](handleEntityNotFound(_0x3f95a9,null))[_0xe1e9('0x1f')](respondWithResult(_0x3f95a9,null))[_0xe1e9('0x3f')](handleError(_0x3f95a9,null));};exports[_0xe1e9('0x43')]=function(_0x23c5fd,_0x7b4ef5){return db[_0xe1e9('0x26')][_0xe1e9('0x43')](_0x23c5fd[_0xe1e9('0x44')],{})['then'](respondWithResult(_0x7b4ef5,0xc9))[_0xe1e9('0x3f')](handleError(_0x7b4ef5,null));};exports[_0xe1e9('0x1e')]=function(_0x419a9e,_0x16b0fd){if(_0x419a9e[_0xe1e9('0x44')]['id']){delete _0x419a9e[_0xe1e9('0x44')]['id'];}return db['DeskConfiguration'][_0xe1e9('0x45')]({'where':{'id':_0x419a9e[_0xe1e9('0x40')]['id']}})[_0xe1e9('0x1f')](handleEntityNotFound(_0x16b0fd,null))['then'](saveUpdates(_0x419a9e['body'],null))[_0xe1e9('0x1f')](respondWithResult(_0x16b0fd,null))[_0xe1e9('0x3f')](handleError(_0x16b0fd,null));};exports[_0xe1e9('0x20')]=function(_0x33b81f,_0x12fc28){return db[_0xe1e9('0x26')][_0xe1e9('0x45')]({'where':{'id':_0x33b81f[_0xe1e9('0x40')]['id']}})[_0xe1e9('0x1f')](handleEntityNotFound(_0x12fc28,null))['then'](removeEntity(_0x12fc28,null))[_0xe1e9('0x3f')](handleError(_0x12fc28,null));};exports['getFields']=function(_0x4ddd8b,_0x5753d5,_0xa13c15){var _0x464789={};var _0x51bb7a={};var _0x110a21;var _0x3f79a5;return db[_0xe1e9('0x26')][_0xe1e9('0x46')]({'where':{'id':_0x4ddd8b['params']['id']}})[_0xe1e9('0x1f')](handleEntityNotFound(_0x5753d5,null))[_0xe1e9('0x1f')](function(_0x58cc13){if(_0x58cc13){_0x110a21=_0x58cc13;_0x51bb7a[_0xe1e9('0x2b')]=_['keys'](db[_0xe1e9('0x47')][_0xe1e9('0x27')]);_0x51bb7a[_0xe1e9('0x2c')]=_[_0xe1e9('0x2d')](_0x4ddd8b[_0xe1e9('0x2c')]);_0x51bb7a[_0xe1e9('0x2e')]=_[_0xe1e9('0x30')](_0x51bb7a[_0xe1e9('0x2b')],_0x51bb7a[_0xe1e9('0x2c')]);_0x464789[_0xe1e9('0x2f')]=_[_0xe1e9('0x30')](_0x51bb7a['model'],qs['fields'](_0x4ddd8b[_0xe1e9('0x2c')][_0xe1e9('0x31')]));_0x464789[_0xe1e9('0x2f')]=_0x464789['attributes'][_0xe1e9('0x41')]?_0x464789[_0xe1e9('0x2f')]:_0x51bb7a['model'];_0x464789[_0xe1e9('0x33')]=qs['sort'](_0x4ddd8b[_0xe1e9('0x2c')][_0xe1e9('0x34')]);_0x464789[_0xe1e9('0x35')]=qs[_0xe1e9('0x2e')](_[_0xe1e9('0x36')](_0x4ddd8b[_0xe1e9('0x2c')],_0x51bb7a[_0xe1e9('0x2e')]));if(_0x4ddd8b['query'][_0xe1e9('0x37')]){_0x464789[_0xe1e9('0x35')]=_['merge'](_0x464789['where'],{'$or':_[_0xe1e9('0x38')](_0x464789['attributes'],function(_0x199a07){var _0x44dfaa={};_0x44dfaa[_0x199a07]={'$like':'%'+_0x4ddd8b[_0xe1e9('0x2c')][_0xe1e9('0x37')]+'%'};return _0x44dfaa;})});}_0x464789=_[_0xe1e9('0x42')]({},_0x464789,_0x4ddd8b[_0xe1e9('0x3a')]);return _0x110a21[_0xe1e9('0x48')](_0x464789);}})['then'](function(_0x287e6b){if(_0x287e6b){_0x3f79a5=_0x287e6b[_0xe1e9('0x41')];if(!_0x4ddd8b['query'][_0xe1e9('0x49')](_0xe1e9('0x32'))){_0x464789['limit']=qs[_0xe1e9('0x17')](_0x4ddd8b[_0xe1e9('0x2c')][_0xe1e9('0x17')]);_0x464789[_0xe1e9('0x19')]=qs[_0xe1e9('0x19')](_0x4ddd8b[_0xe1e9('0x2c')][_0xe1e9('0x19')]);}return _0x110a21[_0xe1e9('0x48')](_0x464789);}})[_0xe1e9('0x1f')](function(_0x3d6eba){if(_0x3d6eba){return _0x3d6eba?{'count':_0x3f79a5,'rows':_0x3d6eba}:null;}})['then'](respondWithResult(_0x5753d5,null))[_0xe1e9('0x3f')](handleError(_0x5753d5,null));};exports[_0xe1e9('0x4a')]=function(_0xc05b2e,_0x151fdd,_0x1d3dcc){var _0x474614={};var _0x193623={};var _0x439ad3;var _0x5f2d1b;return db[_0xe1e9('0x26')][_0xe1e9('0x46')]({'where':{'id':_0xc05b2e[_0xe1e9('0x40')]['id']}})[_0xe1e9('0x1f')](handleEntityNotFound(_0x151fdd,null))['then'](function(_0x5655c8){if(_0x5655c8){_0x439ad3=_0x5655c8;_0x193623[_0xe1e9('0x2b')]=_[_0xe1e9('0x2d')](db[_0xe1e9('0x47')][_0xe1e9('0x27')]);_0x193623[_0xe1e9('0x2c')]=_[_0xe1e9('0x2d')](_0xc05b2e[_0xe1e9('0x2c')]);_0x193623[_0xe1e9('0x2e')]=_[_0xe1e9('0x30')](_0x193623[_0xe1e9('0x2b')],_0x193623['query']);_0x474614[_0xe1e9('0x2f')]=_[_0xe1e9('0x30')](_0x193623['model'],qs[_0xe1e9('0x31')](_0xc05b2e[_0xe1e9('0x2c')][_0xe1e9('0x31')]));_0x474614[_0xe1e9('0x2f')]=_0x474614[_0xe1e9('0x2f')]['length']?_0x474614[_0xe1e9('0x2f')]:_0x193623[_0xe1e9('0x2b')];_0x474614['order']=qs[_0xe1e9('0x34')](_0xc05b2e[_0xe1e9('0x2c')][_0xe1e9('0x34')]);_0x474614['where']=qs[_0xe1e9('0x2e')](_[_0xe1e9('0x36')](_0xc05b2e['query'],_0x193623['filters']));if(_0xc05b2e[_0xe1e9('0x2c')][_0xe1e9('0x37')]){_0x474614['where']=_[_0xe1e9('0x42')](_0x474614[_0xe1e9('0x35')],{'$or':_[_0xe1e9('0x38')](_0x474614['attributes'],function(_0x5554f4){var _0x3e34dd={};_0x3e34dd[_0x5554f4]={'$like':'%'+_0xc05b2e[_0xe1e9('0x2c')][_0xe1e9('0x37')]+'%'};return _0x3e34dd;})});}_0x474614=_[_0xe1e9('0x42')]({},_0x474614,_0xc05b2e[_0xe1e9('0x3a')]);return _0x439ad3[_0xe1e9('0x4a')](_0x474614);}})[_0xe1e9('0x1f')](function(_0x49d805){if(_0x49d805){_0x5f2d1b=_0x49d805[_0xe1e9('0x41')];if(!_0xc05b2e['query'][_0xe1e9('0x49')]('nolimit')){_0x474614['limit']=qs['limit'](_0xc05b2e[_0xe1e9('0x2c')][_0xe1e9('0x17')]);_0x474614[_0xe1e9('0x19')]=qs[_0xe1e9('0x19')](_0xc05b2e[_0xe1e9('0x2c')][_0xe1e9('0x19')]);}return _0x439ad3[_0xe1e9('0x4a')](_0x474614);}})['then'](function(_0x34ec00){if(_0x34ec00){return _0x34ec00?{'count':_0x5f2d1b,'rows':_0x34ec00}:null;}})[_0xe1e9('0x1f')](respondWithResult(_0x151fdd,null))[_0xe1e9('0x3f')](handleError(_0x151fdd,null));};exports['getDescriptions']=function(_0x57d540,_0x470d70,_0x4d2ce8){var _0x20d55d={};var _0xc3f6c2={};var _0x281818;var _0xb317cb;return db[_0xe1e9('0x26')]['findOne']({'where':{'id':_0x57d540['params']['id']}})['then'](handleEntityNotFound(_0x470d70,null))[_0xe1e9('0x1f')](function(_0x4b0daf){if(_0x4b0daf){_0x281818=_0x4b0daf;_0xc3f6c2[_0xe1e9('0x2b')]=_['keys'](db[_0xe1e9('0x47')][_0xe1e9('0x27')]);_0xc3f6c2[_0xe1e9('0x2c')]=_['keys'](_0x57d540['query']);_0xc3f6c2[_0xe1e9('0x2e')]=_['intersection'](_0xc3f6c2[_0xe1e9('0x2b')],_0xc3f6c2['query']);_0x20d55d[_0xe1e9('0x2f')]=_[_0xe1e9('0x30')](_0xc3f6c2[_0xe1e9('0x2b')],qs[_0xe1e9('0x31')](_0x57d540['query'][_0xe1e9('0x31')]));_0x20d55d[_0xe1e9('0x2f')]=_0x20d55d[_0xe1e9('0x2f')]['length']?_0x20d55d['attributes']:_0xc3f6c2['model'];_0x20d55d['order']=qs['sort'](_0x57d540[_0xe1e9('0x2c')][_0xe1e9('0x34')]);_0x20d55d[_0xe1e9('0x35')]=qs[_0xe1e9('0x2e')](_[_0xe1e9('0x36')](_0x57d540['query'],_0xc3f6c2[_0xe1e9('0x2e')]));if(_0x57d540[_0xe1e9('0x2c')][_0xe1e9('0x37')]){_0x20d55d['where']=_['merge'](_0x20d55d[_0xe1e9('0x35')],{'$or':_[_0xe1e9('0x38')](_0x20d55d[_0xe1e9('0x2f')],function(_0x58c57b){var _0x5c848b={};_0x5c848b[_0x58c57b]={'$like':'%'+_0x57d540['query'][_0xe1e9('0x37')]+'%'};return _0x5c848b;})});}_0x20d55d=_['merge']({},_0x20d55d,_0x57d540[_0xe1e9('0x3a')]);return _0x281818['getDescriptions'](_0x20d55d);}})['then'](function(_0x48b952){if(_0x48b952){_0xb317cb=_0x48b952[_0xe1e9('0x41')];if(!_0x57d540['query'][_0xe1e9('0x49')](_0xe1e9('0x32'))){_0x20d55d[_0xe1e9('0x17')]=qs[_0xe1e9('0x17')](_0x57d540[_0xe1e9('0x2c')][_0xe1e9('0x17')]);_0x20d55d[_0xe1e9('0x19')]=qs[_0xe1e9('0x19')](_0x57d540[_0xe1e9('0x2c')][_0xe1e9('0x19')]);}return _0x281818[_0xe1e9('0x4b')](_0x20d55d);}})[_0xe1e9('0x1f')](function(_0x5ea626){if(_0x5ea626){return _0x5ea626?{'count':_0xb317cb,'rows':_0x5ea626}:null;}})['then'](respondWithResult(_0x470d70,null))[_0xe1e9('0x3f')](handleError(_0x470d70,null));};exports['getTags']=function(_0xb41087,_0x4d42b1,_0x52fcfa){var _0x13446d={};var _0x331e7b={};var _0x16b77f;var _0x23b98b;return db[_0xe1e9('0x26')][_0xe1e9('0x46')]({'where':{'id':_0xb41087['params']['id']}})[_0xe1e9('0x1f')](handleEntityNotFound(_0x4d42b1,null))[_0xe1e9('0x1f')](function(_0x49bf62){if(_0x49bf62){_0x16b77f=_0x49bf62;_0x331e7b[_0xe1e9('0x2b')]=_['keys'](db[_0xe1e9('0x4c')][_0xe1e9('0x27')]);_0x331e7b['query']=_['keys'](_0xb41087[_0xe1e9('0x2c')]);_0x331e7b['filters']=_[_0xe1e9('0x30')](_0x331e7b['model'],_0x331e7b[_0xe1e9('0x2c')]);_0x13446d['attributes']=_[_0xe1e9('0x30')](_0x331e7b[_0xe1e9('0x2b')],qs[_0xe1e9('0x31')](_0xb41087[_0xe1e9('0x2c')]['fields']));_0x13446d['attributes']=_0x13446d[_0xe1e9('0x2f')][_0xe1e9('0x41')]?_0x13446d[_0xe1e9('0x2f')]:_0x331e7b[_0xe1e9('0x2b')];_0x13446d[_0xe1e9('0x33')]=qs[_0xe1e9('0x34')](_0xb41087[_0xe1e9('0x2c')][_0xe1e9('0x34')]);_0x13446d[_0xe1e9('0x35')]=qs[_0xe1e9('0x2e')](_[_0xe1e9('0x36')](_0xb41087[_0xe1e9('0x2c')],_0x331e7b[_0xe1e9('0x2e')]));if(_0xb41087[_0xe1e9('0x2c')][_0xe1e9('0x37')]){_0x13446d[_0xe1e9('0x35')]=_[_0xe1e9('0x42')](_0x13446d[_0xe1e9('0x35')],{'$or':_['map'](_0x13446d[_0xe1e9('0x2f')],function(_0x491be5){var _0x52c2a7={};_0x52c2a7[_0x491be5]={'$like':'%'+_0xb41087[_0xe1e9('0x2c')]['filter']+'%'};return _0x52c2a7;})});}_0x13446d=_[_0xe1e9('0x42')]({},_0x13446d,_0xb41087[_0xe1e9('0x3a')]);return _0x16b77f['getTags'](_0x13446d);}})[_0xe1e9('0x1f')](function(_0x47f6d4){if(_0x47f6d4){_0x23b98b=_0x47f6d4['length'];if(!_0xb41087[_0xe1e9('0x2c')]['hasOwnProperty'](_0xe1e9('0x32'))){_0x13446d[_0xe1e9('0x17')]=qs['limit'](_0xb41087[_0xe1e9('0x2c')][_0xe1e9('0x17')]);_0x13446d[_0xe1e9('0x19')]=qs['offset'](_0xb41087['query'][_0xe1e9('0x19')]);}return _0x16b77f['getTags'](_0x13446d);}})[_0xe1e9('0x1f')](function(_0x2faa65){if(_0x2faa65){return _0x2faa65?{'count':_0x23b98b,'rows':_0x2faa65}:null;}})['then'](respondWithResult(_0x4d42b1,null))['catch'](handleError(_0x4d42b1,null));};exports[_0xe1e9('0x4d')]=function(_0xebb6d3,_0x207a19,_0x102b2a){if(_0xebb6d3[_0xe1e9('0x44')]['id']){delete _0xebb6d3['body']['id'];}return db['DeskConfiguration'][_0xe1e9('0x46')]({'where':{'id':_0xebb6d3[_0xe1e9('0x40')]['id']}})[_0xe1e9('0x1f')](handleEntityNotFound(_0x207a19,null))[_0xe1e9('0x1f')](function(_0x2f7e96){if(_0x2f7e96){return _0x2f7e96[_0xe1e9('0x4d')](_0xebb6d3[_0xe1e9('0x44')][_0xe1e9('0x4e')]||[]);}return null;})[_0xe1e9('0x1f')](respondWithResult(_0x207a19,null))[_0xe1e9('0x3f')](handleError(_0x207a19,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 5c173bb..915b3ee 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 _0xa28c=['define','DeskConfiguration','int_desk_configurations','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xa28c,0x1dc));var _0xca28=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xa28c[_0xdea41a];return _0x15d0d8;};'use strict';var _=require('lodash');var util=require(_0xca28('0x0'));var logger=require(_0xca28('0x1'))(_0xca28('0x2'));var moment=require('moment');var BPromise=require(_0xca28('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xca28('0x4'));var config=require(_0xca28('0x5'));var attributes=require(_0xca28('0x6'));module[_0xca28('0x7')]=function(_0x4915e2,_0x20a456){return _0x4915e2[_0xca28('0x8')](_0xca28('0x9'),attributes,{'tableName':_0xca28('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93dc=['int_desk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93dc,0x161));var _0xc93d=function(_0x1ae611,_0x34dd8b){_0x1ae611=_0x1ae611-0x0;var _0x64fc33=_0x93dc[_0x1ae611];return _0x64fc33;};'use strict';var _=require(_0xc93d('0x0'));var util=require(_0xc93d('0x1'));var logger=require(_0xc93d('0x2'))('api');var moment=require(_0xc93d('0x3'));var BPromise=require(_0xc93d('0x4'));var rp=require(_0xc93d('0x5'));var fs=require('fs');var path=require(_0xc93d('0x6'));var rimraf=require('rimraf');var config=require(_0xc93d('0x7'));var attributes=require(_0xc93d('0x8'));module['exports']=function(_0xf3ab33,_0x41e14b){return _0xf3ab33[_0xc93d('0x9')]('DeskConfiguration',attributes,{'tableName':_0xc93d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index c501594..84e1a8b 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 _0x9a0a=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9a0a,0x7c));var _0xa9a0=function(_0x45a017,_0x11184b){_0x45a017=_0x45a017-0x0;var _0x1dd44b=_0x9a0a[_0x45a017];return _0x1dd44b;};'use strict';var _=require(_0xa9a0('0x0'));var util=require(_0xa9a0('0x1'));var moment=require(_0xa9a0('0x2'));var BPromise=require(_0xa9a0('0x3'));var rs=require(_0xa9a0('0x4'));var fs=require('fs');var Redis=require(_0xa9a0('0x5'));var db=require(_0xa9a0('0x6'))['db'];var utils=require(_0xa9a0('0x7'));var logger=require(_0xa9a0('0x8'))('rpc');var config=require(_0xa9a0('0x9'));var jayson=require(_0xa9a0('0xa'));var client=jayson[_0xa9a0('0xb')][_0xa9a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1357ea,_0x20b546,_0x48070c){return new BPromise(function(_0x13b1c0,_0xbd243b){return client[_0xa9a0('0xd')](_0x1357ea,_0x48070c)[_0xa9a0('0xe')](function(_0x316175){logger['info'](_0xa9a0('0xf'),_0x20b546,'request\x20sent');logger[_0xa9a0('0x10')](_0xa9a0('0x11'),_0x20b546,_0xa9a0('0x12'),JSON[_0xa9a0('0x13')](_0x316175));if(_0x316175['error']){if(_0x316175[_0xa9a0('0x14')][_0xa9a0('0x15')]===0x1f4){logger[_0xa9a0('0x14')](_0xa9a0('0xf'),_0x20b546,_0x316175[_0xa9a0('0x14')][_0xa9a0('0x16')]);return _0xbd243b(_0x316175[_0xa9a0('0x14')]['message']);}logger[_0xa9a0('0x14')](_0xa9a0('0xf'),_0x20b546,_0x316175[_0xa9a0('0x14')][_0xa9a0('0x16')]);return _0x13b1c0(_0x316175[_0xa9a0('0x14')][_0xa9a0('0x16')]);}else{logger[_0xa9a0('0x17')](_0xa9a0('0xf'),_0x20b546,_0xa9a0('0x12'));_0x13b1c0(_0x316175[_0xa9a0('0x18')]['message']);}})[_0xa9a0('0x19')](function(_0x523b44){logger[_0xa9a0('0x14')](_0xa9a0('0xf'),_0x20b546,_0x523b44);_0xbd243b(_0x523b44);});});} \ No newline at end of file +var _0xfdf7=['info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0xf65979,_0x202b31){var _0x35f5db=function(_0x2aa9ef){while(--_0x2aa9ef){_0xf65979['push'](_0xf65979['shift']());}};_0x35f5db(++_0x202b31);}(_0xfdf7,0xfa));var _0x7fdf=function(_0x206ca8,_0x34739a){_0x206ca8=_0x206ca8-0x0;var _0x508d10=_0xfdf7[_0x206ca8];return _0x508d10;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7fdf('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7fdf('0x1'))['db'];var utils=require(_0x7fdf('0x2'));var logger=require(_0x7fdf('0x3'))(_0x7fdf('0x4'));var config=require('../../config/environment');var jayson=require(_0x7fdf('0x5'));var client=jayson[_0x7fdf('0x6')][_0x7fdf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x46d7fa,_0xe31014,_0x289a2c){return new BPromise(function(_0x4ef023,_0x50ffe2){return client[_0x7fdf('0x8')](_0x46d7fa,_0x289a2c)[_0x7fdf('0x9')](function(_0x4f69dd){logger[_0x7fdf('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0xe31014,_0x7fdf('0xb'));logger['debug'](_0x7fdf('0xc'),_0xe31014,_0x7fdf('0xb'),JSON[_0x7fdf('0xd')](_0x4f69dd));if(_0x4f69dd['error']){if(_0x4f69dd[_0x7fdf('0xe')][_0x7fdf('0xf')]===0x1f4){logger[_0x7fdf('0xe')](_0x7fdf('0x10'),_0xe31014,_0x4f69dd[_0x7fdf('0xe')]['message']);return _0x50ffe2(_0x4f69dd[_0x7fdf('0xe')]['message']);}logger[_0x7fdf('0xe')](_0x7fdf('0x10'),_0xe31014,_0x4f69dd[_0x7fdf('0xe')][_0x7fdf('0x11')]);return _0x4ef023(_0x4f69dd[_0x7fdf('0xe')][_0x7fdf('0x11')]);}else{logger[_0x7fdf('0xa')](_0x7fdf('0x10'),_0xe31014,_0x7fdf('0xb'));_0x4ef023(_0x4f69dd[_0x7fdf('0x12')][_0x7fdf('0x11')]);}})[_0x7fdf('0x13')](function(_0xcfa636){logger[_0x7fdf('0xe')](_0x7fdf('0x10'),_0xe31014,_0xcfa636);_0x50ffe2(_0xcfa636);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 72a26b1..8d909db 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 _0xdca2=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','create','put','delete','destroy','exports','multer','path'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xdca2,0xfd));var _0x2dca=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xdca2[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0x2dca('0x0'));var util=require('util');var path=require(_0x2dca('0x1'));var timeout=require('connect-timeout');var express=require(_0x2dca('0x2'));var router=express['Router']();var fs_extra=require(_0x2dca('0x3'));var auth=require(_0x2dca('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2dca('0x5'));var controller=require('./intDeskField.controller');router[_0x2dca('0x6')]('/',auth[_0x2dca('0x7')](),controller['index']);router['get'](_0x2dca('0x8'),auth['isAuthenticated'](),controller[_0x2dca('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2dca('0xa')]);router[_0x2dca('0xb')](_0x2dca('0x8'),auth[_0x2dca('0x7')](),controller['update']);router[_0x2dca('0xc')]('/:id',auth[_0x2dca('0x7')](),controller[_0x2dca('0xd')]);module[_0x2dca('0xe')]=router; \ No newline at end of file +var _0x3442=['create','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x4535b2,_0x4f07b0){var _0x4c5bab=function(_0x5bf957){while(--_0x5bf957){_0x4535b2['push'](_0x4535b2['shift']());}};_0x4c5bab(++_0x4f07b0);}(_0x3442,0x15a));var _0x2344=function(_0x16cee3,_0x1feb79){_0x16cee3=_0x16cee3-0x0;var _0x3023b3=_0x3442[_0x16cee3];return _0x3023b3;};'use strict';var multer=require('multer');var util=require(_0x2344('0x0'));var path=require(_0x2344('0x1'));var timeout=require(_0x2344('0x2'));var express=require(_0x2344('0x3'));var router=express[_0x2344('0x4')]();var fs_extra=require(_0x2344('0x5'));var auth=require(_0x2344('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2344('0x7'));var controller=require(_0x2344('0x8'));router['get']('/',auth[_0x2344('0x9')](),controller[_0x2344('0xa')]);router[_0x2344('0xb')](_0x2344('0xc'),auth[_0x2344('0x9')](),controller[_0x2344('0xd')]);router[_0x2344('0xe')]('/',auth[_0x2344('0x9')](),controller[_0x2344('0xf')]);router['put'](_0x2344('0xc'),auth[_0x2344('0x9')](),controller[_0x2344('0x10')]);router[_0x2344('0x11')](_0x2344('0xc'),auth[_0x2344('0x9')](),controller['destroy']);module[_0x2344('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index dd49520..acde286 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 _0xf326=['keyValue','STRING','sequelize','string','variable','customVariable'];(function(_0xf844b0,_0x467e30){var _0x13ba96=function(_0x3940ec){while(--_0x3940ec){_0xf844b0['push'](_0xf844b0['shift']());}};_0x13ba96(++_0x467e30);}(_0xf326,0x12e));var _0x6f32=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0xf326[_0x16db8b];return _0x5ba017;};'use strict';var Sequelize=require(_0x6f32('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x6f32('0x1'),_0x6f32('0x2'),_0x6f32('0x3'),_0x6f32('0x4'),'picklist'),'defaultValue':_0x6f32('0x1')},'content':{'type':Sequelize[_0x6f32('0x5')]},'key':{'type':Sequelize[_0x6f32('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x6f32('0x1'),_0x6f32('0x2'),_0x6f32('0x3'))},'keyContent':{'type':Sequelize[_0x6f32('0x5')]},'idField':{'type':Sequelize[_0x6f32('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8a55=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8a55,0x70));var _0x58a5=function(_0x5b143e,_0x1fec76){_0x5b143e=_0x5b143e-0x0;var _0x533d3c=_0x8a55[_0x5b143e];return _0x533d3c;};'use strict';var Sequelize=require(_0x58a5('0x0'));module[_0x58a5('0x1')]={'type':{'type':Sequelize[_0x58a5('0x2')](_0x58a5('0x3'),_0x58a5('0x4'),_0x58a5('0x5'),_0x58a5('0x6'),_0x58a5('0x7')),'defaultValue':_0x58a5('0x3')},'content':{'type':Sequelize[_0x58a5('0x8')]},'key':{'type':Sequelize[_0x58a5('0x8')]},'keyType':{'type':Sequelize[_0x58a5('0x2')](_0x58a5('0x3'),_0x58a5('0x4'),_0x58a5('0x5'))},'keyContent':{'type':Sequelize[_0x58a5('0x8')]},'idField':{'type':Sequelize[_0x58a5('0x8')]},'nameField':{'type':Sequelize[_0x58a5('0x8')]},'customField':{'type':Sequelize[_0x58a5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x58a5('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 74bbaf2..8694ca3 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 _0xce22=['fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','index','map','DeskField','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','keys','include','find','create','body','params','eml-format','rimraf','zip-dir'];(function(_0xdad237,_0x361a1d){var _0x15c575=function(_0x8db2f6){while(--_0x8db2f6){_0xdad237['push'](_0xdad237['shift']());}};_0x15c575(++_0x361a1d);}(_0xce22,0xea));var _0x2ce2=function(_0x3a392d,_0x15cd42){_0x3a392d=_0x3a392d-0x0;var _0x34b227=_0xce22[_0x3a392d];return _0x34b227;};'use strict';var emlformat=require(_0x2ce2('0x0'));var rimraf=require(_0x2ce2('0x1'));var zipdir=require(_0x2ce2('0x2'));var jsonpatch=require(_0x2ce2('0x3'));var rp=require(_0x2ce2('0x4'));var moment=require('moment');var BPromise=require(_0x2ce2('0x5'));var Mustache=require('mustache');var util=require(_0x2ce2('0x6'));var path=require(_0x2ce2('0x7'));var sox=require(_0x2ce2('0x8'));var csv=require(_0x2ce2('0x9'));var ejs=require(_0x2ce2('0xa'));var fs=require('fs');var fs_extra=require(_0x2ce2('0xb'));var _=require(_0x2ce2('0xc'));var squel=require('squel');var crypto=require(_0x2ce2('0xd'));var jsforce=require(_0x2ce2('0xe'));var deskjs=require(_0x2ce2('0xf'));var toCsv=require(_0x2ce2('0x9'));var querystring=require(_0x2ce2('0x10'));var Papa=require(_0x2ce2('0x11'));var Redis=require('ioredis');var authService=require(_0x2ce2('0x12'));var qs=require(_0x2ce2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ce2('0x14'));var logger=require(_0x2ce2('0x15'))('api');var utils=require(_0x2ce2('0x16'));var config=require(_0x2ce2('0x17'));var licenseUtil=require(_0x2ce2('0x18'));var db=require(_0x2ce2('0x19'))['db'];function respondWithStatusCode(_0x4b2407,_0x1b4a4f){_0x1b4a4f=_0x1b4a4f||0xcc;return function(_0x112244){if(_0x112244){return _0x4b2407[_0x2ce2('0x1a')](_0x1b4a4f);}return _0x4b2407['status'](_0x1b4a4f)[_0x2ce2('0x1b')]();};}function respondWithResult(_0x4d3490,_0x4874a5){_0x4874a5=_0x4874a5||0xc8;return function(_0x7b8036){if(_0x7b8036){return _0x4d3490[_0x2ce2('0x1c')](_0x4874a5)[_0x2ce2('0x1d')](_0x7b8036);}};}function respondWithFilteredResult(_0x17120f,_0x1ac6e9){return function(_0x18dd99){if(_0x18dd99){var _0x313e91=typeof _0x1ac6e9['offset']==='undefined'&&typeof _0x1ac6e9['limit']===_0x2ce2('0x1e');var _0xa229b7=_0x18dd99[_0x2ce2('0x1f')];var _0x3443e6=_0x313e91?0x0:_0x1ac6e9[_0x2ce2('0x20')];var _0x560a77=_0x313e91?_0x18dd99[_0x2ce2('0x1f')]:_0x1ac6e9['offset']+_0x1ac6e9[_0x2ce2('0x21')];var _0x42f597;if(_0x560a77>=_0xa229b7){_0x560a77=_0xa229b7;_0x42f597=0xc8;}else{_0x42f597=0xce;}_0x17120f[_0x2ce2('0x1c')](_0x42f597);return _0x17120f[_0x2ce2('0x22')](_0x2ce2('0x23'),_0x3443e6+'-'+_0x560a77+'/'+_0xa229b7)[_0x2ce2('0x1d')](_0x18dd99);}return null;};}function patchUpdates(_0x578cb5){return function(_0x4d3a37){try{jsonpatch[_0x2ce2('0x24')](_0x4d3a37,_0x578cb5,!![]);}catch(_0x3d07ec){return BPromise[_0x2ce2('0x25')](_0x3d07ec);}return _0x4d3a37[_0x2ce2('0x26')]();};}function saveUpdates(_0x4838fe,_0x5b2b79){return function(_0x5b0eb3){if(_0x5b0eb3){return _0x5b0eb3[_0x2ce2('0x27')](_0x4838fe)[_0x2ce2('0x28')](function(_0x4ae9b9){return _0x4ae9b9;});}return null;};}function removeEntity(_0x17a57a,_0x43a7b6){return function(_0x51249f){if(_0x51249f){return _0x51249f[_0x2ce2('0x29')]()[_0x2ce2('0x28')](function(){_0x17a57a[_0x2ce2('0x1c')](0xcc)[_0x2ce2('0x1b')]();});}};}function handleEntityNotFound(_0x5c748f,_0x528fec){return function(_0x10748a){if(!_0x10748a){_0x5c748f['sendStatus'](0x194);}return _0x10748a;};}function handleError(_0x3ee4f8,_0x2e3296){_0x2e3296=_0x2e3296||0x1f4;return function(_0x3a701e){logger[_0x2ce2('0x2a')](_0x3a701e[_0x2ce2('0x2b')]);if(_0x3a701e['name']){delete _0x3a701e['name'];}_0x3ee4f8[_0x2ce2('0x1c')](_0x2e3296)['send'](_0x3a701e);};}exports[_0x2ce2('0x2c')]=function(_0x44f622,_0x15a245){var _0x137d06={},_0x1e1f17={},_0x2aa881={'count':0x0,'rows':[]};var _0x4b201e=_[_0x2ce2('0x2d')](db[_0x2ce2('0x2e')][_0x2ce2('0x2f')],function(_0x383315){return{'name':_0x383315[_0x2ce2('0x30')],'type':_0x383315[_0x2ce2('0x31')][_0x2ce2('0x32')]};});_0x1e1f17[_0x2ce2('0x33')]=_['map'](_0x4b201e,_0x2ce2('0x34'));_0x1e1f17['query']=_['keys'](_0x44f622[_0x2ce2('0x35')]);_0x1e1f17[_0x2ce2('0x36')]=_['intersection'](_0x1e1f17[_0x2ce2('0x33')],_0x1e1f17[_0x2ce2('0x35')]);_0x137d06[_0x2ce2('0x37')]=_[_0x2ce2('0x38')](_0x1e1f17[_0x2ce2('0x33')],qs[_0x2ce2('0x39')](_0x44f622['query'][_0x2ce2('0x39')]));_0x137d06[_0x2ce2('0x37')]=_0x137d06[_0x2ce2('0x37')][_0x2ce2('0x3a')]?_0x137d06['attributes']:_0x1e1f17[_0x2ce2('0x33')];if(!_0x44f622[_0x2ce2('0x35')][_0x2ce2('0x3b')](_0x2ce2('0x3c'))){_0x137d06[_0x2ce2('0x21')]=qs[_0x2ce2('0x21')](_0x44f622[_0x2ce2('0x35')][_0x2ce2('0x21')]);_0x137d06[_0x2ce2('0x20')]=qs[_0x2ce2('0x20')](_0x44f622[_0x2ce2('0x35')]['offset']);}_0x137d06[_0x2ce2('0x3d')]=qs[_0x2ce2('0x3e')](_0x44f622[_0x2ce2('0x35')][_0x2ce2('0x3e')]);_0x137d06[_0x2ce2('0x3f')]=qs[_0x2ce2('0x36')](_[_0x2ce2('0x40')](_0x44f622[_0x2ce2('0x35')],_0x1e1f17[_0x2ce2('0x36')]),_0x4b201e);if(_0x44f622[_0x2ce2('0x35')][_0x2ce2('0x41')]){_0x137d06[_0x2ce2('0x3f')]=_['merge'](_0x137d06[_0x2ce2('0x3f')],{'$or':_[_0x2ce2('0x2d')](_0x4b201e,function(_0x5e0ee9){if(_0x5e0ee9[_0x2ce2('0x31')]!==_0x2ce2('0x42')){var _0x3b5f23={};_0x3b5f23[_0x5e0ee9[_0x2ce2('0x34')]]={'$like':'%'+_0x44f622[_0x2ce2('0x35')]['filter']+'%'};return _0x3b5f23;}})});}_0x137d06=_[_0x2ce2('0x43')]({},_0x137d06,_0x44f622[_0x2ce2('0x44')]);var _0x3f71d2={'where':_0x137d06['where']};return db[_0x2ce2('0x2e')][_0x2ce2('0x1f')](_0x3f71d2)[_0x2ce2('0x28')](function(_0x1f11cc){_0x2aa881[_0x2ce2('0x1f')]=_0x1f11cc;if(_0x44f622[_0x2ce2('0x35')][_0x2ce2('0x45')]){_0x137d06['include']=[{'all':!![]}];}return db['DeskField'][_0x2ce2('0x46')](_0x137d06);})[_0x2ce2('0x28')](function(_0x3a7d2b){_0x2aa881[_0x2ce2('0x47')]=_0x3a7d2b;return _0x2aa881;})[_0x2ce2('0x28')](respondWithFilteredResult(_0x15a245,_0x137d06))[_0x2ce2('0x48')](handleError(_0x15a245,null));};exports['show']=function(_0x611fe8,_0x2231d6){var _0x215a13={'raw':!![],'where':{'id':_0x611fe8['params']['id']}},_0x63000e={};_0x63000e['model']=_[_0x2ce2('0x49')](db[_0x2ce2('0x2e')][_0x2ce2('0x2f')]);_0x63000e['query']=_[_0x2ce2('0x49')](_0x611fe8[_0x2ce2('0x35')]);_0x63000e[_0x2ce2('0x36')]=_[_0x2ce2('0x38')](_0x63000e[_0x2ce2('0x33')],_0x63000e['query']);_0x215a13['attributes']=_[_0x2ce2('0x38')](_0x63000e[_0x2ce2('0x33')],qs[_0x2ce2('0x39')](_0x611fe8[_0x2ce2('0x35')][_0x2ce2('0x39')]));_0x215a13[_0x2ce2('0x37')]=_0x215a13['attributes']['length']?_0x215a13[_0x2ce2('0x37')]:_0x63000e[_0x2ce2('0x33')];if(_0x611fe8[_0x2ce2('0x35')][_0x2ce2('0x45')]){_0x215a13[_0x2ce2('0x4a')]=[{'all':!![]}];}_0x215a13=_[_0x2ce2('0x43')]({},_0x215a13,_0x611fe8['options']);return db[_0x2ce2('0x2e')][_0x2ce2('0x4b')](_0x215a13)['then'](handleEntityNotFound(_0x2231d6,null))[_0x2ce2('0x28')](respondWithResult(_0x2231d6,null))[_0x2ce2('0x48')](handleError(_0x2231d6,null));};exports[_0x2ce2('0x4c')]=function(_0x59f06b,_0x3b8458){return db[_0x2ce2('0x2e')][_0x2ce2('0x4c')](_0x59f06b['body'],{})['then'](respondWithResult(_0x3b8458,0xc9))[_0x2ce2('0x48')](handleError(_0x3b8458,null));};exports[_0x2ce2('0x27')]=function(_0x3cfeff,_0x3b50cc){if(_0x3cfeff[_0x2ce2('0x4d')]['id']){delete _0x3cfeff['body']['id'];}return db[_0x2ce2('0x2e')][_0x2ce2('0x4b')]({'where':{'id':_0x3cfeff[_0x2ce2('0x4e')]['id']}})[_0x2ce2('0x28')](handleEntityNotFound(_0x3b50cc,null))[_0x2ce2('0x28')](saveUpdates(_0x3cfeff[_0x2ce2('0x4d')],null))['then'](respondWithResult(_0x3b50cc,null))['catch'](handleError(_0x3b50cc,null));};exports[_0x2ce2('0x29')]=function(_0x1e4463,_0x381516){return db[_0x2ce2('0x2e')][_0x2ce2('0x4b')]({'where':{'id':_0x1e4463[_0x2ce2('0x4e')]['id']}})[_0x2ce2('0x28')](handleEntityNotFound(_0x381516,null))['then'](removeEntity(_0x381516,null))['catch'](handleError(_0x381516,null));}; \ No newline at end of file +var _0xdb70=['params','keys','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','DeskField','rawAttributes','fieldName','key','map','query','filters','attributes','intersection','fields','length','model','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show'];(function(_0x501bd2,_0xf8377c){var _0x2d3b90=function(_0x1b523b){while(--_0x1b523b){_0x501bd2['push'](_0x501bd2['shift']());}};_0x2d3b90(++_0xf8377c);}(_0xdb70,0xa0));var _0x0db7=function(_0x2cb9ee,_0x4c757e){_0x2cb9ee=_0x2cb9ee-0x0;var _0x2e15ff=_0xdb70[_0x2cb9ee];return _0x2e15ff;};'use strict';var emlformat=require(_0x0db7('0x0'));var rimraf=require(_0x0db7('0x1'));var zipdir=require(_0x0db7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0db7('0x3'));var moment=require(_0x0db7('0x4'));var BPromise=require(_0x0db7('0x5'));var Mustache=require(_0x0db7('0x6'));var util=require(_0x0db7('0x7'));var path=require(_0x0db7('0x8'));var sox=require(_0x0db7('0x9'));var csv=require(_0x0db7('0xa'));var ejs=require(_0x0db7('0xb'));var fs=require('fs');var fs_extra=require(_0x0db7('0xc'));var _=require(_0x0db7('0xd'));var squel=require('squel');var crypto=require(_0x0db7('0xe'));var jsforce=require(_0x0db7('0xf'));var deskjs=require(_0x0db7('0x10'));var toCsv=require(_0x0db7('0xa'));var querystring=require(_0x0db7('0x11'));var Papa=require(_0x0db7('0x12'));var Redis=require('ioredis');var authService=require(_0x0db7('0x13'));var qs=require(_0x0db7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0db7('0x15'));var logger=require(_0x0db7('0x16'))(_0x0db7('0x17'));var utils=require(_0x0db7('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0db7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9aed4f,_0x2959a2){_0x2959a2=_0x2959a2||0xcc;return function(_0x33ec07){if(_0x33ec07){return _0x9aed4f[_0x0db7('0x1a')](_0x2959a2);}return _0x9aed4f[_0x0db7('0x1b')](_0x2959a2)['end']();};}function respondWithResult(_0x76c036,_0x195556){_0x195556=_0x195556||0xc8;return function(_0x45f594){if(_0x45f594){return _0x76c036[_0x0db7('0x1b')](_0x195556)[_0x0db7('0x1c')](_0x45f594);}};}function respondWithFilteredResult(_0x446448,_0x41b2b3){return function(_0x2edbe9){if(_0x2edbe9){var _0xb9127d=typeof _0x41b2b3[_0x0db7('0x1d')]==='undefined'&&typeof _0x41b2b3[_0x0db7('0x1e')]===_0x0db7('0x1f');var _0x18cf37=_0x2edbe9[_0x0db7('0x20')];var _0x31082b=_0xb9127d?0x0:_0x41b2b3[_0x0db7('0x1d')];var _0x52e95e=_0xb9127d?_0x2edbe9['count']:_0x41b2b3[_0x0db7('0x1d')]+_0x41b2b3[_0x0db7('0x1e')];var _0xe9a55d;if(_0x52e95e>=_0x18cf37){_0x52e95e=_0x18cf37;_0xe9a55d=0xc8;}else{_0xe9a55d=0xce;}_0x446448['status'](_0xe9a55d);return _0x446448[_0x0db7('0x21')](_0x0db7('0x22'),_0x31082b+'-'+_0x52e95e+'/'+_0x18cf37)[_0x0db7('0x1c')](_0x2edbe9);}return null;};}function patchUpdates(_0x211fc0){return function(_0x5a0b04){try{jsonpatch[_0x0db7('0x23')](_0x5a0b04,_0x211fc0,!![]);}catch(_0x48feb2){return BPromise[_0x0db7('0x24')](_0x48feb2);}return _0x5a0b04['save']();};}function saveUpdates(_0x59b7e4,_0x135429){return function(_0x156aaa){if(_0x156aaa){return _0x156aaa[_0x0db7('0x25')](_0x59b7e4)[_0x0db7('0x26')](function(_0x18fc1c){return _0x18fc1c;});}return null;};}function removeEntity(_0x368243,_0xc05009){return function(_0x274bf1){if(_0x274bf1){return _0x274bf1[_0x0db7('0x27')]()[_0x0db7('0x26')](function(){_0x368243[_0x0db7('0x1b')](0xcc)[_0x0db7('0x28')]();});}};}function handleEntityNotFound(_0x299c22,_0x55f339){return function(_0x521565){if(!_0x521565){_0x299c22['sendStatus'](0x194);}return _0x521565;};}function handleError(_0x594e6a,_0x568e60){_0x568e60=_0x568e60||0x1f4;return function(_0x5d2e46){logger[_0x0db7('0x29')](_0x5d2e46[_0x0db7('0x2a')]);if(_0x5d2e46[_0x0db7('0x2b')]){delete _0x5d2e46['name'];}_0x594e6a['status'](_0x568e60)[_0x0db7('0x2c')](_0x5d2e46);};}exports[_0x0db7('0x2d')]=function(_0x3f2169,_0x37ade4){var _0x29ed0a={},_0xfc7311={},_0x4ca418={'count':0x0,'rows':[]};var _0x2de626=_['map'](db[_0x0db7('0x2e')][_0x0db7('0x2f')],function(_0x1481aa){return{'name':_0x1481aa[_0x0db7('0x30')],'type':_0x1481aa['type'][_0x0db7('0x31')]};});_0xfc7311['model']=_[_0x0db7('0x32')](_0x2de626,_0x0db7('0x2b'));_0xfc7311[_0x0db7('0x33')]=_['keys'](_0x3f2169[_0x0db7('0x33')]);_0xfc7311[_0x0db7('0x34')]=_['intersection'](_0xfc7311['model'],_0xfc7311[_0x0db7('0x33')]);_0x29ed0a[_0x0db7('0x35')]=_[_0x0db7('0x36')](_0xfc7311['model'],qs['fields'](_0x3f2169[_0x0db7('0x33')][_0x0db7('0x37')]));_0x29ed0a[_0x0db7('0x35')]=_0x29ed0a['attributes'][_0x0db7('0x38')]?_0x29ed0a[_0x0db7('0x35')]:_0xfc7311[_0x0db7('0x39')];if(!_0x3f2169[_0x0db7('0x33')]['hasOwnProperty'](_0x0db7('0x3a'))){_0x29ed0a['limit']=qs[_0x0db7('0x1e')](_0x3f2169['query'][_0x0db7('0x1e')]);_0x29ed0a[_0x0db7('0x1d')]=qs[_0x0db7('0x1d')](_0x3f2169['query']['offset']);}_0x29ed0a[_0x0db7('0x3b')]=qs[_0x0db7('0x3c')](_0x3f2169[_0x0db7('0x33')][_0x0db7('0x3c')]);_0x29ed0a[_0x0db7('0x3d')]=qs[_0x0db7('0x34')](_['pick'](_0x3f2169[_0x0db7('0x33')],_0xfc7311[_0x0db7('0x34')]),_0x2de626);if(_0x3f2169['query'][_0x0db7('0x3e')]){_0x29ed0a['where']=_[_0x0db7('0x3f')](_0x29ed0a['where'],{'$or':_[_0x0db7('0x32')](_0x2de626,function(_0x27ed23){if(_0x27ed23['type']!==_0x0db7('0x40')){var _0x100ef9={};_0x100ef9[_0x27ed23['name']]={'$like':'%'+_0x3f2169[_0x0db7('0x33')]['filter']+'%'};return _0x100ef9;}})});}_0x29ed0a=_[_0x0db7('0x3f')]({},_0x29ed0a,_0x3f2169[_0x0db7('0x41')]);var _0x32c295={'where':_0x29ed0a[_0x0db7('0x3d')]};return db[_0x0db7('0x2e')]['count'](_0x32c295)[_0x0db7('0x26')](function(_0x2545bf){_0x4ca418[_0x0db7('0x20')]=_0x2545bf;if(_0x3f2169[_0x0db7('0x33')][_0x0db7('0x42')]){_0x29ed0a[_0x0db7('0x43')]=[{'all':!![]}];}return db[_0x0db7('0x2e')][_0x0db7('0x44')](_0x29ed0a);})[_0x0db7('0x26')](function(_0x4591fe){_0x4ca418[_0x0db7('0x45')]=_0x4591fe;return _0x4ca418;})[_0x0db7('0x26')](respondWithFilteredResult(_0x37ade4,_0x29ed0a))['catch'](handleError(_0x37ade4,null));};exports[_0x0db7('0x46')]=function(_0x4a9066,_0x23558a){var _0x150936={'raw':!![],'where':{'id':_0x4a9066[_0x0db7('0x47')]['id']}},_0x55732f={};_0x55732f['model']=_[_0x0db7('0x48')](db[_0x0db7('0x2e')][_0x0db7('0x2f')]);_0x55732f[_0x0db7('0x33')]=_[_0x0db7('0x48')](_0x4a9066[_0x0db7('0x33')]);_0x55732f[_0x0db7('0x34')]=_[_0x0db7('0x36')](_0x55732f[_0x0db7('0x39')],_0x55732f['query']);_0x150936['attributes']=_['intersection'](_0x55732f[_0x0db7('0x39')],qs[_0x0db7('0x37')](_0x4a9066[_0x0db7('0x33')][_0x0db7('0x37')]));_0x150936[_0x0db7('0x35')]=_0x150936[_0x0db7('0x35')]['length']?_0x150936[_0x0db7('0x35')]:_0x55732f[_0x0db7('0x39')];if(_0x4a9066['query'][_0x0db7('0x42')]){_0x150936[_0x0db7('0x43')]=[{'all':!![]}];}_0x150936=_[_0x0db7('0x3f')]({},_0x150936,_0x4a9066['options']);return db[_0x0db7('0x2e')][_0x0db7('0x49')](_0x150936)[_0x0db7('0x26')](handleEntityNotFound(_0x23558a,null))[_0x0db7('0x26')](respondWithResult(_0x23558a,null))[_0x0db7('0x4a')](handleError(_0x23558a,null));};exports['create']=function(_0x23d9b3,_0x2388fa){return db[_0x0db7('0x2e')][_0x0db7('0x4b')](_0x23d9b3['body'],{})['then'](respondWithResult(_0x2388fa,0xc9))[_0x0db7('0x4a')](handleError(_0x2388fa,null));};exports['update']=function(_0x534daa,_0x3281bd){if(_0x534daa[_0x0db7('0x4c')]['id']){delete _0x534daa['body']['id'];}return db[_0x0db7('0x2e')][_0x0db7('0x49')]({'where':{'id':_0x534daa[_0x0db7('0x47')]['id']}})[_0x0db7('0x26')](handleEntityNotFound(_0x3281bd,null))['then'](saveUpdates(_0x534daa['body'],null))['then'](respondWithResult(_0x3281bd,null))[_0x0db7('0x4a')](handleError(_0x3281bd,null));};exports[_0x0db7('0x27')]=function(_0x1ac5df,_0x10863b){return db['DeskField'][_0x0db7('0x49')]({'where':{'id':_0x1ac5df['params']['id']}})['then'](handleEntityNotFound(_0x10863b,null))['then'](removeEntity(_0x10863b,null))[_0x0db7('0x4a')](handleError(_0x10863b,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index a3e1692..6c0703e 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 _0x89ca=['idField','lodash','util','bluebird','request-promise','./intDeskField.attributes','exports','int_desk_fields','desk_unique_index'];(function(_0x56b886,_0x1ff474){var _0x164baf=function(_0x575d09){while(--_0x575d09){_0x56b886['push'](_0x56b886['shift']());}};_0x164baf(++_0x1ff474);}(_0x89ca,0x18d));var _0xa89c=function(_0x44918d,_0x2ea17d){_0x44918d=_0x44918d-0x0;var _0x1c32aa=_0x89ca[_0x44918d];return _0x1c32aa;};'use strict';var _=require(_0xa89c('0x0'));var util=require(_0xa89c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa89c('0x2'));var rp=require(_0xa89c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa89c('0x4'));module[_0xa89c('0x5')]=function(_0x5bb553,_0x2f14a0){return _0x5bb553['define']('DeskField',attributes,{'tableName':_0xa89c('0x6'),'paranoid':![],'indexes':[{'name':_0xa89c('0x7'),'fields':[_0xa89c('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc67f=['define','DeskField','int_desk_fields','desk_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports'];(function(_0x1e291a,_0x13a9da){var _0x448d8a=function(_0x329ac6){while(--_0x329ac6){_0x1e291a['push'](_0x1e291a['shift']());}};_0x448d8a(++_0x13a9da);}(_0xc67f,0xa5));var _0xfc67=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc67f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfc67('0x0'));var util=require(_0xfc67('0x1'));var logger=require(_0xfc67('0x2'))('api');var moment=require(_0xfc67('0x3'));var BPromise=require(_0xfc67('0x4'));var rp=require(_0xfc67('0x5'));var fs=require('fs');var path=require(_0xfc67('0x6'));var rimraf=require(_0xfc67('0x7'));var config=require(_0xfc67('0x8'));var attributes=require(_0xfc67('0x9'));module[_0xfc67('0xa')]=function(_0x2da513,_0x5b6c5b){return _0x2da513[_0xfc67('0xb')](_0xfc67('0xc'),attributes,{'tableName':_0xfc67('0xd'),'paranoid':![],'indexes':[{'name':_0xfc67('0xe'),'fields':['idField',_0xfc67('0xf')],'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 8459307..7b375a8 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 _0x7d6c=['request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x7d6c,0xe3));var _0xc7d6=function(_0x278d3c,_0x30f378){_0x278d3c=_0x278d3c-0x0;var _0x5a71de=_0x7d6c[_0x278d3c];return _0x5a71de;};'use strict';var _=require(_0xc7d6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc7d6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7d6('0x2'));var db=require(_0xc7d6('0x3'))['db'];var utils=require(_0xc7d6('0x4'));var logger=require('../../config/logger')(_0xc7d6('0x5'));var config=require(_0xc7d6('0x6'));var jayson=require(_0xc7d6('0x7'));var client=jayson[_0xc7d6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2876f7,_0x2daf37,_0x19f7f1){return new BPromise(function(_0x1e5cdf,_0x2398ff){return client[_0xc7d6('0x9')](_0x2876f7,_0x19f7f1)[_0xc7d6('0xa')](function(_0x3838ef){logger[_0xc7d6('0xb')](_0xc7d6('0xc'),_0x2daf37,'request\x20sent');logger[_0xc7d6('0xd')](_0xc7d6('0xe'),_0x2daf37,_0xc7d6('0xf'),JSON[_0xc7d6('0x10')](_0x3838ef));if(_0x3838ef[_0xc7d6('0x11')]){if(_0x3838ef[_0xc7d6('0x11')][_0xc7d6('0x12')]===0x1f4){logger[_0xc7d6('0x11')](_0xc7d6('0xc'),_0x2daf37,_0x3838ef[_0xc7d6('0x11')][_0xc7d6('0x13')]);return _0x2398ff(_0x3838ef['error'][_0xc7d6('0x13')]);}logger[_0xc7d6('0x11')]('DeskField,\x20%s,\x20%s',_0x2daf37,_0x3838ef['error'][_0xc7d6('0x13')]);return _0x1e5cdf(_0x3838ef[_0xc7d6('0x11')][_0xc7d6('0x13')]);}else{logger[_0xc7d6('0xb')](_0xc7d6('0xc'),_0x2daf37,'request\x20sent');_0x1e5cdf(_0x3838ef[_0xc7d6('0x14')][_0xc7d6('0x13')]);}})[_0xc7d6('0x15')](function(_0x4e6466){logger[_0xc7d6('0x11')](_0xc7d6('0xc'),_0x2daf37,_0x4e6466);_0x2398ff(_0x4e6466);});});} \ No newline at end of file +var _0x567e=['debug','stringify','error','code','message','info','result','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','DeskField,\x20%s,\x20%s'];(function(_0x268ce8,_0x17ad5e){var _0xa727de=function(_0x269840){while(--_0x269840){_0x268ce8['push'](_0x268ce8['shift']());}};_0xa727de(++_0x17ad5e);}(_0x567e,0x1a9));var _0xe567=function(_0x366a27,_0xc242fb){_0x366a27=_0x366a27-0x0;var _0x5e2804=_0x567e[_0x366a27];return _0x5e2804;};'use strict';var _=require(_0xe567('0x0'));var util=require('util');var moment=require(_0xe567('0x1'));var BPromise=require('bluebird');var rs=require(_0xe567('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe567('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe567('0x4'))(_0xe567('0x5'));var config=require(_0xe567('0x6'));var jayson=require(_0xe567('0x7'));var client=jayson[_0xe567('0x8')][_0xe567('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e3373,_0x578826,_0x366c15){return new BPromise(function(_0x56c018,_0x2a65ec){return client['request'](_0x1e3373,_0x366c15)[_0xe567('0xa')](function(_0x266da5){logger['info'](_0xe567('0xb'),_0x578826,'request\x20sent');logger[_0xe567('0xc')]('DeskField,\x20%s,\x20%s,\x20%s',_0x578826,'request\x20sent',JSON[_0xe567('0xd')](_0x266da5));if(_0x266da5[_0xe567('0xe')]){if(_0x266da5[_0xe567('0xe')][_0xe567('0xf')]===0x1f4){logger[_0xe567('0xe')](_0xe567('0xb'),_0x578826,_0x266da5['error'][_0xe567('0x10')]);return _0x2a65ec(_0x266da5['error']['message']);}logger[_0xe567('0xe')]('DeskField,\x20%s,\x20%s',_0x578826,_0x266da5[_0xe567('0xe')][_0xe567('0x10')]);return _0x56c018(_0x266da5[_0xe567('0xe')]['message']);}else{logger[_0xe567('0x11')](_0xe567('0xb'),_0x578826,'request\x20sent');_0x56c018(_0x266da5[_0xe567('0x12')][_0xe567('0x10')]);}})['catch'](function(_0x7cdd7f){logger[_0xe567('0xe')](_0xe567('0xb'),_0x578826,_0x7cdd7f);_0x2a65ec(_0x7cdd7f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 6e8aa19..a19d975 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 _0xaf99=['/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x971efc,_0x30c558){var _0x26ba63=function(_0x191515){while(--_0x191515){_0x971efc['push'](_0x971efc['shift']());}};_0x26ba63(++_0x30c558);}(_0xaf99,0x110));var _0x9af9=function(_0x572611,_0x3e4509){_0x572611=_0x572611-0x0;var _0x1d7a4f=_0xaf99[_0x572611];return _0x1d7a4f;};'use strict';var multer=require('multer');var util=require(_0x9af9('0x0'));var path=require(_0x9af9('0x1'));var timeout=require(_0x9af9('0x2'));var express=require(_0x9af9('0x3'));var router=express[_0x9af9('0x4')]();var fs_extra=require(_0x9af9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9af9('0x6'));var config=require('../../config/environment');var controller=require('./intDynamics365Account.controller');router[_0x9af9('0x7')]('/',auth[_0x9af9('0x8')](),controller[_0x9af9('0x9')]);router[_0x9af9('0x7')](_0x9af9('0xa'),auth[_0x9af9('0x8')](),controller[_0x9af9('0xb')]);router['get'](_0x9af9('0xc'),auth[_0x9af9('0x8')](),controller[_0x9af9('0xd')]);router[_0x9af9('0x7')](_0x9af9('0xe'),auth[_0x9af9('0x8')](),controller[_0x9af9('0xf')]);router[_0x9af9('0x10')]('/',auth['isAuthenticated'](),controller[_0x9af9('0x11')]);router['post'](_0x9af9('0xc'),auth[_0x9af9('0x8')](),controller[_0x9af9('0x12')]);router['put'](_0x9af9('0xa'),auth[_0x9af9('0x8')](),controller[_0x9af9('0x13')]);router[_0x9af9('0x14')]('/:id',auth[_0x9af9('0x8')](),controller[_0x9af9('0x15')]);module['exports']=router; \ No newline at end of file +var _0x72b6=['getConfigurations','post','addConfiguration','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','/:id/configurations'];(function(_0x4d0a1b,_0x180f34){var _0x4ba2c8=function(_0x42f53f){while(--_0x42f53f){_0x4d0a1b['push'](_0x4d0a1b['shift']());}};_0x4ba2c8(++_0x180f34);}(_0x72b6,0x1e7));var _0x672b=function(_0x16bd5c,_0x431646){_0x16bd5c=_0x16bd5c-0x0;var _0x498385=_0x72b6[_0x16bd5c];return _0x498385;};'use strict';var multer=require(_0x672b('0x0'));var util=require(_0x672b('0x1'));var path=require(_0x672b('0x2'));var timeout=require('connect-timeout');var express=require(_0x672b('0x3'));var router=express[_0x672b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x672b('0x5'));var interaction=require(_0x672b('0x6'));var config=require(_0x672b('0x7'));var controller=require(_0x672b('0x8'));router[_0x672b('0x9')]('/',auth[_0x672b('0xa')](),controller['index']);router[_0x672b('0x9')](_0x672b('0xb'),auth[_0x672b('0xa')](),controller['show']);router[_0x672b('0x9')](_0x672b('0xc'),auth[_0x672b('0xa')](),controller[_0x672b('0xd')]);router[_0x672b('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x672b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x672b('0xe')](_0x672b('0xc'),auth[_0x672b('0xa')](),controller[_0x672b('0xf')]);router[_0x672b('0x10')](_0x672b('0xb'),auth['isAuthenticated'](),controller[_0x672b('0x11')]);router['delete']('/:id',auth[_0x672b('0xa')](),controller[_0x672b('0x12')]);module[_0x672b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index c0f6a82..ab9f675 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 _0x8efc=['STRING'];(function(_0x5e370c,_0x5e0532){var _0x69c1b3=function(_0xb7084e){while(--_0xb7084e){_0x5e370c['push'](_0x5e370c['shift']());}};_0x69c1b3(++_0x5e0532);}(_0x8efc,0x8f));var _0xc8ef=function(_0x25df80,_0xa2aec5){_0x25df80=_0x25df80-0x0;var _0x17b6d0=_0x8efc[_0x25df80];return _0x17b6d0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc8ef('0x0')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc8ef('0x0')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xc8ef('0x0')]},'clientId':{'type':Sequelize[_0xc8ef('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xc8ef('0x0')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x3663=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1e1601,_0x46388f){var _0xc7909f=function(_0xd9558f){while(--_0xd9558f){_0x1e1601['push'](_0x1e1601['shift']());}};_0xc7909f(++_0x46388f);}(_0x3663,0x1cf));var _0x3366=function(_0x3d2ea4,_0xbbfa1d){_0x3d2ea4=_0x3d2ea4-0x0;var _0x2c4a59=_0x3663[_0x3d2ea4];return _0x2c4a59;};'use strict';var Sequelize=require(_0x3366('0x0'));module[_0x3366('0x1')]={'name':{'type':Sequelize[_0x3366('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x3366('0x2')]},'remoteUri':{'type':Sequelize[_0x3366('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x3366('0x2')]},'clientSecret':{'type':Sequelize[_0x3366('0x2')]},'serverUrl':{'type':Sequelize[_0x3366('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3366('0x2')]},'modernAuthentication':{'type':Sequelize[_0x3366('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 24f9632..e259882 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 _0x116c=[')/Attributes(','OptionSet','Options','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','LogicalName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','params','includeAll','include','create','body','find','findOne','Dynamics365Configuration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','data7','modernAuthentication','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','4.0','includes','@odata.type','substring','lastIndexOf','push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode'];(function(_0x2c8ab9,_0x496b5b){var _0x5c1675=function(_0xe6c13a){while(--_0xe6c13a){_0x2c8ab9['push'](_0x2c8ab9['shift']());}};_0x5c1675(++_0x496b5b);}(_0x116c,0xca));var _0xc116=function(_0x3c0776,_0x14ac3b){_0x3c0776=_0x3c0776-0x0;var _0x2ab1e0=_0x116c[_0x3c0776];return _0x2ab1e0;};'use strict';var rp=require(_0xc116('0x0'));var util=require(_0xc116('0x1'));var _=require(_0xc116('0x2'));var qs=require(_0xc116('0x3'));var logger=require(_0xc116('0x4'))('api');var db=require(_0xc116('0x5'))['db'];var integrations=require(_0xc116('0x6'));function respondWithResult(_0x4c0496,_0x6e40c2){_0x6e40c2=_0x6e40c2||0xc8;return function(_0x290b61){if(_0x290b61){return _0x4c0496[_0xc116('0x7')](_0x6e40c2)[_0xc116('0x8')](_0x290b61);}};}function respondWithFilteredResult(_0x5950a1,_0x45ab9f){return function(_0x157cbc){if(_0x157cbc){var _0x5ab26f=typeof _0x45ab9f[_0xc116('0x9')]===_0xc116('0xa')&&typeof _0x45ab9f[_0xc116('0xb')]===_0xc116('0xa');var _0x23ad9d=_0x157cbc[_0xc116('0xc')];var _0x551e2e=_0x5ab26f?0x0:_0x45ab9f[_0xc116('0x9')];var _0x2520ca=_0x5ab26f?_0x157cbc[_0xc116('0xc')]:_0x45ab9f[_0xc116('0x9')]+_0x45ab9f['limit'];var _0x3e3e39;if(_0x2520ca>=_0x23ad9d){_0x2520ca=_0x23ad9d;_0x3e3e39=0xc8;}else{_0x3e3e39=0xce;}_0x5950a1[_0xc116('0x7')](_0x3e3e39);return _0x5950a1[_0xc116('0xd')](_0xc116('0xe'),_0x551e2e+'-'+_0x2520ca+'/'+_0x23ad9d)[_0xc116('0x8')](_0x157cbc);}return null;};}function saveUpdates(_0x2fc414){return function(_0x5e6ed7){if(_0x5e6ed7){return _0x5e6ed7[_0xc116('0xf')](_0x2fc414)[_0xc116('0x10')](function(_0xd0e7fa){return _0xd0e7fa;});}return null;};}function removeEntity(_0x2fa664){return function(_0x5a8ba7){if(_0x5a8ba7){return _0x5a8ba7[_0xc116('0x11')]()[_0xc116('0x10')](function(){_0x2fa664[_0xc116('0x7')](0xcc)[_0xc116('0x12')]();});}};}function handleEntityNotFound(_0x4a4928){return function(_0x99396d){if(!_0x99396d){_0x4a4928['sendStatus'](0x194);}return _0x99396d;};}function handleError(_0x4fc377,_0x5cdca8){_0x5cdca8=_0x5cdca8||0x1f4;return function(_0x3ded70){logger['error'](_0x3ded70[_0xc116('0x13')]);if(_0x3ded70[_0xc116('0x14')]){delete _0x3ded70[_0xc116('0x14')];}_0x4fc377['status'](_0x5cdca8)[_0xc116('0x15')](_0x3ded70);};}exports[_0xc116('0x16')]=function(_0x5309c5,_0x3c384a){var _0x5092c1={},_0x18a241={},_0x1fe055={'count':0x0,'rows':[]};var _0x3a9d32=_[_0xc116('0x17')](db[_0xc116('0x18')][_0xc116('0x19')],function(_0x520c8a){return{'name':_0x520c8a['fieldName'],'type':_0x520c8a[_0xc116('0x1a')][_0xc116('0x1b')]};});_0x18a241[_0xc116('0x1c')]=_[_0xc116('0x17')](_0x3a9d32,'name');_0x18a241[_0xc116('0x1d')]=_[_0xc116('0x1e')](_0x5309c5[_0xc116('0x1d')]);_0x18a241[_0xc116('0x1f')]=_[_0xc116('0x20')](_0x18a241[_0xc116('0x1c')],_0x18a241[_0xc116('0x1d')]);_0x5092c1[_0xc116('0x21')]=_[_0xc116('0x20')](_0x18a241[_0xc116('0x1c')],qs[_0xc116('0x22')](_0x5309c5[_0xc116('0x1d')][_0xc116('0x22')]));_0x5092c1[_0xc116('0x21')]=_0x5092c1[_0xc116('0x21')][_0xc116('0x23')]?_0x5092c1[_0xc116('0x21')]:_0x18a241['model'];if(!_0x5309c5[_0xc116('0x1d')][_0xc116('0x24')](_0xc116('0x25'))){_0x5092c1[_0xc116('0xb')]=qs[_0xc116('0xb')](_0x5309c5[_0xc116('0x1d')][_0xc116('0xb')]);_0x5092c1[_0xc116('0x9')]=qs[_0xc116('0x9')](_0x5309c5[_0xc116('0x1d')][_0xc116('0x9')]);}_0x5092c1[_0xc116('0x26')]=qs['sort'](_0x5309c5[_0xc116('0x1d')][_0xc116('0x27')]);_0x5092c1[_0xc116('0x28')]=qs[_0xc116('0x1f')](_[_0xc116('0x29')](_0x5309c5[_0xc116('0x1d')],_0x18a241[_0xc116('0x1f')]),_0x3a9d32);if(_0x5309c5[_0xc116('0x1d')]['filter']){_0x5092c1[_0xc116('0x28')]=_[_0xc116('0x2a')](_0x5092c1[_0xc116('0x28')],{'$or':_['map'](_0x3a9d32,function(_0x40db2e){if(_0x40db2e[_0xc116('0x1a')]!==_0xc116('0x2b')){var _0x2cc4c0={};_0x2cc4c0[_0x40db2e[_0xc116('0x14')]]={'$like':'%'+_0x5309c5[_0xc116('0x1d')][_0xc116('0x2c')]+'%'};return _0x2cc4c0;}})});}_0x5092c1=_[_0xc116('0x2a')]({},_0x5092c1,_0x5309c5[_0xc116('0x2d')]);var _0x57f1d6={'where':_0x5092c1[_0xc116('0x28')]};return db[_0xc116('0x18')]['count'](_0x57f1d6)[_0xc116('0x10')](function(_0x2f7f2a){_0x1fe055['count']=_0x2f7f2a;if(_0x5309c5[_0xc116('0x1d')]['includeAll']){_0x5092c1['include']=[{'all':!![]}];}return db[_0xc116('0x18')][_0xc116('0x2e')](_0x5092c1);})[_0xc116('0x10')](function(_0x349b11){_0x1fe055[_0xc116('0x2f')]=_0x349b11;return _0x1fe055;})[_0xc116('0x10')](respondWithFilteredResult(_0x3c384a,_0x5092c1))[_0xc116('0x30')](handleError(_0x3c384a,null));};exports['show']=function(_0x3a45aa,_0x56b1f){var _0x104437={'raw':![],'where':{'id':_0x3a45aa[_0xc116('0x31')]['id']}},_0x1ed267={};_0x1ed267['model']=_['keys'](db[_0xc116('0x18')][_0xc116('0x19')]);_0x1ed267[_0xc116('0x1d')]=_[_0xc116('0x1e')](_0x3a45aa[_0xc116('0x1d')]);_0x1ed267[_0xc116('0x1f')]=_[_0xc116('0x20')](_0x1ed267[_0xc116('0x1c')],_0x1ed267[_0xc116('0x1d')]);_0x104437[_0xc116('0x21')]=_[_0xc116('0x20')](_0x1ed267[_0xc116('0x1c')],qs['fields'](_0x3a45aa[_0xc116('0x1d')][_0xc116('0x22')]));_0x104437[_0xc116('0x21')]=_0x104437[_0xc116('0x21')][_0xc116('0x23')]?_0x104437[_0xc116('0x21')]:_0x1ed267[_0xc116('0x1c')];if(_0x3a45aa[_0xc116('0x1d')][_0xc116('0x32')]){_0x104437[_0xc116('0x33')]=[{'all':!![]}];}_0x104437=_['merge']({},_0x104437,_0x3a45aa[_0xc116('0x2d')]);return db[_0xc116('0x18')]['find'](_0x104437)[_0xc116('0x10')](handleEntityNotFound(_0x56b1f,null))[_0xc116('0x10')](respondWithResult(_0x56b1f,null))[_0xc116('0x30')](handleError(_0x56b1f,null));};exports[_0xc116('0x34')]=function(_0x514c75,_0x1c0bcf){return db[_0xc116('0x18')][_0xc116('0x34')](_0x514c75[_0xc116('0x35')],{})[_0xc116('0x10')](respondWithResult(_0x1c0bcf,0xc9))[_0xc116('0x30')](handleError(_0x1c0bcf,null));};exports['update']=function(_0x2edb59,_0x1d6565){if(_0x2edb59[_0xc116('0x35')]['id']){delete _0x2edb59[_0xc116('0x35')]['id'];}return db['Dynamics365Account'][_0xc116('0x36')]({'where':{'id':_0x2edb59[_0xc116('0x31')]['id']}})[_0xc116('0x10')](handleEntityNotFound(_0x1d6565,null))[_0xc116('0x10')](saveUpdates(_0x2edb59[_0xc116('0x35')],null))[_0xc116('0x10')](respondWithResult(_0x1d6565,null))['catch'](handleError(_0x1d6565,null));};exports[_0xc116('0x11')]=function(_0x7f3fd5,_0x23e077){return db['Dynamics365Account'][_0xc116('0x36')]({'where':{'id':_0x7f3fd5[_0xc116('0x31')]['id']}})[_0xc116('0x10')](handleEntityNotFound(_0x23e077,null))[_0xc116('0x10')](removeEntity(_0x23e077,null))[_0xc116('0x30')](handleError(_0x23e077,null));};exports['getConfigurations']=function(_0x1ce820,_0x1b4d31){var _0x3ae0d6={};var _0x502706={};var _0x1b2275;var _0x4a0ecb;return db[_0xc116('0x18')][_0xc116('0x37')]({'where':{'id':_0x1ce820[_0xc116('0x31')]['id']}})[_0xc116('0x10')](handleEntityNotFound(_0x1b4d31,null))[_0xc116('0x10')](function(_0x1d85c5){if(_0x1d85c5){_0x1b2275=_0x1d85c5;_0x502706['model']=_[_0xc116('0x1e')](db[_0xc116('0x38')][_0xc116('0x19')]);_0x502706['query']=_[_0xc116('0x1e')](_0x1ce820['query']);_0x502706[_0xc116('0x1f')]=_[_0xc116('0x20')](_0x502706[_0xc116('0x1c')],_0x502706['query']);_0x3ae0d6[_0xc116('0x21')]=_[_0xc116('0x20')](_0x502706[_0xc116('0x1c')],qs[_0xc116('0x22')](_0x1ce820[_0xc116('0x1d')]['fields']));_0x3ae0d6[_0xc116('0x21')]=_0x3ae0d6[_0xc116('0x21')][_0xc116('0x23')]?_0x3ae0d6[_0xc116('0x21')]:_0x502706[_0xc116('0x1c')];_0x3ae0d6[_0xc116('0x26')]=qs[_0xc116('0x27')](_0x1ce820[_0xc116('0x1d')]['sort']);_0x3ae0d6[_0xc116('0x28')]=qs[_0xc116('0x1f')](_[_0xc116('0x29')](_0x1ce820[_0xc116('0x1d')],_0x502706[_0xc116('0x1f')]));if(_0x1ce820[_0xc116('0x1d')][_0xc116('0x2c')]){_0x3ae0d6['where']=_[_0xc116('0x2a')](_0x3ae0d6[_0xc116('0x28')],{'$or':_[_0xc116('0x17')](_0x3ae0d6[_0xc116('0x21')],function(_0x36fa77){var _0x43783f={};_0x43783f[_0x36fa77]={'$like':'%'+_0x1ce820[_0xc116('0x1d')][_0xc116('0x2c')]+'%'};return _0x43783f;})});}_0x3ae0d6=_['merge']({},_0x3ae0d6,_0x1ce820[_0xc116('0x2d')]);return _0x1b2275[_0xc116('0x39')](_0x3ae0d6);}})[_0xc116('0x10')](function(_0x5226da){if(_0x5226da){_0x4a0ecb=_0x5226da['length'];if(!_0x1ce820[_0xc116('0x1d')][_0xc116('0x24')](_0xc116('0x25'))){_0x3ae0d6[_0xc116('0xb')]=qs[_0xc116('0xb')](_0x1ce820[_0xc116('0x1d')][_0xc116('0xb')]);_0x3ae0d6[_0xc116('0x9')]=qs['offset'](_0x1ce820['query'][_0xc116('0x9')]);}return _0x1b2275['getConfigurations'](_0x3ae0d6);}})[_0xc116('0x10')](function(_0x183508){if(_0x183508){return _0x183508?{'count':_0x4a0ecb,'rows':_0x183508}:null;}})[_0xc116('0x10')](respondWithResult(_0x1b4d31,null))[_0xc116('0x30')](handleError(_0x1b4d31,null));};exports[_0xc116('0x3a')]=function(_0x376774,_0x482ad7){if(_0x376774['body']['id']){delete _0x376774[_0xc116('0x35')]['id'];}return db[_0xc116('0x18')]['findOne']({'where':{'id':_0x376774['params']['id']}})[_0xc116('0x10')](handleEntityNotFound(_0x482ad7,null))['then'](function(_0x5078df){if(_0x5078df){_0x376774[_0xc116('0x35')][_0xc116('0x3b')]=_0x5078df['id'];_0x376774[_0xc116('0x35')][_0xc116('0x3c')]=integrations[_0xc116('0x3d')](_0x376774[_0xc116('0x35')][_0xc116('0x3e')],_0x376774[_0xc116('0x35')][_0xc116('0x1a')]);_0x376774[_0xc116('0x35')]['Descriptions']=integrations[_0xc116('0x3f')](_0x376774[_0xc116('0x35')][_0xc116('0x3e')],_0x376774[_0xc116('0x35')][_0xc116('0x1a')]);return db[_0xc116('0x38')][_0xc116('0x34')](_0x376774[_0xc116('0x35')],{'include':[{'model':db[_0xc116('0x40')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0xc116('0x41')}]});}return null;})[_0xc116('0x10')](respondWithResult(_0x482ad7,null))['catch'](handleError(_0x482ad7,null));};function sanitizeRemoteUri(_0x2fb15c){var _0x5d75f7=_0x2fb15c[_0xc116('0x42')](-0x1);if(_0x5d75f7==='/')return _0x2fb15c['substring'](0x0,_0x2fb15c['lastIndexOf'](_0x5d75f7));return _0x2fb15c;}function getWebApiUrl(_0x1b6ab9){return util[_0xc116('0x43')](_0xc116('0x44'),_0x1b6ab9);}exports[_0xc116('0x45')]=function(_0x58259b,_0x3c4f12){var _0x3c9d5b=_0x58259b[_0xc116('0x1d')][_0xc116('0x46')];var _0x321d40=_0x3c9d5b===_0xc116('0x47')?_0xc116('0x48'):_0xc116('0x49');var _0xdb1546='';var _0x335e76='';var _0x51fb2c='';var _0x3729f7='';var _0x2e24d7='';var _0x46f72e='';var _0xa07abf='';var _0x424cbc='';var _0xd2a6b6=['title','description',_0xc116('0x4a'),_0xc116('0x4b'),_0xc116('0x4c'),_0xc116('0x4d'),_0xc116('0x4e'),_0xc116('0x4f'),_0xc116('0x50'),_0xc116('0x51')];var _0x3c4dee=[_0xc116('0x52'),_0xc116('0x53'),_0xc116('0x54'),_0xc116('0x55'),_0xc116('0x56'),'contactidyominame',_0xc116('0x57'),_0xc116('0x58'),_0xc116('0x59'),_0xc116('0x5a'),_0xc116('0x5b'),_0xc116('0x5c'),'createdon',_0xc116('0x5d'),_0xc116('0x5e'),_0xc116('0x5f'),_0xc116('0x60'),'customeridyominame','emailaddress',_0xc116('0x61'),_0xc116('0x62'),_0xc116('0x63'),_0xc116('0x64'),_0xc116('0x65'),_0xc116('0x66'),_0xc116('0x67'),_0xc116('0x68'),_0xc116('0x69'),'kbarticleidname',_0xc116('0x6a'),'masteridname',_0xc116('0x6b'),_0xc116('0x6c'),_0xc116('0x6d'),'modifiedbyyominame','modifiedon',_0xc116('0x6e'),'modifiedonbehalfbyyominame',_0xc116('0x6f'),_0xc116('0x70'),_0xc116('0x71'),'onholdtime',_0xc116('0x72'),'owneridname',_0xc116('0x73'),'owneridyominame',_0xc116('0x74'),_0xc116('0x75'),_0xc116('0x76'),_0xc116('0x77'),_0xc116('0x78'),'productserialnumber',_0xc116('0x79'),_0xc116('0x7a'),_0xc116('0x7b'),_0xc116('0x7c'),_0xc116('0x7d'),_0xc116('0x7e'),_0xc116('0x7f'),_0xc116('0x80'),_0xc116('0x81'),'statecode',_0xc116('0x82'),_0xc116('0x83'),'ticketnumber',_0xc116('0x84'),_0xc116('0x85'),'traversedpath',_0xc116('0x86'),_0xc116('0x87')];var _0x4c58b4=_0xd2a6b6[_0xc116('0x88')](_0x3c4dee);return db[_0xc116('0x18')]['findOne']({'where':{'id':_0x58259b['params']['id']},'attributes':['id',_0xc116('0x89'),_0xc116('0x8a'),_0xc116('0x8b'),_0xc116('0x8c'),_0xc116('0x8d'),_0xc116('0x8e'),'modernAuthentication'],'include':[{'model':db[_0xc116('0x8f')],'as':_0xc116('0x8f'),'attributes':['id',_0xc116('0x90'),_0xc116('0x91')]}]})[_0xc116('0x10')](handleEntityNotFound(_0x3c4f12,null))[_0xc116('0x10')](function(_0x2cdc7f){if(_0x2cdc7f){if(_0x2cdc7f[_0xc116('0x92')]){_0x2cdc7f['access_token']=_0x2cdc7f[_0xc116('0x8f')][_0xc116('0x90')];_0x424cbc=sanitizeRemoteUri(_0x2cdc7f[_0xc116('0x8f')][_0xc116('0x91')]);_0xa07abf=getWebApiUrl(_0x424cbc);return _0x2cdc7f;}_0x424cbc=sanitizeRemoteUri(_0x2cdc7f[_0xc116('0x8b')]);_0xa07abf=getWebApiUrl(_0x424cbc);var _0x51b9a8={'method':'POST','uri':_0xc116('0x93')+_0x2cdc7f['tenantId']+_0xc116('0x94'),'form':{'client_id':_0x2cdc7f['clientId'],'resource':_0x424cbc,'username':_0x2cdc7f['username'],'password':_0x2cdc7f[_0xc116('0x8a')],'grant_type':_0xc116('0x8a'),'client_secret':_0x2cdc7f['clientSecret']},'json':!![]};return rp(_0x51b9a8);}})[_0xc116('0x10')](function(_0x2b9864){_0x46f72e=_0x2b9864[_0xc116('0x95')];var _0x3937e6={'method':_0xc116('0x96'),'uri':encodeURI(_0xa07abf+_0xc116('0x97')+_0x321d40+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x46f72e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3937e6);})[_0xc116('0x10')](function(_0x2cb121){var _0xe2a946=_0x2cb121[_0xc116('0x98')][0x0];var _0x3b0986=_0xe2a946[_0xc116('0x99')];var _0x52d7cd={'method':'GET','uri':_0xa07abf+_0xc116('0x9a')+_0x3b0986+_0xc116('0x9b'),'headers':{'Authorization':_0xc116('0x9c')+_0x46f72e,'If-None-Match':null,'OData-Version':_0xc116('0x9d')},'json':!![]};return rp(_0x52d7cd);})['then'](function(_0xeb91d6){_0xdb1546=_0xeb91d6;_0x335e76=_0xdb1546['Attributes'];_0x335e76=_['remove'](_0x335e76,function(_0x17f54c){return!_0x4c58b4[_0xc116('0x9e')](_0x17f54c['LogicalName']);});var _0x54c0cd=[];var _0x20117f=[];_0x335e76['forEach'](function(_0x418589){if(_0x418589[_0xc116('0x9f')]){var _0x3e5e7e=_0x418589[_0xc116('0x9f')][_0xc116('0xa0')](_0x418589[_0xc116('0x9f')][_0xc116('0xa1')]('.')+0x1);if(_0x3e5e7e==='PicklistAttributeMetadata'){_0x54c0cd[_0xc116('0xa2')](getSelectList(_0xa07abf,_0x3c9d5b,_0x20117f,_0xdb1546[_0xc116('0x99')],_0x418589[_0xc116('0x99')],_0x46f72e));}}});return Promise[_0xc116('0xa3')](_0x54c0cd);})['then'](function(_0x583485){_0x51fb2c=_0x583485[0x0];var _0x1633e8=[];var _0x466d1c=[];_0x335e76[_0xc116('0xa4')](function(_0x42fda1){if(!_[_0xc116('0xa5')](_0x42fda1[_0xc116('0x9f')])){var _0x48565b=_0x42fda1[_0xc116('0x9f')]['substring'](_0x42fda1[_0xc116('0x9f')]['lastIndexOf']('.')+0x1);if(_0x48565b===_0xc116('0xa6')){_0x1633e8[_0xc116('0xa2')](getBooleanList(_0xa07abf,_0x3c9d5b,_0x466d1c,_0xdb1546[_0xc116('0x99')],_0x42fda1[_0xc116('0x99')],_0x46f72e));}}});return Promise[_0xc116('0xa3')](_0x1633e8);})['then'](function(_0x517d7c){_0x3729f7=_0x517d7c[0x0];var _0x58572f=[];var _0x166af7=[];_0x335e76[_0xc116('0xa4')](function(_0x5e717e){if(_0x5e717e[_0xc116('0x9f')]){var _0x301963=_0x5e717e[_0xc116('0x9f')][_0xc116('0xa0')](_0x5e717e[_0xc116('0x9f')]['lastIndexOf']('.')+0x1);if(_0x301963===_0xc116('0xa7')||_0x301963===_0xc116('0xa8')||_0x301963===_0xc116('0xa9')||_0x301963==='IntegerAttributeMetadata'||_0x301963===_0xc116('0xaa')||_0x301963===_0xc116('0xab')||_0x301963==='StatusAttributeMetadata'||_0x301963===_0xc116('0xac')||_0x301963===_0xc116('0xad')||_0x301963==='DecimalAttributeMetadata'){_0x58572f[_0xc116('0xa2')](getInputList(_0xa07abf,_0x3c9d5b,_0x301963,_0x166af7,_0xdb1546['MetadataId'],_0x5e717e[_0xc116('0x99')],_0x46f72e));}}});return Promise['all'](_0x58572f);})[_0xc116('0x10')](function(_0x2f855d){_0x2e24d7=_0x2f855d[0x0];var _0x35fcff=_0x51fb2c[_0xc116('0x88')](_0x3729f7)['concat'](_0x2e24d7);var _0x30269e={'count':_0x35fcff['length'],'rows':_0x35fcff};return _0x30269e;})[_0xc116('0x10')](respondWithResult(_0x3c4f12,null))[_0xc116('0x30')](function(_0x10c61d){var _0x1ba24a=_0x58259b[_0xc116('0x1d')][_0xc116('0xae')]?0x1f4:_0x10c61d['statusCode']||0x1f4;logger['error'](_0x10c61d[_0xc116('0x13')]);delete _0x10c61d[_0xc116('0x14')];if(_0x1ba24a===0x191){_0x1ba24a=0x190;}_0x3c4f12[_0xc116('0x7')](_0x1ba24a)[_0xc116('0x15')](_0x58259b['query'][_0xc116('0xae')]?{'message':'Wrong\x20credentials','statusCode':_0x10c61d[_0xc116('0xaf')]}:_0x10c61d);});};function getSelectList(_0xc927ad,_0x234ca9,_0x541383,_0x502699,_0x291e0b,_0x25ad8f){var _0x657177={'method':_0xc116('0x96'),'uri':_0xc927ad+'EntityDefinitions('+_0x502699+_0xc116('0xb0')+_0x291e0b+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xc116('0x9c')+_0x25ad8f,'If-None-Match':null,'OData-Version':_0xc116('0x9d')},'json':!![]};return rp(_0x657177)['then'](function(_0x18925d){var _0x402ba3=[];var _0x4410e5=_0x18925d[_0xc116('0xb1')][_0xc116('0xb2')];_0x4410e5[_0xc116('0xa4')](function(_0x349d4f){_0x402ba3[_0xc116('0xa2')]({'name':_0x349d4f[_0xc116('0xb3')][_0xc116('0xb4')]['Label'],'value':String(_0x349d4f['Value'])});});var _0x2a9be9={'id':_0x234ca9+'_'+_0x18925d['LogicalName'],'name':_0x18925d[_0xc116('0xb5')]['UserLocalizedLabel'][_0xc116('0xb3')],'custom':![],'options':_0x402ba3};_0x541383[_0xc116('0xa2')](_0x2a9be9);return _0x541383;});}function getBooleanList(_0x5f1ef8,_0x3a8526,_0x4c0825,_0x299c7c,_0x384e1e,_0x23d606){var _0x49c5b0={'method':_0xc116('0x96'),'uri':_0x5f1ef8+_0xc116('0x9a')+_0x299c7c+')/Attributes('+_0x384e1e+_0xc116('0xb6'),'headers':{'Authorization':_0xc116('0x9c')+_0x23d606,'If-None-Match':null,'OData-Version':_0xc116('0x9d')},'json':!![]};return rp(_0x49c5b0)[_0xc116('0x10')](function(_0x41f4bd){var _0x473846=[];_0x473846[_0xc116('0xa2')]({'name':_0x41f4bd['OptionSet'][_0xc116('0xb7')]['Label'][_0xc116('0xb4')][_0xc116('0xb3')],'value':_0xc116('0xb8')},{'name':_0x41f4bd['OptionSet'][_0xc116('0xb9')]['Label'][_0xc116('0xb4')][_0xc116('0xb3')],'value':'false'});var _0x3c3273={'id':_0x3a8526+'_'+_0x41f4bd[_0xc116('0xba')],'name':_0x41f4bd['DisplayName'][_0xc116('0xb4')][_0xc116('0xb3')],'custom':![],'options':_0x473846};_0x4c0825[_0xc116('0xa2')](_0x3c3273);return _0x4c0825;});}function getInputList(_0x2b5b0a,_0xe3187c,_0x38eeb7,_0x2a489c,_0x36f9a5,_0x1b4db4,_0x4f5d49){var _0x2a1e43={'method':_0xc116('0x96'),'uri':_0x2b5b0a+_0xc116('0x9a')+_0x36f9a5+_0xc116('0xb0')+_0x1b4db4+_0xc116('0xbb')+_0x38eeb7+_0xc116('0xbc'),'headers':{'Authorization':_0xc116('0x9c')+_0x4f5d49,'If-None-Match':null,'OData-Version':_0xc116('0x9d')},'json':!![]};return rp(_0x2a1e43)['then'](function(_0x113772){var _0x52b314={'id':_0xe3187c+'_'+_0x113772[_0xc116('0xba')],'name':_0x113772[_0xc116('0xb5')][_0xc116('0xb4')]?_0x113772['DisplayName'][_0xc116('0xb4')][_0xc116('0xb3')]:_0x113772[_0xc116('0xba')],'custom':![],'options':[]};_0x2a489c['push'](_0x52b314);return _0x2a489c;});} \ No newline at end of file +var _0x1753=['phonecall_activity_parties','accountidname','accountidyominame','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','findOne','password','tenantId','clientId','clientSecret','modernAuthentication','data5','access_token','CloudProvider','data7','remoteUri','POST','https://login.microsoftonline.com/','/oauth2/token','username','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','lastIndexOf','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','test','statusCode','Wrong\x20credentials','GET',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','UserLocalizedLabel','Label','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','Dynamics365Account','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','getConfigurations','Dynamics365Configuration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','%s/api/data/v9.0/','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode'];(function(_0x10c062,_0x210304){var _0x100e3c=function(_0x241d16){while(--_0x241d16){_0x10c062['push'](_0x10c062['shift']());}};_0x100e3c(++_0x210304);}(_0x1753,0x1e6));var _0x3175=function(_0x2b5205,_0x882c3f){_0x2b5205=_0x2b5205-0x0;var _0xefb0e0=_0x1753[_0x2b5205];return _0xefb0e0;};'use strict';var rp=require(_0x3175('0x0'));var util=require(_0x3175('0x1'));var _=require('lodash');var qs=require(_0x3175('0x2'));var logger=require(_0x3175('0x3'))(_0x3175('0x4'));var db=require(_0x3175('0x5'))['db'];var integrations=require(_0x3175('0x6'));function respondWithResult(_0xb48e16,_0x5d92dc){_0x5d92dc=_0x5d92dc||0xc8;return function(_0x261dff){if(_0x261dff){return _0xb48e16[_0x3175('0x7')](_0x5d92dc)[_0x3175('0x8')](_0x261dff);}};}function respondWithFilteredResult(_0x23b968,_0x159087){return function(_0x1deffc){if(_0x1deffc){var _0xa88284=typeof _0x159087[_0x3175('0x9')]===_0x3175('0xa')&&typeof _0x159087[_0x3175('0xb')]===_0x3175('0xa');var _0x32dbee=_0x1deffc['count'];var _0x109f8a=_0xa88284?0x0:_0x159087[_0x3175('0x9')];var _0x2bc0df=_0xa88284?_0x1deffc[_0x3175('0xc')]:_0x159087[_0x3175('0x9')]+_0x159087[_0x3175('0xb')];var _0x3e1b45;if(_0x2bc0df>=_0x32dbee){_0x2bc0df=_0x32dbee;_0x3e1b45=0xc8;}else{_0x3e1b45=0xce;}_0x23b968[_0x3175('0x7')](_0x3e1b45);return _0x23b968[_0x3175('0xd')](_0x3175('0xe'),_0x109f8a+'-'+_0x2bc0df+'/'+_0x32dbee)[_0x3175('0x8')](_0x1deffc);}return null;};}function saveUpdates(_0x1dc34d){return function(_0x29ae14){if(_0x29ae14){return _0x29ae14[_0x3175('0xf')](_0x1dc34d)[_0x3175('0x10')](function(_0x371c74){return _0x371c74;});}return null;};}function removeEntity(_0x31a1d5){return function(_0x476b27){if(_0x476b27){return _0x476b27[_0x3175('0x11')]()[_0x3175('0x10')](function(){_0x31a1d5[_0x3175('0x7')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ca35){return function(_0xfd7346){if(!_0xfd7346){_0x16ca35[_0x3175('0x12')](0x194);}return _0xfd7346;};}function handleError(_0x4923b7,_0x4b2525){_0x4b2525=_0x4b2525||0x1f4;return function(_0x520491){logger[_0x3175('0x13')](_0x520491[_0x3175('0x14')]);if(_0x520491[_0x3175('0x15')]){delete _0x520491[_0x3175('0x15')];}_0x4923b7[_0x3175('0x7')](_0x4b2525)[_0x3175('0x16')](_0x520491);};}exports[_0x3175('0x17')]=function(_0x313c07,_0x5e438c){var _0xb7add8={},_0x287e48={},_0x41ad9c={'count':0x0,'rows':[]};var _0x4c1775=_['map'](db[_0x3175('0x18')][_0x3175('0x19')],function(_0xf12687){return{'name':_0xf12687[_0x3175('0x1a')],'type':_0xf12687[_0x3175('0x1b')]['key']};});_0x287e48[_0x3175('0x1c')]=_[_0x3175('0x1d')](_0x4c1775,'name');_0x287e48[_0x3175('0x1e')]=_[_0x3175('0x1f')](_0x313c07[_0x3175('0x1e')]);_0x287e48[_0x3175('0x20')]=_[_0x3175('0x21')](_0x287e48[_0x3175('0x1c')],_0x287e48[_0x3175('0x1e')]);_0xb7add8['attributes']=_[_0x3175('0x21')](_0x287e48[_0x3175('0x1c')],qs['fields'](_0x313c07[_0x3175('0x1e')]['fields']));_0xb7add8[_0x3175('0x22')]=_0xb7add8['attributes'][_0x3175('0x23')]?_0xb7add8[_0x3175('0x22')]:_0x287e48[_0x3175('0x1c')];if(!_0x313c07[_0x3175('0x1e')][_0x3175('0x24')](_0x3175('0x25'))){_0xb7add8[_0x3175('0xb')]=qs[_0x3175('0xb')](_0x313c07[_0x3175('0x1e')][_0x3175('0xb')]);_0xb7add8[_0x3175('0x9')]=qs[_0x3175('0x9')](_0x313c07[_0x3175('0x1e')][_0x3175('0x9')]);}_0xb7add8[_0x3175('0x26')]=qs[_0x3175('0x27')](_0x313c07[_0x3175('0x1e')][_0x3175('0x27')]);_0xb7add8[_0x3175('0x28')]=qs['filters'](_[_0x3175('0x29')](_0x313c07['query'],_0x287e48[_0x3175('0x20')]),_0x4c1775);if(_0x313c07[_0x3175('0x1e')]['filter']){_0xb7add8[_0x3175('0x28')]=_[_0x3175('0x2a')](_0xb7add8[_0x3175('0x28')],{'$or':_[_0x3175('0x1d')](_0x4c1775,function(_0x5658b1){if(_0x5658b1[_0x3175('0x1b')]!==_0x3175('0x2b')){var _0x3643dc={};_0x3643dc[_0x5658b1[_0x3175('0x15')]]={'$like':'%'+_0x313c07[_0x3175('0x1e')][_0x3175('0x2c')]+'%'};return _0x3643dc;}})});}_0xb7add8=_['merge']({},_0xb7add8,_0x313c07[_0x3175('0x2d')]);var _0xb88c21={'where':_0xb7add8['where']};return db[_0x3175('0x18')][_0x3175('0xc')](_0xb88c21)[_0x3175('0x10')](function(_0x27c26e){_0x41ad9c['count']=_0x27c26e;if(_0x313c07['query'][_0x3175('0x2e')]){_0xb7add8[_0x3175('0x2f')]=[{'all':!![]}];}return db[_0x3175('0x18')][_0x3175('0x30')](_0xb7add8);})[_0x3175('0x10')](function(_0x1903f3){_0x41ad9c[_0x3175('0x31')]=_0x1903f3;return _0x41ad9c;})['then'](respondWithFilteredResult(_0x5e438c,_0xb7add8))[_0x3175('0x32')](handleError(_0x5e438c,null));};exports[_0x3175('0x33')]=function(_0x469f9b,_0x339014){var _0x4083b1={'raw':![],'where':{'id':_0x469f9b[_0x3175('0x34')]['id']}},_0x46b5d4={};_0x46b5d4[_0x3175('0x1c')]=_[_0x3175('0x1f')](db['Dynamics365Account'][_0x3175('0x19')]);_0x46b5d4[_0x3175('0x1e')]=_['keys'](_0x469f9b['query']);_0x46b5d4[_0x3175('0x20')]=_[_0x3175('0x21')](_0x46b5d4[_0x3175('0x1c')],_0x46b5d4[_0x3175('0x1e')]);_0x4083b1[_0x3175('0x22')]=_[_0x3175('0x21')](_0x46b5d4[_0x3175('0x1c')],qs['fields'](_0x469f9b[_0x3175('0x1e')][_0x3175('0x35')]));_0x4083b1[_0x3175('0x22')]=_0x4083b1['attributes'][_0x3175('0x23')]?_0x4083b1[_0x3175('0x22')]:_0x46b5d4[_0x3175('0x1c')];if(_0x469f9b[_0x3175('0x1e')][_0x3175('0x2e')]){_0x4083b1['include']=[{'all':!![]}];}_0x4083b1=_['merge']({},_0x4083b1,_0x469f9b[_0x3175('0x2d')]);return db[_0x3175('0x18')]['find'](_0x4083b1)[_0x3175('0x10')](handleEntityNotFound(_0x339014,null))[_0x3175('0x10')](respondWithResult(_0x339014,null))['catch'](handleError(_0x339014,null));};exports['create']=function(_0x4f27d2,_0x52d0eb){return db[_0x3175('0x18')][_0x3175('0x36')](_0x4f27d2[_0x3175('0x37')],{})['then'](respondWithResult(_0x52d0eb,0xc9))[_0x3175('0x32')](handleError(_0x52d0eb,null));};exports[_0x3175('0xf')]=function(_0x31cebe,_0x11f668){if(_0x31cebe[_0x3175('0x37')]['id']){delete _0x31cebe[_0x3175('0x37')]['id'];}return db[_0x3175('0x18')][_0x3175('0x38')]({'where':{'id':_0x31cebe[_0x3175('0x34')]['id']}})['then'](handleEntityNotFound(_0x11f668,null))['then'](saveUpdates(_0x31cebe[_0x3175('0x37')],null))['then'](respondWithResult(_0x11f668,null))['catch'](handleError(_0x11f668,null));};exports[_0x3175('0x11')]=function(_0x2d4214,_0x1fd177){return db[_0x3175('0x18')][_0x3175('0x38')]({'where':{'id':_0x2d4214['params']['id']}})[_0x3175('0x10')](handleEntityNotFound(_0x1fd177,null))[_0x3175('0x10')](removeEntity(_0x1fd177,null))[_0x3175('0x32')](handleError(_0x1fd177,null));};exports[_0x3175('0x39')]=function(_0x34d4a2,_0x26c384){var _0x278302={};var _0x14d6b1={};var _0x2b0e98;var _0x31c075;return db[_0x3175('0x18')]['findOne']({'where':{'id':_0x34d4a2[_0x3175('0x34')]['id']}})[_0x3175('0x10')](handleEntityNotFound(_0x26c384,null))[_0x3175('0x10')](function(_0x2e8979){if(_0x2e8979){_0x2b0e98=_0x2e8979;_0x14d6b1[_0x3175('0x1c')]=_['keys'](db[_0x3175('0x3a')][_0x3175('0x19')]);_0x14d6b1[_0x3175('0x1e')]=_[_0x3175('0x1f')](_0x34d4a2[_0x3175('0x1e')]);_0x14d6b1[_0x3175('0x20')]=_[_0x3175('0x21')](_0x14d6b1[_0x3175('0x1c')],_0x14d6b1[_0x3175('0x1e')]);_0x278302[_0x3175('0x22')]=_[_0x3175('0x21')](_0x14d6b1['model'],qs[_0x3175('0x35')](_0x34d4a2[_0x3175('0x1e')][_0x3175('0x35')]));_0x278302['attributes']=_0x278302['attributes'][_0x3175('0x23')]?_0x278302[_0x3175('0x22')]:_0x14d6b1[_0x3175('0x1c')];_0x278302[_0x3175('0x26')]=qs[_0x3175('0x27')](_0x34d4a2[_0x3175('0x1e')][_0x3175('0x27')]);_0x278302[_0x3175('0x28')]=qs[_0x3175('0x20')](_['pick'](_0x34d4a2['query'],_0x14d6b1['filters']));if(_0x34d4a2['query']['filter']){_0x278302[_0x3175('0x28')]=_[_0x3175('0x2a')](_0x278302['where'],{'$or':_['map'](_0x278302[_0x3175('0x22')],function(_0x4c0043){var _0x8d267c={};_0x8d267c[_0x4c0043]={'$like':'%'+_0x34d4a2[_0x3175('0x1e')][_0x3175('0x2c')]+'%'};return _0x8d267c;})});}_0x278302=_['merge']({},_0x278302,_0x34d4a2[_0x3175('0x2d')]);return _0x2b0e98[_0x3175('0x39')](_0x278302);}})[_0x3175('0x10')](function(_0x1afedd){if(_0x1afedd){_0x31c075=_0x1afedd[_0x3175('0x23')];if(!_0x34d4a2[_0x3175('0x1e')]['hasOwnProperty'](_0x3175('0x25'))){_0x278302[_0x3175('0xb')]=qs[_0x3175('0xb')](_0x34d4a2['query'][_0x3175('0xb')]);_0x278302[_0x3175('0x9')]=qs['offset'](_0x34d4a2[_0x3175('0x1e')][_0x3175('0x9')]);}return _0x2b0e98[_0x3175('0x39')](_0x278302);}})[_0x3175('0x10')](function(_0x389aab){if(_0x389aab){return _0x389aab?{'count':_0x31c075,'rows':_0x389aab}:null;}})[_0x3175('0x10')](respondWithResult(_0x26c384,null))[_0x3175('0x32')](handleError(_0x26c384,null));};exports[_0x3175('0x3b')]=function(_0x3c268d,_0x11ab8f){if(_0x3c268d[_0x3175('0x37')]['id']){delete _0x3c268d[_0x3175('0x37')]['id'];}return db[_0x3175('0x18')]['findOne']({'where':{'id':_0x3c268d[_0x3175('0x34')]['id']}})['then'](handleEntityNotFound(_0x11ab8f,null))[_0x3175('0x10')](function(_0x271015){if(_0x271015){_0x3c268d[_0x3175('0x37')][_0x3175('0x3c')]=_0x271015['id'];_0x3c268d[_0x3175('0x37')][_0x3175('0x3d')]=integrations['getSubjects'](_0x3c268d[_0x3175('0x37')][_0x3175('0x3e')],_0x3c268d[_0x3175('0x37')][_0x3175('0x1b')]);_0x3c268d[_0x3175('0x37')][_0x3175('0x3f')]=integrations[_0x3175('0x40')](_0x3c268d[_0x3175('0x37')][_0x3175('0x3e')],_0x3c268d['body'][_0x3175('0x1b')]);return db[_0x3175('0x3a')][_0x3175('0x36')](_0x3c268d[_0x3175('0x37')],{'include':[{'model':db[_0x3175('0x41')],'as':'Subjects'},{'model':db[_0x3175('0x41')],'as':'Descriptions'}]});}return null;})[_0x3175('0x10')](respondWithResult(_0x11ab8f,null))[_0x3175('0x32')](handleError(_0x11ab8f,null));};function sanitizeRemoteUri(_0x12bef8){var _0x2a05f2=_0x12bef8[_0x3175('0x42')](-0x1);if(_0x2a05f2==='/')return _0x12bef8[_0x3175('0x43')](0x0,_0x12bef8['lastIndexOf'](_0x2a05f2));return _0x12bef8;}function getWebApiUrl(_0xab6160){return util['format'](_0x3175('0x44'),_0xab6160);}exports['getFields']=function(_0x12cdc5,_0x3251f1){var _0x402075=_0x12cdc5[_0x3175('0x1e')][_0x3175('0x45')];var _0x288bb4=_0x402075===_0x3175('0x46')?_0x3175('0x47'):_0x3175('0x48');var _0x3ae79d='';var _0x5105cf='';var _0x1a979f='';var _0x435ac9='';var _0x4912f3='';var _0x393b19='';var _0x4feccb='';var _0x5c0f6b='';var _0x3af831=[_0x3175('0x49'),_0x3175('0x4a'),_0x3175('0x4b'),_0x3175('0x4c'),_0x3175('0x4d'),'subject',_0x3175('0x4e'),_0x3175('0x4f'),_0x3175('0x50'),_0x3175('0x51')];var _0x17f480=[_0x3175('0x52'),_0x3175('0x53'),'actualserviceunits','billedserviceunits','contactidname',_0x3175('0x54'),_0x3175('0x55'),_0x3175('0x56'),_0x3175('0x57'),'createdbyexternalpartyyominame','createdbyname',_0x3175('0x58'),_0x3175('0x59'),_0x3175('0x5a'),_0x3175('0x5b'),_0x3175('0x5c'),'customeridtype',_0x3175('0x5d'),_0x3175('0x5e'),'entitlementidname',_0x3175('0x5f'),_0x3175('0x60'),_0x3175('0x61'),_0x3175('0x62'),_0x3175('0x63'),_0x3175('0x64'),_0x3175('0x65'),_0x3175('0x66'),_0x3175('0x67'),_0x3175('0x68'),_0x3175('0x69'),_0x3175('0x6a'),'modifiedbyexternalpartyyominame',_0x3175('0x6b'),'modifiedbyyominame','modifiedon',_0x3175('0x6c'),_0x3175('0x6d'),_0x3175('0x6e'),_0x3175('0x6f'),_0x3175('0x70'),_0x3175('0x71'),_0x3175('0x72'),_0x3175('0x73'),_0x3175('0x74'),_0x3175('0x75'),'parentcaseidname',_0x3175('0x76'),_0x3175('0x77'),_0x3175('0x78'),'productidname',_0x3175('0x79'),_0x3175('0x7a'),'resolvebykpiidname',_0x3175('0x7b'),_0x3175('0x7c'),_0x3175('0x7d'),_0x3175('0x7e'),'slainvokedidname',_0x3175('0x7f'),'socialprofileidname','statecode','statuscode',_0x3175('0x80'),_0x3175('0x81'),_0x3175('0x82'),_0x3175('0x83'),_0x3175('0x84'),_0x3175('0x85'),'versionnumber'];var _0x1d0cfd=_0x3af831[_0x3175('0x86')](_0x17f480);return db[_0x3175('0x18')][_0x3175('0x87')]({'where':{'id':_0x12cdc5[_0x3175('0x34')]['id']},'attributes':['id','username',_0x3175('0x88'),'remoteUri',_0x3175('0x89'),_0x3175('0x8a'),_0x3175('0x8b'),_0x3175('0x8c')],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id',_0x3175('0x8d'),'data7']}]})['then'](handleEntityNotFound(_0x3251f1,null))[_0x3175('0x10')](function(_0x5ed619){if(_0x5ed619){if(_0x5ed619['modernAuthentication']){_0x5ed619[_0x3175('0x8e')]=_0x5ed619[_0x3175('0x8f')][_0x3175('0x8d')];_0x5c0f6b=sanitizeRemoteUri(_0x5ed619[_0x3175('0x8f')][_0x3175('0x90')]);_0x4feccb=getWebApiUrl(_0x5c0f6b);return _0x5ed619;}_0x5c0f6b=sanitizeRemoteUri(_0x5ed619[_0x3175('0x91')]);_0x4feccb=getWebApiUrl(_0x5c0f6b);var _0x441c18={'method':_0x3175('0x92'),'uri':_0x3175('0x93')+_0x5ed619[_0x3175('0x89')]+_0x3175('0x94'),'form':{'client_id':_0x5ed619[_0x3175('0x8a')],'resource':_0x5c0f6b,'username':_0x5ed619[_0x3175('0x95')],'password':_0x5ed619['password'],'grant_type':_0x3175('0x88'),'client_secret':_0x5ed619['clientSecret']},'json':!![]};return rp(_0x441c18);}})['then'](function(_0x1c1878){_0x393b19=_0x1c1878[_0x3175('0x8e')];var _0x405fda={'method':'GET','uri':encodeURI(_0x4feccb+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x288bb4+'\x27'),'headers':{'Authorization':_0x3175('0x96')+_0x393b19,'If-None-Match':null,'OData-Version':_0x3175('0x97')},'json':!![]};return rp(_0x405fda);})[_0x3175('0x10')](function(_0x34d5c7){var _0x22f08b=_0x34d5c7[_0x3175('0x98')][0x0];var _0x7a815a=_0x22f08b[_0x3175('0x99')];var _0x4f06df={'method':'GET','uri':_0x4feccb+_0x3175('0x9a')+_0x7a815a+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x3175('0x96')+_0x393b19,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4f06df);})[_0x3175('0x10')](function(_0x4633c8){_0x3ae79d=_0x4633c8;_0x5105cf=_0x3ae79d[_0x3175('0x9b')];_0x5105cf=_['remove'](_0x5105cf,function(_0x3251a4){return!_0x1d0cfd[_0x3175('0x9c')](_0x3251a4[_0x3175('0x9d')]);});var _0x2cf961=[];var _0x3dec33=[];_0x5105cf[_0x3175('0x9e')](function(_0x32516a){if(_0x32516a[_0x3175('0x9f')]){var _0x416af2=_0x32516a[_0x3175('0x9f')][_0x3175('0x43')](_0x32516a[_0x3175('0x9f')]['lastIndexOf']('.')+0x1);if(_0x416af2===_0x3175('0xa0')){_0x2cf961[_0x3175('0xa1')](getSelectList(_0x4feccb,_0x402075,_0x3dec33,_0x3ae79d[_0x3175('0x99')],_0x32516a[_0x3175('0x99')],_0x393b19));}}});return Promise[_0x3175('0xa2')](_0x2cf961);})['then'](function(_0x485486){_0x1a979f=_0x485486[0x0];var _0x328ec4=[];var _0x506f98=[];_0x5105cf['forEach'](function(_0x4181f5){if(!_[_0x3175('0xa3')](_0x4181f5[_0x3175('0x9f')])){var _0x194032=_0x4181f5[_0x3175('0x9f')][_0x3175('0x43')](_0x4181f5['@odata.type']['lastIndexOf']('.')+0x1);if(_0x194032==='BooleanAttributeMetadata'){_0x328ec4[_0x3175('0xa1')](getBooleanList(_0x4feccb,_0x402075,_0x506f98,_0x3ae79d[_0x3175('0x99')],_0x4181f5['MetadataId'],_0x393b19));}}});return Promise[_0x3175('0xa2')](_0x328ec4);})[_0x3175('0x10')](function(_0x4c249a){_0x435ac9=_0x4c249a[0x0];var _0x52f9f9=[];var _0x1696ae=[];_0x5105cf[_0x3175('0x9e')](function(_0x393dfc){if(_0x393dfc[_0x3175('0x9f')]){var _0x122c8e=_0x393dfc[_0x3175('0x9f')][_0x3175('0x43')](_0x393dfc[_0x3175('0x9f')][_0x3175('0xa4')]('.')+0x1);if(_0x122c8e==='StringAttributeMetadata'||_0x122c8e===_0x3175('0xa5')||_0x122c8e===_0x3175('0xa6')||_0x122c8e===_0x3175('0xa7')||_0x122c8e===_0x3175('0xa8')||_0x122c8e===_0x3175('0xa9')||_0x122c8e===_0x3175('0xaa')||_0x122c8e===_0x3175('0xab')||_0x122c8e==='StateAttributeMetadata'||_0x122c8e==='DecimalAttributeMetadata'){_0x52f9f9[_0x3175('0xa1')](getInputList(_0x4feccb,_0x402075,_0x122c8e,_0x1696ae,_0x3ae79d[_0x3175('0x99')],_0x393dfc[_0x3175('0x99')],_0x393b19));}}});return Promise[_0x3175('0xa2')](_0x52f9f9);})['then'](function(_0x2fcde3){_0x4912f3=_0x2fcde3[0x0];var _0x4ad06b=_0x1a979f['concat'](_0x435ac9)[_0x3175('0x86')](_0x4912f3);var _0x4b913f={'count':_0x4ad06b[_0x3175('0x23')],'rows':_0x4ad06b};return _0x4b913f;})['then'](respondWithResult(_0x3251f1,null))[_0x3175('0x32')](function(_0x4ca7b6){var _0x39a8bf=_0x12cdc5[_0x3175('0x1e')][_0x3175('0xac')]?0x1f4:_0x4ca7b6[_0x3175('0xad')]||0x1f4;logger[_0x3175('0x13')](_0x4ca7b6[_0x3175('0x14')]);delete _0x4ca7b6[_0x3175('0x15')];if(_0x39a8bf===0x191){_0x39a8bf=0x190;}_0x3251f1['status'](_0x39a8bf)[_0x3175('0x16')](_0x12cdc5[_0x3175('0x1e')]['test']?{'message':_0x3175('0xae'),'statusCode':_0x4ca7b6[_0x3175('0xad')]}:_0x4ca7b6);});};function getSelectList(_0x5bc9b7,_0x4f005f,_0x20cd47,_0x58c370,_0x5db017,_0x1fe0ad){var _0x4dd125={'method':_0x3175('0xaf'),'uri':_0x5bc9b7+'EntityDefinitions('+_0x58c370+_0x3175('0xb0')+_0x5db017+_0x3175('0xb1')+_0x3175('0xb2'),'headers':{'Authorization':_0x3175('0x96')+_0x1fe0ad,'If-None-Match':null,'OData-Version':_0x3175('0x97')},'json':!![]};return rp(_0x4dd125)['then'](function(_0x4fbd13){var _0x3cff97=[];var _0x1f7151=_0x4fbd13['OptionSet'][_0x3175('0xb3')];_0x1f7151[_0x3175('0x9e')](function(_0x4e6e9e){_0x3cff97[_0x3175('0xa1')]({'name':_0x4e6e9e['Label'][_0x3175('0xb4')][_0x3175('0xb5')],'value':String(_0x4e6e9e['Value'])});});var _0x4e7740={'id':_0x4f005f+'_'+_0x4fbd13['LogicalName'],'name':_0x4fbd13[_0x3175('0xb6')]['UserLocalizedLabel'][_0x3175('0xb5')],'custom':![],'options':_0x3cff97};_0x20cd47[_0x3175('0xa1')](_0x4e7740);return _0x20cd47;});}function getBooleanList(_0x37d3ab,_0x3e75cd,_0x4460dc,_0x3ed2b3,_0x5b81ea,_0x4b123c){var _0x25b463={'method':_0x3175('0xaf'),'uri':_0x37d3ab+'EntityDefinitions('+_0x3ed2b3+')/Attributes('+_0x5b81ea+_0x3175('0xb7'),'headers':{'Authorization':_0x3175('0x96')+_0x4b123c,'If-None-Match':null,'OData-Version':_0x3175('0x97')},'json':!![]};return rp(_0x25b463)[_0x3175('0x10')](function(_0x22d5cd){var _0x540f4f=[];_0x540f4f[_0x3175('0xa1')]({'name':_0x22d5cd[_0x3175('0xb8')][_0x3175('0xb9')][_0x3175('0xb5')]['UserLocalizedLabel'][_0x3175('0xb5')],'value':_0x3175('0xba')},{'name':_0x22d5cd[_0x3175('0xb8')][_0x3175('0xbb')][_0x3175('0xb5')][_0x3175('0xb4')]['Label'],'value':'false'});var _0xd57bf9={'id':_0x3e75cd+'_'+_0x22d5cd[_0x3175('0x9d')],'name':_0x22d5cd[_0x3175('0xb6')][_0x3175('0xb4')]['Label'],'custom':![],'options':_0x540f4f};_0x4460dc[_0x3175('0xa1')](_0xd57bf9);return _0x4460dc;});}function getInputList(_0x4e389e,_0x2a9415,_0x41c640,_0x3e8ea6,_0x17555c,_0x1a89e5,_0x285c5c){var _0x5ef14a={'method':_0x3175('0xaf'),'uri':_0x4e389e+_0x3175('0x9a')+_0x17555c+_0x3175('0xb0')+_0x1a89e5+')/Microsoft.Dynamics.CRM.'+_0x41c640+_0x3175('0xbc'),'headers':{'Authorization':_0x3175('0x96')+_0x285c5c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5ef14a)[_0x3175('0x10')](function(_0x1c1cf0){var _0x3f06c2={'id':_0x2a9415+'_'+_0x1c1cf0[_0x3175('0x9d')],'name':_0x1c1cf0[_0x3175('0xb6')][_0x3175('0xb4')]?_0x1c1cf0[_0x3175('0xb6')][_0x3175('0xb4')][_0x3175('0xb5')]:_0x1c1cf0[_0x3175('0x9d')],'custom':![],'options':[]};_0x3e8ea6['push'](_0x3f06c2);return _0x3e8ea6;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 98ee39f..66dd2a7 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 _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x280a59,_0x3c7db7){var _0x224553=function(_0x5d1614){while(--_0x5d1614){_0x280a59['push'](_0x280a59['shift']());}};_0x224553(++_0x3c7db7);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./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 +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x2aeb5b,_0x522bfb){var _0x59e4c2=function(_0x511eca){while(--_0x511eca){_0x2aeb5b['push'](_0x2aeb5b['shift']());}};_0x59e4c2(++_0x522bfb);}(_0xb7e7,0x121));var _0x7b7e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb7e7[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'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 c76c155..f39981e 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 _0x360a=['GetDynamics365Account','ShowDynamics365Account','find','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','Dynamics365Account','options','raw','where','attributes','include','map','model'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x360a,0x66));var _0xa360=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x360a[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0xa360('0x0'));var moment=require(_0xa360('0x1'));var BPromise=require('bluebird');var rs=require(_0xa360('0x2'));var fs=require('fs');var Redis=require(_0xa360('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa360('0x4'))(_0xa360('0x5'));var config=require(_0xa360('0x6'));var jayson=require(_0xa360('0x7'));var client=jayson['client'][_0xa360('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bb6e4,_0x369317,_0x3f5d1a){return new BPromise(function(_0x1b2024,_0x51f602){return client[_0xa360('0x9')](_0x4bb6e4,_0x3f5d1a)[_0xa360('0xa')](function(_0x1eefb4){logger['info'](_0xa360('0xb'),_0x369317,'request\x20sent');logger[_0xa360('0xc')](_0xa360('0xd'),_0x369317,_0xa360('0xe'),JSON[_0xa360('0xf')](_0x1eefb4));if(_0x1eefb4[_0xa360('0x10')]){if(_0x1eefb4['error'][_0xa360('0x11')]===0x1f4){logger[_0xa360('0x10')](_0xa360('0xb'),_0x369317,_0x1eefb4[_0xa360('0x10')][_0xa360('0x12')]);return _0x51f602(_0x1eefb4[_0xa360('0x10')][_0xa360('0x12')]);}logger[_0xa360('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x369317,_0x1eefb4[_0xa360('0x10')][_0xa360('0x12')]);return _0x1b2024(_0x1eefb4['error'][_0xa360('0x12')]);}else{logger[_0xa360('0x13')](_0xa360('0xb'),_0x369317,_0xa360('0xe'));_0x1b2024(_0x1eefb4[_0xa360('0x14')][_0xa360('0x12')]);}})[_0xa360('0x15')](function(_0x2b4218){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x369317,_0x2b4218);_0x51f602(_0x2b4218);});});}exports['GetDynamics365Account']=function(_0x1a594f){var _0x31b677=this;return new Promise(function(_0x2e9ece,_0x37516c){return db[_0xa360('0x16')]['findAll']({'raw':_0x1a594f[_0xa360('0x17')]?_0x1a594f[_0xa360('0x17')][_0xa360('0x18')]===undefined?!![]:![]:!![],'where':_0x1a594f[_0xa360('0x17')]?_0x1a594f[_0xa360('0x17')][_0xa360('0x19')]||null:null,'attributes':_0x1a594f[_0xa360('0x17')]?_0x1a594f[_0xa360('0x17')][_0xa360('0x1a')]||null:null,'limit':_0x1a594f[_0xa360('0x17')]?_0x1a594f[_0xa360('0x17')]['limit']||null:null,'include':_0x1a594f[_0xa360('0x17')]?_0x1a594f[_0xa360('0x17')][_0xa360('0x1b')]?_[_0xa360('0x1c')](_0x1a594f[_0xa360('0x17')][_0xa360('0x1b')],function(_0x58443f){return{'model':db[_0x58443f[_0xa360('0x1d')]],'as':_0x58443f['as'],'attributes':_0x58443f[_0xa360('0x1a')],'include':_0x58443f[_0xa360('0x1b')]?_[_0xa360('0x1c')](_0x58443f['include'],function(_0x46d7cd){return{'model':db[_0x46d7cd['model']],'as':_0x46d7cd['as'],'attributes':_0x46d7cd[_0xa360('0x1a')],'include':_0x46d7cd[_0xa360('0x1b')]?_[_0xa360('0x1c')](_0x46d7cd[_0xa360('0x1b')],function(_0x52c3c4){return{'model':db[_0x52c3c4[_0xa360('0x1d')]],'as':_0x52c3c4['as'],'attributes':_0x52c3c4[_0xa360('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa360('0xa')](function(_0x44c80e){logger[_0xa360('0x13')](_0xa360('0x1e'),_0x1a594f);logger[_0xa360('0xc')](_0xa360('0x1e'),_0x1a594f,JSON[_0xa360('0xf')](_0x44c80e));_0x2e9ece(_0x44c80e);})[_0xa360('0x15')](function(_0x5cf56f){logger['error'](_0xa360('0x1e'),_0x5cf56f[_0xa360('0x12')],_0x1a594f);_0x37516c(_0x31b677[_0xa360('0x10')](0x1f4,_0x5cf56f[_0xa360('0x12')]));});});};exports[_0xa360('0x1f')]=function(_0x490d4f){var _0x214794=this;return new Promise(function(_0x2e3ca7,_0x26c6fe){return db[_0xa360('0x16')][_0xa360('0x20')]({'raw':_0x490d4f[_0xa360('0x17')]?_0x490d4f[_0xa360('0x17')][_0xa360('0x18')]===undefined?!![]:![]:!![],'where':_0x490d4f[_0xa360('0x17')]?_0x490d4f['options']['where']||null:null,'attributes':_0x490d4f[_0xa360('0x17')]?_0x490d4f[_0xa360('0x17')]['attributes']||null:null,'include':_0x490d4f['options']?_0x490d4f[_0xa360('0x17')]['include']?_['map'](_0x490d4f['options'][_0xa360('0x1b')],function(_0x409d41){return{'model':db[_0x409d41['model']],'as':_0x409d41['as'],'attributes':_0x409d41[_0xa360('0x1a')],'include':_0x409d41['include']?_['map'](_0x409d41[_0xa360('0x1b')],function(_0x1b6743){return{'model':db[_0x1b6743[_0xa360('0x1d')]],'as':_0x1b6743['as'],'attributes':_0x1b6743['attributes'],'include':_0x1b6743[_0xa360('0x1b')]?_[_0xa360('0x1c')](_0x1b6743[_0xa360('0x1b')],function(_0x3267af){return{'model':db[_0x3267af[_0xa360('0x1d')]],'as':_0x3267af['as'],'attributes':_0x3267af['attributes']};}):[]};}):[]};}):[]:[]})[_0xa360('0xa')](function(_0x5ae44a){logger[_0xa360('0x13')](_0xa360('0x1f'),_0x490d4f);logger[_0xa360('0xc')](_0xa360('0x1f'),_0x490d4f,JSON[_0xa360('0xf')](_0x5ae44a));_0x2e3ca7(_0x5ae44a);})['catch'](function(_0x390e15){logger[_0xa360('0x10')](_0xa360('0x1f'),_0x390e15[_0xa360('0x12')],_0x490d4f);_0x26c6fe(_0x214794[_0xa360('0x10')](0x1f4,_0x390e15[_0xa360('0x12')]));});});}; \ No newline at end of file +var _0x916c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','catch','find','ShowDynamics365Account','util','moment','bluebird','randomstring','ioredis'];(function(_0x53068e,_0x2412eb){var _0x4d7d92=function(_0x469fd3){while(--_0x469fd3){_0x53068e['push'](_0x53068e['shift']());}};_0x4d7d92(++_0x2412eb);}(_0x916c,0x93));var _0xc916=function(_0x5be795,_0x1cb1b8){_0x5be795=_0x5be795-0x0;var _0x4e8a3b=_0x916c[_0x5be795];return _0x4e8a3b;};'use strict';var _=require('lodash');var util=require(_0xc916('0x0'));var moment=require(_0xc916('0x1'));var BPromise=require(_0xc916('0x2'));var rs=require(_0xc916('0x3'));var fs=require('fs');var Redis=require(_0xc916('0x4'));var db=require(_0xc916('0x5'))['db'];var utils=require(_0xc916('0x6'));var logger=require(_0xc916('0x7'))(_0xc916('0x8'));var config=require(_0xc916('0x9'));var jayson=require(_0xc916('0xa'));var client=jayson[_0xc916('0xb')][_0xc916('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d8871,_0x576f69,_0xafb59b){return new BPromise(function(_0x47f93f,_0x308753){return client['request'](_0x4d8871,_0xafb59b)[_0xc916('0xd')](function(_0x54f032){logger[_0xc916('0xe')](_0xc916('0xf'),_0x576f69,_0xc916('0x10'));logger[_0xc916('0x11')](_0xc916('0x12'),_0x576f69,'request\x20sent',JSON[_0xc916('0x13')](_0x54f032));if(_0x54f032['error']){if(_0x54f032[_0xc916('0x14')][_0xc916('0x15')]===0x1f4){logger[_0xc916('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x576f69,_0x54f032[_0xc916('0x14')][_0xc916('0x16')]);return _0x308753(_0x54f032[_0xc916('0x14')]['message']);}logger['error'](_0xc916('0xf'),_0x576f69,_0x54f032['error'][_0xc916('0x16')]);return _0x47f93f(_0x54f032['error'][_0xc916('0x16')]);}else{logger[_0xc916('0xe')](_0xc916('0xf'),_0x576f69,'request\x20sent');_0x47f93f(_0x54f032[_0xc916('0x17')][_0xc916('0x16')]);}})['catch'](function(_0x12adec){logger[_0xc916('0x14')](_0xc916('0xf'),_0x576f69,_0x12adec);_0x308753(_0x12adec);});});}exports[_0xc916('0x18')]=function(_0x58c4cb){var _0x32d8cc=this;return new Promise(function(_0xe4e75c,_0x1dd2a5){return db[_0xc916('0x19')][_0xc916('0x1a')]({'raw':_0x58c4cb[_0xc916('0x1b')]?_0x58c4cb[_0xc916('0x1b')][_0xc916('0x1c')]===undefined?!![]:![]:!![],'where':_0x58c4cb[_0xc916('0x1b')]?_0x58c4cb[_0xc916('0x1b')][_0xc916('0x1d')]||null:null,'attributes':_0x58c4cb[_0xc916('0x1b')]?_0x58c4cb[_0xc916('0x1b')][_0xc916('0x1e')]||null:null,'limit':_0x58c4cb[_0xc916('0x1b')]?_0x58c4cb['options'][_0xc916('0x1f')]||null:null,'include':_0x58c4cb[_0xc916('0x1b')]?_0x58c4cb[_0xc916('0x1b')][_0xc916('0x20')]?_[_0xc916('0x21')](_0x58c4cb[_0xc916('0x1b')][_0xc916('0x20')],function(_0x176657){return{'model':db[_0x176657[_0xc916('0x22')]],'as':_0x176657['as'],'attributes':_0x176657['attributes'],'include':_0x176657['include']?_[_0xc916('0x21')](_0x176657['include'],function(_0x3250d7){return{'model':db[_0x3250d7[_0xc916('0x22')]],'as':_0x3250d7['as'],'attributes':_0x3250d7[_0xc916('0x1e')],'include':_0x3250d7[_0xc916('0x20')]?_['map'](_0x3250d7[_0xc916('0x20')],function(_0x366ca1){return{'model':db[_0x366ca1['model']],'as':_0x366ca1['as'],'attributes':_0x366ca1[_0xc916('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc916('0xd')](function(_0x3dd568){logger['info'](_0xc916('0x18'),_0x58c4cb);logger['debug'](_0xc916('0x18'),_0x58c4cb,JSON[_0xc916('0x13')](_0x3dd568));_0xe4e75c(_0x3dd568);})[_0xc916('0x23')](function(_0x1c7ef4){logger[_0xc916('0x14')](_0xc916('0x18'),_0x1c7ef4[_0xc916('0x16')],_0x58c4cb);_0x1dd2a5(_0x32d8cc[_0xc916('0x14')](0x1f4,_0x1c7ef4[_0xc916('0x16')]));});});};exports['ShowDynamics365Account']=function(_0x46265b){var _0xfc7945=this;return new Promise(function(_0x20f0ba,_0x2ac958){return db['Dynamics365Account'][_0xc916('0x24')]({'raw':_0x46265b[_0xc916('0x1b')]?_0x46265b[_0xc916('0x1b')][_0xc916('0x1c')]===undefined?!![]:![]:!![],'where':_0x46265b['options']?_0x46265b[_0xc916('0x1b')][_0xc916('0x1d')]||null:null,'attributes':_0x46265b[_0xc916('0x1b')]?_0x46265b[_0xc916('0x1b')][_0xc916('0x1e')]||null:null,'include':_0x46265b[_0xc916('0x1b')]?_0x46265b['options'][_0xc916('0x20')]?_['map'](_0x46265b[_0xc916('0x1b')][_0xc916('0x20')],function(_0x1df494){return{'model':db[_0x1df494[_0xc916('0x22')]],'as':_0x1df494['as'],'attributes':_0x1df494['attributes'],'include':_0x1df494['include']?_['map'](_0x1df494['include'],function(_0x198784){return{'model':db[_0x198784['model']],'as':_0x198784['as'],'attributes':_0x198784[_0xc916('0x1e')],'include':_0x198784[_0xc916('0x20')]?_['map'](_0x198784['include'],function(_0xc11cfc){return{'model':db[_0xc11cfc[_0xc916('0x22')]],'as':_0xc11cfc['as'],'attributes':_0xc11cfc[_0xc916('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc916('0xd')](function(_0x308640){logger['info'](_0xc916('0x25'),_0x46265b);logger[_0xc916('0x11')](_0xc916('0x25'),_0x46265b,JSON[_0xc916('0x13')](_0x308640));_0x20f0ba(_0x308640);})[_0xc916('0x23')](function(_0x2dcdc4){logger[_0xc916('0x14')](_0xc916('0x25'),_0x2dcdc4[_0xc916('0x16')],_0x46265b);_0x2ac958(_0xfc7945['error'](0x1f4,_0x2dcdc4['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index d013f8c..5a9f2d1 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 _0x7177=['get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller'];(function(_0x1479cc,_0x47b7d2){var _0x47ff61=function(_0x634b3c){while(--_0x634b3c){_0x1479cc['push'](_0x1479cc['shift']());}};_0x47ff61(++_0x47b7d2);}(_0x7177,0x101));var _0x7717=function(_0x1efb4a,_0x46acc8){_0x1efb4a=_0x1efb4a-0x0;var _0x30c4b9=_0x7177[_0x1efb4a];return _0x30c4b9;};'use strict';var multer=require(_0x7717('0x0'));var util=require('util');var path=require(_0x7717('0x1'));var timeout=require('connect-timeout');var express=require(_0x7717('0x2'));var router=express[_0x7717('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7717('0x4'));var interaction=require(_0x7717('0x5'));var config=require('../../config/environment');var controller=require(_0x7717('0x6'));router[_0x7717('0x7')]('/',auth[_0x7717('0x8')](),controller[_0x7717('0x9')]);router[_0x7717('0x7')](_0x7717('0xa'),auth[_0x7717('0x8')](),controller[_0x7717('0xb')]);router[_0x7717('0x7')](_0x7717('0xc'),auth[_0x7717('0x8')](),controller['getFields']);router[_0x7717('0x7')](_0x7717('0xd'),auth['isAuthenticated'](),controller[_0x7717('0xe')]);router['get'](_0x7717('0xf'),auth[_0x7717('0x8')](),controller[_0x7717('0x10')]);router[_0x7717('0x11')]('/',auth[_0x7717('0x8')](),controller['create']);router[_0x7717('0x12')](_0x7717('0xa'),auth[_0x7717('0x8')](),controller[_0x7717('0x13')]);router[_0x7717('0x14')](_0x7717('0xa'),auth[_0x7717('0x8')](),controller['destroy']);module[_0x7717('0x15')]=router; \ No newline at end of file +var _0x4689=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x4689,0xf2));var _0x9468=function(_0x51dd35,_0x3400d6){_0x51dd35=_0x51dd35-0x0;var _0x101211=_0x4689[_0x51dd35];return _0x101211;};'use strict';var multer=require('multer');var util=require(_0x9468('0x0'));var path=require(_0x9468('0x1'));var timeout=require(_0x9468('0x2'));var express=require('express');var router=express[_0x9468('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9468('0x4'));var interaction=require(_0x9468('0x5'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x9468('0x6')]('/',auth[_0x9468('0x7')](),controller[_0x9468('0x8')]);router['get'](_0x9468('0x9'),auth[_0x9468('0x7')](),controller[_0x9468('0xa')]);router[_0x9468('0x6')](_0x9468('0xb'),auth[_0x9468('0x7')](),controller[_0x9468('0xc')]);router[_0x9468('0x6')](_0x9468('0xd'),auth[_0x9468('0x7')](),controller[_0x9468('0xe')]);router[_0x9468('0x6')](_0x9468('0xf'),auth[_0x9468('0x7')](),controller[_0x9468('0x10')]);router[_0x9468('0x11')]('/',auth[_0x9468('0x7')](),controller[_0x9468('0x12')]);router['put'](_0x9468('0x9'),auth[_0x9468('0x7')](),controller['update']);router[_0x9468('0x13')](_0x9468('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x9468('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index e79003b..d9b1632 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 _0x8fae=['phonecall','contact','nothing','BOOLEAN','sequelize','exports','STRING','ENUM'];(function(_0xcfcbaa,_0x369d95){var _0x157ed0=function(_0x3a0b62){while(--_0x3a0b62){_0xcfcbaa['push'](_0xcfcbaa['shift']());}};_0x157ed0(++_0x369d95);}(_0x8fae,0x7c));var _0xe8fa=function(_0x4b8f07,_0x1fd70e){_0x4b8f07=_0x4b8f07-0x0;var _0x133d9a=_0x8fae[_0x4b8f07];return _0x133d9a;};'use strict';var Sequelize=require(_0xe8fa('0x0'));module[_0xe8fa('0x1')]={'name':{'type':Sequelize[_0xe8fa('0x2')]},'description':{'type':Sequelize[_0xe8fa('0x2')]},'ticketType':{'type':Sequelize[_0xe8fa('0x3')]('incident',_0xe8fa('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xe8fa('0x3')](_0xe8fa('0x5'),_0xe8fa('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xe8fa('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xe8fa('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa209=['contact','sequelize','exports','STRING','ENUM','incident'];(function(_0x2d8bf4,_0x12b56c){var _0x34602d=function(_0xf5dd6d){while(--_0xf5dd6d){_0x2d8bf4['push'](_0x2d8bf4['shift']());}};_0x34602d(++_0x12b56c);}(_0xa209,0x1c9));var _0x9a20=function(_0x409e44,_0x423c2e){_0x409e44=_0x409e44-0x0;var _0x1e9e30=_0xa209[_0x409e44];return _0x1e9e30;};'use strict';var Sequelize=require(_0x9a20('0x0'));module[_0x9a20('0x1')]={'name':{'type':Sequelize[_0x9a20('0x2')]},'description':{'type':Sequelize[_0x9a20('0x2')]},'ticketType':{'type':Sequelize[_0x9a20('0x3')](_0x9a20('0x4'),'phonecall'),'defaultValue':_0x9a20('0x4')},'moduleCreate':{'type':Sequelize[_0x9a20('0x3')](_0x9a20('0x5'),'nothing'),'defaultValue':_0x9a20('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x9a20('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 6a82ac1..2452dd9 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 _0xef0c=['Content-Range','reject','save','update','then','destroy','error','name','send','index','Dynamics365Configuration','fieldName','type','map','keys','filters','intersection','query','attributes','model','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','length','include','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','pick','getDescriptions','hasOwnProperty','rimraf','fast-json-patch','request-promise','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/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x240029,_0xa5229c){var _0x561c75=function(_0x2db3a6){while(--_0x2db3a6){_0x240029['push'](_0x240029['shift']());}};_0x561c75(++_0xa5229c);}(_0xef0c,0x1bf));var _0xcef0=function(_0xd30ce,_0x1a5594){_0xd30ce=_0xd30ce-0x0;var _0x19ffde=_0xef0c[_0xd30ce];return _0x19ffde;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcef0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcef0('0x1'));var rp=require(_0xcef0('0x2'));var moment=require('moment');var BPromise=require(_0xcef0('0x3'));var Mustache=require('mustache');var util=require(_0xcef0('0x4'));var path=require(_0xcef0('0x5'));var sox=require(_0xcef0('0x6'));var csv=require(_0xcef0('0x7'));var ejs=require(_0xcef0('0x8'));var fs=require('fs');var fs_extra=require(_0xcef0('0x9'));var _=require(_0xcef0('0xa'));var squel=require(_0xcef0('0xb'));var crypto=require(_0xcef0('0xc'));var jsforce=require(_0xcef0('0xd'));var deskjs=require(_0xcef0('0xe'));var toCsv=require(_0xcef0('0x7'));var querystring=require(_0xcef0('0xf'));var Papa=require('papaparse');var Redis=require(_0xcef0('0x10'));var authService=require(_0xcef0('0x11'));var qs=require(_0xcef0('0x12'));var as=require(_0xcef0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcef0('0x14'))(_0xcef0('0x15'));var utils=require(_0xcef0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcef0('0x17'));var db=require(_0xcef0('0x18'))['db'];function respondWithStatusCode(_0x2082f6,_0xb024e3){_0xb024e3=_0xb024e3||0xcc;return function(_0x3a980d){if(_0x3a980d){return _0x2082f6[_0xcef0('0x19')](_0xb024e3);}return _0x2082f6[_0xcef0('0x1a')](_0xb024e3)[_0xcef0('0x1b')]();};}function respondWithResult(_0x508076,_0x506c49){_0x506c49=_0x506c49||0xc8;return function(_0x4852c1){if(_0x4852c1){return _0x508076['status'](_0x506c49)[_0xcef0('0x1c')](_0x4852c1);}};}function respondWithFilteredResult(_0x4a1719,_0x4ccee6){return function(_0x5ddde9){if(_0x5ddde9){var _0x5626b6=typeof _0x4ccee6['offset']===_0xcef0('0x1d')&&typeof _0x4ccee6[_0xcef0('0x1e')]===_0xcef0('0x1d');var _0x2b88f0=_0x5ddde9['count'];var _0xd2feb9=_0x5626b6?0x0:_0x4ccee6['offset'];var _0x1e0c3f=_0x5626b6?_0x5ddde9[_0xcef0('0x1f')]:_0x4ccee6[_0xcef0('0x20')]+_0x4ccee6[_0xcef0('0x1e')];var _0x3eb3bb;if(_0x1e0c3f>=_0x2b88f0){_0x1e0c3f=_0x2b88f0;_0x3eb3bb=0xc8;}else{_0x3eb3bb=0xce;}_0x4a1719[_0xcef0('0x1a')](_0x3eb3bb);return _0x4a1719['set'](_0xcef0('0x21'),_0xd2feb9+'-'+_0x1e0c3f+'/'+_0x2b88f0)['json'](_0x5ddde9);}return null;};}function patchUpdates(_0x28d503){return function(_0x17617a){try{jsonpatch['apply'](_0x17617a,_0x28d503,!![]);}catch(_0x390169){return BPromise[_0xcef0('0x22')](_0x390169);}return _0x17617a[_0xcef0('0x23')]();};}function saveUpdates(_0x4aeeef,_0x4dd662){return function(_0x5f3ef2){if(_0x5f3ef2){return _0x5f3ef2[_0xcef0('0x24')](_0x4aeeef)[_0xcef0('0x25')](function(_0x4358f8){return _0x4358f8;});}return null;};}function removeEntity(_0x4d4203,_0x2b4c2c){return function(_0x1d30dd){if(_0x1d30dd){return _0x1d30dd[_0xcef0('0x26')]()['then'](function(){_0x4d4203[_0xcef0('0x1a')](0xcc)[_0xcef0('0x1b')]();});}};}function handleEntityNotFound(_0x1d503b,_0x185138){return function(_0xe6ed07){if(!_0xe6ed07){_0x1d503b[_0xcef0('0x19')](0x194);}return _0xe6ed07;};}function handleError(_0x371bde,_0x38209e){_0x38209e=_0x38209e||0x1f4;return function(_0x4959f1){logger[_0xcef0('0x27')](_0x4959f1['stack']);if(_0x4959f1[_0xcef0('0x28')]){delete _0x4959f1['name'];}_0x371bde[_0xcef0('0x1a')](_0x38209e)[_0xcef0('0x29')](_0x4959f1);};}exports[_0xcef0('0x2a')]=function(_0x7befc2,_0x1e903d){var _0x2687fc={},_0x39c7a9={},_0x18f558={'count':0x0,'rows':[]};var _0x5037e9=_['map'](db[_0xcef0('0x2b')]['rawAttributes'],function(_0x4d15e0){return{'name':_0x4d15e0[_0xcef0('0x2c')],'type':_0x4d15e0[_0xcef0('0x2d')]['key']};});_0x39c7a9['model']=_[_0xcef0('0x2e')](_0x5037e9,'name');_0x39c7a9['query']=_[_0xcef0('0x2f')](_0x7befc2['query']);_0x39c7a9[_0xcef0('0x30')]=_[_0xcef0('0x31')](_0x39c7a9['model'],_0x39c7a9[_0xcef0('0x32')]);_0x2687fc[_0xcef0('0x33')]=_[_0xcef0('0x31')](_0x39c7a9[_0xcef0('0x34')],qs['fields'](_0x7befc2['query']['fields']));_0x2687fc['attributes']=_0x2687fc['attributes']['length']?_0x2687fc[_0xcef0('0x33')]:_0x39c7a9['model'];if(!_0x7befc2[_0xcef0('0x32')]['hasOwnProperty'](_0xcef0('0x35'))){_0x2687fc['limit']=qs[_0xcef0('0x1e')](_0x7befc2['query'][_0xcef0('0x1e')]);_0x2687fc[_0xcef0('0x20')]=qs[_0xcef0('0x20')](_0x7befc2[_0xcef0('0x32')][_0xcef0('0x20')]);}_0x2687fc[_0xcef0('0x36')]=qs[_0xcef0('0x37')](_0x7befc2[_0xcef0('0x32')]['sort']);_0x2687fc[_0xcef0('0x38')]=qs[_0xcef0('0x30')](_['pick'](_0x7befc2[_0xcef0('0x32')],_0x39c7a9[_0xcef0('0x30')]),_0x5037e9);if(_0x7befc2['query'][_0xcef0('0x39')]){_0x2687fc[_0xcef0('0x38')]=_['merge'](_0x2687fc[_0xcef0('0x38')],{'$or':_['map'](_0x5037e9,function(_0x5f0d04){if(_0x5f0d04[_0xcef0('0x2d')]!=='VIRTUAL'){var _0x4376fb={};_0x4376fb[_0x5f0d04[_0xcef0('0x28')]]={'$like':'%'+_0x7befc2[_0xcef0('0x32')][_0xcef0('0x39')]+'%'};return _0x4376fb;}})});}_0x2687fc=_[_0xcef0('0x3a')]({},_0x2687fc,_0x7befc2[_0xcef0('0x3b')]);var _0x344baa={'where':_0x2687fc[_0xcef0('0x38')]};return db['Dynamics365Configuration'][_0xcef0('0x1f')](_0x344baa)[_0xcef0('0x25')](function(_0x16916c){_0x18f558[_0xcef0('0x1f')]=_0x16916c;if(_0x7befc2['query'][_0xcef0('0x3c')]){_0x2687fc['include']=[{'all':!![]}];}return db[_0xcef0('0x2b')][_0xcef0('0x3d')](_0x2687fc);})['then'](function(_0x170ba9){_0x18f558[_0xcef0('0x3e')]=_0x170ba9;return _0x18f558;})[_0xcef0('0x25')](respondWithFilteredResult(_0x1e903d,_0x2687fc))[_0xcef0('0x3f')](handleError(_0x1e903d,null));};exports[_0xcef0('0x40')]=function(_0x11cdeb,_0x27ec9f){var _0x255731={'raw':![],'where':{'id':_0x11cdeb[_0xcef0('0x41')]['id']}},_0x521d01={};_0x521d01['model']=_[_0xcef0('0x2f')](db['Dynamics365Configuration'][_0xcef0('0x42')]);_0x521d01[_0xcef0('0x32')]=_['keys'](_0x11cdeb[_0xcef0('0x32')]);_0x521d01[_0xcef0('0x30')]=_[_0xcef0('0x31')](_0x521d01[_0xcef0('0x34')],_0x521d01['query']);_0x255731[_0xcef0('0x33')]=_[_0xcef0('0x31')](_0x521d01[_0xcef0('0x34')],qs[_0xcef0('0x43')](_0x11cdeb['query'][_0xcef0('0x43')]));_0x255731[_0xcef0('0x33')]=_0x255731[_0xcef0('0x33')][_0xcef0('0x44')]?_0x255731[_0xcef0('0x33')]:_0x521d01[_0xcef0('0x34')];if(_0x11cdeb[_0xcef0('0x32')]['includeAll']){_0x255731[_0xcef0('0x45')]=[{'all':!![]}];}_0x255731=_['merge']({},_0x255731,_0x11cdeb[_0xcef0('0x3b')]);return db[_0xcef0('0x2b')][_0xcef0('0x46')](_0x255731)['then'](handleEntityNotFound(_0x27ec9f,null))[_0xcef0('0x25')](respondWithResult(_0x27ec9f,null))[_0xcef0('0x3f')](handleError(_0x27ec9f,null));};exports[_0xcef0('0x47')]=function(_0x408ea5,_0x221c6e){return db[_0xcef0('0x2b')][_0xcef0('0x47')](_0x408ea5[_0xcef0('0x48')],{})[_0xcef0('0x25')](respondWithResult(_0x221c6e,0xc9))[_0xcef0('0x3f')](handleError(_0x221c6e,null));};exports[_0xcef0('0x24')]=function(_0x59603b,_0x15c783){if(_0x59603b[_0xcef0('0x48')]['id']){delete _0x59603b['body']['id'];}return db[_0xcef0('0x2b')]['find']({'where':{'id':_0x59603b['params']['id']}})[_0xcef0('0x25')](handleEntityNotFound(_0x15c783,null))['then'](saveUpdates(_0x59603b[_0xcef0('0x48')],null))['then'](respondWithResult(_0x15c783,null))[_0xcef0('0x3f')](handleError(_0x15c783,null));};exports[_0xcef0('0x26')]=function(_0x2d975f,_0x21f4df){return db[_0xcef0('0x2b')][_0xcef0('0x46')]({'where':{'id':_0x2d975f[_0xcef0('0x41')]['id']}})[_0xcef0('0x25')](handleEntityNotFound(_0x21f4df,null))[_0xcef0('0x25')](removeEntity(_0x21f4df,null))[_0xcef0('0x3f')](handleError(_0x21f4df,null));};exports[_0xcef0('0x49')]=function(_0x44a87f,_0x454821,_0x970c4f){var _0x40130e={};var _0x237ba1={};var _0x6a85e;var _0x31d8f0;return db['Dynamics365Configuration'][_0xcef0('0x4a')]({'where':{'id':_0x44a87f[_0xcef0('0x41')]['id']}})['then'](handleEntityNotFound(_0x454821,null))[_0xcef0('0x25')](function(_0x1fb9fb){if(_0x1fb9fb){_0x6a85e=_0x1fb9fb;_0x237ba1['model']=_['keys'](db[_0xcef0('0x4b')][_0xcef0('0x42')]);_0x237ba1['query']=_[_0xcef0('0x2f')](_0x44a87f[_0xcef0('0x32')]);_0x237ba1[_0xcef0('0x30')]=_[_0xcef0('0x31')](_0x237ba1[_0xcef0('0x34')],_0x237ba1[_0xcef0('0x32')]);_0x40130e[_0xcef0('0x33')]=_[_0xcef0('0x31')](_0x237ba1['model'],qs[_0xcef0('0x43')](_0x44a87f[_0xcef0('0x32')][_0xcef0('0x43')]));_0x40130e[_0xcef0('0x33')]=_0x40130e[_0xcef0('0x33')][_0xcef0('0x44')]?_0x40130e[_0xcef0('0x33')]:_0x237ba1[_0xcef0('0x34')];_0x40130e[_0xcef0('0x36')]=qs[_0xcef0('0x37')](_0x44a87f['query'][_0xcef0('0x37')]);_0x40130e[_0xcef0('0x38')]=qs['filters'](_['pick'](_0x44a87f[_0xcef0('0x32')],_0x237ba1[_0xcef0('0x30')]));if(_0x44a87f[_0xcef0('0x32')]['filter']){_0x40130e[_0xcef0('0x38')]=_[_0xcef0('0x3a')](_0x40130e[_0xcef0('0x38')],{'$or':_['map'](_0x40130e[_0xcef0('0x33')],function(_0x1e6594){var _0x6d3b75={};_0x6d3b75[_0x1e6594]={'$like':'%'+_0x44a87f[_0xcef0('0x32')]['filter']+'%'};return _0x6d3b75;})});}_0x40130e=_[_0xcef0('0x3a')]({},_0x40130e,_0x44a87f[_0xcef0('0x3b')]);return _0x6a85e[_0xcef0('0x49')](_0x40130e);}})[_0xcef0('0x25')](function(_0x1f1244){if(_0x1f1244){_0x31d8f0=_0x1f1244[_0xcef0('0x44')];if(!_0x44a87f[_0xcef0('0x32')]['hasOwnProperty']('nolimit')){_0x40130e[_0xcef0('0x1e')]=qs[_0xcef0('0x1e')](_0x44a87f['query']['limit']);_0x40130e[_0xcef0('0x20')]=qs['offset'](_0x44a87f['query'][_0xcef0('0x20')]);}return _0x6a85e[_0xcef0('0x49')](_0x40130e);}})[_0xcef0('0x25')](function(_0x43ca4b){if(_0x43ca4b){return _0x43ca4b?{'count':_0x31d8f0,'rows':_0x43ca4b}:null;}})[_0xcef0('0x25')](respondWithResult(_0x454821,null))[_0xcef0('0x3f')](handleError(_0x454821,null));};exports[_0xcef0('0x4c')]=function(_0x29bb75,_0x3838a5,_0xf7e3b2){var _0xbb6eac={};var _0xdff04={};var _0x228056;var _0x3a9f6b;return db[_0xcef0('0x2b')][_0xcef0('0x4a')]({'where':{'id':_0x29bb75['params']['id']}})[_0xcef0('0x25')](handleEntityNotFound(_0x3838a5,null))[_0xcef0('0x25')](function(_0x1d9bbe){if(_0x1d9bbe){_0x228056=_0x1d9bbe;_0xdff04['model']=_[_0xcef0('0x2f')](db['Dynamics365Field'][_0xcef0('0x42')]);_0xdff04[_0xcef0('0x32')]=_[_0xcef0('0x2f')](_0x29bb75['query']);_0xdff04['filters']=_[_0xcef0('0x31')](_0xdff04[_0xcef0('0x34')],_0xdff04[_0xcef0('0x32')]);_0xbb6eac['attributes']=_[_0xcef0('0x31')](_0xdff04['model'],qs['fields'](_0x29bb75['query']['fields']));_0xbb6eac[_0xcef0('0x33')]=_0xbb6eac['attributes'][_0xcef0('0x44')]?_0xbb6eac[_0xcef0('0x33')]:_0xdff04[_0xcef0('0x34')];_0xbb6eac[_0xcef0('0x36')]=qs['sort'](_0x29bb75[_0xcef0('0x32')][_0xcef0('0x37')]);_0xbb6eac[_0xcef0('0x38')]=qs[_0xcef0('0x30')](_[_0xcef0('0x4d')](_0x29bb75['query'],_0xdff04[_0xcef0('0x30')]));if(_0x29bb75[_0xcef0('0x32')][_0xcef0('0x39')]){_0xbb6eac[_0xcef0('0x38')]=_[_0xcef0('0x3a')](_0xbb6eac[_0xcef0('0x38')],{'$or':_[_0xcef0('0x2e')](_0xbb6eac[_0xcef0('0x33')],function(_0x4ffcd8){var _0x5d3309={};_0x5d3309[_0x4ffcd8]={'$like':'%'+_0x29bb75[_0xcef0('0x32')]['filter']+'%'};return _0x5d3309;})});}_0xbb6eac=_[_0xcef0('0x3a')]({},_0xbb6eac,_0x29bb75[_0xcef0('0x3b')]);return _0x228056[_0xcef0('0x4c')](_0xbb6eac);}})[_0xcef0('0x25')](function(_0x5a3eb2){if(_0x5a3eb2){_0x3a9f6b=_0x5a3eb2['length'];if(!_0x29bb75[_0xcef0('0x32')]['hasOwnProperty'](_0xcef0('0x35'))){_0xbb6eac[_0xcef0('0x1e')]=qs[_0xcef0('0x1e')](_0x29bb75[_0xcef0('0x32')][_0xcef0('0x1e')]);_0xbb6eac[_0xcef0('0x20')]=qs['offset'](_0x29bb75[_0xcef0('0x32')][_0xcef0('0x20')]);}return _0x228056[_0xcef0('0x4c')](_0xbb6eac);}})[_0xcef0('0x25')](function(_0x4ab023){if(_0x4ab023){return _0x4ab023?{'count':_0x3a9f6b,'rows':_0x4ab023}:null;}})[_0xcef0('0x25')](respondWithResult(_0x3838a5,null))['catch'](handleError(_0x3838a5,null));};exports[_0xcef0('0x4e')]=function(_0x1aaae7,_0x1c2a17,_0x1796c5){var _0x59e07c={};var _0x1507bf={};var _0x2c88f3;var _0x136ea7;return db[_0xcef0('0x2b')][_0xcef0('0x4a')]({'where':{'id':_0x1aaae7[_0xcef0('0x41')]['id']}})['then'](handleEntityNotFound(_0x1c2a17,null))[_0xcef0('0x25')](function(_0x4d6dfd){if(_0x4d6dfd){_0x2c88f3=_0x4d6dfd;_0x1507bf[_0xcef0('0x34')]=_[_0xcef0('0x2f')](db['Dynamics365Field'][_0xcef0('0x42')]);_0x1507bf[_0xcef0('0x32')]=_['keys'](_0x1aaae7[_0xcef0('0x32')]);_0x1507bf['filters']=_[_0xcef0('0x31')](_0x1507bf[_0xcef0('0x34')],_0x1507bf['query']);_0x59e07c[_0xcef0('0x33')]=_[_0xcef0('0x31')](_0x1507bf['model'],qs[_0xcef0('0x43')](_0x1aaae7[_0xcef0('0x32')]['fields']));_0x59e07c[_0xcef0('0x33')]=_0x59e07c[_0xcef0('0x33')][_0xcef0('0x44')]?_0x59e07c['attributes']:_0x1507bf['model'];_0x59e07c[_0xcef0('0x36')]=qs['sort'](_0x1aaae7[_0xcef0('0x32')][_0xcef0('0x37')]);_0x59e07c[_0xcef0('0x38')]=qs[_0xcef0('0x30')](_[_0xcef0('0x4d')](_0x1aaae7[_0xcef0('0x32')],_0x1507bf[_0xcef0('0x30')]));if(_0x1aaae7['query'][_0xcef0('0x39')]){_0x59e07c['where']=_[_0xcef0('0x3a')](_0x59e07c[_0xcef0('0x38')],{'$or':_[_0xcef0('0x2e')](_0x59e07c[_0xcef0('0x33')],function(_0x3d74cf){var _0x800300={};_0x800300[_0x3d74cf]={'$like':'%'+_0x1aaae7[_0xcef0('0x32')]['filter']+'%'};return _0x800300;})});}_0x59e07c=_[_0xcef0('0x3a')]({},_0x59e07c,_0x1aaae7['options']);return _0x2c88f3[_0xcef0('0x4e')](_0x59e07c);}})[_0xcef0('0x25')](function(_0x1eae5d){if(_0x1eae5d){_0x136ea7=_0x1eae5d[_0xcef0('0x44')];if(!_0x1aaae7['query'][_0xcef0('0x4f')](_0xcef0('0x35'))){_0x59e07c[_0xcef0('0x1e')]=qs['limit'](_0x1aaae7['query'][_0xcef0('0x1e')]);_0x59e07c[_0xcef0('0x20')]=qs[_0xcef0('0x20')](_0x1aaae7['query'][_0xcef0('0x20')]);}return _0x2c88f3[_0xcef0('0x4e')](_0x59e07c);}})[_0xcef0('0x25')](function(_0x13ca45){if(_0x13ca45){return _0x13ca45?{'count':_0x136ea7,'rows':_0x13ca45}:null;}})[_0xcef0('0x25')](respondWithResult(_0x1c2a17,null))[_0xcef0('0x3f')](handleError(_0x1c2a17,null));}; \ No newline at end of file +var _0x217c=['include','findAll','show','find','catch','body','params','getFields','findOne','Dynamics365Field','filter','getSubjects','getDescriptions','order','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll'];(function(_0x1c15df,_0x241539){var _0x41c9ce=function(_0x49fb1){while(--_0x49fb1){_0x1c15df['push'](_0x1c15df['shift']());}};_0x41c9ce(++_0x241539);}(_0x217c,0x1f4));var _0xc217=function(_0x389b5b,_0x1adb11){_0x389b5b=_0x389b5b-0x0;var _0xf93e95=_0x217c[_0x389b5b];return _0xf93e95;};'use strict';var emlformat=require(_0xc217('0x0'));var rimraf=require(_0xc217('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc217('0x2'));var rp=require(_0xc217('0x3'));var moment=require(_0xc217('0x4'));var BPromise=require(_0xc217('0x5'));var Mustache=require('mustache');var util=require(_0xc217('0x6'));var path=require(_0xc217('0x7'));var sox=require(_0xc217('0x8'));var csv=require(_0xc217('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc217('0xa'));var _=require(_0xc217('0xb'));var squel=require(_0xc217('0xc'));var crypto=require(_0xc217('0xd'));var jsforce=require(_0xc217('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc217('0xf'));var Papa=require(_0xc217('0x10'));var Redis=require(_0xc217('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc217('0x12'));var as=require(_0xc217('0x13'));var hardwareService=require(_0xc217('0x14'));var logger=require(_0xc217('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc217('0x16'));var licenseUtil=require(_0xc217('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17db0c,_0x29e65d){_0x29e65d=_0x29e65d||0xcc;return function(_0x4d1bf5){if(_0x4d1bf5){return _0x17db0c['sendStatus'](_0x29e65d);}return _0x17db0c['status'](_0x29e65d)['end']();};}function respondWithResult(_0x4f71ec,_0x1992ad){_0x1992ad=_0x1992ad||0xc8;return function(_0x5d68c0){if(_0x5d68c0){return _0x4f71ec[_0xc217('0x18')](_0x1992ad)[_0xc217('0x19')](_0x5d68c0);}};}function respondWithFilteredResult(_0x42ea56,_0x2a12b6){return function(_0x19a469){if(_0x19a469){var _0x123dc3=typeof _0x2a12b6[_0xc217('0x1a')]===_0xc217('0x1b')&&typeof _0x2a12b6[_0xc217('0x1c')]===_0xc217('0x1b');var _0x1193c3=_0x19a469[_0xc217('0x1d')];var _0x51341c=_0x123dc3?0x0:_0x2a12b6[_0xc217('0x1a')];var _0x5671c9=_0x123dc3?_0x19a469[_0xc217('0x1d')]:_0x2a12b6[_0xc217('0x1a')]+_0x2a12b6[_0xc217('0x1c')];var _0x337436;if(_0x5671c9>=_0x1193c3){_0x5671c9=_0x1193c3;_0x337436=0xc8;}else{_0x337436=0xce;}_0x42ea56['status'](_0x337436);return _0x42ea56[_0xc217('0x1e')](_0xc217('0x1f'),_0x51341c+'-'+_0x5671c9+'/'+_0x1193c3)['json'](_0x19a469);}return null;};}function patchUpdates(_0x2db9c2){return function(_0x11e911){try{jsonpatch[_0xc217('0x20')](_0x11e911,_0x2db9c2,!![]);}catch(_0x18d617){return BPromise[_0xc217('0x21')](_0x18d617);}return _0x11e911[_0xc217('0x22')]();};}function saveUpdates(_0x3b27f6,_0x3a37b2){return function(_0x957fb9){if(_0x957fb9){return _0x957fb9[_0xc217('0x23')](_0x3b27f6)['then'](function(_0x3b3b62){return _0x3b3b62;});}return null;};}function removeEntity(_0x5b3dc9,_0x40e840){return function(_0x2fbc35){if(_0x2fbc35){return _0x2fbc35[_0xc217('0x24')]()[_0xc217('0x25')](function(){_0x5b3dc9[_0xc217('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x462373,_0x2010d9){return function(_0x2e8cd9){if(!_0x2e8cd9){_0x462373[_0xc217('0x26')](0x194);}return _0x2e8cd9;};}function handleError(_0x4dba14,_0x5b05fb){_0x5b05fb=_0x5b05fb||0x1f4;return function(_0x55d02f){logger[_0xc217('0x27')](_0x55d02f[_0xc217('0x28')]);if(_0x55d02f[_0xc217('0x29')]){delete _0x55d02f[_0xc217('0x29')];}_0x4dba14[_0xc217('0x18')](_0x5b05fb)[_0xc217('0x2a')](_0x55d02f);};}exports[_0xc217('0x2b')]=function(_0x123207,_0x5c6834){var _0x3e31c4={},_0x1fac38={},_0x534dc4={'count':0x0,'rows':[]};var _0x4a2120=_[_0xc217('0x2c')](db[_0xc217('0x2d')][_0xc217('0x2e')],function(_0x2b86e7){return{'name':_0x2b86e7[_0xc217('0x2f')],'type':_0x2b86e7[_0xc217('0x30')][_0xc217('0x31')]};});_0x1fac38['model']=_[_0xc217('0x2c')](_0x4a2120,_0xc217('0x29'));_0x1fac38[_0xc217('0x32')]=_[_0xc217('0x33')](_0x123207[_0xc217('0x32')]);_0x1fac38[_0xc217('0x34')]=_['intersection'](_0x1fac38[_0xc217('0x35')],_0x1fac38[_0xc217('0x32')]);_0x3e31c4[_0xc217('0x36')]=_[_0xc217('0x37')](_0x1fac38['model'],qs[_0xc217('0x38')](_0x123207[_0xc217('0x32')][_0xc217('0x38')]));_0x3e31c4['attributes']=_0x3e31c4[_0xc217('0x36')][_0xc217('0x39')]?_0x3e31c4[_0xc217('0x36')]:_0x1fac38[_0xc217('0x35')];if(!_0x123207[_0xc217('0x32')][_0xc217('0x3a')](_0xc217('0x3b'))){_0x3e31c4['limit']=qs['limit'](_0x123207[_0xc217('0x32')][_0xc217('0x1c')]);_0x3e31c4[_0xc217('0x1a')]=qs['offset'](_0x123207['query'][_0xc217('0x1a')]);}_0x3e31c4['order']=qs[_0xc217('0x3c')](_0x123207['query']['sort']);_0x3e31c4[_0xc217('0x3d')]=qs[_0xc217('0x34')](_[_0xc217('0x3e')](_0x123207[_0xc217('0x32')],_0x1fac38[_0xc217('0x34')]),_0x4a2120);if(_0x123207[_0xc217('0x32')]['filter']){_0x3e31c4[_0xc217('0x3d')]=_[_0xc217('0x3f')](_0x3e31c4[_0xc217('0x3d')],{'$or':_[_0xc217('0x2c')](_0x4a2120,function(_0x3b2c79){if(_0x3b2c79['type']!==_0xc217('0x40')){var _0x460b4f={};_0x460b4f[_0x3b2c79['name']]={'$like':'%'+_0x123207[_0xc217('0x32')]['filter']+'%'};return _0x460b4f;}})});}_0x3e31c4=_[_0xc217('0x3f')]({},_0x3e31c4,_0x123207[_0xc217('0x41')]);var _0x2788ea={'where':_0x3e31c4[_0xc217('0x3d')]};return db[_0xc217('0x2d')][_0xc217('0x1d')](_0x2788ea)['then'](function(_0xda378){_0x534dc4[_0xc217('0x1d')]=_0xda378;if(_0x123207[_0xc217('0x32')][_0xc217('0x42')]){_0x3e31c4[_0xc217('0x43')]=[{'all':!![]}];}return db[_0xc217('0x2d')][_0xc217('0x44')](_0x3e31c4);})['then'](function(_0x4b2168){_0x534dc4['rows']=_0x4b2168;return _0x534dc4;})['then'](respondWithFilteredResult(_0x5c6834,_0x3e31c4))['catch'](handleError(_0x5c6834,null));};exports[_0xc217('0x45')]=function(_0x5d372c,_0x29b3cd){var _0x5a983f={'raw':![],'where':{'id':_0x5d372c['params']['id']}},_0x5e4fbb={};_0x5e4fbb[_0xc217('0x35')]=_[_0xc217('0x33')](db[_0xc217('0x2d')][_0xc217('0x2e')]);_0x5e4fbb[_0xc217('0x32')]=_[_0xc217('0x33')](_0x5d372c[_0xc217('0x32')]);_0x5e4fbb[_0xc217('0x34')]=_[_0xc217('0x37')](_0x5e4fbb[_0xc217('0x35')],_0x5e4fbb[_0xc217('0x32')]);_0x5a983f[_0xc217('0x36')]=_[_0xc217('0x37')](_0x5e4fbb[_0xc217('0x35')],qs[_0xc217('0x38')](_0x5d372c[_0xc217('0x32')][_0xc217('0x38')]));_0x5a983f[_0xc217('0x36')]=_0x5a983f['attributes']['length']?_0x5a983f[_0xc217('0x36')]:_0x5e4fbb['model'];if(_0x5d372c[_0xc217('0x32')][_0xc217('0x42')]){_0x5a983f['include']=[{'all':!![]}];}_0x5a983f=_[_0xc217('0x3f')]({},_0x5a983f,_0x5d372c[_0xc217('0x41')]);return db[_0xc217('0x2d')][_0xc217('0x46')](_0x5a983f)[_0xc217('0x25')](handleEntityNotFound(_0x29b3cd,null))[_0xc217('0x25')](respondWithResult(_0x29b3cd,null))[_0xc217('0x47')](handleError(_0x29b3cd,null));};exports['create']=function(_0x9b0807,_0x172fc8){return db[_0xc217('0x2d')]['create'](_0x9b0807[_0xc217('0x48')],{})[_0xc217('0x25')](respondWithResult(_0x172fc8,0xc9))['catch'](handleError(_0x172fc8,null));};exports[_0xc217('0x23')]=function(_0x2329cd,_0x303f85){if(_0x2329cd['body']['id']){delete _0x2329cd[_0xc217('0x48')]['id'];}return db[_0xc217('0x2d')][_0xc217('0x46')]({'where':{'id':_0x2329cd[_0xc217('0x49')]['id']}})[_0xc217('0x25')](handleEntityNotFound(_0x303f85,null))['then'](saveUpdates(_0x2329cd['body'],null))['then'](respondWithResult(_0x303f85,null))[_0xc217('0x47')](handleError(_0x303f85,null));};exports[_0xc217('0x24')]=function(_0x9ca6d6,_0x1190f0){return db[_0xc217('0x2d')]['find']({'where':{'id':_0x9ca6d6[_0xc217('0x49')]['id']}})[_0xc217('0x25')](handleEntityNotFound(_0x1190f0,null))[_0xc217('0x25')](removeEntity(_0x1190f0,null))['catch'](handleError(_0x1190f0,null));};exports[_0xc217('0x4a')]=function(_0x440bd4,_0x4d914c,_0x4ea78a){var _0x4d09f1={};var _0x13131e={};var _0x19b98a;var _0x55cd71;return db['Dynamics365Configuration'][_0xc217('0x4b')]({'where':{'id':_0x440bd4['params']['id']}})['then'](handleEntityNotFound(_0x4d914c,null))[_0xc217('0x25')](function(_0x5bfff0){if(_0x5bfff0){_0x19b98a=_0x5bfff0;_0x13131e[_0xc217('0x35')]=_[_0xc217('0x33')](db[_0xc217('0x4c')]['rawAttributes']);_0x13131e['query']=_[_0xc217('0x33')](_0x440bd4[_0xc217('0x32')]);_0x13131e[_0xc217('0x34')]=_['intersection'](_0x13131e['model'],_0x13131e['query']);_0x4d09f1['attributes']=_[_0xc217('0x37')](_0x13131e[_0xc217('0x35')],qs[_0xc217('0x38')](_0x440bd4[_0xc217('0x32')]['fields']));_0x4d09f1[_0xc217('0x36')]=_0x4d09f1[_0xc217('0x36')][_0xc217('0x39')]?_0x4d09f1[_0xc217('0x36')]:_0x13131e[_0xc217('0x35')];_0x4d09f1['order']=qs['sort'](_0x440bd4[_0xc217('0x32')][_0xc217('0x3c')]);_0x4d09f1['where']=qs[_0xc217('0x34')](_[_0xc217('0x3e')](_0x440bd4[_0xc217('0x32')],_0x13131e['filters']));if(_0x440bd4[_0xc217('0x32')][_0xc217('0x4d')]){_0x4d09f1['where']=_[_0xc217('0x3f')](_0x4d09f1['where'],{'$or':_[_0xc217('0x2c')](_0x4d09f1['attributes'],function(_0x4e90e7){var _0x25d8ba={};_0x25d8ba[_0x4e90e7]={'$like':'%'+_0x440bd4[_0xc217('0x32')][_0xc217('0x4d')]+'%'};return _0x25d8ba;})});}_0x4d09f1=_[_0xc217('0x3f')]({},_0x4d09f1,_0x440bd4[_0xc217('0x41')]);return _0x19b98a['getFields'](_0x4d09f1);}})[_0xc217('0x25')](function(_0x447020){if(_0x447020){_0x55cd71=_0x447020[_0xc217('0x39')];if(!_0x440bd4['query'][_0xc217('0x3a')]('nolimit')){_0x4d09f1[_0xc217('0x1c')]=qs[_0xc217('0x1c')](_0x440bd4[_0xc217('0x32')]['limit']);_0x4d09f1['offset']=qs['offset'](_0x440bd4[_0xc217('0x32')][_0xc217('0x1a')]);}return _0x19b98a['getFields'](_0x4d09f1);}})[_0xc217('0x25')](function(_0x2ddeac){if(_0x2ddeac){return _0x2ddeac?{'count':_0x55cd71,'rows':_0x2ddeac}:null;}})['then'](respondWithResult(_0x4d914c,null))[_0xc217('0x47')](handleError(_0x4d914c,null));};exports[_0xc217('0x4e')]=function(_0x324976,_0x5e2676,_0x3a0813){var _0x27a926={};var _0x207f3a={};var _0x405699;var _0x6ead7c;return db[_0xc217('0x2d')][_0xc217('0x4b')]({'where':{'id':_0x324976['params']['id']}})[_0xc217('0x25')](handleEntityNotFound(_0x5e2676,null))[_0xc217('0x25')](function(_0x46e0cb){if(_0x46e0cb){_0x405699=_0x46e0cb;_0x207f3a[_0xc217('0x35')]=_['keys'](db[_0xc217('0x4c')]['rawAttributes']);_0x207f3a['query']=_[_0xc217('0x33')](_0x324976[_0xc217('0x32')]);_0x207f3a[_0xc217('0x34')]=_[_0xc217('0x37')](_0x207f3a['model'],_0x207f3a['query']);_0x27a926['attributes']=_[_0xc217('0x37')](_0x207f3a[_0xc217('0x35')],qs[_0xc217('0x38')](_0x324976[_0xc217('0x32')][_0xc217('0x38')]));_0x27a926['attributes']=_0x27a926[_0xc217('0x36')][_0xc217('0x39')]?_0x27a926[_0xc217('0x36')]:_0x207f3a[_0xc217('0x35')];_0x27a926['order']=qs[_0xc217('0x3c')](_0x324976['query']['sort']);_0x27a926[_0xc217('0x3d')]=qs[_0xc217('0x34')](_[_0xc217('0x3e')](_0x324976[_0xc217('0x32')],_0x207f3a[_0xc217('0x34')]));if(_0x324976[_0xc217('0x32')][_0xc217('0x4d')]){_0x27a926['where']=_[_0xc217('0x3f')](_0x27a926['where'],{'$or':_['map'](_0x27a926[_0xc217('0x36')],function(_0x33d4f3){var _0x117f70={};_0x117f70[_0x33d4f3]={'$like':'%'+_0x324976[_0xc217('0x32')][_0xc217('0x4d')]+'%'};return _0x117f70;})});}_0x27a926=_[_0xc217('0x3f')]({},_0x27a926,_0x324976['options']);return _0x405699[_0xc217('0x4e')](_0x27a926);}})['then'](function(_0x1a57b2){if(_0x1a57b2){_0x6ead7c=_0x1a57b2[_0xc217('0x39')];if(!_0x324976['query'][_0xc217('0x3a')](_0xc217('0x3b'))){_0x27a926[_0xc217('0x1c')]=qs[_0xc217('0x1c')](_0x324976[_0xc217('0x32')]['limit']);_0x27a926[_0xc217('0x1a')]=qs['offset'](_0x324976[_0xc217('0x32')][_0xc217('0x1a')]);}return _0x405699[_0xc217('0x4e')](_0x27a926);}})[_0xc217('0x25')](function(_0x1fe600){if(_0x1fe600){return _0x1fe600?{'count':_0x6ead7c,'rows':_0x1fe600}:null;}})[_0xc217('0x25')](respondWithResult(_0x5e2676,null))[_0xc217('0x47')](handleError(_0x5e2676,null));};exports[_0xc217('0x4f')]=function(_0x3cb4ae,_0x183e85,_0x2e06b0){var _0x4f27d1={};var _0x44cc30={};var _0x56eda5;var _0x55b638;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x3cb4ae[_0xc217('0x49')]['id']}})[_0xc217('0x25')](handleEntityNotFound(_0x183e85,null))['then'](function(_0x4bdc34){if(_0x4bdc34){_0x56eda5=_0x4bdc34;_0x44cc30[_0xc217('0x35')]=_[_0xc217('0x33')](db[_0xc217('0x4c')]['rawAttributes']);_0x44cc30[_0xc217('0x32')]=_[_0xc217('0x33')](_0x3cb4ae['query']);_0x44cc30['filters']=_['intersection'](_0x44cc30[_0xc217('0x35')],_0x44cc30[_0xc217('0x32')]);_0x4f27d1[_0xc217('0x36')]=_[_0xc217('0x37')](_0x44cc30[_0xc217('0x35')],qs[_0xc217('0x38')](_0x3cb4ae[_0xc217('0x32')][_0xc217('0x38')]));_0x4f27d1['attributes']=_0x4f27d1[_0xc217('0x36')][_0xc217('0x39')]?_0x4f27d1[_0xc217('0x36')]:_0x44cc30['model'];_0x4f27d1[_0xc217('0x50')]=qs[_0xc217('0x3c')](_0x3cb4ae['query'][_0xc217('0x3c')]);_0x4f27d1[_0xc217('0x3d')]=qs[_0xc217('0x34')](_[_0xc217('0x3e')](_0x3cb4ae['query'],_0x44cc30[_0xc217('0x34')]));if(_0x3cb4ae['query'][_0xc217('0x4d')]){_0x4f27d1[_0xc217('0x3d')]=_['merge'](_0x4f27d1[_0xc217('0x3d')],{'$or':_[_0xc217('0x2c')](_0x4f27d1[_0xc217('0x36')],function(_0x11f9db){var _0x2f2ff6={};_0x2f2ff6[_0x11f9db]={'$like':'%'+_0x3cb4ae[_0xc217('0x32')][_0xc217('0x4d')]+'%'};return _0x2f2ff6;})});}_0x4f27d1=_[_0xc217('0x3f')]({},_0x4f27d1,_0x3cb4ae['options']);return _0x56eda5[_0xc217('0x4f')](_0x4f27d1);}})[_0xc217('0x25')](function(_0x7da751){if(_0x7da751){_0x55b638=_0x7da751[_0xc217('0x39')];if(!_0x3cb4ae[_0xc217('0x32')][_0xc217('0x3a')]('nolimit')){_0x4f27d1[_0xc217('0x1c')]=qs['limit'](_0x3cb4ae[_0xc217('0x32')][_0xc217('0x1c')]);_0x4f27d1[_0xc217('0x1a')]=qs[_0xc217('0x1a')](_0x3cb4ae[_0xc217('0x32')][_0xc217('0x1a')]);}return _0x56eda5[_0xc217('0x4f')](_0x4f27d1);}})[_0xc217('0x25')](function(_0x4ccab8){if(_0x4ccab8){return _0x4ccab8?{'count':_0x55b638,'rows':_0x4ccab8}:null;}})[_0xc217('0x25')](respondWithResult(_0x183e85,null))[_0xc217('0x47')](handleError(_0x183e85,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index fa8de5b..1e5921e 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 _0x55ca=['./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3b1e3f,_0xf8826b){var _0x3b1cd3=function(_0x26ad44){while(--_0x26ad44){_0x3b1e3f['push'](_0x3b1e3f['shift']());}};_0x3b1cd3(++_0xf8826b);}(_0x55ca,0x126));var _0xa55c=function(_0x26d9b3,_0x591f4e){_0x26d9b3=_0x26d9b3-0x0;var _0x15c226=_0x55ca[_0x26d9b3];return _0x15c226;};'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')]('Dynamics365Configuration',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0d=['./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x16e86c,_0x3be3e2){_0x16e86c=_0x16e86c-0x0;var _0x57d7db=_0x6f0d[_0x16e86c];return _0x57d7db;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'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 0a09f17..0cc16b4 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 _0x7d84=['code','message','info','result','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x7d84,0xcc));var _0x47d8=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0x7d84[_0x188a93];return _0x23b40d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x47d8('0x0'));var BPromise=require(_0x47d8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47d8('0x2'));var db=require(_0x47d8('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x47d8('0x4'));var config=require(_0x47d8('0x5'));var jayson=require(_0x47d8('0x6'));var client=jayson[_0x47d8('0x7')][_0x47d8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43ea3b,_0x228aea,_0x11f3c8){return new BPromise(function(_0x2dfb34,_0x187f76){return client['request'](_0x43ea3b,_0x11f3c8)[_0x47d8('0x9')](function(_0xd7778c){logger['info'](_0x47d8('0xa'),_0x228aea,_0x47d8('0xb'));logger[_0x47d8('0xc')](_0x47d8('0xd'),_0x228aea,'request\x20sent',JSON[_0x47d8('0xe')](_0xd7778c));if(_0xd7778c[_0x47d8('0xf')]){if(_0xd7778c['error'][_0x47d8('0x10')]===0x1f4){logger[_0x47d8('0xf')](_0x47d8('0xa'),_0x228aea,_0xd7778c['error'][_0x47d8('0x11')]);return _0x187f76(_0xd7778c[_0x47d8('0xf')]['message']);}logger[_0x47d8('0xf')](_0x47d8('0xa'),_0x228aea,_0xd7778c[_0x47d8('0xf')]['message']);return _0x2dfb34(_0xd7778c['error'][_0x47d8('0x11')]);}else{logger[_0x47d8('0x12')](_0x47d8('0xa'),_0x228aea,_0x47d8('0xb'));_0x2dfb34(_0xd7778c[_0x47d8('0x13')][_0x47d8('0x11')]);}})['catch'](function(_0x12a7b4){logger[_0x47d8('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x228aea,_0x12a7b4);_0x187f76(_0x12a7b4);});});} \ No newline at end of file +var _0x8af4=['error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0x8af4,0x74));var _0x48af=function(_0x57d3d9,_0x2d605b){_0x57d3d9=_0x57d3d9-0x0;var _0x46730c=_0x8af4[_0x57d3d9];return _0x46730c;};'use strict';var _=require(_0x48af('0x0'));var util=require(_0x48af('0x1'));var moment=require('moment');var BPromise=require(_0x48af('0x2'));var rs=require(_0x48af('0x3'));var fs=require('fs');var Redis=require(_0x48af('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x48af('0x5'));var logger=require(_0x48af('0x6'))('rpc');var config=require(_0x48af('0x7'));var jayson=require(_0x48af('0x8'));var client=jayson[_0x48af('0x9')][_0x48af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31e95e,_0x54bbae,_0x34a9a9){return new BPromise(function(_0x298bca,_0x166667){return client[_0x48af('0xb')](_0x31e95e,_0x34a9a9)[_0x48af('0xc')](function(_0x97cba1){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x54bbae,_0x48af('0xd'));logger[_0x48af('0xe')](_0x48af('0xf'),_0x54bbae,_0x48af('0xd'),JSON['stringify'](_0x97cba1));if(_0x97cba1[_0x48af('0x10')]){if(_0x97cba1[_0x48af('0x10')][_0x48af('0x11')]===0x1f4){logger[_0x48af('0x10')](_0x48af('0x12'),_0x54bbae,_0x97cba1[_0x48af('0x10')][_0x48af('0x13')]);return _0x166667(_0x97cba1['error']['message']);}logger[_0x48af('0x10')](_0x48af('0x12'),_0x54bbae,_0x97cba1[_0x48af('0x10')][_0x48af('0x13')]);return _0x298bca(_0x97cba1[_0x48af('0x10')][_0x48af('0x13')]);}else{logger['info'](_0x48af('0x12'),_0x54bbae,_0x48af('0xd'));_0x298bca(_0x97cba1[_0x48af('0x14')][_0x48af('0x13')]);}})[_0x48af('0x15')](function(_0x6f206){logger[_0x48af('0x10')](_0x48af('0x12'),_0x54bbae,_0x6f206);_0x166667(_0x6f206);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index a6784b9..4c82de5 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 _0x0cd0=['./intDynamics365Field.controller','get','index','/:id','show','post','isAuthenticated','create','put','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x12a4ae,_0x168ebe){var _0x25cb2f=function(_0x22294f){while(--_0x22294f){_0x12a4ae['push'](_0x12a4ae['shift']());}};_0x25cb2f(++_0x168ebe);}(_0x0cd0,0x172));var _0x00cd=function(_0x46df41,_0x56c918){_0x46df41=_0x46df41-0x0;var _0x8b629b=_0x0cd0[_0x46df41];return _0x8b629b;};'use strict';var multer=require(_0x00cd('0x0'));var util=require(_0x00cd('0x1'));var path=require(_0x00cd('0x2'));var timeout=require('connect-timeout');var express=require(_0x00cd('0x3'));var router=express[_0x00cd('0x4')]();var fs_extra=require(_0x00cd('0x5'));var auth=require(_0x00cd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x00cd('0x7'));var controller=require(_0x00cd('0x8'));router[_0x00cd('0x9')]('/',auth['isAuthenticated'](),controller[_0x00cd('0xa')]);router['get'](_0x00cd('0xb'),auth['isAuthenticated'](),controller[_0x00cd('0xc')]);router[_0x00cd('0xd')]('/',auth[_0x00cd('0xe')](),controller[_0x00cd('0xf')]);router[_0x00cd('0x10')](_0x00cd('0xb'),auth[_0x00cd('0xe')](),controller['update']);router[_0x00cd('0x11')](_0x00cd('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x89bb=['isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0x89bb,0x10e));var _0xb89b=function(_0x4e4249,_0x12d4ac){_0x4e4249=_0x4e4249-0x0;var _0x35263a=_0x89bb[_0x4e4249];return _0x35263a;};'use strict';var multer=require(_0xb89b('0x0'));var util=require(_0xb89b('0x1'));var path=require(_0xb89b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb89b('0x3'));var router=express['Router']();var fs_extra=require(_0xb89b('0x4'));var auth=require(_0xb89b('0x5'));var interaction=require(_0xb89b('0x6'));var config=require(_0xb89b('0x7'));var controller=require(_0xb89b('0x8'));router[_0xb89b('0x9')]('/',auth[_0xb89b('0xa')](),controller[_0xb89b('0xb')]);router[_0xb89b('0x9')](_0xb89b('0xc'),auth[_0xb89b('0xa')](),controller[_0xb89b('0xd')]);router['post']('/',auth[_0xb89b('0xa')](),controller[_0xb89b('0xe')]);router[_0xb89b('0xf')](_0xb89b('0xc'),auth[_0xb89b('0xa')](),controller[_0xb89b('0x10')]);router[_0xb89b('0x11')](_0xb89b('0xc'),auth['isAuthenticated'](),controller[_0xb89b('0x12')]);module[_0xb89b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 89e6dd3..70fc846 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 _0x88db=['exports','ENUM','string','keyValue','picklist','STRING','variable','BOOLEAN','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x88db,0x86));var _0xb88d=function(_0x118b2c,_0x5d21f1){_0x118b2c=_0x118b2c-0x0;var _0x35e6fa=_0x88db[_0x118b2c];return _0x35e6fa;};'use strict';var Sequelize=require(_0xb88d('0x0'));module[_0xb88d('0x1')]={'type':{'type':Sequelize[_0xb88d('0x2')](_0xb88d('0x3'),'variable','customVariable',_0xb88d('0x4'),_0xb88d('0x5')),'defaultValue':_0xb88d('0x3')},'content':{'type':Sequelize[_0xb88d('0x6')]},'key':{'type':Sequelize[_0xb88d('0x6')]},'keyType':{'type':Sequelize[_0xb88d('0x2')](_0xb88d('0x3'),_0xb88d('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xb88d('0x6')]},'idField':{'type':Sequelize[_0xb88d('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb88d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb88d('0x6')]}}; \ No newline at end of file +var _0x6cf4=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x6cf4,0x1c6));var _0x46cf=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0x6cf4[_0x77d310];return _0x2cdce4;};'use strict';var Sequelize=require(_0x46cf('0x0'));module['exports']={'type':{'type':Sequelize[_0x46cf('0x1')](_0x46cf('0x2'),_0x46cf('0x3'),_0x46cf('0x4'),'keyValue',_0x46cf('0x5')),'defaultValue':_0x46cf('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x46cf('0x6')]},'keyType':{'type':Sequelize[_0x46cf('0x1')](_0x46cf('0x2'),_0x46cf('0x3'),_0x46cf('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x46cf('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x46cf('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x46cf('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 9635fd6..81c5960 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 _0xeba2=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x242f06,_0x563e27){var _0x414fee=function(_0x2520be){while(--_0x2520be){_0x242f06['push'](_0x242f06['shift']());}};_0x414fee(++_0x563e27);}(_0xeba2,0x16d));var _0x2eba=function(_0x2f37e0,_0x393ef9){_0x2f37e0=_0x2f37e0-0x0;var _0x43ccce=_0xeba2[_0x2f37e0];return _0x43ccce;};'use strict';var emlformat=require(_0x2eba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2eba('0x1'));var jsonpatch=require(_0x2eba('0x2'));var rp=require(_0x2eba('0x3'));var moment=require('moment');var BPromise=require(_0x2eba('0x4'));var Mustache=require(_0x2eba('0x5'));var util=require('util');var path=require(_0x2eba('0x6'));var sox=require(_0x2eba('0x7'));var csv=require(_0x2eba('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2eba('0x9'));var _=require(_0x2eba('0xa'));var squel=require(_0x2eba('0xb'));var crypto=require(_0x2eba('0xc'));var jsforce=require(_0x2eba('0xd'));var deskjs=require(_0x2eba('0xe'));var toCsv=require(_0x2eba('0x8'));var querystring=require(_0x2eba('0xf'));var Papa=require(_0x2eba('0x10'));var Redis=require(_0x2eba('0x11'));var authService=require(_0x2eba('0x12'));var qs=require(_0x2eba('0x13'));var as=require(_0x2eba('0x14'));var hardwareService=require(_0x2eba('0x15'));var logger=require(_0x2eba('0x16'))(_0x2eba('0x17'));var utils=require('../../config/utils');var config=require(_0x2eba('0x18'));var licenseUtil=require(_0x2eba('0x19'));var db=require(_0x2eba('0x1a'))['db'];function respondWithStatusCode(_0x47c14f,_0x99d6d){_0x99d6d=_0x99d6d||0xcc;return function(_0x7f8484){if(_0x7f8484){return _0x47c14f['sendStatus'](_0x99d6d);}return _0x47c14f[_0x2eba('0x1b')](_0x99d6d)['end']();};}function respondWithResult(_0x13c7a7,_0x5bae67){_0x5bae67=_0x5bae67||0xc8;return function(_0x160c91){if(_0x160c91){return _0x13c7a7['status'](_0x5bae67)[_0x2eba('0x1c')](_0x160c91);}};}function respondWithFilteredResult(_0x46ada7,_0x5ad5b6){return function(_0x6bcdc6){if(_0x6bcdc6){var _0x44b4e7=typeof _0x5ad5b6['offset']===_0x2eba('0x1d')&&typeof _0x5ad5b6[_0x2eba('0x1e')]===_0x2eba('0x1d');var _0x5142d1=_0x6bcdc6[_0x2eba('0x1f')];var _0x1731f7=_0x44b4e7?0x0:_0x5ad5b6['offset'];var _0x309aed=_0x44b4e7?_0x6bcdc6[_0x2eba('0x1f')]:_0x5ad5b6[_0x2eba('0x20')]+_0x5ad5b6['limit'];var _0x50a992;if(_0x309aed>=_0x5142d1){_0x309aed=_0x5142d1;_0x50a992=0xc8;}else{_0x50a992=0xce;}_0x46ada7[_0x2eba('0x1b')](_0x50a992);return _0x46ada7[_0x2eba('0x21')](_0x2eba('0x22'),_0x1731f7+'-'+_0x309aed+'/'+_0x5142d1)['json'](_0x6bcdc6);}return null;};}function patchUpdates(_0xd38b06){return function(_0x23d56a){try{jsonpatch[_0x2eba('0x23')](_0x23d56a,_0xd38b06,!![]);}catch(_0x4d7290){return BPromise[_0x2eba('0x24')](_0x4d7290);}return _0x23d56a['save']();};}function saveUpdates(_0x284ae4,_0x724a49){return function(_0x43959f){if(_0x43959f){return _0x43959f[_0x2eba('0x25')](_0x284ae4)['then'](function(_0xb0e28f){return _0xb0e28f;});}return null;};}function removeEntity(_0x5a139d,_0x4346c2){return function(_0x14d278){if(_0x14d278){return _0x14d278[_0x2eba('0x26')]()[_0x2eba('0x27')](function(){_0x5a139d[_0x2eba('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46a29c,_0xeaab31){return function(_0x5bd6ae){if(!_0x5bd6ae){_0x46a29c[_0x2eba('0x28')](0x194);}return _0x5bd6ae;};}function handleError(_0x143f04,_0x19b68d){_0x19b68d=_0x19b68d||0x1f4;return function(_0x4b90a2){logger[_0x2eba('0x29')](_0x4b90a2['stack']);if(_0x4b90a2[_0x2eba('0x2a')]){delete _0x4b90a2[_0x2eba('0x2a')];}_0x143f04['status'](_0x19b68d)[_0x2eba('0x2b')](_0x4b90a2);};}exports[_0x2eba('0x2c')]=function(_0x5316f5,_0x18ee0d){var _0x57d22c={},_0x266b1e={},_0x1107bc={'count':0x0,'rows':[]};var _0xa268fe=_[_0x2eba('0x2d')](db[_0x2eba('0x2e')][_0x2eba('0x2f')],function(_0x51029a){return{'name':_0x51029a[_0x2eba('0x30')],'type':_0x51029a[_0x2eba('0x31')]['key']};});_0x266b1e[_0x2eba('0x32')]=_[_0x2eba('0x2d')](_0xa268fe,_0x2eba('0x2a'));_0x266b1e[_0x2eba('0x33')]=_[_0x2eba('0x34')](_0x5316f5[_0x2eba('0x33')]);_0x266b1e[_0x2eba('0x35')]=_[_0x2eba('0x36')](_0x266b1e[_0x2eba('0x32')],_0x266b1e[_0x2eba('0x33')]);_0x57d22c[_0x2eba('0x37')]=_['intersection'](_0x266b1e[_0x2eba('0x32')],qs['fields'](_0x5316f5[_0x2eba('0x33')]['fields']));_0x57d22c['attributes']=_0x57d22c[_0x2eba('0x37')][_0x2eba('0x38')]?_0x57d22c[_0x2eba('0x37')]:_0x266b1e['model'];if(!_0x5316f5['query'][_0x2eba('0x39')]('nolimit')){_0x57d22c[_0x2eba('0x1e')]=qs[_0x2eba('0x1e')](_0x5316f5[_0x2eba('0x33')][_0x2eba('0x1e')]);_0x57d22c['offset']=qs[_0x2eba('0x20')](_0x5316f5[_0x2eba('0x33')]['offset']);}_0x57d22c[_0x2eba('0x3a')]=qs[_0x2eba('0x3b')](_0x5316f5[_0x2eba('0x33')][_0x2eba('0x3b')]);_0x57d22c['where']=qs['filters'](_['pick'](_0x5316f5[_0x2eba('0x33')],_0x266b1e[_0x2eba('0x35')]),_0xa268fe);if(_0x5316f5[_0x2eba('0x33')][_0x2eba('0x3c')]){_0x57d22c[_0x2eba('0x3d')]=_[_0x2eba('0x3e')](_0x57d22c['where'],{'$or':_['map'](_0xa268fe,function(_0xfd90c0){if(_0xfd90c0[_0x2eba('0x31')]!==_0x2eba('0x3f')){var _0x4b28b4={};_0x4b28b4[_0xfd90c0['name']]={'$like':'%'+_0x5316f5[_0x2eba('0x33')]['filter']+'%'};return _0x4b28b4;}})});}_0x57d22c=_[_0x2eba('0x3e')]({},_0x57d22c,_0x5316f5[_0x2eba('0x40')]);var _0xdb1f87={'where':_0x57d22c[_0x2eba('0x3d')]};return db[_0x2eba('0x2e')][_0x2eba('0x1f')](_0xdb1f87)[_0x2eba('0x27')](function(_0x3fbbd7){_0x1107bc[_0x2eba('0x1f')]=_0x3fbbd7;if(_0x5316f5['query'][_0x2eba('0x41')]){_0x57d22c[_0x2eba('0x42')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x2eba('0x43')](_0x57d22c);})[_0x2eba('0x27')](function(_0x12f7f1){_0x1107bc[_0x2eba('0x44')]=_0x12f7f1;return _0x1107bc;})[_0x2eba('0x27')](respondWithFilteredResult(_0x18ee0d,_0x57d22c))['catch'](handleError(_0x18ee0d,null));};exports[_0x2eba('0x45')]=function(_0x1588f7,_0x5c5dd7){var _0xa52493={'raw':!![],'where':{'id':_0x1588f7[_0x2eba('0x46')]['id']}},_0x393078={};_0x393078[_0x2eba('0x32')]=_[_0x2eba('0x34')](db[_0x2eba('0x2e')][_0x2eba('0x2f')]);_0x393078['query']=_[_0x2eba('0x34')](_0x1588f7['query']);_0x393078[_0x2eba('0x35')]=_['intersection'](_0x393078['model'],_0x393078[_0x2eba('0x33')]);_0xa52493[_0x2eba('0x37')]=_[_0x2eba('0x36')](_0x393078[_0x2eba('0x32')],qs['fields'](_0x1588f7[_0x2eba('0x33')][_0x2eba('0x47')]));_0xa52493[_0x2eba('0x37')]=_0xa52493['attributes']['length']?_0xa52493[_0x2eba('0x37')]:_0x393078[_0x2eba('0x32')];if(_0x1588f7[_0x2eba('0x33')][_0x2eba('0x41')]){_0xa52493[_0x2eba('0x42')]=[{'all':!![]}];}_0xa52493=_['merge']({},_0xa52493,_0x1588f7[_0x2eba('0x40')]);return db[_0x2eba('0x2e')][_0x2eba('0x48')](_0xa52493)[_0x2eba('0x27')](handleEntityNotFound(_0x5c5dd7,null))['then'](respondWithResult(_0x5c5dd7,null))[_0x2eba('0x49')](handleError(_0x5c5dd7,null));};exports[_0x2eba('0x4a')]=function(_0x4527b5,_0x221f46){return db['Dynamics365Field'][_0x2eba('0x4a')](_0x4527b5[_0x2eba('0x4b')],{})['then'](respondWithResult(_0x221f46,0xc9))[_0x2eba('0x49')](handleError(_0x221f46,null));};exports[_0x2eba('0x25')]=function(_0x2e7c42,_0x33464f){if(_0x2e7c42[_0x2eba('0x4b')]['id']){delete _0x2e7c42[_0x2eba('0x4b')]['id'];}return db[_0x2eba('0x2e')][_0x2eba('0x48')]({'where':{'id':_0x2e7c42[_0x2eba('0x46')]['id']}})[_0x2eba('0x27')](handleEntityNotFound(_0x33464f,null))[_0x2eba('0x27')](saveUpdates(_0x2e7c42[_0x2eba('0x4b')],null))['then'](respondWithResult(_0x33464f,null))[_0x2eba('0x49')](handleError(_0x33464f,null));};exports[_0x2eba('0x26')]=function(_0x1ac276,_0x1feace){return db[_0x2eba('0x2e')]['find']({'where':{'id':_0x1ac276[_0x2eba('0x46')]['id']}})[_0x2eba('0x27')](handleEntityNotFound(_0x1feace,null))['then'](removeEntity(_0x1feace,null))[_0x2eba('0x49')](handleError(_0x1feace,null));}; \ No newline at end of file +var _0x8a76=['status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','end','error','name','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','map','includeAll','include','show','length','options','find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5497f8,_0xc92a33){var _0x4d788c=function(_0x2a0214){while(--_0x2a0214){_0x5497f8['push'](_0x5497f8['shift']());}};_0x4d788c(++_0xc92a33);}(_0x8a76,0x141));var _0x68a7=function(_0x6ca440,_0x3c2c86){_0x6ca440=_0x6ca440-0x0;var _0x447620=_0x8a76[_0x6ca440];return _0x447620;};'use strict';var emlformat=require(_0x68a7('0x0'));var rimraf=require(_0x68a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x68a7('0x2'));var rp=require('request-promise');var moment=require(_0x68a7('0x3'));var BPromise=require(_0x68a7('0x4'));var Mustache=require('mustache');var util=require(_0x68a7('0x5'));var path=require(_0x68a7('0x6'));var sox=require(_0x68a7('0x7'));var csv=require(_0x68a7('0x8'));var ejs=require(_0x68a7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68a7('0xa'));var squel=require(_0x68a7('0xb'));var crypto=require('crypto');var jsforce=require(_0x68a7('0xc'));var deskjs=require(_0x68a7('0xd'));var toCsv=require(_0x68a7('0x8'));var querystring=require(_0x68a7('0xe'));var Papa=require(_0x68a7('0xf'));var Redis=require(_0x68a7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x68a7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68a7('0x12'));var logger=require(_0x68a7('0x13'))(_0x68a7('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x68a7('0x15'));var db=require(_0x68a7('0x16'))['db'];function respondWithStatusCode(_0x8903a9,_0xfdb509){_0xfdb509=_0xfdb509||0xcc;return function(_0x19bbc0){if(_0x19bbc0){return _0x8903a9[_0x68a7('0x17')](_0xfdb509);}return _0x8903a9['status'](_0xfdb509)['end']();};}function respondWithResult(_0x564ac5,_0x5570a7){_0x5570a7=_0x5570a7||0xc8;return function(_0x1e333f){if(_0x1e333f){return _0x564ac5[_0x68a7('0x18')](_0x5570a7)[_0x68a7('0x19')](_0x1e333f);}};}function respondWithFilteredResult(_0x2f789a,_0x54832b){return function(_0x2b4cf4){if(_0x2b4cf4){var _0x481108=typeof _0x54832b[_0x68a7('0x1a')]===_0x68a7('0x1b')&&typeof _0x54832b['limit']==='undefined';var _0x2f88b2=_0x2b4cf4[_0x68a7('0x1c')];var _0x332587=_0x481108?0x0:_0x54832b['offset'];var _0x25fa16=_0x481108?_0x2b4cf4['count']:_0x54832b[_0x68a7('0x1a')]+_0x54832b[_0x68a7('0x1d')];var _0x520378;if(_0x25fa16>=_0x2f88b2){_0x25fa16=_0x2f88b2;_0x520378=0xc8;}else{_0x520378=0xce;}_0x2f789a[_0x68a7('0x18')](_0x520378);return _0x2f789a[_0x68a7('0x1e')]('Content-Range',_0x332587+'-'+_0x25fa16+'/'+_0x2f88b2)[_0x68a7('0x19')](_0x2b4cf4);}return null;};}function patchUpdates(_0x1c27a2){return function(_0x406e43){try{jsonpatch[_0x68a7('0x1f')](_0x406e43,_0x1c27a2,!![]);}catch(_0x42a030){return BPromise[_0x68a7('0x20')](_0x42a030);}return _0x406e43[_0x68a7('0x21')]();};}function saveUpdates(_0x2936c0,_0x245db7){return function(_0x5cc218){if(_0x5cc218){return _0x5cc218[_0x68a7('0x22')](_0x2936c0)['then'](function(_0x373b9e){return _0x373b9e;});}return null;};}function removeEntity(_0x4b20e4,_0x4ed545){return function(_0x1d01ce){if(_0x1d01ce){return _0x1d01ce['destroy']()[_0x68a7('0x23')](function(){_0x4b20e4[_0x68a7('0x18')](0xcc)[_0x68a7('0x24')]();});}};}function handleEntityNotFound(_0x141919,_0x3f8af5){return function(_0x3b3bc5){if(!_0x3b3bc5){_0x141919['sendStatus'](0x194);}return _0x3b3bc5;};}function handleError(_0x396afa,_0x26b803){_0x26b803=_0x26b803||0x1f4;return function(_0x2b95a1){logger[_0x68a7('0x25')](_0x2b95a1['stack']);if(_0x2b95a1[_0x68a7('0x26')]){delete _0x2b95a1[_0x68a7('0x26')];}_0x396afa[_0x68a7('0x18')](_0x26b803)['send'](_0x2b95a1);};}exports[_0x68a7('0x27')]=function(_0x44048b,_0x435d48){var _0x3dee0e={},_0xa95552={},_0x52643c={'count':0x0,'rows':[]};var _0x26615d=_['map'](db[_0x68a7('0x28')][_0x68a7('0x29')],function(_0x537628){return{'name':_0x537628[_0x68a7('0x2a')],'type':_0x537628[_0x68a7('0x2b')][_0x68a7('0x2c')]};});_0xa95552[_0x68a7('0x2d')]=_['map'](_0x26615d,'name');_0xa95552[_0x68a7('0x2e')]=_[_0x68a7('0x2f')](_0x44048b[_0x68a7('0x2e')]);_0xa95552['filters']=_[_0x68a7('0x30')](_0xa95552[_0x68a7('0x2d')],_0xa95552[_0x68a7('0x2e')]);_0x3dee0e[_0x68a7('0x31')]=_[_0x68a7('0x30')](_0xa95552[_0x68a7('0x2d')],qs['fields'](_0x44048b[_0x68a7('0x2e')][_0x68a7('0x32')]));_0x3dee0e['attributes']=_0x3dee0e[_0x68a7('0x31')]['length']?_0x3dee0e[_0x68a7('0x31')]:_0xa95552[_0x68a7('0x2d')];if(!_0x44048b[_0x68a7('0x2e')][_0x68a7('0x33')]('nolimit')){_0x3dee0e['limit']=qs[_0x68a7('0x1d')](_0x44048b[_0x68a7('0x2e')][_0x68a7('0x1d')]);_0x3dee0e['offset']=qs['offset'](_0x44048b[_0x68a7('0x2e')][_0x68a7('0x1a')]);}_0x3dee0e[_0x68a7('0x34')]=qs['sort'](_0x44048b[_0x68a7('0x2e')][_0x68a7('0x35')]);_0x3dee0e[_0x68a7('0x36')]=qs[_0x68a7('0x37')](_['pick'](_0x44048b['query'],_0xa95552['filters']),_0x26615d);if(_0x44048b[_0x68a7('0x2e')][_0x68a7('0x38')]){_0x3dee0e['where']=_[_0x68a7('0x39')](_0x3dee0e[_0x68a7('0x36')],{'$or':_[_0x68a7('0x3a')](_0x26615d,function(_0x17349c){if(_0x17349c[_0x68a7('0x2b')]!=='VIRTUAL'){var _0x31addb={};_0x31addb[_0x17349c[_0x68a7('0x26')]]={'$like':'%'+_0x44048b['query'][_0x68a7('0x38')]+'%'};return _0x31addb;}})});}_0x3dee0e=_[_0x68a7('0x39')]({},_0x3dee0e,_0x44048b['options']);var _0x139fdd={'where':_0x3dee0e[_0x68a7('0x36')]};return db['Dynamics365Field'][_0x68a7('0x1c')](_0x139fdd)[_0x68a7('0x23')](function(_0x2c1eea){_0x52643c[_0x68a7('0x1c')]=_0x2c1eea;if(_0x44048b[_0x68a7('0x2e')][_0x68a7('0x3b')]){_0x3dee0e[_0x68a7('0x3c')]=[{'all':!![]}];}return db[_0x68a7('0x28')]['findAll'](_0x3dee0e);})[_0x68a7('0x23')](function(_0x5f3e6d){_0x52643c['rows']=_0x5f3e6d;return _0x52643c;})['then'](respondWithFilteredResult(_0x435d48,_0x3dee0e))['catch'](handleError(_0x435d48,null));};exports[_0x68a7('0x3d')]=function(_0x4a75a4,_0x19912f){var _0x34eb00={'raw':!![],'where':{'id':_0x4a75a4['params']['id']}},_0x1ffc83={};_0x1ffc83['model']=_[_0x68a7('0x2f')](db[_0x68a7('0x28')][_0x68a7('0x29')]);_0x1ffc83[_0x68a7('0x2e')]=_[_0x68a7('0x2f')](_0x4a75a4[_0x68a7('0x2e')]);_0x1ffc83['filters']=_[_0x68a7('0x30')](_0x1ffc83['model'],_0x1ffc83[_0x68a7('0x2e')]);_0x34eb00[_0x68a7('0x31')]=_[_0x68a7('0x30')](_0x1ffc83['model'],qs[_0x68a7('0x32')](_0x4a75a4[_0x68a7('0x2e')][_0x68a7('0x32')]));_0x34eb00[_0x68a7('0x31')]=_0x34eb00[_0x68a7('0x31')][_0x68a7('0x3e')]?_0x34eb00[_0x68a7('0x31')]:_0x1ffc83[_0x68a7('0x2d')];if(_0x4a75a4[_0x68a7('0x2e')][_0x68a7('0x3b')]){_0x34eb00[_0x68a7('0x3c')]=[{'all':!![]}];}_0x34eb00=_[_0x68a7('0x39')]({},_0x34eb00,_0x4a75a4[_0x68a7('0x3f')]);return db[_0x68a7('0x28')][_0x68a7('0x40')](_0x34eb00)[_0x68a7('0x23')](handleEntityNotFound(_0x19912f,null))[_0x68a7('0x23')](respondWithResult(_0x19912f,null))[_0x68a7('0x41')](handleError(_0x19912f,null));};exports[_0x68a7('0x42')]=function(_0x3e87ff,_0x261f96){return db[_0x68a7('0x28')][_0x68a7('0x42')](_0x3e87ff['body'],{})[_0x68a7('0x23')](respondWithResult(_0x261f96,0xc9))[_0x68a7('0x41')](handleError(_0x261f96,null));};exports['update']=function(_0x32b899,_0xa60969){if(_0x32b899[_0x68a7('0x43')]['id']){delete _0x32b899[_0x68a7('0x43')]['id'];}return db[_0x68a7('0x28')][_0x68a7('0x40')]({'where':{'id':_0x32b899['params']['id']}})[_0x68a7('0x23')](handleEntityNotFound(_0xa60969,null))[_0x68a7('0x23')](saveUpdates(_0x32b899['body'],null))[_0x68a7('0x23')](respondWithResult(_0xa60969,null))[_0x68a7('0x41')](handleError(_0xa60969,null));};exports[_0x68a7('0x44')]=function(_0xd552d2,_0x370031){return db[_0x68a7('0x28')]['find']({'where':{'id':_0xd552d2['params']['id']}})['then'](handleEntityNotFound(_0x370031,null))[_0x68a7('0x23')](removeEntity(_0x370031,null))[_0x68a7('0x41')](handleError(_0x370031,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 5d47b19..093300d 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 _0xbe7b=['int_dynamics365_fields','dynamics365_unique_index','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xbe7b,0x147));var _0xbbe7=function(_0x584b3f,_0x3b21a5){_0x584b3f=_0x584b3f-0x0;var _0x359088=_0xbe7b[_0x584b3f];return _0x359088;};'use strict';var _=require(_0xbbe7('0x0'));var util=require(_0xbbe7('0x1'));var logger=require(_0xbbe7('0x2'))(_0xbbe7('0x3'));var moment=require(_0xbbe7('0x4'));var BPromise=require('bluebird');var rp=require(_0xbbe7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbbe7('0x6'));var config=require('../../config/environment');var attributes=require(_0xbbe7('0x7'));module[_0xbbe7('0x8')]=function(_0x283836,_0x2b935d){return _0x283836[_0xbbe7('0x9')](_0xbbe7('0xa'),attributes,{'tableName':_0xbbe7('0xb'),'paranoid':![],'indexes':[{'name':_0xbbe7('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf42a=['dynamics365_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields'];(function(_0x2437a1,_0x4dfb16){var _0x4f20dc=function(_0x55ac01){while(--_0x55ac01){_0x2437a1['push'](_0x2437a1['shift']());}};_0x4f20dc(++_0x4dfb16);}(_0xf42a,0x16a));var _0xaf42=function(_0x4016fb,_0x74bf7c){_0x4016fb=_0x4016fb-0x0;var _0x114166=_0xf42a[_0x4016fb];return _0x114166;};'use strict';var _=require(_0xaf42('0x0'));var util=require(_0xaf42('0x1'));var logger=require(_0xaf42('0x2'))(_0xaf42('0x3'));var moment=require(_0xaf42('0x4'));var BPromise=require(_0xaf42('0x5'));var rp=require(_0xaf42('0x6'));var fs=require('fs');var path=require(_0xaf42('0x7'));var rimraf=require('rimraf');var config=require(_0xaf42('0x8'));var attributes=require(_0xaf42('0x9'));module[_0xaf42('0xa')]=function(_0x3cfac7,_0x4611ec){return _0x3cfac7[_0xaf42('0xb')]('Dynamics365Field',attributes,{'tableName':_0xaf42('0xc'),'paranoid':![],'indexes':[{'name':_0xaf42('0xd'),'fields':['idField',_0xaf42('0xe')],'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 0f5b7d5..b1c8001 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 _0xf3dc=['bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x75db98,_0x46b558){var _0x29298e=function(_0x536cb9){while(--_0x536cb9){_0x75db98['push'](_0x75db98['shift']());}};_0x29298e(++_0x46b558);}(_0xf3dc,0x166));var _0xcf3d=function(_0x246f92,_0xcf7bd4){_0x246f92=_0x246f92-0x0;var _0x2b8e7d=_0xf3dc[_0x246f92];return _0x2b8e7d;};'use strict';var _=require(_0xcf3d('0x0'));var util=require(_0xcf3d('0x1'));var moment=require('moment');var BPromise=require(_0xcf3d('0x2'));var rs=require(_0xcf3d('0x3'));var fs=require('fs');var Redis=require(_0xcf3d('0x4'));var db=require(_0xcf3d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xcf3d('0x6'));var jayson=require(_0xcf3d('0x7'));var client=jayson['client'][_0xcf3d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3601d4,_0x10069a,_0x1de606){return new BPromise(function(_0x18c023,_0x137150){return client[_0xcf3d('0x9')](_0x3601d4,_0x1de606)['then'](function(_0x235826){logger[_0xcf3d('0xa')](_0xcf3d('0xb'),_0x10069a,_0xcf3d('0xc'));logger[_0xcf3d('0xd')](_0xcf3d('0xe'),_0x10069a,_0xcf3d('0xc'),JSON['stringify'](_0x235826));if(_0x235826[_0xcf3d('0xf')]){if(_0x235826['error'][_0xcf3d('0x10')]===0x1f4){logger[_0xcf3d('0xf')](_0xcf3d('0xb'),_0x10069a,_0x235826[_0xcf3d('0xf')]['message']);return _0x137150(_0x235826['error'][_0xcf3d('0x11')]);}logger[_0xcf3d('0xf')](_0xcf3d('0xb'),_0x10069a,_0x235826[_0xcf3d('0xf')][_0xcf3d('0x11')]);return _0x18c023(_0x235826['error']['message']);}else{logger['info'](_0xcf3d('0xb'),_0x10069a,_0xcf3d('0xc'));_0x18c023(_0x235826[_0xcf3d('0x12')]['message']);}})[_0xcf3d('0x13')](function(_0x2d2c80){logger['error'](_0xcf3d('0xb'),_0x10069a,_0x2d2c80);_0x137150(_0x2d2c80);});});} \ No newline at end of file +var _0xdc30=['rpc','../../config/environment','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x10ca28,_0x53392f){var _0x52d77f=function(_0x4ffa95){while(--_0x4ffa95){_0x10ca28['push'](_0x10ca28['shift']());}};_0x52d77f(++_0x53392f);}(_0xdc30,0x109));var _0x0dc3=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xdc30[_0x2e2681];return _0x368a64;};'use strict';var _=require('lodash');var util=require(_0x0dc3('0x0'));var moment=require(_0x0dc3('0x1'));var BPromise=require(_0x0dc3('0x2'));var rs=require(_0x0dc3('0x3'));var fs=require('fs');var Redis=require(_0x0dc3('0x4'));var db=require(_0x0dc3('0x5'))['db'];var utils=require(_0x0dc3('0x6'));var logger=require(_0x0dc3('0x7'))(_0x0dc3('0x8'));var config=require(_0x0dc3('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0dc3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e6260,_0x4d1769,_0x35f876){return new BPromise(function(_0x1d1c1b,_0x4dd5f0){return client[_0x0dc3('0xb')](_0x3e6260,_0x35f876)[_0x0dc3('0xc')](function(_0x8f8460){logger[_0x0dc3('0xd')](_0x0dc3('0xe'),_0x4d1769,_0x0dc3('0xf'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4d1769,_0x0dc3('0xf'),JSON['stringify'](_0x8f8460));if(_0x8f8460[_0x0dc3('0x10')]){if(_0x8f8460[_0x0dc3('0x10')][_0x0dc3('0x11')]===0x1f4){logger[_0x0dc3('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x4d1769,_0x8f8460[_0x0dc3('0x10')][_0x0dc3('0x12')]);return _0x4dd5f0(_0x8f8460['error'][_0x0dc3('0x12')]);}logger[_0x0dc3('0x10')](_0x0dc3('0xe'),_0x4d1769,_0x8f8460['error']['message']);return _0x1d1c1b(_0x8f8460['error']['message']);}else{logger['info'](_0x0dc3('0xe'),_0x4d1769,_0x0dc3('0xf'));_0x1d1c1b(_0x8f8460[_0x0dc3('0x13')][_0x0dc3('0x12')]);}})[_0x0dc3('0x14')](function(_0x5322d0){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x4d1769,_0x5322d0);_0x4dd5f0(_0x5322d0);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 5ec4365..ec773e9 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 _0xa6bc=['put','/:id','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshdeskAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0xa6bc,0xb5));var _0xca6b=function(_0x390b40,_0x32a62e){_0x390b40=_0x390b40-0x0;var _0x11a416=_0xa6bc[_0x390b40];return _0x11a416;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xca6b('0x0'));var timeout=require(_0xca6b('0x1'));var express=require(_0xca6b('0x2'));var router=express[_0xca6b('0x3')]();var fs_extra=require(_0xca6b('0x4'));var auth=require(_0xca6b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xca6b('0x6'));router[_0xca6b('0x7')]('/',auth[_0xca6b('0x8')](),controller['index']);router[_0xca6b('0x7')]('/:id',auth[_0xca6b('0x8')](),controller[_0xca6b('0x9')]);router['get'](_0xca6b('0xa'),auth[_0xca6b('0x8')](),controller[_0xca6b('0xb')]);router[_0xca6b('0x7')](_0xca6b('0xc'),auth[_0xca6b('0x8')](),controller[_0xca6b('0xd')]);router[_0xca6b('0xe')]('/',auth[_0xca6b('0x8')](),controller[_0xca6b('0xf')]);router['post'](_0xca6b('0xa'),auth[_0xca6b('0x8')](),controller[_0xca6b('0x10')]);router[_0xca6b('0x11')](_0xca6b('0x12'),auth[_0xca6b('0x8')](),controller[_0xca6b('0x13')]);router[_0xca6b('0x14')](_0xca6b('0x12'),auth[_0xca6b('0x8')](),controller['destroy']);module[_0xca6b('0x15')]=router; \ No newline at end of file +var _0x0f73=['create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x888dc8,_0x3fabbd){var _0x400c40=function(_0x3e6643){while(--_0x3e6643){_0x888dc8['push'](_0x888dc8['shift']());}};_0x400c40(++_0x3fabbd);}(_0x0f73,0x1c0));var _0x30f7=function(_0x41dae8,_0x585948){_0x41dae8=_0x41dae8-0x0;var _0x5b9f49=_0x0f73[_0x41dae8];return _0x5b9f49;};'use strict';var multer=require(_0x30f7('0x0'));var util=require(_0x30f7('0x1'));var path=require(_0x30f7('0x2'));var timeout=require(_0x30f7('0x3'));var express=require(_0x30f7('0x4'));var router=express[_0x30f7('0x5')]();var fs_extra=require(_0x30f7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x30f7('0x7'));var config=require(_0x30f7('0x8'));var controller=require(_0x30f7('0x9'));router[_0x30f7('0xa')]('/',auth[_0x30f7('0xb')](),controller[_0x30f7('0xc')]);router['get'](_0x30f7('0xd'),auth['isAuthenticated'](),controller[_0x30f7('0xe')]);router['get'](_0x30f7('0xf'),auth[_0x30f7('0xb')](),controller[_0x30f7('0x10')]);router[_0x30f7('0xa')](_0x30f7('0x11'),auth[_0x30f7('0xb')](),controller[_0x30f7('0x12')]);router[_0x30f7('0x13')]('/',auth[_0x30f7('0xb')](),controller[_0x30f7('0x14')]);router[_0x30f7('0x13')](_0x30f7('0xf'),auth[_0x30f7('0xb')](),controller[_0x30f7('0x15')]);router[_0x30f7('0x16')](_0x30f7('0xd'),auth[_0x30f7('0xb')](),controller[_0x30f7('0x17')]);router['delete'](_0x30f7('0xd'),auth[_0x30f7('0xb')](),controller[_0x30f7('0x18')]);module[_0x30f7('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 885f4f4..ae4b651 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 _0x14a0=['username','exports','STRING'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0x14a0,0x8e));var _0x014a=function(_0xc337e5,_0x4b3b38){_0xc337e5=_0xc337e5-0x0;var _0x1be9bd=_0x14a0[_0xc337e5];return _0x1be9bd;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'name':{'type':Sequelize[_0x014a('0x1')]},'description':{'type':Sequelize[_0x014a('0x1')]},'username':{'type':Sequelize[_0x014a('0x1')],'unique':_0x014a('0x2')},'apiKey':{'type':Sequelize[_0x014a('0x1')]},'remoteUri':{'type':Sequelize[_0x014a('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4325=['exports','STRING','username','remoteUri','sequelize'];(function(_0x56db9d,_0x2f421d){var _0x23325d=function(_0x386eba){while(--_0x386eba){_0x56db9d['push'](_0x56db9d['shift']());}};_0x23325d(++_0x2f421d);}(_0x4325,0x1da));var _0x5432=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4325[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x5432('0x0'));module[_0x5432('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5432('0x2')]},'username':{'type':Sequelize[_0x5432('0x2')],'unique':_0x5432('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x5432('0x4')},'serverUrl':{'type':Sequelize[_0x5432('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 4796f77..64c6575 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 _0x6d4a=['FreshdeskConfiguration','addConfiguration','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','FreshdeskField','getFields','apiKey','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','base64','requester','agent','priority','source','ticket_type','group','company','includes','default','custom_text','label','choices','capitalize','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','FreshdeskAccount','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','find','create','body','getConfigurations','findOne'];(function(_0x50f2d7,_0x5efb6a){var _0x2911f3=function(_0x41f11b){while(--_0x41f11b){_0x50f2d7['push'](_0x50f2d7['shift']());}};_0x2911f3(++_0x5efb6a);}(_0x6d4a,0x117));var _0xa6d4=function(_0x52397c,_0x560f80){_0x52397c=_0x52397c-0x0;var _0x4cf4a9=_0x6d4a[_0x52397c];return _0x4cf4a9;};'use strict';var emlformat=require(_0xa6d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa6d4('0x1'));var jsonpatch=require(_0xa6d4('0x2'));var rp=require(_0xa6d4('0x3'));var moment=require(_0xa6d4('0x4'));var BPromise=require(_0xa6d4('0x5'));var Mustache=require(_0xa6d4('0x6'));var util=require(_0xa6d4('0x7'));var path=require(_0xa6d4('0x8'));var sox=require(_0xa6d4('0x9'));var csv=require(_0xa6d4('0xa'));var ejs=require(_0xa6d4('0xb'));var fs=require('fs');var fs_extra=require(_0xa6d4('0xc'));var _=require(_0xa6d4('0xd'));var squel=require(_0xa6d4('0xe'));var crypto=require('crypto');var jsforce=require(_0xa6d4('0xf'));var deskjs=require(_0xa6d4('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa6d4('0x11'));var Papa=require(_0xa6d4('0x12'));var Redis=require(_0xa6d4('0x13'));var authService=require(_0xa6d4('0x14'));var qs=require(_0xa6d4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa6d4('0x16'));var logger=require(_0xa6d4('0x17'))('api');var utils=require(_0xa6d4('0x18'));var config=require(_0xa6d4('0x19'));var licenseUtil=require(_0xa6d4('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa6d4('0x1b'));function respondWithStatusCode(_0x53b1c1,_0x23830f){_0x23830f=_0x23830f||0xcc;return function(_0x13665d){if(_0x13665d){return _0x53b1c1['sendStatus'](_0x23830f);}return _0x53b1c1[_0xa6d4('0x1c')](_0x23830f)[_0xa6d4('0x1d')]();};}function respondWithResult(_0x3a0d34,_0x9631de){_0x9631de=_0x9631de||0xc8;return function(_0x427f4c){if(_0x427f4c){return _0x3a0d34[_0xa6d4('0x1c')](_0x9631de)[_0xa6d4('0x1e')](_0x427f4c);}};}function respondWithFilteredResult(_0x3e714f,_0x7420d8){return function(_0x17a926){if(_0x17a926){var _0x1b9969=typeof _0x7420d8[_0xa6d4('0x1f')]==='undefined'&&typeof _0x7420d8[_0xa6d4('0x20')]==='undefined';var _0x209091=_0x17a926[_0xa6d4('0x21')];var _0x4533ea=_0x1b9969?0x0:_0x7420d8['offset'];var _0x12226a=_0x1b9969?_0x17a926[_0xa6d4('0x21')]:_0x7420d8['offset']+_0x7420d8[_0xa6d4('0x20')];var _0x1e31df;if(_0x12226a>=_0x209091){_0x12226a=_0x209091;_0x1e31df=0xc8;}else{_0x1e31df=0xce;}_0x3e714f[_0xa6d4('0x1c')](_0x1e31df);return _0x3e714f[_0xa6d4('0x22')](_0xa6d4('0x23'),_0x4533ea+'-'+_0x12226a+'/'+_0x209091)['json'](_0x17a926);}return null;};}function patchUpdates(_0x3e0ae2){return function(_0x302292){try{jsonpatch[_0xa6d4('0x24')](_0x302292,_0x3e0ae2,!![]);}catch(_0x545fb1){return BPromise['reject'](_0x545fb1);}return _0x302292[_0xa6d4('0x25')]();};}function saveUpdates(_0x32bea3,_0x46d32f){return function(_0x63886a){if(_0x63886a){return _0x63886a[_0xa6d4('0x26')](_0x32bea3)[_0xa6d4('0x27')](function(_0x4a744e){return _0x4a744e;});}return null;};}function removeEntity(_0x1bf8cb,_0xd4a69e){return function(_0xfa4806){if(_0xfa4806){return _0xfa4806[_0xa6d4('0x28')]()[_0xa6d4('0x27')](function(){_0x1bf8cb[_0xa6d4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a3ed8,_0x5589c5){return function(_0x1fec86){if(!_0x1fec86){_0x3a3ed8['sendStatus'](0x194);}return _0x1fec86;};}function handleError(_0x272759,_0xf2f536){_0xf2f536=_0xf2f536||0x1f4;return function(_0x21c658){logger['error'](_0x21c658[_0xa6d4('0x29')]);if(_0x21c658[_0xa6d4('0x2a')]){delete _0x21c658['name'];}_0x272759[_0xa6d4('0x1c')](_0xf2f536)[_0xa6d4('0x2b')](_0x21c658);};}exports['index']=function(_0x581bae,_0x44b967){var _0x378bf6={},_0x1da3e2={},_0x552065={'count':0x0,'rows':[]};var _0x43cfba=_[_0xa6d4('0x2c')](db[_0xa6d4('0x2d')][_0xa6d4('0x2e')],function(_0x59cff9){return{'name':_0x59cff9['fieldName'],'type':_0x59cff9['type'][_0xa6d4('0x2f')]};});_0x1da3e2[_0xa6d4('0x30')]=_[_0xa6d4('0x2c')](_0x43cfba,_0xa6d4('0x2a'));_0x1da3e2[_0xa6d4('0x31')]=_[_0xa6d4('0x32')](_0x581bae[_0xa6d4('0x31')]);_0x1da3e2['filters']=_['intersection'](_0x1da3e2[_0xa6d4('0x30')],_0x1da3e2[_0xa6d4('0x31')]);_0x378bf6[_0xa6d4('0x33')]=_[_0xa6d4('0x34')](_0x1da3e2[_0xa6d4('0x30')],qs[_0xa6d4('0x35')](_0x581bae[_0xa6d4('0x31')][_0xa6d4('0x35')]));_0x378bf6[_0xa6d4('0x33')]=_0x378bf6['attributes'][_0xa6d4('0x36')]?_0x378bf6['attributes']:_0x1da3e2[_0xa6d4('0x30')];if(!_0x581bae[_0xa6d4('0x31')][_0xa6d4('0x37')](_0xa6d4('0x38'))){_0x378bf6[_0xa6d4('0x20')]=qs[_0xa6d4('0x20')](_0x581bae[_0xa6d4('0x31')]['limit']);_0x378bf6['offset']=qs[_0xa6d4('0x1f')](_0x581bae[_0xa6d4('0x31')]['offset']);}_0x378bf6[_0xa6d4('0x39')]=qs['sort'](_0x581bae[_0xa6d4('0x31')][_0xa6d4('0x3a')]);_0x378bf6['where']=qs['filters'](_[_0xa6d4('0x3b')](_0x581bae[_0xa6d4('0x31')],_0x1da3e2['filters']),_0x43cfba);if(_0x581bae[_0xa6d4('0x31')][_0xa6d4('0x3c')]){_0x378bf6[_0xa6d4('0x3d')]=_[_0xa6d4('0x3e')](_0x378bf6[_0xa6d4('0x3d')],{'$or':_[_0xa6d4('0x2c')](_0x43cfba,function(_0x3cde60){if(_0x3cde60['type']!==_0xa6d4('0x3f')){var _0x17793d={};_0x17793d[_0x3cde60['name']]={'$like':'%'+_0x581bae[_0xa6d4('0x31')][_0xa6d4('0x3c')]+'%'};return _0x17793d;}})});}_0x378bf6=_['merge']({},_0x378bf6,_0x581bae[_0xa6d4('0x40')]);var _0x5480ea={'where':_0x378bf6['where']};return db[_0xa6d4('0x2d')][_0xa6d4('0x21')](_0x5480ea)[_0xa6d4('0x27')](function(_0x1ee3ce){_0x552065[_0xa6d4('0x21')]=_0x1ee3ce;if(_0x581bae[_0xa6d4('0x31')][_0xa6d4('0x41')]){_0x378bf6[_0xa6d4('0x42')]=[{'all':!![]}];}return db[_0xa6d4('0x2d')][_0xa6d4('0x43')](_0x378bf6);})['then'](function(_0x5c2eb9){_0x552065[_0xa6d4('0x44')]=_0x5c2eb9;return _0x552065;})['then'](respondWithFilteredResult(_0x44b967,_0x378bf6))[_0xa6d4('0x45')](handleError(_0x44b967,null));};exports[_0xa6d4('0x46')]=function(_0x5de6cd,_0xfeab4d){var _0x4938ed={'raw':![],'where':{'id':_0x5de6cd[_0xa6d4('0x47')]['id']}},_0x4f4b10={};_0x4f4b10[_0xa6d4('0x30')]=_[_0xa6d4('0x32')](db[_0xa6d4('0x2d')]['rawAttributes']);_0x4f4b10['query']=_[_0xa6d4('0x32')](_0x5de6cd['query']);_0x4f4b10[_0xa6d4('0x48')]=_[_0xa6d4('0x34')](_0x4f4b10[_0xa6d4('0x30')],_0x4f4b10[_0xa6d4('0x31')]);_0x4938ed[_0xa6d4('0x33')]=_[_0xa6d4('0x34')](_0x4f4b10[_0xa6d4('0x30')],qs[_0xa6d4('0x35')](_0x5de6cd[_0xa6d4('0x31')][_0xa6d4('0x35')]));_0x4938ed[_0xa6d4('0x33')]=_0x4938ed['attributes'][_0xa6d4('0x36')]?_0x4938ed['attributes']:_0x4f4b10[_0xa6d4('0x30')];if(_0x5de6cd[_0xa6d4('0x31')][_0xa6d4('0x41')]){_0x4938ed['include']=[{'all':!![]}];}_0x4938ed=_[_0xa6d4('0x3e')]({},_0x4938ed,_0x5de6cd[_0xa6d4('0x40')]);return db['FreshdeskAccount'][_0xa6d4('0x49')](_0x4938ed)[_0xa6d4('0x27')](handleEntityNotFound(_0xfeab4d,null))[_0xa6d4('0x27')](respondWithResult(_0xfeab4d,null))[_0xa6d4('0x45')](handleError(_0xfeab4d,null));};exports[_0xa6d4('0x4a')]=function(_0x2b18dc,_0x3c1567){return db[_0xa6d4('0x2d')][_0xa6d4('0x4a')](_0x2b18dc[_0xa6d4('0x4b')],{})[_0xa6d4('0x27')](respondWithResult(_0x3c1567,0xc9))[_0xa6d4('0x45')](handleError(_0x3c1567,null));};exports[_0xa6d4('0x26')]=function(_0x3043cc,_0x20e1e7){if(_0x3043cc[_0xa6d4('0x4b')]['id']){delete _0x3043cc[_0xa6d4('0x4b')]['id'];}return db['FreshdeskAccount'][_0xa6d4('0x49')]({'where':{'id':_0x3043cc[_0xa6d4('0x47')]['id']}})[_0xa6d4('0x27')](handleEntityNotFound(_0x20e1e7,null))[_0xa6d4('0x27')](saveUpdates(_0x3043cc[_0xa6d4('0x4b')],null))['then'](respondWithResult(_0x20e1e7,null))[_0xa6d4('0x45')](handleError(_0x20e1e7,null));};exports[_0xa6d4('0x28')]=function(_0x1e586a,_0xea08e0){return db[_0xa6d4('0x2d')][_0xa6d4('0x49')]({'where':{'id':_0x1e586a['params']['id']}})['then'](handleEntityNotFound(_0xea08e0,null))[_0xa6d4('0x27')](removeEntity(_0xea08e0,null))[_0xa6d4('0x45')](handleError(_0xea08e0,null));};exports[_0xa6d4('0x4c')]=function(_0x12a240,_0xb32887,_0x241df1){var _0x3b2fd7={};var _0x3e0aae={};var _0x53d954;var _0x2227a4;return db[_0xa6d4('0x2d')][_0xa6d4('0x4d')]({'where':{'id':_0x12a240['params']['id']}})['then'](handleEntityNotFound(_0xb32887,null))[_0xa6d4('0x27')](function(_0x2865b6){if(_0x2865b6){_0x53d954=_0x2865b6;_0x3e0aae['model']=_[_0xa6d4('0x32')](db[_0xa6d4('0x4e')][_0xa6d4('0x2e')]);_0x3e0aae['query']=_[_0xa6d4('0x32')](_0x12a240[_0xa6d4('0x31')]);_0x3e0aae[_0xa6d4('0x48')]=_[_0xa6d4('0x34')](_0x3e0aae[_0xa6d4('0x30')],_0x3e0aae['query']);_0x3b2fd7[_0xa6d4('0x33')]=_[_0xa6d4('0x34')](_0x3e0aae[_0xa6d4('0x30')],qs[_0xa6d4('0x35')](_0x12a240['query'][_0xa6d4('0x35')]));_0x3b2fd7['attributes']=_0x3b2fd7['attributes'][_0xa6d4('0x36')]?_0x3b2fd7['attributes']:_0x3e0aae[_0xa6d4('0x30')];_0x3b2fd7[_0xa6d4('0x39')]=qs[_0xa6d4('0x3a')](_0x12a240[_0xa6d4('0x31')][_0xa6d4('0x3a')]);_0x3b2fd7[_0xa6d4('0x3d')]=qs[_0xa6d4('0x48')](_[_0xa6d4('0x3b')](_0x12a240[_0xa6d4('0x31')],_0x3e0aae['filters']));if(_0x12a240['query'][_0xa6d4('0x3c')]){_0x3b2fd7[_0xa6d4('0x3d')]=_[_0xa6d4('0x3e')](_0x3b2fd7['where'],{'$or':_[_0xa6d4('0x2c')](_0x3b2fd7[_0xa6d4('0x33')],function(_0x269c0e){var _0x11ca8f={};_0x11ca8f[_0x269c0e]={'$like':'%'+_0x12a240[_0xa6d4('0x31')][_0xa6d4('0x3c')]+'%'};return _0x11ca8f;})});}_0x3b2fd7=_[_0xa6d4('0x3e')]({},_0x3b2fd7,_0x12a240[_0xa6d4('0x40')]);return _0x53d954[_0xa6d4('0x4c')](_0x3b2fd7);}})[_0xa6d4('0x27')](function(_0x191a1c){if(_0x191a1c){_0x2227a4=_0x191a1c[_0xa6d4('0x36')];if(!_0x12a240[_0xa6d4('0x31')]['hasOwnProperty'](_0xa6d4('0x38'))){_0x3b2fd7[_0xa6d4('0x20')]=qs[_0xa6d4('0x20')](_0x12a240[_0xa6d4('0x31')][_0xa6d4('0x20')]);_0x3b2fd7[_0xa6d4('0x1f')]=qs[_0xa6d4('0x1f')](_0x12a240['query'][_0xa6d4('0x1f')]);}return _0x53d954[_0xa6d4('0x4c')](_0x3b2fd7);}})[_0xa6d4('0x27')](function(_0x48beff){if(_0x48beff){return _0x48beff?{'count':_0x2227a4,'rows':_0x48beff}:null;}})[_0xa6d4('0x27')](respondWithResult(_0xb32887,null))[_0xa6d4('0x45')](handleError(_0xb32887,null));};exports[_0xa6d4('0x4f')]=function(_0x526273,_0x1726f0,_0x5783dd){if(_0x526273['body']['id']){delete _0x526273[_0xa6d4('0x4b')]['id'];}return db[_0xa6d4('0x2d')][_0xa6d4('0x4d')]({'where':{'id':_0x526273[_0xa6d4('0x47')]['id']}})[_0xa6d4('0x27')](handleEntityNotFound(_0x1726f0,null))[_0xa6d4('0x27')](function(_0x292499){if(_0x292499){_0x526273['body']['AccountId']=_0x292499['id'];_0x526273[_0xa6d4('0x4b')][_0xa6d4('0x50')]=integrations[_0xa6d4('0x51')](_0x526273[_0xa6d4('0x4b')][_0xa6d4('0x52')],_0x526273['body'][_0xa6d4('0x53')]);_0x526273['body'][_0xa6d4('0x54')]=integrations[_0xa6d4('0x55')](_0x526273['body'][_0xa6d4('0x52')],_0x526273[_0xa6d4('0x4b')][_0xa6d4('0x53')]);return db[_0xa6d4('0x4e')]['create'](_0x526273[_0xa6d4('0x4b')],{'include':[{'model':db[_0xa6d4('0x56')],'as':_0xa6d4('0x50')},{'model':db['FreshdeskField'],'as':_0xa6d4('0x54')}]});}return null;})['then'](respondWithResult(_0x1726f0,null))[_0xa6d4('0x45')](handleError(_0x1726f0,null));};exports[_0xa6d4('0x57')]=function(_0x26fdd1,_0xd62dac,_0x4aae4e){var _0x241e32='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x26fdd1['params']['id']},'attributes':['id','remoteUri',_0xa6d4('0x58')]})[_0xa6d4('0x27')](handleEntityNotFound(_0xd62dac,null))[_0xa6d4('0x27')](function(_0x20e67e){if(_0x20e67e){_0x241e32=_0x20e67e[_0xa6d4('0x59')];var _0x4bbf2c=_0x241e32[_0xa6d4('0x5a')](-0x1);if(_0x4bbf2c==='/'){_0x241e32=_0x241e32[_0xa6d4('0x5b')](0x0,_0x241e32[_0xa6d4('0x5c')](_0x4bbf2c));}return rp({'method':_0xa6d4('0x5d'),'uri':util['format'](_0xa6d4('0x5e'),_0x241e32,_0xa6d4('0x5f')),'headers':{'Authorization':util[_0xa6d4('0x60')](_0xa6d4('0x61'),new Buffer(util[_0xa6d4('0x60')](_0xa6d4('0x62'),_0x20e67e[_0xa6d4('0x58')]))['toString'](_0xa6d4('0x63')))},'json':!![]});}})['then'](function(_0x47ef3e){if(_0x47ef3e){var _0x20c9ee=[_0xa6d4('0x64'),'subject',_0xa6d4('0x65'),'description',_0xa6d4('0x1c'),_0xa6d4('0x66'),'group',_0xa6d4('0x67'),_0xa6d4('0x68'),_0xa6d4('0x69'),_0xa6d4('0x6a')];_['remove'](_0x47ef3e,function(_0x262219){return _0x20c9ee[_0xa6d4('0x6b')](_0x262219[_0xa6d4('0x2a')])||!_0x262219[_0xa6d4('0x6c')]&&_0x262219[_0xa6d4('0x53')]!==_0xa6d4('0x6d')&&_0x262219[_0xa6d4('0x53')]!=='custom_dropdown';});return{'count':_0x47ef3e[_0xa6d4('0x36')],'rows':_['map'](_0x47ef3e,function(_0x26d393){return{'id':_0x26d393['name'],'name':_0x26d393[_0xa6d4('0x6e')],'custom':!_0x26d393[_0xa6d4('0x6c')],'options':_0x26d393[_0xa6d4('0x6f')]?_['map'](_0x26d393[_0xa6d4('0x6f')],function(_0x2ff9cd){return{'name':_[_0xa6d4('0x70')](_0x2ff9cd),'value':_0x2ff9cd};}):[]};})};}})[_0xa6d4('0x27')](respondWithResult(_0xd62dac,null))[_0xa6d4('0x45')](function(_0x191ca0){var _0x51c27a=_0x26fdd1['query']['test']?0x1f4:_0x191ca0[_0xa6d4('0x71')]||0x1f4;logger[_0xa6d4('0x72')](_0xa6d4('0x73'),_0xa6d4('0x57'),_0x51c27a,JSON[_0xa6d4('0x74')](_0x191ca0));delete _0x191ca0['name'];if(_0x51c27a===0x191){_0x51c27a=0x190;}_0xd62dac[_0xa6d4('0x1c')](_0x51c27a)['send'](_0x26fdd1[_0xa6d4('0x31')][_0xa6d4('0x75')]?{'message':_0xa6d4('0x76'),'statusCode':_0x191ca0[_0xa6d4('0x71')]}:_0x191ca0);});}; \ No newline at end of file +var _0x34b7=['catch','show','includeAll','create','body','find','getConfigurations','findOne','params','FreshdeskConfiguration','length','order','options','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','group','source','ticket_type','company','includes','default','custom_text','label','choices','capitalize','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','include','rows'];(function(_0x570f07,_0x5ceae2){var _0x286e02=function(_0x5b8bb5){while(--_0x5b8bb5){_0x570f07['push'](_0x570f07['shift']());}};_0x286e02(++_0x5ceae2);}(_0x34b7,0x196));var _0x734b=function(_0x1789bc,_0x1acf84){_0x1789bc=_0x1789bc-0x0;var _0x35efd1=_0x34b7[_0x1789bc];return _0x35efd1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];var integrations=require(_0x734b('0x18'));function respondWithStatusCode(_0x189a82,_0xff9ddf){_0xff9ddf=_0xff9ddf||0xcc;return function(_0x145ec3){if(_0x145ec3){return _0x189a82[_0x734b('0x19')](_0xff9ddf);}return _0x189a82['status'](_0xff9ddf)[_0x734b('0x1a')]();};}function respondWithResult(_0x252510,_0x47791c){_0x47791c=_0x47791c||0xc8;return function(_0xd1ab2a){if(_0xd1ab2a){return _0x252510[_0x734b('0x1b')](_0x47791c)[_0x734b('0x1c')](_0xd1ab2a);}};}function respondWithFilteredResult(_0x2372bd,_0x2c03bd){return function(_0xa6d111){if(_0xa6d111){var _0x4b8c63=typeof _0x2c03bd[_0x734b('0x1d')]==='undefined'&&typeof _0x2c03bd[_0x734b('0x1e')]===_0x734b('0x1f');var _0xfb661a=_0xa6d111[_0x734b('0x20')];var _0x4d3b9c=_0x4b8c63?0x0:_0x2c03bd['offset'];var _0xcd12a1=_0x4b8c63?_0xa6d111[_0x734b('0x20')]:_0x2c03bd[_0x734b('0x1d')]+_0x2c03bd[_0x734b('0x1e')];var _0x1c605c;if(_0xcd12a1>=_0xfb661a){_0xcd12a1=_0xfb661a;_0x1c605c=0xc8;}else{_0x1c605c=0xce;}_0x2372bd[_0x734b('0x1b')](_0x1c605c);return _0x2372bd[_0x734b('0x21')](_0x734b('0x22'),_0x4d3b9c+'-'+_0xcd12a1+'/'+_0xfb661a)[_0x734b('0x1c')](_0xa6d111);}return null;};}function patchUpdates(_0x1d2b27){return function(_0x7060f8){try{jsonpatch[_0x734b('0x23')](_0x7060f8,_0x1d2b27,!![]);}catch(_0x477d6d){return BPromise[_0x734b('0x24')](_0x477d6d);}return _0x7060f8['save']();};}function saveUpdates(_0x1e4dcc,_0x7856d7){return function(_0x4f98a7){if(_0x4f98a7){return _0x4f98a7[_0x734b('0x25')](_0x1e4dcc)[_0x734b('0x26')](function(_0x1a7908){return _0x1a7908;});}return null;};}function removeEntity(_0x11fb8e,_0x46d432){return function(_0x26d118){if(_0x26d118){return _0x26d118[_0x734b('0x27')]()[_0x734b('0x26')](function(){_0x11fb8e[_0x734b('0x1b')](0xcc)[_0x734b('0x1a')]();});}};}function handleEntityNotFound(_0x44ffa9,_0x148abe){return function(_0x3bb651){if(!_0x3bb651){_0x44ffa9['sendStatus'](0x194);}return _0x3bb651;};}function handleError(_0x49732b,_0x13cc5a){_0x13cc5a=_0x13cc5a||0x1f4;return function(_0x3680a0){logger['error'](_0x3680a0[_0x734b('0x28')]);if(_0x3680a0[_0x734b('0x29')]){delete _0x3680a0[_0x734b('0x29')];}_0x49732b[_0x734b('0x1b')](_0x13cc5a)[_0x734b('0x2a')](_0x3680a0);};}exports[_0x734b('0x2b')]=function(_0x3ba39c,_0x5c6c5d){var _0x1f3652={},_0x436efe={},_0x42e9ae={'count':0x0,'rows':[]};var _0x241c89=_[_0x734b('0x2c')](db[_0x734b('0x2d')][_0x734b('0x2e')],function(_0x21ed3c){return{'name':_0x21ed3c[_0x734b('0x2f')],'type':_0x21ed3c[_0x734b('0x30')]['key']};});_0x436efe[_0x734b('0x31')]=_[_0x734b('0x2c')](_0x241c89,'name');_0x436efe[_0x734b('0x32')]=_[_0x734b('0x33')](_0x3ba39c[_0x734b('0x32')]);_0x436efe[_0x734b('0x34')]=_[_0x734b('0x35')](_0x436efe[_0x734b('0x31')],_0x436efe[_0x734b('0x32')]);_0x1f3652[_0x734b('0x36')]=_[_0x734b('0x35')](_0x436efe[_0x734b('0x31')],qs[_0x734b('0x37')](_0x3ba39c[_0x734b('0x32')][_0x734b('0x37')]));_0x1f3652[_0x734b('0x36')]=_0x1f3652[_0x734b('0x36')]['length']?_0x1f3652[_0x734b('0x36')]:_0x436efe['model'];if(!_0x3ba39c[_0x734b('0x32')][_0x734b('0x38')](_0x734b('0x39'))){_0x1f3652[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x3ba39c[_0x734b('0x32')]['limit']);_0x1f3652['offset']=qs[_0x734b('0x1d')](_0x3ba39c['query'][_0x734b('0x1d')]);}_0x1f3652['order']=qs[_0x734b('0x3a')](_0x3ba39c['query'][_0x734b('0x3a')]);_0x1f3652['where']=qs[_0x734b('0x34')](_[_0x734b('0x3b')](_0x3ba39c[_0x734b('0x32')],_0x436efe[_0x734b('0x34')]),_0x241c89);if(_0x3ba39c[_0x734b('0x32')][_0x734b('0x3c')]){_0x1f3652[_0x734b('0x3d')]=_['merge'](_0x1f3652[_0x734b('0x3d')],{'$or':_[_0x734b('0x2c')](_0x241c89,function(_0x58db39){if(_0x58db39[_0x734b('0x30')]!==_0x734b('0x3e')){var _0x2bb422={};_0x2bb422[_0x58db39[_0x734b('0x29')]]={'$like':'%'+_0x3ba39c['query'][_0x734b('0x3c')]+'%'};return _0x2bb422;}})});}_0x1f3652=_[_0x734b('0x3f')]({},_0x1f3652,_0x3ba39c['options']);var _0x40674c={'where':_0x1f3652[_0x734b('0x3d')]};return db['FreshdeskAccount'][_0x734b('0x20')](_0x40674c)[_0x734b('0x26')](function(_0x2820f9){_0x42e9ae[_0x734b('0x20')]=_0x2820f9;if(_0x3ba39c['query']['includeAll']){_0x1f3652[_0x734b('0x40')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x1f3652);})[_0x734b('0x26')](function(_0x50bde2){_0x42e9ae[_0x734b('0x41')]=_0x50bde2;return _0x42e9ae;})['then'](respondWithFilteredResult(_0x5c6c5d,_0x1f3652))[_0x734b('0x42')](handleError(_0x5c6c5d,null));};exports[_0x734b('0x43')]=function(_0xe4fe38,_0x4c3fdc){var _0x5cf3a0={'raw':![],'where':{'id':_0xe4fe38['params']['id']}},_0x2e1aa8={};_0x2e1aa8['model']=_[_0x734b('0x33')](db[_0x734b('0x2d')]['rawAttributes']);_0x2e1aa8[_0x734b('0x32')]=_['keys'](_0xe4fe38[_0x734b('0x32')]);_0x2e1aa8[_0x734b('0x34')]=_[_0x734b('0x35')](_0x2e1aa8['model'],_0x2e1aa8[_0x734b('0x32')]);_0x5cf3a0[_0x734b('0x36')]=_[_0x734b('0x35')](_0x2e1aa8[_0x734b('0x31')],qs['fields'](_0xe4fe38['query']['fields']));_0x5cf3a0[_0x734b('0x36')]=_0x5cf3a0['attributes']['length']?_0x5cf3a0[_0x734b('0x36')]:_0x2e1aa8['model'];if(_0xe4fe38[_0x734b('0x32')][_0x734b('0x44')]){_0x5cf3a0[_0x734b('0x40')]=[{'all':!![]}];}_0x5cf3a0=_[_0x734b('0x3f')]({},_0x5cf3a0,_0xe4fe38['options']);return db[_0x734b('0x2d')]['find'](_0x5cf3a0)[_0x734b('0x26')](handleEntityNotFound(_0x4c3fdc,null))[_0x734b('0x26')](respondWithResult(_0x4c3fdc,null))[_0x734b('0x42')](handleError(_0x4c3fdc,null));};exports['create']=function(_0x370326,_0x4c3efb){return db[_0x734b('0x2d')][_0x734b('0x45')](_0x370326['body'],{})[_0x734b('0x26')](respondWithResult(_0x4c3efb,0xc9))[_0x734b('0x42')](handleError(_0x4c3efb,null));};exports[_0x734b('0x25')]=function(_0x38125a,_0x21e127){if(_0x38125a['body']['id']){delete _0x38125a[_0x734b('0x46')]['id'];}return db['FreshdeskAccount'][_0x734b('0x47')]({'where':{'id':_0x38125a['params']['id']}})[_0x734b('0x26')](handleEntityNotFound(_0x21e127,null))[_0x734b('0x26')](saveUpdates(_0x38125a[_0x734b('0x46')],null))[_0x734b('0x26')](respondWithResult(_0x21e127,null))[_0x734b('0x42')](handleError(_0x21e127,null));};exports['destroy']=function(_0x4c0378,_0x484156){return db[_0x734b('0x2d')][_0x734b('0x47')]({'where':{'id':_0x4c0378['params']['id']}})[_0x734b('0x26')](handleEntityNotFound(_0x484156,null))[_0x734b('0x26')](removeEntity(_0x484156,null))['catch'](handleError(_0x484156,null));};exports[_0x734b('0x48')]=function(_0x3a9749,_0x44e6d2,_0x4d6501){var _0x2e95aa={};var _0x226f6c={};var _0x423b22;var _0xe605be;return db['FreshdeskAccount'][_0x734b('0x49')]({'where':{'id':_0x3a9749[_0x734b('0x4a')]['id']}})[_0x734b('0x26')](handleEntityNotFound(_0x44e6d2,null))[_0x734b('0x26')](function(_0x4b65bf){if(_0x4b65bf){_0x423b22=_0x4b65bf;_0x226f6c[_0x734b('0x31')]=_['keys'](db[_0x734b('0x4b')][_0x734b('0x2e')]);_0x226f6c[_0x734b('0x32')]=_[_0x734b('0x33')](_0x3a9749['query']);_0x226f6c[_0x734b('0x34')]=_[_0x734b('0x35')](_0x226f6c['model'],_0x226f6c['query']);_0x2e95aa[_0x734b('0x36')]=_['intersection'](_0x226f6c[_0x734b('0x31')],qs[_0x734b('0x37')](_0x3a9749[_0x734b('0x32')]['fields']));_0x2e95aa[_0x734b('0x36')]=_0x2e95aa['attributes'][_0x734b('0x4c')]?_0x2e95aa[_0x734b('0x36')]:_0x226f6c[_0x734b('0x31')];_0x2e95aa[_0x734b('0x4d')]=qs['sort'](_0x3a9749[_0x734b('0x32')]['sort']);_0x2e95aa[_0x734b('0x3d')]=qs[_0x734b('0x34')](_[_0x734b('0x3b')](_0x3a9749['query'],_0x226f6c[_0x734b('0x34')]));if(_0x3a9749['query'][_0x734b('0x3c')]){_0x2e95aa[_0x734b('0x3d')]=_[_0x734b('0x3f')](_0x2e95aa[_0x734b('0x3d')],{'$or':_['map'](_0x2e95aa[_0x734b('0x36')],function(_0x48c613){var _0x44e876={};_0x44e876[_0x48c613]={'$like':'%'+_0x3a9749[_0x734b('0x32')][_0x734b('0x3c')]+'%'};return _0x44e876;})});}_0x2e95aa=_['merge']({},_0x2e95aa,_0x3a9749[_0x734b('0x4e')]);return _0x423b22[_0x734b('0x48')](_0x2e95aa);}})[_0x734b('0x26')](function(_0x3b16bb){if(_0x3b16bb){_0xe605be=_0x3b16bb[_0x734b('0x4c')];if(!_0x3a9749[_0x734b('0x32')][_0x734b('0x38')]('nolimit')){_0x2e95aa[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x3a9749[_0x734b('0x32')]['limit']);_0x2e95aa['offset']=qs[_0x734b('0x1d')](_0x3a9749[_0x734b('0x32')][_0x734b('0x1d')]);}return _0x423b22[_0x734b('0x48')](_0x2e95aa);}})['then'](function(_0x565a2e){if(_0x565a2e){return _0x565a2e?{'count':_0xe605be,'rows':_0x565a2e}:null;}})['then'](respondWithResult(_0x44e6d2,null))[_0x734b('0x42')](handleError(_0x44e6d2,null));};exports[_0x734b('0x4f')]=function(_0x1f9cfe,_0x292c68,_0x1b57c5){if(_0x1f9cfe[_0x734b('0x46')]['id']){delete _0x1f9cfe[_0x734b('0x46')]['id'];}return db[_0x734b('0x2d')][_0x734b('0x49')]({'where':{'id':_0x1f9cfe[_0x734b('0x4a')]['id']}})[_0x734b('0x26')](handleEntityNotFound(_0x292c68,null))[_0x734b('0x26')](function(_0x43951a){if(_0x43951a){_0x1f9cfe[_0x734b('0x46')][_0x734b('0x50')]=_0x43951a['id'];_0x1f9cfe[_0x734b('0x46')][_0x734b('0x51')]=integrations[_0x734b('0x52')](_0x1f9cfe[_0x734b('0x46')][_0x734b('0x53')],_0x1f9cfe[_0x734b('0x46')]['type']);_0x1f9cfe[_0x734b('0x46')][_0x734b('0x54')]=integrations[_0x734b('0x55')](_0x1f9cfe[_0x734b('0x46')][_0x734b('0x53')],_0x1f9cfe['body'][_0x734b('0x30')]);return db[_0x734b('0x4b')][_0x734b('0x45')](_0x1f9cfe[_0x734b('0x46')],{'include':[{'model':db[_0x734b('0x56')],'as':_0x734b('0x51')},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x292c68,null))['catch'](handleError(_0x292c68,null));};exports['getFields']=function(_0x3ce4bc,_0x30ffea,_0x16c9d2){var _0xb23b61='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x3ce4bc[_0x734b('0x4a')]['id']},'attributes':['id',_0x734b('0x57'),_0x734b('0x58')]})[_0x734b('0x26')](handleEntityNotFound(_0x30ffea,null))['then'](function(_0x3b364c){if(_0x3b364c){_0xb23b61=_0x3b364c[_0x734b('0x57')];var _0x200f2d=_0xb23b61[_0x734b('0x59')](-0x1);if(_0x200f2d==='/'){_0xb23b61=_0xb23b61['substring'](0x0,_0xb23b61[_0x734b('0x5a')](_0x200f2d));}return rp({'method':'GET','uri':util[_0x734b('0x5b')](_0x734b('0x5c'),_0xb23b61,_0x734b('0x5d')),'headers':{'Authorization':util[_0x734b('0x5b')](_0x734b('0x5e'),new Buffer(util['format'](_0x734b('0x5f'),_0x3b364c[_0x734b('0x58')]))[_0x734b('0x60')](_0x734b('0x61')))},'json':!![]});}})[_0x734b('0x26')](function(_0x599ed1){if(_0x599ed1){var _0x475ecd=[_0x734b('0x62'),_0x734b('0x63'),_0x734b('0x64'),'description',_0x734b('0x1b'),_0x734b('0x65'),_0x734b('0x66'),_0x734b('0x67'),_0x734b('0x68'),'group',_0x734b('0x69')];_['remove'](_0x599ed1,function(_0x460868){return _0x475ecd[_0x734b('0x6a')](_0x460868[_0x734b('0x29')])||!_0x460868[_0x734b('0x6b')]&&_0x460868[_0x734b('0x30')]!==_0x734b('0x6c')&&_0x460868['type']!=='custom_dropdown';});return{'count':_0x599ed1['length'],'rows':_[_0x734b('0x2c')](_0x599ed1,function(_0x540ce8){return{'id':_0x540ce8[_0x734b('0x29')],'name':_0x540ce8[_0x734b('0x6d')],'custom':!_0x540ce8['default'],'options':_0x540ce8[_0x734b('0x6e')]?_[_0x734b('0x2c')](_0x540ce8[_0x734b('0x6e')],function(_0x2a3c8d){return{'name':_[_0x734b('0x6f')](_0x2a3c8d),'value':_0x2a3c8d};}):[]};})};}})[_0x734b('0x26')](respondWithResult(_0x30ffea,null))[_0x734b('0x42')](function(_0x45f05b){var _0x408625=_0x3ce4bc[_0x734b('0x32')]['test']?0x1f4:_0x45f05b[_0x734b('0x70')]||0x1f4;logger[_0x734b('0x71')](_0x734b('0x72'),'getFields',_0x408625,JSON[_0x734b('0x73')](_0x45f05b));delete _0x45f05b[_0x734b('0x29')];if(_0x408625===0x191){_0x408625=0x190;}_0x30ffea[_0x734b('0x1b')](_0x408625)[_0x734b('0x2a')](_0x3ce4bc[_0x734b('0x32')][_0x734b('0x74')]?{'message':_0x734b('0x75'),'statusCode':_0x45f05b[_0x734b('0x70')]}:_0x45f05b);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index ce67a39..d92058c 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 _0x1a61=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2cd538,_0x17f3a1){var _0x895dfd=function(_0x40fdbd){while(--_0x40fdbd){_0x2cd538['push'](_0x2cd538['shift']());}};_0x895dfd(++_0x17f3a1);}(_0x1a61,0x1cd));var _0x11a6=function(_0x251721,_0x22524a){_0x251721=_0x251721-0x0;var _0x27b2b4=_0x1a61[_0x251721];return _0x27b2b4;};'use strict';var _=require('lodash');var util=require(_0x11a6('0x0'));var logger=require('../../config/logger')(_0x11a6('0x1'));var moment=require(_0x11a6('0x2'));var BPromise=require(_0x11a6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x11a6('0x4'));var rimraf=require(_0x11a6('0x5'));var config=require(_0x11a6('0x6'));var attributes=require(_0x11a6('0x7'));var integrations=require(_0x11a6('0x8'));module[_0x11a6('0x9')]=function(_0x3634ad,_0x5419c5){return _0x3634ad['define'](_0x11a6('0xa'),attributes,{'tableName':_0x11a6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fb1=['../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','util','api','bluebird','request-promise','path'];(function(_0x4f9d3e,_0x4206bc){var _0x393612=function(_0x38f666){while(--_0x38f666){_0x4f9d3e['push'](_0x4f9d3e['shift']());}};_0x393612(++_0x4206bc);}(_0x8fb1,0x19d));var _0x18fb=function(_0x255f5f,_0x120a85){_0x255f5f=_0x255f5f-0x0;var _0x1982ec=_0x8fb1[_0x255f5f];return _0x1982ec;};'use strict';var _=require('lodash');var util=require(_0x18fb('0x0'));var logger=require('../../config/logger')(_0x18fb('0x1'));var moment=require('moment');var BPromise=require(_0x18fb('0x2'));var rp=require(_0x18fb('0x3'));var fs=require('fs');var path=require(_0x18fb('0x4'));var rimraf=require('rimraf');var config=require(_0x18fb('0x5'));var attributes=require(_0x18fb('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x18fb('0x7')]=function(_0x1fedb4,_0x621fb6){return _0x1fedb4[_0x18fb('0x8')](_0x18fb('0x9'),attributes,{'tableName':_0x18fb('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 293f2cf..8b790be 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 _0x9e29=['FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowFreshdeskAccount','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3bf02a,_0x4ba8ee){var _0x2cd462=function(_0x2dccc6){while(--_0x2dccc6){_0x3bf02a['push'](_0x3bf02a['shift']());}};_0x2cd462(++_0x4ba8ee);}(_0x9e29,0xf4));var _0x99e2=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x9e29[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0x99e2('0x0'));var util=require(_0x99e2('0x1'));var moment=require(_0x99e2('0x2'));var BPromise=require(_0x99e2('0x3'));var rs=require(_0x99e2('0x4'));var fs=require('fs');var Redis=require(_0x99e2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x99e2('0x6'))(_0x99e2('0x7'));var config=require(_0x99e2('0x8'));var jayson=require(_0x99e2('0x9'));var client=jayson[_0x99e2('0xa')][_0x99e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19021d,_0x23e357,_0x14d341){return new BPromise(function(_0x44c8fc,_0x10b445){return client[_0x99e2('0xc')](_0x19021d,_0x14d341)[_0x99e2('0xd')](function(_0x107d20){logger[_0x99e2('0xe')](_0x99e2('0xf'),_0x23e357,'request\x20sent');logger[_0x99e2('0x10')](_0x99e2('0x11'),_0x23e357,_0x99e2('0x12'),JSON['stringify'](_0x107d20));if(_0x107d20['error']){if(_0x107d20[_0x99e2('0x13')][_0x99e2('0x14')]===0x1f4){logger[_0x99e2('0x13')](_0x99e2('0xf'),_0x23e357,_0x107d20[_0x99e2('0x13')]['message']);return _0x10b445(_0x107d20['error'][_0x99e2('0x15')]);}logger[_0x99e2('0x13')](_0x99e2('0xf'),_0x23e357,_0x107d20['error']['message']);return _0x44c8fc(_0x107d20[_0x99e2('0x13')]['message']);}else{logger['info'](_0x99e2('0xf'),_0x23e357,'request\x20sent');_0x44c8fc(_0x107d20['result'][_0x99e2('0x15')]);}})[_0x99e2('0x16')](function(_0x16b8ed){logger[_0x99e2('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x23e357,_0x16b8ed);_0x10b445(_0x16b8ed);});});}exports[_0x99e2('0x17')]=function(_0x4f1cad){var _0x20e5aa=this;return new Promise(function(_0x169b9d,_0x43bec5){return db[_0x99e2('0x18')][_0x99e2('0x19')]({'raw':_0x4f1cad[_0x99e2('0x1a')]?_0x4f1cad[_0x99e2('0x1a')][_0x99e2('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f1cad[_0x99e2('0x1a')]?_0x4f1cad[_0x99e2('0x1a')][_0x99e2('0x1c')]||null:null,'attributes':_0x4f1cad[_0x99e2('0x1a')]?_0x4f1cad[_0x99e2('0x1a')]['attributes']||null:null,'limit':_0x4f1cad[_0x99e2('0x1a')]?_0x4f1cad[_0x99e2('0x1a')][_0x99e2('0x1d')]||null:null,'include':_0x4f1cad['options']?_0x4f1cad[_0x99e2('0x1a')][_0x99e2('0x1e')]?_[_0x99e2('0x1f')](_0x4f1cad['options'][_0x99e2('0x1e')],function(_0x1b8326){return{'model':db[_0x1b8326[_0x99e2('0x20')]],'as':_0x1b8326['as'],'attributes':_0x1b8326[_0x99e2('0x21')],'include':_0x1b8326[_0x99e2('0x1e')]?_[_0x99e2('0x1f')](_0x1b8326[_0x99e2('0x1e')],function(_0x502249){return{'model':db[_0x502249[_0x99e2('0x20')]],'as':_0x502249['as'],'attributes':_0x502249[_0x99e2('0x21')],'include':_0x502249['include']?_[_0x99e2('0x1f')](_0x502249[_0x99e2('0x1e')],function(_0x1c6e78){return{'model':db[_0x1c6e78['model']],'as':_0x1c6e78['as'],'attributes':_0x1c6e78['attributes']};}):[]};}):[]};}):[]:[]})[_0x99e2('0xd')](function(_0xd846f4){logger[_0x99e2('0xe')](_0x99e2('0x17'),_0x4f1cad);logger[_0x99e2('0x10')]('GetFreshdeskAccount',_0x4f1cad,JSON['stringify'](_0xd846f4));_0x169b9d(_0xd846f4);})[_0x99e2('0x16')](function(_0x38875f){logger[_0x99e2('0x13')](_0x99e2('0x17'),_0x38875f[_0x99e2('0x15')],_0x4f1cad);_0x43bec5(_0x20e5aa['error'](0x1f4,_0x38875f[_0x99e2('0x15')]));});});};exports['ShowFreshdeskAccount']=function(_0x54149c){var _0x1693c7=this;return new Promise(function(_0x567c55,_0x1a8715){return db[_0x99e2('0x18')][_0x99e2('0x22')]({'raw':_0x54149c['options']?_0x54149c[_0x99e2('0x1a')][_0x99e2('0x1b')]===undefined?!![]:![]:!![],'where':_0x54149c[_0x99e2('0x1a')]?_0x54149c['options']['where']||null:null,'attributes':_0x54149c[_0x99e2('0x1a')]?_0x54149c[_0x99e2('0x1a')][_0x99e2('0x21')]||null:null,'include':_0x54149c['options']?_0x54149c[_0x99e2('0x1a')][_0x99e2('0x1e')]?_[_0x99e2('0x1f')](_0x54149c[_0x99e2('0x1a')][_0x99e2('0x1e')],function(_0x396c77){return{'model':db[_0x396c77[_0x99e2('0x20')]],'as':_0x396c77['as'],'attributes':_0x396c77[_0x99e2('0x21')],'include':_0x396c77[_0x99e2('0x1e')]?_[_0x99e2('0x1f')](_0x396c77[_0x99e2('0x1e')],function(_0x46060f){return{'model':db[_0x46060f['model']],'as':_0x46060f['as'],'attributes':_0x46060f[_0x99e2('0x21')],'include':_0x46060f[_0x99e2('0x1e')]?_[_0x99e2('0x1f')](_0x46060f[_0x99e2('0x1e')],function(_0xb87b0f){return{'model':db[_0xb87b0f[_0x99e2('0x20')]],'as':_0xb87b0f['as'],'attributes':_0xb87b0f[_0x99e2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x99e2('0xd')](function(_0x424cef){logger['info'](_0x99e2('0x23'),_0x54149c);logger[_0x99e2('0x10')](_0x99e2('0x23'),_0x54149c,JSON[_0x99e2('0x24')](_0x424cef));_0x567c55(_0x424cef);})[_0x99e2('0x16')](function(_0x4ed71e){logger[_0x99e2('0x13')](_0x99e2('0x23'),_0x4ed71e[_0x99e2('0x15')],_0x54149c);_0x1a8715(_0x1693c7['error'](0x1f4,_0x4ed71e['message']));});});}; \ No newline at end of file +var _0x4dc7=['info','result','catch','FreshdeskAccount','findAll','options','attributes','limit','include','model','map','GetFreshdeskAccount','ShowFreshdeskAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x548698,_0x3c952e){var _0xd924e3=function(_0x53f180){while(--_0x53f180){_0x548698['push'](_0x548698['shift']());}};_0xd924e3(++_0x3c952e);}(_0x4dc7,0x182));var _0x74dc=function(_0x5141dc,_0x5f271a){_0x5141dc=_0x5141dc-0x0;var _0x396104=_0x4dc7[_0x5141dc];return _0x396104;};'use strict';var _=require(_0x74dc('0x0'));var util=require(_0x74dc('0x1'));var moment=require(_0x74dc('0x2'));var BPromise=require(_0x74dc('0x3'));var rs=require(_0x74dc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x74dc('0x5'));var logger=require(_0x74dc('0x6'))(_0x74dc('0x7'));var config=require(_0x74dc('0x8'));var jayson=require(_0x74dc('0x9'));var client=jayson['client'][_0x74dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41239c,_0x534af2,_0xd08fd9){return new BPromise(function(_0x33caef,_0x2a3c60){return client[_0x74dc('0xb')](_0x41239c,_0xd08fd9)[_0x74dc('0xc')](function(_0x51d48a){logger['info'](_0x74dc('0xd'),_0x534af2,_0x74dc('0xe'));logger[_0x74dc('0xf')](_0x74dc('0x10'),_0x534af2,'request\x20sent',JSON[_0x74dc('0x11')](_0x51d48a));if(_0x51d48a['error']){if(_0x51d48a[_0x74dc('0x12')][_0x74dc('0x13')]===0x1f4){logger[_0x74dc('0x12')](_0x74dc('0xd'),_0x534af2,_0x51d48a[_0x74dc('0x12')][_0x74dc('0x14')]);return _0x2a3c60(_0x51d48a[_0x74dc('0x12')][_0x74dc('0x14')]);}logger[_0x74dc('0x12')](_0x74dc('0xd'),_0x534af2,_0x51d48a['error']['message']);return _0x33caef(_0x51d48a[_0x74dc('0x12')][_0x74dc('0x14')]);}else{logger[_0x74dc('0x15')](_0x74dc('0xd'),_0x534af2,'request\x20sent');_0x33caef(_0x51d48a[_0x74dc('0x16')]['message']);}})[_0x74dc('0x17')](function(_0x4f1a67){logger[_0x74dc('0x12')](_0x74dc('0xd'),_0x534af2,_0x4f1a67);_0x2a3c60(_0x4f1a67);});});}exports['GetFreshdeskAccount']=function(_0x45c9ca){var _0x213d1f=this;return new Promise(function(_0x51b720,_0x152ce0){return db[_0x74dc('0x18')][_0x74dc('0x19')]({'raw':_0x45c9ca[_0x74dc('0x1a')]?_0x45c9ca['options']['raw']===undefined?!![]:![]:!![],'where':_0x45c9ca['options']?_0x45c9ca[_0x74dc('0x1a')]['where']||null:null,'attributes':_0x45c9ca['options']?_0x45c9ca[_0x74dc('0x1a')][_0x74dc('0x1b')]||null:null,'limit':_0x45c9ca[_0x74dc('0x1a')]?_0x45c9ca[_0x74dc('0x1a')][_0x74dc('0x1c')]||null:null,'include':_0x45c9ca[_0x74dc('0x1a')]?_0x45c9ca[_0x74dc('0x1a')][_0x74dc('0x1d')]?_['map'](_0x45c9ca['options'][_0x74dc('0x1d')],function(_0x33557c){return{'model':db[_0x33557c[_0x74dc('0x1e')]],'as':_0x33557c['as'],'attributes':_0x33557c[_0x74dc('0x1b')],'include':_0x33557c[_0x74dc('0x1d')]?_[_0x74dc('0x1f')](_0x33557c[_0x74dc('0x1d')],function(_0x2c3c8b){return{'model':db[_0x2c3c8b['model']],'as':_0x2c3c8b['as'],'attributes':_0x2c3c8b[_0x74dc('0x1b')],'include':_0x2c3c8b[_0x74dc('0x1d')]?_['map'](_0x2c3c8b[_0x74dc('0x1d')],function(_0x1c095e){return{'model':db[_0x1c095e[_0x74dc('0x1e')]],'as':_0x1c095e['as'],'attributes':_0x1c095e['attributes']};}):[]};}):[]};}):[]:[]})[_0x74dc('0xc')](function(_0x3dfbe4){logger[_0x74dc('0x15')]('GetFreshdeskAccount',_0x45c9ca);logger[_0x74dc('0xf')]('GetFreshdeskAccount',_0x45c9ca,JSON['stringify'](_0x3dfbe4));_0x51b720(_0x3dfbe4);})[_0x74dc('0x17')](function(_0x2d205e){logger[_0x74dc('0x12')](_0x74dc('0x20'),_0x2d205e['message'],_0x45c9ca);_0x152ce0(_0x213d1f[_0x74dc('0x12')](0x1f4,_0x2d205e[_0x74dc('0x14')]));});});};exports[_0x74dc('0x21')]=function(_0x5a71ad){var _0x1809ac=this;return new Promise(function(_0xfd5537,_0x20a971){return db['FreshdeskAccount'][_0x74dc('0x22')]({'raw':_0x5a71ad[_0x74dc('0x1a')]?_0x5a71ad[_0x74dc('0x1a')][_0x74dc('0x23')]===undefined?!![]:![]:!![],'where':_0x5a71ad[_0x74dc('0x1a')]?_0x5a71ad[_0x74dc('0x1a')][_0x74dc('0x24')]||null:null,'attributes':_0x5a71ad['options']?_0x5a71ad[_0x74dc('0x1a')][_0x74dc('0x1b')]||null:null,'include':_0x5a71ad[_0x74dc('0x1a')]?_0x5a71ad[_0x74dc('0x1a')][_0x74dc('0x1d')]?_[_0x74dc('0x1f')](_0x5a71ad[_0x74dc('0x1a')]['include'],function(_0x69a58){return{'model':db[_0x69a58[_0x74dc('0x1e')]],'as':_0x69a58['as'],'attributes':_0x69a58[_0x74dc('0x1b')],'include':_0x69a58[_0x74dc('0x1d')]?_[_0x74dc('0x1f')](_0x69a58[_0x74dc('0x1d')],function(_0x57ebda){return{'model':db[_0x57ebda['model']],'as':_0x57ebda['as'],'attributes':_0x57ebda['attributes'],'include':_0x57ebda[_0x74dc('0x1d')]?_[_0x74dc('0x1f')](_0x57ebda['include'],function(_0x47ebc2){return{'model':db[_0x47ebc2[_0x74dc('0x1e')]],'as':_0x47ebc2['as'],'attributes':_0x47ebc2[_0x74dc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x74dc('0xc')](function(_0x10f706){logger[_0x74dc('0x15')]('ShowFreshdeskAccount',_0x5a71ad);logger['debug'](_0x74dc('0x21'),_0x5a71ad,JSON[_0x74dc('0x11')](_0x10f706));_0xfd5537(_0x10f706);})[_0x74dc('0x17')](function(_0x3f3bd6){logger[_0x74dc('0x12')](_0x74dc('0x21'),_0x3f3bd6[_0x74dc('0x14')],_0x5a71ad);_0x20a971(_0x1809ac[_0x74dc('0x12')](0x1f4,_0x3f3bd6[_0x74dc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 865a8ba..c8c95d6 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 _0x4938=['/:id/subjects','/:id/tags','getTags','post','create','put','/:id','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','isAuthenticated','show','getFields'];(function(_0x381ac6,_0x374bea){var _0x5ca3c2=function(_0x33016e){while(--_0x33016e){_0x381ac6['push'](_0x381ac6['shift']());}};_0x5ca3c2(++_0x374bea);}(_0x4938,0xc1));var _0x8493=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0x4938[_0x46f1a6];return _0x38429a;};'use strict';var multer=require(_0x8493('0x0'));var util=require(_0x8493('0x1'));var path=require('path');var timeout=require(_0x8493('0x2'));var express=require(_0x8493('0x3'));var router=express[_0x8493('0x4')]();var fs_extra=require(_0x8493('0x5'));var auth=require(_0x8493('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8493('0x7'));var controller=require(_0x8493('0x8'));router[_0x8493('0x9')]('/',auth['isAuthenticated'](),controller[_0x8493('0xa')]);router[_0x8493('0x9')]('/:id',auth[_0x8493('0xb')](),controller[_0x8493('0xc')]);router[_0x8493('0x9')]('/:id/fields',auth[_0x8493('0xb')](),controller[_0x8493('0xd')]);router[_0x8493('0x9')](_0x8493('0xe'),auth[_0x8493('0xb')](),controller['getSubjects']);router[_0x8493('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x8493('0x9')](_0x8493('0xf'),auth[_0x8493('0xb')](),controller[_0x8493('0x10')]);router[_0x8493('0x11')]('/',auth[_0x8493('0xb')](),controller[_0x8493('0x12')]);router[_0x8493('0x11')](_0x8493('0xf'),auth[_0x8493('0xb')](),controller['setTags']);router[_0x8493('0x13')](_0x8493('0x14'),auth[_0x8493('0xb')](),controller[_0x8493('0x15')]);router[_0x8493('0x16')](_0x8493('0x14'),auth[_0x8493('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd2b1=['getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','get','show','/:id/fields','getFields','/:id/subjects'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0xd2b1,0x1aa));var _0x1d2b=function(_0x29acef,_0x3fa99b){_0x29acef=_0x29acef-0x0;var _0x66385d=_0xd2b1[_0x29acef];return _0x66385d;};'use strict';var multer=require(_0x1d2b('0x0'));var util=require(_0x1d2b('0x1'));var path=require('path');var timeout=require(_0x1d2b('0x2'));var express=require(_0x1d2b('0x3'));var router=express[_0x1d2b('0x4')]();var fs_extra=require(_0x1d2b('0x5'));var auth=require(_0x1d2b('0x6'));var interaction=require(_0x1d2b('0x7'));var config=require(_0x1d2b('0x8'));var controller=require(_0x1d2b('0x9'));router['get']('/',auth[_0x1d2b('0xa')](),controller['index']);router[_0x1d2b('0xb')]('/:id',auth[_0x1d2b('0xa')](),controller[_0x1d2b('0xc')]);router[_0x1d2b('0xb')](_0x1d2b('0xd'),auth[_0x1d2b('0xa')](),controller[_0x1d2b('0xe')]);router['get'](_0x1d2b('0xf'),auth[_0x1d2b('0xa')](),controller[_0x1d2b('0x10')]);router['get'](_0x1d2b('0x11'),auth[_0x1d2b('0xa')](),controller['getDescriptions']);router[_0x1d2b('0xb')](_0x1d2b('0x12'),auth[_0x1d2b('0xa')](),controller[_0x1d2b('0x13')]);router[_0x1d2b('0x14')]('/',auth['isAuthenticated'](),controller[_0x1d2b('0x15')]);router['post'](_0x1d2b('0x12'),auth[_0x1d2b('0xa')](),controller[_0x1d2b('0x16')]);router[_0x1d2b('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x1d2b('0x18')]);router['delete']('/:id',auth[_0x1d2b('0xa')](),controller[_0x1d2b('0x19')]);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 31a000f..c307297 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 _0x9db6=['sequelize','exports'];(function(_0x5e3271,_0x5bb7ef){var _0x1c82ae=function(_0x1fdd0c){while(--_0x1fdd0c){_0x5e3271['push'](_0x5e3271['shift']());}};_0x1c82ae(++_0x5bb7ef);}(_0x9db6,0x128));var _0x69db=function(_0x503564,_0x55867e){_0x503564=_0x503564-0x0;var _0x4be9fd=_0x9db6[_0x503564];return _0x4be9fd;};'use strict';var Sequelize=require(_0x69db('0x0'));module[_0x69db('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa4ae=['exports','STRING'];(function(_0x40e412,_0x55f74d){var _0x4f2fb6=function(_0x36ca6f){while(--_0x36ca6f){_0x40e412['push'](_0x40e412['shift']());}};_0x4f2fb6(++_0x55f74d);}(_0xa4ae,0x12a));var _0xea4a=function(_0x44fef1,_0x132cf4){_0x44fef1=_0x44fef1-0x0;var _0x3c3a04=_0xa4ae[_0x44fef1];return _0x3c3a04;};'use strict';var Sequelize=require('sequelize');module[_0xea4a('0x0')]={'name':{'type':Sequelize[_0xea4a('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 56c465c..be44a22 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 _0x9cb8=['filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','update','body','findOne','FreshdeskField','getFields','nolimit','getSubjects','pick','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','then','destroy','error','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0x1b1f88,_0x3fe1cb){var _0x5045b9=function(_0x5c1367){while(--_0x5c1367){_0x1b1f88['push'](_0x1b1f88['shift']());}};_0x5045b9(++_0x3fe1cb);}(_0x9cb8,0x16e));var _0x89cb=function(_0x5d93bf,_0x157933){_0x5d93bf=_0x5d93bf-0x0;var _0x2239ce=_0x9cb8[_0x5d93bf];return _0x2239ce;};'use strict';var emlformat=require(_0x89cb('0x0'));var rimraf=require(_0x89cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x89cb('0x2'));var rp=require(_0x89cb('0x3'));var moment=require('moment');var BPromise=require(_0x89cb('0x4'));var Mustache=require(_0x89cb('0x5'));var util=require('util');var path=require(_0x89cb('0x6'));var sox=require(_0x89cb('0x7'));var csv=require(_0x89cb('0x8'));var ejs=require(_0x89cb('0x9'));var fs=require('fs');var fs_extra=require(_0x89cb('0xa'));var _=require(_0x89cb('0xb'));var squel=require(_0x89cb('0xc'));var crypto=require(_0x89cb('0xd'));var jsforce=require(_0x89cb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x89cb('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x89cb('0xf'));var authService=require(_0x89cb('0x10'));var qs=require(_0x89cb('0x11'));var as=require(_0x89cb('0x12'));var hardwareService=require(_0x89cb('0x13'));var logger=require(_0x89cb('0x14'))(_0x89cb('0x15'));var utils=require(_0x89cb('0x16'));var config=require(_0x89cb('0x17'));var licenseUtil=require(_0x89cb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e188d,_0x192dcd){_0x192dcd=_0x192dcd||0xcc;return function(_0x2880d8){if(_0x2880d8){return _0x5e188d[_0x89cb('0x19')](_0x192dcd);}return _0x5e188d[_0x89cb('0x1a')](_0x192dcd)[_0x89cb('0x1b')]();};}function respondWithResult(_0x342739,_0x56582a){_0x56582a=_0x56582a||0xc8;return function(_0x478d9c){if(_0x478d9c){return _0x342739[_0x89cb('0x1a')](_0x56582a)['json'](_0x478d9c);}};}function respondWithFilteredResult(_0x12b76d,_0x36993c){return function(_0x1dad64){if(_0x1dad64){var _0x107c41=typeof _0x36993c[_0x89cb('0x1c')]===_0x89cb('0x1d')&&typeof _0x36993c[_0x89cb('0x1e')]===_0x89cb('0x1d');var _0xa9961a=_0x1dad64[_0x89cb('0x1f')];var _0x3cc272=_0x107c41?0x0:_0x36993c[_0x89cb('0x1c')];var _0x483cad=_0x107c41?_0x1dad64['count']:_0x36993c[_0x89cb('0x1c')]+_0x36993c[_0x89cb('0x1e')];var _0x3d3b5a;if(_0x483cad>=_0xa9961a){_0x483cad=_0xa9961a;_0x3d3b5a=0xc8;}else{_0x3d3b5a=0xce;}_0x12b76d[_0x89cb('0x1a')](_0x3d3b5a);return _0x12b76d[_0x89cb('0x20')]('Content-Range',_0x3cc272+'-'+_0x483cad+'/'+_0xa9961a)[_0x89cb('0x21')](_0x1dad64);}return null;};}function patchUpdates(_0x5ee897){return function(_0x325676){try{jsonpatch[_0x89cb('0x22')](_0x325676,_0x5ee897,!![]);}catch(_0x399072){return BPromise['reject'](_0x399072);}return _0x325676[_0x89cb('0x23')]();};}function saveUpdates(_0x5b2726,_0xb99378){return function(_0x488e5d){if(_0x488e5d){return _0x488e5d['update'](_0x5b2726)[_0x89cb('0x24')](function(_0x440bd6){return _0x440bd6;});}return null;};}function removeEntity(_0x58373c,_0x274742){return function(_0x162b5b){if(_0x162b5b){return _0x162b5b[_0x89cb('0x25')]()['then'](function(){_0x58373c[_0x89cb('0x1a')](0xcc)[_0x89cb('0x1b')]();});}};}function handleEntityNotFound(_0x33d740,_0x392f5b){return function(_0x564495){if(!_0x564495){_0x33d740[_0x89cb('0x19')](0x194);}return _0x564495;};}function handleError(_0x2b0708,_0x249fe1){_0x249fe1=_0x249fe1||0x1f4;return function(_0x44aca3){logger[_0x89cb('0x26')](_0x44aca3[_0x89cb('0x27')]);if(_0x44aca3[_0x89cb('0x28')]){delete _0x44aca3[_0x89cb('0x28')];}_0x2b0708['status'](_0x249fe1)[_0x89cb('0x29')](_0x44aca3);};}exports['index']=function(_0x1ca851,_0x5b520e){var _0x37f326={},_0x303259={},_0x174acb={'count':0x0,'rows':[]};var _0x4294bc=_[_0x89cb('0x2a')](db[_0x89cb('0x2b')][_0x89cb('0x2c')],function(_0x14e700){return{'name':_0x14e700[_0x89cb('0x2d')],'type':_0x14e700[_0x89cb('0x2e')][_0x89cb('0x2f')]};});_0x303259[_0x89cb('0x30')]=_['map'](_0x4294bc,_0x89cb('0x28'));_0x303259[_0x89cb('0x31')]=_['keys'](_0x1ca851[_0x89cb('0x31')]);_0x303259[_0x89cb('0x32')]=_[_0x89cb('0x33')](_0x303259[_0x89cb('0x30')],_0x303259[_0x89cb('0x31')]);_0x37f326[_0x89cb('0x34')]=_['intersection'](_0x303259[_0x89cb('0x30')],qs[_0x89cb('0x35')](_0x1ca851[_0x89cb('0x31')][_0x89cb('0x35')]));_0x37f326[_0x89cb('0x34')]=_0x37f326[_0x89cb('0x34')][_0x89cb('0x36')]?_0x37f326[_0x89cb('0x34')]:_0x303259['model'];if(!_0x1ca851[_0x89cb('0x31')][_0x89cb('0x37')]('nolimit')){_0x37f326[_0x89cb('0x1e')]=qs[_0x89cb('0x1e')](_0x1ca851[_0x89cb('0x31')]['limit']);_0x37f326[_0x89cb('0x1c')]=qs[_0x89cb('0x1c')](_0x1ca851[_0x89cb('0x31')]['offset']);}_0x37f326[_0x89cb('0x38')]=qs['sort'](_0x1ca851[_0x89cb('0x31')][_0x89cb('0x39')]);_0x37f326[_0x89cb('0x3a')]=qs[_0x89cb('0x32')](_['pick'](_0x1ca851[_0x89cb('0x31')],_0x303259[_0x89cb('0x32')]),_0x4294bc);if(_0x1ca851[_0x89cb('0x31')][_0x89cb('0x3b')]){_0x37f326['where']=_['merge'](_0x37f326[_0x89cb('0x3a')],{'$or':_[_0x89cb('0x2a')](_0x4294bc,function(_0x216429){if(_0x216429[_0x89cb('0x2e')]!==_0x89cb('0x3c')){var _0x484beb={};_0x484beb[_0x216429[_0x89cb('0x28')]]={'$like':'%'+_0x1ca851[_0x89cb('0x31')][_0x89cb('0x3b')]+'%'};return _0x484beb;}})});}_0x37f326=_[_0x89cb('0x3d')]({},_0x37f326,_0x1ca851['options']);var _0x582a19={'where':_0x37f326['where']};return db[_0x89cb('0x2b')]['count'](_0x582a19)[_0x89cb('0x24')](function(_0x1bf745){_0x174acb[_0x89cb('0x1f')]=_0x1bf745;if(_0x1ca851['query'][_0x89cb('0x3e')]){_0x37f326[_0x89cb('0x3f')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x89cb('0x40')](_0x37f326);})[_0x89cb('0x24')](function(_0x4752e5){_0x174acb[_0x89cb('0x41')]=_0x4752e5;return _0x174acb;})[_0x89cb('0x24')](respondWithFilteredResult(_0x5b520e,_0x37f326))[_0x89cb('0x42')](handleError(_0x5b520e,null));};exports[_0x89cb('0x43')]=function(_0x3caae4,_0x49c46e){var _0x322fd8={'raw':![],'where':{'id':_0x3caae4[_0x89cb('0x44')]['id']}},_0x28d7c9={};_0x28d7c9[_0x89cb('0x30')]=_[_0x89cb('0x45')](db[_0x89cb('0x2b')][_0x89cb('0x2c')]);_0x28d7c9[_0x89cb('0x31')]=_[_0x89cb('0x45')](_0x3caae4['query']);_0x28d7c9[_0x89cb('0x32')]=_[_0x89cb('0x33')](_0x28d7c9[_0x89cb('0x30')],_0x28d7c9[_0x89cb('0x31')]);_0x322fd8[_0x89cb('0x34')]=_['intersection'](_0x28d7c9[_0x89cb('0x30')],qs['fields'](_0x3caae4[_0x89cb('0x31')]['fields']));_0x322fd8['attributes']=_0x322fd8[_0x89cb('0x34')]['length']?_0x322fd8[_0x89cb('0x34')]:_0x28d7c9[_0x89cb('0x30')];if(_0x3caae4[_0x89cb('0x31')][_0x89cb('0x3e')]){_0x322fd8[_0x89cb('0x3f')]=[{'all':!![]}];}_0x322fd8=_['merge']({},_0x322fd8,_0x3caae4[_0x89cb('0x46')]);return db['FreshdeskConfiguration'][_0x89cb('0x47')](_0x322fd8)[_0x89cb('0x24')](handleEntityNotFound(_0x49c46e,null))[_0x89cb('0x24')](respondWithResult(_0x49c46e,null))[_0x89cb('0x42')](handleError(_0x49c46e,null));};exports[_0x89cb('0x48')]=function(_0x75c21c,_0x9c862){return db[_0x89cb('0x2b')][_0x89cb('0x48')](_0x75c21c['body'],{})[_0x89cb('0x24')](respondWithResult(_0x9c862,0xc9))[_0x89cb('0x42')](handleError(_0x9c862,null));};exports[_0x89cb('0x49')]=function(_0x589077,_0x11dc0a){if(_0x589077[_0x89cb('0x4a')]['id']){delete _0x589077[_0x89cb('0x4a')]['id'];}return db['FreshdeskConfiguration'][_0x89cb('0x47')]({'where':{'id':_0x589077[_0x89cb('0x44')]['id']}})['then'](handleEntityNotFound(_0x11dc0a,null))['then'](saveUpdates(_0x589077[_0x89cb('0x4a')],null))[_0x89cb('0x24')](respondWithResult(_0x11dc0a,null))[_0x89cb('0x42')](handleError(_0x11dc0a,null));};exports['destroy']=function(_0xc67495,_0x1ff0b6){return db[_0x89cb('0x2b')]['find']({'where':{'id':_0xc67495['params']['id']}})['then'](handleEntityNotFound(_0x1ff0b6,null))[_0x89cb('0x24')](removeEntity(_0x1ff0b6,null))[_0x89cb('0x42')](handleError(_0x1ff0b6,null));};exports['getFields']=function(_0x566d95,_0x15f515,_0x592f38){var _0xbd57ed={};var _0x2b3c86={};var _0x299695;var _0x1dddee;return db[_0x89cb('0x2b')][_0x89cb('0x4b')]({'where':{'id':_0x566d95[_0x89cb('0x44')]['id']}})[_0x89cb('0x24')](handleEntityNotFound(_0x15f515,null))[_0x89cb('0x24')](function(_0x4ed985){if(_0x4ed985){_0x299695=_0x4ed985;_0x2b3c86['model']=_[_0x89cb('0x45')](db[_0x89cb('0x4c')]['rawAttributes']);_0x2b3c86[_0x89cb('0x31')]=_[_0x89cb('0x45')](_0x566d95[_0x89cb('0x31')]);_0x2b3c86[_0x89cb('0x32')]=_[_0x89cb('0x33')](_0x2b3c86['model'],_0x2b3c86[_0x89cb('0x31')]);_0xbd57ed[_0x89cb('0x34')]=_[_0x89cb('0x33')](_0x2b3c86[_0x89cb('0x30')],qs[_0x89cb('0x35')](_0x566d95[_0x89cb('0x31')][_0x89cb('0x35')]));_0xbd57ed['attributes']=_0xbd57ed['attributes']['length']?_0xbd57ed[_0x89cb('0x34')]:_0x2b3c86[_0x89cb('0x30')];_0xbd57ed[_0x89cb('0x38')]=qs[_0x89cb('0x39')](_0x566d95[_0x89cb('0x31')][_0x89cb('0x39')]);_0xbd57ed[_0x89cb('0x3a')]=qs['filters'](_['pick'](_0x566d95['query'],_0x2b3c86[_0x89cb('0x32')]));if(_0x566d95[_0x89cb('0x31')]['filter']){_0xbd57ed[_0x89cb('0x3a')]=_[_0x89cb('0x3d')](_0xbd57ed[_0x89cb('0x3a')],{'$or':_[_0x89cb('0x2a')](_0xbd57ed[_0x89cb('0x34')],function(_0x28a362){var _0x4be8d3={};_0x4be8d3[_0x28a362]={'$like':'%'+_0x566d95['query'][_0x89cb('0x3b')]+'%'};return _0x4be8d3;})});}_0xbd57ed=_[_0x89cb('0x3d')]({},_0xbd57ed,_0x566d95['options']);return _0x299695[_0x89cb('0x4d')](_0xbd57ed);}})[_0x89cb('0x24')](function(_0x32a1c9){if(_0x32a1c9){_0x1dddee=_0x32a1c9[_0x89cb('0x36')];if(!_0x566d95[_0x89cb('0x31')][_0x89cb('0x37')](_0x89cb('0x4e'))){_0xbd57ed[_0x89cb('0x1e')]=qs[_0x89cb('0x1e')](_0x566d95[_0x89cb('0x31')][_0x89cb('0x1e')]);_0xbd57ed[_0x89cb('0x1c')]=qs[_0x89cb('0x1c')](_0x566d95[_0x89cb('0x31')][_0x89cb('0x1c')]);}return _0x299695[_0x89cb('0x4d')](_0xbd57ed);}})[_0x89cb('0x24')](function(_0x1c1a5b){if(_0x1c1a5b){return _0x1c1a5b?{'count':_0x1dddee,'rows':_0x1c1a5b}:null;}})[_0x89cb('0x24')](respondWithResult(_0x15f515,null))[_0x89cb('0x42')](handleError(_0x15f515,null));};exports[_0x89cb('0x4f')]=function(_0x5641d9,_0x244fa0,_0x189b29){var _0x547adb={};var _0x582cde={};var _0x55d3dd;var _0x1ae912;return db['FreshdeskConfiguration'][_0x89cb('0x4b')]({'where':{'id':_0x5641d9[_0x89cb('0x44')]['id']}})[_0x89cb('0x24')](handleEntityNotFound(_0x244fa0,null))['then'](function(_0x3e007e){if(_0x3e007e){_0x55d3dd=_0x3e007e;_0x582cde[_0x89cb('0x30')]=_[_0x89cb('0x45')](db['FreshdeskField']['rawAttributes']);_0x582cde[_0x89cb('0x31')]=_[_0x89cb('0x45')](_0x5641d9[_0x89cb('0x31')]);_0x582cde[_0x89cb('0x32')]=_[_0x89cb('0x33')](_0x582cde[_0x89cb('0x30')],_0x582cde[_0x89cb('0x31')]);_0x547adb[_0x89cb('0x34')]=_[_0x89cb('0x33')](_0x582cde['model'],qs[_0x89cb('0x35')](_0x5641d9[_0x89cb('0x31')]['fields']));_0x547adb['attributes']=_0x547adb[_0x89cb('0x34')][_0x89cb('0x36')]?_0x547adb[_0x89cb('0x34')]:_0x582cde[_0x89cb('0x30')];_0x547adb[_0x89cb('0x38')]=qs[_0x89cb('0x39')](_0x5641d9[_0x89cb('0x31')][_0x89cb('0x39')]);_0x547adb['where']=qs['filters'](_[_0x89cb('0x50')](_0x5641d9[_0x89cb('0x31')],_0x582cde['filters']));if(_0x5641d9[_0x89cb('0x31')]['filter']){_0x547adb[_0x89cb('0x3a')]=_['merge'](_0x547adb[_0x89cb('0x3a')],{'$or':_[_0x89cb('0x2a')](_0x547adb[_0x89cb('0x34')],function(_0x53dc8b){var _0x4060df={};_0x4060df[_0x53dc8b]={'$like':'%'+_0x5641d9[_0x89cb('0x31')]['filter']+'%'};return _0x4060df;})});}_0x547adb=_[_0x89cb('0x3d')]({},_0x547adb,_0x5641d9[_0x89cb('0x46')]);return _0x55d3dd[_0x89cb('0x4f')](_0x547adb);}})[_0x89cb('0x24')](function(_0x58bbf9){if(_0x58bbf9){_0x1ae912=_0x58bbf9[_0x89cb('0x36')];if(!_0x5641d9['query'][_0x89cb('0x37')]('nolimit')){_0x547adb[_0x89cb('0x1e')]=qs['limit'](_0x5641d9[_0x89cb('0x31')]['limit']);_0x547adb[_0x89cb('0x1c')]=qs[_0x89cb('0x1c')](_0x5641d9[_0x89cb('0x31')][_0x89cb('0x1c')]);}return _0x55d3dd[_0x89cb('0x4f')](_0x547adb);}})['then'](function(_0x31c1af){if(_0x31c1af){return _0x31c1af?{'count':_0x1ae912,'rows':_0x31c1af}:null;}})[_0x89cb('0x24')](respondWithResult(_0x244fa0,null))['catch'](handleError(_0x244fa0,null));};exports[_0x89cb('0x51')]=function(_0x4b1d74,_0x5e2e18,_0x4d3602){var _0x9ac5ea={};var _0x4d4692={};var _0x18d4dc;var _0x56ec93;return db['FreshdeskConfiguration'][_0x89cb('0x4b')]({'where':{'id':_0x4b1d74[_0x89cb('0x44')]['id']}})[_0x89cb('0x24')](handleEntityNotFound(_0x5e2e18,null))[_0x89cb('0x24')](function(_0x351243){if(_0x351243){_0x18d4dc=_0x351243;_0x4d4692['model']=_['keys'](db['FreshdeskField']['rawAttributes']);_0x4d4692[_0x89cb('0x31')]=_['keys'](_0x4b1d74[_0x89cb('0x31')]);_0x4d4692[_0x89cb('0x32')]=_[_0x89cb('0x33')](_0x4d4692[_0x89cb('0x30')],_0x4d4692[_0x89cb('0x31')]);_0x9ac5ea[_0x89cb('0x34')]=_[_0x89cb('0x33')](_0x4d4692[_0x89cb('0x30')],qs['fields'](_0x4b1d74[_0x89cb('0x31')][_0x89cb('0x35')]));_0x9ac5ea[_0x89cb('0x34')]=_0x9ac5ea[_0x89cb('0x34')][_0x89cb('0x36')]?_0x9ac5ea[_0x89cb('0x34')]:_0x4d4692[_0x89cb('0x30')];_0x9ac5ea['order']=qs[_0x89cb('0x39')](_0x4b1d74[_0x89cb('0x31')][_0x89cb('0x39')]);_0x9ac5ea['where']=qs['filters'](_[_0x89cb('0x50')](_0x4b1d74[_0x89cb('0x31')],_0x4d4692['filters']));if(_0x4b1d74[_0x89cb('0x31')][_0x89cb('0x3b')]){_0x9ac5ea[_0x89cb('0x3a')]=_[_0x89cb('0x3d')](_0x9ac5ea[_0x89cb('0x3a')],{'$or':_[_0x89cb('0x2a')](_0x9ac5ea[_0x89cb('0x34')],function(_0x2c2d34){var _0x54a5cf={};_0x54a5cf[_0x2c2d34]={'$like':'%'+_0x4b1d74[_0x89cb('0x31')][_0x89cb('0x3b')]+'%'};return _0x54a5cf;})});}_0x9ac5ea=_['merge']({},_0x9ac5ea,_0x4b1d74[_0x89cb('0x46')]);return _0x18d4dc[_0x89cb('0x51')](_0x9ac5ea);}})['then'](function(_0x412fb9){if(_0x412fb9){_0x56ec93=_0x412fb9['length'];if(!_0x4b1d74[_0x89cb('0x31')][_0x89cb('0x37')](_0x89cb('0x4e'))){_0x9ac5ea[_0x89cb('0x1e')]=qs['limit'](_0x4b1d74['query'][_0x89cb('0x1e')]);_0x9ac5ea[_0x89cb('0x1c')]=qs[_0x89cb('0x1c')](_0x4b1d74[_0x89cb('0x31')][_0x89cb('0x1c')]);}return _0x18d4dc['getDescriptions'](_0x9ac5ea);}})[_0x89cb('0x24')](function(_0x304682){if(_0x304682){return _0x304682?{'count':_0x56ec93,'rows':_0x304682}:null;}})['then'](respondWithResult(_0x5e2e18,null))[_0x89cb('0x42')](handleError(_0x5e2e18,null));};exports[_0x89cb('0x52')]=function(_0x4db337,_0x265954,_0x86f567){var _0x4a9a3c={};var _0x3cb2bd={};var _0x48a6a4;var _0x1c27f5;return db[_0x89cb('0x2b')]['findOne']({'where':{'id':_0x4db337[_0x89cb('0x44')]['id']}})[_0x89cb('0x24')](handleEntityNotFound(_0x265954,null))['then'](function(_0xe84d9a){if(_0xe84d9a){_0x48a6a4=_0xe84d9a;_0x3cb2bd['model']=_['keys'](db[_0x89cb('0x53')]['rawAttributes']);_0x3cb2bd[_0x89cb('0x31')]=_['keys'](_0x4db337['query']);_0x3cb2bd[_0x89cb('0x32')]=_[_0x89cb('0x33')](_0x3cb2bd['model'],_0x3cb2bd['query']);_0x4a9a3c['attributes']=_[_0x89cb('0x33')](_0x3cb2bd[_0x89cb('0x30')],qs['fields'](_0x4db337[_0x89cb('0x31')][_0x89cb('0x35')]));_0x4a9a3c['attributes']=_0x4a9a3c['attributes'][_0x89cb('0x36')]?_0x4a9a3c['attributes']:_0x3cb2bd['model'];_0x4a9a3c[_0x89cb('0x38')]=qs['sort'](_0x4db337[_0x89cb('0x31')][_0x89cb('0x39')]);_0x4a9a3c['where']=qs[_0x89cb('0x32')](_[_0x89cb('0x50')](_0x4db337['query'],_0x3cb2bd[_0x89cb('0x32')]));if(_0x4db337[_0x89cb('0x31')]['filter']){_0x4a9a3c[_0x89cb('0x3a')]=_['merge'](_0x4a9a3c['where'],{'$or':_[_0x89cb('0x2a')](_0x4a9a3c[_0x89cb('0x34')],function(_0x21d9f5){var _0x36df94={};_0x36df94[_0x21d9f5]={'$like':'%'+_0x4db337[_0x89cb('0x31')]['filter']+'%'};return _0x36df94;})});}_0x4a9a3c=_['merge']({},_0x4a9a3c,_0x4db337[_0x89cb('0x46')]);return _0x48a6a4[_0x89cb('0x52')](_0x4a9a3c);}})[_0x89cb('0x24')](function(_0x7c51af){if(_0x7c51af){_0x1c27f5=_0x7c51af[_0x89cb('0x36')];if(!_0x4db337['query'][_0x89cb('0x37')]('nolimit')){_0x4a9a3c[_0x89cb('0x1e')]=qs[_0x89cb('0x1e')](_0x4db337[_0x89cb('0x31')]['limit']);_0x4a9a3c[_0x89cb('0x1c')]=qs['offset'](_0x4db337[_0x89cb('0x31')][_0x89cb('0x1c')]);}return _0x48a6a4[_0x89cb('0x52')](_0x4a9a3c);}})[_0x89cb('0x24')](function(_0x50d788){if(_0x50d788){return _0x50d788?{'count':_0x1c27f5,'rows':_0x50d788}:null;}})['then'](respondWithResult(_0x265954,null))[_0x89cb('0x42')](handleError(_0x265954,null));};exports[_0x89cb('0x54')]=function(_0x6ea88b,_0x394c85,_0x4774ba){if(_0x6ea88b[_0x89cb('0x4a')]['id']){delete _0x6ea88b['body']['id'];}return db[_0x89cb('0x2b')][_0x89cb('0x4b')]({'where':{'id':_0x6ea88b[_0x89cb('0x44')]['id']}})[_0x89cb('0x24')](handleEntityNotFound(_0x394c85,null))[_0x89cb('0x24')](function(_0x481f78){if(_0x481f78){return _0x481f78[_0x89cb('0x54')](_0x6ea88b[_0x89cb('0x4a')]['ids']||[]);}return null;})[_0x89cb('0x24')](respondWithResult(_0x394c85,null))[_0x89cb('0x42')](handleError(_0x394c85,null));}; \ No newline at end of file +var _0xd97b=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','then','includeAll','rows','keys','rawAttributes','include','catch','create','body','find','params','getFields','findOne','order','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format'];(function(_0x27f8ab,_0x134841){var _0x508566=function(_0x3b819b){while(--_0x3b819b){_0x27f8ab['push'](_0x27f8ab['shift']());}};_0x508566(++_0x134841);}(_0xd97b,0x1ad));var _0xbd97=function(_0x12ad6b,_0x42b30f){_0x12ad6b=_0x12ad6b-0x0;var _0x287db6=_0xd97b[_0x12ad6b];return _0x287db6;};'use strict';var emlformat=require(_0xbd97('0x0'));var rimraf=require(_0xbd97('0x1'));var zipdir=require(_0xbd97('0x2'));var jsonpatch=require(_0xbd97('0x3'));var rp=require(_0xbd97('0x4'));var moment=require(_0xbd97('0x5'));var BPromise=require(_0xbd97('0x6'));var Mustache=require(_0xbd97('0x7'));var util=require(_0xbd97('0x8'));var path=require(_0xbd97('0x9'));var sox=require('sox');var csv=require(_0xbd97('0xa'));var ejs=require(_0xbd97('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd97('0xc'));var squel=require('squel');var crypto=require(_0xbd97('0xd'));var jsforce=require(_0xbd97('0xe'));var deskjs=require(_0xbd97('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbd97('0x10'));var Papa=require(_0xbd97('0x11'));var Redis=require(_0xbd97('0x12'));var authService=require(_0xbd97('0x13'));var qs=require(_0xbd97('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd97('0x15'));var logger=require(_0xbd97('0x16'))(_0xbd97('0x17'));var utils=require('../../config/utils');var config=require(_0xbd97('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd97('0x19'))['db'];function respondWithStatusCode(_0xb98d84,_0x1ed0bb){_0x1ed0bb=_0x1ed0bb||0xcc;return function(_0x3c658e){if(_0x3c658e){return _0xb98d84[_0xbd97('0x1a')](_0x1ed0bb);}return _0xb98d84[_0xbd97('0x1b')](_0x1ed0bb)[_0xbd97('0x1c')]();};}function respondWithResult(_0x3ef1c0,_0xc4b678){_0xc4b678=_0xc4b678||0xc8;return function(_0x1f1aa4){if(_0x1f1aa4){return _0x3ef1c0[_0xbd97('0x1b')](_0xc4b678)['json'](_0x1f1aa4);}};}function respondWithFilteredResult(_0x5ca70e,_0x608b6e){return function(_0xd83e7d){if(_0xd83e7d){var _0x180970=typeof _0x608b6e[_0xbd97('0x1d')]==='undefined'&&typeof _0x608b6e[_0xbd97('0x1e')]===_0xbd97('0x1f');var _0x5435c4=_0xd83e7d['count'];var _0x232e70=_0x180970?0x0:_0x608b6e['offset'];var _0x3b3211=_0x180970?_0xd83e7d[_0xbd97('0x20')]:_0x608b6e[_0xbd97('0x1d')]+_0x608b6e[_0xbd97('0x1e')];var _0x32f58c;if(_0x3b3211>=_0x5435c4){_0x3b3211=_0x5435c4;_0x32f58c=0xc8;}else{_0x32f58c=0xce;}_0x5ca70e[_0xbd97('0x1b')](_0x32f58c);return _0x5ca70e[_0xbd97('0x21')](_0xbd97('0x22'),_0x232e70+'-'+_0x3b3211+'/'+_0x5435c4)[_0xbd97('0x23')](_0xd83e7d);}return null;};}function patchUpdates(_0x3aaa0b){return function(_0x5efe18){try{jsonpatch[_0xbd97('0x24')](_0x5efe18,_0x3aaa0b,!![]);}catch(_0x3f5434){return BPromise[_0xbd97('0x25')](_0x3f5434);}return _0x5efe18['save']();};}function saveUpdates(_0x3c93da,_0x1e2919){return function(_0x293407){if(_0x293407){return _0x293407[_0xbd97('0x26')](_0x3c93da)['then'](function(_0x41870c){return _0x41870c;});}return null;};}function removeEntity(_0x4a9558,_0x23c2a8){return function(_0x2887ee){if(_0x2887ee){return _0x2887ee[_0xbd97('0x27')]()['then'](function(){_0x4a9558[_0xbd97('0x1b')](0xcc)[_0xbd97('0x1c')]();});}};}function handleEntityNotFound(_0x2ac5ca,_0x4dbe52){return function(_0x454161){if(!_0x454161){_0x2ac5ca[_0xbd97('0x1a')](0x194);}return _0x454161;};}function handleError(_0x22a3ff,_0x5d1255){_0x5d1255=_0x5d1255||0x1f4;return function(_0x1bc75f){logger[_0xbd97('0x28')](_0x1bc75f[_0xbd97('0x29')]);if(_0x1bc75f['name']){delete _0x1bc75f[_0xbd97('0x2a')];}_0x22a3ff[_0xbd97('0x1b')](_0x5d1255)[_0xbd97('0x2b')](_0x1bc75f);};}exports[_0xbd97('0x2c')]=function(_0x37de42,_0x16c6d0){var _0x4d9676={},_0x427d94={},_0x4f8534={'count':0x0,'rows':[]};var _0x391730=_[_0xbd97('0x2d')](db[_0xbd97('0x2e')]['rawAttributes'],function(_0xfd2128){return{'name':_0xfd2128[_0xbd97('0x2f')],'type':_0xfd2128[_0xbd97('0x30')][_0xbd97('0x31')]};});_0x427d94[_0xbd97('0x32')]=_[_0xbd97('0x2d')](_0x391730,_0xbd97('0x2a'));_0x427d94['query']=_['keys'](_0x37de42[_0xbd97('0x33')]);_0x427d94[_0xbd97('0x34')]=_[_0xbd97('0x35')](_0x427d94[_0xbd97('0x32')],_0x427d94['query']);_0x4d9676['attributes']=_[_0xbd97('0x35')](_0x427d94[_0xbd97('0x32')],qs[_0xbd97('0x36')](_0x37de42['query'][_0xbd97('0x36')]));_0x4d9676[_0xbd97('0x37')]=_0x4d9676[_0xbd97('0x37')][_0xbd97('0x38')]?_0x4d9676['attributes']:_0x427d94['model'];if(!_0x37de42[_0xbd97('0x33')][_0xbd97('0x39')](_0xbd97('0x3a'))){_0x4d9676[_0xbd97('0x1e')]=qs[_0xbd97('0x1e')](_0x37de42[_0xbd97('0x33')][_0xbd97('0x1e')]);_0x4d9676[_0xbd97('0x1d')]=qs[_0xbd97('0x1d')](_0x37de42[_0xbd97('0x33')][_0xbd97('0x1d')]);}_0x4d9676['order']=qs[_0xbd97('0x3b')](_0x37de42['query'][_0xbd97('0x3b')]);_0x4d9676[_0xbd97('0x3c')]=qs['filters'](_[_0xbd97('0x3d')](_0x37de42[_0xbd97('0x33')],_0x427d94[_0xbd97('0x34')]),_0x391730);if(_0x37de42[_0xbd97('0x33')][_0xbd97('0x3e')]){_0x4d9676[_0xbd97('0x3c')]=_['merge'](_0x4d9676['where'],{'$or':_[_0xbd97('0x2d')](_0x391730,function(_0x5b49f9){if(_0x5b49f9['type']!=='VIRTUAL'){var _0x3f94c9={};_0x3f94c9[_0x5b49f9[_0xbd97('0x2a')]]={'$like':'%'+_0x37de42['query'][_0xbd97('0x3e')]+'%'};return _0x3f94c9;}})});}_0x4d9676=_[_0xbd97('0x3f')]({},_0x4d9676,_0x37de42[_0xbd97('0x40')]);var _0xc76121={'where':_0x4d9676[_0xbd97('0x3c')]};return db[_0xbd97('0x2e')][_0xbd97('0x20')](_0xc76121)[_0xbd97('0x41')](function(_0x287824){_0x4f8534[_0xbd97('0x20')]=_0x287824;if(_0x37de42[_0xbd97('0x33')][_0xbd97('0x42')]){_0x4d9676['include']=[{'all':!![]}];}return db[_0xbd97('0x2e')]['findAll'](_0x4d9676);})['then'](function(_0x3f0ba5){_0x4f8534[_0xbd97('0x43')]=_0x3f0ba5;return _0x4f8534;})[_0xbd97('0x41')](respondWithFilteredResult(_0x16c6d0,_0x4d9676))['catch'](handleError(_0x16c6d0,null));};exports['show']=function(_0x49a091,_0x496012){var _0x500dd8={'raw':![],'where':{'id':_0x49a091['params']['id']}},_0x2b29e2={};_0x2b29e2[_0xbd97('0x32')]=_[_0xbd97('0x44')](db['FreshdeskConfiguration'][_0xbd97('0x45')]);_0x2b29e2[_0xbd97('0x33')]=_[_0xbd97('0x44')](_0x49a091[_0xbd97('0x33')]);_0x2b29e2[_0xbd97('0x34')]=_[_0xbd97('0x35')](_0x2b29e2['model'],_0x2b29e2[_0xbd97('0x33')]);_0x500dd8[_0xbd97('0x37')]=_['intersection'](_0x2b29e2[_0xbd97('0x32')],qs[_0xbd97('0x36')](_0x49a091['query']['fields']));_0x500dd8['attributes']=_0x500dd8[_0xbd97('0x37')][_0xbd97('0x38')]?_0x500dd8['attributes']:_0x2b29e2[_0xbd97('0x32')];if(_0x49a091[_0xbd97('0x33')][_0xbd97('0x42')]){_0x500dd8[_0xbd97('0x46')]=[{'all':!![]}];}_0x500dd8=_['merge']({},_0x500dd8,_0x49a091[_0xbd97('0x40')]);return db[_0xbd97('0x2e')]['find'](_0x500dd8)[_0xbd97('0x41')](handleEntityNotFound(_0x496012,null))[_0xbd97('0x41')](respondWithResult(_0x496012,null))[_0xbd97('0x47')](handleError(_0x496012,null));};exports[_0xbd97('0x48')]=function(_0x126ead,_0x1c5cc2){return db[_0xbd97('0x2e')][_0xbd97('0x48')](_0x126ead['body'],{})[_0xbd97('0x41')](respondWithResult(_0x1c5cc2,0xc9))['catch'](handleError(_0x1c5cc2,null));};exports['update']=function(_0x58192b,_0x22dcdc){if(_0x58192b[_0xbd97('0x49')]['id']){delete _0x58192b['body']['id'];}return db['FreshdeskConfiguration'][_0xbd97('0x4a')]({'where':{'id':_0x58192b[_0xbd97('0x4b')]['id']}})['then'](handleEntityNotFound(_0x22dcdc,null))[_0xbd97('0x41')](saveUpdates(_0x58192b['body'],null))[_0xbd97('0x41')](respondWithResult(_0x22dcdc,null))['catch'](handleError(_0x22dcdc,null));};exports[_0xbd97('0x27')]=function(_0xe7ed29,_0x57b170){return db[_0xbd97('0x2e')][_0xbd97('0x4a')]({'where':{'id':_0xe7ed29[_0xbd97('0x4b')]['id']}})[_0xbd97('0x41')](handleEntityNotFound(_0x57b170,null))['then'](removeEntity(_0x57b170,null))[_0xbd97('0x47')](handleError(_0x57b170,null));};exports[_0xbd97('0x4c')]=function(_0x40dea1,_0x58313a,_0x20961b){var _0x4996f4={};var _0x550672={};var _0x3e4a02;var _0x3c9ec8;return db[_0xbd97('0x2e')][_0xbd97('0x4d')]({'where':{'id':_0x40dea1[_0xbd97('0x4b')]['id']}})['then'](handleEntityNotFound(_0x58313a,null))[_0xbd97('0x41')](function(_0x42caa2){if(_0x42caa2){_0x3e4a02=_0x42caa2;_0x550672[_0xbd97('0x32')]=_[_0xbd97('0x44')](db['FreshdeskField'][_0xbd97('0x45')]);_0x550672[_0xbd97('0x33')]=_[_0xbd97('0x44')](_0x40dea1[_0xbd97('0x33')]);_0x550672[_0xbd97('0x34')]=_['intersection'](_0x550672[_0xbd97('0x32')],_0x550672['query']);_0x4996f4[_0xbd97('0x37')]=_[_0xbd97('0x35')](_0x550672['model'],qs[_0xbd97('0x36')](_0x40dea1['query'][_0xbd97('0x36')]));_0x4996f4[_0xbd97('0x37')]=_0x4996f4[_0xbd97('0x37')][_0xbd97('0x38')]?_0x4996f4[_0xbd97('0x37')]:_0x550672[_0xbd97('0x32')];_0x4996f4[_0xbd97('0x4e')]=qs[_0xbd97('0x3b')](_0x40dea1['query'][_0xbd97('0x3b')]);_0x4996f4['where']=qs[_0xbd97('0x34')](_[_0xbd97('0x3d')](_0x40dea1[_0xbd97('0x33')],_0x550672['filters']));if(_0x40dea1[_0xbd97('0x33')][_0xbd97('0x3e')]){_0x4996f4[_0xbd97('0x3c')]=_[_0xbd97('0x3f')](_0x4996f4[_0xbd97('0x3c')],{'$or':_[_0xbd97('0x2d')](_0x4996f4[_0xbd97('0x37')],function(_0x4cf671){var _0x425f91={};_0x425f91[_0x4cf671]={'$like':'%'+_0x40dea1[_0xbd97('0x33')][_0xbd97('0x3e')]+'%'};return _0x425f91;})});}_0x4996f4=_[_0xbd97('0x3f')]({},_0x4996f4,_0x40dea1[_0xbd97('0x40')]);return _0x3e4a02[_0xbd97('0x4c')](_0x4996f4);}})[_0xbd97('0x41')](function(_0x5762c5){if(_0x5762c5){_0x3c9ec8=_0x5762c5['length'];if(!_0x40dea1['query'][_0xbd97('0x39')](_0xbd97('0x3a'))){_0x4996f4[_0xbd97('0x1e')]=qs[_0xbd97('0x1e')](_0x40dea1[_0xbd97('0x33')][_0xbd97('0x1e')]);_0x4996f4[_0xbd97('0x1d')]=qs[_0xbd97('0x1d')](_0x40dea1[_0xbd97('0x33')][_0xbd97('0x1d')]);}return _0x3e4a02[_0xbd97('0x4c')](_0x4996f4);}})[_0xbd97('0x41')](function(_0x357221){if(_0x357221){return _0x357221?{'count':_0x3c9ec8,'rows':_0x357221}:null;}})[_0xbd97('0x41')](respondWithResult(_0x58313a,null))[_0xbd97('0x47')](handleError(_0x58313a,null));};exports[_0xbd97('0x4f')]=function(_0x2f54eb,_0x1cd26a,_0x2f898a){var _0x5906f6={};var _0x176de0={};var _0xdebc90;var _0xa0c13b;return db['FreshdeskConfiguration'][_0xbd97('0x4d')]({'where':{'id':_0x2f54eb[_0xbd97('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1cd26a,null))[_0xbd97('0x41')](function(_0x270c84){if(_0x270c84){_0xdebc90=_0x270c84;_0x176de0[_0xbd97('0x32')]=_[_0xbd97('0x44')](db[_0xbd97('0x50')][_0xbd97('0x45')]);_0x176de0[_0xbd97('0x33')]=_[_0xbd97('0x44')](_0x2f54eb['query']);_0x176de0[_0xbd97('0x34')]=_['intersection'](_0x176de0['model'],_0x176de0['query']);_0x5906f6[_0xbd97('0x37')]=_[_0xbd97('0x35')](_0x176de0[_0xbd97('0x32')],qs[_0xbd97('0x36')](_0x2f54eb[_0xbd97('0x33')][_0xbd97('0x36')]));_0x5906f6[_0xbd97('0x37')]=_0x5906f6[_0xbd97('0x37')][_0xbd97('0x38')]?_0x5906f6[_0xbd97('0x37')]:_0x176de0[_0xbd97('0x32')];_0x5906f6['order']=qs[_0xbd97('0x3b')](_0x2f54eb[_0xbd97('0x33')][_0xbd97('0x3b')]);_0x5906f6[_0xbd97('0x3c')]=qs[_0xbd97('0x34')](_[_0xbd97('0x3d')](_0x2f54eb['query'],_0x176de0[_0xbd97('0x34')]));if(_0x2f54eb[_0xbd97('0x33')][_0xbd97('0x3e')]){_0x5906f6['where']=_['merge'](_0x5906f6[_0xbd97('0x3c')],{'$or':_['map'](_0x5906f6['attributes'],function(_0x16ab9e){var _0x196606={};_0x196606[_0x16ab9e]={'$like':'%'+_0x2f54eb[_0xbd97('0x33')][_0xbd97('0x3e')]+'%'};return _0x196606;})});}_0x5906f6=_[_0xbd97('0x3f')]({},_0x5906f6,_0x2f54eb['options']);return _0xdebc90['getSubjects'](_0x5906f6);}})[_0xbd97('0x41')](function(_0xca99c7){if(_0xca99c7){_0xa0c13b=_0xca99c7[_0xbd97('0x38')];if(!_0x2f54eb['query'][_0xbd97('0x39')]('nolimit')){_0x5906f6['limit']=qs[_0xbd97('0x1e')](_0x2f54eb[_0xbd97('0x33')][_0xbd97('0x1e')]);_0x5906f6['offset']=qs[_0xbd97('0x1d')](_0x2f54eb[_0xbd97('0x33')][_0xbd97('0x1d')]);}return _0xdebc90['getSubjects'](_0x5906f6);}})[_0xbd97('0x41')](function(_0x5aff27){if(_0x5aff27){return _0x5aff27?{'count':_0xa0c13b,'rows':_0x5aff27}:null;}})[_0xbd97('0x41')](respondWithResult(_0x1cd26a,null))['catch'](handleError(_0x1cd26a,null));};exports[_0xbd97('0x51')]=function(_0x38b21f,_0x127ffc,_0x1f0cea){var _0x57c629={};var _0x275de5={};var _0x3c5b43;var _0x37df70;return db[_0xbd97('0x2e')][_0xbd97('0x4d')]({'where':{'id':_0x38b21f[_0xbd97('0x4b')]['id']}})[_0xbd97('0x41')](handleEntityNotFound(_0x127ffc,null))[_0xbd97('0x41')](function(_0x31ce0d){if(_0x31ce0d){_0x3c5b43=_0x31ce0d;_0x275de5['model']=_[_0xbd97('0x44')](db[_0xbd97('0x50')][_0xbd97('0x45')]);_0x275de5['query']=_['keys'](_0x38b21f['query']);_0x275de5[_0xbd97('0x34')]=_[_0xbd97('0x35')](_0x275de5['model'],_0x275de5[_0xbd97('0x33')]);_0x57c629['attributes']=_[_0xbd97('0x35')](_0x275de5[_0xbd97('0x32')],qs[_0xbd97('0x36')](_0x38b21f[_0xbd97('0x33')][_0xbd97('0x36')]));_0x57c629[_0xbd97('0x37')]=_0x57c629[_0xbd97('0x37')][_0xbd97('0x38')]?_0x57c629[_0xbd97('0x37')]:_0x275de5[_0xbd97('0x32')];_0x57c629[_0xbd97('0x4e')]=qs[_0xbd97('0x3b')](_0x38b21f[_0xbd97('0x33')]['sort']);_0x57c629['where']=qs[_0xbd97('0x34')](_['pick'](_0x38b21f['query'],_0x275de5[_0xbd97('0x34')]));if(_0x38b21f[_0xbd97('0x33')][_0xbd97('0x3e')]){_0x57c629[_0xbd97('0x3c')]=_['merge'](_0x57c629[_0xbd97('0x3c')],{'$or':_['map'](_0x57c629[_0xbd97('0x37')],function(_0x4e2b95){var _0x7fade0={};_0x7fade0[_0x4e2b95]={'$like':'%'+_0x38b21f[_0xbd97('0x33')][_0xbd97('0x3e')]+'%'};return _0x7fade0;})});}_0x57c629=_[_0xbd97('0x3f')]({},_0x57c629,_0x38b21f[_0xbd97('0x40')]);return _0x3c5b43['getDescriptions'](_0x57c629);}})['then'](function(_0x70c7a5){if(_0x70c7a5){_0x37df70=_0x70c7a5['length'];if(!_0x38b21f[_0xbd97('0x33')][_0xbd97('0x39')](_0xbd97('0x3a'))){_0x57c629[_0xbd97('0x1e')]=qs[_0xbd97('0x1e')](_0x38b21f[_0xbd97('0x33')][_0xbd97('0x1e')]);_0x57c629['offset']=qs[_0xbd97('0x1d')](_0x38b21f[_0xbd97('0x33')][_0xbd97('0x1d')]);}return _0x3c5b43[_0xbd97('0x51')](_0x57c629);}})['then'](function(_0x289012){if(_0x289012){return _0x289012?{'count':_0x37df70,'rows':_0x289012}:null;}})[_0xbd97('0x41')](respondWithResult(_0x127ffc,null))[_0xbd97('0x47')](handleError(_0x127ffc,null));};exports[_0xbd97('0x52')]=function(_0x1d63ea,_0x2ff362,_0x22c1ee){var _0x2d189a={};var _0x4a41e8={};var _0x204e6d;var _0x216cc7;return db[_0xbd97('0x2e')][_0xbd97('0x4d')]({'where':{'id':_0x1d63ea[_0xbd97('0x4b')]['id']}})[_0xbd97('0x41')](handleEntityNotFound(_0x2ff362,null))[_0xbd97('0x41')](function(_0x12f803){if(_0x12f803){_0x204e6d=_0x12f803;_0x4a41e8[_0xbd97('0x32')]=_['keys'](db[_0xbd97('0x53')]['rawAttributes']);_0x4a41e8[_0xbd97('0x33')]=_[_0xbd97('0x44')](_0x1d63ea[_0xbd97('0x33')]);_0x4a41e8[_0xbd97('0x34')]=_[_0xbd97('0x35')](_0x4a41e8[_0xbd97('0x32')],_0x4a41e8['query']);_0x2d189a[_0xbd97('0x37')]=_[_0xbd97('0x35')](_0x4a41e8[_0xbd97('0x32')],qs[_0xbd97('0x36')](_0x1d63ea[_0xbd97('0x33')][_0xbd97('0x36')]));_0x2d189a[_0xbd97('0x37')]=_0x2d189a[_0xbd97('0x37')][_0xbd97('0x38')]?_0x2d189a[_0xbd97('0x37')]:_0x4a41e8[_0xbd97('0x32')];_0x2d189a[_0xbd97('0x4e')]=qs[_0xbd97('0x3b')](_0x1d63ea[_0xbd97('0x33')]['sort']);_0x2d189a['where']=qs[_0xbd97('0x34')](_[_0xbd97('0x3d')](_0x1d63ea[_0xbd97('0x33')],_0x4a41e8[_0xbd97('0x34')]));if(_0x1d63ea[_0xbd97('0x33')][_0xbd97('0x3e')]){_0x2d189a['where']=_[_0xbd97('0x3f')](_0x2d189a['where'],{'$or':_[_0xbd97('0x2d')](_0x2d189a[_0xbd97('0x37')],function(_0x53485c){var _0x154cc4={};_0x154cc4[_0x53485c]={'$like':'%'+_0x1d63ea['query']['filter']+'%'};return _0x154cc4;})});}_0x2d189a=_[_0xbd97('0x3f')]({},_0x2d189a,_0x1d63ea[_0xbd97('0x40')]);return _0x204e6d['getTags'](_0x2d189a);}})[_0xbd97('0x41')](function(_0x844f6c){if(_0x844f6c){_0x216cc7=_0x844f6c[_0xbd97('0x38')];if(!_0x1d63ea[_0xbd97('0x33')]['hasOwnProperty']('nolimit')){_0x2d189a[_0xbd97('0x1e')]=qs['limit'](_0x1d63ea[_0xbd97('0x33')][_0xbd97('0x1e')]);_0x2d189a[_0xbd97('0x1d')]=qs[_0xbd97('0x1d')](_0x1d63ea['query'][_0xbd97('0x1d')]);}return _0x204e6d['getTags'](_0x2d189a);}})[_0xbd97('0x41')](function(_0xa9e983){if(_0xa9e983){return _0xa9e983?{'count':_0x216cc7,'rows':_0xa9e983}:null;}})[_0xbd97('0x41')](respondWithResult(_0x2ff362,null))[_0xbd97('0x47')](handleError(_0x2ff362,null));};exports[_0xbd97('0x54')]=function(_0x437c89,_0x2cea8a,_0x39135c){if(_0x437c89[_0xbd97('0x49')]['id']){delete _0x437c89[_0xbd97('0x49')]['id'];}return db[_0xbd97('0x2e')][_0xbd97('0x4d')]({'where':{'id':_0x437c89[_0xbd97('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2cea8a,null))[_0xbd97('0x41')](function(_0x16aacb){if(_0x16aacb){return _0x16aacb[_0xbd97('0x54')](_0x437c89['body'][_0xbd97('0x55')]||[]);}return null;})[_0xbd97('0x41')](respondWithResult(_0x2cea8a,null))['catch'](handleError(_0x2cea8a,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 553bbaf..8d2b891 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 _0x2cc0=['lodash','util','../../config/logger','api','bluebird','rimraf','exports','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x1aebc8,_0x235ef3){var _0x24e4f5=function(_0x95bb36){while(--_0x95bb36){_0x1aebc8['push'](_0x1aebc8['shift']());}};_0x24e4f5(++_0x235ef3);}(_0x2cc0,0x1f4));var _0x02cc=function(_0x64bc77,_0x2ba780){_0x64bc77=_0x64bc77-0x0;var _0x4cb281=_0x2cc0[_0x64bc77];return _0x4cb281;};'use strict';var _=require(_0x02cc('0x0'));var util=require(_0x02cc('0x1'));var logger=require(_0x02cc('0x2'))(_0x02cc('0x3'));var moment=require('moment');var BPromise=require(_0x02cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x02cc('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x02cc('0x6')]=function(_0x2d1fb0,_0x1e5cb2){return _0x2d1fb0[_0x02cc('0x7')](_0x02cc('0x8'),attributes,{'tableName':_0x02cc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb97d=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1a7697,_0x469f4e){var _0x4d2dc8=function(_0x1f6849){while(--_0x1f6849){_0x1a7697['push'](_0x1a7697['shift']());}};_0x4d2dc8(++_0x469f4e);}(_0xb97d,0x115));var _0xdb97=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xb97d[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xdb97('0x0'));var util=require(_0xdb97('0x1'));var logger=require(_0xdb97('0x2'))(_0xdb97('0x3'));var moment=require(_0xdb97('0x4'));var BPromise=require(_0xdb97('0x5'));var rp=require(_0xdb97('0x6'));var fs=require('fs');var path=require(_0xdb97('0x7'));var rimraf=require(_0xdb97('0x8'));var config=require(_0xdb97('0x9'));var attributes=require(_0xdb97('0xa'));module[_0xdb97('0xb')]=function(_0x3ee5bd,_0x1f14c4){return _0x3ee5bd['define'](_0xdb97('0xc'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index bb56c37..392d561 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 _0x6ced=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6ced,0x1e4));var _0xd6ce=function(_0x59099c,_0x533869){_0x59099c=_0x59099c-0x0;var _0x3a4c8c=_0x6ced[_0x59099c];return _0x3a4c8c;};'use strict';var _=require(_0xd6ce('0x0'));var util=require(_0xd6ce('0x1'));var moment=require(_0xd6ce('0x2'));var BPromise=require('bluebird');var rs=require(_0xd6ce('0x3'));var fs=require('fs');var Redis=require(_0xd6ce('0x4'));var db=require(_0xd6ce('0x5'))['db'];var utils=require(_0xd6ce('0x6'));var logger=require('../../config/logger')(_0xd6ce('0x7'));var config=require(_0xd6ce('0x8'));var jayson=require(_0xd6ce('0x9'));var client=jayson[_0xd6ce('0xa')][_0xd6ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f24e,_0x56943e,_0x3905a0){return new BPromise(function(_0x4672a0,_0x39c917){return client['request'](_0x21f24e,_0x3905a0)['then'](function(_0x6bec68){logger[_0xd6ce('0xc')](_0xd6ce('0xd'),_0x56943e,'request\x20sent');logger[_0xd6ce('0xe')](_0xd6ce('0xf'),_0x56943e,_0xd6ce('0x10'),JSON[_0xd6ce('0x11')](_0x6bec68));if(_0x6bec68['error']){if(_0x6bec68[_0xd6ce('0x12')][_0xd6ce('0x13')]===0x1f4){logger[_0xd6ce('0x12')](_0xd6ce('0xd'),_0x56943e,_0x6bec68[_0xd6ce('0x12')][_0xd6ce('0x14')]);return _0x39c917(_0x6bec68['error']['message']);}logger[_0xd6ce('0x12')](_0xd6ce('0xd'),_0x56943e,_0x6bec68[_0xd6ce('0x12')][_0xd6ce('0x14')]);return _0x4672a0(_0x6bec68[_0xd6ce('0x12')]['message']);}else{logger[_0xd6ce('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x56943e,'request\x20sent');_0x4672a0(_0x6bec68[_0xd6ce('0x15')][_0xd6ce('0x14')]);}})[_0xd6ce('0x16')](function(_0x8c7e73){logger[_0xd6ce('0x12')](_0xd6ce('0xd'),_0x56943e,_0x8c7e73);_0x39c917(_0x8c7e73);});});} \ No newline at end of file +var _0x3243=['client','request','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x17093e,_0x4b3a88){var _0x49fb28=function(_0xc0afa3){while(--_0xc0afa3){_0x17093e['push'](_0x17093e['shift']());}};_0x49fb28(++_0x4b3a88);}(_0x3243,0x76));var _0x3324=function(_0x4aaf1e,_0x45f564){_0x4aaf1e=_0x4aaf1e-0x0;var _0x154c3=_0x3243[_0x4aaf1e];return _0x154c3;};'use strict';var _=require(_0x3324('0x0'));var util=require('util');var moment=require(_0x3324('0x1'));var BPromise=require(_0x3324('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3324('0x3'))['db'];var utils=require(_0x3324('0x4'));var logger=require(_0x3324('0x5'))(_0x3324('0x6'));var config=require('../../config/environment');var jayson=require(_0x3324('0x7'));var client=jayson[_0x3324('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e2789,_0x5d6bac,_0x4068ed){return new BPromise(function(_0x97e09e,_0x9bd923){return client[_0x3324('0x9')](_0x1e2789,_0x4068ed)['then'](function(_0x2092f3){logger[_0x3324('0xa')](_0x3324('0xb'),_0x5d6bac,'request\x20sent');logger[_0x3324('0xc')](_0x3324('0xd'),_0x5d6bac,'request\x20sent',JSON[_0x3324('0xe')](_0x2092f3));if(_0x2092f3[_0x3324('0xf')]){if(_0x2092f3[_0x3324('0xf')][_0x3324('0x10')]===0x1f4){logger[_0x3324('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5d6bac,_0x2092f3[_0x3324('0xf')][_0x3324('0x11')]);return _0x9bd923(_0x2092f3[_0x3324('0xf')]['message']);}logger[_0x3324('0xf')](_0x3324('0xb'),_0x5d6bac,_0x2092f3[_0x3324('0xf')][_0x3324('0x11')]);return _0x97e09e(_0x2092f3[_0x3324('0xf')][_0x3324('0x11')]);}else{logger[_0x3324('0xa')](_0x3324('0xb'),_0x5d6bac,_0x3324('0x12'));_0x97e09e(_0x2092f3[_0x3324('0x13')][_0x3324('0x11')]);}})[_0x3324('0x14')](function(_0x90933a){logger[_0x3324('0xf')](_0x3324('0xb'),_0x5d6bac,_0x90933a);_0x9bd923(_0x90933a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 5c4f90e..078c742 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 _0x10f8=['Router','../../components/auth/service','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x52d367,_0x3cdae6){var _0xe8c4d3=function(_0x59bffe){while(--_0x59bffe){_0x52d367['push'](_0x52d367['shift']());}};_0xe8c4d3(++_0x3cdae6);}(_0x10f8,0xb6));var _0x810f=function(_0x3ce937,_0x568d7d){_0x3ce937=_0x3ce937-0x0;var _0x41d2fa=_0x10f8[_0x3ce937];return _0x41d2fa;};'use strict';var multer=require(_0x810f('0x0'));var util=require(_0x810f('0x1'));var path=require(_0x810f('0x2'));var timeout=require(_0x810f('0x3'));var express=require(_0x810f('0x4'));var router=express[_0x810f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x810f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x810f('0x7'));router[_0x810f('0x8')]('/',auth[_0x810f('0x9')](),controller[_0x810f('0xa')]);router[_0x810f('0x8')](_0x810f('0xb'),auth['isAuthenticated'](),controller[_0x810f('0xc')]);router['post']('/',auth[_0x810f('0x9')](),controller['create']);router[_0x810f('0xd')](_0x810f('0xb'),auth[_0x810f('0x9')](),controller[_0x810f('0xe')]);router['delete']('/:id',auth[_0x810f('0x9')](),controller[_0x810f('0xf')]);module[_0x810f('0x10')]=router; \ No newline at end of file +var _0xd7e7=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','multer','path','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7e7,0xc8));var _0x7d7e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd7e7[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x7d7e('0x0'));var util=require('util');var path=require(_0x7d7e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7d7e('0x2')]();var fs_extra=require(_0x7d7e('0x3'));var auth=require(_0x7d7e('0x4'));var interaction=require(_0x7d7e('0x5'));var config=require(_0x7d7e('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x7d7e('0x7')]('/',auth[_0x7d7e('0x8')](),controller[_0x7d7e('0x9')]);router['get']('/:id',auth[_0x7d7e('0x8')](),controller[_0x7d7e('0xa')]);router[_0x7d7e('0xb')]('/',auth[_0x7d7e('0x8')](),controller[_0x7d7e('0xc')]);router[_0x7d7e('0xd')](_0x7d7e('0xe'),auth[_0x7d7e('0x8')](),controller[_0x7d7e('0xf')]);router['delete'](_0x7d7e('0xe'),auth[_0x7d7e('0x8')](),controller[_0x7d7e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 970edd6..cf999f2 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 _0x7e16=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0x7e16,0x1a1));var _0x67e1=function(_0x1f5c56,_0x20370f){_0x1f5c56=_0x1f5c56-0x0;var _0x3ce4ef=_0x7e16[_0x1f5c56];return _0x3ce4ef;};'use strict';var Sequelize=require(_0x67e1('0x0'));module[_0x67e1('0x1')]={'type':{'type':Sequelize['ENUM'](_0x67e1('0x2'),_0x67e1('0x3'),_0x67e1('0x4'),_0x67e1('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x67e1('0x6')]},'key':{'type':Sequelize[_0x67e1('0x6')]},'keyType':{'type':Sequelize[_0x67e1('0x7')]('string',_0x67e1('0x3'),_0x67e1('0x4'))},'keyContent':{'type':Sequelize[_0x67e1('0x6')]},'idField':{'type':Sequelize[_0x67e1('0x6')]},'nameField':{'type':Sequelize[_0x67e1('0x6')]},'customField':{'type':Sequelize[_0x67e1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x67e1('0x6')]}}; \ No newline at end of file +var _0xa038=['picklist','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x3307de,_0x56060e){var _0x25bc40=function(_0x52baca){while(--_0x52baca){_0x3307de['push'](_0x3307de['shift']());}};_0x25bc40(++_0x56060e);}(_0xa038,0x1e1));var _0x8a03=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xa038[_0x58e469];return _0x4c01c5;};'use strict';var Sequelize=require(_0x8a03('0x0'));module[_0x8a03('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x8a03('0x2'),_0x8a03('0x3'),_0x8a03('0x4'),_0x8a03('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8a03('0x6')]},'keyType':{'type':Sequelize[_0x8a03('0x7')]('string',_0x8a03('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x8a03('0x6')]},'idField':{'type':Sequelize[_0x8a03('0x6')]},'nameField':{'type':Sequelize[_0x8a03('0x6')]},'customField':{'type':Sequelize[_0x8a03('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8a03('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 1fa7396..fb212ba 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 _0x657b=['order','sort','pick','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','save','update','then','sendStatus','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x36deab,_0x943434){var _0x3c907d=function(_0x5a339a){while(--_0x5a339a){_0x36deab['push'](_0x36deab['shift']());}};_0x3c907d(++_0x943434);}(_0x657b,0x131));var _0xb657=function(_0x216843,_0xea9e59){_0x216843=_0x216843-0x0;var _0x4c98bf=_0x657b[_0x216843];return _0x4c98bf;};'use strict';var emlformat=require(_0xb657('0x0'));var rimraf=require(_0xb657('0x1'));var zipdir=require(_0xb657('0x2'));var jsonpatch=require(_0xb657('0x3'));var rp=require(_0xb657('0x4'));var moment=require('moment');var BPromise=require(_0xb657('0x5'));var Mustache=require(_0xb657('0x6'));var util=require('util');var path=require(_0xb657('0x7'));var sox=require(_0xb657('0x8'));var csv=require(_0xb657('0x9'));var ejs=require(_0xb657('0xa'));var fs=require('fs');var fs_extra=require(_0xb657('0xb'));var _=require('lodash');var squel=require(_0xb657('0xc'));var crypto=require('crypto');var jsforce=require(_0xb657('0xd'));var deskjs=require(_0xb657('0xe'));var toCsv=require(_0xb657('0x9'));var querystring=require('querystring');var Papa=require(_0xb657('0xf'));var Redis=require('ioredis');var authService=require(_0xb657('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb657('0x11'));var hardwareService=require(_0xb657('0x12'));var logger=require(_0xb657('0x13'))('api');var utils=require(_0xb657('0x14'));var config=require(_0xb657('0x15'));var licenseUtil=require(_0xb657('0x16'));var db=require(_0xb657('0x17'))['db'];function respondWithStatusCode(_0x51228b,_0x3e1ea1){_0x3e1ea1=_0x3e1ea1||0xcc;return function(_0x3ebcc2){if(_0x3ebcc2){return _0x51228b['sendStatus'](_0x3e1ea1);}return _0x51228b[_0xb657('0x18')](_0x3e1ea1)[_0xb657('0x19')]();};}function respondWithResult(_0xf04de9,_0x3ca0b4){_0x3ca0b4=_0x3ca0b4||0xc8;return function(_0x4aedb7){if(_0x4aedb7){return _0xf04de9[_0xb657('0x18')](_0x3ca0b4)[_0xb657('0x1a')](_0x4aedb7);}};}function respondWithFilteredResult(_0x511057,_0x4d253b){return function(_0x144eaf){if(_0x144eaf){var _0xbde891=typeof _0x4d253b[_0xb657('0x1b')]===_0xb657('0x1c')&&typeof _0x4d253b[_0xb657('0x1d')]===_0xb657('0x1c');var _0x20919b=_0x144eaf[_0xb657('0x1e')];var _0x9e98be=_0xbde891?0x0:_0x4d253b[_0xb657('0x1b')];var _0x2f0ba0=_0xbde891?_0x144eaf['count']:_0x4d253b[_0xb657('0x1b')]+_0x4d253b[_0xb657('0x1d')];var _0x21474b;if(_0x2f0ba0>=_0x20919b){_0x2f0ba0=_0x20919b;_0x21474b=0xc8;}else{_0x21474b=0xce;}_0x511057[_0xb657('0x18')](_0x21474b);return _0x511057['set']('Content-Range',_0x9e98be+'-'+_0x2f0ba0+'/'+_0x20919b)[_0xb657('0x1a')](_0x144eaf);}return null;};}function patchUpdates(_0x926b57){return function(_0xee3c7e){try{jsonpatch['apply'](_0xee3c7e,_0x926b57,!![]);}catch(_0x19f1e9){return BPromise['reject'](_0x19f1e9);}return _0xee3c7e[_0xb657('0x1f')]();};}function saveUpdates(_0x466a42,_0x2895ab){return function(_0x12fd7d){if(_0x12fd7d){return _0x12fd7d[_0xb657('0x20')](_0x466a42)['then'](function(_0x3de4eb){return _0x3de4eb;});}return null;};}function removeEntity(_0x13cea8,_0x38b4a0){return function(_0xfdd680){if(_0xfdd680){return _0xfdd680['destroy']()[_0xb657('0x21')](function(){_0x13cea8['status'](0xcc)[_0xb657('0x19')]();});}};}function handleEntityNotFound(_0x4e8587,_0x221794){return function(_0x4fe1c5){if(!_0x4fe1c5){_0x4e8587[_0xb657('0x22')](0x194);}return _0x4fe1c5;};}function handleError(_0x154f83,_0x5d4b01){_0x5d4b01=_0x5d4b01||0x1f4;return function(_0x241301){logger[_0xb657('0x23')](_0x241301[_0xb657('0x24')]);if(_0x241301['name']){delete _0x241301[_0xb657('0x25')];}_0x154f83[_0xb657('0x18')](_0x5d4b01)[_0xb657('0x26')](_0x241301);};}exports[_0xb657('0x27')]=function(_0x37a5af,_0xba9c05){var _0x66d5af={},_0x3be5de={},_0x291a32={'count':0x0,'rows':[]};var _0x410a93=_[_0xb657('0x28')](db[_0xb657('0x29')][_0xb657('0x2a')],function(_0x292fb1){return{'name':_0x292fb1[_0xb657('0x2b')],'type':_0x292fb1[_0xb657('0x2c')][_0xb657('0x2d')]};});_0x3be5de['model']=_[_0xb657('0x28')](_0x410a93,'name');_0x3be5de[_0xb657('0x2e')]=_[_0xb657('0x2f')](_0x37a5af['query']);_0x3be5de[_0xb657('0x30')]=_[_0xb657('0x31')](_0x3be5de[_0xb657('0x32')],_0x3be5de[_0xb657('0x2e')]);_0x66d5af[_0xb657('0x33')]=_['intersection'](_0x3be5de[_0xb657('0x32')],qs[_0xb657('0x34')](_0x37a5af[_0xb657('0x2e')][_0xb657('0x34')]));_0x66d5af[_0xb657('0x33')]=_0x66d5af['attributes'][_0xb657('0x35')]?_0x66d5af[_0xb657('0x33')]:_0x3be5de[_0xb657('0x32')];if(!_0x37a5af['query'][_0xb657('0x36')]('nolimit')){_0x66d5af[_0xb657('0x1d')]=qs[_0xb657('0x1d')](_0x37a5af[_0xb657('0x2e')][_0xb657('0x1d')]);_0x66d5af[_0xb657('0x1b')]=qs[_0xb657('0x1b')](_0x37a5af[_0xb657('0x2e')][_0xb657('0x1b')]);}_0x66d5af[_0xb657('0x37')]=qs[_0xb657('0x38')](_0x37a5af[_0xb657('0x2e')]['sort']);_0x66d5af['where']=qs[_0xb657('0x30')](_[_0xb657('0x39')](_0x37a5af[_0xb657('0x2e')],_0x3be5de[_0xb657('0x30')]),_0x410a93);if(_0x37a5af[_0xb657('0x2e')][_0xb657('0x3a')]){_0x66d5af['where']=_[_0xb657('0x3b')](_0x66d5af['where'],{'$or':_[_0xb657('0x28')](_0x410a93,function(_0xb37c21){if(_0xb37c21[_0xb657('0x2c')]!==_0xb657('0x3c')){var _0x3e854e={};_0x3e854e[_0xb37c21['name']]={'$like':'%'+_0x37a5af[_0xb657('0x2e')][_0xb657('0x3a')]+'%'};return _0x3e854e;}})});}_0x66d5af=_[_0xb657('0x3b')]({},_0x66d5af,_0x37a5af[_0xb657('0x3d')]);var _0x53941c={'where':_0x66d5af[_0xb657('0x3e')]};return db[_0xb657('0x29')][_0xb657('0x1e')](_0x53941c)[_0xb657('0x21')](function(_0x229f48){_0x291a32['count']=_0x229f48;if(_0x37a5af[_0xb657('0x2e')]['includeAll']){_0x66d5af[_0xb657('0x3f')]=[{'all':!![]}];}return db['FreshdeskField'][_0xb657('0x40')](_0x66d5af);})[_0xb657('0x21')](function(_0x2397c3){_0x291a32[_0xb657('0x41')]=_0x2397c3;return _0x291a32;})[_0xb657('0x21')](respondWithFilteredResult(_0xba9c05,_0x66d5af))[_0xb657('0x42')](handleError(_0xba9c05,null));};exports['show']=function(_0x199b64,_0x3583f1){var _0x22b735={'raw':!![],'where':{'id':_0x199b64[_0xb657('0x43')]['id']}},_0x5c9c67={};_0x5c9c67[_0xb657('0x32')]=_[_0xb657('0x2f')](db[_0xb657('0x29')][_0xb657('0x2a')]);_0x5c9c67[_0xb657('0x2e')]=_[_0xb657('0x2f')](_0x199b64[_0xb657('0x2e')]);_0x5c9c67[_0xb657('0x30')]=_['intersection'](_0x5c9c67[_0xb657('0x32')],_0x5c9c67['query']);_0x22b735[_0xb657('0x33')]=_[_0xb657('0x31')](_0x5c9c67['model'],qs[_0xb657('0x34')](_0x199b64['query']['fields']));_0x22b735[_0xb657('0x33')]=_0x22b735[_0xb657('0x33')][_0xb657('0x35')]?_0x22b735[_0xb657('0x33')]:_0x5c9c67['model'];if(_0x199b64[_0xb657('0x2e')][_0xb657('0x44')]){_0x22b735[_0xb657('0x3f')]=[{'all':!![]}];}_0x22b735=_[_0xb657('0x3b')]({},_0x22b735,_0x199b64[_0xb657('0x3d')]);return db['FreshdeskField'][_0xb657('0x45')](_0x22b735)['then'](handleEntityNotFound(_0x3583f1,null))['then'](respondWithResult(_0x3583f1,null))['catch'](handleError(_0x3583f1,null));};exports[_0xb657('0x46')]=function(_0x4a4a38,_0x2367aa){return db[_0xb657('0x29')][_0xb657('0x46')](_0x4a4a38['body'],{})[_0xb657('0x21')](respondWithResult(_0x2367aa,0xc9))[_0xb657('0x42')](handleError(_0x2367aa,null));};exports[_0xb657('0x20')]=function(_0x8178df,_0x2b957b){if(_0x8178df[_0xb657('0x47')]['id']){delete _0x8178df['body']['id'];}return db[_0xb657('0x29')][_0xb657('0x45')]({'where':{'id':_0x8178df['params']['id']}})[_0xb657('0x21')](handleEntityNotFound(_0x2b957b,null))['then'](saveUpdates(_0x8178df[_0xb657('0x47')],null))['then'](respondWithResult(_0x2b957b,null))[_0xb657('0x42')](handleError(_0x2b957b,null));};exports['destroy']=function(_0x385228,_0x5b6e64){return db[_0xb657('0x29')][_0xb657('0x45')]({'where':{'id':_0x385228[_0xb657('0x43')]['id']}})[_0xb657('0x21')](handleEntityNotFound(_0x5b6e64,null))[_0xb657('0x21')](removeEntity(_0x5b6e64,null))['catch'](handleError(_0x5b6e64,null));}; \ No newline at end of file +var _0xb921=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','error','stack','name','index','FreshdeskField','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','params','include','options','create','body','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x14e30d,_0x160848){var _0x260a59=function(_0x57eba5){while(--_0x57eba5){_0x14e30d['push'](_0x14e30d['shift']());}};_0x260a59(++_0x160848);}(_0xb921,0x16a));var _0x1b92=function(_0x4a73dd,_0x58e46c){_0x4a73dd=_0x4a73dd-0x0;var _0x279e6b=_0xb921[_0x4a73dd];return _0x279e6b;};'use strict';var emlformat=require(_0x1b92('0x0'));var rimraf=require(_0x1b92('0x1'));var zipdir=require(_0x1b92('0x2'));var jsonpatch=require(_0x1b92('0x3'));var rp=require(_0x1b92('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b92('0x5'));var util=require(_0x1b92('0x6'));var path=require(_0x1b92('0x7'));var sox=require(_0x1b92('0x8'));var csv=require(_0x1b92('0x9'));var ejs=require(_0x1b92('0xa'));var fs=require('fs');var fs_extra=require(_0x1b92('0xb'));var _=require(_0x1b92('0xc'));var squel=require(_0x1b92('0xd'));var crypto=require(_0x1b92('0xe'));var jsforce=require(_0x1b92('0xf'));var deskjs=require(_0x1b92('0x10'));var toCsv=require(_0x1b92('0x9'));var querystring=require(_0x1b92('0x11'));var Papa=require(_0x1b92('0x12'));var Redis=require('ioredis');var authService=require(_0x1b92('0x13'));var qs=require(_0x1b92('0x14'));var as=require(_0x1b92('0x15'));var hardwareService=require(_0x1b92('0x16'));var logger=require(_0x1b92('0x17'))(_0x1b92('0x18'));var utils=require(_0x1b92('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1b92('0x1a'));var db=require(_0x1b92('0x1b'))['db'];function respondWithStatusCode(_0x5a1ca5,_0x81cbe0){_0x81cbe0=_0x81cbe0||0xcc;return function(_0x29a7ed){if(_0x29a7ed){return _0x5a1ca5[_0x1b92('0x1c')](_0x81cbe0);}return _0x5a1ca5[_0x1b92('0x1d')](_0x81cbe0)[_0x1b92('0x1e')]();};}function respondWithResult(_0x290be6,_0x1d33bf){_0x1d33bf=_0x1d33bf||0xc8;return function(_0x4bbb76){if(_0x4bbb76){return _0x290be6[_0x1b92('0x1d')](_0x1d33bf)['json'](_0x4bbb76);}};}function respondWithFilteredResult(_0x1a559b,_0x511a97){return function(_0x694d4f){if(_0x694d4f){var _0x523285=typeof _0x511a97[_0x1b92('0x1f')]===_0x1b92('0x20')&&typeof _0x511a97[_0x1b92('0x21')]==='undefined';var _0x2d171f=_0x694d4f[_0x1b92('0x22')];var _0x289523=_0x523285?0x0:_0x511a97[_0x1b92('0x1f')];var _0x4368dc=_0x523285?_0x694d4f['count']:_0x511a97[_0x1b92('0x1f')]+_0x511a97[_0x1b92('0x21')];var _0x30b0d8;if(_0x4368dc>=_0x2d171f){_0x4368dc=_0x2d171f;_0x30b0d8=0xc8;}else{_0x30b0d8=0xce;}_0x1a559b['status'](_0x30b0d8);return _0x1a559b[_0x1b92('0x23')](_0x1b92('0x24'),_0x289523+'-'+_0x4368dc+'/'+_0x2d171f)[_0x1b92('0x25')](_0x694d4f);}return null;};}function patchUpdates(_0x4bfc51){return function(_0x1d9d28){try{jsonpatch['apply'](_0x1d9d28,_0x4bfc51,!![]);}catch(_0x39ef4e){return BPromise[_0x1b92('0x26')](_0x39ef4e);}return _0x1d9d28['save']();};}function saveUpdates(_0x4ea25f,_0x34c5c9){return function(_0x311487){if(_0x311487){return _0x311487[_0x1b92('0x27')](_0x4ea25f)[_0x1b92('0x28')](function(_0x41fc82){return _0x41fc82;});}return null;};}function removeEntity(_0x186030,_0x48cdf1){return function(_0x3be220){if(_0x3be220){return _0x3be220[_0x1b92('0x29')]()[_0x1b92('0x28')](function(){_0x186030[_0x1b92('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f0e1b,_0x53025e){return function(_0x4369e2){if(!_0x4369e2){_0x3f0e1b[_0x1b92('0x1c')](0x194);}return _0x4369e2;};}function handleError(_0x1abb9a,_0x3c1fa1){_0x3c1fa1=_0x3c1fa1||0x1f4;return function(_0x3e353){logger[_0x1b92('0x2a')](_0x3e353[_0x1b92('0x2b')]);if(_0x3e353[_0x1b92('0x2c')]){delete _0x3e353['name'];}_0x1abb9a['status'](_0x3c1fa1)['send'](_0x3e353);};}exports[_0x1b92('0x2d')]=function(_0x525d05,_0x2c4e02){var _0x5d006b={},_0x462949={},_0x4656aa={'count':0x0,'rows':[]};var _0x26f832=_['map'](db[_0x1b92('0x2e')][_0x1b92('0x2f')],function(_0x55eafd){return{'name':_0x55eafd['fieldName'],'type':_0x55eafd[_0x1b92('0x30')][_0x1b92('0x31')]};});_0x462949[_0x1b92('0x32')]=_[_0x1b92('0x33')](_0x26f832,_0x1b92('0x2c'));_0x462949['query']=_[_0x1b92('0x34')](_0x525d05[_0x1b92('0x35')]);_0x462949[_0x1b92('0x36')]=_[_0x1b92('0x37')](_0x462949[_0x1b92('0x32')],_0x462949[_0x1b92('0x35')]);_0x5d006b[_0x1b92('0x38')]=_['intersection'](_0x462949[_0x1b92('0x32')],qs[_0x1b92('0x39')](_0x525d05['query'][_0x1b92('0x39')]));_0x5d006b[_0x1b92('0x38')]=_0x5d006b[_0x1b92('0x38')]['length']?_0x5d006b[_0x1b92('0x38')]:_0x462949[_0x1b92('0x32')];if(!_0x525d05['query']['hasOwnProperty'](_0x1b92('0x3a'))){_0x5d006b[_0x1b92('0x21')]=qs[_0x1b92('0x21')](_0x525d05[_0x1b92('0x35')]['limit']);_0x5d006b['offset']=qs['offset'](_0x525d05[_0x1b92('0x35')][_0x1b92('0x1f')]);}_0x5d006b[_0x1b92('0x3b')]=qs[_0x1b92('0x3c')](_0x525d05[_0x1b92('0x35')][_0x1b92('0x3c')]);_0x5d006b[_0x1b92('0x3d')]=qs['filters'](_[_0x1b92('0x3e')](_0x525d05[_0x1b92('0x35')],_0x462949['filters']),_0x26f832);if(_0x525d05[_0x1b92('0x35')][_0x1b92('0x3f')]){_0x5d006b[_0x1b92('0x3d')]=_[_0x1b92('0x40')](_0x5d006b[_0x1b92('0x3d')],{'$or':_[_0x1b92('0x33')](_0x26f832,function(_0x115e5f){if(_0x115e5f[_0x1b92('0x30')]!==_0x1b92('0x41')){var _0x14571e={};_0x14571e[_0x115e5f['name']]={'$like':'%'+_0x525d05[_0x1b92('0x35')]['filter']+'%'};return _0x14571e;}})});}_0x5d006b=_[_0x1b92('0x40')]({},_0x5d006b,_0x525d05['options']);var _0x4589fb={'where':_0x5d006b[_0x1b92('0x3d')]};return db[_0x1b92('0x2e')][_0x1b92('0x22')](_0x4589fb)[_0x1b92('0x28')](function(_0x29cda5){_0x4656aa[_0x1b92('0x22')]=_0x29cda5;if(_0x525d05[_0x1b92('0x35')][_0x1b92('0x42')]){_0x5d006b['include']=[{'all':!![]}];}return db[_0x1b92('0x2e')]['findAll'](_0x5d006b);})[_0x1b92('0x28')](function(_0x1e945){_0x4656aa[_0x1b92('0x43')]=_0x1e945;return _0x4656aa;})[_0x1b92('0x28')](respondWithFilteredResult(_0x2c4e02,_0x5d006b))['catch'](handleError(_0x2c4e02,null));};exports[_0x1b92('0x44')]=function(_0xfb5b49,_0x133500){var _0x469a88={'raw':!![],'where':{'id':_0xfb5b49[_0x1b92('0x45')]['id']}},_0xd3f7b0={};_0xd3f7b0['model']=_[_0x1b92('0x34')](db[_0x1b92('0x2e')][_0x1b92('0x2f')]);_0xd3f7b0[_0x1b92('0x35')]=_[_0x1b92('0x34')](_0xfb5b49[_0x1b92('0x35')]);_0xd3f7b0['filters']=_[_0x1b92('0x37')](_0xd3f7b0[_0x1b92('0x32')],_0xd3f7b0['query']);_0x469a88[_0x1b92('0x38')]=_['intersection'](_0xd3f7b0[_0x1b92('0x32')],qs[_0x1b92('0x39')](_0xfb5b49[_0x1b92('0x35')]['fields']));_0x469a88[_0x1b92('0x38')]=_0x469a88[_0x1b92('0x38')]['length']?_0x469a88['attributes']:_0xd3f7b0['model'];if(_0xfb5b49[_0x1b92('0x35')][_0x1b92('0x42')]){_0x469a88[_0x1b92('0x46')]=[{'all':!![]}];}_0x469a88=_[_0x1b92('0x40')]({},_0x469a88,_0xfb5b49[_0x1b92('0x47')]);return db[_0x1b92('0x2e')]['find'](_0x469a88)[_0x1b92('0x28')](handleEntityNotFound(_0x133500,null))[_0x1b92('0x28')](respondWithResult(_0x133500,null))['catch'](handleError(_0x133500,null));};exports[_0x1b92('0x48')]=function(_0x30dbb0,_0x121be9){return db['FreshdeskField'][_0x1b92('0x48')](_0x30dbb0[_0x1b92('0x49')],{})[_0x1b92('0x28')](respondWithResult(_0x121be9,0xc9))[_0x1b92('0x4a')](handleError(_0x121be9,null));};exports[_0x1b92('0x27')]=function(_0x5ac096,_0x142d28){if(_0x5ac096[_0x1b92('0x49')]['id']){delete _0x5ac096[_0x1b92('0x49')]['id'];}return db[_0x1b92('0x2e')][_0x1b92('0x4b')]({'where':{'id':_0x5ac096['params']['id']}})['then'](handleEntityNotFound(_0x142d28,null))[_0x1b92('0x28')](saveUpdates(_0x5ac096[_0x1b92('0x49')],null))[_0x1b92('0x28')](respondWithResult(_0x142d28,null))[_0x1b92('0x4a')](handleError(_0x142d28,null));};exports['destroy']=function(_0x4e0954,_0xfdae28){return db['FreshdeskField'][_0x1b92('0x4b')]({'where':{'id':_0x4e0954[_0x1b92('0x45')]['id']}})[_0x1b92('0x28')](handleEntityNotFound(_0xfdae28,null))['then'](removeEntity(_0xfdae28,null))[_0x1b92('0x4a')](handleError(_0xfdae28,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index cd3ecfc..acbcc6e 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 _0x8135=['freshdesk_unique_index','idField','FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8135,0x99));var _0x5813=function(_0x5cda08,_0x36aa78){_0x5cda08=_0x5cda08-0x0;var _0x5ac60e=_0x8135[_0x5cda08];return _0x5ac60e;};'use strict';var _=require('lodash');var util=require(_0x5813('0x0'));var logger=require(_0x5813('0x1'))(_0x5813('0x2'));var moment=require(_0x5813('0x3'));var BPromise=require('bluebird');var rp=require(_0x5813('0x4'));var fs=require('fs');var path=require(_0x5813('0x5'));var rimraf=require(_0x5813('0x6'));var config=require(_0x5813('0x7'));var attributes=require(_0x5813('0x8'));module['exports']=function(_0x57ac38,_0x27599d){return _0x57ac38[_0x5813('0x9')](_0x5813('0xa'),attributes,{'tableName':_0x5813('0xb'),'paranoid':![],'indexes':[{'name':_0x5813('0xc'),'fields':[_0x5813('0xd'),_0x5813('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe52=['FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x11bf1d,_0xec50a7){var _0x4955e3=function(_0x51edb0){while(--_0x51edb0){_0x11bf1d['push'](_0x11bf1d['shift']());}};_0x4955e3(++_0xec50a7);}(_0xfe52,0x1a8));var _0x2fe5=function(_0x1b919f,_0xec3f28){_0x1b919f=_0x1b919f-0x0;var _0x4c8244=_0xfe52[_0x1b919f];return _0x4c8244;};'use strict';var _=require(_0x2fe5('0x0'));var util=require(_0x2fe5('0x1'));var logger=require(_0x2fe5('0x2'))('api');var moment=require(_0x2fe5('0x3'));var BPromise=require('bluebird');var rp=require(_0x2fe5('0x4'));var fs=require('fs');var path=require(_0x2fe5('0x5'));var rimraf=require(_0x2fe5('0x6'));var config=require(_0x2fe5('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0x2fe5('0x8')]=function(_0x2251ef,_0x1e24e7){return _0x2251ef[_0x2fe5('0x9')](_0x2fe5('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x2fe5('0xb'),'fields':[_0x2fe5('0xc'),_0x2fe5('0xd')],'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 4d17cd3..d7bb344 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 _0x10ea=['FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x220cf9,_0x2a8cc4){var _0x4ead40=function(_0x467cd0){while(--_0x467cd0){_0x220cf9['push'](_0x220cf9['shift']());}};_0x4ead40(++_0x2a8cc4);}(_0x10ea,0x14d));var _0xa10e=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0x10ea[_0x3df871];return _0x570f7b;};'use strict';var _=require(_0xa10e('0x0'));var util=require('util');var moment=require(_0xa10e('0x1'));var BPromise=require(_0xa10e('0x2'));var rs=require(_0xa10e('0x3'));var fs=require('fs');var Redis=require(_0xa10e('0x4'));var db=require(_0xa10e('0x5'))['db'];var utils=require(_0xa10e('0x6'));var logger=require(_0xa10e('0x7'))(_0xa10e('0x8'));var config=require(_0xa10e('0x9'));var jayson=require(_0xa10e('0xa'));var client=jayson['client'][_0xa10e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b05b1,_0x51e295,_0x29b42f){return new BPromise(function(_0x458e3d,_0x3758f9){return client[_0xa10e('0xc')](_0x3b05b1,_0x29b42f)[_0xa10e('0xd')](function(_0x19a7f6){logger['info'](_0xa10e('0xe'),_0x51e295,_0xa10e('0xf'));logger[_0xa10e('0x10')](_0xa10e('0x11'),_0x51e295,_0xa10e('0xf'),JSON[_0xa10e('0x12')](_0x19a7f6));if(_0x19a7f6[_0xa10e('0x13')]){if(_0x19a7f6[_0xa10e('0x13')][_0xa10e('0x14')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x51e295,_0x19a7f6[_0xa10e('0x13')][_0xa10e('0x15')]);return _0x3758f9(_0x19a7f6[_0xa10e('0x13')]['message']);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x51e295,_0x19a7f6[_0xa10e('0x13')]['message']);return _0x458e3d(_0x19a7f6['error']['message']);}else{logger[_0xa10e('0x16')](_0xa10e('0xe'),_0x51e295,'request\x20sent');_0x458e3d(_0x19a7f6[_0xa10e('0x17')]['message']);}})[_0xa10e('0x18')](function(_0x23faa3){logger[_0xa10e('0x13')](_0xa10e('0xe'),_0x51e295,_0x23faa3);_0x3758f9(_0x23faa3);});});} \ No newline at end of file +var _0xd37a=['catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3ac733,_0x23e93b){var _0xdf68e1=function(_0x3df2fd){while(--_0x3df2fd){_0x3ac733['push'](_0x3ac733['shift']());}};_0xdf68e1(++_0x23e93b);}(_0xd37a,0x157));var _0xad37=function(_0x310994,_0x22016d){_0x310994=_0x310994-0x0;var _0x323e1b=_0xd37a[_0x310994];return _0x323e1b;};'use strict';var _=require(_0xad37('0x0'));var util=require(_0xad37('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xad37('0x2'));var fs=require('fs');var Redis=require(_0xad37('0x3'));var db=require(_0xad37('0x4'))['db'];var utils=require(_0xad37('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xad37('0x6'));var jayson=require(_0xad37('0x7'));var client=jayson['client'][_0xad37('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x128deb,_0x240f9c,_0x526be3){return new BPromise(function(_0x364685,_0x5b4b2b){return client['request'](_0x128deb,_0x526be3)['then'](function(_0x5017bc){logger[_0xad37('0x9')](_0xad37('0xa'),_0x240f9c,_0xad37('0xb'));logger[_0xad37('0xc')](_0xad37('0xd'),_0x240f9c,'request\x20sent',JSON[_0xad37('0xe')](_0x5017bc));if(_0x5017bc[_0xad37('0xf')]){if(_0x5017bc['error']['code']===0x1f4){logger[_0xad37('0xf')](_0xad37('0xa'),_0x240f9c,_0x5017bc[_0xad37('0xf')][_0xad37('0x10')]);return _0x5b4b2b(_0x5017bc[_0xad37('0xf')][_0xad37('0x10')]);}logger[_0xad37('0xf')](_0xad37('0xa'),_0x240f9c,_0x5017bc[_0xad37('0xf')][_0xad37('0x10')]);return _0x364685(_0x5017bc[_0xad37('0xf')][_0xad37('0x10')]);}else{logger[_0xad37('0x9')](_0xad37('0xa'),_0x240f9c,_0xad37('0xb'));_0x364685(_0x5017bc[_0xad37('0x11')][_0xad37('0x10')]);}})[_0xad37('0x12')](function(_0xe6fe8f){logger['error'](_0xad37('0xa'),_0x240f9c,_0xe6fe8f);_0x5b4b2b(_0xe6fe8f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 98c3e58..7f99a2d 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 _0xb62e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','get','show','/:id/configurations','/:id/fields','getFields','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','Router'];(function(_0x5829e7,_0x3f6148){var _0x50915e=function(_0x228f67){while(--_0x228f67){_0x5829e7['push'](_0x5829e7['shift']());}};_0x50915e(++_0x3f6148);}(_0xb62e,0x1de));var _0xeb62=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb62e[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xc')](_0xeb62('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xeb62('0xc')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')]('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);router[_0xeb62('0x11')](_0xeb62('0xe'),auth[_0xeb62('0xa')](),controller['addConfiguration']);router[_0xeb62('0x13')](_0xeb62('0x14'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x15')]);router['delete'](_0xeb62('0x14'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x16')]);module['exports']=router; \ No newline at end of file +var _0x4522=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','create','post','addConfiguration','put','destroy','path','connect-timeout','express','fs-extra'];(function(_0x162f48,_0x5b20ee){var _0x31f414=function(_0x1f86f3){while(--_0x1f86f3){_0x162f48['push'](_0x162f48['shift']());}};_0x31f414(++_0x5b20ee);}(_0x4522,0x1a0));var _0x2452=function(_0x1911a4,_0x445fb6){_0x1911a4=_0x1911a4-0x0;var _0x4447b2=_0x4522[_0x1911a4];return _0x4447b2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2452('0x0'));var timeout=require(_0x2452('0x1'));var express=require(_0x2452('0x2'));var router=express['Router']();var fs_extra=require(_0x2452('0x3'));var auth=require(_0x2452('0x4'));var interaction=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var controller=require(_0x2452('0x7'));router[_0x2452('0x8')]('/',auth[_0x2452('0x9')](),controller[_0x2452('0xa')]);router[_0x2452('0x8')](_0x2452('0xb'),auth[_0x2452('0x9')](),controller[_0x2452('0xc')]);router[_0x2452('0x8')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0xe')]);router['get']('/:id/fields',auth[_0x2452('0x9')](),controller['getFields']);router['post']('/',auth[_0x2452('0x9')](),controller[_0x2452('0xf')]);router[_0x2452('0x10')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0x11')]);router[_0x2452('0x12')](_0x2452('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x2452('0xb'),auth['isAuthenticated'](),controller[_0x2452('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index ff44158..67df964 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 _0xb03e=['STRING','username','remoteUri','exports'];(function(_0x48a11e,_0x1b6d2e){var _0x2f7fa1=function(_0x22f61a){while(--_0x22f61a){_0x48a11e['push'](_0x48a11e['shift']());}};_0x2f7fa1(++_0x1b6d2e);}(_0xb03e,0x1eb));var _0xeb03=function(_0x11113b,_0x323839){_0x11113b=_0x11113b-0x0;var _0x53428d=_0xb03e[_0x11113b];return _0x53428d;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'name':{'type':Sequelize[_0xeb03('0x1')]},'description':{'type':Sequelize[_0xeb03('0x1')]},'username':{'type':Sequelize[_0xeb03('0x1')],'unique':_0xeb03('0x2')},'apiKey':{'type':Sequelize[_0xeb03('0x1')]},'remoteUri':{'type':Sequelize[_0xeb03('0x1')],'unique':_0xeb03('0x3')},'serverUrl':{'type':Sequelize[_0xeb03('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x1c9a=['sequelize','STRING','username','remoteUri'];(function(_0x2131ee,_0xc8ad4a){var _0x5e3c9c=function(_0x8289c5){while(--_0x8289c5){_0x2131ee['push'](_0x2131ee['shift']());}};_0x5e3c9c(++_0xc8ad4a);}(_0x1c9a,0x98));var _0xa1c9=function(_0x2400be,_0x1ec945){_0x2400be=_0x2400be-0x0;var _0x2deba9=_0x1c9a[_0x2400be];return _0x2deba9;};'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 diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 29be0c1..fd8f5e8 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 _0xc613=['apply','save','update','then','destroy','end','error','name','send','index','map','FreshsalesAccount','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','options','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','getFields','apiKey','username','remoteUri','slice','lastIndexOf','GET','%s%s','users','email','statusCode','stringify','test','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','count','limit','json'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0xc613,0x161));var _0x3c61=function(_0x392302,_0x2be840){_0x392302=_0x392302-0x0;var _0x4268bf=_0xc613[_0x392302];return _0x4268bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c61('0x0'));var zipdir=require(_0x3c61('0x1'));var jsonpatch=require(_0x3c61('0x2'));var rp=require(_0x3c61('0x3'));var moment=require(_0x3c61('0x4'));var BPromise=require(_0x3c61('0x5'));var Mustache=require(_0x3c61('0x6'));var util=require(_0x3c61('0x7'));var path=require(_0x3c61('0x8'));var sox=require(_0x3c61('0x9'));var csv=require(_0x3c61('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(_0x3c61('0xb'));var jsforce=require(_0x3c61('0xc'));var deskjs=require(_0x3c61('0xd'));var toCsv=require(_0x3c61('0xa'));var querystring=require('querystring');var Papa=require(_0x3c61('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3c61('0xf'));var as=require(_0x3c61('0x10'));var hardwareService=require(_0x3c61('0x11'));var logger=require('../../config/logger')(_0x3c61('0x12'));var utils=require(_0x3c61('0x13'));var config=require(_0x3c61('0x14'));var licenseUtil=require(_0x3c61('0x15'));var db=require(_0x3c61('0x16'))['db'];var integrations=require(_0x3c61('0x17'));function respondWithStatusCode(_0x354c3f,_0x448509){_0x448509=_0x448509||0xcc;return function(_0x56f594){if(_0x56f594){return _0x354c3f[_0x3c61('0x18')](_0x448509);}return _0x354c3f['status'](_0x448509)['end']();};}function respondWithResult(_0x18fac2,_0x2d9e11){_0x2d9e11=_0x2d9e11||0xc8;return function(_0x51b1f4){if(_0x51b1f4){return _0x18fac2[_0x3c61('0x19')](_0x2d9e11)['json'](_0x51b1f4);}};}function respondWithFilteredResult(_0xee28f8,_0x15adce){return function(_0x2695dc){if(_0x2695dc){var _0x15f3bd=typeof _0x15adce[_0x3c61('0x1a')]==='undefined'&&typeof _0x15adce['limit']===_0x3c61('0x1b');var _0x48025f=_0x2695dc['count'];var _0x38638b=_0x15f3bd?0x0:_0x15adce['offset'];var _0x334add=_0x15f3bd?_0x2695dc[_0x3c61('0x1c')]:_0x15adce['offset']+_0x15adce[_0x3c61('0x1d')];var _0x54840f;if(_0x334add>=_0x48025f){_0x334add=_0x48025f;_0x54840f=0xc8;}else{_0x54840f=0xce;}_0xee28f8[_0x3c61('0x19')](_0x54840f);return _0xee28f8['set']('Content-Range',_0x38638b+'-'+_0x334add+'/'+_0x48025f)[_0x3c61('0x1e')](_0x2695dc);}return null;};}function patchUpdates(_0x59fb89){return function(_0x1c1461){try{jsonpatch[_0x3c61('0x1f')](_0x1c1461,_0x59fb89,!![]);}catch(_0x7cd5b5){return BPromise['reject'](_0x7cd5b5);}return _0x1c1461[_0x3c61('0x20')]();};}function saveUpdates(_0x3248ed,_0x4192d6){return function(_0x400a1d){if(_0x400a1d){return _0x400a1d[_0x3c61('0x21')](_0x3248ed)[_0x3c61('0x22')](function(_0xde6889){return _0xde6889;});}return null;};}function removeEntity(_0x4b3572,_0x1617e4){return function(_0x39b766){if(_0x39b766){return _0x39b766[_0x3c61('0x23')]()[_0x3c61('0x22')](function(){_0x4b3572[_0x3c61('0x19')](0xcc)[_0x3c61('0x24')]();});}};}function handleEntityNotFound(_0x4efa5a,_0x11e2bb){return function(_0x2f5c94){if(!_0x2f5c94){_0x4efa5a[_0x3c61('0x18')](0x194);}return _0x2f5c94;};}function handleError(_0x4f2458,_0x35ac12){_0x35ac12=_0x35ac12||0x1f4;return function(_0x1dd8ec){logger[_0x3c61('0x25')](_0x1dd8ec['stack']);if(_0x1dd8ec[_0x3c61('0x26')]){delete _0x1dd8ec['name'];}_0x4f2458[_0x3c61('0x19')](_0x35ac12)[_0x3c61('0x27')](_0x1dd8ec);};}exports[_0x3c61('0x28')]=function(_0xa76a6c,_0x4f7065){var _0xec9255={},_0x5c3d3d={},_0x23e6e9={'count':0x0,'rows':[]};var _0x64856f=_[_0x3c61('0x29')](db[_0x3c61('0x2a')][_0x3c61('0x2b')],function(_0x9c0cfb){return{'name':_0x9c0cfb['fieldName'],'type':_0x9c0cfb[_0x3c61('0x2c')][_0x3c61('0x2d')]};});_0x5c3d3d[_0x3c61('0x2e')]=_[_0x3c61('0x29')](_0x64856f,_0x3c61('0x26'));_0x5c3d3d['query']=_[_0x3c61('0x2f')](_0xa76a6c[_0x3c61('0x30')]);_0x5c3d3d['filters']=_[_0x3c61('0x31')](_0x5c3d3d[_0x3c61('0x2e')],_0x5c3d3d[_0x3c61('0x30')]);_0xec9255['attributes']=_[_0x3c61('0x31')](_0x5c3d3d[_0x3c61('0x2e')],qs[_0x3c61('0x32')](_0xa76a6c[_0x3c61('0x30')][_0x3c61('0x32')]));_0xec9255[_0x3c61('0x33')]=_0xec9255['attributes'][_0x3c61('0x34')]?_0xec9255[_0x3c61('0x33')]:_0x5c3d3d[_0x3c61('0x2e')];if(!_0xa76a6c[_0x3c61('0x30')][_0x3c61('0x35')](_0x3c61('0x36'))){_0xec9255[_0x3c61('0x1d')]=qs[_0x3c61('0x1d')](_0xa76a6c[_0x3c61('0x30')][_0x3c61('0x1d')]);_0xec9255[_0x3c61('0x1a')]=qs[_0x3c61('0x1a')](_0xa76a6c[_0x3c61('0x30')][_0x3c61('0x1a')]);}_0xec9255[_0x3c61('0x37')]=qs[_0x3c61('0x38')](_0xa76a6c['query']['sort']);_0xec9255[_0x3c61('0x39')]=qs['filters'](_[_0x3c61('0x3a')](_0xa76a6c[_0x3c61('0x30')],_0x5c3d3d[_0x3c61('0x3b')]),_0x64856f);if(_0xa76a6c[_0x3c61('0x30')]['filter']){_0xec9255[_0x3c61('0x39')]=_[_0x3c61('0x3c')](_0xec9255[_0x3c61('0x39')],{'$or':_['map'](_0x64856f,function(_0x13cc72){if(_0x13cc72[_0x3c61('0x2c')]!==_0x3c61('0x3d')){var _0x4b56a6={};_0x4b56a6[_0x13cc72[_0x3c61('0x26')]]={'$like':'%'+_0xa76a6c[_0x3c61('0x30')][_0x3c61('0x3e')]+'%'};return _0x4b56a6;}})});}_0xec9255=_[_0x3c61('0x3c')]({},_0xec9255,_0xa76a6c['options']);var _0x588562={'where':_0xec9255[_0x3c61('0x39')]};return db[_0x3c61('0x2a')][_0x3c61('0x1c')](_0x588562)[_0x3c61('0x22')](function(_0x5458be){_0x23e6e9[_0x3c61('0x1c')]=_0x5458be;if(_0xa76a6c[_0x3c61('0x30')][_0x3c61('0x3f')]){_0xec9255[_0x3c61('0x40')]=[{'all':!![]}];}return db[_0x3c61('0x2a')][_0x3c61('0x41')](_0xec9255);})[_0x3c61('0x22')](function(_0x4d8084){_0x23e6e9[_0x3c61('0x42')]=_0x4d8084;return _0x23e6e9;})[_0x3c61('0x22')](respondWithFilteredResult(_0x4f7065,_0xec9255))[_0x3c61('0x43')](handleError(_0x4f7065,null));};exports[_0x3c61('0x44')]=function(_0x2c06da,_0x112ab3){var _0x1c4b07={'raw':![],'where':{'id':_0x2c06da['params']['id']}},_0x5b9b0f={};_0x5b9b0f[_0x3c61('0x2e')]=_[_0x3c61('0x2f')](db[_0x3c61('0x2a')]['rawAttributes']);_0x5b9b0f[_0x3c61('0x30')]=_['keys'](_0x2c06da['query']);_0x5b9b0f['filters']=_[_0x3c61('0x31')](_0x5b9b0f[_0x3c61('0x2e')],_0x5b9b0f['query']);_0x1c4b07[_0x3c61('0x33')]=_[_0x3c61('0x31')](_0x5b9b0f[_0x3c61('0x2e')],qs['fields'](_0x2c06da['query'][_0x3c61('0x32')]));_0x1c4b07[_0x3c61('0x33')]=_0x1c4b07['attributes'][_0x3c61('0x34')]?_0x1c4b07[_0x3c61('0x33')]:_0x5b9b0f['model'];if(_0x2c06da[_0x3c61('0x30')]['includeAll']){_0x1c4b07['include']=[{'all':!![]}];}_0x1c4b07=_[_0x3c61('0x3c')]({},_0x1c4b07,_0x2c06da['options']);return db[_0x3c61('0x2a')][_0x3c61('0x45')](_0x1c4b07)[_0x3c61('0x22')](handleEntityNotFound(_0x112ab3,null))[_0x3c61('0x22')](respondWithResult(_0x112ab3,null))[_0x3c61('0x43')](handleError(_0x112ab3,null));};exports['create']=function(_0x5c7ed0,_0x39cff5){return db[_0x3c61('0x2a')][_0x3c61('0x46')](_0x5c7ed0[_0x3c61('0x47')],{})[_0x3c61('0x22')](respondWithResult(_0x39cff5,0xc9))[_0x3c61('0x43')](handleError(_0x39cff5,null));};exports[_0x3c61('0x21')]=function(_0x24c8c1,_0x1f572f){if(_0x24c8c1[_0x3c61('0x47')]['id']){delete _0x24c8c1[_0x3c61('0x47')]['id'];}return db[_0x3c61('0x2a')][_0x3c61('0x45')]({'where':{'id':_0x24c8c1[_0x3c61('0x48')]['id']}})[_0x3c61('0x22')](handleEntityNotFound(_0x1f572f,null))[_0x3c61('0x22')](saveUpdates(_0x24c8c1[_0x3c61('0x47')],null))[_0x3c61('0x22')](respondWithResult(_0x1f572f,null))[_0x3c61('0x43')](handleError(_0x1f572f,null));};exports[_0x3c61('0x23')]=function(_0xb63037,_0x50f8f7){return db[_0x3c61('0x2a')][_0x3c61('0x45')]({'where':{'id':_0xb63037['params']['id']}})[_0x3c61('0x22')](handleEntityNotFound(_0x50f8f7,null))['then'](removeEntity(_0x50f8f7,null))[_0x3c61('0x43')](handleError(_0x50f8f7,null));};exports[_0x3c61('0x49')]=function(_0x5094de,_0x382733,_0x5489e2){var _0x322a9a={};var _0x2b71c1={};var _0x27dd80;var _0x59daf2;return db[_0x3c61('0x2a')][_0x3c61('0x4a')]({'where':{'id':_0x5094de[_0x3c61('0x48')]['id']}})[_0x3c61('0x22')](handleEntityNotFound(_0x382733,null))[_0x3c61('0x22')](function(_0x2cb1df){if(_0x2cb1df){_0x27dd80=_0x2cb1df;_0x2b71c1[_0x3c61('0x2e')]=_[_0x3c61('0x2f')](db[_0x3c61('0x4b')][_0x3c61('0x2b')]);_0x2b71c1[_0x3c61('0x30')]=_[_0x3c61('0x2f')](_0x5094de[_0x3c61('0x30')]);_0x2b71c1[_0x3c61('0x3b')]=_['intersection'](_0x2b71c1[_0x3c61('0x2e')],_0x2b71c1[_0x3c61('0x30')]);_0x322a9a[_0x3c61('0x33')]=_[_0x3c61('0x31')](_0x2b71c1[_0x3c61('0x2e')],qs[_0x3c61('0x32')](_0x5094de[_0x3c61('0x30')][_0x3c61('0x32')]));_0x322a9a['attributes']=_0x322a9a[_0x3c61('0x33')][_0x3c61('0x34')]?_0x322a9a[_0x3c61('0x33')]:_0x2b71c1[_0x3c61('0x2e')];_0x322a9a[_0x3c61('0x37')]=qs[_0x3c61('0x38')](_0x5094de['query']['sort']);_0x322a9a[_0x3c61('0x39')]=qs[_0x3c61('0x3b')](_[_0x3c61('0x3a')](_0x5094de['query'],_0x2b71c1['filters']));if(_0x5094de[_0x3c61('0x30')][_0x3c61('0x3e')]){_0x322a9a[_0x3c61('0x39')]=_[_0x3c61('0x3c')](_0x322a9a[_0x3c61('0x39')],{'$or':_['map'](_0x322a9a[_0x3c61('0x33')],function(_0x2e686f){var _0x1fd2d2={};_0x1fd2d2[_0x2e686f]={'$like':'%'+_0x5094de[_0x3c61('0x30')][_0x3c61('0x3e')]+'%'};return _0x1fd2d2;})});}_0x322a9a=_['merge']({},_0x322a9a,_0x5094de[_0x3c61('0x4c')]);return _0x27dd80['getConfigurations'](_0x322a9a);}})[_0x3c61('0x22')](function(_0x3f31a6){if(_0x3f31a6){_0x59daf2=_0x3f31a6[_0x3c61('0x34')];if(!_0x5094de[_0x3c61('0x30')][_0x3c61('0x35')](_0x3c61('0x36'))){_0x322a9a[_0x3c61('0x1d')]=qs[_0x3c61('0x1d')](_0x5094de[_0x3c61('0x30')][_0x3c61('0x1d')]);_0x322a9a[_0x3c61('0x1a')]=qs['offset'](_0x5094de[_0x3c61('0x30')]['offset']);}return _0x27dd80[_0x3c61('0x49')](_0x322a9a);}})[_0x3c61('0x22')](function(_0x101417){if(_0x101417){return _0x101417?{'count':_0x59daf2,'rows':_0x101417}:null;}})['then'](respondWithResult(_0x382733,null))[_0x3c61('0x43')](handleError(_0x382733,null));};exports['addConfiguration']=function(_0x214f74,_0xd19da0,_0x101fa2){if(_0x214f74[_0x3c61('0x47')]['id']){delete _0x214f74[_0x3c61('0x47')]['id'];}return db[_0x3c61('0x2a')][_0x3c61('0x4a')]({'where':{'id':_0x214f74[_0x3c61('0x48')]['id']}})[_0x3c61('0x22')](handleEntityNotFound(_0xd19da0,null))[_0x3c61('0x22')](function(_0x771666){if(_0x771666){_0x214f74[_0x3c61('0x47')][_0x3c61('0x4d')]=_0x771666['id'];_0x214f74[_0x3c61('0x47')][_0x3c61('0x4e')]=integrations[_0x3c61('0x4f')](_0x214f74[_0x3c61('0x47')]['channel'],_0x214f74[_0x3c61('0x47')][_0x3c61('0x2c')]);_0x214f74[_0x3c61('0x47')][_0x3c61('0x50')]=integrations[_0x3c61('0x51')](_0x214f74[_0x3c61('0x47')][_0x3c61('0x52')],_0x214f74['body'][_0x3c61('0x2c')]);return db['FreshsalesConfiguration'][_0x3c61('0x46')](_0x214f74['body'],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xd19da0,null))[_0x3c61('0x43')](handleError(_0xd19da0,null));};exports[_0x3c61('0x53')]=function(_0x11fd95,_0x19cfc2,_0x75e814){var _0x49f7ee='';var _0x3775ac='';return db[_0x3c61('0x2a')][_0x3c61('0x4a')]({'where':{'id':_0x11fd95[_0x3c61('0x48')]['id']},'attributes':['id','username','remoteUri',_0x3c61('0x54')]})[_0x3c61('0x22')](handleEntityNotFound(_0x19cfc2,null))[_0x3c61('0x22')](function(_0x1397a0){if(_0x1397a0){_0x3775ac=_0x1397a0[_0x3c61('0x55')];_0x49f7ee=_0x1397a0[_0x3c61('0x56')];var _0x123bbf=_0x1397a0[_0x3c61('0x56')][_0x3c61('0x57')](-0x1);if(_0x123bbf==='/'){_0x49f7ee=_0x49f7ee['substring'](0x0,_0x49f7ee[_0x3c61('0x58')](_0x123bbf));}return rp({'method':_0x3c61('0x59'),'uri':util['format'](_0x3c61('0x5a'),_0x49f7ee,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x1397a0[_0x3c61('0x54')]},'json':!![]});}})['then'](function(_0x429fa9){if(_0x429fa9){var _0xfe6463=_0x429fa9[_0x3c61('0x5b')];var _0x90228=![];var _0x11737e=null;for(_0x11737e=0x0;_0x11737e<_0xfe6463[_0x3c61('0x34')];_0x11737e++){if(_0xfe6463[_0x11737e][_0x3c61('0x5c')]===_0x3775ac){_0x90228=!![];}}if(_0x90228){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x19cfc2,null))['catch'](function(_0x22b1ef){var _0xa4c98=_0x11fd95[_0x3c61('0x30')]['test']?0x1f4:_0x22b1ef[_0x3c61('0x5d')]||0x1f4;logger[_0x3c61('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x3c61('0x53'),_0xa4c98,JSON[_0x3c61('0x5e')](_0x22b1ef));delete _0x22b1ef[_0x3c61('0x26')];if(_0xa4c98===0x191){_0xa4c98=0x190;}_0x19cfc2[_0x3c61('0x19')](_0xa4c98)[_0x3c61('0x27')](_0x11fd95[_0x3c61('0x30')][_0x3c61('0x5f')]?{'message':'Wrong\x20credentials','statusCode':_0x22b1ef[_0x3c61('0x5d')]}:_0x22b1ef);});}; \ No newline at end of file +var _0xf4f6=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','params','includeAll','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','username','remoteUri','GET','format','/api/selector/owners','apiKey','users','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName'];(function(_0x4d578c,_0x4d2ed2){var _0xf41cac=function(_0x4edde3){while(--_0x4edde3){_0x4d578c['push'](_0x4d578c['shift']());}};_0xf41cac(++_0x4d2ed2);}(_0xf4f6,0x16c));var _0x6f4f=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xf4f6[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0x6f4f('0x0'));var rimraf=require(_0x6f4f('0x1'));var zipdir=require(_0x6f4f('0x2'));var jsonpatch=require(_0x6f4f('0x3'));var rp=require(_0x6f4f('0x4'));var moment=require(_0x6f4f('0x5'));var BPromise=require(_0x6f4f('0x6'));var Mustache=require(_0x6f4f('0x7'));var util=require(_0x6f4f('0x8'));var path=require(_0x6f4f('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6f4f('0xa'));var fs=require('fs');var fs_extra=require(_0x6f4f('0xb'));var _=require(_0x6f4f('0xc'));var squel=require(_0x6f4f('0xd'));var crypto=require(_0x6f4f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6f4f('0xf'));var toCsv=require(_0x6f4f('0x10'));var querystring=require(_0x6f4f('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6f4f('0x12'));var qs=require(_0x6f4f('0x13'));var as=require(_0x6f4f('0x14'));var hardwareService=require(_0x6f4f('0x15'));var logger=require(_0x6f4f('0x16'))(_0x6f4f('0x17'));var utils=require(_0x6f4f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6f4f('0x19'));var db=require(_0x6f4f('0x1a'))['db'];var integrations=require(_0x6f4f('0x1b'));function respondWithStatusCode(_0x363391,_0x2b12f8){_0x2b12f8=_0x2b12f8||0xcc;return function(_0x1c5f0d){if(_0x1c5f0d){return _0x363391[_0x6f4f('0x1c')](_0x2b12f8);}return _0x363391[_0x6f4f('0x1d')](_0x2b12f8)[_0x6f4f('0x1e')]();};}function respondWithResult(_0x4fa903,_0x44342a){_0x44342a=_0x44342a||0xc8;return function(_0x36607b){if(_0x36607b){return _0x4fa903[_0x6f4f('0x1d')](_0x44342a)[_0x6f4f('0x1f')](_0x36607b);}};}function respondWithFilteredResult(_0xf65e08,_0x114e61){return function(_0x24f619){if(_0x24f619){var _0xf3b4af=typeof _0x114e61[_0x6f4f('0x20')]==='undefined'&&typeof _0x114e61['limit']===_0x6f4f('0x21');var _0x1c243a=_0x24f619['count'];var _0x4a3e11=_0xf3b4af?0x0:_0x114e61[_0x6f4f('0x20')];var _0x3a831d=_0xf3b4af?_0x24f619[_0x6f4f('0x22')]:_0x114e61['offset']+_0x114e61[_0x6f4f('0x23')];var _0x262861;if(_0x3a831d>=_0x1c243a){_0x3a831d=_0x1c243a;_0x262861=0xc8;}else{_0x262861=0xce;}_0xf65e08['status'](_0x262861);return _0xf65e08[_0x6f4f('0x24')](_0x6f4f('0x25'),_0x4a3e11+'-'+_0x3a831d+'/'+_0x1c243a)[_0x6f4f('0x1f')](_0x24f619);}return null;};}function patchUpdates(_0x4a00d9){return function(_0x3b76f5){try{jsonpatch[_0x6f4f('0x26')](_0x3b76f5,_0x4a00d9,!![]);}catch(_0x2642f1){return BPromise[_0x6f4f('0x27')](_0x2642f1);}return _0x3b76f5[_0x6f4f('0x28')]();};}function saveUpdates(_0x266d3a,_0x40a497){return function(_0x392d53){if(_0x392d53){return _0x392d53[_0x6f4f('0x29')](_0x266d3a)[_0x6f4f('0x2a')](function(_0x2d3c35){return _0x2d3c35;});}return null;};}function removeEntity(_0x89f23d,_0x2f43d4){return function(_0x22c90a){if(_0x22c90a){return _0x22c90a[_0x6f4f('0x2b')]()[_0x6f4f('0x2a')](function(){_0x89f23d['status'](0xcc)[_0x6f4f('0x1e')]();});}};}function handleEntityNotFound(_0x2540d2,_0xc59bf7){return function(_0x1dded){if(!_0x1dded){_0x2540d2[_0x6f4f('0x1c')](0x194);}return _0x1dded;};}function handleError(_0x700f1d,_0x1b6016){_0x1b6016=_0x1b6016||0x1f4;return function(_0xa89e95){logger[_0x6f4f('0x2c')](_0xa89e95[_0x6f4f('0x2d')]);if(_0xa89e95[_0x6f4f('0x2e')]){delete _0xa89e95['name'];}_0x700f1d[_0x6f4f('0x1d')](_0x1b6016)['send'](_0xa89e95);};}exports[_0x6f4f('0x2f')]=function(_0x521cdc,_0x436ed6){var _0x190e5e={},_0x30ea67={},_0x1caf71={'count':0x0,'rows':[]};var _0x59b276=_[_0x6f4f('0x30')](db[_0x6f4f('0x31')][_0x6f4f('0x32')],function(_0x47e1ad){return{'name':_0x47e1ad[_0x6f4f('0x33')],'type':_0x47e1ad[_0x6f4f('0x34')][_0x6f4f('0x35')]};});_0x30ea67[_0x6f4f('0x36')]=_[_0x6f4f('0x30')](_0x59b276,_0x6f4f('0x2e'));_0x30ea67[_0x6f4f('0x37')]=_[_0x6f4f('0x38')](_0x521cdc[_0x6f4f('0x37')]);_0x30ea67[_0x6f4f('0x39')]=_[_0x6f4f('0x3a')](_0x30ea67[_0x6f4f('0x36')],_0x30ea67[_0x6f4f('0x37')]);_0x190e5e[_0x6f4f('0x3b')]=_[_0x6f4f('0x3a')](_0x30ea67[_0x6f4f('0x36')],qs[_0x6f4f('0x3c')](_0x521cdc[_0x6f4f('0x37')][_0x6f4f('0x3c')]));_0x190e5e[_0x6f4f('0x3b')]=_0x190e5e[_0x6f4f('0x3b')][_0x6f4f('0x3d')]?_0x190e5e[_0x6f4f('0x3b')]:_0x30ea67[_0x6f4f('0x36')];if(!_0x521cdc[_0x6f4f('0x37')][_0x6f4f('0x3e')](_0x6f4f('0x3f'))){_0x190e5e[_0x6f4f('0x23')]=qs[_0x6f4f('0x23')](_0x521cdc['query'][_0x6f4f('0x23')]);_0x190e5e[_0x6f4f('0x20')]=qs[_0x6f4f('0x20')](_0x521cdc[_0x6f4f('0x37')][_0x6f4f('0x20')]);}_0x190e5e[_0x6f4f('0x40')]=qs[_0x6f4f('0x41')](_0x521cdc[_0x6f4f('0x37')][_0x6f4f('0x41')]);_0x190e5e[_0x6f4f('0x42')]=qs[_0x6f4f('0x39')](_[_0x6f4f('0x43')](_0x521cdc[_0x6f4f('0x37')],_0x30ea67[_0x6f4f('0x39')]),_0x59b276);if(_0x521cdc[_0x6f4f('0x37')][_0x6f4f('0x44')]){_0x190e5e[_0x6f4f('0x42')]=_['merge'](_0x190e5e[_0x6f4f('0x42')],{'$or':_[_0x6f4f('0x30')](_0x59b276,function(_0x57a7e8){if(_0x57a7e8[_0x6f4f('0x34')]!==_0x6f4f('0x45')){var _0x41c2ec={};_0x41c2ec[_0x57a7e8[_0x6f4f('0x2e')]]={'$like':'%'+_0x521cdc[_0x6f4f('0x37')][_0x6f4f('0x44')]+'%'};return _0x41c2ec;}})});}_0x190e5e=_[_0x6f4f('0x46')]({},_0x190e5e,_0x521cdc[_0x6f4f('0x47')]);var _0x5c7e8a={'where':_0x190e5e['where']};return db[_0x6f4f('0x31')][_0x6f4f('0x22')](_0x5c7e8a)[_0x6f4f('0x2a')](function(_0x281aaf){_0x1caf71['count']=_0x281aaf;if(_0x521cdc[_0x6f4f('0x37')]['includeAll']){_0x190e5e[_0x6f4f('0x48')]=[{'all':!![]}];}return db[_0x6f4f('0x31')]['findAll'](_0x190e5e);})[_0x6f4f('0x2a')](function(_0x10e969){_0x1caf71[_0x6f4f('0x49')]=_0x10e969;return _0x1caf71;})['then'](respondWithFilteredResult(_0x436ed6,_0x190e5e))[_0x6f4f('0x4a')](handleError(_0x436ed6,null));};exports[_0x6f4f('0x4b')]=function(_0x532a85,_0x59d080){var _0x106df9={'raw':![],'where':{'id':_0x532a85[_0x6f4f('0x4c')]['id']}},_0x3e8bb5={};_0x3e8bb5[_0x6f4f('0x36')]=_['keys'](db[_0x6f4f('0x31')][_0x6f4f('0x32')]);_0x3e8bb5[_0x6f4f('0x37')]=_['keys'](_0x532a85[_0x6f4f('0x37')]);_0x3e8bb5[_0x6f4f('0x39')]=_['intersection'](_0x3e8bb5['model'],_0x3e8bb5[_0x6f4f('0x37')]);_0x106df9[_0x6f4f('0x3b')]=_[_0x6f4f('0x3a')](_0x3e8bb5[_0x6f4f('0x36')],qs[_0x6f4f('0x3c')](_0x532a85[_0x6f4f('0x37')]['fields']));_0x106df9[_0x6f4f('0x3b')]=_0x106df9[_0x6f4f('0x3b')][_0x6f4f('0x3d')]?_0x106df9[_0x6f4f('0x3b')]:_0x3e8bb5[_0x6f4f('0x36')];if(_0x532a85[_0x6f4f('0x37')][_0x6f4f('0x4d')]){_0x106df9[_0x6f4f('0x48')]=[{'all':!![]}];}_0x106df9=_['merge']({},_0x106df9,_0x532a85['options']);return db[_0x6f4f('0x31')]['find'](_0x106df9)[_0x6f4f('0x2a')](handleEntityNotFound(_0x59d080,null))[_0x6f4f('0x2a')](respondWithResult(_0x59d080,null))[_0x6f4f('0x4a')](handleError(_0x59d080,null));};exports[_0x6f4f('0x4e')]=function(_0x280b7e,_0x334a8e){return db['FreshsalesAccount'][_0x6f4f('0x4e')](_0x280b7e[_0x6f4f('0x4f')],{})[_0x6f4f('0x2a')](respondWithResult(_0x334a8e,0xc9))['catch'](handleError(_0x334a8e,null));};exports[_0x6f4f('0x29')]=function(_0x1f5282,_0xbe5eb5){if(_0x1f5282[_0x6f4f('0x4f')]['id']){delete _0x1f5282[_0x6f4f('0x4f')]['id'];}return db[_0x6f4f('0x31')][_0x6f4f('0x50')]({'where':{'id':_0x1f5282[_0x6f4f('0x4c')]['id']}})[_0x6f4f('0x2a')](handleEntityNotFound(_0xbe5eb5,null))[_0x6f4f('0x2a')](saveUpdates(_0x1f5282[_0x6f4f('0x4f')],null))[_0x6f4f('0x2a')](respondWithResult(_0xbe5eb5,null))['catch'](handleError(_0xbe5eb5,null));};exports['destroy']=function(_0x571f4b,_0x5bb21e){return db['FreshsalesAccount']['find']({'where':{'id':_0x571f4b['params']['id']}})[_0x6f4f('0x2a')](handleEntityNotFound(_0x5bb21e,null))[_0x6f4f('0x2a')](removeEntity(_0x5bb21e,null))[_0x6f4f('0x4a')](handleError(_0x5bb21e,null));};exports[_0x6f4f('0x51')]=function(_0x5b06a2,_0x47be5a,_0x54c5c2){var _0x14a1cb={};var _0x2ddff2={};var _0x465833;var _0x469931;return db[_0x6f4f('0x31')][_0x6f4f('0x52')]({'where':{'id':_0x5b06a2[_0x6f4f('0x4c')]['id']}})[_0x6f4f('0x2a')](handleEntityNotFound(_0x47be5a,null))[_0x6f4f('0x2a')](function(_0x4cdb0c){if(_0x4cdb0c){_0x465833=_0x4cdb0c;_0x2ddff2[_0x6f4f('0x36')]=_[_0x6f4f('0x38')](db[_0x6f4f('0x53')][_0x6f4f('0x32')]);_0x2ddff2[_0x6f4f('0x37')]=_[_0x6f4f('0x38')](_0x5b06a2[_0x6f4f('0x37')]);_0x2ddff2[_0x6f4f('0x39')]=_[_0x6f4f('0x3a')](_0x2ddff2[_0x6f4f('0x36')],_0x2ddff2[_0x6f4f('0x37')]);_0x14a1cb[_0x6f4f('0x3b')]=_[_0x6f4f('0x3a')](_0x2ddff2[_0x6f4f('0x36')],qs['fields'](_0x5b06a2[_0x6f4f('0x37')][_0x6f4f('0x3c')]));_0x14a1cb[_0x6f4f('0x3b')]=_0x14a1cb[_0x6f4f('0x3b')][_0x6f4f('0x3d')]?_0x14a1cb[_0x6f4f('0x3b')]:_0x2ddff2[_0x6f4f('0x36')];_0x14a1cb[_0x6f4f('0x40')]=qs['sort'](_0x5b06a2[_0x6f4f('0x37')][_0x6f4f('0x41')]);_0x14a1cb[_0x6f4f('0x42')]=qs['filters'](_['pick'](_0x5b06a2[_0x6f4f('0x37')],_0x2ddff2['filters']));if(_0x5b06a2['query'][_0x6f4f('0x44')]){_0x14a1cb[_0x6f4f('0x42')]=_['merge'](_0x14a1cb[_0x6f4f('0x42')],{'$or':_[_0x6f4f('0x30')](_0x14a1cb[_0x6f4f('0x3b')],function(_0x192b81){var _0x275ce4={};_0x275ce4[_0x192b81]={'$like':'%'+_0x5b06a2['query'][_0x6f4f('0x44')]+'%'};return _0x275ce4;})});}_0x14a1cb=_[_0x6f4f('0x46')]({},_0x14a1cb,_0x5b06a2[_0x6f4f('0x47')]);return _0x465833[_0x6f4f('0x51')](_0x14a1cb);}})[_0x6f4f('0x2a')](function(_0x3f6e44){if(_0x3f6e44){_0x469931=_0x3f6e44[_0x6f4f('0x3d')];if(!_0x5b06a2[_0x6f4f('0x37')]['hasOwnProperty'](_0x6f4f('0x3f'))){_0x14a1cb[_0x6f4f('0x23')]=qs[_0x6f4f('0x23')](_0x5b06a2['query'][_0x6f4f('0x23')]);_0x14a1cb[_0x6f4f('0x20')]=qs[_0x6f4f('0x20')](_0x5b06a2[_0x6f4f('0x37')][_0x6f4f('0x20')]);}return _0x465833[_0x6f4f('0x51')](_0x14a1cb);}})[_0x6f4f('0x2a')](function(_0x445557){if(_0x445557){return _0x445557?{'count':_0x469931,'rows':_0x445557}:null;}})['then'](respondWithResult(_0x47be5a,null))[_0x6f4f('0x4a')](handleError(_0x47be5a,null));};exports[_0x6f4f('0x54')]=function(_0x5f0f0c,_0xc4fa66,_0x459d64){if(_0x5f0f0c[_0x6f4f('0x4f')]['id']){delete _0x5f0f0c[_0x6f4f('0x4f')]['id'];}return db[_0x6f4f('0x31')]['findOne']({'where':{'id':_0x5f0f0c[_0x6f4f('0x4c')]['id']}})[_0x6f4f('0x2a')](handleEntityNotFound(_0xc4fa66,null))[_0x6f4f('0x2a')](function(_0x46fb1){if(_0x46fb1){_0x5f0f0c['body']['AccountId']=_0x46fb1['id'];_0x5f0f0c['body']['Subjects']=integrations[_0x6f4f('0x55')](_0x5f0f0c[_0x6f4f('0x4f')][_0x6f4f('0x56')],_0x5f0f0c[_0x6f4f('0x4f')][_0x6f4f('0x34')]);_0x5f0f0c[_0x6f4f('0x4f')][_0x6f4f('0x57')]=integrations[_0x6f4f('0x58')](_0x5f0f0c[_0x6f4f('0x4f')]['channel'],_0x5f0f0c[_0x6f4f('0x4f')]['type']);return db[_0x6f4f('0x53')][_0x6f4f('0x4e')](_0x5f0f0c[_0x6f4f('0x4f')],{'include':[{'model':db[_0x6f4f('0x59')],'as':_0x6f4f('0x5a')},{'model':db['FreshsalesField'],'as':_0x6f4f('0x57')}]});}return null;})[_0x6f4f('0x2a')](respondWithResult(_0xc4fa66,null))['catch'](handleError(_0xc4fa66,null));};exports['getFields']=function(_0x2d2b35,_0x319726,_0x276148){var _0x6af37e='';var _0x1fd2ed='';return db['FreshsalesAccount'][_0x6f4f('0x52')]({'where':{'id':_0x2d2b35[_0x6f4f('0x4c')]['id']},'attributes':['id',_0x6f4f('0x5b'),_0x6f4f('0x5c'),'apiKey']})['then'](handleEntityNotFound(_0x319726,null))['then'](function(_0x36f34d){if(_0x36f34d){_0x1fd2ed=_0x36f34d['username'];_0x6af37e=_0x36f34d['remoteUri'];var _0x2f4e7a=_0x36f34d[_0x6f4f('0x5c')]['slice'](-0x1);if(_0x2f4e7a==='/'){_0x6af37e=_0x6af37e['substring'](0x0,_0x6af37e['lastIndexOf'](_0x2f4e7a));}return rp({'method':_0x6f4f('0x5d'),'uri':util[_0x6f4f('0x5e')]('%s%s',_0x6af37e,_0x6f4f('0x5f')),'headers':{'Authorization':'Token\x20token='+_0x36f34d[_0x6f4f('0x60')]},'json':!![]});}})[_0x6f4f('0x2a')](function(_0x1594cf){if(_0x1594cf){var _0x47aafc=_0x1594cf[_0x6f4f('0x61')];var _0x32212f=![];var _0x46ece2=null;for(_0x46ece2=0x0;_0x46ece2<_0x47aafc[_0x6f4f('0x3d')];_0x46ece2++){if(_0x47aafc[_0x46ece2]['email']===_0x1fd2ed){_0x32212f=!![];}}if(_0x32212f){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x6f4f('0x2a')](respondWithResult(_0x319726,null))[_0x6f4f('0x4a')](function(_0x2dc0fb){var _0x2fd50b=_0x2d2b35['query'][_0x6f4f('0x62')]?0x1f4:_0x2dc0fb[_0x6f4f('0x63')]||0x1f4;logger['error'](_0x6f4f('0x64'),_0x6f4f('0x65'),_0x2fd50b,JSON[_0x6f4f('0x66')](_0x2dc0fb));delete _0x2dc0fb[_0x6f4f('0x2e')];if(_0x2fd50b===0x191){_0x2fd50b=0x190;}_0x319726[_0x6f4f('0x1d')](_0x2fd50b)[_0x6f4f('0x67')](_0x2d2b35[_0x6f4f('0x37')][_0x6f4f('0x62')]?{'message':'Wrong\x20credentials','statusCode':_0x2dc0fb[_0x6f4f('0x63')]}:_0x2dc0fb);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 39abcc5..77b59d0 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 _0x6a55=['define','FreshsalesAccount','int_freshsales_accounts','lodash','moment','path','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x6a55,0xdb));var _0x56a5=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0x6a55[_0x516927];return _0x30749b;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x56a5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56a5('0x2'));var rimraf=require('rimraf');var config=require(_0x56a5('0x3'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x56a5('0x4'));module[_0x56a5('0x5')]=function(_0x42d164,_0x293ea1){return _0x42d164[_0x56a5('0x6')](_0x56a5('0x7'),attributes,{'tableName':_0x56a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','FreshsalesAccount','int_freshsales_accounts','lodash'];(function(_0x389832,_0x10a4a9){var _0x59429e=function(_0x5f3562){while(--_0x5f3562){_0x389832['push'](_0x389832['shift']());}};_0x59429e(++_0x10a4a9);}(_0x5496,0x175));var _0x6549=function(_0x2e2be8,_0x54b2e9){_0x2e2be8=_0x2e2be8-0x0;var _0x44417f=_0x5496[_0x2e2be8];return _0x44417f;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x43cb17,_0x1d8cea){return _0x43cb17['define'](_0x6549('0x9'),attributes,{'tableName':_0x6549('0xa'),'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 335a25d..c666aad 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 _0x68b3=['include','map','model','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit'];(function(_0x1c31f9,_0x397956){var _0x537bc6=function(_0x366a40){while(--_0x366a40){_0x1c31f9['push'](_0x1c31f9['shift']());}};_0x537bc6(++_0x397956);}(_0x68b3,0x1d8));var _0x368b=function(_0x91b94a,_0x49b09d){_0x91b94a=_0x91b94a-0x0;var _0xc98b7f=_0x68b3[_0x91b94a];return _0xc98b7f;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});}exports[_0x368b('0x18')]=function(_0x540f57){var _0x5d543e=this;return new Promise(function(_0x3e2e9f,_0x27d2a0){return db[_0x368b('0x19')][_0x368b('0x1a')]({'raw':_0x540f57[_0x368b('0x1b')]?_0x540f57['options'][_0x368b('0x1c')]===undefined?!![]:![]:!![],'where':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x1d')]||null:null,'attributes':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x1e')]||null:null,'limit':_0x540f57[_0x368b('0x1b')]?_0x540f57['options'][_0x368b('0x1f')]||null:null,'include':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x20')]?_[_0x368b('0x21')](_0x540f57['options'][_0x368b('0x20')],function(_0x1ca429){return{'model':db[_0x1ca429[_0x368b('0x22')]],'as':_0x1ca429['as'],'attributes':_0x1ca429[_0x368b('0x1e')],'include':_0x1ca429[_0x368b('0x20')]?_[_0x368b('0x21')](_0x1ca429[_0x368b('0x20')],function(_0x11ea2d){return{'model':db[_0x11ea2d[_0x368b('0x22')]],'as':_0x11ea2d['as'],'attributes':_0x11ea2d[_0x368b('0x1e')],'include':_0x11ea2d[_0x368b('0x20')]?_[_0x368b('0x21')](_0x11ea2d[_0x368b('0x20')],function(_0x376e61){return{'model':db[_0x376e61[_0x368b('0x22')]],'as':_0x376e61['as'],'attributes':_0x376e61[_0x368b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x368b('0xd')](function(_0x9f192e){logger[_0x368b('0x15')](_0x368b('0x18'),_0x540f57);logger[_0x368b('0x10')](_0x368b('0x18'),_0x540f57,JSON[_0x368b('0x11')](_0x9f192e));_0x3e2e9f(_0x9f192e);})[_0x368b('0x17')](function(_0x5db0b4){logger['error'](_0x368b('0x18'),_0x5db0b4[_0x368b('0x14')],_0x540f57);_0x27d2a0(_0x5d543e[_0x368b('0x12')](0x1f4,_0x5db0b4[_0x368b('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x12ae59){var _0x1f3ed3=this;return new Promise(function(_0x3699fe,_0x1c68ca){return db[_0x368b('0x19')]['find']({'raw':_0x12ae59[_0x368b('0x1b')]?_0x12ae59[_0x368b('0x1b')][_0x368b('0x1c')]===undefined?!![]:![]:!![],'where':_0x12ae59[_0x368b('0x1b')]?_0x12ae59['options']['where']||null:null,'attributes':_0x12ae59['options']?_0x12ae59[_0x368b('0x1b')][_0x368b('0x1e')]||null:null,'include':_0x12ae59[_0x368b('0x1b')]?_0x12ae59[_0x368b('0x1b')][_0x368b('0x20')]?_['map'](_0x12ae59[_0x368b('0x1b')][_0x368b('0x20')],function(_0x54e7e5){return{'model':db[_0x54e7e5[_0x368b('0x22')]],'as':_0x54e7e5['as'],'attributes':_0x54e7e5[_0x368b('0x1e')],'include':_0x54e7e5['include']?_[_0x368b('0x21')](_0x54e7e5[_0x368b('0x20')],function(_0x4a3044){return{'model':db[_0x4a3044[_0x368b('0x22')]],'as':_0x4a3044['as'],'attributes':_0x4a3044['attributes'],'include':_0x4a3044['include']?_['map'](_0x4a3044[_0x368b('0x20')],function(_0x4d6f22){return{'model':db[_0x4d6f22[_0x368b('0x22')]],'as':_0x4d6f22['as'],'attributes':_0x4d6f22[_0x368b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x368b('0xd')](function(_0xd0f23f){logger[_0x368b('0x15')](_0x368b('0x23'),_0x12ae59);logger[_0x368b('0x10')](_0x368b('0x23'),_0x12ae59,JSON['stringify'](_0xd0f23f));_0x3699fe(_0xd0f23f);})[_0x368b('0x17')](function(_0x1f60ea){logger['error'](_0x368b('0x23'),_0x1f60ea[_0x368b('0x14')],_0x12ae59);_0x1c68ca(_0x1f3ed3[_0x368b('0x12')](0x1f4,_0x1f60ea[_0x368b('0x14')]));});});}; \ No newline at end of file +var _0x47c5=['include','model','attributes','map','GetFreshsalesAccount','ShowFreshsalesAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshsalesAccount','findAll','options','raw'];(function(_0x27ab3b,_0x4ba1b9){var _0x5cf92f=function(_0x4102f6){while(--_0x4102f6){_0x27ab3b['push'](_0x27ab3b['shift']());}};_0x5cf92f(++_0x4ba1b9);}(_0x47c5,0x165));var _0x547c=function(_0x57cb4f,_0x541f57){_0x57cb4f=_0x57cb4f-0x0;var _0x29bb45=_0x47c5[_0x57cb4f];return _0x29bb45;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});}exports['GetFreshsalesAccount']=function(_0x23fa9e){var _0x199e4f=this;return new Promise(function(_0xeb059e,_0x4a8901){return db[_0x547c('0x18')][_0x547c('0x19')]({'raw':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e['options'][_0x547c('0x1b')]===undefined?!![]:![]:!![],'where':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e['options']['where']||null:null,'attributes':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')]['attributes']||null:null,'limit':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')]['limit']||null:null,'include':_0x23fa9e[_0x547c('0x1a')]?_0x23fa9e[_0x547c('0x1a')][_0x547c('0x1c')]?_['map'](_0x23fa9e[_0x547c('0x1a')][_0x547c('0x1c')],function(_0x470694){return{'model':db[_0x470694[_0x547c('0x1d')]],'as':_0x470694['as'],'attributes':_0x470694[_0x547c('0x1e')],'include':_0x470694[_0x547c('0x1c')]?_[_0x547c('0x1f')](_0x470694[_0x547c('0x1c')],function(_0x507895){return{'model':db[_0x507895[_0x547c('0x1d')]],'as':_0x507895['as'],'attributes':_0x507895['attributes'],'include':_0x507895['include']?_['map'](_0x507895['include'],function(_0x2c725d){return{'model':db[_0x2c725d['model']],'as':_0x2c725d['as'],'attributes':_0x2c725d[_0x547c('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ea493){logger['info'](_0x547c('0x20'),_0x23fa9e);logger[_0x547c('0x10')](_0x547c('0x20'),_0x23fa9e,JSON[_0x547c('0x12')](_0x3ea493));_0xeb059e(_0x3ea493);})[_0x547c('0x17')](function(_0x569924){logger['error'](_0x547c('0x20'),_0x569924['message'],_0x23fa9e);_0x4a8901(_0x199e4f[_0x547c('0x13')](0x1f4,_0x569924[_0x547c('0x15')]));});});};exports[_0x547c('0x21')]=function(_0x1695be){var _0x4652e7=this;return new Promise(function(_0x51e6e7,_0x342c10){return db['FreshsalesAccount']['find']({'raw':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1b')]===undefined?!![]:![]:!![],'where':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x22')]||null:null,'attributes':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1e')]||null:null,'include':_0x1695be[_0x547c('0x1a')]?_0x1695be[_0x547c('0x1a')][_0x547c('0x1c')]?_[_0x547c('0x1f')](_0x1695be[_0x547c('0x1a')]['include'],function(_0x3afc28){return{'model':db[_0x3afc28['model']],'as':_0x3afc28['as'],'attributes':_0x3afc28['attributes'],'include':_0x3afc28['include']?_[_0x547c('0x1f')](_0x3afc28[_0x547c('0x1c')],function(_0x31c7d3){return{'model':db[_0x31c7d3[_0x547c('0x1d')]],'as':_0x31c7d3['as'],'attributes':_0x31c7d3[_0x547c('0x1e')],'include':_0x31c7d3[_0x547c('0x1c')]?_['map'](_0x31c7d3['include'],function(_0x5ea2c7){return{'model':db[_0x5ea2c7[_0x547c('0x1d')]],'as':_0x5ea2c7['as'],'attributes':_0x5ea2c7[_0x547c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x547c('0xc')](function(_0x44687e){logger[_0x547c('0xd')](_0x547c('0x21'),_0x1695be);logger['debug'](_0x547c('0x21'),_0x1695be,JSON['stringify'](_0x44687e));_0x51e6e7(_0x44687e);})[_0x547c('0x17')](function(_0x18fcc5){logger['error'](_0x547c('0x21'),_0x18fcc5['message'],_0x1695be);_0x342c10(_0x4652e7['error'](0x1f4,_0x18fcc5[_0x547c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index fa10f42..d2056c2 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 _0xbbc9=['isAuthenticated','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','/:id'];(function(_0x47b030,_0x4b011d){var _0x3f634f=function(_0x1a38e8){while(--_0x1a38e8){_0x47b030['push'](_0x47b030['shift']());}};_0x3f634f(++_0x4b011d);}(_0xbbc9,0x1c3));var _0x9bbc=function(_0x2c5884,_0x289fe5){_0x2c5884=_0x2c5884-0x0;var _0x276de0=_0xbbc9[_0x2c5884];return _0x276de0;};'use strict';var multer=require(_0x9bbc('0x0'));var util=require(_0x9bbc('0x1'));var path=require(_0x9bbc('0x2'));var timeout=require(_0x9bbc('0x3'));var express=require(_0x9bbc('0x4'));var router=express[_0x9bbc('0x5')]();var fs_extra=require(_0x9bbc('0x6'));var auth=require(_0x9bbc('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0x9bbc('0x8')]('/',auth['isAuthenticated'](),controller[_0x9bbc('0x9')]);router[_0x9bbc('0x8')](_0x9bbc('0xa'),auth[_0x9bbc('0xb')](),controller[_0x9bbc('0xc')]);router[_0x9bbc('0x8')](_0x9bbc('0xd'),auth[_0x9bbc('0xb')](),controller['getSubjects']);router[_0x9bbc('0x8')](_0x9bbc('0xe'),auth[_0x9bbc('0xb')](),controller[_0x9bbc('0xf')]);router[_0x9bbc('0x8')](_0x9bbc('0x10'),auth[_0x9bbc('0xb')](),controller[_0x9bbc('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9bbc('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9bbc('0x13')](_0x9bbc('0xa'),auth['isAuthenticated'](),controller[_0x9bbc('0x14')]);module[_0x9bbc('0x15')]=router; \ No newline at end of file +var _0x4eb4=['./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','/:id','update','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x9b9e0a,_0x253d5c){var _0x22432f=function(_0x570bd4){while(--_0x570bd4){_0x9b9e0a['push'](_0x9b9e0a['shift']());}};_0x22432f(++_0x253d5c);}(_0x4eb4,0x1de));var _0x44eb=function(_0x2b45b5,_0x474458){_0x2b45b5=_0x2b45b5-0x0;var _0x1d9c06=_0x4eb4[_0x2b45b5];return _0x1d9c06;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x44eb('0x0'));var timeout=require(_0x44eb('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x44eb('0x2'));var auth=require(_0x44eb('0x3'));var interaction=require(_0x44eb('0x4'));var config=require(_0x44eb('0x5'));var controller=require(_0x44eb('0x6'));router[_0x44eb('0x7')]('/',auth[_0x44eb('0x8')](),controller[_0x44eb('0x9')]);router[_0x44eb('0x7')]('/:id',auth[_0x44eb('0x8')](),controller[_0x44eb('0xa')]);router['get'](_0x44eb('0xb'),auth[_0x44eb('0x8')](),controller[_0x44eb('0xc')]);router[_0x44eb('0x7')](_0x44eb('0xd'),auth[_0x44eb('0x8')](),controller[_0x44eb('0xe')]);router[_0x44eb('0x7')](_0x44eb('0xf'),auth[_0x44eb('0x8')](),controller[_0x44eb('0x10')]);router[_0x44eb('0x11')]('/',auth[_0x44eb('0x8')](),controller['create']);router[_0x44eb('0x12')](_0x44eb('0x13'),auth['isAuthenticated'](),controller[_0x44eb('0x14')]);router['delete'](_0x44eb('0x13'),auth[_0x44eb('0x8')](),controller['destroy']);module[_0x44eb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 5e53c51..1b9a8fd 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 _0xceb7=['sequelize','STRING'];(function(_0x5a7112,_0x1f9492){var _0x3147f7=function(_0x4d2329){while(--_0x4d2329){_0x5a7112['push'](_0x5a7112['shift']());}};_0x3147f7(++_0x1f9492);}(_0xceb7,0xc8));var _0x7ceb=function(_0x15fffe,_0x259450){_0x15fffe=_0x15fffe-0x0;var _0x35fa05=_0xceb7[_0x15fffe];return _0x35fa05;};'use strict';var Sequelize=require(_0x7ceb('0x0'));module['exports']={'name':{'type':Sequelize[_0x7ceb('0x1')]},'description':{'type':Sequelize[_0x7ceb('0x1')]}}; \ No newline at end of file +var _0x00de=['sequelize','exports','STRING'];(function(_0x530f6f,_0x136bc2){var _0x54761f=function(_0x16e1c1){while(--_0x16e1c1){_0x530f6f['push'](_0x530f6f['shift']());}};_0x54761f(++_0x136bc2);}(_0x00de,0xba));var _0xe00d=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0x00de[_0x4a0e68];return _0x4fb274;};'use strict';var Sequelize=require(_0xe00d('0x0'));module[_0xe00d('0x1')]={'name':{'type':Sequelize[_0xe00d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index e1f75dd..347727d 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 _0x49d5=['findOne','pick','getDescriptions','FreshsalesField','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','json','save','update','then','destroy','error','stack','name','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','getSubjects'];(function(_0x2facd6,_0x2aaf16){var _0x4fbcb0=function(_0x4a8838){while(--_0x4a8838){_0x2facd6['push'](_0x2facd6['shift']());}};_0x4fbcb0(++_0x2aaf16);}(_0x49d5,0x186));var _0x549d=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x49d5[_0x46aff0];return _0x9d78cf;};'use strict';var emlformat=require(_0x549d('0x0'));var rimraf=require(_0x549d('0x1'));var zipdir=require(_0x549d('0x2'));var jsonpatch=require(_0x549d('0x3'));var rp=require(_0x549d('0x4'));var moment=require(_0x549d('0x5'));var BPromise=require(_0x549d('0x6'));var Mustache=require('mustache');var util=require(_0x549d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x549d('0x8'));var ejs=require(_0x549d('0x9'));var fs=require('fs');var fs_extra=require(_0x549d('0xa'));var _=require(_0x549d('0xb'));var squel=require(_0x549d('0xc'));var crypto=require(_0x549d('0xd'));var jsforce=require(_0x549d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x549d('0xf'));var Redis=require(_0x549d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x549d('0x11'));var logger=require('../../config/logger')(_0x549d('0x12'));var utils=require(_0x549d('0x13'));var config=require(_0x549d('0x14'));var licenseUtil=require(_0x549d('0x15'));var db=require(_0x549d('0x16'))['db'];function respondWithStatusCode(_0x40b264,_0x597b08){_0x597b08=_0x597b08||0xcc;return function(_0x5c5203){if(_0x5c5203){return _0x40b264[_0x549d('0x17')](_0x597b08);}return _0x40b264['status'](_0x597b08)[_0x549d('0x18')]();};}function respondWithResult(_0x32c7a1,_0x4810cf){_0x4810cf=_0x4810cf||0xc8;return function(_0x8d3173){if(_0x8d3173){return _0x32c7a1[_0x549d('0x19')](_0x4810cf)['json'](_0x8d3173);}};}function respondWithFilteredResult(_0x56ad9d,_0x3e6a2d){return function(_0x8f3d7a){if(_0x8f3d7a){var _0x5c3f4b=typeof _0x3e6a2d[_0x549d('0x1a')]==='undefined'&&typeof _0x3e6a2d['limit']===_0x549d('0x1b');var _0x4c2680=_0x8f3d7a[_0x549d('0x1c')];var _0x2f9d91=_0x5c3f4b?0x0:_0x3e6a2d[_0x549d('0x1a')];var _0x3bdcdf=_0x5c3f4b?_0x8f3d7a[_0x549d('0x1c')]:_0x3e6a2d[_0x549d('0x1a')]+_0x3e6a2d['limit'];var _0x56ebc0;if(_0x3bdcdf>=_0x4c2680){_0x3bdcdf=_0x4c2680;_0x56ebc0=0xc8;}else{_0x56ebc0=0xce;}_0x56ad9d[_0x549d('0x19')](_0x56ebc0);return _0x56ad9d[_0x549d('0x1d')]('Content-Range',_0x2f9d91+'-'+_0x3bdcdf+'/'+_0x4c2680)[_0x549d('0x1e')](_0x8f3d7a);}return null;};}function patchUpdates(_0xf35543){return function(_0x25feef){try{jsonpatch['apply'](_0x25feef,_0xf35543,!![]);}catch(_0x5f47a9){return BPromise['reject'](_0x5f47a9);}return _0x25feef[_0x549d('0x1f')]();};}function saveUpdates(_0x54e482,_0x2716d8){return function(_0x1c3459){if(_0x1c3459){return _0x1c3459[_0x549d('0x20')](_0x54e482)[_0x549d('0x21')](function(_0x2b0c60){return _0x2b0c60;});}return null;};}function removeEntity(_0x5ddf5a,_0x4e0790){return function(_0x3e385b){if(_0x3e385b){return _0x3e385b[_0x549d('0x22')]()[_0x549d('0x21')](function(){_0x5ddf5a['status'](0xcc)[_0x549d('0x18')]();});}};}function handleEntityNotFound(_0x1a42ca,_0x3bd45f){return function(_0x1cf38a){if(!_0x1cf38a){_0x1a42ca[_0x549d('0x17')](0x194);}return _0x1cf38a;};}function handleError(_0x13f83e,_0x23dba2){_0x23dba2=_0x23dba2||0x1f4;return function(_0x2c2842){logger[_0x549d('0x23')](_0x2c2842[_0x549d('0x24')]);if(_0x2c2842[_0x549d('0x25')]){delete _0x2c2842[_0x549d('0x25')];}_0x13f83e[_0x549d('0x19')](_0x23dba2)['send'](_0x2c2842);};}exports['index']=function(_0x43e461,_0x324280){var _0x4d515b={},_0x5a8198={},_0x23e627={'count':0x0,'rows':[]};var _0x5c14b0=_[_0x549d('0x26')](db[_0x549d('0x27')][_0x549d('0x28')],function(_0x2c2119){return{'name':_0x2c2119[_0x549d('0x29')],'type':_0x2c2119[_0x549d('0x2a')]['key']};});_0x5a8198[_0x549d('0x2b')]=_['map'](_0x5c14b0,_0x549d('0x25'));_0x5a8198[_0x549d('0x2c')]=_[_0x549d('0x2d')](_0x43e461[_0x549d('0x2c')]);_0x5a8198[_0x549d('0x2e')]=_[_0x549d('0x2f')](_0x5a8198[_0x549d('0x2b')],_0x5a8198[_0x549d('0x2c')]);_0x4d515b['attributes']=_[_0x549d('0x2f')](_0x5a8198[_0x549d('0x2b')],qs[_0x549d('0x30')](_0x43e461['query'][_0x549d('0x30')]));_0x4d515b[_0x549d('0x31')]=_0x4d515b['attributes'][_0x549d('0x32')]?_0x4d515b[_0x549d('0x31')]:_0x5a8198['model'];if(!_0x43e461[_0x549d('0x2c')][_0x549d('0x33')](_0x549d('0x34'))){_0x4d515b[_0x549d('0x35')]=qs['limit'](_0x43e461[_0x549d('0x2c')][_0x549d('0x35')]);_0x4d515b[_0x549d('0x1a')]=qs[_0x549d('0x1a')](_0x43e461[_0x549d('0x2c')][_0x549d('0x1a')]);}_0x4d515b[_0x549d('0x36')]=qs[_0x549d('0x37')](_0x43e461[_0x549d('0x2c')][_0x549d('0x37')]);_0x4d515b[_0x549d('0x38')]=qs[_0x549d('0x2e')](_['pick'](_0x43e461[_0x549d('0x2c')],_0x5a8198['filters']),_0x5c14b0);if(_0x43e461[_0x549d('0x2c')][_0x549d('0x39')]){_0x4d515b['where']=_[_0x549d('0x3a')](_0x4d515b[_0x549d('0x38')],{'$or':_[_0x549d('0x26')](_0x5c14b0,function(_0x2773a3){if(_0x2773a3['type']!==_0x549d('0x3b')){var _0x5d0b1c={};_0x5d0b1c[_0x2773a3[_0x549d('0x25')]]={'$like':'%'+_0x43e461['query']['filter']+'%'};return _0x5d0b1c;}})});}_0x4d515b=_[_0x549d('0x3a')]({},_0x4d515b,_0x43e461[_0x549d('0x3c')]);var _0xe56fa4={'where':_0x4d515b['where']};return db[_0x549d('0x27')][_0x549d('0x1c')](_0xe56fa4)[_0x549d('0x21')](function(_0x43050a){_0x23e627['count']=_0x43050a;if(_0x43e461['query'][_0x549d('0x3d')]){_0x4d515b[_0x549d('0x3e')]=[{'all':!![]}];}return db[_0x549d('0x27')][_0x549d('0x3f')](_0x4d515b);})[_0x549d('0x21')](function(_0x5cce72){_0x23e627[_0x549d('0x40')]=_0x5cce72;return _0x23e627;})[_0x549d('0x21')](respondWithFilteredResult(_0x324280,_0x4d515b))['catch'](handleError(_0x324280,null));};exports[_0x549d('0x41')]=function(_0x32c758,_0x27facb){var _0x4f9e2a={'raw':![],'where':{'id':_0x32c758[_0x549d('0x42')]['id']}},_0x3d7e03={};_0x3d7e03[_0x549d('0x2b')]=_[_0x549d('0x2d')](db[_0x549d('0x27')][_0x549d('0x28')]);_0x3d7e03[_0x549d('0x2c')]=_[_0x549d('0x2d')](_0x32c758['query']);_0x3d7e03[_0x549d('0x2e')]=_[_0x549d('0x2f')](_0x3d7e03[_0x549d('0x2b')],_0x3d7e03[_0x549d('0x2c')]);_0x4f9e2a[_0x549d('0x31')]=_[_0x549d('0x2f')](_0x3d7e03[_0x549d('0x2b')],qs[_0x549d('0x30')](_0x32c758['query'][_0x549d('0x30')]));_0x4f9e2a['attributes']=_0x4f9e2a[_0x549d('0x31')][_0x549d('0x32')]?_0x4f9e2a[_0x549d('0x31')]:_0x3d7e03[_0x549d('0x2b')];if(_0x32c758['query'][_0x549d('0x3d')]){_0x4f9e2a[_0x549d('0x3e')]=[{'all':!![]}];}_0x4f9e2a=_[_0x549d('0x3a')]({},_0x4f9e2a,_0x32c758['options']);return db['FreshsalesConfiguration'][_0x549d('0x43')](_0x4f9e2a)['then'](handleEntityNotFound(_0x27facb,null))[_0x549d('0x21')](respondWithResult(_0x27facb,null))[_0x549d('0x44')](handleError(_0x27facb,null));};exports[_0x549d('0x45')]=function(_0x43f561,_0x10cd7b){return db[_0x549d('0x27')][_0x549d('0x45')](_0x43f561['body'],{})[_0x549d('0x21')](respondWithResult(_0x10cd7b,0xc9))[_0x549d('0x44')](handleError(_0x10cd7b,null));};exports[_0x549d('0x20')]=function(_0x2001e3,_0x45da15){if(_0x2001e3['body']['id']){delete _0x2001e3[_0x549d('0x46')]['id'];}return db[_0x549d('0x27')]['find']({'where':{'id':_0x2001e3[_0x549d('0x42')]['id']}})['then'](handleEntityNotFound(_0x45da15,null))[_0x549d('0x21')](saveUpdates(_0x2001e3[_0x549d('0x46')],null))[_0x549d('0x21')](respondWithResult(_0x45da15,null))[_0x549d('0x44')](handleError(_0x45da15,null));};exports[_0x549d('0x22')]=function(_0x206b78,_0x39dce7){return db[_0x549d('0x27')][_0x549d('0x43')]({'where':{'id':_0x206b78['params']['id']}})[_0x549d('0x21')](handleEntityNotFound(_0x39dce7,null))[_0x549d('0x21')](removeEntity(_0x39dce7,null))[_0x549d('0x44')](handleError(_0x39dce7,null));};exports[_0x549d('0x47')]=function(_0x357a3e,_0x4a6d17,_0x313651){var _0x332cb8={};var _0x3d5691={};var _0x3dea76;var _0x1a8056;return db[_0x549d('0x27')][_0x549d('0x48')]({'where':{'id':_0x357a3e['params']['id']}})['then'](handleEntityNotFound(_0x4a6d17,null))[_0x549d('0x21')](function(_0x2e0cbf){if(_0x2e0cbf){_0x3dea76=_0x2e0cbf;_0x3d5691[_0x549d('0x2b')]=_[_0x549d('0x2d')](db['FreshsalesField'][_0x549d('0x28')]);_0x3d5691[_0x549d('0x2c')]=_['keys'](_0x357a3e[_0x549d('0x2c')]);_0x3d5691['filters']=_['intersection'](_0x3d5691[_0x549d('0x2b')],_0x3d5691[_0x549d('0x2c')]);_0x332cb8[_0x549d('0x31')]=_['intersection'](_0x3d5691[_0x549d('0x2b')],qs[_0x549d('0x30')](_0x357a3e['query'][_0x549d('0x30')]));_0x332cb8[_0x549d('0x31')]=_0x332cb8['attributes']['length']?_0x332cb8[_0x549d('0x31')]:_0x3d5691[_0x549d('0x2b')];_0x332cb8['order']=qs[_0x549d('0x37')](_0x357a3e[_0x549d('0x2c')][_0x549d('0x37')]);_0x332cb8['where']=qs[_0x549d('0x2e')](_[_0x549d('0x49')](_0x357a3e['query'],_0x3d5691[_0x549d('0x2e')]));if(_0x357a3e[_0x549d('0x2c')]['filter']){_0x332cb8[_0x549d('0x38')]=_[_0x549d('0x3a')](_0x332cb8[_0x549d('0x38')],{'$or':_[_0x549d('0x26')](_0x332cb8[_0x549d('0x31')],function(_0x4cfbf5){var _0x190e78={};_0x190e78[_0x4cfbf5]={'$like':'%'+_0x357a3e[_0x549d('0x2c')][_0x549d('0x39')]+'%'};return _0x190e78;})});}_0x332cb8=_[_0x549d('0x3a')]({},_0x332cb8,_0x357a3e['options']);return _0x3dea76[_0x549d('0x47')](_0x332cb8);}})['then'](function(_0x297ec7){if(_0x297ec7){_0x1a8056=_0x297ec7[_0x549d('0x32')];if(!_0x357a3e[_0x549d('0x2c')][_0x549d('0x33')]('nolimit')){_0x332cb8['limit']=qs['limit'](_0x357a3e[_0x549d('0x2c')][_0x549d('0x35')]);_0x332cb8[_0x549d('0x1a')]=qs[_0x549d('0x1a')](_0x357a3e[_0x549d('0x2c')][_0x549d('0x1a')]);}return _0x3dea76[_0x549d('0x47')](_0x332cb8);}})[_0x549d('0x21')](function(_0x7c4f23){if(_0x7c4f23){return _0x7c4f23?{'count':_0x1a8056,'rows':_0x7c4f23}:null;}})[_0x549d('0x21')](respondWithResult(_0x4a6d17,null))['catch'](handleError(_0x4a6d17,null));};exports[_0x549d('0x4a')]=function(_0x5cc64c,_0xe4339a,_0xffc054){var _0x1db9c8={};var _0x29eac2={};var _0x211c60;var _0x909464;return db[_0x549d('0x27')]['findOne']({'where':{'id':_0x5cc64c[_0x549d('0x42')]['id']}})[_0x549d('0x21')](handleEntityNotFound(_0xe4339a,null))['then'](function(_0x408122){if(_0x408122){_0x211c60=_0x408122;_0x29eac2['model']=_[_0x549d('0x2d')](db[_0x549d('0x4b')][_0x549d('0x28')]);_0x29eac2[_0x549d('0x2c')]=_[_0x549d('0x2d')](_0x5cc64c[_0x549d('0x2c')]);_0x29eac2[_0x549d('0x2e')]=_[_0x549d('0x2f')](_0x29eac2[_0x549d('0x2b')],_0x29eac2['query']);_0x1db9c8[_0x549d('0x31')]=_['intersection'](_0x29eac2[_0x549d('0x2b')],qs[_0x549d('0x30')](_0x5cc64c[_0x549d('0x2c')][_0x549d('0x30')]));_0x1db9c8[_0x549d('0x31')]=_0x1db9c8[_0x549d('0x31')][_0x549d('0x32')]?_0x1db9c8[_0x549d('0x31')]:_0x29eac2[_0x549d('0x2b')];_0x1db9c8[_0x549d('0x36')]=qs['sort'](_0x5cc64c['query'][_0x549d('0x37')]);_0x1db9c8['where']=qs[_0x549d('0x2e')](_['pick'](_0x5cc64c[_0x549d('0x2c')],_0x29eac2[_0x549d('0x2e')]));if(_0x5cc64c['query'][_0x549d('0x39')]){_0x1db9c8[_0x549d('0x38')]=_['merge'](_0x1db9c8[_0x549d('0x38')],{'$or':_[_0x549d('0x26')](_0x1db9c8[_0x549d('0x31')],function(_0x362f88){var _0x48f174={};_0x48f174[_0x362f88]={'$like':'%'+_0x5cc64c[_0x549d('0x2c')]['filter']+'%'};return _0x48f174;})});}_0x1db9c8=_[_0x549d('0x3a')]({},_0x1db9c8,_0x5cc64c[_0x549d('0x3c')]);return _0x211c60[_0x549d('0x4a')](_0x1db9c8);}})[_0x549d('0x21')](function(_0x5f3393){if(_0x5f3393){_0x909464=_0x5f3393[_0x549d('0x32')];if(!_0x5cc64c[_0x549d('0x2c')][_0x549d('0x33')](_0x549d('0x34'))){_0x1db9c8[_0x549d('0x35')]=qs[_0x549d('0x35')](_0x5cc64c['query']['limit']);_0x1db9c8[_0x549d('0x1a')]=qs[_0x549d('0x1a')](_0x5cc64c['query'][_0x549d('0x1a')]);}return _0x211c60[_0x549d('0x4a')](_0x1db9c8);}})[_0x549d('0x21')](function(_0x4fd317){if(_0x4fd317){return _0x4fd317?{'count':_0x909464,'rows':_0x4fd317}:null;}})[_0x549d('0x21')](respondWithResult(_0xe4339a,null))[_0x549d('0x44')](handleError(_0xe4339a,null));};exports[_0x549d('0x4c')]=function(_0x323840,_0x3f66ea,_0x4db025){var _0x54ecc6={};var _0x5b1eb0={};var _0x377b85;var _0x57043e;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x323840['params']['id']}})[_0x549d('0x21')](handleEntityNotFound(_0x3f66ea,null))['then'](function(_0x364063){if(_0x364063){_0x377b85=_0x364063;_0x5b1eb0['model']=_[_0x549d('0x2d')](db[_0x549d('0x4b')][_0x549d('0x28')]);_0x5b1eb0[_0x549d('0x2c')]=_[_0x549d('0x2d')](_0x323840[_0x549d('0x2c')]);_0x5b1eb0[_0x549d('0x2e')]=_['intersection'](_0x5b1eb0[_0x549d('0x2b')],_0x5b1eb0[_0x549d('0x2c')]);_0x54ecc6[_0x549d('0x31')]=_[_0x549d('0x2f')](_0x5b1eb0['model'],qs[_0x549d('0x30')](_0x323840[_0x549d('0x2c')]['fields']));_0x54ecc6['attributes']=_0x54ecc6[_0x549d('0x31')][_0x549d('0x32')]?_0x54ecc6['attributes']:_0x5b1eb0['model'];_0x54ecc6[_0x549d('0x36')]=qs[_0x549d('0x37')](_0x323840['query'][_0x549d('0x37')]);_0x54ecc6[_0x549d('0x38')]=qs[_0x549d('0x2e')](_['pick'](_0x323840[_0x549d('0x2c')],_0x5b1eb0['filters']));if(_0x323840[_0x549d('0x2c')]['filter']){_0x54ecc6['where']=_[_0x549d('0x3a')](_0x54ecc6['where'],{'$or':_[_0x549d('0x26')](_0x54ecc6[_0x549d('0x31')],function(_0x595d4f){var _0x346612={};_0x346612[_0x595d4f]={'$like':'%'+_0x323840[_0x549d('0x2c')][_0x549d('0x39')]+'%'};return _0x346612;})});}_0x54ecc6=_[_0x549d('0x3a')]({},_0x54ecc6,_0x323840['options']);return _0x377b85[_0x549d('0x4c')](_0x54ecc6);}})[_0x549d('0x21')](function(_0x197940){if(_0x197940){_0x57043e=_0x197940[_0x549d('0x32')];if(!_0x323840[_0x549d('0x2c')][_0x549d('0x33')](_0x549d('0x34'))){_0x54ecc6['limit']=qs[_0x549d('0x35')](_0x323840[_0x549d('0x2c')][_0x549d('0x35')]);_0x54ecc6[_0x549d('0x1a')]=qs[_0x549d('0x1a')](_0x323840[_0x549d('0x2c')]['offset']);}return _0x377b85['getFields'](_0x54ecc6);}})[_0x549d('0x21')](function(_0x4791b3){if(_0x4791b3){return _0x4791b3?{'count':_0x57043e,'rows':_0x4791b3}:null;}})[_0x549d('0x21')](respondWithResult(_0x3f66ea,null))[_0x549d('0x44')](handleError(_0x3f66ea,null));}; \ No newline at end of file +var _0xa245=['FreshsalesField','pick','getSubjects','getDescriptions','getFields','eml-format','rimraf','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','FreshsalesConfiguration','includeAll','include','rows','catch','show','params','keys','options','find','create','body','findOne'];(function(_0x39dadd,_0x5e021f){var _0x52c414=function(_0x2fff0a){while(--_0x2fff0a){_0x39dadd['push'](_0x39dadd['shift']());}};_0x52c414(++_0x5e021f);}(_0xa245,0x195));var _0x5a24=function(_0x15d08f,_0x37ce88){_0x15d08f=_0x15d08f-0x0;var _0x4a0056=_0xa245[_0x15d08f];return _0x4a0056;};'use strict';var emlformat=require(_0x5a24('0x0'));var rimraf=require(_0x5a24('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5a24('0x2'));var moment=require(_0x5a24('0x3'));var BPromise=require(_0x5a24('0x4'));var Mustache=require(_0x5a24('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5a24('0x6'));var fs=require('fs');var fs_extra=require(_0x5a24('0x7'));var _=require(_0x5a24('0x8'));var squel=require('squel');var crypto=require(_0x5a24('0x9'));var jsforce=require(_0x5a24('0xa'));var deskjs=require(_0x5a24('0xb'));var toCsv=require(_0x5a24('0xc'));var querystring=require(_0x5a24('0xd'));var Papa=require(_0x5a24('0xe'));var Redis=require(_0x5a24('0xf'));var authService=require(_0x5a24('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5a24('0x11'));var hardwareService=require(_0x5a24('0x12'));var logger=require(_0x5a24('0x13'))('api');var utils=require(_0x5a24('0x14'));var config=require(_0x5a24('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a24('0x16'))['db'];function respondWithStatusCode(_0x34918d,_0x26d819){_0x26d819=_0x26d819||0xcc;return function(_0x246972){if(_0x246972){return _0x34918d[_0x5a24('0x17')](_0x26d819);}return _0x34918d[_0x5a24('0x18')](_0x26d819)[_0x5a24('0x19')]();};}function respondWithResult(_0x2d994c,_0x1d4da0){_0x1d4da0=_0x1d4da0||0xc8;return function(_0x23ef8c){if(_0x23ef8c){return _0x2d994c[_0x5a24('0x18')](_0x1d4da0)['json'](_0x23ef8c);}};}function respondWithFilteredResult(_0x12f0d8,_0xd68d7b){return function(_0x1c9e7e){if(_0x1c9e7e){var _0x18fd14=typeof _0xd68d7b[_0x5a24('0x1a')]===_0x5a24('0x1b')&&typeof _0xd68d7b['limit']===_0x5a24('0x1b');var _0xba16bd=_0x1c9e7e['count'];var _0x3bfd6a=_0x18fd14?0x0:_0xd68d7b['offset'];var _0x2aed95=_0x18fd14?_0x1c9e7e[_0x5a24('0x1c')]:_0xd68d7b['offset']+_0xd68d7b[_0x5a24('0x1d')];var _0x1a44aa;if(_0x2aed95>=_0xba16bd){_0x2aed95=_0xba16bd;_0x1a44aa=0xc8;}else{_0x1a44aa=0xce;}_0x12f0d8[_0x5a24('0x18')](_0x1a44aa);return _0x12f0d8[_0x5a24('0x1e')]('Content-Range',_0x3bfd6a+'-'+_0x2aed95+'/'+_0xba16bd)[_0x5a24('0x1f')](_0x1c9e7e);}return null;};}function patchUpdates(_0x2ba9bd){return function(_0x279957){try{jsonpatch[_0x5a24('0x20')](_0x279957,_0x2ba9bd,!![]);}catch(_0x36c9df){return BPromise[_0x5a24('0x21')](_0x36c9df);}return _0x279957[_0x5a24('0x22')]();};}function saveUpdates(_0x25da4e,_0x5f09c5){return function(_0x5de749){if(_0x5de749){return _0x5de749[_0x5a24('0x23')](_0x25da4e)['then'](function(_0x1bfee6){return _0x1bfee6;});}return null;};}function removeEntity(_0xaf265b,_0x17cdb0){return function(_0x349cc8){if(_0x349cc8){return _0x349cc8[_0x5a24('0x24')]()[_0x5a24('0x25')](function(){_0xaf265b['status'](0xcc)[_0x5a24('0x19')]();});}};}function handleEntityNotFound(_0x55f286,_0x55bb08){return function(_0x232b05){if(!_0x232b05){_0x55f286[_0x5a24('0x17')](0x194);}return _0x232b05;};}function handleError(_0x11560b,_0x28dcea){_0x28dcea=_0x28dcea||0x1f4;return function(_0x54507e){logger[_0x5a24('0x26')](_0x54507e[_0x5a24('0x27')]);if(_0x54507e[_0x5a24('0x28')]){delete _0x54507e[_0x5a24('0x28')];}_0x11560b[_0x5a24('0x18')](_0x28dcea)[_0x5a24('0x29')](_0x54507e);};}exports[_0x5a24('0x2a')]=function(_0x2099bb,_0x290fd2){var _0x7d5ec2={},_0x25fb1c={},_0x30eb46={'count':0x0,'rows':[]};var _0x24c8e2=_[_0x5a24('0x2b')](db['FreshsalesConfiguration'][_0x5a24('0x2c')],function(_0x4b1715){return{'name':_0x4b1715[_0x5a24('0x2d')],'type':_0x4b1715[_0x5a24('0x2e')]['key']};});_0x25fb1c[_0x5a24('0x2f')]=_[_0x5a24('0x2b')](_0x24c8e2,_0x5a24('0x28'));_0x25fb1c['query']=_['keys'](_0x2099bb['query']);_0x25fb1c[_0x5a24('0x30')]=_[_0x5a24('0x31')](_0x25fb1c['model'],_0x25fb1c[_0x5a24('0x32')]);_0x7d5ec2[_0x5a24('0x33')]=_['intersection'](_0x25fb1c[_0x5a24('0x2f')],qs[_0x5a24('0x34')](_0x2099bb[_0x5a24('0x32')][_0x5a24('0x34')]));_0x7d5ec2[_0x5a24('0x33')]=_0x7d5ec2[_0x5a24('0x33')][_0x5a24('0x35')]?_0x7d5ec2[_0x5a24('0x33')]:_0x25fb1c['model'];if(!_0x2099bb['query'][_0x5a24('0x36')](_0x5a24('0x37'))){_0x7d5ec2[_0x5a24('0x1d')]=qs[_0x5a24('0x1d')](_0x2099bb[_0x5a24('0x32')][_0x5a24('0x1d')]);_0x7d5ec2['offset']=qs[_0x5a24('0x1a')](_0x2099bb['query']['offset']);}_0x7d5ec2[_0x5a24('0x38')]=qs[_0x5a24('0x39')](_0x2099bb[_0x5a24('0x32')][_0x5a24('0x39')]);_0x7d5ec2['where']=qs['filters'](_['pick'](_0x2099bb[_0x5a24('0x32')],_0x25fb1c[_0x5a24('0x30')]),_0x24c8e2);if(_0x2099bb[_0x5a24('0x32')][_0x5a24('0x3a')]){_0x7d5ec2[_0x5a24('0x3b')]=_['merge'](_0x7d5ec2[_0x5a24('0x3b')],{'$or':_[_0x5a24('0x2b')](_0x24c8e2,function(_0x5bbe04){if(_0x5bbe04['type']!==_0x5a24('0x3c')){var _0x2d982b={};_0x2d982b[_0x5bbe04[_0x5a24('0x28')]]={'$like':'%'+_0x2099bb[_0x5a24('0x32')][_0x5a24('0x3a')]+'%'};return _0x2d982b;}})});}_0x7d5ec2=_[_0x5a24('0x3d')]({},_0x7d5ec2,_0x2099bb['options']);var _0x34da13={'where':_0x7d5ec2[_0x5a24('0x3b')]};return db[_0x5a24('0x3e')]['count'](_0x34da13)[_0x5a24('0x25')](function(_0x106db4){_0x30eb46[_0x5a24('0x1c')]=_0x106db4;if(_0x2099bb['query'][_0x5a24('0x3f')]){_0x7d5ec2[_0x5a24('0x40')]=[{'all':!![]}];}return db[_0x5a24('0x3e')]['findAll'](_0x7d5ec2);})[_0x5a24('0x25')](function(_0x1971c3){_0x30eb46[_0x5a24('0x41')]=_0x1971c3;return _0x30eb46;})[_0x5a24('0x25')](respondWithFilteredResult(_0x290fd2,_0x7d5ec2))[_0x5a24('0x42')](handleError(_0x290fd2,null));};exports[_0x5a24('0x43')]=function(_0x32e238,_0x205d34){var _0x2598e0={'raw':![],'where':{'id':_0x32e238[_0x5a24('0x44')]['id']}},_0x19e6fc={};_0x19e6fc[_0x5a24('0x2f')]=_[_0x5a24('0x45')](db[_0x5a24('0x3e')][_0x5a24('0x2c')]);_0x19e6fc[_0x5a24('0x32')]=_[_0x5a24('0x45')](_0x32e238[_0x5a24('0x32')]);_0x19e6fc[_0x5a24('0x30')]=_[_0x5a24('0x31')](_0x19e6fc[_0x5a24('0x2f')],_0x19e6fc[_0x5a24('0x32')]);_0x2598e0[_0x5a24('0x33')]=_[_0x5a24('0x31')](_0x19e6fc['model'],qs[_0x5a24('0x34')](_0x32e238[_0x5a24('0x32')]['fields']));_0x2598e0[_0x5a24('0x33')]=_0x2598e0[_0x5a24('0x33')][_0x5a24('0x35')]?_0x2598e0['attributes']:_0x19e6fc['model'];if(_0x32e238[_0x5a24('0x32')][_0x5a24('0x3f')]){_0x2598e0[_0x5a24('0x40')]=[{'all':!![]}];}_0x2598e0=_[_0x5a24('0x3d')]({},_0x2598e0,_0x32e238[_0x5a24('0x46')]);return db[_0x5a24('0x3e')][_0x5a24('0x47')](_0x2598e0)['then'](handleEntityNotFound(_0x205d34,null))[_0x5a24('0x25')](respondWithResult(_0x205d34,null))[_0x5a24('0x42')](handleError(_0x205d34,null));};exports[_0x5a24('0x48')]=function(_0x2a9eea,_0x252318){return db[_0x5a24('0x3e')]['create'](_0x2a9eea[_0x5a24('0x49')],{})[_0x5a24('0x25')](respondWithResult(_0x252318,0xc9))[_0x5a24('0x42')](handleError(_0x252318,null));};exports[_0x5a24('0x23')]=function(_0xbbbef9,_0x31cbe0){if(_0xbbbef9[_0x5a24('0x49')]['id']){delete _0xbbbef9[_0x5a24('0x49')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0xbbbef9[_0x5a24('0x44')]['id']}})[_0x5a24('0x25')](handleEntityNotFound(_0x31cbe0,null))['then'](saveUpdates(_0xbbbef9[_0x5a24('0x49')],null))[_0x5a24('0x25')](respondWithResult(_0x31cbe0,null))['catch'](handleError(_0x31cbe0,null));};exports[_0x5a24('0x24')]=function(_0x26e924,_0x4c383a){return db['FreshsalesConfiguration'][_0x5a24('0x47')]({'where':{'id':_0x26e924[_0x5a24('0x44')]['id']}})[_0x5a24('0x25')](handleEntityNotFound(_0x4c383a,null))[_0x5a24('0x25')](removeEntity(_0x4c383a,null))['catch'](handleError(_0x4c383a,null));};exports['getSubjects']=function(_0x10aecd,_0x21d35c,_0x58b146){var _0x1e99f6={};var _0x367824={};var _0x5c1974;var _0x5ac292;return db[_0x5a24('0x3e')][_0x5a24('0x4a')]({'where':{'id':_0x10aecd[_0x5a24('0x44')]['id']}})[_0x5a24('0x25')](handleEntityNotFound(_0x21d35c,null))[_0x5a24('0x25')](function(_0x3f7314){if(_0x3f7314){_0x5c1974=_0x3f7314;_0x367824[_0x5a24('0x2f')]=_[_0x5a24('0x45')](db[_0x5a24('0x4b')][_0x5a24('0x2c')]);_0x367824[_0x5a24('0x32')]=_[_0x5a24('0x45')](_0x10aecd[_0x5a24('0x32')]);_0x367824[_0x5a24('0x30')]=_['intersection'](_0x367824['model'],_0x367824[_0x5a24('0x32')]);_0x1e99f6[_0x5a24('0x33')]=_[_0x5a24('0x31')](_0x367824['model'],qs['fields'](_0x10aecd[_0x5a24('0x32')]['fields']));_0x1e99f6[_0x5a24('0x33')]=_0x1e99f6[_0x5a24('0x33')][_0x5a24('0x35')]?_0x1e99f6[_0x5a24('0x33')]:_0x367824[_0x5a24('0x2f')];_0x1e99f6[_0x5a24('0x38')]=qs[_0x5a24('0x39')](_0x10aecd[_0x5a24('0x32')][_0x5a24('0x39')]);_0x1e99f6[_0x5a24('0x3b')]=qs['filters'](_[_0x5a24('0x4c')](_0x10aecd[_0x5a24('0x32')],_0x367824[_0x5a24('0x30')]));if(_0x10aecd['query'][_0x5a24('0x3a')]){_0x1e99f6[_0x5a24('0x3b')]=_[_0x5a24('0x3d')](_0x1e99f6[_0x5a24('0x3b')],{'$or':_[_0x5a24('0x2b')](_0x1e99f6[_0x5a24('0x33')],function(_0x339895){var _0x49443e={};_0x49443e[_0x339895]={'$like':'%'+_0x10aecd['query'][_0x5a24('0x3a')]+'%'};return _0x49443e;})});}_0x1e99f6=_[_0x5a24('0x3d')]({},_0x1e99f6,_0x10aecd['options']);return _0x5c1974[_0x5a24('0x4d')](_0x1e99f6);}})[_0x5a24('0x25')](function(_0x19c2bd){if(_0x19c2bd){_0x5ac292=_0x19c2bd['length'];if(!_0x10aecd[_0x5a24('0x32')][_0x5a24('0x36')](_0x5a24('0x37'))){_0x1e99f6['limit']=qs[_0x5a24('0x1d')](_0x10aecd[_0x5a24('0x32')]['limit']);_0x1e99f6['offset']=qs['offset'](_0x10aecd['query'][_0x5a24('0x1a')]);}return _0x5c1974['getSubjects'](_0x1e99f6);}})['then'](function(_0x43cf15){if(_0x43cf15){return _0x43cf15?{'count':_0x5ac292,'rows':_0x43cf15}:null;}})[_0x5a24('0x25')](respondWithResult(_0x21d35c,null))[_0x5a24('0x42')](handleError(_0x21d35c,null));};exports[_0x5a24('0x4e')]=function(_0x554a44,_0x320a4a,_0x120506){var _0x399417={};var _0x573105={};var _0x517a19;var _0x49d32b;return db[_0x5a24('0x3e')]['findOne']({'where':{'id':_0x554a44['params']['id']}})[_0x5a24('0x25')](handleEntityNotFound(_0x320a4a,null))[_0x5a24('0x25')](function(_0x3f6702){if(_0x3f6702){_0x517a19=_0x3f6702;_0x573105[_0x5a24('0x2f')]=_[_0x5a24('0x45')](db[_0x5a24('0x4b')][_0x5a24('0x2c')]);_0x573105[_0x5a24('0x32')]=_['keys'](_0x554a44['query']);_0x573105['filters']=_[_0x5a24('0x31')](_0x573105[_0x5a24('0x2f')],_0x573105[_0x5a24('0x32')]);_0x399417[_0x5a24('0x33')]=_[_0x5a24('0x31')](_0x573105['model'],qs[_0x5a24('0x34')](_0x554a44[_0x5a24('0x32')][_0x5a24('0x34')]));_0x399417['attributes']=_0x399417[_0x5a24('0x33')][_0x5a24('0x35')]?_0x399417[_0x5a24('0x33')]:_0x573105['model'];_0x399417[_0x5a24('0x38')]=qs[_0x5a24('0x39')](_0x554a44[_0x5a24('0x32')][_0x5a24('0x39')]);_0x399417[_0x5a24('0x3b')]=qs['filters'](_[_0x5a24('0x4c')](_0x554a44['query'],_0x573105['filters']));if(_0x554a44[_0x5a24('0x32')][_0x5a24('0x3a')]){_0x399417['where']=_[_0x5a24('0x3d')](_0x399417[_0x5a24('0x3b')],{'$or':_[_0x5a24('0x2b')](_0x399417[_0x5a24('0x33')],function(_0x19e821){var _0x4d96a0={};_0x4d96a0[_0x19e821]={'$like':'%'+_0x554a44[_0x5a24('0x32')][_0x5a24('0x3a')]+'%'};return _0x4d96a0;})});}_0x399417=_[_0x5a24('0x3d')]({},_0x399417,_0x554a44[_0x5a24('0x46')]);return _0x517a19[_0x5a24('0x4e')](_0x399417);}})['then'](function(_0x34416){if(_0x34416){_0x49d32b=_0x34416[_0x5a24('0x35')];if(!_0x554a44[_0x5a24('0x32')][_0x5a24('0x36')]('nolimit')){_0x399417['limit']=qs[_0x5a24('0x1d')](_0x554a44[_0x5a24('0x32')][_0x5a24('0x1d')]);_0x399417[_0x5a24('0x1a')]=qs['offset'](_0x554a44['query']['offset']);}return _0x517a19[_0x5a24('0x4e')](_0x399417);}})[_0x5a24('0x25')](function(_0x1db41b){if(_0x1db41b){return _0x1db41b?{'count':_0x49d32b,'rows':_0x1db41b}:null;}})[_0x5a24('0x25')](respondWithResult(_0x320a4a,null))['catch'](handleError(_0x320a4a,null));};exports[_0x5a24('0x4f')]=function(_0x3d3194,_0x2a3696,_0x258d26){var _0x29b630={};var _0xe7e175={};var _0x2879ab;var _0x19cb99;return db[_0x5a24('0x3e')][_0x5a24('0x4a')]({'where':{'id':_0x3d3194[_0x5a24('0x44')]['id']}})[_0x5a24('0x25')](handleEntityNotFound(_0x2a3696,null))['then'](function(_0x41286c){if(_0x41286c){_0x2879ab=_0x41286c;_0xe7e175['model']=_[_0x5a24('0x45')](db[_0x5a24('0x4b')][_0x5a24('0x2c')]);_0xe7e175[_0x5a24('0x32')]=_[_0x5a24('0x45')](_0x3d3194['query']);_0xe7e175['filters']=_[_0x5a24('0x31')](_0xe7e175[_0x5a24('0x2f')],_0xe7e175[_0x5a24('0x32')]);_0x29b630['attributes']=_['intersection'](_0xe7e175['model'],qs['fields'](_0x3d3194[_0x5a24('0x32')]['fields']));_0x29b630[_0x5a24('0x33')]=_0x29b630[_0x5a24('0x33')][_0x5a24('0x35')]?_0x29b630[_0x5a24('0x33')]:_0xe7e175['model'];_0x29b630['order']=qs['sort'](_0x3d3194['query'][_0x5a24('0x39')]);_0x29b630[_0x5a24('0x3b')]=qs[_0x5a24('0x30')](_['pick'](_0x3d3194['query'],_0xe7e175['filters']));if(_0x3d3194[_0x5a24('0x32')][_0x5a24('0x3a')]){_0x29b630['where']=_[_0x5a24('0x3d')](_0x29b630[_0x5a24('0x3b')],{'$or':_[_0x5a24('0x2b')](_0x29b630[_0x5a24('0x33')],function(_0x5d5290){var _0x12812a={};_0x12812a[_0x5d5290]={'$like':'%'+_0x3d3194['query'][_0x5a24('0x3a')]+'%'};return _0x12812a;})});}_0x29b630=_[_0x5a24('0x3d')]({},_0x29b630,_0x3d3194[_0x5a24('0x46')]);return _0x2879ab[_0x5a24('0x4f')](_0x29b630);}})[_0x5a24('0x25')](function(_0x2637ae){if(_0x2637ae){_0x19cb99=_0x2637ae[_0x5a24('0x35')];if(!_0x3d3194[_0x5a24('0x32')][_0x5a24('0x36')](_0x5a24('0x37'))){_0x29b630[_0x5a24('0x1d')]=qs[_0x5a24('0x1d')](_0x3d3194[_0x5a24('0x32')][_0x5a24('0x1d')]);_0x29b630['offset']=qs['offset'](_0x3d3194[_0x5a24('0x32')]['offset']);}return _0x2879ab[_0x5a24('0x4f')](_0x29b630);}})[_0x5a24('0x25')](function(_0xd3920f){if(_0xd3920f){return _0xd3920f?{'count':_0x19cb99,'rows':_0xd3920f}:null;}})[_0x5a24('0x25')](respondWithResult(_0x2a3696,null))['catch'](handleError(_0x2a3696,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 511dae6..9874b0d 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 _0x7cdd=['rimraf','exports','define','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5cf567,_0x1b47b9){var _0x2d187e=function(_0x1b0119){while(--_0x1b0119){_0x5cf567['push'](_0x5cf567['shift']());}};_0x2d187e(++_0x1b47b9);}(_0x7cdd,0xac));var _0xd7cd=function(_0x34644d,_0x45e6b6){_0x34644d=_0x34644d-0x0;var _0x3defbe=_0x7cdd[_0x34644d];return _0x3defbe;};'use strict';var _=require(_0xd7cd('0x0'));var util=require(_0xd7cd('0x1'));var logger=require(_0xd7cd('0x2'))(_0xd7cd('0x3'));var moment=require(_0xd7cd('0x4'));var BPromise=require(_0xd7cd('0x5'));var rp=require(_0xd7cd('0x6'));var fs=require('fs');var path=require(_0xd7cd('0x7'));var rimraf=require(_0xd7cd('0x8'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xd7cd('0x9')]=function(_0x19a240,_0x3e37d1){return _0x19a240[_0xd7cd('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0xd7cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ae3=['exports','FreshsalesConfiguration','util','../../config/logger','api','moment','path','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0x7ae3,0x185));var _0x37ae=function(_0x45bee1,_0x4267e6){_0x45bee1=_0x45bee1-0x0;var _0x101884=_0x7ae3[_0x45bee1];return _0x101884;};'use strict';var _=require('lodash');var util=require(_0x37ae('0x0'));var logger=require(_0x37ae('0x1'))(_0x37ae('0x2'));var moment=require(_0x37ae('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x37ae('0x4'));var rimraf=require('rimraf');var config=require(_0x37ae('0x5'));var attributes=require(_0x37ae('0x6'));module[_0x37ae('0x7')]=function(_0x264933,_0x4e3ea5){return _0x264933['define'](_0x37ae('0x8'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index ac969f9..18a2f42 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 _0x3acc=['../../config/utils','../../config/logger','rpc','client','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4a327e,_0x547461){var _0x55ff51=function(_0x37806e){while(--_0x37806e){_0x4a327e['push'](_0x4a327e['shift']());}};_0x55ff51(++_0x547461);}(_0x3acc,0x145));var _0xc3ac=function(_0x1a82ad,_0x28fc69){_0x1a82ad=_0x1a82ad-0x0;var _0x247f25=_0x3acc[_0x1a82ad];return _0x247f25;};'use strict';var _=require(_0xc3ac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc3ac('0x1'));var rs=require(_0xc3ac('0x2'));var fs=require('fs');var Redis=require(_0xc3ac('0x3'));var db=require(_0xc3ac('0x4'))['db'];var utils=require(_0xc3ac('0x5'));var logger=require(_0xc3ac('0x6'))(_0xc3ac('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc3ac('0x8')][_0xc3ac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b3d33,_0x53ddb2,_0x417471){return new BPromise(function(_0x53e649,_0x41d2de){return client['request'](_0x1b3d33,_0x417471)[_0xc3ac('0xa')](function(_0x387a69){logger['info'](_0xc3ac('0xb'),_0x53ddb2,_0xc3ac('0xc'));logger[_0xc3ac('0xd')](_0xc3ac('0xe'),_0x53ddb2,_0xc3ac('0xc'),JSON[_0xc3ac('0xf')](_0x387a69));if(_0x387a69[_0xc3ac('0x10')]){if(_0x387a69['error'][_0xc3ac('0x11')]===0x1f4){logger[_0xc3ac('0x10')](_0xc3ac('0xb'),_0x53ddb2,_0x387a69['error']['message']);return _0x41d2de(_0x387a69['error']['message']);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x53ddb2,_0x387a69[_0xc3ac('0x10')][_0xc3ac('0x12')]);return _0x53e649(_0x387a69['error'][_0xc3ac('0x12')]);}else{logger[_0xc3ac('0x13')](_0xc3ac('0xb'),_0x53ddb2,_0xc3ac('0xc'));_0x53e649(_0x387a69[_0xc3ac('0x14')]['message']);}})[_0xc3ac('0x15')](function(_0x29000e){logger[_0xc3ac('0x10')](_0xc3ac('0xb'),_0x53ddb2,_0x29000e);_0x41d2de(_0x29000e);});});} \ No newline at end of file +var _0x0a83=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','bluebird','randomstring'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0a83,0x16d));var _0x30a8=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x0a83[_0xb833b1];return _0x1ab87a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x30a8('0x0'));var BPromise=require(_0x30a8('0x1'));var rs=require(_0x30a8('0x2'));var fs=require('fs');var Redis=require(_0x30a8('0x3'));var db=require(_0x30a8('0x4'))['db'];var utils=require(_0x30a8('0x5'));var logger=require(_0x30a8('0x6'))(_0x30a8('0x7'));var config=require(_0x30a8('0x8'));var jayson=require(_0x30a8('0x9'));var client=jayson[_0x30a8('0xa')][_0x30a8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46886f,_0x198198,_0x48ccf7){return new BPromise(function(_0x5d75bb,_0x7b2c4f){return client[_0x30a8('0xc')](_0x46886f,_0x48ccf7)['then'](function(_0x4ecd8a){logger[_0x30a8('0xd')](_0x30a8('0xe'),_0x198198,'request\x20sent');logger[_0x30a8('0xf')](_0x30a8('0x10'),_0x198198,_0x30a8('0x11'),JSON[_0x30a8('0x12')](_0x4ecd8a));if(_0x4ecd8a[_0x30a8('0x13')]){if(_0x4ecd8a[_0x30a8('0x13')]['code']===0x1f4){logger[_0x30a8('0x13')](_0x30a8('0xe'),_0x198198,_0x4ecd8a[_0x30a8('0x13')][_0x30a8('0x14')]);return _0x7b2c4f(_0x4ecd8a[_0x30a8('0x13')]['message']);}logger[_0x30a8('0x13')](_0x30a8('0xe'),_0x198198,_0x4ecd8a['error'][_0x30a8('0x14')]);return _0x5d75bb(_0x4ecd8a[_0x30a8('0x13')][_0x30a8('0x14')]);}else{logger[_0x30a8('0xd')](_0x30a8('0xe'),_0x198198,'request\x20sent');_0x5d75bb(_0x4ecd8a[_0x30a8('0x15')][_0x30a8('0x14')]);}})[_0x30a8('0x16')](function(_0x3a3652){logger[_0x30a8('0x13')](_0x30a8('0xe'),_0x198198,_0x3a3652);_0x7b2c4f(_0x3a3652);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index e8b1f4e..7620689 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 _0x2b84=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x27367c,_0x3da497){var _0x38efb6=function(_0x529519){while(--_0x529519){_0x27367c['push'](_0x27367c['shift']());}};_0x38efb6(++_0x3da497);}(_0x2b84,0x105));var _0x42b8=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x2b84[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x42b8('0x0'));var util=require('util');var path=require(_0x42b8('0x1'));var timeout=require(_0x42b8('0x2'));var express=require(_0x42b8('0x3'));var router=express[_0x42b8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x42b8('0x5'));var interaction=require(_0x42b8('0x6'));var config=require(_0x42b8('0x7'));var controller=require(_0x42b8('0x8'));router[_0x42b8('0x9')]('/',auth[_0x42b8('0xa')](),controller[_0x42b8('0xb')]);router[_0x42b8('0x9')]('/:id',auth[_0x42b8('0xa')](),controller['show']);router[_0x42b8('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x42b8('0xd')](_0x42b8('0xe'),auth[_0x42b8('0xa')](),controller[_0x42b8('0xf')]);router[_0x42b8('0x10')]('/:id',auth[_0x42b8('0xa')](),controller[_0x42b8('0x11')]);module[_0x42b8('0x12')]=router; \ No newline at end of file +var _0xe64a=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/:id','show','post'];(function(_0x1ca361,_0x573b1c){var _0x454618=function(_0x50531a){while(--_0x50531a){_0x1ca361['push'](_0x1ca361['shift']());}};_0x454618(++_0x573b1c);}(_0xe64a,0x1e0));var _0xae64=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe64a[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xae64('0x0'));var util=require(_0xae64('0x1'));var path=require(_0xae64('0x2'));var timeout=require(_0xae64('0x3'));var express=require(_0xae64('0x4'));var router=express[_0xae64('0x5')]();var fs_extra=require(_0xae64('0x6'));var auth=require(_0xae64('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xae64('0x8')](),controller[_0xae64('0x9')]);router[_0xae64('0xa')](_0xae64('0xb'),auth[_0xae64('0x8')](),controller[_0xae64('0xc')]);router[_0xae64('0xd')]('/',auth[_0xae64('0x8')](),controller[_0xae64('0xe')]);router[_0xae64('0xf')](_0xae64('0xb'),auth['isAuthenticated'](),controller[_0xae64('0x10')]);router['delete']('/:id',auth[_0xae64('0x8')](),controller[_0xae64('0x11')]);module[_0xae64('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 29cc6ec..fc273f4 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 _0x478c=['string','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x584291,_0x24b5b3){var _0x4e7d08=function(_0x59e0b1){while(--_0x59e0b1){_0x584291['push'](_0x584291['shift']());}};_0x4e7d08(++_0x24b5b3);}(_0x478c,0x1e6));var _0xc478=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x478c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc478('0x0')]={'type':{'type':Sequelize[_0xc478('0x1')](_0xc478('0x2'),'variable',_0xc478('0x3'),_0xc478('0x4'),_0xc478('0x5')),'defaultValue':_0xc478('0x2')},'content':{'type':Sequelize[_0xc478('0x6')]},'key':{'type':Sequelize[_0xc478('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xc478('0x6')]},'idField':{'type':Sequelize[_0xc478('0x6')]},'nameField':{'type':Sequelize[_0xc478('0x6')]},'customField':{'type':Sequelize[_0xc478('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc478('0x6')]}}; \ No newline at end of file +var _0x4676=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','picklist','STRING'];(function(_0x3d1b84,_0x36ecb2){var _0x9d757=function(_0x267e26){while(--_0x267e26){_0x3d1b84['push'](_0x3d1b84['shift']());}};_0x9d757(++_0x36ecb2);}(_0x4676,0x1c4));var _0x6467=function(_0xaae166,_0xa5e4db){_0xaae166=_0xaae166-0x0;var _0x4b34bf=_0x4676[_0xaae166];return _0x4b34bf;};'use strict';var Sequelize=require(_0x6467('0x0'));module[_0x6467('0x1')]={'type':{'type':Sequelize[_0x6467('0x2')](_0x6467('0x3'),'variable',_0x6467('0x4'),'keyValue',_0x6467('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6467('0x6')]},'key':{'type':Sequelize[_0x6467('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x6467('0x7'),_0x6467('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6467('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6467('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6467('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 62d2815..c8bfdcc 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 _0xbc7d=['includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','index','FreshsalesField','rawAttributes','fieldName','type','key','model','map','name','query','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','VIRTUAL','options'];(function(_0x3c496c,_0x4f94e2){var _0x89166=function(_0x4de970){while(--_0x4de970){_0x3c496c['push'](_0x3c496c['shift']());}};_0x89166(++_0x4f94e2);}(_0xbc7d,0x178));var _0xdbc7=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0xbc7d[_0x35b18a];return _0x4db1bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdbc7('0x0'));var jsonpatch=require(_0xdbc7('0x1'));var rp=require(_0xdbc7('0x2'));var moment=require(_0xdbc7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc7('0x4'));var path=require(_0xdbc7('0x5'));var sox=require(_0xdbc7('0x6'));var csv=require(_0xdbc7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdbc7('0x8'));var squel=require(_0xdbc7('0x9'));var crypto=require(_0xdbc7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdbc7('0xb'));var toCsv=require(_0xdbc7('0x7'));var querystring=require(_0xdbc7('0xc'));var Papa=require(_0xdbc7('0xd'));var Redis=require(_0xdbc7('0xe'));var authService=require(_0xdbc7('0xf'));var qs=require(_0xdbc7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbc7('0x11'));var logger=require('../../config/logger')(_0xdbc7('0x12'));var utils=require(_0xdbc7('0x13'));var config=require(_0xdbc7('0x14'));var licenseUtil=require(_0xdbc7('0x15'));var db=require(_0xdbc7('0x16'))['db'];function respondWithStatusCode(_0x53b6ba,_0x2a7c05){_0x2a7c05=_0x2a7c05||0xcc;return function(_0x2baa90){if(_0x2baa90){return _0x53b6ba['sendStatus'](_0x2a7c05);}return _0x53b6ba[_0xdbc7('0x17')](_0x2a7c05)[_0xdbc7('0x18')]();};}function respondWithResult(_0x242e70,_0x241fde){_0x241fde=_0x241fde||0xc8;return function(_0x39e3df){if(_0x39e3df){return _0x242e70[_0xdbc7('0x17')](_0x241fde)[_0xdbc7('0x19')](_0x39e3df);}};}function respondWithFilteredResult(_0x1eb638,_0xe92345){return function(_0x267ea6){if(_0x267ea6){var _0x2fc74e=typeof _0xe92345[_0xdbc7('0x1a')]===_0xdbc7('0x1b')&&typeof _0xe92345['limit']===_0xdbc7('0x1b');var _0x4299e7=_0x267ea6['count'];var _0x7ccfa9=_0x2fc74e?0x0:_0xe92345[_0xdbc7('0x1a')];var _0xf4b05b=_0x2fc74e?_0x267ea6[_0xdbc7('0x1c')]:_0xe92345['offset']+_0xe92345['limit'];var _0x1b3cfb;if(_0xf4b05b>=_0x4299e7){_0xf4b05b=_0x4299e7;_0x1b3cfb=0xc8;}else{_0x1b3cfb=0xce;}_0x1eb638[_0xdbc7('0x17')](_0x1b3cfb);return _0x1eb638[_0xdbc7('0x1d')](_0xdbc7('0x1e'),_0x7ccfa9+'-'+_0xf4b05b+'/'+_0x4299e7)[_0xdbc7('0x19')](_0x267ea6);}return null;};}function patchUpdates(_0x456d57){return function(_0x277196){try{jsonpatch[_0xdbc7('0x1f')](_0x277196,_0x456d57,!![]);}catch(_0x5cfc60){return BPromise[_0xdbc7('0x20')](_0x5cfc60);}return _0x277196[_0xdbc7('0x21')]();};}function saveUpdates(_0x158f26,_0x10e8fb){return function(_0x1ee0bb){if(_0x1ee0bb){return _0x1ee0bb[_0xdbc7('0x22')](_0x158f26)[_0xdbc7('0x23')](function(_0x3f0fcc){return _0x3f0fcc;});}return null;};}function removeEntity(_0x53e288,_0x4bd480){return function(_0x32bcc2){if(_0x32bcc2){return _0x32bcc2[_0xdbc7('0x24')]()[_0xdbc7('0x23')](function(){_0x53e288[_0xdbc7('0x17')](0xcc)[_0xdbc7('0x18')]();});}};}function handleEntityNotFound(_0x3562c2,_0x2ebb1e){return function(_0x1861aa){if(!_0x1861aa){_0x3562c2['sendStatus'](0x194);}return _0x1861aa;};}function handleError(_0x46b673,_0x554403){_0x554403=_0x554403||0x1f4;return function(_0x4df157){logger[_0xdbc7('0x25')](_0x4df157[_0xdbc7('0x26')]);if(_0x4df157['name']){delete _0x4df157['name'];}_0x46b673[_0xdbc7('0x17')](_0x554403)['send'](_0x4df157);};}exports[_0xdbc7('0x27')]=function(_0x212ca7,_0x29b6ce){var _0x36e115={},_0x2d0da6={},_0x3da85d={'count':0x0,'rows':[]};var _0x20472f=_['map'](db[_0xdbc7('0x28')][_0xdbc7('0x29')],function(_0xbc45a7){return{'name':_0xbc45a7[_0xdbc7('0x2a')],'type':_0xbc45a7[_0xdbc7('0x2b')][_0xdbc7('0x2c')]};});_0x2d0da6[_0xdbc7('0x2d')]=_[_0xdbc7('0x2e')](_0x20472f,_0xdbc7('0x2f'));_0x2d0da6[_0xdbc7('0x30')]=_['keys'](_0x212ca7['query']);_0x2d0da6['filters']=_['intersection'](_0x2d0da6[_0xdbc7('0x2d')],_0x2d0da6[_0xdbc7('0x30')]);_0x36e115['attributes']=_['intersection'](_0x2d0da6['model'],qs[_0xdbc7('0x31')](_0x212ca7[_0xdbc7('0x30')][_0xdbc7('0x31')]));_0x36e115['attributes']=_0x36e115[_0xdbc7('0x32')][_0xdbc7('0x33')]?_0x36e115[_0xdbc7('0x32')]:_0x2d0da6['model'];if(!_0x212ca7[_0xdbc7('0x30')][_0xdbc7('0x34')]('nolimit')){_0x36e115[_0xdbc7('0x35')]=qs['limit'](_0x212ca7['query'][_0xdbc7('0x35')]);_0x36e115[_0xdbc7('0x1a')]=qs['offset'](_0x212ca7[_0xdbc7('0x30')]['offset']);}_0x36e115[_0xdbc7('0x36')]=qs[_0xdbc7('0x37')](_0x212ca7[_0xdbc7('0x30')][_0xdbc7('0x37')]);_0x36e115[_0xdbc7('0x38')]=qs[_0xdbc7('0x39')](_['pick'](_0x212ca7['query'],_0x2d0da6['filters']),_0x20472f);if(_0x212ca7[_0xdbc7('0x30')][_0xdbc7('0x3a')]){_0x36e115[_0xdbc7('0x38')]=_[_0xdbc7('0x3b')](_0x36e115['where'],{'$or':_[_0xdbc7('0x2e')](_0x20472f,function(_0x34215f){if(_0x34215f[_0xdbc7('0x2b')]!==_0xdbc7('0x3c')){var _0x3131f3={};_0x3131f3[_0x34215f[_0xdbc7('0x2f')]]={'$like':'%'+_0x212ca7[_0xdbc7('0x30')][_0xdbc7('0x3a')]+'%'};return _0x3131f3;}})});}_0x36e115=_[_0xdbc7('0x3b')]({},_0x36e115,_0x212ca7[_0xdbc7('0x3d')]);var _0x36d4c3={'where':_0x36e115[_0xdbc7('0x38')]};return db[_0xdbc7('0x28')][_0xdbc7('0x1c')](_0x36d4c3)[_0xdbc7('0x23')](function(_0x11f3ab){_0x3da85d[_0xdbc7('0x1c')]=_0x11f3ab;if(_0x212ca7['query'][_0xdbc7('0x3e')]){_0x36e115[_0xdbc7('0x3f')]=[{'all':!![]}];}return db[_0xdbc7('0x28')][_0xdbc7('0x40')](_0x36e115);})[_0xdbc7('0x23')](function(_0x1ab954){_0x3da85d[_0xdbc7('0x41')]=_0x1ab954;return _0x3da85d;})[_0xdbc7('0x23')](respondWithFilteredResult(_0x29b6ce,_0x36e115))[_0xdbc7('0x42')](handleError(_0x29b6ce,null));};exports[_0xdbc7('0x43')]=function(_0x5b6913,_0xfde3cd){var _0x148514={'raw':!![],'where':{'id':_0x5b6913['params']['id']}},_0x12b29f={};_0x12b29f['model']=_[_0xdbc7('0x44')](db[_0xdbc7('0x28')][_0xdbc7('0x29')]);_0x12b29f[_0xdbc7('0x30')]=_['keys'](_0x5b6913['query']);_0x12b29f[_0xdbc7('0x39')]=_['intersection'](_0x12b29f[_0xdbc7('0x2d')],_0x12b29f[_0xdbc7('0x30')]);_0x148514['attributes']=_['intersection'](_0x12b29f[_0xdbc7('0x2d')],qs[_0xdbc7('0x31')](_0x5b6913[_0xdbc7('0x30')]['fields']));_0x148514[_0xdbc7('0x32')]=_0x148514[_0xdbc7('0x32')]['length']?_0x148514[_0xdbc7('0x32')]:_0x12b29f[_0xdbc7('0x2d')];if(_0x5b6913[_0xdbc7('0x30')][_0xdbc7('0x3e')]){_0x148514[_0xdbc7('0x3f')]=[{'all':!![]}];}_0x148514=_[_0xdbc7('0x3b')]({},_0x148514,_0x5b6913[_0xdbc7('0x3d')]);return db[_0xdbc7('0x28')][_0xdbc7('0x45')](_0x148514)[_0xdbc7('0x23')](handleEntityNotFound(_0xfde3cd,null))[_0xdbc7('0x23')](respondWithResult(_0xfde3cd,null))[_0xdbc7('0x42')](handleError(_0xfde3cd,null));};exports[_0xdbc7('0x46')]=function(_0x51447a,_0x436c6a){return db[_0xdbc7('0x28')][_0xdbc7('0x46')](_0x51447a[_0xdbc7('0x47')],{})[_0xdbc7('0x23')](respondWithResult(_0x436c6a,0xc9))[_0xdbc7('0x42')](handleError(_0x436c6a,null));};exports[_0xdbc7('0x22')]=function(_0xa4865d,_0x632584){if(_0xa4865d[_0xdbc7('0x47')]['id']){delete _0xa4865d['body']['id'];}return db[_0xdbc7('0x28')]['find']({'where':{'id':_0xa4865d['params']['id']}})[_0xdbc7('0x23')](handleEntityNotFound(_0x632584,null))[_0xdbc7('0x23')](saveUpdates(_0xa4865d[_0xdbc7('0x47')],null))['then'](respondWithResult(_0x632584,null))[_0xdbc7('0x42')](handleError(_0x632584,null));};exports['destroy']=function(_0x1d8a2f,_0xcc6398){return db[_0xdbc7('0x28')][_0xdbc7('0x45')]({'where':{'id':_0x1d8a2f[_0xdbc7('0x48')]['id']}})[_0xdbc7('0x23')](handleEntityNotFound(_0xcc6398,null))[_0xdbc7('0x23')](removeEntity(_0xcc6398,null))[_0xdbc7('0x42')](handleError(_0xcc6398,null));}; \ No newline at end of file +var _0xcda8=['limit','count','set','Content-Range','apply','reject','destroy','end','error','stack','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','then','rows','catch','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined'];(function(_0x44f65c,_0x55e30c){var _0x4d9573=function(_0x2055cf){while(--_0x2055cf){_0x44f65c['push'](_0x44f65c['shift']());}};_0x4d9573(++_0x55e30c);}(_0xcda8,0x10a));var _0x8cda=function(_0x1952e6,_0x20b617){_0x1952e6=_0x1952e6-0x0;var _0x5d8f9d=_0xcda8[_0x1952e6];return _0x5d8f9d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cda('0x0'));var zipdir=require(_0x8cda('0x1'));var jsonpatch=require(_0x8cda('0x2'));var rp=require(_0x8cda('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8cda('0x4'));var util=require(_0x8cda('0x5'));var path=require(_0x8cda('0x6'));var sox=require(_0x8cda('0x7'));var csv=require(_0x8cda('0x8'));var ejs=require(_0x8cda('0x9'));var fs=require('fs');var fs_extra=require(_0x8cda('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8cda('0xb'));var jsforce=require(_0x8cda('0xc'));var deskjs=require(_0x8cda('0xd'));var toCsv=require(_0x8cda('0x8'));var querystring=require('querystring');var Papa=require(_0x8cda('0xe'));var Redis=require(_0x8cda('0xf'));var authService=require(_0x8cda('0x10'));var qs=require(_0x8cda('0x11'));var as=require(_0x8cda('0x12'));var hardwareService=require(_0x8cda('0x13'));var logger=require(_0x8cda('0x14'))(_0x8cda('0x15'));var utils=require(_0x8cda('0x16'));var config=require(_0x8cda('0x17'));var licenseUtil=require(_0x8cda('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36c364,_0x205498){_0x205498=_0x205498||0xcc;return function(_0x365a04){if(_0x365a04){return _0x36c364[_0x8cda('0x19')](_0x205498);}return _0x36c364[_0x8cda('0x1a')](_0x205498)['end']();};}function respondWithResult(_0x5905ae,_0x191910){_0x191910=_0x191910||0xc8;return function(_0x4b8b08){if(_0x4b8b08){return _0x5905ae['status'](_0x191910)[_0x8cda('0x1b')](_0x4b8b08);}};}function respondWithFilteredResult(_0x20c83a,_0x513b04){return function(_0x50562a){if(_0x50562a){var _0x345e73=typeof _0x513b04[_0x8cda('0x1c')]===_0x8cda('0x1d')&&typeof _0x513b04[_0x8cda('0x1e')]===_0x8cda('0x1d');var _0x38c502=_0x50562a[_0x8cda('0x1f')];var _0xd723=_0x345e73?0x0:_0x513b04['offset'];var _0xa73631=_0x345e73?_0x50562a['count']:_0x513b04[_0x8cda('0x1c')]+_0x513b04[_0x8cda('0x1e')];var _0x4f7aa6;if(_0xa73631>=_0x38c502){_0xa73631=_0x38c502;_0x4f7aa6=0xc8;}else{_0x4f7aa6=0xce;}_0x20c83a['status'](_0x4f7aa6);return _0x20c83a[_0x8cda('0x20')](_0x8cda('0x21'),_0xd723+'-'+_0xa73631+'/'+_0x38c502)[_0x8cda('0x1b')](_0x50562a);}return null;};}function patchUpdates(_0xd35b31){return function(_0x4761f4){try{jsonpatch[_0x8cda('0x22')](_0x4761f4,_0xd35b31,!![]);}catch(_0x3e7d4e){return BPromise[_0x8cda('0x23')](_0x3e7d4e);}return _0x4761f4['save']();};}function saveUpdates(_0x519542,_0x5a064d){return function(_0x4efbdd){if(_0x4efbdd){return _0x4efbdd['update'](_0x519542)['then'](function(_0x21c4a5){return _0x21c4a5;});}return null;};}function removeEntity(_0x174543,_0x2e9476){return function(_0x3e0361){if(_0x3e0361){return _0x3e0361[_0x8cda('0x24')]()['then'](function(){_0x174543[_0x8cda('0x1a')](0xcc)[_0x8cda('0x25')]();});}};}function handleEntityNotFound(_0xa29f17,_0x44dd67){return function(_0x28d246){if(!_0x28d246){_0xa29f17[_0x8cda('0x19')](0x194);}return _0x28d246;};}function handleError(_0x4abff6,_0x10ebaf){_0x10ebaf=_0x10ebaf||0x1f4;return function(_0x541053){logger[_0x8cda('0x26')](_0x541053[_0x8cda('0x27')]);if(_0x541053['name']){delete _0x541053['name'];}_0x4abff6[_0x8cda('0x1a')](_0x10ebaf)[_0x8cda('0x28')](_0x541053);};}exports[_0x8cda('0x29')]=function(_0x5e174b,_0x2a1a81){var _0x81f55e={},_0x24db6e={},_0x5881e3={'count':0x0,'rows':[]};var _0x87882c=_[_0x8cda('0x2a')](db[_0x8cda('0x2b')][_0x8cda('0x2c')],function(_0x5d46ae){return{'name':_0x5d46ae[_0x8cda('0x2d')],'type':_0x5d46ae[_0x8cda('0x2e')][_0x8cda('0x2f')]};});_0x24db6e[_0x8cda('0x30')]=_['map'](_0x87882c,_0x8cda('0x31'));_0x24db6e[_0x8cda('0x32')]=_['keys'](_0x5e174b[_0x8cda('0x32')]);_0x24db6e[_0x8cda('0x33')]=_['intersection'](_0x24db6e[_0x8cda('0x30')],_0x24db6e[_0x8cda('0x32')]);_0x81f55e['attributes']=_[_0x8cda('0x34')](_0x24db6e[_0x8cda('0x30')],qs[_0x8cda('0x35')](_0x5e174b[_0x8cda('0x32')][_0x8cda('0x35')]));_0x81f55e[_0x8cda('0x36')]=_0x81f55e[_0x8cda('0x36')][_0x8cda('0x37')]?_0x81f55e[_0x8cda('0x36')]:_0x24db6e[_0x8cda('0x30')];if(!_0x5e174b[_0x8cda('0x32')][_0x8cda('0x38')](_0x8cda('0x39'))){_0x81f55e[_0x8cda('0x1e')]=qs[_0x8cda('0x1e')](_0x5e174b[_0x8cda('0x32')]['limit']);_0x81f55e[_0x8cda('0x1c')]=qs['offset'](_0x5e174b[_0x8cda('0x32')][_0x8cda('0x1c')]);}_0x81f55e[_0x8cda('0x3a')]=qs['sort'](_0x5e174b[_0x8cda('0x32')][_0x8cda('0x3b')]);_0x81f55e['where']=qs[_0x8cda('0x33')](_['pick'](_0x5e174b[_0x8cda('0x32')],_0x24db6e[_0x8cda('0x33')]),_0x87882c);if(_0x5e174b[_0x8cda('0x32')][_0x8cda('0x3c')]){_0x81f55e[_0x8cda('0x3d')]=_[_0x8cda('0x3e')](_0x81f55e[_0x8cda('0x3d')],{'$or':_[_0x8cda('0x2a')](_0x87882c,function(_0x53935d){if(_0x53935d['type']!==_0x8cda('0x3f')){var _0xf35344={};_0xf35344[_0x53935d[_0x8cda('0x31')]]={'$like':'%'+_0x5e174b[_0x8cda('0x32')][_0x8cda('0x3c')]+'%'};return _0xf35344;}})});}_0x81f55e=_[_0x8cda('0x3e')]({},_0x81f55e,_0x5e174b[_0x8cda('0x40')]);var _0x3b5073={'where':_0x81f55e[_0x8cda('0x3d')]};return db['FreshsalesField'][_0x8cda('0x1f')](_0x3b5073)['then'](function(_0x4a32bb){_0x5881e3[_0x8cda('0x1f')]=_0x4a32bb;if(_0x5e174b[_0x8cda('0x32')][_0x8cda('0x41')]){_0x81f55e['include']=[{'all':!![]}];}return db[_0x8cda('0x2b')]['findAll'](_0x81f55e);})[_0x8cda('0x42')](function(_0x25aeb8){_0x5881e3[_0x8cda('0x43')]=_0x25aeb8;return _0x5881e3;})[_0x8cda('0x42')](respondWithFilteredResult(_0x2a1a81,_0x81f55e))[_0x8cda('0x44')](handleError(_0x2a1a81,null));};exports['show']=function(_0x2e5c0f,_0x598403){var _0xb6619a={'raw':!![],'where':{'id':_0x2e5c0f[_0x8cda('0x45')]['id']}},_0x194bc9={};_0x194bc9[_0x8cda('0x30')]=_[_0x8cda('0x46')](db['FreshsalesField'][_0x8cda('0x2c')]);_0x194bc9['query']=_[_0x8cda('0x46')](_0x2e5c0f[_0x8cda('0x32')]);_0x194bc9[_0x8cda('0x33')]=_[_0x8cda('0x34')](_0x194bc9['model'],_0x194bc9[_0x8cda('0x32')]);_0xb6619a[_0x8cda('0x36')]=_['intersection'](_0x194bc9[_0x8cda('0x30')],qs['fields'](_0x2e5c0f[_0x8cda('0x32')][_0x8cda('0x35')]));_0xb6619a[_0x8cda('0x36')]=_0xb6619a[_0x8cda('0x36')][_0x8cda('0x37')]?_0xb6619a['attributes']:_0x194bc9[_0x8cda('0x30')];if(_0x2e5c0f[_0x8cda('0x32')][_0x8cda('0x41')]){_0xb6619a['include']=[{'all':!![]}];}_0xb6619a=_[_0x8cda('0x3e')]({},_0xb6619a,_0x2e5c0f[_0x8cda('0x40')]);return db[_0x8cda('0x2b')][_0x8cda('0x47')](_0xb6619a)['then'](handleEntityNotFound(_0x598403,null))['then'](respondWithResult(_0x598403,null))['catch'](handleError(_0x598403,null));};exports[_0x8cda('0x48')]=function(_0x420fa1,_0x5b8dab){return db[_0x8cda('0x2b')]['create'](_0x420fa1['body'],{})[_0x8cda('0x42')](respondWithResult(_0x5b8dab,0xc9))[_0x8cda('0x44')](handleError(_0x5b8dab,null));};exports['update']=function(_0x24649b,_0x32d92f){if(_0x24649b[_0x8cda('0x49')]['id']){delete _0x24649b['body']['id'];}return db[_0x8cda('0x2b')][_0x8cda('0x47')]({'where':{'id':_0x24649b[_0x8cda('0x45')]['id']}})[_0x8cda('0x42')](handleEntityNotFound(_0x32d92f,null))[_0x8cda('0x42')](saveUpdates(_0x24649b[_0x8cda('0x49')],null))[_0x8cda('0x42')](respondWithResult(_0x32d92f,null))[_0x8cda('0x44')](handleError(_0x32d92f,null));};exports['destroy']=function(_0x50b796,_0x470421){return db[_0x8cda('0x2b')][_0x8cda('0x47')]({'where':{'id':_0x50b796[_0x8cda('0x45')]['id']}})[_0x8cda('0x42')](handleEntityNotFound(_0x470421,null))['then'](removeEntity(_0x470421,null))[_0x8cda('0x44')](handleError(_0x470421,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index b9ede6f..bcf2e03 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 _0x2faf=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x3fb5fa,_0x11037d){var _0x4622ec=function(_0x26c583){while(--_0x26c583){_0x3fb5fa['push'](_0x3fb5fa['shift']());}};_0x4622ec(++_0x11037d);}(_0x2faf,0xb0));var _0xf2fa=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2faf[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf2fa('0x0'));var util=require(_0xf2fa('0x1'));var logger=require(_0xf2fa('0x2'))('api');var moment=require(_0xf2fa('0x3'));var BPromise=require(_0xf2fa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2fa('0x5'));var rimraf=require(_0xf2fa('0x6'));var config=require(_0xf2fa('0x7'));var attributes=require(_0xf2fa('0x8'));module[_0xf2fa('0x9')]=function(_0x33c832,_0x44d406){return _0x33c832['define'](_0xf2fa('0xa'),attributes,{'tableName':_0xf2fa('0xb'),'paranoid':![],'indexes':[{'name':_0xf2fa('0xc'),'fields':[_0xf2fa('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x13eb=['lodash','util','api','moment','request-promise','path','rimraf','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId'];(function(_0x42a392,_0x25167e){var _0x1cdea5=function(_0x5e07e6){while(--_0x5e07e6){_0x42a392['push'](_0x42a392['shift']());}};_0x1cdea5(++_0x25167e);}(_0x13eb,0x8f));var _0xb13e=function(_0x15070a,_0x522955){_0x15070a=_0x15070a-0x0;var _0x251d50=_0x13eb[_0x15070a];return _0x251d50;};'use strict';var _=require(_0xb13e('0x0'));var util=require(_0xb13e('0x1'));var logger=require('../../config/logger')(_0xb13e('0x2'));var moment=require(_0xb13e('0x3'));var BPromise=require('bluebird');var rp=require(_0xb13e('0x4'));var fs=require('fs');var path=require(_0xb13e('0x5'));var rimraf=require(_0xb13e('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0xb13e('0x7')]=function(_0xaadc20,_0x382048){return _0xaadc20[_0xb13e('0x8')](_0xb13e('0x9'),attributes,{'tableName':_0xb13e('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xb13e('0xb'),_0xb13e('0xc')],'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 a8e4678..bff95f7 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 _0x7096=['code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x32b122,_0x1ad490){var _0x4ad25a=function(_0x590ee6){while(--_0x590ee6){_0x32b122['push'](_0x32b122['shift']());}};_0x4ad25a(++_0x1ad490);}(_0x7096,0x10c));var _0x6709=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x7096[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var moment=require('moment');var BPromise=require(_0x6709('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var utils=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));var config=require(_0x6709('0x7'));var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e2223,_0x11ad23,_0x985814){return new BPromise(function(_0x30147f,_0x513ab6){return client['request'](_0x3e2223,_0x985814)[_0x6709('0xb')](function(_0x2d8c0b){logger[_0x6709('0xc')](_0x6709('0xd'),_0x11ad23,_0x6709('0xe'));logger[_0x6709('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x11ad23,'request\x20sent',JSON[_0x6709('0x10')](_0x2d8c0b));if(_0x2d8c0b[_0x6709('0x11')]){if(_0x2d8c0b[_0x6709('0x11')][_0x6709('0x12')]===0x1f4){logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')][_0x6709('0x13')]);return _0x513ab6(_0x2d8c0b['error'][_0x6709('0x13')]);}logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')]['message']);return _0x30147f(_0x2d8c0b[_0x6709('0x11')]['message']);}else{logger[_0x6709('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x11ad23,_0x6709('0xe'));_0x30147f(_0x2d8c0b[_0x6709('0x14')][_0x6709('0x13')]);}})[_0x6709('0x15')](function(_0x4cab30){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x11ad23,_0x4cab30);_0x513ab6(_0x4cab30);});});} \ No newline at end of file +var _0x71ab=['http','request','then','info','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshsalesField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x114338,_0xe80b3d){var _0x3f8b09=function(_0x1771fc){while(--_0x1771fc){_0x114338['push'](_0x114338['shift']());}};_0x3f8b09(++_0xe80b3d);}(_0x71ab,0x64));var _0xb71a=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x71ab[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a84e,_0x4358ce,_0x2a4c86){return new BPromise(function(_0x43ca14,_0x471ab6){return client[_0xb71a('0xb')](_0x35a84e,_0x2a4c86)[_0xb71a('0xc')](function(_0x378c96){logger[_0xb71a('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0xb71a('0xe'));logger['debug'](_0xb71a('0xf'),_0x4358ce,_0xb71a('0xe'),JSON[_0xb71a('0x10')](_0x378c96));if(_0x378c96['error']){if(_0x378c96[_0xb71a('0x11')]['code']===0x1f4){logger[_0xb71a('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0x378c96['error'][_0xb71a('0x12')]);return _0x471ab6(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}logger[_0xb71a('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0x378c96['error']['message']);return _0x43ca14(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}else{logger[_0xb71a('0xd')](_0xb71a('0x13'),_0x4358ce,_0xb71a('0xe'));_0x43ca14(_0x378c96[_0xb71a('0x14')][_0xb71a('0x12')]);}})[_0xb71a('0x15')](function(_0x7710a8){logger['error'](_0xb71a('0x13'),_0x4358ce,_0x7710a8);_0x471ab6(_0x7710a8);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index d70d943..96fb333 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(_0x4f78ea,_0x20f02a){var _0x4095b9=function(_0x26da06){while(--_0x26da06){_0x4f78ea['push'](_0x4f78ea['shift']());}};_0x4095b9(++_0x20f02a);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x25d55c,_0x147d2d){var _0x39c269=function(_0x1dd270){while(--_0x1dd270){_0x25d55c['push'](_0x25d55c['shift']());}};_0x39c269(++_0x147d2d);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index c225028..f404a8d 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 _0x7c71=['username','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x43937e,_0x3e6e3a){var _0x1a620f=function(_0x244df3){while(--_0x244df3){_0x43937e['push'](_0x43937e['shift']());}};_0x1a620f(++_0x3e6e3a);}(_0x7c71,0x177));var _0x17c7=function(_0x5ad771,_0x34186f){_0x5ad771=_0x5ad771-0x0;var _0x5b5dce=_0x7c71[_0x5ad771];return _0x5b5dce;};'use strict';var Sequelize=require(_0x17c7('0x0'));module[_0x17c7('0x1')]={'name':{'type':Sequelize[_0x17c7('0x2')]},'description':{'type':Sequelize[_0x17c7('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x17c7('0x3')},'remoteUri':{'type':Sequelize[_0x17c7('0x2')]},'password':{'type':Sequelize[_0x17c7('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x17c7('0x2')]},'serverUrl':{'type':Sequelize[_0x17c7('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x17c7('0x4')](_0x17c7('0x5'),_0x17c7('0x6')),'defaultValue':_0x17c7('0x5')}}; \ No newline at end of file +var _0xa613=['username','integrationTab','newTab','sequelize','STRING'];(function(_0xe79ec4,_0x19750c){var _0x197e8a=function(_0x4c638a){while(--_0x4c638a){_0xe79ec4['push'](_0xe79ec4['shift']());}};_0x197e8a(++_0x19750c);}(_0xa613,0x8a));var _0x3a61=function(_0x26236f,_0x36916c){_0x26236f=_0x26236f-0x0;var _0x11c59f=_0xa613[_0x26236f];return _0x11c59f;};'use strict';var Sequelize=require(_0x3a61('0x0'));module['exports']={'name':{'type':Sequelize[_0x3a61('0x1')]},'description':{'type':Sequelize[_0x3a61('0x1')]},'username':{'type':Sequelize[_0x3a61('0x1')],'unique':_0x3a61('0x2')},'remoteUri':{'type':Sequelize[_0x3a61('0x1')]},'password':{'type':Sequelize[_0x3a61('0x1')]},'clientId':{'type':Sequelize[_0x3a61('0x1')]},'clientSecret':{'type':Sequelize[_0x3a61('0x1')]},'securityToken':{'type':Sequelize[_0x3a61('0x1')]},'serverUrl':{'type':Sequelize[_0x3a61('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3a61('0x3'),_0x3a61('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 4640536..4364c30 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 _0x14b0=['boolean','email','textarea','remove','includes','picklistValues','label','value','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','end','error','stack','name','send','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','destroy','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientId','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsRecurrence','Subject','Description','string','int','picklist'];(function(_0x39d1f0,_0x1080ae){var _0x85aaf7=function(_0xfa3078){while(--_0xfa3078){_0x39d1f0['push'](_0x39d1f0['shift']());}};_0x85aaf7(++_0x1080ae);}(_0x14b0,0x113));var _0x014b=function(_0x2c660f,_0x4556e7){_0x2c660f=_0x2c660f-0x0;var _0x3e4457=_0x14b0[_0x2c660f];return _0x3e4457;};'use strict';var emlformat=require(_0x014b('0x0'));var rimraf=require(_0x014b('0x1'));var zipdir=require(_0x014b('0x2'));var jsonpatch=require(_0x014b('0x3'));var rp=require(_0x014b('0x4'));var moment=require(_0x014b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x014b('0x6'));var util=require(_0x014b('0x7'));var path=require(_0x014b('0x8'));var sox=require(_0x014b('0x9'));var csv=require('to-csv');var ejs=require(_0x014b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x014b('0xb'));var squel=require(_0x014b('0xc'));var crypto=require('crypto');var jsforce=require(_0x014b('0xd'));var deskjs=require(_0x014b('0xe'));var toCsv=require(_0x014b('0xf'));var querystring=require('querystring');var Papa=require(_0x014b('0x10'));var Redis=require('ioredis');var authService=require(_0x014b('0x11'));var qs=require(_0x014b('0x12'));var as=require(_0x014b('0x13'));var hardwareService=require(_0x014b('0x14'));var logger=require(_0x014b('0x15'))(_0x014b('0x16'));var utils=require(_0x014b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x014b('0x18'));var db=require(_0x014b('0x19'))['db'];var integrations=require(_0x014b('0x1a'));function respondWithStatusCode(_0x56912b,_0xf92412){_0xf92412=_0xf92412||0xcc;return function(_0x59191e){if(_0x59191e){return _0x56912b[_0x014b('0x1b')](_0xf92412);}return _0x56912b['status'](_0xf92412)['end']();};}function respondWithResult(_0x181dd1,_0x2539b7){_0x2539b7=_0x2539b7||0xc8;return function(_0x4a697b){if(_0x4a697b){return _0x181dd1[_0x014b('0x1c')](_0x2539b7)[_0x014b('0x1d')](_0x4a697b);}};}function respondWithFilteredResult(_0x131cd7,_0x1172cb){return function(_0x58a689){if(_0x58a689){var _0xa522df=typeof _0x1172cb[_0x014b('0x1e')]===_0x014b('0x1f')&&typeof _0x1172cb[_0x014b('0x20')]===_0x014b('0x1f');var _0xffb628=_0x58a689[_0x014b('0x21')];var _0x464dc3=_0xa522df?0x0:_0x1172cb[_0x014b('0x1e')];var _0x4bfd73=_0xa522df?_0x58a689[_0x014b('0x21')]:_0x1172cb[_0x014b('0x1e')]+_0x1172cb[_0x014b('0x20')];var _0x3f0283;if(_0x4bfd73>=_0xffb628){_0x4bfd73=_0xffb628;_0x3f0283=0xc8;}else{_0x3f0283=0xce;}_0x131cd7['status'](_0x3f0283);return _0x131cd7['set'](_0x014b('0x22'),_0x464dc3+'-'+_0x4bfd73+'/'+_0xffb628)[_0x014b('0x1d')](_0x58a689);}return null;};}function patchUpdates(_0x5e4367){return function(_0x45ce41){try{jsonpatch[_0x014b('0x23')](_0x45ce41,_0x5e4367,!![]);}catch(_0x180717){return BPromise[_0x014b('0x24')](_0x180717);}return _0x45ce41[_0x014b('0x25')]();};}function saveUpdates(_0x9eb566,_0x134602){return function(_0x230081){if(_0x230081){return _0x230081['update'](_0x9eb566)[_0x014b('0x26')](function(_0x514b3e){return _0x514b3e;});}return null;};}function removeEntity(_0x6d0fb5,_0x4fdcd9){return function(_0x40e02b){if(_0x40e02b){return _0x40e02b['destroy']()['then'](function(){_0x6d0fb5['status'](0xcc)[_0x014b('0x27')]();});}};}function handleEntityNotFound(_0x406d20,_0x729d64){return function(_0x450307){if(!_0x450307){_0x406d20[_0x014b('0x1b')](0x194);}return _0x450307;};}function handleError(_0x5a8cf2,_0x1976dc){_0x1976dc=_0x1976dc||0x1f4;return function(_0x403267){logger[_0x014b('0x28')](_0x403267[_0x014b('0x29')]);if(_0x403267[_0x014b('0x2a')]){delete _0x403267[_0x014b('0x2a')];}_0x5a8cf2[_0x014b('0x1c')](_0x1976dc)[_0x014b('0x2b')](_0x403267);};}exports['index']=function(_0x589af4,_0x36d62d){var _0x557106={},_0x388ea9={},_0x305174={'count':0x0,'rows':[]};var _0x521413=_['map'](db[_0x014b('0x2c')][_0x014b('0x2d')],function(_0x220965){return{'name':_0x220965[_0x014b('0x2e')],'type':_0x220965[_0x014b('0x2f')][_0x014b('0x30')]};});_0x388ea9[_0x014b('0x31')]=_[_0x014b('0x32')](_0x521413,'name');_0x388ea9[_0x014b('0x33')]=_[_0x014b('0x34')](_0x589af4[_0x014b('0x33')]);_0x388ea9[_0x014b('0x35')]=_[_0x014b('0x36')](_0x388ea9['model'],_0x388ea9[_0x014b('0x33')]);_0x557106['attributes']=_[_0x014b('0x36')](_0x388ea9[_0x014b('0x31')],qs['fields'](_0x589af4[_0x014b('0x33')][_0x014b('0x37')]));_0x557106['attributes']=_0x557106[_0x014b('0x38')][_0x014b('0x39')]?_0x557106[_0x014b('0x38')]:_0x388ea9[_0x014b('0x31')];if(!_0x589af4[_0x014b('0x33')][_0x014b('0x3a')](_0x014b('0x3b'))){_0x557106['limit']=qs[_0x014b('0x20')](_0x589af4[_0x014b('0x33')]['limit']);_0x557106[_0x014b('0x1e')]=qs[_0x014b('0x1e')](_0x589af4['query']['offset']);}_0x557106[_0x014b('0x3c')]=qs[_0x014b('0x3d')](_0x589af4[_0x014b('0x33')]['sort']);_0x557106['where']=qs['filters'](_[_0x014b('0x3e')](_0x589af4[_0x014b('0x33')],_0x388ea9[_0x014b('0x35')]),_0x521413);if(_0x589af4[_0x014b('0x33')][_0x014b('0x3f')]){_0x557106[_0x014b('0x40')]=_['merge'](_0x557106[_0x014b('0x40')],{'$or':_['map'](_0x521413,function(_0x101384){if(_0x101384['type']!=='VIRTUAL'){var _0x47ba2d={};_0x47ba2d[_0x101384['name']]={'$like':'%'+_0x589af4[_0x014b('0x33')][_0x014b('0x3f')]+'%'};return _0x47ba2d;}})});}_0x557106=_[_0x014b('0x41')]({},_0x557106,_0x589af4[_0x014b('0x42')]);var _0x4ef9cf={'where':_0x557106[_0x014b('0x40')]};return db[_0x014b('0x2c')]['count'](_0x4ef9cf)[_0x014b('0x26')](function(_0x4b2eb6){_0x305174[_0x014b('0x21')]=_0x4b2eb6;if(_0x589af4[_0x014b('0x33')][_0x014b('0x43')]){_0x557106[_0x014b('0x44')]=[{'all':!![]}];}return db[_0x014b('0x2c')][_0x014b('0x45')](_0x557106);})[_0x014b('0x26')](function(_0x289abf){_0x305174[_0x014b('0x46')]=_0x289abf;return _0x305174;})[_0x014b('0x26')](respondWithFilteredResult(_0x36d62d,_0x557106))[_0x014b('0x47')](handleError(_0x36d62d,null));};exports['show']=function(_0x3cd4f8,_0x510179){var _0x5e4800={'raw':![],'where':{'id':_0x3cd4f8[_0x014b('0x48')]['id']}},_0x20bafa={};_0x20bafa[_0x014b('0x31')]=_[_0x014b('0x34')](db['SalesforceAccount'][_0x014b('0x2d')]);_0x20bafa['query']=_[_0x014b('0x34')](_0x3cd4f8[_0x014b('0x33')]);_0x20bafa['filters']=_[_0x014b('0x36')](_0x20bafa['model'],_0x20bafa[_0x014b('0x33')]);_0x5e4800[_0x014b('0x38')]=_['intersection'](_0x20bafa[_0x014b('0x31')],qs[_0x014b('0x37')](_0x3cd4f8[_0x014b('0x33')]['fields']));_0x5e4800['attributes']=_0x5e4800['attributes']['length']?_0x5e4800[_0x014b('0x38')]:_0x20bafa[_0x014b('0x31')];if(_0x3cd4f8['query']['includeAll']){_0x5e4800[_0x014b('0x44')]=[{'all':!![]}];}_0x5e4800=_['merge']({},_0x5e4800,_0x3cd4f8[_0x014b('0x42')]);return db[_0x014b('0x2c')][_0x014b('0x49')](_0x5e4800)['then'](handleEntityNotFound(_0x510179,null))['then'](respondWithResult(_0x510179,null))['catch'](handleError(_0x510179,null));};exports[_0x014b('0x4a')]=function(_0x1aa64c,_0x1d6b2f){return db[_0x014b('0x2c')][_0x014b('0x4a')](_0x1aa64c[_0x014b('0x4b')],{})[_0x014b('0x26')](respondWithResult(_0x1d6b2f,0xc9))[_0x014b('0x47')](handleError(_0x1d6b2f,null));};exports[_0x014b('0x4c')]=function(_0x293a66,_0xf7a12e){if(_0x293a66[_0x014b('0x4b')]['id']){delete _0x293a66[_0x014b('0x4b')]['id'];}return db[_0x014b('0x2c')][_0x014b('0x49')]({'where':{'id':_0x293a66['params']['id']}})[_0x014b('0x26')](handleEntityNotFound(_0xf7a12e,null))['then'](saveUpdates(_0x293a66[_0x014b('0x4b')],null))[_0x014b('0x26')](respondWithResult(_0xf7a12e,null))[_0x014b('0x47')](handleError(_0xf7a12e,null));};exports[_0x014b('0x4d')]=function(_0x37a69a,_0x47aa1c){return db['SalesforceAccount'][_0x014b('0x49')]({'where':{'id':_0x37a69a[_0x014b('0x48')]['id']}})[_0x014b('0x26')](handleEntityNotFound(_0x47aa1c,null))[_0x014b('0x26')](removeEntity(_0x47aa1c,null))['catch'](handleError(_0x47aa1c,null));};exports[_0x014b('0x4e')]=function(_0x58d700,_0x48b03e,_0x1f3fc7){var _0x3908dc={};var _0x404cbf={};var _0x2426da;var _0x2991f0;return db[_0x014b('0x2c')][_0x014b('0x4f')]({'where':{'id':_0x58d700[_0x014b('0x48')]['id']}})[_0x014b('0x26')](handleEntityNotFound(_0x48b03e,null))[_0x014b('0x26')](function(_0xf4025f){if(_0xf4025f){_0x2426da=_0xf4025f;_0x404cbf[_0x014b('0x31')]=_[_0x014b('0x34')](db[_0x014b('0x50')][_0x014b('0x2d')]);_0x404cbf[_0x014b('0x33')]=_[_0x014b('0x34')](_0x58d700[_0x014b('0x33')]);_0x404cbf[_0x014b('0x35')]=_[_0x014b('0x36')](_0x404cbf[_0x014b('0x31')],_0x404cbf[_0x014b('0x33')]);_0x3908dc[_0x014b('0x38')]=_[_0x014b('0x36')](_0x404cbf[_0x014b('0x31')],qs[_0x014b('0x37')](_0x58d700[_0x014b('0x33')][_0x014b('0x37')]));_0x3908dc['attributes']=_0x3908dc[_0x014b('0x38')][_0x014b('0x39')]?_0x3908dc[_0x014b('0x38')]:_0x404cbf[_0x014b('0x31')];_0x3908dc[_0x014b('0x3c')]=qs[_0x014b('0x3d')](_0x58d700[_0x014b('0x33')]['sort']);_0x3908dc[_0x014b('0x40')]=qs[_0x014b('0x35')](_[_0x014b('0x3e')](_0x58d700[_0x014b('0x33')],_0x404cbf['filters']));if(_0x58d700[_0x014b('0x33')][_0x014b('0x3f')]){_0x3908dc['where']=_[_0x014b('0x41')](_0x3908dc[_0x014b('0x40')],{'$or':_[_0x014b('0x32')](_0x3908dc[_0x014b('0x38')],function(_0x1b526a){var _0x585cf0={};_0x585cf0[_0x1b526a]={'$like':'%'+_0x58d700[_0x014b('0x33')][_0x014b('0x3f')]+'%'};return _0x585cf0;})});}_0x3908dc=_['merge']({},_0x3908dc,_0x58d700[_0x014b('0x42')]);return _0x2426da[_0x014b('0x4e')](_0x3908dc);}})[_0x014b('0x26')](function(_0x1aab02){if(_0x1aab02){_0x2991f0=_0x1aab02[_0x014b('0x39')];if(!_0x58d700[_0x014b('0x33')][_0x014b('0x3a')](_0x014b('0x3b'))){_0x3908dc['limit']=qs[_0x014b('0x20')](_0x58d700[_0x014b('0x33')]['limit']);_0x3908dc['offset']=qs[_0x014b('0x1e')](_0x58d700['query'][_0x014b('0x1e')]);}return _0x2426da[_0x014b('0x4e')](_0x3908dc);}})[_0x014b('0x26')](function(_0x304e56){if(_0x304e56){return _0x304e56?{'count':_0x2991f0,'rows':_0x304e56}:null;}})[_0x014b('0x26')](respondWithResult(_0x48b03e,null))['catch'](handleError(_0x48b03e,null));};exports[_0x014b('0x51')]=function(_0x3df32,_0x56d8fd,_0x37ca06){if(_0x3df32[_0x014b('0x4b')]['id']){delete _0x3df32['body']['id'];}return db[_0x014b('0x2c')][_0x014b('0x4f')]({'where':{'id':_0x3df32[_0x014b('0x48')]['id']}})[_0x014b('0x26')](handleEntityNotFound(_0x56d8fd,null))[_0x014b('0x26')](function(_0xe55075){if(_0xe55075){_0x3df32[_0x014b('0x4b')][_0x014b('0x52')]=_0xe55075['id'];_0x3df32['body'][_0x014b('0x53')]=integrations[_0x014b('0x54')](_0x3df32[_0x014b('0x4b')][_0x014b('0x55')],_0x3df32[_0x014b('0x4b')][_0x014b('0x2f')]);_0x3df32[_0x014b('0x4b')][_0x014b('0x56')]=integrations[_0x014b('0x57')](_0x3df32['body'][_0x014b('0x55')],_0x3df32['body'][_0x014b('0x2f')]);return db[_0x014b('0x50')][_0x014b('0x4a')](_0x3df32[_0x014b('0x4b')],{'include':[{'model':db[_0x014b('0x58')],'as':'Subjects'},{'model':db[_0x014b('0x58')],'as':_0x014b('0x56')}]});}return null;})['then'](respondWithResult(_0x56d8fd,null))[_0x014b('0x47')](handleError(_0x56d8fd,null));};exports[_0x014b('0x59')]=function(_0x47c323,_0x1fc9c5,_0x4fd12a){var _0x6a90be;var _0x21236f='';var _0x167fa2=_0x014b('0x5a');return db['SalesforceAccount'][_0x014b('0x4f')]({'where':{'id':_0x47c323[_0x014b('0x48')]['id']},'attributes':['id',_0x014b('0x5b'),'clientId',_0x014b('0x5c'),_0x014b('0x5d'),_0x014b('0x5e'),_0x014b('0x5f')]})[_0x014b('0x26')](handleEntityNotFound(_0x1fc9c5,null))['then'](function(_0x1b09b7){if(_0x1b09b7){_0x21236f=_0x1b09b7[_0x014b('0x5b')];var _0x4d2d9f=_0x21236f[_0x014b('0x60')](-0x1);if(_0x4d2d9f==='/'){_0x21236f=_0x21236f[_0x014b('0x61')](0x0,_0x21236f[_0x014b('0x62')](_0x4d2d9f));}_0x6a90be=new jsforce[(_0x014b('0x63'))]({'oauth2':{'loginUrl':_0x21236f,'clientId':_0x1b09b7[_0x014b('0x64')],'clientSecret':_0x1b09b7['clientSecret']}});return _0x6a90be[_0x014b('0x65')](_0x1b09b7[_0x014b('0x5d')],_0x1b09b7[_0x014b('0x5e')][_0x014b('0x66')](_0x1b09b7[_0x014b('0x5f')]));}})['then'](function(_0x42b673){if(_0x42b673){if(!_[_0x014b('0x67')](_0x47c323[_0x014b('0x33')][_0x014b('0x68')])){_0x167fa2=_0x47c323[_0x014b('0x33')][_0x014b('0x68')];}return _0x6a90be[_0x014b('0x69')](_0x167fa2)[_0x014b('0x6a')]();}})[_0x014b('0x26')](function(_0x37cc9c){var _0x2b3768=[_0x014b('0x6b'),_0x014b('0x6c'),'IsReminderSet',_0x014b('0x6d'),_0x014b('0x6e'),_0x014b('0x6f')];var _0x2d3a93=[_0x014b('0x70'),_0x014b('0x71'),_0x014b('0x72'),_0x014b('0x73'),_0x014b('0x74'),_0x014b('0x75'),'phone'];if(_0x37cc9c){_[_0x014b('0x76')](_0x37cc9c['fields'],function(_0x5c1c70){return _0x2b3768[_0x014b('0x77')](_0x5c1c70['name'])||!_0x2d3a93[_0x014b('0x77')](_0x5c1c70['type']);});return{'count':_0x37cc9c['fields']['length'],'rows':_[_0x014b('0x32')](_0x37cc9c[_0x014b('0x37')],function(_0x1d9072){return{'id':_0x1d9072[_0x014b('0x2a')],'name':_0x1d9072['label'],'custom':_0x1d9072['custom'],'options':_0x1d9072[_0x014b('0x78')][_0x014b('0x39')]>0x0?_[_0x014b('0x32')](_0x1d9072[_0x014b('0x78')],function(_0x5a4d46){return{'name':_0x5a4d46[_0x014b('0x79')],'value':_0x5a4d46[_0x014b('0x7a')]};}):_0x1d9072['type']==_0x014b('0x73')?[{'name':'True','value':_0x014b('0x7b')},{'name':_0x014b('0x7c'),'value':_0x014b('0x7d')}]:[]};})};}})[_0x014b('0x26')](respondWithResult(_0x1fc9c5,null))['catch'](function(_0x4bd3e4){var _0x3809cf=_0x47c323[_0x014b('0x33')]['test']?0x1f4:_0x4bd3e4[_0x014b('0x7e')]||0x1f4;logger[_0x014b('0x28')](_0x014b('0x7f'),'getFields',_0x3809cf,JSON['stringify'](_0x4bd3e4));delete _0x4bd3e4['name'];if(_0x3809cf===0x191){_0x3809cf=0x190;}_0x1fc9c5[_0x014b('0x1c')](_0x3809cf)[_0x014b('0x2b')](_0x47c323[_0x014b('0x33')][_0x014b('0x80')]?{'message':_0x014b('0x81'),'statusCode':_0x4bd3e4[_0x014b('0x7e')]}:_0x4bd3e4);});}; \ No newline at end of file +var _0x44e4=['../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','apply','save','update','then','destroy','name','send','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','filter','merge','includeAll','findAll','rows','catch','show','include','options','find','create','body','params','getConfigurations','findOne','SalesforceConfiguration','length','addConfiguration','getSubjects','getDescriptions','channel','Subjects','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','password','substring','lastIndexOf','Connection','login','username','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','picklistValues','value','True','true','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x40a364,_0x7aa2e4){var _0x3434d1=function(_0x2e7e4a){while(--_0x2e7e4a){_0x40a364['push'](_0x40a364['shift']());}};_0x3434d1(++_0x7aa2e4);}(_0x44e4,0xde));var _0x444e=function(_0x2b31a8,_0x28b862){_0x2b31a8=_0x2b31a8-0x0;var _0x1175a5=_0x44e4[_0x2b31a8];return _0x1175a5;};'use strict';var emlformat=require(_0x444e('0x0'));var rimraf=require(_0x444e('0x1'));var zipdir=require(_0x444e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x444e('0x3'));var Mustache=require('mustache');var util=require(_0x444e('0x4'));var path=require(_0x444e('0x5'));var sox=require(_0x444e('0x6'));var csv=require(_0x444e('0x7'));var ejs=require(_0x444e('0x8'));var fs=require('fs');var fs_extra=require(_0x444e('0x9'));var _=require(_0x444e('0xa'));var squel=require(_0x444e('0xb'));var crypto=require(_0x444e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x444e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x444e('0xe'));var Papa=require('papaparse');var Redis=require(_0x444e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x444e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x444e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x444e('0x12'));var config=require(_0x444e('0x13'));var licenseUtil=require(_0x444e('0x14'));var db=require(_0x444e('0x15'))['db'];var integrations=require(_0x444e('0x16'));function respondWithStatusCode(_0x3179b4,_0x5e9c98){_0x5e9c98=_0x5e9c98||0xcc;return function(_0x11087f){if(_0x11087f){return _0x3179b4[_0x444e('0x17')](_0x5e9c98);}return _0x3179b4[_0x444e('0x18')](_0x5e9c98)[_0x444e('0x19')]();};}function respondWithResult(_0x588931,_0xa6be8f){_0xa6be8f=_0xa6be8f||0xc8;return function(_0x1db231){if(_0x1db231){return _0x588931['status'](_0xa6be8f)['json'](_0x1db231);}};}function respondWithFilteredResult(_0x258b41,_0x29efb4){return function(_0x253b44){if(_0x253b44){var _0x13b511=typeof _0x29efb4[_0x444e('0x1a')]===_0x444e('0x1b')&&typeof _0x29efb4[_0x444e('0x1c')]===_0x444e('0x1b');var _0x55a93c=_0x253b44[_0x444e('0x1d')];var _0x22161f=_0x13b511?0x0:_0x29efb4[_0x444e('0x1a')];var _0x22ef75=_0x13b511?_0x253b44[_0x444e('0x1d')]:_0x29efb4[_0x444e('0x1a')]+_0x29efb4[_0x444e('0x1c')];var _0x4e5445;if(_0x22ef75>=_0x55a93c){_0x22ef75=_0x55a93c;_0x4e5445=0xc8;}else{_0x4e5445=0xce;}_0x258b41[_0x444e('0x18')](_0x4e5445);return _0x258b41[_0x444e('0x1e')]('Content-Range',_0x22161f+'-'+_0x22ef75+'/'+_0x55a93c)['json'](_0x253b44);}return null;};}function patchUpdates(_0x4ccd47){return function(_0x4722b9){try{jsonpatch[_0x444e('0x1f')](_0x4722b9,_0x4ccd47,!![]);}catch(_0x4909f0){return BPromise['reject'](_0x4909f0);}return _0x4722b9[_0x444e('0x20')]();};}function saveUpdates(_0x570db9,_0x2398c3){return function(_0x1aa424){if(_0x1aa424){return _0x1aa424[_0x444e('0x21')](_0x570db9)[_0x444e('0x22')](function(_0x3fc15b){return _0x3fc15b;});}return null;};}function removeEntity(_0x3c43e5,_0x90ec27){return function(_0x317f17){if(_0x317f17){return _0x317f17[_0x444e('0x23')]()['then'](function(){_0x3c43e5[_0x444e('0x18')](0xcc)[_0x444e('0x19')]();});}};}function handleEntityNotFound(_0x4935c9,_0x2be63b){return function(_0xbc8b7e){if(!_0xbc8b7e){_0x4935c9[_0x444e('0x17')](0x194);}return _0xbc8b7e;};}function handleError(_0x2270f8,_0x51f5b7){_0x51f5b7=_0x51f5b7||0x1f4;return function(_0x421a4c){logger['error'](_0x421a4c['stack']);if(_0x421a4c[_0x444e('0x24')]){delete _0x421a4c[_0x444e('0x24')];}_0x2270f8['status'](_0x51f5b7)[_0x444e('0x25')](_0x421a4c);};}exports['index']=function(_0x32cc04,_0x367d6c){var _0x342ef5={},_0x1d4d81={},_0x1af055={'count':0x0,'rows':[]};var _0x27a738=_[_0x444e('0x26')](db[_0x444e('0x27')][_0x444e('0x28')],function(_0x516d77){return{'name':_0x516d77[_0x444e('0x29')],'type':_0x516d77[_0x444e('0x2a')][_0x444e('0x2b')]};});_0x1d4d81[_0x444e('0x2c')]=_[_0x444e('0x26')](_0x27a738,_0x444e('0x24'));_0x1d4d81[_0x444e('0x2d')]=_[_0x444e('0x2e')](_0x32cc04[_0x444e('0x2d')]);_0x1d4d81['filters']=_[_0x444e('0x2f')](_0x1d4d81['model'],_0x1d4d81[_0x444e('0x2d')]);_0x342ef5[_0x444e('0x30')]=_['intersection'](_0x1d4d81['model'],qs[_0x444e('0x31')](_0x32cc04[_0x444e('0x2d')]['fields']));_0x342ef5[_0x444e('0x30')]=_0x342ef5['attributes']['length']?_0x342ef5[_0x444e('0x30')]:_0x1d4d81[_0x444e('0x2c')];if(!_0x32cc04[_0x444e('0x2d')][_0x444e('0x32')](_0x444e('0x33'))){_0x342ef5['limit']=qs[_0x444e('0x1c')](_0x32cc04['query'][_0x444e('0x1c')]);_0x342ef5[_0x444e('0x1a')]=qs[_0x444e('0x1a')](_0x32cc04['query'][_0x444e('0x1a')]);}_0x342ef5[_0x444e('0x34')]=qs[_0x444e('0x35')](_0x32cc04[_0x444e('0x2d')][_0x444e('0x35')]);_0x342ef5['where']=qs[_0x444e('0x36')](_[_0x444e('0x37')](_0x32cc04[_0x444e('0x2d')],_0x1d4d81[_0x444e('0x36')]),_0x27a738);if(_0x32cc04['query']['filter']){_0x342ef5[_0x444e('0x38')]=_['merge'](_0x342ef5[_0x444e('0x38')],{'$or':_[_0x444e('0x26')](_0x27a738,function(_0x150f23){if(_0x150f23[_0x444e('0x2a')]!=='VIRTUAL'){var _0x2cb086={};_0x2cb086[_0x150f23[_0x444e('0x24')]]={'$like':'%'+_0x32cc04[_0x444e('0x2d')][_0x444e('0x39')]+'%'};return _0x2cb086;}})});}_0x342ef5=_[_0x444e('0x3a')]({},_0x342ef5,_0x32cc04['options']);var _0x1b80c5={'where':_0x342ef5[_0x444e('0x38')]};return db[_0x444e('0x27')]['count'](_0x1b80c5)[_0x444e('0x22')](function(_0x20bca1){_0x1af055[_0x444e('0x1d')]=_0x20bca1;if(_0x32cc04['query'][_0x444e('0x3b')]){_0x342ef5['include']=[{'all':!![]}];}return db[_0x444e('0x27')][_0x444e('0x3c')](_0x342ef5);})[_0x444e('0x22')](function(_0x1c5b4a){_0x1af055[_0x444e('0x3d')]=_0x1c5b4a;return _0x1af055;})[_0x444e('0x22')](respondWithFilteredResult(_0x367d6c,_0x342ef5))[_0x444e('0x3e')](handleError(_0x367d6c,null));};exports[_0x444e('0x3f')]=function(_0x112caa,_0x32bf75){var _0x541fb2={'raw':![],'where':{'id':_0x112caa['params']['id']}},_0xe7a4f9={};_0xe7a4f9[_0x444e('0x2c')]=_[_0x444e('0x2e')](db[_0x444e('0x27')][_0x444e('0x28')]);_0xe7a4f9[_0x444e('0x2d')]=_[_0x444e('0x2e')](_0x112caa[_0x444e('0x2d')]);_0xe7a4f9[_0x444e('0x36')]=_['intersection'](_0xe7a4f9[_0x444e('0x2c')],_0xe7a4f9[_0x444e('0x2d')]);_0x541fb2['attributes']=_[_0x444e('0x2f')](_0xe7a4f9[_0x444e('0x2c')],qs[_0x444e('0x31')](_0x112caa[_0x444e('0x2d')][_0x444e('0x31')]));_0x541fb2[_0x444e('0x30')]=_0x541fb2[_0x444e('0x30')]['length']?_0x541fb2[_0x444e('0x30')]:_0xe7a4f9['model'];if(_0x112caa[_0x444e('0x2d')][_0x444e('0x3b')]){_0x541fb2[_0x444e('0x40')]=[{'all':!![]}];}_0x541fb2=_[_0x444e('0x3a')]({},_0x541fb2,_0x112caa[_0x444e('0x41')]);return db[_0x444e('0x27')][_0x444e('0x42')](_0x541fb2)['then'](handleEntityNotFound(_0x32bf75,null))[_0x444e('0x22')](respondWithResult(_0x32bf75,null))[_0x444e('0x3e')](handleError(_0x32bf75,null));};exports[_0x444e('0x43')]=function(_0x225655,_0x492c47){return db[_0x444e('0x27')][_0x444e('0x43')](_0x225655[_0x444e('0x44')],{})[_0x444e('0x22')](respondWithResult(_0x492c47,0xc9))[_0x444e('0x3e')](handleError(_0x492c47,null));};exports['update']=function(_0x58c2f4,_0x2e8b21){if(_0x58c2f4['body']['id']){delete _0x58c2f4[_0x444e('0x44')]['id'];}return db[_0x444e('0x27')][_0x444e('0x42')]({'where':{'id':_0x58c2f4[_0x444e('0x45')]['id']}})[_0x444e('0x22')](handleEntityNotFound(_0x2e8b21,null))['then'](saveUpdates(_0x58c2f4[_0x444e('0x44')],null))['then'](respondWithResult(_0x2e8b21,null))[_0x444e('0x3e')](handleError(_0x2e8b21,null));};exports[_0x444e('0x23')]=function(_0x1fa6e4,_0x15d1d7){return db[_0x444e('0x27')][_0x444e('0x42')]({'where':{'id':_0x1fa6e4[_0x444e('0x45')]['id']}})[_0x444e('0x22')](handleEntityNotFound(_0x15d1d7,null))[_0x444e('0x22')](removeEntity(_0x15d1d7,null))[_0x444e('0x3e')](handleError(_0x15d1d7,null));};exports[_0x444e('0x46')]=function(_0x5962ca,_0x5e5b14,_0x120114){var _0x25ba6c={};var _0x1f134d={};var _0xbad4ec;var _0x3c09c5;return db['SalesforceAccount'][_0x444e('0x47')]({'where':{'id':_0x5962ca['params']['id']}})[_0x444e('0x22')](handleEntityNotFound(_0x5e5b14,null))[_0x444e('0x22')](function(_0x14a5ed){if(_0x14a5ed){_0xbad4ec=_0x14a5ed;_0x1f134d[_0x444e('0x2c')]=_[_0x444e('0x2e')](db[_0x444e('0x48')][_0x444e('0x28')]);_0x1f134d['query']=_[_0x444e('0x2e')](_0x5962ca[_0x444e('0x2d')]);_0x1f134d[_0x444e('0x36')]=_[_0x444e('0x2f')](_0x1f134d[_0x444e('0x2c')],_0x1f134d[_0x444e('0x2d')]);_0x25ba6c[_0x444e('0x30')]=_[_0x444e('0x2f')](_0x1f134d[_0x444e('0x2c')],qs[_0x444e('0x31')](_0x5962ca[_0x444e('0x2d')][_0x444e('0x31')]));_0x25ba6c['attributes']=_0x25ba6c[_0x444e('0x30')][_0x444e('0x49')]?_0x25ba6c[_0x444e('0x30')]:_0x1f134d[_0x444e('0x2c')];_0x25ba6c[_0x444e('0x34')]=qs['sort'](_0x5962ca[_0x444e('0x2d')]['sort']);_0x25ba6c[_0x444e('0x38')]=qs[_0x444e('0x36')](_['pick'](_0x5962ca[_0x444e('0x2d')],_0x1f134d[_0x444e('0x36')]));if(_0x5962ca[_0x444e('0x2d')][_0x444e('0x39')]){_0x25ba6c[_0x444e('0x38')]=_[_0x444e('0x3a')](_0x25ba6c['where'],{'$or':_['map'](_0x25ba6c[_0x444e('0x30')],function(_0x88a63b){var _0x219d0b={};_0x219d0b[_0x88a63b]={'$like':'%'+_0x5962ca[_0x444e('0x2d')][_0x444e('0x39')]+'%'};return _0x219d0b;})});}_0x25ba6c=_[_0x444e('0x3a')]({},_0x25ba6c,_0x5962ca['options']);return _0xbad4ec[_0x444e('0x46')](_0x25ba6c);}})[_0x444e('0x22')](function(_0x2a11a7){if(_0x2a11a7){_0x3c09c5=_0x2a11a7[_0x444e('0x49')];if(!_0x5962ca['query'][_0x444e('0x32')](_0x444e('0x33'))){_0x25ba6c[_0x444e('0x1c')]=qs[_0x444e('0x1c')](_0x5962ca[_0x444e('0x2d')][_0x444e('0x1c')]);_0x25ba6c['offset']=qs['offset'](_0x5962ca[_0x444e('0x2d')][_0x444e('0x1a')]);}return _0xbad4ec[_0x444e('0x46')](_0x25ba6c);}})[_0x444e('0x22')](function(_0x591670){if(_0x591670){return _0x591670?{'count':_0x3c09c5,'rows':_0x591670}:null;}})['then'](respondWithResult(_0x5e5b14,null))[_0x444e('0x3e')](handleError(_0x5e5b14,null));};exports[_0x444e('0x4a')]=function(_0x218445,_0x3e99c3,_0x5dd335){if(_0x218445['body']['id']){delete _0x218445[_0x444e('0x44')]['id'];}return db[_0x444e('0x27')][_0x444e('0x47')]({'where':{'id':_0x218445[_0x444e('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e99c3,null))[_0x444e('0x22')](function(_0x15825d){if(_0x15825d){_0x218445[_0x444e('0x44')]['AccountId']=_0x15825d['id'];_0x218445[_0x444e('0x44')]['Subjects']=integrations[_0x444e('0x4b')](_0x218445[_0x444e('0x44')]['channel'],_0x218445[_0x444e('0x44')][_0x444e('0x2a')]);_0x218445[_0x444e('0x44')]['Descriptions']=integrations[_0x444e('0x4c')](_0x218445[_0x444e('0x44')][_0x444e('0x4d')],_0x218445[_0x444e('0x44')]['type']);return db[_0x444e('0x48')][_0x444e('0x43')](_0x218445['body'],{'include':[{'model':db['SalesforceField'],'as':_0x444e('0x4e')},{'model':db['SalesforceField'],'as':_0x444e('0x4f')}]});}return null;})[_0x444e('0x22')](respondWithResult(_0x3e99c3,null))[_0x444e('0x3e')](handleError(_0x3e99c3,null));};exports[_0x444e('0x50')]=function(_0xd8d84b,_0x1324c6,_0x366670){var _0x2fd06a;var _0x32b525='';var _0x19f7fe=_0x444e('0x51');return db[_0x444e('0x27')][_0x444e('0x47')]({'where':{'id':_0xd8d84b[_0x444e('0x45')]['id']},'attributes':['id',_0x444e('0x52'),_0x444e('0x53'),_0x444e('0x54'),'username',_0x444e('0x55'),'securityToken']})[_0x444e('0x22')](handleEntityNotFound(_0x1324c6,null))['then'](function(_0x54e607){if(_0x54e607){_0x32b525=_0x54e607[_0x444e('0x52')];var _0x3ea221=_0x32b525['slice'](-0x1);if(_0x3ea221==='/'){_0x32b525=_0x32b525[_0x444e('0x56')](0x0,_0x32b525[_0x444e('0x57')](_0x3ea221));}_0x2fd06a=new jsforce[(_0x444e('0x58'))]({'oauth2':{'loginUrl':_0x32b525,'clientId':_0x54e607['clientId'],'clientSecret':_0x54e607[_0x444e('0x54')]}});return _0x2fd06a[_0x444e('0x59')](_0x54e607[_0x444e('0x5a')],_0x54e607[_0x444e('0x55')][_0x444e('0x5b')](_0x54e607['securityToken']));}})[_0x444e('0x22')](function(_0x2b282c){if(_0x2b282c){if(!_[_0x444e('0x5c')](_0xd8d84b['query'][_0x444e('0x5d')])){_0x19f7fe=_0xd8d84b[_0x444e('0x2d')][_0x444e('0x5d')];}return _0x2fd06a[_0x444e('0x5e')](_0x19f7fe)[_0x444e('0x5f')]();}})['then'](function(_0x29779c){var _0x26b5d4=[_0x444e('0x60'),_0x444e('0x61'),_0x444e('0x62'),_0x444e('0x63'),_0x444e('0x64'),_0x444e('0x65')];var _0x4eea63=[_0x444e('0x66'),_0x444e('0x67'),_0x444e('0x68'),_0x444e('0x69'),_0x444e('0x6a'),_0x444e('0x6b'),_0x444e('0x6c')];if(_0x29779c){_[_0x444e('0x6d')](_0x29779c['fields'],function(_0x57558f){return _0x26b5d4[_0x444e('0x6e')](_0x57558f[_0x444e('0x24')])||!_0x4eea63[_0x444e('0x6e')](_0x57558f[_0x444e('0x2a')]);});return{'count':_0x29779c[_0x444e('0x31')]['length'],'rows':_[_0x444e('0x26')](_0x29779c['fields'],function(_0x12ebec){return{'id':_0x12ebec[_0x444e('0x24')],'name':_0x12ebec[_0x444e('0x6f')],'custom':_0x12ebec['custom'],'options':_0x12ebec[_0x444e('0x70')]['length']>0x0?_[_0x444e('0x26')](_0x12ebec[_0x444e('0x70')],function(_0xd0129a){return{'name':_0xd0129a[_0x444e('0x6f')],'value':_0xd0129a[_0x444e('0x71')]};}):_0x12ebec[_0x444e('0x2a')]==_0x444e('0x69')?[{'name':_0x444e('0x72'),'value':_0x444e('0x73')},{'name':'False','value':_0x444e('0x74')}]:[]};})};}})[_0x444e('0x22')](respondWithResult(_0x1324c6,null))[_0x444e('0x3e')](function(_0x263f41){var _0x560db7=_0xd8d84b['query'][_0x444e('0x75')]?0x1f4:_0x263f41[_0x444e('0x76')]||0x1f4;logger[_0x444e('0x77')](_0x444e('0x78'),_0x444e('0x50'),_0x560db7,JSON['stringify'](_0x263f41));delete _0x263f41[_0x444e('0x24')];if(_0x560db7===0x191){_0x560db7=0x190;}_0x1324c6[_0x444e('0x18')](_0x560db7)['send'](_0xd8d84b['query'][_0x444e('0x75')]?{'message':_0x444e('0x79'),'statusCode':_0x263f41[_0x444e('0x76')]}:_0x263f41);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 45ebd6a..146bed5 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 _0x64f6=['define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports'];(function(_0x3e2022,_0x29eab1){var _0x3541c4=function(_0x246d92){while(--_0x246d92){_0x3e2022['push'](_0x3e2022['shift']());}};_0x3541c4(++_0x29eab1);}(_0x64f6,0x17d));var _0x664f=function(_0x5a4f3b,_0x344159){_0x5a4f3b=_0x5a4f3b-0x0;var _0x33e973=_0x64f6[_0x5a4f3b];return _0x33e973;};'use strict';var _=require(_0x664f('0x0'));var util=require(_0x664f('0x1'));var logger=require(_0x664f('0x2'))(_0x664f('0x3'));var moment=require(_0x664f('0x4'));var BPromise=require('bluebird');var rp=require(_0x664f('0x5'));var fs=require('fs');var path=require(_0x664f('0x6'));var rimraf=require(_0x664f('0x7'));var config=require(_0x664f('0x8'));var attributes=require(_0x664f('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x664f('0xa')]=function(_0x4d83a8,_0x1c63fb){return _0x4d83a8[_0x664f('0xb')](_0x664f('0xc'),attributes,{'tableName':_0x664f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a9c=['util','../../config/logger','moment','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x0a9c,0x18b));var _0xc0a9=function(_0x495d0f,_0x56f9ec){_0x495d0f=_0x495d0f-0x0;var _0x12a131=_0x0a9c[_0x495d0f];return _0x12a131;};'use strict';var _=require(_0xc0a9('0x0'));var util=require(_0xc0a9('0x1'));var logger=require(_0xc0a9('0x2'))('api');var moment=require(_0xc0a9('0x3'));var BPromise=require('bluebird');var rp=require(_0xc0a9('0x4'));var fs=require('fs');var path=require(_0xc0a9('0x5'));var rimraf=require(_0xc0a9('0x6'));var config=require('../../config/environment');var attributes=require(_0xc0a9('0x7'));var integrations=require(_0xc0a9('0x8'));module[_0xc0a9('0x9')]=function(_0x17a689,_0x11d65d){return _0x17a689[_0xc0a9('0xa')](_0xc0a9('0xb'),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 d421268..e281fa6 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 _0x22b0=['../../config/utils','../../config/logger','rpc','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','findAll','options','raw','attributes','limit','include','model','map','ShowSalesforceAccount','SalesforceAccount','where','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xc6116e,_0x5cd8ee){var _0x4ebc61=function(_0x42f301){while(--_0x42f301){_0xc6116e['push'](_0xc6116e['shift']());}};_0x4ebc61(++_0x5cd8ee);}(_0x22b0,0xcd));var _0x022b=function(_0x2eddcf,_0x29a0bf){_0x2eddcf=_0x2eddcf-0x0;var _0x4cbbd1=_0x22b0[_0x2eddcf];return _0x4cbbd1;};'use strict';var _=require('lodash');var util=require(_0x022b('0x0'));var moment=require('moment');var BPromise=require(_0x022b('0x1'));var rs=require(_0x022b('0x2'));var fs=require('fs');var Redis=require(_0x022b('0x3'));var db=require(_0x022b('0x4'))['db'];var utils=require(_0x022b('0x5'));var logger=require(_0x022b('0x6'))(_0x022b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x022b('0x8')][_0x022b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5259,_0x18c599,_0x290eb5){return new BPromise(function(_0x44dff9,_0x3ef455){return client[_0x022b('0xa')](_0x3c5259,_0x290eb5)[_0x022b('0xb')](function(_0x16356c){logger[_0x022b('0xc')](_0x022b('0xd'),_0x18c599,_0x022b('0xe'));logger[_0x022b('0xf')](_0x022b('0x10'),_0x18c599,'request\x20sent',JSON[_0x022b('0x11')](_0x16356c));if(_0x16356c[_0x022b('0x12')]){if(_0x16356c[_0x022b('0x12')][_0x022b('0x13')]===0x1f4){logger[_0x022b('0x12')](_0x022b('0xd'),_0x18c599,_0x16356c['error'][_0x022b('0x14')]);return _0x3ef455(_0x16356c[_0x022b('0x12')][_0x022b('0x14')]);}logger[_0x022b('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x18c599,_0x16356c[_0x022b('0x12')][_0x022b('0x14')]);return _0x44dff9(_0x16356c['error'][_0x022b('0x14')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x18c599,_0x022b('0xe'));_0x44dff9(_0x16356c[_0x022b('0x15')]['message']);}})[_0x022b('0x16')](function(_0x2ff059){logger[_0x022b('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x18c599,_0x2ff059);_0x3ef455(_0x2ff059);});});}exports[_0x022b('0x17')]=function(_0x1b971c){var _0x4279de=this;return new Promise(function(_0x3cf6a9,_0x1d0dbf){return db['SalesforceAccount'][_0x022b('0x18')]({'raw':_0x1b971c[_0x022b('0x19')]?_0x1b971c['options'][_0x022b('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b971c[_0x022b('0x19')]?_0x1b971c[_0x022b('0x19')]['where']||null:null,'attributes':_0x1b971c[_0x022b('0x19')]?_0x1b971c[_0x022b('0x19')][_0x022b('0x1b')]||null:null,'limit':_0x1b971c[_0x022b('0x19')]?_0x1b971c[_0x022b('0x19')][_0x022b('0x1c')]||null:null,'include':_0x1b971c[_0x022b('0x19')]?_0x1b971c[_0x022b('0x19')][_0x022b('0x1d')]?_['map'](_0x1b971c['options']['include'],function(_0x2590c3){return{'model':db[_0x2590c3['model']],'as':_0x2590c3['as'],'attributes':_0x2590c3['attributes'],'include':_0x2590c3[_0x022b('0x1d')]?_['map'](_0x2590c3[_0x022b('0x1d')],function(_0x3d0f2f){return{'model':db[_0x3d0f2f[_0x022b('0x1e')]],'as':_0x3d0f2f['as'],'attributes':_0x3d0f2f[_0x022b('0x1b')],'include':_0x3d0f2f['include']?_[_0x022b('0x1f')](_0x3d0f2f['include'],function(_0x1baec5){return{'model':db[_0x1baec5[_0x022b('0x1e')]],'as':_0x1baec5['as'],'attributes':_0x1baec5[_0x022b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x022b('0xb')](function(_0x5f2130){logger[_0x022b('0xc')]('GetSalesforceAccount',_0x1b971c);logger[_0x022b('0xf')]('GetSalesforceAccount',_0x1b971c,JSON[_0x022b('0x11')](_0x5f2130));_0x3cf6a9(_0x5f2130);})[_0x022b('0x16')](function(_0x5b78f8){logger['error']('GetSalesforceAccount',_0x5b78f8[_0x022b('0x14')],_0x1b971c);_0x1d0dbf(_0x4279de[_0x022b('0x12')](0x1f4,_0x5b78f8[_0x022b('0x14')]));});});};exports[_0x022b('0x20')]=function(_0x185c43){var _0x1a2da8=this;return new Promise(function(_0x23d957,_0x497d3b){return db[_0x022b('0x21')]['find']({'raw':_0x185c43['options']?_0x185c43[_0x022b('0x19')][_0x022b('0x1a')]===undefined?!![]:![]:!![],'where':_0x185c43[_0x022b('0x19')]?_0x185c43[_0x022b('0x19')][_0x022b('0x22')]||null:null,'attributes':_0x185c43[_0x022b('0x19')]?_0x185c43['options'][_0x022b('0x1b')]||null:null,'include':_0x185c43[_0x022b('0x19')]?_0x185c43[_0x022b('0x19')][_0x022b('0x1d')]?_[_0x022b('0x1f')](_0x185c43['options']['include'],function(_0x4a1bcc){return{'model':db[_0x4a1bcc[_0x022b('0x1e')]],'as':_0x4a1bcc['as'],'attributes':_0x4a1bcc[_0x022b('0x1b')],'include':_0x4a1bcc[_0x022b('0x1d')]?_[_0x022b('0x1f')](_0x4a1bcc[_0x022b('0x1d')],function(_0x37de70){return{'model':db[_0x37de70[_0x022b('0x1e')]],'as':_0x37de70['as'],'attributes':_0x37de70['attributes'],'include':_0x37de70[_0x022b('0x1d')]?_[_0x022b('0x1f')](_0x37de70[_0x022b('0x1d')],function(_0x9709b9){return{'model':db[_0x9709b9[_0x022b('0x1e')]],'as':_0x9709b9['as'],'attributes':_0x9709b9['attributes']};}):[]};}):[]};}):[]:[]})[_0x022b('0xb')](function(_0x312e82){logger[_0x022b('0xc')](_0x022b('0x20'),_0x185c43);logger['debug']('ShowSalesforceAccount',_0x185c43,JSON[_0x022b('0x11')](_0x312e82));_0x23d957(_0x312e82);})['catch'](function(_0x581c8d){logger['error'](_0x022b('0x20'),_0x581c8d[_0x022b('0x14')],_0x185c43);_0x497d3b(_0x1a2da8[_0x022b('0x12')](0x1f4,_0x581c8d[_0x022b('0x14')]));});});}; \ No newline at end of file +var _0x3eef=['raw','ShowSalesforceAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','where','attributes','limit','map','include','model','GetSalesforceAccount','debug','SalesforceAccount','find'];(function(_0x49b58c,_0x3b6cb9){var _0x9c1b64=function(_0x275d75){while(--_0x275d75){_0x49b58c['push'](_0x49b58c['shift']());}};_0x9c1b64(++_0x3b6cb9);}(_0x3eef,0xe0));var _0xf3ee=function(_0x365cbd,_0x227903){_0x365cbd=_0x365cbd-0x0;var _0x1d4d20=_0x3eef[_0x365cbd];return _0x1d4d20;};'use strict';var _=require(_0xf3ee('0x0'));var util=require(_0xf3ee('0x1'));var moment=require(_0xf3ee('0x2'));var BPromise=require('bluebird');var rs=require(_0xf3ee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3ee('0x4'))['db'];var utils=require(_0xf3ee('0x5'));var logger=require(_0xf3ee('0x6'))(_0xf3ee('0x7'));var config=require(_0xf3ee('0x8'));var jayson=require(_0xf3ee('0x9'));var client=jayson['client'][_0xf3ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bcda6,_0x4d22a7,_0x7ce3c9){return new BPromise(function(_0x363374,_0x161302){return client[_0xf3ee('0xb')](_0x5bcda6,_0x7ce3c9)[_0xf3ee('0xc')](function(_0x259d51){logger[_0xf3ee('0xd')](_0xf3ee('0xe'),_0x4d22a7,_0xf3ee('0xf'));logger['debug'](_0xf3ee('0x10'),_0x4d22a7,'request\x20sent',JSON[_0xf3ee('0x11')](_0x259d51));if(_0x259d51[_0xf3ee('0x12')]){if(_0x259d51[_0xf3ee('0x12')][_0xf3ee('0x13')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x4d22a7,_0x259d51['error'][_0xf3ee('0x14')]);return _0x161302(_0x259d51[_0xf3ee('0x12')][_0xf3ee('0x14')]);}logger[_0xf3ee('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x4d22a7,_0x259d51[_0xf3ee('0x12')][_0xf3ee('0x14')]);return _0x363374(_0x259d51['error'][_0xf3ee('0x14')]);}else{logger[_0xf3ee('0xd')](_0xf3ee('0xe'),_0x4d22a7,_0xf3ee('0xf'));_0x363374(_0x259d51[_0xf3ee('0x15')][_0xf3ee('0x14')]);}})[_0xf3ee('0x16')](function(_0x59ff71){logger[_0xf3ee('0x12')](_0xf3ee('0xe'),_0x4d22a7,_0x59ff71);_0x161302(_0x59ff71);});});}exports['GetSalesforceAccount']=function(_0x4afeed){var _0x37eb47=this;return new Promise(function(_0x1eb2c2,_0x301162){return db['SalesforceAccount'][_0xf3ee('0x17')]({'raw':_0x4afeed[_0xf3ee('0x18')]?_0x4afeed['options']['raw']===undefined?!![]:![]:!![],'where':_0x4afeed['options']?_0x4afeed[_0xf3ee('0x18')][_0xf3ee('0x19')]||null:null,'attributes':_0x4afeed[_0xf3ee('0x18')]?_0x4afeed[_0xf3ee('0x18')][_0xf3ee('0x1a')]||null:null,'limit':_0x4afeed[_0xf3ee('0x18')]?_0x4afeed[_0xf3ee('0x18')][_0xf3ee('0x1b')]||null:null,'include':_0x4afeed['options']?_0x4afeed[_0xf3ee('0x18')]['include']?_[_0xf3ee('0x1c')](_0x4afeed[_0xf3ee('0x18')][_0xf3ee('0x1d')],function(_0x6b5fa2){return{'model':db[_0x6b5fa2[_0xf3ee('0x1e')]],'as':_0x6b5fa2['as'],'attributes':_0x6b5fa2[_0xf3ee('0x1a')],'include':_0x6b5fa2[_0xf3ee('0x1d')]?_[_0xf3ee('0x1c')](_0x6b5fa2[_0xf3ee('0x1d')],function(_0x356e01){return{'model':db[_0x356e01[_0xf3ee('0x1e')]],'as':_0x356e01['as'],'attributes':_0x356e01[_0xf3ee('0x1a')],'include':_0x356e01[_0xf3ee('0x1d')]?_['map'](_0x356e01[_0xf3ee('0x1d')],function(_0x1314c3){return{'model':db[_0x1314c3['model']],'as':_0x1314c3['as'],'attributes':_0x1314c3[_0xf3ee('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf3ee('0xc')](function(_0x3dd84e){logger[_0xf3ee('0xd')](_0xf3ee('0x1f'),_0x4afeed);logger[_0xf3ee('0x20')](_0xf3ee('0x1f'),_0x4afeed,JSON[_0xf3ee('0x11')](_0x3dd84e));_0x1eb2c2(_0x3dd84e);})[_0xf3ee('0x16')](function(_0x53c17c){logger['error']('GetSalesforceAccount',_0x53c17c[_0xf3ee('0x14')],_0x4afeed);_0x301162(_0x37eb47[_0xf3ee('0x12')](0x1f4,_0x53c17c[_0xf3ee('0x14')]));});});};exports['ShowSalesforceAccount']=function(_0x166364){var _0x192937=this;return new Promise(function(_0x3caa6f,_0x370ab1){return db[_0xf3ee('0x21')][_0xf3ee('0x22')]({'raw':_0x166364[_0xf3ee('0x18')]?_0x166364[_0xf3ee('0x18')][_0xf3ee('0x23')]===undefined?!![]:![]:!![],'where':_0x166364[_0xf3ee('0x18')]?_0x166364[_0xf3ee('0x18')]['where']||null:null,'attributes':_0x166364[_0xf3ee('0x18')]?_0x166364[_0xf3ee('0x18')]['attributes']||null:null,'include':_0x166364['options']?_0x166364[_0xf3ee('0x18')][_0xf3ee('0x1d')]?_[_0xf3ee('0x1c')](_0x166364[_0xf3ee('0x18')][_0xf3ee('0x1d')],function(_0x13aa98){return{'model':db[_0x13aa98['model']],'as':_0x13aa98['as'],'attributes':_0x13aa98['attributes'],'include':_0x13aa98[_0xf3ee('0x1d')]?_['map'](_0x13aa98['include'],function(_0x3663e8){return{'model':db[_0x3663e8[_0xf3ee('0x1e')]],'as':_0x3663e8['as'],'attributes':_0x3663e8[_0xf3ee('0x1a')],'include':_0x3663e8[_0xf3ee('0x1d')]?_[_0xf3ee('0x1c')](_0x3663e8[_0xf3ee('0x1d')],function(_0xbbae89){return{'model':db[_0xbbae89[_0xf3ee('0x1e')]],'as':_0xbbae89['as'],'attributes':_0xbbae89['attributes']};}):[]};}):[]};}):[]:[]})[_0xf3ee('0xc')](function(_0x25bd61){logger['info'](_0xf3ee('0x24'),_0x166364);logger[_0xf3ee('0x20')]('ShowSalesforceAccount',_0x166364,JSON[_0xf3ee('0x11')](_0x25bd61));_0x3caa6f(_0x25bd61);})[_0xf3ee('0x16')](function(_0x4532f9){logger[_0xf3ee('0x12')](_0xf3ee('0x24'),_0x4532f9[_0xf3ee('0x14')],_0x166364);_0x370ab1(_0x192937[_0xf3ee('0x12')](0x1f4,_0x4532f9[_0xf3ee('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index b971e89..543d22c 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 _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(_0x2279cd,_0x318ac1){var _0x7efb94=function(_0x2c33fd){while(--_0x2c33fd){_0x2279cd['push'](_0x2279cd['shift']());}};_0x7efb94(++_0x318ac1);}(_0x2ef3,0xba));var _0x32ef=function(_0xc1d7b3,_0x4b5244){_0xc1d7b3=_0xc1d7b3-0x0;var _0x408803=_0x2ef3[_0xc1d7b3];return _0x408803;};'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 +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(_0x3609df,_0x13bc20){_0x3609df=_0x3609df-0x0;var _0x22ab78=_0x2032[_0x3609df];return _0x22ab78;};'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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 49db74d..aae5951 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 _0x5543=['exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5543,0x1bb));var _0x3554=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x5543[_0xbeb808];return _0x5d6909;};'use strict';var Sequelize=require(_0x3554('0x0'));module[_0x3554('0x1')]={'name':{'type':Sequelize[_0x3554('0x2')]},'description':{'type':Sequelize[_0x3554('0x2')]},'ticketType':{'type':Sequelize[_0x3554('0x3')](_0x3554('0x4'),_0x3554('0x5')),'defaultValue':_0x3554('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x3554('0x6'),_0x3554('0x7'),_0x3554('0x8'),_0x3554('0x9'),_0x3554('0xa')),'defaultValue':_0x3554('0x6')},'moduleCreate':{'type':Sequelize[_0x3554('0x3')](_0x3554('0xb'),_0x3554('0x7'),_0x3554('0x8'),_0x3554('0xa')),'defaultValue':_0x3554('0x8')},'leadId':{'type':Sequelize[_0x3554('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x3554('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x3554('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x3554('0x2')]}}; \ No newline at end of file +var _0x34f9=['STRING','ENUM','Task','contact_lead','contact','account_contact_lead','account','nothing','lead','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x34f9,0xfb));var _0x934f=function(_0x1f0203,_0x2f9046){_0x1f0203=_0x1f0203-0x0;var _0x39e381=_0x34f9[_0x1f0203];return _0x39e381;};'use strict';var Sequelize=require(_0x934f('0x0'));module[_0x934f('0x1')]={'name':{'type':Sequelize[_0x934f('0x2')]},'description':{'type':Sequelize[_0x934f('0x2')]},'ticketType':{'type':Sequelize[_0x934f('0x3')](_0x934f('0x4'),'Case'),'defaultValue':_0x934f('0x4')},'moduleSearch':{'type':Sequelize[_0x934f('0x3')](_0x934f('0x5'),_0x934f('0x6'),'lead',_0x934f('0x7'),_0x934f('0x8')),'defaultValue':_0x934f('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0x934f('0x9'),_0x934f('0x6'),_0x934f('0xa'),_0x934f('0x8')),'defaultValue':_0x934f('0xa')},'leadId':{'type':Sequelize[_0x934f('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x934f('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x934f('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x934f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 8ab2615..d8b64b5 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 _0x9d55=['params','rawAttributes','find','catch','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','send','index','map','SalesforceConfiguration','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','name','filter','options','includeAll','include','findAll','rows','show'];(function(_0x33177a,_0x4bf39f){var _0x39b047=function(_0x48eb25){while(--_0x48eb25){_0x33177a['push'](_0x33177a['shift']());}};_0x39b047(++_0x4bf39f);}(_0x9d55,0xfe));var _0x59d5=function(_0x5d887d,_0x302ed0){_0x5d887d=_0x5d887d-0x0;var _0x2858b7=_0x9d55[_0x5d887d];return _0x2858b7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x59d5('0x0'));var rp=require(_0x59d5('0x1'));var moment=require(_0x59d5('0x2'));var BPromise=require(_0x59d5('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x59d5('0x4'));var sox=require('sox');var csv=require(_0x59d5('0x5'));var ejs=require(_0x59d5('0x6'));var fs=require('fs');var fs_extra=require(_0x59d5('0x7'));var _=require(_0x59d5('0x8'));var squel=require(_0x59d5('0x9'));var crypto=require('crypto');var jsforce=require(_0x59d5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x59d5('0x5'));var querystring=require(_0x59d5('0xb'));var Papa=require(_0x59d5('0xc'));var Redis=require(_0x59d5('0xd'));var authService=require(_0x59d5('0xe'));var qs=require(_0x59d5('0xf'));var as=require(_0x59d5('0x10'));var hardwareService=require(_0x59d5('0x11'));var logger=require('../../config/logger')(_0x59d5('0x12'));var utils=require(_0x59d5('0x13'));var config=require(_0x59d5('0x14'));var licenseUtil=require(_0x59d5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d6506,_0x29acef){_0x29acef=_0x29acef||0xcc;return function(_0x5f3edf){if(_0x5f3edf){return _0x5d6506[_0x59d5('0x16')](_0x29acef);}return _0x5d6506[_0x59d5('0x17')](_0x29acef)[_0x59d5('0x18')]();};}function respondWithResult(_0x5dc948,_0x5be2bd){_0x5be2bd=_0x5be2bd||0xc8;return function(_0x4c6b22){if(_0x4c6b22){return _0x5dc948[_0x59d5('0x17')](_0x5be2bd)[_0x59d5('0x19')](_0x4c6b22);}};}function respondWithFilteredResult(_0x3a09eb,_0x50c331){return function(_0x1a5257){if(_0x1a5257){var _0x31b7b4=typeof _0x50c331[_0x59d5('0x1a')]===_0x59d5('0x1b')&&typeof _0x50c331[_0x59d5('0x1c')]===_0x59d5('0x1b');var _0xb14ef2=_0x1a5257[_0x59d5('0x1d')];var _0x29b281=_0x31b7b4?0x0:_0x50c331[_0x59d5('0x1a')];var _0x5a91d9=_0x31b7b4?_0x1a5257[_0x59d5('0x1d')]:_0x50c331[_0x59d5('0x1a')]+_0x50c331['limit'];var _0x9cccd5;if(_0x5a91d9>=_0xb14ef2){_0x5a91d9=_0xb14ef2;_0x9cccd5=0xc8;}else{_0x9cccd5=0xce;}_0x3a09eb[_0x59d5('0x17')](_0x9cccd5);return _0x3a09eb[_0x59d5('0x1e')]('Content-Range',_0x29b281+'-'+_0x5a91d9+'/'+_0xb14ef2)[_0x59d5('0x19')](_0x1a5257);}return null;};}function patchUpdates(_0x381ea6){return function(_0x64ab38){try{jsonpatch[_0x59d5('0x1f')](_0x64ab38,_0x381ea6,!![]);}catch(_0x211e6e){return BPromise[_0x59d5('0x20')](_0x211e6e);}return _0x64ab38[_0x59d5('0x21')]();};}function saveUpdates(_0xcb4f7b,_0x163161){return function(_0x21c854){if(_0x21c854){return _0x21c854[_0x59d5('0x22')](_0xcb4f7b)[_0x59d5('0x23')](function(_0x4477a7){return _0x4477a7;});}return null;};}function removeEntity(_0x19121a,_0x36c9b8){return function(_0x15264f){if(_0x15264f){return _0x15264f[_0x59d5('0x24')]()[_0x59d5('0x23')](function(){_0x19121a[_0x59d5('0x17')](0xcc)[_0x59d5('0x18')]();});}};}function handleEntityNotFound(_0x210e2e,_0x210fba){return function(_0x4c9ae0){if(!_0x4c9ae0){_0x210e2e[_0x59d5('0x16')](0x194);}return _0x4c9ae0;};}function handleError(_0x1f901c,_0x445f02){_0x445f02=_0x445f02||0x1f4;return function(_0x44b02e){logger[_0x59d5('0x25')](_0x44b02e[_0x59d5('0x26')]);if(_0x44b02e['name']){delete _0x44b02e['name'];}_0x1f901c[_0x59d5('0x17')](_0x445f02)[_0x59d5('0x27')](_0x44b02e);};}exports[_0x59d5('0x28')]=function(_0x265ed8,_0x57b4a5){var _0x551ff0={},_0x3c0635={},_0x431e3d={'count':0x0,'rows':[]};var _0x224c7b=_[_0x59d5('0x29')](db[_0x59d5('0x2a')]['rawAttributes'],function(_0x1d9305){return{'name':_0x1d9305[_0x59d5('0x2b')],'type':_0x1d9305[_0x59d5('0x2c')][_0x59d5('0x2d')]};});_0x3c0635['model']=_[_0x59d5('0x29')](_0x224c7b,'name');_0x3c0635[_0x59d5('0x2e')]=_[_0x59d5('0x2f')](_0x265ed8[_0x59d5('0x2e')]);_0x3c0635[_0x59d5('0x30')]=_[_0x59d5('0x31')](_0x3c0635['model'],_0x3c0635[_0x59d5('0x2e')]);_0x551ff0['attributes']=_[_0x59d5('0x31')](_0x3c0635['model'],qs[_0x59d5('0x32')](_0x265ed8['query']['fields']));_0x551ff0[_0x59d5('0x33')]=_0x551ff0['attributes'][_0x59d5('0x34')]?_0x551ff0[_0x59d5('0x33')]:_0x3c0635[_0x59d5('0x35')];if(!_0x265ed8[_0x59d5('0x2e')][_0x59d5('0x36')](_0x59d5('0x37'))){_0x551ff0[_0x59d5('0x1c')]=qs[_0x59d5('0x1c')](_0x265ed8[_0x59d5('0x2e')]['limit']);_0x551ff0[_0x59d5('0x1a')]=qs[_0x59d5('0x1a')](_0x265ed8['query'][_0x59d5('0x1a')]);}_0x551ff0[_0x59d5('0x38')]=qs[_0x59d5('0x39')](_0x265ed8[_0x59d5('0x2e')]['sort']);_0x551ff0[_0x59d5('0x3a')]=qs[_0x59d5('0x30')](_[_0x59d5('0x3b')](_0x265ed8[_0x59d5('0x2e')],_0x3c0635[_0x59d5('0x30')]),_0x224c7b);if(_0x265ed8[_0x59d5('0x2e')]['filter']){_0x551ff0[_0x59d5('0x3a')]=_[_0x59d5('0x3c')](_0x551ff0[_0x59d5('0x3a')],{'$or':_[_0x59d5('0x29')](_0x224c7b,function(_0x69501e){if(_0x69501e[_0x59d5('0x2c')]!==_0x59d5('0x3d')){var _0x564081={};_0x564081[_0x69501e[_0x59d5('0x3e')]]={'$like':'%'+_0x265ed8[_0x59d5('0x2e')][_0x59d5('0x3f')]+'%'};return _0x564081;}})});}_0x551ff0=_['merge']({},_0x551ff0,_0x265ed8[_0x59d5('0x40')]);var _0x2f7ac2={'where':_0x551ff0[_0x59d5('0x3a')]};return db['SalesforceConfiguration']['count'](_0x2f7ac2)[_0x59d5('0x23')](function(_0x3052a0){_0x431e3d['count']=_0x3052a0;if(_0x265ed8[_0x59d5('0x2e')][_0x59d5('0x41')]){_0x551ff0[_0x59d5('0x42')]=[{'all':!![]}];}return db[_0x59d5('0x2a')][_0x59d5('0x43')](_0x551ff0);})['then'](function(_0x2f6a45){_0x431e3d[_0x59d5('0x44')]=_0x2f6a45;return _0x431e3d;})[_0x59d5('0x23')](respondWithFilteredResult(_0x57b4a5,_0x551ff0))['catch'](handleError(_0x57b4a5,null));};exports[_0x59d5('0x45')]=function(_0x5d6f49,_0xe5775d){var _0x35fae7={'raw':![],'where':{'id':_0x5d6f49[_0x59d5('0x46')]['id']}},_0x261562={};_0x261562[_0x59d5('0x35')]=_[_0x59d5('0x2f')](db[_0x59d5('0x2a')][_0x59d5('0x47')]);_0x261562[_0x59d5('0x2e')]=_['keys'](_0x5d6f49[_0x59d5('0x2e')]);_0x261562[_0x59d5('0x30')]=_['intersection'](_0x261562[_0x59d5('0x35')],_0x261562[_0x59d5('0x2e')]);_0x35fae7[_0x59d5('0x33')]=_[_0x59d5('0x31')](_0x261562[_0x59d5('0x35')],qs[_0x59d5('0x32')](_0x5d6f49[_0x59d5('0x2e')][_0x59d5('0x32')]));_0x35fae7[_0x59d5('0x33')]=_0x35fae7[_0x59d5('0x33')][_0x59d5('0x34')]?_0x35fae7['attributes']:_0x261562['model'];if(_0x5d6f49['query']['includeAll']){_0x35fae7[_0x59d5('0x42')]=[{'all':!![]}];}_0x35fae7=_['merge']({},_0x35fae7,_0x5d6f49[_0x59d5('0x40')]);return db[_0x59d5('0x2a')][_0x59d5('0x48')](_0x35fae7)[_0x59d5('0x23')](handleEntityNotFound(_0xe5775d,null))['then'](respondWithResult(_0xe5775d,null))[_0x59d5('0x49')](handleError(_0xe5775d,null));};exports[_0x59d5('0x4a')]=function(_0x9afef2,_0x119d77){return db[_0x59d5('0x2a')][_0x59d5('0x4a')](_0x9afef2[_0x59d5('0x4b')],{})[_0x59d5('0x23')](respondWithResult(_0x119d77,0xc9))[_0x59d5('0x49')](handleError(_0x119d77,null));};exports[_0x59d5('0x22')]=function(_0x6c3eab,_0x874d16){if(_0x6c3eab[_0x59d5('0x4b')]['id']){delete _0x6c3eab[_0x59d5('0x4b')]['id'];}return db[_0x59d5('0x2a')][_0x59d5('0x48')]({'where':{'id':_0x6c3eab[_0x59d5('0x46')]['id']}})[_0x59d5('0x23')](handleEntityNotFound(_0x874d16,null))[_0x59d5('0x23')](saveUpdates(_0x6c3eab[_0x59d5('0x4b')],null))[_0x59d5('0x23')](respondWithResult(_0x874d16,null))[_0x59d5('0x49')](handleError(_0x874d16,null));};exports[_0x59d5('0x24')]=function(_0x8bb8c5,_0x5f16c5){return db[_0x59d5('0x2a')][_0x59d5('0x48')]({'where':{'id':_0x8bb8c5[_0x59d5('0x46')]['id']}})[_0x59d5('0x23')](handleEntityNotFound(_0x5f16c5,null))[_0x59d5('0x23')](removeEntity(_0x5f16c5,null))[_0x59d5('0x49')](handleError(_0x5f16c5,null));};exports[_0x59d5('0x4c')]=function(_0x4b195a,_0x55185f,_0x4c01f4){var _0x1c7c64={};var _0x1367a6={};var _0xbf3cf4;var _0x596af4;return db[_0x59d5('0x2a')][_0x59d5('0x4d')]({'where':{'id':_0x4b195a[_0x59d5('0x46')]['id']}})['then'](handleEntityNotFound(_0x55185f,null))[_0x59d5('0x23')](function(_0x298ec9){if(_0x298ec9){_0xbf3cf4=_0x298ec9;_0x1367a6[_0x59d5('0x35')]=_[_0x59d5('0x2f')](db[_0x59d5('0x4e')]['rawAttributes']);_0x1367a6[_0x59d5('0x2e')]=_['keys'](_0x4b195a[_0x59d5('0x2e')]);_0x1367a6['filters']=_[_0x59d5('0x31')](_0x1367a6[_0x59d5('0x35')],_0x1367a6[_0x59d5('0x2e')]);_0x1c7c64[_0x59d5('0x33')]=_[_0x59d5('0x31')](_0x1367a6[_0x59d5('0x35')],qs[_0x59d5('0x32')](_0x4b195a['query'][_0x59d5('0x32')]));_0x1c7c64[_0x59d5('0x33')]=_0x1c7c64[_0x59d5('0x33')]['length']?_0x1c7c64[_0x59d5('0x33')]:_0x1367a6[_0x59d5('0x35')];_0x1c7c64['order']=qs[_0x59d5('0x39')](_0x4b195a[_0x59d5('0x2e')]['sort']);_0x1c7c64['where']=qs['filters'](_[_0x59d5('0x3b')](_0x4b195a[_0x59d5('0x2e')],_0x1367a6[_0x59d5('0x30')]));if(_0x4b195a[_0x59d5('0x2e')][_0x59d5('0x3f')]){_0x1c7c64[_0x59d5('0x3a')]=_[_0x59d5('0x3c')](_0x1c7c64[_0x59d5('0x3a')],{'$or':_[_0x59d5('0x29')](_0x1c7c64['attributes'],function(_0x3620a5){var _0x2ba61f={};_0x2ba61f[_0x3620a5]={'$like':'%'+_0x4b195a['query'][_0x59d5('0x3f')]+'%'};return _0x2ba61f;})});}_0x1c7c64=_['merge']({},_0x1c7c64,_0x4b195a[_0x59d5('0x40')]);return _0xbf3cf4['getFields'](_0x1c7c64);}})['then'](function(_0x15f27c){if(_0x15f27c){_0x596af4=_0x15f27c[_0x59d5('0x34')];if(!_0x4b195a[_0x59d5('0x2e')]['hasOwnProperty']('nolimit')){_0x1c7c64[_0x59d5('0x1c')]=qs['limit'](_0x4b195a[_0x59d5('0x2e')][_0x59d5('0x1c')]);_0x1c7c64[_0x59d5('0x1a')]=qs[_0x59d5('0x1a')](_0x4b195a[_0x59d5('0x2e')][_0x59d5('0x1a')]);}return _0xbf3cf4[_0x59d5('0x4c')](_0x1c7c64);}})['then'](function(_0x418ad6){if(_0x418ad6){return _0x418ad6?{'count':_0x596af4,'rows':_0x418ad6}:null;}})['then'](respondWithResult(_0x55185f,null))[_0x59d5('0x49')](handleError(_0x55185f,null));};exports['getSubjects']=function(_0xb7ea6,_0xb87da2,_0x446773){var _0x26d525={};var _0x2d1ecb={};var _0x5c74cb;var _0x38979c;return db['SalesforceConfiguration'][_0x59d5('0x4d')]({'where':{'id':_0xb7ea6[_0x59d5('0x46')]['id']}})[_0x59d5('0x23')](handleEntityNotFound(_0xb87da2,null))['then'](function(_0x44d5db){if(_0x44d5db){_0x5c74cb=_0x44d5db;_0x2d1ecb[_0x59d5('0x35')]=_[_0x59d5('0x2f')](db[_0x59d5('0x4e')][_0x59d5('0x47')]);_0x2d1ecb[_0x59d5('0x2e')]=_['keys'](_0xb7ea6[_0x59d5('0x2e')]);_0x2d1ecb['filters']=_[_0x59d5('0x31')](_0x2d1ecb[_0x59d5('0x35')],_0x2d1ecb[_0x59d5('0x2e')]);_0x26d525[_0x59d5('0x33')]=_['intersection'](_0x2d1ecb['model'],qs[_0x59d5('0x32')](_0xb7ea6[_0x59d5('0x2e')][_0x59d5('0x32')]));_0x26d525[_0x59d5('0x33')]=_0x26d525[_0x59d5('0x33')][_0x59d5('0x34')]?_0x26d525[_0x59d5('0x33')]:_0x2d1ecb['model'];_0x26d525[_0x59d5('0x38')]=qs[_0x59d5('0x39')](_0xb7ea6[_0x59d5('0x2e')][_0x59d5('0x39')]);_0x26d525[_0x59d5('0x3a')]=qs[_0x59d5('0x30')](_[_0x59d5('0x3b')](_0xb7ea6['query'],_0x2d1ecb['filters']));if(_0xb7ea6[_0x59d5('0x2e')]['filter']){_0x26d525[_0x59d5('0x3a')]=_[_0x59d5('0x3c')](_0x26d525[_0x59d5('0x3a')],{'$or':_[_0x59d5('0x29')](_0x26d525[_0x59d5('0x33')],function(_0x35059c){var _0x51b965={};_0x51b965[_0x35059c]={'$like':'%'+_0xb7ea6[_0x59d5('0x2e')][_0x59d5('0x3f')]+'%'};return _0x51b965;})});}_0x26d525=_[_0x59d5('0x3c')]({},_0x26d525,_0xb7ea6[_0x59d5('0x40')]);return _0x5c74cb[_0x59d5('0x4f')](_0x26d525);}})['then'](function(_0x5d554c){if(_0x5d554c){_0x38979c=_0x5d554c[_0x59d5('0x34')];if(!_0xb7ea6[_0x59d5('0x2e')][_0x59d5('0x36')](_0x59d5('0x37'))){_0x26d525[_0x59d5('0x1c')]=qs[_0x59d5('0x1c')](_0xb7ea6['query'][_0x59d5('0x1c')]);_0x26d525[_0x59d5('0x1a')]=qs[_0x59d5('0x1a')](_0xb7ea6['query'][_0x59d5('0x1a')]);}return _0x5c74cb[_0x59d5('0x4f')](_0x26d525);}})['then'](function(_0x531c34){if(_0x531c34){return _0x531c34?{'count':_0x38979c,'rows':_0x531c34}:null;}})[_0x59d5('0x23')](respondWithResult(_0xb87da2,null))['catch'](handleError(_0xb87da2,null));};exports[_0x59d5('0x50')]=function(_0x12fceb,_0x1ddfaf,_0x3ba0dd){var _0x5e6d31={};var _0x28d7c={};var _0x3bfc3f;var _0x4d0df1;return db[_0x59d5('0x2a')]['findOne']({'where':{'id':_0x12fceb[_0x59d5('0x46')]['id']}})[_0x59d5('0x23')](handleEntityNotFound(_0x1ddfaf,null))[_0x59d5('0x23')](function(_0x130df4){if(_0x130df4){_0x3bfc3f=_0x130df4;_0x28d7c[_0x59d5('0x35')]=_[_0x59d5('0x2f')](db['SalesforceField']['rawAttributes']);_0x28d7c[_0x59d5('0x2e')]=_[_0x59d5('0x2f')](_0x12fceb[_0x59d5('0x2e')]);_0x28d7c[_0x59d5('0x30')]=_['intersection'](_0x28d7c[_0x59d5('0x35')],_0x28d7c[_0x59d5('0x2e')]);_0x5e6d31[_0x59d5('0x33')]=_['intersection'](_0x28d7c[_0x59d5('0x35')],qs['fields'](_0x12fceb[_0x59d5('0x2e')][_0x59d5('0x32')]));_0x5e6d31[_0x59d5('0x33')]=_0x5e6d31[_0x59d5('0x33')][_0x59d5('0x34')]?_0x5e6d31['attributes']:_0x28d7c[_0x59d5('0x35')];_0x5e6d31[_0x59d5('0x38')]=qs[_0x59d5('0x39')](_0x12fceb['query'][_0x59d5('0x39')]);_0x5e6d31[_0x59d5('0x3a')]=qs['filters'](_[_0x59d5('0x3b')](_0x12fceb[_0x59d5('0x2e')],_0x28d7c['filters']));if(_0x12fceb[_0x59d5('0x2e')]['filter']){_0x5e6d31[_0x59d5('0x3a')]=_[_0x59d5('0x3c')](_0x5e6d31[_0x59d5('0x3a')],{'$or':_[_0x59d5('0x29')](_0x5e6d31[_0x59d5('0x33')],function(_0xf118db){var _0x4c8ac2={};_0x4c8ac2[_0xf118db]={'$like':'%'+_0x12fceb['query'][_0x59d5('0x3f')]+'%'};return _0x4c8ac2;})});}_0x5e6d31=_[_0x59d5('0x3c')]({},_0x5e6d31,_0x12fceb['options']);return _0x3bfc3f['getDescriptions'](_0x5e6d31);}})[_0x59d5('0x23')](function(_0x228634){if(_0x228634){_0x4d0df1=_0x228634['length'];if(!_0x12fceb[_0x59d5('0x2e')][_0x59d5('0x36')](_0x59d5('0x37'))){_0x5e6d31[_0x59d5('0x1c')]=qs[_0x59d5('0x1c')](_0x12fceb[_0x59d5('0x2e')][_0x59d5('0x1c')]);_0x5e6d31[_0x59d5('0x1a')]=qs[_0x59d5('0x1a')](_0x12fceb[_0x59d5('0x2e')][_0x59d5('0x1a')]);}return _0x3bfc3f['getDescriptions'](_0x5e6d31);}})[_0x59d5('0x23')](function(_0x3da1c6){if(_0x3da1c6){return _0x3da1c6?{'count':_0x4d0df1,'rows':_0x3da1c6}:null;}})['then'](respondWithResult(_0x1ddfaf,null))[_0x59d5('0x49')](handleError(_0x1ddfaf,null));}; \ No newline at end of file +var _0xbdaa=['then','destroy','error','stack','name','send','map','SalesforceConfiguration','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','rows','params','rawAttributes','options','find','catch','create','body','getFields','pick','findOne','SalesforceField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbdaa,0x16f));var _0xabda=function(_0xf7b340,_0x5877b1){_0xf7b340=_0xf7b340-0x0;var _0x124440=_0xbdaa[_0xf7b340];return _0x124440;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xabda('0x0'));var zipdir=require(_0xabda('0x1'));var jsonpatch=require(_0xabda('0x2'));var rp=require(_0xabda('0x3'));var moment=require(_0xabda('0x4'));var BPromise=require(_0xabda('0x5'));var Mustache=require(_0xabda('0x6'));var util=require(_0xabda('0x7'));var path=require(_0xabda('0x8'));var sox=require(_0xabda('0x9'));var csv=require(_0xabda('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xabda('0xb'));var _=require('lodash');var squel=require(_0xabda('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xabda('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xabda('0xe'));var Redis=require(_0xabda('0xf'));var authService=require(_0xabda('0x10'));var qs=require(_0xabda('0x11'));var as=require(_0xabda('0x12'));var hardwareService=require(_0xabda('0x13'));var logger=require(_0xabda('0x14'))('api');var utils=require(_0xabda('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xabda('0x16'));var db=require(_0xabda('0x17'))['db'];function respondWithStatusCode(_0x10b4e2,_0x3a54dc){_0x3a54dc=_0x3a54dc||0xcc;return function(_0x5831db){if(_0x5831db){return _0x10b4e2[_0xabda('0x18')](_0x3a54dc);}return _0x10b4e2[_0xabda('0x19')](_0x3a54dc)[_0xabda('0x1a')]();};}function respondWithResult(_0x3fc661,_0x161d19){_0x161d19=_0x161d19||0xc8;return function(_0x658a04){if(_0x658a04){return _0x3fc661[_0xabda('0x19')](_0x161d19)[_0xabda('0x1b')](_0x658a04);}};}function respondWithFilteredResult(_0x2bf54f,_0x133087){return function(_0x309765){if(_0x309765){var _0x2d505b=typeof _0x133087[_0xabda('0x1c')]===_0xabda('0x1d')&&typeof _0x133087[_0xabda('0x1e')]==='undefined';var _0x503c8a=_0x309765[_0xabda('0x1f')];var _0x1a3c1c=_0x2d505b?0x0:_0x133087[_0xabda('0x1c')];var _0x45b997=_0x2d505b?_0x309765['count']:_0x133087['offset']+_0x133087[_0xabda('0x1e')];var _0x3ec4a0;if(_0x45b997>=_0x503c8a){_0x45b997=_0x503c8a;_0x3ec4a0=0xc8;}else{_0x3ec4a0=0xce;}_0x2bf54f[_0xabda('0x19')](_0x3ec4a0);return _0x2bf54f[_0xabda('0x20')](_0xabda('0x21'),_0x1a3c1c+'-'+_0x45b997+'/'+_0x503c8a)[_0xabda('0x1b')](_0x309765);}return null;};}function patchUpdates(_0x2862de){return function(_0x11a858){try{jsonpatch[_0xabda('0x22')](_0x11a858,_0x2862de,!![]);}catch(_0x35ea16){return BPromise[_0xabda('0x23')](_0x35ea16);}return _0x11a858[_0xabda('0x24')]();};}function saveUpdates(_0x5be169,_0x3cfb40){return function(_0x82ae6c){if(_0x82ae6c){return _0x82ae6c[_0xabda('0x25')](_0x5be169)[_0xabda('0x26')](function(_0x42d75a){return _0x42d75a;});}return null;};}function removeEntity(_0x5d62cd,_0x3f4012){return function(_0x496cde){if(_0x496cde){return _0x496cde[_0xabda('0x27')]()[_0xabda('0x26')](function(){_0x5d62cd[_0xabda('0x19')](0xcc)[_0xabda('0x1a')]();});}};}function handleEntityNotFound(_0x2dfc1b,_0x2a5db0){return function(_0xc44aed){if(!_0xc44aed){_0x2dfc1b['sendStatus'](0x194);}return _0xc44aed;};}function handleError(_0x3e3cc1,_0x127a0b){_0x127a0b=_0x127a0b||0x1f4;return function(_0x4993d0){logger[_0xabda('0x28')](_0x4993d0[_0xabda('0x29')]);if(_0x4993d0[_0xabda('0x2a')]){delete _0x4993d0['name'];}_0x3e3cc1[_0xabda('0x19')](_0x127a0b)[_0xabda('0x2b')](_0x4993d0);};}exports['index']=function(_0x5e0d11,_0x237ddb){var _0x31b0cd={},_0x536d3f={},_0x4e0393={'count':0x0,'rows':[]};var _0x1f5616=_[_0xabda('0x2c')](db[_0xabda('0x2d')]['rawAttributes'],function(_0x5b8d4a){return{'name':_0x5b8d4a[_0xabda('0x2e')],'type':_0x5b8d4a[_0xabda('0x2f')][_0xabda('0x30')]};});_0x536d3f[_0xabda('0x31')]=_[_0xabda('0x2c')](_0x1f5616,_0xabda('0x2a'));_0x536d3f['query']=_[_0xabda('0x32')](_0x5e0d11[_0xabda('0x33')]);_0x536d3f['filters']=_[_0xabda('0x34')](_0x536d3f[_0xabda('0x31')],_0x536d3f[_0xabda('0x33')]);_0x31b0cd[_0xabda('0x35')]=_[_0xabda('0x34')](_0x536d3f['model'],qs[_0xabda('0x36')](_0x5e0d11[_0xabda('0x33')][_0xabda('0x36')]));_0x31b0cd[_0xabda('0x35')]=_0x31b0cd[_0xabda('0x35')][_0xabda('0x37')]?_0x31b0cd['attributes']:_0x536d3f[_0xabda('0x31')];if(!_0x5e0d11[_0xabda('0x33')][_0xabda('0x38')](_0xabda('0x39'))){_0x31b0cd['limit']=qs['limit'](_0x5e0d11[_0xabda('0x33')][_0xabda('0x1e')]);_0x31b0cd[_0xabda('0x1c')]=qs[_0xabda('0x1c')](_0x5e0d11[_0xabda('0x33')]['offset']);}_0x31b0cd[_0xabda('0x3a')]=qs['sort'](_0x5e0d11[_0xabda('0x33')][_0xabda('0x3b')]);_0x31b0cd[_0xabda('0x3c')]=qs[_0xabda('0x3d')](_['pick'](_0x5e0d11[_0xabda('0x33')],_0x536d3f[_0xabda('0x3d')]),_0x1f5616);if(_0x5e0d11[_0xabda('0x33')]['filter']){_0x31b0cd['where']=_[_0xabda('0x3e')](_0x31b0cd[_0xabda('0x3c')],{'$or':_[_0xabda('0x2c')](_0x1f5616,function(_0x24b1ca){if(_0x24b1ca[_0xabda('0x2f')]!==_0xabda('0x3f')){var _0x563737={};_0x563737[_0x24b1ca[_0xabda('0x2a')]]={'$like':'%'+_0x5e0d11['query'][_0xabda('0x40')]+'%'};return _0x563737;}})});}_0x31b0cd=_[_0xabda('0x3e')]({},_0x31b0cd,_0x5e0d11['options']);var _0x3062bf={'where':_0x31b0cd['where']};return db[_0xabda('0x2d')][_0xabda('0x1f')](_0x3062bf)['then'](function(_0x2aefbb){_0x4e0393[_0xabda('0x1f')]=_0x2aefbb;if(_0x5e0d11['query'][_0xabda('0x41')]){_0x31b0cd[_0xabda('0x42')]=[{'all':!![]}];}return db[_0xabda('0x2d')]['findAll'](_0x31b0cd);})[_0xabda('0x26')](function(_0x52f347){_0x4e0393[_0xabda('0x43')]=_0x52f347;return _0x4e0393;})[_0xabda('0x26')](respondWithFilteredResult(_0x237ddb,_0x31b0cd))['catch'](handleError(_0x237ddb,null));};exports['show']=function(_0x17dba7,_0x452096){var _0x245430={'raw':![],'where':{'id':_0x17dba7[_0xabda('0x44')]['id']}},_0x51a691={};_0x51a691[_0xabda('0x31')]=_[_0xabda('0x32')](db[_0xabda('0x2d')][_0xabda('0x45')]);_0x51a691['query']=_['keys'](_0x17dba7['query']);_0x51a691[_0xabda('0x3d')]=_[_0xabda('0x34')](_0x51a691[_0xabda('0x31')],_0x51a691['query']);_0x245430[_0xabda('0x35')]=_[_0xabda('0x34')](_0x51a691['model'],qs[_0xabda('0x36')](_0x17dba7['query'][_0xabda('0x36')]));_0x245430[_0xabda('0x35')]=_0x245430[_0xabda('0x35')][_0xabda('0x37')]?_0x245430[_0xabda('0x35')]:_0x51a691[_0xabda('0x31')];if(_0x17dba7[_0xabda('0x33')]['includeAll']){_0x245430[_0xabda('0x42')]=[{'all':!![]}];}_0x245430=_['merge']({},_0x245430,_0x17dba7[_0xabda('0x46')]);return db[_0xabda('0x2d')][_0xabda('0x47')](_0x245430)[_0xabda('0x26')](handleEntityNotFound(_0x452096,null))['then'](respondWithResult(_0x452096,null))[_0xabda('0x48')](handleError(_0x452096,null));};exports[_0xabda('0x49')]=function(_0x2fcbbc,_0x41fea8){return db[_0xabda('0x2d')][_0xabda('0x49')](_0x2fcbbc[_0xabda('0x4a')],{})[_0xabda('0x26')](respondWithResult(_0x41fea8,0xc9))[_0xabda('0x48')](handleError(_0x41fea8,null));};exports[_0xabda('0x25')]=function(_0x5c8e10,_0x378921){if(_0x5c8e10['body']['id']){delete _0x5c8e10[_0xabda('0x4a')]['id'];}return db[_0xabda('0x2d')][_0xabda('0x47')]({'where':{'id':_0x5c8e10[_0xabda('0x44')]['id']}})[_0xabda('0x26')](handleEntityNotFound(_0x378921,null))[_0xabda('0x26')](saveUpdates(_0x5c8e10[_0xabda('0x4a')],null))[_0xabda('0x26')](respondWithResult(_0x378921,null))[_0xabda('0x48')](handleError(_0x378921,null));};exports[_0xabda('0x27')]=function(_0xa19d52,_0x230fec){return db[_0xabda('0x2d')][_0xabda('0x47')]({'where':{'id':_0xa19d52[_0xabda('0x44')]['id']}})[_0xabda('0x26')](handleEntityNotFound(_0x230fec,null))[_0xabda('0x26')](removeEntity(_0x230fec,null))[_0xabda('0x48')](handleError(_0x230fec,null));};exports[_0xabda('0x4b')]=function(_0x5080e6,_0x5bfc05,_0x6eebfc){var _0x157da3={};var _0x3ac61e={};var _0x2c88fc;var _0xc9bafb;return db[_0xabda('0x2d')]['findOne']({'where':{'id':_0x5080e6[_0xabda('0x44')]['id']}})[_0xabda('0x26')](handleEntityNotFound(_0x5bfc05,null))['then'](function(_0x560fd4){if(_0x560fd4){_0x2c88fc=_0x560fd4;_0x3ac61e['model']=_['keys'](db['SalesforceField'][_0xabda('0x45')]);_0x3ac61e[_0xabda('0x33')]=_[_0xabda('0x32')](_0x5080e6['query']);_0x3ac61e[_0xabda('0x3d')]=_[_0xabda('0x34')](_0x3ac61e[_0xabda('0x31')],_0x3ac61e[_0xabda('0x33')]);_0x157da3[_0xabda('0x35')]=_[_0xabda('0x34')](_0x3ac61e[_0xabda('0x31')],qs['fields'](_0x5080e6[_0xabda('0x33')][_0xabda('0x36')]));_0x157da3['attributes']=_0x157da3[_0xabda('0x35')]['length']?_0x157da3['attributes']:_0x3ac61e[_0xabda('0x31')];_0x157da3[_0xabda('0x3a')]=qs['sort'](_0x5080e6[_0xabda('0x33')][_0xabda('0x3b')]);_0x157da3[_0xabda('0x3c')]=qs['filters'](_[_0xabda('0x4c')](_0x5080e6[_0xabda('0x33')],_0x3ac61e[_0xabda('0x3d')]));if(_0x5080e6[_0xabda('0x33')][_0xabda('0x40')]){_0x157da3['where']=_[_0xabda('0x3e')](_0x157da3['where'],{'$or':_['map'](_0x157da3[_0xabda('0x35')],function(_0x4e8745){var _0x331e3e={};_0x331e3e[_0x4e8745]={'$like':'%'+_0x5080e6[_0xabda('0x33')]['filter']+'%'};return _0x331e3e;})});}_0x157da3=_['merge']({},_0x157da3,_0x5080e6[_0xabda('0x46')]);return _0x2c88fc[_0xabda('0x4b')](_0x157da3);}})['then'](function(_0xffaa72){if(_0xffaa72){_0xc9bafb=_0xffaa72[_0xabda('0x37')];if(!_0x5080e6['query']['hasOwnProperty'](_0xabda('0x39'))){_0x157da3[_0xabda('0x1e')]=qs['limit'](_0x5080e6[_0xabda('0x33')][_0xabda('0x1e')]);_0x157da3['offset']=qs['offset'](_0x5080e6[_0xabda('0x33')]['offset']);}return _0x2c88fc[_0xabda('0x4b')](_0x157da3);}})['then'](function(_0x202760){if(_0x202760){return _0x202760?{'count':_0xc9bafb,'rows':_0x202760}:null;}})[_0xabda('0x26')](respondWithResult(_0x5bfc05,null))[_0xabda('0x48')](handleError(_0x5bfc05,null));};exports['getSubjects']=function(_0x28f5d0,_0x12872d,_0x135d4c){var _0x34a99c={};var _0x371dec={};var _0x6427c4;var _0x140468;return db[_0xabda('0x2d')][_0xabda('0x4d')]({'where':{'id':_0x28f5d0[_0xabda('0x44')]['id']}})[_0xabda('0x26')](handleEntityNotFound(_0x12872d,null))[_0xabda('0x26')](function(_0x43eb82){if(_0x43eb82){_0x6427c4=_0x43eb82;_0x371dec[_0xabda('0x31')]=_['keys'](db[_0xabda('0x4e')][_0xabda('0x45')]);_0x371dec[_0xabda('0x33')]=_[_0xabda('0x32')](_0x28f5d0['query']);_0x371dec[_0xabda('0x3d')]=_[_0xabda('0x34')](_0x371dec[_0xabda('0x31')],_0x371dec[_0xabda('0x33')]);_0x34a99c[_0xabda('0x35')]=_[_0xabda('0x34')](_0x371dec[_0xabda('0x31')],qs[_0xabda('0x36')](_0x28f5d0[_0xabda('0x33')][_0xabda('0x36')]));_0x34a99c[_0xabda('0x35')]=_0x34a99c[_0xabda('0x35')][_0xabda('0x37')]?_0x34a99c[_0xabda('0x35')]:_0x371dec[_0xabda('0x31')];_0x34a99c['order']=qs[_0xabda('0x3b')](_0x28f5d0[_0xabda('0x33')][_0xabda('0x3b')]);_0x34a99c[_0xabda('0x3c')]=qs[_0xabda('0x3d')](_['pick'](_0x28f5d0[_0xabda('0x33')],_0x371dec[_0xabda('0x3d')]));if(_0x28f5d0[_0xabda('0x33')][_0xabda('0x40')]){_0x34a99c['where']=_[_0xabda('0x3e')](_0x34a99c[_0xabda('0x3c')],{'$or':_[_0xabda('0x2c')](_0x34a99c[_0xabda('0x35')],function(_0x362314){var _0x8df818={};_0x8df818[_0x362314]={'$like':'%'+_0x28f5d0[_0xabda('0x33')][_0xabda('0x40')]+'%'};return _0x8df818;})});}_0x34a99c=_[_0xabda('0x3e')]({},_0x34a99c,_0x28f5d0['options']);return _0x6427c4[_0xabda('0x4f')](_0x34a99c);}})[_0xabda('0x26')](function(_0x4211cf){if(_0x4211cf){_0x140468=_0x4211cf['length'];if(!_0x28f5d0[_0xabda('0x33')][_0xabda('0x38')](_0xabda('0x39'))){_0x34a99c[_0xabda('0x1e')]=qs['limit'](_0x28f5d0['query'][_0xabda('0x1e')]);_0x34a99c[_0xabda('0x1c')]=qs['offset'](_0x28f5d0['query'][_0xabda('0x1c')]);}return _0x6427c4[_0xabda('0x4f')](_0x34a99c);}})[_0xabda('0x26')](function(_0x467c53){if(_0x467c53){return _0x467c53?{'count':_0x140468,'rows':_0x467c53}:null;}})[_0xabda('0x26')](respondWithResult(_0x12872d,null))[_0xabda('0x48')](handleError(_0x12872d,null));};exports['getDescriptions']=function(_0x464a0b,_0x42865b,_0x5ef4af){var _0x4ae82a={};var _0x4e5dc4={};var _0x1fc0d8;var _0x351daf;return db[_0xabda('0x2d')][_0xabda('0x4d')]({'where':{'id':_0x464a0b[_0xabda('0x44')]['id']}})[_0xabda('0x26')](handleEntityNotFound(_0x42865b,null))[_0xabda('0x26')](function(_0x4cc750){if(_0x4cc750){_0x1fc0d8=_0x4cc750;_0x4e5dc4[_0xabda('0x31')]=_[_0xabda('0x32')](db[_0xabda('0x4e')]['rawAttributes']);_0x4e5dc4[_0xabda('0x33')]=_[_0xabda('0x32')](_0x464a0b[_0xabda('0x33')]);_0x4e5dc4[_0xabda('0x3d')]=_[_0xabda('0x34')](_0x4e5dc4['model'],_0x4e5dc4[_0xabda('0x33')]);_0x4ae82a[_0xabda('0x35')]=_[_0xabda('0x34')](_0x4e5dc4['model'],qs['fields'](_0x464a0b[_0xabda('0x33')][_0xabda('0x36')]));_0x4ae82a[_0xabda('0x35')]=_0x4ae82a[_0xabda('0x35')][_0xabda('0x37')]?_0x4ae82a['attributes']:_0x4e5dc4['model'];_0x4ae82a['order']=qs['sort'](_0x464a0b[_0xabda('0x33')][_0xabda('0x3b')]);_0x4ae82a[_0xabda('0x3c')]=qs[_0xabda('0x3d')](_[_0xabda('0x4c')](_0x464a0b['query'],_0x4e5dc4[_0xabda('0x3d')]));if(_0x464a0b['query'][_0xabda('0x40')]){_0x4ae82a['where']=_[_0xabda('0x3e')](_0x4ae82a['where'],{'$or':_['map'](_0x4ae82a['attributes'],function(_0x5eb572){var _0x2a6c86={};_0x2a6c86[_0x5eb572]={'$like':'%'+_0x464a0b[_0xabda('0x33')][_0xabda('0x40')]+'%'};return _0x2a6c86;})});}_0x4ae82a=_['merge']({},_0x4ae82a,_0x464a0b['options']);return _0x1fc0d8[_0xabda('0x50')](_0x4ae82a);}})[_0xabda('0x26')](function(_0x57a822){if(_0x57a822){_0x351daf=_0x57a822[_0xabda('0x37')];if(!_0x464a0b[_0xabda('0x33')][_0xabda('0x38')](_0xabda('0x39'))){_0x4ae82a[_0xabda('0x1e')]=qs[_0xabda('0x1e')](_0x464a0b[_0xabda('0x33')][_0xabda('0x1e')]);_0x4ae82a[_0xabda('0x1c')]=qs[_0xabda('0x1c')](_0x464a0b[_0xabda('0x33')]['offset']);}return _0x1fc0d8[_0xabda('0x50')](_0x4ae82a);}})[_0xabda('0x26')](function(_0x373644){if(_0x373644){return _0x373644?{'count':_0x351daf,'rows':_0x373644}:null;}})[_0xabda('0x26')](respondWithResult(_0x42865b,null))['catch'](handleError(_0x42865b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index b39a364..dd3ae9a 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 _0xd698=['path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5d0609,_0x127562){var _0xaa3fd1=function(_0x47f457){while(--_0x47f457){_0x5d0609['push'](_0x5d0609['shift']());}};_0xaa3fd1(++_0x127562);}(_0xd698,0xc9));var _0x8d69=function(_0x31bcfb,_0x2e5d62){_0x31bcfb=_0x31bcfb-0x0;var _0x3cac13=_0xd698[_0x31bcfb];return _0x3cac13;};'use strict';var _=require(_0x8d69('0x0'));var util=require(_0x8d69('0x1'));var logger=require(_0x8d69('0x2'))(_0x8d69('0x3'));var moment=require(_0x8d69('0x4'));var BPromise=require(_0x8d69('0x5'));var rp=require(_0x8d69('0x6'));var fs=require('fs');var path=require(_0x8d69('0x7'));var rimraf=require(_0x8d69('0x8'));var config=require(_0x8d69('0x9'));var attributes=require(_0x8d69('0xa'));module['exports']=function(_0x1c6268,_0x247814){return _0x1c6268['define'](_0x8d69('0xb'),attributes,{'tableName':_0x8d69('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d39=['exports','define','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes'];(function(_0x471f2f,_0x5d5d3f){var _0x161e92=function(_0x31ec9e){while(--_0x31ec9e){_0x471f2f['push'](_0x471f2f['shift']());}};_0x161e92(++_0x5d5d3f);}(_0x6d39,0x12f));var _0x96d3=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x6d39[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require(_0x96d3('0x0'));var logger=require(_0x96d3('0x1'))(_0x96d3('0x2'));var moment=require(_0x96d3('0x3'));var BPromise=require(_0x96d3('0x4'));var rp=require(_0x96d3('0x5'));var fs=require('fs');var path=require(_0x96d3('0x6'));var rimraf=require(_0x96d3('0x7'));var config=require('../../config/environment');var attributes=require(_0x96d3('0x8'));module[_0x96d3('0x9')]=function(_0x348bb3,_0x11975d){return _0x348bb3[_0x96d3('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0x96d3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 5270b67..fffced6 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 _0x74dd=['util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x74dd,0x164));var _0xd74d=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0x74dd[_0x358806];return _0x19fdcb;};'use strict';var _=require(_0xd74d('0x0'));var util=require(_0xd74d('0x1'));var moment=require(_0xd74d('0x2'));var BPromise=require(_0xd74d('0x3'));var rs=require(_0xd74d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd74d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd74d('0x6'));var jayson=require(_0xd74d('0x7'));var client=jayson[_0xd74d('0x8')][_0xd74d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19d8d1,_0x43d8d0,_0x4ba41a){return new BPromise(function(_0x4706ae,_0x2bbecc){return client[_0xd74d('0xa')](_0x19d8d1,_0x4ba41a)[_0xd74d('0xb')](function(_0x1a1391){logger[_0xd74d('0xc')](_0xd74d('0xd'),_0x43d8d0,_0xd74d('0xe'));logger[_0xd74d('0xf')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x43d8d0,_0xd74d('0xe'),JSON[_0xd74d('0x10')](_0x1a1391));if(_0x1a1391[_0xd74d('0x11')]){if(_0x1a1391[_0xd74d('0x11')][_0xd74d('0x12')]===0x1f4){logger[_0xd74d('0x11')](_0xd74d('0xd'),_0x43d8d0,_0x1a1391['error'][_0xd74d('0x13')]);return _0x2bbecc(_0x1a1391[_0xd74d('0x11')][_0xd74d('0x13')]);}logger[_0xd74d('0x11')](_0xd74d('0xd'),_0x43d8d0,_0x1a1391[_0xd74d('0x11')]['message']);return _0x4706ae(_0x1a1391[_0xd74d('0x11')][_0xd74d('0x13')]);}else{logger[_0xd74d('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x43d8d0,_0xd74d('0xe'));_0x4706ae(_0x1a1391['result'][_0xd74d('0x13')]);}})[_0xd74d('0x14')](function(_0x5f551){logger[_0xd74d('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x43d8d0,_0x5f551);_0x2bbecc(_0x5f551);});});} \ No newline at end of file +var _0x12ca=['then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2c9ee8,_0x551fd5){var _0x5c0a6a=function(_0x357720){while(--_0x357720){_0x2c9ee8['push'](_0x2c9ee8['shift']());}};_0x5c0a6a(++_0x551fd5);}(_0x12ca,0x9c));var _0xa12c=function(_0x198480,_0x574b93){_0x198480=_0x198480-0x0;var _0x58dff5=_0x12ca[_0x198480];return _0x58dff5;};'use strict';var _=require(_0xa12c('0x0'));var util=require(_0xa12c('0x1'));var moment=require('moment');var BPromise=require(_0xa12c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa12c('0x3'))['db'];var utils=require(_0xa12c('0x4'));var logger=require(_0xa12c('0x5'))(_0xa12c('0x6'));var config=require(_0xa12c('0x7'));var jayson=require(_0xa12c('0x8'));var client=jayson[_0xa12c('0x9')][_0xa12c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfc8278,_0x4f5f2c,_0x5b1932){return new BPromise(function(_0x1ca945,_0x352f47){return client[_0xa12c('0xb')](_0xfc8278,_0x5b1932)[_0xa12c('0xc')](function(_0x3fb1fe){logger[_0xa12c('0xd')](_0xa12c('0xe'),_0x4f5f2c,_0xa12c('0xf'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x4f5f2c,_0xa12c('0xf'),JSON['stringify'](_0x3fb1fe));if(_0x3fb1fe[_0xa12c('0x10')]){if(_0x3fb1fe['error'][_0xa12c('0x11')]===0x1f4){logger[_0xa12c('0x10')](_0xa12c('0xe'),_0x4f5f2c,_0x3fb1fe['error'][_0xa12c('0x12')]);return _0x352f47(_0x3fb1fe[_0xa12c('0x10')]['message']);}logger[_0xa12c('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4f5f2c,_0x3fb1fe['error']['message']);return _0x1ca945(_0x3fb1fe[_0xa12c('0x10')][_0xa12c('0x12')]);}else{logger[_0xa12c('0xd')](_0xa12c('0xe'),_0x4f5f2c,_0xa12c('0xf'));_0x1ca945(_0x3fb1fe[_0xa12c('0x13')]['message']);}})[_0xa12c('0x14')](function(_0x39d8da){logger[_0xa12c('0x10')](_0xa12c('0xe'),_0x4f5f2c,_0x39d8da);_0x352f47(_0x39d8da);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 206b16a..c171bb4 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 _0x15db=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','/:id','post','create','put','isAuthenticated','destroy','exports','multer','connect-timeout'];(function(_0x4a1fef,_0x5b3eb6){var _0x2286e0=function(_0x51dcbf){while(--_0x51dcbf){_0x4a1fef['push'](_0x4a1fef['shift']());}};_0x2286e0(++_0x5b3eb6);}(_0x15db,0x9e));var _0xb15d=function(_0x4e9f9b,_0x4b6116){_0x4e9f9b=_0x4e9f9b-0x0;var _0x4a77d1=_0x15db[_0x4e9f9b];return _0x4a77d1;};'use strict';var multer=require(_0xb15d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb15d('0x1'));var express=require(_0xb15d('0x2'));var router=express[_0xb15d('0x3')]();var fs_extra=require(_0xb15d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb15d('0x5'));var config=require(_0xb15d('0x6'));var controller=require(_0xb15d('0x7'));router[_0xb15d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb15d('0x8')](_0xb15d('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xb15d('0xa')]('/',auth['isAuthenticated'](),controller[_0xb15d('0xb')]);router[_0xb15d('0xc')](_0xb15d('0x9'),auth[_0xb15d('0xd')](),controller['update']);router['delete'](_0xb15d('0x9'),auth['isAuthenticated'](),controller[_0xb15d('0xe')]);module[_0xb15d('0xf')]=router; \ No newline at end of file +var _0x00ee=['get','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x17b98a,_0x49b017){var _0x5c62eb=function(_0xc17454){while(--_0xc17454){_0x17b98a['push'](_0x17b98a['shift']());}};_0x5c62eb(++_0x49b017);}(_0x00ee,0xe2));var _0xe00e=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0x00ee[_0x1aba25];return _0x47d997;};'use strict';var multer=require(_0xe00e('0x0'));var util=require(_0xe00e('0x1'));var path=require(_0xe00e('0x2'));var timeout=require(_0xe00e('0x3'));var express=require('express');var router=express[_0xe00e('0x4')]();var fs_extra=require(_0xe00e('0x5'));var auth=require(_0xe00e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe00e('0x7'));var controller=require('./intSalesforceField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe00e('0x8')]('/:id',auth[_0xe00e('0x9')](),controller[_0xe00e('0xa')]);router[_0xe00e('0xb')]('/',auth['isAuthenticated'](),controller[_0xe00e('0xc')]);router[_0xe00e('0xd')](_0xe00e('0xe'),auth[_0xe00e('0x9')](),controller['update']);router[_0xe00e('0xf')](_0xe00e('0xe'),auth[_0xe00e('0x9')](),controller[_0xe00e('0x10')]);module[_0xe00e('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index edd59db..57d3125 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 _0xdfa8=['STRING','variable','exports','ENUM','string','customVariable','picklist'];(function(_0xadde88,_0x58ad47){var _0x3b8eb6=function(_0x15535a){while(--_0x15535a){_0xadde88['push'](_0xadde88['shift']());}};_0x3b8eb6(++_0x58ad47);}(_0xdfa8,0x79));var _0x8dfa=function(_0x4de002,_0x157410){_0x4de002=_0x4de002-0x0;var _0x577285=_0xdfa8[_0x4de002];return _0x577285;};'use strict';var Sequelize=require('sequelize');module[_0x8dfa('0x0')]={'type':{'type':Sequelize[_0x8dfa('0x1')](_0x8dfa('0x2'),'variable',_0x8dfa('0x3'),'keyValue',_0x8dfa('0x4')),'defaultValue':_0x8dfa('0x2')},'content':{'type':Sequelize[_0x8dfa('0x5')]},'key':{'type':Sequelize[_0x8dfa('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x8dfa('0x2'),_0x8dfa('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x8dfa('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x8dfa('0x5')]}}; \ No newline at end of file +var _0xea26=['ENUM','string','customVariable','picklist','STRING','variable','sequelize','exports'];(function(_0x555503,_0x36e3e7){var _0x2c258e=function(_0xd3dd11){while(--_0xd3dd11){_0x555503['push'](_0x555503['shift']());}};_0x2c258e(++_0x36e3e7);}(_0xea26,0x16e));var _0x6ea2=function(_0x1c039a,_0x49d513){_0x1c039a=_0x1c039a-0x0;var _0x5249ae=_0xea26[_0x1c039a];return _0x5249ae;};'use strict';var Sequelize=require(_0x6ea2('0x0'));module[_0x6ea2('0x1')]={'type':{'type':Sequelize[_0x6ea2('0x2')](_0x6ea2('0x3'),'variable',_0x6ea2('0x4'),'keyValue',_0x6ea2('0x5')),'defaultValue':_0x6ea2('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6ea2('0x6')]},'keyType':{'type':Sequelize[_0x6ea2('0x2')](_0x6ea2('0x3'),_0x6ea2('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x6ea2('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x6ea2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 043767a..fdcdfb2 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 _0x41ca=['sort','where','filters','pick','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','request-promise','moment','mustache','util','to-csv','lodash','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','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','map','SalesforceField','rawAttributes','fieldName','type','query','keys','attributes','intersection','model','fields','length','nolimit','order'];(function(_0x28578d,_0xcf5cf0){var _0x524826=function(_0x4a51b7){while(--_0x4a51b7){_0x28578d['push'](_0x28578d['shift']());}};_0x524826(++_0xcf5cf0);}(_0x41ca,0xe2));var _0xa41c=function(_0xf6b2b8,_0xbfe716){_0xf6b2b8=_0xf6b2b8-0x0;var _0xc0a21a=_0x41ca[_0xf6b2b8];return _0xc0a21a;};'use strict';var emlformat=require(_0xa41c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa41c('0x1'));var moment=require(_0xa41c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa41c('0x3'));var util=require(_0xa41c('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xa41c('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa41c('0x6'));var squel=require('squel');var crypto=require(_0xa41c('0x7'));var jsforce=require(_0xa41c('0x8'));var deskjs=require(_0xa41c('0x9'));var toCsv=require(_0xa41c('0x5'));var querystring=require(_0xa41c('0xa'));var Papa=require('papaparse');var Redis=require(_0xa41c('0xb'));var authService=require(_0xa41c('0xc'));var qs=require(_0xa41c('0xd'));var as=require(_0xa41c('0xe'));var hardwareService=require(_0xa41c('0xf'));var logger=require(_0xa41c('0x10'))(_0xa41c('0x11'));var utils=require(_0xa41c('0x12'));var config=require(_0xa41c('0x13'));var licenseUtil=require(_0xa41c('0x14'));var db=require(_0xa41c('0x15'))['db'];function respondWithStatusCode(_0x2badd5,_0x3dda96){_0x3dda96=_0x3dda96||0xcc;return function(_0x3cbc3b){if(_0x3cbc3b){return _0x2badd5[_0xa41c('0x16')](_0x3dda96);}return _0x2badd5[_0xa41c('0x17')](_0x3dda96)[_0xa41c('0x18')]();};}function respondWithResult(_0x1d1d3d,_0x1f3de2){_0x1f3de2=_0x1f3de2||0xc8;return function(_0x5b00ab){if(_0x5b00ab){return _0x1d1d3d[_0xa41c('0x17')](_0x1f3de2)[_0xa41c('0x19')](_0x5b00ab);}};}function respondWithFilteredResult(_0x3c7605,_0x44c7de){return function(_0x3f4411){if(_0x3f4411){var _0x964d78=typeof _0x44c7de['offset']===_0xa41c('0x1a')&&typeof _0x44c7de[_0xa41c('0x1b')]===_0xa41c('0x1a');var _0x4c93cd=_0x3f4411[_0xa41c('0x1c')];var _0x28c7dd=_0x964d78?0x0:_0x44c7de[_0xa41c('0x1d')];var _0x2e80f4=_0x964d78?_0x3f4411['count']:_0x44c7de[_0xa41c('0x1d')]+_0x44c7de[_0xa41c('0x1b')];var _0x13a3a0;if(_0x2e80f4>=_0x4c93cd){_0x2e80f4=_0x4c93cd;_0x13a3a0=0xc8;}else{_0x13a3a0=0xce;}_0x3c7605[_0xa41c('0x17')](_0x13a3a0);return _0x3c7605[_0xa41c('0x1e')](_0xa41c('0x1f'),_0x28c7dd+'-'+_0x2e80f4+'/'+_0x4c93cd)[_0xa41c('0x19')](_0x3f4411);}return null;};}function patchUpdates(_0x2a06af){return function(_0x33791b){try{jsonpatch[_0xa41c('0x20')](_0x33791b,_0x2a06af,!![]);}catch(_0xaa1d77){return BPromise[_0xa41c('0x21')](_0xaa1d77);}return _0x33791b['save']();};}function saveUpdates(_0x5e56e5,_0x2871c7){return function(_0x23567d){if(_0x23567d){return _0x23567d[_0xa41c('0x22')](_0x5e56e5)['then'](function(_0x4f6051){return _0x4f6051;});}return null;};}function removeEntity(_0xc76eb4,_0x53210b){return function(_0x44e109){if(_0x44e109){return _0x44e109[_0xa41c('0x23')]()[_0xa41c('0x24')](function(){_0xc76eb4[_0xa41c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32eb80,_0x4912d2){return function(_0x380d8f){if(!_0x380d8f){_0x32eb80['sendStatus'](0x194);}return _0x380d8f;};}function handleError(_0x188a21,_0x3056c8){_0x3056c8=_0x3056c8||0x1f4;return function(_0x2779ae){logger['error'](_0x2779ae[_0xa41c('0x25')]);if(_0x2779ae[_0xa41c('0x26')]){delete _0x2779ae[_0xa41c('0x26')];}_0x188a21[_0xa41c('0x17')](_0x3056c8)[_0xa41c('0x27')](_0x2779ae);};}exports['index']=function(_0x175135,_0x368e1a){var _0x1b57da={},_0x4bb43e={},_0x1a77e5={'count':0x0,'rows':[]};var _0x44528c=_[_0xa41c('0x28')](db[_0xa41c('0x29')][_0xa41c('0x2a')],function(_0xbe180b){return{'name':_0xbe180b[_0xa41c('0x2b')],'type':_0xbe180b[_0xa41c('0x2c')]['key']};});_0x4bb43e['model']=_['map'](_0x44528c,_0xa41c('0x26'));_0x4bb43e[_0xa41c('0x2d')]=_[_0xa41c('0x2e')](_0x175135['query']);_0x4bb43e['filters']=_['intersection'](_0x4bb43e['model'],_0x4bb43e[_0xa41c('0x2d')]);_0x1b57da[_0xa41c('0x2f')]=_[_0xa41c('0x30')](_0x4bb43e[_0xa41c('0x31')],qs['fields'](_0x175135[_0xa41c('0x2d')][_0xa41c('0x32')]));_0x1b57da[_0xa41c('0x2f')]=_0x1b57da['attributes'][_0xa41c('0x33')]?_0x1b57da[_0xa41c('0x2f')]:_0x4bb43e[_0xa41c('0x31')];if(!_0x175135[_0xa41c('0x2d')]['hasOwnProperty'](_0xa41c('0x34'))){_0x1b57da[_0xa41c('0x1b')]=qs[_0xa41c('0x1b')](_0x175135['query']['limit']);_0x1b57da[_0xa41c('0x1d')]=qs[_0xa41c('0x1d')](_0x175135[_0xa41c('0x2d')][_0xa41c('0x1d')]);}_0x1b57da[_0xa41c('0x35')]=qs[_0xa41c('0x36')](_0x175135['query'][_0xa41c('0x36')]);_0x1b57da[_0xa41c('0x37')]=qs[_0xa41c('0x38')](_[_0xa41c('0x39')](_0x175135[_0xa41c('0x2d')],_0x4bb43e[_0xa41c('0x38')]),_0x44528c);if(_0x175135['query']['filter']){_0x1b57da[_0xa41c('0x37')]=_[_0xa41c('0x3a')](_0x1b57da[_0xa41c('0x37')],{'$or':_[_0xa41c('0x28')](_0x44528c,function(_0x3b4d3f){if(_0x3b4d3f['type']!=='VIRTUAL'){var _0x54c3d4={};_0x54c3d4[_0x3b4d3f[_0xa41c('0x26')]]={'$like':'%'+_0x175135[_0xa41c('0x2d')]['filter']+'%'};return _0x54c3d4;}})});}_0x1b57da=_[_0xa41c('0x3a')]({},_0x1b57da,_0x175135['options']);var _0x1045af={'where':_0x1b57da[_0xa41c('0x37')]};return db[_0xa41c('0x29')][_0xa41c('0x1c')](_0x1045af)[_0xa41c('0x24')](function(_0x1402f9){_0x1a77e5['count']=_0x1402f9;if(_0x175135['query'][_0xa41c('0x3b')]){_0x1b57da[_0xa41c('0x3c')]=[{'all':!![]}];}return db[_0xa41c('0x29')][_0xa41c('0x3d')](_0x1b57da);})[_0xa41c('0x24')](function(_0xb0ab5){_0x1a77e5[_0xa41c('0x3e')]=_0xb0ab5;return _0x1a77e5;})['then'](respondWithFilteredResult(_0x368e1a,_0x1b57da))[_0xa41c('0x3f')](handleError(_0x368e1a,null));};exports[_0xa41c('0x40')]=function(_0x3bcea5,_0x154fa4){var _0x11d4dd={'raw':!![],'where':{'id':_0x3bcea5[_0xa41c('0x41')]['id']}},_0x587a91={};_0x587a91['model']=_[_0xa41c('0x2e')](db[_0xa41c('0x29')][_0xa41c('0x2a')]);_0x587a91['query']=_[_0xa41c('0x2e')](_0x3bcea5[_0xa41c('0x2d')]);_0x587a91['filters']=_[_0xa41c('0x30')](_0x587a91[_0xa41c('0x31')],_0x587a91[_0xa41c('0x2d')]);_0x11d4dd[_0xa41c('0x2f')]=_[_0xa41c('0x30')](_0x587a91['model'],qs[_0xa41c('0x32')](_0x3bcea5[_0xa41c('0x2d')][_0xa41c('0x32')]));_0x11d4dd[_0xa41c('0x2f')]=_0x11d4dd[_0xa41c('0x2f')][_0xa41c('0x33')]?_0x11d4dd[_0xa41c('0x2f')]:_0x587a91[_0xa41c('0x31')];if(_0x3bcea5['query'][_0xa41c('0x3b')]){_0x11d4dd['include']=[{'all':!![]}];}_0x11d4dd=_[_0xa41c('0x3a')]({},_0x11d4dd,_0x3bcea5[_0xa41c('0x42')]);return db[_0xa41c('0x29')][_0xa41c('0x43')](_0x11d4dd)[_0xa41c('0x24')](handleEntityNotFound(_0x154fa4,null))[_0xa41c('0x24')](respondWithResult(_0x154fa4,null))[_0xa41c('0x3f')](handleError(_0x154fa4,null));};exports[_0xa41c('0x44')]=function(_0x2b76be,_0x2f236d){return db[_0xa41c('0x29')][_0xa41c('0x44')](_0x2b76be['body'],{})[_0xa41c('0x24')](respondWithResult(_0x2f236d,0xc9))[_0xa41c('0x3f')](handleError(_0x2f236d,null));};exports[_0xa41c('0x22')]=function(_0x49e687,_0x3f7f62){if(_0x49e687[_0xa41c('0x45')]['id']){delete _0x49e687[_0xa41c('0x45')]['id'];}return db['SalesforceField'][_0xa41c('0x43')]({'where':{'id':_0x49e687['params']['id']}})[_0xa41c('0x24')](handleEntityNotFound(_0x3f7f62,null))['then'](saveUpdates(_0x49e687[_0xa41c('0x45')],null))[_0xa41c('0x24')](respondWithResult(_0x3f7f62,null))[_0xa41c('0x3f')](handleError(_0x3f7f62,null));};exports[_0xa41c('0x23')]=function(_0x2b1a7c,_0x108597){return db[_0xa41c('0x29')][_0xa41c('0x43')]({'where':{'id':_0x2b1a7c[_0xa41c('0x41')]['id']}})[_0xa41c('0x24')](handleEntityNotFound(_0x108597,null))[_0xa41c('0x24')](removeEntity(_0x108597,null))[_0xa41c('0x3f')](handleError(_0x108597,null));}; \ No newline at end of file +var _0x1540=['params','length','include','catch','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','map','SalesforceField','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x1b4e76,_0x17942c){var _0x5e64e3=function(_0x3e4799){while(--_0x3e4799){_0x1b4e76['push'](_0x1b4e76['shift']());}};_0x5e64e3(++_0x17942c);}(_0x1540,0x1c4));var _0x0154=function(_0x8438b5,_0x2190ac){_0x8438b5=_0x8438b5-0x0;var _0x1e16d3=_0x1540[_0x8438b5];return _0x1e16d3;};'use strict';var emlformat=require(_0x0154('0x0'));var rimraf=require(_0x0154('0x1'));var zipdir=require(_0x0154('0x2'));var jsonpatch=require(_0x0154('0x3'));var rp=require(_0x0154('0x4'));var moment=require(_0x0154('0x5'));var BPromise=require(_0x0154('0x6'));var Mustache=require(_0x0154('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0154('0x8'));var csv=require(_0x0154('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0154('0xa'));var _=require(_0x0154('0xb'));var squel=require(_0x0154('0xc'));var crypto=require(_0x0154('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0154('0x9'));var querystring=require(_0x0154('0xe'));var Papa=require('papaparse');var Redis=require(_0x0154('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0154('0x10'));var as=require(_0x0154('0x11'));var hardwareService=require(_0x0154('0x12'));var logger=require(_0x0154('0x13'))('api');var utils=require(_0x0154('0x14'));var config=require(_0x0154('0x15'));var licenseUtil=require(_0x0154('0x16'));var db=require(_0x0154('0x17'))['db'];function respondWithStatusCode(_0x449842,_0x84df67){_0x84df67=_0x84df67||0xcc;return function(_0x48ac2d){if(_0x48ac2d){return _0x449842[_0x0154('0x18')](_0x84df67);}return _0x449842['status'](_0x84df67)[_0x0154('0x19')]();};}function respondWithResult(_0x18b21a,_0x4360ce){_0x4360ce=_0x4360ce||0xc8;return function(_0x5df349){if(_0x5df349){return _0x18b21a['status'](_0x4360ce)[_0x0154('0x1a')](_0x5df349);}};}function respondWithFilteredResult(_0x45e7f2,_0x2055be){return function(_0x104628){if(_0x104628){var _0x78072c=typeof _0x2055be[_0x0154('0x1b')]===_0x0154('0x1c')&&typeof _0x2055be[_0x0154('0x1d')]===_0x0154('0x1c');var _0x541dad=_0x104628[_0x0154('0x1e')];var _0x129364=_0x78072c?0x0:_0x2055be[_0x0154('0x1b')];var _0x1e01d2=_0x78072c?_0x104628[_0x0154('0x1e')]:_0x2055be['offset']+_0x2055be[_0x0154('0x1d')];var _0x2e202c;if(_0x1e01d2>=_0x541dad){_0x1e01d2=_0x541dad;_0x2e202c=0xc8;}else{_0x2e202c=0xce;}_0x45e7f2[_0x0154('0x1f')](_0x2e202c);return _0x45e7f2[_0x0154('0x20')](_0x0154('0x21'),_0x129364+'-'+_0x1e01d2+'/'+_0x541dad)[_0x0154('0x1a')](_0x104628);}return null;};}function patchUpdates(_0x48e7da){return function(_0x11d4ef){try{jsonpatch[_0x0154('0x22')](_0x11d4ef,_0x48e7da,!![]);}catch(_0x55453d){return BPromise[_0x0154('0x23')](_0x55453d);}return _0x11d4ef[_0x0154('0x24')]();};}function saveUpdates(_0xf380a0,_0xc9b08a){return function(_0x521f0b){if(_0x521f0b){return _0x521f0b['update'](_0xf380a0)['then'](function(_0x976c07){return _0x976c07;});}return null;};}function removeEntity(_0x221f7a,_0x5a54ba){return function(_0x5a59af){if(_0x5a59af){return _0x5a59af[_0x0154('0x25')]()[_0x0154('0x26')](function(){_0x221f7a['status'](0xcc)[_0x0154('0x19')]();});}};}function handleEntityNotFound(_0x5b186e,_0xcb346f){return function(_0x426243){if(!_0x426243){_0x5b186e[_0x0154('0x18')](0x194);}return _0x426243;};}function handleError(_0x2aad6c,_0x298e79){_0x298e79=_0x298e79||0x1f4;return function(_0x5f07e6){logger[_0x0154('0x27')](_0x5f07e6[_0x0154('0x28')]);if(_0x5f07e6['name']){delete _0x5f07e6[_0x0154('0x29')];}_0x2aad6c['status'](_0x298e79)['send'](_0x5f07e6);};}exports[_0x0154('0x2a')]=function(_0x187917,_0x297fba){var _0x37e7df={},_0x18e508={},_0x44fe97={'count':0x0,'rows':[]};var _0x109885=_[_0x0154('0x2b')](db[_0x0154('0x2c')][_0x0154('0x2d')],function(_0x13a0fc){return{'name':_0x13a0fc[_0x0154('0x2e')],'type':_0x13a0fc[_0x0154('0x2f')]['key']};});_0x18e508['model']=_[_0x0154('0x2b')](_0x109885,_0x0154('0x29'));_0x18e508[_0x0154('0x30')]=_[_0x0154('0x31')](_0x187917['query']);_0x18e508[_0x0154('0x32')]=_['intersection'](_0x18e508[_0x0154('0x33')],_0x18e508[_0x0154('0x30')]);_0x37e7df[_0x0154('0x34')]=_[_0x0154('0x35')](_0x18e508[_0x0154('0x33')],qs[_0x0154('0x36')](_0x187917[_0x0154('0x30')]['fields']));_0x37e7df[_0x0154('0x34')]=_0x37e7df[_0x0154('0x34')]['length']?_0x37e7df['attributes']:_0x18e508[_0x0154('0x33')];if(!_0x187917[_0x0154('0x30')]['hasOwnProperty']('nolimit')){_0x37e7df[_0x0154('0x1d')]=qs[_0x0154('0x1d')](_0x187917['query'][_0x0154('0x1d')]);_0x37e7df['offset']=qs[_0x0154('0x1b')](_0x187917[_0x0154('0x30')][_0x0154('0x1b')]);}_0x37e7df[_0x0154('0x37')]=qs[_0x0154('0x38')](_0x187917['query'][_0x0154('0x38')]);_0x37e7df[_0x0154('0x39')]=qs[_0x0154('0x32')](_[_0x0154('0x3a')](_0x187917[_0x0154('0x30')],_0x18e508['filters']),_0x109885);if(_0x187917['query'][_0x0154('0x3b')]){_0x37e7df[_0x0154('0x39')]=_[_0x0154('0x3c')](_0x37e7df[_0x0154('0x39')],{'$or':_[_0x0154('0x2b')](_0x109885,function(_0x3b2948){if(_0x3b2948[_0x0154('0x2f')]!==_0x0154('0x3d')){var _0xe4ad3e={};_0xe4ad3e[_0x3b2948[_0x0154('0x29')]]={'$like':'%'+_0x187917[_0x0154('0x30')][_0x0154('0x3b')]+'%'};return _0xe4ad3e;}})});}_0x37e7df=_[_0x0154('0x3c')]({},_0x37e7df,_0x187917[_0x0154('0x3e')]);var _0x50c1cb={'where':_0x37e7df[_0x0154('0x39')]};return db[_0x0154('0x2c')][_0x0154('0x1e')](_0x50c1cb)[_0x0154('0x26')](function(_0x14079d){_0x44fe97['count']=_0x14079d;if(_0x187917['query'][_0x0154('0x3f')]){_0x37e7df['include']=[{'all':!![]}];}return db['SalesforceField'][_0x0154('0x40')](_0x37e7df);})['then'](function(_0x154c03){_0x44fe97[_0x0154('0x41')]=_0x154c03;return _0x44fe97;})['then'](respondWithFilteredResult(_0x297fba,_0x37e7df))['catch'](handleError(_0x297fba,null));};exports['show']=function(_0x227e63,_0x28520b){var _0x5ae30a={'raw':!![],'where':{'id':_0x227e63[_0x0154('0x42')]['id']}},_0x5cecc0={};_0x5cecc0[_0x0154('0x33')]=_[_0x0154('0x31')](db[_0x0154('0x2c')][_0x0154('0x2d')]);_0x5cecc0[_0x0154('0x30')]=_['keys'](_0x227e63[_0x0154('0x30')]);_0x5cecc0['filters']=_['intersection'](_0x5cecc0[_0x0154('0x33')],_0x5cecc0[_0x0154('0x30')]);_0x5ae30a[_0x0154('0x34')]=_['intersection'](_0x5cecc0[_0x0154('0x33')],qs[_0x0154('0x36')](_0x227e63[_0x0154('0x30')][_0x0154('0x36')]));_0x5ae30a[_0x0154('0x34')]=_0x5ae30a[_0x0154('0x34')][_0x0154('0x43')]?_0x5ae30a[_0x0154('0x34')]:_0x5cecc0[_0x0154('0x33')];if(_0x227e63[_0x0154('0x30')][_0x0154('0x3f')]){_0x5ae30a[_0x0154('0x44')]=[{'all':!![]}];}_0x5ae30a=_[_0x0154('0x3c')]({},_0x5ae30a,_0x227e63[_0x0154('0x3e')]);return db[_0x0154('0x2c')]['find'](_0x5ae30a)[_0x0154('0x26')](handleEntityNotFound(_0x28520b,null))[_0x0154('0x26')](respondWithResult(_0x28520b,null))[_0x0154('0x45')](handleError(_0x28520b,null));};exports['create']=function(_0x76a71e,_0x5d6765){return db[_0x0154('0x2c')][_0x0154('0x46')](_0x76a71e[_0x0154('0x47')],{})['then'](respondWithResult(_0x5d6765,0xc9))['catch'](handleError(_0x5d6765,null));};exports[_0x0154('0x48')]=function(_0x587e55,_0x17a364){if(_0x587e55[_0x0154('0x47')]['id']){delete _0x587e55[_0x0154('0x47')]['id'];}return db['SalesforceField'][_0x0154('0x49')]({'where':{'id':_0x587e55[_0x0154('0x42')]['id']}})['then'](handleEntityNotFound(_0x17a364,null))[_0x0154('0x26')](saveUpdates(_0x587e55[_0x0154('0x47')],null))[_0x0154('0x26')](respondWithResult(_0x17a364,null))[_0x0154('0x45')](handleError(_0x17a364,null));};exports[_0x0154('0x25')]=function(_0x3bc53c,_0x1532fc){return db[_0x0154('0x2c')][_0x0154('0x49')]({'where':{'id':_0x3bc53c['params']['id']}})[_0x0154('0x26')](handleEntityNotFound(_0x1532fc,null))[_0x0154('0x26')](removeEntity(_0x1532fc,null))[_0x0154('0x45')](handleError(_0x1532fc,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index f9d4004..bd35bc8 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 _0x7a39=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intSalesforceField.attributes','exports','define','int_salesforce_fields','FieldId'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7a39,0x75));var _0x97a3=function(_0x3c05d8,_0x150e2f){_0x3c05d8=_0x3c05d8-0x0;var _0x1910b1=_0x7a39[_0x3c05d8];return _0x1910b1;};'use strict';var _=require(_0x97a3('0x0'));var util=require(_0x97a3('0x1'));var logger=require(_0x97a3('0x2'))(_0x97a3('0x3'));var moment=require(_0x97a3('0x4'));var BPromise=require(_0x97a3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x97a3('0x6'));var rimraf=require(_0x97a3('0x7'));var config=require('../../config/environment');var attributes=require(_0x97a3('0x8'));module[_0x97a3('0x9')]=function(_0x31e02b,_0x2561ba){return _0x31e02b[_0x97a3('0xa')]('SalesforceField',attributes,{'tableName':_0x97a3('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0x97a3('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4016=['rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4657fc,_0x1bd9d0){var _0xc29874=function(_0x2810cf){while(--_0x2810cf){_0x4657fc['push'](_0x4657fc['shift']());}};_0xc29874(++_0x1bd9d0);}(_0x4016,0x190));var _0x6401=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x4016[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x6401('0x0'));var logger=require(_0x6401('0x1'))(_0x6401('0x2'));var moment=require(_0x6401('0x3'));var BPromise=require('bluebird');var rp=require(_0x6401('0x4'));var fs=require('fs');var path=require(_0x6401('0x5'));var rimraf=require(_0x6401('0x6'));var config=require('../../config/environment');var attributes=require(_0x6401('0x7'));module[_0x6401('0x8')]=function(_0x26faa1,_0x40c455){return _0x26faa1[_0x6401('0x9')](_0x6401('0xa'),attributes,{'tableName':_0x6401('0xb'),'paranoid':![],'indexes':[{'name':_0x6401('0xc'),'fields':['idField',_0x6401('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 bb2c90b..034680f 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 _0xdde7=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x5d1c71,_0xa5678e){var _0x4fb225=function(_0x403e91){while(--_0x403e91){_0x5d1c71['push'](_0x5d1c71['shift']());}};_0x4fb225(++_0xa5678e);}(_0xdde7,0x1ae));var _0x7dde=function(_0x4945e8,_0x597c5e){_0x4945e8=_0x4945e8-0x0;var _0x4300ca=_0xdde7[_0x4945e8];return _0x4300ca;};'use strict';var _=require(_0x7dde('0x0'));var util=require(_0x7dde('0x1'));var moment=require(_0x7dde('0x2'));var BPromise=require(_0x7dde('0x3'));var rs=require(_0x7dde('0x4'));var fs=require('fs');var Redis=require(_0x7dde('0x5'));var db=require(_0x7dde('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7dde('0x7'))(_0x7dde('0x8'));var config=require('../../config/environment');var jayson=require(_0x7dde('0x9'));var client=jayson[_0x7dde('0xa')][_0x7dde('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x211872,_0x5340bc,_0x18cb9d){return new BPromise(function(_0x26d057,_0x18c183){return client[_0x7dde('0xc')](_0x211872,_0x18cb9d)[_0x7dde('0xd')](function(_0x313ab7){logger[_0x7dde('0xe')](_0x7dde('0xf'),_0x5340bc,_0x7dde('0x10'));logger[_0x7dde('0x11')](_0x7dde('0x12'),_0x5340bc,'request\x20sent',JSON[_0x7dde('0x13')](_0x313ab7));if(_0x313ab7[_0x7dde('0x14')]){if(_0x313ab7[_0x7dde('0x14')][_0x7dde('0x15')]===0x1f4){logger['error'](_0x7dde('0xf'),_0x5340bc,_0x313ab7[_0x7dde('0x14')][_0x7dde('0x16')]);return _0x18c183(_0x313ab7[_0x7dde('0x14')][_0x7dde('0x16')]);}logger['error'](_0x7dde('0xf'),_0x5340bc,_0x313ab7[_0x7dde('0x14')]['message']);return _0x26d057(_0x313ab7[_0x7dde('0x14')][_0x7dde('0x16')]);}else{logger[_0x7dde('0xe')](_0x7dde('0xf'),_0x5340bc,_0x7dde('0x10'));_0x26d057(_0x313ab7['result'][_0x7dde('0x16')]);}})[_0x7dde('0x17')](function(_0x5afa9c){logger[_0x7dde('0x14')](_0x7dde('0xf'),_0x5340bc,_0x5afa9c);_0x18c183(_0x5afa9c);});});} \ No newline at end of file +var _0x7784=['error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7784,0x15e));var _0x4778=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7784[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x4778('0x0'));var util=require(_0x4778('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4778('0x2'));var fs=require('fs');var Redis=require(_0x4778('0x3'));var db=require(_0x4778('0x4'))['db'];var utils=require(_0x4778('0x5'));var logger=require(_0x4778('0x6'))(_0x4778('0x7'));var config=require(_0x4778('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4778('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31355c,_0x43c7dc,_0x595350){return new BPromise(function(_0x1b2f62,_0x142938){return client[_0x4778('0xa')](_0x31355c,_0x595350)[_0x4778('0xb')](function(_0x32dd59){logger[_0x4778('0xc')](_0x4778('0xd'),_0x43c7dc,_0x4778('0xe'));logger[_0x4778('0xf')](_0x4778('0x10'),_0x43c7dc,_0x4778('0xe'),JSON[_0x4778('0x11')](_0x32dd59));if(_0x32dd59['error']){if(_0x32dd59[_0x4778('0x12')][_0x4778('0x13')]===0x1f4){logger[_0x4778('0x12')](_0x4778('0xd'),_0x43c7dc,_0x32dd59['error']['message']);return _0x142938(_0x32dd59[_0x4778('0x12')]['message']);}logger[_0x4778('0x12')](_0x4778('0xd'),_0x43c7dc,_0x32dd59['error'][_0x4778('0x14')]);return _0x1b2f62(_0x32dd59['error'][_0x4778('0x14')]);}else{logger[_0x4778('0xc')](_0x4778('0xd'),_0x43c7dc,'request\x20sent');_0x1b2f62(_0x32dd59[_0x4778('0x15')]['message']);}})[_0x4778('0x16')](function(_0x5f4561){logger[_0x4778('0x12')](_0x4778('0xd'),_0x43c7dc,_0x5f4561);_0x142938(_0x5f4561);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 4f96bf8..a2c05c9 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 _0x03cf=['./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','delete','destroy','util','path','Router','../../components/auth/service','../../config/environment'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x03cf,0x64));var _0xf03c=function(_0x377774,_0xd74cdf){_0x377774=_0x377774-0x0;var _0x11d3aa=_0x03cf[_0x377774];return _0x11d3aa;};'use strict';var multer=require('multer');var util=require(_0xf03c('0x0'));var path=require(_0xf03c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf03c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf03c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf03c('0x4'));var controller=require(_0xf03c('0x5'));router[_0xf03c('0x6')]('/',auth['isAuthenticated'](),controller[_0xf03c('0x7')]);router[_0xf03c('0x6')](_0xf03c('0x8'),auth[_0xf03c('0x9')](),controller[_0xf03c('0xa')]);router[_0xf03c('0x6')]('/:id/configurations',auth[_0xf03c('0x9')](),controller[_0xf03c('0xb')]);router[_0xf03c('0x6')](_0xf03c('0xc'),auth[_0xf03c('0x9')](),controller[_0xf03c('0xd')]);router[_0xf03c('0xe')]('/',auth[_0xf03c('0x9')](),controller[_0xf03c('0xf')]);router[_0xf03c('0xe')](_0xf03c('0x10'),auth[_0xf03c('0x9')](),controller[_0xf03c('0x11')]);router['put'](_0xf03c('0x8'),auth[_0xf03c('0x9')](),controller[_0xf03c('0x12')]);router[_0xf03c('0x13')]('/:id',auth[_0xf03c('0x9')](),controller[_0xf03c('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf485=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x155496,_0x313cf7){var _0x5b657d=function(_0x50fc4b){while(--_0x50fc4b){_0x155496['push'](_0x155496['shift']());}};_0x5b657d(++_0x313cf7);}(_0xf485,0x1af));var _0x5f48=function(_0x2e0cfe,_0x4b8709){_0x2e0cfe=_0x2e0cfe-0x0;var _0x4bd6c5=_0xf485[_0x2e0cfe];return _0x4bd6c5;};'use strict';var multer=require(_0x5f48('0x0'));var util=require('util');var path=require(_0x5f48('0x1'));var timeout=require('connect-timeout');var express=require(_0x5f48('0x2'));var router=express[_0x5f48('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5f48('0x4'));var interaction=require(_0x5f48('0x5'));var config=require(_0x5f48('0x6'));var controller=require('./intServicenowAccount.controller');router[_0x5f48('0x7')]('/',auth[_0x5f48('0x8')](),controller[_0x5f48('0x9')]);router[_0x5f48('0x7')](_0x5f48('0xa'),auth[_0x5f48('0x8')](),controller[_0x5f48('0xb')]);router[_0x5f48('0x7')](_0x5f48('0xc'),auth['isAuthenticated'](),controller[_0x5f48('0xd')]);router[_0x5f48('0x7')](_0x5f48('0xe'),auth[_0x5f48('0x8')](),controller[_0x5f48('0xf')]);router[_0x5f48('0x10')]('/',auth[_0x5f48('0x8')](),controller['create']);router[_0x5f48('0x10')](_0x5f48('0xc'),auth['isAuthenticated'](),controller[_0x5f48('0x11')]);router[_0x5f48('0x12')](_0x5f48('0xa'),auth[_0x5f48('0x8')](),controller[_0x5f48('0x13')]);router['delete']('/:id',auth[_0x5f48('0x8')](),controller[_0x5f48('0x14')]);module[_0x5f48('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index cd20948..8f22b80 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 _0xa1d1=['remoteUri','sequelize','STRING','username'];(function(_0x1217cf,_0x327d42){var _0x179ed0=function(_0xe6a60b){while(--_0xe6a60b){_0x1217cf['push'](_0x1217cf['shift']());}};_0x179ed0(++_0x327d42);}(_0xa1d1,0x1c9));var _0x1a1d=function(_0x271d12,_0x4475a6){_0x271d12=_0x271d12-0x0;var _0x115469=_0xa1d1[_0x271d12];return _0x115469;};'use strict';var Sequelize=require(_0x1a1d('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a1d('0x1')]},'description':{'type':Sequelize[_0x1a1d('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x1a1d('0x2')},'password':{'type':Sequelize[_0x1a1d('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1a1d('0x3')},'serverUrl':{'type':Sequelize[_0x1a1d('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x901a=['remoteUri','sequelize','exports','STRING'];(function(_0x59088b,_0x41f8f1){var _0x27522d=function(_0x1d6ab8){while(--_0x1d6ab8){_0x59088b['push'](_0x59088b['shift']());}};_0x27522d(++_0x41f8f1);}(_0x901a,0xa5));var _0xa901=function(_0x5c0693,_0x1c78c0){_0x5c0693=_0x5c0693-0x0;var _0xd6334b=_0x901a[_0x5c0693];return _0xd6334b;};'use strict';var Sequelize=require(_0xa901('0x0'));module[_0xa901('0x1')]={'name':{'type':Sequelize[_0xa901('0x2')]},'description':{'type':Sequelize[_0xa901('0x2')]},'username':{'type':Sequelize[_0xa901('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xa901('0x2')]},'email':{'type':Sequelize[_0xa901('0x2')]},'remoteUri':{'type':Sequelize[_0xa901('0x2')],'unique':_0xa901('0x3')},'serverUrl':{'type':Sequelize[_0xa901('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index bd8c969..e6904e9 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 _0xaff0=['rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','options','includeAll','then','rows','catch','show','keys','length','find','create','body','params','getConfigurations','ServicenowConfiguration','pick','merge','addConfiguration','findOne','AccountId','Subjects','channel','ServicenowField','Descriptions','getFields','made_sla','knowledge','close_code','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','sys_domain_path','rfc','expected_start','opened_at','group_list','reopened_time','resolved_at','caller_id','approval_set','subcategory','short_description','correlation_display','work_start','assignment_group','calendar_duration','close_notes','parent_incident','sys_id','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','due_date','sys_mod_count','sys_tags','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','concat','ServiceNow\x20error:\x20','test','statusCode','send','Wrong\x20credentials','boolean','True','False','result','inactive','false','value','push','eml-format','zip-dir','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','error','stack','name','index','map','ServicenowAccount'];(function(_0x5efb58,_0x1cef15){var _0x1c5299=function(_0x393d3a){while(--_0x393d3a){_0x5efb58['push'](_0x5efb58['shift']());}};_0x1c5299(++_0x1cef15);}(_0xaff0,0x85));var _0x0aff=function(_0x2b330b,_0xde43c4){_0x2b330b=_0x2b330b-0x0;var _0x25405e=_0xaff0[_0x2b330b];return _0x25405e;};'use strict';var emlformat=require(_0x0aff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0aff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0aff('0x2'));var Mustache=require(_0x0aff('0x3'));var util=require('util');var path=require(_0x0aff('0x4'));var sox=require('sox');var csv=require(_0x0aff('0x5'));var ejs=require(_0x0aff('0x6'));var fs=require('fs');var fs_extra=require(_0x0aff('0x7'));var _=require('lodash');var squel=require(_0x0aff('0x8'));var crypto=require(_0x0aff('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0aff('0x5'));var querystring=require(_0x0aff('0xa'));var Papa=require(_0x0aff('0xb'));var Redis=require(_0x0aff('0xc'));var authService=require(_0x0aff('0xd'));var qs=require(_0x0aff('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0aff('0xf'));var logger=require(_0x0aff('0x10'))('api');var utils=require(_0x0aff('0x11'));var config=require(_0x0aff('0x12'));var licenseUtil=require(_0x0aff('0x13'));var db=require(_0x0aff('0x14'))['db'];var integrations=require(_0x0aff('0x15'));function respondWithStatusCode(_0x3414c7,_0x1c736c){_0x1c736c=_0x1c736c||0xcc;return function(_0x4d6a52){if(_0x4d6a52){return _0x3414c7[_0x0aff('0x16')](_0x1c736c);}return _0x3414c7[_0x0aff('0x17')](_0x1c736c)[_0x0aff('0x18')]();};}function respondWithResult(_0x64356c,_0x1e32dc){_0x1e32dc=_0x1e32dc||0xc8;return function(_0x2d805c){if(_0x2d805c){return _0x64356c[_0x0aff('0x17')](_0x1e32dc)[_0x0aff('0x19')](_0x2d805c);}};}function respondWithFilteredResult(_0x1a7550,_0x2e04fd){return function(_0x5272b9){if(_0x5272b9){var _0x148397=typeof _0x2e04fd[_0x0aff('0x1a')]===_0x0aff('0x1b')&&typeof _0x2e04fd['limit']===_0x0aff('0x1b');var _0x2beded=_0x5272b9[_0x0aff('0x1c')];var _0x7f51eb=_0x148397?0x0:_0x2e04fd[_0x0aff('0x1a')];var _0x46abb0=_0x148397?_0x5272b9['count']:_0x2e04fd[_0x0aff('0x1a')]+_0x2e04fd[_0x0aff('0x1d')];var _0x42db2e;if(_0x46abb0>=_0x2beded){_0x46abb0=_0x2beded;_0x42db2e=0xc8;}else{_0x42db2e=0xce;}_0x1a7550[_0x0aff('0x17')](_0x42db2e);return _0x1a7550[_0x0aff('0x1e')](_0x0aff('0x1f'),_0x7f51eb+'-'+_0x46abb0+'/'+_0x2beded)[_0x0aff('0x19')](_0x5272b9);}return null;};}function patchUpdates(_0x24ad78){return function(_0x4d6884){try{jsonpatch[_0x0aff('0x20')](_0x4d6884,_0x24ad78,!![]);}catch(_0x3b7aad){return BPromise[_0x0aff('0x21')](_0x3b7aad);}return _0x4d6884['save']();};}function saveUpdates(_0x19e980,_0x3c2472){return function(_0x302cd3){if(_0x302cd3){return _0x302cd3[_0x0aff('0x22')](_0x19e980)['then'](function(_0x49218e){return _0x49218e;});}return null;};}function removeEntity(_0x5e8fb9,_0x5a04c1){return function(_0x24440c){if(_0x24440c){return _0x24440c[_0x0aff('0x23')]()['then'](function(){_0x5e8fb9[_0x0aff('0x17')](0xcc)[_0x0aff('0x18')]();});}};}function handleEntityNotFound(_0x4ab74a,_0x45d839){return function(_0x22d9cb){if(!_0x22d9cb){_0x4ab74a[_0x0aff('0x16')](0x194);}return _0x22d9cb;};}function handleError(_0x5e0884,_0x58cd03){_0x58cd03=_0x58cd03||0x1f4;return function(_0xf26eb0){logger[_0x0aff('0x24')](_0xf26eb0[_0x0aff('0x25')]);if(_0xf26eb0[_0x0aff('0x26')]){delete _0xf26eb0[_0x0aff('0x26')];}_0x5e0884[_0x0aff('0x17')](_0x58cd03)['send'](_0xf26eb0);};}exports[_0x0aff('0x27')]=function(_0x1ebe24,_0x5772eb){var _0x1b5061={},_0x1264ab={},_0x2a40ad={'count':0x0,'rows':[]};var _0x474467=_[_0x0aff('0x28')](db[_0x0aff('0x29')][_0x0aff('0x2a')],function(_0x1ec8cd){return{'name':_0x1ec8cd[_0x0aff('0x2b')],'type':_0x1ec8cd['type']['key']};});_0x1264ab[_0x0aff('0x2c')]=_[_0x0aff('0x28')](_0x474467,_0x0aff('0x26'));_0x1264ab[_0x0aff('0x2d')]=_['keys'](_0x1ebe24['query']);_0x1264ab[_0x0aff('0x2e')]=_[_0x0aff('0x2f')](_0x1264ab[_0x0aff('0x2c')],_0x1264ab['query']);_0x1b5061[_0x0aff('0x30')]=_[_0x0aff('0x2f')](_0x1264ab[_0x0aff('0x2c')],qs['fields'](_0x1ebe24[_0x0aff('0x2d')][_0x0aff('0x31')]));_0x1b5061['attributes']=_0x1b5061['attributes']['length']?_0x1b5061[_0x0aff('0x30')]:_0x1264ab[_0x0aff('0x2c')];if(!_0x1ebe24[_0x0aff('0x2d')][_0x0aff('0x32')](_0x0aff('0x33'))){_0x1b5061[_0x0aff('0x1d')]=qs['limit'](_0x1ebe24[_0x0aff('0x2d')][_0x0aff('0x1d')]);_0x1b5061[_0x0aff('0x1a')]=qs[_0x0aff('0x1a')](_0x1ebe24[_0x0aff('0x2d')][_0x0aff('0x1a')]);}_0x1b5061[_0x0aff('0x34')]=qs['sort'](_0x1ebe24[_0x0aff('0x2d')][_0x0aff('0x35')]);_0x1b5061[_0x0aff('0x36')]=qs['filters'](_['pick'](_0x1ebe24[_0x0aff('0x2d')],_0x1264ab['filters']),_0x474467);if(_0x1ebe24[_0x0aff('0x2d')][_0x0aff('0x37')]){_0x1b5061[_0x0aff('0x36')]=_['merge'](_0x1b5061[_0x0aff('0x36')],{'$or':_['map'](_0x474467,function(_0x2840fb){if(_0x2840fb[_0x0aff('0x38')]!==_0x0aff('0x39')){var _0x149745={};_0x149745[_0x2840fb[_0x0aff('0x26')]]={'$like':'%'+_0x1ebe24['query']['filter']+'%'};return _0x149745;}})});}_0x1b5061=_['merge']({},_0x1b5061,_0x1ebe24[_0x0aff('0x3a')]);var _0x2fd779={'where':_0x1b5061[_0x0aff('0x36')]};return db[_0x0aff('0x29')][_0x0aff('0x1c')](_0x2fd779)['then'](function(_0x696417){_0x2a40ad['count']=_0x696417;if(_0x1ebe24[_0x0aff('0x2d')][_0x0aff('0x3b')]){_0x1b5061['include']=[{'all':!![]}];}return db[_0x0aff('0x29')]['findAll'](_0x1b5061);})[_0x0aff('0x3c')](function(_0x513adb){_0x2a40ad[_0x0aff('0x3d')]=_0x513adb;return _0x2a40ad;})['then'](respondWithFilteredResult(_0x5772eb,_0x1b5061))[_0x0aff('0x3e')](handleError(_0x5772eb,null));};exports[_0x0aff('0x3f')]=function(_0x56ec13,_0x41a345){var _0x2d7c5a={'raw':![],'where':{'id':_0x56ec13['params']['id']}},_0x317f63={};_0x317f63['model']=_[_0x0aff('0x40')](db[_0x0aff('0x29')]['rawAttributes']);_0x317f63[_0x0aff('0x2d')]=_[_0x0aff('0x40')](_0x56ec13[_0x0aff('0x2d')]);_0x317f63[_0x0aff('0x2e')]=_[_0x0aff('0x2f')](_0x317f63[_0x0aff('0x2c')],_0x317f63['query']);_0x2d7c5a[_0x0aff('0x30')]=_[_0x0aff('0x2f')](_0x317f63[_0x0aff('0x2c')],qs[_0x0aff('0x31')](_0x56ec13[_0x0aff('0x2d')]['fields']));_0x2d7c5a[_0x0aff('0x30')]=_0x2d7c5a['attributes'][_0x0aff('0x41')]?_0x2d7c5a['attributes']:_0x317f63[_0x0aff('0x2c')];if(_0x56ec13['query'][_0x0aff('0x3b')]){_0x2d7c5a['include']=[{'all':!![]}];}_0x2d7c5a=_['merge']({},_0x2d7c5a,_0x56ec13[_0x0aff('0x3a')]);return db[_0x0aff('0x29')][_0x0aff('0x42')](_0x2d7c5a)[_0x0aff('0x3c')](handleEntityNotFound(_0x41a345,null))['then'](respondWithResult(_0x41a345,null))[_0x0aff('0x3e')](handleError(_0x41a345,null));};exports[_0x0aff('0x43')]=function(_0x34287f,_0x5a7a27){return db[_0x0aff('0x29')][_0x0aff('0x43')](_0x34287f[_0x0aff('0x44')],{})['then'](respondWithResult(_0x5a7a27,0xc9))[_0x0aff('0x3e')](handleError(_0x5a7a27,null));};exports[_0x0aff('0x22')]=function(_0xd8898f,_0x2f32a6){if(_0xd8898f['body']['id']){delete _0xd8898f['body']['id'];}return db[_0x0aff('0x29')][_0x0aff('0x42')]({'where':{'id':_0xd8898f[_0x0aff('0x45')]['id']}})[_0x0aff('0x3c')](handleEntityNotFound(_0x2f32a6,null))[_0x0aff('0x3c')](saveUpdates(_0xd8898f[_0x0aff('0x44')],null))['then'](respondWithResult(_0x2f32a6,null))['catch'](handleError(_0x2f32a6,null));};exports[_0x0aff('0x23')]=function(_0x26e3ea,_0x376a48){return db[_0x0aff('0x29')][_0x0aff('0x42')]({'where':{'id':_0x26e3ea[_0x0aff('0x45')]['id']}})[_0x0aff('0x3c')](handleEntityNotFound(_0x376a48,null))[_0x0aff('0x3c')](removeEntity(_0x376a48,null))[_0x0aff('0x3e')](handleError(_0x376a48,null));};exports[_0x0aff('0x46')]=function(_0x41baa2,_0x1438fb,_0x32b478){var _0x459f7a={};var _0x460087={};var _0x2796d3;var _0x1e232a;return db['ServicenowAccount']['findOne']({'where':{'id':_0x41baa2[_0x0aff('0x45')]['id']}})[_0x0aff('0x3c')](handleEntityNotFound(_0x1438fb,null))['then'](function(_0x3bd7da){if(_0x3bd7da){_0x2796d3=_0x3bd7da;_0x460087[_0x0aff('0x2c')]=_['keys'](db[_0x0aff('0x47')][_0x0aff('0x2a')]);_0x460087[_0x0aff('0x2d')]=_[_0x0aff('0x40')](_0x41baa2[_0x0aff('0x2d')]);_0x460087['filters']=_['intersection'](_0x460087[_0x0aff('0x2c')],_0x460087[_0x0aff('0x2d')]);_0x459f7a['attributes']=_[_0x0aff('0x2f')](_0x460087[_0x0aff('0x2c')],qs[_0x0aff('0x31')](_0x41baa2[_0x0aff('0x2d')][_0x0aff('0x31')]));_0x459f7a[_0x0aff('0x30')]=_0x459f7a[_0x0aff('0x30')][_0x0aff('0x41')]?_0x459f7a['attributes']:_0x460087[_0x0aff('0x2c')];_0x459f7a['order']=qs[_0x0aff('0x35')](_0x41baa2[_0x0aff('0x2d')][_0x0aff('0x35')]);_0x459f7a[_0x0aff('0x36')]=qs[_0x0aff('0x2e')](_[_0x0aff('0x48')](_0x41baa2[_0x0aff('0x2d')],_0x460087[_0x0aff('0x2e')]));if(_0x41baa2['query'][_0x0aff('0x37')]){_0x459f7a['where']=_[_0x0aff('0x49')](_0x459f7a['where'],{'$or':_['map'](_0x459f7a[_0x0aff('0x30')],function(_0xff8f44){var _0xf5256b={};_0xf5256b[_0xff8f44]={'$like':'%'+_0x41baa2['query'][_0x0aff('0x37')]+'%'};return _0xf5256b;})});}_0x459f7a=_[_0x0aff('0x49')]({},_0x459f7a,_0x41baa2[_0x0aff('0x3a')]);return _0x2796d3['getConfigurations'](_0x459f7a);}})[_0x0aff('0x3c')](function(_0x4b124a){if(_0x4b124a){_0x1e232a=_0x4b124a[_0x0aff('0x41')];if(!_0x41baa2[_0x0aff('0x2d')][_0x0aff('0x32')](_0x0aff('0x33'))){_0x459f7a['limit']=qs[_0x0aff('0x1d')](_0x41baa2[_0x0aff('0x2d')]['limit']);_0x459f7a[_0x0aff('0x1a')]=qs[_0x0aff('0x1a')](_0x41baa2['query']['offset']);}return _0x2796d3['getConfigurations'](_0x459f7a);}})[_0x0aff('0x3c')](function(_0x42148e){if(_0x42148e){return _0x42148e?{'count':_0x1e232a,'rows':_0x42148e}:null;}})['then'](respondWithResult(_0x1438fb,null))['catch'](handleError(_0x1438fb,null));};exports[_0x0aff('0x4a')]=function(_0x60f56,_0x3d1aa0,_0x521f27){if(_0x60f56['body']['id']){delete _0x60f56['body']['id'];}return db[_0x0aff('0x29')][_0x0aff('0x4b')]({'where':{'id':_0x60f56[_0x0aff('0x45')]['id']}})[_0x0aff('0x3c')](handleEntityNotFound(_0x3d1aa0,null))[_0x0aff('0x3c')](function(_0x125259){if(_0x125259){_0x60f56[_0x0aff('0x44')][_0x0aff('0x4c')]=_0x125259['id'];_0x60f56[_0x0aff('0x44')][_0x0aff('0x4d')]=integrations['getSubjects'](_0x60f56['body']['channel'],_0x60f56['body'][_0x0aff('0x38')]);_0x60f56['body']['Descriptions']=integrations['getDescriptions'](_0x60f56[_0x0aff('0x44')][_0x0aff('0x4e')],_0x60f56[_0x0aff('0x44')]['type']);return db[_0x0aff('0x47')][_0x0aff('0x43')](_0x60f56[_0x0aff('0x44')],{'include':[{'model':db[_0x0aff('0x4f')],'as':_0x0aff('0x4d')},{'model':db[_0x0aff('0x4f')],'as':_0x0aff('0x50')}]});}return null;})[_0x0aff('0x3c')](respondWithResult(_0x3d1aa0,null))[_0x0aff('0x3e')](handleError(_0x3d1aa0,null));};exports[_0x0aff('0x51')]=function(_0x5c56c2,_0x3586b2,_0x1a8b4d){var _0x5db055=[_0x0aff('0x52'),'hold_reason',_0x0aff('0x53'),'subcategory',_0x0aff('0x54'),'notify','incident_state',_0x0aff('0x55'),_0x0aff('0x56')];var _0x4ef1c2=['parent',_0x0aff('0x52'),_0x0aff('0x57'),_0x0aff('0x58'),_0x0aff('0x59'),_0x0aff('0x5a'),_0x0aff('0x5b'),'hold_reason','approval_history',_0x0aff('0x5c'),_0x0aff('0x5d'),_0x0aff('0x5e'),_0x0aff('0x5f'),_0x0aff('0x60'),_0x0aff('0x61'),_0x0aff('0x62'),'state',_0x0aff('0x63'),_0x0aff('0x53'),_0x0aff('0x34'),_0x0aff('0x64'),_0x0aff('0x65'),_0x0aff('0x66'),_0x0aff('0x67'),_0x0aff('0x68'),'active',_0x0aff('0x69'),_0x0aff('0x6a'),'priority',_0x0aff('0x6b'),_0x0aff('0x6c'),'time_worked',_0x0aff('0x6d'),_0x0aff('0x6e'),'business_duration',_0x0aff('0x6f'),'work_end',_0x0aff('0x70'),_0x0aff('0x71'),_0x0aff('0x72'),_0x0aff('0x73'),_0x0aff('0x74'),'work_notes',_0x0aff('0x75'),_0x0aff('0x54'),_0x0aff('0x76'),'delivery_task',_0x0aff('0x77'),_0x0aff('0x78'),'business_stc','additional_assignee_list','description',_0x0aff('0x79'),'notify','sys_class_name',_0x0aff('0x7a'),'closed_by','follow_up',_0x0aff('0x7b'),_0x0aff('0x7c'),'contact_type',_0x0aff('0x7d'),_0x0aff('0x7e'),_0x0aff('0x7f'),_0x0aff('0x80'),_0x0aff('0x81'),_0x0aff('0x82'),_0x0aff('0x83'),_0x0aff('0x84'),_0x0aff('0x55'),_0x0aff('0x85'),_0x0aff('0x86'),'approval','comments_and_work_notes',_0x0aff('0x87'),_0x0aff('0x88'),'reopen_count',_0x0aff('0x89'),'escalation','upon_approval',_0x0aff('0x8a'),_0x0aff('0x8b'),'category'];var _0x13ef9c='';var _0x8c7e60='';var _0x215f09=[];var _0x3fcad6='';var _0x17fe92='';var _0x3fd6ec=[];var _0x44acbd='';var _0x144e5d='';var _0x1c7862={};var _0x3c6612='';return db['ServicenowAccount'][_0x0aff('0x4b')]({'where':{'id':_0x5c56c2[_0x0aff('0x45')]['id']},'attributes':['id',_0x0aff('0x8c'),_0x0aff('0x8d'),_0x0aff('0x8e'),_0x0aff('0x8f'),_0x0aff('0x90')]})[_0x0aff('0x3c')](handleEntityNotFound(_0x3586b2,null))[_0x0aff('0x3c')](function(_0x1d0cf5){if(_0x1d0cf5){_0x3c6612=_0x1d0cf5[_0x0aff('0x8f')];var _0x2ee930=_0x3c6612[_0x0aff('0x91')](-0x1);if(_0x2ee930==='/'){_0x3c6612=_0x3c6612[_0x0aff('0x92')](0x0,_0x3c6612['lastIndexOf'](_0x2ee930));}_0x144e5d=util[_0x0aff('0x93')](_0x0aff('0x94'),_0x3c6612);_0x44acbd=util[_0x0aff('0x93')](_0x0aff('0x95'),_0x3c6612);_0x1c7862={'user':_0x1d0cf5[_0x0aff('0x8c')],'pass':_0x1d0cf5['password']};var _0x1598a5={'method':_0x0aff('0x96'),'uri':_0x144e5d+_0x0aff('0x97'),'auth':_0x1c7862,'json':!![]};return rp(_0x1598a5);}})[_0x0aff('0x3c')](function(_0x18f4e8){if(_0x18f4e8['result'][_0x0aff('0x41')]>0x0){_0x13ef9c=_0x18f4e8['result'];}console[_0x0aff('0x98')](_0x0aff('0x99'),_0x13ef9c);_0x3fd6ec=[];_0x8c7e60=Object[_0x0aff('0x9a')]([],_0x13ef9c);_[_0x0aff('0x9b')](_0x8c7e60,function(_0x2c2645){return!_0x5db055[_0x0aff('0x9c')](_0x2c2645[_0x0aff('0x26')]);});_0x8c7e60[_0x0aff('0x9d')](function(_0x5f2daa){var _0x110bb0=createFieldObject(_0x44acbd,_0x1c7862,_0x5f2daa[_0x0aff('0x9e')],_0x5f2daa[_0x0aff('0x26')],_0x5f2daa[_0x0aff('0x9f')],![]);_0x3fd6ec['push'](_0x110bb0);});return Promise['all'](_0x3fd6ec);})[_0x0aff('0x3c')](function(_0x20142a){_0x215f09=_0x20142a;_0x3fcad6=Object[_0x0aff('0x9a')]([],_0x13ef9c);console[_0x0aff('0x98')]('TCL:\x20_object',_0x13ef9c);_[_0x0aff('0x9b')](_0x3fcad6,function(_0x173f06){return _0x4ef1c2[_0x0aff('0x9c')](_0x173f06['name']);});console[_0x0aff('0x98')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3fcad6);_0x3fd6ec=[];_0x3fcad6['forEach'](function(_0x365ca8){var _0x44a6ab=createFieldObject(_0x44acbd,_0x1c7862,_0x365ca8[_0x0aff('0x9e')],_0x365ca8[_0x0aff('0x26')],_0x365ca8['label'],!![]);_0x3fd6ec['push'](_0x44a6ab);});return Promise[_0x0aff('0xa0')](_0x3fd6ec);})[_0x0aff('0x3c')](function(_0x4b7289){_0x17fe92=_0x4b7289;var _0x1f3fae=_0x215f09[_0x0aff('0xa1')](_0x17fe92);return{'count':_0x1f3fae['length'],'rows':_0x1f3fae};})[_0x0aff('0x3c')](respondWithResult(_0x3586b2,null))[_0x0aff('0x3e')](function(_0x2b239c){console[_0x0aff('0x98')](_0x0aff('0xa2')+_0x2b239c);var _0x3692a4=_0x5c56c2[_0x0aff('0x2d')][_0x0aff('0xa3')]?0x1f4:_0x2b239c[_0x0aff('0xa4')]||0x1f4;logger['error'](_0x2b239c['stack']);delete _0x2b239c[_0x0aff('0x26')];if(_0x3692a4===0x191){_0x3692a4=0x190;}_0x3586b2[_0x0aff('0x17')](_0x3692a4)[_0x0aff('0xa5')](_0x5c56c2[_0x0aff('0x2d')]['test']?{'message':_0x0aff('0xa6'),'statusCode':_0x2b239c[_0x0aff('0xa4')]}:_0x2b239c);});};function createFieldObject(_0x451f5e,_0x324453,_0x466234,_0x555fa0,_0x53673f,_0x13677d){return new Promise(function(_0x57470c,_0x122c47){var _0x5ef2f2={'id':_0x555fa0,'name':_0x53673f,'custom':_0x13677d};if(_0x466234===_0x0aff('0xa7')){_0x5ef2f2[_0x0aff('0x3a')]=[{'name':_0x0aff('0xa8'),'value':'true'},{'name':_0x0aff('0xa9'),'value':'false'}];_0x57470c(_0x5ef2f2);}else{var _0x407279={'method':_0x0aff('0x96'),'uri':_0x451f5e+'sys_choice?sysparm_query=name=incident^element='+_0x555fa0,'auth':_0x324453,'json':!![]};return rp(_0x407279)[_0x0aff('0x3c')](function(_0x43931d){var _0x5767f4=[];if(_0x43931d['result']['length']>0x0){_0x43931d[_0x0aff('0xaa')][_0x0aff('0x9d')](function(_0x2b83b3){if(_0x2b83b3[_0x0aff('0xab')]===_0x0aff('0xac')){var _0x4c26db={'name':_0x2b83b3[_0x0aff('0x9f')],'value':_0x2b83b3[_0x0aff('0xad')]};_0x5767f4[_0x0aff('0xae')](_0x4c26db);}});}_0x5ef2f2['options']=_0x5767f4;if(_0x5ef2f2[_0x0aff('0x3a')][_0x0aff('0x41')]>0x0){_0x57470c(_0x5ef2f2);}else{if(_0x13677d==![]){_0x57470c();}else{_0x57470c(_0x5ef2f2);}}});}});} \ No newline at end of file +var _0xb7c2=['opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','sys_id','contact_type','reopened_by','incident_state','problem_id','company','activity_due','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','location','category','password','email','remoteUri','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','ServiceNow\x20error:\x20','statusCode','error','test','Wrong\x20credentials','boolean','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','where','pick','filter','merge','options','includeAll','include','rows','show','params','find','catch','create','body','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','getSubjects','channel','Descriptions','ServicenowField','Subjects','getFields','knowledge','close_code','notify','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','hold_reason','approval_history','number','sys_updated_by'];(function(_0x586b36,_0x2020f7){var _0x3354ff=function(_0x5bb74e){while(--_0x5bb74e){_0x586b36['push'](_0x586b36['shift']());}};_0x3354ff(++_0x2020f7);}(_0xb7c2,0x10a));var _0x2b7c=function(_0x3c3430,_0x40d55c){_0x3c3430=_0x3c3430-0x0;var _0x1bfb82=_0xb7c2[_0x3c3430];return _0x1bfb82;};'use strict';var emlformat=require(_0x2b7c('0x0'));var rimraf=require(_0x2b7c('0x1'));var zipdir=require(_0x2b7c('0x2'));var jsonpatch=require(_0x2b7c('0x3'));var rp=require(_0x2b7c('0x4'));var moment=require('moment');var BPromise=require(_0x2b7c('0x5'));var Mustache=require('mustache');var util=require(_0x2b7c('0x6'));var path=require(_0x2b7c('0x7'));var sox=require(_0x2b7c('0x8'));var csv=require(_0x2b7c('0x9'));var ejs=require(_0x2b7c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b7c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b7c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2b7c('0x9'));var querystring=require(_0x2b7c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2b7c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2b7c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b7c('0x10'))(_0x2b7c('0x11'));var utils=require(_0x2b7c('0x12'));var config=require(_0x2b7c('0x13'));var licenseUtil=require(_0x2b7c('0x14'));var db=require(_0x2b7c('0x15'))['db'];var integrations=require(_0x2b7c('0x16'));function respondWithStatusCode(_0x1b0191,_0x5cddd1){_0x5cddd1=_0x5cddd1||0xcc;return function(_0x551963){if(_0x551963){return _0x1b0191[_0x2b7c('0x17')](_0x5cddd1);}return _0x1b0191['status'](_0x5cddd1)[_0x2b7c('0x18')]();};}function respondWithResult(_0x157344,_0x5e97c9){_0x5e97c9=_0x5e97c9||0xc8;return function(_0x5322bb){if(_0x5322bb){return _0x157344[_0x2b7c('0x19')](_0x5e97c9)[_0x2b7c('0x1a')](_0x5322bb);}};}function respondWithFilteredResult(_0x116e71,_0x34f909){return function(_0x1c0bdb){if(_0x1c0bdb){var _0x4dba1f=typeof _0x34f909['offset']==='undefined'&&typeof _0x34f909['limit']===_0x2b7c('0x1b');var _0x125c7c=_0x1c0bdb[_0x2b7c('0x1c')];var _0x5bc4aa=_0x4dba1f?0x0:_0x34f909['offset'];var _0x19c240=_0x4dba1f?_0x1c0bdb['count']:_0x34f909['offset']+_0x34f909[_0x2b7c('0x1d')];var _0x309f60;if(_0x19c240>=_0x125c7c){_0x19c240=_0x125c7c;_0x309f60=0xc8;}else{_0x309f60=0xce;}_0x116e71['status'](_0x309f60);return _0x116e71[_0x2b7c('0x1e')](_0x2b7c('0x1f'),_0x5bc4aa+'-'+_0x19c240+'/'+_0x125c7c)[_0x2b7c('0x1a')](_0x1c0bdb);}return null;};}function patchUpdates(_0xf1436a){return function(_0x3166b0){try{jsonpatch[_0x2b7c('0x20')](_0x3166b0,_0xf1436a,!![]);}catch(_0x43f9b5){return BPromise[_0x2b7c('0x21')](_0x43f9b5);}return _0x3166b0[_0x2b7c('0x22')]();};}function saveUpdates(_0x384ac3,_0x1537b9){return function(_0x396af9){if(_0x396af9){return _0x396af9[_0x2b7c('0x23')](_0x384ac3)[_0x2b7c('0x24')](function(_0x4437d1){return _0x4437d1;});}return null;};}function removeEntity(_0x18cf63,_0x2f5d2d){return function(_0x396e11){if(_0x396e11){return _0x396e11[_0x2b7c('0x25')]()[_0x2b7c('0x24')](function(){_0x18cf63[_0x2b7c('0x19')](0xcc)[_0x2b7c('0x18')]();});}};}function handleEntityNotFound(_0x11443f,_0x48ca9b){return function(_0x235d50){if(!_0x235d50){_0x11443f[_0x2b7c('0x17')](0x194);}return _0x235d50;};}function handleError(_0x392fc6,_0x3ce214){_0x3ce214=_0x3ce214||0x1f4;return function(_0x47f8ae){logger['error'](_0x47f8ae[_0x2b7c('0x26')]);if(_0x47f8ae[_0x2b7c('0x27')]){delete _0x47f8ae[_0x2b7c('0x27')];}_0x392fc6[_0x2b7c('0x19')](_0x3ce214)[_0x2b7c('0x28')](_0x47f8ae);};}exports[_0x2b7c('0x29')]=function(_0x173840,_0xfb3a3c){var _0x3d8ca={},_0x26a64d={},_0x5647b6={'count':0x0,'rows':[]};var _0x5ac08f=_[_0x2b7c('0x2a')](db[_0x2b7c('0x2b')][_0x2b7c('0x2c')],function(_0x3f7b7f){return{'name':_0x3f7b7f[_0x2b7c('0x2d')],'type':_0x3f7b7f[_0x2b7c('0x2e')][_0x2b7c('0x2f')]};});_0x26a64d[_0x2b7c('0x30')]=_['map'](_0x5ac08f,_0x2b7c('0x27'));_0x26a64d[_0x2b7c('0x31')]=_[_0x2b7c('0x32')](_0x173840[_0x2b7c('0x31')]);_0x26a64d[_0x2b7c('0x33')]=_[_0x2b7c('0x34')](_0x26a64d['model'],_0x26a64d['query']);_0x3d8ca[_0x2b7c('0x35')]=_['intersection'](_0x26a64d['model'],qs['fields'](_0x173840['query'][_0x2b7c('0x36')]));_0x3d8ca[_0x2b7c('0x35')]=_0x3d8ca[_0x2b7c('0x35')][_0x2b7c('0x37')]?_0x3d8ca[_0x2b7c('0x35')]:_0x26a64d[_0x2b7c('0x30')];if(!_0x173840[_0x2b7c('0x31')]['hasOwnProperty'](_0x2b7c('0x38'))){_0x3d8ca[_0x2b7c('0x1d')]=qs[_0x2b7c('0x1d')](_0x173840[_0x2b7c('0x31')][_0x2b7c('0x1d')]);_0x3d8ca['offset']=qs['offset'](_0x173840['query'][_0x2b7c('0x39')]);}_0x3d8ca[_0x2b7c('0x3a')]=qs['sort'](_0x173840['query']['sort']);_0x3d8ca[_0x2b7c('0x3b')]=qs['filters'](_[_0x2b7c('0x3c')](_0x173840['query'],_0x26a64d[_0x2b7c('0x33')]),_0x5ac08f);if(_0x173840['query'][_0x2b7c('0x3d')]){_0x3d8ca[_0x2b7c('0x3b')]=_[_0x2b7c('0x3e')](_0x3d8ca[_0x2b7c('0x3b')],{'$or':_[_0x2b7c('0x2a')](_0x5ac08f,function(_0x89e35){if(_0x89e35[_0x2b7c('0x2e')]!=='VIRTUAL'){var _0x3b818b={};_0x3b818b[_0x89e35[_0x2b7c('0x27')]]={'$like':'%'+_0x173840[_0x2b7c('0x31')][_0x2b7c('0x3d')]+'%'};return _0x3b818b;}})});}_0x3d8ca=_[_0x2b7c('0x3e')]({},_0x3d8ca,_0x173840[_0x2b7c('0x3f')]);var _0x440001={'where':_0x3d8ca[_0x2b7c('0x3b')]};return db[_0x2b7c('0x2b')][_0x2b7c('0x1c')](_0x440001)[_0x2b7c('0x24')](function(_0x3dc22f){_0x5647b6[_0x2b7c('0x1c')]=_0x3dc22f;if(_0x173840[_0x2b7c('0x31')][_0x2b7c('0x40')]){_0x3d8ca[_0x2b7c('0x41')]=[{'all':!![]}];}return db[_0x2b7c('0x2b')]['findAll'](_0x3d8ca);})[_0x2b7c('0x24')](function(_0x303dca){_0x5647b6[_0x2b7c('0x42')]=_0x303dca;return _0x5647b6;})[_0x2b7c('0x24')](respondWithFilteredResult(_0xfb3a3c,_0x3d8ca))['catch'](handleError(_0xfb3a3c,null));};exports[_0x2b7c('0x43')]=function(_0x54f749,_0x4c73ba){var _0x2ab218={'raw':![],'where':{'id':_0x54f749[_0x2b7c('0x44')]['id']}},_0x35590c={};_0x35590c[_0x2b7c('0x30')]=_[_0x2b7c('0x32')](db[_0x2b7c('0x2b')]['rawAttributes']);_0x35590c[_0x2b7c('0x31')]=_[_0x2b7c('0x32')](_0x54f749[_0x2b7c('0x31')]);_0x35590c[_0x2b7c('0x33')]=_[_0x2b7c('0x34')](_0x35590c['model'],_0x35590c['query']);_0x2ab218[_0x2b7c('0x35')]=_[_0x2b7c('0x34')](_0x35590c[_0x2b7c('0x30')],qs[_0x2b7c('0x36')](_0x54f749[_0x2b7c('0x31')][_0x2b7c('0x36')]));_0x2ab218['attributes']=_0x2ab218['attributes']['length']?_0x2ab218[_0x2b7c('0x35')]:_0x35590c[_0x2b7c('0x30')];if(_0x54f749[_0x2b7c('0x31')][_0x2b7c('0x40')]){_0x2ab218[_0x2b7c('0x41')]=[{'all':!![]}];}_0x2ab218=_['merge']({},_0x2ab218,_0x54f749[_0x2b7c('0x3f')]);return db['ServicenowAccount'][_0x2b7c('0x45')](_0x2ab218)[_0x2b7c('0x24')](handleEntityNotFound(_0x4c73ba,null))[_0x2b7c('0x24')](respondWithResult(_0x4c73ba,null))[_0x2b7c('0x46')](handleError(_0x4c73ba,null));};exports[_0x2b7c('0x47')]=function(_0xda6aad,_0x45b9c7){return db[_0x2b7c('0x2b')][_0x2b7c('0x47')](_0xda6aad[_0x2b7c('0x48')],{})[_0x2b7c('0x24')](respondWithResult(_0x45b9c7,0xc9))['catch'](handleError(_0x45b9c7,null));};exports[_0x2b7c('0x23')]=function(_0x209a1f,_0x4e9cf9){if(_0x209a1f[_0x2b7c('0x48')]['id']){delete _0x209a1f[_0x2b7c('0x48')]['id'];}return db[_0x2b7c('0x2b')][_0x2b7c('0x45')]({'where':{'id':_0x209a1f[_0x2b7c('0x44')]['id']}})[_0x2b7c('0x24')](handleEntityNotFound(_0x4e9cf9,null))[_0x2b7c('0x24')](saveUpdates(_0x209a1f[_0x2b7c('0x48')],null))[_0x2b7c('0x24')](respondWithResult(_0x4e9cf9,null))[_0x2b7c('0x46')](handleError(_0x4e9cf9,null));};exports['destroy']=function(_0x4da6b8,_0x143a0b){return db['ServicenowAccount'][_0x2b7c('0x45')]({'where':{'id':_0x4da6b8[_0x2b7c('0x44')]['id']}})[_0x2b7c('0x24')](handleEntityNotFound(_0x143a0b,null))[_0x2b7c('0x24')](removeEntity(_0x143a0b,null))[_0x2b7c('0x46')](handleError(_0x143a0b,null));};exports['getConfigurations']=function(_0x57b52b,_0x50a6af,_0xfc2adc){var _0x31edff={};var _0x23a882={};var _0x4a4da8;var _0x5e9c6b;return db[_0x2b7c('0x2b')][_0x2b7c('0x49')]({'where':{'id':_0x57b52b['params']['id']}})[_0x2b7c('0x24')](handleEntityNotFound(_0x50a6af,null))[_0x2b7c('0x24')](function(_0x43e092){if(_0x43e092){_0x4a4da8=_0x43e092;_0x23a882[_0x2b7c('0x30')]=_[_0x2b7c('0x32')](db[_0x2b7c('0x4a')][_0x2b7c('0x2c')]);_0x23a882['query']=_[_0x2b7c('0x32')](_0x57b52b[_0x2b7c('0x31')]);_0x23a882[_0x2b7c('0x33')]=_[_0x2b7c('0x34')](_0x23a882['model'],_0x23a882[_0x2b7c('0x31')]);_0x31edff[_0x2b7c('0x35')]=_[_0x2b7c('0x34')](_0x23a882[_0x2b7c('0x30')],qs['fields'](_0x57b52b[_0x2b7c('0x31')][_0x2b7c('0x36')]));_0x31edff[_0x2b7c('0x35')]=_0x31edff['attributes'][_0x2b7c('0x37')]?_0x31edff['attributes']:_0x23a882['model'];_0x31edff[_0x2b7c('0x3a')]=qs['sort'](_0x57b52b[_0x2b7c('0x31')]['sort']);_0x31edff[_0x2b7c('0x3b')]=qs[_0x2b7c('0x33')](_[_0x2b7c('0x3c')](_0x57b52b['query'],_0x23a882['filters']));if(_0x57b52b[_0x2b7c('0x31')][_0x2b7c('0x3d')]){_0x31edff[_0x2b7c('0x3b')]=_[_0x2b7c('0x3e')](_0x31edff[_0x2b7c('0x3b')],{'$or':_[_0x2b7c('0x2a')](_0x31edff[_0x2b7c('0x35')],function(_0xd5b567){var _0x479a12={};_0x479a12[_0xd5b567]={'$like':'%'+_0x57b52b[_0x2b7c('0x31')][_0x2b7c('0x3d')]+'%'};return _0x479a12;})});}_0x31edff=_[_0x2b7c('0x3e')]({},_0x31edff,_0x57b52b['options']);return _0x4a4da8[_0x2b7c('0x4b')](_0x31edff);}})['then'](function(_0x337f74){if(_0x337f74){_0x5e9c6b=_0x337f74[_0x2b7c('0x37')];if(!_0x57b52b[_0x2b7c('0x31')]['hasOwnProperty']('nolimit')){_0x31edff[_0x2b7c('0x1d')]=qs['limit'](_0x57b52b['query'][_0x2b7c('0x1d')]);_0x31edff[_0x2b7c('0x39')]=qs[_0x2b7c('0x39')](_0x57b52b[_0x2b7c('0x31')][_0x2b7c('0x39')]);}return _0x4a4da8[_0x2b7c('0x4b')](_0x31edff);}})[_0x2b7c('0x24')](function(_0x429937){if(_0x429937){return _0x429937?{'count':_0x5e9c6b,'rows':_0x429937}:null;}})[_0x2b7c('0x24')](respondWithResult(_0x50a6af,null))['catch'](handleError(_0x50a6af,null));};exports[_0x2b7c('0x4c')]=function(_0x5ab168,_0x4a6151,_0x57a7bf){if(_0x5ab168[_0x2b7c('0x48')]['id']){delete _0x5ab168[_0x2b7c('0x48')]['id'];}return db[_0x2b7c('0x2b')][_0x2b7c('0x49')]({'where':{'id':_0x5ab168[_0x2b7c('0x44')]['id']}})[_0x2b7c('0x24')](handleEntityNotFound(_0x4a6151,null))[_0x2b7c('0x24')](function(_0x7c9f24){if(_0x7c9f24){_0x5ab168['body']['AccountId']=_0x7c9f24['id'];_0x5ab168[_0x2b7c('0x48')]['Subjects']=integrations[_0x2b7c('0x4d')](_0x5ab168[_0x2b7c('0x48')][_0x2b7c('0x4e')],_0x5ab168['body'][_0x2b7c('0x2e')]);_0x5ab168[_0x2b7c('0x48')][_0x2b7c('0x4f')]=integrations['getDescriptions'](_0x5ab168[_0x2b7c('0x48')]['channel'],_0x5ab168['body'][_0x2b7c('0x2e')]);return db['ServicenowConfiguration'][_0x2b7c('0x47')](_0x5ab168[_0x2b7c('0x48')],{'include':[{'model':db[_0x2b7c('0x50')],'as':_0x2b7c('0x51')},{'model':db[_0x2b7c('0x50')],'as':'Descriptions'}]});}return null;})[_0x2b7c('0x24')](respondWithResult(_0x4a6151,null))[_0x2b7c('0x46')](handleError(_0x4a6151,null));};exports[_0x2b7c('0x52')]=function(_0x40978f,_0x43ff43,_0x5c1c9f){var _0x4b27ca=['made_sla','hold_reason',_0x2b7c('0x53'),'subcategory',_0x2b7c('0x54'),_0x2b7c('0x55'),'incident_state',_0x2b7c('0x56'),'category'];var _0x4deec0=[_0x2b7c('0x57'),'made_sla',_0x2b7c('0x58'),_0x2b7c('0x59'),_0x2b7c('0x5a'),_0x2b7c('0x5b'),'child_incidents',_0x2b7c('0x5c'),_0x2b7c('0x5d'),_0x2b7c('0x5e'),'resolved_by',_0x2b7c('0x5f'),_0x2b7c('0x60'),_0x2b7c('0x61'),_0x2b7c('0x62'),_0x2b7c('0x63'),'state',_0x2b7c('0x64'),'knowledge',_0x2b7c('0x3a'),_0x2b7c('0x65'),_0x2b7c('0x66'),_0x2b7c('0x67'),_0x2b7c('0x68'),_0x2b7c('0x69'),_0x2b7c('0x6a'),_0x2b7c('0x6b'),_0x2b7c('0x6c'),'priority',_0x2b7c('0x6d'),_0x2b7c('0x6e'),'time_worked',_0x2b7c('0x6f'),_0x2b7c('0x70'),_0x2b7c('0x71'),'group_list',_0x2b7c('0x72'),_0x2b7c('0x73'),_0x2b7c('0x74'),_0x2b7c('0x75'),_0x2b7c('0x76'),_0x2b7c('0x77'),_0x2b7c('0x78'),_0x2b7c('0x79'),_0x2b7c('0x54'),'correlation_display',_0x2b7c('0x7a'),'work_start',_0x2b7c('0x7b'),_0x2b7c('0x7c'),_0x2b7c('0x7d'),_0x2b7c('0x7e'),_0x2b7c('0x7f'),'notify',_0x2b7c('0x80'),_0x2b7c('0x81'),_0x2b7c('0x82'),'follow_up',_0x2b7c('0x83'),_0x2b7c('0x84'),_0x2b7c('0x85'),_0x2b7c('0x86'),_0x2b7c('0x87'),'urgency',_0x2b7c('0x88'),_0x2b7c('0x89'),'reassignment_count',_0x2b7c('0x8a'),'assigned_to',_0x2b7c('0x56'),_0x2b7c('0x8b'),_0x2b7c('0x8c'),'approval',_0x2b7c('0x8d'),_0x2b7c('0x8e'),_0x2b7c('0x8f'),'reopen_count',_0x2b7c('0x90'),_0x2b7c('0x91'),_0x2b7c('0x92'),_0x2b7c('0x93'),_0x2b7c('0x94'),_0x2b7c('0x95')];var _0x578abc='';var _0x2d395b='';var _0x99dba8=[];var _0x41bf5f='';var _0x56083e='';var _0x773766=[];var _0x2b2adc='';var _0x2ef194='';var _0x1f3553={};var _0x392f88='';return db[_0x2b7c('0x2b')]['findOne']({'where':{'id':_0x40978f[_0x2b7c('0x44')]['id']},'attributes':['id','username',_0x2b7c('0x96'),_0x2b7c('0x97'),_0x2b7c('0x98'),'serverUrl']})[_0x2b7c('0x24')](handleEntityNotFound(_0x43ff43,null))[_0x2b7c('0x24')](function(_0x3c7a05){if(_0x3c7a05){_0x392f88=_0x3c7a05[_0x2b7c('0x98')];var _0x84d013=_0x392f88['slice'](-0x1);if(_0x84d013==='/'){_0x392f88=_0x392f88['substring'](0x0,_0x392f88['lastIndexOf'](_0x84d013));}_0x2ef194=util[_0x2b7c('0x99')](_0x2b7c('0x9a'),_0x392f88);_0x2b2adc=util[_0x2b7c('0x99')]('%s/api/now/table/',_0x392f88);_0x1f3553={'user':_0x3c7a05['username'],'pass':_0x3c7a05['password']};var _0x45c57d={'method':_0x2b7c('0x9b'),'uri':_0x2ef194+_0x2b7c('0x9c'),'auth':_0x1f3553,'json':!![]};return rp(_0x45c57d);}})['then'](function(_0xd83ebb){if(_0xd83ebb[_0x2b7c('0x9d')]['length']>0x0){_0x578abc=_0xd83ebb[_0x2b7c('0x9d')];}console['log'](_0x2b7c('0x9e'),_0x578abc);_0x773766=[];_0x2d395b=Object[_0x2b7c('0x9f')]([],_0x578abc);_[_0x2b7c('0xa0')](_0x2d395b,function(_0x2db755){return!_0x4b27ca[_0x2b7c('0xa1')](_0x2db755['name']);});_0x2d395b['forEach'](function(_0x3cf3b0){var _0x119f42=createFieldObject(_0x2b2adc,_0x1f3553,_0x3cf3b0[_0x2b7c('0xa2')],_0x3cf3b0[_0x2b7c('0x27')],_0x3cf3b0[_0x2b7c('0xa3')],![]);_0x773766[_0x2b7c('0xa4')](_0x119f42);});return Promise['all'](_0x773766);})[_0x2b7c('0x24')](function(_0x246d66){_0x99dba8=_0x246d66;_0x41bf5f=Object[_0x2b7c('0x9f')]([],_0x578abc);console[_0x2b7c('0xa5')](_0x2b7c('0xa6'),_0x578abc);_[_0x2b7c('0xa0')](_0x41bf5f,function(_0x1244b5){return _0x4deec0[_0x2b7c('0xa1')](_0x1244b5[_0x2b7c('0x27')]);});console[_0x2b7c('0xa5')](_0x2b7c('0xa7'),_0x41bf5f);_0x773766=[];_0x41bf5f['forEach'](function(_0x7f2788){var _0x47f1f3=createFieldObject(_0x2b2adc,_0x1f3553,_0x7f2788[_0x2b7c('0xa2')],_0x7f2788[_0x2b7c('0x27')],_0x7f2788[_0x2b7c('0xa3')],!![]);_0x773766[_0x2b7c('0xa4')](_0x47f1f3);});return Promise[_0x2b7c('0xa8')](_0x773766);})[_0x2b7c('0x24')](function(_0x15c83a){_0x56083e=_0x15c83a;var _0x508e98=_0x99dba8['concat'](_0x56083e);return{'count':_0x508e98['length'],'rows':_0x508e98};})[_0x2b7c('0x24')](respondWithResult(_0x43ff43,null))['catch'](function(_0x398f82){console[_0x2b7c('0xa5')](_0x2b7c('0xa9')+_0x398f82);var _0x49839b=_0x40978f['query']['test']?0x1f4:_0x398f82[_0x2b7c('0xaa')]||0x1f4;logger[_0x2b7c('0xab')](_0x398f82[_0x2b7c('0x26')]);delete _0x398f82[_0x2b7c('0x27')];if(_0x49839b===0x191){_0x49839b=0x190;}_0x43ff43['status'](_0x49839b)[_0x2b7c('0x28')](_0x40978f['query'][_0x2b7c('0xac')]?{'message':_0x2b7c('0xad'),'statusCode':_0x398f82['statusCode']}:_0x398f82);});};function createFieldObject(_0x577c93,_0xe25618,_0x54a063,_0x3814e9,_0xa210fa,_0x496b84){return new Promise(function(_0x2a8ef0,_0x59c1d6){var _0x49604b={'id':_0x3814e9,'name':_0xa210fa,'custom':_0x496b84};if(_0x54a063===_0x2b7c('0xae')){_0x49604b['options']=[{'name':'True','value':_0x2b7c('0xaf')},{'name':_0x2b7c('0xb0'),'value':'false'}];_0x2a8ef0(_0x49604b);}else{var _0x4c5840={'method':'GET','uri':_0x577c93+_0x2b7c('0xb1')+_0x3814e9,'auth':_0xe25618,'json':!![]};return rp(_0x4c5840)[_0x2b7c('0x24')](function(_0x56fb64){var _0x4d30c4=[];if(_0x56fb64['result'][_0x2b7c('0x37')]>0x0){_0x56fb64[_0x2b7c('0x9d')]['forEach'](function(_0x47eac6){if(_0x47eac6[_0x2b7c('0xb2')]===_0x2b7c('0xb3')){var _0x17eba8={'name':_0x47eac6[_0x2b7c('0xa3')],'value':_0x47eac6[_0x2b7c('0xb4')]};_0x4d30c4[_0x2b7c('0xa4')](_0x17eba8);}});}_0x49604b[_0x2b7c('0x3f')]=_0x4d30c4;if(_0x49604b['options'][_0x2b7c('0x37')]>0x0){_0x2a8ef0(_0x49604b);}else{if(_0x496b84==![]){_0x2a8ef0();}else{_0x2a8ef0(_0x49604b);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index e75f5c5..26d091c 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','ServicenowAccount','int_servicenow_accounts'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0x5fc3[_0x16bb4b];return _0x8aeb84;};'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'));var integrations=require(_0x35fc('0x9'));module['exports']=function(_0x5754be,_0x19a0d1){return _0x5754be['define'](_0x35fc('0xa'),attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eb2=['request-promise','rimraf','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x268f32,_0x1aaa92){var _0x7f063f=function(_0x3c2892){while(--_0x3c2892){_0x268f32['push'](_0x268f32['shift']());}};_0x7f063f(++_0x1aaa92);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x2eb2[_0x4ae625];return _0x31accf;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x22eb('0x7'));module[_0x22eb('0x8')]=function(_0x35dd5b,_0x2a9850){return _0x35dd5b[_0x22eb('0x9')](_0x22eb('0xa'),attributes,{'tableName':_0x22eb('0xb'),'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 dae38c8..6602d9c 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 _0xc16a=['jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','map','then','catch','ShowServicenowAccount','find','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x476b61,_0x28400f){var _0x8afab7=function(_0x3e3393){while(--_0x3e3393){_0x476b61['push'](_0x476b61['shift']());}};_0x8afab7(++_0x28400f);}(_0xc16a,0x14c));var _0xac16=function(_0x424689,_0x3a4791){_0x424689=_0x424689-0x0;var _0x55099d=_0xc16a[_0x424689];return _0x55099d;};'use strict';var _=require(_0xac16('0x0'));var util=require(_0xac16('0x1'));var moment=require(_0xac16('0x2'));var BPromise=require(_0xac16('0x3'));var rs=require(_0xac16('0x4'));var fs=require('fs');var Redis=require(_0xac16('0x5'));var db=require(_0xac16('0x6'))['db'];var utils=require(_0xac16('0x7'));var logger=require(_0xac16('0x8'))('rpc');var config=require(_0xac16('0x9'));var jayson=require(_0xac16('0xa'));var client=jayson[_0xac16('0xb')][_0xac16('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x85ce55,_0x589f28,_0x50d53c){return new BPromise(function(_0x32dc18,_0x2f4013){return client[_0xac16('0xd')](_0x85ce55,_0x50d53c)['then'](function(_0x1e720b){logger[_0xac16('0xe')](_0xac16('0xf'),_0x589f28,'request\x20sent');logger[_0xac16('0x10')](_0xac16('0x11'),_0x589f28,'request\x20sent',JSON[_0xac16('0x12')](_0x1e720b));if(_0x1e720b[_0xac16('0x13')]){if(_0x1e720b['error'][_0xac16('0x14')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x589f28,_0x1e720b[_0xac16('0x13')][_0xac16('0x15')]);return _0x2f4013(_0x1e720b['error'][_0xac16('0x15')]);}logger['error'](_0xac16('0xf'),_0x589f28,_0x1e720b[_0xac16('0x13')][_0xac16('0x15')]);return _0x32dc18(_0x1e720b[_0xac16('0x13')][_0xac16('0x15')]);}else{logger[_0xac16('0xe')](_0xac16('0xf'),_0x589f28,_0xac16('0x16'));_0x32dc18(_0x1e720b[_0xac16('0x17')][_0xac16('0x15')]);}})['catch'](function(_0x3d7148){logger[_0xac16('0x13')](_0xac16('0xf'),_0x589f28,_0x3d7148);_0x2f4013(_0x3d7148);});});}exports[_0xac16('0x18')]=function(_0x56c413){var _0x927057=this;return new Promise(function(_0x1e05c2,_0x6099a3){return db[_0xac16('0x19')]['findAll']({'raw':_0x56c413['options']?_0x56c413[_0xac16('0x1a')][_0xac16('0x1b')]===undefined?!![]:![]:!![],'where':_0x56c413[_0xac16('0x1a')]?_0x56c413[_0xac16('0x1a')][_0xac16('0x1c')]||null:null,'attributes':_0x56c413['options']?_0x56c413['options'][_0xac16('0x1d')]||null:null,'limit':_0x56c413[_0xac16('0x1a')]?_0x56c413[_0xac16('0x1a')][_0xac16('0x1e')]||null:null,'include':_0x56c413[_0xac16('0x1a')]?_0x56c413[_0xac16('0x1a')][_0xac16('0x1f')]?_[_0xac16('0x20')](_0x56c413[_0xac16('0x1a')][_0xac16('0x1f')],function(_0x8762a7){return{'model':db[_0x8762a7['model']],'as':_0x8762a7['as'],'attributes':_0x8762a7[_0xac16('0x1d')],'include':_0x8762a7[_0xac16('0x1f')]?_[_0xac16('0x20')](_0x8762a7[_0xac16('0x1f')],function(_0x3422dd){return{'model':db[_0x3422dd['model']],'as':_0x3422dd['as'],'attributes':_0x3422dd[_0xac16('0x1d')],'include':_0x3422dd[_0xac16('0x1f')]?_[_0xac16('0x20')](_0x3422dd[_0xac16('0x1f')],function(_0xf57794){return{'model':db[_0xf57794['model']],'as':_0xf57794['as'],'attributes':_0xf57794[_0xac16('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xac16('0x21')](function(_0x212b3a){logger['info'](_0xac16('0x18'),_0x56c413);logger[_0xac16('0x10')](_0xac16('0x18'),_0x56c413,JSON[_0xac16('0x12')](_0x212b3a));_0x1e05c2(_0x212b3a);})[_0xac16('0x22')](function(_0x53a23c){logger[_0xac16('0x13')](_0xac16('0x18'),_0x53a23c[_0xac16('0x15')],_0x56c413);_0x6099a3(_0x927057[_0xac16('0x13')](0x1f4,_0x53a23c[_0xac16('0x15')]));});});};exports[_0xac16('0x23')]=function(_0x584327){var _0x596355=this;return new Promise(function(_0x1cf430,_0x36251f){return db[_0xac16('0x19')][_0xac16('0x24')]({'raw':_0x584327[_0xac16('0x1a')]?_0x584327['options'][_0xac16('0x1b')]===undefined?!![]:![]:!![],'where':_0x584327[_0xac16('0x1a')]?_0x584327[_0xac16('0x1a')][_0xac16('0x1c')]||null:null,'attributes':_0x584327[_0xac16('0x1a')]?_0x584327[_0xac16('0x1a')]['attributes']||null:null,'include':_0x584327[_0xac16('0x1a')]?_0x584327['options'][_0xac16('0x1f')]?_[_0xac16('0x20')](_0x584327['options']['include'],function(_0x519542){return{'model':db[_0x519542['model']],'as':_0x519542['as'],'attributes':_0x519542[_0xac16('0x1d')],'include':_0x519542['include']?_[_0xac16('0x20')](_0x519542[_0xac16('0x1f')],function(_0x3941fd){return{'model':db[_0x3941fd['model']],'as':_0x3941fd['as'],'attributes':_0x3941fd[_0xac16('0x1d')],'include':_0x3941fd[_0xac16('0x1f')]?_['map'](_0x3941fd['include'],function(_0x16890f){return{'model':db[_0x16890f[_0xac16('0x25')]],'as':_0x16890f['as'],'attributes':_0x16890f[_0xac16('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4daa8b){logger[_0xac16('0xe')]('ShowServicenowAccount',_0x584327);logger[_0xac16('0x10')](_0xac16('0x23'),_0x584327,JSON[_0xac16('0x12')](_0x4daa8b));_0x1cf430(_0x4daa8b);})['catch'](function(_0x2b7dbb){logger[_0xac16('0x13')](_0xac16('0x23'),_0x2b7dbb[_0xac16('0x15')],_0x584327);_0x36251f(_0x596355['error'](0x1f4,_0x2b7dbb[_0xac16('0x15')]));});});}; \ No newline at end of file +var _0x4ec5=['model','stringify','ShowServicenowAccount','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','GetServicenowAccount','ServicenowAccount','findAll','where','options','attributes','include','map'];(function(_0x211aac,_0x5c5ef9){var _0x54d3bb=function(_0x394762){while(--_0x394762){_0x211aac['push'](_0x211aac['shift']());}};_0x54d3bb(++_0x5c5ef9);}(_0x4ec5,0x9f));var _0x54ec=function(_0x57e7f8,_0x328bcd){_0x57e7f8=_0x57e7f8-0x0;var _0x39f93b=_0x4ec5[_0x57e7f8];return _0x39f93b;};'use strict';var _=require(_0x54ec('0x0'));var util=require(_0x54ec('0x1'));var moment=require(_0x54ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x54ec('0x3'));var fs=require('fs');var Redis=require(_0x54ec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x54ec('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x54ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x54ec('0x7')][_0x54ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5eea6c,_0x1359e0,_0x35d299){return new BPromise(function(_0x3b46d5,_0x31e21b){return client['request'](_0x5eea6c,_0x35d299)[_0x54ec('0x9')](function(_0xeb5a70){logger[_0x54ec('0xa')](_0x54ec('0xb'),_0x1359e0,'request\x20sent');logger[_0x54ec('0xc')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1359e0,'request\x20sent',JSON['stringify'](_0xeb5a70));if(_0xeb5a70['error']){if(_0xeb5a70[_0x54ec('0xd')][_0x54ec('0xe')]===0x1f4){logger[_0x54ec('0xd')](_0x54ec('0xb'),_0x1359e0,_0xeb5a70[_0x54ec('0xd')][_0x54ec('0xf')]);return _0x31e21b(_0xeb5a70[_0x54ec('0xd')][_0x54ec('0xf')]);}logger[_0x54ec('0xd')](_0x54ec('0xb'),_0x1359e0,_0xeb5a70[_0x54ec('0xd')][_0x54ec('0xf')]);return _0x3b46d5(_0xeb5a70['error']['message']);}else{logger[_0x54ec('0xa')](_0x54ec('0xb'),_0x1359e0,_0x54ec('0x10'));_0x3b46d5(_0xeb5a70[_0x54ec('0x11')][_0x54ec('0xf')]);}})[_0x54ec('0x12')](function(_0x24fec3){logger[_0x54ec('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x1359e0,_0x24fec3);_0x31e21b(_0x24fec3);});});}exports[_0x54ec('0x13')]=function(_0x198727){var _0x5a7dc7=this;return new Promise(function(_0x25cede,_0x19e0d1){return db[_0x54ec('0x14')][_0x54ec('0x15')]({'raw':_0x198727['options']?_0x198727['options']['raw']===undefined?!![]:![]:!![],'where':_0x198727['options']?_0x198727['options'][_0x54ec('0x16')]||null:null,'attributes':_0x198727[_0x54ec('0x17')]?_0x198727[_0x54ec('0x17')][_0x54ec('0x18')]||null:null,'limit':_0x198727[_0x54ec('0x17')]?_0x198727[_0x54ec('0x17')]['limit']||null:null,'include':_0x198727[_0x54ec('0x17')]?_0x198727[_0x54ec('0x17')][_0x54ec('0x19')]?_[_0x54ec('0x1a')](_0x198727[_0x54ec('0x17')][_0x54ec('0x19')],function(_0x195c0c){return{'model':db[_0x195c0c['model']],'as':_0x195c0c['as'],'attributes':_0x195c0c[_0x54ec('0x18')],'include':_0x195c0c['include']?_['map'](_0x195c0c[_0x54ec('0x19')],function(_0x5477da){return{'model':db[_0x5477da['model']],'as':_0x5477da['as'],'attributes':_0x5477da[_0x54ec('0x18')],'include':_0x5477da['include']?_[_0x54ec('0x1a')](_0x5477da['include'],function(_0x80cf77){return{'model':db[_0x80cf77[_0x54ec('0x1b')]],'as':_0x80cf77['as'],'attributes':_0x80cf77['attributes']};}):[]};}):[]};}):[]:[]})[_0x54ec('0x9')](function(_0x50695f){logger[_0x54ec('0xa')](_0x54ec('0x13'),_0x198727);logger[_0x54ec('0xc')]('GetServicenowAccount',_0x198727,JSON[_0x54ec('0x1c')](_0x50695f));_0x25cede(_0x50695f);})[_0x54ec('0x12')](function(_0x4bcef1){logger[_0x54ec('0xd')]('GetServicenowAccount',_0x4bcef1[_0x54ec('0xf')],_0x198727);_0x19e0d1(_0x5a7dc7[_0x54ec('0xd')](0x1f4,_0x4bcef1['message']));});});};exports[_0x54ec('0x1d')]=function(_0x321612){var _0x591ced=this;return new Promise(function(_0x524f54,_0x2cb121){return db[_0x54ec('0x14')]['find']({'raw':_0x321612['options']?_0x321612[_0x54ec('0x17')][_0x54ec('0x1e')]===undefined?!![]:![]:!![],'where':_0x321612[_0x54ec('0x17')]?_0x321612['options'][_0x54ec('0x16')]||null:null,'attributes':_0x321612[_0x54ec('0x17')]?_0x321612[_0x54ec('0x17')][_0x54ec('0x18')]||null:null,'include':_0x321612[_0x54ec('0x17')]?_0x321612['options'][_0x54ec('0x19')]?_[_0x54ec('0x1a')](_0x321612[_0x54ec('0x17')]['include'],function(_0x158c5d){return{'model':db[_0x158c5d['model']],'as':_0x158c5d['as'],'attributes':_0x158c5d[_0x54ec('0x18')],'include':_0x158c5d['include']?_[_0x54ec('0x1a')](_0x158c5d[_0x54ec('0x19')],function(_0x5577e6){return{'model':db[_0x5577e6[_0x54ec('0x1b')]],'as':_0x5577e6['as'],'attributes':_0x5577e6[_0x54ec('0x18')],'include':_0x5577e6[_0x54ec('0x19')]?_[_0x54ec('0x1a')](_0x5577e6[_0x54ec('0x19')],function(_0x5914ba){return{'model':db[_0x5914ba[_0x54ec('0x1b')]],'as':_0x5914ba['as'],'attributes':_0x5914ba[_0x54ec('0x18')]};}):[]};}):[]};}):[]:[]})[_0x54ec('0x9')](function(_0x58e5b8){logger[_0x54ec('0xa')]('ShowServicenowAccount',_0x321612);logger[_0x54ec('0xc')]('ShowServicenowAccount',_0x321612,JSON[_0x54ec('0x1c')](_0x58e5b8));_0x524f54(_0x58e5b8);})['catch'](function(_0x3b3cd3){logger[_0x54ec('0xd')](_0x54ec('0x1d'),_0x3b3cd3[_0x54ec('0xf')],_0x321612);_0x2cb121(_0x591ced[_0x54ec('0xd')](0x1f4,_0x3b3cd3['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index cf3a115..935e2fa 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 _0x3623=['getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','/:id','show','/:id/fields','getFields','/:id/subjects','isAuthenticated'];(function(_0x2d8d69,_0x8e47ff){var _0x39ae22=function(_0xd7935e){while(--_0xd7935e){_0x2d8d69['push'](_0x2d8d69['shift']());}};_0x39ae22(++_0x8e47ff);}(_0x3623,0x149));var _0x3362=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0x3623[_0x4c7d8b];return _0x187158;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3362('0x0'));var timeout=require(_0x3362('0x1'));var express=require(_0x3362('0x2'));var router=express[_0x3362('0x3')]();var fs_extra=require(_0x3362('0x4'));var auth=require(_0x3362('0x5'));var interaction=require(_0x3362('0x6'));var config=require(_0x3362('0x7'));var controller=require(_0x3362('0x8'));router[_0x3362('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3362('0x9')](_0x3362('0xa'),auth['isAuthenticated'](),controller[_0x3362('0xb')]);router['get'](_0x3362('0xc'),auth['isAuthenticated'](),controller[_0x3362('0xd')]);router['get'](_0x3362('0xe'),auth[_0x3362('0xf')](),controller[_0x3362('0x10')]);router[_0x3362('0x9')](_0x3362('0x11'),auth['isAuthenticated'](),controller[_0x3362('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3362('0x13')]);router[_0x3362('0x14')](_0x3362('0xa'),auth[_0x3362('0xf')](),controller[_0x3362('0x15')]);router[_0x3362('0x16')](_0x3362('0xa'),auth[_0x3362('0xf')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7909=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated'];(function(_0x59befa,_0x4af99b){var _0x1dd63d=function(_0x4c1df4){while(--_0x4c1df4){_0x59befa['push'](_0x59befa['shift']());}};_0x1dd63d(++_0x4af99b);}(_0x7909,0x140));var _0x9790=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7909[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x9790('0x0'));var util=require('util');var path=require(_0x9790('0x1'));var timeout=require(_0x9790('0x2'));var express=require(_0x9790('0x3'));var router=express[_0x9790('0x4')]();var fs_extra=require(_0x9790('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9790('0x6'));var controller=require(_0x9790('0x7'));router[_0x9790('0x8')]('/',auth[_0x9790('0x9')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9790('0xa')]);router[_0x9790('0x8')](_0x9790('0xb'),auth[_0x9790('0x9')](),controller[_0x9790('0xc')]);router[_0x9790('0x8')](_0x9790('0xd'),auth[_0x9790('0x9')](),controller[_0x9790('0xe')]);router[_0x9790('0x8')](_0x9790('0xf'),auth[_0x9790('0x9')](),controller[_0x9790('0x10')]);router['post']('/',auth[_0x9790('0x9')](),controller['create']);router[_0x9790('0x11')](_0x9790('0x12'),auth[_0x9790('0x9')](),controller[_0x9790('0x13')]);router['delete']('/:id',auth[_0x9790('0x9')](),controller[_0x9790('0x14')]);module[_0x9790('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 6504c2a..c261c8d 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 _0x840f=['STRING','sequelize','exports'];(function(_0x5b8b87,_0x449a20){var _0x2c1b64=function(_0x1846a5){while(--_0x1846a5){_0x5b8b87['push'](_0x5b8b87['shift']());}};_0x2c1b64(++_0x449a20);}(_0x840f,0xca));var _0xf840=function(_0x17cffd,_0x2e92ca){_0x17cffd=_0x17cffd-0x0;var _0x54b404=_0x840f[_0x17cffd];return _0x54b404;};'use strict';var Sequelize=require(_0xf840('0x0'));module[_0xf840('0x1')]={'name':{'type':Sequelize[_0xf840('0x2')]},'description':{'type':Sequelize[_0xf840('0x2')]}}; \ No newline at end of file +var _0x648a=['exports','STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x648a,0x116));var _0xa648=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x648a[_0x1b6186];return _0x186121;};'use strict';var Sequelize=require(_0xa648('0x0'));module[_0xa648('0x1')]={'name':{'type':Sequelize[_0xa648('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 4e3bdbf..a291685 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 _0x64d6=['Content-Range','json','save','then','destroy','error','stack','name','send','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','catch','show','keys','merge','find','create','body','params','findOne','ServicenowField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set'];(function(_0x21b7ea,_0x11ad3f){var _0x2290c9=function(_0x56ec67){while(--_0x56ec67){_0x21b7ea['push'](_0x21b7ea['shift']());}};_0x2290c9(++_0x11ad3f);}(_0x64d6,0x7f));var _0x664d=function(_0x1dbebb,_0x11508a){_0x1dbebb=_0x1dbebb-0x0;var _0x49537c=_0x64d6[_0x1dbebb];return _0x49537c;};'use strict';var emlformat=require(_0x664d('0x0'));var rimraf=require(_0x664d('0x1'));var zipdir=require(_0x664d('0x2'));var jsonpatch=require(_0x664d('0x3'));var rp=require(_0x664d('0x4'));var moment=require(_0x664d('0x5'));var BPromise=require(_0x664d('0x6'));var Mustache=require(_0x664d('0x7'));var util=require(_0x664d('0x8'));var path=require(_0x664d('0x9'));var sox=require(_0x664d('0xa'));var csv=require(_0x664d('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x664d('0xc'));var _=require(_0x664d('0xd'));var squel=require('squel');var crypto=require(_0x664d('0xe'));var jsforce=require(_0x664d('0xf'));var deskjs=require(_0x664d('0x10'));var toCsv=require(_0x664d('0xb'));var querystring=require(_0x664d('0x11'));var Papa=require(_0x664d('0x12'));var Redis=require(_0x664d('0x13'));var authService=require(_0x664d('0x14'));var qs=require(_0x664d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x664d('0x16'));var logger=require(_0x664d('0x17'))(_0x664d('0x18'));var utils=require('../../config/utils');var config=require(_0x664d('0x19'));var licenseUtil=require(_0x664d('0x1a'));var db=require(_0x664d('0x1b'))['db'];function respondWithStatusCode(_0x179656,_0x5d054a){_0x5d054a=_0x5d054a||0xcc;return function(_0x98b158){if(_0x98b158){return _0x179656['sendStatus'](_0x5d054a);}return _0x179656[_0x664d('0x1c')](_0x5d054a)[_0x664d('0x1d')]();};}function respondWithResult(_0xcae5ea,_0x25e559){_0x25e559=_0x25e559||0xc8;return function(_0x4b409a){if(_0x4b409a){return _0xcae5ea[_0x664d('0x1c')](_0x25e559)['json'](_0x4b409a);}};}function respondWithFilteredResult(_0x58c156,_0x1782a9){return function(_0x4b5375){if(_0x4b5375){var _0x4183b2=typeof _0x1782a9[_0x664d('0x1e')]===_0x664d('0x1f')&&typeof _0x1782a9[_0x664d('0x20')]===_0x664d('0x1f');var _0x3f5fae=_0x4b5375[_0x664d('0x21')];var _0x51d0b0=_0x4183b2?0x0:_0x1782a9[_0x664d('0x1e')];var _0x592435=_0x4183b2?_0x4b5375[_0x664d('0x21')]:_0x1782a9['offset']+_0x1782a9[_0x664d('0x20')];var _0x14ed7e;if(_0x592435>=_0x3f5fae){_0x592435=_0x3f5fae;_0x14ed7e=0xc8;}else{_0x14ed7e=0xce;}_0x58c156[_0x664d('0x1c')](_0x14ed7e);return _0x58c156[_0x664d('0x22')](_0x664d('0x23'),_0x51d0b0+'-'+_0x592435+'/'+_0x3f5fae)[_0x664d('0x24')](_0x4b5375);}return null;};}function patchUpdates(_0x1b5dd5){return function(_0x16e712){try{jsonpatch['apply'](_0x16e712,_0x1b5dd5,!![]);}catch(_0x4cb2da){return BPromise['reject'](_0x4cb2da);}return _0x16e712[_0x664d('0x25')]();};}function saveUpdates(_0x44607a,_0x3bf60f){return function(_0x34198d){if(_0x34198d){return _0x34198d['update'](_0x44607a)[_0x664d('0x26')](function(_0x179f02){return _0x179f02;});}return null;};}function removeEntity(_0x22cbce,_0x4383b2){return function(_0x4ebc5c){if(_0x4ebc5c){return _0x4ebc5c[_0x664d('0x27')]()[_0x664d('0x26')](function(){_0x22cbce[_0x664d('0x1c')](0xcc)[_0x664d('0x1d')]();});}};}function handleEntityNotFound(_0x4a89c2,_0x4bc7f4){return function(_0x1e17b2){if(!_0x1e17b2){_0x4a89c2['sendStatus'](0x194);}return _0x1e17b2;};}function handleError(_0x5073f4,_0x375b5f){_0x375b5f=_0x375b5f||0x1f4;return function(_0x53737c){logger[_0x664d('0x28')](_0x53737c[_0x664d('0x29')]);if(_0x53737c[_0x664d('0x2a')]){delete _0x53737c[_0x664d('0x2a')];}_0x5073f4['status'](_0x375b5f)[_0x664d('0x2b')](_0x53737c);};}exports['index']=function(_0x47d0ac,_0x40e559){var _0x4e4390={},_0x25811c={},_0x50e253={'count':0x0,'rows':[]};var _0x1d88cc=_['map'](db[_0x664d('0x2c')][_0x664d('0x2d')],function(_0x3ae6f0){return{'name':_0x3ae6f0[_0x664d('0x2e')],'type':_0x3ae6f0[_0x664d('0x2f')][_0x664d('0x30')]};});_0x25811c[_0x664d('0x31')]=_[_0x664d('0x32')](_0x1d88cc,_0x664d('0x2a'));_0x25811c[_0x664d('0x33')]=_['keys'](_0x47d0ac[_0x664d('0x33')]);_0x25811c[_0x664d('0x34')]=_[_0x664d('0x35')](_0x25811c[_0x664d('0x31')],_0x25811c[_0x664d('0x33')]);_0x4e4390[_0x664d('0x36')]=_[_0x664d('0x35')](_0x25811c[_0x664d('0x31')],qs[_0x664d('0x37')](_0x47d0ac['query']['fields']));_0x4e4390[_0x664d('0x36')]=_0x4e4390['attributes'][_0x664d('0x38')]?_0x4e4390[_0x664d('0x36')]:_0x25811c[_0x664d('0x31')];if(!_0x47d0ac[_0x664d('0x33')][_0x664d('0x39')](_0x664d('0x3a'))){_0x4e4390['limit']=qs['limit'](_0x47d0ac[_0x664d('0x33')][_0x664d('0x20')]);_0x4e4390['offset']=qs['offset'](_0x47d0ac[_0x664d('0x33')]['offset']);}_0x4e4390[_0x664d('0x3b')]=qs[_0x664d('0x3c')](_0x47d0ac[_0x664d('0x33')][_0x664d('0x3c')]);_0x4e4390[_0x664d('0x3d')]=qs['filters'](_[_0x664d('0x3e')](_0x47d0ac[_0x664d('0x33')],_0x25811c[_0x664d('0x34')]),_0x1d88cc);if(_0x47d0ac[_0x664d('0x33')][_0x664d('0x3f')]){_0x4e4390[_0x664d('0x3d')]=_['merge'](_0x4e4390[_0x664d('0x3d')],{'$or':_[_0x664d('0x32')](_0x1d88cc,function(_0x253cc7){if(_0x253cc7[_0x664d('0x2f')]!=='VIRTUAL'){var _0x404678={};_0x404678[_0x253cc7[_0x664d('0x2a')]]={'$like':'%'+_0x47d0ac[_0x664d('0x33')][_0x664d('0x3f')]+'%'};return _0x404678;}})});}_0x4e4390=_['merge']({},_0x4e4390,_0x47d0ac[_0x664d('0x40')]);var _0x1e31c6={'where':_0x4e4390['where']};return db[_0x664d('0x2c')][_0x664d('0x21')](_0x1e31c6)[_0x664d('0x26')](function(_0x48d5b6){_0x50e253['count']=_0x48d5b6;if(_0x47d0ac[_0x664d('0x33')][_0x664d('0x41')]){_0x4e4390[_0x664d('0x42')]=[{'all':!![]}];}return db[_0x664d('0x2c')][_0x664d('0x43')](_0x4e4390);})['then'](function(_0x4fa0b4){_0x50e253['rows']=_0x4fa0b4;return _0x50e253;})[_0x664d('0x26')](respondWithFilteredResult(_0x40e559,_0x4e4390))[_0x664d('0x44')](handleError(_0x40e559,null));};exports[_0x664d('0x45')]=function(_0xc5a445,_0x37702f){var _0x176257={'raw':![],'where':{'id':_0xc5a445['params']['id']}},_0x1a2766={};_0x1a2766[_0x664d('0x31')]=_[_0x664d('0x46')](db['ServicenowConfiguration'][_0x664d('0x2d')]);_0x1a2766[_0x664d('0x33')]=_[_0x664d('0x46')](_0xc5a445[_0x664d('0x33')]);_0x1a2766[_0x664d('0x34')]=_['intersection'](_0x1a2766[_0x664d('0x31')],_0x1a2766['query']);_0x176257['attributes']=_[_0x664d('0x35')](_0x1a2766[_0x664d('0x31')],qs['fields'](_0xc5a445[_0x664d('0x33')][_0x664d('0x37')]));_0x176257[_0x664d('0x36')]=_0x176257[_0x664d('0x36')][_0x664d('0x38')]?_0x176257[_0x664d('0x36')]:_0x1a2766[_0x664d('0x31')];if(_0xc5a445[_0x664d('0x33')]['includeAll']){_0x176257['include']=[{'all':!![]}];}_0x176257=_[_0x664d('0x47')]({},_0x176257,_0xc5a445[_0x664d('0x40')]);return db[_0x664d('0x2c')][_0x664d('0x48')](_0x176257)['then'](handleEntityNotFound(_0x37702f,null))[_0x664d('0x26')](respondWithResult(_0x37702f,null))[_0x664d('0x44')](handleError(_0x37702f,null));};exports[_0x664d('0x49')]=function(_0x2ee684,_0x26ba88){return db[_0x664d('0x2c')][_0x664d('0x49')](_0x2ee684['body'],{})[_0x664d('0x26')](respondWithResult(_0x26ba88,0xc9))[_0x664d('0x44')](handleError(_0x26ba88,null));};exports['update']=function(_0x3e13e2,_0x142c98){if(_0x3e13e2['body']['id']){delete _0x3e13e2[_0x664d('0x4a')]['id'];}return db[_0x664d('0x2c')]['find']({'where':{'id':_0x3e13e2[_0x664d('0x4b')]['id']}})[_0x664d('0x26')](handleEntityNotFound(_0x142c98,null))[_0x664d('0x26')](saveUpdates(_0x3e13e2[_0x664d('0x4a')],null))[_0x664d('0x26')](respondWithResult(_0x142c98,null))['catch'](handleError(_0x142c98,null));};exports['destroy']=function(_0x3079c4,_0x454aca){return db['ServicenowConfiguration']['find']({'where':{'id':_0x3079c4[_0x664d('0x4b')]['id']}})[_0x664d('0x26')](handleEntityNotFound(_0x454aca,null))[_0x664d('0x26')](removeEntity(_0x454aca,null))['catch'](handleError(_0x454aca,null));};exports['getFields']=function(_0x557db5,_0x283c64,_0x555695){var _0x2851c2={};var _0x106d09={};var _0x26233f;var _0x5da865;return db[_0x664d('0x2c')][_0x664d('0x4c')]({'where':{'id':_0x557db5['params']['id']}})[_0x664d('0x26')](handleEntityNotFound(_0x283c64,null))['then'](function(_0x5342b0){if(_0x5342b0){_0x26233f=_0x5342b0;_0x106d09[_0x664d('0x31')]=_[_0x664d('0x46')](db[_0x664d('0x4d')][_0x664d('0x2d')]);_0x106d09[_0x664d('0x33')]=_[_0x664d('0x46')](_0x557db5[_0x664d('0x33')]);_0x106d09['filters']=_[_0x664d('0x35')](_0x106d09[_0x664d('0x31')],_0x106d09['query']);_0x2851c2[_0x664d('0x36')]=_[_0x664d('0x35')](_0x106d09[_0x664d('0x31')],qs['fields'](_0x557db5['query'][_0x664d('0x37')]));_0x2851c2[_0x664d('0x36')]=_0x2851c2['attributes']['length']?_0x2851c2[_0x664d('0x36')]:_0x106d09['model'];_0x2851c2[_0x664d('0x3b')]=qs[_0x664d('0x3c')](_0x557db5['query']['sort']);_0x2851c2[_0x664d('0x3d')]=qs[_0x664d('0x34')](_[_0x664d('0x3e')](_0x557db5['query'],_0x106d09[_0x664d('0x34')]));if(_0x557db5[_0x664d('0x33')][_0x664d('0x3f')]){_0x2851c2[_0x664d('0x3d')]=_[_0x664d('0x47')](_0x2851c2[_0x664d('0x3d')],{'$or':_['map'](_0x2851c2[_0x664d('0x36')],function(_0x339984){var _0x547917={};_0x547917[_0x339984]={'$like':'%'+_0x557db5[_0x664d('0x33')][_0x664d('0x3f')]+'%'};return _0x547917;})});}_0x2851c2=_[_0x664d('0x47')]({},_0x2851c2,_0x557db5[_0x664d('0x40')]);return _0x26233f[_0x664d('0x4e')](_0x2851c2);}})[_0x664d('0x26')](function(_0x12d89f){if(_0x12d89f){_0x5da865=_0x12d89f['length'];if(!_0x557db5[_0x664d('0x33')][_0x664d('0x39')]('nolimit')){_0x2851c2[_0x664d('0x20')]=qs[_0x664d('0x20')](_0x557db5[_0x664d('0x33')]['limit']);_0x2851c2['offset']=qs[_0x664d('0x1e')](_0x557db5[_0x664d('0x33')][_0x664d('0x1e')]);}return _0x26233f[_0x664d('0x4e')](_0x2851c2);}})[_0x664d('0x26')](function(_0x5a1bab){if(_0x5a1bab){return _0x5a1bab?{'count':_0x5da865,'rows':_0x5a1bab}:null;}})[_0x664d('0x26')](respondWithResult(_0x283c64,null))[_0x664d('0x44')](handleError(_0x283c64,null));};exports[_0x664d('0x4f')]=function(_0x1677a0,_0x2b84c1,_0x11a971){var _0x467938={};var _0x10f14d={};var _0x1602a6;var _0x17d30a;return db[_0x664d('0x2c')]['findOne']({'where':{'id':_0x1677a0['params']['id']}})[_0x664d('0x26')](handleEntityNotFound(_0x2b84c1,null))[_0x664d('0x26')](function(_0xb06f02){if(_0xb06f02){_0x1602a6=_0xb06f02;_0x10f14d[_0x664d('0x31')]=_[_0x664d('0x46')](db[_0x664d('0x4d')][_0x664d('0x2d')]);_0x10f14d['query']=_[_0x664d('0x46')](_0x1677a0[_0x664d('0x33')]);_0x10f14d['filters']=_['intersection'](_0x10f14d[_0x664d('0x31')],_0x10f14d['query']);_0x467938[_0x664d('0x36')]=_[_0x664d('0x35')](_0x10f14d[_0x664d('0x31')],qs[_0x664d('0x37')](_0x1677a0[_0x664d('0x33')][_0x664d('0x37')]));_0x467938['attributes']=_0x467938[_0x664d('0x36')][_0x664d('0x38')]?_0x467938[_0x664d('0x36')]:_0x10f14d[_0x664d('0x31')];_0x467938[_0x664d('0x3b')]=qs[_0x664d('0x3c')](_0x1677a0[_0x664d('0x33')]['sort']);_0x467938['where']=qs[_0x664d('0x34')](_['pick'](_0x1677a0[_0x664d('0x33')],_0x10f14d['filters']));if(_0x1677a0[_0x664d('0x33')][_0x664d('0x3f')]){_0x467938[_0x664d('0x3d')]=_[_0x664d('0x47')](_0x467938[_0x664d('0x3d')],{'$or':_['map'](_0x467938['attributes'],function(_0x2ac2c3){var _0x51336c={};_0x51336c[_0x2ac2c3]={'$like':'%'+_0x1677a0[_0x664d('0x33')][_0x664d('0x3f')]+'%'};return _0x51336c;})});}_0x467938=_[_0x664d('0x47')]({},_0x467938,_0x1677a0[_0x664d('0x40')]);return _0x1602a6[_0x664d('0x4f')](_0x467938);}})[_0x664d('0x26')](function(_0x2a4b4f){if(_0x2a4b4f){_0x17d30a=_0x2a4b4f[_0x664d('0x38')];if(!_0x1677a0[_0x664d('0x33')][_0x664d('0x39')](_0x664d('0x3a'))){_0x467938['limit']=qs[_0x664d('0x20')](_0x1677a0[_0x664d('0x33')][_0x664d('0x20')]);_0x467938[_0x664d('0x1e')]=qs[_0x664d('0x1e')](_0x1677a0[_0x664d('0x33')][_0x664d('0x1e')]);}return _0x1602a6[_0x664d('0x4f')](_0x467938);}})['then'](function(_0x1912e8){if(_0x1912e8){return _0x1912e8?{'count':_0x17d30a,'rows':_0x1912e8}:null;}})[_0x664d('0x26')](respondWithResult(_0x2b84c1,null))[_0x664d('0x44')](handleError(_0x2b84c1,null));};exports[_0x664d('0x50')]=function(_0x5f1cbc,_0x59603b,_0xe7c44f){var _0x1fff92={};var _0x44f126={};var _0xcdadb6;var _0x4a155a;return db['ServicenowConfiguration'][_0x664d('0x4c')]({'where':{'id':_0x5f1cbc[_0x664d('0x4b')]['id']}})[_0x664d('0x26')](handleEntityNotFound(_0x59603b,null))[_0x664d('0x26')](function(_0x3b234e){if(_0x3b234e){_0xcdadb6=_0x3b234e;_0x44f126[_0x664d('0x31')]=_[_0x664d('0x46')](db[_0x664d('0x4d')]['rawAttributes']);_0x44f126[_0x664d('0x33')]=_[_0x664d('0x46')](_0x5f1cbc[_0x664d('0x33')]);_0x44f126[_0x664d('0x34')]=_[_0x664d('0x35')](_0x44f126[_0x664d('0x31')],_0x44f126[_0x664d('0x33')]);_0x1fff92[_0x664d('0x36')]=_['intersection'](_0x44f126['model'],qs[_0x664d('0x37')](_0x5f1cbc['query'][_0x664d('0x37')]));_0x1fff92[_0x664d('0x36')]=_0x1fff92[_0x664d('0x36')][_0x664d('0x38')]?_0x1fff92[_0x664d('0x36')]:_0x44f126[_0x664d('0x31')];_0x1fff92[_0x664d('0x3b')]=qs[_0x664d('0x3c')](_0x5f1cbc['query']['sort']);_0x1fff92[_0x664d('0x3d')]=qs['filters'](_['pick'](_0x5f1cbc[_0x664d('0x33')],_0x44f126['filters']));if(_0x5f1cbc[_0x664d('0x33')][_0x664d('0x3f')]){_0x1fff92[_0x664d('0x3d')]=_[_0x664d('0x47')](_0x1fff92[_0x664d('0x3d')],{'$or':_[_0x664d('0x32')](_0x1fff92['attributes'],function(_0x1c1846){var _0x3a0a26={};_0x3a0a26[_0x1c1846]={'$like':'%'+_0x5f1cbc[_0x664d('0x33')][_0x664d('0x3f')]+'%'};return _0x3a0a26;})});}_0x1fff92=_['merge']({},_0x1fff92,_0x5f1cbc[_0x664d('0x40')]);return _0xcdadb6[_0x664d('0x50')](_0x1fff92);}})[_0x664d('0x26')](function(_0x49c45c){if(_0x49c45c){_0x4a155a=_0x49c45c[_0x664d('0x38')];if(!_0x5f1cbc[_0x664d('0x33')][_0x664d('0x39')](_0x664d('0x3a'))){_0x1fff92[_0x664d('0x20')]=qs['limit'](_0x5f1cbc[_0x664d('0x33')][_0x664d('0x20')]);_0x1fff92[_0x664d('0x1e')]=qs[_0x664d('0x1e')](_0x5f1cbc[_0x664d('0x33')][_0x664d('0x1e')]);}return _0xcdadb6[_0x664d('0x50')](_0x1fff92);}})[_0x664d('0x26')](function(_0x1b3207){if(_0x1b3207){return _0x1b3207?{'count':_0x4a155a,'rows':_0x1b3207}:null;}})[_0x664d('0x26')](respondWithResult(_0x59603b,null))['catch'](handleError(_0x59603b,null));}; \ No newline at end of file +var _0x1005=['fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','rows','show','params','keys','find','create','catch','body','getFields','findOne','ServicenowField','getSubjects','getDescriptions','rimraf','zip-dir'];(function(_0x2e4e67,_0x4e9853){var _0x268124=function(_0x291e46){while(--_0x291e46){_0x2e4e67['push'](_0x2e4e67['shift']());}};_0x268124(++_0x4e9853);}(_0x1005,0x189));var _0x5100=function(_0x1d3815,_0x3f9f7a){_0x1d3815=_0x1d3815-0x0;var _0x3fee01=_0x1005[_0x1d3815];return _0x3fee01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5100('0x0'));var zipdir=require(_0x5100('0x1'));var jsonpatch=require(_0x5100('0x2'));var rp=require('request-promise');var moment=require(_0x5100('0x3'));var BPromise=require(_0x5100('0x4'));var Mustache=require('mustache');var util=require(_0x5100('0x5'));var path=require(_0x5100('0x6'));var sox=require(_0x5100('0x7'));var csv=require('to-csv');var ejs=require(_0x5100('0x8'));var fs=require('fs');var fs_extra=require(_0x5100('0x9'));var _=require('lodash');var squel=require(_0x5100('0xa'));var crypto=require(_0x5100('0xb'));var jsforce=require(_0x5100('0xc'));var deskjs=require(_0x5100('0xd'));var toCsv=require(_0x5100('0xe'));var querystring=require(_0x5100('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5100('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5100('0x11'));var hardwareService=require(_0x5100('0x12'));var logger=require(_0x5100('0x13'))(_0x5100('0x14'));var utils=require(_0x5100('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5100('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d0655,_0xdd409f){_0xdd409f=_0xdd409f||0xcc;return function(_0x56af69){if(_0x56af69){return _0x4d0655['sendStatus'](_0xdd409f);}return _0x4d0655['status'](_0xdd409f)[_0x5100('0x17')]();};}function respondWithResult(_0x5bc0cd,_0x5bd68e){_0x5bd68e=_0x5bd68e||0xc8;return function(_0x542da6){if(_0x542da6){return _0x5bc0cd[_0x5100('0x18')](_0x5bd68e)[_0x5100('0x19')](_0x542da6);}};}function respondWithFilteredResult(_0xa7ab0d,_0x1f46f9){return function(_0x5b12fa){if(_0x5b12fa){var _0x19b980=typeof _0x1f46f9[_0x5100('0x1a')]===_0x5100('0x1b')&&typeof _0x1f46f9[_0x5100('0x1c')]===_0x5100('0x1b');var _0x4b9aef=_0x5b12fa[_0x5100('0x1d')];var _0xae12f8=_0x19b980?0x0:_0x1f46f9[_0x5100('0x1a')];var _0x57b836=_0x19b980?_0x5b12fa['count']:_0x1f46f9[_0x5100('0x1a')]+_0x1f46f9[_0x5100('0x1c')];var _0x1dffc1;if(_0x57b836>=_0x4b9aef){_0x57b836=_0x4b9aef;_0x1dffc1=0xc8;}else{_0x1dffc1=0xce;}_0xa7ab0d[_0x5100('0x18')](_0x1dffc1);return _0xa7ab0d[_0x5100('0x1e')](_0x5100('0x1f'),_0xae12f8+'-'+_0x57b836+'/'+_0x4b9aef)['json'](_0x5b12fa);}return null;};}function patchUpdates(_0x183e25){return function(_0x1e427f){try{jsonpatch[_0x5100('0x20')](_0x1e427f,_0x183e25,!![]);}catch(_0x1fb594){return BPromise[_0x5100('0x21')](_0x1fb594);}return _0x1e427f[_0x5100('0x22')]();};}function saveUpdates(_0x55c529,_0x3f11cf){return function(_0x38d294){if(_0x38d294){return _0x38d294[_0x5100('0x23')](_0x55c529)[_0x5100('0x24')](function(_0x5c76d6){return _0x5c76d6;});}return null;};}function removeEntity(_0x183d81,_0x3c962b){return function(_0x805b6a){if(_0x805b6a){return _0x805b6a[_0x5100('0x25')]()['then'](function(){_0x183d81['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x378692,_0x5ed179){return function(_0x344aa1){if(!_0x344aa1){_0x378692[_0x5100('0x26')](0x194);}return _0x344aa1;};}function handleError(_0x28c889,_0x57249a){_0x57249a=_0x57249a||0x1f4;return function(_0x5861ab){logger['error'](_0x5861ab['stack']);if(_0x5861ab[_0x5100('0x27')]){delete _0x5861ab['name'];}_0x28c889[_0x5100('0x18')](_0x57249a)[_0x5100('0x28')](_0x5861ab);};}exports[_0x5100('0x29')]=function(_0x18dda9,_0x20b9cd){var _0x31aab2={},_0x29cbf8={},_0x29a07f={'count':0x0,'rows':[]};var _0x1fad74=_[_0x5100('0x2a')](db[_0x5100('0x2b')][_0x5100('0x2c')],function(_0x15c627){return{'name':_0x15c627[_0x5100('0x2d')],'type':_0x15c627[_0x5100('0x2e')][_0x5100('0x2f')]};});_0x29cbf8[_0x5100('0x30')]=_[_0x5100('0x2a')](_0x1fad74,_0x5100('0x27'));_0x29cbf8['query']=_['keys'](_0x18dda9[_0x5100('0x31')]);_0x29cbf8[_0x5100('0x32')]=_['intersection'](_0x29cbf8['model'],_0x29cbf8[_0x5100('0x31')]);_0x31aab2[_0x5100('0x33')]=_[_0x5100('0x34')](_0x29cbf8[_0x5100('0x30')],qs[_0x5100('0x35')](_0x18dda9[_0x5100('0x31')]['fields']));_0x31aab2['attributes']=_0x31aab2[_0x5100('0x33')][_0x5100('0x36')]?_0x31aab2[_0x5100('0x33')]:_0x29cbf8[_0x5100('0x30')];if(!_0x18dda9[_0x5100('0x31')][_0x5100('0x37')](_0x5100('0x38'))){_0x31aab2[_0x5100('0x1c')]=qs[_0x5100('0x1c')](_0x18dda9[_0x5100('0x31')]['limit']);_0x31aab2[_0x5100('0x1a')]=qs[_0x5100('0x1a')](_0x18dda9[_0x5100('0x31')][_0x5100('0x1a')]);}_0x31aab2[_0x5100('0x39')]=qs['sort'](_0x18dda9['query'][_0x5100('0x3a')]);_0x31aab2['where']=qs['filters'](_[_0x5100('0x3b')](_0x18dda9['query'],_0x29cbf8[_0x5100('0x32')]),_0x1fad74);if(_0x18dda9[_0x5100('0x31')][_0x5100('0x3c')]){_0x31aab2['where']=_[_0x5100('0x3d')](_0x31aab2[_0x5100('0x3e')],{'$or':_[_0x5100('0x2a')](_0x1fad74,function(_0x1a3f1b){if(_0x1a3f1b[_0x5100('0x2e')]!=='VIRTUAL'){var _0x38c106={};_0x38c106[_0x1a3f1b[_0x5100('0x27')]]={'$like':'%'+_0x18dda9[_0x5100('0x31')][_0x5100('0x3c')]+'%'};return _0x38c106;}})});}_0x31aab2=_[_0x5100('0x3d')]({},_0x31aab2,_0x18dda9[_0x5100('0x3f')]);var _0x3a30f5={'where':_0x31aab2[_0x5100('0x3e')]};return db[_0x5100('0x2b')][_0x5100('0x1d')](_0x3a30f5)[_0x5100('0x24')](function(_0x42a6b7){_0x29a07f[_0x5100('0x1d')]=_0x42a6b7;if(_0x18dda9[_0x5100('0x31')][_0x5100('0x40')]){_0x31aab2[_0x5100('0x41')]=[{'all':!![]}];}return db[_0x5100('0x2b')]['findAll'](_0x31aab2);})[_0x5100('0x24')](function(_0x4fdf5c){_0x29a07f[_0x5100('0x42')]=_0x4fdf5c;return _0x29a07f;})[_0x5100('0x24')](respondWithFilteredResult(_0x20b9cd,_0x31aab2))['catch'](handleError(_0x20b9cd,null));};exports[_0x5100('0x43')]=function(_0x5cd723,_0x4de8c4){var _0x288256={'raw':![],'where':{'id':_0x5cd723[_0x5100('0x44')]['id']}},_0x47e2b2={};_0x47e2b2[_0x5100('0x30')]=_[_0x5100('0x45')](db[_0x5100('0x2b')][_0x5100('0x2c')]);_0x47e2b2[_0x5100('0x31')]=_[_0x5100('0x45')](_0x5cd723[_0x5100('0x31')]);_0x47e2b2[_0x5100('0x32')]=_[_0x5100('0x34')](_0x47e2b2[_0x5100('0x30')],_0x47e2b2[_0x5100('0x31')]);_0x288256[_0x5100('0x33')]=_['intersection'](_0x47e2b2[_0x5100('0x30')],qs[_0x5100('0x35')](_0x5cd723[_0x5100('0x31')][_0x5100('0x35')]));_0x288256[_0x5100('0x33')]=_0x288256[_0x5100('0x33')]['length']?_0x288256[_0x5100('0x33')]:_0x47e2b2[_0x5100('0x30')];if(_0x5cd723[_0x5100('0x31')]['includeAll']){_0x288256[_0x5100('0x41')]=[{'all':!![]}];}_0x288256=_[_0x5100('0x3d')]({},_0x288256,_0x5cd723['options']);return db[_0x5100('0x2b')][_0x5100('0x46')](_0x288256)[_0x5100('0x24')](handleEntityNotFound(_0x4de8c4,null))[_0x5100('0x24')](respondWithResult(_0x4de8c4,null))['catch'](handleError(_0x4de8c4,null));};exports[_0x5100('0x47')]=function(_0xad7720,_0x315daf){return db['ServicenowConfiguration'][_0x5100('0x47')](_0xad7720['body'],{})[_0x5100('0x24')](respondWithResult(_0x315daf,0xc9))[_0x5100('0x48')](handleError(_0x315daf,null));};exports[_0x5100('0x23')]=function(_0x3c9157,_0x2e752c){if(_0x3c9157[_0x5100('0x49')]['id']){delete _0x3c9157[_0x5100('0x49')]['id'];}return db[_0x5100('0x2b')][_0x5100('0x46')]({'where':{'id':_0x3c9157[_0x5100('0x44')]['id']}})[_0x5100('0x24')](handleEntityNotFound(_0x2e752c,null))[_0x5100('0x24')](saveUpdates(_0x3c9157[_0x5100('0x49')],null))['then'](respondWithResult(_0x2e752c,null))['catch'](handleError(_0x2e752c,null));};exports[_0x5100('0x25')]=function(_0x128710,_0x3e7351){return db['ServicenowConfiguration'][_0x5100('0x46')]({'where':{'id':_0x128710[_0x5100('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e7351,null))[_0x5100('0x24')](removeEntity(_0x3e7351,null))[_0x5100('0x48')](handleError(_0x3e7351,null));};exports[_0x5100('0x4a')]=function(_0x2e3582,_0x2b1a3a,_0x9e0688){var _0x36331d={};var _0xf1e062={};var _0x5eaa1f;var _0x3693d8;return db['ServicenowConfiguration'][_0x5100('0x4b')]({'where':{'id':_0x2e3582['params']['id']}})['then'](handleEntityNotFound(_0x2b1a3a,null))[_0x5100('0x24')](function(_0x1338af){if(_0x1338af){_0x5eaa1f=_0x1338af;_0xf1e062['model']=_[_0x5100('0x45')](db['ServicenowField'][_0x5100('0x2c')]);_0xf1e062[_0x5100('0x31')]=_['keys'](_0x2e3582['query']);_0xf1e062[_0x5100('0x32')]=_[_0x5100('0x34')](_0xf1e062[_0x5100('0x30')],_0xf1e062[_0x5100('0x31')]);_0x36331d[_0x5100('0x33')]=_['intersection'](_0xf1e062[_0x5100('0x30')],qs[_0x5100('0x35')](_0x2e3582['query'][_0x5100('0x35')]));_0x36331d['attributes']=_0x36331d[_0x5100('0x33')][_0x5100('0x36')]?_0x36331d[_0x5100('0x33')]:_0xf1e062[_0x5100('0x30')];_0x36331d['order']=qs[_0x5100('0x3a')](_0x2e3582[_0x5100('0x31')][_0x5100('0x3a')]);_0x36331d['where']=qs[_0x5100('0x32')](_[_0x5100('0x3b')](_0x2e3582[_0x5100('0x31')],_0xf1e062[_0x5100('0x32')]));if(_0x2e3582['query'][_0x5100('0x3c')]){_0x36331d[_0x5100('0x3e')]=_[_0x5100('0x3d')](_0x36331d[_0x5100('0x3e')],{'$or':_['map'](_0x36331d[_0x5100('0x33')],function(_0x313b36){var _0x31af2d={};_0x31af2d[_0x313b36]={'$like':'%'+_0x2e3582[_0x5100('0x31')][_0x5100('0x3c')]+'%'};return _0x31af2d;})});}_0x36331d=_['merge']({},_0x36331d,_0x2e3582[_0x5100('0x3f')]);return _0x5eaa1f[_0x5100('0x4a')](_0x36331d);}})['then'](function(_0x27b324){if(_0x27b324){_0x3693d8=_0x27b324[_0x5100('0x36')];if(!_0x2e3582[_0x5100('0x31')][_0x5100('0x37')]('nolimit')){_0x36331d['limit']=qs['limit'](_0x2e3582[_0x5100('0x31')][_0x5100('0x1c')]);_0x36331d[_0x5100('0x1a')]=qs[_0x5100('0x1a')](_0x2e3582['query']['offset']);}return _0x5eaa1f['getFields'](_0x36331d);}})['then'](function(_0x2dc437){if(_0x2dc437){return _0x2dc437?{'count':_0x3693d8,'rows':_0x2dc437}:null;}})[_0x5100('0x24')](respondWithResult(_0x2b1a3a,null))[_0x5100('0x48')](handleError(_0x2b1a3a,null));};exports['getSubjects']=function(_0x29468e,_0x5e93e6,_0x5847e6){var _0x3633e1={};var _0x4be6f8={};var _0x439371;var _0x59b8eb;return db[_0x5100('0x2b')][_0x5100('0x4b')]({'where':{'id':_0x29468e[_0x5100('0x44')]['id']}})[_0x5100('0x24')](handleEntityNotFound(_0x5e93e6,null))[_0x5100('0x24')](function(_0x13c19e){if(_0x13c19e){_0x439371=_0x13c19e;_0x4be6f8[_0x5100('0x30')]=_[_0x5100('0x45')](db[_0x5100('0x4c')][_0x5100('0x2c')]);_0x4be6f8[_0x5100('0x31')]=_['keys'](_0x29468e[_0x5100('0x31')]);_0x4be6f8[_0x5100('0x32')]=_[_0x5100('0x34')](_0x4be6f8['model'],_0x4be6f8[_0x5100('0x31')]);_0x3633e1[_0x5100('0x33')]=_[_0x5100('0x34')](_0x4be6f8[_0x5100('0x30')],qs['fields'](_0x29468e['query'][_0x5100('0x35')]));_0x3633e1['attributes']=_0x3633e1[_0x5100('0x33')][_0x5100('0x36')]?_0x3633e1[_0x5100('0x33')]:_0x4be6f8[_0x5100('0x30')];_0x3633e1[_0x5100('0x39')]=qs['sort'](_0x29468e['query'][_0x5100('0x3a')]);_0x3633e1['where']=qs[_0x5100('0x32')](_[_0x5100('0x3b')](_0x29468e['query'],_0x4be6f8[_0x5100('0x32')]));if(_0x29468e[_0x5100('0x31')][_0x5100('0x3c')]){_0x3633e1[_0x5100('0x3e')]=_[_0x5100('0x3d')](_0x3633e1[_0x5100('0x3e')],{'$or':_[_0x5100('0x2a')](_0x3633e1[_0x5100('0x33')],function(_0x590296){var _0x387773={};_0x387773[_0x590296]={'$like':'%'+_0x29468e[_0x5100('0x31')]['filter']+'%'};return _0x387773;})});}_0x3633e1=_[_0x5100('0x3d')]({},_0x3633e1,_0x29468e[_0x5100('0x3f')]);return _0x439371[_0x5100('0x4d')](_0x3633e1);}})[_0x5100('0x24')](function(_0x18fc06){if(_0x18fc06){_0x59b8eb=_0x18fc06['length'];if(!_0x29468e[_0x5100('0x31')][_0x5100('0x37')](_0x5100('0x38'))){_0x3633e1[_0x5100('0x1c')]=qs['limit'](_0x29468e[_0x5100('0x31')][_0x5100('0x1c')]);_0x3633e1[_0x5100('0x1a')]=qs[_0x5100('0x1a')](_0x29468e['query']['offset']);}return _0x439371['getSubjects'](_0x3633e1);}})['then'](function(_0x1adf75){if(_0x1adf75){return _0x1adf75?{'count':_0x59b8eb,'rows':_0x1adf75}:null;}})[_0x5100('0x24')](respondWithResult(_0x5e93e6,null))['catch'](handleError(_0x5e93e6,null));};exports[_0x5100('0x4e')]=function(_0x243d74,_0x1946a2,_0x4a4757){var _0x333c19={};var _0x251923={};var _0x24d2f9;var _0x1cc83b;return db[_0x5100('0x2b')][_0x5100('0x4b')]({'where':{'id':_0x243d74['params']['id']}})[_0x5100('0x24')](handleEntityNotFound(_0x1946a2,null))[_0x5100('0x24')](function(_0x5599fd){if(_0x5599fd){_0x24d2f9=_0x5599fd;_0x251923[_0x5100('0x30')]=_['keys'](db[_0x5100('0x4c')][_0x5100('0x2c')]);_0x251923[_0x5100('0x31')]=_[_0x5100('0x45')](_0x243d74[_0x5100('0x31')]);_0x251923[_0x5100('0x32')]=_['intersection'](_0x251923[_0x5100('0x30')],_0x251923[_0x5100('0x31')]);_0x333c19[_0x5100('0x33')]=_[_0x5100('0x34')](_0x251923[_0x5100('0x30')],qs[_0x5100('0x35')](_0x243d74[_0x5100('0x31')][_0x5100('0x35')]));_0x333c19['attributes']=_0x333c19[_0x5100('0x33')][_0x5100('0x36')]?_0x333c19[_0x5100('0x33')]:_0x251923[_0x5100('0x30')];_0x333c19[_0x5100('0x39')]=qs[_0x5100('0x3a')](_0x243d74[_0x5100('0x31')][_0x5100('0x3a')]);_0x333c19['where']=qs['filters'](_[_0x5100('0x3b')](_0x243d74[_0x5100('0x31')],_0x251923['filters']));if(_0x243d74[_0x5100('0x31')][_0x5100('0x3c')]){_0x333c19['where']=_[_0x5100('0x3d')](_0x333c19[_0x5100('0x3e')],{'$or':_[_0x5100('0x2a')](_0x333c19['attributes'],function(_0x28534d){var _0x4a71ad={};_0x4a71ad[_0x28534d]={'$like':'%'+_0x243d74[_0x5100('0x31')][_0x5100('0x3c')]+'%'};return _0x4a71ad;})});}_0x333c19=_['merge']({},_0x333c19,_0x243d74['options']);return _0x24d2f9[_0x5100('0x4e')](_0x333c19);}})[_0x5100('0x24')](function(_0x389194){if(_0x389194){_0x1cc83b=_0x389194['length'];if(!_0x243d74[_0x5100('0x31')][_0x5100('0x37')](_0x5100('0x38'))){_0x333c19[_0x5100('0x1c')]=qs[_0x5100('0x1c')](_0x243d74[_0x5100('0x31')][_0x5100('0x1c')]);_0x333c19['offset']=qs[_0x5100('0x1a')](_0x243d74[_0x5100('0x31')][_0x5100('0x1a')]);}return _0x24d2f9[_0x5100('0x4e')](_0x333c19);}})[_0x5100('0x24')](function(_0x581b8f){if(_0x581b8f){return _0x581b8f?{'count':_0x1cc83b,'rows':_0x581b8f}:null;}})['then'](respondWithResult(_0x1946a2,null))[_0x5100('0x48')](handleError(_0x1946a2,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 462774b..1b70041 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 _0x8109=['ServicenowConfiguration','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define'];(function(_0x23a06b,_0x7a2509){var _0x18d883=function(_0x5cc57c){while(--_0x5cc57c){_0x23a06b['push'](_0x23a06b['shift']());}};_0x18d883(++_0x7a2509);}(_0x8109,0xa9));var _0x9810=function(_0xc9c76b,_0x4993c0){_0xc9c76b=_0xc9c76b-0x0;var _0x387c6f=_0x8109[_0xc9c76b];return _0x387c6f;};'use strict';var _=require(_0x9810('0x0'));var util=require('util');var logger=require(_0x9810('0x1'))(_0x9810('0x2'));var moment=require('moment');var BPromise=require(_0x9810('0x3'));var rp=require(_0x9810('0x4'));var fs=require('fs');var path=require(_0x9810('0x5'));var rimraf=require(_0x9810('0x6'));var config=require(_0x9810('0x7'));var attributes=require(_0x9810('0x8'));module[_0x9810('0x9')]=function(_0x24baaf,_0x440a10){return _0x24baaf[_0x9810('0xa')](_0x9810('0xb'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93e9=['moment','bluebird','request-promise','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api'];(function(_0x2e85c2,_0x54dc93){var _0x5818bf=function(_0x42c679){while(--_0x42c679){_0x2e85c2['push'](_0x2e85c2['shift']());}};_0x5818bf(++_0x54dc93);}(_0x93e9,0xcc));var _0x993e=function(_0x285e4f,_0x531eae){_0x285e4f=_0x285e4f-0x0;var _0x3e2160=_0x93e9[_0x285e4f];return _0x3e2160;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var logger=require(_0x993e('0x2'))(_0x993e('0x3'));var moment=require(_0x993e('0x4'));var BPromise=require(_0x993e('0x5'));var rp=require(_0x993e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x993e('0x7'));var attributes=require(_0x993e('0x8'));module[_0x993e('0x9')]=function(_0x45f52e,_0x1da414){return _0x45f52e[_0x993e('0xa')](_0x993e('0xb'),attributes,{'tableName':_0x993e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 5e795e0..16015b5 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 _0x5c7c=['rpc','client','http','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4759ac,_0x16651a){var _0xae0e15=function(_0x1e2fec){while(--_0x1e2fec){_0x4759ac['push'](_0x4759ac['shift']());}};_0xae0e15(++_0x16651a);}(_0x5c7c,0x172));var _0xc5c7=function(_0x68a64c,_0x4fa1e1){_0x68a64c=_0x68a64c-0x0;var _0x3acf1f=_0x5c7c[_0x68a64c];return _0x3acf1f;};'use strict';var _=require(_0xc5c7('0x0'));var util=require(_0xc5c7('0x1'));var moment=require(_0xc5c7('0x2'));var BPromise=require(_0xc5c7('0x3'));var rs=require(_0xc5c7('0x4'));var fs=require('fs');var Redis=require(_0xc5c7('0x5'));var db=require(_0xc5c7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5c7('0x7'))(_0xc5c7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc5c7('0x9')][_0xc5c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59e252,_0x393fc7,_0x1714a0){return new BPromise(function(_0x35f991,_0x43520f){return client['request'](_0x59e252,_0x1714a0)[_0xc5c7('0xb')](function(_0xb6831f){logger['info'](_0xc5c7('0xc'),_0x393fc7,_0xc5c7('0xd'));logger[_0xc5c7('0xe')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x393fc7,'request\x20sent',JSON['stringify'](_0xb6831f));if(_0xb6831f[_0xc5c7('0xf')]){if(_0xb6831f[_0xc5c7('0xf')]['code']===0x1f4){logger[_0xc5c7('0xf')](_0xc5c7('0xc'),_0x393fc7,_0xb6831f[_0xc5c7('0xf')][_0xc5c7('0x10')]);return _0x43520f(_0xb6831f[_0xc5c7('0xf')][_0xc5c7('0x10')]);}logger[_0xc5c7('0xf')](_0xc5c7('0xc'),_0x393fc7,_0xb6831f['error'][_0xc5c7('0x10')]);return _0x35f991(_0xb6831f[_0xc5c7('0xf')]['message']);}else{logger['info'](_0xc5c7('0xc'),_0x393fc7,_0xc5c7('0xd'));_0x35f991(_0xb6831f[_0xc5c7('0x11')][_0xc5c7('0x10')]);}})['catch'](function(_0x2552ef){logger[_0xc5c7('0xf')](_0xc5c7('0xc'),_0x393fc7,_0x2552ef);_0x43520f(_0x2552ef);});});} \ No newline at end of file +var _0xbeb1=['info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbeb1,0x9b));var _0x1beb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xbeb1[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x1beb('0x0'));var util=require(_0x1beb('0x1'));var moment=require(_0x1beb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1beb('0x3'));var db=require(_0x1beb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1beb('0x5'))(_0x1beb('0x6'));var config=require(_0x1beb('0x7'));var jayson=require(_0x1beb('0x8'));var client=jayson[_0x1beb('0x9')][_0x1beb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1149d7,_0x3c0db7,_0x25aa9d){return new BPromise(function(_0xffab57,_0x5ece76){return client[_0x1beb('0xb')](_0x1149d7,_0x25aa9d)[_0x1beb('0xc')](function(_0x11af3c){logger[_0x1beb('0xd')](_0x1beb('0xe'),_0x3c0db7,_0x1beb('0xf'));logger[_0x1beb('0x10')](_0x1beb('0x11'),_0x3c0db7,_0x1beb('0xf'),JSON[_0x1beb('0x12')](_0x11af3c));if(_0x11af3c[_0x1beb('0x13')]){if(_0x11af3c[_0x1beb('0x13')][_0x1beb('0x14')]===0x1f4){logger[_0x1beb('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3c0db7,_0x11af3c[_0x1beb('0x13')]['message']);return _0x5ece76(_0x11af3c['error'][_0x1beb('0x15')]);}logger[_0x1beb('0x13')](_0x1beb('0xe'),_0x3c0db7,_0x11af3c[_0x1beb('0x13')]['message']);return _0xffab57(_0x11af3c[_0x1beb('0x13')][_0x1beb('0x15')]);}else{logger[_0x1beb('0xd')](_0x1beb('0xe'),_0x3c0db7,_0x1beb('0xf'));_0xffab57(_0x11af3c[_0x1beb('0x16')][_0x1beb('0x15')]);}})[_0x1beb('0x17')](function(_0x48c464){logger[_0x1beb('0x13')](_0x1beb('0xe'),_0x3c0db7,_0x48c464);_0x5ece76(_0x48c464);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 406218e..22119cc 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 _0xbf0b=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3bcfee,_0x411cc7){var _0x161f14=function(_0xb5b4e6){while(--_0xb5b4e6){_0x3bcfee['push'](_0x3bcfee['shift']());}};_0x161f14(++_0x411cc7);}(_0xbf0b,0x159));var _0xbbf0=function(_0x148ccb,_0x251799){_0x148ccb=_0x148ccb-0x0;var _0x15e08a=_0xbf0b[_0x148ccb];return _0x15e08a;};'use strict';var multer=require(_0xbbf0('0x0'));var util=require(_0xbbf0('0x1'));var path=require(_0xbbf0('0x2'));var timeout=require(_0xbbf0('0x3'));var express=require(_0xbbf0('0x4'));var router=express[_0xbbf0('0x5')]();var fs_extra=require(_0xbbf0('0x6'));var auth=require(_0xbbf0('0x7'));var interaction=require(_0xbbf0('0x8'));var config=require(_0xbbf0('0x9'));var controller=require(_0xbbf0('0xa'));router[_0xbbf0('0xb')]('/',auth[_0xbbf0('0xc')](),controller[_0xbbf0('0xd')]);router[_0xbbf0('0xb')](_0xbbf0('0xe'),auth['isAuthenticated'](),controller[_0xbbf0('0xf')]);router[_0xbbf0('0x10')]('/',auth[_0xbbf0('0xc')](),controller[_0xbbf0('0x11')]);router[_0xbbf0('0x12')](_0xbbf0('0xe'),auth[_0xbbf0('0xc')](),controller[_0xbbf0('0x13')]);router[_0xbbf0('0x14')](_0xbbf0('0xe'),auth[_0xbbf0('0xc')](),controller[_0xbbf0('0x15')]);module[_0xbbf0('0x16')]=router; \ No newline at end of file +var _0xd164=['util','path','express','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x59c86e,_0x38ce57){var _0x48a50e=function(_0x1eeda5){while(--_0x1eeda5){_0x59c86e['push'](_0x59c86e['shift']());}};_0x48a50e(++_0x38ce57);}(_0xd164,0x120));var _0x4d16=function(_0x1daa7e,_0xc9104a){_0x1daa7e=_0x1daa7e-0x0;var _0x4f09ca=_0xd164[_0x1daa7e];return _0x4f09ca;};'use strict';var multer=require('multer');var util=require(_0x4d16('0x0'));var path=require(_0x4d16('0x1'));var timeout=require('connect-timeout');var express=require(_0x4d16('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4d16('0x3'));var config=require(_0x4d16('0x4'));var controller=require(_0x4d16('0x5'));router[_0x4d16('0x6')]('/',auth[_0x4d16('0x7')](),controller[_0x4d16('0x8')]);router[_0x4d16('0x6')](_0x4d16('0x9'),auth[_0x4d16('0x7')](),controller[_0x4d16('0xa')]);router[_0x4d16('0xb')]('/',auth['isAuthenticated'](),controller[_0x4d16('0xc')]);router[_0x4d16('0xd')](_0x4d16('0x9'),auth[_0x4d16('0x7')](),controller[_0x4d16('0xe')]);router[_0x4d16('0xf')](_0x4d16('0x9'),auth[_0x4d16('0x7')](),controller[_0x4d16('0x10')]);module[_0x4d16('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index bc06659..b6a1809 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 _0x2eb8=['keyValue','picklist','string','STRING','variable','customVariable','BOOLEAN','sequelize','ENUM'];(function(_0x3b5bca,_0x326805){var _0x39833=function(_0x16f56f){while(--_0x16f56f){_0x3b5bca['push'](_0x3b5bca['shift']());}};_0x39833(++_0x326805);}(_0x2eb8,0x15d));var _0x82eb=function(_0x3f6349,_0xec3303){_0x3f6349=_0x3f6349-0x0;var _0xbb000c=_0x2eb8[_0x3f6349];return _0xbb000c;};'use strict';var Sequelize=require(_0x82eb('0x0'));module['exports']={'type':{'type':Sequelize[_0x82eb('0x1')]('string','variable','customVariable',_0x82eb('0x2'),_0x82eb('0x3')),'defaultValue':_0x82eb('0x4')},'content':{'type':Sequelize[_0x82eb('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x82eb('0x1')](_0x82eb('0x4'),_0x82eb('0x6'),_0x82eb('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x82eb('0x5')]},'nameField':{'type':Sequelize[_0x82eb('0x5')]},'customField':{'type':Sequelize[_0x82eb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x82eb('0x5')]}}; \ No newline at end of file +var _0x22a5=['string','customVariable','keyValue','STRING','ENUM','variable','BOOLEAN','sequelize','exports'];(function(_0x3ec630,_0x3ee528){var _0x5f3ef6=function(_0x8c938b){while(--_0x8c938b){_0x3ec630['push'](_0x3ec630['shift']());}};_0x5f3ef6(++_0x3ee528);}(_0x22a5,0x103));var _0x522a=function(_0x50cae0,_0x18f3eb){_0x50cae0=_0x50cae0-0x0;var _0x769359=_0x22a5[_0x50cae0];return _0x769359;};'use strict';var Sequelize=require(_0x522a('0x0'));module[_0x522a('0x1')]={'type':{'type':Sequelize['ENUM'](_0x522a('0x2'),'variable',_0x522a('0x3'),_0x522a('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x522a('0x5')]},'key':{'type':Sequelize[_0x522a('0x5')]},'keyType':{'type':Sequelize[_0x522a('0x6')](_0x522a('0x2'),_0x522a('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x522a('0x5')]},'idField':{'type':Sequelize[_0x522a('0x5')]},'nameField':{'type':Sequelize[_0x522a('0x5')]},'customField':{'type':Sequelize[_0x522a('0x8')],'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 6e91042..ef08d58 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 _0xa43b=['../../mysqldb','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','type','options','includeAll','include','findAll','rows','catch','params','filters','length','create','body','find','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0xa43b,0x156));var _0xba43=function(_0x1bc378,_0x5c520c){_0x1bc378=_0x1bc378-0x0;var _0x1b93fa=_0xa43b[_0x1bc378];return _0x1b93fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba43('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xba43('0x1'));var rp=require('request-promise');var moment=require(_0xba43('0x2'));var BPromise=require(_0xba43('0x3'));var Mustache=require(_0xba43('0x4'));var util=require(_0xba43('0x5'));var path=require('path');var sox=require(_0xba43('0x6'));var csv=require('to-csv');var ejs=require(_0xba43('0x7'));var fs=require('fs');var fs_extra=require(_0xba43('0x8'));var _=require(_0xba43('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xba43('0xa'));var deskjs=require(_0xba43('0xb'));var toCsv=require(_0xba43('0xc'));var querystring=require('querystring');var Papa=require(_0xba43('0xd'));var Redis=require(_0xba43('0xe'));var authService=require(_0xba43('0xf'));var qs=require(_0xba43('0x10'));var as=require(_0xba43('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba43('0x12'))(_0xba43('0x13'));var utils=require(_0xba43('0x14'));var config=require(_0xba43('0x15'));var licenseUtil=require(_0xba43('0x16'));var db=require(_0xba43('0x17'))['db'];function respondWithStatusCode(_0x58c64b,_0x1e285a){_0x1e285a=_0x1e285a||0xcc;return function(_0x3a40df){if(_0x3a40df){return _0x58c64b['sendStatus'](_0x1e285a);}return _0x58c64b['status'](_0x1e285a)[_0xba43('0x18')]();};}function respondWithResult(_0x436fa9,_0x2f87d1){_0x2f87d1=_0x2f87d1||0xc8;return function(_0x472009){if(_0x472009){return _0x436fa9['status'](_0x2f87d1)['json'](_0x472009);}};}function respondWithFilteredResult(_0x515a32,_0x3f0908){return function(_0x156dd8){if(_0x156dd8){var _0x2a5ff8=typeof _0x3f0908[_0xba43('0x19')]===_0xba43('0x1a')&&typeof _0x3f0908[_0xba43('0x1b')]===_0xba43('0x1a');var _0x52b898=_0x156dd8[_0xba43('0x1c')];var _0x185417=_0x2a5ff8?0x0:_0x3f0908['offset'];var _0x563fdd=_0x2a5ff8?_0x156dd8[_0xba43('0x1c')]:_0x3f0908[_0xba43('0x19')]+_0x3f0908[_0xba43('0x1b')];var _0x42985d;if(_0x563fdd>=_0x52b898){_0x563fdd=_0x52b898;_0x42985d=0xc8;}else{_0x42985d=0xce;}_0x515a32[_0xba43('0x1d')](_0x42985d);return _0x515a32[_0xba43('0x1e')](_0xba43('0x1f'),_0x185417+'-'+_0x563fdd+'/'+_0x52b898)[_0xba43('0x20')](_0x156dd8);}return null;};}function patchUpdates(_0x387d75){return function(_0x1a9ef4){try{jsonpatch[_0xba43('0x21')](_0x1a9ef4,_0x387d75,!![]);}catch(_0x1ed3f2){return BPromise[_0xba43('0x22')](_0x1ed3f2);}return _0x1a9ef4[_0xba43('0x23')]();};}function saveUpdates(_0x13d821,_0x494ec9){return function(_0x118f62){if(_0x118f62){return _0x118f62[_0xba43('0x24')](_0x13d821)[_0xba43('0x25')](function(_0x1d0c18){return _0x1d0c18;});}return null;};}function removeEntity(_0x1aa693,_0x4bed8e){return function(_0x5aa6c9){if(_0x5aa6c9){return _0x5aa6c9[_0xba43('0x26')]()[_0xba43('0x25')](function(){_0x1aa693[_0xba43('0x1d')](0xcc)[_0xba43('0x18')]();});}};}function handleEntityNotFound(_0x234135,_0xcfa99d){return function(_0x698ff4){if(!_0x698ff4){_0x234135[_0xba43('0x27')](0x194);}return _0x698ff4;};}function handleError(_0x556e55,_0x44ed14){_0x44ed14=_0x44ed14||0x1f4;return function(_0x19fa6e){logger[_0xba43('0x28')](_0x19fa6e['stack']);if(_0x19fa6e[_0xba43('0x29')]){delete _0x19fa6e[_0xba43('0x29')];}_0x556e55['status'](_0x44ed14)[_0xba43('0x2a')](_0x19fa6e);};}exports[_0xba43('0x2b')]=function(_0x3d6181,_0x182800){var _0x53035a={},_0x457faf={},_0x3242f4={'count':0x0,'rows':[]};var _0x43a2b6=_[_0xba43('0x2c')](db[_0xba43('0x2d')][_0xba43('0x2e')],function(_0x364813){return{'name':_0x364813[_0xba43('0x2f')],'type':_0x364813['type'][_0xba43('0x30')]};});_0x457faf[_0xba43('0x31')]=_[_0xba43('0x2c')](_0x43a2b6,_0xba43('0x29'));_0x457faf[_0xba43('0x32')]=_[_0xba43('0x33')](_0x3d6181[_0xba43('0x32')]);_0x457faf['filters']=_[_0xba43('0x34')](_0x457faf[_0xba43('0x31')],_0x457faf[_0xba43('0x32')]);_0x53035a[_0xba43('0x35')]=_[_0xba43('0x34')](_0x457faf['model'],qs['fields'](_0x3d6181[_0xba43('0x32')][_0xba43('0x36')]));_0x53035a[_0xba43('0x35')]=_0x53035a[_0xba43('0x35')]['length']?_0x53035a[_0xba43('0x35')]:_0x457faf[_0xba43('0x31')];if(!_0x3d6181['query'][_0xba43('0x37')]('nolimit')){_0x53035a['limit']=qs[_0xba43('0x1b')](_0x3d6181['query'][_0xba43('0x1b')]);_0x53035a[_0xba43('0x19')]=qs[_0xba43('0x19')](_0x3d6181[_0xba43('0x32')]['offset']);}_0x53035a[_0xba43('0x38')]=qs[_0xba43('0x39')](_0x3d6181['query'][_0xba43('0x39')]);_0x53035a[_0xba43('0x3a')]=qs['filters'](_['pick'](_0x3d6181[_0xba43('0x32')],_0x457faf['filters']),_0x43a2b6);if(_0x3d6181[_0xba43('0x32')]['filter']){_0x53035a[_0xba43('0x3a')]=_[_0xba43('0x3b')](_0x53035a[_0xba43('0x3a')],{'$or':_[_0xba43('0x2c')](_0x43a2b6,function(_0x460cff){if(_0x460cff[_0xba43('0x3c')]!=='VIRTUAL'){var _0x404a22={};_0x404a22[_0x460cff[_0xba43('0x29')]]={'$like':'%'+_0x3d6181[_0xba43('0x32')]['filter']+'%'};return _0x404a22;}})});}_0x53035a=_[_0xba43('0x3b')]({},_0x53035a,_0x3d6181[_0xba43('0x3d')]);var _0xe209a1={'where':_0x53035a[_0xba43('0x3a')]};return db[_0xba43('0x2d')][_0xba43('0x1c')](_0xe209a1)['then'](function(_0x50e97b){_0x3242f4[_0xba43('0x1c')]=_0x50e97b;if(_0x3d6181[_0xba43('0x32')][_0xba43('0x3e')]){_0x53035a[_0xba43('0x3f')]=[{'all':!![]}];}return db[_0xba43('0x2d')][_0xba43('0x40')](_0x53035a);})[_0xba43('0x25')](function(_0x4f3624){_0x3242f4[_0xba43('0x41')]=_0x4f3624;return _0x3242f4;})[_0xba43('0x25')](respondWithFilteredResult(_0x182800,_0x53035a))[_0xba43('0x42')](handleError(_0x182800,null));};exports['show']=function(_0x36dfe2,_0x2b4299){var _0x4f13a={'raw':!![],'where':{'id':_0x36dfe2[_0xba43('0x43')]['id']}},_0x40b4e9={};_0x40b4e9['model']=_[_0xba43('0x33')](db[_0xba43('0x2d')][_0xba43('0x2e')]);_0x40b4e9['query']=_[_0xba43('0x33')](_0x36dfe2['query']);_0x40b4e9[_0xba43('0x44')]=_[_0xba43('0x34')](_0x40b4e9['model'],_0x40b4e9['query']);_0x4f13a[_0xba43('0x35')]=_['intersection'](_0x40b4e9[_0xba43('0x31')],qs[_0xba43('0x36')](_0x36dfe2[_0xba43('0x32')][_0xba43('0x36')]));_0x4f13a[_0xba43('0x35')]=_0x4f13a['attributes'][_0xba43('0x45')]?_0x4f13a[_0xba43('0x35')]:_0x40b4e9['model'];if(_0x36dfe2[_0xba43('0x32')][_0xba43('0x3e')]){_0x4f13a[_0xba43('0x3f')]=[{'all':!![]}];}_0x4f13a=_['merge']({},_0x4f13a,_0x36dfe2[_0xba43('0x3d')]);return db[_0xba43('0x2d')]['find'](_0x4f13a)[_0xba43('0x25')](handleEntityNotFound(_0x2b4299,null))[_0xba43('0x25')](respondWithResult(_0x2b4299,null))[_0xba43('0x42')](handleError(_0x2b4299,null));};exports[_0xba43('0x46')]=function(_0x221b1e,_0x483076){return db[_0xba43('0x2d')]['create'](_0x221b1e['body'],{})['then'](respondWithResult(_0x483076,0xc9))[_0xba43('0x42')](handleError(_0x483076,null));};exports[_0xba43('0x24')]=function(_0x19d7c5,_0x49e34b){if(_0x19d7c5['body']['id']){delete _0x19d7c5['body']['id'];}return db[_0xba43('0x2d')]['find']({'where':{'id':_0x19d7c5[_0xba43('0x43')]['id']}})[_0xba43('0x25')](handleEntityNotFound(_0x49e34b,null))[_0xba43('0x25')](saveUpdates(_0x19d7c5[_0xba43('0x47')],null))[_0xba43('0x25')](respondWithResult(_0x49e34b,null))['catch'](handleError(_0x49e34b,null));};exports[_0xba43('0x26')]=function(_0x4263d0,_0x16cd07){return db['ServicenowField'][_0xba43('0x48')]({'where':{'id':_0x4263d0[_0xba43('0x43')]['id']}})['then'](handleEntityNotFound(_0x16cd07,null))['then'](removeEntity(_0x16cd07,null))['catch'](handleError(_0x16cd07,null));}; \ No newline at end of file +var _0xa56e=['pick','filter','type','VIRTUAL','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ServicenowField','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where'];(function(_0x26b00e,_0x245a09){var _0x3764c3=function(_0x30fe77){while(--_0x30fe77){_0x26b00e['push'](_0x26b00e['shift']());}};_0x3764c3(++_0x245a09);}(_0xa56e,0xee));var _0xea56=function(_0xf2a7a5,_0x322667){_0xf2a7a5=_0xf2a7a5-0x0;var _0x5c494b=_0xa56e[_0xf2a7a5];return _0x5c494b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea56('0x0'));var zipdir=require(_0xea56('0x1'));var jsonpatch=require(_0xea56('0x2'));var rp=require(_0xea56('0x3'));var moment=require(_0xea56('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xea56('0x5'));var util=require(_0xea56('0x6'));var path=require(_0xea56('0x7'));var sox=require('sox');var csv=require(_0xea56('0x8'));var ejs=require(_0xea56('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xea56('0xa'));var squel=require(_0xea56('0xb'));var crypto=require(_0xea56('0xc'));var jsforce=require(_0xea56('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xea56('0x8'));var querystring=require(_0xea56('0xe'));var Papa=require('papaparse');var Redis=require(_0xea56('0xf'));var authService=require(_0xea56('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xea56('0x11'));var hardwareService=require(_0xea56('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xea56('0x13'));var config=require(_0xea56('0x14'));var licenseUtil=require(_0xea56('0x15'));var db=require(_0xea56('0x16'))['db'];function respondWithStatusCode(_0x14e280,_0x24e309){_0x24e309=_0x24e309||0xcc;return function(_0x43e808){if(_0x43e808){return _0x14e280[_0xea56('0x17')](_0x24e309);}return _0x14e280[_0xea56('0x18')](_0x24e309)[_0xea56('0x19')]();};}function respondWithResult(_0x1022c9,_0x1d4765){_0x1d4765=_0x1d4765||0xc8;return function(_0xc97c01){if(_0xc97c01){return _0x1022c9[_0xea56('0x18')](_0x1d4765)[_0xea56('0x1a')](_0xc97c01);}};}function respondWithFilteredResult(_0xbc040,_0x3d4cf3){return function(_0x3b13f3){if(_0x3b13f3){var _0x228e8a=typeof _0x3d4cf3[_0xea56('0x1b')]===_0xea56('0x1c')&&typeof _0x3d4cf3[_0xea56('0x1d')]==='undefined';var _0x1f3505=_0x3b13f3[_0xea56('0x1e')];var _0x927d4a=_0x228e8a?0x0:_0x3d4cf3[_0xea56('0x1b')];var _0xbfc889=_0x228e8a?_0x3b13f3[_0xea56('0x1e')]:_0x3d4cf3[_0xea56('0x1b')]+_0x3d4cf3[_0xea56('0x1d')];var _0x2c7b27;if(_0xbfc889>=_0x1f3505){_0xbfc889=_0x1f3505;_0x2c7b27=0xc8;}else{_0x2c7b27=0xce;}_0xbc040[_0xea56('0x18')](_0x2c7b27);return _0xbc040['set'](_0xea56('0x1f'),_0x927d4a+'-'+_0xbfc889+'/'+_0x1f3505)['json'](_0x3b13f3);}return null;};}function patchUpdates(_0x4d6ddd){return function(_0x4c79b0){try{jsonpatch[_0xea56('0x20')](_0x4c79b0,_0x4d6ddd,!![]);}catch(_0x95344d){return BPromise[_0xea56('0x21')](_0x95344d);}return _0x4c79b0[_0xea56('0x22')]();};}function saveUpdates(_0x3a17ff,_0x2b8dd3){return function(_0xa0f4cb){if(_0xa0f4cb){return _0xa0f4cb[_0xea56('0x23')](_0x3a17ff)[_0xea56('0x24')](function(_0xf9b168){return _0xf9b168;});}return null;};}function removeEntity(_0x2a7402,_0x4921dc){return function(_0x22790a){if(_0x22790a){return _0x22790a[_0xea56('0x25')]()[_0xea56('0x24')](function(){_0x2a7402['status'](0xcc)[_0xea56('0x19')]();});}};}function handleEntityNotFound(_0x3257f5,_0x2060cb){return function(_0x59a180){if(!_0x59a180){_0x3257f5[_0xea56('0x17')](0x194);}return _0x59a180;};}function handleError(_0x46f61f,_0x396f87){_0x396f87=_0x396f87||0x1f4;return function(_0x4442be){logger[_0xea56('0x26')](_0x4442be['stack']);if(_0x4442be[_0xea56('0x27')]){delete _0x4442be[_0xea56('0x27')];}_0x46f61f['status'](_0x396f87)[_0xea56('0x28')](_0x4442be);};}exports[_0xea56('0x29')]=function(_0x564bd7,_0x408f8c){var _0x5ad37e={},_0x1d6254={},_0x58704e={'count':0x0,'rows':[]};var _0x51fe74=_[_0xea56('0x2a')](db[_0xea56('0x2b')][_0xea56('0x2c')],function(_0x1eb3ab){return{'name':_0x1eb3ab['fieldName'],'type':_0x1eb3ab['type'][_0xea56('0x2d')]};});_0x1d6254['model']=_['map'](_0x51fe74,_0xea56('0x27'));_0x1d6254[_0xea56('0x2e')]=_[_0xea56('0x2f')](_0x564bd7[_0xea56('0x2e')]);_0x1d6254[_0xea56('0x30')]=_[_0xea56('0x31')](_0x1d6254[_0xea56('0x32')],_0x1d6254[_0xea56('0x2e')]);_0x5ad37e[_0xea56('0x33')]=_['intersection'](_0x1d6254['model'],qs['fields'](_0x564bd7[_0xea56('0x2e')][_0xea56('0x34')]));_0x5ad37e[_0xea56('0x33')]=_0x5ad37e[_0xea56('0x33')][_0xea56('0x35')]?_0x5ad37e[_0xea56('0x33')]:_0x1d6254[_0xea56('0x32')];if(!_0x564bd7['query']['hasOwnProperty'](_0xea56('0x36'))){_0x5ad37e[_0xea56('0x1d')]=qs['limit'](_0x564bd7['query'][_0xea56('0x1d')]);_0x5ad37e[_0xea56('0x1b')]=qs[_0xea56('0x1b')](_0x564bd7[_0xea56('0x2e')]['offset']);}_0x5ad37e[_0xea56('0x37')]=qs['sort'](_0x564bd7[_0xea56('0x2e')][_0xea56('0x38')]);_0x5ad37e[_0xea56('0x39')]=qs['filters'](_[_0xea56('0x3a')](_0x564bd7[_0xea56('0x2e')],_0x1d6254[_0xea56('0x30')]),_0x51fe74);if(_0x564bd7[_0xea56('0x2e')][_0xea56('0x3b')]){_0x5ad37e[_0xea56('0x39')]=_['merge'](_0x5ad37e[_0xea56('0x39')],{'$or':_[_0xea56('0x2a')](_0x51fe74,function(_0x5d5f8c){if(_0x5d5f8c[_0xea56('0x3c')]!==_0xea56('0x3d')){var _0x537b20={};_0x537b20[_0x5d5f8c[_0xea56('0x27')]]={'$like':'%'+_0x564bd7[_0xea56('0x2e')][_0xea56('0x3b')]+'%'};return _0x537b20;}})});}_0x5ad37e=_[_0xea56('0x3e')]({},_0x5ad37e,_0x564bd7['options']);var _0x35dc95={'where':_0x5ad37e[_0xea56('0x39')]};return db[_0xea56('0x2b')][_0xea56('0x1e')](_0x35dc95)[_0xea56('0x24')](function(_0x4dfe36){_0x58704e[_0xea56('0x1e')]=_0x4dfe36;if(_0x564bd7['query']['includeAll']){_0x5ad37e[_0xea56('0x3f')]=[{'all':!![]}];}return db[_0xea56('0x2b')][_0xea56('0x40')](_0x5ad37e);})['then'](function(_0x59c2b5){_0x58704e[_0xea56('0x41')]=_0x59c2b5;return _0x58704e;})[_0xea56('0x24')](respondWithFilteredResult(_0x408f8c,_0x5ad37e))[_0xea56('0x42')](handleError(_0x408f8c,null));};exports[_0xea56('0x43')]=function(_0x212ffc,_0x59eba9){var _0xe9fe35={'raw':!![],'where':{'id':_0x212ffc[_0xea56('0x44')]['id']}},_0x43d66d={};_0x43d66d[_0xea56('0x32')]=_['keys'](db[_0xea56('0x2b')]['rawAttributes']);_0x43d66d['query']=_[_0xea56('0x2f')](_0x212ffc[_0xea56('0x2e')]);_0x43d66d['filters']=_[_0xea56('0x31')](_0x43d66d['model'],_0x43d66d[_0xea56('0x2e')]);_0xe9fe35[_0xea56('0x33')]=_[_0xea56('0x31')](_0x43d66d[_0xea56('0x32')],qs[_0xea56('0x34')](_0x212ffc[_0xea56('0x2e')][_0xea56('0x34')]));_0xe9fe35[_0xea56('0x33')]=_0xe9fe35[_0xea56('0x33')]['length']?_0xe9fe35[_0xea56('0x33')]:_0x43d66d[_0xea56('0x32')];if(_0x212ffc[_0xea56('0x2e')][_0xea56('0x45')]){_0xe9fe35[_0xea56('0x3f')]=[{'all':!![]}];}_0xe9fe35=_['merge']({},_0xe9fe35,_0x212ffc[_0xea56('0x46')]);return db[_0xea56('0x2b')][_0xea56('0x47')](_0xe9fe35)[_0xea56('0x24')](handleEntityNotFound(_0x59eba9,null))[_0xea56('0x24')](respondWithResult(_0x59eba9,null))[_0xea56('0x42')](handleError(_0x59eba9,null));};exports[_0xea56('0x48')]=function(_0x1baf48,_0x47b71f){return db[_0xea56('0x2b')][_0xea56('0x48')](_0x1baf48[_0xea56('0x49')],{})[_0xea56('0x24')](respondWithResult(_0x47b71f,0xc9))[_0xea56('0x42')](handleError(_0x47b71f,null));};exports['update']=function(_0x2a391a,_0x4d223f){if(_0x2a391a['body']['id']){delete _0x2a391a[_0xea56('0x49')]['id'];}return db[_0xea56('0x2b')][_0xea56('0x47')]({'where':{'id':_0x2a391a[_0xea56('0x44')]['id']}})[_0xea56('0x24')](handleEntityNotFound(_0x4d223f,null))[_0xea56('0x24')](saveUpdates(_0x2a391a['body'],null))['then'](respondWithResult(_0x4d223f,null))[_0xea56('0x42')](handleError(_0x4d223f,null));};exports[_0xea56('0x25')]=function(_0x23e467,_0x661ee7){return db[_0xea56('0x2b')][_0xea56('0x47')]({'where':{'id':_0x23e467[_0xea56('0x44')]['id']}})[_0xea56('0x24')](handleEntityNotFound(_0x661ee7,null))[_0xea56('0x24')](removeEntity(_0x661ee7,null))['catch'](handleError(_0x661ee7,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 796d5fa..a157962 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 _0xe7db=['ServicenowField','servicenow_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intServicenowField.attributes','exports'];(function(_0x310bab,_0x27b562){var _0xc04981=function(_0xe847a7){while(--_0xe847a7){_0x310bab['push'](_0x310bab['shift']());}};_0xc04981(++_0x27b562);}(_0xe7db,0x1bd));var _0xbe7d=function(_0x3aaef5,_0x16cdc8){_0x3aaef5=_0x3aaef5-0x0;var _0x4c0ed5=_0xe7db[_0x3aaef5];return _0x4c0ed5;};'use strict';var _=require(_0xbe7d('0x0'));var util=require(_0xbe7d('0x1'));var logger=require(_0xbe7d('0x2'))(_0xbe7d('0x3'));var moment=require('moment');var BPromise=require(_0xbe7d('0x4'));var rp=require(_0xbe7d('0x5'));var fs=require('fs');var path=require(_0xbe7d('0x6'));var rimraf=require(_0xbe7d('0x7'));var config=require('../../config/environment');var attributes=require(_0xbe7d('0x8'));module[_0xbe7d('0x9')]=function(_0x40ceb8,_0x1b63ce){return _0x40ceb8['define'](_0xbe7d('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xbe7d('0xb'),'fields':['idField',_0xbe7d('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e28=['idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index'];(function(_0x8544c0,_0x3095e7){var _0x1d0b9c=function(_0x5656e4){while(--_0x5656e4){_0x8544c0['push'](_0x8544c0['shift']());}};_0x1d0b9c(++_0x3095e7);}(_0x2e28,0x12e));var _0x82e2=function(_0x513315,_0x30ae66){_0x513315=_0x513315-0x0;var _0x1ceb7b=_0x2e28[_0x513315];return _0x1ceb7b;};'use strict';var _=require('lodash');var util=require(_0x82e2('0x0'));var logger=require(_0x82e2('0x1'))(_0x82e2('0x2'));var moment=require(_0x82e2('0x3'));var BPromise=require(_0x82e2('0x4'));var rp=require(_0x82e2('0x5'));var fs=require('fs');var path=require(_0x82e2('0x6'));var rimraf=require(_0x82e2('0x7'));var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module[_0x82e2('0x8')]=function(_0x51e0dc,_0x1f3ede){return _0x51e0dc[_0x82e2('0x9')](_0x82e2('0xa'),attributes,{'tableName':_0x82e2('0xb'),'paranoid':![],'indexes':[{'name':_0x82e2('0xc'),'fields':[_0x82e2('0xd'),_0x82e2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index d0f7391..e251ce9 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 _0xbdb7=['request\x20sent','debug','ServicenowField,\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','ServicenowField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x244f5d,_0x3c98c6){_0x244f5d=_0x244f5d-0x0;var _0x1a3886=_0xbdb7[_0x244f5d];return _0x1a3886;};'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 +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x528e77,_0x272034){var _0x2b858a=function(_0x5594fa){while(--_0x5594fa){_0x528e77['push'](_0x528e77['shift']());}};_0x2b858a(++_0x272034);}(_0xaa88,0x137));var _0x8aa8=function(_0x90f34f,_0x404021){_0x90f34f=_0x90f34f-0x0;var _0x4b18cf=_0xaa88[_0x90f34f];return _0x4b18cf;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 80af7b4..0cf48f8 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(_0x35810c,_0x125cef){var _0x327590=function(_0x29d58b){while(--_0x29d58b){_0x35810c['push'](_0x35810c['shift']());}};_0x327590(++_0x125cef);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x4a9bc8,_0x36b0a3){var _0x4e4fd8=function(_0x1ea06f){while(--_0x1ea06f){_0x4a9bc8['push'](_0x4a9bc8['shift']());}};_0x4e4fd8(++_0x36b0a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 c693752..06b95fb 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(_0x1a273d,_0x30b8ea){var _0x375c5b=function(_0xd45822){while(--_0xd45822){_0x1a273d['push'](_0x1a273d['shift']());}};_0x375c5b(++_0x30b8ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x40d85b,_0x40b222){var _0x25df88=function(_0x1ad788){while(--_0x1ad788){_0x40d85b['push'](_0x40d85b['shift']());}};_0x25df88(++_0x40b222);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 5120dd9..d28c61d 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 _0x7c3d=['SugarcrmAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','then','include','findAll','rows','catch','show','includeAll','find','create','body','params','destroy','findOne','SugarcrmConfiguration','sort','getConfigurations','addConfiguration','Subjects','getSubjects','channel','SugarcrmField','Descriptions','getFields','assigned_user_id','date_start','duration_hours','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','format','login','JSON','stringify','PLAIN','POST','%s%s','/service/v4_1/rest.php','Calls','values','module_fields','remove','includes','label','endsWith','value','statusCode','error','Wrong\x20credentials','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','count','offset','Content-Range','json','apply','reject','save','update','stack','name','send','index','map'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x7c3d,0x13d));var _0xd7c3=function(_0x3ca75e,_0x3c827e){_0x3ca75e=_0x3ca75e-0x0;var _0x3ca1d1=_0x7c3d[_0x3ca75e];return _0x3ca1d1;};'use strict';var emlformat=require(_0xd7c3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd7c3('0x1'));var jsonpatch=require(_0xd7c3('0x2'));var rp=require(_0xd7c3('0x3'));var moment=require(_0xd7c3('0x4'));var BPromise=require(_0xd7c3('0x5'));var Mustache=require('mustache');var util=require(_0xd7c3('0x6'));var path=require(_0xd7c3('0x7'));var sox=require(_0xd7c3('0x8'));var csv=require('to-csv');var ejs=require(_0xd7c3('0x9'));var fs=require('fs');var fs_extra=require(_0xd7c3('0xa'));var _=require(_0xd7c3('0xb'));var squel=require(_0xd7c3('0xc'));var crypto=require(_0xd7c3('0xd'));var jsforce=require(_0xd7c3('0xe'));var deskjs=require(_0xd7c3('0xf'));var toCsv=require(_0xd7c3('0x10'));var querystring=require(_0xd7c3('0x11'));var Papa=require(_0xd7c3('0x12'));var Redis=require(_0xd7c3('0x13'));var authService=require(_0xd7c3('0x14'));var qs=require(_0xd7c3('0x15'));var as=require(_0xd7c3('0x16'));var hardwareService=require(_0xd7c3('0x17'));var logger=require('../../config/logger')(_0xd7c3('0x18'));var utils=require(_0xd7c3('0x19'));var config=require(_0xd7c3('0x1a'));var licenseUtil=require(_0xd7c3('0x1b'));var db=require(_0xd7c3('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x234874,_0x7c681f){_0x7c681f=_0x7c681f||0xcc;return function(_0x4cc8f9){if(_0x4cc8f9){return _0x234874[_0xd7c3('0x1d')](_0x7c681f);}return _0x234874['status'](_0x7c681f)[_0xd7c3('0x1e')]();};}function respondWithResult(_0x505b02,_0x3ec6fb){_0x3ec6fb=_0x3ec6fb||0xc8;return function(_0x410c37){if(_0x410c37){return _0x505b02[_0xd7c3('0x1f')](_0x3ec6fb)['json'](_0x410c37);}};}function respondWithFilteredResult(_0x549656,_0x2d841a){return function(_0x2c2494){if(_0x2c2494){var _0x321aeb=typeof _0x2d841a['offset']==='undefined'&&typeof _0x2d841a[_0xd7c3('0x20')]==='undefined';var _0x238d66=_0x2c2494[_0xd7c3('0x21')];var _0x72bf64=_0x321aeb?0x0:_0x2d841a[_0xd7c3('0x22')];var _0x4c32eb=_0x321aeb?_0x2c2494['count']:_0x2d841a['offset']+_0x2d841a[_0xd7c3('0x20')];var _0x1e2522;if(_0x4c32eb>=_0x238d66){_0x4c32eb=_0x238d66;_0x1e2522=0xc8;}else{_0x1e2522=0xce;}_0x549656[_0xd7c3('0x1f')](_0x1e2522);return _0x549656['set'](_0xd7c3('0x23'),_0x72bf64+'-'+_0x4c32eb+'/'+_0x238d66)[_0xd7c3('0x24')](_0x2c2494);}return null;};}function patchUpdates(_0x500576){return function(_0x514d3f){try{jsonpatch[_0xd7c3('0x25')](_0x514d3f,_0x500576,!![]);}catch(_0x268ac2){return BPromise[_0xd7c3('0x26')](_0x268ac2);}return _0x514d3f[_0xd7c3('0x27')]();};}function saveUpdates(_0x2de2ce,_0x43bc7f){return function(_0x465e1f){if(_0x465e1f){return _0x465e1f[_0xd7c3('0x28')](_0x2de2ce)['then'](function(_0x5c08f4){return _0x5c08f4;});}return null;};}function removeEntity(_0x4489f0,_0x3cc91e){return function(_0x359309){if(_0x359309){return _0x359309['destroy']()['then'](function(){_0x4489f0[_0xd7c3('0x1f')](0xcc)[_0xd7c3('0x1e')]();});}};}function handleEntityNotFound(_0x50d0f4,_0x46187a){return function(_0x567a2e){if(!_0x567a2e){_0x50d0f4['sendStatus'](0x194);}return _0x567a2e;};}function handleError(_0x4a9ce0,_0x272678){_0x272678=_0x272678||0x1f4;return function(_0x4246b6){logger['error'](_0x4246b6[_0xd7c3('0x29')]);if(_0x4246b6[_0xd7c3('0x2a')]){delete _0x4246b6[_0xd7c3('0x2a')];}_0x4a9ce0[_0xd7c3('0x1f')](_0x272678)[_0xd7c3('0x2b')](_0x4246b6);};}exports[_0xd7c3('0x2c')]=function(_0x152cf4,_0x391849){var _0x2644e8={},_0x93107d={},_0x38c930={'count':0x0,'rows':[]};var _0x179f6a=_[_0xd7c3('0x2d')](db[_0xd7c3('0x2e')][_0xd7c3('0x2f')],function(_0x2bfb37){return{'name':_0x2bfb37[_0xd7c3('0x30')],'type':_0x2bfb37['type'][_0xd7c3('0x31')]};});_0x93107d[_0xd7c3('0x32')]=_[_0xd7c3('0x2d')](_0x179f6a,_0xd7c3('0x2a'));_0x93107d['query']=_[_0xd7c3('0x33')](_0x152cf4[_0xd7c3('0x34')]);_0x93107d[_0xd7c3('0x35')]=_[_0xd7c3('0x36')](_0x93107d[_0xd7c3('0x32')],_0x93107d[_0xd7c3('0x34')]);_0x2644e8[_0xd7c3('0x37')]=_['intersection'](_0x93107d[_0xd7c3('0x32')],qs[_0xd7c3('0x38')](_0x152cf4['query'][_0xd7c3('0x38')]));_0x2644e8['attributes']=_0x2644e8[_0xd7c3('0x37')][_0xd7c3('0x39')]?_0x2644e8['attributes']:_0x93107d[_0xd7c3('0x32')];if(!_0x152cf4[_0xd7c3('0x34')][_0xd7c3('0x3a')](_0xd7c3('0x3b'))){_0x2644e8[_0xd7c3('0x20')]=qs[_0xd7c3('0x20')](_0x152cf4[_0xd7c3('0x34')][_0xd7c3('0x20')]);_0x2644e8[_0xd7c3('0x22')]=qs[_0xd7c3('0x22')](_0x152cf4[_0xd7c3('0x34')][_0xd7c3('0x22')]);}_0x2644e8[_0xd7c3('0x3c')]=qs['sort'](_0x152cf4[_0xd7c3('0x34')]['sort']);_0x2644e8[_0xd7c3('0x3d')]=qs[_0xd7c3('0x35')](_[_0xd7c3('0x3e')](_0x152cf4[_0xd7c3('0x34')],_0x93107d[_0xd7c3('0x35')]),_0x179f6a);if(_0x152cf4[_0xd7c3('0x34')][_0xd7c3('0x3f')]){_0x2644e8[_0xd7c3('0x3d')]=_[_0xd7c3('0x40')](_0x2644e8[_0xd7c3('0x3d')],{'$or':_[_0xd7c3('0x2d')](_0x179f6a,function(_0x54ee9b){if(_0x54ee9b[_0xd7c3('0x41')]!==_0xd7c3('0x42')){var _0x1b44d7={};_0x1b44d7[_0x54ee9b[_0xd7c3('0x2a')]]={'$like':'%'+_0x152cf4['query'][_0xd7c3('0x3f')]+'%'};return _0x1b44d7;}})});}_0x2644e8=_['merge']({},_0x2644e8,_0x152cf4[_0xd7c3('0x43')]);var _0x556912={'where':_0x2644e8[_0xd7c3('0x3d')]};return db[_0xd7c3('0x2e')][_0xd7c3('0x21')](_0x556912)[_0xd7c3('0x44')](function(_0x23d1a1){_0x38c930[_0xd7c3('0x21')]=_0x23d1a1;if(_0x152cf4['query']['includeAll']){_0x2644e8[_0xd7c3('0x45')]=[{'all':!![]}];}return db[_0xd7c3('0x2e')][_0xd7c3('0x46')](_0x2644e8);})[_0xd7c3('0x44')](function(_0x2c6fbd){_0x38c930[_0xd7c3('0x47')]=_0x2c6fbd;return _0x38c930;})[_0xd7c3('0x44')](respondWithFilteredResult(_0x391849,_0x2644e8))[_0xd7c3('0x48')](handleError(_0x391849,null));};exports[_0xd7c3('0x49')]=function(_0x2022ae,_0x42fb07){var _0x4b7446={'raw':![],'where':{'id':_0x2022ae['params']['id']}},_0x3719b5={};_0x3719b5[_0xd7c3('0x32')]=_[_0xd7c3('0x33')](db[_0xd7c3('0x2e')][_0xd7c3('0x2f')]);_0x3719b5[_0xd7c3('0x34')]=_[_0xd7c3('0x33')](_0x2022ae[_0xd7c3('0x34')]);_0x3719b5[_0xd7c3('0x35')]=_[_0xd7c3('0x36')](_0x3719b5[_0xd7c3('0x32')],_0x3719b5[_0xd7c3('0x34')]);_0x4b7446[_0xd7c3('0x37')]=_[_0xd7c3('0x36')](_0x3719b5[_0xd7c3('0x32')],qs[_0xd7c3('0x38')](_0x2022ae[_0xd7c3('0x34')]['fields']));_0x4b7446[_0xd7c3('0x37')]=_0x4b7446[_0xd7c3('0x37')]['length']?_0x4b7446[_0xd7c3('0x37')]:_0x3719b5['model'];if(_0x2022ae[_0xd7c3('0x34')][_0xd7c3('0x4a')]){_0x4b7446[_0xd7c3('0x45')]=[{'all':!![]}];}_0x4b7446=_[_0xd7c3('0x40')]({},_0x4b7446,_0x2022ae[_0xd7c3('0x43')]);return db[_0xd7c3('0x2e')][_0xd7c3('0x4b')](_0x4b7446)[_0xd7c3('0x44')](handleEntityNotFound(_0x42fb07,null))[_0xd7c3('0x44')](respondWithResult(_0x42fb07,null))[_0xd7c3('0x48')](handleError(_0x42fb07,null));};exports[_0xd7c3('0x4c')]=function(_0x85938c,_0x558adf){return db[_0xd7c3('0x2e')][_0xd7c3('0x4c')](_0x85938c['body'],{})[_0xd7c3('0x44')](respondWithResult(_0x558adf,0xc9))[_0xd7c3('0x48')](handleError(_0x558adf,null));};exports[_0xd7c3('0x28')]=function(_0x38bdf9,_0x2d9bcf){if(_0x38bdf9['body']['id']){delete _0x38bdf9[_0xd7c3('0x4d')]['id'];}return db[_0xd7c3('0x2e')][_0xd7c3('0x4b')]({'where':{'id':_0x38bdf9[_0xd7c3('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2d9bcf,null))[_0xd7c3('0x44')](saveUpdates(_0x38bdf9[_0xd7c3('0x4d')],null))[_0xd7c3('0x44')](respondWithResult(_0x2d9bcf,null))[_0xd7c3('0x48')](handleError(_0x2d9bcf,null));};exports[_0xd7c3('0x4f')]=function(_0x45a5d5,_0xd4316){return db[_0xd7c3('0x2e')][_0xd7c3('0x4b')]({'where':{'id':_0x45a5d5[_0xd7c3('0x4e')]['id']}})[_0xd7c3('0x44')](handleEntityNotFound(_0xd4316,null))[_0xd7c3('0x44')](removeEntity(_0xd4316,null))[_0xd7c3('0x48')](handleError(_0xd4316,null));};exports['getConfigurations']=function(_0x5a8b78,_0x1c7ecc,_0x135ae1){var _0x26c836={};var _0xec75a3={};var _0x2f5b84;var _0xd60cbd;return db[_0xd7c3('0x2e')][_0xd7c3('0x50')]({'where':{'id':_0x5a8b78[_0xd7c3('0x4e')]['id']}})[_0xd7c3('0x44')](handleEntityNotFound(_0x1c7ecc,null))['then'](function(_0x328278){if(_0x328278){_0x2f5b84=_0x328278;_0xec75a3[_0xd7c3('0x32')]=_['keys'](db[_0xd7c3('0x51')]['rawAttributes']);_0xec75a3[_0xd7c3('0x34')]=_['keys'](_0x5a8b78[_0xd7c3('0x34')]);_0xec75a3[_0xd7c3('0x35')]=_[_0xd7c3('0x36')](_0xec75a3[_0xd7c3('0x32')],_0xec75a3[_0xd7c3('0x34')]);_0x26c836[_0xd7c3('0x37')]=_['intersection'](_0xec75a3['model'],qs['fields'](_0x5a8b78[_0xd7c3('0x34')][_0xd7c3('0x38')]));_0x26c836[_0xd7c3('0x37')]=_0x26c836[_0xd7c3('0x37')][_0xd7c3('0x39')]?_0x26c836['attributes']:_0xec75a3['model'];_0x26c836['order']=qs['sort'](_0x5a8b78[_0xd7c3('0x34')][_0xd7c3('0x52')]);_0x26c836[_0xd7c3('0x3d')]=qs['filters'](_[_0xd7c3('0x3e')](_0x5a8b78['query'],_0xec75a3[_0xd7c3('0x35')]));if(_0x5a8b78[_0xd7c3('0x34')][_0xd7c3('0x3f')]){_0x26c836[_0xd7c3('0x3d')]=_[_0xd7c3('0x40')](_0x26c836[_0xd7c3('0x3d')],{'$or':_['map'](_0x26c836[_0xd7c3('0x37')],function(_0x3d1be5){var _0x53568b={};_0x53568b[_0x3d1be5]={'$like':'%'+_0x5a8b78[_0xd7c3('0x34')]['filter']+'%'};return _0x53568b;})});}_0x26c836=_[_0xd7c3('0x40')]({},_0x26c836,_0x5a8b78[_0xd7c3('0x43')]);return _0x2f5b84[_0xd7c3('0x53')](_0x26c836);}})[_0xd7c3('0x44')](function(_0x334990){if(_0x334990){_0xd60cbd=_0x334990[_0xd7c3('0x39')];if(!_0x5a8b78[_0xd7c3('0x34')]['hasOwnProperty'](_0xd7c3('0x3b'))){_0x26c836[_0xd7c3('0x20')]=qs[_0xd7c3('0x20')](_0x5a8b78['query'][_0xd7c3('0x20')]);_0x26c836[_0xd7c3('0x22')]=qs[_0xd7c3('0x22')](_0x5a8b78['query']['offset']);}return _0x2f5b84[_0xd7c3('0x53')](_0x26c836);}})[_0xd7c3('0x44')](function(_0x3caac2){if(_0x3caac2){return _0x3caac2?{'count':_0xd60cbd,'rows':_0x3caac2}:null;}})[_0xd7c3('0x44')](respondWithResult(_0x1c7ecc,null))[_0xd7c3('0x48')](handleError(_0x1c7ecc,null));};exports[_0xd7c3('0x54')]=function(_0x3efeba,_0x1d6042,_0x18b3d6){if(_0x3efeba['body']['id']){delete _0x3efeba[_0xd7c3('0x4d')]['id'];}return db['SugarcrmAccount'][_0xd7c3('0x50')]({'where':{'id':_0x3efeba[_0xd7c3('0x4e')]['id']}})[_0xd7c3('0x44')](handleEntityNotFound(_0x1d6042,null))[_0xd7c3('0x44')](function(_0x571e64){if(_0x571e64){_0x3efeba[_0xd7c3('0x4d')]['AccountId']=_0x571e64['id'];_0x3efeba[_0xd7c3('0x4d')][_0xd7c3('0x55')]=integrations[_0xd7c3('0x56')](_0x3efeba['body']['channel'],_0x3efeba[_0xd7c3('0x4d')][_0xd7c3('0x41')]);_0x3efeba[_0xd7c3('0x4d')]['Descriptions']=integrations['getDescriptions'](_0x3efeba[_0xd7c3('0x4d')][_0xd7c3('0x57')],_0x3efeba[_0xd7c3('0x4d')]['type']);return db[_0xd7c3('0x51')][_0xd7c3('0x4c')](_0x3efeba[_0xd7c3('0x4d')],{'include':[{'model':db['SugarcrmField'],'as':_0xd7c3('0x55')},{'model':db[_0xd7c3('0x58')],'as':_0xd7c3('0x59')}]});}return null;})[_0xd7c3('0x44')](respondWithResult(_0x1d6042,null))[_0xd7c3('0x48')](handleError(_0x1d6042,null));};exports[_0xd7c3('0x5a')]=function(_0x5c1e3a,_0x2f0100,_0x271550){var _0x381470='';var _0x21b33a=['id',_0xd7c3('0x2a'),_0xd7c3('0x5b'),'created_by','description',_0xd7c3('0x5c'),_0xd7c3('0x5d'),'duration_minutes','parent_id',_0xd7c3('0x5e'),_0xd7c3('0x5f'),_0xd7c3('0x60')];return db[_0xd7c3('0x2e')][_0xd7c3('0x50')]({'where':{'id':_0x5c1e3a[_0xd7c3('0x4e')]['id']},'attributes':['id',_0xd7c3('0x61'),_0xd7c3('0x62'),_0xd7c3('0x63')]})['then'](handleEntityNotFound(_0x2f0100,null))[_0xd7c3('0x44')](function(_0x477879){if(_0x477879){_0x381470=_0x477879[_0xd7c3('0x63')];var _0x41e245=_0x381470[_0xd7c3('0x64')](-0x1);if(_0x41e245==='/'){_0x381470=_0x381470['substring'](0x0,_0x381470[_0xd7c3('0x65')](_0x41e245));}return rp({'method':'POST','uri':util[_0xd7c3('0x66')]('%s%s',_0x381470,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xd7c3('0x67'),'input_type':_0xd7c3('0x68'),'response_type':_0xd7c3('0x68'),'rest_data':JSON[_0xd7c3('0x69')]({'user_auth':{'user_name':_0x477879['username'],'password':_0x477879[_0xd7c3('0x62')],'encryption':_0xd7c3('0x6a')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x9aa7cd){if(_0x9aa7cd&&_0x9aa7cd[_0xd7c3('0x2a')]!=='Invalid\x20Login'&&_0x9aa7cd['name']!=='Password\x20Expired'){return rp({'method':_0xd7c3('0x6b'),'uri':util[_0xd7c3('0x66')](_0xd7c3('0x6c'),_0x381470,_0xd7c3('0x6d')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xd7c3('0x68'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x9aa7cd['id'],'module_name':_0xd7c3('0x6e')})}})['then'](function(_0x36172a){if(_0x36172a){var _0x5a0063=_[_0xd7c3('0x6f')](_0x36172a[_0xd7c3('0x70')]);_[_0xd7c3('0x71')](_0x5a0063,function(_0x514603){return _0x21b33a[_0xd7c3('0x72')](_0x514603[_0xd7c3('0x2a')]);});return{'count':_0x5a0063[_0xd7c3('0x39')],'rows':_['map'](_0x5a0063,function(_0x1299a1){return{'id':_0x1299a1[_0xd7c3('0x2a')],'name':_0x1299a1[_0xd7c3('0x73')],'custom':_[_0xd7c3('0x74')](_0x1299a1[_0xd7c3('0x2a')],'_c')?!![]:![],'options':_0x1299a1[_0xd7c3('0x43')]?_[_0xd7c3('0x2d')](_[_0xd7c3('0x6f')](_0x1299a1[_0xd7c3('0x43')]),function(_0x54595b){return{'name':_0x54595b[_0xd7c3('0x75')],'value':_0x54595b['name']};}):[]};})};}})[_0xd7c3('0x44')](respondWithResult(_0x2f0100,null))[_0xd7c3('0x48')](function(_0x1157ec){var _0x575c19=_0x5c1e3a[_0xd7c3('0x34')]['test']?0x1f4:_0x1157ec[_0xd7c3('0x76')]||0x1f4;logger[_0xd7c3('0x77')]('getFields,\x20%s,\x20%s,\x20%s',_0xd7c3('0x5a'),_0x575c19,JSON[_0xd7c3('0x69')](_0x1157ec));delete _0x1157ec[_0xd7c3('0x2a')];if(_0x575c19===0x191){_0x575c19=0x190;}_0x2f0100[_0xd7c3('0x1f')](_0x575c19)['send'](_0x5c1e3a[_0xd7c3('0x34')]['test']?{'message':_0xd7c3('0x78'),'statusCode':_0x1157ec[_0xd7c3('0x76')]}:_0x1157ec);});}else{var _0x530ed1=0x1f4;_0x2f0100['status'](_0x530ed1)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x9277=['SugarcrmConfiguration','filter','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','values','module_fields','includes','label','endsWith','statusCode','test','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','SugarcrmAccount','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','includeAll','include','catch','show','keys','rawAttributes','options','find','create','body','params','getConfigurations','findOne'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9277,0x195));var _0x7927=function(_0x53618a,_0x3ce1c8){_0x53618a=_0x53618a-0x0;var _0x588ddb=_0x9277[_0x53618a];return _0x588ddb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7927('0x0'));var jsonpatch=require(_0x7927('0x1'));var rp=require(_0x7927('0x2'));var moment=require(_0x7927('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7927('0x4'));var path=require(_0x7927('0x5'));var sox=require(_0x7927('0x6'));var csv=require('to-csv');var ejs=require(_0x7927('0x7'));var fs=require('fs');var fs_extra=require(_0x7927('0x8'));var _=require(_0x7927('0x9'));var squel=require(_0x7927('0xa'));var crypto=require('crypto');var jsforce=require(_0x7927('0xb'));var deskjs=require(_0x7927('0xc'));var toCsv=require(_0x7927('0xd'));var querystring=require(_0x7927('0xe'));var Papa=require(_0x7927('0xf'));var Redis=require(_0x7927('0x10'));var authService=require(_0x7927('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7927('0x12'));var hardwareService=require(_0x7927('0x13'));var logger=require(_0x7927('0x14'))(_0x7927('0x15'));var utils=require(_0x7927('0x16'));var config=require(_0x7927('0x17'));var licenseUtil=require(_0x7927('0x18'));var db=require(_0x7927('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x46d796,_0x5ac794){_0x5ac794=_0x5ac794||0xcc;return function(_0x1964c0){if(_0x1964c0){return _0x46d796[_0x7927('0x1a')](_0x5ac794);}return _0x46d796[_0x7927('0x1b')](_0x5ac794)['end']();};}function respondWithResult(_0x454da0,_0x2091b7){_0x2091b7=_0x2091b7||0xc8;return function(_0x3be15e){if(_0x3be15e){return _0x454da0[_0x7927('0x1b')](_0x2091b7)[_0x7927('0x1c')](_0x3be15e);}};}function respondWithFilteredResult(_0x336164,_0x2eb2a2){return function(_0x199f14){if(_0x199f14){var _0x27f332=typeof _0x2eb2a2[_0x7927('0x1d')]===_0x7927('0x1e')&&typeof _0x2eb2a2[_0x7927('0x1f')]===_0x7927('0x1e');var _0x43cf3=_0x199f14[_0x7927('0x20')];var _0x454615=_0x27f332?0x0:_0x2eb2a2[_0x7927('0x1d')];var _0x4db4de=_0x27f332?_0x199f14['count']:_0x2eb2a2[_0x7927('0x1d')]+_0x2eb2a2[_0x7927('0x1f')];var _0x1c3d56;if(_0x4db4de>=_0x43cf3){_0x4db4de=_0x43cf3;_0x1c3d56=0xc8;}else{_0x1c3d56=0xce;}_0x336164[_0x7927('0x1b')](_0x1c3d56);return _0x336164[_0x7927('0x21')](_0x7927('0x22'),_0x454615+'-'+_0x4db4de+'/'+_0x43cf3)[_0x7927('0x1c')](_0x199f14);}return null;};}function patchUpdates(_0x2a176e){return function(_0x3eae0a){try{jsonpatch[_0x7927('0x23')](_0x3eae0a,_0x2a176e,!![]);}catch(_0x40afa3){return BPromise[_0x7927('0x24')](_0x40afa3);}return _0x3eae0a[_0x7927('0x25')]();};}function saveUpdates(_0x28071d,_0x2be819){return function(_0xc9af99){if(_0xc9af99){return _0xc9af99[_0x7927('0x26')](_0x28071d)[_0x7927('0x27')](function(_0x1333f2){return _0x1333f2;});}return null;};}function removeEntity(_0xe499dc,_0x96a0c9){return function(_0x15187f){if(_0x15187f){return _0x15187f[_0x7927('0x28')]()[_0x7927('0x27')](function(){_0xe499dc[_0x7927('0x1b')](0xcc)[_0x7927('0x29')]();});}};}function handleEntityNotFound(_0x5858e3,_0x9dba05){return function(_0x5b3d8b){if(!_0x5b3d8b){_0x5858e3[_0x7927('0x1a')](0x194);}return _0x5b3d8b;};}function handleError(_0x3e59a6,_0x2750ce){_0x2750ce=_0x2750ce||0x1f4;return function(_0x8459f4){logger[_0x7927('0x2a')](_0x8459f4['stack']);if(_0x8459f4[_0x7927('0x2b')]){delete _0x8459f4[_0x7927('0x2b')];}_0x3e59a6[_0x7927('0x1b')](_0x2750ce)[_0x7927('0x2c')](_0x8459f4);};}exports[_0x7927('0x2d')]=function(_0x578d9c,_0x26bd40){var _0x3917b5={},_0x392eaf={},_0x2910a9={'count':0x0,'rows':[]};var _0x3abcbc=_[_0x7927('0x2e')](db[_0x7927('0x2f')]['rawAttributes'],function(_0x57139b){return{'name':_0x57139b[_0x7927('0x30')],'type':_0x57139b[_0x7927('0x31')][_0x7927('0x32')]};});_0x392eaf[_0x7927('0x33')]=_['map'](_0x3abcbc,'name');_0x392eaf[_0x7927('0x34')]=_['keys'](_0x578d9c[_0x7927('0x34')]);_0x392eaf[_0x7927('0x35')]=_[_0x7927('0x36')](_0x392eaf[_0x7927('0x33')],_0x392eaf[_0x7927('0x34')]);_0x3917b5['attributes']=_[_0x7927('0x36')](_0x392eaf['model'],qs[_0x7927('0x37')](_0x578d9c['query'][_0x7927('0x37')]));_0x3917b5[_0x7927('0x38')]=_0x3917b5['attributes'][_0x7927('0x39')]?_0x3917b5[_0x7927('0x38')]:_0x392eaf['model'];if(!_0x578d9c[_0x7927('0x34')][_0x7927('0x3a')](_0x7927('0x3b'))){_0x3917b5['limit']=qs[_0x7927('0x1f')](_0x578d9c[_0x7927('0x34')][_0x7927('0x1f')]);_0x3917b5[_0x7927('0x1d')]=qs[_0x7927('0x1d')](_0x578d9c[_0x7927('0x34')][_0x7927('0x1d')]);}_0x3917b5[_0x7927('0x3c')]=qs['sort'](_0x578d9c[_0x7927('0x34')][_0x7927('0x3d')]);_0x3917b5[_0x7927('0x3e')]=qs[_0x7927('0x35')](_[_0x7927('0x3f')](_0x578d9c[_0x7927('0x34')],_0x392eaf[_0x7927('0x35')]),_0x3abcbc);if(_0x578d9c[_0x7927('0x34')]['filter']){_0x3917b5['where']=_['merge'](_0x3917b5[_0x7927('0x3e')],{'$or':_[_0x7927('0x2e')](_0x3abcbc,function(_0x1de4d1){if(_0x1de4d1[_0x7927('0x31')]!==_0x7927('0x40')){var _0x103911={};_0x103911[_0x1de4d1[_0x7927('0x2b')]]={'$like':'%'+_0x578d9c[_0x7927('0x34')]['filter']+'%'};return _0x103911;}})});}_0x3917b5=_[_0x7927('0x41')]({},_0x3917b5,_0x578d9c['options']);var _0x3ab01a={'where':_0x3917b5[_0x7927('0x3e')]};return db[_0x7927('0x2f')][_0x7927('0x20')](_0x3ab01a)[_0x7927('0x27')](function(_0x382cc6){_0x2910a9[_0x7927('0x20')]=_0x382cc6;if(_0x578d9c[_0x7927('0x34')][_0x7927('0x42')]){_0x3917b5[_0x7927('0x43')]=[{'all':!![]}];}return db[_0x7927('0x2f')]['findAll'](_0x3917b5);})[_0x7927('0x27')](function(_0x28cec7){_0x2910a9['rows']=_0x28cec7;return _0x2910a9;})[_0x7927('0x27')](respondWithFilteredResult(_0x26bd40,_0x3917b5))[_0x7927('0x44')](handleError(_0x26bd40,null));};exports[_0x7927('0x45')]=function(_0x5d5058,_0x51e937){var _0x5f1076={'raw':![],'where':{'id':_0x5d5058['params']['id']}},_0xdbcedc={};_0xdbcedc[_0x7927('0x33')]=_[_0x7927('0x46')](db[_0x7927('0x2f')][_0x7927('0x47')]);_0xdbcedc[_0x7927('0x34')]=_[_0x7927('0x46')](_0x5d5058['query']);_0xdbcedc[_0x7927('0x35')]=_[_0x7927('0x36')](_0xdbcedc[_0x7927('0x33')],_0xdbcedc[_0x7927('0x34')]);_0x5f1076['attributes']=_[_0x7927('0x36')](_0xdbcedc[_0x7927('0x33')],qs['fields'](_0x5d5058[_0x7927('0x34')][_0x7927('0x37')]));_0x5f1076['attributes']=_0x5f1076['attributes'][_0x7927('0x39')]?_0x5f1076[_0x7927('0x38')]:_0xdbcedc['model'];if(_0x5d5058[_0x7927('0x34')][_0x7927('0x42')]){_0x5f1076[_0x7927('0x43')]=[{'all':!![]}];}_0x5f1076=_[_0x7927('0x41')]({},_0x5f1076,_0x5d5058[_0x7927('0x48')]);return db['SugarcrmAccount'][_0x7927('0x49')](_0x5f1076)[_0x7927('0x27')](handleEntityNotFound(_0x51e937,null))[_0x7927('0x27')](respondWithResult(_0x51e937,null))['catch'](handleError(_0x51e937,null));};exports[_0x7927('0x4a')]=function(_0x559ba9,_0x4d7f64){return db[_0x7927('0x2f')]['create'](_0x559ba9[_0x7927('0x4b')],{})[_0x7927('0x27')](respondWithResult(_0x4d7f64,0xc9))[_0x7927('0x44')](handleError(_0x4d7f64,null));};exports['update']=function(_0x3f5f6e,_0x38a2dd){if(_0x3f5f6e[_0x7927('0x4b')]['id']){delete _0x3f5f6e[_0x7927('0x4b')]['id'];}return db[_0x7927('0x2f')][_0x7927('0x49')]({'where':{'id':_0x3f5f6e[_0x7927('0x4c')]['id']}})[_0x7927('0x27')](handleEntityNotFound(_0x38a2dd,null))[_0x7927('0x27')](saveUpdates(_0x3f5f6e[_0x7927('0x4b')],null))[_0x7927('0x27')](respondWithResult(_0x38a2dd,null))[_0x7927('0x44')](handleError(_0x38a2dd,null));};exports[_0x7927('0x28')]=function(_0x3e7638,_0x1b8e1c){return db[_0x7927('0x2f')][_0x7927('0x49')]({'where':{'id':_0x3e7638[_0x7927('0x4c')]['id']}})[_0x7927('0x27')](handleEntityNotFound(_0x1b8e1c,null))[_0x7927('0x27')](removeEntity(_0x1b8e1c,null))[_0x7927('0x44')](handleError(_0x1b8e1c,null));};exports[_0x7927('0x4d')]=function(_0x11acd7,_0x3cfc5a,_0x459c35){var _0x3c7f1c={};var _0x24841e={};var _0x32cf67;var _0x590830;return db[_0x7927('0x2f')][_0x7927('0x4e')]({'where':{'id':_0x11acd7[_0x7927('0x4c')]['id']}})[_0x7927('0x27')](handleEntityNotFound(_0x3cfc5a,null))[_0x7927('0x27')](function(_0x33f8c1){if(_0x33f8c1){_0x32cf67=_0x33f8c1;_0x24841e['model']=_[_0x7927('0x46')](db[_0x7927('0x4f')]['rawAttributes']);_0x24841e[_0x7927('0x34')]=_[_0x7927('0x46')](_0x11acd7[_0x7927('0x34')]);_0x24841e[_0x7927('0x35')]=_['intersection'](_0x24841e[_0x7927('0x33')],_0x24841e[_0x7927('0x34')]);_0x3c7f1c['attributes']=_[_0x7927('0x36')](_0x24841e[_0x7927('0x33')],qs['fields'](_0x11acd7[_0x7927('0x34')]['fields']));_0x3c7f1c[_0x7927('0x38')]=_0x3c7f1c[_0x7927('0x38')][_0x7927('0x39')]?_0x3c7f1c[_0x7927('0x38')]:_0x24841e[_0x7927('0x33')];_0x3c7f1c[_0x7927('0x3c')]=qs[_0x7927('0x3d')](_0x11acd7[_0x7927('0x34')][_0x7927('0x3d')]);_0x3c7f1c[_0x7927('0x3e')]=qs['filters'](_[_0x7927('0x3f')](_0x11acd7[_0x7927('0x34')],_0x24841e['filters']));if(_0x11acd7[_0x7927('0x34')][_0x7927('0x50')]){_0x3c7f1c[_0x7927('0x3e')]=_[_0x7927('0x41')](_0x3c7f1c[_0x7927('0x3e')],{'$or':_[_0x7927('0x2e')](_0x3c7f1c[_0x7927('0x38')],function(_0x3cfe20){var _0x39eca8={};_0x39eca8[_0x3cfe20]={'$like':'%'+_0x11acd7[_0x7927('0x34')][_0x7927('0x50')]+'%'};return _0x39eca8;})});}_0x3c7f1c=_[_0x7927('0x41')]({},_0x3c7f1c,_0x11acd7[_0x7927('0x48')]);return _0x32cf67[_0x7927('0x4d')](_0x3c7f1c);}})[_0x7927('0x27')](function(_0x12e1f4){if(_0x12e1f4){_0x590830=_0x12e1f4[_0x7927('0x39')];if(!_0x11acd7['query'][_0x7927('0x3a')]('nolimit')){_0x3c7f1c[_0x7927('0x1f')]=qs[_0x7927('0x1f')](_0x11acd7[_0x7927('0x34')]['limit']);_0x3c7f1c[_0x7927('0x1d')]=qs[_0x7927('0x1d')](_0x11acd7['query']['offset']);}return _0x32cf67['getConfigurations'](_0x3c7f1c);}})[_0x7927('0x27')](function(_0x45f5ca){if(_0x45f5ca){return _0x45f5ca?{'count':_0x590830,'rows':_0x45f5ca}:null;}})[_0x7927('0x27')](respondWithResult(_0x3cfc5a,null))[_0x7927('0x44')](handleError(_0x3cfc5a,null));};exports[_0x7927('0x51')]=function(_0x1d5c31,_0x5ae646,_0x2221c1){if(_0x1d5c31['body']['id']){delete _0x1d5c31[_0x7927('0x4b')]['id'];}return db[_0x7927('0x2f')][_0x7927('0x4e')]({'where':{'id':_0x1d5c31[_0x7927('0x4c')]['id']}})[_0x7927('0x27')](handleEntityNotFound(_0x5ae646,null))[_0x7927('0x27')](function(_0x529090){if(_0x529090){_0x1d5c31[_0x7927('0x4b')][_0x7927('0x52')]=_0x529090['id'];_0x1d5c31['body']['Subjects']=integrations[_0x7927('0x53')](_0x1d5c31[_0x7927('0x4b')]['channel'],_0x1d5c31[_0x7927('0x4b')][_0x7927('0x31')]);_0x1d5c31[_0x7927('0x4b')][_0x7927('0x54')]=integrations[_0x7927('0x55')](_0x1d5c31[_0x7927('0x4b')][_0x7927('0x56')],_0x1d5c31[_0x7927('0x4b')]['type']);return db[_0x7927('0x4f')][_0x7927('0x4a')](_0x1d5c31['body'],{'include':[{'model':db[_0x7927('0x57')],'as':_0x7927('0x58')},{'model':db[_0x7927('0x57')],'as':_0x7927('0x54')}]});}return null;})[_0x7927('0x27')](respondWithResult(_0x5ae646,null))[_0x7927('0x44')](handleError(_0x5ae646,null));};exports[_0x7927('0x59')]=function(_0x58215f,_0x5e6e40,_0x50f5a6){var _0x2c70ce='';var _0x563732=['id',_0x7927('0x2b'),_0x7927('0x5a'),_0x7927('0x5b'),'description',_0x7927('0x5c'),'duration_hours',_0x7927('0x5d'),_0x7927('0x5e'),_0x7927('0x5f'),_0x7927('0x60'),_0x7927('0x61')];return db[_0x7927('0x2f')][_0x7927('0x4e')]({'where':{'id':_0x58215f[_0x7927('0x4c')]['id']},'attributes':['id','username',_0x7927('0x62'),_0x7927('0x63')]})[_0x7927('0x27')](handleEntityNotFound(_0x5e6e40,null))[_0x7927('0x27')](function(_0x203367){if(_0x203367){_0x2c70ce=_0x203367[_0x7927('0x63')];var _0x4d8e48=_0x2c70ce[_0x7927('0x64')](-0x1);if(_0x4d8e48==='/'){_0x2c70ce=_0x2c70ce[_0x7927('0x65')](0x0,_0x2c70ce['lastIndexOf'](_0x4d8e48));}return rp({'method':_0x7927('0x66'),'uri':util[_0x7927('0x67')](_0x7927('0x68'),_0x2c70ce,_0x7927('0x69')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0x7927('0x6a'),'rest_data':JSON[_0x7927('0x6b')]({'user_auth':{'user_name':_0x203367[_0x7927('0x6c')],'password':_0x203367[_0x7927('0x62')],'encryption':_0x7927('0x6d')},'application':_0x7927('0x6e')})}});}})[_0x7927('0x27')](function(_0x49b18d){if(_0x49b18d&&_0x49b18d['name']!==_0x7927('0x6f')&&_0x49b18d[_0x7927('0x2b')]!=='Password\x20Expired'){return rp({'method':_0x7927('0x66'),'uri':util[_0x7927('0x67')](_0x7927('0x68'),_0x2c70ce,_0x7927('0x69')),'json':!![],'form':{'method':_0x7927('0x70'),'input_type':_0x7927('0x6a'),'response_type':_0x7927('0x6a'),'rest_data':JSON['stringify']({'session':_0x49b18d['id'],'module_name':'Calls'})}})[_0x7927('0x27')](function(_0xc87f18){if(_0xc87f18){var _0x4f5cbf=_[_0x7927('0x71')](_0xc87f18[_0x7927('0x72')]);_['remove'](_0x4f5cbf,function(_0x5870c5){return _0x563732[_0x7927('0x73')](_0x5870c5[_0x7927('0x2b')]);});return{'count':_0x4f5cbf[_0x7927('0x39')],'rows':_[_0x7927('0x2e')](_0x4f5cbf,function(_0x3491ac){return{'id':_0x3491ac[_0x7927('0x2b')],'name':_0x3491ac[_0x7927('0x74')],'custom':_[_0x7927('0x75')](_0x3491ac['name'],'_c')?!![]:![],'options':_0x3491ac[_0x7927('0x48')]?_[_0x7927('0x2e')](_[_0x7927('0x71')](_0x3491ac['options']),function(_0x25dc6c){return{'name':_0x25dc6c['value'],'value':_0x25dc6c[_0x7927('0x2b')]};}):[]};})};}})[_0x7927('0x27')](respondWithResult(_0x5e6e40,null))[_0x7927('0x44')](function(_0xcb19fa){var _0x16c903=_0x58215f[_0x7927('0x34')]['test']?0x1f4:_0xcb19fa[_0x7927('0x76')]||0x1f4;logger[_0x7927('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0x7927('0x59'),_0x16c903,JSON[_0x7927('0x6b')](_0xcb19fa));delete _0xcb19fa[_0x7927('0x2b')];if(_0x16c903===0x191){_0x16c903=0x190;}_0x5e6e40[_0x7927('0x1b')](_0x16c903)[_0x7927('0x2c')](_0x58215f[_0x7927('0x34')][_0x7927('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0xcb19fa[_0x7927('0x76')]}:_0xcb19fa);});}else{var _0x1b5626=0x1f4;_0x5e6e40[_0x7927('0x1b')](_0x1b5626)[_0x7927('0x2c')]({'message':_0x7927('0x78'),'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 bbe664d..f85f47f 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 _0xb98b=['../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x2c4841,_0x10c9fe){var _0x1a24c0=function(_0xf068df){while(--_0xf068df){_0x2c4841['push'](_0x2c4841['shift']());}};_0x1a24c0(++_0x10c9fe);}(_0xb98b,0x144));var _0xbb98=function(_0x355202,_0x56d959){_0x355202=_0x355202-0x0;var _0x2d4eb8=_0xb98b[_0x355202];return _0x2d4eb8;};'use strict';var _=require(_0xbb98('0x0'));var util=require(_0xbb98('0x1'));var logger=require(_0xbb98('0x2'))(_0xbb98('0x3'));var moment=require('moment');var BPromise=require(_0xbb98('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb98('0x5'));var rimraf=require('rimraf');var config=require(_0xbb98('0x6'));var attributes=require(_0xbb98('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xbb98('0x8')]=function(_0x1bab20,_0x331e49){return _0x1bab20[_0xbb98('0x9')](_0xbb98('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d60=['rimraf','../../components/integrations/configuration','define','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x999255,_0x426e0b){var _0x192f4e=function(_0xe5ed3e){while(--_0xe5ed3e){_0x999255['push'](_0x999255['shift']());}};_0x192f4e(++_0x426e0b);}(_0x7d60,0xd0));var _0x07d6=function(_0x1c5341,_0x223383){_0x1c5341=_0x1c5341-0x0;var _0x4215c0=_0x7d60[_0x1c5341];return _0x4215c0;};'use strict';var _=require(_0x07d6('0x0'));var util=require(_0x07d6('0x1'));var logger=require(_0x07d6('0x2'))(_0x07d6('0x3'));var moment=require(_0x07d6('0x4'));var BPromise=require(_0x07d6('0x5'));var rp=require(_0x07d6('0x6'));var fs=require('fs');var path=require(_0x07d6('0x7'));var rimraf=require(_0x07d6('0x8'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x07d6('0x9'));module['exports']=function(_0x1d70f9,_0x453256){return _0x1d70f9[_0x07d6('0xa')]('SugarcrmAccount',attributes,{'tableName':_0x07d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index bdbe9dd..ddf6af2 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 _0xac63=['error','message','info','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','limit','include','model','map','ShowSugarcrmAccount','find','raw','attributes','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x54b34b,_0x2a4eab){var _0x3518b7=function(_0xfda22a){while(--_0xfda22a){_0x54b34b['push'](_0x54b34b['shift']());}};_0x3518b7(++_0x2a4eab);}(_0xac63,0x112));var _0x3ac6=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xac63[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x3ac6('0x0'));var util=require(_0x3ac6('0x1'));var moment=require('moment');var BPromise=require(_0x3ac6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ac6('0x3'));var db=require(_0x3ac6('0x4'))['db'];var utils=require(_0x3ac6('0x5'));var logger=require(_0x3ac6('0x6'))(_0x3ac6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x57c67a,_0x215db0,_0x1dd82a){return new BPromise(function(_0x54f915,_0x582eeb){return client[_0x3ac6('0x8')](_0x57c67a,_0x1dd82a)[_0x3ac6('0x9')](function(_0x2f1a38){logger['info'](_0x3ac6('0xa'),_0x215db0,_0x3ac6('0xb'));logger[_0x3ac6('0xc')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x215db0,'request\x20sent',JSON[_0x3ac6('0xd')](_0x2f1a38));if(_0x2f1a38[_0x3ac6('0xe')]){if(_0x2f1a38[_0x3ac6('0xe')]['code']===0x1f4){logger[_0x3ac6('0xe')](_0x3ac6('0xa'),_0x215db0,_0x2f1a38[_0x3ac6('0xe')][_0x3ac6('0xf')]);return _0x582eeb(_0x2f1a38[_0x3ac6('0xe')][_0x3ac6('0xf')]);}logger[_0x3ac6('0xe')](_0x3ac6('0xa'),_0x215db0,_0x2f1a38[_0x3ac6('0xe')][_0x3ac6('0xf')]);return _0x54f915(_0x2f1a38['error']['message']);}else{logger[_0x3ac6('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x215db0,_0x3ac6('0xb'));_0x54f915(_0x2f1a38[_0x3ac6('0x11')][_0x3ac6('0xf')]);}})['catch'](function(_0xed06b8){logger[_0x3ac6('0xe')](_0x3ac6('0xa'),_0x215db0,_0xed06b8);_0x582eeb(_0xed06b8);});});}exports[_0x3ac6('0x12')]=function(_0x7706f9){var _0x762496=this;return new Promise(function(_0x4a3e14,_0x85ca8b){return db[_0x3ac6('0x13')][_0x3ac6('0x14')]({'raw':_0x7706f9[_0x3ac6('0x15')]?_0x7706f9['options']['raw']===undefined?!![]:![]:!![],'where':_0x7706f9[_0x3ac6('0x15')]?_0x7706f9[_0x3ac6('0x15')][_0x3ac6('0x16')]||null:null,'attributes':_0x7706f9[_0x3ac6('0x15')]?_0x7706f9[_0x3ac6('0x15')]['attributes']||null:null,'limit':_0x7706f9['options']?_0x7706f9[_0x3ac6('0x15')][_0x3ac6('0x17')]||null:null,'include':_0x7706f9[_0x3ac6('0x15')]?_0x7706f9[_0x3ac6('0x15')][_0x3ac6('0x18')]?_['map'](_0x7706f9[_0x3ac6('0x15')]['include'],function(_0x3c1795){return{'model':db[_0x3c1795[_0x3ac6('0x19')]],'as':_0x3c1795['as'],'attributes':_0x3c1795['attributes'],'include':_0x3c1795[_0x3ac6('0x18')]?_[_0x3ac6('0x1a')](_0x3c1795[_0x3ac6('0x18')],function(_0x20d4ac){return{'model':db[_0x20d4ac['model']],'as':_0x20d4ac['as'],'attributes':_0x20d4ac['attributes'],'include':_0x20d4ac[_0x3ac6('0x18')]?_[_0x3ac6('0x1a')](_0x20d4ac[_0x3ac6('0x18')],function(_0x5e4948){return{'model':db[_0x5e4948[_0x3ac6('0x19')]],'as':_0x5e4948['as'],'attributes':_0x5e4948['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ac6('0x9')](function(_0x5ee237){logger[_0x3ac6('0x10')](_0x3ac6('0x12'),_0x7706f9);logger[_0x3ac6('0xc')]('GetSugarcrmAccount',_0x7706f9,JSON[_0x3ac6('0xd')](_0x5ee237));_0x4a3e14(_0x5ee237);})['catch'](function(_0x2e6c72){logger[_0x3ac6('0xe')]('GetSugarcrmAccount',_0x2e6c72[_0x3ac6('0xf')],_0x7706f9);_0x85ca8b(_0x762496['error'](0x1f4,_0x2e6c72[_0x3ac6('0xf')]));});});};exports[_0x3ac6('0x1b')]=function(_0x4ea7e9){var _0x11a22d=this;return new Promise(function(_0x5a17c5,_0x5b6ccd){return db[_0x3ac6('0x13')][_0x3ac6('0x1c')]({'raw':_0x4ea7e9['options']?_0x4ea7e9['options'][_0x3ac6('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ea7e9[_0x3ac6('0x15')]?_0x4ea7e9['options']['where']||null:null,'attributes':_0x4ea7e9[_0x3ac6('0x15')]?_0x4ea7e9[_0x3ac6('0x15')][_0x3ac6('0x1e')]||null:null,'include':_0x4ea7e9[_0x3ac6('0x15')]?_0x4ea7e9[_0x3ac6('0x15')][_0x3ac6('0x18')]?_['map'](_0x4ea7e9['options'][_0x3ac6('0x18')],function(_0x4a7ee2){return{'model':db[_0x4a7ee2[_0x3ac6('0x19')]],'as':_0x4a7ee2['as'],'attributes':_0x4a7ee2[_0x3ac6('0x1e')],'include':_0x4a7ee2[_0x3ac6('0x18')]?_[_0x3ac6('0x1a')](_0x4a7ee2[_0x3ac6('0x18')],function(_0x19ca52){return{'model':db[_0x19ca52[_0x3ac6('0x19')]],'as':_0x19ca52['as'],'attributes':_0x19ca52['attributes'],'include':_0x19ca52['include']?_['map'](_0x19ca52[_0x3ac6('0x18')],function(_0x330451){return{'model':db[_0x330451[_0x3ac6('0x19')]],'as':_0x330451['as'],'attributes':_0x330451[_0x3ac6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3ac6('0x9')](function(_0x57e90f){logger[_0x3ac6('0x10')](_0x3ac6('0x1b'),_0x4ea7e9);logger[_0x3ac6('0xc')](_0x3ac6('0x1b'),_0x4ea7e9,JSON[_0x3ac6('0xd')](_0x57e90f));_0x5a17c5(_0x57e90f);})[_0x3ac6('0x1f')](function(_0x3701e7){logger[_0x3ac6('0xe')](_0x3ac6('0x1b'),_0x3701e7[_0x3ac6('0xf')],_0x4ea7e9);_0x5b6ccd(_0x11a22d[_0x3ac6('0xe')](0x1f4,_0x3701e7[_0x3ac6('0xf')]));});});}; \ No newline at end of file +var _0xbba5=['include','map','model','GetSugarcrmAccount','find','ShowSugarcrmAccount','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','SugarcrmAccount','findAll','options','raw','where','attributes','limit'];(function(_0x30ce7d,_0x20293f){var _0x48e89c=function(_0xe2ec32){while(--_0xe2ec32){_0x30ce7d['push'](_0x30ce7d['shift']());}};_0x48e89c(++_0x20293f);}(_0xbba5,0x11e));var _0x5bba=function(_0x1eda12,_0x4133e2){_0x1eda12=_0x1eda12-0x0;var _0x324067=_0xbba5[_0x1eda12];return _0x324067;};'use strict';var _=require('lodash');var util=require(_0x5bba('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5bba('0x1'));var db=require(_0x5bba('0x2'))['db'];var utils=require(_0x5bba('0x3'));var logger=require(_0x5bba('0x4'))(_0x5bba('0x5'));var config=require(_0x5bba('0x6'));var jayson=require(_0x5bba('0x7'));var client=jayson[_0x5bba('0x8')][_0x5bba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x317e3e,_0x52784e,_0x45fd7){return new BPromise(function(_0x3f2437,_0x31de19){return client[_0x5bba('0xa')](_0x317e3e,_0x45fd7)[_0x5bba('0xb')](function(_0x5066d2){logger[_0x5bba('0xc')](_0x5bba('0xd'),_0x52784e,'request\x20sent');logger[_0x5bba('0xe')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x52784e,_0x5bba('0xf'),JSON[_0x5bba('0x10')](_0x5066d2));if(_0x5066d2[_0x5bba('0x11')]){if(_0x5066d2[_0x5bba('0x11')][_0x5bba('0x12')]===0x1f4){logger[_0x5bba('0x11')](_0x5bba('0xd'),_0x52784e,_0x5066d2[_0x5bba('0x11')][_0x5bba('0x13')]);return _0x31de19(_0x5066d2[_0x5bba('0x11')][_0x5bba('0x13')]);}logger[_0x5bba('0x11')](_0x5bba('0xd'),_0x52784e,_0x5066d2[_0x5bba('0x11')]['message']);return _0x3f2437(_0x5066d2[_0x5bba('0x11')][_0x5bba('0x13')]);}else{logger[_0x5bba('0xc')](_0x5bba('0xd'),_0x52784e,_0x5bba('0xf'));_0x3f2437(_0x5066d2[_0x5bba('0x14')][_0x5bba('0x13')]);}})[_0x5bba('0x15')](function(_0x5f0f56){logger['error'](_0x5bba('0xd'),_0x52784e,_0x5f0f56);_0x31de19(_0x5f0f56);});});}exports['GetSugarcrmAccount']=function(_0x199ef2){var _0x24a944=this;return new Promise(function(_0x32064a,_0x5df108){return db[_0x5bba('0x16')][_0x5bba('0x17')]({'raw':_0x199ef2[_0x5bba('0x18')]?_0x199ef2[_0x5bba('0x18')][_0x5bba('0x19')]===undefined?!![]:![]:!![],'where':_0x199ef2[_0x5bba('0x18')]?_0x199ef2[_0x5bba('0x18')][_0x5bba('0x1a')]||null:null,'attributes':_0x199ef2[_0x5bba('0x18')]?_0x199ef2[_0x5bba('0x18')][_0x5bba('0x1b')]||null:null,'limit':_0x199ef2[_0x5bba('0x18')]?_0x199ef2[_0x5bba('0x18')][_0x5bba('0x1c')]||null:null,'include':_0x199ef2[_0x5bba('0x18')]?_0x199ef2['options'][_0x5bba('0x1d')]?_[_0x5bba('0x1e')](_0x199ef2[_0x5bba('0x18')][_0x5bba('0x1d')],function(_0x1e8dc7){return{'model':db[_0x1e8dc7[_0x5bba('0x1f')]],'as':_0x1e8dc7['as'],'attributes':_0x1e8dc7[_0x5bba('0x1b')],'include':_0x1e8dc7[_0x5bba('0x1d')]?_['map'](_0x1e8dc7[_0x5bba('0x1d')],function(_0x16763c){return{'model':db[_0x16763c['model']],'as':_0x16763c['as'],'attributes':_0x16763c[_0x5bba('0x1b')],'include':_0x16763c[_0x5bba('0x1d')]?_[_0x5bba('0x1e')](_0x16763c['include'],function(_0x6112d2){return{'model':db[_0x6112d2[_0x5bba('0x1f')]],'as':_0x6112d2['as'],'attributes':_0x6112d2[_0x5bba('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bb7e7){logger['info'](_0x5bba('0x20'),_0x199ef2);logger[_0x5bba('0xe')](_0x5bba('0x20'),_0x199ef2,JSON['stringify'](_0x3bb7e7));_0x32064a(_0x3bb7e7);})['catch'](function(_0x5da60a){logger[_0x5bba('0x11')](_0x5bba('0x20'),_0x5da60a[_0x5bba('0x13')],_0x199ef2);_0x5df108(_0x24a944[_0x5bba('0x11')](0x1f4,_0x5da60a[_0x5bba('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x528739){var _0x1829a2=this;return new Promise(function(_0x52e9d9,_0x44f0ad){return db[_0x5bba('0x16')][_0x5bba('0x21')]({'raw':_0x528739['options']?_0x528739[_0x5bba('0x18')][_0x5bba('0x19')]===undefined?!![]:![]:!![],'where':_0x528739['options']?_0x528739[_0x5bba('0x18')][_0x5bba('0x1a')]||null:null,'attributes':_0x528739[_0x5bba('0x18')]?_0x528739[_0x5bba('0x18')][_0x5bba('0x1b')]||null:null,'include':_0x528739[_0x5bba('0x18')]?_0x528739['options'][_0x5bba('0x1d')]?_['map'](_0x528739['options'][_0x5bba('0x1d')],function(_0x4aa844){return{'model':db[_0x4aa844[_0x5bba('0x1f')]],'as':_0x4aa844['as'],'attributes':_0x4aa844[_0x5bba('0x1b')],'include':_0x4aa844[_0x5bba('0x1d')]?_[_0x5bba('0x1e')](_0x4aa844[_0x5bba('0x1d')],function(_0x740572){return{'model':db[_0x740572['model']],'as':_0x740572['as'],'attributes':_0x740572['attributes'],'include':_0x740572[_0x5bba('0x1d')]?_[_0x5bba('0x1e')](_0x740572[_0x5bba('0x1d')],function(_0x33d6f5){return{'model':db[_0x33d6f5[_0x5bba('0x1f')]],'as':_0x33d6f5['as'],'attributes':_0x33d6f5['attributes']};}):[]};}):[]};}):[]:[]})[_0x5bba('0xb')](function(_0x100869){logger[_0x5bba('0xc')](_0x5bba('0x22'),_0x528739);logger[_0x5bba('0xe')]('ShowSugarcrmAccount',_0x528739,JSON[_0x5bba('0x10')](_0x100869));_0x52e9d9(_0x100869);})[_0x5bba('0x15')](function(_0x264e45){logger[_0x5bba('0x11')](_0x5bba('0x22'),_0x264e45[_0x5bba('0x13')],_0x528739);_0x44f0ad(_0x1829a2[_0x5bba('0x11')](0x1f4,_0x264e45[_0x5bba('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 2ea2032..3fb6993 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 _0x6ec4=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x123655,_0x5ede4e){var _0x3d393b=function(_0x3903aa){while(--_0x3903aa){_0x123655['push'](_0x123655['shift']());}};_0x3d393b(++_0x5ede4e);}(_0x6ec4,0x1dc));var _0x46ec=function(_0x1f9faf,_0x227808){_0x1f9faf=_0x1f9faf-0x0;var _0x13ab2c=_0x6ec4[_0x1f9faf];return _0x13ab2c;};'use strict';var multer=require(_0x46ec('0x0'));var util=require(_0x46ec('0x1'));var path=require('path');var timeout=require(_0x46ec('0x2'));var express=require(_0x46ec('0x3'));var router=express[_0x46ec('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x46ec('0x5'));var interaction=require(_0x46ec('0x6'));var config=require(_0x46ec('0x7'));var controller=require(_0x46ec('0x8'));router[_0x46ec('0x9')]('/',auth[_0x46ec('0xa')](),controller[_0x46ec('0xb')]);router[_0x46ec('0x9')](_0x46ec('0xc'),auth['isAuthenticated'](),controller[_0x46ec('0xd')]);router[_0x46ec('0x9')](_0x46ec('0xe'),auth[_0x46ec('0xa')](),controller['getFields']);router['get'](_0x46ec('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x46ec('0x9')](_0x46ec('0x10'),auth[_0x46ec('0xa')](),controller[_0x46ec('0x11')]);router[_0x46ec('0x12')]('/',auth[_0x46ec('0xa')](),controller[_0x46ec('0x13')]);router[_0x46ec('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x46ec('0x15')]);router['delete'](_0x46ec('0xc'),auth[_0x46ec('0xa')](),controller[_0x46ec('0x16')]);module[_0x46ec('0x17')]=router; \ No newline at end of file +var _0xeea1=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x9de82c,_0x573e29){var _0x4431e3=function(_0x55ec6f){while(--_0x55ec6f){_0x9de82c['push'](_0x9de82c['shift']());}};_0x4431e3(++_0x573e29);}(_0xeea1,0x1c7));var _0x1eea=function(_0x559fa6,_0x58609d){_0x559fa6=_0x559fa6-0x0;var _0x815bc6=_0xeea1[_0x559fa6];return _0x815bc6;};'use strict';var multer=require(_0x1eea('0x0'));var util=require(_0x1eea('0x1'));var path=require(_0x1eea('0x2'));var timeout=require(_0x1eea('0x3'));var express=require(_0x1eea('0x4'));var router=express[_0x1eea('0x5')]();var fs_extra=require(_0x1eea('0x6'));var auth=require(_0x1eea('0x7'));var interaction=require(_0x1eea('0x8'));var config=require('../../config/environment');var controller=require(_0x1eea('0x9'));router[_0x1eea('0xa')]('/',auth[_0x1eea('0xb')](),controller[_0x1eea('0xc')]);router['get'](_0x1eea('0xd'),auth[_0x1eea('0xb')](),controller[_0x1eea('0xe')]);router[_0x1eea('0xa')](_0x1eea('0xf'),auth[_0x1eea('0xb')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x1eea('0xb')](),controller[_0x1eea('0x10')]);router['get'](_0x1eea('0x11'),auth[_0x1eea('0xb')](),controller['getDescriptions']);router['post']('/',auth[_0x1eea('0xb')](),controller[_0x1eea('0x12')]);router[_0x1eea('0x13')](_0x1eea('0xd'),auth[_0x1eea('0xb')](),controller['update']);router[_0x1eea('0x14')]('/:id',auth[_0x1eea('0xb')](),controller[_0x1eea('0x15')]);module[_0x1eea('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 97f3bd3..77a73c8 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 _0x33f0=['sequelize','exports','STRING'];(function(_0x1da6be,_0x5d4e33){var _0x1264cf=function(_0x65beb4){while(--_0x65beb4){_0x1da6be['push'](_0x1da6be['shift']());}};_0x1264cf(++_0x5d4e33);}(_0x33f0,0xfc));var _0x033f=function(_0xd9e858,_0x5b12e7){_0xd9e858=_0xd9e858-0x0;var _0x48204d=_0x33f0[_0xd9e858];return _0x48204d;};'use strict';var Sequelize=require(_0x033f('0x0'));module[_0x033f('0x1')]={'name':{'type':Sequelize[_0x033f('0x2')]},'description':{'type':Sequelize[_0x033f('0x2')]}}; \ No newline at end of file +var _0x97bd=['exports','STRING','sequelize'];(function(_0x5927a2,_0xd41f21){var _0x242579=function(_0x38aad3){while(--_0x38aad3){_0x5927a2['push'](_0x5927a2['shift']());}};_0x242579(++_0xd41f21);}(_0x97bd,0x194));var _0xd97b=function(_0x119f18,_0x32f881){_0x119f18=_0x119f18-0x0;var _0x1eb51d=_0x97bd[_0x119f18];return _0x1eb51d;};'use strict';var Sequelize=require(_0xd97b('0x0'));module[_0xd97b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd97b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 8fa5099..0a0ed31 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 _0x1b68=['index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','name','options','SugarcrmConfiguration','count','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','update','getFields','findOne','SugarcrmField','pick','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','then','destroy','stack','send'];(function(_0x389663,_0x120107){var _0x2acf45=function(_0xd888d2){while(--_0xd888d2){_0x389663['push'](_0x389663['shift']());}};_0x2acf45(++_0x120107);}(_0x1b68,0x7e));var _0x81b6=function(_0xf6866a,_0x19fd23){_0xf6866a=_0xf6866a-0x0;var _0x4cdd19=_0x1b68[_0xf6866a];return _0x4cdd19;};'use strict';var emlformat=require(_0x81b6('0x0'));var rimraf=require(_0x81b6('0x1'));var zipdir=require(_0x81b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x81b6('0x3'));var moment=require('moment');var BPromise=require(_0x81b6('0x4'));var Mustache=require(_0x81b6('0x5'));var util=require('util');var path=require(_0x81b6('0x6'));var sox=require(_0x81b6('0x7'));var csv=require(_0x81b6('0x8'));var ejs=require(_0x81b6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x81b6('0xa'));var crypto=require(_0x81b6('0xb'));var jsforce=require(_0x81b6('0xc'));var deskjs=require(_0x81b6('0xd'));var toCsv=require(_0x81b6('0x8'));var querystring=require(_0x81b6('0xe'));var Papa=require('papaparse');var Redis=require(_0x81b6('0xf'));var authService=require(_0x81b6('0x10'));var qs=require(_0x81b6('0x11'));var as=require(_0x81b6('0x12'));var hardwareService=require(_0x81b6('0x13'));var logger=require(_0x81b6('0x14'))(_0x81b6('0x15'));var utils=require(_0x81b6('0x16'));var config=require(_0x81b6('0x17'));var licenseUtil=require(_0x81b6('0x18'));var db=require(_0x81b6('0x19'))['db'];function respondWithStatusCode(_0x5eeea6,_0x4dbcc4){_0x4dbcc4=_0x4dbcc4||0xcc;return function(_0x46f5dc){if(_0x46f5dc){return _0x5eeea6[_0x81b6('0x1a')](_0x4dbcc4);}return _0x5eeea6[_0x81b6('0x1b')](_0x4dbcc4)[_0x81b6('0x1c')]();};}function respondWithResult(_0x238ac5,_0x2d1266){_0x2d1266=_0x2d1266||0xc8;return function(_0x54b1f4){if(_0x54b1f4){return _0x238ac5[_0x81b6('0x1b')](_0x2d1266)[_0x81b6('0x1d')](_0x54b1f4);}};}function respondWithFilteredResult(_0x4e4d0c,_0x2c8e48){return function(_0x3b3203){if(_0x3b3203){var _0x3934c3=typeof _0x2c8e48['offset']===_0x81b6('0x1e')&&typeof _0x2c8e48[_0x81b6('0x1f')]===_0x81b6('0x1e');var _0x2944d1=_0x3b3203['count'];var _0x243349=_0x3934c3?0x0:_0x2c8e48[_0x81b6('0x20')];var _0x172bc2=_0x3934c3?_0x3b3203['count']:_0x2c8e48[_0x81b6('0x20')]+_0x2c8e48[_0x81b6('0x1f')];var _0xca53fe;if(_0x172bc2>=_0x2944d1){_0x172bc2=_0x2944d1;_0xca53fe=0xc8;}else{_0xca53fe=0xce;}_0x4e4d0c[_0x81b6('0x1b')](_0xca53fe);return _0x4e4d0c[_0x81b6('0x21')](_0x81b6('0x22'),_0x243349+'-'+_0x172bc2+'/'+_0x2944d1)['json'](_0x3b3203);}return null;};}function patchUpdates(_0x2905ac){return function(_0xf0ab35){try{jsonpatch[_0x81b6('0x23')](_0xf0ab35,_0x2905ac,!![]);}catch(_0x3d09ea){return BPromise[_0x81b6('0x24')](_0x3d09ea);}return _0xf0ab35[_0x81b6('0x25')]();};}function saveUpdates(_0x538d32,_0x38ce88){return function(_0x467bf1){if(_0x467bf1){return _0x467bf1['update'](_0x538d32)[_0x81b6('0x26')](function(_0x2bf93f){return _0x2bf93f;});}return null;};}function removeEntity(_0x5ef80d,_0x23355e){return function(_0x34a971){if(_0x34a971){return _0x34a971[_0x81b6('0x27')]()['then'](function(){_0x5ef80d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20fc44,_0x1a6ad4){return function(_0xacc098){if(!_0xacc098){_0x20fc44[_0x81b6('0x1a')](0x194);}return _0xacc098;};}function handleError(_0x329602,_0x462ef9){_0x462ef9=_0x462ef9||0x1f4;return function(_0x2f9b71){logger['error'](_0x2f9b71[_0x81b6('0x28')]);if(_0x2f9b71['name']){delete _0x2f9b71['name'];}_0x329602['status'](_0x462ef9)[_0x81b6('0x29')](_0x2f9b71);};}exports[_0x81b6('0x2a')]=function(_0x58c04d,_0x4b1aed){var _0x5c8679={},_0x1c5ea5={},_0x316bc8={'count':0x0,'rows':[]};var _0x1d0775=_[_0x81b6('0x2b')](db['SugarcrmConfiguration'][_0x81b6('0x2c')],function(_0x5e2fc4){return{'name':_0x5e2fc4[_0x81b6('0x2d')],'type':_0x5e2fc4[_0x81b6('0x2e')][_0x81b6('0x2f')]};});_0x1c5ea5[_0x81b6('0x30')]=_[_0x81b6('0x2b')](_0x1d0775,'name');_0x1c5ea5[_0x81b6('0x31')]=_['keys'](_0x58c04d[_0x81b6('0x31')]);_0x1c5ea5[_0x81b6('0x32')]=_[_0x81b6('0x33')](_0x1c5ea5[_0x81b6('0x30')],_0x1c5ea5[_0x81b6('0x31')]);_0x5c8679[_0x81b6('0x34')]=_[_0x81b6('0x33')](_0x1c5ea5['model'],qs[_0x81b6('0x35')](_0x58c04d['query'][_0x81b6('0x35')]));_0x5c8679[_0x81b6('0x34')]=_0x5c8679[_0x81b6('0x34')]['length']?_0x5c8679[_0x81b6('0x34')]:_0x1c5ea5[_0x81b6('0x30')];if(!_0x58c04d[_0x81b6('0x31')][_0x81b6('0x36')]('nolimit')){_0x5c8679[_0x81b6('0x1f')]=qs[_0x81b6('0x1f')](_0x58c04d[_0x81b6('0x31')][_0x81b6('0x1f')]);_0x5c8679['offset']=qs[_0x81b6('0x20')](_0x58c04d[_0x81b6('0x31')]['offset']);}_0x5c8679[_0x81b6('0x37')]=qs[_0x81b6('0x38')](_0x58c04d[_0x81b6('0x31')][_0x81b6('0x38')]);_0x5c8679['where']=qs[_0x81b6('0x32')](_['pick'](_0x58c04d[_0x81b6('0x31')],_0x1c5ea5['filters']),_0x1d0775);if(_0x58c04d[_0x81b6('0x31')][_0x81b6('0x39')]){_0x5c8679[_0x81b6('0x3a')]=_[_0x81b6('0x3b')](_0x5c8679[_0x81b6('0x3a')],{'$or':_[_0x81b6('0x2b')](_0x1d0775,function(_0x407f3f){if(_0x407f3f[_0x81b6('0x2e')]!==_0x81b6('0x3c')){var _0x21e589={};_0x21e589[_0x407f3f[_0x81b6('0x3d')]]={'$like':'%'+_0x58c04d[_0x81b6('0x31')][_0x81b6('0x39')]+'%'};return _0x21e589;}})});}_0x5c8679=_[_0x81b6('0x3b')]({},_0x5c8679,_0x58c04d[_0x81b6('0x3e')]);var _0x576984={'where':_0x5c8679[_0x81b6('0x3a')]};return db[_0x81b6('0x3f')][_0x81b6('0x40')](_0x576984)[_0x81b6('0x26')](function(_0x42c75b){_0x316bc8[_0x81b6('0x40')]=_0x42c75b;if(_0x58c04d[_0x81b6('0x31')][_0x81b6('0x41')]){_0x5c8679[_0x81b6('0x42')]=[{'all':!![]}];}return db[_0x81b6('0x3f')][_0x81b6('0x43')](_0x5c8679);})[_0x81b6('0x26')](function(_0x234b2b){_0x316bc8[_0x81b6('0x44')]=_0x234b2b;return _0x316bc8;})[_0x81b6('0x26')](respondWithFilteredResult(_0x4b1aed,_0x5c8679))[_0x81b6('0x45')](handleError(_0x4b1aed,null));};exports['show']=function(_0x3502ea,_0x10bbd9){var _0x1ede45={'raw':![],'where':{'id':_0x3502ea[_0x81b6('0x46')]['id']}},_0x59f1ff={};_0x59f1ff[_0x81b6('0x30')]=_[_0x81b6('0x47')](db['SugarcrmConfiguration'][_0x81b6('0x2c')]);_0x59f1ff['query']=_[_0x81b6('0x47')](_0x3502ea['query']);_0x59f1ff[_0x81b6('0x32')]=_[_0x81b6('0x33')](_0x59f1ff[_0x81b6('0x30')],_0x59f1ff['query']);_0x1ede45[_0x81b6('0x34')]=_['intersection'](_0x59f1ff[_0x81b6('0x30')],qs[_0x81b6('0x35')](_0x3502ea[_0x81b6('0x31')][_0x81b6('0x35')]));_0x1ede45['attributes']=_0x1ede45['attributes'][_0x81b6('0x48')]?_0x1ede45[_0x81b6('0x34')]:_0x59f1ff[_0x81b6('0x30')];if(_0x3502ea[_0x81b6('0x31')][_0x81b6('0x41')]){_0x1ede45[_0x81b6('0x42')]=[{'all':!![]}];}_0x1ede45=_[_0x81b6('0x3b')]({},_0x1ede45,_0x3502ea[_0x81b6('0x3e')]);return db[_0x81b6('0x3f')][_0x81b6('0x49')](_0x1ede45)[_0x81b6('0x26')](handleEntityNotFound(_0x10bbd9,null))[_0x81b6('0x26')](respondWithResult(_0x10bbd9,null))[_0x81b6('0x45')](handleError(_0x10bbd9,null));};exports[_0x81b6('0x4a')]=function(_0x5c1a52,_0x3358df){return db[_0x81b6('0x3f')][_0x81b6('0x4a')](_0x5c1a52[_0x81b6('0x4b')],{})['then'](respondWithResult(_0x3358df,0xc9))[_0x81b6('0x45')](handleError(_0x3358df,null));};exports[_0x81b6('0x4c')]=function(_0xacbb56,_0x43b8b7){if(_0xacbb56[_0x81b6('0x4b')]['id']){delete _0xacbb56[_0x81b6('0x4b')]['id'];}return db[_0x81b6('0x3f')][_0x81b6('0x49')]({'where':{'id':_0xacbb56[_0x81b6('0x46')]['id']}})[_0x81b6('0x26')](handleEntityNotFound(_0x43b8b7,null))[_0x81b6('0x26')](saveUpdates(_0xacbb56[_0x81b6('0x4b')],null))['then'](respondWithResult(_0x43b8b7,null))[_0x81b6('0x45')](handleError(_0x43b8b7,null));};exports[_0x81b6('0x27')]=function(_0x3b14de,_0x809eb5){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x3b14de[_0x81b6('0x46')]['id']}})[_0x81b6('0x26')](handleEntityNotFound(_0x809eb5,null))[_0x81b6('0x26')](removeEntity(_0x809eb5,null))['catch'](handleError(_0x809eb5,null));};exports[_0x81b6('0x4d')]=function(_0x534b6c,_0x53bc15,_0x58161a){var _0x1ea08b={};var _0x35308c={};var _0x4cd730;var _0x31b03d;return db[_0x81b6('0x3f')][_0x81b6('0x4e')]({'where':{'id':_0x534b6c['params']['id']}})[_0x81b6('0x26')](handleEntityNotFound(_0x53bc15,null))['then'](function(_0x37afd1){if(_0x37afd1){_0x4cd730=_0x37afd1;_0x35308c[_0x81b6('0x30')]=_[_0x81b6('0x47')](db[_0x81b6('0x4f')]['rawAttributes']);_0x35308c[_0x81b6('0x31')]=_[_0x81b6('0x47')](_0x534b6c['query']);_0x35308c['filters']=_[_0x81b6('0x33')](_0x35308c[_0x81b6('0x30')],_0x35308c[_0x81b6('0x31')]);_0x1ea08b[_0x81b6('0x34')]=_[_0x81b6('0x33')](_0x35308c[_0x81b6('0x30')],qs[_0x81b6('0x35')](_0x534b6c[_0x81b6('0x31')][_0x81b6('0x35')]));_0x1ea08b[_0x81b6('0x34')]=_0x1ea08b[_0x81b6('0x34')][_0x81b6('0x48')]?_0x1ea08b['attributes']:_0x35308c['model'];_0x1ea08b[_0x81b6('0x37')]=qs[_0x81b6('0x38')](_0x534b6c[_0x81b6('0x31')]['sort']);_0x1ea08b[_0x81b6('0x3a')]=qs[_0x81b6('0x32')](_[_0x81b6('0x50')](_0x534b6c[_0x81b6('0x31')],_0x35308c[_0x81b6('0x32')]));if(_0x534b6c['query'][_0x81b6('0x39')]){_0x1ea08b[_0x81b6('0x3a')]=_[_0x81b6('0x3b')](_0x1ea08b[_0x81b6('0x3a')],{'$or':_[_0x81b6('0x2b')](_0x1ea08b[_0x81b6('0x34')],function(_0xd87daf){var _0x298c3f={};_0x298c3f[_0xd87daf]={'$like':'%'+_0x534b6c[_0x81b6('0x31')][_0x81b6('0x39')]+'%'};return _0x298c3f;})});}_0x1ea08b=_[_0x81b6('0x3b')]({},_0x1ea08b,_0x534b6c[_0x81b6('0x3e')]);return _0x4cd730[_0x81b6('0x4d')](_0x1ea08b);}})[_0x81b6('0x26')](function(_0x110630){if(_0x110630){_0x31b03d=_0x110630[_0x81b6('0x48')];if(!_0x534b6c[_0x81b6('0x31')][_0x81b6('0x36')](_0x81b6('0x51'))){_0x1ea08b[_0x81b6('0x1f')]=qs[_0x81b6('0x1f')](_0x534b6c['query']['limit']);_0x1ea08b[_0x81b6('0x20')]=qs[_0x81b6('0x20')](_0x534b6c[_0x81b6('0x31')][_0x81b6('0x20')]);}return _0x4cd730[_0x81b6('0x4d')](_0x1ea08b);}})[_0x81b6('0x26')](function(_0x338181){if(_0x338181){return _0x338181?{'count':_0x31b03d,'rows':_0x338181}:null;}})['then'](respondWithResult(_0x53bc15,null))[_0x81b6('0x45')](handleError(_0x53bc15,null));};exports[_0x81b6('0x52')]=function(_0x3b52e9,_0x20eaef,_0xa6e5d0){var _0x26b967={};var _0x491bbc={};var _0x48813e;var _0x37ccb7;return db[_0x81b6('0x3f')]['findOne']({'where':{'id':_0x3b52e9[_0x81b6('0x46')]['id']}})['then'](handleEntityNotFound(_0x20eaef,null))['then'](function(_0x162033){if(_0x162033){_0x48813e=_0x162033;_0x491bbc[_0x81b6('0x30')]=_[_0x81b6('0x47')](db[_0x81b6('0x4f')][_0x81b6('0x2c')]);_0x491bbc[_0x81b6('0x31')]=_[_0x81b6('0x47')](_0x3b52e9[_0x81b6('0x31')]);_0x491bbc[_0x81b6('0x32')]=_['intersection'](_0x491bbc[_0x81b6('0x30')],_0x491bbc[_0x81b6('0x31')]);_0x26b967[_0x81b6('0x34')]=_['intersection'](_0x491bbc['model'],qs[_0x81b6('0x35')](_0x3b52e9[_0x81b6('0x31')][_0x81b6('0x35')]));_0x26b967[_0x81b6('0x34')]=_0x26b967[_0x81b6('0x34')]['length']?_0x26b967[_0x81b6('0x34')]:_0x491bbc[_0x81b6('0x30')];_0x26b967[_0x81b6('0x37')]=qs['sort'](_0x3b52e9[_0x81b6('0x31')][_0x81b6('0x38')]);_0x26b967['where']=qs[_0x81b6('0x32')](_[_0x81b6('0x50')](_0x3b52e9['query'],_0x491bbc[_0x81b6('0x32')]));if(_0x3b52e9[_0x81b6('0x31')][_0x81b6('0x39')]){_0x26b967[_0x81b6('0x3a')]=_[_0x81b6('0x3b')](_0x26b967[_0x81b6('0x3a')],{'$or':_['map'](_0x26b967[_0x81b6('0x34')],function(_0x56bc39){var _0x411c39={};_0x411c39[_0x56bc39]={'$like':'%'+_0x3b52e9[_0x81b6('0x31')][_0x81b6('0x39')]+'%'};return _0x411c39;})});}_0x26b967=_['merge']({},_0x26b967,_0x3b52e9['options']);return _0x48813e[_0x81b6('0x52')](_0x26b967);}})[_0x81b6('0x26')](function(_0x552104){if(_0x552104){_0x37ccb7=_0x552104[_0x81b6('0x48')];if(!_0x3b52e9[_0x81b6('0x31')]['hasOwnProperty'](_0x81b6('0x51'))){_0x26b967[_0x81b6('0x1f')]=qs[_0x81b6('0x1f')](_0x3b52e9[_0x81b6('0x31')][_0x81b6('0x1f')]);_0x26b967[_0x81b6('0x20')]=qs[_0x81b6('0x20')](_0x3b52e9[_0x81b6('0x31')][_0x81b6('0x20')]);}return _0x48813e['getSubjects'](_0x26b967);}})[_0x81b6('0x26')](function(_0x135f76){if(_0x135f76){return _0x135f76?{'count':_0x37ccb7,'rows':_0x135f76}:null;}})['then'](respondWithResult(_0x20eaef,null))[_0x81b6('0x45')](handleError(_0x20eaef,null));};exports[_0x81b6('0x53')]=function(_0x321b64,_0x2d8a2c,_0x353fe5){var _0x4bf2ff={};var _0x2f54e6={};var _0x465922;var _0x8f32af;return db[_0x81b6('0x3f')][_0x81b6('0x4e')]({'where':{'id':_0x321b64[_0x81b6('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d8a2c,null))['then'](function(_0x11cacd){if(_0x11cacd){_0x465922=_0x11cacd;_0x2f54e6[_0x81b6('0x30')]=_[_0x81b6('0x47')](db[_0x81b6('0x4f')]['rawAttributes']);_0x2f54e6[_0x81b6('0x31')]=_[_0x81b6('0x47')](_0x321b64['query']);_0x2f54e6[_0x81b6('0x32')]=_[_0x81b6('0x33')](_0x2f54e6[_0x81b6('0x30')],_0x2f54e6[_0x81b6('0x31')]);_0x4bf2ff[_0x81b6('0x34')]=_[_0x81b6('0x33')](_0x2f54e6[_0x81b6('0x30')],qs[_0x81b6('0x35')](_0x321b64['query'][_0x81b6('0x35')]));_0x4bf2ff[_0x81b6('0x34')]=_0x4bf2ff[_0x81b6('0x34')][_0x81b6('0x48')]?_0x4bf2ff[_0x81b6('0x34')]:_0x2f54e6['model'];_0x4bf2ff[_0x81b6('0x37')]=qs[_0x81b6('0x38')](_0x321b64[_0x81b6('0x31')][_0x81b6('0x38')]);_0x4bf2ff[_0x81b6('0x3a')]=qs[_0x81b6('0x32')](_['pick'](_0x321b64[_0x81b6('0x31')],_0x2f54e6[_0x81b6('0x32')]));if(_0x321b64['query'][_0x81b6('0x39')]){_0x4bf2ff['where']=_[_0x81b6('0x3b')](_0x4bf2ff['where'],{'$or':_['map'](_0x4bf2ff[_0x81b6('0x34')],function(_0x17cb95){var _0xc59e43={};_0xc59e43[_0x17cb95]={'$like':'%'+_0x321b64[_0x81b6('0x31')][_0x81b6('0x39')]+'%'};return _0xc59e43;})});}_0x4bf2ff=_[_0x81b6('0x3b')]({},_0x4bf2ff,_0x321b64[_0x81b6('0x3e')]);return _0x465922['getDescriptions'](_0x4bf2ff);}})[_0x81b6('0x26')](function(_0x38566d){if(_0x38566d){_0x8f32af=_0x38566d[_0x81b6('0x48')];if(!_0x321b64[_0x81b6('0x31')][_0x81b6('0x36')](_0x81b6('0x51'))){_0x4bf2ff['limit']=qs['limit'](_0x321b64[_0x81b6('0x31')][_0x81b6('0x1f')]);_0x4bf2ff['offset']=qs[_0x81b6('0x20')](_0x321b64[_0x81b6('0x31')]['offset']);}return _0x465922['getDescriptions'](_0x4bf2ff);}})[_0x81b6('0x26')](function(_0x3d6914){if(_0x3d6914){return _0x3d6914?{'count':_0x8f32af,'rows':_0x3d6914}:null;}})[_0x81b6('0x26')](respondWithResult(_0x2d8a2c,null))['catch'](handleError(_0x2d8a2c,null));}; \ No newline at end of file +var _0x2603=['undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','find','catch','body','getFields','findOne','SugarcrmField','order','getSubjects','getDescriptions','rimraf','zip-dir','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x23c03c,_0x249733){var _0x1a8c79=function(_0x5cb43c){while(--_0x5cb43c){_0x23c03c['push'](_0x23c03c['shift']());}};_0x1a8c79(++_0x249733);}(_0x2603,0x82));var _0x3260=function(_0x1ddd0,_0x15f9f4){_0x1ddd0=_0x1ddd0-0x0;var _0x4d86d0=_0x2603[_0x1ddd0];return _0x4d86d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3260('0x0'));var zipdir=require(_0x3260('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3260('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3260('0x3'));var sox=require(_0x3260('0x4'));var csv=require('to-csv');var ejs=require(_0x3260('0x5'));var fs=require('fs');var fs_extra=require(_0x3260('0x6'));var _=require(_0x3260('0x7'));var squel=require('squel');var crypto=require(_0x3260('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x3260('0x9'));var toCsv=require('to-csv');var querystring=require(_0x3260('0xa'));var Papa=require(_0x3260('0xb'));var Redis=require(_0x3260('0xc'));var authService=require(_0x3260('0xd'));var qs=require(_0x3260('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3260('0xf'));var logger=require(_0x3260('0x10'))('api');var utils=require(_0x3260('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x3260('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53520d,_0x404ac4){_0x404ac4=_0x404ac4||0xcc;return function(_0x2592e0){if(_0x2592e0){return _0x53520d[_0x3260('0x13')](_0x404ac4);}return _0x53520d[_0x3260('0x14')](_0x404ac4)[_0x3260('0x15')]();};}function respondWithResult(_0x26ab2b,_0x2b6e14){_0x2b6e14=_0x2b6e14||0xc8;return function(_0xf4d388){if(_0xf4d388){return _0x26ab2b[_0x3260('0x14')](_0x2b6e14)[_0x3260('0x16')](_0xf4d388);}};}function respondWithFilteredResult(_0x3b0a0f,_0x3ce455){return function(_0x1d163d){if(_0x1d163d){var _0x21830b=typeof _0x3ce455[_0x3260('0x17')]===_0x3260('0x18')&&typeof _0x3ce455[_0x3260('0x19')]==='undefined';var _0x319f26=_0x1d163d[_0x3260('0x1a')];var _0x54f56c=_0x21830b?0x0:_0x3ce455[_0x3260('0x17')];var _0x4700dc=_0x21830b?_0x1d163d[_0x3260('0x1a')]:_0x3ce455[_0x3260('0x17')]+_0x3ce455['limit'];var _0x8e22be;if(_0x4700dc>=_0x319f26){_0x4700dc=_0x319f26;_0x8e22be=0xc8;}else{_0x8e22be=0xce;}_0x3b0a0f[_0x3260('0x14')](_0x8e22be);return _0x3b0a0f[_0x3260('0x1b')](_0x3260('0x1c'),_0x54f56c+'-'+_0x4700dc+'/'+_0x319f26)['json'](_0x1d163d);}return null;};}function patchUpdates(_0x4e4ef3){return function(_0x2b23bf){try{jsonpatch[_0x3260('0x1d')](_0x2b23bf,_0x4e4ef3,!![]);}catch(_0x409ce1){return BPromise['reject'](_0x409ce1);}return _0x2b23bf[_0x3260('0x1e')]();};}function saveUpdates(_0x194153,_0x2ca8f9){return function(_0x224644){if(_0x224644){return _0x224644[_0x3260('0x1f')](_0x194153)[_0x3260('0x20')](function(_0x29914c){return _0x29914c;});}return null;};}function removeEntity(_0x3ae31b,_0xb32a74){return function(_0x4ea158){if(_0x4ea158){return _0x4ea158[_0x3260('0x21')]()[_0x3260('0x20')](function(){_0x3ae31b[_0x3260('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27c4ea,_0xbd9b07){return function(_0x106984){if(!_0x106984){_0x27c4ea[_0x3260('0x13')](0x194);}return _0x106984;};}function handleError(_0x47ecf2,_0x589ba5){_0x589ba5=_0x589ba5||0x1f4;return function(_0x39cb31){logger[_0x3260('0x22')](_0x39cb31[_0x3260('0x23')]);if(_0x39cb31[_0x3260('0x24')]){delete _0x39cb31[_0x3260('0x24')];}_0x47ecf2[_0x3260('0x14')](_0x589ba5)[_0x3260('0x25')](_0x39cb31);};}exports[_0x3260('0x26')]=function(_0x5a8831,_0x36d87f){var _0x2b382b={},_0x4e36fc={},_0x55817f={'count':0x0,'rows':[]};var _0x47b1ed=_[_0x3260('0x27')](db[_0x3260('0x28')][_0x3260('0x29')],function(_0x2325a9){return{'name':_0x2325a9[_0x3260('0x2a')],'type':_0x2325a9[_0x3260('0x2b')][_0x3260('0x2c')]};});_0x4e36fc[_0x3260('0x2d')]=_[_0x3260('0x27')](_0x47b1ed,_0x3260('0x24'));_0x4e36fc['query']=_[_0x3260('0x2e')](_0x5a8831[_0x3260('0x2f')]);_0x4e36fc[_0x3260('0x30')]=_[_0x3260('0x31')](_0x4e36fc[_0x3260('0x2d')],_0x4e36fc[_0x3260('0x2f')]);_0x2b382b[_0x3260('0x32')]=_[_0x3260('0x31')](_0x4e36fc[_0x3260('0x2d')],qs[_0x3260('0x33')](_0x5a8831['query'][_0x3260('0x33')]));_0x2b382b['attributes']=_0x2b382b[_0x3260('0x32')][_0x3260('0x34')]?_0x2b382b[_0x3260('0x32')]:_0x4e36fc[_0x3260('0x2d')];if(!_0x5a8831[_0x3260('0x2f')][_0x3260('0x35')](_0x3260('0x36'))){_0x2b382b['limit']=qs[_0x3260('0x19')](_0x5a8831[_0x3260('0x2f')][_0x3260('0x19')]);_0x2b382b[_0x3260('0x17')]=qs['offset'](_0x5a8831[_0x3260('0x2f')][_0x3260('0x17')]);}_0x2b382b['order']=qs['sort'](_0x5a8831[_0x3260('0x2f')][_0x3260('0x37')]);_0x2b382b[_0x3260('0x38')]=qs[_0x3260('0x30')](_[_0x3260('0x39')](_0x5a8831[_0x3260('0x2f')],_0x4e36fc[_0x3260('0x30')]),_0x47b1ed);if(_0x5a8831[_0x3260('0x2f')][_0x3260('0x3a')]){_0x2b382b['where']=_['merge'](_0x2b382b[_0x3260('0x38')],{'$or':_[_0x3260('0x27')](_0x47b1ed,function(_0x13d5b3){if(_0x13d5b3[_0x3260('0x2b')]!==_0x3260('0x3b')){var _0x5b86d7={};_0x5b86d7[_0x13d5b3['name']]={'$like':'%'+_0x5a8831[_0x3260('0x2f')][_0x3260('0x3a')]+'%'};return _0x5b86d7;}})});}_0x2b382b=_[_0x3260('0x3c')]({},_0x2b382b,_0x5a8831[_0x3260('0x3d')]);var _0x3096b4={'where':_0x2b382b[_0x3260('0x38')]};return db[_0x3260('0x28')][_0x3260('0x1a')](_0x3096b4)[_0x3260('0x20')](function(_0x5952b1){_0x55817f[_0x3260('0x1a')]=_0x5952b1;if(_0x5a8831[_0x3260('0x2f')]['includeAll']){_0x2b382b[_0x3260('0x3e')]=[{'all':!![]}];}return db[_0x3260('0x28')][_0x3260('0x3f')](_0x2b382b);})[_0x3260('0x20')](function(_0x4f58c6){_0x55817f[_0x3260('0x40')]=_0x4f58c6;return _0x55817f;})[_0x3260('0x20')](respondWithFilteredResult(_0x36d87f,_0x2b382b))['catch'](handleError(_0x36d87f,null));};exports[_0x3260('0x41')]=function(_0x426a76,_0x5d5802){var _0x40545f={'raw':![],'where':{'id':_0x426a76[_0x3260('0x42')]['id']}},_0x5b20a8={};_0x5b20a8[_0x3260('0x2d')]=_[_0x3260('0x2e')](db['SugarcrmConfiguration'][_0x3260('0x29')]);_0x5b20a8[_0x3260('0x2f')]=_['keys'](_0x426a76[_0x3260('0x2f')]);_0x5b20a8[_0x3260('0x30')]=_['intersection'](_0x5b20a8[_0x3260('0x2d')],_0x5b20a8[_0x3260('0x2f')]);_0x40545f[_0x3260('0x32')]=_[_0x3260('0x31')](_0x5b20a8[_0x3260('0x2d')],qs[_0x3260('0x33')](_0x426a76['query'][_0x3260('0x33')]));_0x40545f[_0x3260('0x32')]=_0x40545f[_0x3260('0x32')][_0x3260('0x34')]?_0x40545f['attributes']:_0x5b20a8[_0x3260('0x2d')];if(_0x426a76['query'][_0x3260('0x43')]){_0x40545f[_0x3260('0x3e')]=[{'all':!![]}];}_0x40545f=_[_0x3260('0x3c')]({},_0x40545f,_0x426a76[_0x3260('0x3d')]);return db[_0x3260('0x28')][_0x3260('0x44')](_0x40545f)[_0x3260('0x20')](handleEntityNotFound(_0x5d5802,null))[_0x3260('0x20')](respondWithResult(_0x5d5802,null))[_0x3260('0x45')](handleError(_0x5d5802,null));};exports['create']=function(_0x3db614,_0x27dc51){return db['SugarcrmConfiguration']['create'](_0x3db614[_0x3260('0x46')],{})[_0x3260('0x20')](respondWithResult(_0x27dc51,0xc9))[_0x3260('0x45')](handleError(_0x27dc51,null));};exports['update']=function(_0x1fa532,_0x30c168){if(_0x1fa532[_0x3260('0x46')]['id']){delete _0x1fa532[_0x3260('0x46')]['id'];}return db[_0x3260('0x28')][_0x3260('0x44')]({'where':{'id':_0x1fa532[_0x3260('0x42')]['id']}})[_0x3260('0x20')](handleEntityNotFound(_0x30c168,null))[_0x3260('0x20')](saveUpdates(_0x1fa532[_0x3260('0x46')],null))['then'](respondWithResult(_0x30c168,null))[_0x3260('0x45')](handleError(_0x30c168,null));};exports[_0x3260('0x21')]=function(_0x46ec84,_0xdf3761){return db[_0x3260('0x28')]['find']({'where':{'id':_0x46ec84[_0x3260('0x42')]['id']}})['then'](handleEntityNotFound(_0xdf3761,null))[_0x3260('0x20')](removeEntity(_0xdf3761,null))[_0x3260('0x45')](handleError(_0xdf3761,null));};exports[_0x3260('0x47')]=function(_0x3c6eaf,_0x10af52,_0x874752){var _0x443bfa={};var _0x1dacc2={};var _0x2b4804;var _0x10e69a;return db[_0x3260('0x28')][_0x3260('0x48')]({'where':{'id':_0x3c6eaf[_0x3260('0x42')]['id']}})['then'](handleEntityNotFound(_0x10af52,null))[_0x3260('0x20')](function(_0x22fbfe){if(_0x22fbfe){_0x2b4804=_0x22fbfe;_0x1dacc2['model']=_[_0x3260('0x2e')](db[_0x3260('0x49')][_0x3260('0x29')]);_0x1dacc2[_0x3260('0x2f')]=_[_0x3260('0x2e')](_0x3c6eaf[_0x3260('0x2f')]);_0x1dacc2[_0x3260('0x30')]=_[_0x3260('0x31')](_0x1dacc2[_0x3260('0x2d')],_0x1dacc2[_0x3260('0x2f')]);_0x443bfa[_0x3260('0x32')]=_[_0x3260('0x31')](_0x1dacc2['model'],qs['fields'](_0x3c6eaf[_0x3260('0x2f')][_0x3260('0x33')]));_0x443bfa[_0x3260('0x32')]=_0x443bfa[_0x3260('0x32')][_0x3260('0x34')]?_0x443bfa[_0x3260('0x32')]:_0x1dacc2['model'];_0x443bfa[_0x3260('0x4a')]=qs[_0x3260('0x37')](_0x3c6eaf[_0x3260('0x2f')]['sort']);_0x443bfa[_0x3260('0x38')]=qs[_0x3260('0x30')](_['pick'](_0x3c6eaf[_0x3260('0x2f')],_0x1dacc2['filters']));if(_0x3c6eaf['query'][_0x3260('0x3a')]){_0x443bfa[_0x3260('0x38')]=_[_0x3260('0x3c')](_0x443bfa[_0x3260('0x38')],{'$or':_[_0x3260('0x27')](_0x443bfa[_0x3260('0x32')],function(_0xa3d38e){var _0x3d1ae9={};_0x3d1ae9[_0xa3d38e]={'$like':'%'+_0x3c6eaf[_0x3260('0x2f')]['filter']+'%'};return _0x3d1ae9;})});}_0x443bfa=_[_0x3260('0x3c')]({},_0x443bfa,_0x3c6eaf[_0x3260('0x3d')]);return _0x2b4804[_0x3260('0x47')](_0x443bfa);}})['then'](function(_0x1400d1){if(_0x1400d1){_0x10e69a=_0x1400d1[_0x3260('0x34')];if(!_0x3c6eaf[_0x3260('0x2f')][_0x3260('0x35')](_0x3260('0x36'))){_0x443bfa[_0x3260('0x19')]=qs[_0x3260('0x19')](_0x3c6eaf['query'][_0x3260('0x19')]);_0x443bfa['offset']=qs[_0x3260('0x17')](_0x3c6eaf[_0x3260('0x2f')][_0x3260('0x17')]);}return _0x2b4804[_0x3260('0x47')](_0x443bfa);}})[_0x3260('0x20')](function(_0x5145db){if(_0x5145db){return _0x5145db?{'count':_0x10e69a,'rows':_0x5145db}:null;}})['then'](respondWithResult(_0x10af52,null))[_0x3260('0x45')](handleError(_0x10af52,null));};exports['getSubjects']=function(_0x51776f,_0x5e0ac6,_0x54f7b0){var _0xcb45e9={};var _0x4851c2={};var _0x2994fb;var _0x2bc330;return db[_0x3260('0x28')]['findOne']({'where':{'id':_0x51776f['params']['id']}})['then'](handleEntityNotFound(_0x5e0ac6,null))[_0x3260('0x20')](function(_0xc81b04){if(_0xc81b04){_0x2994fb=_0xc81b04;_0x4851c2[_0x3260('0x2d')]=_[_0x3260('0x2e')](db[_0x3260('0x49')][_0x3260('0x29')]);_0x4851c2[_0x3260('0x2f')]=_[_0x3260('0x2e')](_0x51776f[_0x3260('0x2f')]);_0x4851c2['filters']=_[_0x3260('0x31')](_0x4851c2[_0x3260('0x2d')],_0x4851c2[_0x3260('0x2f')]);_0xcb45e9[_0x3260('0x32')]=_[_0x3260('0x31')](_0x4851c2['model'],qs[_0x3260('0x33')](_0x51776f[_0x3260('0x2f')][_0x3260('0x33')]));_0xcb45e9[_0x3260('0x32')]=_0xcb45e9[_0x3260('0x32')][_0x3260('0x34')]?_0xcb45e9[_0x3260('0x32')]:_0x4851c2['model'];_0xcb45e9[_0x3260('0x4a')]=qs['sort'](_0x51776f[_0x3260('0x2f')][_0x3260('0x37')]);_0xcb45e9[_0x3260('0x38')]=qs[_0x3260('0x30')](_[_0x3260('0x39')](_0x51776f[_0x3260('0x2f')],_0x4851c2[_0x3260('0x30')]));if(_0x51776f['query'][_0x3260('0x3a')]){_0xcb45e9[_0x3260('0x38')]=_[_0x3260('0x3c')](_0xcb45e9[_0x3260('0x38')],{'$or':_[_0x3260('0x27')](_0xcb45e9['attributes'],function(_0x37f081){var _0x348f41={};_0x348f41[_0x37f081]={'$like':'%'+_0x51776f[_0x3260('0x2f')][_0x3260('0x3a')]+'%'};return _0x348f41;})});}_0xcb45e9=_['merge']({},_0xcb45e9,_0x51776f[_0x3260('0x3d')]);return _0x2994fb[_0x3260('0x4b')](_0xcb45e9);}})['then'](function(_0x24b796){if(_0x24b796){_0x2bc330=_0x24b796[_0x3260('0x34')];if(!_0x51776f['query'][_0x3260('0x35')]('nolimit')){_0xcb45e9[_0x3260('0x19')]=qs['limit'](_0x51776f[_0x3260('0x2f')]['limit']);_0xcb45e9[_0x3260('0x17')]=qs['offset'](_0x51776f['query'][_0x3260('0x17')]);}return _0x2994fb[_0x3260('0x4b')](_0xcb45e9);}})[_0x3260('0x20')](function(_0xf8e723){if(_0xf8e723){return _0xf8e723?{'count':_0x2bc330,'rows':_0xf8e723}:null;}})[_0x3260('0x20')](respondWithResult(_0x5e0ac6,null))[_0x3260('0x45')](handleError(_0x5e0ac6,null));};exports[_0x3260('0x4c')]=function(_0x35eba6,_0x14c317,_0x2656ed){var _0xeb298e={};var _0x21fc44={};var _0x1ad586;var _0x43cb20;return db[_0x3260('0x28')]['findOne']({'where':{'id':_0x35eba6['params']['id']}})[_0x3260('0x20')](handleEntityNotFound(_0x14c317,null))[_0x3260('0x20')](function(_0x65da0e){if(_0x65da0e){_0x1ad586=_0x65da0e;_0x21fc44[_0x3260('0x2d')]=_[_0x3260('0x2e')](db[_0x3260('0x49')]['rawAttributes']);_0x21fc44['query']=_[_0x3260('0x2e')](_0x35eba6['query']);_0x21fc44['filters']=_[_0x3260('0x31')](_0x21fc44[_0x3260('0x2d')],_0x21fc44['query']);_0xeb298e[_0x3260('0x32')]=_[_0x3260('0x31')](_0x21fc44['model'],qs[_0x3260('0x33')](_0x35eba6[_0x3260('0x2f')][_0x3260('0x33')]));_0xeb298e[_0x3260('0x32')]=_0xeb298e['attributes'][_0x3260('0x34')]?_0xeb298e[_0x3260('0x32')]:_0x21fc44['model'];_0xeb298e[_0x3260('0x4a')]=qs[_0x3260('0x37')](_0x35eba6[_0x3260('0x2f')]['sort']);_0xeb298e['where']=qs[_0x3260('0x30')](_[_0x3260('0x39')](_0x35eba6[_0x3260('0x2f')],_0x21fc44[_0x3260('0x30')]));if(_0x35eba6['query'][_0x3260('0x3a')]){_0xeb298e[_0x3260('0x38')]=_[_0x3260('0x3c')](_0xeb298e[_0x3260('0x38')],{'$or':_[_0x3260('0x27')](_0xeb298e[_0x3260('0x32')],function(_0xdec799){var _0x15c8a8={};_0x15c8a8[_0xdec799]={'$like':'%'+_0x35eba6[_0x3260('0x2f')][_0x3260('0x3a')]+'%'};return _0x15c8a8;})});}_0xeb298e=_[_0x3260('0x3c')]({},_0xeb298e,_0x35eba6['options']);return _0x1ad586['getDescriptions'](_0xeb298e);}})[_0x3260('0x20')](function(_0x2ed8fd){if(_0x2ed8fd){_0x43cb20=_0x2ed8fd[_0x3260('0x34')];if(!_0x35eba6['query'][_0x3260('0x35')]('nolimit')){_0xeb298e[_0x3260('0x19')]=qs[_0x3260('0x19')](_0x35eba6[_0x3260('0x2f')][_0x3260('0x19')]);_0xeb298e[_0x3260('0x17')]=qs[_0x3260('0x17')](_0x35eba6['query'][_0x3260('0x17')]);}return _0x1ad586[_0x3260('0x4c')](_0xeb298e);}})['then'](function(_0x2f3d59){if(_0x2f3d59){return _0x2f3d59?{'count':_0x43cb20,'rows':_0x2f3d59}:null;}})[_0x3260('0x20')](respondWithResult(_0x14c317,null))['catch'](handleError(_0x14c317,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 01d6765..e812f5c 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 _0x830a=['util','../../config/logger','api','request-promise','path','../../config/environment','int_sugarcrm_configurations','lodash'];(function(_0x2bb81a,_0x4b5a7e){var _0x11233c=function(_0x3b9d88){while(--_0x3b9d88){_0x2bb81a['push'](_0x2bb81a['shift']());}};_0x11233c(++_0x4b5a7e);}(_0x830a,0x1df));var _0xa830=function(_0x4986e6,_0x5af8f8){_0x4986e6=_0x4986e6-0x0;var _0x159f5e=_0x830a[_0x4986e6];return _0x159f5e;};'use strict';var _=require(_0xa830('0x0'));var util=require(_0xa830('0x1'));var logger=require(_0xa830('0x2'))(_0xa830('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa830('0x4'));var fs=require('fs');var path=require(_0xa830('0x5'));var rimraf=require('rimraf');var config=require(_0xa830('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x3fba87,_0x3fcf3a){return _0x3fba87['define']('SugarcrmConfiguration',attributes,{'tableName':_0xa830('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba7f=['define','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes'];(function(_0x119a2a,_0x52a94f){var _0x22d268=function(_0x40714c){while(--_0x40714c){_0x119a2a['push'](_0x119a2a['shift']());}};_0x22d268(++_0x52a94f);}(_0xba7f,0x6e));var _0xfba7=function(_0x82b028,_0x5bece1){_0x82b028=_0x82b028-0x0;var _0x594a8b=_0xba7f[_0x82b028];return _0x594a8b;};'use strict';var _=require(_0xfba7('0x0'));var util=require(_0xfba7('0x1'));var logger=require(_0xfba7('0x2'))(_0xfba7('0x3'));var moment=require(_0xfba7('0x4'));var BPromise=require(_0xfba7('0x5'));var rp=require(_0xfba7('0x6'));var fs=require('fs');var path=require(_0xfba7('0x7'));var rimraf=require(_0xfba7('0x8'));var config=require('../../config/environment');var attributes=require(_0xfba7('0x9'));module['exports']=function(_0x3fb967,_0x2999a5){return _0x3fb967[_0xfba7('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0xfba7('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 dbf3793..a557cb8 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 _0xacd4=['../../config/logger','rpc','jayson/promise','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','lodash','moment','../../mysqldb'];(function(_0x1ec3fe,_0x5e9050){var _0x94093c=function(_0x49666b){while(--_0x49666b){_0x1ec3fe['push'](_0x1ec3fe['shift']());}};_0x94093c(++_0x5e9050);}(_0xacd4,0x18c));var _0x4acd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xacd4[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x4acd('0x0'));var util=require('util');var moment=require(_0x4acd('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4acd('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x4acd('0x3'))(_0x4acd('0x4'));var config=require('../../config/environment');var jayson=require(_0x4acd('0x5'));var client=jayson[_0x4acd('0x6')][_0x4acd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x7f0a3c,_0x48862c,_0x48339e){return new BPromise(function(_0x4fc536,_0x19b68a){return client[_0x4acd('0x8')](_0x7f0a3c,_0x48339e)['then'](function(_0x5c643e){logger['info'](_0x4acd('0x9'),_0x48862c,_0x4acd('0xa'));logger[_0x4acd('0xb')](_0x4acd('0xc'),_0x48862c,_0x4acd('0xa'),JSON[_0x4acd('0xd')](_0x5c643e));if(_0x5c643e['error']){if(_0x5c643e['error'][_0x4acd('0xe')]===0x1f4){logger[_0x4acd('0xf')](_0x4acd('0x9'),_0x48862c,_0x5c643e[_0x4acd('0xf')][_0x4acd('0x10')]);return _0x19b68a(_0x5c643e[_0x4acd('0xf')]['message']);}logger['error'](_0x4acd('0x9'),_0x48862c,_0x5c643e[_0x4acd('0xf')][_0x4acd('0x10')]);return _0x4fc536(_0x5c643e[_0x4acd('0xf')]['message']);}else{logger[_0x4acd('0x11')](_0x4acd('0x9'),_0x48862c,'request\x20sent');_0x4fc536(_0x5c643e[_0x4acd('0x12')][_0x4acd('0x10')]);}})['catch'](function(_0x1ea352){logger['error'](_0x4acd('0x9'),_0x48862c,_0x1ea352);_0x19b68a(_0x1ea352);});});} \ No newline at end of file +var _0x7280=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x334e39,_0x16f47f){var _0x158b6c=function(_0x20d713){while(--_0x20d713){_0x334e39['push'](_0x334e39['shift']());}};_0x158b6c(++_0x16f47f);}(_0x7280,0x1c0));var _0x0728=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x7280[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x0728('0x0'));var util=require(_0x0728('0x1'));var moment=require(_0x0728('0x2'));var BPromise=require(_0x0728('0x3'));var rs=require(_0x0728('0x4'));var fs=require('fs');var Redis=require(_0x0728('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0728('0x6'));var logger=require(_0x0728('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0728('0x8'));var client=jayson[_0x0728('0x9')][_0x0728('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x428569,_0x2f4c2f,_0x4851ab){return new BPromise(function(_0x56d01f,_0x249dac){return client[_0x0728('0xb')](_0x428569,_0x4851ab)[_0x0728('0xc')](function(_0x1da321){logger[_0x0728('0xd')](_0x0728('0xe'),_0x2f4c2f,_0x0728('0xf'));logger[_0x0728('0x10')](_0x0728('0x11'),_0x2f4c2f,_0x0728('0xf'),JSON['stringify'](_0x1da321));if(_0x1da321['error']){if(_0x1da321[_0x0728('0x12')]['code']===0x1f4){logger['error'](_0x0728('0xe'),_0x2f4c2f,_0x1da321[_0x0728('0x12')][_0x0728('0x13')]);return _0x249dac(_0x1da321[_0x0728('0x12')]['message']);}logger[_0x0728('0x12')](_0x0728('0xe'),_0x2f4c2f,_0x1da321[_0x0728('0x12')][_0x0728('0x13')]);return _0x56d01f(_0x1da321[_0x0728('0x12')][_0x0728('0x13')]);}else{logger[_0x0728('0xd')](_0x0728('0xe'),_0x2f4c2f,_0x0728('0xf'));_0x56d01f(_0x1da321[_0x0728('0x14')][_0x0728('0x13')]);}})['catch'](function(_0x2e6e0f){logger[_0x0728('0x12')](_0x0728('0xe'),_0x2f4c2f,_0x2e6e0f);_0x249dac(_0x2e6e0f);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 7795493..70bfb51 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 _0x689a=['fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x2d8a50,_0x14d6cc){var _0x2eaf10=function(_0x29003d){while(--_0x29003d){_0x2d8a50['push'](_0x2d8a50['shift']());}};_0x2eaf10(++_0x14d6cc);}(_0x689a,0x1e9));var _0xa689=function(_0xa76eac,_0x1f5972){_0xa76eac=_0xa76eac-0x0;var _0x29d4d9=_0x689a[_0xa76eac];return _0x29d4d9;};'use strict';var multer=require('multer');var util=require(_0xa689('0x0'));var path=require(_0xa689('0x1'));var timeout=require(_0xa689('0x2'));var express=require(_0xa689('0x3'));var router=express[_0xa689('0x4')]();var fs_extra=require(_0xa689('0x5'));var auth=require(_0xa689('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa689('0x7'));var controller=require(_0xa689('0x8'));router[_0xa689('0x9')]('/',auth[_0xa689('0xa')](),controller[_0xa689('0xb')]);router[_0xa689('0x9')](_0xa689('0xc'),auth['isAuthenticated'](),controller[_0xa689('0xd')]);router['post']('/',auth[_0xa689('0xa')](),controller[_0xa689('0xe')]);router[_0xa689('0xf')](_0xa689('0xc'),auth[_0xa689('0xa')](),controller[_0xa689('0x10')]);router[_0xa689('0x11')](_0xa689('0xc'),auth['isAuthenticated'](),controller[_0xa689('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe9a8=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','post','create','update','delete','multer'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe9a8,0xef));var _0x8e9a=function(_0x522104,_0x260bde){_0x522104=_0x522104-0x0;var _0x552027=_0xe9a8[_0x522104];return _0x552027;};'use strict';var multer=require(_0x8e9a('0x0'));var util=require(_0x8e9a('0x1'));var path=require('path');var timeout=require(_0x8e9a('0x2'));var express=require(_0x8e9a('0x3'));var router=express['Router']();var fs_extra=require(_0x8e9a('0x4'));var auth=require(_0x8e9a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8e9a('0x6'));var controller=require(_0x8e9a('0x7'));router[_0x8e9a('0x8')]('/',auth[_0x8e9a('0x9')](),controller[_0x8e9a('0xa')]);router[_0x8e9a('0x8')](_0x8e9a('0xb'),auth[_0x8e9a('0x9')](),controller['show']);router[_0x8e9a('0xc')]('/',auth[_0x8e9a('0x9')](),controller[_0x8e9a('0xd')]);router['put'](_0x8e9a('0xb'),auth[_0x8e9a('0x9')](),controller[_0x8e9a('0xe')]);router[_0x8e9a('0xf')](_0x8e9a('0xb'),auth[_0x8e9a('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 86db7e1..8531e98 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 _0xae22=['keyValue','picklist','ENUM','STRING','BOOLEAN','exports','string','variable','customVariable'];(function(_0x1de223,_0xc4c595){var _0x363973=function(_0x46534d){while(--_0x46534d){_0x1de223['push'](_0x1de223['shift']());}};_0x363973(++_0xc4c595);}(_0xae22,0x113));var _0x2ae2=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xae22[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require('sequelize');module[_0x2ae2('0x0')]={'type':{'type':Sequelize['ENUM'](_0x2ae2('0x1'),_0x2ae2('0x2'),_0x2ae2('0x3'),_0x2ae2('0x4'),_0x2ae2('0x5')),'defaultValue':_0x2ae2('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2ae2('0x6')](_0x2ae2('0x1'),_0x2ae2('0x2'),_0x2ae2('0x3'))},'keyContent':{'type':Sequelize[_0x2ae2('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2ae2('0x7')]},'customField':{'type':Sequelize[_0x2ae2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6e41=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','STRING'];(function(_0x1f3dab,_0x333eab){var _0x14b30f=function(_0x7d5e65){while(--_0x7d5e65){_0x1f3dab['push'](_0x1f3dab['shift']());}};_0x14b30f(++_0x333eab);}(_0x6e41,0x1f1));var _0x16e4=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x6e41[_0x486f4a];return _0x135d99;};'use strict';var Sequelize=require(_0x16e4('0x0'));module[_0x16e4('0x1')]={'type':{'type':Sequelize[_0x16e4('0x2')](_0x16e4('0x3'),_0x16e4('0x4'),'customVariable',_0x16e4('0x5'),'picklist'),'defaultValue':_0x16e4('0x3')},'content':{'type':Sequelize[_0x16e4('0x6')]},'key':{'type':Sequelize[_0x16e4('0x6')]},'keyType':{'type':Sequelize[_0x16e4('0x2')]('string',_0x16e4('0x4'),_0x16e4('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x16e4('0x6')]},'nameField':{'type':Sequelize[_0x16e4('0x6')]},'customField':{'type':Sequelize[_0x16e4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x16e4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 2609f5e..e69b228 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 _0x84fd=['util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','status','end','sendStatus','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','mustache'];(function(_0xfb6186,_0x51cb8c){var _0x5a3189=function(_0x12ba68){while(--_0x12ba68){_0xfb6186['push'](_0xfb6186['shift']());}};_0x5a3189(++_0x51cb8c);}(_0x84fd,0xdf));var _0xd84f=function(_0xd99068,_0x4a5a38){_0xd99068=_0xd99068-0x0;var _0x253e27=_0x84fd[_0xd99068];return _0x253e27;};'use strict';var emlformat=require(_0xd84f('0x0'));var rimraf=require(_0xd84f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd84f('0x2'));var rp=require(_0xd84f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd84f('0x4'));var util=require(_0xd84f('0x5'));var path=require('path');var sox=require(_0xd84f('0x6'));var csv=require(_0xd84f('0x7'));var ejs=require(_0xd84f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd84f('0x9'));var squel=require('squel');var crypto=require(_0xd84f('0xa'));var jsforce=require(_0xd84f('0xb'));var deskjs=require(_0xd84f('0xc'));var toCsv=require(_0xd84f('0x7'));var querystring=require(_0xd84f('0xd'));var Papa=require(_0xd84f('0xe'));var Redis=require(_0xd84f('0xf'));var authService=require(_0xd84f('0x10'));var qs=require(_0xd84f('0x11'));var as=require(_0xd84f('0x12'));var hardwareService=require(_0xd84f('0x13'));var logger=require(_0xd84f('0x14'))(_0xd84f('0x15'));var utils=require('../../config/utils');var config=require(_0xd84f('0x16'));var licenseUtil=require(_0xd84f('0x17'));var db=require(_0xd84f('0x18'))['db'];function respondWithStatusCode(_0x601ee,_0x56ae1c){_0x56ae1c=_0x56ae1c||0xcc;return function(_0xb3b288){if(_0xb3b288){return _0x601ee['sendStatus'](_0x56ae1c);}return _0x601ee['status'](_0x56ae1c)['end']();};}function respondWithResult(_0x1790f9,_0xaa8067){_0xaa8067=_0xaa8067||0xc8;return function(_0x22a662){if(_0x22a662){return _0x1790f9['status'](_0xaa8067)[_0xd84f('0x19')](_0x22a662);}};}function respondWithFilteredResult(_0x468653,_0x5dd4f7){return function(_0x38835c){if(_0x38835c){var _0x3b4891=typeof _0x5dd4f7[_0xd84f('0x1a')]===_0xd84f('0x1b')&&typeof _0x5dd4f7[_0xd84f('0x1c')]===_0xd84f('0x1b');var _0x106b5f=_0x38835c['count'];var _0xe65b60=_0x3b4891?0x0:_0x5dd4f7['offset'];var _0x19e565=_0x3b4891?_0x38835c[_0xd84f('0x1d')]:_0x5dd4f7[_0xd84f('0x1a')]+_0x5dd4f7[_0xd84f('0x1c')];var _0x244f0f;if(_0x19e565>=_0x106b5f){_0x19e565=_0x106b5f;_0x244f0f=0xc8;}else{_0x244f0f=0xce;}_0x468653['status'](_0x244f0f);return _0x468653[_0xd84f('0x1e')]('Content-Range',_0xe65b60+'-'+_0x19e565+'/'+_0x106b5f)[_0xd84f('0x19')](_0x38835c);}return null;};}function patchUpdates(_0x1b5a49){return function(_0x36e3c9){try{jsonpatch['apply'](_0x36e3c9,_0x1b5a49,!![]);}catch(_0xf41cc3){return BPromise[_0xd84f('0x1f')](_0xf41cc3);}return _0x36e3c9[_0xd84f('0x20')]();};}function saveUpdates(_0x25a95b,_0x4edf96){return function(_0x4df41c){if(_0x4df41c){return _0x4df41c[_0xd84f('0x21')](_0x25a95b)['then'](function(_0x8abac6){return _0x8abac6;});}return null;};}function removeEntity(_0x448125,_0x4087fe){return function(_0x15b690){if(_0x15b690){return _0x15b690[_0xd84f('0x22')]()[_0xd84f('0x23')](function(){_0x448125[_0xd84f('0x24')](0xcc)[_0xd84f('0x25')]();});}};}function handleEntityNotFound(_0x4ec114,_0x5eea3c){return function(_0x590e88){if(!_0x590e88){_0x4ec114[_0xd84f('0x26')](0x194);}return _0x590e88;};}function handleError(_0x1cced2,_0x23a708){_0x23a708=_0x23a708||0x1f4;return function(_0x4352b6){logger[_0xd84f('0x27')](_0x4352b6[_0xd84f('0x28')]);if(_0x4352b6['name']){delete _0x4352b6[_0xd84f('0x29')];}_0x1cced2[_0xd84f('0x24')](_0x23a708)[_0xd84f('0x2a')](_0x4352b6);};}exports[_0xd84f('0x2b')]=function(_0x566131,_0x1850f5){var _0x2f150a={},_0x526b3f={},_0x478fff={'count':0x0,'rows':[]};var _0x44a423=_[_0xd84f('0x2c')](db[_0xd84f('0x2d')][_0xd84f('0x2e')],function(_0x41b277){return{'name':_0x41b277[_0xd84f('0x2f')],'type':_0x41b277[_0xd84f('0x30')][_0xd84f('0x31')]};});_0x526b3f[_0xd84f('0x32')]=_[_0xd84f('0x2c')](_0x44a423,'name');_0x526b3f['query']=_[_0xd84f('0x33')](_0x566131[_0xd84f('0x34')]);_0x526b3f[_0xd84f('0x35')]=_[_0xd84f('0x36')](_0x526b3f['model'],_0x526b3f[_0xd84f('0x34')]);_0x2f150a['attributes']=_['intersection'](_0x526b3f[_0xd84f('0x32')],qs[_0xd84f('0x37')](_0x566131['query'][_0xd84f('0x37')]));_0x2f150a[_0xd84f('0x38')]=_0x2f150a[_0xd84f('0x38')][_0xd84f('0x39')]?_0x2f150a[_0xd84f('0x38')]:_0x526b3f[_0xd84f('0x32')];if(!_0x566131[_0xd84f('0x34')][_0xd84f('0x3a')](_0xd84f('0x3b'))){_0x2f150a[_0xd84f('0x1c')]=qs[_0xd84f('0x1c')](_0x566131[_0xd84f('0x34')][_0xd84f('0x1c')]);_0x2f150a[_0xd84f('0x1a')]=qs[_0xd84f('0x1a')](_0x566131[_0xd84f('0x34')][_0xd84f('0x1a')]);}_0x2f150a[_0xd84f('0x3c')]=qs[_0xd84f('0x3d')](_0x566131['query']['sort']);_0x2f150a[_0xd84f('0x3e')]=qs[_0xd84f('0x35')](_[_0xd84f('0x3f')](_0x566131[_0xd84f('0x34')],_0x526b3f[_0xd84f('0x35')]),_0x44a423);if(_0x566131['query'][_0xd84f('0x40')]){_0x2f150a['where']=_[_0xd84f('0x41')](_0x2f150a[_0xd84f('0x3e')],{'$or':_['map'](_0x44a423,function(_0x55e0e2){if(_0x55e0e2[_0xd84f('0x30')]!=='VIRTUAL'){var _0x685265={};_0x685265[_0x55e0e2[_0xd84f('0x29')]]={'$like':'%'+_0x566131[_0xd84f('0x34')]['filter']+'%'};return _0x685265;}})});}_0x2f150a=_['merge']({},_0x2f150a,_0x566131[_0xd84f('0x42')]);var _0x43bfe7={'where':_0x2f150a[_0xd84f('0x3e')]};return db[_0xd84f('0x2d')][_0xd84f('0x1d')](_0x43bfe7)[_0xd84f('0x23')](function(_0x491e44){_0x478fff['count']=_0x491e44;if(_0x566131[_0xd84f('0x34')][_0xd84f('0x43')]){_0x2f150a[_0xd84f('0x44')]=[{'all':!![]}];}return db[_0xd84f('0x2d')]['findAll'](_0x2f150a);})[_0xd84f('0x23')](function(_0x375587){_0x478fff[_0xd84f('0x45')]=_0x375587;return _0x478fff;})[_0xd84f('0x23')](respondWithFilteredResult(_0x1850f5,_0x2f150a))[_0xd84f('0x46')](handleError(_0x1850f5,null));};exports[_0xd84f('0x47')]=function(_0x570ab5,_0x30004c){var _0xc95d63={'raw':!![],'where':{'id':_0x570ab5[_0xd84f('0x48')]['id']}},_0x2ccb57={};_0x2ccb57['model']=_[_0xd84f('0x33')](db[_0xd84f('0x2d')][_0xd84f('0x2e')]);_0x2ccb57['query']=_[_0xd84f('0x33')](_0x570ab5[_0xd84f('0x34')]);_0x2ccb57[_0xd84f('0x35')]=_[_0xd84f('0x36')](_0x2ccb57[_0xd84f('0x32')],_0x2ccb57[_0xd84f('0x34')]);_0xc95d63[_0xd84f('0x38')]=_[_0xd84f('0x36')](_0x2ccb57['model'],qs['fields'](_0x570ab5[_0xd84f('0x34')][_0xd84f('0x37')]));_0xc95d63[_0xd84f('0x38')]=_0xc95d63[_0xd84f('0x38')]['length']?_0xc95d63[_0xd84f('0x38')]:_0x2ccb57[_0xd84f('0x32')];if(_0x570ab5[_0xd84f('0x34')][_0xd84f('0x43')]){_0xc95d63[_0xd84f('0x44')]=[{'all':!![]}];}_0xc95d63=_[_0xd84f('0x41')]({},_0xc95d63,_0x570ab5[_0xd84f('0x42')]);return db[_0xd84f('0x2d')]['find'](_0xc95d63)[_0xd84f('0x23')](handleEntityNotFound(_0x30004c,null))[_0xd84f('0x23')](respondWithResult(_0x30004c,null))[_0xd84f('0x46')](handleError(_0x30004c,null));};exports[_0xd84f('0x49')]=function(_0xace34b,_0x5b64af){return db[_0xd84f('0x2d')][_0xd84f('0x49')](_0xace34b[_0xd84f('0x4a')],{})[_0xd84f('0x23')](respondWithResult(_0x5b64af,0xc9))[_0xd84f('0x46')](handleError(_0x5b64af,null));};exports[_0xd84f('0x21')]=function(_0x1e0fa4,_0x32e2c2){if(_0x1e0fa4[_0xd84f('0x4a')]['id']){delete _0x1e0fa4[_0xd84f('0x4a')]['id'];}return db[_0xd84f('0x2d')][_0xd84f('0x4b')]({'where':{'id':_0x1e0fa4[_0xd84f('0x48')]['id']}})[_0xd84f('0x23')](handleEntityNotFound(_0x32e2c2,null))[_0xd84f('0x23')](saveUpdates(_0x1e0fa4[_0xd84f('0x4a')],null))[_0xd84f('0x23')](respondWithResult(_0x32e2c2,null))[_0xd84f('0x46')](handleError(_0x32e2c2,null));};exports[_0xd84f('0x22')]=function(_0x2752b8,_0x45a38c){return db[_0xd84f('0x2d')][_0xd84f('0x4b')]({'where':{'id':_0x2752b8['params']['id']}})[_0xd84f('0x23')](handleEntityNotFound(_0x45a38c,null))[_0xd84f('0x23')](removeEntity(_0x45a38c,null))['catch'](handleError(_0x45a38c,null));}; \ No newline at end of file +var _0x4f0b=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','update','end','error','stack','name','send','index','map','SugarcrmField','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','then','includeAll','include','findAll','show','params','catch','create','body','destroy','find','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3ceb6c,_0x554602){var _0x256814=function(_0x7800cf){while(--_0x7800cf){_0x3ceb6c['push'](_0x3ceb6c['shift']());}};_0x256814(++_0x554602);}(_0x4f0b,0x96));var _0xb4f0=function(_0x249da4,_0x81b7b5){_0x249da4=_0x249da4-0x0;var _0x4f23b5=_0x4f0b[_0x249da4];return _0x4f23b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb4f0('0x0'));var zipdir=require(_0xb4f0('0x1'));var jsonpatch=require(_0xb4f0('0x2'));var rp=require(_0xb4f0('0x3'));var moment=require('moment');var BPromise=require(_0xb4f0('0x4'));var Mustache=require(_0xb4f0('0x5'));var util=require(_0xb4f0('0x6'));var path=require(_0xb4f0('0x7'));var sox=require(_0xb4f0('0x8'));var csv=require(_0xb4f0('0x9'));var ejs=require(_0xb4f0('0xa'));var fs=require('fs');var fs_extra=require(_0xb4f0('0xb'));var _=require(_0xb4f0('0xc'));var squel=require(_0xb4f0('0xd'));var crypto=require(_0xb4f0('0xe'));var jsforce=require(_0xb4f0('0xf'));var deskjs=require(_0xb4f0('0x10'));var toCsv=require(_0xb4f0('0x9'));var querystring=require(_0xb4f0('0x11'));var Papa=require(_0xb4f0('0x12'));var Redis=require(_0xb4f0('0x13'));var authService=require(_0xb4f0('0x14'));var qs=require(_0xb4f0('0x15'));var as=require(_0xb4f0('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb4f0('0x17'));var utils=require(_0xb4f0('0x18'));var config=require(_0xb4f0('0x19'));var licenseUtil=require(_0xb4f0('0x1a'));var db=require(_0xb4f0('0x1b'))['db'];function respondWithStatusCode(_0x1db6ac,_0x35b47e){_0x35b47e=_0x35b47e||0xcc;return function(_0x49f291){if(_0x49f291){return _0x1db6ac[_0xb4f0('0x1c')](_0x35b47e);}return _0x1db6ac[_0xb4f0('0x1d')](_0x35b47e)['end']();};}function respondWithResult(_0x98acc1,_0x4577df){_0x4577df=_0x4577df||0xc8;return function(_0x38b062){if(_0x38b062){return _0x98acc1[_0xb4f0('0x1d')](_0x4577df)[_0xb4f0('0x1e')](_0x38b062);}};}function respondWithFilteredResult(_0x7796df,_0x4e8515){return function(_0x9d3503){if(_0x9d3503){var _0x117880=typeof _0x4e8515['offset']===_0xb4f0('0x1f')&&typeof _0x4e8515['limit']===_0xb4f0('0x1f');var _0x25256b=_0x9d3503[_0xb4f0('0x20')];var _0x234665=_0x117880?0x0:_0x4e8515['offset'];var _0x44b51a=_0x117880?_0x9d3503[_0xb4f0('0x20')]:_0x4e8515[_0xb4f0('0x21')]+_0x4e8515[_0xb4f0('0x22')];var _0x1c8d6b;if(_0x44b51a>=_0x25256b){_0x44b51a=_0x25256b;_0x1c8d6b=0xc8;}else{_0x1c8d6b=0xce;}_0x7796df['status'](_0x1c8d6b);return _0x7796df[_0xb4f0('0x23')](_0xb4f0('0x24'),_0x234665+'-'+_0x44b51a+'/'+_0x25256b)[_0xb4f0('0x1e')](_0x9d3503);}return null;};}function patchUpdates(_0xc5bda3){return function(_0x21031d){try{jsonpatch[_0xb4f0('0x25')](_0x21031d,_0xc5bda3,!![]);}catch(_0x56a191){return BPromise['reject'](_0x56a191);}return _0x21031d['save']();};}function saveUpdates(_0xa4fa7e,_0x102ea2){return function(_0x4ef645){if(_0x4ef645){return _0x4ef645[_0xb4f0('0x26')](_0xa4fa7e)['then'](function(_0x169237){return _0x169237;});}return null;};}function removeEntity(_0x4612dd,_0x3fb518){return function(_0x3f26e0){if(_0x3f26e0){return _0x3f26e0['destroy']()['then'](function(){_0x4612dd[_0xb4f0('0x1d')](0xcc)[_0xb4f0('0x27')]();});}};}function handleEntityNotFound(_0x8b862e,_0x14b9b0){return function(_0x1b555c){if(!_0x1b555c){_0x8b862e[_0xb4f0('0x1c')](0x194);}return _0x1b555c;};}function handleError(_0x328a15,_0x165c29){_0x165c29=_0x165c29||0x1f4;return function(_0x36e28b){logger[_0xb4f0('0x28')](_0x36e28b[_0xb4f0('0x29')]);if(_0x36e28b[_0xb4f0('0x2a')]){delete _0x36e28b[_0xb4f0('0x2a')];}_0x328a15[_0xb4f0('0x1d')](_0x165c29)[_0xb4f0('0x2b')](_0x36e28b);};}exports[_0xb4f0('0x2c')]=function(_0x4452ef,_0xc2d60d){var _0x577d3c={},_0x3f37cf={},_0x4c89a1={'count':0x0,'rows':[]};var _0x372027=_[_0xb4f0('0x2d')](db[_0xb4f0('0x2e')][_0xb4f0('0x2f')],function(_0x373fad){return{'name':_0x373fad['fieldName'],'type':_0x373fad[_0xb4f0('0x30')][_0xb4f0('0x31')]};});_0x3f37cf[_0xb4f0('0x32')]=_[_0xb4f0('0x2d')](_0x372027,_0xb4f0('0x2a'));_0x3f37cf['query']=_[_0xb4f0('0x33')](_0x4452ef[_0xb4f0('0x34')]);_0x3f37cf[_0xb4f0('0x35')]=_[_0xb4f0('0x36')](_0x3f37cf[_0xb4f0('0x32')],_0x3f37cf[_0xb4f0('0x34')]);_0x577d3c[_0xb4f0('0x37')]=_[_0xb4f0('0x36')](_0x3f37cf[_0xb4f0('0x32')],qs[_0xb4f0('0x38')](_0x4452ef[_0xb4f0('0x34')]['fields']));_0x577d3c[_0xb4f0('0x37')]=_0x577d3c[_0xb4f0('0x37')]['length']?_0x577d3c[_0xb4f0('0x37')]:_0x3f37cf['model'];if(!_0x4452ef[_0xb4f0('0x34')][_0xb4f0('0x39')](_0xb4f0('0x3a'))){_0x577d3c['limit']=qs['limit'](_0x4452ef[_0xb4f0('0x34')]['limit']);_0x577d3c['offset']=qs[_0xb4f0('0x21')](_0x4452ef[_0xb4f0('0x34')][_0xb4f0('0x21')]);}_0x577d3c[_0xb4f0('0x3b')]=qs[_0xb4f0('0x3c')](_0x4452ef[_0xb4f0('0x34')][_0xb4f0('0x3c')]);_0x577d3c['where']=qs[_0xb4f0('0x35')](_[_0xb4f0('0x3d')](_0x4452ef['query'],_0x3f37cf[_0xb4f0('0x35')]),_0x372027);if(_0x4452ef['query']['filter']){_0x577d3c[_0xb4f0('0x3e')]=_[_0xb4f0('0x3f')](_0x577d3c[_0xb4f0('0x3e')],{'$or':_[_0xb4f0('0x2d')](_0x372027,function(_0x3a0e89){if(_0x3a0e89[_0xb4f0('0x30')]!==_0xb4f0('0x40')){var _0x5f5779={};_0x5f5779[_0x3a0e89[_0xb4f0('0x2a')]]={'$like':'%'+_0x4452ef[_0xb4f0('0x34')]['filter']+'%'};return _0x5f5779;}})});}_0x577d3c=_[_0xb4f0('0x3f')]({},_0x577d3c,_0x4452ef[_0xb4f0('0x41')]);var _0x2ea4a3={'where':_0x577d3c[_0xb4f0('0x3e')]};return db['SugarcrmField'][_0xb4f0('0x20')](_0x2ea4a3)[_0xb4f0('0x42')](function(_0x2f66b4){_0x4c89a1[_0xb4f0('0x20')]=_0x2f66b4;if(_0x4452ef['query'][_0xb4f0('0x43')]){_0x577d3c[_0xb4f0('0x44')]=[{'all':!![]}];}return db['SugarcrmField'][_0xb4f0('0x45')](_0x577d3c);})[_0xb4f0('0x42')](function(_0x3aec4b){_0x4c89a1['rows']=_0x3aec4b;return _0x4c89a1;})[_0xb4f0('0x42')](respondWithFilteredResult(_0xc2d60d,_0x577d3c))['catch'](handleError(_0xc2d60d,null));};exports[_0xb4f0('0x46')]=function(_0x49116c,_0x276685){var _0x308009={'raw':!![],'where':{'id':_0x49116c[_0xb4f0('0x47')]['id']}},_0x12ac99={};_0x12ac99[_0xb4f0('0x32')]=_['keys'](db[_0xb4f0('0x2e')][_0xb4f0('0x2f')]);_0x12ac99[_0xb4f0('0x34')]=_['keys'](_0x49116c[_0xb4f0('0x34')]);_0x12ac99[_0xb4f0('0x35')]=_[_0xb4f0('0x36')](_0x12ac99[_0xb4f0('0x32')],_0x12ac99[_0xb4f0('0x34')]);_0x308009[_0xb4f0('0x37')]=_[_0xb4f0('0x36')](_0x12ac99[_0xb4f0('0x32')],qs['fields'](_0x49116c[_0xb4f0('0x34')][_0xb4f0('0x38')]));_0x308009[_0xb4f0('0x37')]=_0x308009[_0xb4f0('0x37')]['length']?_0x308009['attributes']:_0x12ac99[_0xb4f0('0x32')];if(_0x49116c['query'][_0xb4f0('0x43')]){_0x308009[_0xb4f0('0x44')]=[{'all':!![]}];}_0x308009=_['merge']({},_0x308009,_0x49116c[_0xb4f0('0x41')]);return db['SugarcrmField']['find'](_0x308009)[_0xb4f0('0x42')](handleEntityNotFound(_0x276685,null))['then'](respondWithResult(_0x276685,null))[_0xb4f0('0x48')](handleError(_0x276685,null));};exports[_0xb4f0('0x49')]=function(_0x852a4c,_0x2497ae){return db['SugarcrmField'][_0xb4f0('0x49')](_0x852a4c['body'],{})[_0xb4f0('0x42')](respondWithResult(_0x2497ae,0xc9))[_0xb4f0('0x48')](handleError(_0x2497ae,null));};exports[_0xb4f0('0x26')]=function(_0xc338b6,_0x5c2b39){if(_0xc338b6[_0xb4f0('0x4a')]['id']){delete _0xc338b6[_0xb4f0('0x4a')]['id'];}return db[_0xb4f0('0x2e')]['find']({'where':{'id':_0xc338b6[_0xb4f0('0x47')]['id']}})[_0xb4f0('0x42')](handleEntityNotFound(_0x5c2b39,null))[_0xb4f0('0x42')](saveUpdates(_0xc338b6[_0xb4f0('0x4a')],null))[_0xb4f0('0x42')](respondWithResult(_0x5c2b39,null))['catch'](handleError(_0x5c2b39,null));};exports[_0xb4f0('0x4b')]=function(_0x4dac8d,_0x41b5e1){return db['SugarcrmField'][_0xb4f0('0x4c')]({'where':{'id':_0x4dac8d['params']['id']}})[_0xb4f0('0x42')](handleEntityNotFound(_0x41b5e1,null))[_0xb4f0('0x42')](removeEntity(_0x41b5e1,null))[_0xb4f0('0x48')](handleError(_0x41b5e1,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index e6b0b0e..d98de06 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 _0x63e4=['path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x21a686,_0x12bd48){var _0xdd7908=function(_0x19e09d){while(--_0x19e09d){_0x21a686['push'](_0x21a686['shift']());}};_0xdd7908(++_0x12bd48);}(_0x63e4,0x180));var _0x463e=function(_0x24e6ba,_0x949b9){_0x24e6ba=_0x24e6ba-0x0;var _0x5ee7ae=_0x63e4[_0x24e6ba];return _0x5ee7ae;};'use strict';var _=require(_0x463e('0x0'));var util=require(_0x463e('0x1'));var logger=require(_0x463e('0x2'))(_0x463e('0x3'));var moment=require('moment');var BPromise=require(_0x463e('0x4'));var rp=require(_0x463e('0x5'));var fs=require('fs');var path=require(_0x463e('0x6'));var rimraf=require(_0x463e('0x7'));var config=require(_0x463e('0x8'));var attributes=require(_0x463e('0x9'));module[_0x463e('0xa')]=function(_0x12f57e,_0x583abe){return _0x12f57e['define'](_0x463e('0xb'),attributes,{'tableName':_0x463e('0xc'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x463e('0xd'),_0x463e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0718=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x0718,0xd6));var _0x8071=function(_0x2a6571,_0xf1567c){_0x2a6571=_0x2a6571-0x0;var _0xdf7731=_0x0718[_0x2a6571];return _0xdf7731;};'use strict';var _=require(_0x8071('0x0'));var util=require(_0x8071('0x1'));var logger=require(_0x8071('0x2'))('api');var moment=require(_0x8071('0x3'));var BPromise=require(_0x8071('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8071('0x5'));var rimraf=require('rimraf');var config=require(_0x8071('0x6'));var attributes=require(_0x8071('0x7'));module[_0x8071('0x8')]=function(_0x1732d8,_0x11f982){return _0x1732d8[_0x8071('0x9')](_0x8071('0xa'),attributes,{'tableName':_0x8071('0xb'),'paranoid':![],'indexes':[{'name':_0x8071('0xc'),'fields':[_0x8071('0xd'),_0x8071('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 de9e8ba..9d52317 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 _0x39ab=['stringify','error','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x3ba583,_0x20db3b){var _0x349767=function(_0x489376){while(--_0x489376){_0x3ba583['push'](_0x3ba583['shift']());}};_0x349767(++_0x20db3b);}(_0x39ab,0x118));var _0xb39a=function(_0x5c4443,_0x4fe225){_0x5c4443=_0x5c4443-0x0;var _0xac7ad4=_0x39ab[_0x5c4443];return _0xac7ad4;};'use strict';var _=require(_0xb39a('0x0'));var util=require('util');var moment=require(_0xb39a('0x1'));var BPromise=require('bluebird');var rs=require(_0xb39a('0x2'));var fs=require('fs');var Redis=require(_0xb39a('0x3'));var db=require(_0xb39a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb39a('0x5'))(_0xb39a('0x6'));var config=require(_0xb39a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb39a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x399cd6,_0x44d425,_0x8c5eb){return new BPromise(function(_0x152c92,_0x475edd){return client[_0xb39a('0x9')](_0x399cd6,_0x8c5eb)[_0xb39a('0xa')](function(_0xc25846){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x44d425,_0xb39a('0xb'));logger[_0xb39a('0xc')](_0xb39a('0xd'),_0x44d425,_0xb39a('0xb'),JSON[_0xb39a('0xe')](_0xc25846));if(_0xc25846[_0xb39a('0xf')]){if(_0xc25846[_0xb39a('0xf')]['code']===0x1f4){logger[_0xb39a('0xf')](_0xb39a('0x10'),_0x44d425,_0xc25846[_0xb39a('0xf')][_0xb39a('0x11')]);return _0x475edd(_0xc25846[_0xb39a('0xf')][_0xb39a('0x11')]);}logger[_0xb39a('0xf')](_0xb39a('0x10'),_0x44d425,_0xc25846['error'][_0xb39a('0x11')]);return _0x152c92(_0xc25846[_0xb39a('0xf')][_0xb39a('0x11')]);}else{logger[_0xb39a('0x12')](_0xb39a('0x10'),_0x44d425,'request\x20sent');_0x152c92(_0xc25846[_0xb39a('0x13')][_0xb39a('0x11')]);}})[_0xb39a('0x14')](function(_0x5ed964){logger[_0xb39a('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x44d425,_0x5ed964);_0x475edd(_0x5ed964);});});} \ No newline at end of file +var _0x1cc9=['../../config/logger','../../config/environment','jayson/promise','client','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x157c09,_0x321dee){var _0x1db4d0=function(_0x400df9){while(--_0x400df9){_0x157c09['push'](_0x157c09['shift']());}};_0x1db4d0(++_0x321dee);}(_0x1cc9,0x7d));var _0x91cc=function(_0xd6ecce,_0x38ce20){_0xd6ecce=_0xd6ecce-0x0;var _0x22e1af=_0x1cc9[_0xd6ecce];return _0x22e1af;};'use strict';var _=require(_0x91cc('0x0'));var util=require(_0x91cc('0x1'));var moment=require('moment');var BPromise=require(_0x91cc('0x2'));var rs=require(_0x91cc('0x3'));var fs=require('fs');var Redis=require(_0x91cc('0x4'));var db=require(_0x91cc('0x5'))['db'];var utils=require(_0x91cc('0x6'));var logger=require(_0x91cc('0x7'))('rpc');var config=require(_0x91cc('0x8'));var jayson=require(_0x91cc('0x9'));var client=jayson[_0x91cc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1841e4,_0x5046ca,_0x38a6cb){return new BPromise(function(_0x191306,_0x331ada){return client[_0x91cc('0xb')](_0x1841e4,_0x38a6cb)['then'](function(_0x2d41aa){logger[_0x91cc('0xc')](_0x91cc('0xd'),_0x5046ca,_0x91cc('0xe'));logger[_0x91cc('0xf')](_0x91cc('0x10'),_0x5046ca,_0x91cc('0xe'),JSON[_0x91cc('0x11')](_0x2d41aa));if(_0x2d41aa['error']){if(_0x2d41aa['error'][_0x91cc('0x12')]===0x1f4){logger[_0x91cc('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x5046ca,_0x2d41aa[_0x91cc('0x13')][_0x91cc('0x14')]);return _0x331ada(_0x2d41aa[_0x91cc('0x13')][_0x91cc('0x14')]);}logger[_0x91cc('0x13')](_0x91cc('0xd'),_0x5046ca,_0x2d41aa[_0x91cc('0x13')][_0x91cc('0x14')]);return _0x191306(_0x2d41aa[_0x91cc('0x13')][_0x91cc('0x14')]);}else{logger[_0x91cc('0xc')](_0x91cc('0xd'),_0x5046ca,_0x91cc('0xe'));_0x191306(_0x2d41aa[_0x91cc('0x15')][_0x91cc('0x14')]);}})['catch'](function(_0xf72f6b){logger[_0x91cc('0x13')](_0x91cc('0xd'),_0x5046ca,_0xf72f6b);_0x331ada(_0xf72f6b);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index c3cb91b..ab63db0 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 _0xc997=['/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','getConfigurations'];(function(_0x5be1ac,_0x5ee1f4){var _0x21b996=function(_0x377104){while(--_0x377104){_0x5be1ac['push'](_0x5be1ac['shift']());}};_0x21b996(++_0x5ee1f4);}(_0xc997,0x1ac));var _0x7c99=function(_0x638bbd,_0x144bc5){_0x638bbd=_0x638bbd-0x0;var _0x3c43b7=_0xc997[_0x638bbd];return _0x3c43b7;};'use strict';var multer=require('multer');var util=require(_0x7c99('0x0'));var path=require(_0x7c99('0x1'));var timeout=require(_0x7c99('0x2'));var express=require(_0x7c99('0x3'));var router=express[_0x7c99('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7c99('0x5'));var interaction=require(_0x7c99('0x6'));var config=require(_0x7c99('0x7'));var controller=require(_0x7c99('0x8'));router[_0x7c99('0x9')]('/',auth[_0x7c99('0xa')](),controller[_0x7c99('0xb')]);router[_0x7c99('0x9')]('/:id',auth[_0x7c99('0xa')](),controller[_0x7c99('0xc')]);router[_0x7c99('0x9')]('/:id/configurations',auth[_0x7c99('0xa')](),controller[_0x7c99('0xd')]);router['get'](_0x7c99('0xe'),auth['isAuthenticated'](),controller[_0x7c99('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7c99('0x10')]);router[_0x7c99('0x11')](_0x7c99('0x12'),auth[_0x7c99('0xa')](),controller[_0x7c99('0x13')]);router[_0x7c99('0x14')](_0x7c99('0x15'),auth[_0x7c99('0xa')](),controller[_0x7c99('0x16')]);router[_0x7c99('0x17')](_0x7c99('0x15'),auth[_0x7c99('0xa')](),controller[_0x7c99('0x18')]);module[_0x7c99('0x19')]=router; \ No newline at end of file +var _0x4262=['/:id','show','getConfigurations','/:id/fields','create','post','/:id/configurations','put','update','destroy','exports','multer','util','path','express','fs-extra','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x4ad296,_0x15f440){var _0x2cf3fe=function(_0x25153e){while(--_0x25153e){_0x4ad296['push'](_0x4ad296['shift']());}};_0x2cf3fe(++_0x15f440);}(_0x4262,0x15f));var _0x2426=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4262[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x2426('0x0'));var util=require(_0x2426('0x1'));var path=require(_0x2426('0x2'));var timeout=require('connect-timeout');var express=require(_0x2426('0x3'));var router=express['Router']();var fs_extra=require(_0x2426('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2426('0x5'));var controller=require(_0x2426('0x6'));router[_0x2426('0x7')]('/',auth[_0x2426('0x8')](),controller['index']);router[_0x2426('0x7')](_0x2426('0x9'),auth[_0x2426('0x8')](),controller[_0x2426('0xa')]);router[_0x2426('0x7')]('/:id/configurations',auth[_0x2426('0x8')](),controller[_0x2426('0xb')]);router[_0x2426('0x7')](_0x2426('0xc'),auth[_0x2426('0x8')](),controller['getFields']);router['post']('/',auth[_0x2426('0x8')](),controller[_0x2426('0xd')]);router[_0x2426('0xe')](_0x2426('0xf'),auth[_0x2426('0x8')](),controller['addConfiguration']);router[_0x2426('0x10')](_0x2426('0x9'),auth[_0x2426('0x8')](),controller[_0x2426('0x11')]);router['delete'](_0x2426('0x9'),auth[_0x2426('0x8')](),controller[_0x2426('0x12')]);module[_0x2426('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index b9aba86..a9653fd 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 _0xb280=['exports','STRING','HelpDesk'];(function(_0x54a8ce,_0x58d6fa){var _0x1b26e3=function(_0x5e9b66){while(--_0x5e9b66){_0x54a8ce['push'](_0x54a8ce['shift']());}};_0x1b26e3(++_0x58d6fa);}(_0xb280,0x19e));var _0x0b28=function(_0x564e75,_0x1b060b){_0x564e75=_0x564e75-0x0;var _0x40111b=_0xb280[_0x564e75];return _0x40111b;};'use strict';var Sequelize=require('sequelize');module[_0x0b28('0x0')]={'name':{'type':Sequelize[_0x0b28('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0b28('0x1')]},'username':{'type':Sequelize[_0x0b28('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0b28('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x0b28('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x0b28('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xac26=['exports','STRING','HelpDesk','sequelize'];(function(_0x1d1967,_0x52b368){var _0x5d6ce0=function(_0x41f793){while(--_0x41f793){_0x1d1967['push'](_0x1d1967['shift']());}};_0x5d6ce0(++_0x52b368);}(_0xac26,0x14b));var _0x6ac2=function(_0x36cec9,_0x7e7a62){_0x36cec9=_0x36cec9-0x0;var _0x44bcaa=_0xac26[_0x36cec9];return _0x44bcaa;};'use strict';var Sequelize=require(_0x6ac2('0x0'));module[_0x6ac2('0x1')]={'name':{'type':Sequelize[_0x6ac2('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6ac2('0x2')]},'username':{'type':Sequelize[_0x6ac2('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6ac2('0x2')],'allowNull':![],'defaultValue':_0x6ac2('0x3')},'remoteUri':{'type':Sequelize[_0x6ac2('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6ac2('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x6ac2('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 0f27fc6..01456da 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 _0x7c4e=['type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','getConfigurations','findOne','VtigerConfiguration','rawAttributes','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','moduleName','remoteUri','serverUrl','username','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','describe','reference','owner','includes','remove','editable','false','cf_','picklist','picklistValues','label','value','log','statusCode','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','VtigerAccount','fieldName'];(function(_0x5c7921,_0x49b9fa){var _0x263a40=function(_0x38a3bc){while(--_0x38a3bc){_0x5c7921['push'](_0x5c7921['shift']());}};_0x263a40(++_0x49b9fa);}(_0x7c4e,0x1be));var _0xe7c4=function(_0x2dd429,_0x1e5d4e){_0x2dd429=_0x2dd429-0x0;var _0x386787=_0x7c4e[_0x2dd429];return _0x386787;};'use strict';var emlformat=require(_0xe7c4('0x0'));var rimraf=require(_0xe7c4('0x1'));var zipdir=require(_0xe7c4('0x2'));var jsonpatch=require(_0xe7c4('0x3'));var rp=require(_0xe7c4('0x4'));var moment=require('moment');var BPromise=require(_0xe7c4('0x5'));var Mustache=require(_0xe7c4('0x6'));var util=require(_0xe7c4('0x7'));var path=require(_0xe7c4('0x8'));var sox=require('sox');var csv=require(_0xe7c4('0x9'));var ejs=require(_0xe7c4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe7c4('0xb'));var squel=require(_0xe7c4('0xc'));var crypto=require(_0xe7c4('0xd'));var jsforce=require(_0xe7c4('0xe'));var deskjs=require(_0xe7c4('0xf'));var toCsv=require(_0xe7c4('0x9'));var querystring=require(_0xe7c4('0x10'));var Papa=require(_0xe7c4('0x11'));var Redis=require('ioredis');var authService=require(_0xe7c4('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe7c4('0x13'));var logger=require(_0xe7c4('0x14'))(_0xe7c4('0x15'));var utils=require(_0xe7c4('0x16'));var config=require(_0xe7c4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7c4('0x18'))['db'];var integrations=require(_0xe7c4('0x19'));function respondWithStatusCode(_0x4bd7a4,_0x230a92){_0x230a92=_0x230a92||0xcc;return function(_0x9db25){if(_0x9db25){return _0x4bd7a4['sendStatus'](_0x230a92);}return _0x4bd7a4[_0xe7c4('0x1a')](_0x230a92)[_0xe7c4('0x1b')]();};}function respondWithResult(_0x4ac12f,_0x344a03){_0x344a03=_0x344a03||0xc8;return function(_0x35f661){if(_0x35f661){return _0x4ac12f['status'](_0x344a03)[_0xe7c4('0x1c')](_0x35f661);}};}function respondWithFilteredResult(_0x156bc9,_0x455bbb){return function(_0x17641b){if(_0x17641b){var _0x4fcf2c=typeof _0x455bbb['offset']===_0xe7c4('0x1d')&&typeof _0x455bbb[_0xe7c4('0x1e')]===_0xe7c4('0x1d');var _0x1436b4=_0x17641b[_0xe7c4('0x1f')];var _0x34589e=_0x4fcf2c?0x0:_0x455bbb['offset'];var _0x4b549e=_0x4fcf2c?_0x17641b[_0xe7c4('0x1f')]:_0x455bbb[_0xe7c4('0x20')]+_0x455bbb['limit'];var _0x47011f;if(_0x4b549e>=_0x1436b4){_0x4b549e=_0x1436b4;_0x47011f=0xc8;}else{_0x47011f=0xce;}_0x156bc9['status'](_0x47011f);return _0x156bc9[_0xe7c4('0x21')](_0xe7c4('0x22'),_0x34589e+'-'+_0x4b549e+'/'+_0x1436b4)[_0xe7c4('0x1c')](_0x17641b);}return null;};}function patchUpdates(_0xde6d5f){return function(_0x2f9952){try{jsonpatch[_0xe7c4('0x23')](_0x2f9952,_0xde6d5f,!![]);}catch(_0x14942b){return BPromise[_0xe7c4('0x24')](_0x14942b);}return _0x2f9952[_0xe7c4('0x25')]();};}function saveUpdates(_0x58f994,_0x17e0ac){return function(_0x1cbe5c){if(_0x1cbe5c){return _0x1cbe5c['update'](_0x58f994)[_0xe7c4('0x26')](function(_0x4b3718){return _0x4b3718;});}return null;};}function removeEntity(_0x2ec680,_0x213118){return function(_0x25e286){if(_0x25e286){return _0x25e286[_0xe7c4('0x27')]()[_0xe7c4('0x26')](function(){_0x2ec680[_0xe7c4('0x1a')](0xcc)[_0xe7c4('0x1b')]();});}};}function handleEntityNotFound(_0x424bda,_0x1762d2){return function(_0x4fdb59){if(!_0x4fdb59){_0x424bda['sendStatus'](0x194);}return _0x4fdb59;};}function handleError(_0x966fa,_0x4280f1){_0x4280f1=_0x4280f1||0x1f4;return function(_0x55dd54){logger[_0xe7c4('0x28')](_0x55dd54[_0xe7c4('0x29')]);if(_0x55dd54['name']){delete _0x55dd54[_0xe7c4('0x2a')];}_0x966fa['status'](_0x4280f1)[_0xe7c4('0x2b')](_0x55dd54);};}exports['index']=function(_0x214999,_0x56964e){var _0x303b65={},_0x54ef51={},_0x23fda7={'count':0x0,'rows':[]};var _0x5d0a44=_['map'](db[_0xe7c4('0x2c')]['rawAttributes'],function(_0xc84555){return{'name':_0xc84555[_0xe7c4('0x2d')],'type':_0xc84555[_0xe7c4('0x2e')][_0xe7c4('0x2f')]};});_0x54ef51[_0xe7c4('0x30')]=_[_0xe7c4('0x31')](_0x5d0a44,_0xe7c4('0x2a'));_0x54ef51[_0xe7c4('0x32')]=_[_0xe7c4('0x33')](_0x214999[_0xe7c4('0x32')]);_0x54ef51[_0xe7c4('0x34')]=_[_0xe7c4('0x35')](_0x54ef51['model'],_0x54ef51[_0xe7c4('0x32')]);_0x303b65[_0xe7c4('0x36')]=_['intersection'](_0x54ef51[_0xe7c4('0x30')],qs[_0xe7c4('0x37')](_0x214999['query'][_0xe7c4('0x37')]));_0x303b65[_0xe7c4('0x36')]=_0x303b65[_0xe7c4('0x36')]['length']?_0x303b65[_0xe7c4('0x36')]:_0x54ef51['model'];if(!_0x214999[_0xe7c4('0x32')][_0xe7c4('0x38')]('nolimit')){_0x303b65[_0xe7c4('0x1e')]=qs['limit'](_0x214999[_0xe7c4('0x32')]['limit']);_0x303b65[_0xe7c4('0x20')]=qs[_0xe7c4('0x20')](_0x214999[_0xe7c4('0x32')][_0xe7c4('0x20')]);}_0x303b65[_0xe7c4('0x39')]=qs['sort'](_0x214999[_0xe7c4('0x32')][_0xe7c4('0x3a')]);_0x303b65[_0xe7c4('0x3b')]=qs[_0xe7c4('0x34')](_[_0xe7c4('0x3c')](_0x214999[_0xe7c4('0x32')],_0x54ef51[_0xe7c4('0x34')]),_0x5d0a44);if(_0x214999[_0xe7c4('0x32')]['filter']){_0x303b65[_0xe7c4('0x3b')]=_[_0xe7c4('0x3d')](_0x303b65[_0xe7c4('0x3b')],{'$or':_['map'](_0x5d0a44,function(_0x20acbf){if(_0x20acbf['type']!=='VIRTUAL'){var _0x3c74bc={};_0x3c74bc[_0x20acbf[_0xe7c4('0x2a')]]={'$like':'%'+_0x214999[_0xe7c4('0x32')][_0xe7c4('0x3e')]+'%'};return _0x3c74bc;}})});}_0x303b65=_[_0xe7c4('0x3d')]({},_0x303b65,_0x214999[_0xe7c4('0x3f')]);var _0xcb0e2c={'where':_0x303b65['where']};return db[_0xe7c4('0x2c')][_0xe7c4('0x1f')](_0xcb0e2c)[_0xe7c4('0x26')](function(_0x3b8b86){_0x23fda7[_0xe7c4('0x1f')]=_0x3b8b86;if(_0x214999[_0xe7c4('0x32')][_0xe7c4('0x40')]){_0x303b65[_0xe7c4('0x41')]=[{'all':!![]}];}return db[_0xe7c4('0x2c')][_0xe7c4('0x42')](_0x303b65);})[_0xe7c4('0x26')](function(_0x94e457){_0x23fda7[_0xe7c4('0x43')]=_0x94e457;return _0x23fda7;})[_0xe7c4('0x26')](respondWithFilteredResult(_0x56964e,_0x303b65))[_0xe7c4('0x44')](handleError(_0x56964e,null));};exports[_0xe7c4('0x45')]=function(_0xbd32d,_0xd17e14){var _0x5a1fee={'raw':![],'where':{'id':_0xbd32d[_0xe7c4('0x46')]['id']}},_0x1cdcb8={};_0x1cdcb8[_0xe7c4('0x30')]=_['keys'](db[_0xe7c4('0x2c')]['rawAttributes']);_0x1cdcb8[_0xe7c4('0x32')]=_[_0xe7c4('0x33')](_0xbd32d[_0xe7c4('0x32')]);_0x1cdcb8[_0xe7c4('0x34')]=_[_0xe7c4('0x35')](_0x1cdcb8[_0xe7c4('0x30')],_0x1cdcb8[_0xe7c4('0x32')]);_0x5a1fee[_0xe7c4('0x36')]=_[_0xe7c4('0x35')](_0x1cdcb8['model'],qs['fields'](_0xbd32d[_0xe7c4('0x32')][_0xe7c4('0x37')]));_0x5a1fee[_0xe7c4('0x36')]=_0x5a1fee['attributes'][_0xe7c4('0x47')]?_0x5a1fee[_0xe7c4('0x36')]:_0x1cdcb8[_0xe7c4('0x30')];if(_0xbd32d[_0xe7c4('0x32')][_0xe7c4('0x40')]){_0x5a1fee['include']=[{'all':!![]}];}_0x5a1fee=_['merge']({},_0x5a1fee,_0xbd32d[_0xe7c4('0x3f')]);return db[_0xe7c4('0x2c')][_0xe7c4('0x48')](_0x5a1fee)[_0xe7c4('0x26')](handleEntityNotFound(_0xd17e14,null))[_0xe7c4('0x26')](respondWithResult(_0xd17e14,null))['catch'](handleError(_0xd17e14,null));};exports[_0xe7c4('0x49')]=function(_0x33d924,_0x5ce963){return db[_0xe7c4('0x2c')][_0xe7c4('0x49')](_0x33d924[_0xe7c4('0x4a')],{})['then'](respondWithResult(_0x5ce963,0xc9))[_0xe7c4('0x44')](handleError(_0x5ce963,null));};exports[_0xe7c4('0x4b')]=function(_0x32a96d,_0xa34320){if(_0x32a96d[_0xe7c4('0x4a')]['id']){delete _0x32a96d[_0xe7c4('0x4a')]['id'];}return db[_0xe7c4('0x2c')][_0xe7c4('0x48')]({'where':{'id':_0x32a96d['params']['id']}})[_0xe7c4('0x26')](handleEntityNotFound(_0xa34320,null))['then'](saveUpdates(_0x32a96d[_0xe7c4('0x4a')],null))[_0xe7c4('0x26')](respondWithResult(_0xa34320,null))[_0xe7c4('0x44')](handleError(_0xa34320,null));};exports['destroy']=function(_0x52c541,_0x166d86){return db[_0xe7c4('0x2c')][_0xe7c4('0x48')]({'where':{'id':_0x52c541['params']['id']}})[_0xe7c4('0x26')](handleEntityNotFound(_0x166d86,null))[_0xe7c4('0x26')](removeEntity(_0x166d86,null))[_0xe7c4('0x44')](handleError(_0x166d86,null));};exports[_0xe7c4('0x4c')]=function(_0x3cd8e8,_0x3359d5,_0x10ca53){var _0x30c54b={};var _0x2613ab={};var _0x13cf8b;var _0x115b31;return db[_0xe7c4('0x2c')][_0xe7c4('0x4d')]({'where':{'id':_0x3cd8e8['params']['id']}})[_0xe7c4('0x26')](handleEntityNotFound(_0x3359d5,null))['then'](function(_0x22783a){if(_0x22783a){_0x13cf8b=_0x22783a;_0x2613ab[_0xe7c4('0x30')]=_[_0xe7c4('0x33')](db[_0xe7c4('0x4e')][_0xe7c4('0x4f')]);_0x2613ab[_0xe7c4('0x32')]=_['keys'](_0x3cd8e8[_0xe7c4('0x32')]);_0x2613ab['filters']=_[_0xe7c4('0x35')](_0x2613ab[_0xe7c4('0x30')],_0x2613ab[_0xe7c4('0x32')]);_0x30c54b[_0xe7c4('0x36')]=_[_0xe7c4('0x35')](_0x2613ab[_0xe7c4('0x30')],qs[_0xe7c4('0x37')](_0x3cd8e8[_0xe7c4('0x32')][_0xe7c4('0x37')]));_0x30c54b[_0xe7c4('0x36')]=_0x30c54b[_0xe7c4('0x36')][_0xe7c4('0x47')]?_0x30c54b[_0xe7c4('0x36')]:_0x2613ab[_0xe7c4('0x30')];_0x30c54b[_0xe7c4('0x39')]=qs[_0xe7c4('0x3a')](_0x3cd8e8[_0xe7c4('0x32')][_0xe7c4('0x3a')]);_0x30c54b[_0xe7c4('0x3b')]=qs[_0xe7c4('0x34')](_['pick'](_0x3cd8e8['query'],_0x2613ab[_0xe7c4('0x34')]));if(_0x3cd8e8['query'][_0xe7c4('0x3e')]){_0x30c54b['where']=_[_0xe7c4('0x3d')](_0x30c54b[_0xe7c4('0x3b')],{'$or':_[_0xe7c4('0x31')](_0x30c54b[_0xe7c4('0x36')],function(_0x56a5be){var _0x5599c5={};_0x5599c5[_0x56a5be]={'$like':'%'+_0x3cd8e8[_0xe7c4('0x32')][_0xe7c4('0x3e')]+'%'};return _0x5599c5;})});}_0x30c54b=_[_0xe7c4('0x3d')]({},_0x30c54b,_0x3cd8e8[_0xe7c4('0x3f')]);return _0x13cf8b[_0xe7c4('0x4c')](_0x30c54b);}})[_0xe7c4('0x26')](function(_0x3cc666){if(_0x3cc666){_0x115b31=_0x3cc666[_0xe7c4('0x47')];if(!_0x3cd8e8[_0xe7c4('0x32')]['hasOwnProperty'](_0xe7c4('0x50'))){_0x30c54b['limit']=qs[_0xe7c4('0x1e')](_0x3cd8e8[_0xe7c4('0x32')]['limit']);_0x30c54b['offset']=qs[_0xe7c4('0x20')](_0x3cd8e8[_0xe7c4('0x32')][_0xe7c4('0x20')]);}return _0x13cf8b['getConfigurations'](_0x30c54b);}})[_0xe7c4('0x26')](function(_0x499378){if(_0x499378){return _0x499378?{'count':_0x115b31,'rows':_0x499378}:null;}})[_0xe7c4('0x26')](respondWithResult(_0x3359d5,null))[_0xe7c4('0x44')](handleError(_0x3359d5,null));};exports[_0xe7c4('0x51')]=function(_0x44690c,_0x30243e,_0x30fcdc){if(_0x44690c[_0xe7c4('0x4a')]['id']){delete _0x44690c[_0xe7c4('0x4a')]['id'];}return db[_0xe7c4('0x2c')][_0xe7c4('0x4d')]({'where':{'id':_0x44690c[_0xe7c4('0x46')]['id']}})[_0xe7c4('0x26')](handleEntityNotFound(_0x30243e,null))[_0xe7c4('0x26')](function(_0x20f7a6){if(_0x20f7a6){_0x44690c[_0xe7c4('0x4a')][_0xe7c4('0x52')]=_0x20f7a6['id'];_0x44690c[_0xe7c4('0x4a')]['Subjects']=integrations[_0xe7c4('0x53')](_0x44690c[_0xe7c4('0x4a')][_0xe7c4('0x54')],_0x44690c[_0xe7c4('0x4a')][_0xe7c4('0x2e')]);_0x44690c[_0xe7c4('0x4a')][_0xe7c4('0x55')]=integrations[_0xe7c4('0x56')](_0x44690c[_0xe7c4('0x4a')]['channel'],_0x44690c[_0xe7c4('0x4a')]['type']);return db[_0xe7c4('0x4e')]['create'](_0x44690c[_0xe7c4('0x4a')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0xe7c4('0x57')],'as':_0xe7c4('0x55')}]});}return null;})[_0xe7c4('0x26')](respondWithResult(_0x30243e,null))[_0xe7c4('0x44')](handleError(_0x30243e,null));};var md5=require(_0xe7c4('0x58'));exports['getFields']=function(_0x290ab2,_0x54a00b,_0x15b133){var _0x313e3b=null;var _0x2c0a5f=null;var _0x5b1f86=null;var _0x58cffd=null;var _0x4bbd91='';return db['VtigerAccount'][_0xe7c4('0x4d')]({'where':{'id':_0x290ab2[_0xe7c4('0x46')]['id']},'attributes':['id',_0xe7c4('0x2a'),'username','description',_0xe7c4('0x59'),_0xe7c4('0x5a'),_0xe7c4('0x5b'),'accessKey']})['then'](handleEntityNotFound(_0x54a00b,null))[_0xe7c4('0x26')](function(_0x3eb4c4){if(_0x3eb4c4){_0x313e3b=_0x3eb4c4[_0xe7c4('0x5c')];_0x2c0a5f=_0x3eb4c4[_0xe7c4('0x5d')];_0x5b1f86=_0x3eb4c4[_0xe7c4('0x59')];_0x4bbd91=_0x3eb4c4[_0xe7c4('0x5a')];var _0xd23f7a=_0x4bbd91[_0xe7c4('0x5e')](-0x1);if(_0xd23f7a==='/'){_0x4bbd91=_0x4bbd91[_0xe7c4('0x5f')](0x0,_0x4bbd91[_0xe7c4('0x60')](_0xd23f7a));}_0x58cffd=util[_0xe7c4('0x61')](_0xe7c4('0x62'),_0x4bbd91);var _0x248a44={'method':_0xe7c4('0x63'),'uri':_0x58cffd,'qs':{'operation':_0xe7c4('0x64'),'username':_0x3eb4c4['username']},'json':!![]};return rp(_0x248a44);}})[_0xe7c4('0x26')](function(_0x34eca8){if(_0x34eca8[_0xe7c4('0x65')]){var _0x1f607e={'method':_0xe7c4('0x66'),'uri':_0x58cffd,'form':{'operation':_0xe7c4('0x67'),'username':_0x313e3b,'accessKey':md5(_0x34eca8[_0xe7c4('0x68')]['token']+_0x2c0a5f)},'json':!![]};return rp(_0x1f607e);}})[_0xe7c4('0x26')](function(_0x20a5fb){if(_0x20a5fb['success']){var _0x2881dd={'method':_0xe7c4('0x63'),'uri':_0x58cffd,'qs':{'operation':_0xe7c4('0x69'),'username':_0x313e3b,'sessionName':_0x20a5fb['result']['sessionName'],'elementType':_0x5b1f86},'json':!![]};return rp(_0x2881dd);}})[_0xe7c4('0x26')](function(_0x518246){if(_0x518246['success']){var _0x542410=['autogenerated',_0xe7c4('0x6a'),_0xe7c4('0x6b')];_['remove'](_0x518246['result']['fields'],function(_0x1b33ac){return _0x542410[_0xe7c4('0x6c')](_0x1b33ac['type'][_0xe7c4('0x2a')]);});_[_0xe7c4('0x6d')](_0x518246['result'][_0xe7c4('0x37')],function(_0x5287e6){return _0x5287e6[_0xe7c4('0x6e')]===_0xe7c4('0x6f');});return{'count':_0x518246[_0xe7c4('0x68')]['fields'][_0xe7c4('0x47')],'rows':_['map'](_0x518246[_0xe7c4('0x68')][_0xe7c4('0x37')],function(_0x2f5c26){return{'id':_0x2f5c26['name'],'name':_0x2f5c26['label'],'custom':_['startsWith'](_0x2f5c26[_0xe7c4('0x2a')],_0xe7c4('0x70'))?!![]:![],'options':_0x2f5c26[_0xe7c4('0x2e')][_0xe7c4('0x2a')]===_0xe7c4('0x71')&&_0x2f5c26[_0xe7c4('0x2e')][_0xe7c4('0x72')]['length']>0x0?_[_0xe7c4('0x31')](_0x2f5c26[_0xe7c4('0x2e')][_0xe7c4('0x72')],function(_0x304ab0){return{'name':_0x304ab0[_0xe7c4('0x73')],'value':_0x304ab0[_0xe7c4('0x74')]};}):[]};})};}})['then'](respondWithResult(_0x54a00b,null))['catch'](function(_0x32f1ce){console[_0xe7c4('0x75')]('vTiger\x20error:\x20'+_0x32f1ce);var _0x5b6dea=_0x290ab2[_0xe7c4('0x32')]['test']?0x1f4:_0x32f1ce[_0xe7c4('0x76')]||0x1f4;logger[_0xe7c4('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xe7c4('0x77'),_0x5b6dea,JSON[_0xe7c4('0x78')](_0x32f1ce));delete _0x32f1ce[_0xe7c4('0x2a')];if(_0x5b6dea===0x191){_0x5b6dea=0x190;}_0x54a00b[_0xe7c4('0x1a')](_0x5b6dea)[_0xe7c4('0x2b')](_0x290ab2[_0xe7c4('0x32')][_0xe7c4('0x79')]?{'message':_0xe7c4('0x7a'),'statusCode':_0x32f1ce[_0xe7c4('0x76')]}:_0x32f1ce);});}; \ No newline at end of file +var _0x533c=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','offset','limit','count','Content-Range','json','apply','save','update','then','end','sendStatus','error','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','filters','intersection','attributes','fields','query','length','model','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','findAll','show','params','keys','create','body','catch','destroy','find','getConfigurations','VtigerConfiguration','order','pick','addConfiguration','findOne','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','%s/webservice.php','GET','success','login','result','token','autogenerated','remove','includes','false','label','startsWith','cf_','picklist','picklistValues','value','log','statusCode','stringify','test','Wrong\x20credentials','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring'];(function(_0x5746a1,_0x11eab1){var _0x551a43=function(_0x7ddcbe){while(--_0x7ddcbe){_0x5746a1['push'](_0x5746a1['shift']());}};_0x551a43(++_0x11eab1);}(_0x533c,0x1af));var _0xc533=function(_0x30e211,_0x32e11b){_0x30e211=_0x30e211-0x0;var _0x2c1ec1=_0x533c[_0x30e211];return _0x2c1ec1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc533('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc533('0x1'));var rp=require('request-promise');var moment=require(_0xc533('0x2'));var BPromise=require(_0xc533('0x3'));var Mustache=require(_0xc533('0x4'));var util=require('util');var path=require(_0xc533('0x5'));var sox=require('sox');var csv=require(_0xc533('0x6'));var ejs=require(_0xc533('0x7'));var fs=require('fs');var fs_extra=require(_0xc533('0x8'));var _=require(_0xc533('0x9'));var squel=require('squel');var crypto=require(_0xc533('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc533('0xb'));var toCsv=require(_0xc533('0x6'));var querystring=require(_0xc533('0xc'));var Papa=require(_0xc533('0xd'));var Redis=require(_0xc533('0xe'));var authService=require(_0xc533('0xf'));var qs=require(_0xc533('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc533('0x11'));var logger=require(_0xc533('0x12'))(_0xc533('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc533('0x14'));var db=require(_0xc533('0x15'))['db'];var integrations=require(_0xc533('0x16'));function respondWithStatusCode(_0x3b1d41,_0x45d771){_0x45d771=_0x45d771||0xcc;return function(_0x5bb02f){if(_0x5bb02f){return _0x3b1d41['sendStatus'](_0x45d771);}return _0x3b1d41[_0xc533('0x17')](_0x45d771)['end']();};}function respondWithResult(_0x44a50a,_0x408629){_0x408629=_0x408629||0xc8;return function(_0x3d9a73){if(_0x3d9a73){return _0x44a50a[_0xc533('0x17')](_0x408629)['json'](_0x3d9a73);}};}function respondWithFilteredResult(_0x273767,_0x1f2e6a){return function(_0x30a361){if(_0x30a361){var _0x27f5b0=typeof _0x1f2e6a[_0xc533('0x18')]==='undefined'&&typeof _0x1f2e6a[_0xc533('0x19')]==='undefined';var _0x30ccb6=_0x30a361[_0xc533('0x1a')];var _0x2cadad=_0x27f5b0?0x0:_0x1f2e6a[_0xc533('0x18')];var _0x5af848=_0x27f5b0?_0x30a361[_0xc533('0x1a')]:_0x1f2e6a[_0xc533('0x18')]+_0x1f2e6a['limit'];var _0xa1e1d5;if(_0x5af848>=_0x30ccb6){_0x5af848=_0x30ccb6;_0xa1e1d5=0xc8;}else{_0xa1e1d5=0xce;}_0x273767[_0xc533('0x17')](_0xa1e1d5);return _0x273767['set'](_0xc533('0x1b'),_0x2cadad+'-'+_0x5af848+'/'+_0x30ccb6)[_0xc533('0x1c')](_0x30a361);}return null;};}function patchUpdates(_0x5320f2){return function(_0x169d59){try{jsonpatch[_0xc533('0x1d')](_0x169d59,_0x5320f2,!![]);}catch(_0x4ac768){return BPromise['reject'](_0x4ac768);}return _0x169d59[_0xc533('0x1e')]();};}function saveUpdates(_0x28fb87,_0x2285fb){return function(_0x2daabf){if(_0x2daabf){return _0x2daabf[_0xc533('0x1f')](_0x28fb87)[_0xc533('0x20')](function(_0x495759){return _0x495759;});}return null;};}function removeEntity(_0x12dc83,_0x3cfce3){return function(_0x11731e){if(_0x11731e){return _0x11731e['destroy']()[_0xc533('0x20')](function(){_0x12dc83[_0xc533('0x17')](0xcc)[_0xc533('0x21')]();});}};}function handleEntityNotFound(_0x46bda8,_0x1742fb){return function(_0x4ffdfb){if(!_0x4ffdfb){_0x46bda8[_0xc533('0x22')](0x194);}return _0x4ffdfb;};}function handleError(_0x462fb3,_0x39e413){_0x39e413=_0x39e413||0x1f4;return function(_0xdabf85){logger[_0xc533('0x23')](_0xdabf85['stack']);if(_0xdabf85['name']){delete _0xdabf85[_0xc533('0x24')];}_0x462fb3[_0xc533('0x17')](_0x39e413)[_0xc533('0x25')](_0xdabf85);};}exports[_0xc533('0x26')]=function(_0x498beb,_0x5a80f1){var _0x11250c={},_0x39be75={},_0x59bf3f={'count':0x0,'rows':[]};var _0x2fd403=_[_0xc533('0x27')](db[_0xc533('0x28')][_0xc533('0x29')],function(_0x4721d2){return{'name':_0x4721d2[_0xc533('0x2a')],'type':_0x4721d2[_0xc533('0x2b')]['key']};});_0x39be75['model']=_[_0xc533('0x27')](_0x2fd403,_0xc533('0x24'));_0x39be75['query']=_['keys'](_0x498beb['query']);_0x39be75[_0xc533('0x2c')]=_[_0xc533('0x2d')](_0x39be75['model'],_0x39be75['query']);_0x11250c[_0xc533('0x2e')]=_[_0xc533('0x2d')](_0x39be75['model'],qs[_0xc533('0x2f')](_0x498beb[_0xc533('0x30')][_0xc533('0x2f')]));_0x11250c[_0xc533('0x2e')]=_0x11250c[_0xc533('0x2e')][_0xc533('0x31')]?_0x11250c[_0xc533('0x2e')]:_0x39be75[_0xc533('0x32')];if(!_0x498beb[_0xc533('0x30')][_0xc533('0x33')]('nolimit')){_0x11250c[_0xc533('0x19')]=qs['limit'](_0x498beb['query'][_0xc533('0x19')]);_0x11250c[_0xc533('0x18')]=qs['offset'](_0x498beb[_0xc533('0x30')][_0xc533('0x18')]);}_0x11250c['order']=qs[_0xc533('0x34')](_0x498beb['query'][_0xc533('0x34')]);_0x11250c[_0xc533('0x35')]=qs[_0xc533('0x2c')](_['pick'](_0x498beb[_0xc533('0x30')],_0x39be75[_0xc533('0x2c')]),_0x2fd403);if(_0x498beb[_0xc533('0x30')][_0xc533('0x36')]){_0x11250c[_0xc533('0x35')]=_[_0xc533('0x37')](_0x11250c['where'],{'$or':_[_0xc533('0x27')](_0x2fd403,function(_0x408512){if(_0x408512[_0xc533('0x2b')]!=='VIRTUAL'){var _0x78be14={};_0x78be14[_0x408512[_0xc533('0x24')]]={'$like':'%'+_0x498beb['query']['filter']+'%'};return _0x78be14;}})});}_0x11250c=_['merge']({},_0x11250c,_0x498beb[_0xc533('0x38')]);var _0x1247a5={'where':_0x11250c[_0xc533('0x35')]};return db['VtigerAccount']['count'](_0x1247a5)[_0xc533('0x20')](function(_0x1c4de8){_0x59bf3f[_0xc533('0x1a')]=_0x1c4de8;if(_0x498beb[_0xc533('0x30')][_0xc533('0x39')]){_0x11250c[_0xc533('0x3a')]=[{'all':!![]}];}return db['VtigerAccount'][_0xc533('0x3b')](_0x11250c);})[_0xc533('0x20')](function(_0x4e72f3){_0x59bf3f['rows']=_0x4e72f3;return _0x59bf3f;})['then'](respondWithFilteredResult(_0x5a80f1,_0x11250c))['catch'](handleError(_0x5a80f1,null));};exports[_0xc533('0x3c')]=function(_0x4d85bf,_0x2fa81c){var _0x22c4c4={'raw':![],'where':{'id':_0x4d85bf[_0xc533('0x3d')]['id']}},_0x50eddf={};_0x50eddf[_0xc533('0x32')]=_['keys'](db[_0xc533('0x28')][_0xc533('0x29')]);_0x50eddf[_0xc533('0x30')]=_[_0xc533('0x3e')](_0x4d85bf['query']);_0x50eddf[_0xc533('0x2c')]=_['intersection'](_0x50eddf[_0xc533('0x32')],_0x50eddf['query']);_0x22c4c4[_0xc533('0x2e')]=_[_0xc533('0x2d')](_0x50eddf[_0xc533('0x32')],qs[_0xc533('0x2f')](_0x4d85bf['query']['fields']));_0x22c4c4[_0xc533('0x2e')]=_0x22c4c4[_0xc533('0x2e')][_0xc533('0x31')]?_0x22c4c4['attributes']:_0x50eddf['model'];if(_0x4d85bf[_0xc533('0x30')][_0xc533('0x39')]){_0x22c4c4[_0xc533('0x3a')]=[{'all':!![]}];}_0x22c4c4=_[_0xc533('0x37')]({},_0x22c4c4,_0x4d85bf['options']);return db[_0xc533('0x28')]['find'](_0x22c4c4)['then'](handleEntityNotFound(_0x2fa81c,null))[_0xc533('0x20')](respondWithResult(_0x2fa81c,null))['catch'](handleError(_0x2fa81c,null));};exports[_0xc533('0x3f')]=function(_0x419f99,_0x5b1bd3){return db[_0xc533('0x28')][_0xc533('0x3f')](_0x419f99[_0xc533('0x40')],{})[_0xc533('0x20')](respondWithResult(_0x5b1bd3,0xc9))[_0xc533('0x41')](handleError(_0x5b1bd3,null));};exports[_0xc533('0x1f')]=function(_0x4d2c63,_0x3b657a){if(_0x4d2c63[_0xc533('0x40')]['id']){delete _0x4d2c63[_0xc533('0x40')]['id'];}return db[_0xc533('0x28')]['find']({'where':{'id':_0x4d2c63['params']['id']}})['then'](handleEntityNotFound(_0x3b657a,null))[_0xc533('0x20')](saveUpdates(_0x4d2c63['body'],null))['then'](respondWithResult(_0x3b657a,null))['catch'](handleError(_0x3b657a,null));};exports[_0xc533('0x42')]=function(_0x5a7838,_0x40b373){return db[_0xc533('0x28')][_0xc533('0x43')]({'where':{'id':_0x5a7838[_0xc533('0x3d')]['id']}})['then'](handleEntityNotFound(_0x40b373,null))['then'](removeEntity(_0x40b373,null))['catch'](handleError(_0x40b373,null));};exports[_0xc533('0x44')]=function(_0x326421,_0x4c687e,_0x5388f9){var _0x135df9={};var _0x49e31d={};var _0x46a2c0;var _0x8cb586;return db[_0xc533('0x28')]['findOne']({'where':{'id':_0x326421[_0xc533('0x3d')]['id']}})[_0xc533('0x20')](handleEntityNotFound(_0x4c687e,null))[_0xc533('0x20')](function(_0x7bdc73){if(_0x7bdc73){_0x46a2c0=_0x7bdc73;_0x49e31d[_0xc533('0x32')]=_[_0xc533('0x3e')](db[_0xc533('0x45')][_0xc533('0x29')]);_0x49e31d[_0xc533('0x30')]=_['keys'](_0x326421[_0xc533('0x30')]);_0x49e31d[_0xc533('0x2c')]=_[_0xc533('0x2d')](_0x49e31d['model'],_0x49e31d[_0xc533('0x30')]);_0x135df9[_0xc533('0x2e')]=_[_0xc533('0x2d')](_0x49e31d[_0xc533('0x32')],qs[_0xc533('0x2f')](_0x326421[_0xc533('0x30')][_0xc533('0x2f')]));_0x135df9['attributes']=_0x135df9[_0xc533('0x2e')][_0xc533('0x31')]?_0x135df9[_0xc533('0x2e')]:_0x49e31d[_0xc533('0x32')];_0x135df9[_0xc533('0x46')]=qs[_0xc533('0x34')](_0x326421[_0xc533('0x30')][_0xc533('0x34')]);_0x135df9[_0xc533('0x35')]=qs[_0xc533('0x2c')](_[_0xc533('0x47')](_0x326421[_0xc533('0x30')],_0x49e31d[_0xc533('0x2c')]));if(_0x326421['query'][_0xc533('0x36')]){_0x135df9[_0xc533('0x35')]=_[_0xc533('0x37')](_0x135df9[_0xc533('0x35')],{'$or':_[_0xc533('0x27')](_0x135df9['attributes'],function(_0x42e2b8){var _0x4bfc1a={};_0x4bfc1a[_0x42e2b8]={'$like':'%'+_0x326421['query'][_0xc533('0x36')]+'%'};return _0x4bfc1a;})});}_0x135df9=_[_0xc533('0x37')]({},_0x135df9,_0x326421[_0xc533('0x38')]);return _0x46a2c0[_0xc533('0x44')](_0x135df9);}})['then'](function(_0x13fb4f){if(_0x13fb4f){_0x8cb586=_0x13fb4f[_0xc533('0x31')];if(!_0x326421['query']['hasOwnProperty']('nolimit')){_0x135df9['limit']=qs['limit'](_0x326421[_0xc533('0x30')][_0xc533('0x19')]);_0x135df9[_0xc533('0x18')]=qs['offset'](_0x326421[_0xc533('0x30')][_0xc533('0x18')]);}return _0x46a2c0[_0xc533('0x44')](_0x135df9);}})[_0xc533('0x20')](function(_0x55db8c){if(_0x55db8c){return _0x55db8c?{'count':_0x8cb586,'rows':_0x55db8c}:null;}})[_0xc533('0x20')](respondWithResult(_0x4c687e,null))[_0xc533('0x41')](handleError(_0x4c687e,null));};exports[_0xc533('0x48')]=function(_0x5afcdb,_0x1a7287,_0x24803f){if(_0x5afcdb[_0xc533('0x40')]['id']){delete _0x5afcdb[_0xc533('0x40')]['id'];}return db[_0xc533('0x28')][_0xc533('0x49')]({'where':{'id':_0x5afcdb[_0xc533('0x3d')]['id']}})[_0xc533('0x20')](handleEntityNotFound(_0x1a7287,null))[_0xc533('0x20')](function(_0x4ff40e){if(_0x4ff40e){_0x5afcdb[_0xc533('0x40')]['AccountId']=_0x4ff40e['id'];_0x5afcdb[_0xc533('0x40')][_0xc533('0x4a')]=integrations[_0xc533('0x4b')](_0x5afcdb[_0xc533('0x40')][_0xc533('0x4c')],_0x5afcdb[_0xc533('0x40')][_0xc533('0x2b')]);_0x5afcdb[_0xc533('0x40')]['Descriptions']=integrations[_0xc533('0x4d')](_0x5afcdb['body'][_0xc533('0x4c')],_0x5afcdb[_0xc533('0x40')][_0xc533('0x2b')]);return db[_0xc533('0x45')]['create'](_0x5afcdb[_0xc533('0x40')],{'include':[{'model':db['VtigerField'],'as':_0xc533('0x4a')},{'model':db[_0xc533('0x4e')],'as':_0xc533('0x4f')}]});}return null;})[_0xc533('0x20')](respondWithResult(_0x1a7287,null))[_0xc533('0x41')](handleError(_0x1a7287,null));};var md5=require(_0xc533('0x50'));exports[_0xc533('0x51')]=function(_0x2476a7,_0x1ade7b,_0x35e8dc){var _0x1b421d=null;var _0x40e68e=null;var _0x1f974b=null;var _0x2251c0=null;var _0x5ab5b1='';return db[_0xc533('0x28')][_0xc533('0x49')]({'where':{'id':_0x2476a7[_0xc533('0x3d')]['id']},'attributes':['id',_0xc533('0x24'),_0xc533('0x52'),_0xc533('0x53'),_0xc533('0x54'),_0xc533('0x55'),_0xc533('0x56'),'accessKey']})['then'](handleEntityNotFound(_0x1ade7b,null))[_0xc533('0x20')](function(_0x47327d){if(_0x47327d){_0x1b421d=_0x47327d['username'];_0x40e68e=_0x47327d[_0xc533('0x57')];_0x1f974b=_0x47327d[_0xc533('0x54')];_0x5ab5b1=_0x47327d[_0xc533('0x55')];var _0x116103=_0x5ab5b1[_0xc533('0x58')](-0x1);if(_0x116103==='/'){_0x5ab5b1=_0x5ab5b1['substring'](0x0,_0x5ab5b1[_0xc533('0x59')](_0x116103));}_0x2251c0=util['format'](_0xc533('0x5a'),_0x5ab5b1);var _0x542478={'method':_0xc533('0x5b'),'uri':_0x2251c0,'qs':{'operation':'getchallenge','username':_0x47327d[_0xc533('0x52')]},'json':!![]};return rp(_0x542478);}})[_0xc533('0x20')](function(_0x26df00){if(_0x26df00[_0xc533('0x5c')]){var _0x255a0d={'method':'POST','uri':_0x2251c0,'form':{'operation':_0xc533('0x5d'),'username':_0x1b421d,'accessKey':md5(_0x26df00[_0xc533('0x5e')][_0xc533('0x5f')]+_0x40e68e)},'json':!![]};return rp(_0x255a0d);}})['then'](function(_0x347b37){if(_0x347b37[_0xc533('0x5c')]){var _0x7587cf={'method':_0xc533('0x5b'),'uri':_0x2251c0,'qs':{'operation':'describe','username':_0x1b421d,'sessionName':_0x347b37[_0xc533('0x5e')]['sessionName'],'elementType':_0x1f974b},'json':!![]};return rp(_0x7587cf);}})['then'](function(_0x1813b8){if(_0x1813b8['success']){var _0x4da58c=[_0xc533('0x60'),'reference','owner'];_[_0xc533('0x61')](_0x1813b8[_0xc533('0x5e')][_0xc533('0x2f')],function(_0x52ab14){return _0x4da58c[_0xc533('0x62')](_0x52ab14[_0xc533('0x2b')][_0xc533('0x24')]);});_[_0xc533('0x61')](_0x1813b8['result'][_0xc533('0x2f')],function(_0x4ab4dc){return _0x4ab4dc['editable']===_0xc533('0x63');});return{'count':_0x1813b8[_0xc533('0x5e')][_0xc533('0x2f')][_0xc533('0x31')],'rows':_[_0xc533('0x27')](_0x1813b8[_0xc533('0x5e')][_0xc533('0x2f')],function(_0x2d3ab8){return{'id':_0x2d3ab8[_0xc533('0x24')],'name':_0x2d3ab8[_0xc533('0x64')],'custom':_[_0xc533('0x65')](_0x2d3ab8[_0xc533('0x24')],_0xc533('0x66'))?!![]:![],'options':_0x2d3ab8[_0xc533('0x2b')][_0xc533('0x24')]===_0xc533('0x67')&&_0x2d3ab8[_0xc533('0x2b')]['picklistValues']['length']>0x0?_[_0xc533('0x27')](_0x2d3ab8['type'][_0xc533('0x68')],function(_0x13978c){return{'name':_0x13978c[_0xc533('0x64')],'value':_0x13978c[_0xc533('0x69')]};}):[]};})};}})[_0xc533('0x20')](respondWithResult(_0x1ade7b,null))[_0xc533('0x41')](function(_0x4af723){console[_0xc533('0x6a')]('vTiger\x20error:\x20'+_0x4af723);var _0x4861d2=_0x2476a7[_0xc533('0x30')]['test']?0x1f4:_0x4af723[_0xc533('0x6b')]||0x1f4;logger[_0xc533('0x23')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4861d2,JSON[_0xc533('0x6c')](_0x4af723));delete _0x4af723['name'];if(_0x4861d2===0x191){_0x4861d2=0x190;}_0x1ade7b[_0xc533('0x17')](_0x4861d2)[_0xc533('0x25')](_0x2476a7[_0xc533('0x30')][_0xc533('0x6d')]?{'message':_0xc533('0x6e'),'statusCode':_0x4af723[_0xc533('0x6b')]}:_0x4af723);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index b71a9d3..1e88d66 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 _0xf089=['../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','path','./intVtigerAccount.attributes'];(function(_0x419a17,_0x4d144e){var _0x215d0f=function(_0x4ec322){while(--_0x4ec322){_0x419a17['push'](_0x419a17['shift']());}};_0x215d0f(++_0x4d144e);}(_0xf089,0x72));var _0x9f08=function(_0x461fa2,_0x3792d9){_0x461fa2=_0x461fa2-0x0;var _0xcd4ea7=_0xf089[_0x461fa2];return _0xcd4ea7;};'use strict';var _=require(_0x9f08('0x0'));var util=require('util');var logger=require(_0x9f08('0x1'))(_0x9f08('0x2'));var moment=require(_0x9f08('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f08('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9f08('0x5'));var integrations=require(_0x9f08('0x6'));module[_0x9f08('0x7')]=function(_0xd1c007,_0x164406){return _0xd1c007['define'](_0x9f08('0x8'),attributes,{'tableName':_0x9f08('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1bb=['VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x509548,_0x183f40){var _0x380d59=function(_0x51a5ff){while(--_0x51a5ff){_0x509548['push'](_0x509548['shift']());}};_0x380d59(++_0x183f40);}(_0xa1bb,0x136));var _0xba1b=function(_0x424059,_0x1af682){_0x424059=_0x424059-0x0;var _0x4f7d28=_0xa1bb[_0x424059];return _0x4f7d28;};'use strict';var _=require('lodash');var util=require(_0xba1b('0x0'));var logger=require(_0xba1b('0x1'))(_0xba1b('0x2'));var moment=require('moment');var BPromise=require(_0xba1b('0x3'));var rp=require(_0xba1b('0x4'));var fs=require('fs');var path=require(_0xba1b('0x5'));var rimraf=require(_0xba1b('0x6'));var config=require(_0xba1b('0x7'));var attributes=require(_0xba1b('0x8'));var integrations=require(_0xba1b('0x9'));module[_0xba1b('0xa')]=function(_0x5bba9d,_0x3cad35){return _0x5bba9d[_0xba1b('0xb')](_0xba1b('0xc'),attributes,{'tableName':_0xba1b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index e0536b2..9311faf 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 _0x7af2=['ShowVtigerAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error','message','VtigerAccount,\x20%s,\x20%s','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','debug','stringify','find','raw'];(function(_0x410d21,_0x2092e7){var _0x18fde2=function(_0x5ea70c){while(--_0x5ea70c){_0x410d21['push'](_0x410d21['shift']());}};_0x18fde2(++_0x2092e7);}(_0x7af2,0x119));var _0x27af=function(_0x575d3d,_0x1b92d7){_0x575d3d=_0x575d3d-0x0;var _0x49e231=_0x7af2[_0x575d3d];return _0x49e231;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var moment=require(_0x27af('0x1'));var BPromise=require(_0x27af('0x2'));var rs=require(_0x27af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27af('0x4'))['db'];var utils=require(_0x27af('0x5'));var logger=require(_0x27af('0x6'))(_0x27af('0x7'));var config=require(_0x27af('0x8'));var jayson=require(_0x27af('0x9'));var client=jayson[_0x27af('0xa')][_0x27af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2193c6,_0x572219,_0x1e2509){return new BPromise(function(_0x366868,_0x389e97){return client['request'](_0x2193c6,_0x1e2509)[_0x27af('0xc')](function(_0xfa1882){logger[_0x27af('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x572219,_0x27af('0xe'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x572219,_0x27af('0xe'),JSON['stringify'](_0xfa1882));if(_0xfa1882['error']){if(_0xfa1882[_0x27af('0xf')]['code']===0x1f4){logger[_0x27af('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x572219,_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);return _0x389e97(_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);}logger[_0x27af('0xf')](_0x27af('0x11'),_0x572219,_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);return _0x366868(_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);}else{logger[_0x27af('0xd')](_0x27af('0x11'),_0x572219,_0x27af('0xe'));_0x366868(_0xfa1882[_0x27af('0x12')][_0x27af('0x10')]);}})[_0x27af('0x13')](function(_0x13f8ed){logger[_0x27af('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x572219,_0x13f8ed);_0x389e97(_0x13f8ed);});});}exports[_0x27af('0x14')]=function(_0x31d702){var _0x5997ae=this;return new Promise(function(_0x4e6e2f,_0x20a6d7){return db[_0x27af('0x15')][_0x27af('0x16')]({'raw':_0x31d702[_0x27af('0x17')]?_0x31d702[_0x27af('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x31d702[_0x27af('0x17')]?_0x31d702[_0x27af('0x17')][_0x27af('0x18')]||null:null,'attributes':_0x31d702['options']?_0x31d702[_0x27af('0x17')][_0x27af('0x19')]||null:null,'limit':_0x31d702[_0x27af('0x17')]?_0x31d702['options'][_0x27af('0x1a')]||null:null,'include':_0x31d702[_0x27af('0x17')]?_0x31d702[_0x27af('0x17')][_0x27af('0x1b')]?_[_0x27af('0x1c')](_0x31d702[_0x27af('0x17')][_0x27af('0x1b')],function(_0x35b36d){return{'model':db[_0x35b36d[_0x27af('0x1d')]],'as':_0x35b36d['as'],'attributes':_0x35b36d['attributes'],'include':_0x35b36d['include']?_['map'](_0x35b36d[_0x27af('0x1b')],function(_0x4feaf1){return{'model':db[_0x4feaf1[_0x27af('0x1d')]],'as':_0x4feaf1['as'],'attributes':_0x4feaf1[_0x27af('0x19')],'include':_0x4feaf1['include']?_[_0x27af('0x1c')](_0x4feaf1[_0x27af('0x1b')],function(_0x463e36){return{'model':db[_0x463e36[_0x27af('0x1d')]],'as':_0x463e36['as'],'attributes':_0x463e36[_0x27af('0x19')]};}):[]};}):[]};}):[]:[]})[_0x27af('0xc')](function(_0x775d4e){logger['info'](_0x27af('0x14'),_0x31d702);logger[_0x27af('0x1e')](_0x27af('0x14'),_0x31d702,JSON[_0x27af('0x1f')](_0x775d4e));_0x4e6e2f(_0x775d4e);})[_0x27af('0x13')](function(_0xa08dd9){logger[_0x27af('0xf')](_0x27af('0x14'),_0xa08dd9[_0x27af('0x10')],_0x31d702);_0x20a6d7(_0x5997ae[_0x27af('0xf')](0x1f4,_0xa08dd9[_0x27af('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x15e867){var _0x14b2e7=this;return new Promise(function(_0x3800a1,_0x575887){return db[_0x27af('0x15')][_0x27af('0x20')]({'raw':_0x15e867['options']?_0x15e867['options'][_0x27af('0x21')]===undefined?!![]:![]:!![],'where':_0x15e867[_0x27af('0x17')]?_0x15e867['options'][_0x27af('0x18')]||null:null,'attributes':_0x15e867[_0x27af('0x17')]?_0x15e867[_0x27af('0x17')][_0x27af('0x19')]||null:null,'include':_0x15e867[_0x27af('0x17')]?_0x15e867[_0x27af('0x17')][_0x27af('0x1b')]?_[_0x27af('0x1c')](_0x15e867[_0x27af('0x17')][_0x27af('0x1b')],function(_0x13c97d){return{'model':db[_0x13c97d['model']],'as':_0x13c97d['as'],'attributes':_0x13c97d['attributes'],'include':_0x13c97d[_0x27af('0x1b')]?_[_0x27af('0x1c')](_0x13c97d['include'],function(_0x2dd799){return{'model':db[_0x2dd799[_0x27af('0x1d')]],'as':_0x2dd799['as'],'attributes':_0x2dd799['attributes'],'include':_0x2dd799[_0x27af('0x1b')]?_[_0x27af('0x1c')](_0x2dd799[_0x27af('0x1b')],function(_0x329d06){return{'model':db[_0x329d06[_0x27af('0x1d')]],'as':_0x329d06['as'],'attributes':_0x329d06['attributes']};}):[]};}):[]};}):[]:[]})[_0x27af('0xc')](function(_0x468cea){logger['info']('ShowVtigerAccount',_0x15e867);logger[_0x27af('0x1e')](_0x27af('0x22'),_0x15e867,JSON[_0x27af('0x1f')](_0x468cea));_0x3800a1(_0x468cea);})[_0x27af('0x13')](function(_0x467891){logger[_0x27af('0xf')]('ShowVtigerAccount',_0x467891[_0x27af('0x10')],_0x15e867);_0x575887(_0x14b2e7['error'](0x1f4,_0x467891[_0x27af('0x10')]));});});}; \ No newline at end of file +var _0x0abf=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowVtigerAccount','then','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s'];(function(_0x53e8af,_0x3fade5){var _0x5cbc77=function(_0x59bf9e){while(--_0x59bf9e){_0x53e8af['push'](_0x53e8af['shift']());}};_0x5cbc77(++_0x3fade5);}(_0x0abf,0xe8));var _0xf0ab=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x0abf[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233afe,_0x57ff3b,_0x2c4628){return new BPromise(function(_0x3f7e2b,_0x3ca099){return client[_0xf0ab('0xa')](_0x233afe,_0x2c4628)['then'](function(_0x472508){logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,'request\x20sent');logger['debug'](_0xf0ab('0xd'),_0x57ff3b,'request\x20sent',JSON[_0xf0ab('0xe')](_0x472508));if(_0x472508[_0xf0ab('0xf')]){if(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x10')]===0x1f4){logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')]['message']);return _0x3ca099(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);return _0x3f7e2b(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}else{logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,_0xf0ab('0x12'));_0x3f7e2b(_0x472508[_0xf0ab('0x13')][_0xf0ab('0x11')]);}})[_0xf0ab('0x14')](function(_0x230f40){logger['error'](_0xf0ab('0xc'),_0x57ff3b,_0x230f40);_0x3ca099(_0x230f40);});});}exports[_0xf0ab('0x15')]=function(_0x1803f0){var _0x1ffeb5=this;return new Promise(function(_0x776619,_0xb9a33){return db[_0xf0ab('0x16')][_0xf0ab('0x17')]({'raw':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x19')]===undefined?!![]:![]:!![],'where':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1a')]||null:null,'attributes':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')]['attributes']||null:null,'limit':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1b')]||null:null,'include':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1c')],function(_0x18bb37){return{'model':db[_0x18bb37[_0xf0ab('0x1e')]],'as':_0x18bb37['as'],'attributes':_0x18bb37['attributes'],'include':_0x18bb37['include']?_['map'](_0x18bb37[_0xf0ab('0x1c')],function(_0x4f0caf){return{'model':db[_0x4f0caf[_0xf0ab('0x1e')]],'as':_0x4f0caf['as'],'attributes':_0x4f0caf[_0xf0ab('0x1f')],'include':_0x4f0caf['include']?_[_0xf0ab('0x1d')](_0x4f0caf[_0xf0ab('0x1c')],function(_0x10bf5f){return{'model':db[_0x10bf5f[_0xf0ab('0x1e')]],'as':_0x10bf5f['as'],'attributes':_0x10bf5f[_0xf0ab('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d0da7){logger['info']('GetVtigerAccount',_0x1803f0);logger[_0xf0ab('0x20')](_0xf0ab('0x15'),_0x1803f0,JSON[_0xf0ab('0xe')](_0x2d0da7));_0x776619(_0x2d0da7);})[_0xf0ab('0x14')](function(_0x43476c){logger[_0xf0ab('0xf')](_0xf0ab('0x15'),_0x43476c[_0xf0ab('0x11')],_0x1803f0);_0xb9a33(_0x1ffeb5[_0xf0ab('0xf')](0x1f4,_0x43476c[_0xf0ab('0x11')]));});});};exports[_0xf0ab('0x21')]=function(_0x199753){var _0x58cbe1=this;return new Promise(function(_0x1e1ffb,_0x35973a){return db['VtigerAccount']['find']({'raw':_0x199753[_0xf0ab('0x18')]?_0x199753[_0xf0ab('0x18')][_0xf0ab('0x19')]===undefined?!![]:![]:!![],'where':_0x199753['options']?_0x199753['options'][_0xf0ab('0x1a')]||null:null,'attributes':_0x199753['options']?_0x199753[_0xf0ab('0x18')]['attributes']||null:null,'include':_0x199753[_0xf0ab('0x18')]?_0x199753[_0xf0ab('0x18')]['include']?_['map'](_0x199753[_0xf0ab('0x18')][_0xf0ab('0x1c')],function(_0x2a3fac){return{'model':db[_0x2a3fac[_0xf0ab('0x1e')]],'as':_0x2a3fac['as'],'attributes':_0x2a3fac[_0xf0ab('0x1f')],'include':_0x2a3fac[_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x2a3fac[_0xf0ab('0x1c')],function(_0x2a2f5d){return{'model':db[_0x2a2f5d[_0xf0ab('0x1e')]],'as':_0x2a2f5d['as'],'attributes':_0x2a2f5d[_0xf0ab('0x1f')],'include':_0x2a2f5d[_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x2a2f5d[_0xf0ab('0x1c')],function(_0x5d8443){return{'model':db[_0x5d8443[_0xf0ab('0x1e')]],'as':_0x5d8443['as'],'attributes':_0x5d8443[_0xf0ab('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf0ab('0x22')](function(_0x5c9192){logger[_0xf0ab('0xb')](_0xf0ab('0x21'),_0x199753);logger[_0xf0ab('0x20')]('ShowVtigerAccount',_0x199753,JSON[_0xf0ab('0xe')](_0x5c9192));_0x1e1ffb(_0x5c9192);})['catch'](function(_0xda3971){logger['error'](_0xf0ab('0x21'),_0xda3971[_0xf0ab('0x11')],_0x199753);_0x35973a(_0x58cbe1[_0xf0ab('0xf')](0x1f4,_0xda3971[_0xf0ab('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index cfcae79..23dd3e0 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 _0xbcbd=['put','/:id','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','show','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x8f8842,_0x33cab3){var _0x32e64c=function(_0x18a388){while(--_0x18a388){_0x8f8842['push'](_0x8f8842['shift']());}};_0x32e64c(++_0x33cab3);}(_0xbcbd,0x138));var _0xdbcb=function(_0x265f52,_0x2d59d1){_0x265f52=_0x265f52-0x0;var _0x108c85=_0xbcbd[_0x265f52];return _0x108c85;};'use strict';var multer=require(_0xdbcb('0x0'));var util=require('util');var path=require(_0xdbcb('0x1'));var timeout=require(_0xdbcb('0x2'));var express=require(_0xdbcb('0x3'));var router=express[_0xdbcb('0x4')]();var fs_extra=require(_0xdbcb('0x5'));var auth=require(_0xdbcb('0x6'));var interaction=require(_0xdbcb('0x7'));var config=require(_0xdbcb('0x8'));var controller=require(_0xdbcb('0x9'));router[_0xdbcb('0xa')]('/',auth[_0xdbcb('0xb')](),controller[_0xdbcb('0xc')]);router['get']('/:id',auth[_0xdbcb('0xb')](),controller[_0xdbcb('0xd')]);router[_0xdbcb('0xa')]('/:id/fields',auth[_0xdbcb('0xb')](),controller['getFields']);router[_0xdbcb('0xa')]('/:id/subjects',auth[_0xdbcb('0xb')](),controller[_0xdbcb('0xe')]);router[_0xdbcb('0xa')](_0xdbcb('0xf'),auth['isAuthenticated'](),controller[_0xdbcb('0x10')]);router[_0xdbcb('0x11')]('/',auth[_0xdbcb('0xb')](),controller['create']);router[_0xdbcb('0x12')](_0xdbcb('0x13'),auth[_0xdbcb('0xb')](),controller['update']);router[_0xdbcb('0x14')](_0xdbcb('0x13'),auth[_0xdbcb('0xb')](),controller[_0xdbcb('0x15')]);module['exports']=router; \ No newline at end of file +var _0x5a2b=['/:id/descriptions','getDescriptions','post','put','delete','/:id','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5a2b,0xf8));var _0xb5a2=function(_0x2702cb,_0x2ee131){_0x2702cb=_0x2702cb-0x0;var _0x16da7c=_0x5a2b[_0x2702cb];return _0x16da7c;};'use strict';var multer=require('multer');var util=require(_0xb5a2('0x0'));var path=require('path');var timeout=require(_0xb5a2('0x1'));var express=require(_0xb5a2('0x2'));var router=express[_0xb5a2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb5a2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb5a2('0x5'));var controller=require(_0xb5a2('0x6'));router[_0xb5a2('0x7')]('/',auth[_0xb5a2('0x8')](),controller['index']);router[_0xb5a2('0x7')]('/:id',auth[_0xb5a2('0x8')](),controller[_0xb5a2('0x9')]);router['get'](_0xb5a2('0xa'),auth[_0xb5a2('0x8')](),controller[_0xb5a2('0xb')]);router[_0xb5a2('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xb5a2('0x7')](_0xb5a2('0xc'),auth['isAuthenticated'](),controller[_0xb5a2('0xd')]);router[_0xb5a2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb5a2('0xf')]('/:id',auth[_0xb5a2('0x8')](),controller['update']);router[_0xb5a2('0x10')](_0xb5a2('0x11'),auth[_0xb5a2('0x8')](),controller[_0xb5a2('0x12')]);module[_0xb5a2('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 2974a96..58e3908 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 _0xc934=['STRING'];(function(_0x3d90e9,_0x12bd15){var _0x22b65b=function(_0x41655c){while(--_0x41655c){_0x3d90e9['push'](_0x3d90e9['shift']());}};_0x22b65b(++_0x12bd15);}(_0xc934,0x111));var _0x4c93=function(_0x5b60a3,_0x5e510e){_0x5b60a3=_0x5b60a3-0x0;var _0x210bf8=_0xc934[_0x5b60a3];return _0x210bf8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4c93('0x0')]}}; \ No newline at end of file +var _0x2474=['exports','STRING'];(function(_0x3a4794,_0x95f9e0){var _0x54929f=function(_0x191839){while(--_0x191839){_0x3a4794['push'](_0x3a4794['shift']());}};_0x54929f(++_0x95f9e0);}(_0x2474,0x1ee));var _0x4247=function(_0x3dc359,_0x29709e){_0x3dc359=_0x3dc359-0x0;var _0x4e75cd=_0x2474[_0x3dc359];return _0x4e75cd;};'use strict';var Sequelize=require('sequelize');module[_0x4247('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4247('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index a380e8a..3dbf896 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 _0xc951=['merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','update','body','getFields','findOne','VtigerField','pick','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0xa506c3,_0x504d82){var _0x1bcea8=function(_0x14b914){while(--_0x14b914){_0xa506c3['push'](_0xa506c3['shift']());}};_0x1bcea8(++_0x504d82);}(_0xc951,0x1a3));var _0x1c95=function(_0x2dbcb8,_0xd3b666){_0x2dbcb8=_0x2dbcb8-0x0;var _0x5bcc49=_0xc951[_0x2dbcb8];return _0x5bcc49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c95('0x0'));var zipdir=require(_0x1c95('0x1'));var jsonpatch=require(_0x1c95('0x2'));var rp=require(_0x1c95('0x3'));var moment=require('moment');var BPromise=require(_0x1c95('0x4'));var Mustache=require(_0x1c95('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1c95('0x6'));var ejs=require(_0x1c95('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c95('0x8'));var squel=require(_0x1c95('0x9'));var crypto=require(_0x1c95('0xa'));var jsforce=require(_0x1c95('0xb'));var deskjs=require(_0x1c95('0xc'));var toCsv=require(_0x1c95('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1c95('0xd'));var authService=require(_0x1c95('0xe'));var qs=require(_0x1c95('0xf'));var as=require(_0x1c95('0x10'));var hardwareService=require(_0x1c95('0x11'));var logger=require(_0x1c95('0x12'))(_0x1c95('0x13'));var utils=require(_0x1c95('0x14'));var config=require(_0x1c95('0x15'));var licenseUtil=require(_0x1c95('0x16'));var db=require(_0x1c95('0x17'))['db'];function respondWithStatusCode(_0x41e7b9,_0xc8cc3e){_0xc8cc3e=_0xc8cc3e||0xcc;return function(_0x27831b){if(_0x27831b){return _0x41e7b9[_0x1c95('0x18')](_0xc8cc3e);}return _0x41e7b9[_0x1c95('0x19')](_0xc8cc3e)[_0x1c95('0x1a')]();};}function respondWithResult(_0x56d469,_0x17c8e7){_0x17c8e7=_0x17c8e7||0xc8;return function(_0xb3a944){if(_0xb3a944){return _0x56d469[_0x1c95('0x19')](_0x17c8e7)[_0x1c95('0x1b')](_0xb3a944);}};}function respondWithFilteredResult(_0x4b60ae,_0x58d677){return function(_0x254082){if(_0x254082){var _0x145e66=typeof _0x58d677[_0x1c95('0x1c')]===_0x1c95('0x1d')&&typeof _0x58d677[_0x1c95('0x1e')]==='undefined';var _0x5438bd=_0x254082['count'];var _0x57254c=_0x145e66?0x0:_0x58d677[_0x1c95('0x1c')];var _0x3388c4=_0x145e66?_0x254082[_0x1c95('0x1f')]:_0x58d677[_0x1c95('0x1c')]+_0x58d677[_0x1c95('0x1e')];var _0x13f962;if(_0x3388c4>=_0x5438bd){_0x3388c4=_0x5438bd;_0x13f962=0xc8;}else{_0x13f962=0xce;}_0x4b60ae['status'](_0x13f962);return _0x4b60ae[_0x1c95('0x20')]('Content-Range',_0x57254c+'-'+_0x3388c4+'/'+_0x5438bd)[_0x1c95('0x1b')](_0x254082);}return null;};}function patchUpdates(_0x3a9ea7){return function(_0x53a587){try{jsonpatch[_0x1c95('0x21')](_0x53a587,_0x3a9ea7,!![]);}catch(_0x20dbfe){return BPromise[_0x1c95('0x22')](_0x20dbfe);}return _0x53a587[_0x1c95('0x23')]();};}function saveUpdates(_0x575370,_0x28a9e6){return function(_0x1f3d58){if(_0x1f3d58){return _0x1f3d58['update'](_0x575370)[_0x1c95('0x24')](function(_0x220fa4){return _0x220fa4;});}return null;};}function removeEntity(_0x53587f,_0x3440ef){return function(_0x29b48a){if(_0x29b48a){return _0x29b48a[_0x1c95('0x25')]()['then'](function(){_0x53587f['status'](0xcc)[_0x1c95('0x1a')]();});}};}function handleEntityNotFound(_0x2733f1,_0x2a50b4){return function(_0x4233a8){if(!_0x4233a8){_0x2733f1[_0x1c95('0x18')](0x194);}return _0x4233a8;};}function handleError(_0x1a6de6,_0xabc0de){_0xabc0de=_0xabc0de||0x1f4;return function(_0x2557d3){logger[_0x1c95('0x26')](_0x2557d3[_0x1c95('0x27')]);if(_0x2557d3[_0x1c95('0x28')]){delete _0x2557d3[_0x1c95('0x28')];}_0x1a6de6[_0x1c95('0x19')](_0xabc0de)[_0x1c95('0x29')](_0x2557d3);};}exports[_0x1c95('0x2a')]=function(_0x2a1c5c,_0xe612ca){var _0x461293={},_0x461a9a={},_0x575383={'count':0x0,'rows':[]};var _0x4c7032=_[_0x1c95('0x2b')](db[_0x1c95('0x2c')][_0x1c95('0x2d')],function(_0x3aa179){return{'name':_0x3aa179['fieldName'],'type':_0x3aa179[_0x1c95('0x2e')]['key']};});_0x461a9a[_0x1c95('0x2f')]=_[_0x1c95('0x2b')](_0x4c7032,_0x1c95('0x28'));_0x461a9a['query']=_[_0x1c95('0x30')](_0x2a1c5c[_0x1c95('0x31')]);_0x461a9a[_0x1c95('0x32')]=_['intersection'](_0x461a9a[_0x1c95('0x2f')],_0x461a9a[_0x1c95('0x31')]);_0x461293['attributes']=_[_0x1c95('0x33')](_0x461a9a[_0x1c95('0x2f')],qs[_0x1c95('0x34')](_0x2a1c5c[_0x1c95('0x31')]['fields']));_0x461293['attributes']=_0x461293['attributes'][_0x1c95('0x35')]?_0x461293[_0x1c95('0x36')]:_0x461a9a[_0x1c95('0x2f')];if(!_0x2a1c5c[_0x1c95('0x31')][_0x1c95('0x37')](_0x1c95('0x38'))){_0x461293['limit']=qs[_0x1c95('0x1e')](_0x2a1c5c['query'][_0x1c95('0x1e')]);_0x461293[_0x1c95('0x1c')]=qs[_0x1c95('0x1c')](_0x2a1c5c['query']['offset']);}_0x461293[_0x1c95('0x39')]=qs[_0x1c95('0x3a')](_0x2a1c5c[_0x1c95('0x31')]['sort']);_0x461293[_0x1c95('0x3b')]=qs['filters'](_['pick'](_0x2a1c5c[_0x1c95('0x31')],_0x461a9a['filters']),_0x4c7032);if(_0x2a1c5c[_0x1c95('0x31')][_0x1c95('0x3c')]){_0x461293[_0x1c95('0x3b')]=_[_0x1c95('0x3d')](_0x461293[_0x1c95('0x3b')],{'$or':_['map'](_0x4c7032,function(_0x208fd5){if(_0x208fd5[_0x1c95('0x2e')]!==_0x1c95('0x3e')){var _0x55f8e8={};_0x55f8e8[_0x208fd5[_0x1c95('0x28')]]={'$like':'%'+_0x2a1c5c[_0x1c95('0x31')][_0x1c95('0x3c')]+'%'};return _0x55f8e8;}})});}_0x461293=_['merge']({},_0x461293,_0x2a1c5c[_0x1c95('0x3f')]);var _0x27878e={'where':_0x461293[_0x1c95('0x3b')]};return db[_0x1c95('0x2c')][_0x1c95('0x1f')](_0x27878e)['then'](function(_0x2e9c0b){_0x575383[_0x1c95('0x1f')]=_0x2e9c0b;if(_0x2a1c5c[_0x1c95('0x31')][_0x1c95('0x40')]){_0x461293[_0x1c95('0x41')]=[{'all':!![]}];}return db[_0x1c95('0x2c')]['findAll'](_0x461293);})[_0x1c95('0x24')](function(_0x50cd1c){_0x575383[_0x1c95('0x42')]=_0x50cd1c;return _0x575383;})[_0x1c95('0x24')](respondWithFilteredResult(_0xe612ca,_0x461293))[_0x1c95('0x43')](handleError(_0xe612ca,null));};exports[_0x1c95('0x44')]=function(_0x4cc316,_0x4324b8){var _0x1ef270={'raw':![],'where':{'id':_0x4cc316[_0x1c95('0x45')]['id']}},_0x826ad1={};_0x826ad1[_0x1c95('0x2f')]=_[_0x1c95('0x30')](db[_0x1c95('0x2c')]['rawAttributes']);_0x826ad1[_0x1c95('0x31')]=_[_0x1c95('0x30')](_0x4cc316['query']);_0x826ad1[_0x1c95('0x32')]=_['intersection'](_0x826ad1[_0x1c95('0x2f')],_0x826ad1['query']);_0x1ef270[_0x1c95('0x36')]=_[_0x1c95('0x33')](_0x826ad1[_0x1c95('0x2f')],qs[_0x1c95('0x34')](_0x4cc316[_0x1c95('0x31')][_0x1c95('0x34')]));_0x1ef270[_0x1c95('0x36')]=_0x1ef270[_0x1c95('0x36')][_0x1c95('0x35')]?_0x1ef270[_0x1c95('0x36')]:_0x826ad1['model'];if(_0x4cc316['query'][_0x1c95('0x40')]){_0x1ef270['include']=[{'all':!![]}];}_0x1ef270=_[_0x1c95('0x3d')]({},_0x1ef270,_0x4cc316[_0x1c95('0x3f')]);return db['VtigerConfiguration'][_0x1c95('0x46')](_0x1ef270)[_0x1c95('0x24')](handleEntityNotFound(_0x4324b8,null))[_0x1c95('0x24')](respondWithResult(_0x4324b8,null))[_0x1c95('0x43')](handleError(_0x4324b8,null));};exports[_0x1c95('0x47')]=function(_0x410fed,_0x2ce031){return db[_0x1c95('0x2c')]['create'](_0x410fed['body'],{})[_0x1c95('0x24')](respondWithResult(_0x2ce031,0xc9))[_0x1c95('0x43')](handleError(_0x2ce031,null));};exports[_0x1c95('0x48')]=function(_0x5e8acb,_0x2ff37f){if(_0x5e8acb['body']['id']){delete _0x5e8acb[_0x1c95('0x49')]['id'];}return db['VtigerConfiguration'][_0x1c95('0x46')]({'where':{'id':_0x5e8acb[_0x1c95('0x45')]['id']}})['then'](handleEntityNotFound(_0x2ff37f,null))[_0x1c95('0x24')](saveUpdates(_0x5e8acb[_0x1c95('0x49')],null))['then'](respondWithResult(_0x2ff37f,null))[_0x1c95('0x43')](handleError(_0x2ff37f,null));};exports[_0x1c95('0x25')]=function(_0x1374bd,_0x28d03f){return db[_0x1c95('0x2c')]['find']({'where':{'id':_0x1374bd[_0x1c95('0x45')]['id']}})[_0x1c95('0x24')](handleEntityNotFound(_0x28d03f,null))[_0x1c95('0x24')](removeEntity(_0x28d03f,null))[_0x1c95('0x43')](handleError(_0x28d03f,null));};exports[_0x1c95('0x4a')]=function(_0x45488c,_0x3d8eae,_0x46a89c){var _0x586ab1={};var _0xa501b9={};var _0x1a5bd5;var _0x1d911e;return db[_0x1c95('0x2c')][_0x1c95('0x4b')]({'where':{'id':_0x45488c[_0x1c95('0x45')]['id']}})[_0x1c95('0x24')](handleEntityNotFound(_0x3d8eae,null))[_0x1c95('0x24')](function(_0x56cd36){if(_0x56cd36){_0x1a5bd5=_0x56cd36;_0xa501b9[_0x1c95('0x2f')]=_['keys'](db[_0x1c95('0x4c')]['rawAttributes']);_0xa501b9[_0x1c95('0x31')]=_[_0x1c95('0x30')](_0x45488c['query']);_0xa501b9[_0x1c95('0x32')]=_[_0x1c95('0x33')](_0xa501b9['model'],_0xa501b9[_0x1c95('0x31')]);_0x586ab1[_0x1c95('0x36')]=_[_0x1c95('0x33')](_0xa501b9[_0x1c95('0x2f')],qs[_0x1c95('0x34')](_0x45488c[_0x1c95('0x31')][_0x1c95('0x34')]));_0x586ab1[_0x1c95('0x36')]=_0x586ab1[_0x1c95('0x36')][_0x1c95('0x35')]?_0x586ab1[_0x1c95('0x36')]:_0xa501b9[_0x1c95('0x2f')];_0x586ab1['order']=qs['sort'](_0x45488c[_0x1c95('0x31')]['sort']);_0x586ab1[_0x1c95('0x3b')]=qs['filters'](_[_0x1c95('0x4d')](_0x45488c[_0x1c95('0x31')],_0xa501b9[_0x1c95('0x32')]));if(_0x45488c[_0x1c95('0x31')][_0x1c95('0x3c')]){_0x586ab1['where']=_[_0x1c95('0x3d')](_0x586ab1[_0x1c95('0x3b')],{'$or':_[_0x1c95('0x2b')](_0x586ab1[_0x1c95('0x36')],function(_0x295c18){var _0x5ed176={};_0x5ed176[_0x295c18]={'$like':'%'+_0x45488c[_0x1c95('0x31')]['filter']+'%'};return _0x5ed176;})});}_0x586ab1=_['merge']({},_0x586ab1,_0x45488c[_0x1c95('0x3f')]);return _0x1a5bd5[_0x1c95('0x4a')](_0x586ab1);}})['then'](function(_0xec7793){if(_0xec7793){_0x1d911e=_0xec7793[_0x1c95('0x35')];if(!_0x45488c[_0x1c95('0x31')][_0x1c95('0x37')]('nolimit')){_0x586ab1[_0x1c95('0x1e')]=qs['limit'](_0x45488c[_0x1c95('0x31')]['limit']);_0x586ab1[_0x1c95('0x1c')]=qs['offset'](_0x45488c[_0x1c95('0x31')][_0x1c95('0x1c')]);}return _0x1a5bd5['getFields'](_0x586ab1);}})['then'](function(_0x13b375){if(_0x13b375){return _0x13b375?{'count':_0x1d911e,'rows':_0x13b375}:null;}})[_0x1c95('0x24')](respondWithResult(_0x3d8eae,null))[_0x1c95('0x43')](handleError(_0x3d8eae,null));};exports['getSubjects']=function(_0x3a98fd,_0x218132,_0xafa41b){var _0x569c2c={};var _0x345c83={};var _0x3663f0;var _0x520ae3;return db[_0x1c95('0x2c')]['findOne']({'where':{'id':_0x3a98fd['params']['id']}})[_0x1c95('0x24')](handleEntityNotFound(_0x218132,null))['then'](function(_0x14f888){if(_0x14f888){_0x3663f0=_0x14f888;_0x345c83[_0x1c95('0x2f')]=_['keys'](db['VtigerField'][_0x1c95('0x2d')]);_0x345c83[_0x1c95('0x31')]=_[_0x1c95('0x30')](_0x3a98fd[_0x1c95('0x31')]);_0x345c83['filters']=_[_0x1c95('0x33')](_0x345c83['model'],_0x345c83[_0x1c95('0x31')]);_0x569c2c[_0x1c95('0x36')]=_['intersection'](_0x345c83[_0x1c95('0x2f')],qs[_0x1c95('0x34')](_0x3a98fd[_0x1c95('0x31')][_0x1c95('0x34')]));_0x569c2c[_0x1c95('0x36')]=_0x569c2c[_0x1c95('0x36')][_0x1c95('0x35')]?_0x569c2c['attributes']:_0x345c83[_0x1c95('0x2f')];_0x569c2c[_0x1c95('0x39')]=qs['sort'](_0x3a98fd[_0x1c95('0x31')][_0x1c95('0x3a')]);_0x569c2c[_0x1c95('0x3b')]=qs['filters'](_[_0x1c95('0x4d')](_0x3a98fd[_0x1c95('0x31')],_0x345c83[_0x1c95('0x32')]));if(_0x3a98fd['query'][_0x1c95('0x3c')]){_0x569c2c[_0x1c95('0x3b')]=_[_0x1c95('0x3d')](_0x569c2c[_0x1c95('0x3b')],{'$or':_[_0x1c95('0x2b')](_0x569c2c[_0x1c95('0x36')],function(_0x19e690){var _0x2c2372={};_0x2c2372[_0x19e690]={'$like':'%'+_0x3a98fd[_0x1c95('0x31')][_0x1c95('0x3c')]+'%'};return _0x2c2372;})});}_0x569c2c=_[_0x1c95('0x3d')]({},_0x569c2c,_0x3a98fd[_0x1c95('0x3f')]);return _0x3663f0['getSubjects'](_0x569c2c);}})['then'](function(_0x4f034b){if(_0x4f034b){_0x520ae3=_0x4f034b[_0x1c95('0x35')];if(!_0x3a98fd['query'][_0x1c95('0x37')](_0x1c95('0x38'))){_0x569c2c[_0x1c95('0x1e')]=qs[_0x1c95('0x1e')](_0x3a98fd[_0x1c95('0x31')][_0x1c95('0x1e')]);_0x569c2c[_0x1c95('0x1c')]=qs[_0x1c95('0x1c')](_0x3a98fd[_0x1c95('0x31')][_0x1c95('0x1c')]);}return _0x3663f0[_0x1c95('0x4e')](_0x569c2c);}})[_0x1c95('0x24')](function(_0x46e8de){if(_0x46e8de){return _0x46e8de?{'count':_0x520ae3,'rows':_0x46e8de}:null;}})[_0x1c95('0x24')](respondWithResult(_0x218132,null))[_0x1c95('0x43')](handleError(_0x218132,null));};exports[_0x1c95('0x4f')]=function(_0xe08b5e,_0x1411f4,_0x31092b){var _0x28a43a={};var _0x4fa05a={};var _0x2a657a;var _0xd6e707;return db[_0x1c95('0x2c')][_0x1c95('0x4b')]({'where':{'id':_0xe08b5e[_0x1c95('0x45')]['id']}})[_0x1c95('0x24')](handleEntityNotFound(_0x1411f4,null))[_0x1c95('0x24')](function(_0x44377b){if(_0x44377b){_0x2a657a=_0x44377b;_0x4fa05a[_0x1c95('0x2f')]=_[_0x1c95('0x30')](db[_0x1c95('0x4c')]['rawAttributes']);_0x4fa05a['query']=_[_0x1c95('0x30')](_0xe08b5e['query']);_0x4fa05a[_0x1c95('0x32')]=_['intersection'](_0x4fa05a['model'],_0x4fa05a[_0x1c95('0x31')]);_0x28a43a[_0x1c95('0x36')]=_['intersection'](_0x4fa05a[_0x1c95('0x2f')],qs['fields'](_0xe08b5e[_0x1c95('0x31')][_0x1c95('0x34')]));_0x28a43a[_0x1c95('0x36')]=_0x28a43a[_0x1c95('0x36')][_0x1c95('0x35')]?_0x28a43a[_0x1c95('0x36')]:_0x4fa05a['model'];_0x28a43a[_0x1c95('0x39')]=qs[_0x1c95('0x3a')](_0xe08b5e[_0x1c95('0x31')]['sort']);_0x28a43a[_0x1c95('0x3b')]=qs['filters'](_[_0x1c95('0x4d')](_0xe08b5e['query'],_0x4fa05a[_0x1c95('0x32')]));if(_0xe08b5e['query'][_0x1c95('0x3c')]){_0x28a43a['where']=_[_0x1c95('0x3d')](_0x28a43a[_0x1c95('0x3b')],{'$or':_[_0x1c95('0x2b')](_0x28a43a[_0x1c95('0x36')],function(_0x5bcef1){var _0x39652d={};_0x39652d[_0x5bcef1]={'$like':'%'+_0xe08b5e[_0x1c95('0x31')][_0x1c95('0x3c')]+'%'};return _0x39652d;})});}_0x28a43a=_[_0x1c95('0x3d')]({},_0x28a43a,_0xe08b5e[_0x1c95('0x3f')]);return _0x2a657a[_0x1c95('0x4f')](_0x28a43a);}})[_0x1c95('0x24')](function(_0x25914a){if(_0x25914a){_0xd6e707=_0x25914a[_0x1c95('0x35')];if(!_0xe08b5e[_0x1c95('0x31')][_0x1c95('0x37')](_0x1c95('0x38'))){_0x28a43a[_0x1c95('0x1e')]=qs[_0x1c95('0x1e')](_0xe08b5e[_0x1c95('0x31')][_0x1c95('0x1e')]);_0x28a43a[_0x1c95('0x1c')]=qs[_0x1c95('0x1c')](_0xe08b5e[_0x1c95('0x31')][_0x1c95('0x1c')]);}return _0x2a657a['getDescriptions'](_0x28a43a);}})[_0x1c95('0x24')](function(_0x2e0cb){if(_0x2e0cb){return _0x2e0cb?{'count':_0xd6e707,'rows':_0x2e0cb}:null;}})['then'](respondWithResult(_0x1411f4,null))[_0x1c95('0x43')](handleError(_0x1411f4,null));}; \ No newline at end of file +var _0x6719=['findOne','hasOwnProperty','getSubjects','VtigerField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','destroy','name','send','index','map','VtigerConfiguration','type','query','keys','intersection','attributes','model','fields','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','show','rawAttributes','length','includeAll','find','catch','create','body','params','getFields'];(function(_0x1621d8,_0x4756bf){var _0x6883c7=function(_0x3ed06c){while(--_0x3ed06c){_0x1621d8['push'](_0x1621d8['shift']());}};_0x6883c7(++_0x4756bf);}(_0x6719,0x139));var _0x9671=function(_0xb0c152,_0x1d37a9){_0xb0c152=_0xb0c152-0x0;var _0x2fc458=_0x6719[_0xb0c152];return _0x2fc458;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9671('0x0'));var zipdir=require(_0x9671('0x1'));var jsonpatch=require(_0x9671('0x2'));var rp=require(_0x9671('0x3'));var moment=require(_0x9671('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9671('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9671('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9671('0x7'));var _=require(_0x9671('0x8'));var squel=require(_0x9671('0x9'));var crypto=require(_0x9671('0xa'));var jsforce=require(_0x9671('0xb'));var deskjs=require(_0x9671('0xc'));var toCsv=require(_0x9671('0x6'));var querystring=require(_0x9671('0xd'));var Papa=require(_0x9671('0xe'));var Redis=require(_0x9671('0xf'));var authService=require(_0x9671('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9671('0x11'));var hardwareService=require(_0x9671('0x12'));var logger=require(_0x9671('0x13'))(_0x9671('0x14'));var utils=require(_0x9671('0x15'));var config=require(_0x9671('0x16'));var licenseUtil=require(_0x9671('0x17'));var db=require(_0x9671('0x18'))['db'];function respondWithStatusCode(_0x4fd91b,_0xd91700){_0xd91700=_0xd91700||0xcc;return function(_0x5ed7f3){if(_0x5ed7f3){return _0x4fd91b[_0x9671('0x19')](_0xd91700);}return _0x4fd91b[_0x9671('0x1a')](_0xd91700)[_0x9671('0x1b')]();};}function respondWithResult(_0x35a86b,_0x285dc0){_0x285dc0=_0x285dc0||0xc8;return function(_0x10fd9d){if(_0x10fd9d){return _0x35a86b[_0x9671('0x1a')](_0x285dc0)[_0x9671('0x1c')](_0x10fd9d);}};}function respondWithFilteredResult(_0x843045,_0xcd2b35){return function(_0x2c5da7){if(_0x2c5da7){var _0x3c552c=typeof _0xcd2b35['offset']==='undefined'&&typeof _0xcd2b35[_0x9671('0x1d')]===_0x9671('0x1e');var _0x20a4d0=_0x2c5da7[_0x9671('0x1f')];var _0x2e94b8=_0x3c552c?0x0:_0xcd2b35[_0x9671('0x20')];var _0x51c1c2=_0x3c552c?_0x2c5da7[_0x9671('0x1f')]:_0xcd2b35[_0x9671('0x20')]+_0xcd2b35['limit'];var _0xc78244;if(_0x51c1c2>=_0x20a4d0){_0x51c1c2=_0x20a4d0;_0xc78244=0xc8;}else{_0xc78244=0xce;}_0x843045['status'](_0xc78244);return _0x843045[_0x9671('0x21')](_0x9671('0x22'),_0x2e94b8+'-'+_0x51c1c2+'/'+_0x20a4d0)[_0x9671('0x1c')](_0x2c5da7);}return null;};}function patchUpdates(_0x1c57ac){return function(_0x9196d9){try{jsonpatch[_0x9671('0x23')](_0x9196d9,_0x1c57ac,!![]);}catch(_0x4864c3){return BPromise[_0x9671('0x24')](_0x4864c3);}return _0x9196d9['save']();};}function saveUpdates(_0x20af1f,_0x59c964){return function(_0x8a17f2){if(_0x8a17f2){return _0x8a17f2['update'](_0x20af1f)[_0x9671('0x25')](function(_0x58d389){return _0x58d389;});}return null;};}function removeEntity(_0x1a4c0a,_0x4bfce2){return function(_0x15bf58){if(_0x15bf58){return _0x15bf58[_0x9671('0x26')]()[_0x9671('0x25')](function(){_0x1a4c0a['status'](0xcc)[_0x9671('0x1b')]();});}};}function handleEntityNotFound(_0x598e42,_0x4024b5){return function(_0x515c62){if(!_0x515c62){_0x598e42[_0x9671('0x19')](0x194);}return _0x515c62;};}function handleError(_0x45633a,_0x146127){_0x146127=_0x146127||0x1f4;return function(_0x3d10fb){logger['error'](_0x3d10fb['stack']);if(_0x3d10fb[_0x9671('0x27')]){delete _0x3d10fb[_0x9671('0x27')];}_0x45633a[_0x9671('0x1a')](_0x146127)[_0x9671('0x28')](_0x3d10fb);};}exports[_0x9671('0x29')]=function(_0x40c82c,_0x56a5f2){var _0x341f94={},_0x19f30d={},_0x27eb0c={'count':0x0,'rows':[]};var _0x5d7957=_[_0x9671('0x2a')](db[_0x9671('0x2b')]['rawAttributes'],function(_0x3395c4){return{'name':_0x3395c4['fieldName'],'type':_0x3395c4[_0x9671('0x2c')]['key']};});_0x19f30d['model']=_['map'](_0x5d7957,_0x9671('0x27'));_0x19f30d[_0x9671('0x2d')]=_[_0x9671('0x2e')](_0x40c82c[_0x9671('0x2d')]);_0x19f30d['filters']=_[_0x9671('0x2f')](_0x19f30d['model'],_0x19f30d[_0x9671('0x2d')]);_0x341f94[_0x9671('0x30')]=_[_0x9671('0x2f')](_0x19f30d[_0x9671('0x31')],qs['fields'](_0x40c82c[_0x9671('0x2d')][_0x9671('0x32')]));_0x341f94[_0x9671('0x30')]=_0x341f94[_0x9671('0x30')]['length']?_0x341f94[_0x9671('0x30')]:_0x19f30d[_0x9671('0x31')];if(!_0x40c82c[_0x9671('0x2d')]['hasOwnProperty'](_0x9671('0x33'))){_0x341f94[_0x9671('0x1d')]=qs[_0x9671('0x1d')](_0x40c82c[_0x9671('0x2d')][_0x9671('0x1d')]);_0x341f94[_0x9671('0x20')]=qs[_0x9671('0x20')](_0x40c82c[_0x9671('0x2d')][_0x9671('0x20')]);}_0x341f94[_0x9671('0x34')]=qs[_0x9671('0x35')](_0x40c82c[_0x9671('0x2d')][_0x9671('0x35')]);_0x341f94[_0x9671('0x36')]=qs[_0x9671('0x37')](_[_0x9671('0x38')](_0x40c82c['query'],_0x19f30d[_0x9671('0x37')]),_0x5d7957);if(_0x40c82c['query'][_0x9671('0x39')]){_0x341f94['where']=_['merge'](_0x341f94[_0x9671('0x36')],{'$or':_[_0x9671('0x2a')](_0x5d7957,function(_0x2c752f){if(_0x2c752f[_0x9671('0x2c')]!==_0x9671('0x3a')){var _0xa5ed54={};_0xa5ed54[_0x2c752f[_0x9671('0x27')]]={'$like':'%'+_0x40c82c[_0x9671('0x2d')][_0x9671('0x39')]+'%'};return _0xa5ed54;}})});}_0x341f94=_[_0x9671('0x3b')]({},_0x341f94,_0x40c82c[_0x9671('0x3c')]);var _0x79b82a={'where':_0x341f94[_0x9671('0x36')]};return db[_0x9671('0x2b')][_0x9671('0x1f')](_0x79b82a)[_0x9671('0x25')](function(_0x161fc9){_0x27eb0c[_0x9671('0x1f')]=_0x161fc9;if(_0x40c82c[_0x9671('0x2d')]['includeAll']){_0x341f94[_0x9671('0x3d')]=[{'all':!![]}];}return db[_0x9671('0x2b')]['findAll'](_0x341f94);})[_0x9671('0x25')](function(_0x5b1901){_0x27eb0c['rows']=_0x5b1901;return _0x27eb0c;})[_0x9671('0x25')](respondWithFilteredResult(_0x56a5f2,_0x341f94))['catch'](handleError(_0x56a5f2,null));};exports[_0x9671('0x3e')]=function(_0x1782c7,_0x1c0399){var _0x1fadaf={'raw':![],'where':{'id':_0x1782c7['params']['id']}},_0x34078e={};_0x34078e[_0x9671('0x31')]=_[_0x9671('0x2e')](db[_0x9671('0x2b')][_0x9671('0x3f')]);_0x34078e[_0x9671('0x2d')]=_['keys'](_0x1782c7[_0x9671('0x2d')]);_0x34078e[_0x9671('0x37')]=_['intersection'](_0x34078e[_0x9671('0x31')],_0x34078e[_0x9671('0x2d')]);_0x1fadaf['attributes']=_['intersection'](_0x34078e[_0x9671('0x31')],qs[_0x9671('0x32')](_0x1782c7[_0x9671('0x2d')]['fields']));_0x1fadaf[_0x9671('0x30')]=_0x1fadaf[_0x9671('0x30')][_0x9671('0x40')]?_0x1fadaf[_0x9671('0x30')]:_0x34078e['model'];if(_0x1782c7['query'][_0x9671('0x41')]){_0x1fadaf['include']=[{'all':!![]}];}_0x1fadaf=_[_0x9671('0x3b')]({},_0x1fadaf,_0x1782c7[_0x9671('0x3c')]);return db[_0x9671('0x2b')][_0x9671('0x42')](_0x1fadaf)[_0x9671('0x25')](handleEntityNotFound(_0x1c0399,null))[_0x9671('0x25')](respondWithResult(_0x1c0399,null))[_0x9671('0x43')](handleError(_0x1c0399,null));};exports[_0x9671('0x44')]=function(_0xec2656,_0x46c285){return db[_0x9671('0x2b')]['create'](_0xec2656[_0x9671('0x45')],{})[_0x9671('0x25')](respondWithResult(_0x46c285,0xc9))[_0x9671('0x43')](handleError(_0x46c285,null));};exports['update']=function(_0x194241,_0x585dc9){if(_0x194241[_0x9671('0x45')]['id']){delete _0x194241[_0x9671('0x45')]['id'];}return db['VtigerConfiguration'][_0x9671('0x42')]({'where':{'id':_0x194241[_0x9671('0x46')]['id']}})[_0x9671('0x25')](handleEntityNotFound(_0x585dc9,null))[_0x9671('0x25')](saveUpdates(_0x194241[_0x9671('0x45')],null))['then'](respondWithResult(_0x585dc9,null))[_0x9671('0x43')](handleError(_0x585dc9,null));};exports['destroy']=function(_0xfcd491,_0xb8f9ea){return db[_0x9671('0x2b')][_0x9671('0x42')]({'where':{'id':_0xfcd491[_0x9671('0x46')]['id']}})[_0x9671('0x25')](handleEntityNotFound(_0xb8f9ea,null))[_0x9671('0x25')](removeEntity(_0xb8f9ea,null))[_0x9671('0x43')](handleError(_0xb8f9ea,null));};exports[_0x9671('0x47')]=function(_0x3a8e7a,_0x40f359,_0x1c9ae9){var _0x5e763a={};var _0x2e9fb2={};var _0x3b4759;var _0x5a90a0;return db['VtigerConfiguration'][_0x9671('0x48')]({'where':{'id':_0x3a8e7a[_0x9671('0x46')]['id']}})[_0x9671('0x25')](handleEntityNotFound(_0x40f359,null))['then'](function(_0x5e581a){if(_0x5e581a){_0x3b4759=_0x5e581a;_0x2e9fb2[_0x9671('0x31')]=_[_0x9671('0x2e')](db['VtigerField']['rawAttributes']);_0x2e9fb2[_0x9671('0x2d')]=_['keys'](_0x3a8e7a['query']);_0x2e9fb2['filters']=_['intersection'](_0x2e9fb2['model'],_0x2e9fb2[_0x9671('0x2d')]);_0x5e763a[_0x9671('0x30')]=_['intersection'](_0x2e9fb2[_0x9671('0x31')],qs['fields'](_0x3a8e7a[_0x9671('0x2d')][_0x9671('0x32')]));_0x5e763a['attributes']=_0x5e763a[_0x9671('0x30')][_0x9671('0x40')]?_0x5e763a[_0x9671('0x30')]:_0x2e9fb2[_0x9671('0x31')];_0x5e763a[_0x9671('0x34')]=qs[_0x9671('0x35')](_0x3a8e7a[_0x9671('0x2d')][_0x9671('0x35')]);_0x5e763a['where']=qs[_0x9671('0x37')](_[_0x9671('0x38')](_0x3a8e7a[_0x9671('0x2d')],_0x2e9fb2[_0x9671('0x37')]));if(_0x3a8e7a[_0x9671('0x2d')]['filter']){_0x5e763a[_0x9671('0x36')]=_['merge'](_0x5e763a[_0x9671('0x36')],{'$or':_[_0x9671('0x2a')](_0x5e763a[_0x9671('0x30')],function(_0x4bf3a5){var _0x1f294c={};_0x1f294c[_0x4bf3a5]={'$like':'%'+_0x3a8e7a[_0x9671('0x2d')]['filter']+'%'};return _0x1f294c;})});}_0x5e763a=_['merge']({},_0x5e763a,_0x3a8e7a[_0x9671('0x3c')]);return _0x3b4759[_0x9671('0x47')](_0x5e763a);}})[_0x9671('0x25')](function(_0xd21bf8){if(_0xd21bf8){_0x5a90a0=_0xd21bf8[_0x9671('0x40')];if(!_0x3a8e7a[_0x9671('0x2d')][_0x9671('0x49')]('nolimit')){_0x5e763a['limit']=qs[_0x9671('0x1d')](_0x3a8e7a[_0x9671('0x2d')][_0x9671('0x1d')]);_0x5e763a['offset']=qs[_0x9671('0x20')](_0x3a8e7a[_0x9671('0x2d')]['offset']);}return _0x3b4759[_0x9671('0x47')](_0x5e763a);}})[_0x9671('0x25')](function(_0x643895){if(_0x643895){return _0x643895?{'count':_0x5a90a0,'rows':_0x643895}:null;}})['then'](respondWithResult(_0x40f359,null))[_0x9671('0x43')](handleError(_0x40f359,null));};exports[_0x9671('0x4a')]=function(_0x29d515,_0x32ed10,_0x52c760){var _0x5bfe7c={};var _0x53c8a7={};var _0x23fc46;var _0x552759;return db['VtigerConfiguration'][_0x9671('0x48')]({'where':{'id':_0x29d515['params']['id']}})[_0x9671('0x25')](handleEntityNotFound(_0x32ed10,null))[_0x9671('0x25')](function(_0x367a57){if(_0x367a57){_0x23fc46=_0x367a57;_0x53c8a7[_0x9671('0x31')]=_[_0x9671('0x2e')](db[_0x9671('0x4b')]['rawAttributes']);_0x53c8a7['query']=_[_0x9671('0x2e')](_0x29d515['query']);_0x53c8a7['filters']=_['intersection'](_0x53c8a7[_0x9671('0x31')],_0x53c8a7[_0x9671('0x2d')]);_0x5bfe7c['attributes']=_[_0x9671('0x2f')](_0x53c8a7[_0x9671('0x31')],qs[_0x9671('0x32')](_0x29d515[_0x9671('0x2d')][_0x9671('0x32')]));_0x5bfe7c['attributes']=_0x5bfe7c[_0x9671('0x30')][_0x9671('0x40')]?_0x5bfe7c[_0x9671('0x30')]:_0x53c8a7[_0x9671('0x31')];_0x5bfe7c['order']=qs[_0x9671('0x35')](_0x29d515['query'][_0x9671('0x35')]);_0x5bfe7c['where']=qs[_0x9671('0x37')](_[_0x9671('0x38')](_0x29d515['query'],_0x53c8a7[_0x9671('0x37')]));if(_0x29d515[_0x9671('0x2d')][_0x9671('0x39')]){_0x5bfe7c[_0x9671('0x36')]=_[_0x9671('0x3b')](_0x5bfe7c[_0x9671('0x36')],{'$or':_[_0x9671('0x2a')](_0x5bfe7c[_0x9671('0x30')],function(_0x5d8868){var _0x3e0bc8={};_0x3e0bc8[_0x5d8868]={'$like':'%'+_0x29d515[_0x9671('0x2d')][_0x9671('0x39')]+'%'};return _0x3e0bc8;})});}_0x5bfe7c=_[_0x9671('0x3b')]({},_0x5bfe7c,_0x29d515[_0x9671('0x3c')]);return _0x23fc46[_0x9671('0x4a')](_0x5bfe7c);}})[_0x9671('0x25')](function(_0x1ef0e8){if(_0x1ef0e8){_0x552759=_0x1ef0e8[_0x9671('0x40')];if(!_0x29d515[_0x9671('0x2d')][_0x9671('0x49')](_0x9671('0x33'))){_0x5bfe7c['limit']=qs['limit'](_0x29d515['query'][_0x9671('0x1d')]);_0x5bfe7c[_0x9671('0x20')]=qs[_0x9671('0x20')](_0x29d515[_0x9671('0x2d')][_0x9671('0x20')]);}return _0x23fc46[_0x9671('0x4a')](_0x5bfe7c);}})[_0x9671('0x25')](function(_0x157c88){if(_0x157c88){return _0x157c88?{'count':_0x552759,'rows':_0x157c88}:null;}})[_0x9671('0x25')](respondWithResult(_0x32ed10,null))[_0x9671('0x43')](handleError(_0x32ed10,null));};exports['getDescriptions']=function(_0x22b021,_0x4c8be6,_0x417f63){var _0xff29e3={};var _0x1f5bc9={};var _0x2cd1b3;var _0x4c58c3;return db[_0x9671('0x2b')]['findOne']({'where':{'id':_0x22b021[_0x9671('0x46')]['id']}})[_0x9671('0x25')](handleEntityNotFound(_0x4c8be6,null))[_0x9671('0x25')](function(_0x3bc763){if(_0x3bc763){_0x2cd1b3=_0x3bc763;_0x1f5bc9[_0x9671('0x31')]=_[_0x9671('0x2e')](db[_0x9671('0x4b')][_0x9671('0x3f')]);_0x1f5bc9[_0x9671('0x2d')]=_['keys'](_0x22b021['query']);_0x1f5bc9[_0x9671('0x37')]=_[_0x9671('0x2f')](_0x1f5bc9[_0x9671('0x31')],_0x1f5bc9[_0x9671('0x2d')]);_0xff29e3[_0x9671('0x30')]=_['intersection'](_0x1f5bc9[_0x9671('0x31')],qs[_0x9671('0x32')](_0x22b021[_0x9671('0x2d')][_0x9671('0x32')]));_0xff29e3[_0x9671('0x30')]=_0xff29e3[_0x9671('0x30')][_0x9671('0x40')]?_0xff29e3['attributes']:_0x1f5bc9['model'];_0xff29e3[_0x9671('0x34')]=qs[_0x9671('0x35')](_0x22b021[_0x9671('0x2d')][_0x9671('0x35')]);_0xff29e3[_0x9671('0x36')]=qs[_0x9671('0x37')](_[_0x9671('0x38')](_0x22b021[_0x9671('0x2d')],_0x1f5bc9[_0x9671('0x37')]));if(_0x22b021[_0x9671('0x2d')][_0x9671('0x39')]){_0xff29e3['where']=_['merge'](_0xff29e3[_0x9671('0x36')],{'$or':_[_0x9671('0x2a')](_0xff29e3[_0x9671('0x30')],function(_0xe6275c){var _0x5232e5={};_0x5232e5[_0xe6275c]={'$like':'%'+_0x22b021[_0x9671('0x2d')][_0x9671('0x39')]+'%'};return _0x5232e5;})});}_0xff29e3=_[_0x9671('0x3b')]({},_0xff29e3,_0x22b021[_0x9671('0x3c')]);return _0x2cd1b3['getDescriptions'](_0xff29e3);}})[_0x9671('0x25')](function(_0x2c1725){if(_0x2c1725){_0x4c58c3=_0x2c1725['length'];if(!_0x22b021[_0x9671('0x2d')]['hasOwnProperty'](_0x9671('0x33'))){_0xff29e3[_0x9671('0x1d')]=qs['limit'](_0x22b021[_0x9671('0x2d')][_0x9671('0x1d')]);_0xff29e3[_0x9671('0x20')]=qs[_0x9671('0x20')](_0x22b021[_0x9671('0x2d')][_0x9671('0x20')]);}return _0x2cd1b3[_0x9671('0x4c')](_0xff29e3);}})['then'](function(_0x39644a){if(_0x39644a){return _0x39644a?{'count':_0x4c58c3,'rows':_0x39644a}:null;}})[_0x9671('0x25')](respondWithResult(_0x4c8be6,null))[_0x9671('0x43')](handleError(_0x4c8be6,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index e0123de..2762e7f 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 _0xc381=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x7d4593,_0xd66d60){var _0x440c23=function(_0x2d83a4){while(--_0x2d83a4){_0x7d4593['push'](_0x7d4593['shift']());}};_0x440c23(++_0xd66d60);}(_0xc381,0x12a));var _0x1c38=function(_0x5661f1,_0x5db14c){_0x5661f1=_0x5661f1-0x0;var _0x3d740=_0xc381[_0x5661f1];return _0x3d740;};'use strict';var _=require(_0x1c38('0x0'));var util=require(_0x1c38('0x1'));var logger=require(_0x1c38('0x2'))(_0x1c38('0x3'));var moment=require(_0x1c38('0x4'));var BPromise=require(_0x1c38('0x5'));var rp=require(_0x1c38('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c38('0x7'));var config=require(_0x1c38('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x1c38('0x9')]=function(_0x35f665,_0xd25de2){return _0x35f665[_0x1c38('0xa')](_0x1c38('0xb'),attributes,{'tableName':_0x1c38('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda68=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','VtigerConfiguration','int_vtiger_configurations'];(function(_0x4c19a1,_0x15197f){var _0x58ac50=function(_0x7c08c1){while(--_0x7c08c1){_0x4c19a1['push'](_0x4c19a1['shift']());}};_0x58ac50(++_0x15197f);}(_0xda68,0x18c));var _0x8da6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda68[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8da6('0x0'));var logger=require(_0x8da6('0x1'))(_0x8da6('0x2'));var moment=require(_0x8da6('0x3'));var BPromise=require(_0x8da6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8da6('0x5'));var rimraf=require(_0x8da6('0x6'));var config=require(_0x8da6('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x8da6('0x8')]=function(_0x3bff25,_0x2f0a14){return _0x3bff25['define'](_0x8da6('0x9'),attributes,{'tableName':_0x8da6('0xa'),'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 d265253..ef30d8a 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 _0x25b4=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','randomstring','../../mysqldb'];(function(_0xe36749,_0x2a45c8){var _0x5d86b7=function(_0x1219e5){while(--_0x1219e5){_0xe36749['push'](_0xe36749['shift']());}};_0x5d86b7(++_0x2a45c8);}(_0x25b4,0x19f));var _0x425b=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0x25b4[_0x4c73ac];return _0x9839ee;};'use strict';var _=require(_0x425b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x425b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x425b('0x2'))['db'];var utils=require(_0x425b('0x3'));var logger=require(_0x425b('0x4'))(_0x425b('0x5'));var config=require(_0x425b('0x6'));var jayson=require(_0x425b('0x7'));var client=jayson[_0x425b('0x8')][_0x425b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d23b5,_0xbd5466,_0x22513b){return new BPromise(function(_0xa898ce,_0x3a101e){return client['request'](_0x4d23b5,_0x22513b)[_0x425b('0xa')](function(_0x58cf48){logger[_0x425b('0xb')](_0x425b('0xc'),_0xbd5466,_0x425b('0xd'));logger[_0x425b('0xe')](_0x425b('0xf'),_0xbd5466,_0x425b('0xd'),JSON['stringify'](_0x58cf48));if(_0x58cf48[_0x425b('0x10')]){if(_0x58cf48[_0x425b('0x10')]['code']===0x1f4){logger[_0x425b('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0xbd5466,_0x58cf48[_0x425b('0x10')]['message']);return _0x3a101e(_0x58cf48[_0x425b('0x10')][_0x425b('0x11')]);}logger[_0x425b('0x10')](_0x425b('0xc'),_0xbd5466,_0x58cf48[_0x425b('0x10')][_0x425b('0x11')]);return _0xa898ce(_0x58cf48[_0x425b('0x10')][_0x425b('0x11')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0xbd5466,_0x425b('0xd'));_0xa898ce(_0x58cf48['result'][_0x425b('0x11')]);}})[_0x425b('0x12')](function(_0x2c9e6e){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0xbd5466,_0x2c9e6e);_0x3a101e(_0x2c9e6e);});});} \ No newline at end of file +var _0x9349=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x9349,0x1a4));var _0x9934=function(_0x42c9b7,_0x53656f){_0x42c9b7=_0x42c9b7-0x0;var _0x2842d9=_0x9349[_0x42c9b7];return _0x2842d9;};'use strict';var _=require(_0x9934('0x0'));var util=require('util');var moment=require(_0x9934('0x1'));var BPromise=require(_0x9934('0x2'));var rs=require(_0x9934('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9934('0x4'))['db'];var utils=require(_0x9934('0x5'));var logger=require(_0x9934('0x6'))(_0x9934('0x7'));var config=require(_0x9934('0x8'));var jayson=require(_0x9934('0x9'));var client=jayson[_0x9934('0xa')][_0x9934('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f466e,_0x27a034,_0x573206){return new BPromise(function(_0x4ede11,_0x56fe40){return client[_0x9934('0xc')](_0x3f466e,_0x573206)[_0x9934('0xd')](function(_0x4bf4c8){logger[_0x9934('0xe')](_0x9934('0xf'),_0x27a034,_0x9934('0x10'));logger['debug'](_0x9934('0x11'),_0x27a034,_0x9934('0x10'),JSON[_0x9934('0x12')](_0x4bf4c8));if(_0x4bf4c8[_0x9934('0x13')]){if(_0x4bf4c8[_0x9934('0x13')][_0x9934('0x14')]===0x1f4){logger[_0x9934('0x13')](_0x9934('0xf'),_0x27a034,_0x4bf4c8['error'][_0x9934('0x15')]);return _0x56fe40(_0x4bf4c8[_0x9934('0x13')]['message']);}logger[_0x9934('0x13')](_0x9934('0xf'),_0x27a034,_0x4bf4c8[_0x9934('0x13')][_0x9934('0x15')]);return _0x4ede11(_0x4bf4c8['error'][_0x9934('0x15')]);}else{logger['info'](_0x9934('0xf'),_0x27a034,_0x9934('0x10'));_0x4ede11(_0x4bf4c8['result'][_0x9934('0x15')]);}})[_0x9934('0x16')](function(_0x100c84){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x27a034,_0x100c84);_0x56fe40(_0x100c84);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 59e3177..6771bdc 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 _0x28d6=['get','/:id','show','create','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated'];(function(_0x15f9fc,_0x248573){var _0x4317ca=function(_0x108423){while(--_0x108423){_0x15f9fc['push'](_0x15f9fc['shift']());}};_0x4317ca(++_0x248573);}(_0x28d6,0x86));var _0x628d=function(_0x5e745e,_0xde2931){_0x5e745e=_0x5e745e-0x0;var _0x122dab=_0x28d6[_0x5e745e];return _0x122dab;};'use strict';var multer=require(_0x628d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x628d('0x1'));var express=require(_0x628d('0x2'));var router=express[_0x628d('0x3')]();var fs_extra=require(_0x628d('0x4'));var auth=require(_0x628d('0x5'));var interaction=require(_0x628d('0x6'));var config=require(_0x628d('0x7'));var controller=require(_0x628d('0x8'));router['get']('/',auth[_0x628d('0x9')](),controller['index']);router[_0x628d('0xa')](_0x628d('0xb'),auth[_0x628d('0x9')](),controller[_0x628d('0xc')]);router['post']('/',auth[_0x628d('0x9')](),controller[_0x628d('0xd')]);router[_0x628d('0xe')](_0x628d('0xb'),auth[_0x628d('0x9')](),controller['update']);router[_0x628d('0xf')](_0x628d('0xb'),auth[_0x628d('0x9')](),controller[_0x628d('0x10')]);module[_0x628d('0x11')]=router; \ No newline at end of file +var _0x00a2=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','/:id','show','isAuthenticated','create','put','update','delete','exports','multer','connect-timeout'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x00a2,0x1b8));var _0x200a=function(_0x490a3e,_0x14cf9c){_0x490a3e=_0x490a3e-0x0;var _0x4f1000=_0x00a2[_0x490a3e];return _0x4f1000;};'use strict';var multer=require(_0x200a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x200a('0x1'));var express=require('express');var router=express[_0x200a('0x2')]();var fs_extra=require(_0x200a('0x3'));var auth=require(_0x200a('0x4'));var interaction=require(_0x200a('0x5'));var config=require(_0x200a('0x6'));var controller=require(_0x200a('0x7'));router[_0x200a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x200a('0x9'),auth['isAuthenticated'](),controller[_0x200a('0xa')]);router['post']('/',auth[_0x200a('0xb')](),controller[_0x200a('0xc')]);router[_0x200a('0xd')](_0x200a('0x9'),auth['isAuthenticated'](),controller[_0x200a('0xe')]);router[_0x200a('0xf')](_0x200a('0x9'),auth[_0x200a('0xb')](),controller['destroy']);module[_0x200a('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index a3873f5..4e105e4 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 _0x99d7=['variable','customVariable','BOOLEAN','sequelize','exports','ENUM','keyValue','string','STRING'];(function(_0x2d7cb9,_0x56e3a5){var _0x4a74f9=function(_0xf06f3d){while(--_0xf06f3d){_0x2d7cb9['push'](_0x2d7cb9['shift']());}};_0x4a74f9(++_0x56e3a5);}(_0x99d7,0x174));var _0x799d=function(_0x351778,_0x483583){_0x351778=_0x351778-0x0;var _0x228fb5=_0x99d7[_0x351778];return _0x228fb5;};'use strict';var Sequelize=require(_0x799d('0x0'));module[_0x799d('0x1')]={'type':{'type':Sequelize[_0x799d('0x2')]('string','variable','customVariable',_0x799d('0x3'),'picklist'),'defaultValue':_0x799d('0x4')},'content':{'type':Sequelize[_0x799d('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x799d('0x2')](_0x799d('0x4'),_0x799d('0x6'),_0x799d('0x7'))},'keyContent':{'type':Sequelize[_0x799d('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x799d('0x5')]},'customField':{'type':Sequelize[_0x799d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x799d('0x5')]}}; \ No newline at end of file +var _0xdebf=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdebf,0x13c));var _0xfdeb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdebf[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xfdeb('0x0'));module[_0xfdeb('0x1')]={'type':{'type':Sequelize[_0xfdeb('0x2')](_0xfdeb('0x3'),_0xfdeb('0x4'),_0xfdeb('0x5'),_0xfdeb('0x6'),_0xfdeb('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfdeb('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xfdeb('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xfdeb('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfdeb('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 163ef77..ea2016e 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 _0xb1a4=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','stack','name','send','map','VtigerField','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes','options','create','body','find','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x3fd81e,_0x326515){var _0x56ec7c=function(_0x3263ce){while(--_0x3263ce){_0x3fd81e['push'](_0x3fd81e['shift']());}};_0x56ec7c(++_0x326515);}(_0xb1a4,0x15d));var _0x4b1a=function(_0x28fe56,_0x43472b){_0x28fe56=_0x28fe56-0x0;var _0x29a433=_0xb1a4[_0x28fe56];return _0x29a433;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4b1a('0x0'));var jsonpatch=require(_0x4b1a('0x1'));var rp=require(_0x4b1a('0x2'));var moment=require(_0x4b1a('0x3'));var BPromise=require(_0x4b1a('0x4'));var Mustache=require(_0x4b1a('0x5'));var util=require(_0x4b1a('0x6'));var path=require(_0x4b1a('0x7'));var sox=require('sox');var csv=require(_0x4b1a('0x8'));var ejs=require(_0x4b1a('0x9'));var fs=require('fs');var fs_extra=require(_0x4b1a('0xa'));var _=require(_0x4b1a('0xb'));var squel=require(_0x4b1a('0xc'));var crypto=require(_0x4b1a('0xd'));var jsforce=require(_0x4b1a('0xe'));var deskjs=require(_0x4b1a('0xf'));var toCsv=require(_0x4b1a('0x8'));var querystring=require(_0x4b1a('0x10'));var Papa=require(_0x4b1a('0x11'));var Redis=require('ioredis');var authService=require(_0x4b1a('0x12'));var qs=require(_0x4b1a('0x13'));var as=require(_0x4b1a('0x14'));var hardwareService=require(_0x4b1a('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x4b1a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4b1a('0x17'));var db=require(_0x4b1a('0x18'))['db'];function respondWithStatusCode(_0x4decb2,_0x1a5f33){_0x1a5f33=_0x1a5f33||0xcc;return function(_0x303e65){if(_0x303e65){return _0x4decb2[_0x4b1a('0x19')](_0x1a5f33);}return _0x4decb2[_0x4b1a('0x1a')](_0x1a5f33)[_0x4b1a('0x1b')]();};}function respondWithResult(_0x194de5,_0x1c911e){_0x1c911e=_0x1c911e||0xc8;return function(_0x3be9e1){if(_0x3be9e1){return _0x194de5['status'](_0x1c911e)['json'](_0x3be9e1);}};}function respondWithFilteredResult(_0x532a9e,_0x44cf1b){return function(_0x5ed5ae){if(_0x5ed5ae){var _0x489ac6=typeof _0x44cf1b[_0x4b1a('0x1c')]==='undefined'&&typeof _0x44cf1b[_0x4b1a('0x1d')]===_0x4b1a('0x1e');var _0x28c1a8=_0x5ed5ae[_0x4b1a('0x1f')];var _0x3dfdd8=_0x489ac6?0x0:_0x44cf1b[_0x4b1a('0x1c')];var _0x10ddf4=_0x489ac6?_0x5ed5ae[_0x4b1a('0x1f')]:_0x44cf1b[_0x4b1a('0x1c')]+_0x44cf1b['limit'];var _0x27b774;if(_0x10ddf4>=_0x28c1a8){_0x10ddf4=_0x28c1a8;_0x27b774=0xc8;}else{_0x27b774=0xce;}_0x532a9e['status'](_0x27b774);return _0x532a9e['set'](_0x4b1a('0x20'),_0x3dfdd8+'-'+_0x10ddf4+'/'+_0x28c1a8)['json'](_0x5ed5ae);}return null;};}function patchUpdates(_0x359755){return function(_0x5b5481){try{jsonpatch[_0x4b1a('0x21')](_0x5b5481,_0x359755,!![]);}catch(_0x129a84){return BPromise['reject'](_0x129a84);}return _0x5b5481[_0x4b1a('0x22')]();};}function saveUpdates(_0x4defd1,_0x18c7a8){return function(_0x4eef83){if(_0x4eef83){return _0x4eef83[_0x4b1a('0x23')](_0x4defd1)[_0x4b1a('0x24')](function(_0x4a3aa0){return _0x4a3aa0;});}return null;};}function removeEntity(_0x51db79,_0x5b2db2){return function(_0x387603){if(_0x387603){return _0x387603[_0x4b1a('0x25')]()[_0x4b1a('0x24')](function(){_0x51db79[_0x4b1a('0x1a')](0xcc)[_0x4b1a('0x1b')]();});}};}function handleEntityNotFound(_0x1d0c25,_0x53378b){return function(_0x599f32){if(!_0x599f32){_0x1d0c25[_0x4b1a('0x19')](0x194);}return _0x599f32;};}function handleError(_0x23bbfa,_0x3f5a5c){_0x3f5a5c=_0x3f5a5c||0x1f4;return function(_0x4eabfc){logger['error'](_0x4eabfc[_0x4b1a('0x26')]);if(_0x4eabfc[_0x4b1a('0x27')]){delete _0x4eabfc[_0x4b1a('0x27')];}_0x23bbfa[_0x4b1a('0x1a')](_0x3f5a5c)[_0x4b1a('0x28')](_0x4eabfc);};}exports['index']=function(_0x53f000,_0x3dea71){var _0x1e9f20={},_0x288456={},_0x20640f={'count':0x0,'rows':[]};var _0x19c4b6=_[_0x4b1a('0x29')](db[_0x4b1a('0x2a')]['rawAttributes'],function(_0x2602c6){return{'name':_0x2602c6[_0x4b1a('0x2b')],'type':_0x2602c6[_0x4b1a('0x2c')]['key']};});_0x288456[_0x4b1a('0x2d')]=_[_0x4b1a('0x29')](_0x19c4b6,'name');_0x288456[_0x4b1a('0x2e')]=_[_0x4b1a('0x2f')](_0x53f000[_0x4b1a('0x2e')]);_0x288456['filters']=_[_0x4b1a('0x30')](_0x288456[_0x4b1a('0x2d')],_0x288456[_0x4b1a('0x2e')]);_0x1e9f20['attributes']=_['intersection'](_0x288456[_0x4b1a('0x2d')],qs[_0x4b1a('0x31')](_0x53f000[_0x4b1a('0x2e')][_0x4b1a('0x31')]));_0x1e9f20[_0x4b1a('0x32')]=_0x1e9f20[_0x4b1a('0x32')][_0x4b1a('0x33')]?_0x1e9f20[_0x4b1a('0x32')]:_0x288456['model'];if(!_0x53f000[_0x4b1a('0x2e')][_0x4b1a('0x34')](_0x4b1a('0x35'))){_0x1e9f20[_0x4b1a('0x1d')]=qs[_0x4b1a('0x1d')](_0x53f000[_0x4b1a('0x2e')]['limit']);_0x1e9f20[_0x4b1a('0x1c')]=qs['offset'](_0x53f000[_0x4b1a('0x2e')][_0x4b1a('0x1c')]);}_0x1e9f20[_0x4b1a('0x36')]=qs[_0x4b1a('0x37')](_0x53f000[_0x4b1a('0x2e')]['sort']);_0x1e9f20[_0x4b1a('0x38')]=qs['filters'](_['pick'](_0x53f000[_0x4b1a('0x2e')],_0x288456[_0x4b1a('0x39')]),_0x19c4b6);if(_0x53f000[_0x4b1a('0x2e')][_0x4b1a('0x3a')]){_0x1e9f20[_0x4b1a('0x38')]=_[_0x4b1a('0x3b')](_0x1e9f20['where'],{'$or':_['map'](_0x19c4b6,function(_0x1bf996){if(_0x1bf996[_0x4b1a('0x2c')]!==_0x4b1a('0x3c')){var _0x178d2b={};_0x178d2b[_0x1bf996['name']]={'$like':'%'+_0x53f000['query']['filter']+'%'};return _0x178d2b;}})});}_0x1e9f20=_[_0x4b1a('0x3b')]({},_0x1e9f20,_0x53f000['options']);var _0x10cfd8={'where':_0x1e9f20[_0x4b1a('0x38')]};return db[_0x4b1a('0x2a')][_0x4b1a('0x1f')](_0x10cfd8)[_0x4b1a('0x24')](function(_0x37a826){_0x20640f[_0x4b1a('0x1f')]=_0x37a826;if(_0x53f000[_0x4b1a('0x2e')][_0x4b1a('0x3d')]){_0x1e9f20[_0x4b1a('0x3e')]=[{'all':!![]}];}return db[_0x4b1a('0x2a')][_0x4b1a('0x3f')](_0x1e9f20);})['then'](function(_0x10f1f3){_0x20640f[_0x4b1a('0x40')]=_0x10f1f3;return _0x20640f;})[_0x4b1a('0x24')](respondWithFilteredResult(_0x3dea71,_0x1e9f20))[_0x4b1a('0x41')](handleError(_0x3dea71,null));};exports[_0x4b1a('0x42')]=function(_0x48f5f4,_0x1b38a3){var _0x3aa9c0={'raw':!![],'where':{'id':_0x48f5f4['params']['id']}},_0x4ad578={};_0x4ad578[_0x4b1a('0x2d')]=_['keys'](db[_0x4b1a('0x2a')][_0x4b1a('0x43')]);_0x4ad578[_0x4b1a('0x2e')]=_[_0x4b1a('0x2f')](_0x48f5f4[_0x4b1a('0x2e')]);_0x4ad578[_0x4b1a('0x39')]=_[_0x4b1a('0x30')](_0x4ad578[_0x4b1a('0x2d')],_0x4ad578[_0x4b1a('0x2e')]);_0x3aa9c0[_0x4b1a('0x32')]=_[_0x4b1a('0x30')](_0x4ad578[_0x4b1a('0x2d')],qs['fields'](_0x48f5f4['query'][_0x4b1a('0x31')]));_0x3aa9c0[_0x4b1a('0x32')]=_0x3aa9c0[_0x4b1a('0x32')][_0x4b1a('0x33')]?_0x3aa9c0[_0x4b1a('0x32')]:_0x4ad578['model'];if(_0x48f5f4[_0x4b1a('0x2e')][_0x4b1a('0x3d')]){_0x3aa9c0[_0x4b1a('0x3e')]=[{'all':!![]}];}_0x3aa9c0=_['merge']({},_0x3aa9c0,_0x48f5f4[_0x4b1a('0x44')]);return db[_0x4b1a('0x2a')]['find'](_0x3aa9c0)[_0x4b1a('0x24')](handleEntityNotFound(_0x1b38a3,null))[_0x4b1a('0x24')](respondWithResult(_0x1b38a3,null))[_0x4b1a('0x41')](handleError(_0x1b38a3,null));};exports[_0x4b1a('0x45')]=function(_0x3597f5,_0x26ac19){return db[_0x4b1a('0x2a')]['create'](_0x3597f5['body'],{})[_0x4b1a('0x24')](respondWithResult(_0x26ac19,0xc9))['catch'](handleError(_0x26ac19,null));};exports[_0x4b1a('0x23')]=function(_0x4bf13c,_0x1396bc){if(_0x4bf13c['body']['id']){delete _0x4bf13c[_0x4b1a('0x46')]['id'];}return db[_0x4b1a('0x2a')]['find']({'where':{'id':_0x4bf13c['params']['id']}})[_0x4b1a('0x24')](handleEntityNotFound(_0x1396bc,null))['then'](saveUpdates(_0x4bf13c[_0x4b1a('0x46')],null))['then'](respondWithResult(_0x1396bc,null))[_0x4b1a('0x41')](handleError(_0x1396bc,null));};exports[_0x4b1a('0x25')]=function(_0x5c5068,_0x18a9d7){return db['VtigerField'][_0x4b1a('0x47')]({'where':{'id':_0x5c5068[_0x4b1a('0x48')]['id']}})[_0x4b1a('0x24')](handleEntityNotFound(_0x18a9d7,null))[_0x4b1a('0x24')](removeEntity(_0x18a9d7,null))[_0x4b1a('0x41')](handleError(_0x18a9d7,null));}; \ No newline at end of file +var _0xab1a=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','map','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VtigerField','includeAll','include','findAll','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x1d9414,_0x5d19bb){var _0x217ec5=function(_0x55aac1){while(--_0x55aac1){_0x1d9414['push'](_0x1d9414['shift']());}};_0x217ec5(++_0x5d19bb);}(_0xab1a,0x151));var _0xaab1=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0xab1a[_0x487ab4];return _0x3bef77;};'use strict';var emlformat=require(_0xaab1('0x0'));var rimraf=require(_0xaab1('0x1'));var zipdir=require(_0xaab1('0x2'));var jsonpatch=require(_0xaab1('0x3'));var rp=require('request-promise');var moment=require(_0xaab1('0x4'));var BPromise=require(_0xaab1('0x5'));var Mustache=require(_0xaab1('0x6'));var util=require(_0xaab1('0x7'));var path=require('path');var sox=require(_0xaab1('0x8'));var csv=require(_0xaab1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaab1('0xa'));var _=require(_0xaab1('0xb'));var squel=require(_0xaab1('0xc'));var crypto=require(_0xaab1('0xd'));var jsforce=require(_0xaab1('0xe'));var deskjs=require(_0xaab1('0xf'));var toCsv=require(_0xaab1('0x9'));var querystring=require(_0xaab1('0x10'));var Papa=require(_0xaab1('0x11'));var Redis=require(_0xaab1('0x12'));var authService=require(_0xaab1('0x13'));var qs=require(_0xaab1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaab1('0x15'));var utils=require(_0xaab1('0x16'));var config=require(_0xaab1('0x17'));var licenseUtil=require(_0xaab1('0x18'));var db=require(_0xaab1('0x19'))['db'];function respondWithStatusCode(_0x4e45ce,_0x3ce75f){_0x3ce75f=_0x3ce75f||0xcc;return function(_0x23bde5){if(_0x23bde5){return _0x4e45ce[_0xaab1('0x1a')](_0x3ce75f);}return _0x4e45ce[_0xaab1('0x1b')](_0x3ce75f)['end']();};}function respondWithResult(_0x32e764,_0x204b8a){_0x204b8a=_0x204b8a||0xc8;return function(_0x5695df){if(_0x5695df){return _0x32e764['status'](_0x204b8a)[_0xaab1('0x1c')](_0x5695df);}};}function respondWithFilteredResult(_0x2a300f,_0x574979){return function(_0x2a4485){if(_0x2a4485){var _0x356dd7=typeof _0x574979[_0xaab1('0x1d')]===_0xaab1('0x1e')&&typeof _0x574979[_0xaab1('0x1f')]===_0xaab1('0x1e');var _0x2c9f3b=_0x2a4485['count'];var _0x13ba55=_0x356dd7?0x0:_0x574979[_0xaab1('0x1d')];var _0x54fd0f=_0x356dd7?_0x2a4485[_0xaab1('0x20')]:_0x574979['offset']+_0x574979[_0xaab1('0x1f')];var _0x52672e;if(_0x54fd0f>=_0x2c9f3b){_0x54fd0f=_0x2c9f3b;_0x52672e=0xc8;}else{_0x52672e=0xce;}_0x2a300f['status'](_0x52672e);return _0x2a300f[_0xaab1('0x21')](_0xaab1('0x22'),_0x13ba55+'-'+_0x54fd0f+'/'+_0x2c9f3b)['json'](_0x2a4485);}return null;};}function patchUpdates(_0x3bb39a){return function(_0x175546){try{jsonpatch[_0xaab1('0x23')](_0x175546,_0x3bb39a,!![]);}catch(_0x4cea72){return BPromise[_0xaab1('0x24')](_0x4cea72);}return _0x175546['save']();};}function saveUpdates(_0x27e72c,_0x17a353){return function(_0x524b7e){if(_0x524b7e){return _0x524b7e[_0xaab1('0x25')](_0x27e72c)[_0xaab1('0x26')](function(_0x470ef0){return _0x470ef0;});}return null;};}function removeEntity(_0x527d6e,_0x2fb93d){return function(_0x495d1d){if(_0x495d1d){return _0x495d1d[_0xaab1('0x27')]()[_0xaab1('0x26')](function(){_0x527d6e[_0xaab1('0x1b')](0xcc)[_0xaab1('0x28')]();});}};}function handleEntityNotFound(_0x5a85c5,_0x3b745c){return function(_0x29496a){if(!_0x29496a){_0x5a85c5[_0xaab1('0x1a')](0x194);}return _0x29496a;};}function handleError(_0x3d3b06,_0xbf15f8){_0xbf15f8=_0xbf15f8||0x1f4;return function(_0x4e213f){logger['error'](_0x4e213f[_0xaab1('0x29')]);if(_0x4e213f[_0xaab1('0x2a')]){delete _0x4e213f[_0xaab1('0x2a')];}_0x3d3b06[_0xaab1('0x1b')](_0xbf15f8)[_0xaab1('0x2b')](_0x4e213f);};}exports['index']=function(_0x3fbfe7,_0x7dc02f){var _0x51207b={},_0x5f38e3={},_0x2fd8a0={'count':0x0,'rows':[]};var _0x213050=_[_0xaab1('0x2c')](db['VtigerField']['rawAttributes'],function(_0x28ad87){return{'name':_0x28ad87[_0xaab1('0x2d')],'type':_0x28ad87['type']['key']};});_0x5f38e3['model']=_[_0xaab1('0x2c')](_0x213050,_0xaab1('0x2a'));_0x5f38e3[_0xaab1('0x2e')]=_[_0xaab1('0x2f')](_0x3fbfe7[_0xaab1('0x2e')]);_0x5f38e3[_0xaab1('0x30')]=_[_0xaab1('0x31')](_0x5f38e3[_0xaab1('0x32')],_0x5f38e3[_0xaab1('0x2e')]);_0x51207b['attributes']=_['intersection'](_0x5f38e3['model'],qs['fields'](_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x33')]));_0x51207b[_0xaab1('0x34')]=_0x51207b[_0xaab1('0x34')][_0xaab1('0x35')]?_0x51207b[_0xaab1('0x34')]:_0x5f38e3['model'];if(!_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x36')](_0xaab1('0x37'))){_0x51207b[_0xaab1('0x1f')]=qs[_0xaab1('0x1f')](_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x1f')]);_0x51207b[_0xaab1('0x1d')]=qs['offset'](_0x3fbfe7['query'][_0xaab1('0x1d')]);}_0x51207b[_0xaab1('0x38')]=qs[_0xaab1('0x39')](_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x39')]);_0x51207b['where']=qs['filters'](_[_0xaab1('0x3a')](_0x3fbfe7[_0xaab1('0x2e')],_0x5f38e3['filters']),_0x213050);if(_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x3b')]){_0x51207b[_0xaab1('0x3c')]=_[_0xaab1('0x3d')](_0x51207b[_0xaab1('0x3c')],{'$or':_[_0xaab1('0x2c')](_0x213050,function(_0x49c345){if(_0x49c345['type']!==_0xaab1('0x3e')){var _0x38c0bd={};_0x38c0bd[_0x49c345[_0xaab1('0x2a')]]={'$like':'%'+_0x3fbfe7[_0xaab1('0x2e')]['filter']+'%'};return _0x38c0bd;}})});}_0x51207b=_[_0xaab1('0x3d')]({},_0x51207b,_0x3fbfe7[_0xaab1('0x3f')]);var _0x4b653b={'where':_0x51207b[_0xaab1('0x3c')]};return db[_0xaab1('0x40')]['count'](_0x4b653b)[_0xaab1('0x26')](function(_0x28038f){_0x2fd8a0[_0xaab1('0x20')]=_0x28038f;if(_0x3fbfe7[_0xaab1('0x2e')][_0xaab1('0x41')]){_0x51207b[_0xaab1('0x42')]=[{'all':!![]}];}return db[_0xaab1('0x40')][_0xaab1('0x43')](_0x51207b);})[_0xaab1('0x26')](function(_0xb16fb1){_0x2fd8a0['rows']=_0xb16fb1;return _0x2fd8a0;})[_0xaab1('0x26')](respondWithFilteredResult(_0x7dc02f,_0x51207b))[_0xaab1('0x44')](handleError(_0x7dc02f,null));};exports['show']=function(_0x471b85,_0x3e75c0){var _0x2e875c={'raw':!![],'where':{'id':_0x471b85[_0xaab1('0x45')]['id']}},_0xec88c9={};_0xec88c9['model']=_[_0xaab1('0x2f')](db[_0xaab1('0x40')]['rawAttributes']);_0xec88c9[_0xaab1('0x2e')]=_['keys'](_0x471b85[_0xaab1('0x2e')]);_0xec88c9[_0xaab1('0x30')]=_[_0xaab1('0x31')](_0xec88c9[_0xaab1('0x32')],_0xec88c9['query']);_0x2e875c[_0xaab1('0x34')]=_[_0xaab1('0x31')](_0xec88c9[_0xaab1('0x32')],qs[_0xaab1('0x33')](_0x471b85[_0xaab1('0x2e')]['fields']));_0x2e875c[_0xaab1('0x34')]=_0x2e875c[_0xaab1('0x34')][_0xaab1('0x35')]?_0x2e875c['attributes']:_0xec88c9[_0xaab1('0x32')];if(_0x471b85[_0xaab1('0x2e')][_0xaab1('0x41')]){_0x2e875c[_0xaab1('0x42')]=[{'all':!![]}];}_0x2e875c=_[_0xaab1('0x3d')]({},_0x2e875c,_0x471b85[_0xaab1('0x3f')]);return db[_0xaab1('0x40')][_0xaab1('0x46')](_0x2e875c)[_0xaab1('0x26')](handleEntityNotFound(_0x3e75c0,null))['then'](respondWithResult(_0x3e75c0,null))[_0xaab1('0x44')](handleError(_0x3e75c0,null));};exports[_0xaab1('0x47')]=function(_0x4d0b95,_0xb77b34){return db['VtigerField'][_0xaab1('0x47')](_0x4d0b95[_0xaab1('0x48')],{})[_0xaab1('0x26')](respondWithResult(_0xb77b34,0xc9))['catch'](handleError(_0xb77b34,null));};exports[_0xaab1('0x25')]=function(_0x563c5d,_0x319a61){if(_0x563c5d['body']['id']){delete _0x563c5d['body']['id'];}return db['VtigerField'][_0xaab1('0x46')]({'where':{'id':_0x563c5d[_0xaab1('0x45')]['id']}})[_0xaab1('0x26')](handleEntityNotFound(_0x319a61,null))[_0xaab1('0x26')](saveUpdates(_0x563c5d['body'],null))[_0xaab1('0x26')](respondWithResult(_0x319a61,null))['catch'](handleError(_0x319a61,null));};exports[_0xaab1('0x27')]=function(_0x60640b,_0x4a2c3f){return db['VtigerField']['find']({'where':{'id':_0x60640b['params']['id']}})[_0xaab1('0x26')](handleEntityNotFound(_0x4a2c3f,null))[_0xaab1('0x26')](removeEntity(_0x4a2c3f,null))[_0xaab1('0x44')](handleError(_0x4a2c3f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 51b98ef..9bf6686 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 _0xab98=['bluebird','request-promise','rimraf','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x4877f0,_0x4de930){var _0x4b1810=function(_0x5da482){while(--_0x5da482){_0x4877f0['push'](_0x4877f0['shift']());}};_0x4b1810(++_0x4de930);}(_0xab98,0x8b));var _0x8ab9=function(_0x4a60bc,_0x3f583e){_0x4a60bc=_0x4a60bc-0x0;var _0x2d31df=_0xab98[_0x4a60bc];return _0x2d31df;};'use strict';var _=require(_0x8ab9('0x0'));var util=require(_0x8ab9('0x1'));var logger=require(_0x8ab9('0x2'))(_0x8ab9('0x3'));var moment=require(_0x8ab9('0x4'));var BPromise=require(_0x8ab9('0x5'));var rp=require(_0x8ab9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ab9('0x7'));var config=require('../../config/environment');var attributes=require(_0x8ab9('0x8'));module[_0x8ab9('0x9')]=function(_0x2f882e,_0x2d1d18){return _0x2f882e[_0x8ab9('0xa')](_0x8ab9('0xb'),attributes,{'tableName':_0x8ab9('0xc'),'paranoid':![],'indexes':[{'name':_0x8ab9('0xd'),'fields':[_0x8ab9('0xe'),_0x8ab9('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b19=['moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','idField','FieldId','util','api'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x6b19,0x15d));var _0x96b1=function(_0xb91dcb,_0x3f6f2d){_0xb91dcb=_0xb91dcb-0x0;var _0x8e2e5b=_0x6b19[_0xb91dcb];return _0x8e2e5b;};'use strict';var _=require('lodash');var util=require(_0x96b1('0x0'));var logger=require('../../config/logger')(_0x96b1('0x1'));var moment=require(_0x96b1('0x2'));var BPromise=require(_0x96b1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x96b1('0x4'));var rimraf=require(_0x96b1('0x5'));var config=require(_0x96b1('0x6'));var attributes=require(_0x96b1('0x7'));module[_0x96b1('0x8')]=function(_0x18b15a,_0x4c12fb){return _0x18b15a[_0x96b1('0x9')](_0x96b1('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x96b1('0xb'),_0x96b1('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index ef932c2..2261d7b 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 _0x0918=['VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x401232,_0x3d36a9){var _0x5b2d90=function(_0x4db75b){while(--_0x4db75b){_0x401232['push'](_0x401232['shift']());}};_0x5b2d90(++_0x3d36a9);}(_0x0918,0x186));var _0x8091=function(_0x5a2637,_0x31c148){_0x5a2637=_0x5a2637-0x0;var _0xbd56e2=_0x0918[_0x5a2637];return _0xbd56e2;};'use strict';var _=require(_0x8091('0x0'));var util=require(_0x8091('0x1'));var moment=require(_0x8091('0x2'));var BPromise=require(_0x8091('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8091('0x4'));var db=require(_0x8091('0x5'))['db'];var utils=require(_0x8091('0x6'));var logger=require(_0x8091('0x7'))(_0x8091('0x8'));var config=require('../../config/environment');var jayson=require(_0x8091('0x9'));var client=jayson[_0x8091('0xa')][_0x8091('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1de51b,_0x1842ea,_0x4a6714){return new BPromise(function(_0x36b9f3,_0x413020){return client[_0x8091('0xc')](_0x1de51b,_0x4a6714)[_0x8091('0xd')](function(_0x17bda3){logger[_0x8091('0xe')](_0x8091('0xf'),_0x1842ea,_0x8091('0x10'));logger[_0x8091('0x11')](_0x8091('0x12'),_0x1842ea,_0x8091('0x10'),JSON[_0x8091('0x13')](_0x17bda3));if(_0x17bda3['error']){if(_0x17bda3[_0x8091('0x14')][_0x8091('0x15')]===0x1f4){logger[_0x8091('0x14')](_0x8091('0xf'),_0x1842ea,_0x17bda3[_0x8091('0x14')][_0x8091('0x16')]);return _0x413020(_0x17bda3['error']['message']);}logger[_0x8091('0x14')](_0x8091('0xf'),_0x1842ea,_0x17bda3[_0x8091('0x14')][_0x8091('0x16')]);return _0x36b9f3(_0x17bda3[_0x8091('0x14')][_0x8091('0x16')]);}else{logger[_0x8091('0xe')](_0x8091('0xf'),_0x1842ea,_0x8091('0x10'));_0x36b9f3(_0x17bda3['result']['message']);}})[_0x8091('0x17')](function(_0x16a89a){logger[_0x8091('0x14')](_0x8091('0xf'),_0x1842ea,_0x16a89a);_0x413020(_0x16a89a);});});} \ No newline at end of file +var _0x0f89=['jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2f0c46,_0x6baaee){var _0x1ea4c4=function(_0xf406db){while(--_0xf406db){_0x2f0c46['push'](_0x2f0c46['shift']());}};_0x1ea4c4(++_0x6baaee);}(_0x0f89,0x1f1));var _0x90f8=function(_0x5c6edf,_0x3a8514){_0x5c6edf=_0x5c6edf-0x0;var _0x545039=_0x0f89[_0x5c6edf];return _0x545039;};'use strict';var _=require(_0x90f8('0x0'));var util=require(_0x90f8('0x1'));var moment=require(_0x90f8('0x2'));var BPromise=require(_0x90f8('0x3'));var rs=require(_0x90f8('0x4'));var fs=require('fs');var Redis=require(_0x90f8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x90f8('0x6'));var logger=require(_0x90f8('0x7'))(_0x90f8('0x8'));var config=require('../../config/environment');var jayson=require(_0x90f8('0x9'));var client=jayson[_0x90f8('0xa')][_0x90f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5cdb80,_0x25c88b,_0x23d553){return new BPromise(function(_0xb0a707,_0x31940c){return client[_0x90f8('0xc')](_0x5cdb80,_0x23d553)['then'](function(_0x3a70bf){logger[_0x90f8('0xd')](_0x90f8('0xe'),_0x25c88b,_0x90f8('0xf'));logger['debug'](_0x90f8('0x10'),_0x25c88b,_0x90f8('0xf'),JSON[_0x90f8('0x11')](_0x3a70bf));if(_0x3a70bf[_0x90f8('0x12')]){if(_0x3a70bf['error']['code']===0x1f4){logger['error'](_0x90f8('0xe'),_0x25c88b,_0x3a70bf[_0x90f8('0x12')]['message']);return _0x31940c(_0x3a70bf[_0x90f8('0x12')][_0x90f8('0x13')]);}logger[_0x90f8('0x12')](_0x90f8('0xe'),_0x25c88b,_0x3a70bf[_0x90f8('0x12')][_0x90f8('0x13')]);return _0xb0a707(_0x3a70bf['error'][_0x90f8('0x13')]);}else{logger['info'](_0x90f8('0xe'),_0x25c88b,'request\x20sent');_0xb0a707(_0x3a70bf[_0x90f8('0x14')][_0x90f8('0x13')]);}})[_0x90f8('0x15')](function(_0x15f20d){logger[_0x90f8('0x12')](_0x90f8('0xe'),_0x25c88b,_0x15f20d);_0x31940c(_0x15f20d);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 76df7f3..91fb356 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 _0xaec7=['exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy'];(function(_0x381695,_0x3e46cd){var _0x1e56e2=function(_0x490a41){while(--_0x490a41){_0x381695['push'](_0x381695['shift']());}};_0x1e56e2(++_0x3e46cd);}(_0xaec7,0x8b));var _0x7aec=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xaec7[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require(_0x7aec('0x0'));var util=require('util');var path=require(_0x7aec('0x1'));var timeout=require(_0x7aec('0x2'));var express=require(_0x7aec('0x3'));var router=express['Router']();var fs_extra=require(_0x7aec('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7aec('0x5'));var config=require('../../config/environment');var controller=require(_0x7aec('0x6'));router[_0x7aec('0x7')]('/',auth[_0x7aec('0x8')](),controller[_0x7aec('0x9')]);router[_0x7aec('0x7')]('/:id',auth[_0x7aec('0x8')](),controller[_0x7aec('0xa')]);router[_0x7aec('0x7')](_0x7aec('0xb'),auth[_0x7aec('0x8')](),controller['getConfigurations']);router[_0x7aec('0x7')](_0x7aec('0xc'),auth[_0x7aec('0x8')](),controller[_0x7aec('0xd')]);router[_0x7aec('0xe')]('/',auth[_0x7aec('0x8')](),controller[_0x7aec('0xf')]);router[_0x7aec('0xe')](_0x7aec('0xb'),auth[_0x7aec('0x8')](),controller[_0x7aec('0x10')]);router[_0x7aec('0x11')](_0x7aec('0x12'),auth['isAuthenticated'](),controller[_0x7aec('0x13')]);router[_0x7aec('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x7aec('0x15')]);module[_0x7aec('0x16')]=router; \ No newline at end of file +var _0x41a6=['/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0x41a6,0x65));var _0x641a=function(_0x4b9617,_0x1bdf76){_0x4b9617=_0x4b9617-0x0;var _0x5f04ab=_0x41a6[_0x4b9617];return _0x5f04ab;};'use strict';var multer=require(_0x641a('0x0'));var util=require('util');var path=require(_0x641a('0x1'));var timeout=require(_0x641a('0x2'));var express=require(_0x641a('0x3'));var router=express[_0x641a('0x4')]();var fs_extra=require(_0x641a('0x5'));var auth=require(_0x641a('0x6'));var interaction=require(_0x641a('0x7'));var config=require(_0x641a('0x8'));var controller=require('./intZendeskAccount.controller');router[_0x641a('0x9')]('/',auth[_0x641a('0xa')](),controller[_0x641a('0xb')]);router[_0x641a('0x9')](_0x641a('0xc'),auth[_0x641a('0xa')](),controller[_0x641a('0xd')]);router[_0x641a('0x9')](_0x641a('0xe'),auth['isAuthenticated'](),controller[_0x641a('0xf')]);router['get']('/:id/fields',auth[_0x641a('0xa')](),controller[_0x641a('0x10')]);router[_0x641a('0x11')]('/',auth[_0x641a('0xa')](),controller['create']);router[_0x641a('0x11')](_0x641a('0xe'),auth[_0x641a('0xa')](),controller[_0x641a('0x12')]);router[_0x641a('0x13')](_0x641a('0xc'),auth['isAuthenticated'](),controller[_0x641a('0x14')]);router[_0x641a('0x15')](_0x641a('0xc'),auth[_0x641a('0xa')](),controller[_0x641a('0x16')]);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 4912306..5f91122 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 _0xafb9=['exports','STRING','username','password','integrationTab','newTab','sequelize'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0xafb9,0x68));var _0x9afb=function(_0x348126,_0x3547bd){_0x348126=_0x348126-0x0;var _0x4fbfd3=_0xafb9[_0x348126];return _0x4fbfd3;};'use strict';var Sequelize=require(_0x9afb('0x0'));module[_0x9afb('0x1')]={'name':{'type':Sequelize[_0x9afb('0x2')]},'description':{'type':Sequelize[_0x9afb('0x2')]},'username':{'type':Sequelize[_0x9afb('0x2')],'unique':_0x9afb('0x3')},'password':{'type':Sequelize[_0x9afb('0x2')]},'token':{'type':Sequelize[_0x9afb('0x2')]},'remoteUri':{'type':Sequelize[_0x9afb('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0x9afb('0x4'),'token'),'defaultValue':_0x9afb('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9afb('0x5'),_0x9afb('0x6')),'defaultValue':_0x9afb('0x5')}}; \ No newline at end of file +var _0xc838=['sequelize','exports','STRING','username','remoteUri','ENUM','password','token','newTab'];(function(_0x2e556e,_0x17da28){var _0x4b2ba3=function(_0x46db08){while(--_0x46db08){_0x2e556e['push'](_0x2e556e['shift']());}};_0x4b2ba3(++_0x17da28);}(_0xc838,0xbd));var _0x8c83=function(_0x31164c,_0x4b6325){_0x31164c=_0x31164c-0x0;var _0x509e10=_0xc838[_0x31164c];return _0x509e10;};'use strict';var Sequelize=require(_0x8c83('0x0'));module[_0x8c83('0x1')]={'name':{'type':Sequelize[_0x8c83('0x2')]},'description':{'type':Sequelize[_0x8c83('0x2')]},'username':{'type':Sequelize[_0x8c83('0x2')],'unique':_0x8c83('0x3')},'password':{'type':Sequelize[_0x8c83('0x2')]},'token':{'type':Sequelize[_0x8c83('0x2')]},'remoteUri':{'type':Sequelize[_0x8c83('0x2')],'unique':_0x8c83('0x4')},'authType':{'type':Sequelize[_0x8c83('0x5')](_0x8c83('0x6'),_0x8c83('0x7')),'defaultValue':_0x8c83('0x6')},'serverUrl':{'type':Sequelize[_0x8c83('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x8c83('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 6496c78..54d0e2c 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 _0x0713=['rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','find','create','body','catch','getConfigurations','hasOwnProperty','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','ZendeskConfiguration','ZendeskField','Descriptions','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','ticket_fields','authType','headers','format','Basic\x20%s','toString','%s/token:%s','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','position','title','system_field_options','custom_field_options','test','statusCode','Wrong\x20credentials','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','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','ZendeskAccount'];(function(_0x4def1b,_0xa61dda){var _0x1dc1f0=function(_0x14b741){while(--_0x14b741){_0x4def1b['push'](_0x4def1b['shift']());}};_0x1dc1f0(++_0xa61dda);}(_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'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5330a8,_0x1826ca){_0x1826ca=_0x1826ca||0xcc;return function(_0x5dc13b){if(_0x5dc13b){return _0x5330a8[_0x3071('0x1b')](_0x1826ca);}return _0x5330a8[_0x3071('0x1c')](_0x1826ca)['end']();};}function respondWithResult(_0x104e73,_0x4e1219){_0x4e1219=_0x4e1219||0xc8;return function(_0x2fc15d){if(_0x2fc15d){return _0x104e73[_0x3071('0x1c')](_0x4e1219)[_0x3071('0x1d')](_0x2fc15d);}};}function respondWithFilteredResult(_0x1f14e1,_0x1caa5d){return function(_0x2a6a4b){if(_0x2a6a4b){var _0x157a47=typeof _0x1caa5d[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1caa5d[_0x3071('0x20')]==='undefined';var _0x224996=_0x2a6a4b[_0x3071('0x21')];var _0x1068d9=_0x157a47?0x0:_0x1caa5d[_0x3071('0x1e')];var _0x3acf0e=_0x157a47?_0x2a6a4b[_0x3071('0x21')]:_0x1caa5d[_0x3071('0x1e')]+_0x1caa5d[_0x3071('0x20')];var _0x502a16;if(_0x3acf0e>=_0x224996){_0x3acf0e=_0x224996;_0x502a16=0xc8;}else{_0x502a16=0xce;}_0x1f14e1[_0x3071('0x1c')](_0x502a16);return _0x1f14e1[_0x3071('0x22')](_0x3071('0x23'),_0x1068d9+'-'+_0x3acf0e+'/'+_0x224996)['json'](_0x2a6a4b);}return null;};}function patchUpdates(_0xb8f4e3){return function(_0x5cd80d){try{jsonpatch[_0x3071('0x24')](_0x5cd80d,_0xb8f4e3,!![]);}catch(_0x43128c){return BPromise[_0x3071('0x25')](_0x43128c);}return _0x5cd80d[_0x3071('0x26')]();};}function saveUpdates(_0x33090c,_0x34c50e){return function(_0x3c5cef){if(_0x3c5cef){return _0x3c5cef[_0x3071('0x27')](_0x33090c)['then'](function(_0x481a51){return _0x481a51;});}return null;};}function removeEntity(_0x2ce48a,_0xb05b1d){return function(_0x412652){if(_0x412652){return _0x412652[_0x3071('0x28')]()[_0x3071('0x29')](function(){_0x2ce48a[_0x3071('0x1c')](0xcc)[_0x3071('0x2a')]();});}};}function handleEntityNotFound(_0x1fe727,_0x1de5fb){return function(_0x4c7130){if(!_0x4c7130){_0x1fe727[_0x3071('0x1b')](0x194);}return _0x4c7130;};}function handleError(_0x3f1e6e,_0x177138){_0x177138=_0x177138||0x1f4;return function(_0x4d5c4b){logger[_0x3071('0x2b')](_0x4d5c4b[_0x3071('0x2c')]);if(_0x4d5c4b[_0x3071('0x2d')]){delete _0x4d5c4b[_0x3071('0x2d')];}_0x3f1e6e[_0x3071('0x1c')](_0x177138)[_0x3071('0x2e')](_0x4d5c4b);};}exports[_0x3071('0x2f')]=function(_0x3921a1,_0x32f1b4){var _0x292205={},_0x254fc8={},_0x5aba96={'count':0x0,'rows':[]};var _0x4f1484=_[_0x3071('0x30')](db[_0x3071('0x31')][_0x3071('0x32')],function(_0x40be95){return{'name':_0x40be95[_0x3071('0x33')],'type':_0x40be95[_0x3071('0x34')][_0x3071('0x35')]};});_0x254fc8[_0x3071('0x36')]=_['map'](_0x4f1484,'name');_0x254fc8['query']=_[_0x3071('0x37')](_0x3921a1[_0x3071('0x38')]);_0x254fc8['filters']=_[_0x3071('0x39')](_0x254fc8[_0x3071('0x36')],_0x254fc8[_0x3071('0x38')]);_0x292205[_0x3071('0x3a')]=_['intersection'](_0x254fc8[_0x3071('0x36')],qs[_0x3071('0x3b')](_0x3921a1[_0x3071('0x38')][_0x3071('0x3b')]));_0x292205[_0x3071('0x3a')]=_0x292205[_0x3071('0x3a')][_0x3071('0x3c')]?_0x292205[_0x3071('0x3a')]:_0x254fc8['model'];if(!_0x3921a1[_0x3071('0x38')]['hasOwnProperty']('nolimit')){_0x292205[_0x3071('0x20')]=qs[_0x3071('0x20')](_0x3921a1['query'][_0x3071('0x20')]);_0x292205[_0x3071('0x1e')]=qs[_0x3071('0x1e')](_0x3921a1[_0x3071('0x38')][_0x3071('0x1e')]);}_0x292205[_0x3071('0x3d')]=qs['sort'](_0x3921a1[_0x3071('0x38')][_0x3071('0x3e')]);_0x292205['where']=qs[_0x3071('0x3f')](_['pick'](_0x3921a1[_0x3071('0x38')],_0x254fc8[_0x3071('0x3f')]),_0x4f1484);if(_0x3921a1['query']['filter']){_0x292205[_0x3071('0x40')]=_[_0x3071('0x41')](_0x292205[_0x3071('0x40')],{'$or':_['map'](_0x4f1484,function(_0x4dea69){if(_0x4dea69['type']!==_0x3071('0x42')){var _0x4b7928={};_0x4b7928[_0x4dea69[_0x3071('0x2d')]]={'$like':'%'+_0x3921a1[_0x3071('0x38')][_0x3071('0x43')]+'%'};return _0x4b7928;}})});}_0x292205=_[_0x3071('0x41')]({},_0x292205,_0x3921a1[_0x3071('0x44')]);var _0x593c9c={'where':_0x292205['where']};return db[_0x3071('0x31')][_0x3071('0x21')](_0x593c9c)[_0x3071('0x29')](function(_0x1f69a6){_0x5aba96['count']=_0x1f69a6;if(_0x3921a1[_0x3071('0x38')][_0x3071('0x45')]){_0x292205[_0x3071('0x46')]=[{'all':!![]}];}return db[_0x3071('0x31')][_0x3071('0x47')](_0x292205);})[_0x3071('0x29')](function(_0x56a9d8){_0x5aba96[_0x3071('0x48')]=_0x56a9d8;return _0x5aba96;})['then'](respondWithFilteredResult(_0x32f1b4,_0x292205))['catch'](handleError(_0x32f1b4,null));};exports['show']=function(_0x47ceaf,_0x2992e6){var _0x1be8b6={'raw':![],'where':{'id':_0x47ceaf[_0x3071('0x49')]['id']}},_0x67b2fb={};_0x67b2fb[_0x3071('0x36')]=_[_0x3071('0x37')](db[_0x3071('0x31')][_0x3071('0x32')]);_0x67b2fb['query']=_[_0x3071('0x37')](_0x47ceaf[_0x3071('0x38')]);_0x67b2fb[_0x3071('0x3f')]=_[_0x3071('0x39')](_0x67b2fb[_0x3071('0x36')],_0x67b2fb['query']);_0x1be8b6['attributes']=_[_0x3071('0x39')](_0x67b2fb[_0x3071('0x36')],qs[_0x3071('0x3b')](_0x47ceaf[_0x3071('0x38')][_0x3071('0x3b')]));_0x1be8b6['attributes']=_0x1be8b6[_0x3071('0x3a')]['length']?_0x1be8b6[_0x3071('0x3a')]:_0x67b2fb['model'];if(_0x47ceaf['query'][_0x3071('0x45')]){_0x1be8b6['include']=[{'all':!![]}];}_0x1be8b6=_[_0x3071('0x41')]({},_0x1be8b6,_0x47ceaf['options']);return db[_0x3071('0x31')][_0x3071('0x4a')](_0x1be8b6)[_0x3071('0x29')](handleEntityNotFound(_0x2992e6,null))[_0x3071('0x29')](respondWithResult(_0x2992e6,null))['catch'](handleError(_0x2992e6,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){return db['ZendeskAccount'][_0x3071('0x4b')](_0x575c12[_0x3071('0x4c')],{})['then'](respondWithResult(_0xd273ec,0xc9))[_0x3071('0x4d')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x224a70,_0x38bcc2){if(_0x224a70[_0x3071('0x4c')]['id']){delete _0x224a70[_0x3071('0x4c')]['id'];}return db[_0x3071('0x31')]['find']({'where':{'id':_0x224a70[_0x3071('0x49')]['id']}})[_0x3071('0x29')](handleEntityNotFound(_0x38bcc2,null))[_0x3071('0x29')](saveUpdates(_0x224a70[_0x3071('0x4c')],null))['then'](respondWithResult(_0x38bcc2,null))[_0x3071('0x4d')](handleError(_0x38bcc2,null));};exports[_0x3071('0x28')]=function(_0x1b832e,_0x2307dd){return db[_0x3071('0x31')][_0x3071('0x4a')]({'where':{'id':_0x1b832e[_0x3071('0x49')]['id']}})[_0x3071('0x29')](handleEntityNotFound(_0x2307dd,null))[_0x3071('0x29')](removeEntity(_0x2307dd,null))[_0x3071('0x4d')](handleError(_0x2307dd,null));};exports[_0x3071('0x4e')]=function(_0x111115,_0x24977b,_0x114f1f){var _0x1656de={};var _0x12be97={};var _0x596cdd;var _0x47a438;return db[_0x3071('0x31')]['findOne']({'where':{'id':_0x111115[_0x3071('0x49')]['id']}})[_0x3071('0x29')](handleEntityNotFound(_0x24977b,null))[_0x3071('0x29')](function(_0x514821){if(_0x514821){_0x596cdd=_0x514821;_0x12be97[_0x3071('0x36')]=_[_0x3071('0x37')](db['ZendeskConfiguration']['rawAttributes']);_0x12be97[_0x3071('0x38')]=_[_0x3071('0x37')](_0x111115[_0x3071('0x38')]);_0x12be97[_0x3071('0x3f')]=_['intersection'](_0x12be97[_0x3071('0x36')],_0x12be97[_0x3071('0x38')]);_0x1656de[_0x3071('0x3a')]=_[_0x3071('0x39')](_0x12be97[_0x3071('0x36')],qs['fields'](_0x111115[_0x3071('0x38')][_0x3071('0x3b')]));_0x1656de[_0x3071('0x3a')]=_0x1656de[_0x3071('0x3a')][_0x3071('0x3c')]?_0x1656de[_0x3071('0x3a')]:_0x12be97[_0x3071('0x36')];_0x1656de['order']=qs['sort'](_0x111115[_0x3071('0x38')]['sort']);_0x1656de[_0x3071('0x40')]=qs[_0x3071('0x3f')](_['pick'](_0x111115[_0x3071('0x38')],_0x12be97[_0x3071('0x3f')]));if(_0x111115['query'][_0x3071('0x43')]){_0x1656de[_0x3071('0x40')]=_[_0x3071('0x41')](_0x1656de[_0x3071('0x40')],{'$or':_[_0x3071('0x30')](_0x1656de['attributes'],function(_0x327ef0){var _0x313a54={};_0x313a54[_0x327ef0]={'$like':'%'+_0x111115[_0x3071('0x38')]['filter']+'%'};return _0x313a54;})});}_0x1656de=_[_0x3071('0x41')]({},_0x1656de,_0x111115[_0x3071('0x44')]);return _0x596cdd[_0x3071('0x4e')](_0x1656de);}})[_0x3071('0x29')](function(_0x379723){if(_0x379723){_0x47a438=_0x379723[_0x3071('0x3c')];if(!_0x111115[_0x3071('0x38')][_0x3071('0x4f')](_0x3071('0x50'))){_0x1656de['limit']=qs[_0x3071('0x20')](_0x111115[_0x3071('0x38')][_0x3071('0x20')]);_0x1656de[_0x3071('0x1e')]=qs[_0x3071('0x1e')](_0x111115[_0x3071('0x38')][_0x3071('0x1e')]);}return _0x596cdd[_0x3071('0x4e')](_0x1656de);}})[_0x3071('0x29')](function(_0x302680){if(_0x302680){return _0x302680?{'count':_0x47a438,'rows':_0x302680}:null;}})[_0x3071('0x29')](respondWithResult(_0x24977b,null))['catch'](handleError(_0x24977b,null));};exports[_0x3071('0x51')]=function(_0x315044,_0x279594,_0x3ed86c){if(_0x315044[_0x3071('0x4c')]['id']){delete _0x315044[_0x3071('0x4c')]['id'];}return db[_0x3071('0x31')][_0x3071('0x52')]({'where':{'id':_0x315044['params']['id']}})[_0x3071('0x29')](handleEntityNotFound(_0x279594,null))[_0x3071('0x29')](function(_0x59ba87){if(_0x59ba87){_0x315044['body'][_0x3071('0x53')]=_0x59ba87['id'];_0x315044[_0x3071('0x4c')][_0x3071('0x54')]=integrations[_0x3071('0x55')](_0x315044['body']['channel'],_0x315044[_0x3071('0x4c')]['type']);_0x315044['body']['Descriptions']=integrations['getDescriptions'](_0x315044[_0x3071('0x4c')][_0x3071('0x56')],_0x315044[_0x3071('0x4c')]['type']);return db[_0x3071('0x57')][_0x3071('0x4b')](_0x315044[_0x3071('0x4c')],{'include':[{'model':db[_0x3071('0x58')],'as':'Subjects'},{'model':db[_0x3071('0x58')],'as':_0x3071('0x59')}]});}return null;})['then'](respondWithResult(_0x279594,null))[_0x3071('0x4d')](handleError(_0x279594,null));};exports[_0x3071('0x5a')]=function(_0x388cd1,_0x40c258,_0x4edd23){var _0x11ffdd='';return db[_0x3071('0x31')]['findOne']({'where':{'id':_0x388cd1['params']['id']},'attributes':['id',_0x3071('0x5b'),_0x3071('0x5c'),_0x3071('0x5d'),'authType','remoteUri']})[_0x3071('0x29')](handleEntityNotFound(_0x40c258,null))[_0x3071('0x29')](function(_0x3bad84){if(_0x3bad84){_0x11ffdd=_0x3bad84[_0x3071('0x5e')];var _0x2f1935=_0x11ffdd[_0x3071('0x5f')](-0x1);if(_0x2f1935==='/'){_0x11ffdd=_0x11ffdd[_0x3071('0x60')](0x0,_0x11ffdd[_0x3071('0x61')](_0x2f1935));}var _0x5eed64={'method':_0x3071('0x62'),'uri':util['format'](_0x3071('0x63'),_0x11ffdd,_0x3071('0x64')),'json':!![]};switch(_0x3bad84[_0x3071('0x65')]){case _0x3071('0x5c'):_0x5eed64[_0x3071('0x66')]={'Authorization':util[_0x3071('0x67')](_0x3071('0x68'),new Buffer(util[_0x3071('0x67')]('%s:%s',_0x3bad84[_0x3071('0x5b')],_0x3bad84[_0x3071('0x5c')]))[_0x3071('0x69')]('base64'))};break;case _0x3071('0x5d'):_0x5eed64[_0x3071('0x66')]={'Authorization':util[_0x3071('0x67')]('Basic\x20%s',new Buffer(util['format'](_0x3071('0x6a'),_0x3bad84['username'],_0x3bad84[_0x3071('0x5d')]))[_0x3071('0x69')](_0x3071('0x6b')))};break;default:throw new db[(_0x3071('0x6c'))][(_0x3071('0x6d'))](_0x3071('0x6e'));}return rp(_0x5eed64);}})[_0x3071('0x29')](function(_0x4c67ec){if(_0x4c67ec){var _0x1f2be3=[_0x3071('0x6f'),_0x3071('0x70'),_0x3071('0x71'),_0x3071('0x72')];_[_0x3071('0x73')](_0x4c67ec[_0x3071('0x64')],function(_0x277377){return _0x1f2be3['includes'](_0x277377[_0x3071('0x34')]);});return{'count':_0x4c67ec['ticket_fields'][_0x3071('0x3c')],'rows':_[_0x3071('0x30')](_0x4c67ec[_0x3071('0x64')],function(_0x45879b){return{'id':_0x45879b['id'],'name':_0x45879b[_0x3071('0x74')]>0x7?_0x45879b[_0x3071('0x75')]:_0x45879b[_0x3071('0x34')],'custom':_0x45879b[_0x3071('0x74')]>0x7?!![]:![],'options':_0x45879b[_0x3071('0x76')]?_0x45879b[_0x3071('0x76')]:_0x45879b['custom_field_options']?_0x45879b[_0x3071('0x77')]:[]};})};}})[_0x3071('0x29')](respondWithResult(_0x40c258,null))['catch'](function(_0x156826){var _0x3b7c95=_0x388cd1[_0x3071('0x38')][_0x3071('0x78')]?0x1f4:_0x156826[_0x3071('0x79')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x3071('0x5a'),_0x3b7c95,JSON['stringify'](_0x156826));delete _0x156826[_0x3071('0x2d')];if(_0x3b7c95===0x191){_0x3b7c95=0x190;}_0x40c258[_0x3071('0x1c')](_0x3b7c95)[_0x3071('0x2e')](_0x388cd1[_0x3071('0x38')][_0x3071('0x78')]?{'message':_0x3071('0x7a'),'statusCode':_0x156826['statusCode']}:_0x156826);});}; \ No newline at end of file +var _0xe706=['getConfigurations','findOne','ZendeskConfiguration','pick','hasOwnProperty','AccountId','Subjects','getSubjects','Descriptions','channel','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','GET','format','password','headers','Basic\x20%s','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','remove','includes','ticket_fields','title','position','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','show','includeAll','include','find','create','body','catch','params'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0xe706,0xa3));var _0x6e70=function(_0x50abc4,_0x558d64){_0x50abc4=_0x50abc4-0x0;var _0x5a745d=_0xe706[_0x50abc4];return _0x5a745d;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];var integrations=require(_0x6e70('0x1d'));function respondWithStatusCode(_0x3b38f3,_0x310eb7){_0x310eb7=_0x310eb7||0xcc;return function(_0xa1eb74){if(_0xa1eb74){return _0x3b38f3[_0x6e70('0x1e')](_0x310eb7);}return _0x3b38f3['status'](_0x310eb7)['end']();};}function respondWithResult(_0x48bc72,_0x257e81){_0x257e81=_0x257e81||0xc8;return function(_0x5a37a6){if(_0x5a37a6){return _0x48bc72['status'](_0x257e81)[_0x6e70('0x1f')](_0x5a37a6);}};}function respondWithFilteredResult(_0x22c50c,_0x5d9263){return function(_0x24f3ac){if(_0x24f3ac){var _0x5c3fe7=typeof _0x5d9263[_0x6e70('0x20')]===_0x6e70('0x21')&&typeof _0x5d9263['limit']==='undefined';var _0x3bd572=_0x24f3ac['count'];var _0x28a21f=_0x5c3fe7?0x0:_0x5d9263[_0x6e70('0x20')];var _0x53acdc=_0x5c3fe7?_0x24f3ac['count']:_0x5d9263[_0x6e70('0x20')]+_0x5d9263[_0x6e70('0x22')];var _0x2368eb;if(_0x53acdc>=_0x3bd572){_0x53acdc=_0x3bd572;_0x2368eb=0xc8;}else{_0x2368eb=0xce;}_0x22c50c[_0x6e70('0x23')](_0x2368eb);return _0x22c50c[_0x6e70('0x24')](_0x6e70('0x25'),_0x28a21f+'-'+_0x53acdc+'/'+_0x3bd572)[_0x6e70('0x1f')](_0x24f3ac);}return null;};}function patchUpdates(_0x44a49f){return function(_0x29326f){try{jsonpatch[_0x6e70('0x26')](_0x29326f,_0x44a49f,!![]);}catch(_0x4a0cfe){return BPromise[_0x6e70('0x27')](_0x4a0cfe);}return _0x29326f[_0x6e70('0x28')]();};}function saveUpdates(_0x27b294,_0x502b2d){return function(_0x3ccd87){if(_0x3ccd87){return _0x3ccd87[_0x6e70('0x29')](_0x27b294)[_0x6e70('0x2a')](function(_0x50da2c){return _0x50da2c;});}return null;};}function removeEntity(_0x10fc91,_0x538b9c){return function(_0x50aec2){if(_0x50aec2){return _0x50aec2['destroy']()[_0x6e70('0x2a')](function(){_0x10fc91[_0x6e70('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ecdf1,_0x1196ed){return function(_0x5f268f){if(!_0x5f268f){_0x3ecdf1[_0x6e70('0x1e')](0x194);}return _0x5f268f;};}function handleError(_0x67fb43,_0x2bb231){_0x2bb231=_0x2bb231||0x1f4;return function(_0x4a67ac){logger['error'](_0x4a67ac[_0x6e70('0x2b')]);if(_0x4a67ac[_0x6e70('0x2c')]){delete _0x4a67ac[_0x6e70('0x2c')];}_0x67fb43[_0x6e70('0x23')](_0x2bb231)[_0x6e70('0x2d')](_0x4a67ac);};}exports['index']=function(_0x1952ea,_0x406f29){var _0xecf336={},_0x2864a0={},_0x396a67={'count':0x0,'rows':[]};var _0x20a225=_[_0x6e70('0x2e')](db[_0x6e70('0x2f')][_0x6e70('0x30')],function(_0x3a5d30){return{'name':_0x3a5d30['fieldName'],'type':_0x3a5d30[_0x6e70('0x31')]['key']};});_0x2864a0[_0x6e70('0x32')]=_['map'](_0x20a225,_0x6e70('0x2c'));_0x2864a0[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x1952ea['query']);_0x2864a0[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x2864a0['model'],_0x2864a0[_0x6e70('0x33')]);_0xecf336[_0x6e70('0x37')]=_['intersection'](_0x2864a0[_0x6e70('0x32')],qs[_0x6e70('0x38')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x38')]));_0xecf336[_0x6e70('0x37')]=_0xecf336[_0x6e70('0x37')][_0x6e70('0x39')]?_0xecf336[_0x6e70('0x37')]:_0x2864a0[_0x6e70('0x32')];if(!_0x1952ea[_0x6e70('0x33')]['hasOwnProperty'](_0x6e70('0x3a'))){_0xecf336['limit']=qs[_0x6e70('0x22')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x22')]);_0xecf336[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x20')]);}_0xecf336[_0x6e70('0x3b')]=qs[_0x6e70('0x3c')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3c')]);_0xecf336[_0x6e70('0x3d')]=qs[_0x6e70('0x35')](_['pick'](_0x1952ea['query'],_0x2864a0['filters']),_0x20a225);if(_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3e')]){_0xecf336[_0x6e70('0x3d')]=_[_0x6e70('0x3f')](_0xecf336[_0x6e70('0x3d')],{'$or':_[_0x6e70('0x2e')](_0x20a225,function(_0x572a71){if(_0x572a71[_0x6e70('0x31')]!==_0x6e70('0x40')){var _0x1c5cde={};_0x1c5cde[_0x572a71[_0x6e70('0x2c')]]={'$like':'%'+_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3e')]+'%'};return _0x1c5cde;}})});}_0xecf336=_[_0x6e70('0x3f')]({},_0xecf336,_0x1952ea[_0x6e70('0x41')]);var _0x5be100={'where':_0xecf336[_0x6e70('0x3d')]};return db[_0x6e70('0x2f')][_0x6e70('0x42')](_0x5be100)[_0x6e70('0x2a')](function(_0x201da9){_0x396a67[_0x6e70('0x42')]=_0x201da9;if(_0x1952ea[_0x6e70('0x33')]['includeAll']){_0xecf336['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x6e70('0x43')](_0xecf336);})[_0x6e70('0x2a')](function(_0x83847b){_0x396a67[_0x6e70('0x44')]=_0x83847b;return _0x396a67;})[_0x6e70('0x2a')](respondWithFilteredResult(_0x406f29,_0xecf336))['catch'](handleError(_0x406f29,null));};exports[_0x6e70('0x45')]=function(_0x2a58d7,_0x2a2aca){var _0x52b197={'raw':![],'where':{'id':_0x2a58d7['params']['id']}},_0x544ad0={};_0x544ad0[_0x6e70('0x32')]=_['keys'](db[_0x6e70('0x2f')][_0x6e70('0x30')]);_0x544ad0[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x2a58d7['query']);_0x544ad0[_0x6e70('0x35')]=_['intersection'](_0x544ad0[_0x6e70('0x32')],_0x544ad0[_0x6e70('0x33')]);_0x52b197[_0x6e70('0x37')]=_[_0x6e70('0x36')](_0x544ad0['model'],qs[_0x6e70('0x38')](_0x2a58d7[_0x6e70('0x33')][_0x6e70('0x38')]));_0x52b197[_0x6e70('0x37')]=_0x52b197[_0x6e70('0x37')][_0x6e70('0x39')]?_0x52b197[_0x6e70('0x37')]:_0x544ad0['model'];if(_0x2a58d7[_0x6e70('0x33')][_0x6e70('0x46')]){_0x52b197[_0x6e70('0x47')]=[{'all':!![]}];}_0x52b197=_[_0x6e70('0x3f')]({},_0x52b197,_0x2a58d7[_0x6e70('0x41')]);return db[_0x6e70('0x2f')][_0x6e70('0x48')](_0x52b197)['then'](handleEntityNotFound(_0x2a2aca,null))[_0x6e70('0x2a')](respondWithResult(_0x2a2aca,null))['catch'](handleError(_0x2a2aca,null));};exports[_0x6e70('0x49')]=function(_0x3836e4,_0x4b351e){return db['ZendeskAccount'][_0x6e70('0x49')](_0x3836e4[_0x6e70('0x4a')],{})[_0x6e70('0x2a')](respondWithResult(_0x4b351e,0xc9))['catch'](handleError(_0x4b351e,null));};exports['update']=function(_0x238ebb,_0x11ac3d){if(_0x238ebb[_0x6e70('0x4a')]['id']){delete _0x238ebb[_0x6e70('0x4a')]['id'];}return db[_0x6e70('0x2f')][_0x6e70('0x48')]({'where':{'id':_0x238ebb['params']['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x11ac3d,null))[_0x6e70('0x2a')](saveUpdates(_0x238ebb[_0x6e70('0x4a')],null))[_0x6e70('0x2a')](respondWithResult(_0x11ac3d,null))[_0x6e70('0x4b')](handleError(_0x11ac3d,null));};exports['destroy']=function(_0x4ae901,_0x2c5538){return db[_0x6e70('0x2f')][_0x6e70('0x48')]({'where':{'id':_0x4ae901[_0x6e70('0x4c')]['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x2c5538,null))['then'](removeEntity(_0x2c5538,null))[_0x6e70('0x4b')](handleError(_0x2c5538,null));};exports[_0x6e70('0x4d')]=function(_0x1fa320,_0x23ebfb,_0x3aba34){var _0x4a111a={};var _0x1142cd={};var _0x1dd242;var _0x2c20d3;return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x1fa320[_0x6e70('0x4c')]['id']}})['then'](handleEntityNotFound(_0x23ebfb,null))[_0x6e70('0x2a')](function(_0x8d425d){if(_0x8d425d){_0x1dd242=_0x8d425d;_0x1142cd['model']=_[_0x6e70('0x34')](db[_0x6e70('0x4f')]['rawAttributes']);_0x1142cd[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x1fa320[_0x6e70('0x33')]);_0x1142cd[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x1142cd['model'],_0x1142cd[_0x6e70('0x33')]);_0x4a111a[_0x6e70('0x37')]=_[_0x6e70('0x36')](_0x1142cd[_0x6e70('0x32')],qs[_0x6e70('0x38')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x38')]));_0x4a111a[_0x6e70('0x37')]=_0x4a111a[_0x6e70('0x37')][_0x6e70('0x39')]?_0x4a111a[_0x6e70('0x37')]:_0x1142cd[_0x6e70('0x32')];_0x4a111a[_0x6e70('0x3b')]=qs[_0x6e70('0x3c')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x3c')]);_0x4a111a[_0x6e70('0x3d')]=qs[_0x6e70('0x35')](_[_0x6e70('0x50')](_0x1fa320[_0x6e70('0x33')],_0x1142cd['filters']));if(_0x1fa320[_0x6e70('0x33')][_0x6e70('0x3e')]){_0x4a111a[_0x6e70('0x3d')]=_[_0x6e70('0x3f')](_0x4a111a[_0x6e70('0x3d')],{'$or':_[_0x6e70('0x2e')](_0x4a111a['attributes'],function(_0x42bd85){var _0x6cabf0={};_0x6cabf0[_0x42bd85]={'$like':'%'+_0x1fa320['query'][_0x6e70('0x3e')]+'%'};return _0x6cabf0;})});}_0x4a111a=_[_0x6e70('0x3f')]({},_0x4a111a,_0x1fa320[_0x6e70('0x41')]);return _0x1dd242['getConfigurations'](_0x4a111a);}})['then'](function(_0x2f9be4){if(_0x2f9be4){_0x2c20d3=_0x2f9be4[_0x6e70('0x39')];if(!_0x1fa320[_0x6e70('0x33')][_0x6e70('0x51')](_0x6e70('0x3a'))){_0x4a111a[_0x6e70('0x22')]=qs[_0x6e70('0x22')](_0x1fa320['query']['limit']);_0x4a111a[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x20')]);}return _0x1dd242['getConfigurations'](_0x4a111a);}})['then'](function(_0x2e972b){if(_0x2e972b){return _0x2e972b?{'count':_0x2c20d3,'rows':_0x2e972b}:null;}})[_0x6e70('0x2a')](respondWithResult(_0x23ebfb,null))['catch'](handleError(_0x23ebfb,null));};exports['addConfiguration']=function(_0x355708,_0x47fbed,_0x2a8fb7){if(_0x355708[_0x6e70('0x4a')]['id']){delete _0x355708[_0x6e70('0x4a')]['id'];}return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x355708[_0x6e70('0x4c')]['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x47fbed,null))[_0x6e70('0x2a')](function(_0x570115){if(_0x570115){_0x355708[_0x6e70('0x4a')][_0x6e70('0x52')]=_0x570115['id'];_0x355708[_0x6e70('0x4a')][_0x6e70('0x53')]=integrations[_0x6e70('0x54')](_0x355708['body']['channel'],_0x355708['body'][_0x6e70('0x31')]);_0x355708[_0x6e70('0x4a')][_0x6e70('0x55')]=integrations['getDescriptions'](_0x355708['body'][_0x6e70('0x56')],_0x355708[_0x6e70('0x4a')][_0x6e70('0x31')]);return db[_0x6e70('0x4f')][_0x6e70('0x49')](_0x355708[_0x6e70('0x4a')],{'include':[{'model':db['ZendeskField'],'as':_0x6e70('0x53')},{'model':db[_0x6e70('0x57')],'as':_0x6e70('0x55')}]});}return null;})[_0x6e70('0x2a')](respondWithResult(_0x47fbed,null))['catch'](handleError(_0x47fbed,null));};exports[_0x6e70('0x58')]=function(_0x531097,_0x5b4046,_0x30487b){var _0x3249a5='';return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x531097[_0x6e70('0x4c')]['id']},'attributes':['id',_0x6e70('0x59'),'password',_0x6e70('0x5a'),_0x6e70('0x5b'),_0x6e70('0x5c')]})[_0x6e70('0x2a')](handleEntityNotFound(_0x5b4046,null))[_0x6e70('0x2a')](function(_0x13c092){if(_0x13c092){_0x3249a5=_0x13c092[_0x6e70('0x5c')];var _0xd9b4a9=_0x3249a5[_0x6e70('0x5d')](-0x1);if(_0xd9b4a9==='/'){_0x3249a5=_0x3249a5[_0x6e70('0x5e')](0x0,_0x3249a5['lastIndexOf'](_0xd9b4a9));}var _0x44c877={'method':_0x6e70('0x5f'),'uri':util[_0x6e70('0x60')]('%s/%s',_0x3249a5,'ticket_fields'),'json':!![]};switch(_0x13c092[_0x6e70('0x5b')]){case _0x6e70('0x61'):_0x44c877[_0x6e70('0x62')]={'Authorization':util[_0x6e70('0x60')](_0x6e70('0x63'),new Buffer(util['format']('%s:%s',_0x13c092[_0x6e70('0x59')],_0x13c092[_0x6e70('0x61')]))['toString'](_0x6e70('0x64')))};break;case _0x6e70('0x5a'):_0x44c877[_0x6e70('0x62')]={'Authorization':util[_0x6e70('0x60')](_0x6e70('0x63'),new Buffer(util[_0x6e70('0x60')](_0x6e70('0x65'),_0x13c092[_0x6e70('0x59')],_0x13c092[_0x6e70('0x5a')]))[_0x6e70('0x66')](_0x6e70('0x64')))};break;default:throw new db[(_0x6e70('0x67'))][(_0x6e70('0x68'))](_0x6e70('0x69'));}return rp(_0x44c877);}})['then'](function(_0x5b3cb0){if(_0x5b3cb0){var _0x39ed95=['subject',_0x6e70('0x6a'),'group','assignee'];_[_0x6e70('0x6b')](_0x5b3cb0['ticket_fields'],function(_0x576069){return _0x39ed95[_0x6e70('0x6c')](_0x576069[_0x6e70('0x31')]);});return{'count':_0x5b3cb0[_0x6e70('0x6d')]['length'],'rows':_['map'](_0x5b3cb0['ticket_fields'],function(_0x3e7be7){return{'id':_0x3e7be7['id'],'name':_0x3e7be7['position']>0x7?_0x3e7be7[_0x6e70('0x6e')]:_0x3e7be7[_0x6e70('0x31')],'custom':_0x3e7be7[_0x6e70('0x6f')]>0x7?!![]:![],'options':_0x3e7be7[_0x6e70('0x70')]?_0x3e7be7[_0x6e70('0x70')]:_0x3e7be7[_0x6e70('0x71')]?_0x3e7be7[_0x6e70('0x71')]:[]};})};}})['then'](respondWithResult(_0x5b4046,null))[_0x6e70('0x4b')](function(_0x2493b0){var _0xb649a6=_0x531097['query'][_0x6e70('0x72')]?0x1f4:_0x2493b0[_0x6e70('0x73')]||0x1f4;logger[_0x6e70('0x74')](_0x6e70('0x75'),_0x6e70('0x58'),_0xb649a6,JSON[_0x6e70('0x76')](_0x2493b0));delete _0x2493b0[_0x6e70('0x2c')];if(_0xb649a6===0x191){_0xb649a6=0x190;}_0x5b4046[_0x6e70('0x23')](_0xb649a6)[_0x6e70('0x2d')](_0x531097['query'][_0x6e70('0x72')]?{'message':_0x6e70('0x77'),'statusCode':_0x2493b0['statusCode']}:_0x2493b0);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 14ea6ef..a403db5 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 _0x143d=['../../components/integrations/configuration','exports','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes'];(function(_0x2d80f4,_0x45d622){var _0x5562d1=function(_0x45ebdf){while(--_0x45ebdf){_0x2d80f4['push'](_0x2d80f4['shift']());}};_0x5562d1(++_0x45d622);}(_0x143d,0x1d7));var _0xd143=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0x143d[_0x56825b];return _0x69ce77;};'use strict';var _=require(_0xd143('0x0'));var util=require(_0xd143('0x1'));var logger=require(_0xd143('0x2'))(_0xd143('0x3'));var moment=require(_0xd143('0x4'));var BPromise=require(_0xd143('0x5'));var rp=require(_0xd143('0x6'));var fs=require('fs');var path=require(_0xd143('0x7'));var rimraf=require('rimraf');var config=require(_0xd143('0x8'));var attributes=require(_0xd143('0x9'));var integrations=require(_0xd143('0xa'));module[_0xd143('0xb')]=function(_0x388f0e,_0x4f84c7){return _0x388f0e['define']('ZendeskAccount',attributes,{'tableName':_0xd143('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6964=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZendeskAccount','lodash','util','api','moment'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0x6964,0x11c));var _0x4696=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0x6964[_0x5a26f5];return _0x2e9ef7;};'use strict';var _=require(_0x4696('0x0'));var util=require(_0x4696('0x1'));var logger=require('../../config/logger')(_0x4696('0x2'));var moment=require(_0x4696('0x3'));var BPromise=require(_0x4696('0x4'));var rp=require(_0x4696('0x5'));var fs=require('fs');var path=require(_0x4696('0x6'));var rimraf=require(_0x4696('0x7'));var config=require(_0x4696('0x8'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x4696('0x9')]=function(_0x9c6d3,_0x1c8e84){return _0x9c6d3[_0x4696('0xa')](_0x4696('0xb'),attributes,{'tableName':'int_zendesk_accounts','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 40aaf07..dea1eaf 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 _0x812f=['GetZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZendeskAccount','ZendeskAccount','find','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x198ba4,_0x3a5e65){var _0x2b03a7=function(_0x1e3f89){while(--_0x1e3f89){_0x198ba4['push'](_0x198ba4['shift']());}};_0x2b03a7(++_0x3a5e65);}(_0x812f,0x136));var _0xf812=function(_0x1727cb,_0x888974){_0x1727cb=_0x1727cb-0x0;var _0x1c3555=_0x812f[_0x1727cb];return _0x1c3555;};'use strict';var _=require(_0xf812('0x0'));var util=require(_0xf812('0x1'));var moment=require(_0xf812('0x2'));var BPromise=require(_0xf812('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(_0xf812('0x4'))(_0xf812('0x5'));var config=require(_0xf812('0x6'));var jayson=require(_0xf812('0x7'));var client=jayson[_0xf812('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x314553,_0x5312f4,_0x28a1b2){return new BPromise(function(_0x586a6f,_0x18c6b3){return client['request'](_0x314553,_0x28a1b2)[_0xf812('0x9')](function(_0x4d08a8){logger[_0xf812('0xa')]('ZendeskAccount,\x20%s,\x20%s',_0x5312f4,'request\x20sent');logger[_0xf812('0xb')](_0xf812('0xc'),_0x5312f4,'request\x20sent',JSON[_0xf812('0xd')](_0x4d08a8));if(_0x4d08a8['error']){if(_0x4d08a8[_0xf812('0xe')][_0xf812('0xf')]===0x1f4){logger['error'](_0xf812('0x10'),_0x5312f4,_0x4d08a8['error']['message']);return _0x18c6b3(_0x4d08a8['error'][_0xf812('0x11')]);}logger[_0xf812('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x5312f4,_0x4d08a8[_0xf812('0xe')][_0xf812('0x11')]);return _0x586a6f(_0x4d08a8[_0xf812('0xe')]['message']);}else{logger[_0xf812('0xa')](_0xf812('0x10'),_0x5312f4,'request\x20sent');_0x586a6f(_0x4d08a8[_0xf812('0x12')][_0xf812('0x11')]);}})[_0xf812('0x13')](function(_0x37bdc5){logger[_0xf812('0xe')](_0xf812('0x10'),_0x5312f4,_0x37bdc5);_0x18c6b3(_0x37bdc5);});});}exports[_0xf812('0x14')]=function(_0x2985ff){var _0x57ac06=this;return new Promise(function(_0x179b4d,_0x2d5d7a){return db['ZendeskAccount'][_0xf812('0x15')]({'raw':_0x2985ff[_0xf812('0x16')]?_0x2985ff[_0xf812('0x16')][_0xf812('0x17')]===undefined?!![]:![]:!![],'where':_0x2985ff[_0xf812('0x16')]?_0x2985ff['options'][_0xf812('0x18')]||null:null,'attributes':_0x2985ff[_0xf812('0x16')]?_0x2985ff['options'][_0xf812('0x19')]||null:null,'limit':_0x2985ff[_0xf812('0x16')]?_0x2985ff[_0xf812('0x16')][_0xf812('0x1a')]||null:null,'include':_0x2985ff['options']?_0x2985ff['options'][_0xf812('0x1b')]?_[_0xf812('0x1c')](_0x2985ff[_0xf812('0x16')]['include'],function(_0x2a95a4){return{'model':db[_0x2a95a4[_0xf812('0x1d')]],'as':_0x2a95a4['as'],'attributes':_0x2a95a4[_0xf812('0x19')],'include':_0x2a95a4[_0xf812('0x1b')]?_[_0xf812('0x1c')](_0x2a95a4[_0xf812('0x1b')],function(_0x4f561d){return{'model':db[_0x4f561d[_0xf812('0x1d')]],'as':_0x4f561d['as'],'attributes':_0x4f561d[_0xf812('0x19')],'include':_0x4f561d[_0xf812('0x1b')]?_[_0xf812('0x1c')](_0x4f561d[_0xf812('0x1b')],function(_0xad2db8){return{'model':db[_0xad2db8[_0xf812('0x1d')]],'as':_0xad2db8['as'],'attributes':_0xad2db8[_0xf812('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf812('0x9')](function(_0xce027a){logger[_0xf812('0xa')](_0xf812('0x14'),_0x2985ff);logger['debug']('GetZendeskAccount',_0x2985ff,JSON['stringify'](_0xce027a));_0x179b4d(_0xce027a);})[_0xf812('0x13')](function(_0x27c20e){logger[_0xf812('0xe')](_0xf812('0x14'),_0x27c20e[_0xf812('0x11')],_0x2985ff);_0x2d5d7a(_0x57ac06[_0xf812('0xe')](0x1f4,_0x27c20e[_0xf812('0x11')]));});});};exports[_0xf812('0x1e')]=function(_0x2097d1){var _0x47467=this;return new Promise(function(_0x5178fc,_0x68a12b){return db[_0xf812('0x1f')][_0xf812('0x20')]({'raw':_0x2097d1[_0xf812('0x16')]?_0x2097d1[_0xf812('0x16')][_0xf812('0x17')]===undefined?!![]:![]:!![],'where':_0x2097d1[_0xf812('0x16')]?_0x2097d1[_0xf812('0x16')][_0xf812('0x18')]||null:null,'attributes':_0x2097d1[_0xf812('0x16')]?_0x2097d1['options'][_0xf812('0x19')]||null:null,'include':_0x2097d1[_0xf812('0x16')]?_0x2097d1[_0xf812('0x16')][_0xf812('0x1b')]?_['map'](_0x2097d1['options'][_0xf812('0x1b')],function(_0x4693f1){return{'model':db[_0x4693f1['model']],'as':_0x4693f1['as'],'attributes':_0x4693f1[_0xf812('0x19')],'include':_0x4693f1[_0xf812('0x1b')]?_[_0xf812('0x1c')](_0x4693f1[_0xf812('0x1b')],function(_0x51ebc3){return{'model':db[_0x51ebc3['model']],'as':_0x51ebc3['as'],'attributes':_0x51ebc3['attributes'],'include':_0x51ebc3[_0xf812('0x1b')]?_[_0xf812('0x1c')](_0x51ebc3[_0xf812('0x1b')],function(_0x2c8726){return{'model':db[_0x2c8726[_0xf812('0x1d')]],'as':_0x2c8726['as'],'attributes':_0x2c8726[_0xf812('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf812('0x9')](function(_0x116429){logger[_0xf812('0xa')](_0xf812('0x1e'),_0x2097d1);logger[_0xf812('0xb')](_0xf812('0x1e'),_0x2097d1,JSON[_0xf812('0xd')](_0x116429));_0x5178fc(_0x116429);})[_0xf812('0x13')](function(_0x6b9485){logger[_0xf812('0xe')](_0xf812('0x1e'),_0x6b9485['message'],_0x2097d1);_0x68a12b(_0x47467[_0xf812('0xe')](0x1f4,_0x6b9485[_0xf812('0x11')]));});});}; \ No newline at end of file +var _0xc640=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ZendeskAccount','findAll','options','where','attributes','include','map','model','debug','GetZendeskAccount','catch','ShowZendeskAccount','find','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc640,0x1ab));var _0x0c64=function(_0x4a8ace,_0x1d94ff){_0x4a8ace=_0x4a8ace-0x0;var _0xb6d6b8=_0xc640[_0x4a8ace];return _0xb6d6b8;};'use strict';var _=require(_0x0c64('0x0'));var util=require(_0x0c64('0x1'));var moment=require(_0x0c64('0x2'));var BPromise=require(_0x0c64('0x3'));var rs=require(_0x0c64('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c64('0x5'))['db'];var utils=require(_0x0c64('0x6'));var logger=require(_0x0c64('0x7'))(_0x0c64('0x8'));var config=require(_0x0c64('0x9'));var jayson=require(_0x0c64('0xa'));var client=jayson['client'][_0x0c64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x300a64,_0x13bdb7,_0x532846){return new BPromise(function(_0x490f41,_0x279684){return client[_0x0c64('0xc')](_0x300a64,_0x532846)[_0x0c64('0xd')](function(_0x28b054){logger[_0x0c64('0xe')](_0x0c64('0xf'),_0x13bdb7,_0x0c64('0x10'));logger['debug'](_0x0c64('0x11'),_0x13bdb7,_0x0c64('0x10'),JSON[_0x0c64('0x12')](_0x28b054));if(_0x28b054[_0x0c64('0x13')]){if(_0x28b054[_0x0c64('0x13')]['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x13bdb7,_0x28b054['error']['message']);return _0x279684(_0x28b054[_0x0c64('0x13')][_0x0c64('0x14')]);}logger['error'](_0x0c64('0xf'),_0x13bdb7,_0x28b054['error'][_0x0c64('0x14')]);return _0x490f41(_0x28b054[_0x0c64('0x13')][_0x0c64('0x14')]);}else{logger[_0x0c64('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x13bdb7,'request\x20sent');_0x490f41(_0x28b054[_0x0c64('0x15')][_0x0c64('0x14')]);}})['catch'](function(_0x55c147){logger[_0x0c64('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x13bdb7,_0x55c147);_0x279684(_0x55c147);});});}exports['GetZendeskAccount']=function(_0x391047){var _0x91763e=this;return new Promise(function(_0x37557a,_0x3f366e){return db[_0x0c64('0x16')][_0x0c64('0x17')]({'raw':_0x391047[_0x0c64('0x18')]?_0x391047['options']['raw']===undefined?!![]:![]:!![],'where':_0x391047[_0x0c64('0x18')]?_0x391047['options'][_0x0c64('0x19')]||null:null,'attributes':_0x391047[_0x0c64('0x18')]?_0x391047[_0x0c64('0x18')][_0x0c64('0x1a')]||null:null,'limit':_0x391047['options']?_0x391047[_0x0c64('0x18')]['limit']||null:null,'include':_0x391047['options']?_0x391047[_0x0c64('0x18')][_0x0c64('0x1b')]?_[_0x0c64('0x1c')](_0x391047[_0x0c64('0x18')][_0x0c64('0x1b')],function(_0x39cd4e){return{'model':db[_0x39cd4e['model']],'as':_0x39cd4e['as'],'attributes':_0x39cd4e[_0x0c64('0x1a')],'include':_0x39cd4e[_0x0c64('0x1b')]?_[_0x0c64('0x1c')](_0x39cd4e[_0x0c64('0x1b')],function(_0x34002b){return{'model':db[_0x34002b[_0x0c64('0x1d')]],'as':_0x34002b['as'],'attributes':_0x34002b['attributes'],'include':_0x34002b[_0x0c64('0x1b')]?_['map'](_0x34002b[_0x0c64('0x1b')],function(_0x5bb891){return{'model':db[_0x5bb891[_0x0c64('0x1d')]],'as':_0x5bb891['as'],'attributes':_0x5bb891[_0x0c64('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0c64('0xd')](function(_0x48f9cc){logger[_0x0c64('0xe')]('GetZendeskAccount',_0x391047);logger[_0x0c64('0x1e')](_0x0c64('0x1f'),_0x391047,JSON[_0x0c64('0x12')](_0x48f9cc));_0x37557a(_0x48f9cc);})[_0x0c64('0x20')](function(_0x1ee941){logger['error'](_0x0c64('0x1f'),_0x1ee941[_0x0c64('0x14')],_0x391047);_0x3f366e(_0x91763e[_0x0c64('0x13')](0x1f4,_0x1ee941[_0x0c64('0x14')]));});});};exports[_0x0c64('0x21')]=function(_0x4754fa){var _0x3f61cc=this;return new Promise(function(_0x4b7b1f,_0x507f7c){return db['ZendeskAccount'][_0x0c64('0x22')]({'raw':_0x4754fa[_0x0c64('0x18')]?_0x4754fa['options'][_0x0c64('0x23')]===undefined?!![]:![]:!![],'where':_0x4754fa[_0x0c64('0x18')]?_0x4754fa['options']['where']||null:null,'attributes':_0x4754fa[_0x0c64('0x18')]?_0x4754fa[_0x0c64('0x18')][_0x0c64('0x1a')]||null:null,'include':_0x4754fa[_0x0c64('0x18')]?_0x4754fa[_0x0c64('0x18')][_0x0c64('0x1b')]?_[_0x0c64('0x1c')](_0x4754fa[_0x0c64('0x18')][_0x0c64('0x1b')],function(_0x166482){return{'model':db[_0x166482[_0x0c64('0x1d')]],'as':_0x166482['as'],'attributes':_0x166482[_0x0c64('0x1a')],'include':_0x166482[_0x0c64('0x1b')]?_[_0x0c64('0x1c')](_0x166482[_0x0c64('0x1b')],function(_0x43bc9){return{'model':db[_0x43bc9[_0x0c64('0x1d')]],'as':_0x43bc9['as'],'attributes':_0x43bc9[_0x0c64('0x1a')],'include':_0x43bc9[_0x0c64('0x1b')]?_[_0x0c64('0x1c')](_0x43bc9['include'],function(_0x206188){return{'model':db[_0x206188[_0x0c64('0x1d')]],'as':_0x206188['as'],'attributes':_0x206188[_0x0c64('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0c64('0xd')](function(_0x586acc){logger[_0x0c64('0xe')](_0x0c64('0x21'),_0x4754fa);logger['debug']('ShowZendeskAccount',_0x4754fa,JSON[_0x0c64('0x12')](_0x586acc));_0x4b7b1f(_0x586acc);})[_0x0c64('0x20')](function(_0x5ddeb0){logger[_0x0c64('0x13')]('ShowZendeskAccount',_0x5ddeb0[_0x0c64('0x14')],_0x4754fa);_0x507f7c(_0x3f61cc[_0x0c64('0x13')](0x1f4,_0x5ddeb0[_0x0c64('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 4699273..e5c6d83 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 _0x750a=['getTags','post','setTags','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/tags'];(function(_0x45a212,_0x348218){var _0x51c77b=function(_0xef60d){while(--_0xef60d){_0x45a212['push'](_0x45a212['shift']());}};_0x51c77b(++_0x348218);}(_0x750a,0x140));var _0xa750=function(_0x1c9801,_0x17b7a2){_0x1c9801=_0x1c9801-0x0;var _0x3fd117=_0x750a[_0x1c9801];return _0x3fd117;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['show']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/subjects',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['get']('/:id/descriptions',auth[_0xa750('0x9')](),controller['getDescriptions']);router[_0xa750('0x8')](_0xa750('0xf'),auth['isAuthenticated'](),controller[_0xa750('0x10')]);router[_0xa750('0x11')]('/',auth[_0xa750('0x9')](),controller['create']);router[_0xa750('0x11')](_0xa750('0xf'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);router[_0xa750('0x13')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x14')]);router[_0xa750('0x15')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x16')]);module[_0xa750('0x17')]=router; \ No newline at end of file +var _0x9ffd=['update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','put'];(function(_0x1f1e31,_0x27b5c3){var _0x229b56=function(_0x16db77){while(--_0x16db77){_0x1f1e31['push'](_0x1f1e31['shift']());}};_0x229b56(++_0x27b5c3);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4a3a6f,_0x18824a){_0x4a3a6f=_0x4a3a6f-0x0;var _0x99835a=_0x9ffd[_0x4a3a6f];return _0x99835a;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0xb')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['getTags']);router['post']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x14')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['setTags']);router[_0xd9ff('0x15')](_0xd9ff('0xc'),auth['isAuthenticated'](),controller[_0xd9ff('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd9ff('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 19c3cf5..1dbc4ba 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 _0x1beb=['sequelize','STRING'];(function(_0x15ca1a,_0x30fc82){var _0x507626=function(_0x14c9bc){while(--_0x14c9bc){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x507626(++_0x30fc82);}(_0x1beb,0xda));var _0xb1be=function(_0x38efea,_0x5baab8){_0x38efea=_0x38efea-0x0;var _0x4e6dd4=_0x1beb[_0x38efea];return _0x4e6dd4;};'use strict';var Sequelize=require(_0xb1be('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb1be('0x1')]}}; \ No newline at end of file +var _0x0b93=['sequelize'];(function(_0x5c533c,_0x519d54){var _0x1c58aa=function(_0x13bd55){while(--_0x13bd55){_0x5c533c['push'](_0x5c533c['shift']());}};_0x1c58aa(++_0x519d54);}(_0x0b93,0x111));var _0x30b9=function(_0x3e56c7,_0x334c9b){_0x3e56c7=_0x3e56c7-0x0;var _0x4fef94=_0x0b93[_0x3e56c7];return _0x4fef94;};'use strict';var Sequelize=require(_0x30b9('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 4c1265d..2044cf6 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 _0x08ea=['fieldName','key','query','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','params','rawAttributes','intersection','create','body','find','getFields','findOne','keys','hasOwnProperty','ZendeskField','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','sendStatus','error','name','index','map','ZendeskConfiguration'];(function(_0x379907,_0x5e38db){var _0x138c4f=function(_0x47d8f2){while(--_0x47d8f2){_0x379907['push'](_0x379907['shift']());}};_0x138c4f(++_0x5e38db);}(_0x08ea,0xce));var _0xa08e=function(_0x237ca0,_0xa2f1c9){_0x237ca0=_0x237ca0-0x0;var _0x4a868=_0x08ea[_0x237ca0];return _0x4a868;};'use strict';var emlformat=require(_0xa08e('0x0'));var rimraf=require(_0xa08e('0x1'));var zipdir=require(_0xa08e('0x2'));var jsonpatch=require(_0xa08e('0x3'));var rp=require(_0xa08e('0x4'));var moment=require(_0xa08e('0x5'));var BPromise=require(_0xa08e('0x6'));var Mustache=require(_0xa08e('0x7'));var util=require(_0xa08e('0x8'));var path=require(_0xa08e('0x9'));var sox=require(_0xa08e('0xa'));var csv=require(_0xa08e('0xb'));var ejs=require(_0xa08e('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa08e('0xd'));var squel=require(_0xa08e('0xe'));var crypto=require(_0xa08e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa08e('0x10'));var toCsv=require(_0xa08e('0xb'));var querystring=require(_0xa08e('0x11'));var Papa=require(_0xa08e('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa08e('0x13'));var as=require(_0xa08e('0x14'));var hardwareService=require(_0xa08e('0x15'));var logger=require(_0xa08e('0x16'))(_0xa08e('0x17'));var utils=require('../../config/utils');var config=require(_0xa08e('0x18'));var licenseUtil=require(_0xa08e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1eab51,_0x41c402){_0x41c402=_0x41c402||0xcc;return function(_0x134584){if(_0x134584){return _0x1eab51['sendStatus'](_0x41c402);}return _0x1eab51[_0xa08e('0x1a')](_0x41c402)[_0xa08e('0x1b')]();};}function respondWithResult(_0x1d186b,_0x2ec702){_0x2ec702=_0x2ec702||0xc8;return function(_0x300d8b){if(_0x300d8b){return _0x1d186b[_0xa08e('0x1a')](_0x2ec702)[_0xa08e('0x1c')](_0x300d8b);}};}function respondWithFilteredResult(_0x304e63,_0x53f26a){return function(_0x38dd3c){if(_0x38dd3c){var _0x1565d6=typeof _0x53f26a[_0xa08e('0x1d')]===_0xa08e('0x1e')&&typeof _0x53f26a[_0xa08e('0x1f')]==='undefined';var _0xdf6a78=_0x38dd3c[_0xa08e('0x20')];var _0x290484=_0x1565d6?0x0:_0x53f26a[_0xa08e('0x1d')];var _0x3c34df=_0x1565d6?_0x38dd3c[_0xa08e('0x20')]:_0x53f26a[_0xa08e('0x1d')]+_0x53f26a[_0xa08e('0x1f')];var _0x347a49;if(_0x3c34df>=_0xdf6a78){_0x3c34df=_0xdf6a78;_0x347a49=0xc8;}else{_0x347a49=0xce;}_0x304e63[_0xa08e('0x1a')](_0x347a49);return _0x304e63[_0xa08e('0x21')]('Content-Range',_0x290484+'-'+_0x3c34df+'/'+_0xdf6a78)[_0xa08e('0x1c')](_0x38dd3c);}return null;};}function patchUpdates(_0x50d6b8){return function(_0x4aa415){try{jsonpatch[_0xa08e('0x22')](_0x4aa415,_0x50d6b8,!![]);}catch(_0x2afaa6){return BPromise[_0xa08e('0x23')](_0x2afaa6);}return _0x4aa415[_0xa08e('0x24')]();};}function saveUpdates(_0x805646,_0x2fe481){return function(_0x38e092){if(_0x38e092){return _0x38e092[_0xa08e('0x25')](_0x805646)['then'](function(_0x3b4224){return _0x3b4224;});}return null;};}function removeEntity(_0x27a430,_0x2164ea){return function(_0x1e1e02){if(_0x1e1e02){return _0x1e1e02[_0xa08e('0x26')]()[_0xa08e('0x27')](function(){_0x27a430[_0xa08e('0x1a')](0xcc)[_0xa08e('0x1b')]();});}};}function handleEntityNotFound(_0x92f7da,_0x3b0753){return function(_0x53bf21){if(!_0x53bf21){_0x92f7da[_0xa08e('0x28')](0x194);}return _0x53bf21;};}function handleError(_0x3119c9,_0x3ed3c5){_0x3ed3c5=_0x3ed3c5||0x1f4;return function(_0x44f319){logger[_0xa08e('0x29')](_0x44f319['stack']);if(_0x44f319[_0xa08e('0x2a')]){delete _0x44f319[_0xa08e('0x2a')];}_0x3119c9[_0xa08e('0x1a')](_0x3ed3c5)['send'](_0x44f319);};}exports[_0xa08e('0x2b')]=function(_0x240740,_0x46fb49){var _0x16f062={},_0x5ee497={},_0x192c90={'count':0x0,'rows':[]};var _0x3593ca=_[_0xa08e('0x2c')](db[_0xa08e('0x2d')]['rawAttributes'],function(_0x1a4293){return{'name':_0x1a4293[_0xa08e('0x2e')],'type':_0x1a4293['type'][_0xa08e('0x2f')]};});_0x5ee497['model']=_['map'](_0x3593ca,_0xa08e('0x2a'));_0x5ee497[_0xa08e('0x30')]=_['keys'](_0x240740[_0xa08e('0x30')]);_0x5ee497['filters']=_['intersection'](_0x5ee497['model'],_0x5ee497[_0xa08e('0x30')]);_0x16f062[_0xa08e('0x31')]=_['intersection'](_0x5ee497[_0xa08e('0x32')],qs[_0xa08e('0x33')](_0x240740['query'][_0xa08e('0x33')]));_0x16f062[_0xa08e('0x31')]=_0x16f062['attributes'][_0xa08e('0x34')]?_0x16f062[_0xa08e('0x31')]:_0x5ee497[_0xa08e('0x32')];if(!_0x240740['query']['hasOwnProperty'](_0xa08e('0x35'))){_0x16f062[_0xa08e('0x1f')]=qs[_0xa08e('0x1f')](_0x240740['query'][_0xa08e('0x1f')]);_0x16f062['offset']=qs[_0xa08e('0x1d')](_0x240740['query'][_0xa08e('0x1d')]);}_0x16f062[_0xa08e('0x36')]=qs[_0xa08e('0x37')](_0x240740[_0xa08e('0x30')][_0xa08e('0x37')]);_0x16f062[_0xa08e('0x38')]=qs[_0xa08e('0x39')](_[_0xa08e('0x3a')](_0x240740['query'],_0x5ee497[_0xa08e('0x39')]),_0x3593ca);if(_0x240740[_0xa08e('0x30')][_0xa08e('0x3b')]){_0x16f062[_0xa08e('0x38')]=_[_0xa08e('0x3c')](_0x16f062[_0xa08e('0x38')],{'$or':_[_0xa08e('0x2c')](_0x3593ca,function(_0x2890b6){if(_0x2890b6[_0xa08e('0x3d')]!=='VIRTUAL'){var _0x9489c3={};_0x9489c3[_0x2890b6[_0xa08e('0x2a')]]={'$like':'%'+_0x240740[_0xa08e('0x30')][_0xa08e('0x3b')]+'%'};return _0x9489c3;}})});}_0x16f062=_[_0xa08e('0x3c')]({},_0x16f062,_0x240740[_0xa08e('0x3e')]);var _0x230d1a={'where':_0x16f062['where']};return db[_0xa08e('0x2d')][_0xa08e('0x20')](_0x230d1a)[_0xa08e('0x27')](function(_0x1515f5){_0x192c90[_0xa08e('0x20')]=_0x1515f5;if(_0x240740['query'][_0xa08e('0x3f')]){_0x16f062[_0xa08e('0x40')]=[{'all':!![]}];}return db[_0xa08e('0x2d')][_0xa08e('0x41')](_0x16f062);})[_0xa08e('0x27')](function(_0x56f8ae){_0x192c90['rows']=_0x56f8ae;return _0x192c90;})[_0xa08e('0x27')](respondWithFilteredResult(_0x46fb49,_0x16f062))[_0xa08e('0x42')](handleError(_0x46fb49,null));};exports[_0xa08e('0x43')]=function(_0x384792,_0x42fa23){var _0x1747e4={'raw':![],'where':{'id':_0x384792[_0xa08e('0x44')]['id']}},_0x6aa351={};_0x6aa351[_0xa08e('0x32')]=_['keys'](db[_0xa08e('0x2d')][_0xa08e('0x45')]);_0x6aa351['query']=_['keys'](_0x384792[_0xa08e('0x30')]);_0x6aa351[_0xa08e('0x39')]=_[_0xa08e('0x46')](_0x6aa351[_0xa08e('0x32')],_0x6aa351[_0xa08e('0x30')]);_0x1747e4[_0xa08e('0x31')]=_[_0xa08e('0x46')](_0x6aa351['model'],qs[_0xa08e('0x33')](_0x384792[_0xa08e('0x30')][_0xa08e('0x33')]));_0x1747e4[_0xa08e('0x31')]=_0x1747e4[_0xa08e('0x31')][_0xa08e('0x34')]?_0x1747e4[_0xa08e('0x31')]:_0x6aa351[_0xa08e('0x32')];if(_0x384792[_0xa08e('0x30')][_0xa08e('0x3f')]){_0x1747e4['include']=[{'all':!![]}];}_0x1747e4=_[_0xa08e('0x3c')]({},_0x1747e4,_0x384792[_0xa08e('0x3e')]);return db['ZendeskConfiguration']['find'](_0x1747e4)[_0xa08e('0x27')](handleEntityNotFound(_0x42fa23,null))[_0xa08e('0x27')](respondWithResult(_0x42fa23,null))[_0xa08e('0x42')](handleError(_0x42fa23,null));};exports[_0xa08e('0x47')]=function(_0x464d67,_0x335433){return db[_0xa08e('0x2d')][_0xa08e('0x47')](_0x464d67[_0xa08e('0x48')],{})[_0xa08e('0x27')](respondWithResult(_0x335433,0xc9))[_0xa08e('0x42')](handleError(_0x335433,null));};exports['update']=function(_0x3bdc96,_0x5292af){if(_0x3bdc96[_0xa08e('0x48')]['id']){delete _0x3bdc96[_0xa08e('0x48')]['id'];}return db[_0xa08e('0x2d')]['find']({'where':{'id':_0x3bdc96['params']['id']}})[_0xa08e('0x27')](handleEntityNotFound(_0x5292af,null))[_0xa08e('0x27')](saveUpdates(_0x3bdc96['body'],null))[_0xa08e('0x27')](respondWithResult(_0x5292af,null))[_0xa08e('0x42')](handleError(_0x5292af,null));};exports[_0xa08e('0x26')]=function(_0x451835,_0x4bf406){return db[_0xa08e('0x2d')][_0xa08e('0x49')]({'where':{'id':_0x451835['params']['id']}})[_0xa08e('0x27')](handleEntityNotFound(_0x4bf406,null))[_0xa08e('0x27')](removeEntity(_0x4bf406,null))[_0xa08e('0x42')](handleError(_0x4bf406,null));};exports[_0xa08e('0x4a')]=function(_0x5a1fd0,_0x2436ed,_0x1288c3){var _0x8b3ae8={};var _0x2212e1={};var _0x406eda;var _0x586057;return db[_0xa08e('0x2d')][_0xa08e('0x4b')]({'where':{'id':_0x5a1fd0[_0xa08e('0x44')]['id']}})[_0xa08e('0x27')](handleEntityNotFound(_0x2436ed,null))[_0xa08e('0x27')](function(_0x10f59f){if(_0x10f59f){_0x406eda=_0x10f59f;_0x2212e1[_0xa08e('0x32')]=_[_0xa08e('0x4c')](db['ZendeskField'][_0xa08e('0x45')]);_0x2212e1['query']=_['keys'](_0x5a1fd0[_0xa08e('0x30')]);_0x2212e1[_0xa08e('0x39')]=_[_0xa08e('0x46')](_0x2212e1[_0xa08e('0x32')],_0x2212e1['query']);_0x8b3ae8['attributes']=_['intersection'](_0x2212e1[_0xa08e('0x32')],qs[_0xa08e('0x33')](_0x5a1fd0['query'][_0xa08e('0x33')]));_0x8b3ae8['attributes']=_0x8b3ae8[_0xa08e('0x31')]['length']?_0x8b3ae8['attributes']:_0x2212e1[_0xa08e('0x32')];_0x8b3ae8[_0xa08e('0x36')]=qs['sort'](_0x5a1fd0[_0xa08e('0x30')][_0xa08e('0x37')]);_0x8b3ae8[_0xa08e('0x38')]=qs['filters'](_[_0xa08e('0x3a')](_0x5a1fd0[_0xa08e('0x30')],_0x2212e1[_0xa08e('0x39')]));if(_0x5a1fd0[_0xa08e('0x30')][_0xa08e('0x3b')]){_0x8b3ae8[_0xa08e('0x38')]=_[_0xa08e('0x3c')](_0x8b3ae8[_0xa08e('0x38')],{'$or':_['map'](_0x8b3ae8['attributes'],function(_0x198e62){var _0x3a9f9b={};_0x3a9f9b[_0x198e62]={'$like':'%'+_0x5a1fd0[_0xa08e('0x30')][_0xa08e('0x3b')]+'%'};return _0x3a9f9b;})});}_0x8b3ae8=_[_0xa08e('0x3c')]({},_0x8b3ae8,_0x5a1fd0[_0xa08e('0x3e')]);return _0x406eda[_0xa08e('0x4a')](_0x8b3ae8);}})[_0xa08e('0x27')](function(_0x4a589b){if(_0x4a589b){_0x586057=_0x4a589b['length'];if(!_0x5a1fd0['query'][_0xa08e('0x4d')]('nolimit')){_0x8b3ae8['limit']=qs[_0xa08e('0x1f')](_0x5a1fd0['query'][_0xa08e('0x1f')]);_0x8b3ae8[_0xa08e('0x1d')]=qs['offset'](_0x5a1fd0[_0xa08e('0x30')]['offset']);}return _0x406eda['getFields'](_0x8b3ae8);}})[_0xa08e('0x27')](function(_0x543418){if(_0x543418){return _0x543418?{'count':_0x586057,'rows':_0x543418}:null;}})[_0xa08e('0x27')](respondWithResult(_0x2436ed,null))['catch'](handleError(_0x2436ed,null));};exports['getSubjects']=function(_0x768ee4,_0x36ada1,_0x5ce8b1){var _0x540e5f={};var _0x3ce6da={};var _0xc6af2c;var _0x32dde1;return db[_0xa08e('0x2d')][_0xa08e('0x4b')]({'where':{'id':_0x768ee4[_0xa08e('0x44')]['id']}})['then'](handleEntityNotFound(_0x36ada1,null))[_0xa08e('0x27')](function(_0x1372b2){if(_0x1372b2){_0xc6af2c=_0x1372b2;_0x3ce6da[_0xa08e('0x32')]=_[_0xa08e('0x4c')](db[_0xa08e('0x4e')]['rawAttributes']);_0x3ce6da[_0xa08e('0x30')]=_['keys'](_0x768ee4['query']);_0x3ce6da[_0xa08e('0x39')]=_[_0xa08e('0x46')](_0x3ce6da[_0xa08e('0x32')],_0x3ce6da[_0xa08e('0x30')]);_0x540e5f[_0xa08e('0x31')]=_[_0xa08e('0x46')](_0x3ce6da[_0xa08e('0x32')],qs[_0xa08e('0x33')](_0x768ee4[_0xa08e('0x30')]['fields']));_0x540e5f[_0xa08e('0x31')]=_0x540e5f[_0xa08e('0x31')][_0xa08e('0x34')]?_0x540e5f[_0xa08e('0x31')]:_0x3ce6da[_0xa08e('0x32')];_0x540e5f[_0xa08e('0x36')]=qs[_0xa08e('0x37')](_0x768ee4[_0xa08e('0x30')][_0xa08e('0x37')]);_0x540e5f[_0xa08e('0x38')]=qs['filters'](_[_0xa08e('0x3a')](_0x768ee4[_0xa08e('0x30')],_0x3ce6da[_0xa08e('0x39')]));if(_0x768ee4[_0xa08e('0x30')][_0xa08e('0x3b')]){_0x540e5f[_0xa08e('0x38')]=_[_0xa08e('0x3c')](_0x540e5f[_0xa08e('0x38')],{'$or':_[_0xa08e('0x2c')](_0x540e5f[_0xa08e('0x31')],function(_0x43de91){var _0x37a4ae={};_0x37a4ae[_0x43de91]={'$like':'%'+_0x768ee4[_0xa08e('0x30')][_0xa08e('0x3b')]+'%'};return _0x37a4ae;})});}_0x540e5f=_['merge']({},_0x540e5f,_0x768ee4['options']);return _0xc6af2c[_0xa08e('0x4f')](_0x540e5f);}})[_0xa08e('0x27')](function(_0x13fcc9){if(_0x13fcc9){_0x32dde1=_0x13fcc9[_0xa08e('0x34')];if(!_0x768ee4['query']['hasOwnProperty'](_0xa08e('0x35'))){_0x540e5f[_0xa08e('0x1f')]=qs['limit'](_0x768ee4[_0xa08e('0x30')][_0xa08e('0x1f')]);_0x540e5f[_0xa08e('0x1d')]=qs['offset'](_0x768ee4['query'][_0xa08e('0x1d')]);}return _0xc6af2c['getSubjects'](_0x540e5f);}})['then'](function(_0xbf60bc){if(_0xbf60bc){return _0xbf60bc?{'count':_0x32dde1,'rows':_0xbf60bc}:null;}})[_0xa08e('0x27')](respondWithResult(_0x36ada1,null))[_0xa08e('0x42')](handleError(_0x36ada1,null));};exports['getDescriptions']=function(_0x4b6076,_0x22539b,_0x116733){var _0x21f776={};var _0x277d5c={};var _0x5a323e;var _0x5d8fa5;return db[_0xa08e('0x2d')][_0xa08e('0x4b')]({'where':{'id':_0x4b6076['params']['id']}})['then'](handleEntityNotFound(_0x22539b,null))[_0xa08e('0x27')](function(_0x53fa98){if(_0x53fa98){_0x5a323e=_0x53fa98;_0x277d5c[_0xa08e('0x32')]=_['keys'](db[_0xa08e('0x4e')]['rawAttributes']);_0x277d5c['query']=_['keys'](_0x4b6076[_0xa08e('0x30')]);_0x277d5c[_0xa08e('0x39')]=_['intersection'](_0x277d5c[_0xa08e('0x32')],_0x277d5c[_0xa08e('0x30')]);_0x21f776['attributes']=_['intersection'](_0x277d5c[_0xa08e('0x32')],qs[_0xa08e('0x33')](_0x4b6076['query'][_0xa08e('0x33')]));_0x21f776[_0xa08e('0x31')]=_0x21f776[_0xa08e('0x31')][_0xa08e('0x34')]?_0x21f776['attributes']:_0x277d5c[_0xa08e('0x32')];_0x21f776[_0xa08e('0x36')]=qs[_0xa08e('0x37')](_0x4b6076[_0xa08e('0x30')][_0xa08e('0x37')]);_0x21f776['where']=qs[_0xa08e('0x39')](_[_0xa08e('0x3a')](_0x4b6076[_0xa08e('0x30')],_0x277d5c[_0xa08e('0x39')]));if(_0x4b6076[_0xa08e('0x30')][_0xa08e('0x3b')]){_0x21f776[_0xa08e('0x38')]=_['merge'](_0x21f776[_0xa08e('0x38')],{'$or':_[_0xa08e('0x2c')](_0x21f776[_0xa08e('0x31')],function(_0x2cdd57){var _0xb0ab05={};_0xb0ab05[_0x2cdd57]={'$like':'%'+_0x4b6076[_0xa08e('0x30')]['filter']+'%'};return _0xb0ab05;})});}_0x21f776=_['merge']({},_0x21f776,_0x4b6076[_0xa08e('0x3e')]);return _0x5a323e[_0xa08e('0x50')](_0x21f776);}})[_0xa08e('0x27')](function(_0x4b2984){if(_0x4b2984){_0x5d8fa5=_0x4b2984[_0xa08e('0x34')];if(!_0x4b6076[_0xa08e('0x30')]['hasOwnProperty']('nolimit')){_0x21f776[_0xa08e('0x1f')]=qs[_0xa08e('0x1f')](_0x4b6076[_0xa08e('0x30')][_0xa08e('0x1f')]);_0x21f776[_0xa08e('0x1d')]=qs[_0xa08e('0x1d')](_0x4b6076[_0xa08e('0x30')][_0xa08e('0x1d')]);}return _0x5a323e[_0xa08e('0x50')](_0x21f776);}})[_0xa08e('0x27')](function(_0x3287be){if(_0x3287be){return _0x3287be?{'count':_0x5d8fa5,'rows':_0x3287be}:null;}})[_0xa08e('0x27')](respondWithResult(_0x22539b,null))[_0xa08e('0x42')](handleError(_0x22539b,null));};exports['getTags']=function(_0x5f248c,_0x5ddbc8,_0xdab53f){var _0x42e9dc={};var _0x201840={};var _0x7725fb;var _0x232aba;return db[_0xa08e('0x2d')]['findOne']({'where':{'id':_0x5f248c['params']['id']}})['then'](handleEntityNotFound(_0x5ddbc8,null))['then'](function(_0x2c2900){if(_0x2c2900){_0x7725fb=_0x2c2900;_0x201840[_0xa08e('0x32')]=_[_0xa08e('0x4c')](db[_0xa08e('0x51')][_0xa08e('0x45')]);_0x201840[_0xa08e('0x30')]=_[_0xa08e('0x4c')](_0x5f248c[_0xa08e('0x30')]);_0x201840[_0xa08e('0x39')]=_[_0xa08e('0x46')](_0x201840[_0xa08e('0x32')],_0x201840[_0xa08e('0x30')]);_0x42e9dc['attributes']=_['intersection'](_0x201840['model'],qs[_0xa08e('0x33')](_0x5f248c[_0xa08e('0x30')]['fields']));_0x42e9dc[_0xa08e('0x31')]=_0x42e9dc[_0xa08e('0x31')][_0xa08e('0x34')]?_0x42e9dc[_0xa08e('0x31')]:_0x201840[_0xa08e('0x32')];_0x42e9dc[_0xa08e('0x36')]=qs['sort'](_0x5f248c[_0xa08e('0x30')][_0xa08e('0x37')]);_0x42e9dc[_0xa08e('0x38')]=qs[_0xa08e('0x39')](_[_0xa08e('0x3a')](_0x5f248c[_0xa08e('0x30')],_0x201840[_0xa08e('0x39')]));if(_0x5f248c[_0xa08e('0x30')][_0xa08e('0x3b')]){_0x42e9dc['where']=_[_0xa08e('0x3c')](_0x42e9dc[_0xa08e('0x38')],{'$or':_[_0xa08e('0x2c')](_0x42e9dc[_0xa08e('0x31')],function(_0x4ee6c4){var _0x34341b={};_0x34341b[_0x4ee6c4]={'$like':'%'+_0x5f248c[_0xa08e('0x30')][_0xa08e('0x3b')]+'%'};return _0x34341b;})});}_0x42e9dc=_['merge']({},_0x42e9dc,_0x5f248c['options']);return _0x7725fb[_0xa08e('0x52')](_0x42e9dc);}})[_0xa08e('0x27')](function(_0x284ad2){if(_0x284ad2){_0x232aba=_0x284ad2[_0xa08e('0x34')];if(!_0x5f248c[_0xa08e('0x30')][_0xa08e('0x4d')](_0xa08e('0x35'))){_0x42e9dc[_0xa08e('0x1f')]=qs[_0xa08e('0x1f')](_0x5f248c[_0xa08e('0x30')][_0xa08e('0x1f')]);_0x42e9dc[_0xa08e('0x1d')]=qs['offset'](_0x5f248c[_0xa08e('0x30')]['offset']);}return _0x7725fb[_0xa08e('0x52')](_0x42e9dc);}})['then'](function(_0x55673b){if(_0x55673b){return _0x55673b?{'count':_0x232aba,'rows':_0x55673b}:null;}})[_0xa08e('0x27')](respondWithResult(_0x5ddbc8,null))[_0xa08e('0x42')](handleError(_0x5ddbc8,null));};exports[_0xa08e('0x53')]=function(_0x2f38d6,_0x48df04,_0x4d2625){if(_0x2f38d6[_0xa08e('0x48')]['id']){delete _0x2f38d6[_0xa08e('0x48')]['id'];}return db[_0xa08e('0x2d')][_0xa08e('0x4b')]({'where':{'id':_0x2f38d6['params']['id']}})[_0xa08e('0x27')](handleEntityNotFound(_0x48df04,null))[_0xa08e('0x27')](function(_0x3a8737){if(_0x3a8737){return _0x3a8737[_0xa08e('0x53')](_0x2f38d6[_0xa08e('0x48')]['ids']||[]);}return null;})[_0xa08e('0x27')](respondWithResult(_0x48df04,null))[_0xa08e('0x42')](handleError(_0x48df04,null));}; \ No newline at end of file +var _0x0a5b=['keys','rawAttributes','find','create','body','update','getFields','findOne','ZendeskField','catch','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','send','map','ZendeskConfiguration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x0a5b,0x163));var _0xb0a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a5b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb0a5('0x0'));var rimraf=require(_0xb0a5('0x1'));var zipdir=require(_0xb0a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0a5('0x3'));var moment=require(_0xb0a5('0x4'));var BPromise=require(_0xb0a5('0x5'));var Mustache=require('mustache');var util=require(_0xb0a5('0x6'));var path=require(_0xb0a5('0x7'));var sox=require('sox');var csv=require(_0xb0a5('0x8'));var ejs=require(_0xb0a5('0x9'));var fs=require('fs');var fs_extra=require(_0xb0a5('0xa'));var _=require('lodash');var squel=require(_0xb0a5('0xb'));var crypto=require(_0xb0a5('0xc'));var jsforce=require(_0xb0a5('0xd'));var deskjs=require(_0xb0a5('0xe'));var toCsv=require(_0xb0a5('0x8'));var querystring=require('querystring');var Papa=require(_0xb0a5('0xf'));var Redis=require(_0xb0a5('0x10'));var authService=require(_0xb0a5('0x11'));var qs=require(_0xb0a5('0x12'));var as=require(_0xb0a5('0x13'));var hardwareService=require(_0xb0a5('0x14'));var logger=require(_0xb0a5('0x15'))(_0xb0a5('0x16'));var utils=require('../../config/utils');var config=require(_0xb0a5('0x17'));var licenseUtil=require(_0xb0a5('0x18'));var db=require(_0xb0a5('0x19'))['db'];function respondWithStatusCode(_0x4f0b69,_0x5efd35){_0x5efd35=_0x5efd35||0xcc;return function(_0x412a4e){if(_0x412a4e){return _0x4f0b69[_0xb0a5('0x1a')](_0x5efd35);}return _0x4f0b69[_0xb0a5('0x1b')](_0x5efd35)[_0xb0a5('0x1c')]();};}function respondWithResult(_0x3066c7,_0x39d7f6){_0x39d7f6=_0x39d7f6||0xc8;return function(_0x63a40a){if(_0x63a40a){return _0x3066c7[_0xb0a5('0x1b')](_0x39d7f6)[_0xb0a5('0x1d')](_0x63a40a);}};}function respondWithFilteredResult(_0x17111f,_0x1defd9){return function(_0x219f50){if(_0x219f50){var _0x367d1f=typeof _0x1defd9[_0xb0a5('0x1e')]===_0xb0a5('0x1f')&&typeof _0x1defd9[_0xb0a5('0x20')]==='undefined';var _0x59e873=_0x219f50['count'];var _0x37602f=_0x367d1f?0x0:_0x1defd9['offset'];var _0x3fd771=_0x367d1f?_0x219f50[_0xb0a5('0x21')]:_0x1defd9[_0xb0a5('0x1e')]+_0x1defd9[_0xb0a5('0x20')];var _0x37372a;if(_0x3fd771>=_0x59e873){_0x3fd771=_0x59e873;_0x37372a=0xc8;}else{_0x37372a=0xce;}_0x17111f['status'](_0x37372a);return _0x17111f[_0xb0a5('0x22')]('Content-Range',_0x37602f+'-'+_0x3fd771+'/'+_0x59e873)[_0xb0a5('0x1d')](_0x219f50);}return null;};}function patchUpdates(_0x440698){return function(_0x8fb61b){try{jsonpatch[_0xb0a5('0x23')](_0x8fb61b,_0x440698,!![]);}catch(_0x50b522){return BPromise[_0xb0a5('0x24')](_0x50b522);}return _0x8fb61b['save']();};}function saveUpdates(_0x45fa50,_0x144dbf){return function(_0x5c3e44){if(_0x5c3e44){return _0x5c3e44['update'](_0x45fa50)[_0xb0a5('0x25')](function(_0x5e6e5f){return _0x5e6e5f;});}return null;};}function removeEntity(_0x3510cf,_0x3d9888){return function(_0x206913){if(_0x206913){return _0x206913[_0xb0a5('0x26')]()[_0xb0a5('0x25')](function(){_0x3510cf[_0xb0a5('0x1b')](0xcc)[_0xb0a5('0x1c')]();});}};}function handleEntityNotFound(_0x88be3b,_0x2ab83){return function(_0x82e0f0){if(!_0x82e0f0){_0x88be3b[_0xb0a5('0x1a')](0x194);}return _0x82e0f0;};}function handleError(_0x2758ea,_0x309475){_0x309475=_0x309475||0x1f4;return function(_0x4de0e1){logger[_0xb0a5('0x27')](_0x4de0e1[_0xb0a5('0x28')]);if(_0x4de0e1[_0xb0a5('0x29')]){delete _0x4de0e1[_0xb0a5('0x29')];}_0x2758ea['status'](_0x309475)[_0xb0a5('0x2a')](_0x4de0e1);};}exports['index']=function(_0xed8a17,_0x4d9e32){var _0x12462a={},_0xcbffd8={},_0x30a2f2={'count':0x0,'rows':[]};var _0x5316f5=_[_0xb0a5('0x2b')](db[_0xb0a5('0x2c')]['rawAttributes'],function(_0x32569d){return{'name':_0x32569d[_0xb0a5('0x2d')],'type':_0x32569d[_0xb0a5('0x2e')][_0xb0a5('0x2f')]};});_0xcbffd8[_0xb0a5('0x30')]=_[_0xb0a5('0x2b')](_0x5316f5,'name');_0xcbffd8[_0xb0a5('0x31')]=_['keys'](_0xed8a17[_0xb0a5('0x31')]);_0xcbffd8[_0xb0a5('0x32')]=_[_0xb0a5('0x33')](_0xcbffd8[_0xb0a5('0x30')],_0xcbffd8[_0xb0a5('0x31')]);_0x12462a[_0xb0a5('0x34')]=_['intersection'](_0xcbffd8[_0xb0a5('0x30')],qs[_0xb0a5('0x35')](_0xed8a17['query'][_0xb0a5('0x35')]));_0x12462a[_0xb0a5('0x34')]=_0x12462a[_0xb0a5('0x34')][_0xb0a5('0x36')]?_0x12462a['attributes']:_0xcbffd8[_0xb0a5('0x30')];if(!_0xed8a17[_0xb0a5('0x31')][_0xb0a5('0x37')](_0xb0a5('0x38'))){_0x12462a['limit']=qs['limit'](_0xed8a17[_0xb0a5('0x31')][_0xb0a5('0x20')]);_0x12462a[_0xb0a5('0x1e')]=qs[_0xb0a5('0x1e')](_0xed8a17[_0xb0a5('0x31')][_0xb0a5('0x1e')]);}_0x12462a[_0xb0a5('0x39')]=qs[_0xb0a5('0x3a')](_0xed8a17[_0xb0a5('0x31')][_0xb0a5('0x3a')]);_0x12462a[_0xb0a5('0x3b')]=qs[_0xb0a5('0x32')](_[_0xb0a5('0x3c')](_0xed8a17[_0xb0a5('0x31')],_0xcbffd8[_0xb0a5('0x32')]),_0x5316f5);if(_0xed8a17[_0xb0a5('0x31')][_0xb0a5('0x3d')]){_0x12462a[_0xb0a5('0x3b')]=_[_0xb0a5('0x3e')](_0x12462a[_0xb0a5('0x3b')],{'$or':_['map'](_0x5316f5,function(_0x5a6653){if(_0x5a6653[_0xb0a5('0x2e')]!==_0xb0a5('0x3f')){var _0x107c89={};_0x107c89[_0x5a6653[_0xb0a5('0x29')]]={'$like':'%'+_0xed8a17[_0xb0a5('0x31')][_0xb0a5('0x3d')]+'%'};return _0x107c89;}})});}_0x12462a=_[_0xb0a5('0x3e')]({},_0x12462a,_0xed8a17[_0xb0a5('0x40')]);var _0x10fd63={'where':_0x12462a[_0xb0a5('0x3b')]};return db['ZendeskConfiguration'][_0xb0a5('0x21')](_0x10fd63)[_0xb0a5('0x25')](function(_0x54fbf1){_0x30a2f2[_0xb0a5('0x21')]=_0x54fbf1;if(_0xed8a17[_0xb0a5('0x31')][_0xb0a5('0x41')]){_0x12462a[_0xb0a5('0x42')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xb0a5('0x43')](_0x12462a);})[_0xb0a5('0x25')](function(_0x31b3d7){_0x30a2f2['rows']=_0x31b3d7;return _0x30a2f2;})[_0xb0a5('0x25')](respondWithFilteredResult(_0x4d9e32,_0x12462a))['catch'](handleError(_0x4d9e32,null));};exports[_0xb0a5('0x44')]=function(_0x28b053,_0x57380b){var _0x4017f0={'raw':![],'where':{'id':_0x28b053[_0xb0a5('0x45')]['id']}},_0x4f45df={};_0x4f45df[_0xb0a5('0x30')]=_[_0xb0a5('0x46')](db['ZendeskConfiguration'][_0xb0a5('0x47')]);_0x4f45df[_0xb0a5('0x31')]=_['keys'](_0x28b053[_0xb0a5('0x31')]);_0x4f45df[_0xb0a5('0x32')]=_[_0xb0a5('0x33')](_0x4f45df['model'],_0x4f45df[_0xb0a5('0x31')]);_0x4017f0['attributes']=_['intersection'](_0x4f45df[_0xb0a5('0x30')],qs[_0xb0a5('0x35')](_0x28b053[_0xb0a5('0x31')][_0xb0a5('0x35')]));_0x4017f0[_0xb0a5('0x34')]=_0x4017f0['attributes'][_0xb0a5('0x36')]?_0x4017f0[_0xb0a5('0x34')]:_0x4f45df[_0xb0a5('0x30')];if(_0x28b053[_0xb0a5('0x31')][_0xb0a5('0x41')]){_0x4017f0['include']=[{'all':!![]}];}_0x4017f0=_[_0xb0a5('0x3e')]({},_0x4017f0,_0x28b053['options']);return db[_0xb0a5('0x2c')][_0xb0a5('0x48')](_0x4017f0)[_0xb0a5('0x25')](handleEntityNotFound(_0x57380b,null))[_0xb0a5('0x25')](respondWithResult(_0x57380b,null))['catch'](handleError(_0x57380b,null));};exports[_0xb0a5('0x49')]=function(_0x52ffee,_0x1807de){return db[_0xb0a5('0x2c')][_0xb0a5('0x49')](_0x52ffee[_0xb0a5('0x4a')],{})[_0xb0a5('0x25')](respondWithResult(_0x1807de,0xc9))['catch'](handleError(_0x1807de,null));};exports[_0xb0a5('0x4b')]=function(_0x4774d1,_0x46f473){if(_0x4774d1[_0xb0a5('0x4a')]['id']){delete _0x4774d1[_0xb0a5('0x4a')]['id'];}return db[_0xb0a5('0x2c')][_0xb0a5('0x48')]({'where':{'id':_0x4774d1['params']['id']}})[_0xb0a5('0x25')](handleEntityNotFound(_0x46f473,null))[_0xb0a5('0x25')](saveUpdates(_0x4774d1[_0xb0a5('0x4a')],null))[_0xb0a5('0x25')](respondWithResult(_0x46f473,null))['catch'](handleError(_0x46f473,null));};exports[_0xb0a5('0x26')]=function(_0x357176,_0x4ce278){return db[_0xb0a5('0x2c')][_0xb0a5('0x48')]({'where':{'id':_0x357176[_0xb0a5('0x45')]['id']}})[_0xb0a5('0x25')](handleEntityNotFound(_0x4ce278,null))['then'](removeEntity(_0x4ce278,null))['catch'](handleError(_0x4ce278,null));};exports[_0xb0a5('0x4c')]=function(_0x34ed76,_0x3d24bc,_0x19ca8a){var _0x49ed8a={};var _0x4736e1={};var _0x4ee8b5;var _0x11adc9;return db[_0xb0a5('0x2c')][_0xb0a5('0x4d')]({'where':{'id':_0x34ed76['params']['id']}})['then'](handleEntityNotFound(_0x3d24bc,null))[_0xb0a5('0x25')](function(_0x40afcf){if(_0x40afcf){_0x4ee8b5=_0x40afcf;_0x4736e1[_0xb0a5('0x30')]=_[_0xb0a5('0x46')](db[_0xb0a5('0x4e')][_0xb0a5('0x47')]);_0x4736e1['query']=_['keys'](_0x34ed76[_0xb0a5('0x31')]);_0x4736e1[_0xb0a5('0x32')]=_[_0xb0a5('0x33')](_0x4736e1[_0xb0a5('0x30')],_0x4736e1['query']);_0x49ed8a[_0xb0a5('0x34')]=_[_0xb0a5('0x33')](_0x4736e1['model'],qs[_0xb0a5('0x35')](_0x34ed76[_0xb0a5('0x31')][_0xb0a5('0x35')]));_0x49ed8a[_0xb0a5('0x34')]=_0x49ed8a[_0xb0a5('0x34')][_0xb0a5('0x36')]?_0x49ed8a[_0xb0a5('0x34')]:_0x4736e1[_0xb0a5('0x30')];_0x49ed8a['order']=qs[_0xb0a5('0x3a')](_0x34ed76['query'][_0xb0a5('0x3a')]);_0x49ed8a['where']=qs[_0xb0a5('0x32')](_[_0xb0a5('0x3c')](_0x34ed76['query'],_0x4736e1[_0xb0a5('0x32')]));if(_0x34ed76[_0xb0a5('0x31')][_0xb0a5('0x3d')]){_0x49ed8a[_0xb0a5('0x3b')]=_[_0xb0a5('0x3e')](_0x49ed8a['where'],{'$or':_[_0xb0a5('0x2b')](_0x49ed8a[_0xb0a5('0x34')],function(_0x420f47){var _0x14a780={};_0x14a780[_0x420f47]={'$like':'%'+_0x34ed76[_0xb0a5('0x31')][_0xb0a5('0x3d')]+'%'};return _0x14a780;})});}_0x49ed8a=_[_0xb0a5('0x3e')]({},_0x49ed8a,_0x34ed76['options']);return _0x4ee8b5[_0xb0a5('0x4c')](_0x49ed8a);}})[_0xb0a5('0x25')](function(_0xbcd4a0){if(_0xbcd4a0){_0x11adc9=_0xbcd4a0['length'];if(!_0x34ed76[_0xb0a5('0x31')][_0xb0a5('0x37')](_0xb0a5('0x38'))){_0x49ed8a['limit']=qs['limit'](_0x34ed76[_0xb0a5('0x31')][_0xb0a5('0x20')]);_0x49ed8a[_0xb0a5('0x1e')]=qs[_0xb0a5('0x1e')](_0x34ed76[_0xb0a5('0x31')][_0xb0a5('0x1e')]);}return _0x4ee8b5['getFields'](_0x49ed8a);}})[_0xb0a5('0x25')](function(_0x18570f){if(_0x18570f){return _0x18570f?{'count':_0x11adc9,'rows':_0x18570f}:null;}})[_0xb0a5('0x25')](respondWithResult(_0x3d24bc,null))[_0xb0a5('0x4f')](handleError(_0x3d24bc,null));};exports['getSubjects']=function(_0x4e3cd3,_0x47a255,_0x4105e1){var _0x5a7d9f={};var _0x71f89e={};var _0x5634b7;var _0x121c90;return db[_0xb0a5('0x2c')]['findOne']({'where':{'id':_0x4e3cd3['params']['id']}})[_0xb0a5('0x25')](handleEntityNotFound(_0x47a255,null))[_0xb0a5('0x25')](function(_0x413d08){if(_0x413d08){_0x5634b7=_0x413d08;_0x71f89e[_0xb0a5('0x30')]=_[_0xb0a5('0x46')](db['ZendeskField'][_0xb0a5('0x47')]);_0x71f89e[_0xb0a5('0x31')]=_[_0xb0a5('0x46')](_0x4e3cd3[_0xb0a5('0x31')]);_0x71f89e[_0xb0a5('0x32')]=_[_0xb0a5('0x33')](_0x71f89e[_0xb0a5('0x30')],_0x71f89e[_0xb0a5('0x31')]);_0x5a7d9f[_0xb0a5('0x34')]=_[_0xb0a5('0x33')](_0x71f89e[_0xb0a5('0x30')],qs[_0xb0a5('0x35')](_0x4e3cd3[_0xb0a5('0x31')]['fields']));_0x5a7d9f[_0xb0a5('0x34')]=_0x5a7d9f[_0xb0a5('0x34')]['length']?_0x5a7d9f['attributes']:_0x71f89e['model'];_0x5a7d9f[_0xb0a5('0x39')]=qs[_0xb0a5('0x3a')](_0x4e3cd3['query'][_0xb0a5('0x3a')]);_0x5a7d9f[_0xb0a5('0x3b')]=qs[_0xb0a5('0x32')](_[_0xb0a5('0x3c')](_0x4e3cd3[_0xb0a5('0x31')],_0x71f89e[_0xb0a5('0x32')]));if(_0x4e3cd3[_0xb0a5('0x31')][_0xb0a5('0x3d')]){_0x5a7d9f[_0xb0a5('0x3b')]=_[_0xb0a5('0x3e')](_0x5a7d9f[_0xb0a5('0x3b')],{'$or':_['map'](_0x5a7d9f[_0xb0a5('0x34')],function(_0x5aa1c0){var _0x25a453={};_0x25a453[_0x5aa1c0]={'$like':'%'+_0x4e3cd3[_0xb0a5('0x31')][_0xb0a5('0x3d')]+'%'};return _0x25a453;})});}_0x5a7d9f=_['merge']({},_0x5a7d9f,_0x4e3cd3['options']);return _0x5634b7['getSubjects'](_0x5a7d9f);}})[_0xb0a5('0x25')](function(_0x318aba){if(_0x318aba){_0x121c90=_0x318aba[_0xb0a5('0x36')];if(!_0x4e3cd3[_0xb0a5('0x31')][_0xb0a5('0x37')](_0xb0a5('0x38'))){_0x5a7d9f[_0xb0a5('0x20')]=qs[_0xb0a5('0x20')](_0x4e3cd3[_0xb0a5('0x31')][_0xb0a5('0x20')]);_0x5a7d9f[_0xb0a5('0x1e')]=qs[_0xb0a5('0x1e')](_0x4e3cd3['query'][_0xb0a5('0x1e')]);}return _0x5634b7[_0xb0a5('0x50')](_0x5a7d9f);}})[_0xb0a5('0x25')](function(_0x124473){if(_0x124473){return _0x124473?{'count':_0x121c90,'rows':_0x124473}:null;}})[_0xb0a5('0x25')](respondWithResult(_0x47a255,null))[_0xb0a5('0x4f')](handleError(_0x47a255,null));};exports[_0xb0a5('0x51')]=function(_0x3c9327,_0x4ff1d6,_0x179b10){var _0x35715a={};var _0x307cf6={};var _0x3f5663;var _0x3a6aec;return db[_0xb0a5('0x2c')]['findOne']({'where':{'id':_0x3c9327['params']['id']}})[_0xb0a5('0x25')](handleEntityNotFound(_0x4ff1d6,null))[_0xb0a5('0x25')](function(_0x1f5a1d){if(_0x1f5a1d){_0x3f5663=_0x1f5a1d;_0x307cf6['model']=_[_0xb0a5('0x46')](db[_0xb0a5('0x4e')][_0xb0a5('0x47')]);_0x307cf6[_0xb0a5('0x31')]=_[_0xb0a5('0x46')](_0x3c9327['query']);_0x307cf6[_0xb0a5('0x32')]=_[_0xb0a5('0x33')](_0x307cf6[_0xb0a5('0x30')],_0x307cf6['query']);_0x35715a[_0xb0a5('0x34')]=_[_0xb0a5('0x33')](_0x307cf6[_0xb0a5('0x30')],qs[_0xb0a5('0x35')](_0x3c9327['query'][_0xb0a5('0x35')]));_0x35715a[_0xb0a5('0x34')]=_0x35715a[_0xb0a5('0x34')][_0xb0a5('0x36')]?_0x35715a[_0xb0a5('0x34')]:_0x307cf6[_0xb0a5('0x30')];_0x35715a[_0xb0a5('0x39')]=qs['sort'](_0x3c9327['query'][_0xb0a5('0x3a')]);_0x35715a[_0xb0a5('0x3b')]=qs[_0xb0a5('0x32')](_[_0xb0a5('0x3c')](_0x3c9327[_0xb0a5('0x31')],_0x307cf6['filters']));if(_0x3c9327[_0xb0a5('0x31')][_0xb0a5('0x3d')]){_0x35715a[_0xb0a5('0x3b')]=_['merge'](_0x35715a[_0xb0a5('0x3b')],{'$or':_[_0xb0a5('0x2b')](_0x35715a['attributes'],function(_0xa4e2bc){var _0xb58f99={};_0xb58f99[_0xa4e2bc]={'$like':'%'+_0x3c9327['query'][_0xb0a5('0x3d')]+'%'};return _0xb58f99;})});}_0x35715a=_[_0xb0a5('0x3e')]({},_0x35715a,_0x3c9327[_0xb0a5('0x40')]);return _0x3f5663[_0xb0a5('0x51')](_0x35715a);}})['then'](function(_0x580564){if(_0x580564){_0x3a6aec=_0x580564[_0xb0a5('0x36')];if(!_0x3c9327['query'][_0xb0a5('0x37')]('nolimit')){_0x35715a[_0xb0a5('0x20')]=qs[_0xb0a5('0x20')](_0x3c9327['query'][_0xb0a5('0x20')]);_0x35715a[_0xb0a5('0x1e')]=qs[_0xb0a5('0x1e')](_0x3c9327['query']['offset']);}return _0x3f5663[_0xb0a5('0x51')](_0x35715a);}})[_0xb0a5('0x25')](function(_0xe39c7f){if(_0xe39c7f){return _0xe39c7f?{'count':_0x3a6aec,'rows':_0xe39c7f}:null;}})[_0xb0a5('0x25')](respondWithResult(_0x4ff1d6,null))[_0xb0a5('0x4f')](handleError(_0x4ff1d6,null));};exports['getTags']=function(_0x36e51b,_0x300e8a,_0x359dbe){var _0x359ca9={};var _0x22b400={};var _0x50d896;var _0x2fb4c5;return db[_0xb0a5('0x2c')][_0xb0a5('0x4d')]({'where':{'id':_0x36e51b[_0xb0a5('0x45')]['id']}})[_0xb0a5('0x25')](handleEntityNotFound(_0x300e8a,null))['then'](function(_0x4bd6ac){if(_0x4bd6ac){_0x50d896=_0x4bd6ac;_0x22b400[_0xb0a5('0x30')]=_[_0xb0a5('0x46')](db['Tag']['rawAttributes']);_0x22b400[_0xb0a5('0x31')]=_[_0xb0a5('0x46')](_0x36e51b[_0xb0a5('0x31')]);_0x22b400[_0xb0a5('0x32')]=_[_0xb0a5('0x33')](_0x22b400[_0xb0a5('0x30')],_0x22b400[_0xb0a5('0x31')]);_0x359ca9[_0xb0a5('0x34')]=_['intersection'](_0x22b400['model'],qs['fields'](_0x36e51b[_0xb0a5('0x31')][_0xb0a5('0x35')]));_0x359ca9[_0xb0a5('0x34')]=_0x359ca9['attributes'][_0xb0a5('0x36')]?_0x359ca9[_0xb0a5('0x34')]:_0x22b400['model'];_0x359ca9[_0xb0a5('0x39')]=qs[_0xb0a5('0x3a')](_0x36e51b[_0xb0a5('0x31')][_0xb0a5('0x3a')]);_0x359ca9[_0xb0a5('0x3b')]=qs[_0xb0a5('0x32')](_[_0xb0a5('0x3c')](_0x36e51b[_0xb0a5('0x31')],_0x22b400['filters']));if(_0x36e51b['query']['filter']){_0x359ca9[_0xb0a5('0x3b')]=_[_0xb0a5('0x3e')](_0x359ca9['where'],{'$or':_[_0xb0a5('0x2b')](_0x359ca9[_0xb0a5('0x34')],function(_0x4cb55b){var _0x2aa27f={};_0x2aa27f[_0x4cb55b]={'$like':'%'+_0x36e51b[_0xb0a5('0x31')]['filter']+'%'};return _0x2aa27f;})});}_0x359ca9=_[_0xb0a5('0x3e')]({},_0x359ca9,_0x36e51b['options']);return _0x50d896['getTags'](_0x359ca9);}})['then'](function(_0x520457){if(_0x520457){_0x2fb4c5=_0x520457[_0xb0a5('0x36')];if(!_0x36e51b[_0xb0a5('0x31')][_0xb0a5('0x37')](_0xb0a5('0x38'))){_0x359ca9['limit']=qs[_0xb0a5('0x20')](_0x36e51b[_0xb0a5('0x31')]['limit']);_0x359ca9['offset']=qs[_0xb0a5('0x1e')](_0x36e51b[_0xb0a5('0x31')][_0xb0a5('0x1e')]);}return _0x50d896[_0xb0a5('0x52')](_0x359ca9);}})[_0xb0a5('0x25')](function(_0x4f9e90){if(_0x4f9e90){return _0x4f9e90?{'count':_0x2fb4c5,'rows':_0x4f9e90}:null;}})[_0xb0a5('0x25')](respondWithResult(_0x300e8a,null))[_0xb0a5('0x4f')](handleError(_0x300e8a,null));};exports[_0xb0a5('0x53')]=function(_0x38b622,_0x63fbde,_0x32048d){if(_0x38b622['body']['id']){delete _0x38b622[_0xb0a5('0x4a')]['id'];}return db[_0xb0a5('0x2c')]['findOne']({'where':{'id':_0x38b622['params']['id']}})['then'](handleEntityNotFound(_0x63fbde,null))[_0xb0a5('0x25')](function(_0x5adc1f){if(_0x5adc1f){return _0x5adc1f[_0xb0a5('0x53')](_0x38b622['body'][_0xb0a5('0x54')]||[]);}return null;})[_0xb0a5('0x25')](respondWithResult(_0x63fbde,null))['catch'](handleError(_0x63fbde,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 35dc3a6..641bab4 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(_0x3beed1,_0x3a8514){var _0x4628e6=function(_0xd2dd82){while(--_0xd2dd82){_0x3beed1['push'](_0x3beed1['shift']());}};_0x4628e6(++_0x3a8514);}(_0x80ed,0x11c));var _0xd80e=function(_0x35303f,_0x4ac717){_0x35303f=_0x35303f-0x0;var _0x214996=_0x80ed[_0x35303f];return _0x214996;};'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 _0xdb94=['lodash','util','../../config/logger','api','moment','request-promise','path','./intZendeskConfiguration.attributes','ZendeskConfiguration'];(function(_0x3b4e2f,_0x206d7b){var _0xe65be6=function(_0x21ee60){while(--_0x21ee60){_0x3b4e2f['push'](_0x3b4e2f['shift']());}};_0xe65be6(++_0x206d7b);}(_0xdb94,0xab));var _0x4db9=function(_0xe86b03,_0x4f1d99){_0xe86b03=_0xe86b03-0x0;var _0x2711d6=_0xdb94[_0xe86b03];return _0x2711d6;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var logger=require(_0x4db9('0x2'))(_0x4db9('0x3'));var moment=require(_0x4db9('0x4'));var BPromise=require('bluebird');var rp=require(_0x4db9('0x5'));var fs=require('fs');var path=require(_0x4db9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4db9('0x7'));module['exports']=function(_0x47a3f5,_0x31dd9f){return _0x47a3f5['define'](_0x4db9('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 4452322..de5eac1 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 _0x72e3=['result','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x217686,_0x5599e9){var _0x4413e4=function(_0x115027){while(--_0x115027){_0x217686['push'](_0x217686['shift']());}};_0x4413e4(++_0x5599e9);}(_0x72e3,0xe8));var _0x372e=function(_0x16cc8e,_0x2618a2){_0x16cc8e=_0x16cc8e-0x0;var _0x5abb4d=_0x72e3[_0x16cc8e];return _0x5abb4d;};'use strict';var _=require(_0x372e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x372e('0x1'));var rs=require(_0x372e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x372e('0x3'))['db'];var utils=require(_0x372e('0x4'));var logger=require(_0x372e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x372e('0x6'));var client=jayson[_0x372e('0x7')][_0x372e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x250817,_0x573266,_0x16e6d2){return new BPromise(function(_0x1f2258,_0x3141da){return client[_0x372e('0x9')](_0x250817,_0x16e6d2)[_0x372e('0xa')](function(_0x5284e1){logger[_0x372e('0xb')](_0x372e('0xc'),_0x573266,_0x372e('0xd'));logger[_0x372e('0xe')](_0x372e('0xf'),_0x573266,_0x372e('0xd'),JSON[_0x372e('0x10')](_0x5284e1));if(_0x5284e1[_0x372e('0x11')]){if(_0x5284e1['error'][_0x372e('0x12')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x573266,_0x5284e1[_0x372e('0x11')][_0x372e('0x13')]);return _0x3141da(_0x5284e1['error'][_0x372e('0x13')]);}logger[_0x372e('0x11')](_0x372e('0xc'),_0x573266,_0x5284e1[_0x372e('0x11')][_0x372e('0x13')]);return _0x1f2258(_0x5284e1['error'][_0x372e('0x13')]);}else{logger[_0x372e('0xb')](_0x372e('0xc'),_0x573266,_0x372e('0xd'));_0x1f2258(_0x5284e1[_0x372e('0x14')][_0x372e('0x13')]);}})['catch'](function(_0x1d9aa7){logger[_0x372e('0x11')](_0x372e('0xc'),_0x573266,_0x1d9aa7);_0x3141da(_0x1d9aa7);});});} \ No newline at end of file +var _0x8003=['jayson/promise','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x8003,0x1ad));var _0x3800=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x8003[_0x247fa1];return _0x244f35;};'use strict';var _=require(_0x3800('0x0'));var util=require('util');var moment=require(_0x3800('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3800('0x2'));var db=require(_0x3800('0x3'))['db'];var utils=require(_0x3800('0x4'));var logger=require(_0x3800('0x5'))(_0x3800('0x6'));var config=require(_0x3800('0x7'));var jayson=require(_0x3800('0x8'));var client=jayson[_0x3800('0x9')][_0x3800('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ae83f,_0x12d9d4,_0x5a909e){return new BPromise(function(_0x27754d,_0x25922a){return client[_0x3800('0xb')](_0x2ae83f,_0x5a909e)['then'](function(_0x595f6f){logger[_0x3800('0xc')](_0x3800('0xd'),_0x12d9d4,_0x3800('0xe'));logger[_0x3800('0xf')](_0x3800('0x10'),_0x12d9d4,_0x3800('0xe'),JSON[_0x3800('0x11')](_0x595f6f));if(_0x595f6f[_0x3800('0x12')]){if(_0x595f6f[_0x3800('0x12')][_0x3800('0x13')]===0x1f4){logger['error'](_0x3800('0xd'),_0x12d9d4,_0x595f6f[_0x3800('0x12')]['message']);return _0x25922a(_0x595f6f[_0x3800('0x12')][_0x3800('0x14')]);}logger[_0x3800('0x12')](_0x3800('0xd'),_0x12d9d4,_0x595f6f[_0x3800('0x12')]['message']);return _0x27754d(_0x595f6f[_0x3800('0x12')][_0x3800('0x14')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x12d9d4,_0x3800('0xe'));_0x27754d(_0x595f6f[_0x3800('0x15')][_0x3800('0x14')]);}})[_0x3800('0x16')](function(_0x7e117a){logger[_0x3800('0x12')](_0x3800('0xd'),_0x12d9d4,_0x7e117a);_0x25922a(_0x7e117a);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 0f30261..798db42 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 _0xa5ba=['fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x18465f,_0x1c4992){var _0x3a39ae=function(_0x545cda){while(--_0x545cda){_0x18465f['push'](_0x18465f['shift']());}};_0x3a39ae(++_0x1c4992);}(_0xa5ba,0x66));var _0xaa5b=function(_0x3c5abe,_0x1323fb){_0x3c5abe=_0x3c5abe-0x0;var _0x6b69=_0xa5ba[_0x3c5abe];return _0x6b69;};'use strict';var multer=require(_0xaa5b('0x0'));var util=require(_0xaa5b('0x1'));var path=require(_0xaa5b('0x2'));var timeout=require(_0xaa5b('0x3'));var express=require(_0xaa5b('0x4'));var router=express[_0xaa5b('0x5')]();var fs_extra=require(_0xaa5b('0x6'));var auth=require(_0xaa5b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xaa5b('0x8'));var controller=require(_0xaa5b('0x9'));router[_0xaa5b('0xa')]('/',auth[_0xaa5b('0xb')](),controller['index']);router['get'](_0xaa5b('0xc'),auth['isAuthenticated'](),controller[_0xaa5b('0xd')]);router['post']('/',auth[_0xaa5b('0xb')](),controller[_0xaa5b('0xe')]);router['put']('/:id',auth[_0xaa5b('0xb')](),controller[_0xaa5b('0xf')]);router['delete'](_0xaa5b('0xc'),auth[_0xaa5b('0xb')](),controller[_0xaa5b('0x10')]);module[_0xaa5b('0x11')]=router; \ No newline at end of file +var _0xc748=['./intZendeskField.controller','get','isAuthenticated','index','show','create','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5847ab,_0x306925){var _0x15dbd2=function(_0x57a129){while(--_0x57a129){_0x5847ab['push'](_0x5847ab['shift']());}};_0x15dbd2(++_0x306925);}(_0xc748,0x13a));var _0x8c74=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0xc748[_0x3fd3a3];return _0xa3e4d5;};'use strict';var multer=require(_0x8c74('0x0'));var util=require(_0x8c74('0x1'));var path=require(_0x8c74('0x2'));var timeout=require(_0x8c74('0x3'));var express=require(_0x8c74('0x4'));var router=express[_0x8c74('0x5')]();var fs_extra=require(_0x8c74('0x6'));var auth=require(_0x8c74('0x7'));var interaction=require(_0x8c74('0x8'));var config=require(_0x8c74('0x9'));var controller=require(_0x8c74('0xa'));router[_0x8c74('0xb')]('/',auth[_0x8c74('0xc')](),controller[_0x8c74('0xd')]);router[_0x8c74('0xb')]('/:id',auth[_0x8c74('0xc')](),controller[_0x8c74('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8c74('0xf')]);router[_0x8c74('0x10')]('/:id',auth[_0x8c74('0xc')](),controller[_0x8c74('0x11')]);router['delete']('/:id',auth[_0x8c74('0xc')](),controller['destroy']);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 c5595f7..c20b22f 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 _0xa9b4=['sequelize','ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN'];(function(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_0xa9b4,0x144));var _0x4a9b=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9b4[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x4a9b('0x0'));module['exports']={'type':{'type':Sequelize[_0x4a9b('0x1')](_0x4a9b('0x2'),'variable',_0x4a9b('0x3'),_0x4a9b('0x4'),_0x4a9b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4a9b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4a9b('0x1')](_0x4a9b('0x2'),_0x4a9b('0x7'),_0x4a9b('0x3'))},'keyContent':{'type':Sequelize[_0x4a9b('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4a9b('0x6')]},'customField':{'type':Sequelize[_0x4a9b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdcaa=['string','customVariable','picklist','ENUM','variable','STRING','BOOLEAN','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdcaa,0x19c));var _0xadca=function(_0x1abb30,_0x2d964a){_0x1abb30=_0x1abb30-0x0;var _0x3eb779=_0xdcaa[_0x1abb30];return _0x3eb779;};'use strict';var Sequelize=require(_0xadca('0x0'));module[_0xadca('0x1')]={'type':{'type':Sequelize['ENUM'](_0xadca('0x2'),'variable',_0xadca('0x3'),'keyValue',_0xadca('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xadca('0x5')]('string',_0xadca('0x6'),_0xadca('0x3'))},'keyContent':{'type':Sequelize[_0xadca('0x7')]},'idField':{'type':Sequelize[_0xadca('0x7')]},'nameField':{'type':Sequelize[_0xadca('0x7')]},'customField':{'type':Sequelize[_0xadca('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xadca('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index e5dd0c1..6a22379 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 _0x6cba=['find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','update'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6cba,0x173));var _0xa6cb=function(_0x4af269,_0x5c6903){_0x4af269=_0x4af269-0x0;var _0x4dbee8=_0x6cba[_0x4af269];return _0x4dbee8;};'use strict';var emlformat=require(_0xa6cb('0x0'));var rimraf=require(_0xa6cb('0x1'));var zipdir=require(_0xa6cb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa6cb('0x3'));var moment=require(_0xa6cb('0x4'));var BPromise=require(_0xa6cb('0x5'));var Mustache=require(_0xa6cb('0x6'));var util=require(_0xa6cb('0x7'));var path=require(_0xa6cb('0x8'));var sox=require(_0xa6cb('0x9'));var csv=require(_0xa6cb('0xa'));var ejs=require(_0xa6cb('0xb'));var fs=require('fs');var fs_extra=require(_0xa6cb('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa6cb('0xd'));var jsforce=require(_0xa6cb('0xe'));var deskjs=require(_0xa6cb('0xf'));var toCsv=require(_0xa6cb('0xa'));var querystring=require(_0xa6cb('0x10'));var Papa=require(_0xa6cb('0x11'));var Redis=require(_0xa6cb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa6cb('0x13'));var as=require(_0xa6cb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa6cb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa6cb('0x16'));var db=require(_0xa6cb('0x17'))['db'];function respondWithStatusCode(_0x16e50e,_0x437651){_0x437651=_0x437651||0xcc;return function(_0x479626){if(_0x479626){return _0x16e50e[_0xa6cb('0x18')](_0x437651);}return _0x16e50e['status'](_0x437651)[_0xa6cb('0x19')]();};}function respondWithResult(_0x46dd09,_0x355f16){_0x355f16=_0x355f16||0xc8;return function(_0x4b1736){if(_0x4b1736){return _0x46dd09[_0xa6cb('0x1a')](_0x355f16)[_0xa6cb('0x1b')](_0x4b1736);}};}function respondWithFilteredResult(_0x196094,_0x44fc4c){return function(_0x5dc9d5){if(_0x5dc9d5){var _0x15c4ea=typeof _0x44fc4c[_0xa6cb('0x1c')]===_0xa6cb('0x1d')&&typeof _0x44fc4c[_0xa6cb('0x1e')]===_0xa6cb('0x1d');var _0x5bf1c9=_0x5dc9d5['count'];var _0x25bfe3=_0x15c4ea?0x0:_0x44fc4c[_0xa6cb('0x1c')];var _0x566668=_0x15c4ea?_0x5dc9d5[_0xa6cb('0x1f')]:_0x44fc4c[_0xa6cb('0x1c')]+_0x44fc4c[_0xa6cb('0x1e')];var _0x37bf22;if(_0x566668>=_0x5bf1c9){_0x566668=_0x5bf1c9;_0x37bf22=0xc8;}else{_0x37bf22=0xce;}_0x196094[_0xa6cb('0x1a')](_0x37bf22);return _0x196094[_0xa6cb('0x20')](_0xa6cb('0x21'),_0x25bfe3+'-'+_0x566668+'/'+_0x5bf1c9)[_0xa6cb('0x1b')](_0x5dc9d5);}return null;};}function patchUpdates(_0x1ee44b){return function(_0x1c5cc9){try{jsonpatch['apply'](_0x1c5cc9,_0x1ee44b,!![]);}catch(_0x48aab4){return BPromise[_0xa6cb('0x22')](_0x48aab4);}return _0x1c5cc9[_0xa6cb('0x23')]();};}function saveUpdates(_0x24aff1,_0x4d98bf){return function(_0x2fee2b){if(_0x2fee2b){return _0x2fee2b['update'](_0x24aff1)[_0xa6cb('0x24')](function(_0x1c5ffe){return _0x1c5ffe;});}return null;};}function removeEntity(_0x15b3b9,_0x1abf9a){return function(_0xba7486){if(_0xba7486){return _0xba7486[_0xa6cb('0x25')]()['then'](function(){_0x15b3b9[_0xa6cb('0x1a')](0xcc)[_0xa6cb('0x19')]();});}};}function handleEntityNotFound(_0x13f945,_0x36c7a8){return function(_0x5d1554){if(!_0x5d1554){_0x13f945[_0xa6cb('0x18')](0x194);}return _0x5d1554;};}function handleError(_0x155d68,_0x159edb){_0x159edb=_0x159edb||0x1f4;return function(_0x254e9a){logger[_0xa6cb('0x26')](_0x254e9a[_0xa6cb('0x27')]);if(_0x254e9a[_0xa6cb('0x28')]){delete _0x254e9a['name'];}_0x155d68[_0xa6cb('0x1a')](_0x159edb)['send'](_0x254e9a);};}exports['index']=function(_0x481c0e,_0x5ce072){var _0x5cf500={},_0x180d21={},_0x5d1d9a={'count':0x0,'rows':[]};var _0x1517db=_[_0xa6cb('0x29')](db[_0xa6cb('0x2a')][_0xa6cb('0x2b')],function(_0x3c6b74){return{'name':_0x3c6b74[_0xa6cb('0x2c')],'type':_0x3c6b74[_0xa6cb('0x2d')][_0xa6cb('0x2e')]};});_0x180d21[_0xa6cb('0x2f')]=_[_0xa6cb('0x29')](_0x1517db,_0xa6cb('0x28'));_0x180d21[_0xa6cb('0x30')]=_['keys'](_0x481c0e[_0xa6cb('0x30')]);_0x180d21[_0xa6cb('0x31')]=_[_0xa6cb('0x32')](_0x180d21[_0xa6cb('0x2f')],_0x180d21['query']);_0x5cf500['attributes']=_[_0xa6cb('0x32')](_0x180d21[_0xa6cb('0x2f')],qs[_0xa6cb('0x33')](_0x481c0e[_0xa6cb('0x30')][_0xa6cb('0x33')]));_0x5cf500[_0xa6cb('0x34')]=_0x5cf500[_0xa6cb('0x34')][_0xa6cb('0x35')]?_0x5cf500[_0xa6cb('0x34')]:_0x180d21[_0xa6cb('0x2f')];if(!_0x481c0e['query']['hasOwnProperty'](_0xa6cb('0x36'))){_0x5cf500[_0xa6cb('0x1e')]=qs['limit'](_0x481c0e[_0xa6cb('0x30')][_0xa6cb('0x1e')]);_0x5cf500[_0xa6cb('0x1c')]=qs[_0xa6cb('0x1c')](_0x481c0e[_0xa6cb('0x30')][_0xa6cb('0x1c')]);}_0x5cf500['order']=qs['sort'](_0x481c0e['query'][_0xa6cb('0x37')]);_0x5cf500[_0xa6cb('0x38')]=qs[_0xa6cb('0x31')](_[_0xa6cb('0x39')](_0x481c0e['query'],_0x180d21['filters']),_0x1517db);if(_0x481c0e[_0xa6cb('0x30')][_0xa6cb('0x3a')]){_0x5cf500['where']=_[_0xa6cb('0x3b')](_0x5cf500[_0xa6cb('0x38')],{'$or':_[_0xa6cb('0x29')](_0x1517db,function(_0x250291){if(_0x250291['type']!==_0xa6cb('0x3c')){var _0x4319ca={};_0x4319ca[_0x250291[_0xa6cb('0x28')]]={'$like':'%'+_0x481c0e['query'][_0xa6cb('0x3a')]+'%'};return _0x4319ca;}})});}_0x5cf500=_[_0xa6cb('0x3b')]({},_0x5cf500,_0x481c0e[_0xa6cb('0x3d')]);var _0x6f88b7={'where':_0x5cf500[_0xa6cb('0x38')]};return db[_0xa6cb('0x2a')][_0xa6cb('0x1f')](_0x6f88b7)['then'](function(_0x3fca63){_0x5d1d9a[_0xa6cb('0x1f')]=_0x3fca63;if(_0x481c0e[_0xa6cb('0x30')][_0xa6cb('0x3e')]){_0x5cf500[_0xa6cb('0x3f')]=[{'all':!![]}];}return db['ZendeskField'][_0xa6cb('0x40')](_0x5cf500);})['then'](function(_0x16bb9e){_0x5d1d9a[_0xa6cb('0x41')]=_0x16bb9e;return _0x5d1d9a;})[_0xa6cb('0x24')](respondWithFilteredResult(_0x5ce072,_0x5cf500))['catch'](handleError(_0x5ce072,null));};exports[_0xa6cb('0x42')]=function(_0x1ef210,_0x612e57){var _0x395179={'raw':!![],'where':{'id':_0x1ef210[_0xa6cb('0x43')]['id']}},_0x1c472a={};_0x1c472a[_0xa6cb('0x2f')]=_[_0xa6cb('0x44')](db[_0xa6cb('0x2a')][_0xa6cb('0x2b')]);_0x1c472a[_0xa6cb('0x30')]=_[_0xa6cb('0x44')](_0x1ef210['query']);_0x1c472a[_0xa6cb('0x31')]=_[_0xa6cb('0x32')](_0x1c472a[_0xa6cb('0x2f')],_0x1c472a[_0xa6cb('0x30')]);_0x395179[_0xa6cb('0x34')]=_[_0xa6cb('0x32')](_0x1c472a[_0xa6cb('0x2f')],qs[_0xa6cb('0x33')](_0x1ef210[_0xa6cb('0x30')][_0xa6cb('0x33')]));_0x395179[_0xa6cb('0x34')]=_0x395179[_0xa6cb('0x34')][_0xa6cb('0x35')]?_0x395179[_0xa6cb('0x34')]:_0x1c472a[_0xa6cb('0x2f')];if(_0x1ef210[_0xa6cb('0x30')][_0xa6cb('0x3e')]){_0x395179[_0xa6cb('0x3f')]=[{'all':!![]}];}_0x395179=_['merge']({},_0x395179,_0x1ef210[_0xa6cb('0x3d')]);return db[_0xa6cb('0x2a')]['find'](_0x395179)[_0xa6cb('0x24')](handleEntityNotFound(_0x612e57,null))[_0xa6cb('0x24')](respondWithResult(_0x612e57,null))[_0xa6cb('0x45')](handleError(_0x612e57,null));};exports[_0xa6cb('0x46')]=function(_0x24ad15,_0x5f26b8){return db['ZendeskField']['create'](_0x24ad15[_0xa6cb('0x47')],{})['then'](respondWithResult(_0x5f26b8,0xc9))[_0xa6cb('0x45')](handleError(_0x5f26b8,null));};exports[_0xa6cb('0x48')]=function(_0x1af644,_0x6efc2){if(_0x1af644[_0xa6cb('0x47')]['id']){delete _0x1af644['body']['id'];}return db[_0xa6cb('0x2a')][_0xa6cb('0x49')]({'where':{'id':_0x1af644['params']['id']}})[_0xa6cb('0x24')](handleEntityNotFound(_0x6efc2,null))[_0xa6cb('0x24')](saveUpdates(_0x1af644[_0xa6cb('0x47')],null))[_0xa6cb('0x24')](respondWithResult(_0x6efc2,null))['catch'](handleError(_0x6efc2,null));};exports[_0xa6cb('0x25')]=function(_0x469e65,_0x38b01c){return db['ZendeskField']['find']({'where':{'id':_0x469e65[_0xa6cb('0x43')]['id']}})[_0xa6cb('0x24')](handleEntityNotFound(_0x38b01c,null))[_0xa6cb('0x24')](removeEntity(_0x38b01c,null))[_0xa6cb('0x45')](handleError(_0x38b01c,null));}; \ No newline at end of file +var _0x7834=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','map','ZendeskField','fieldName','key','model','name','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','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','api','../../config/utils','../../mysqldb','status','end'];(function(_0x4ffca4,_0x1dfad4){var _0xc7336e=function(_0x436f5d){while(--_0x436f5d){_0x4ffca4['push'](_0x4ffca4['shift']());}};_0xc7336e(++_0x1dfad4);}(_0x7834,0x13f));var _0x4783=function(_0x99250c,_0x4603c0){_0x99250c=_0x99250c-0x0;var _0x3927d5=_0x7834[_0x99250c];return _0x3927d5;};'use strict';var emlformat=require(_0x4783('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4783('0x1'));var rp=require('request-promise');var moment=require(_0x4783('0x2'));var BPromise=require(_0x4783('0x3'));var Mustache=require(_0x4783('0x4'));var util=require(_0x4783('0x5'));var path=require(_0x4783('0x6'));var sox=require(_0x4783('0x7'));var csv=require(_0x4783('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4783('0x9'));var _=require(_0x4783('0xa'));var squel=require('squel');var crypto=require(_0x4783('0xb'));var jsforce=require(_0x4783('0xc'));var deskjs=require(_0x4783('0xd'));var toCsv=require(_0x4783('0x8'));var querystring=require(_0x4783('0xe'));var Papa=require(_0x4783('0xf'));var Redis=require('ioredis');var authService=require(_0x4783('0x10'));var qs=require(_0x4783('0x11'));var as=require(_0x4783('0x12'));var hardwareService=require(_0x4783('0x13'));var logger=require(_0x4783('0x14'))(_0x4783('0x15'));var utils=require(_0x4783('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4783('0x17'))['db'];function respondWithStatusCode(_0x85087d,_0x4ce944){_0x4ce944=_0x4ce944||0xcc;return function(_0x2afbdc){if(_0x2afbdc){return _0x85087d['sendStatus'](_0x4ce944);}return _0x85087d[_0x4783('0x18')](_0x4ce944)[_0x4783('0x19')]();};}function respondWithResult(_0x41d853,_0xecb9f9){_0xecb9f9=_0xecb9f9||0xc8;return function(_0x230ae6){if(_0x230ae6){return _0x41d853['status'](_0xecb9f9)[_0x4783('0x1a')](_0x230ae6);}};}function respondWithFilteredResult(_0x225443,_0x11e996){return function(_0x20788f){if(_0x20788f){var _0x3cb485=typeof _0x11e996[_0x4783('0x1b')]===_0x4783('0x1c')&&typeof _0x11e996[_0x4783('0x1d')]===_0x4783('0x1c');var _0x28c979=_0x20788f[_0x4783('0x1e')];var _0x323a90=_0x3cb485?0x0:_0x11e996['offset'];var _0x465ed7=_0x3cb485?_0x20788f[_0x4783('0x1e')]:_0x11e996['offset']+_0x11e996[_0x4783('0x1d')];var _0x4a9dc8;if(_0x465ed7>=_0x28c979){_0x465ed7=_0x28c979;_0x4a9dc8=0xc8;}else{_0x4a9dc8=0xce;}_0x225443[_0x4783('0x18')](_0x4a9dc8);return _0x225443[_0x4783('0x1f')](_0x4783('0x20'),_0x323a90+'-'+_0x465ed7+'/'+_0x28c979)[_0x4783('0x1a')](_0x20788f);}return null;};}function patchUpdates(_0x1b5e90){return function(_0x2772b3){try{jsonpatch[_0x4783('0x21')](_0x2772b3,_0x1b5e90,!![]);}catch(_0x4e15d7){return BPromise[_0x4783('0x22')](_0x4e15d7);}return _0x2772b3['save']();};}function saveUpdates(_0x429801,_0x2d592f){return function(_0x46ada4){if(_0x46ada4){return _0x46ada4[_0x4783('0x23')](_0x429801)[_0x4783('0x24')](function(_0x54529d){return _0x54529d;});}return null;};}function removeEntity(_0x2633e6,_0x16ee3a){return function(_0xba686e){if(_0xba686e){return _0xba686e[_0x4783('0x25')]()[_0x4783('0x24')](function(){_0x2633e6[_0x4783('0x18')](0xcc)[_0x4783('0x19')]();});}};}function handleEntityNotFound(_0x48da76,_0x22d276){return function(_0x3e45d2){if(!_0x3e45d2){_0x48da76['sendStatus'](0x194);}return _0x3e45d2;};}function handleError(_0x5f2ed1,_0x1d3e22){_0x1d3e22=_0x1d3e22||0x1f4;return function(_0xb5f71c){logger['error'](_0xb5f71c[_0x4783('0x26')]);if(_0xb5f71c['name']){delete _0xb5f71c['name'];}_0x5f2ed1['status'](_0x1d3e22)['send'](_0xb5f71c);};}exports['index']=function(_0x59e49b,_0x250b9d){var _0x589082={},_0x3a996c={},_0x455559={'count':0x0,'rows':[]};var _0x424806=_[_0x4783('0x27')](db[_0x4783('0x28')]['rawAttributes'],function(_0x1e23f4){return{'name':_0x1e23f4[_0x4783('0x29')],'type':_0x1e23f4['type'][_0x4783('0x2a')]};});_0x3a996c[_0x4783('0x2b')]=_['map'](_0x424806,_0x4783('0x2c'));_0x3a996c['query']=_[_0x4783('0x2d')](_0x59e49b['query']);_0x3a996c[_0x4783('0x2e')]=_[_0x4783('0x2f')](_0x3a996c['model'],_0x3a996c[_0x4783('0x30')]);_0x589082[_0x4783('0x31')]=_[_0x4783('0x2f')](_0x3a996c[_0x4783('0x2b')],qs['fields'](_0x59e49b[_0x4783('0x30')][_0x4783('0x32')]));_0x589082[_0x4783('0x31')]=_0x589082[_0x4783('0x31')]['length']?_0x589082[_0x4783('0x31')]:_0x3a996c[_0x4783('0x2b')];if(!_0x59e49b['query'][_0x4783('0x33')](_0x4783('0x34'))){_0x589082[_0x4783('0x1d')]=qs[_0x4783('0x1d')](_0x59e49b[_0x4783('0x30')]['limit']);_0x589082[_0x4783('0x1b')]=qs['offset'](_0x59e49b['query'][_0x4783('0x1b')]);}_0x589082[_0x4783('0x35')]=qs[_0x4783('0x36')](_0x59e49b['query'][_0x4783('0x36')]);_0x589082['where']=qs[_0x4783('0x2e')](_['pick'](_0x59e49b[_0x4783('0x30')],_0x3a996c[_0x4783('0x2e')]),_0x424806);if(_0x59e49b[_0x4783('0x30')]['filter']){_0x589082[_0x4783('0x37')]=_['merge'](_0x589082[_0x4783('0x37')],{'$or':_[_0x4783('0x27')](_0x424806,function(_0x85209b){if(_0x85209b[_0x4783('0x38')]!=='VIRTUAL'){var _0x172958={};_0x172958[_0x85209b[_0x4783('0x2c')]]={'$like':'%'+_0x59e49b[_0x4783('0x30')]['filter']+'%'};return _0x172958;}})});}_0x589082=_[_0x4783('0x39')]({},_0x589082,_0x59e49b[_0x4783('0x3a')]);var _0x1ebdc8={'where':_0x589082['where']};return db['ZendeskField'][_0x4783('0x1e')](_0x1ebdc8)[_0x4783('0x24')](function(_0x373208){_0x455559[_0x4783('0x1e')]=_0x373208;if(_0x59e49b[_0x4783('0x30')][_0x4783('0x3b')]){_0x589082[_0x4783('0x3c')]=[{'all':!![]}];}return db[_0x4783('0x28')][_0x4783('0x3d')](_0x589082);})['then'](function(_0x49e41a){_0x455559[_0x4783('0x3e')]=_0x49e41a;return _0x455559;})['then'](respondWithFilteredResult(_0x250b9d,_0x589082))[_0x4783('0x3f')](handleError(_0x250b9d,null));};exports[_0x4783('0x40')]=function(_0x4708be,_0x3df302){var _0x5e5bc7={'raw':!![],'where':{'id':_0x4708be[_0x4783('0x41')]['id']}},_0x409ac6={};_0x409ac6[_0x4783('0x2b')]=_['keys'](db['ZendeskField'][_0x4783('0x42')]);_0x409ac6[_0x4783('0x30')]=_['keys'](_0x4708be[_0x4783('0x30')]);_0x409ac6['filters']=_[_0x4783('0x2f')](_0x409ac6[_0x4783('0x2b')],_0x409ac6[_0x4783('0x30')]);_0x5e5bc7[_0x4783('0x31')]=_[_0x4783('0x2f')](_0x409ac6[_0x4783('0x2b')],qs[_0x4783('0x32')](_0x4708be[_0x4783('0x30')]['fields']));_0x5e5bc7['attributes']=_0x5e5bc7[_0x4783('0x31')]['length']?_0x5e5bc7[_0x4783('0x31')]:_0x409ac6[_0x4783('0x2b')];if(_0x4708be[_0x4783('0x30')][_0x4783('0x3b')]){_0x5e5bc7[_0x4783('0x3c')]=[{'all':!![]}];}_0x5e5bc7=_[_0x4783('0x39')]({},_0x5e5bc7,_0x4708be[_0x4783('0x3a')]);return db[_0x4783('0x28')][_0x4783('0x43')](_0x5e5bc7)[_0x4783('0x24')](handleEntityNotFound(_0x3df302,null))[_0x4783('0x24')](respondWithResult(_0x3df302,null))[_0x4783('0x3f')](handleError(_0x3df302,null));};exports['create']=function(_0x5f44f9,_0xb416de){return db[_0x4783('0x28')]['create'](_0x5f44f9['body'],{})[_0x4783('0x24')](respondWithResult(_0xb416de,0xc9))[_0x4783('0x3f')](handleError(_0xb416de,null));};exports[_0x4783('0x23')]=function(_0x5b248f,_0x3dbd65){if(_0x5b248f['body']['id']){delete _0x5b248f[_0x4783('0x44')]['id'];}return db[_0x4783('0x28')]['find']({'where':{'id':_0x5b248f['params']['id']}})['then'](handleEntityNotFound(_0x3dbd65,null))[_0x4783('0x24')](saveUpdates(_0x5b248f[_0x4783('0x44')],null))['then'](respondWithResult(_0x3dbd65,null))[_0x4783('0x3f')](handleError(_0x3dbd65,null));};exports[_0x4783('0x25')]=function(_0x51a14f,_0x447ab9){return db['ZendeskField'][_0x4783('0x43')]({'where':{'id':_0x51a14f['params']['id']}})[_0x4783('0x24')](handleEntityNotFound(_0x447ab9,null))['then'](removeEntity(_0x447ab9,null))[_0x4783('0x3f')](handleError(_0x447ab9,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index c3a42ed..641a600 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 _0x3abe=['idField','FieldId','lodash','api','request-promise','path','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index'];(function(_0x24eda8,_0x1416cd){var _0x372428=function(_0x4bb6c8){while(--_0x4bb6c8){_0x24eda8['push'](_0x24eda8['shift']());}};_0x372428(++_0x1416cd);}(_0x3abe,0x7b));var _0xe3ab=function(_0x432fbd,_0x3bc1eb){_0x432fbd=_0x432fbd-0x0;var _0x13c8b1=_0x3abe[_0x432fbd];return _0x13c8b1;};'use strict';var _=require(_0xe3ab('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe3ab('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe3ab('0x2'));var fs=require('fs');var path=require(_0xe3ab('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe3ab('0x4'));module['exports']=function(_0x13e50c,_0x209351){return _0x13e50c[_0xe3ab('0x5')](_0xe3ab('0x6'),attributes,{'tableName':_0xe3ab('0x7'),'paranoid':![],'indexes':[{'name':_0xe3ab('0x8'),'fields':[_0xe3ab('0x9'),_0xe3ab('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf744=['bluebird','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment'];(function(_0x5aee2d,_0x111038){var _0x4daa97=function(_0xa2da52){while(--_0xa2da52){_0x5aee2d['push'](_0x5aee2d['shift']());}};_0x4daa97(++_0x111038);}(_0xf744,0xdd));var _0x4f74=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xf744[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0x4f74('0x0'));var util=require(_0x4f74('0x1'));var logger=require(_0x4f74('0x2'))('api');var moment=require(_0x4f74('0x3'));var BPromise=require(_0x4f74('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f74('0x5'));var rimraf=require(_0x4f74('0x6'));var config=require(_0x4f74('0x7'));var attributes=require(_0x4f74('0x8'));module[_0x4f74('0x9')]=function(_0x21abab,_0x48cf14){return _0x21abab[_0x4f74('0xa')]('ZendeskField',attributes,{'tableName':_0x4f74('0xb'),'paranoid':![],'indexes':[{'name':_0x4f74('0xc'),'fields':[_0x4f74('0xd'),_0x4f74('0xe')],'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 00c1942..937a1ee 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 _0xc43f=['client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x56eb02,_0x1f4beb){var _0x535ee4=function(_0xd143ba){while(--_0xd143ba){_0x56eb02['push'](_0x56eb02['shift']());}};_0x535ee4(++_0x1f4beb);}(_0xc43f,0x120));var _0xfc43=function(_0x2cdf5b,_0x41eece){_0x2cdf5b=_0x2cdf5b-0x0;var _0x87798e=_0xc43f[_0x2cdf5b];return _0x87798e;};'use strict';var _=require(_0xfc43('0x0'));var util=require(_0xfc43('0x1'));var moment=require(_0xfc43('0x2'));var BPromise=require(_0xfc43('0x3'));var rs=require(_0xfc43('0x4'));var fs=require('fs');var Redis=require(_0xfc43('0x5'));var db=require(_0xfc43('0x6'))['db'];var utils=require(_0xfc43('0x7'));var logger=require('../../config/logger')(_0xfc43('0x8'));var config=require(_0xfc43('0x9'));var jayson=require(_0xfc43('0xa'));var client=jayson[_0xfc43('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x241725,_0x91ede3,_0x5c032c){return new BPromise(function(_0x218a81,_0x943dd9){return client[_0xfc43('0xc')](_0x241725,_0x5c032c)[_0xfc43('0xd')](function(_0x49cd71){logger[_0xfc43('0xe')](_0xfc43('0xf'),_0x91ede3,_0xfc43('0x10'));logger[_0xfc43('0x11')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x91ede3,_0xfc43('0x10'),JSON[_0xfc43('0x12')](_0x49cd71));if(_0x49cd71[_0xfc43('0x13')]){if(_0x49cd71[_0xfc43('0x13')][_0xfc43('0x14')]===0x1f4){logger[_0xfc43('0x13')](_0xfc43('0xf'),_0x91ede3,_0x49cd71[_0xfc43('0x13')][_0xfc43('0x15')]);return _0x943dd9(_0x49cd71['error'][_0xfc43('0x15')]);}logger['error'](_0xfc43('0xf'),_0x91ede3,_0x49cd71[_0xfc43('0x13')][_0xfc43('0x15')]);return _0x218a81(_0x49cd71[_0xfc43('0x13')][_0xfc43('0x15')]);}else{logger[_0xfc43('0xe')](_0xfc43('0xf'),_0x91ede3,_0xfc43('0x10'));_0x218a81(_0x49cd71['result'][_0xfc43('0x15')]);}})[_0xfc43('0x16')](function(_0xfeb098){logger[_0xfc43('0x13')](_0xfc43('0xf'),_0x91ede3,_0xfeb098);_0x943dd9(_0xfeb098);});});} \ No newline at end of file +var _0x7ec9=['request','then','info','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ZendeskField,\x20%s,\x20%s','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x559b2d,_0x18cc0f){var _0x16f956=function(_0x17ad10){while(--_0x17ad10){_0x559b2d['push'](_0x559b2d['shift']());}};_0x16f956(++_0x18cc0f);}(_0x7ec9,0x19a));var _0x97ec=function(_0x2136a6,_0x35af63){_0x2136a6=_0x2136a6-0x0;var _0x55b948=_0x7ec9[_0x2136a6];return _0x55b948;};'use strict';var _=require(_0x97ec('0x0'));var util=require(_0x97ec('0x1'));var moment=require('moment');var BPromise=require(_0x97ec('0x2'));var rs=require(_0x97ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x97ec('0x5'))('rpc');var config=require(_0x97ec('0x6'));var jayson=require(_0x97ec('0x7'));var client=jayson[_0x97ec('0x8')][_0x97ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57c6e7,_0x3cece6,_0x5a0fc4){return new BPromise(function(_0x5c0eea,_0x34476d){return client[_0x97ec('0xa')](_0x57c6e7,_0x5a0fc4)[_0x97ec('0xb')](function(_0x278249){logger[_0x97ec('0xc')]('ZendeskField,\x20%s,\x20%s',_0x3cece6,'request\x20sent');logger['debug'](_0x97ec('0xd'),_0x3cece6,_0x97ec('0xe'),JSON['stringify'](_0x278249));if(_0x278249[_0x97ec('0xf')]){if(_0x278249['error'][_0x97ec('0x10')]===0x1f4){logger[_0x97ec('0xf')]('ZendeskField,\x20%s,\x20%s',_0x3cece6,_0x278249[_0x97ec('0xf')]['message']);return _0x34476d(_0x278249[_0x97ec('0xf')][_0x97ec('0x11')]);}logger[_0x97ec('0xf')]('ZendeskField,\x20%s,\x20%s',_0x3cece6,_0x278249[_0x97ec('0xf')][_0x97ec('0x11')]);return _0x5c0eea(_0x278249[_0x97ec('0xf')]['message']);}else{logger[_0x97ec('0xc')]('ZendeskField,\x20%s,\x20%s',_0x3cece6,_0x97ec('0xe'));_0x5c0eea(_0x278249[_0x97ec('0x12')]['message']);}})[_0x97ec('0x13')](function(_0x294b94){logger[_0x97ec('0xf')](_0x97ec('0x14'),_0x3cece6,_0x294b94);_0x34476d(_0x294b94);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 9833c5f..ce0927c 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 _0xd1b8=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','show','isAuthenticated','getConfigurations','post','create','/:id/configurations','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xd1b8,0x9a));var _0x8d1b=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0xd1b8[_0x30b0d8];return _0x459c09;};'use strict';var multer=require(_0x8d1b('0x0'));var util=require(_0x8d1b('0x1'));var path=require(_0x8d1b('0x2'));var timeout=require(_0x8d1b('0x3'));var express=require('express');var router=express[_0x8d1b('0x4')]();var fs_extra=require(_0x8d1b('0x5'));var auth=require(_0x8d1b('0x6'));var interaction=require(_0x8d1b('0x7'));var config=require(_0x8d1b('0x8'));var controller=require(_0x8d1b('0x9'));router[_0x8d1b('0xa')]('/',auth['isAuthenticated'](),controller[_0x8d1b('0xb')]);router[_0x8d1b('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x8d1b('0xc')]);router[_0x8d1b('0xa')]('/:id/configurations',auth[_0x8d1b('0xd')](),controller[_0x8d1b('0xe')]);router[_0x8d1b('0xa')]('/:id/fields',auth[_0x8d1b('0xd')](),controller['getFields']);router[_0x8d1b('0xf')]('/',auth['isAuthenticated'](),controller[_0x8d1b('0x10')]);router[_0x8d1b('0xf')](_0x8d1b('0x11'),auth[_0x8d1b('0xd')](),controller['addConfiguration']);router[_0x8d1b('0x12')](_0x8d1b('0x13'),auth[_0x8d1b('0xd')](),controller['update']);router[_0x8d1b('0x14')](_0x8d1b('0x13'),auth[_0x8d1b('0xd')](),controller[_0x8d1b('0x15')]);module[_0x8d1b('0x16')]=router; \ No newline at end of file +var _0x3a2a=['get','index','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','put','/:id','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller'];(function(_0x1b2748,_0x159312){var _0xb28c40=function(_0x2eef84){while(--_0x2eef84){_0x1b2748['push'](_0x1b2748['shift']());}};_0xb28c40(++_0x159312);}(_0x3a2a,0x1db));var _0xa3a2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3a2a[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xa3a2('0x0'));var util=require(_0xa3a2('0x1'));var path=require(_0xa3a2('0x2'));var timeout=require('connect-timeout');var express=require(_0xa3a2('0x3'));var router=express['Router']();var fs_extra=require(_0xa3a2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa3a2('0x5'));var config=require(_0xa3a2('0x6'));var controller=require(_0xa3a2('0x7'));router[_0xa3a2('0x8')]('/',auth['isAuthenticated'](),controller[_0xa3a2('0x9')]);router[_0xa3a2('0x8')]('/:id',auth[_0xa3a2('0xa')](),controller[_0xa3a2('0xb')]);router[_0xa3a2('0x8')]('/:id/configurations',auth[_0xa3a2('0xa')](),controller[_0xa3a2('0xc')]);router['get'](_0xa3a2('0xd'),auth[_0xa3a2('0xa')](),controller[_0xa3a2('0xe')]);router[_0xa3a2('0xf')]('/',auth[_0xa3a2('0xa')](),controller[_0xa3a2('0x10')]);router[_0xa3a2('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xa3a2('0x11')]('/:id',auth[_0xa3a2('0xa')](),controller['update']);router['delete'](_0xa3a2('0x12'),auth['isAuthenticated'](),controller[_0xa3a2('0x13')]);module[_0xa3a2('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 019fc6e..d5f6a71 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 _0xf4eb=['sequelize','STRING'];(function(_0x40f3ca,_0x28c114){var _0x4df35d=function(_0xbc0519){while(--_0xbc0519){_0x40f3ca['push'](_0x40f3ca['shift']());}};_0x4df35d(++_0x28c114);}(_0xf4eb,0xec));var _0xbf4e=function(_0x56c840,_0x45f02b){_0x56c840=_0x56c840-0x0;var _0x3dd372=_0xf4eb[_0x56c840];return _0x3dd372;};'use strict';var Sequelize=require(_0xbf4e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xbf4e('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xbf4e('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xbf4e('0x1')]},'refreshToken':{'type':Sequelize[_0xbf4e('0x1')]}}; \ No newline at end of file +var _0xf109=['exports','STRING','sequelize'];(function(_0x251c6d,_0x4652d1){var _0x4f0bf3=function(_0x105b36){while(--_0x105b36){_0x251c6d['push'](_0x251c6d['shift']());}};_0x4f0bf3(++_0x4652d1);}(_0xf109,0xce));var _0x9f10=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xf109[_0x342baa];return _0x1208f3;};'use strict';var Sequelize=require(_0x9f10('0x0'));module[_0x9f10('0x1')]={'name':{'type':Sequelize[_0x9f10('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x9f10('0x2')]},'clientSecret':{'type':Sequelize[_0x9f10('0x2')]},'serverUrl':{'type':Sequelize[_0x9f10('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x9f10('0x2')]},'refreshToken':{'type':Sequelize[_0x9f10('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index bafae96..d1a59f0 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 _0xa535=['limit','undefined','set','Content-Range','json','apply','reject','destroy','then','error','stack','name','send','ZohoAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','find','create','update','body','findOne','ZohoConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','access_token','getFields','serverUrl','code','host','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','Zoho-oauthtoken\x20','response','Owner','Call_Duration','Call_Result','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','pick_list_values','test','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset'];(function(_0x31bca9,_0x1fac97){var _0x54af10=function(_0x5f502b){while(--_0x5f502b){_0x31bca9['push'](_0x31bca9['shift']());}};_0x54af10(++_0x1fac97);}(_0xa535,0x145));var _0x5a53=function(_0xfbcb23,_0x56c545){_0xfbcb23=_0xfbcb23-0x0;var _0x588786=_0xa535[_0xfbcb23];return _0x588786;};'use strict';var emlformat=require(_0x5a53('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a53('0x1'));var jsonpatch=require(_0x5a53('0x2'));var rp=require('request-promise');var moment=require(_0x5a53('0x3'));var BPromise=require(_0x5a53('0x4'));var Mustache=require('mustache');var util=require(_0x5a53('0x5'));var path=require(_0x5a53('0x6'));var sox=require('sox');var csv=require(_0x5a53('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a53('0x8'));var _=require(_0x5a53('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5a53('0xa'));var deskjs=require(_0x5a53('0xb'));var toCsv=require(_0x5a53('0x7'));var querystring=require(_0x5a53('0xc'));var Papa=require(_0x5a53('0xd'));var Redis=require('ioredis');var authService=require(_0x5a53('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a53('0xf'));var logger=require(_0x5a53('0x10'))('api');var utils=require(_0x5a53('0x11'));var config=require(_0x5a53('0x12'));var licenseUtil=require(_0x5a53('0x13'));var db=require(_0x5a53('0x14'))['db'];var integrations=require(_0x5a53('0x15'));function respondWithStatusCode(_0x580031,_0x4111e4){_0x4111e4=_0x4111e4||0xcc;return function(_0x5635f8){if(_0x5635f8){return _0x580031[_0x5a53('0x16')](_0x4111e4);}return _0x580031[_0x5a53('0x17')](_0x4111e4)[_0x5a53('0x18')]();};}function respondWithResult(_0x332fe6,_0x561f26){_0x561f26=_0x561f26||0xc8;return function(_0x2f4a5){if(_0x2f4a5){return _0x332fe6[_0x5a53('0x17')](_0x561f26)['json'](_0x2f4a5);}};}function respondWithFilteredResult(_0x569996,_0x2e4cfe){return function(_0x305b6c){if(_0x305b6c){var _0x2789a3=typeof _0x2e4cfe[_0x5a53('0x19')]==='undefined'&&typeof _0x2e4cfe[_0x5a53('0x1a')]===_0x5a53('0x1b');var _0x591cd3=_0x305b6c['count'];var _0x162c83=_0x2789a3?0x0:_0x2e4cfe[_0x5a53('0x19')];var _0x7be47=_0x2789a3?_0x305b6c['count']:_0x2e4cfe['offset']+_0x2e4cfe[_0x5a53('0x1a')];var _0x57d77e;if(_0x7be47>=_0x591cd3){_0x7be47=_0x591cd3;_0x57d77e=0xc8;}else{_0x57d77e=0xce;}_0x569996[_0x5a53('0x17')](_0x57d77e);return _0x569996[_0x5a53('0x1c')](_0x5a53('0x1d'),_0x162c83+'-'+_0x7be47+'/'+_0x591cd3)[_0x5a53('0x1e')](_0x305b6c);}return null;};}function patchUpdates(_0x28e364){return function(_0x1a3f6c){try{jsonpatch[_0x5a53('0x1f')](_0x1a3f6c,_0x28e364,!![]);}catch(_0x544497){return BPromise[_0x5a53('0x20')](_0x544497);}return _0x1a3f6c['save']();};}function saveUpdates(_0x68a505,_0x36fd41){return function(_0x1667c5){if(_0x1667c5){return _0x1667c5['update'](_0x68a505)['then'](function(_0x159f6b){return _0x159f6b;});}return null;};}function removeEntity(_0x235926,_0x44ec86){return function(_0x2d0949){if(_0x2d0949){return _0x2d0949[_0x5a53('0x21')]()[_0x5a53('0x22')](function(){_0x235926['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x379e79,_0x5b8ae5){return function(_0x4bfae5){if(!_0x4bfae5){_0x379e79['sendStatus'](0x194);}return _0x4bfae5;};}function handleError(_0x4015ef,_0x109a70){_0x109a70=_0x109a70||0x1f4;return function(_0x4c0dee){logger[_0x5a53('0x23')](_0x4c0dee[_0x5a53('0x24')]);if(_0x4c0dee[_0x5a53('0x25')]){delete _0x4c0dee['name'];}_0x4015ef[_0x5a53('0x17')](_0x109a70)[_0x5a53('0x26')](_0x4c0dee);};}exports['index']=function(_0x4cd3c0,_0x254305){var _0x13cecd={},_0x39ce5c={},_0x430a7b={'count':0x0,'rows':[]};var _0x22f462=_['map'](db[_0x5a53('0x27')][_0x5a53('0x28')],function(_0x42673e){return{'name':_0x42673e['fieldName'],'type':_0x42673e[_0x5a53('0x29')][_0x5a53('0x2a')]};});_0x39ce5c[_0x5a53('0x2b')]=_[_0x5a53('0x2c')](_0x22f462,_0x5a53('0x25'));_0x39ce5c[_0x5a53('0x2d')]=_[_0x5a53('0x2e')](_0x4cd3c0[_0x5a53('0x2d')]);_0x39ce5c[_0x5a53('0x2f')]=_[_0x5a53('0x30')](_0x39ce5c[_0x5a53('0x2b')],_0x39ce5c[_0x5a53('0x2d')]);_0x13cecd[_0x5a53('0x31')]=_[_0x5a53('0x30')](_0x39ce5c[_0x5a53('0x2b')],qs[_0x5a53('0x32')](_0x4cd3c0['query'][_0x5a53('0x32')]));_0x13cecd[_0x5a53('0x31')]=_0x13cecd['attributes'][_0x5a53('0x33')]?_0x13cecd[_0x5a53('0x31')]:_0x39ce5c['model'];if(!_0x4cd3c0[_0x5a53('0x2d')][_0x5a53('0x34')](_0x5a53('0x35'))){_0x13cecd[_0x5a53('0x1a')]=qs[_0x5a53('0x1a')](_0x4cd3c0[_0x5a53('0x2d')][_0x5a53('0x1a')]);_0x13cecd[_0x5a53('0x19')]=qs[_0x5a53('0x19')](_0x4cd3c0[_0x5a53('0x2d')][_0x5a53('0x19')]);}_0x13cecd[_0x5a53('0x36')]=qs[_0x5a53('0x37')](_0x4cd3c0[_0x5a53('0x2d')][_0x5a53('0x37')]);_0x13cecd[_0x5a53('0x38')]=qs['filters'](_[_0x5a53('0x39')](_0x4cd3c0[_0x5a53('0x2d')],_0x39ce5c[_0x5a53('0x2f')]),_0x22f462);if(_0x4cd3c0[_0x5a53('0x2d')][_0x5a53('0x3a')]){_0x13cecd['where']=_[_0x5a53('0x3b')](_0x13cecd[_0x5a53('0x38')],{'$or':_[_0x5a53('0x2c')](_0x22f462,function(_0x20864f){if(_0x20864f[_0x5a53('0x29')]!==_0x5a53('0x3c')){var _0x1bb544={};_0x1bb544[_0x20864f['name']]={'$like':'%'+_0x4cd3c0[_0x5a53('0x2d')][_0x5a53('0x3a')]+'%'};return _0x1bb544;}})});}_0x13cecd=_['merge']({},_0x13cecd,_0x4cd3c0[_0x5a53('0x3d')]);var _0x46e80b={'where':_0x13cecd[_0x5a53('0x38')]};return db[_0x5a53('0x27')][_0x5a53('0x3e')](_0x46e80b)['then'](function(_0x302d6c){_0x430a7b['count']=_0x302d6c;if(_0x4cd3c0[_0x5a53('0x2d')][_0x5a53('0x3f')]){_0x13cecd[_0x5a53('0x40')]=[{'all':!![]}];}return db[_0x5a53('0x27')]['findAll'](_0x13cecd);})[_0x5a53('0x22')](function(_0x182a5c){_0x430a7b['rows']=_0x182a5c;return _0x430a7b;})['then'](respondWithFilteredResult(_0x254305,_0x13cecd))[_0x5a53('0x41')](handleError(_0x254305,null));};exports[_0x5a53('0x42')]=function(_0x13d1f8,_0x4ee851){var _0xdf2ccb={'raw':![],'where':{'id':_0x13d1f8[_0x5a53('0x43')]['id']}},_0x2e4f85={};_0x2e4f85[_0x5a53('0x2b')]=_['keys'](db[_0x5a53('0x27')][_0x5a53('0x28')]);_0x2e4f85[_0x5a53('0x2d')]=_[_0x5a53('0x2e')](_0x13d1f8[_0x5a53('0x2d')]);_0x2e4f85[_0x5a53('0x2f')]=_[_0x5a53('0x30')](_0x2e4f85[_0x5a53('0x2b')],_0x2e4f85['query']);_0xdf2ccb[_0x5a53('0x31')]=_[_0x5a53('0x30')](_0x2e4f85[_0x5a53('0x2b')],qs['fields'](_0x13d1f8[_0x5a53('0x2d')][_0x5a53('0x32')]));_0xdf2ccb[_0x5a53('0x31')]=_0xdf2ccb[_0x5a53('0x31')][_0x5a53('0x33')]?_0xdf2ccb[_0x5a53('0x31')]:_0x2e4f85[_0x5a53('0x2b')];if(_0x13d1f8['query'][_0x5a53('0x3f')]){_0xdf2ccb[_0x5a53('0x40')]=[{'all':!![]}];}_0xdf2ccb=_[_0x5a53('0x3b')]({},_0xdf2ccb,_0x13d1f8[_0x5a53('0x3d')]);return db['ZohoAccount'][_0x5a53('0x44')](_0xdf2ccb)[_0x5a53('0x22')](handleEntityNotFound(_0x4ee851,null))[_0x5a53('0x22')](respondWithResult(_0x4ee851,null))['catch'](handleError(_0x4ee851,null));};exports[_0x5a53('0x45')]=function(_0x8769f3,_0x4dea91){return db['ZohoAccount'][_0x5a53('0x45')](_0x8769f3['body'],{})[_0x5a53('0x22')](respondWithResult(_0x4dea91,0xc9))[_0x5a53('0x41')](handleError(_0x4dea91,null));};exports[_0x5a53('0x46')]=function(_0x1a4672,_0x57a8c5){if(_0x1a4672[_0x5a53('0x47')]['id']){delete _0x1a4672[_0x5a53('0x47')]['id'];}return db['ZohoAccount'][_0x5a53('0x44')]({'where':{'id':_0x1a4672[_0x5a53('0x43')]['id']}})[_0x5a53('0x22')](handleEntityNotFound(_0x57a8c5,null))[_0x5a53('0x22')](saveUpdates(_0x1a4672[_0x5a53('0x47')],null))[_0x5a53('0x22')](respondWithResult(_0x57a8c5,null))['catch'](handleError(_0x57a8c5,null));};exports[_0x5a53('0x21')]=function(_0x52eba9,_0x4c08f7){return db[_0x5a53('0x27')][_0x5a53('0x44')]({'where':{'id':_0x52eba9[_0x5a53('0x43')]['id']}})[_0x5a53('0x22')](handleEntityNotFound(_0x4c08f7,null))[_0x5a53('0x22')](removeEntity(_0x4c08f7,null))['catch'](handleError(_0x4c08f7,null));};exports['getConfigurations']=function(_0x258d81,_0x47ab40,_0x3371da){var _0x6a434f={};var _0x3a8191={};var _0x21465f;var _0x185a37;return db[_0x5a53('0x27')][_0x5a53('0x48')]({'where':{'id':_0x258d81[_0x5a53('0x43')]['id']}})['then'](handleEntityNotFound(_0x47ab40,null))[_0x5a53('0x22')](function(_0x1755d9){if(_0x1755d9){_0x21465f=_0x1755d9;_0x3a8191[_0x5a53('0x2b')]=_[_0x5a53('0x2e')](db[_0x5a53('0x49')][_0x5a53('0x28')]);_0x3a8191['query']=_['keys'](_0x258d81['query']);_0x3a8191['filters']=_['intersection'](_0x3a8191['model'],_0x3a8191[_0x5a53('0x2d')]);_0x6a434f[_0x5a53('0x31')]=_[_0x5a53('0x30')](_0x3a8191[_0x5a53('0x2b')],qs['fields'](_0x258d81['query'][_0x5a53('0x32')]));_0x6a434f[_0x5a53('0x31')]=_0x6a434f['attributes'][_0x5a53('0x33')]?_0x6a434f['attributes']:_0x3a8191[_0x5a53('0x2b')];_0x6a434f['order']=qs[_0x5a53('0x37')](_0x258d81['query'][_0x5a53('0x37')]);_0x6a434f[_0x5a53('0x38')]=qs['filters'](_[_0x5a53('0x39')](_0x258d81['query'],_0x3a8191['filters']));if(_0x258d81['query']['filter']){_0x6a434f[_0x5a53('0x38')]=_[_0x5a53('0x3b')](_0x6a434f['where'],{'$or':_[_0x5a53('0x2c')](_0x6a434f[_0x5a53('0x31')],function(_0x458e0b){var _0x147cd8={};_0x147cd8[_0x458e0b]={'$like':'%'+_0x258d81[_0x5a53('0x2d')]['filter']+'%'};return _0x147cd8;})});}_0x6a434f=_[_0x5a53('0x3b')]({},_0x6a434f,_0x258d81[_0x5a53('0x3d')]);return _0x21465f[_0x5a53('0x4a')](_0x6a434f);}})[_0x5a53('0x22')](function(_0x8da35b){if(_0x8da35b){_0x185a37=_0x8da35b['length'];if(!_0x258d81[_0x5a53('0x2d')][_0x5a53('0x34')](_0x5a53('0x35'))){_0x6a434f['limit']=qs['limit'](_0x258d81[_0x5a53('0x2d')]['limit']);_0x6a434f[_0x5a53('0x19')]=qs[_0x5a53('0x19')](_0x258d81[_0x5a53('0x2d')][_0x5a53('0x19')]);}return _0x21465f[_0x5a53('0x4a')](_0x6a434f);}})['then'](function(_0x24c3b1){if(_0x24c3b1){return _0x24c3b1?{'count':_0x185a37,'rows':_0x24c3b1}:null;}})[_0x5a53('0x22')](respondWithResult(_0x47ab40,null))[_0x5a53('0x41')](handleError(_0x47ab40,null));};exports[_0x5a53('0x4b')]=function(_0x43ade0,_0x14ebff,_0x2ec368){if(_0x43ade0['body']['id']){delete _0x43ade0[_0x5a53('0x47')]['id'];}return db[_0x5a53('0x27')][_0x5a53('0x48')]({'where':{'id':_0x43ade0[_0x5a53('0x43')]['id']}})[_0x5a53('0x22')](handleEntityNotFound(_0x14ebff,null))['then'](function(_0x28306a){if(_0x28306a){_0x43ade0[_0x5a53('0x47')]['AccountId']=_0x28306a['id'];_0x43ade0[_0x5a53('0x47')][_0x5a53('0x4c')]=integrations[_0x5a53('0x4d')](_0x43ade0[_0x5a53('0x47')][_0x5a53('0x4e')],_0x43ade0[_0x5a53('0x47')][_0x5a53('0x29')]);_0x43ade0[_0x5a53('0x47')][_0x5a53('0x4f')]=integrations[_0x5a53('0x50')](_0x43ade0[_0x5a53('0x47')][_0x5a53('0x4e')],_0x43ade0['body'][_0x5a53('0x29')]);return db[_0x5a53('0x49')]['create'](_0x43ade0[_0x5a53('0x47')],{'include':[{'model':db['ZohoField'],'as':_0x5a53('0x4c')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x14ebff,null))[_0x5a53('0x41')](handleError(_0x14ebff,null));};function getAccessToken(_0x1bbece){return new Promise(function(_0x2e3263,_0x88c701){var _0xf366dc;switch(_0x1bbece[_0x5a53('0x51')]){case'US':_0xf366dc=_0x5a53('0x52');break;case'AU':_0xf366dc='https://accounts.zoho.com.au';break;case'EU':_0xf366dc=_0x5a53('0x53');break;case'IN':_0xf366dc=_0x5a53('0x54');break;case'CN':_0xf366dc=_0x5a53('0x55');break;default:_0xf366dc='https://accounts.zoho.eu';break;}var _0x485f35={'method':_0x5a53('0x56'),'uri':_0xf366dc+'/oauth/v2/token','qs':{'refresh_token':_0x1bbece[_0x5a53('0x57')],'client_id':_0x1bbece[_0x5a53('0x58')],'client_secret':_0x1bbece['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x485f35)[_0x5a53('0x22')](function(_0x18ea4b){if(_0x18ea4b['access_token']){_0x2e3263(_0x18ea4b[_0x5a53('0x59')]);}else{_0x88c701('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0xf281eb){_0x88c701(_0xf281eb);});});}exports[_0x5a53('0x5a')]=function(_0x3a83ae,_0x3ffb3c,_0x3cec34){var _0x3f0d13,_0x100ebd,_0x5bca7b,_0x33271a,_0xd6bae6;return db[_0x5a53('0x27')][_0x5a53('0x48')]({'where':{'id':_0x3a83ae[_0x5a53('0x43')]['id']},'attributes':['id','host',_0x5a53('0x51'),_0x5a53('0x58'),'clientSecret',_0x5a53('0x5b'),_0x5a53('0x5c'),'refreshToken']})[_0x5a53('0x22')](handleEntityNotFound(_0x3ffb3c,null))[_0x5a53('0x22')](function(_0x34ce9c){_0xd6bae6=_0x34ce9c;_0x3f0d13=_0xd6bae6[_0x5a53('0x5d')];_0x100ebd=_0x3f0d13==='zoho.eu'?'eu':_0x5a53('0x5e');_0x5bca7b=_0xd6bae6[_0x5a53('0x5b')];var _0x75f323=_0x5bca7b[_0x5a53('0x5f')](-0x1);if(_0x75f323==='/'||_0x75f323==='\x5c'||_0x75f323===':'){_0x5bca7b=_0x5bca7b[_0x5a53('0x60')](0x0,_0x5bca7b[_0x5a53('0x61')](_0x75f323));}if(!_0xd6bae6['refreshToken']){throw new Error(_0x5a53('0x62'));}return getAccessToken(_0xd6bae6);})[_0x5a53('0x22')](function(_0x52cd94){if(_0x52cd94){return rp({'method':_0x5a53('0x63'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x100ebd),'qs':{'module':_0x5a53('0x64')},'headers':{'Authorization':_0x5a53('0x65')+_0x52cd94},'json':!![]});}})[_0x5a53('0x22')](function(_0x1e3735){if(_0x1e3735){if(_0x1e3735[_0x5a53('0x66')]&&_0x1e3735[_0x5a53('0x66')][_0x5a53('0x23')]){throw new Error(_0x1e3735[_0x5a53('0x66')][_0x5a53('0x23')]['message']);}var _0x32fb6d=[];var _0x5d234f=[];var _0x6484f0=[_0x5a53('0x67'),'Subject','Description','WhoId',_0x5a53('0x68'),_0x5a53('0x69'),'Call_Start_Time',_0x5a53('0x6a')];_0x5d234f=_['remove'](_0x1e3735['fields'],function(_0x1763de){return _0x6484f0[_0x5a53('0x6b')](_0x1763de[_0x5a53('0x6c')]);});for(var _0x17ff8c=0x0;_0x17ff8c<_0x5d234f[_0x5a53('0x33')];_0x17ff8c++){if(_0x5d234f[_0x17ff8c][_0x5a53('0x6d')]===![]){_0x32fb6d[_0x5a53('0x6e')]({'id':_0x5d234f[_0x17ff8c]['id'],'name':_0x5d234f[_0x17ff8c][_0x5a53('0x6f')],'custom':_0x5d234f[_0x17ff8c][_0x5a53('0x70')],'options':_0x5d234f[_0x17ff8c]['data_type']==='picklist'&&_0x5d234f[_0x17ff8c][_0x5a53('0x71')][_0x5a53('0x33')]>-0x1?_[_0x5a53('0x2c')](_0x5d234f[_0x17ff8c]['pick_list_values'],function(_0x1a0d31){return{'name':_0x1a0d31,'value':_0x1a0d31};}):[]});}}return{'count':_0x32fb6d['length'],'rows':_0x32fb6d};}else{return{'count':0x0,'rows':[]};}})[_0x5a53('0x22')](respondWithResult(_0x3ffb3c,null))[_0x5a53('0x41')](function(_0x5dd621){var _0x458e3c=_0x3a83ae[_0x5a53('0x2d')][_0x5a53('0x72')]?0x1f4:_0x5dd621['statusCode']||0x1f4;logger[_0x5a53('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x5a53('0x5a'),_0x458e3c,JSON['stringify'](_0x5dd621));delete _0x5dd621[_0x5a53('0x25')];if(_0x458e3c===0x191){_0x458e3c=0x190;}_0x3ffb3c['status'](_0x458e3c)[_0x5a53('0x26')](_0x3a83ae[_0x5a53('0x2d')][_0x5a53('0x72')]?{'message':_0x5a53('0x73'),'statusCode':_0x5dd621[_0x5a53('0x74')]}:_0x5dd621);});}; \ No newline at end of file +var _0xfec8=['Call_Duration','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','ZohoAccount','type','model','map','query','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','keys','rawAttributes','fields','include','options','find','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','order','hasOwnProperty','AccountId','channel','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfec8,0x107));var _0x8fec=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0xfec8[_0x3e7e96];return _0x13f6f0;};'use strict';var emlformat=require(_0x8fec('0x0'));var rimraf=require(_0x8fec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8fec('0x2'));var rp=require('request-promise');var moment=require(_0x8fec('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8fec('0x4'));var path=require(_0x8fec('0x5'));var sox=require(_0x8fec('0x6'));var csv=require('to-csv');var ejs=require(_0x8fec('0x7'));var fs=require('fs');var fs_extra=require(_0x8fec('0x8'));var _=require(_0x8fec('0x9'));var squel=require(_0x8fec('0xa'));var crypto=require(_0x8fec('0xb'));var jsforce=require(_0x8fec('0xc'));var deskjs=require(_0x8fec('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8fec('0xe'));var Papa=require('papaparse');var Redis=require(_0x8fec('0xf'));var authService=require(_0x8fec('0x10'));var qs=require(_0x8fec('0x11'));var as=require(_0x8fec('0x12'));var hardwareService=require(_0x8fec('0x13'));var logger=require(_0x8fec('0x14'))(_0x8fec('0x15'));var utils=require(_0x8fec('0x16'));var config=require(_0x8fec('0x17'));var licenseUtil=require(_0x8fec('0x18'));var db=require(_0x8fec('0x19'))['db'];var integrations=require(_0x8fec('0x1a'));function respondWithStatusCode(_0x4a43bb,_0x362761){_0x362761=_0x362761||0xcc;return function(_0x114f60){if(_0x114f60){return _0x4a43bb[_0x8fec('0x1b')](_0x362761);}return _0x4a43bb[_0x8fec('0x1c')](_0x362761)[_0x8fec('0x1d')]();};}function respondWithResult(_0x652e36,_0x1d7ab8){_0x1d7ab8=_0x1d7ab8||0xc8;return function(_0x4c036f){if(_0x4c036f){return _0x652e36['status'](_0x1d7ab8)['json'](_0x4c036f);}};}function respondWithFilteredResult(_0x5b2ded,_0x1a841b){return function(_0x1fe9c5){if(_0x1fe9c5){var _0x338180=typeof _0x1a841b[_0x8fec('0x1e')]===_0x8fec('0x1f')&&typeof _0x1a841b[_0x8fec('0x20')]===_0x8fec('0x1f');var _0x79aae3=_0x1fe9c5['count'];var _0x58fb6f=_0x338180?0x0:_0x1a841b[_0x8fec('0x1e')];var _0x1237f2=_0x338180?_0x1fe9c5[_0x8fec('0x21')]:_0x1a841b[_0x8fec('0x1e')]+_0x1a841b[_0x8fec('0x20')];var _0x235d6f;if(_0x1237f2>=_0x79aae3){_0x1237f2=_0x79aae3;_0x235d6f=0xc8;}else{_0x235d6f=0xce;}_0x5b2ded[_0x8fec('0x1c')](_0x235d6f);return _0x5b2ded[_0x8fec('0x22')](_0x8fec('0x23'),_0x58fb6f+'-'+_0x1237f2+'/'+_0x79aae3)[_0x8fec('0x24')](_0x1fe9c5);}return null;};}function patchUpdates(_0x5183c3){return function(_0x32b4c7){try{jsonpatch['apply'](_0x32b4c7,_0x5183c3,!![]);}catch(_0x1b404d){return BPromise[_0x8fec('0x25')](_0x1b404d);}return _0x32b4c7[_0x8fec('0x26')]();};}function saveUpdates(_0x66f18c,_0x32ce0a){return function(_0x1b54a7){if(_0x1b54a7){return _0x1b54a7[_0x8fec('0x27')](_0x66f18c)[_0x8fec('0x28')](function(_0x1ef3df){return _0x1ef3df;});}return null;};}function removeEntity(_0x304df3,_0x1a25f0){return function(_0xee42a3){if(_0xee42a3){return _0xee42a3['destroy']()[_0x8fec('0x28')](function(){_0x304df3[_0x8fec('0x1c')](0xcc)[_0x8fec('0x1d')]();});}};}function handleEntityNotFound(_0x4edd39,_0x1bad84){return function(_0x44c988){if(!_0x44c988){_0x4edd39[_0x8fec('0x1b')](0x194);}return _0x44c988;};}function handleError(_0x2f018e,_0x1049f0){_0x1049f0=_0x1049f0||0x1f4;return function(_0x5522ac){logger[_0x8fec('0x29')](_0x5522ac[_0x8fec('0x2a')]);if(_0x5522ac[_0x8fec('0x2b')]){delete _0x5522ac['name'];}_0x2f018e[_0x8fec('0x1c')](_0x1049f0)['send'](_0x5522ac);};}exports['index']=function(_0xdf7b80,_0x3a8d3e){var _0x362ba1={},_0x5983b7={},_0x3ca793={'count':0x0,'rows':[]};var _0x2dee1e=_['map'](db[_0x8fec('0x2c')]['rawAttributes'],function(_0x5e6472){return{'name':_0x5e6472['fieldName'],'type':_0x5e6472[_0x8fec('0x2d')]['key']};});_0x5983b7[_0x8fec('0x2e')]=_[_0x8fec('0x2f')](_0x2dee1e,_0x8fec('0x2b'));_0x5983b7[_0x8fec('0x30')]=_['keys'](_0xdf7b80[_0x8fec('0x30')]);_0x5983b7[_0x8fec('0x31')]=_[_0x8fec('0x32')](_0x5983b7[_0x8fec('0x2e')],_0x5983b7[_0x8fec('0x30')]);_0x362ba1[_0x8fec('0x33')]=_[_0x8fec('0x32')](_0x5983b7[_0x8fec('0x2e')],qs['fields'](_0xdf7b80[_0x8fec('0x30')]['fields']));_0x362ba1[_0x8fec('0x33')]=_0x362ba1[_0x8fec('0x33')][_0x8fec('0x34')]?_0x362ba1['attributes']:_0x5983b7['model'];if(!_0xdf7b80[_0x8fec('0x30')]['hasOwnProperty'](_0x8fec('0x35'))){_0x362ba1[_0x8fec('0x20')]=qs[_0x8fec('0x20')](_0xdf7b80[_0x8fec('0x30')]['limit']);_0x362ba1['offset']=qs['offset'](_0xdf7b80['query'][_0x8fec('0x1e')]);}_0x362ba1['order']=qs['sort'](_0xdf7b80[_0x8fec('0x30')][_0x8fec('0x36')]);_0x362ba1[_0x8fec('0x37')]=qs[_0x8fec('0x31')](_[_0x8fec('0x38')](_0xdf7b80[_0x8fec('0x30')],_0x5983b7[_0x8fec('0x31')]),_0x2dee1e);if(_0xdf7b80[_0x8fec('0x30')][_0x8fec('0x39')]){_0x362ba1[_0x8fec('0x37')]=_[_0x8fec('0x3a')](_0x362ba1[_0x8fec('0x37')],{'$or':_[_0x8fec('0x2f')](_0x2dee1e,function(_0x251f8c){if(_0x251f8c[_0x8fec('0x2d')]!==_0x8fec('0x3b')){var _0x2f47f4={};_0x2f47f4[_0x251f8c[_0x8fec('0x2b')]]={'$like':'%'+_0xdf7b80['query'][_0x8fec('0x39')]+'%'};return _0x2f47f4;}})});}_0x362ba1=_['merge']({},_0x362ba1,_0xdf7b80['options']);var _0x110c87={'where':_0x362ba1[_0x8fec('0x37')]};return db[_0x8fec('0x2c')][_0x8fec('0x21')](_0x110c87)['then'](function(_0x1d2944){_0x3ca793['count']=_0x1d2944;if(_0xdf7b80[_0x8fec('0x30')][_0x8fec('0x3c')]){_0x362ba1['include']=[{'all':!![]}];}return db['ZohoAccount'][_0x8fec('0x3d')](_0x362ba1);})['then'](function(_0x122807){_0x3ca793[_0x8fec('0x3e')]=_0x122807;return _0x3ca793;})['then'](respondWithFilteredResult(_0x3a8d3e,_0x362ba1))[_0x8fec('0x3f')](handleError(_0x3a8d3e,null));};exports['show']=function(_0x4f903a,_0x160c8f){var _0x4e2576={'raw':![],'where':{'id':_0x4f903a[_0x8fec('0x40')]['id']}},_0x32ce80={};_0x32ce80[_0x8fec('0x2e')]=_[_0x8fec('0x41')](db[_0x8fec('0x2c')][_0x8fec('0x42')]);_0x32ce80[_0x8fec('0x30')]=_[_0x8fec('0x41')](_0x4f903a['query']);_0x32ce80[_0x8fec('0x31')]=_['intersection'](_0x32ce80[_0x8fec('0x2e')],_0x32ce80[_0x8fec('0x30')]);_0x4e2576[_0x8fec('0x33')]=_[_0x8fec('0x32')](_0x32ce80['model'],qs[_0x8fec('0x43')](_0x4f903a[_0x8fec('0x30')]['fields']));_0x4e2576[_0x8fec('0x33')]=_0x4e2576[_0x8fec('0x33')][_0x8fec('0x34')]?_0x4e2576[_0x8fec('0x33')]:_0x32ce80[_0x8fec('0x2e')];if(_0x4f903a[_0x8fec('0x30')]['includeAll']){_0x4e2576[_0x8fec('0x44')]=[{'all':!![]}];}_0x4e2576=_[_0x8fec('0x3a')]({},_0x4e2576,_0x4f903a[_0x8fec('0x45')]);return db[_0x8fec('0x2c')][_0x8fec('0x46')](_0x4e2576)['then'](handleEntityNotFound(_0x160c8f,null))[_0x8fec('0x28')](respondWithResult(_0x160c8f,null))['catch'](handleError(_0x160c8f,null));};exports[_0x8fec('0x47')]=function(_0x7c957b,_0xe5f03){return db[_0x8fec('0x2c')][_0x8fec('0x47')](_0x7c957b[_0x8fec('0x48')],{})[_0x8fec('0x28')](respondWithResult(_0xe5f03,0xc9))['catch'](handleError(_0xe5f03,null));};exports['update']=function(_0x2f2979,_0x45ad76){if(_0x2f2979[_0x8fec('0x48')]['id']){delete _0x2f2979[_0x8fec('0x48')]['id'];}return db[_0x8fec('0x2c')]['find']({'where':{'id':_0x2f2979[_0x8fec('0x40')]['id']}})[_0x8fec('0x28')](handleEntityNotFound(_0x45ad76,null))[_0x8fec('0x28')](saveUpdates(_0x2f2979[_0x8fec('0x48')],null))['then'](respondWithResult(_0x45ad76,null))[_0x8fec('0x3f')](handleError(_0x45ad76,null));};exports[_0x8fec('0x49')]=function(_0x2f575d,_0xa08a6){return db['ZohoAccount'][_0x8fec('0x46')]({'where':{'id':_0x2f575d[_0x8fec('0x40')]['id']}})[_0x8fec('0x28')](handleEntityNotFound(_0xa08a6,null))[_0x8fec('0x28')](removeEntity(_0xa08a6,null))[_0x8fec('0x3f')](handleError(_0xa08a6,null));};exports[_0x8fec('0x4a')]=function(_0x589f80,_0x3c3f1d,_0x4f427b){var _0xbe937c={};var _0x361cde={};var _0x153ceb;var _0x14e878;return db[_0x8fec('0x2c')][_0x8fec('0x4b')]({'where':{'id':_0x589f80[_0x8fec('0x40')]['id']}})[_0x8fec('0x28')](handleEntityNotFound(_0x3c3f1d,null))[_0x8fec('0x28')](function(_0x5535cb){if(_0x5535cb){_0x153ceb=_0x5535cb;_0x361cde[_0x8fec('0x2e')]=_[_0x8fec('0x41')](db[_0x8fec('0x4c')][_0x8fec('0x42')]);_0x361cde[_0x8fec('0x30')]=_[_0x8fec('0x41')](_0x589f80['query']);_0x361cde[_0x8fec('0x31')]=_['intersection'](_0x361cde[_0x8fec('0x2e')],_0x361cde[_0x8fec('0x30')]);_0xbe937c[_0x8fec('0x33')]=_[_0x8fec('0x32')](_0x361cde[_0x8fec('0x2e')],qs['fields'](_0x589f80[_0x8fec('0x30')][_0x8fec('0x43')]));_0xbe937c[_0x8fec('0x33')]=_0xbe937c[_0x8fec('0x33')][_0x8fec('0x34')]?_0xbe937c[_0x8fec('0x33')]:_0x361cde[_0x8fec('0x2e')];_0xbe937c[_0x8fec('0x4d')]=qs[_0x8fec('0x36')](_0x589f80[_0x8fec('0x30')]['sort']);_0xbe937c[_0x8fec('0x37')]=qs['filters'](_['pick'](_0x589f80[_0x8fec('0x30')],_0x361cde[_0x8fec('0x31')]));if(_0x589f80[_0x8fec('0x30')]['filter']){_0xbe937c[_0x8fec('0x37')]=_[_0x8fec('0x3a')](_0xbe937c[_0x8fec('0x37')],{'$or':_[_0x8fec('0x2f')](_0xbe937c['attributes'],function(_0x2ee2ee){var _0x56bb8b={};_0x56bb8b[_0x2ee2ee]={'$like':'%'+_0x589f80[_0x8fec('0x30')][_0x8fec('0x39')]+'%'};return _0x56bb8b;})});}_0xbe937c=_[_0x8fec('0x3a')]({},_0xbe937c,_0x589f80[_0x8fec('0x45')]);return _0x153ceb[_0x8fec('0x4a')](_0xbe937c);}})[_0x8fec('0x28')](function(_0x535cd9){if(_0x535cd9){_0x14e878=_0x535cd9[_0x8fec('0x34')];if(!_0x589f80[_0x8fec('0x30')][_0x8fec('0x4e')](_0x8fec('0x35'))){_0xbe937c[_0x8fec('0x20')]=qs[_0x8fec('0x20')](_0x589f80['query'][_0x8fec('0x20')]);_0xbe937c[_0x8fec('0x1e')]=qs[_0x8fec('0x1e')](_0x589f80['query']['offset']);}return _0x153ceb[_0x8fec('0x4a')](_0xbe937c);}})['then'](function(_0x400d5b){if(_0x400d5b){return _0x400d5b?{'count':_0x14e878,'rows':_0x400d5b}:null;}})[_0x8fec('0x28')](respondWithResult(_0x3c3f1d,null))['catch'](handleError(_0x3c3f1d,null));};exports['addConfiguration']=function(_0x254734,_0x4fa162,_0x1559c6){if(_0x254734['body']['id']){delete _0x254734[_0x8fec('0x48')]['id'];}return db[_0x8fec('0x2c')]['findOne']({'where':{'id':_0x254734[_0x8fec('0x40')]['id']}})[_0x8fec('0x28')](handleEntityNotFound(_0x4fa162,null))[_0x8fec('0x28')](function(_0x58e26b){if(_0x58e26b){_0x254734[_0x8fec('0x48')][_0x8fec('0x4f')]=_0x58e26b['id'];_0x254734['body']['Subjects']=integrations['getSubjects'](_0x254734['body'][_0x8fec('0x50')],_0x254734['body'][_0x8fec('0x2d')]);_0x254734[_0x8fec('0x48')][_0x8fec('0x51')]=integrations['getDescriptions'](_0x254734['body']['channel'],_0x254734[_0x8fec('0x48')][_0x8fec('0x2d')]);return db[_0x8fec('0x4c')][_0x8fec('0x47')](_0x254734['body'],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x8fec('0x51')}]});}return null;})[_0x8fec('0x28')](respondWithResult(_0x4fa162,null))[_0x8fec('0x3f')](handleError(_0x4fa162,null));};function getAccessToken(_0x194d98){return new Promise(function(_0x2f3ff0,_0xe56fd2){var _0x58a4b0;switch(_0x194d98[_0x8fec('0x52')]){case'US':_0x58a4b0=_0x8fec('0x53');break;case'AU':_0x58a4b0=_0x8fec('0x54');break;case'EU':_0x58a4b0=_0x8fec('0x55');break;case'IN':_0x58a4b0=_0x8fec('0x56');break;case'CN':_0x58a4b0='https://accounts.zoho.com.cn';break;default:_0x58a4b0=_0x8fec('0x55');break;}var _0x4b79b5={'method':'POST','uri':_0x58a4b0+'/oauth/v2/token','qs':{'refresh_token':_0x194d98[_0x8fec('0x57')],'client_id':_0x194d98[_0x8fec('0x58')],'client_secret':_0x194d98[_0x8fec('0x59')],'grant_type':_0x8fec('0x5a')},'json':!![]};return rp(_0x4b79b5)[_0x8fec('0x28')](function(_0x5920c7){if(_0x5920c7['access_token']){_0x2f3ff0(_0x5920c7[_0x8fec('0x5b')]);}else{_0xe56fd2(_0x8fec('0x5c'));}})[_0x8fec('0x3f')](function(_0x575a83){_0xe56fd2(_0x575a83);});});}exports[_0x8fec('0x5d')]=function(_0x5ab9f2,_0x1469d3,_0x1d87aa){var _0x144a71,_0x141722,_0x3802b8,_0x126406,_0x285453;return db[_0x8fec('0x2c')][_0x8fec('0x4b')]({'where':{'id':_0x5ab9f2[_0x8fec('0x40')]['id']},'attributes':['id',_0x8fec('0x5e'),_0x8fec('0x52'),_0x8fec('0x58'),_0x8fec('0x59'),_0x8fec('0x5f'),_0x8fec('0x60'),_0x8fec('0x57')]})[_0x8fec('0x28')](handleEntityNotFound(_0x1469d3,null))['then'](function(_0x534b17){_0x285453=_0x534b17;_0x144a71=_0x285453[_0x8fec('0x5e')];_0x141722=_0x144a71===_0x8fec('0x61')?'eu':'com';_0x3802b8=_0x285453[_0x8fec('0x5f')];var _0xd8907=_0x3802b8[_0x8fec('0x62')](-0x1);if(_0xd8907==='/'||_0xd8907==='\x5c'||_0xd8907===':'){_0x3802b8=_0x3802b8['substring'](0x0,_0x3802b8['lastIndexOf'](_0xd8907));}if(!_0x285453[_0x8fec('0x57')]){throw new Error(_0x8fec('0x63'));}return getAccessToken(_0x285453);})['then'](function(_0x13d433){if(_0x13d433){return rp({'method':_0x8fec('0x64'),'uri':util[_0x8fec('0x65')](_0x8fec('0x66'),_0x141722),'qs':{'module':_0x8fec('0x67')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x13d433},'json':!![]});}})[_0x8fec('0x28')](function(_0x34fd8d){if(_0x34fd8d){if(_0x34fd8d['response']&&_0x34fd8d[_0x8fec('0x68')][_0x8fec('0x29')]){throw new Error(_0x34fd8d[_0x8fec('0x68')][_0x8fec('0x29')][_0x8fec('0x69')]);}var _0x460873=[];var _0x41d2db=[];var _0x2cb457=['Owner','Subject','Description','WhoId',_0x8fec('0x6a'),_0x8fec('0x6b'),'Call_Start_Time',_0x8fec('0x6c')];_0x41d2db=_[_0x8fec('0x6d')](_0x34fd8d[_0x8fec('0x43')],function(_0x475a5b){return _0x2cb457[_0x8fec('0x6e')](_0x475a5b[_0x8fec('0x6f')]);});for(var _0x71f8d4=0x0;_0x71f8d4<_0x41d2db[_0x8fec('0x34')];_0x71f8d4++){if(_0x41d2db[_0x71f8d4][_0x8fec('0x70')]===![]){_0x460873['push']({'id':_0x41d2db[_0x71f8d4]['id'],'name':_0x41d2db[_0x71f8d4][_0x8fec('0x71')],'custom':_0x41d2db[_0x71f8d4][_0x8fec('0x72')],'options':_0x41d2db[_0x71f8d4][_0x8fec('0x73')]===_0x8fec('0x74')&&_0x41d2db[_0x71f8d4][_0x8fec('0x75')][_0x8fec('0x34')]>-0x1?_['map'](_0x41d2db[_0x71f8d4]['pick_list_values'],function(_0x17829d){return{'name':_0x17829d,'value':_0x17829d};}):[]});}}return{'count':_0x460873[_0x8fec('0x34')],'rows':_0x460873};}else{return{'count':0x0,'rows':[]};}})[_0x8fec('0x28')](respondWithResult(_0x1469d3,null))[_0x8fec('0x3f')](function(_0x5a886e){var _0x1281fb=_0x5ab9f2['query']['test']?0x1f4:_0x5a886e[_0x8fec('0x76')]||0x1f4;logger[_0x8fec('0x29')](_0x8fec('0x77'),_0x8fec('0x5d'),_0x1281fb,JSON[_0x8fec('0x78')](_0x5a886e));delete _0x5a886e[_0x8fec('0x2b')];if(_0x1281fb===0x191){_0x1281fb=0x190;}_0x1469d3[_0x8fec('0x1c')](_0x1281fb)['send'](_0x5ab9f2[_0x8fec('0x30')][_0x8fec('0x79')]?{'message':_0x8fec('0x7a'),'statusCode':_0x5a886e[_0x8fec('0x76')]}:_0x5a886e);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 2372cca..73f128a 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 _0x6299=['serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','clientSecret','application/x-www-form-urlencoded','then','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','/oauth/v2/token','parse','refreshToken','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','clientId','code','host'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x6299,0x169));var _0x9629=function(_0xb22f73,_0x927062){_0xb22f73=_0xb22f73-0x0;var _0x524d7a=_0x6299[_0xb22f73];return _0x524d7a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9629('0x0'))(_0x9629('0x1'));var moment=require(_0x9629('0x2'));var BPromise=require(_0x9629('0x3'));var rp=require(_0x9629('0x4'));var fs=require('fs');var path=require(_0x9629('0x5'));var rimraf=require('rimraf');var config=require(_0x9629('0x6'));var attributes=require(_0x9629('0x7'));var integrations=require(_0x9629('0x8'));module[_0x9629('0x9')]=function(_0x1206bf,_0x5d5981){return _0x1206bf['define'](_0x9629('0xa'),attributes,{'tableName':_0x9629('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x533868,_0x555ca5,_0x4fca40){if(_0x533868[_0x9629('0xc')](_0x9629('0xd'))||_0x533868[_0x9629('0xc')]('serverUrl')||_0x533868[_0x9629('0xc')](_0x9629('0xe'))||_0x533868[_0x9629('0xc')]('clientSecret')||_0x533868[_0x9629('0xc')](_0x9629('0xf'))||_0x533868[_0x9629('0xc')](_0x9629('0x10'))){var _0x37a60e,_0x4e7334;_0x37a60e=_0x533868[_0x9629('0x11')];var _0xb53308=_0x37a60e[_0x9629('0x12')](-0x1);if(_0xb53308==='/'||_0xb53308==='\x5c'||_0xb53308===':'){_0x37a60e=_0x37a60e[_0x9629('0x13')](0x0,_0x37a60e[_0x9629('0x14')](_0xb53308));}switch(_0x533868[_0x9629('0xd')]){case'US':_0x4e7334='https://accounts.zoho.com';break;case'AU':_0x4e7334=_0x9629('0x15');break;case'IN':_0x4e7334=_0x9629('0x16');break;case'CN':_0x4e7334=_0x9629('0x17');break;default:_0x4e7334=_0x9629('0x18');break;}var _0xa4b554={'method':_0x9629('0x19'),'uri':_0x4e7334+'/oauth/v2/token','form':{'grant_type':_0x9629('0x1a'),'client_id':_0x533868[_0x9629('0xe')],'client_secret':_0x533868[_0x9629('0x1b')],'redirect_uri':_0x533868[_0x9629('0x11')],'code':_0x533868[_0x9629('0xf')]},'headers':{'Content-Type':_0x9629('0x1c')}};return rp(_0xa4b554)[_0x9629('0x1d')](function(_0x447f28){var _0x1fbacf=JSON['parse'](_0x447f28);if(_0x1fbacf[_0x9629('0x1e')]){_0x533868['refreshToken']=_0x1fbacf[_0x9629('0x1e')];logger[_0x9629('0x1f')](util['format'](_0x9629('0x20'),_0x533868[_0x9629('0x21')],_0x533868['id']));}else{logger[_0x9629('0x22')](util[_0x9629('0x23')](_0x9629('0x24'),_0x533868['name'],_0x533868['id']),util['inspect'](_0x1fbacf,{'showHidden':![],'depth':null}));}return _0x4fca40(null,_0x555ca5);})[_0x9629('0x25')](function(_0x169576){logger[_0x9629('0x22')](util['format'](_0x9629('0x24'),_0x533868[_0x9629('0x21')],_0x533868['id']),util[_0x9629('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x4fca40(_0x169576);});}else{return _0x4fca40(null,_0x555ca5);}},'beforeUpdate':function(_0x4ae0c7,_0x5caac4,_0x558e99){if(_0x4ae0c7[_0x9629('0xc')](_0x9629('0xd'))||_0x4ae0c7[_0x9629('0xc')](_0x9629('0x11'))||_0x4ae0c7[_0x9629('0xc')]('clientId')||_0x4ae0c7[_0x9629('0xc')]('clientSecret')||_0x4ae0c7[_0x9629('0xc')](_0x9629('0xf'))||_0x4ae0c7[_0x9629('0xc')](_0x9629('0x10'))){var _0x13a3b2,_0xe7c85c;_0x13a3b2=_0x4ae0c7[_0x9629('0x11')];var _0x4248f3=_0x13a3b2[_0x9629('0x12')](-0x1);if(_0x4248f3==='/'||_0x4248f3==='\x5c'||_0x4248f3===':'){_0x13a3b2=_0x13a3b2['substring'](0x0,_0x13a3b2[_0x9629('0x14')](_0x4248f3));}switch(_0x4ae0c7[_0x9629('0xd')]){case'US':_0xe7c85c='https://accounts.zoho.com';break;case'AU':_0xe7c85c=_0x9629('0x15');break;case'IN':_0xe7c85c=_0x9629('0x16');break;case'CN':_0xe7c85c=_0x9629('0x17');break;default:_0xe7c85c=_0x9629('0x18');break;}var _0x5f319d={'method':_0x9629('0x19'),'uri':_0xe7c85c+_0x9629('0x27'),'form':{'grant_type':'authorization_code','client_id':_0x4ae0c7[_0x9629('0xe')],'client_secret':_0x4ae0c7['clientSecret'],'redirect_uri':_0x4ae0c7[_0x9629('0x11')],'code':_0x4ae0c7[_0x9629('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x5f319d)['then'](function(_0x2942ab){var _0x2cd400=JSON[_0x9629('0x28')](_0x2942ab);if(_0x2cd400[_0x9629('0x1e')]){_0x4ae0c7[_0x9629('0x29')]=_0x2cd400[_0x9629('0x1e')];logger[_0x9629('0x1f')](util[_0x9629('0x23')](_0x9629('0x20'),_0x4ae0c7[_0x9629('0x21')],_0x4ae0c7['id']));}else{logger[_0x9629('0x22')](util['format'](_0x9629('0x24'),_0x4ae0c7['name'],_0x4ae0c7['id']),util[_0x9629('0x26')](_0x2cd400,{'showHidden':![],'depth':null}));}return _0x558e99(null,_0x5caac4);})[_0x9629('0x25')](function(_0x1ab2e8){logger[_0x9629('0x22')](util[_0x9629('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4ae0c7[_0x9629('0x21')],_0x4ae0c7['id']),util[_0x9629('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x558e99(_0x1ab2e8);});}else{return _0x558e99(null,_0x5caac4);}}}});}; \ No newline at end of file +var _0xf741=['then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','substring','https://accounts.zoho.eu','POST','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','slice','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded'];(function(_0x38a2a9,_0xb5ecd5){var _0x3d7053=function(_0x5c1412){while(--_0x5c1412){_0x38a2a9['push'](_0x38a2a9['shift']());}};_0x3d7053(++_0xb5ecd5);}(_0xf741,0xb6));var _0x1f74=function(_0x1a085b,_0x28fd55){_0x1a085b=_0x1a085b-0x0;var _0xacff4=_0xf741[_0x1a085b];return _0xacff4;};'use strict';var _=require(_0x1f74('0x0'));var util=require(_0x1f74('0x1'));var logger=require(_0x1f74('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1f74('0x3'));var rp=require(_0x1f74('0x4'));var fs=require('fs');var path=require(_0x1f74('0x5'));var rimraf=require('rimraf');var config=require(_0x1f74('0x6'));var attributes=require(_0x1f74('0x7'));var integrations=require(_0x1f74('0x8'));module[_0x1f74('0x9')]=function(_0x55ed9a,_0x2b8adb){return _0x55ed9a[_0x1f74('0xa')](_0x1f74('0xb'),attributes,{'tableName':_0x1f74('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xbceb4b,_0xe9de29,_0xf89f62){if(_0xbceb4b[_0x1f74('0xd')]('zone')||_0xbceb4b[_0x1f74('0xd')](_0x1f74('0xe'))||_0xbceb4b[_0x1f74('0xd')](_0x1f74('0xf'))||_0xbceb4b[_0x1f74('0xd')](_0x1f74('0x10'))||_0xbceb4b[_0x1f74('0xd')](_0x1f74('0x11'))||_0xbceb4b[_0x1f74('0xd')]('host')){var _0x5bc0b5,_0x2e872e;_0x5bc0b5=_0xbceb4b[_0x1f74('0xe')];var _0x422f2d=_0x5bc0b5[_0x1f74('0x12')](-0x1);if(_0x422f2d==='/'||_0x422f2d==='\x5c'||_0x422f2d===':'){_0x5bc0b5=_0x5bc0b5['substring'](0x0,_0x5bc0b5[_0x1f74('0x13')](_0x422f2d));}switch(_0xbceb4b[_0x1f74('0x14')]){case'US':_0x2e872e=_0x1f74('0x15');break;case'AU':_0x2e872e=_0x1f74('0x16');break;case'IN':_0x2e872e=_0x1f74('0x17');break;case'CN':_0x2e872e=_0x1f74('0x18');break;default:_0x2e872e='https://accounts.zoho.eu';break;}var _0x20058e={'method':'POST','uri':_0x2e872e+_0x1f74('0x19'),'form':{'grant_type':_0x1f74('0x1a'),'client_id':_0xbceb4b['clientId'],'client_secret':_0xbceb4b[_0x1f74('0x10')],'redirect_uri':_0xbceb4b[_0x1f74('0xe')],'code':_0xbceb4b[_0x1f74('0x11')]},'headers':{'Content-Type':_0x1f74('0x1b')}};return rp(_0x20058e)[_0x1f74('0x1c')](function(_0x13dfd4){var _0x17d0bd=JSON[_0x1f74('0x1d')](_0x13dfd4);if(_0x17d0bd[_0x1f74('0x1e')]){_0xbceb4b[_0x1f74('0x1f')]=_0x17d0bd['refresh_token'];logger[_0x1f74('0x20')](util[_0x1f74('0x21')](_0x1f74('0x22'),_0xbceb4b[_0x1f74('0x23')],_0xbceb4b['id']));}else{logger[_0x1f74('0x24')](util[_0x1f74('0x21')](_0x1f74('0x25'),_0xbceb4b['name'],_0xbceb4b['id']),util[_0x1f74('0x26')](_0x17d0bd,{'showHidden':![],'depth':null}));}return _0xf89f62(null,_0xe9de29);})['catch'](function(_0x4e6482){logger[_0x1f74('0x24')](util[_0x1f74('0x21')](_0x1f74('0x25'),_0xbceb4b[_0x1f74('0x23')],_0xbceb4b['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xf89f62(_0x4e6482);});}else{return _0xf89f62(null,_0xe9de29);}},'beforeUpdate':function(_0xb91528,_0x7ef73,_0x5cfb44){if(_0xb91528[_0x1f74('0xd')](_0x1f74('0x14'))||_0xb91528[_0x1f74('0xd')](_0x1f74('0xe'))||_0xb91528[_0x1f74('0xd')](_0x1f74('0xf'))||_0xb91528['changed']('clientSecret')||_0xb91528[_0x1f74('0xd')]('code')||_0xb91528[_0x1f74('0xd')]('host')){var _0x47bb56,_0x303df0;_0x47bb56=_0xb91528[_0x1f74('0xe')];var _0x319178=_0x47bb56[_0x1f74('0x12')](-0x1);if(_0x319178==='/'||_0x319178==='\x5c'||_0x319178===':'){_0x47bb56=_0x47bb56[_0x1f74('0x27')](0x0,_0x47bb56['lastIndexOf'](_0x319178));}switch(_0xb91528[_0x1f74('0x14')]){case'US':_0x303df0='https://accounts.zoho.com';break;case'AU':_0x303df0=_0x1f74('0x16');break;case'IN':_0x303df0=_0x1f74('0x17');break;case'CN':_0x303df0=_0x1f74('0x18');break;default:_0x303df0=_0x1f74('0x28');break;}var _0x30c2bc={'method':_0x1f74('0x29'),'uri':_0x303df0+_0x1f74('0x19'),'form':{'grant_type':'authorization_code','client_id':_0xb91528[_0x1f74('0xf')],'client_secret':_0xb91528['clientSecret'],'redirect_uri':_0xb91528['serverUrl'],'code':_0xb91528[_0x1f74('0x11')]},'headers':{'Content-Type':_0x1f74('0x1b')}};return rp(_0x30c2bc)[_0x1f74('0x1c')](function(_0x420f85){var _0x2451ad=JSON['parse'](_0x420f85);if(_0x2451ad[_0x1f74('0x1e')]){_0xb91528[_0x1f74('0x1f')]=_0x2451ad[_0x1f74('0x1e')];logger['info'](util[_0x1f74('0x21')](_0x1f74('0x22'),_0xb91528[_0x1f74('0x23')],_0xb91528['id']));}else{logger['error'](util[_0x1f74('0x21')](_0x1f74('0x25'),_0xb91528[_0x1f74('0x23')],_0xb91528['id']),util[_0x1f74('0x26')](_0x2451ad,{'showHidden':![],'depth':null}));}return _0x5cfb44(null,_0x7ef73);})['catch'](function(_0x5b6add){logger[_0x1f74('0x24')](util['format'](_0x1f74('0x25'),_0xb91528['name'],_0xb91528['id']),util[_0x1f74('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x5cfb44(_0x5b6add);});}else{return _0x5cfb44(null,_0x7ef73);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index b8a5e10..e63f649 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 _0x68fd=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ZohoAccount,\x20%s,\x20%s','GetZohoAccount','options','raw','attributes','limit','map','model','include','catch','ShowZohoAccount','ZohoAccount','where','debug','lodash'];(function(_0x20db5a,_0x2c891a){var _0x3bc8d8=function(_0x1d7084){while(--_0x1d7084){_0x20db5a['push'](_0x20db5a['shift']());}};_0x3bc8d8(++_0x2c891a);}(_0x68fd,0x1e9));var _0xd68f=function(_0x2152b2,_0x1832da){_0x2152b2=_0x2152b2-0x0;var _0x374a9c=_0x68fd[_0x2152b2];return _0x374a9c;};'use strict';var _=require(_0xd68f('0x0'));var util=require('util');var moment=require(_0xd68f('0x1'));var BPromise=require(_0xd68f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd68f('0x3'));var db=require(_0xd68f('0x4'))['db'];var utils=require(_0xd68f('0x5'));var logger=require(_0xd68f('0x6'))(_0xd68f('0x7'));var config=require(_0xd68f('0x8'));var jayson=require(_0xd68f('0x9'));var client=jayson[_0xd68f('0xa')][_0xd68f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e59f5,_0xb3cb35,_0x182353){return new BPromise(function(_0x26f6ca,_0x22c199){return client[_0xd68f('0xc')](_0x4e59f5,_0x182353)[_0xd68f('0xd')](function(_0x18438e){logger['info']('ZohoAccount,\x20%s,\x20%s',_0xb3cb35,_0xd68f('0xe'));logger['debug'](_0xd68f('0xf'),_0xb3cb35,_0xd68f('0xe'),JSON[_0xd68f('0x10')](_0x18438e));if(_0x18438e[_0xd68f('0x11')]){if(_0x18438e[_0xd68f('0x11')][_0xd68f('0x12')]===0x1f4){logger[_0xd68f('0x11')]('ZohoAccount,\x20%s,\x20%s',_0xb3cb35,_0x18438e['error']['message']);return _0x22c199(_0x18438e['error'][_0xd68f('0x13')]);}logger[_0xd68f('0x11')]('ZohoAccount,\x20%s,\x20%s',_0xb3cb35,_0x18438e[_0xd68f('0x11')][_0xd68f('0x13')]);return _0x26f6ca(_0x18438e[_0xd68f('0x11')][_0xd68f('0x13')]);}else{logger[_0xd68f('0x14')](_0xd68f('0x15'),_0xb3cb35,_0xd68f('0xe'));_0x26f6ca(_0x18438e['result'][_0xd68f('0x13')]);}})['catch'](function(_0x5db5b1){logger[_0xd68f('0x11')](_0xd68f('0x15'),_0xb3cb35,_0x5db5b1);_0x22c199(_0x5db5b1);});});}exports[_0xd68f('0x16')]=function(_0x3fdfbf){var _0x44e849=this;return new Promise(function(_0xb01ed,_0xa09f23){return db['ZohoAccount']['findAll']({'raw':_0x3fdfbf[_0xd68f('0x17')]?_0x3fdfbf[_0xd68f('0x17')][_0xd68f('0x18')]===undefined?!![]:![]:!![],'where':_0x3fdfbf[_0xd68f('0x17')]?_0x3fdfbf[_0xd68f('0x17')]['where']||null:null,'attributes':_0x3fdfbf[_0xd68f('0x17')]?_0x3fdfbf[_0xd68f('0x17')][_0xd68f('0x19')]||null:null,'limit':_0x3fdfbf['options']?_0x3fdfbf[_0xd68f('0x17')][_0xd68f('0x1a')]||null:null,'include':_0x3fdfbf[_0xd68f('0x17')]?_0x3fdfbf['options']['include']?_[_0xd68f('0x1b')](_0x3fdfbf['options']['include'],function(_0x3cf02f){return{'model':db[_0x3cf02f[_0xd68f('0x1c')]],'as':_0x3cf02f['as'],'attributes':_0x3cf02f[_0xd68f('0x19')],'include':_0x3cf02f[_0xd68f('0x1d')]?_[_0xd68f('0x1b')](_0x3cf02f[_0xd68f('0x1d')],function(_0x169dea){return{'model':db[_0x169dea[_0xd68f('0x1c')]],'as':_0x169dea['as'],'attributes':_0x169dea[_0xd68f('0x19')],'include':_0x169dea[_0xd68f('0x1d')]?_[_0xd68f('0x1b')](_0x169dea[_0xd68f('0x1d')],function(_0xee7d9d){return{'model':db[_0xee7d9d['model']],'as':_0xee7d9d['as'],'attributes':_0xee7d9d[_0xd68f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd68f('0xd')](function(_0x4b1515){logger[_0xd68f('0x14')]('GetZohoAccount',_0x3fdfbf);logger['debug'](_0xd68f('0x16'),_0x3fdfbf,JSON[_0xd68f('0x10')](_0x4b1515));_0xb01ed(_0x4b1515);})[_0xd68f('0x1e')](function(_0x52a2dc){logger[_0xd68f('0x11')]('GetZohoAccount',_0x52a2dc[_0xd68f('0x13')],_0x3fdfbf);_0xa09f23(_0x44e849['error'](0x1f4,_0x52a2dc[_0xd68f('0x13')]));});});};exports[_0xd68f('0x1f')]=function(_0x426ad2){var _0x3827c9=this;return new Promise(function(_0x38df7f,_0x58aeda){return db[_0xd68f('0x20')]['find']({'raw':_0x426ad2[_0xd68f('0x17')]?_0x426ad2['options'][_0xd68f('0x18')]===undefined?!![]:![]:!![],'where':_0x426ad2[_0xd68f('0x17')]?_0x426ad2[_0xd68f('0x17')][_0xd68f('0x21')]||null:null,'attributes':_0x426ad2['options']?_0x426ad2[_0xd68f('0x17')][_0xd68f('0x19')]||null:null,'include':_0x426ad2[_0xd68f('0x17')]?_0x426ad2[_0xd68f('0x17')]['include']?_[_0xd68f('0x1b')](_0x426ad2[_0xd68f('0x17')][_0xd68f('0x1d')],function(_0x37a021){return{'model':db[_0x37a021[_0xd68f('0x1c')]],'as':_0x37a021['as'],'attributes':_0x37a021[_0xd68f('0x19')],'include':_0x37a021[_0xd68f('0x1d')]?_[_0xd68f('0x1b')](_0x37a021['include'],function(_0x44fa9b){return{'model':db[_0x44fa9b[_0xd68f('0x1c')]],'as':_0x44fa9b['as'],'attributes':_0x44fa9b[_0xd68f('0x19')],'include':_0x44fa9b[_0xd68f('0x1d')]?_[_0xd68f('0x1b')](_0x44fa9b[_0xd68f('0x1d')],function(_0x1ff0ac){return{'model':db[_0x1ff0ac[_0xd68f('0x1c')]],'as':_0x1ff0ac['as'],'attributes':_0x1ff0ac['attributes']};}):[]};}):[]};}):[]:[]})[_0xd68f('0xd')](function(_0x1474a0){logger[_0xd68f('0x14')](_0xd68f('0x1f'),_0x426ad2);logger[_0xd68f('0x22')]('ShowZohoAccount',_0x426ad2,JSON[_0xd68f('0x10')](_0x1474a0));_0x38df7f(_0x1474a0);})[_0xd68f('0x1e')](function(_0xb06175){logger[_0xd68f('0x11')](_0xd68f('0x1f'),_0xb06175[_0xd68f('0x13')],_0x426ad2);_0x58aeda(_0x3827c9[_0xd68f('0x11')](0x1f4,_0xb06175[_0xd68f('0x13')]));});});}; \ No newline at end of file +var _0x6372=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','ZohoAccount','findAll','options','raw','attributes','include','map','model','GetZohoAccount','ShowZohoAccount','find','where','lodash','moment'];(function(_0x5da21c,_0x340f8b){var _0x3b72fa=function(_0x3aae43){while(--_0x3aae43){_0x5da21c['push'](_0x5da21c['shift']());}};_0x3b72fa(++_0x340f8b);}(_0x6372,0x1b8));var _0x2637=function(_0x2cc3c1,_0xa43650){_0x2cc3c1=_0x2cc3c1-0x0;var _0x4c4f66=_0x6372[_0x2cc3c1];return _0x4c4f66;};'use strict';var _=require(_0x2637('0x0'));var util=require('util');var moment=require(_0x2637('0x1'));var BPromise=require('bluebird');var rs=require(_0x2637('0x2'));var fs=require('fs');var Redis=require(_0x2637('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2637('0x4'));var logger=require(_0x2637('0x5'))(_0x2637('0x6'));var config=require(_0x2637('0x7'));var jayson=require(_0x2637('0x8'));var client=jayson['client'][_0x2637('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54bdd1,_0x4f8521,_0x49383d){return new BPromise(function(_0x30abde,_0x5a4748){return client['request'](_0x54bdd1,_0x49383d)[_0x2637('0xa')](function(_0x2dbcb5){logger[_0x2637('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x4f8521,'request\x20sent');logger[_0x2637('0xc')](_0x2637('0xd'),_0x4f8521,_0x2637('0xe'),JSON[_0x2637('0xf')](_0x2dbcb5));if(_0x2dbcb5[_0x2637('0x10')]){if(_0x2dbcb5[_0x2637('0x10')][_0x2637('0x11')]===0x1f4){logger[_0x2637('0x10')](_0x2637('0x12'),_0x4f8521,_0x2dbcb5['error'][_0x2637('0x13')]);return _0x5a4748(_0x2dbcb5[_0x2637('0x10')][_0x2637('0x13')]);}logger['error'](_0x2637('0x12'),_0x4f8521,_0x2dbcb5[_0x2637('0x10')][_0x2637('0x13')]);return _0x30abde(_0x2dbcb5[_0x2637('0x10')]['message']);}else{logger[_0x2637('0xb')](_0x2637('0x12'),_0x4f8521,_0x2637('0xe'));_0x30abde(_0x2dbcb5[_0x2637('0x14')][_0x2637('0x13')]);}})[_0x2637('0x15')](function(_0x567d3c){logger['error'](_0x2637('0x12'),_0x4f8521,_0x567d3c);_0x5a4748(_0x567d3c);});});}exports['GetZohoAccount']=function(_0x4f44d7){var _0x3dcb2e=this;return new Promise(function(_0x1e9598,_0x4d3266){return db[_0x2637('0x16')][_0x2637('0x17')]({'raw':_0x4f44d7[_0x2637('0x18')]?_0x4f44d7['options'][_0x2637('0x19')]===undefined?!![]:![]:!![],'where':_0x4f44d7[_0x2637('0x18')]?_0x4f44d7[_0x2637('0x18')]['where']||null:null,'attributes':_0x4f44d7[_0x2637('0x18')]?_0x4f44d7[_0x2637('0x18')][_0x2637('0x1a')]||null:null,'limit':_0x4f44d7['options']?_0x4f44d7[_0x2637('0x18')]['limit']||null:null,'include':_0x4f44d7[_0x2637('0x18')]?_0x4f44d7[_0x2637('0x18')][_0x2637('0x1b')]?_['map'](_0x4f44d7['options'][_0x2637('0x1b')],function(_0x5e6d31){return{'model':db[_0x5e6d31['model']],'as':_0x5e6d31['as'],'attributes':_0x5e6d31['attributes'],'include':_0x5e6d31[_0x2637('0x1b')]?_[_0x2637('0x1c')](_0x5e6d31[_0x2637('0x1b')],function(_0x3d3bd9){return{'model':db[_0x3d3bd9[_0x2637('0x1d')]],'as':_0x3d3bd9['as'],'attributes':_0x3d3bd9[_0x2637('0x1a')],'include':_0x3d3bd9[_0x2637('0x1b')]?_[_0x2637('0x1c')](_0x3d3bd9['include'],function(_0x13a4a8){return{'model':db[_0x13a4a8[_0x2637('0x1d')]],'as':_0x13a4a8['as'],'attributes':_0x13a4a8['attributes']};}):[]};}):[]};}):[]:[]})[_0x2637('0xa')](function(_0x2d3f28){logger[_0x2637('0xb')](_0x2637('0x1e'),_0x4f44d7);logger['debug'](_0x2637('0x1e'),_0x4f44d7,JSON[_0x2637('0xf')](_0x2d3f28));_0x1e9598(_0x2d3f28);})[_0x2637('0x15')](function(_0x27f326){logger[_0x2637('0x10')]('GetZohoAccount',_0x27f326['message'],_0x4f44d7);_0x4d3266(_0x3dcb2e[_0x2637('0x10')](0x1f4,_0x27f326['message']));});});};exports[_0x2637('0x1f')]=function(_0xaa5292){var _0x2d1628=this;return new Promise(function(_0x39fd9e,_0x40e343){return db[_0x2637('0x16')][_0x2637('0x20')]({'raw':_0xaa5292[_0x2637('0x18')]?_0xaa5292[_0x2637('0x18')][_0x2637('0x19')]===undefined?!![]:![]:!![],'where':_0xaa5292[_0x2637('0x18')]?_0xaa5292[_0x2637('0x18')][_0x2637('0x21')]||null:null,'attributes':_0xaa5292[_0x2637('0x18')]?_0xaa5292[_0x2637('0x18')][_0x2637('0x1a')]||null:null,'include':_0xaa5292[_0x2637('0x18')]?_0xaa5292['options'][_0x2637('0x1b')]?_[_0x2637('0x1c')](_0xaa5292['options']['include'],function(_0x3b4a0f){return{'model':db[_0x3b4a0f[_0x2637('0x1d')]],'as':_0x3b4a0f['as'],'attributes':_0x3b4a0f[_0x2637('0x1a')],'include':_0x3b4a0f[_0x2637('0x1b')]?_[_0x2637('0x1c')](_0x3b4a0f[_0x2637('0x1b')],function(_0x3107e5){return{'model':db[_0x3107e5[_0x2637('0x1d')]],'as':_0x3107e5['as'],'attributes':_0x3107e5[_0x2637('0x1a')],'include':_0x3107e5[_0x2637('0x1b')]?_[_0x2637('0x1c')](_0x3107e5[_0x2637('0x1b')],function(_0x4bdb3c){return{'model':db[_0x4bdb3c[_0x2637('0x1d')]],'as':_0x4bdb3c['as'],'attributes':_0x4bdb3c['attributes']};}):[]};}):[]};}):[]:[]})[_0x2637('0xa')](function(_0x44b93b){logger[_0x2637('0xb')](_0x2637('0x1f'),_0xaa5292);logger[_0x2637('0xc')](_0x2637('0x1f'),_0xaa5292,JSON[_0x2637('0xf')](_0x44b93b));_0x39fd9e(_0x44b93b);})[_0x2637('0x15')](function(_0x31df33){logger[_0x2637('0x10')](_0x2637('0x1f'),_0x31df33[_0x2637('0x13')],_0xaa5292);_0x40e343(_0x2d1628[_0x2637('0x10')](0x1f4,_0x31df33[_0x2637('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 63f0e76..54bb7a9 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 _0x076f=['put','delete','destroy','exports','multer','express','fs-extra','../../components/auth/service','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getDescriptions','post','create'];(function(_0x205921,_0x5607e7){var _0x50f162=function(_0x5c4d64){while(--_0x5c4d64){_0x205921['push'](_0x205921['shift']());}};_0x50f162(++_0x5607e7);}(_0x076f,0x16c));var _0xf076=function(_0x5d082a,_0x4aa33f){_0x5d082a=_0x5d082a-0x0;var _0xebd7f4=_0x076f[_0x5d082a];return _0xebd7f4;};'use strict';var multer=require(_0xf076('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf076('0x1'));var router=express['Router']();var fs_extra=require(_0xf076('0x2'));var auth=require(_0xf076('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf076('0x4'));router[_0xf076('0x5')]('/',auth[_0xf076('0x6')](),controller['index']);router[_0xf076('0x5')](_0xf076('0x7'),auth[_0xf076('0x6')](),controller[_0xf076('0x8')]);router[_0xf076('0x5')](_0xf076('0x9'),auth[_0xf076('0x6')](),controller[_0xf076('0xa')]);router[_0xf076('0x5')]('/:id/subjects',auth[_0xf076('0x6')](),controller['getSubjects']);router[_0xf076('0x5')]('/:id/descriptions',auth[_0xf076('0x6')](),controller[_0xf076('0xb')]);router[_0xf076('0xc')]('/',auth[_0xf076('0x6')](),controller[_0xf076('0xd')]);router[_0xf076('0xe')](_0xf076('0x7'),auth[_0xf076('0x6')](),controller['update']);router[_0xf076('0xf')](_0xf076('0x7'),auth[_0xf076('0x6')](),controller[_0xf076('0x10')]);module[_0xf076('0x11')]=router; \ No newline at end of file +var _0x07dd=['isAuthenticated','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xcd3d34,_0x5a5acc){var _0x490679=function(_0x4cf368){while(--_0x4cf368){_0xcd3d34['push'](_0xcd3d34['shift']());}};_0x490679(++_0x5a5acc);}(_0x07dd,0x1c4));var _0xd07d=function(_0xa07178,_0x3e6d1c){_0xa07178=_0xa07178-0x0;var _0x2e4eb9=_0x07dd[_0xa07178];return _0x2e4eb9;};'use strict';var multer=require('multer');var util=require(_0xd07d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd07d('0x1'));var router=express[_0xd07d('0x2')]();var fs_extra=require(_0xd07d('0x3'));var auth=require(_0xd07d('0x4'));var interaction=require(_0xd07d('0x5'));var config=require(_0xd07d('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0xd07d('0x7')]('/',auth[_0xd07d('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd07d('0x7')](_0xd07d('0x9'),auth[_0xd07d('0x8')](),controller['getFields']);router[_0xd07d('0x7')](_0xd07d('0xa'),auth[_0xd07d('0x8')](),controller['getSubjects']);router['get'](_0xd07d('0xb'),auth[_0xd07d('0x8')](),controller[_0xd07d('0xc')]);router[_0xd07d('0xd')]('/',auth['isAuthenticated'](),controller[_0xd07d('0xe')]);router[_0xd07d('0xf')](_0xd07d('0x10'),auth[_0xd07d('0x8')](),controller[_0xd07d('0x11')]);router[_0xd07d('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd07d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index e9753f3..e4d9ca0 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 _0x58f4=['exports','STRING','ENUM','lead','contact','nothing','contact_lead'];(function(_0x5a0045,_0x4ea3dc){var _0x5cc4fe=function(_0x285769){while(--_0x285769){_0x5a0045['push'](_0x5a0045['shift']());}};_0x5cc4fe(++_0x4ea3dc);}(_0x58f4,0x1b2));var _0x458f=function(_0x3f59ca,_0x176e8b){_0x3f59ca=_0x3f59ca-0x0;var _0xbc3388=_0x58f4[_0x3f59ca];return _0xbc3388;};'use strict';var Sequelize=require('sequelize');module[_0x458f('0x0')]={'name':{'type':Sequelize[_0x458f('0x1')]},'moduleCreate':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x3'),_0x458f('0x4'),_0x458f('0x5')),'defaultValue':_0x458f('0x3')},'moduleSearch':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x6'),_0x458f('0x4'),_0x458f('0x3')),'defaultValue':_0x458f('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7dd1=['nothing','lead','contact_lead','exports','STRING','ENUM','contact'];(function(_0x35d900,_0x30044e){var _0x154e19=function(_0x528bd4){while(--_0x528bd4){_0x35d900['push'](_0x35d900['shift']());}};_0x154e19(++_0x30044e);}(_0x7dd1,0xf1));var _0x17dd=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x7dd1[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require('sequelize');module[_0x17dd('0x0')]={'name':{'type':Sequelize[_0x17dd('0x1')]},'moduleCreate':{'type':Sequelize[_0x17dd('0x2')]('lead',_0x17dd('0x3'),_0x17dd('0x4')),'defaultValue':_0x17dd('0x5')},'moduleSearch':{'type':Sequelize[_0x17dd('0x2')](_0x17dd('0x6'),_0x17dd('0x3'),'lead'),'defaultValue':_0x17dd('0x6')},'description':{'type':Sequelize[_0x17dd('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 67bf090..1e827ce 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 _0xf009=['util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','ZohoConfiguration','rawAttributes','fieldName','type','key','map','name','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','find','create','body','catch','params','getFields','findOne','ZohoField','pick','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf009,0x136));var _0x9f00=function(_0x239eaf,_0x1968b4){_0x239eaf=_0x239eaf-0x0;var _0x8863f7=_0xf009[_0x239eaf];return _0x8863f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f00('0x0'));var zipdir=require(_0x9f00('0x1'));var jsonpatch=require(_0x9f00('0x2'));var rp=require(_0x9f00('0x3'));var moment=require('moment');var BPromise=require(_0x9f00('0x4'));var Mustache=require(_0x9f00('0x5'));var util=require(_0x9f00('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9f00('0x7'));var ejs=require(_0x9f00('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f00('0x9'));var squel=require('squel');var crypto=require(_0x9f00('0xa'));var jsforce=require(_0x9f00('0xb'));var deskjs=require(_0x9f00('0xc'));var toCsv=require(_0x9f00('0x7'));var querystring=require(_0x9f00('0xd'));var Papa=require(_0x9f00('0xe'));var Redis=require(_0x9f00('0xf'));var authService=require(_0x9f00('0x10'));var qs=require(_0x9f00('0x11'));var as=require(_0x9f00('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f00('0x13'))(_0x9f00('0x14'));var utils=require(_0x9f00('0x15'));var config=require(_0x9f00('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48758c,_0x3b3212){_0x3b3212=_0x3b3212||0xcc;return function(_0x3f0cf0){if(_0x3f0cf0){return _0x48758c[_0x9f00('0x17')](_0x3b3212);}return _0x48758c['status'](_0x3b3212)[_0x9f00('0x18')]();};}function respondWithResult(_0x2d4639,_0x1d75ed){_0x1d75ed=_0x1d75ed||0xc8;return function(_0x54a869){if(_0x54a869){return _0x2d4639[_0x9f00('0x19')](_0x1d75ed)[_0x9f00('0x1a')](_0x54a869);}};}function respondWithFilteredResult(_0x4e19ec,_0x1a90f8){return function(_0x74ddea){if(_0x74ddea){var _0xdcc093=typeof _0x1a90f8[_0x9f00('0x1b')]===_0x9f00('0x1c')&&typeof _0x1a90f8[_0x9f00('0x1d')]===_0x9f00('0x1c');var _0x4a657f=_0x74ddea[_0x9f00('0x1e')];var _0x530f8e=_0xdcc093?0x0:_0x1a90f8[_0x9f00('0x1b')];var _0x4d468f=_0xdcc093?_0x74ddea[_0x9f00('0x1e')]:_0x1a90f8[_0x9f00('0x1b')]+_0x1a90f8[_0x9f00('0x1d')];var _0x52a5d3;if(_0x4d468f>=_0x4a657f){_0x4d468f=_0x4a657f;_0x52a5d3=0xc8;}else{_0x52a5d3=0xce;}_0x4e19ec[_0x9f00('0x19')](_0x52a5d3);return _0x4e19ec[_0x9f00('0x1f')](_0x9f00('0x20'),_0x530f8e+'-'+_0x4d468f+'/'+_0x4a657f)[_0x9f00('0x1a')](_0x74ddea);}return null;};}function patchUpdates(_0x12d199){return function(_0x385d38){try{jsonpatch['apply'](_0x385d38,_0x12d199,!![]);}catch(_0xabbfb3){return BPromise[_0x9f00('0x21')](_0xabbfb3);}return _0x385d38[_0x9f00('0x22')]();};}function saveUpdates(_0x58af36,_0x47b545){return function(_0x2e39f3){if(_0x2e39f3){return _0x2e39f3[_0x9f00('0x23')](_0x58af36)[_0x9f00('0x24')](function(_0x66b956){return _0x66b956;});}return null;};}function removeEntity(_0x4d8059,_0x2c4bd1){return function(_0x32668e){if(_0x32668e){return _0x32668e[_0x9f00('0x25')]()['then'](function(){_0x4d8059[_0x9f00('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5de97f,_0x5b97fa){return function(_0x2f12bc){if(!_0x2f12bc){_0x5de97f[_0x9f00('0x17')](0x194);}return _0x2f12bc;};}function handleError(_0x23936b,_0x1e9151){_0x1e9151=_0x1e9151||0x1f4;return function(_0x4e5a0b){logger[_0x9f00('0x26')](_0x4e5a0b['stack']);if(_0x4e5a0b['name']){delete _0x4e5a0b['name'];}_0x23936b[_0x9f00('0x19')](_0x1e9151)['send'](_0x4e5a0b);};}exports['index']=function(_0x361c5a,_0x2b4631){var _0x26e2be={},_0x5ef013={},_0x35abbc={'count':0x0,'rows':[]};var _0x2ccce3=_['map'](db[_0x9f00('0x27')][_0x9f00('0x28')],function(_0x49e06f){return{'name':_0x49e06f[_0x9f00('0x29')],'type':_0x49e06f[_0x9f00('0x2a')][_0x9f00('0x2b')]};});_0x5ef013['model']=_[_0x9f00('0x2c')](_0x2ccce3,_0x9f00('0x2d'));_0x5ef013['query']=_[_0x9f00('0x2e')](_0x361c5a[_0x9f00('0x2f')]);_0x5ef013[_0x9f00('0x30')]=_[_0x9f00('0x31')](_0x5ef013[_0x9f00('0x32')],_0x5ef013[_0x9f00('0x2f')]);_0x26e2be['attributes']=_[_0x9f00('0x31')](_0x5ef013[_0x9f00('0x32')],qs['fields'](_0x361c5a[_0x9f00('0x2f')][_0x9f00('0x33')]));_0x26e2be[_0x9f00('0x34')]=_0x26e2be['attributes'][_0x9f00('0x35')]?_0x26e2be[_0x9f00('0x34')]:_0x5ef013[_0x9f00('0x32')];if(!_0x361c5a[_0x9f00('0x2f')][_0x9f00('0x36')](_0x9f00('0x37'))){_0x26e2be[_0x9f00('0x1d')]=qs['limit'](_0x361c5a['query'][_0x9f00('0x1d')]);_0x26e2be[_0x9f00('0x1b')]=qs[_0x9f00('0x1b')](_0x361c5a[_0x9f00('0x2f')][_0x9f00('0x1b')]);}_0x26e2be[_0x9f00('0x38')]=qs[_0x9f00('0x39')](_0x361c5a['query']['sort']);_0x26e2be[_0x9f00('0x3a')]=qs[_0x9f00('0x30')](_['pick'](_0x361c5a[_0x9f00('0x2f')],_0x5ef013[_0x9f00('0x30')]),_0x2ccce3);if(_0x361c5a[_0x9f00('0x2f')][_0x9f00('0x3b')]){_0x26e2be[_0x9f00('0x3a')]=_[_0x9f00('0x3c')](_0x26e2be[_0x9f00('0x3a')],{'$or':_[_0x9f00('0x2c')](_0x2ccce3,function(_0x220584){if(_0x220584['type']!==_0x9f00('0x3d')){var _0x30f169={};_0x30f169[_0x220584[_0x9f00('0x2d')]]={'$like':'%'+_0x361c5a[_0x9f00('0x2f')]['filter']+'%'};return _0x30f169;}})});}_0x26e2be=_['merge']({},_0x26e2be,_0x361c5a[_0x9f00('0x3e')]);var _0x2f1f8d={'where':_0x26e2be[_0x9f00('0x3a')]};return db[_0x9f00('0x27')][_0x9f00('0x1e')](_0x2f1f8d)[_0x9f00('0x24')](function(_0x2ea4a9){_0x35abbc[_0x9f00('0x1e')]=_0x2ea4a9;if(_0x361c5a['query']['includeAll']){_0x26e2be[_0x9f00('0x3f')]=[{'all':!![]}];}return db[_0x9f00('0x27')][_0x9f00('0x40')](_0x26e2be);})['then'](function(_0x4d889d){_0x35abbc[_0x9f00('0x41')]=_0x4d889d;return _0x35abbc;})['then'](respondWithFilteredResult(_0x2b4631,_0x26e2be))['catch'](handleError(_0x2b4631,null));};exports[_0x9f00('0x42')]=function(_0x3b568f,_0x14294a){var _0x261783={'raw':![],'where':{'id':_0x3b568f['params']['id']}},_0xc7168e={};_0xc7168e[_0x9f00('0x32')]=_[_0x9f00('0x2e')](db[_0x9f00('0x27')][_0x9f00('0x28')]);_0xc7168e['query']=_['keys'](_0x3b568f[_0x9f00('0x2f')]);_0xc7168e[_0x9f00('0x30')]=_[_0x9f00('0x31')](_0xc7168e[_0x9f00('0x32')],_0xc7168e[_0x9f00('0x2f')]);_0x261783['attributes']=_[_0x9f00('0x31')](_0xc7168e[_0x9f00('0x32')],qs[_0x9f00('0x33')](_0x3b568f[_0x9f00('0x2f')][_0x9f00('0x33')]));_0x261783['attributes']=_0x261783[_0x9f00('0x34')][_0x9f00('0x35')]?_0x261783[_0x9f00('0x34')]:_0xc7168e[_0x9f00('0x32')];if(_0x3b568f[_0x9f00('0x2f')][_0x9f00('0x43')]){_0x261783[_0x9f00('0x3f')]=[{'all':!![]}];}_0x261783=_['merge']({},_0x261783,_0x3b568f['options']);return db[_0x9f00('0x27')][_0x9f00('0x44')](_0x261783)['then'](handleEntityNotFound(_0x14294a,null))[_0x9f00('0x24')](respondWithResult(_0x14294a,null))['catch'](handleError(_0x14294a,null));};exports[_0x9f00('0x45')]=function(_0x363320,_0x5d5a26){return db[_0x9f00('0x27')][_0x9f00('0x45')](_0x363320[_0x9f00('0x46')],{})[_0x9f00('0x24')](respondWithResult(_0x5d5a26,0xc9))[_0x9f00('0x47')](handleError(_0x5d5a26,null));};exports[_0x9f00('0x23')]=function(_0x3d17e4,_0x10ac9c){if(_0x3d17e4[_0x9f00('0x46')]['id']){delete _0x3d17e4[_0x9f00('0x46')]['id'];}return db[_0x9f00('0x27')][_0x9f00('0x44')]({'where':{'id':_0x3d17e4['params']['id']}})['then'](handleEntityNotFound(_0x10ac9c,null))[_0x9f00('0x24')](saveUpdates(_0x3d17e4[_0x9f00('0x46')],null))[_0x9f00('0x24')](respondWithResult(_0x10ac9c,null))[_0x9f00('0x47')](handleError(_0x10ac9c,null));};exports[_0x9f00('0x25')]=function(_0x12a245,_0x521bb2){return db[_0x9f00('0x27')][_0x9f00('0x44')]({'where':{'id':_0x12a245[_0x9f00('0x48')]['id']}})['then'](handleEntityNotFound(_0x521bb2,null))[_0x9f00('0x24')](removeEntity(_0x521bb2,null))[_0x9f00('0x47')](handleError(_0x521bb2,null));};exports[_0x9f00('0x49')]=function(_0xf3c904,_0x595259,_0x502737){var _0x4294a7={};var _0x20cdef={};var _0x582216;var _0x422522;return db[_0x9f00('0x27')][_0x9f00('0x4a')]({'where':{'id':_0xf3c904[_0x9f00('0x48')]['id']}})[_0x9f00('0x24')](handleEntityNotFound(_0x595259,null))['then'](function(_0x5cd844){if(_0x5cd844){_0x582216=_0x5cd844;_0x20cdef[_0x9f00('0x32')]=_[_0x9f00('0x2e')](db['ZohoField'][_0x9f00('0x28')]);_0x20cdef['query']=_[_0x9f00('0x2e')](_0xf3c904[_0x9f00('0x2f')]);_0x20cdef[_0x9f00('0x30')]=_['intersection'](_0x20cdef[_0x9f00('0x32')],_0x20cdef['query']);_0x4294a7[_0x9f00('0x34')]=_[_0x9f00('0x31')](_0x20cdef[_0x9f00('0x32')],qs[_0x9f00('0x33')](_0xf3c904[_0x9f00('0x2f')][_0x9f00('0x33')]));_0x4294a7['attributes']=_0x4294a7[_0x9f00('0x34')][_0x9f00('0x35')]?_0x4294a7['attributes']:_0x20cdef[_0x9f00('0x32')];_0x4294a7[_0x9f00('0x38')]=qs[_0x9f00('0x39')](_0xf3c904[_0x9f00('0x2f')][_0x9f00('0x39')]);_0x4294a7[_0x9f00('0x3a')]=qs[_0x9f00('0x30')](_['pick'](_0xf3c904[_0x9f00('0x2f')],_0x20cdef[_0x9f00('0x30')]));if(_0xf3c904['query']['filter']){_0x4294a7[_0x9f00('0x3a')]=_[_0x9f00('0x3c')](_0x4294a7['where'],{'$or':_['map'](_0x4294a7[_0x9f00('0x34')],function(_0x40838c){var _0x33ad8a={};_0x33ad8a[_0x40838c]={'$like':'%'+_0xf3c904['query']['filter']+'%'};return _0x33ad8a;})});}_0x4294a7=_[_0x9f00('0x3c')]({},_0x4294a7,_0xf3c904[_0x9f00('0x3e')]);return _0x582216['getFields'](_0x4294a7);}})[_0x9f00('0x24')](function(_0x2bcd59){if(_0x2bcd59){_0x422522=_0x2bcd59[_0x9f00('0x35')];if(!_0xf3c904[_0x9f00('0x2f')]['hasOwnProperty'](_0x9f00('0x37'))){_0x4294a7[_0x9f00('0x1d')]=qs[_0x9f00('0x1d')](_0xf3c904[_0x9f00('0x2f')]['limit']);_0x4294a7[_0x9f00('0x1b')]=qs['offset'](_0xf3c904[_0x9f00('0x2f')][_0x9f00('0x1b')]);}return _0x582216['getFields'](_0x4294a7);}})[_0x9f00('0x24')](function(_0x5f3b2e){if(_0x5f3b2e){return _0x5f3b2e?{'count':_0x422522,'rows':_0x5f3b2e}:null;}})[_0x9f00('0x24')](respondWithResult(_0x595259,null))['catch'](handleError(_0x595259,null));};exports['getSubjects']=function(_0x4684db,_0x39f06a,_0x19dc23){var _0x174e24={};var _0x23c60f={};var _0xb94313;var _0x43dfaa;return db[_0x9f00('0x27')][_0x9f00('0x4a')]({'where':{'id':_0x4684db['params']['id']}})['then'](handleEntityNotFound(_0x39f06a,null))['then'](function(_0x49247c){if(_0x49247c){_0xb94313=_0x49247c;_0x23c60f[_0x9f00('0x32')]=_[_0x9f00('0x2e')](db[_0x9f00('0x4b')][_0x9f00('0x28')]);_0x23c60f[_0x9f00('0x2f')]=_[_0x9f00('0x2e')](_0x4684db[_0x9f00('0x2f')]);_0x23c60f[_0x9f00('0x30')]=_[_0x9f00('0x31')](_0x23c60f['model'],_0x23c60f[_0x9f00('0x2f')]);_0x174e24[_0x9f00('0x34')]=_['intersection'](_0x23c60f['model'],qs[_0x9f00('0x33')](_0x4684db[_0x9f00('0x2f')][_0x9f00('0x33')]));_0x174e24['attributes']=_0x174e24[_0x9f00('0x34')]['length']?_0x174e24[_0x9f00('0x34')]:_0x23c60f[_0x9f00('0x32')];_0x174e24[_0x9f00('0x38')]=qs[_0x9f00('0x39')](_0x4684db['query']['sort']);_0x174e24[_0x9f00('0x3a')]=qs['filters'](_[_0x9f00('0x4c')](_0x4684db[_0x9f00('0x2f')],_0x23c60f[_0x9f00('0x30')]));if(_0x4684db[_0x9f00('0x2f')]['filter']){_0x174e24[_0x9f00('0x3a')]=_[_0x9f00('0x3c')](_0x174e24[_0x9f00('0x3a')],{'$or':_['map'](_0x174e24['attributes'],function(_0x2d9ba5){var _0x55557f={};_0x55557f[_0x2d9ba5]={'$like':'%'+_0x4684db['query'][_0x9f00('0x3b')]+'%'};return _0x55557f;})});}_0x174e24=_[_0x9f00('0x3c')]({},_0x174e24,_0x4684db[_0x9f00('0x3e')]);return _0xb94313[_0x9f00('0x4d')](_0x174e24);}})[_0x9f00('0x24')](function(_0x4fdffd){if(_0x4fdffd){_0x43dfaa=_0x4fdffd[_0x9f00('0x35')];if(!_0x4684db[_0x9f00('0x2f')][_0x9f00('0x36')](_0x9f00('0x37'))){_0x174e24[_0x9f00('0x1d')]=qs['limit'](_0x4684db['query']['limit']);_0x174e24[_0x9f00('0x1b')]=qs[_0x9f00('0x1b')](_0x4684db['query'][_0x9f00('0x1b')]);}return _0xb94313[_0x9f00('0x4d')](_0x174e24);}})[_0x9f00('0x24')](function(_0x40cbca){if(_0x40cbca){return _0x40cbca?{'count':_0x43dfaa,'rows':_0x40cbca}:null;}})[_0x9f00('0x24')](respondWithResult(_0x39f06a,null))[_0x9f00('0x47')](handleError(_0x39f06a,null));};exports[_0x9f00('0x4e')]=function(_0x3c0b62,_0x1e3dce,_0x44f969){var _0x8037fb={};var _0x3dc4d0={};var _0xecb919;var _0x59bc84;return db[_0x9f00('0x27')][_0x9f00('0x4a')]({'where':{'id':_0x3c0b62['params']['id']}})['then'](handleEntityNotFound(_0x1e3dce,null))['then'](function(_0xc40047){if(_0xc40047){_0xecb919=_0xc40047;_0x3dc4d0['model']=_[_0x9f00('0x2e')](db[_0x9f00('0x4b')][_0x9f00('0x28')]);_0x3dc4d0[_0x9f00('0x2f')]=_[_0x9f00('0x2e')](_0x3c0b62['query']);_0x3dc4d0['filters']=_[_0x9f00('0x31')](_0x3dc4d0[_0x9f00('0x32')],_0x3dc4d0['query']);_0x8037fb['attributes']=_[_0x9f00('0x31')](_0x3dc4d0[_0x9f00('0x32')],qs['fields'](_0x3c0b62[_0x9f00('0x2f')][_0x9f00('0x33')]));_0x8037fb[_0x9f00('0x34')]=_0x8037fb[_0x9f00('0x34')][_0x9f00('0x35')]?_0x8037fb['attributes']:_0x3dc4d0[_0x9f00('0x32')];_0x8037fb[_0x9f00('0x38')]=qs[_0x9f00('0x39')](_0x3c0b62['query']['sort']);_0x8037fb['where']=qs['filters'](_[_0x9f00('0x4c')](_0x3c0b62[_0x9f00('0x2f')],_0x3dc4d0[_0x9f00('0x30')]));if(_0x3c0b62[_0x9f00('0x2f')]['filter']){_0x8037fb['where']=_['merge'](_0x8037fb[_0x9f00('0x3a')],{'$or':_[_0x9f00('0x2c')](_0x8037fb[_0x9f00('0x34')],function(_0x2e899a){var _0x5daef2={};_0x5daef2[_0x2e899a]={'$like':'%'+_0x3c0b62[_0x9f00('0x2f')]['filter']+'%'};return _0x5daef2;})});}_0x8037fb=_[_0x9f00('0x3c')]({},_0x8037fb,_0x3c0b62[_0x9f00('0x3e')]);return _0xecb919[_0x9f00('0x4e')](_0x8037fb);}})[_0x9f00('0x24')](function(_0x4acc27){if(_0x4acc27){_0x59bc84=_0x4acc27[_0x9f00('0x35')];if(!_0x3c0b62['query']['hasOwnProperty'](_0x9f00('0x37'))){_0x8037fb[_0x9f00('0x1d')]=qs['limit'](_0x3c0b62[_0x9f00('0x2f')][_0x9f00('0x1d')]);_0x8037fb[_0x9f00('0x1b')]=qs[_0x9f00('0x1b')](_0x3c0b62[_0x9f00('0x2f')][_0x9f00('0x1b')]);}return _0xecb919[_0x9f00('0x4e')](_0x8037fb);}})[_0x9f00('0x24')](function(_0x515d32){if(_0x515d32){return _0x515d32?{'count':_0x59bc84,'rows':_0x515d32}:null;}})['then'](respondWithResult(_0x1e3dce,null))[_0x9f00('0x47')](handleError(_0x1e3dce,null));}; \ No newline at end of file +var _0x05b0=['order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','error','stack','name','index','map','ZohoConfiguration','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','rawAttributes','length','includeAll','find','catch','create','body','update','params','getFields','findOne','ZohoField'];(function(_0x274019,_0x33d2c5){var _0x52169e=function(_0x2783dc){while(--_0x2783dc){_0x274019['push'](_0x274019['shift']());}};_0x52169e(++_0x33d2c5);}(_0x05b0,0x1e9));var _0x005b=function(_0x2f2e97,_0x222107){_0x2f2e97=_0x2f2e97-0x0;var _0x53fd00=_0x05b0[_0x2f2e97];return _0x53fd00;};'use strict';var emlformat=require(_0x005b('0x0'));var rimraf=require(_0x005b('0x1'));var zipdir=require(_0x005b('0x2'));var jsonpatch=require(_0x005b('0x3'));var rp=require(_0x005b('0x4'));var moment=require('moment');var BPromise=require(_0x005b('0x5'));var Mustache=require('mustache');var util=require(_0x005b('0x6'));var path=require('path');var sox=require(_0x005b('0x7'));var csv=require(_0x005b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x005b('0x9'));var _=require(_0x005b('0xa'));var squel=require(_0x005b('0xb'));var crypto=require('crypto');var jsforce=require(_0x005b('0xc'));var deskjs=require(_0x005b('0xd'));var toCsv=require(_0x005b('0x8'));var querystring=require('querystring');var Papa=require(_0x005b('0xe'));var Redis=require(_0x005b('0xf'));var authService=require(_0x005b('0x10'));var qs=require(_0x005b('0x11'));var as=require(_0x005b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x005b('0x13'))(_0x005b('0x14'));var utils=require(_0x005b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x005b('0x16'));var db=require(_0x005b('0x17'))['db'];function respondWithStatusCode(_0x1b2e58,_0x4970c3){_0x4970c3=_0x4970c3||0xcc;return function(_0x1162de){if(_0x1162de){return _0x1b2e58[_0x005b('0x18')](_0x4970c3);}return _0x1b2e58[_0x005b('0x19')](_0x4970c3)[_0x005b('0x1a')]();};}function respondWithResult(_0x173073,_0x9957ae){_0x9957ae=_0x9957ae||0xc8;return function(_0x373a92){if(_0x373a92){return _0x173073[_0x005b('0x19')](_0x9957ae)[_0x005b('0x1b')](_0x373a92);}};}function respondWithFilteredResult(_0x1b0201,_0x1505b4){return function(_0x39eddf){if(_0x39eddf){var _0xbea9a=typeof _0x1505b4[_0x005b('0x1c')]===_0x005b('0x1d')&&typeof _0x1505b4[_0x005b('0x1e')]===_0x005b('0x1d');var _0x23d783=_0x39eddf[_0x005b('0x1f')];var _0x37ecfc=_0xbea9a?0x0:_0x1505b4['offset'];var _0x171aca=_0xbea9a?_0x39eddf['count']:_0x1505b4[_0x005b('0x1c')]+_0x1505b4[_0x005b('0x1e')];var _0x5960fc;if(_0x171aca>=_0x23d783){_0x171aca=_0x23d783;_0x5960fc=0xc8;}else{_0x5960fc=0xce;}_0x1b0201[_0x005b('0x19')](_0x5960fc);return _0x1b0201['set'](_0x005b('0x20'),_0x37ecfc+'-'+_0x171aca+'/'+_0x23d783)[_0x005b('0x1b')](_0x39eddf);}return null;};}function patchUpdates(_0x32dc64){return function(_0x39d31f){try{jsonpatch[_0x005b('0x21')](_0x39d31f,_0x32dc64,!![]);}catch(_0x43215e){return BPromise[_0x005b('0x22')](_0x43215e);}return _0x39d31f['save']();};}function saveUpdates(_0x4b806f,_0x6bdedd){return function(_0x21480c){if(_0x21480c){return _0x21480c['update'](_0x4b806f)[_0x005b('0x23')](function(_0x3804d1){return _0x3804d1;});}return null;};}function removeEntity(_0xe1bee7,_0xb6b045){return function(_0x59fa57){if(_0x59fa57){return _0x59fa57[_0x005b('0x24')]()['then'](function(){_0xe1bee7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b106c,_0x34c74d){return function(_0x54ddc6){if(!_0x54ddc6){_0x2b106c['sendStatus'](0x194);}return _0x54ddc6;};}function handleError(_0x2a79d5,_0x28f707){_0x28f707=_0x28f707||0x1f4;return function(_0x132284){logger[_0x005b('0x25')](_0x132284[_0x005b('0x26')]);if(_0x132284[_0x005b('0x27')]){delete _0x132284[_0x005b('0x27')];}_0x2a79d5['status'](_0x28f707)['send'](_0x132284);};}exports[_0x005b('0x28')]=function(_0x4df994,_0x3e9902){var _0x4ac7aa={},_0x5669de={},_0x465ca6={'count':0x0,'rows':[]};var _0x3f598d=_[_0x005b('0x29')](db[_0x005b('0x2a')]['rawAttributes'],function(_0xa433ee){return{'name':_0xa433ee[_0x005b('0x2b')],'type':_0xa433ee[_0x005b('0x2c')][_0x005b('0x2d')]};});_0x5669de['model']=_[_0x005b('0x29')](_0x3f598d,_0x005b('0x27'));_0x5669de[_0x005b('0x2e')]=_[_0x005b('0x2f')](_0x4df994['query']);_0x5669de['filters']=_[_0x005b('0x30')](_0x5669de[_0x005b('0x31')],_0x5669de[_0x005b('0x2e')]);_0x4ac7aa['attributes']=_['intersection'](_0x5669de['model'],qs[_0x005b('0x32')](_0x4df994[_0x005b('0x2e')][_0x005b('0x32')]));_0x4ac7aa[_0x005b('0x33')]=_0x4ac7aa[_0x005b('0x33')]['length']?_0x4ac7aa['attributes']:_0x5669de[_0x005b('0x31')];if(!_0x4df994[_0x005b('0x2e')][_0x005b('0x34')](_0x005b('0x35'))){_0x4ac7aa[_0x005b('0x1e')]=qs[_0x005b('0x1e')](_0x4df994[_0x005b('0x2e')][_0x005b('0x1e')]);_0x4ac7aa[_0x005b('0x1c')]=qs[_0x005b('0x1c')](_0x4df994[_0x005b('0x2e')][_0x005b('0x1c')]);}_0x4ac7aa['order']=qs['sort'](_0x4df994[_0x005b('0x2e')][_0x005b('0x36')]);_0x4ac7aa['where']=qs[_0x005b('0x37')](_[_0x005b('0x38')](_0x4df994[_0x005b('0x2e')],_0x5669de[_0x005b('0x37')]),_0x3f598d);if(_0x4df994[_0x005b('0x2e')]['filter']){_0x4ac7aa[_0x005b('0x39')]=_[_0x005b('0x3a')](_0x4ac7aa[_0x005b('0x39')],{'$or':_['map'](_0x3f598d,function(_0x52cc3b){if(_0x52cc3b[_0x005b('0x2c')]!==_0x005b('0x3b')){var _0x47b301={};_0x47b301[_0x52cc3b['name']]={'$like':'%'+_0x4df994[_0x005b('0x2e')][_0x005b('0x3c')]+'%'};return _0x47b301;}})});}_0x4ac7aa=_['merge']({},_0x4ac7aa,_0x4df994[_0x005b('0x3d')]);var _0x4fae85={'where':_0x4ac7aa['where']};return db[_0x005b('0x2a')][_0x005b('0x1f')](_0x4fae85)[_0x005b('0x23')](function(_0x441497){_0x465ca6[_0x005b('0x1f')]=_0x441497;if(_0x4df994[_0x005b('0x2e')]['includeAll']){_0x4ac7aa[_0x005b('0x3e')]=[{'all':!![]}];}return db[_0x005b('0x2a')][_0x005b('0x3f')](_0x4ac7aa);})[_0x005b('0x23')](function(_0x145bad){_0x465ca6[_0x005b('0x40')]=_0x145bad;return _0x465ca6;})[_0x005b('0x23')](respondWithFilteredResult(_0x3e9902,_0x4ac7aa))['catch'](handleError(_0x3e9902,null));};exports[_0x005b('0x41')]=function(_0x4bcade,_0x41a592){var _0x14fc12={'raw':![],'where':{'id':_0x4bcade['params']['id']}},_0x51b2bd={};_0x51b2bd[_0x005b('0x31')]=_['keys'](db[_0x005b('0x2a')][_0x005b('0x42')]);_0x51b2bd['query']=_['keys'](_0x4bcade['query']);_0x51b2bd[_0x005b('0x37')]=_[_0x005b('0x30')](_0x51b2bd['model'],_0x51b2bd[_0x005b('0x2e')]);_0x14fc12[_0x005b('0x33')]=_[_0x005b('0x30')](_0x51b2bd['model'],qs[_0x005b('0x32')](_0x4bcade[_0x005b('0x2e')][_0x005b('0x32')]));_0x14fc12[_0x005b('0x33')]=_0x14fc12[_0x005b('0x33')][_0x005b('0x43')]?_0x14fc12['attributes']:_0x51b2bd[_0x005b('0x31')];if(_0x4bcade[_0x005b('0x2e')][_0x005b('0x44')]){_0x14fc12['include']=[{'all':!![]}];}_0x14fc12=_[_0x005b('0x3a')]({},_0x14fc12,_0x4bcade['options']);return db[_0x005b('0x2a')][_0x005b('0x45')](_0x14fc12)[_0x005b('0x23')](handleEntityNotFound(_0x41a592,null))[_0x005b('0x23')](respondWithResult(_0x41a592,null))[_0x005b('0x46')](handleError(_0x41a592,null));};exports[_0x005b('0x47')]=function(_0x462650,_0x5b5d0e){return db[_0x005b('0x2a')][_0x005b('0x47')](_0x462650[_0x005b('0x48')],{})[_0x005b('0x23')](respondWithResult(_0x5b5d0e,0xc9))['catch'](handleError(_0x5b5d0e,null));};exports[_0x005b('0x49')]=function(_0x58a1ca,_0x451157){if(_0x58a1ca[_0x005b('0x48')]['id']){delete _0x58a1ca[_0x005b('0x48')]['id'];}return db[_0x005b('0x2a')][_0x005b('0x45')]({'where':{'id':_0x58a1ca[_0x005b('0x4a')]['id']}})[_0x005b('0x23')](handleEntityNotFound(_0x451157,null))[_0x005b('0x23')](saveUpdates(_0x58a1ca[_0x005b('0x48')],null))[_0x005b('0x23')](respondWithResult(_0x451157,null))[_0x005b('0x46')](handleError(_0x451157,null));};exports[_0x005b('0x24')]=function(_0x5dda19,_0x4ff1cc){return db[_0x005b('0x2a')]['find']({'where':{'id':_0x5dda19[_0x005b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ff1cc,null))['then'](removeEntity(_0x4ff1cc,null))[_0x005b('0x46')](handleError(_0x4ff1cc,null));};exports[_0x005b('0x4b')]=function(_0x2edf3c,_0x5d4c97,_0x287134){var _0x41a310={};var _0x363443={};var _0x4aea00;var _0x444710;return db['ZohoConfiguration'][_0x005b('0x4c')]({'where':{'id':_0x2edf3c[_0x005b('0x4a')]['id']}})[_0x005b('0x23')](handleEntityNotFound(_0x5d4c97,null))['then'](function(_0x34554c){if(_0x34554c){_0x4aea00=_0x34554c;_0x363443['model']=_[_0x005b('0x2f')](db[_0x005b('0x4d')][_0x005b('0x42')]);_0x363443['query']=_[_0x005b('0x2f')](_0x2edf3c[_0x005b('0x2e')]);_0x363443[_0x005b('0x37')]=_['intersection'](_0x363443[_0x005b('0x31')],_0x363443['query']);_0x41a310['attributes']=_[_0x005b('0x30')](_0x363443[_0x005b('0x31')],qs[_0x005b('0x32')](_0x2edf3c[_0x005b('0x2e')]['fields']));_0x41a310[_0x005b('0x33')]=_0x41a310[_0x005b('0x33')][_0x005b('0x43')]?_0x41a310['attributes']:_0x363443[_0x005b('0x31')];_0x41a310[_0x005b('0x4e')]=qs[_0x005b('0x36')](_0x2edf3c[_0x005b('0x2e')][_0x005b('0x36')]);_0x41a310[_0x005b('0x39')]=qs['filters'](_[_0x005b('0x38')](_0x2edf3c['query'],_0x363443['filters']));if(_0x2edf3c[_0x005b('0x2e')]['filter']){_0x41a310[_0x005b('0x39')]=_[_0x005b('0x3a')](_0x41a310['where'],{'$or':_[_0x005b('0x29')](_0x41a310[_0x005b('0x33')],function(_0x1c8159){var _0x25616f={};_0x25616f[_0x1c8159]={'$like':'%'+_0x2edf3c[_0x005b('0x2e')][_0x005b('0x3c')]+'%'};return _0x25616f;})});}_0x41a310=_['merge']({},_0x41a310,_0x2edf3c['options']);return _0x4aea00[_0x005b('0x4b')](_0x41a310);}})[_0x005b('0x23')](function(_0x4314f9){if(_0x4314f9){_0x444710=_0x4314f9['length'];if(!_0x2edf3c[_0x005b('0x2e')]['hasOwnProperty']('nolimit')){_0x41a310[_0x005b('0x1e')]=qs['limit'](_0x2edf3c[_0x005b('0x2e')][_0x005b('0x1e')]);_0x41a310[_0x005b('0x1c')]=qs[_0x005b('0x1c')](_0x2edf3c[_0x005b('0x2e')][_0x005b('0x1c')]);}return _0x4aea00[_0x005b('0x4b')](_0x41a310);}})['then'](function(_0x3e3fb8){if(_0x3e3fb8){return _0x3e3fb8?{'count':_0x444710,'rows':_0x3e3fb8}:null;}})[_0x005b('0x23')](respondWithResult(_0x5d4c97,null))[_0x005b('0x46')](handleError(_0x5d4c97,null));};exports['getSubjects']=function(_0x2435c8,_0x5628a7,_0x1644cd){var _0x3f27c1={};var _0xdc6067={};var _0x4ddffc;var _0x35d51a;return db[_0x005b('0x2a')][_0x005b('0x4c')]({'where':{'id':_0x2435c8[_0x005b('0x4a')]['id']}})[_0x005b('0x23')](handleEntityNotFound(_0x5628a7,null))[_0x005b('0x23')](function(_0x4ba533){if(_0x4ba533){_0x4ddffc=_0x4ba533;_0xdc6067[_0x005b('0x31')]=_['keys'](db[_0x005b('0x4d')][_0x005b('0x42')]);_0xdc6067[_0x005b('0x2e')]=_[_0x005b('0x2f')](_0x2435c8[_0x005b('0x2e')]);_0xdc6067['filters']=_[_0x005b('0x30')](_0xdc6067[_0x005b('0x31')],_0xdc6067[_0x005b('0x2e')]);_0x3f27c1[_0x005b('0x33')]=_['intersection'](_0xdc6067[_0x005b('0x31')],qs[_0x005b('0x32')](_0x2435c8['query'][_0x005b('0x32')]));_0x3f27c1[_0x005b('0x33')]=_0x3f27c1[_0x005b('0x33')][_0x005b('0x43')]?_0x3f27c1['attributes']:_0xdc6067[_0x005b('0x31')];_0x3f27c1[_0x005b('0x4e')]=qs['sort'](_0x2435c8[_0x005b('0x2e')][_0x005b('0x36')]);_0x3f27c1[_0x005b('0x39')]=qs[_0x005b('0x37')](_[_0x005b('0x38')](_0x2435c8[_0x005b('0x2e')],_0xdc6067[_0x005b('0x37')]));if(_0x2435c8['query'][_0x005b('0x3c')]){_0x3f27c1[_0x005b('0x39')]=_['merge'](_0x3f27c1[_0x005b('0x39')],{'$or':_[_0x005b('0x29')](_0x3f27c1[_0x005b('0x33')],function(_0xffd77b){var _0x18e4a1={};_0x18e4a1[_0xffd77b]={'$like':'%'+_0x2435c8[_0x005b('0x2e')]['filter']+'%'};return _0x18e4a1;})});}_0x3f27c1=_[_0x005b('0x3a')]({},_0x3f27c1,_0x2435c8[_0x005b('0x3d')]);return _0x4ddffc[_0x005b('0x4f')](_0x3f27c1);}})['then'](function(_0x2eda07){if(_0x2eda07){_0x35d51a=_0x2eda07[_0x005b('0x43')];if(!_0x2435c8[_0x005b('0x2e')][_0x005b('0x34')]('nolimit')){_0x3f27c1[_0x005b('0x1e')]=qs[_0x005b('0x1e')](_0x2435c8[_0x005b('0x2e')][_0x005b('0x1e')]);_0x3f27c1[_0x005b('0x1c')]=qs['offset'](_0x2435c8[_0x005b('0x2e')][_0x005b('0x1c')]);}return _0x4ddffc[_0x005b('0x4f')](_0x3f27c1);}})[_0x005b('0x23')](function(_0xc9218b){if(_0xc9218b){return _0xc9218b?{'count':_0x35d51a,'rows':_0xc9218b}:null;}})[_0x005b('0x23')](respondWithResult(_0x5628a7,null))[_0x005b('0x46')](handleError(_0x5628a7,null));};exports[_0x005b('0x50')]=function(_0x333dbe,_0x296af0,_0x482064){var _0x160301={};var _0x25d08b={};var _0x2beed7;var _0x54c17e;return db[_0x005b('0x2a')][_0x005b('0x4c')]({'where':{'id':_0x333dbe[_0x005b('0x4a')]['id']}})[_0x005b('0x23')](handleEntityNotFound(_0x296af0,null))['then'](function(_0xfa7425){if(_0xfa7425){_0x2beed7=_0xfa7425;_0x25d08b[_0x005b('0x31')]=_[_0x005b('0x2f')](db[_0x005b('0x4d')][_0x005b('0x42')]);_0x25d08b[_0x005b('0x2e')]=_[_0x005b('0x2f')](_0x333dbe[_0x005b('0x2e')]);_0x25d08b[_0x005b('0x37')]=_[_0x005b('0x30')](_0x25d08b[_0x005b('0x31')],_0x25d08b['query']);_0x160301[_0x005b('0x33')]=_[_0x005b('0x30')](_0x25d08b[_0x005b('0x31')],qs['fields'](_0x333dbe[_0x005b('0x2e')][_0x005b('0x32')]));_0x160301[_0x005b('0x33')]=_0x160301[_0x005b('0x33')][_0x005b('0x43')]?_0x160301['attributes']:_0x25d08b[_0x005b('0x31')];_0x160301['order']=qs[_0x005b('0x36')](_0x333dbe[_0x005b('0x2e')]['sort']);_0x160301[_0x005b('0x39')]=qs[_0x005b('0x37')](_[_0x005b('0x38')](_0x333dbe['query'],_0x25d08b[_0x005b('0x37')]));if(_0x333dbe['query'][_0x005b('0x3c')]){_0x160301[_0x005b('0x39')]=_['merge'](_0x160301[_0x005b('0x39')],{'$or':_['map'](_0x160301[_0x005b('0x33')],function(_0x514be4){var _0x4fd74c={};_0x4fd74c[_0x514be4]={'$like':'%'+_0x333dbe[_0x005b('0x2e')]['filter']+'%'};return _0x4fd74c;})});}_0x160301=_[_0x005b('0x3a')]({},_0x160301,_0x333dbe['options']);return _0x2beed7[_0x005b('0x50')](_0x160301);}})[_0x005b('0x23')](function(_0x4423cb){if(_0x4423cb){_0x54c17e=_0x4423cb['length'];if(!_0x333dbe[_0x005b('0x2e')]['hasOwnProperty']('nolimit')){_0x160301[_0x005b('0x1e')]=qs[_0x005b('0x1e')](_0x333dbe[_0x005b('0x2e')][_0x005b('0x1e')]);_0x160301[_0x005b('0x1c')]=qs[_0x005b('0x1c')](_0x333dbe[_0x005b('0x2e')]['offset']);}return _0x2beed7[_0x005b('0x50')](_0x160301);}})[_0x005b('0x23')](function(_0xdab109){if(_0xdab109){return _0xdab109?{'count':_0x54c17e,'rows':_0xdab109}:null;}})[_0x005b('0x23')](respondWithResult(_0x296af0,null))[_0x005b('0x46')](handleError(_0x296af0,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 1afaf90..d7a4556 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 _0x7978=['exports','define','int_zoho_configurations','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2d778d,_0x453b15){var _0x41d05b=function(_0x2ebeef){while(--_0x2ebeef){_0x2d778d['push'](_0x2d778d['shift']());}};_0x41d05b(++_0x453b15);}(_0x7978,0xa3));var _0x8797=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x7978[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8797('0x0'))(_0x8797('0x1'));var moment=require(_0x8797('0x2'));var BPromise=require(_0x8797('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8797('0x4'));var rimraf=require(_0x8797('0x5'));var config=require(_0x8797('0x6'));var attributes=require('./intZohoConfiguration.attributes');module[_0x8797('0x7')]=function(_0xdec84f,_0x1ea267){return _0xdec84f[_0x8797('0x8')]('ZohoConfiguration',attributes,{'tableName':_0x8797('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb81=['path','rimraf','exports','define','ZohoConfiguration','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xf17dc6,_0x384f92){var _0x2c1a6c=function(_0x51b2a9){while(--_0x51b2a9){_0xf17dc6['push'](_0xf17dc6['shift']());}};_0x2c1a6c(++_0x384f92);}(_0xfb81,0x186));var _0x1fb8=function(_0x230951,_0x4dad52){_0x230951=_0x230951-0x0;var _0xeb26b1=_0xfb81[_0x230951];return _0xeb26b1;};'use strict';var _=require('lodash');var util=require(_0x1fb8('0x0'));var logger=require(_0x1fb8('0x1'))(_0x1fb8('0x2'));var moment=require(_0x1fb8('0x3'));var BPromise=require(_0x1fb8('0x4'));var rp=require(_0x1fb8('0x5'));var fs=require('fs');var path=require(_0x1fb8('0x6'));var rimraf=require(_0x1fb8('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x1fb8('0x8')]=function(_0x3e7531,_0x108778){return _0x3e7531[_0x1fb8('0x9')](_0x1fb8('0xa'),attributes,{'tableName':'int_zoho_configurations','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 0f423ee..1c17db2 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 _0x339f=['request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x280584,_0x2e40b6){var _0x5c3b73=function(_0x241400){while(--_0x241400){_0x280584['push'](_0x280584['shift']());}};_0x5c3b73(++_0x2e40b6);}(_0x339f,0x114));var _0xf339=function(_0x28d75e,_0x2208a5){_0x28d75e=_0x28d75e-0x0;var _0x36ca32=_0x339f[_0x28d75e];return _0x36ca32;};'use strict';var _=require('lodash');var util=require(_0xf339('0x0'));var moment=require(_0xf339('0x1'));var BPromise=require('bluebird');var rs=require(_0xf339('0x2'));var fs=require('fs');var Redis=require(_0xf339('0x3'));var db=require(_0xf339('0x4'))['db'];var utils=require(_0xf339('0x5'));var logger=require('../../config/logger')(_0xf339('0x6'));var config=require(_0xf339('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf339('0x8')][_0xf339('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4dc71e,_0x53186f,_0x1b0304){return new BPromise(function(_0x5b32c9,_0xca11e1){return client[_0xf339('0xa')](_0x4dc71e,_0x1b0304)[_0xf339('0xb')](function(_0x2283bb){logger[_0xf339('0xc')](_0xf339('0xd'),_0x53186f,_0xf339('0xe'));logger[_0xf339('0xf')](_0xf339('0x10'),_0x53186f,_0xf339('0xe'),JSON[_0xf339('0x11')](_0x2283bb));if(_0x2283bb['error']){if(_0x2283bb[_0xf339('0x12')][_0xf339('0x13')]===0x1f4){logger[_0xf339('0x12')](_0xf339('0xd'),_0x53186f,_0x2283bb[_0xf339('0x12')]['message']);return _0xca11e1(_0x2283bb[_0xf339('0x12')][_0xf339('0x14')]);}logger[_0xf339('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x53186f,_0x2283bb['error'][_0xf339('0x14')]);return _0x5b32c9(_0x2283bb[_0xf339('0x12')][_0xf339('0x14')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x53186f,_0xf339('0xe'));_0x5b32c9(_0x2283bb[_0xf339('0x15')]['message']);}})['catch'](function(_0x5a82fb){logger[_0xf339('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x53186f,_0x5a82fb);_0xca11e1(_0x5a82fb);});});} \ No newline at end of file +var _0xcfad=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0xcfad,0x14d));var _0xdcfa=function(_0x21930d,_0x4127f8){_0x21930d=_0x21930d-0x0;var _0x5667db=_0xcfad[_0x21930d];return _0x5667db;};'use strict';var _=require(_0xdcfa('0x0'));var util=require(_0xdcfa('0x1'));var moment=require(_0xdcfa('0x2'));var BPromise=require('bluebird');var rs=require(_0xdcfa('0x3'));var fs=require('fs');var Redis=require(_0xdcfa('0x4'));var db=require(_0xdcfa('0x5'))['db'];var utils=require(_0xdcfa('0x6'));var logger=require('../../config/logger')(_0xdcfa('0x7'));var config=require(_0xdcfa('0x8'));var jayson=require(_0xdcfa('0x9'));var client=jayson[_0xdcfa('0xa')][_0xdcfa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c43aa,_0x1eeeb1,_0x43b074){return new BPromise(function(_0x5d6684,_0x14dfd9){return client[_0xdcfa('0xc')](_0x3c43aa,_0x43b074)[_0xdcfa('0xd')](function(_0x3b65e1){logger['info'](_0xdcfa('0xe'),_0x1eeeb1,_0xdcfa('0xf'));logger[_0xdcfa('0x10')](_0xdcfa('0x11'),_0x1eeeb1,_0xdcfa('0xf'),JSON[_0xdcfa('0x12')](_0x3b65e1));if(_0x3b65e1[_0xdcfa('0x13')]){if(_0x3b65e1[_0xdcfa('0x13')][_0xdcfa('0x14')]===0x1f4){logger[_0xdcfa('0x13')](_0xdcfa('0xe'),_0x1eeeb1,_0x3b65e1[_0xdcfa('0x13')][_0xdcfa('0x15')]);return _0x14dfd9(_0x3b65e1['error'][_0xdcfa('0x15')]);}logger[_0xdcfa('0x13')](_0xdcfa('0xe'),_0x1eeeb1,_0x3b65e1[_0xdcfa('0x13')][_0xdcfa('0x15')]);return _0x5d6684(_0x3b65e1[_0xdcfa('0x13')][_0xdcfa('0x15')]);}else{logger[_0xdcfa('0x16')]('ZohoConfiguration,\x20%s,\x20%s',_0x1eeeb1,_0xdcfa('0xf'));_0x5d6684(_0x3b65e1[_0xdcfa('0x17')][_0xdcfa('0x15')]);}})[_0xdcfa('0x18')](function(_0x41b7e6){logger[_0xdcfa('0x13')](_0xdcfa('0xe'),_0x1eeeb1,_0x41b7e6);_0x14dfd9(_0x41b7e6);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index e4bc677..c22e3fa 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 _0x648e=['show','post','isAuthenticated','put','update','delete','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id'];(function(_0x5b285d,_0x5a9a5e){var _0x405c68=function(_0xce1d7f){while(--_0xce1d7f){_0x5b285d['push'](_0x5b285d['shift']());}};_0x405c68(++_0x5a9a5e);}(_0x648e,0xa0));var _0xe648=function(_0x185aba,_0x339d35){_0x185aba=_0x185aba-0x0;var _0x40afe7=_0x648e[_0x185aba];return _0x40afe7;};'use strict';var multer=require('multer');var util=require(_0xe648('0x0'));var path=require('path');var timeout=require(_0xe648('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe648('0x2'));var auth=require(_0xe648('0x3'));var interaction=require(_0xe648('0x4'));var config=require(_0xe648('0x5'));var controller=require(_0xe648('0x6'));router[_0xe648('0x7')]('/',auth['isAuthenticated'](),controller[_0xe648('0x8')]);router[_0xe648('0x7')](_0xe648('0x9'),auth['isAuthenticated'](),controller[_0xe648('0xa')]);router[_0xe648('0xb')]('/',auth[_0xe648('0xc')](),controller['create']);router[_0xe648('0xd')](_0xe648('0x9'),auth['isAuthenticated'](),controller[_0xe648('0xe')]);router[_0xe648('0xf')](_0xe648('0x9'),auth[_0xe648('0xc')](),controller['destroy']);module[_0xe648('0x10')]=router; \ No newline at end of file +var _0x7c61=['isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intZohoField.controller'];(function(_0x23154d,_0x4d195f){var _0x300430=function(_0x38300b){while(--_0x38300b){_0x23154d['push'](_0x23154d['shift']());}};_0x300430(++_0x4d195f);}(_0x7c61,0x14e));var _0x17c6=function(_0x1e752d,_0x4c6de7){_0x1e752d=_0x1e752d-0x0;var _0x1bb8ab=_0x7c61[_0x1e752d];return _0x1bb8ab;};'use strict';var multer=require(_0x17c6('0x0'));var util=require(_0x17c6('0x1'));var path=require(_0x17c6('0x2'));var timeout=require(_0x17c6('0x3'));var express=require(_0x17c6('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x17c6('0x5'));var interaction=require(_0x17c6('0x6'));var config=require('../../config/environment');var controller=require(_0x17c6('0x7'));router['get']('/',auth[_0x17c6('0x8')](),controller[_0x17c6('0x9')]);router[_0x17c6('0xa')](_0x17c6('0xb'),auth[_0x17c6('0x8')](),controller[_0x17c6('0xc')]);router[_0x17c6('0xd')]('/',auth['isAuthenticated'](),controller[_0x17c6('0xe')]);router['put']('/:id',auth[_0x17c6('0x8')](),controller[_0x17c6('0xf')]);router[_0x17c6('0x10')](_0x17c6('0xb'),auth[_0x17c6('0x8')](),controller[_0x17c6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 5a98a33..2590d37 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 _0x2c49=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x2929ac,_0x56a221){var _0x4e1633=function(_0x1ac710){while(--_0x1ac710){_0x2929ac['push'](_0x2929ac['shift']());}};_0x4e1633(++_0x56a221);}(_0x2c49,0xe5));var _0x92c4=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0x2c49[_0x22cc16];return _0x399b70;};'use strict';var Sequelize=require(_0x92c4('0x0'));module[_0x92c4('0x1')]={'type':{'type':Sequelize[_0x92c4('0x2')](_0x92c4('0x3'),_0x92c4('0x4'),_0x92c4('0x5'),_0x92c4('0x6'),_0x92c4('0x7')),'defaultValue':_0x92c4('0x3')},'content':{'type':Sequelize[_0x92c4('0x8')]},'key':{'type':Sequelize[_0x92c4('0x8')]},'keyType':{'type':Sequelize[_0x92c4('0x2')](_0x92c4('0x3'),'variable',_0x92c4('0x5'))},'keyContent':{'type':Sequelize[_0x92c4('0x8')]},'idField':{'type':Sequelize[_0x92c4('0x8')]},'nameField':{'type':Sequelize[_0x92c4('0x8')]},'customField':{'type':Sequelize[_0x92c4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x92c4('0x8')]}}; \ No newline at end of file +var _0xd859=['picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x473032,_0x14e909){var _0x3bc6c7=function(_0x3001b8){while(--_0x3001b8){_0x473032['push'](_0x473032['shift']());}};_0x3bc6c7(++_0x14e909);}(_0xd859,0x81));var _0x9d85=function(_0x4f0a1d,_0x2228c5){_0x4f0a1d=_0x4f0a1d-0x0;var _0x4a5f66=_0xd859[_0x4f0a1d];return _0x4a5f66;};'use strict';var Sequelize=require(_0x9d85('0x0'));module['exports']={'type':{'type':Sequelize[_0x9d85('0x1')](_0x9d85('0x2'),_0x9d85('0x3'),_0x9d85('0x4'),_0x9d85('0x5'),_0x9d85('0x6')),'defaultValue':_0x9d85('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9d85('0x7')]},'keyType':{'type':Sequelize[_0x9d85('0x1')](_0x9d85('0x2'),_0x9d85('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9d85('0x7')]},'customField':{'type':Sequelize[_0x9d85('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9d85('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 42f1de5..608c924 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 _0x9ea6=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','index','map','ZohoField','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','fields','find','create','body','params','eml-format','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api'];(function(_0x330b58,_0x3101ae){var _0x286224=function(_0xb9bf5e){while(--_0xb9bf5e){_0x330b58['push'](_0x330b58['shift']());}};_0x286224(++_0x3101ae);}(_0x9ea6,0xc5));var _0x69ea=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x9ea6[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0x69ea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x69ea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x69ea('0x2'));var BPromise=require(_0x69ea('0x3'));var Mustache=require(_0x69ea('0x4'));var util=require('util');var path=require(_0x69ea('0x5'));var sox=require(_0x69ea('0x6'));var csv=require(_0x69ea('0x7'));var ejs=require(_0x69ea('0x8'));var fs=require('fs');var fs_extra=require(_0x69ea('0x9'));var _=require('lodash');var squel=require(_0x69ea('0xa'));var crypto=require(_0x69ea('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x69ea('0xc'));var toCsv=require(_0x69ea('0x7'));var querystring=require(_0x69ea('0xd'));var Papa=require(_0x69ea('0xe'));var Redis=require('ioredis');var authService=require(_0x69ea('0xf'));var qs=require(_0x69ea('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x69ea('0x11'))(_0x69ea('0x12'));var utils=require(_0x69ea('0x13'));var config=require(_0x69ea('0x14'));var licenseUtil=require(_0x69ea('0x15'));var db=require(_0x69ea('0x16'))['db'];function respondWithStatusCode(_0x219bcb,_0x327983){_0x327983=_0x327983||0xcc;return function(_0x5206ef){if(_0x5206ef){return _0x219bcb[_0x69ea('0x17')](_0x327983);}return _0x219bcb[_0x69ea('0x18')](_0x327983)['end']();};}function respondWithResult(_0x673b95,_0x5576ed){_0x5576ed=_0x5576ed||0xc8;return function(_0x459b8b){if(_0x459b8b){return _0x673b95[_0x69ea('0x18')](_0x5576ed)[_0x69ea('0x19')](_0x459b8b);}};}function respondWithFilteredResult(_0x2a68bf,_0xce3cac){return function(_0x88eca5){if(_0x88eca5){var _0x21ea7c=typeof _0xce3cac[_0x69ea('0x1a')]===_0x69ea('0x1b')&&typeof _0xce3cac[_0x69ea('0x1c')]===_0x69ea('0x1b');var _0x19c4ae=_0x88eca5[_0x69ea('0x1d')];var _0x127881=_0x21ea7c?0x0:_0xce3cac[_0x69ea('0x1a')];var _0x1fc60b=_0x21ea7c?_0x88eca5[_0x69ea('0x1d')]:_0xce3cac[_0x69ea('0x1a')]+_0xce3cac[_0x69ea('0x1c')];var _0x4a0878;if(_0x1fc60b>=_0x19c4ae){_0x1fc60b=_0x19c4ae;_0x4a0878=0xc8;}else{_0x4a0878=0xce;}_0x2a68bf[_0x69ea('0x18')](_0x4a0878);return _0x2a68bf[_0x69ea('0x1e')](_0x69ea('0x1f'),_0x127881+'-'+_0x1fc60b+'/'+_0x19c4ae)[_0x69ea('0x19')](_0x88eca5);}return null;};}function patchUpdates(_0x5e7cab){return function(_0x35bc16){try{jsonpatch[_0x69ea('0x20')](_0x35bc16,_0x5e7cab,!![]);}catch(_0x7a40f0){return BPromise[_0x69ea('0x21')](_0x7a40f0);}return _0x35bc16[_0x69ea('0x22')]();};}function saveUpdates(_0x521902,_0x10b3de){return function(_0x17f8f0){if(_0x17f8f0){return _0x17f8f0[_0x69ea('0x23')](_0x521902)[_0x69ea('0x24')](function(_0x4b4261){return _0x4b4261;});}return null;};}function removeEntity(_0x228516,_0x3cd7cb){return function(_0x4438d9){if(_0x4438d9){return _0x4438d9[_0x69ea('0x25')]()[_0x69ea('0x24')](function(){_0x228516[_0x69ea('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2056f9,_0x38f259){return function(_0x54aecd){if(!_0x54aecd){_0x2056f9[_0x69ea('0x17')](0x194);}return _0x54aecd;};}function handleError(_0x5b8201,_0x186150){_0x186150=_0x186150||0x1f4;return function(_0x160159){logger['error'](_0x160159[_0x69ea('0x26')]);if(_0x160159['name']){delete _0x160159['name'];}_0x5b8201[_0x69ea('0x18')](_0x186150)[_0x69ea('0x27')](_0x160159);};}exports[_0x69ea('0x28')]=function(_0xe8f92c,_0x5543c8){var _0x7c2b85={},_0x9bde71={},_0x19942c={'count':0x0,'rows':[]};var _0x40d30c=_[_0x69ea('0x29')](db[_0x69ea('0x2a')][_0x69ea('0x2b')],function(_0x4aae84){return{'name':_0x4aae84[_0x69ea('0x2c')],'type':_0x4aae84['type'][_0x69ea('0x2d')]};});_0x9bde71[_0x69ea('0x2e')]=_[_0x69ea('0x29')](_0x40d30c,_0x69ea('0x2f'));_0x9bde71[_0x69ea('0x30')]=_[_0x69ea('0x31')](_0xe8f92c[_0x69ea('0x30')]);_0x9bde71[_0x69ea('0x32')]=_[_0x69ea('0x33')](_0x9bde71[_0x69ea('0x2e')],_0x9bde71[_0x69ea('0x30')]);_0x7c2b85[_0x69ea('0x34')]=_[_0x69ea('0x33')](_0x9bde71['model'],qs['fields'](_0xe8f92c[_0x69ea('0x30')]['fields']));_0x7c2b85[_0x69ea('0x34')]=_0x7c2b85[_0x69ea('0x34')][_0x69ea('0x35')]?_0x7c2b85[_0x69ea('0x34')]:_0x9bde71[_0x69ea('0x2e')];if(!_0xe8f92c['query']['hasOwnProperty'](_0x69ea('0x36'))){_0x7c2b85['limit']=qs[_0x69ea('0x1c')](_0xe8f92c[_0x69ea('0x30')][_0x69ea('0x1c')]);_0x7c2b85[_0x69ea('0x1a')]=qs[_0x69ea('0x1a')](_0xe8f92c['query'][_0x69ea('0x1a')]);}_0x7c2b85[_0x69ea('0x37')]=qs[_0x69ea('0x38')](_0xe8f92c[_0x69ea('0x30')][_0x69ea('0x38')]);_0x7c2b85[_0x69ea('0x39')]=qs[_0x69ea('0x32')](_['pick'](_0xe8f92c[_0x69ea('0x30')],_0x9bde71[_0x69ea('0x32')]),_0x40d30c);if(_0xe8f92c[_0x69ea('0x30')][_0x69ea('0x3a')]){_0x7c2b85[_0x69ea('0x39')]=_[_0x69ea('0x3b')](_0x7c2b85['where'],{'$or':_[_0x69ea('0x29')](_0x40d30c,function(_0x52cd62){if(_0x52cd62[_0x69ea('0x3c')]!==_0x69ea('0x3d')){var _0x2ce48b={};_0x2ce48b[_0x52cd62[_0x69ea('0x2f')]]={'$like':'%'+_0xe8f92c[_0x69ea('0x30')][_0x69ea('0x3a')]+'%'};return _0x2ce48b;}})});}_0x7c2b85=_['merge']({},_0x7c2b85,_0xe8f92c[_0x69ea('0x3e')]);var _0x44d128={'where':_0x7c2b85[_0x69ea('0x39')]};return db[_0x69ea('0x2a')][_0x69ea('0x1d')](_0x44d128)[_0x69ea('0x24')](function(_0x2183b7){_0x19942c[_0x69ea('0x1d')]=_0x2183b7;if(_0xe8f92c[_0x69ea('0x30')][_0x69ea('0x3f')]){_0x7c2b85[_0x69ea('0x40')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x7c2b85);})[_0x69ea('0x24')](function(_0x34efda){_0x19942c['rows']=_0x34efda;return _0x19942c;})[_0x69ea('0x24')](respondWithFilteredResult(_0x5543c8,_0x7c2b85))[_0x69ea('0x41')](handleError(_0x5543c8,null));};exports[_0x69ea('0x42')]=function(_0xb2974f,_0x3b5c7c){var _0x4ae88a={'raw':!![],'where':{'id':_0xb2974f['params']['id']}},_0x57d3cb={};_0x57d3cb['model']=_[_0x69ea('0x31')](db[_0x69ea('0x2a')][_0x69ea('0x2b')]);_0x57d3cb[_0x69ea('0x30')]=_[_0x69ea('0x31')](_0xb2974f['query']);_0x57d3cb[_0x69ea('0x32')]=_[_0x69ea('0x33')](_0x57d3cb[_0x69ea('0x2e')],_0x57d3cb[_0x69ea('0x30')]);_0x4ae88a[_0x69ea('0x34')]=_[_0x69ea('0x33')](_0x57d3cb[_0x69ea('0x2e')],qs[_0x69ea('0x43')](_0xb2974f['query'][_0x69ea('0x43')]));_0x4ae88a['attributes']=_0x4ae88a[_0x69ea('0x34')]['length']?_0x4ae88a['attributes']:_0x57d3cb[_0x69ea('0x2e')];if(_0xb2974f[_0x69ea('0x30')][_0x69ea('0x3f')]){_0x4ae88a[_0x69ea('0x40')]=[{'all':!![]}];}_0x4ae88a=_[_0x69ea('0x3b')]({},_0x4ae88a,_0xb2974f[_0x69ea('0x3e')]);return db[_0x69ea('0x2a')][_0x69ea('0x44')](_0x4ae88a)['then'](handleEntityNotFound(_0x3b5c7c,null))[_0x69ea('0x24')](respondWithResult(_0x3b5c7c,null))[_0x69ea('0x41')](handleError(_0x3b5c7c,null));};exports[_0x69ea('0x45')]=function(_0x11217e,_0x537f27){return db[_0x69ea('0x2a')][_0x69ea('0x45')](_0x11217e[_0x69ea('0x46')],{})[_0x69ea('0x24')](respondWithResult(_0x537f27,0xc9))[_0x69ea('0x41')](handleError(_0x537f27,null));};exports[_0x69ea('0x23')]=function(_0x2b5f3b,_0x1e3720){if(_0x2b5f3b[_0x69ea('0x46')]['id']){delete _0x2b5f3b[_0x69ea('0x46')]['id'];}return db['ZohoField'][_0x69ea('0x44')]({'where':{'id':_0x2b5f3b[_0x69ea('0x47')]['id']}})[_0x69ea('0x24')](handleEntityNotFound(_0x1e3720,null))[_0x69ea('0x24')](saveUpdates(_0x2b5f3b['body'],null))['then'](respondWithResult(_0x1e3720,null))[_0x69ea('0x41')](handleError(_0x1e3720,null));};exports[_0x69ea('0x25')]=function(_0x502959,_0x546b48){return db[_0x69ea('0x2a')][_0x69ea('0x44')]({'where':{'id':_0x502959[_0x69ea('0x47')]['id']}})[_0x69ea('0x24')](handleEntityNotFound(_0x546b48,null))[_0x69ea('0x24')](removeEntity(_0x546b48,null))['catch'](handleError(_0x546b48,null));}; \ No newline at end of file +var _0x3ffd=['params','length','create','body','eml-format','zip-dir','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','Content-Range','apply','update','then','error','stack','name','send','index','map','ZohoField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','catch','show'];(function(_0xb7cb72,_0x19d391){var _0x4b7570=function(_0x5a4a93){while(--_0x5a4a93){_0xb7cb72['push'](_0xb7cb72['shift']());}};_0x4b7570(++_0x19d391);}(_0x3ffd,0x84));var _0xd3ff=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0x3ffd[_0x3fb9dd];return _0x20136a;};'use strict';var emlformat=require(_0xd3ff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3ff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd3ff('0x2'));var path=require(_0xd3ff('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd3ff('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd3ff('0x5'));var squel=require(_0xd3ff('0x6'));var crypto=require(_0xd3ff('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xd3ff('0x8'));var toCsv=require(_0xd3ff('0x9'));var querystring=require(_0xd3ff('0xa'));var Papa=require(_0xd3ff('0xb'));var Redis=require('ioredis');var authService=require(_0xd3ff('0xc'));var qs=require(_0xd3ff('0xd'));var as=require(_0xd3ff('0xe'));var hardwareService=require(_0xd3ff('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xd3ff('0x10'));var config=require(_0xd3ff('0x11'));var licenseUtil=require(_0xd3ff('0x12'));var db=require(_0xd3ff('0x13'))['db'];function respondWithStatusCode(_0x56e8b4,_0x10b5d9){_0x10b5d9=_0x10b5d9||0xcc;return function(_0x5da232){if(_0x5da232){return _0x56e8b4['sendStatus'](_0x10b5d9);}return _0x56e8b4[_0xd3ff('0x14')](_0x10b5d9)[_0xd3ff('0x15')]();};}function respondWithResult(_0x450596,_0x4c9104){_0x4c9104=_0x4c9104||0xc8;return function(_0x5a8c0f){if(_0x5a8c0f){return _0x450596[_0xd3ff('0x14')](_0x4c9104)[_0xd3ff('0x16')](_0x5a8c0f);}};}function respondWithFilteredResult(_0x3a55f4,_0x4cff73){return function(_0x246b98){if(_0x246b98){var _0x31f439=typeof _0x4cff73['offset']==='undefined'&&typeof _0x4cff73['limit']==='undefined';var _0x34ddd9=_0x246b98[_0xd3ff('0x17')];var _0x49b2e4=_0x31f439?0x0:_0x4cff73[_0xd3ff('0x18')];var _0x575446=_0x31f439?_0x246b98['count']:_0x4cff73[_0xd3ff('0x18')]+_0x4cff73['limit'];var _0x91025e;if(_0x575446>=_0x34ddd9){_0x575446=_0x34ddd9;_0x91025e=0xc8;}else{_0x91025e=0xce;}_0x3a55f4[_0xd3ff('0x14')](_0x91025e);return _0x3a55f4['set'](_0xd3ff('0x19'),_0x49b2e4+'-'+_0x575446+'/'+_0x34ddd9)['json'](_0x246b98);}return null;};}function patchUpdates(_0x4ca087){return function(_0x48e37d){try{jsonpatch[_0xd3ff('0x1a')](_0x48e37d,_0x4ca087,!![]);}catch(_0x1ceec9){return BPromise['reject'](_0x1ceec9);}return _0x48e37d['save']();};}function saveUpdates(_0x39ba4d,_0x5597e6){return function(_0x2f7acf){if(_0x2f7acf){return _0x2f7acf[_0xd3ff('0x1b')](_0x39ba4d)[_0xd3ff('0x1c')](function(_0x2bebc8){return _0x2bebc8;});}return null;};}function removeEntity(_0x84065d,_0x2c445e){return function(_0x28097f){if(_0x28097f){return _0x28097f['destroy']()[_0xd3ff('0x1c')](function(){_0x84065d[_0xd3ff('0x14')](0xcc)[_0xd3ff('0x15')]();});}};}function handleEntityNotFound(_0xd6fdfb,_0x17a53f){return function(_0x5d9b6e){if(!_0x5d9b6e){_0xd6fdfb['sendStatus'](0x194);}return _0x5d9b6e;};}function handleError(_0x5bb0b3,_0x4cd994){_0x4cd994=_0x4cd994||0x1f4;return function(_0x117c6a){logger[_0xd3ff('0x1d')](_0x117c6a[_0xd3ff('0x1e')]);if(_0x117c6a[_0xd3ff('0x1f')]){delete _0x117c6a[_0xd3ff('0x1f')];}_0x5bb0b3[_0xd3ff('0x14')](_0x4cd994)[_0xd3ff('0x20')](_0x117c6a);};}exports[_0xd3ff('0x21')]=function(_0x4decc6,_0x24c5f8){var _0x3fb4f0={},_0x3e2b70={},_0x1a4d92={'count':0x0,'rows':[]};var _0x78ea6e=_[_0xd3ff('0x22')](db[_0xd3ff('0x23')]['rawAttributes'],function(_0x22c6fa){return{'name':_0x22c6fa[_0xd3ff('0x24')],'type':_0x22c6fa[_0xd3ff('0x25')][_0xd3ff('0x26')]};});_0x3e2b70[_0xd3ff('0x27')]=_[_0xd3ff('0x22')](_0x78ea6e,_0xd3ff('0x1f'));_0x3e2b70[_0xd3ff('0x28')]=_[_0xd3ff('0x29')](_0x4decc6['query']);_0x3e2b70[_0xd3ff('0x2a')]=_[_0xd3ff('0x2b')](_0x3e2b70[_0xd3ff('0x27')],_0x3e2b70[_0xd3ff('0x28')]);_0x3fb4f0[_0xd3ff('0x2c')]=_[_0xd3ff('0x2b')](_0x3e2b70['model'],qs[_0xd3ff('0x2d')](_0x4decc6[_0xd3ff('0x28')][_0xd3ff('0x2d')]));_0x3fb4f0[_0xd3ff('0x2c')]=_0x3fb4f0[_0xd3ff('0x2c')]['length']?_0x3fb4f0[_0xd3ff('0x2c')]:_0x3e2b70['model'];if(!_0x4decc6[_0xd3ff('0x28')][_0xd3ff('0x2e')]('nolimit')){_0x3fb4f0[_0xd3ff('0x2f')]=qs[_0xd3ff('0x2f')](_0x4decc6[_0xd3ff('0x28')][_0xd3ff('0x2f')]);_0x3fb4f0[_0xd3ff('0x18')]=qs[_0xd3ff('0x18')](_0x4decc6['query'][_0xd3ff('0x18')]);}_0x3fb4f0[_0xd3ff('0x30')]=qs[_0xd3ff('0x31')](_0x4decc6['query']['sort']);_0x3fb4f0['where']=qs[_0xd3ff('0x2a')](_[_0xd3ff('0x32')](_0x4decc6[_0xd3ff('0x28')],_0x3e2b70[_0xd3ff('0x2a')]),_0x78ea6e);if(_0x4decc6[_0xd3ff('0x28')]['filter']){_0x3fb4f0[_0xd3ff('0x33')]=_['merge'](_0x3fb4f0['where'],{'$or':_['map'](_0x78ea6e,function(_0x229a85){if(_0x229a85['type']!==_0xd3ff('0x34')){var _0x2ae76b={};_0x2ae76b[_0x229a85[_0xd3ff('0x1f')]]={'$like':'%'+_0x4decc6['query'][_0xd3ff('0x35')]+'%'};return _0x2ae76b;}})});}_0x3fb4f0=_[_0xd3ff('0x36')]({},_0x3fb4f0,_0x4decc6[_0xd3ff('0x37')]);var _0x1a68f7={'where':_0x3fb4f0[_0xd3ff('0x33')]};return db[_0xd3ff('0x23')][_0xd3ff('0x17')](_0x1a68f7)[_0xd3ff('0x1c')](function(_0x2c6c5f){_0x1a4d92[_0xd3ff('0x17')]=_0x2c6c5f;if(_0x4decc6[_0xd3ff('0x28')][_0xd3ff('0x38')]){_0x3fb4f0[_0xd3ff('0x39')]=[{'all':!![]}];}return db[_0xd3ff('0x23')]['findAll'](_0x3fb4f0);})[_0xd3ff('0x1c')](function(_0xf6757d){_0x1a4d92['rows']=_0xf6757d;return _0x1a4d92;})[_0xd3ff('0x1c')](respondWithFilteredResult(_0x24c5f8,_0x3fb4f0))[_0xd3ff('0x3a')](handleError(_0x24c5f8,null));};exports[_0xd3ff('0x3b')]=function(_0xa9281f,_0x4c34b0){var _0x28e605={'raw':!![],'where':{'id':_0xa9281f[_0xd3ff('0x3c')]['id']}},_0x187fd2={};_0x187fd2[_0xd3ff('0x27')]=_['keys'](db[_0xd3ff('0x23')]['rawAttributes']);_0x187fd2['query']=_[_0xd3ff('0x29')](_0xa9281f[_0xd3ff('0x28')]);_0x187fd2[_0xd3ff('0x2a')]=_[_0xd3ff('0x2b')](_0x187fd2[_0xd3ff('0x27')],_0x187fd2[_0xd3ff('0x28')]);_0x28e605['attributes']=_[_0xd3ff('0x2b')](_0x187fd2['model'],qs[_0xd3ff('0x2d')](_0xa9281f[_0xd3ff('0x28')][_0xd3ff('0x2d')]));_0x28e605[_0xd3ff('0x2c')]=_0x28e605[_0xd3ff('0x2c')][_0xd3ff('0x3d')]?_0x28e605[_0xd3ff('0x2c')]:_0x187fd2[_0xd3ff('0x27')];if(_0xa9281f[_0xd3ff('0x28')][_0xd3ff('0x38')]){_0x28e605[_0xd3ff('0x39')]=[{'all':!![]}];}_0x28e605=_['merge']({},_0x28e605,_0xa9281f['options']);return db[_0xd3ff('0x23')]['find'](_0x28e605)[_0xd3ff('0x1c')](handleEntityNotFound(_0x4c34b0,null))[_0xd3ff('0x1c')](respondWithResult(_0x4c34b0,null))[_0xd3ff('0x3a')](handleError(_0x4c34b0,null));};exports[_0xd3ff('0x3e')]=function(_0xbe1225,_0x331f62){return db[_0xd3ff('0x23')]['create'](_0xbe1225[_0xd3ff('0x3f')],{})[_0xd3ff('0x1c')](respondWithResult(_0x331f62,0xc9))['catch'](handleError(_0x331f62,null));};exports[_0xd3ff('0x1b')]=function(_0x18a2d8,_0x45bd12){if(_0x18a2d8[_0xd3ff('0x3f')]['id']){delete _0x18a2d8[_0xd3ff('0x3f')]['id'];}return db[_0xd3ff('0x23')]['find']({'where':{'id':_0x18a2d8[_0xd3ff('0x3c')]['id']}})['then'](handleEntityNotFound(_0x45bd12,null))[_0xd3ff('0x1c')](saveUpdates(_0x18a2d8[_0xd3ff('0x3f')],null))[_0xd3ff('0x1c')](respondWithResult(_0x45bd12,null))[_0xd3ff('0x3a')](handleError(_0x45bd12,null));};exports['destroy']=function(_0x3abad8,_0x25e59a){return db[_0xd3ff('0x23')]['find']({'where':{'id':_0x3abad8[_0xd3ff('0x3c')]['id']}})['then'](handleEntityNotFound(_0x25e59a,null))[_0xd3ff('0x1c')](removeEntity(_0x25e59a,null))[_0xd3ff('0x3a')](handleError(_0x25e59a,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index e39c13c..d3681f7 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 _0x33af=['moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','util','api'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x33af,0xec));var _0xf33a=function(_0x531ec4,_0x203380){_0x531ec4=_0x531ec4-0x0;var _0x43fd6f=_0x33af[_0x531ec4];return _0x43fd6f;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));module[_0xf33a('0x8')]=function(_0x583e54,_0xc0dd13){return _0x583e54[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[{'name':_0xf33a('0xc'),'fields':[_0xf33a('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe2fe=['zoho_unique_index','FieldId','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoField'];(function(_0x18bfdb,_0x241d43){var _0x44334c=function(_0x55e999){while(--_0x55e999){_0x18bfdb['push'](_0x18bfdb['shift']());}};_0x44334c(++_0x241d43);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intZohoField.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['idField',_0xee2f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index fd292db..3f5bd1f 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 _0x9cf4=['jayson/promise','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x449892,_0x2a2cb7){var _0x3cde6a=function(_0xe393af){while(--_0xe393af){_0x449892['push'](_0x449892['shift']());}};_0x3cde6a(++_0x2a2cb7);}(_0x9cf4,0x16d));var _0x49cf=function(_0x20d80c,_0x57f4bc){_0x20d80c=_0x20d80c-0x0;var _0x39ff0a=_0x9cf4[_0x20d80c];return _0x39ff0a;};'use strict';var _=require(_0x49cf('0x0'));var util=require(_0x49cf('0x1'));var moment=require(_0x49cf('0x2'));var BPromise=require(_0x49cf('0x3'));var rs=require(_0x49cf('0x4'));var fs=require('fs');var Redis=require(_0x49cf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x49cf('0x6'));var logger=require(_0x49cf('0x7'))('rpc');var config=require(_0x49cf('0x8'));var jayson=require(_0x49cf('0x9'));var client=jayson['client'][_0x49cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31750e,_0x2e296d,_0x3b61ed){return new BPromise(function(_0x3f03c6,_0x3081d2){return client[_0x49cf('0xb')](_0x31750e,_0x3b61ed)['then'](function(_0x3e73c0){logger[_0x49cf('0xc')](_0x49cf('0xd'),_0x2e296d,_0x49cf('0xe'));logger[_0x49cf('0xf')](_0x49cf('0x10'),_0x2e296d,'request\x20sent',JSON[_0x49cf('0x11')](_0x3e73c0));if(_0x3e73c0[_0x49cf('0x12')]){if(_0x3e73c0[_0x49cf('0x12')]['code']===0x1f4){logger[_0x49cf('0x12')]('ZohoField,\x20%s,\x20%s',_0x2e296d,_0x3e73c0['error'][_0x49cf('0x13')]);return _0x3081d2(_0x3e73c0[_0x49cf('0x12')][_0x49cf('0x13')]);}logger['error'](_0x49cf('0xd'),_0x2e296d,_0x3e73c0[_0x49cf('0x12')][_0x49cf('0x13')]);return _0x3f03c6(_0x3e73c0[_0x49cf('0x12')][_0x49cf('0x13')]);}else{logger[_0x49cf('0xc')](_0x49cf('0xd'),_0x2e296d,_0x49cf('0xe'));_0x3f03c6(_0x3e73c0[_0x49cf('0x14')][_0x49cf('0x13')]);}})[_0x49cf('0x15')](function(_0x3c4c1c){logger[_0x49cf('0x12')](_0x49cf('0xd'),_0x2e296d,_0x3c4c1c);_0x3081d2(_0x3c4c1c);});});} \ No newline at end of file +var _0x44b3=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x20e295,_0x308599){var _0x33ffbe=function(_0x2eeb46){while(--_0x2eeb46){_0x20e295['push'](_0x20e295['shift']());}};_0x33ffbe(++_0x308599);}(_0x44b3,0x1b8));var _0x344b=function(_0x2403fd,_0x4e4aec){_0x2403fd=_0x2403fd-0x0;var _0x4ca7fc=_0x44b3[_0x2403fd];return _0x4ca7fc;};'use strict';var _=require(_0x344b('0x0'));var util=require(_0x344b('0x1'));var moment=require('moment');var BPromise=require(_0x344b('0x2'));var rs=require(_0x344b('0x3'));var fs=require('fs');var Redis=require(_0x344b('0x4'));var db=require(_0x344b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x344b('0x6'))(_0x344b('0x7'));var config=require(_0x344b('0x8'));var jayson=require(_0x344b('0x9'));var client=jayson[_0x344b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f8739,_0x134494,_0x3840a7){return new BPromise(function(_0x54db0b,_0x3dc87a){return client[_0x344b('0xb')](_0x3f8739,_0x3840a7)[_0x344b('0xc')](function(_0x187f37){logger[_0x344b('0xd')](_0x344b('0xe'),_0x134494,_0x344b('0xf'));logger[_0x344b('0x10')](_0x344b('0x11'),_0x134494,'request\x20sent',JSON[_0x344b('0x12')](_0x187f37));if(_0x187f37[_0x344b('0x13')]){if(_0x187f37[_0x344b('0x13')][_0x344b('0x14')]===0x1f4){logger[_0x344b('0x13')](_0x344b('0xe'),_0x134494,_0x187f37[_0x344b('0x13')][_0x344b('0x15')]);return _0x3dc87a(_0x187f37[_0x344b('0x13')][_0x344b('0x15')]);}logger[_0x344b('0x13')](_0x344b('0xe'),_0x134494,_0x187f37['error'][_0x344b('0x15')]);return _0x54db0b(_0x187f37[_0x344b('0x13')]['message']);}else{logger[_0x344b('0xd')](_0x344b('0xe'),_0x134494,'request\x20sent');_0x54db0b(_0x187f37['result'][_0x344b('0x15')]);}})['catch'](function(_0x1322f6){logger[_0x344b('0x13')](_0x344b('0xe'),_0x134494,_0x1322f6);_0x3dc87a(_0x1322f6);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 8c893be..e722e0c 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x28d0f7,_0x579973){var _0x45d26b=function(_0x37dea1){while(--_0x37dea1){_0x28d0f7['push'](_0x28d0f7['shift']());}};_0x45d26b(++_0x579973);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5a69ab,_0x610049){var _0x27f2f7=function(_0x452a0c){while(--_0x452a0c){_0x5a69ab['push'](_0x5a69ab['shift']());}};_0x27f2f7(++_0x610049);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 842ba91..b95669d 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 _0xabbd=['BOOLEAN','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x5ef8ab,_0x235fad){var _0x4839c0=function(_0x3acbfe){while(--_0x3acbfe){_0x5ef8ab['push'](_0x5ef8ab['shift']());}};_0x4839c0(++_0x235fad);}(_0xabbd,0x1f2));var _0xdabb=function(_0x259aab,_0x3c2b69){_0x259aab=_0x259aab-0x0;var _0x2824b1=_0xabbd[_0x259aab];return _0x2824b1;};'use strict';var Sequelize=require(_0xdabb('0x0'));module[_0xdabb('0x1')]={'name':{'type':Sequelize[_0xdabb('0x2')],'allowNull':![],'unique':_0xdabb('0x3')},'version':{'type':Sequelize[_0xdabb('0x2')],'allowNull':![],'unique':_0xdabb('0x3')},'main':{'type':Sequelize[_0xdabb('0x2')],'defaultValue':_0xdabb('0x4')},'filename':{'type':Sequelize[_0xdabb('0x2')]},'path':{'type':Sequelize[_0xdabb('0x2')]},'type':{'type':Sequelize[_0xdabb('0x2')]},'size':{'type':Sequelize[_0xdabb('0x5')]},'active':{'type':Sequelize[_0xdabb('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xdabb('0x2')]},'logo':{'type':Sequelize[_0xdabb('0x2')]},'state':{'type':Sequelize[_0xdabb('0x2')],'unique':'state'},'description':{'type':Sequelize[_0xdabb('0x2')]},'title':{'type':Sequelize[_0xdabb('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xdabb('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xd200=['exports','STRING','unique_name_and_version','INTEGER','BOOLEAN','sequelize'];(function(_0x462032,_0x595bb4){var _0x5edee7=function(_0x50cf99){while(--_0x50cf99){_0x462032['push'](_0x462032['shift']());}};_0x5edee7(++_0x595bb4);}(_0xd200,0x7d));var _0x0d20=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xd200[_0x11ce46];return _0x368a1e;};'use strict';var Sequelize=require(_0x0d20('0x0'));module[_0x0d20('0x1')]={'name':{'type':Sequelize[_0x0d20('0x2')],'allowNull':![],'unique':_0x0d20('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0d20('0x3')},'main':{'type':Sequelize[_0x0d20('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x0d20('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0d20('0x2')]},'size':{'type':Sequelize[_0x0d20('0x4')]},'active':{'type':Sequelize[_0x0d20('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x0d20('0x2')]},'logo':{'type':Sequelize[_0x0d20('0x2')]},'state':{'type':Sequelize[_0x0d20('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x0d20('0x2')]},'title':{'type':Sequelize[_0x0d20('0x2')]},'remoteUri':{'type':Sequelize[_0x0d20('0x2')]},'link':{'type':Sequelize[_0x0d20('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 70c5d56..dc5c798 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 _0xc6ac=['type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','Integration','rawAttributes','fieldName'];(function(_0x179d19,_0x3f63fc){var _0x1ca47f=function(_0x42ef71){while(--_0x42ef71){_0x179d19['push'](_0x179d19['shift']());}};_0x1ca47f(++_0x3f63fc);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x9624da,_0x587d9f){_0x9624da=_0x9624da-0x0;var _0x4729a1=_0xc6ac[_0x9624da];return _0x4729a1;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['Integration'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['create']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')](_0x4e1a0b[_0xcc6a('0x4d')],{})[_0xcc6a('0x27')](respondWithResult(_0x47c999,0xc9))['catch'](handleError(_0x47c999,null));};exports[_0xcc6a('0x4e')]=function(_0x5e7bab,_0x3aa7dd){if(_0x5e7bab[_0xcc6a('0x4d')]['id']){delete _0x5e7bab[_0xcc6a('0x4d')]['id'];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x5e7bab[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aa7dd,null))[_0xcc6a('0x27')](saveUpdates(_0x5e7bab[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x3aa7dd,null))[_0xcc6a('0x4b')](handleError(_0x3aa7dd,null));};exports[_0xcc6a('0x28')]=function(_0x362bf6,_0x431684){return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x362bf6[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x431684,null))[_0xcc6a('0x27')](removeEntity(_0x431684,null))[_0xcc6a('0x4b')](handleError(_0x431684,null));}; \ No newline at end of file +var _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','Integration','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x564c5d,_0x27d56b){var _0x128b6e=function(_0x178f1f){while(--_0x178f1f){_0x564c5d['push'](_0x564c5d['shift']());}};_0x128b6e(++_0x27d56b);}(_0x2ef3,0xba));var _0x32ef=function(_0xb1dba7,_0x3efa4c){_0xb1dba7=_0xb1dba7-0x0;var _0x55fde1=_0x2ef3[_0xb1dba7];return _0x55fde1;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['Integration'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['Integration'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['Integration']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 258c7b2..2195d61 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 _0x42c7=['exports','define','Integration','integrations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4b4154,_0x38a122){var _0x340ed7=function(_0x1250b9){while(--_0x1250b9){_0x4b4154['push'](_0x4b4154['shift']());}};_0x340ed7(++_0x38a122);}(_0x42c7,0x154));var _0x742c=function(_0x4430be,_0x4ee4df){_0x4430be=_0x4430be-0x0;var _0x39146c=_0x42c7[_0x4430be];return _0x39146c;};'use strict';var _=require(_0x742c('0x0'));var util=require(_0x742c('0x1'));var logger=require(_0x742c('0x2'))('api');var moment=require(_0x742c('0x3'));var BPromise=require(_0x742c('0x4'));var rp=require(_0x742c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x742c('0x6'));var config=require(_0x742c('0x7'));var attributes=require('./integration.attributes');module[_0x742c('0x8')]=function(_0x3516fa,_0x31aaef){return _0x3516fa[_0x742c('0x9')](_0x742c('0xa'),attributes,{'tableName':_0x742c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7118=['Integration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./integration.attributes','exports','define'];(function(_0x3869c8,_0x2ff137){var _0x4caf60=function(_0x224384){while(--_0x224384){_0x3869c8['push'](_0x3869c8['shift']());}};_0x4caf60(++_0x2ff137);}(_0x7118,0x1c9));var _0x8711=function(_0x1d2382,_0xe7e615){_0x1d2382=_0x1d2382-0x0;var _0x1a548f=_0x7118[_0x1d2382];return _0x1a548f;};'use strict';var _=require(_0x8711('0x0'));var util=require('util');var logger=require(_0x8711('0x1'))(_0x8711('0x2'));var moment=require(_0x8711('0x3'));var BPromise=require(_0x8711('0x4'));var rp=require(_0x8711('0x5'));var fs=require('fs');var path=require(_0x8711('0x6'));var rimraf=require('rimraf');var config=require(_0x8711('0x7'));var attributes=require(_0x8711('0x8'));module[_0x8711('0x9')]=function(_0x35066d,_0x203ddf){return _0x35066d[_0x8711('0xa')](_0x8711('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 a78ec13..17ab758 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 _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0xcf581b,_0x4359dd){var _0x4f454d=function(_0x182d58){while(--_0x182d58){_0xcf581b['push'](_0xcf581b['shift']());}};_0x4f454d(++_0x4359dd);}(_0xda2d,0x102));var _0xdda2=function(_0x241b3d,_0x22928a){_0x241b3d=_0x241b3d-0x0;var _0x410963=_0xda2d[_0x241b3d];return _0x410963;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('Integration,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file +var _0xd7d1=['info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x2cd752,_0x25d752){_0x2cd752=_0x2cd752-0x0;var _0x579c67=_0xd7d1[_0x2cd752];return _0x579c67;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('Integration,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('Integration,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 537af27..2cb8f42 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 _0xef0f=['update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x320f34,_0x1db10d){var _0x1c95ec=function(_0x4c9237){while(--_0x4c9237){_0x320f34['push'](_0x320f34['shift']());}};_0x1c95ec(++_0x1db10d);}(_0xef0f,0x168));var _0xfef0=function(_0x3f63c8,_0x596550){_0x3f63c8=_0x3f63c8-0x0;var _0x4ceda4=_0xef0f[_0x3f63c8];return _0x4ceda4;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0xf')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x11')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x13')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6d38=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','/:id','create','update','destroy','exports','util'];(function(_0x5cb6d0,_0x169f81){var _0x408ccb=function(_0x12eec6){while(--_0x12eec6){_0x5cb6d0['push'](_0x5cb6d0['shift']());}};_0x408ccb(++_0x169f81);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x6d38[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['post']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0xc')]);router['put']('/:id',auth[_0x86d3('0x7')](),controller[_0x86d3('0xd')]);router['delete'](_0x86d3('0xb'),auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 89c0bc9..7781258 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 _0x3bac=['TEXT','ENUM','SENT','SENDING','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x167ac7,_0x3ba8de){var _0x5f4fed=function(_0x5f33ad){while(--_0x5f33ad){_0x167ac7['push'](_0x167ac7['shift']());}};_0x5f4fed(++_0x3ba8de);}(_0x3bac,0x14f));var _0xc3ba=function(_0x17615e,_0x483a49){_0x17615e=_0x17615e-0x0;var _0xa4c97e=_0x3bac[_0x17615e];return _0xa4c97e;};'use strict';var Sequelize=require(_0xc3ba('0x0'));module['exports']={'integration':{'type':Sequelize[_0xc3ba('0x1')]},'eventChannel':{'type':Sequelize[_0xc3ba('0x1')]},'exitStatus':{'type':Sequelize[_0xc3ba('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xc3ba('0x2')]},'contacts':{'type':Sequelize[_0xc3ba('0x1')]},'uniqueid':{'type':Sequelize[_0xc3ba('0x1')]},'calleridnum':{'type':Sequelize[_0xc3ba('0x1')]},'calleridname':{'type':Sequelize[_0xc3ba('0x1')]},'queue':{'type':Sequelize[_0xc3ba('0x1')]},'interface':{'type':Sequelize[_0xc3ba('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xc3ba('0x3')]},'holdtime':{'type':Sequelize[_0xc3ba('0x2')]},'agentcomplete':{'type':Sequelize[_0xc3ba('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xc3ba('0x3')]},'talktime':{'type':Sequelize[_0xc3ba('0x2')]},'agentacw':{'type':Sequelize[_0xc3ba('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc3ba('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xc3ba('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xc3ba('0x3')]},'agentdump':{'type':Sequelize[_0xc3ba('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xc3ba('0x3')]},'lastevent':{'type':Sequelize[_0xc3ba('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xc3ba('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xc3ba('0x1')]},'language':{'type':Sequelize[_0xc3ba('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc3ba('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc3ba('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc3ba('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xc3ba('0x1')]},'destcalleridnum':{'type':Sequelize[_0xc3ba('0x1')]},'destcalleridname':{'type':Sequelize[_0xc3ba('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xc3ba('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xc3ba('0x1')]},'destcontext':{'type':Sequelize[_0xc3ba('0x1')]},'destexten':{'type':Sequelize[_0xc3ba('0x1')]},'destpriority':{'type':Sequelize[_0xc3ba('0x1')]},'destuniqueid':{'type':Sequelize[_0xc3ba('0x1')]},'messageId':{'type':Sequelize[_0xc3ba('0x1')]},'inReplyTo':{'type':Sequelize[_0xc3ba('0x1')]},'subject':{'type':Sequelize[_0xc3ba('0x1')]},'from':{'type':Sequelize[_0xc3ba('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xc3ba('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xc3ba('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xc3ba('0x6')](_0xc3ba('0x7'),_0xc3ba('0x8'),'RECEIVED',_0xc3ba('0x9'))},'url':{'type':Sequelize[_0xc3ba('0x1')]},'app':{'type':Sequelize[_0xc3ba('0x1')]},'appdata':{'type':Sequelize[_0xc3ba('0x1')]},'projectId':{'type':Sequelize[_0xc3ba('0x2')]}}; \ No newline at end of file +var _0x1f94=['SENDING','RECEIVED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x3e0191,_0x1d4b20){var _0xf2ae83=function(_0x277210){while(--_0x277210){_0x3e0191['push'](_0x3e0191['shift']());}};_0xf2ae83(++_0x1d4b20);}(_0x1f94,0x9c));var _0x41f9=function(_0x34b6aa,_0x5ddd29){_0x34b6aa=_0x34b6aa-0x0;var _0x3ead29=_0x1f94[_0x34b6aa];return _0x3ead29;};'use strict';var Sequelize=require(_0x41f9('0x0'));module[_0x41f9('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x41f9('0x2')]},'exitStatus':{'type':Sequelize[_0x41f9('0x2')]},'ticketId':{'type':Sequelize[_0x41f9('0x2')]},'integrationId':{'type':Sequelize[_0x41f9('0x3')]},'contacts':{'type':Sequelize[_0x41f9('0x2')]},'uniqueid':{'type':Sequelize[_0x41f9('0x2')]},'calleridnum':{'type':Sequelize[_0x41f9('0x2')]},'calleridname':{'type':Sequelize[_0x41f9('0x2')]},'queue':{'type':Sequelize[_0x41f9('0x2')]},'interface':{'type':Sequelize[_0x41f9('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x41f9('0x4')]},'agentconnectAt':{'type':Sequelize[_0x41f9('0x4')]},'holdtime':{'type':Sequelize[_0x41f9('0x3')]},'agentcomplete':{'type':Sequelize[_0x41f9('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x41f9('0x4')]},'talktime':{'type':Sequelize[_0x41f9('0x3')]},'agentacw':{'type':Sequelize[_0x41f9('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x41f9('0x3')]},'reason':{'type':Sequelize[_0x41f9('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x41f9('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x41f9('0x4')]},'lastevent':{'type':Sequelize[_0x41f9('0x2')]},'channel':{'type':Sequelize[_0x41f9('0x2')]},'channelstate':{'type':Sequelize[_0x41f9('0x3')]},'channelstatedesc':{'type':Sequelize[_0x41f9('0x2')]},'connectedlinenum':{'type':Sequelize[_0x41f9('0x2')]},'connectedlinename':{'type':Sequelize[_0x41f9('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x41f9('0x2')]},'context':{'type':Sequelize[_0x41f9('0x2')]},'exten':{'type':Sequelize[_0x41f9('0x2')]},'priority':{'type':Sequelize[_0x41f9('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x41f9('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x41f9('0x2')]},'destcalleridnum':{'type':Sequelize[_0x41f9('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x41f9('0x2')]},'destlanguage':{'type':Sequelize[_0x41f9('0x2')]},'destaccountcode':{'type':Sequelize[_0x41f9('0x2')]},'destcontext':{'type':Sequelize[_0x41f9('0x2')]},'destexten':{'type':Sequelize[_0x41f9('0x2')]},'destpriority':{'type':Sequelize[_0x41f9('0x2')]},'destuniqueid':{'type':Sequelize[_0x41f9('0x2')]},'messageId':{'type':Sequelize[_0x41f9('0x2')]},'inReplyTo':{'type':Sequelize[_0x41f9('0x2')]},'subject':{'type':Sequelize[_0x41f9('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x41f9('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x41f9('0x6')]},'status':{'type':Sequelize[_0x41f9('0x7')](_0x41f9('0x8'),_0x41f9('0x9'),_0x41f9('0xa'),'FAILED')},'url':{'type':Sequelize[_0x41f9('0x2')]},'app':{'type':Sequelize[_0x41f9('0x2')]},'appdata':{'type':Sequelize[_0x41f9('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index d396d4d..c5c2310 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 _0x0145=['update','then','destroy','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','keys','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject'];(function(_0x59dfc2,_0x1804f6){var _0x1396b5=function(_0x451961){while(--_0x451961){_0x59dfc2['push'](_0x59dfc2['shift']());}};_0x1396b5(++_0x1804f6);}(_0x0145,0x1e3));var _0x5014=function(_0x2c9f89,_0x5f4c0a){_0x2c9f89=_0x2c9f89-0x0;var _0x55c1e8=_0x0145[_0x2c9f89];return _0x55c1e8;};'use strict';var emlformat=require(_0x5014('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5014('0x1'));var jsonpatch=require(_0x5014('0x2'));var rp=require(_0x5014('0x3'));var moment=require(_0x5014('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5014('0x5'));var path=require(_0x5014('0x6'));var sox=require(_0x5014('0x7'));var csv=require(_0x5014('0x8'));var ejs=require(_0x5014('0x9'));var fs=require('fs');var fs_extra=require(_0x5014('0xa'));var _=require(_0x5014('0xb'));var squel=require(_0x5014('0xc'));var crypto=require('crypto');var jsforce=require(_0x5014('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5014('0x8'));var querystring=require(_0x5014('0xe'));var Papa=require(_0x5014('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5014('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5014('0x11'));var logger=require(_0x5014('0x12'))(_0x5014('0x13'));var utils=require(_0x5014('0x14'));var config=require(_0x5014('0x15'));var licenseUtil=require(_0x5014('0x16'));var db=require(_0x5014('0x17'))['db'];function respondWithStatusCode(_0xf54ee6,_0x38eb04){_0x38eb04=_0x38eb04||0xcc;return function(_0x464eaf){if(_0x464eaf){return _0xf54ee6[_0x5014('0x18')](_0x38eb04);}return _0xf54ee6[_0x5014('0x19')](_0x38eb04)[_0x5014('0x1a')]();};}function respondWithResult(_0x263a7b,_0x5a7b5a){_0x5a7b5a=_0x5a7b5a||0xc8;return function(_0x13885a){if(_0x13885a){return _0x263a7b['status'](_0x5a7b5a)[_0x5014('0x1b')](_0x13885a);}};}function respondWithFilteredResult(_0x202d8b,_0x5dedb2){return function(_0xe2691a){if(_0xe2691a){var _0x3af7f6=typeof _0x5dedb2['offset']===_0x5014('0x1c')&&typeof _0x5dedb2[_0x5014('0x1d')]===_0x5014('0x1c');var _0x32470d=_0xe2691a['count'];var _0x1cadfe=_0x3af7f6?0x0:_0x5dedb2[_0x5014('0x1e')];var _0x96b1dc=_0x3af7f6?_0xe2691a[_0x5014('0x1f')]:_0x5dedb2['offset']+_0x5dedb2['limit'];var _0x2c5a44;if(_0x96b1dc>=_0x32470d){_0x96b1dc=_0x32470d;_0x2c5a44=0xc8;}else{_0x2c5a44=0xce;}_0x202d8b[_0x5014('0x19')](_0x2c5a44);return _0x202d8b[_0x5014('0x20')](_0x5014('0x21'),_0x1cadfe+'-'+_0x96b1dc+'/'+_0x32470d)[_0x5014('0x1b')](_0xe2691a);}return null;};}function patchUpdates(_0x59c526){return function(_0x408d7a){try{jsonpatch['apply'](_0x408d7a,_0x59c526,!![]);}catch(_0x39718b){return BPromise[_0x5014('0x22')](_0x39718b);}return _0x408d7a['save']();};}function saveUpdates(_0x4cc469,_0x5bf840){return function(_0x12f599){if(_0x12f599){return _0x12f599[_0x5014('0x23')](_0x4cc469)[_0x5014('0x24')](function(_0x5e898d){return _0x5e898d;});}return null;};}function removeEntity(_0x53b1d7,_0x32f65f){return function(_0x26e6fd){if(_0x26e6fd){return _0x26e6fd[_0x5014('0x25')]()['then'](function(){_0x53b1d7[_0x5014('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b6ef0,_0x308a08){return function(_0x33fb16){if(!_0x33fb16){_0x1b6ef0['sendStatus'](0x194);}return _0x33fb16;};}function handleError(_0x3b5a69,_0x5bdeaf){_0x5bdeaf=_0x5bdeaf||0x1f4;return function(_0x1905aa){logger[_0x5014('0x26')](_0x1905aa[_0x5014('0x27')]);if(_0x1905aa['name']){delete _0x1905aa[_0x5014('0x28')];}_0x3b5a69[_0x5014('0x19')](_0x5bdeaf)['send'](_0x1905aa);};}exports[_0x5014('0x29')]=function(_0x17adb8,_0x47880b){var _0xac79be={},_0x4f6988={},_0x2c087d={'count':0x0,'rows':[]};var _0x1599fc=_[_0x5014('0x2a')](db[_0x5014('0x2b')][_0x5014('0x2c')],function(_0x549a38){return{'name':_0x549a38[_0x5014('0x2d')],'type':_0x549a38['type'][_0x5014('0x2e')]};});_0x4f6988[_0x5014('0x2f')]=_[_0x5014('0x2a')](_0x1599fc,_0x5014('0x28'));_0x4f6988[_0x5014('0x30')]=_['keys'](_0x17adb8[_0x5014('0x30')]);_0x4f6988[_0x5014('0x31')]=_[_0x5014('0x32')](_0x4f6988[_0x5014('0x2f')],_0x4f6988[_0x5014('0x30')]);_0xac79be[_0x5014('0x33')]=_[_0x5014('0x32')](_0x4f6988[_0x5014('0x2f')],qs['fields'](_0x17adb8[_0x5014('0x30')][_0x5014('0x34')]));_0xac79be[_0x5014('0x33')]=_0xac79be[_0x5014('0x33')]['length']?_0xac79be[_0x5014('0x33')]:_0x4f6988['model'];if(!_0x17adb8[_0x5014('0x30')]['hasOwnProperty'](_0x5014('0x35'))){_0xac79be[_0x5014('0x1d')]=qs[_0x5014('0x1d')](_0x17adb8['query'][_0x5014('0x1d')]);_0xac79be['offset']=qs[_0x5014('0x1e')](_0x17adb8['query']['offset']);}_0xac79be[_0x5014('0x36')]=qs[_0x5014('0x37')](_0x17adb8[_0x5014('0x30')][_0x5014('0x37')]);_0xac79be[_0x5014('0x38')]=qs[_0x5014('0x31')](_[_0x5014('0x39')](_0x17adb8[_0x5014('0x30')],_0x4f6988[_0x5014('0x31')]),_0x1599fc);if(_0x17adb8[_0x5014('0x30')][_0x5014('0x3a')]){_0xac79be[_0x5014('0x38')]=_[_0x5014('0x3b')](_0xac79be['where'],{'$or':_[_0x5014('0x2a')](_0x1599fc,function(_0x5539e5){if(_0x5539e5[_0x5014('0x3c')]!==_0x5014('0x3d')){var _0x58a65d={};_0x58a65d[_0x5539e5[_0x5014('0x28')]]={'$like':'%'+_0x17adb8[_0x5014('0x30')][_0x5014('0x3a')]+'%'};return _0x58a65d;}})});}_0xac79be=_[_0x5014('0x3b')]({},_0xac79be,_0x17adb8[_0x5014('0x3e')]);var _0x310a82={'where':_0xac79be[_0x5014('0x38')]};return db[_0x5014('0x2b')][_0x5014('0x1f')](_0x310a82)[_0x5014('0x24')](function(_0x112ce9){_0x2c087d[_0x5014('0x1f')]=_0x112ce9;if(_0x17adb8[_0x5014('0x30')][_0x5014('0x3f')]){_0xac79be[_0x5014('0x40')]=[{'all':!![]}];}return db[_0x5014('0x2b')]['findAll'](_0xac79be);})['then'](function(_0xdde091){_0x2c087d[_0x5014('0x41')]=_0xdde091;return _0x2c087d;})[_0x5014('0x24')](respondWithFilteredResult(_0x47880b,_0xac79be))[_0x5014('0x42')](handleError(_0x47880b,null));};exports['show']=function(_0x3b08cc,_0x220db6){var _0x5b283d={'raw':![],'where':{'id':_0x3b08cc[_0x5014('0x43')]['id']}},_0x1c1c5d={};_0x1c1c5d[_0x5014('0x2f')]=_[_0x5014('0x44')](db[_0x5014('0x2b')]['rawAttributes']);_0x1c1c5d['query']=_['keys'](_0x3b08cc[_0x5014('0x30')]);_0x1c1c5d[_0x5014('0x31')]=_['intersection'](_0x1c1c5d[_0x5014('0x2f')],_0x1c1c5d['query']);_0x5b283d[_0x5014('0x33')]=_[_0x5014('0x32')](_0x1c1c5d[_0x5014('0x2f')],qs['fields'](_0x3b08cc['query'][_0x5014('0x34')]));_0x5b283d[_0x5014('0x33')]=_0x5b283d[_0x5014('0x33')][_0x5014('0x45')]?_0x5b283d[_0x5014('0x33')]:_0x1c1c5d[_0x5014('0x2f')];if(_0x3b08cc[_0x5014('0x30')][_0x5014('0x3f')]){_0x5b283d['include']=[{'all':!![]}];}_0x5b283d=_[_0x5014('0x3b')]({},_0x5b283d,_0x3b08cc[_0x5014('0x3e')]);return db[_0x5014('0x2b')][_0x5014('0x46')](_0x5b283d)[_0x5014('0x24')](handleEntityNotFound(_0x220db6,null))[_0x5014('0x24')](respondWithResult(_0x220db6,null))[_0x5014('0x42')](handleError(_0x220db6,null));};exports[_0x5014('0x47')]=function(_0x2ef301,_0x1eb2b4){return db['IntegrationReport'][_0x5014('0x47')](_0x2ef301[_0x5014('0x48')],{})[_0x5014('0x24')](respondWithResult(_0x1eb2b4,0xc9))[_0x5014('0x42')](handleError(_0x1eb2b4,null));};exports[_0x5014('0x23')]=function(_0x28c3dd,_0x6cb9ee){if(_0x28c3dd[_0x5014('0x48')]['id']){delete _0x28c3dd[_0x5014('0x48')]['id'];}return db['IntegrationReport'][_0x5014('0x46')]({'where':{'id':_0x28c3dd[_0x5014('0x43')]['id']}})[_0x5014('0x24')](handleEntityNotFound(_0x6cb9ee,null))['then'](saveUpdates(_0x28c3dd[_0x5014('0x48')],null))[_0x5014('0x24')](respondWithResult(_0x6cb9ee,null))[_0x5014('0x42')](handleError(_0x6cb9ee,null));};exports['destroy']=function(_0xfb6b32,_0x5625a9){return db[_0x5014('0x2b')][_0x5014('0x46')]({'where':{'id':_0xfb6b32[_0x5014('0x43')]['id']}})[_0x5014('0x24')](handleEntityNotFound(_0x5625a9,null))[_0x5014('0x24')](removeEntity(_0x5625a9,null))[_0x5014('0x42')](handleError(_0x5625a9,null));};exports[_0x5014('0x49')]=function(_0x932cc6,_0x41385f){return db[_0x5014('0x2b')][_0x5014('0x49')]()[_0x5014('0x24')](respondWithResult(_0x41385f,null))[_0x5014('0x42')](handleError(_0x41385f,null));}; \ No newline at end of file +var _0xfdc4=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','name','index','IntegrationReport','rawAttributes','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xfdc4,0x1f1));var _0x4fdc=function(_0x6e9961,_0x1d5310){_0x6e9961=_0x6e9961-0x0;var _0x1b7e2d=_0xfdc4[_0x6e9961];return _0x1b7e2d;};'use strict';var emlformat=require(_0x4fdc('0x0'));var rimraf=require(_0x4fdc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4fdc('0x2'));var rp=require(_0x4fdc('0x3'));var moment=require('moment');var BPromise=require(_0x4fdc('0x4'));var Mustache=require(_0x4fdc('0x5'));var util=require('util');var path=require(_0x4fdc('0x6'));var sox=require(_0x4fdc('0x7'));var csv=require(_0x4fdc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4fdc('0x9'));var squel=require('squel');var crypto=require(_0x4fdc('0xa'));var jsforce=require(_0x4fdc('0xb'));var deskjs=require(_0x4fdc('0xc'));var toCsv=require(_0x4fdc('0x8'));var querystring=require(_0x4fdc('0xd'));var Papa=require(_0x4fdc('0xe'));var Redis=require(_0x4fdc('0xf'));var authService=require(_0x4fdc('0x10'));var qs=require(_0x4fdc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fdc('0x12'))(_0x4fdc('0x13'));var utils=require(_0x4fdc('0x14'));var config=require(_0x4fdc('0x15'));var licenseUtil=require(_0x4fdc('0x16'));var db=require(_0x4fdc('0x17'))['db'];function respondWithStatusCode(_0x113311,_0x5c50cd){_0x5c50cd=_0x5c50cd||0xcc;return function(_0xdf78b){if(_0xdf78b){return _0x113311[_0x4fdc('0x18')](_0x5c50cd);}return _0x113311[_0x4fdc('0x19')](_0x5c50cd)[_0x4fdc('0x1a')]();};}function respondWithResult(_0x163eb6,_0x358741){_0x358741=_0x358741||0xc8;return function(_0x1526f3){if(_0x1526f3){return _0x163eb6[_0x4fdc('0x19')](_0x358741)[_0x4fdc('0x1b')](_0x1526f3);}};}function respondWithFilteredResult(_0x2268b0,_0x54baf9){return function(_0x2fe380){if(_0x2fe380){var _0x1e9c48=typeof _0x54baf9['offset']===_0x4fdc('0x1c')&&typeof _0x54baf9[_0x4fdc('0x1d')]===_0x4fdc('0x1c');var _0x5cda58=_0x2fe380[_0x4fdc('0x1e')];var _0x138155=_0x1e9c48?0x0:_0x54baf9['offset'];var _0x10d4da=_0x1e9c48?_0x2fe380['count']:_0x54baf9[_0x4fdc('0x1f')]+_0x54baf9[_0x4fdc('0x1d')];var _0x333b94;if(_0x10d4da>=_0x5cda58){_0x10d4da=_0x5cda58;_0x333b94=0xc8;}else{_0x333b94=0xce;}_0x2268b0[_0x4fdc('0x19')](_0x333b94);return _0x2268b0[_0x4fdc('0x20')]('Content-Range',_0x138155+'-'+_0x10d4da+'/'+_0x5cda58)['json'](_0x2fe380);}return null;};}function patchUpdates(_0x422c3d){return function(_0xc3b0e2){try{jsonpatch['apply'](_0xc3b0e2,_0x422c3d,!![]);}catch(_0x4e7120){return BPromise[_0x4fdc('0x21')](_0x4e7120);}return _0xc3b0e2[_0x4fdc('0x22')]();};}function saveUpdates(_0x4a0332,_0xd31f19){return function(_0x36ed59){if(_0x36ed59){return _0x36ed59[_0x4fdc('0x23')](_0x4a0332)[_0x4fdc('0x24')](function(_0x1e8ea9){return _0x1e8ea9;});}return null;};}function removeEntity(_0x21644e,_0x13129d){return function(_0x18c130){if(_0x18c130){return _0x18c130[_0x4fdc('0x25')]()[_0x4fdc('0x24')](function(){_0x21644e[_0x4fdc('0x19')](0xcc)[_0x4fdc('0x1a')]();});}};}function handleEntityNotFound(_0x1a46db,_0x1a76e2){return function(_0x5a4b35){if(!_0x5a4b35){_0x1a46db[_0x4fdc('0x18')](0x194);}return _0x5a4b35;};}function handleError(_0x308c20,_0xa55854){_0xa55854=_0xa55854||0x1f4;return function(_0x18d6ca){logger['error'](_0x18d6ca['stack']);if(_0x18d6ca['name']){delete _0x18d6ca[_0x4fdc('0x26')];}_0x308c20[_0x4fdc('0x19')](_0xa55854)['send'](_0x18d6ca);};}exports[_0x4fdc('0x27')]=function(_0x1975fb,_0x1dbdd2){var _0x5f41dd={},_0x369548={},_0x3984f8={'count':0x0,'rows':[]};var _0x3252b5=_['map'](db[_0x4fdc('0x28')][_0x4fdc('0x29')],function(_0x395b74){return{'name':_0x395b74['fieldName'],'type':_0x395b74['type'][_0x4fdc('0x2a')]};});_0x369548[_0x4fdc('0x2b')]=_[_0x4fdc('0x2c')](_0x3252b5,'name');_0x369548['query']=_[_0x4fdc('0x2d')](_0x1975fb[_0x4fdc('0x2e')]);_0x369548[_0x4fdc('0x2f')]=_[_0x4fdc('0x30')](_0x369548[_0x4fdc('0x2b')],_0x369548[_0x4fdc('0x2e')]);_0x5f41dd[_0x4fdc('0x31')]=_[_0x4fdc('0x30')](_0x369548[_0x4fdc('0x2b')],qs['fields'](_0x1975fb[_0x4fdc('0x2e')][_0x4fdc('0x32')]));_0x5f41dd[_0x4fdc('0x31')]=_0x5f41dd[_0x4fdc('0x31')][_0x4fdc('0x33')]?_0x5f41dd[_0x4fdc('0x31')]:_0x369548[_0x4fdc('0x2b')];if(!_0x1975fb[_0x4fdc('0x2e')][_0x4fdc('0x34')](_0x4fdc('0x35'))){_0x5f41dd['limit']=qs['limit'](_0x1975fb[_0x4fdc('0x2e')][_0x4fdc('0x1d')]);_0x5f41dd[_0x4fdc('0x1f')]=qs[_0x4fdc('0x1f')](_0x1975fb['query']['offset']);}_0x5f41dd[_0x4fdc('0x36')]=qs[_0x4fdc('0x37')](_0x1975fb[_0x4fdc('0x2e')][_0x4fdc('0x37')]);_0x5f41dd[_0x4fdc('0x38')]=qs[_0x4fdc('0x2f')](_[_0x4fdc('0x39')](_0x1975fb['query'],_0x369548[_0x4fdc('0x2f')]),_0x3252b5);if(_0x1975fb[_0x4fdc('0x2e')]['filter']){_0x5f41dd[_0x4fdc('0x38')]=_['merge'](_0x5f41dd[_0x4fdc('0x38')],{'$or':_[_0x4fdc('0x2c')](_0x3252b5,function(_0x214b0e){if(_0x214b0e[_0x4fdc('0x3a')]!==_0x4fdc('0x3b')){var _0x4b9d8e={};_0x4b9d8e[_0x214b0e[_0x4fdc('0x26')]]={'$like':'%'+_0x1975fb[_0x4fdc('0x2e')][_0x4fdc('0x3c')]+'%'};return _0x4b9d8e;}})});}_0x5f41dd=_[_0x4fdc('0x3d')]({},_0x5f41dd,_0x1975fb[_0x4fdc('0x3e')]);var _0x2e0ef7={'where':_0x5f41dd[_0x4fdc('0x38')]};return db[_0x4fdc('0x28')][_0x4fdc('0x1e')](_0x2e0ef7)[_0x4fdc('0x24')](function(_0x5a3db5){_0x3984f8[_0x4fdc('0x1e')]=_0x5a3db5;if(_0x1975fb[_0x4fdc('0x2e')][_0x4fdc('0x3f')]){_0x5f41dd[_0x4fdc('0x40')]=[{'all':!![]}];}return db[_0x4fdc('0x28')][_0x4fdc('0x41')](_0x5f41dd);})[_0x4fdc('0x24')](function(_0x748f27){_0x3984f8[_0x4fdc('0x42')]=_0x748f27;return _0x3984f8;})[_0x4fdc('0x24')](respondWithFilteredResult(_0x1dbdd2,_0x5f41dd))[_0x4fdc('0x43')](handleError(_0x1dbdd2,null));};exports[_0x4fdc('0x44')]=function(_0x5b895d,_0x3512c1){var _0x47e69e={'raw':![],'where':{'id':_0x5b895d[_0x4fdc('0x45')]['id']}},_0x2bb5a0={};_0x2bb5a0[_0x4fdc('0x2b')]=_[_0x4fdc('0x2d')](db['IntegrationReport'][_0x4fdc('0x29')]);_0x2bb5a0['query']=_[_0x4fdc('0x2d')](_0x5b895d[_0x4fdc('0x2e')]);_0x2bb5a0['filters']=_[_0x4fdc('0x30')](_0x2bb5a0[_0x4fdc('0x2b')],_0x2bb5a0[_0x4fdc('0x2e')]);_0x47e69e[_0x4fdc('0x31')]=_[_0x4fdc('0x30')](_0x2bb5a0[_0x4fdc('0x2b')],qs['fields'](_0x5b895d['query'][_0x4fdc('0x32')]));_0x47e69e['attributes']=_0x47e69e[_0x4fdc('0x31')][_0x4fdc('0x33')]?_0x47e69e[_0x4fdc('0x31')]:_0x2bb5a0['model'];if(_0x5b895d[_0x4fdc('0x2e')][_0x4fdc('0x3f')]){_0x47e69e['include']=[{'all':!![]}];}_0x47e69e=_[_0x4fdc('0x3d')]({},_0x47e69e,_0x5b895d[_0x4fdc('0x3e')]);return db['IntegrationReport']['find'](_0x47e69e)['then'](handleEntityNotFound(_0x3512c1,null))[_0x4fdc('0x24')](respondWithResult(_0x3512c1,null))[_0x4fdc('0x43')](handleError(_0x3512c1,null));};exports[_0x4fdc('0x46')]=function(_0x2a3f16,_0x37e783){return db[_0x4fdc('0x28')][_0x4fdc('0x46')](_0x2a3f16[_0x4fdc('0x47')],{})[_0x4fdc('0x24')](respondWithResult(_0x37e783,0xc9))[_0x4fdc('0x43')](handleError(_0x37e783,null));};exports['update']=function(_0x721c1b,_0x418b45){if(_0x721c1b[_0x4fdc('0x47')]['id']){delete _0x721c1b[_0x4fdc('0x47')]['id'];}return db[_0x4fdc('0x28')][_0x4fdc('0x48')]({'where':{'id':_0x721c1b[_0x4fdc('0x45')]['id']}})['then'](handleEntityNotFound(_0x418b45,null))[_0x4fdc('0x24')](saveUpdates(_0x721c1b[_0x4fdc('0x47')],null))[_0x4fdc('0x24')](respondWithResult(_0x418b45,null))[_0x4fdc('0x43')](handleError(_0x418b45,null));};exports[_0x4fdc('0x25')]=function(_0x1a50c2,_0x50bdf2){return db[_0x4fdc('0x28')][_0x4fdc('0x48')]({'where':{'id':_0x1a50c2['params']['id']}})['then'](handleEntityNotFound(_0x50bdf2,null))[_0x4fdc('0x24')](removeEntity(_0x50bdf2,null))[_0x4fdc('0x43')](handleError(_0x50bdf2,null));};exports[_0x4fdc('0x49')]=function(_0x5d2fff,_0xabd5d5){return db['IntegrationReport'][_0x4fdc('0x49')]()['then'](respondWithResult(_0xabd5d5,null))[_0x4fdc('0x43')](handleError(_0xabd5d5,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index ff7fe55..a6e8860 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 _0x1f13=['rimraf','./integrationReport.attributes','define','report_integration','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x16cc3a,_0x41053a){var _0x50418e=function(_0x540b52){while(--_0x540b52){_0x16cc3a['push'](_0x16cc3a['shift']());}};_0x50418e(++_0x41053a);}(_0x1f13,0xbf));var _0x31f1=function(_0x9b8000,_0x5dbd59){_0x9b8000=_0x9b8000-0x0;var _0x35c1ee=_0x1f13[_0x9b8000];return _0x35c1ee;};'use strict';var _=require(_0x31f1('0x0'));var util=require(_0x31f1('0x1'));var logger=require(_0x31f1('0x2'))(_0x31f1('0x3'));var moment=require(_0x31f1('0x4'));var BPromise=require('bluebird');var rp=require(_0x31f1('0x5'));var fs=require('fs');var path=require(_0x31f1('0x6'));var rimraf=require(_0x31f1('0x7'));var config=require('../../config/environment');var attributes=require(_0x31f1('0x8'));module['exports']=function(_0x4a3ef1,_0x278942){return _0x4a3ef1[_0x31f1('0x9')]('IntegrationReport',attributes,{'tableName':_0x31f1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb994=['../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb994,0x1f4));var _0x4b99=function(_0x484027,_0x5f2808){_0x484027=_0x484027-0x0;var _0x1b81e0=_0xb994[_0x484027];return _0x1b81e0;};'use strict';var _=require(_0x4b99('0x0'));var util=require(_0x4b99('0x1'));var logger=require(_0x4b99('0x2'))(_0x4b99('0x3'));var moment=require(_0x4b99('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4b99('0x5'));var config=require(_0x4b99('0x6'));var attributes=require(_0x4b99('0x7'));module[_0x4b99('0x8')]=function(_0x1b1f9e,_0x266cb2){return _0x1b1f9e['define'](_0x4b99('0x9'),attributes,{'tableName':_0x4b99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index a11be8e..31c4fd6 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 _0x1261=['then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x224397,_0x25a4e5){var _0x3437ed=function(_0x350892){while(--_0x350892){_0x224397['push'](_0x224397['shift']());}};_0x3437ed(++_0x25a4e5);}(_0x1261,0x144));var _0x1126=function(_0xee4c5f,_0x1bf72d){_0xee4c5f=_0xee4c5f-0x0;var _0x5accbc=_0x1261[_0xee4c5f];return _0x5accbc;};'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')]('IntegrationReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x1967=['then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x1967,0x173));var _0x7196=function(_0x10ecfc,_0x53bf69){_0x10ecfc=_0x10ecfc-0x0;var _0xf08cf=_0x1967[_0x10ecfc];return _0xf08cf;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index dd5cdc2..3b09e12 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 _0x6440=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6440,0x1de));var _0x0644=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x6440[_0xa6cc5c];return _0x44803d;};'use strict';var multer=require(_0x0644('0x0'));var util=require(_0x0644('0x1'));var path=require('path');var timeout=require(_0x0644('0x2'));var express=require(_0x0644('0x3'));var router=express[_0x0644('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0644('0x5'));var interaction=require(_0x0644('0x6'));var config=require(_0x0644('0x7'));var controller=require(_0x0644('0x8'));router[_0x0644('0x9')]('/',auth[_0x0644('0xa')](),controller[_0x0644('0xb')]);router[_0x0644('0x9')]('/:id',auth[_0x0644('0xa')](),controller['show']);router['get']('/:id/sub_intervals',auth[_0x0644('0xa')](),controller[_0x0644('0xc')]);router[_0x0644('0xd')]('/',auth[_0x0644('0xa')](),controller[_0x0644('0xe')]);router['post']('/:id/sub_intervals',auth[_0x0644('0xa')](),controller[_0x0644('0xf')]);router[_0x0644('0xd')](_0x0644('0x10'),auth[_0x0644('0xa')](),controller[_0x0644('0x11')]);router[_0x0644('0x12')](_0x0644('0x13'),auth[_0x0644('0xa')](),controller[_0x0644('0x14')]);router[_0x0644('0x15')](_0x0644('0x13'),auth[_0x0644('0xa')](),controller[_0x0644('0x16')]);module[_0x0644('0x17')]=router; \ No newline at end of file +var _0xe0cc=['addInterval','/:id/sub_intervals/create_many','addIntervals','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create'];(function(_0x5d51ce,_0x536f30){var _0x425f59=function(_0x18e1ff){while(--_0x18e1ff){_0x5d51ce['push'](_0x5d51ce['shift']());}};_0x425f59(++_0x536f30);}(_0xe0cc,0x1cd));var _0xce0c=function(_0x306ba0,_0x1a06f3){_0x306ba0=_0x306ba0-0x0;var _0x322e60=_0xe0cc[_0x306ba0];return _0x322e60;};'use strict';var multer=require(_0xce0c('0x0'));var util=require(_0xce0c('0x1'));var path=require(_0xce0c('0x2'));var timeout=require('connect-timeout');var express=require(_0xce0c('0x3'));var router=express[_0xce0c('0x4')]();var fs_extra=require(_0xce0c('0x5'));var auth=require(_0xce0c('0x6'));var interaction=require(_0xce0c('0x7'));var config=require(_0xce0c('0x8'));var controller=require(_0xce0c('0x9'));router[_0xce0c('0xa')]('/',auth[_0xce0c('0xb')](),controller[_0xce0c('0xc')]);router[_0xce0c('0xa')](_0xce0c('0xd'),auth['isAuthenticated'](),controller[_0xce0c('0xe')]);router[_0xce0c('0xa')](_0xce0c('0xf'),auth[_0xce0c('0xb')](),controller[_0xce0c('0x10')]);router[_0xce0c('0x11')]('/',auth['isAuthenticated'](),controller[_0xce0c('0x12')]);router['post'](_0xce0c('0xf'),auth['isAuthenticated'](),controller[_0xce0c('0x13')]);router[_0xce0c('0x11')](_0xce0c('0x14'),auth['isAuthenticated'](),controller[_0xce0c('0x15')]);router['put'](_0xce0c('0xd'),auth[_0xce0c('0xb')](),controller[_0xce0c('0x16')]);router[_0xce0c('0x17')](_0xce0c('0xd'),auth['isAuthenticated'](),controller['destroy']);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 8b81547..d2744aa 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 _0x802e=['sequelize','exports','STRING'];(function(_0x177864,_0x515ea5){var _0x58b91d=function(_0xde2f34){while(--_0xde2f34){_0x177864['push'](_0x177864['shift']());}};_0x58b91d(++_0x515ea5);}(_0x802e,0x13b));var _0xe802=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x802e[_0x381589];return _0x2a075d;};'use strict';var Sequelize=require(_0xe802('0x0'));module[_0xe802('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe802('0x2')]},'interval':{'type':Sequelize[_0xe802('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x5481=['STRING','sequelize'];(function(_0x532ee1,_0x538b50){var _0xecf3b1=function(_0x2bba71){while(--_0x2bba71){_0x532ee1['push'](_0x532ee1['shift']());}};_0xecf3b1(++_0x538b50);}(_0x5481,0x101));var _0x1548=function(_0x2aca59,_0x24a235){_0x2aca59=_0x2aca59-0x0;var _0x5933ec=_0x5481[_0x2aca59];return _0x5933ec;};'use strict';var Sequelize=require(_0x1548('0x0'));module['exports']={'name':{'type':Sequelize[_0x1548('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index f813dea..020cbdc 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 _0x883e=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','send','index','map','Interval','rawAttributes','fieldName','type','key','model','name','query','keys','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','count','include','findAll','rows','catch','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addInterval','IntervalId','getIntervals','intersection','addIntervals','findOne','sequelize','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash'];(function(_0x396152,_0x25d180){var _0x2db4ea=function(_0x2839b3){while(--_0x2839b3){_0x396152['push'](_0x396152['shift']());}};_0x2db4ea(++_0x25d180);}(_0x883e,0xb1));var _0xe883=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x883e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe883('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe883('0x1'));var jsonpatch=require(_0xe883('0x2'));var rp=require(_0xe883('0x3'));var moment=require(_0xe883('0x4'));var BPromise=require(_0xe883('0x5'));var Mustache=require('mustache');var util=require(_0xe883('0x6'));var path=require(_0xe883('0x7'));var sox=require('sox');var csv=require(_0xe883('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe883('0x9'));var _=require(_0xe883('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe883('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe883('0xc'));var Papa=require(_0xe883('0xd'));var Redis=require(_0xe883('0xe'));var authService=require(_0xe883('0xf'));var qs=require(_0xe883('0x10'));var as=require(_0xe883('0x11'));var hardwareService=require(_0xe883('0x12'));var logger=require(_0xe883('0x13'))(_0xe883('0x14'));var utils=require(_0xe883('0x15'));var config=require(_0xe883('0x16'));var licenseUtil=require(_0xe883('0x17'));var db=require(_0xe883('0x18'))['db'];var extensions=require(_0xe883('0x19'));function respondWithStatusCode(_0x52cf3c,_0xea7ae2){_0xea7ae2=_0xea7ae2||0xcc;return function(_0x3e1f08){if(_0x3e1f08){return _0x52cf3c[_0xe883('0x1a')](_0xea7ae2);}return _0x52cf3c['status'](_0xea7ae2)[_0xe883('0x1b')]();};}function respondWithResult(_0x58d73d,_0x415fdf){_0x415fdf=_0x415fdf||0xc8;return function(_0x2c8628){if(_0x2c8628){return _0x58d73d[_0xe883('0x1c')](_0x415fdf)[_0xe883('0x1d')](_0x2c8628);}};}function respondWithFilteredResult(_0x3e57e0,_0x234bf9){return function(_0x5babd1){if(_0x5babd1){var _0x36cd1d=typeof _0x234bf9[_0xe883('0x1e')]===_0xe883('0x1f')&&typeof _0x234bf9[_0xe883('0x20')]===_0xe883('0x1f');var _0x2d88c9=_0x5babd1['count'];var _0x47c396=_0x36cd1d?0x0:_0x234bf9[_0xe883('0x1e')];var _0x38b4f4=_0x36cd1d?_0x5babd1['count']:_0x234bf9[_0xe883('0x1e')]+_0x234bf9[_0xe883('0x20')];var _0xb24fcf;if(_0x38b4f4>=_0x2d88c9){_0x38b4f4=_0x2d88c9;_0xb24fcf=0xc8;}else{_0xb24fcf=0xce;}_0x3e57e0[_0xe883('0x1c')](_0xb24fcf);return _0x3e57e0[_0xe883('0x21')](_0xe883('0x22'),_0x47c396+'-'+_0x38b4f4+'/'+_0x2d88c9)['json'](_0x5babd1);}return null;};}function patchUpdates(_0x5d9beb){return function(_0xf8ed09){try{jsonpatch[_0xe883('0x23')](_0xf8ed09,_0x5d9beb,!![]);}catch(_0x2a3d98){return BPromise[_0xe883('0x24')](_0x2a3d98);}return _0xf8ed09[_0xe883('0x25')]();};}function saveUpdates(_0xc3fc07,_0x464a32){return function(_0x15903e){if(_0x15903e){return _0x15903e[_0xe883('0x26')](_0xc3fc07)['then'](function(_0x35e2ec){return _0x35e2ec;});}return null;};}function removeEntity(_0x1c964e,_0xa52cc2){return function(_0x1ff3ad){if(_0x1ff3ad){return _0x1ff3ad['destroy']()[_0xe883('0x27')](function(){var _0x504b21=_0x1ff3ad['get']({'plain':!![]});var _0x3c76f7='Intervals';return db['UserProfileResource']['destroy']({'where':{'type':_0x3c76f7,'resourceId':_0x504b21['id']}})['then'](function(){return _0x1ff3ad;});})[_0xe883('0x27')](function(){_0x1c964e[_0xe883('0x1c')](0xcc)[_0xe883('0x1b')]();});}};}function handleEntityNotFound(_0x36fbb4,_0x11637d){return function(_0x1662f2){if(!_0x1662f2){_0x36fbb4[_0xe883('0x1a')](0x194);}return _0x1662f2;};}function handleError(_0x4ba6b3,_0x1ec853){_0x1ec853=_0x1ec853||0x1f4;return function(_0x296501){logger[_0xe883('0x28')](_0x296501[_0xe883('0x29')]);if(_0x296501['name']){delete _0x296501['name'];}_0x4ba6b3[_0xe883('0x1c')](_0x1ec853)[_0xe883('0x2a')](_0x296501);};}exports[_0xe883('0x2b')]=function(_0x2ff5df,_0x172b70){var _0x33d443={},_0x11bd46={},_0xaa114e={'count':0x0,'rows':[]};var _0x270df1=_[_0xe883('0x2c')](db[_0xe883('0x2d')][_0xe883('0x2e')],function(_0x558b85){return{'name':_0x558b85[_0xe883('0x2f')],'type':_0x558b85[_0xe883('0x30')][_0xe883('0x31')]};});_0x11bd46[_0xe883('0x32')]=_['map'](_0x270df1,_0xe883('0x33'));_0x11bd46[_0xe883('0x34')]=_[_0xe883('0x35')](_0x2ff5df[_0xe883('0x34')]);_0x11bd46['filters']=_['intersection'](_0x11bd46['model'],_0x11bd46['query']);_0x33d443[_0xe883('0x36')]=_['intersection'](_0x11bd46['model'],qs['fields'](_0x2ff5df['query'][_0xe883('0x37')]));_0x33d443[_0xe883('0x36')]=_0x33d443['attributes'][_0xe883('0x38')]?_0x33d443[_0xe883('0x36')]:_0x11bd46[_0xe883('0x32')];if(!_0x2ff5df[_0xe883('0x34')][_0xe883('0x39')]('nolimit')){_0x33d443[_0xe883('0x20')]=qs[_0xe883('0x20')](_0x2ff5df[_0xe883('0x34')][_0xe883('0x20')]);_0x33d443['offset']=qs[_0xe883('0x1e')](_0x2ff5df[_0xe883('0x34')]['offset']);}_0x33d443[_0xe883('0x3a')]=qs[_0xe883('0x3b')](_0x2ff5df[_0xe883('0x34')][_0xe883('0x3b')]);_0x33d443['where']=qs[_0xe883('0x3c')](_[_0xe883('0x3d')](_0x2ff5df[_0xe883('0x34')],_0x11bd46['filters']),_0x270df1);if(_0x2ff5df[_0xe883('0x34')][_0xe883('0x3e')]){_0x33d443[_0xe883('0x3f')]=_['merge'](_0x33d443['where'],{'$or':_[_0xe883('0x2c')](_0x270df1,function(_0x3f9079){if(_0x3f9079[_0xe883('0x30')]!==_0xe883('0x40')){var _0x4aa042={};_0x4aa042[_0x3f9079[_0xe883('0x33')]]={'$like':'%'+_0x2ff5df[_0xe883('0x34')][_0xe883('0x3e')]+'%'};return _0x4aa042;}})});}_0x33d443=_[_0xe883('0x41')]({},_0x33d443,_0x2ff5df[_0xe883('0x42')]);var _0x18f79={'where':_0x33d443['where']};return db[_0xe883('0x2d')]['count'](_0x18f79)[_0xe883('0x27')](function(_0x40b988){_0xaa114e[_0xe883('0x43')]=_0x40b988;if(_0x2ff5df[_0xe883('0x34')]['includeAll']){_0x33d443[_0xe883('0x44')]=[{'all':!![]}];}return db[_0xe883('0x2d')][_0xe883('0x45')](_0x33d443);})['then'](function(_0x363f77){_0xaa114e[_0xe883('0x46')]=_0x363f77;return _0xaa114e;})['then'](respondWithFilteredResult(_0x172b70,_0x33d443))[_0xe883('0x47')](handleError(_0x172b70,null));};exports['show']=function(_0x231fa9,_0x41f9b3){var _0x1eb77a={'raw':!![],'where':{'id':_0x231fa9[_0xe883('0x48')]['id']}},_0x28895f={};_0x28895f[_0xe883('0x32')]=_[_0xe883('0x35')](db['Interval'][_0xe883('0x2e')]);_0x28895f[_0xe883('0x34')]=_[_0xe883('0x35')](_0x231fa9[_0xe883('0x34')]);_0x28895f['filters']=_['intersection'](_0x28895f[_0xe883('0x32')],_0x28895f[_0xe883('0x34')]);_0x1eb77a[_0xe883('0x36')]=_['intersection'](_0x28895f[_0xe883('0x32')],qs[_0xe883('0x37')](_0x231fa9[_0xe883('0x34')][_0xe883('0x37')]));_0x1eb77a[_0xe883('0x36')]=_0x1eb77a[_0xe883('0x36')]['length']?_0x1eb77a[_0xe883('0x36')]:_0x28895f[_0xe883('0x32')];if(_0x231fa9[_0xe883('0x34')][_0xe883('0x49')]){_0x1eb77a[_0xe883('0x44')]=[{'all':!![]}];}_0x1eb77a=_['merge']({},_0x1eb77a,_0x231fa9[_0xe883('0x42')]);return db[_0xe883('0x2d')][_0xe883('0x4a')](_0x1eb77a)[_0xe883('0x27')](handleEntityNotFound(_0x41f9b3,null))['then'](respondWithResult(_0x41f9b3,null))[_0xe883('0x47')](handleError(_0x41f9b3,null));};exports[_0xe883('0x4b')]=function(_0x509973,_0x5ef286){return db[_0xe883('0x2d')][_0xe883('0x4b')](_0x509973[_0xe883('0x4c')],{})[_0xe883('0x27')](function(_0x722db1){var _0x4ee5c5=_0x509973['user']['get']({'plain':!![]});if(!_0x4ee5c5)throw new Error(_0xe883('0x4d'));if(_0x4ee5c5[_0xe883('0x4e')]===_0xe883('0x4f')){var _0x7cb317=_0x722db1['get']({'plain':!![]});var _0x4b86b9=_0xe883('0x50');return db[_0xe883('0x51')]['find']({'where':{'name':_0x4b86b9,'userProfileId':_0x4ee5c5[_0xe883('0x52')]},'raw':!![]})[_0xe883('0x27')](function(_0x447eba){if(_0x447eba&&_0x447eba['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x7cb317[_0xe883('0x33')],'resourceId':_0x7cb317['id'],'type':_0x447eba[_0xe883('0x33')],'sectionId':_0x447eba['id']},{})[_0xe883('0x27')](function(){return _0x722db1;});}else{return _0x722db1;}})[_0xe883('0x47')](function(_0x320f44){logger[_0xe883('0x28')](_0xe883('0x53'),_0x320f44);throw _0x320f44;});}return _0x722db1;})[_0xe883('0x27')](respondWithResult(_0x5ef286,0xc9))[_0xe883('0x47')](handleError(_0x5ef286,null));};exports['update']=function(_0x2f947c,_0x2914b7){if(_0x2f947c[_0xe883('0x4c')]['id']){delete _0x2f947c[_0xe883('0x4c')]['id'];}return db[_0xe883('0x2d')][_0xe883('0x4a')]({'where':{'id':_0x2f947c['params']['id']}})[_0xe883('0x27')](handleEntityNotFound(_0x2914b7,null))['then'](saveUpdates(_0x2f947c[_0xe883('0x4c')],null))[_0xe883('0x27')](respondWithResult(_0x2914b7,null))[_0xe883('0x47')](handleError(_0x2914b7,null));};exports[_0xe883('0x54')]=function(_0x26d575,_0x34f517){return db['Interval'][_0xe883('0x4a')]({'where':{'id':_0x26d575[_0xe883('0x48')]['id']}})['then'](handleEntityNotFound(_0x34f517,null))['then'](removeEntity(_0x34f517,null))[_0xe883('0x47')](handleError(_0x34f517,null));};exports[_0xe883('0x55')]=function(_0x35a9af,_0xacc49d,_0x302bb7){if(_0x35a9af[_0xe883('0x4c')]['id']){delete _0x35a9af[_0xe883('0x4c')]['id'];}return db[_0xe883('0x2d')][_0xe883('0x4a')]({'where':{'id':_0x35a9af[_0xe883('0x48')]['id']}})[_0xe883('0x27')](handleEntityNotFound(_0xacc49d,null))[_0xe883('0x27')](function(_0x17ea57){if(_0x17ea57){_0x35a9af[_0xe883('0x4c')][_0xe883('0x56')]=_0x17ea57['id'];return db[_0xe883('0x2d')][_0xe883('0x4b')](_0x35a9af[_0xe883('0x4c')]);}})[_0xe883('0x27')](respondWithResult(_0xacc49d,null))['catch'](handleError(_0xacc49d,null));};exports[_0xe883('0x57')]=function(_0x5724c5,_0x54b55c,_0x172ac4){var _0x375b92={};var _0x1ec54e={};var _0x50d08d;var _0x1d214a;return db[_0xe883('0x2d')]['findOne']({'where':{'id':_0x5724c5[_0xe883('0x48')]['id']}})[_0xe883('0x27')](handleEntityNotFound(_0x54b55c,null))[_0xe883('0x27')](function(_0x19561c){if(_0x19561c){_0x50d08d=_0x19561c;_0x1ec54e[_0xe883('0x32')]=_['keys'](db[_0xe883('0x2d')][_0xe883('0x2e')]);_0x1ec54e[_0xe883('0x34')]=_[_0xe883('0x35')](_0x5724c5['query']);_0x1ec54e['filters']=_[_0xe883('0x58')](_0x1ec54e[_0xe883('0x32')],_0x1ec54e[_0xe883('0x34')]);_0x375b92[_0xe883('0x36')]=_['intersection'](_0x1ec54e[_0xe883('0x32')],qs['fields'](_0x5724c5['query'][_0xe883('0x37')]));_0x375b92['attributes']=_0x375b92[_0xe883('0x36')][_0xe883('0x38')]?_0x375b92[_0xe883('0x36')]:_0x1ec54e[_0xe883('0x32')];_0x375b92[_0xe883('0x3a')]=qs['sort'](_0x5724c5[_0xe883('0x34')][_0xe883('0x3b')]);_0x375b92[_0xe883('0x3f')]=qs['filters'](_[_0xe883('0x3d')](_0x5724c5[_0xe883('0x34')],_0x1ec54e['filters']));if(_0x5724c5[_0xe883('0x34')][_0xe883('0x3e')]){_0x375b92[_0xe883('0x3f')]=_['merge'](_0x375b92[_0xe883('0x3f')],{'$or':_['map'](_0x375b92['attributes'],function(_0x776357){var _0x8e58a={};_0x8e58a[_0x776357]={'$like':'%'+_0x5724c5['query']['filter']+'%'};return _0x8e58a;})});}_0x375b92=_[_0xe883('0x41')]({},_0x375b92,_0x5724c5[_0xe883('0x42')]);return _0x50d08d['getIntervals'](_0x375b92);}})['then'](function(_0x1963ca){if(_0x1963ca){_0x1d214a=_0x1963ca['length'];if(!_0x5724c5[_0xe883('0x34')][_0xe883('0x39')]('nolimit')){_0x375b92[_0xe883('0x20')]=qs[_0xe883('0x20')](_0x5724c5[_0xe883('0x34')][_0xe883('0x20')]);_0x375b92[_0xe883('0x1e')]=qs['offset'](_0x5724c5[_0xe883('0x34')]['offset']);}return _0x50d08d[_0xe883('0x57')](_0x375b92);}})[_0xe883('0x27')](function(_0x5e5dd1){if(_0x5e5dd1){return _0x5e5dd1?{'count':_0x1d214a,'rows':_0x5e5dd1}:null;}})['then'](respondWithResult(_0x54b55c,null))['catch'](handleError(_0x54b55c,null));};exports[_0xe883('0x59')]=function(_0x5edddd,_0x154211,_0x8091ca){return db[_0xe883('0x2d')][_0xe883('0x5a')]({'where':{'id':_0x5edddd[_0xe883('0x48')]['id']}})[_0xe883('0x27')](handleEntityNotFound(_0x154211,null))[_0xe883('0x27')](function(_0xd4e432){if(_0xd4e432){return db[_0xe883('0x5b')][_0xe883('0x5c')](function(_0x39b06f){return db[_0xe883('0x2d')][_0xe883('0x54')]({'where':{'IntervalId':_0x5edddd[_0xe883('0x48')]['id']},'transaction':_0x39b06f})[_0xe883('0x27')](function(_0x559fe4){var _0xb53032=_[_0xe883('0x2c')](_0x5edddd[_0xe883('0x4c')],function(_0x251b9c){delete _0x251b9c['id'];_0x251b9c[_0xe883('0x56')]=_0x5edddd[_0xe883('0x48')]['id'];return _0x251b9c;});return db[_0xe883('0x2d')][_0xe883('0x5d')](_0xb53032,{'transaction':_0x39b06f});});})[_0xe883('0x27')](function(){return db['Interval'][_0xe883('0x45')]({'where':{'IntervalId':_0x5edddd['params']['id']}});});}})[_0xe883('0x27')](respondWithResult(_0x154211,null))[_0xe883('0x47')](handleError(_0x154211,null));}; \ No newline at end of file +var _0x6ce2=['sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','destroy','error','stack','name','send','index','map','Interval','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','findOne','filter','addIntervals','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x4ae1c8,_0x3f18c1){var _0x2eb247=function(_0x3574bc){while(--_0x3574bc){_0x4ae1c8['push'](_0x4ae1c8['shift']());}};_0x2eb247(++_0x3f18c1);}(_0x6ce2,0xfe));var _0x26ce=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x6ce2[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x26ce('0x0'));var rimraf=require(_0x26ce('0x1'));var zipdir=require(_0x26ce('0x2'));var jsonpatch=require(_0x26ce('0x3'));var rp=require(_0x26ce('0x4'));var moment=require(_0x26ce('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x26ce('0x6'));var util=require('util');var path=require('path');var sox=require(_0x26ce('0x7'));var csv=require('to-csv');var ejs=require(_0x26ce('0x8'));var fs=require('fs');var fs_extra=require(_0x26ce('0x9'));var _=require(_0x26ce('0xa'));var squel=require(_0x26ce('0xb'));var crypto=require('crypto');var jsforce=require(_0x26ce('0xc'));var deskjs=require(_0x26ce('0xd'));var toCsv=require(_0x26ce('0xe'));var querystring=require(_0x26ce('0xf'));var Papa=require(_0x26ce('0x10'));var Redis=require(_0x26ce('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x26ce('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x26ce('0x13'));var utils=require(_0x26ce('0x14'));var config=require(_0x26ce('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x26ce('0x16'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x58585b,_0x575db9){_0x575db9=_0x575db9||0xcc;return function(_0x4246b1){if(_0x4246b1){return _0x58585b[_0x26ce('0x17')](_0x575db9);}return _0x58585b[_0x26ce('0x18')](_0x575db9)[_0x26ce('0x19')]();};}function respondWithResult(_0x1bce46,_0x1d0eaf){_0x1d0eaf=_0x1d0eaf||0xc8;return function(_0x13f768){if(_0x13f768){return _0x1bce46[_0x26ce('0x18')](_0x1d0eaf)[_0x26ce('0x1a')](_0x13f768);}};}function respondWithFilteredResult(_0x159849,_0x43c83e){return function(_0x4d37d4){if(_0x4d37d4){var _0x5871ae=typeof _0x43c83e[_0x26ce('0x1b')]===_0x26ce('0x1c')&&typeof _0x43c83e[_0x26ce('0x1d')]==='undefined';var _0x5f228f=_0x4d37d4[_0x26ce('0x1e')];var _0x1d744b=_0x5871ae?0x0:_0x43c83e[_0x26ce('0x1b')];var _0x5ecfbf=_0x5871ae?_0x4d37d4[_0x26ce('0x1e')]:_0x43c83e[_0x26ce('0x1b')]+_0x43c83e[_0x26ce('0x1d')];var _0x4488a7;if(_0x5ecfbf>=_0x5f228f){_0x5ecfbf=_0x5f228f;_0x4488a7=0xc8;}else{_0x4488a7=0xce;}_0x159849[_0x26ce('0x18')](_0x4488a7);return _0x159849['set'](_0x26ce('0x1f'),_0x1d744b+'-'+_0x5ecfbf+'/'+_0x5f228f)[_0x26ce('0x1a')](_0x4d37d4);}return null;};}function patchUpdates(_0x316a9e){return function(_0x34ac0f){try{jsonpatch[_0x26ce('0x20')](_0x34ac0f,_0x316a9e,!![]);}catch(_0x3022a5){return BPromise[_0x26ce('0x21')](_0x3022a5);}return _0x34ac0f[_0x26ce('0x22')]();};}function saveUpdates(_0x166992,_0x2c5b80){return function(_0x36fcec){if(_0x36fcec){return _0x36fcec[_0x26ce('0x23')](_0x166992)[_0x26ce('0x24')](function(_0x38defa){return _0x38defa;});}return null;};}function removeEntity(_0x1acabc,_0x52a354){return function(_0x276f44){if(_0x276f44){return _0x276f44['destroy']()[_0x26ce('0x24')](function(){var _0x7f9c80=_0x276f44[_0x26ce('0x25')]({'plain':!![]});var _0x4be760=_0x26ce('0x26');return db[_0x26ce('0x27')][_0x26ce('0x28')]({'where':{'type':_0x4be760,'resourceId':_0x7f9c80['id']}})[_0x26ce('0x24')](function(){return _0x276f44;});})['then'](function(){_0x1acabc[_0x26ce('0x18')](0xcc)[_0x26ce('0x19')]();});}};}function handleEntityNotFound(_0x4a7d5d,_0x5eec53){return function(_0x282579){if(!_0x282579){_0x4a7d5d['sendStatus'](0x194);}return _0x282579;};}function handleError(_0x4089b8,_0x9a28d9){_0x9a28d9=_0x9a28d9||0x1f4;return function(_0x3d335f){logger[_0x26ce('0x29')](_0x3d335f[_0x26ce('0x2a')]);if(_0x3d335f[_0x26ce('0x2b')]){delete _0x3d335f[_0x26ce('0x2b')];}_0x4089b8[_0x26ce('0x18')](_0x9a28d9)[_0x26ce('0x2c')](_0x3d335f);};}exports[_0x26ce('0x2d')]=function(_0x43067c,_0x160236){var _0x3c0c72={},_0x3c075b={},_0x4d9a59={'count':0x0,'rows':[]};var _0x903cdc=_[_0x26ce('0x2e')](db[_0x26ce('0x2f')][_0x26ce('0x30')],function(_0x56deea){return{'name':_0x56deea['fieldName'],'type':_0x56deea['type'][_0x26ce('0x31')]};});_0x3c075b['model']=_[_0x26ce('0x2e')](_0x903cdc,_0x26ce('0x2b'));_0x3c075b[_0x26ce('0x32')]=_[_0x26ce('0x33')](_0x43067c[_0x26ce('0x32')]);_0x3c075b[_0x26ce('0x34')]=_[_0x26ce('0x35')](_0x3c075b['model'],_0x3c075b[_0x26ce('0x32')]);_0x3c0c72[_0x26ce('0x36')]=_[_0x26ce('0x35')](_0x3c075b[_0x26ce('0x37')],qs[_0x26ce('0x38')](_0x43067c['query']['fields']));_0x3c0c72['attributes']=_0x3c0c72[_0x26ce('0x36')][_0x26ce('0x39')]?_0x3c0c72[_0x26ce('0x36')]:_0x3c075b[_0x26ce('0x37')];if(!_0x43067c[_0x26ce('0x32')][_0x26ce('0x3a')](_0x26ce('0x3b'))){_0x3c0c72[_0x26ce('0x1d')]=qs[_0x26ce('0x1d')](_0x43067c[_0x26ce('0x32')][_0x26ce('0x1d')]);_0x3c0c72[_0x26ce('0x1b')]=qs[_0x26ce('0x1b')](_0x43067c['query']['offset']);}_0x3c0c72[_0x26ce('0x3c')]=qs[_0x26ce('0x3d')](_0x43067c[_0x26ce('0x32')]['sort']);_0x3c0c72['where']=qs[_0x26ce('0x34')](_[_0x26ce('0x3e')](_0x43067c[_0x26ce('0x32')],_0x3c075b[_0x26ce('0x34')]),_0x903cdc);if(_0x43067c['query']['filter']){_0x3c0c72[_0x26ce('0x3f')]=_['merge'](_0x3c0c72[_0x26ce('0x3f')],{'$or':_[_0x26ce('0x2e')](_0x903cdc,function(_0x14d800){if(_0x14d800[_0x26ce('0x40')]!=='VIRTUAL'){var _0x31f91b={};_0x31f91b[_0x14d800[_0x26ce('0x2b')]]={'$like':'%'+_0x43067c['query']['filter']+'%'};return _0x31f91b;}})});}_0x3c0c72=_[_0x26ce('0x41')]({},_0x3c0c72,_0x43067c[_0x26ce('0x42')]);var _0x57f08e={'where':_0x3c0c72[_0x26ce('0x3f')]};return db['Interval'][_0x26ce('0x1e')](_0x57f08e)['then'](function(_0x10cf5a){_0x4d9a59[_0x26ce('0x1e')]=_0x10cf5a;if(_0x43067c['query'][_0x26ce('0x43')]){_0x3c0c72[_0x26ce('0x44')]=[{'all':!![]}];}return db[_0x26ce('0x2f')][_0x26ce('0x45')](_0x3c0c72);})[_0x26ce('0x24')](function(_0x580df1){_0x4d9a59[_0x26ce('0x46')]=_0x580df1;return _0x4d9a59;})[_0x26ce('0x24')](respondWithFilteredResult(_0x160236,_0x3c0c72))[_0x26ce('0x47')](handleError(_0x160236,null));};exports['show']=function(_0x13372a,_0x28012c){var _0x3e0f38={'raw':!![],'where':{'id':_0x13372a[_0x26ce('0x48')]['id']}},_0x50fe8a={};_0x50fe8a[_0x26ce('0x37')]=_[_0x26ce('0x33')](db[_0x26ce('0x2f')][_0x26ce('0x30')]);_0x50fe8a[_0x26ce('0x32')]=_[_0x26ce('0x33')](_0x13372a['query']);_0x50fe8a[_0x26ce('0x34')]=_[_0x26ce('0x35')](_0x50fe8a[_0x26ce('0x37')],_0x50fe8a[_0x26ce('0x32')]);_0x3e0f38[_0x26ce('0x36')]=_[_0x26ce('0x35')](_0x50fe8a[_0x26ce('0x37')],qs[_0x26ce('0x38')](_0x13372a['query']['fields']));_0x3e0f38[_0x26ce('0x36')]=_0x3e0f38[_0x26ce('0x36')][_0x26ce('0x39')]?_0x3e0f38['attributes']:_0x50fe8a[_0x26ce('0x37')];if(_0x13372a[_0x26ce('0x32')][_0x26ce('0x43')]){_0x3e0f38['include']=[{'all':!![]}];}_0x3e0f38=_[_0x26ce('0x41')]({},_0x3e0f38,_0x13372a[_0x26ce('0x42')]);return db['Interval'][_0x26ce('0x49')](_0x3e0f38)['then'](handleEntityNotFound(_0x28012c,null))[_0x26ce('0x24')](respondWithResult(_0x28012c,null))[_0x26ce('0x47')](handleError(_0x28012c,null));};exports[_0x26ce('0x4a')]=function(_0x4e44db,_0x41122e){return db[_0x26ce('0x2f')][_0x26ce('0x4a')](_0x4e44db[_0x26ce('0x4b')],{})[_0x26ce('0x24')](function(_0x2fb217){var _0x2cf366=_0x4e44db[_0x26ce('0x4c')][_0x26ce('0x25')]({'plain':!![]});if(!_0x2cf366)throw new Error(_0x26ce('0x4d'));if(_0x2cf366[_0x26ce('0x4e')]==='user'){var _0x4f7072=_0x2fb217['get']({'plain':!![]});var _0x1bceaf=_0x26ce('0x26');return db[_0x26ce('0x4f')]['find']({'where':{'name':_0x1bceaf,'userProfileId':_0x2cf366['userProfileId']},'raw':!![]})['then'](function(_0x35185c){if(_0x35185c&&_0x35185c[_0x26ce('0x50')]===0x0){return db[_0x26ce('0x27')]['create']({'name':_0x4f7072['name'],'resourceId':_0x4f7072['id'],'type':_0x35185c['name'],'sectionId':_0x35185c['id']},{})[_0x26ce('0x24')](function(){return _0x2fb217;});}else{return _0x2fb217;}})[_0x26ce('0x47')](function(_0x1fcb78){logger['error'](_0x26ce('0x51'),_0x1fcb78);throw _0x1fcb78;});}return _0x2fb217;})[_0x26ce('0x24')](respondWithResult(_0x41122e,0xc9))[_0x26ce('0x47')](handleError(_0x41122e,null));};exports['update']=function(_0xe2f276,_0xf7143b){if(_0xe2f276[_0x26ce('0x4b')]['id']){delete _0xe2f276[_0x26ce('0x4b')]['id'];}return db[_0x26ce('0x2f')]['find']({'where':{'id':_0xe2f276[_0x26ce('0x48')]['id']}})['then'](handleEntityNotFound(_0xf7143b,null))[_0x26ce('0x24')](saveUpdates(_0xe2f276['body'],null))[_0x26ce('0x24')](respondWithResult(_0xf7143b,null))['catch'](handleError(_0xf7143b,null));};exports[_0x26ce('0x28')]=function(_0x1ac354,_0x30cae){return db[_0x26ce('0x2f')][_0x26ce('0x49')]({'where':{'id':_0x1ac354[_0x26ce('0x48')]['id']}})['then'](handleEntityNotFound(_0x30cae,null))[_0x26ce('0x24')](removeEntity(_0x30cae,null))[_0x26ce('0x47')](handleError(_0x30cae,null));};exports[_0x26ce('0x52')]=function(_0x5635ea,_0x53cc1f,_0x5e9091){if(_0x5635ea[_0x26ce('0x4b')]['id']){delete _0x5635ea[_0x26ce('0x4b')]['id'];}return db[_0x26ce('0x2f')][_0x26ce('0x49')]({'where':{'id':_0x5635ea[_0x26ce('0x48')]['id']}})[_0x26ce('0x24')](handleEntityNotFound(_0x53cc1f,null))['then'](function(_0x413e76){if(_0x413e76){_0x5635ea[_0x26ce('0x4b')]['IntervalId']=_0x413e76['id'];return db['Interval']['create'](_0x5635ea[_0x26ce('0x4b')]);}})['then'](respondWithResult(_0x53cc1f,null))[_0x26ce('0x47')](handleError(_0x53cc1f,null));};exports['getIntervals']=function(_0xac64e9,_0x4b31eb,_0x47e443){var _0x4504b7={};var _0x1e113c={};var _0x43bee6;var _0x282f5e;return db[_0x26ce('0x2f')][_0x26ce('0x53')]({'where':{'id':_0xac64e9['params']['id']}})['then'](handleEntityNotFound(_0x4b31eb,null))['then'](function(_0x4fcfc7){if(_0x4fcfc7){_0x43bee6=_0x4fcfc7;_0x1e113c[_0x26ce('0x37')]=_[_0x26ce('0x33')](db[_0x26ce('0x2f')][_0x26ce('0x30')]);_0x1e113c[_0x26ce('0x32')]=_['keys'](_0xac64e9[_0x26ce('0x32')]);_0x1e113c[_0x26ce('0x34')]=_[_0x26ce('0x35')](_0x1e113c['model'],_0x1e113c[_0x26ce('0x32')]);_0x4504b7['attributes']=_[_0x26ce('0x35')](_0x1e113c[_0x26ce('0x37')],qs[_0x26ce('0x38')](_0xac64e9[_0x26ce('0x32')]['fields']));_0x4504b7[_0x26ce('0x36')]=_0x4504b7['attributes'][_0x26ce('0x39')]?_0x4504b7[_0x26ce('0x36')]:_0x1e113c[_0x26ce('0x37')];_0x4504b7['order']=qs[_0x26ce('0x3d')](_0xac64e9['query']['sort']);_0x4504b7[_0x26ce('0x3f')]=qs[_0x26ce('0x34')](_['pick'](_0xac64e9['query'],_0x1e113c[_0x26ce('0x34')]));if(_0xac64e9[_0x26ce('0x32')]['filter']){_0x4504b7[_0x26ce('0x3f')]=_['merge'](_0x4504b7['where'],{'$or':_[_0x26ce('0x2e')](_0x4504b7[_0x26ce('0x36')],function(_0x1eab97){var _0x4adade={};_0x4adade[_0x1eab97]={'$like':'%'+_0xac64e9[_0x26ce('0x32')][_0x26ce('0x54')]+'%'};return _0x4adade;})});}_0x4504b7=_[_0x26ce('0x41')]({},_0x4504b7,_0xac64e9['options']);return _0x43bee6['getIntervals'](_0x4504b7);}})[_0x26ce('0x24')](function(_0x2d5177){if(_0x2d5177){_0x282f5e=_0x2d5177['length'];if(!_0xac64e9['query'][_0x26ce('0x3a')](_0x26ce('0x3b'))){_0x4504b7[_0x26ce('0x1d')]=qs['limit'](_0xac64e9[_0x26ce('0x32')][_0x26ce('0x1d')]);_0x4504b7[_0x26ce('0x1b')]=qs[_0x26ce('0x1b')](_0xac64e9[_0x26ce('0x32')][_0x26ce('0x1b')]);}return _0x43bee6['getIntervals'](_0x4504b7);}})[_0x26ce('0x24')](function(_0x57a261){if(_0x57a261){return _0x57a261?{'count':_0x282f5e,'rows':_0x57a261}:null;}})[_0x26ce('0x24')](respondWithResult(_0x4b31eb,null))[_0x26ce('0x47')](handleError(_0x4b31eb,null));};exports[_0x26ce('0x55')]=function(_0x4408c9,_0x22b479,_0x10572f){return db[_0x26ce('0x2f')]['findOne']({'where':{'id':_0x4408c9['params']['id']}})[_0x26ce('0x24')](handleEntityNotFound(_0x22b479,null))[_0x26ce('0x24')](function(_0x36ed4c){if(_0x36ed4c){return db['sequelize'][_0x26ce('0x56')](function(_0x49053d){return db[_0x26ce('0x2f')][_0x26ce('0x28')]({'where':{'IntervalId':_0x4408c9['params']['id']},'transaction':_0x49053d})[_0x26ce('0x24')](function(_0x35a463){var _0x5ec1de=_[_0x26ce('0x2e')](_0x4408c9[_0x26ce('0x4b')],function(_0x6615de){delete _0x6615de['id'];_0x6615de['IntervalId']=_0x4408c9[_0x26ce('0x48')]['id'];return _0x6615de;});return db[_0x26ce('0x2f')]['bulkCreate'](_0x5ec1de,{'transaction':_0x49053d});});})[_0x26ce('0x24')](function(){return db['Interval'][_0x26ce('0x45')]({'where':{'IntervalId':_0x4408c9[_0x26ce('0x48')]['id']}});});}})['then'](respondWithResult(_0x22b479,null))[_0x26ce('0x47')](handleError(_0x22b479,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index cc8f9ca..b681045 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 _0x437d=['../../components/extensions/rewrite','../../utils/iftime','iftime','exports','Interval','tools_intervals','rewrite','string','interval','then','map','ifTime','reduce'];(function(_0x5ed848,_0x4656ce){var _0x3fc715=function(_0x103afb){while(--_0x103afb){_0x5ed848['push'](_0x5ed848['shift']());}};_0x3fc715(++_0x4656ce);}(_0x437d,0x16c));var _0xd437=function(_0x3220aa,_0x4e66d5){_0x3220aa=_0x3220aa-0x0;var _0x27eee9=_0x437d[_0x3220aa];return _0x27eee9;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xd437('0x0'));var iftime=require(_0xd437('0x1'))[_0xd437('0x2')];module[_0xd437('0x3')]=function(_0x49cf17){return _0x49cf17['define'](_0xd437('0x4'),attributes,{'tableName':_0xd437('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5c566a){extensions[_0xd437('0x6')](_0x49cf17,_0x5c566a);},'afterBulkCreate':function(_0x25b165,_0x4f795c,_0x15eeaf){_0x15eeaf();extensions[_0xd437('0x6')](_0x49cf17,_0x25b165[0x0]);},'afterUpdate':function(_0x445aa5){extensions[_0xd437('0x6')](_0x49cf17,_0x445aa5);},'afterDestroy':function(_0x4d23ea){extensions['rewrite'](_0x49cf17,_0x4d23ea);}},'instanceMethods':{'ifTime':function(_0x15fab2=undefined,_0x1bd6e1=new Date()){if(typeof this['interval']===_0xd437('0x7')){return iftime(this[_0xd437('0x8')],_0x15fab2,_0x1bd6e1);}else{return this['getIntervals']()[_0xd437('0x9')](function(_0x1a6a73){return Promise['all'](_0x1a6a73[_0xd437('0xa')](function(_0x302fb3){return _0x302fb3[_0xd437('0xb')](_0x15fab2,_0x1bd6e1);}));})[_0xd437('0x9')](function(_0xc9ab5b){return _0xc9ab5b[_0xd437('0xc')](function(_0x138962,_0x46e4d4){return _0x138962||_0x46e4d4;},![]);});}}}});}; \ No newline at end of file +var _0x2e80=['all','map','reduce','./interval.attributes','../../utils/iftime','exports','define','Interval','rewrite','interval','string','then'];(function(_0x299028,_0x4d7e9f){var _0x12154e=function(_0x558d18){while(--_0x558d18){_0x299028['push'](_0x299028['shift']());}};_0x12154e(++_0x4d7e9f);}(_0x2e80,0x177));var _0x02e8=function(_0x54f7c0,_0x27af83){_0x54f7c0=_0x54f7c0-0x0;var _0x245d03=_0x2e80[_0x54f7c0];return _0x245d03;};'use strict';var attributes=require(_0x02e8('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x02e8('0x1'))['iftime'];module[_0x02e8('0x2')]=function(_0x503ffa){return _0x503ffa[_0x02e8('0x3')](_0x02e8('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b4428){extensions['rewrite'](_0x503ffa,_0x3b4428);},'afterBulkCreate':function(_0x51f7f9,_0x47ca05,_0x218235){_0x218235();extensions['rewrite'](_0x503ffa,_0x51f7f9[0x0]);},'afterUpdate':function(_0x228104){extensions[_0x02e8('0x5')](_0x503ffa,_0x228104);},'afterDestroy':function(_0x50ab77){extensions[_0x02e8('0x5')](_0x503ffa,_0x50ab77);}},'instanceMethods':{'ifTime':function(_0x39817f=undefined,_0x3fb969=new Date()){if(typeof this[_0x02e8('0x6')]===_0x02e8('0x7')){return iftime(this[_0x02e8('0x6')],_0x39817f,_0x3fb969);}else{return this['getIntervals']()[_0x02e8('0x8')](function(_0x42a849){return Promise[_0x02e8('0x9')](_0x42a849[_0x02e8('0xa')](function(_0x5e4dd2){return _0x5e4dd2['ifTime'](_0x39817f,_0x3fb969);}));})[_0x02e8('0x8')](function(_0x3b3e4c){return _0x3b3e4c[_0x02e8('0xb')](function(_0x99e573,_0x48a8d3){return _0x99e573||_0x48a8d3;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 9f7791c..f42a27b 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 _0x8272=['GetInterval','Interval','options','where','attributes','limit','include','map','model','then','info','stringify','catch','error','message','ShowInterval','find','raw','debug','findAll','all','ifTime','reduce','name','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','isArray','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc'];(function(_0x4e2596,_0x1ff134){var _0x3804de=function(_0x3cba73){while(--_0x3cba73){_0x4e2596['push'](_0x4e2596['shift']());}};_0x3804de(++_0x1ff134);}(_0x8272,0xdb));var _0x2827=function(_0x3e1294,_0x41791a){_0x3e1294=_0x3e1294-0x0;var _0x3bbca2=_0x8272[_0x3e1294];return _0x3bbca2;};'use strict';var _=require('lodash');var util=require(_0x2827('0x0'));var db=require(_0x2827('0x1'))['db'];var iftime=require(_0x2827('0x2'))[_0x2827('0x3')];var logger=require(_0x2827('0x4'))(_0x2827('0x5'));exports[_0x2827('0x6')]=function(_0x149520){var _0x276165=this;return new Promise(function(_0x21d70b,_0x273697){return db[_0x2827('0x7')]['findAll']({'raw':_0x149520['options']?_0x149520[_0x2827('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x149520[_0x2827('0x8')]?_0x149520[_0x2827('0x8')][_0x2827('0x9')]||null:null,'attributes':_0x149520[_0x2827('0x8')]?_0x149520[_0x2827('0x8')][_0x2827('0xa')]||null:null,'limit':_0x149520[_0x2827('0x8')]?_0x149520[_0x2827('0x8')][_0x2827('0xb')]||null:null,'include':_0x149520['options']?_0x149520[_0x2827('0x8')][_0x2827('0xc')]?_[_0x2827('0xd')](_0x149520[_0x2827('0x8')][_0x2827('0xc')],function(_0x256345){return{'model':db[_0x256345[_0x2827('0xe')]],'as':_0x256345['as'],'attributes':_0x256345[_0x2827('0xa')],'include':_0x256345[_0x2827('0xc')]?_[_0x2827('0xd')](_0x256345[_0x2827('0xc')],function(_0x173ee4){return{'model':db[_0x173ee4[_0x2827('0xe')]],'as':_0x173ee4['as'],'attributes':_0x173ee4[_0x2827('0xa')],'include':_0x173ee4['include']?_[_0x2827('0xd')](_0x173ee4['include'],function(_0x324e98){return{'model':db[_0x324e98[_0x2827('0xe')]],'as':_0x324e98['as'],'attributes':_0x324e98[_0x2827('0xa')]};}):[]};}):[]};}):[]:[]})[_0x2827('0xf')](function(_0x40c109){logger[_0x2827('0x10')]('GetInterval',_0x149520);logger['debug']('GetInterval',_0x149520,JSON[_0x2827('0x11')](_0x40c109));_0x21d70b(_0x40c109);})[_0x2827('0x12')](function(_0x92e0cb){logger[_0x2827('0x13')](_0x2827('0x6'),_0x92e0cb['message'],_0x149520);_0x273697(_0x276165[_0x2827('0x13')](0x1f4,_0x92e0cb[_0x2827('0x14')]));});});};exports[_0x2827('0x15')]=function(_0x546a2c){var _0x1b4828=this;return new Promise(function(_0x3496e3,_0x4cce70){return db[_0x2827('0x7')][_0x2827('0x16')]({'raw':_0x546a2c[_0x2827('0x8')]?_0x546a2c[_0x2827('0x8')][_0x2827('0x17')]===undefined?!![]:![]:!![],'where':_0x546a2c['options']?_0x546a2c[_0x2827('0x8')][_0x2827('0x9')]||null:null,'attributes':_0x546a2c[_0x2827('0x8')]?_0x546a2c['options'][_0x2827('0xa')]||null:null,'include':_0x546a2c['options']?_0x546a2c[_0x2827('0x8')][_0x2827('0xc')]?_[_0x2827('0xd')](_0x546a2c[_0x2827('0x8')][_0x2827('0xc')],function(_0x359cd6){return{'model':db[_0x359cd6[_0x2827('0xe')]],'as':_0x359cd6['as'],'attributes':_0x359cd6[_0x2827('0xa')],'include':_0x359cd6[_0x2827('0xc')]?_[_0x2827('0xd')](_0x359cd6['include'],function(_0x2bbfae){return{'model':db[_0x2bbfae['model']],'as':_0x2bbfae['as'],'attributes':_0x2bbfae['attributes'],'include':_0x2bbfae[_0x2827('0xc')]?_[_0x2827('0xd')](_0x2bbfae[_0x2827('0xc')],function(_0x2848bf){return{'model':db[_0x2848bf['model']],'as':_0x2848bf['as'],'attributes':_0x2848bf['attributes']};}):[]};}):[]};}):[]:[]})[_0x2827('0xf')](function(_0x47023a){logger[_0x2827('0x10')](_0x2827('0x15'),_0x546a2c);logger[_0x2827('0x18')](_0x2827('0x15'),_0x546a2c,JSON['stringify'](_0x47023a));_0x3496e3(_0x47023a);})[_0x2827('0x12')](function(_0xd5e7f0){logger[_0x2827('0x13')](_0x2827('0x15'),_0xd5e7f0[_0x2827('0x14')],_0x546a2c);_0x4cce70(_0x1b4828[_0x2827('0x13')](0x1f4,_0xd5e7f0[_0x2827('0x14')]));});});};function checkArrayOfIntervals(_0xabae98,_0x2979d4){var _0x2e12f3=[];return db['Interval'][_0x2827('0x19')]({'where':{'id':_0xabae98}})[_0x2827('0xf')](function(_0x3cb61c){_0x2e12f3=_0x3cb61c;return Promise[_0x2827('0x1a')](_0x2e12f3['map'](function(_0x4c68cc){return _0x4c68cc[_0x2827('0x1b')](_0x2979d4);}));})[_0x2827('0xf')](function(_0x2955ce){var _0x19096e=_0x2955ce[_0x2827('0x1c')](function(_0x325dfa,_0x5831f3){return _0x325dfa||_0x5831f3;},![]);logger['info'](util['format']('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x2e12f3[_0x2827('0xd')](function(_0x251fa4){return _0x251fa4[_0x2827('0x1d')];})[_0x2827('0x1e')](',\x20'),_0x2e12f3[_0x2827('0xd')](function(_0x520386){return _0x520386['id'];})['join'](',\x20')));return _0x19096e;});}function checkSingleInterval(_0x3e9fcf,_0x4b272e){return db['Interval'][_0x2827('0x1f')](_0x3e9fcf)['then'](function(_0x3b1c5d){if(_0x3b1c5d){logger['info'](util[_0x2827('0x20')](_0x2827('0x21'),_0x3b1c5d['name'],_0x3b1c5d['id']));return _0x3b1c5d[_0x2827('0x1b')](_0x4b272e);}});}exports['IntervalIftime']=function(_0x4d1c13){var _0x474de8=_0x4d1c13[_0x2827('0x22')];var _0x45f691=Array[_0x2827('0x23')](_0x4d1c13[_0x2827('0x24')])?_0x4d1c13[_0x2827('0x24')]:typeof _0x4d1c13['intervals']===_0x2827('0x25')?[_0x4d1c13[_0x2827('0x24')]]:[];var _0x27356c=_0x4d1c13['timezone']||undefined;var _0x4d02dc=![];if(_0x45f691[_0x2827('0x26')]){logger['info'](util[_0x2827('0x20')](_0x2827('0x27'),_0x45f691[_0x2827('0x1e')](';\x20')));}if(_0x27356c){logger[_0x2827('0x10')](util[_0x2827('0x20')](_0x2827('0x28'),_0x27356c));}logger[_0x2827('0x18')](_0x2827('0x29'),_0x4d02dc);logger[_0x2827('0x2a')](_0x2827('0x2b'),_0x4d1c13);return Promise[_0x2827('0x2c')]()[_0x2827('0xf')](function(){if(Array['isArray'](_0x474de8)){return checkArrayOfIntervals(_0x474de8,_0x27356c);}else if(_0x474de8){return checkSingleInterval(_0x474de8,_0x27356c);}})['then'](function(_0x3efd1c){var _0x4f0ac5=_0x45f691[_0x2827('0x1c')](function(_0x5d81c1,_0x399d3c){return _0x5d81c1||iftime(_0x399d3c,_0x27356c);},![]);_0x4d02dc=_0x3efd1c||_0x4f0ac5;return _0x4d02dc;})['catch'](function(_0x2f30c8){logger[_0x2827('0x13')](_0x2827('0x2b'),_0x4d1c13,_0x2f30c8);throw this[_0x2827('0x13')](0x1f4,_0x2f30c8[_0x2827('0x14')]);});}; \ No newline at end of file +var _0xa76d=['message','ShowInterval','find','where','all','join','name','ifTime','intervalIds','isArray','intervals','string','timezone','length','format','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','reduce','lodash','util','../../mysqldb','../../utils/iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','attributes','limit','include','map','model','then','info','debug','stringify','catch','error'];(function(_0x4f8e83,_0x318d19){var _0x7e049e=function(_0x2d8875){while(--_0x2d8875){_0x4f8e83['push'](_0x4f8e83['shift']());}};_0x7e049e(++_0x318d19);}(_0xa76d,0x142));var _0xda76=function(_0x192d60,_0x5f53c8){_0x192d60=_0x192d60-0x0;var _0x189f8f=_0xa76d[_0x192d60];return _0x189f8f;};'use strict';var _=require(_0xda76('0x0'));var util=require(_0xda76('0x1'));var db=require(_0xda76('0x2'))['db'];var iftime=require(_0xda76('0x3'))['iftime'];var logger=require(_0xda76('0x4'))(_0xda76('0x5'));exports[_0xda76('0x6')]=function(_0x13f2ab){var _0xca5951=this;return new Promise(function(_0x3b39a1,_0x5d7f7f){return db[_0xda76('0x7')][_0xda76('0x8')]({'raw':_0x13f2ab[_0xda76('0x9')]?_0x13f2ab[_0xda76('0x9')][_0xda76('0xa')]===undefined?!![]:![]:!![],'where':_0x13f2ab[_0xda76('0x9')]?_0x13f2ab[_0xda76('0x9')]['where']||null:null,'attributes':_0x13f2ab[_0xda76('0x9')]?_0x13f2ab[_0xda76('0x9')][_0xda76('0xb')]||null:null,'limit':_0x13f2ab[_0xda76('0x9')]?_0x13f2ab[_0xda76('0x9')][_0xda76('0xc')]||null:null,'include':_0x13f2ab[_0xda76('0x9')]?_0x13f2ab[_0xda76('0x9')][_0xda76('0xd')]?_[_0xda76('0xe')](_0x13f2ab[_0xda76('0x9')][_0xda76('0xd')],function(_0x4e1784){return{'model':db[_0x4e1784[_0xda76('0xf')]],'as':_0x4e1784['as'],'attributes':_0x4e1784[_0xda76('0xb')],'include':_0x4e1784[_0xda76('0xd')]?_[_0xda76('0xe')](_0x4e1784['include'],function(_0x5bda16){return{'model':db[_0x5bda16[_0xda76('0xf')]],'as':_0x5bda16['as'],'attributes':_0x5bda16[_0xda76('0xb')],'include':_0x5bda16[_0xda76('0xd')]?_[_0xda76('0xe')](_0x5bda16[_0xda76('0xd')],function(_0x176d83){return{'model':db[_0x176d83[_0xda76('0xf')]],'as':_0x176d83['as'],'attributes':_0x176d83['attributes']};}):[]};}):[]};}):[]:[]})[_0xda76('0x10')](function(_0x476bec){logger[_0xda76('0x11')]('GetInterval',_0x13f2ab);logger[_0xda76('0x12')](_0xda76('0x6'),_0x13f2ab,JSON[_0xda76('0x13')](_0x476bec));_0x3b39a1(_0x476bec);})[_0xda76('0x14')](function(_0x438dbd){logger[_0xda76('0x15')](_0xda76('0x6'),_0x438dbd['message'],_0x13f2ab);_0x5d7f7f(_0xca5951[_0xda76('0x15')](0x1f4,_0x438dbd[_0xda76('0x16')]));});});};exports[_0xda76('0x17')]=function(_0x5f4be0){var _0x516767=this;return new Promise(function(_0x1dfd01,_0x42cd28){return db[_0xda76('0x7')][_0xda76('0x18')]({'raw':_0x5f4be0[_0xda76('0x9')]?_0x5f4be0[_0xda76('0x9')][_0xda76('0xa')]===undefined?!![]:![]:!![],'where':_0x5f4be0[_0xda76('0x9')]?_0x5f4be0[_0xda76('0x9')][_0xda76('0x19')]||null:null,'attributes':_0x5f4be0[_0xda76('0x9')]?_0x5f4be0[_0xda76('0x9')][_0xda76('0xb')]||null:null,'include':_0x5f4be0[_0xda76('0x9')]?_0x5f4be0[_0xda76('0x9')][_0xda76('0xd')]?_['map'](_0x5f4be0['options'][_0xda76('0xd')],function(_0x2d2fc7){return{'model':db[_0x2d2fc7[_0xda76('0xf')]],'as':_0x2d2fc7['as'],'attributes':_0x2d2fc7[_0xda76('0xb')],'include':_0x2d2fc7['include']?_[_0xda76('0xe')](_0x2d2fc7['include'],function(_0x16c353){return{'model':db[_0x16c353[_0xda76('0xf')]],'as':_0x16c353['as'],'attributes':_0x16c353['attributes'],'include':_0x16c353['include']?_[_0xda76('0xe')](_0x16c353[_0xda76('0xd')],function(_0x1b7714){return{'model':db[_0x1b7714['model']],'as':_0x1b7714['as'],'attributes':_0x1b7714['attributes']};}):[]};}):[]};}):[]:[]})[_0xda76('0x10')](function(_0x3797e7){logger[_0xda76('0x11')](_0xda76('0x17'),_0x5f4be0);logger[_0xda76('0x12')](_0xda76('0x17'),_0x5f4be0,JSON[_0xda76('0x13')](_0x3797e7));_0x1dfd01(_0x3797e7);})[_0xda76('0x14')](function(_0x50db33){logger[_0xda76('0x15')]('ShowInterval',_0x50db33['message'],_0x5f4be0);_0x42cd28(_0x516767[_0xda76('0x15')](0x1f4,_0x50db33[_0xda76('0x16')]));});});};function checkArrayOfIntervals(_0x3b1ec4,_0x103d3e){var _0x131d07=[];return db[_0xda76('0x7')][_0xda76('0x8')]({'where':{'id':_0x3b1ec4}})[_0xda76('0x10')](function(_0xe3da59){_0x131d07=_0xe3da59;return Promise[_0xda76('0x1a')](_0x131d07[_0xda76('0xe')](function(_0x56807d){return _0x56807d['ifTime'](_0x103d3e);}));})[_0xda76('0x10')](function(_0x5afa60){var _0xb384c0=_0x5afa60['reduce'](function(_0x7a0f1c,_0x55a940){return _0x7a0f1c||_0x55a940;},![]);logger[_0xda76('0x11')](util['format']('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x131d07['map'](function(_0x4d6092){return _0x4d6092['name'];})['join'](',\x20'),_0x131d07[_0xda76('0xe')](function(_0x456397){return _0x456397['id'];})[_0xda76('0x1b')](',\x20')));return _0xb384c0;});}function checkSingleInterval(_0x1104f3,_0x2a5011){return db['Interval']['findById'](_0x1104f3)[_0xda76('0x10')](function(_0x6e4ba5){if(_0x6e4ba5){logger[_0xda76('0x11')](util['format']('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x6e4ba5[_0xda76('0x1c')],_0x6e4ba5['id']));return _0x6e4ba5[_0xda76('0x1d')](_0x2a5011);}});}exports['IntervalIftime']=function(_0xb53c9e){var _0x2ca914=_0xb53c9e[_0xda76('0x1e')];var _0x9556cd=Array[_0xda76('0x1f')](_0xb53c9e['intervals'])?_0xb53c9e[_0xda76('0x20')]:typeof _0xb53c9e[_0xda76('0x20')]===_0xda76('0x21')?[_0xb53c9e[_0xda76('0x20')]]:[];var _0x57f772=_0xb53c9e[_0xda76('0x22')]||undefined;var _0x34a1b0=![];if(_0x9556cd[_0xda76('0x23')]){logger[_0xda76('0x11')](util[_0xda76('0x24')](_0xda76('0x25'),_0x9556cd[_0xda76('0x1b')](';\x20')));}if(_0x57f772){logger['info'](util[_0xda76('0x24')](_0xda76('0x26'),_0x57f772));}logger[_0xda76('0x12')](_0xda76('0x27'),_0x34a1b0);logger[_0xda76('0x28')](_0xda76('0x29'),_0xb53c9e);return Promise['resolve']()['then'](function(){if(Array[_0xda76('0x1f')](_0x2ca914)){return checkArrayOfIntervals(_0x2ca914,_0x57f772);}else if(_0x2ca914){return checkSingleInterval(_0x2ca914,_0x57f772);}})[_0xda76('0x10')](function(_0x3757ea){var _0xc6eb43=_0x9556cd[_0xda76('0x2a')](function(_0x1d9a8f,_0x5ef6e5){return _0x1d9a8f||iftime(_0x5ef6e5,_0x57f772);},![]);_0x34a1b0=_0x3757ea||_0xc6eb43;return _0x34a1b0;})[_0xda76('0x14')](function(_0x577e69){logger[_0xda76('0x15')](_0xda76('0x29'),_0xb53c9e,_0x577e69);throw this['error'](0x1f4,_0x577e69[_0xda76('0x16')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index b0b4911..d74ed38 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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x18d631,_0x4376d2){var _0x50d708=function(_0x3b6ab5){while(--_0x3b6ab5){_0x18d631['push'](_0x18d631['shift']());}};_0x50d708(++_0x4376d2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 1ede878..bd8ca91 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 _0x2f10=['customfield_11500','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','send','body','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','Report','\x20from\x20','issuetype','fields'];(function(_0x37fead,_0x178c7d){var _0x211a4c=function(_0x16d0cd){while(--_0x16d0cd){_0x37fead['push'](_0x37fead['shift']());}};_0x211a4c(++_0x178c7d);}(_0x2f10,0xa9));var _0x02f1=function(_0xb67be,_0xea4afc){_0xb67be=_0xb67be-0x0;var _0x7bd493=_0x2f10[_0xb67be];return _0x7bd493;};'use strict';var BPromise=require(_0x02f1('0x0'));var https=require(_0x02f1('0x1'));var logger=require(_0x02f1('0x2'))(_0x02f1('0x3'));var USERNAME=_0x02f1('0x4');var PASSWORD=_0x02f1('0x5');function openIssue(_0x3c8ba3,_0xd2248e){var _0x90b9d={'fields':{'project':{'key':_0x3c8ba3['key']||_0x02f1('0x6')},'summary':(_0x3c8ba3['summary']||_0x02f1('0x7'))+_0x02f1('0x8')+_0x3c8ba3['ip'],'description':_0x3c8ba3['description']||JSON['stringify'](_0x3c8ba3),'issuetype':{'name':_0x3c8ba3[_0x02f1('0x9')]||'Bug'}}};_0x90b9d[_0x02f1('0xa')][_0x02f1('0xb')]=_0x3c8ba3['email'];_0x90b9d[_0x02f1('0xa')]['customfield_11501']=_0x3c8ba3[_0x02f1('0xc')];_0x90b9d[_0x02f1('0xa')][_0x02f1('0xd')]=_0x3c8ba3[_0x02f1('0xe')];_0x90b9d[_0x02f1('0xa')][_0x02f1('0xf')]=_0x3c8ba3[_0x02f1('0x10')];_0x90b9d['fields'][_0x02f1('0x11')]=_0x3c8ba3[_0x02f1('0x12')];_0x90b9d[_0x02f1('0xa')][_0x02f1('0x13')]=_0x3c8ba3['ip'];var _0x5e6cb8={'host':_0x02f1('0x14'),'port':0x1bb,'path':_0x02f1('0x15'),'method':_0x02f1('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x02f1('0x17'),'Authorization':_0x02f1('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x02f1('0x19')](_0x02f1('0x1a'))}};var _0x274dff=JSON[_0x02f1('0x1b')](_0x90b9d);var _0x1ed5fb=https[_0x02f1('0x1c')](_0x5e6cb8,function(_0x453234){_0x453234[_0x02f1('0x1d')](_0x02f1('0x1e'));var _0x37e542='';_0x453234['on'](_0x02f1('0x1f'),function(_0x319fa6){_0x37e542+=_0x319fa6;});_0x453234['on'](_0x02f1('0x20'),function(){if(_0xd2248e){return _0xd2248e[_0x02f1('0x21')](_0x453234['statusCode'])[_0x02f1('0x22')](JSON[_0x02f1('0x23')](_0x37e542));}});});_0x1ed5fb['on'](_0x02f1('0x24'),function(_0x57b1e9){if(_0xd2248e){return _0xd2248e['status'](0x1f4)['json']({'errors':[{'message':_0x02f1('0x25'),'type':_0x02f1('0x26')}]});}});_0x1ed5fb['write'](_0x274dff);_0x1ed5fb['end']();}exports['openIssue']=openIssue;exports[_0x02f1('0x27')]=function(_0x1e3fd1,_0xa0c7f6){_0x1e3fd1[_0x02f1('0x28')]['ip']=_0x1e3fd1['headers'][_0x02f1('0x29')]||_0x1e3fd1[_0x02f1('0x2a')]['remoteAddress']||_0x1e3fd1[_0x02f1('0x2b')][_0x02f1('0x2c')]||_0x1e3fd1[_0x02f1('0x2a')][_0x02f1('0x2b')][_0x02f1('0x2c')];return openIssue(_0x1e3fd1['body'],_0xa0c7f6);}; \ No newline at end of file +var _0x1fed=['api.jira','write','openIssue','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','email','fields','customfield_11501','customfield_11502','newToken','customfield_11503','name','reason','/rest/api/2/issue','Basic\x20','toString','base64','setEncoding','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request'];(function(_0x3bd904,_0x1c4ff6){var _0x318065=function(_0xc598fa){while(--_0xc598fa){_0x3bd904['push'](_0x3bd904['shift']());}};_0x318065(++_0x1c4ff6);}(_0x1fed,0xda));var _0xd1fe=function(_0x2f49df,_0x518919){_0x2f49df=_0x2f49df-0x0;var _0x1ec090=_0x1fed[_0x2f49df];return _0x1ec090;};'use strict';var BPromise=require(_0xd1fe('0x0'));var https=require(_0xd1fe('0x1'));var logger=require(_0xd1fe('0x2'))(_0xd1fe('0x3'));var USERNAME=_0xd1fe('0x4');var PASSWORD=_0xd1fe('0x5');function openIssue(_0x1fe16a,_0x4a5ed2){var _0x2394f9={'fields':{'project':{'key':_0x1fe16a[_0xd1fe('0x6')]||'MOTGUI'},'summary':(_0x1fe16a[_0xd1fe('0x7')]||_0xd1fe('0x8'))+_0xd1fe('0x9')+_0x1fe16a['ip'],'description':_0x1fe16a[_0xd1fe('0xa')]||JSON[_0xd1fe('0xb')](_0x1fe16a),'issuetype':{'name':_0x1fe16a[_0xd1fe('0xc')]||_0xd1fe('0xd')}}};_0x2394f9['fields'][_0xd1fe('0xe')]=_0x1fe16a[_0xd1fe('0xf')];_0x2394f9[_0xd1fe('0x10')][_0xd1fe('0x11')]=_0x1fe16a['oldToken'];_0x2394f9[_0xd1fe('0x10')][_0xd1fe('0x12')]=_0x1fe16a[_0xd1fe('0x13')];_0x2394f9[_0xd1fe('0x10')][_0xd1fe('0x14')]=_0x1fe16a[_0xd1fe('0x15')];_0x2394f9['fields']['customfield_11504']=_0x1fe16a[_0xd1fe('0x16')];_0x2394f9[_0xd1fe('0x10')]['customfield_10102']=_0x1fe16a['ip'];var _0x20fbc0={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xd1fe('0x17'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xd1fe('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xd1fe('0x19')](_0xd1fe('0x1a'))}};var _0x251e6c=JSON[_0xd1fe('0xb')](_0x2394f9);var _0x123016=https['request'](_0x20fbc0,function(_0x444ece){_0x444ece[_0xd1fe('0x1b')]('utf8');var _0x5b3f1c='';_0x444ece['on']('data',function(_0x1dadbe){_0x5b3f1c+=_0x1dadbe;});_0x444ece['on'](_0xd1fe('0x1c'),function(){if(_0x4a5ed2){return _0x4a5ed2[_0xd1fe('0x1d')](_0x444ece[_0xd1fe('0x1e')])[_0xd1fe('0x1f')](JSON[_0xd1fe('0x20')](_0x5b3f1c));}});});_0x123016['on']('error',function(_0x31ceda){if(_0x4a5ed2){return _0x4a5ed2[_0xd1fe('0x1d')](0x1f4)['json']({'errors':[{'message':_0xd1fe('0x21'),'type':_0xd1fe('0x22')}]});}});_0x123016[_0xd1fe('0x23')](_0x251e6c);_0x123016['end']();}exports[_0xd1fe('0x24')]=openIssue;exports['send']=function(_0x5444be,_0x49dbb6){_0x5444be[_0xd1fe('0x25')]['ip']=_0x5444be['headers'][_0xd1fe('0x26')]||_0x5444be[_0xd1fe('0x27')][_0xd1fe('0x28')]||_0x5444be[_0xd1fe('0x29')][_0xd1fe('0x28')]||_0x5444be[_0xd1fe('0x27')][_0xd1fe('0x29')][_0xd1fe('0x28')];return openIssue(_0x5444be[_0xd1fe('0x25')],_0x49dbb6);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 7e2f212..ffda7c7 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1339=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4147e6,_0x57174e){var _0x3305ba=function(_0x30199e){while(--_0x30199e){_0x4147e6['push'](_0x4147e6['shift']());}};_0x3305ba(++_0x57174e);}(_0x1339,0x1ed));var _0x9133=function(_0x2c7354,_0x1bd80a){_0x2c7354=_0x2c7354-0x0;var _0x38e8c2=_0x1339[_0x2c7354];return _0x38e8c2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var fs_extra=require(_0x9133('0x4'));var auth=require(_0x9133('0x5'));var interaction=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0x9133('0x8')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0xa')]);router['get'](_0x9133('0xb'),auth[_0x9133('0x9')](),controller[_0x9133('0xc')]);router[_0x9133('0x8')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0xe')]);router[_0x9133('0xf')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0x10')]);router['put'](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0x11')]);router[_0x9133('0x12')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller['destroy']);module[_0x9133('0x13')]=router; \ No newline at end of file +var _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','get','describe','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xac4a,0x13f));var _0xaac4=function(_0x1bce53,_0x252ee8){_0x1bce53=_0x1bce53-0x0;var _0x3b13b1=_0xac4a[_0x1bce53];return _0x3b13b1;};'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('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaac4('0xd')](_0xaac4('0xe'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);module[_0xaac4('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 70b70a5..60f1d2f 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0x1a8a82,_0x12580){_0x1a8a82=_0x1a8a82-0x0;var _0x173354=_0x7a54[_0x1a8a82];return _0x173354;};'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(_0x45c996,_0x393f1f){_0x45c996=_0x45c996-0x0;var _0x48ef4b=_0x7a54[_0x45c996];return _0x48ef4b;};'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 5b9b2ab..a6c96ae 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 _0x14f5=['limit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty'];(function(_0x4a76d8,_0x5a442f){var _0xcda2b6=function(_0x49f356){while(--_0x49f356){_0x4a76d8['push'](_0x4a76d8['shift']());}};_0xcda2b6(++_0x5a442f);}(_0x14f5,0xae));var _0x514f=function(_0x5008c8,_0x342e4a){_0x5008c8=_0x5008c8-0x0;var _0x28d778=_0x14f5[_0x5008c8];return _0x28d778;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x514f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x514f('0x1'));var rp=require(_0x514f('0x2'));var moment=require(_0x514f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x514f('0x4'));var util=require(_0x514f('0x5'));var path=require('path');var sox=require(_0x514f('0x6'));var csv=require(_0x514f('0x7'));var ejs=require(_0x514f('0x8'));var fs=require('fs');var fs_extra=require(_0x514f('0x9'));var _=require(_0x514f('0xa'));var squel=require(_0x514f('0xb'));var crypto=require(_0x514f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x514f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x514f('0xe'));var Papa=require(_0x514f('0xf'));var Redis=require(_0x514f('0x10'));var authService=require(_0x514f('0x11'));var qs=require(_0x514f('0x12'));var as=require(_0x514f('0x13'));var hardwareService=require(_0x514f('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x514f('0x15'));var licenseUtil=require(_0x514f('0x16'));var db=require(_0x514f('0x17'))['db'];function respondWithStatusCode(_0x321914,_0x3eed49){_0x3eed49=_0x3eed49||0xcc;return function(_0x2ed1b7){if(_0x2ed1b7){return _0x321914[_0x514f('0x18')](_0x3eed49);}return _0x321914[_0x514f('0x19')](_0x3eed49)[_0x514f('0x1a')]();};}function respondWithResult(_0x4124bf,_0x46e552){_0x46e552=_0x46e552||0xc8;return function(_0x3fc905){if(_0x3fc905){return _0x4124bf[_0x514f('0x19')](_0x46e552)[_0x514f('0x1b')](_0x3fc905);}};}function respondWithFilteredResult(_0x1694b3,_0x5865d1){return function(_0x70d2b4){if(_0x70d2b4){var _0x1f0cbe=typeof _0x5865d1['offset']===_0x514f('0x1c')&&typeof _0x5865d1['limit']===_0x514f('0x1c');var _0x309ce0=_0x70d2b4[_0x514f('0x1d')];var _0x5a5641=_0x1f0cbe?0x0:_0x5865d1[_0x514f('0x1e')];var _0x3673a4=_0x1f0cbe?_0x70d2b4[_0x514f('0x1d')]:_0x5865d1[_0x514f('0x1e')]+_0x5865d1['limit'];var _0x4f9193;if(_0x3673a4>=_0x309ce0){_0x3673a4=_0x309ce0;_0x4f9193=0xc8;}else{_0x4f9193=0xce;}_0x1694b3[_0x514f('0x19')](_0x4f9193);return _0x1694b3[_0x514f('0x1f')](_0x514f('0x20'),_0x5a5641+'-'+_0x3673a4+'/'+_0x309ce0)['json'](_0x70d2b4);}return null;};}function patchUpdates(_0x43fcf9){return function(_0x7248e8){try{jsonpatch['apply'](_0x7248e8,_0x43fcf9,!![]);}catch(_0x186417){return BPromise[_0x514f('0x21')](_0x186417);}return _0x7248e8['save']();};}function saveUpdates(_0xd093a1,_0x18a430){return function(_0xd89aa2){if(_0xd89aa2){return _0xd89aa2[_0x514f('0x22')](_0xd093a1)['then'](function(_0x58861e){return _0x58861e;});}return null;};}function removeEntity(_0x4b0245,_0x5d80cb){return function(_0x1c16f9){if(_0x1c16f9){return _0x1c16f9[_0x514f('0x23')]()[_0x514f('0x24')](function(){_0x4b0245[_0x514f('0x19')](0xcc)[_0x514f('0x1a')]();});}};}function handleEntityNotFound(_0x26df04,_0x2c6bb1){return function(_0x101742){if(!_0x101742){_0x26df04[_0x514f('0x18')](0x194);}return _0x101742;};}function handleError(_0x5f2da2,_0x8c8bdf){_0x8c8bdf=_0x8c8bdf||0x1f4;return function(_0x37b3db){logger[_0x514f('0x25')](_0x37b3db[_0x514f('0x26')]);if(_0x37b3db[_0x514f('0x27')]){delete _0x37b3db[_0x514f('0x27')];}_0x5f2da2[_0x514f('0x19')](_0x8c8bdf)[_0x514f('0x28')](_0x37b3db);};}exports[_0x514f('0x29')]=function(_0x594a50,_0x2c4c4b){var _0x488c17={},_0x2b43e0={},_0x51beda={'count':0x0,'rows':[]};var _0x40ac5e=_[_0x514f('0x2a')](db[_0x514f('0x2b')][_0x514f('0x2c')],function(_0xdc0bcc){return{'name':_0xdc0bcc['fieldName'],'type':_0xdc0bcc['type'][_0x514f('0x2d')]};});_0x2b43e0['model']=_[_0x514f('0x2a')](_0x40ac5e,_0x514f('0x27'));_0x2b43e0[_0x514f('0x2e')]=_[_0x514f('0x2f')](_0x594a50[_0x514f('0x2e')]);_0x2b43e0['filters']=_['intersection'](_0x2b43e0['model'],_0x2b43e0[_0x514f('0x2e')]);_0x488c17[_0x514f('0x30')]=_[_0x514f('0x31')](_0x2b43e0[_0x514f('0x32')],qs[_0x514f('0x33')](_0x594a50[_0x514f('0x2e')][_0x514f('0x33')]));_0x488c17[_0x514f('0x30')]=_0x488c17[_0x514f('0x30')][_0x514f('0x34')]?_0x488c17['attributes']:_0x2b43e0['model'];if(!_0x594a50['query'][_0x514f('0x35')]('nolimit')){_0x488c17[_0x514f('0x36')]=qs['limit'](_0x594a50[_0x514f('0x2e')]['limit']);_0x488c17['offset']=qs[_0x514f('0x1e')](_0x594a50['query'][_0x514f('0x1e')]);}_0x488c17[_0x514f('0x37')]=qs[_0x514f('0x38')](_0x594a50[_0x514f('0x2e')][_0x514f('0x38')]);_0x488c17['where']=qs[_0x514f('0x39')](_[_0x514f('0x3a')](_0x594a50[_0x514f('0x2e')],_0x2b43e0[_0x514f('0x39')]),_0x40ac5e);if(_0x594a50['query'][_0x514f('0x3b')]){_0x488c17[_0x514f('0x3c')]=_[_0x514f('0x3d')](_0x488c17[_0x514f('0x3c')],{'$or':_['map'](_0x40ac5e,function(_0x1c1a24){if(_0x1c1a24[_0x514f('0x3e')]!==_0x514f('0x3f')){var _0x281d39={};_0x281d39[_0x1c1a24['name']]={'$like':'%'+_0x594a50[_0x514f('0x2e')]['filter']+'%'};return _0x281d39;}})});}_0x488c17=_[_0x514f('0x3d')]({},_0x488c17,_0x594a50[_0x514f('0x40')]);var _0x18969b={'where':_0x488c17['where']};return db['JscriptyAnswerReport'][_0x514f('0x1d')](_0x18969b)['then'](function(_0x10259a){_0x51beda[_0x514f('0x1d')]=_0x10259a;if(_0x594a50[_0x514f('0x2e')][_0x514f('0x41')]){_0x488c17[_0x514f('0x42')]=[{'all':!![]}];}return db[_0x514f('0x2b')][_0x514f('0x43')](_0x488c17);})['then'](function(_0x48914e){_0x51beda[_0x514f('0x44')]=_0x48914e;return _0x51beda;})['then'](respondWithFilteredResult(_0x2c4c4b,_0x488c17))[_0x514f('0x45')](handleError(_0x2c4c4b,null));};exports[_0x514f('0x46')]=function(_0x48d82a,_0x203af2){var _0x326ea6={'raw':!![],'where':{'id':_0x48d82a[_0x514f('0x47')]['id']}},_0x51e50b={};_0x51e50b['model']=_['keys'](db[_0x514f('0x2b')][_0x514f('0x2c')]);_0x51e50b[_0x514f('0x2e')]=_[_0x514f('0x2f')](_0x48d82a[_0x514f('0x2e')]);_0x51e50b['filters']=_['intersection'](_0x51e50b[_0x514f('0x32')],_0x51e50b[_0x514f('0x2e')]);_0x326ea6[_0x514f('0x30')]=_[_0x514f('0x31')](_0x51e50b[_0x514f('0x32')],qs['fields'](_0x48d82a[_0x514f('0x2e')]['fields']));_0x326ea6['attributes']=_0x326ea6[_0x514f('0x30')]['length']?_0x326ea6[_0x514f('0x30')]:_0x51e50b['model'];if(_0x48d82a['query'][_0x514f('0x41')]){_0x326ea6[_0x514f('0x42')]=[{'all':!![]}];}_0x326ea6=_['merge']({},_0x326ea6,_0x48d82a['options']);return db[_0x514f('0x2b')][_0x514f('0x48')](_0x326ea6)[_0x514f('0x24')](handleEntityNotFound(_0x203af2,null))[_0x514f('0x24')](respondWithResult(_0x203af2,null))[_0x514f('0x45')](handleError(_0x203af2,null));};exports[_0x514f('0x49')]=function(_0xa5259e,_0x1b33b2){return db[_0x514f('0x2b')]['create'](_0xa5259e[_0x514f('0x4a')],{})[_0x514f('0x24')](respondWithResult(_0x1b33b2,0xc9))[_0x514f('0x45')](handleError(_0x1b33b2,null));};exports[_0x514f('0x22')]=function(_0x33b658,_0x2e6971){if(_0x33b658[_0x514f('0x4a')]['id']){delete _0x33b658['body']['id'];}return db[_0x514f('0x2b')]['find']({'where':{'id':_0x33b658[_0x514f('0x47')]['id']}})[_0x514f('0x24')](handleEntityNotFound(_0x2e6971,null))[_0x514f('0x24')](saveUpdates(_0x33b658[_0x514f('0x4a')],null))[_0x514f('0x24')](respondWithResult(_0x2e6971,null))['catch'](handleError(_0x2e6971,null));};exports['destroy']=function(_0x38e237,_0x5e6e97){return db[_0x514f('0x2b')]['find']({'where':{'id':_0x38e237[_0x514f('0x47')]['id']}})[_0x514f('0x24')](handleEntityNotFound(_0x5e6e97,null))[_0x514f('0x24')](removeEntity(_0x5e6e97,null))['catch'](handleError(_0x5e6e97,null));};exports[_0x514f('0x4b')]=function(_0x41cb02,_0x2171e9){return db['JscriptyAnswerReport'][_0x514f('0x4b')]()[_0x514f('0x24')](respondWithResult(_0x2171e9,null))['catch'](handleError(_0x2171e9,null));}; \ No newline at end of file +var _0x1354=['moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyAnswerReport','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x29a3a8,_0x1c537f){var _0x2ed8cb=function(_0x46a9de){while(--_0x46a9de){_0x29a3a8['push'](_0x29a3a8['shift']());}};_0x2ed8cb(++_0x1c537f);}(_0x1354,0x95));var _0x4135=function(_0x20ea26,_0x5512f8){_0x20ea26=_0x20ea26-0x0;var _0xcbc4d7=_0x1354[_0x20ea26];return _0xcbc4d7;};'use strict';var emlformat=require(_0x4135('0x0'));var rimraf=require(_0x4135('0x1'));var zipdir=require(_0x4135('0x2'));var jsonpatch=require(_0x4135('0x3'));var rp=require(_0x4135('0x4'));var moment=require(_0x4135('0x5'));var BPromise=require(_0x4135('0x6'));var Mustache=require('mustache');var util=require(_0x4135('0x7'));var path=require(_0x4135('0x8'));var sox=require(_0x4135('0x9'));var csv=require('to-csv');var ejs=require(_0x4135('0xa'));var fs=require('fs');var fs_extra=require(_0x4135('0xb'));var _=require('lodash');var squel=require(_0x4135('0xc'));var crypto=require(_0x4135('0xd'));var jsforce=require(_0x4135('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4135('0xf'));var querystring=require('querystring');var Papa=require(_0x4135('0x10'));var Redis=require(_0x4135('0x11'));var authService=require(_0x4135('0x12'));var qs=require(_0x4135('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4135('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4135('0x15'));var config=require(_0x4135('0x16'));var licenseUtil=require(_0x4135('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x307e6f,_0x838d6f){_0x838d6f=_0x838d6f||0xcc;return function(_0xb825cb){if(_0xb825cb){return _0x307e6f[_0x4135('0x18')](_0x838d6f);}return _0x307e6f[_0x4135('0x19')](_0x838d6f)[_0x4135('0x1a')]();};}function respondWithResult(_0x54f954,_0x50dd01){_0x50dd01=_0x50dd01||0xc8;return function(_0x249c86){if(_0x249c86){return _0x54f954[_0x4135('0x19')](_0x50dd01)[_0x4135('0x1b')](_0x249c86);}};}function respondWithFilteredResult(_0x17179a,_0x4b7609){return function(_0x34fd82){if(_0x34fd82){var _0x2e8733=typeof _0x4b7609['offset']==='undefined'&&typeof _0x4b7609[_0x4135('0x1c')]==='undefined';var _0x2f2600=_0x34fd82['count'];var _0x53f54e=_0x2e8733?0x0:_0x4b7609['offset'];var _0x53f5a7=_0x2e8733?_0x34fd82[_0x4135('0x1d')]:_0x4b7609['offset']+_0x4b7609[_0x4135('0x1c')];var _0xf81757;if(_0x53f5a7>=_0x2f2600){_0x53f5a7=_0x2f2600;_0xf81757=0xc8;}else{_0xf81757=0xce;}_0x17179a[_0x4135('0x19')](_0xf81757);return _0x17179a['set'](_0x4135('0x1e'),_0x53f54e+'-'+_0x53f5a7+'/'+_0x2f2600)[_0x4135('0x1b')](_0x34fd82);}return null;};}function patchUpdates(_0x398294){return function(_0x485395){try{jsonpatch[_0x4135('0x1f')](_0x485395,_0x398294,!![]);}catch(_0x58bdb1){return BPromise[_0x4135('0x20')](_0x58bdb1);}return _0x485395[_0x4135('0x21')]();};}function saveUpdates(_0x314f11,_0x188707){return function(_0x5a3777){if(_0x5a3777){return _0x5a3777[_0x4135('0x22')](_0x314f11)[_0x4135('0x23')](function(_0x32dcf6){return _0x32dcf6;});}return null;};}function removeEntity(_0x3912e9,_0x83a794){return function(_0x2c604b){if(_0x2c604b){return _0x2c604b[_0x4135('0x24')]()[_0x4135('0x23')](function(){_0x3912e9[_0x4135('0x19')](0xcc)[_0x4135('0x1a')]();});}};}function handleEntityNotFound(_0x12a9fd,_0x192126){return function(_0x212228){if(!_0x212228){_0x12a9fd[_0x4135('0x18')](0x194);}return _0x212228;};}function handleError(_0x4b448f,_0x1a3d30){_0x1a3d30=_0x1a3d30||0x1f4;return function(_0x3e40bc){logger[_0x4135('0x25')](_0x3e40bc[_0x4135('0x26')]);if(_0x3e40bc[_0x4135('0x27')]){delete _0x3e40bc[_0x4135('0x27')];}_0x4b448f['status'](_0x1a3d30)[_0x4135('0x28')](_0x3e40bc);};}exports[_0x4135('0x29')]=function(_0x31b508,_0x2c06d0){var _0x284121={},_0x511fce={},_0x411ee0={'count':0x0,'rows':[]};var _0x381e86=_['map'](db[_0x4135('0x2a')]['rawAttributes'],function(_0x2438d2){return{'name':_0x2438d2[_0x4135('0x2b')],'type':_0x2438d2[_0x4135('0x2c')][_0x4135('0x2d')]};});_0x511fce['model']=_[_0x4135('0x2e')](_0x381e86,_0x4135('0x27'));_0x511fce[_0x4135('0x2f')]=_[_0x4135('0x30')](_0x31b508[_0x4135('0x2f')]);_0x511fce[_0x4135('0x31')]=_['intersection'](_0x511fce[_0x4135('0x32')],_0x511fce[_0x4135('0x2f')]);_0x284121['attributes']=_[_0x4135('0x33')](_0x511fce['model'],qs[_0x4135('0x34')](_0x31b508[_0x4135('0x2f')]['fields']));_0x284121['attributes']=_0x284121[_0x4135('0x35')][_0x4135('0x36')]?_0x284121[_0x4135('0x35')]:_0x511fce['model'];if(!_0x31b508[_0x4135('0x2f')][_0x4135('0x37')](_0x4135('0x38'))){_0x284121['limit']=qs[_0x4135('0x1c')](_0x31b508[_0x4135('0x2f')]['limit']);_0x284121[_0x4135('0x39')]=qs[_0x4135('0x39')](_0x31b508['query'][_0x4135('0x39')]);}_0x284121['order']=qs[_0x4135('0x3a')](_0x31b508[_0x4135('0x2f')][_0x4135('0x3a')]);_0x284121[_0x4135('0x3b')]=qs[_0x4135('0x31')](_[_0x4135('0x3c')](_0x31b508['query'],_0x511fce[_0x4135('0x31')]),_0x381e86);if(_0x31b508[_0x4135('0x2f')]['filter']){_0x284121[_0x4135('0x3b')]=_['merge'](_0x284121[_0x4135('0x3b')],{'$or':_[_0x4135('0x2e')](_0x381e86,function(_0x14f353){if(_0x14f353[_0x4135('0x2c')]!==_0x4135('0x3d')){var _0x41ce9e={};_0x41ce9e[_0x14f353[_0x4135('0x27')]]={'$like':'%'+_0x31b508[_0x4135('0x2f')][_0x4135('0x3e')]+'%'};return _0x41ce9e;}})});}_0x284121=_[_0x4135('0x3f')]({},_0x284121,_0x31b508[_0x4135('0x40')]);var _0x53689f={'where':_0x284121['where']};return db[_0x4135('0x2a')][_0x4135('0x1d')](_0x53689f)[_0x4135('0x23')](function(_0x2dfd11){_0x411ee0[_0x4135('0x1d')]=_0x2dfd11;if(_0x31b508['query'][_0x4135('0x41')]){_0x284121[_0x4135('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x4135('0x43')](_0x284121);})[_0x4135('0x23')](function(_0x1ddad4){_0x411ee0[_0x4135('0x44')]=_0x1ddad4;return _0x411ee0;})['then'](respondWithFilteredResult(_0x2c06d0,_0x284121))['catch'](handleError(_0x2c06d0,null));};exports[_0x4135('0x45')]=function(_0x58c6e1,_0x166ecb){var _0x5894fb={'raw':!![],'where':{'id':_0x58c6e1['params']['id']}},_0x25d1c4={};_0x25d1c4[_0x4135('0x32')]=_['keys'](db[_0x4135('0x2a')][_0x4135('0x46')]);_0x25d1c4[_0x4135('0x2f')]=_['keys'](_0x58c6e1[_0x4135('0x2f')]);_0x25d1c4[_0x4135('0x31')]=_[_0x4135('0x33')](_0x25d1c4[_0x4135('0x32')],_0x25d1c4[_0x4135('0x2f')]);_0x5894fb[_0x4135('0x35')]=_[_0x4135('0x33')](_0x25d1c4[_0x4135('0x32')],qs[_0x4135('0x34')](_0x58c6e1[_0x4135('0x2f')]['fields']));_0x5894fb[_0x4135('0x35')]=_0x5894fb[_0x4135('0x35')][_0x4135('0x36')]?_0x5894fb[_0x4135('0x35')]:_0x25d1c4[_0x4135('0x32')];if(_0x58c6e1['query'][_0x4135('0x41')]){_0x5894fb['include']=[{'all':!![]}];}_0x5894fb=_['merge']({},_0x5894fb,_0x58c6e1[_0x4135('0x40')]);return db[_0x4135('0x2a')][_0x4135('0x47')](_0x5894fb)[_0x4135('0x23')](handleEntityNotFound(_0x166ecb,null))[_0x4135('0x23')](respondWithResult(_0x166ecb,null))[_0x4135('0x48')](handleError(_0x166ecb,null));};exports[_0x4135('0x49')]=function(_0x18aed5,_0x13f1f1){return db[_0x4135('0x2a')][_0x4135('0x49')](_0x18aed5[_0x4135('0x4a')],{})[_0x4135('0x23')](respondWithResult(_0x13f1f1,0xc9))[_0x4135('0x48')](handleError(_0x13f1f1,null));};exports[_0x4135('0x22')]=function(_0x74a924,_0x540029){if(_0x74a924[_0x4135('0x4a')]['id']){delete _0x74a924['body']['id'];}return db[_0x4135('0x2a')][_0x4135('0x47')]({'where':{'id':_0x74a924[_0x4135('0x4b')]['id']}})[_0x4135('0x23')](handleEntityNotFound(_0x540029,null))[_0x4135('0x23')](saveUpdates(_0x74a924[_0x4135('0x4a')],null))[_0x4135('0x23')](respondWithResult(_0x540029,null))['catch'](handleError(_0x540029,null));};exports['destroy']=function(_0x1b98e8,_0x5b6255){return db[_0x4135('0x2a')][_0x4135('0x47')]({'where':{'id':_0x1b98e8[_0x4135('0x4b')]['id']}})[_0x4135('0x23')](handleEntityNotFound(_0x5b6255,null))[_0x4135('0x23')](removeEntity(_0x5b6255,null))[_0x4135('0x48')](handleError(_0x5b6255,null));};exports['describe']=function(_0x1c4049,_0x31c532){return db[_0x4135('0x2a')][_0x4135('0x4c')]()[_0x4135('0x23')](respondWithResult(_0x31c532,null))[_0x4135('0x48')](handleError(_0x31c532,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index d455dff..8556046 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 _0x41f5=['report_jscripty_answers','lodash','util','../../config/logger','moment','request-promise','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x41f5,0x105));var _0x541f=function(_0x42b3e3,_0x3e2593){_0x42b3e3=_0x42b3e3-0x0;var _0x622dcb=_0x41f5[_0x42b3e3];return _0x622dcb;};'use strict';var _=require(_0x541f('0x0'));var util=require(_0x541f('0x1'));var logger=require(_0x541f('0x2'))('api');var moment=require(_0x541f('0x3'));var BPromise=require('bluebird');var rp=require(_0x541f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x541f('0x5'));module[_0x541f('0x6')]=function(_0x19a02a,_0x5e80de){return _0x19a02a[_0x541f('0x7')](_0x541f('0x8'),attributes,{'tableName':_0x541f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x706e=['request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','../../config/logger','api','moment','bluebird'];(function(_0x1b944d,_0x14ac0f){var _0x1caddc=function(_0x3290b3){while(--_0x3290b3){_0x1b944d['push'](_0x1b944d['shift']());}};_0x1caddc(++_0x14ac0f);}(_0x706e,0x110));var _0xe706=function(_0x57b4f4,_0x1dc78b){_0x57b4f4=_0x57b4f4-0x0;var _0x3ba116=_0x706e[_0x57b4f4];return _0x3ba116;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe706('0x0'))(_0xe706('0x1'));var moment=require(_0xe706('0x2'));var BPromise=require(_0xe706('0x3'));var rp=require(_0xe706('0x4'));var fs=require('fs');var path=require(_0xe706('0x5'));var rimraf=require(_0xe706('0x6'));var config=require(_0xe706('0x7'));var attributes=require(_0xe706('0x8'));module[_0xe706('0x9')]=function(_0x496a01,_0x2e6268){return _0x496a01[_0xe706('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0xe706('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 26ab803..eff391a 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 _0xd5f0=['info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x248256,_0x56c3bf){var _0x28bd95=function(_0xb173b3){while(--_0xb173b3){_0x248256['push'](_0x248256['shift']());}};_0x28bd95(++_0x56c3bf);}(_0xd5f0,0x87));var _0x0d5f=function(_0x545ffc,_0x37aeb8){_0x545ffc=_0x545ffc-0x0;var _0x557cae=_0xd5f0[_0x545ffc];return _0x557cae;};'use strict';var _=require(_0x0d5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0d5f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0d5f('0x2'));var logger=require(_0x0d5f('0x3'))('rpc');var config=require(_0x0d5f('0x4'));var jayson=require(_0x0d5f('0x5'));var client=jayson[_0x0d5f('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x66b10d,_0x5dee96,_0x2d9680){return new BPromise(function(_0x580d03,_0x3cec8){return client[_0x0d5f('0x7')](_0x66b10d,_0x2d9680)[_0x0d5f('0x8')](function(_0x9903c7){logger[_0x0d5f('0x9')](_0x0d5f('0xa'),_0x5dee96,_0x0d5f('0xb'));logger['debug'](_0x0d5f('0xc'),_0x5dee96,'request\x20sent',JSON[_0x0d5f('0xd')](_0x9903c7));if(_0x9903c7[_0x0d5f('0xe')]){if(_0x9903c7[_0x0d5f('0xe')][_0x0d5f('0xf')]===0x1f4){logger[_0x0d5f('0xe')](_0x0d5f('0xa'),_0x5dee96,_0x9903c7[_0x0d5f('0xe')][_0x0d5f('0x10')]);return _0x3cec8(_0x9903c7[_0x0d5f('0xe')][_0x0d5f('0x10')]);}logger[_0x0d5f('0xe')](_0x0d5f('0xa'),_0x5dee96,_0x9903c7['error'][_0x0d5f('0x10')]);return _0x580d03(_0x9903c7[_0x0d5f('0xe')][_0x0d5f('0x10')]);}else{logger['info'](_0x0d5f('0xa'),_0x5dee96,_0x0d5f('0xb'));_0x580d03(_0x9903c7['result'][_0x0d5f('0x10')]);}})[_0x0d5f('0x11')](function(_0x39b8c4){logger[_0x0d5f('0xe')](_0x0d5f('0xa'),_0x5dee96,_0x39b8c4);_0x3cec8(_0x39b8c4);});});} \ No newline at end of file +var _0xf03a=['JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf03a,0xce));var _0xaf03=function(_0x533c62,_0x500760){_0x533c62=_0x533c62-0x0;var _0x17050e=_0xf03a[_0x533c62];return _0x17050e;};'use strict';var _=require(_0xaf03('0x0'));var util=require(_0xaf03('0x1'));var moment=require(_0xaf03('0x2'));var BPromise=require(_0xaf03('0x3'));var rs=require(_0xaf03('0x4'));var fs=require('fs');var Redis=require(_0xaf03('0x5'));var db=require(_0xaf03('0x6'))['db'];var utils=require(_0xaf03('0x7'));var logger=require(_0xaf03('0x8'))('rpc');var config=require(_0xaf03('0x9'));var jayson=require(_0xaf03('0xa'));var client=jayson[_0xaf03('0xb')][_0xaf03('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43ccd9,_0x3275a5,_0x45f6f7){return new BPromise(function(_0x4dd32b,_0x1a2bdb){return client['request'](_0x43ccd9,_0x45f6f7)['then'](function(_0x1b5dcc){logger[_0xaf03('0xd')](_0xaf03('0xe'),_0x3275a5,_0xaf03('0xf'));logger['debug'](_0xaf03('0x10'),_0x3275a5,'request\x20sent',JSON[_0xaf03('0x11')](_0x1b5dcc));if(_0x1b5dcc[_0xaf03('0x12')]){if(_0x1b5dcc[_0xaf03('0x12')]['code']===0x1f4){logger[_0xaf03('0x12')](_0xaf03('0xe'),_0x3275a5,_0x1b5dcc[_0xaf03('0x12')][_0xaf03('0x13')]);return _0x1a2bdb(_0x1b5dcc['error'][_0xaf03('0x13')]);}logger[_0xaf03('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3275a5,_0x1b5dcc['error'][_0xaf03('0x13')]);return _0x4dd32b(_0x1b5dcc['error'][_0xaf03('0x13')]);}else{logger[_0xaf03('0xd')](_0xaf03('0xe'),_0x3275a5,_0xaf03('0xf'));_0x4dd32b(_0x1b5dcc[_0xaf03('0x14')][_0xaf03('0x13')]);}})[_0xaf03('0x15')](function(_0x22ddec){logger[_0xaf03('0x12')](_0xaf03('0xe'),_0x3275a5,_0x22ddec);_0x1a2bdb(_0x22ddec);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 903a7ee..ce5b3c5 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 _0x4ceb=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','create','/:id/clone','clone','put','delete','destroy','util','path','connect-timeout','express'];(function(_0x50ff51,_0x32a7f8){var _0x4fe0de=function(_0x51a448){while(--_0x51a448){_0x50ff51['push'](_0x50ff51['shift']());}};_0x4fe0de(++_0x32a7f8);}(_0x4ceb,0x104));var _0xb4ce=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x4ceb[_0x1f9f37];return _0x21c080;};'use strict';var multer=require('multer');var util=require(_0xb4ce('0x0'));var path=require(_0xb4ce('0x1'));var timeout=require(_0xb4ce('0x2'));var express=require(_0xb4ce('0x3'));var router=express[_0xb4ce('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb4ce('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb4ce('0x6'));var controller=require('./jscriptyProject.controller');router[_0xb4ce('0x7')]('/',auth[_0xb4ce('0x8')](),controller[_0xb4ce('0x9')]);router[_0xb4ce('0x7')](_0xb4ce('0xa'),auth[_0xb4ce('0x8')](),controller[_0xb4ce('0xb')]);router['get'](_0xb4ce('0xc'),auth[_0xb4ce('0x8')](),controller[_0xb4ce('0xd')]);router[_0xb4ce('0x7')](_0xb4ce('0xe'),auth[_0xb4ce('0x8')](),controller[_0xb4ce('0xf')]);router[_0xb4ce('0x7')]('/:id/summary',auth[_0xb4ce('0x8')](),timeout(_0xb4ce('0x10')),controller[_0xb4ce('0x11')]);router['post']('/',auth[_0xb4ce('0x8')](),controller[_0xb4ce('0x12')]);router['post'](_0xb4ce('0x13'),auth[_0xb4ce('0x8')](),controller[_0xb4ce('0x14')]);router[_0xb4ce('0x15')](_0xb4ce('0xa'),auth[_0xb4ce('0x8')](),controller['update']);router[_0xb4ce('0x16')](_0xb4ce('0xa'),auth[_0xb4ce('0x8')](),controller[_0xb4ce('0x17')]);module['exports']=router; \ No newline at end of file +var _0x76dd=['put','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/summary','30s','getSummary','post','create','/:id/clone','clone'];(function(_0x1fa709,_0x585623){var _0x130ba1=function(_0x51cec3){while(--_0x51cec3){_0x1fa709['push'](_0x1fa709['shift']());}};_0x130ba1(++_0x585623);}(_0x76dd,0xdf));var _0xd76d=function(_0x5ba3d5,_0x3faf71){_0x5ba3d5=_0x5ba3d5-0x0;var _0xa952a9=_0x76dd[_0x5ba3d5];return _0xa952a9;};'use strict';var multer=require('multer');var util=require(_0xd76d('0x0'));var path=require('path');var timeout=require(_0xd76d('0x1'));var express=require('express');var router=express[_0xd76d('0x2')]();var fs_extra=require(_0xd76d('0x3'));var auth=require(_0xd76d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router[_0xd76d('0x5')]('/',auth['isAuthenticated'](),controller[_0xd76d('0x6')]);router[_0xd76d('0x5')](_0xd76d('0x7'),auth[_0xd76d('0x8')](),controller[_0xd76d('0x9')]);router['get'](_0xd76d('0xa'),auth[_0xd76d('0x8')](),controller[_0xd76d('0xb')]);router['get']('/:id/answers',auth[_0xd76d('0x8')](),controller['getAnswers']);router[_0xd76d('0x5')](_0xd76d('0xc'),auth['isAuthenticated'](),timeout(_0xd76d('0xd')),controller[_0xd76d('0xe')]);router[_0xd76d('0xf')]('/',auth[_0xd76d('0x8')](),controller[_0xd76d('0x10')]);router[_0xd76d('0xf')](_0xd76d('0x11'),auth['isAuthenticated'](),controller[_0xd76d('0x12')]);router[_0xd76d('0x13')](_0xd76d('0x7'),auth[_0xd76d('0x8')](),controller['update']);router[_0xd76d('0x14')]('/:id',auth[_0xd76d('0x8')](),controller['destroy']);module[_0xd76d('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index e69ba96..facb9ff 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 _0x59fd=['TEXT','long','isObjectLike','formData','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','util','exports','STRING'];(function(_0x364f11,_0x2ce5d0){var _0x1453f8=function(_0x528e06){while(--_0x528e06){_0x364f11['push'](_0x364f11['shift']());}};_0x1453f8(++_0x2ce5d0);}(_0x59fd,0x65));var _0xd59f=function(_0x19403b,_0x38ce14){_0x19403b=_0x19403b-0x0;var _0x4f246c=_0x59fd[_0x19403b];return _0x4f246c;};'use strict';var Sequelize=require(_0xd59f('0x0'));var _=require('lodash');var util=require(_0xd59f('0x1'));module[_0xd59f('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xd59f('0x3')]},'formData':{'type':Sequelize[_0xd59f('0x4')](_0xd59f('0x5')),'set':function(_0x19aaa3){if(_[_0xd59f('0x6')](_0x19aaa3)){this['setDataValue'](_0xd59f('0x7'),JSON['stringify'](_0x19aaa3));}else if(_[_0xd59f('0x8')](_0x19aaa3)){this[_0xd59f('0x9')]('formData',_0x19aaa3);}else{this[_0xd59f('0x9')](_0xd59f('0x7'),util[_0xd59f('0xa')](_0xd59f('0xb'),this[_0xd59f('0xc')]('name')||'',this[_0xd59f('0xc')](_0xd59f('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd59f('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd59f('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xca2a=['name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format','getDataValue','description','BOOLEAN','lodash','util','STRING'];(function(_0x4079e1,_0xeba708){var _0x14c475=function(_0x5ab4f2){while(--_0x5ab4f2){_0x4079e1['push'](_0x4079e1['shift']());}};_0x14c475(++_0xeba708);}(_0xca2a,0x1ce));var _0xaca2=function(_0x1ba263,_0x40c06b){_0x1ba263=_0x1ba263-0x0;var _0x3ac43a=_0xca2a[_0x1ba263];return _0x3ac43a;};'use strict';var Sequelize=require('sequelize');var _=require(_0xaca2('0x0'));var util=require(_0xaca2('0x1'));module['exports']={'name':{'type':Sequelize[_0xaca2('0x2')],'unique':_0xaca2('0x3')},'description':{'type':Sequelize[_0xaca2('0x2')]},'formData':{'type':Sequelize[_0xaca2('0x4')](_0xaca2('0x5')),'set':function(_0x21d88c){if(_[_0xaca2('0x6')](_0x21d88c)){this[_0xaca2('0x7')]('formData',JSON[_0xaca2('0x8')](_0x21d88c));}else if(_[_0xaca2('0x9')](_0x21d88c)){this[_0xaca2('0x7')](_0xaca2('0xa'),_0x21d88c);}else{this[_0xaca2('0x7')](_0xaca2('0xa'),util[_0xaca2('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xaca2('0xc')](_0xaca2('0x3'))||'',this['getDataValue'](_0xaca2('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xaca2('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xaca2('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index ff4fa02..ef9cccc 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 _0xb5fb=['-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','then','Projects','UserProfileResource','destroy','end','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','JscriptyProject','includeAll','include','findAll','rows','catch','show','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','body','omit','updatedAt','role','UserProfileSection','userProfileId','update','params','getSessions','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','ProjectId','fromCharCode','toString','indexOf','replace','getSummary','starttime','startTime'];(function(_0x338442,_0x327f9d){var _0x3f96b6=function(_0x3cc8dc){while(--_0x3cc8dc){_0x338442['push'](_0x338442['shift']());}};_0x3f96b6(++_0x327f9d);}(_0xb5fb,0x172));var _0xbb5f=function(_0x2484be,_0x12368d){_0x2484be=_0x2484be-0x0;var _0x2953f1=_0xb5fb[_0x2484be];return _0x2953f1;};'use strict';var emlformat=require(_0xbb5f('0x0'));var rimraf=require(_0xbb5f('0x1'));var zipdir=require(_0xbb5f('0x2'));var jsonpatch=require(_0xbb5f('0x3'));var rp=require(_0xbb5f('0x4'));var moment=require(_0xbb5f('0x5'));var BPromise=require(_0xbb5f('0x6'));var Mustache=require(_0xbb5f('0x7'));var util=require(_0xbb5f('0x8'));var path=require(_0xbb5f('0x9'));var sox=require(_0xbb5f('0xa'));var csv=require(_0xbb5f('0xb'));var ejs=require(_0xbb5f('0xc'));var fs=require('fs');var fs_extra=require(_0xbb5f('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbb5f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbb5f('0xf'));var toCsv=require(_0xbb5f('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbb5f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb5f('0x11'));var as=require(_0xbb5f('0x12'));var hardwareService=require(_0xbb5f('0x13'));var logger=require(_0xbb5f('0x14'))(_0xbb5f('0x15'));var utils=require(_0xbb5f('0x16'));var config=require(_0xbb5f('0x17'));var licenseUtil=require(_0xbb5f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb6c375,_0x5754e0){_0x5754e0=_0x5754e0||0xcc;return function(_0xc0e15a){if(_0xc0e15a){return _0xb6c375[_0xbb5f('0x19')](_0x5754e0);}return _0xb6c375[_0xbb5f('0x1a')](_0x5754e0)['end']();};}function respondWithResult(_0x4315ba,_0xb68b5){_0xb68b5=_0xb68b5||0xc8;return function(_0x5db765){if(_0x5db765){return _0x4315ba[_0xbb5f('0x1a')](_0xb68b5)[_0xbb5f('0x1b')](_0x5db765);}};}function respondWithFilteredResult(_0x3078a8,_0x4085a1){return function(_0x59d9e0){if(_0x59d9e0){var _0x5cf99d=typeof _0x4085a1[_0xbb5f('0x1c')]==='undefined'&&typeof _0x4085a1[_0xbb5f('0x1d')]===_0xbb5f('0x1e');var _0x4efe3a=_0x59d9e0[_0xbb5f('0x1f')];var _0x4cc050=_0x5cf99d?0x0:_0x4085a1[_0xbb5f('0x1c')];var _0xca33c1=_0x5cf99d?_0x59d9e0[_0xbb5f('0x1f')]:_0x4085a1['offset']+_0x4085a1[_0xbb5f('0x1d')];var _0x82ce7e;if(_0xca33c1>=_0x4efe3a){_0xca33c1=_0x4efe3a;_0x82ce7e=0xc8;}else{_0x82ce7e=0xce;}_0x3078a8[_0xbb5f('0x1a')](_0x82ce7e);return _0x3078a8['set'](_0xbb5f('0x20'),_0x4cc050+'-'+_0xca33c1+'/'+_0x4efe3a)['json'](_0x59d9e0);}return null;};}function patchUpdates(_0x7ebb8e){return function(_0x63f1ad){try{jsonpatch[_0xbb5f('0x21')](_0x63f1ad,_0x7ebb8e,!![]);}catch(_0x5533c3){return BPromise[_0xbb5f('0x22')](_0x5533c3);}return _0x63f1ad['save']();};}function saveUpdates(_0x2127d7,_0x540b43){return function(_0x33633f){if(_0x33633f){return _0x33633f['update'](_0x2127d7)[_0xbb5f('0x23')](function(_0x488886){return _0x488886;});}return null;};}function removeEntity(_0x3f5f92,_0xb35efe){return function(_0x1649b8){if(_0x1649b8){return _0x1649b8['destroy']()[_0xbb5f('0x23')](function(){var _0x4de835=_0x1649b8['get']({'plain':!![]});var _0x41be1c=_0xbb5f('0x24');return db[_0xbb5f('0x25')][_0xbb5f('0x26')]({'where':{'type':_0x41be1c,'resourceId':_0x4de835['id']}})[_0xbb5f('0x23')](function(){return _0x1649b8;});})[_0xbb5f('0x23')](function(){_0x3f5f92[_0xbb5f('0x1a')](0xcc)[_0xbb5f('0x27')]();});}};}function handleEntityNotFound(_0x16f5bc,_0x229757){return function(_0xa87ebb){if(!_0xa87ebb){_0x16f5bc[_0xbb5f('0x19')](0x194);}return _0xa87ebb;};}function handleError(_0x187477,_0x26fd51){_0x26fd51=_0x26fd51||0x1f4;return function(_0x14566f){logger[_0xbb5f('0x28')](_0x14566f['stack']);if(_0x14566f['name']){delete _0x14566f[_0xbb5f('0x29')];}_0x187477[_0xbb5f('0x1a')](_0x26fd51)['send'](_0x14566f);};}exports[_0xbb5f('0x2a')]=function(_0x56ca55,_0x3ea574){var _0x30641a={},_0xa2adf2={},_0x24e8c2={'count':0x0,'rows':[]};var _0x22d528=_[_0xbb5f('0x2b')](db['JscriptyProject'][_0xbb5f('0x2c')],function(_0x3c720b){return{'name':_0x3c720b[_0xbb5f('0x2d')],'type':_0x3c720b[_0xbb5f('0x2e')][_0xbb5f('0x2f')]};});_0xa2adf2[_0xbb5f('0x30')]=_[_0xbb5f('0x2b')](_0x22d528,_0xbb5f('0x29'));_0xa2adf2[_0xbb5f('0x31')]=_[_0xbb5f('0x32')](_0x56ca55[_0xbb5f('0x31')]);_0xa2adf2[_0xbb5f('0x33')]=_['intersection'](_0xa2adf2[_0xbb5f('0x30')],_0xa2adf2[_0xbb5f('0x31')]);_0x30641a['attributes']=_[_0xbb5f('0x34')](_0xa2adf2['model'],qs[_0xbb5f('0x35')](_0x56ca55['query']['fields']));_0x30641a[_0xbb5f('0x36')]=_0x30641a[_0xbb5f('0x36')][_0xbb5f('0x37')]?_0x30641a[_0xbb5f('0x36')]:_0xa2adf2[_0xbb5f('0x30')];if(!_0x56ca55[_0xbb5f('0x31')][_0xbb5f('0x38')](_0xbb5f('0x39'))){_0x30641a[_0xbb5f('0x1d')]=qs[_0xbb5f('0x1d')](_0x56ca55[_0xbb5f('0x31')][_0xbb5f('0x1d')]);_0x30641a[_0xbb5f('0x1c')]=qs['offset'](_0x56ca55[_0xbb5f('0x31')][_0xbb5f('0x1c')]);}_0x30641a[_0xbb5f('0x3a')]=qs[_0xbb5f('0x3b')](_0x56ca55['query'][_0xbb5f('0x3b')]);_0x30641a['where']=qs[_0xbb5f('0x33')](_[_0xbb5f('0x3c')](_0x56ca55[_0xbb5f('0x31')],_0xa2adf2[_0xbb5f('0x33')]),_0x22d528);if(_0x56ca55[_0xbb5f('0x31')][_0xbb5f('0x3d')]){_0x30641a['where']=_[_0xbb5f('0x3e')](_0x30641a[_0xbb5f('0x3f')],{'$or':_[_0xbb5f('0x2b')](_0x22d528,function(_0x20f0ad){if(_0x20f0ad['type']!=='VIRTUAL'){var _0x5dc398={};_0x5dc398[_0x20f0ad[_0xbb5f('0x29')]]={'$like':'%'+_0x56ca55[_0xbb5f('0x31')][_0xbb5f('0x3d')]+'%'};return _0x5dc398;}})});}_0x30641a=_['merge']({},_0x30641a,_0x56ca55[_0xbb5f('0x40')]);var _0x408c84={'where':_0x30641a['where']};return db[_0xbb5f('0x41')][_0xbb5f('0x1f')](_0x408c84)['then'](function(_0x313a67){_0x24e8c2[_0xbb5f('0x1f')]=_0x313a67;if(_0x56ca55[_0xbb5f('0x31')][_0xbb5f('0x42')]){_0x30641a[_0xbb5f('0x43')]=[{'all':!![]}];}return db[_0xbb5f('0x41')][_0xbb5f('0x44')](_0x30641a);})[_0xbb5f('0x23')](function(_0x4a8af4){_0x24e8c2[_0xbb5f('0x45')]=_0x4a8af4;return _0x24e8c2;})[_0xbb5f('0x23')](respondWithFilteredResult(_0x3ea574,_0x30641a))[_0xbb5f('0x46')](handleError(_0x3ea574,null));};exports[_0xbb5f('0x47')]=function(_0x50ebe7,_0x2e0608){var _0x4d8961={'raw':![],'where':{'id':_0x50ebe7['params']['id']}},_0x3c6fee={};_0x3c6fee[_0xbb5f('0x30')]=_[_0xbb5f('0x32')](db[_0xbb5f('0x41')][_0xbb5f('0x2c')]);_0x3c6fee[_0xbb5f('0x31')]=_[_0xbb5f('0x32')](_0x50ebe7['query']);_0x3c6fee[_0xbb5f('0x33')]=_[_0xbb5f('0x34')](_0x3c6fee['model'],_0x3c6fee['query']);_0x4d8961[_0xbb5f('0x36')]=_[_0xbb5f('0x34')](_0x3c6fee['model'],qs[_0xbb5f('0x35')](_0x50ebe7[_0xbb5f('0x31')][_0xbb5f('0x35')]));_0x4d8961['attributes']=_0x4d8961[_0xbb5f('0x36')][_0xbb5f('0x37')]?_0x4d8961[_0xbb5f('0x36')]:_0x3c6fee['model'];if(_0x50ebe7['query'][_0xbb5f('0x42')]){_0x4d8961[_0xbb5f('0x43')]=[{'all':!![]}];}_0x4d8961=_[_0xbb5f('0x3e')]({},_0x4d8961,_0x50ebe7[_0xbb5f('0x40')]);return db['JscriptyProject']['find'](_0x4d8961)[_0xbb5f('0x23')](handleEntityNotFound(_0x2e0608,null))[_0xbb5f('0x23')](respondWithResult(_0x2e0608,null))['catch'](handleError(_0x2e0608,null));};exports[_0xbb5f('0x48')]=function(_0x3f1fe6,_0x5a21cc){return db[_0xbb5f('0x41')][_0xbb5f('0x48')](_0x3f1fe6['body'],{})[_0xbb5f('0x23')](function(_0x144305){var _0x4a062c=_0x3f1fe6['user'][_0xbb5f('0x49')]({'plain':!![]});if(!_0x4a062c)throw new Error(_0xbb5f('0x4a'));if(_0x4a062c['role']===_0xbb5f('0x4b')){var _0x9b1906=_0x144305[_0xbb5f('0x49')]({'plain':!![]});var _0x3fc42d='Projects';return db['UserProfileSection'][_0xbb5f('0x4c')]({'where':{'name':_0x3fc42d,'userProfileId':_0x4a062c['userProfileId']},'raw':!![]})['then'](function(_0xe88d9e){if(_0xe88d9e&&_0xe88d9e[_0xbb5f('0x4d')]===0x0){return db['UserProfileResource'][_0xbb5f('0x48')]({'name':_0x9b1906[_0xbb5f('0x29')],'resourceId':_0x9b1906['id'],'type':_0xe88d9e[_0xbb5f('0x29')],'sectionId':_0xe88d9e['id']},{})['then'](function(){return _0x144305;});}else{return _0x144305;}})[_0xbb5f('0x46')](function(_0x118de3){logger[_0xbb5f('0x28')](_0xbb5f('0x4e'),_0x118de3);throw _0x118de3;});}return _0x144305;})['then'](respondWithResult(_0x5a21cc,0xc9))['catch'](handleError(_0x5a21cc,null));};exports[_0xbb5f('0x4f')]=function(_0x5dbe1a,_0x52cad4){var _0x44de07={'where':{'id':_0x5dbe1a['params']['id']}},_0xcbbbc7={};_0xcbbbc7[_0xbb5f('0x30')]=_[_0xbb5f('0x32')](db['JscriptyProject'][_0xbb5f('0x2c')]);_0x44de07[_0xbb5f('0x36')]=_[_0xbb5f('0x34')](_0xcbbbc7['model'],qs[_0xbb5f('0x35')](_0x5dbe1a[_0xbb5f('0x31')][_0xbb5f('0x35')]));_0x44de07[_0xbb5f('0x36')]=_0x44de07[_0xbb5f('0x36')][_0xbb5f('0x37')]?_0x44de07[_0xbb5f('0x36')]:_0xcbbbc7[_0xbb5f('0x30')];if(_0x5dbe1a[_0xbb5f('0x31')][_0xbb5f('0x42')]){_0x44de07['include']=[{'all':!![]}];}_0x44de07=_[_0xbb5f('0x3e')]({},_0x44de07,_0x5dbe1a[_0xbb5f('0x40')]);return db['JscriptyProject'][_0xbb5f('0x4c')](_0x44de07)[_0xbb5f('0x23')](handleEntityNotFound(_0x52cad4,null))[_0xbb5f('0x23')](function(_0x337485){if(_0x337485){var _0x1f73cf=_0x337485[_0xbb5f('0x49')]({'plain':!![]});_0x1f73cf=qs['omit'](_0x1f73cf,['id',_0xbb5f('0x50'),'updatedAt']);_0x5dbe1a[_0xbb5f('0x51')]=_[_0xbb5f('0x52')](_0x5dbe1a[_0xbb5f('0x51')],['id',_0xbb5f('0x50'),_0xbb5f('0x53')]);return db['JscriptyProject'][_0xbb5f('0x48')](_[_0xbb5f('0x3e')](_0x1f73cf,_0x5dbe1a[_0xbb5f('0x51')]),{'include':_0x5dbe1a['query'][_0xbb5f('0x42')]?[{'all':!![]}]:undefined})[_0xbb5f('0x23')](function(_0x4b2d0f){var _0x50731c=_0x5dbe1a[_0xbb5f('0x4b')][_0xbb5f('0x49')]({'plain':!![]});if(!_0x50731c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50731c[_0xbb5f('0x54')]==='user'){var _0x588a31=_0x4b2d0f['get']({'plain':!![]});var _0x4d69a8=_0xbb5f('0x24');return db[_0xbb5f('0x55')][_0xbb5f('0x4c')]({'where':{'name':_0x4d69a8,'userProfileId':_0x50731c[_0xbb5f('0x56')]},'raw':!![]})[_0xbb5f('0x23')](function(_0x1706a6){if(_0x1706a6&&_0x1706a6['autoAssociation']===0x0){return db[_0xbb5f('0x25')][_0xbb5f('0x48')]({'name':_0x588a31[_0xbb5f('0x29')],'resourceId':_0x588a31['id'],'type':_0x1706a6[_0xbb5f('0x29')],'sectionId':_0x1706a6['id']},{})[_0xbb5f('0x23')](function(){return _0x4b2d0f;});}else{return _0x4b2d0f;}})[_0xbb5f('0x46')](function(_0x235a73){logger[_0xbb5f('0x28')](_0xbb5f('0x4e'),_0x235a73);throw _0x235a73;});}return _0x4b2d0f;});}})[_0xbb5f('0x23')](respondWithResult(_0x52cad4,0xc9))[_0xbb5f('0x46')](handleError(_0x52cad4,null));};exports[_0xbb5f('0x57')]=function(_0x743f3b,_0x35640e){if(_0x743f3b['body']['id']){delete _0x743f3b[_0xbb5f('0x51')]['id'];}return db[_0xbb5f('0x41')][_0xbb5f('0x4c')]({'where':{'id':_0x743f3b[_0xbb5f('0x58')]['id']}})[_0xbb5f('0x23')](handleEntityNotFound(_0x35640e,null))[_0xbb5f('0x23')](saveUpdates(_0x743f3b['body'],null))[_0xbb5f('0x23')](respondWithResult(_0x35640e,null))['catch'](handleError(_0x35640e,null));};exports[_0xbb5f('0x26')]=function(_0x3e260c,_0x23d18b){return db['JscriptyProject'][_0xbb5f('0x4c')]({'where':{'id':_0x3e260c['params']['id']}})[_0xbb5f('0x23')](handleEntityNotFound(_0x23d18b,null))[_0xbb5f('0x23')](removeEntity(_0x23d18b,null))[_0xbb5f('0x46')](handleError(_0x23d18b,null));};exports[_0xbb5f('0x59')]=function(_0x34e20b,_0x5cb244,_0xf8442a){var _0x516ba8={'raw':!![],'where':{}};var _0x3f84df={};var _0x221fdd={'count':0x0,'rows':[]};return db[_0xbb5f('0x41')][_0xbb5f('0x5a')]({'where':{'id':_0x34e20b[_0xbb5f('0x58')]['id']}})[_0xbb5f('0x23')](handleEntityNotFound(_0x5cb244,null))[_0xbb5f('0x23')](function(_0x31ef4c){if(_0x31ef4c){_0x3f84df['model']=_[_0xbb5f('0x32')](db['JscriptySessionReport'][_0xbb5f('0x2c')]);_0x3f84df[_0xbb5f('0x31')]=_['keys'](_0x34e20b[_0xbb5f('0x31')]);_0x3f84df['filters']=_[_0xbb5f('0x34')](_0x3f84df[_0xbb5f('0x30')],_0x3f84df['query']);_0x516ba8[_0xbb5f('0x36')]=_[_0xbb5f('0x34')](_0x3f84df[_0xbb5f('0x30')],qs[_0xbb5f('0x35')](_0x34e20b[_0xbb5f('0x31')][_0xbb5f('0x35')]));_0x516ba8['attributes']=_0x516ba8[_0xbb5f('0x36')]['length']?_0x516ba8['attributes']:_0x3f84df[_0xbb5f('0x30')];if(!_0x34e20b[_0xbb5f('0x31')][_0xbb5f('0x38')]('nolimit')){_0x516ba8['limit']=qs[_0xbb5f('0x1d')](_0x34e20b[_0xbb5f('0x31')]['limit']);_0x516ba8[_0xbb5f('0x1c')]=qs[_0xbb5f('0x1c')](_0x34e20b[_0xbb5f('0x31')]['offset']);}_0x516ba8[_0xbb5f('0x3a')]=qs[_0xbb5f('0x3b')](_0x34e20b[_0xbb5f('0x31')][_0xbb5f('0x3b')]);_0x516ba8[_0xbb5f('0x3f')]=qs[_0xbb5f('0x33')](_['pick'](_0x34e20b[_0xbb5f('0x31')],_0x3f84df['filters']));_0x516ba8[_0xbb5f('0x3f')]['ProjectId']=_0x31ef4c['id'];if(_0x34e20b[_0xbb5f('0x31')][_0xbb5f('0x3d')]){_0x516ba8['where']=_[_0xbb5f('0x3e')](_0x516ba8[_0xbb5f('0x3f')],{'$or':_['map'](_0x516ba8[_0xbb5f('0x36')],function(_0x19ebee){var _0x35b138={};_0x35b138[_0x19ebee]={'$like':'%'+_0x34e20b[_0xbb5f('0x31')][_0xbb5f('0x3d')]+'%'};return _0x35b138;})});}_0x516ba8=_['merge']({},_0x516ba8,_0x34e20b[_0xbb5f('0x40')]);return db[_0xbb5f('0x5b')][_0xbb5f('0x1f')]({'where':_0x516ba8[_0xbb5f('0x3f')]})[_0xbb5f('0x23')](function(_0x50c3b4){_0x221fdd[_0xbb5f('0x1f')]=_0x50c3b4;if(_0x34e20b[_0xbb5f('0x31')][_0xbb5f('0x42')]){_0x516ba8[_0xbb5f('0x43')]=[{'all':!![]}];}return db[_0xbb5f('0x5b')]['findAll'](_0x516ba8);})[_0xbb5f('0x23')](function(_0x5eb1b2){_0x221fdd['rows']=_0x5eb1b2;return _0x221fdd;});}})[_0xbb5f('0x23')](respondWithFilteredResult(_0x5cb244,_0x516ba8))[_0xbb5f('0x46')](handleError(_0x5cb244,null));};exports[_0xbb5f('0x5c')]=function(_0x4dc0da,_0x1cf2e7,_0x495382){var _0x111acb={'raw':!![],'where':{}};var _0x13fe18={};var _0x5284b7={'count':0x0,'rows':[]};return db[_0xbb5f('0x41')][_0xbb5f('0x5a')]({'where':{'id':_0x4dc0da[_0xbb5f('0x58')]['id']}})[_0xbb5f('0x23')](handleEntityNotFound(_0x1cf2e7,null))[_0xbb5f('0x23')](function(_0x37279c){if(_0x37279c){_0x13fe18[_0xbb5f('0x30')]=_[_0xbb5f('0x32')](db[_0xbb5f('0x5d')][_0xbb5f('0x2c')]);_0x13fe18['query']=_[_0xbb5f('0x32')](_0x4dc0da[_0xbb5f('0x31')]);_0x13fe18[_0xbb5f('0x33')]=_[_0xbb5f('0x34')](_0x13fe18['model'],_0x13fe18[_0xbb5f('0x31')]);_0x111acb[_0xbb5f('0x36')]=_[_0xbb5f('0x34')](_0x13fe18[_0xbb5f('0x30')],qs[_0xbb5f('0x35')](_0x4dc0da[_0xbb5f('0x31')][_0xbb5f('0x35')]));_0x111acb[_0xbb5f('0x36')]=_0x111acb[_0xbb5f('0x36')]['length']?_0x111acb['attributes']:_0x13fe18[_0xbb5f('0x30')];if(!_0x4dc0da[_0xbb5f('0x31')]['hasOwnProperty']('nolimit')){_0x111acb[_0xbb5f('0x1d')]=qs[_0xbb5f('0x1d')](_0x4dc0da['query'][_0xbb5f('0x1d')]);_0x111acb[_0xbb5f('0x1c')]=qs[_0xbb5f('0x1c')](_0x4dc0da[_0xbb5f('0x31')]['offset']);}_0x111acb['order']=qs[_0xbb5f('0x3b')](_0x4dc0da[_0xbb5f('0x31')][_0xbb5f('0x3b')]);_0x111acb[_0xbb5f('0x3f')]=qs[_0xbb5f('0x33')](_[_0xbb5f('0x3c')](_0x4dc0da[_0xbb5f('0x31')],_0x13fe18[_0xbb5f('0x33')]));_0x111acb[_0xbb5f('0x3f')][_0xbb5f('0x5e')]=_0x37279c['id'];if(_0x4dc0da[_0xbb5f('0x31')][_0xbb5f('0x3d')]){_0x111acb['where']=_[_0xbb5f('0x3e')](_0x111acb[_0xbb5f('0x3f')],{'$or':_[_0xbb5f('0x2b')](_0x111acb[_0xbb5f('0x36')],function(_0x268f39){var _0x2b2594={};_0x2b2594[_0x268f39]={'$like':'%'+_0x4dc0da[_0xbb5f('0x31')][_0xbb5f('0x3d')]+'%'};return _0x2b2594;})});}_0x111acb=_[_0xbb5f('0x3e')]({},_0x111acb,_0x4dc0da['options']);return db[_0xbb5f('0x5d')][_0xbb5f('0x1f')]({'where':_0x111acb[_0xbb5f('0x3f')]})[_0xbb5f('0x23')](function(_0x2dfb5c){_0x5284b7[_0xbb5f('0x1f')]=_0x2dfb5c;if(_0x4dc0da['query'][_0xbb5f('0x42')]){_0x111acb[_0xbb5f('0x43')]=[{'all':!![]}];}return db[_0xbb5f('0x5d')]['findAll'](_0x111acb);})[_0xbb5f('0x23')](function(_0x28f36d){_0x5284b7[_0xbb5f('0x45')]=_0x28f36d;return _0x5284b7;});}})[_0xbb5f('0x23')](respondWithFilteredResult(_0x1cf2e7,_0x111acb))['catch'](handleError(_0x1cf2e7,null));};function char(_0x44b665){return'number'===typeof _0x44b665?String[_0xbb5f('0x5f')][_0xbb5f('0x21')](null,arguments):_0x44b665;}function needsEncapsulation(_0x5cfd26){return!!_0x5cfd26&&(_0x5cfd26[_0xbb5f('0x60')]()['indexOf'](char(0xd))>=0x0||_0x5cfd26[_0xbb5f('0x60')]()[_0xbb5f('0x61')](char(0xa))>=0x0||_0x5cfd26[_0xbb5f('0x60')]()['indexOf'](char(0x2c))>=0x0||_0x5cfd26[_0xbb5f('0x60')]()[_0xbb5f('0x61')](char(0x22))>=0x0);}function encapsulate(_0x5901a7){var _0xac3000=char(0x22),_0x2928f4='\x5c'+char(0x22),_0x427c4e=_0x5901a7[_0xbb5f('0x60')]()[_0xbb5f('0x62')](new RegExp(_0xac3000,'g'),_0x2928f4);return _0xac3000+_0x427c4e+_0xac3000;}exports[_0xbb5f('0x63')]=function(_0x571b2b,_0x42908a,_0x1814fd){var _0x275fe7,_0x2f7e50;var _0x1f9286={'where':{'ProjectId':_0x571b2b['params']['id']}};if(_0x571b2b[_0xbb5f('0x31')]['startTime']){_0x1f9286[_0xbb5f('0x3f')][_0xbb5f('0x64')]=JSON['parse'](_0x571b2b[_0xbb5f('0x31')][_0xbb5f('0x65')]);}return db['JscriptySessionReport'][_0xbb5f('0x44')](_0x1f9286)[_0xbb5f('0x23')](handleEntityNotFound(_0x42908a,null))[_0xbb5f('0x23')](function(_0x523536){if(_0x523536){_0x275fe7=_0x523536;return db['JscriptyQuestionReport'][_0xbb5f('0x44')]({'where':{'SessionId':{'$in':_[_0xbb5f('0x2b')](_0x275fe7,'id')},'ProjectId':_0x571b2b[_0xbb5f('0x58')]['id']},'order':_0xbb5f('0x66')});}})[_0xbb5f('0x23')](handleEntityNotFound(_0x42908a,null))['then'](function(_0x33cf16){if(_0x33cf16){_0x2f7e50=_0x33cf16;var _0x4c7aac={};for(var _0x544a1e=0x0,_0x5262b8=_0x2f7e50['length'];_0x544a1e<_0x5262b8;_0x544a1e++){if(!_0x4c7aac[_0xbb5f('0x38')](_0x2f7e50[_0x544a1e][_0xbb5f('0x67')])){_0x4c7aac[_0x2f7e50[_0x544a1e]['questionId']]=needsEncapsulation(_0x2f7e50[_0x544a1e][_0xbb5f('0x68')])?encapsulate(_0x2f7e50[_0x544a1e][_0xbb5f('0x68')]):_0x2f7e50[_0x544a1e][_0xbb5f('0x68')];}}var _0x4144bc=[],_0xa934da={};for(var _0x2a110a=0x0,_0x396250=_0x275fe7[_0xbb5f('0x37')];_0x2a110a<_0x396250;_0x2a110a++){_0xa934da={'ProjectId':_0x571b2b['params']['id'],'SessionId':_0x275fe7[_0x2a110a]['id'],'StartTime':moment(_0x275fe7[_0x2a110a]['starttime'])[_0xbb5f('0x69')](_0xbb5f('0x6a'))};for(var _0x11a992=0x0,_0x431411=_0x2f7e50[_0xbb5f('0x37')];_0x11a992<_0x431411;_0x11a992++){if(_0x2f7e50[_0x11a992][_0xbb5f('0x6b')]==_0x275fe7[_0x2a110a]['id']&&_0x4c7aac[_0xbb5f('0x38')](_0x2f7e50[_0x11a992][_0xbb5f('0x67')])){_0xa934da[_0x4c7aac[_0x2f7e50[_0x11a992][_0xbb5f('0x67')]]]=_0x2f7e50[_0x11a992][_0xbb5f('0x6c')];}}for(var _0x27a4c0 in _0x4c7aac){if(!_0xa934da[_0xbb5f('0x38')](_0x4c7aac[_0x27a4c0])){_0xa934da[_0x4c7aac[_0x27a4c0]]=null;}}_0x4144bc[_0xbb5f('0x6d')](_0xa934da);}return _0x4144bc;}})[_0xbb5f('0x23')](function(_0x1affe6){if(!_[_0xbb5f('0x6e')](_0x1affe6)){var _0x12f99a=toCsv(_0x1affe6);var _0x1b7061=Date['now']();fs['writeFileSync'](util['format'](_0xbb5f('0x6f'),_0x571b2b[_0xbb5f('0x58')]['id'],_0x1b7061),_0x12f99a);_0x42908a[_0xbb5f('0x70')](_0xbb5f('0x71'),'attachment;\x20filename='+util[_0xbb5f('0x69')](_0xbb5f('0x72'),_0x571b2b['params']['id'],_0x1b7061));_0x42908a[_0xbb5f('0x70')](_0xbb5f('0x73'),_0xbb5f('0x74'));return _0x42908a[_0xbb5f('0x75')](util[_0xbb5f('0x69')](_0xbb5f('0x6f'),_0x571b2b[_0xbb5f('0x58')]['id'],_0x1b7061));}else{return _0x42908a[_0xbb5f('0x19')](0xcc);}})['catch'](handleError(_0x42908a,null));}; \ No newline at end of file +var _0xc19a=['getSummary','startTime','parse','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','params','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','userProfileId','getSessions','findOne','JscriptySessionReport','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','indexOf','toString'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xc19a,0x7f));var _0xac19=function(_0x5e2bee,_0x103eee){_0x5e2bee=_0x5e2bee-0x0;var _0x31f19f=_0xc19a[_0x5e2bee];return _0x31f19f;};'use strict';var emlformat=require(_0xac19('0x0'));var rimraf=require(_0xac19('0x1'));var zipdir=require(_0xac19('0x2'));var jsonpatch=require(_0xac19('0x3'));var rp=require('request-promise');var moment=require(_0xac19('0x4'));var BPromise=require(_0xac19('0x5'));var Mustache=require(_0xac19('0x6'));var util=require('util');var path=require(_0xac19('0x7'));var sox=require(_0xac19('0x8'));var csv=require('to-csv');var ejs=require(_0xac19('0x9'));var fs=require('fs');var fs_extra=require(_0xac19('0xa'));var _=require('lodash');var squel=require(_0xac19('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac19('0xc'));var querystring=require(_0xac19('0xd'));var Papa=require(_0xac19('0xe'));var Redis=require(_0xac19('0xf'));var authService=require(_0xac19('0x10'));var qs=require(_0xac19('0x11'));var as=require(_0xac19('0x12'));var hardwareService=require(_0xac19('0x13'));var logger=require('../../config/logger')(_0xac19('0x14'));var utils=require(_0xac19('0x15'));var config=require(_0xac19('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x493836,_0x52f65e){_0x52f65e=_0x52f65e||0xcc;return function(_0xba0c2a){if(_0xba0c2a){return _0x493836[_0xac19('0x17')](_0x52f65e);}return _0x493836['status'](_0x52f65e)['end']();};}function respondWithResult(_0x1bfe4a,_0x5a0214){_0x5a0214=_0x5a0214||0xc8;return function(_0x127a6e){if(_0x127a6e){return _0x1bfe4a[_0xac19('0x18')](_0x5a0214)['json'](_0x127a6e);}};}function respondWithFilteredResult(_0x189eab,_0x5817e1){return function(_0x204220){if(_0x204220){var _0x1961fc=typeof _0x5817e1[_0xac19('0x19')]===_0xac19('0x1a')&&typeof _0x5817e1[_0xac19('0x1b')]==='undefined';var _0x5235ac=_0x204220[_0xac19('0x1c')];var _0x26c053=_0x1961fc?0x0:_0x5817e1[_0xac19('0x19')];var _0x42d094=_0x1961fc?_0x204220['count']:_0x5817e1['offset']+_0x5817e1[_0xac19('0x1b')];var _0x2b0e52;if(_0x42d094>=_0x5235ac){_0x42d094=_0x5235ac;_0x2b0e52=0xc8;}else{_0x2b0e52=0xce;}_0x189eab[_0xac19('0x18')](_0x2b0e52);return _0x189eab[_0xac19('0x1d')](_0xac19('0x1e'),_0x26c053+'-'+_0x42d094+'/'+_0x5235ac)[_0xac19('0x1f')](_0x204220);}return null;};}function patchUpdates(_0x3d63c0){return function(_0x1d150b){try{jsonpatch[_0xac19('0x20')](_0x1d150b,_0x3d63c0,!![]);}catch(_0x7239ca){return BPromise['reject'](_0x7239ca);}return _0x1d150b[_0xac19('0x21')]();};}function saveUpdates(_0x347f6e,_0x2c457f){return function(_0x31dbb7){if(_0x31dbb7){return _0x31dbb7['update'](_0x347f6e)[_0xac19('0x22')](function(_0x52b6d2){return _0x52b6d2;});}return null;};}function removeEntity(_0x605bb3,_0x5d65fb){return function(_0x404842){if(_0x404842){return _0x404842[_0xac19('0x23')]()['then'](function(){var _0x339fd1=_0x404842[_0xac19('0x24')]({'plain':!![]});var _0x4158c4='Projects';return db[_0xac19('0x25')][_0xac19('0x23')]({'where':{'type':_0x4158c4,'resourceId':_0x339fd1['id']}})[_0xac19('0x22')](function(){return _0x404842;});})[_0xac19('0x22')](function(){_0x605bb3[_0xac19('0x18')](0xcc)[_0xac19('0x26')]();});}};}function handleEntityNotFound(_0x5bde80,_0x3fcbbf){return function(_0x15ec90){if(!_0x15ec90){_0x5bde80[_0xac19('0x17')](0x194);}return _0x15ec90;};}function handleError(_0x153a6a,_0x4c3c8d){_0x4c3c8d=_0x4c3c8d||0x1f4;return function(_0x1301cd){logger[_0xac19('0x27')](_0x1301cd[_0xac19('0x28')]);if(_0x1301cd[_0xac19('0x29')]){delete _0x1301cd['name'];}_0x153a6a[_0xac19('0x18')](_0x4c3c8d)[_0xac19('0x2a')](_0x1301cd);};}exports[_0xac19('0x2b')]=function(_0x1e7013,_0x5cb694){var _0x222d3e={},_0x249546={},_0x187f25={'count':0x0,'rows':[]};var _0x17752e=_[_0xac19('0x2c')](db[_0xac19('0x2d')][_0xac19('0x2e')],function(_0x11aab6){return{'name':_0x11aab6[_0xac19('0x2f')],'type':_0x11aab6[_0xac19('0x30')]['key']};});_0x249546[_0xac19('0x31')]=_[_0xac19('0x2c')](_0x17752e,'name');_0x249546['query']=_[_0xac19('0x32')](_0x1e7013[_0xac19('0x33')]);_0x249546[_0xac19('0x34')]=_[_0xac19('0x35')](_0x249546[_0xac19('0x31')],_0x249546[_0xac19('0x33')]);_0x222d3e[_0xac19('0x36')]=_[_0xac19('0x35')](_0x249546['model'],qs['fields'](_0x1e7013[_0xac19('0x33')][_0xac19('0x37')]));_0x222d3e[_0xac19('0x36')]=_0x222d3e[_0xac19('0x36')][_0xac19('0x38')]?_0x222d3e['attributes']:_0x249546[_0xac19('0x31')];if(!_0x1e7013['query'][_0xac19('0x39')]('nolimit')){_0x222d3e[_0xac19('0x1b')]=qs[_0xac19('0x1b')](_0x1e7013[_0xac19('0x33')][_0xac19('0x1b')]);_0x222d3e[_0xac19('0x19')]=qs[_0xac19('0x19')](_0x1e7013[_0xac19('0x33')][_0xac19('0x19')]);}_0x222d3e[_0xac19('0x3a')]=qs[_0xac19('0x3b')](_0x1e7013[_0xac19('0x33')]['sort']);_0x222d3e[_0xac19('0x3c')]=qs['filters'](_[_0xac19('0x3d')](_0x1e7013['query'],_0x249546[_0xac19('0x34')]),_0x17752e);if(_0x1e7013[_0xac19('0x33')][_0xac19('0x3e')]){_0x222d3e[_0xac19('0x3c')]=_['merge'](_0x222d3e['where'],{'$or':_['map'](_0x17752e,function(_0x5b0b78){if(_0x5b0b78[_0xac19('0x30')]!==_0xac19('0x3f')){var _0x3eec1d={};_0x3eec1d[_0x5b0b78[_0xac19('0x29')]]={'$like':'%'+_0x1e7013[_0xac19('0x33')][_0xac19('0x3e')]+'%'};return _0x3eec1d;}})});}_0x222d3e=_['merge']({},_0x222d3e,_0x1e7013[_0xac19('0x40')]);var _0x21e984={'where':_0x222d3e[_0xac19('0x3c')]};return db['JscriptyProject'][_0xac19('0x1c')](_0x21e984)['then'](function(_0x305092){_0x187f25[_0xac19('0x1c')]=_0x305092;if(_0x1e7013[_0xac19('0x33')][_0xac19('0x41')]){_0x222d3e[_0xac19('0x42')]=[{'all':!![]}];}return db[_0xac19('0x2d')][_0xac19('0x43')](_0x222d3e);})[_0xac19('0x22')](function(_0x2b70ea){_0x187f25['rows']=_0x2b70ea;return _0x187f25;})[_0xac19('0x22')](respondWithFilteredResult(_0x5cb694,_0x222d3e))[_0xac19('0x44')](handleError(_0x5cb694,null));};exports['show']=function(_0x2e83d8,_0x13fe80){var _0x592b58={'raw':![],'where':{'id':_0x2e83d8[_0xac19('0x45')]['id']}},_0x4c6b30={};_0x4c6b30[_0xac19('0x31')]=_[_0xac19('0x32')](db[_0xac19('0x2d')][_0xac19('0x2e')]);_0x4c6b30[_0xac19('0x33')]=_[_0xac19('0x32')](_0x2e83d8[_0xac19('0x33')]);_0x4c6b30[_0xac19('0x34')]=_[_0xac19('0x35')](_0x4c6b30[_0xac19('0x31')],_0x4c6b30[_0xac19('0x33')]);_0x592b58['attributes']=_[_0xac19('0x35')](_0x4c6b30[_0xac19('0x31')],qs[_0xac19('0x37')](_0x2e83d8[_0xac19('0x33')]['fields']));_0x592b58[_0xac19('0x36')]=_0x592b58[_0xac19('0x36')][_0xac19('0x38')]?_0x592b58[_0xac19('0x36')]:_0x4c6b30[_0xac19('0x31')];if(_0x2e83d8[_0xac19('0x33')]['includeAll']){_0x592b58[_0xac19('0x42')]=[{'all':!![]}];}_0x592b58=_[_0xac19('0x46')]({},_0x592b58,_0x2e83d8[_0xac19('0x40')]);return db[_0xac19('0x2d')][_0xac19('0x47')](_0x592b58)[_0xac19('0x22')](handleEntityNotFound(_0x13fe80,null))[_0xac19('0x22')](respondWithResult(_0x13fe80,null))[_0xac19('0x44')](handleError(_0x13fe80,null));};exports[_0xac19('0x48')]=function(_0x3df206,_0x1d107b){return db['JscriptyProject'][_0xac19('0x48')](_0x3df206['body'],{})[_0xac19('0x22')](function(_0x4ecf1b){var _0x90dac4=_0x3df206[_0xac19('0x49')][_0xac19('0x24')]({'plain':!![]});if(!_0x90dac4)throw new Error(_0xac19('0x4a'));if(_0x90dac4[_0xac19('0x4b')]===_0xac19('0x49')){var _0x22ddf3=_0x4ecf1b[_0xac19('0x24')]({'plain':!![]});var _0x7906a1=_0xac19('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x7906a1,'userProfileId':_0x90dac4['userProfileId']},'raw':!![]})['then'](function(_0x106b5a){if(_0x106b5a&&_0x106b5a[_0xac19('0x4d')]===0x0){return db[_0xac19('0x25')][_0xac19('0x48')]({'name':_0x22ddf3[_0xac19('0x29')],'resourceId':_0x22ddf3['id'],'type':_0x106b5a[_0xac19('0x29')],'sectionId':_0x106b5a['id']},{})[_0xac19('0x22')](function(){return _0x4ecf1b;});}else{return _0x4ecf1b;}})[_0xac19('0x44')](function(_0x10e08c){logger[_0xac19('0x27')](_0xac19('0x4e'),_0x10e08c);throw _0x10e08c;});}return _0x4ecf1b;})[_0xac19('0x22')](respondWithResult(_0x1d107b,0xc9))['catch'](handleError(_0x1d107b,null));};exports[_0xac19('0x4f')]=function(_0x2381f2,_0x4409fb){var _0x283cb8={'where':{'id':_0x2381f2[_0xac19('0x45')]['id']}},_0x1c2d41={};_0x1c2d41[_0xac19('0x31')]=_[_0xac19('0x32')](db['JscriptyProject'][_0xac19('0x2e')]);_0x283cb8[_0xac19('0x36')]=_[_0xac19('0x35')](_0x1c2d41['model'],qs[_0xac19('0x37')](_0x2381f2[_0xac19('0x33')][_0xac19('0x37')]));_0x283cb8[_0xac19('0x36')]=_0x283cb8[_0xac19('0x36')][_0xac19('0x38')]?_0x283cb8[_0xac19('0x36')]:_0x1c2d41[_0xac19('0x31')];if(_0x2381f2[_0xac19('0x33')][_0xac19('0x41')]){_0x283cb8['include']=[{'all':!![]}];}_0x283cb8=_[_0xac19('0x46')]({},_0x283cb8,_0x2381f2[_0xac19('0x40')]);return db[_0xac19('0x2d')]['find'](_0x283cb8)[_0xac19('0x22')](handleEntityNotFound(_0x4409fb,null))[_0xac19('0x22')](function(_0x5c0e17){if(_0x5c0e17){var _0x534906=_0x5c0e17[_0xac19('0x24')]({'plain':!![]});_0x534906=qs[_0xac19('0x50')](_0x534906,['id','createdAt',_0xac19('0x51')]);_0x2381f2[_0xac19('0x52')]=_[_0xac19('0x50')](_0x2381f2[_0xac19('0x52')],['id','createdAt',_0xac19('0x51')]);return db[_0xac19('0x2d')][_0xac19('0x48')](_[_0xac19('0x46')](_0x534906,_0x2381f2[_0xac19('0x52')]),{'include':_0x2381f2[_0xac19('0x33')][_0xac19('0x41')]?[{'all':!![]}]:undefined})[_0xac19('0x22')](function(_0x3491e6){var _0x23156a=_0x2381f2[_0xac19('0x49')][_0xac19('0x24')]({'plain':!![]});if(!_0x23156a)throw new Error(_0xac19('0x4a'));if(_0x23156a[_0xac19('0x4b')]===_0xac19('0x49')){var _0xedee68=_0x3491e6['get']({'plain':!![]});var _0x5beee3=_0xac19('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x5beee3,'userProfileId':_0x23156a[_0xac19('0x53')]},'raw':!![]})[_0xac19('0x22')](function(_0x16a10d){if(_0x16a10d&&_0x16a10d[_0xac19('0x4d')]===0x0){return db[_0xac19('0x25')]['create']({'name':_0xedee68[_0xac19('0x29')],'resourceId':_0xedee68['id'],'type':_0x16a10d[_0xac19('0x29')],'sectionId':_0x16a10d['id']},{})[_0xac19('0x22')](function(){return _0x3491e6;});}else{return _0x3491e6;}})[_0xac19('0x44')](function(_0x28d206){logger[_0xac19('0x27')](_0xac19('0x4e'),_0x28d206);throw _0x28d206;});}return _0x3491e6;});}})[_0xac19('0x22')](respondWithResult(_0x4409fb,0xc9))[_0xac19('0x44')](handleError(_0x4409fb,null));};exports['update']=function(_0x47c422,_0x1c49cc){if(_0x47c422[_0xac19('0x52')]['id']){delete _0x47c422['body']['id'];}return db[_0xac19('0x2d')][_0xac19('0x47')]({'where':{'id':_0x47c422['params']['id']}})[_0xac19('0x22')](handleEntityNotFound(_0x1c49cc,null))[_0xac19('0x22')](saveUpdates(_0x47c422[_0xac19('0x52')],null))['then'](respondWithResult(_0x1c49cc,null))[_0xac19('0x44')](handleError(_0x1c49cc,null));};exports[_0xac19('0x23')]=function(_0x1b1fa3,_0x45cdf4){return db[_0xac19('0x2d')]['find']({'where':{'id':_0x1b1fa3[_0xac19('0x45')]['id']}})[_0xac19('0x22')](handleEntityNotFound(_0x45cdf4,null))[_0xac19('0x22')](removeEntity(_0x45cdf4,null))[_0xac19('0x44')](handleError(_0x45cdf4,null));};exports[_0xac19('0x54')]=function(_0x1470e1,_0x2afb93,_0x41affc){var _0xbb8088={'raw':!![],'where':{}};var _0x5a7f87={};var _0x36f3c3={'count':0x0,'rows':[]};return db[_0xac19('0x2d')][_0xac19('0x55')]({'where':{'id':_0x1470e1[_0xac19('0x45')]['id']}})[_0xac19('0x22')](handleEntityNotFound(_0x2afb93,null))[_0xac19('0x22')](function(_0x49ba3f){if(_0x49ba3f){_0x5a7f87['model']=_['keys'](db[_0xac19('0x56')][_0xac19('0x2e')]);_0x5a7f87[_0xac19('0x33')]=_[_0xac19('0x32')](_0x1470e1[_0xac19('0x33')]);_0x5a7f87['filters']=_[_0xac19('0x35')](_0x5a7f87[_0xac19('0x31')],_0x5a7f87[_0xac19('0x33')]);_0xbb8088[_0xac19('0x36')]=_[_0xac19('0x35')](_0x5a7f87[_0xac19('0x31')],qs['fields'](_0x1470e1[_0xac19('0x33')]['fields']));_0xbb8088[_0xac19('0x36')]=_0xbb8088[_0xac19('0x36')]['length']?_0xbb8088[_0xac19('0x36')]:_0x5a7f87[_0xac19('0x31')];if(!_0x1470e1[_0xac19('0x33')]['hasOwnProperty']('nolimit')){_0xbb8088['limit']=qs[_0xac19('0x1b')](_0x1470e1[_0xac19('0x33')][_0xac19('0x1b')]);_0xbb8088['offset']=qs[_0xac19('0x19')](_0x1470e1[_0xac19('0x33')][_0xac19('0x19')]);}_0xbb8088[_0xac19('0x3a')]=qs[_0xac19('0x3b')](_0x1470e1[_0xac19('0x33')][_0xac19('0x3b')]);_0xbb8088[_0xac19('0x3c')]=qs[_0xac19('0x34')](_[_0xac19('0x3d')](_0x1470e1[_0xac19('0x33')],_0x5a7f87[_0xac19('0x34')]));_0xbb8088['where'][_0xac19('0x57')]=_0x49ba3f['id'];if(_0x1470e1[_0xac19('0x33')][_0xac19('0x3e')]){_0xbb8088[_0xac19('0x3c')]=_[_0xac19('0x46')](_0xbb8088['where'],{'$or':_[_0xac19('0x2c')](_0xbb8088['attributes'],function(_0x342109){var _0x16fcf0={};_0x16fcf0[_0x342109]={'$like':'%'+_0x1470e1[_0xac19('0x33')][_0xac19('0x3e')]+'%'};return _0x16fcf0;})});}_0xbb8088=_[_0xac19('0x46')]({},_0xbb8088,_0x1470e1['options']);return db[_0xac19('0x56')][_0xac19('0x1c')]({'where':_0xbb8088[_0xac19('0x3c')]})[_0xac19('0x22')](function(_0x350f81){_0x36f3c3['count']=_0x350f81;if(_0x1470e1[_0xac19('0x33')][_0xac19('0x41')]){_0xbb8088[_0xac19('0x42')]=[{'all':!![]}];}return db[_0xac19('0x56')]['findAll'](_0xbb8088);})[_0xac19('0x22')](function(_0x1ad2ef){_0x36f3c3[_0xac19('0x58')]=_0x1ad2ef;return _0x36f3c3;});}})[_0xac19('0x22')](respondWithFilteredResult(_0x2afb93,_0xbb8088))[_0xac19('0x44')](handleError(_0x2afb93,null));};exports[_0xac19('0x59')]=function(_0x1d3c73,_0x1b7a6e,_0x5e35fc){var _0x3ad8ad={'raw':!![],'where':{}};var _0x54ea46={};var _0xf90ae4={'count':0x0,'rows':[]};return db[_0xac19('0x2d')]['findOne']({'where':{'id':_0x1d3c73[_0xac19('0x45')]['id']}})[_0xac19('0x22')](handleEntityNotFound(_0x1b7a6e,null))['then'](function(_0x1d447e){if(_0x1d447e){_0x54ea46[_0xac19('0x31')]=_[_0xac19('0x32')](db[_0xac19('0x5a')][_0xac19('0x2e')]);_0x54ea46[_0xac19('0x33')]=_['keys'](_0x1d3c73[_0xac19('0x33')]);_0x54ea46[_0xac19('0x34')]=_['intersection'](_0x54ea46[_0xac19('0x31')],_0x54ea46['query']);_0x3ad8ad[_0xac19('0x36')]=_[_0xac19('0x35')](_0x54ea46['model'],qs[_0xac19('0x37')](_0x1d3c73[_0xac19('0x33')]['fields']));_0x3ad8ad[_0xac19('0x36')]=_0x3ad8ad['attributes'][_0xac19('0x38')]?_0x3ad8ad[_0xac19('0x36')]:_0x54ea46['model'];if(!_0x1d3c73[_0xac19('0x33')][_0xac19('0x39')]('nolimit')){_0x3ad8ad['limit']=qs['limit'](_0x1d3c73[_0xac19('0x33')]['limit']);_0x3ad8ad[_0xac19('0x19')]=qs[_0xac19('0x19')](_0x1d3c73[_0xac19('0x33')][_0xac19('0x19')]);}_0x3ad8ad[_0xac19('0x3a')]=qs[_0xac19('0x3b')](_0x1d3c73['query'][_0xac19('0x3b')]);_0x3ad8ad[_0xac19('0x3c')]=qs[_0xac19('0x34')](_[_0xac19('0x3d')](_0x1d3c73[_0xac19('0x33')],_0x54ea46[_0xac19('0x34')]));_0x3ad8ad[_0xac19('0x3c')]['ProjectId']=_0x1d447e['id'];if(_0x1d3c73[_0xac19('0x33')][_0xac19('0x3e')]){_0x3ad8ad[_0xac19('0x3c')]=_[_0xac19('0x46')](_0x3ad8ad['where'],{'$or':_[_0xac19('0x2c')](_0x3ad8ad['attributes'],function(_0x593abc){var _0x54e324={};_0x54e324[_0x593abc]={'$like':'%'+_0x1d3c73[_0xac19('0x33')]['filter']+'%'};return _0x54e324;})});}_0x3ad8ad=_[_0xac19('0x46')]({},_0x3ad8ad,_0x1d3c73['options']);return db['JscriptyAnswerReport'][_0xac19('0x1c')]({'where':_0x3ad8ad[_0xac19('0x3c')]})[_0xac19('0x22')](function(_0x5f0b35){_0xf90ae4[_0xac19('0x1c')]=_0x5f0b35;if(_0x1d3c73[_0xac19('0x33')]['includeAll']){_0x3ad8ad[_0xac19('0x42')]=[{'all':!![]}];}return db[_0xac19('0x5a')][_0xac19('0x43')](_0x3ad8ad);})['then'](function(_0x26ec54){_0xf90ae4[_0xac19('0x58')]=_0x26ec54;return _0xf90ae4;});}})[_0xac19('0x22')](respondWithFilteredResult(_0x1b7a6e,_0x3ad8ad))[_0xac19('0x44')](handleError(_0x1b7a6e,null));};function char(_0x5c397b){return _0xac19('0x5b')===typeof _0x5c397b?String[_0xac19('0x5c')][_0xac19('0x20')](null,arguments):_0x5c397b;}function needsEncapsulation(_0xab241e){return!!_0xab241e&&(_0xab241e['toString']()[_0xac19('0x5d')](char(0xd))>=0x0||_0xab241e[_0xac19('0x5e')]()[_0xac19('0x5d')](char(0xa))>=0x0||_0xab241e[_0xac19('0x5e')]()[_0xac19('0x5d')](char(0x2c))>=0x0||_0xab241e[_0xac19('0x5e')]()[_0xac19('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x2b629c){var _0x45574f=char(0x22),_0x45f63a='\x5c'+char(0x22),_0x54a972=_0x2b629c[_0xac19('0x5e')]()['replace'](new RegExp(_0x45574f,'g'),_0x45f63a);return _0x45574f+_0x54a972+_0x45574f;}exports[_0xac19('0x5f')]=function(_0x292700,_0x420d39,_0x216012){var _0x4b7d18,_0x453ade;var _0x45475a={'where':{'ProjectId':_0x292700['params']['id']}};if(_0x292700[_0xac19('0x33')][_0xac19('0x60')]){_0x45475a[_0xac19('0x3c')]['starttime']=JSON[_0xac19('0x61')](_0x292700['query']['startTime']);}return db[_0xac19('0x56')][_0xac19('0x43')](_0x45475a)['then'](handleEntityNotFound(_0x420d39,null))['then'](function(_0xd3b5d){if(_0xd3b5d){_0x4b7d18=_0xd3b5d;return db['JscriptyQuestionReport'][_0xac19('0x43')]({'where':{'SessionId':{'$in':_[_0xac19('0x2c')](_0x4b7d18,'id')},'ProjectId':_0x292700[_0xac19('0x45')]['id']},'order':_0xac19('0x62')});}})['then'](handleEntityNotFound(_0x420d39,null))[_0xac19('0x22')](function(_0xf6a08e){if(_0xf6a08e){_0x453ade=_0xf6a08e;var _0x55a80e={};for(var _0x3ae05c=0x0,_0x196c7c=_0x453ade['length'];_0x3ae05c<_0x196c7c;_0x3ae05c++){if(!_0x55a80e['hasOwnProperty'](_0x453ade[_0x3ae05c][_0xac19('0x63')])){_0x55a80e[_0x453ade[_0x3ae05c][_0xac19('0x63')]]=needsEncapsulation(_0x453ade[_0x3ae05c][_0xac19('0x64')])?encapsulate(_0x453ade[_0x3ae05c][_0xac19('0x64')]):_0x453ade[_0x3ae05c][_0xac19('0x64')];}}var _0x4508df=[],_0x5b3d43={};for(var _0x20343b=0x0,_0x10ebf=_0x4b7d18['length'];_0x20343b<_0x10ebf;_0x20343b++){_0x5b3d43={'ProjectId':_0x292700[_0xac19('0x45')]['id'],'SessionId':_0x4b7d18[_0x20343b]['id'],'StartTime':moment(_0x4b7d18[_0x20343b][_0xac19('0x65')])[_0xac19('0x66')](_0xac19('0x67'))};for(var _0x31722b=0x0,_0x5c8654=_0x453ade[_0xac19('0x38')];_0x31722b<_0x5c8654;_0x31722b++){if(_0x453ade[_0x31722b][_0xac19('0x68')]==_0x4b7d18[_0x20343b]['id']&&_0x55a80e[_0xac19('0x39')](_0x453ade[_0x31722b]['questionId'])){_0x5b3d43[_0x55a80e[_0x453ade[_0x31722b][_0xac19('0x63')]]]=_0x453ade[_0x31722b][_0xac19('0x69')];}}for(var _0x3b1c66 in _0x55a80e){if(!_0x5b3d43['hasOwnProperty'](_0x55a80e[_0x3b1c66])){_0x5b3d43[_0x55a80e[_0x3b1c66]]=null;}}_0x4508df['push'](_0x5b3d43);}return _0x4508df;}})[_0xac19('0x22')](function(_0x286595){if(!_['isEmpty'](_0x286595)){var _0x4b7185=toCsv(_0x286595);var _0x3116b0=Date[_0xac19('0x6a')]();fs[_0xac19('0x6b')](util[_0xac19('0x66')](_0xac19('0x6c'),_0x292700[_0xac19('0x45')]['id'],_0x3116b0),_0x4b7185);_0x420d39[_0xac19('0x6d')](_0xac19('0x6e'),'attachment;\x20filename='+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x292700['params']['id'],_0x3116b0));_0x420d39[_0xac19('0x6d')]('Content-type','text/csv');return _0x420d39['download'](util[_0xac19('0x66')](_0xac19('0x6c'),_0x292700[_0xac19('0x45')]['id'],_0x3116b0));}else{return _0x420d39[_0xac19('0x17')](0xcc);}})[_0xac19('0x44')](handleError(_0x420d39,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index ed35d2b..a85f0b2 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 _0xeb79=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects'];(function(_0x44e066,_0x3566ae){var _0x2d8313=function(_0x1005d3){while(--_0x1005d3){_0x44e066['push'](_0x44e066['shift']());}};_0x2d8313(++_0x3566ae);}(_0xeb79,0x87));var _0x9eb7=function(_0x48a46f,_0x30b03f){_0x48a46f=_0x48a46f-0x0;var _0x15e344=_0xeb79[_0x48a46f];return _0x15e344;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9eb7('0x0'))('api');var moment=require(_0x9eb7('0x1'));var BPromise=require('bluebird');var rp=require(_0x9eb7('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9eb7('0x3'));var config=require(_0x9eb7('0x4'));var attributes=require(_0x9eb7('0x5'));module[_0x9eb7('0x6')]=function(_0x58bc03,_0x501d0c){return _0x58bc03[_0x9eb7('0x7')]('JscriptyProject',attributes,{'tableName':_0x9eb7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3379=['exports','JscriptyProject','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./jscriptyProject.attributes'];(function(_0xda7291,_0x13c698){var _0x3da1ea=function(_0x128124){while(--_0x128124){_0xda7291['push'](_0xda7291['shift']());}};_0x3da1ea(++_0x13c698);}(_0x3379,0x115));var _0x9337=function(_0x359332,_0x3eb2d1){_0x359332=_0x359332-0x0;var _0x1ea635=_0x3379[_0x359332];return _0x1ea635;};'use strict';var _=require(_0x9337('0x0'));var util=require(_0x9337('0x1'));var logger=require(_0x9337('0x2'))(_0x9337('0x3'));var moment=require('moment');var BPromise=require(_0x9337('0x4'));var rp=require(_0x9337('0x5'));var fs=require('fs');var path=require(_0x9337('0x6'));var rimraf=require(_0x9337('0x7'));var config=require('../../config/environment');var attributes=require(_0x9337('0x8'));module[_0x9337('0x9')]=function(_0x390772,_0x677c38){return _0x390772['define'](_0x9337('0xa'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 404f447..a0b77d8 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 _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x219bfd,_0x27af34){var _0x3263e4=function(_0x3abb2c){while(--_0x3abb2c){_0x219bfd['push'](_0x219bfd['shift']());}};_0x3263e4(++_0x27af34);}(_0xe706,0xa3));var _0x6e70=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0xe706[_0x586fa2];return _0x515be9;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d4b9b,_0x5601c9){var _0xd43524=function(_0x5271ae){while(--_0x5271ae){_0x2d4b9b['push'](_0x2d4b9b['shift']());}};_0xd43524(++_0x5601c9);}(_0x70e0,0x17b));var _0x070e=function(_0x5a93e0,_0x3ae561){_0x5a93e0=_0x5a93e0-0x0;var _0x5e625b=_0x70e0[_0x5a93e0];return _0x5e625b;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 414bc5a..44cc6e5 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 _0x5ccc=['create','put','update','exports','multer','util','express','fs-extra','../../components/interaction/service','./jscriptyQuestionReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x39cd3c,_0xa21102){var _0x47a0ae=function(_0x330b05){while(--_0x330b05){_0x39cd3c['push'](_0x39cd3c['shift']());}};_0x47a0ae(++_0xa21102);}(_0x5ccc,0xca));var _0xc5cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ccc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc5cc('0x0'));var util=require(_0xc5cc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc5cc('0x2'));var router=express['Router']();var fs_extra=require(_0xc5cc('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc5cc('0x4'));var config=require('../../config/environment');var controller=require(_0xc5cc('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xc5cc('0x6')]);router[_0xc5cc('0x7')](_0xc5cc('0x8'),auth[_0xc5cc('0x9')](),controller[_0xc5cc('0xa')]);router[_0xc5cc('0x7')](_0xc5cc('0xb'),auth[_0xc5cc('0x9')](),controller[_0xc5cc('0xc')]);router[_0xc5cc('0xd')]('/',auth[_0xc5cc('0x9')](),controller[_0xc5cc('0xe')]);router[_0xc5cc('0xf')](_0xc5cc('0xb'),auth[_0xc5cc('0x9')](),controller[_0xc5cc('0x10')]);router['delete'](_0xc5cc('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xc5cc('0x11')]=router; \ No newline at end of file +var _0x76de=['/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x76de,0x15b));var _0xe76d=function(_0x3ad59b,_0x13aca3){_0x3ad59b=_0x3ad59b-0x0;var _0x453202=_0x76de[_0x3ad59b];return _0x453202;};'use strict';var multer=require(_0xe76d('0x0'));var util=require(_0xe76d('0x1'));var path=require(_0xe76d('0x2'));var timeout=require(_0xe76d('0x3'));var express=require(_0xe76d('0x4'));var router=express['Router']();var fs_extra=require(_0xe76d('0x5'));var auth=require(_0xe76d('0x6'));var interaction=require(_0xe76d('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0xe76d('0x8')]('/',auth[_0xe76d('0x9')](),controller[_0xe76d('0xa')]);router[_0xe76d('0x8')](_0xe76d('0xb'),auth[_0xe76d('0x9')](),controller[_0xe76d('0xc')]);router[_0xe76d('0x8')](_0xe76d('0xd'),auth[_0xe76d('0x9')](),controller[_0xe76d('0xe')]);router[_0xe76d('0xf')]('/',auth[_0xe76d('0x9')](),controller[_0xe76d('0x10')]);router['put'](_0xe76d('0xd'),auth[_0xe76d('0x9')](),controller[_0xe76d('0x11')]);router['delete']('/:id',auth[_0xe76d('0x9')](),controller[_0xe76d('0x12')]);module[_0xe76d('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index c758f80..0b2e288 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(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x7a54,0x106));var _0x47a5=function(_0x23ef7e,_0x32313b){_0x23ef7e=_0x23ef7e-0x0;var _0x25d28f=_0x7a54[_0x23ef7e];return _0x25d28f;};'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(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a54,0x106));var _0x47a5=function(_0x40d46b,_0x24aae3){_0x40d46b=_0x40d46b-0x0;var _0x1ba171=_0x7a54[_0x40d46b];return _0x1ba171;};'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 2928752..239166c 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 _0x6a5a=['fields','length','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','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','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0x6a5a,0xaa));var _0xa6a5=function(_0x599206,_0x3bea47){_0x599206=_0x599206-0x0;var _0x1a68fd=_0x6a5a[_0x599206];return _0x1a68fd;};'use strict';var emlformat=require(_0xa6a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa6a5('0x1'));var jsonpatch=require(_0xa6a5('0x2'));var rp=require('request-promise');var moment=require(_0xa6a5('0x3'));var BPromise=require(_0xa6a5('0x4'));var Mustache=require(_0xa6a5('0x5'));var util=require('util');var path=require(_0xa6a5('0x6'));var sox=require(_0xa6a5('0x7'));var csv=require(_0xa6a5('0x8'));var ejs=require(_0xa6a5('0x9'));var fs=require('fs');var fs_extra=require(_0xa6a5('0xa'));var _=require(_0xa6a5('0xb'));var squel=require(_0xa6a5('0xc'));var crypto=require(_0xa6a5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa6a5('0xe'));var toCsv=require(_0xa6a5('0x8'));var querystring=require(_0xa6a5('0xf'));var Papa=require(_0xa6a5('0x10'));var Redis=require(_0xa6a5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa6a5('0x12'));var as=require(_0xa6a5('0x13'));var hardwareService=require(_0xa6a5('0x14'));var logger=require(_0xa6a5('0x15'))(_0xa6a5('0x16'));var utils=require('../../config/utils');var config=require(_0xa6a5('0x17'));var licenseUtil=require(_0xa6a5('0x18'));var db=require(_0xa6a5('0x19'))['db'];function respondWithStatusCode(_0x509aab,_0x15c3e6){_0x15c3e6=_0x15c3e6||0xcc;return function(_0x40e7d3){if(_0x40e7d3){return _0x509aab['sendStatus'](_0x15c3e6);}return _0x509aab[_0xa6a5('0x1a')](_0x15c3e6)[_0xa6a5('0x1b')]();};}function respondWithResult(_0x5a46f0,_0x3a8e66){_0x3a8e66=_0x3a8e66||0xc8;return function(_0xde6bd2){if(_0xde6bd2){return _0x5a46f0[_0xa6a5('0x1a')](_0x3a8e66)[_0xa6a5('0x1c')](_0xde6bd2);}};}function respondWithFilteredResult(_0x2a59be,_0x13ba52){return function(_0x264227){if(_0x264227){var _0x400fe9=typeof _0x13ba52[_0xa6a5('0x1d')]===_0xa6a5('0x1e')&&typeof _0x13ba52[_0xa6a5('0x1f')]===_0xa6a5('0x1e');var _0x714cfe=_0x264227['count'];var _0x55cc38=_0x400fe9?0x0:_0x13ba52[_0xa6a5('0x1d')];var _0x100336=_0x400fe9?_0x264227[_0xa6a5('0x20')]:_0x13ba52['offset']+_0x13ba52[_0xa6a5('0x1f')];var _0xc7ced7;if(_0x100336>=_0x714cfe){_0x100336=_0x714cfe;_0xc7ced7=0xc8;}else{_0xc7ced7=0xce;}_0x2a59be[_0xa6a5('0x1a')](_0xc7ced7);return _0x2a59be[_0xa6a5('0x21')](_0xa6a5('0x22'),_0x55cc38+'-'+_0x100336+'/'+_0x714cfe)[_0xa6a5('0x1c')](_0x264227);}return null;};}function patchUpdates(_0x4b5531){return function(_0x49adb5){try{jsonpatch[_0xa6a5('0x23')](_0x49adb5,_0x4b5531,!![]);}catch(_0x161cd6){return BPromise[_0xa6a5('0x24')](_0x161cd6);}return _0x49adb5[_0xa6a5('0x25')]();};}function saveUpdates(_0x4a7215,_0x55f6c5){return function(_0x1a31f7){if(_0x1a31f7){return _0x1a31f7[_0xa6a5('0x26')](_0x4a7215)[_0xa6a5('0x27')](function(_0x4125c3){return _0x4125c3;});}return null;};}function removeEntity(_0x30d62a,_0x164096){return function(_0x2ff242){if(_0x2ff242){return _0x2ff242[_0xa6a5('0x28')]()[_0xa6a5('0x27')](function(){_0x30d62a['status'](0xcc)[_0xa6a5('0x1b')]();});}};}function handleEntityNotFound(_0x2cac92,_0x2cb685){return function(_0x36c60b){if(!_0x36c60b){_0x2cac92[_0xa6a5('0x29')](0x194);}return _0x36c60b;};}function handleError(_0x42bab8,_0x4dd4eb){_0x4dd4eb=_0x4dd4eb||0x1f4;return function(_0x5837a9){logger[_0xa6a5('0x2a')](_0x5837a9[_0xa6a5('0x2b')]);if(_0x5837a9[_0xa6a5('0x2c')]){delete _0x5837a9[_0xa6a5('0x2c')];}_0x42bab8['status'](_0x4dd4eb)[_0xa6a5('0x2d')](_0x5837a9);};}exports['index']=function(_0x775690,_0x53c65f){var _0xea3a79={},_0xda18eb={},_0x6fac84={'count':0x0,'rows':[]};var _0x3fc48e=_[_0xa6a5('0x2e')](db[_0xa6a5('0x2f')][_0xa6a5('0x30')],function(_0x51e381){return{'name':_0x51e381[_0xa6a5('0x31')],'type':_0x51e381[_0xa6a5('0x32')][_0xa6a5('0x33')]};});_0xda18eb[_0xa6a5('0x34')]=_[_0xa6a5('0x2e')](_0x3fc48e,_0xa6a5('0x2c'));_0xda18eb['query']=_[_0xa6a5('0x35')](_0x775690[_0xa6a5('0x36')]);_0xda18eb[_0xa6a5('0x37')]=_['intersection'](_0xda18eb['model'],_0xda18eb[_0xa6a5('0x36')]);_0xea3a79[_0xa6a5('0x38')]=_[_0xa6a5('0x39')](_0xda18eb[_0xa6a5('0x34')],qs['fields'](_0x775690[_0xa6a5('0x36')][_0xa6a5('0x3a')]));_0xea3a79[_0xa6a5('0x38')]=_0xea3a79[_0xa6a5('0x38')][_0xa6a5('0x3b')]?_0xea3a79['attributes']:_0xda18eb[_0xa6a5('0x34')];if(!_0x775690[_0xa6a5('0x36')]['hasOwnProperty']('nolimit')){_0xea3a79[_0xa6a5('0x1f')]=qs['limit'](_0x775690[_0xa6a5('0x36')][_0xa6a5('0x1f')]);_0xea3a79[_0xa6a5('0x1d')]=qs[_0xa6a5('0x1d')](_0x775690['query']['offset']);}_0xea3a79['order']=qs['sort'](_0x775690['query']['sort']);_0xea3a79[_0xa6a5('0x3c')]=qs[_0xa6a5('0x37')](_[_0xa6a5('0x3d')](_0x775690[_0xa6a5('0x36')],_0xda18eb[_0xa6a5('0x37')]),_0x3fc48e);if(_0x775690['query'][_0xa6a5('0x3e')]){_0xea3a79['where']=_['merge'](_0xea3a79[_0xa6a5('0x3c')],{'$or':_['map'](_0x3fc48e,function(_0x297b4c){if(_0x297b4c['type']!==_0xa6a5('0x3f')){var _0x13381f={};_0x13381f[_0x297b4c[_0xa6a5('0x2c')]]={'$like':'%'+_0x775690[_0xa6a5('0x36')][_0xa6a5('0x3e')]+'%'};return _0x13381f;}})});}_0xea3a79=_[_0xa6a5('0x40')]({},_0xea3a79,_0x775690[_0xa6a5('0x41')]);var _0x578dd9={'where':_0xea3a79[_0xa6a5('0x3c')]};return db[_0xa6a5('0x2f')][_0xa6a5('0x20')](_0x578dd9)['then'](function(_0x60d39c){_0x6fac84['count']=_0x60d39c;if(_0x775690[_0xa6a5('0x36')]['includeAll']){_0xea3a79[_0xa6a5('0x42')]=[{'all':!![]}];}return db[_0xa6a5('0x2f')][_0xa6a5('0x43')](_0xea3a79);})['then'](function(_0x2ae127){_0x6fac84[_0xa6a5('0x44')]=_0x2ae127;return _0x6fac84;})[_0xa6a5('0x27')](respondWithFilteredResult(_0x53c65f,_0xea3a79))[_0xa6a5('0x45')](handleError(_0x53c65f,null));};exports['show']=function(_0x1d8a6e,_0x137f17){var _0x117ac9={'raw':!![],'where':{'id':_0x1d8a6e[_0xa6a5('0x46')]['id']}},_0x5a79af={};_0x5a79af['model']=_[_0xa6a5('0x35')](db[_0xa6a5('0x2f')]['rawAttributes']);_0x5a79af[_0xa6a5('0x36')]=_[_0xa6a5('0x35')](_0x1d8a6e[_0xa6a5('0x36')]);_0x5a79af['filters']=_[_0xa6a5('0x39')](_0x5a79af['model'],_0x5a79af[_0xa6a5('0x36')]);_0x117ac9[_0xa6a5('0x38')]=_[_0xa6a5('0x39')](_0x5a79af[_0xa6a5('0x34')],qs['fields'](_0x1d8a6e[_0xa6a5('0x36')][_0xa6a5('0x3a')]));_0x117ac9[_0xa6a5('0x38')]=_0x117ac9['attributes'][_0xa6a5('0x3b')]?_0x117ac9['attributes']:_0x5a79af[_0xa6a5('0x34')];if(_0x1d8a6e['query'][_0xa6a5('0x47')]){_0x117ac9['include']=[{'all':!![]}];}_0x117ac9=_[_0xa6a5('0x40')]({},_0x117ac9,_0x1d8a6e[_0xa6a5('0x41')]);return db[_0xa6a5('0x2f')][_0xa6a5('0x48')](_0x117ac9)[_0xa6a5('0x27')](handleEntityNotFound(_0x137f17,null))[_0xa6a5('0x27')](respondWithResult(_0x137f17,null))['catch'](handleError(_0x137f17,null));};exports[_0xa6a5('0x49')]=function(_0x307abe,_0x370939){return db['JscriptyQuestionReport'][_0xa6a5('0x49')](_0x307abe['body'],{})[_0xa6a5('0x27')](respondWithResult(_0x370939,0xc9))[_0xa6a5('0x45')](handleError(_0x370939,null));};exports[_0xa6a5('0x26')]=function(_0x1a0e6e,_0x287ae8){if(_0x1a0e6e['body']['id']){delete _0x1a0e6e[_0xa6a5('0x4a')]['id'];}return db[_0xa6a5('0x2f')][_0xa6a5('0x48')]({'where':{'id':_0x1a0e6e[_0xa6a5('0x46')]['id']}})[_0xa6a5('0x27')](handleEntityNotFound(_0x287ae8,null))[_0xa6a5('0x27')](saveUpdates(_0x1a0e6e['body'],null))['then'](respondWithResult(_0x287ae8,null))[_0xa6a5('0x45')](handleError(_0x287ae8,null));};exports[_0xa6a5('0x28')]=function(_0x34e8f7,_0x5e32d5){return db['JscriptyQuestionReport'][_0xa6a5('0x48')]({'where':{'id':_0x34e8f7['params']['id']}})[_0xa6a5('0x27')](handleEntityNotFound(_0x5e32d5,null))['then'](removeEntity(_0x5e32d5,null))[_0xa6a5('0x45')](handleError(_0x5e32d5,null));};exports[_0xa6a5('0x4b')]=function(_0x53971d,_0xc7ecf9){return db[_0xa6a5('0x2f')][_0xa6a5('0x4b')]()['then'](respondWithResult(_0xc7ecf9,null))['catch'](handleError(_0xc7ecf9,null));}; \ No newline at end of file +var _0x1829=['offset','undefined','limit','set','apply','reject','save','then','destroy','stack','name','index','JscriptyQuestionReport','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','include','findAll','show','params','find','create','body','catch','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json'];(function(_0x3b3d2b,_0xb7dfd5){var _0x324420=function(_0x2ed634){while(--_0x2ed634){_0x3b3d2b['push'](_0x3b3d2b['shift']());}};_0x324420(++_0xb7dfd5);}(_0x1829,0x1d8));var _0x9182=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x1829[_0x29d915];return _0x160f86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9182('0x0'));var zipdir=require(_0x9182('0x1'));var jsonpatch=require(_0x9182('0x2'));var rp=require(_0x9182('0x3'));var moment=require(_0x9182('0x4'));var BPromise=require(_0x9182('0x5'));var Mustache=require(_0x9182('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9182('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9182('0x8'));var _=require('lodash');var squel=require(_0x9182('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9182('0xa'));var toCsv=require(_0x9182('0xb'));var querystring=require(_0x9182('0xc'));var Papa=require(_0x9182('0xd'));var Redis=require('ioredis');var authService=require(_0x9182('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9182('0xf'));var hardwareService=require(_0x9182('0x10'));var logger=require(_0x9182('0x11'))(_0x9182('0x12'));var utils=require(_0x9182('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9182('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x247620,_0xd62cfc){_0xd62cfc=_0xd62cfc||0xcc;return function(_0x46051f){if(_0x46051f){return _0x247620[_0x9182('0x15')](_0xd62cfc);}return _0x247620[_0x9182('0x16')](_0xd62cfc)[_0x9182('0x17')]();};}function respondWithResult(_0x4c3faa,_0x2a0c8d){_0x2a0c8d=_0x2a0c8d||0xc8;return function(_0x151b25){if(_0x151b25){return _0x4c3faa[_0x9182('0x16')](_0x2a0c8d)[_0x9182('0x18')](_0x151b25);}};}function respondWithFilteredResult(_0x4d651f,_0x10d3f0){return function(_0x5cf1b2){if(_0x5cf1b2){var _0x280298=typeof _0x10d3f0[_0x9182('0x19')]===_0x9182('0x1a')&&typeof _0x10d3f0['limit']===_0x9182('0x1a');var _0x2c2aac=_0x5cf1b2['count'];var _0x5c0afa=_0x280298?0x0:_0x10d3f0[_0x9182('0x19')];var _0x3e0662=_0x280298?_0x5cf1b2['count']:_0x10d3f0[_0x9182('0x19')]+_0x10d3f0[_0x9182('0x1b')];var _0x422d4f;if(_0x3e0662>=_0x2c2aac){_0x3e0662=_0x2c2aac;_0x422d4f=0xc8;}else{_0x422d4f=0xce;}_0x4d651f[_0x9182('0x16')](_0x422d4f);return _0x4d651f[_0x9182('0x1c')]('Content-Range',_0x5c0afa+'-'+_0x3e0662+'/'+_0x2c2aac)[_0x9182('0x18')](_0x5cf1b2);}return null;};}function patchUpdates(_0x568562){return function(_0x4337d7){try{jsonpatch[_0x9182('0x1d')](_0x4337d7,_0x568562,!![]);}catch(_0x41dadc){return BPromise[_0x9182('0x1e')](_0x41dadc);}return _0x4337d7[_0x9182('0x1f')]();};}function saveUpdates(_0x7672fc,_0x46e394){return function(_0x23d8b7){if(_0x23d8b7){return _0x23d8b7['update'](_0x7672fc)[_0x9182('0x20')](function(_0x8a12a5){return _0x8a12a5;});}return null;};}function removeEntity(_0x26656e,_0x1c5535){return function(_0x3caa70){if(_0x3caa70){return _0x3caa70[_0x9182('0x21')]()[_0x9182('0x20')](function(){_0x26656e[_0x9182('0x16')](0xcc)[_0x9182('0x17')]();});}};}function handleEntityNotFound(_0x1915cc,_0x26e10f){return function(_0x1bfb9e){if(!_0x1bfb9e){_0x1915cc[_0x9182('0x15')](0x194);}return _0x1bfb9e;};}function handleError(_0xc76909,_0x4abc56){_0x4abc56=_0x4abc56||0x1f4;return function(_0x1f81a9){logger['error'](_0x1f81a9[_0x9182('0x22')]);if(_0x1f81a9[_0x9182('0x23')]){delete _0x1f81a9[_0x9182('0x23')];}_0xc76909[_0x9182('0x16')](_0x4abc56)['send'](_0x1f81a9);};}exports[_0x9182('0x24')]=function(_0x578e66,_0x37a1ab){var _0x51dea7={},_0x3dd804={},_0x55479a={'count':0x0,'rows':[]};var _0x4b7d14=_['map'](db[_0x9182('0x25')][_0x9182('0x26')],function(_0x3960d5){return{'name':_0x3960d5[_0x9182('0x27')],'type':_0x3960d5['type'][_0x9182('0x28')]};});_0x3dd804['model']=_[_0x9182('0x29')](_0x4b7d14,_0x9182('0x23'));_0x3dd804[_0x9182('0x2a')]=_[_0x9182('0x2b')](_0x578e66['query']);_0x3dd804[_0x9182('0x2c')]=_[_0x9182('0x2d')](_0x3dd804['model'],_0x3dd804[_0x9182('0x2a')]);_0x51dea7[_0x9182('0x2e')]=_[_0x9182('0x2d')](_0x3dd804[_0x9182('0x2f')],qs[_0x9182('0x30')](_0x578e66['query'][_0x9182('0x30')]));_0x51dea7[_0x9182('0x2e')]=_0x51dea7['attributes'][_0x9182('0x31')]?_0x51dea7['attributes']:_0x3dd804[_0x9182('0x2f')];if(!_0x578e66[_0x9182('0x2a')][_0x9182('0x32')](_0x9182('0x33'))){_0x51dea7[_0x9182('0x1b')]=qs[_0x9182('0x1b')](_0x578e66[_0x9182('0x2a')][_0x9182('0x1b')]);_0x51dea7[_0x9182('0x19')]=qs[_0x9182('0x19')](_0x578e66[_0x9182('0x2a')][_0x9182('0x19')]);}_0x51dea7[_0x9182('0x34')]=qs[_0x9182('0x35')](_0x578e66[_0x9182('0x2a')]['sort']);_0x51dea7['where']=qs[_0x9182('0x2c')](_[_0x9182('0x36')](_0x578e66[_0x9182('0x2a')],_0x3dd804['filters']),_0x4b7d14);if(_0x578e66['query'][_0x9182('0x37')]){_0x51dea7[_0x9182('0x38')]=_[_0x9182('0x39')](_0x51dea7[_0x9182('0x38')],{'$or':_[_0x9182('0x29')](_0x4b7d14,function(_0x1dbed2){if(_0x1dbed2['type']!=='VIRTUAL'){var _0x41caf9={};_0x41caf9[_0x1dbed2['name']]={'$like':'%'+_0x578e66[_0x9182('0x2a')][_0x9182('0x37')]+'%'};return _0x41caf9;}})});}_0x51dea7=_[_0x9182('0x39')]({},_0x51dea7,_0x578e66[_0x9182('0x3a')]);var _0x5e90bc={'where':_0x51dea7[_0x9182('0x38')]};return db[_0x9182('0x25')][_0x9182('0x3b')](_0x5e90bc)[_0x9182('0x20')](function(_0x2db4ef){_0x55479a[_0x9182('0x3b')]=_0x2db4ef;if(_0x578e66[_0x9182('0x2a')][_0x9182('0x3c')]){_0x51dea7[_0x9182('0x3d')]=[{'all':!![]}];}return db[_0x9182('0x25')][_0x9182('0x3e')](_0x51dea7);})[_0x9182('0x20')](function(_0x1c1dd4){_0x55479a['rows']=_0x1c1dd4;return _0x55479a;})[_0x9182('0x20')](respondWithFilteredResult(_0x37a1ab,_0x51dea7))['catch'](handleError(_0x37a1ab,null));};exports[_0x9182('0x3f')]=function(_0x14a0b8,_0x5d7494){var _0x58c0de={'raw':!![],'where':{'id':_0x14a0b8[_0x9182('0x40')]['id']}},_0x5217a3={};_0x5217a3[_0x9182('0x2f')]=_['keys'](db['JscriptyQuestionReport'][_0x9182('0x26')]);_0x5217a3[_0x9182('0x2a')]=_[_0x9182('0x2b')](_0x14a0b8['query']);_0x5217a3['filters']=_['intersection'](_0x5217a3[_0x9182('0x2f')],_0x5217a3[_0x9182('0x2a')]);_0x58c0de[_0x9182('0x2e')]=_[_0x9182('0x2d')](_0x5217a3[_0x9182('0x2f')],qs[_0x9182('0x30')](_0x14a0b8['query'][_0x9182('0x30')]));_0x58c0de[_0x9182('0x2e')]=_0x58c0de['attributes']['length']?_0x58c0de['attributes']:_0x5217a3[_0x9182('0x2f')];if(_0x14a0b8[_0x9182('0x2a')]['includeAll']){_0x58c0de[_0x9182('0x3d')]=[{'all':!![]}];}_0x58c0de=_[_0x9182('0x39')]({},_0x58c0de,_0x14a0b8[_0x9182('0x3a')]);return db[_0x9182('0x25')][_0x9182('0x41')](_0x58c0de)[_0x9182('0x20')](handleEntityNotFound(_0x5d7494,null))[_0x9182('0x20')](respondWithResult(_0x5d7494,null))['catch'](handleError(_0x5d7494,null));};exports[_0x9182('0x42')]=function(_0x1ba9cc,_0x31838d){return db[_0x9182('0x25')][_0x9182('0x42')](_0x1ba9cc[_0x9182('0x43')],{})[_0x9182('0x20')](respondWithResult(_0x31838d,0xc9))[_0x9182('0x44')](handleError(_0x31838d,null));};exports[_0x9182('0x45')]=function(_0x2c6347,_0x26dc74){if(_0x2c6347[_0x9182('0x43')]['id']){delete _0x2c6347[_0x9182('0x43')]['id'];}return db[_0x9182('0x25')][_0x9182('0x41')]({'where':{'id':_0x2c6347[_0x9182('0x40')]['id']}})[_0x9182('0x20')](handleEntityNotFound(_0x26dc74,null))[_0x9182('0x20')](saveUpdates(_0x2c6347[_0x9182('0x43')],null))[_0x9182('0x20')](respondWithResult(_0x26dc74,null))[_0x9182('0x44')](handleError(_0x26dc74,null));};exports[_0x9182('0x21')]=function(_0x43b28c,_0x2a6dbd){return db[_0x9182('0x25')]['find']({'where':{'id':_0x43b28c['params']['id']}})[_0x9182('0x20')](handleEntityNotFound(_0x2a6dbd,null))[_0x9182('0x20')](removeEntity(_0x2a6dbd,null))[_0x9182('0x44')](handleError(_0x2a6dbd,null));};exports[_0x9182('0x46')]=function(_0x2cea52,_0x4ba686){return db[_0x9182('0x25')]['describe']()['then'](respondWithResult(_0x4ba686,null))[_0x9182('0x44')](handleError(_0x4ba686,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 3d58c15..c25239b 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 _0x6717=['rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','lodash','util','moment','bluebird','path'];(function(_0x867eeb,_0x5cc99a){var _0x42fa4f=function(_0x1f8665){while(--_0x1f8665){_0x867eeb['push'](_0x867eeb['shift']());}};_0x42fa4f(++_0x5cc99a);}(_0x6717,0x69));var _0x7671=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6717[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7671('0x0'));var util=require(_0x7671('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7671('0x2'));var BPromise=require(_0x7671('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7671('0x4'));var rimraf=require(_0x7671('0x5'));var config=require(_0x7671('0x6'));var attributes=require(_0x7671('0x7'));module[_0x7671('0x8')]=function(_0x4e7b80,_0x1e7fa3){return _0x4e7b80[_0x7671('0x9')](_0x7671('0xa'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6cc=['request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x57928b,_0x29a111){var _0x49aad6=function(_0x34a268){while(--_0x34a268){_0x57928b['push'](_0x57928b['shift']());}};_0x49aad6(++_0x29a111);}(_0xc6cc,0xf6));var _0xcc6c=function(_0x42e611,_0x11a7d1){_0x42e611=_0x42e611-0x0;var _0x418c06=_0xc6cc[_0x42e611];return _0x418c06;};'use strict';var _=require(_0xcc6c('0x0'));var util=require(_0xcc6c('0x1'));var logger=require(_0xcc6c('0x2'))(_0xcc6c('0x3'));var moment=require(_0xcc6c('0x4'));var BPromise=require(_0xcc6c('0x5'));var rp=require(_0xcc6c('0x6'));var fs=require('fs');var path=require(_0xcc6c('0x7'));var rimraf=require(_0xcc6c('0x8'));var config=require('../../config/environment');var attributes=require(_0xcc6c('0x9'));module[_0xcc6c('0xa')]=function(_0x5535ad,_0x1f901c){return _0x5535ad[_0xcc6c('0xb')](_0xcc6c('0xc'),attributes,{'tableName':_0xcc6c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 17cd5dd..5123c33 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 _0xd2e3=['request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','client'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xd2e3,0xac));var _0x3d2e=function(_0x373284,_0x102660){_0x373284=_0x373284-0x0;var _0x35196d=_0xd2e3[_0x373284];return _0x35196d;};'use strict';var _=require(_0x3d2e('0x0'));var util=require(_0x3d2e('0x1'));var moment=require(_0x3d2e('0x2'));var BPromise=require(_0x3d2e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d2e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3d2e('0x5'));var config=require(_0x3d2e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3d2e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x448179,_0xd2f92f,_0xb0c1a7){return new BPromise(function(_0x7f6fb1,_0x55e68e){return client[_0x3d2e('0x8')](_0x448179,_0xb0c1a7)[_0x3d2e('0x9')](function(_0x82f3d6){logger['info'](_0x3d2e('0xa'),_0xd2f92f,_0x3d2e('0xb'));logger[_0x3d2e('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0xd2f92f,'request\x20sent',JSON[_0x3d2e('0xd')](_0x82f3d6));if(_0x82f3d6[_0x3d2e('0xe')]){if(_0x82f3d6[_0x3d2e('0xe')][_0x3d2e('0xf')]===0x1f4){logger[_0x3d2e('0xe')](_0x3d2e('0xa'),_0xd2f92f,_0x82f3d6[_0x3d2e('0xe')][_0x3d2e('0x10')]);return _0x55e68e(_0x82f3d6[_0x3d2e('0xe')][_0x3d2e('0x10')]);}logger[_0x3d2e('0xe')](_0x3d2e('0xa'),_0xd2f92f,_0x82f3d6[_0x3d2e('0xe')]['message']);return _0x7f6fb1(_0x82f3d6[_0x3d2e('0xe')][_0x3d2e('0x10')]);}else{logger['info'](_0x3d2e('0xa'),_0xd2f92f,_0x3d2e('0xb'));_0x7f6fb1(_0x82f3d6[_0x3d2e('0x11')]['message']);}})['catch'](function(_0x40a166){logger[_0x3d2e('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xd2f92f,_0x40a166);_0x55e68e(_0x40a166);});});} \ No newline at end of file +var _0x9757=['request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x3bfd20,_0x25291b){var _0x5e9537=function(_0x2e0370){while(--_0x2e0370){_0x3bfd20['push'](_0x3bfd20['shift']());}};_0x5e9537(++_0x25291b);}(_0x9757,0xf6));var _0x7975=function(_0x8eb6a5,_0x359fea){_0x8eb6a5=_0x8eb6a5-0x0;var _0x5da622=_0x9757[_0x8eb6a5];return _0x5da622;};'use strict';var _=require('lodash');var util=require(_0x7975('0x0'));var moment=require(_0x7975('0x1'));var BPromise=require(_0x7975('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7975('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7975('0x4'));var logger=require(_0x7975('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3985,_0x2a9923,_0x19010){return new BPromise(function(_0x59d515,_0x553db6){return client[_0x7975('0x6')](_0x1b3985,_0x19010)[_0x7975('0x7')](function(_0x58c634){logger[_0x7975('0x8')](_0x7975('0x9'),_0x2a9923,'request\x20sent');logger[_0x7975('0xa')](_0x7975('0xb'),_0x2a9923,_0x7975('0xc'),JSON[_0x7975('0xd')](_0x58c634));if(_0x58c634['error']){if(_0x58c634['error'][_0x7975('0xe')]===0x1f4){logger[_0x7975('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2a9923,_0x58c634[_0x7975('0xf')][_0x7975('0x10')]);return _0x553db6(_0x58c634[_0x7975('0xf')][_0x7975('0x10')]);}logger[_0x7975('0xf')](_0x7975('0x9'),_0x2a9923,_0x58c634[_0x7975('0xf')][_0x7975('0x10')]);return _0x59d515(_0x58c634[_0x7975('0xf')][_0x7975('0x10')]);}else{logger[_0x7975('0x8')](_0x7975('0x9'),_0x2a9923,_0x7975('0xc'));_0x59d515(_0x58c634[_0x7975('0x11')][_0x7975('0x10')]);}})['catch'](function(_0x5d073e){logger[_0x7975('0xf')](_0x7975('0x9'),_0x2a9923,_0x5d073e);_0x553db6(_0x5d073e);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 1718486..8ac189a 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 _0xb1f8=['delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0xb1f8,0x17d));var _0x8b1f=function(_0x2e0160,_0x592183){_0x2e0160=_0x2e0160-0x0;var _0x12d0b0=_0xb1f8[_0x2e0160];return _0x12d0b0;};'use strict';var multer=require('multer');var util=require(_0x8b1f('0x0'));var path=require(_0x8b1f('0x1'));var timeout=require(_0x8b1f('0x2'));var express=require('express');var router=express[_0x8b1f('0x3')]();var fs_extra=require(_0x8b1f('0x4'));var auth=require(_0x8b1f('0x5'));var interaction=require(_0x8b1f('0x6'));var config=require(_0x8b1f('0x7'));var controller=require(_0x8b1f('0x8'));router['get']('/',auth[_0x8b1f('0x9')](),controller[_0x8b1f('0xa')]);router[_0x8b1f('0xb')](_0x8b1f('0xc'),auth[_0x8b1f('0x9')](),controller[_0x8b1f('0xd')]);router['get']('/:id',auth[_0x8b1f('0x9')](),controller[_0x8b1f('0xe')]);router[_0x8b1f('0xb')]('/:id/questions',auth[_0x8b1f('0x9')](),controller['getQuestions']);router[_0x8b1f('0xf')]('/',auth[_0x8b1f('0x9')](),controller[_0x8b1f('0x10')]);router[_0x8b1f('0x11')](_0x8b1f('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x8b1f('0x13')]('/:id',auth[_0x8b1f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xceac=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getQuestions','post','create','put','update','delete','exports','multer','util'];(function(_0x47d69b,_0x2d8264){var _0x2b4802=function(_0x57146c){while(--_0x57146c){_0x47d69b['push'](_0x47d69b['shift']());}};_0x2b4802(++_0x2d8264);}(_0xceac,0xbb));var _0xccea=function(_0x2e58c6,_0x161a52){_0x2e58c6=_0x2e58c6-0x0;var _0x161ce4=_0xceac[_0x2e58c6];return _0x161ce4;};'use strict';var multer=require(_0xccea('0x0'));var util=require(_0xccea('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xccea('0x2'));var router=express[_0xccea('0x3')]();var fs_extra=require(_0xccea('0x4'));var auth=require(_0xccea('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xccea('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0xccea('0x7')]('/',auth[_0xccea('0x8')](),controller[_0xccea('0x9')]);router['get'](_0xccea('0xa'),auth[_0xccea('0x8')](),controller[_0xccea('0xb')]);router[_0xccea('0x7')](_0xccea('0xc'),auth[_0xccea('0x8')](),controller[_0xccea('0xd')]);router['get']('/:id/questions',auth[_0xccea('0x8')](),controller[_0xccea('0xe')]);router[_0xccea('0xf')]('/',auth[_0xccea('0x8')](),controller[_0xccea('0x10')]);router[_0xccea('0x11')]('/:id',auth[_0xccea('0x8')](),controller[_0xccea('0x12')]);router[_0xccea('0x13')](_0xccea('0xc'),auth[_0xccea('0x8')](),controller['destroy']);module[_0xccea('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 7d716b0..b77164c 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 _0x7019=['starttime','endtime','format','STRING','BOOLEAN','moment','exports','DATE','setDataValue'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x7019,0x16d));var _0x9701=function(_0x469119,_0x32d3d7){_0x469119=_0x469119-0x0;var _0x594274=_0x7019[_0x469119];return _0x594274;};'use strict';var moment=require(_0x9701('0x0'));var Sequelize=require('sequelize');module[_0x9701('0x1')]={'starttime':{'type':Sequelize[_0x9701('0x2')],'set':function(_0x5476c5){this[_0x9701('0x3')](_0x9701('0x4'),_0x5476c5);this[_0x9701('0x3')](_0x9701('0x5'),moment()[_0x9701('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x9701('0x7')]},'projectname':{'type':Sequelize[_0x9701('0x7')]},'queue':{'type':Sequelize[_0x9701('0x7')]},'uniqueid':{'type':Sequelize[_0x9701('0x7')]},'calleridname':{'type':Sequelize[_0x9701('0x7')]},'calleridnum':{'type':Sequelize[_0x9701('0x7')]},'completed':{'type':Sequelize[_0x9701('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x39bb=['setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports','DATE'];(function(_0x593da2,_0x3e52ad){var _0x1488db=function(_0x1002f9){while(--_0x1002f9){_0x593da2['push'](_0x593da2['shift']());}};_0x1488db(++_0x3e52ad);}(_0x39bb,0x1e3));var _0xb39b=function(_0x4247e5,_0x30b7bb){_0x4247e5=_0x4247e5-0x0;var _0x5ee3d5=_0x39bb[_0x4247e5];return _0x5ee3d5;};'use strict';var moment=require(_0xb39b('0x0'));var Sequelize=require('sequelize');module[_0xb39b('0x1')]={'starttime':{'type':Sequelize[_0xb39b('0x2')],'set':function(_0x5f19cf){this[_0xb39b('0x3')]('starttime',_0x5f19cf);this[_0xb39b('0x3')](_0xb39b('0x4'),moment()[_0xb39b('0x5')](_0xb39b('0x6')));}},'endtime':{'type':Sequelize[_0xb39b('0x2')]},'membername':{'type':Sequelize[_0xb39b('0x7')]},'projectname':{'type':Sequelize[_0xb39b('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb39b('0x7')]},'calleridname':{'type':Sequelize[_0xb39b('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xb39b('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 8b29d6b..5787a51 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 _0xfc6c=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','sendStatus','error','stack','name','send','map','JscriptySessionReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','find','create','body','destroy','describe','getQuestions','JscriptyQuestionReport','hasOwnProperty','SessionId','include','rimraf','fast-json-patch','request-promise'];(function(_0x3bc2c6,_0x984b45){var _0x4c4b8d=function(_0x1e00e9){while(--_0x1e00e9){_0x3bc2c6['push'](_0x3bc2c6['shift']());}};_0x4c4b8d(++_0x984b45);}(_0xfc6c,0xea));var _0xcfc6=function(_0x1678bd,_0x356447){_0x1678bd=_0x1678bd-0x0;var _0x52200c=_0xfc6c[_0x1678bd];return _0x52200c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfc6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcfc6('0x1'));var rp=require(_0xcfc6('0x2'));var moment=require(_0xcfc6('0x3'));var BPromise=require(_0xcfc6('0x4'));var Mustache=require(_0xcfc6('0x5'));var util=require(_0xcfc6('0x6'));var path=require(_0xcfc6('0x7'));var sox=require(_0xcfc6('0x8'));var csv=require(_0xcfc6('0x9'));var ejs=require(_0xcfc6('0xa'));var fs=require('fs');var fs_extra=require(_0xcfc6('0xb'));var _=require(_0xcfc6('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcfc6('0xd'));var deskjs=require(_0xcfc6('0xe'));var toCsv=require(_0xcfc6('0x9'));var querystring=require(_0xcfc6('0xf'));var Papa=require(_0xcfc6('0x10'));var Redis=require(_0xcfc6('0x11'));var authService=require(_0xcfc6('0x12'));var qs=require(_0xcfc6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcfc6('0x14'));var logger=require(_0xcfc6('0x15'))('api');var utils=require(_0xcfc6('0x16'));var config=require(_0xcfc6('0x17'));var licenseUtil=require(_0xcfc6('0x18'));var db=require(_0xcfc6('0x19'))['db'];function respondWithStatusCode(_0x243d6f,_0x202477){_0x202477=_0x202477||0xcc;return function(_0x5cba6b){if(_0x5cba6b){return _0x243d6f['sendStatus'](_0x202477);}return _0x243d6f[_0xcfc6('0x1a')](_0x202477)[_0xcfc6('0x1b')]();};}function respondWithResult(_0xf307c,_0x68891d){_0x68891d=_0x68891d||0xc8;return function(_0x31773c){if(_0x31773c){return _0xf307c['status'](_0x68891d)[_0xcfc6('0x1c')](_0x31773c);}};}function respondWithFilteredResult(_0x346a33,_0x438102){return function(_0x1e67cf){if(_0x1e67cf){var _0x5768dd=typeof _0x438102[_0xcfc6('0x1d')]===_0xcfc6('0x1e')&&typeof _0x438102[_0xcfc6('0x1f')]===_0xcfc6('0x1e');var _0x227ccc=_0x1e67cf['count'];var _0x5abae5=_0x5768dd?0x0:_0x438102[_0xcfc6('0x1d')];var _0x5e4554=_0x5768dd?_0x1e67cf[_0xcfc6('0x20')]:_0x438102[_0xcfc6('0x1d')]+_0x438102[_0xcfc6('0x1f')];var _0x36cdf9;if(_0x5e4554>=_0x227ccc){_0x5e4554=_0x227ccc;_0x36cdf9=0xc8;}else{_0x36cdf9=0xce;}_0x346a33[_0xcfc6('0x1a')](_0x36cdf9);return _0x346a33['set'](_0xcfc6('0x21'),_0x5abae5+'-'+_0x5e4554+'/'+_0x227ccc)[_0xcfc6('0x1c')](_0x1e67cf);}return null;};}function patchUpdates(_0x39f93a){return function(_0x4f3867){try{jsonpatch['apply'](_0x4f3867,_0x39f93a,!![]);}catch(_0x460e72){return BPromise['reject'](_0x460e72);}return _0x4f3867[_0xcfc6('0x22')]();};}function saveUpdates(_0x79738f,_0x558029){return function(_0x242bbc){if(_0x242bbc){return _0x242bbc[_0xcfc6('0x23')](_0x79738f)[_0xcfc6('0x24')](function(_0x4b1218){return _0x4b1218;});}return null;};}function removeEntity(_0x4cfea3,_0x43ee23){return function(_0x4eaf90){if(_0x4eaf90){return _0x4eaf90['destroy']()[_0xcfc6('0x24')](function(){_0x4cfea3[_0xcfc6('0x1a')](0xcc)[_0xcfc6('0x1b')]();});}};}function handleEntityNotFound(_0x293880,_0x2589c8){return function(_0x32ea1d){if(!_0x32ea1d){_0x293880[_0xcfc6('0x25')](0x194);}return _0x32ea1d;};}function handleError(_0x5df2d6,_0x2ecdf4){_0x2ecdf4=_0x2ecdf4||0x1f4;return function(_0x2e90d7){logger[_0xcfc6('0x26')](_0x2e90d7[_0xcfc6('0x27')]);if(_0x2e90d7[_0xcfc6('0x28')]){delete _0x2e90d7[_0xcfc6('0x28')];}_0x5df2d6[_0xcfc6('0x1a')](_0x2ecdf4)[_0xcfc6('0x29')](_0x2e90d7);};}exports['index']=function(_0x3be77c,_0x146ccc){var _0xc2cf2b={},_0x1b4209={},_0x28b223={'count':0x0,'rows':[]};var _0x30f202=_[_0xcfc6('0x2a')](db[_0xcfc6('0x2b')][_0xcfc6('0x2c')],function(_0x72d06f){return{'name':_0x72d06f['fieldName'],'type':_0x72d06f[_0xcfc6('0x2d')][_0xcfc6('0x2e')]};});_0x1b4209[_0xcfc6('0x2f')]=_[_0xcfc6('0x2a')](_0x30f202,_0xcfc6('0x28'));_0x1b4209[_0xcfc6('0x30')]=_['keys'](_0x3be77c[_0xcfc6('0x30')]);_0x1b4209[_0xcfc6('0x31')]=_['intersection'](_0x1b4209[_0xcfc6('0x2f')],_0x1b4209['query']);_0xc2cf2b['attributes']=_[_0xcfc6('0x32')](_0x1b4209['model'],qs[_0xcfc6('0x33')](_0x3be77c['query'][_0xcfc6('0x33')]));_0xc2cf2b[_0xcfc6('0x34')]=_0xc2cf2b[_0xcfc6('0x34')][_0xcfc6('0x35')]?_0xc2cf2b[_0xcfc6('0x34')]:_0x1b4209[_0xcfc6('0x2f')];if(!_0x3be77c[_0xcfc6('0x30')]['hasOwnProperty'](_0xcfc6('0x36'))){_0xc2cf2b[_0xcfc6('0x1f')]=qs[_0xcfc6('0x1f')](_0x3be77c[_0xcfc6('0x30')][_0xcfc6('0x1f')]);_0xc2cf2b[_0xcfc6('0x1d')]=qs[_0xcfc6('0x1d')](_0x3be77c[_0xcfc6('0x30')]['offset']);}_0xc2cf2b[_0xcfc6('0x37')]=qs[_0xcfc6('0x38')](_0x3be77c[_0xcfc6('0x30')][_0xcfc6('0x38')]);_0xc2cf2b['where']=qs[_0xcfc6('0x31')](_[_0xcfc6('0x39')](_0x3be77c[_0xcfc6('0x30')],_0x1b4209[_0xcfc6('0x31')]),_0x30f202);if(_0x3be77c[_0xcfc6('0x30')][_0xcfc6('0x3a')]){_0xc2cf2b[_0xcfc6('0x3b')]=_[_0xcfc6('0x3c')](_0xc2cf2b['where'],{'$or':_[_0xcfc6('0x2a')](_0x30f202,function(_0x17be60){if(_0x17be60[_0xcfc6('0x2d')]!==_0xcfc6('0x3d')){var _0x123043={};_0x123043[_0x17be60['name']]={'$like':'%'+_0x3be77c[_0xcfc6('0x30')][_0xcfc6('0x3a')]+'%'};return _0x123043;}})});}_0xc2cf2b=_[_0xcfc6('0x3c')]({},_0xc2cf2b,_0x3be77c[_0xcfc6('0x3e')]);var _0x40d6d5={'where':_0xc2cf2b['where']};return db[_0xcfc6('0x2b')][_0xcfc6('0x20')](_0x40d6d5)[_0xcfc6('0x24')](function(_0x3872e8){_0x28b223[_0xcfc6('0x20')]=_0x3872e8;if(_0x3be77c[_0xcfc6('0x30')][_0xcfc6('0x3f')]){_0xc2cf2b['include']=[{'all':!![]}];}return db[_0xcfc6('0x2b')][_0xcfc6('0x40')](_0xc2cf2b);})[_0xcfc6('0x24')](function(_0x59463c){_0x28b223[_0xcfc6('0x41')]=_0x59463c;return _0x28b223;})[_0xcfc6('0x24')](respondWithFilteredResult(_0x146ccc,_0xc2cf2b))[_0xcfc6('0x42')](handleError(_0x146ccc,null));};exports['show']=function(_0xb00247,_0x45bfe6){var _0x18b817={'raw':!![],'where':{'id':_0xb00247[_0xcfc6('0x43')]['id']}},_0x3f6d61={};_0x3f6d61[_0xcfc6('0x2f')]=_[_0xcfc6('0x44')](db[_0xcfc6('0x2b')][_0xcfc6('0x2c')]);_0x3f6d61[_0xcfc6('0x30')]=_[_0xcfc6('0x44')](_0xb00247[_0xcfc6('0x30')]);_0x3f6d61['filters']=_[_0xcfc6('0x32')](_0x3f6d61['model'],_0x3f6d61[_0xcfc6('0x30')]);_0x18b817[_0xcfc6('0x34')]=_[_0xcfc6('0x32')](_0x3f6d61[_0xcfc6('0x2f')],qs[_0xcfc6('0x33')](_0xb00247[_0xcfc6('0x30')][_0xcfc6('0x33')]));_0x18b817[_0xcfc6('0x34')]=_0x18b817[_0xcfc6('0x34')]['length']?_0x18b817[_0xcfc6('0x34')]:_0x3f6d61[_0xcfc6('0x2f')];if(_0xb00247[_0xcfc6('0x30')][_0xcfc6('0x3f')]){_0x18b817['include']=[{'all':!![]}];}_0x18b817=_[_0xcfc6('0x3c')]({},_0x18b817,_0xb00247[_0xcfc6('0x3e')]);return db[_0xcfc6('0x2b')][_0xcfc6('0x45')](_0x18b817)[_0xcfc6('0x24')](handleEntityNotFound(_0x45bfe6,null))['then'](respondWithResult(_0x45bfe6,null))[_0xcfc6('0x42')](handleError(_0x45bfe6,null));};exports[_0xcfc6('0x46')]=function(_0x379a3e,_0x3e42b3){return db[_0xcfc6('0x2b')]['create'](_0x379a3e[_0xcfc6('0x47')],{})['then'](respondWithResult(_0x3e42b3,0xc9))[_0xcfc6('0x42')](handleError(_0x3e42b3,null));};exports['update']=function(_0x2a6e05,_0x274b20){if(_0x2a6e05['body']['id']){delete _0x2a6e05[_0xcfc6('0x47')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x2a6e05['params']['id']}})[_0xcfc6('0x24')](handleEntityNotFound(_0x274b20,null))['then'](saveUpdates(_0x2a6e05[_0xcfc6('0x47')],null))[_0xcfc6('0x24')](respondWithResult(_0x274b20,null))[_0xcfc6('0x42')](handleError(_0x274b20,null));};exports[_0xcfc6('0x48')]=function(_0x2dd4f8,_0x67ec56){return db[_0xcfc6('0x2b')][_0xcfc6('0x45')]({'where':{'id':_0x2dd4f8[_0xcfc6('0x43')]['id']}})[_0xcfc6('0x24')](handleEntityNotFound(_0x67ec56,null))['then'](removeEntity(_0x67ec56,null))[_0xcfc6('0x42')](handleError(_0x67ec56,null));};exports[_0xcfc6('0x49')]=function(_0x3fceea,_0x532e49){return db[_0xcfc6('0x2b')][_0xcfc6('0x49')]()[_0xcfc6('0x24')](respondWithResult(_0x532e49,null))[_0xcfc6('0x42')](handleError(_0x532e49,null));};exports[_0xcfc6('0x4a')]=function(_0x11963f,_0x3ab339,_0x4571f7){var _0x566c4a={'raw':!![],'where':{}};var _0x4d5b04={};var _0x266b50={'count':0x0,'rows':[]};return db[_0xcfc6('0x2b')]['findOne']({'where':{'id':_0x11963f['params']['id']}})[_0xcfc6('0x24')](handleEntityNotFound(_0x3ab339,null))[_0xcfc6('0x24')](function(_0xbaa4a0){if(_0xbaa4a0){_0x4d5b04[_0xcfc6('0x2f')]=_[_0xcfc6('0x44')](db[_0xcfc6('0x4b')][_0xcfc6('0x2c')]);_0x4d5b04[_0xcfc6('0x30')]=_[_0xcfc6('0x44')](_0x11963f[_0xcfc6('0x30')]);_0x4d5b04[_0xcfc6('0x31')]=_[_0xcfc6('0x32')](_0x4d5b04[_0xcfc6('0x2f')],_0x4d5b04[_0xcfc6('0x30')]);_0x566c4a['attributes']=_[_0xcfc6('0x32')](_0x4d5b04['model'],qs[_0xcfc6('0x33')](_0x11963f[_0xcfc6('0x30')]['fields']));_0x566c4a[_0xcfc6('0x34')]=_0x566c4a[_0xcfc6('0x34')][_0xcfc6('0x35')]?_0x566c4a[_0xcfc6('0x34')]:_0x4d5b04[_0xcfc6('0x2f')];if(!_0x11963f[_0xcfc6('0x30')][_0xcfc6('0x4c')](_0xcfc6('0x36'))){_0x566c4a[_0xcfc6('0x1f')]=qs[_0xcfc6('0x1f')](_0x11963f[_0xcfc6('0x30')]['limit']);_0x566c4a[_0xcfc6('0x1d')]=qs['offset'](_0x11963f['query'][_0xcfc6('0x1d')]);}_0x566c4a[_0xcfc6('0x37')]=qs['sort'](_0x11963f[_0xcfc6('0x30')][_0xcfc6('0x38')]);_0x566c4a[_0xcfc6('0x3b')]=qs[_0xcfc6('0x31')](_['pick'](_0x11963f['query'],_0x4d5b04['filters']));_0x566c4a[_0xcfc6('0x3b')][_0xcfc6('0x4d')]=_0xbaa4a0['id'];if(_0x11963f[_0xcfc6('0x30')][_0xcfc6('0x3a')]){_0x566c4a['where']=_[_0xcfc6('0x3c')](_0x566c4a[_0xcfc6('0x3b')],{'$or':_['map'](_0x566c4a[_0xcfc6('0x34')],function(_0x28660c){var _0x389e8a={};_0x389e8a[_0x28660c]={'$like':'%'+_0x11963f[_0xcfc6('0x30')]['filter']+'%'};return _0x389e8a;})});}_0x566c4a=_[_0xcfc6('0x3c')]({},_0x566c4a,_0x11963f['options']);return db[_0xcfc6('0x4b')][_0xcfc6('0x20')]({'where':_0x566c4a[_0xcfc6('0x3b')]})[_0xcfc6('0x24')](function(_0x5eb5d5){_0x266b50[_0xcfc6('0x20')]=_0x5eb5d5;if(_0x11963f['query']['includeAll']){_0x566c4a[_0xcfc6('0x4e')]=[{'all':!![]}];}return db[_0xcfc6('0x4b')]['findAll'](_0x566c4a);})['then'](function(_0x4fefdd){_0x266b50['rows']=_0x4fefdd;return _0x266b50;});}})[_0xcfc6('0x24')](respondWithFilteredResult(_0x3ab339,_0x566c4a))['catch'](handleError(_0x3ab339,null));}; \ No newline at end of file +var _0x85de=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','create','body','find','params','findOne','SessionId','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x5a3e50,_0x5c9170){var _0x1a713c=function(_0x51b118){while(--_0x51b118){_0x5a3e50['push'](_0x5a3e50['shift']());}};_0x1a713c(++_0x5c9170);}(_0x85de,0xee));var _0xe85d=function(_0xcd88b0,_0x409ce7){_0xcd88b0=_0xcd88b0-0x0;var _0x22cce5=_0x85de[_0xcd88b0];return _0x22cce5;};'use strict';var emlformat=require(_0xe85d('0x0'));var rimraf=require(_0xe85d('0x1'));var zipdir=require(_0xe85d('0x2'));var jsonpatch=require(_0xe85d('0x3'));var rp=require(_0xe85d('0x4'));var moment=require('moment');var BPromise=require(_0xe85d('0x5'));var Mustache=require(_0xe85d('0x6'));var util=require(_0xe85d('0x7'));var path=require(_0xe85d('0x8'));var sox=require(_0xe85d('0x9'));var csv=require(_0xe85d('0xa'));var ejs=require(_0xe85d('0xb'));var fs=require('fs');var fs_extra=require(_0xe85d('0xc'));var _=require('lodash');var squel=require(_0xe85d('0xd'));var crypto=require(_0xe85d('0xe'));var jsforce=require(_0xe85d('0xf'));var deskjs=require(_0xe85d('0x10'));var toCsv=require(_0xe85d('0xa'));var querystring=require(_0xe85d('0x11'));var Papa=require(_0xe85d('0x12'));var Redis=require(_0xe85d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe85d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe85d('0x15'))(_0xe85d('0x16'));var utils=require(_0xe85d('0x17'));var config=require(_0xe85d('0x18'));var licenseUtil=require(_0xe85d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x349f7a,_0xd10bf8){_0xd10bf8=_0xd10bf8||0xcc;return function(_0x53c2e9){if(_0x53c2e9){return _0x349f7a[_0xe85d('0x1a')](_0xd10bf8);}return _0x349f7a[_0xe85d('0x1b')](_0xd10bf8)[_0xe85d('0x1c')]();};}function respondWithResult(_0x3fca0e,_0x5432c0){_0x5432c0=_0x5432c0||0xc8;return function(_0x59c771){if(_0x59c771){return _0x3fca0e[_0xe85d('0x1b')](_0x5432c0)[_0xe85d('0x1d')](_0x59c771);}};}function respondWithFilteredResult(_0x4e1837,_0x3f87bc){return function(_0x21fda3){if(_0x21fda3){var _0x5a6947=typeof _0x3f87bc['offset']===_0xe85d('0x1e')&&typeof _0x3f87bc['limit']===_0xe85d('0x1e');var _0x80b5c4=_0x21fda3[_0xe85d('0x1f')];var _0x45f1cb=_0x5a6947?0x0:_0x3f87bc['offset'];var _0x4e7846=_0x5a6947?_0x21fda3[_0xe85d('0x1f')]:_0x3f87bc[_0xe85d('0x20')]+_0x3f87bc[_0xe85d('0x21')];var _0x27ac0c;if(_0x4e7846>=_0x80b5c4){_0x4e7846=_0x80b5c4;_0x27ac0c=0xc8;}else{_0x27ac0c=0xce;}_0x4e1837[_0xe85d('0x1b')](_0x27ac0c);return _0x4e1837[_0xe85d('0x22')](_0xe85d('0x23'),_0x45f1cb+'-'+_0x4e7846+'/'+_0x80b5c4)[_0xe85d('0x1d')](_0x21fda3);}return null;};}function patchUpdates(_0x7a6730){return function(_0x208410){try{jsonpatch[_0xe85d('0x24')](_0x208410,_0x7a6730,!![]);}catch(_0x31fee2){return BPromise[_0xe85d('0x25')](_0x31fee2);}return _0x208410['save']();};}function saveUpdates(_0x4cda2e,_0x242d7e){return function(_0x990c3){if(_0x990c3){return _0x990c3[_0xe85d('0x26')](_0x4cda2e)['then'](function(_0x6ad60c){return _0x6ad60c;});}return null;};}function removeEntity(_0x43d4f7,_0x560113){return function(_0x5b4ea1){if(_0x5b4ea1){return _0x5b4ea1[_0xe85d('0x27')]()[_0xe85d('0x28')](function(){_0x43d4f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d1b80,_0x2cba13){return function(_0x1405b5){if(!_0x1405b5){_0x3d1b80[_0xe85d('0x1a')](0x194);}return _0x1405b5;};}function handleError(_0x296ea9,_0x752fb6){_0x752fb6=_0x752fb6||0x1f4;return function(_0x48d312){logger[_0xe85d('0x29')](_0x48d312[_0xe85d('0x2a')]);if(_0x48d312[_0xe85d('0x2b')]){delete _0x48d312[_0xe85d('0x2b')];}_0x296ea9[_0xe85d('0x1b')](_0x752fb6)[_0xe85d('0x2c')](_0x48d312);};}exports[_0xe85d('0x2d')]=function(_0x54f7e0,_0xec9f9b){var _0x32da04={},_0x33cbae={},_0x28cca8={'count':0x0,'rows':[]};var _0x51edaa=_[_0xe85d('0x2e')](db['JscriptySessionReport'][_0xe85d('0x2f')],function(_0x21acd2){return{'name':_0x21acd2[_0xe85d('0x30')],'type':_0x21acd2[_0xe85d('0x31')][_0xe85d('0x32')]};});_0x33cbae[_0xe85d('0x33')]=_[_0xe85d('0x2e')](_0x51edaa,'name');_0x33cbae[_0xe85d('0x34')]=_[_0xe85d('0x35')](_0x54f7e0['query']);_0x33cbae['filters']=_[_0xe85d('0x36')](_0x33cbae[_0xe85d('0x33')],_0x33cbae[_0xe85d('0x34')]);_0x32da04[_0xe85d('0x37')]=_[_0xe85d('0x36')](_0x33cbae[_0xe85d('0x33')],qs[_0xe85d('0x38')](_0x54f7e0[_0xe85d('0x34')]['fields']));_0x32da04['attributes']=_0x32da04[_0xe85d('0x37')][_0xe85d('0x39')]?_0x32da04[_0xe85d('0x37')]:_0x33cbae[_0xe85d('0x33')];if(!_0x54f7e0[_0xe85d('0x34')]['hasOwnProperty'](_0xe85d('0x3a'))){_0x32da04[_0xe85d('0x21')]=qs[_0xe85d('0x21')](_0x54f7e0[_0xe85d('0x34')][_0xe85d('0x21')]);_0x32da04[_0xe85d('0x20')]=qs[_0xe85d('0x20')](_0x54f7e0[_0xe85d('0x34')]['offset']);}_0x32da04[_0xe85d('0x3b')]=qs[_0xe85d('0x3c')](_0x54f7e0[_0xe85d('0x34')][_0xe85d('0x3c')]);_0x32da04['where']=qs[_0xe85d('0x3d')](_[_0xe85d('0x3e')](_0x54f7e0[_0xe85d('0x34')],_0x33cbae[_0xe85d('0x3d')]),_0x51edaa);if(_0x54f7e0[_0xe85d('0x34')][_0xe85d('0x3f')]){_0x32da04[_0xe85d('0x40')]=_[_0xe85d('0x41')](_0x32da04[_0xe85d('0x40')],{'$or':_[_0xe85d('0x2e')](_0x51edaa,function(_0x2ed2b5){if(_0x2ed2b5[_0xe85d('0x31')]!==_0xe85d('0x42')){var _0x172327={};_0x172327[_0x2ed2b5[_0xe85d('0x2b')]]={'$like':'%'+_0x54f7e0[_0xe85d('0x34')][_0xe85d('0x3f')]+'%'};return _0x172327;}})});}_0x32da04=_[_0xe85d('0x41')]({},_0x32da04,_0x54f7e0[_0xe85d('0x43')]);var _0xb2e41e={'where':_0x32da04[_0xe85d('0x40')]};return db[_0xe85d('0x44')][_0xe85d('0x1f')](_0xb2e41e)['then'](function(_0x3bc878){_0x28cca8[_0xe85d('0x1f')]=_0x3bc878;if(_0x54f7e0[_0xe85d('0x34')][_0xe85d('0x45')]){_0x32da04[_0xe85d('0x46')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xe85d('0x47')](_0x32da04);})[_0xe85d('0x28')](function(_0x5cf8a3){_0x28cca8[_0xe85d('0x48')]=_0x5cf8a3;return _0x28cca8;})[_0xe85d('0x28')](respondWithFilteredResult(_0xec9f9b,_0x32da04))[_0xe85d('0x49')](handleError(_0xec9f9b,null));};exports[_0xe85d('0x4a')]=function(_0x4f215a,_0x10f37a){var _0xd0f038={'raw':!![],'where':{'id':_0x4f215a['params']['id']}},_0x2f5eca={};_0x2f5eca[_0xe85d('0x33')]=_[_0xe85d('0x35')](db[_0xe85d('0x44')][_0xe85d('0x2f')]);_0x2f5eca['query']=_[_0xe85d('0x35')](_0x4f215a[_0xe85d('0x34')]);_0x2f5eca[_0xe85d('0x3d')]=_['intersection'](_0x2f5eca[_0xe85d('0x33')],_0x2f5eca['query']);_0xd0f038[_0xe85d('0x37')]=_[_0xe85d('0x36')](_0x2f5eca[_0xe85d('0x33')],qs[_0xe85d('0x38')](_0x4f215a[_0xe85d('0x34')][_0xe85d('0x38')]));_0xd0f038[_0xe85d('0x37')]=_0xd0f038[_0xe85d('0x37')]['length']?_0xd0f038[_0xe85d('0x37')]:_0x2f5eca[_0xe85d('0x33')];if(_0x4f215a[_0xe85d('0x34')]['includeAll']){_0xd0f038[_0xe85d('0x46')]=[{'all':!![]}];}_0xd0f038=_['merge']({},_0xd0f038,_0x4f215a[_0xe85d('0x43')]);return db[_0xe85d('0x44')]['find'](_0xd0f038)['then'](handleEntityNotFound(_0x10f37a,null))[_0xe85d('0x28')](respondWithResult(_0x10f37a,null))[_0xe85d('0x49')](handleError(_0x10f37a,null));};exports['create']=function(_0x4ea172,_0x38f857){return db[_0xe85d('0x44')][_0xe85d('0x4b')](_0x4ea172['body'],{})[_0xe85d('0x28')](respondWithResult(_0x38f857,0xc9))[_0xe85d('0x49')](handleError(_0x38f857,null));};exports[_0xe85d('0x26')]=function(_0x122a1e,_0xfd6b14){if(_0x122a1e['body']['id']){delete _0x122a1e[_0xe85d('0x4c')]['id'];}return db[_0xe85d('0x44')][_0xe85d('0x4d')]({'where':{'id':_0x122a1e[_0xe85d('0x4e')]['id']}})['then'](handleEntityNotFound(_0xfd6b14,null))['then'](saveUpdates(_0x122a1e[_0xe85d('0x4c')],null))[_0xe85d('0x28')](respondWithResult(_0xfd6b14,null))[_0xe85d('0x49')](handleError(_0xfd6b14,null));};exports[_0xe85d('0x27')]=function(_0x426620,_0xf22da3){return db[_0xe85d('0x44')]['find']({'where':{'id':_0x426620[_0xe85d('0x4e')]['id']}})[_0xe85d('0x28')](handleEntityNotFound(_0xf22da3,null))['then'](removeEntity(_0xf22da3,null))[_0xe85d('0x49')](handleError(_0xf22da3,null));};exports['describe']=function(_0x1aa50f,_0x5f23e5){return db['JscriptySessionReport']['describe']()[_0xe85d('0x28')](respondWithResult(_0x5f23e5,null))[_0xe85d('0x49')](handleError(_0x5f23e5,null));};exports['getQuestions']=function(_0x12e684,_0x46d75b,_0x55e28c){var _0x1ad846={'raw':!![],'where':{}};var _0x2e56c4={};var _0x2d861a={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xe85d('0x4f')]({'where':{'id':_0x12e684[_0xe85d('0x4e')]['id']}})[_0xe85d('0x28')](handleEntityNotFound(_0x46d75b,null))['then'](function(_0x120afc){if(_0x120afc){_0x2e56c4['model']=_[_0xe85d('0x35')](db['JscriptyQuestionReport'][_0xe85d('0x2f')]);_0x2e56c4[_0xe85d('0x34')]=_['keys'](_0x12e684[_0xe85d('0x34')]);_0x2e56c4[_0xe85d('0x3d')]=_[_0xe85d('0x36')](_0x2e56c4[_0xe85d('0x33')],_0x2e56c4[_0xe85d('0x34')]);_0x1ad846['attributes']=_[_0xe85d('0x36')](_0x2e56c4[_0xe85d('0x33')],qs[_0xe85d('0x38')](_0x12e684[_0xe85d('0x34')][_0xe85d('0x38')]));_0x1ad846[_0xe85d('0x37')]=_0x1ad846['attributes'][_0xe85d('0x39')]?_0x1ad846[_0xe85d('0x37')]:_0x2e56c4[_0xe85d('0x33')];if(!_0x12e684[_0xe85d('0x34')]['hasOwnProperty'](_0xe85d('0x3a'))){_0x1ad846['limit']=qs[_0xe85d('0x21')](_0x12e684[_0xe85d('0x34')][_0xe85d('0x21')]);_0x1ad846[_0xe85d('0x20')]=qs[_0xe85d('0x20')](_0x12e684[_0xe85d('0x34')][_0xe85d('0x20')]);}_0x1ad846['order']=qs[_0xe85d('0x3c')](_0x12e684[_0xe85d('0x34')]['sort']);_0x1ad846['where']=qs[_0xe85d('0x3d')](_[_0xe85d('0x3e')](_0x12e684[_0xe85d('0x34')],_0x2e56c4[_0xe85d('0x3d')]));_0x1ad846[_0xe85d('0x40')][_0xe85d('0x50')]=_0x120afc['id'];if(_0x12e684[_0xe85d('0x34')][_0xe85d('0x3f')]){_0x1ad846['where']=_['merge'](_0x1ad846['where'],{'$or':_[_0xe85d('0x2e')](_0x1ad846['attributes'],function(_0x251e0d){var _0x109aba={};_0x109aba[_0x251e0d]={'$like':'%'+_0x12e684[_0xe85d('0x34')][_0xe85d('0x3f')]+'%'};return _0x109aba;})});}_0x1ad846=_[_0xe85d('0x41')]({},_0x1ad846,_0x12e684[_0xe85d('0x43')]);return db[_0xe85d('0x51')][_0xe85d('0x1f')]({'where':_0x1ad846[_0xe85d('0x40')]})[_0xe85d('0x28')](function(_0x46744a){_0x2d861a['count']=_0x46744a;if(_0x12e684['query'][_0xe85d('0x45')]){_0x1ad846[_0xe85d('0x46')]=[{'all':!![]}];}return db[_0xe85d('0x51')]['findAll'](_0x1ad846);})[_0xe85d('0x28')](function(_0x45276f){_0x2d861a[_0xe85d('0x48')]=_0x45276f;return _0x2d861a;});}})['then'](respondWithFilteredResult(_0x46d75b,_0x1ad846))['catch'](handleError(_0x46d75b,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 4601e19..ee26680 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 _0x6c7b=['path','rimraf','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','moment','request-promise'];(function(_0x570af4,_0x46bd49){var _0x31c7d6=function(_0x5ce3b3){while(--_0x5ce3b3){_0x570af4['push'](_0x570af4['shift']());}};_0x31c7d6(++_0x46bd49);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x1fc0af,_0x13a8bb){_0x1fc0af=_0x1fc0af-0x0;var _0x23a8e0=_0x6c7b[_0x1fc0af];return _0x23a8e0;};'use strict';var _=require(_0xb6c7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb6c7('0x1'));var BPromise=require('bluebird');var rp=require(_0xb6c7('0x2'));var fs=require('fs');var path=require(_0xb6c7('0x3'));var rimraf=require(_0xb6c7('0x4'));var config=require('../../config/environment');var attributes=require(_0xb6c7('0x5'));module[_0xb6c7('0x6')]=function(_0xfe3eb9,_0x219abc){return _0xfe3eb9[_0xb6c7('0x7')]('JscriptySessionReport',attributes,{'tableName':_0xb6c7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27a0=['define','JscriptySessionReport','util','../../config/logger','api','moment','bluebird','./jscriptySessionReport.attributes','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x27a0,0xbf));var _0x027a=function(_0x518ac1,_0x2d4275){_0x518ac1=_0x518ac1-0x0;var _0x8801c1=_0x27a0[_0x518ac1];return _0x8801c1;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var logger=require(_0x027a('0x1'))(_0x027a('0x2'));var moment=require(_0x027a('0x3'));var BPromise=require(_0x027a('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(_0x027a('0x5'));module[_0x027a('0x6')]=function(_0x137b09,_0x639bec){return _0x137b09[_0x027a('0x7')](_0x027a('0x8'),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 edf87cc..7ba2ac6 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptySessionReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5305f2,_0x180334){var _0x59a8f7=function(_0x30b5d8){while(--_0x30b5d8){_0x5305f2['push'](_0x5305f2['shift']());}};_0x59a8f7(++_0x180334);}(_0x5fab,0x177));var _0xb5fa=function(_0x1394a2,_0x533264){_0x1394a2=_0x1394a2-0x0;var _0x31dcd1=_0x5fab[_0x1394a2];return _0x31dcd1;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x4991=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2b49bc,_0x47b636){var _0x43cc65=function(_0x236ec3){while(--_0x236ec3){_0x2b49bc['push'](_0x2b49bc['shift']());}};_0x43cc65(++_0x47b636);}(_0x4991,0xf7));var _0x1499=function(_0x4e94a2,_0x2601f2){_0x4e94a2=_0x4e94a2-0x0;var _0x171fa1=_0x4991[_0x4e94a2];return _0x171fa1;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c3bd7,_0x1c65c3,_0x33b261){return new BPromise(function(_0x133bae,_0x380e48){return client[_0x1499('0xb')](_0x1c3bd7,_0x33b261)[_0x1499('0xc')](function(_0x48d2ca){logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');logger[_0x1499('0xf')](_0x1499('0x10'),_0x1c65c3,'request\x20sent',JSON[_0x1499('0x11')](_0x48d2ca));if(_0x48d2ca[_0x1499('0x12')]){if(_0x48d2ca['error']['code']===0x1f4){logger['error'](_0x1499('0xe'),_0x1c65c3,_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);return _0x380e48(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x1c65c3,_0x48d2ca[_0x1499('0x12')]['message']);return _0x133bae(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}else{logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');_0x133bae(_0x48d2ca[_0x1499('0x14')][_0x1499('0x13')]);}})['catch'](function(_0x25164c){logger[_0x1499('0x12')](_0x1499('0xe'),_0x1c65c3,_0x25164c);_0x380e48(_0x25164c);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 3665b7d..b03d248 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 _0x688d=['update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','put','/:id','isAuthenticated'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x688d,0xe2));var _0xd688=function(_0x51a01c,_0x24549e){_0x51a01c=_0x51a01c-0x0;var _0x5ee105=_0x688d[_0x51a01c];return _0x5ee105;};'use strict';var multer=require('multer');var util=require(_0xd688('0x0'));var path=require(_0xd688('0x1'));var timeout=require(_0xd688('0x2'));var express=require(_0xd688('0x3'));var router=express[_0xd688('0x4')]();var fs_extra=require(_0xd688('0x5'));var auth=require(_0xd688('0x6'));var interaction=require(_0xd688('0x7'));var config=require(_0xd688('0x8'));var controller=require('./license.controller');router[_0xd688('0x9')]('/',controller[_0xd688('0xa')]);router[_0xd688('0xb')](_0xd688('0xc'),auth[_0xd688('0xd')](),controller[_0xd688('0xe')]);router[_0xd688('0x9')]('/download_log_file',auth['isAuthenticated'](),controller['downloadLogFile']);module['exports']=router; \ No newline at end of file +var _0x89c0=['isAuthenticated','update','downloadLogFile','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x89c0,0x1b0));var _0x089c=function(_0xb3928c,_0x539c87){_0xb3928c=_0xb3928c-0x0;var _0x30d9b2=_0x89c0[_0xb3928c];return _0x30d9b2;};'use strict';var multer=require(_0x089c('0x0'));var util=require('util');var path=require(_0x089c('0x1'));var timeout=require(_0x089c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x089c('0x3'));var config=require(_0x089c('0x4'));var controller=require(_0x089c('0x5'));router[_0x089c('0x6')]('/',controller[_0x089c('0x7')]);router[_0x089c('0x8')](_0x089c('0x9'),auth[_0x089c('0xa')](),controller[_0x089c('0xb')]);router[_0x089c('0x6')]('/download_log_file',auth['isAuthenticated'](),controller[_0x089c('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index d2df0d0..c4ec524 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 _0xe127=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0x2b365f,_0x17aa37){var _0x26b060=function(_0x5e0a39){while(--_0x5e0a39){_0x2b365f['push'](_0x2b365f['shift']());}};_0x26b060(++_0x17aa37);}(_0xe127,0x73));var _0x7e12=function(_0x51eeba,_0xbc84c4){_0x51eeba=_0x51eeba-0x0;var _0x2d0031=_0xe127[_0x51eeba];return _0x2d0031;};'use strict';var Sequelize=require(_0x7e12('0x0'));module[_0x7e12('0x1')]={'license':{'type':Sequelize[_0x7e12('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x7e12('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x7e12('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2c5c=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x51f286,_0xde9293){var _0x4810b0=function(_0x3020c9){while(--_0x3020c9){_0x51f286['push'](_0x51f286['shift']());}};_0x4810b0(++_0xde9293);}(_0x2c5c,0x11f));var _0xc2c5=function(_0x5e58a0,_0x27877c){_0x5e58a0=_0x5e58a0-0x0;var _0x1c8f4e=_0x2c5c[_0x5e58a0];return _0x1c8f4e;};'use strict';var Sequelize=require(_0xc2c5('0x0'));module[_0xc2c5('0x1')]={'license':{'type':Sequelize[_0xc2c5('0x2')]},'data1':{'type':Sequelize[_0xc2c5('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xc2c5('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 2c1c2c1..8008305 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 _0xb833=['join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','set','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','body','License','find','params','get','checkLicense','key','demo','catch','downloadLogFile'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb833,0x18c));var _0x3b83=function(_0xc47e0d,_0x1efd06){_0xc47e0d=_0xc47e0d-0x0;var _0x13f48d=_0xb833[_0xc47e0d];return _0x13f48d;};'use strict';var emlformat=require(_0x3b83('0x0'));var rimraf=require(_0x3b83('0x1'));var zipdir=require(_0x3b83('0x2'));var jsonpatch=require(_0x3b83('0x3'));var rp=require(_0x3b83('0x4'));var moment=require(_0x3b83('0x5'));var BPromise=require(_0x3b83('0x6'));var Mustache=require(_0x3b83('0x7'));var util=require(_0x3b83('0x8'));var path=require('path');var sox=require(_0x3b83('0x9'));var csv=require(_0x3b83('0xa'));var ejs=require(_0x3b83('0xb'));var fs=require('fs');var fs_extra=require(_0x3b83('0xc'));var _=require(_0x3b83('0xd'));var squel=require(_0x3b83('0xe'));var crypto=require(_0x3b83('0xf'));var jsforce=require(_0x3b83('0x10'));var deskjs=require(_0x3b83('0x11'));var toCsv=require(_0x3b83('0xa'));var querystring=require(_0x3b83('0x12'));var Papa=require('papaparse');var Redis=require(_0x3b83('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3b83('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b83('0x15'))('api');var utils=require(_0x3b83('0x16'));var config=require(_0x3b83('0x17'));var licenseUtil=require(_0x3b83('0x18'));var db=require(_0x3b83('0x19'))['db'];function respondWithStatusCode(_0x5b8845,_0x3ac9f9){_0x3ac9f9=_0x3ac9f9||0xcc;return function(_0x8bd92d){if(_0x8bd92d){return _0x5b8845[_0x3b83('0x1a')](_0x3ac9f9);}return _0x5b8845[_0x3b83('0x1b')](_0x3ac9f9)['end']();};}function respondWithResult(_0x3b6136,_0x21dd27){_0x21dd27=_0x21dd27||0xc8;return function(_0x4ff9c6){if(_0x4ff9c6){return _0x3b6136['status'](_0x21dd27)[_0x3b83('0x1c')](_0x4ff9c6);}};}function respondWithFilteredResult(_0xf7a1ad,_0x1507c1){return function(_0x40523e){if(_0x40523e){var _0x332904=typeof _0x1507c1[_0x3b83('0x1d')]===_0x3b83('0x1e')&&typeof _0x1507c1['limit']==='undefined';var _0x20be8f=_0x40523e[_0x3b83('0x1f')];var _0x7638e7=_0x332904?0x0:_0x1507c1[_0x3b83('0x1d')];var _0x713d91=_0x332904?_0x40523e['count']:_0x1507c1[_0x3b83('0x1d')]+_0x1507c1[_0x3b83('0x20')];var _0x1209e3;if(_0x713d91>=_0x20be8f){_0x713d91=_0x20be8f;_0x1209e3=0xc8;}else{_0x1209e3=0xce;}_0xf7a1ad['status'](_0x1209e3);return _0xf7a1ad['set'](_0x3b83('0x21'),_0x7638e7+'-'+_0x713d91+'/'+_0x20be8f)['json'](_0x40523e);}return null;};}function patchUpdates(_0x2be31c){return function(_0x5e1637){try{jsonpatch[_0x3b83('0x22')](_0x5e1637,_0x2be31c,!![]);}catch(_0x268fc3){return BPromise[_0x3b83('0x23')](_0x268fc3);}return _0x5e1637[_0x3b83('0x24')]();};}function saveUpdates(_0x1e8a3b,_0x2ed9f9){return function(_0x1bd7fd){if(_0x1bd7fd){return _0x1bd7fd[_0x3b83('0x25')](_0x1e8a3b)[_0x3b83('0x26')](function(_0x15368e){return _0x15368e;});}return null;};}function removeEntity(_0xe3d116,_0x230dc2){return function(_0x197468){if(_0x197468){return _0x197468[_0x3b83('0x27')]()[_0x3b83('0x26')](function(){_0xe3d116[_0x3b83('0x1b')](0xcc)[_0x3b83('0x28')]();});}};}function handleEntityNotFound(_0x2b7d9e,_0xb02f49){return function(_0x4ad121){if(!_0x4ad121){_0x2b7d9e['sendStatus'](0x194);}return _0x4ad121;};}function handleError(_0x565a11,_0x4506cf){_0x4506cf=_0x4506cf||0x1f4;return function(_0x2d1507){logger[_0x3b83('0x29')](_0x2d1507[_0x3b83('0x2a')]);if(_0x2d1507[_0x3b83('0x2b')]){delete _0x2d1507[_0x3b83('0x2b')];}_0x565a11[_0x3b83('0x1b')](_0x4506cf)[_0x3b83('0x2c')](_0x2d1507);};}var utilLicense=require(_0x3b83('0x18'));exports['index']=function(_0x3a8d77,_0x18b623){var _0x440899={'raw':!![],'where':{'id':0x1}},_0x15bba3={};_0x15bba3[_0x3b83('0x2d')]=_[_0x3b83('0x2e')](db['License'][_0x3b83('0x2f')]);_0x15bba3[_0x3b83('0x30')]=_['keys'](_0x3a8d77['query']);_0x15bba3[_0x3b83('0x31')]=_[_0x3b83('0x32')](_0x15bba3[_0x3b83('0x2d')],_0x15bba3[_0x3b83('0x30')]);_0x440899[_0x3b83('0x33')]=_[_0x3b83('0x32')](_0x15bba3[_0x3b83('0x2d')],qs[_0x3b83('0x34')](_0x3a8d77['query'][_0x3b83('0x34')]));_0x440899[_0x3b83('0x33')]=_0x440899[_0x3b83('0x33')][_0x3b83('0x35')]?_0x440899[_0x3b83('0x33')]:_0x15bba3[_0x3b83('0x2d')];_0x440899=_[_0x3b83('0x36')]({},_0x440899,_0x3a8d77[_0x3b83('0x37')]);return utilLicense['getLicense'](_0x440899)[_0x3b83('0x26')](respondWithResult(_0x18b623,null))['catch'](handleError(_0x18b623,null));};exports[_0x3b83('0x25')]=function(_0x5a0eba,_0x9e6f7f){if(_0x5a0eba[_0x3b83('0x38')]['id']){delete _0x5a0eba['body']['id'];}return db[_0x3b83('0x39')][_0x3b83('0x3a')]({'where':{'id':_0x5a0eba[_0x3b83('0x3b')]['id']}})[_0x3b83('0x26')](handleEntityNotFound(_0x9e6f7f,null))[_0x3b83('0x26')](function(_0x2ab3d0){var _0x135a04=_0x2ab3d0[_0x3b83('0x3c')]({'plain':!![]});return utilLicense[_0x3b83('0x3d')](_0x135a04,_0x5a0eba[_0x3b83('0x38')][_0x3b83('0x3e')]);})['then'](function(_0x157a8a){if(!_0x157a8a[_0x3b83('0x3f')]){return saveUpdates(_0x5a0eba[_0x3b83('0x38')],null);}return _0x157a8a;})[_0x3b83('0x26')](respondWithResult(_0x9e6f7f,null))[_0x3b83('0x40')](handleError(_0x9e6f7f,null));};exports[_0x3b83('0x41')]=function(_0x5e98d7,_0x13a4d5){var _0x5366a1='license-info.log';var _0x4da161=path[_0x3b83('0x42')](_0x3b83('0x43'),_0x3b83('0x44'),_0x3b83('0x45'),_0x5366a1);_0x13a4d5[_0x3b83('0x46')](_0x3b83('0x47'),_0x3b83('0x48')+_0x5366a1);_0x13a4d5[_0x3b83('0x49')](_0x3b83('0x4a'),_0x3b83('0x4b'));_0x13a4d5[_0x3b83('0x4c')](_0x4da161);}; \ No newline at end of file +var _0xc45f=['json','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','query','keys','intersection','attributes','fields','length','model','merge','options','catch','body','License','find','params','get','checkLicense','key','demo','downloadLogFile','/var','log','xcally','setHeader','Content-disposition','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','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','offset','undefined','count','limit','set'];(function(_0x103cd3,_0x2d7033){var _0x2255b8=function(_0x1fc254){while(--_0x1fc254){_0x103cd3['push'](_0x103cd3['shift']());}};_0x2255b8(++_0x2d7033);}(_0xc45f,0x14f));var _0xfc45=function(_0x4972a7,_0x426796){_0x4972a7=_0x4972a7-0x0;var _0x2a83e9=_0xc45f[_0x4972a7];return _0x2a83e9;};'use strict';var emlformat=require(_0xfc45('0x0'));var rimraf=require(_0xfc45('0x1'));var zipdir=require(_0xfc45('0x2'));var jsonpatch=require(_0xfc45('0x3'));var rp=require(_0xfc45('0x4'));var moment=require(_0xfc45('0x5'));var BPromise=require(_0xfc45('0x6'));var Mustache=require('mustache');var util=require(_0xfc45('0x7'));var path=require(_0xfc45('0x8'));var sox=require(_0xfc45('0x9'));var csv=require(_0xfc45('0xa'));var ejs=require(_0xfc45('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfc45('0xc'));var crypto=require(_0xfc45('0xd'));var jsforce=require(_0xfc45('0xe'));var deskjs=require(_0xfc45('0xf'));var toCsv=require(_0xfc45('0xa'));var querystring=require(_0xfc45('0x10'));var Papa=require(_0xfc45('0x11'));var Redis=require(_0xfc45('0x12'));var authService=require(_0xfc45('0x13'));var qs=require(_0xfc45('0x14'));var as=require(_0xfc45('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc45('0x16'))('api');var utils=require(_0xfc45('0x17'));var config=require(_0xfc45('0x18'));var licenseUtil=require(_0xfc45('0x19'));var db=require(_0xfc45('0x1a'))['db'];function respondWithStatusCode(_0x2dab05,_0x5e7c07){_0x5e7c07=_0x5e7c07||0xcc;return function(_0x1acefc){if(_0x1acefc){return _0x2dab05[_0xfc45('0x1b')](_0x5e7c07);}return _0x2dab05[_0xfc45('0x1c')](_0x5e7c07)[_0xfc45('0x1d')]();};}function respondWithResult(_0xa6fe80,_0x2e8ca){_0x2e8ca=_0x2e8ca||0xc8;return function(_0x5807de){if(_0x5807de){return _0xa6fe80[_0xfc45('0x1c')](_0x2e8ca)['json'](_0x5807de);}};}function respondWithFilteredResult(_0x5a3446,_0x55bb0e){return function(_0x1b9701){if(_0x1b9701){var _0x47357a=typeof _0x55bb0e[_0xfc45('0x1e')]===_0xfc45('0x1f')&&typeof _0x55bb0e['limit']==='undefined';var _0x58cc4f=_0x1b9701['count'];var _0x1493a0=_0x47357a?0x0:_0x55bb0e[_0xfc45('0x1e')];var _0x112ba6=_0x47357a?_0x1b9701[_0xfc45('0x20')]:_0x55bb0e['offset']+_0x55bb0e[_0xfc45('0x21')];var _0x24b79c;if(_0x112ba6>=_0x58cc4f){_0x112ba6=_0x58cc4f;_0x24b79c=0xc8;}else{_0x24b79c=0xce;}_0x5a3446['status'](_0x24b79c);return _0x5a3446[_0xfc45('0x22')]('Content-Range',_0x1493a0+'-'+_0x112ba6+'/'+_0x58cc4f)[_0xfc45('0x23')](_0x1b9701);}return null;};}function patchUpdates(_0x7aa151){return function(_0x28e701){try{jsonpatch[_0xfc45('0x24')](_0x28e701,_0x7aa151,!![]);}catch(_0x4f68d0){return BPromise[_0xfc45('0x25')](_0x4f68d0);}return _0x28e701[_0xfc45('0x26')]();};}function saveUpdates(_0xcf4ac2,_0x425650){return function(_0x1a2ab0){if(_0x1a2ab0){return _0x1a2ab0[_0xfc45('0x27')](_0xcf4ac2)[_0xfc45('0x28')](function(_0xfc4b16){return _0xfc4b16;});}return null;};}function removeEntity(_0x591dc8,_0x9fcd1d){return function(_0x523738){if(_0x523738){return _0x523738[_0xfc45('0x29')]()['then'](function(){_0x591dc8[_0xfc45('0x1c')](0xcc)[_0xfc45('0x1d')]();});}};}function handleEntityNotFound(_0x4affd4,_0x2d38a5){return function(_0x3ce44b){if(!_0x3ce44b){_0x4affd4[_0xfc45('0x1b')](0x194);}return _0x3ce44b;};}function handleError(_0x588f41,_0xec1705){_0xec1705=_0xec1705||0x1f4;return function(_0x47a476){logger[_0xfc45('0x2a')](_0x47a476[_0xfc45('0x2b')]);if(_0x47a476['name']){delete _0x47a476[_0xfc45('0x2c')];}_0x588f41['status'](_0xec1705)[_0xfc45('0x2d')](_0x47a476);};}var utilLicense=require(_0xfc45('0x19'));exports[_0xfc45('0x2e')]=function(_0x4f1e26,_0x29ac8e){var _0x300765={'raw':!![],'where':{'id':0x1}},_0xd14c00={};_0xd14c00['model']=_['keys'](db['License'][_0xfc45('0x2f')]);_0xd14c00[_0xfc45('0x30')]=_[_0xfc45('0x31')](_0x4f1e26['query']);_0xd14c00['filters']=_[_0xfc45('0x32')](_0xd14c00['model'],_0xd14c00[_0xfc45('0x30')]);_0x300765[_0xfc45('0x33')]=_[_0xfc45('0x32')](_0xd14c00['model'],qs[_0xfc45('0x34')](_0x4f1e26[_0xfc45('0x30')]['fields']));_0x300765[_0xfc45('0x33')]=_0x300765[_0xfc45('0x33')][_0xfc45('0x35')]?_0x300765[_0xfc45('0x33')]:_0xd14c00[_0xfc45('0x36')];_0x300765=_[_0xfc45('0x37')]({},_0x300765,_0x4f1e26[_0xfc45('0x38')]);return utilLicense['getLicense'](_0x300765)[_0xfc45('0x28')](respondWithResult(_0x29ac8e,null))[_0xfc45('0x39')](handleError(_0x29ac8e,null));};exports[_0xfc45('0x27')]=function(_0x278e1e,_0x1cc5ed){if(_0x278e1e[_0xfc45('0x3a')]['id']){delete _0x278e1e[_0xfc45('0x3a')]['id'];}return db[_0xfc45('0x3b')][_0xfc45('0x3c')]({'where':{'id':_0x278e1e[_0xfc45('0x3d')]['id']}})[_0xfc45('0x28')](handleEntityNotFound(_0x1cc5ed,null))[_0xfc45('0x28')](function(_0xcbaf1f){var _0x595b4f=_0xcbaf1f[_0xfc45('0x3e')]({'plain':!![]});return utilLicense[_0xfc45('0x3f')](_0x595b4f,_0x278e1e[_0xfc45('0x3a')][_0xfc45('0x40')]);})['then'](function(_0x224ca6){if(!_0x224ca6[_0xfc45('0x41')]){return saveUpdates(_0x278e1e['body'],null);}return _0x224ca6;})[_0xfc45('0x28')](respondWithResult(_0x1cc5ed,null))[_0xfc45('0x39')](handleError(_0x1cc5ed,null));};exports[_0xfc45('0x42')]=function(_0x163a38,_0x3253c0){var _0x3d82d8='license-info.log';var _0x2a1599=path['join'](_0xfc45('0x43'),_0xfc45('0x44'),_0xfc45('0x45'),_0x3d82d8);_0x3253c0[_0xfc45('0x46')](_0xfc45('0x47'),'attachment;\x20filename='+_0x3d82d8);_0x3253c0['set'](_0xfc45('0x48'),_0xfc45('0x49'));_0x3253c0['download'](_0x2a1599);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index e5575e8..f0335cb 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 _0x63d3=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash','util'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x63d3,0x1d2));var _0x363d=function(_0x40c31e,_0x1f0319){_0x40c31e=_0x40c31e-0x0;var _0x5954c6=_0x63d3[_0x40c31e];return _0x5954c6;};'use strict';var _=require(_0x363d('0x0'));var util=require(_0x363d('0x1'));var logger=require(_0x363d('0x2'))(_0x363d('0x3'));var moment=require('moment');var BPromise=require(_0x363d('0x4'));var rp=require(_0x363d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x363d('0x6'));var config=require(_0x363d('0x7'));var attributes=require(_0x363d('0x8'));module[_0x363d('0x9')]=function(_0x3704df,_0x282354){return _0x3704df[_0x363d('0xa')](_0x363d('0xb'),attributes,{'tableName':_0x363d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3573=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','License','lodash'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x3573,0x15e));var _0x3357=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3573[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3357('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3357('0x1'));var moment=require(_0x3357('0x2'));var BPromise=require(_0x3357('0x3'));var rp=require(_0x3357('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3357('0x5'));var config=require(_0x3357('0x6'));var attributes=require('./license.attributes');module[_0x3357('0x7')]=function(_0x1cd7eb,_0x3787ff){return _0x1cd7eb['define'](_0x3357('0x8'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index b779734..bd8dbf1 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 _0xef09=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2c7724,_0x412497){var _0x7a23e6=function(_0x56d04e){while(--_0x56d04e){_0x2c7724['push'](_0x2c7724['shift']());}};_0x7a23e6(++_0x412497);}(_0xef09,0xa4));var _0x9ef0=function(_0x21fd8b,_0x45f411){_0x21fd8b=_0x21fd8b-0x0;var _0x51b266=_0xef09[_0x21fd8b];return _0x51b266;};'use strict';var _=require(_0x9ef0('0x0'));var util=require(_0x9ef0('0x1'));var moment=require(_0x9ef0('0x2'));var BPromise=require(_0x9ef0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ef0('0x4'));var db=require(_0x9ef0('0x5'))['db'];var utils=require(_0x9ef0('0x6'));var logger=require(_0x9ef0('0x7'))(_0x9ef0('0x8'));var config=require(_0x9ef0('0x9'));var jayson=require(_0x9ef0('0xa'));var client=jayson[_0x9ef0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52ee77,_0x47807b,_0x310ff9){return new BPromise(function(_0x1c69bd,_0x4e0581){return client['request'](_0x52ee77,_0x310ff9)[_0x9ef0('0xc')](function(_0x237590){logger[_0x9ef0('0xd')](_0x9ef0('0xe'),_0x47807b,_0x9ef0('0xf'));logger[_0x9ef0('0x10')](_0x9ef0('0x11'),_0x47807b,_0x9ef0('0xf'),JSON[_0x9ef0('0x12')](_0x237590));if(_0x237590['error']){if(_0x237590[_0x9ef0('0x13')][_0x9ef0('0x14')]===0x1f4){logger[_0x9ef0('0x13')](_0x9ef0('0xe'),_0x47807b,_0x237590[_0x9ef0('0x13')][_0x9ef0('0x15')]);return _0x4e0581(_0x237590[_0x9ef0('0x13')][_0x9ef0('0x15')]);}logger[_0x9ef0('0x13')](_0x9ef0('0xe'),_0x47807b,_0x237590[_0x9ef0('0x13')]['message']);return _0x1c69bd(_0x237590[_0x9ef0('0x13')][_0x9ef0('0x15')]);}else{logger[_0x9ef0('0xd')](_0x9ef0('0xe'),_0x47807b,_0x9ef0('0xf'));_0x1c69bd(_0x237590[_0x9ef0('0x16')][_0x9ef0('0x15')]);}})[_0x9ef0('0x17')](function(_0x5cada0){logger[_0x9ef0('0x13')](_0x9ef0('0xe'),_0x47807b,_0x5cada0);_0x4e0581(_0x5cada0);});});} \ No newline at end of file +var _0xc5b6=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util'];(function(_0x6ffc3d,_0x3fd67d){var _0x4a83fc=function(_0x23b846){while(--_0x23b846){_0x6ffc3d['push'](_0x6ffc3d['shift']());}};_0x4a83fc(++_0x3fd67d);}(_0xc5b6,0xe2));var _0x6c5b=function(_0x36c72c,_0x144535){_0x36c72c=_0x36c72c-0x0;var _0x3f6f1b=_0xc5b6[_0x36c72c];return _0x3f6f1b;};'use strict';var _=require(_0x6c5b('0x0'));var util=require(_0x6c5b('0x1'));var moment=require(_0x6c5b('0x2'));var BPromise=require(_0x6c5b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c5b('0x4'))['db'];var utils=require(_0x6c5b('0x5'));var logger=require(_0x6c5b('0x6'))(_0x6c5b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6c5b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6441a0,_0x4aeaee,_0x319378){return new BPromise(function(_0x1118a7,_0x46c19){return client[_0x6c5b('0x9')](_0x6441a0,_0x319378)[_0x6c5b('0xa')](function(_0x72c41){logger[_0x6c5b('0xb')](_0x6c5b('0xc'),_0x4aeaee,_0x6c5b('0xd'));logger['debug'](_0x6c5b('0xe'),_0x4aeaee,_0x6c5b('0xd'),JSON['stringify'](_0x72c41));if(_0x72c41[_0x6c5b('0xf')]){if(_0x72c41[_0x6c5b('0xf')][_0x6c5b('0x10')]===0x1f4){logger[_0x6c5b('0xf')]('License,\x20%s,\x20%s',_0x4aeaee,_0x72c41[_0x6c5b('0xf')][_0x6c5b('0x11')]);return _0x46c19(_0x72c41[_0x6c5b('0xf')]['message']);}logger[_0x6c5b('0xf')](_0x6c5b('0xc'),_0x4aeaee,_0x72c41['error'][_0x6c5b('0x11')]);return _0x1118a7(_0x72c41[_0x6c5b('0xf')][_0x6c5b('0x11')]);}else{logger[_0x6c5b('0xb')](_0x6c5b('0xc'),_0x4aeaee,_0x6c5b('0xd'));_0x1118a7(_0x72c41['result'][_0x6c5b('0x11')]);}})[_0x6c5b('0x12')](function(_0x480e6a){logger[_0x6c5b('0xf')](_0x6c5b('0xc'),_0x4aeaee,_0x480e6a);_0x46c19(_0x480e6a);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 76a8928..4761755 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 _0x3bf1=['create','addSmtp','addApplications','send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeSmtp','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','getAgents','post','addDisposition','addAnswer'];(function(_0xfc8634,_0x45312b){var _0x130cb8=function(_0x330a8d){while(--_0x330a8d){_0xfc8634['push'](_0xfc8634['shift']());}};_0x130cb8(++_0x45312b);}(_0x3bf1,0x1b2));var _0x13bf=function(_0x4bc96e,_0x4e763d){_0x4bc96e=_0x4bc96e-0x0;var _0x511ff7=_0x3bf1[_0x4bc96e];return _0x511ff7;};'use strict';var multer=require(_0x13bf('0x0'));var util=require(_0x13bf('0x1'));var path=require(_0x13bf('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x13bf('0x3')]();var fs_extra=require(_0x13bf('0x4'));var auth=require(_0x13bf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x13bf('0x6'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0x13bf('0x7')](),controller['index']);router[_0x13bf('0x8')](_0x13bf('0x9'),auth[_0x13bf('0x7')](),controller['describe']);router[_0x13bf('0x8')](_0x13bf('0xa'),auth[_0x13bf('0x7')](),controller['show']);router[_0x13bf('0x8')](_0x13bf('0xb'),auth[_0x13bf('0x7')](),controller[_0x13bf('0xc')]);router[_0x13bf('0x8')](_0x13bf('0xd'),auth['isAuthenticated'](),controller[_0x13bf('0xe')]);router[_0x13bf('0x8')](_0x13bf('0xf'),auth['isAuthenticated'](),controller['getImap']);router[_0x13bf('0x8')](_0x13bf('0x10'),auth['isAuthenticated'](),controller[_0x13bf('0x11')]);router[_0x13bf('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x13bf('0x12')]);router['get'](_0x13bf('0x13'),auth[_0x13bf('0x7')](),controller[_0x13bf('0x14')]);router[_0x13bf('0x8')](_0x13bf('0x15'),auth[_0x13bf('0x7')](),controller[_0x13bf('0x16')]);router[_0x13bf('0x8')](_0x13bf('0x17'),auth[_0x13bf('0x7')](),controller['verifySmtp']);router['get']('/:id/users',auth[_0x13bf('0x7')](),controller[_0x13bf('0x18')]);router[_0x13bf('0x19')](_0x13bf('0xb'),auth[_0x13bf('0x7')](),controller[_0x13bf('0x1a')]);router[_0x13bf('0x19')](_0x13bf('0xd'),auth['isAuthenticated'](),controller[_0x13bf('0x1b')]);router['post']('/',auth['isAuthenticated'](),controller[_0x13bf('0x1c')]);router['post'](_0x13bf('0xf'),auth['isAuthenticated'](),controller['addImap']);router[_0x13bf('0x19')]('/:id/out_servers',auth[_0x13bf('0x7')](),controller[_0x13bf('0x1d')]);router['post']('/:id/interactions',auth[_0x13bf('0x7')](),controller['addInteraction']);router[_0x13bf('0x19')](_0x13bf('0x13'),auth[_0x13bf('0x7')](),controller[_0x13bf('0x1e')]);router['post']('/:id/send',auth[_0x13bf('0x7')](),controller[_0x13bf('0x1f')]);router['post'](_0x13bf('0x20'),auth[_0x13bf('0x7')](),controller[_0x13bf('0x21')]);router[_0x13bf('0x22')](_0x13bf('0xa'),auth[_0x13bf('0x7')](),controller[_0x13bf('0x23')]);router[_0x13bf('0x24')]('/:id/dispositions',auth[_0x13bf('0x7')](),controller[_0x13bf('0x25')]);router['delete'](_0x13bf('0xd'),auth[_0x13bf('0x7')](),controller[_0x13bf('0x26')]);router[_0x13bf('0x24')](_0x13bf('0xf'),auth[_0x13bf('0x7')](),controller['removeImap']);router[_0x13bf('0x24')](_0x13bf('0x10'),auth[_0x13bf('0x7')](),controller[_0x13bf('0x27')]);router['delete'](_0x13bf('0xa'),auth[_0x13bf('0x7')](),controller[_0x13bf('0x28')]);router[_0x13bf('0x24')](_0x13bf('0x20'),auth[_0x13bf('0x7')](),controller['removeAgents']);module[_0x13bf('0x29')]=router; \ No newline at end of file +var _0x0782=['getInteractions','/:id/messages','getMessages','/:id/verify','verifySmtp','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','/:id/send','/:id/users','addAgents','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeImap','destroy','removeAgents','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions'];(function(_0x16b3f9,_0x3e746f){var _0x421fe0=function(_0x86bc97){while(--_0x86bc97){_0x16b3f9['push'](_0x16b3f9['shift']());}};_0x421fe0(++_0x3e746f);}(_0x0782,0xe3));var _0x2078=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x0782[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require('multer');var util=require(_0x2078('0x0'));var path=require(_0x2078('0x1'));var timeout=require(_0x2078('0x2'));var express=require(_0x2078('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2078('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2078('0x5'));var controller=require(_0x2078('0x6'));router[_0x2078('0x7')]('/',auth[_0x2078('0x8')](),controller[_0x2078('0x9')]);router[_0x2078('0x7')](_0x2078('0xa'),auth[_0x2078('0x8')](),controller['describe']);router[_0x2078('0x7')](_0x2078('0xb'),auth[_0x2078('0x8')](),controller['show']);router['get'](_0x2078('0xc'),auth[_0x2078('0x8')](),controller[_0x2078('0xd')]);router[_0x2078('0x7')]('/:id/canned_answers',auth[_0x2078('0x8')](),controller['getAnswers']);router['get'](_0x2078('0xe'),auth[_0x2078('0x8')](),controller[_0x2078('0xf')]);router[_0x2078('0x7')](_0x2078('0x10'),auth[_0x2078('0x8')](),controller[_0x2078('0x11')]);router[_0x2078('0x7')](_0x2078('0x12'),auth['isAuthenticated'](),controller[_0x2078('0x13')]);router[_0x2078('0x7')]('/:id/applications',auth[_0x2078('0x8')](),controller['getApplications']);router[_0x2078('0x7')](_0x2078('0x14'),auth[_0x2078('0x8')](),controller[_0x2078('0x15')]);router[_0x2078('0x7')](_0x2078('0x16'),auth[_0x2078('0x8')](),controller[_0x2078('0x17')]);router[_0x2078('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x2078('0x18')](_0x2078('0xc'),auth[_0x2078('0x8')](),controller[_0x2078('0x19')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2078('0x1a')]);router[_0x2078('0x18')]('/',auth[_0x2078('0x8')](),controller[_0x2078('0x1b')]);router[_0x2078('0x18')](_0x2078('0xe'),auth[_0x2078('0x8')](),controller[_0x2078('0x1c')]);router[_0x2078('0x18')](_0x2078('0x10'),auth[_0x2078('0x8')](),controller[_0x2078('0x1d')]);router['post'](_0x2078('0x12'),auth[_0x2078('0x8')](),controller[_0x2078('0x1e')]);router[_0x2078('0x18')]('/:id/applications',auth[_0x2078('0x8')](),controller['addApplications']);router[_0x2078('0x18')](_0x2078('0x1f'),auth['isAuthenticated'](),controller['send']);router[_0x2078('0x18')](_0x2078('0x20'),auth[_0x2078('0x8')](),controller[_0x2078('0x21')]);router['put']('/:id',auth[_0x2078('0x8')](),controller['update']);router[_0x2078('0x22')](_0x2078('0xc'),auth[_0x2078('0x8')](),controller[_0x2078('0x23')]);router[_0x2078('0x22')](_0x2078('0x24'),auth[_0x2078('0x8')](),controller[_0x2078('0x25')]);router['delete'](_0x2078('0xe'),auth[_0x2078('0x8')](),controller[_0x2078('0x26')]);router[_0x2078('0x22')](_0x2078('0x10'),auth[_0x2078('0x8')](),controller['removeSmtp']);router[_0x2078('0x22')](_0x2078('0xb'),auth['isAuthenticated'](),controller[_0x2078('0x27')]);router[_0x2078('0x22')](_0x2078('0x20'),auth[_0x2078('0x8')](),controller[_0x2078('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 113df07..9037d39 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 _0xe9e5=['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','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','hotmail','yahoo','outlook365','getDataValue','provider','custom','setDataValue','BOOLEAN','STRING','TEXT','Arial,Helvetica,sans-serif','INTEGER'];(function(_0x35fabd,_0x825452){var _0x61a8ee=function(_0x218f4c){while(--_0x218f4c){_0x35fabd['push'](_0x35fabd['shift']());}};_0x61a8ee(++_0x825452);}(_0xe9e5,0x1d7));var _0x5e9e=function(_0x2d839d,_0x29a08c){_0x2d839d=_0x2d839d-0x0;var _0x5dc2ff=_0xe9e5[_0x2d839d];return _0x5dc2ff;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x5e9e('0x0')],'defaultValue':![]},'email':{'type':Sequelize[_0x5e9e('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x5e9e('0x0')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x5e9e('0x2')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5e9e('0x3')},'fontSize':{'type':Sequelize[_0x5e9e('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5e9e('0x5');}},'notificationSound':{'type':Sequelize[_0x5e9e('0x0')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5e9e('0x0')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5e9e('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5e9e('0x0')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5e9e('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5e9e('0x0')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5e9e('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5e9e('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x5e9e('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x5e9e('0x0')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x6a84ab){if(!_0x6a84ab)this['setDataValue'](_0x5e9e('0x7'),null);this['setDataValue'](_0x5e9e('0x8'),_0x6a84ab);}},'provider':{'type':Sequelize[_0x5e9e('0x9')]('gmail',_0x5e9e('0xa'),_0x5e9e('0xb'),_0x5e9e('0xc')),'defaultValue':null,'get':function(){var _0x1d234a=this[_0x5e9e('0xd')](_0x5e9e('0xe'));return _0x1d234a||_0x5e9e('0xf');},'set':function(_0x433218){if(_0x433218===_0x5e9e('0xf')){_0x433218=null;}return this[_0x5e9e('0x10')](_0x5e9e('0xe'),_0x433218);}}}; \ No newline at end of file +var _0xb450=['hotmail','yahoo','getDataValue','provider','custom','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','gmail'];(function(_0xf53142,_0x97fe17){var _0x15293a=function(_0x46a40b){while(--_0x46a40b){_0xf53142['push'](_0xf53142['shift']());}};_0x15293a(++_0x97fe17);}(_0xb450,0xcb));var _0x0b45=function(_0x449198,_0x4c97a5){_0x449198=_0x449198-0x0;var _0x1070c6=_0xb450[_0x449198];return _0x1070c6;};'use strict';var Sequelize=require('sequelize');module[_0x0b45('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x0b45('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x0b45('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x0b45('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x0b45('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x0b45('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x0b45('0x3')]},'markAsUnread':{'type':Sequelize[_0x0b45('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x0b45('0x1')],'allowNull':![],'defaultValue':_0x0b45('0x4')},'fontSize':{'type':Sequelize[_0x0b45('0x5')](0x2)[_0x0b45('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0b45('0x7');}},'notificationSound':{'type':Sequelize[_0x0b45('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0b45('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0b45('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0b45('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0b45('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x0b45('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x0b45('0x2')],'defaultValue':![],'comment':_0x0b45('0x9'),'set':function(_0x4c2444){if(!_0x4c2444)this[_0x0b45('0xa')](_0x0b45('0xb'),null);this[_0x0b45('0xa')]('mandatoryDisposition',_0x4c2444);}},'provider':{'type':Sequelize['ENUM'](_0x0b45('0xc'),_0x0b45('0xd'),_0x0b45('0xe'),'outlook365'),'defaultValue':null,'get':function(){var _0x159923=this[_0x0b45('0xf')](_0x0b45('0x10'));return _0x159923||_0x0b45('0x11');},'set':function(_0x2654ab){if(_0x2654ab===_0x0b45('0x11')){_0x2654ab=null;}return this[_0x0b45('0xa')](_0x0b45('0x10'),_0x2654ab);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index f46a167..7629a81 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 _0xbc71=['addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','create','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','MailInteraction','addInteraction','getInteractions','CmContact','Owner','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','format','inlineCss','split','updatedAt','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','root','basename','getSmtpOptions','SendMail','sendMail','List','List\x20not\x20found','Contacts','subject','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','verifySmtp','CloudProvider','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','User','getAgents','moment','util','path','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','sendStatus','name','send','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','username','password','pass','modernAuthentication','CloudProviderId','host','port','authentication','Imap','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','show','params','Smtp','Pause','length','includeAll','options','find','body','provider','custom','secure','Mail\x20Account\x20not\x20found','service','describe','MailAccountId','getDispositions','findOne','Disposition','rows','removeDispositions'];(function(_0x3079b9,_0x58d2f4){var _0x105101=function(_0x140d4e){while(--_0x140d4e){_0x3079b9['push'](_0x3079b9['shift']());}};_0x105101(++_0x58d2f4);}(_0xbc71,0x114));var _0x1bc7=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xbc71[_0x55f8b4];return _0x2475f9;};'use strict';var moment=require(_0x1bc7('0x0'));var BPromise=require('bluebird');var util=require(_0x1bc7('0x1'));var path=require(_0x1bc7('0x2'));var _=require('lodash');var juice=require(_0x1bc7('0x3'));var Redis=require(_0x1bc7('0x4'));var qs=require(_0x1bc7('0x5'));var logger=require(_0x1bc7('0x6'))(_0x1bc7('0x7'));var config=require(_0x1bc7('0x8'));var db=require(_0x1bc7('0x9'))['db'];config[_0x1bc7('0xa')]=_[_0x1bc7('0xb')](config[_0x1bc7('0xa')],{'host':_0x1bc7('0xc'),'port':0x18eb});var socket=require(_0x1bc7('0xd'))(new Redis(config[_0x1bc7('0xa')]));require(_0x1bc7('0xe'))[_0x1bc7('0xf')](socket);var jayson=require(_0x1bc7('0x10'));var client=jayson[_0x1bc7('0x11')][_0x1bc7('0x12')]({'port':0x232b});function respondWithRpcPromise(_0x1fc637,_0x139243,_0x2ac87c,_0x586089){return new BPromise(function(_0x4aa5e7,_0x32b4eb){var _0x45a0b6=_0x586089||client;return _0x45a0b6['request'](_0x1fc637,_0x2ac87c)[_0x1bc7('0x13')](function(_0x1015aa){logger[_0x1bc7('0x14')]('MailAccount,\x20%s,\x20%s',_0x139243,_0x1bc7('0x15'));logger[_0x1bc7('0x16')](_0x1bc7('0x17'),_0x139243,_0x1bc7('0x15'),JSON[_0x1bc7('0x18')](_0x1015aa));if(_0x1015aa['error']){if(_0x1015aa[_0x1bc7('0x19')][_0x1bc7('0x1a')]===0x1f4){logger[_0x1bc7('0x19')](_0x1bc7('0x1b'),_0x139243,_0x1015aa[_0x1bc7('0x19')][_0x1bc7('0x1c')]);return _0x32b4eb(_0x1015aa[_0x1bc7('0x19')][_0x1bc7('0x1c')]);}logger[_0x1bc7('0x19')](_0x1bc7('0x1b'),_0x139243,_0x1015aa[_0x1bc7('0x19')]['message']);return _0x4aa5e7(_0x1015aa['error']['message']);}else{logger[_0x1bc7('0x14')]('MailAccount,\x20%s,\x20%s',_0x139243,_0x1bc7('0x15'));_0x4aa5e7(_0x1015aa[_0x1bc7('0x1d')]['message']);}})[_0x1bc7('0x1e')](function(_0x567e76){logger[_0x1bc7('0x19')](_0x1bc7('0x1b'),_0x139243,_0x567e76);_0x32b4eb(_0x567e76);});});}function respondWithStatusCode(_0x617f67,_0x4f03d2){_0x4f03d2=_0x4f03d2||0xcc;return function(_0x334bfe){if(_0x334bfe){return _0x617f67['sendStatus'](_0x4f03d2);}return _0x617f67[_0x1bc7('0x1f')](_0x4f03d2)[_0x1bc7('0x20')]();};}function respondWithResult(_0x4f6fc7,_0x4a6f78){_0x4a6f78=_0x4a6f78||0xc8;return function(_0x29acd4){if(_0x29acd4){return _0x4f6fc7[_0x1bc7('0x1f')](_0x4a6f78)[_0x1bc7('0x21')](_0x29acd4);}};}function respondWithFilteredResult(_0x5e5dce,_0x4e0113){return function(_0x3adb15){if(_0x3adb15){var _0x5148f3=typeof _0x4e0113[_0x1bc7('0x22')]===_0x1bc7('0x23')&&typeof _0x4e0113[_0x1bc7('0x24')]===_0x1bc7('0x23');var _0x2aa658=_0x3adb15[_0x1bc7('0x25')];var _0x434925=_0x5148f3?0x0:_0x4e0113[_0x1bc7('0x22')];var _0x362e5e=_0x5148f3?_0x3adb15['count']:_0x4e0113[_0x1bc7('0x22')]+_0x4e0113[_0x1bc7('0x24')];var _0x438c25;if(_0x362e5e>=_0x2aa658){_0x362e5e=_0x2aa658;_0x438c25=0xc8;}else{_0x438c25=0xce;}_0x5e5dce[_0x1bc7('0x1f')](_0x438c25);return _0x5e5dce['set'](_0x1bc7('0x26'),_0x434925+'-'+_0x362e5e+'/'+_0x2aa658)[_0x1bc7('0x21')](_0x3adb15);}return null;};}function saveUpdates(_0x8d911d){return function(_0x2f29e4){if(_0x2f29e4){return _0x2f29e4[_0x1bc7('0x27')](_0x8d911d)[_0x1bc7('0x13')](function(_0x3815b4){return _0x3815b4;});}return null;};}function removeEntity(_0x2f971e){return function(_0x48467d){if(_0x48467d){return _0x48467d[_0x1bc7('0x28')]()['then'](function(){var _0x3406ef=_0x48467d[_0x1bc7('0x29')]({'plain':!![]});var _0x595387=_0x1bc7('0x2a');return db[_0x1bc7('0x2b')]['destroy']({'where':{'type':_0x595387,'resourceId':_0x3406ef['id']}})[_0x1bc7('0x13')](function(){return _0x48467d;});})[_0x1bc7('0x13')](function(){_0x2f971e[_0x1bc7('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51cfb9){return function(_0x429db4){if(!_0x429db4){_0x51cfb9[_0x1bc7('0x2c')](0x194);}return _0x429db4;};}function handleError(_0x372758,_0x33017f){_0x33017f=_0x33017f||0x1f4;return function(_0x2a26dc){logger[_0x1bc7('0x19')](_0x2a26dc['stack']);if(_0x2a26dc[_0x1bc7('0x2d')]){delete _0x2a26dc[_0x1bc7('0x2d')];}_0x372758[_0x1bc7('0x1f')](_0x33017f)[_0x1bc7('0x2e')](_0x2a26dc);};}function getImapHost(_0x2a0127){switch(_0x2a0127){case _0x1bc7('0x2f'):return _0x1bc7('0x30');case'yahoo':return _0x1bc7('0x31');case'hotmail':return _0x1bc7('0x32');case _0x1bc7('0x33'):return _0x1bc7('0x34');}throw new Error(_0x1bc7('0x35'),_0x2a0127);}function getSmtpHost(_0x34a302){switch(_0x34a302){case _0x1bc7('0x2f'):return _0x1bc7('0x36');case _0x1bc7('0x37'):return _0x1bc7('0x38');case _0x1bc7('0x39'):return'smtp-mail.outlook.com';case'outlook365':return _0x1bc7('0x3a');}throw new Error(_0x1bc7('0x35'),_0x34a302);}function getAuthenticationOptions(_0x5364ea,_0x3a3ae3){var _0x2828fb={};var _0x26202f={};if(_0x5364ea){_0x2828fb['user']=_0x26202f[_0x1bc7('0x3b')]=_0x3a3ae3[_0x1bc7('0x3c')];_0x2828fb[_0x1bc7('0x3d')]=_0x26202f[_0x1bc7('0x3e')]=_0x3a3ae3['password'];if(_0x3a3ae3[_0x1bc7('0x3f')]){_0x2828fb[_0x1bc7('0x3f')]=_0x26202f['modernAuthentication']=!![];_0x2828fb[_0x1bc7('0x40')]=_0x26202f[_0x1bc7('0x40')]=_0x3a3ae3[_0x1bc7('0x40')];_0x2828fb[_0x1bc7('0x3d')]=_0x26202f[_0x1bc7('0x3e')]=null;}else{_0x2828fb['CloudProviderId']=_0x26202f['CloudProviderId']=null;}_0x2828fb[_0x1bc7('0x41')]=getImapHost(_0x5364ea);_0x2828fb[_0x1bc7('0x42')]=0x3e1;_0x26202f['host']=getSmtpHost(_0x5364ea);_0x26202f[_0x1bc7('0x42')]=0x24b;_0x26202f['secure']=![];_0x2828fb['service']=_0x26202f['service']=null;}else{if(_0x3a3ae3[_0x1bc7('0x43')]){_0x2828fb['user']=_0x26202f['user']=_0x3a3ae3[_0x1bc7('0x3c')];_0x2828fb[_0x1bc7('0x3d')]=_0x26202f[_0x1bc7('0x3e')]=_0x3a3ae3[_0x1bc7('0x3d')];}else{_0x2828fb[_0x1bc7('0x43')]=_0x26202f['authentication']=![];_0x2828fb[_0x1bc7('0x3b')]=_0x26202f['user']=null;_0x2828fb[_0x1bc7('0x3d')]=_0x26202f[_0x1bc7('0x3e')]=null;}_0x2828fb[_0x1bc7('0x41')]=_0x3a3ae3[_0x1bc7('0x44')][_0x1bc7('0x41')];_0x2828fb['port']=_0x3a3ae3['Imap']['port'];_0x26202f['host']=_0x3a3ae3['Smtp'][_0x1bc7('0x41')];_0x26202f[_0x1bc7('0x42')]=_0x3a3ae3['Smtp'][_0x1bc7('0x42')];}return{'Imap':_0x2828fb,'Smtp':_0x26202f};}exports['index']=function(_0x5939db,_0x1cb754){var _0xddbb84={'include':[{'model':db[_0x1bc7('0x45')],'as':_0x1bc7('0x44')},{'model':db[_0x1bc7('0x46')],'as':'Smtp'},{'model':db['Pause'],'as':_0x1bc7('0x47')}]},_0x90f95f={},_0x1ba747={'count':0x0,'rows':[]};var _0x160dd6=_[_0x1bc7('0x48')](db[_0x1bc7('0x49')][_0x1bc7('0x4a')],function(_0x4fdf1b){return{'name':_0x4fdf1b[_0x1bc7('0x4b')],'type':_0x4fdf1b['type'][_0x1bc7('0x4c')]};});_0x90f95f[_0x1bc7('0x4d')]=_[_0x1bc7('0x48')](_0x160dd6,_0x1bc7('0x2d'));_0x90f95f['query']=_[_0x1bc7('0x4e')](_0x5939db['query']);_0x90f95f[_0x1bc7('0x4f')]=_[_0x1bc7('0x50')](_0x90f95f[_0x1bc7('0x4d')],_0x90f95f[_0x1bc7('0x51')]);_0xddbb84['attributes']=_[_0x1bc7('0x50')](_0x90f95f[_0x1bc7('0x4d')],qs['fields'](_0x5939db[_0x1bc7('0x51')][_0x1bc7('0x52')]));_0xddbb84[_0x1bc7('0x53')]=_0xddbb84['attributes']['length']?_0xddbb84[_0x1bc7('0x53')]:_0x90f95f[_0x1bc7('0x4d')];if(!_0x5939db[_0x1bc7('0x51')][_0x1bc7('0x54')](_0x1bc7('0x55'))){_0xddbb84[_0x1bc7('0x24')]=qs[_0x1bc7('0x24')](_0x5939db[_0x1bc7('0x51')][_0x1bc7('0x24')]);_0xddbb84[_0x1bc7('0x22')]=qs[_0x1bc7('0x22')](_0x5939db[_0x1bc7('0x51')][_0x1bc7('0x22')]);}_0xddbb84[_0x1bc7('0x56')]=qs[_0x1bc7('0x57')](_0x5939db[_0x1bc7('0x51')][_0x1bc7('0x57')]);_0xddbb84['where']=qs[_0x1bc7('0x4f')](_[_0x1bc7('0x58')](_0x5939db['query'],_0x90f95f[_0x1bc7('0x4f')]),_0x160dd6);if(_0x5939db[_0x1bc7('0x51')][_0x1bc7('0x59')]){_0xddbb84[_0x1bc7('0x5a')]=_[_0x1bc7('0x5b')](_0xddbb84[_0x1bc7('0x5a')],{'$or':_[_0x1bc7('0x48')](_0x160dd6,function(_0x1768e7){if(_0x1768e7['type']!==_0x1bc7('0x5c')){var _0x1372e5={};_0x1372e5[_0x1768e7[_0x1bc7('0x2d')]]={'$like':'%'+_0x5939db[_0x1bc7('0x51')][_0x1bc7('0x59')]+'%'};return _0x1372e5;}})});}_0xddbb84=_['merge']({},_0xddbb84,_0x5939db['options']);var _0x1efd6e={'where':_0xddbb84[_0x1bc7('0x5a')]};return db[_0x1bc7('0x49')][_0x1bc7('0x25')](_0x1efd6e)[_0x1bc7('0x13')](function(_0x142f09){_0x1ba747[_0x1bc7('0x25')]=_0x142f09;if(_0x5939db['query']['includeAll']){_0xddbb84[_0x1bc7('0x5d')]=[{'all':!![]}];}return db[_0x1bc7('0x49')][_0x1bc7('0x5e')](_0xddbb84);})['then'](function(_0x5daf91){_0x1ba747['rows']=_0x5daf91;return _0x1ba747;})[_0x1bc7('0x13')](respondWithFilteredResult(_0x1cb754,_0xddbb84))['catch'](handleError(_0x1cb754,null));};exports[_0x1bc7('0x5f')]=function(_0x530f10,_0x2825de){var _0x52ef8b={'raw':![],'where':{'id':_0x530f10[_0x1bc7('0x60')]['id']},'include':[{'model':db[_0x1bc7('0x45')],'as':_0x1bc7('0x44')},{'model':db[_0x1bc7('0x46')],'as':_0x1bc7('0x61')},{'model':db[_0x1bc7('0x62')],'as':_0x1bc7('0x47')}]},_0x40a1c5={};_0x40a1c5['model']=_[_0x1bc7('0x4e')](db[_0x1bc7('0x49')][_0x1bc7('0x4a')]);_0x40a1c5[_0x1bc7('0x51')]=_[_0x1bc7('0x4e')](_0x530f10[_0x1bc7('0x51')]);_0x40a1c5['filters']=_[_0x1bc7('0x50')](_0x40a1c5['model'],_0x40a1c5[_0x1bc7('0x51')]);_0x52ef8b[_0x1bc7('0x53')]=_[_0x1bc7('0x50')](_0x40a1c5['model'],qs['fields'](_0x530f10['query'][_0x1bc7('0x52')]));_0x52ef8b[_0x1bc7('0x53')]=_0x52ef8b[_0x1bc7('0x53')][_0x1bc7('0x63')]?_0x52ef8b[_0x1bc7('0x53')]:_0x40a1c5[_0x1bc7('0x4d')];if(_0x530f10[_0x1bc7('0x51')][_0x1bc7('0x64')]){_0x52ef8b[_0x1bc7('0x5d')]=[{'all':!![]}];}_0x52ef8b=_[_0x1bc7('0x5b')]({},_0x52ef8b,_0x530f10[_0x1bc7('0x65')]);return db['MailAccount'][_0x1bc7('0x66')](_0x52ef8b)['then'](handleEntityNotFound(_0x2825de,null))[_0x1bc7('0x13')](respondWithResult(_0x2825de,null))[_0x1bc7('0x1e')](handleError(_0x2825de,null));};exports[_0x1bc7('0x27')]=function(_0x2ac621,_0x23c9cb){if(_0x2ac621[_0x1bc7('0x67')]['id']){delete _0x2ac621[_0x1bc7('0x67')]['id'];}var _0x3117ef=_0x2ac621[_0x1bc7('0x67')][_0x1bc7('0x68')]===_0x1bc7('0x69')?null:_0x2ac621[_0x1bc7('0x67')][_0x1bc7('0x68')];var _0x34b6ec=_0x2ac621['body'][_0x1bc7('0x44')]||{};var _0x24ce83=_0x2ac621[_0x1bc7('0x67')][_0x1bc7('0x61')]||{};if(_0x3117ef){_0x34b6ec[_0x1bc7('0x41')]=getImapHost(_0x3117ef);_0x34b6ec['port']=0x3e1;_0x24ce83[_0x1bc7('0x41')]=getSmtpHost(_0x3117ef);_0x24ce83[_0x1bc7('0x42')]=0x24b;_0x24ce83['secure']=![];}if(_0x24ce83[_0x1bc7('0x3f')]){_0x24ce83[_0x1bc7('0x6a')]=![];}else{_0x24ce83[_0x1bc7('0x40')]=null;}if(!_0x34b6ec['modernAuthentication'])_0x34b6ec[_0x1bc7('0x40')]=null;_0x2ac621[_0x1bc7('0x67')][_0x1bc7('0x44')]=_0x34b6ec;_0x2ac621[_0x1bc7('0x67')][_0x1bc7('0x61')]=_0x24ce83;return db[_0x1bc7('0x49')][_0x1bc7('0x66')]({'where':{'id':_0x2ac621[_0x1bc7('0x60')]['id']},'include':[{'model':db[_0x1bc7('0x45')],'as':_0x1bc7('0x44')},{'model':db[_0x1bc7('0x46')],'as':'Smtp'},{'model':db[_0x1bc7('0x62')],'as':_0x1bc7('0x47')}]})[_0x1bc7('0x13')](handleEntityNotFound(_0x23c9cb,null))[_0x1bc7('0x13')](function(_0x1da0bb){if(!_0x1da0bb)throw new Error(_0x1bc7('0x6b'));if(_0x1da0bb[_0x1bc7('0x6c')])delete _0x2ac621[_0x1bc7('0x67')]['Imap'];return _0x1da0bb;})[_0x1bc7('0x13')](saveUpdates(_0x2ac621['body'],null))[_0x1bc7('0x13')](function(_0x528124){if(!_0x2ac621['body'][_0x1bc7('0x44')])return _0x528124;return db[_0x1bc7('0x45')][_0x1bc7('0x27')](_0x2ac621[_0x1bc7('0x67')][_0x1bc7('0x44')],{'where':{'MailAccountId':_0x528124['id']}})['then'](function(){return _0x528124;});})[_0x1bc7('0x13')](function(_0x52a85d){if(!_0x2ac621[_0x1bc7('0x67')][_0x1bc7('0x61')])return _0x52a85d;return db[_0x1bc7('0x46')][_0x1bc7('0x27')](_0x2ac621[_0x1bc7('0x67')][_0x1bc7('0x61')],{'where':{'MailAccountId':_0x52a85d['id']}})[_0x1bc7('0x13')](function(){return _0x52a85d;});})[_0x1bc7('0x13')](respondWithResult(_0x23c9cb,null))[_0x1bc7('0x1e')](handleError(_0x23c9cb,null));};exports['describe']=function(_0x4175ec,_0x331543){return db[_0x1bc7('0x49')][_0x1bc7('0x6d')]()[_0x1bc7('0x13')](respondWithResult(_0x331543,null))['catch'](handleError(_0x331543,null));};exports['addDisposition']=function(_0x136fe9,_0x5e9077){if(_0x136fe9[_0x1bc7('0x67')]['id']){delete _0x136fe9[_0x1bc7('0x67')]['id'];}return db['MailAccount'][_0x1bc7('0x66')]({'where':{'id':_0x136fe9[_0x1bc7('0x60')]['id']}})[_0x1bc7('0x13')](handleEntityNotFound(_0x5e9077,null))[_0x1bc7('0x13')](function(_0x1dba15){if(_0x1dba15){_0x136fe9[_0x1bc7('0x67')][_0x1bc7('0x6e')]=_0x1dba15['id'];return db['Disposition']['create'](_0x136fe9[_0x1bc7('0x67')]);}})['then'](respondWithResult(_0x5e9077,null))['catch'](handleError(_0x5e9077,null));};exports[_0x1bc7('0x6f')]=function(_0x42a81e,_0x4afd86){var _0x2646a1={'raw':![],'where':{}};var _0x5a833c={};var _0x321348={'count':0x0,'rows':[]};return db[_0x1bc7('0x49')][_0x1bc7('0x70')]({'where':{'id':_0x42a81e[_0x1bc7('0x60')]['id']}})['then'](handleEntityNotFound(_0x4afd86,null))['then'](function(_0x206d21){if(_0x206d21){_0x5a833c['model']=_[_0x1bc7('0x4e')](db[_0x1bc7('0x71')][_0x1bc7('0x4a')]);_0x5a833c['query']=_[_0x1bc7('0x4e')](_0x42a81e[_0x1bc7('0x51')]);_0x5a833c[_0x1bc7('0x4f')]=_[_0x1bc7('0x50')](_0x5a833c[_0x1bc7('0x4d')],_0x5a833c[_0x1bc7('0x51')]);_0x2646a1[_0x1bc7('0x53')]=_[_0x1bc7('0x50')](_0x5a833c['model'],qs[_0x1bc7('0x52')](_0x42a81e[_0x1bc7('0x51')][_0x1bc7('0x52')]));_0x2646a1['attributes']=_0x2646a1['attributes'][_0x1bc7('0x63')]?_0x2646a1[_0x1bc7('0x53')]:_0x5a833c['model'];if(!_0x42a81e[_0x1bc7('0x51')][_0x1bc7('0x54')](_0x1bc7('0x55'))){_0x2646a1[_0x1bc7('0x24')]=qs[_0x1bc7('0x24')](_0x42a81e[_0x1bc7('0x51')][_0x1bc7('0x24')]);_0x2646a1[_0x1bc7('0x22')]=qs[_0x1bc7('0x22')](_0x42a81e[_0x1bc7('0x51')][_0x1bc7('0x22')]);}_0x2646a1['order']=qs[_0x1bc7('0x57')](_0x42a81e[_0x1bc7('0x51')]['sort']);_0x2646a1[_0x1bc7('0x5a')]=qs[_0x1bc7('0x4f')](_['pick'](_0x42a81e[_0x1bc7('0x51')],_0x5a833c[_0x1bc7('0x4f')]));_0x2646a1[_0x1bc7('0x5a')]['MailAccountId']=_0x206d21['id'];if(_0x42a81e[_0x1bc7('0x51')][_0x1bc7('0x59')]){_0x2646a1[_0x1bc7('0x5a')]=_['merge'](_0x2646a1[_0x1bc7('0x5a')],{'$or':_[_0x1bc7('0x48')](_0x2646a1['attributes'],function(_0x40048a){var _0x284172={};_0x284172[_0x40048a]={'$like':'%'+_0x42a81e[_0x1bc7('0x51')]['filter']+'%'};return _0x284172;})});}_0x2646a1=_[_0x1bc7('0x5b')]({},_0x2646a1,_0x42a81e['options']);return db[_0x1bc7('0x71')][_0x1bc7('0x25')]({'where':_0x2646a1[_0x1bc7('0x5a')]})[_0x1bc7('0x13')](function(_0x4bc142){_0x321348[_0x1bc7('0x25')]=_0x4bc142;if(_0x42a81e[_0x1bc7('0x51')][_0x1bc7('0x64')]){_0x2646a1['include']=[{'all':!![]}];}return db[_0x1bc7('0x71')]['findAll'](_0x2646a1);})[_0x1bc7('0x13')](function(_0x41b699){_0x321348[_0x1bc7('0x72')]=_0x41b699;return _0x321348;});}})[_0x1bc7('0x13')](respondWithFilteredResult(_0x4afd86,_0x2646a1))['catch'](handleError(_0x4afd86,null));};exports[_0x1bc7('0x73')]=function(_0x1766bf,_0x610e76){return db[_0x1bc7('0x49')][_0x1bc7('0x66')]({'where':{'id':_0x1766bf[_0x1bc7('0x60')]['id']}})['then'](handleEntityNotFound(_0x610e76,null))[_0x1bc7('0x13')](function(_0x4987b1){if(_0x4987b1){return _0x4987b1['removeDispositions'](_0x1766bf[_0x1bc7('0x51')]['ids']);}})[_0x1bc7('0x13')](respondWithStatusCode(_0x610e76,null))[_0x1bc7('0x1e')](handleError(_0x610e76,null));};exports[_0x1bc7('0x74')]=function(_0x309af0,_0x54691a){if(_0x309af0[_0x1bc7('0x67')]['id']){delete _0x309af0[_0x1bc7('0x67')]['id'];}return db[_0x1bc7('0x49')][_0x1bc7('0x66')]({'where':{'id':_0x309af0[_0x1bc7('0x60')]['id']}})[_0x1bc7('0x13')](handleEntityNotFound(_0x54691a,null))[_0x1bc7('0x13')](function(_0x3fec11){if(_0x3fec11){_0x309af0[_0x1bc7('0x67')][_0x1bc7('0x6e')]=_0x3fec11['id'];return db[_0x1bc7('0x75')]['create'](_0x309af0[_0x1bc7('0x67')]);}})[_0x1bc7('0x13')](respondWithResult(_0x54691a,null))['catch'](handleError(_0x54691a,null));};exports[_0x1bc7('0x76')]=function(_0x52cce9,_0x2cde06){var _0x1924ad={'raw':![],'where':{}};var _0x448a71={};var _0x218dd7={'count':0x0,'rows':[]};return db['MailAccount'][_0x1bc7('0x70')]({'where':{'id':_0x52cce9[_0x1bc7('0x60')]['id']}})[_0x1bc7('0x13')](handleEntityNotFound(_0x2cde06,null))[_0x1bc7('0x13')](function(_0x520215){if(_0x520215){_0x448a71[_0x1bc7('0x4d')]=_['keys'](db[_0x1bc7('0x75')]['rawAttributes']);_0x448a71['query']=_[_0x1bc7('0x4e')](_0x52cce9['query']);_0x448a71[_0x1bc7('0x4f')]=_[_0x1bc7('0x50')](_0x448a71[_0x1bc7('0x4d')],_0x448a71['query']);_0x1924ad[_0x1bc7('0x53')]=_[_0x1bc7('0x50')](_0x448a71['model'],qs['fields'](_0x52cce9['query']['fields']));_0x1924ad[_0x1bc7('0x53')]=_0x1924ad[_0x1bc7('0x53')][_0x1bc7('0x63')]?_0x1924ad['attributes']:_0x448a71['model'];if(!_0x52cce9['query'][_0x1bc7('0x54')](_0x1bc7('0x55'))){_0x1924ad['limit']=qs[_0x1bc7('0x24')](_0x52cce9['query'][_0x1bc7('0x24')]);_0x1924ad[_0x1bc7('0x22')]=qs[_0x1bc7('0x22')](_0x52cce9[_0x1bc7('0x51')]['offset']);}_0x1924ad[_0x1bc7('0x56')]=qs[_0x1bc7('0x57')](_0x52cce9[_0x1bc7('0x51')][_0x1bc7('0x57')]);_0x1924ad[_0x1bc7('0x5a')]=qs[_0x1bc7('0x4f')](_[_0x1bc7('0x58')](_0x52cce9[_0x1bc7('0x51')],_0x448a71[_0x1bc7('0x4f')]));_0x1924ad[_0x1bc7('0x5a')]['MailAccountId']=_0x520215['id'];if(_0x52cce9[_0x1bc7('0x51')][_0x1bc7('0x59')]){_0x1924ad[_0x1bc7('0x5a')]=_[_0x1bc7('0x5b')](_0x1924ad[_0x1bc7('0x5a')],{'$or':_[_0x1bc7('0x48')](_0x1924ad[_0x1bc7('0x53')],function(_0x4a594a){var _0x18401f={};_0x18401f[_0x4a594a]={'$like':'%'+_0x52cce9['query'][_0x1bc7('0x59')]+'%'};return _0x18401f;})});}_0x1924ad=_['merge']({},_0x1924ad,_0x52cce9['options']);return db[_0x1bc7('0x75')][_0x1bc7('0x25')]({'where':_0x1924ad[_0x1bc7('0x5a')]})[_0x1bc7('0x13')](function(_0x4c04fd){_0x218dd7[_0x1bc7('0x25')]=_0x4c04fd;if(_0x52cce9[_0x1bc7('0x51')][_0x1bc7('0x64')]){_0x1924ad[_0x1bc7('0x5d')]=[{'all':!![]}];}return db[_0x1bc7('0x75')]['findAll'](_0x1924ad);})[_0x1bc7('0x13')](function(_0x1b3388){_0x218dd7[_0x1bc7('0x72')]=_0x1b3388;return _0x218dd7;});}})['then'](respondWithFilteredResult(_0x2cde06,_0x1924ad))[_0x1bc7('0x1e')](handleError(_0x2cde06,null));};exports['removeAnswers']=function(_0x2cf134,_0x4d0093){return db[_0x1bc7('0x49')][_0x1bc7('0x66')]({'where':{'id':_0x2cf134[_0x1bc7('0x60')]['id']}})[_0x1bc7('0x13')](handleEntityNotFound(_0x4d0093,null))[_0x1bc7('0x13')](function(_0x544d41){if(_0x544d41){return _0x544d41[_0x1bc7('0x77')](_0x2cf134[_0x1bc7('0x51')][_0x1bc7('0x78')]);}})['then'](respondWithStatusCode(_0x4d0093,null))[_0x1bc7('0x1e')](handleError(_0x4d0093,null));};exports[_0x1bc7('0x79')]=function(_0x2d8bd7,_0x4ce748){var _0x68c6ea={'name':_0x2d8bd7['body']['name'],'key':_0x2d8bd7['body']['key'],'provider':_0x2d8bd7['body']['provider']==='custom'?null:_0x2d8bd7[_0x1bc7('0x67')][_0x1bc7('0x68')],'email':_0x2d8bd7[_0x1bc7('0x67')][_0x1bc7('0x7a')],'ListId':_0x2d8bd7['body'][_0x1bc7('0x7b')],'active':!_[_0x1bc7('0x7c')](_0x2d8bd7['body'][_0x1bc7('0x7d')])?_0x2d8bd7[_0x1bc7('0x67')]['active']:!![],'description':_0x2d8bd7[_0x1bc7('0x67')][_0x1bc7('0x7e')]||null};var _0x3e9805=getAuthenticationOptions(_0x68c6ea[_0x1bc7('0x68')],_0x2d8bd7['body']);_0x68c6ea[_0x1bc7('0x44')]=_0x3e9805[_0x1bc7('0x44')];_0x68c6ea[_0x1bc7('0x61')]=_0x3e9805[_0x1bc7('0x61')];return db['MailAccount'][_0x1bc7('0x79')](_0x68c6ea,{'include':[{'model':db['MailServerOut'],'as':_0x1bc7('0x61')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x1bc7('0x13')](function(_0x3db095){var _0x5af9a3=_0x2d8bd7[_0x1bc7('0x3b')][_0x1bc7('0x29')]({'plain':!![]});if(!_0x5af9a3)throw new Error(_0x1bc7('0x7f'));if(_0x5af9a3[_0x1bc7('0x80')]==='user'){var _0x23da49=_0x3db095['get']({'plain':!![]});return db['UserProfileSection'][_0x1bc7('0x66')]({'where':{'name':_0x1bc7('0x2a'),'userProfileId':_0x5af9a3[_0x1bc7('0x81')]},'raw':!![]})[_0x1bc7('0x13')](function(_0x5db368){if(_0x5db368&&_0x5db368[_0x1bc7('0x82')]===0x0){return db[_0x1bc7('0x2b')][_0x1bc7('0x79')]({'name':_0x23da49[_0x1bc7('0x2d')],'resourceId':_0x23da49['id'],'type':_0x5db368[_0x1bc7('0x2d')],'sectionId':_0x5db368['id']},{})['then'](function(){return _0x3db095;});}else{return _0x3db095;}})[_0x1bc7('0x1e')](function(_0x251443){logger[_0x1bc7('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x251443);throw _0x251443;});}return _0x3db095;})[_0x1bc7('0x13')](respondWithResult(_0x4ce748,0xc9))[_0x1bc7('0x1e')](handleError(_0x4ce748,null));};exports['getImap']=function(_0x16408d,_0x1bc790){return db[_0x1bc7('0x49')][_0x1bc7('0x70')]({'where':{'id':_0x16408d['params']['id']}})[_0x1bc7('0x13')](handleEntityNotFound(_0x1bc790,null))['then'](function(_0x1c0294){if(_0x1c0294){return _0x1c0294[_0x1bc7('0x83')]();}return null;})[_0x1bc7('0x13')](respondWithResult(_0x1bc790,null))['catch'](handleError(_0x1bc790,null));};exports[_0x1bc7('0x84')]=function(_0x366ff9,_0x542a2f){if(_0x366ff9[_0x1bc7('0x67')]['id']){delete _0x366ff9[_0x1bc7('0x67')]['id'];}return db[_0x1bc7('0x49')][_0x1bc7('0x66')]({'where':{'id':_0x366ff9['params']['id']}})['then'](handleEntityNotFound(_0x542a2f,null))[_0x1bc7('0x13')](function(_0xc42ff1){if(_0xc42ff1){_0x366ff9[_0x1bc7('0x67')][_0x1bc7('0x6e')]=_0xc42ff1['id'];return db[_0x1bc7('0x45')][_0x1bc7('0x79')](_0x366ff9[_0x1bc7('0x67')]);}})[_0x1bc7('0x13')](respondWithResult(_0x542a2f,null))['catch'](handleError(_0x542a2f,null));};exports['removeImap']=function(_0x5bff1a,_0x27eff8){return db['MailAccount'][_0x1bc7('0x70')]({'where':{'id':_0x5bff1a[_0x1bc7('0x60')]['id']}})[_0x1bc7('0x13')](handleEntityNotFound(_0x27eff8,null))['then'](function(_0x171eba){if(_0x171eba){return _0x171eba[_0x1bc7('0x85')](null);}return null;})['then'](respondWithStatusCode(_0x27eff8,null))[_0x1bc7('0x1e')](handleError(_0x27eff8,null));};exports[_0x1bc7('0x86')]=function(_0x422a43,_0xbb6ea4){return db['MailAccount'][_0x1bc7('0x70')]({'where':{'id':_0x422a43['params']['id']}})[_0x1bc7('0x13')](handleEntityNotFound(_0xbb6ea4,null))[_0x1bc7('0x13')](function(_0x3bd5d6){if(_0x3bd5d6){return _0x3bd5d6[_0x1bc7('0x86')]();}return null;})[_0x1bc7('0x13')](respondWithResult(_0xbb6ea4,null))[_0x1bc7('0x1e')](handleError(_0xbb6ea4,null));};exports[_0x1bc7('0x87')]=function(_0x33ad6b,_0xd6347){if(_0x33ad6b['body']['id']){delete _0x33ad6b[_0x1bc7('0x67')]['id'];}return db[_0x1bc7('0x49')][_0x1bc7('0x66')]({'where':{'id':_0x33ad6b[_0x1bc7('0x60')]['id']}})[_0x1bc7('0x13')](handleEntityNotFound(_0xd6347,null))[_0x1bc7('0x13')](function(_0x162f7c){if(_0x162f7c){_0x33ad6b['body'][_0x1bc7('0x6e')]=_0x162f7c['id'];return db[_0x1bc7('0x46')][_0x1bc7('0x79')](_0x33ad6b['body']);}})[_0x1bc7('0x13')](respondWithResult(_0xd6347,null))[_0x1bc7('0x1e')](handleError(_0xd6347,null));};exports[_0x1bc7('0x88')]=function(_0x401a51,_0x4b00d6){return db[_0x1bc7('0x49')][_0x1bc7('0x70')]({'where':{'id':_0x401a51[_0x1bc7('0x60')]['id']}})[_0x1bc7('0x13')](handleEntityNotFound(_0x4b00d6,null))['then'](function(_0x3015fa){if(_0x3015fa){return _0x3015fa['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x4b00d6,null))[_0x1bc7('0x1e')](handleError(_0x4b00d6,null));};exports['addInteraction']=function(_0x278a43,_0x3da6c3){return db[_0x1bc7('0x89')][_0x1bc7('0x66')]({'where':{'id':_0x278a43['params']['id']}})[_0x1bc7('0x13')](handleEntityNotFound(_0x3da6c3,null))[_0x1bc7('0x13')](function(_0x43037c){if(_0x43037c){return _0x43037c[_0x1bc7('0x8a')](_0x278a43[_0x1bc7('0x67')][_0x1bc7('0x78')],_['omit'](_0x278a43[_0x1bc7('0x67')],[_0x1bc7('0x78'),'id'])||{});}})[_0x1bc7('0x13')](respondWithResult(_0x3da6c3,null))[_0x1bc7('0x1e')](handleError(_0x3da6c3,null));};exports[_0x1bc7('0x8b')]=function(_0x5bae9f,_0x26ba9b){var _0x364cdd={'raw':![],'where':{}};var _0x2b052f={};var _0x122046={'count':0x0,'rows':[]};return db['MailAccount'][_0x1bc7('0x70')]({'where':{'id':_0x5bae9f['params']['id']}})['then'](handleEntityNotFound(_0x26ba9b,null))[_0x1bc7('0x13')](function(_0x10ae31){if(_0x10ae31){_0x2b052f['model']=_[_0x1bc7('0x4e')](db[_0x1bc7('0x89')][_0x1bc7('0x4a')]);_0x2b052f['query']=_[_0x1bc7('0x4e')](_0x5bae9f[_0x1bc7('0x51')]);_0x2b052f[_0x1bc7('0x4f')]=_[_0x1bc7('0x50')](_0x2b052f['model'],_0x2b052f['query']);_0x364cdd['attributes']=_['intersection'](_0x2b052f[_0x1bc7('0x4d')],qs['fields'](_0x5bae9f[_0x1bc7('0x51')][_0x1bc7('0x52')]));_0x364cdd[_0x1bc7('0x53')]=_0x364cdd[_0x1bc7('0x53')][_0x1bc7('0x63')]?_0x364cdd[_0x1bc7('0x53')]:_0x2b052f['model'];if(!_0x5bae9f[_0x1bc7('0x51')][_0x1bc7('0x54')](_0x1bc7('0x55'))){_0x364cdd[_0x1bc7('0x24')]=qs[_0x1bc7('0x24')](_0x5bae9f[_0x1bc7('0x51')]['limit']);_0x364cdd[_0x1bc7('0x22')]=qs[_0x1bc7('0x22')](_0x5bae9f[_0x1bc7('0x51')][_0x1bc7('0x22')]);}_0x364cdd[_0x1bc7('0x56')]=qs[_0x1bc7('0x57')](_0x5bae9f[_0x1bc7('0x51')][_0x1bc7('0x57')]);_0x364cdd['where']=qs[_0x1bc7('0x4f')](_[_0x1bc7('0x58')](_0x5bae9f[_0x1bc7('0x51')],_0x2b052f['filters']));_0x364cdd[_0x1bc7('0x5a')][_0x1bc7('0x6e')]=_0x10ae31['id'];if(_0x5bae9f[_0x1bc7('0x51')][_0x1bc7('0x59')]){_0x364cdd[_0x1bc7('0x5a')]=_[_0x1bc7('0x5b')](_0x364cdd['where'],{'$or':_[_0x1bc7('0x48')](_0x364cdd['attributes'],function(_0x16882e){var _0x1a96fc={};_0x1a96fc[_0x16882e]={'$like':'%'+_0x5bae9f['query'][_0x1bc7('0x59')]+'%'};return _0x1a96fc;})});}_0x364cdd=_[_0x1bc7('0x5b')]({},_0x364cdd,_0x5bae9f[_0x1bc7('0x65')]);return db[_0x1bc7('0x89')][_0x1bc7('0x25')]({'where':_0x364cdd['where']})[_0x1bc7('0x13')](function(_0x2c3104){_0x122046['count']=_0x2c3104;if(_0x5bae9f[_0x1bc7('0x51')][_0x1bc7('0x64')]){_0x364cdd[_0x1bc7('0x5d')]=[{'model':db[_0x1bc7('0x8c')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x1bc7('0x8d'),'attributes':['name','fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x1bc7('0x8e'),'attributes':['id',_0x1bc7('0x2d'),_0x1bc7('0x8f')],'where':_0x5bae9f[_0x1bc7('0x51')][_0x1bc7('0x90')]?{'id':_0x5bae9f['query']['tag']}:undefined,'required':_0x5bae9f['query'][_0x1bc7('0x90')]?!![]:![]}];}return db['MailInteraction'][_0x1bc7('0x5e')](_0x364cdd);})[_0x1bc7('0x13')](function(_0x3d95b4){_0x122046['rows']=_0x3d95b4;return _0x122046;});}})[_0x1bc7('0x13')](respondWithFilteredResult(_0x26ba9b,_0x364cdd))[_0x1bc7('0x1e')](handleError(_0x26ba9b,null));};exports[_0x1bc7('0x91')]=function addApplications(_0x3fec69,_0xb5dad6){var _0x54fba0=_0x3fec69['params']['id'];var _0x3784f3=_0x3fec69['body'];var _0xb9a84c=0xc8;var _0x1ecca9=null;return db['sequelize'][_0x1bc7('0x92')]({'isolationLevel':db[_0x1bc7('0x93')][_0x1bc7('0x94')][_0x1bc7('0x95')][_0x1bc7('0x96')]},function(_0x363d3f){return db[_0x1bc7('0x49')]['findOne']({'where':{'id':_0x54fba0},'transaction':_0x363d3f})['then'](function(_0xaf7652){if(_0xaf7652){return db[_0x1bc7('0x97')][_0x1bc7('0x28')]({'where':{'MailAccountId':_0x54fba0},'transaction':_0x363d3f})[_0x1bc7('0x13')](function(){var _0x1d2750=_[_0x1bc7('0x48')](_0x3784f3,function(_0xe256a7){_0xe256a7[_0x1bc7('0x6e')]=_0x54fba0;return _0xe256a7;});return db['MailApplication']['bulkCreate'](_0x1d2750,{'transaction':_0x363d3f});});}else{_0xb9a84c=0x194;_0x1ecca9=[];}});})[_0x1bc7('0x13')](function(){if(_0xb9a84c!==0x194){return db[_0x1bc7('0x97')][_0x1bc7('0x98')]({'where':{'MailAccountId':_0x54fba0},'order':_0x1bc7('0x99')})[_0x1bc7('0x13')](function(_0x5cb048){_0x1ecca9=_0x5cb048;});}})['catch'](function(_0x151495){_0xb9a84c=0x1f4;logger['error'](_0x151495[_0x1bc7('0x9a')]);if(_0x151495['name']){delete _0x151495[_0x1bc7('0x2d')];}_0x1ecca9=_0x151495;})[_0x1bc7('0x9b')](function(){if(_0x1ecca9===null){_0xb5dad6[_0x1bc7('0x2c')](_0xb9a84c);}else{if(_0xb9a84c===0x1f4){_0xb5dad6[_0x1bc7('0x1f')](_0xb9a84c)[_0x1bc7('0x2e')](_0x1ecca9);}else{_0xb5dad6[_0x1bc7('0x1f')](_0xb9a84c)[_0x1bc7('0x21')](_0x1ecca9);}}});};exports[_0x1bc7('0x9c')]=function(_0x1e392b,_0x5f2b19){var _0x51197f={};var _0x53455d={};var _0x17b83c;var _0x652584;return db[_0x1bc7('0x49')][_0x1bc7('0x70')]({'where':{'id':_0x1e392b[_0x1bc7('0x60')]['id']}})[_0x1bc7('0x13')](handleEntityNotFound(_0x5f2b19,null))[_0x1bc7('0x13')](function(_0x44501e){if(_0x44501e){_0x17b83c=_0x44501e;_0x53455d[_0x1bc7('0x4d')]=_[_0x1bc7('0x4e')](db[_0x1bc7('0x97')]['rawAttributes']);_0x53455d[_0x1bc7('0x51')]=_[_0x1bc7('0x4e')](_0x1e392b[_0x1bc7('0x51')]);_0x53455d[_0x1bc7('0x4f')]=_[_0x1bc7('0x50')](_0x53455d[_0x1bc7('0x4d')],_0x53455d[_0x1bc7('0x51')]);_0x51197f['attributes']=_[_0x1bc7('0x50')](_0x53455d[_0x1bc7('0x4d')],qs[_0x1bc7('0x52')](_0x1e392b['query']['fields']));_0x51197f[_0x1bc7('0x53')]=_0x51197f[_0x1bc7('0x53')][_0x1bc7('0x63')]?_0x51197f[_0x1bc7('0x53')]:_0x53455d['model'];_0x51197f[_0x1bc7('0x56')]=qs['sort'](_0x1e392b[_0x1bc7('0x51')]['sort']);_0x51197f[_0x1bc7('0x5a')]=qs[_0x1bc7('0x4f')](_[_0x1bc7('0x58')](_0x1e392b[_0x1bc7('0x51')],_0x53455d['filters']));if(_0x1e392b['query'][_0x1bc7('0x59')]){_0x51197f[_0x1bc7('0x5a')]=_[_0x1bc7('0x5b')](_0x51197f[_0x1bc7('0x5a')],{'$or':_[_0x1bc7('0x48')](_0x51197f['attributes'],function(_0x248970){var _0x200fa5={};_0x200fa5[_0x248970]={'$like':'%'+_0x1e392b[_0x1bc7('0x51')][_0x1bc7('0x59')]+'%'};return _0x200fa5;})});}_0x51197f=_[_0x1bc7('0x5b')]({},_0x51197f,_0x1e392b[_0x1bc7('0x65')]);return _0x17b83c[_0x1bc7('0x9c')](_0x51197f);}})[_0x1bc7('0x13')](function(_0xc364b3){if(_0xc364b3){_0x652584=_0xc364b3[_0x1bc7('0x63')];if(!_0x1e392b[_0x1bc7('0x51')][_0x1bc7('0x54')]('nolimit')){_0x51197f[_0x1bc7('0x24')]=qs[_0x1bc7('0x24')](_0x1e392b['query'][_0x1bc7('0x24')]);_0x51197f[_0x1bc7('0x22')]=qs[_0x1bc7('0x22')](_0x1e392b[_0x1bc7('0x51')][_0x1bc7('0x22')]);}return _0x17b83c[_0x1bc7('0x9c')](_0x51197f);}})[_0x1bc7('0x13')](function(_0x313614){if(_0x313614){return _0x313614?{'count':_0x652584,'rows':_0x313614}:null;}})[_0x1bc7('0x13')](respondWithResult(_0x5f2b19,null))['catch'](handleError(_0x5f2b19,null));};exports[_0x1bc7('0x9d')]=function(_0x828b4e,_0x17e7b9){var _0x3836f6={'raw':!![],'where':{}};var _0x5a61e9={};var _0x1d2118={'count':0x0,'rows':[]};return db[_0x1bc7('0x49')][_0x1bc7('0x70')]({'where':{'id':_0x828b4e[_0x1bc7('0x60')]['id']}})[_0x1bc7('0x13')](handleEntityNotFound(_0x17e7b9,null))['then'](function(_0xcc8a6){if(_0xcc8a6){_0x5a61e9[_0x1bc7('0x4d')]=_[_0x1bc7('0x4e')](db[_0x1bc7('0x9e')][_0x1bc7('0x4a')]);_0x5a61e9[_0x1bc7('0x51')]=_['keys'](_0x828b4e[_0x1bc7('0x51')]);_0x5a61e9[_0x1bc7('0x4f')]=_[_0x1bc7('0x50')](_0x5a61e9['model'],_0x5a61e9[_0x1bc7('0x51')]);_0x3836f6[_0x1bc7('0x53')]=_[_0x1bc7('0x50')](_0x5a61e9[_0x1bc7('0x4d')],qs[_0x1bc7('0x52')](_0x828b4e[_0x1bc7('0x51')][_0x1bc7('0x52')]));_0x3836f6['attributes']=_0x3836f6[_0x1bc7('0x53')][_0x1bc7('0x63')]?_0x3836f6[_0x1bc7('0x53')]:_0x5a61e9[_0x1bc7('0x4d')];if(!_0x828b4e[_0x1bc7('0x51')][_0x1bc7('0x54')](_0x1bc7('0x55'))){_0x3836f6[_0x1bc7('0x24')]=qs['limit'](_0x828b4e[_0x1bc7('0x51')][_0x1bc7('0x24')]);_0x3836f6[_0x1bc7('0x22')]=qs['offset'](_0x828b4e[_0x1bc7('0x51')][_0x1bc7('0x22')]);}_0x3836f6['order']=qs[_0x1bc7('0x57')](_0x828b4e[_0x1bc7('0x51')]['sort']);_0x3836f6[_0x1bc7('0x5a')]=qs['filters'](_[_0x1bc7('0x58')](_0x828b4e['query'],_0x5a61e9['filters']));_0x3836f6[_0x1bc7('0x5a')]['MailAccountId']=_0xcc8a6['id'];if(_0x828b4e['query'][_0x1bc7('0x59')]){_0x3836f6[_0x1bc7('0x5a')]=_[_0x1bc7('0x5b')](_0x3836f6['where'],{'$or':_[_0x1bc7('0x48')](_0x3836f6[_0x1bc7('0x53')],function(_0x31adff){var _0xc5b1cb={};_0xc5b1cb[_0x31adff]={'$like':'%'+_0x828b4e[_0x1bc7('0x51')][_0x1bc7('0x59')]+'%'};return _0xc5b1cb;})});}if(_0x828b4e[_0x1bc7('0x51')][_0x1bc7('0x9f')]){var _0x90e29e=_0x828b4e[_0x1bc7('0x51')]['$gte']['split'](',');var _0x48846f={};_0x48846f[_0x90e29e[0x0]]={'$gte':moment(_0x90e29e[0x1])[_0x1bc7('0xa0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3836f6['where']=_['merge'](_0x3836f6[_0x1bc7('0x5a')],_0x48846f);}_0x3836f6=_['merge']({},_0x3836f6,_0x828b4e[_0x1bc7('0x65')]);return db[_0x1bc7('0x9e')][_0x1bc7('0x25')]({'where':_0x3836f6[_0x1bc7('0x5a')]})[_0x1bc7('0x13')](function(_0x28e83c){_0x1d2118[_0x1bc7('0x25')]=_0x28e83c;if(_0x828b4e[_0x1bc7('0x51')][_0x1bc7('0x64')]){_0x3836f6[_0x1bc7('0x5d')]=[{'all':!![]}];}return db['MailMessage'][_0x1bc7('0x5e')](_0x3836f6);})[_0x1bc7('0x13')](function(_0x446b10){if(_0x828b4e[_0x1bc7('0x51')][_0x1bc7('0xa1')]==='true'){for(var _0x27bccd=0x0;_0x27bccd<_0x446b10['length'];_0x27bccd++){_0x446b10[_0x27bccd][_0x1bc7('0x67')]=juice(_0x446b10[_0x27bccd][_0x1bc7('0x67')]);}}_0x1d2118[_0x1bc7('0x72')]=_0x446b10;return _0x1d2118;});}})[_0x1bc7('0x13')](respondWithFilteredResult(_0x17e7b9,_0x3836f6))['catch'](handleError(_0x17e7b9,null));};exports[_0x1bc7('0x2e')]=function(_0x2111ba,_0x506bbc){var _0x288b7b,_0x39ff52={},_0x2e020e;if(_0x2111ba['body']['to']){_0x2e020e=_0x2111ba[_0x1bc7('0x67')]['to'][_0x1bc7('0xa2')](',')[0x0];}return db[_0x1bc7('0x49')][_0x1bc7('0x66')]({'where':{'id':_0x2111ba['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x1bc7('0x8c')],'as':'Contacts','where':{'email':_0x2e020e},'limit':0x1,'order':[[_0x1bc7('0xa3'),'DESC']]}]},{'model':db[_0x1bc7('0x46')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x1bc7('0x13')](handleEntityNotFound(_0x506bbc,null))[_0x1bc7('0x13')](function(_0x2bb7ec){if(!_0x2bb7ec)return;_0x288b7b=_0x2bb7ec;if(!_0x2bb7ec[_0x1bc7('0x61')])throw new Error(_0x1bc7('0xa4'));if(_[_0x1bc7('0x7c')](_0x2111ba[_0x1bc7('0x67')][_0x1bc7('0xa5')])){_0x2111ba['body'][_0x1bc7('0xa5')]=util[_0x1bc7('0xa0')](_0x1bc7('0xa6'),_0x2bb7ec[_0x1bc7('0x2d')],_0x2bb7ec[_0x1bc7('0x7a')]||_0x2bb7ec[_0x1bc7('0x61')][_0x1bc7('0x3b')]);}if(_0x2111ba[_0x1bc7('0x67')][_0x1bc7('0xa7')]&&_0x2111ba[_0x1bc7('0x67')][_0x1bc7('0xa7')]['length']){for(var _0x1be1b7=0x0;_0x1be1b7<_0x2111ba[_0x1bc7('0x67')][_0x1bc7('0xa7')][_0x1bc7('0x63')];_0x1be1b7+=0x1){_0x2111ba[_0x1bc7('0x67')][_0x1bc7('0xa7')][_0x1be1b7]={'filename':_0x2111ba[_0x1bc7('0x67')][_0x1bc7('0xa7')][_0x1be1b7][_0x1bc7('0x2d')],'path':path['join'](config[_0x1bc7('0xa8')],'server/files/attachments',_0x2111ba[_0x1bc7('0x67')][_0x1bc7('0xa7')][_0x1be1b7][_0x1bc7('0xa9')])};}}var _0x13fcd1=_0x2bb7ec[_0x1bc7('0xaa')]();return respondWithRpcPromise(_0x1bc7('0xab'),_0x1bc7('0xac'),{'account':_0x13fcd1,'message':_0x2111ba[_0x1bc7('0x67')]});})['then'](function(_0x55f22d){if(!_0x55f22d)return;_0x39ff52=_0x55f22d;if(!_0x288b7b[_0x1bc7('0xad')])throw new Error(_0x1bc7('0xae'));if(_0x288b7b[_0x1bc7('0xad')][_0x1bc7('0xaf')][_0x1bc7('0x63')])return _0x288b7b[_0x1bc7('0xad')]['Contacts'][0x0];return db['CmContact'][_0x1bc7('0x79')](_[_0x1bc7('0xb')](_0x2111ba['body'],{'firstName':_0x2111ba['body']['to'],'email':_0x2111ba[_0x1bc7('0x67')]['to'],'phone':_0x2111ba['body']['to'],'ListId':_0x288b7b[_0x1bc7('0x7b')]}));})[_0x1bc7('0x13')](function(_0xba2963){if(!_0xba2963)return;var _0x320e97={'UserId':_0x2111ba[_0x1bc7('0x3b')]['id'],'ContactId':_0xba2963['id'],'MailAccountId':_0x288b7b['id'],'inReplyTo':_0x39ff52['messageId'],'to':_0x2111ba['body'][_0x1bc7('0xa5')],'cc':_0x2111ba[_0x1bc7('0x67')]['cc'],'subject':_0x2111ba[_0x1bc7('0x67')][_0x1bc7('0xb0')],'attach':_0x2111ba[_0x1bc7('0x67')]['attach'],'firstMsgDirection':_0x1bc7('0xb1'),'lastMsgAt':moment()[_0x1bc7('0xa0')](_0x1bc7('0xb2')),'lastMsgDirection':_0x1bc7('0xb1'),'Messages':[_['merge'](_0x2111ba['body'],{'messageId':_0x39ff52[_0x1bc7('0xb3')],'sentAt':moment()[_0x1bc7('0xa0')](_0x1bc7('0xb2')),'read':!![],'MailAccountId':_0x288b7b['id'],'UserId':_0x2111ba[_0x1bc7('0x3b')]['id'],'ContactId':_0xba2963['id']})]};if(_0x2111ba[_0x1bc7('0x67')]['Interaction']){_0x320e97=_[_0x1bc7('0x5b')](_0x320e97,_0x2111ba[_0x1bc7('0x67')][_0x1bc7('0xb4')]);}return db[_0x1bc7('0x89')][_0x1bc7('0x79')](_0x320e97,{'include':[{'model':db[_0x1bc7('0x9e')],'as':'Messages'}]});})[_0x1bc7('0x13')](respondWithResult(_0x506bbc,null))['catch'](handleError(_0x506bbc,null));};exports[_0x1bc7('0xb5')]=function(_0x484f08,_0x1e4112){return db[_0x1bc7('0x49')][_0x1bc7('0x66')]({'where':{'id':_0x484f08[_0x1bc7('0x60')]['id']},'include':[{'model':db[_0x1bc7('0x46')],'as':_0x1bc7('0x61'),'raw':!![],'include':[{'model':db[_0x1bc7('0xb6')],'as':'CloudProvider','raw':!![]}]}]})[_0x1bc7('0x13')](handleEntityNotFound(_0x1e4112,null))[_0x1bc7('0x13')](function(_0x505000){if(!_0x505000[_0x1bc7('0x61')])return;var _0x2a6eff=_0x505000['getSmtpOptions']();return respondWithRpcPromise(_0x1bc7('0xb7'),_0x1bc7('0xb5'),{'account':_0x2a6eff});})[_0x1bc7('0x13')](respondWithResult(_0x1e4112,null))[_0x1bc7('0x1e')](handleError(_0x1e4112,null));};exports['destroy']=function(_0x48a75d,_0x59e87f){return db[_0x1bc7('0x49')][_0x1bc7('0x66')]({'where':{'id':_0x48a75d[_0x1bc7('0x60')]['id']}})[_0x1bc7('0x13')](handleEntityNotFound(_0x59e87f,null))['then'](function(_0x8ee909){if(_0x8ee909&&_0x8ee909[_0x1bc7('0x6c')]){throw new db[(_0x1bc7('0xb8'))]['ValidationError'](_0x1bc7('0xb9'));}return _0x8ee909;})['then'](removeEntity(_0x59e87f,null))[_0x1bc7('0x1e')](handleError(_0x59e87f,null));};exports[_0x1bc7('0xba')]=function(_0x45bcaf,_0x5865fb){return db[_0x1bc7('0x49')][_0x1bc7('0x66')]({'where':{'id':_0x45bcaf[_0x1bc7('0x60')]['id']}})['then'](handleEntityNotFound(_0x5865fb,null))[_0x1bc7('0x13')](function(_0x544615){if(_0x544615){return _0x544615[_0x1bc7('0xba')](_0x45bcaf[_0x1bc7('0x67')][_0x1bc7('0x78')],_[_0x1bc7('0xbb')](_0x45bcaf[_0x1bc7('0x67')],[_0x1bc7('0x78'),'id'])||{})[_0x1bc7('0xbc')](function(_0x27062c){for(var _0x418785=0x0;_0x418785<_0x45bcaf['body'][_0x1bc7('0x78')][_0x1bc7('0x63')];_0x418785+=0x1){socket[_0x1bc7('0xbd')](_0x1bc7('0xbe'),{'UserId':Number(_0x45bcaf[_0x1bc7('0x67')][_0x1bc7('0x78')][_0x418785]),'MailAccountId':Number(_0x45bcaf[_0x1bc7('0x60')]['id'])});}return _0x27062c;});}})['then'](respondWithResult(_0x5865fb,null))[_0x1bc7('0x1e')](handleError(_0x5865fb,null));};exports[_0x1bc7('0xbf')]=function(_0x162db9,_0x58b15e){return db[_0x1bc7('0x49')][_0x1bc7('0x66')]({'where':{'id':_0x162db9[_0x1bc7('0x60')]['id']}})['then'](handleEntityNotFound(_0x58b15e,null))[_0x1bc7('0x13')](function(_0x1f7a3d){if(_0x1f7a3d){return _0x1f7a3d[_0x1bc7('0xbf')](_0x162db9[_0x1bc7('0x51')][_0x1bc7('0x78')])['then'](function(){if(_[_0x1bc7('0xc0')](_0x162db9['query']['ids'])){for(var _0x3859c1=0x0;_0x3859c1<_0x162db9[_0x1bc7('0x51')][_0x1bc7('0x78')][_0x1bc7('0x63')];_0x3859c1+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x162db9[_0x1bc7('0x51')][_0x1bc7('0x78')][_0x3859c1]),'MailAccountId':Number(_0x162db9['params']['id'])});}}else{socket[_0x1bc7('0xbd')](_0x1bc7('0xc1'),{'UserId':Number(_0x162db9[_0x1bc7('0x51')][_0x1bc7('0x78')]),'MailAccountId':Number(_0x162db9['params']['id'])});}});}})[_0x1bc7('0x13')](respondWithStatusCode(_0x58b15e,null))[_0x1bc7('0x1e')](handleError(_0x58b15e,null));};exports['getAgents']=function(_0x27c753,_0x4c7af3){var _0x2890f5={};var _0xc653e2={};var _0x726d99;var _0x36b538;return db[_0x1bc7('0x49')][_0x1bc7('0x70')]({'where':{'id':_0x27c753[_0x1bc7('0x60')]['id']}})[_0x1bc7('0x13')](handleEntityNotFound(_0x4c7af3,null))[_0x1bc7('0x13')](function(_0x1587b6){if(_0x1587b6){_0x726d99=_0x1587b6;_0xc653e2[_0x1bc7('0x4d')]=_[_0x1bc7('0x4e')](db[_0x1bc7('0xc2')][_0x1bc7('0x4a')]);_0xc653e2[_0x1bc7('0x51')]=_[_0x1bc7('0x4e')](_0x27c753['query']);_0xc653e2[_0x1bc7('0x4f')]=_[_0x1bc7('0x50')](_0xc653e2[_0x1bc7('0x4d')],_0xc653e2[_0x1bc7('0x51')]);_0x2890f5[_0x1bc7('0x53')]=_[_0x1bc7('0x50')](_0xc653e2[_0x1bc7('0x4d')],qs[_0x1bc7('0x52')](_0x27c753[_0x1bc7('0x51')][_0x1bc7('0x52')]));_0x2890f5[_0x1bc7('0x53')]=_0x2890f5[_0x1bc7('0x53')][_0x1bc7('0x63')]?_0x2890f5[_0x1bc7('0x53')]:_0xc653e2[_0x1bc7('0x4d')];_0x2890f5[_0x1bc7('0x56')]=qs[_0x1bc7('0x57')](_0x27c753[_0x1bc7('0x51')][_0x1bc7('0x57')]);_0x2890f5[_0x1bc7('0x5a')]=qs[_0x1bc7('0x4f')](_[_0x1bc7('0x58')](_0x27c753['query'],_0xc653e2[_0x1bc7('0x4f')]));if(_0x27c753[_0x1bc7('0x51')][_0x1bc7('0x59')]){_0x2890f5[_0x1bc7('0x5a')]=_[_0x1bc7('0x5b')](_0x2890f5[_0x1bc7('0x5a')],{'$or':_[_0x1bc7('0x48')](_0x2890f5[_0x1bc7('0x53')],function(_0x796f74){var _0x941261={};_0x941261[_0x796f74]={'$like':'%'+_0x27c753[_0x1bc7('0x51')][_0x1bc7('0x59')]+'%'};return _0x941261;})});}_0x2890f5=_[_0x1bc7('0x5b')]({},_0x2890f5,_0x27c753[_0x1bc7('0x65')]);return _0x726d99[_0x1bc7('0xc3')](_0x2890f5);}})[_0x1bc7('0x13')](function(_0x3a7514){if(_0x3a7514){_0x36b538=_0x3a7514['length'];if(!_0x27c753[_0x1bc7('0x51')]['hasOwnProperty']('nolimit')){_0x2890f5[_0x1bc7('0x24')]=qs['limit'](_0x27c753[_0x1bc7('0x51')][_0x1bc7('0x24')]);_0x2890f5[_0x1bc7('0x22')]=qs[_0x1bc7('0x22')](_0x27c753['query']['offset']);}return _0x726d99[_0x1bc7('0xc3')](_0x2890f5);}})[_0x1bc7('0x13')](function(_0x409a4d){if(_0x409a4d){return _0x409a4d?{'count':_0x36b538,'rows':_0x409a4d}:null;}})[_0x1bc7('0x13')](respondWithResult(_0x4c7af3,null))[_0x1bc7('0x1e')](handleError(_0x4c7af3,null));}; \ No newline at end of file +var _0x6ede=['../../mysqldb','redis','./mailAccount.socket','register','jayson/promise','client','info','request\x20sent','debug','error','message','MailAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','destroy','get','MailAccounts','UserProfileResource','stack','name','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','gmail','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','MailServerIn','include','options','body','custom','find','describe','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','pick','removeDispositions','ids','addAnswer','map','CannedAnswer','removeAnswers','provider','email','ListId','isNil','active','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true','send','CmList','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','root','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','out','Interaction','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','api'];(function(_0xc6971f,_0x53138a){var _0x28ca53=function(_0xa0f0b4){while(--_0xa0f0b4){_0xc6971f['push'](_0xc6971f['shift']());}};_0x28ca53(++_0x53138a);}(_0x6ede,0xb6));var _0xe6ed=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0x6ede[_0x587693];return _0x510a1a;};'use strict';var moment=require(_0xe6ed('0x0'));var BPromise=require(_0xe6ed('0x1'));var util=require(_0xe6ed('0x2'));var path=require(_0xe6ed('0x3'));var _=require(_0xe6ed('0x4'));var juice=require(_0xe6ed('0x5'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xe6ed('0x6'));var config=require('../../config/environment');var db=require(_0xe6ed('0x7'))['db'];config['redis']=_['defaults'](config[_0xe6ed('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe6ed('0x9'))[_0xe6ed('0xa')](socket);var jayson=require(_0xe6ed('0xb'));var client=jayson[_0xe6ed('0xc')]['http']({'port':0x232b});function respondWithRpcPromise(_0x53d025,_0x58d687,_0x31f4e2,_0x41bf4c){return new BPromise(function(_0x1ba92c,_0x537930){var _0x4eba4e=_0x41bf4c||client;return _0x4eba4e['request'](_0x53d025,_0x31f4e2)['then'](function(_0x157930){logger[_0xe6ed('0xd')]('MailAccount,\x20%s,\x20%s',_0x58d687,_0xe6ed('0xe'));logger[_0xe6ed('0xf')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x58d687,'request\x20sent',JSON['stringify'](_0x157930));if(_0x157930['error']){if(_0x157930[_0xe6ed('0x10')]['code']===0x1f4){logger[_0xe6ed('0x10')]('MailAccount,\x20%s,\x20%s',_0x58d687,_0x157930[_0xe6ed('0x10')][_0xe6ed('0x11')]);return _0x537930(_0x157930['error']['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0x58d687,_0x157930['error'][_0xe6ed('0x11')]);return _0x1ba92c(_0x157930[_0xe6ed('0x10')][_0xe6ed('0x11')]);}else{logger[_0xe6ed('0xd')](_0xe6ed('0x12'),_0x58d687,'request\x20sent');_0x1ba92c(_0x157930[_0xe6ed('0x13')][_0xe6ed('0x11')]);}})[_0xe6ed('0x14')](function(_0x520069){logger['error'](_0xe6ed('0x12'),_0x58d687,_0x520069);_0x537930(_0x520069);});});}function respondWithStatusCode(_0x4b3cc8,_0x5893db){_0x5893db=_0x5893db||0xcc;return function(_0x2cd004){if(_0x2cd004){return _0x4b3cc8[_0xe6ed('0x15')](_0x5893db);}return _0x4b3cc8[_0xe6ed('0x16')](_0x5893db)[_0xe6ed('0x17')]();};}function respondWithResult(_0xfc1330,_0x3e20eb){_0x3e20eb=_0x3e20eb||0xc8;return function(_0x121534){if(_0x121534){return _0xfc1330[_0xe6ed('0x16')](_0x3e20eb)[_0xe6ed('0x18')](_0x121534);}};}function respondWithFilteredResult(_0x4db1d4,_0x57b529){return function(_0x35fa46){if(_0x35fa46){var _0x394307=typeof _0x57b529['offset']===_0xe6ed('0x19')&&typeof _0x57b529[_0xe6ed('0x1a')]===_0xe6ed('0x19');var _0x362680=_0x35fa46[_0xe6ed('0x1b')];var _0x1e1884=_0x394307?0x0:_0x57b529[_0xe6ed('0x1c')];var _0x2fc69e=_0x394307?_0x35fa46['count']:_0x57b529[_0xe6ed('0x1c')]+_0x57b529[_0xe6ed('0x1a')];var _0x2ca89f;if(_0x2fc69e>=_0x362680){_0x2fc69e=_0x362680;_0x2ca89f=0xc8;}else{_0x2ca89f=0xce;}_0x4db1d4[_0xe6ed('0x16')](_0x2ca89f);return _0x4db1d4['set'](_0xe6ed('0x1d'),_0x1e1884+'-'+_0x2fc69e+'/'+_0x362680)[_0xe6ed('0x18')](_0x35fa46);}return null;};}function saveUpdates(_0x42ef26){return function(_0x15e3e2){if(_0x15e3e2){return _0x15e3e2[_0xe6ed('0x1e')](_0x42ef26)[_0xe6ed('0x1f')](function(_0x53ca50){return _0x53ca50;});}return null;};}function removeEntity(_0x281a5f){return function(_0x592f62){if(_0x592f62){return _0x592f62[_0xe6ed('0x20')]()[_0xe6ed('0x1f')](function(){var _0x1fc7cc=_0x592f62[_0xe6ed('0x21')]({'plain':!![]});var _0x36848e=_0xe6ed('0x22');return db[_0xe6ed('0x23')][_0xe6ed('0x20')]({'where':{'type':_0x36848e,'resourceId':_0x1fc7cc['id']}})[_0xe6ed('0x1f')](function(){return _0x592f62;});})[_0xe6ed('0x1f')](function(){_0x281a5f[_0xe6ed('0x16')](0xcc)[_0xe6ed('0x17')]();});}};}function handleEntityNotFound(_0x17abcc){return function(_0x37a4ac){if(!_0x37a4ac){_0x17abcc[_0xe6ed('0x15')](0x194);}return _0x37a4ac;};}function handleError(_0x57c9fc,_0x11a61a){_0x11a61a=_0x11a61a||0x1f4;return function(_0x5a69b1){logger[_0xe6ed('0x10')](_0x5a69b1[_0xe6ed('0x24')]);if(_0x5a69b1['name']){delete _0x5a69b1[_0xe6ed('0x25')];}_0x57c9fc[_0xe6ed('0x16')](_0x11a61a)['send'](_0x5a69b1);};}function getImapHost(_0x59f3b0){switch(_0x59f3b0){case'gmail':return'imap.gmail.com';case _0xe6ed('0x26'):return _0xe6ed('0x27');case _0xe6ed('0x28'):return _0xe6ed('0x29');case'outlook365':return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x59f3b0);}function getSmtpHost(_0x256776){switch(_0x256776){case _0xe6ed('0x2a'):return _0xe6ed('0x2b');case _0xe6ed('0x26'):return _0xe6ed('0x2c');case _0xe6ed('0x28'):return _0xe6ed('0x2d');case _0xe6ed('0x2e'):return'smtp.office365.com';}throw new Error(_0xe6ed('0x2f'),_0x256776);}function getAuthenticationOptions(_0x1252dd,_0x3ea47f){var _0x4ce8a0={};var _0x2811cb={};if(_0x1252dd){_0x4ce8a0[_0xe6ed('0x30')]=_0x2811cb[_0xe6ed('0x30')]=_0x3ea47f[_0xe6ed('0x31')];_0x4ce8a0[_0xe6ed('0x32')]=_0x2811cb[_0xe6ed('0x33')]=_0x3ea47f['password'];if(_0x3ea47f['modernAuthentication']){_0x4ce8a0[_0xe6ed('0x34')]=_0x2811cb[_0xe6ed('0x34')]=!![];_0x4ce8a0[_0xe6ed('0x35')]=_0x2811cb['CloudProviderId']=_0x3ea47f['CloudProviderId'];_0x4ce8a0[_0xe6ed('0x32')]=_0x2811cb[_0xe6ed('0x33')]=null;}else{_0x4ce8a0[_0xe6ed('0x35')]=_0x2811cb['CloudProviderId']=null;}_0x4ce8a0[_0xe6ed('0x36')]=getImapHost(_0x1252dd);_0x4ce8a0['port']=0x3e1;_0x2811cb[_0xe6ed('0x36')]=getSmtpHost(_0x1252dd);_0x2811cb[_0xe6ed('0x37')]=0x24b;_0x2811cb[_0xe6ed('0x38')]=![];_0x4ce8a0[_0xe6ed('0x39')]=_0x2811cb[_0xe6ed('0x39')]=null;}else{if(_0x3ea47f[_0xe6ed('0x3a')]){_0x4ce8a0[_0xe6ed('0x30')]=_0x2811cb['user']=_0x3ea47f[_0xe6ed('0x31')];_0x4ce8a0[_0xe6ed('0x32')]=_0x2811cb[_0xe6ed('0x33')]=_0x3ea47f[_0xe6ed('0x32')];}else{_0x4ce8a0[_0xe6ed('0x3a')]=_0x2811cb[_0xe6ed('0x3a')]=![];_0x4ce8a0[_0xe6ed('0x30')]=_0x2811cb[_0xe6ed('0x30')]=null;_0x4ce8a0[_0xe6ed('0x32')]=_0x2811cb[_0xe6ed('0x33')]=null;}_0x4ce8a0['host']=_0x3ea47f[_0xe6ed('0x3b')]['host'];_0x4ce8a0[_0xe6ed('0x37')]=_0x3ea47f[_0xe6ed('0x3b')][_0xe6ed('0x37')];_0x2811cb['host']=_0x3ea47f[_0xe6ed('0x3c')][_0xe6ed('0x36')];_0x2811cb[_0xe6ed('0x37')]=_0x3ea47f[_0xe6ed('0x3c')][_0xe6ed('0x37')];}return{'Imap':_0x4ce8a0,'Smtp':_0x2811cb};}exports[_0xe6ed('0x3d')]=function(_0x18e1b0,_0x595d78){var _0x44f148={'include':[{'model':db['MailServerIn'],'as':_0xe6ed('0x3b')},{'model':db[_0xe6ed('0x3e')],'as':_0xe6ed('0x3c')},{'model':db[_0xe6ed('0x3f')],'as':_0xe6ed('0x40')}]},_0x13173d={},_0x562fb6={'count':0x0,'rows':[]};var _0x4a5495=_['map'](db[_0xe6ed('0x41')][_0xe6ed('0x42')],function(_0x5047aa){return{'name':_0x5047aa[_0xe6ed('0x43')],'type':_0x5047aa[_0xe6ed('0x44')][_0xe6ed('0x45')]};});_0x13173d[_0xe6ed('0x46')]=_['map'](_0x4a5495,_0xe6ed('0x25'));_0x13173d[_0xe6ed('0x47')]=_[_0xe6ed('0x48')](_0x18e1b0[_0xe6ed('0x47')]);_0x13173d[_0xe6ed('0x49')]=_['intersection'](_0x13173d['model'],_0x13173d[_0xe6ed('0x47')]);_0x44f148[_0xe6ed('0x4a')]=_[_0xe6ed('0x4b')](_0x13173d['model'],qs[_0xe6ed('0x4c')](_0x18e1b0[_0xe6ed('0x47')][_0xe6ed('0x4c')]));_0x44f148[_0xe6ed('0x4a')]=_0x44f148['attributes'][_0xe6ed('0x4d')]?_0x44f148[_0xe6ed('0x4a')]:_0x13173d[_0xe6ed('0x46')];if(!_0x18e1b0[_0xe6ed('0x47')][_0xe6ed('0x4e')]('nolimit')){_0x44f148[_0xe6ed('0x1a')]=qs['limit'](_0x18e1b0['query']['limit']);_0x44f148[_0xe6ed('0x1c')]=qs[_0xe6ed('0x1c')](_0x18e1b0[_0xe6ed('0x47')][_0xe6ed('0x1c')]);}_0x44f148[_0xe6ed('0x4f')]=qs[_0xe6ed('0x50')](_0x18e1b0['query'][_0xe6ed('0x50')]);_0x44f148[_0xe6ed('0x51')]=qs[_0xe6ed('0x49')](_['pick'](_0x18e1b0['query'],_0x13173d[_0xe6ed('0x49')]),_0x4a5495);if(_0x18e1b0['query'][_0xe6ed('0x52')]){_0x44f148[_0xe6ed('0x51')]=_[_0xe6ed('0x53')](_0x44f148[_0xe6ed('0x51')],{'$or':_['map'](_0x4a5495,function(_0x45a435){if(_0x45a435[_0xe6ed('0x44')]!==_0xe6ed('0x54')){var _0x36d657={};_0x36d657[_0x45a435['name']]={'$like':'%'+_0x18e1b0[_0xe6ed('0x47')][_0xe6ed('0x52')]+'%'};return _0x36d657;}})});}_0x44f148=_[_0xe6ed('0x53')]({},_0x44f148,_0x18e1b0['options']);var _0x464da6={'where':_0x44f148['where']};return db[_0xe6ed('0x41')][_0xe6ed('0x1b')](_0x464da6)['then'](function(_0x2e46d5){_0x562fb6[_0xe6ed('0x1b')]=_0x2e46d5;if(_0x18e1b0[_0xe6ed('0x47')][_0xe6ed('0x55')]){_0x44f148['include']=[{'all':!![]}];}return db[_0xe6ed('0x41')][_0xe6ed('0x56')](_0x44f148);})[_0xe6ed('0x1f')](function(_0x419779){_0x562fb6[_0xe6ed('0x57')]=_0x419779;return _0x562fb6;})['then'](respondWithFilteredResult(_0x595d78,_0x44f148))[_0xe6ed('0x14')](handleError(_0x595d78,null));};exports[_0xe6ed('0x58')]=function(_0x4dabc1,_0x44537a){var _0x3270e0={'raw':![],'where':{'id':_0x4dabc1[_0xe6ed('0x59')]['id']},'include':[{'model':db[_0xe6ed('0x5a')],'as':_0xe6ed('0x3b')},{'model':db[_0xe6ed('0x3e')],'as':_0xe6ed('0x3c')},{'model':db[_0xe6ed('0x3f')],'as':_0xe6ed('0x40')}]},_0x169e4b={};_0x169e4b[_0xe6ed('0x46')]=_[_0xe6ed('0x48')](db[_0xe6ed('0x41')]['rawAttributes']);_0x169e4b[_0xe6ed('0x47')]=_[_0xe6ed('0x48')](_0x4dabc1[_0xe6ed('0x47')]);_0x169e4b[_0xe6ed('0x49')]=_[_0xe6ed('0x4b')](_0x169e4b[_0xe6ed('0x46')],_0x169e4b[_0xe6ed('0x47')]);_0x3270e0[_0xe6ed('0x4a')]=_[_0xe6ed('0x4b')](_0x169e4b[_0xe6ed('0x46')],qs[_0xe6ed('0x4c')](_0x4dabc1[_0xe6ed('0x47')][_0xe6ed('0x4c')]));_0x3270e0[_0xe6ed('0x4a')]=_0x3270e0[_0xe6ed('0x4a')][_0xe6ed('0x4d')]?_0x3270e0[_0xe6ed('0x4a')]:_0x169e4b[_0xe6ed('0x46')];if(_0x4dabc1[_0xe6ed('0x47')][_0xe6ed('0x55')]){_0x3270e0[_0xe6ed('0x5b')]=[{'all':!![]}];}_0x3270e0=_[_0xe6ed('0x53')]({},_0x3270e0,_0x4dabc1[_0xe6ed('0x5c')]);return db[_0xe6ed('0x41')]['find'](_0x3270e0)[_0xe6ed('0x1f')](handleEntityNotFound(_0x44537a,null))[_0xe6ed('0x1f')](respondWithResult(_0x44537a,null))[_0xe6ed('0x14')](handleError(_0x44537a,null));};exports[_0xe6ed('0x1e')]=function(_0x49d6b9,_0x45f1a9){if(_0x49d6b9[_0xe6ed('0x5d')]['id']){delete _0x49d6b9[_0xe6ed('0x5d')]['id'];}var _0x26545c=_0x49d6b9[_0xe6ed('0x5d')]['provider']===_0xe6ed('0x5e')?null:_0x49d6b9[_0xe6ed('0x5d')]['provider'];var _0x1e166d=_0x49d6b9['body']['Imap']||{};var _0x531743=_0x49d6b9[_0xe6ed('0x5d')]['Smtp']||{};if(_0x26545c){_0x1e166d[_0xe6ed('0x36')]=getImapHost(_0x26545c);_0x1e166d[_0xe6ed('0x37')]=0x3e1;_0x531743['host']=getSmtpHost(_0x26545c);_0x531743['port']=0x24b;_0x531743[_0xe6ed('0x38')]=![];}if(_0x531743[_0xe6ed('0x34')]){_0x531743[_0xe6ed('0x38')]=![];}else{_0x531743[_0xe6ed('0x35')]=null;}if(!_0x1e166d[_0xe6ed('0x34')])_0x1e166d[_0xe6ed('0x35')]=null;_0x49d6b9['body'][_0xe6ed('0x3b')]=_0x1e166d;_0x49d6b9[_0xe6ed('0x5d')][_0xe6ed('0x3c')]=_0x531743;return db['MailAccount'][_0xe6ed('0x5f')]({'where':{'id':_0x49d6b9[_0xe6ed('0x59')]['id']},'include':[{'model':db[_0xe6ed('0x5a')],'as':_0xe6ed('0x3b')},{'model':db[_0xe6ed('0x3e')],'as':_0xe6ed('0x3c')},{'model':db[_0xe6ed('0x3f')],'as':_0xe6ed('0x40')}]})[_0xe6ed('0x1f')](handleEntityNotFound(_0x45f1a9,null))[_0xe6ed('0x1f')](function(_0x446984){if(!_0x446984)throw new Error('Mail\x20Account\x20not\x20found');if(_0x446984[_0xe6ed('0x39')])delete _0x49d6b9[_0xe6ed('0x5d')][_0xe6ed('0x3b')];return _0x446984;})['then'](saveUpdates(_0x49d6b9[_0xe6ed('0x5d')],null))[_0xe6ed('0x1f')](function(_0x30006d){if(!_0x49d6b9[_0xe6ed('0x5d')][_0xe6ed('0x3b')])return _0x30006d;return db['MailServerIn']['update'](_0x49d6b9['body'][_0xe6ed('0x3b')],{'where':{'MailAccountId':_0x30006d['id']}})[_0xe6ed('0x1f')](function(){return _0x30006d;});})[_0xe6ed('0x1f')](function(_0x4a0bf4){if(!_0x49d6b9[_0xe6ed('0x5d')]['Smtp'])return _0x4a0bf4;return db[_0xe6ed('0x3e')][_0xe6ed('0x1e')](_0x49d6b9['body'][_0xe6ed('0x3c')],{'where':{'MailAccountId':_0x4a0bf4['id']}})['then'](function(){return _0x4a0bf4;});})[_0xe6ed('0x1f')](respondWithResult(_0x45f1a9,null))['catch'](handleError(_0x45f1a9,null));};exports[_0xe6ed('0x60')]=function(_0x375053,_0x2998ee){return db[_0xe6ed('0x41')][_0xe6ed('0x60')]()[_0xe6ed('0x1f')](respondWithResult(_0x2998ee,null))[_0xe6ed('0x14')](handleError(_0x2998ee,null));};exports['addDisposition']=function(_0x45a6bc,_0x473ca8){if(_0x45a6bc[_0xe6ed('0x5d')]['id']){delete _0x45a6bc[_0xe6ed('0x5d')]['id'];}return db['MailAccount'][_0xe6ed('0x5f')]({'where':{'id':_0x45a6bc['params']['id']}})['then'](handleEntityNotFound(_0x473ca8,null))[_0xe6ed('0x1f')](function(_0x5582a8){if(_0x5582a8){_0x45a6bc[_0xe6ed('0x5d')][_0xe6ed('0x61')]=_0x5582a8['id'];return db[_0xe6ed('0x62')][_0xe6ed('0x63')](_0x45a6bc['body']);}})['then'](respondWithResult(_0x473ca8,null))[_0xe6ed('0x14')](handleError(_0x473ca8,null));};exports[_0xe6ed('0x64')]=function(_0x403b83,_0x2c54d5){var _0x43419a={'raw':![],'where':{}};var _0x52b2fd={};var _0x1b535b={'count':0x0,'rows':[]};return db[_0xe6ed('0x41')][_0xe6ed('0x65')]({'where':{'id':_0x403b83[_0xe6ed('0x59')]['id']}})['then'](handleEntityNotFound(_0x2c54d5,null))[_0xe6ed('0x1f')](function(_0x27985f){if(_0x27985f){_0x52b2fd[_0xe6ed('0x46')]=_[_0xe6ed('0x48')](db[_0xe6ed('0x62')][_0xe6ed('0x42')]);_0x52b2fd[_0xe6ed('0x47')]=_[_0xe6ed('0x48')](_0x403b83[_0xe6ed('0x47')]);_0x52b2fd[_0xe6ed('0x49')]=_[_0xe6ed('0x4b')](_0x52b2fd[_0xe6ed('0x46')],_0x52b2fd['query']);_0x43419a[_0xe6ed('0x4a')]=_[_0xe6ed('0x4b')](_0x52b2fd[_0xe6ed('0x46')],qs[_0xe6ed('0x4c')](_0x403b83['query'][_0xe6ed('0x4c')]));_0x43419a['attributes']=_0x43419a['attributes'][_0xe6ed('0x4d')]?_0x43419a[_0xe6ed('0x4a')]:_0x52b2fd[_0xe6ed('0x46')];if(!_0x403b83[_0xe6ed('0x47')][_0xe6ed('0x4e')](_0xe6ed('0x66'))){_0x43419a[_0xe6ed('0x1a')]=qs['limit'](_0x403b83[_0xe6ed('0x47')]['limit']);_0x43419a['offset']=qs[_0xe6ed('0x1c')](_0x403b83[_0xe6ed('0x47')][_0xe6ed('0x1c')]);}_0x43419a[_0xe6ed('0x4f')]=qs[_0xe6ed('0x50')](_0x403b83['query'][_0xe6ed('0x50')]);_0x43419a[_0xe6ed('0x51')]=qs['filters'](_[_0xe6ed('0x67')](_0x403b83['query'],_0x52b2fd[_0xe6ed('0x49')]));_0x43419a[_0xe6ed('0x51')]['MailAccountId']=_0x27985f['id'];if(_0x403b83['query'][_0xe6ed('0x52')]){_0x43419a['where']=_[_0xe6ed('0x53')](_0x43419a[_0xe6ed('0x51')],{'$or':_['map'](_0x43419a[_0xe6ed('0x4a')],function(_0x2bb791){var _0x134134={};_0x134134[_0x2bb791]={'$like':'%'+_0x403b83['query'][_0xe6ed('0x52')]+'%'};return _0x134134;})});}_0x43419a=_[_0xe6ed('0x53')]({},_0x43419a,_0x403b83[_0xe6ed('0x5c')]);return db[_0xe6ed('0x62')][_0xe6ed('0x1b')]({'where':_0x43419a[_0xe6ed('0x51')]})['then'](function(_0x109bd5){_0x1b535b[_0xe6ed('0x1b')]=_0x109bd5;if(_0x403b83[_0xe6ed('0x47')][_0xe6ed('0x55')]){_0x43419a['include']=[{'all':!![]}];}return db[_0xe6ed('0x62')]['findAll'](_0x43419a);})[_0xe6ed('0x1f')](function(_0x4a47b5){_0x1b535b[_0xe6ed('0x57')]=_0x4a47b5;return _0x1b535b;});}})[_0xe6ed('0x1f')](respondWithFilteredResult(_0x2c54d5,_0x43419a))['catch'](handleError(_0x2c54d5,null));};exports[_0xe6ed('0x68')]=function(_0x16b603,_0x3b2d21){return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0x16b603[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x3b2d21,null))[_0xe6ed('0x1f')](function(_0x160354){if(_0x160354){return _0x160354[_0xe6ed('0x68')](_0x16b603[_0xe6ed('0x47')][_0xe6ed('0x69')]);}})['then'](respondWithStatusCode(_0x3b2d21,null))[_0xe6ed('0x14')](handleError(_0x3b2d21,null));};exports[_0xe6ed('0x6a')]=function(_0x348398,_0x10ef69){if(_0x348398[_0xe6ed('0x5d')]['id']){delete _0x348398[_0xe6ed('0x5d')]['id'];}return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0x348398[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x10ef69,null))[_0xe6ed('0x1f')](function(_0x37ad61){if(_0x37ad61){_0x348398['body'][_0xe6ed('0x61')]=_0x37ad61['id'];return db['CannedAnswer'][_0xe6ed('0x63')](_0x348398['body']);}})[_0xe6ed('0x1f')](respondWithResult(_0x10ef69,null))[_0xe6ed('0x14')](handleError(_0x10ef69,null));};exports['getAnswers']=function(_0x5285b2,_0x533090){var _0x4303fd={'raw':![],'where':{}};var _0x56b36a={};var _0x195a16={'count':0x0,'rows':[]};return db[_0xe6ed('0x41')]['findOne']({'where':{'id':_0x5285b2[_0xe6ed('0x59')]['id']}})['then'](handleEntityNotFound(_0x533090,null))['then'](function(_0x5e6bda){if(_0x5e6bda){_0x56b36a['model']=_[_0xe6ed('0x48')](db['CannedAnswer'][_0xe6ed('0x42')]);_0x56b36a[_0xe6ed('0x47')]=_[_0xe6ed('0x48')](_0x5285b2[_0xe6ed('0x47')]);_0x56b36a[_0xe6ed('0x49')]=_[_0xe6ed('0x4b')](_0x56b36a['model'],_0x56b36a[_0xe6ed('0x47')]);_0x4303fd[_0xe6ed('0x4a')]=_[_0xe6ed('0x4b')](_0x56b36a['model'],qs[_0xe6ed('0x4c')](_0x5285b2['query'][_0xe6ed('0x4c')]));_0x4303fd[_0xe6ed('0x4a')]=_0x4303fd[_0xe6ed('0x4a')][_0xe6ed('0x4d')]?_0x4303fd[_0xe6ed('0x4a')]:_0x56b36a[_0xe6ed('0x46')];if(!_0x5285b2[_0xe6ed('0x47')][_0xe6ed('0x4e')](_0xe6ed('0x66'))){_0x4303fd[_0xe6ed('0x1a')]=qs[_0xe6ed('0x1a')](_0x5285b2[_0xe6ed('0x47')][_0xe6ed('0x1a')]);_0x4303fd[_0xe6ed('0x1c')]=qs[_0xe6ed('0x1c')](_0x5285b2[_0xe6ed('0x47')]['offset']);}_0x4303fd[_0xe6ed('0x4f')]=qs[_0xe6ed('0x50')](_0x5285b2[_0xe6ed('0x47')][_0xe6ed('0x50')]);_0x4303fd[_0xe6ed('0x51')]=qs[_0xe6ed('0x49')](_[_0xe6ed('0x67')](_0x5285b2[_0xe6ed('0x47')],_0x56b36a[_0xe6ed('0x49')]));_0x4303fd['where']['MailAccountId']=_0x5e6bda['id'];if(_0x5285b2[_0xe6ed('0x47')][_0xe6ed('0x52')]){_0x4303fd[_0xe6ed('0x51')]=_[_0xe6ed('0x53')](_0x4303fd['where'],{'$or':_[_0xe6ed('0x6b')](_0x4303fd[_0xe6ed('0x4a')],function(_0x10db18){var _0x2d6614={};_0x2d6614[_0x10db18]={'$like':'%'+_0x5285b2[_0xe6ed('0x47')][_0xe6ed('0x52')]+'%'};return _0x2d6614;})});}_0x4303fd=_[_0xe6ed('0x53')]({},_0x4303fd,_0x5285b2['options']);return db[_0xe6ed('0x6c')][_0xe6ed('0x1b')]({'where':_0x4303fd[_0xe6ed('0x51')]})[_0xe6ed('0x1f')](function(_0x3e3b48){_0x195a16[_0xe6ed('0x1b')]=_0x3e3b48;if(_0x5285b2[_0xe6ed('0x47')][_0xe6ed('0x55')]){_0x4303fd[_0xe6ed('0x5b')]=[{'all':!![]}];}return db[_0xe6ed('0x6c')][_0xe6ed('0x56')](_0x4303fd);})[_0xe6ed('0x1f')](function(_0x993809){_0x195a16[_0xe6ed('0x57')]=_0x993809;return _0x195a16;});}})['then'](respondWithFilteredResult(_0x533090,_0x4303fd))[_0xe6ed('0x14')](handleError(_0x533090,null));};exports[_0xe6ed('0x6d')]=function(_0x734dcc,_0x45bd7e){return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0x734dcc[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x45bd7e,null))[_0xe6ed('0x1f')](function(_0x3130cd){if(_0x3130cd){return _0x3130cd[_0xe6ed('0x6d')](_0x734dcc['query']['ids']);}})['then'](respondWithStatusCode(_0x45bd7e,null))[_0xe6ed('0x14')](handleError(_0x45bd7e,null));};exports['create']=function(_0x1ebb22,_0x1266db){var _0x13be06={'name':_0x1ebb22[_0xe6ed('0x5d')][_0xe6ed('0x25')],'key':_0x1ebb22['body'][_0xe6ed('0x45')],'provider':_0x1ebb22['body']['provider']===_0xe6ed('0x5e')?null:_0x1ebb22[_0xe6ed('0x5d')][_0xe6ed('0x6e')],'email':_0x1ebb22[_0xe6ed('0x5d')][_0xe6ed('0x6f')],'ListId':_0x1ebb22[_0xe6ed('0x5d')][_0xe6ed('0x70')],'active':!_[_0xe6ed('0x71')](_0x1ebb22['body'][_0xe6ed('0x72')])?_0x1ebb22[_0xe6ed('0x5d')][_0xe6ed('0x72')]:!![],'description':_0x1ebb22[_0xe6ed('0x5d')]['description']||null};var _0x591cab=getAuthenticationOptions(_0x13be06['provider'],_0x1ebb22['body']);_0x13be06['Imap']=_0x591cab[_0xe6ed('0x3b')];_0x13be06[_0xe6ed('0x3c')]=_0x591cab[_0xe6ed('0x3c')];return db['MailAccount'][_0xe6ed('0x63')](_0x13be06,{'include':[{'model':db[_0xe6ed('0x3e')],'as':'Smtp'},{'model':db[_0xe6ed('0x5a')],'as':_0xe6ed('0x3b')}]})[_0xe6ed('0x1f')](function(_0x2460b0){var _0x204be3=_0x1ebb22[_0xe6ed('0x30')][_0xe6ed('0x21')]({'plain':!![]});if(!_0x204be3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x204be3[_0xe6ed('0x73')]==='user'){var _0x181a3e=_0x2460b0[_0xe6ed('0x21')]({'plain':!![]});return db['UserProfileSection'][_0xe6ed('0x5f')]({'where':{'name':'MailAccounts','userProfileId':_0x204be3[_0xe6ed('0x74')]},'raw':!![]})[_0xe6ed('0x1f')](function(_0x1723c9){if(_0x1723c9&&_0x1723c9[_0xe6ed('0x75')]===0x0){return db[_0xe6ed('0x23')][_0xe6ed('0x63')]({'name':_0x181a3e['name'],'resourceId':_0x181a3e['id'],'type':_0x1723c9[_0xe6ed('0x25')],'sectionId':_0x1723c9['id']},{})[_0xe6ed('0x1f')](function(){return _0x2460b0;});}else{return _0x2460b0;}})[_0xe6ed('0x14')](function(_0x37cbb4){logger[_0xe6ed('0x10')](_0xe6ed('0x76'),_0x37cbb4);throw _0x37cbb4;});}return _0x2460b0;})['then'](respondWithResult(_0x1266db,0xc9))[_0xe6ed('0x14')](handleError(_0x1266db,null));};exports[_0xe6ed('0x77')]=function(_0x373f70,_0x1dbb1d){return db[_0xe6ed('0x41')][_0xe6ed('0x65')]({'where':{'id':_0x373f70[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x1dbb1d,null))['then'](function(_0x239383){if(_0x239383){return _0x239383[_0xe6ed('0x77')]();}return null;})[_0xe6ed('0x1f')](respondWithResult(_0x1dbb1d,null))['catch'](handleError(_0x1dbb1d,null));};exports['addImap']=function(_0x51d188,_0xe8d4c){if(_0x51d188[_0xe6ed('0x5d')]['id']){delete _0x51d188[_0xe6ed('0x5d')]['id'];}return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0x51d188['params']['id']}})['then'](handleEntityNotFound(_0xe8d4c,null))[_0xe6ed('0x1f')](function(_0x14c61e){if(_0x14c61e){_0x51d188[_0xe6ed('0x5d')][_0xe6ed('0x61')]=_0x14c61e['id'];return db[_0xe6ed('0x5a')][_0xe6ed('0x63')](_0x51d188[_0xe6ed('0x5d')]);}})[_0xe6ed('0x1f')](respondWithResult(_0xe8d4c,null))[_0xe6ed('0x14')](handleError(_0xe8d4c,null));};exports[_0xe6ed('0x78')]=function(_0x12c051,_0x507f70){return db[_0xe6ed('0x41')][_0xe6ed('0x65')]({'where':{'id':_0x12c051[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x507f70,null))[_0xe6ed('0x1f')](function(_0x5a2047){if(_0x5a2047){return _0x5a2047['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x507f70,null))[_0xe6ed('0x14')](handleError(_0x507f70,null));};exports[_0xe6ed('0x79')]=function(_0x32085a,_0x40b884){return db[_0xe6ed('0x41')]['findOne']({'where':{'id':_0x32085a[_0xe6ed('0x59')]['id']}})['then'](handleEntityNotFound(_0x40b884,null))[_0xe6ed('0x1f')](function(_0x420260){if(_0x420260){return _0x420260[_0xe6ed('0x79')]();}return null;})[_0xe6ed('0x1f')](respondWithResult(_0x40b884,null))[_0xe6ed('0x14')](handleError(_0x40b884,null));};exports[_0xe6ed('0x7a')]=function(_0x40de6c,_0x5fefdd){if(_0x40de6c[_0xe6ed('0x5d')]['id']){delete _0x40de6c['body']['id'];}return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0x40de6c['params']['id']}})['then'](handleEntityNotFound(_0x5fefdd,null))[_0xe6ed('0x1f')](function(_0x1579ab){if(_0x1579ab){_0x40de6c['body'][_0xe6ed('0x61')]=_0x1579ab['id'];return db['MailServerOut']['create'](_0x40de6c[_0xe6ed('0x5d')]);}})[_0xe6ed('0x1f')](respondWithResult(_0x5fefdd,null))[_0xe6ed('0x14')](handleError(_0x5fefdd,null));};exports[_0xe6ed('0x7b')]=function(_0x5ddd7b,_0x5edd1d){return db[_0xe6ed('0x41')][_0xe6ed('0x65')]({'where':{'id':_0x5ddd7b[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x5edd1d,null))[_0xe6ed('0x1f')](function(_0x4e91e9){if(_0x4e91e9){return _0x4e91e9[_0xe6ed('0x7c')](null);}return null;})[_0xe6ed('0x1f')](respondWithStatusCode(_0x5edd1d,null))['catch'](handleError(_0x5edd1d,null));};exports['addInteraction']=function(_0x11ef12,_0x2a4352){return db['MailInteraction'][_0xe6ed('0x5f')]({'where':{'id':_0x11ef12[_0xe6ed('0x59')]['id']}})['then'](handleEntityNotFound(_0x2a4352,null))[_0xe6ed('0x1f')](function(_0x2f0955){if(_0x2f0955){return _0x2f0955[_0xe6ed('0x7d')](_0x11ef12['body']['ids'],_[_0xe6ed('0x7e')](_0x11ef12[_0xe6ed('0x5d')],[_0xe6ed('0x69'),'id'])||{});}})['then'](respondWithResult(_0x2a4352,null))[_0xe6ed('0x14')](handleError(_0x2a4352,null));};exports[_0xe6ed('0x7f')]=function(_0x3f23fe,_0x35cef5){var _0x39c04b={'raw':![],'where':{}};var _0x4b5979={};var _0x197bdc={'count':0x0,'rows':[]};return db['MailAccount'][_0xe6ed('0x65')]({'where':{'id':_0x3f23fe['params']['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x35cef5,null))[_0xe6ed('0x1f')](function(_0x326087){if(_0x326087){_0x4b5979[_0xe6ed('0x46')]=_['keys'](db[_0xe6ed('0x80')][_0xe6ed('0x42')]);_0x4b5979[_0xe6ed('0x47')]=_[_0xe6ed('0x48')](_0x3f23fe[_0xe6ed('0x47')]);_0x4b5979['filters']=_[_0xe6ed('0x4b')](_0x4b5979[_0xe6ed('0x46')],_0x4b5979['query']);_0x39c04b['attributes']=_['intersection'](_0x4b5979[_0xe6ed('0x46')],qs['fields'](_0x3f23fe[_0xe6ed('0x47')]['fields']));_0x39c04b[_0xe6ed('0x4a')]=_0x39c04b[_0xe6ed('0x4a')]['length']?_0x39c04b['attributes']:_0x4b5979[_0xe6ed('0x46')];if(!_0x3f23fe[_0xe6ed('0x47')][_0xe6ed('0x4e')]('nolimit')){_0x39c04b[_0xe6ed('0x1a')]=qs[_0xe6ed('0x1a')](_0x3f23fe[_0xe6ed('0x47')][_0xe6ed('0x1a')]);_0x39c04b[_0xe6ed('0x1c')]=qs[_0xe6ed('0x1c')](_0x3f23fe[_0xe6ed('0x47')]['offset']);}_0x39c04b[_0xe6ed('0x4f')]=qs[_0xe6ed('0x50')](_0x3f23fe['query'][_0xe6ed('0x50')]);_0x39c04b['where']=qs[_0xe6ed('0x49')](_[_0xe6ed('0x67')](_0x3f23fe[_0xe6ed('0x47')],_0x4b5979['filters']));_0x39c04b[_0xe6ed('0x51')][_0xe6ed('0x61')]=_0x326087['id'];if(_0x3f23fe[_0xe6ed('0x47')][_0xe6ed('0x52')]){_0x39c04b['where']=_[_0xe6ed('0x53')](_0x39c04b['where'],{'$or':_['map'](_0x39c04b['attributes'],function(_0x2857a2){var _0x40af02={};_0x40af02[_0x2857a2]={'$like':'%'+_0x3f23fe[_0xe6ed('0x47')][_0xe6ed('0x52')]+'%'};return _0x40af02;})});}_0x39c04b=_[_0xe6ed('0x53')]({},_0x39c04b,_0x3f23fe['options']);return db[_0xe6ed('0x80')]['count']({'where':_0x39c04b[_0xe6ed('0x51')]})[_0xe6ed('0x1f')](function(_0x579b54){_0x197bdc[_0xe6ed('0x1b')]=_0x579b54;if(_0x3f23fe[_0xe6ed('0x47')][_0xe6ed('0x55')]){_0x39c04b[_0xe6ed('0x5b')]=[{'model':db['CmContact'],'as':_0xe6ed('0x81'),'required':![]},{'model':db[_0xe6ed('0x82')],'as':_0xe6ed('0x83'),'attributes':[_0xe6ed('0x25'),_0xe6ed('0x84'),_0xe6ed('0x85')],'required':![]},{'model':db[_0xe6ed('0x86')],'as':_0xe6ed('0x87'),'attributes':['id',_0xe6ed('0x25'),_0xe6ed('0x88')],'where':_0x3f23fe[_0xe6ed('0x47')][_0xe6ed('0x89')]?{'id':_0x3f23fe[_0xe6ed('0x47')][_0xe6ed('0x89')]}:undefined,'required':_0x3f23fe[_0xe6ed('0x47')][_0xe6ed('0x89')]?!![]:![]}];}return db[_0xe6ed('0x80')][_0xe6ed('0x56')](_0x39c04b);})[_0xe6ed('0x1f')](function(_0x415646){_0x197bdc['rows']=_0x415646;return _0x197bdc;});}})[_0xe6ed('0x1f')](respondWithFilteredResult(_0x35cef5,_0x39c04b))['catch'](handleError(_0x35cef5,null));};exports[_0xe6ed('0x8a')]=function addApplications(_0x3bcfd7,_0x4a7e0f){var _0x121a19=_0x3bcfd7['params']['id'];var _0x381299=_0x3bcfd7[_0xe6ed('0x5d')];var _0x3f4d02=0xc8;var _0x1ab4b4=null;return db[_0xe6ed('0x8b')][_0xe6ed('0x8c')]({'isolationLevel':db[_0xe6ed('0x8b')][_0xe6ed('0x8d')][_0xe6ed('0x8e')][_0xe6ed('0x8f')]},function(_0x35ffdd){return db[_0xe6ed('0x41')]['findOne']({'where':{'id':_0x121a19},'transaction':_0x35ffdd})[_0xe6ed('0x1f')](function(_0xa23e75){if(_0xa23e75){return db[_0xe6ed('0x90')][_0xe6ed('0x20')]({'where':{'MailAccountId':_0x121a19},'transaction':_0x35ffdd})['then'](function(){var _0x5a658f=_[_0xe6ed('0x6b')](_0x381299,function(_0x26c9c4){_0x26c9c4[_0xe6ed('0x61')]=_0x121a19;return _0x26c9c4;});return db[_0xe6ed('0x90')][_0xe6ed('0x91')](_0x5a658f,{'transaction':_0x35ffdd});});}else{_0x3f4d02=0x194;_0x1ab4b4=[];}});})[_0xe6ed('0x1f')](function(){if(_0x3f4d02!==0x194){return db[_0xe6ed('0x90')]['findAndCountAll']({'where':{'MailAccountId':_0x121a19},'order':_0xe6ed('0x92')})[_0xe6ed('0x1f')](function(_0x17fad2){_0x1ab4b4=_0x17fad2;});}})[_0xe6ed('0x14')](function(_0x1b6925){_0x3f4d02=0x1f4;logger[_0xe6ed('0x10')](_0x1b6925[_0xe6ed('0x24')]);if(_0x1b6925['name']){delete _0x1b6925['name'];}_0x1ab4b4=_0x1b6925;})[_0xe6ed('0x93')](function(){if(_0x1ab4b4===null){_0x4a7e0f[_0xe6ed('0x15')](_0x3f4d02);}else{if(_0x3f4d02===0x1f4){_0x4a7e0f['status'](_0x3f4d02)['send'](_0x1ab4b4);}else{_0x4a7e0f[_0xe6ed('0x16')](_0x3f4d02)['json'](_0x1ab4b4);}}});};exports[_0xe6ed('0x94')]=function(_0x280964,_0x505a5e){var _0x5e33bb={};var _0x1ab655={};var _0x281575;var _0x1e974c;return db[_0xe6ed('0x41')][_0xe6ed('0x65')]({'where':{'id':_0x280964[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x505a5e,null))[_0xe6ed('0x1f')](function(_0x56f5a7){if(_0x56f5a7){_0x281575=_0x56f5a7;_0x1ab655[_0xe6ed('0x46')]=_[_0xe6ed('0x48')](db[_0xe6ed('0x90')][_0xe6ed('0x42')]);_0x1ab655[_0xe6ed('0x47')]=_['keys'](_0x280964[_0xe6ed('0x47')]);_0x1ab655[_0xe6ed('0x49')]=_[_0xe6ed('0x4b')](_0x1ab655[_0xe6ed('0x46')],_0x1ab655['query']);_0x5e33bb[_0xe6ed('0x4a')]=_['intersection'](_0x1ab655['model'],qs['fields'](_0x280964[_0xe6ed('0x47')]['fields']));_0x5e33bb[_0xe6ed('0x4a')]=_0x5e33bb[_0xe6ed('0x4a')]['length']?_0x5e33bb[_0xe6ed('0x4a')]:_0x1ab655['model'];_0x5e33bb[_0xe6ed('0x4f')]=qs[_0xe6ed('0x50')](_0x280964[_0xe6ed('0x47')][_0xe6ed('0x50')]);_0x5e33bb[_0xe6ed('0x51')]=qs[_0xe6ed('0x49')](_[_0xe6ed('0x67')](_0x280964[_0xe6ed('0x47')],_0x1ab655[_0xe6ed('0x49')]));if(_0x280964[_0xe6ed('0x47')][_0xe6ed('0x52')]){_0x5e33bb[_0xe6ed('0x51')]=_[_0xe6ed('0x53')](_0x5e33bb[_0xe6ed('0x51')],{'$or':_[_0xe6ed('0x6b')](_0x5e33bb[_0xe6ed('0x4a')],function(_0x4bb4c0){var _0x150d8e={};_0x150d8e[_0x4bb4c0]={'$like':'%'+_0x280964['query']['filter']+'%'};return _0x150d8e;})});}_0x5e33bb=_['merge']({},_0x5e33bb,_0x280964[_0xe6ed('0x5c')]);return _0x281575[_0xe6ed('0x94')](_0x5e33bb);}})[_0xe6ed('0x1f')](function(_0x3356ac){if(_0x3356ac){_0x1e974c=_0x3356ac['length'];if(!_0x280964[_0xe6ed('0x47')][_0xe6ed('0x4e')](_0xe6ed('0x66'))){_0x5e33bb[_0xe6ed('0x1a')]=qs[_0xe6ed('0x1a')](_0x280964[_0xe6ed('0x47')][_0xe6ed('0x1a')]);_0x5e33bb[_0xe6ed('0x1c')]=qs['offset'](_0x280964[_0xe6ed('0x47')][_0xe6ed('0x1c')]);}return _0x281575[_0xe6ed('0x94')](_0x5e33bb);}})[_0xe6ed('0x1f')](function(_0x14d7a8){if(_0x14d7a8){return _0x14d7a8?{'count':_0x1e974c,'rows':_0x14d7a8}:null;}})['then'](respondWithResult(_0x505a5e,null))[_0xe6ed('0x14')](handleError(_0x505a5e,null));};exports[_0xe6ed('0x95')]=function(_0x339f26,_0x172f84){var _0x133182={'raw':!![],'where':{}};var _0x22b898={};var _0x337cc2={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x339f26[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x172f84,null))['then'](function(_0x2723ef){if(_0x2723ef){_0x22b898['model']=_['keys'](db['MailMessage']['rawAttributes']);_0x22b898[_0xe6ed('0x47')]=_[_0xe6ed('0x48')](_0x339f26[_0xe6ed('0x47')]);_0x22b898[_0xe6ed('0x49')]=_[_0xe6ed('0x4b')](_0x22b898[_0xe6ed('0x46')],_0x22b898['query']);_0x133182[_0xe6ed('0x4a')]=_[_0xe6ed('0x4b')](_0x22b898[_0xe6ed('0x46')],qs['fields'](_0x339f26['query'][_0xe6ed('0x4c')]));_0x133182['attributes']=_0x133182[_0xe6ed('0x4a')][_0xe6ed('0x4d')]?_0x133182[_0xe6ed('0x4a')]:_0x22b898[_0xe6ed('0x46')];if(!_0x339f26[_0xe6ed('0x47')][_0xe6ed('0x4e')](_0xe6ed('0x66'))){_0x133182['limit']=qs[_0xe6ed('0x1a')](_0x339f26[_0xe6ed('0x47')][_0xe6ed('0x1a')]);_0x133182[_0xe6ed('0x1c')]=qs[_0xe6ed('0x1c')](_0x339f26['query']['offset']);}_0x133182[_0xe6ed('0x4f')]=qs[_0xe6ed('0x50')](_0x339f26[_0xe6ed('0x47')][_0xe6ed('0x50')]);_0x133182[_0xe6ed('0x51')]=qs['filters'](_[_0xe6ed('0x67')](_0x339f26['query'],_0x22b898['filters']));_0x133182[_0xe6ed('0x51')]['MailAccountId']=_0x2723ef['id'];if(_0x339f26[_0xe6ed('0x47')][_0xe6ed('0x52')]){_0x133182[_0xe6ed('0x51')]=_[_0xe6ed('0x53')](_0x133182[_0xe6ed('0x51')],{'$or':_[_0xe6ed('0x6b')](_0x133182[_0xe6ed('0x4a')],function(_0x449e72){var _0x2aedf9={};_0x2aedf9[_0x449e72]={'$like':'%'+_0x339f26[_0xe6ed('0x47')][_0xe6ed('0x52')]+'%'};return _0x2aedf9;})});}if(_0x339f26[_0xe6ed('0x47')][_0xe6ed('0x96')]){var _0x5c6a18=_0x339f26['query'][_0xe6ed('0x96')][_0xe6ed('0x97')](',');var _0xd12cf={};_0xd12cf[_0x5c6a18[0x0]]={'$gte':moment(_0x5c6a18[0x1])[_0xe6ed('0x98')](_0xe6ed('0x99'))};_0x133182[_0xe6ed('0x51')]=_[_0xe6ed('0x53')](_0x133182[_0xe6ed('0x51')],_0xd12cf);}_0x133182=_[_0xe6ed('0x53')]({},_0x133182,_0x339f26[_0xe6ed('0x5c')]);return db[_0xe6ed('0x9a')][_0xe6ed('0x1b')]({'where':_0x133182[_0xe6ed('0x51')]})[_0xe6ed('0x1f')](function(_0x5d86dc){_0x337cc2[_0xe6ed('0x1b')]=_0x5d86dc;if(_0x339f26['query'][_0xe6ed('0x55')]){_0x133182[_0xe6ed('0x5b')]=[{'all':!![]}];}return db[_0xe6ed('0x9a')][_0xe6ed('0x56')](_0x133182);})[_0xe6ed('0x1f')](function(_0x1f07c6){if(_0x339f26['query']['inlineCss']===_0xe6ed('0x9b')){for(var _0x112206=0x0;_0x112206<_0x1f07c6[_0xe6ed('0x4d')];_0x112206++){_0x1f07c6[_0x112206][_0xe6ed('0x5d')]=juice(_0x1f07c6[_0x112206][_0xe6ed('0x5d')]);}}_0x337cc2['rows']=_0x1f07c6;return _0x337cc2;});}})[_0xe6ed('0x1f')](respondWithFilteredResult(_0x172f84,_0x133182))[_0xe6ed('0x14')](handleError(_0x172f84,null));};exports[_0xe6ed('0x9c')]=function(_0x3e0d1a,_0x30ace4){var _0x2126d6,_0x4eca36={},_0xa2ec1e;if(_0x3e0d1a['body']['to']){_0xa2ec1e=_0x3e0d1a[_0xe6ed('0x5d')]['to'][_0xe6ed('0x97')](',')[0x0];}return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0x3e0d1a[_0xe6ed('0x59')]['id']},'include':[{'model':db[_0xe6ed('0x9d')],'as':_0xe6ed('0x9e'),'include':[{'model':db[_0xe6ed('0x9f')],'as':_0xe6ed('0xa0'),'where':{'email':_0xa2ec1e},'limit':0x1,'order':[[_0xe6ed('0xa1'),_0xe6ed('0xa2')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xe6ed('0xa3')],'as':_0xe6ed('0xa3'),'raw':!![]}]}]})[_0xe6ed('0x1f')](handleEntityNotFound(_0x30ace4,null))[_0xe6ed('0x1f')](function(_0x42f0f1){if(!_0x42f0f1)return;_0x2126d6=_0x42f0f1;if(!_0x42f0f1['Smtp'])throw new Error(_0xe6ed('0xa4'));if(_[_0xe6ed('0x71')](_0x3e0d1a[_0xe6ed('0x5d')][_0xe6ed('0xa5')])){_0x3e0d1a[_0xe6ed('0x5d')]['from']=util[_0xe6ed('0x98')]('%s\x20<%s>',_0x42f0f1[_0xe6ed('0x25')],_0x42f0f1[_0xe6ed('0x6f')]||_0x42f0f1[_0xe6ed('0x3c')][_0xe6ed('0x30')]);}if(_0x3e0d1a[_0xe6ed('0x5d')][_0xe6ed('0xa6')]&&_0x3e0d1a[_0xe6ed('0x5d')][_0xe6ed('0xa6')][_0xe6ed('0x4d')]){for(var _0x17ee2e=0x0;_0x17ee2e<_0x3e0d1a[_0xe6ed('0x5d')]['attachments'][_0xe6ed('0x4d')];_0x17ee2e+=0x1){_0x3e0d1a[_0xe6ed('0x5d')]['attachments'][_0x17ee2e]={'filename':_0x3e0d1a[_0xe6ed('0x5d')]['attachments'][_0x17ee2e][_0xe6ed('0x25')],'path':path['join'](config[_0xe6ed('0xa7')],'server/files/attachments',_0x3e0d1a[_0xe6ed('0x5d')]['attachments'][_0x17ee2e][_0xe6ed('0xa8')])};}}var _0x4759c4=_0x42f0f1[_0xe6ed('0xa9')]();return respondWithRpcPromise(_0xe6ed('0xaa'),_0xe6ed('0xab'),{'account':_0x4759c4,'message':_0x3e0d1a['body']});})[_0xe6ed('0x1f')](function(_0x401449){if(!_0x401449)return;_0x4eca36=_0x401449;if(!_0x2126d6[_0xe6ed('0x9e')])throw new Error(_0xe6ed('0xac'));if(_0x2126d6[_0xe6ed('0x9e')][_0xe6ed('0xa0')][_0xe6ed('0x4d')])return _0x2126d6[_0xe6ed('0x9e')][_0xe6ed('0xa0')][0x0];return db['CmContact'][_0xe6ed('0x63')](_['defaults'](_0x3e0d1a[_0xe6ed('0x5d')],{'firstName':_0x3e0d1a[_0xe6ed('0x5d')]['to'],'email':_0x3e0d1a['body']['to'],'phone':_0x3e0d1a[_0xe6ed('0x5d')]['to'],'ListId':_0x2126d6[_0xe6ed('0x70')]}));})[_0xe6ed('0x1f')](function(_0x41ee0f){if(!_0x41ee0f)return;var _0x4296b3={'UserId':_0x3e0d1a[_0xe6ed('0x30')]['id'],'ContactId':_0x41ee0f['id'],'MailAccountId':_0x2126d6['id'],'inReplyTo':_0x4eca36[_0xe6ed('0xad')],'to':_0x3e0d1a[_0xe6ed('0x5d')][_0xe6ed('0xa5')],'cc':_0x3e0d1a[_0xe6ed('0x5d')]['cc'],'subject':_0x3e0d1a[_0xe6ed('0x5d')]['subject'],'attach':_0x3e0d1a[_0xe6ed('0x5d')]['attach'],'firstMsgDirection':_0xe6ed('0xae'),'lastMsgAt':moment()[_0xe6ed('0x98')](_0xe6ed('0x99')),'lastMsgDirection':'out','Messages':[_[_0xe6ed('0x53')](_0x3e0d1a[_0xe6ed('0x5d')],{'messageId':_0x4eca36[_0xe6ed('0xad')],'sentAt':moment()['format'](_0xe6ed('0x99')),'read':!![],'MailAccountId':_0x2126d6['id'],'UserId':_0x3e0d1a[_0xe6ed('0x30')]['id'],'ContactId':_0x41ee0f['id']})]};if(_0x3e0d1a['body'][_0xe6ed('0xaf')]){_0x4296b3=_[_0xe6ed('0x53')](_0x4296b3,_0x3e0d1a['body'][_0xe6ed('0xaf')]);}return db['MailInteraction']['create'](_0x4296b3,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0xe6ed('0x1f')](respondWithResult(_0x30ace4,null))[_0xe6ed('0x14')](handleError(_0x30ace4,null));};exports['verifySmtp']=function(_0x255c5a,_0x5e4c68){return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0x255c5a[_0xe6ed('0x59')]['id']},'include':[{'model':db[_0xe6ed('0x3e')],'as':_0xe6ed('0x3c'),'raw':!![],'include':[{'model':db[_0xe6ed('0xa3')],'as':_0xe6ed('0xa3'),'raw':!![]}]}]})[_0xe6ed('0x1f')](handleEntityNotFound(_0x5e4c68,null))[_0xe6ed('0x1f')](function(_0x4d3884){if(!_0x4d3884[_0xe6ed('0x3c')])return;var _0x40139f=_0x4d3884[_0xe6ed('0xa9')]();return respondWithRpcPromise(_0xe6ed('0xb0'),_0xe6ed('0xb1'),{'account':_0x40139f});})['then'](respondWithResult(_0x5e4c68,null))[_0xe6ed('0x14')](handleError(_0x5e4c68,null));};exports[_0xe6ed('0x20')]=function(_0x314f28,_0x48f620){return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0x314f28[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x48f620,null))[_0xe6ed('0x1f')](function(_0x5094c3){if(_0x5094c3&&_0x5094c3[_0xe6ed('0x39')]){throw new db[(_0xe6ed('0xb2'))][(_0xe6ed('0xb3'))](_0xe6ed('0xb4'));}return _0x5094c3;})[_0xe6ed('0x1f')](removeEntity(_0x48f620,null))[_0xe6ed('0x14')](handleError(_0x48f620,null));};exports[_0xe6ed('0xb5')]=function(_0xcffbd5,_0x171b86){return db[_0xe6ed('0x41')][_0xe6ed('0x5f')]({'where':{'id':_0xcffbd5[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x171b86,null))[_0xe6ed('0x1f')](function(_0x20d87c){if(_0x20d87c){return _0x20d87c[_0xe6ed('0xb5')](_0xcffbd5['body']['ids'],_[_0xe6ed('0x7e')](_0xcffbd5[_0xe6ed('0x5d')],[_0xe6ed('0x69'),'id'])||{})[_0xe6ed('0xb6')](function(_0x557478){for(var _0x89a7d0=0x0;_0x89a7d0<_0xcffbd5['body']['ids'][_0xe6ed('0x4d')];_0x89a7d0+=0x1){socket[_0xe6ed('0xb7')](_0xe6ed('0xb8'),{'UserId':Number(_0xcffbd5['body']['ids'][_0x89a7d0]),'MailAccountId':Number(_0xcffbd5[_0xe6ed('0x59')]['id'])});}return _0x557478;});}})[_0xe6ed('0x1f')](respondWithResult(_0x171b86,null))['catch'](handleError(_0x171b86,null));};exports[_0xe6ed('0xb9')]=function(_0x2c0a9d,_0x4caae3){return db['MailAccount'][_0xe6ed('0x5f')]({'where':{'id':_0x2c0a9d[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x4caae3,null))['then'](function(_0x5a076f){if(_0x5a076f){return _0x5a076f[_0xe6ed('0xb9')](_0x2c0a9d[_0xe6ed('0x47')]['ids'])[_0xe6ed('0x1f')](function(){if(_[_0xe6ed('0xba')](_0x2c0a9d['query'][_0xe6ed('0x69')])){for(var _0x13a40b=0x0;_0x13a40b<_0x2c0a9d[_0xe6ed('0x47')][_0xe6ed('0x69')][_0xe6ed('0x4d')];_0x13a40b+=0x1){socket[_0xe6ed('0xb7')](_0xe6ed('0xbb'),{'UserId':Number(_0x2c0a9d[_0xe6ed('0x47')]['ids'][_0x13a40b]),'MailAccountId':Number(_0x2c0a9d['params']['id'])});}}else{socket[_0xe6ed('0xb7')](_0xe6ed('0xbb'),{'UserId':Number(_0x2c0a9d['query'][_0xe6ed('0x69')]),'MailAccountId':Number(_0x2c0a9d[_0xe6ed('0x59')]['id'])});}});}})[_0xe6ed('0x1f')](respondWithStatusCode(_0x4caae3,null))['catch'](handleError(_0x4caae3,null));};exports[_0xe6ed('0xbc')]=function(_0x2ed9fe,_0x3a6d6c){var _0x3410dd={};var _0x2de0ee={};var _0xdd8c36;var _0x501dfc;return db[_0xe6ed('0x41')][_0xe6ed('0x65')]({'where':{'id':_0x2ed9fe[_0xe6ed('0x59')]['id']}})[_0xe6ed('0x1f')](handleEntityNotFound(_0x3a6d6c,null))['then'](function(_0x232730){if(_0x232730){_0xdd8c36=_0x232730;_0x2de0ee[_0xe6ed('0x46')]=_['keys'](db['User'][_0xe6ed('0x42')]);_0x2de0ee[_0xe6ed('0x47')]=_[_0xe6ed('0x48')](_0x2ed9fe[_0xe6ed('0x47')]);_0x2de0ee[_0xe6ed('0x49')]=_[_0xe6ed('0x4b')](_0x2de0ee[_0xe6ed('0x46')],_0x2de0ee[_0xe6ed('0x47')]);_0x3410dd[_0xe6ed('0x4a')]=_[_0xe6ed('0x4b')](_0x2de0ee['model'],qs[_0xe6ed('0x4c')](_0x2ed9fe['query'][_0xe6ed('0x4c')]));_0x3410dd[_0xe6ed('0x4a')]=_0x3410dd['attributes']['length']?_0x3410dd[_0xe6ed('0x4a')]:_0x2de0ee[_0xe6ed('0x46')];_0x3410dd[_0xe6ed('0x4f')]=qs[_0xe6ed('0x50')](_0x2ed9fe[_0xe6ed('0x47')][_0xe6ed('0x50')]);_0x3410dd['where']=qs['filters'](_[_0xe6ed('0x67')](_0x2ed9fe[_0xe6ed('0x47')],_0x2de0ee[_0xe6ed('0x49')]));if(_0x2ed9fe[_0xe6ed('0x47')][_0xe6ed('0x52')]){_0x3410dd[_0xe6ed('0x51')]=_[_0xe6ed('0x53')](_0x3410dd[_0xe6ed('0x51')],{'$or':_[_0xe6ed('0x6b')](_0x3410dd[_0xe6ed('0x4a')],function(_0x549d25){var _0x5c0ea1={};_0x5c0ea1[_0x549d25]={'$like':'%'+_0x2ed9fe[_0xe6ed('0x47')][_0xe6ed('0x52')]+'%'};return _0x5c0ea1;})});}_0x3410dd=_[_0xe6ed('0x53')]({},_0x3410dd,_0x2ed9fe['options']);return _0xdd8c36[_0xe6ed('0xbc')](_0x3410dd);}})[_0xe6ed('0x1f')](function(_0x2d05e8){if(_0x2d05e8){_0x501dfc=_0x2d05e8[_0xe6ed('0x4d')];if(!_0x2ed9fe[_0xe6ed('0x47')][_0xe6ed('0x4e')]('nolimit')){_0x3410dd[_0xe6ed('0x1a')]=qs[_0xe6ed('0x1a')](_0x2ed9fe[_0xe6ed('0x47')][_0xe6ed('0x1a')]);_0x3410dd[_0xe6ed('0x1c')]=qs[_0xe6ed('0x1c')](_0x2ed9fe[_0xe6ed('0x47')][_0xe6ed('0x1c')]);}return _0xdd8c36[_0xe6ed('0xbc')](_0x3410dd);}})[_0xe6ed('0x1f')](function(_0x21c48d){if(_0x21c48d){return _0x21c48d?{'count':_0x501dfc,'rows':_0x21c48d}:null;}})[_0xe6ed('0x1f')](respondWithResult(_0x3a6d6c,null))[_0xe6ed('0x14')](handleError(_0x3a6d6c,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 1befb81..f897bdc 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 _0x684b=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','MailAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x684b,0x1a5));var _0xb684=function(_0x3d07e4,_0x1a771e){_0x3d07e4=_0x3d07e4-0x0;var _0x422ec1=_0x684b[_0x3d07e4];return _0x422ec1;};'use strict';var EventEmitter=require(_0xb684('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xb684('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xb684('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb684('0x3'),'afterDestroy':_0xb684('0x4')};function emitEvent(_0x208615){return function(_0x217699,_0x4fb0ea,_0x11d8d7){MailAccountEvents['emit'](_0x208615+':'+_0x217699['id'],_0x217699);MailAccountEvents[_0xb684('0x5')](_0x208615,_0x217699);_0x11d8d7(null);};}for(var e in events){if(events[_0xb684('0x6')](e)){var event=events[e];MailAccount[_0xb684('0x7')](e,emitEvent(event));}}module[_0xb684('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xac6a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','remove'];(function(_0x5a4526,_0x521684){var _0x4d5f94=function(_0x240bd6){while(--_0x240bd6){_0x5a4526['push'](_0x5a4526['shift']());}};_0x4d5f94(++_0x521684);}(_0xac6a,0xc2));var _0xaac6=function(_0x5f2241,_0x14a83f){_0x5f2241=_0x5f2241-0x0;var _0x4f01c2=_0xac6a[_0x5f2241];return _0x4f01c2;};'use strict';var EventEmitter=require(_0xaac6('0x0'));var MailAccount=require(_0xaac6('0x1'))['db'][_0xaac6('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xaac6('0x3')](0x0);var events={'afterCreate':_0xaac6('0x4'),'afterUpdate':'update','afterDestroy':_0xaac6('0x5')};function emitEvent(_0x4c0cf4){return function(_0x9dc043,_0x1a0d76,_0x44259b){MailAccountEvents[_0xaac6('0x6')](_0x4c0cf4+':'+_0x9dc043['id'],_0x9dc043);MailAccountEvents[_0xaac6('0x6')](_0x4c0cf4,_0x9dc043);_0x44259b(null);};}for(var e in events){if(events[_0xaac6('0x7')](e)){var event=events[e];MailAccount[_0xaac6('0x8')](e,emitEvent(event));}}module[_0xaac6('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 1d39d22..972ab5e 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 _0x6299=['auth','user','data5','pass','./mailAccount.attributes','define','MailAccount','mail_accounts','provider','custom','service','host','port','Smtp','secure','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found'];(function(_0xc2b2c,_0x5c70f8){var _0x5078d8=function(_0x42d367){while(--_0x42d367){_0xc2b2c['push'](_0xc2b2c['shift']());}};_0x5078d8(++_0x5c70f8);}(_0x6299,0x114));var _0x9629=function(_0x460efb,_0x4c5527){_0x460efb=_0x460efb-0x0;var _0x545ca3=_0x6299[_0x460efb];return _0x545ca3;};'use strict';var attributes=require(_0x9629('0x0'));module['exports']=function(_0x35aeb7){return _0x35aeb7[_0x9629('0x1')](_0x9629('0x2'),attributes,{'tableName':_0x9629('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xf479ab=this;var _0x20912f={'id':_0xf479ab['id'],'tls':{'rejectUnauthorized':![]}};if(_0xf479ab[_0x9629('0x4')]!==_0x9629('0x5')){_0x20912f[_0x9629('0x6')]=_0xf479ab[_0x9629('0x4')];}else{_0x20912f[_0x9629('0x7')]=_0xf479ab['Smtp'][_0x9629('0x7')];_0x20912f[_0x9629('0x8')]=_0xf479ab[_0x9629('0x9')][_0x9629('0x8')];_0x20912f[_0x9629('0xa')]=_0xf479ab[_0x9629('0x9')][_0x9629('0xa')];}if(_0xf479ab[_0x9629('0x9')]['authentication']){if(_0xf479ab[_0x9629('0x9')]['modernAuthentication']){if(!_0xf479ab[_0x9629('0x9')][_0x9629('0xb')])throw new Error(_0x9629('0xc'));_0x20912f[_0x9629('0xd')]={'type':'OAuth2','user':_0xf479ab[_0x9629('0x9')][_0x9629('0xe')],'accessToken':_0xf479ab[_0x9629('0x9')]['CloudProvider'][_0x9629('0xf')]};}else{_0x20912f[_0x9629('0xd')]={'user':_0xf479ab[_0x9629('0x9')][_0x9629('0xe')],'pass':_0xf479ab['Smtp'][_0x9629('0x10')]};}}return _0x20912f;}}});}; \ No newline at end of file +var _0x67d7=['define','MailAccount','mail_accounts','provider','custom','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','auth','user','data5','pass','./mailAccount.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67d7,0x1c6));var _0x767d=function(_0x34dc5d,_0x351b12){_0x34dc5d=_0x34dc5d-0x0;var _0x3f5ab1=_0x67d7[_0x34dc5d];return _0x3f5ab1;};'use strict';var attributes=require(_0x767d('0x0'));module[_0x767d('0x1')]=function(_0x1b2c8b){return _0x1b2c8b[_0x767d('0x2')](_0x767d('0x3'),attributes,{'tableName':_0x767d('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x127045=this;var _0x3538d0={'id':_0x127045['id'],'tls':{'rejectUnauthorized':![]}};if(_0x127045[_0x767d('0x5')]!==_0x767d('0x6')){_0x3538d0[_0x767d('0x7')]=_0x127045[_0x767d('0x5')];}else{_0x3538d0[_0x767d('0x8')]=_0x127045[_0x767d('0x9')]['host'];_0x3538d0[_0x767d('0xa')]=_0x127045[_0x767d('0x9')][_0x767d('0xa')];_0x3538d0[_0x767d('0xb')]=_0x127045['Smtp'][_0x767d('0xb')];}if(_0x127045['Smtp'][_0x767d('0xc')]){if(_0x127045[_0x767d('0x9')][_0x767d('0xd')]){if(!_0x127045[_0x767d('0x9')][_0x767d('0xe')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x3538d0[_0x767d('0xf')]={'type':'OAuth2','user':_0x127045[_0x767d('0x9')][_0x767d('0x10')],'accessToken':_0x127045['Smtp'][_0x767d('0xe')][_0x767d('0x11')]};}else{_0x3538d0[_0x767d('0xf')]={'user':_0x127045[_0x767d('0x9')][_0x767d('0x10')],'pass':_0x127045[_0x767d('0x9')][_0x767d('0x12')]};}}return _0x3538d0;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 0232346..d3c9392 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 _0x4873=['format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','contact','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','waitForTheAssignedAgent','queueId','MailQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailAccount','findAll','options','where','attributes','limit','map','include','model','then','GetMailAccount','ShowMailAccount','raw','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','CmContact','updatedAt','CompanyId','body','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','List','get','applications','list','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','ListId','create','List\x20not\x20found','messageId','subject','attach'];(function(_0x11c7a4,_0x602427){var _0x34963f=function(_0xbd2c28){while(--_0xbd2c28){_0x11c7a4['push'](_0x11c7a4['shift']());}};_0x34963f(++_0x602427);}(_0x4873,0x1df));var _0x3487=function(_0x482774,_0x5f4138){_0x482774=_0x482774-0x0;var _0x2661e3=_0x4873[_0x482774];return _0x2661e3;};'use strict';var _=require(_0x3487('0x0'));var moment=require(_0x3487('0x1'));var BPromise=require(_0x3487('0x2'));var rs=require('randomstring');var Redis=require(_0x3487('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x3487('0x4'));var config=require(_0x3487('0x5'));var jayson=require(_0x3487('0x6'));var client=jayson[_0x3487('0x7')][_0x3487('0x8')]({'port':0x232c});config[_0x3487('0x9')]=_[_0x3487('0xa')](config[_0x3487('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3487('0xb'))(new Redis(config[_0x3487('0x9')]));require(_0x3487('0xc'))[_0x3487('0xd')](socket);function respondWithRpcPromise(_0x17b90c,_0x5a50e8,_0x365727){return new BPromise(function(_0x5e2cca,_0x1a5a7a){return client[_0x3487('0xe')](_0x17b90c,_0x365727)['then'](function(_0x56b795){logger[_0x3487('0xf')](_0x3487('0x10'),_0x5a50e8,'request\x20sent');logger[_0x3487('0x11')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5a50e8,'request\x20sent',JSON[_0x3487('0x12')](_0x56b795));if(_0x56b795[_0x3487('0x13')]){if(_0x56b795[_0x3487('0x13')][_0x3487('0x14')]===0x1f4){logger[_0x3487('0x13')](_0x3487('0x10'),_0x5a50e8,_0x56b795['error'][_0x3487('0x15')]);return _0x1a5a7a(_0x56b795[_0x3487('0x13')][_0x3487('0x15')]);}logger['error'](_0x3487('0x10'),_0x5a50e8,_0x56b795[_0x3487('0x13')][_0x3487('0x15')]);return _0x5e2cca(_0x56b795[_0x3487('0x13')][_0x3487('0x15')]);}else{logger[_0x3487('0xf')](_0x3487('0x10'),_0x5a50e8,_0x3487('0x16'));_0x5e2cca(_0x56b795[_0x3487('0x17')][_0x3487('0x15')]);}})[_0x3487('0x18')](function(_0x41795b){logger[_0x3487('0x13')](_0x3487('0x10'),_0x5a50e8,_0x41795b);_0x1a5a7a(_0x41795b);});});}exports['GetMailAccount']=function(_0x320349){var _0x594ff6=this;return new Promise(function(_0x2fd2e8,_0x20eae9){return db[_0x3487('0x19')][_0x3487('0x1a')]({'raw':_0x320349[_0x3487('0x1b')]?_0x320349[_0x3487('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x320349[_0x3487('0x1b')]?_0x320349[_0x3487('0x1b')][_0x3487('0x1c')]||null:null,'attributes':_0x320349[_0x3487('0x1b')]?_0x320349[_0x3487('0x1b')][_0x3487('0x1d')]||null:null,'limit':_0x320349['options']?_0x320349[_0x3487('0x1b')][_0x3487('0x1e')]||null:null,'include':_0x320349[_0x3487('0x1b')]?_0x320349['options']['include']?_[_0x3487('0x1f')](_0x320349[_0x3487('0x1b')][_0x3487('0x20')],function(_0x3a9d76){return{'model':db[_0x3a9d76['model']],'as':_0x3a9d76['as'],'attributes':_0x3a9d76[_0x3487('0x1d')],'include':_0x3a9d76[_0x3487('0x20')]?_['map'](_0x3a9d76[_0x3487('0x20')],function(_0x3fb245){return{'model':db[_0x3fb245['model']],'as':_0x3fb245['as'],'attributes':_0x3fb245['attributes'],'include':_0x3fb245[_0x3487('0x20')]?_[_0x3487('0x1f')](_0x3fb245[_0x3487('0x20')],function(_0x23a76e){return{'model':db[_0x23a76e[_0x3487('0x21')]],'as':_0x23a76e['as'],'attributes':_0x23a76e[_0x3487('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3487('0x22')](function(_0x38af4a){logger[_0x3487('0xf')](_0x3487('0x23'),_0x320349);logger[_0x3487('0x11')]('GetMailAccount',_0x320349,JSON['stringify'](_0x38af4a));_0x2fd2e8(_0x38af4a);})[_0x3487('0x18')](function(_0x56ee54){logger['error'](_0x3487('0x23'),_0x56ee54[_0x3487('0x15')],_0x320349);_0x20eae9(_0x594ff6['error'](0x1f4,_0x56ee54['message']));});});};exports[_0x3487('0x24')]=function(_0x3a89ba){var _0x46df42=this;return new Promise(function(_0x531dd3,_0x3bb44f){return db['MailAccount']['find']({'raw':_0x3a89ba['options']?_0x3a89ba[_0x3487('0x1b')][_0x3487('0x25')]===undefined?!![]:![]:!![],'where':_0x3a89ba['options']?_0x3a89ba['options'][_0x3487('0x1c')]||null:null,'attributes':_0x3a89ba['options']?_0x3a89ba['options'][_0x3487('0x1d')]||null:null,'include':_0x3a89ba[_0x3487('0x1b')]?_0x3a89ba[_0x3487('0x1b')]['include']?_[_0x3487('0x1f')](_0x3a89ba[_0x3487('0x1b')][_0x3487('0x20')],function(_0x27c28f){return{'model':db[_0x27c28f['model']],'as':_0x27c28f['as'],'attributes':_0x27c28f[_0x3487('0x1d')],'include':_0x27c28f[_0x3487('0x20')]?_['map'](_0x27c28f[_0x3487('0x20')],function(_0x325a3a){return{'model':db[_0x325a3a[_0x3487('0x21')]],'as':_0x325a3a['as'],'attributes':_0x325a3a[_0x3487('0x1d')],'include':_0x325a3a[_0x3487('0x20')]?_[_0x3487('0x1f')](_0x325a3a[_0x3487('0x20')],function(_0x299172){return{'model':db[_0x299172[_0x3487('0x21')]],'as':_0x299172['as'],'attributes':_0x299172['attributes']};}):[]};}):[]};}):[]:[]})[_0x3487('0x22')](function(_0x3c9fa6){if(_0x3a89ba['options']['smtp']===!![])_0x3c9fa6[_0x3487('0x26')](_0x3487('0x27'),_0x3c9fa6[_0x3487('0x28')]());logger['info']('ShowMailAccount',_0x3a89ba);logger['debug'](_0x3487('0x24'),_0x3a89ba,JSON[_0x3487('0x12')](_0x3c9fa6));_0x531dd3(_0x3c9fa6);})['catch'](function(_0xbd0668){logger[_0x3487('0x13')](_0x3487('0x24'),_0xbd0668[_0x3487('0x15')],_0x3a89ba);_0x3bb44f(_0x46df42[_0x3487('0x13')](0x1f4,_0xbd0668[_0x3487('0x15')]));});});};exports[_0x3487('0x29')]=function(_0xc2e2ab){var _0x3cb013=this;return new Promise(function(_0x565cb2,_0x5c4f06){var _0x24a4ec={'body':_0xc2e2ab['body'],'channel':'mail'};var _0x8bb8c2=_['difference'](_['keys'](db[_0x3487('0x2a')]['rawAttributes']),['createdAt',_0x3487('0x2b'),_0x3487('0x2c'),'ListId']);var _0x51b69c=![];if(_0xc2e2ab[_0x3487('0x2d')]['id']){delete _0xc2e2ab[_0x3487('0x2d')]['id'];}if(_['isNil'](_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x2e')])){return _0x5c4f06(_0x3cb013['error'](0x1f4,_0x3487('0x2f')));}if(_[_0x3487('0x30')](_0xc2e2ab[_0x3487('0x2d')]['body'])||_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x2d')]===''){return _0x5c4f06(_0x3cb013[_0x3487('0x13')](0x1f4,_0x3487('0x31')));}if(_[_0x3487('0x30')](_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x32')])){return _0x5c4f06(_0x3cb013[_0x3487('0x13')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x8bb8c2));}if(!_[_0x3487('0x33')](_0x8bb8c2,_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x32')])){return _0x5c4f06(_0x3cb013[_0x3487('0x13')](0x1f4,_0x3487('0x34')+_0x8bb8c2));}var _0x31e766={};_0x31e766[_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x32')]]=_0xc2e2ab['body']['from'];return db[_0x3487('0x19')][_0x3487('0x35')]({'where':{'id':_0xc2e2ab[_0x3487('0x36')]['id']},'include':[{'model':db[_0x3487('0x37')],'as':'List','include':[{'model':db['CmContact'],'as':_0x3487('0x38'),'where':_0x31e766,'limit':0x1,'order':[[_0x3487('0x2b'),_0x3487('0x39')]]}]},{'model':db[_0x3487('0x3a')],'as':_0x3487('0x3b')},{'model':db[_0x3487('0x3c')],'as':_0x3487('0x3d'),'include':[{'model':db[_0x3487('0x3e')],'as':'CloudProvider'}]}]})['then'](function(_0x320351){if(_0x320351&&_0x320351[_0x3487('0x3f')]){var _0x58e50c=_0x320351[_0x3487('0x40')]({'plain':!![]});_0x24a4ec['account']=_['omit'](_0x58e50c,[_0x3487('0x3b'),_0x3487('0x3f')]);_0x24a4ec['account'][_0x3487('0x27')]=_0x320351[_0x3487('0x28')]();_0x24a4ec[_0x3487('0x41')]=_0x58e50c['Applications'];_0x24a4ec[_0x3487('0x42')]=_0x58e50c[_0x3487('0x3f')];_0x24a4ec[_0x3487('0x41')]=_[_0x3487('0x43')](_0x24a4ec['applications'],[_0x3487('0x44')],[_0x3487('0x45')]);if(_0x24a4ec[_0x3487('0x36')]&&_0x24a4ec[_0x3487('0x36')][_0x3487('0x46')]){_0x24a4ec[_0x3487('0x41')][_0x3487('0x47')]({'id':0x0,'priority':_0x24a4ec['applications'][_0x3487('0x48')]+0x1,'app':_0x3487('0x49'),'appdata':'autoclose','interval':_0x3487('0x4a')});}if(_0x24a4ec[_0x3487('0x36')][_0x3487('0x3b')]){delete _0x24a4ec[_0x3487('0x36')][_0x3487('0x3b')];}if(_0x24a4ec[_0x3487('0x36')][_0x3487('0x3f')]){delete _0x24a4ec[_0x3487('0x36')][_0x3487('0x3f')];}if(_0x58e50c[_0x3487('0x3f')]['Contacts'][_0x3487('0x48')]){return _0x58e50c[_0x3487('0x3f')][_0x3487('0x38')][0x0];}var _0x478b67=_[_0x3487('0xa')](_0xc2e2ab[_0x3487('0x2d')],{'firstName':_0xc2e2ab['body'][_0x3487('0x2e')],'ListId':_0x58e50c[_0x3487('0x4b')]});_0x478b67[_0xc2e2ab['body']['mapKey']]=_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x2e')];return db[_0x3487('0x2a')][_0x3487('0x4c')](_0x478b67);}else{throw new Error(_0x3487('0x4d'));}})[_0x3487('0x22')](function(_0x4fac20){_0x24a4ec['contact']=_0x4fac20;if(_0x4fac20){if(!_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')]['messageId']){_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x4e')]=rs['generate']()+'\x20'+_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')]['from'];}var _0x504fac={'ContactId':_0x4fac20['id'],'MailAccountId':_0xc2e2ab[_0x3487('0x36')]['id'],'inReplyTo':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x4e')],'to':_0xc2e2ab['body'][_0x3487('0x15')][_0x3487('0x2e')],'cc':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')]['cc'],'subject':_0xc2e2ab['body']['message'][_0x3487('0x4f')],'attach':_0xc2e2ab['body'][_0x3487('0x15')][_0x3487('0x50')],'lastMsgAt':moment()[_0x3487('0x51')](_0x3487('0x52')),'lastMsgDirection':'in'};return db[_0x3487('0x53')][_0x3487('0x35')]({'where':{'closed':![],'MailAccountId':_0xc2e2ab[_0x3487('0x36')]['id']},'include':[{'model':db[_0x3487('0x54')],'as':_0x3487('0x55'),'attributes':[_0x3487('0x4e')],'where':{'messageId':_0xc2e2ab[_0x3487('0x2d')]['message'][_0x3487('0x56')]}}]})[_0x3487('0x22')](function(_0x57b0e4){if(_0x57b0e4){return[_0x57b0e4,![]];}return db[_0x3487('0x53')]['create'](_0x504fac)['then'](function(_0x2e724d){return[_0x2e724d,!![]];});});}else{throw new Error(_0x3487('0x57'));}})[_0x3487('0x58')](function(_0x177fc0,_0x3d47c3){if(_0x177fc0){_0x51b69c=_0x3d47c3;if(!_0x3d47c3){return _0x177fc0[_0x3487('0x59')]({'inReplyTo':_0xc2e2ab[_0x3487('0x2d')]['message'][_0x3487('0x4e')],'to':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x2e')],'cc':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')]['cc'],'subject':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x4f')],'attach':_0x177fc0[_0x3487('0x50')]?_0x177fc0['attach']:_0xc2e2ab['body'][_0x3487('0x15')]['attach'],'substatus':null,'substatusAt':moment()[_0x3487('0x51')](_0x3487('0x52')),'lastMsgAt':moment()[_0x3487('0x51')](_0x3487('0x52')),'lastMsgDirection':'in'});}else{return _0x177fc0;}}})['then'](function(_0x17ac4a){_0x24a4ec[_0x3487('0x5a')]=_0x17ac4a[_0x3487('0x40')]({'plain':!![]});_0x24a4ec[_0x3487('0x5a')][_0x3487('0x5b')]=_0x51b69c;return db[_0x3487('0x54')]['create']({'body':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x2d')],'MailAccountId':_0xc2e2ab['account']['id'],'MailInteractionId':_0x17ac4a['id'],'direction':'in','ContactId':_0x24a4ec[_0x3487('0x5c')]['id'],'messageId':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x4e')],'from':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x2e')],'to':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')]['to'],'cc':_0xc2e2ab[_0x3487('0x2d')]['message']['cc'],'subject':_0xc2e2ab[_0x3487('0x2d')]['message']['subject'],'attach':_0xc2e2ab[_0x3487('0x2d')]['message'][_0x3487('0x50')],'Attachments':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')]['attachments'],'originTo':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x5d')],'originCc':_0xc2e2ab['body'][_0x3487('0x15')][_0x3487('0x5e')],'bcc':_0xc2e2ab[_0x3487('0x2d')]['message']['bcc'],'ChatWebsiteId':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x5f')]||null,'originChannel':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x60')]||_0x3487('0x61'),'ChatOfflineMessageId':_0xc2e2ab[_0x3487('0x2d')][_0x3487('0x15')][_0x3487('0x62')]||null},{'include':[{'model':db[_0x3487('0x63')],'as':_0x3487('0x64')}]});})[_0x3487('0x22')](function(_0x3d26eb){_0x24a4ec[_0x3487('0x15')]=_0x3d26eb;if(!_0x24a4ec[_0x3487('0x5a')][_0x3487('0x65')]){return;}return db[_0x3487('0x66')][_0x3487('0x35')]({'attributes':['id','name'],'where':{'id':_0x24a4ec[_0x3487('0x5a')][_0x3487('0x65')]}});})[_0x3487('0x22')](function(_0x9bbb2e){if(_0x9bbb2e){_0x24a4ec[_0x3487('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x9bbb2e[_0x3487('0x67')]+','+(_0x24a4ec[_0x3487('0x36')][_0x3487('0x68')]||0xa),'interval':_0x3487('0x4a')});}if(!_0x24a4ec[_0x3487('0x5a')][_0x3487('0x69')]){return;}return db[_0x3487('0x6a')]['find']({'attributes':['id',_0x3487('0x67')],'where':{'id':_0x24a4ec['interaction']['queueId']}});})[_0x3487('0x22')](function(_0x20ba2b){if(_0x20ba2b){_0x24a4ec[_0x3487('0x41')][_0x3487('0x6b')]({'id':0x0,'priority':0x1,'app':_0x3487('0x6c'),'appdata':_0x20ba2b[_0x3487('0x67')]+','+(_0x24a4ec[_0x3487('0x36')][_0x3487('0x6d')]||0x12c),'interval':_0x3487('0x4a')});}return respondWithRpcPromise(_0x3487('0x6e'),_0x3487('0x6f'),_0x24a4ec);})[_0x3487('0x22')](function(_0xd45305){_0x565cb2(_0xd45305);})[_0x3487('0x18')](function(_0x178b4f){_0x5c4f06(_0x3cb013['error'](0x1f4,_0x178b4f[_0x3487('0x15')]));});});}; \ No newline at end of file +var _0x4006=['MailInteraction','update','format','interaction','created','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','waitForTheAssignedAgent','queueId','queue','*,*,*,*','Start','startRouting','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','redis','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','MailAccount','findAll','options','raw','where','include','map','model','attributes','GetMailAccount','ShowMailAccount','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','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','find','account','CmList','List','Contacts','DESC','Applications','MailServerOut','Smtp','CloudProvider','get','omit','smtpOptions','list','applications','orderBy','priority','autoclose','push','length','defaults','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo'];(function(_0x539665,_0x2e21eb){var _0xd709b5=function(_0x2f7583){while(--_0x2f7583){_0x539665['push'](_0x539665['shift']());}};_0xd709b5(++_0x2e21eb);}(_0x4006,0x1c7));var _0x6400=function(_0x544d17,_0x2672ea){_0x544d17=_0x544d17-0x0;var _0x5e5fcc=_0x4006[_0x544d17];return _0x5e5fcc;};'use strict';var _=require('lodash');var moment=require(_0x6400('0x0'));var BPromise=require(_0x6400('0x1'));var rs=require(_0x6400('0x2'));var Redis=require(_0x6400('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x6400('0x4'));var config=require('../../config/environment');var jayson=require(_0x6400('0x5'));var client=jayson['client']['http']({'port':0x232c});config[_0x6400('0x6')]=_['defaults'](config[_0x6400('0x6')],{'host':_0x6400('0x7'),'port':0x18eb});var socket=require(_0x6400('0x8'))(new Redis(config[_0x6400('0x6')]));require('./mailAccount.socket')[_0x6400('0x9')](socket);function respondWithRpcPromise(_0x46819e,_0x31a8d0,_0x356982){return new BPromise(function(_0x3b124f,_0x1c59d0){return client[_0x6400('0xa')](_0x46819e,_0x356982)[_0x6400('0xb')](function(_0x237e22){logger[_0x6400('0xc')](_0x6400('0xd'),_0x31a8d0,'request\x20sent');logger[_0x6400('0xe')](_0x6400('0xf'),_0x31a8d0,_0x6400('0x10'),JSON[_0x6400('0x11')](_0x237e22));if(_0x237e22['error']){if(_0x237e22[_0x6400('0x12')][_0x6400('0x13')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x31a8d0,_0x237e22['error'][_0x6400('0x14')]);return _0x1c59d0(_0x237e22[_0x6400('0x12')]['message']);}logger[_0x6400('0x12')]('MailAccount,\x20%s,\x20%s',_0x31a8d0,_0x237e22[_0x6400('0x12')]['message']);return _0x3b124f(_0x237e22[_0x6400('0x12')][_0x6400('0x14')]);}else{logger[_0x6400('0xc')](_0x6400('0xd'),_0x31a8d0,'request\x20sent');_0x3b124f(_0x237e22[_0x6400('0x15')][_0x6400('0x14')]);}})[_0x6400('0x16')](function(_0x50524f){logger[_0x6400('0x12')](_0x6400('0xd'),_0x31a8d0,_0x50524f);_0x1c59d0(_0x50524f);});});}exports['GetMailAccount']=function(_0x36a8f5){var _0x32a8d8=this;return new Promise(function(_0xb4d0ca,_0x5d8ddb){return db[_0x6400('0x17')][_0x6400('0x18')]({'raw':_0x36a8f5[_0x6400('0x19')]?_0x36a8f5[_0x6400('0x19')][_0x6400('0x1a')]===undefined?!![]:![]:!![],'where':_0x36a8f5[_0x6400('0x19')]?_0x36a8f5[_0x6400('0x19')][_0x6400('0x1b')]||null:null,'attributes':_0x36a8f5[_0x6400('0x19')]?_0x36a8f5[_0x6400('0x19')]['attributes']||null:null,'limit':_0x36a8f5[_0x6400('0x19')]?_0x36a8f5['options']['limit']||null:null,'include':_0x36a8f5[_0x6400('0x19')]?_0x36a8f5[_0x6400('0x19')][_0x6400('0x1c')]?_[_0x6400('0x1d')](_0x36a8f5['options'][_0x6400('0x1c')],function(_0x56d9e6){return{'model':db[_0x56d9e6[_0x6400('0x1e')]],'as':_0x56d9e6['as'],'attributes':_0x56d9e6['attributes'],'include':_0x56d9e6[_0x6400('0x1c')]?_[_0x6400('0x1d')](_0x56d9e6['include'],function(_0x434550){return{'model':db[_0x434550[_0x6400('0x1e')]],'as':_0x434550['as'],'attributes':_0x434550[_0x6400('0x1f')],'include':_0x434550['include']?_[_0x6400('0x1d')](_0x434550['include'],function(_0x5f06ae){return{'model':db[_0x5f06ae[_0x6400('0x1e')]],'as':_0x5f06ae['as'],'attributes':_0x5f06ae['attributes']};}):[]};}):[]};}):[]:[]})[_0x6400('0xb')](function(_0x197b9d){logger['info'](_0x6400('0x20'),_0x36a8f5);logger['debug']('GetMailAccount',_0x36a8f5,JSON[_0x6400('0x11')](_0x197b9d));_0xb4d0ca(_0x197b9d);})[_0x6400('0x16')](function(_0x10005a){logger[_0x6400('0x12')](_0x6400('0x20'),_0x10005a['message'],_0x36a8f5);_0x5d8ddb(_0x32a8d8[_0x6400('0x12')](0x1f4,_0x10005a[_0x6400('0x14')]));});});};exports[_0x6400('0x21')]=function(_0x1f66c3){var _0x57c3fb=this;return new Promise(function(_0x437624,_0x356f4d){return db[_0x6400('0x17')]['find']({'raw':_0x1f66c3[_0x6400('0x19')]?_0x1f66c3[_0x6400('0x19')][_0x6400('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f66c3[_0x6400('0x19')]?_0x1f66c3['options'][_0x6400('0x1b')]||null:null,'attributes':_0x1f66c3[_0x6400('0x19')]?_0x1f66c3['options'][_0x6400('0x1f')]||null:null,'include':_0x1f66c3[_0x6400('0x19')]?_0x1f66c3['options']['include']?_[_0x6400('0x1d')](_0x1f66c3[_0x6400('0x19')][_0x6400('0x1c')],function(_0x5286a0){return{'model':db[_0x5286a0['model']],'as':_0x5286a0['as'],'attributes':_0x5286a0['attributes'],'include':_0x5286a0[_0x6400('0x1c')]?_[_0x6400('0x1d')](_0x5286a0[_0x6400('0x1c')],function(_0x1a9e17){return{'model':db[_0x1a9e17[_0x6400('0x1e')]],'as':_0x1a9e17['as'],'attributes':_0x1a9e17['attributes'],'include':_0x1a9e17[_0x6400('0x1c')]?_[_0x6400('0x1d')](_0x1a9e17['include'],function(_0x51425c){return{'model':db[_0x51425c[_0x6400('0x1e')]],'as':_0x51425c['as'],'attributes':_0x51425c[_0x6400('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6400('0xb')](function(_0x51a7c0){if(_0x1f66c3[_0x6400('0x19')][_0x6400('0x22')]===!![])_0x51a7c0[_0x6400('0x23')]('smtpOptions',_0x51a7c0[_0x6400('0x24')]());logger[_0x6400('0xc')](_0x6400('0x21'),_0x1f66c3);logger['debug']('ShowMailAccount',_0x1f66c3,JSON['stringify'](_0x51a7c0));_0x437624(_0x51a7c0);})[_0x6400('0x16')](function(_0x5c4845){logger['error'](_0x6400('0x21'),_0x5c4845[_0x6400('0x14')],_0x1f66c3);_0x356f4d(_0x57c3fb['error'](0x1f4,_0x5c4845[_0x6400('0x14')]));});});};exports[_0x6400('0x25')]=function(_0x43b7bb){var _0x51ee86=this;return new Promise(function(_0x9536e5,_0x443ff0){var _0x5f27cd={'body':_0x43b7bb[_0x6400('0x26')],'channel':'mail'};var _0x51a9e8=_[_0x6400('0x27')](_[_0x6400('0x28')](db[_0x6400('0x29')]['rawAttributes']),[_0x6400('0x2a'),_0x6400('0x2b'),_0x6400('0x2c'),_0x6400('0x2d')]);var _0x3069f0=![];if(_0x43b7bb['body']['id']){delete _0x43b7bb[_0x6400('0x26')]['id'];}if(_['isNil'](_0x43b7bb[_0x6400('0x26')][_0x6400('0x2e')])){return _0x443ff0(_0x51ee86[_0x6400('0x12')](0x1f4,_0x6400('0x2f')));}if(_['isNil'](_0x43b7bb[_0x6400('0x26')][_0x6400('0x26')])||_0x43b7bb[_0x6400('0x26')][_0x6400('0x26')]===''){return _0x443ff0(_0x51ee86['error'](0x1f4,_0x6400('0x30')));}if(_['isNil'](_0x43b7bb[_0x6400('0x26')]['mapKey'])){return _0x443ff0(_0x51ee86[_0x6400('0x12')](0x1f4,_0x6400('0x31')+_0x51a9e8));}if(!_[_0x6400('0x32')](_0x51a9e8,_0x43b7bb['body'][_0x6400('0x33')])){return _0x443ff0(_0x51ee86['error'](0x1f4,_0x6400('0x34')+_0x51a9e8));}var _0x146358={};_0x146358[_0x43b7bb[_0x6400('0x26')][_0x6400('0x33')]]=_0x43b7bb[_0x6400('0x26')][_0x6400('0x2e')];return db[_0x6400('0x17')][_0x6400('0x35')]({'where':{'id':_0x43b7bb[_0x6400('0x36')]['id']},'include':[{'model':db[_0x6400('0x37')],'as':_0x6400('0x38'),'include':[{'model':db['CmContact'],'as':_0x6400('0x39'),'where':_0x146358,'limit':0x1,'order':[[_0x6400('0x2b'),_0x6400('0x3a')]]}]},{'model':db['MailApplication'],'as':_0x6400('0x3b')},{'model':db[_0x6400('0x3c')],'as':_0x6400('0x3d'),'include':[{'model':db['CloudProvider'],'as':_0x6400('0x3e')}]}]})['then'](function(_0x518ee4){if(_0x518ee4&&_0x518ee4['List']){var _0x32c3d0=_0x518ee4[_0x6400('0x3f')]({'plain':!![]});_0x5f27cd['account']=_[_0x6400('0x40')](_0x32c3d0,[_0x6400('0x3b'),'List']);_0x5f27cd['account'][_0x6400('0x41')]=_0x518ee4[_0x6400('0x24')]();_0x5f27cd['applications']=_0x32c3d0[_0x6400('0x3b')];_0x5f27cd[_0x6400('0x42')]=_0x32c3d0[_0x6400('0x38')];_0x5f27cd[_0x6400('0x43')]=_[_0x6400('0x44')](_0x5f27cd[_0x6400('0x43')],[_0x6400('0x45')],['asc']);if(_0x5f27cd[_0x6400('0x36')]&&_0x5f27cd[_0x6400('0x36')][_0x6400('0x46')]){_0x5f27cd[_0x6400('0x43')][_0x6400('0x47')]({'id':0x0,'priority':_0x5f27cd[_0x6400('0x43')][_0x6400('0x48')]+0x1,'app':'close','appdata':_0x6400('0x46'),'interval':'*,*,*,*'});}if(_0x5f27cd['account'][_0x6400('0x3b')]){delete _0x5f27cd[_0x6400('0x36')][_0x6400('0x3b')];}if(_0x5f27cd['account'][_0x6400('0x38')]){delete _0x5f27cd[_0x6400('0x36')][_0x6400('0x38')];}if(_0x32c3d0[_0x6400('0x38')][_0x6400('0x39')]['length']){return _0x32c3d0[_0x6400('0x38')][_0x6400('0x39')][0x0];}var _0x55e49c=_[_0x6400('0x49')](_0x43b7bb[_0x6400('0x26')],{'firstName':_0x43b7bb[_0x6400('0x26')]['from'],'ListId':_0x32c3d0[_0x6400('0x2d')]});_0x55e49c[_0x43b7bb['body'][_0x6400('0x33')]]=_0x43b7bb[_0x6400('0x26')][_0x6400('0x2e')];return db[_0x6400('0x29')][_0x6400('0x4a')](_0x55e49c);}else{throw new Error(_0x6400('0x4b'));}})['then'](function(_0x1ce65e){_0x5f27cd[_0x6400('0x4c')]=_0x1ce65e;if(_0x1ce65e){if(!_0x43b7bb['body'][_0x6400('0x14')][_0x6400('0x4d')]){_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')]['messageId']=rs[_0x6400('0x4e')]()+'\x20'+_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x2e')];}var _0x38abb3={'ContactId':_0x1ce65e['id'],'MailAccountId':_0x43b7bb[_0x6400('0x36')]['id'],'inReplyTo':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x4d')],'to':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x2e')],'cc':_0x43b7bb['body'][_0x6400('0x14')]['cc'],'subject':_0x43b7bb[_0x6400('0x26')]['message'][_0x6400('0x4f')],'attach':_0x43b7bb['body'][_0x6400('0x14')][_0x6400('0x50')],'lastMsgAt':moment()['format'](_0x6400('0x51')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x6400('0x35')]({'where':{'closed':![],'MailAccountId':_0x43b7bb['account']['id']},'include':[{'model':db[_0x6400('0x52')],'as':_0x6400('0x53'),'attributes':[_0x6400('0x4d')],'where':{'messageId':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x54')]}}]})['then'](function(_0x53215e){if(_0x53215e){return[_0x53215e,![]];}return db[_0x6400('0x55')][_0x6400('0x4a')](_0x38abb3)['then'](function(_0x10d6a8){return[_0x10d6a8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x4379cf,_0x391c23){if(_0x4379cf){_0x3069f0=_0x391c23;if(!_0x391c23){return _0x4379cf[_0x6400('0x56')]({'inReplyTo':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x4d')],'to':_0x43b7bb[_0x6400('0x26')]['message'][_0x6400('0x2e')],'cc':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')]['cc'],'subject':_0x43b7bb['body']['message'][_0x6400('0x4f')],'attach':_0x4379cf[_0x6400('0x50')]?_0x4379cf[_0x6400('0x50')]:_0x43b7bb['body'][_0x6400('0x14')]['attach'],'substatus':null,'substatusAt':moment()[_0x6400('0x57')](_0x6400('0x51')),'lastMsgAt':moment()['format'](_0x6400('0x51')),'lastMsgDirection':'in'});}else{return _0x4379cf;}}})[_0x6400('0xb')](function(_0x2c3e81){_0x5f27cd[_0x6400('0x58')]=_0x2c3e81[_0x6400('0x3f')]({'plain':!![]});_0x5f27cd[_0x6400('0x58')][_0x6400('0x59')]=_0x3069f0;return db['MailMessage'][_0x6400('0x4a')]({'body':_0x43b7bb[_0x6400('0x26')][_0x6400('0x26')],'MailAccountId':_0x43b7bb[_0x6400('0x36')]['id'],'MailInteractionId':_0x2c3e81['id'],'direction':'in','ContactId':_0x5f27cd[_0x6400('0x4c')]['id'],'messageId':_0x43b7bb[_0x6400('0x26')]['message'][_0x6400('0x4d')],'from':_0x43b7bb[_0x6400('0x26')]['message']['from'],'to':_0x43b7bb['body']['message']['to'],'cc':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')]['cc'],'subject':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')]['subject'],'attach':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x50')],'Attachments':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x5a')],'originTo':_0x43b7bb['body'][_0x6400('0x14')][_0x6400('0x5b')],'originCc':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x5c')],'bcc':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')]['bcc'],'ChatWebsiteId':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x5d')]||null,'originChannel':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x5e')]||_0x6400('0x5f'),'ChatOfflineMessageId':_0x43b7bb[_0x6400('0x26')][_0x6400('0x14')][_0x6400('0x60')]||null},{'include':[{'model':db[_0x6400('0x61')],'as':'Attachments'}]});})['then'](function(_0x471b2b){_0x5f27cd['message']=_0x471b2b;if(!_0x5f27cd['interaction'][_0x6400('0x62')]){return;}return db[_0x6400('0x63')][_0x6400('0x35')]({'attributes':['id',_0x6400('0x64')],'where':{'id':_0x5f27cd['interaction'][_0x6400('0x62')]}});})['then'](function(_0x11d006){if(_0x11d006){_0x5f27cd[_0x6400('0x43')][_0x6400('0x65')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x11d006[_0x6400('0x64')]+','+(_0x5f27cd[_0x6400('0x36')][_0x6400('0x66')]||0xa),'interval':'*,*,*,*'});}if(!_0x5f27cd[_0x6400('0x58')][_0x6400('0x67')]){return;}return db['MailQueue'][_0x6400('0x35')]({'attributes':['id',_0x6400('0x64')],'where':{'id':_0x5f27cd[_0x6400('0x58')][_0x6400('0x67')]}});})['then'](function(_0x5cefda){if(_0x5cefda){_0x5f27cd['applications'][_0x6400('0x65')]({'id':0x0,'priority':0x1,'app':_0x6400('0x68'),'appdata':_0x5cefda[_0x6400('0x64')]+','+(_0x5f27cd[_0x6400('0x36')]['waitForTheAssignedQueue']||0x12c),'interval':_0x6400('0x69')});}return respondWithRpcPromise(_0x6400('0x6a'),_0x6400('0x6b'),_0x5f27cd);})[_0x6400('0xb')](function(_0x43c2c6){_0x9536e5(_0x43c2c6);})['catch'](function(_0x486026){_0x443ff0(_0x51ee86[_0x6400('0x12')](0x1f4,_0x486026['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 6515d5b..983c538 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 _0xf3b1=['mailAccount:','./mailAccount.events','save','update','emit','removeListener','register','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf3b1,0x1b1));var _0x1f3b=function(_0x2c9562,_0x22f6b8){_0x2c9562=_0x2c9562-0x0;var _0x5ab4b2=_0xf3b1[_0x2c9562];return _0x5ab4b2;};'use strict';var MailAccountEvents=require(_0x1f3b('0x0'));var events=[_0x1f3b('0x1'),'remove',_0x1f3b('0x2')];function createListener(_0x29014c,_0x5afc43){return function(_0x2fa04d){_0x5afc43[_0x1f3b('0x3')](_0x29014c,_0x2fa04d);};}function removeListener(_0x46e5c2,_0x4c7e73){return function(){MailAccountEvents[_0x1f3b('0x4')](_0x46e5c2,_0x4c7e73);};}exports[_0x1f3b('0x5')]=function(_0x4931b5){for(var _0x43f36e=0x0,_0x4c4818=events[_0x1f3b('0x6')];_0x43f36e<_0x4c4818;_0x43f36e++){var _0x5cd312=events[_0x43f36e];var _0x8b1296=createListener(_0x1f3b('0x7')+_0x5cd312,_0x4931b5);MailAccountEvents['on'](_0x5cd312,_0x8b1296);}}; \ No newline at end of file +var _0xcfa3=['register','length','mailAccount:','save','update','emit','removeListener'];(function(_0x1c880c,_0x5b65f5){var _0x49150e=function(_0x228d3b){while(--_0x228d3b){_0x1c880c['push'](_0x1c880c['shift']());}};_0x49150e(++_0x5b65f5);}(_0xcfa3,0x88));var _0x3cfa=function(_0x545cc9,_0x8120c4){_0x545cc9=_0x545cc9-0x0;var _0x2673a0=_0xcfa3[_0x545cc9];return _0x2673a0;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x3cfa('0x0'),'remove',_0x3cfa('0x1')];function createListener(_0x241ff2,_0x59346b){return function(_0x37880c){_0x59346b[_0x3cfa('0x2')](_0x241ff2,_0x37880c);};}function removeListener(_0xb7434a,_0x156845){return function(){MailAccountEvents[_0x3cfa('0x3')](_0xb7434a,_0x156845);};}exports[_0x3cfa('0x4')]=function(_0x3adb1e){for(var _0x454773=0x0,_0x568844=events[_0x3cfa('0x5')];_0x454773<_0x568844;_0x454773++){var _0x3a7790=events[_0x454773];var _0x4e1eef=createListener(_0x3cfa('0x6')+_0x3a7790,_0x3adb1e);MailAccountEvents['on'](_0x3a7790,_0x4e1eef);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 2c54d87..8f34831 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 _0x858a=['show','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x3a9fcf,_0x52c5a3){var _0x1ecfb8=function(_0x2f23b7){while(--_0x2f23b7){_0x3a9fcf['push'](_0x3a9fcf['shift']());}};_0x1ecfb8(++_0x52c5a3);}(_0x858a,0x83));var _0xa858=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x858a[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0xa858('0x0'));var util=require(_0xa858('0x1'));var path=require(_0xa858('0x2'));var timeout=require(_0xa858('0x3'));var express=require(_0xa858('0x4'));var router=express[_0xa858('0x5')]();var fs_extra=require(_0xa858('0x6'));var auth=require(_0xa858('0x7'));var interaction=require(_0xa858('0x8'));var config=require(_0xa858('0x9'));var controller=require('./mailApplication.controller');router[_0xa858('0xa')](_0xa858('0xb'),auth[_0xa858('0xc')](),controller[_0xa858('0xd')]);router[_0xa858('0xe')](_0xa858('0xb'),auth[_0xa858('0xc')](),controller[_0xa858('0xf')]);router[_0xa858('0x10')]('/:id',auth[_0xa858('0xc')](),controller['destroy']);module[_0xa858('0x11')]=router; \ No newline at end of file +var _0xe49a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','isAuthenticated','show','put','/:id','delete','destroy','exports','path','connect-timeout'];(function(_0x47ba5f,_0x2c0e07){var _0x1b18d9=function(_0x16fe9b){while(--_0x16fe9b){_0x47ba5f['push'](_0x47ba5f['shift']());}};_0x1b18d9(++_0x2c0e07);}(_0xe49a,0xa3));var _0xae49=function(_0x4cd9b6,_0x26e28){_0x4cd9b6=_0x4cd9b6-0x0;var _0x1304b2=_0xe49a[_0x4cd9b6];return _0x1304b2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xae49('0x0'));var timeout=require(_0xae49('0x1'));var express=require('express');var router=express[_0xae49('0x2')]();var fs_extra=require(_0xae49('0x3'));var auth=require(_0xae49('0x4'));var interaction=require(_0xae49('0x5'));var config=require(_0xae49('0x6'));var controller=require(_0xae49('0x7'));router['get']('/:id',auth[_0xae49('0x8')](),controller[_0xae49('0x9')]);router[_0xae49('0xa')](_0xae49('0xb'),auth[_0xae49('0x8')](),controller['update']);router[_0xae49('0xc')](_0xae49('0xb'),auth[_0xae49('0x8')](),controller[_0xae49('0xd')]);module[_0xae49('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 9a9e393..f98f49b 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 _0xfcd8=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x27b735,_0x302127){var _0x22b41b=function(_0x146220){while(--_0x146220){_0x27b735['push'](_0x27b735['shift']());}};_0x22b41b(++_0x302127);}(_0xfcd8,0x64));var _0x8fcd=function(_0x51bad8,_0x9f0aa8){_0x51bad8=_0x51bad8-0x0;var _0x1c9544=_0xfcd8[_0x51bad8];return _0x1c9544;};'use strict';var Sequelize=require(_0x8fcd('0x0'));module[_0x8fcd('0x1')]={'priority':{'type':Sequelize[_0x8fcd('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8fcd('0x3')},'appdata':{'type':Sequelize[_0x8fcd('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8fcd('0x5')],'defaultValue':_0x8fcd('0x6')}}; \ No newline at end of file +var _0x4147=['INTEGER','STRING','TEXT','sequelize','exports'];(function(_0x83b7b9,_0x554605){var _0x5057a2=function(_0x2a2f61){while(--_0x2a2f61){_0x83b7b9['push'](_0x83b7b9['shift']());}};_0x5057a2(++_0x554605);}(_0x4147,0x1a7));var _0x7414=function(_0x5dbf38,_0x1ff06d){_0x5dbf38=_0x5dbf38-0x0;var _0x4ea452=_0x4147[_0x5dbf38];return _0x4ea452;};'use strict';var Sequelize=require(_0x7414('0x0'));module[_0x7414('0x1')]={'priority':{'type':Sequelize[_0x7414('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7414('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7414('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7414('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 770301f..c6a82ab 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 _0xa9e0=['includeAll','merge','options','find','catch','body','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','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x1f17d7,_0x22ee6c){var _0x253670=function(_0x4100c7){while(--_0x4100c7){_0x1f17d7['push'](_0x1f17d7['shift']());}};_0x253670(++_0x22ee6c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file +var _0xda3f=['includeAll','include','merge','find','catch','body','MailApplication','destroy','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','params','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x358474,_0x2ae44d){var _0x5afe34=function(_0x240ecc){while(--_0x240ecc){_0x358474['push'](_0x358474['shift']());}};_0x5afe34(++_0x2ae44d);}(_0xda3f,0xec));var _0xfda3=function(_0x58aa3b,_0x3c9cae){_0x58aa3b=_0x58aa3b-0x0;var _0x1d9a9b=_0xda3f[_0x58aa3b];return _0x1d9a9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['show']=function(_0x3c1549,_0x4101b1){var _0x301509={'raw':!![],'where':{'id':_0x3c1549[_0xfda3('0x28')]['id']}},_0x474992={};_0x474992[_0xfda3('0x29')]=_[_0xfda3('0x2a')](db['MailApplication']['rawAttributes']);_0x474992[_0xfda3('0x2b')]=_['keys'](_0x3c1549['query']);_0x474992[_0xfda3('0x2c')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2e')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],qs[_0xfda3('0x2f')](_0x3c1549[_0xfda3('0x2b')]['fields']));_0x301509[_0xfda3('0x2e')]=_0x301509[_0xfda3('0x2e')][_0xfda3('0x30')]?_0x301509[_0xfda3('0x2e')]:_0x474992[_0xfda3('0x29')];if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x31')]){_0x301509[_0xfda3('0x32')]=[{'all':!![]}];}_0x301509=_[_0xfda3('0x33')]({},_0x301509,_0x3c1549['options']);return db['MailApplication'][_0xfda3('0x34')](_0x301509)[_0xfda3('0x23')](handleEntityNotFound(_0x4101b1,null))['then'](respondWithResult(_0x4101b1,null))[_0xfda3('0x35')](handleError(_0x4101b1,null));};exports[_0xfda3('0x22')]=function(_0x28ca96,_0x52ee98){if(_0x28ca96[_0xfda3('0x36')]['id']){delete _0x28ca96[_0xfda3('0x36')]['id'];}return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x28ca96[_0xfda3('0x28')]['id']}})['then'](handleEntityNotFound(_0x52ee98,null))[_0xfda3('0x23')](saveUpdates(_0x28ca96[_0xfda3('0x36')],null))[_0xfda3('0x23')](respondWithResult(_0x52ee98,null))['catch'](handleError(_0x52ee98,null));};exports[_0xfda3('0x38')]=function(_0x4854b1,_0x2d9a3f){return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x4854b1[_0xfda3('0x28')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2d9a3f,null))[_0xfda3('0x23')](removeEntity(_0x2d9a3f,null))[_0xfda3('0x35')](handleError(_0x2d9a3f,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index c61a643..b5c6741 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 _0x901b=['mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication'];(function(_0x33b64f,_0x502c60){var _0xfc052b=function(_0x31fddd){while(--_0x31fddd){_0x33b64f['push'](_0x33b64f['shift']());}};_0xfc052b(++_0x502c60);}(_0x901b,0x117));var _0xb901=function(_0x5a2f28,_0x2844c1){_0x5a2f28=_0x5a2f28-0x0;var _0x59aede=_0x901b[_0x5a2f28];return _0x59aede;};'use strict';var _=require('lodash');var util=require(_0xb901('0x0'));var logger=require(_0xb901('0x1'))(_0xb901('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb901('0x3'));var rimraf=require(_0xb901('0x4'));var config=require(_0xb901('0x5'));var attributes=require(_0xb901('0x6'));module[_0xb901('0x7')]=function(_0x4bde14,_0xd6d331){return _0x4bde14['define'](_0xb901('0x8'),attributes,{'tableName':_0xb901('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb901('0xa'),'collate':_0xb901('0xb')});}; \ No newline at end of file +var _0xf0ae=['../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2d6d86,_0xf30668){var _0xfb9a4e=function(_0x305f5a){while(--_0x305f5a){_0x2d6d86['push'](_0x2d6d86['shift']());}};_0xfb9a4e(++_0xf30668);}(_0xf0ae,0xf8));var _0xef0a=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xf0ae[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xef0a('0x0'));var util=require(_0xef0a('0x1'));var logger=require(_0xef0a('0x2'))(_0xef0a('0x3'));var moment=require(_0xef0a('0x4'));var BPromise=require('bluebird');var rp=require(_0xef0a('0x5'));var fs=require('fs');var path=require(_0xef0a('0x6'));var rimraf=require(_0xef0a('0x7'));var config=require(_0xef0a('0x8'));var attributes=require(_0xef0a('0x9'));module[_0xef0a('0xa')]=function(_0x145f5d,_0x5dddba){return _0x145f5d[_0xef0a('0xb')](_0xef0a('0xc'),attributes,{'tableName':_0xef0a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xef0a('0xe'),'collate':_0xef0a('0xf')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index fc4fe3e..8e4048e 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 _0x30ba=['client','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailApplication','update','body','options','raw','where','attributes','then','UpdateMailApplication','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x4dd047,_0x3a355e){var _0x38d7a4=function(_0x3af089){while(--_0x3af089){_0x4dd047['push'](_0x4dd047['shift']());}};_0x38d7a4(++_0x3a355e);}(_0x30ba,0xca));var _0xa30b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30ba[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa30b('0x0'));var util=require('util');var moment=require(_0xa30b('0x1'));var BPromise=require(_0xa30b('0x2'));var rs=require(_0xa30b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa30b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa30b('0x5'));var config=require(_0xa30b('0x6'));var jayson=require(_0xa30b('0x7'));var client=jayson[_0xa30b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15511d,_0x52a48d,_0x123ddf){return new BPromise(function(_0x39f67d,_0x3a57c4){return client[_0xa30b('0x9')](_0x15511d,_0x123ddf)['then'](function(_0x19b7a0){logger[_0xa30b('0xa')](_0xa30b('0xb'),_0x52a48d,_0xa30b('0xc'));logger[_0xa30b('0xd')](_0xa30b('0xe'),_0x52a48d,_0xa30b('0xc'),JSON[_0xa30b('0xf')](_0x19b7a0));if(_0x19b7a0[_0xa30b('0x10')]){if(_0x19b7a0[_0xa30b('0x10')][_0xa30b('0x11')]===0x1f4){logger[_0xa30b('0x10')](_0xa30b('0xb'),_0x52a48d,_0x19b7a0['error']['message']);return _0x3a57c4(_0x19b7a0[_0xa30b('0x10')][_0xa30b('0x12')]);}logger['error'](_0xa30b('0xb'),_0x52a48d,_0x19b7a0[_0xa30b('0x10')]['message']);return _0x39f67d(_0x19b7a0[_0xa30b('0x10')][_0xa30b('0x12')]);}else{logger[_0xa30b('0xa')](_0xa30b('0xb'),_0x52a48d,'request\x20sent');_0x39f67d(_0x19b7a0[_0xa30b('0x13')][_0xa30b('0x12')]);}})[_0xa30b('0x14')](function(_0x129c5d){logger[_0xa30b('0x10')](_0xa30b('0xb'),_0x52a48d,_0x129c5d);_0x3a57c4(_0x129c5d);});});}exports['UpdateMailApplication']=function(_0x51d19d){var _0x79099a=this;return new Promise(function(_0x4fcced,_0x59fc46){return db[_0xa30b('0x15')][_0xa30b('0x16')](_0x51d19d[_0xa30b('0x17')],{'raw':_0x51d19d[_0xa30b('0x18')]?_0x51d19d[_0xa30b('0x18')][_0xa30b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51d19d[_0xa30b('0x18')]?_0x51d19d[_0xa30b('0x18')][_0xa30b('0x1a')]||null:null,'attributes':_0x51d19d['options']?_0x51d19d[_0xa30b('0x18')][_0xa30b('0x1b')]||null:null,'limit':_0x51d19d['options']?_0x51d19d[_0xa30b('0x18')]['limit']||null:null})[_0xa30b('0x1c')](function(_0x38f7f3){logger[_0xa30b('0xa')](_0xa30b('0x1d'),_0x51d19d);logger['debug'](_0xa30b('0x1d'),_0x51d19d,JSON[_0xa30b('0xf')](_0x38f7f3));_0x4fcced(_0x38f7f3);})[_0xa30b('0x14')](function(_0x2c0361){logger[_0xa30b('0x10')](_0xa30b('0x1d'),_0x2c0361[_0xa30b('0x12')],_0x51d19d);_0x59fc46(_0x79099a[_0xa30b('0x10')](0x1f4,_0x2c0361['message']));});});}; \ No newline at end of file +var _0x3c45=['result','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3c45,0x132));var _0x53c4=function(_0x46abcd,_0x941a15){_0x46abcd=_0x46abcd-0x0;var _0x2cd077=_0x3c45[_0x46abcd];return _0x2cd077;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x53c4('0x0'));var BPromise=require(_0x53c4('0x1'));var rs=require(_0x53c4('0x2'));var fs=require('fs');var Redis=require(_0x53c4('0x3'));var db=require(_0x53c4('0x4'))['db'];var utils=require(_0x53c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x53c4('0x6')][_0x53c4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x592ff1,_0x267336,_0x2c0f33){return new BPromise(function(_0x6a469a,_0x50130a){return client[_0x53c4('0x8')](_0x592ff1,_0x2c0f33)['then'](function(_0x3304b6){logger[_0x53c4('0x9')](_0x53c4('0xa'),_0x267336,_0x53c4('0xb'));logger[_0x53c4('0xc')](_0x53c4('0xd'),_0x267336,'request\x20sent',JSON[_0x53c4('0xe')](_0x3304b6));if(_0x3304b6[_0x53c4('0xf')]){if(_0x3304b6[_0x53c4('0xf')][_0x53c4('0x10')]===0x1f4){logger[_0x53c4('0xf')]('MailApplication,\x20%s,\x20%s',_0x267336,_0x3304b6['error'][_0x53c4('0x11')]);return _0x50130a(_0x3304b6[_0x53c4('0xf')][_0x53c4('0x11')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x267336,_0x3304b6['error'][_0x53c4('0x11')]);return _0x6a469a(_0x3304b6[_0x53c4('0xf')]['message']);}else{logger[_0x53c4('0x9')](_0x53c4('0xa'),_0x267336,_0x53c4('0xb'));_0x6a469a(_0x3304b6[_0x53c4('0x12')][_0x53c4('0x11')]);}})['catch'](function(_0x29f966){logger[_0x53c4('0xf')]('MailApplication,\x20%s,\x20%s',_0x267336,_0x29f966);_0x50130a(_0x29f966);});});}exports[_0x53c4('0x13')]=function(_0x2dac49){var _0xab7f9c=this;return new Promise(function(_0xc763d,_0x372cf9){return db[_0x53c4('0x14')]['update'](_0x2dac49[_0x53c4('0x15')],{'raw':_0x2dac49[_0x53c4('0x16')]?_0x2dac49[_0x53c4('0x16')][_0x53c4('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dac49[_0x53c4('0x16')]?_0x2dac49[_0x53c4('0x16')][_0x53c4('0x18')]||null:null,'attributes':_0x2dac49[_0x53c4('0x16')]?_0x2dac49[_0x53c4('0x16')][_0x53c4('0x19')]||null:null,'limit':_0x2dac49[_0x53c4('0x16')]?_0x2dac49['options']['limit']||null:null})[_0x53c4('0x1a')](function(_0x1c05a7){logger[_0x53c4('0x9')](_0x53c4('0x13'),_0x2dac49);logger[_0x53c4('0xc')](_0x53c4('0x13'),_0x2dac49,JSON['stringify'](_0x1c05a7));_0xc763d(_0x1c05a7);})['catch'](function(_0x258cb0){logger[_0x53c4('0xf')](_0x53c4('0x13'),_0x258cb0[_0x53c4('0x11')],_0x2dac49);_0x372cf9(_0xab7f9c[_0x53c4('0xf')](0x1f4,_0x258cb0[_0x53c4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index fa03a0f..c9a98f2 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 _0x56bd=['update','delete','tracked','mailinteraction:destroy','destroy','removeTags','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put'];(function(_0x53dfa3,_0x1d4132){var _0x44dd97=function(_0x4d08fd){while(--_0x4d08fd){_0x53dfa3['push'](_0x53dfa3['shift']());}};_0x44dd97(++_0x1d4132);}(_0x56bd,0x1f3));var _0xd56b=function(_0x1df3ea,_0x421b66){_0x1df3ea=_0x1df3ea-0x0;var _0x2f1d1c=_0x56bd[_0x1df3ea];return _0x2f1d1c;};'use strict';var express=require(_0xd56b('0x0'));var router=express[_0xd56b('0x1')]();var auth=require(_0xd56b('0x2'));var interaction=require(_0xd56b('0x3'));var controller=require(_0xd56b('0x4'));router['get']('/',auth[_0xd56b('0x5')](),controller[_0xd56b('0x6')]);router[_0xd56b('0x7')](_0xd56b('0x8'),auth['isAuthenticated'](),controller[_0xd56b('0x9')]);router[_0xd56b('0x7')](_0xd56b('0xa'),auth[_0xd56b('0x5')](),controller[_0xd56b('0xb')]);router[_0xd56b('0x7')](_0xd56b('0xc'),auth[_0xd56b('0x5')](),controller[_0xd56b('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xd56b('0xe')]);router[_0xd56b('0xf')]('/',auth[_0xd56b('0x5')](),controller[_0xd56b('0x10')]);router['post'](_0xd56b('0xc'),auth[_0xd56b('0x5')](),controller[_0xd56b('0x11')]);router[_0xd56b('0xf')](_0xd56b('0x12'),auth[_0xd56b('0x5')](),interaction['tracked'](_0xd56b('0x13'),_0xd56b('0x14')),controller[_0xd56b('0x15')]);router[_0xd56b('0x16')](_0xd56b('0xa'),auth[_0xd56b('0x5')](),interaction['tracked'](_0xd56b('0x13'),'mailinteraction:update'),controller[_0xd56b('0x17')]);router[_0xd56b('0x18')](_0xd56b('0xa'),auth[_0xd56b('0x5')](),interaction[_0xd56b('0x19')]('mail',_0xd56b('0x1a')),controller[_0xd56b('0x1b')]);router[_0xd56b('0x18')]('/:id/tags',auth[_0xd56b('0x5')](),controller[_0xd56b('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xb45c=['mail','mailinteraction:update','update','delete','tracked','/:id/tags','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','show','/:id/messages','/:id/download','download','post','addMessage','mailinteraction:addtags','addTags','put','/:id'];(function(_0xd8a8af,_0x1e93f0){var _0x5b7278=function(_0x458800){while(--_0x458800){_0xd8a8af['push'](_0xd8a8af['shift']());}};_0x5b7278(++_0x1e93f0);}(_0xb45c,0xfb));var _0xcb45=function(_0x261583,_0x7796bd){_0x261583=_0x261583-0x0;var _0x14db13=_0xb45c[_0x261583];return _0x14db13;};'use strict';var express=require('express');var router=express[_0xcb45('0x0')]();var auth=require(_0xcb45('0x1'));var interaction=require(_0xcb45('0x2'));var controller=require(_0xcb45('0x3'));router['get']('/',auth[_0xcb45('0x4')](),controller[_0xcb45('0x5')]);router[_0xcb45('0x6')](_0xcb45('0x7'),auth[_0xcb45('0x4')](),controller[_0xcb45('0x8')]);router[_0xcb45('0x6')]('/:id',auth[_0xcb45('0x4')](),controller[_0xcb45('0x9')]);router['get'](_0xcb45('0xa'),auth[_0xcb45('0x4')](),controller['getMessages']);router[_0xcb45('0x6')](_0xcb45('0xb'),auth['isAuthenticated'](),controller[_0xcb45('0xc')]);router[_0xcb45('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcb45('0xd')]('/:id/messages',auth[_0xcb45('0x4')](),controller[_0xcb45('0xe')]);router[_0xcb45('0xd')]('/:id/tags',auth[_0xcb45('0x4')](),interaction['tracked']('mail',_0xcb45('0xf')),controller[_0xcb45('0x10')]);router[_0xcb45('0x11')](_0xcb45('0x12'),auth[_0xcb45('0x4')](),interaction['tracked'](_0xcb45('0x13'),_0xcb45('0x14')),controller[_0xcb45('0x15')]);router[_0xcb45('0x16')](_0xcb45('0x12'),auth['isAuthenticated'](),interaction[_0xcb45('0x17')]('mail','mailinteraction:destroy'),controller['destroy']);router['delete'](_0xcb45('0x18'),auth[_0xcb45('0x4')](),controller[_0xcb45('0x19')]);module[_0xcb45('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 6701a17..5e93c90 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 _0x39bb=['STRING','TEXT','out','sequelize','iconv','exports','BOOLEAN','DATE'];(function(_0x3b0eac,_0x503c4e){var _0xdf4967=function(_0x2b4a8d){while(--_0x2b4a8d){_0x3b0eac['push'](_0x3b0eac['shift']());}};_0xdf4967(++_0x503c4e);}(_0x39bb,0xeb));var _0xb39b=function(_0x148785,_0x195ee5){_0x148785=_0x148785-0x0;var _0x17a172=_0x39bb[_0x148785];return _0x17a172;};'use strict';var Sequelize=require(_0xb39b('0x0'));var iconv=require(_0xb39b('0x1'));module[_0xb39b('0x2')]={'closed':{'type':Sequelize[_0xb39b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb39b('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb39b('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xb39b('0x5')](0x1fe)},'to':{'type':Sequelize[_0xb39b('0x5')]},'cc':{'type':Sequelize[_0xb39b('0x6')]('long')},'subject':{'type':Sequelize[_0xb39b('0x6')]()},'attach':{'type':Sequelize[_0xb39b('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb39b('0x4')]},'substatus':{'type':Sequelize[_0xb39b('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xb39b('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb39b('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb39b('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb39b('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8f6c=['TEXT','long','BOOLEAN','ENUM','out','sequelize','iconv','exports','DATE','STRING'];(function(_0x184f11,_0x163b8a){var _0x32cf55=function(_0x180119){while(--_0x180119){_0x184f11['push'](_0x184f11['shift']());}};_0x32cf55(++_0x163b8a);}(_0x8f6c,0x145));var _0xc8f6=function(_0x44867c,_0x5956cd){_0x44867c=_0x44867c-0x0;var _0x364ae1=_0x8f6c[_0x44867c];return _0x364ae1;};'use strict';var Sequelize=require(_0xc8f6('0x0'));var iconv=require(_0xc8f6('0x1'));module[_0xc8f6('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc8f6('0x3')]},'disposition':{'type':Sequelize[_0xc8f6('0x4')]},'secondDisposition':{'type':Sequelize[_0xc8f6('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc8f6('0x4')]},'note':{'type':Sequelize[_0xc8f6('0x4')]},'inReplyTo':{'type':Sequelize[_0xc8f6('0x4')](0x1fe)},'to':{'type':Sequelize[_0xc8f6('0x4')]},'cc':{'type':Sequelize[_0xc8f6('0x5')](_0xc8f6('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xc8f6('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xc8f6('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xc8f6('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xc8f6('0x8')]('in',_0xc8f6('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc8f6('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc8f6('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc8f6('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index dcb7cc5..6f57e30 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 _0xade9=['params','model','keys','query','filters','intersection','fields','attributes','length','include','merge','find','create','body','describe','addMessage','MailMessage','ids','findOne','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','inlineCss','true','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','push','Attachment','Attachments','Messages','from','subject','createdAt','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','rimraf','zip-dir','moment','bluebird','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','catch','show'];(function(_0x2e8e99,_0x3eae1c){var _0x308334=function(_0x2d8a43){while(--_0x2d8a43){_0x2e8e99['push'](_0x2e8e99['shift']());}};_0x308334(++_0x3eae1c);}(_0xade9,0x1c0));var _0x9ade=function(_0x174a72,_0x46034c){_0x174a72=_0x174a72-0x0;var _0x32cecd=_0xade9[_0x174a72];return _0x32cecd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ade('0x0'));var zipdir=require(_0x9ade('0x1'));var moment=require(_0x9ade('0x2'));var BPromise=require(_0x9ade('0x3'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x9ade('0x4'));var juice=require(_0x9ade('0x5'));var Redis=require(_0x9ade('0x6'));var interaction=require(_0x9ade('0x7'));var qs=require(_0x9ade('0x8'));var logger=require('../../config/logger')(_0x9ade('0x9'));var config=require(_0x9ade('0xa'));var db=require(_0x9ade('0xb'))['db'];var htmlEntities=require(_0x9ade('0xc'));config[_0x9ade('0xd')]=_[_0x9ade('0xe')](config['redis'],{'host':_0x9ade('0xf'),'port':0x18eb});var socket=require(_0x9ade('0x10'))(new Redis(config[_0x9ade('0xd')]));require(_0x9ade('0x11'))[_0x9ade('0x12')](socket);function respondWithStatusCode(_0x1b308a,_0x50c932){_0x50c932=_0x50c932||0xcc;return function(_0xb71fd0){if(_0xb71fd0){return _0x1b308a[_0x9ade('0x13')](_0x50c932);}return _0x1b308a['status'](_0x50c932)[_0x9ade('0x14')]();};}function respondWithResult(_0x485c78,_0x2b3027){_0x2b3027=_0x2b3027||0xc8;return function(_0xcf3d74){if(_0xcf3d74){return _0x485c78[_0x9ade('0x15')](_0x2b3027)[_0x9ade('0x16')](_0xcf3d74);}};}function respondWithFilteredResult(_0x40c707,_0x50d0e3){return function(_0x13cfaf){if(_0x13cfaf){var _0x5e4d8d=typeof _0x50d0e3[_0x9ade('0x17')]===_0x9ade('0x18')&&typeof _0x50d0e3[_0x9ade('0x19')]===_0x9ade('0x18');var _0x3a63c9=_0x13cfaf['count'];var _0x921b1b=_0x5e4d8d?0x0:_0x50d0e3[_0x9ade('0x17')];var _0x3b890=_0x5e4d8d?_0x13cfaf[_0x9ade('0x1a')]:_0x50d0e3[_0x9ade('0x17')]+_0x50d0e3['limit'];var _0xd4ef5b;if(_0x3b890>=_0x3a63c9){_0x3b890=_0x3a63c9;_0xd4ef5b=0xc8;}else{_0xd4ef5b=0xce;}_0x40c707['status'](_0xd4ef5b);return _0x40c707[_0x9ade('0x1b')](_0x9ade('0x1c'),_0x921b1b+'-'+_0x3b890+'/'+_0x3a63c9)[_0x9ade('0x16')](_0x13cfaf);}return null;};}function saveUpdates(_0x10c4a0){return function(_0x4f64aa){if(_0x4f64aa){return _0x4f64aa[_0x9ade('0x1d')](_0x10c4a0)[_0x9ade('0x1e')](function(_0x5b132e){return _0x5b132e;});}return null;};}function removeEntity(_0x33c6c8){return function(_0x7b34a2){if(_0x7b34a2){return _0x7b34a2[_0x9ade('0x1f')]()[_0x9ade('0x1e')](function(){_0x33c6c8[_0x9ade('0x15')](0xcc)[_0x9ade('0x14')]();});}};}function handleEntityNotFound(_0x4cb7c1){return function(_0x1e62ee){if(!_0x1e62ee){_0x4cb7c1[_0x9ade('0x13')](0x194);}return _0x1e62ee;};}function handleError(_0x3ed9ca,_0x341691){_0x341691=_0x341691||0x1f4;return function(_0x203aba){logger[_0x9ade('0x20')](_0x203aba[_0x9ade('0x21')]);if(_0x203aba[_0x9ade('0x22')]){delete _0x203aba[_0x9ade('0x22')];}_0x3ed9ca[_0x9ade('0x15')](_0x341691)[_0x9ade('0x23')](_0x203aba);};}exports[_0x9ade('0x24')]=function(_0x51a0dc,_0x12b879){var _0x2721cf={};var _0x5e7c96=_[_0x9ade('0x25')](db[_0x9ade('0x26')][_0x9ade('0x27')],function(_0x409ab9){return{'name':_0x409ab9[_0x9ade('0x28')],'type':_0x409ab9[_0x9ade('0x29')][_0x9ade('0x2a')]};});_0x2721cf=qs[_0x9ade('0x2b')](_0x5e7c96,_0x51a0dc);return interaction[_0x9ade('0x2c')](_0x9ade('0x2d'),_0x51a0dc['query'],_0x51a0dc['user'],_0x2721cf,_0x5e7c96)[_0x9ade('0x1e')](respondWithFilteredResult(_0x12b879,_0x2721cf))[_0x9ade('0x2e')](handleError(_0x12b879,null));};exports[_0x9ade('0x2f')]=function(_0x57f5b7,_0x3fc6ab){var _0xd77e18={'raw':![],'where':{'id':_0x57f5b7[_0x9ade('0x30')]['id']}},_0x5bf12f={};_0x5bf12f[_0x9ade('0x31')]=_[_0x9ade('0x32')](db['MailInteraction'][_0x9ade('0x27')]);_0x5bf12f[_0x9ade('0x33')]=_['keys'](_0x57f5b7[_0x9ade('0x33')]);_0x5bf12f[_0x9ade('0x34')]=_[_0x9ade('0x35')](_0x5bf12f[_0x9ade('0x31')],_0x5bf12f[_0x9ade('0x33')]);_0xd77e18['attributes']=_[_0x9ade('0x35')](_0x5bf12f[_0x9ade('0x31')],qs['fields'](_0x57f5b7[_0x9ade('0x33')][_0x9ade('0x36')]));_0xd77e18[_0x9ade('0x37')]=_0xd77e18[_0x9ade('0x37')][_0x9ade('0x38')]?_0xd77e18[_0x9ade('0x37')]:_0x5bf12f[_0x9ade('0x31')];if(_0x57f5b7[_0x9ade('0x33')]['includeAll']){_0xd77e18[_0x9ade('0x39')]=[{'all':!![]}];}_0xd77e18=_[_0x9ade('0x3a')]({},_0xd77e18,_0x57f5b7['options']);return db['MailInteraction'][_0x9ade('0x3b')](_0xd77e18)[_0x9ade('0x1e')](handleEntityNotFound(_0x3fc6ab,null))['then'](respondWithResult(_0x3fc6ab,null))['catch'](handleError(_0x3fc6ab,null));};exports[_0x9ade('0x3c')]=function(_0x52af24,_0x14ef51){return db[_0x9ade('0x26')]['create'](_0x52af24[_0x9ade('0x3d')],{})[_0x9ade('0x1e')](respondWithResult(_0x14ef51,0xc9))[_0x9ade('0x2e')](handleError(_0x14ef51,null));};exports[_0x9ade('0x1d')]=function(_0x3736bb,_0x17dddc){if(_0x3736bb[_0x9ade('0x3d')]['id']){delete _0x3736bb['body']['id'];}return db['MailInteraction']['find']({'where':{'id':_0x3736bb[_0x9ade('0x30')]['id']}})[_0x9ade('0x1e')](handleEntityNotFound(_0x17dddc,null))[_0x9ade('0x1e')](saveUpdates(_0x3736bb[_0x9ade('0x3d')],null))['then'](respondWithResult(_0x17dddc,null))[_0x9ade('0x2e')](handleError(_0x17dddc,null));};exports[_0x9ade('0x1f')]=function(_0xa02524,_0x208f78){return db[_0x9ade('0x26')][_0x9ade('0x3b')]({'where':{'id':_0xa02524['params']['id']}})[_0x9ade('0x1e')](handleEntityNotFound(_0x208f78,null))[_0x9ade('0x1e')](removeEntity(_0x208f78,null))[_0x9ade('0x2e')](handleError(_0x208f78,null));};exports[_0x9ade('0x3e')]=function(_0x4e810c,_0x160eed){return db[_0x9ade('0x26')][_0x9ade('0x3e')]()[_0x9ade('0x1e')](respondWithResult(_0x160eed,null))[_0x9ade('0x2e')](handleError(_0x160eed,null));};exports[_0x9ade('0x3f')]=function(_0x3d1246,_0x3bd681){return db[_0x9ade('0x40')]['find']({'where':{'id':_0x3d1246[_0x9ade('0x30')]['id']}})[_0x9ade('0x1e')](handleEntityNotFound(_0x3bd681,null))[_0x9ade('0x1e')](function(_0x59db3b){if(_0x59db3b){return _0x59db3b['addMessage'](_0x3d1246[_0x9ade('0x3d')]['ids'],_['omit'](_0x3d1246[_0x9ade('0x3d')],[_0x9ade('0x41'),'id'])||{});}})[_0x9ade('0x1e')](respondWithResult(_0x3bd681,null))[_0x9ade('0x2e')](handleError(_0x3bd681,null));};exports['getMessages']=function(_0xe33754,_0x45ccfd){var _0x2484bf={'raw':![],'where':{}};var _0x1b2df7={};var _0x21b1d6={'count':0x0,'rows':[]};return db[_0x9ade('0x26')][_0x9ade('0x42')]({'where':{'id':_0xe33754[_0x9ade('0x30')]['id']}})[_0x9ade('0x1e')](handleEntityNotFound(_0x45ccfd,null))['then'](function(_0x53f656){if(_0x53f656){_0x1b2df7[_0x9ade('0x31')]=_[_0x9ade('0x32')](db[_0x9ade('0x40')][_0x9ade('0x27')]);_0x1b2df7[_0x9ade('0x33')]=_['keys'](_0xe33754[_0x9ade('0x33')]);_0x1b2df7[_0x9ade('0x34')]=_[_0x9ade('0x35')](_0x1b2df7[_0x9ade('0x31')],_0x1b2df7[_0x9ade('0x33')]);_0x2484bf['attributes']=_[_0x9ade('0x35')](_0x1b2df7['model'],qs[_0x9ade('0x36')](_0xe33754['query'][_0x9ade('0x36')]));_0x2484bf[_0x9ade('0x37')]=_0x2484bf['attributes'][_0x9ade('0x38')]?_0x2484bf[_0x9ade('0x37')]:_0x1b2df7[_0x9ade('0x31')];if(!_0xe33754[_0x9ade('0x33')][_0x9ade('0x43')](_0x9ade('0x44'))){_0x2484bf[_0x9ade('0x19')]=qs[_0x9ade('0x19')](_0xe33754[_0x9ade('0x33')]['limit']);_0x2484bf[_0x9ade('0x17')]=qs[_0x9ade('0x17')](_0xe33754[_0x9ade('0x33')][_0x9ade('0x17')]);}_0x2484bf[_0x9ade('0x45')]=qs[_0x9ade('0x46')](_0xe33754[_0x9ade('0x33')][_0x9ade('0x46')]);_0x2484bf[_0x9ade('0x47')]=qs[_0x9ade('0x34')](_[_0x9ade('0x48')](_0xe33754[_0x9ade('0x33')],_0x1b2df7[_0x9ade('0x34')]));_0x2484bf[_0x9ade('0x47')][_0x9ade('0x49')]=_0x53f656['id'];if(_0xe33754['query'][_0x9ade('0x4a')]){_0x2484bf[_0x9ade('0x47')]=_[_0x9ade('0x3a')](_0x2484bf[_0x9ade('0x47')],{'$or':_[_0x9ade('0x25')](_0x2484bf[_0x9ade('0x37')],function(_0x52956b){var _0x3dd203={};_0x3dd203[_0x52956b]={'$like':'%'+_0xe33754[_0x9ade('0x33')][_0x9ade('0x4a')]+'%'};return _0x3dd203;})});}if(_0xe33754[_0x9ade('0x33')][_0x9ade('0x4b')]){var _0x100503=_0xe33754[_0x9ade('0x33')][_0x9ade('0x4b')][_0x9ade('0x4c')](',');var _0xa6a103={};_0xa6a103[_0x100503[0x0]]={'$gte':moment(_0x100503[0x1])[_0x9ade('0x4d')](_0x9ade('0x4e'))};_0x2484bf[_0x9ade('0x47')]=_[_0x9ade('0x3a')](_0x2484bf['where'],_0xa6a103);}_0x2484bf=_[_0x9ade('0x3a')]({},_0x2484bf,_0xe33754[_0x9ade('0x4f')]);return db[_0x9ade('0x40')][_0x9ade('0x1a')]({'where':_0x2484bf['where']})['then'](function(_0x30aaba){_0x21b1d6['count']=_0x30aaba;if(_0xe33754[_0x9ade('0x33')][_0x9ade('0x50')]){_0x2484bf['include']=[{'all':!![]}];}return db['MailMessage'][_0x9ade('0x2c')](_0x2484bf);})[_0x9ade('0x1e')](function(_0x44e8a9){if(_0xe33754[_0x9ade('0x33')][_0x9ade('0x51')]===_0x9ade('0x52')){for(var _0x4e46e7=0x0;_0x4e46e7<_0x44e8a9[_0x9ade('0x38')];_0x4e46e7++){_0x44e8a9[_0x4e46e7][_0x9ade('0x3d')]=juice(_0x44e8a9[_0x4e46e7][_0x9ade('0x3d')]);}}_0x21b1d6[_0x9ade('0x53')]=_0x44e8a9;return _0x21b1d6;});}})[_0x9ade('0x1e')](respondWithFilteredResult(_0x45ccfd,_0x2484bf))[_0x9ade('0x2e')](handleError(_0x45ccfd,null));};exports[_0x9ade('0x54')]=function(_0x6a4490,_0x2d3109){return db[_0x9ade('0x26')][_0x9ade('0x3b')]({'where':{'id':_0x6a4490[_0x9ade('0x30')]['id']}})[_0x9ade('0x1e')](handleEntityNotFound(_0x2d3109,null))[_0x9ade('0x1e')](function(_0x3a2275){if(_0x3a2275){return _0x3a2275[_0x9ade('0x55')](_0x6a4490[_0x9ade('0x3d')][_0x9ade('0x41')],_['omit'](_0x6a4490[_0x9ade('0x3d')],['ids','id'])||{})[_0x9ade('0x56')](function(){return db[_0x9ade('0x57')]['findAll']({'attributes':['id',_0x9ade('0x22'),_0x9ade('0x58')],'where':{'id':_0x6a4490[_0x9ade('0x3d')][_0x9ade('0x41')]}});})[_0x9ade('0x1e')](function(_0x3be650){socket[_0x9ade('0x59')](_0x9ade('0x5a'),{'id':Number(_0x6a4490[_0x9ade('0x30')]['id']),'tags':_0x3be650||[]});return{'id':Number(_0x6a4490['params']['id']),'tags':_0x3be650||[]};});}})['then'](respondWithResult(_0x2d3109,null))[_0x9ade('0x2e')](handleError(_0x2d3109,null));};exports[_0x9ade('0x5b')]=function(_0x4620a8,_0x2bb846){return db[_0x9ade('0x26')][_0x9ade('0x3b')]({'where':{'id':_0x4620a8[_0x9ade('0x30')]['id']}})['then'](handleEntityNotFound(_0x2bb846,null))['then'](function(_0x3814bb){if(_0x3814bb){return _0x3814bb['removeTags'](_0x4620a8[_0x9ade('0x33')][_0x9ade('0x41')]);}})[_0x9ade('0x1e')](respondWithStatusCode(_0x2bb846,null))[_0x9ade('0x2e')](handleError(_0x2bb846,null));};exports[_0x9ade('0x5c')]=function(_0x44d3ef,_0x787f16){var _0x26deb5=moment()[_0x9ade('0x5d')]()[_0x9ade('0x5e')]();var _0x69c8e5=path[_0x9ade('0x5f')](config[_0x9ade('0x60')],_0x9ade('0x61'),_0x9ade('0x62'),_0x9ade('0x63'));var _0x104987=path[_0x9ade('0x5f')](config[_0x9ade('0x60')],_0x9ade('0x61'),_0x9ade('0x62'),'attachments');var _0x280317=path[_0x9ade('0x5f')](_0x69c8e5,_0x26deb5);var _0xa78357=util[_0x9ade('0x4d')](_0x9ade('0x64'),_0x44d3ef['params']['id'],_0x26deb5);var _0x2f13c1=path[_0x9ade('0x5f')](_0x69c8e5,_0xa78357);var _0x65aea3=[];if(_0x44d3ef[_0x9ade('0x33')][_0x9ade('0x65')]){_0x65aea3[_0x9ade('0x66')]({'model':db[_0x9ade('0x67')],'as':_0x9ade('0x68'),'raw':!![]});}var _0x5dd76a=[{'model':db[_0x9ade('0x40')],'as':_0x9ade('0x69'),'attributes':['id','body',_0x9ade('0x6a'),'to','cc','bcc',_0x9ade('0x6b'),_0x9ade('0x6c')],'where':{'secret':![]},'order':qs[_0x9ade('0x46')]('id'),'include':_0x65aea3}];return db[_0x9ade('0x26')]['find']({'where':{'id':_0x44d3ef[_0x9ade('0x30')]['id']},'include':_0x5dd76a})['then'](handleEntityNotFound(_0x787f16,null))[_0x9ade('0x1e')](function(_0x4e11d9){if(_0x4e11d9&&_0x4e11d9[_0x9ade('0x69')]){var _0x555262=_0x4e11d9[_0x9ade('0x6d')]({'plain':!![]});fs[_0x9ade('0x6e')](_0x280317);return BPromise[_0x9ade('0x6f')](_0x555262[_0x9ade('0x69')],function(_0x3b1ada,_0x511434){var _0x3ce712={'from':_0x3b1ada['from'],'to':_0x3b1ada['to']||'missing.recipient@your.company.com','subject':_0x3b1ada[_0x9ade('0x6b')],'html':htmlEntities[_0x9ade('0x70')](_0x3b1ada[_0x9ade('0x3d')]),'headers':{'Date':moment(_0x3b1ada[_0x9ade('0x6c')])['format'](_0x9ade('0x71'))},'attachments':[]};if(_0x3b1ada['cc']){_0x3ce712[_0x9ade('0x72')]['Cc']=_0x3b1ada['cc'];}if(_0x3b1ada[_0x9ade('0x73')]){_0x3ce712[_0x9ade('0x72')][_0x9ade('0x74')]=_0x3b1ada['bcc'];}return new BPromise(function(_0x13c99b,_0x40dd88){if(_0x3b1ada[_0x9ade('0x68')]){for(var _0x2a6704=0x0;_0x2a6704<_0x3b1ada[_0x9ade('0x68')][_0x9ade('0x38')];_0x2a6704++){var _0x4add70=_0x3b1ada[_0x9ade('0x68')][_0x2a6704];var _0x2d1fae=path[_0x9ade('0x5f')](_0x104987,_0x4add70[_0x9ade('0x75')]);if(fs[_0x9ade('0x76')](_0x2d1fae)){_0x3ce712[_0x9ade('0x65')]['push']({'name':_0x4add70[_0x9ade('0x22')],'contentType':_0x4add70[_0x9ade('0x29')],'data':fs[_0x9ade('0x77')](_0x2d1fae)});}}}emlformat[_0x9ade('0x78')](_0x3ce712,function(_0x4cd3e9,_0x388a82){if(_0x4cd3e9)return _0x40dd88(_0x4cd3e9);fs[_0x9ade('0x79')](path[_0x9ade('0x5f')](_0x280317,util[_0x9ade('0x4d')](_0x9ade('0x7a'),_0x511434)),_0x388a82);return _0x13c99b(_0x388a82);});});})[_0x9ade('0x1e')](function(){return new BPromise(function(_0x42620f,_0xe4d445){zipdir(_0x280317,{'saveTo':_0x2f13c1},function(_0x324724,_0x2300e7){if(_0x324724)return _0xe4d445(_0x324724);return _0x42620f(_0x2300e7);});})['then'](function(){return new BPromise(function(_0x36ec55,_0x3db45f){rimraf(_0x280317,function(_0x3165e0){if(_0x3165e0)_0x3db45f(_0x3165e0);return _0x36ec55();});});})[_0x9ade('0x1e')](function(){return _0x787f16[_0x9ade('0x5c')](_0x2f13c1,_0xa78357,function(_0x5ac97e){if(!_0x5ac97e)fs[_0x9ade('0x7b')](_0x2f13c1);});});});}else{return _0x787f16[_0x9ade('0x13')](0xc8);}})[_0x9ade('0x2e')](handleError(_0x787f16,null));}; \ No newline at end of file +var _0xdfd3=['limit','status','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','key','getOptions','findAll','user','catch','show','params','model','keys','query','filters','attributes','intersection','fields','includeAll','merge','options','find','create','body','MailInteraction','describe','addMessage','MailMessage','ids','getMessages','length','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','inlineCss','rows','addTags','setTags','omit','spread','Tag','color','emit','mailInteractionTags:save','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','type','readFileSync','build','writeFileSync','message%d.eml','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','api','../../config/environment','../../mysqldb','html-entities','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','json','offset','undefined','count'];(function(_0x29eb44,_0x300719){var _0x4512ac=function(_0x183803){while(--_0x183803){_0x29eb44['push'](_0x29eb44['shift']());}};_0x4512ac(++_0x300719);}(_0xdfd3,0x1b8));var _0x3dfd=function(_0x36d04d,_0x469817){_0x36d04d=_0x36d04d-0x0;var _0x213b48=_0xdfd3[_0x36d04d];return _0x213b48;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3dfd('0x0'));var zipdir=require(_0x3dfd('0x1'));var moment=require(_0x3dfd('0x2'));var BPromise=require(_0x3dfd('0x3'));var util=require(_0x3dfd('0x4'));var path=require(_0x3dfd('0x5'));var fs=require('fs');var _=require(_0x3dfd('0x6'));var juice=require(_0x3dfd('0x7'));var Redis=require(_0x3dfd('0x8'));var interaction=require(_0x3dfd('0x9'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x3dfd('0xa'));var config=require(_0x3dfd('0xb'));var db=require(_0x3dfd('0xc'))['db'];var htmlEntities=require(_0x3dfd('0xd'));config['redis']=_['defaults'](config['redis'],{'host':_0x3dfd('0xe'),'port':0x18eb});var socket=require(_0x3dfd('0xf'))(new Redis(config['redis']));require(_0x3dfd('0x10'))[_0x3dfd('0x11')](socket);function respondWithStatusCode(_0x96fb09,_0x2691b7){_0x2691b7=_0x2691b7||0xcc;return function(_0x4d72cd){if(_0x4d72cd){return _0x96fb09[_0x3dfd('0x12')](_0x2691b7);}return _0x96fb09['status'](_0x2691b7)[_0x3dfd('0x13')]();};}function respondWithResult(_0x756b9c,_0xd86242){_0xd86242=_0xd86242||0xc8;return function(_0x1d4430){if(_0x1d4430){return _0x756b9c['status'](_0xd86242)[_0x3dfd('0x14')](_0x1d4430);}};}function respondWithFilteredResult(_0x324bb7,_0x2166b1){return function(_0x14cd07){if(_0x14cd07){var _0x112d44=typeof _0x2166b1[_0x3dfd('0x15')]===_0x3dfd('0x16')&&typeof _0x2166b1['limit']===_0x3dfd('0x16');var _0x178b37=_0x14cd07['count'];var _0x335a02=_0x112d44?0x0:_0x2166b1[_0x3dfd('0x15')];var _0x25c4cc=_0x112d44?_0x14cd07[_0x3dfd('0x17')]:_0x2166b1['offset']+_0x2166b1[_0x3dfd('0x18')];var _0x1cb669;if(_0x25c4cc>=_0x178b37){_0x25c4cc=_0x178b37;_0x1cb669=0xc8;}else{_0x1cb669=0xce;}_0x324bb7[_0x3dfd('0x19')](_0x1cb669);return _0x324bb7['set']('Content-Range',_0x335a02+'-'+_0x25c4cc+'/'+_0x178b37)[_0x3dfd('0x14')](_0x14cd07);}return null;};}function saveUpdates(_0x12096f){return function(_0x25c3a2){if(_0x25c3a2){return _0x25c3a2[_0x3dfd('0x1a')](_0x12096f)['then'](function(_0x4599ab){return _0x4599ab;});}return null;};}function removeEntity(_0x49172c){return function(_0xdd8a0b){if(_0xdd8a0b){return _0xdd8a0b[_0x3dfd('0x1b')]()[_0x3dfd('0x1c')](function(){_0x49172c[_0x3dfd('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38ee1a){return function(_0x23eb03){if(!_0x23eb03){_0x38ee1a[_0x3dfd('0x12')](0x194);}return _0x23eb03;};}function handleError(_0x322df9,_0x137824){_0x137824=_0x137824||0x1f4;return function(_0x4d2397){logger[_0x3dfd('0x1d')](_0x4d2397[_0x3dfd('0x1e')]);if(_0x4d2397[_0x3dfd('0x1f')]){delete _0x4d2397['name'];}_0x322df9[_0x3dfd('0x19')](_0x137824)['send'](_0x4d2397);};}exports[_0x3dfd('0x20')]=function(_0x49b99c,_0x5c566e){var _0x2202d8={};var _0x1074e6=_[_0x3dfd('0x21')](db['MailInteraction'][_0x3dfd('0x22')],function(_0x32b751){return{'name':_0x32b751[_0x3dfd('0x23')],'type':_0x32b751['type'][_0x3dfd('0x24')]};});_0x2202d8=qs[_0x3dfd('0x25')](_0x1074e6,_0x49b99c);return interaction[_0x3dfd('0x26')]('mail',_0x49b99c['query'],_0x49b99c[_0x3dfd('0x27')],_0x2202d8,_0x1074e6)['then'](respondWithFilteredResult(_0x5c566e,_0x2202d8))[_0x3dfd('0x28')](handleError(_0x5c566e,null));};exports[_0x3dfd('0x29')]=function(_0x28c78f,_0x5207ea){var _0x374153={'raw':![],'where':{'id':_0x28c78f[_0x3dfd('0x2a')]['id']}},_0x2c0f40={};_0x2c0f40[_0x3dfd('0x2b')]=_[_0x3dfd('0x2c')](db['MailInteraction'][_0x3dfd('0x22')]);_0x2c0f40[_0x3dfd('0x2d')]=_[_0x3dfd('0x2c')](_0x28c78f[_0x3dfd('0x2d')]);_0x2c0f40[_0x3dfd('0x2e')]=_['intersection'](_0x2c0f40[_0x3dfd('0x2b')],_0x2c0f40[_0x3dfd('0x2d')]);_0x374153[_0x3dfd('0x2f')]=_[_0x3dfd('0x30')](_0x2c0f40['model'],qs[_0x3dfd('0x31')](_0x28c78f[_0x3dfd('0x2d')][_0x3dfd('0x31')]));_0x374153[_0x3dfd('0x2f')]=_0x374153[_0x3dfd('0x2f')]['length']?_0x374153[_0x3dfd('0x2f')]:_0x2c0f40[_0x3dfd('0x2b')];if(_0x28c78f['query'][_0x3dfd('0x32')]){_0x374153['include']=[{'all':!![]}];}_0x374153=_[_0x3dfd('0x33')]({},_0x374153,_0x28c78f[_0x3dfd('0x34')]);return db['MailInteraction'][_0x3dfd('0x35')](_0x374153)[_0x3dfd('0x1c')](handleEntityNotFound(_0x5207ea,null))['then'](respondWithResult(_0x5207ea,null))[_0x3dfd('0x28')](handleError(_0x5207ea,null));};exports[_0x3dfd('0x36')]=function(_0x23a29f,_0x3975c8){return db['MailInteraction']['create'](_0x23a29f[_0x3dfd('0x37')],{})[_0x3dfd('0x1c')](respondWithResult(_0x3975c8,0xc9))[_0x3dfd('0x28')](handleError(_0x3975c8,null));};exports[_0x3dfd('0x1a')]=function(_0x3b8a65,_0x168e6a){if(_0x3b8a65['body']['id']){delete _0x3b8a65['body']['id'];}return db[_0x3dfd('0x38')][_0x3dfd('0x35')]({'where':{'id':_0x3b8a65[_0x3dfd('0x2a')]['id']}})[_0x3dfd('0x1c')](handleEntityNotFound(_0x168e6a,null))[_0x3dfd('0x1c')](saveUpdates(_0x3b8a65[_0x3dfd('0x37')],null))[_0x3dfd('0x1c')](respondWithResult(_0x168e6a,null))[_0x3dfd('0x28')](handleError(_0x168e6a,null));};exports[_0x3dfd('0x1b')]=function(_0x428240,_0x39a1f1){return db[_0x3dfd('0x38')][_0x3dfd('0x35')]({'where':{'id':_0x428240[_0x3dfd('0x2a')]['id']}})[_0x3dfd('0x1c')](handleEntityNotFound(_0x39a1f1,null))['then'](removeEntity(_0x39a1f1,null))['catch'](handleError(_0x39a1f1,null));};exports[_0x3dfd('0x39')]=function(_0x43c7d2,_0x4a217f){return db[_0x3dfd('0x38')][_0x3dfd('0x39')]()[_0x3dfd('0x1c')](respondWithResult(_0x4a217f,null))[_0x3dfd('0x28')](handleError(_0x4a217f,null));};exports[_0x3dfd('0x3a')]=function(_0x5da65a,_0x53d1f2){return db[_0x3dfd('0x3b')][_0x3dfd('0x35')]({'where':{'id':_0x5da65a['params']['id']}})[_0x3dfd('0x1c')](handleEntityNotFound(_0x53d1f2,null))['then'](function(_0x2d2c4a){if(_0x2d2c4a){return _0x2d2c4a[_0x3dfd('0x3a')](_0x5da65a[_0x3dfd('0x37')][_0x3dfd('0x3c')],_['omit'](_0x5da65a['body'],[_0x3dfd('0x3c'),'id'])||{});}})[_0x3dfd('0x1c')](respondWithResult(_0x53d1f2,null))[_0x3dfd('0x28')](handleError(_0x53d1f2,null));};exports[_0x3dfd('0x3d')]=function(_0x541da8,_0x1df0a9){var _0x2fc579={'raw':![],'where':{}};var _0x31fb77={};var _0x49e8ef={'count':0x0,'rows':[]};return db[_0x3dfd('0x38')]['findOne']({'where':{'id':_0x541da8[_0x3dfd('0x2a')]['id']}})[_0x3dfd('0x1c')](handleEntityNotFound(_0x1df0a9,null))[_0x3dfd('0x1c')](function(_0x1826a8){if(_0x1826a8){_0x31fb77['model']=_[_0x3dfd('0x2c')](db['MailMessage'][_0x3dfd('0x22')]);_0x31fb77[_0x3dfd('0x2d')]=_['keys'](_0x541da8[_0x3dfd('0x2d')]);_0x31fb77[_0x3dfd('0x2e')]=_['intersection'](_0x31fb77[_0x3dfd('0x2b')],_0x31fb77[_0x3dfd('0x2d')]);_0x2fc579[_0x3dfd('0x2f')]=_[_0x3dfd('0x30')](_0x31fb77[_0x3dfd('0x2b')],qs['fields'](_0x541da8['query'][_0x3dfd('0x31')]));_0x2fc579[_0x3dfd('0x2f')]=_0x2fc579[_0x3dfd('0x2f')][_0x3dfd('0x3e')]?_0x2fc579[_0x3dfd('0x2f')]:_0x31fb77[_0x3dfd('0x2b')];if(!_0x541da8[_0x3dfd('0x2d')][_0x3dfd('0x3f')](_0x3dfd('0x40'))){_0x2fc579[_0x3dfd('0x18')]=qs[_0x3dfd('0x18')](_0x541da8[_0x3dfd('0x2d')][_0x3dfd('0x18')]);_0x2fc579[_0x3dfd('0x15')]=qs[_0x3dfd('0x15')](_0x541da8[_0x3dfd('0x2d')][_0x3dfd('0x15')]);}_0x2fc579[_0x3dfd('0x41')]=qs['sort'](_0x541da8[_0x3dfd('0x2d')][_0x3dfd('0x42')]);_0x2fc579[_0x3dfd('0x43')]=qs[_0x3dfd('0x2e')](_[_0x3dfd('0x44')](_0x541da8[_0x3dfd('0x2d')],_0x31fb77[_0x3dfd('0x2e')]));_0x2fc579[_0x3dfd('0x43')][_0x3dfd('0x45')]=_0x1826a8['id'];if(_0x541da8['query']['filter']){_0x2fc579['where']=_[_0x3dfd('0x33')](_0x2fc579[_0x3dfd('0x43')],{'$or':_['map'](_0x2fc579[_0x3dfd('0x2f')],function(_0x125434){var _0x542bc6={};_0x542bc6[_0x125434]={'$like':'%'+_0x541da8[_0x3dfd('0x2d')][_0x3dfd('0x46')]+'%'};return _0x542bc6;})});}if(_0x541da8['query'][_0x3dfd('0x47')]){var _0x535839=_0x541da8[_0x3dfd('0x2d')][_0x3dfd('0x47')][_0x3dfd('0x48')](',');var _0x1449c1={};_0x1449c1[_0x535839[0x0]]={'$gte':moment(_0x535839[0x1])[_0x3dfd('0x49')](_0x3dfd('0x4a'))};_0x2fc579[_0x3dfd('0x43')]=_['merge'](_0x2fc579['where'],_0x1449c1);}_0x2fc579=_[_0x3dfd('0x33')]({},_0x2fc579,_0x541da8[_0x3dfd('0x34')]);return db[_0x3dfd('0x3b')][_0x3dfd('0x17')]({'where':_0x2fc579[_0x3dfd('0x43')]})[_0x3dfd('0x1c')](function(_0x556c3b){_0x49e8ef[_0x3dfd('0x17')]=_0x556c3b;if(_0x541da8[_0x3dfd('0x2d')][_0x3dfd('0x32')]){_0x2fc579[_0x3dfd('0x4b')]=[{'all':!![]}];}return db['MailMessage'][_0x3dfd('0x26')](_0x2fc579);})[_0x3dfd('0x1c')](function(_0x52566a){if(_0x541da8[_0x3dfd('0x2d')][_0x3dfd('0x4c')]==='true'){for(var _0x1fb0fd=0x0;_0x1fb0fd<_0x52566a['length'];_0x1fb0fd++){_0x52566a[_0x1fb0fd][_0x3dfd('0x37')]=juice(_0x52566a[_0x1fb0fd][_0x3dfd('0x37')]);}}_0x49e8ef[_0x3dfd('0x4d')]=_0x52566a;return _0x49e8ef;});}})[_0x3dfd('0x1c')](respondWithFilteredResult(_0x1df0a9,_0x2fc579))[_0x3dfd('0x28')](handleError(_0x1df0a9,null));};exports[_0x3dfd('0x4e')]=function(_0x31c0d9,_0x113576){return db['MailInteraction'][_0x3dfd('0x35')]({'where':{'id':_0x31c0d9[_0x3dfd('0x2a')]['id']}})[_0x3dfd('0x1c')](handleEntityNotFound(_0x113576,null))[_0x3dfd('0x1c')](function(_0x1bb63d){if(_0x1bb63d){return _0x1bb63d[_0x3dfd('0x4f')](_0x31c0d9[_0x3dfd('0x37')]['ids'],_[_0x3dfd('0x50')](_0x31c0d9[_0x3dfd('0x37')],[_0x3dfd('0x3c'),'id'])||{})[_0x3dfd('0x51')](function(){return db[_0x3dfd('0x52')]['findAll']({'attributes':['id',_0x3dfd('0x1f'),_0x3dfd('0x53')],'where':{'id':_0x31c0d9[_0x3dfd('0x37')][_0x3dfd('0x3c')]}});})['then'](function(_0x360d32){socket[_0x3dfd('0x54')](_0x3dfd('0x55'),{'id':Number(_0x31c0d9[_0x3dfd('0x2a')]['id']),'tags':_0x360d32||[]});return{'id':Number(_0x31c0d9[_0x3dfd('0x2a')]['id']),'tags':_0x360d32||[]};});}})[_0x3dfd('0x1c')](respondWithResult(_0x113576,null))[_0x3dfd('0x28')](handleError(_0x113576,null));};exports['removeTags']=function(_0x40545b,_0x2ed0d2){return db[_0x3dfd('0x38')][_0x3dfd('0x35')]({'where':{'id':_0x40545b['params']['id']}})[_0x3dfd('0x1c')](handleEntityNotFound(_0x2ed0d2,null))['then'](function(_0x5d9921){if(_0x5d9921){return _0x5d9921['removeTags'](_0x40545b['query'][_0x3dfd('0x3c')]);}})[_0x3dfd('0x1c')](respondWithStatusCode(_0x2ed0d2,null))['catch'](handleError(_0x2ed0d2,null));};exports[_0x3dfd('0x56')]=function(_0x4aea65,_0x17523f){var _0x17040e=moment()[_0x3dfd('0x57')]()[_0x3dfd('0x58')]();var _0x81e8ee=path[_0x3dfd('0x59')](config[_0x3dfd('0x5a')],_0x3dfd('0x5b'),_0x3dfd('0x5c'),_0x3dfd('0x5d'));var _0x56c886=path[_0x3dfd('0x59')](config[_0x3dfd('0x5a')],'server',_0x3dfd('0x5c'),_0x3dfd('0x5e'));var _0x1ed436=path['join'](_0x81e8ee,_0x17040e);var _0x3d9b3b=util[_0x3dfd('0x49')](_0x3dfd('0x5f'),_0x4aea65['params']['id'],_0x17040e);var _0x53c8c8=path['join'](_0x81e8ee,_0x3d9b3b);var _0x2e782f=[];if(_0x4aea65[_0x3dfd('0x2d')][_0x3dfd('0x5e')]){_0x2e782f['push']({'model':db[_0x3dfd('0x60')],'as':'Attachments','raw':!![]});}var _0x2d0f61=[{'model':db['MailMessage'],'as':_0x3dfd('0x61'),'attributes':['id','body',_0x3dfd('0x62'),'to','cc',_0x3dfd('0x63'),_0x3dfd('0x64'),_0x3dfd('0x65')],'where':{'secret':![]},'order':qs[_0x3dfd('0x42')]('id'),'include':_0x2e782f}];return db[_0x3dfd('0x38')][_0x3dfd('0x35')]({'where':{'id':_0x4aea65[_0x3dfd('0x2a')]['id']},'include':_0x2d0f61})['then'](handleEntityNotFound(_0x17523f,null))['then'](function(_0x9357e4){if(_0x9357e4&&_0x9357e4['Messages']){var _0x4470be=_0x9357e4[_0x3dfd('0x66')]({'plain':!![]});fs[_0x3dfd('0x67')](_0x1ed436);return BPromise[_0x3dfd('0x68')](_0x4470be['Messages'],function(_0x493f91,_0x2bc78d){var _0x3700d8={'from':_0x493f91[_0x3dfd('0x62')],'to':_0x493f91['to']||'missing.recipient@your.company.com','subject':_0x493f91['subject'],'html':htmlEntities['decode'](_0x493f91[_0x3dfd('0x37')]),'headers':{'Date':moment(_0x493f91['createdAt'])[_0x3dfd('0x49')](_0x3dfd('0x69'))},'attachments':[]};if(_0x493f91['cc']){_0x3700d8[_0x3dfd('0x6a')]['Cc']=_0x493f91['cc'];}if(_0x493f91['bcc']){_0x3700d8[_0x3dfd('0x6a')][_0x3dfd('0x6b')]=_0x493f91[_0x3dfd('0x63')];}return new BPromise(function(_0x251e9a,_0x3f38a0){if(_0x493f91[_0x3dfd('0x6c')]){for(var _0x235213=0x0;_0x235213<_0x493f91[_0x3dfd('0x6c')][_0x3dfd('0x3e')];_0x235213++){var _0x4eeef5=_0x493f91[_0x3dfd('0x6c')][_0x235213];var _0x4bbc34=path[_0x3dfd('0x59')](_0x56c886,_0x4eeef5[_0x3dfd('0x6d')]);if(fs[_0x3dfd('0x6e')](_0x4bbc34)){_0x3700d8['attachments']['push']({'name':_0x4eeef5[_0x3dfd('0x1f')],'contentType':_0x4eeef5[_0x3dfd('0x6f')],'data':fs[_0x3dfd('0x70')](_0x4bbc34)});}}}emlformat[_0x3dfd('0x71')](_0x3700d8,function(_0xd07474,_0x2025a2){if(_0xd07474)return _0x3f38a0(_0xd07474);fs[_0x3dfd('0x72')](path['join'](_0x1ed436,util[_0x3dfd('0x49')](_0x3dfd('0x73'),_0x2bc78d)),_0x2025a2);return _0x251e9a(_0x2025a2);});});})['then'](function(){return new BPromise(function(_0x3dcffe,_0x174167){zipdir(_0x1ed436,{'saveTo':_0x53c8c8},function(_0x59de02,_0x4d29aa){if(_0x59de02)return _0x174167(_0x59de02);return _0x3dcffe(_0x4d29aa);});})[_0x3dfd('0x1c')](function(){return new BPromise(function(_0x5ef00c,_0x30b996){rimraf(_0x1ed436,function(_0x5b1b0b){if(_0x5b1b0b)_0x30b996(_0x5b1b0b);return _0x5ef00c();});});})[_0x3dfd('0x1c')](function(){return _0x17523f[_0x3dfd('0x56')](_0x53c8c8,_0x3d9b3b,function(_0x48108f){if(!_0x48108f)fs['unlinkSync'](_0x53c8c8);});});});}else{return _0x17523f[_0x3dfd('0x12')](0xc8);}})[_0x3dfd('0x28')](handleError(_0x17523f,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 8df210f..a6a1752 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 _0x3ea9=['setDataValue','Users','findAll','length','emit','catch','hasOwnProperty','events','MailInteraction','MailMessage','setMaxListeners','save','update','getUsers','then'];(function(_0x2ddd63,_0xb39e2e){var _0x43e1ed=function(_0x2e1ddf){while(--_0x2e1ddf){_0x2ddd63['push'](_0x2ddd63['shift']());}};_0x43e1ed(++_0xb39e2e);}(_0x3ea9,0x1d8));var _0x93ea=function(_0xa42745,_0x436be0){_0xa42745=_0xa42745-0x0;var _0x49c702=_0x3ea9[_0xa42745];return _0x49c702;};'use strict';var EventEmitter=require(_0x93ea('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x93ea('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x93ea('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x93ea('0x3')](0x0);var events={'afterCreate':_0x93ea('0x4'),'afterUpdate':_0x93ea('0x5'),'afterDestroy':'remove'};function emitEvent(_0x220648){return function(_0x359168,_0xd0f754,_0x4d8186){_0x359168[_0x93ea('0x6')]({'attributes':['id'],'raw':!![]})[_0x93ea('0x7')](function(_0x416b18){_0x359168[_0x93ea('0x8')](_0x93ea('0x9'),_0x416b18['map'](function(_0x4d2951){return{'id':_0x4d2951['id']};}));return MailMessage[_0x93ea('0xa')]({'where':{'MailInteractionId':_0x359168['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3b9d35){_0x359168[_0x93ea('0x8')]('unreadMessages',_0x3b9d35[_0x93ea('0xb')]);MailInteractionEvents[_0x93ea('0xc')](_0x220648+':'+_0x359168['id'],_0x359168);MailInteractionEvents[_0x93ea('0xc')](_0x220648,_0x359168);_0x4d8186(null);})[_0x93ea('0xd')](_0x4d8186(null));};}for(var e in events){if(events[_0x93ea('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xc1f5=['setMaxListeners','save','remove','getUsers','then','setDataValue','findAll','length','emit','hasOwnProperty','../../mysqldb'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xc1f5,0x128));var _0x5c1f=function(_0x31e469,_0x3b683d){_0x31e469=_0x31e469-0x0;var _0x29b8b1=_0xc1f5[_0x31e469];return _0x29b8b1;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0x5c1f('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5c1f('0x1')](0x0);var events={'afterCreate':_0x5c1f('0x2'),'afterUpdate':'update','afterDestroy':_0x5c1f('0x3')};function emitEvent(_0x375819){return function(_0x536529,_0x5df6d4,_0x115406){_0x536529[_0x5c1f('0x4')]({'attributes':['id'],'raw':!![]})[_0x5c1f('0x5')](function(_0x5bc1ef){_0x536529[_0x5c1f('0x6')]('Users',_0x5bc1ef['map'](function(_0x511b68){return{'id':_0x511b68['id']};}));return MailMessage[_0x5c1f('0x7')]({'where':{'MailInteractionId':_0x536529['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5c1f('0x5')](function(_0x1048f8){_0x536529[_0x5c1f('0x6')]('unreadMessages',_0x1048f8[_0x5c1f('0x8')]);MailInteractionEvents[_0x5c1f('0x9')](_0x375819+':'+_0x536529['id'],_0x536529);MailInteractionEvents['emit'](_0x375819,_0x536529);_0x115406(null);})['catch'](_0x115406(null));};}for(var e in events){if(events[_0x5c1f('0xa')](e)){var event=events[e];MailInteraction['hook'](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 a3ec28e..61c1d79 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 _0x3a3d=['exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','get','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes'];(function(_0xce43be,_0x2b1d54){var _0x1ae1c1=function(_0x43afe9){while(--_0x43afe9){_0xce43be['push'](_0xce43be['shift']());}};_0x1ae1c1(++_0x2b1d54);}(_0x3a3d,0xba));var _0xd3a3=function(_0x20368b,_0x290bbb){_0x20368b=_0x20368b-0x0;var _0x7c6c4=_0x3a3d[_0x20368b];return _0x7c6c4;};'use strict';var _=require(_0xd3a3('0x0'));var util=require(_0xd3a3('0x1'));var logger=require('../../config/logger')(_0xd3a3('0x2'));var moment=require(_0xd3a3('0x3'));var BPromise=require(_0xd3a3('0x4'));var rp=require(_0xd3a3('0x5'));var fs=require('fs');var path=require(_0xd3a3('0x6'));var rimraf=require(_0xd3a3('0x7'));var config=require(_0xd3a3('0x8'));var attributes=require(_0xd3a3('0x9'));module[_0xd3a3('0xa')]=function(_0x540bc4,_0x129902){return _0x540bc4['define'](_0xd3a3('0xb'),attributes,{'tableName':_0xd3a3('0xc'),'paranoid':![],'indexes':[{'name':_0xd3a3('0xd'),'fields':[_0xd3a3('0xe'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x30bdd6,_0x4e7bf5,_0x504883){if(_0x30bdd6[_0xd3a3('0xf')]){_0x30bdd6['substatusAt']=moment()[_0xd3a3('0x10')](_0xd3a3('0x11'));}if(_0x30bdd6[_0xd3a3('0x12')]){_0x30bdd6[_0xd3a3('0x13')]=moment()[_0xd3a3('0x10')](_0xd3a3('0x11'));}_0x504883(null,_0x4e7bf5);},'beforeUpdate':function(_0x1f822f,_0x2fc988,_0x501a2c){if(_0x1f822f['changed'](_0xd3a3('0xf'))){_0x1f822f['substatusAt']=_0x1f822f[_0xd3a3('0xf')]?moment()[_0xd3a3('0x10')](_0xd3a3('0x11')):null;}if(_0x1f822f[_0xd3a3('0x14')](_0xd3a3('0x12'))){_0x1f822f['closedAt']=moment()[_0xd3a3('0x10')](_0xd3a3('0x11'));_0x1f822f[_0xd3a3('0xf')]=null;_0x1f822f[_0xd3a3('0x15')]=null;}_0x501a2c(null,_0x1f822f);},'afterUpdate':function(_0x3228a4,_0x4b1db9,_0x10a03e){var _0x3767d4=_0x540bc4['models'];var _0x23bcf7=_0x3228a4[_0xd3a3('0x16')]({'plain':!![]});if(_0x23bcf7[_0xd3a3('0x12')]){return _0x3767d4['MailMessage'][_0xd3a3('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x23bcf7['id']}})[_0xd3a3('0x18')](function(){_0x10a03e();})[_0xd3a3('0x19')](function(_0x11c541){_0x10a03e(_0x11c541);});}else{_0x10a03e();}}},'charset':_0xd3a3('0x1a'),'collate':_0xd3a3('0x1b')});}; \ No newline at end of file +var _0x535c=['substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','models','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','./mailInteraction.attributes','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x535c,0xe4));var _0xc535=function(_0x5d1f9a,_0x3c75fd){_0x5d1f9a=_0x5d1f9a-0x0;var _0x864ff7=_0x535c[_0x5d1f9a];return _0x864ff7;};'use strict';var _=require(_0xc535('0x0'));var util=require(_0xc535('0x1'));var logger=require('../../config/logger')(_0xc535('0x2'));var moment=require('moment');var BPromise=require(_0xc535('0x3'));var rp=require(_0xc535('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc535('0x5'));module['exports']=function(_0x13ad20,_0x344068){return _0x13ad20['define'](_0xc535('0x6'),attributes,{'tableName':_0xc535('0x7'),'paranoid':![],'indexes':[{'name':_0xc535('0x8'),'fields':[_0xc535('0x9'),'to'],'type':_0xc535('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x192bb2,_0x91ac09,_0x4195f4){if(_0x192bb2[_0xc535('0xb')]){_0x192bb2[_0xc535('0xc')]=moment()[_0xc535('0xd')](_0xc535('0xe'));}if(_0x192bb2[_0xc535('0xf')]){_0x192bb2['closedAt']=moment()[_0xc535('0xd')](_0xc535('0xe'));}_0x4195f4(null,_0x91ac09);},'beforeUpdate':function(_0x42ddb2,_0x354b62,_0x238559){if(_0x42ddb2[_0xc535('0x10')](_0xc535('0xb'))){_0x42ddb2[_0xc535('0xc')]=_0x42ddb2[_0xc535('0xb')]?moment()[_0xc535('0xd')](_0xc535('0xe')):null;}if(_0x42ddb2['changed'](_0xc535('0xf'))){_0x42ddb2[_0xc535('0x11')]=moment()[_0xc535('0xd')](_0xc535('0xe'));_0x42ddb2[_0xc535('0xb')]=null;_0x42ddb2[_0xc535('0xc')]=null;}_0x238559(null,_0x42ddb2);},'afterUpdate':function(_0x28207b,_0x2e33d1,_0xad06da){var _0x4496b7=_0x13ad20[_0xc535('0x12')];var _0x3fe94e=_0x28207b['get']({'plain':!![]});if(_0x3fe94e[_0xc535('0xf')]){return _0x4496b7[_0xc535('0x13')][_0xc535('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x3fe94e['id']}})[_0xc535('0x15')](function(){_0xad06da();})['catch'](function(_0x536a7a){_0xad06da(_0x536a7a);});}else{_0xad06da();}}},'charset':_0xc535('0x16'),'collate':_0xc535('0x17')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index dd0e795..9bd765f 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 _0xdccd=['redis','localhost','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','limit','AddTagsToMailInteraction','find','where','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x12b405,_0x221eba){var _0x1124e9=function(_0x2bb159){while(--_0x2bb159){_0x12b405['push'](_0x12b405['shift']());}};_0x1124e9(++_0x221eba);}(_0xdccd,0x102));var _0xddcc=function(_0x12f468,_0x3373be){_0x12f468=_0x12f468-0x0;var _0x23f6e7=_0xdccd[_0x12f468];return _0x23f6e7;};'use strict';var _=require(_0xddcc('0x0'));var util=require(_0xddcc('0x1'));var moment=require(_0xddcc('0x2'));var BPromise=require(_0xddcc('0x3'));var rs=require(_0xddcc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xddcc('0x5'))['db'];var utils=require(_0xddcc('0x6'));var logger=require(_0xddcc('0x7'))(_0xddcc('0x8'));var config=require(_0xddcc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xddcc('0xa')][_0xddcc('0xb')]({'port':0x232a});config[_0xddcc('0xc')]=_['defaults'](config[_0xddcc('0xc')],{'host':_0xddcc('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xddcc('0xc')]));require(_0xddcc('0xe'))[_0xddcc('0xf')](socket);function respondWithRpcPromise(_0x88f89d,_0x2a5bec,_0xc00dd4){return new BPromise(function(_0x1f192d,_0x542795){return client[_0xddcc('0x10')](_0x88f89d,_0xc00dd4)[_0xddcc('0x11')](function(_0x416b57){logger['info'](_0xddcc('0x12'),_0x2a5bec,_0xddcc('0x13'));logger[_0xddcc('0x14')](_0xddcc('0x15'),_0x2a5bec,_0xddcc('0x13'),JSON[_0xddcc('0x16')](_0x416b57));if(_0x416b57[_0xddcc('0x17')]){if(_0x416b57['error'][_0xddcc('0x18')]===0x1f4){logger[_0xddcc('0x17')](_0xddcc('0x12'),_0x2a5bec,_0x416b57[_0xddcc('0x17')][_0xddcc('0x19')]);return _0x542795(_0x416b57[_0xddcc('0x17')][_0xddcc('0x19')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x2a5bec,_0x416b57[_0xddcc('0x17')][_0xddcc('0x19')]);return _0x1f192d(_0x416b57[_0xddcc('0x17')]['message']);}else{logger[_0xddcc('0x1a')](_0xddcc('0x12'),_0x2a5bec,'request\x20sent');_0x1f192d(_0x416b57[_0xddcc('0x1b')][_0xddcc('0x19')]);}})[_0xddcc('0x1c')](function(_0x178076){logger[_0xddcc('0x17')](_0xddcc('0x12'),_0x2a5bec,_0x178076);_0x542795(_0x178076);});});}exports[_0xddcc('0x1d')]=function(_0x15749a){var _0x5f119f=this;return new Promise(function(_0x51b22a,_0x1d488a){return db[_0xddcc('0x1e')][_0xddcc('0x1f')](_0x15749a[_0xddcc('0x20')],{'raw':_0x15749a[_0xddcc('0x21')]?_0x15749a[_0xddcc('0x21')][_0xddcc('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15749a[_0xddcc('0x21')]?_0x15749a[_0xddcc('0x21')]['where']||null:null,'attributes':_0x15749a['options']?_0x15749a[_0xddcc('0x21')][_0xddcc('0x23')]||null:null,'limit':_0x15749a[_0xddcc('0x21')]?_0x15749a[_0xddcc('0x21')][_0xddcc('0x24')]||null:null})[_0xddcc('0x11')](function(_0x4a4ac1){logger[_0xddcc('0x1a')](_0xddcc('0x1d'),_0x15749a);logger[_0xddcc('0x14')]('UpdateMailInteraction',_0x15749a,JSON[_0xddcc('0x16')](_0x4a4ac1));_0x51b22a(_0x4a4ac1);})[_0xddcc('0x1c')](function(_0x3ae20d){logger[_0xddcc('0x17')](_0xddcc('0x1d'),_0x3ae20d[_0xddcc('0x19')],_0x15749a);_0x1d488a(_0x5f119f[_0xddcc('0x17')](0x1f4,_0x3ae20d[_0xddcc('0x19')]));});});};exports[_0xddcc('0x25')]=function(_0x1f7815){return new Promise(function(_0x1500ab,_0x3fcaee){return db[_0xddcc('0x1e')][_0xddcc('0x26')]({'where':_0x1f7815[_0xddcc('0x21')]?_0x1f7815[_0xddcc('0x21')][_0xddcc('0x27')]||null:null})[_0xddcc('0x11')](function(_0x25aab0){if(_0x25aab0){return _0x25aab0[_0xddcc('0x28')](_0x1f7815[_0xddcc('0x20')]['ids'],_[_0xddcc('0x29')](_0x1f7815[_0xddcc('0x20')],[_0xddcc('0x2a'),'id'])||{});}})[_0xddcc('0x2b')](function(_0x54641a){logger['info']('AddTags',_0x1f7815);logger[_0xddcc('0x14')](_0xddcc('0x2c'),_0x1f7815,JSON[_0xddcc('0x16')](_0x54641a));_0x1500ab(_0x54641a);})[_0xddcc('0x1c')](function(_0x4640d9){logger[_0xddcc('0x17')]('AddTags',_0x4640d9['message'],_0x1f7815);_0x3fcaee(_this['error'](0x1f4,_0x4640d9['message']));});});}; \ No newline at end of file +var _0x14b2=['localhost','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','MailInteraction','options','raw','where','attributes','limit','UpdateMailInteraction','debug','stringify','catch','AddTagsToMailInteraction','ids','omit','body','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults'];(function(_0x3dc86c,_0x9de6b0){var _0x30c8c0=function(_0x2be893){while(--_0x2be893){_0x3dc86c['push'](_0x3dc86c['shift']());}};_0x30c8c0(++_0x9de6b0);}(_0x14b2,0x1a1));var _0x214b=function(_0x2b44e3,_0x82a548){_0x2b44e3=_0x2b44e3-0x0;var _0x352473=_0x14b2[_0x2b44e3];return _0x352473;};'use strict';var _=require(_0x214b('0x0'));var util=require(_0x214b('0x1'));var moment=require('moment');var BPromise=require(_0x214b('0x2'));var rs=require(_0x214b('0x3'));var fs=require('fs');var Redis=require(_0x214b('0x4'));var db=require(_0x214b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x214b('0x6'))(_0x214b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x214b('0x8')][_0x214b('0x9')]({'port':0x232a});config[_0x214b('0xa')]=_[_0x214b('0xb')](config[_0x214b('0xa')],{'host':_0x214b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x214b('0xa')]));require('./mailInteraction.socket')[_0x214b('0xd')](socket);function respondWithRpcPromise(_0x53d959,_0x322c4c,_0x5256ad){return new BPromise(function(_0x5ccdfd,_0x4cae5e){return client[_0x214b('0xe')](_0x53d959,_0x5256ad)[_0x214b('0xf')](function(_0x49acef){logger[_0x214b('0x10')](_0x214b('0x11'),_0x322c4c,_0x214b('0x12'));logger['debug'](_0x214b('0x13'),_0x322c4c,'request\x20sent',JSON['stringify'](_0x49acef));if(_0x49acef[_0x214b('0x14')]){if(_0x49acef[_0x214b('0x14')][_0x214b('0x15')]===0x1f4){logger[_0x214b('0x14')](_0x214b('0x11'),_0x322c4c,_0x49acef[_0x214b('0x14')]['message']);return _0x4cae5e(_0x49acef[_0x214b('0x14')]['message']);}logger[_0x214b('0x14')](_0x214b('0x11'),_0x322c4c,_0x49acef[_0x214b('0x14')]['message']);return _0x5ccdfd(_0x49acef['error'][_0x214b('0x16')]);}else{logger['info'](_0x214b('0x11'),_0x322c4c,_0x214b('0x12'));_0x5ccdfd(_0x49acef['result'][_0x214b('0x16')]);}})['catch'](function(_0x44028f){logger[_0x214b('0x14')](_0x214b('0x11'),_0x322c4c,_0x44028f);_0x4cae5e(_0x44028f);});});}exports['UpdateMailInteraction']=function(_0x14c45c){var _0x1e80bc=this;return new Promise(function(_0x2dacc1,_0x3dc351){return db[_0x214b('0x17')]['update'](_0x14c45c['body'],{'raw':_0x14c45c[_0x214b('0x18')]?_0x14c45c[_0x214b('0x18')][_0x214b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14c45c[_0x214b('0x18')]?_0x14c45c['options'][_0x214b('0x1a')]||null:null,'attributes':_0x14c45c[_0x214b('0x18')]?_0x14c45c[_0x214b('0x18')][_0x214b('0x1b')]||null:null,'limit':_0x14c45c['options']?_0x14c45c[_0x214b('0x18')][_0x214b('0x1c')]||null:null})[_0x214b('0xf')](function(_0x220d38){logger[_0x214b('0x10')](_0x214b('0x1d'),_0x14c45c);logger[_0x214b('0x1e')](_0x214b('0x1d'),_0x14c45c,JSON[_0x214b('0x1f')](_0x220d38));_0x2dacc1(_0x220d38);})[_0x214b('0x20')](function(_0x2aaaf1){logger['error']('UpdateMailInteraction',_0x2aaaf1[_0x214b('0x16')],_0x14c45c);_0x3dc351(_0x1e80bc[_0x214b('0x14')](0x1f4,_0x2aaaf1[_0x214b('0x16')]));});});};exports[_0x214b('0x21')]=function(_0x49bed4){return new Promise(function(_0xf137ee,_0x787560){return db['MailInteraction']['find']({'where':_0x49bed4[_0x214b('0x18')]?_0x49bed4[_0x214b('0x18')][_0x214b('0x1a')]||null:null})['then'](function(_0x1b3a94){if(_0x1b3a94){return _0x1b3a94['addTags'](_0x49bed4['body'][_0x214b('0x22')],_[_0x214b('0x23')](_0x49bed4[_0x214b('0x24')],[_0x214b('0x22'),'id'])||{});}})[_0x214b('0x25')](function(_0x42a9d3){logger[_0x214b('0x10')](_0x214b('0x26'),_0x49bed4);logger['debug']('AddTags',_0x49bed4,JSON[_0x214b('0x1f')](_0x42a9d3));_0xf137ee(_0x42a9d3);})[_0x214b('0x20')](function(_0x131860){logger[_0x214b('0x14')]('AddTags',_0x131860['message'],_0x49bed4);_0x787560(_this[_0x214b('0x14')](0x1f4,_0x131860[_0x214b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 94d2603..a5a88a4 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 _0xe92e=['register','length','./mailInteraction.events','remove','update','emit','removeListener'];(function(_0x2465d1,_0x3ee732){var _0x1e5d3d=function(_0x555b97){while(--_0x555b97){_0x2465d1['push'](_0x2465d1['shift']());}};_0x1e5d3d(++_0x3ee732);}(_0xe92e,0x105));var _0xee92=function(_0x610ee3,_0x51f487){_0x610ee3=_0x610ee3-0x0;var _0x351601=_0xe92e[_0x610ee3];return _0x351601;};'use strict';var MailInteractionEvents=require(_0xee92('0x0'));var events=['save',_0xee92('0x1'),_0xee92('0x2')];function createListener(_0x1c6c3e,_0x4b555f){return function(_0xe0484a){_0x4b555f[_0xee92('0x3')](_0x1c6c3e,_0xe0484a);};}function removeListener(_0x2612ba,_0x933842){return function(){MailInteractionEvents[_0xee92('0x4')](_0x2612ba,_0x933842);};}exports[_0xee92('0x5')]=function(_0x33e0fa){for(var _0x5d1653=0x0,_0x42c6d2=events[_0xee92('0x6')];_0x5d1653<_0x42c6d2;_0x5d1653++){var _0x40b1ef=events[_0x5d1653];var _0x3aee73=createListener('mailInteraction:'+_0x40b1ef,_0x33e0fa);MailInteractionEvents['on'](_0x40b1ef,_0x3aee73);}}; \ No newline at end of file +var _0x42a5=['emit','removeListener','register','mailInteraction:','./mailInteraction.events','save','remove','update'];(function(_0x4a314a,_0x6c6a7c){var _0x5d1948=function(_0x58f22f){while(--_0x58f22f){_0x4a314a['push'](_0x4a314a['shift']());}};_0x5d1948(++_0x6c6a7c);}(_0x42a5,0x1b4));var _0x542a=function(_0x306f3b,_0x518ab3){_0x306f3b=_0x306f3b-0x0;var _0x3fc367=_0x42a5[_0x306f3b];return _0x3fc367;};'use strict';var MailInteractionEvents=require(_0x542a('0x0'));var events=[_0x542a('0x1'),_0x542a('0x2'),_0x542a('0x3')];function createListener(_0x31e361,_0x5e4c52){return function(_0x3eae2b){_0x5e4c52[_0x542a('0x4')](_0x31e361,_0x3eae2b);};}function removeListener(_0x1e044b,_0x483ff7){return function(){MailInteractionEvents[_0x542a('0x5')](_0x1e044b,_0x483ff7);};}exports[_0x542a('0x6')]=function(_0x432961){for(var _0x318356=0x0,_0x5acc67=events['length'];_0x318356<_0x5acc67;_0x318356++){var _0x1a3c52=events[_0x318356];var _0xacc7c2=createListener(_0x542a('0x7')+_0x1a3c52,_0x432961);MailInteractionEvents['on'](_0x1a3c52,_0xacc7c2);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 7694999..5d06ec2 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf17a=['../../components/auth/service','./mailInteractionHasTag.controller','get','/describe','express','Router'];(function(_0x263f21,_0x3fdf66){var _0x162854=function(_0x4c28d9){while(--_0x4c28d9){_0x263f21['push'](_0x263f21['shift']());}};_0x162854(++_0x3fdf66);}(_0xf17a,0x136));var _0xaf17=function(_0x1a7bf3,_0x15216f){_0x1a7bf3=_0x1a7bf3-0x0;var _0x4f615b=_0xf17a[_0x1a7bf3];return _0x4f615b;};'use strict';var express=require(_0xaf17('0x0'));var router=express[_0xaf17('0x1')]();var auth=require(_0xaf17('0x2'));var controller=require(_0xaf17('0x3'));router[_0xaf17('0x4')](_0xaf17('0x5'),auth['isAuthenticated'](),controller['describe']);module['exports']=router; \ No newline at end of file +var _0xed5f=['isAuthenticated','describe','exports','Router','../../components/auth/service','./mailInteractionHasTag.controller','/describe'];(function(_0x317f00,_0x2dfa1d){var _0x8c178b=function(_0x28cd88){while(--_0x28cd88){_0x317f00['push'](_0x317f00['shift']());}};_0x8c178b(++_0x2dfa1d);}(_0xed5f,0x1e6));var _0xfed5=function(_0x26c0d8,_0x2c7c2d){_0x26c0d8=_0x26c0d8-0x0;var _0x1fffff=_0xed5f[_0x26c0d8];return _0x1fffff;};'use strict';var express=require('express');var router=express[_0xfed5('0x0')]();var auth=require(_0xfed5('0x1'));var controller=require(_0xfed5('0x2'));router['get'](_0xfed5('0x3'),auth[_0xfed5('0x4')](),controller[_0xfed5('0x5')]);module[_0xfed5('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 40903e0..5b5765f 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x2e9e2b,_0x21c9dd){var _0x4132e4=function(_0x528a37){while(--_0x528a37){_0x2e9e2b['push'](_0x2e9e2b['shift']());}};_0x4132e4(++_0x21c9dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x592702,_0x5a6dc6){var _0x3eea51=function(_0x1d2115){while(--_0x1d2115){_0x592702['push'](_0x592702['shift']());}};_0x3eea51(++_0x5a6dc6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 2fc5fd5..6770d90 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd526=['INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd526,0x15d));var _0x6d52=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xd526[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x6d52('0x0'));module['exports']={'MailInteractionId':{'type':Sequelize[_0x6d52('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0x87ad=['sequelize','exports','INTEGER'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x87ad,0x66));var _0xd87a=function(_0x571528,_0x2f3797){_0x571528=_0x571528-0x0;var _0x54464d=_0x87ad[_0x571528];return _0x54464d;};'use strict';var Sequelize=require(_0xd87a('0x0'));module[_0xd87a('0x1')]={'MailInteractionId':{'type':Sequelize[_0xd87a('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xd87a('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 225e6b7..c5d3a65 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d66=['exports','define','MailInteractionHasTag','mail_interaction_has_tags'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x9d66,0xac));var _0x69d6=function(_0x2ec6c6,_0x5cacca){_0x2ec6c6=_0x2ec6c6-0x0;var _0x38e3ed=_0x9d66[_0x2ec6c6];return _0x38e3ed;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0x69d6('0x0')]=function(_0x41e60a){return _0x41e60a[_0x69d6('0x1')](_0x69d6('0x2'),attributes,{'tableName':_0x69d6('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x610d=['exports','define'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x610d,0x192));var _0xd610=function(_0x1dd284,_0x4a920c){_0x1dd284=_0x1dd284-0x0;var _0x54374d=_0x610d[_0x1dd284];return _0x54374d;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0xd610('0x0')]=function(_0x5060e5){return _0x5060e5[_0xd610('0x1')]('MailInteractionHasTag',attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index c062ed8..fb8c148 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 _0x08e5=['update','put','/:id/accept','accept','/:id/reject','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','tracked','create'];(function(_0x1c9b1f,_0x5414b6){var _0x3f531e=function(_0x5dce8a){while(--_0x5dce8a){_0x1c9b1f['push'](_0x1c9b1f['shift']());}};_0x3f531e(++_0x5414b6);}(_0x08e5,0x1a9));var _0x508e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x08e5[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x508e('0x0'));var util=require(_0x508e('0x1'));var path=require('path');var timeout=require(_0x508e('0x2'));var express=require(_0x508e('0x3'));var router=express[_0x508e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x508e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0x508e('0x6')]('/',auth[_0x508e('0x7')](),controller['index']);router[_0x508e('0x6')](_0x508e('0x8'),auth[_0x508e('0x7')](),controller[_0x508e('0x9')]);router[_0x508e('0x6')](_0x508e('0xa'),auth[_0x508e('0x7')](),controller[_0x508e('0xb')]);router[_0x508e('0x6')](_0x508e('0xc'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x508e('0x7')](),interaction[_0x508e('0xd')]('mail','mailmessage:create'),controller[_0x508e('0xe')]);router['put'](_0x508e('0xa'),auth[_0x508e('0x7')](),controller[_0x508e('0xf')]);router[_0x508e('0x10')](_0x508e('0x11'),auth[_0x508e('0x7')](),controller[_0x508e('0x12')]);router[_0x508e('0x10')](_0x508e('0x13'),auth['isAuthenticated'](),controller['reject']);router[_0x508e('0x14')](_0x508e('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x508e('0x15')]=router; \ No newline at end of file +var _0x89c4=['post','tracked','mail','create','/:id','put','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id/download','download'];(function(_0x294239,_0x3f5997){var _0x38f97d=function(_0x5ac50c){while(--_0x5ac50c){_0x294239['push'](_0x294239['shift']());}};_0x38f97d(++_0x3f5997);}(_0x89c4,0x82));var _0x489c=function(_0x5a225b,_0x1de1a1){_0x5a225b=_0x5a225b-0x0;var _0x1d5aab=_0x89c4[_0x5a225b];return _0x1d5aab;};'use strict';var multer=require(_0x489c('0x0'));var util=require(_0x489c('0x1'));var path=require('path');var timeout=require(_0x489c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x489c('0x3'));var auth=require(_0x489c('0x4'));var interaction=require(_0x489c('0x5'));var config=require(_0x489c('0x6'));var controller=require(_0x489c('0x7'));router[_0x489c('0x8')]('/',auth[_0x489c('0x9')](),controller['index']);router[_0x489c('0x8')](_0x489c('0xa'),auth[_0x489c('0x9')](),controller[_0x489c('0xb')]);router['get']('/:id',auth[_0x489c('0x9')](),controller['show']);router[_0x489c('0x8')](_0x489c('0xc'),auth[_0x489c('0x9')](),controller[_0x489c('0xd')]);router[_0x489c('0xe')]('/',auth[_0x489c('0x9')](),interaction[_0x489c('0xf')](_0x489c('0x10'),'mailmessage:create'),controller[_0x489c('0x11')]);router['put'](_0x489c('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x489c('0x13')]('/:id/accept',auth[_0x489c('0x9')](),controller['accept']);router[_0x489c('0x13')](_0x489c('0x14'),auth['isAuthenticated'](),controller[_0x489c('0x15')]);router[_0x489c('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x489c('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index c04e123..4fc494c 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 _0x07a5=['ENUM','STRING','TEXT','DATE','INTEGER','BOOLEAN','Email','lodash','exports','long','medium'];(function(_0x3daba9,_0x424886){var _0x310987=function(_0x5dcc9a){while(--_0x5dcc9a){_0x3daba9['push'](_0x3daba9['shift']());}};_0x310987(++_0x424886);}(_0x07a5,0x96));var _0x507a=function(_0x5d50d7,_0x339501){_0x5d50d7=_0x5d50d7-0x0;var _0x4acb68=_0x07a5[_0x5d50d7];return _0x4acb68;};'use strict';var Sequelize=require('sequelize');var _=require(_0x507a('0x0'));module[_0x507a('0x1')]={'body':{'type':Sequelize['TEXT'](_0x507a('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x507a('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x507a('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x507a('0x5')](0x1fe)},'from':{'type':Sequelize[_0x507a('0x5')]},'to':{'type':Sequelize[_0x507a('0x6')](_0x507a('0x2'))},'cc':{'type':Sequelize[_0x507a('0x6')](_0x507a('0x2'))},'bcc':{'type':Sequelize[_0x507a('0x6')](_0x507a('0x2'))},'subject':{'type':Sequelize[_0x507a('0x6')]},'sentAt':{'type':Sequelize[_0x507a('0x7')]},'attach':{'type':Sequelize[_0x507a('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x507a('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x507a('0x6')](_0x507a('0x2'))},'originCc':{'type':Sequelize[_0x507a('0x6')](_0x507a('0x2'))},'originChannel':{'type':Sequelize[_0x507a('0x4')](_0x507a('0xa'),'Chat'),'defaultValue':_0x507a('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x0459=['DATE','ENUM','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','out','STRING'];(function(_0x5a304e,_0x35ebc8){var _0x403034=function(_0x45f3b2){while(--_0x45f3b2){_0x5a304e['push'](_0x5a304e['shift']());}};_0x403034(++_0x35ebc8);}(_0x0459,0x12f));var _0x9045=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x0459[_0x1e3c16];return _0x47a0c9;};'use strict';var Sequelize=require(_0x9045('0x0'));var _=require(_0x9045('0x1'));module[_0x9045('0x2')]={'body':{'type':Sequelize[_0x9045('0x3')](_0x9045('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9045('0x3')](_0x9045('0x5'))},'read':{'type':Sequelize[_0x9045('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9045('0x7')),'defaultValue':_0x9045('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9045('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x9045('0x3')](_0x9045('0x4'))},'cc':{'type':Sequelize[_0x9045('0x3')](_0x9045('0x4'))},'bcc':{'type':Sequelize[_0x9045('0x3')](_0x9045('0x4'))},'subject':{'type':Sequelize[_0x9045('0x3')]},'sentAt':{'type':Sequelize[_0x9045('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9045('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0x9045('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0x9045('0x4'))},'originChannel':{'type':Sequelize[_0x9045('0xa')](_0x9045('0xb'),_0x9045('0xc')),'defaultValue':_0x9045('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 4a43a54..cdea3f9 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 _0xc26a=['map','MailMessage','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','body','destroy','describe','create','direction','out','secret','split','MailAccount','findOne','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','acceptMessage','reject','UserId','user','agent','get','MailInteraction','MailInteractionId','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','email','interface','channel','event','fromString','EventManager','rejectmessage','unix','toString','server','files','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','writeFileSync','download','unlinkSync','moment','util','path','lodash','ioredis','html-to-text','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','html-entities','./mailMessage.socket','register','jayson/promise','client','http','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','stack','name','send','index'];(function(_0x5e9326,_0x28038a){var _0x3654b6=function(_0x43b044){while(--_0x43b044){_0x5e9326['push'](_0x5e9326['shift']());}};_0x3654b6(++_0x28038a);}(_0xc26a,0x103));var _0xac26=function(_0x1177d5,_0x22b649){_0x1177d5=_0x1177d5-0x0;var _0xc3ddc2=_0xc26a[_0x1177d5];return _0xc3ddc2;};'use strict';var emlformat=require('eml-format');var moment=require(_0xac26('0x0'));var util=require(_0xac26('0x1'));var path=require(_0xac26('0x2'));var fs=require('fs');var _=require(_0xac26('0x3'));var Redis=require(_0xac26('0x4'));var htmlToText=require(_0xac26('0x5'));var interactionService=require(_0xac26('0x6'));var qs=require(_0xac26('0x7'));var logger=require(_0xac26('0x8'))(_0xac26('0x9'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require('../../config/environment');var db=require(_0xac26('0xa'))['db'];config[_0xac26('0xb')]=_[_0xac26('0xc')](config[_0xac26('0xb')],{'host':_0xac26('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac26('0xb')]));var htmlEntities=require(_0xac26('0xe'));require(_0xac26('0xf'))[_0xac26('0x10')](socket);var jayson=require(_0xac26('0x11'));var client=jayson[_0xac26('0x12')]['http']({'port':0x232c});var client9003=jayson[_0xac26('0x12')][_0xac26('0x13')]({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35602a,_0xa659e3,_0x4d4162,_0x425380){return new Promise(function(_0x27106e,_0x4a9c5d){var _0x8ef42d=_0x425380||client;return _0x8ef42d['request'](_0x35602a,_0x4d4162)['then'](function(_0x4cbfad){logger[_0xac26('0x14')](_0xac26('0x15'),_0xa659e3,_0xac26('0x16'));logger[_0xac26('0x17')]('MailMessage,\x20%s,\x20%s,\x20%s',_0xa659e3,_0xac26('0x16'),JSON[_0xac26('0x18')](_0x4cbfad));if(_0x4cbfad[_0xac26('0x19')]){if(_0x4cbfad['error'][_0xac26('0x1a')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0xa659e3,_0x4cbfad[_0xac26('0x19')]['message']);return _0x4a9c5d(_0x4cbfad['error'][_0xac26('0x1b')]);}logger['error'](_0xac26('0x15'),_0xa659e3,_0x4cbfad[_0xac26('0x19')][_0xac26('0x1b')]);return _0x27106e(_0x4cbfad[_0xac26('0x19')][_0xac26('0x1b')]);}else{logger[_0xac26('0x14')]('MailMessage,\x20%s,\x20%s',_0xa659e3,'request\x20sent');_0x27106e(_0x4cbfad[_0xac26('0x1c')][_0xac26('0x1b')]);}})[_0xac26('0x1d')](function(_0x2bd35f){logger[_0xac26('0x19')](_0xac26('0x15'),_0xa659e3,_0x2bd35f);_0x4a9c5d(_0x2bd35f);});});}function respondWithResult(_0x533cd6,_0x55c3ef){_0x55c3ef=_0x55c3ef||0xc8;return function(_0x27edd){if(_0x27edd){return _0x533cd6[_0xac26('0x1e')](_0x55c3ef)[_0xac26('0x1f')](_0x27edd);}};}function respondWithFilteredResult(_0x3f2219,_0x56e1f4){return function(_0x429c08){if(_0x429c08){var _0x17851c=typeof _0x56e1f4[_0xac26('0x20')]===_0xac26('0x21')&&typeof _0x56e1f4[_0xac26('0x22')]===_0xac26('0x21');var _0x50e88c=_0x429c08[_0xac26('0x23')];var _0x39f82b=_0x17851c?0x0:_0x56e1f4[_0xac26('0x20')];var _0x934c71=_0x17851c?_0x429c08[_0xac26('0x23')]:_0x56e1f4[_0xac26('0x20')]+_0x56e1f4[_0xac26('0x22')];var _0x280b97;if(_0x934c71>=_0x50e88c){_0x934c71=_0x50e88c;_0x280b97=0xc8;}else{_0x280b97=0xce;}_0x3f2219[_0xac26('0x1e')](_0x280b97);return _0x3f2219[_0xac26('0x24')](_0xac26('0x25'),_0x39f82b+'-'+_0x934c71+'/'+_0x50e88c)['json'](_0x429c08);}return null;};}function saveUpdates(_0x31aeed){return function(_0x537fd3){if(_0x537fd3){return _0x537fd3[_0xac26('0x26')](_0x31aeed)[_0xac26('0x27')](function(_0xbb652f){return _0xbb652f;});}return null;};}function removeEntity(_0x214f45){return function(_0x49a3a5){if(_0x49a3a5){return _0x49a3a5['destroy']()[_0xac26('0x27')](function(){_0x214f45[_0xac26('0x1e')](0xcc)[_0xac26('0x28')]();});}};}function handleEntityNotFound(_0x7dfa67){return function(_0x3b3fef){if(!_0x3b3fef){_0x7dfa67['sendStatus'](0x194);}return _0x3b3fef;};}function handleError(_0x26ec81,_0x521c98){_0x521c98=_0x521c98||0x1f4;return function(_0x5c6662){logger[_0xac26('0x19')](_0x5c6662[_0xac26('0x29')]);if(_0x5c6662[_0xac26('0x2a')]){delete _0x5c6662[_0xac26('0x2a')];}_0x26ec81['status'](_0x521c98)[_0xac26('0x2b')](_0x5c6662);};}exports[_0xac26('0x2c')]=function(_0x45b653,_0x4014f8){var _0xb5009f={},_0x1b33f3={},_0x3d0912={'count':0x0,'rows':[]};var _0x4c84ce=_[_0xac26('0x2d')](db[_0xac26('0x2e')]['rawAttributes'],function(_0x8ea2de){return{'name':_0x8ea2de[_0xac26('0x2f')],'type':_0x8ea2de[_0xac26('0x30')][_0xac26('0x31')]};});_0x1b33f3[_0xac26('0x32')]=_[_0xac26('0x2d')](_0x4c84ce,_0xac26('0x2a'));_0x1b33f3[_0xac26('0x33')]=_[_0xac26('0x34')](_0x45b653[_0xac26('0x33')]);_0x1b33f3[_0xac26('0x35')]=_['intersection'](_0x1b33f3[_0xac26('0x32')],_0x1b33f3[_0xac26('0x33')]);_0xb5009f[_0xac26('0x36')]=_[_0xac26('0x37')](_0x1b33f3[_0xac26('0x32')],qs[_0xac26('0x38')](_0x45b653[_0xac26('0x33')][_0xac26('0x38')]));_0xb5009f['attributes']=_0xb5009f[_0xac26('0x36')][_0xac26('0x39')]?_0xb5009f[_0xac26('0x36')]:_0x1b33f3['model'];if(!_0x45b653[_0xac26('0x33')][_0xac26('0x3a')](_0xac26('0x3b'))){_0xb5009f['limit']=qs[_0xac26('0x22')](_0x45b653[_0xac26('0x33')][_0xac26('0x22')]);_0xb5009f['offset']=qs[_0xac26('0x20')](_0x45b653[_0xac26('0x33')]['offset']);}_0xb5009f[_0xac26('0x3c')]=qs[_0xac26('0x3d')](_0x45b653[_0xac26('0x33')]['sort']);_0xb5009f['where']=qs['filters'](_['pick'](_0x45b653[_0xac26('0x33')],_0x1b33f3[_0xac26('0x35')]),_0x4c84ce);if(_0x45b653[_0xac26('0x33')][_0xac26('0x3e')]){_0xb5009f[_0xac26('0x3f')]=_[_0xac26('0x40')](_0xb5009f[_0xac26('0x3f')],{'$or':_[_0xac26('0x2d')](_0x4c84ce,function(_0x8693f7){if(_0x8693f7[_0xac26('0x30')]!==_0xac26('0x41')){var _0x35df68={};_0x35df68[_0x8693f7[_0xac26('0x2a')]]={'$like':'%'+_0x45b653[_0xac26('0x33')][_0xac26('0x3e')]+'%'};return _0x35df68;}})});}_0xb5009f=_['merge']({},_0xb5009f,_0x45b653['options']);var _0x34ac9d={'where':_0xb5009f['where']};return db[_0xac26('0x2e')][_0xac26('0x23')](_0x34ac9d)[_0xac26('0x27')](function(_0x217f61){_0x3d0912[_0xac26('0x23')]=_0x217f61;if(_0x45b653[_0xac26('0x33')][_0xac26('0x42')]){_0xb5009f[_0xac26('0x43')]=[{'all':!![]}];}return db['MailMessage'][_0xac26('0x44')](_0xb5009f);})[_0xac26('0x27')](function(_0x1294ee){_0x3d0912[_0xac26('0x45')]=_0x1294ee;return _0x3d0912;})[_0xac26('0x27')](respondWithFilteredResult(_0x4014f8,_0xb5009f))[_0xac26('0x1d')](handleError(_0x4014f8,null));};exports[_0xac26('0x46')]=function(_0x5b52c0,_0x53732c){var _0x51ddcc={'raw':!![],'where':{'id':_0x5b52c0[_0xac26('0x47')]['id']}},_0x4fdfc1={};_0x4fdfc1[_0xac26('0x32')]=_[_0xac26('0x34')](db['MailMessage']['rawAttributes']);_0x4fdfc1[_0xac26('0x33')]=_[_0xac26('0x34')](_0x5b52c0[_0xac26('0x33')]);_0x4fdfc1[_0xac26('0x35')]=_[_0xac26('0x37')](_0x4fdfc1[_0xac26('0x32')],_0x4fdfc1[_0xac26('0x33')]);_0x51ddcc[_0xac26('0x36')]=_[_0xac26('0x37')](_0x4fdfc1[_0xac26('0x32')],qs[_0xac26('0x38')](_0x5b52c0[_0xac26('0x33')][_0xac26('0x38')]));_0x51ddcc['attributes']=_0x51ddcc[_0xac26('0x36')][_0xac26('0x39')]?_0x51ddcc['attributes']:_0x4fdfc1[_0xac26('0x32')];if(_0x5b52c0[_0xac26('0x33')][_0xac26('0x42')]){_0x51ddcc[_0xac26('0x43')]=[{'all':!![]}];}_0x51ddcc=_[_0xac26('0x40')]({},_0x51ddcc,_0x5b52c0[_0xac26('0x48')]);return db[_0xac26('0x2e')][_0xac26('0x49')](_0x51ddcc)[_0xac26('0x27')](handleEntityNotFound(_0x53732c,null))[_0xac26('0x27')](respondWithResult(_0x53732c,null))[_0xac26('0x1d')](handleError(_0x53732c,null));};exports['update']=function(_0x12bf7a,_0x270ee5){if(_0x12bf7a[_0xac26('0x4a')]['id']){delete _0x12bf7a[_0xac26('0x4a')]['id'];}return db['MailMessage'][_0xac26('0x49')]({'where':{'id':_0x12bf7a[_0xac26('0x47')]['id']}})[_0xac26('0x27')](handleEntityNotFound(_0x270ee5,null))[_0xac26('0x27')](saveUpdates(_0x12bf7a[_0xac26('0x4a')],null))[_0xac26('0x27')](respondWithResult(_0x270ee5,null))[_0xac26('0x1d')](handleError(_0x270ee5,null));};exports[_0xac26('0x4b')]=function(_0x2aa7ae,_0xa2ff5b){return db[_0xac26('0x2e')]['find']({'where':{'id':_0x2aa7ae[_0xac26('0x47')]['id']}})[_0xac26('0x27')](handleEntityNotFound(_0xa2ff5b,null))['then'](removeEntity(_0xa2ff5b,null))[_0xac26('0x1d')](handleError(_0xa2ff5b,null));};exports[_0xac26('0x4c')]=function(_0xdd33b8,_0x2f8fa4){return db[_0xac26('0x2e')][_0xac26('0x4c')]()[_0xac26('0x27')](respondWithResult(_0x2f8fa4,null))[_0xac26('0x1d')](handleError(_0x2f8fa4,null));};exports[_0xac26('0x4d')]=function(_0x368b3a,_0x551132){return db[_0xac26('0x2e')][_0xac26('0x4d')](_0x368b3a[_0xac26('0x4a')])[_0xac26('0x27')](function(_0x57f037){if(_0x57f037){if(_0x57f037[_0xac26('0x4e')]===_0xac26('0x4f')&&!_0x57f037[_0xac26('0x50')]){var _0x164bac,_0x3eee4c,_0x103bd5;if(_0x368b3a[_0xac26('0x4a')]['to']){_0x3eee4c=_0x368b3a['body']['to'][_0xac26('0x51')](',')[0x0];}return db[_0xac26('0x52')][_0xac26('0x53')]({'where':{'id':_0x57f037['MailAccountId']},'include':[{'model':db[_0xac26('0x54')],'as':_0xac26('0x55'),'include':[{'model':db['CmContact'],'as':_0xac26('0x56'),'where':{'email':_0x3eee4c},'limit':0x1,'order':[[_0xac26('0x57'),_0xac26('0x58')]]}]},{'model':db[_0xac26('0x59')],'as':_0xac26('0x5a'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xac26('0x5b'),'raw':!![]}]}]})[_0xac26('0x27')](function(_0x25d166){_0x164bac=_0x25d166;if(!_0x164bac||!_0x164bac[_0xac26('0x5a')])return;var _0x25a34f=_0x164bac[_0xac26('0x5c')]();if(_0x368b3a['body']['attachments']&&_0x368b3a[_0xac26('0x4a')][_0xac26('0x5d')][_0xac26('0x39')]){for(var _0x23b03b=0x0;_0x23b03b<_0x368b3a['body'][_0xac26('0x5d')][_0xac26('0x39')];_0x23b03b+=0x1){_0x368b3a[_0xac26('0x4a')][_0xac26('0x5d')][_0x23b03b]={'filename':_0x368b3a[_0xac26('0x4a')][_0xac26('0x5d')][_0x23b03b]['name'],'path':path[_0xac26('0x5e')](config[_0xac26('0x5f')],'server/files/attachments',_0x368b3a[_0xac26('0x4a')][_0xac26('0x5d')][_0x23b03b][_0xac26('0x60')])};}}_0x103bd5={'account':_0x25a34f,'message':_0x368b3a[_0xac26('0x4a')]};return;})[_0xac26('0x27')](function(){if(_0x164bac[_0xac26('0x55')]){if(_0x164bac['List']['Contacts'][_0xac26('0x39')]){return _0x164bac[_0xac26('0x55')]['Contacts'][0x0];}else{return db[_0xac26('0x61')][_0xac26('0x4d')](_['defaults'](_0x368b3a[_0xac26('0x4a')],{'firstName':_0x368b3a[_0xac26('0x4a')]['to'],'email':_0x368b3a[_0xac26('0x4a')]['to'],'phone':_0x368b3a[_0xac26('0x4a')]['to'],'ListId':_0x164bac[_0xac26('0x62')]}));}}else{throw new Error(_0xac26('0x63'));}})['then'](function(){if(_0x103bd5){return respondWithRpcPromise(_0xac26('0x64'),_0xac26('0x65'),_0x103bd5,client9003)[_0xac26('0x27')](function(_0xc76ed){return _0x57f037['update']({'read':!![],'messageId':_0xc76ed[_0xac26('0x66')],'sentAt':moment()[_0xac26('0x67')](_0xac26('0x68'))});})['catch'](function(_0x3f4726){logger['error']('%s',JSON[_0xac26('0x18')](_0x3f4726));return _0x57f037;});}return _0x57f037;});}return _0x57f037;}})[_0xac26('0x27')](respondWithResult(_0x551132,0xc9))[_0xac26('0x1d')](handleError(_0x551132,null));};exports[_0xac26('0x69')]=function(_0x430877,_0x4724b4){var _0x43f7ce=_0xac26('0x6a');return interactionService[_0xac26('0x6b')](_0x430877,_0x43f7ce)[_0xac26('0x27')](respondWithResult(_0x4724b4,null))[_0xac26('0x1d')](handleError(_0x4724b4,null));};exports[_0xac26('0x6c')]=function(_0x43a1c0,_0x5327c7){var _0xa9056d={'agent':{},'channel':_0xac26('0x6a')};if(_0x43a1c0[_0xac26('0x4a')]['id']){delete _0x43a1c0[_0xac26('0x4a')]['id'];}_0x43a1c0['body'][_0xac26('0x6d')]=_0x43a1c0[_0xac26('0x4a')][_0xac26('0x6d')]||_0x43a1c0[_0xac26('0x6e')]['id'];_0xa9056d[_0xac26('0x6f')]['id']=_0x43a1c0[_0xac26('0x4a')][_0xac26('0x6d')];return db[_0xac26('0x2e')][_0xac26('0x49')]({'where':{'id':_0x43a1c0[_0xac26('0x47')]['id'],'UserId':null}})[_0xac26('0x27')](handleEntityNotFound(_0x5327c7,null))[_0xac26('0x27')](function(_0x581afe){if(_0x581afe){_0xa9056d[_0xac26('0x1b')]=_0x581afe[_0xac26('0x70')]({'plain':!![]});return db[_0xac26('0x71')]['find']({'where':{'id':_0x581afe[_0xac26('0x72')]}});}return null;})[_0xac26('0x27')](handleEntityNotFound(_0x5327c7,null))[_0xac26('0x27')](function(_0x1f9415){if(_0x1f9415){_0xa9056d[_0xac26('0x73')]=_0x1f9415[_0xac26('0x70')]({'plain':!![]});interaction_log[_0xac26('0x14')](_0xac26('0x74'),_0x43a1c0['user']['id'],_0x43a1c0['user'][_0xac26('0x2a')],_0x43a1c0['user'][_0xac26('0x75')],_0xa9056d[_0xac26('0x73')]['id'],_0x43a1c0[_0xac26('0x4a')]?JSON[_0xac26('0x18')](_0x43a1c0[_0xac26('0x4a')]):_0xac26('0x76'));return respondWithRpcPromise('RejectMessage',_0xac26('0x77'),_0xa9056d);}return null;})[_0xac26('0x27')](function(_0x3de492){var _0xa2c6e0=_0xac26('0x78')+_0x3de492[_0xac26('0x1b')][_0xac26('0x79')];return db[_0xac26('0x7a')][_0xac26('0x33')](_0xa2c6e0,{'type':db['Sequelize'][_0xac26('0x7b')]['SELECT'],'raw':!![]})['then'](function(_0x5aca66){return _0x5aca66;});})['then'](function(_0x527211){if(_0x527211){_0xa9056d[_0xac26('0x1b')][_0xac26('0x7c')]=_0x527211[0x0];if(!_0x43a1c0[_0xac26('0x4a')][_0xac26('0x6d')])return;return db[_0xac26('0x7d')]['find']({'where':{'id':_0x43a1c0['body'][_0xac26('0x6d')],'role':_0xac26('0x6f')},'attributes':['id','name','fullname',_0xac26('0x7e'),'internal'],'raw':!![]});}return null;})[_0xac26('0x27')](function(_0x36bd76){if(!_0x36bd76)return null;_0xa9056d[_0xac26('0x1b')][_0xac26('0x6f')]=_0x36bd76;return _0xa9056d;})[_0xac26('0x27')](function(_0x5ed7d9){if(_0x5ed7d9){_0x5ed7d9['message'][_0xac26('0x7f')]=util['format']('SIP/%s',_0x43a1c0['user'][_0xac26('0x2a')]);_0x5ed7d9[_0xac26('0x1b')][_0xac26('0x80')]=_0xa9056d[_0xac26('0x80')];_0x5ed7d9[_0xac26('0x1b')]['motionChannel']=_0xa9056d[_0xac26('0x80')];_0x5ed7d9[_0xac26('0x1b')][_0xac26('0x81')]=_0xac26('0x6c');_0x5ed7d9[_0xac26('0x1b')][_0xac26('0x4a')]=htmlToText[_0xac26('0x82')](_0xa9056d[_0xac26('0x1b')]['body']);respondWithRpcPromise('EventManager',_0xac26('0x83'),{'event':_0xac26('0x84'),'message':_0x5ed7d9[_0xac26('0x1b')]},client9002);return _0xa9056d;}return null;})[_0xac26('0x27')](respondWithResult(_0x5327c7,null))[_0xac26('0x1d')](handleError(_0x5327c7,null));};exports['download']=function(_0x92110b,_0x3beb2b){var _0x4ac939=moment()[_0xac26('0x85')]()[_0xac26('0x86')]();var _0x113f2c=path[_0xac26('0x5e')](config[_0xac26('0x5f')],_0xac26('0x87'),_0xac26('0x88'),'tmp');var _0x5b01c3=path['join'](config[_0xac26('0x5f')],_0xac26('0x87'),'files',_0xac26('0x5d'));var _0x1b3102=util['format']('message-%s.eml',_0x4ac939);return db[_0xac26('0x2e')][_0xac26('0x49')]({'where':{'id':_0x92110b[_0xac26('0x47')]['id']},'attributes':['id','body',_0xac26('0x89'),'to','cc',_0xac26('0x8a'),_0xac26('0x8b'),_0xac26('0x8c')],'include':_0x92110b[_0xac26('0x33')][_0xac26('0x5d')]?[{'model':db[_0xac26('0x8d')],'as':_0xac26('0x8e')}]:undefined})[_0xac26('0x27')](handleEntityNotFound(_0x3beb2b,null))[_0xac26('0x27')](function(_0x399604){if(_0x399604){var _0x4dbb78=_0x399604;var _0x3b4a34={'from':_0x4dbb78[_0xac26('0x89')],'to':_0x4dbb78['to'],'subject':_0x4dbb78[_0xac26('0x8b')],'html':htmlEntities['decode'](_0x4dbb78[_0xac26('0x4a')]),'headers':{'Date':moment(_0x4dbb78['createdAt'])[_0xac26('0x67')](_0xac26('0x8f'))},'attachments':[]};if(_0x399604['cc']){_0x3b4a34[_0xac26('0x90')]['Cc']=_0x399604['cc'];}if(_0x399604[_0xac26('0x8a')]){_0x3b4a34[_0xac26('0x90')][_0xac26('0x91')]=_0x399604[_0xac26('0x8a')];}return new Promise(function(_0x48e5db,_0xc971f7){if(_0x399604['Attachments']){for(var _0x5cf33b=0x0;_0x5cf33b<_0x399604[_0xac26('0x8e')][_0xac26('0x39')];_0x5cf33b++){var _0xbdc13a=_0x399604[_0xac26('0x8e')][_0x5cf33b];var _0x3ebf0d=path[_0xac26('0x5e')](_0x5b01c3,_0xbdc13a[_0xac26('0x60')]);if(fs[_0xac26('0x92')](_0x3ebf0d)){_0x3b4a34['attachments'][_0xac26('0x93')]({'name':_0xbdc13a[_0xac26('0x2a')],'contentType':_0xbdc13a[_0xac26('0x30')],'data':fs[_0xac26('0x94')](_0x3ebf0d)});}}}emlformat['build'](_0x3b4a34,function(_0x234239,_0x311406){if(_0x234239)return _0xc971f7(_0x234239);fs[_0xac26('0x95')](path[_0xac26('0x5e')](_0x113f2c,_0x1b3102),_0x311406);return _0x48e5db(_0x311406);});});}})[_0xac26('0x27')](function(_0x1a53af){if(_0x1a53af){return _0x3beb2b[_0xac26('0x96')](path['join'](_0x113f2c,_0x1b3102),_0x1b3102,function(_0x4cf2c0){if(!_0x4cf2c0)fs[_0xac26('0x97')](path[_0xac26('0x5e')](_0x113f2c,_0x1b3102));});}})[_0xac26('0x1d')](handleError(_0x3beb2b,null));}; \ No newline at end of file +var _0x8038=['lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','undefined','count','offset','limit','set','destroy','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','update','describe','create','out','secret','body','MailAccount','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','acceptMessage','UserId','user','agent','get','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','interface','SIP/%s','channel','event','reject','fromString','EventManager','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','Attachment','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','existsSync','readFileSync','build','writeFileSync','unlinkSync','moment'];(function(_0x312f7a,_0x25dbca){var _0x496c0c=function(_0x509756){while(--_0x509756){_0x312f7a['push'](_0x312f7a['shift']());}};_0x496c0c(++_0x25dbca);}(_0x8038,0x1af));var _0x8803=function(_0x4d44f7,_0x27147b){_0x4d44f7=_0x4d44f7-0x0;var _0x1bcbc5=_0x8038[_0x4d44f7];return _0x1bcbc5;};'use strict';var emlformat=require('eml-format');var moment=require(_0x8803('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x8803('0x1'));var Redis=require(_0x8803('0x2'));var htmlToText=require(_0x8803('0x3'));var interactionService=require('../../components/interaction/service');var qs=require(_0x8803('0x4'));var logger=require(_0x8803('0x5'))(_0x8803('0x6'));var interaction_log=require(_0x8803('0x5'))(_0x8803('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x8803('0x8')]=_[_0x8803('0x9')](config[_0x8803('0x8')],{'host':_0x8803('0xa'),'port':0x18eb});var socket=require(_0x8803('0xb'))(new Redis(config[_0x8803('0x8')]));var htmlEntities=require(_0x8803('0xc'));require(_0x8803('0xd'))['register'](socket);var jayson=require(_0x8803('0xe'));var client=jayson[_0x8803('0xf')][_0x8803('0x10')]({'port':0x232c});var client9003=jayson[_0x8803('0xf')][_0x8803('0x10')]({'port':0x232b});var client9002=jayson[_0x8803('0xf')][_0x8803('0x10')]({'port':0x232a});function respondWithRpcPromise(_0xaf79f0,_0x3b8ba5,_0x5db10d,_0x1e4c76){return new Promise(function(_0x20ef65,_0x31cd7b){var _0x2e1058=_0x1e4c76||client;return _0x2e1058[_0x8803('0x11')](_0xaf79f0,_0x5db10d)[_0x8803('0x12')](function(_0x55be86){logger[_0x8803('0x13')](_0x8803('0x14'),_0x3b8ba5,_0x8803('0x15'));logger[_0x8803('0x16')](_0x8803('0x17'),_0x3b8ba5,'request\x20sent',JSON[_0x8803('0x18')](_0x55be86));if(_0x55be86[_0x8803('0x19')]){if(_0x55be86['error'][_0x8803('0x1a')]===0x1f4){logger[_0x8803('0x19')]('MailMessage,\x20%s,\x20%s',_0x3b8ba5,_0x55be86['error'][_0x8803('0x1b')]);return _0x31cd7b(_0x55be86[_0x8803('0x19')][_0x8803('0x1b')]);}logger[_0x8803('0x19')](_0x8803('0x14'),_0x3b8ba5,_0x55be86[_0x8803('0x19')]['message']);return _0x20ef65(_0x55be86[_0x8803('0x19')][_0x8803('0x1b')]);}else{logger['info'](_0x8803('0x14'),_0x3b8ba5,_0x8803('0x15'));_0x20ef65(_0x55be86['result'][_0x8803('0x1b')]);}})[_0x8803('0x1c')](function(_0x3f4cf0){logger[_0x8803('0x19')](_0x8803('0x14'),_0x3b8ba5,_0x3f4cf0);_0x31cd7b(_0x3f4cf0);});});}function respondWithResult(_0x43d4f5,_0x38c88b){_0x38c88b=_0x38c88b||0xc8;return function(_0x3c9440){if(_0x3c9440){return _0x43d4f5[_0x8803('0x1d')](_0x38c88b)[_0x8803('0x1e')](_0x3c9440);}};}function respondWithFilteredResult(_0x213d23,_0x4c1058){return function(_0x84ae58){if(_0x84ae58){var _0x3b2204=typeof _0x4c1058['offset']==='undefined'&&typeof _0x4c1058['limit']===_0x8803('0x1f');var _0x1e5068=_0x84ae58[_0x8803('0x20')];var _0x549a4c=_0x3b2204?0x0:_0x4c1058['offset'];var _0x4cefb9=_0x3b2204?_0x84ae58[_0x8803('0x20')]:_0x4c1058[_0x8803('0x21')]+_0x4c1058[_0x8803('0x22')];var _0x1d6639;if(_0x4cefb9>=_0x1e5068){_0x4cefb9=_0x1e5068;_0x1d6639=0xc8;}else{_0x1d6639=0xce;}_0x213d23[_0x8803('0x1d')](_0x1d6639);return _0x213d23[_0x8803('0x23')]('Content-Range',_0x549a4c+'-'+_0x4cefb9+'/'+_0x1e5068)['json'](_0x84ae58);}return null;};}function saveUpdates(_0x4f3daf){return function(_0x20d420){if(_0x20d420){return _0x20d420['update'](_0x4f3daf)[_0x8803('0x12')](function(_0x342d5d){return _0x342d5d;});}return null;};}function removeEntity(_0x34b853){return function(_0x164667){if(_0x164667){return _0x164667[_0x8803('0x24')]()[_0x8803('0x12')](function(){_0x34b853[_0x8803('0x1d')](0xcc)[_0x8803('0x25')]();});}};}function handleEntityNotFound(_0x1749f2){return function(_0x2b33f0){if(!_0x2b33f0){_0x1749f2[_0x8803('0x26')](0x194);}return _0x2b33f0;};}function handleError(_0x267df0,_0x209865){_0x209865=_0x209865||0x1f4;return function(_0x3aedcc){logger[_0x8803('0x19')](_0x3aedcc['stack']);if(_0x3aedcc[_0x8803('0x27')]){delete _0x3aedcc['name'];}_0x267df0['status'](_0x209865)[_0x8803('0x28')](_0x3aedcc);};}exports[_0x8803('0x29')]=function(_0x1a5516,_0x15d0d3){var _0x1b352e={},_0x5c813b={},_0x4078e4={'count':0x0,'rows':[]};var _0x224b73=_[_0x8803('0x2a')](db[_0x8803('0x2b')][_0x8803('0x2c')],function(_0x48fb3c){return{'name':_0x48fb3c[_0x8803('0x2d')],'type':_0x48fb3c[_0x8803('0x2e')][_0x8803('0x2f')]};});_0x5c813b[_0x8803('0x30')]=_[_0x8803('0x2a')](_0x224b73,_0x8803('0x27'));_0x5c813b[_0x8803('0x31')]=_[_0x8803('0x32')](_0x1a5516[_0x8803('0x31')]);_0x5c813b[_0x8803('0x33')]=_[_0x8803('0x34')](_0x5c813b[_0x8803('0x30')],_0x5c813b[_0x8803('0x31')]);_0x1b352e[_0x8803('0x35')]=_[_0x8803('0x34')](_0x5c813b['model'],qs['fields'](_0x1a5516[_0x8803('0x31')][_0x8803('0x36')]));_0x1b352e[_0x8803('0x35')]=_0x1b352e[_0x8803('0x35')][_0x8803('0x37')]?_0x1b352e[_0x8803('0x35')]:_0x5c813b['model'];if(!_0x1a5516[_0x8803('0x31')][_0x8803('0x38')](_0x8803('0x39'))){_0x1b352e['limit']=qs['limit'](_0x1a5516['query'][_0x8803('0x22')]);_0x1b352e['offset']=qs[_0x8803('0x21')](_0x1a5516[_0x8803('0x31')][_0x8803('0x21')]);}_0x1b352e['order']=qs[_0x8803('0x3a')](_0x1a5516[_0x8803('0x31')][_0x8803('0x3a')]);_0x1b352e['where']=qs[_0x8803('0x33')](_[_0x8803('0x3b')](_0x1a5516[_0x8803('0x31')],_0x5c813b['filters']),_0x224b73);if(_0x1a5516[_0x8803('0x31')][_0x8803('0x3c')]){_0x1b352e[_0x8803('0x3d')]=_[_0x8803('0x3e')](_0x1b352e[_0x8803('0x3d')],{'$or':_[_0x8803('0x2a')](_0x224b73,function(_0xb8178b){if(_0xb8178b[_0x8803('0x2e')]!==_0x8803('0x3f')){var _0x503de4={};_0x503de4[_0xb8178b[_0x8803('0x27')]]={'$like':'%'+_0x1a5516[_0x8803('0x31')][_0x8803('0x3c')]+'%'};return _0x503de4;}})});}_0x1b352e=_[_0x8803('0x3e')]({},_0x1b352e,_0x1a5516['options']);var _0x5e3801={'where':_0x1b352e[_0x8803('0x3d')]};return db[_0x8803('0x2b')][_0x8803('0x20')](_0x5e3801)['then'](function(_0x5bc2c3){_0x4078e4[_0x8803('0x20')]=_0x5bc2c3;if(_0x1a5516[_0x8803('0x31')][_0x8803('0x40')]){_0x1b352e[_0x8803('0x41')]=[{'all':!![]}];}return db[_0x8803('0x2b')][_0x8803('0x42')](_0x1b352e);})['then'](function(_0x15d557){_0x4078e4[_0x8803('0x43')]=_0x15d557;return _0x4078e4;})['then'](respondWithFilteredResult(_0x15d0d3,_0x1b352e))[_0x8803('0x1c')](handleError(_0x15d0d3,null));};exports[_0x8803('0x44')]=function(_0x2c996f,_0x3f10df){var _0x189e53={'raw':!![],'where':{'id':_0x2c996f[_0x8803('0x45')]['id']}},_0x234be1={};_0x234be1[_0x8803('0x30')]=_[_0x8803('0x32')](db[_0x8803('0x2b')][_0x8803('0x2c')]);_0x234be1[_0x8803('0x31')]=_['keys'](_0x2c996f['query']);_0x234be1['filters']=_[_0x8803('0x34')](_0x234be1[_0x8803('0x30')],_0x234be1[_0x8803('0x31')]);_0x189e53[_0x8803('0x35')]=_['intersection'](_0x234be1['model'],qs['fields'](_0x2c996f[_0x8803('0x31')][_0x8803('0x36')]));_0x189e53[_0x8803('0x35')]=_0x189e53[_0x8803('0x35')][_0x8803('0x37')]?_0x189e53[_0x8803('0x35')]:_0x234be1['model'];if(_0x2c996f['query']['includeAll']){_0x189e53[_0x8803('0x41')]=[{'all':!![]}];}_0x189e53=_[_0x8803('0x3e')]({},_0x189e53,_0x2c996f[_0x8803('0x46')]);return db[_0x8803('0x2b')][_0x8803('0x47')](_0x189e53)['then'](handleEntityNotFound(_0x3f10df,null))[_0x8803('0x12')](respondWithResult(_0x3f10df,null))[_0x8803('0x1c')](handleError(_0x3f10df,null));};exports[_0x8803('0x48')]=function(_0x492428,_0x5ef0bc){if(_0x492428['body']['id']){delete _0x492428['body']['id'];}return db[_0x8803('0x2b')][_0x8803('0x47')]({'where':{'id':_0x492428['params']['id']}})[_0x8803('0x12')](handleEntityNotFound(_0x5ef0bc,null))['then'](saveUpdates(_0x492428['body'],null))['then'](respondWithResult(_0x5ef0bc,null))[_0x8803('0x1c')](handleError(_0x5ef0bc,null));};exports[_0x8803('0x24')]=function(_0x2472d3,_0x1f5f92){return db[_0x8803('0x2b')][_0x8803('0x47')]({'where':{'id':_0x2472d3['params']['id']}})['then'](handleEntityNotFound(_0x1f5f92,null))[_0x8803('0x12')](removeEntity(_0x1f5f92,null))[_0x8803('0x1c')](handleError(_0x1f5f92,null));};exports[_0x8803('0x49')]=function(_0x25e564,_0x3d34ba){return db[_0x8803('0x2b')][_0x8803('0x49')]()['then'](respondWithResult(_0x3d34ba,null))[_0x8803('0x1c')](handleError(_0x3d34ba,null));};exports[_0x8803('0x4a')]=function(_0x459f77,_0x46777a){return db[_0x8803('0x2b')]['create'](_0x459f77['body'])[_0x8803('0x12')](function(_0x4046e7){if(_0x4046e7){if(_0x4046e7['direction']===_0x8803('0x4b')&&!_0x4046e7[_0x8803('0x4c')]){var _0x278c29,_0x3aefb9,_0xdae871;if(_0x459f77['body']['to']){_0x3aefb9=_0x459f77[_0x8803('0x4d')]['to']['split'](',')[0x0];}return db[_0x8803('0x4e')]['findOne']({'where':{'id':_0x4046e7[_0x8803('0x4f')]},'include':[{'model':db[_0x8803('0x50')],'as':_0x8803('0x51'),'include':[{'model':db[_0x8803('0x52')],'as':'Contacts','where':{'email':_0x3aefb9},'limit':0x1,'order':[[_0x8803('0x53'),_0x8803('0x54')]]}]},{'model':db[_0x8803('0x55')],'as':_0x8803('0x56'),'raw':!![],'include':[{'model':db[_0x8803('0x57')],'as':_0x8803('0x57'),'raw':!![]}]}]})[_0x8803('0x12')](function(_0x10bfd7){_0x278c29=_0x10bfd7;if(!_0x278c29||!_0x278c29[_0x8803('0x56')])return;var _0x160e6d=_0x278c29[_0x8803('0x58')]();if(_0x459f77[_0x8803('0x4d')][_0x8803('0x59')]&&_0x459f77[_0x8803('0x4d')][_0x8803('0x59')][_0x8803('0x37')]){for(var _0x4e1bd4=0x0;_0x4e1bd4<_0x459f77['body']['attachments']['length'];_0x4e1bd4+=0x1){_0x459f77[_0x8803('0x4d')][_0x8803('0x59')][_0x4e1bd4]={'filename':_0x459f77[_0x8803('0x4d')][_0x8803('0x59')][_0x4e1bd4][_0x8803('0x27')],'path':path[_0x8803('0x5a')](config[_0x8803('0x5b')],'server/files/attachments',_0x459f77[_0x8803('0x4d')]['attachments'][_0x4e1bd4][_0x8803('0x5c')])};}}_0xdae871={'account':_0x160e6d,'message':_0x459f77['body']};return;})['then'](function(){if(_0x278c29[_0x8803('0x51')]){if(_0x278c29[_0x8803('0x51')]['Contacts'][_0x8803('0x37')]){return _0x278c29[_0x8803('0x51')]['Contacts'][0x0];}else{return db[_0x8803('0x52')]['create'](_[_0x8803('0x9')](_0x459f77[_0x8803('0x4d')],{'firstName':_0x459f77[_0x8803('0x4d')]['to'],'email':_0x459f77[_0x8803('0x4d')]['to'],'phone':_0x459f77[_0x8803('0x4d')]['to'],'ListId':_0x278c29['ListId']}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0xdae871){return respondWithRpcPromise(_0x8803('0x5d'),_0x8803('0x5e'),_0xdae871,client9003)[_0x8803('0x12')](function(_0x378087){return _0x4046e7[_0x8803('0x48')]({'read':!![],'messageId':_0x378087[_0x8803('0x5f')],'sentAt':moment()[_0x8803('0x60')](_0x8803('0x61'))});})['catch'](function(_0x3719bf){logger[_0x8803('0x19')]('%s',JSON['stringify'](_0x3719bf));return _0x4046e7;});}return _0x4046e7;});}return _0x4046e7;}})[_0x8803('0x12')](respondWithResult(_0x46777a,0xc9))[_0x8803('0x1c')](handleError(_0x46777a,null));};exports['accept']=function(_0x64b884,_0xd10210){var _0x375a9b=_0x8803('0x62');return interactionService[_0x8803('0x63')](_0x64b884,_0x375a9b)[_0x8803('0x12')](respondWithResult(_0xd10210,null))[_0x8803('0x1c')](handleError(_0xd10210,null));};exports['reject']=function(_0xaafcf2,_0x229689){var _0x38d838={'agent':{},'channel':_0x8803('0x62')};if(_0xaafcf2[_0x8803('0x4d')]['id']){delete _0xaafcf2[_0x8803('0x4d')]['id'];}_0xaafcf2['body'][_0x8803('0x64')]=_0xaafcf2['body'][_0x8803('0x64')]||_0xaafcf2[_0x8803('0x65')]['id'];_0x38d838[_0x8803('0x66')]['id']=_0xaafcf2[_0x8803('0x4d')][_0x8803('0x64')];return db['MailMessage'][_0x8803('0x47')]({'where':{'id':_0xaafcf2['params']['id'],'UserId':null}})[_0x8803('0x12')](handleEntityNotFound(_0x229689,null))['then'](function(_0x5ed022){if(_0x5ed022){_0x38d838[_0x8803('0x1b')]=_0x5ed022[_0x8803('0x67')]({'plain':!![]});return db['MailInteraction'][_0x8803('0x47')]({'where':{'id':_0x5ed022['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x229689,null))[_0x8803('0x12')](function(_0xf54a20){if(_0xf54a20){_0x38d838[_0x8803('0x68')]=_0xf54a20[_0x8803('0x67')]({'plain':!![]});interaction_log['info'](_0x8803('0x69'),_0xaafcf2[_0x8803('0x65')]['id'],_0xaafcf2['user'][_0x8803('0x27')],_0xaafcf2[_0x8803('0x65')][_0x8803('0x6a')],_0x38d838['interaction']['id'],_0xaafcf2[_0x8803('0x4d')]?JSON[_0x8803('0x18')](_0xaafcf2[_0x8803('0x4d')]):_0x8803('0x6b'));return respondWithRpcPromise(_0x8803('0x6c'),'rejectMessage',_0x38d838);}return null;})[_0x8803('0x12')](function(_0x26cf19){var _0x2d6f2b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x26cf19['message'][_0x8803('0x6d')];return db[_0x8803('0x6e')][_0x8803('0x31')](_0x2d6f2b,{'type':db[_0x8803('0x6f')][_0x8803('0x70')][_0x8803('0x71')],'raw':!![]})[_0x8803('0x12')](function(_0x5006ad){return _0x5006ad;});})[_0x8803('0x12')](function(_0x255c4a){if(_0x255c4a){_0x38d838[_0x8803('0x1b')]['contact']=_0x255c4a[0x0];if(!_0xaafcf2[_0x8803('0x4d')][_0x8803('0x64')])return;return db['User'][_0x8803('0x47')]({'where':{'id':_0xaafcf2[_0x8803('0x4d')][_0x8803('0x64')],'role':_0x8803('0x66')},'attributes':['id',_0x8803('0x27'),_0x8803('0x72'),_0x8803('0x73'),'internal'],'raw':!![]});}return null;})[_0x8803('0x12')](function(_0x11ab8d){if(!_0x11ab8d)return null;_0x38d838[_0x8803('0x1b')][_0x8803('0x66')]=_0x11ab8d;return _0x38d838;})[_0x8803('0x12')](function(_0x26118f){if(_0x26118f){_0x26118f[_0x8803('0x1b')][_0x8803('0x74')]=util['format'](_0x8803('0x75'),_0xaafcf2['user'][_0x8803('0x27')]);_0x26118f['message']['channel']=_0x38d838[_0x8803('0x76')];_0x26118f[_0x8803('0x1b')]['motionChannel']=_0x38d838['channel'];_0x26118f['message'][_0x8803('0x77')]=_0x8803('0x78');_0x26118f['message'][_0x8803('0x4d')]=htmlToText[_0x8803('0x79')](_0x38d838[_0x8803('0x1b')]['body']);respondWithRpcPromise(_0x8803('0x7a'),_0x8803('0x7a'),{'event':_0x8803('0x7b'),'message':_0x26118f[_0x8803('0x1b')]},client9002);return _0x38d838;}return null;})[_0x8803('0x12')](respondWithResult(_0x229689,null))[_0x8803('0x1c')](handleError(_0x229689,null));};exports[_0x8803('0x7c')]=function(_0x431677,_0x31eb91){var _0x663070=moment()[_0x8803('0x7d')]()[_0x8803('0x7e')]();var _0x5d3036=path[_0x8803('0x5a')](config[_0x8803('0x5b')],_0x8803('0x7f'),_0x8803('0x80'),_0x8803('0x81'));var _0x3e8331=path[_0x8803('0x5a')](config[_0x8803('0x5b')],_0x8803('0x7f'),_0x8803('0x80'),_0x8803('0x59'));var _0xa9a631=util[_0x8803('0x60')](_0x8803('0x82'),_0x663070);return db['MailMessage'][_0x8803('0x47')]({'where':{'id':_0x431677['params']['id']},'attributes':['id','body',_0x8803('0x83'),'to','cc','bcc','subject','createdAt'],'include':_0x431677['query']['attachments']?[{'model':db[_0x8803('0x84')],'as':_0x8803('0x85')}]:undefined})[_0x8803('0x12')](handleEntityNotFound(_0x31eb91,null))['then'](function(_0x2ec8c4){if(_0x2ec8c4){var _0x1389e1=_0x2ec8c4;var _0x2eae57={'from':_0x1389e1['from'],'to':_0x1389e1['to'],'subject':_0x1389e1[_0x8803('0x86')],'html':htmlEntities[_0x8803('0x87')](_0x1389e1[_0x8803('0x4d')]),'headers':{'Date':moment(_0x1389e1['createdAt'])[_0x8803('0x60')](_0x8803('0x88'))},'attachments':[]};if(_0x2ec8c4['cc']){_0x2eae57[_0x8803('0x89')]['Cc']=_0x2ec8c4['cc'];}if(_0x2ec8c4[_0x8803('0x8a')]){_0x2eae57['headers']['Bcc']=_0x2ec8c4[_0x8803('0x8a')];}return new Promise(function(_0x953a71,_0x150d79){if(_0x2ec8c4[_0x8803('0x85')]){for(var _0xe8fe6c=0x0;_0xe8fe6c<_0x2ec8c4['Attachments'][_0x8803('0x37')];_0xe8fe6c++){var _0x54769d=_0x2ec8c4['Attachments'][_0xe8fe6c];var _0x5eea55=path[_0x8803('0x5a')](_0x3e8331,_0x54769d[_0x8803('0x5c')]);if(fs[_0x8803('0x8b')](_0x5eea55)){_0x2eae57[_0x8803('0x59')]['push']({'name':_0x54769d['name'],'contentType':_0x54769d[_0x8803('0x2e')],'data':fs[_0x8803('0x8c')](_0x5eea55)});}}}emlformat[_0x8803('0x8d')](_0x2eae57,function(_0x1c8e0a,_0x32d8b5){if(_0x1c8e0a)return _0x150d79(_0x1c8e0a);fs[_0x8803('0x8e')](path[_0x8803('0x5a')](_0x5d3036,_0xa9a631),_0x32d8b5);return _0x953a71(_0x32d8b5);});});}})[_0x8803('0x12')](function(_0x40267e){if(_0x40267e){return _0x31eb91[_0x8803('0x7c')](path['join'](_0x5d3036,_0xa9a631),_0xa9a631,function(_0x489742){if(!_0x489742)fs[_0x8803('0x8f')](path[_0x8803('0x5a')](_0x5d3036,_0xa9a631));});}})[_0x8803('0x1c')](handleError(_0x31eb91,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 6ec34eb..6ea7522 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 _0xa881=['hasOwnProperty','hook','exports','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x330cd6,_0x53dfa6){var _0x45406d=function(_0x31b43d){while(--_0x31b43d){_0x330cd6['push'](_0x330cd6['shift']());}};_0x45406d(++_0x53dfa6);}(_0xa881,0x8f));var _0x1a88=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa881[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x1a88('0x0'))['db'][_0x1a88('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x1a88('0x2')](0x0);var events={'afterCreate':_0x1a88('0x3'),'afterUpdate':_0x1a88('0x4'),'afterDestroy':_0x1a88('0x5')};function emitEvent(_0x675b9){return function(_0x56f395,_0x423658,_0x294055){MailMessageEvents[_0x1a88('0x6')](_0x675b9+':'+_0x56f395['id'],_0x56f395);MailMessageEvents[_0x1a88('0x6')](_0x675b9,_0x56f395);_0x294055(null);};}for(var e in events){if(events[_0x1a88('0x7')](e)){var event=events[e];MailMessage[_0x1a88('0x8')](e,emitEvent(event));}}module[_0x1a88('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x5a5f=['save','update','remove','emit','hasOwnProperty','exports','MailMessage','setMaxListeners'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x5a5f,0x1ee));var _0xf5a5=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0x5a5f[_0x1526e1];return _0x249a1e;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0xf5a5('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf5a5('0x1')](0x0);var events={'afterCreate':_0xf5a5('0x2'),'afterUpdate':_0xf5a5('0x3'),'afterDestroy':_0xf5a5('0x4')};function emitEvent(_0x46cfb4){return function(_0xd24d4d,_0x4faa11,_0x29ef9e){MailMessageEvents[_0xf5a5('0x5')](_0x46cfb4+':'+_0xd24d4d['id'],_0xd24d4d);MailMessageEvents[_0xf5a5('0x5')](_0x46cfb4,_0xd24d4d);_0x29ef9e(null);};}for(var e in events){if(events[_0xf5a5('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xf5a5('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index dbe83bf..b1de8f2 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 _0x15a2=['bluebird','request-promise','html-to-text','rimraf','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','body','fromString','models','direction','toLowerCase','out','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','catch','error','lodash','../../config/logger','api'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x15a2,0xb1));var _0x215a=function(_0x527361,_0x1d96b4){_0x527361=_0x527361-0x0;var _0x1fcb80=_0x15a2[_0x527361];return _0x1fcb80;};'use strict';var _=require(_0x215a('0x0'));var util=require('util');var logger=require(_0x215a('0x1'))(_0x215a('0x2'));var moment=require('moment');var BPromise=require(_0x215a('0x3'));var rp=require(_0x215a('0x4'));var htmlToText=require(_0x215a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x215a('0x6'));var config=require('../../config/environment');var attributes=require(_0x215a('0x7'));module[_0x215a('0x8')]=function(_0x34fb27,_0x210cc7){return _0x34fb27[_0x215a('0x9')](_0x215a('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x215a('0xb'),'fields':[_0x215a('0xb')]},{'name':_0x215a('0xc'),'fields':[_0x215a('0xd'),_0x215a('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5205ef,_0x1d468f,_0xc7f64d){if(_0x5205ef[_0x215a('0xf')]){_0x5205ef['plainBody']=htmlToText[_0x215a('0x10')](_0x5205ef['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xc7f64d(null,_0x1d468f);},'afterCreate':function(_0x49f16e,_0x10b92e,_0x5eac5a){var _0x4283f5=_0x34fb27[_0x215a('0x11')];var _0x4b164=_0x49f16e['get']({'plain':!![]});if(_0x4b164[_0x215a('0x12')][_0x215a('0x13')]()==='in'||_0x4b164[_0x215a('0x12')][_0x215a('0x13')]()===_0x215a('0x14')&&!_0x4b164['secret']&&!_[_0x215a('0x15')](_0x4b164[_0x215a('0x16')])){_0x4283f5[_0x215a('0x17')][_0x215a('0x18')]({'where':{'id':_0x4b164[_0x215a('0x19')]}})[_0x215a('0x1a')](function(_0x590756){if(_0x590756){_0x590756['update']({'lastMsgAt':_0x4b164[_0x215a('0x1b')],'lastMsgDirection':_0x4b164[_0x215a('0x12')]['toLowerCase']()});}})[_0x215a('0x1c')](function(_0xea08a8){console[_0x215a('0x1d')](_0xea08a8);});}_0x5eac5a();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf100=['toLowerCase','secret','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','plainBody','FULLTEXT','body','fromString','models','direction'];(function(_0x33539a,_0xab9aa5){var _0x1a99a7=function(_0x3e95db){while(--_0x3e95db){_0x33539a['push'](_0x33539a['shift']());}};_0x1a99a7(++_0xab9aa5);}(_0xf100,0x183));var _0x0f10=function(_0x3cd453,_0x239793){_0x3cd453=_0x3cd453-0x0;var _0x338dc1=_0xf100[_0x3cd453];return _0x338dc1;};'use strict';var _=require(_0x0f10('0x0'));var util=require(_0x0f10('0x1'));var logger=require(_0x0f10('0x2'))('api');var moment=require(_0x0f10('0x3'));var BPromise=require(_0x0f10('0x4'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x0f10('0x5'));var rimraf=require('rimraf');var config=require(_0x0f10('0x6'));var attributes=require(_0x0f10('0x7'));module[_0x0f10('0x8')]=function(_0x103d44,_0x409254){return _0x103d44[_0x0f10('0x9')]('MailMessage',attributes,{'tableName':_0x0f10('0xa'),'paranoid':![],'indexes':[{'name':_0x0f10('0xb'),'fields':[_0x0f10('0xb')]},{'name':'fti_mail_messages','fields':[_0x0f10('0xc'),'subject'],'type':_0x0f10('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x105846,_0x4bb708,_0x104b59){if(_0x105846[_0x0f10('0xe')]){_0x105846[_0x0f10('0xc')]=htmlToText[_0x0f10('0xf')](_0x105846[_0x0f10('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x104b59(null,_0x4bb708);},'afterCreate':function(_0x13b81a,_0xf6c78d,_0x1dc521){var _0x2d827a=_0x103d44[_0x0f10('0x10')];var _0x25fdbd=_0x13b81a['get']({'plain':!![]});if(_0x25fdbd[_0x0f10('0x11')]['toLowerCase']()==='in'||_0x25fdbd[_0x0f10('0x11')][_0x0f10('0x12')]()==='out'&&!_0x25fdbd[_0x0f10('0x13')]&&!_['isNil'](_0x25fdbd[_0x0f10('0x14')])){_0x2d827a[_0x0f10('0x15')][_0x0f10('0x16')]({'where':{'id':_0x25fdbd[_0x0f10('0x17')]}})[_0x0f10('0x18')](function(_0x188047){if(_0x188047){_0x188047['update']({'lastMsgAt':_0x25fdbd[_0x0f10('0x19')],'lastMsgDirection':_0x25fdbd[_0x0f10('0x11')]['toLowerCase']()});}})['catch'](function(_0x5216a4){console['error'](_0x5216a4);});}_0x1dc521();}},'charset':'utf8mb4','collate':_0x0f10('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index d86a48f..fdae165 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 _0x5f2f=['MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','MailMessage','create','options','raw','CreateMailMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x431d1f,_0x188970){var _0x449745=function(_0x2da22f){while(--_0x2da22f){_0x431d1f['push'](_0x431d1f['shift']());}};_0x449745(++_0x188970);}(_0x5f2f,0x73));var _0xf5f2=function(_0x26be45,_0x154888){_0x26be45=_0x26be45-0x0;var _0xe50f19=_0x5f2f[_0x26be45];return _0xe50f19;};'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('./mailMessage.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['CreateMailMessage']=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 _0x7334=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','create','body','options','raw','CreateMailMessage','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x31ad98,_0xe532a2){var _0x1fb8c7=function(_0x110f7d){while(--_0x110f7d){_0x31ad98['push'](_0x31ad98['shift']());}};_0x1fb8c7(++_0xe532a2);}(_0x7334,0x184));var _0x4733=function(_0x3d3bb9,_0x148ba2){_0x3d3bb9=_0x3d3bb9-0x0;var _0x4ac12d=_0x7334[_0x3d3bb9];return _0x4ac12d;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var config=require(_0x4733('0x7'));var jayson=require(_0x4733('0x8'));var client=jayson[_0x4733('0x9')][_0x4733('0xa')]({'port':0x232a});config[_0x4733('0xb')]=_[_0x4733('0xc')](config[_0x4733('0xb')],{'host':_0x4733('0xd'),'port':0x18eb});var socket=require(_0x4733('0xe'))(new Redis(config[_0x4733('0xb')]));require(_0x4733('0xf'))[_0x4733('0x10')](socket);function respondWithRpcPromise(_0x1bc511,_0x2bafad,_0x49032d){return new BPromise(function(_0x42b97f,_0x1e6fcf){return client['request'](_0x1bc511,_0x49032d)[_0x4733('0x11')](function(_0x5240a4){logger[_0x4733('0x12')](_0x4733('0x13'),_0x2bafad,_0x4733('0x14'));logger[_0x4733('0x15')](_0x4733('0x16'),_0x2bafad,_0x4733('0x14'),JSON[_0x4733('0x17')](_0x5240a4));if(_0x5240a4['error']){if(_0x5240a4[_0x4733('0x18')]['code']===0x1f4){logger[_0x4733('0x18')](_0x4733('0x13'),_0x2bafad,_0x5240a4[_0x4733('0x18')][_0x4733('0x19')]);return _0x1e6fcf(_0x5240a4[_0x4733('0x18')][_0x4733('0x19')]);}logger[_0x4733('0x18')](_0x4733('0x13'),_0x2bafad,_0x5240a4[_0x4733('0x18')]['message']);return _0x42b97f(_0x5240a4[_0x4733('0x18')][_0x4733('0x19')]);}else{logger['info'](_0x4733('0x13'),_0x2bafad,_0x4733('0x14'));_0x42b97f(_0x5240a4[_0x4733('0x1a')][_0x4733('0x19')]);}})['catch'](function(_0x517fbc){logger[_0x4733('0x18')](_0x4733('0x13'),_0x2bafad,_0x517fbc);_0x1e6fcf(_0x517fbc);});});}exports['CreateMailMessage']=function(_0x32f166){var _0x1943bc=this;return new Promise(function(_0x15339c,_0x7a4e0){return db['MailMessage'][_0x4733('0x1b')](_0x32f166[_0x4733('0x1c')],{'raw':_0x32f166['options']?_0x32f166[_0x4733('0x1d')][_0x4733('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x15a291){logger[_0x4733('0x12')](_0x4733('0x1f'),_0x32f166);logger[_0x4733('0x15')](_0x4733('0x1f'),_0x32f166,JSON[_0x4733('0x17')](_0x15a291));_0x15339c(_0x15a291);})[_0x4733('0x20')](function(_0x2bb78f){logger['error'](_0x4733('0x1f'),_0x2bb78f[_0x4733('0x19')],_0x32f166);_0x7a4e0(_0x1943bc[_0x4733('0x18')](0x1f4,_0x2bb78f[_0x4733('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 46ef518..d4ba879 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 _0x5829=['length','mailMessage:','save','remove','emit','removeListener'];(function(_0x13efcf,_0x4da51c){var _0x207efa=function(_0x37f1f3){while(--_0x37f1f3){_0x13efcf['push'](_0x13efcf['shift']());}};_0x207efa(++_0x4da51c);}(_0x5829,0x116));var _0x9582=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x5829[_0x1928c9];return _0x51b5fb;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x9582('0x0'),_0x9582('0x1'),'update'];function createListener(_0x159233,_0xffa594){return function(_0x4945cf){_0xffa594[_0x9582('0x2')](_0x159233,_0x4945cf);};}function removeListener(_0x46e172,_0xa54469){return function(){MailMessageEvents[_0x9582('0x3')](_0x46e172,_0xa54469);};}exports['register']=function(_0x5aca3f){for(var _0x155e2c=0x0,_0x197390=events[_0x9582('0x4')];_0x155e2c<_0x197390;_0x155e2c++){var _0x16a050=events[_0x155e2c];var _0x95ef8e=createListener(_0x9582('0x5')+_0x16a050,_0x5aca3f);MailMessageEvents['on'](_0x16a050,_0x95ef8e);}}; \ No newline at end of file +var _0x78f9=['remove','update','register','length','./mailMessage.events','save'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x78f9,0x1d8));var _0x978f=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x78f9[_0x5783f4];return _0x28e380;};'use strict';var MailMessageEvents=require(_0x978f('0x0'));var events=[_0x978f('0x1'),_0x978f('0x2'),_0x978f('0x3')];function createListener(_0x23d060,_0x37eab7){return function(_0x2f627c){_0x37eab7['emit'](_0x23d060,_0x2f627c);};}function removeListener(_0x46a21b,_0x47f1d4){return function(){MailMessageEvents['removeListener'](_0x46a21b,_0x47f1d4);};}exports[_0x978f('0x4')]=function(_0x22a3d7){for(var _0x4244d0=0x0,_0x487398=events[_0x978f('0x5')];_0x4244d0<_0x487398;_0x4244d0++){var _0x1ece85=events[_0x4244d0];var _0x22a9bc=createListener('mailMessage:'+_0x1ece85,_0x22a3d7);MailMessageEvents['on'](_0x1ece85,_0x22a9bc);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 826b869..d41a3b7 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 _0xcabc=['/:id/teams','getTeams','/:id/users','post','create','addTeams','put','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','describe','get','/:id','show','getMembers'];(function(_0x5e5c7b,_0x2495a3){var _0x3f947f=function(_0x29bca5){while(--_0x29bca5){_0x5e5c7b['push'](_0x5e5c7b['shift']());}};_0x3f947f(++_0x2495a3);}(_0xcabc,0x1ce));var _0xccab=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcabc[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xccab('0x0'));var util=require(_0xccab('0x1'));var path=require(_0xccab('0x2'));var timeout=require(_0xccab('0x3'));var express=require(_0xccab('0x4'));var router=express[_0xccab('0x5')]();var fs_extra=require(_0xccab('0x6'));var auth=require(_0xccab('0x7'));var interaction=require(_0xccab('0x8'));var config=require(_0xccab('0x9'));var controller=require(_0xccab('0xa'));router['get']('/',auth[_0xccab('0xb')](),controller[_0xccab('0xc')]);router['get']('/describe',auth[_0xccab('0xb')](),controller[_0xccab('0xd')]);router[_0xccab('0xe')](_0xccab('0xf'),auth['isAuthenticated'](),controller[_0xccab('0x10')]);router[_0xccab('0xe')]('/:id/members',auth[_0xccab('0xb')](),controller[_0xccab('0x11')]);router[_0xccab('0xe')](_0xccab('0x12'),auth['isAuthenticated'](),controller[_0xccab('0x13')]);router[_0xccab('0xe')](_0xccab('0x14'),auth[_0xccab('0xb')](),controller['getAgents']);router[_0xccab('0x15')]('/',auth[_0xccab('0xb')](),controller[_0xccab('0x16')]);router[_0xccab('0x15')](_0xccab('0x12'),auth[_0xccab('0xb')](),controller[_0xccab('0x17')]);router[_0xccab('0x15')](_0xccab('0x14'),auth[_0xccab('0xb')](),controller['addAgents']);router[_0xccab('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xccab('0x19')]);router[_0xccab('0x1a')](_0xccab('0xf'),auth[_0xccab('0xb')](),controller[_0xccab('0x1b')]);router[_0xccab('0x1a')](_0xccab('0x12'),auth['isAuthenticated'](),controller[_0xccab('0x1c')]);router[_0xccab('0x1a')](_0xccab('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xccab('0x1d')]=router; \ No newline at end of file +var _0x5a7f=['get','isAuthenticated','index','/describe','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3d8ca8,_0x1a9764){var _0x517e45=function(_0x641ad9){while(--_0x641ad9){_0x3d8ca8['push'](_0x3d8ca8['shift']());}};_0x517e45(++_0x1a9764);}(_0x5a7f,0x12c));var _0xf5a7=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x5a7f[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0xf5a7('0x0'));var util=require(_0xf5a7('0x1'));var path=require(_0xf5a7('0x2'));var timeout=require(_0xf5a7('0x3'));var express=require(_0xf5a7('0x4'));var router=express[_0xf5a7('0x5')]();var fs_extra=require(_0xf5a7('0x6'));var auth=require(_0xf5a7('0x7'));var interaction=require(_0xf5a7('0x8'));var config=require(_0xf5a7('0x9'));var controller=require('./mailQueue.controller');router[_0xf5a7('0xa')]('/',auth[_0xf5a7('0xb')](),controller[_0xf5a7('0xc')]);router[_0xf5a7('0xa')](_0xf5a7('0xd'),auth[_0xf5a7('0xb')](),controller[_0xf5a7('0xe')]);router[_0xf5a7('0xa')](_0xf5a7('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xf5a7('0xa')]('/:id/members',auth[_0xf5a7('0xb')](),controller[_0xf5a7('0x10')]);router[_0xf5a7('0xa')](_0xf5a7('0x11'),auth[_0xf5a7('0xb')](),controller[_0xf5a7('0x12')]);router[_0xf5a7('0xa')](_0xf5a7('0x13'),auth[_0xf5a7('0xb')](),controller['getAgents']);router[_0xf5a7('0x14')]('/',auth[_0xf5a7('0xb')](),controller[_0xf5a7('0x15')]);router[_0xf5a7('0x14')](_0xf5a7('0x11'),auth[_0xf5a7('0xb')](),controller[_0xf5a7('0x16')]);router['post'](_0xf5a7('0x13'),auth['isAuthenticated'](),controller[_0xf5a7('0x17')]);router[_0xf5a7('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xf5a7('0x19')]);router[_0xf5a7('0x1a')]('/:id',auth[_0xf5a7('0xb')](),controller[_0xf5a7('0x1b')]);router[_0xf5a7('0x1a')](_0xf5a7('0x11'),auth[_0xf5a7('0xb')](),controller[_0xf5a7('0x1c')]);router[_0xf5a7('0x1a')]('/:id/users',auth[_0xf5a7('0xb')](),controller[_0xf5a7('0x1d')]);module[_0xf5a7('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 081c86e..d5f7252 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 _0x933a=['ENUM','rrmemory','beepall','exports','name','STRING','INTEGER'];(function(_0x3e2b52,_0x4e2ca9){var _0x3d9d11=function(_0x4c9e31){while(--_0x4c9e31){_0x3e2b52['push'](_0x3e2b52['shift']());}};_0x3d9d11(++_0x4e2ca9);}(_0x933a,0x184));var _0xa933=function(_0x4ed5d7,_0x1a61a8){_0x4ed5d7=_0x4ed5d7-0x0;var _0x9a927c=_0x933a[_0x4ed5d7];return _0x9a927c;};'use strict';var Sequelize=require('sequelize');module[_0xa933('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xa933('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa933('0x2')]},'timeout':{'type':Sequelize[_0xa933('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa933('0x4')](_0xa933('0x5'),_0xa933('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x224e=['beepall','roundrobin','sequelize','STRING','INTEGER','rrmemory'];(function(_0x221e15,_0x3ce785){var _0x347006=function(_0x45efaf){while(--_0x45efaf){_0x221e15['push'](_0x221e15['shift']());}};_0x347006(++_0x3ce785);}(_0x224e,0x1ac));var _0xe224=function(_0xd8c624,_0x12e8ef){_0xd8c624=_0xd8c624-0x0;var _0x51e058=_0x224e[_0xd8c624];return _0x51e058;};'use strict';var Sequelize=require(_0xe224('0x0'));module['exports']={'name':{'type':Sequelize[_0xe224('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe224('0x1')]},'timeout':{'type':Sequelize[_0xe224('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe224('0x3'),_0xe224('0x4'),_0xe224('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 67bae3e..9ecf8a9 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 _0xb140=['filter','options','User','findAndCountAll','UserId','format','%s/%s','SIP','mailPause','createdAt','updatedAt','getTeams','Team','hasOwnProperty','nolimit','addTeams','ids','Agents','online','voicePause','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','./mailQueue.socket','end','json','offset','undefined','count','limit','status','set','Content-Range','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','where','include','query','findAll','rows','catch','params','keys','filters','intersection','model','fields','attributes','includeAll','merge','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','describe','getMembers','findOne','UserMailQueue','length','order','sort','pick','MailQueueId'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xb140,0xb3));var _0x0b14=function(_0x7f1086,_0x434356){_0x7f1086=_0x7f1086-0x0;var _0x358a47=_0xb140[_0x7f1086];return _0x358a47;};'use strict';var BPromise=require(_0x0b14('0x0'));var util=require(_0x0b14('0x1'));var _=require(_0x0b14('0x2'));var squel=require(_0x0b14('0x3'));var Redis=require(_0x0b14('0x4'));var qs=require(_0x0b14('0x5'));var logger=require(_0x0b14('0x6'))(_0x0b14('0x7'));var config=require(_0x0b14('0x8'));var db=require(_0x0b14('0x9'))['db'];config[_0x0b14('0xa')]=_['defaults'](config[_0x0b14('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0b14('0xa')]));require(_0x0b14('0xb'))['register'](socket);function respondWithStatusCode(_0x1b19e3,_0x35504d){_0x35504d=_0x35504d||0xcc;return function(_0x5bcd32){if(_0x5bcd32){return _0x1b19e3['sendStatus'](_0x35504d);}return _0x1b19e3['status'](_0x35504d)[_0x0b14('0xc')]();};}function respondWithResult(_0x1a9f24,_0x34d816){_0x34d816=_0x34d816||0xc8;return function(_0x3c3a98){if(_0x3c3a98){return _0x1a9f24['status'](_0x34d816)[_0x0b14('0xd')](_0x3c3a98);}};}function respondWithFilteredResult(_0x13792b,_0x1bf11f){return function(_0x364fcb){if(_0x364fcb){var _0x2db6b3=typeof _0x1bf11f[_0x0b14('0xe')]===_0x0b14('0xf')&&typeof _0x1bf11f['limit']===_0x0b14('0xf');var _0x231855=_0x364fcb[_0x0b14('0x10')];var _0x3bf7db=_0x2db6b3?0x0:_0x1bf11f[_0x0b14('0xe')];var _0x12b97b=_0x2db6b3?_0x364fcb[_0x0b14('0x10')]:_0x1bf11f[_0x0b14('0xe')]+_0x1bf11f[_0x0b14('0x11')];var _0x2e3554;if(_0x12b97b>=_0x231855){_0x12b97b=_0x231855;_0x2e3554=0xc8;}else{_0x2e3554=0xce;}_0x13792b[_0x0b14('0x12')](_0x2e3554);return _0x13792b[_0x0b14('0x13')](_0x0b14('0x14'),_0x3bf7db+'-'+_0x12b97b+'/'+_0x231855)[_0x0b14('0xd')](_0x364fcb);}return null;};}function saveUpdates(_0x2e38b0){return function(_0x2c5269){if(_0x2c5269){return _0x2c5269[_0x0b14('0x15')](_0x2e38b0)[_0x0b14('0x16')](function(_0xeffa6b){return _0xeffa6b;});}return null;};}function removeEntity(_0x3e3d76){return function(_0x216534){if(_0x216534){return _0x216534[_0x0b14('0x17')]()[_0x0b14('0x16')](function(){var _0x47d4ad=_0x216534[_0x0b14('0x18')]({'plain':!![]});var _0x25a77c='MailQueues';return db[_0x0b14('0x19')][_0x0b14('0x17')]({'where':{'type':_0x25a77c,'resourceId':_0x47d4ad['id']}})[_0x0b14('0x16')](function(){return _0x216534;});})[_0x0b14('0x16')](function(){_0x3e3d76[_0x0b14('0x12')](0xcc)[_0x0b14('0xc')]();});}};}function handleEntityNotFound(_0x189d12){return function(_0x35e7a2){if(!_0x35e7a2){_0x189d12['sendStatus'](0x194);}return _0x35e7a2;};}function handleError(_0x2099b5,_0x5894ec){_0x5894ec=_0x5894ec||0x1f4;return function(_0x28ed33){logger['error'](_0x28ed33[_0x0b14('0x1a')]);if(_0x28ed33[_0x0b14('0x1b')]){delete _0x28ed33['name'];}_0x2099b5[_0x0b14('0x12')](_0x5894ec)[_0x0b14('0x1c')](_0x28ed33);};}exports[_0x0b14('0x1d')]=function(_0x49bb96,_0x14e211){var _0x4bb4fa={};var _0x573b29={'count':0x0,'rows':[]};var _0x1c14c8=_[_0x0b14('0x1e')](db[_0x0b14('0x1f')][_0x0b14('0x20')],function(_0x5ad8c6){return{'name':_0x5ad8c6[_0x0b14('0x21')],'type':_0x5ad8c6[_0x0b14('0x22')][_0x0b14('0x23')]};});_0x4bb4fa=qs['getOptions'](_0x1c14c8,_0x49bb96);var _0x2753ae={'where':_0x4bb4fa[_0x0b14('0x24')]};return db['MailQueue'][_0x0b14('0x10')](_0x2753ae)[_0x0b14('0x16')](function(_0x491542){_0x573b29[_0x0b14('0x10')]=_0x491542;_0x4bb4fa[_0x0b14('0x25')]=qs[_0x0b14('0x25')](_0x49bb96[_0x0b14('0x26')]);return db[_0x0b14('0x1f')][_0x0b14('0x27')](_0x4bb4fa);})[_0x0b14('0x16')](function(_0x409eb0){_0x573b29[_0x0b14('0x28')]=_0x409eb0;return _0x573b29;})['then'](respondWithFilteredResult(_0x14e211,_0x4bb4fa))[_0x0b14('0x29')](handleError(_0x14e211,null));};exports['show']=function(_0x212a4d,_0x14cdb6){var _0x298339={'raw':!![],'where':{'id':_0x212a4d[_0x0b14('0x2a')]['id']}},_0x3107c4={};_0x3107c4['model']=_['keys'](db[_0x0b14('0x1f')]['rawAttributes']);_0x3107c4[_0x0b14('0x26')]=_[_0x0b14('0x2b')](_0x212a4d[_0x0b14('0x26')]);_0x3107c4[_0x0b14('0x2c')]=_[_0x0b14('0x2d')](_0x3107c4[_0x0b14('0x2e')],_0x3107c4['query']);_0x298339['attributes']=_[_0x0b14('0x2d')](_0x3107c4['model'],qs['fields'](_0x212a4d[_0x0b14('0x26')][_0x0b14('0x2f')]));_0x298339[_0x0b14('0x30')]=_0x298339[_0x0b14('0x30')]['length']?_0x298339[_0x0b14('0x30')]:_0x3107c4['model'];if(_0x212a4d[_0x0b14('0x26')][_0x0b14('0x31')]){_0x298339[_0x0b14('0x25')]=[{'all':!![]}];}_0x298339=_[_0x0b14('0x32')]({},_0x298339,_0x212a4d['options']);return db[_0x0b14('0x1f')][_0x0b14('0x33')](_0x298339)[_0x0b14('0x16')](handleEntityNotFound(_0x14cdb6,null))[_0x0b14('0x16')](respondWithResult(_0x14cdb6,null))[_0x0b14('0x29')](handleError(_0x14cdb6,null));};exports[_0x0b14('0x34')]=function(_0x5e107f,_0x1487fa){return db[_0x0b14('0x1f')][_0x0b14('0x34')](_0x5e107f[_0x0b14('0x35')],{})[_0x0b14('0x16')](function(_0x9b1dd5){var _0x3059fe=_0x5e107f[_0x0b14('0x36')][_0x0b14('0x18')]({'plain':!![]});if(!_0x3059fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3059fe[_0x0b14('0x37')]===_0x0b14('0x36')){var _0x3acf13=_0x9b1dd5[_0x0b14('0x18')]({'plain':!![]});var _0x400e8a='MailQueues';return db[_0x0b14('0x38')][_0x0b14('0x33')]({'where':{'name':_0x400e8a,'userProfileId':_0x3059fe[_0x0b14('0x39')]},'raw':!![]})[_0x0b14('0x16')](function(_0x3c0263){if(_0x3c0263&&_0x3c0263[_0x0b14('0x3a')]===0x0){return db[_0x0b14('0x19')][_0x0b14('0x34')]({'name':_0x3acf13['name'],'resourceId':_0x3acf13['id'],'type':_0x3c0263[_0x0b14('0x1b')],'sectionId':_0x3c0263['id']},{})[_0x0b14('0x16')](function(){return _0x9b1dd5;});}else{return _0x9b1dd5;}})[_0x0b14('0x29')](function(_0x474836){logger[_0x0b14('0x3b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x474836);throw _0x474836;});}return _0x9b1dd5;})[_0x0b14('0x16')](respondWithResult(_0x1487fa,0xc9))[_0x0b14('0x29')](handleError(_0x1487fa,null));};exports[_0x0b14('0x15')]=function(_0x111b66,_0x2a6412){if(_0x111b66['body']['id']){delete _0x111b66[_0x0b14('0x35')]['id'];}return db[_0x0b14('0x1f')]['find']({'where':{'id':_0x111b66[_0x0b14('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2a6412,null))[_0x0b14('0x16')](saveUpdates(_0x111b66[_0x0b14('0x35')],null))[_0x0b14('0x16')](respondWithResult(_0x2a6412,null))[_0x0b14('0x29')](handleError(_0x2a6412,null));};exports[_0x0b14('0x17')]=function(_0x32a7a3,_0x4663e7){return db[_0x0b14('0x1f')][_0x0b14('0x33')]({'where':{'id':_0x32a7a3[_0x0b14('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4663e7,null))[_0x0b14('0x16')](removeEntity(_0x4663e7,null))[_0x0b14('0x29')](handleError(_0x4663e7,null));};exports[_0x0b14('0x3c')]=function(_0x113a15,_0x28fde8){return db[_0x0b14('0x1f')][_0x0b14('0x3c')]()['then'](respondWithResult(_0x28fde8,null))[_0x0b14('0x29')](handleError(_0x28fde8,null));};exports[_0x0b14('0x3d')]=function(_0x56c5ec,_0x35c197){var _0x33e4e0={'raw':!![],'where':{}},_0x4b3929={},_0x5a986d;return db[_0x0b14('0x1f')][_0x0b14('0x3e')]({'where':{'id':_0x56c5ec[_0x0b14('0x2a')]['id']}})[_0x0b14('0x16')](handleEntityNotFound(_0x35c197,null))[_0x0b14('0x16')](function(_0x537aa5){if(_0x537aa5){_0x5a986d=_0x537aa5['get']({'plain':!![]});_0x4b3929[_0x0b14('0x2e')]=_['keys'](db[_0x0b14('0x3f')]['rawAttributes']);_0x4b3929['query']=_[_0x0b14('0x2b')](_0x56c5ec[_0x0b14('0x26')]);_0x4b3929[_0x0b14('0x2c')]=_['intersection'](_0x4b3929[_0x0b14('0x2e')],_0x4b3929[_0x0b14('0x26')]);_0x33e4e0['attributes']=_[_0x0b14('0x2d')](_0x4b3929['model'],qs[_0x0b14('0x2f')](_0x56c5ec[_0x0b14('0x26')]['fields']));_0x33e4e0[_0x0b14('0x30')]=_0x33e4e0[_0x0b14('0x30')][_0x0b14('0x40')]?_0x33e4e0['attributes']:_0x4b3929[_0x0b14('0x2e')];if(!_0x56c5ec[_0x0b14('0x26')]['hasOwnProperty']('nolimit')){_0x33e4e0['limit']=qs['limit'](_0x56c5ec['query']['limit']);_0x33e4e0[_0x0b14('0xe')]=qs[_0x0b14('0xe')](_0x56c5ec[_0x0b14('0x26')][_0x0b14('0xe')]);}_0x33e4e0[_0x0b14('0x41')]=qs[_0x0b14('0x42')](_0x56c5ec[_0x0b14('0x26')]['sort']);_0x33e4e0[_0x0b14('0x24')]=qs['filters'](_[_0x0b14('0x43')](_0x56c5ec[_0x0b14('0x26')],_0x4b3929['filters']));_0x33e4e0['where'][_0x0b14('0x44')]=_0x537aa5['id'];if(_0x56c5ec['query'][_0x0b14('0x45')]){_0x33e4e0[_0x0b14('0x24')]=_[_0x0b14('0x32')](_0x33e4e0['where'],{'$or':_['map'](_0x33e4e0['attributes'],function(_0x2b3203){var _0xd25c26={};_0xd25c26[_0x2b3203]={'$like':'%'+_0x56c5ec[_0x0b14('0x26')]['filter']+'%'};return _0xd25c26;})});}_0x33e4e0=_[_0x0b14('0x32')]({},_0x33e4e0,_0x56c5ec[_0x0b14('0x46')]);return db[_0x0b14('0x3f')]['findAll'](_0x33e4e0);}})[_0x0b14('0x16')](function(_0x32c7c1){if(_0x32c7c1){return db[_0x0b14('0x47')][_0x0b14('0x48')]({'where':{'id':_['map'](_0x32c7c1,_0x0b14('0x49')),'role':'agent'},'attributes':['id',_0x0b14('0x1b'),'mailPause','updatedAt','createdAt']});}})[_0x0b14('0x16')](function(_0x211899){if(_0x211899){return{'count':_0x211899[_0x0b14('0x10')],'rows':_[_0x0b14('0x1e')](_0x211899[_0x0b14('0x28')],function(_0x346757){return{'membername':_0x346757['name'],'UserId':_0x346757['id'],'queue_name':_0x5a986d[_0x0b14('0x1b')],'MailQueueId':_0x5a986d['id'],'interface':util[_0x0b14('0x4a')](_0x0b14('0x4b'),_0x0b14('0x4c'),_0x346757['name']),'penalty':0x0,'paused':_0x346757[_0x0b14('0x4d')],'createdAt':_0x346757[_0x0b14('0x4e')],'updatedAt':_0x346757[_0x0b14('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0b14('0x16')](respondWithFilteredResult(_0x35c197,_0x33e4e0))['catch'](handleError(_0x35c197,null));};exports[_0x0b14('0x50')]=function(_0xdf76c5,_0x1d87eb){var _0x32c391={};var _0x3acabd={};var _0x26c7ab;var _0x11884f;return db[_0x0b14('0x1f')]['findOne']({'where':{'id':_0xdf76c5[_0x0b14('0x2a')]['id']}})[_0x0b14('0x16')](handleEntityNotFound(_0x1d87eb,null))[_0x0b14('0x16')](function(_0x32be9c){if(_0x32be9c){_0x26c7ab=_0x32be9c;_0x3acabd[_0x0b14('0x2e')]=_[_0x0b14('0x2b')](db[_0x0b14('0x51')]['rawAttributes']);_0x3acabd[_0x0b14('0x26')]=_[_0x0b14('0x2b')](_0xdf76c5[_0x0b14('0x26')]);_0x3acabd[_0x0b14('0x2c')]=_[_0x0b14('0x2d')](_0x3acabd[_0x0b14('0x2e')],_0x3acabd[_0x0b14('0x26')]);_0x32c391[_0x0b14('0x30')]=_['intersection'](_0x3acabd[_0x0b14('0x2e')],qs['fields'](_0xdf76c5[_0x0b14('0x26')][_0x0b14('0x2f')]));_0x32c391['attributes']=_0x32c391[_0x0b14('0x30')]['length']?_0x32c391['attributes']:_0x3acabd['model'];_0x32c391[_0x0b14('0x41')]=qs['sort'](_0xdf76c5[_0x0b14('0x26')][_0x0b14('0x42')]);_0x32c391['where']=qs[_0x0b14('0x2c')](_[_0x0b14('0x43')](_0xdf76c5[_0x0b14('0x26')],_0x3acabd[_0x0b14('0x2c')]));if(_0xdf76c5[_0x0b14('0x26')][_0x0b14('0x45')]){_0x32c391['where']=_[_0x0b14('0x32')](_0x32c391[_0x0b14('0x24')],{'$or':_[_0x0b14('0x1e')](_0x32c391[_0x0b14('0x30')],function(_0x20dfb6){var _0x43c53c={};_0x43c53c[_0x20dfb6]={'$like':'%'+_0xdf76c5[_0x0b14('0x26')][_0x0b14('0x45')]+'%'};return _0x43c53c;})});}_0x32c391=_[_0x0b14('0x32')]({},_0x32c391,_0xdf76c5[_0x0b14('0x46')]);return _0x26c7ab[_0x0b14('0x50')](_0x32c391);}})[_0x0b14('0x16')](function(_0x3b1f11){if(_0x3b1f11){_0x11884f=_0x3b1f11['length'];if(!_0xdf76c5[_0x0b14('0x26')][_0x0b14('0x52')](_0x0b14('0x53'))){_0x32c391['limit']=qs['limit'](_0xdf76c5[_0x0b14('0x26')][_0x0b14('0x11')]);_0x32c391['offset']=qs[_0x0b14('0xe')](_0xdf76c5['query'][_0x0b14('0xe')]);}return _0x26c7ab[_0x0b14('0x50')](_0x32c391);}})[_0x0b14('0x16')](function(_0x434cee){if(_0x434cee){return _0x434cee?{'count':_0x11884f,'rows':_0x434cee}:null;}})[_0x0b14('0x16')](respondWithResult(_0x1d87eb,null))[_0x0b14('0x29')](handleError(_0x1d87eb,null));};exports[_0x0b14('0x54')]=function(_0x228283,_0x11d9ca){var _0x1ce2ee=_0x228283[_0x0b14('0x35')][_0x0b14('0x55')];return db[_0x0b14('0x51')][_0x0b14('0x27')]({'where':{'id':_0x1ce2ee},'attributes':['id'],'include':[{'model':db[_0x0b14('0x47')],'as':_0x0b14('0x56'),'attributes':['id',_0x0b14('0x1b'),_0x0b14('0x57'),_0x0b14('0x58'),'interface'],'raw':!![]}]})[_0x0b14('0x16')](function(_0x35ac40){if(_0x35ac40){var _0x42fe74=_['flatMap'](_0x35ac40,function(_0x58ee2e){var _0x174773=_0x58ee2e['get']({'plain':!![]});return _0x174773[_0x0b14('0x56')];});return db[_0x0b14('0x1f')][_0x0b14('0x33')]({'where':{'id':_0x228283[_0x0b14('0x2a')]['id']}})['then'](function(_0xa1aea9){return db['sequelize']['transaction'](function(_0x4aa7f4){return _0xa1aea9[_0x0b14('0x54')](_0x1ce2ee,{'transaction':_0x4aa7f4})[_0x0b14('0x16')](function(){return BPromise['each'](_0x42fe74,function(_0x39b05e){return db[_0x0b14('0x3f')][_0x0b14('0x59')]({'where':{'UserId':_0x39b05e['id'],'MailQueueId':_0x228283[_0x0b14('0x2a')]['id']},'transaction':_0x4aa7f4});});})[_0x0b14('0x16')](function(){_0x42fe74[_0x0b14('0x5a')](function(_0x3a285d){socket[_0x0b14('0x5b')](_0x0b14('0x5c'),{'UserId':_0x3a285d['id'],'MailQueueId':_0xa1aea9['id']});});});});});}})[_0x0b14('0x16')](respondWithStatusCode(_0x11d9ca,null))[_0x0b14('0x29')](handleError(_0x11d9ca,null));};exports[_0x0b14('0x5d')]=function(_0x420f03,_0x4535d2){return db['Team'][_0x0b14('0x27')]({'where':{'id':_0x420f03['query'][_0x0b14('0x55')]},'attributes':['id'],'include':[{'model':db[_0x0b14('0x47')],'as':_0x0b14('0x56'),'attributes':['id'],'raw':!![]}]})[_0x0b14('0x16')](handleEntityNotFound(_0x4535d2,null))[_0x0b14('0x16')](function(_0x36f29c){var _0x5617c0=_[_0x0b14('0x1e')](_0x36f29c,'id');var _0x142019=[];var _0x4bffd4=[];var _0x3e06a7=squel[_0x0b14('0x5e')]();_0x3e06a7[_0x0b14('0x5f')]('tq.TeamId')[_0x0b14('0x60')](_0x0b14('0x61'),'tq')[_0x0b14('0x62')](_0x0b14('0x63'),'ut',_0x0b14('0x64'))['where'](_0x0b14('0x65'),_0x420f03['params']['id']);for(var _0x3f45ec=0x0;_0x3f45ec<_0x36f29c[_0x0b14('0x40')];_0x3f45ec+=0x1){let _0x475cf1=_0x36f29c[_0x3f45ec];for(var _0x58a61c=0x0;_0x58a61c<_0x475cf1[_0x0b14('0x56')][_0x0b14('0x40')];_0x58a61c+=0x1){let _0x1b7e31=_0x475cf1['Agents'][_0x58a61c];var _0x172621=_0x3e06a7[_0x0b14('0x66')]();_0x172621['where'](_0x0b14('0x67'),_0x1b7e31['id']);_0x4bffd4[_0x0b14('0x68')](db[_0x0b14('0x69')][_0x0b14('0x26')](_0x172621[_0x0b14('0x6a')](),{'type':db[_0x0b14('0x69')][_0x0b14('0x6b')][_0x0b14('0x6c')]})['then'](function(_0x57520f){if(_0x57520f[_0x0b14('0x40')]===0x1){return _0x1b7e31['id'];}else{var _0x505149=_[_0x0b14('0x6d')](_[_0x0b14('0x1e')](_0x57520f,_0x0b14('0x6e')),function(_0xe8d4c7){return _['includes'](_0x5617c0,_0xe8d4c7);});if(_0x505149){return _0x1b7e31['id'];}}}));}}return BPromise[_0x0b14('0x6f')](_0x4bffd4)[_0x0b14('0x16')](function(_0x103125){_0x142019=_(_0x142019)[_0x0b14('0x70')](_0x103125)[_0x0b14('0x71')]()[_0x0b14('0x72')]();return db[_0x0b14('0x1f')][_0x0b14('0x33')]({'where':{'id':_0x420f03[_0x0b14('0x2a')]['id']}})[_0x0b14('0x16')](function(_0x44a134){return db[_0x0b14('0x69')][_0x0b14('0x73')](function(_0xa4cd33){return _0x44a134[_0x0b14('0x5d')](_0x420f03[_0x0b14('0x26')][_0x0b14('0x55')],{'transaction':_0xa4cd33})[_0x0b14('0x16')](function(){if(!_[_0x0b14('0x74')](_0x142019)){return _0x44a134[_0x0b14('0x75')](_0x142019,{'transaction':_0xa4cd33});}})['then'](function(){_0x142019['forEach'](function(_0x386792){socket[_0x0b14('0x5b')](_0x0b14('0x76'),{'UserId':_0x386792,'MailQueueId':_0x44a134['id']});});});});});});})[_0x0b14('0x16')](respondWithStatusCode(_0x4535d2,null))[_0x0b14('0x29')](handleError(_0x4535d2,null));};exports[_0x0b14('0x77')]=function(_0xb2ef7b,_0x2e453b){return db[_0x0b14('0x1f')][_0x0b14('0x33')]({'where':{'id':_0xb2ef7b[_0x0b14('0x2a')]['id']}})[_0x0b14('0x16')](handleEntityNotFound(_0x2e453b,null))['then'](function(_0x4fc54b){if(_0x4fc54b){return _0x4fc54b[_0x0b14('0x77')](_0xb2ef7b[_0x0b14('0x35')]['ids'],_[_0x0b14('0x78')](_0xb2ef7b[_0x0b14('0x35')],[_0x0b14('0x55'),'id'])||{})[_0x0b14('0x79')](function(_0x71144e){for(var _0x2cd97b=0x0;_0x2cd97b<_0xb2ef7b[_0x0b14('0x35')][_0x0b14('0x55')][_0x0b14('0x40')];_0x2cd97b+=0x1){socket[_0x0b14('0x5b')](_0x0b14('0x5c'),{'UserId':Number(_0xb2ef7b['body'][_0x0b14('0x55')][_0x2cd97b]),'MailQueueId':Number(_0xb2ef7b['params']['id'])});}return _0x71144e;});}})[_0x0b14('0x16')](respondWithResult(_0x2e453b,null))['catch'](handleError(_0x2e453b,null));};exports[_0x0b14('0x75')]=function(_0x5260fe,_0x301d4b){return db[_0x0b14('0x1f')][_0x0b14('0x33')]({'where':{'id':_0x5260fe[_0x0b14('0x2a')]['id']}})[_0x0b14('0x16')](handleEntityNotFound(_0x301d4b,null))[_0x0b14('0x16')](function(_0x188b69){if(_0x188b69){return _0x188b69[_0x0b14('0x75')](_0x5260fe[_0x0b14('0x26')]['ids'])['then'](function(){if(_[_0x0b14('0x7a')](_0x5260fe[_0x0b14('0x26')][_0x0b14('0x55')])){for(var _0x82c529=0x0;_0x82c529<_0x5260fe[_0x0b14('0x26')]['ids']['length'];_0x82c529+=0x1){socket[_0x0b14('0x5b')]('userMailQueue:remove',{'UserId':Number(_0x5260fe[_0x0b14('0x26')][_0x0b14('0x55')][_0x82c529]),'MailQueueId':Number(_0x5260fe[_0x0b14('0x2a')]['id'])});}}else{socket['emit'](_0x0b14('0x76'),{'UserId':Number(_0x5260fe[_0x0b14('0x26')]['ids']),'MailQueueId':Number(_0x5260fe[_0x0b14('0x2a')]['id'])});}});}})[_0x0b14('0x16')](respondWithStatusCode(_0x301d4b,null))['catch'](handleError(_0x301d4b,null));};exports['getAgents']=function(_0x211190,_0xf947db){var _0x476f75={};var _0x15eec2={};var _0x2f9f8d;var _0x552dc6;return db[_0x0b14('0x1f')][_0x0b14('0x3e')]({'where':{'id':_0x211190[_0x0b14('0x2a')]['id']}})[_0x0b14('0x16')](handleEntityNotFound(_0xf947db,null))[_0x0b14('0x16')](function(_0x2ce263){if(_0x2ce263){_0x2f9f8d=_0x2ce263;_0x15eec2[_0x0b14('0x2e')]=_[_0x0b14('0x2b')](db[_0x0b14('0x47')][_0x0b14('0x20')]);_0x15eec2['query']=_[_0x0b14('0x2b')](_0x211190[_0x0b14('0x26')]);_0x15eec2[_0x0b14('0x2c')]=_[_0x0b14('0x2d')](_0x15eec2[_0x0b14('0x2e')],_0x15eec2['query']);_0x476f75[_0x0b14('0x30')]=_[_0x0b14('0x2d')](_0x15eec2[_0x0b14('0x2e')],qs[_0x0b14('0x2f')](_0x211190['query'][_0x0b14('0x2f')]));_0x476f75['attributes']=_0x476f75[_0x0b14('0x30')]['length']?_0x476f75[_0x0b14('0x30')]:_0x15eec2['model'];_0x476f75[_0x0b14('0x41')]=qs[_0x0b14('0x42')](_0x211190[_0x0b14('0x26')][_0x0b14('0x42')]);_0x476f75['where']=qs[_0x0b14('0x2c')](_[_0x0b14('0x43')](_0x211190['query'],_0x15eec2[_0x0b14('0x2c')]));if(_0x211190[_0x0b14('0x26')][_0x0b14('0x45')]){_0x476f75[_0x0b14('0x24')]=_[_0x0b14('0x32')](_0x476f75['where'],{'$or':_[_0x0b14('0x1e')](_0x476f75[_0x0b14('0x30')],function(_0x196940){var _0x125d9e={};_0x125d9e[_0x196940]={'$like':'%'+_0x211190['query'][_0x0b14('0x45')]+'%'};return _0x125d9e;})});}_0x476f75=_['merge']({},_0x476f75,_0x211190[_0x0b14('0x46')]);return _0x2f9f8d['getAgents'](_0x476f75);}})[_0x0b14('0x16')](function(_0x46e50b){if(_0x46e50b){_0x552dc6=_0x46e50b[_0x0b14('0x40')];if(!_0x211190[_0x0b14('0x26')]['hasOwnProperty'](_0x0b14('0x53'))){_0x476f75['limit']=qs[_0x0b14('0x11')](_0x211190['query'][_0x0b14('0x11')]);_0x476f75['offset']=qs[_0x0b14('0xe')](_0x211190[_0x0b14('0x26')][_0x0b14('0xe')]);}return _0x2f9f8d[_0x0b14('0x7b')](_0x476f75);}})[_0x0b14('0x16')](function(_0x1509ff){if(_0x1509ff){return _0x1509ff?{'count':_0x552dc6,'rows':_0x1509ff}:null;}})[_0x0b14('0x16')](respondWithResult(_0xf947db,null))[_0x0b14('0x29')](handleError(_0xf947db,null));}; \ No newline at end of file +var _0x0460=['name','send','index','map','MailQueue','fieldName','type','where','include','query','findAll','rows','catch','show','params','keys','rawAttributes','filters','model','attributes','intersection','fields','includeAll','merge','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','describe','UserMailQueue','length','nolimit','order','sort','pick','filter','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','userMailQueue:save','field','tq.TeamId','team_has_mail_queues','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','includes','all','union','compact','value','removeTeams','ids','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','spread','isArray','getAgents','findOne','hasOwnProperty','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','./mailQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','update','then','destroy','get','MailQueues','UserProfileResource'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x0460,0xd2));var _0x0046=function(_0x218819,_0x4b151a){_0x218819=_0x218819-0x0;var _0x5d3a33=_0x0460[_0x218819];return _0x5d3a33;};'use strict';var BPromise=require(_0x0046('0x0'));var util=require(_0x0046('0x1'));var _=require(_0x0046('0x2'));var squel=require(_0x0046('0x3'));var Redis=require(_0x0046('0x4'));var qs=require(_0x0046('0x5'));var logger=require(_0x0046('0x6'))(_0x0046('0x7'));var config=require(_0x0046('0x8'));var db=require('../../mysqldb')['db'];config[_0x0046('0x9')]=_[_0x0046('0xa')](config[_0x0046('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0046('0x9')]));require(_0x0046('0xb'))[_0x0046('0xc')](socket);function respondWithStatusCode(_0x9024af,_0x3dbdef){_0x3dbdef=_0x3dbdef||0xcc;return function(_0x2b861f){if(_0x2b861f){return _0x9024af[_0x0046('0xd')](_0x3dbdef);}return _0x9024af[_0x0046('0xe')](_0x3dbdef)[_0x0046('0xf')]();};}function respondWithResult(_0x355afa,_0x1dae7f){_0x1dae7f=_0x1dae7f||0xc8;return function(_0x1c97bd){if(_0x1c97bd){return _0x355afa[_0x0046('0xe')](_0x1dae7f)['json'](_0x1c97bd);}};}function respondWithFilteredResult(_0x6d760b,_0xdac84){return function(_0x4b5678){if(_0x4b5678){var _0x31b69b=typeof _0xdac84[_0x0046('0x10')]===_0x0046('0x11')&&typeof _0xdac84[_0x0046('0x12')]===_0x0046('0x11');var _0x292401=_0x4b5678[_0x0046('0x13')];var _0x269c57=_0x31b69b?0x0:_0xdac84[_0x0046('0x10')];var _0x4170d4=_0x31b69b?_0x4b5678[_0x0046('0x13')]:_0xdac84[_0x0046('0x10')]+_0xdac84[_0x0046('0x12')];var _0x1f9619;if(_0x4170d4>=_0x292401){_0x4170d4=_0x292401;_0x1f9619=0xc8;}else{_0x1f9619=0xce;}_0x6d760b[_0x0046('0xe')](_0x1f9619);return _0x6d760b['set'](_0x0046('0x14'),_0x269c57+'-'+_0x4170d4+'/'+_0x292401)[_0x0046('0x15')](_0x4b5678);}return null;};}function saveUpdates(_0x43d9a9){return function(_0x1b48c4){if(_0x1b48c4){return _0x1b48c4[_0x0046('0x16')](_0x43d9a9)[_0x0046('0x17')](function(_0x837b3b){return _0x837b3b;});}return null;};}function removeEntity(_0x1d3714){return function(_0x173263){if(_0x173263){return _0x173263[_0x0046('0x18')]()[_0x0046('0x17')](function(){var _0x33c47d=_0x173263[_0x0046('0x19')]({'plain':!![]});var _0xb53582=_0x0046('0x1a');return db[_0x0046('0x1b')][_0x0046('0x18')]({'where':{'type':_0xb53582,'resourceId':_0x33c47d['id']}})[_0x0046('0x17')](function(){return _0x173263;});})[_0x0046('0x17')](function(){_0x1d3714[_0x0046('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ae3ad){return function(_0xfb3177){if(!_0xfb3177){_0x2ae3ad[_0x0046('0xd')](0x194);}return _0xfb3177;};}function handleError(_0x2eb0bd,_0xf88f82){_0xf88f82=_0xf88f82||0x1f4;return function(_0x146f84){logger['error'](_0x146f84['stack']);if(_0x146f84[_0x0046('0x1c')]){delete _0x146f84[_0x0046('0x1c')];}_0x2eb0bd[_0x0046('0xe')](_0xf88f82)[_0x0046('0x1d')](_0x146f84);};}exports[_0x0046('0x1e')]=function(_0x36a2ff,_0x9e9a96){var _0x851755={};var _0x81cd5f={'count':0x0,'rows':[]};var _0x43fcae=_[_0x0046('0x1f')](db[_0x0046('0x20')]['rawAttributes'],function(_0x2607e6){return{'name':_0x2607e6[_0x0046('0x21')],'type':_0x2607e6[_0x0046('0x22')]['key']};});_0x851755=qs['getOptions'](_0x43fcae,_0x36a2ff);var _0x428d43={'where':_0x851755[_0x0046('0x23')]};return db[_0x0046('0x20')][_0x0046('0x13')](_0x428d43)[_0x0046('0x17')](function(_0xd003fb){_0x81cd5f[_0x0046('0x13')]=_0xd003fb;_0x851755[_0x0046('0x24')]=qs[_0x0046('0x24')](_0x36a2ff[_0x0046('0x25')]);return db['MailQueue'][_0x0046('0x26')](_0x851755);})[_0x0046('0x17')](function(_0x1a3275){_0x81cd5f[_0x0046('0x27')]=_0x1a3275;return _0x81cd5f;})[_0x0046('0x17')](respondWithFilteredResult(_0x9e9a96,_0x851755))[_0x0046('0x28')](handleError(_0x9e9a96,null));};exports[_0x0046('0x29')]=function(_0x22197a,_0x1535d1){var _0x1d1dfe={'raw':!![],'where':{'id':_0x22197a[_0x0046('0x2a')]['id']}},_0x5184d0={};_0x5184d0['model']=_[_0x0046('0x2b')](db[_0x0046('0x20')][_0x0046('0x2c')]);_0x5184d0[_0x0046('0x25')]=_[_0x0046('0x2b')](_0x22197a[_0x0046('0x25')]);_0x5184d0[_0x0046('0x2d')]=_['intersection'](_0x5184d0[_0x0046('0x2e')],_0x5184d0['query']);_0x1d1dfe[_0x0046('0x2f')]=_[_0x0046('0x30')](_0x5184d0[_0x0046('0x2e')],qs[_0x0046('0x31')](_0x22197a[_0x0046('0x25')]['fields']));_0x1d1dfe[_0x0046('0x2f')]=_0x1d1dfe[_0x0046('0x2f')]['length']?_0x1d1dfe[_0x0046('0x2f')]:_0x5184d0['model'];if(_0x22197a[_0x0046('0x25')][_0x0046('0x32')]){_0x1d1dfe[_0x0046('0x24')]=[{'all':!![]}];}_0x1d1dfe=_[_0x0046('0x33')]({},_0x1d1dfe,_0x22197a[_0x0046('0x34')]);return db[_0x0046('0x20')][_0x0046('0x35')](_0x1d1dfe)['then'](handleEntityNotFound(_0x1535d1,null))[_0x0046('0x17')](respondWithResult(_0x1535d1,null))[_0x0046('0x28')](handleError(_0x1535d1,null));};exports[_0x0046('0x36')]=function(_0x3eaf76,_0x1c4e81){return db[_0x0046('0x20')]['create'](_0x3eaf76[_0x0046('0x37')],{})['then'](function(_0x7a9eb4){var _0xfec577=_0x3eaf76[_0x0046('0x38')][_0x0046('0x19')]({'plain':!![]});if(!_0xfec577)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfec577[_0x0046('0x39')]===_0x0046('0x38')){var _0x3c786f=_0x7a9eb4['get']({'plain':!![]});var _0x40dddd=_0x0046('0x1a');return db[_0x0046('0x3a')][_0x0046('0x35')]({'where':{'name':_0x40dddd,'userProfileId':_0xfec577[_0x0046('0x3b')]},'raw':!![]})[_0x0046('0x17')](function(_0x59cfc4){if(_0x59cfc4&&_0x59cfc4[_0x0046('0x3c')]===0x0){return db[_0x0046('0x1b')]['create']({'name':_0x3c786f['name'],'resourceId':_0x3c786f['id'],'type':_0x59cfc4[_0x0046('0x1c')],'sectionId':_0x59cfc4['id']},{})['then'](function(){return _0x7a9eb4;});}else{return _0x7a9eb4;}})[_0x0046('0x28')](function(_0x4f5d97){logger[_0x0046('0x3d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f5d97);throw _0x4f5d97;});}return _0x7a9eb4;})['then'](respondWithResult(_0x1c4e81,0xc9))[_0x0046('0x28')](handleError(_0x1c4e81,null));};exports[_0x0046('0x16')]=function(_0x1c20de,_0x119080){if(_0x1c20de[_0x0046('0x37')]['id']){delete _0x1c20de[_0x0046('0x37')]['id'];}return db['MailQueue'][_0x0046('0x35')]({'where':{'id':_0x1c20de[_0x0046('0x2a')]['id']}})['then'](handleEntityNotFound(_0x119080,null))[_0x0046('0x17')](saveUpdates(_0x1c20de[_0x0046('0x37')],null))[_0x0046('0x17')](respondWithResult(_0x119080,null))[_0x0046('0x28')](handleError(_0x119080,null));};exports[_0x0046('0x18')]=function(_0x4c1464,_0x5a0bff){return db[_0x0046('0x20')][_0x0046('0x35')]({'where':{'id':_0x4c1464[_0x0046('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5a0bff,null))[_0x0046('0x17')](removeEntity(_0x5a0bff,null))[_0x0046('0x28')](handleError(_0x5a0bff,null));};exports[_0x0046('0x3e')]=function(_0xbf4fe1,_0x147b28){return db[_0x0046('0x20')][_0x0046('0x3e')]()[_0x0046('0x17')](respondWithResult(_0x147b28,null))[_0x0046('0x28')](handleError(_0x147b28,null));};exports['getMembers']=function(_0x470168,_0xd8ed82){var _0x45e6ba={'raw':!![],'where':{}},_0x31f759={},_0x2d17e7;return db[_0x0046('0x20')]['findOne']({'where':{'id':_0x470168['params']['id']}})[_0x0046('0x17')](handleEntityNotFound(_0xd8ed82,null))[_0x0046('0x17')](function(_0x32948b){if(_0x32948b){_0x2d17e7=_0x32948b[_0x0046('0x19')]({'plain':!![]});_0x31f759['model']=_[_0x0046('0x2b')](db[_0x0046('0x3f')][_0x0046('0x2c')]);_0x31f759['query']=_['keys'](_0x470168['query']);_0x31f759['filters']=_[_0x0046('0x30')](_0x31f759[_0x0046('0x2e')],_0x31f759['query']);_0x45e6ba[_0x0046('0x2f')]=_[_0x0046('0x30')](_0x31f759['model'],qs[_0x0046('0x31')](_0x470168[_0x0046('0x25')]['fields']));_0x45e6ba['attributes']=_0x45e6ba[_0x0046('0x2f')][_0x0046('0x40')]?_0x45e6ba[_0x0046('0x2f')]:_0x31f759[_0x0046('0x2e')];if(!_0x470168[_0x0046('0x25')]['hasOwnProperty'](_0x0046('0x41'))){_0x45e6ba['limit']=qs[_0x0046('0x12')](_0x470168[_0x0046('0x25')][_0x0046('0x12')]);_0x45e6ba[_0x0046('0x10')]=qs['offset'](_0x470168[_0x0046('0x25')]['offset']);}_0x45e6ba[_0x0046('0x42')]=qs['sort'](_0x470168['query'][_0x0046('0x43')]);_0x45e6ba[_0x0046('0x23')]=qs[_0x0046('0x2d')](_[_0x0046('0x44')](_0x470168[_0x0046('0x25')],_0x31f759[_0x0046('0x2d')]));_0x45e6ba[_0x0046('0x23')]['MailQueueId']=_0x32948b['id'];if(_0x470168[_0x0046('0x25')][_0x0046('0x45')]){_0x45e6ba[_0x0046('0x23')]=_[_0x0046('0x33')](_0x45e6ba['where'],{'$or':_[_0x0046('0x1f')](_0x45e6ba[_0x0046('0x2f')],function(_0x525f58){var _0x1ffcad={};_0x1ffcad[_0x525f58]={'$like':'%'+_0x470168[_0x0046('0x25')][_0x0046('0x45')]+'%'};return _0x1ffcad;})});}_0x45e6ba=_['merge']({},_0x45e6ba,_0x470168['options']);return db[_0x0046('0x3f')][_0x0046('0x26')](_0x45e6ba);}})[_0x0046('0x17')](function(_0x7f1283){if(_0x7f1283){return db[_0x0046('0x46')][_0x0046('0x47')]({'where':{'id':_[_0x0046('0x1f')](_0x7f1283,_0x0046('0x48')),'role':_0x0046('0x49')},'attributes':['id','name',_0x0046('0x4a'),_0x0046('0x4b'),_0x0046('0x4c')]});}})['then'](function(_0x3923fc){if(_0x3923fc){return{'count':_0x3923fc[_0x0046('0x13')],'rows':_[_0x0046('0x1f')](_0x3923fc['rows'],function(_0x482e00){return{'membername':_0x482e00[_0x0046('0x1c')],'UserId':_0x482e00['id'],'queue_name':_0x2d17e7[_0x0046('0x1c')],'MailQueueId':_0x2d17e7['id'],'interface':util[_0x0046('0x4d')](_0x0046('0x4e'),_0x0046('0x4f'),_0x482e00[_0x0046('0x1c')]),'penalty':0x0,'paused':_0x482e00[_0x0046('0x4a')],'createdAt':_0x482e00[_0x0046('0x4c')],'updatedAt':_0x482e00['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0046('0x17')](respondWithFilteredResult(_0xd8ed82,_0x45e6ba))[_0x0046('0x28')](handleError(_0xd8ed82,null));};exports[_0x0046('0x50')]=function(_0x20f672,_0xf7428b){var _0x3b7b53={};var _0x5c0a1d={};var _0x3b4fc1;var _0x2dc831;return db[_0x0046('0x20')]['findOne']({'where':{'id':_0x20f672[_0x0046('0x2a')]['id']}})['then'](handleEntityNotFound(_0xf7428b,null))[_0x0046('0x17')](function(_0x4cc9c2){if(_0x4cc9c2){_0x3b4fc1=_0x4cc9c2;_0x5c0a1d[_0x0046('0x2e')]=_[_0x0046('0x2b')](db[_0x0046('0x51')][_0x0046('0x2c')]);_0x5c0a1d['query']=_[_0x0046('0x2b')](_0x20f672[_0x0046('0x25')]);_0x5c0a1d[_0x0046('0x2d')]=_['intersection'](_0x5c0a1d[_0x0046('0x2e')],_0x5c0a1d['query']);_0x3b7b53['attributes']=_[_0x0046('0x30')](_0x5c0a1d[_0x0046('0x2e')],qs[_0x0046('0x31')](_0x20f672['query']['fields']));_0x3b7b53[_0x0046('0x2f')]=_0x3b7b53['attributes'][_0x0046('0x40')]?_0x3b7b53[_0x0046('0x2f')]:_0x5c0a1d['model'];_0x3b7b53[_0x0046('0x42')]=qs[_0x0046('0x43')](_0x20f672[_0x0046('0x25')][_0x0046('0x43')]);_0x3b7b53[_0x0046('0x23')]=qs[_0x0046('0x2d')](_[_0x0046('0x44')](_0x20f672['query'],_0x5c0a1d[_0x0046('0x2d')]));if(_0x20f672[_0x0046('0x25')][_0x0046('0x45')]){_0x3b7b53[_0x0046('0x23')]=_[_0x0046('0x33')](_0x3b7b53[_0x0046('0x23')],{'$or':_[_0x0046('0x1f')](_0x3b7b53[_0x0046('0x2f')],function(_0xdeaa30){var _0x19ff59={};_0x19ff59[_0xdeaa30]={'$like':'%'+_0x20f672[_0x0046('0x25')][_0x0046('0x45')]+'%'};return _0x19ff59;})});}_0x3b7b53=_['merge']({},_0x3b7b53,_0x20f672[_0x0046('0x34')]);return _0x3b4fc1[_0x0046('0x50')](_0x3b7b53);}})[_0x0046('0x17')](function(_0x5139c5){if(_0x5139c5){_0x2dc831=_0x5139c5[_0x0046('0x40')];if(!_0x20f672['query']['hasOwnProperty'](_0x0046('0x41'))){_0x3b7b53[_0x0046('0x12')]=qs[_0x0046('0x12')](_0x20f672[_0x0046('0x25')][_0x0046('0x12')]);_0x3b7b53[_0x0046('0x10')]=qs[_0x0046('0x10')](_0x20f672[_0x0046('0x25')]['offset']);}return _0x3b4fc1[_0x0046('0x50')](_0x3b7b53);}})[_0x0046('0x17')](function(_0x4d1f2b){if(_0x4d1f2b){return _0x4d1f2b?{'count':_0x2dc831,'rows':_0x4d1f2b}:null;}})[_0x0046('0x17')](respondWithResult(_0xf7428b,null))['catch'](handleError(_0xf7428b,null));};exports[_0x0046('0x52')]=function(_0x5502ac,_0x202c70){var _0x52766c=_0x5502ac[_0x0046('0x37')]['ids'];return db[_0x0046('0x51')][_0x0046('0x26')]({'where':{'id':_0x52766c},'attributes':['id'],'include':[{'model':db[_0x0046('0x46')],'as':_0x0046('0x53'),'attributes':['id','name',_0x0046('0x54'),_0x0046('0x55'),_0x0046('0x56')],'raw':!![]}]})['then'](function(_0x259a96){if(_0x259a96){var _0x278c93=_[_0x0046('0x57')](_0x259a96,function(_0x3e14f8){var _0x2f10dc=_0x3e14f8['get']({'plain':!![]});return _0x2f10dc[_0x0046('0x53')];});return db[_0x0046('0x20')][_0x0046('0x35')]({'where':{'id':_0x5502ac['params']['id']}})[_0x0046('0x17')](function(_0xc4e699){return db[_0x0046('0x58')][_0x0046('0x59')](function(_0x2a42d4){return _0xc4e699[_0x0046('0x52')](_0x52766c,{'transaction':_0x2a42d4})['then'](function(){return BPromise[_0x0046('0x5a')](_0x278c93,function(_0x9255a6){return db[_0x0046('0x3f')]['findOrCreate']({'where':{'UserId':_0x9255a6['id'],'MailQueueId':_0x5502ac['params']['id']},'transaction':_0x2a42d4});});})[_0x0046('0x17')](function(){_0x278c93[_0x0046('0x5b')](function(_0x44a4a8){socket['emit'](_0x0046('0x5c'),{'UserId':_0x44a4a8['id'],'MailQueueId':_0xc4e699['id']});});});});});}})[_0x0046('0x17')](respondWithStatusCode(_0x202c70,null))['catch'](handleError(_0x202c70,null));};exports['removeTeams']=function(_0x304fcd,_0x5817f8){return db['Team'][_0x0046('0x26')]({'where':{'id':_0x304fcd['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x0046('0x46')],'as':_0x0046('0x53'),'attributes':['id'],'raw':!![]}]})[_0x0046('0x17')](handleEntityNotFound(_0x5817f8,null))[_0x0046('0x17')](function(_0x3784a3){var _0x1f808d=_[_0x0046('0x1f')](_0x3784a3,'id');var _0xac0bc=[];var _0x3bff14=[];var _0x9eb055=squel['select']();_0x9eb055[_0x0046('0x5d')](_0x0046('0x5e'))['from'](_0x0046('0x5f'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0046('0x23')](_0x0046('0x60'),_0x304fcd['params']['id']);for(var _0x482846=0x0;_0x482846<_0x3784a3[_0x0046('0x40')];_0x482846+=0x1){let _0x3516ff=_0x3784a3[_0x482846];for(var _0x456f43=0x0;_0x456f43<_0x3516ff[_0x0046('0x53')]['length'];_0x456f43+=0x1){let _0x4da10d=_0x3516ff[_0x0046('0x53')][_0x456f43];var _0x19ea54=_0x9eb055[_0x0046('0x61')]();_0x19ea54[_0x0046('0x23')]('ut.UserId\x20=\x20?',_0x4da10d['id']);_0x3bff14[_0x0046('0x62')](db[_0x0046('0x58')][_0x0046('0x25')](_0x19ea54[_0x0046('0x63')](),{'type':db[_0x0046('0x58')][_0x0046('0x64')]['SELECT']})['then'](function(_0x709237){if(_0x709237[_0x0046('0x40')]===0x1){return _0x4da10d['id'];}else{var _0x2fed10=_[_0x0046('0x65')](_[_0x0046('0x1f')](_0x709237,'TeamId'),function(_0x304dbb){return _[_0x0046('0x66')](_0x1f808d,_0x304dbb);});if(_0x2fed10){return _0x4da10d['id'];}}}));}}return BPromise[_0x0046('0x67')](_0x3bff14)[_0x0046('0x17')](function(_0x15608d){_0xac0bc=_(_0xac0bc)[_0x0046('0x68')](_0x15608d)[_0x0046('0x69')]()[_0x0046('0x6a')]();return db[_0x0046('0x20')][_0x0046('0x35')]({'where':{'id':_0x304fcd[_0x0046('0x2a')]['id']}})[_0x0046('0x17')](function(_0x1f84c7){return db['sequelize'][_0x0046('0x59')](function(_0x5ed78d){return _0x1f84c7[_0x0046('0x6b')](_0x304fcd[_0x0046('0x25')][_0x0046('0x6c')],{'transaction':_0x5ed78d})[_0x0046('0x17')](function(){if(!_[_0x0046('0x6d')](_0xac0bc)){return _0x1f84c7[_0x0046('0x6e')](_0xac0bc,{'transaction':_0x5ed78d});}})[_0x0046('0x17')](function(){_0xac0bc['forEach'](function(_0x95f35c){socket[_0x0046('0x6f')](_0x0046('0x70'),{'UserId':_0x95f35c,'MailQueueId':_0x1f84c7['id']});});});});});});})[_0x0046('0x17')](respondWithStatusCode(_0x5817f8,null))[_0x0046('0x28')](handleError(_0x5817f8,null));};exports[_0x0046('0x71')]=function(_0x1ef6d6,_0x165cb8){return db[_0x0046('0x20')][_0x0046('0x35')]({'where':{'id':_0x1ef6d6[_0x0046('0x2a')]['id']}})[_0x0046('0x17')](handleEntityNotFound(_0x165cb8,null))[_0x0046('0x17')](function(_0x10295c){if(_0x10295c){return _0x10295c[_0x0046('0x71')](_0x1ef6d6[_0x0046('0x37')][_0x0046('0x6c')],_['omit'](_0x1ef6d6[_0x0046('0x37')],[_0x0046('0x6c'),'id'])||{})[_0x0046('0x72')](function(_0xdc396){for(var _0x105522=0x0;_0x105522<_0x1ef6d6['body'][_0x0046('0x6c')][_0x0046('0x40')];_0x105522+=0x1){socket[_0x0046('0x6f')](_0x0046('0x5c'),{'UserId':Number(_0x1ef6d6[_0x0046('0x37')]['ids'][_0x105522]),'MailQueueId':Number(_0x1ef6d6[_0x0046('0x2a')]['id'])});}return _0xdc396;});}})[_0x0046('0x17')](respondWithResult(_0x165cb8,null))['catch'](handleError(_0x165cb8,null));};exports[_0x0046('0x6e')]=function(_0x2ac4a6,_0x6335b1){return db[_0x0046('0x20')][_0x0046('0x35')]({'where':{'id':_0x2ac4a6[_0x0046('0x2a')]['id']}})[_0x0046('0x17')](handleEntityNotFound(_0x6335b1,null))['then'](function(_0x2a3534){if(_0x2a3534){return _0x2a3534[_0x0046('0x6e')](_0x2ac4a6['query'][_0x0046('0x6c')])[_0x0046('0x17')](function(){if(_[_0x0046('0x73')](_0x2ac4a6[_0x0046('0x25')]['ids'])){for(var _0x8466c=0x0;_0x8466c<_0x2ac4a6[_0x0046('0x25')][_0x0046('0x6c')]['length'];_0x8466c+=0x1){socket['emit'](_0x0046('0x70'),{'UserId':Number(_0x2ac4a6['query']['ids'][_0x8466c]),'MailQueueId':Number(_0x2ac4a6['params']['id'])});}}else{socket[_0x0046('0x6f')](_0x0046('0x70'),{'UserId':Number(_0x2ac4a6[_0x0046('0x25')][_0x0046('0x6c')]),'MailQueueId':Number(_0x2ac4a6[_0x0046('0x2a')]['id'])});}});}})[_0x0046('0x17')](respondWithStatusCode(_0x6335b1,null))[_0x0046('0x28')](handleError(_0x6335b1,null));};exports[_0x0046('0x74')]=function(_0x56b1d6,_0x5708bc){var _0x44ed3a={};var _0x4e2a98={};var _0x43c175;var _0x48d973;return db[_0x0046('0x20')][_0x0046('0x75')]({'where':{'id':_0x56b1d6[_0x0046('0x2a')]['id']}})[_0x0046('0x17')](handleEntityNotFound(_0x5708bc,null))[_0x0046('0x17')](function(_0xea0b70){if(_0xea0b70){_0x43c175=_0xea0b70;_0x4e2a98['model']=_[_0x0046('0x2b')](db[_0x0046('0x46')][_0x0046('0x2c')]);_0x4e2a98[_0x0046('0x25')]=_['keys'](_0x56b1d6[_0x0046('0x25')]);_0x4e2a98['filters']=_[_0x0046('0x30')](_0x4e2a98[_0x0046('0x2e')],_0x4e2a98[_0x0046('0x25')]);_0x44ed3a[_0x0046('0x2f')]=_[_0x0046('0x30')](_0x4e2a98[_0x0046('0x2e')],qs['fields'](_0x56b1d6[_0x0046('0x25')][_0x0046('0x31')]));_0x44ed3a[_0x0046('0x2f')]=_0x44ed3a['attributes'][_0x0046('0x40')]?_0x44ed3a['attributes']:_0x4e2a98[_0x0046('0x2e')];_0x44ed3a['order']=qs['sort'](_0x56b1d6['query'][_0x0046('0x43')]);_0x44ed3a[_0x0046('0x23')]=qs[_0x0046('0x2d')](_[_0x0046('0x44')](_0x56b1d6[_0x0046('0x25')],_0x4e2a98[_0x0046('0x2d')]));if(_0x56b1d6[_0x0046('0x25')][_0x0046('0x45')]){_0x44ed3a[_0x0046('0x23')]=_[_0x0046('0x33')](_0x44ed3a[_0x0046('0x23')],{'$or':_['map'](_0x44ed3a['attributes'],function(_0x31fbe0){var _0x5e6ab4={};_0x5e6ab4[_0x31fbe0]={'$like':'%'+_0x56b1d6[_0x0046('0x25')]['filter']+'%'};return _0x5e6ab4;})});}_0x44ed3a=_['merge']({},_0x44ed3a,_0x56b1d6[_0x0046('0x34')]);return _0x43c175[_0x0046('0x74')](_0x44ed3a);}})['then'](function(_0x30e540){if(_0x30e540){_0x48d973=_0x30e540[_0x0046('0x40')];if(!_0x56b1d6[_0x0046('0x25')][_0x0046('0x76')](_0x0046('0x41'))){_0x44ed3a[_0x0046('0x12')]=qs['limit'](_0x56b1d6['query'][_0x0046('0x12')]);_0x44ed3a[_0x0046('0x10')]=qs[_0x0046('0x10')](_0x56b1d6['query'][_0x0046('0x10')]);}return _0x43c175[_0x0046('0x74')](_0x44ed3a);}})[_0x0046('0x17')](function(_0x2020ae){if(_0x2020ae){return _0x2020ae?{'count':_0x48d973,'rows':_0x2020ae}:null;}})['then'](respondWithResult(_0x5708bc,null))[_0x0046('0x28')](handleError(_0x5708bc,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 6706980..563dfcb 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 _0x448e=['exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x32b50a,_0x435ae9){var _0x3d9c2e=function(_0x3b6c4b){while(--_0x3b6c4b){_0x32b50a['push'](_0x32b50a['shift']());}};_0x3d9c2e(++_0x435ae9);}(_0x448e,0x88));var _0xe448=function(_0x2650e9,_0xb91cc){_0x2650e9=_0x2650e9-0x0;var _0x3511c8=_0x448e[_0x2650e9];return _0x3511c8;};'use strict';var EventEmitter=require(_0xe448('0x0'));var MailQueue=require(_0xe448('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe448('0x2')](0x0);var events={'afterCreate':_0xe448('0x3'),'afterUpdate':'update','afterDestroy':_0xe448('0x4')};function emitEvent(_0xf64b43){return function(_0x4f7344,_0x5b2089,_0x270dba){MailQueueEvents['emit'](_0xf64b43+':'+_0x4f7344['id'],_0x4f7344);MailQueueEvents[_0xe448('0x5')](_0xf64b43,_0x4f7344);_0x270dba(null);};}for(var e in events){if(events[_0xe448('0x6')](e)){var event=events[e];MailQueue[_0xe448('0x7')](e,emitEvent(event));}}module[_0xe448('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xb3fa=['remove','emit','hook','../../mysqldb','MailQueue','update'];(function(_0x315aa8,_0x262f9c){var _0x20f758=function(_0x1765e7){while(--_0x1765e7){_0x315aa8['push'](_0x315aa8['shift']());}};_0x20f758(++_0x262f9c);}(_0xb3fa,0x159));var _0xab3f=function(_0x26bf83,_0x2a3592){_0x26bf83=_0x26bf83-0x0;var _0x39edae=_0xb3fa[_0x26bf83];return _0x39edae;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xab3f('0x0'))['db'][_0xab3f('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xab3f('0x2'),'afterDestroy':_0xab3f('0x3')};function emitEvent(_0x519f3b){return function(_0x68d615,_0x3ee341,_0x15fcdb){MailQueueEvents[_0xab3f('0x4')](_0x519f3b+':'+_0x68d615['id'],_0x68d615);MailQueueEvents[_0xab3f('0x4')](_0x519f3b,_0x68d615);_0x15fcdb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xab3f('0x5')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 49e9967..df93ff3 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 _0xa77e=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','lodash','util'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa77e,0x142));var _0xea77=function(_0x2c5487,_0x4a08c6){_0x2c5487=_0x2c5487-0x0;var _0x14e4a5=_0xa77e[_0x2c5487];return _0x14e4a5;};'use strict';var _=require(_0xea77('0x0'));var util=require(_0xea77('0x1'));var logger=require(_0xea77('0x2'))(_0xea77('0x3'));var moment=require(_0xea77('0x4'));var BPromise=require(_0xea77('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea77('0x6'));var rimraf=require(_0xea77('0x7'));var config=require(_0xea77('0x8'));var attributes=require(_0xea77('0x9'));module[_0xea77('0xa')]=function(_0x40d2eb,_0x436cec){return _0x40d2eb['define'](_0xea77('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e11=['api','moment','request-promise','rimraf','./mailQueue.attributes','exports','define','mail_queues','lodash','util'];(function(_0x5e4b32,_0x4d8f10){var _0xf573ff=function(_0x42b516){while(--_0x42b516){_0x5e4b32['push'](_0x5e4b32['shift']());}};_0xf573ff(++_0x4d8f10);}(_0x7e11,0x18e));var _0x17e1=function(_0x5895c2,_0x27fd4d){_0x5895c2=_0x5895c2-0x0;var _0x148edb=_0x7e11[_0x5895c2];return _0x148edb;};'use strict';var _=require(_0x17e1('0x0'));var util=require(_0x17e1('0x1'));var logger=require('../../config/logger')(_0x17e1('0x2'));var moment=require(_0x17e1('0x3'));var BPromise=require('bluebird');var rp=require(_0x17e1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17e1('0x5'));var config=require('../../config/environment');var attributes=require(_0x17e1('0x6'));module[_0x17e1('0x7')]=function(_0x2c45ec,_0x552080){return _0x2c45ec[_0x17e1('0x8')]('MailQueue',attributes,{'tableName':_0x17e1('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 62f2c15..7ba6b39 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 _0x4849=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','raw','options','attributes','limit','include','map','model','where','ShowMailQueue','lodash','util','bluebird','randomstring'];(function(_0x2242a1,_0x38f44d){var _0x2c298b=function(_0x4f4246){while(--_0x4f4246){_0x2242a1['push'](_0x2242a1['shift']());}};_0x2c298b(++_0x38f44d);}(_0x4849,0x152));var _0x9484=function(_0x2453fd,_0x3bb3b6){_0x2453fd=_0x2453fd-0x0;var _0x5c3b25=_0x4849[_0x2453fd];return _0x5c3b25;};'use strict';var _=require(_0x9484('0x0'));var util=require(_0x9484('0x1'));var moment=require('moment');var BPromise=require(_0x9484('0x2'));var rs=require(_0x9484('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9484('0x4'))['db'];var utils=require(_0x9484('0x5'));var logger=require(_0x9484('0x6'))('rpc');var config=require(_0x9484('0x7'));var jayson=require(_0x9484('0x8'));var client=jayson[_0x9484('0x9')]['http']({'port':0x232a});config[_0x9484('0xa')]=_[_0x9484('0xb')](config[_0x9484('0xa')],{'host':_0x9484('0xc'),'port':0x18eb});var socket=require(_0x9484('0xd'))(new Redis(config[_0x9484('0xa')]));require(_0x9484('0xe'))['register'](socket);function respondWithRpcPromise(_0x288fff,_0x39e366,_0x1b0e4c){return new BPromise(function(_0x543292,_0x402974){return client['request'](_0x288fff,_0x1b0e4c)[_0x9484('0xf')](function(_0x5e2ae7){logger[_0x9484('0x10')](_0x9484('0x11'),_0x39e366,_0x9484('0x12'));logger[_0x9484('0x13')](_0x9484('0x14'),_0x39e366,'request\x20sent',JSON[_0x9484('0x15')](_0x5e2ae7));if(_0x5e2ae7[_0x9484('0x16')]){if(_0x5e2ae7[_0x9484('0x16')][_0x9484('0x17')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x39e366,_0x5e2ae7['error'][_0x9484('0x18')]);return _0x402974(_0x5e2ae7[_0x9484('0x16')][_0x9484('0x18')]);}logger[_0x9484('0x16')](_0x9484('0x11'),_0x39e366,_0x5e2ae7[_0x9484('0x16')][_0x9484('0x18')]);return _0x543292(_0x5e2ae7[_0x9484('0x16')][_0x9484('0x18')]);}else{logger[_0x9484('0x10')](_0x9484('0x11'),_0x39e366,_0x9484('0x12'));_0x543292(_0x5e2ae7[_0x9484('0x19')][_0x9484('0x18')]);}})[_0x9484('0x1a')](function(_0x268ced){logger[_0x9484('0x16')](_0x9484('0x11'),_0x39e366,_0x268ced);_0x402974(_0x268ced);});});}exports[_0x9484('0x1b')]=function(_0x1f3724){var _0x599a86=this;return new Promise(function(_0x3ac59f,_0x342dae){return db[_0x9484('0x1c')]['findAll']({'raw':_0x1f3724['options']?_0x1f3724['options'][_0x9484('0x1d')]===undefined?!![]:![]:!![],'where':_0x1f3724[_0x9484('0x1e')]?_0x1f3724[_0x9484('0x1e')]['where']||null:null,'attributes':_0x1f3724[_0x9484('0x1e')]?_0x1f3724[_0x9484('0x1e')][_0x9484('0x1f')]||null:null,'limit':_0x1f3724[_0x9484('0x1e')]?_0x1f3724['options'][_0x9484('0x20')]||null:null,'include':_0x1f3724[_0x9484('0x1e')]?_0x1f3724[_0x9484('0x1e')]['include']?_['map'](_0x1f3724[_0x9484('0x1e')][_0x9484('0x21')],function(_0xee4f1c){return{'model':db[_0xee4f1c['model']],'as':_0xee4f1c['as'],'attributes':_0xee4f1c[_0x9484('0x1f')],'include':_0xee4f1c[_0x9484('0x21')]?_[_0x9484('0x22')](_0xee4f1c[_0x9484('0x21')],function(_0x5a4167){return{'model':db[_0x5a4167[_0x9484('0x23')]],'as':_0x5a4167['as'],'attributes':_0x5a4167['attributes'],'include':_0x5a4167[_0x9484('0x21')]?_[_0x9484('0x22')](_0x5a4167[_0x9484('0x21')],function(_0xd9cdd5){return{'model':db[_0xd9cdd5[_0x9484('0x23')]],'as':_0xd9cdd5['as'],'attributes':_0xd9cdd5[_0x9484('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9484('0xf')](function(_0x1b1f4d){logger[_0x9484('0x10')]('GetMailQueue',_0x1f3724);logger['debug'](_0x9484('0x1b'),_0x1f3724,JSON[_0x9484('0x15')](_0x1b1f4d));_0x3ac59f(_0x1b1f4d);})['catch'](function(_0x220d37){logger['error'](_0x9484('0x1b'),_0x220d37[_0x9484('0x18')],_0x1f3724);_0x342dae(_0x599a86['error'](0x1f4,_0x220d37[_0x9484('0x18')]));});});};exports['ShowMailQueue']=function(_0x57bf7f){var _0x3a7d78=this;return new Promise(function(_0x164e78,_0x561e19){return db[_0x9484('0x1c')]['find']({'raw':_0x57bf7f[_0x9484('0x1e')]?_0x57bf7f[_0x9484('0x1e')][_0x9484('0x1d')]===undefined?!![]:![]:!![],'where':_0x57bf7f[_0x9484('0x1e')]?_0x57bf7f[_0x9484('0x1e')][_0x9484('0x24')]||null:null,'attributes':_0x57bf7f['options']?_0x57bf7f[_0x9484('0x1e')][_0x9484('0x1f')]||null:null,'include':_0x57bf7f['options']?_0x57bf7f[_0x9484('0x1e')]['include']?_['map'](_0x57bf7f['options']['include'],function(_0x117f90){return{'model':db[_0x117f90[_0x9484('0x23')]],'as':_0x117f90['as'],'attributes':_0x117f90[_0x9484('0x1f')],'include':_0x117f90[_0x9484('0x21')]?_[_0x9484('0x22')](_0x117f90[_0x9484('0x21')],function(_0x4befdf){return{'model':db[_0x4befdf[_0x9484('0x23')]],'as':_0x4befdf['as'],'attributes':_0x4befdf[_0x9484('0x1f')],'include':_0x4befdf['include']?_[_0x9484('0x22')](_0x4befdf[_0x9484('0x21')],function(_0x4b33b6){return{'model':db[_0x4b33b6['model']],'as':_0x4b33b6['as'],'attributes':_0x4b33b6[_0x9484('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9484('0xf')](function(_0xf8db33){logger[_0x9484('0x10')](_0x9484('0x25'),_0x57bf7f);logger[_0x9484('0x13')]('ShowMailQueue',_0x57bf7f,JSON[_0x9484('0x15')](_0xf8db33));_0x164e78(_0xf8db33);})['catch'](function(_0x11e7d6){logger[_0x9484('0x16')](_0x9484('0x25'),_0x11e7d6[_0x9484('0x18')],_0x57bf7f);_0x561e19(_0x3a7d78[_0x9484('0x16')](0x1f4,_0x11e7d6[_0x9484('0x18')]));});});}; \ No newline at end of file +var _0xd4cb=['find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','defaults','localhost','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailQueue','findAll','options','raw','attributes','limit','include','model','map','then','ShowMailQueue','MailQueue'];(function(_0x4c1d4d,_0x13296f){var _0x3f3c5f=function(_0x41c1b9){while(--_0x41c1b9){_0x4c1d4d['push'](_0x4c1d4d['shift']());}};_0x3f3c5f(++_0x13296f);}(_0xd4cb,0x9e));var _0xbd4c=function(_0x2cc5e4,_0x57b886){_0x2cc5e4=_0x2cc5e4-0x0;var _0x35f687=_0xd4cb[_0x2cc5e4];return _0x35f687;};'use strict';var _=require(_0xbd4c('0x0'));var util=require(_0xbd4c('0x1'));var moment=require(_0xbd4c('0x2'));var BPromise=require(_0xbd4c('0x3'));var rs=require(_0xbd4c('0x4'));var fs=require('fs');var Redis=require(_0xbd4c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbd4c('0x6'))(_0xbd4c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbd4c('0x8')][_0xbd4c('0x9')]({'port':0x232a});config['redis']=_[_0xbd4c('0xa')](config['redis'],{'host':_0xbd4c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbd4c('0xc'))[_0xbd4c('0xd')](socket);function respondWithRpcPromise(_0x216d63,_0x4d14a3,_0x2c305d){return new BPromise(function(_0x2c2054,_0x569898){return client[_0xbd4c('0xe')](_0x216d63,_0x2c305d)['then'](function(_0x5dd742){logger[_0xbd4c('0xf')](_0xbd4c('0x10'),_0x4d14a3,_0xbd4c('0x11'));logger[_0xbd4c('0x12')](_0xbd4c('0x13'),_0x4d14a3,_0xbd4c('0x11'),JSON[_0xbd4c('0x14')](_0x5dd742));if(_0x5dd742[_0xbd4c('0x15')]){if(_0x5dd742[_0xbd4c('0x15')]['code']===0x1f4){logger[_0xbd4c('0x15')](_0xbd4c('0x10'),_0x4d14a3,_0x5dd742['error'][_0xbd4c('0x16')]);return _0x569898(_0x5dd742[_0xbd4c('0x15')][_0xbd4c('0x16')]);}logger[_0xbd4c('0x15')](_0xbd4c('0x10'),_0x4d14a3,_0x5dd742[_0xbd4c('0x15')][_0xbd4c('0x16')]);return _0x2c2054(_0x5dd742[_0xbd4c('0x15')][_0xbd4c('0x16')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x4d14a3,_0xbd4c('0x11'));_0x2c2054(_0x5dd742[_0xbd4c('0x17')][_0xbd4c('0x16')]);}})[_0xbd4c('0x18')](function(_0x4ef0f0){logger[_0xbd4c('0x15')](_0xbd4c('0x10'),_0x4d14a3,_0x4ef0f0);_0x569898(_0x4ef0f0);});});}exports[_0xbd4c('0x19')]=function(_0x1039cf){var _0x274cdb=this;return new Promise(function(_0x37d2e8,_0x52925f){return db['MailQueue'][_0xbd4c('0x1a')]({'raw':_0x1039cf['options']?_0x1039cf[_0xbd4c('0x1b')][_0xbd4c('0x1c')]===undefined?!![]:![]:!![],'where':_0x1039cf[_0xbd4c('0x1b')]?_0x1039cf['options']['where']||null:null,'attributes':_0x1039cf['options']?_0x1039cf['options'][_0xbd4c('0x1d')]||null:null,'limit':_0x1039cf[_0xbd4c('0x1b')]?_0x1039cf[_0xbd4c('0x1b')][_0xbd4c('0x1e')]||null:null,'include':_0x1039cf[_0xbd4c('0x1b')]?_0x1039cf[_0xbd4c('0x1b')][_0xbd4c('0x1f')]?_['map'](_0x1039cf[_0xbd4c('0x1b')]['include'],function(_0x9e5905){return{'model':db[_0x9e5905[_0xbd4c('0x20')]],'as':_0x9e5905['as'],'attributes':_0x9e5905['attributes'],'include':_0x9e5905[_0xbd4c('0x1f')]?_['map'](_0x9e5905['include'],function(_0x380dca){return{'model':db[_0x380dca[_0xbd4c('0x20')]],'as':_0x380dca['as'],'attributes':_0x380dca[_0xbd4c('0x1d')],'include':_0x380dca['include']?_[_0xbd4c('0x21')](_0x380dca['include'],function(_0x37c327){return{'model':db[_0x37c327[_0xbd4c('0x20')]],'as':_0x37c327['as'],'attributes':_0x37c327[_0xbd4c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbd4c('0x22')](function(_0x2684c5){logger[_0xbd4c('0xf')]('GetMailQueue',_0x1039cf);logger[_0xbd4c('0x12')](_0xbd4c('0x19'),_0x1039cf,JSON['stringify'](_0x2684c5));_0x37d2e8(_0x2684c5);})[_0xbd4c('0x18')](function(_0x32b017){logger[_0xbd4c('0x15')](_0xbd4c('0x19'),_0x32b017[_0xbd4c('0x16')],_0x1039cf);_0x52925f(_0x274cdb['error'](0x1f4,_0x32b017[_0xbd4c('0x16')]));});});};exports[_0xbd4c('0x23')]=function(_0x3c32bd){var _0xac731a=this;return new Promise(function(_0x5f2f27,_0x5ade87){return db[_0xbd4c('0x24')][_0xbd4c('0x25')]({'raw':_0x3c32bd['options']?_0x3c32bd[_0xbd4c('0x1b')][_0xbd4c('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c32bd[_0xbd4c('0x1b')]?_0x3c32bd[_0xbd4c('0x1b')][_0xbd4c('0x26')]||null:null,'attributes':_0x3c32bd['options']?_0x3c32bd[_0xbd4c('0x1b')][_0xbd4c('0x1d')]||null:null,'include':_0x3c32bd[_0xbd4c('0x1b')]?_0x3c32bd[_0xbd4c('0x1b')][_0xbd4c('0x1f')]?_[_0xbd4c('0x21')](_0x3c32bd['options']['include'],function(_0x365b7d){return{'model':db[_0x365b7d[_0xbd4c('0x20')]],'as':_0x365b7d['as'],'attributes':_0x365b7d['attributes'],'include':_0x365b7d[_0xbd4c('0x1f')]?_[_0xbd4c('0x21')](_0x365b7d[_0xbd4c('0x1f')],function(_0x1fafba){return{'model':db[_0x1fafba['model']],'as':_0x1fafba['as'],'attributes':_0x1fafba['attributes'],'include':_0x1fafba[_0xbd4c('0x1f')]?_[_0xbd4c('0x21')](_0x1fafba[_0xbd4c('0x1f')],function(_0x1f861b){return{'model':db[_0x1f861b[_0xbd4c('0x20')]],'as':_0x1f861b['as'],'attributes':_0x1f861b[_0xbd4c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbd4c('0x22')](function(_0x4673b3){logger['info'](_0xbd4c('0x23'),_0x3c32bd);logger[_0xbd4c('0x12')]('ShowMailQueue',_0x3c32bd,JSON[_0xbd4c('0x14')](_0x4673b3));_0x5f2f27(_0x4673b3);})['catch'](function(_0x5b38c8){logger['error'](_0xbd4c('0x23'),_0x5b38c8[_0xbd4c('0x16')],_0x3c32bd);_0x5ade87(_0xac731a[_0xbd4c('0x15')](0x1f4,_0x5b38c8[_0xbd4c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 6582efe..68b4810 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 _0x5c89=['./mailQueue.events','save','update','register','length'];(function(_0x271a23,_0x1e1906){var _0x3ce2db=function(_0xa05bee){while(--_0xa05bee){_0x271a23['push'](_0x271a23['shift']());}};_0x3ce2db(++_0x1e1906);}(_0x5c89,0x69));var _0x95c8=function(_0xe55ed1,_0x19ed60){_0xe55ed1=_0xe55ed1-0x0;var _0x19a635=_0x5c89[_0xe55ed1];return _0x19a635;};'use strict';var MailQueueEvents=require(_0x95c8('0x0'));var events=[_0x95c8('0x1'),'remove',_0x95c8('0x2')];function createListener(_0x469713,_0x20c510){return function(_0x51012a){_0x20c510['emit'](_0x469713,_0x51012a);};}function removeListener(_0x3e2a0b,_0x40a32c){return function(){MailQueueEvents['removeListener'](_0x3e2a0b,_0x40a32c);};}exports[_0x95c8('0x3')]=function(_0x5bdd8b){for(var _0x42529c=0x0,_0x156a74=events[_0x95c8('0x4')];_0x42529c<_0x156a74;_0x42529c++){var _0x11c6de=events[_0x42529c];var _0x47d3dc=createListener('mailQueue:'+_0x11c6de,_0x5bdd8b);MailQueueEvents['on'](_0x11c6de,_0x47d3dc);}}; \ No newline at end of file +var _0x82b1=['mailQueue:','./mailQueue.events','save','remove','update','emit','length'];(function(_0x433d50,_0x1458d3){var _0x2dea86=function(_0x1e969d){while(--_0x1e969d){_0x433d50['push'](_0x433d50['shift']());}};_0x2dea86(++_0x1458d3);}(_0x82b1,0x197));var _0x182b=function(_0x1fbb7c,_0x330a19){_0x1fbb7c=_0x1fbb7c-0x0;var _0x2dcb7f=_0x82b1[_0x1fbb7c];return _0x2dcb7f;};'use strict';var MailQueueEvents=require(_0x182b('0x0'));var events=[_0x182b('0x1'),_0x182b('0x2'),_0x182b('0x3')];function createListener(_0x3f991f,_0x1893b7){return function(_0x52d240){_0x1893b7[_0x182b('0x4')](_0x3f991f,_0x52d240);};}function removeListener(_0x40c682,_0x1fdd20){return function(){MailQueueEvents['removeListener'](_0x40c682,_0x1fdd20);};}exports['register']=function(_0x445b46){for(var _0x5650a3=0x0,_0x3059a8=events[_0x182b('0x5')];_0x5650a3<_0x3059a8;_0x5650a3++){var _0x87ac04=events[_0x5650a3];var _0xf4ac7e=createListener(_0x182b('0x6')+_0x87ac04,_0x445b46);MailQueueEvents['on'](_0x87ac04,_0xf4ac7e);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 16e67ed..ee33616 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 _0x8829=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','describe','/:id','post','put','delete','destroy','exports'];(function(_0x3841bc,_0x4b13ae){var _0x4ef58d=function(_0xcf2398){while(--_0xcf2398){_0x3841bc['push'](_0x3841bc['shift']());}};_0x4ef58d(++_0x4b13ae);}(_0x8829,0xfc));var _0x9882=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8829[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x9882('0x0'));var path=require(_0x9882('0x1'));var timeout=require(_0x9882('0x2'));var express=require(_0x9882('0x3'));var router=express[_0x9882('0x4')]();var fs_extra=require(_0x9882('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9882('0x6'));var config=require(_0x9882('0x7'));var controller=require(_0x9882('0x8'));router[_0x9882('0x9')]('/',auth[_0x9882('0xa')](),controller['index']);router['get']('/describe',auth[_0x9882('0xa')](),controller[_0x9882('0xb')]);router['get'](_0x9882('0xc'),auth[_0x9882('0xa')](),controller['show']);router[_0x9882('0xd')]('/',auth[_0x9882('0xa')](),controller['create']);router[_0x9882('0xe')](_0x9882('0xc'),auth[_0x9882('0xa')](),controller['update']);router[_0x9882('0xf')]('/:id',auth[_0x9882('0xa')](),controller[_0x9882('0x10')]);module[_0x9882('0x11')]=router; \ No newline at end of file +var _0xa068=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailQueueReport.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x4e65e3,_0x5a3fe7){var _0x1c0690=function(_0x54aaeb){while(--_0x54aaeb){_0x4e65e3['push'](_0x4e65e3['shift']());}};_0x1c0690(++_0x5a3fe7);}(_0xa068,0x1d4));var _0x8a06=function(_0x5e1b22,_0x5a456a){_0x5e1b22=_0x5e1b22-0x0;var _0x329e7e=_0xa068[_0x5e1b22];return _0x329e7e;};'use strict';var multer=require(_0x8a06('0x0'));var util=require(_0x8a06('0x1'));var path=require(_0x8a06('0x2'));var timeout=require(_0x8a06('0x3'));var express=require(_0x8a06('0x4'));var router=express[_0x8a06('0x5')]();var fs_extra=require(_0x8a06('0x6'));var auth=require(_0x8a06('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8a06('0x8'));router['get']('/',auth[_0x8a06('0x9')](),controller[_0x8a06('0xa')]);router[_0x8a06('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x8a06('0xb')](_0x8a06('0xc'),auth[_0x8a06('0x9')](),controller[_0x8a06('0xd')]);router[_0x8a06('0xe')]('/',auth[_0x8a06('0x9')](),controller[_0x8a06('0xf')]);router[_0x8a06('0x10')](_0x8a06('0xc'),auth[_0x8a06('0x9')](),controller[_0x8a06('0x11')]);router[_0x8a06('0x12')](_0x8a06('0xc'),auth[_0x8a06('0x9')](),controller[_0x8a06('0x13')]);module[_0x8a06('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 a8d5ed4..a1dc6b0 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 _0x95eb=['moment','sequelize','STRING','DATE'];(function(_0x26253d,_0x5dfc80){var _0x318a82=function(_0x22ae6a){while(--_0x22ae6a){_0x26253d['push'](_0x26253d['shift']());}};_0x318a82(++_0x5dfc80);}(_0x95eb,0x7c));var _0xb95e=function(_0x5e4894,_0x2911b1){_0x5e4894=_0x5e4894-0x0;var _0x5c3515=_0x95eb[_0x5e4894];return _0x5c3515;};'use strict';var moment=require(_0xb95e('0x0'));var Sequelize=require(_0xb95e('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb95e('0x2')]},'joinAt':{'type':Sequelize[_0xb95e('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb95e('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb95e('0x2')]}}; \ No newline at end of file +var _0x98a1=['sequelize','exports','STRING','DATE','moment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x98a1,0x10d));var _0x198a=function(_0x566789,_0x401300){_0x566789=_0x566789-0x0;var _0x5301d7=_0x98a1[_0x566789];return _0x5301d7;};'use strict';var moment=require(_0x198a('0x0'));var Sequelize=require(_0x198a('0x1'));module[_0x198a('0x2')]={'uniqueid':{'type':Sequelize[_0x198a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x198a('0x3')]},'joinAt':{'type':Sequelize[_0x198a('0x4')]},'leaveAt':{'type':Sequelize[_0x198a('0x4')]},'acceptAt':{'type':Sequelize[_0x198a('0x4')]},'exitAt':{'type':Sequelize[_0x198a('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index a1506b3..1b69200 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 _0x2a07=['index','map','MailQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','name','send'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2a07,0x74));var _0x72a0=function(_0x3a19d4,_0x3f19a4){_0x3a19d4=_0x3a19d4-0x0;var _0x5b858b=_0x2a07[_0x3a19d4];return _0x5b858b;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':!![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['MailQueueReport'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['MailQueueReport']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));};exports[_0x72a0('0x4f')]=function(_0x50c8d7,_0xc0f323){return db[_0x72a0('0x2e')]['describe']()['then'](respondWithResult(_0xc0f323,null))[_0x72a0('0x46')](handleError(_0xc0f323,null));}; \ No newline at end of file +var _0x0120=['name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','limit','undefined','count','offset','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack'];(function(_0x3c988a,_0x3e74c9){var _0x465b4b=function(_0x169193){while(--_0x169193){_0x3c988a['push'](_0x3c988a['shift']());}};_0x465b4b(++_0x3e74c9);}(_0x0120,0x6f));var _0x0012=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x0120[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0x0012('0x0'));var rimraf=require(_0x0012('0x1'));var zipdir=require(_0x0012('0x2'));var jsonpatch=require(_0x0012('0x3'));var rp=require(_0x0012('0x4'));var moment=require(_0x0012('0x5'));var BPromise=require(_0x0012('0x6'));var Mustache=require(_0x0012('0x7'));var util=require(_0x0012('0x8'));var path=require(_0x0012('0x9'));var sox=require(_0x0012('0xa'));var csv=require(_0x0012('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0012('0xc'));var crypto=require(_0x0012('0xd'));var jsforce=require(_0x0012('0xe'));var deskjs=require(_0x0012('0xf'));var toCsv=require(_0x0012('0xb'));var querystring=require('querystring');var Papa=require(_0x0012('0x10'));var Redis=require(_0x0012('0x11'));var authService=require(_0x0012('0x12'));var qs=require(_0x0012('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0012('0x14'));var logger=require('../../config/logger')(_0x0012('0x15'));var utils=require(_0x0012('0x16'));var config=require(_0x0012('0x17'));var licenseUtil=require(_0x0012('0x18'));var db=require(_0x0012('0x19'))['db'];function respondWithStatusCode(_0x4d3e7a,_0x6d4a1a){_0x6d4a1a=_0x6d4a1a||0xcc;return function(_0x4f0ee1){if(_0x4f0ee1){return _0x4d3e7a['sendStatus'](_0x6d4a1a);}return _0x4d3e7a['status'](_0x6d4a1a)['end']();};}function respondWithResult(_0x3a7d50,_0x496a2b){_0x496a2b=_0x496a2b||0xc8;return function(_0x3995fd){if(_0x3995fd){return _0x3a7d50[_0x0012('0x1a')](_0x496a2b)['json'](_0x3995fd);}};}function respondWithFilteredResult(_0x24f4ed,_0x1a0c0d){return function(_0x348810){if(_0x348810){var _0x3b8dfc=typeof _0x1a0c0d['offset']==='undefined'&&typeof _0x1a0c0d[_0x0012('0x1b')]===_0x0012('0x1c');var _0x3948bf=_0x348810[_0x0012('0x1d')];var _0x1d0423=_0x3b8dfc?0x0:_0x1a0c0d[_0x0012('0x1e')];var _0x1e78ee=_0x3b8dfc?_0x348810[_0x0012('0x1d')]:_0x1a0c0d['offset']+_0x1a0c0d[_0x0012('0x1b')];var _0x56b0e1;if(_0x1e78ee>=_0x3948bf){_0x1e78ee=_0x3948bf;_0x56b0e1=0xc8;}else{_0x56b0e1=0xce;}_0x24f4ed['status'](_0x56b0e1);return _0x24f4ed[_0x0012('0x1f')](_0x0012('0x20'),_0x1d0423+'-'+_0x1e78ee+'/'+_0x3948bf)[_0x0012('0x21')](_0x348810);}return null;};}function patchUpdates(_0x2c837e){return function(_0x53ac2d){try{jsonpatch['apply'](_0x53ac2d,_0x2c837e,!![]);}catch(_0x460d82){return BPromise[_0x0012('0x22')](_0x460d82);}return _0x53ac2d[_0x0012('0x23')]();};}function saveUpdates(_0x7177bc,_0x190f07){return function(_0x2e6a2c){if(_0x2e6a2c){return _0x2e6a2c[_0x0012('0x24')](_0x7177bc)[_0x0012('0x25')](function(_0x57487e){return _0x57487e;});}return null;};}function removeEntity(_0x24674c,_0x24a280){return function(_0x4cf4bd){if(_0x4cf4bd){return _0x4cf4bd[_0x0012('0x26')]()[_0x0012('0x25')](function(){_0x24674c[_0x0012('0x1a')](0xcc)[_0x0012('0x27')]();});}};}function handleEntityNotFound(_0x42bcd7,_0x5e820b){return function(_0x351ffd){if(!_0x351ffd){_0x42bcd7[_0x0012('0x28')](0x194);}return _0x351ffd;};}function handleError(_0xbb5b55,_0x2a0302){_0x2a0302=_0x2a0302||0x1f4;return function(_0x173cb3){logger[_0x0012('0x29')](_0x173cb3[_0x0012('0x2a')]);if(_0x173cb3[_0x0012('0x2b')]){delete _0x173cb3[_0x0012('0x2b')];}_0xbb5b55[_0x0012('0x1a')](_0x2a0302)[_0x0012('0x2c')](_0x173cb3);};}exports[_0x0012('0x2d')]=function(_0x45c3ca,_0x3ce788){var _0x1282bb={},_0x276389={},_0x1b676d={'count':0x0,'rows':[]};var _0x1f4a0a=_[_0x0012('0x2e')](db[_0x0012('0x2f')][_0x0012('0x30')],function(_0x4d0998){return{'name':_0x4d0998[_0x0012('0x31')],'type':_0x4d0998[_0x0012('0x32')]['key']};});_0x276389[_0x0012('0x33')]=_[_0x0012('0x2e')](_0x1f4a0a,_0x0012('0x2b'));_0x276389[_0x0012('0x34')]=_[_0x0012('0x35')](_0x45c3ca['query']);_0x276389[_0x0012('0x36')]=_[_0x0012('0x37')](_0x276389[_0x0012('0x33')],_0x276389['query']);_0x1282bb[_0x0012('0x38')]=_[_0x0012('0x37')](_0x276389[_0x0012('0x33')],qs[_0x0012('0x39')](_0x45c3ca[_0x0012('0x34')][_0x0012('0x39')]));_0x1282bb['attributes']=_0x1282bb[_0x0012('0x38')][_0x0012('0x3a')]?_0x1282bb[_0x0012('0x38')]:_0x276389[_0x0012('0x33')];if(!_0x45c3ca['query']['hasOwnProperty'](_0x0012('0x3b'))){_0x1282bb[_0x0012('0x1b')]=qs[_0x0012('0x1b')](_0x45c3ca[_0x0012('0x34')][_0x0012('0x1b')]);_0x1282bb[_0x0012('0x1e')]=qs[_0x0012('0x1e')](_0x45c3ca['query'][_0x0012('0x1e')]);}_0x1282bb[_0x0012('0x3c')]=qs['sort'](_0x45c3ca[_0x0012('0x34')][_0x0012('0x3d')]);_0x1282bb[_0x0012('0x3e')]=qs[_0x0012('0x36')](_[_0x0012('0x3f')](_0x45c3ca[_0x0012('0x34')],_0x276389[_0x0012('0x36')]),_0x1f4a0a);if(_0x45c3ca['query'][_0x0012('0x40')]){_0x1282bb['where']=_[_0x0012('0x41')](_0x1282bb['where'],{'$or':_['map'](_0x1f4a0a,function(_0x1c35aa){if(_0x1c35aa[_0x0012('0x32')]!==_0x0012('0x42')){var _0x4e4424={};_0x4e4424[_0x1c35aa[_0x0012('0x2b')]]={'$like':'%'+_0x45c3ca[_0x0012('0x34')][_0x0012('0x40')]+'%'};return _0x4e4424;}})});}_0x1282bb=_[_0x0012('0x41')]({},_0x1282bb,_0x45c3ca[_0x0012('0x43')]);var _0x379780={'where':_0x1282bb[_0x0012('0x3e')]};return db[_0x0012('0x2f')]['count'](_0x379780)[_0x0012('0x25')](function(_0x25aff1){_0x1b676d[_0x0012('0x1d')]=_0x25aff1;if(_0x45c3ca[_0x0012('0x34')][_0x0012('0x44')]){_0x1282bb[_0x0012('0x45')]=[{'all':!![]}];}return db[_0x0012('0x2f')]['findAll'](_0x1282bb);})['then'](function(_0x1c54de){_0x1b676d['rows']=_0x1c54de;return _0x1b676d;})[_0x0012('0x25')](respondWithFilteredResult(_0x3ce788,_0x1282bb))[_0x0012('0x46')](handleError(_0x3ce788,null));};exports[_0x0012('0x47')]=function(_0x40f80d,_0x32c1f9){var _0x5348a2={'raw':!![],'where':{'id':_0x40f80d[_0x0012('0x48')]['id']}},_0x1bd93a={};_0x1bd93a['model']=_[_0x0012('0x35')](db[_0x0012('0x2f')][_0x0012('0x30')]);_0x1bd93a[_0x0012('0x34')]=_['keys'](_0x40f80d['query']);_0x1bd93a[_0x0012('0x36')]=_['intersection'](_0x1bd93a[_0x0012('0x33')],_0x1bd93a['query']);_0x5348a2[_0x0012('0x38')]=_[_0x0012('0x37')](_0x1bd93a[_0x0012('0x33')],qs[_0x0012('0x39')](_0x40f80d['query'][_0x0012('0x39')]));_0x5348a2['attributes']=_0x5348a2[_0x0012('0x38')][_0x0012('0x3a')]?_0x5348a2[_0x0012('0x38')]:_0x1bd93a[_0x0012('0x33')];if(_0x40f80d[_0x0012('0x34')][_0x0012('0x44')]){_0x5348a2[_0x0012('0x45')]=[{'all':!![]}];}_0x5348a2=_['merge']({},_0x5348a2,_0x40f80d[_0x0012('0x43')]);return db[_0x0012('0x2f')][_0x0012('0x49')](_0x5348a2)[_0x0012('0x25')](handleEntityNotFound(_0x32c1f9,null))[_0x0012('0x25')](respondWithResult(_0x32c1f9,null))[_0x0012('0x46')](handleError(_0x32c1f9,null));};exports['create']=function(_0x5894ee,_0x48de64){return db['MailQueueReport'][_0x0012('0x4a')](_0x5894ee[_0x0012('0x4b')],{})[_0x0012('0x25')](respondWithResult(_0x48de64,0xc9))[_0x0012('0x46')](handleError(_0x48de64,null));};exports[_0x0012('0x24')]=function(_0x53d552,_0x44ffaf){if(_0x53d552[_0x0012('0x4b')]['id']){delete _0x53d552[_0x0012('0x4b')]['id'];}return db[_0x0012('0x2f')][_0x0012('0x49')]({'where':{'id':_0x53d552[_0x0012('0x48')]['id']}})[_0x0012('0x25')](handleEntityNotFound(_0x44ffaf,null))[_0x0012('0x25')](saveUpdates(_0x53d552[_0x0012('0x4b')],null))[_0x0012('0x25')](respondWithResult(_0x44ffaf,null))[_0x0012('0x46')](handleError(_0x44ffaf,null));};exports['destroy']=function(_0x2389cd,_0x12cb8f){return db[_0x0012('0x2f')]['find']({'where':{'id':_0x2389cd[_0x0012('0x48')]['id']}})[_0x0012('0x25')](handleEntityNotFound(_0x12cb8f,null))[_0x0012('0x25')](removeEntity(_0x12cb8f,null))[_0x0012('0x46')](handleError(_0x12cb8f,null));};exports[_0x0012('0x4c')]=function(_0x5f283f,_0xd11428){return db['MailQueueReport'][_0x0012('0x4c')]()[_0x0012('0x25')](respondWithResult(_0xd11428,null))['catch'](handleError(_0xd11428,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index d1bb831..72916f4 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 _0xb722=['../../config/environment','exports','report_mail_queue','uniqueid','util','../../config/logger','api','moment','path'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb722,0x1e1));var _0x2b72=function(_0x2fee0b,_0x29dbd6){_0x2fee0b=_0x2fee0b-0x0;var _0x103e89=_0xb722[_0x2fee0b];return _0x103e89;};'use strict';var _=require('lodash');var util=require(_0x2b72('0x0'));var logger=require(_0x2b72('0x1'))(_0x2b72('0x2'));var moment=require(_0x2b72('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b72('0x4'));var rimraf=require('rimraf');var config=require(_0x2b72('0x5'));var attributes=require('./mailQueueReport.attributes');module[_0x2b72('0x6')]=function(_0x5ef34d,_0x1181e6){return _0x5ef34d['define']('MailQueueReport',attributes,{'tableName':_0x2b72('0x7'),'paranoid':![],'indexes':[{'name':_0x2b72('0x8'),'fields':[_0x2b72('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b5f=['bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','uniqueid','lodash','util','../../config/logger','api'];(function(_0x30c9a6,_0x2d0d2c){var _0x12a646=function(_0xb83002){while(--_0xb83002){_0x30c9a6['push'](_0x30c9a6['shift']());}};_0x12a646(++_0x2d0d2c);}(_0x7b5f,0x1ac));var _0xf7b5=function(_0xdf6058,_0x4c3384){_0xdf6058=_0xdf6058-0x0;var _0x49b20f=_0x7b5f[_0xdf6058];return _0x49b20f;};'use strict';var _=require(_0xf7b5('0x0'));var util=require(_0xf7b5('0x1'));var logger=require(_0xf7b5('0x2'))(_0xf7b5('0x3'));var moment=require('moment');var BPromise=require(_0xf7b5('0x4'));var rp=require(_0xf7b5('0x5'));var fs=require('fs');var path=require(_0xf7b5('0x6'));var rimraf=require(_0xf7b5('0x7'));var config=require(_0xf7b5('0x8'));var attributes=require(_0xf7b5('0x9'));module['exports']=function(_0x48ee39,_0x49acce){return _0x48ee39[_0xf7b5('0xa')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xf7b5('0xb'),'fields':[_0xf7b5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index bab5697..49f29e4 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(_0x240a22,_0x17d7e0){var _0x3b761d=function(_0xffb4e9){while(--_0xffb4e9){_0x240a22['push'](_0x240a22['shift']());}};_0x3b761d(++_0x17d7e0);}(_0x1261,0x144));var _0x1126=function(_0x9a7d5b,_0x50327f){_0x9a7d5b=_0x9a7d5b-0x0;var _0xe2a5b3=_0x1261[_0x9a7d5b];return _0xe2a5b3;};'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 _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x1237b5,_0x4786ad){var _0x5a2b68=function(_0x369986){while(--_0x369986){_0x1237b5['push'](_0x1237b5['shift']());}};_0x5a2b68(++_0x4786ad);}(_0x2ef3,0xba));var _0x32ef=function(_0xe2f389,_0x15ad8f){_0xe2f389=_0xe2f389-0x0;var _0x46a97b=_0x2ef3[_0xe2f389];return _0x46a97b;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index bdb867b..0ac35ce 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x28ef23,_0x232b89){var _0x48cc18=function(_0x3938a3){while(--_0x3938a3){_0x28ef23['push'](_0x28ef23['shift']());}};_0x48cc18(++_0x232b89);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x14d896,_0x53578b){_0x14d896=_0x14d896-0x0;var _0x28679a=_0xcb91[_0x14d896];return _0x28679a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x47c9b1,_0x119667){var _0x314445=function(_0x547906){while(--_0x547906){_0x47c9b1['push'](_0x47c9b1['shift']());}};_0x314445(++_0x119667);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index b5985f4..3f024af 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 _0xd8f5=['BOOLEAN','INTEGER','INBOX','exports','STRING'];(function(_0x1876b2,_0x5d0225){var _0x9fb1e0=function(_0x29b099){while(--_0x29b099){_0x1876b2['push'](_0x1876b2['shift']());}};_0x9fb1e0(++_0x5d0225);}(_0xd8f5,0xee));var _0x5d8f=function(_0x23d29a,_0x4ba399){_0x23d29a=_0x23d29a-0x0;var _0x17ef20=_0xd8f5[_0x23d29a];return _0x17ef20;};'use strict';var Sequelize=require('sequelize');module[_0x5d8f('0x0')]={'description':{'type':Sequelize[_0x5d8f('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x5d8f('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x5d8f('0x1')]},'password':{'type':Sequelize[_0x5d8f('0x1')]},'port':{'type':Sequelize[_0x5d8f('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5d8f('0x1')],'defaultValue':_0x5d8f('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x5d8f('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x5d8f('0x1')]},'modernAuthentication':{'type':Sequelize[_0x5d8f('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x8616=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x84b0e6,_0x5d4182){var _0x302fa9=function(_0x5c3121){while(--_0x5c3121){_0x84b0e6['push'](_0x84b0e6['shift']());}};_0x302fa9(++_0x5d4182);}(_0x8616,0x16e));var _0x6861=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x8616[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require('sequelize');module[_0x6861('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x6861('0x1')]},'authentication':{'type':Sequelize[_0x6861('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x6861('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x6861('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x6861('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x6861('0x1')]},'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 4dba2a7..821251b 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 _0x0777=['define','MailServerIn','mail_servers_in','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x5f4cea,_0x5bbb6e){var _0x368aff=function(_0x12ed2b){while(--_0x12ed2b){_0x5f4cea['push'](_0x5f4cea['shift']());}};_0x368aff(++_0x5bbb6e);}(_0x0777,0x1d1));var _0x7077=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x0777[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x7077('0x0'));var util=require('util');var logger=require(_0x7077('0x1'))(_0x7077('0x2'));var moment=require(_0x7077('0x3'));var BPromise=require(_0x7077('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7077('0x5'));var config=require(_0x7077('0x6'));var attributes=require('./mailServerIn.attributes');module[_0x7077('0x7')]=function(_0x29774a,_0x301162){return _0x29774a[_0x7077('0x8')](_0x7077('0x9'),attributes,{'tableName':_0x7077('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd15=['../../config/environment','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','bluebird','rimraf'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xdd15,0x145));var _0x5dd1=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0xdd15[_0x4226d6];return _0x19655b;};'use strict';var _=require(_0x5dd1('0x0'));var util=require(_0x5dd1('0x1'));var logger=require(_0x5dd1('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5dd1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5dd1('0x4'));var config=require(_0x5dd1('0x5'));var attributes=require('./mailServerIn.attributes');module[_0x5dd1('0x6')]=function(_0x69f825,_0x2a7f73){return _0x69f825[_0x5dd1('0x7')](_0x5dd1('0x8'),attributes,{'tableName':_0x5dd1('0x9'),'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 f5a65bb..8d854f3 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 _0x1371=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','MailServerIn,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','options','where','attributes','limit','include','model','map','GetMailServerIn','lodash','util','moment','randomstring','ioredis'];(function(_0x54f3e8,_0x3ed493){var _0x267b37=function(_0x58247e){while(--_0x58247e){_0x54f3e8['push'](_0x54f3e8['shift']());}};_0x267b37(++_0x3ed493);}(_0x1371,0x91));var _0x1137=function(_0x2b1b95,_0x232b6e){_0x2b1b95=_0x2b1b95-0x0;var _0x27fac7=_0x1371[_0x2b1b95];return _0x27fac7;};'use strict';var _=require(_0x1137('0x0'));var util=require(_0x1137('0x1'));var moment=require(_0x1137('0x2'));var BPromise=require('bluebird');var rs=require(_0x1137('0x3'));var fs=require('fs');var Redis=require(_0x1137('0x4'));var db=require(_0x1137('0x5'))['db'];var utils=require(_0x1137('0x6'));var logger=require(_0x1137('0x7'))(_0x1137('0x8'));var config=require(_0x1137('0x9'));var jayson=require(_0x1137('0xa'));var client=jayson['client'][_0x1137('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e2d0a,_0x4596e5,_0xd6ecc8){return new BPromise(function(_0x2b2acc,_0x1a9798){return client['request'](_0x4e2d0a,_0xd6ecc8)[_0x1137('0xc')](function(_0x6d8a66){logger[_0x1137('0xd')](_0x1137('0xe'),_0x4596e5,'request\x20sent');logger[_0x1137('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x4596e5,_0x1137('0x10'),JSON[_0x1137('0x11')](_0x6d8a66));if(_0x6d8a66[_0x1137('0x12')]){if(_0x6d8a66['error']['code']===0x1f4){logger[_0x1137('0x12')]('MailServerIn,\x20%s,\x20%s',_0x4596e5,_0x6d8a66[_0x1137('0x12')][_0x1137('0x13')]);return _0x1a9798(_0x6d8a66['error'][_0x1137('0x13')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x4596e5,_0x6d8a66['error'][_0x1137('0x13')]);return _0x2b2acc(_0x6d8a66[_0x1137('0x12')][_0x1137('0x13')]);}else{logger[_0x1137('0xd')](_0x1137('0xe'),_0x4596e5,_0x1137('0x10'));_0x2b2acc(_0x6d8a66[_0x1137('0x14')][_0x1137('0x13')]);}})[_0x1137('0x15')](function(_0x1cced2){logger[_0x1137('0x12')](_0x1137('0xe'),_0x4596e5,_0x1cced2);_0x1a9798(_0x1cced2);});});}exports['GetMailServerIn']=function(_0x5371cc){var _0x23dbfb=this;return new Promise(function(_0x1586dc,_0x2ec19b){return db['MailServerIn']['findAll']({'raw':_0x5371cc[_0x1137('0x16')]?_0x5371cc[_0x1137('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5371cc['options']?_0x5371cc[_0x1137('0x16')][_0x1137('0x17')]||null:null,'attributes':_0x5371cc[_0x1137('0x16')]?_0x5371cc[_0x1137('0x16')][_0x1137('0x18')]||null:null,'limit':_0x5371cc['options']?_0x5371cc[_0x1137('0x16')][_0x1137('0x19')]||null:null,'include':_0x5371cc[_0x1137('0x16')]?_0x5371cc[_0x1137('0x16')][_0x1137('0x1a')]?_['map'](_0x5371cc[_0x1137('0x16')]['include'],function(_0x53e59f){return{'model':db[_0x53e59f[_0x1137('0x1b')]],'as':_0x53e59f['as'],'attributes':_0x53e59f['attributes'],'include':_0x53e59f['include']?_[_0x1137('0x1c')](_0x53e59f['include'],function(_0x24ebad){return{'model':db[_0x24ebad[_0x1137('0x1b')]],'as':_0x24ebad['as'],'attributes':_0x24ebad['attributes'],'include':_0x24ebad[_0x1137('0x1a')]?_[_0x1137('0x1c')](_0x24ebad['include'],function(_0x482e9a){return{'model':db[_0x482e9a['model']],'as':_0x482e9a['as'],'attributes':_0x482e9a[_0x1137('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc8d94c){logger[_0x1137('0xd')](_0x1137('0x1d'),_0x5371cc);logger[_0x1137('0xf')](_0x1137('0x1d'),_0x5371cc,JSON[_0x1137('0x11')](_0xc8d94c));_0x1586dc(_0xc8d94c);})[_0x1137('0x15')](function(_0x28a60e){logger[_0x1137('0x12')](_0x1137('0x1d'),_0x28a60e[_0x1137('0x13')],_0x5371cc);_0x2ec19b(_0x23dbfb[_0x1137('0x12')](0x1f4,_0x28a60e['message']));});});}; \ No newline at end of file +var _0xd57a=['result','catch','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','GetMailServerIn','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3987a1,_0x447793){var _0xe2596e=function(_0x546925){while(--_0x546925){_0x3987a1['push'](_0x3987a1['shift']());}};_0xe2596e(++_0x447793);}(_0xd57a,0xdf));var _0xad57=function(_0x25690d,_0x5594ad){_0x25690d=_0x25690d-0x0;var _0x1af49f=_0xd57a[_0x25690d];return _0x1af49f;};'use strict';var _=require(_0xad57('0x0'));var util=require(_0xad57('0x1'));var moment=require(_0xad57('0x2'));var BPromise=require('bluebird');var rs=require(_0xad57('0x3'));var fs=require('fs');var Redis=require(_0xad57('0x4'));var db=require(_0xad57('0x5'))['db'];var utils=require(_0xad57('0x6'));var logger=require(_0xad57('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xad57('0x8'));var client=jayson[_0xad57('0x9')][_0xad57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xed22cb,_0x41d0ff,_0x38354b){return new BPromise(function(_0x231c0d,_0x4f2f43){return client[_0xad57('0xb')](_0xed22cb,_0x38354b)[_0xad57('0xc')](function(_0x1a903b){logger[_0xad57('0xd')](_0xad57('0xe'),_0x41d0ff,_0xad57('0xf'));logger[_0xad57('0x10')](_0xad57('0x11'),_0x41d0ff,'request\x20sent',JSON[_0xad57('0x12')](_0x1a903b));if(_0x1a903b[_0xad57('0x13')]){if(_0x1a903b[_0xad57('0x13')][_0xad57('0x14')]===0x1f4){logger[_0xad57('0x13')](_0xad57('0xe'),_0x41d0ff,_0x1a903b[_0xad57('0x13')][_0xad57('0x15')]);return _0x4f2f43(_0x1a903b[_0xad57('0x13')][_0xad57('0x15')]);}logger[_0xad57('0x13')](_0xad57('0xe'),_0x41d0ff,_0x1a903b['error'][_0xad57('0x15')]);return _0x231c0d(_0x1a903b[_0xad57('0x13')][_0xad57('0x15')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x41d0ff,_0xad57('0xf'));_0x231c0d(_0x1a903b[_0xad57('0x16')][_0xad57('0x15')]);}})[_0xad57('0x17')](function(_0x586447){logger[_0xad57('0x13')](_0xad57('0xe'),_0x41d0ff,_0x586447);_0x4f2f43(_0x586447);});});}exports['GetMailServerIn']=function(_0x91512d){var _0x1828d2=this;return new Promise(function(_0x1e456b,_0x173aaa){return db[_0xad57('0x18')][_0xad57('0x19')]({'raw':_0x91512d[_0xad57('0x1a')]?_0x91512d[_0xad57('0x1a')][_0xad57('0x1b')]===undefined?!![]:![]:!![],'where':_0x91512d[_0xad57('0x1a')]?_0x91512d[_0xad57('0x1a')][_0xad57('0x1c')]||null:null,'attributes':_0x91512d[_0xad57('0x1a')]?_0x91512d[_0xad57('0x1a')][_0xad57('0x1d')]||null:null,'limit':_0x91512d[_0xad57('0x1a')]?_0x91512d['options'][_0xad57('0x1e')]||null:null,'include':_0x91512d[_0xad57('0x1a')]?_0x91512d[_0xad57('0x1a')][_0xad57('0x1f')]?_[_0xad57('0x20')](_0x91512d[_0xad57('0x1a')][_0xad57('0x1f')],function(_0xeeb037){return{'model':db[_0xeeb037[_0xad57('0x21')]],'as':_0xeeb037['as'],'attributes':_0xeeb037['attributes'],'include':_0xeeb037[_0xad57('0x1f')]?_[_0xad57('0x20')](_0xeeb037['include'],function(_0x466646){return{'model':db[_0x466646['model']],'as':_0x466646['as'],'attributes':_0x466646['attributes'],'include':_0x466646[_0xad57('0x1f')]?_[_0xad57('0x20')](_0x466646[_0xad57('0x1f')],function(_0x203db3){return{'model':db[_0x203db3[_0xad57('0x21')]],'as':_0x203db3['as'],'attributes':_0x203db3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d0a53){logger[_0xad57('0xd')](_0xad57('0x22'),_0x91512d);logger['debug'](_0xad57('0x22'),_0x91512d,JSON[_0xad57('0x12')](_0x3d0a53));_0x1e456b(_0x3d0a53);})['catch'](function(_0x2e0ec1){logger[_0xad57('0x13')](_0xad57('0x22'),_0x2e0ec1[_0xad57('0x15')],_0x91512d);_0x173aaa(_0x1828d2[_0xad57('0x13')](0x1f4,_0x2e0ec1[_0xad57('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 3c3a903..b059d7a 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(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7a54,0x106));var _0x47a5=function(_0x23ba60,_0x3a3294){_0x23ba60=_0x23ba60-0x0;var _0x442a1f=_0x7a54[_0x23ba60];return _0x442a1f;};'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(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x7a54,0x106));var _0x47a5=function(_0x345c13,_0x4715e1){_0x345c13=_0x345c13-0x0;var _0x4cca65=_0x7a54[_0x345c13];return _0x4cca65;};'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 eb92006..ae7b2e8 100644 --- a/server/api/mailServerOut/mailServerOut.attributes.js +++ b/server/api/mailServerOut/mailServerOut.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f68=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x5cda0a,_0x40c5be){var _0x4b5223=function(_0x107072){while(--_0x107072){_0x5cda0a['push'](_0x5cda0a['shift']());}};_0x4b5223(++_0x40c5be);}(_0x2f68,0x9a));var _0x82f6=function(_0x566838,_0x57a56d){_0x566838=_0x566838-0x0;var _0x5d9f6c=_0x2f68[_0x566838];return _0x5d9f6c;};'use strict';var Sequelize=require('sequelize');module[_0x82f6('0x0')]={'description':{'type':Sequelize[_0x82f6('0x1')]},'host':{'type':Sequelize[_0x82f6('0x1')]},'user':{'type':Sequelize[_0x82f6('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x82f6('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x82f6('0x1')]},'authentication':{'type':Sequelize[_0x82f6('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x065e=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x54a2ec,_0x32d7ec){var _0x44aa1f=function(_0x3860c9){while(--_0x3860c9){_0x54a2ec['push'](_0x54a2ec['shift']());}};_0x44aa1f(++_0x32d7ec);}(_0x065e,0x1a7));var _0xe065=function(_0x57a044,_0x5345a7){_0x57a044=_0x57a044-0x0;var _0x194711=_0x065e[_0x57a044];return _0x194711;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xe065('0x1')]},'pass':{'type':Sequelize[_0xe065('0x1')]},'port':{'type':Sequelize[_0xe065('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xe065('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xe065('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 fc85263..2c59136 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 _0x6358=['error','name','send','index','map','MailServerOut','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','then','destroy'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x6358,0x71));var _0x8635=function(_0x487049,_0x477969){_0x487049=_0x487049-0x0;var _0x5304a9=_0x6358[_0x487049];return _0x5304a9;};'use strict';var emlformat=require(_0x8635('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8635('0x1'));var jsonpatch=require(_0x8635('0x2'));var rp=require('request-promise');var moment=require(_0x8635('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8635('0x4'));var path=require(_0x8635('0x5'));var sox=require(_0x8635('0x6'));var csv=require(_0x8635('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8635('0x8'));var _=require(_0x8635('0x9'));var squel=require(_0x8635('0xa'));var crypto=require(_0x8635('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8635('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8635('0xd'));var Papa=require('papaparse');var Redis=require(_0x8635('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8635('0xf'));var as=require(_0x8635('0x10'));var hardwareService=require(_0x8635('0x11'));var logger=require('../../config/logger')(_0x8635('0x12'));var utils=require(_0x8635('0x13'));var config=require(_0x8635('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8635('0x15'))['db'];function respondWithStatusCode(_0x29966c,_0x38a616){_0x38a616=_0x38a616||0xcc;return function(_0x2842ad){if(_0x2842ad){return _0x29966c[_0x8635('0x16')](_0x38a616);}return _0x29966c[_0x8635('0x17')](_0x38a616)[_0x8635('0x18')]();};}function respondWithResult(_0x35045d,_0x2048ad){_0x2048ad=_0x2048ad||0xc8;return function(_0xcfcc3a){if(_0xcfcc3a){return _0x35045d[_0x8635('0x17')](_0x2048ad)[_0x8635('0x19')](_0xcfcc3a);}};}function respondWithFilteredResult(_0x241a00,_0x152a87){return function(_0x34e5bd){if(_0x34e5bd){var _0x132346=typeof _0x152a87[_0x8635('0x1a')]===_0x8635('0x1b')&&typeof _0x152a87['limit']===_0x8635('0x1b');var _0x1a5ffb=_0x34e5bd[_0x8635('0x1c')];var _0x15c466=_0x132346?0x0:_0x152a87['offset'];var _0x3413b7=_0x132346?_0x34e5bd[_0x8635('0x1c')]:_0x152a87[_0x8635('0x1a')]+_0x152a87[_0x8635('0x1d')];var _0x579ca1;if(_0x3413b7>=_0x1a5ffb){_0x3413b7=_0x1a5ffb;_0x579ca1=0xc8;}else{_0x579ca1=0xce;}_0x241a00['status'](_0x579ca1);return _0x241a00[_0x8635('0x1e')]('Content-Range',_0x15c466+'-'+_0x3413b7+'/'+_0x1a5ffb)['json'](_0x34e5bd);}return null;};}function patchUpdates(_0x523c9e){return function(_0xd34a39){try{jsonpatch[_0x8635('0x1f')](_0xd34a39,_0x523c9e,!![]);}catch(_0x2878c7){return BPromise['reject'](_0x2878c7);}return _0xd34a39[_0x8635('0x20')]();};}function saveUpdates(_0x5cc5aa,_0xba9804){return function(_0x32266c){if(_0x32266c){return _0x32266c['update'](_0x5cc5aa)[_0x8635('0x21')](function(_0x2918d7){return _0x2918d7;});}return null;};}function removeEntity(_0x1517e5,_0x1a97fb){return function(_0xf207df){if(_0xf207df){return _0xf207df[_0x8635('0x22')]()[_0x8635('0x21')](function(){_0x1517e5[_0x8635('0x17')](0xcc)[_0x8635('0x18')]();});}};}function handleEntityNotFound(_0x1cab00,_0x123b7a){return function(_0x2e9f86){if(!_0x2e9f86){_0x1cab00[_0x8635('0x16')](0x194);}return _0x2e9f86;};}function handleError(_0x12705d,_0x1d8626){_0x1d8626=_0x1d8626||0x1f4;return function(_0x1109f5){logger[_0x8635('0x23')](_0x1109f5['stack']);if(_0x1109f5['name']){delete _0x1109f5[_0x8635('0x24')];}_0x12705d['status'](_0x1d8626)[_0x8635('0x25')](_0x1109f5);};}exports[_0x8635('0x26')]=function(_0x417a4a,_0x4dcad7){var _0x55b2af={},_0x3c4f6a={},_0x552a0={'count':0x0,'rows':[]};var _0x5285f5=_[_0x8635('0x27')](db[_0x8635('0x28')][_0x8635('0x29')],function(_0x405db1){return{'name':_0x405db1[_0x8635('0x2a')],'type':_0x405db1['type'][_0x8635('0x2b')]};});_0x3c4f6a[_0x8635('0x2c')]=_['map'](_0x5285f5,'name');_0x3c4f6a[_0x8635('0x2d')]=_[_0x8635('0x2e')](_0x417a4a[_0x8635('0x2d')]);_0x3c4f6a['filters']=_[_0x8635('0x2f')](_0x3c4f6a[_0x8635('0x2c')],_0x3c4f6a[_0x8635('0x2d')]);_0x55b2af[_0x8635('0x30')]=_[_0x8635('0x2f')](_0x3c4f6a[_0x8635('0x2c')],qs[_0x8635('0x31')](_0x417a4a[_0x8635('0x2d')][_0x8635('0x31')]));_0x55b2af['attributes']=_0x55b2af['attributes'][_0x8635('0x32')]?_0x55b2af[_0x8635('0x30')]:_0x3c4f6a[_0x8635('0x2c')];if(!_0x417a4a[_0x8635('0x2d')][_0x8635('0x33')](_0x8635('0x34'))){_0x55b2af['limit']=qs['limit'](_0x417a4a[_0x8635('0x2d')][_0x8635('0x1d')]);_0x55b2af[_0x8635('0x1a')]=qs[_0x8635('0x1a')](_0x417a4a['query']['offset']);}_0x55b2af[_0x8635('0x35')]=qs[_0x8635('0x36')](_0x417a4a[_0x8635('0x2d')]['sort']);_0x55b2af[_0x8635('0x37')]=qs[_0x8635('0x38')](_[_0x8635('0x39')](_0x417a4a['query'],_0x3c4f6a[_0x8635('0x38')]),_0x5285f5);if(_0x417a4a[_0x8635('0x2d')][_0x8635('0x3a')]){_0x55b2af[_0x8635('0x37')]=_[_0x8635('0x3b')](_0x55b2af[_0x8635('0x37')],{'$or':_[_0x8635('0x27')](_0x5285f5,function(_0xcb3627){if(_0xcb3627[_0x8635('0x3c')]!==_0x8635('0x3d')){var _0x129b62={};_0x129b62[_0xcb3627[_0x8635('0x24')]]={'$like':'%'+_0x417a4a[_0x8635('0x2d')][_0x8635('0x3a')]+'%'};return _0x129b62;}})});}_0x55b2af=_[_0x8635('0x3b')]({},_0x55b2af,_0x417a4a['options']);var _0x16bf35={'where':_0x55b2af['where']};return db[_0x8635('0x28')][_0x8635('0x1c')](_0x16bf35)[_0x8635('0x21')](function(_0x2e1ac0){_0x552a0[_0x8635('0x1c')]=_0x2e1ac0;if(_0x417a4a[_0x8635('0x2d')][_0x8635('0x3e')]){_0x55b2af[_0x8635('0x3f')]=[{'all':!![]}];}return db[_0x8635('0x28')][_0x8635('0x40')](_0x55b2af);})[_0x8635('0x21')](function(_0x2d0ecc){_0x552a0[_0x8635('0x41')]=_0x2d0ecc;return _0x552a0;})[_0x8635('0x21')](respondWithFilteredResult(_0x4dcad7,_0x55b2af))[_0x8635('0x42')](handleError(_0x4dcad7,null));};exports[_0x8635('0x43')]=function(_0x158e68,_0x1689f3){var _0x202f12={'raw':!![],'where':{'id':_0x158e68[_0x8635('0x44')]['id']}},_0x17ad49={};_0x17ad49['model']=_[_0x8635('0x2e')](db['MailServerOut']['rawAttributes']);_0x17ad49[_0x8635('0x2d')]=_[_0x8635('0x2e')](_0x158e68['query']);_0x17ad49[_0x8635('0x38')]=_['intersection'](_0x17ad49[_0x8635('0x2c')],_0x17ad49[_0x8635('0x2d')]);_0x202f12[_0x8635('0x30')]=_[_0x8635('0x2f')](_0x17ad49['model'],qs[_0x8635('0x31')](_0x158e68[_0x8635('0x2d')][_0x8635('0x31')]));_0x202f12[_0x8635('0x30')]=_0x202f12['attributes']['length']?_0x202f12['attributes']:_0x17ad49[_0x8635('0x2c')];if(_0x158e68['query'][_0x8635('0x3e')]){_0x202f12[_0x8635('0x3f')]=[{'all':!![]}];}_0x202f12=_[_0x8635('0x3b')]({},_0x202f12,_0x158e68[_0x8635('0x45')]);return db[_0x8635('0x28')][_0x8635('0x46')](_0x202f12)[_0x8635('0x21')](handleEntityNotFound(_0x1689f3,null))[_0x8635('0x21')](respondWithResult(_0x1689f3,null))[_0x8635('0x42')](handleError(_0x1689f3,null));};exports[_0x8635('0x47')]=function(_0x162586,_0x33c5a7){return db[_0x8635('0x28')][_0x8635('0x47')](_0x162586[_0x8635('0x48')],{})[_0x8635('0x21')](respondWithResult(_0x33c5a7,0xc9))[_0x8635('0x42')](handleError(_0x33c5a7,null));};exports[_0x8635('0x49')]=function(_0x5f2d99,_0x2cb9e5){if(_0x5f2d99[_0x8635('0x48')]['id']){delete _0x5f2d99[_0x8635('0x48')]['id'];}return db[_0x8635('0x28')][_0x8635('0x46')]({'where':{'id':_0x5f2d99[_0x8635('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb9e5,null))[_0x8635('0x21')](saveUpdates(_0x5f2d99[_0x8635('0x48')],null))[_0x8635('0x21')](respondWithResult(_0x2cb9e5,null))[_0x8635('0x42')](handleError(_0x2cb9e5,null));};exports[_0x8635('0x22')]=function(_0x38379e,_0x5af6c6){return db[_0x8635('0x28')][_0x8635('0x46')]({'where':{'id':_0x38379e[_0x8635('0x44')]['id']}})['then'](handleEntityNotFound(_0x5af6c6,null))['then'](removeEntity(_0x5af6c6,null))['catch'](handleError(_0x5af6c6,null));}; \ No newline at end of file +var _0x07fd=['count','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','MailServerOut','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','findAll','catch','params','rawAttributes','include','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0x07fd,0x105));var _0xd07f=function(_0x61e8d9,_0x54fd02){_0x61e8d9=_0x61e8d9-0x0;var _0x1f1438=_0x07fd[_0x61e8d9];return _0x1f1438;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd07f('0x0'));var jsonpatch=require(_0xd07f('0x1'));var rp=require(_0xd07f('0x2'));var moment=require(_0xd07f('0x3'));var BPromise=require(_0xd07f('0x4'));var Mustache=require(_0xd07f('0x5'));var util=require('util');var path=require(_0xd07f('0x6'));var sox=require('sox');var csv=require(_0xd07f('0x7'));var ejs=require(_0xd07f('0x8'));var fs=require('fs');var fs_extra=require(_0xd07f('0x9'));var _=require(_0xd07f('0xa'));var squel=require(_0xd07f('0xb'));var crypto=require('crypto');var jsforce=require(_0xd07f('0xc'));var deskjs=require(_0xd07f('0xd'));var toCsv=require(_0xd07f('0x7'));var querystring=require(_0xd07f('0xe'));var Papa=require(_0xd07f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd07f('0x10'));var as=require(_0xd07f('0x11'));var hardwareService=require(_0xd07f('0x12'));var logger=require(_0xd07f('0x13'))(_0xd07f('0x14'));var utils=require(_0xd07f('0x15'));var config=require(_0xd07f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd07f('0x17'))['db'];function respondWithStatusCode(_0x4bcb61,_0x3983e3){_0x3983e3=_0x3983e3||0xcc;return function(_0x55b81e){if(_0x55b81e){return _0x4bcb61[_0xd07f('0x18')](_0x3983e3);}return _0x4bcb61[_0xd07f('0x19')](_0x3983e3)[_0xd07f('0x1a')]();};}function respondWithResult(_0x368288,_0x47b3ec){_0x47b3ec=_0x47b3ec||0xc8;return function(_0x474caf){if(_0x474caf){return _0x368288[_0xd07f('0x19')](_0x47b3ec)[_0xd07f('0x1b')](_0x474caf);}};}function respondWithFilteredResult(_0x12abf2,_0x1cac6e){return function(_0x250777){if(_0x250777){var _0x5d91bb=typeof _0x1cac6e[_0xd07f('0x1c')]===_0xd07f('0x1d')&&typeof _0x1cac6e[_0xd07f('0x1e')]===_0xd07f('0x1d');var _0x241861=_0x250777[_0xd07f('0x1f')];var _0x4b7167=_0x5d91bb?0x0:_0x1cac6e[_0xd07f('0x1c')];var _0x3588dc=_0x5d91bb?_0x250777[_0xd07f('0x1f')]:_0x1cac6e[_0xd07f('0x1c')]+_0x1cac6e['limit'];var _0x468600;if(_0x3588dc>=_0x241861){_0x3588dc=_0x241861;_0x468600=0xc8;}else{_0x468600=0xce;}_0x12abf2[_0xd07f('0x19')](_0x468600);return _0x12abf2['set'](_0xd07f('0x20'),_0x4b7167+'-'+_0x3588dc+'/'+_0x241861)['json'](_0x250777);}return null;};}function patchUpdates(_0x359383){return function(_0x645fbe){try{jsonpatch[_0xd07f('0x21')](_0x645fbe,_0x359383,!![]);}catch(_0x51a9b4){return BPromise[_0xd07f('0x22')](_0x51a9b4);}return _0x645fbe[_0xd07f('0x23')]();};}function saveUpdates(_0x498502,_0x580c0d){return function(_0x3d56dd){if(_0x3d56dd){return _0x3d56dd[_0xd07f('0x24')](_0x498502)['then'](function(_0x102508){return _0x102508;});}return null;};}function removeEntity(_0x519a32,_0x2cd394){return function(_0x448e6d){if(_0x448e6d){return _0x448e6d[_0xd07f('0x25')]()[_0xd07f('0x26')](function(){_0x519a32['status'](0xcc)[_0xd07f('0x1a')]();});}};}function handleEntityNotFound(_0x21fe7a,_0x5ad723){return function(_0x2046f2){if(!_0x2046f2){_0x21fe7a[_0xd07f('0x18')](0x194);}return _0x2046f2;};}function handleError(_0x5d3917,_0x91ce84){_0x91ce84=_0x91ce84||0x1f4;return function(_0x4b5247){logger[_0xd07f('0x27')](_0x4b5247['stack']);if(_0x4b5247[_0xd07f('0x28')]){delete _0x4b5247[_0xd07f('0x28')];}_0x5d3917[_0xd07f('0x19')](_0x91ce84)[_0xd07f('0x29')](_0x4b5247);};}exports[_0xd07f('0x2a')]=function(_0x2759a5,_0x3c544f){var _0x334e8c={},_0x8259ca={},_0x1cd219={'count':0x0,'rows':[]};var _0x3b66a6=_[_0xd07f('0x2b')](db[_0xd07f('0x2c')]['rawAttributes'],function(_0x1b7c6b){return{'name':_0x1b7c6b[_0xd07f('0x2d')],'type':_0x1b7c6b[_0xd07f('0x2e')][_0xd07f('0x2f')]};});_0x8259ca['model']=_[_0xd07f('0x2b')](_0x3b66a6,_0xd07f('0x28'));_0x8259ca[_0xd07f('0x30')]=_[_0xd07f('0x31')](_0x2759a5['query']);_0x8259ca[_0xd07f('0x32')]=_[_0xd07f('0x33')](_0x8259ca[_0xd07f('0x34')],_0x8259ca[_0xd07f('0x30')]);_0x334e8c[_0xd07f('0x35')]=_[_0xd07f('0x33')](_0x8259ca[_0xd07f('0x34')],qs[_0xd07f('0x36')](_0x2759a5[_0xd07f('0x30')][_0xd07f('0x36')]));_0x334e8c[_0xd07f('0x35')]=_0x334e8c['attributes'][_0xd07f('0x37')]?_0x334e8c[_0xd07f('0x35')]:_0x8259ca['model'];if(!_0x2759a5[_0xd07f('0x30')][_0xd07f('0x38')](_0xd07f('0x39'))){_0x334e8c[_0xd07f('0x1e')]=qs['limit'](_0x2759a5[_0xd07f('0x30')][_0xd07f('0x1e')]);_0x334e8c[_0xd07f('0x1c')]=qs[_0xd07f('0x1c')](_0x2759a5[_0xd07f('0x30')]['offset']);}_0x334e8c[_0xd07f('0x3a')]=qs['sort'](_0x2759a5['query'][_0xd07f('0x3b')]);_0x334e8c[_0xd07f('0x3c')]=qs[_0xd07f('0x32')](_[_0xd07f('0x3d')](_0x2759a5[_0xd07f('0x30')],_0x8259ca[_0xd07f('0x32')]),_0x3b66a6);if(_0x2759a5[_0xd07f('0x30')]['filter']){_0x334e8c[_0xd07f('0x3c')]=_[_0xd07f('0x3e')](_0x334e8c[_0xd07f('0x3c')],{'$or':_[_0xd07f('0x2b')](_0x3b66a6,function(_0x52e302){if(_0x52e302[_0xd07f('0x2e')]!=='VIRTUAL'){var _0x1f311d={};_0x1f311d[_0x52e302[_0xd07f('0x28')]]={'$like':'%'+_0x2759a5[_0xd07f('0x30')]['filter']+'%'};return _0x1f311d;}})});}_0x334e8c=_[_0xd07f('0x3e')]({},_0x334e8c,_0x2759a5[_0xd07f('0x3f')]);var _0x25beb3={'where':_0x334e8c['where']};return db[_0xd07f('0x2c')][_0xd07f('0x1f')](_0x25beb3)[_0xd07f('0x26')](function(_0x3eb4a){_0x1cd219[_0xd07f('0x1f')]=_0x3eb4a;if(_0x2759a5['query'][_0xd07f('0x40')]){_0x334e8c['include']=[{'all':!![]}];}return db[_0xd07f('0x2c')][_0xd07f('0x41')](_0x334e8c);})[_0xd07f('0x26')](function(_0x4c0c2a){_0x1cd219['rows']=_0x4c0c2a;return _0x1cd219;})[_0xd07f('0x26')](respondWithFilteredResult(_0x3c544f,_0x334e8c))[_0xd07f('0x42')](handleError(_0x3c544f,null));};exports['show']=function(_0x1bffdc,_0x2c2f71){var _0x42d6f8={'raw':!![],'where':{'id':_0x1bffdc[_0xd07f('0x43')]['id']}},_0x4f498c={};_0x4f498c[_0xd07f('0x34')]=_[_0xd07f('0x31')](db['MailServerOut'][_0xd07f('0x44')]);_0x4f498c[_0xd07f('0x30')]=_['keys'](_0x1bffdc['query']);_0x4f498c[_0xd07f('0x32')]=_[_0xd07f('0x33')](_0x4f498c[_0xd07f('0x34')],_0x4f498c['query']);_0x42d6f8[_0xd07f('0x35')]=_[_0xd07f('0x33')](_0x4f498c[_0xd07f('0x34')],qs[_0xd07f('0x36')](_0x1bffdc['query'][_0xd07f('0x36')]));_0x42d6f8[_0xd07f('0x35')]=_0x42d6f8[_0xd07f('0x35')][_0xd07f('0x37')]?_0x42d6f8[_0xd07f('0x35')]:_0x4f498c['model'];if(_0x1bffdc[_0xd07f('0x30')][_0xd07f('0x40')]){_0x42d6f8[_0xd07f('0x45')]=[{'all':!![]}];}_0x42d6f8=_[_0xd07f('0x3e')]({},_0x42d6f8,_0x1bffdc['options']);return db[_0xd07f('0x2c')][_0xd07f('0x46')](_0x42d6f8)[_0xd07f('0x26')](handleEntityNotFound(_0x2c2f71,null))['then'](respondWithResult(_0x2c2f71,null))[_0xd07f('0x42')](handleError(_0x2c2f71,null));};exports[_0xd07f('0x47')]=function(_0xa5ff5b,_0x1ca93d){return db[_0xd07f('0x2c')][_0xd07f('0x47')](_0xa5ff5b[_0xd07f('0x48')],{})[_0xd07f('0x26')](respondWithResult(_0x1ca93d,0xc9))[_0xd07f('0x42')](handleError(_0x1ca93d,null));};exports[_0xd07f('0x24')]=function(_0x2f59f2,_0xa49172){if(_0x2f59f2[_0xd07f('0x48')]['id']){delete _0x2f59f2[_0xd07f('0x48')]['id'];}return db[_0xd07f('0x2c')][_0xd07f('0x46')]({'where':{'id':_0x2f59f2[_0xd07f('0x43')]['id']}})[_0xd07f('0x26')](handleEntityNotFound(_0xa49172,null))['then'](saveUpdates(_0x2f59f2[_0xd07f('0x48')],null))[_0xd07f('0x26')](respondWithResult(_0xa49172,null))[_0xd07f('0x42')](handleError(_0xa49172,null));};exports[_0xd07f('0x25')]=function(_0x576851,_0x12c619){return db[_0xd07f('0x2c')][_0xd07f('0x46')]({'where':{'id':_0x576851['params']['id']}})[_0xd07f('0x26')](handleEntityNotFound(_0x12c619,null))[_0xd07f('0x26')](removeEntity(_0x12c619,null))['catch'](handleError(_0x12c619,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 21bf8cf..6a5424f 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 _0x32a9=['define','mail_servers_out','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x5499d9,_0x1abd4f){var _0x52054c=function(_0x2205bc){while(--_0x2205bc){_0x5499d9['push'](_0x5499d9['shift']());}};_0x52054c(++_0x1abd4f);}(_0x32a9,0xd2));var _0x932a=function(_0x200766,_0x5114fa){_0x200766=_0x200766-0x0;var _0x8cc5d1=_0x32a9[_0x200766];return _0x8cc5d1;};'use strict';var _=require(_0x932a('0x0'));var util=require('util');var logger=require(_0x932a('0x1'))(_0x932a('0x2'));var moment=require(_0x932a('0x3'));var BPromise=require(_0x932a('0x4'));var rp=require(_0x932a('0x5'));var fs=require('fs');var path=require(_0x932a('0x6'));var rimraf=require(_0x932a('0x7'));var config=require(_0x932a('0x8'));var attributes=require(_0x932a('0x9'));module[_0x932a('0xa')]=function(_0x3e038f,_0x358874){return _0x3e038f[_0x932a('0xb')]('MailServerOut',attributes,{'tableName':_0x932a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b93=['request-promise','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','lodash','api','moment'];(function(_0x34dd3c,_0x12616c){var _0x19beab=function(_0x327c96){while(--_0x327c96){_0x34dd3c['push'](_0x34dd3c['shift']());}};_0x19beab(++_0x12616c);}(_0x9b93,0xe7));var _0x39b9=function(_0x58ee61,_0x41f78f){_0x58ee61=_0x58ee61-0x0;var _0x1b8825=_0x9b93[_0x58ee61];return _0x1b8825;};'use strict';var _=require(_0x39b9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x39b9('0x1'));var moment=require(_0x39b9('0x2'));var BPromise=require('bluebird');var rp=require(_0x39b9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x39b9('0x4'));var attributes=require(_0x39b9('0x5'));module[_0x39b9('0x6')]=function(_0x3c7cd1,_0x591551){return _0x3c7cd1[_0x39b9('0x7')](_0x39b9('0x8'),attributes,{'tableName':'mail_servers_out','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 8a52c0d..98c709f 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2b6c93,_0x163a8b){var _0x5cfd8e=function(_0xe1548a){while(--_0xe1548a){_0x2b6c93['push'](_0x2b6c93['shift']());}};_0x5cfd8e(++_0x163a8b);}(_0xadb5,0xad));var _0x5adb=function(_0x9c846e,_0x45785f){_0x9c846e=_0x9c846e-0x0;var _0x3eb787=_0xadb5[_0x9c846e];return _0x3eb787;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x192099,_0x38a593){var _0x3d6ccc=function(_0x541fff){while(--_0x541fff){_0x192099['push'](_0x192099['shift']());}};_0x3d6ccc(++_0x38a593);}(_0xadb5,0xad));var _0x5adb=function(_0x42aa46,_0x1d286){_0x42aa46=_0x42aa46-0x0;var _0x50beb6=_0xadb5[_0x42aa46];return _0x50beb6;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 80500fa..7284e7d 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 _0x10b1=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put'];(function(_0x1e9287,_0x37f584){var _0x44342e=function(_0x2f559e){while(--_0x2f559e){_0x1e9287['push'](_0x1e9287['shift']());}};_0x44342e(++_0x37f584);}(_0x10b1,0x1ca));var _0x110b=function(_0x170200,_0x14e8bd){_0x170200=_0x170200-0x0;var _0x455a6c=_0x10b1[_0x170200];return _0x455a6c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x110b('0x0'));var timeout=require(_0x110b('0x1'));var express=require(_0x110b('0x2'));var router=express[_0x110b('0x3')]();var fs_extra=require(_0x110b('0x4'));var auth=require(_0x110b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x110b('0x6'));var controller=require(_0x110b('0x7'));router[_0x110b('0x8')]('/',auth[_0x110b('0x9')](),controller[_0x110b('0xa')]);router['get'](_0x110b('0xb'),auth[_0x110b('0x9')](),controller['describe']);router['get'](_0x110b('0xc'),auth[_0x110b('0x9')](),controller[_0x110b('0xd')]);router[_0x110b('0xe')]('/',auth[_0x110b('0x9')](),controller[_0x110b('0xf')]);router[_0x110b('0x10')](_0x110b('0xc'),auth[_0x110b('0x9')](),controller['update']);router[_0x110b('0x11')](_0x110b('0xc'),auth['isAuthenticated'](),controller[_0x110b('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9afd=['post','put','/:id','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','show'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9afd,0x11f));var _0xd9af=function(_0x2cef86,_0xbae0a6){_0x2cef86=_0x2cef86-0x0;var _0x46dfd6=_0x9afd[_0x2cef86];return _0x46dfd6;};'use strict';var multer=require(_0xd9af('0x0'));var util=require('util');var path=require(_0xd9af('0x1'));var timeout=require('connect-timeout');var express=require(_0xd9af('0x2'));var router=express['Router']();var fs_extra=require(_0xd9af('0x3'));var auth=require(_0xd9af('0x4'));var interaction=require(_0xd9af('0x5'));var config=require(_0xd9af('0x6'));var controller=require(_0xd9af('0x7'));router[_0xd9af('0x8')]('/',auth[_0xd9af('0x9')](),controller['index']);router['get'](_0xd9af('0xa'),auth['isAuthenticated'](),controller[_0xd9af('0xb')]);router[_0xd9af('0x8')]('/:id',auth[_0xd9af('0x9')](),controller[_0xd9af('0xc')]);router[_0xd9af('0xd')]('/',auth[_0xd9af('0x9')](),controller['create']);router[_0xd9af('0xe')](_0xd9af('0xf'),auth[_0xd9af('0x9')](),controller[_0xd9af('0x10')]);router[_0xd9af('0x11')]('/:id',auth[_0xd9af('0x9')](),controller[_0xd9af('0x12')]);module[_0xd9af('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 8803037..4111fb6 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 _0xeff8=['name','STRING','sequelize','exports'];(function(_0xb1c5d5,_0x3a2038){var _0x3766dc=function(_0x12344b){while(--_0x12344b){_0xb1c5d5['push'](_0xb1c5d5['shift']());}};_0x3766dc(++_0x3a2038);}(_0xeff8,0x186));var _0x8eff=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0xeff8[_0x34bc6c];return _0x168820;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8eff('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8eff('0x3')]}}; \ No newline at end of file +var _0x6f44=['name','STRING','sequelize','exports'];(function(_0x2b6a9d,_0x1da7e6){var _0x35203e=function(_0x3353dc){while(--_0x3353dc){_0x2b6a9d['push'](_0x2b6a9d['shift']());}};_0x35203e(++_0x1da7e6);}(_0x6f44,0x1ea));var _0x46f4=function(_0x4808be,_0xcd6ce9){_0x4808be=_0x4808be-0x0;var _0x3776bd=_0x6f44[_0x4808be];return _0x3776bd;};'use strict';var Sequelize=require(_0x46f4('0x0'));module[_0x46f4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x46f4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x46f4('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index c33bcf5..b436e92 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 _0x4aa5=['filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','params','include','create','body','catch','find','describe','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','MailSubstatus','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x164760,_0x5874b0){var _0x8b91b2=function(_0x40d20a){while(--_0x40d20a){_0x164760['push'](_0x164760['shift']());}};_0x8b91b2(++_0x5874b0);}(_0x4aa5,0x13f));var _0x54aa=function(_0x4b8aed,_0x3d66af){_0x4b8aed=_0x4b8aed-0x0;var _0x492553=_0x4aa5[_0x4b8aed];return _0x492553;};'use strict';var emlformat=require(_0x54aa('0x0'));var rimraf=require(_0x54aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x54aa('0x2'));var moment=require(_0x54aa('0x3'));var BPromise=require(_0x54aa('0x4'));var Mustache=require('mustache');var util=require(_0x54aa('0x5'));var path=require(_0x54aa('0x6'));var sox=require(_0x54aa('0x7'));var csv=require(_0x54aa('0x8'));var ejs=require(_0x54aa('0x9'));var fs=require('fs');var fs_extra=require(_0x54aa('0xa'));var _=require('lodash');var squel=require(_0x54aa('0xb'));var crypto=require(_0x54aa('0xc'));var jsforce=require(_0x54aa('0xd'));var deskjs=require(_0x54aa('0xe'));var toCsv=require(_0x54aa('0x8'));var querystring=require(_0x54aa('0xf'));var Papa=require(_0x54aa('0x10'));var Redis=require(_0x54aa('0x11'));var authService=require(_0x54aa('0x12'));var qs=require(_0x54aa('0x13'));var as=require(_0x54aa('0x14'));var hardwareService=require(_0x54aa('0x15'));var logger=require(_0x54aa('0x16'))(_0x54aa('0x17'));var utils=require(_0x54aa('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x54aa('0x19'));var db=require(_0x54aa('0x1a'))['db'];function respondWithStatusCode(_0x1266e8,_0x33ce03){_0x33ce03=_0x33ce03||0xcc;return function(_0x224ee6){if(_0x224ee6){return _0x1266e8[_0x54aa('0x1b')](_0x33ce03);}return _0x1266e8['status'](_0x33ce03)[_0x54aa('0x1c')]();};}function respondWithResult(_0x52068f,_0x163b13){_0x163b13=_0x163b13||0xc8;return function(_0x1eac99){if(_0x1eac99){return _0x52068f[_0x54aa('0x1d')](_0x163b13)['json'](_0x1eac99);}};}function respondWithFilteredResult(_0xa768d5,_0x3f6399){return function(_0x4148e7){if(_0x4148e7){var _0x22405c=typeof _0x3f6399[_0x54aa('0x1e')]==='undefined'&&typeof _0x3f6399[_0x54aa('0x1f')]===_0x54aa('0x20');var _0x4ed47b=_0x4148e7['count'];var _0x12a31e=_0x22405c?0x0:_0x3f6399['offset'];var _0x45ea09=_0x22405c?_0x4148e7[_0x54aa('0x21')]:_0x3f6399[_0x54aa('0x1e')]+_0x3f6399[_0x54aa('0x1f')];var _0x4607d4;if(_0x45ea09>=_0x4ed47b){_0x45ea09=_0x4ed47b;_0x4607d4=0xc8;}else{_0x4607d4=0xce;}_0xa768d5[_0x54aa('0x1d')](_0x4607d4);return _0xa768d5[_0x54aa('0x22')](_0x54aa('0x23'),_0x12a31e+'-'+_0x45ea09+'/'+_0x4ed47b)['json'](_0x4148e7);}return null;};}function patchUpdates(_0x3491fe){return function(_0x4eea82){try{jsonpatch['apply'](_0x4eea82,_0x3491fe,!![]);}catch(_0x505a5d){return BPromise[_0x54aa('0x24')](_0x505a5d);}return _0x4eea82[_0x54aa('0x25')]();};}function saveUpdates(_0x2b4454,_0x23a933){return function(_0x2248a5){if(_0x2248a5){return _0x2248a5[_0x54aa('0x26')](_0x2b4454)['then'](function(_0x14a458){return _0x14a458;});}return null;};}function removeEntity(_0x3c2f4e,_0x240447){return function(_0x57f35c){if(_0x57f35c){return _0x57f35c[_0x54aa('0x27')]()[_0x54aa('0x28')](function(){_0x3c2f4e[_0x54aa('0x1d')](0xcc)[_0x54aa('0x1c')]();});}};}function handleEntityNotFound(_0x452b9e,_0x3913c5){return function(_0x8bd516){if(!_0x8bd516){_0x452b9e[_0x54aa('0x1b')](0x194);}return _0x8bd516;};}function handleError(_0x4317ac,_0x58c7b3){_0x58c7b3=_0x58c7b3||0x1f4;return function(_0x560ad9){logger[_0x54aa('0x29')](_0x560ad9[_0x54aa('0x2a')]);if(_0x560ad9[_0x54aa('0x2b')]){delete _0x560ad9[_0x54aa('0x2b')];}_0x4317ac[_0x54aa('0x1d')](_0x58c7b3)[_0x54aa('0x2c')](_0x560ad9);};}exports[_0x54aa('0x2d')]=function(_0x494973,_0x4b4309){var _0x197b76={},_0x8d26a4={},_0x558fb8={'count':0x0,'rows':[]};var _0xf8a5a9=_['map'](db[_0x54aa('0x2e')][_0x54aa('0x2f')],function(_0x3065a5){return{'name':_0x3065a5['fieldName'],'type':_0x3065a5[_0x54aa('0x30')]['key']};});_0x8d26a4[_0x54aa('0x31')]=_['map'](_0xf8a5a9,_0x54aa('0x2b'));_0x8d26a4[_0x54aa('0x32')]=_[_0x54aa('0x33')](_0x494973[_0x54aa('0x32')]);_0x8d26a4[_0x54aa('0x34')]=_[_0x54aa('0x35')](_0x8d26a4['model'],_0x8d26a4[_0x54aa('0x32')]);_0x197b76[_0x54aa('0x36')]=_[_0x54aa('0x35')](_0x8d26a4[_0x54aa('0x31')],qs[_0x54aa('0x37')](_0x494973[_0x54aa('0x32')][_0x54aa('0x37')]));_0x197b76[_0x54aa('0x36')]=_0x197b76[_0x54aa('0x36')]['length']?_0x197b76[_0x54aa('0x36')]:_0x8d26a4['model'];if(!_0x494973[_0x54aa('0x32')][_0x54aa('0x38')](_0x54aa('0x39'))){_0x197b76[_0x54aa('0x1f')]=qs[_0x54aa('0x1f')](_0x494973[_0x54aa('0x32')][_0x54aa('0x1f')]);_0x197b76[_0x54aa('0x1e')]=qs[_0x54aa('0x1e')](_0x494973['query'][_0x54aa('0x1e')]);}_0x197b76[_0x54aa('0x3a')]=qs[_0x54aa('0x3b')](_0x494973[_0x54aa('0x32')][_0x54aa('0x3b')]);_0x197b76[_0x54aa('0x3c')]=qs[_0x54aa('0x34')](_['pick'](_0x494973[_0x54aa('0x32')],_0x8d26a4[_0x54aa('0x34')]),_0xf8a5a9);if(_0x494973[_0x54aa('0x32')][_0x54aa('0x3d')]){_0x197b76[_0x54aa('0x3c')]=_[_0x54aa('0x3e')](_0x197b76[_0x54aa('0x3c')],{'$or':_[_0x54aa('0x3f')](_0xf8a5a9,function(_0xdcc0d6){if(_0xdcc0d6[_0x54aa('0x30')]!==_0x54aa('0x40')){var _0x5b72af={};_0x5b72af[_0xdcc0d6[_0x54aa('0x2b')]]={'$like':'%'+_0x494973['query'][_0x54aa('0x3d')]+'%'};return _0x5b72af;}})});}_0x197b76=_[_0x54aa('0x3e')]({},_0x197b76,_0x494973[_0x54aa('0x41')]);var _0x432afe={'where':_0x197b76[_0x54aa('0x3c')]};return db[_0x54aa('0x2e')][_0x54aa('0x21')](_0x432afe)[_0x54aa('0x28')](function(_0x2909b3){_0x558fb8['count']=_0x2909b3;if(_0x494973['query'][_0x54aa('0x42')]){_0x197b76['include']=[{'all':!![]}];}return db[_0x54aa('0x2e')][_0x54aa('0x43')](_0x197b76);})[_0x54aa('0x28')](function(_0x5b3058){_0x558fb8[_0x54aa('0x44')]=_0x5b3058;return _0x558fb8;})['then'](respondWithFilteredResult(_0x4b4309,_0x197b76))['catch'](handleError(_0x4b4309,null));};exports['show']=function(_0x3e0873,_0x508261){var _0x129d29={'raw':!![],'where':{'id':_0x3e0873[_0x54aa('0x45')]['id']}},_0x14b49e={};_0x14b49e[_0x54aa('0x31')]=_[_0x54aa('0x33')](db[_0x54aa('0x2e')]['rawAttributes']);_0x14b49e[_0x54aa('0x32')]=_[_0x54aa('0x33')](_0x3e0873[_0x54aa('0x32')]);_0x14b49e[_0x54aa('0x34')]=_[_0x54aa('0x35')](_0x14b49e['model'],_0x14b49e[_0x54aa('0x32')]);_0x129d29[_0x54aa('0x36')]=_['intersection'](_0x14b49e[_0x54aa('0x31')],qs[_0x54aa('0x37')](_0x3e0873['query'][_0x54aa('0x37')]));_0x129d29[_0x54aa('0x36')]=_0x129d29[_0x54aa('0x36')]['length']?_0x129d29[_0x54aa('0x36')]:_0x14b49e[_0x54aa('0x31')];if(_0x3e0873['query'][_0x54aa('0x42')]){_0x129d29[_0x54aa('0x46')]=[{'all':!![]}];}_0x129d29=_[_0x54aa('0x3e')]({},_0x129d29,_0x3e0873['options']);return db[_0x54aa('0x2e')]['find'](_0x129d29)['then'](handleEntityNotFound(_0x508261,null))['then'](respondWithResult(_0x508261,null))['catch'](handleError(_0x508261,null));};exports[_0x54aa('0x47')]=function(_0x2ba5b8,_0x5be19d){return db['MailSubstatus'][_0x54aa('0x47')](_0x2ba5b8['body'],{})[_0x54aa('0x28')](respondWithResult(_0x5be19d,0xc9))['catch'](handleError(_0x5be19d,null));};exports[_0x54aa('0x26')]=function(_0x45101a,_0x44a8df){if(_0x45101a['body']['id']){delete _0x45101a[_0x54aa('0x48')]['id'];}return db[_0x54aa('0x2e')]['find']({'where':{'id':_0x45101a[_0x54aa('0x45')]['id']}})[_0x54aa('0x28')](handleEntityNotFound(_0x44a8df,null))[_0x54aa('0x28')](saveUpdates(_0x45101a[_0x54aa('0x48')],null))[_0x54aa('0x28')](respondWithResult(_0x44a8df,null))[_0x54aa('0x49')](handleError(_0x44a8df,null));};exports[_0x54aa('0x27')]=function(_0x224f8b,_0xa9860c){return db[_0x54aa('0x2e')][_0x54aa('0x4a')]({'where':{'id':_0x224f8b['params']['id']}})['then'](handleEntityNotFound(_0xa9860c,null))[_0x54aa('0x28')](removeEntity(_0xa9860c,null))['catch'](handleError(_0xa9860c,null));};exports[_0x54aa('0x4b')]=function(_0x5ed346,_0x4955d6){return db[_0x54aa('0x2e')][_0x54aa('0x4b')]()['then'](respondWithResult(_0x4955d6,null))[_0x54aa('0x49')](handleError(_0x4955d6,null));}; \ No newline at end of file +var _0x3661=['sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','rawAttributes','length','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','index','map','MailSubstatus','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x35975e,_0x3ba999){var _0x2d3a5d=function(_0x59a63d){while(--_0x59a63d){_0x35975e['push'](_0x35975e['shift']());}};_0x2d3a5d(++_0x3ba999);}(_0x3661,0x138));var _0x1366=function(_0x216464,_0x5e94a6){_0x216464=_0x216464-0x0;var _0x106df6=_0x3661[_0x216464];return _0x106df6;};'use strict';var emlformat=require(_0x1366('0x0'));var rimraf=require(_0x1366('0x1'));var zipdir=require(_0x1366('0x2'));var jsonpatch=require(_0x1366('0x3'));var rp=require('request-promise');var moment=require(_0x1366('0x4'));var BPromise=require(_0x1366('0x5'));var Mustache=require(_0x1366('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1366('0x7'));var csv=require(_0x1366('0x8'));var ejs=require(_0x1366('0x9'));var fs=require('fs');var fs_extra=require(_0x1366('0xa'));var _=require(_0x1366('0xb'));var squel=require(_0x1366('0xc'));var crypto=require(_0x1366('0xd'));var jsforce=require(_0x1366('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1366('0x8'));var querystring=require(_0x1366('0xf'));var Papa=require(_0x1366('0x10'));var Redis=require('ioredis');var authService=require(_0x1366('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1366('0x12'));var hardwareService=require(_0x1366('0x13'));var logger=require(_0x1366('0x14'))(_0x1366('0x15'));var utils=require('../../config/utils');var config=require(_0x1366('0x16'));var licenseUtil=require(_0x1366('0x17'));var db=require(_0x1366('0x18'))['db'];function respondWithStatusCode(_0xac0082,_0x3c880a){_0x3c880a=_0x3c880a||0xcc;return function(_0xc5e401){if(_0xc5e401){return _0xac0082[_0x1366('0x19')](_0x3c880a);}return _0xac0082[_0x1366('0x1a')](_0x3c880a)[_0x1366('0x1b')]();};}function respondWithResult(_0x4cf00e,_0x16d5bf){_0x16d5bf=_0x16d5bf||0xc8;return function(_0x128de2){if(_0x128de2){return _0x4cf00e[_0x1366('0x1a')](_0x16d5bf)['json'](_0x128de2);}};}function respondWithFilteredResult(_0x2abad9,_0x19cf4a){return function(_0x4d0b8a){if(_0x4d0b8a){var _0x25f3d8=typeof _0x19cf4a[_0x1366('0x1c')]===_0x1366('0x1d')&&typeof _0x19cf4a[_0x1366('0x1e')]==='undefined';var _0x61aeac=_0x4d0b8a[_0x1366('0x1f')];var _0x3065bb=_0x25f3d8?0x0:_0x19cf4a[_0x1366('0x1c')];var _0x115d24=_0x25f3d8?_0x4d0b8a[_0x1366('0x1f')]:_0x19cf4a['offset']+_0x19cf4a[_0x1366('0x1e')];var _0x523b5e;if(_0x115d24>=_0x61aeac){_0x115d24=_0x61aeac;_0x523b5e=0xc8;}else{_0x523b5e=0xce;}_0x2abad9[_0x1366('0x1a')](_0x523b5e);return _0x2abad9[_0x1366('0x20')]('Content-Range',_0x3065bb+'-'+_0x115d24+'/'+_0x61aeac)['json'](_0x4d0b8a);}return null;};}function patchUpdates(_0x54fc92){return function(_0x4c4128){try{jsonpatch[_0x1366('0x21')](_0x4c4128,_0x54fc92,!![]);}catch(_0x247d14){return BPromise[_0x1366('0x22')](_0x247d14);}return _0x4c4128['save']();};}function saveUpdates(_0x53aa98,_0x3cb50){return function(_0x52c1af){if(_0x52c1af){return _0x52c1af[_0x1366('0x23')](_0x53aa98)[_0x1366('0x24')](function(_0x5ebe66){return _0x5ebe66;});}return null;};}function removeEntity(_0x24fb0a,_0xee1edb){return function(_0x3c3212){if(_0x3c3212){return _0x3c3212[_0x1366('0x25')]()['then'](function(){_0x24fb0a['status'](0xcc)[_0x1366('0x1b')]();});}};}function handleEntityNotFound(_0x276776,_0x21ccea){return function(_0x103a0c){if(!_0x103a0c){_0x276776[_0x1366('0x19')](0x194);}return _0x103a0c;};}function handleError(_0x1f5a06,_0x5d06d9){_0x5d06d9=_0x5d06d9||0x1f4;return function(_0x49a26e){logger[_0x1366('0x26')](_0x49a26e[_0x1366('0x27')]);if(_0x49a26e[_0x1366('0x28')]){delete _0x49a26e[_0x1366('0x28')];}_0x1f5a06[_0x1366('0x1a')](_0x5d06d9)['send'](_0x49a26e);};}exports[_0x1366('0x29')]=function(_0x23e18e,_0x451277){var _0x59891d={},_0x25ab09={},_0xb10bbf={'count':0x0,'rows':[]};var _0x18fa53=_[_0x1366('0x2a')](db[_0x1366('0x2b')]['rawAttributes'],function(_0x397412){return{'name':_0x397412['fieldName'],'type':_0x397412[_0x1366('0x2c')]['key']};});_0x25ab09[_0x1366('0x2d')]=_[_0x1366('0x2a')](_0x18fa53,_0x1366('0x28'));_0x25ab09[_0x1366('0x2e')]=_['keys'](_0x23e18e[_0x1366('0x2e')]);_0x25ab09[_0x1366('0x2f')]=_[_0x1366('0x30')](_0x25ab09[_0x1366('0x2d')],_0x25ab09[_0x1366('0x2e')]);_0x59891d['attributes']=_[_0x1366('0x30')](_0x25ab09['model'],qs[_0x1366('0x31')](_0x23e18e[_0x1366('0x2e')]['fields']));_0x59891d[_0x1366('0x32')]=_0x59891d[_0x1366('0x32')]['length']?_0x59891d[_0x1366('0x32')]:_0x25ab09[_0x1366('0x2d')];if(!_0x23e18e[_0x1366('0x2e')][_0x1366('0x33')](_0x1366('0x34'))){_0x59891d[_0x1366('0x1e')]=qs[_0x1366('0x1e')](_0x23e18e[_0x1366('0x2e')][_0x1366('0x1e')]);_0x59891d[_0x1366('0x1c')]=qs['offset'](_0x23e18e['query'][_0x1366('0x1c')]);}_0x59891d['order']=qs[_0x1366('0x35')](_0x23e18e[_0x1366('0x2e')][_0x1366('0x35')]);_0x59891d[_0x1366('0x36')]=qs[_0x1366('0x2f')](_[_0x1366('0x37')](_0x23e18e[_0x1366('0x2e')],_0x25ab09[_0x1366('0x2f')]),_0x18fa53);if(_0x23e18e[_0x1366('0x2e')][_0x1366('0x38')]){_0x59891d['where']=_[_0x1366('0x39')](_0x59891d[_0x1366('0x36')],{'$or':_[_0x1366('0x2a')](_0x18fa53,function(_0x4900af){if(_0x4900af[_0x1366('0x2c')]!==_0x1366('0x3a')){var _0xc5bd52={};_0xc5bd52[_0x4900af[_0x1366('0x28')]]={'$like':'%'+_0x23e18e[_0x1366('0x2e')][_0x1366('0x38')]+'%'};return _0xc5bd52;}})});}_0x59891d=_[_0x1366('0x39')]({},_0x59891d,_0x23e18e[_0x1366('0x3b')]);var _0x5f24fc={'where':_0x59891d['where']};return db[_0x1366('0x2b')][_0x1366('0x1f')](_0x5f24fc)[_0x1366('0x24')](function(_0x59c3c8){_0xb10bbf[_0x1366('0x1f')]=_0x59c3c8;if(_0x23e18e['query']['includeAll']){_0x59891d[_0x1366('0x3c')]=[{'all':!![]}];}return db[_0x1366('0x2b')][_0x1366('0x3d')](_0x59891d);})['then'](function(_0x138e59){_0xb10bbf[_0x1366('0x3e')]=_0x138e59;return _0xb10bbf;})[_0x1366('0x24')](respondWithFilteredResult(_0x451277,_0x59891d))[_0x1366('0x3f')](handleError(_0x451277,null));};exports['show']=function(_0x22fb74,_0x1eefd5){var _0x53c533={'raw':!![],'where':{'id':_0x22fb74[_0x1366('0x40')]['id']}},_0x447f5a={};_0x447f5a[_0x1366('0x2d')]=_[_0x1366('0x41')](db[_0x1366('0x2b')][_0x1366('0x42')]);_0x447f5a[_0x1366('0x2e')]=_[_0x1366('0x41')](_0x22fb74[_0x1366('0x2e')]);_0x447f5a['filters']=_[_0x1366('0x30')](_0x447f5a['model'],_0x447f5a['query']);_0x53c533[_0x1366('0x32')]=_['intersection'](_0x447f5a[_0x1366('0x2d')],qs[_0x1366('0x31')](_0x22fb74[_0x1366('0x2e')][_0x1366('0x31')]));_0x53c533[_0x1366('0x32')]=_0x53c533[_0x1366('0x32')][_0x1366('0x43')]?_0x53c533[_0x1366('0x32')]:_0x447f5a['model'];if(_0x22fb74[_0x1366('0x2e')][_0x1366('0x44')]){_0x53c533['include']=[{'all':!![]}];}_0x53c533=_[_0x1366('0x39')]({},_0x53c533,_0x22fb74[_0x1366('0x3b')]);return db[_0x1366('0x2b')][_0x1366('0x45')](_0x53c533)[_0x1366('0x24')](handleEntityNotFound(_0x1eefd5,null))[_0x1366('0x24')](respondWithResult(_0x1eefd5,null))[_0x1366('0x3f')](handleError(_0x1eefd5,null));};exports['create']=function(_0x353846,_0x55f649){return db[_0x1366('0x2b')][_0x1366('0x46')](_0x353846['body'],{})[_0x1366('0x24')](respondWithResult(_0x55f649,0xc9))['catch'](handleError(_0x55f649,null));};exports[_0x1366('0x23')]=function(_0x1aaa5d,_0x13a0d0){if(_0x1aaa5d[_0x1366('0x47')]['id']){delete _0x1aaa5d[_0x1366('0x47')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x1aaa5d[_0x1366('0x40')]['id']}})[_0x1366('0x24')](handleEntityNotFound(_0x13a0d0,null))[_0x1366('0x24')](saveUpdates(_0x1aaa5d[_0x1366('0x47')],null))['then'](respondWithResult(_0x13a0d0,null))[_0x1366('0x3f')](handleError(_0x13a0d0,null));};exports[_0x1366('0x25')]=function(_0x5cea79,_0x3cae6c){return db[_0x1366('0x2b')][_0x1366('0x45')]({'where':{'id':_0x5cea79['params']['id']}})[_0x1366('0x24')](handleEntityNotFound(_0x3cae6c,null))[_0x1366('0x24')](removeEntity(_0x3cae6c,null))[_0x1366('0x3f')](handleError(_0x3cae6c,null));};exports[_0x1366('0x48')]=function(_0x37c8d7,_0x5f234e){return db[_0x1366('0x2b')][_0x1366('0x48')]()[_0x1366('0x24')](respondWithResult(_0x5f234e,null))[_0x1366('0x3f')](handleError(_0x5f234e,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 236b909..06a19b9 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 _0x54e2=['../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','exports'];(function(_0x31aa26,_0x6571f5){var _0x23764e=function(_0x2f040c){while(--_0x2f040c){_0x31aa26['push'](_0x31aa26['shift']());}};_0x23764e(++_0x6571f5);}(_0x54e2,0x11f));var _0x254e=function(_0x12dd0e,_0x288e21){_0x12dd0e=_0x12dd0e-0x0;var _0x340f7d=_0x54e2[_0x12dd0e];return _0x340f7d;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x254e('0x0'))['db'][_0x254e('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x254e('0x2')](0x0);var events={'afterUpdate':_0x254e('0x3')};function emitEvent(_0x81a458){return function(_0x1f1ebd,_0x352f02,_0x34709b){MailSubstatusEvents[_0x254e('0x4')](_0x81a458+':'+_0x1f1ebd['id'],_0x1f1ebd);MailSubstatusEvents[_0x254e('0x4')](_0x81a458,_0x1f1ebd);_0x34709b(null);};}for(var e in events){if(events[_0x254e('0x5')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x254e('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x5b4d=['hasOwnProperty','hook','events','../../mysqldb','update','emit'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x5b4d,0x1d6));var _0xd5b4=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5b4d[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0xd5b4('0x0'));var MailSubstatus=require(_0xd5b4('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xd5b4('0x2')};function emitEvent(_0xbe0df1){return function(_0x546a8e,_0x1f1708,_0x5805fe){MailSubstatusEvents[_0xd5b4('0x3')](_0xbe0df1+':'+_0x546a8e['id'],_0x546a8e);MailSubstatusEvents[_0xd5b4('0x3')](_0xbe0df1,_0x546a8e);_0x5805fe(null);};}for(var e in events){if(events[_0xd5b4('0x4')](e)){var event=events[e];MailSubstatus[_0xd5b4('0x5')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 53d9f1e..37c8d78 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 _0x7a6c=['define','Condition','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models'];(function(_0x97c519,_0x16100d){var _0x789bc0=function(_0x3cdf27){while(--_0x3cdf27){_0x97c519['push'](_0x97c519['shift']());}};_0x789bc0(++_0x16100d);}(_0x7a6c,0x197));var _0xc7a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a6c[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xc7a6('0x0'));module[_0xc7a6('0x1')]=function(_0x49a7c9){var _0x71d317=_0x49a7c9[_0xc7a6('0x2')];return _0x49a7c9[_0xc7a6('0x3')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5db7e5,_0x446a03,_0x122ae3){return _0x71d317[_0xc7a6('0x4')]['update']({'value':_0x5db7e5[_0xc7a6('0x5')]},{'where':{'field':_0xc7a6('0x6'),'value':_0x5db7e5[_0xc7a6('0x7')][_0xc7a6('0x5')]}})[_0xc7a6('0x8')](function(){_0x122ae3();})[_0xc7a6('0x9')](function(_0x272936){_0x122ae3(_0x272936);});}}});}; \ No newline at end of file +var _0x13c4=['mailSubstatus','_previousDataValues','catch','exports','models','define','MailSubstatus','mail_substatuses','Condition','update','name'];(function(_0x3f3af1,_0x50fdfc){var _0x19cf03=function(_0x5978a2){while(--_0x5978a2){_0x3f3af1['push'](_0x3f3af1['shift']());}};_0x19cf03(++_0x50fdfc);}(_0x13c4,0x121));var _0x413c=function(_0x56dfdb,_0xbef4c0){_0x56dfdb=_0x56dfdb-0x0;var _0xf3f640=_0x13c4[_0x56dfdb];return _0xf3f640;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x413c('0x0')]=function(_0x3eda16){var _0x4ba799=_0x3eda16[_0x413c('0x1')];return _0x3eda16[_0x413c('0x2')](_0x413c('0x3'),attributes,{'tableName':_0x413c('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5492e4,_0xd3c2f2,_0x124738){return _0x4ba799[_0x413c('0x5')][_0x413c('0x6')]({'value':_0x5492e4[_0x413c('0x7')]},{'where':{'field':_0x413c('0x8'),'value':_0x5492e4[_0x413c('0x9')][_0x413c('0x7')]}})['then'](function(){_0x124738();})[_0x413c('0xa')](function(_0xcb9cde){_0x124738(_0xcb9cde);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 4226428..721c207 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 _0xb96a=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','error','message','request\x20sent'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xb96a,0x1bb));var _0xab96=function(_0x1a365a,_0x34c820){_0x1a365a=_0x1a365a-0x0;var _0x406ca2=_0xb96a[_0x1a365a];return _0x406ca2;};'use strict';var _=require(_0xab96('0x0'));var util=require(_0xab96('0x1'));var moment=require('moment');var BPromise=require(_0xab96('0x2'));var rs=require(_0xab96('0x3'));var fs=require('fs');var Redis=require(_0xab96('0x4'));var db=require(_0xab96('0x5'))['db'];var utils=require(_0xab96('0x6'));var logger=require(_0xab96('0x7'))('rpc');var config=require(_0xab96('0x8'));var jayson=require(_0xab96('0x9'));var client=jayson[_0xab96('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17c122,_0x1e8d61,_0x3f4fb2){return new BPromise(function(_0x496cac,_0x3769f9){return client[_0xab96('0xb')](_0x17c122,_0x3f4fb2)[_0xab96('0xc')](function(_0x216e62){logger[_0xab96('0xd')](_0xab96('0xe'),_0x1e8d61,'request\x20sent');logger[_0xab96('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x1e8d61,'request\x20sent',JSON['stringify'](_0x216e62));if(_0x216e62['error']){if(_0x216e62[_0xab96('0x10')]['code']===0x1f4){logger['error'](_0xab96('0xe'),_0x1e8d61,_0x216e62['error'][_0xab96('0x11')]);return _0x3769f9(_0x216e62[_0xab96('0x10')][_0xab96('0x11')]);}logger['error'](_0xab96('0xe'),_0x1e8d61,_0x216e62[_0xab96('0x10')][_0xab96('0x11')]);return _0x496cac(_0x216e62['error'][_0xab96('0x11')]);}else{logger[_0xab96('0xd')](_0xab96('0xe'),_0x1e8d61,_0xab96('0x12'));_0x496cac(_0x216e62[_0xab96('0x13')]['message']);}})[_0xab96('0x14')](function(_0x40f2ce){logger['error'](_0xab96('0xe'),_0x1e8d61,_0x40f2ce);_0x3769f9(_0x40f2ce);});});} \ No newline at end of file +var _0x7050=['http','info','MailSubstatus,\x20%s,\x20%s','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7050,0x74));var _0x0705=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0x7050[_0x231a47];return _0x48d7c9;};'use strict';var _=require(_0x0705('0x0'));var util=require(_0x0705('0x1'));var moment=require(_0x0705('0x2'));var BPromise=require(_0x0705('0x3'));var rs=require(_0x0705('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0705('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0705('0x6'))('rpc');var config=require(_0x0705('0x7'));var jayson=require(_0x0705('0x8'));var client=jayson[_0x0705('0x9')][_0x0705('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30b0a7,_0x55380f,_0x2ca812){return new BPromise(function(_0x33223c,_0x181fdd){return client['request'](_0x30b0a7,_0x2ca812)['then'](function(_0x1c0713){logger[_0x0705('0xb')](_0x0705('0xc'),_0x55380f,'request\x20sent');logger['debug'](_0x0705('0xd'),_0x55380f,_0x0705('0xe'),JSON['stringify'](_0x1c0713));if(_0x1c0713['error']){if(_0x1c0713[_0x0705('0xf')][_0x0705('0x10')]===0x1f4){logger[_0x0705('0xf')](_0x0705('0xc'),_0x55380f,_0x1c0713[_0x0705('0xf')][_0x0705('0x11')]);return _0x181fdd(_0x1c0713[_0x0705('0xf')]['message']);}logger[_0x0705('0xf')](_0x0705('0xc'),_0x55380f,_0x1c0713[_0x0705('0xf')][_0x0705('0x11')]);return _0x33223c(_0x1c0713['error'][_0x0705('0x11')]);}else{logger[_0x0705('0xb')](_0x0705('0xc'),_0x55380f,_0x0705('0xe'));_0x33223c(_0x1c0713['result'][_0x0705('0x11')]);}})['catch'](function(_0x14ee72){logger[_0x0705('0xf')](_0x0705('0xc'),_0x55380f,_0x14ee72);_0x181fdd(_0x14ee72);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 6bc1ba8..debf84b 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 _0x9b16=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy'];(function(_0x4cc046,_0x295d34){var _0x538c74=function(_0x40db6f){while(--_0x40db6f){_0x4cc046['push'](_0x4cc046['shift']());}};_0x538c74(++_0x295d34);}(_0x9b16,0x109));var _0x69b1=function(_0xa4f977,_0x132b28){_0xa4f977=_0xa4f977-0x0;var _0x48f563=_0x9b16[_0xa4f977];return _0x48f563;};'use strict';var multer=require(_0x69b1('0x0'));var util=require(_0x69b1('0x1'));var path=require(_0x69b1('0x2'));var timeout=require(_0x69b1('0x3'));var express=require('express');var router=express[_0x69b1('0x4')]();var fs_extra=require(_0x69b1('0x5'));var auth=require(_0x69b1('0x6'));var interaction=require(_0x69b1('0x7'));var config=require(_0x69b1('0x8'));var controller=require(_0x69b1('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x69b1('0xa')]);router[_0x69b1('0xb')](_0x69b1('0xc'),auth[_0x69b1('0xd')](),controller[_0x69b1('0xe')]);router[_0x69b1('0xb')]('/:id',auth[_0x69b1('0xd')](),controller[_0x69b1('0xf')]);router[_0x69b1('0x10')]('/',auth['isAuthenticated'](),controller[_0x69b1('0x11')]);router[_0x69b1('0x12')](_0x69b1('0x13'),auth[_0x69b1('0xd')](),controller[_0x69b1('0x14')]);router[_0x69b1('0x15')](_0x69b1('0x13'),auth[_0x69b1('0xd')](),controller[_0x69b1('0x16')]);module[_0x69b1('0x17')]=router; \ No newline at end of file +var _0x14ca=['../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','get','/describe','describe','isAuthenticated','show','post','put','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0x14ca,0xb9));var _0xa14c=function(_0xb1ee6d,_0x427b4c){_0xb1ee6d=_0xb1ee6d-0x0;var _0x559dde=_0x14ca[_0xb1ee6d];return _0x559dde;};'use strict';var multer=require(_0xa14c('0x0'));var util=require(_0xa14c('0x1'));var path=require(_0xa14c('0x2'));var timeout=require('connect-timeout');var express=require(_0xa14c('0x3'));var router=express[_0xa14c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa14c('0x5'));var config=require(_0xa14c('0x6'));var controller=require(_0xa14c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa14c('0x8')]);router[_0xa14c('0x9')](_0xa14c('0xa'),auth['isAuthenticated'](),controller[_0xa14c('0xb')]);router[_0xa14c('0x9')]('/:id',auth[_0xa14c('0xc')](),controller[_0xa14c('0xd')]);router[_0xa14c('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa14c('0xf')]('/:id',auth[_0xa14c('0xc')](),controller['update']);router[_0xa14c('0x10')]('/:id',auth[_0xa14c('0xc')](),controller[_0xa14c('0x11')]);module[_0xa14c('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 1921814..65e2e05 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(_0x22c6bb,_0x3f94ef){var _0x15106e=function(_0x26c7ec){while(--_0x26c7ec){_0x22c6bb['push'](_0x22c6bb['shift']());}};_0x15106e(++_0x3f94ef);}(_0x00bb,0x1d8));var _0xb00b=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x00bb[_0x311c35];return _0x5cc50c;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x3e8e15,_0x2377ec){var _0x1922de=function(_0x1af79d){while(--_0x1af79d){_0x3e8e15['push'](_0x3e8e15['shift']());}};_0x1922de(++_0x2377ec);}(_0x70e0,0x17b));var _0x070e=function(_0x7404a0,_0x34c77f){_0x7404a0=_0x7404a0-0x0;var _0x58680f=_0x70e0[_0x7404a0];return _0x58680f;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index d13f028..4443453 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 _0x5e29=['../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','apply','save','update','then','destroy','error','name','send','index','MailTransferReport','rawAttributes','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','intersection','includeAll','options','find','create','body','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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'];(function(_0x5abe0f,_0x501e74){var _0x5702ce=function(_0x1d9292){while(--_0x1d9292){_0x5abe0f['push'](_0x5abe0f['shift']());}};_0x5702ce(++_0x501e74);}(_0x5e29,0x15a));var _0x95e2=function(_0x55eddc,_0x5cd2cc){_0x55eddc=_0x55eddc-0x0;var _0x3aba8c=_0x5e29[_0x55eddc];return _0x3aba8c;};'use strict';var emlformat=require(_0x95e2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x95e2('0x1'));var moment=require(_0x95e2('0x2'));var BPromise=require(_0x95e2('0x3'));var Mustache=require(_0x95e2('0x4'));var util=require(_0x95e2('0x5'));var path=require(_0x95e2('0x6'));var sox=require(_0x95e2('0x7'));var csv=require(_0x95e2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95e2('0x9'));var squel=require(_0x95e2('0xa'));var crypto=require(_0x95e2('0xb'));var jsforce=require(_0x95e2('0xc'));var deskjs=require(_0x95e2('0xd'));var toCsv=require(_0x95e2('0x8'));var querystring=require(_0x95e2('0xe'));var Papa=require(_0x95e2('0xf'));var Redis=require('ioredis');var authService=require(_0x95e2('0x10'));var qs=require(_0x95e2('0x11'));var as=require(_0x95e2('0x12'));var hardwareService=require(_0x95e2('0x13'));var logger=require(_0x95e2('0x14'))(_0x95e2('0x15'));var utils=require(_0x95e2('0x16'));var config=require(_0x95e2('0x17'));var licenseUtil=require(_0x95e2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33c840,_0x4daeef){_0x4daeef=_0x4daeef||0xcc;return function(_0x3f4f64){if(_0x3f4f64){return _0x33c840[_0x95e2('0x19')](_0x4daeef);}return _0x33c840[_0x95e2('0x1a')](_0x4daeef)[_0x95e2('0x1b')]();};}function respondWithResult(_0x52a742,_0x40ee17){_0x40ee17=_0x40ee17||0xc8;return function(_0x19b876){if(_0x19b876){return _0x52a742['status'](_0x40ee17)[_0x95e2('0x1c')](_0x19b876);}};}function respondWithFilteredResult(_0x365153,_0x56fde1){return function(_0x28de5c){if(_0x28de5c){var _0x3a24db=typeof _0x56fde1[_0x95e2('0x1d')]==='undefined'&&typeof _0x56fde1[_0x95e2('0x1e')]==='undefined';var _0x40ae10=_0x28de5c[_0x95e2('0x1f')];var _0x13fc10=_0x3a24db?0x0:_0x56fde1['offset'];var _0x28f297=_0x3a24db?_0x28de5c[_0x95e2('0x1f')]:_0x56fde1[_0x95e2('0x1d')]+_0x56fde1[_0x95e2('0x1e')];var _0x288eec;if(_0x28f297>=_0x40ae10){_0x28f297=_0x40ae10;_0x288eec=0xc8;}else{_0x288eec=0xce;}_0x365153['status'](_0x288eec);return _0x365153[_0x95e2('0x20')]('Content-Range',_0x13fc10+'-'+_0x28f297+'/'+_0x40ae10)['json'](_0x28de5c);}return null;};}function patchUpdates(_0x2352a7){return function(_0xc0279a){try{jsonpatch[_0x95e2('0x21')](_0xc0279a,_0x2352a7,!![]);}catch(_0x13c74a){return BPromise['reject'](_0x13c74a);}return _0xc0279a[_0x95e2('0x22')]();};}function saveUpdates(_0x49132c,_0x401bd5){return function(_0x108191){if(_0x108191){return _0x108191[_0x95e2('0x23')](_0x49132c)[_0x95e2('0x24')](function(_0xfac1d0){return _0xfac1d0;});}return null;};}function removeEntity(_0x6133a9,_0x1dac7e){return function(_0x3b93d4){if(_0x3b93d4){return _0x3b93d4[_0x95e2('0x25')]()['then'](function(){_0x6133a9[_0x95e2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57c355,_0x1dd32b){return function(_0x485230){if(!_0x485230){_0x57c355[_0x95e2('0x19')](0x194);}return _0x485230;};}function handleError(_0x5747a6,_0x233956){_0x233956=_0x233956||0x1f4;return function(_0x4b1fae){logger[_0x95e2('0x26')](_0x4b1fae['stack']);if(_0x4b1fae[_0x95e2('0x27')]){delete _0x4b1fae[_0x95e2('0x27')];}_0x5747a6[_0x95e2('0x1a')](_0x233956)[_0x95e2('0x28')](_0x4b1fae);};}exports[_0x95e2('0x29')]=function(_0x501743,_0x1db9cf){var _0x3e7e32={},_0x1d308e={},_0x187d75={'count':0x0,'rows':[]};var _0x12892b=_['map'](db[_0x95e2('0x2a')][_0x95e2('0x2b')],function(_0x5208f3){return{'name':_0x5208f3['fieldName'],'type':_0x5208f3[_0x95e2('0x2c')][_0x95e2('0x2d')]};});_0x1d308e[_0x95e2('0x2e')]=_[_0x95e2('0x2f')](_0x12892b,_0x95e2('0x27'));_0x1d308e[_0x95e2('0x30')]=_[_0x95e2('0x31')](_0x501743[_0x95e2('0x30')]);_0x1d308e[_0x95e2('0x32')]=_['intersection'](_0x1d308e['model'],_0x1d308e[_0x95e2('0x30')]);_0x3e7e32[_0x95e2('0x33')]=_['intersection'](_0x1d308e[_0x95e2('0x2e')],qs['fields'](_0x501743[_0x95e2('0x30')][_0x95e2('0x34')]));_0x3e7e32[_0x95e2('0x33')]=_0x3e7e32[_0x95e2('0x33')][_0x95e2('0x35')]?_0x3e7e32[_0x95e2('0x33')]:_0x1d308e[_0x95e2('0x2e')];if(!_0x501743[_0x95e2('0x30')][_0x95e2('0x36')]('nolimit')){_0x3e7e32[_0x95e2('0x1e')]=qs['limit'](_0x501743['query']['limit']);_0x3e7e32[_0x95e2('0x1d')]=qs['offset'](_0x501743['query'][_0x95e2('0x1d')]);}_0x3e7e32[_0x95e2('0x37')]=qs[_0x95e2('0x38')](_0x501743[_0x95e2('0x30')][_0x95e2('0x38')]);_0x3e7e32[_0x95e2('0x39')]=qs[_0x95e2('0x32')](_[_0x95e2('0x3a')](_0x501743[_0x95e2('0x30')],_0x1d308e[_0x95e2('0x32')]),_0x12892b);if(_0x501743[_0x95e2('0x30')][_0x95e2('0x3b')]){_0x3e7e32[_0x95e2('0x39')]=_[_0x95e2('0x3c')](_0x3e7e32[_0x95e2('0x39')],{'$or':_[_0x95e2('0x2f')](_0x12892b,function(_0x319576){if(_0x319576[_0x95e2('0x2c')]!=='VIRTUAL'){var _0x2f23dd={};_0x2f23dd[_0x319576[_0x95e2('0x27')]]={'$like':'%'+_0x501743[_0x95e2('0x30')]['filter']+'%'};return _0x2f23dd;}})});}_0x3e7e32=_['merge']({},_0x3e7e32,_0x501743['options']);var _0x252621={'where':_0x3e7e32['where']};return db[_0x95e2('0x2a')][_0x95e2('0x1f')](_0x252621)['then'](function(_0x313be6){_0x187d75[_0x95e2('0x1f')]=_0x313be6;if(_0x501743[_0x95e2('0x30')]['includeAll']){_0x3e7e32[_0x95e2('0x3d')]=[{'all':!![]}];}return db[_0x95e2('0x2a')][_0x95e2('0x3e')](_0x3e7e32);})[_0x95e2('0x24')](function(_0x5d34ef){_0x187d75[_0x95e2('0x3f')]=_0x5d34ef;return _0x187d75;})[_0x95e2('0x24')](respondWithFilteredResult(_0x1db9cf,_0x3e7e32))[_0x95e2('0x40')](handleError(_0x1db9cf,null));};exports[_0x95e2('0x41')]=function(_0x12da91,_0x190fd){var _0x26f9ba={'raw':!![],'where':{'id':_0x12da91[_0x95e2('0x42')]['id']}},_0x2fe4e8={};_0x2fe4e8[_0x95e2('0x2e')]=_[_0x95e2('0x31')](db[_0x95e2('0x2a')]['rawAttributes']);_0x2fe4e8[_0x95e2('0x30')]=_[_0x95e2('0x31')](_0x12da91[_0x95e2('0x30')]);_0x2fe4e8[_0x95e2('0x32')]=_[_0x95e2('0x43')](_0x2fe4e8[_0x95e2('0x2e')],_0x2fe4e8[_0x95e2('0x30')]);_0x26f9ba[_0x95e2('0x33')]=_[_0x95e2('0x43')](_0x2fe4e8[_0x95e2('0x2e')],qs[_0x95e2('0x34')](_0x12da91[_0x95e2('0x30')]['fields']));_0x26f9ba[_0x95e2('0x33')]=_0x26f9ba[_0x95e2('0x33')][_0x95e2('0x35')]?_0x26f9ba[_0x95e2('0x33')]:_0x2fe4e8[_0x95e2('0x2e')];if(_0x12da91[_0x95e2('0x30')][_0x95e2('0x44')]){_0x26f9ba[_0x95e2('0x3d')]=[{'all':!![]}];}_0x26f9ba=_['merge']({},_0x26f9ba,_0x12da91[_0x95e2('0x45')]);return db[_0x95e2('0x2a')][_0x95e2('0x46')](_0x26f9ba)[_0x95e2('0x24')](handleEntityNotFound(_0x190fd,null))[_0x95e2('0x24')](respondWithResult(_0x190fd,null))[_0x95e2('0x40')](handleError(_0x190fd,null));};exports[_0x95e2('0x47')]=function(_0x7e8bed,_0x4cf5e6){return db[_0x95e2('0x2a')][_0x95e2('0x47')](_0x7e8bed[_0x95e2('0x48')],{})['then'](respondWithResult(_0x4cf5e6,0xc9))[_0x95e2('0x40')](handleError(_0x4cf5e6,null));};exports[_0x95e2('0x23')]=function(_0x2a4171,_0x542046){if(_0x2a4171[_0x95e2('0x48')]['id']){delete _0x2a4171['body']['id'];}return db[_0x95e2('0x2a')][_0x95e2('0x46')]({'where':{'id':_0x2a4171['params']['id']}})[_0x95e2('0x24')](handleEntityNotFound(_0x542046,null))[_0x95e2('0x24')](saveUpdates(_0x2a4171[_0x95e2('0x48')],null))['then'](respondWithResult(_0x542046,null))['catch'](handleError(_0x542046,null));};exports['destroy']=function(_0xf441e3,_0x446fb0){return db['MailTransferReport'][_0x95e2('0x46')]({'where':{'id':_0xf441e3[_0x95e2('0x42')]['id']}})['then'](handleEntityNotFound(_0x446fb0,null))['then'](removeEntity(_0x446fb0,null))[_0x95e2('0x40')](handleError(_0x446fb0,null));};exports[_0x95e2('0x49')]=function(_0x591466,_0x139dfb){return db[_0x95e2('0x2a')][_0x95e2('0x49')]()[_0x95e2('0x24')](respondWithResult(_0x139dfb,null))[_0x95e2('0x40')](handleError(_0x139dfb,null));}; \ No newline at end of file +var _0xf8f5=['merge','VIRTUAL','options','include','MailTransferReport','catch','show','params','rawAttributes','find','create','body','update','destroy','describe','eml-format','rimraf','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','then','error','stack','name','send','index','map','fieldName','type','key','model','keys','filters','intersection','attributes','query','fields','length','nolimit','order','sort','where','pick','filter'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf8f5,0xe4));var _0x5f8f=function(_0x34e124,_0x42f2ec){_0x34e124=_0x34e124-0x0;var _0x1e2947=_0xf8f5[_0x34e124];return _0x1e2947;};'use strict';var emlformat=require(_0x5f8f('0x0'));var rimraf=require(_0x5f8f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5f8f('0x2'));var BPromise=require(_0x5f8f('0x3'));var Mustache=require(_0x5f8f('0x4'));var util=require(_0x5f8f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x5f8f('0x6'));var ejs=require(_0x5f8f('0x7'));var fs=require('fs');var fs_extra=require(_0x5f8f('0x8'));var _=require(_0x5f8f('0x9'));var squel=require(_0x5f8f('0xa'));var crypto=require(_0x5f8f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5f8f('0xc'));var toCsv=require(_0x5f8f('0x6'));var querystring=require(_0x5f8f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5f8f('0xe'));var as=require(_0x5f8f('0xf'));var hardwareService=require(_0x5f8f('0x10'));var logger=require(_0x5f8f('0x11'))(_0x5f8f('0x12'));var utils=require(_0x5f8f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5f8f('0x14'));var db=require(_0x5f8f('0x15'))['db'];function respondWithStatusCode(_0x2150a8,_0x3ee2a1){_0x3ee2a1=_0x3ee2a1||0xcc;return function(_0x13c414){if(_0x13c414){return _0x2150a8[_0x5f8f('0x16')](_0x3ee2a1);}return _0x2150a8[_0x5f8f('0x17')](_0x3ee2a1)[_0x5f8f('0x18')]();};}function respondWithResult(_0x5866e2,_0x36316e){_0x36316e=_0x36316e||0xc8;return function(_0x4cbe99){if(_0x4cbe99){return _0x5866e2['status'](_0x36316e)['json'](_0x4cbe99);}};}function respondWithFilteredResult(_0x3580a6,_0x1c1622){return function(_0x5b1dcd){if(_0x5b1dcd){var _0x1071f2=typeof _0x1c1622[_0x5f8f('0x19')]===_0x5f8f('0x1a')&&typeof _0x1c1622[_0x5f8f('0x1b')]==='undefined';var _0x10a0a2=_0x5b1dcd['count'];var _0x596dd2=_0x1071f2?0x0:_0x1c1622[_0x5f8f('0x19')];var _0x848c41=_0x1071f2?_0x5b1dcd[_0x5f8f('0x1c')]:_0x1c1622[_0x5f8f('0x19')]+_0x1c1622[_0x5f8f('0x1b')];var _0x45a666;if(_0x848c41>=_0x10a0a2){_0x848c41=_0x10a0a2;_0x45a666=0xc8;}else{_0x45a666=0xce;}_0x3580a6[_0x5f8f('0x17')](_0x45a666);return _0x3580a6['set'](_0x5f8f('0x1d'),_0x596dd2+'-'+_0x848c41+'/'+_0x10a0a2)['json'](_0x5b1dcd);}return null;};}function patchUpdates(_0x21a555){return function(_0x141926){try{jsonpatch['apply'](_0x141926,_0x21a555,!![]);}catch(_0x803d38){return BPromise[_0x5f8f('0x1e')](_0x803d38);}return _0x141926[_0x5f8f('0x1f')]();};}function saveUpdates(_0x17b195,_0x22ba0e){return function(_0x71c65f){if(_0x71c65f){return _0x71c65f['update'](_0x17b195)[_0x5f8f('0x20')](function(_0x858078){return _0x858078;});}return null;};}function removeEntity(_0x386879,_0x484595){return function(_0x52f10f){if(_0x52f10f){return _0x52f10f['destroy']()[_0x5f8f('0x20')](function(){_0x386879[_0x5f8f('0x17')](0xcc)[_0x5f8f('0x18')]();});}};}function handleEntityNotFound(_0x1164f2,_0x437ff0){return function(_0xf065a){if(!_0xf065a){_0x1164f2[_0x5f8f('0x16')](0x194);}return _0xf065a;};}function handleError(_0x22a2b0,_0x250a75){_0x250a75=_0x250a75||0x1f4;return function(_0x39487a){logger[_0x5f8f('0x21')](_0x39487a[_0x5f8f('0x22')]);if(_0x39487a[_0x5f8f('0x23')]){delete _0x39487a[_0x5f8f('0x23')];}_0x22a2b0[_0x5f8f('0x17')](_0x250a75)[_0x5f8f('0x24')](_0x39487a);};}exports[_0x5f8f('0x25')]=function(_0x4a9ffa,_0x51076d){var _0x693d43={},_0xe6532e={},_0x29ab7c={'count':0x0,'rows':[]};var _0x5e28f7=_[_0x5f8f('0x26')](db['MailTransferReport']['rawAttributes'],function(_0x53ac43){return{'name':_0x53ac43[_0x5f8f('0x27')],'type':_0x53ac43[_0x5f8f('0x28')][_0x5f8f('0x29')]};});_0xe6532e[_0x5f8f('0x2a')]=_[_0x5f8f('0x26')](_0x5e28f7,_0x5f8f('0x23'));_0xe6532e['query']=_[_0x5f8f('0x2b')](_0x4a9ffa['query']);_0xe6532e[_0x5f8f('0x2c')]=_[_0x5f8f('0x2d')](_0xe6532e['model'],_0xe6532e['query']);_0x693d43[_0x5f8f('0x2e')]=_[_0x5f8f('0x2d')](_0xe6532e[_0x5f8f('0x2a')],qs['fields'](_0x4a9ffa[_0x5f8f('0x2f')][_0x5f8f('0x30')]));_0x693d43[_0x5f8f('0x2e')]=_0x693d43[_0x5f8f('0x2e')][_0x5f8f('0x31')]?_0x693d43[_0x5f8f('0x2e')]:_0xe6532e['model'];if(!_0x4a9ffa[_0x5f8f('0x2f')]['hasOwnProperty'](_0x5f8f('0x32'))){_0x693d43[_0x5f8f('0x1b')]=qs[_0x5f8f('0x1b')](_0x4a9ffa[_0x5f8f('0x2f')]['limit']);_0x693d43[_0x5f8f('0x19')]=qs[_0x5f8f('0x19')](_0x4a9ffa[_0x5f8f('0x2f')][_0x5f8f('0x19')]);}_0x693d43[_0x5f8f('0x33')]=qs[_0x5f8f('0x34')](_0x4a9ffa[_0x5f8f('0x2f')][_0x5f8f('0x34')]);_0x693d43[_0x5f8f('0x35')]=qs[_0x5f8f('0x2c')](_[_0x5f8f('0x36')](_0x4a9ffa['query'],_0xe6532e[_0x5f8f('0x2c')]),_0x5e28f7);if(_0x4a9ffa[_0x5f8f('0x2f')][_0x5f8f('0x37')]){_0x693d43[_0x5f8f('0x35')]=_[_0x5f8f('0x38')](_0x693d43['where'],{'$or':_[_0x5f8f('0x26')](_0x5e28f7,function(_0x35191e){if(_0x35191e['type']!==_0x5f8f('0x39')){var _0x8656f7={};_0x8656f7[_0x35191e[_0x5f8f('0x23')]]={'$like':'%'+_0x4a9ffa[_0x5f8f('0x2f')][_0x5f8f('0x37')]+'%'};return _0x8656f7;}})});}_0x693d43=_[_0x5f8f('0x38')]({},_0x693d43,_0x4a9ffa[_0x5f8f('0x3a')]);var _0x40425f={'where':_0x693d43['where']};return db['MailTransferReport'][_0x5f8f('0x1c')](_0x40425f)[_0x5f8f('0x20')](function(_0x141367){_0x29ab7c[_0x5f8f('0x1c')]=_0x141367;if(_0x4a9ffa[_0x5f8f('0x2f')]['includeAll']){_0x693d43[_0x5f8f('0x3b')]=[{'all':!![]}];}return db[_0x5f8f('0x3c')]['findAll'](_0x693d43);})['then'](function(_0x314f77){_0x29ab7c['rows']=_0x314f77;return _0x29ab7c;})[_0x5f8f('0x20')](respondWithFilteredResult(_0x51076d,_0x693d43))[_0x5f8f('0x3d')](handleError(_0x51076d,null));};exports[_0x5f8f('0x3e')]=function(_0x377abe,_0x26bacc){var _0x219bea={'raw':!![],'where':{'id':_0x377abe[_0x5f8f('0x3f')]['id']}},_0x4d0f0d={};_0x4d0f0d['model']=_[_0x5f8f('0x2b')](db[_0x5f8f('0x3c')][_0x5f8f('0x40')]);_0x4d0f0d['query']=_[_0x5f8f('0x2b')](_0x377abe[_0x5f8f('0x2f')]);_0x4d0f0d[_0x5f8f('0x2c')]=_['intersection'](_0x4d0f0d[_0x5f8f('0x2a')],_0x4d0f0d[_0x5f8f('0x2f')]);_0x219bea[_0x5f8f('0x2e')]=_[_0x5f8f('0x2d')](_0x4d0f0d['model'],qs[_0x5f8f('0x30')](_0x377abe[_0x5f8f('0x2f')]['fields']));_0x219bea[_0x5f8f('0x2e')]=_0x219bea[_0x5f8f('0x2e')][_0x5f8f('0x31')]?_0x219bea[_0x5f8f('0x2e')]:_0x4d0f0d[_0x5f8f('0x2a')];if(_0x377abe[_0x5f8f('0x2f')]['includeAll']){_0x219bea['include']=[{'all':!![]}];}_0x219bea=_['merge']({},_0x219bea,_0x377abe[_0x5f8f('0x3a')]);return db[_0x5f8f('0x3c')][_0x5f8f('0x41')](_0x219bea)[_0x5f8f('0x20')](handleEntityNotFound(_0x26bacc,null))[_0x5f8f('0x20')](respondWithResult(_0x26bacc,null))[_0x5f8f('0x3d')](handleError(_0x26bacc,null));};exports[_0x5f8f('0x42')]=function(_0x5de397,_0x1bbbc){return db['MailTransferReport']['create'](_0x5de397[_0x5f8f('0x43')],{})[_0x5f8f('0x20')](respondWithResult(_0x1bbbc,0xc9))['catch'](handleError(_0x1bbbc,null));};exports[_0x5f8f('0x44')]=function(_0x5d2f17,_0x22495a){if(_0x5d2f17[_0x5f8f('0x43')]['id']){delete _0x5d2f17['body']['id'];}return db['MailTransferReport'][_0x5f8f('0x41')]({'where':{'id':_0x5d2f17[_0x5f8f('0x3f')]['id']}})[_0x5f8f('0x20')](handleEntityNotFound(_0x22495a,null))[_0x5f8f('0x20')](saveUpdates(_0x5d2f17[_0x5f8f('0x43')],null))[_0x5f8f('0x20')](respondWithResult(_0x22495a,null))[_0x5f8f('0x3d')](handleError(_0x22495a,null));};exports[_0x5f8f('0x45')]=function(_0x3986cd,_0x5f13ab){return db['MailTransferReport'][_0x5f8f('0x41')]({'where':{'id':_0x3986cd[_0x5f8f('0x3f')]['id']}})[_0x5f8f('0x20')](handleEntityNotFound(_0x5f13ab,null))['then'](removeEntity(_0x5f13ab,null))['catch'](handleError(_0x5f13ab,null));};exports[_0x5f8f('0x46')]=function(_0x123001,_0xc570f4){return db[_0x5f8f('0x3c')][_0x5f8f('0x46')]()[_0x5f8f('0x20')](respondWithResult(_0xc570f4,null))[_0x5f8f('0x3d')](handleError(_0xc570f4,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index b343680..d9dbb5b 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 _0x616c=['moment','bluebird','request-promise','path','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','util','../../config/logger'];(function(_0x3ea60c,_0x5d97b1){var _0x35d3ea=function(_0x3d94e1){while(--_0x3d94e1){_0x3ea60c['push'](_0x3ea60c['shift']());}};_0x35d3ea(++_0x5d97b1);}(_0x616c,0x1b6));var _0xc616=function(_0x2fee45,_0x3fee71){_0x2fee45=_0x2fee45-0x0;var _0x2ea2e3=_0x616c[_0x2fee45];return _0x2ea2e3;};'use strict';var _=require('lodash');var util=require(_0xc616('0x0'));var logger=require(_0xc616('0x1'))('api');var moment=require(_0xc616('0x2'));var BPromise=require(_0xc616('0x3'));var rp=require(_0xc616('0x4'));var fs=require('fs');var path=require(_0xc616('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc616('0x6'));module[_0xc616('0x7')]=function(_0x1772f5,_0x15f809){return _0x1772f5[_0xc616('0x8')](_0xc616('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc616('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ce6=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x15f6ec,_0x54bcfc){var _0x2339d0=function(_0x5c1071){while(--_0x5c1071){_0x15f6ec['push'](_0x15f6ec['shift']());}};_0x2339d0(++_0x54bcfc);}(_0x4ce6,0x108));var _0x64ce=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0x4ce6[_0x5f1617];return _0x3af5da;};'use strict';var _=require(_0x64ce('0x0'));var util=require('util');var logger=require(_0x64ce('0x1'))(_0x64ce('0x2'));var moment=require(_0x64ce('0x3'));var BPromise=require(_0x64ce('0x4'));var rp=require(_0x64ce('0x5'));var fs=require('fs');var path=require(_0x64ce('0x6'));var rimraf=require('rimraf');var config=require(_0x64ce('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x31bc0f,_0x262751){return _0x31bc0f['define'](_0x64ce('0x8'),attributes,{'tableName':_0x64ce('0x9'),'paranoid':![],'indexes':[{'name':_0x64ce('0xa'),'fields':[_0x64ce('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 96dffa0..2885911 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 _0x07e1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0xcdac34,_0x43f665){var _0x269d23=function(_0x3f2d6f){while(--_0x3f2d6f){_0xcdac34['push'](_0xcdac34['shift']());}};_0x269d23(++_0x43f665);}(_0x07e1,0x133));var _0x107e=function(_0x2fd5f1,_0x51a172){_0x2fd5f1=_0x2fd5f1-0x0;var _0x5af6f6=_0x07e1[_0x2fd5f1];return _0x5af6f6;};'use strict';var _=require(_0x107e('0x0'));var util=require(_0x107e('0x1'));var moment=require(_0x107e('0x2'));var BPromise=require('bluebird');var rs=require(_0x107e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x107e('0x4'))['db'];var utils=require(_0x107e('0x5'));var logger=require(_0x107e('0x6'))(_0x107e('0x7'));var config=require(_0x107e('0x8'));var jayson=require(_0x107e('0x9'));var client=jayson[_0x107e('0xa')][_0x107e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39401c,_0x39b58b,_0x1cf676){return new BPromise(function(_0x23e4fc,_0x253b20){return client[_0x107e('0xc')](_0x39401c,_0x1cf676)[_0x107e('0xd')](function(_0x290bcd){logger['info'](_0x107e('0xe'),_0x39b58b,_0x107e('0xf'));logger[_0x107e('0x10')](_0x107e('0x11'),_0x39b58b,_0x107e('0xf'),JSON[_0x107e('0x12')](_0x290bcd));if(_0x290bcd[_0x107e('0x13')]){if(_0x290bcd[_0x107e('0x13')][_0x107e('0x14')]===0x1f4){logger['error'](_0x107e('0xe'),_0x39b58b,_0x290bcd[_0x107e('0x13')]['message']);return _0x253b20(_0x290bcd[_0x107e('0x13')][_0x107e('0x15')]);}logger[_0x107e('0x13')](_0x107e('0xe'),_0x39b58b,_0x290bcd[_0x107e('0x13')]['message']);return _0x23e4fc(_0x290bcd['error']['message']);}else{logger[_0x107e('0x16')]('MailTransferReport,\x20%s,\x20%s',_0x39b58b,_0x107e('0xf'));_0x23e4fc(_0x290bcd['result'][_0x107e('0x15')]);}})[_0x107e('0x17')](function(_0x46eccf){logger[_0x107e('0x13')](_0x107e('0xe'),_0x39b58b,_0x46eccf);_0x253b20(_0x46eccf);});});} \ No newline at end of file +var _0x6222=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailTransferReport,\x20%s,\x20%s','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x5c6545,_0x474b5e){var _0x30365a=function(_0xcaf07){while(--_0xcaf07){_0x5c6545['push'](_0x5c6545['shift']());}};_0x30365a(++_0x474b5e);}(_0x6222,0x7d));var _0x2622=function(_0x4b37f8,_0x52f0be){_0x4b37f8=_0x4b37f8-0x0;var _0x584319=_0x6222[_0x4b37f8];return _0x584319;};'use strict';var _=require(_0x2622('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2622('0x1'));var rs=require(_0x2622('0x2'));var fs=require('fs');var Redis=require(_0x2622('0x3'));var db=require(_0x2622('0x4'))['db'];var utils=require(_0x2622('0x5'));var logger=require(_0x2622('0x6'))(_0x2622('0x7'));var config=require(_0x2622('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2622('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38c07d,_0x5d293b,_0x3e1a50){return new BPromise(function(_0x2bf6f5,_0x5ef694){return client[_0x2622('0xa')](_0x38c07d,_0x3e1a50)[_0x2622('0xb')](function(_0x264e67){logger[_0x2622('0xc')](_0x2622('0xd'),_0x5d293b,'request\x20sent');logger['debug'](_0x2622('0xe'),_0x5d293b,_0x2622('0xf'),JSON[_0x2622('0x10')](_0x264e67));if(_0x264e67[_0x2622('0x11')]){if(_0x264e67[_0x2622('0x11')]['code']===0x1f4){logger[_0x2622('0x11')](_0x2622('0xd'),_0x5d293b,_0x264e67[_0x2622('0x11')][_0x2622('0x12')]);return _0x5ef694(_0x264e67['error'][_0x2622('0x12')]);}logger[_0x2622('0x11')](_0x2622('0xd'),_0x5d293b,_0x264e67['error'][_0x2622('0x12')]);return _0x2bf6f5(_0x264e67[_0x2622('0x11')][_0x2622('0x12')]);}else{logger[_0x2622('0xc')](_0x2622('0xd'),_0x5d293b,_0x2622('0xf'));_0x2bf6f5(_0x264e67[_0x2622('0x13')][_0x2622('0x12')]);}})[_0x2622('0x14')](function(_0x5896c7){logger[_0x2622('0x11')](_0x2622('0xd'),_0x5d293b,_0x5896c7);_0x5ef694(_0x5896c7);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 1e21aec..72af05a 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 _0x7c73=['../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7c73,0xea));var _0x37c7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7c73[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x37c7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x37c7('0x1'));var express=require('express');var router=express[_0x37c7('0x2')]();var fs_extra=require(_0x37c7('0x3'));var auth=require(_0x37c7('0x4'));var interaction=require(_0x37c7('0x5'));var config=require(_0x37c7('0x6'));var controller=require(_0x37c7('0x7'));router[_0x37c7('0x8')]('/',auth['isAuthenticated'](),controller[_0x37c7('0x9')]);router[_0x37c7('0x8')](_0x37c7('0xa'),auth[_0x37c7('0xb')](),controller[_0x37c7('0xc')]);router[_0x37c7('0x8')](_0x37c7('0xd'),auth[_0x37c7('0xb')](),controller[_0x37c7('0xe')]);router['post']('/',auth[_0x37c7('0xb')](),controller[_0x37c7('0xf')]);router[_0x37c7('0x10')](_0x37c7('0xd'),auth[_0x37c7('0xb')](),controller[_0x37c7('0x11')]);router[_0x37c7('0x12')](_0x37c7('0xd'),auth[_0x37c7('0xb')](),controller[_0x37c7('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1346=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1346,0x7f));var _0x6134=function(_0x3b510c,_0xc57621){_0x3b510c=_0x3b510c-0x0;var _0x4a3574=_0x1346[_0x3b510c];return _0x4a3574;};'use strict';var multer=require('multer');var util=require(_0x6134('0x0'));var path=require(_0x6134('0x1'));var timeout=require(_0x6134('0x2'));var express=require(_0x6134('0x3'));var router=express[_0x6134('0x4')]();var fs_extra=require(_0x6134('0x5'));var auth=require(_0x6134('0x6'));var interaction=require(_0x6134('0x7'));var config=require(_0x6134('0x8'));var controller=require('./memberReport.controller');router[_0x6134('0x9')]('/',auth[_0x6134('0xa')](),controller[_0x6134('0xb')]);router[_0x6134('0x9')](_0x6134('0xc'),auth[_0x6134('0xa')](),controller[_0x6134('0xd')]);router[_0x6134('0x9')](_0x6134('0xe'),auth[_0x6134('0xa')](),controller[_0x6134('0xf')]);router[_0x6134('0x10')]('/',auth[_0x6134('0xa')](),controller[_0x6134('0x11')]);router[_0x6134('0x12')](_0x6134('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6134('0xe'),auth[_0x6134('0xa')](),controller[_0x6134('0x13')]);module[_0x6134('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 46fa0bd..e630fdb 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 _0x05b2=['seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','DATE','getDataValue','enterAt','diff'];(function(_0x1057a3,_0x28d9b7){var _0x131cdb=function(_0x47a386){while(--_0x47a386){_0x1057a3['push'](_0x1057a3['shift']());}};_0x131cdb(++_0x28d9b7);}(_0x05b2,0x77));var _0x205b=function(_0x4b250a,_0x32a950){_0x4b250a=_0x4b250a-0x0;var _0x1ed247=_0x05b2[_0x4b250a];return _0x1ed247;};'use strict';var Sequelize=require(_0x205b('0x0'));var moment=require(_0x205b('0x1'));module[_0x205b('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x205b('0x3')]},'interface':{'type':Sequelize[_0x205b('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x205b('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x205b('0x5')],'set':function(_0x65929){var _0xbb4fe1=moment(_0x65929);var _0x2d6888=moment(this[_0x205b('0x6')](_0x205b('0x7')));var _0xd814cd=_0xbb4fe1[_0x205b('0x8')](_0x2d6888,_0x205b('0x9'));this[_0x205b('0xa')]('exitAt',_0x65929);this[_0x205b('0xa')](_0x205b('0xb'),_0xd814cd>=0x0?_0xd814cd:null);}},'data1':{'type':Sequelize[_0x205b('0x3')],'comment':_0x205b('0xc')},'data2':{'type':Sequelize[_0x205b('0x3')],'comment':_0x205b('0xd')},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x205b('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x205b('0x3')],'comment':_0x205b('0xe')},'role':{'type':Sequelize[_0x205b('0x3')]},'internal':{'type':Sequelize[_0x205b('0xf')]},'uniqueid':{'type':Sequelize[_0x205b('0x3')]}}; \ No newline at end of file +var _0xb1c9=['enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0xb1c9,0x1cc));var _0x9b1c=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xb1c9[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require(_0x9b1c('0x0'));var moment=require('moment');module[_0x9b1c('0x1')]={'channel':{'type':Sequelize[_0x9b1c('0x2')]},'membername':{'type':Sequelize[_0x9b1c('0x2')]},'interface':{'type':Sequelize[_0x9b1c('0x2')]},'type':{'type':Sequelize[_0x9b1c('0x2')],'defaultValue':_0x9b1c('0x3'),'comment':_0x9b1c('0x4')},'duration':{'type':Sequelize[_0x9b1c('0x5')]},'enterAt':{'type':Sequelize[_0x9b1c('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x5e7a13){var _0x144ab2=moment(_0x5e7a13);var _0x275d5a=moment(this[_0x9b1c('0x7')](_0x9b1c('0x8')));var _0x254964=_0x144ab2[_0x9b1c('0x9')](_0x275d5a,_0x9b1c('0xa'));this[_0x9b1c('0xb')](_0x9b1c('0xc'),_0x5e7a13);this[_0x9b1c('0xb')](_0x9b1c('0xd'),_0x254964>=0x0?_0x254964:null);}},'data1':{'type':Sequelize[_0x9b1c('0x2')],'comment':_0x9b1c('0xe')},'data2':{'type':Sequelize[_0x9b1c('0x2')],'comment':_0x9b1c('0xf')},'data3':{'type':Sequelize[_0x9b1c('0x2')],'comment':_0x9b1c('0x10')},'data4':{'type':Sequelize[_0x9b1c('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x9b1c('0x2')],'comment':_0x9b1c('0x11')},'role':{'type':Sequelize[_0x9b1c('0x2')]},'internal':{'type':Sequelize[_0x9b1c('0x5')]},'uniqueid':{'type':Sequelize[_0x9b1c('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index c5b97d5..5eec43c 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0xebeaa3,_0x15969c){var _0x2c3397=function(_0xa9b333){while(--_0xa9b333){_0xebeaa3['push'](_0xebeaa3['shift']());}};_0x2c3397(++_0x15969c);}(_0x3e74,0x175));var _0x43e7=function(_0x4922ef,_0x22b627){_0x4922ef=_0x4922ef-0x0;var _0x3b9431=_0x3e74[_0x4922ef];return _0x3b9431;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x29af75,_0x152b87){var _0x32b56b=function(_0x5460fe){while(--_0x5460fe){_0x29af75['push'](_0x29af75['shift']());}};_0x32b56b(++_0x152b87);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 48b60e4..84ee9ee 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 _0x9dbf=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','membername_interface','membername','interface','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9dbf,0x99));var _0xf9db=function(_0x773561,_0x313a1d){_0x773561=_0x773561-0x0;var _0xcefe36=_0x9dbf[_0x773561];return _0xcefe36;};'use strict';var _=require(_0xf9db('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf9db('0x1'));var moment=require(_0xf9db('0x2'));var BPromise=require(_0xf9db('0x3'));var rp=require(_0xf9db('0x4'));var fs=require('fs');var path=require(_0xf9db('0x5'));var rimraf=require(_0xf9db('0x6'));var config=require(_0xf9db('0x7'));var attributes=require(_0xf9db('0x8'));module['exports']=function(_0xc9f8a7,_0x127970){return _0xc9f8a7[_0xf9db('0x9')](_0xf9db('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xf9db('0xb'),'fields':[_0xf9db('0xc'),_0xf9db('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x84cd=['bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','interface','lodash','util','../../config/logger','api','moment'];(function(_0x4fdb79,_0x12c116){var _0x3ec15b=function(_0x50c82e){while(--_0x50c82e){_0x4fdb79['push'](_0x4fdb79['shift']());}};_0x3ec15b(++_0x12c116);}(_0x84cd,0x193));var _0xd84c=function(_0xac0174,_0x6bec5f){_0xac0174=_0xac0174-0x0;var _0x4b09f8=_0x84cd[_0xac0174];return _0x4b09f8;};'use strict';var _=require(_0xd84c('0x0'));var util=require(_0xd84c('0x1'));var logger=require(_0xd84c('0x2'))(_0xd84c('0x3'));var moment=require(_0xd84c('0x4'));var BPromise=require(_0xd84c('0x5'));var rp=require(_0xd84c('0x6'));var fs=require('fs');var path=require(_0xd84c('0x7'));var rimraf=require(_0xd84c('0x8'));var config=require(_0xd84c('0x9'));var attributes=require(_0xd84c('0xa'));module[_0xd84c('0xb')]=function(_0x3ff9c4,_0x3f05d2){return _0x3ff9c4[_0xd84c('0xc')](_0xd84c('0xd'),attributes,{'tableName':_0xd84c('0xe'),'paranoid':![],'indexes':[{'name':_0xd84c('0xf'),'fields':['membername',_0xd84c('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index b76693b..d108c30 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 _0xc21c=['MemberReport','findAll','options','raw','where','attributes','include','map','model','then','stringify','CreateMemberReport','body','UpdateMemberReport','update','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','catch','GetMemberReport'];(function(_0x5aab8f,_0x411fd5){var _0x5059aa=function(_0x5ea027){while(--_0x5ea027){_0x5aab8f['push'](_0x5aab8f['shift']());}};_0x5059aa(++_0x411fd5);}(_0xc21c,0x166));var _0xcc21=function(_0x16eb26,_0x2f56d2){_0x16eb26=_0x16eb26-0x0;var _0x4eeda1=_0xc21c[_0x16eb26];return _0x4eeda1;};'use strict';var _=require(_0xcc21('0x0'));var util=require(_0xcc21('0x1'));var moment=require('moment');var BPromise=require(_0xcc21('0x2'));var rs=require(_0xcc21('0x3'));var fs=require('fs');var Redis=require(_0xcc21('0x4'));var db=require(_0xcc21('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc21('0x6'))(_0xcc21('0x7'));var config=require(_0xcc21('0x8'));var jayson=require(_0xcc21('0x9'));var client=jayson[_0xcc21('0xa')][_0xcc21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33604a,_0x4f3166,_0x2676fe){return new BPromise(function(_0xff4686,_0x4cb3ea){return client[_0xcc21('0xc')](_0x33604a,_0x2676fe)['then'](function(_0x144387){logger['info'](_0xcc21('0xd'),_0x4f3166,'request\x20sent');logger[_0xcc21('0xe')](_0xcc21('0xf'),_0x4f3166,'request\x20sent',JSON['stringify'](_0x144387));if(_0x144387[_0xcc21('0x10')]){if(_0x144387[_0xcc21('0x10')]['code']===0x1f4){logger[_0xcc21('0x10')]('MemberReport,\x20%s,\x20%s',_0x4f3166,_0x144387[_0xcc21('0x10')][_0xcc21('0x11')]);return _0x4cb3ea(_0x144387[_0xcc21('0x10')]['message']);}logger[_0xcc21('0x10')]('MemberReport,\x20%s,\x20%s',_0x4f3166,_0x144387[_0xcc21('0x10')][_0xcc21('0x11')]);return _0xff4686(_0x144387[_0xcc21('0x10')][_0xcc21('0x11')]);}else{logger[_0xcc21('0x12')](_0xcc21('0xd'),_0x4f3166,_0xcc21('0x13'));_0xff4686(_0x144387['result']['message']);}})[_0xcc21('0x14')](function(_0x56d008){logger[_0xcc21('0x10')](_0xcc21('0xd'),_0x4f3166,_0x56d008);_0x4cb3ea(_0x56d008);});});}exports[_0xcc21('0x15')]=function(_0x132145){var _0x79ea56=this;return new Promise(function(_0x5a727c,_0x30f62e){return db[_0xcc21('0x16')][_0xcc21('0x17')]({'raw':_0x132145[_0xcc21('0x18')]?_0x132145['options'][_0xcc21('0x19')]===undefined?!![]:![]:!![],'where':_0x132145[_0xcc21('0x18')]?_0x132145[_0xcc21('0x18')][_0xcc21('0x1a')]||null:null,'attributes':_0x132145[_0xcc21('0x18')]?_0x132145['options'][_0xcc21('0x1b')]||null:null,'limit':_0x132145[_0xcc21('0x18')]?_0x132145['options']['limit']||null:null,'include':_0x132145[_0xcc21('0x18')]?_0x132145['options'][_0xcc21('0x1c')]?_[_0xcc21('0x1d')](_0x132145[_0xcc21('0x18')][_0xcc21('0x1c')],function(_0x438d6c){return{'model':db[_0x438d6c[_0xcc21('0x1e')]],'as':_0x438d6c['as'],'attributes':_0x438d6c['attributes'],'include':_0x438d6c[_0xcc21('0x1c')]?_['map'](_0x438d6c[_0xcc21('0x1c')],function(_0x3a5c4a){return{'model':db[_0x3a5c4a[_0xcc21('0x1e')]],'as':_0x3a5c4a['as'],'attributes':_0x3a5c4a[_0xcc21('0x1b')],'include':_0x3a5c4a['include']?_[_0xcc21('0x1d')](_0x3a5c4a['include'],function(_0x6280ac){return{'model':db[_0x6280ac[_0xcc21('0x1e')]],'as':_0x6280ac['as'],'attributes':_0x6280ac[_0xcc21('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcc21('0x1f')](function(_0x7ff7d2){logger[_0xcc21('0x12')](_0xcc21('0x15'),_0x132145);logger[_0xcc21('0xe')](_0xcc21('0x15'),_0x132145,JSON[_0xcc21('0x20')](_0x7ff7d2));_0x5a727c(_0x7ff7d2);})['catch'](function(_0x304658){logger['error'](_0xcc21('0x15'),_0x304658[_0xcc21('0x11')],_0x132145);_0x30f62e(_0x79ea56[_0xcc21('0x10')](0x1f4,_0x304658['message']));});});};exports[_0xcc21('0x21')]=function(_0x506901){var _0x29f003=this;return new Promise(function(_0x5d1dc3,_0x5b1f31){return db['MemberReport']['create'](_0x506901[_0xcc21('0x22')],{'raw':_0x506901['options']?_0x506901[_0xcc21('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xcc21('0x1f')](function(_0x311a00){logger[_0xcc21('0x12')]('CreateMemberReport',_0x506901);logger[_0xcc21('0xe')](_0xcc21('0x21'),_0x506901,JSON[_0xcc21('0x20')](_0x311a00));_0x5d1dc3(_0x311a00);})[_0xcc21('0x14')](function(_0x56b983){logger['error'](_0xcc21('0x21'),_0x56b983['message'],_0x506901);_0x5b1f31(_0x29f003[_0xcc21('0x10')](0x1f4,_0x56b983[_0xcc21('0x11')]));});});};exports[_0xcc21('0x23')]=function(_0x590b7f){var _0x46a3b8=this;return new Promise(function(_0x51f67a,_0x4bb1ca){return db[_0xcc21('0x16')][_0xcc21('0x24')](_0x590b7f['body'],{'raw':_0x590b7f[_0xcc21('0x18')]?_0x590b7f[_0xcc21('0x18')][_0xcc21('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x590b7f[_0xcc21('0x18')]?_0x590b7f[_0xcc21('0x18')][_0xcc21('0x1a')]||null:null,'attributes':_0x590b7f['options']?_0x590b7f[_0xcc21('0x18')][_0xcc21('0x1b')]||null:null,'limit':_0x590b7f[_0xcc21('0x18')]?_0x590b7f[_0xcc21('0x18')][_0xcc21('0x25')]||null:null})['then'](function(_0xf03d8e){logger[_0xcc21('0x12')](_0xcc21('0x23'),_0x590b7f);logger['debug'](_0xcc21('0x23'),_0x590b7f,JSON[_0xcc21('0x20')](_0xf03d8e));_0x51f67a(_0xf03d8e);})[_0xcc21('0x14')](function(_0x46cf4f){logger['error']('UpdateMemberReport',_0x46cf4f[_0xcc21('0x11')],_0x590b7f);_0x4bb1ca(_0x46a3b8[_0xcc21('0x10')](0x1f4,_0x46cf4f['message']));});});}; \ No newline at end of file +var _0x8784=['message','result','catch','MemberReport','findAll','options','where','attributes','limit','include','map','model','GetMemberReport','create','body','raw','CreateMemberReport','update','UpdateMemberReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x387ddf,_0x3066bc){var _0x3f503e=function(_0x4b401b){while(--_0x4b401b){_0x387ddf['push'](_0x387ddf['shift']());}};_0x3f503e(++_0x3066bc);}(_0x8784,0x172));var _0x4878=function(_0x5b8310,_0x77ea6f){_0x5b8310=_0x5b8310-0x0;var _0xd3ebc1=_0x8784[_0x5b8310];return _0xd3ebc1;};'use strict';var _=require(_0x4878('0x0'));var util=require(_0x4878('0x1'));var moment=require('moment');var BPromise=require(_0x4878('0x2'));var rs=require(_0x4878('0x3'));var fs=require('fs');var Redis=require(_0x4878('0x4'));var db=require(_0x4878('0x5'))['db'];var utils=require(_0x4878('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4878('0x7'));var jayson=require(_0x4878('0x8'));var client=jayson[_0x4878('0x9')][_0x4878('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe22936,_0x4148dd,_0x131e82){return new BPromise(function(_0x35cd6a,_0x29d02e){return client['request'](_0xe22936,_0x131e82)[_0x4878('0xb')](function(_0xfe196b){logger[_0x4878('0xc')](_0x4878('0xd'),_0x4148dd,_0x4878('0xe'));logger[_0x4878('0xf')](_0x4878('0x10'),_0x4148dd,_0x4878('0xe'),JSON[_0x4878('0x11')](_0xfe196b));if(_0xfe196b[_0x4878('0x12')]){if(_0xfe196b[_0x4878('0x12')][_0x4878('0x13')]===0x1f4){logger['error'](_0x4878('0xd'),_0x4148dd,_0xfe196b[_0x4878('0x12')][_0x4878('0x14')]);return _0x29d02e(_0xfe196b['error'][_0x4878('0x14')]);}logger[_0x4878('0x12')]('MemberReport,\x20%s,\x20%s',_0x4148dd,_0xfe196b[_0x4878('0x12')]['message']);return _0x35cd6a(_0xfe196b['error'][_0x4878('0x14')]);}else{logger[_0x4878('0xc')](_0x4878('0xd'),_0x4148dd,_0x4878('0xe'));_0x35cd6a(_0xfe196b[_0x4878('0x15')]['message']);}})[_0x4878('0x16')](function(_0x25282f){logger['error'](_0x4878('0xd'),_0x4148dd,_0x25282f);_0x29d02e(_0x25282f);});});}exports['GetMemberReport']=function(_0x2c2529){var _0x4baa5e=this;return new Promise(function(_0x5267ff,_0x2ab3f6){return db[_0x4878('0x17')][_0x4878('0x18')]({'raw':_0x2c2529[_0x4878('0x19')]?_0x2c2529[_0x4878('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2c2529[_0x4878('0x19')]?_0x2c2529[_0x4878('0x19')][_0x4878('0x1a')]||null:null,'attributes':_0x2c2529[_0x4878('0x19')]?_0x2c2529[_0x4878('0x19')][_0x4878('0x1b')]||null:null,'limit':_0x2c2529['options']?_0x2c2529[_0x4878('0x19')][_0x4878('0x1c')]||null:null,'include':_0x2c2529[_0x4878('0x19')]?_0x2c2529['options'][_0x4878('0x1d')]?_[_0x4878('0x1e')](_0x2c2529['options'][_0x4878('0x1d')],function(_0x10e25d){return{'model':db[_0x10e25d[_0x4878('0x1f')]],'as':_0x10e25d['as'],'attributes':_0x10e25d['attributes'],'include':_0x10e25d[_0x4878('0x1d')]?_[_0x4878('0x1e')](_0x10e25d[_0x4878('0x1d')],function(_0x476ec3){return{'model':db[_0x476ec3[_0x4878('0x1f')]],'as':_0x476ec3['as'],'attributes':_0x476ec3['attributes'],'include':_0x476ec3[_0x4878('0x1d')]?_[_0x4878('0x1e')](_0x476ec3['include'],function(_0x48f8f){return{'model':db[_0x48f8f[_0x4878('0x1f')]],'as':_0x48f8f['as'],'attributes':_0x48f8f[_0x4878('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4878('0xb')](function(_0x43b9a0){logger[_0x4878('0xc')](_0x4878('0x20'),_0x2c2529);logger[_0x4878('0xf')](_0x4878('0x20'),_0x2c2529,JSON[_0x4878('0x11')](_0x43b9a0));_0x5267ff(_0x43b9a0);})[_0x4878('0x16')](function(_0x38400b){logger[_0x4878('0x12')]('GetMemberReport',_0x38400b[_0x4878('0x14')],_0x2c2529);_0x2ab3f6(_0x4baa5e[_0x4878('0x12')](0x1f4,_0x38400b['message']));});});};exports['CreateMemberReport']=function(_0x41908f){var _0x2e06b6=this;return new Promise(function(_0x45432e,_0x46b27d){return db[_0x4878('0x17')][_0x4878('0x21')](_0x41908f[_0x4878('0x22')],{'raw':_0x41908f['options']?_0x41908f[_0x4878('0x19')][_0x4878('0x23')]===undefined?!![]:![]:!![]})[_0x4878('0xb')](function(_0xae0447){logger[_0x4878('0xc')]('CreateMemberReport',_0x41908f);logger['debug']('CreateMemberReport',_0x41908f,JSON[_0x4878('0x11')](_0xae0447));_0x45432e(_0xae0447);})[_0x4878('0x16')](function(_0x44e796){logger['error'](_0x4878('0x24'),_0x44e796[_0x4878('0x14')],_0x41908f);_0x46b27d(_0x2e06b6['error'](0x1f4,_0x44e796[_0x4878('0x14')]));});});};exports['UpdateMemberReport']=function(_0xcdb929){var _0x4c31b6=this;return new Promise(function(_0x4d2fa4,_0x179116){return db['MemberReport'][_0x4878('0x25')](_0xcdb929[_0x4878('0x22')],{'raw':_0xcdb929['options']?_0xcdb929[_0x4878('0x19')][_0x4878('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcdb929['options']?_0xcdb929[_0x4878('0x19')][_0x4878('0x1a')]||null:null,'attributes':_0xcdb929['options']?_0xcdb929[_0x4878('0x19')]['attributes']||null:null,'limit':_0xcdb929[_0x4878('0x19')]?_0xcdb929[_0x4878('0x19')][_0x4878('0x1c')]||null:null})[_0x4878('0xb')](function(_0x5c78da){logger[_0x4878('0xc')](_0x4878('0x26'),_0xcdb929);logger[_0x4878('0xf')](_0x4878('0x26'),_0xcdb929,JSON['stringify'](_0x5c78da));_0x4d2fa4(_0x5c78da);})[_0x4878('0x16')](function(_0x48b7f3){logger[_0x4878('0x12')](_0x4878('0x26'),_0x48b7f3['message'],_0xcdb929);_0x179116(_0x4c31b6[_0x4878('0x12')](0x1f4,_0x48b7f3[_0x4878('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 0a6e51a..d9265b3 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 _0xd07b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports'];(function(_0x321c3f,_0x3d7642){var _0x37f079=function(_0x8b2719){while(--_0x8b2719){_0x321c3f['push'](_0x321c3f['shift']());}};_0x37f079(++_0x3d7642);}(_0xd07b,0xfc));var _0xbd07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd07b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbd07('0x0'));var util=require(_0xbd07('0x1'));var path=require(_0xbd07('0x2'));var timeout=require(_0xbd07('0x3'));var express=require(_0xbd07('0x4'));var router=express[_0xbd07('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbd07('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbd07('0x7'));var controller=require(_0xbd07('0x8'));router[_0xbd07('0x9')]('/',controller[_0xbd07('0xa')]);module[_0xbd07('0xb')]=router; \ No newline at end of file +var _0xb3f7=['get','index','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x2ba9ac,_0xa1fdc4){var _0x1b0fc9=function(_0x4343de){while(--_0x4343de){_0x2ba9ac['push'](_0x2ba9ac['shift']());}};_0x1b0fc9(++_0xa1fdc4);}(_0xb3f7,0x10a));var _0x7b3f=function(_0x554904,_0x18a27b){_0x554904=_0x554904-0x0;var _0x28f8c0=_0xb3f7[_0x554904];return _0x28f8c0;};'use strict';var multer=require(_0x7b3f('0x0'));var util=require(_0x7b3f('0x1'));var path=require(_0x7b3f('0x2'));var timeout=require(_0x7b3f('0x3'));var express=require('express');var router=express[_0x7b3f('0x4')]();var fs_extra=require(_0x7b3f('0x5'));var auth=require(_0x7b3f('0x6'));var interaction=require(_0x7b3f('0x7'));var config=require(_0x7b3f('0x8'));var controller=require(_0x7b3f('0x9'));router[_0x7b3f('0xa')]('/',controller[_0x7b3f('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 052f6ad..7b6ec17 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 _0x5b5d=['sequelize'];(function(_0x9097bc,_0x348605){var _0x5af24a=function(_0x5a67b9){while(--_0x5a67b9){_0x9097bc['push'](_0x9097bc['shift']());}};_0x5af24a(++_0x348605);}(_0x5b5d,0x11c));var _0xd5b5=function(_0x21bd0c,_0xb53081){_0x21bd0c=_0x21bd0c-0x0;var _0x222ccc=_0x5b5d[_0x21bd0c];return _0x222ccc;};'use strict';var Sequelize=require(_0xd5b5('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0x30bf=['version','sequelize','exports','STRING'];(function(_0x28c7a7,_0x55a356){var _0x50610f=function(_0x3a4038){while(--_0x3a4038){_0x28c7a7['push'](_0x28c7a7['shift']());}};_0x50610f(++_0x55a356);}(_0x30bf,0x121));var _0xf30b=function(_0x2b8dcc,_0x30fd84){_0x2b8dcc=_0x2b8dcc-0x0;var _0x3992ac=_0x30bf[_0x2b8dcc];return _0x3992ac;};'use strict';var Sequelize=require(_0xf30b('0x0'));module[_0xf30b('0x1')]={'version':{'type':Sequelize[_0xf30b('0x2')],'unique':_0xf30b('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 97db161..044b143 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 _0xa9a7=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','Migration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x416326,_0xd2abb0){var _0xa70bf5=function(_0x2a2d1b){while(--_0x2a2d1b){_0x416326['push'](_0x416326['shift']());}};_0xa70bf5(++_0xd2abb0);}(_0xa9a7,0xbd));var _0x7a9a=function(_0x27ab20,_0x2b7d74){_0x27ab20=_0x27ab20-0x0;var _0x89aca0=_0xa9a7[_0x27ab20];return _0x89aca0;};'use strict';var emlformat=require(_0x7a9a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7a9a('0x1'));var jsonpatch=require(_0x7a9a('0x2'));var rp=require(_0x7a9a('0x3'));var moment=require(_0x7a9a('0x4'));var BPromise=require(_0x7a9a('0x5'));var Mustache=require(_0x7a9a('0x6'));var util=require(_0x7a9a('0x7'));var path=require('path');var sox=require(_0x7a9a('0x8'));var csv=require(_0x7a9a('0x9'));var ejs=require(_0x7a9a('0xa'));var fs=require('fs');var fs_extra=require(_0x7a9a('0xb'));var _=require(_0x7a9a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7a9a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7a9a('0x9'));var querystring=require(_0x7a9a('0xe'));var Papa=require(_0x7a9a('0xf'));var Redis=require(_0x7a9a('0x10'));var authService=require(_0x7a9a('0x11'));var qs=require(_0x7a9a('0x12'));var as=require(_0x7a9a('0x13'));var hardwareService=require(_0x7a9a('0x14'));var logger=require(_0x7a9a('0x15'))('api');var utils=require(_0x7a9a('0x16'));var config=require(_0x7a9a('0x17'));var licenseUtil=require(_0x7a9a('0x18'));var db=require(_0x7a9a('0x19'))['db'];function respondWithStatusCode(_0x42f51b,_0x5b69b4){_0x5b69b4=_0x5b69b4||0xcc;return function(_0x2c3f44){if(_0x2c3f44){return _0x42f51b['sendStatus'](_0x5b69b4);}return _0x42f51b[_0x7a9a('0x1a')](_0x5b69b4)[_0x7a9a('0x1b')]();};}function respondWithResult(_0x592bef,_0xe83434){_0xe83434=_0xe83434||0xc8;return function(_0x3926a1){if(_0x3926a1){return _0x592bef[_0x7a9a('0x1a')](_0xe83434)[_0x7a9a('0x1c')](_0x3926a1);}};}function respondWithFilteredResult(_0x77aee0,_0x419205){return function(_0xfd534e){if(_0xfd534e){var _0x35db3f=typeof _0x419205[_0x7a9a('0x1d')]===_0x7a9a('0x1e')&&typeof _0x419205[_0x7a9a('0x1f')]===_0x7a9a('0x1e');var _0x54f9bd=_0xfd534e[_0x7a9a('0x20')];var _0x512f9b=_0x35db3f?0x0:_0x419205['offset'];var _0x11823d=_0x35db3f?_0xfd534e['count']:_0x419205[_0x7a9a('0x1d')]+_0x419205[_0x7a9a('0x1f')];var _0x7ede59;if(_0x11823d>=_0x54f9bd){_0x11823d=_0x54f9bd;_0x7ede59=0xc8;}else{_0x7ede59=0xce;}_0x77aee0[_0x7a9a('0x1a')](_0x7ede59);return _0x77aee0[_0x7a9a('0x21')](_0x7a9a('0x22'),_0x512f9b+'-'+_0x11823d+'/'+_0x54f9bd)[_0x7a9a('0x1c')](_0xfd534e);}return null;};}function patchUpdates(_0x10db00){return function(_0x557bc6){try{jsonpatch[_0x7a9a('0x23')](_0x557bc6,_0x10db00,!![]);}catch(_0xee36f8){return BPromise[_0x7a9a('0x24')](_0xee36f8);}return _0x557bc6['save']();};}function saveUpdates(_0xef16ce,_0x320012){return function(_0x1ca6ef){if(_0x1ca6ef){return _0x1ca6ef['update'](_0xef16ce)[_0x7a9a('0x25')](function(_0x2105cb){return _0x2105cb;});}return null;};}function removeEntity(_0x208083,_0x373d23){return function(_0x55887d){if(_0x55887d){return _0x55887d[_0x7a9a('0x26')]()[_0x7a9a('0x25')](function(){_0x208083[_0x7a9a('0x1a')](0xcc)[_0x7a9a('0x1b')]();});}};}function handleEntityNotFound(_0x5c4fa7,_0x55f50d){return function(_0x39e41a){if(!_0x39e41a){_0x5c4fa7[_0x7a9a('0x27')](0x194);}return _0x39e41a;};}function handleError(_0x58ba46,_0x1ba6fd){_0x1ba6fd=_0x1ba6fd||0x1f4;return function(_0x45a0a7){logger[_0x7a9a('0x28')](_0x45a0a7[_0x7a9a('0x29')]);if(_0x45a0a7[_0x7a9a('0x2a')]){delete _0x45a0a7[_0x7a9a('0x2a')];}_0x58ba46[_0x7a9a('0x1a')](_0x1ba6fd)[_0x7a9a('0x2b')](_0x45a0a7);};}exports[_0x7a9a('0x2c')]=function(_0x51abfc,_0x253e83){var _0xb8f37d={},_0x3eb016={},_0x148101={'count':0x0,'rows':[]};var _0x364e89=_['map'](db[_0x7a9a('0x2d')][_0x7a9a('0x2e')],function(_0x41e177){return{'name':_0x41e177[_0x7a9a('0x2f')],'type':_0x41e177[_0x7a9a('0x30')][_0x7a9a('0x31')]};});_0x3eb016[_0x7a9a('0x32')]=_[_0x7a9a('0x33')](_0x364e89,_0x7a9a('0x2a'));_0x3eb016[_0x7a9a('0x34')]=_[_0x7a9a('0x35')](_0x51abfc[_0x7a9a('0x34')]);_0x3eb016[_0x7a9a('0x36')]=_[_0x7a9a('0x37')](_0x3eb016[_0x7a9a('0x32')],_0x3eb016[_0x7a9a('0x34')]);_0xb8f37d['attributes']=_[_0x7a9a('0x37')](_0x3eb016[_0x7a9a('0x32')],qs[_0x7a9a('0x38')](_0x51abfc[_0x7a9a('0x34')][_0x7a9a('0x38')]));_0xb8f37d[_0x7a9a('0x39')]=_0xb8f37d[_0x7a9a('0x39')]['length']?_0xb8f37d['attributes']:_0x3eb016[_0x7a9a('0x32')];if(!_0x51abfc[_0x7a9a('0x34')][_0x7a9a('0x3a')]('nolimit')){_0xb8f37d[_0x7a9a('0x1f')]=qs[_0x7a9a('0x1f')](_0x51abfc['query'][_0x7a9a('0x1f')]);_0xb8f37d['offset']=qs[_0x7a9a('0x1d')](_0x51abfc[_0x7a9a('0x34')][_0x7a9a('0x1d')]);}_0xb8f37d['order']=qs[_0x7a9a('0x3b')](_0x51abfc[_0x7a9a('0x34')][_0x7a9a('0x3b')]);_0xb8f37d['where']=qs[_0x7a9a('0x36')](_[_0x7a9a('0x3c')](_0x51abfc['query'],_0x3eb016[_0x7a9a('0x36')]),_0x364e89);if(_0x51abfc[_0x7a9a('0x34')]['filter']){_0xb8f37d[_0x7a9a('0x3d')]=_[_0x7a9a('0x3e')](_0xb8f37d[_0x7a9a('0x3d')],{'$or':_[_0x7a9a('0x33')](_0x364e89,function(_0x50422d){if(_0x50422d[_0x7a9a('0x30')]!==_0x7a9a('0x3f')){var _0x52a40c={};_0x52a40c[_0x50422d[_0x7a9a('0x2a')]]={'$like':'%'+_0x51abfc[_0x7a9a('0x34')][_0x7a9a('0x40')]+'%'};return _0x52a40c;}})});}_0xb8f37d=_[_0x7a9a('0x3e')]({},_0xb8f37d,_0x51abfc[_0x7a9a('0x41')]);var _0x4e39ca={'where':_0xb8f37d[_0x7a9a('0x3d')]};return db['Migration'][_0x7a9a('0x20')](_0x4e39ca)[_0x7a9a('0x25')](function(_0x69a3cc){_0x148101[_0x7a9a('0x20')]=_0x69a3cc;if(_0x51abfc[_0x7a9a('0x34')][_0x7a9a('0x42')]){_0xb8f37d['include']=[{'all':!![]}];}return db['Migration'][_0x7a9a('0x43')](_0xb8f37d);})[_0x7a9a('0x25')](function(_0x367a98){_0x148101[_0x7a9a('0x44')]=_0x367a98;return _0x148101;})[_0x7a9a('0x25')](respondWithFilteredResult(_0x253e83,_0xb8f37d))[_0x7a9a('0x45')](handleError(_0x253e83,null));}; \ No newline at end of file +var _0x4591=['end','error','stack','name','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','include','Migration','findAll','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then'];(function(_0x55e513,_0x32bd07){var _0x225f26=function(_0x168eb4){while(--_0x168eb4){_0x55e513['push'](_0x55e513['shift']());}};_0x225f26(++_0x32bd07);}(_0x4591,0x168));var _0x1459=function(_0x483d2c,_0x34dc13){_0x483d2c=_0x483d2c-0x0;var _0x25239a=_0x4591[_0x483d2c];return _0x25239a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1459('0x0'));var zipdir=require(_0x1459('0x1'));var jsonpatch=require(_0x1459('0x2'));var rp=require(_0x1459('0x3'));var moment=require(_0x1459('0x4'));var BPromise=require(_0x1459('0x5'));var Mustache=require(_0x1459('0x6'));var util=require(_0x1459('0x7'));var path=require(_0x1459('0x8'));var sox=require('sox');var csv=require(_0x1459('0x9'));var ejs=require(_0x1459('0xa'));var fs=require('fs');var fs_extra=require(_0x1459('0xb'));var _=require(_0x1459('0xc'));var squel=require('squel');var crypto=require(_0x1459('0xd'));var jsforce=require(_0x1459('0xe'));var deskjs=require(_0x1459('0xf'));var toCsv=require(_0x1459('0x9'));var querystring=require(_0x1459('0x10'));var Papa=require('papaparse');var Redis=require(_0x1459('0x11'));var authService=require(_0x1459('0x12'));var qs=require(_0x1459('0x13'));var as=require(_0x1459('0x14'));var hardwareService=require(_0x1459('0x15'));var logger=require(_0x1459('0x16'))(_0x1459('0x17'));var utils=require('../../config/utils');var config=require(_0x1459('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dd5c4,_0x2f6a1f){_0x2f6a1f=_0x2f6a1f||0xcc;return function(_0x977afd){if(_0x977afd){return _0x3dd5c4['sendStatus'](_0x2f6a1f);}return _0x3dd5c4[_0x1459('0x19')](_0x2f6a1f)['end']();};}function respondWithResult(_0x217c3c,_0x369041){_0x369041=_0x369041||0xc8;return function(_0x46daeb){if(_0x46daeb){return _0x217c3c[_0x1459('0x19')](_0x369041)[_0x1459('0x1a')](_0x46daeb);}};}function respondWithFilteredResult(_0x4237b2,_0x3857a6){return function(_0x7b1647){if(_0x7b1647){var _0xa1474e=typeof _0x3857a6[_0x1459('0x1b')]===_0x1459('0x1c')&&typeof _0x3857a6[_0x1459('0x1d')]==='undefined';var _0x3385e6=_0x7b1647[_0x1459('0x1e')];var _0x3233ab=_0xa1474e?0x0:_0x3857a6['offset'];var _0x12f43a=_0xa1474e?_0x7b1647[_0x1459('0x1e')]:_0x3857a6[_0x1459('0x1b')]+_0x3857a6[_0x1459('0x1d')];var _0x2e5d9c;if(_0x12f43a>=_0x3385e6){_0x12f43a=_0x3385e6;_0x2e5d9c=0xc8;}else{_0x2e5d9c=0xce;}_0x4237b2[_0x1459('0x19')](_0x2e5d9c);return _0x4237b2['set'](_0x1459('0x1f'),_0x3233ab+'-'+_0x12f43a+'/'+_0x3385e6)[_0x1459('0x1a')](_0x7b1647);}return null;};}function patchUpdates(_0x4c4cd7){return function(_0x20187e){try{jsonpatch[_0x1459('0x20')](_0x20187e,_0x4c4cd7,!![]);}catch(_0x479019){return BPromise['reject'](_0x479019);}return _0x20187e[_0x1459('0x21')]();};}function saveUpdates(_0x2424e1,_0x14179b){return function(_0xbd6f2a){if(_0xbd6f2a){return _0xbd6f2a[_0x1459('0x22')](_0x2424e1)[_0x1459('0x23')](function(_0x5e196e){return _0x5e196e;});}return null;};}function removeEntity(_0x20c113,_0x62fd9c){return function(_0x4bb449){if(_0x4bb449){return _0x4bb449['destroy']()[_0x1459('0x23')](function(){_0x20c113[_0x1459('0x19')](0xcc)[_0x1459('0x24')]();});}};}function handleEntityNotFound(_0x289e5f,_0x444513){return function(_0x54f869){if(!_0x54f869){_0x289e5f['sendStatus'](0x194);}return _0x54f869;};}function handleError(_0x183c45,_0x14e6cb){_0x14e6cb=_0x14e6cb||0x1f4;return function(_0x3dc97f){logger[_0x1459('0x25')](_0x3dc97f[_0x1459('0x26')]);if(_0x3dc97f[_0x1459('0x27')]){delete _0x3dc97f['name'];}_0x183c45[_0x1459('0x19')](_0x14e6cb)['send'](_0x3dc97f);};}exports['index']=function(_0x719b5,_0x56e9c6){var _0x440b33={},_0x62973d={},_0xd05f89={'count':0x0,'rows':[]};var _0x4ccd51=_['map'](db['Migration'][_0x1459('0x28')],function(_0x418eed){return{'name':_0x418eed[_0x1459('0x29')],'type':_0x418eed[_0x1459('0x2a')][_0x1459('0x2b')]};});_0x62973d[_0x1459('0x2c')]=_[_0x1459('0x2d')](_0x4ccd51,_0x1459('0x27'));_0x62973d['query']=_[_0x1459('0x2e')](_0x719b5['query']);_0x62973d[_0x1459('0x2f')]=_[_0x1459('0x30')](_0x62973d[_0x1459('0x2c')],_0x62973d[_0x1459('0x31')]);_0x440b33['attributes']=_[_0x1459('0x30')](_0x62973d[_0x1459('0x2c')],qs['fields'](_0x719b5[_0x1459('0x31')][_0x1459('0x32')]));_0x440b33[_0x1459('0x33')]=_0x440b33[_0x1459('0x33')][_0x1459('0x34')]?_0x440b33['attributes']:_0x62973d[_0x1459('0x2c')];if(!_0x719b5['query'][_0x1459('0x35')](_0x1459('0x36'))){_0x440b33[_0x1459('0x1d')]=qs[_0x1459('0x1d')](_0x719b5[_0x1459('0x31')]['limit']);_0x440b33[_0x1459('0x1b')]=qs['offset'](_0x719b5[_0x1459('0x31')][_0x1459('0x1b')]);}_0x440b33[_0x1459('0x37')]=qs['sort'](_0x719b5[_0x1459('0x31')]['sort']);_0x440b33[_0x1459('0x38')]=qs[_0x1459('0x2f')](_[_0x1459('0x39')](_0x719b5[_0x1459('0x31')],_0x62973d[_0x1459('0x2f')]),_0x4ccd51);if(_0x719b5['query']['filter']){_0x440b33[_0x1459('0x38')]=_[_0x1459('0x3a')](_0x440b33[_0x1459('0x38')],{'$or':_[_0x1459('0x2d')](_0x4ccd51,function(_0x3cfd60){if(_0x3cfd60['type']!==_0x1459('0x3b')){var _0x288355={};_0x288355[_0x3cfd60[_0x1459('0x27')]]={'$like':'%'+_0x719b5[_0x1459('0x31')]['filter']+'%'};return _0x288355;}})});}_0x440b33=_[_0x1459('0x3a')]({},_0x440b33,_0x719b5[_0x1459('0x3c')]);var _0x14d5ff={'where':_0x440b33['where']};return db['Migration'][_0x1459('0x1e')](_0x14d5ff)[_0x1459('0x23')](function(_0x5bdbee){_0xd05f89['count']=_0x5bdbee;if(_0x719b5[_0x1459('0x31')]['includeAll']){_0x440b33[_0x1459('0x3d')]=[{'all':!![]}];}return db[_0x1459('0x3e')][_0x1459('0x3f')](_0x440b33);})['then'](function(_0x3da259){_0xd05f89[_0x1459('0x40')]=_0x3da259;return _0xd05f89;})[_0x1459('0x23')](respondWithFilteredResult(_0x56e9c6,_0x440b33))[_0x1459('0x41')](handleError(_0x56e9c6,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index e66d45a..faa8628 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 _0x17e9=['request-promise','path','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment'];(function(_0x4f19ed,_0xc1a35d){var _0x29ed4a=function(_0x592f43){while(--_0x592f43){_0x4f19ed['push'](_0x4f19ed['shift']());}};_0x29ed4a(++_0xc1a35d);}(_0x17e9,0x15a));var _0x917e=function(_0x464d61,_0xaf87e2){_0x464d61=_0x464d61-0x0;var _0x31daa9=_0x17e9[_0x464d61];return _0x31daa9;};'use strict';var _=require(_0x917e('0x0'));var util=require(_0x917e('0x1'));var logger=require(_0x917e('0x2'))(_0x917e('0x3'));var moment=require(_0x917e('0x4'));var BPromise=require('bluebird');var rp=require(_0x917e('0x5'));var fs=require('fs');var path=require(_0x917e('0x6'));var rimraf=require('rimraf');var config=require(_0x917e('0x7'));var attributes=require(_0x917e('0x8'));module[_0x917e('0x9')]=function(_0x49327e,_0x398f7e){return _0x49327e[_0x917e('0xa')](_0x917e('0xb'),attributes,{'tableName':_0x917e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e40=['request-promise','path','./migration.attributes','define','lodash','util','api','moment','bluebird'];(function(_0x368787,_0x29d74f){var _0x545265=function(_0x35b1d1){while(--_0x35b1d1){_0x368787['push'](_0x368787['shift']());}};_0x545265(++_0x29d74f);}(_0x9e40,0x124));var _0x09e4=function(_0x357de2,_0x168f76){_0x357de2=_0x357de2-0x0;var _0x329326=_0x9e40[_0x357de2];return _0x329326;};'use strict';var _=require(_0x09e4('0x0'));var util=require(_0x09e4('0x1'));var logger=require('../../config/logger')(_0x09e4('0x2'));var moment=require(_0x09e4('0x3'));var BPromise=require(_0x09e4('0x4'));var rp=require(_0x09e4('0x5'));var fs=require('fs');var path=require(_0x09e4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x09e4('0x7'));module['exports']=function(_0x12ff6b,_0x3d18a7){return _0x12ff6b[_0x09e4('0x8')]('Migration',attributes,{'tableName':'migrations','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 ada2f89..3f31211 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 _0x4517=['info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x158cbf,_0x4c892e){var _0x16be5b=function(_0xa1af07){while(--_0xa1af07){_0x158cbf['push'](_0x158cbf['shift']());}};_0x16be5b(++_0x4c892e);}(_0x4517,0x112));var _0x7451=function(_0x125512,_0x10f365){_0x125512=_0x125512-0x0;var _0x1c4ddf=_0x4517[_0x125512];return _0x1c4ddf;};'use strict';var _=require('lodash');var util=require(_0x7451('0x0'));var moment=require(_0x7451('0x1'));var BPromise=require('bluebird');var rs=require(_0x7451('0x2'));var fs=require('fs');var Redis=require(_0x7451('0x3'));var db=require(_0x7451('0x4'))['db'];var utils=require(_0x7451('0x5'));var logger=require(_0x7451('0x6'))(_0x7451('0x7'));var config=require(_0x7451('0x8'));var jayson=require(_0x7451('0x9'));var client=jayson[_0x7451('0xa')][_0x7451('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ac271,_0x1bfc08,_0x26306e){return new BPromise(function(_0x443b80,_0x2c2ace){return client[_0x7451('0xc')](_0x3ac271,_0x26306e)[_0x7451('0xd')](function(_0x4b7888){logger[_0x7451('0xe')](_0x7451('0xf'),_0x1bfc08,_0x7451('0x10'));logger[_0x7451('0x11')](_0x7451('0x12'),_0x1bfc08,_0x7451('0x10'),JSON[_0x7451('0x13')](_0x4b7888));if(_0x4b7888['error']){if(_0x4b7888['error'][_0x7451('0x14')]===0x1f4){logger['error'](_0x7451('0xf'),_0x1bfc08,_0x4b7888[_0x7451('0x15')]['message']);return _0x2c2ace(_0x4b7888[_0x7451('0x15')][_0x7451('0x16')]);}logger['error'](_0x7451('0xf'),_0x1bfc08,_0x4b7888[_0x7451('0x15')][_0x7451('0x16')]);return _0x443b80(_0x4b7888[_0x7451('0x15')]['message']);}else{logger[_0x7451('0xe')](_0x7451('0xf'),_0x1bfc08,_0x7451('0x10'));_0x443b80(_0x4b7888['result']['message']);}})[_0x7451('0x17')](function(_0x1db688){logger[_0x7451('0x15')](_0x7451('0xf'),_0x1bfc08,_0x1db688);_0x2c2ace(_0x1db688);});});} \ No newline at end of file +var _0xbd99=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbd99,0x1df));var _0x9bd9=function(_0x3a0692,_0x1e59ff){_0x3a0692=_0x3a0692-0x0;var _0x5cb6e3=_0xbd99[_0x3a0692];return _0x5cb6e3;};'use strict';var _=require(_0x9bd9('0x0'));var util=require(_0x9bd9('0x1'));var moment=require('moment');var BPromise=require(_0x9bd9('0x2'));var rs=require(_0x9bd9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bd9('0x4'))['db'];var utils=require(_0x9bd9('0x5'));var logger=require(_0x9bd9('0x6'))(_0x9bd9('0x7'));var config=require(_0x9bd9('0x8'));var jayson=require(_0x9bd9('0x9'));var client=jayson[_0x9bd9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b41ea,_0x241303,_0x28b83f){return new BPromise(function(_0x7ddd62,_0x441225){return client[_0x9bd9('0xb')](_0x3b41ea,_0x28b83f)['then'](function(_0x865dc1){logger['info'](_0x9bd9('0xc'),_0x241303,_0x9bd9('0xd'));logger[_0x9bd9('0xe')](_0x9bd9('0xf'),_0x241303,_0x9bd9('0xd'),JSON[_0x9bd9('0x10')](_0x865dc1));if(_0x865dc1[_0x9bd9('0x11')]){if(_0x865dc1['error'][_0x9bd9('0x12')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x241303,_0x865dc1[_0x9bd9('0x11')]['message']);return _0x441225(_0x865dc1[_0x9bd9('0x11')][_0x9bd9('0x13')]);}logger[_0x9bd9('0x11')]('Migration,\x20%s,\x20%s',_0x241303,_0x865dc1[_0x9bd9('0x11')]['message']);return _0x7ddd62(_0x865dc1[_0x9bd9('0x11')][_0x9bd9('0x13')]);}else{logger['info'](_0x9bd9('0xc'),_0x241303,_0x9bd9('0xd'));_0x7ddd62(_0x865dc1[_0x9bd9('0x14')][_0x9bd9('0x13')]);}})['catch'](function(_0x57ffcb){logger[_0x9bd9('0x11')](_0x9bd9('0xc'),_0x241303,_0x57ffcb);_0x441225(_0x57ffcb);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 7210266..5bb2022 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 _0xf954=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./network.controller','get','isAuthenticated','/:id','show','create','put','destroy','exports','multer','util'];(function(_0x3f0b09,_0x4f390a){var _0x4b42be=function(_0x5ab50f){while(--_0x5ab50f){_0x3f0b09['push'](_0x3f0b09['shift']());}};_0x4b42be(++_0x4f390a);}(_0xf954,0x10e));var _0x4f95=function(_0x666cc6,_0x53441b){_0x666cc6=_0x666cc6-0x0;var _0x4e6d1d=_0xf954[_0x666cc6];return _0x4e6d1d;};'use strict';var multer=require(_0x4f95('0x0'));var util=require(_0x4f95('0x1'));var path=require(_0x4f95('0x2'));var timeout=require(_0x4f95('0x3'));var express=require(_0x4f95('0x4'));var router=express[_0x4f95('0x5')]();var fs_extra=require(_0x4f95('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4f95('0x7'));var controller=require(_0x4f95('0x8'));router[_0x4f95('0x9')]('/',auth[_0x4f95('0xa')](),controller['index']);router[_0x4f95('0x9')](_0x4f95('0xb'),auth[_0x4f95('0xa')](),controller[_0x4f95('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4f95('0xd')]);router[_0x4f95('0xe')](_0x4f95('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4f95('0xb'),auth[_0x4f95('0xa')](),controller[_0x4f95('0xf')]);module[_0x4f95('0x10')]=router; \ No newline at end of file +var _0x42ec=['isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x42ec,0x1e8));var _0xc42e=function(_0x7f7bd2,_0x4de695){_0x7f7bd2=_0x7f7bd2-0x0;var _0x3247d5=_0x42ec[_0x7f7bd2];return _0x3247d5;};'use strict';var multer=require(_0xc42e('0x0'));var util=require(_0xc42e('0x1'));var path=require(_0xc42e('0x2'));var timeout=require(_0xc42e('0x3'));var express=require(_0xc42e('0x4'));var router=express['Router']();var fs_extra=require(_0xc42e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc42e('0x6'));var config=require(_0xc42e('0x7'));var controller=require(_0xc42e('0x8'));router[_0xc42e('0x9')]('/',auth['isAuthenticated'](),controller[_0xc42e('0xa')]);router['get'](_0xc42e('0xb'),auth[_0xc42e('0xc')](),controller['show']);router[_0xc42e('0xd')]('/',auth[_0xc42e('0xc')](),controller[_0xc42e('0xe')]);router[_0xc42e('0xf')]('/:id',auth[_0xc42e('0xc')](),controller[_0xc42e('0x10')]);router[_0xc42e('0x11')]('/:id',auth[_0xc42e('0xc')](),controller[_0xc42e('0x12')]);module[_0xc42e('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 99d9b85..025c6e4 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 _0x5c4c=['localnet','externip','stun','turn','STRING','sequelize','exports','ENUM'];(function(_0x4f2bcc,_0x1464bf){var _0xe76823=function(_0x437969){while(--_0x437969){_0x4f2bcc['push'](_0x4f2bcc['shift']());}};_0xe76823(++_0x1464bf);}(_0x5c4c,0x1dd));var _0xc5c4=function(_0x2defca,_0x2dbbda){_0x2defca=_0x2defca-0x0;var _0x380265=_0x5c4c[_0x2defca];return _0x380265;};'use strict';var Sequelize=require(_0xc5c4('0x0'));module[_0xc5c4('0x1')]={'type':{'type':Sequelize[_0xc5c4('0x2')](_0xc5c4('0x3'),_0xc5c4('0x4'),_0xc5c4('0x5'),_0xc5c4('0x6'))},'value':{'type':Sequelize[_0xc5c4('0x7')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc5c4('0x7')]}}; \ No newline at end of file +var _0xed2a=['STRING','sequelize','exports','ENUM','localnet','stun','turn'];(function(_0x843f73,_0x3549e1){var _0x368b65=function(_0x56adbd){while(--_0x56adbd){_0x843f73['push'](_0x843f73['shift']());}};_0x368b65(++_0x3549e1);}(_0xed2a,0xb0));var _0xaed2=function(_0x304d18,_0x52b0ad){_0x304d18=_0x304d18-0x0;var _0x28f662=_0xed2a[_0x304d18];return _0x28f662;};'use strict';var Sequelize=require(_0xaed2('0x0'));module[_0xaed2('0x1')]={'type':{'type':Sequelize[_0xaed2('0x2')](_0xaed2('0x3'),'externip',_0xaed2('0x4'),_0xaed2('0x5'))},'value':{'type':Sequelize[_0xaed2('0x6')]},'username':{'type':Sequelize[_0xaed2('0x6')]},'password':{'type':Sequelize[_0xaed2('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index d2c81ce..b3e7afb 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 _0x608c=['join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/stun_multiple.ejs','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','TURN','chan_sip.so','util','path','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','find','create','body','findAll','toUpperCase','STUN','readFileSync'];(function(_0x1f2bd6,_0x27f184){var _0x492ce8=function(_0x18fc1b){while(--_0x18fc1b){_0x1f2bd6['push'](_0x1f2bd6['shift']());}};_0x492ce8(++_0x27f184);}(_0x608c,0x179));var _0xc608=function(_0x5da75a,_0x588bc4){_0x5da75a=_0x5da75a-0x0;var _0x3a5efe=_0x608c[_0x5da75a];return _0x3a5efe;};'use strict';var util=require(_0xc608('0x0'));var path=require(_0xc608('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc608('0x2'));var qs=require(_0xc608('0x3'));var logger=require(_0xc608('0x4'))(_0xc608('0x5'));var config=require(_0xc608('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0xc608('0x7'));var client=jayson[_0xc608('0x8')][_0xc608('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb80533,_0x9f293f,_0x6a9455,_0x4a9c93){return new Promise(function(_0x5cf94a,_0xcd73ca){var _0x3777ba=_0x4a9c93||client;return _0x3777ba[_0xc608('0xa')](_0xb80533,_0x6a9455)[_0xc608('0xb')](function(_0x5bac3e){logger[_0xc608('0xc')](_0xc608('0xd'),_0x9f293f,_0xc608('0xe'));logger[_0xc608('0xf')](_0xc608('0x10'),_0x9f293f,_0xc608('0xe'),JSON[_0xc608('0x11')](_0x5bac3e));if(_0x5bac3e[_0xc608('0x12')]){if(_0x5bac3e[_0xc608('0x12')][_0xc608('0x13')]===0x1f4){logger[_0xc608('0x12')](_0xc608('0xd'),_0x9f293f,_0x5bac3e[_0xc608('0x12')]['message']);return _0xcd73ca(_0x5bac3e[_0xc608('0x12')][_0xc608('0x14')]);}logger[_0xc608('0x12')](_0xc608('0xd'),_0x9f293f,_0x5bac3e[_0xc608('0x12')][_0xc608('0x14')]);return _0x5cf94a(_0x5bac3e[_0xc608('0x12')][_0xc608('0x14')]);}else{logger[_0xc608('0xc')](_0xc608('0xd'),_0x9f293f,_0xc608('0xe'));_0x5cf94a(_0x5bac3e[_0xc608('0x15')][_0xc608('0x14')]);}})['catch'](function(_0xd90b62){logger[_0xc608('0x12')](_0xc608('0xd'),_0x9f293f,_0xd90b62);_0xcd73ca(_0xd90b62);});});}function respondWithResult(_0xbf53cd,_0xd905eb){_0xd905eb=_0xd905eb||0xc8;return function(_0x304c8d){if(_0x304c8d){return _0xbf53cd[_0xc608('0x16')](_0xd905eb)['json'](_0x304c8d);}};}function respondWithFilteredResult(_0x11afc6,_0xa7250c){return function(_0x1106bc){if(_0x1106bc){var _0x2db862=typeof _0xa7250c[_0xc608('0x17')]===_0xc608('0x18')&&typeof _0xa7250c[_0xc608('0x19')]===_0xc608('0x18');var _0x70570c=_0x1106bc[_0xc608('0x1a')];var _0x4e53b6=_0x2db862?0x0:_0xa7250c[_0xc608('0x17')];var _0x10eebd=_0x2db862?_0x1106bc['count']:_0xa7250c['offset']+_0xa7250c[_0xc608('0x19')];var _0x354632;if(_0x10eebd>=_0x70570c){_0x10eebd=_0x70570c;_0x354632=0xc8;}else{_0x354632=0xce;}_0x11afc6[_0xc608('0x16')](_0x354632);return _0x11afc6[_0xc608('0x1b')](_0xc608('0x1c'),_0x4e53b6+'-'+_0x10eebd+'/'+_0x70570c)[_0xc608('0x1d')](_0x1106bc);}return null;};}function saveUpdates(_0x2f0c07){return function(_0x8fc7db){if(_0x8fc7db){return _0x8fc7db[_0xc608('0x1e')](_0x2f0c07)[_0xc608('0xb')](function(_0x2da5ed){return _0x2da5ed;});}return null;};}function removeEntity(_0x254e4c){return function(_0x3a2c5a){if(_0x3a2c5a){return _0x3a2c5a[_0xc608('0x1f')]()[_0xc608('0xb')](function(){_0x254e4c[_0xc608('0x16')](0xcc)[_0xc608('0x20')]();});}};}function handleEntityNotFound(_0x1f06a9){return function(_0x255074){if(!_0x255074){_0x1f06a9[_0xc608('0x21')](0x194);}return _0x255074;};}function handleError(_0xc63fd5,_0x4acf45){_0x4acf45=_0x4acf45||0x1f4;return function(_0x5de4b5){logger[_0xc608('0x12')](_0x5de4b5[_0xc608('0x22')]);if(_0x5de4b5[_0xc608('0x23')]){delete _0x5de4b5[_0xc608('0x23')];}_0xc63fd5[_0xc608('0x16')](_0x4acf45)[_0xc608('0x24')](_0x5de4b5);};}exports[_0xc608('0x25')]=function(_0x5332c8,_0x486293){var _0x3b0f61={},_0x4e4b7c={},_0x52185f={'count':0x0,'rows':[]};var _0x1a5ad5=_[_0xc608('0x26')](db[_0xc608('0x27')][_0xc608('0x28')],function(_0x405835){return{'name':_0x405835[_0xc608('0x29')],'type':_0x405835[_0xc608('0x2a')]['key']};});_0x4e4b7c['model']=_[_0xc608('0x26')](_0x1a5ad5,_0xc608('0x23'));_0x4e4b7c[_0xc608('0x2b')]=_[_0xc608('0x2c')](_0x5332c8[_0xc608('0x2b')]);_0x4e4b7c[_0xc608('0x2d')]=_[_0xc608('0x2e')](_0x4e4b7c[_0xc608('0x2f')],_0x4e4b7c[_0xc608('0x2b')]);_0x3b0f61[_0xc608('0x30')]=_[_0xc608('0x2e')](_0x4e4b7c[_0xc608('0x2f')],qs['fields'](_0x5332c8[_0xc608('0x2b')]['fields']));_0x3b0f61[_0xc608('0x30')]=_0x3b0f61[_0xc608('0x30')][_0xc608('0x31')]?_0x3b0f61[_0xc608('0x30')]:_0x4e4b7c[_0xc608('0x2f')];if(!_0x5332c8['query']['hasOwnProperty'](_0xc608('0x32'))){_0x3b0f61[_0xc608('0x19')]=qs[_0xc608('0x19')](_0x5332c8[_0xc608('0x2b')][_0xc608('0x19')]);_0x3b0f61[_0xc608('0x17')]=qs[_0xc608('0x17')](_0x5332c8[_0xc608('0x2b')][_0xc608('0x17')]);}_0x3b0f61[_0xc608('0x33')]=qs[_0xc608('0x34')](_0x5332c8[_0xc608('0x2b')]['sort']);_0x3b0f61[_0xc608('0x35')]=qs[_0xc608('0x2d')](_[_0xc608('0x36')](_0x5332c8[_0xc608('0x2b')],_0x4e4b7c['filters']),_0x1a5ad5);if(_0x5332c8[_0xc608('0x2b')][_0xc608('0x37')]){_0x3b0f61[_0xc608('0x35')]=_[_0xc608('0x38')](_0x3b0f61[_0xc608('0x35')],{'$or':_[_0xc608('0x26')](_0x1a5ad5,function(_0x1d067e){if(_0x1d067e[_0xc608('0x2a')]!==_0xc608('0x39')){var _0x402e56={};_0x402e56[_0x1d067e[_0xc608('0x23')]]={'$like':'%'+_0x5332c8[_0xc608('0x2b')][_0xc608('0x37')]+'%'};return _0x402e56;}})});}_0x3b0f61=_[_0xc608('0x38')]({},_0x3b0f61,_0x5332c8[_0xc608('0x3a')]);var _0x4ce173={'where':_0x3b0f61[_0xc608('0x35')]};return db[_0xc608('0x27')][_0xc608('0x1a')](_0x4ce173)[_0xc608('0xb')](function(_0x499a13){_0x52185f['count']=_0x499a13;if(_0x5332c8[_0xc608('0x2b')][_0xc608('0x3b')]){_0x3b0f61[_0xc608('0x3c')]=[{'all':!![]}];}return db[_0xc608('0x27')]['findAll'](_0x3b0f61);})['then'](function(_0x13f441){_0x52185f[_0xc608('0x3d')]=_0x13f441;return _0x52185f;})['then'](respondWithFilteredResult(_0x486293,_0x3b0f61))[_0xc608('0x3e')](handleError(_0x486293,null));};exports[_0xc608('0x3f')]=function(_0x89b9d,_0x3c53bb){var _0xfb7989={'raw':!![],'where':{'id':_0x89b9d[_0xc608('0x40')]['id']}},_0x5e3893={};_0x5e3893[_0xc608('0x2f')]=_[_0xc608('0x2c')](db['Network'][_0xc608('0x28')]);_0x5e3893[_0xc608('0x2b')]=_[_0xc608('0x2c')](_0x89b9d[_0xc608('0x2b')]);_0x5e3893[_0xc608('0x2d')]=_[_0xc608('0x2e')](_0x5e3893['model'],_0x5e3893[_0xc608('0x2b')]);_0xfb7989[_0xc608('0x30')]=_['intersection'](_0x5e3893[_0xc608('0x2f')],qs[_0xc608('0x41')](_0x89b9d[_0xc608('0x2b')][_0xc608('0x41')]));_0xfb7989[_0xc608('0x30')]=_0xfb7989[_0xc608('0x30')][_0xc608('0x31')]?_0xfb7989[_0xc608('0x30')]:_0x5e3893[_0xc608('0x2f')];if(_0x89b9d['query'][_0xc608('0x3b')]){_0xfb7989[_0xc608('0x3c')]=[{'all':!![]}];}_0xfb7989=_['merge']({},_0xfb7989,_0x89b9d[_0xc608('0x3a')]);return db[_0xc608('0x27')][_0xc608('0x42')](_0xfb7989)[_0xc608('0xb')](handleEntityNotFound(_0x3c53bb,null))[_0xc608('0xb')](respondWithResult(_0x3c53bb,null))[_0xc608('0x3e')](handleError(_0x3c53bb,null));};exports['create']=function(_0x9f08c3,_0x32b781){var _0x11b62c;return db[_0xc608('0x27')][_0xc608('0x43')](_0x9f08c3[_0xc608('0x44')],{'raw':!![]})[_0xc608('0xb')](function(_0x465c19){_0x11b62c=_0x465c19;return db[_0xc608('0x27')][_0xc608('0x45')]({'where':{'type':_0x9f08c3[_0xc608('0x44')]['type']},'raw':!![]});})['then'](function(_0x3ee9f4){if(_0x11b62c[_0xc608('0x2a')][_0xc608('0x46')]()==_0xc608('0x47')){var _0x38c8ac=fs[_0xc608('0x48')](path[_0xc608('0x49')](config[_0xc608('0x4a')],'server/files/templates/stun_multiple.ejs'),_0xc608('0x4b'));var _0x532b9d=ejs[_0xc608('0x4c')](_0x38c8ac,{'networks':_0x3ee9f4||[]});fs[_0xc608('0x4d')](_0xc608('0x4e'),_0x532b9d);return respondWithRpcPromise(_0xc608('0x4f'),_0xc608('0x43'),{'module':_0xc608('0x50')});}else if(_0x11b62c[_0xc608('0x2a')][_0xc608('0x46')]()=='TURN'){var _0x1efcf1=fs[_0xc608('0x48')](path[_0xc608('0x49')](config[_0xc608('0x4a')],_0xc608('0x51')),_0xc608('0x4b'));var _0x11cc25=ejs[_0xc608('0x4c')](_0x1efcf1,{'networks':_0x3ee9f4||[]});fs[_0xc608('0x4d')](_0xc608('0x52'),_0x11cc25);return respondWithRpcPromise(_0xc608('0x4f'),_0xc608('0x43'),{'module':_0xc608('0x50')});}else{var _0x4033fc=fs['readFileSync'](path[_0xc608('0x49')](config[_0xc608('0x4a')],'server/files/templates/network.ejs'),_0xc608('0x4b'));var _0x593634=ejs[_0xc608('0x4c')](_0x4033fc,{'networks':_0x3ee9f4||[]});fs[_0xc608('0x4d')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x9f08c3['body'][_0xc608('0x2a')]['toLowerCase']()),_0x593634);return respondWithRpcPromise(_0xc608('0x4f'),_0xc608('0x43'),{'module':'chan_sip.so'});}})[_0xc608('0xb')](function(){return _0x11b62c;})[_0xc608('0xb')](respondWithResult(_0x32b781,0xc9))['catch'](handleError(_0x32b781,null));};exports['update']=function(_0x1c5b58,_0x1bcba0){var _0x185569;return db[_0xc608('0x27')][_0xc608('0x42')]({'where':{'id':_0x1c5b58[_0xc608('0x40')]['id']}})['then'](handleEntityNotFound(_0x1bcba0,null))[_0xc608('0xb')](saveUpdates(_0x1c5b58[_0xc608('0x44')],null))[_0xc608('0xb')](function(_0x58e0a2){if(_0x58e0a2){_0x185569=_0x58e0a2;return db[_0xc608('0x27')][_0xc608('0x45')]({'where':{'type':_0x185569[_0xc608('0x2a')]},'raw':!![]});}return null;})[_0xc608('0xb')](function(_0x15d899){if(_0x185569[_0xc608('0x2a')][_0xc608('0x46')]()==_0xc608('0x47')){var _0x2d3b2f=fs['readFileSync'](path[_0xc608('0x49')](config[_0xc608('0x4a')],_0xc608('0x53')),_0xc608('0x4b'));var _0x2d786b=ejs[_0xc608('0x4c')](_0x2d3b2f,{'networks':_0x15d899||[]});fs[_0xc608('0x4d')](_0xc608('0x4e'),_0x2d786b);return respondWithRpcPromise(_0xc608('0x4f'),_0xc608('0x1e'),{'module':'res_stun_monitor.so'});}else if(_0x185569['type']['toUpperCase']()=='TURN'){var _0x262981=fs[_0xc608('0x48')](path[_0xc608('0x49')](config[_0xc608('0x4a')],_0xc608('0x51')),'utf8');var _0x17b2ea=ejs[_0xc608('0x4c')](_0x262981,{'networks':_0x15d899||[]});fs[_0xc608('0x4d')](_0xc608('0x52'),_0x17b2ea);return respondWithRpcPromise('Reload',_0xc608('0x1e'),{'module':_0xc608('0x50')});}else{var _0x50f21e=fs[_0xc608('0x48')](path[_0xc608('0x49')](config[_0xc608('0x4a')],_0xc608('0x54')),_0xc608('0x4b'));var _0x21f3fb=ejs[_0xc608('0x4c')](_0x50f21e,{'networks':_0x15d899||[]});fs['writeFileSync'](util[_0xc608('0x55')](_0xc608('0x56'),_0x1c5b58['body'][_0xc608('0x2a')][_0xc608('0x57')]()),_0x21f3fb);return respondWithRpcPromise(_0xc608('0x4f'),_0xc608('0x1e'),{'module':'chan_sip.so'});}})[_0xc608('0xb')](function(_0xd3084a){if(_0xd3084a){return _0x185569;}return null;})[_0xc608('0xb')](respondWithResult(_0x1bcba0,null))[_0xc608('0x3e')](handleError(_0x1bcba0,null));};exports[_0xc608('0x1f')]=function(_0x514f72,_0x474b3d){var _0x1bee0d;return db['Network'][_0xc608('0x42')]({'where':{'id':_0x514f72['params']['id']}})[_0xc608('0xb')](function(_0x2562c0){_0x1bee0d=_0x2562c0;return _0x2562c0;})[_0xc608('0xb')](handleEntityNotFound(_0x474b3d,null))['then'](removeEntity(_0x474b3d,null))[_0xc608('0xb')](function(){if(_0x1bee0d){return db[_0xc608('0x27')][_0xc608('0x45')]({'where':{'type':_0x1bee0d[_0xc608('0x2a')]},'raw':!![]});}})[_0xc608('0xb')](function(_0x5be195){if(_0x1bee0d[_0xc608('0x2a')][_0xc608('0x46')]()==_0xc608('0x47')){var _0x1ace4d=fs[_0xc608('0x48')](path[_0xc608('0x49')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xc608('0x4b'));var _0x37edde=ejs[_0xc608('0x4c')](_0x1ace4d,{'networks':_0x5be195||[]});fs[_0xc608('0x4d')](_0xc608('0x4e'),_0x37edde);return respondWithRpcPromise(_0xc608('0x4f'),_0xc608('0x1f'),{'module':'res_stun_monitor.so'});}else if(_0x1bee0d[_0xc608('0x2a')][_0xc608('0x46')]()==_0xc608('0x58')){var _0xcd92d6=fs[_0xc608('0x48')](path[_0xc608('0x49')](config['root'],_0xc608('0x51')),'utf8');var _0x1e9b83=ejs[_0xc608('0x4c')](_0xcd92d6,{'networks':_0x5be195||[]});fs['writeFileSync'](_0xc608('0x52'),_0x1e9b83);return respondWithRpcPromise(_0xc608('0x4f'),_0xc608('0x1f'),{'module':_0xc608('0x50')});}else{var _0xeb1b1d=fs[_0xc608('0x48')](path['join'](config[_0xc608('0x4a')],_0xc608('0x54')),_0xc608('0x4b'));var _0x12ac12=ejs['render'](_0xeb1b1d,{'networks':_0x5be195||[]});fs[_0xc608('0x4d')](util[_0xc608('0x55')](_0xc608('0x56'),_0x1bee0d[_0xc608('0x2a')][_0xc608('0x57')]()),_0x12ac12);return respondWithRpcPromise(_0xc608('0x4f'),_0xc608('0x1f'),{'module':_0xc608('0x59')});}})['catch'](handleError(_0x474b3d,null));}; \ No newline at end of file +var _0x6eb7=['model','name','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','Network','includeAll','include','findAll','rows','show','params','keys','intersection','find','create','body','toUpperCase','STUN','join','server/files/templates/stun_multiple.ejs','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','readFileSync','root','server/files/templates/turn_multiple.ejs','utf8','render','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','TURN','/etc/asterisk/turn_xcally.conf','util','path','ejs','lodash','../../config/logger','api','../../config/environment','jayson/promise','client','http','then','Network,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','status','json','offset','undefined','limit','count','set','destroy','end','send','index','map','rawAttributes','fieldName','key'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x6eb7,0x87));var _0x76eb=function(_0x116359,_0x346111){_0x116359=_0x116359-0x0;var _0x4b4367=_0x6eb7[_0x116359];return _0x4b4367;};'use strict';var util=require(_0x76eb('0x0'));var path=require(_0x76eb('0x1'));var ejs=require(_0x76eb('0x2'));var fs=require('fs');var _=require(_0x76eb('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x76eb('0x4'))(_0x76eb('0x5'));var config=require(_0x76eb('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0x76eb('0x7'));var client=jayson[_0x76eb('0x8')][_0x76eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fc3cf,_0x54eede,_0x2994ea,_0x1a450f){return new Promise(function(_0xb81a19,_0x1c1f6a){var _0x39e540=_0x1a450f||client;return _0x39e540['request'](_0x3fc3cf,_0x2994ea)[_0x76eb('0xa')](function(_0x4864d6){logger['info'](_0x76eb('0xb'),_0x54eede,_0x76eb('0xc'));logger[_0x76eb('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x54eede,_0x76eb('0xc'),JSON['stringify'](_0x4864d6));if(_0x4864d6[_0x76eb('0xe')]){if(_0x4864d6['error'][_0x76eb('0xf')]===0x1f4){logger['error'](_0x76eb('0xb'),_0x54eede,_0x4864d6[_0x76eb('0xe')][_0x76eb('0x10')]);return _0x1c1f6a(_0x4864d6['error'][_0x76eb('0x10')]);}logger[_0x76eb('0xe')]('Network,\x20%s,\x20%s',_0x54eede,_0x4864d6[_0x76eb('0xe')][_0x76eb('0x10')]);return _0xb81a19(_0x4864d6[_0x76eb('0xe')][_0x76eb('0x10')]);}else{logger[_0x76eb('0x11')](_0x76eb('0xb'),_0x54eede,'request\x20sent');_0xb81a19(_0x4864d6[_0x76eb('0x12')][_0x76eb('0x10')]);}})[_0x76eb('0x13')](function(_0x2e8f30){logger[_0x76eb('0xe')]('Network,\x20%s,\x20%s',_0x54eede,_0x2e8f30);_0x1c1f6a(_0x2e8f30);});});}function respondWithResult(_0x33107b,_0x28b764){_0x28b764=_0x28b764||0xc8;return function(_0x156600){if(_0x156600){return _0x33107b[_0x76eb('0x14')](_0x28b764)[_0x76eb('0x15')](_0x156600);}};}function respondWithFilteredResult(_0x139163,_0x3ed34d){return function(_0x503b52){if(_0x503b52){var _0x818a02=typeof _0x3ed34d[_0x76eb('0x16')]===_0x76eb('0x17')&&typeof _0x3ed34d[_0x76eb('0x18')]===_0x76eb('0x17');var _0xa447b5=_0x503b52[_0x76eb('0x19')];var _0x15c2de=_0x818a02?0x0:_0x3ed34d[_0x76eb('0x16')];var _0x4a463f=_0x818a02?_0x503b52['count']:_0x3ed34d['offset']+_0x3ed34d[_0x76eb('0x18')];var _0x3af428;if(_0x4a463f>=_0xa447b5){_0x4a463f=_0xa447b5;_0x3af428=0xc8;}else{_0x3af428=0xce;}_0x139163[_0x76eb('0x14')](_0x3af428);return _0x139163[_0x76eb('0x1a')]('Content-Range',_0x15c2de+'-'+_0x4a463f+'/'+_0xa447b5)[_0x76eb('0x15')](_0x503b52);}return null;};}function saveUpdates(_0x2af824){return function(_0x514156){if(_0x514156){return _0x514156['update'](_0x2af824)[_0x76eb('0xa')](function(_0x131d8d){return _0x131d8d;});}return null;};}function removeEntity(_0x263fbd){return function(_0x4ff3a0){if(_0x4ff3a0){return _0x4ff3a0[_0x76eb('0x1b')]()[_0x76eb('0xa')](function(){_0x263fbd[_0x76eb('0x14')](0xcc)[_0x76eb('0x1c')]();});}};}function handleEntityNotFound(_0x20bf48){return function(_0x237b2a){if(!_0x237b2a){_0x20bf48['sendStatus'](0x194);}return _0x237b2a;};}function handleError(_0x2788aa,_0x54f43c){_0x54f43c=_0x54f43c||0x1f4;return function(_0x427637){logger[_0x76eb('0xe')](_0x427637['stack']);if(_0x427637['name']){delete _0x427637['name'];}_0x2788aa[_0x76eb('0x14')](_0x54f43c)[_0x76eb('0x1d')](_0x427637);};}exports[_0x76eb('0x1e')]=function(_0x42c923,_0x48f9f6){var _0x58dda6={},_0x563642={},_0x4419fe={'count':0x0,'rows':[]};var _0x4365e4=_[_0x76eb('0x1f')](db['Network'][_0x76eb('0x20')],function(_0x443920){return{'name':_0x443920[_0x76eb('0x21')],'type':_0x443920['type'][_0x76eb('0x22')]};});_0x563642[_0x76eb('0x23')]=_[_0x76eb('0x1f')](_0x4365e4,_0x76eb('0x24'));_0x563642['query']=_['keys'](_0x42c923[_0x76eb('0x25')]);_0x563642[_0x76eb('0x26')]=_['intersection'](_0x563642[_0x76eb('0x23')],_0x563642[_0x76eb('0x25')]);_0x58dda6[_0x76eb('0x27')]=_['intersection'](_0x563642[_0x76eb('0x23')],qs['fields'](_0x42c923[_0x76eb('0x25')][_0x76eb('0x28')]));_0x58dda6[_0x76eb('0x27')]=_0x58dda6[_0x76eb('0x27')][_0x76eb('0x29')]?_0x58dda6[_0x76eb('0x27')]:_0x563642[_0x76eb('0x23')];if(!_0x42c923[_0x76eb('0x25')][_0x76eb('0x2a')](_0x76eb('0x2b'))){_0x58dda6['limit']=qs[_0x76eb('0x18')](_0x42c923[_0x76eb('0x25')]['limit']);_0x58dda6[_0x76eb('0x16')]=qs[_0x76eb('0x16')](_0x42c923[_0x76eb('0x25')][_0x76eb('0x16')]);}_0x58dda6[_0x76eb('0x2c')]=qs[_0x76eb('0x2d')](_0x42c923[_0x76eb('0x25')][_0x76eb('0x2d')]);_0x58dda6[_0x76eb('0x2e')]=qs[_0x76eb('0x26')](_[_0x76eb('0x2f')](_0x42c923[_0x76eb('0x25')],_0x563642[_0x76eb('0x26')]),_0x4365e4);if(_0x42c923[_0x76eb('0x25')]['filter']){_0x58dda6[_0x76eb('0x2e')]=_[_0x76eb('0x30')](_0x58dda6['where'],{'$or':_['map'](_0x4365e4,function(_0x246fd1){if(_0x246fd1[_0x76eb('0x31')]!==_0x76eb('0x32')){var _0xe39fa8={};_0xe39fa8[_0x246fd1['name']]={'$like':'%'+_0x42c923[_0x76eb('0x25')]['filter']+'%'};return _0xe39fa8;}})});}_0x58dda6=_[_0x76eb('0x30')]({},_0x58dda6,_0x42c923[_0x76eb('0x33')]);var _0x10789a={'where':_0x58dda6[_0x76eb('0x2e')]};return db[_0x76eb('0x34')][_0x76eb('0x19')](_0x10789a)[_0x76eb('0xa')](function(_0x5bd6ed){_0x4419fe['count']=_0x5bd6ed;if(_0x42c923[_0x76eb('0x25')][_0x76eb('0x35')]){_0x58dda6[_0x76eb('0x36')]=[{'all':!![]}];}return db[_0x76eb('0x34')][_0x76eb('0x37')](_0x58dda6);})[_0x76eb('0xa')](function(_0x4a1d0c){_0x4419fe[_0x76eb('0x38')]=_0x4a1d0c;return _0x4419fe;})[_0x76eb('0xa')](respondWithFilteredResult(_0x48f9f6,_0x58dda6))[_0x76eb('0x13')](handleError(_0x48f9f6,null));};exports[_0x76eb('0x39')]=function(_0x1a69e8,_0xae2298){var _0x577e11={'raw':!![],'where':{'id':_0x1a69e8[_0x76eb('0x3a')]['id']}},_0x366695={};_0x366695[_0x76eb('0x23')]=_['keys'](db[_0x76eb('0x34')]['rawAttributes']);_0x366695[_0x76eb('0x25')]=_[_0x76eb('0x3b')](_0x1a69e8[_0x76eb('0x25')]);_0x366695[_0x76eb('0x26')]=_[_0x76eb('0x3c')](_0x366695['model'],_0x366695[_0x76eb('0x25')]);_0x577e11[_0x76eb('0x27')]=_[_0x76eb('0x3c')](_0x366695[_0x76eb('0x23')],qs[_0x76eb('0x28')](_0x1a69e8['query'][_0x76eb('0x28')]));_0x577e11[_0x76eb('0x27')]=_0x577e11['attributes'][_0x76eb('0x29')]?_0x577e11[_0x76eb('0x27')]:_0x366695[_0x76eb('0x23')];if(_0x1a69e8[_0x76eb('0x25')][_0x76eb('0x35')]){_0x577e11['include']=[{'all':!![]}];}_0x577e11=_[_0x76eb('0x30')]({},_0x577e11,_0x1a69e8['options']);return db[_0x76eb('0x34')][_0x76eb('0x3d')](_0x577e11)[_0x76eb('0xa')](handleEntityNotFound(_0xae2298,null))[_0x76eb('0xa')](respondWithResult(_0xae2298,null))[_0x76eb('0x13')](handleError(_0xae2298,null));};exports[_0x76eb('0x3e')]=function(_0x3132cf,_0x4b1fb6){var _0x5e125d;return db[_0x76eb('0x34')][_0x76eb('0x3e')](_0x3132cf[_0x76eb('0x3f')],{'raw':!![]})['then'](function(_0x851c5a){_0x5e125d=_0x851c5a;return db[_0x76eb('0x34')][_0x76eb('0x37')]({'where':{'type':_0x3132cf[_0x76eb('0x3f')][_0x76eb('0x31')]},'raw':!![]});})['then'](function(_0x49148c){if(_0x5e125d[_0x76eb('0x31')][_0x76eb('0x40')]()==_0x76eb('0x41')){var _0x446514=fs['readFileSync'](path[_0x76eb('0x42')](config['root'],_0x76eb('0x43')),'utf8');var _0x56d230=ejs['render'](_0x446514,{'networks':_0x49148c||[]});fs[_0x76eb('0x44')](_0x76eb('0x45'),_0x56d230);return respondWithRpcPromise(_0x76eb('0x46'),_0x76eb('0x3e'),{'module':_0x76eb('0x47')});}else if(_0x5e125d['type'][_0x76eb('0x40')]()=='TURN'){var _0x310789=fs[_0x76eb('0x48')](path[_0x76eb('0x42')](config[_0x76eb('0x49')],_0x76eb('0x4a')),_0x76eb('0x4b'));var _0x26ad8c=ejs[_0x76eb('0x4c')](_0x310789,{'networks':_0x49148c||[]});fs[_0x76eb('0x44')]('/etc/asterisk/turn_xcally.conf',_0x26ad8c);return respondWithRpcPromise(_0x76eb('0x46'),_0x76eb('0x3e'),{'module':_0x76eb('0x47')});}else{var _0xff33da=fs[_0x76eb('0x48')](path[_0x76eb('0x42')](config[_0x76eb('0x49')],_0x76eb('0x4d')),_0x76eb('0x4b'));var _0x20ad2d=ejs[_0x76eb('0x4c')](_0xff33da,{'networks':_0x49148c||[]});fs[_0x76eb('0x44')](util[_0x76eb('0x4e')](_0x76eb('0x4f'),_0x3132cf[_0x76eb('0x3f')]['type'][_0x76eb('0x50')]()),_0x20ad2d);return respondWithRpcPromise('Reload','create',{'module':_0x76eb('0x51')});}})['then'](function(){return _0x5e125d;})['then'](respondWithResult(_0x4b1fb6,0xc9))[_0x76eb('0x13')](handleError(_0x4b1fb6,null));};exports[_0x76eb('0x52')]=function(_0x27496b,_0x3e899d){var _0x2721bb;return db[_0x76eb('0x34')]['find']({'where':{'id':_0x27496b[_0x76eb('0x3a')]['id']}})[_0x76eb('0xa')](handleEntityNotFound(_0x3e899d,null))[_0x76eb('0xa')](saveUpdates(_0x27496b[_0x76eb('0x3f')],null))[_0x76eb('0xa')](function(_0x51e37a){if(_0x51e37a){_0x2721bb=_0x51e37a;return db['Network'][_0x76eb('0x37')]({'where':{'type':_0x2721bb[_0x76eb('0x31')]},'raw':!![]});}return null;})[_0x76eb('0xa')](function(_0x4a5c03){if(_0x2721bb[_0x76eb('0x31')][_0x76eb('0x40')]()=='STUN'){var _0x453214=fs[_0x76eb('0x48')](path[_0x76eb('0x42')](config[_0x76eb('0x49')],'server/files/templates/stun_multiple.ejs'),_0x76eb('0x4b'));var _0x1270b0=ejs['render'](_0x453214,{'networks':_0x4a5c03||[]});fs[_0x76eb('0x44')]('/etc/asterisk/stun_xcally.conf',_0x1270b0);return respondWithRpcPromise(_0x76eb('0x46'),_0x76eb('0x52'),{'module':_0x76eb('0x47')});}else if(_0x2721bb['type']['toUpperCase']()==_0x76eb('0x53')){var _0xce2314=fs[_0x76eb('0x48')](path[_0x76eb('0x42')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x76eb('0x4b'));var _0x506783=ejs[_0x76eb('0x4c')](_0xce2314,{'networks':_0x4a5c03||[]});fs[_0x76eb('0x44')]('/etc/asterisk/turn_xcally.conf',_0x506783);return respondWithRpcPromise(_0x76eb('0x46'),_0x76eb('0x52'),{'module':_0x76eb('0x47')});}else{var _0xf89e3f=fs[_0x76eb('0x48')](path[_0x76eb('0x42')](config[_0x76eb('0x49')],_0x76eb('0x4d')),_0x76eb('0x4b'));var _0x14f6e3=ejs[_0x76eb('0x4c')](_0xf89e3f,{'networks':_0x4a5c03||[]});fs[_0x76eb('0x44')](util[_0x76eb('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0x27496b[_0x76eb('0x3f')][_0x76eb('0x31')][_0x76eb('0x50')]()),_0x14f6e3);return respondWithRpcPromise(_0x76eb('0x46'),_0x76eb('0x52'),{'module':_0x76eb('0x51')});}})['then'](function(_0x5e3df8){if(_0x5e3df8){return _0x2721bb;}return null;})[_0x76eb('0xa')](respondWithResult(_0x3e899d,null))[_0x76eb('0x13')](handleError(_0x3e899d,null));};exports['destroy']=function(_0xb946ed,_0x437956){var _0x212fc1;return db['Network']['find']({'where':{'id':_0xb946ed[_0x76eb('0x3a')]['id']}})['then'](function(_0xbfc4b3){_0x212fc1=_0xbfc4b3;return _0xbfc4b3;})[_0x76eb('0xa')](handleEntityNotFound(_0x437956,null))['then'](removeEntity(_0x437956,null))[_0x76eb('0xa')](function(){if(_0x212fc1){return db[_0x76eb('0x34')][_0x76eb('0x37')]({'where':{'type':_0x212fc1[_0x76eb('0x31')]},'raw':!![]});}})[_0x76eb('0xa')](function(_0x5c8443){if(_0x212fc1[_0x76eb('0x31')][_0x76eb('0x40')]()==_0x76eb('0x41')){var _0x5afb55=fs[_0x76eb('0x48')](path[_0x76eb('0x42')](config[_0x76eb('0x49')],_0x76eb('0x43')),_0x76eb('0x4b'));var _0x145717=ejs[_0x76eb('0x4c')](_0x5afb55,{'networks':_0x5c8443||[]});fs['writeFileSync'](_0x76eb('0x45'),_0x145717);return respondWithRpcPromise(_0x76eb('0x46'),_0x76eb('0x1b'),{'module':_0x76eb('0x47')});}else if(_0x212fc1[_0x76eb('0x31')][_0x76eb('0x40')]()=='TURN'){var _0x82cfdf=fs[_0x76eb('0x48')](path[_0x76eb('0x42')](config[_0x76eb('0x49')],_0x76eb('0x4a')),_0x76eb('0x4b'));var _0x4de1ee=ejs[_0x76eb('0x4c')](_0x82cfdf,{'networks':_0x5c8443||[]});fs[_0x76eb('0x44')](_0x76eb('0x54'),_0x4de1ee);return respondWithRpcPromise(_0x76eb('0x46'),_0x76eb('0x1b'),{'module':_0x76eb('0x47')});}else{var _0x480309=fs[_0x76eb('0x48')](path[_0x76eb('0x42')](config[_0x76eb('0x49')],'server/files/templates/network.ejs'),_0x76eb('0x4b'));var _0x1ced04=ejs['render'](_0x480309,{'networks':_0x5c8443||[]});fs[_0x76eb('0x44')](util[_0x76eb('0x4e')](_0x76eb('0x4f'),_0x212fc1[_0x76eb('0x31')]['toLowerCase']()),_0x1ced04);return respondWithRpcPromise(_0x76eb('0x46'),'destroy',{'module':'chan_sip.so'});}})[_0x76eb('0x13')](handleError(_0x437956,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 6a09183..28c27b0 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 _0xcea2=['../../config/environment','./network.attributes','define','Network','network','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x11d769,_0x5b20aa){var _0x2d33b3=function(_0x70ca0){while(--_0x70ca0){_0x11d769['push'](_0x11d769['shift']());}};_0x2d33b3(++_0x5b20aa);}(_0xcea2,0x15a));var _0x2cea=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xcea2[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var logger=require(_0x2cea('0x1'))('api');var moment=require(_0x2cea('0x2'));var BPromise=require(_0x2cea('0x3'));var rp=require(_0x2cea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var attributes=require(_0x2cea('0x7'));module['exports']=function(_0x34f0f2,_0x485c26){return _0x34f0f2[_0x2cea('0x8')](_0x2cea('0x9'),attributes,{'tableName':_0x2cea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Network','network','lodash'];(function(_0x4bab98,_0xfd0b2d){var _0x4be4fb=function(_0x12cac){while(--_0x12cac){_0x4bab98['push'](_0x4bab98['shift']());}};_0x4be4fb(++_0xfd0b2d);}(_0xdace,0xc5));var _0xedac=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0xdace[_0x45fc6a];return _0x14bcfd;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./network.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 80ab73b..ca88d42 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(_0x492e1f,_0x525b92){var _0x324206=function(_0x20be83){while(--_0x20be83){_0x492e1f['push'](_0x492e1f['shift']());}};_0x324206(++_0x525b92);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1798c6,_0x3d2cfd){var _0x33c68c=function(_0x5db3e1){while(--_0x5db3e1){_0x1798c6['push'](_0x1798c6['shift']());}};_0x33c68c(++_0x3d2cfd);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index be96078..0e09c30 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 _0x4991=['/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeAnswers','/:id/users','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','getAnswers','getApplications','/:id/interactions','getInteractions','post','create','addDisposition','/:id/canned_answers','addAnswer'];(function(_0x3d33bc,_0xe6114c){var _0x2c6915=function(_0x206fa7){while(--_0x206fa7){_0x3d33bc['push'](_0x3d33bc['shift']());}};_0x2c6915(++_0xe6114c);}(_0x4991,0xf7));var _0x1499=function(_0x3a9e70,_0xd03cbd){_0x3a9e70=_0x3a9e70-0x0;var _0x5529d8=_0x4991[_0x3a9e70];return _0x5529d8;};'use strict';var multer=require(_0x1499('0x0'));var util=require('util');var path=require(_0x1499('0x1'));var timeout=require('connect-timeout');var express=require(_0x1499('0x2'));var router=express[_0x1499('0x3')]();var fs_extra=require(_0x1499('0x4'));var auth=require(_0x1499('0x5'));var interaction=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var controller=require(_0x1499('0x8'));router[_0x1499('0x9')]('/',auth['isAuthenticated'](),controller[_0x1499('0xa')]);router[_0x1499('0x9')](_0x1499('0xb'),auth[_0x1499('0xc')](),controller[_0x1499('0xd')]);router[_0x1499('0x9')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller['show']);router[_0x1499('0x9')](_0x1499('0xf'),auth['isAuthenticated'](),controller[_0x1499('0x10')]);router[_0x1499('0x9')]('/:id/canned_answers',auth[_0x1499('0xc')](),controller[_0x1499('0x11')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0x1499('0x12')]);router[_0x1499('0x9')](_0x1499('0x13'),auth[_0x1499('0xc')](),controller[_0x1499('0x14')]);router['get']('/:id/users',auth[_0x1499('0xc')](),controller['getAgents']);router[_0x1499('0x15')]('/',auth[_0x1499('0xc')](),controller[_0x1499('0x16')]);router[_0x1499('0x15')]('/:id/dispositions',auth[_0x1499('0xc')](),controller[_0x1499('0x17')]);router['post'](_0x1499('0x18'),auth[_0x1499('0xc')](),controller[_0x1499('0x19')]);router[_0x1499('0x15')](_0x1499('0x1a'),controller[_0x1499('0x1b')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x1499('0x1c')]);router[_0x1499('0x15')]('/:id/users',auth[_0x1499('0xc')](),controller[_0x1499('0x1d')]);router[_0x1499('0x15')](_0x1499('0x1e'),auth[_0x1499('0xc')](),controller[_0x1499('0x1f')]);router[_0x1499('0x20')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller[_0x1499('0x21')]);router[_0x1499('0x22')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller[_0x1499('0x23')]);router[_0x1499('0x22')](_0x1499('0xf'),auth[_0x1499('0xc')](),controller['removeDispositions']);router[_0x1499('0x22')](_0x1499('0x18'),auth[_0x1499('0xc')](),controller[_0x1499('0x24')]);router[_0x1499('0x22')](_0x1499('0x25'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x1499('0x26')]=router; \ No newline at end of file +var _0x6a95=['/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','/:id/notify','notify','addApplications','addAgents','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0x6a95,0x1db));var _0x56a9=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x6a95[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var path=require(_0x56a9('0x2'));var timeout=require(_0x56a9('0x3'));var express=require(_0x56a9('0x4'));var router=express[_0x56a9('0x5')]();var fs_extra=require(_0x56a9('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x56a9('0x7'));var controller=require(_0x56a9('0x8'));router[_0x56a9('0x9')]('/',auth[_0x56a9('0xa')](),controller[_0x56a9('0xb')]);router[_0x56a9('0x9')](_0x56a9('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x56a9('0x9')](_0x56a9('0xd'),auth['isAuthenticated'](),controller[_0x56a9('0xe')]);router[_0x56a9('0x9')](_0x56a9('0xf'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x10')]);router[_0x56a9('0x9')](_0x56a9('0x11'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x12')]);router['get'](_0x56a9('0x13'),auth['isAuthenticated'](),controller[_0x56a9('0x14')]);router[_0x56a9('0x9')](_0x56a9('0x15'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x16')]);router[_0x56a9('0x9')](_0x56a9('0x17'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x18')]);router['post']('/',auth['isAuthenticated'](),controller[_0x56a9('0x19')]);router[_0x56a9('0x1a')](_0x56a9('0xf'),auth[_0x56a9('0xa')](),controller['addDisposition']);router[_0x56a9('0x1a')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x56a9('0x1a')](_0x56a9('0x1b'),controller[_0x56a9('0x1c')]);router[_0x56a9('0x1a')](_0x56a9('0x13'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x1d')]);router[_0x56a9('0x1a')](_0x56a9('0x17'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x1e')]);router[_0x56a9('0x1a')]('/:id/send',auth['isAuthenticated'](),controller[_0x56a9('0x1f')]);router[_0x56a9('0x20')](_0x56a9('0xd'),auth[_0x56a9('0xa')](),controller['update']);router[_0x56a9('0x21')](_0x56a9('0xd'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x22')]);router['delete'](_0x56a9('0xf'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x23')]);router[_0x56a9('0x21')](_0x56a9('0x11'),auth['isAuthenticated'](),controller[_0x56a9('0x24')]);router[_0x56a9('0x21')](_0x56a9('0x17'),auth['isAuthenticated'](),controller[_0x56a9('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index b2fb708..b10f3ea 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 _0x8881=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','randomstring','exports','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0xf4ba2,_0x42fd08){var _0x3951c1=function(_0x4a1f2c){while(--_0x4a1f2c){_0xf4ba2['push'](_0xf4ba2['shift']());}};_0x3951c1(++_0x42fd08);}(_0x8881,0x152));var _0x1888=function(_0x3ec333,_0x26bcbe){_0x3ec333=_0x3ec333-0x0;var _0x15ccb8=_0x8881[_0x3ec333];return _0x15ccb8;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x1888('0x0'));module[_0x1888('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1888('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x1888('0x3')]},'token':{'type':Sequelize[_0x1888('0x3')],'defaultValue':function(){return rs[_0x1888('0x4')]();}},'replyUri':{'type':Sequelize[_0x1888('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1888('0x5')],'defaultValue':function(){return _0x1888('0x6');}},'notificationSound':{'type':Sequelize[_0x1888('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1888('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1888('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1888('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x1888('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1888('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1888('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1888('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x1888('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x1888('0x7')],'defaultValue':![],'comment':_0x1888('0xa'),'set':function(_0x439af8){if(!_0x439af8)this[_0x1888('0xb')]('mandatoryDispositionPauseId',null);this[_0x1888('0xb')]('mandatoryDisposition',_0x439af8);}}}; \ No newline at end of file +var _0x763b=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x5db649,_0x39e176){var _0x405470=function(_0x291729){while(--_0x291729){_0x5db649['push'](_0x5db649['shift']());}};_0x405470(++_0x39e176);}(_0x763b,0x13c));var _0xb763=function(_0x4b1236,_0x5993a5){_0x4b1236=_0x4b1236-0x0;var _0x45d450=_0x763b[_0x4b1236];return _0x45d450;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xb763('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xb763('0x1')]},'token':{'type':Sequelize[_0xb763('0x1')],'defaultValue':function(){return rs[_0xb763('0x2')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb763('0x3')],'defaultValue':function(){return _0xb763('0x4');}},'notificationSound':{'type':Sequelize[_0xb763('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb763('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb763('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb763('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb763('0x1')]},'queueTransfer':{'type':Sequelize[_0xb763('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb763('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb763('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb763('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xb763('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xb763('0x5')],'defaultValue':![],'comment':_0xb763('0x8'),'set':function(_0x2dafcd){if(!_0x2dafcd)this[_0xb763('0x9')](_0xb763('0xa'),null);this[_0xb763('0x9')](_0xb763('0xb'),_0x2dafcd);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index ed33794..979e083 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 _0xba34=['Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','defaults','contact','threadId','OpenchannelInteraction','externalUrl','spread','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','ids','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','isNil','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','save','update','destroy','get','OpenchannelAccounts','stack','name','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','Pause','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','hasOwnProperty','order','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel'];(function(_0x3262e7,_0xae980f){var _0x297196=function(_0x408dd7){while(--_0x408dd7){_0x3262e7['push'](_0x3262e7['shift']());}};_0x297196(++_0xae980f);}(_0xba34,0x119));var _0x4ba3=function(_0x299a06,_0x24186e){_0x299a06=_0x299a06-0x0;var _0x12851d=_0xba34[_0x299a06];return _0x12851d;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];config[_0x4ba3('0x19')]=_['defaults'](config[_0x4ba3('0x19')],{'host':_0x4ba3('0x1a'),'port':0x18eb});var socket=require(_0x4ba3('0x1b'))(new Redis(config[_0x4ba3('0x19')]));require(_0x4ba3('0x1c'))[_0x4ba3('0x1d')](socket);var jayson=require(_0x4ba3('0x1e'));var client=jayson[_0x4ba3('0x1f')][_0x4ba3('0x20')]({'port':0x232c});var client9002=jayson[_0x4ba3('0x1f')][_0x4ba3('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x301359,_0x29a9d1,_0x25f584,_0x40e75b){return new BPromise(function(_0x1b7776,_0x58d20a){var _0x382fd0=_0x40e75b||client;return _0x382fd0[_0x4ba3('0x21')](_0x301359,_0x25f584)[_0x4ba3('0x22')](function(_0x451c92){logger['info'](_0x4ba3('0x23'),_0x29a9d1,_0x4ba3('0x24'));logger[_0x4ba3('0x25')](_0x4ba3('0x26'),_0x29a9d1,_0x4ba3('0x24'),JSON[_0x4ba3('0x27')](_0x451c92));if(_0x451c92['error']){if(_0x451c92['error'][_0x4ba3('0x28')]===0x1f4){logger['error'](_0x4ba3('0x23'),_0x29a9d1,_0x451c92[_0x4ba3('0x29')][_0x4ba3('0x2a')]);return _0x58d20a(_0x451c92[_0x4ba3('0x29')][_0x4ba3('0x2a')]);}logger[_0x4ba3('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x29a9d1,_0x451c92[_0x4ba3('0x29')][_0x4ba3('0x2a')]);return _0x1b7776(_0x451c92['error'][_0x4ba3('0x2a')]);}else{logger['info'](_0x4ba3('0x23'),_0x29a9d1,_0x4ba3('0x24'));_0x1b7776(_0x451c92[_0x4ba3('0x2b')][_0x4ba3('0x2a')]);}})[_0x4ba3('0x2c')](function(_0xe29a49){logger[_0x4ba3('0x29')](_0x4ba3('0x23'),_0x29a9d1,_0xe29a49);_0x58d20a(_0xe29a49);});});}function respondWithStatusCode(_0x6cecf3,_0x2e67a0){_0x2e67a0=_0x2e67a0||0xcc;return function(_0x50c729){if(_0x50c729){return _0x6cecf3[_0x4ba3('0x2d')](_0x2e67a0);}return _0x6cecf3[_0x4ba3('0x2e')](_0x2e67a0)[_0x4ba3('0x2f')]();};}function respondWithResult(_0x5adaab,_0x10537e){_0x10537e=_0x10537e||0xc8;return function(_0x1fe5e2){if(_0x1fe5e2){return _0x5adaab[_0x4ba3('0x2e')](_0x10537e)['json'](_0x1fe5e2);}};}function respondWithFilteredResult(_0x10cae6,_0x843276){return function(_0x34ecb4){if(_0x34ecb4){var _0x22394d=typeof _0x843276['offset']==='undefined'&&typeof _0x843276[_0x4ba3('0x30')]===_0x4ba3('0x31');var _0x15cfae=_0x34ecb4[_0x4ba3('0x32')];var _0x2cb5d5=_0x22394d?0x0:_0x843276[_0x4ba3('0x33')];var _0x48b3b7=_0x22394d?_0x34ecb4[_0x4ba3('0x32')]:_0x843276[_0x4ba3('0x33')]+_0x843276[_0x4ba3('0x30')];var _0xbf95b3;if(_0x48b3b7>=_0x15cfae){_0x48b3b7=_0x15cfae;_0xbf95b3=0xc8;}else{_0xbf95b3=0xce;}_0x10cae6[_0x4ba3('0x2e')](_0xbf95b3);return _0x10cae6[_0x4ba3('0x34')](_0x4ba3('0x35'),_0x2cb5d5+'-'+_0x48b3b7+'/'+_0x15cfae)[_0x4ba3('0x36')](_0x34ecb4);}return null;};}function patchUpdates(_0x133e76){return function(_0x1abe8b){try{jsonpatch['apply'](_0x1abe8b,_0x133e76,!![]);}catch(_0x5a453f){return BPromise['reject'](_0x5a453f);}return _0x1abe8b[_0x4ba3('0x37')]();};}function saveUpdates(_0xd033d7,_0x41b4eb){return function(_0x4372cb){if(_0x4372cb){return _0x4372cb[_0x4ba3('0x38')](_0xd033d7)[_0x4ba3('0x22')](function(_0x137551){return _0x137551;});}return null;};}function removeEntity(_0xe1abe8,_0x2f3495){return function(_0x3dfe4b){if(_0x3dfe4b){return _0x3dfe4b[_0x4ba3('0x39')]()[_0x4ba3('0x22')](function(){var _0x54535c=_0x3dfe4b[_0x4ba3('0x3a')]({'plain':!![]});var _0x401a9a=_0x4ba3('0x3b');return db['UserProfileResource'][_0x4ba3('0x39')]({'where':{'type':_0x401a9a,'resourceId':_0x54535c['id']}})['then'](function(){return _0x3dfe4b;});})[_0x4ba3('0x22')](function(){_0xe1abe8[_0x4ba3('0x2e')](0xcc)[_0x4ba3('0x2f')]();});}};}function handleEntityNotFound(_0x2b213b,_0xf892e1){return function(_0x3d977c){if(!_0x3d977c){_0x2b213b['sendStatus'](0x194);}return _0x3d977c;};}function handleError(_0x336d6d,_0x3cf56c){_0x3cf56c=_0x3cf56c||0x1f4;return function(_0x2e77d4){logger['error'](_0x2e77d4[_0x4ba3('0x3c')]);if(_0x2e77d4[_0x4ba3('0x3d')]){delete _0x2e77d4['name'];}_0x336d6d[_0x4ba3('0x2e')](_0x3cf56c)['send'](_0x2e77d4);};}exports['index']=function(_0xef9169,_0x1acc74){var _0x38b64d={'include':[{'model':db['Pause'],'as':_0x4ba3('0x3e')}]},_0x2b14e1={},_0x20ac88={'count':0x0,'rows':[]};var _0x10e4b5=_[_0x4ba3('0x3f')](db[_0x4ba3('0x40')][_0x4ba3('0x41')],function(_0x2acc92){return{'name':_0x2acc92[_0x4ba3('0x42')],'type':_0x2acc92[_0x4ba3('0x43')]['key']};});_0x2b14e1[_0x4ba3('0x44')]=_[_0x4ba3('0x3f')](_0x10e4b5,_0x4ba3('0x3d'));_0x2b14e1[_0x4ba3('0x45')]=_[_0x4ba3('0x46')](_0xef9169[_0x4ba3('0x45')]);_0x2b14e1[_0x4ba3('0x47')]=_[_0x4ba3('0x48')](_0x2b14e1[_0x4ba3('0x44')],_0x2b14e1[_0x4ba3('0x45')]);_0x38b64d[_0x4ba3('0x49')]=_[_0x4ba3('0x48')](_0x2b14e1[_0x4ba3('0x44')],qs[_0x4ba3('0x4a')](_0xef9169['query']['fields']));_0x38b64d['attributes']=_0x38b64d['attributes']['length']?_0x38b64d[_0x4ba3('0x49')]:_0x2b14e1['model'];if(!_0xef9169[_0x4ba3('0x45')]['hasOwnProperty'](_0x4ba3('0x4b'))){_0x38b64d[_0x4ba3('0x30')]=qs[_0x4ba3('0x30')](_0xef9169[_0x4ba3('0x45')][_0x4ba3('0x30')]);_0x38b64d['offset']=qs[_0x4ba3('0x33')](_0xef9169['query'][_0x4ba3('0x33')]);}_0x38b64d['order']=qs[_0x4ba3('0x4c')](_0xef9169[_0x4ba3('0x45')][_0x4ba3('0x4c')]);_0x38b64d[_0x4ba3('0x4d')]=qs[_0x4ba3('0x47')](_[_0x4ba3('0x4e')](_0xef9169[_0x4ba3('0x45')],_0x2b14e1['filters']),_0x10e4b5);if(_0xef9169[_0x4ba3('0x45')][_0x4ba3('0x4f')]){_0x38b64d[_0x4ba3('0x4d')]=_[_0x4ba3('0x50')](_0x38b64d[_0x4ba3('0x4d')],{'$or':_['map'](_0x10e4b5,function(_0x56b55d){if(_0x56b55d[_0x4ba3('0x43')]!==_0x4ba3('0x51')){var _0x18617b={};_0x18617b[_0x56b55d['name']]={'$like':'%'+_0xef9169[_0x4ba3('0x45')][_0x4ba3('0x4f')]+'%'};return _0x18617b;}})});}_0x38b64d=_[_0x4ba3('0x50')]({},_0x38b64d,_0xef9169['options']);var _0x47f588={'where':_0x38b64d[_0x4ba3('0x4d')]};return db['OpenchannelAccount'][_0x4ba3('0x32')](_0x47f588)[_0x4ba3('0x22')](function(_0x1aab37){_0x20ac88[_0x4ba3('0x32')]=_0x1aab37;if(_0xef9169[_0x4ba3('0x45')][_0x4ba3('0x52')]){_0x38b64d['include']=[{'all':!![]}];}return db[_0x4ba3('0x40')][_0x4ba3('0x53')](_0x38b64d);})['then'](function(_0x325475){_0x20ac88[_0x4ba3('0x54')]=_0x325475;return _0x20ac88;})[_0x4ba3('0x22')](respondWithFilteredResult(_0x1acc74,_0x38b64d))[_0x4ba3('0x2c')](handleError(_0x1acc74,null));};exports[_0x4ba3('0x55')]=function(_0x4d092d,_0x37a312){var _0x38de05={'raw':![],'where':{'id':_0x4d092d[_0x4ba3('0x56')]['id']},'include':[{'model':db[_0x4ba3('0x57')],'as':_0x4ba3('0x3e')}]},_0x588ee1={};_0x588ee1[_0x4ba3('0x44')]=_[_0x4ba3('0x46')](db[_0x4ba3('0x40')][_0x4ba3('0x41')]);_0x588ee1[_0x4ba3('0x45')]=_[_0x4ba3('0x46')](_0x4d092d[_0x4ba3('0x45')]);_0x588ee1[_0x4ba3('0x47')]=_[_0x4ba3('0x48')](_0x588ee1[_0x4ba3('0x44')],_0x588ee1[_0x4ba3('0x45')]);_0x38de05[_0x4ba3('0x49')]=_['intersection'](_0x588ee1['model'],qs['fields'](_0x4d092d[_0x4ba3('0x45')][_0x4ba3('0x4a')]));_0x38de05[_0x4ba3('0x49')]=_0x38de05[_0x4ba3('0x49')][_0x4ba3('0x58')]?_0x38de05['attributes']:_0x588ee1[_0x4ba3('0x44')];if(_0x4d092d[_0x4ba3('0x45')][_0x4ba3('0x52')]){_0x38de05[_0x4ba3('0x59')]=[{'all':!![]}];}_0x38de05=_[_0x4ba3('0x50')]({},_0x38de05,_0x4d092d[_0x4ba3('0x5a')]);return db[_0x4ba3('0x40')][_0x4ba3('0x5b')](_0x38de05)[_0x4ba3('0x22')](handleEntityNotFound(_0x37a312,null))[_0x4ba3('0x22')](respondWithResult(_0x37a312,null))[_0x4ba3('0x2c')](handleError(_0x37a312,null));};exports[_0x4ba3('0x5c')]=function(_0x317b9f,_0x328314){return db['OpenchannelAccount'][_0x4ba3('0x5c')](_0x317b9f[_0x4ba3('0x5d')],{})[_0x4ba3('0x22')](function(_0x451696){var _0x22d5ca=_0x317b9f[_0x4ba3('0x5e')][_0x4ba3('0x3a')]({'plain':!![]});if(!_0x22d5ca)throw new Error(_0x4ba3('0x5f'));if(_0x22d5ca['role']===_0x4ba3('0x5e')){var _0x3a9cff=_0x451696[_0x4ba3('0x3a')]({'plain':!![]});var _0x4ebcf9=_0x4ba3('0x3b');return db['UserProfileSection'][_0x4ba3('0x5b')]({'where':{'name':_0x4ebcf9,'userProfileId':_0x22d5ca[_0x4ba3('0x60')]},'raw':!![]})[_0x4ba3('0x22')](function(_0x369a9f){if(_0x369a9f&&_0x369a9f[_0x4ba3('0x61')]===0x0){return db['UserProfileResource'][_0x4ba3('0x5c')]({'name':_0x3a9cff[_0x4ba3('0x3d')],'resourceId':_0x3a9cff['id'],'type':_0x369a9f[_0x4ba3('0x3d')],'sectionId':_0x369a9f['id']},{})[_0x4ba3('0x22')](function(){return _0x451696;});}else{return _0x451696;}})[_0x4ba3('0x2c')](function(_0x5ead3b){logger[_0x4ba3('0x29')](_0x4ba3('0x62'),_0x5ead3b);throw _0x5ead3b;});}return _0x451696;})[_0x4ba3('0x22')](respondWithResult(_0x328314,0xc9))[_0x4ba3('0x2c')](handleError(_0x328314,null));};exports[_0x4ba3('0x38')]=function(_0x4070cd,_0x3fdf7f){if(_0x4070cd[_0x4ba3('0x5d')]['id']){delete _0x4070cd[_0x4ba3('0x5d')]['id'];}return db[_0x4ba3('0x40')][_0x4ba3('0x5b')]({'where':{'id':_0x4070cd['params']['id']},'include':[{'model':db[_0x4ba3('0x57')],'as':_0x4ba3('0x3e')}]})['then'](handleEntityNotFound(_0x3fdf7f,null))['then'](saveUpdates(_0x4070cd[_0x4ba3('0x5d')],null))[_0x4ba3('0x22')](respondWithResult(_0x3fdf7f,null))['catch'](handleError(_0x3fdf7f,null));};exports[_0x4ba3('0x39')]=function(_0x30bb71,_0x1fb2aa){return db['OpenchannelAccount'][_0x4ba3('0x5b')]({'where':{'id':_0x30bb71[_0x4ba3('0x56')]['id']}})[_0x4ba3('0x22')](handleEntityNotFound(_0x1fb2aa,null))[_0x4ba3('0x22')](removeEntity(_0x1fb2aa,null))[_0x4ba3('0x2c')](handleError(_0x1fb2aa,null));};exports[_0x4ba3('0x63')]=function(_0x50eb4b,_0x3a1fad){return db[_0x4ba3('0x40')][_0x4ba3('0x63')]()['then'](respondWithResult(_0x3a1fad,null))[_0x4ba3('0x2c')](handleError(_0x3a1fad,null));};exports[_0x4ba3('0x64')]=function(_0x385cee,_0x24f035,_0x21c8b1){if(_0x385cee[_0x4ba3('0x5d')]['id']){delete _0x385cee[_0x4ba3('0x5d')]['id'];}return db[_0x4ba3('0x40')]['find']({'where':{'id':_0x385cee['params']['id']}})[_0x4ba3('0x22')](handleEntityNotFound(_0x24f035,null))['then'](function(_0x13ee2c){if(_0x13ee2c){_0x385cee[_0x4ba3('0x5d')][_0x4ba3('0x65')]=_0x13ee2c['id'];return db['Disposition'][_0x4ba3('0x5c')](_0x385cee[_0x4ba3('0x5d')]);}})[_0x4ba3('0x22')](respondWithResult(_0x24f035,null))['catch'](handleError(_0x24f035,null));};exports[_0x4ba3('0x66')]=function(_0x55b660,_0xd6ad8e,_0x247352){var _0x5dce8f={'raw':![],'where':{}};var _0x37fedb={};var _0x2ed729={'count':0x0,'rows':[]};return db[_0x4ba3('0x40')][_0x4ba3('0x67')]({'where':{'id':_0x55b660[_0x4ba3('0x56')]['id']}})[_0x4ba3('0x22')](handleEntityNotFound(_0xd6ad8e,null))[_0x4ba3('0x22')](function(_0x329874){if(_0x329874){_0x37fedb[_0x4ba3('0x44')]=_['keys'](db[_0x4ba3('0x68')][_0x4ba3('0x41')]);_0x37fedb[_0x4ba3('0x45')]=_[_0x4ba3('0x46')](_0x55b660[_0x4ba3('0x45')]);_0x37fedb[_0x4ba3('0x47')]=_[_0x4ba3('0x48')](_0x37fedb[_0x4ba3('0x44')],_0x37fedb[_0x4ba3('0x45')]);_0x5dce8f[_0x4ba3('0x49')]=_[_0x4ba3('0x48')](_0x37fedb[_0x4ba3('0x44')],qs['fields'](_0x55b660[_0x4ba3('0x45')][_0x4ba3('0x4a')]));_0x5dce8f['attributes']=_0x5dce8f[_0x4ba3('0x49')][_0x4ba3('0x58')]?_0x5dce8f['attributes']:_0x37fedb['model'];if(!_0x55b660[_0x4ba3('0x45')][_0x4ba3('0x69')](_0x4ba3('0x4b'))){_0x5dce8f[_0x4ba3('0x30')]=qs[_0x4ba3('0x30')](_0x55b660[_0x4ba3('0x45')][_0x4ba3('0x30')]);_0x5dce8f[_0x4ba3('0x33')]=qs['offset'](_0x55b660[_0x4ba3('0x45')]['offset']);}_0x5dce8f[_0x4ba3('0x6a')]=qs[_0x4ba3('0x4c')](_0x55b660[_0x4ba3('0x45')][_0x4ba3('0x4c')]);_0x5dce8f[_0x4ba3('0x4d')]=qs[_0x4ba3('0x47')](_[_0x4ba3('0x4e')](_0x55b660[_0x4ba3('0x45')],_0x37fedb['filters']));_0x5dce8f[_0x4ba3('0x4d')][_0x4ba3('0x65')]=_0x329874['id'];if(_0x55b660[_0x4ba3('0x45')]['filter']){_0x5dce8f[_0x4ba3('0x4d')]=_[_0x4ba3('0x50')](_0x5dce8f[_0x4ba3('0x4d')],{'$or':_[_0x4ba3('0x3f')](_0x5dce8f[_0x4ba3('0x49')],function(_0x2569bc){var _0x3ea460={};_0x3ea460[_0x2569bc]={'$like':'%'+_0x55b660['query']['filter']+'%'};return _0x3ea460;})});}_0x5dce8f=_[_0x4ba3('0x50')]({},_0x5dce8f,_0x55b660['options']);return db[_0x4ba3('0x68')][_0x4ba3('0x32')]({'where':_0x5dce8f[_0x4ba3('0x4d')]})[_0x4ba3('0x22')](function(_0x5a3c63){_0x2ed729['count']=_0x5a3c63;if(_0x55b660[_0x4ba3('0x45')][_0x4ba3('0x52')]){_0x5dce8f['include']=[{'all':!![]}];}return db[_0x4ba3('0x68')][_0x4ba3('0x53')](_0x5dce8f);})[_0x4ba3('0x22')](function(_0x1e8232){_0x2ed729[_0x4ba3('0x54')]=_0x1e8232;return _0x2ed729;});}})[_0x4ba3('0x22')](respondWithFilteredResult(_0xd6ad8e,_0x5dce8f))[_0x4ba3('0x2c')](handleError(_0xd6ad8e,null));};exports['removeDispositions']=function(_0x18da09,_0x1a45e3,_0x211d2b){return db['OpenchannelAccount'][_0x4ba3('0x5b')]({'where':{'id':_0x18da09[_0x4ba3('0x56')]['id']}})['then'](handleEntityNotFound(_0x1a45e3,null))[_0x4ba3('0x22')](function(_0x15cb27){if(_0x15cb27){return _0x15cb27['removeDispositions'](_0x18da09['query']['ids']);}})['then'](respondWithStatusCode(_0x1a45e3,null))[_0x4ba3('0x2c')](handleError(_0x1a45e3,null));};exports[_0x4ba3('0x6b')]=function(_0xbe79ec,_0x219aa4,_0x421609){if(_0xbe79ec[_0x4ba3('0x5d')]['id']){delete _0xbe79ec[_0x4ba3('0x5d')]['id'];}return db['OpenchannelAccount'][_0x4ba3('0x5b')]({'where':{'id':_0xbe79ec['params']['id']}})[_0x4ba3('0x22')](handleEntityNotFound(_0x219aa4,null))['then'](function(_0x27298f){if(_0x27298f){_0xbe79ec[_0x4ba3('0x5d')][_0x4ba3('0x65')]=_0x27298f['id'];return db[_0x4ba3('0x6c')][_0x4ba3('0x5c')](_0xbe79ec['body']);}})['then'](respondWithResult(_0x219aa4,null))[_0x4ba3('0x2c')](handleError(_0x219aa4,null));};exports[_0x4ba3('0x6d')]=function(_0x2cf661,_0x5cac73,_0x2cc55c){var _0x3dd147={'raw':![],'where':{}};var _0x7ec030={};var _0x3d8606={'count':0x0,'rows':[]};return db[_0x4ba3('0x40')][_0x4ba3('0x67')]({'where':{'id':_0x2cf661[_0x4ba3('0x56')]['id']}})[_0x4ba3('0x22')](handleEntityNotFound(_0x5cac73,null))['then'](function(_0x375c61){if(_0x375c61){_0x7ec030['model']=_[_0x4ba3('0x46')](db[_0x4ba3('0x6c')][_0x4ba3('0x41')]);_0x7ec030[_0x4ba3('0x45')]=_['keys'](_0x2cf661[_0x4ba3('0x45')]);_0x7ec030[_0x4ba3('0x47')]=_[_0x4ba3('0x48')](_0x7ec030[_0x4ba3('0x44')],_0x7ec030['query']);_0x3dd147['attributes']=_[_0x4ba3('0x48')](_0x7ec030[_0x4ba3('0x44')],qs[_0x4ba3('0x4a')](_0x2cf661['query'][_0x4ba3('0x4a')]));_0x3dd147[_0x4ba3('0x49')]=_0x3dd147[_0x4ba3('0x49')][_0x4ba3('0x58')]?_0x3dd147[_0x4ba3('0x49')]:_0x7ec030[_0x4ba3('0x44')];if(!_0x2cf661['query'][_0x4ba3('0x69')]('nolimit')){_0x3dd147[_0x4ba3('0x30')]=qs[_0x4ba3('0x30')](_0x2cf661[_0x4ba3('0x45')][_0x4ba3('0x30')]);_0x3dd147['offset']=qs[_0x4ba3('0x33')](_0x2cf661[_0x4ba3('0x45')]['offset']);}_0x3dd147[_0x4ba3('0x6a')]=qs['sort'](_0x2cf661[_0x4ba3('0x45')][_0x4ba3('0x4c')]);_0x3dd147[_0x4ba3('0x4d')]=qs[_0x4ba3('0x47')](_[_0x4ba3('0x4e')](_0x2cf661['query'],_0x7ec030['filters']));_0x3dd147[_0x4ba3('0x4d')][_0x4ba3('0x65')]=_0x375c61['id'];if(_0x2cf661[_0x4ba3('0x45')]['filter']){_0x3dd147[_0x4ba3('0x4d')]=_[_0x4ba3('0x50')](_0x3dd147['where'],{'$or':_[_0x4ba3('0x3f')](_0x3dd147[_0x4ba3('0x49')],function(_0xcb15cb){var _0x2660d6={};_0x2660d6[_0xcb15cb]={'$like':'%'+_0x2cf661[_0x4ba3('0x45')][_0x4ba3('0x4f')]+'%'};return _0x2660d6;})});}_0x3dd147=_[_0x4ba3('0x50')]({},_0x3dd147,_0x2cf661[_0x4ba3('0x5a')]);return db['CannedAnswer'][_0x4ba3('0x32')]({'where':_0x3dd147[_0x4ba3('0x4d')]})[_0x4ba3('0x22')](function(_0x1fe247){_0x3d8606[_0x4ba3('0x32')]=_0x1fe247;if(_0x2cf661[_0x4ba3('0x45')][_0x4ba3('0x52')]){_0x3dd147[_0x4ba3('0x59')]=[{'all':!![]}];}return db[_0x4ba3('0x6c')][_0x4ba3('0x53')](_0x3dd147);})[_0x4ba3('0x22')](function(_0x1e6f1f){_0x3d8606[_0x4ba3('0x54')]=_0x1e6f1f;return _0x3d8606;});}})['then'](respondWithFilteredResult(_0x5cac73,_0x3dd147))['catch'](handleError(_0x5cac73,null));};exports[_0x4ba3('0x6e')]=function(_0x32eb88,_0x25fa2a,_0x106727){return db[_0x4ba3('0x40')][_0x4ba3('0x5b')]({'where':{'id':_0x32eb88[_0x4ba3('0x56')]['id']}})['then'](handleEntityNotFound(_0x25fa2a,null))['then'](function(_0x1a5ba3){if(_0x1a5ba3){return _0x1a5ba3[_0x4ba3('0x6e')](_0x32eb88['query']['ids']);}})['then'](respondWithStatusCode(_0x25fa2a,null))['catch'](handleError(_0x25fa2a,null));};exports[_0x4ba3('0x6f')]=function(_0x2f5314,_0x1e2649,_0x1cd1a6){var _0x26bb6b={'body':_0x2f5314['body'],'channel':_0x4ba3('0x70')};var _0x1097ee=[];var _0x143934=[];var _0x5084c1={};var _0x52508d=![];return db['CmContact']['describe']()[_0x4ba3('0x22')](function(_0x17d501){if(!_0x17d501){throw new db[(_0x4ba3('0x71'))][(_0x4ba3('0x72'))](_0x4ba3('0x73'));}_0x1097ee=_['difference'](_[_0x4ba3('0x46')](_0x17d501),['createdAt',_0x4ba3('0x74')]);_0x143934=_[_0x4ba3('0x75')](_[_0x4ba3('0x46')](_0x17d501),['createdAt',_0x4ba3('0x74'),_0x4ba3('0x76'),_0x4ba3('0x77')]);if(_0x2f5314[_0x4ba3('0x5d')]['id']){delete _0x2f5314['body']['id'];}if(_['isNil'](_0x2f5314[_0x4ba3('0x5d')][_0x4ba3('0x78')])){throw new db['Sequelize'][(_0x4ba3('0x72'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2f5314['body']['body'])||_0x2f5314[_0x4ba3('0x5d')][_0x4ba3('0x5d')]===''){throw new db[(_0x4ba3('0x71'))][(_0x4ba3('0x72'))](_0x4ba3('0x79'));}if(_['isNil'](_0x2f5314['body'][_0x4ba3('0x7a')])){throw new db['Sequelize'][(_0x4ba3('0x72'))](_0x4ba3('0x7b')+_0x143934);}if(!_[_0x4ba3('0x7c')](_0x143934,_0x2f5314['body'][_0x4ba3('0x7a')])){throw new db[(_0x4ba3('0x71'))][(_0x4ba3('0x72'))](_0x4ba3('0x7d')+_0x143934);}_0x5084c1[_0x2f5314[_0x4ba3('0x5d')][_0x4ba3('0x7a')]]=_0x2f5314[_0x4ba3('0x5d')][_0x4ba3('0x78')];})[_0x4ba3('0x22')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x2f5314[_0x4ba3('0x56')]['id']},'include':[{'model':db[_0x4ba3('0x7e')],'as':_0x4ba3('0x7f'),'include':[{'model':db[_0x4ba3('0x80')],'as':_0x4ba3('0x81'),'where':_0x5084c1,'limit':0x1,'order':[[_0x4ba3('0x74'),'DESC']]}]},{'model':db[_0x4ba3('0x82')],'as':_0x4ba3('0x83')}]});})['then'](handleEntityNotFound(_0x1e2649,null))[_0x4ba3('0x22')](function(_0x229736){if(_0x229736&&_0x229736[_0x4ba3('0x7f')]){_0x26bb6b[_0x4ba3('0x84')]=_0x229736;_0x26bb6b[_0x4ba3('0x85')]=_0x229736[_0x4ba3('0x83')];_0x26bb6b[_0x4ba3('0x86')]=_0x229736[_0x4ba3('0x7f')];_0x26bb6b[_0x4ba3('0x85')]=_[_0x4ba3('0x87')](_0x26bb6b[_0x4ba3('0x85')],[_0x4ba3('0x88')],[_0x4ba3('0x89')]);if(_0x26bb6b[_0x4ba3('0x84')][_0x4ba3('0x83')]){delete _0x26bb6b['account'][_0x4ba3('0x83')];}if(_0x26bb6b[_0x4ba3('0x84')]['List']&&_0x26bb6b[_0x4ba3('0x84')]['List'][_0x4ba3('0x81')][_0x4ba3('0x58')]){return _0x26bb6b['account']['List'][_0x4ba3('0x81')][0x0];}var _0x5c1b8e=_[_0x4ba3('0x8a')](_0x2f5314[_0x4ba3('0x5d')],{'firstName':_0x2f5314['body'][_0x4ba3('0x78')],'ListId':_0x229736['ListId']});_0x5c1b8e[_0x2f5314[_0x4ba3('0x5d')][_0x4ba3('0x7a')]]=_0x2f5314[_0x4ba3('0x5d')]['from'];return db[_0x4ba3('0x80')]['create'](_0x5c1b8e,{'fields':_0x1097ee,'raw':!![]});}})['then'](handleEntityNotFound(_0x1e2649,null))[_0x4ba3('0x22')](function(_0x5d2241){_0x26bb6b[_0x4ba3('0x8b')]=_0x5d2241;if(_0x5d2241){var _0x9b9c64={'ContactId':_0x5d2241['id'],'OpenchannelAccountId':_0x2f5314[_0x4ba3('0x56')]['id'],'from':(_0x5d2241['firstName']||'')+'\x20'+(_0x5d2241['lastName']||'')};var _0x11c1ae={'OpenchannelAccountId':_0x2f5314[_0x4ba3('0x56')]['id'],'closed':![]};if(_0x2f5314[_0x4ba3('0x5d')][_0x4ba3('0x8c')]){_0x11c1ae[_0x4ba3('0x8c')]=_0x2f5314['body'][_0x4ba3('0x8c')];return db[_0x4ba3('0x8d')][_0x4ba3('0x5b')]({'where':_0x11c1ae})[_0x4ba3('0x22')](function(_0x4a8086){if(_0x4a8086){return[_0x4a8086,![]];}_0x9b9c64[_0x4ba3('0x8c')]=_0x2f5314[_0x4ba3('0x5d')][_0x4ba3('0x8c')];_0x9b9c64[_0x4ba3('0x8e')]=_0x2f5314[_0x4ba3('0x5d')][_0x4ba3('0x8e')];return db[_0x4ba3('0x8d')][_0x4ba3('0x5c')](_0x9b9c64)[_0x4ba3('0x22')](function(_0x3bfa2c){return[_0x3bfa2c,!![]];});});}else{_0x11c1ae[_0x4ba3('0x8c')]=null;}_0x11c1ae['ContactId']=_0x5d2241['id'];return db[_0x4ba3('0x8d')][_0x4ba3('0x5b')]({'where':_0x11c1ae})['then'](function(_0x425687){if(_0x425687){return[_0x425687,![]];}return db['OpenchannelInteraction'][_0x4ba3('0x5c')](_0x9b9c64)[_0x4ba3('0x22')](function(_0x3f081a){return[_0x3f081a,!![]];});});}})[_0x4ba3('0x8f')](function(_0x4aeadd,_0x542d8d){if(_0x4aeadd){_0x52508d=_0x542d8d;if(!_0x542d8d){var _0x78581={'from':(_0x26bb6b[_0x4ba3('0x8b')]['firstName']||'')+'\x20'+(_0x26bb6b[_0x4ba3('0x8b')][_0x4ba3('0x90')]||'')};if(_0x2f5314[_0x4ba3('0x5d')][_0x4ba3('0x8c')]&&_0x2f5314['body'][_0x4ba3('0x91')]&&_0x2f5314[_0x4ba3('0x5d')][_0x4ba3('0x8c')]!=_0x2f5314[_0x4ba3('0x5d')]['messageId']){_0x78581[_0x4ba3('0x8c')]=_0x2f5314['body'][_0x4ba3('0x91')];}return _0x4aeadd[_0x4ba3('0x38')](_0x78581);}else{return _0x4aeadd;}}})[_0x4ba3('0x22')](function(_0x450c9e){_0x26bb6b['interaction']=_0x450c9e['get']({'plain':!![]});_0x26bb6b[_0x4ba3('0x92')][_0x4ba3('0x93')]=_0x52508d;if(_0x26bb6b[_0x4ba3('0x92')]['created']){if(_0x26bb6b['account'][_0x4ba3('0x94')]){_0x26bb6b[_0x4ba3('0x85')][_0x4ba3('0x95')]({'id':0x0,'priority':_0x26bb6b[_0x4ba3('0x85')]['length']+0x1,'app':_0x4ba3('0x96'),'appdata':_0x4ba3('0x97'),'interval':_0x4ba3('0x98')});}}return db[_0x4ba3('0x99')][_0x4ba3('0x5c')]({'body':_0x2f5314[_0x4ba3('0x5d')][_0x4ba3('0x5d')],'OpenchannelAccountId':_0x2f5314[_0x4ba3('0x56')]['id'],'OpenchannelInteractionId':_0x450c9e['id'],'direction':'in','ContactId':_0x26bb6b[_0x4ba3('0x8b')]['id'],'AttachmentId':_0x2f5314[_0x4ba3('0x5d')][_0x4ba3('0x9a')]});})[_0x4ba3('0x22')](function(_0x2d1627){_0x26bb6b[_0x4ba3('0x2a')]=_0x2d1627;if(!_0x26bb6b[_0x4ba3('0x92')][_0x4ba3('0x9b')])return;return db[_0x4ba3('0x9c')][_0x4ba3('0x5b')]({'attributes':['id','name'],'where':{'id':_0x26bb6b[_0x4ba3('0x92')][_0x4ba3('0x9b')]}});})[_0x4ba3('0x22')](function(_0x411a8f){if(_0x411a8f){_0x26bb6b[_0x4ba3('0x85')][_0x4ba3('0x9d')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x411a8f['name']+','+(_0x26bb6b[_0x4ba3('0x84')][_0x4ba3('0x9e')]||0xa),'interval':_0x4ba3('0x98')});}if(!_0x26bb6b['interaction'][_0x4ba3('0x9f')])return;return db[_0x4ba3('0xa0')][_0x4ba3('0x5b')]({'attributes':['id',_0x4ba3('0x3d')],'where':{'id':_0x26bb6b[_0x4ba3('0x92')][_0x4ba3('0x9f')]}});})[_0x4ba3('0x22')](function(_0xab9d13){if(_0xab9d13){_0x26bb6b[_0x4ba3('0x85')]['unshift']({'id':0x0,'priority':0x1,'app':_0x4ba3('0xa1'),'appdata':_0xab9d13['name']+','+(_0x26bb6b['account'][_0x4ba3('0xa2')]||0x12c),'interval':_0x4ba3('0x98')});}return respondWithRpcPromise('Start',_0x4ba3('0xa3'),_0x26bb6b);})[_0x4ba3('0x22')](function(_0x42f738){respondWithRpcPromise(_0x4ba3('0xa4'),_0x4ba3('0xa4'),{'event':_0x4ba3('0x6f'),'message':_0x42f738},client9002);return _0x42f738;})[_0x4ba3('0x22')](respondWithResult(_0x1e2649,null))['catch'](handleError(_0x1e2649,null));};exports[_0x4ba3('0xa5')]=function(_0x2eb75a,_0x2a5723){var _0x14db48=_0x2eb75a[_0x4ba3('0x56')]['id'];var _0x4f902c=_0x2eb75a[_0x4ba3('0x5d')];var _0x524fbc=0xc8;var _0x4f0da0=null;return db[_0x4ba3('0xa6')]['transaction']({'isolationLevel':db[_0x4ba3('0xa6')][_0x4ba3('0xa7')][_0x4ba3('0xa8')][_0x4ba3('0xa9')]},function(_0x1bab2b){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x14db48},'transaction':_0x1bab2b})[_0x4ba3('0x22')](function(_0x10826b){if(_0x10826b){return db[_0x4ba3('0x82')]['destroy']({'where':{'OpenchannelAccountId':_0x14db48},'transaction':_0x1bab2b})[_0x4ba3('0x22')](function(){var _0x4eff33=_[_0x4ba3('0x3f')](_0x4f902c,function(_0xb3b9b8){_0xb3b9b8[_0x4ba3('0x65')]=_0x14db48;return _0xb3b9b8;});return db[_0x4ba3('0x82')][_0x4ba3('0xaa')](_0x4eff33,{'transaction':_0x1bab2b});});}else{_0x524fbc=0x194;_0x4f0da0=[];}});})[_0x4ba3('0x22')](function(){if(_0x524fbc!==0x194){return db[_0x4ba3('0x82')][_0x4ba3('0xab')]({'where':{'OpenchannelAccountId':_0x14db48},'order':_0x4ba3('0x88')})['then'](function(_0x5a68f4){_0x4f0da0=_0x5a68f4;});}})[_0x4ba3('0x2c')](function(_0x3c3509){_0x524fbc=0x1f4;logger[_0x4ba3('0x29')](_0x3c3509['stack']);if(_0x3c3509[_0x4ba3('0x3d')]){delete _0x3c3509[_0x4ba3('0x3d')];}_0x4f0da0=_0x3c3509;})[_0x4ba3('0xac')](function(){if(_0x4f0da0===null){_0x2a5723[_0x4ba3('0x2d')](_0x524fbc);}else{if(_0x524fbc===0x1f4){_0x2a5723[_0x4ba3('0x2e')](_0x524fbc)['send'](_0x4f0da0);}else{_0x2a5723['status'](_0x524fbc)['json'](_0x4f0da0);}}});};exports[_0x4ba3('0xad')]=function(_0x53ca8d,_0x36a7c7,_0x221411){var _0x4034c9={};var _0x4df2aa={};var _0x3185d6;var _0x138acb;return db[_0x4ba3('0x40')]['findOne']({'where':{'id':_0x53ca8d['params']['id']}})[_0x4ba3('0x22')](handleEntityNotFound(_0x36a7c7,null))['then'](function(_0xba2542){if(_0xba2542){_0x3185d6=_0xba2542;_0x4df2aa[_0x4ba3('0x44')]=_[_0x4ba3('0x46')](db['OpenchannelApplication']['rawAttributes']);_0x4df2aa[_0x4ba3('0x45')]=_['keys'](_0x53ca8d[_0x4ba3('0x45')]);_0x4df2aa['filters']=_['intersection'](_0x4df2aa[_0x4ba3('0x44')],_0x4df2aa[_0x4ba3('0x45')]);_0x4034c9['attributes']=_[_0x4ba3('0x48')](_0x4df2aa['model'],qs[_0x4ba3('0x4a')](_0x53ca8d['query'][_0x4ba3('0x4a')]));_0x4034c9['attributes']=_0x4034c9[_0x4ba3('0x49')][_0x4ba3('0x58')]?_0x4034c9[_0x4ba3('0x49')]:_0x4df2aa[_0x4ba3('0x44')];_0x4034c9['order']=qs[_0x4ba3('0x4c')](_0x53ca8d[_0x4ba3('0x45')]['sort']);_0x4034c9['where']=qs[_0x4ba3('0x47')](_[_0x4ba3('0x4e')](_0x53ca8d[_0x4ba3('0x45')],_0x4df2aa[_0x4ba3('0x47')]));if(_0x53ca8d[_0x4ba3('0x45')][_0x4ba3('0x4f')]){_0x4034c9[_0x4ba3('0x4d')]=_['merge'](_0x4034c9[_0x4ba3('0x4d')],{'$or':_[_0x4ba3('0x3f')](_0x4034c9[_0x4ba3('0x49')],function(_0x112017){var _0x5e92bf={};_0x5e92bf[_0x112017]={'$like':'%'+_0x53ca8d[_0x4ba3('0x45')][_0x4ba3('0x4f')]+'%'};return _0x5e92bf;})});}_0x4034c9=_[_0x4ba3('0x50')]({},_0x4034c9,_0x53ca8d['options']);return _0x3185d6[_0x4ba3('0xad')](_0x4034c9);}})[_0x4ba3('0x22')](function(_0x5e6d8e){if(_0x5e6d8e){_0x138acb=_0x5e6d8e[_0x4ba3('0x58')];if(!_0x53ca8d[_0x4ba3('0x45')][_0x4ba3('0x69')](_0x4ba3('0x4b'))){_0x4034c9[_0x4ba3('0x30')]=qs[_0x4ba3('0x30')](_0x53ca8d[_0x4ba3('0x45')][_0x4ba3('0x30')]);_0x4034c9['offset']=qs['offset'](_0x53ca8d[_0x4ba3('0x45')][_0x4ba3('0x33')]);}return _0x3185d6[_0x4ba3('0xad')](_0x4034c9);}})[_0x4ba3('0x22')](function(_0x54c457){if(_0x54c457){return _0x54c457?{'count':_0x138acb,'rows':_0x54c457}:null;}})[_0x4ba3('0x22')](respondWithResult(_0x36a7c7,null))[_0x4ba3('0x2c')](handleError(_0x36a7c7,null));};exports[_0x4ba3('0xae')]=function(_0x46ca6b,_0x54fa39,_0xe89c1c){var _0x34a02d={'raw':![],'where':{}};var _0x4443c8={};var _0x41de51={'count':0x0,'rows':[]};return db[_0x4ba3('0x40')][_0x4ba3('0x67')]({'where':{'id':_0x46ca6b['params']['id']}})[_0x4ba3('0x22')](handleEntityNotFound(_0x54fa39,null))[_0x4ba3('0x22')](function(_0x3d564b){if(_0x3d564b){_0x4443c8[_0x4ba3('0x44')]=_[_0x4ba3('0x46')](db[_0x4ba3('0x8d')][_0x4ba3('0x41')]);_0x4443c8[_0x4ba3('0x45')]=_['keys'](_0x46ca6b['query']);_0x4443c8[_0x4ba3('0x47')]=_[_0x4ba3('0x48')](_0x4443c8['model'],_0x4443c8['query']);_0x34a02d['attributes']=_[_0x4ba3('0x48')](_0x4443c8[_0x4ba3('0x44')],qs[_0x4ba3('0x4a')](_0x46ca6b[_0x4ba3('0x45')][_0x4ba3('0x4a')]));_0x34a02d[_0x4ba3('0x49')]=_0x34a02d['attributes']['length']?_0x34a02d['attributes']:_0x4443c8[_0x4ba3('0x44')];if(!_0x46ca6b[_0x4ba3('0x45')]['hasOwnProperty']('nolimit')){_0x34a02d[_0x4ba3('0x30')]=qs[_0x4ba3('0x30')](_0x46ca6b[_0x4ba3('0x45')]['limit']);_0x34a02d['offset']=qs[_0x4ba3('0x33')](_0x46ca6b[_0x4ba3('0x45')][_0x4ba3('0x33')]);}_0x34a02d['order']=qs[_0x4ba3('0x4c')](_0x46ca6b[_0x4ba3('0x45')][_0x4ba3('0x4c')]);_0x34a02d[_0x4ba3('0x4d')]=qs[_0x4ba3('0x47')](_['pick'](_0x46ca6b[_0x4ba3('0x45')],_0x4443c8[_0x4ba3('0x47')]));_0x34a02d[_0x4ba3('0x4d')][_0x4ba3('0x65')]=_0x3d564b['id'];if(_0x46ca6b['query'][_0x4ba3('0x4f')]){_0x34a02d[_0x4ba3('0x4d')]=_[_0x4ba3('0x50')](_0x34a02d[_0x4ba3('0x4d')],{'$or':_[_0x4ba3('0x3f')](_0x34a02d[_0x4ba3('0x49')],function(_0x57351a){var _0x52e254={};_0x52e254[_0x57351a]={'$like':'%'+_0x46ca6b[_0x4ba3('0x45')][_0x4ba3('0x4f')]+'%'};return _0x52e254;})});}_0x34a02d=_[_0x4ba3('0x50')]({},_0x34a02d,_0x46ca6b[_0x4ba3('0x5a')]);return db[_0x4ba3('0x8d')][_0x4ba3('0x32')]({'where':_0x34a02d[_0x4ba3('0x4d')]})['then'](function(_0x445bad){_0x41de51['count']=_0x445bad;if(_0x46ca6b['query'][_0x4ba3('0x52')]){_0x34a02d[_0x4ba3('0x59')]=[{'model':db[_0x4ba3('0x80')],'as':_0x4ba3('0xaf'),'required':![]},{'model':db[_0x4ba3('0x9c')],'as':_0x4ba3('0xb0'),'attributes':[_0x4ba3('0x3d'),_0x4ba3('0xb1'),_0x4ba3('0xb2')],'required':![]},{'model':db[_0x4ba3('0xb3')],'as':_0x4ba3('0xb4'),'attributes':['id',_0x4ba3('0x3d'),_0x4ba3('0xb5')],'where':_0x46ca6b['query'][_0x4ba3('0xb6')]?{'id':_0x46ca6b[_0x4ba3('0x45')]['tag']}:undefined,'required':_0x46ca6b[_0x4ba3('0x45')][_0x4ba3('0xb6')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x4ba3('0x53')](_0x34a02d);})[_0x4ba3('0x22')](function(_0x4d05e8){_0x41de51['rows']=_0x4d05e8;return _0x41de51;});}})[_0x4ba3('0x22')](respondWithFilteredResult(_0x54fa39,_0x34a02d))[_0x4ba3('0x2c')](handleError(_0x54fa39,null));};exports[_0x4ba3('0xb7')]=function(_0x5aeacc,_0x5b5020,_0x175591){return db[_0x4ba3('0x40')][_0x4ba3('0x5b')]({'where':{'id':_0x5aeacc['params']['id']}})['then'](handleEntityNotFound(_0x5b5020,null))[_0x4ba3('0x22')](function(_0x596381){if(_0x596381){return _0x596381[_0x4ba3('0xb7')](_0x5aeacc[_0x4ba3('0x5d')][_0x4ba3('0xb8')],_[_0x4ba3('0xb9')](_0x5aeacc[_0x4ba3('0x5d')],[_0x4ba3('0xb8'),'id'])||{})[_0x4ba3('0x8f')](function(_0xded950){for(var _0x159c02=0x0;_0x159c02<_0x5aeacc[_0x4ba3('0x5d')][_0x4ba3('0xb8')][_0x4ba3('0x58')];_0x159c02+=0x1){socket[_0x4ba3('0xba')](_0x4ba3('0xbb'),{'UserId':Number(_0x5aeacc['body'][_0x4ba3('0xb8')][_0x159c02]),'OpenchannelAccountId':Number(_0x5aeacc[_0x4ba3('0x56')]['id'])});}return _0xded950;});}})[_0x4ba3('0x22')](respondWithResult(_0x5b5020,null))['catch'](handleError(_0x5b5020,null));};exports[_0x4ba3('0xbc')]=function(_0x3fc3df,_0x14b4d8,_0x26adf2){return db[_0x4ba3('0x40')][_0x4ba3('0x5b')]({'where':{'id':_0x3fc3df[_0x4ba3('0x56')]['id']}})[_0x4ba3('0x22')](handleEntityNotFound(_0x14b4d8,null))[_0x4ba3('0x22')](function(_0x1d0dc2){if(_0x1d0dc2){return _0x1d0dc2[_0x4ba3('0xbc')](_0x3fc3df[_0x4ba3('0x45')][_0x4ba3('0xb8')])[_0x4ba3('0x22')](function(){if(_[_0x4ba3('0xbd')](_0x3fc3df['query']['ids'])){for(var _0xb6f50c=0x0;_0xb6f50c<_0x3fc3df[_0x4ba3('0x45')]['ids'][_0x4ba3('0x58')];_0xb6f50c+=0x1){socket[_0x4ba3('0xba')](_0x4ba3('0xbe'),{'UserId':Number(_0x3fc3df[_0x4ba3('0x45')][_0x4ba3('0xb8')][_0xb6f50c]),'OpenchannelAccountId':Number(_0x3fc3df[_0x4ba3('0x56')]['id'])});}}else{socket[_0x4ba3('0xba')](_0x4ba3('0xbe'),{'UserId':Number(_0x3fc3df[_0x4ba3('0x45')][_0x4ba3('0xb8')]),'OpenchannelAccountId':Number(_0x3fc3df[_0x4ba3('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x14b4d8,null))[_0x4ba3('0x2c')](handleError(_0x14b4d8,null));};exports[_0x4ba3('0xbf')]=function(_0x20e143,_0x19c83d,_0x3fadb6){var _0x1b45c6={};var _0x49a651={};var _0x286eb6;var _0x2d1795;return db[_0x4ba3('0x40')][_0x4ba3('0x67')]({'where':{'id':_0x20e143['params']['id']}})[_0x4ba3('0x22')](handleEntityNotFound(_0x19c83d,null))[_0x4ba3('0x22')](function(_0x335c06){if(_0x335c06){_0x286eb6=_0x335c06;_0x49a651['model']=_['keys'](db[_0x4ba3('0x9c')][_0x4ba3('0x41')]);_0x49a651[_0x4ba3('0x45')]=_[_0x4ba3('0x46')](_0x20e143[_0x4ba3('0x45')]);_0x49a651[_0x4ba3('0x47')]=_[_0x4ba3('0x48')](_0x49a651[_0x4ba3('0x44')],_0x49a651[_0x4ba3('0x45')]);_0x1b45c6[_0x4ba3('0x49')]=_[_0x4ba3('0x48')](_0x49a651[_0x4ba3('0x44')],qs[_0x4ba3('0x4a')](_0x20e143['query'][_0x4ba3('0x4a')]));_0x1b45c6[_0x4ba3('0x49')]=_0x1b45c6[_0x4ba3('0x49')][_0x4ba3('0x58')]?_0x1b45c6[_0x4ba3('0x49')]:_0x49a651[_0x4ba3('0x44')];_0x1b45c6[_0x4ba3('0x6a')]=qs[_0x4ba3('0x4c')](_0x20e143[_0x4ba3('0x45')]['sort']);_0x1b45c6[_0x4ba3('0x4d')]=qs[_0x4ba3('0x47')](_[_0x4ba3('0x4e')](_0x20e143['query'],_0x49a651['filters']));if(_0x20e143['query'][_0x4ba3('0x4f')]){_0x1b45c6[_0x4ba3('0x4d')]=_[_0x4ba3('0x50')](_0x1b45c6[_0x4ba3('0x4d')],{'$or':_['map'](_0x1b45c6[_0x4ba3('0x49')],function(_0x345933){var _0x28397a={};_0x28397a[_0x345933]={'$like':'%'+_0x20e143[_0x4ba3('0x45')][_0x4ba3('0x4f')]+'%'};return _0x28397a;})});}_0x1b45c6=_[_0x4ba3('0x50')]({},_0x1b45c6,_0x20e143[_0x4ba3('0x5a')]);return _0x286eb6[_0x4ba3('0xbf')](_0x1b45c6);}})[_0x4ba3('0x22')](function(_0xc2820c){if(_0xc2820c){_0x2d1795=_0xc2820c['length'];if(!_0x20e143['query'][_0x4ba3('0x69')]('nolimit')){_0x1b45c6['limit']=qs[_0x4ba3('0x30')](_0x20e143['query'][_0x4ba3('0x30')]);_0x1b45c6[_0x4ba3('0x33')]=qs['offset'](_0x20e143[_0x4ba3('0x45')][_0x4ba3('0x33')]);}return _0x286eb6['getAgents'](_0x1b45c6);}})['then'](function(_0x486572){if(_0x486572){return _0x486572?{'count':_0x2d1795,'rows':_0x486572}:null;}})[_0x4ba3('0x22')](respondWithResult(_0x19c83d,null))[_0x4ba3('0x2c')](handleError(_0x19c83d,null));};exports[_0x4ba3('0xc0')]=function(_0x579184,_0x219795,_0x45cc4c){var _0x57d175,_0x4f432f,_0x2c0ce7;if(_['isNil'](_0x579184[_0x4ba3('0x5d')]['body'])||_0x579184['body'][_0x4ba3('0x5d')]===''){throw new db[(_0x4ba3('0x71'))][(_0x4ba3('0x72'))](_0x4ba3('0x79'));}if(_[_0x4ba3('0xc1')](_0x579184[_0x4ba3('0x5d')]['to'])){}_0x57d175=_0x579184[_0x4ba3('0x5d')]['to'];return db[_0x4ba3('0x40')][_0x4ba3('0x67')]({'where':{'id':_0x579184[_0x4ba3('0x56')]['id']}})[_0x4ba3('0x22')](handleEntityNotFound(_0x219795,null))[_0x4ba3('0x22')](function(_0x1d0f3a){if(_0x1d0f3a){return db[_0x4ba3('0x40')][_0x4ba3('0x5b')]({'where':{'id':_0x1d0f3a['id']},'include':[{'model':db[_0x4ba3('0x7e')],'as':_0x4ba3('0x7f'),'include':[{'model':db[_0x4ba3('0x80')],'as':_0x4ba3('0x81'),'where':{[_0x1d0f3a[_0x4ba3('0x7a')]]:_0x57d175},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x219795,null))[_0x4ba3('0x22')](function(_0x7b5357){if(_0x7b5357&&_0x7b5357[_0x4ba3('0x7f')]){_0x4f432f=_0x7b5357[_0x4ba3('0x3a')]({'plain':!![]});if(_0x4f432f['List']&&_0x4f432f[_0x4ba3('0x7f')][_0x4ba3('0x81')]['length']){return _0x4f432f[_0x4ba3('0x7f')][_0x4ba3('0x81')][0x0];}return db[_0x4ba3('0x80')][_0x4ba3('0x5c')](_['defaults'](_0x579184[_0x4ba3('0x5d')],{'firstName':_0x57d175,[_0x7b5357[_0x4ba3('0x7a')]]:_0x57d175,'phone':_0x57d175,'ListId':_0x4f432f[_0x4ba3('0x77')]}));}})[_0x4ba3('0x22')](handleEntityNotFound(_0x219795,null))[_0x4ba3('0x22')](function(_0x361d85){if(_0x361d85){_0x2c0ce7=_0x361d85;return db[_0x4ba3('0x8d')][_0x4ba3('0x5b')]({'where':{'ContactId':_0x2c0ce7['id'],'closed':![],'OpenchannelAccountId':_0x4f432f['id']}})[_0x4ba3('0x22')](function(_0xaa290){if(_0xaa290){return[_0xaa290,![]];}return db[_0x4ba3('0x8d')][_0x4ba3('0x5c')]({'UserId':_0x579184[_0x4ba3('0x5e')]['id'],'ContactId':_0x2c0ce7['id'],'OpenchannelAccountId':_0x4f432f['id'],'lastMsgDirection':_0x4ba3('0xc2'),'firstMsgDirection':_0x4ba3('0xc2'),'Messages':[_[_0x4ba3('0x50')](_0x579184[_0x4ba3('0x5d')],{'read':![],'body':_0x579184[_0x4ba3('0x5d')][_0x4ba3('0x5d')],'OpenchannelAccountId':_0x4f432f['id'],'UserId':_0x579184[_0x4ba3('0x5e')]['id'],'ContactId':_0x2c0ce7['id']})]},{'include':[{'model':db[_0x4ba3('0x99')],'as':'Messages'}]})[_0x4ba3('0x22')](function(_0x2bbb71){return[_0x2bbb71,!![]];});});}})['spread'](function(_0x25c292,_0xd25e28){if(_0xd25e28){return _0x25c292;}return db['OpenchannelMessage'][_0x4ba3('0x5c')](_['merge'](_0x579184[_0x4ba3('0x5d')],{'read':![],'body':_0x579184[_0x4ba3('0x5d')][_0x4ba3('0x5d')],'OpenchannelAccountId':_0x4f432f['id'],'OpenchannelInteractionId':_0x25c292['id'],'UserId':_0x579184[_0x4ba3('0x5e')]['id'],'ContactId':_0x2c0ce7['id']}))[_0x4ba3('0x22')](function(_0x45667d){_0x25c292['dataValues'][_0x4ba3('0xc3')]=[];_0x25c292[_0x4ba3('0xc4')][_0x4ba3('0xc3')][_0x4ba3('0x95')](_0x45667d['dataValues']);return _0x25c292;});});}})[_0x4ba3('0x22')](respondWithResult(_0x219795,null))[_0x4ba3('0x2c')](handleError(_0x219795,null));}; \ No newline at end of file +var _0x6934=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','sendStatus','stack','name','send','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','userProfileId','update','Pause','describe','addDisposition','Disposition','findOne','pick','OpenchannelAccountId','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','isNil','from','ValidationError','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','Contacts','DESC','Applications','List','account','applications','orderBy','priority','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','created','interaction','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','OpenchannelQueue','queueId','queue','Start','startRouting','EventManager','addApplications','sequelize','Transaction','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','addAgents','ids','omit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','emit','getAgents','CmList','out','spread','dataValues','Messages','eml-format'];(function(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0x6934,0x17f));var _0x4693=function(_0x4afb13,_0x4a6cee){_0x4afb13=_0x4afb13-0x0;var _0x2ca126=_0x6934[_0x4afb13];return _0x2ca126;};'use strict';var emlformat=require(_0x4693('0x0'));var rimraf=require(_0x4693('0x1'));var zipdir=require(_0x4693('0x2'));var jsonpatch=require(_0x4693('0x3'));var rp=require(_0x4693('0x4'));var moment=require('moment');var BPromise=require(_0x4693('0x5'));var Mustache=require(_0x4693('0x6'));var util=require(_0x4693('0x7'));var path=require(_0x4693('0x8'));var sox=require('sox');var csv=require(_0x4693('0x9'));var ejs=require(_0x4693('0xa'));var fs=require('fs');var fs_extra=require(_0x4693('0xb'));var _=require(_0x4693('0xc'));var squel=require(_0x4693('0xd'));var crypto=require(_0x4693('0xe'));var jsforce=require(_0x4693('0xf'));var deskjs=require(_0x4693('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4693('0x11'));var Redis=require(_0x4693('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4693('0x13'));var as=require(_0x4693('0x14'));var hardwareService=require(_0x4693('0x15'));var logger=require('../../config/logger')(_0x4693('0x16'));var utils=require(_0x4693('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4693('0x18'));var db=require(_0x4693('0x19'))['db'];config[_0x4693('0x1a')]=_[_0x4693('0x1b')](config[_0x4693('0x1a')],{'host':_0x4693('0x1c'),'port':0x18eb});var socket=require(_0x4693('0x1d'))(new Redis(config[_0x4693('0x1a')]));require(_0x4693('0x1e'))[_0x4693('0x1f')](socket);var jayson=require(_0x4693('0x20'));var client=jayson[_0x4693('0x21')][_0x4693('0x22')]({'port':0x232c});var client9002=jayson[_0x4693('0x21')][_0x4693('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x3f7a6e,_0x502c77,_0xe7c815,_0x31ac01){return new BPromise(function(_0x16d180,_0x23d85c){var _0x19bddf=_0x31ac01||client;return _0x19bddf[_0x4693('0x23')](_0x3f7a6e,_0xe7c815)[_0x4693('0x24')](function(_0x5759ff){logger[_0x4693('0x25')](_0x4693('0x26'),_0x502c77,_0x4693('0x27'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x502c77,_0x4693('0x27'),JSON[_0x4693('0x28')](_0x5759ff));if(_0x5759ff[_0x4693('0x29')]){if(_0x5759ff[_0x4693('0x29')][_0x4693('0x2a')]===0x1f4){logger[_0x4693('0x29')](_0x4693('0x26'),_0x502c77,_0x5759ff[_0x4693('0x29')][_0x4693('0x2b')]);return _0x23d85c(_0x5759ff[_0x4693('0x29')][_0x4693('0x2b')]);}logger[_0x4693('0x29')](_0x4693('0x26'),_0x502c77,_0x5759ff[_0x4693('0x29')][_0x4693('0x2b')]);return _0x16d180(_0x5759ff[_0x4693('0x29')][_0x4693('0x2b')]);}else{logger[_0x4693('0x25')](_0x4693('0x26'),_0x502c77,_0x4693('0x27'));_0x16d180(_0x5759ff[_0x4693('0x2c')]['message']);}})['catch'](function(_0xfa3c6d){logger[_0x4693('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x502c77,_0xfa3c6d);_0x23d85c(_0xfa3c6d);});});}function respondWithStatusCode(_0x27d2d7,_0x38e859){_0x38e859=_0x38e859||0xcc;return function(_0x5199b9){if(_0x5199b9){return _0x27d2d7['sendStatus'](_0x38e859);}return _0x27d2d7[_0x4693('0x2d')](_0x38e859)[_0x4693('0x2e')]();};}function respondWithResult(_0x13fb51,_0x19613d){_0x19613d=_0x19613d||0xc8;return function(_0x3bf39d){if(_0x3bf39d){return _0x13fb51['status'](_0x19613d)[_0x4693('0x2f')](_0x3bf39d);}};}function respondWithFilteredResult(_0x41d988,_0x49ab47){return function(_0x538068){if(_0x538068){var _0x5b397c=typeof _0x49ab47[_0x4693('0x30')]===_0x4693('0x31')&&typeof _0x49ab47[_0x4693('0x32')]===_0x4693('0x31');var _0x5bfc91=_0x538068['count'];var _0x5d608f=_0x5b397c?0x0:_0x49ab47['offset'];var _0x3c8be9=_0x5b397c?_0x538068[_0x4693('0x33')]:_0x49ab47[_0x4693('0x30')]+_0x49ab47[_0x4693('0x32')];var _0x11936f;if(_0x3c8be9>=_0x5bfc91){_0x3c8be9=_0x5bfc91;_0x11936f=0xc8;}else{_0x11936f=0xce;}_0x41d988[_0x4693('0x2d')](_0x11936f);return _0x41d988['set'](_0x4693('0x34'),_0x5d608f+'-'+_0x3c8be9+'/'+_0x5bfc91)[_0x4693('0x2f')](_0x538068);}return null;};}function patchUpdates(_0x46ee76){return function(_0x372880){try{jsonpatch[_0x4693('0x35')](_0x372880,_0x46ee76,!![]);}catch(_0x6daa67){return BPromise[_0x4693('0x36')](_0x6daa67);}return _0x372880[_0x4693('0x37')]();};}function saveUpdates(_0x43cc0d,_0x2c82e5){return function(_0x25d762){if(_0x25d762){return _0x25d762['update'](_0x43cc0d)[_0x4693('0x24')](function(_0x5c9dd2){return _0x5c9dd2;});}return null;};}function removeEntity(_0x3c6dfb,_0x15cd30){return function(_0x5c08da){if(_0x5c08da){return _0x5c08da[_0x4693('0x38')]()[_0x4693('0x24')](function(){var _0x2715d0=_0x5c08da[_0x4693('0x39')]({'plain':!![]});var _0x5f51a8='OpenchannelAccounts';return db['UserProfileResource'][_0x4693('0x38')]({'where':{'type':_0x5f51a8,'resourceId':_0x2715d0['id']}})[_0x4693('0x24')](function(){return _0x5c08da;});})[_0x4693('0x24')](function(){_0x3c6dfb[_0x4693('0x2d')](0xcc)[_0x4693('0x2e')]();});}};}function handleEntityNotFound(_0x519f60,_0xd17e67){return function(_0x10b80f){if(!_0x10b80f){_0x519f60[_0x4693('0x3a')](0x194);}return _0x10b80f;};}function handleError(_0x1781aa,_0x3547ee){_0x3547ee=_0x3547ee||0x1f4;return function(_0x4862bf){logger[_0x4693('0x29')](_0x4862bf[_0x4693('0x3b')]);if(_0x4862bf[_0x4693('0x3c')]){delete _0x4862bf[_0x4693('0x3c')];}_0x1781aa[_0x4693('0x2d')](_0x3547ee)[_0x4693('0x3d')](_0x4862bf);};}exports['index']=function(_0x179486,_0x38bad7){var _0x5a6648={'include':[{'model':db['Pause'],'as':_0x4693('0x3e')}]},_0xb948={},_0x4d33f0={'count':0x0,'rows':[]};var _0x452364=_['map'](db[_0x4693('0x3f')][_0x4693('0x40')],function(_0x4b59aa){return{'name':_0x4b59aa[_0x4693('0x41')],'type':_0x4b59aa[_0x4693('0x42')]['key']};});_0xb948[_0x4693('0x43')]=_[_0x4693('0x44')](_0x452364,_0x4693('0x3c'));_0xb948['query']=_[_0x4693('0x45')](_0x179486[_0x4693('0x46')]);_0xb948['filters']=_[_0x4693('0x47')](_0xb948[_0x4693('0x43')],_0xb948[_0x4693('0x46')]);_0x5a6648['attributes']=_[_0x4693('0x47')](_0xb948[_0x4693('0x43')],qs['fields'](_0x179486['query'][_0x4693('0x48')]));_0x5a6648[_0x4693('0x49')]=_0x5a6648[_0x4693('0x49')][_0x4693('0x4a')]?_0x5a6648['attributes']:_0xb948['model'];if(!_0x179486[_0x4693('0x46')][_0x4693('0x4b')](_0x4693('0x4c'))){_0x5a6648[_0x4693('0x32')]=qs['limit'](_0x179486[_0x4693('0x46')]['limit']);_0x5a6648[_0x4693('0x30')]=qs[_0x4693('0x30')](_0x179486[_0x4693('0x46')][_0x4693('0x30')]);}_0x5a6648[_0x4693('0x4d')]=qs['sort'](_0x179486[_0x4693('0x46')][_0x4693('0x4e')]);_0x5a6648['where']=qs[_0x4693('0x4f')](_['pick'](_0x179486[_0x4693('0x46')],_0xb948[_0x4693('0x4f')]),_0x452364);if(_0x179486[_0x4693('0x46')][_0x4693('0x50')]){_0x5a6648[_0x4693('0x51')]=_[_0x4693('0x52')](_0x5a6648[_0x4693('0x51')],{'$or':_[_0x4693('0x44')](_0x452364,function(_0x517506){if(_0x517506['type']!==_0x4693('0x53')){var _0x59dcfe={};_0x59dcfe[_0x517506[_0x4693('0x3c')]]={'$like':'%'+_0x179486[_0x4693('0x46')][_0x4693('0x50')]+'%'};return _0x59dcfe;}})});}_0x5a6648=_[_0x4693('0x52')]({},_0x5a6648,_0x179486[_0x4693('0x54')]);var _0x571034={'where':_0x5a6648[_0x4693('0x51')]};return db[_0x4693('0x3f')][_0x4693('0x33')](_0x571034)[_0x4693('0x24')](function(_0x39583a){_0x4d33f0[_0x4693('0x33')]=_0x39583a;if(_0x179486[_0x4693('0x46')][_0x4693('0x55')]){_0x5a6648[_0x4693('0x56')]=[{'all':!![]}];}return db[_0x4693('0x3f')]['findAll'](_0x5a6648);})[_0x4693('0x24')](function(_0x3c2b88){_0x4d33f0['rows']=_0x3c2b88;return _0x4d33f0;})[_0x4693('0x24')](respondWithFilteredResult(_0x38bad7,_0x5a6648))[_0x4693('0x57')](handleError(_0x38bad7,null));};exports[_0x4693('0x58')]=function(_0x438521,_0x2d48f3){var _0x522842={'raw':![],'where':{'id':_0x438521[_0x4693('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x4693('0x3e')}]},_0x15bb5e={};_0x15bb5e['model']=_[_0x4693('0x45')](db[_0x4693('0x3f')]['rawAttributes']);_0x15bb5e[_0x4693('0x46')]=_['keys'](_0x438521[_0x4693('0x46')]);_0x15bb5e[_0x4693('0x4f')]=_[_0x4693('0x47')](_0x15bb5e['model'],_0x15bb5e['query']);_0x522842[_0x4693('0x49')]=_[_0x4693('0x47')](_0x15bb5e[_0x4693('0x43')],qs[_0x4693('0x48')](_0x438521[_0x4693('0x46')][_0x4693('0x48')]));_0x522842[_0x4693('0x49')]=_0x522842['attributes'][_0x4693('0x4a')]?_0x522842[_0x4693('0x49')]:_0x15bb5e[_0x4693('0x43')];if(_0x438521[_0x4693('0x46')][_0x4693('0x55')]){_0x522842[_0x4693('0x56')]=[{'all':!![]}];}_0x522842=_[_0x4693('0x52')]({},_0x522842,_0x438521[_0x4693('0x54')]);return db[_0x4693('0x3f')]['find'](_0x522842)[_0x4693('0x24')](handleEntityNotFound(_0x2d48f3,null))['then'](respondWithResult(_0x2d48f3,null))[_0x4693('0x57')](handleError(_0x2d48f3,null));};exports[_0x4693('0x5a')]=function(_0x198a42,_0x2c65a2){return db[_0x4693('0x3f')]['create'](_0x198a42[_0x4693('0x5b')],{})[_0x4693('0x24')](function(_0x1f82d9){var _0x106559=_0x198a42['user'][_0x4693('0x39')]({'plain':!![]});if(!_0x106559)throw new Error(_0x4693('0x5c'));if(_0x106559['role']===_0x4693('0x5d')){var _0x52ed34=_0x1f82d9[_0x4693('0x39')]({'plain':!![]});var _0x4a20c3='OpenchannelAccounts';return db['UserProfileSection'][_0x4693('0x5e')]({'where':{'name':_0x4a20c3,'userProfileId':_0x106559[_0x4693('0x5f')]},'raw':!![]})[_0x4693('0x24')](function(_0x278350){if(_0x278350&&_0x278350['autoAssociation']===0x0){return db['UserProfileResource'][_0x4693('0x5a')]({'name':_0x52ed34[_0x4693('0x3c')],'resourceId':_0x52ed34['id'],'type':_0x278350[_0x4693('0x3c')],'sectionId':_0x278350['id']},{})['then'](function(){return _0x1f82d9;});}else{return _0x1f82d9;}})[_0x4693('0x57')](function(_0x356764){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x356764);throw _0x356764;});}return _0x1f82d9;})[_0x4693('0x24')](respondWithResult(_0x2c65a2,0xc9))[_0x4693('0x57')](handleError(_0x2c65a2,null));};exports[_0x4693('0x60')]=function(_0x5a74b6,_0x21fc83){if(_0x5a74b6[_0x4693('0x5b')]['id']){delete _0x5a74b6['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x5a74b6['params']['id']},'include':[{'model':db[_0x4693('0x61')],'as':_0x4693('0x3e')}]})[_0x4693('0x24')](handleEntityNotFound(_0x21fc83,null))['then'](saveUpdates(_0x5a74b6[_0x4693('0x5b')],null))[_0x4693('0x24')](respondWithResult(_0x21fc83,null))['catch'](handleError(_0x21fc83,null));};exports[_0x4693('0x38')]=function(_0x2b8a98,_0x44091d){return db[_0x4693('0x3f')][_0x4693('0x5e')]({'where':{'id':_0x2b8a98[_0x4693('0x59')]['id']}})['then'](handleEntityNotFound(_0x44091d,null))[_0x4693('0x24')](removeEntity(_0x44091d,null))[_0x4693('0x57')](handleError(_0x44091d,null));};exports[_0x4693('0x62')]=function(_0x4dd105,_0x4257f1){return db[_0x4693('0x3f')][_0x4693('0x62')]()['then'](respondWithResult(_0x4257f1,null))['catch'](handleError(_0x4257f1,null));};exports[_0x4693('0x63')]=function(_0x18ecf2,_0x418b26,_0x15f073){if(_0x18ecf2[_0x4693('0x5b')]['id']){delete _0x18ecf2[_0x4693('0x5b')]['id'];}return db[_0x4693('0x3f')][_0x4693('0x5e')]({'where':{'id':_0x18ecf2[_0x4693('0x59')]['id']}})['then'](handleEntityNotFound(_0x418b26,null))[_0x4693('0x24')](function(_0x226864){if(_0x226864){_0x18ecf2[_0x4693('0x5b')]['OpenchannelAccountId']=_0x226864['id'];return db[_0x4693('0x64')]['create'](_0x18ecf2[_0x4693('0x5b')]);}})['then'](respondWithResult(_0x418b26,null))[_0x4693('0x57')](handleError(_0x418b26,null));};exports['getDispositions']=function(_0x170d8e,_0x92a009,_0x3ef030){var _0x1b9a0d={'raw':![],'where':{}};var _0x1c0a78={};var _0x368d0f={'count':0x0,'rows':[]};return db[_0x4693('0x3f')][_0x4693('0x65')]({'where':{'id':_0x170d8e[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x92a009,null))[_0x4693('0x24')](function(_0x4b2f83){if(_0x4b2f83){_0x1c0a78['model']=_['keys'](db[_0x4693('0x64')][_0x4693('0x40')]);_0x1c0a78['query']=_[_0x4693('0x45')](_0x170d8e[_0x4693('0x46')]);_0x1c0a78['filters']=_[_0x4693('0x47')](_0x1c0a78[_0x4693('0x43')],_0x1c0a78[_0x4693('0x46')]);_0x1b9a0d[_0x4693('0x49')]=_[_0x4693('0x47')](_0x1c0a78[_0x4693('0x43')],qs[_0x4693('0x48')](_0x170d8e[_0x4693('0x46')][_0x4693('0x48')]));_0x1b9a0d[_0x4693('0x49')]=_0x1b9a0d['attributes'][_0x4693('0x4a')]?_0x1b9a0d[_0x4693('0x49')]:_0x1c0a78[_0x4693('0x43')];if(!_0x170d8e[_0x4693('0x46')]['hasOwnProperty'](_0x4693('0x4c'))){_0x1b9a0d[_0x4693('0x32')]=qs[_0x4693('0x32')](_0x170d8e[_0x4693('0x46')][_0x4693('0x32')]);_0x1b9a0d[_0x4693('0x30')]=qs[_0x4693('0x30')](_0x170d8e[_0x4693('0x46')][_0x4693('0x30')]);}_0x1b9a0d[_0x4693('0x4d')]=qs['sort'](_0x170d8e[_0x4693('0x46')][_0x4693('0x4e')]);_0x1b9a0d[_0x4693('0x51')]=qs[_0x4693('0x4f')](_[_0x4693('0x66')](_0x170d8e[_0x4693('0x46')],_0x1c0a78[_0x4693('0x4f')]));_0x1b9a0d[_0x4693('0x51')][_0x4693('0x67')]=_0x4b2f83['id'];if(_0x170d8e[_0x4693('0x46')][_0x4693('0x50')]){_0x1b9a0d[_0x4693('0x51')]=_[_0x4693('0x52')](_0x1b9a0d[_0x4693('0x51')],{'$or':_['map'](_0x1b9a0d[_0x4693('0x49')],function(_0x2355b6){var _0x400e1e={};_0x400e1e[_0x2355b6]={'$like':'%'+_0x170d8e[_0x4693('0x46')][_0x4693('0x50')]+'%'};return _0x400e1e;})});}_0x1b9a0d=_['merge']({},_0x1b9a0d,_0x170d8e[_0x4693('0x54')]);return db[_0x4693('0x64')][_0x4693('0x33')]({'where':_0x1b9a0d[_0x4693('0x51')]})[_0x4693('0x24')](function(_0xaa4df9){_0x368d0f[_0x4693('0x33')]=_0xaa4df9;if(_0x170d8e[_0x4693('0x46')][_0x4693('0x55')]){_0x1b9a0d[_0x4693('0x56')]=[{'all':!![]}];}return db[_0x4693('0x64')][_0x4693('0x68')](_0x1b9a0d);})[_0x4693('0x24')](function(_0x2801b1){_0x368d0f['rows']=_0x2801b1;return _0x368d0f;});}})[_0x4693('0x24')](respondWithFilteredResult(_0x92a009,_0x1b9a0d))[_0x4693('0x57')](handleError(_0x92a009,null));};exports[_0x4693('0x69')]=function(_0x26e09d,_0x537436,_0x43dfbf){return db[_0x4693('0x3f')]['find']({'where':{'id':_0x26e09d[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x537436,null))[_0x4693('0x24')](function(_0x709cc1){if(_0x709cc1){return _0x709cc1[_0x4693('0x69')](_0x26e09d['query']['ids']);}})[_0x4693('0x24')](respondWithStatusCode(_0x537436,null))[_0x4693('0x57')](handleError(_0x537436,null));};exports[_0x4693('0x6a')]=function(_0x32766b,_0x247449,_0x5eca63){if(_0x32766b[_0x4693('0x5b')]['id']){delete _0x32766b[_0x4693('0x5b')]['id'];}return db[_0x4693('0x3f')][_0x4693('0x5e')]({'where':{'id':_0x32766b[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x247449,null))[_0x4693('0x24')](function(_0x157fc8){if(_0x157fc8){_0x32766b[_0x4693('0x5b')][_0x4693('0x67')]=_0x157fc8['id'];return db[_0x4693('0x6b')][_0x4693('0x5a')](_0x32766b[_0x4693('0x5b')]);}})[_0x4693('0x24')](respondWithResult(_0x247449,null))[_0x4693('0x57')](handleError(_0x247449,null));};exports[_0x4693('0x6c')]=function(_0x369d98,_0x2e432d,_0x5238e3){var _0x4e820c={'raw':![],'where':{}};var _0x4760a5={};var _0x2b9b4f={'count':0x0,'rows':[]};return db[_0x4693('0x3f')][_0x4693('0x65')]({'where':{'id':_0x369d98['params']['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x2e432d,null))[_0x4693('0x24')](function(_0x496677){if(_0x496677){_0x4760a5[_0x4693('0x43')]=_[_0x4693('0x45')](db[_0x4693('0x6b')]['rawAttributes']);_0x4760a5['query']=_[_0x4693('0x45')](_0x369d98['query']);_0x4760a5[_0x4693('0x4f')]=_[_0x4693('0x47')](_0x4760a5[_0x4693('0x43')],_0x4760a5[_0x4693('0x46')]);_0x4e820c['attributes']=_['intersection'](_0x4760a5['model'],qs[_0x4693('0x48')](_0x369d98[_0x4693('0x46')][_0x4693('0x48')]));_0x4e820c[_0x4693('0x49')]=_0x4e820c[_0x4693('0x49')]['length']?_0x4e820c['attributes']:_0x4760a5['model'];if(!_0x369d98[_0x4693('0x46')][_0x4693('0x4b')](_0x4693('0x4c'))){_0x4e820c[_0x4693('0x32')]=qs[_0x4693('0x32')](_0x369d98[_0x4693('0x46')]['limit']);_0x4e820c['offset']=qs['offset'](_0x369d98[_0x4693('0x46')][_0x4693('0x30')]);}_0x4e820c[_0x4693('0x4d')]=qs[_0x4693('0x4e')](_0x369d98[_0x4693('0x46')][_0x4693('0x4e')]);_0x4e820c[_0x4693('0x51')]=qs['filters'](_[_0x4693('0x66')](_0x369d98['query'],_0x4760a5['filters']));_0x4e820c[_0x4693('0x51')][_0x4693('0x67')]=_0x496677['id'];if(_0x369d98[_0x4693('0x46')][_0x4693('0x50')]){_0x4e820c[_0x4693('0x51')]=_[_0x4693('0x52')](_0x4e820c[_0x4693('0x51')],{'$or':_[_0x4693('0x44')](_0x4e820c[_0x4693('0x49')],function(_0x3640cc){var _0x29f2f7={};_0x29f2f7[_0x3640cc]={'$like':'%'+_0x369d98[_0x4693('0x46')][_0x4693('0x50')]+'%'};return _0x29f2f7;})});}_0x4e820c=_['merge']({},_0x4e820c,_0x369d98[_0x4693('0x54')]);return db[_0x4693('0x6b')][_0x4693('0x33')]({'where':_0x4e820c['where']})[_0x4693('0x24')](function(_0xf3db61){_0x2b9b4f[_0x4693('0x33')]=_0xf3db61;if(_0x369d98[_0x4693('0x46')][_0x4693('0x55')]){_0x4e820c['include']=[{'all':!![]}];}return db[_0x4693('0x6b')]['findAll'](_0x4e820c);})[_0x4693('0x24')](function(_0x533ece){_0x2b9b4f[_0x4693('0x6d')]=_0x533ece;return _0x2b9b4f;});}})[_0x4693('0x24')](respondWithFilteredResult(_0x2e432d,_0x4e820c))[_0x4693('0x57')](handleError(_0x2e432d,null));};exports['removeAnswers']=function(_0x332ae9,_0x1e677f,_0x80e490){return db[_0x4693('0x3f')][_0x4693('0x5e')]({'where':{'id':_0x332ae9[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x1e677f,null))[_0x4693('0x24')](function(_0x2cd678){if(_0x2cd678){return _0x2cd678[_0x4693('0x6e')](_0x332ae9[_0x4693('0x46')]['ids']);}})[_0x4693('0x24')](respondWithStatusCode(_0x1e677f,null))[_0x4693('0x57')](handleError(_0x1e677f,null));};exports[_0x4693('0x6f')]=function(_0x48857d,_0x58d8b6,_0x2642b5){var _0x2f206d={'body':_0x48857d[_0x4693('0x5b')],'channel':_0x4693('0x70')};var _0x3d0339=[];var _0x5f4c79=[];var _0x396e3f={};var _0x20b5fa=![];return db[_0x4693('0x71')][_0x4693('0x62')]()['then'](function(_0x12ada5){if(!_0x12ada5){throw new db[(_0x4693('0x72'))]['ValidationError'](_0x4693('0x73'));}_0x3d0339=_['difference'](_[_0x4693('0x45')](_0x12ada5),[_0x4693('0x74'),_0x4693('0x75')]);_0x5f4c79=_[_0x4693('0x76')](_[_0x4693('0x45')](_0x12ada5),[_0x4693('0x74'),_0x4693('0x75'),'CompanyId',_0x4693('0x77')]);if(_0x48857d[_0x4693('0x5b')]['id']){delete _0x48857d[_0x4693('0x5b')]['id'];}if(_[_0x4693('0x78')](_0x48857d[_0x4693('0x5b')][_0x4693('0x79')])){throw new db[(_0x4693('0x72'))][(_0x4693('0x7a'))](_0x4693('0x7b'));}if(_[_0x4693('0x78')](_0x48857d['body'][_0x4693('0x5b')])||_0x48857d[_0x4693('0x5b')]['body']===''){throw new db['Sequelize']['ValidationError'](_0x4693('0x7c'));}if(_[_0x4693('0x78')](_0x48857d['body'][_0x4693('0x7d')])){throw new db['Sequelize'][(_0x4693('0x7a'))](_0x4693('0x7e')+_0x5f4c79);}if(!_[_0x4693('0x7f')](_0x5f4c79,_0x48857d[_0x4693('0x5b')][_0x4693('0x7d')])){throw new db[(_0x4693('0x72'))]['ValidationError'](_0x4693('0x80')+_0x5f4c79);}_0x396e3f[_0x48857d['body']['mapKey']]=_0x48857d[_0x4693('0x5b')][_0x4693('0x79')];})[_0x4693('0x24')](function(){return db[_0x4693('0x3f')]['find']({'where':{'id':_0x48857d[_0x4693('0x59')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x4693('0x71')],'as':_0x4693('0x81'),'where':_0x396e3f,'limit':0x1,'order':[['updatedAt',_0x4693('0x82')]]}]},{'model':db['OpenchannelApplication'],'as':_0x4693('0x83')}]});})[_0x4693('0x24')](handleEntityNotFound(_0x58d8b6,null))['then'](function(_0x2c7a0f){if(_0x2c7a0f&&_0x2c7a0f[_0x4693('0x84')]){_0x2f206d[_0x4693('0x85')]=_0x2c7a0f;_0x2f206d['applications']=_0x2c7a0f['Applications'];_0x2f206d['list']=_0x2c7a0f[_0x4693('0x84')];_0x2f206d[_0x4693('0x86')]=_[_0x4693('0x87')](_0x2f206d[_0x4693('0x86')],[_0x4693('0x88')],['asc']);if(_0x2f206d['account']['Applications']){delete _0x2f206d[_0x4693('0x85')][_0x4693('0x83')];}if(_0x2f206d[_0x4693('0x85')]['List']&&_0x2f206d[_0x4693('0x85')][_0x4693('0x84')][_0x4693('0x81')][_0x4693('0x4a')]){return _0x2f206d[_0x4693('0x85')][_0x4693('0x84')][_0x4693('0x81')][0x0];}var _0x304df7=_[_0x4693('0x1b')](_0x48857d[_0x4693('0x5b')],{'firstName':_0x48857d[_0x4693('0x5b')]['from'],'ListId':_0x2c7a0f[_0x4693('0x77')]});_0x304df7[_0x48857d['body'][_0x4693('0x7d')]]=_0x48857d[_0x4693('0x5b')][_0x4693('0x79')];return db['CmContact'][_0x4693('0x5a')](_0x304df7,{'fields':_0x3d0339,'raw':!![]});}})['then'](handleEntityNotFound(_0x58d8b6,null))[_0x4693('0x24')](function(_0x4bed7f){_0x2f206d[_0x4693('0x89')]=_0x4bed7f;if(_0x4bed7f){var _0x93c94={'ContactId':_0x4bed7f['id'],'OpenchannelAccountId':_0x48857d[_0x4693('0x59')]['id'],'from':(_0x4bed7f[_0x4693('0x8a')]||'')+'\x20'+(_0x4bed7f[_0x4693('0x8b')]||'')};var _0x37f7e6={'OpenchannelAccountId':_0x48857d[_0x4693('0x59')]['id'],'closed':![]};if(_0x48857d[_0x4693('0x5b')][_0x4693('0x8c')]){_0x37f7e6[_0x4693('0x8c')]=_0x48857d[_0x4693('0x5b')]['threadId'];return db[_0x4693('0x8d')][_0x4693('0x5e')]({'where':_0x37f7e6})['then'](function(_0x4e0340){if(_0x4e0340){return[_0x4e0340,![]];}_0x93c94[_0x4693('0x8c')]=_0x48857d['body'][_0x4693('0x8c')];_0x93c94[_0x4693('0x8e')]=_0x48857d[_0x4693('0x5b')][_0x4693('0x8e')];return db['OpenchannelInteraction'][_0x4693('0x5a')](_0x93c94)[_0x4693('0x24')](function(_0x2b4bb3){return[_0x2b4bb3,!![]];});});}else{_0x37f7e6[_0x4693('0x8c')]=null;}_0x37f7e6[_0x4693('0x8f')]=_0x4bed7f['id'];return db[_0x4693('0x8d')][_0x4693('0x5e')]({'where':_0x37f7e6})[_0x4693('0x24')](function(_0x3c8ed1){if(_0x3c8ed1){return[_0x3c8ed1,![]];}return db[_0x4693('0x8d')][_0x4693('0x5a')](_0x93c94)[_0x4693('0x24')](function(_0x216535){return[_0x216535,!![]];});});}})['spread'](function(_0x419683,_0x3f8936){if(_0x419683){_0x20b5fa=_0x3f8936;if(!_0x3f8936){var _0x291557={'from':(_0x2f206d[_0x4693('0x89')][_0x4693('0x8a')]||'')+'\x20'+(_0x2f206d[_0x4693('0x89')][_0x4693('0x8b')]||'')};if(_0x48857d[_0x4693('0x5b')]['threadId']&&_0x48857d[_0x4693('0x5b')][_0x4693('0x90')]&&_0x48857d['body'][_0x4693('0x8c')]!=_0x48857d[_0x4693('0x5b')]['messageId']){_0x291557[_0x4693('0x8c')]=_0x48857d[_0x4693('0x5b')][_0x4693('0x90')];}return _0x419683['update'](_0x291557);}else{return _0x419683;}}})['then'](function(_0x4dd234){_0x2f206d['interaction']=_0x4dd234['get']({'plain':!![]});_0x2f206d['interaction'][_0x4693('0x91')]=_0x20b5fa;if(_0x2f206d[_0x4693('0x92')][_0x4693('0x91')]){if(_0x2f206d[_0x4693('0x85')]['autoclose']){_0x2f206d['applications'][_0x4693('0x93')]({'id':0x0,'priority':_0x2f206d['applications'][_0x4693('0x4a')]+0x1,'app':_0x4693('0x94'),'appdata':'unmanaged','interval':_0x4693('0x95')});}}return db[_0x4693('0x96')][_0x4693('0x5a')]({'body':_0x48857d[_0x4693('0x5b')][_0x4693('0x5b')],'OpenchannelAccountId':_0x48857d[_0x4693('0x59')]['id'],'OpenchannelInteractionId':_0x4dd234['id'],'direction':'in','ContactId':_0x2f206d['contact']['id'],'AttachmentId':_0x48857d['body'][_0x4693('0x97')]});})['then'](function(_0x2ca14b){_0x2f206d[_0x4693('0x2b')]=_0x2ca14b;if(!_0x2f206d[_0x4693('0x92')][_0x4693('0x98')])return;return db[_0x4693('0x99')][_0x4693('0x5e')]({'attributes':['id',_0x4693('0x3c')],'where':{'id':_0x2f206d[_0x4693('0x92')][_0x4693('0x98')]}});})['then'](function(_0x185f21){if(_0x185f21){_0x2f206d[_0x4693('0x86')][_0x4693('0x9a')]({'id':0x0,'priority':0x0,'app':_0x4693('0x9b'),'appdata':_0x185f21[_0x4693('0x3c')]+','+(_0x2f206d['account'][_0x4693('0x9c')]||0xa),'interval':_0x4693('0x95')});}if(!_0x2f206d[_0x4693('0x92')]['queueId'])return;return db[_0x4693('0x9d')][_0x4693('0x5e')]({'attributes':['id',_0x4693('0x3c')],'where':{'id':_0x2f206d[_0x4693('0x92')][_0x4693('0x9e')]}});})[_0x4693('0x24')](function(_0x2e17c6){if(_0x2e17c6){_0x2f206d[_0x4693('0x86')]['unshift']({'id':0x0,'priority':0x1,'app':_0x4693('0x9f'),'appdata':_0x2e17c6[_0x4693('0x3c')]+','+(_0x2f206d[_0x4693('0x85')]['waitForTheAssignedQueue']||0x12c),'interval':_0x4693('0x95')});}return respondWithRpcPromise(_0x4693('0xa0'),_0x4693('0xa1'),_0x2f206d);})['then'](function(_0x2d1b8){respondWithRpcPromise(_0x4693('0xa2'),_0x4693('0xa2'),{'event':_0x4693('0x6f'),'message':_0x2d1b8},client9002);return _0x2d1b8;})[_0x4693('0x24')](respondWithResult(_0x58d8b6,null))[_0x4693('0x57')](handleError(_0x58d8b6,null));};exports[_0x4693('0xa3')]=function(_0x56c7e1,_0x42b472){var _0x453889=_0x56c7e1[_0x4693('0x59')]['id'];var _0x5da694=_0x56c7e1[_0x4693('0x5b')];var _0x579c42=0xc8;var _0x97736a=null;return db[_0x4693('0xa4')]['transaction']({'isolationLevel':db[_0x4693('0xa4')][_0x4693('0xa5')]['ISOLATION_LEVELS'][_0x4693('0xa6')]},function(_0x5d526e){return db[_0x4693('0x3f')][_0x4693('0x65')]({'where':{'id':_0x453889},'transaction':_0x5d526e})[_0x4693('0x24')](function(_0x5e3976){if(_0x5e3976){return db[_0x4693('0xa7')][_0x4693('0x38')]({'where':{'OpenchannelAccountId':_0x453889},'transaction':_0x5d526e})[_0x4693('0x24')](function(){var _0x30ec1e=_[_0x4693('0x44')](_0x5da694,function(_0x47f2f1){_0x47f2f1['OpenchannelAccountId']=_0x453889;return _0x47f2f1;});return db[_0x4693('0xa7')][_0x4693('0xa8')](_0x30ec1e,{'transaction':_0x5d526e});});}else{_0x579c42=0x194;_0x97736a=[];}});})[_0x4693('0x24')](function(){if(_0x579c42!==0x194){return db['OpenchannelApplication'][_0x4693('0xa9')]({'where':{'OpenchannelAccountId':_0x453889},'order':_0x4693('0x88')})[_0x4693('0x24')](function(_0x5a33d9){_0x97736a=_0x5a33d9;});}})[_0x4693('0x57')](function(_0x51953f){_0x579c42=0x1f4;logger[_0x4693('0x29')](_0x51953f['stack']);if(_0x51953f['name']){delete _0x51953f[_0x4693('0x3c')];}_0x97736a=_0x51953f;})['finally'](function(){if(_0x97736a===null){_0x42b472[_0x4693('0x3a')](_0x579c42);}else{if(_0x579c42===0x1f4){_0x42b472[_0x4693('0x2d')](_0x579c42)[_0x4693('0x3d')](_0x97736a);}else{_0x42b472[_0x4693('0x2d')](_0x579c42)[_0x4693('0x2f')](_0x97736a);}}});};exports[_0x4693('0xaa')]=function(_0x5bdb53,_0x4a8822,_0x7a9669){var _0x74a024={};var _0x401520={};var _0xa153eb;var _0x5883a2;return db[_0x4693('0x3f')][_0x4693('0x65')]({'where':{'id':_0x5bdb53[_0x4693('0x59')]['id']}})['then'](handleEntityNotFound(_0x4a8822,null))[_0x4693('0x24')](function(_0x16f5b3){if(_0x16f5b3){_0xa153eb=_0x16f5b3;_0x401520[_0x4693('0x43')]=_[_0x4693('0x45')](db[_0x4693('0xa7')]['rawAttributes']);_0x401520[_0x4693('0x46')]=_[_0x4693('0x45')](_0x5bdb53['query']);_0x401520[_0x4693('0x4f')]=_[_0x4693('0x47')](_0x401520[_0x4693('0x43')],_0x401520['query']);_0x74a024[_0x4693('0x49')]=_[_0x4693('0x47')](_0x401520[_0x4693('0x43')],qs[_0x4693('0x48')](_0x5bdb53[_0x4693('0x46')][_0x4693('0x48')]));_0x74a024[_0x4693('0x49')]=_0x74a024[_0x4693('0x49')][_0x4693('0x4a')]?_0x74a024['attributes']:_0x401520['model'];_0x74a024[_0x4693('0x4d')]=qs[_0x4693('0x4e')](_0x5bdb53['query'][_0x4693('0x4e')]);_0x74a024[_0x4693('0x51')]=qs['filters'](_[_0x4693('0x66')](_0x5bdb53['query'],_0x401520[_0x4693('0x4f')]));if(_0x5bdb53[_0x4693('0x46')]['filter']){_0x74a024[_0x4693('0x51')]=_[_0x4693('0x52')](_0x74a024['where'],{'$or':_[_0x4693('0x44')](_0x74a024['attributes'],function(_0x277699){var _0x7c31ca={};_0x7c31ca[_0x277699]={'$like':'%'+_0x5bdb53['query']['filter']+'%'};return _0x7c31ca;})});}_0x74a024=_[_0x4693('0x52')]({},_0x74a024,_0x5bdb53[_0x4693('0x54')]);return _0xa153eb[_0x4693('0xaa')](_0x74a024);}})[_0x4693('0x24')](function(_0x390b41){if(_0x390b41){_0x5883a2=_0x390b41['length'];if(!_0x5bdb53['query'][_0x4693('0x4b')]('nolimit')){_0x74a024[_0x4693('0x32')]=qs[_0x4693('0x32')](_0x5bdb53[_0x4693('0x46')]['limit']);_0x74a024[_0x4693('0x30')]=qs[_0x4693('0x30')](_0x5bdb53[_0x4693('0x46')][_0x4693('0x30')]);}return _0xa153eb['getApplications'](_0x74a024);}})[_0x4693('0x24')](function(_0x7c94f1){if(_0x7c94f1){return _0x7c94f1?{'count':_0x5883a2,'rows':_0x7c94f1}:null;}})[_0x4693('0x24')](respondWithResult(_0x4a8822,null))[_0x4693('0x57')](handleError(_0x4a8822,null));};exports[_0x4693('0xab')]=function(_0x6fdf28,_0x18d864,_0x3de06d){var _0x1e43e9={'raw':![],'where':{}};var _0x53abf4={};var _0x2315f7={'count':0x0,'rows':[]};return db[_0x4693('0x3f')][_0x4693('0x65')]({'where':{'id':_0x6fdf28[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x18d864,null))[_0x4693('0x24')](function(_0x334b34){if(_0x334b34){_0x53abf4[_0x4693('0x43')]=_[_0x4693('0x45')](db[_0x4693('0x8d')]['rawAttributes']);_0x53abf4[_0x4693('0x46')]=_[_0x4693('0x45')](_0x6fdf28[_0x4693('0x46')]);_0x53abf4['filters']=_['intersection'](_0x53abf4[_0x4693('0x43')],_0x53abf4[_0x4693('0x46')]);_0x1e43e9['attributes']=_[_0x4693('0x47')](_0x53abf4[_0x4693('0x43')],qs[_0x4693('0x48')](_0x6fdf28[_0x4693('0x46')][_0x4693('0x48')]));_0x1e43e9['attributes']=_0x1e43e9[_0x4693('0x49')][_0x4693('0x4a')]?_0x1e43e9[_0x4693('0x49')]:_0x53abf4[_0x4693('0x43')];if(!_0x6fdf28['query'][_0x4693('0x4b')](_0x4693('0x4c'))){_0x1e43e9[_0x4693('0x32')]=qs[_0x4693('0x32')](_0x6fdf28['query'][_0x4693('0x32')]);_0x1e43e9[_0x4693('0x30')]=qs['offset'](_0x6fdf28[_0x4693('0x46')]['offset']);}_0x1e43e9[_0x4693('0x4d')]=qs[_0x4693('0x4e')](_0x6fdf28[_0x4693('0x46')][_0x4693('0x4e')]);_0x1e43e9[_0x4693('0x51')]=qs[_0x4693('0x4f')](_[_0x4693('0x66')](_0x6fdf28['query'],_0x53abf4['filters']));_0x1e43e9[_0x4693('0x51')][_0x4693('0x67')]=_0x334b34['id'];if(_0x6fdf28['query'][_0x4693('0x50')]){_0x1e43e9['where']=_[_0x4693('0x52')](_0x1e43e9['where'],{'$or':_[_0x4693('0x44')](_0x1e43e9[_0x4693('0x49')],function(_0x9d84de){var _0x2befdf={};_0x2befdf[_0x9d84de]={'$like':'%'+_0x6fdf28[_0x4693('0x46')][_0x4693('0x50')]+'%'};return _0x2befdf;})});}_0x1e43e9=_[_0x4693('0x52')]({},_0x1e43e9,_0x6fdf28['options']);return db[_0x4693('0x8d')][_0x4693('0x33')]({'where':_0x1e43e9[_0x4693('0x51')]})[_0x4693('0x24')](function(_0x3f8b65){_0x2315f7['count']=_0x3f8b65;if(_0x6fdf28[_0x4693('0x46')][_0x4693('0x55')]){_0x1e43e9[_0x4693('0x56')]=[{'model':db[_0x4693('0x71')],'as':_0x4693('0xac'),'required':![]},{'model':db[_0x4693('0x99')],'as':_0x4693('0xad'),'attributes':[_0x4693('0x3c'),_0x4693('0xae'),_0x4693('0xaf')],'required':![]},{'model':db[_0x4693('0xb0')],'as':_0x4693('0xb1'),'attributes':['id',_0x4693('0x3c'),_0x4693('0xb2')],'where':_0x6fdf28['query']['tag']?{'id':_0x6fdf28[_0x4693('0x46')]['tag']}:undefined,'required':_0x6fdf28[_0x4693('0x46')]['tag']?!![]:![]}];}return db[_0x4693('0x8d')][_0x4693('0x68')](_0x1e43e9);})[_0x4693('0x24')](function(_0x44f743){_0x2315f7[_0x4693('0x6d')]=_0x44f743;return _0x2315f7;});}})[_0x4693('0x24')](respondWithFilteredResult(_0x18d864,_0x1e43e9))[_0x4693('0x57')](handleError(_0x18d864,null));};exports[_0x4693('0xb3')]=function(_0x55b553,_0x130830,_0x1949cb){return db[_0x4693('0x3f')][_0x4693('0x5e')]({'where':{'id':_0x55b553[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x130830,null))[_0x4693('0x24')](function(_0x1f58f8){if(_0x1f58f8){return _0x1f58f8[_0x4693('0xb3')](_0x55b553[_0x4693('0x5b')][_0x4693('0xb4')],_[_0x4693('0xb5')](_0x55b553[_0x4693('0x5b')],['ids','id'])||{})['spread'](function(_0x181fa2){for(var _0x14dc45=0x0;_0x14dc45<_0x55b553['body'][_0x4693('0xb4')][_0x4693('0x4a')];_0x14dc45+=0x1){socket['emit'](_0x4693('0xb6'),{'UserId':Number(_0x55b553[_0x4693('0x5b')][_0x4693('0xb4')][_0x14dc45]),'OpenchannelAccountId':Number(_0x55b553[_0x4693('0x59')]['id'])});}return _0x181fa2;});}})[_0x4693('0x24')](respondWithResult(_0x130830,null))[_0x4693('0x57')](handleError(_0x130830,null));};exports[_0x4693('0xb7')]=function(_0x1942e1,_0x34f617,_0x163e3a){return db['OpenchannelAccount']['find']({'where':{'id':_0x1942e1[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x34f617,null))['then'](function(_0xc27dac){if(_0xc27dac){return _0xc27dac['removeAgents'](_0x1942e1[_0x4693('0x46')][_0x4693('0xb4')])['then'](function(){if(_['isArray'](_0x1942e1[_0x4693('0x46')][_0x4693('0xb4')])){for(var _0x4c35b7=0x0;_0x4c35b7<_0x1942e1['query'][_0x4693('0xb4')]['length'];_0x4c35b7+=0x1){socket['emit'](_0x4693('0xb8'),{'UserId':Number(_0x1942e1[_0x4693('0x46')][_0x4693('0xb4')][_0x4c35b7]),'OpenchannelAccountId':Number(_0x1942e1['params']['id'])});}}else{socket[_0x4693('0xb9')](_0x4693('0xb8'),{'UserId':Number(_0x1942e1['query'][_0x4693('0xb4')]),'OpenchannelAccountId':Number(_0x1942e1[_0x4693('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x34f617,null))['catch'](handleError(_0x34f617,null));};exports[_0x4693('0xba')]=function(_0x2faa02,_0x51aadc,_0x47da67){var _0x16fb33={};var _0x53fc9e={};var _0x687a02;var _0x39317f;return db[_0x4693('0x3f')][_0x4693('0x65')]({'where':{'id':_0x2faa02[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x51aadc,null))['then'](function(_0x2ed55c){if(_0x2ed55c){_0x687a02=_0x2ed55c;_0x53fc9e[_0x4693('0x43')]=_[_0x4693('0x45')](db[_0x4693('0x99')]['rawAttributes']);_0x53fc9e[_0x4693('0x46')]=_[_0x4693('0x45')](_0x2faa02[_0x4693('0x46')]);_0x53fc9e[_0x4693('0x4f')]=_[_0x4693('0x47')](_0x53fc9e[_0x4693('0x43')],_0x53fc9e[_0x4693('0x46')]);_0x16fb33[_0x4693('0x49')]=_[_0x4693('0x47')](_0x53fc9e[_0x4693('0x43')],qs['fields'](_0x2faa02[_0x4693('0x46')][_0x4693('0x48')]));_0x16fb33[_0x4693('0x49')]=_0x16fb33['attributes'][_0x4693('0x4a')]?_0x16fb33[_0x4693('0x49')]:_0x53fc9e['model'];_0x16fb33[_0x4693('0x4d')]=qs[_0x4693('0x4e')](_0x2faa02['query']['sort']);_0x16fb33['where']=qs[_0x4693('0x4f')](_[_0x4693('0x66')](_0x2faa02[_0x4693('0x46')],_0x53fc9e[_0x4693('0x4f')]));if(_0x2faa02['query'][_0x4693('0x50')]){_0x16fb33['where']=_[_0x4693('0x52')](_0x16fb33[_0x4693('0x51')],{'$or':_['map'](_0x16fb33[_0x4693('0x49')],function(_0x2e590c){var _0x47619a={};_0x47619a[_0x2e590c]={'$like':'%'+_0x2faa02['query'][_0x4693('0x50')]+'%'};return _0x47619a;})});}_0x16fb33=_[_0x4693('0x52')]({},_0x16fb33,_0x2faa02['options']);return _0x687a02[_0x4693('0xba')](_0x16fb33);}})[_0x4693('0x24')](function(_0x4a7f07){if(_0x4a7f07){_0x39317f=_0x4a7f07['length'];if(!_0x2faa02[_0x4693('0x46')][_0x4693('0x4b')]('nolimit')){_0x16fb33['limit']=qs['limit'](_0x2faa02[_0x4693('0x46')][_0x4693('0x32')]);_0x16fb33[_0x4693('0x30')]=qs[_0x4693('0x30')](_0x2faa02[_0x4693('0x46')][_0x4693('0x30')]);}return _0x687a02['getAgents'](_0x16fb33);}})[_0x4693('0x24')](function(_0x579358){if(_0x579358){return _0x579358?{'count':_0x39317f,'rows':_0x579358}:null;}})[_0x4693('0x24')](respondWithResult(_0x51aadc,null))['catch'](handleError(_0x51aadc,null));};exports[_0x4693('0x3d')]=function(_0x549310,_0x1feff5,_0x4ee44e){var _0x473813,_0x5d406e,_0x5932da;if(_[_0x4693('0x78')](_0x549310['body'][_0x4693('0x5b')])||_0x549310[_0x4693('0x5b')]['body']===''){throw new db[(_0x4693('0x72'))][(_0x4693('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4693('0x78')](_0x549310[_0x4693('0x5b')]['to'])){}_0x473813=_0x549310[_0x4693('0x5b')]['to'];return db[_0x4693('0x3f')][_0x4693('0x65')]({'where':{'id':_0x549310[_0x4693('0x59')]['id']}})[_0x4693('0x24')](handleEntityNotFound(_0x1feff5,null))[_0x4693('0x24')](function(_0x304c06){if(_0x304c06){return db[_0x4693('0x3f')][_0x4693('0x5e')]({'where':{'id':_0x304c06['id']},'include':[{'model':db[_0x4693('0xbb')],'as':_0x4693('0x84'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x304c06[_0x4693('0x7d')]]:_0x473813},'limit':0x1,'order':[[_0x4693('0x75'),_0x4693('0x82')]]}]}]})[_0x4693('0x24')](handleEntityNotFound(_0x1feff5,null))[_0x4693('0x24')](function(_0xf46512){if(_0xf46512&&_0xf46512[_0x4693('0x84')]){_0x5d406e=_0xf46512[_0x4693('0x39')]({'plain':!![]});if(_0x5d406e['List']&&_0x5d406e[_0x4693('0x84')][_0x4693('0x81')][_0x4693('0x4a')]){return _0x5d406e[_0x4693('0x84')]['Contacts'][0x0];}return db['CmContact'][_0x4693('0x5a')](_[_0x4693('0x1b')](_0x549310[_0x4693('0x5b')],{'firstName':_0x473813,[_0xf46512[_0x4693('0x7d')]]:_0x473813,'phone':_0x473813,'ListId':_0x5d406e[_0x4693('0x77')]}));}})['then'](handleEntityNotFound(_0x1feff5,null))['then'](function(_0x5e878e){if(_0x5e878e){_0x5932da=_0x5e878e;return db[_0x4693('0x8d')][_0x4693('0x5e')]({'where':{'ContactId':_0x5932da['id'],'closed':![],'OpenchannelAccountId':_0x5d406e['id']}})[_0x4693('0x24')](function(_0x49fea6){if(_0x49fea6){return[_0x49fea6,![]];}return db[_0x4693('0x8d')][_0x4693('0x5a')]({'UserId':_0x549310[_0x4693('0x5d')]['id'],'ContactId':_0x5932da['id'],'OpenchannelAccountId':_0x5d406e['id'],'lastMsgDirection':'out','firstMsgDirection':_0x4693('0xbc'),'Messages':[_[_0x4693('0x52')](_0x549310[_0x4693('0x5b')],{'read':![],'body':_0x549310[_0x4693('0x5b')]['body'],'OpenchannelAccountId':_0x5d406e['id'],'UserId':_0x549310[_0x4693('0x5d')]['id'],'ContactId':_0x5932da['id']})]},{'include':[{'model':db[_0x4693('0x96')],'as':'Messages'}]})[_0x4693('0x24')](function(_0x5613ab){return[_0x5613ab,!![]];});});}})[_0x4693('0xbd')](function(_0x54820a,_0x2831ab){if(_0x2831ab){return _0x54820a;}return db[_0x4693('0x96')]['create'](_[_0x4693('0x52')](_0x549310[_0x4693('0x5b')],{'read':![],'body':_0x549310[_0x4693('0x5b')][_0x4693('0x5b')],'OpenchannelAccountId':_0x5d406e['id'],'OpenchannelInteractionId':_0x54820a['id'],'UserId':_0x549310['user']['id'],'ContactId':_0x5932da['id']}))['then'](function(_0x8dd131){_0x54820a[_0x4693('0xbe')][_0x4693('0xbf')]=[];_0x54820a['dataValues'][_0x4693('0xbf')][_0x4693('0x93')](_0x8dd131[_0x4693('0xbe')]);return _0x54820a;});});}})[_0x4693('0x24')](respondWithResult(_0x1feff5,null))[_0x4693('0x57')](handleError(_0x1feff5,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index f7a5482..70d564b 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 _0x5b02=['exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','remove','emit','hook'];(function(_0x55d478,_0x516f1b){var _0x3b35b3=function(_0x1738b6){while(--_0x1738b6){_0x55d478['push'](_0x55d478['shift']());}};_0x3b35b3(++_0x516f1b);}(_0x5b02,0xe9));var _0x25b0=function(_0x54f915,_0x43e96d){_0x54f915=_0x54f915-0x0;var _0x4bbc37=_0x5b02[_0x54f915];return _0x4bbc37;};'use strict';var EventEmitter=require(_0x25b0('0x0'));var OpenchannelAccount=require(_0x25b0('0x1'))['db'][_0x25b0('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x25b0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x25b0('0x4')};function emitEvent(_0x53493e){return function(_0x3e1d20,_0x31c9c2,_0x38dc14){OpenchannelAccountEvents[_0x25b0('0x5')](_0x53493e+':'+_0x3e1d20['id'],_0x3e1d20);OpenchannelAccountEvents[_0x25b0('0x5')](_0x53493e,_0x3e1d20);_0x38dc14(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x25b0('0x6')](e,emitEvent(event));}}module[_0x25b0('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x6f7a=['events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x3690a2,_0x2af11f){_0x3690a2=_0x3690a2-0x0;var _0x5c48de=_0x6f7a[_0x3690a2];return _0x5c48de;};'use strict';var EventEmitter=require(_0xa6f7('0x0'));var OpenchannelAccount=require(_0xa6f7('0x1'))['db'][_0xa6f7('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xa6f7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa6f7('0x4'),'afterDestroy':_0xa6f7('0x5')};function emitEvent(_0x12ecb8){return function(_0x1da6dc,_0x22e529,_0x1f5922){OpenchannelAccountEvents[_0xa6f7('0x6')](_0x12ecb8+':'+_0x1da6dc['id'],_0x1da6dc);OpenchannelAccountEvents[_0xa6f7('0x6')](_0x12ecb8,_0x1da6dc);_0x1f5922(null);};}for(var e in events){if(events[_0xa6f7('0x7')](e)){var event=events[e];OpenchannelAccount[_0xa6f7('0x8')](e,emitEvent(event));}}module[_0xa6f7('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 6620b06..a94d07e 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(_0x4751a0,_0x30ed45){var _0x147a09=function(_0x40d030){while(--_0x40d030){_0x4751a0['push'](_0x4751a0['shift']());}};_0x147a09(++_0x30ed45);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x1205ab,_0x296de5){var _0x2be0ac=function(_0x34639f){while(--_0x34639f){_0x1205ab['push'](_0x1205ab['shift']());}};_0x2be0ac(++_0x296de5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 e9a6dd7..0a34a00 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 _0x13f6=['code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','socket.io-emitter','redis','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x18a397,_0x4f7413){var _0x50a9b7=function(_0x124dfd){while(--_0x124dfd){_0x18a397['push'](_0x18a397['shift']());}};_0x50a9b7(++_0x4f7413);}(_0x13f6,0x124));var _0x613f=function(_0xc434e4,_0x470cae){_0xc434e4=_0xc434e4-0x0;var _0x21b400=_0x13f6[_0xc434e4];return _0x21b400;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x613f('0x2'));var fs=require('fs');var Redis=require(_0x613f('0x3'));var db=require(_0x613f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x613f('0x5'))(_0x613f('0x6'));var config=require(_0x613f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613f('0x8')][_0x613f('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x613f('0xa'))(new Redis(config[_0x613f('0xb')]));require(_0x613f('0xc'))[_0x613f('0xd')](socket);function respondWithRpcPromise(_0x4e98ce,_0x1a8dd0,_0x40d7f5){return new BPromise(function(_0xcd514c,_0x5210a0){return client[_0x613f('0xe')](_0x4e98ce,_0x40d7f5)[_0x613f('0xf')](function(_0x31875a){logger['info'](_0x613f('0x10'),_0x1a8dd0,_0x613f('0x11'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x1a8dd0,'request\x20sent',JSON[_0x613f('0x12')](_0x31875a));if(_0x31875a[_0x613f('0x13')]){if(_0x31875a[_0x613f('0x13')][_0x613f('0x14')]===0x1f4){logger[_0x613f('0x13')](_0x613f('0x10'),_0x1a8dd0,_0x31875a[_0x613f('0x13')][_0x613f('0x15')]);return _0x5210a0(_0x31875a[_0x613f('0x13')][_0x613f('0x15')]);}logger['error'](_0x613f('0x10'),_0x1a8dd0,_0x31875a['error']['message']);return _0xcd514c(_0x31875a[_0x613f('0x13')][_0x613f('0x15')]);}else{logger['info'](_0x613f('0x10'),_0x1a8dd0,'request\x20sent');_0xcd514c(_0x31875a[_0x613f('0x16')][_0x613f('0x15')]);}})[_0x613f('0x17')](function(_0x2a47f4){logger[_0x613f('0x13')](_0x613f('0x10'),_0x1a8dd0,_0x2a47f4);_0x5210a0(_0x2a47f4);});});} \ No newline at end of file +var _0x84a0=['redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http'];(function(_0x43918d,_0x3dcef8){var _0x20947e=function(_0x246332){while(--_0x246332){_0x43918d['push'](_0x43918d['shift']());}};_0x20947e(++_0x3dcef8);}(_0x84a0,0x66));var _0x084a=function(_0x4f9208,_0x6eadec){_0x4f9208=_0x4f9208-0x0;var _0x3f01f8=_0x84a0[_0x4f9208];return _0x3f01f8;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var moment=require(_0x084a('0x2'));var BPromise=require(_0x084a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x084a('0x4'));var db=require(_0x084a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x084a('0x6'));var config=require(_0x084a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x084a('0x8')][_0x084a('0x9')]({'port':0x232a});config[_0x084a('0xa')]=_[_0x084a('0xb')](config[_0x084a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x084a('0xc'))(new Redis(config[_0x084a('0xa')]));require(_0x084a('0xd'))[_0x084a('0xe')](socket);function respondWithRpcPromise(_0x142127,_0x4c1e29,_0x4dd423){return new BPromise(function(_0x3d9dc6,_0x853df){return client[_0x084a('0xf')](_0x142127,_0x4dd423)[_0x084a('0x10')](function(_0x2d7c90){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x4c1e29,_0x084a('0x11'));logger[_0x084a('0x12')](_0x084a('0x13'),_0x4c1e29,_0x084a('0x11'),JSON[_0x084a('0x14')](_0x2d7c90));if(_0x2d7c90[_0x084a('0x15')]){if(_0x2d7c90[_0x084a('0x15')][_0x084a('0x16')]===0x1f4){logger['error'](_0x084a('0x17'),_0x4c1e29,_0x2d7c90['error'][_0x084a('0x18')]);return _0x853df(_0x2d7c90[_0x084a('0x15')][_0x084a('0x18')]);}logger[_0x084a('0x15')](_0x084a('0x17'),_0x4c1e29,_0x2d7c90['error'][_0x084a('0x18')]);return _0x3d9dc6(_0x2d7c90['error'][_0x084a('0x18')]);}else{logger[_0x084a('0x19')]('OpenchannelAccount,\x20%s,\x20%s',_0x4c1e29,_0x084a('0x11'));_0x3d9dc6(_0x2d7c90[_0x084a('0x1a')][_0x084a('0x18')]);}})[_0x084a('0x1b')](function(_0x33d3a6){logger[_0x084a('0x15')](_0x084a('0x17'),_0x4c1e29,_0x33d3a6);_0x853df(_0x33d3a6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 64020fd..f32b1f0 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 _0xe9f9=['./openchannelAccount.events','remove','update','removeListener','register','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe9f9,0x174));var _0x9e9f=function(_0x125fcb,_0x49946a){_0x125fcb=_0x125fcb-0x0;var _0x61d085=_0xe9f9[_0x125fcb];return _0x61d085;};'use strict';var OpenchannelAccountEvents=require(_0x9e9f('0x0'));var events=['save',_0x9e9f('0x1'),_0x9e9f('0x2')];function createListener(_0x24e489,_0x439590){return function(_0x15d8d0){_0x439590['emit'](_0x24e489,_0x15d8d0);};}function removeListener(_0x2020b3,_0x47f4c7){return function(){OpenchannelAccountEvents[_0x9e9f('0x3')](_0x2020b3,_0x47f4c7);};}exports[_0x9e9f('0x4')]=function(_0x549ea5){for(var _0x32da7a=0x0,_0x54f87c=events[_0x9e9f('0x5')];_0x32da7a<_0x54f87c;_0x32da7a++){var _0x661886=events[_0x32da7a];var _0x10d43b=createListener('openchannelAccount:'+_0x661886,_0x549ea5);OpenchannelAccountEvents['on'](_0x661886,_0x10d43b);}}; \ No newline at end of file +var _0x422f=['update','emit','removeListener','register','openchannelAccount:','save'];(function(_0x5721eb,_0x176164){var _0x5edfd2=function(_0xba44b4){while(--_0xba44b4){_0x5721eb['push'](_0x5721eb['shift']());}};_0x5edfd2(++_0x176164);}(_0x422f,0x1c7));var _0xf422=function(_0x35b08a,_0xd824d1){_0x35b08a=_0x35b08a-0x0;var _0x20bc1a=_0x422f[_0x35b08a];return _0x20bc1a;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xf422('0x0'),'remove',_0xf422('0x1')];function createListener(_0x2148ba,_0x55031a){return function(_0x23acfa){_0x55031a[_0xf422('0x2')](_0x2148ba,_0x23acfa);};}function removeListener(_0x312bc8,_0x444ad5){return function(){OpenchannelAccountEvents[_0xf422('0x3')](_0x312bc8,_0x444ad5);};}exports[_0xf422('0x4')]=function(_0x3e3e5d){for(var _0x13ed91=0x0,_0x350b2d=events['length'];_0x13ed91<_0x350b2d;_0x13ed91++){var _0x3f4801=events[_0x13ed91];var _0x1037fa=createListener(_0xf422('0x5')+_0x3f4801,_0x3e3e5d);OpenchannelAccountEvents['on'](_0x3f4801,_0x1037fa);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 15642f9..aab3144 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 _0x8a13=['get','index','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller'];(function(_0x2ecf2f,_0x4aca42){var _0x3b9e70=function(_0x2fee17){while(--_0x2fee17){_0x2ecf2f['push'](_0x2ecf2f['shift']());}};_0x3b9e70(++_0x4aca42);}(_0x8a13,0x1d7));var _0x38a1=function(_0x3be82c,_0x3307d7){_0x3be82c=_0x3be82c-0x0;var _0x40d25a=_0x8a13[_0x3be82c];return _0x40d25a;};'use strict';var multer=require(_0x38a1('0x0'));var util=require('util');var path=require(_0x38a1('0x1'));var timeout=require(_0x38a1('0x2'));var express=require(_0x38a1('0x3'));var router=express[_0x38a1('0x4')]();var fs_extra=require(_0x38a1('0x5'));var auth=require(_0x38a1('0x6'));var interaction=require(_0x38a1('0x7'));var config=require('../../config/environment');var controller=require(_0x38a1('0x8'));router[_0x38a1('0x9')]('/',auth['isAuthenticated'](),controller[_0x38a1('0xa')]);router[_0x38a1('0x9')]('/:id',auth[_0x38a1('0xb')](),controller[_0x38a1('0xc')]);router[_0x38a1('0xd')]('/',auth[_0x38a1('0xb')](),controller[_0x38a1('0xe')]);router['put'](_0x38a1('0xf'),auth['isAuthenticated'](),controller[_0x38a1('0x10')]);router[_0x38a1('0x11')](_0x38a1('0xf'),auth[_0x38a1('0xb')](),controller[_0x38a1('0x12')]);module[_0x38a1('0x13')]=router; \ No newline at end of file +var _0xe064=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','create','put','update','destroy','exports','multer','path'];(function(_0x434db2,_0x113541){var _0x4e9284=function(_0x5d59b4){while(--_0x5d59b4){_0x434db2['push'](_0x434db2['shift']());}};_0x4e9284(++_0x113541);}(_0xe064,0x9e));var _0x4e06=function(_0x260e4b,_0x54668d){_0x260e4b=_0x260e4b-0x0;var _0x18dfba=_0xe064[_0x260e4b];return _0x18dfba;};'use strict';var multer=require(_0x4e06('0x0'));var util=require('util');var path=require(_0x4e06('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4e06('0x2')]();var fs_extra=require(_0x4e06('0x3'));var auth=require(_0x4e06('0x4'));var interaction=require(_0x4e06('0x5'));var config=require(_0x4e06('0x6'));var controller=require(_0x4e06('0x7'));router[_0x4e06('0x8')]('/',auth[_0x4e06('0x9')](),controller['index']);router['get'](_0x4e06('0xa'),auth[_0x4e06('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x4e06('0xb')]);router[_0x4e06('0xc')](_0x4e06('0xa'),auth[_0x4e06('0x9')](),controller[_0x4e06('0xd')]);router['delete']('/:id',auth[_0x4e06('0x9')](),controller[_0x4e06('0xe')]);module[_0x4e06('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index b54623c..9a4ff7c 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 _0x32bb=['*,*,*,*','sequelize','INTEGER','STRING'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x32bb,0x121));var _0xb32b=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0x32bb[_0x11f5ff];return _0x46eefb;};'use strict';var Sequelize=require(_0xb32b('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb32b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb32b('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb32b('0x2')]},'interval':{'type':Sequelize[_0xb32b('0x2')],'defaultValue':_0xb32b('0x3')}}; \ No newline at end of file +var _0x5a92=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x4e3a8a,_0xa6ad36){var _0x40de5e=function(_0xebbe7a){while(--_0xebbe7a){_0x4e3a8a['push'](_0x4e3a8a['shift']());}};_0x40de5e(++_0xa6ad36);}(_0x5a92,0xa6));var _0x25a9=function(_0x18f9b9,_0xe6c8ec){_0x18f9b9=_0x18f9b9-0x0;var _0x2f5790=_0x5a92[_0x18f9b9];return _0x2f5790;};'use strict';var Sequelize=require(_0x25a9('0x0'));module[_0x25a9('0x1')]={'priority':{'type':Sequelize[_0x25a9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x25a9('0x3')],'allowNull':![],'defaultValue':_0x25a9('0x4')},'appdata':{'type':Sequelize[_0x25a9('0x5')]()},'description':{'type':Sequelize[_0x25a9('0x3')]},'interval':{'type':Sequelize[_0x25a9('0x3')],'defaultValue':_0x25a9('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index e682abd..b07caf4 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 _0x550a=['json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','sendStatus','error','name','send','index','map','OpenchannelApplication','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','update','body','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x419d42,_0x3613dd){var _0x375fa5=function(_0x2ac540){while(--_0x2ac540){_0x419d42['push'](_0x419d42['shift']());}};_0x375fa5(++_0x3613dd);}(_0x550a,0x165));var _0xa550=function(_0x4f6827,_0x2a59e1){_0x4f6827=_0x4f6827-0x0;var _0x59cfd2=_0x550a[_0x4f6827];return _0x59cfd2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa550('0x0'));var zipdir=require(_0xa550('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa550('0x2'));var BPromise=require(_0xa550('0x3'));var Mustache=require(_0xa550('0x4'));var util=require(_0xa550('0x5'));var path=require(_0xa550('0x6'));var sox=require(_0xa550('0x7'));var csv=require(_0xa550('0x8'));var ejs=require(_0xa550('0x9'));var fs=require('fs');var fs_extra=require(_0xa550('0xa'));var _=require(_0xa550('0xb'));var squel=require(_0xa550('0xc'));var crypto=require('crypto');var jsforce=require(_0xa550('0xd'));var deskjs=require(_0xa550('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa550('0xf'));var Papa=require(_0xa550('0x10'));var Redis=require(_0xa550('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa550('0x12'));var as=require(_0xa550('0x13'));var hardwareService=require(_0xa550('0x14'));var logger=require(_0xa550('0x15'))('api');var utils=require(_0xa550('0x16'));var config=require(_0xa550('0x17'));var licenseUtil=require(_0xa550('0x18'));var db=require(_0xa550('0x19'))['db'];function respondWithStatusCode(_0x279338,_0x43fd08){_0x43fd08=_0x43fd08||0xcc;return function(_0xa4946e){if(_0xa4946e){return _0x279338['sendStatus'](_0x43fd08);}return _0x279338[_0xa550('0x1a')](_0x43fd08)[_0xa550('0x1b')]();};}function respondWithResult(_0x4a7fbb,_0x407405){_0x407405=_0x407405||0xc8;return function(_0xe5f128){if(_0xe5f128){return _0x4a7fbb[_0xa550('0x1a')](_0x407405)[_0xa550('0x1c')](_0xe5f128);}};}function respondWithFilteredResult(_0x5a5303,_0x59fed5){return function(_0x2a39a9){if(_0x2a39a9){var _0x50265d=typeof _0x59fed5['offset']===_0xa550('0x1d')&&typeof _0x59fed5[_0xa550('0x1e')]===_0xa550('0x1d');var _0x4d8a12=_0x2a39a9[_0xa550('0x1f')];var _0x4b9a71=_0x50265d?0x0:_0x59fed5['offset'];var _0x5e452b=_0x50265d?_0x2a39a9[_0xa550('0x1f')]:_0x59fed5[_0xa550('0x20')]+_0x59fed5[_0xa550('0x1e')];var _0x514ec3;if(_0x5e452b>=_0x4d8a12){_0x5e452b=_0x4d8a12;_0x514ec3=0xc8;}else{_0x514ec3=0xce;}_0x5a5303['status'](_0x514ec3);return _0x5a5303[_0xa550('0x21')](_0xa550('0x22'),_0x4b9a71+'-'+_0x5e452b+'/'+_0x4d8a12)['json'](_0x2a39a9);}return null;};}function patchUpdates(_0x36bd8f){return function(_0x180561){try{jsonpatch[_0xa550('0x23')](_0x180561,_0x36bd8f,!![]);}catch(_0x2f42ab){return BPromise[_0xa550('0x24')](_0x2f42ab);}return _0x180561[_0xa550('0x25')]();};}function saveUpdates(_0x592fe5,_0x2cb2ac){return function(_0x3967c6){if(_0x3967c6){return _0x3967c6['update'](_0x592fe5)[_0xa550('0x26')](function(_0x443354){return _0x443354;});}return null;};}function removeEntity(_0x28360d,_0x19ef15){return function(_0x492252){if(_0x492252){return _0x492252['destroy']()[_0xa550('0x26')](function(){_0x28360d['status'](0xcc)[_0xa550('0x1b')]();});}};}function handleEntityNotFound(_0x2c22f3,_0x3f3be6){return function(_0x3539fc){if(!_0x3539fc){_0x2c22f3[_0xa550('0x27')](0x194);}return _0x3539fc;};}function handleError(_0x58af50,_0x56fb59){_0x56fb59=_0x56fb59||0x1f4;return function(_0x49d765){logger[_0xa550('0x28')](_0x49d765['stack']);if(_0x49d765[_0xa550('0x29')]){delete _0x49d765[_0xa550('0x29')];}_0x58af50['status'](_0x56fb59)[_0xa550('0x2a')](_0x49d765);};}exports[_0xa550('0x2b')]=function(_0x267d67,_0x71b688){var _0x269502={},_0x30b032={},_0x2e6290={'count':0x0,'rows':[]};var _0x1ac1c5=_[_0xa550('0x2c')](db[_0xa550('0x2d')]['rawAttributes'],function(_0xddcd0b){return{'name':_0xddcd0b[_0xa550('0x2e')],'type':_0xddcd0b['type'][_0xa550('0x2f')]};});_0x30b032['model']=_[_0xa550('0x2c')](_0x1ac1c5,_0xa550('0x29'));_0x30b032[_0xa550('0x30')]=_[_0xa550('0x31')](_0x267d67['query']);_0x30b032[_0xa550('0x32')]=_[_0xa550('0x33')](_0x30b032[_0xa550('0x34')],_0x30b032[_0xa550('0x30')]);_0x269502[_0xa550('0x35')]=_[_0xa550('0x33')](_0x30b032[_0xa550('0x34')],qs[_0xa550('0x36')](_0x267d67[_0xa550('0x30')]['fields']));_0x269502[_0xa550('0x35')]=_0x269502['attributes'][_0xa550('0x37')]?_0x269502['attributes']:_0x30b032[_0xa550('0x34')];if(!_0x267d67[_0xa550('0x30')][_0xa550('0x38')](_0xa550('0x39'))){_0x269502[_0xa550('0x1e')]=qs[_0xa550('0x1e')](_0x267d67[_0xa550('0x30')][_0xa550('0x1e')]);_0x269502[_0xa550('0x20')]=qs[_0xa550('0x20')](_0x267d67[_0xa550('0x30')][_0xa550('0x20')]);}_0x269502[_0xa550('0x3a')]=qs['sort'](_0x267d67[_0xa550('0x30')][_0xa550('0x3b')]);_0x269502[_0xa550('0x3c')]=qs[_0xa550('0x32')](_[_0xa550('0x3d')](_0x267d67['query'],_0x30b032[_0xa550('0x32')]),_0x1ac1c5);if(_0x267d67[_0xa550('0x30')][_0xa550('0x3e')]){_0x269502[_0xa550('0x3c')]=_[_0xa550('0x3f')](_0x269502['where'],{'$or':_[_0xa550('0x2c')](_0x1ac1c5,function(_0xb24100){if(_0xb24100['type']!=='VIRTUAL'){var _0x2599ae={};_0x2599ae[_0xb24100[_0xa550('0x29')]]={'$like':'%'+_0x267d67[_0xa550('0x30')][_0xa550('0x3e')]+'%'};return _0x2599ae;}})});}_0x269502=_[_0xa550('0x3f')]({},_0x269502,_0x267d67[_0xa550('0x40')]);var _0x3f8d19={'where':_0x269502[_0xa550('0x3c')]};return db[_0xa550('0x2d')][_0xa550('0x1f')](_0x3f8d19)[_0xa550('0x26')](function(_0x11ac62){_0x2e6290[_0xa550('0x1f')]=_0x11ac62;if(_0x267d67[_0xa550('0x30')][_0xa550('0x41')]){_0x269502['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xa550('0x42')](_0x269502);})['then'](function(_0x3cd9b8){_0x2e6290[_0xa550('0x43')]=_0x3cd9b8;return _0x2e6290;})[_0xa550('0x26')](respondWithFilteredResult(_0x71b688,_0x269502))['catch'](handleError(_0x71b688,null));};exports[_0xa550('0x44')]=function(_0x52bc1c,_0x8547a7){var _0x5e347b={'raw':!![],'where':{'id':_0x52bc1c[_0xa550('0x45')]['id']}},_0x2c5ebb={};_0x2c5ebb[_0xa550('0x34')]=_[_0xa550('0x31')](db[_0xa550('0x2d')][_0xa550('0x46')]);_0x2c5ebb['query']=_[_0xa550('0x31')](_0x52bc1c[_0xa550('0x30')]);_0x2c5ebb['filters']=_[_0xa550('0x33')](_0x2c5ebb[_0xa550('0x34')],_0x2c5ebb['query']);_0x5e347b[_0xa550('0x35')]=_['intersection'](_0x2c5ebb[_0xa550('0x34')],qs['fields'](_0x52bc1c['query'][_0xa550('0x36')]));_0x5e347b[_0xa550('0x35')]=_0x5e347b['attributes']['length']?_0x5e347b[_0xa550('0x35')]:_0x2c5ebb[_0xa550('0x34')];if(_0x52bc1c[_0xa550('0x30')][_0xa550('0x41')]){_0x5e347b[_0xa550('0x47')]=[{'all':!![]}];}_0x5e347b=_[_0xa550('0x3f')]({},_0x5e347b,_0x52bc1c['options']);return db[_0xa550('0x2d')][_0xa550('0x48')](_0x5e347b)[_0xa550('0x26')](handleEntityNotFound(_0x8547a7,null))[_0xa550('0x26')](respondWithResult(_0x8547a7,null))[_0xa550('0x49')](handleError(_0x8547a7,null));};exports[_0xa550('0x4a')]=function(_0x26597c,_0x53e7f9){return db[_0xa550('0x2d')][_0xa550('0x4a')](_0x26597c['body'],{})['then'](respondWithResult(_0x53e7f9,0xc9))[_0xa550('0x49')](handleError(_0x53e7f9,null));};exports[_0xa550('0x4b')]=function(_0x8e0f4e,_0x590021){if(_0x8e0f4e['body']['id']){delete _0x8e0f4e[_0xa550('0x4c')]['id'];}return db[_0xa550('0x2d')][_0xa550('0x48')]({'where':{'id':_0x8e0f4e[_0xa550('0x45')]['id']}})['then'](handleEntityNotFound(_0x590021,null))[_0xa550('0x26')](saveUpdates(_0x8e0f4e[_0xa550('0x4c')],null))[_0xa550('0x26')](respondWithResult(_0x590021,null))['catch'](handleError(_0x590021,null));};exports['destroy']=function(_0x37418f,_0x1968f3){return db[_0xa550('0x2d')]['find']({'where':{'id':_0x37418f['params']['id']}})['then'](handleEntityNotFound(_0x1968f3,null))[_0xa550('0x26')](removeEntity(_0x1968f3,null))[_0xa550('0x49')](handleError(_0x1968f3,null));}; \ No newline at end of file +var _0xfdab=['VIRTUAL','count','includeAll','include','findAll','rows','show','params','catch','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge'];(function(_0xb2c4e,_0x75b613){var _0x3f5cef=function(_0x4c275d){while(--_0x4c275d){_0xb2c4e['push'](_0xb2c4e['shift']());}};_0x3f5cef(++_0x75b613);}(_0xfdab,0x148));var _0xbfda=function(_0x268843,_0x40e471){_0x268843=_0x268843-0x0;var _0x5b15fa=_0xfdab[_0x268843];return _0x5b15fa;};'use strict';var emlformat=require(_0xbfda('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbfda('0x1'));var jsonpatch=require(_0xbfda('0x2'));var rp=require(_0xbfda('0x3'));var moment=require(_0xbfda('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbfda('0x5'));var util=require(_0xbfda('0x6'));var path=require(_0xbfda('0x7'));var sox=require(_0xbfda('0x8'));var csv=require(_0xbfda('0x9'));var ejs=require(_0xbfda('0xa'));var fs=require('fs');var fs_extra=require(_0xbfda('0xb'));var _=require(_0xbfda('0xc'));var squel=require(_0xbfda('0xd'));var crypto=require(_0xbfda('0xe'));var jsforce=require(_0xbfda('0xf'));var deskjs=require(_0xbfda('0x10'));var toCsv=require(_0xbfda('0x9'));var querystring=require(_0xbfda('0x11'));var Papa=require(_0xbfda('0x12'));var Redis=require(_0xbfda('0x13'));var authService=require(_0xbfda('0x14'));var qs=require(_0xbfda('0x15'));var as=require(_0xbfda('0x16'));var hardwareService=require(_0xbfda('0x17'));var logger=require(_0xbfda('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xbfda('0x19'));var licenseUtil=require(_0xbfda('0x1a'));var db=require(_0xbfda('0x1b'))['db'];function respondWithStatusCode(_0x1d84a1,_0x212a76){_0x212a76=_0x212a76||0xcc;return function(_0x200eee){if(_0x200eee){return _0x1d84a1[_0xbfda('0x1c')](_0x212a76);}return _0x1d84a1[_0xbfda('0x1d')](_0x212a76)[_0xbfda('0x1e')]();};}function respondWithResult(_0x29cadb,_0x12cc25){_0x12cc25=_0x12cc25||0xc8;return function(_0x4dea3a){if(_0x4dea3a){return _0x29cadb[_0xbfda('0x1d')](_0x12cc25)[_0xbfda('0x1f')](_0x4dea3a);}};}function respondWithFilteredResult(_0x10830f,_0x1db2c2){return function(_0x1c9977){if(_0x1c9977){var _0x1d9635=typeof _0x1db2c2[_0xbfda('0x20')]===_0xbfda('0x21')&&typeof _0x1db2c2[_0xbfda('0x22')]===_0xbfda('0x21');var _0x5c8003=_0x1c9977['count'];var _0x42d60a=_0x1d9635?0x0:_0x1db2c2['offset'];var _0x1d6cce=_0x1d9635?_0x1c9977['count']:_0x1db2c2['offset']+_0x1db2c2[_0xbfda('0x22')];var _0x3c34ff;if(_0x1d6cce>=_0x5c8003){_0x1d6cce=_0x5c8003;_0x3c34ff=0xc8;}else{_0x3c34ff=0xce;}_0x10830f['status'](_0x3c34ff);return _0x10830f[_0xbfda('0x23')](_0xbfda('0x24'),_0x42d60a+'-'+_0x1d6cce+'/'+_0x5c8003)[_0xbfda('0x1f')](_0x1c9977);}return null;};}function patchUpdates(_0x21705f){return function(_0x134ccf){try{jsonpatch[_0xbfda('0x25')](_0x134ccf,_0x21705f,!![]);}catch(_0x27daf8){return BPromise[_0xbfda('0x26')](_0x27daf8);}return _0x134ccf[_0xbfda('0x27')]();};}function saveUpdates(_0x33f8f9,_0x18162b){return function(_0x52413f){if(_0x52413f){return _0x52413f[_0xbfda('0x28')](_0x33f8f9)[_0xbfda('0x29')](function(_0x5538e0){return _0x5538e0;});}return null;};}function removeEntity(_0x22b52d,_0x562313){return function(_0x2aecf8){if(_0x2aecf8){return _0x2aecf8[_0xbfda('0x2a')]()['then'](function(){_0x22b52d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16758f,_0x47ab74){return function(_0x1d6552){if(!_0x1d6552){_0x16758f[_0xbfda('0x1c')](0x194);}return _0x1d6552;};}function handleError(_0x55ca03,_0x6f9518){_0x6f9518=_0x6f9518||0x1f4;return function(_0x2578b1){logger[_0xbfda('0x2b')](_0x2578b1['stack']);if(_0x2578b1[_0xbfda('0x2c')]){delete _0x2578b1[_0xbfda('0x2c')];}_0x55ca03['status'](_0x6f9518)[_0xbfda('0x2d')](_0x2578b1);};}exports[_0xbfda('0x2e')]=function(_0x5b6240,_0x188aac){var _0x453899={},_0x333dc6={},_0x18b672={'count':0x0,'rows':[]};var _0x5d659a=_['map'](db[_0xbfda('0x2f')][_0xbfda('0x30')],function(_0x378b2b){return{'name':_0x378b2b[_0xbfda('0x31')],'type':_0x378b2b[_0xbfda('0x32')]['key']};});_0x333dc6['model']=_[_0xbfda('0x33')](_0x5d659a,'name');_0x333dc6[_0xbfda('0x34')]=_[_0xbfda('0x35')](_0x5b6240[_0xbfda('0x34')]);_0x333dc6['filters']=_[_0xbfda('0x36')](_0x333dc6[_0xbfda('0x37')],_0x333dc6[_0xbfda('0x34')]);_0x453899[_0xbfda('0x38')]=_['intersection'](_0x333dc6[_0xbfda('0x37')],qs[_0xbfda('0x39')](_0x5b6240[_0xbfda('0x34')][_0xbfda('0x39')]));_0x453899[_0xbfda('0x38')]=_0x453899[_0xbfda('0x38')][_0xbfda('0x3a')]?_0x453899[_0xbfda('0x38')]:_0x333dc6[_0xbfda('0x37')];if(!_0x5b6240[_0xbfda('0x34')][_0xbfda('0x3b')](_0xbfda('0x3c'))){_0x453899[_0xbfda('0x22')]=qs[_0xbfda('0x22')](_0x5b6240['query'][_0xbfda('0x22')]);_0x453899['offset']=qs[_0xbfda('0x20')](_0x5b6240[_0xbfda('0x34')][_0xbfda('0x20')]);}_0x453899['order']=qs[_0xbfda('0x3d')](_0x5b6240['query'][_0xbfda('0x3d')]);_0x453899[_0xbfda('0x3e')]=qs['filters'](_[_0xbfda('0x3f')](_0x5b6240[_0xbfda('0x34')],_0x333dc6[_0xbfda('0x40')]),_0x5d659a);if(_0x5b6240[_0xbfda('0x34')][_0xbfda('0x41')]){_0x453899[_0xbfda('0x3e')]=_[_0xbfda('0x42')](_0x453899[_0xbfda('0x3e')],{'$or':_[_0xbfda('0x33')](_0x5d659a,function(_0x9298a1){if(_0x9298a1['type']!==_0xbfda('0x43')){var _0x4f6cd2={};_0x4f6cd2[_0x9298a1['name']]={'$like':'%'+_0x5b6240[_0xbfda('0x34')][_0xbfda('0x41')]+'%'};return _0x4f6cd2;}})});}_0x453899=_[_0xbfda('0x42')]({},_0x453899,_0x5b6240['options']);var _0x22dbbf={'where':_0x453899[_0xbfda('0x3e')]};return db[_0xbfda('0x2f')][_0xbfda('0x44')](_0x22dbbf)[_0xbfda('0x29')](function(_0x7e6917){_0x18b672[_0xbfda('0x44')]=_0x7e6917;if(_0x5b6240[_0xbfda('0x34')][_0xbfda('0x45')]){_0x453899[_0xbfda('0x46')]=[{'all':!![]}];}return db[_0xbfda('0x2f')][_0xbfda('0x47')](_0x453899);})['then'](function(_0x5a3dc2){_0x18b672[_0xbfda('0x48')]=_0x5a3dc2;return _0x18b672;})[_0xbfda('0x29')](respondWithFilteredResult(_0x188aac,_0x453899))['catch'](handleError(_0x188aac,null));};exports[_0xbfda('0x49')]=function(_0x4e70e2,_0x51da8f){var _0x488cd0={'raw':!![],'where':{'id':_0x4e70e2[_0xbfda('0x4a')]['id']}},_0x39e61e={};_0x39e61e['model']=_['keys'](db[_0xbfda('0x2f')][_0xbfda('0x30')]);_0x39e61e[_0xbfda('0x34')]=_[_0xbfda('0x35')](_0x4e70e2[_0xbfda('0x34')]);_0x39e61e[_0xbfda('0x40')]=_[_0xbfda('0x36')](_0x39e61e[_0xbfda('0x37')],_0x39e61e[_0xbfda('0x34')]);_0x488cd0[_0xbfda('0x38')]=_['intersection'](_0x39e61e[_0xbfda('0x37')],qs[_0xbfda('0x39')](_0x4e70e2[_0xbfda('0x34')][_0xbfda('0x39')]));_0x488cd0[_0xbfda('0x38')]=_0x488cd0[_0xbfda('0x38')]['length']?_0x488cd0[_0xbfda('0x38')]:_0x39e61e['model'];if(_0x4e70e2[_0xbfda('0x34')][_0xbfda('0x45')]){_0x488cd0['include']=[{'all':!![]}];}_0x488cd0=_['merge']({},_0x488cd0,_0x4e70e2['options']);return db[_0xbfda('0x2f')]['find'](_0x488cd0)['then'](handleEntityNotFound(_0x51da8f,null))[_0xbfda('0x29')](respondWithResult(_0x51da8f,null))[_0xbfda('0x4b')](handleError(_0x51da8f,null));};exports['create']=function(_0x252bc3,_0x17bebb){return db[_0xbfda('0x2f')][_0xbfda('0x4c')](_0x252bc3[_0xbfda('0x4d')],{})[_0xbfda('0x29')](respondWithResult(_0x17bebb,0xc9))['catch'](handleError(_0x17bebb,null));};exports[_0xbfda('0x28')]=function(_0x4f2755,_0x129afe){if(_0x4f2755['body']['id']){delete _0x4f2755[_0xbfda('0x4d')]['id'];}return db[_0xbfda('0x2f')][_0xbfda('0x4e')]({'where':{'id':_0x4f2755[_0xbfda('0x4a')]['id']}})['then'](handleEntityNotFound(_0x129afe,null))['then'](saveUpdates(_0x4f2755[_0xbfda('0x4d')],null))[_0xbfda('0x29')](respondWithResult(_0x129afe,null))['catch'](handleError(_0x129afe,null));};exports['destroy']=function(_0x1da47b,_0x57afeb){return db[_0xbfda('0x2f')][_0xbfda('0x4e')]({'where':{'id':_0x1da47b['params']['id']}})[_0xbfda('0x29')](handleEntityNotFound(_0x57afeb,null))[_0xbfda('0x29')](removeEntity(_0x57afeb,null))[_0xbfda('0x4b')](handleError(_0x57afeb,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 1e79a54..6cf95f0 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 _0x86c4=['request-promise','path','rimraf','../../config/environment','exports','define','utf8mb4','lodash','util','moment','bluebird'];(function(_0x52c0c2,_0x11be01){var _0x38e7db=function(_0x32f870){while(--_0x32f870){_0x52c0c2['push'](_0x52c0c2['shift']());}};_0x38e7db(++_0x11be01);}(_0x86c4,0x104));var _0x486c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x86c4[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x486c('0x0'));var util=require(_0x486c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x486c('0x2'));var BPromise=require(_0x486c('0x3'));var rp=require(_0x486c('0x4'));var fs=require('fs');var path=require(_0x486c('0x5'));var rimraf=require(_0x486c('0x6'));var config=require(_0x486c('0x7'));var attributes=require('./openchannelApplication.attributes');module[_0x486c('0x8')]=function(_0x51bb05,_0x177ec7){return _0x51bb05[_0x486c('0x9')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x486c('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x636c=['bluebird','request-promise','path','./openchannelApplication.attributes','exports','define','utf8mb4','lodash','util','moment'];(function(_0x5a503c,_0x40f51a){var _0x108f15=function(_0x4d0c47){while(--_0x4d0c47){_0x5a503c['push'](_0x5a503c['shift']());}};_0x108f15(++_0x40f51a);}(_0x636c,0x15b));var _0xc636=function(_0x14deb8,_0x2e7e5e){_0x14deb8=_0x14deb8-0x0;var _0x1f5d27=_0x636c[_0x14deb8];return _0x1f5d27;};'use strict';var _=require(_0xc636('0x0'));var util=require(_0xc636('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc636('0x2'));var BPromise=require(_0xc636('0x3'));var rp=require(_0xc636('0x4'));var fs=require('fs');var path=require(_0xc636('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc636('0x6'));module[_0xc636('0x7')]=function(_0x11e2dd,_0x19491e){return _0x11e2dd[_0xc636('0x8')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc636('0x9'),'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 e757567..f3f4474 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 _0x3c09=['stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','catch','util','bluebird','randomstring','../../config/logger','../../config/environment','client','http','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3c09,0x17a));var _0x93c0=function(_0x18baa4,_0x5e35f2){_0x18baa4=_0x18baa4-0x0;var _0x370834=_0x3c09[_0x18baa4];return _0x370834;};'use strict';var _=require('lodash');var util=require(_0x93c0('0x0'));var moment=require('moment');var BPromise=require(_0x93c0('0x1'));var rs=require(_0x93c0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x93c0('0x3'))('rpc');var config=require(_0x93c0('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x93c0('0x5')][_0x93c0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1b3a12,_0x593c01,_0x590649){return new BPromise(function(_0x36085d,_0xc64e04){return client['request'](_0x1b3a12,_0x590649)[_0x93c0('0x7')](function(_0x1a776c){logger[_0x93c0('0x8')]('OpenchannelApplication,\x20%s,\x20%s',_0x593c01,_0x93c0('0x9'));logger[_0x93c0('0xa')](_0x93c0('0xb'),_0x593c01,_0x93c0('0x9'),JSON[_0x93c0('0xc')](_0x1a776c));if(_0x1a776c[_0x93c0('0xd')]){if(_0x1a776c[_0x93c0('0xd')][_0x93c0('0xe')]===0x1f4){logger[_0x93c0('0xd')](_0x93c0('0xf'),_0x593c01,_0x1a776c[_0x93c0('0xd')][_0x93c0('0x10')]);return _0xc64e04(_0x1a776c[_0x93c0('0xd')][_0x93c0('0x10')]);}logger[_0x93c0('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x593c01,_0x1a776c['error'][_0x93c0('0x10')]);return _0x36085d(_0x1a776c[_0x93c0('0xd')][_0x93c0('0x10')]);}else{logger[_0x93c0('0x8')](_0x93c0('0xf'),_0x593c01,'request\x20sent');_0x36085d(_0x1a776c['result'][_0x93c0('0x10')]);}})['catch'](function(_0x4c4ff9){logger[_0x93c0('0xd')](_0x93c0('0xf'),_0x593c01,_0x4c4ff9);_0xc64e04(_0x4c4ff9);});});}exports[_0x93c0('0x11')]=function(_0x5291e6){var _0x16dbd1=this;return new Promise(function(_0x3ef762,_0x4e8ffa){return db[_0x93c0('0x12')][_0x93c0('0x13')](_0x5291e6[_0x93c0('0x14')],{'raw':_0x5291e6[_0x93c0('0x15')]?_0x5291e6['options'][_0x93c0('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5291e6['options']?_0x5291e6[_0x93c0('0x15')][_0x93c0('0x17')]||null:null,'attributes':_0x5291e6['options']?_0x5291e6[_0x93c0('0x15')][_0x93c0('0x18')]||null:null,'limit':_0x5291e6[_0x93c0('0x15')]?_0x5291e6[_0x93c0('0x15')]['limit']||null:null})[_0x93c0('0x7')](function(_0x1e4005){logger[_0x93c0('0x8')](_0x93c0('0x11'),_0x5291e6);logger[_0x93c0('0xa')](_0x93c0('0x11'),_0x5291e6,JSON['stringify'](_0x1e4005));_0x3ef762(_0x1e4005);})[_0x93c0('0x19')](function(_0x53ab47){logger[_0x93c0('0xd')](_0x93c0('0x11'),_0x53ab47[_0x93c0('0x10')],_0x5291e6);_0x4e8ffa(_0x16dbd1[_0x93c0('0xd')](0x1f4,_0x53ab47[_0x93c0('0x10')]));});});}; \ No newline at end of file +var _0x54ac=['../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring'];(function(_0x560d6f,_0x5d91c4){var _0x46f76a=function(_0x45e8ff){while(--_0x45e8ff){_0x560d6f['push'](_0x560d6f['shift']());}};_0x46f76a(++_0x5d91c4);}(_0x54ac,0xeb));var _0xc54a=function(_0x55a802,_0x10ab3a){_0x55a802=_0x55a802-0x0;var _0x1a0461=_0x54ac[_0x55a802];return _0x1a0461;};'use strict';var _=require(_0xc54a('0x0'));var util=require(_0xc54a('0x1'));var moment=require(_0xc54a('0x2'));var BPromise=require(_0xc54a('0x3'));var rs=require(_0xc54a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc54a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc54a('0x6'));var jayson=require(_0xc54a('0x7'));var client=jayson[_0xc54a('0x8')][_0xc54a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fe878,_0x37d6e5,_0x7eb9e){return new BPromise(function(_0xdd68fc,_0x4a07cb){return client[_0xc54a('0xa')](_0x3fe878,_0x7eb9e)['then'](function(_0x2ebd54){logger[_0xc54a('0xb')](_0xc54a('0xc'),_0x37d6e5,_0xc54a('0xd'));logger[_0xc54a('0xe')](_0xc54a('0xf'),_0x37d6e5,_0xc54a('0xd'),JSON[_0xc54a('0x10')](_0x2ebd54));if(_0x2ebd54[_0xc54a('0x11')]){if(_0x2ebd54[_0xc54a('0x11')]['code']===0x1f4){logger[_0xc54a('0x11')](_0xc54a('0xc'),_0x37d6e5,_0x2ebd54[_0xc54a('0x11')][_0xc54a('0x12')]);return _0x4a07cb(_0x2ebd54[_0xc54a('0x11')][_0xc54a('0x12')]);}logger[_0xc54a('0x11')](_0xc54a('0xc'),_0x37d6e5,_0x2ebd54[_0xc54a('0x11')][_0xc54a('0x12')]);return _0xdd68fc(_0x2ebd54[_0xc54a('0x11')][_0xc54a('0x12')]);}else{logger[_0xc54a('0xb')](_0xc54a('0xc'),_0x37d6e5,_0xc54a('0xd'));_0xdd68fc(_0x2ebd54[_0xc54a('0x13')][_0xc54a('0x12')]);}})[_0xc54a('0x14')](function(_0x20f7f7){logger[_0xc54a('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x37d6e5,_0x20f7f7);_0x4a07cb(_0x20f7f7);});});}exports[_0xc54a('0x15')]=function(_0x54d0a2){var _0x3f2348=this;return new Promise(function(_0x43db9f,_0x1d1b48){return db[_0xc54a('0x16')][_0xc54a('0x17')](_0x54d0a2['body'],{'raw':_0x54d0a2[_0xc54a('0x18')]?_0x54d0a2['options'][_0xc54a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54d0a2[_0xc54a('0x18')]?_0x54d0a2['options'][_0xc54a('0x1a')]||null:null,'attributes':_0x54d0a2['options']?_0x54d0a2[_0xc54a('0x18')][_0xc54a('0x1b')]||null:null,'limit':_0x54d0a2[_0xc54a('0x18')]?_0x54d0a2[_0xc54a('0x18')][_0xc54a('0x1c')]||null:null})[_0xc54a('0x1d')](function(_0xae1ec3){logger[_0xc54a('0xb')](_0xc54a('0x15'),_0x54d0a2);logger['debug'](_0xc54a('0x15'),_0x54d0a2,JSON['stringify'](_0xae1ec3));_0x43db9f(_0xae1ec3);})['catch'](function(_0x7b43f7){logger[_0xc54a('0x11')]('UpdateOpenchannelApplication',_0x7b43f7[_0xc54a('0x12')],_0x54d0a2);_0x1d1b48(_0x3f2348['error'](0x1f4,_0x7b43f7['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index c21f3bd..6125d1f 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 _0x7b8c=['describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x1d8cd5,_0x51f174){var _0x3ab71f=function(_0x5efa91){while(--_0x5efa91){_0x1d8cd5['push'](_0x1d8cd5['shift']());}};_0x3ab71f(++_0x51f174);}(_0x7b8c,0x1c6));var _0xc7b8=function(_0x1514e1,_0x1a4243){_0x1514e1=_0x1514e1-0x0;var _0x2999aa=_0x7b8c[_0x1514e1];return _0x2999aa;};'use strict';var multer=require(_0xc7b8('0x0'));var util=require(_0xc7b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc7b8('0x2'));var router=express[_0xc7b8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc7b8('0x4'));var interaction=require(_0xc7b8('0x5'));var config=require(_0xc7b8('0x6'));var controller=require('./openchannelInteraction.controller');router[_0xc7b8('0x7')]('/',auth[_0xc7b8('0x8')](),controller[_0xc7b8('0x9')]);router[_0xc7b8('0x7')](_0xc7b8('0xa'),auth[_0xc7b8('0x8')](),controller[_0xc7b8('0xb')]);router[_0xc7b8('0x7')](_0xc7b8('0xc'),auth[_0xc7b8('0x8')](),controller[_0xc7b8('0xd')]);router[_0xc7b8('0x7')](_0xc7b8('0xe'),auth[_0xc7b8('0x8')](),controller[_0xc7b8('0xf')]);router[_0xc7b8('0x7')](_0xc7b8('0x10'),auth['isAuthenticated'](),controller[_0xc7b8('0x11')]);router[_0xc7b8('0x12')]('/',auth[_0xc7b8('0x8')](),controller[_0xc7b8('0x13')]);router[_0xc7b8('0x12')](_0xc7b8('0xe'),auth['isAuthenticated'](),controller['addMessage']);router[_0xc7b8('0x12')]('/:id/tags',auth[_0xc7b8('0x8')](),interaction[_0xc7b8('0x14')](_0xc7b8('0x15'),_0xc7b8('0x16')),controller['addTags']);router[_0xc7b8('0x17')](_0xc7b8('0xc'),auth['isAuthenticated'](),interaction[_0xc7b8('0x14')](_0xc7b8('0x15'),_0xc7b8('0x18')),controller[_0xc7b8('0x19')]);router[_0xc7b8('0x1a')](_0xc7b8('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0xc7b8('0x15'),_0xc7b8('0x1b')),controller[_0xc7b8('0x1c')]);router[_0xc7b8('0x1a')](_0xc7b8('0x1d'),auth[_0xc7b8('0x8')](),controller['removeTags']);module[_0xc7b8('0x1e')]=router; \ No newline at end of file +var _0x68e3=['/:id/messages','getMessages','/:id/download','download','post','create','addMessage','openchannel','openchannelinteraction:addtags','put','/:id','openchannelinteraction:update','update','tracked','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','show'];(function(_0x488f98,_0x1391e4){var _0x3aeb3e=function(_0x1a0484){while(--_0x1a0484){_0x488f98['push'](_0x488f98['shift']());}};_0x3aeb3e(++_0x1391e4);}(_0x68e3,0xcd));var _0x368e=function(_0x2cbbf1,_0x7c1604){_0x2cbbf1=_0x2cbbf1-0x0;var _0x2e812a=_0x68e3[_0x2cbbf1];return _0x2e812a;};'use strict';var multer=require(_0x368e('0x0'));var util=require(_0x368e('0x1'));var path=require(_0x368e('0x2'));var timeout=require('connect-timeout');var express=require(_0x368e('0x3'));var router=express['Router']();var fs_extra=require(_0x368e('0x4'));var auth=require(_0x368e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x368e('0x6'));var controller=require(_0x368e('0x7'));router[_0x368e('0x8')]('/',auth[_0x368e('0x9')](),controller[_0x368e('0xa')]);router[_0x368e('0x8')]('/describe',auth[_0x368e('0x9')](),controller['describe']);router[_0x368e('0x8')]('/:id',auth[_0x368e('0x9')](),controller[_0x368e('0xb')]);router[_0x368e('0x8')](_0x368e('0xc'),auth[_0x368e('0x9')](),controller[_0x368e('0xd')]);router['get'](_0x368e('0xe'),auth[_0x368e('0x9')](),controller[_0x368e('0xf')]);router[_0x368e('0x10')]('/',auth[_0x368e('0x9')](),controller[_0x368e('0x11')]);router[_0x368e('0x10')]('/:id/messages',auth['isAuthenticated'](),controller[_0x368e('0x12')]);router['post']('/:id/tags',auth[_0x368e('0x9')](),interaction['tracked'](_0x368e('0x13'),_0x368e('0x14')),controller['addTags']);router[_0x368e('0x15')](_0x368e('0x16'),auth['isAuthenticated'](),interaction['tracked'](_0x368e('0x13'),_0x368e('0x17')),controller[_0x368e('0x18')]);router['delete']('/:id',auth[_0x368e('0x9')](),interaction[_0x368e('0x19')](_0x368e('0x13'),_0x368e('0x1a')),controller[_0x368e('0x1b')]);router[_0x368e('0x1c')]('/:id/tags',auth[_0x368e('0x9')](),controller[_0x368e('0x1d')]);module[_0x368e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 53381b3..ab8f1d4 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 _0xa03c=['INTEGER','sequelize','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0xa03c,0x94));var _0xca03=function(_0xc5b1aa,_0x436c79){_0xc5b1aa=_0xc5b1aa-0x0;var _0x4cfe8d=_0xa03c[_0xc5b1aa];return _0x4cfe8d;};'use strict';var Sequelize=require(_0xca03('0x0'));module['exports']={'closed':{'type':Sequelize[_0xca03('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xca03('0x2')]},'disposition':{'type':Sequelize[_0xca03('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xca03('0x3')]},'note':{'type':Sequelize[_0xca03('0x3')]},'read1stAt':{'type':Sequelize[_0xca03('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xca03('0x3')]},'lastMsgAt':{'type':Sequelize[_0xca03('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xca03('0x4')]('in',_0xca03('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xca03('0x4')]('in',_0xca03('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xca03('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xca03('0x6')]}}; \ No newline at end of file +var _0x9be2=['sequelize','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x9be2,0x85));var _0x29be=function(_0x319dd2,_0x32c5b1){_0x319dd2=_0x319dd2-0x0;var _0x2c9d2b=_0x9be2[_0x319dd2];return _0x2c9d2b;};'use strict';var Sequelize=require(_0x29be('0x0'));module[_0x29be('0x1')]={'closed':{'type':Sequelize[_0x29be('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x29be('0x3')]},'secondDisposition':{'type':Sequelize[_0x29be('0x3')]},'thirdDisposition':{'type':Sequelize[_0x29be('0x3')]},'note':{'type':Sequelize[_0x29be('0x3')]},'read1stAt':{'type':Sequelize[_0x29be('0x4')]},'threadId':{'type':Sequelize[_0x29be('0x3')]},'externalUrl':{'type':Sequelize[_0x29be('0x3')]},'lastMsgAt':{'type':Sequelize[_0x29be('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x29be('0x5')]('in',_0x29be('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x29be('0x5')]('in',_0x29be('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x29be('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 5713abb..c92b496 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 _0x1404=['openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','secret','read','Account','Owner','get','mkdirSync','N.A.','closed','disposition','threadId','Private','Attachment','basename','existsSync','createReadStream','pipe','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','error','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','then','destroy','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','type','getOptions','query','catch','show','from','params','model','keys','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','update','describe','OpenchannelMessage','addMessage','ids','omit','findOne','hasOwnProperty','order','sort','where','filters','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','findAll','rows','addTags','setTags','spread','Tag','color','emit'];(function(_0x3980b8,_0x50dd45){var _0x295195=function(_0x140706){while(--_0x140706){_0x3980b8['push'](_0x3980b8['shift']());}};_0x295195(++_0x50dd45);}(_0x1404,0x134));var _0x4140=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x1404[_0x2d7f0e];return _0x110b07;};'use strict';var rimraf=require(_0x4140('0x0'));var zipdir=require(_0x4140('0x1'));var moment=require(_0x4140('0x2'));var util=require(_0x4140('0x3'));var path=require(_0x4140('0x4'));var ejs=require(_0x4140('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x4140('0x6'));var interaction=require(_0x4140('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x4140('0x8'));var logger=require(_0x4140('0x9'))(_0x4140('0xa'));var config=require(_0x4140('0xb'));var db=require(_0x4140('0xc'))['db'];config[_0x4140('0xd')]=_[_0x4140('0xe')](config[_0x4140('0xd')],{'host':_0x4140('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4140('0xd')]));require(_0x4140('0x10'))[_0x4140('0x11')](socket);function respondWithStatusCode(_0x2f9d59,_0x3ad367){_0x3ad367=_0x3ad367||0xcc;return function(_0x2e9883){if(_0x2e9883){return _0x2f9d59[_0x4140('0x12')](_0x3ad367);}return _0x2f9d59['status'](_0x3ad367)['end']();};}function respondWithResult(_0x3925c8,_0x500e5a){_0x500e5a=_0x500e5a||0xc8;return function(_0x18d33e){if(_0x18d33e){return _0x3925c8[_0x4140('0x13')](_0x500e5a)[_0x4140('0x14')](_0x18d33e);}};}function respondWithFilteredResult(_0x1fd605,_0x3623df){return function(_0x491659){if(_0x491659){var _0x10182e=typeof _0x3623df[_0x4140('0x15')]===_0x4140('0x16')&&typeof _0x3623df['limit']==='undefined';var _0x20c2ff=_0x491659['count'];var _0x47f4c3=_0x10182e?0x0:_0x3623df[_0x4140('0x15')];var _0x165c9f=_0x10182e?_0x491659['count']:_0x3623df[_0x4140('0x15')]+_0x3623df[_0x4140('0x17')];var _0x3209dd;if(_0x165c9f>=_0x20c2ff){_0x165c9f=_0x20c2ff;_0x3209dd=0xc8;}else{_0x3209dd=0xce;}_0x1fd605[_0x4140('0x13')](_0x3209dd);return _0x1fd605[_0x4140('0x18')](_0x4140('0x19'),_0x47f4c3+'-'+_0x165c9f+'/'+_0x20c2ff)['json'](_0x491659);}return null;};}function saveUpdates(_0x543bd4){return function(_0x1fb171){if(_0x1fb171){return _0x1fb171['update'](_0x543bd4)[_0x4140('0x1a')](function(_0x1efdb0){return _0x1efdb0;});}return null;};}function removeEntity(_0x16dc50){return function(_0x226910){if(_0x226910){return _0x226910[_0x4140('0x1b')]()[_0x4140('0x1a')](function(){_0x16dc50['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e6ed7){return function(_0x10a9f0){if(!_0x10a9f0){_0x5e6ed7[_0x4140('0x12')](0x194);}return _0x10a9f0;};}function handleError(_0x1b1b24,_0x5b96aa){_0x5b96aa=_0x5b96aa||0x1f4;return function(_0x183e83){logger['error'](_0x183e83[_0x4140('0x1c')]);if(_0x183e83['name']){delete _0x183e83[_0x4140('0x1d')];}_0x1b1b24['status'](_0x5b96aa)[_0x4140('0x1e')](_0x183e83);};}exports[_0x4140('0x1f')]=function(_0x5369e5,_0x8043c2){var _0x90f682={};var _0x2125e1=_[_0x4140('0x20')](db[_0x4140('0x21')][_0x4140('0x22')],function(_0x34835c){return{'name':_0x34835c['fieldName'],'type':_0x34835c[_0x4140('0x23')]['key']};});_0x90f682=qs[_0x4140('0x24')](_0x2125e1,_0x5369e5);return interaction['findAll']('openchannel',_0x5369e5[_0x4140('0x25')],_0x5369e5['user'],_0x90f682,_0x2125e1)[_0x4140('0x1a')](respondWithFilteredResult(_0x8043c2,_0x90f682))[_0x4140('0x26')](handleError(_0x8043c2,null));};exports[_0x4140('0x27')]=function(_0x4abcf7,_0x218c47){var _0x171b2b={};if(_0x4abcf7['query'][_0x4140('0x23')]&&_0x4abcf7['query']['type']===_0x4140('0x28')){_0x171b2b['from']=_0x4abcf7['params']['id'];}else{_0x171b2b['id']=_0x4abcf7[_0x4140('0x29')]['id'];}var _0x2df8cb={'raw':![],'where':_0x171b2b},_0x46e0c9={};_0x46e0c9[_0x4140('0x2a')]=_[_0x4140('0x2b')](db[_0x4140('0x21')]['rawAttributes']);_0x46e0c9[_0x4140('0x25')]=_['keys'](_0x4abcf7['query']);_0x46e0c9['filters']=_[_0x4140('0x2c')](_0x46e0c9[_0x4140('0x2a')],_0x46e0c9[_0x4140('0x25')]);_0x2df8cb[_0x4140('0x2d')]=_['intersection'](_0x46e0c9[_0x4140('0x2a')],qs[_0x4140('0x2e')](_0x4abcf7[_0x4140('0x25')][_0x4140('0x2e')]));_0x2df8cb[_0x4140('0x2d')]=_0x2df8cb[_0x4140('0x2d')][_0x4140('0x2f')]?_0x2df8cb['attributes']:_0x46e0c9[_0x4140('0x2a')];if(_0x4abcf7[_0x4140('0x25')][_0x4140('0x30')]){_0x2df8cb[_0x4140('0x31')]=[{'all':!![]}];}_0x2df8cb=_[_0x4140('0x32')]({},_0x2df8cb,_0x4abcf7[_0x4140('0x33')]);return db[_0x4140('0x21')][_0x4140('0x34')](_0x2df8cb)[_0x4140('0x1a')](handleEntityNotFound(_0x218c47,null))[_0x4140('0x1a')](respondWithResult(_0x218c47,null))[_0x4140('0x26')](handleError(_0x218c47,null));};exports[_0x4140('0x35')]=function(_0x50f1cf,_0x47b8d8){return db['OpenchannelInteraction'][_0x4140('0x35')](_0x50f1cf[_0x4140('0x36')],{})[_0x4140('0x1a')](respondWithResult(_0x47b8d8,0xc9))['catch'](handleError(_0x47b8d8,null));};exports[_0x4140('0x37')]=function(_0x5b91a8,_0x32d843){if(_0x5b91a8[_0x4140('0x36')]['id']){delete _0x5b91a8['body']['id'];}return db[_0x4140('0x21')][_0x4140('0x34')]({'where':{'id':_0x5b91a8[_0x4140('0x29')]['id']}})[_0x4140('0x1a')](handleEntityNotFound(_0x32d843,null))[_0x4140('0x1a')](saveUpdates(_0x5b91a8['body'],null))['then'](respondWithResult(_0x32d843,null))[_0x4140('0x26')](handleError(_0x32d843,null));};exports[_0x4140('0x1b')]=function(_0x379e92,_0x528a74){return db[_0x4140('0x21')][_0x4140('0x34')]({'where':{'id':_0x379e92[_0x4140('0x29')]['id']}})['then'](handleEntityNotFound(_0x528a74,null))['then'](removeEntity(_0x528a74,null))[_0x4140('0x26')](handleError(_0x528a74,null));};exports[_0x4140('0x38')]=function(_0xa6f918,_0x399856){return db[_0x4140('0x21')]['describe']()[_0x4140('0x1a')](respondWithResult(_0x399856,null))[_0x4140('0x26')](handleError(_0x399856,null));};exports['addMessage']=function(_0x342fec,_0x2b9916){return db[_0x4140('0x39')]['find']({'where':{'id':_0x342fec[_0x4140('0x29')]['id']}})[_0x4140('0x1a')](handleEntityNotFound(_0x2b9916,null))[_0x4140('0x1a')](function(_0xb7be47){if(_0xb7be47){return _0xb7be47[_0x4140('0x3a')](_0x342fec[_0x4140('0x36')][_0x4140('0x3b')],_[_0x4140('0x3c')](_0x342fec['body'],[_0x4140('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x2b9916,null))[_0x4140('0x26')](handleError(_0x2b9916,null));};exports['getMessages']=function(_0x5a04c1,_0x3e663e){var _0x424cf5={'raw':![],'where':{}};var _0x17fe2a={};var _0x39db11={'count':0x0,'rows':[]};return db[_0x4140('0x21')][_0x4140('0x3d')]({'where':{'id':_0x5a04c1[_0x4140('0x29')]['id']}})[_0x4140('0x1a')](handleEntityNotFound(_0x3e663e,null))['then'](function(_0x338a77){if(_0x338a77){_0x17fe2a[_0x4140('0x2a')]=_[_0x4140('0x2b')](db[_0x4140('0x39')][_0x4140('0x22')]);_0x17fe2a['query']=_[_0x4140('0x2b')](_0x5a04c1[_0x4140('0x25')]);_0x17fe2a['filters']=_[_0x4140('0x2c')](_0x17fe2a[_0x4140('0x2a')],_0x17fe2a['query']);_0x424cf5[_0x4140('0x2d')]=_[_0x4140('0x2c')](_0x17fe2a[_0x4140('0x2a')],qs[_0x4140('0x2e')](_0x5a04c1[_0x4140('0x25')][_0x4140('0x2e')]));_0x424cf5[_0x4140('0x2d')]=_0x424cf5['attributes']['length']?_0x424cf5[_0x4140('0x2d')]:_0x17fe2a[_0x4140('0x2a')];if(!_0x5a04c1[_0x4140('0x25')][_0x4140('0x3e')]('nolimit')){_0x424cf5[_0x4140('0x17')]=qs[_0x4140('0x17')](_0x5a04c1['query'][_0x4140('0x17')]);_0x424cf5[_0x4140('0x15')]=qs[_0x4140('0x15')](_0x5a04c1[_0x4140('0x25')]['offset']);}_0x424cf5[_0x4140('0x3f')]=qs[_0x4140('0x40')](_0x5a04c1[_0x4140('0x25')]['sort']);_0x424cf5[_0x4140('0x41')]=qs[_0x4140('0x42')](_[_0x4140('0x43')](_0x5a04c1[_0x4140('0x25')],_0x17fe2a['filters']));_0x424cf5[_0x4140('0x41')]['OpenchannelInteractionId']=_0x338a77['id'];if(_0x5a04c1[_0x4140('0x25')][_0x4140('0x44')]){_0x424cf5[_0x4140('0x41')]=_[_0x4140('0x32')](_0x424cf5[_0x4140('0x41')],{'$or':_[_0x4140('0x20')](_0x424cf5['attributes'],function(_0x7c236){var _0x18fafa={};_0x18fafa[_0x7c236]={'$like':'%'+_0x5a04c1['query'][_0x4140('0x44')]+'%'};return _0x18fafa;})});}if(_0x5a04c1[_0x4140('0x25')][_0x4140('0x45')]){var _0x4e30ac=_0x5a04c1[_0x4140('0x25')][_0x4140('0x45')][_0x4140('0x46')](',');var _0x48ff06={};_0x48ff06[_0x4e30ac[0x0]]={'$gte':moment(_0x4e30ac[0x1])[_0x4140('0x47')](_0x4140('0x48'))};_0x424cf5[_0x4140('0x41')]=_[_0x4140('0x32')](_0x424cf5['where'],_0x48ff06);}_0x424cf5=_[_0x4140('0x32')]({},_0x424cf5,_0x5a04c1['options']);return db['OpenchannelMessage'][_0x4140('0x49')]({'where':_0x424cf5[_0x4140('0x41')]})[_0x4140('0x1a')](function(_0x17e93a){_0x39db11['count']=_0x17e93a;if(_0x5a04c1['query']['includeAll']){_0x424cf5[_0x4140('0x31')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x4140('0x4a')](_0x424cf5);})[_0x4140('0x1a')](function(_0x23b1fc){_0x39db11[_0x4140('0x4b')]=_0x23b1fc;return _0x39db11;});}})[_0x4140('0x1a')](respondWithFilteredResult(_0x3e663e,_0x424cf5))[_0x4140('0x26')](handleError(_0x3e663e,null));};exports[_0x4140('0x4c')]=function(_0x3f36c3,_0x4e381f){return db[_0x4140('0x21')][_0x4140('0x34')]({'where':{'id':_0x3f36c3['params']['id']}})['then'](handleEntityNotFound(_0x4e381f,null))[_0x4140('0x1a')](function(_0x148559){if(_0x148559){return _0x148559[_0x4140('0x4d')](_0x3f36c3[_0x4140('0x36')][_0x4140('0x3b')],_[_0x4140('0x3c')](_0x3f36c3[_0x4140('0x36')],[_0x4140('0x3b'),'id'])||{})[_0x4140('0x4e')](function(){return db[_0x4140('0x4f')]['findAll']({'attributes':['id','name',_0x4140('0x50')],'where':{'id':_0x3f36c3[_0x4140('0x36')][_0x4140('0x3b')]}});})[_0x4140('0x1a')](function(_0x5099b0){socket[_0x4140('0x51')](_0x4140('0x52'),{'id':Number(_0x3f36c3['params']['id']),'tags':_0x5099b0||[]});return{'id':Number(_0x3f36c3['params']['id']),'tags':_0x5099b0||[]};});}})[_0x4140('0x1a')](respondWithResult(_0x4e381f,null))['catch'](handleError(_0x4e381f,null));};exports[_0x4140('0x53')]=function(_0x5b76b4,_0x53f950){return db[_0x4140('0x21')]['find']({'where':{'id':_0x5b76b4[_0x4140('0x29')]['id']}})[_0x4140('0x1a')](handleEntityNotFound(_0x53f950,null))[_0x4140('0x1a')](function(_0x3bd029){if(_0x3bd029){return _0x3bd029[_0x4140('0x53')](_0x5b76b4[_0x4140('0x25')][_0x4140('0x3b')]);}})[_0x4140('0x1a')](respondWithStatusCode(_0x53f950,null))[_0x4140('0x26')](handleError(_0x53f950,null));};exports[_0x4140('0x54')]=function(_0x40bfa9,_0x21e3f4){var _0x984ee3=moment()[_0x4140('0x55')]()[_0x4140('0x56')]();var _0x45f023=path[_0x4140('0x57')](config[_0x4140('0x58')],_0x4140('0x59'),_0x4140('0x5a'),_0x4140('0x5b'));var _0x1d5e81=path[_0x4140('0x57')](config['root'],_0x4140('0x59'),_0x4140('0x5a'),'attachments');var _0x28a2f9=path[_0x4140('0x57')](_0x45f023,_0x984ee3);var _0x3e9873=util[_0x4140('0x47')](_0x4140('0x5c'),_0x40bfa9[_0x4140('0x29')]['id'],_0x984ee3);var _0x5e1e7b=path[_0x4140('0x57')](_0x45f023,_0x3e9873);var _0x2a65ee=[];_0x2a65ee[_0x4140('0x5d')]({'model':db[_0x4140('0x5e')],'as':'User','attributes':['id',_0x4140('0x5f')],'raw':!![]});_0x2a65ee[_0x4140('0x5d')]({'model':db[_0x4140('0x60')],'as':_0x4140('0x61'),'attributes':['id',_0x4140('0x62'),_0x4140('0x63')],'raw':!![]});if(_0x40bfa9[_0x4140('0x25')]['attachments']){_0x2a65ee[_0x4140('0x5d')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x262cdc=[{'model':db['OpenchannelMessage'],'as':_0x4140('0x64'),'attributes':['id',_0x4140('0x36'),_0x4140('0x65'),_0x4140('0x66'),_0x4140('0x67'),_0x4140('0x68')],'include':_0x2a65ee}];_0x262cdc[_0x4140('0x5d')]({'model':db['OpenchannelAccount'],'as':_0x4140('0x69'),'attributes':['id',_0x4140('0x1d')]});_0x262cdc[_0x4140('0x5d')]({'model':db[_0x4140('0x5e')],'as':_0x4140('0x6a'),'attributes':['id','fullname']});return db[_0x4140('0x21')][_0x4140('0x34')]({'where':{'id':_0x40bfa9['params']['id']},'include':_0x262cdc})[_0x4140('0x1a')](handleEntityNotFound(_0x21e3f4,null))[_0x4140('0x1a')](function(_0x3a379b){if(_0x3a379b){var _0x18044f=_0x3a379b[_0x4140('0x6b')]({'plain':!![]});fs[_0x4140('0x6c')](_0x28a2f9);var _0x139d38={'channel':'Openchannel','account':_0x18044f[_0x4140('0x69')][_0x4140('0x1d')],'agent':_0x18044f[_0x4140('0x6a')]?_0x18044f[_0x4140('0x6a')][_0x4140('0x5f')]:_0x4140('0x6d'),'createdAt':moment(_0x18044f[_0x4140('0x65')])[_0x4140('0x47')](_0x4140('0x48'))[_0x4140('0x56')](),'closedAt':_0x18044f[_0x4140('0x6e')]?moment(_0x18044f['closedAt'])[_0x4140('0x47')](_0x4140('0x48'))[_0x4140('0x56')]():'','disposition':_0x18044f[_0x4140('0x6f')],'visibility':_0x18044f[_0x4140('0x70')]?'Public':_0x4140('0x71'),'messages':_(_0x18044f[_0x4140('0x64')])[_0x4140('0x44')]({'secret':![]})[_0x4140('0x20')](function(_0x94d25c){if(_0x94d25c[_0x4140('0x72')]){var _0x2bdafb=path[_0x4140('0x57')](_0x1d5e81,_0x94d25c[_0x4140('0x72')][_0x4140('0x73')]);if(fs[_0x4140('0x74')](_0x2bdafb)){fs[_0x4140('0x75')](_0x2bdafb)[_0x4140('0x76')](fs['createWriteStream'](path[_0x4140('0x57')](_0x28a2f9,_0x94d25c[_0x4140('0x72')][_0x4140('0x73')])));}}return{'date':moment(_0x94d25c['createdAt'])[_0x4140('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4140('0x56')](),'sender':_0x94d25c[_0x4140('0x66')]===_0x4140('0x77')?_0x94d25c['User']?_0x94d25c[_0x4140('0x5e')][_0x4140('0x5f')]:_0x4140('0x78'):_0x94d25c[_0x4140('0x61')][_0x4140('0x62')]+(_0x94d25c['Contact'][_0x4140('0x63')]?'\x20'+_0x94d25c[_0x4140('0x61')][_0x4140('0x63')]:''),'body':_0x94d25c[_0x4140('0x72')]?_0x94d25c[_0x4140('0x72')]['basename']:_0x94d25c['body'],'direction':_0x94d25c[_0x4140('0x66')]===_0x4140('0x77')?'A':'C','secret':_0x94d25c[_0x4140('0x67')],'read':_0x94d25c[_0x4140('0x68')],'attachment':_0x94d25c['Attachment']};})[_0x4140('0x79')]()};return ejs[_0x4140('0x7a')](path[_0x4140('0x57')](config[_0x4140('0x58')],_0x4140('0x59'),_0x4140('0x7b'),_0x4140('0x7c')),{'interaction':_0x139d38})['then'](function(_0x1952cc){var _0x2a74a2=path[_0x4140('0x57')](_0x28a2f9,_0x4140('0x7d')+_0x18044f['id']+'-'+_0x984ee3+_0x4140('0x7e'));var _0x3d449d={'path':_0x2a74a2,'channel':_0x4140('0x7f'),'interactionId':_0x18044f['id']};return pdf['createPdfFromHTML'](_0x1952cc,_0x3d449d);})[_0x4140('0x1a')](function(){return new Promise(function(_0x30a1a0,_0x1e7e3a){zipdir(_0x28a2f9,{'saveTo':_0x5e1e7b},function(_0x37bbfa,_0x2d5de7){if(_0x37bbfa)return _0x1e7e3a(_0x37bbfa);return _0x30a1a0(_0x2d5de7);});})[_0x4140('0x1a')](function(){return new Promise(function(_0x431ae0,_0x4b21d2){rimraf(_0x28a2f9,function(_0x483184){if(_0x483184)_0x4b21d2(_0x483184);return _0x431ae0();});});})[_0x4140('0x1a')](function(){return _0x21e3f4['download'](_0x5e1e7b,_0x3e9873,function(_0xdbb794){if(_0xdbb794){logger[_0x4140('0x80')](_0x4140('0x81'),_0xdbb794);}else{fs['unlinkSync'](_0x5e1e7b);}});});});}else{return _0x21e3f4['sendStatus'](0xc8);}})[_0x4140('0x26')](handleError(_0x21e3f4,null));}; \ No newline at end of file +var _0x296b=['undefined','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','getOptions','findAll','openchannel','query','user','show','from','params','model','keys','OpenchannelInteraction','filters','intersection','fields','attributes','length','include','merge','catch','create','body','find','describe','addMessage','ids','findOne','OpenchannelMessage','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','addTags','setTags','omit','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','Attachment','Messages','createdAt','direction','read','OpenchannelAccount','Account','Owner','fullname','get','mkdirSync','Openchannel','toString','closed','closedAt','disposition','threadId','Private','existsSync','createReadStream','createWriteStream','out','lastName','basename','secret','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','rimraf','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','limit'];(function(_0x442214,_0x3a869f){var _0x2bddf9=function(_0x34b9c7){while(--_0x34b9c7){_0x442214['push'](_0x442214['shift']());}};_0x2bddf9(++_0x3a869f);}(_0x296b,0x6e));var _0xb296=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0x296b[_0x3cb3ca];return _0x214366;};'use strict';var rimraf=require(_0xb296('0x0'));var zipdir=require('zip-dir');var moment=require(_0xb296('0x1'));var util=require(_0xb296('0x2'));var path=require(_0xb296('0x3'));var ejs=require(_0xb296('0x4'));var fs=require('fs');var _=require(_0xb296('0x5'));var Redis=require(_0xb296('0x6'));var interaction=require(_0xb296('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0xb296('0x8'));var logger=require(_0xb296('0x9'))(_0xb296('0xa'));var config=require(_0xb296('0xb'));var db=require('../../mysqldb')['db'];config[_0xb296('0xc')]=_[_0xb296('0xd')](config[_0xb296('0xc')],{'host':_0xb296('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb296('0xc')]));require(_0xb296('0xf'))[_0xb296('0x10')](socket);function respondWithStatusCode(_0x4d6fe1,_0x12de0c){_0x12de0c=_0x12de0c||0xcc;return function(_0x26e6da){if(_0x26e6da){return _0x4d6fe1[_0xb296('0x11')](_0x12de0c);}return _0x4d6fe1[_0xb296('0x12')](_0x12de0c)[_0xb296('0x13')]();};}function respondWithResult(_0x3e32f6,_0x21fa30){_0x21fa30=_0x21fa30||0xc8;return function(_0x369f8a){if(_0x369f8a){return _0x3e32f6[_0xb296('0x12')](_0x21fa30)[_0xb296('0x14')](_0x369f8a);}};}function respondWithFilteredResult(_0x2de36e,_0x3aed0b){return function(_0x683dff){if(_0x683dff){var _0x413fdb=typeof _0x3aed0b[_0xb296('0x15')]==='undefined'&&typeof _0x3aed0b[_0xb296('0x16')]===_0xb296('0x17');var _0x159cee=_0x683dff[_0xb296('0x18')];var _0x4db9ef=_0x413fdb?0x0:_0x3aed0b[_0xb296('0x15')];var _0x849f3f=_0x413fdb?_0x683dff[_0xb296('0x18')]:_0x3aed0b[_0xb296('0x15')]+_0x3aed0b[_0xb296('0x16')];var _0x50b43f;if(_0x849f3f>=_0x159cee){_0x849f3f=_0x159cee;_0x50b43f=0xc8;}else{_0x50b43f=0xce;}_0x2de36e[_0xb296('0x12')](_0x50b43f);return _0x2de36e[_0xb296('0x19')](_0xb296('0x1a'),_0x4db9ef+'-'+_0x849f3f+'/'+_0x159cee)[_0xb296('0x14')](_0x683dff);}return null;};}function saveUpdates(_0x3f3bf3){return function(_0x32b36d){if(_0x32b36d){return _0x32b36d[_0xb296('0x1b')](_0x3f3bf3)[_0xb296('0x1c')](function(_0x165175){return _0x165175;});}return null;};}function removeEntity(_0x4b5c37){return function(_0x53834a){if(_0x53834a){return _0x53834a[_0xb296('0x1d')]()['then'](function(){_0x4b5c37[_0xb296('0x12')](0xcc)[_0xb296('0x13')]();});}};}function handleEntityNotFound(_0xded9b0){return function(_0x24fd51){if(!_0x24fd51){_0xded9b0[_0xb296('0x11')](0x194);}return _0x24fd51;};}function handleError(_0x532dc9,_0x323063){_0x323063=_0x323063||0x1f4;return function(_0xa2f22c){logger[_0xb296('0x1e')](_0xa2f22c[_0xb296('0x1f')]);if(_0xa2f22c['name']){delete _0xa2f22c[_0xb296('0x20')];}_0x532dc9[_0xb296('0x12')](_0x323063)[_0xb296('0x21')](_0xa2f22c);};}exports[_0xb296('0x22')]=function(_0x31f234,_0x1f0710){var _0x595761={};var _0x3040c2=_[_0xb296('0x23')](db['OpenchannelInteraction'][_0xb296('0x24')],function(_0x9bb973){return{'name':_0x9bb973[_0xb296('0x25')],'type':_0x9bb973[_0xb296('0x26')]['key']};});_0x595761=qs[_0xb296('0x27')](_0x3040c2,_0x31f234);return interaction[_0xb296('0x28')](_0xb296('0x29'),_0x31f234[_0xb296('0x2a')],_0x31f234[_0xb296('0x2b')],_0x595761,_0x3040c2)[_0xb296('0x1c')](respondWithFilteredResult(_0x1f0710,_0x595761))['catch'](handleError(_0x1f0710,null));};exports[_0xb296('0x2c')]=function(_0x50e22f,_0x2f7cf5){var _0x2b8abe={};if(_0x50e22f[_0xb296('0x2a')][_0xb296('0x26')]&&_0x50e22f[_0xb296('0x2a')][_0xb296('0x26')]===_0xb296('0x2d')){_0x2b8abe[_0xb296('0x2d')]=_0x50e22f[_0xb296('0x2e')]['id'];}else{_0x2b8abe['id']=_0x50e22f['params']['id'];}var _0x532569={'raw':![],'where':_0x2b8abe},_0x1df4ba={};_0x1df4ba[_0xb296('0x2f')]=_[_0xb296('0x30')](db[_0xb296('0x31')][_0xb296('0x24')]);_0x1df4ba[_0xb296('0x2a')]=_['keys'](_0x50e22f[_0xb296('0x2a')]);_0x1df4ba[_0xb296('0x32')]=_['intersection'](_0x1df4ba['model'],_0x1df4ba[_0xb296('0x2a')]);_0x532569['attributes']=_[_0xb296('0x33')](_0x1df4ba[_0xb296('0x2f')],qs[_0xb296('0x34')](_0x50e22f[_0xb296('0x2a')][_0xb296('0x34')]));_0x532569['attributes']=_0x532569[_0xb296('0x35')][_0xb296('0x36')]?_0x532569[_0xb296('0x35')]:_0x1df4ba[_0xb296('0x2f')];if(_0x50e22f[_0xb296('0x2a')]['includeAll']){_0x532569[_0xb296('0x37')]=[{'all':!![]}];}_0x532569=_[_0xb296('0x38')]({},_0x532569,_0x50e22f['options']);return db[_0xb296('0x31')]['find'](_0x532569)[_0xb296('0x1c')](handleEntityNotFound(_0x2f7cf5,null))[_0xb296('0x1c')](respondWithResult(_0x2f7cf5,null))[_0xb296('0x39')](handleError(_0x2f7cf5,null));};exports[_0xb296('0x3a')]=function(_0x59dbe4,_0x1ed6dc){return db[_0xb296('0x31')][_0xb296('0x3a')](_0x59dbe4[_0xb296('0x3b')],{})[_0xb296('0x1c')](respondWithResult(_0x1ed6dc,0xc9))['catch'](handleError(_0x1ed6dc,null));};exports[_0xb296('0x1b')]=function(_0x4a93bf,_0x5d57db){if(_0x4a93bf[_0xb296('0x3b')]['id']){delete _0x4a93bf[_0xb296('0x3b')]['id'];}return db[_0xb296('0x31')]['find']({'where':{'id':_0x4a93bf[_0xb296('0x2e')]['id']}})[_0xb296('0x1c')](handleEntityNotFound(_0x5d57db,null))[_0xb296('0x1c')](saveUpdates(_0x4a93bf['body'],null))[_0xb296('0x1c')](respondWithResult(_0x5d57db,null))[_0xb296('0x39')](handleError(_0x5d57db,null));};exports[_0xb296('0x1d')]=function(_0x413f3c,_0xc54ac2){return db[_0xb296('0x31')][_0xb296('0x3c')]({'where':{'id':_0x413f3c[_0xb296('0x2e')]['id']}})['then'](handleEntityNotFound(_0xc54ac2,null))[_0xb296('0x1c')](removeEntity(_0xc54ac2,null))[_0xb296('0x39')](handleError(_0xc54ac2,null));};exports[_0xb296('0x3d')]=function(_0x4fc8bd,_0x5e934f){return db['OpenchannelInteraction'][_0xb296('0x3d')]()[_0xb296('0x1c')](respondWithResult(_0x5e934f,null))[_0xb296('0x39')](handleError(_0x5e934f,null));};exports[_0xb296('0x3e')]=function(_0x3390bb,_0x40e8af){return db['OpenchannelMessage']['find']({'where':{'id':_0x3390bb[_0xb296('0x2e')]['id']}})['then'](handleEntityNotFound(_0x40e8af,null))[_0xb296('0x1c')](function(_0x5c7779){if(_0x5c7779){return _0x5c7779[_0xb296('0x3e')](_0x3390bb['body'][_0xb296('0x3f')],_['omit'](_0x3390bb[_0xb296('0x3b')],[_0xb296('0x3f'),'id'])||{});}})[_0xb296('0x1c')](respondWithResult(_0x40e8af,null))['catch'](handleError(_0x40e8af,null));};exports['getMessages']=function(_0x37307c,_0x5555f3){var _0x25fcce={'raw':![],'where':{}};var _0x4af622={};var _0x388a89={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xb296('0x40')]({'where':{'id':_0x37307c[_0xb296('0x2e')]['id']}})['then'](handleEntityNotFound(_0x5555f3,null))['then'](function(_0x4909d8){if(_0x4909d8){_0x4af622[_0xb296('0x2f')]=_[_0xb296('0x30')](db[_0xb296('0x41')][_0xb296('0x24')]);_0x4af622[_0xb296('0x2a')]=_[_0xb296('0x30')](_0x37307c['query']);_0x4af622['filters']=_[_0xb296('0x33')](_0x4af622[_0xb296('0x2f')],_0x4af622['query']);_0x25fcce[_0xb296('0x35')]=_[_0xb296('0x33')](_0x4af622[_0xb296('0x2f')],qs[_0xb296('0x34')](_0x37307c[_0xb296('0x2a')]['fields']));_0x25fcce[_0xb296('0x35')]=_0x25fcce['attributes']['length']?_0x25fcce[_0xb296('0x35')]:_0x4af622['model'];if(!_0x37307c['query'][_0xb296('0x42')](_0xb296('0x43'))){_0x25fcce['limit']=qs[_0xb296('0x16')](_0x37307c[_0xb296('0x2a')][_0xb296('0x16')]);_0x25fcce[_0xb296('0x15')]=qs[_0xb296('0x15')](_0x37307c['query']['offset']);}_0x25fcce[_0xb296('0x44')]=qs[_0xb296('0x45')](_0x37307c[_0xb296('0x2a')]['sort']);_0x25fcce[_0xb296('0x46')]=qs[_0xb296('0x32')](_[_0xb296('0x47')](_0x37307c[_0xb296('0x2a')],_0x4af622[_0xb296('0x32')]));_0x25fcce[_0xb296('0x46')][_0xb296('0x48')]=_0x4909d8['id'];if(_0x37307c[_0xb296('0x2a')][_0xb296('0x49')]){_0x25fcce[_0xb296('0x46')]=_[_0xb296('0x38')](_0x25fcce[_0xb296('0x46')],{'$or':_[_0xb296('0x23')](_0x25fcce[_0xb296('0x35')],function(_0x4015db){var _0x91f85={};_0x91f85[_0x4015db]={'$like':'%'+_0x37307c['query']['filter']+'%'};return _0x91f85;})});}if(_0x37307c[_0xb296('0x2a')][_0xb296('0x4a')]){var _0x164aba=_0x37307c[_0xb296('0x2a')][_0xb296('0x4a')]['split'](',');var _0x9e0c52={};_0x9e0c52[_0x164aba[0x0]]={'$gte':moment(_0x164aba[0x1])[_0xb296('0x4b')](_0xb296('0x4c'))};_0x25fcce[_0xb296('0x46')]=_['merge'](_0x25fcce[_0xb296('0x46')],_0x9e0c52);}_0x25fcce=_[_0xb296('0x38')]({},_0x25fcce,_0x37307c[_0xb296('0x4d')]);return db['OpenchannelMessage'][_0xb296('0x18')]({'where':_0x25fcce['where']})['then'](function(_0x5a8375){_0x388a89[_0xb296('0x18')]=_0x5a8375;if(_0x37307c[_0xb296('0x2a')][_0xb296('0x4e')]){_0x25fcce[_0xb296('0x37')]=[{'all':!![]}];}return db[_0xb296('0x41')]['findAll'](_0x25fcce);})['then'](function(_0xef6f44){_0x388a89['rows']=_0xef6f44;return _0x388a89;});}})[_0xb296('0x1c')](respondWithFilteredResult(_0x5555f3,_0x25fcce))[_0xb296('0x39')](handleError(_0x5555f3,null));};exports[_0xb296('0x4f')]=function(_0x315cc7,_0x19a0d7){return db[_0xb296('0x31')]['find']({'where':{'id':_0x315cc7[_0xb296('0x2e')]['id']}})[_0xb296('0x1c')](handleEntityNotFound(_0x19a0d7,null))['then'](function(_0xa512b9){if(_0xa512b9){return _0xa512b9[_0xb296('0x50')](_0x315cc7[_0xb296('0x3b')][_0xb296('0x3f')],_[_0xb296('0x51')](_0x315cc7[_0xb296('0x3b')],[_0xb296('0x3f'),'id'])||{})[_0xb296('0x52')](function(){return db[_0xb296('0x53')]['findAll']({'attributes':['id',_0xb296('0x20'),_0xb296('0x54')],'where':{'id':_0x315cc7['body']['ids']}});})[_0xb296('0x1c')](function(_0xda7e05){socket[_0xb296('0x55')](_0xb296('0x56'),{'id':Number(_0x315cc7[_0xb296('0x2e')]['id']),'tags':_0xda7e05||[]});return{'id':Number(_0x315cc7[_0xb296('0x2e')]['id']),'tags':_0xda7e05||[]};});}})[_0xb296('0x1c')](respondWithResult(_0x19a0d7,null))[_0xb296('0x39')](handleError(_0x19a0d7,null));};exports[_0xb296('0x57')]=function(_0x1f9d45,_0x3ff7b1){return db[_0xb296('0x31')]['find']({'where':{'id':_0x1f9d45[_0xb296('0x2e')]['id']}})[_0xb296('0x1c')](handleEntityNotFound(_0x3ff7b1,null))[_0xb296('0x1c')](function(_0x3b57b6){if(_0x3b57b6){return _0x3b57b6['removeTags'](_0x1f9d45[_0xb296('0x2a')][_0xb296('0x3f')]);}})[_0xb296('0x1c')](respondWithStatusCode(_0x3ff7b1,null))[_0xb296('0x39')](handleError(_0x3ff7b1,null));};exports[_0xb296('0x58')]=function(_0x5cd55a,_0x16a859){var _0x40a3ef=moment()[_0xb296('0x59')]()['toString']();var _0x41ff1f=path[_0xb296('0x5a')](config[_0xb296('0x5b')],_0xb296('0x5c'),_0xb296('0x5d'),_0xb296('0x5e'));var _0x14592d=path[_0xb296('0x5a')](config[_0xb296('0x5b')],'server',_0xb296('0x5d'),_0xb296('0x5f'));var _0xe9694e=path[_0xb296('0x5a')](_0x41ff1f,_0x40a3ef);var _0xc38040=util[_0xb296('0x4b')](_0xb296('0x60'),_0x5cd55a[_0xb296('0x2e')]['id'],_0x40a3ef);var _0x48d2d6=path[_0xb296('0x5a')](_0x41ff1f,_0xc38040);var _0x46c4fb=[];_0x46c4fb[_0xb296('0x61')]({'model':db[_0xb296('0x62')],'as':_0xb296('0x62'),'attributes':['id','fullname'],'raw':!![]});_0x46c4fb[_0xb296('0x61')]({'model':db[_0xb296('0x63')],'as':_0xb296('0x64'),'attributes':['id',_0xb296('0x65'),'lastName'],'raw':!![]});if(_0x5cd55a[_0xb296('0x2a')][_0xb296('0x5f')]){_0x46c4fb[_0xb296('0x61')]({'model':db[_0xb296('0x66')],'as':_0xb296('0x66'),'raw':!![]});}var _0x57ae6f=[{'model':db[_0xb296('0x41')],'as':_0xb296('0x67'),'attributes':['id',_0xb296('0x3b'),_0xb296('0x68'),_0xb296('0x69'),'secret',_0xb296('0x6a')],'include':_0x46c4fb}];_0x57ae6f[_0xb296('0x61')]({'model':db[_0xb296('0x6b')],'as':_0xb296('0x6c'),'attributes':['id',_0xb296('0x20')]});_0x57ae6f['push']({'model':db['User'],'as':_0xb296('0x6d'),'attributes':['id',_0xb296('0x6e')]});return db[_0xb296('0x31')][_0xb296('0x3c')]({'where':{'id':_0x5cd55a[_0xb296('0x2e')]['id']},'include':_0x57ae6f})[_0xb296('0x1c')](handleEntityNotFound(_0x16a859,null))['then'](function(_0x25f7fd){if(_0x25f7fd){var _0x20b3c5=_0x25f7fd[_0xb296('0x6f')]({'plain':!![]});fs[_0xb296('0x70')](_0xe9694e);var _0x41290c={'channel':_0xb296('0x71'),'account':_0x20b3c5['Account'][_0xb296('0x20')],'agent':_0x20b3c5[_0xb296('0x6d')]?_0x20b3c5[_0xb296('0x6d')][_0xb296('0x6e')]:'N.A.','createdAt':moment(_0x20b3c5[_0xb296('0x68')])[_0xb296('0x4b')](_0xb296('0x4c'))[_0xb296('0x72')](),'closedAt':_0x20b3c5[_0xb296('0x73')]?moment(_0x20b3c5[_0xb296('0x74')])['format'](_0xb296('0x4c'))[_0xb296('0x72')]():'','disposition':_0x20b3c5[_0xb296('0x75')],'visibility':_0x20b3c5[_0xb296('0x76')]?'Public':_0xb296('0x77'),'messages':_(_0x20b3c5[_0xb296('0x67')])[_0xb296('0x49')]({'secret':![]})[_0xb296('0x23')](function(_0x128ea1){if(_0x128ea1[_0xb296('0x66')]){var _0x1fce00=path['join'](_0x14592d,_0x128ea1[_0xb296('0x66')]['basename']);if(fs[_0xb296('0x78')](_0x1fce00)){fs[_0xb296('0x79')](_0x1fce00)['pipe'](fs[_0xb296('0x7a')](path[_0xb296('0x5a')](_0xe9694e,_0x128ea1['Attachment']['basename'])));}}return{'date':moment(_0x128ea1[_0xb296('0x68')])[_0xb296('0x4b')](_0xb296('0x4c'))[_0xb296('0x72')](),'sender':_0x128ea1[_0xb296('0x69')]===_0xb296('0x7b')?_0x128ea1[_0xb296('0x62')]?_0x128ea1[_0xb296('0x62')][_0xb296('0x6e')]:'System':_0x128ea1[_0xb296('0x64')]['firstName']+(_0x128ea1[_0xb296('0x64')][_0xb296('0x7c')]?'\x20'+_0x128ea1[_0xb296('0x64')]['lastName']:''),'body':_0x128ea1[_0xb296('0x66')]?_0x128ea1['Attachment'][_0xb296('0x7d')]:_0x128ea1['body'],'direction':_0x128ea1[_0xb296('0x69')]===_0xb296('0x7b')?'A':'C','secret':_0x128ea1[_0xb296('0x7e')],'read':_0x128ea1[_0xb296('0x6a')],'attachment':_0x128ea1[_0xb296('0x66')]};})['value']()};return ejs['renderFile'](path['join'](config[_0xb296('0x5b')],_0xb296('0x5c'),_0xb296('0x7f'),_0xb296('0x80')),{'interaction':_0x41290c})[_0xb296('0x1c')](function(_0x431480){var _0xdba2f1=path[_0xb296('0x5a')](_0xe9694e,_0xb296('0x81')+_0x20b3c5['id']+'-'+_0x40a3ef+_0xb296('0x82'));var _0x3bc0b3={'path':_0xdba2f1,'channel':_0xb296('0x71'),'interactionId':_0x20b3c5['id']};return pdf[_0xb296('0x83')](_0x431480,_0x3bc0b3);})[_0xb296('0x1c')](function(){return new Promise(function(_0x2751c3,_0x47a089){zipdir(_0xe9694e,{'saveTo':_0x48d2d6},function(_0x3c58d3,_0x10eaad){if(_0x3c58d3)return _0x47a089(_0x3c58d3);return _0x2751c3(_0x10eaad);});})[_0xb296('0x1c')](function(){return new Promise(function(_0x2283a5,_0x51490b){rimraf(_0xe9694e,function(_0x181155){if(_0x181155)_0x51490b(_0x181155);return _0x2283a5();});});})[_0xb296('0x1c')](function(){return _0x16a859[_0xb296('0x58')](_0x48d2d6,_0xc38040,function(_0x37f579){if(_0x37f579){logger[_0xb296('0x1e')](_0xb296('0x84'),_0x37f579);}else{fs['unlinkSync'](_0x48d2d6);}});});});}else{return _0x16a859['sendStatus'](0xc8);}})['catch'](handleError(_0x16a859,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index ceb1946..2a326d9 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 _0x1a12=['emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length'];(function(_0x141131,_0x52b412){var _0x3287e7=function(_0x24f1d9){while(--_0x24f1d9){_0x141131['push'](_0x141131['shift']());}};_0x3287e7(++_0x52b412);}(_0x1a12,0x124));var _0x21a1=function(_0x9bc85,_0x12b60b){_0x9bc85=_0x9bc85-0x0;var _0x4ba2ec=_0x1a12[_0x9bc85];return _0x4ba2ec;};'use strict';var EventEmitter=require(_0x21a1('0x0'));var OpenchannelInteraction=require(_0x21a1('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x21a1('0x1'))['db'][_0x21a1('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x21a1('0x3')](0x0);var events={'afterCreate':_0x21a1('0x4'),'afterUpdate':_0x21a1('0x5'),'afterDestroy':_0x21a1('0x6')};function emitEvent(_0x46cf5b){return function(_0x2832f9,_0x5273ba,_0x12cd4b){_0x2832f9[_0x21a1('0x7')]({'attributes':['id'],'raw':!![]})[_0x21a1('0x8')](function(_0x19eefa){_0x2832f9[_0x21a1('0x9')]('Users',_0x19eefa[_0x21a1('0xa')](function(_0x1ddaa1){return{'id':_0x1ddaa1['id']};}));return OpenchannelMessage[_0x21a1('0xb')]({'where':{'OpenchannelInteractionId':_0x2832f9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x21a1('0x8')](function(_0x562436){_0x2832f9[_0x21a1('0x9')](_0x21a1('0xc'),_0x562436[_0x21a1('0xd')]);OpenchannelInteractionEvents['emit'](_0x46cf5b+':'+_0x2832f9['id'],_0x2832f9);OpenchannelInteractionEvents[_0x21a1('0xe')](_0x46cf5b,_0x2832f9);_0x12cd4b(null);})[_0x21a1('0xf')](_0x12cd4b(null));};}for(var e in events){if(events[_0x21a1('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x21a1('0x11')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x9253=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch'];(function(_0x28aac6,_0x8cc55a){var _0x57ebef=function(_0x26a73f){while(--_0x26a73f){_0x28aac6['push'](_0x28aac6['shift']());}};_0x57ebef(++_0x8cc55a);}(_0x9253,0x1cb));var _0x3925=function(_0x2879da,_0x2433cd){_0x2879da=_0x2879da-0x0;var _0x421d56=_0x9253[_0x2879da];return _0x421d56;};'use strict';var EventEmitter=require(_0x3925('0x0'));var OpenchannelInteraction=require(_0x3925('0x1'))['db'][_0x3925('0x2')];var OpenchannelMessage=require(_0x3925('0x1'))['db'][_0x3925('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x3925('0x4')](0x0);var events={'afterCreate':_0x3925('0x5'),'afterUpdate':'update','afterDestroy':_0x3925('0x6')};function emitEvent(_0x327102){return function(_0x1d5417,_0x12e99d,_0x5e14f2){_0x1d5417[_0x3925('0x7')]({'attributes':['id'],'raw':!![]})[_0x3925('0x8')](function(_0x2405b7){_0x1d5417[_0x3925('0x9')](_0x3925('0xa'),_0x2405b7['map'](function(_0x593639){return{'id':_0x593639['id']};}));return OpenchannelMessage[_0x3925('0xb')]({'where':{'OpenchannelInteractionId':_0x1d5417['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3925('0x8')](function(_0x28e3b0){_0x1d5417[_0x3925('0x9')](_0x3925('0xc'),_0x28e3b0[_0x3925('0xd')]);OpenchannelInteractionEvents[_0x3925('0xe')](_0x327102+':'+_0x1d5417['id'],_0x1d5417);OpenchannelInteractionEvents[_0x3925('0xe')](_0x327102,_0x1d5417);_0x5e14f2(null);})[_0x3925('0xf')](_0x5e14f2(null));};}for(var e in events){if(events[_0x3925('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x3925('0x11')](e,emitEvent(event));}}module[_0x3925('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 4052372..6917eef 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 _0x1e33=['./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x9c2b18,_0x21a082){var _0x2afc7b=function(_0x3ae826){while(--_0x3ae826){_0x9c2b18['push'](_0x9c2b18['shift']());}};_0x2afc7b(++_0x21a082);}(_0x1e33,0x13d));var _0x31e3=function(_0x3104d7,_0x197001){_0x3104d7=_0x3104d7-0x0;var _0x9917b5=_0x1e33[_0x3104d7];return _0x9917b5;};'use strict';var _=require('lodash');var util=require(_0x31e3('0x0'));var logger=require('../../config/logger')(_0x31e3('0x1'));var moment=require(_0x31e3('0x2'));var BPromise=require(_0x31e3('0x3'));var rp=require(_0x31e3('0x4'));var fs=require('fs');var path=require(_0x31e3('0x5'));var rimraf=require(_0x31e3('0x6'));var config=require('../../config/environment');var attributes=require(_0x31e3('0x7'));module[_0x31e3('0x8')]=function(_0x500d96,_0x92d309){return _0x500d96[_0x31e3('0x9')](_0x31e3('0xa'),attributes,{'tableName':_0x31e3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x31e3('0xc'),'hooks':{'beforeUpdate':function(_0x1793a1,_0x32a5fe,_0x470a1b){if(_0x1793a1[_0x31e3('0xd')](_0x31e3('0xe'))){_0x1793a1[_0x31e3('0xf')]=moment()[_0x31e3('0x10')](_0x31e3('0x11'));}_0x470a1b(null,_0x1793a1);}}});}; \ No newline at end of file +var _0x6113=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed'];(function(_0x5e88d8,_0x399d52){var _0xa1d699=function(_0xa50de4){while(--_0xa50de4){_0x5e88d8['push'](_0x5e88d8['shift']());}};_0xa1d699(++_0x399d52);}(_0x6113,0x1b2));var _0x3611=function(_0x4f0c5f,_0x3f5868){_0x4f0c5f=_0x4f0c5f-0x0;var _0x5d45c5=_0x6113[_0x4f0c5f];return _0x5d45c5;};'use strict';var _=require(_0x3611('0x0'));var util=require(_0x3611('0x1'));var logger=require(_0x3611('0x2'))('api');var moment=require(_0x3611('0x3'));var BPromise=require(_0x3611('0x4'));var rp=require(_0x3611('0x5'));var fs=require('fs');var path=require(_0x3611('0x6'));var rimraf=require('rimraf');var config=require(_0x3611('0x7'));var attributes=require(_0x3611('0x8'));module[_0x3611('0x9')]=function(_0xd601b4,_0x5126cd){return _0xd601b4[_0x3611('0xa')](_0x3611('0xb'),attributes,{'tableName':_0x3611('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3611('0xd'),'collate':_0x3611('0xe'),'hooks':{'beforeUpdate':function(_0x450266,_0x4bffdc,_0x2957ab){if(_0x450266[_0x3611('0xf')]('closed')){_0x450266['closedAt']=moment()[_0x3611('0x10')](_0x3611('0x11'));}_0x2957ab(null,_0x450266);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 96fcb92..574a4af 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 _0x5675=['options','where','AddTagsToOpenchannelInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5675,0xd6));var _0x5567=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x5675[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x5567('0x0'));var util=require(_0x5567('0x1'));var moment=require('moment');var BPromise=require(_0x5567('0x2'));var rs=require(_0x5567('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5567('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5567('0x5'))(_0x5567('0x6'));var config=require(_0x5567('0x7'));var jayson=require(_0x5567('0x8'));var client=jayson[_0x5567('0x9')][_0x5567('0xa')]({'port':0x232a});config[_0x5567('0xb')]=_[_0x5567('0xc')](config['redis'],{'host':_0x5567('0xd'),'port':0x18eb});var socket=require(_0x5567('0xe'))(new Redis(config[_0x5567('0xb')]));require(_0x5567('0xf'))['register'](socket);function respondWithRpcPromise(_0x22dc94,_0x520304,_0x81eea2){return new BPromise(function(_0x3d8987,_0x22d136){return client[_0x5567('0x10')](_0x22dc94,_0x81eea2)[_0x5567('0x11')](function(_0x51a427){logger[_0x5567('0x12')](_0x5567('0x13'),_0x520304,_0x5567('0x14'));logger[_0x5567('0x15')](_0x5567('0x16'),_0x520304,_0x5567('0x14'),JSON[_0x5567('0x17')](_0x51a427));if(_0x51a427[_0x5567('0x18')]){if(_0x51a427[_0x5567('0x18')][_0x5567('0x19')]===0x1f4){logger['error'](_0x5567('0x13'),_0x520304,_0x51a427[_0x5567('0x18')][_0x5567('0x1a')]);return _0x22d136(_0x51a427[_0x5567('0x18')][_0x5567('0x1a')]);}logger[_0x5567('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x520304,_0x51a427['error']['message']);return _0x3d8987(_0x51a427[_0x5567('0x18')][_0x5567('0x1a')]);}else{logger[_0x5567('0x12')](_0x5567('0x13'),_0x520304,_0x5567('0x14'));_0x3d8987(_0x51a427['result'][_0x5567('0x1a')]);}})[_0x5567('0x1b')](function(_0x42f848){logger[_0x5567('0x18')](_0x5567('0x13'),_0x520304,_0x42f848);_0x22d136(_0x42f848);});});}exports[_0x5567('0x1c')]=function(_0x3e55ce){var _0x38ae0f=this;return new Promise(function(_0x2f3947,_0x5f4e93){return db[_0x5567('0x1d')][_0x5567('0x1e')](_0x3e55ce[_0x5567('0x1f')],{'raw':_0x3e55ce[_0x5567('0x20')]?_0x3e55ce[_0x5567('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e55ce[_0x5567('0x20')]?_0x3e55ce['options'][_0x5567('0x21')]||null:null,'attributes':_0x3e55ce[_0x5567('0x20')]?_0x3e55ce[_0x5567('0x20')]['attributes']||null:null,'limit':_0x3e55ce[_0x5567('0x20')]?_0x3e55ce[_0x5567('0x20')]['limit']||null:null})['then'](function(_0x42b5df){logger[_0x5567('0x12')](_0x5567('0x1c'),_0x3e55ce);logger[_0x5567('0x15')](_0x5567('0x1c'),_0x3e55ce,JSON[_0x5567('0x17')](_0x42b5df));_0x2f3947(_0x42b5df);})[_0x5567('0x1b')](function(_0x21724f){logger['error'](_0x5567('0x1c'),_0x21724f[_0x5567('0x1a')],_0x3e55ce);_0x5f4e93(_0x38ae0f[_0x5567('0x18')](0x1f4,_0x21724f['message']));});});};exports[_0x5567('0x22')]=function(_0x50b849){return new Promise(function(_0x2e5756,_0x286342){return db[_0x5567('0x1d')][_0x5567('0x23')]({'where':_0x50b849[_0x5567('0x20')]?_0x50b849['options'][_0x5567('0x21')]||null:null})[_0x5567('0x11')](function(_0x2edcdd){if(_0x2edcdd){return _0x2edcdd[_0x5567('0x24')](_0x50b849[_0x5567('0x1f')]['ids'],_[_0x5567('0x25')](_0x50b849['body'],[_0x5567('0x26'),'id'])||{});}})[_0x5567('0x27')](function(_0x4b86ad){logger[_0x5567('0x12')](_0x5567('0x28'),_0x50b849);logger[_0x5567('0x15')](_0x5567('0x28'),_0x50b849,JSON['stringify'](_0x4b86ad));_0x2e5756(_0x4b86ad);})[_0x5567('0x1b')](function(_0x29a672){logger[_0x5567('0x18')](_0x5567('0x28'),_0x29a672[_0x5567('0x1a')],_0x50b849);_0x286342(_this[_0x5567('0x18')](0x1f4,_0x29a672[_0x5567('0x1a')]));});});}; \ No newline at end of file +var _0x6e44=['debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','body','options','raw','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','where','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s'];(function(_0x4437c7,_0x2bd96c){var _0x13893c=function(_0x3132b9){while(--_0x3132b9){_0x4437c7['push'](_0x4437c7['shift']());}};_0x13893c(++_0x2bd96c);}(_0x6e44,0xc5));var _0x46e4=function(_0x1a3634,_0x3a5fe7){_0x1a3634=_0x1a3634-0x0;var _0x2338c7=_0x6e44[_0x1a3634];return _0x2338c7;};'use strict';var _=require(_0x46e4('0x0'));var util=require(_0x46e4('0x1'));var moment=require(_0x46e4('0x2'));var BPromise=require(_0x46e4('0x3'));var rs=require(_0x46e4('0x4'));var fs=require('fs');var Redis=require(_0x46e4('0x5'));var db=require(_0x46e4('0x6'))['db'];var utils=require(_0x46e4('0x7'));var logger=require(_0x46e4('0x8'))(_0x46e4('0x9'));var config=require(_0x46e4('0xa'));var jayson=require(_0x46e4('0xb'));var client=jayson['client'][_0x46e4('0xc')]({'port':0x232a});config['redis']=_[_0x46e4('0xd')](config[_0x46e4('0xe')],{'host':_0x46e4('0xf'),'port':0x18eb});var socket=require(_0x46e4('0x10'))(new Redis(config['redis']));require(_0x46e4('0x11'))[_0x46e4('0x12')](socket);function respondWithRpcPromise(_0x2c556e,_0x4cb1a0,_0x3c9455){return new BPromise(function(_0x4cf2e6,_0x316189){return client[_0x46e4('0x13')](_0x2c556e,_0x3c9455)[_0x46e4('0x14')](function(_0xf700cb){logger[_0x46e4('0x15')](_0x46e4('0x16'),_0x4cb1a0,'request\x20sent');logger[_0x46e4('0x17')](_0x46e4('0x18'),_0x4cb1a0,_0x46e4('0x19'),JSON[_0x46e4('0x1a')](_0xf700cb));if(_0xf700cb[_0x46e4('0x1b')]){if(_0xf700cb['error'][_0x46e4('0x1c')]===0x1f4){logger[_0x46e4('0x1b')](_0x46e4('0x16'),_0x4cb1a0,_0xf700cb['error']['message']);return _0x316189(_0xf700cb[_0x46e4('0x1b')][_0x46e4('0x1d')]);}logger[_0x46e4('0x1b')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4cb1a0,_0xf700cb['error'][_0x46e4('0x1d')]);return _0x4cf2e6(_0xf700cb[_0x46e4('0x1b')][_0x46e4('0x1d')]);}else{logger[_0x46e4('0x15')](_0x46e4('0x16'),_0x4cb1a0,_0x46e4('0x19'));_0x4cf2e6(_0xf700cb[_0x46e4('0x1e')][_0x46e4('0x1d')]);}})[_0x46e4('0x1f')](function(_0x4584a0){logger['error'](_0x46e4('0x16'),_0x4cb1a0,_0x4584a0);_0x316189(_0x4584a0);});});}exports[_0x46e4('0x20')]=function(_0x2f9ab6){var _0x1ea59b=this;return new Promise(function(_0x3b4d1a,_0x211a5c){return db['OpenchannelInteraction']['update'](_0x2f9ab6[_0x46e4('0x21')],{'raw':_0x2f9ab6[_0x46e4('0x22')]?_0x2f9ab6['options'][_0x46e4('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f9ab6[_0x46e4('0x22')]?_0x2f9ab6[_0x46e4('0x22')]['where']||null:null,'attributes':_0x2f9ab6[_0x46e4('0x22')]?_0x2f9ab6['options']['attributes']||null:null,'limit':_0x2f9ab6[_0x46e4('0x22')]?_0x2f9ab6[_0x46e4('0x22')][_0x46e4('0x24')]||null:null})[_0x46e4('0x14')](function(_0xe37afe){logger[_0x46e4('0x15')](_0x46e4('0x20'),_0x2f9ab6);logger['debug'](_0x46e4('0x20'),_0x2f9ab6,JSON[_0x46e4('0x1a')](_0xe37afe));_0x3b4d1a(_0xe37afe);})['catch'](function(_0x3a9eae){logger['error'](_0x46e4('0x20'),_0x3a9eae[_0x46e4('0x1d')],_0x2f9ab6);_0x211a5c(_0x1ea59b[_0x46e4('0x1b')](0x1f4,_0x3a9eae['message']));});});};exports[_0x46e4('0x25')]=function(_0x1f9134){return new Promise(function(_0x107233,_0xa9c95d){return db[_0x46e4('0x26')][_0x46e4('0x27')]({'where':_0x1f9134[_0x46e4('0x22')]?_0x1f9134[_0x46e4('0x22')][_0x46e4('0x28')]||null:null})[_0x46e4('0x14')](function(_0x21b7fc){if(_0x21b7fc){return _0x21b7fc['addTags'](_0x1f9134[_0x46e4('0x21')][_0x46e4('0x29')],_['omit'](_0x1f9134[_0x46e4('0x21')],[_0x46e4('0x29'),'id'])||{});}})[_0x46e4('0x2a')](function(_0x5604c3){logger[_0x46e4('0x15')](_0x46e4('0x2b'),_0x1f9134);logger[_0x46e4('0x17')](_0x46e4('0x2b'),_0x1f9134,JSON[_0x46e4('0x1a')](_0x5604c3));_0x107233(_0x5604c3);})[_0x46e4('0x1f')](function(_0xe69d09){logger[_0x46e4('0x1b')](_0x46e4('0x2b'),_0xe69d09[_0x46e4('0x1d')],_0x1f9134);_0xa9c95d(_this[_0x46e4('0x1b')](0x1f4,_0xe69d09[_0x46e4('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index ff6f85a..61b5092 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 _0x3522=['remove','update','emit','register','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x262063,_0x4aef94){var _0x2ff61b=function(_0x3775c1){while(--_0x3775c1){_0x262063['push'](_0x262063['shift']());}};_0x2ff61b(++_0x4aef94);}(_0x3522,0x8e));var _0x2352=function(_0x59204e,_0x17bf98){_0x59204e=_0x59204e-0x0;var _0x5b49eb=_0x3522[_0x59204e];return _0x5b49eb;};'use strict';var OpenchannelInteractionEvents=require(_0x2352('0x0'));var events=[_0x2352('0x1'),_0x2352('0x2'),_0x2352('0x3')];function createListener(_0xbd0bfc,_0x31a3c8){return function(_0x53dc95){_0x31a3c8[_0x2352('0x4')](_0xbd0bfc,_0x53dc95);};}function removeListener(_0xefde91,_0x4ca8e6){return function(){OpenchannelInteractionEvents['removeListener'](_0xefde91,_0x4ca8e6);};}exports[_0x2352('0x5')]=function(_0x54e106){for(var _0x211699=0x0,_0x1d2440=events[_0x2352('0x6')];_0x211699<_0x1d2440;_0x211699++){var _0x25431f=events[_0x211699];var _0x5ac012=createListener(_0x2352('0x7')+_0x25431f,_0x54e106);OpenchannelInteractionEvents['on'](_0x25431f,_0x5ac012);}}; \ No newline at end of file +var _0x093c=['save','remove','removeListener','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x48f7cf,_0x4baa04){var _0xc201c0=function(_0x23ff34){while(--_0x23ff34){_0x48f7cf['push'](_0x48f7cf['shift']());}};_0xc201c0(++_0x4baa04);}(_0x093c,0x16d));var _0xc093=function(_0x488838,_0xfc56d0){_0x488838=_0x488838-0x0;var _0x1c8741=_0x093c[_0x488838];return _0x1c8741;};'use strict';var OpenchannelInteractionEvents=require(_0xc093('0x0'));var events=[_0xc093('0x1'),_0xc093('0x2'),'update'];function createListener(_0x37a72a,_0x4988cf){return function(_0x3999f0){_0x4988cf['emit'](_0x37a72a,_0x3999f0);};}function removeListener(_0x4fbaac,_0x3f2bd3){return function(){OpenchannelInteractionEvents[_0xc093('0x3')](_0x4fbaac,_0x3f2bd3);};}exports['register']=function(_0x7dc807){for(var _0x2a3407=0x0,_0x49fcb7=events[_0xc093('0x4')];_0x2a3407<_0x49fcb7;_0x2a3407++){var _0x159c5a=events[_0x2a3407];var _0x273bf6=createListener(_0xc093('0x5')+_0x159c5a,_0x7dc807);OpenchannelInteractionEvents['on'](_0x159c5a,_0x273bf6);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index adeb36d..8eefef1 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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x2ffc98,_0x5a0140){var _0x1bb50a=function(_0x77385){while(--_0x77385){_0x2ffc98['push'](_0x2ffc98['shift']());}};_0x1bb50a(++_0x5a0140);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xcb91[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +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(_0x52c259,_0x4bc883){var _0x71b342=function(_0x104336){while(--_0x104336){_0x52c259['push'](_0x52c259['shift']());}};_0x71b342(++_0x4bc883);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 032217e..6e2bf8e 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 _0xbaf0=['DATE','STRING','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x4bb156,_0x154c26){var _0x439eaf=function(_0x12bcbb){while(--_0x12bcbb){_0x4bb156['push'](_0x4bb156['shift']());}};_0x439eaf(++_0x154c26);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'body':{'type':Sequelize[_0x0baf('0x1')](_0x0baf('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0baf('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0baf('0x4')]('in','out'),'defaultValue':_0x0baf('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0baf('0x6')]},'providerName':{'type':Sequelize[_0x0baf('0x7')]},'providerResponse':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xb9e7=['ENUM','out','DATE','exports','TEXT','medium','BOOLEAN'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0xb9e7[_0x26f1b2];return _0x1624a4;};'use strict';var Sequelize=require('sequelize');module[_0x7b9e('0x0')]={'body':{'type':Sequelize[_0x7b9e('0x1')](_0x7b9e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7b9e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7b9e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7b9e('0x4')]('in','out'),'defaultValue':_0x7b9e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7b9e('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7b9e('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 1bc47fd..8461839 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 _0xa8d4=['model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','show','params','rawAttributes','options','find','catch','create','body','describe','openchannel','acceptMessage','reject','UserId','user','agent','get','OpenchannelInteraction','interaction','role','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','interface','channel','EventManager','rejectmessage','util','lodash','ioredis','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','client','http','../../config/logger','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','stack','name','map','OpenchannelMessage','fieldName','type','key','query','keys','intersection'];(function(_0x4d778f,_0x1d4a49){var _0x100d48=function(_0x31e8bf){while(--_0x31e8bf){_0x4d778f['push'](_0x4d778f['shift']());}};_0x100d48(++_0x1d4a49);}(_0xa8d4,0xe7));var _0x4a8d=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa8d4[_0x1da04e];return _0xdd8c41;};'use strict';var util=require(_0x4a8d('0x0'));var _=require(_0x4a8d('0x1'));var Redis=require(_0x4a8d('0x2'));var interactionService=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x4a8d('0x3'))['db'];config[_0x4a8d('0x4')]=_['defaults'](config['redis'],{'host':_0x4a8d('0x5'),'port':0x18eb});var socket=require(_0x4a8d('0x6'))(new Redis(config[_0x4a8d('0x4')]));require(_0x4a8d('0x7'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x4a8d('0x8')][_0x4a8d('0x9')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var interaction_log=require(_0x4a8d('0xa'))('openchannel-interactions');function respondWithRpcPromise(_0x1994fe,_0x5a787a,_0xbcfcf0,_0x59d2d2){return new Promise(function(_0x309977,_0x1100aa){var _0xd4dc79=_0x59d2d2||client;return _0xd4dc79[_0x4a8d('0xb')](_0x1994fe,_0xbcfcf0)[_0x4a8d('0xc')](function(_0x16f974){logger[_0x4a8d('0xd')](_0x4a8d('0xe'),_0x5a787a,_0x4a8d('0xf'));logger[_0x4a8d('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x5a787a,'request\x20sent',JSON[_0x4a8d('0x11')](_0x16f974));if(_0x16f974[_0x4a8d('0x12')]){if(_0x16f974[_0x4a8d('0x12')][_0x4a8d('0x13')]===0x1f4){logger[_0x4a8d('0x12')](_0x4a8d('0xe'),_0x5a787a,_0x16f974[_0x4a8d('0x12')][_0x4a8d('0x14')]);return _0x1100aa(_0x16f974['error'][_0x4a8d('0x14')]);}logger['error'](_0x4a8d('0xe'),_0x5a787a,_0x16f974['error'][_0x4a8d('0x14')]);return _0x309977(_0x16f974[_0x4a8d('0x12')][_0x4a8d('0x14')]);}else{logger['info'](_0x4a8d('0xe'),_0x5a787a,_0x4a8d('0xf'));_0x309977(_0x16f974[_0x4a8d('0x15')][_0x4a8d('0x14')]);}})['catch'](function(_0x1f700b){logger[_0x4a8d('0x12')](_0x4a8d('0xe'),_0x5a787a,_0x1f700b);_0x1100aa(_0x1f700b);});});}function respondWithResult(_0x32996e,_0x535614){_0x535614=_0x535614||0xc8;return function(_0xce902e){if(_0xce902e){return _0x32996e[_0x4a8d('0x16')](_0x535614)[_0x4a8d('0x17')](_0xce902e);}};}function respondWithFilteredResult(_0x2755c0,_0x29ed67){return function(_0x37ac4e){if(_0x37ac4e){var _0x233030=typeof _0x29ed67[_0x4a8d('0x18')]===_0x4a8d('0x19')&&typeof _0x29ed67[_0x4a8d('0x1a')]===_0x4a8d('0x19');var _0xe7a2fe=_0x37ac4e[_0x4a8d('0x1b')];var _0xb4d0a5=_0x233030?0x0:_0x29ed67[_0x4a8d('0x18')];var _0xc2bac0=_0x233030?_0x37ac4e[_0x4a8d('0x1b')]:_0x29ed67[_0x4a8d('0x18')]+_0x29ed67[_0x4a8d('0x1a')];var _0x5c69b8;if(_0xc2bac0>=_0xe7a2fe){_0xc2bac0=_0xe7a2fe;_0x5c69b8=0xc8;}else{_0x5c69b8=0xce;}_0x2755c0[_0x4a8d('0x16')](_0x5c69b8);return _0x2755c0[_0x4a8d('0x1c')](_0x4a8d('0x1d'),_0xb4d0a5+'-'+_0xc2bac0+'/'+_0xe7a2fe)['json'](_0x37ac4e);}return null;};}function saveUpdates(_0x1d9098){return function(_0x598668){if(_0x598668){return _0x598668[_0x4a8d('0x1e')](_0x1d9098)[_0x4a8d('0xc')](function(_0x5d24c5){return _0x5d24c5;});}return null;};}function removeEntity(_0x2b93da){return function(_0x4d413f){if(_0x4d413f){return _0x4d413f[_0x4a8d('0x1f')]()[_0x4a8d('0xc')](function(){_0x2b93da[_0x4a8d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x497e51){return function(_0x23aa61){if(!_0x23aa61){_0x497e51['sendStatus'](0x194);}return _0x23aa61;};}function handleError(_0x44ed58,_0x22cd0d){_0x22cd0d=_0x22cd0d||0x1f4;return function(_0x597473){logger[_0x4a8d('0x12')](_0x597473[_0x4a8d('0x20')]);if(_0x597473[_0x4a8d('0x21')]){delete _0x597473[_0x4a8d('0x21')];}_0x44ed58[_0x4a8d('0x16')](_0x22cd0d)['send'](_0x597473);};}exports['index']=function(_0x1c1d55,_0x1aa415){var _0x228672={},_0x2a9390={},_0x320c4e={'count':0x0,'rows':[]};var _0x4ed5f9=_[_0x4a8d('0x22')](db[_0x4a8d('0x23')]['rawAttributes'],function(_0x2a7422){return{'name':_0x2a7422[_0x4a8d('0x24')],'type':_0x2a7422[_0x4a8d('0x25')][_0x4a8d('0x26')]};});_0x2a9390['model']=_[_0x4a8d('0x22')](_0x4ed5f9,'name');_0x2a9390[_0x4a8d('0x27')]=_[_0x4a8d('0x28')](_0x1c1d55[_0x4a8d('0x27')]);_0x2a9390['filters']=_[_0x4a8d('0x29')](_0x2a9390[_0x4a8d('0x2a')],_0x2a9390[_0x4a8d('0x27')]);_0x228672[_0x4a8d('0x2b')]=_[_0x4a8d('0x29')](_0x2a9390[_0x4a8d('0x2a')],qs[_0x4a8d('0x2c')](_0x1c1d55[_0x4a8d('0x27')][_0x4a8d('0x2c')]));_0x228672[_0x4a8d('0x2b')]=_0x228672[_0x4a8d('0x2b')][_0x4a8d('0x2d')]?_0x228672['attributes']:_0x2a9390[_0x4a8d('0x2a')];if(!_0x1c1d55[_0x4a8d('0x27')][_0x4a8d('0x2e')](_0x4a8d('0x2f'))){_0x228672[_0x4a8d('0x1a')]=qs[_0x4a8d('0x1a')](_0x1c1d55[_0x4a8d('0x27')]['limit']);_0x228672['offset']=qs['offset'](_0x1c1d55[_0x4a8d('0x27')][_0x4a8d('0x18')]);}_0x228672['order']=qs[_0x4a8d('0x30')](_0x1c1d55['query'][_0x4a8d('0x30')]);_0x228672[_0x4a8d('0x31')]=qs[_0x4a8d('0x32')](_['pick'](_0x1c1d55['query'],_0x2a9390[_0x4a8d('0x32')]),_0x4ed5f9);if(_0x1c1d55['query'][_0x4a8d('0x33')]){_0x228672[_0x4a8d('0x31')]=_[_0x4a8d('0x34')](_0x228672[_0x4a8d('0x31')],{'$or':_[_0x4a8d('0x22')](_0x4ed5f9,function(_0x8c9b3b){if(_0x8c9b3b[_0x4a8d('0x25')]!==_0x4a8d('0x35')){var _0xe47932={};_0xe47932[_0x8c9b3b[_0x4a8d('0x21')]]={'$like':'%'+_0x1c1d55[_0x4a8d('0x27')][_0x4a8d('0x33')]+'%'};return _0xe47932;}})});}_0x228672=_[_0x4a8d('0x34')]({},_0x228672,_0x1c1d55['options']);var _0x50e9e0={'where':_0x228672['where']};return db['OpenchannelMessage'][_0x4a8d('0x1b')](_0x50e9e0)[_0x4a8d('0xc')](function(_0x44f7fc){_0x320c4e['count']=_0x44f7fc;if(_0x1c1d55[_0x4a8d('0x27')][_0x4a8d('0x36')]){_0x228672[_0x4a8d('0x37')]=[{'all':!![]}];}return db[_0x4a8d('0x23')]['findAll'](_0x228672);})[_0x4a8d('0xc')](function(_0x5413b7){_0x320c4e['rows']=_0x5413b7;return _0x320c4e;})[_0x4a8d('0xc')](respondWithFilteredResult(_0x1aa415,_0x228672))['catch'](handleError(_0x1aa415,null));};exports[_0x4a8d('0x38')]=function(_0x9deb,_0x80156b){var _0x8b24e2={'raw':!![],'where':{'id':_0x9deb[_0x4a8d('0x39')]['id']}},_0x34e13e={};_0x34e13e[_0x4a8d('0x2a')]=_[_0x4a8d('0x28')](db['OpenchannelMessage'][_0x4a8d('0x3a')]);_0x34e13e['query']=_['keys'](_0x9deb['query']);_0x34e13e['filters']=_[_0x4a8d('0x29')](_0x34e13e['model'],_0x34e13e['query']);_0x8b24e2[_0x4a8d('0x2b')]=_[_0x4a8d('0x29')](_0x34e13e[_0x4a8d('0x2a')],qs[_0x4a8d('0x2c')](_0x9deb[_0x4a8d('0x27')]['fields']));_0x8b24e2[_0x4a8d('0x2b')]=_0x8b24e2['attributes'][_0x4a8d('0x2d')]?_0x8b24e2[_0x4a8d('0x2b')]:_0x34e13e['model'];if(_0x9deb[_0x4a8d('0x27')]['includeAll']){_0x8b24e2[_0x4a8d('0x37')]=[{'all':!![]}];}_0x8b24e2=_[_0x4a8d('0x34')]({},_0x8b24e2,_0x9deb[_0x4a8d('0x3b')]);return db[_0x4a8d('0x23')][_0x4a8d('0x3c')](_0x8b24e2)['then'](handleEntityNotFound(_0x80156b,null))[_0x4a8d('0xc')](respondWithResult(_0x80156b,null))[_0x4a8d('0x3d')](handleError(_0x80156b,null));};exports[_0x4a8d('0x3e')]=function(_0x9645,_0x36ddf2){return db[_0x4a8d('0x23')][_0x4a8d('0x3e')](_0x9645['body'],{})['then'](respondWithResult(_0x36ddf2,0xc9))[_0x4a8d('0x3d')](handleError(_0x36ddf2,null));};exports[_0x4a8d('0x1e')]=function(_0x2dcae7,_0x1387a9){if(_0x2dcae7['body']['id']){delete _0x2dcae7[_0x4a8d('0x3f')]['id'];}return db[_0x4a8d('0x23')][_0x4a8d('0x3c')]({'where':{'id':_0x2dcae7[_0x4a8d('0x39')]['id']}})[_0x4a8d('0xc')](handleEntityNotFound(_0x1387a9,null))['then'](saveUpdates(_0x2dcae7['body'],null))[_0x4a8d('0xc')](respondWithResult(_0x1387a9,null))[_0x4a8d('0x3d')](handleError(_0x1387a9,null));};exports[_0x4a8d('0x1f')]=function(_0x9473c9,_0x28a77c){return db[_0x4a8d('0x23')][_0x4a8d('0x3c')]({'where':{'id':_0x9473c9['params']['id']}})[_0x4a8d('0xc')](handleEntityNotFound(_0x28a77c,null))['then'](removeEntity(_0x28a77c,null))['catch'](handleError(_0x28a77c,null));};exports[_0x4a8d('0x40')]=function(_0x130ae7,_0x58ec51){return db[_0x4a8d('0x23')][_0x4a8d('0x40')]()['then'](respondWithResult(_0x58ec51,null))['catch'](handleError(_0x58ec51,null));};exports['accept']=function(_0xbec1ab,_0x160915){var _0x3ec42c=_0x4a8d('0x41');return interactionService[_0x4a8d('0x42')](_0xbec1ab,_0x3ec42c)['then'](respondWithResult(_0x160915,null))[_0x4a8d('0x3d')](handleError(_0x160915,null));};exports[_0x4a8d('0x43')]=function(_0x6230e4,_0x4ce674){var _0x57c5d9={'agent':{},'channel':_0x4a8d('0x41')};if(_0x6230e4[_0x4a8d('0x3f')]['id']){delete _0x6230e4['body']['id'];}_0x6230e4[_0x4a8d('0x3f')]['UserId']=_0x6230e4[_0x4a8d('0x3f')][_0x4a8d('0x44')]||_0x6230e4[_0x4a8d('0x45')]['id'];_0x57c5d9[_0x4a8d('0x46')]['id']=_0x6230e4['body']['UserId'];return db[_0x4a8d('0x23')][_0x4a8d('0x3c')]({'where':{'id':_0x6230e4['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4ce674,null))[_0x4a8d('0xc')](function(_0x255d7c){if(_0x255d7c){_0x57c5d9[_0x4a8d('0x14')]=_0x255d7c[_0x4a8d('0x47')]({'plain':!![]});return db[_0x4a8d('0x48')]['find']({'where':{'id':_0x255d7c['OpenchannelInteractionId']}});}return null;})[_0x4a8d('0xc')](handleEntityNotFound(_0x4ce674,null))[_0x4a8d('0xc')](function(_0x23b2a3){if(_0x23b2a3){_0x57c5d9[_0x4a8d('0x49')]=_0x23b2a3[_0x4a8d('0x47')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x6230e4['user']['id'],_0x6230e4[_0x4a8d('0x45')][_0x4a8d('0x21')],_0x6230e4['user'][_0x4a8d('0x4a')],_0x57c5d9['interaction']['id'],_0x6230e4['body']?JSON[_0x4a8d('0x11')](_0x6230e4[_0x4a8d('0x3f')]):_0x4a8d('0x4b'));return respondWithRpcPromise(_0x4a8d('0x4c'),'rejectMessage',_0x57c5d9);}return null;})['then'](function(_0x47318c){var _0x238e81=_0x4a8d('0x4d')+_0x47318c['message'][_0x4a8d('0x4e')];return db[_0x4a8d('0x4f')][_0x4a8d('0x27')](_0x238e81,{'type':db[_0x4a8d('0x50')][_0x4a8d('0x51')][_0x4a8d('0x52')],'raw':!![]})[_0x4a8d('0xc')](function(_0x91be7){return _0x91be7;});})[_0x4a8d('0xc')](function(_0x3cfc64){if(_0x3cfc64){_0x57c5d9['message'][_0x4a8d('0x53')]=_0x3cfc64[0x0];if(!_0x6230e4[_0x4a8d('0x3f')][_0x4a8d('0x44')])return;return db[_0x4a8d('0x54')][_0x4a8d('0x3c')]({'where':{'id':_0x6230e4[_0x4a8d('0x3f')][_0x4a8d('0x44')],'role':'agent'},'attributes':['id',_0x4a8d('0x21'),_0x4a8d('0x55'),_0x4a8d('0x56'),'internal'],'raw':!![]});}return null;})['then'](function(_0x1f6339){if(!_0x1f6339)return null;_0x57c5d9['message']['agent']=_0x1f6339;return _0x57c5d9;})[_0x4a8d('0xc')](function(_0x213adc){if(_0x213adc){_0x213adc[_0x4a8d('0x14')][_0x4a8d('0x57')]=util['format']('SIP/%s',_0x6230e4[_0x4a8d('0x45')][_0x4a8d('0x21')]);_0x213adc[_0x4a8d('0x14')][_0x4a8d('0x58')]=_0x57c5d9[_0x4a8d('0x58')];_0x213adc[_0x4a8d('0x14')]['motionChannel']=_0x57c5d9['channel'];_0x213adc[_0x4a8d('0x14')]['event']=_0x4a8d('0x43');respondWithRpcPromise(_0x4a8d('0x59'),_0x4a8d('0x59'),{'event':_0x4a8d('0x5a'),'message':_0x213adc[_0x4a8d('0x14')]},client9002);return _0x57c5d9;}return null;})['then'](respondWithResult(_0x4ce674,null))[_0x4a8d('0x3d')](handleError(_0x4ce674,null));}; \ No newline at end of file +var _0x481b=['util','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','openchannel-interactions','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','update','destroy','sendStatus','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','create','body','find','describe','accept','acceptMessage','reject','UserId','user','agent','get','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','format','SIP/%s','channel','motionChannel','EventManager','rejectmessage'];(function(_0x536fda,_0x1a687b){var _0x32a87c=function(_0x4f73e6){while(--_0x4f73e6){_0x536fda['push'](_0x536fda['shift']());}};_0x32a87c(++_0x1a687b);}(_0x481b,0x12c));var _0xb481=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x481b[_0xa148b7];return _0x51efd3;};'use strict';var util=require(_0xb481('0x0'));var _=require('lodash');var Redis=require(_0xb481('0x1'));var interactionService=require('../../components/interaction/service');var qs=require(_0xb481('0x2'));var logger=require(_0xb481('0x3'))(_0xb481('0x4'));var config=require(_0xb481('0x5'));var db=require('../../mysqldb')['db'];config[_0xb481('0x6')]=_[_0xb481('0x7')](config['redis'],{'host':_0xb481('0x8'),'port':0x18eb});var socket=require(_0xb481('0x9'))(new Redis(config[_0xb481('0x6')]));require(_0xb481('0xa'))['register'](socket);var jayson=require(_0xb481('0xb'));var client=jayson[_0xb481('0xc')]['http']({'port':0x232c});var client9002=jayson[_0xb481('0xc')]['http']({'port':0x232a});var interaction_log=require(_0xb481('0x3'))(_0xb481('0xd'));function respondWithRpcPromise(_0x1de826,_0x2b5b67,_0x5606c5,_0x1f437a){return new Promise(function(_0x296f02,_0x7155e1){var _0x17b223=_0x1f437a||client;return _0x17b223[_0xb481('0xe')](_0x1de826,_0x5606c5)[_0xb481('0xf')](function(_0x532cbe){logger[_0xb481('0x10')](_0xb481('0x11'),_0x2b5b67,'request\x20sent');logger[_0xb481('0x12')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2b5b67,_0xb481('0x13'),JSON[_0xb481('0x14')](_0x532cbe));if(_0x532cbe[_0xb481('0x15')]){if(_0x532cbe[_0xb481('0x15')][_0xb481('0x16')]===0x1f4){logger['error'](_0xb481('0x11'),_0x2b5b67,_0x532cbe[_0xb481('0x15')][_0xb481('0x17')]);return _0x7155e1(_0x532cbe['error']['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x2b5b67,_0x532cbe[_0xb481('0x15')][_0xb481('0x17')]);return _0x296f02(_0x532cbe['error']['message']);}else{logger[_0xb481('0x10')](_0xb481('0x11'),_0x2b5b67,_0xb481('0x13'));_0x296f02(_0x532cbe[_0xb481('0x18')][_0xb481('0x17')]);}})[_0xb481('0x19')](function(_0x3edd18){logger[_0xb481('0x15')](_0xb481('0x11'),_0x2b5b67,_0x3edd18);_0x7155e1(_0x3edd18);});});}function respondWithResult(_0x1d9934,_0x58a85b){_0x58a85b=_0x58a85b||0xc8;return function(_0x5ea5e3){if(_0x5ea5e3){return _0x1d9934[_0xb481('0x1a')](_0x58a85b)[_0xb481('0x1b')](_0x5ea5e3);}};}function respondWithFilteredResult(_0x516d3c,_0x204743){return function(_0x260c7c){if(_0x260c7c){var _0x95007b=typeof _0x204743['offset']===_0xb481('0x1c')&&typeof _0x204743[_0xb481('0x1d')]===_0xb481('0x1c');var _0x4145ab=_0x260c7c[_0xb481('0x1e')];var _0x5b7239=_0x95007b?0x0:_0x204743[_0xb481('0x1f')];var _0x15b36c=_0x95007b?_0x260c7c[_0xb481('0x1e')]:_0x204743['offset']+_0x204743['limit'];var _0x9c868a;if(_0x15b36c>=_0x4145ab){_0x15b36c=_0x4145ab;_0x9c868a=0xc8;}else{_0x9c868a=0xce;}_0x516d3c[_0xb481('0x1a')](_0x9c868a);return _0x516d3c['set']('Content-Range',_0x5b7239+'-'+_0x15b36c+'/'+_0x4145ab)['json'](_0x260c7c);}return null;};}function saveUpdates(_0x2d670b){return function(_0x17e848){if(_0x17e848){return _0x17e848[_0xb481('0x20')](_0x2d670b)[_0xb481('0xf')](function(_0x181d47){return _0x181d47;});}return null;};}function removeEntity(_0x1cb5b4){return function(_0x69147a){if(_0x69147a){return _0x69147a[_0xb481('0x21')]()['then'](function(){_0x1cb5b4[_0xb481('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41669b){return function(_0x40a615){if(!_0x40a615){_0x41669b[_0xb481('0x22')](0x194);}return _0x40a615;};}function handleError(_0x594dac,_0x569cb6){_0x569cb6=_0x569cb6||0x1f4;return function(_0x338601){logger['error'](_0x338601[_0xb481('0x23')]);if(_0x338601[_0xb481('0x24')]){delete _0x338601[_0xb481('0x24')];}_0x594dac[_0xb481('0x1a')](_0x569cb6)[_0xb481('0x25')](_0x338601);};}exports['index']=function(_0x1e9bdb,_0x444ce3){var _0x34ab14={},_0x7e2b56={},_0x407c4f={'count':0x0,'rows':[]};var _0x3cff2f=_[_0xb481('0x26')](db[_0xb481('0x27')][_0xb481('0x28')],function(_0x36bb9f){return{'name':_0x36bb9f[_0xb481('0x29')],'type':_0x36bb9f[_0xb481('0x2a')][_0xb481('0x2b')]};});_0x7e2b56['model']=_[_0xb481('0x26')](_0x3cff2f,_0xb481('0x24'));_0x7e2b56[_0xb481('0x2c')]=_[_0xb481('0x2d')](_0x1e9bdb[_0xb481('0x2c')]);_0x7e2b56[_0xb481('0x2e')]=_['intersection'](_0x7e2b56[_0xb481('0x2f')],_0x7e2b56[_0xb481('0x2c')]);_0x34ab14['attributes']=_['intersection'](_0x7e2b56['model'],qs[_0xb481('0x30')](_0x1e9bdb[_0xb481('0x2c')][_0xb481('0x30')]));_0x34ab14['attributes']=_0x34ab14[_0xb481('0x31')][_0xb481('0x32')]?_0x34ab14[_0xb481('0x31')]:_0x7e2b56[_0xb481('0x2f')];if(!_0x1e9bdb['query'][_0xb481('0x33')](_0xb481('0x34'))){_0x34ab14[_0xb481('0x1d')]=qs['limit'](_0x1e9bdb[_0xb481('0x2c')][_0xb481('0x1d')]);_0x34ab14[_0xb481('0x1f')]=qs['offset'](_0x1e9bdb[_0xb481('0x2c')][_0xb481('0x1f')]);}_0x34ab14[_0xb481('0x35')]=qs[_0xb481('0x36')](_0x1e9bdb[_0xb481('0x2c')]['sort']);_0x34ab14[_0xb481('0x37')]=qs['filters'](_['pick'](_0x1e9bdb['query'],_0x7e2b56['filters']),_0x3cff2f);if(_0x1e9bdb['query'][_0xb481('0x38')]){_0x34ab14[_0xb481('0x37')]=_[_0xb481('0x39')](_0x34ab14['where'],{'$or':_[_0xb481('0x26')](_0x3cff2f,function(_0x1a187f){if(_0x1a187f[_0xb481('0x2a')]!==_0xb481('0x3a')){var _0x34d560={};_0x34d560[_0x1a187f[_0xb481('0x24')]]={'$like':'%'+_0x1e9bdb[_0xb481('0x2c')][_0xb481('0x38')]+'%'};return _0x34d560;}})});}_0x34ab14=_[_0xb481('0x39')]({},_0x34ab14,_0x1e9bdb[_0xb481('0x3b')]);var _0x2a09a7={'where':_0x34ab14[_0xb481('0x37')]};return db[_0xb481('0x27')]['count'](_0x2a09a7)[_0xb481('0xf')](function(_0x4b1085){_0x407c4f[_0xb481('0x1e')]=_0x4b1085;if(_0x1e9bdb[_0xb481('0x2c')][_0xb481('0x3c')]){_0x34ab14[_0xb481('0x3d')]=[{'all':!![]}];}return db[_0xb481('0x27')][_0xb481('0x3e')](_0x34ab14);})[_0xb481('0xf')](function(_0x4f46b6){_0x407c4f[_0xb481('0x3f')]=_0x4f46b6;return _0x407c4f;})['then'](respondWithFilteredResult(_0x444ce3,_0x34ab14))[_0xb481('0x19')](handleError(_0x444ce3,null));};exports[_0xb481('0x40')]=function(_0x5234d0,_0x4f81f0){var _0xfce789={'raw':!![],'where':{'id':_0x5234d0[_0xb481('0x41')]['id']}},_0x91cf={};_0x91cf[_0xb481('0x2f')]=_[_0xb481('0x2d')](db[_0xb481('0x27')]['rawAttributes']);_0x91cf[_0xb481('0x2c')]=_[_0xb481('0x2d')](_0x5234d0[_0xb481('0x2c')]);_0x91cf[_0xb481('0x2e')]=_[_0xb481('0x42')](_0x91cf[_0xb481('0x2f')],_0x91cf[_0xb481('0x2c')]);_0xfce789['attributes']=_[_0xb481('0x42')](_0x91cf[_0xb481('0x2f')],qs[_0xb481('0x30')](_0x5234d0['query']['fields']));_0xfce789['attributes']=_0xfce789['attributes'][_0xb481('0x32')]?_0xfce789[_0xb481('0x31')]:_0x91cf[_0xb481('0x2f')];if(_0x5234d0[_0xb481('0x2c')][_0xb481('0x3c')]){_0xfce789[_0xb481('0x3d')]=[{'all':!![]}];}_0xfce789=_[_0xb481('0x39')]({},_0xfce789,_0x5234d0['options']);return db[_0xb481('0x27')]['find'](_0xfce789)[_0xb481('0xf')](handleEntityNotFound(_0x4f81f0,null))[_0xb481('0xf')](respondWithResult(_0x4f81f0,null))[_0xb481('0x19')](handleError(_0x4f81f0,null));};exports[_0xb481('0x43')]=function(_0x1863f8,_0x362f47){return db['OpenchannelMessage'][_0xb481('0x43')](_0x1863f8['body'],{})['then'](respondWithResult(_0x362f47,0xc9))[_0xb481('0x19')](handleError(_0x362f47,null));};exports[_0xb481('0x20')]=function(_0x4fb600,_0xee535c){if(_0x4fb600[_0xb481('0x44')]['id']){delete _0x4fb600[_0xb481('0x44')]['id'];}return db[_0xb481('0x27')][_0xb481('0x45')]({'where':{'id':_0x4fb600[_0xb481('0x41')]['id']}})[_0xb481('0xf')](handleEntityNotFound(_0xee535c,null))[_0xb481('0xf')](saveUpdates(_0x4fb600[_0xb481('0x44')],null))['then'](respondWithResult(_0xee535c,null))[_0xb481('0x19')](handleError(_0xee535c,null));};exports[_0xb481('0x21')]=function(_0x4a0591,_0x371475){return db[_0xb481('0x27')][_0xb481('0x45')]({'where':{'id':_0x4a0591[_0xb481('0x41')]['id']}})[_0xb481('0xf')](handleEntityNotFound(_0x371475,null))[_0xb481('0xf')](removeEntity(_0x371475,null))['catch'](handleError(_0x371475,null));};exports[_0xb481('0x46')]=function(_0x2051e1,_0x217d73){return db[_0xb481('0x27')][_0xb481('0x46')]()[_0xb481('0xf')](respondWithResult(_0x217d73,null))[_0xb481('0x19')](handleError(_0x217d73,null));};exports[_0xb481('0x47')]=function(_0x32197c,_0x4451c4){var _0x5796e='openchannel';return interactionService[_0xb481('0x48')](_0x32197c,_0x5796e)[_0xb481('0xf')](respondWithResult(_0x4451c4,null))[_0xb481('0x19')](handleError(_0x4451c4,null));};exports[_0xb481('0x49')]=function(_0x1073c9,_0x23e9f8){var _0x163480={'agent':{},'channel':'openchannel'};if(_0x1073c9[_0xb481('0x44')]['id']){delete _0x1073c9[_0xb481('0x44')]['id'];}_0x1073c9[_0xb481('0x44')][_0xb481('0x4a')]=_0x1073c9['body']['UserId']||_0x1073c9[_0xb481('0x4b')]['id'];_0x163480[_0xb481('0x4c')]['id']=_0x1073c9['body']['UserId'];return db[_0xb481('0x27')][_0xb481('0x45')]({'where':{'id':_0x1073c9[_0xb481('0x41')]['id'],'UserId':null}})[_0xb481('0xf')](handleEntityNotFound(_0x23e9f8,null))[_0xb481('0xf')](function(_0x5548bf){if(_0x5548bf){_0x163480[_0xb481('0x17')]=_0x5548bf[_0xb481('0x4d')]({'plain':!![]});return db['OpenchannelInteraction'][_0xb481('0x45')]({'where':{'id':_0x5548bf['OpenchannelInteractionId']}});}return null;})[_0xb481('0xf')](handleEntityNotFound(_0x23e9f8,null))[_0xb481('0xf')](function(_0x58a835){if(_0x58a835){_0x163480[_0xb481('0x4e')]=_0x58a835[_0xb481('0x4d')]({'plain':!![]});interaction_log[_0xb481('0x10')](_0xb481('0x4f'),_0x1073c9['user']['id'],_0x1073c9[_0xb481('0x4b')][_0xb481('0x24')],_0x1073c9[_0xb481('0x4b')][_0xb481('0x50')],_0x163480[_0xb481('0x4e')]['id'],_0x1073c9['body']?JSON[_0xb481('0x14')](_0x1073c9[_0xb481('0x44')]):_0xb481('0x51'));return respondWithRpcPromise(_0xb481('0x52'),_0xb481('0x53'),_0x163480);}return null;})[_0xb481('0xf')](function(_0xbb4563){var _0x1a8d8b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xbb4563[_0xb481('0x17')][_0xb481('0x54')];return db[_0xb481('0x55')]['query'](_0x1a8d8b,{'type':db[_0xb481('0x56')][_0xb481('0x57')][_0xb481('0x58')],'raw':!![]})[_0xb481('0xf')](function(_0x4049c2){return _0x4049c2;});})[_0xb481('0xf')](function(_0x49f50e){if(_0x49f50e){_0x163480[_0xb481('0x17')][_0xb481('0x59')]=_0x49f50e[0x0];if(!_0x1073c9[_0xb481('0x44')][_0xb481('0x4a')])return;return db[_0xb481('0x5a')][_0xb481('0x45')]({'where':{'id':_0x1073c9[_0xb481('0x44')][_0xb481('0x4a')],'role':_0xb481('0x4c')},'attributes':['id',_0xb481('0x24'),_0xb481('0x5b'),'email',_0xb481('0x5c')],'raw':!![]});}return null;})['then'](function(_0x1384c2){if(!_0x1384c2)return null;_0x163480[_0xb481('0x17')]['agent']=_0x1384c2;return _0x163480;})[_0xb481('0xf')](function(_0x5bb384){if(_0x5bb384){_0x5bb384[_0xb481('0x17')][_0xb481('0x5d')]=util[_0xb481('0x5e')](_0xb481('0x5f'),_0x1073c9[_0xb481('0x4b')]['name']);_0x5bb384[_0xb481('0x17')][_0xb481('0x60')]=_0x163480[_0xb481('0x60')];_0x5bb384['message'][_0xb481('0x61')]=_0x163480[_0xb481('0x60')];_0x5bb384[_0xb481('0x17')]['event']='reject';respondWithRpcPromise(_0xb481('0x62'),'EventManager',{'event':_0xb481('0x63'),'message':_0x5bb384[_0xb481('0x17')]},client9002);return _0x163480;}return null;})[_0xb481('0xf')](respondWithResult(_0x23e9f8,null))[_0xb481('0x19')](handleError(_0x23e9f8,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index c753368..464068f 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 _0x5aae=['events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x5ec61d,_0x36c73c){var _0x2e0e5c=function(_0x1da225){while(--_0x1da225){_0x5ec61d['push'](_0x5ec61d['shift']());}};_0x2e0e5c(++_0x36c73c);}(_0x5aae,0x7e));var _0xe5aa=function(_0x374f60,_0x551010){_0x374f60=_0x374f60-0x0;var _0x454eda=_0x5aae[_0x374f60];return _0x454eda;};'use strict';var EventEmitter=require(_0xe5aa('0x0'));var OpenchannelMessage=require(_0xe5aa('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xe5aa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe5aa('0x3'),'afterDestroy':_0xe5aa('0x4')};function emitEvent(_0x435326){return function(_0x24e3b2,_0x81a569,_0x5aaef1){OpenchannelMessageEvents[_0xe5aa('0x5')](_0x435326+':'+_0x24e3b2['id'],_0x24e3b2);OpenchannelMessageEvents['emit'](_0x435326,_0x24e3b2);_0x5aaef1(null);};}for(var e in events){if(events[_0xe5aa('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xa3e7=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage'];(function(_0x8395d6,_0x4517e1){var _0x36c36a=function(_0x2ef1e4){while(--_0x2ef1e4){_0x8395d6['push'](_0x8395d6['shift']());}};_0x36c36a(++_0x4517e1);}(_0xa3e7,0x1e4));var _0x7a3e=function(_0x379f38,_0x32be37){_0x379f38=_0x379f38-0x0;var _0x2656c7=_0xa3e7[_0x379f38];return _0x2656c7;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x7a3e('0x0'))['db'][_0x7a3e('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7a3e('0x2'),'afterUpdate':_0x7a3e('0x3'),'afterDestroy':_0x7a3e('0x4')};function emitEvent(_0x1daff8){return function(_0x42abc7,_0x2d7e02,_0x1f5ca9){OpenchannelMessageEvents[_0x7a3e('0x5')](_0x1daff8+':'+_0x42abc7['id'],_0x42abc7);OpenchannelMessageEvents['emit'](_0x1daff8,_0x42abc7);_0x1f5ca9(null);};}for(var e in events){if(events[_0x7a3e('0x6')](e)){var event=events[e];OpenchannelMessage[_0x7a3e('0x7')](e,emitEvent(event));}}module[_0x7a3e('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 03ebcae..c253580 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 _0x45a3=['Interactions','Contact','then','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','method','OpenchannelMessage,\x20%s,\x20%s','threadId','error','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','secret','CmContact','describe','OpenchannelAccount','OpenchannelAccountId'];(function(_0x2f3f7e,_0x25dba8){var _0x2c8ee4=function(_0x36eea7){while(--_0x36eea7){_0x2f3f7e['push'](_0x2f3f7e['shift']());}};_0x2c8ee4(++_0x25dba8);}(_0x45a3,0xaf));var _0x345a=function(_0x186dbb,_0x1352c4){_0x186dbb=_0x186dbb-0x0;var _0x28fe9f=_0x45a3[_0x186dbb];return _0x28fe9f;};'use strict';var _=require(_0x345a('0x0'));var util=require(_0x345a('0x1'));var logger=require(_0x345a('0x2'))(_0x345a('0x3'));var moment=require(_0x345a('0x4'));var BPromise=require(_0x345a('0x5'));var rp=require(_0x345a('0x6'));var fs=require('fs');var path=require(_0x345a('0x7'));var rimraf=require(_0x345a('0x8'));var config=require(_0x345a('0x9'));var attributes=require(_0x345a('0xa'));module[_0x345a('0xb')]=function(_0x5467fd,_0x5c362e){return _0x5467fd[_0x345a('0xc')](_0x345a('0xd'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x345a('0xe'),'fields':[_0x345a('0xf')],'type':_0x345a('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a80b5,_0x506aa0,_0x13f5d8){var _0x50e941=_0x5467fd[_0x345a('0x11')];var _0x1a4164=_0x2a80b5[_0x345a('0x12')]({'plain':!![]});if(_0x1a4164[_0x345a('0x13')][_0x345a('0x14')]()==='in'||_0x1a4164['direction'][_0x345a('0x14')]()==='out'&&!_0x1a4164['secret']&&!_[_0x345a('0x15')](_0x1a4164['UserId'])){_0x50e941[_0x345a('0x16')][_0x345a('0x17')]({'where':{'id':_0x1a4164[_0x345a('0x18')]}})['then'](function(_0x4b6442){if(_0x4b6442){_0x4b6442[_0x345a('0x19')]({'lastMsgAt':_0x1a4164[_0x345a('0x1a')],'lastMsgDirection':_0x1a4164['direction'][_0x345a('0x14')]()});}})[_0x345a('0x1b')](function(_0xb3271){console['error'](_0xb3271);});}if(_0x1a4164[_0x345a('0x13')]==='out'&&!_0x1a4164[_0x345a('0x1c')]){var _0x55e395;_0x50e941[_0x345a('0x1d')][_0x345a('0x1e')]()['then'](function(_0x29930a){return _0x50e941[_0x345a('0x1f')]['find']({'where':{'id':_0x1a4164[_0x345a('0x20')]},'include':[{'model':_0x50e941['OpenchannelInteraction'],'as':_0x345a('0x21'),'where':{'id':_0x1a4164[_0x345a('0x18')]},'limit':0x1,'include':[{'model':_0x50e941[_0x345a('0x1d')],'as':_0x345a('0x22'),'attributes':_['keys'](_0x29930a)}]}]});})[_0x345a('0x23')](function(_0x2f6d52){_0x55e395=_0x2f6d52[_0x345a('0x12')]({'plain':!![]});if(_0x55e395&&_0x55e395[_0x345a('0x24')]){logger[_0x345a('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x345a('0x26'),util[_0x345a('0x27')](_0x345a('0x28'),_0x1a4164['id'],_0x55e395[_0x345a('0x24')]));if(_0x55e395[_0x345a('0x21')]&&_0x55e395['Interactions']['length']){_0x1a4164[_0x345a('0x29')]=_[_0x345a('0x2a')](_0x55e395['Interactions'][0x0],'Contact');_0x1a4164[_0x345a('0x22')]=_0x55e395['Interactions'][0x0][_0x345a('0x22')];}var _0x506aa0={'method':_0x345a('0x2b'),'uri':encodeURI(_0x55e395[_0x345a('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x506aa0[_0x345a('0x2c')]){case'GET':_0x506aa0['qs']=_0x1a4164;break;case'POST':_0x506aa0[_0x345a('0xf')]=_0x1a4164;break;}return rp(_0x506aa0)[_0x345a('0x23')](function(_0xb2356d){logger[_0x345a('0x25')](_0x345a('0x2d'),_0x345a('0x26'),util[_0x345a('0x27')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x1a4164['id'],_0x55e395[_0x345a('0x24')]));if(_0xb2356d[_0x345a('0xf')]['threadId']&&_0xb2356d[_0x345a('0xf')][_0x345a('0x2e')]!=_0x1a4164[_0x345a('0x29')][_0x345a('0x2e')]){return _0x50e941['OpenchannelInteraction'][_0x345a('0x19')]({'threadId':_0xb2356d[_0x345a('0xf')][_0x345a('0x2e')]},{'where':{'id':_0x1a4164[_0x345a('0x29')]['id']}});}else{return;}})[_0x345a('0x23')](function(){return _0x2a80b5[_0x345a('0x19')]({'read':!![]});})[_0x345a('0x1b')](function(_0x3a8346){logger[_0x345a('0x2f')](_0x345a('0x2d'),_0x345a('0x26'),util[_0x345a('0x30')](_0x3a8346,{'showHidden':![],'depth':null}));_0x13f5d8();});}else{_0x13f5d8();}})[_0x345a('0x31')](function(){_0x13f5d8();});}else{_0x13f5d8();}}},'charset':_0x345a('0x32'),'collate':_0x345a('0x33')});}; \ No newline at end of file +var _0x6054=['models','get','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','findOne','then','update','createdAt','catch','error','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','threadId','inspect','finally','utf8mb4','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x6054,0x90));var _0x4605=function(_0x31ae8c,_0x15dd90){_0x31ae8c=_0x31ae8c-0x0;var _0x30e30b=_0x6054[_0x31ae8c];return _0x30e30b;};'use strict';var _=require('lodash');var util=require(_0x4605('0x0'));var logger=require('../../config/logger')(_0x4605('0x1'));var moment=require(_0x4605('0x2'));var BPromise=require(_0x4605('0x3'));var rp=require(_0x4605('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4605('0x5'));var config=require(_0x4605('0x6'));var attributes=require(_0x4605('0x7'));module[_0x4605('0x8')]=function(_0x5a1eb2,_0x59d04a){return _0x5a1eb2[_0x4605('0x9')](_0x4605('0xa'),attributes,{'tableName':_0x4605('0xb'),'paranoid':![],'indexes':[{'name':_0x4605('0xc'),'fields':[_0x4605('0xd')],'type':_0x4605('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32d511,_0x3e1f0b,_0xf103c7){var _0x32b52f=_0x5a1eb2[_0x4605('0xf')];var _0x5abe1c=_0x32d511[_0x4605('0x10')]({'plain':!![]});if(_0x5abe1c[_0x4605('0x11')][_0x4605('0x12')]()==='in'||_0x5abe1c[_0x4605('0x11')][_0x4605('0x12')]()==='out'&&!_0x5abe1c[_0x4605('0x13')]&&!_[_0x4605('0x14')](_0x5abe1c[_0x4605('0x15')])){_0x32b52f[_0x4605('0x16')][_0x4605('0x17')]({'where':{'id':_0x5abe1c['OpenchannelInteractionId']}})[_0x4605('0x18')](function(_0x4009fb){if(_0x4009fb){_0x4009fb[_0x4605('0x19')]({'lastMsgAt':_0x5abe1c[_0x4605('0x1a')],'lastMsgDirection':_0x5abe1c[_0x4605('0x11')][_0x4605('0x12')]()});}})[_0x4605('0x1b')](function(_0xaf7b56){console[_0x4605('0x1c')](_0xaf7b56);});}if(_0x5abe1c[_0x4605('0x11')]==='out'&&!_0x5abe1c[_0x4605('0x13')]){var _0x569ecb;_0x32b52f['CmContact'][_0x4605('0x1d')]()[_0x4605('0x18')](function(_0x8a9bb8){return _0x32b52f[_0x4605('0x1e')][_0x4605('0x1f')]({'where':{'id':_0x5abe1c[_0x4605('0x20')]},'include':[{'model':_0x32b52f[_0x4605('0x16')],'as':_0x4605('0x21'),'where':{'id':_0x5abe1c[_0x4605('0x22')]},'limit':0x1,'include':[{'model':_0x32b52f[_0x4605('0x23')],'as':_0x4605('0x24'),'attributes':_[_0x4605('0x25')](_0x8a9bb8)}]}]});})[_0x4605('0x18')](function(_0x4eeeb9){_0x569ecb=_0x4eeeb9[_0x4605('0x10')]({'plain':!![]});if(_0x569ecb&&_0x569ecb[_0x4605('0x26')]){logger[_0x4605('0x27')](_0x4605('0x28'),_0x4605('0x29'),util['format'](_0x4605('0x2a'),_0x5abe1c['id'],_0x569ecb[_0x4605('0x26')]));if(_0x569ecb[_0x4605('0x21')]&&_0x569ecb[_0x4605('0x21')][_0x4605('0x2b')]){_0x5abe1c[_0x4605('0x2c')]=_[_0x4605('0x2d')](_0x569ecb[_0x4605('0x21')][0x0],_0x4605('0x24'));_0x5abe1c[_0x4605('0x24')]=_0x569ecb['Interactions'][0x0][_0x4605('0x24')];}var _0x3e1f0b={'method':_0x4605('0x2e'),'uri':encodeURI(_0x569ecb[_0x4605('0x26')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3e1f0b[_0x4605('0x2f')]){case _0x4605('0x30'):_0x3e1f0b['qs']=_0x5abe1c;break;case _0x4605('0x2e'):_0x3e1f0b[_0x4605('0xd')]=_0x5abe1c;break;}return rp(_0x3e1f0b)[_0x4605('0x18')](function(_0x417264){logger[_0x4605('0x27')](_0x4605('0x28'),_0x4605('0x29'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x5abe1c['id'],_0x569ecb[_0x4605('0x26')]));if(_0x417264[_0x4605('0xd')]['threadId']&&_0x417264[_0x4605('0xd')][_0x4605('0x31')]!=_0x5abe1c[_0x4605('0x2c')]['threadId']){return _0x32b52f[_0x4605('0x16')][_0x4605('0x19')]({'threadId':_0x417264[_0x4605('0xd')][_0x4605('0x31')]},{'where':{'id':_0x5abe1c[_0x4605('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x32d511[_0x4605('0x19')]({'read':!![]});})[_0x4605('0x1b')](function(_0x5c603a){logger[_0x4605('0x1c')](_0x4605('0x28'),_0x4605('0x29'),util[_0x4605('0x32')](_0x5c603a,{'showHidden':![],'depth':null}));_0xf103c7();});}else{_0xf103c7();}})[_0x4605('0x33')](function(){_0xf103c7();});}else{_0xf103c7();}}},'charset':_0x4605('0x34'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index e0d2707..39d4c4b 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 _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x25fd71,_0x493b52){var _0x15917d=function(_0x4337f6){while(--_0x4337f6){_0x25fd71['push'](_0x25fd71['shift']());}};_0x15917d(++_0x493b52);}(_0xdb28,0x106));var _0x8db2=function(_0x393c29,_0x12fce9){_0x393c29=_0x393c29-0x0;var _0x43cbce=_0xdb28[_0x393c29];return _0x43cbce;};'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});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file +var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x2ec06f,_0x3bb56d){var _0x3a1c71=function(_0x5ca631){while(--_0x5ca631){_0x2ec06f['push'](_0x2ec06f['shift']());}};_0x3a1c71(++_0x3bb56d);}(_0xdb28,0x106));var _0x8db2=function(_0x3df8be,_0xda4695){_0x3df8be=_0x3df8be-0x0;var _0x408eb3=_0xdb28[_0x3df8be];return _0x408eb3;};'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});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index c50f630..da0744e 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 _0xe685=['register','openchannelMessage:','save','remove','update','emit'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe685,0xe0));var _0x5e68=function(_0x3622d7,_0x3b0019){_0x3622d7=_0x3622d7-0x0;var _0x3b3dae=_0xe685[_0x3622d7];return _0x3b3dae;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x5e68('0x0'),_0x5e68('0x1'),_0x5e68('0x2')];function createListener(_0x4173ff,_0x10fd00){return function(_0xd1426){_0x10fd00[_0x5e68('0x3')](_0x4173ff,_0xd1426);};}function removeListener(_0xb3a1d0,_0x36653c){return function(){OpenchannelMessageEvents['removeListener'](_0xb3a1d0,_0x36653c);};}exports[_0x5e68('0x4')]=function(_0x13e7ac){for(var _0x4267ac=0x0,_0x1c875b=events['length'];_0x4267ac<_0x1c875b;_0x4267ac++){var _0x3094f2=events[_0x4267ac];var _0x21c446=createListener(_0x5e68('0x5')+_0x3094f2,_0x13e7ac);OpenchannelMessageEvents['on'](_0x3094f2,_0x21c446);}}; \ No newline at end of file +var _0x0ab2=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','removeListener','register'];(function(_0x723ad0,_0x6957a8){var _0x2c5784=function(_0x498283){while(--_0x498283){_0x723ad0['push'](_0x723ad0['shift']());}};_0x2c5784(++_0x6957a8);}(_0x0ab2,0x9a));var _0x20ab=function(_0xaf0090,_0x20c43f){_0xaf0090=_0xaf0090-0x0;var _0x572d06=_0x0ab2[_0xaf0090];return _0x572d06;};'use strict';var OpenchannelMessageEvents=require(_0x20ab('0x0'));var events=[_0x20ab('0x1'),_0x20ab('0x2'),_0x20ab('0x3')];function createListener(_0x217637,_0x1520c9){return function(_0x4cc8cc){_0x1520c9['emit'](_0x217637,_0x4cc8cc);};}function removeListener(_0x435fc9,_0x2c4d43){return function(){OpenchannelMessageEvents[_0x20ab('0x4')](_0x435fc9,_0x2c4d43);};}exports[_0x20ab('0x5')]=function(_0x35fdb5){for(var _0x362d27=0x0,_0x16d3fc=events[_0x20ab('0x6')];_0x362d27<_0x16d3fc;_0x362d27++){var _0x458cd9=events[_0x362d27];var _0x547349=createListener(_0x20ab('0x7')+_0x458cd9,_0x35fdb5);OpenchannelMessageEvents['on'](_0x458cd9,_0x547349);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 6577c2c..1d1e5f2 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 _0xa4dc=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','getMembers','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','update','delete','destroy','/:id/teams','removeTeams','removeAgents','multer'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa4dc,0x1a3));var _0xca4d=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xa4dc[_0x87b0ff];return _0x3bc0b2;};'use strict';var multer=require(_0xca4d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xca4d('0x1'));var express=require(_0xca4d('0x2'));var router=express[_0xca4d('0x3')]();var fs_extra=require(_0xca4d('0x4'));var auth=require(_0xca4d('0x5'));var interaction=require(_0xca4d('0x6'));var config=require(_0xca4d('0x7'));var controller=require('./openchannelQueue.controller');router[_0xca4d('0x8')]('/',auth[_0xca4d('0x9')](),controller[_0xca4d('0xa')]);router[_0xca4d('0x8')](_0xca4d('0xb'),auth[_0xca4d('0x9')](),controller[_0xca4d('0xc')]);router['get'](_0xca4d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xca4d('0x8')]('/:id/members',auth[_0xca4d('0x9')](),controller[_0xca4d('0xe')]);router[_0xca4d('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0xca4d('0xf')]);router[_0xca4d('0x8')]('/:id/users',auth[_0xca4d('0x9')](),controller[_0xca4d('0x10')]);router[_0xca4d('0x11')]('/',auth[_0xca4d('0x9')](),controller[_0xca4d('0x12')]);router[_0xca4d('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0xca4d('0x13')]);router[_0xca4d('0x11')](_0xca4d('0x14'),auth[_0xca4d('0x9')](),controller[_0xca4d('0x15')]);router['put'](_0xca4d('0xd'),auth['isAuthenticated'](),controller[_0xca4d('0x16')]);router[_0xca4d('0x17')](_0xca4d('0xd'),auth[_0xca4d('0x9')](),controller[_0xca4d('0x18')]);router['delete'](_0xca4d('0x19'),auth['isAuthenticated'](),controller[_0xca4d('0x1a')]);router[_0xca4d('0x17')](_0xca4d('0x14'),auth[_0xca4d('0x9')](),controller[_0xca4d('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x61ad=['express','Router','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x5bdc7,_0x52a30b){var _0x449a98=function(_0x34f4d0){while(--_0x34f4d0){_0x5bdc7['push'](_0x5bdc7['shift']());}};_0x449a98(++_0x52a30b);}(_0x61ad,0x184));var _0xd61a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x61ad[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd61a('0x0'));var util=require(_0xd61a('0x1'));var path=require(_0xd61a('0x2'));var timeout=require(_0xd61a('0x3'));var express=require(_0xd61a('0x4'));var router=express[_0xd61a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd61a('0x6'));var controller=require(_0xd61a('0x7'));router[_0xd61a('0x8')]('/',auth[_0xd61a('0x9')](),controller['index']);router[_0xd61a('0x8')](_0xd61a('0xa'),auth[_0xd61a('0x9')](),controller[_0xd61a('0xb')]);router[_0xd61a('0x8')](_0xd61a('0xc'),auth[_0xd61a('0x9')](),controller[_0xd61a('0xd')]);router[_0xd61a('0x8')](_0xd61a('0xe'),auth[_0xd61a('0x9')](),controller[_0xd61a('0xf')]);router[_0xd61a('0x8')](_0xd61a('0x10'),auth[_0xd61a('0x9')](),controller[_0xd61a('0x11')]);router[_0xd61a('0x8')](_0xd61a('0x12'),auth[_0xd61a('0x9')](),controller['getAgents']);router[_0xd61a('0x13')]('/',auth[_0xd61a('0x9')](),controller[_0xd61a('0x14')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0xd61a('0x15')]);router[_0xd61a('0x13')](_0xd61a('0x12'),auth['isAuthenticated'](),controller[_0xd61a('0x16')]);router[_0xd61a('0x17')](_0xd61a('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd61a('0x18')]('/:id',auth[_0xd61a('0x9')](),controller[_0xd61a('0x19')]);router[_0xd61a('0x18')](_0xd61a('0x10'),auth[_0xd61a('0x9')](),controller['removeTeams']);router['delete'](_0xd61a('0x12'),auth[_0xd61a('0x9')](),controller[_0xd61a('0x1a')]);module[_0xd61a('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 4d94b65..3c66f71 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 _0xab12=['name','INTEGER','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xab12,0x162));var _0x2ab1=function(_0x3c566b,_0x1615f6){_0x3c566b=_0x3c566b-0x0;var _0x1f2de8=_0xab12[_0x3c566b];return _0x1f2de8;};'use strict';var Sequelize=require(_0x2ab1('0x0'));module[_0x2ab1('0x1')]={'name':{'type':Sequelize[_0x2ab1('0x2')],'unique':_0x2ab1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2ab1('0x2')]},'timeout':{'type':Sequelize[_0x2ab1('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x2ab1('0x5'),_0x2ab1('0x6'))}}; \ No newline at end of file +var _0xf42d=['ENUM','beepall','sequelize','exports','STRING','name'];(function(_0x41fd45,_0x5baf60){var _0xb77779=function(_0x7842b2){while(--_0x7842b2){_0x41fd45['push'](_0x41fd45['shift']());}};_0xb77779(++_0x5baf60);}(_0xf42d,0x188));var _0xdf42=function(_0x2bb752,_0x39c066){_0x2bb752=_0x2bb752-0x0;var _0x3f0872=_0xf42d[_0x2bb752];return _0x3f0872;};'use strict';var Sequelize=require(_0xdf42('0x0'));module[_0xdf42('0x1')]={'name':{'type':Sequelize[_0xdf42('0x2')],'unique':_0xdf42('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdf42('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdf42('0x4')]('rrmemory',_0xdf42('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 122fa2c..949ffb6 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 _0x3cac=['flatMap','transaction','emit','userOpenchannelQueue:save','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','end','error','stack','name','map','OpenchannelQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','rows','catch','show','params','model','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','keys','hasOwnProperty','nolimit','order','sort','pick','OpenchannelQueueId','filter','UserOpenchannelQueue','User','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','SIP','openchannelPause','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface'];(function(_0x37d16b,_0x3ef772){var _0x403643=function(_0x17e4db){while(--_0x17e4db){_0x37d16b['push'](_0x37d16b['shift']());}};_0x403643(++_0x3ef772);}(_0x3cac,0xa0));var _0xc3ca=function(_0x3b9e10,_0x2dc4aa){_0x3b9e10=_0x3b9e10-0x0;var _0x3a446b=_0x3cac[_0x3b9e10];return _0x3a446b;};'use strict';var BPromise=require(_0xc3ca('0x0'));var util=require(_0xc3ca('0x1'));var _=require(_0xc3ca('0x2'));var squel=require(_0xc3ca('0x3'));var Redis=require(_0xc3ca('0x4'));var qs=require(_0xc3ca('0x5'));var logger=require('../../config/logger')(_0xc3ca('0x6'));var config=require(_0xc3ca('0x7'));var db=require(_0xc3ca('0x8'))['db'];config[_0xc3ca('0x9')]=_[_0xc3ca('0xa')](config[_0xc3ca('0x9')],{'host':_0xc3ca('0xb'),'port':0x18eb});var socket=require(_0xc3ca('0xc'))(new Redis(config['redis']));require(_0xc3ca('0xd'))[_0xc3ca('0xe')](socket);function respondWithStatusCode(_0x23cd5b,_0x796fd5){_0x796fd5=_0x796fd5||0xcc;return function(_0x3f741a){if(_0x3f741a){return _0x23cd5b[_0xc3ca('0xf')](_0x796fd5);}return _0x23cd5b['status'](_0x796fd5)['end']();};}function respondWithResult(_0x51cc40,_0x510d9b){_0x510d9b=_0x510d9b||0xc8;return function(_0x426316){if(_0x426316){return _0x51cc40[_0xc3ca('0x10')](_0x510d9b)[_0xc3ca('0x11')](_0x426316);}};}function respondWithFilteredResult(_0x42dbbf,_0x255fb3){return function(_0x27fa84){if(_0x27fa84){var _0x41ac16=typeof _0x255fb3['offset']===_0xc3ca('0x12')&&typeof _0x255fb3[_0xc3ca('0x13')]==='undefined';var _0x256612=_0x27fa84[_0xc3ca('0x14')];var _0x109e53=_0x41ac16?0x0:_0x255fb3[_0xc3ca('0x15')];var _0x2034e3=_0x41ac16?_0x27fa84[_0xc3ca('0x14')]:_0x255fb3[_0xc3ca('0x15')]+_0x255fb3[_0xc3ca('0x13')];var _0x4d7194;if(_0x2034e3>=_0x256612){_0x2034e3=_0x256612;_0x4d7194=0xc8;}else{_0x4d7194=0xce;}_0x42dbbf[_0xc3ca('0x10')](_0x4d7194);return _0x42dbbf['set'](_0xc3ca('0x16'),_0x109e53+'-'+_0x2034e3+'/'+_0x256612)[_0xc3ca('0x11')](_0x27fa84);}return null;};}function saveUpdates(_0x139ee4){return function(_0x24af21){if(_0x24af21){return _0x24af21[_0xc3ca('0x17')](_0x139ee4)[_0xc3ca('0x18')](function(_0x22d644){return _0x22d644;});}return null;};}function removeEntity(_0x4b2a18){return function(_0x15d2c1){if(_0x15d2c1){return _0x15d2c1[_0xc3ca('0x19')]()['then'](function(){var _0x860f75=_0x15d2c1[_0xc3ca('0x1a')]({'plain':!![]});var _0x4dd3b1=_0xc3ca('0x1b');return db[_0xc3ca('0x1c')][_0xc3ca('0x19')]({'where':{'type':_0x4dd3b1,'resourceId':_0x860f75['id']}})['then'](function(){return _0x15d2c1;});})[_0xc3ca('0x18')](function(){_0x4b2a18[_0xc3ca('0x10')](0xcc)[_0xc3ca('0x1d')]();});}};}function handleEntityNotFound(_0x2eec5d){return function(_0x47ea80){if(!_0x47ea80){_0x2eec5d[_0xc3ca('0xf')](0x194);}return _0x47ea80;};}function handleError(_0x465deb,_0x37467f){_0x37467f=_0x37467f||0x1f4;return function(_0xe605ee){logger[_0xc3ca('0x1e')](_0xe605ee[_0xc3ca('0x1f')]);if(_0xe605ee[_0xc3ca('0x20')]){delete _0xe605ee[_0xc3ca('0x20')];}_0x465deb[_0xc3ca('0x10')](_0x37467f)['send'](_0xe605ee);};}exports['index']=function(_0x2eed34,_0x16f8a8){var _0x1a4011={};var _0x3b3312={'count':0x0,'rows':[]};var _0x45001b=_[_0xc3ca('0x21')](db[_0xc3ca('0x22')][_0xc3ca('0x23')],function(_0x2787e6){return{'name':_0x2787e6[_0xc3ca('0x24')],'type':_0x2787e6['type'][_0xc3ca('0x25')]};});_0x1a4011=qs[_0xc3ca('0x26')](_0x45001b,_0x2eed34);var _0x53643a={'where':_0x1a4011[_0xc3ca('0x27')]};return db['OpenchannelQueue'][_0xc3ca('0x14')](_0x53643a)[_0xc3ca('0x18')](function(_0x1a4976){_0x3b3312['count']=_0x1a4976;_0x1a4011['include']=qs[_0xc3ca('0x28')](_0x2eed34[_0xc3ca('0x29')]);return db[_0xc3ca('0x22')][_0xc3ca('0x2a')](_0x1a4011);})[_0xc3ca('0x18')](function(_0x77642a){_0x3b3312[_0xc3ca('0x2b')]=_0x77642a;return _0x3b3312;})[_0xc3ca('0x18')](respondWithFilteredResult(_0x16f8a8,_0x1a4011))[_0xc3ca('0x2c')](handleError(_0x16f8a8,null));};exports[_0xc3ca('0x2d')]=function(_0x1dd046,_0x234d15){var _0x4460a7={'raw':!![],'where':{'id':_0x1dd046[_0xc3ca('0x2e')]['id']}},_0x10265e={};_0x10265e[_0xc3ca('0x2f')]=_['keys'](db[_0xc3ca('0x22')][_0xc3ca('0x23')]);_0x10265e[_0xc3ca('0x29')]=_['keys'](_0x1dd046[_0xc3ca('0x29')]);_0x10265e[_0xc3ca('0x30')]=_[_0xc3ca('0x31')](_0x10265e['model'],_0x10265e[_0xc3ca('0x29')]);_0x4460a7[_0xc3ca('0x32')]=_['intersection'](_0x10265e['model'],qs['fields'](_0x1dd046[_0xc3ca('0x29')][_0xc3ca('0x33')]));_0x4460a7['attributes']=_0x4460a7['attributes'][_0xc3ca('0x34')]?_0x4460a7[_0xc3ca('0x32')]:_0x10265e[_0xc3ca('0x2f')];if(_0x1dd046[_0xc3ca('0x29')][_0xc3ca('0x35')]){_0x4460a7['include']=[{'all':!![]}];}_0x4460a7=_[_0xc3ca('0x36')]({},_0x4460a7,_0x1dd046[_0xc3ca('0x37')]);return db[_0xc3ca('0x22')][_0xc3ca('0x38')](_0x4460a7)['then'](handleEntityNotFound(_0x234d15,null))[_0xc3ca('0x18')](respondWithResult(_0x234d15,null))['catch'](handleError(_0x234d15,null));};exports[_0xc3ca('0x39')]=function(_0x4a6fd4,_0x2d1558){return db[_0xc3ca('0x22')][_0xc3ca('0x39')](_0x4a6fd4[_0xc3ca('0x3a')],{})['then'](function(_0x50f9f8){var _0x41ef54=_0x4a6fd4['user'][_0xc3ca('0x1a')]({'plain':!![]});if(!_0x41ef54)throw new Error(_0xc3ca('0x3b'));if(_0x41ef54[_0xc3ca('0x3c')]===_0xc3ca('0x3d')){var _0x4654ed=_0x50f9f8[_0xc3ca('0x1a')]({'plain':!![]});var _0x71d7a0=_0xc3ca('0x1b');return db[_0xc3ca('0x3e')][_0xc3ca('0x38')]({'where':{'name':_0x71d7a0,'userProfileId':_0x41ef54[_0xc3ca('0x3f')]},'raw':!![]})[_0xc3ca('0x18')](function(_0x4012bd){if(_0x4012bd&&_0x4012bd['autoAssociation']===0x0){return db[_0xc3ca('0x1c')]['create']({'name':_0x4654ed['name'],'resourceId':_0x4654ed['id'],'type':_0x4012bd[_0xc3ca('0x20')],'sectionId':_0x4012bd['id']},{})['then'](function(){return _0x50f9f8;});}else{return _0x50f9f8;}})[_0xc3ca('0x2c')](function(_0x30af24){logger[_0xc3ca('0x1e')](_0xc3ca('0x40'),_0x30af24);throw _0x30af24;});}return _0x50f9f8;})[_0xc3ca('0x18')](respondWithResult(_0x2d1558,0xc9))[_0xc3ca('0x2c')](handleError(_0x2d1558,null));};exports[_0xc3ca('0x17')]=function(_0x553d5c,_0x38020b){if(_0x553d5c[_0xc3ca('0x3a')]['id']){delete _0x553d5c[_0xc3ca('0x3a')]['id'];}return db[_0xc3ca('0x22')][_0xc3ca('0x38')]({'where':{'id':_0x553d5c[_0xc3ca('0x2e')]['id']}})[_0xc3ca('0x18')](handleEntityNotFound(_0x38020b,null))[_0xc3ca('0x18')](saveUpdates(_0x553d5c['body'],null))['then'](respondWithResult(_0x38020b,null))[_0xc3ca('0x2c')](handleError(_0x38020b,null));};exports[_0xc3ca('0x19')]=function(_0x1ee518,_0x5c43f1){return db['OpenchannelQueue'][_0xc3ca('0x38')]({'where':{'id':_0x1ee518[_0xc3ca('0x2e')]['id']}})[_0xc3ca('0x18')](handleEntityNotFound(_0x5c43f1,null))['then'](removeEntity(_0x5c43f1,null))[_0xc3ca('0x2c')](handleError(_0x5c43f1,null));};exports[_0xc3ca('0x41')]=function(_0x39c334,_0x27354c){return db[_0xc3ca('0x22')][_0xc3ca('0x41')]()[_0xc3ca('0x18')](respondWithResult(_0x27354c,null))[_0xc3ca('0x2c')](handleError(_0x27354c,null));};exports[_0xc3ca('0x42')]=function(_0x527a49,_0x5536b4){var _0x45ae16={'raw':!![],'where':{}},_0x2594cd={},_0x4edb19;return db['OpenchannelQueue'][_0xc3ca('0x43')]({'where':{'id':_0x527a49[_0xc3ca('0x2e')]['id']}})[_0xc3ca('0x18')](handleEntityNotFound(_0x5536b4,null))[_0xc3ca('0x18')](function(_0x56d8c3){if(_0x56d8c3){_0x4edb19=_0x56d8c3[_0xc3ca('0x1a')]({'plain':!![]});_0x2594cd['model']=_[_0xc3ca('0x44')](db['UserOpenchannelQueue'][_0xc3ca('0x23')]);_0x2594cd[_0xc3ca('0x29')]=_[_0xc3ca('0x44')](_0x527a49[_0xc3ca('0x29')]);_0x2594cd[_0xc3ca('0x30')]=_[_0xc3ca('0x31')](_0x2594cd[_0xc3ca('0x2f')],_0x2594cd['query']);_0x45ae16[_0xc3ca('0x32')]=_[_0xc3ca('0x31')](_0x2594cd['model'],qs['fields'](_0x527a49[_0xc3ca('0x29')][_0xc3ca('0x33')]));_0x45ae16[_0xc3ca('0x32')]=_0x45ae16[_0xc3ca('0x32')][_0xc3ca('0x34')]?_0x45ae16[_0xc3ca('0x32')]:_0x2594cd[_0xc3ca('0x2f')];if(!_0x527a49[_0xc3ca('0x29')][_0xc3ca('0x45')](_0xc3ca('0x46'))){_0x45ae16[_0xc3ca('0x13')]=qs['limit'](_0x527a49[_0xc3ca('0x29')][_0xc3ca('0x13')]);_0x45ae16[_0xc3ca('0x15')]=qs['offset'](_0x527a49[_0xc3ca('0x29')][_0xc3ca('0x15')]);}_0x45ae16[_0xc3ca('0x47')]=qs[_0xc3ca('0x48')](_0x527a49['query']['sort']);_0x45ae16[_0xc3ca('0x27')]=qs['filters'](_[_0xc3ca('0x49')](_0x527a49[_0xc3ca('0x29')],_0x2594cd[_0xc3ca('0x30')]));_0x45ae16['where'][_0xc3ca('0x4a')]=_0x56d8c3['id'];if(_0x527a49['query'][_0xc3ca('0x4b')]){_0x45ae16[_0xc3ca('0x27')]=_[_0xc3ca('0x36')](_0x45ae16[_0xc3ca('0x27')],{'$or':_[_0xc3ca('0x21')](_0x45ae16[_0xc3ca('0x32')],function(_0x493734){var _0x5c8ad0={};_0x5c8ad0[_0x493734]={'$like':'%'+_0x527a49[_0xc3ca('0x29')]['filter']+'%'};return _0x5c8ad0;})});}_0x45ae16=_[_0xc3ca('0x36')]({},_0x45ae16,_0x527a49[_0xc3ca('0x37')]);return db[_0xc3ca('0x4c')][_0xc3ca('0x2a')](_0x45ae16);}})[_0xc3ca('0x18')](function(_0x210166){if(_0x210166){return db[_0xc3ca('0x4d')][_0xc3ca('0x4e')]({'where':{'id':_[_0xc3ca('0x21')](_0x210166,'UserId'),'role':_0xc3ca('0x4f')},'attributes':['id',_0xc3ca('0x20'),'openchannelPause',_0xc3ca('0x50'),_0xc3ca('0x51')]});}})[_0xc3ca('0x18')](function(_0x4a2bd4){if(_0x4a2bd4){return{'count':_0x4a2bd4[_0xc3ca('0x14')],'rows':_['map'](_0x4a2bd4[_0xc3ca('0x2b')],function(_0x159c95){return{'membername':_0x159c95[_0xc3ca('0x20')],'UserId':_0x159c95['id'],'queue_name':_0x4edb19[_0xc3ca('0x20')],'OpenchannelQueueId':_0x4edb19['id'],'interface':util[_0xc3ca('0x52')](_0xc3ca('0x53'),_0xc3ca('0x54'),_0x159c95[_0xc3ca('0x20')]),'penalty':0x0,'paused':_0x159c95[_0xc3ca('0x55')],'createdAt':_0x159c95[_0xc3ca('0x51')],'updatedAt':_0x159c95[_0xc3ca('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc3ca('0x18')](respondWithFilteredResult(_0x5536b4,_0x45ae16))['catch'](handleError(_0x5536b4,null));};exports['getTeams']=function(_0x2a2a9e,_0x163de0){var _0x3e0791={};var _0x49ee24={};var _0xb3da99;var _0x66af8c;return db[_0xc3ca('0x22')]['findOne']({'where':{'id':_0x2a2a9e['params']['id']}})[_0xc3ca('0x18')](handleEntityNotFound(_0x163de0,null))[_0xc3ca('0x18')](function(_0x4b8981){if(_0x4b8981){_0xb3da99=_0x4b8981;_0x49ee24['model']=_[_0xc3ca('0x44')](db[_0xc3ca('0x56')][_0xc3ca('0x23')]);_0x49ee24[_0xc3ca('0x29')]=_[_0xc3ca('0x44')](_0x2a2a9e[_0xc3ca('0x29')]);_0x49ee24[_0xc3ca('0x30')]=_[_0xc3ca('0x31')](_0x49ee24[_0xc3ca('0x2f')],_0x49ee24[_0xc3ca('0x29')]);_0x3e0791['attributes']=_['intersection'](_0x49ee24['model'],qs[_0xc3ca('0x33')](_0x2a2a9e[_0xc3ca('0x29')][_0xc3ca('0x33')]));_0x3e0791['attributes']=_0x3e0791[_0xc3ca('0x32')][_0xc3ca('0x34')]?_0x3e0791['attributes']:_0x49ee24[_0xc3ca('0x2f')];_0x3e0791[_0xc3ca('0x47')]=qs['sort'](_0x2a2a9e[_0xc3ca('0x29')][_0xc3ca('0x48')]);_0x3e0791['where']=qs[_0xc3ca('0x30')](_[_0xc3ca('0x49')](_0x2a2a9e[_0xc3ca('0x29')],_0x49ee24[_0xc3ca('0x30')]));if(_0x2a2a9e[_0xc3ca('0x29')][_0xc3ca('0x4b')]){_0x3e0791[_0xc3ca('0x27')]=_['merge'](_0x3e0791[_0xc3ca('0x27')],{'$or':_[_0xc3ca('0x21')](_0x3e0791['attributes'],function(_0x3c7a9d){var _0x4d2f92={};_0x4d2f92[_0x3c7a9d]={'$like':'%'+_0x2a2a9e[_0xc3ca('0x29')][_0xc3ca('0x4b')]+'%'};return _0x4d2f92;})});}_0x3e0791=_[_0xc3ca('0x36')]({},_0x3e0791,_0x2a2a9e[_0xc3ca('0x37')]);return _0xb3da99[_0xc3ca('0x57')](_0x3e0791);}})[_0xc3ca('0x18')](function(_0x4e906c){if(_0x4e906c){_0x66af8c=_0x4e906c[_0xc3ca('0x34')];if(!_0x2a2a9e['query'][_0xc3ca('0x45')](_0xc3ca('0x46'))){_0x3e0791[_0xc3ca('0x13')]=qs[_0xc3ca('0x13')](_0x2a2a9e['query']['limit']);_0x3e0791[_0xc3ca('0x15')]=qs['offset'](_0x2a2a9e['query'][_0xc3ca('0x15')]);}return _0xb3da99[_0xc3ca('0x57')](_0x3e0791);}})[_0xc3ca('0x18')](function(_0x4c6b27){if(_0x4c6b27){return _0x4c6b27?{'count':_0x66af8c,'rows':_0x4c6b27}:null;}})['then'](respondWithResult(_0x163de0,null))['catch'](handleError(_0x163de0,null));};exports[_0xc3ca('0x58')]=function(_0x8a1f90,_0x569477){var _0x4758b8=_0x8a1f90[_0xc3ca('0x3a')][_0xc3ca('0x59')];return db[_0xc3ca('0x56')][_0xc3ca('0x2a')]({'where':{'id':_0x4758b8},'attributes':['id'],'include':[{'model':db[_0xc3ca('0x4d')],'as':_0xc3ca('0x5a'),'attributes':['id','name',_0xc3ca('0x5b'),_0xc3ca('0x5c'),_0xc3ca('0x5d')],'raw':!![]}]})[_0xc3ca('0x18')](function(_0x482ad7){if(_0x482ad7){var _0x22e2f6=_[_0xc3ca('0x5e')](_0x482ad7,function(_0x23f681){var _0x43f49f=_0x23f681[_0xc3ca('0x1a')]({'plain':!![]});return _0x43f49f[_0xc3ca('0x5a')];});return db[_0xc3ca('0x22')]['find']({'where':{'id':_0x8a1f90[_0xc3ca('0x2e')]['id']}})[_0xc3ca('0x18')](function(_0x164678){return db['sequelize'][_0xc3ca('0x5f')](function(_0x3a61e9){return _0x164678[_0xc3ca('0x58')](_0x4758b8,{'transaction':_0x3a61e9})[_0xc3ca('0x18')](function(){return BPromise['each'](_0x22e2f6,function(_0x921f71){return db[_0xc3ca('0x4c')]['findOrCreate']({'where':{'UserId':_0x921f71['id'],'OpenchannelQueueId':_0x8a1f90[_0xc3ca('0x2e')]['id']},'transaction':_0x3a61e9});});})[_0xc3ca('0x18')](function(){_0x22e2f6['forEach'](function(_0x122475){socket[_0xc3ca('0x60')](_0xc3ca('0x61'),{'UserId':_0x122475['id'],'OpenchannelQueueId':_0x164678['id']});});});});});}})[_0xc3ca('0x18')](respondWithStatusCode(_0x569477,null))['catch'](handleError(_0x569477,null));};exports['removeTeams']=function(_0x5e8524,_0x431800){return db[_0xc3ca('0x56')][_0xc3ca('0x2a')]({'where':{'id':_0x5e8524[_0xc3ca('0x29')][_0xc3ca('0x59')]},'attributes':['id'],'include':[{'model':db[_0xc3ca('0x4d')],'as':_0xc3ca('0x5a'),'attributes':['id'],'raw':!![]}]})[_0xc3ca('0x18')](handleEntityNotFound(_0x431800,null))[_0xc3ca('0x18')](function(_0x2452a9){var _0x46b92b=_['map'](_0x2452a9,'id');var _0x4f0553=[];var _0xa314f2=[];var _0x34c46c=squel['select']();_0x34c46c[_0xc3ca('0x62')](_0xc3ca('0x63'))[_0xc3ca('0x64')]('team_has_openchannel_queues','tq')['join'](_0xc3ca('0x65'),'ut',_0xc3ca('0x66'))[_0xc3ca('0x27')](_0xc3ca('0x67'),_0x5e8524[_0xc3ca('0x2e')]['id']);for(var _0x28d077=0x0;_0x28d077<_0x2452a9['length'];_0x28d077+=0x1){let _0x3c35ea=_0x2452a9[_0x28d077];for(var _0x254c07=0x0;_0x254c07<_0x3c35ea[_0xc3ca('0x5a')]['length'];_0x254c07+=0x1){let _0x1b6a2f=_0x3c35ea['Agents'][_0x254c07];var _0x1aaeed=_0x34c46c['clone']();_0x1aaeed['where'](_0xc3ca('0x68'),_0x1b6a2f['id']);_0xa314f2[_0xc3ca('0x69')](db[_0xc3ca('0x6a')][_0xc3ca('0x29')](_0x1aaeed[_0xc3ca('0x6b')](),{'type':db[_0xc3ca('0x6a')][_0xc3ca('0x6c')][_0xc3ca('0x6d')]})['then'](function(_0x40102f){if(_0x40102f[_0xc3ca('0x34')]===0x1){return _0x1b6a2f['id'];}else{var _0x2e014f=_[_0xc3ca('0x6e')](_[_0xc3ca('0x21')](_0x40102f,_0xc3ca('0x6f')),function(_0x9adbe9){return _[_0xc3ca('0x70')](_0x46b92b,_0x9adbe9);});if(_0x2e014f){return _0x1b6a2f['id'];}}}));}}return BPromise[_0xc3ca('0x71')](_0xa314f2)[_0xc3ca('0x18')](function(_0x4c6445){_0x4f0553=_(_0x4f0553)[_0xc3ca('0x72')](_0x4c6445)[_0xc3ca('0x73')]()[_0xc3ca('0x74')]();return db['OpenchannelQueue'][_0xc3ca('0x38')]({'where':{'id':_0x5e8524[_0xc3ca('0x2e')]['id']}})['then'](function(_0x2bd1a5){return db[_0xc3ca('0x6a')][_0xc3ca('0x5f')](function(_0x3ba11c){return _0x2bd1a5[_0xc3ca('0x75')](_0x5e8524[_0xc3ca('0x29')][_0xc3ca('0x59')],{'transaction':_0x3ba11c})[_0xc3ca('0x18')](function(){if(!_[_0xc3ca('0x76')](_0x4f0553)){return _0x2bd1a5[_0xc3ca('0x77')](_0x4f0553,{'transaction':_0x3ba11c});}})[_0xc3ca('0x18')](function(){_0x4f0553[_0xc3ca('0x78')](function(_0x332e78){socket['emit'](_0xc3ca('0x79'),{'UserId':_0x332e78,'OpenchannelQueueId':_0x2bd1a5['id']});});});});});});})[_0xc3ca('0x18')](respondWithStatusCode(_0x431800,null))[_0xc3ca('0x2c')](handleError(_0x431800,null));};exports[_0xc3ca('0x7a')]=function(_0xfdb757,_0x24e86e){return db[_0xc3ca('0x22')][_0xc3ca('0x38')]({'where':{'id':_0xfdb757['params']['id']}})['then'](handleEntityNotFound(_0x24e86e,null))[_0xc3ca('0x18')](function(_0x5c2fbc){if(_0x5c2fbc){return _0x5c2fbc[_0xc3ca('0x7a')](_0xfdb757['body'][_0xc3ca('0x59')],_[_0xc3ca('0x7b')](_0xfdb757[_0xc3ca('0x3a')],['ids','id'])||{})[_0xc3ca('0x7c')](function(_0x46d969){for(var _0x20de83=0x0;_0x20de83<_0xfdb757[_0xc3ca('0x3a')][_0xc3ca('0x59')][_0xc3ca('0x34')];_0x20de83+=0x1){socket[_0xc3ca('0x60')](_0xc3ca('0x61'),{'UserId':Number(_0xfdb757[_0xc3ca('0x3a')]['ids'][_0x20de83]),'OpenchannelQueueId':Number(_0xfdb757[_0xc3ca('0x2e')]['id'])});}return _0x46d969;});}})[_0xc3ca('0x18')](respondWithResult(_0x24e86e,null))[_0xc3ca('0x2c')](handleError(_0x24e86e,null));};exports[_0xc3ca('0x77')]=function(_0x4143c4,_0x1e2112){return db['OpenchannelQueue'][_0xc3ca('0x38')]({'where':{'id':_0x4143c4[_0xc3ca('0x2e')]['id']}})[_0xc3ca('0x18')](handleEntityNotFound(_0x1e2112,null))[_0xc3ca('0x18')](function(_0x4e0766){if(_0x4e0766){return _0x4e0766[_0xc3ca('0x77')](_0x4143c4[_0xc3ca('0x29')][_0xc3ca('0x59')])[_0xc3ca('0x18')](function(){if(_[_0xc3ca('0x7d')](_0x4143c4[_0xc3ca('0x29')][_0xc3ca('0x59')])){for(var _0x2dd180=0x0;_0x2dd180<_0x4143c4[_0xc3ca('0x29')][_0xc3ca('0x59')][_0xc3ca('0x34')];_0x2dd180+=0x1){socket[_0xc3ca('0x60')](_0xc3ca('0x79'),{'UserId':Number(_0x4143c4[_0xc3ca('0x29')]['ids'][_0x2dd180]),'OpenchannelQueueId':Number(_0x4143c4[_0xc3ca('0x2e')]['id'])});}}else{socket['emit'](_0xc3ca('0x79'),{'UserId':Number(_0x4143c4['query'][_0xc3ca('0x59')]),'OpenchannelQueueId':Number(_0x4143c4[_0xc3ca('0x2e')]['id'])});}});}})[_0xc3ca('0x18')](respondWithStatusCode(_0x1e2112,null))[_0xc3ca('0x2c')](handleError(_0x1e2112,null));};exports[_0xc3ca('0x7e')]=function(_0x1fdb4f,_0x55050e){var _0xa684b4={};var _0x2aa9a3={};var _0x2035ef;var _0x16269f;return db[_0xc3ca('0x22')][_0xc3ca('0x43')]({'where':{'id':_0x1fdb4f[_0xc3ca('0x2e')]['id']}})[_0xc3ca('0x18')](handleEntityNotFound(_0x55050e,null))[_0xc3ca('0x18')](function(_0x4771b1){if(_0x4771b1){_0x2035ef=_0x4771b1;_0x2aa9a3['model']=_['keys'](db['User'][_0xc3ca('0x23')]);_0x2aa9a3[_0xc3ca('0x29')]=_['keys'](_0x1fdb4f['query']);_0x2aa9a3[_0xc3ca('0x30')]=_[_0xc3ca('0x31')](_0x2aa9a3[_0xc3ca('0x2f')],_0x2aa9a3[_0xc3ca('0x29')]);_0xa684b4['attributes']=_['intersection'](_0x2aa9a3[_0xc3ca('0x2f')],qs['fields'](_0x1fdb4f[_0xc3ca('0x29')][_0xc3ca('0x33')]));_0xa684b4[_0xc3ca('0x32')]=_0xa684b4[_0xc3ca('0x32')]['length']?_0xa684b4[_0xc3ca('0x32')]:_0x2aa9a3['model'];_0xa684b4['order']=qs['sort'](_0x1fdb4f['query'][_0xc3ca('0x48')]);_0xa684b4[_0xc3ca('0x27')]=qs['filters'](_[_0xc3ca('0x49')](_0x1fdb4f[_0xc3ca('0x29')],_0x2aa9a3['filters']));if(_0x1fdb4f[_0xc3ca('0x29')]['filter']){_0xa684b4[_0xc3ca('0x27')]=_[_0xc3ca('0x36')](_0xa684b4['where'],{'$or':_[_0xc3ca('0x21')](_0xa684b4[_0xc3ca('0x32')],function(_0x2e4f14){var _0x55e58a={};_0x55e58a[_0x2e4f14]={'$like':'%'+_0x1fdb4f['query'][_0xc3ca('0x4b')]+'%'};return _0x55e58a;})});}_0xa684b4=_[_0xc3ca('0x36')]({},_0xa684b4,_0x1fdb4f[_0xc3ca('0x37')]);return _0x2035ef[_0xc3ca('0x7e')](_0xa684b4);}})[_0xc3ca('0x18')](function(_0xea9018){if(_0xea9018){_0x16269f=_0xea9018[_0xc3ca('0x34')];if(!_0x1fdb4f[_0xc3ca('0x29')][_0xc3ca('0x45')](_0xc3ca('0x46'))){_0xa684b4['limit']=qs['limit'](_0x1fdb4f[_0xc3ca('0x29')][_0xc3ca('0x13')]);_0xa684b4[_0xc3ca('0x15')]=qs[_0xc3ca('0x15')](_0x1fdb4f[_0xc3ca('0x29')][_0xc3ca('0x15')]);}return _0x2035ef[_0xc3ca('0x7e')](_0xa684b4);}})[_0xc3ca('0x18')](function(_0x2bf2f9){if(_0x2bf2f9){return _0x2bf2f9?{'count':_0x16269f,'rows':_0x2bf2f9}:null;}})['then'](respondWithResult(_0x55050e,null))[_0xc3ca('0x2c')](handleError(_0x55050e,null));}; \ No newline at end of file +var _0x33fc=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','nolimit','order','sort','pick','OpenchannelQueueId','filter','options','findAndCountAll','UserId','openchannelPause','format','SIP','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','each','forEach','emit','select','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','every','includes','all','compact','removeTeams','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','util','lodash','squel','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','index','map','OpenchannelQueue','rawAttributes','type','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','user','UserProfileSection','autoAssociation'];(function(_0x940d80,_0x37300e){var _0xd72077=function(_0xbcd603){while(--_0xbcd603){_0x940d80['push'](_0x940d80['shift']());}};_0xd72077(++_0x37300e);}(_0x33fc,0xa2));var _0xc33f=function(_0x4da03b,_0x3d680d){_0x4da03b=_0x4da03b-0x0;var _0x25144d=_0x33fc[_0x4da03b];return _0x25144d;};'use strict';var BPromise=require(_0xc33f('0x0'));var util=require(_0xc33f('0x1'));var _=require(_0xc33f('0x2'));var squel=require(_0xc33f('0x3'));var Redis=require('ioredis');var qs=require(_0xc33f('0x4'));var logger=require('../../config/logger')(_0xc33f('0x5'));var config=require(_0xc33f('0x6'));var db=require(_0xc33f('0x7'))['db'];config['redis']=_['defaults'](config[_0xc33f('0x8')],{'host':_0xc33f('0x9'),'port':0x18eb});var socket=require(_0xc33f('0xa'))(new Redis(config['redis']));require(_0xc33f('0xb'))[_0xc33f('0xc')](socket);function respondWithStatusCode(_0x27ffae,_0x35f961){_0x35f961=_0x35f961||0xcc;return function(_0x17c27f){if(_0x17c27f){return _0x27ffae[_0xc33f('0xd')](_0x35f961);}return _0x27ffae[_0xc33f('0xe')](_0x35f961)[_0xc33f('0xf')]();};}function respondWithResult(_0x2eaff8,_0x308964){_0x308964=_0x308964||0xc8;return function(_0x236cec){if(_0x236cec){return _0x2eaff8[_0xc33f('0xe')](_0x308964)[_0xc33f('0x10')](_0x236cec);}};}function respondWithFilteredResult(_0x121034,_0x57a7dd){return function(_0x3fd954){if(_0x3fd954){var _0x16954a=typeof _0x57a7dd[_0xc33f('0x11')]===_0xc33f('0x12')&&typeof _0x57a7dd['limit']===_0xc33f('0x12');var _0x48e2f5=_0x3fd954[_0xc33f('0x13')];var _0x2f9a86=_0x16954a?0x0:_0x57a7dd['offset'];var _0x44e8f7=_0x16954a?_0x3fd954[_0xc33f('0x13')]:_0x57a7dd['offset']+_0x57a7dd[_0xc33f('0x14')];var _0x5255da;if(_0x44e8f7>=_0x48e2f5){_0x44e8f7=_0x48e2f5;_0x5255da=0xc8;}else{_0x5255da=0xce;}_0x121034['status'](_0x5255da);return _0x121034[_0xc33f('0x15')](_0xc33f('0x16'),_0x2f9a86+'-'+_0x44e8f7+'/'+_0x48e2f5)['json'](_0x3fd954);}return null;};}function saveUpdates(_0x1a5fa3){return function(_0x33bd61){if(_0x33bd61){return _0x33bd61[_0xc33f('0x17')](_0x1a5fa3)[_0xc33f('0x18')](function(_0x56bc9e){return _0x56bc9e;});}return null;};}function removeEntity(_0x3d2e9a){return function(_0x29ccac){if(_0x29ccac){return _0x29ccac[_0xc33f('0x19')]()['then'](function(){var _0x2f1620=_0x29ccac[_0xc33f('0x1a')]({'plain':!![]});var _0x5dec74=_0xc33f('0x1b');return db[_0xc33f('0x1c')][_0xc33f('0x19')]({'where':{'type':_0x5dec74,'resourceId':_0x2f1620['id']}})['then'](function(){return _0x29ccac;});})[_0xc33f('0x18')](function(){_0x3d2e9a[_0xc33f('0xe')](0xcc)[_0xc33f('0xf')]();});}};}function handleEntityNotFound(_0x47744c){return function(_0x536a92){if(!_0x536a92){_0x47744c['sendStatus'](0x194);}return _0x536a92;};}function handleError(_0x40ad7f,_0x52a05d){_0x52a05d=_0x52a05d||0x1f4;return function(_0x55ea38){logger[_0xc33f('0x1d')](_0x55ea38['stack']);if(_0x55ea38[_0xc33f('0x1e')]){delete _0x55ea38[_0xc33f('0x1e')];}_0x40ad7f[_0xc33f('0xe')](_0x52a05d)['send'](_0x55ea38);};}exports[_0xc33f('0x1f')]=function(_0x2279d8,_0x1c9d41){var _0x34ac9e={};var _0x1ae2f5={'count':0x0,'rows':[]};var _0x15579c=_[_0xc33f('0x20')](db[_0xc33f('0x21')][_0xc33f('0x22')],function(_0x45a9c0){return{'name':_0x45a9c0['fieldName'],'type':_0x45a9c0[_0xc33f('0x23')]['key']};});_0x34ac9e=qs[_0xc33f('0x24')](_0x15579c,_0x2279d8);var _0x142bf1={'where':_0x34ac9e[_0xc33f('0x25')]};return db['OpenchannelQueue'][_0xc33f('0x13')](_0x142bf1)[_0xc33f('0x18')](function(_0x5ca30d){_0x1ae2f5[_0xc33f('0x13')]=_0x5ca30d;_0x34ac9e[_0xc33f('0x26')]=qs[_0xc33f('0x26')](_0x2279d8[_0xc33f('0x27')]);return db[_0xc33f('0x21')][_0xc33f('0x28')](_0x34ac9e);})['then'](function(_0x451c46){_0x1ae2f5[_0xc33f('0x29')]=_0x451c46;return _0x1ae2f5;})[_0xc33f('0x18')](respondWithFilteredResult(_0x1c9d41,_0x34ac9e))[_0xc33f('0x2a')](handleError(_0x1c9d41,null));};exports[_0xc33f('0x2b')]=function(_0x114338,_0x21f6b3){var _0x299051={'raw':!![],'where':{'id':_0x114338[_0xc33f('0x2c')]['id']}},_0x3387c9={};_0x3387c9[_0xc33f('0x2d')]=_[_0xc33f('0x2e')](db['OpenchannelQueue'][_0xc33f('0x22')]);_0x3387c9[_0xc33f('0x27')]=_['keys'](_0x114338[_0xc33f('0x27')]);_0x3387c9[_0xc33f('0x2f')]=_[_0xc33f('0x30')](_0x3387c9[_0xc33f('0x2d')],_0x3387c9[_0xc33f('0x27')]);_0x299051[_0xc33f('0x31')]=_['intersection'](_0x3387c9[_0xc33f('0x2d')],qs[_0xc33f('0x32')](_0x114338[_0xc33f('0x27')]['fields']));_0x299051[_0xc33f('0x31')]=_0x299051[_0xc33f('0x31')][_0xc33f('0x33')]?_0x299051['attributes']:_0x3387c9[_0xc33f('0x2d')];if(_0x114338[_0xc33f('0x27')][_0xc33f('0x34')]){_0x299051['include']=[{'all':!![]}];}_0x299051=_[_0xc33f('0x35')]({},_0x299051,_0x114338['options']);return db[_0xc33f('0x21')][_0xc33f('0x36')](_0x299051)[_0xc33f('0x18')](handleEntityNotFound(_0x21f6b3,null))['then'](respondWithResult(_0x21f6b3,null))[_0xc33f('0x2a')](handleError(_0x21f6b3,null));};exports[_0xc33f('0x37')]=function(_0x27325c,_0x2938b2){return db[_0xc33f('0x21')][_0xc33f('0x37')](_0x27325c[_0xc33f('0x38')],{})[_0xc33f('0x18')](function(_0x2cfe7d){var _0x1a8a27=_0x27325c[_0xc33f('0x39')][_0xc33f('0x1a')]({'plain':!![]});if(!_0x1a8a27)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a8a27['role']===_0xc33f('0x39')){var _0x1fc513=_0x2cfe7d[_0xc33f('0x1a')]({'plain':!![]});var _0x53e5a5=_0xc33f('0x1b');return db[_0xc33f('0x3a')][_0xc33f('0x36')]({'where':{'name':_0x53e5a5,'userProfileId':_0x1a8a27['userProfileId']},'raw':!![]})[_0xc33f('0x18')](function(_0x425db7){if(_0x425db7&&_0x425db7[_0xc33f('0x3b')]===0x0){return db[_0xc33f('0x1c')][_0xc33f('0x37')]({'name':_0x1fc513['name'],'resourceId':_0x1fc513['id'],'type':_0x425db7[_0xc33f('0x1e')],'sectionId':_0x425db7['id']},{})['then'](function(){return _0x2cfe7d;});}else{return _0x2cfe7d;}})['catch'](function(_0x376dda){logger['error'](_0xc33f('0x3c'),_0x376dda);throw _0x376dda;});}return _0x2cfe7d;})[_0xc33f('0x18')](respondWithResult(_0x2938b2,0xc9))[_0xc33f('0x2a')](handleError(_0x2938b2,null));};exports[_0xc33f('0x17')]=function(_0x340a5c,_0x368e1b){if(_0x340a5c[_0xc33f('0x38')]['id']){delete _0x340a5c[_0xc33f('0x38')]['id'];}return db['OpenchannelQueue'][_0xc33f('0x36')]({'where':{'id':_0x340a5c['params']['id']}})['then'](handleEntityNotFound(_0x368e1b,null))[_0xc33f('0x18')](saveUpdates(_0x340a5c[_0xc33f('0x38')],null))[_0xc33f('0x18')](respondWithResult(_0x368e1b,null))[_0xc33f('0x2a')](handleError(_0x368e1b,null));};exports[_0xc33f('0x19')]=function(_0xe29f80,_0x5eac48){return db[_0xc33f('0x21')][_0xc33f('0x36')]({'where':{'id':_0xe29f80['params']['id']}})[_0xc33f('0x18')](handleEntityNotFound(_0x5eac48,null))[_0xc33f('0x18')](removeEntity(_0x5eac48,null))[_0xc33f('0x2a')](handleError(_0x5eac48,null));};exports[_0xc33f('0x3d')]=function(_0x8edcde,_0x46ddf7){return db[_0xc33f('0x21')][_0xc33f('0x3d')]()[_0xc33f('0x18')](respondWithResult(_0x46ddf7,null))['catch'](handleError(_0x46ddf7,null));};exports['getMembers']=function(_0x58b5a1,_0x4d9b5d){var _0x2da153={'raw':!![],'where':{}},_0xab872e={},_0xc3f244;return db[_0xc33f('0x21')][_0xc33f('0x3e')]({'where':{'id':_0x58b5a1[_0xc33f('0x2c')]['id']}})[_0xc33f('0x18')](handleEntityNotFound(_0x4d9b5d,null))['then'](function(_0x2ac829){if(_0x2ac829){_0xc3f244=_0x2ac829['get']({'plain':!![]});_0xab872e[_0xc33f('0x2d')]=_[_0xc33f('0x2e')](db[_0xc33f('0x3f')]['rawAttributes']);_0xab872e[_0xc33f('0x27')]=_[_0xc33f('0x2e')](_0x58b5a1['query']);_0xab872e[_0xc33f('0x2f')]=_[_0xc33f('0x30')](_0xab872e['model'],_0xab872e[_0xc33f('0x27')]);_0x2da153[_0xc33f('0x31')]=_[_0xc33f('0x30')](_0xab872e[_0xc33f('0x2d')],qs['fields'](_0x58b5a1[_0xc33f('0x27')][_0xc33f('0x32')]));_0x2da153[_0xc33f('0x31')]=_0x2da153['attributes'][_0xc33f('0x33')]?_0x2da153[_0xc33f('0x31')]:_0xab872e[_0xc33f('0x2d')];if(!_0x58b5a1[_0xc33f('0x27')]['hasOwnProperty'](_0xc33f('0x40'))){_0x2da153[_0xc33f('0x14')]=qs[_0xc33f('0x14')](_0x58b5a1[_0xc33f('0x27')][_0xc33f('0x14')]);_0x2da153[_0xc33f('0x11')]=qs[_0xc33f('0x11')](_0x58b5a1[_0xc33f('0x27')]['offset']);}_0x2da153[_0xc33f('0x41')]=qs[_0xc33f('0x42')](_0x58b5a1[_0xc33f('0x27')]['sort']);_0x2da153['where']=qs[_0xc33f('0x2f')](_[_0xc33f('0x43')](_0x58b5a1[_0xc33f('0x27')],_0xab872e[_0xc33f('0x2f')]));_0x2da153[_0xc33f('0x25')][_0xc33f('0x44')]=_0x2ac829['id'];if(_0x58b5a1[_0xc33f('0x27')][_0xc33f('0x45')]){_0x2da153[_0xc33f('0x25')]=_[_0xc33f('0x35')](_0x2da153[_0xc33f('0x25')],{'$or':_[_0xc33f('0x20')](_0x2da153[_0xc33f('0x31')],function(_0x8a1d7a){var _0x3eb1a9={};_0x3eb1a9[_0x8a1d7a]={'$like':'%'+_0x58b5a1['query'][_0xc33f('0x45')]+'%'};return _0x3eb1a9;})});}_0x2da153=_[_0xc33f('0x35')]({},_0x2da153,_0x58b5a1[_0xc33f('0x46')]);return db['UserOpenchannelQueue']['findAll'](_0x2da153);}})[_0xc33f('0x18')](function(_0x24ab7b){if(_0x24ab7b){return db['User'][_0xc33f('0x47')]({'where':{'id':_[_0xc33f('0x20')](_0x24ab7b,_0xc33f('0x48')),'role':'agent'},'attributes':['id',_0xc33f('0x1e'),_0xc33f('0x49'),'updatedAt','createdAt']});}})[_0xc33f('0x18')](function(_0x12f64b){if(_0x12f64b){return{'count':_0x12f64b[_0xc33f('0x13')],'rows':_[_0xc33f('0x20')](_0x12f64b[_0xc33f('0x29')],function(_0x3ab007){return{'membername':_0x3ab007['name'],'UserId':_0x3ab007['id'],'queue_name':_0xc3f244[_0xc33f('0x1e')],'OpenchannelQueueId':_0xc3f244['id'],'interface':util[_0xc33f('0x4a')]('%s/%s',_0xc33f('0x4b'),_0x3ab007[_0xc33f('0x1e')]),'penalty':0x0,'paused':_0x3ab007[_0xc33f('0x49')],'createdAt':_0x3ab007[_0xc33f('0x4c')],'updatedAt':_0x3ab007['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4d9b5d,_0x2da153))[_0xc33f('0x2a')](handleError(_0x4d9b5d,null));};exports[_0xc33f('0x4d')]=function(_0x591bfa,_0x95fbc8){var _0x2809c2={};var _0x2e53e0={};var _0x10f61d;var _0x48a57d;return db[_0xc33f('0x21')][_0xc33f('0x3e')]({'where':{'id':_0x591bfa[_0xc33f('0x2c')]['id']}})[_0xc33f('0x18')](handleEntityNotFound(_0x95fbc8,null))[_0xc33f('0x18')](function(_0x5c77cf){if(_0x5c77cf){_0x10f61d=_0x5c77cf;_0x2e53e0[_0xc33f('0x2d')]=_[_0xc33f('0x2e')](db[_0xc33f('0x4e')][_0xc33f('0x22')]);_0x2e53e0[_0xc33f('0x27')]=_[_0xc33f('0x2e')](_0x591bfa[_0xc33f('0x27')]);_0x2e53e0[_0xc33f('0x2f')]=_['intersection'](_0x2e53e0[_0xc33f('0x2d')],_0x2e53e0['query']);_0x2809c2[_0xc33f('0x31')]=_[_0xc33f('0x30')](_0x2e53e0['model'],qs[_0xc33f('0x32')](_0x591bfa['query']['fields']));_0x2809c2['attributes']=_0x2809c2['attributes'][_0xc33f('0x33')]?_0x2809c2[_0xc33f('0x31')]:_0x2e53e0[_0xc33f('0x2d')];_0x2809c2[_0xc33f('0x41')]=qs[_0xc33f('0x42')](_0x591bfa['query'][_0xc33f('0x42')]);_0x2809c2[_0xc33f('0x25')]=qs[_0xc33f('0x2f')](_[_0xc33f('0x43')](_0x591bfa[_0xc33f('0x27')],_0x2e53e0[_0xc33f('0x2f')]));if(_0x591bfa['query'][_0xc33f('0x45')]){_0x2809c2[_0xc33f('0x25')]=_[_0xc33f('0x35')](_0x2809c2[_0xc33f('0x25')],{'$or':_[_0xc33f('0x20')](_0x2809c2[_0xc33f('0x31')],function(_0x262ce6){var _0x44d273={};_0x44d273[_0x262ce6]={'$like':'%'+_0x591bfa[_0xc33f('0x27')][_0xc33f('0x45')]+'%'};return _0x44d273;})});}_0x2809c2=_[_0xc33f('0x35')]({},_0x2809c2,_0x591bfa[_0xc33f('0x46')]);return _0x10f61d[_0xc33f('0x4d')](_0x2809c2);}})['then'](function(_0x4fe0e4){if(_0x4fe0e4){_0x48a57d=_0x4fe0e4['length'];if(!_0x591bfa[_0xc33f('0x27')]['hasOwnProperty']('nolimit')){_0x2809c2[_0xc33f('0x14')]=qs[_0xc33f('0x14')](_0x591bfa[_0xc33f('0x27')][_0xc33f('0x14')]);_0x2809c2['offset']=qs['offset'](_0x591bfa[_0xc33f('0x27')][_0xc33f('0x11')]);}return _0x10f61d[_0xc33f('0x4d')](_0x2809c2);}})[_0xc33f('0x18')](function(_0x219ac9){if(_0x219ac9){return _0x219ac9?{'count':_0x48a57d,'rows':_0x219ac9}:null;}})['then'](respondWithResult(_0x95fbc8,null))[_0xc33f('0x2a')](handleError(_0x95fbc8,null));};exports[_0xc33f('0x4f')]=function(_0x328fec,_0x1ee9d2){var _0xdcda9c=_0x328fec[_0xc33f('0x38')][_0xc33f('0x50')];return db['Team']['findAll']({'where':{'id':_0xdcda9c},'attributes':['id'],'include':[{'model':db[_0xc33f('0x51')],'as':_0xc33f('0x52'),'attributes':['id',_0xc33f('0x1e'),_0xc33f('0x53'),_0xc33f('0x54'),'interface'],'raw':!![]}]})[_0xc33f('0x18')](function(_0x40f131){if(_0x40f131){var _0x505e43=_[_0xc33f('0x55')](_0x40f131,function(_0x1567c6){var _0x43bd27=_0x1567c6[_0xc33f('0x1a')]({'plain':!![]});return _0x43bd27['Agents'];});return db[_0xc33f('0x21')][_0xc33f('0x36')]({'where':{'id':_0x328fec[_0xc33f('0x2c')]['id']}})[_0xc33f('0x18')](function(_0x557952){return db[_0xc33f('0x56')][_0xc33f('0x57')](function(_0x211355){return _0x557952['addTeams'](_0xdcda9c,{'transaction':_0x211355})[_0xc33f('0x18')](function(){return BPromise[_0xc33f('0x58')](_0x505e43,function(_0x2dbc17){return db[_0xc33f('0x3f')]['findOrCreate']({'where':{'UserId':_0x2dbc17['id'],'OpenchannelQueueId':_0x328fec['params']['id']},'transaction':_0x211355});});})[_0xc33f('0x18')](function(){_0x505e43[_0xc33f('0x59')](function(_0x3d3665){socket[_0xc33f('0x5a')]('userOpenchannelQueue:save',{'UserId':_0x3d3665['id'],'OpenchannelQueueId':_0x557952['id']});});});});});}})['then'](respondWithStatusCode(_0x1ee9d2,null))[_0xc33f('0x2a')](handleError(_0x1ee9d2,null));};exports['removeTeams']=function(_0x24d7e9,_0x4f27a4){return db[_0xc33f('0x4e')]['findAll']({'where':{'id':_0x24d7e9['query'][_0xc33f('0x50')]},'attributes':['id'],'include':[{'model':db[_0xc33f('0x51')],'as':_0xc33f('0x52'),'attributes':['id'],'raw':!![]}]})[_0xc33f('0x18')](handleEntityNotFound(_0x4f27a4,null))[_0xc33f('0x18')](function(_0x364a7f){var _0x6f1bf6=_[_0xc33f('0x20')](_0x364a7f,'id');var _0x369dcc=[];var _0x4f8e32=[];var _0x4297c2=squel[_0xc33f('0x5b')]();_0x4297c2['field']('tq.TeamId')['from'](_0xc33f('0x5c'),'tq')[_0xc33f('0x5d')]('user_has_teams','ut',_0xc33f('0x5e'))[_0xc33f('0x25')]('OpenchannelQueueId\x20=\x20?',_0x24d7e9[_0xc33f('0x2c')]['id']);for(var _0x3f8b48=0x0;_0x3f8b48<_0x364a7f[_0xc33f('0x33')];_0x3f8b48+=0x1){let _0x9ac47e=_0x364a7f[_0x3f8b48];for(var _0x111550=0x0;_0x111550<_0x9ac47e['Agents']['length'];_0x111550+=0x1){let _0x1e9b94=_0x9ac47e[_0xc33f('0x52')][_0x111550];var _0x5445b6=_0x4297c2[_0xc33f('0x5f')]();_0x5445b6[_0xc33f('0x25')]('ut.UserId\x20=\x20?',_0x1e9b94['id']);_0x4f8e32['push'](db[_0xc33f('0x56')][_0xc33f('0x27')](_0x5445b6['toString'](),{'type':db[_0xc33f('0x56')][_0xc33f('0x60')][_0xc33f('0x61')]})[_0xc33f('0x18')](function(_0x180bfd){if(_0x180bfd[_0xc33f('0x33')]===0x1){return _0x1e9b94['id'];}else{var _0x3870fa=_[_0xc33f('0x62')](_[_0xc33f('0x20')](_0x180bfd,'TeamId'),function(_0x83244){return _[_0xc33f('0x63')](_0x6f1bf6,_0x83244);});if(_0x3870fa){return _0x1e9b94['id'];}}}));}}return BPromise[_0xc33f('0x64')](_0x4f8e32)[_0xc33f('0x18')](function(_0x1f4b4d){_0x369dcc=_(_0x369dcc)['union'](_0x1f4b4d)[_0xc33f('0x65')]()['value']();return db['OpenchannelQueue'][_0xc33f('0x36')]({'where':{'id':_0x24d7e9[_0xc33f('0x2c')]['id']}})[_0xc33f('0x18')](function(_0x5b3cb7){return db[_0xc33f('0x56')][_0xc33f('0x57')](function(_0x5e6d41){return _0x5b3cb7[_0xc33f('0x66')](_0x24d7e9[_0xc33f('0x27')][_0xc33f('0x50')],{'transaction':_0x5e6d41})[_0xc33f('0x18')](function(){if(!_['isEmpty'](_0x369dcc)){return _0x5b3cb7[_0xc33f('0x67')](_0x369dcc,{'transaction':_0x5e6d41});}})[_0xc33f('0x18')](function(){_0x369dcc[_0xc33f('0x59')](function(_0x3c1b24){socket[_0xc33f('0x5a')](_0xc33f('0x68'),{'UserId':_0x3c1b24,'OpenchannelQueueId':_0x5b3cb7['id']});});});});});});})[_0xc33f('0x18')](respondWithStatusCode(_0x4f27a4,null))['catch'](handleError(_0x4f27a4,null));};exports[_0xc33f('0x69')]=function(_0x29780c,_0x589cbe){return db[_0xc33f('0x21')][_0xc33f('0x36')]({'where':{'id':_0x29780c['params']['id']}})[_0xc33f('0x18')](handleEntityNotFound(_0x589cbe,null))[_0xc33f('0x18')](function(_0xc81ce2){if(_0xc81ce2){return _0xc81ce2['addAgents'](_0x29780c[_0xc33f('0x38')][_0xc33f('0x50')],_[_0xc33f('0x6a')](_0x29780c['body'],[_0xc33f('0x50'),'id'])||{})[_0xc33f('0x6b')](function(_0x5d360a){for(var _0x2127b4=0x0;_0x2127b4<_0x29780c['body'][_0xc33f('0x50')][_0xc33f('0x33')];_0x2127b4+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x29780c['body'][_0xc33f('0x50')][_0x2127b4]),'OpenchannelQueueId':Number(_0x29780c['params']['id'])});}return _0x5d360a;});}})[_0xc33f('0x18')](respondWithResult(_0x589cbe,null))[_0xc33f('0x2a')](handleError(_0x589cbe,null));};exports['removeAgents']=function(_0x4c2c69,_0x438b6b){return db[_0xc33f('0x21')][_0xc33f('0x36')]({'where':{'id':_0x4c2c69[_0xc33f('0x2c')]['id']}})['then'](handleEntityNotFound(_0x438b6b,null))[_0xc33f('0x18')](function(_0x45c280){if(_0x45c280){return _0x45c280[_0xc33f('0x67')](_0x4c2c69['query'][_0xc33f('0x50')])[_0xc33f('0x18')](function(){if(_[_0xc33f('0x6c')](_0x4c2c69['query']['ids'])){for(var _0x44a766=0x0;_0x44a766<_0x4c2c69[_0xc33f('0x27')]['ids'][_0xc33f('0x33')];_0x44a766+=0x1){socket[_0xc33f('0x5a')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4c2c69['query'][_0xc33f('0x50')][_0x44a766]),'OpenchannelQueueId':Number(_0x4c2c69[_0xc33f('0x2c')]['id'])});}}else{socket[_0xc33f('0x5a')](_0xc33f('0x68'),{'UserId':Number(_0x4c2c69[_0xc33f('0x27')][_0xc33f('0x50')]),'OpenchannelQueueId':Number(_0x4c2c69[_0xc33f('0x2c')]['id'])});}});}})[_0xc33f('0x18')](respondWithStatusCode(_0x438b6b,null))[_0xc33f('0x2a')](handleError(_0x438b6b,null));};exports[_0xc33f('0x6d')]=function(_0x48100d,_0x5e4189){var _0x53f96a={};var _0x58353d={};var _0x6b2361;var _0x31e40b;return db['OpenchannelQueue'][_0xc33f('0x3e')]({'where':{'id':_0x48100d[_0xc33f('0x2c')]['id']}})[_0xc33f('0x18')](handleEntityNotFound(_0x5e4189,null))['then'](function(_0x759968){if(_0x759968){_0x6b2361=_0x759968;_0x58353d[_0xc33f('0x2d')]=_['keys'](db[_0xc33f('0x51')]['rawAttributes']);_0x58353d[_0xc33f('0x27')]=_['keys'](_0x48100d[_0xc33f('0x27')]);_0x58353d[_0xc33f('0x2f')]=_[_0xc33f('0x30')](_0x58353d[_0xc33f('0x2d')],_0x58353d['query']);_0x53f96a['attributes']=_[_0xc33f('0x30')](_0x58353d[_0xc33f('0x2d')],qs[_0xc33f('0x32')](_0x48100d[_0xc33f('0x27')][_0xc33f('0x32')]));_0x53f96a[_0xc33f('0x31')]=_0x53f96a['attributes']['length']?_0x53f96a[_0xc33f('0x31')]:_0x58353d[_0xc33f('0x2d')];_0x53f96a[_0xc33f('0x41')]=qs[_0xc33f('0x42')](_0x48100d[_0xc33f('0x27')][_0xc33f('0x42')]);_0x53f96a[_0xc33f('0x25')]=qs[_0xc33f('0x2f')](_[_0xc33f('0x43')](_0x48100d[_0xc33f('0x27')],_0x58353d[_0xc33f('0x2f')]));if(_0x48100d[_0xc33f('0x27')][_0xc33f('0x45')]){_0x53f96a[_0xc33f('0x25')]=_[_0xc33f('0x35')](_0x53f96a[_0xc33f('0x25')],{'$or':_[_0xc33f('0x20')](_0x53f96a[_0xc33f('0x31')],function(_0x4a474f){var _0x1e8d01={};_0x1e8d01[_0x4a474f]={'$like':'%'+_0x48100d[_0xc33f('0x27')]['filter']+'%'};return _0x1e8d01;})});}_0x53f96a=_[_0xc33f('0x35')]({},_0x53f96a,_0x48100d['options']);return _0x6b2361[_0xc33f('0x6d')](_0x53f96a);}})[_0xc33f('0x18')](function(_0x1f7334){if(_0x1f7334){_0x31e40b=_0x1f7334[_0xc33f('0x33')];if(!_0x48100d[_0xc33f('0x27')][_0xc33f('0x6e')](_0xc33f('0x40'))){_0x53f96a[_0xc33f('0x14')]=qs[_0xc33f('0x14')](_0x48100d[_0xc33f('0x27')][_0xc33f('0x14')]);_0x53f96a[_0xc33f('0x11')]=qs[_0xc33f('0x11')](_0x48100d[_0xc33f('0x27')][_0xc33f('0x11')]);}return _0x6b2361[_0xc33f('0x6d')](_0x53f96a);}})[_0xc33f('0x18')](function(_0x39e357){if(_0x39e357){return _0x39e357?{'count':_0x31e40b,'rows':_0x39e357}:null;}})['then'](respondWithResult(_0x5e4189,null))[_0xc33f('0x2a')](handleError(_0x5e4189,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index e3f0083..d13ef04 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 _0xec3b=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x5687d3,_0x980d0b){var _0x31988b=function(_0x193486){while(--_0x193486){_0x5687d3['push'](_0x5687d3['shift']());}};_0x31988b(++_0x980d0b);}(_0xec3b,0x194));var _0xbec3=function(_0x5c38b3,_0x423ea3){_0x5c38b3=_0x5c38b3-0x0;var _0x611cc6=_0xec3b[_0x5c38b3];return _0x611cc6;};'use strict';var EventEmitter=require(_0xbec3('0x0'));var OpenchannelQueue=require(_0xbec3('0x1'))['db'][_0xbec3('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xbec3('0x3')](0x0);var events={'afterCreate':_0xbec3('0x4'),'afterUpdate':_0xbec3('0x5'),'afterDestroy':_0xbec3('0x6')};function emitEvent(_0x5a2f76){return function(_0x36e533,_0x3a06ab,_0x4e5c93){OpenchannelQueueEvents[_0xbec3('0x7')](_0x5a2f76+':'+_0x36e533['id'],_0x36e533);OpenchannelQueueEvents['emit'](_0x5a2f76,_0x36e533);_0x4e5c93(null);};}for(var e in events){if(events[_0xbec3('0x8')](e)){var event=events[e];OpenchannelQueue[_0xbec3('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x5b16=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','save'];(function(_0x2ee5db,_0x3cccdd){var _0x262b39=function(_0x32fb0d){while(--_0x32fb0d){_0x2ee5db['push'](_0x2ee5db['shift']());}};_0x262b39(++_0x3cccdd);}(_0x5b16,0xd7));var _0x65b1=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x5b16[_0x58afd5];return _0x3e503b;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x65b1('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x65b1('0x1'),'afterUpdate':_0x65b1('0x2'),'afterDestroy':_0x65b1('0x3')};function emitEvent(_0x19d229){return function(_0x4d9c06,_0x593a5e,_0x3566d9){OpenchannelQueueEvents[_0x65b1('0x4')](_0x19d229+':'+_0x4d9c06['id'],_0x4d9c06);OpenchannelQueueEvents[_0x65b1('0x4')](_0x19d229,_0x4d9c06);_0x3566d9(null);};}for(var e in events){if(events[_0x65b1('0x5')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x65b1('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index ac01bcc..8a6bbbe 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 _0x5632=['exports','define','openchannel_queues','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./openchannelQueue.attributes'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x5632,0xbe));var _0x2563=function(_0x30d545,_0x1d0fec){_0x30d545=_0x30d545-0x0;var _0x310d50=_0x5632[_0x30d545];return _0x310d50;};'use strict';var _=require(_0x2563('0x0'));var util=require(_0x2563('0x1'));var logger=require(_0x2563('0x2'))(_0x2563('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2563('0x4'));var fs=require('fs');var path=require(_0x2563('0x5'));var rimraf=require('rimraf');var config=require(_0x2563('0x6'));var attributes=require(_0x2563('0x7'));module[_0x2563('0x8')]=function(_0x2c61f0,_0x36041e){return _0x2c61f0[_0x2563('0x9')]('OpenchannelQueue',attributes,{'tableName':_0x2563('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb95=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','define','lodash','util'];(function(_0x28ddff,_0x3b1162){var _0x32bea0=function(_0x59ee23){while(--_0x59ee23){_0x28ddff['push'](_0x28ddff['shift']());}};_0x32bea0(++_0x3b1162);}(_0xfb95,0xb9));var _0x5fb9=function(_0x163ed0,_0x19d4af){_0x163ed0=_0x163ed0-0x0;var _0x2475bf=_0xfb95[_0x163ed0];return _0x2475bf;};'use strict';var _=require(_0x5fb9('0x0'));var util=require(_0x5fb9('0x1'));var logger=require(_0x5fb9('0x2'))(_0x5fb9('0x3'));var moment=require('moment');var BPromise=require(_0x5fb9('0x4'));var rp=require(_0x5fb9('0x5'));var fs=require('fs');var path=require(_0x5fb9('0x6'));var rimraf=require(_0x5fb9('0x7'));var config=require(_0x5fb9('0x8'));var attributes=require(_0x5fb9('0x9'));module['exports']=function(_0x86933c,_0x13933f){return _0x86933c[_0x5fb9('0xa')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index e84fc6c..d5764fe 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 _0x5cb3=['error','code','OpenchannelQueue,\x20%s,\x20%s','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','info','debug','stringify','ShowOpenchannelQueue','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x47d493,_0x3bedfb){var _0x50242a=function(_0x473bd6){while(--_0x473bd6){_0x47d493['push'](_0x47d493['shift']());}};_0x50242a(++_0x3bedfb);}(_0x5cb3,0x1e9));var _0x35cb=function(_0x5e3230,_0x4a7427){_0x5e3230=_0x5e3230-0x0;var _0x1b78ef=_0x5cb3[_0x5e3230];return _0x1b78ef;};'use strict';var _=require('lodash');var util=require(_0x35cb('0x0'));var moment=require(_0x35cb('0x1'));var BPromise=require(_0x35cb('0x2'));var rs=require(_0x35cb('0x3'));var fs=require('fs');var Redis=require(_0x35cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x35cb('0x5'));var logger=require('../../config/logger')(_0x35cb('0x6'));var config=require(_0x35cb('0x7'));var jayson=require(_0x35cb('0x8'));var client=jayson['client'][_0x35cb('0x9')]({'port':0x232a});config[_0x35cb('0xa')]=_[_0x35cb('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x35cb('0xc'))(new Redis(config[_0x35cb('0xa')]));require(_0x35cb('0xd'))[_0x35cb('0xe')](socket);function respondWithRpcPromise(_0x36dcb,_0x5ac885,_0x1374f8){return new BPromise(function(_0x43ebcf,_0xdd230){return client[_0x35cb('0xf')](_0x36dcb,_0x1374f8)['then'](function(_0x3a5ff6){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x5ac885,_0x35cb('0x10'));logger['debug'](_0x35cb('0x11'),_0x5ac885,'request\x20sent',JSON['stringify'](_0x3a5ff6));if(_0x3a5ff6[_0x35cb('0x12')]){if(_0x3a5ff6[_0x35cb('0x12')][_0x35cb('0x13')]===0x1f4){logger[_0x35cb('0x12')](_0x35cb('0x14'),_0x5ac885,_0x3a5ff6['error'][_0x35cb('0x15')]);return _0xdd230(_0x3a5ff6['error']['message']);}logger[_0x35cb('0x12')](_0x35cb('0x14'),_0x5ac885,_0x3a5ff6[_0x35cb('0x12')][_0x35cb('0x15')]);return _0x43ebcf(_0x3a5ff6[_0x35cb('0x12')][_0x35cb('0x15')]);}else{logger['info'](_0x35cb('0x14'),_0x5ac885,_0x35cb('0x10'));_0x43ebcf(_0x3a5ff6['result']['message']);}})[_0x35cb('0x16')](function(_0x5c7f72){logger[_0x35cb('0x12')](_0x35cb('0x14'),_0x5ac885,_0x5c7f72);_0xdd230(_0x5c7f72);});});}exports[_0x35cb('0x17')]=function(_0xb7ce85){var _0x3f709a=this;return new Promise(function(_0x5af4fd,_0x4cb919){return db[_0x35cb('0x18')][_0x35cb('0x19')]({'raw':_0xb7ce85[_0x35cb('0x1a')]?_0xb7ce85[_0x35cb('0x1a')][_0x35cb('0x1b')]===undefined?!![]:![]:!![],'where':_0xb7ce85[_0x35cb('0x1a')]?_0xb7ce85[_0x35cb('0x1a')][_0x35cb('0x1c')]||null:null,'attributes':_0xb7ce85['options']?_0xb7ce85[_0x35cb('0x1a')][_0x35cb('0x1d')]||null:null,'limit':_0xb7ce85[_0x35cb('0x1a')]?_0xb7ce85['options'][_0x35cb('0x1e')]||null:null,'include':_0xb7ce85[_0x35cb('0x1a')]?_0xb7ce85[_0x35cb('0x1a')]['include']?_[_0x35cb('0x1f')](_0xb7ce85[_0x35cb('0x1a')]['include'],function(_0x59558f){return{'model':db[_0x59558f['model']],'as':_0x59558f['as'],'attributes':_0x59558f['attributes'],'include':_0x59558f[_0x35cb('0x20')]?_[_0x35cb('0x1f')](_0x59558f[_0x35cb('0x20')],function(_0x2c3635){return{'model':db[_0x2c3635['model']],'as':_0x2c3635['as'],'attributes':_0x2c3635[_0x35cb('0x1d')],'include':_0x2c3635['include']?_[_0x35cb('0x1f')](_0x2c3635[_0x35cb('0x20')],function(_0x4bb602){return{'model':db[_0x4bb602[_0x35cb('0x21')]],'as':_0x4bb602['as'],'attributes':_0x4bb602[_0x35cb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x35cb('0x22')](function(_0x208c3d){logger[_0x35cb('0x23')](_0x35cb('0x17'),_0xb7ce85);logger[_0x35cb('0x24')]('GetOpenchannelQueue',_0xb7ce85,JSON[_0x35cb('0x25')](_0x208c3d));_0x5af4fd(_0x208c3d);})[_0x35cb('0x16')](function(_0x2cea10){logger['error'](_0x35cb('0x17'),_0x2cea10[_0x35cb('0x15')],_0xb7ce85);_0x4cb919(_0x3f709a[_0x35cb('0x12')](0x1f4,_0x2cea10[_0x35cb('0x15')]));});});};exports[_0x35cb('0x26')]=function(_0x3083da){var _0x46a1ae=this;return new Promise(function(_0x47fe4b,_0x19b07f){return db[_0x35cb('0x18')]['find']({'raw':_0x3083da[_0x35cb('0x1a')]?_0x3083da[_0x35cb('0x1a')][_0x35cb('0x1b')]===undefined?!![]:![]:!![],'where':_0x3083da[_0x35cb('0x1a')]?_0x3083da[_0x35cb('0x1a')][_0x35cb('0x1c')]||null:null,'attributes':_0x3083da['options']?_0x3083da[_0x35cb('0x1a')][_0x35cb('0x1d')]||null:null,'include':_0x3083da[_0x35cb('0x1a')]?_0x3083da[_0x35cb('0x1a')]['include']?_[_0x35cb('0x1f')](_0x3083da[_0x35cb('0x1a')][_0x35cb('0x20')],function(_0x25c0ab){return{'model':db[_0x25c0ab[_0x35cb('0x21')]],'as':_0x25c0ab['as'],'attributes':_0x25c0ab[_0x35cb('0x1d')],'include':_0x25c0ab['include']?_[_0x35cb('0x1f')](_0x25c0ab[_0x35cb('0x20')],function(_0x5f447a){return{'model':db[_0x5f447a[_0x35cb('0x21')]],'as':_0x5f447a['as'],'attributes':_0x5f447a[_0x35cb('0x1d')],'include':_0x5f447a[_0x35cb('0x20')]?_[_0x35cb('0x1f')](_0x5f447a['include'],function(_0x231cf3){return{'model':db[_0x231cf3[_0x35cb('0x21')]],'as':_0x231cf3['as'],'attributes':_0x231cf3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x57d47b){logger[_0x35cb('0x23')]('ShowOpenchannelQueue',_0x3083da);logger[_0x35cb('0x24')](_0x35cb('0x26'),_0x3083da,JSON['stringify'](_0x57d47b));_0x47fe4b(_0x57d47b);})['catch'](function(_0x5af586){logger[_0x35cb('0x12')](_0x35cb('0x26'),_0x5af586[_0x35cb('0x15')],_0x3083da);_0x19b07f(_0x46a1ae['error'](0x1f4,_0x5af586[_0x35cb('0x15')]));});});}; \ No newline at end of file +var _0x9758=['stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','catch','GetOpenchannelQueue','options','raw','attributes','limit','include','model','map','debug','ShowOpenchannelQueue','OpenchannelQueue','find','where','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','then','info','OpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2f3443,_0x1e9913){var _0x287be1=function(_0x12d59a){while(--_0x12d59a){_0x2f3443['push'](_0x2f3443['shift']());}};_0x287be1(++_0x1e9913);}(_0x9758,0xe6));var _0x8975=function(_0x411186,_0x1478ef){_0x411186=_0x411186-0x0;var _0x22cca5=_0x9758[_0x411186];return _0x22cca5;};'use strict';var _=require('lodash');var util=require(_0x8975('0x0'));var moment=require(_0x8975('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8975('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8975('0x3'));var logger=require(_0x8975('0x4'))(_0x8975('0x5'));var config=require(_0x8975('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8975('0x7')]['http']({'port':0x232a});config['redis']=_[_0x8975('0x8')](config[_0x8975('0x9')],{'host':_0x8975('0xa'),'port':0x18eb});var socket=require(_0x8975('0xb'))(new Redis(config[_0x8975('0x9')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2b0b29,_0x37fb12,_0x193457){return new BPromise(function(_0x59e262,_0x414983){return client['request'](_0x2b0b29,_0x193457)[_0x8975('0xc')](function(_0x1d5355){logger[_0x8975('0xd')]('OpenchannelQueue,\x20%s,\x20%s',_0x37fb12,'request\x20sent');logger['debug'](_0x8975('0xe'),_0x37fb12,'request\x20sent',JSON[_0x8975('0xf')](_0x1d5355));if(_0x1d5355[_0x8975('0x10')]){if(_0x1d5355[_0x8975('0x10')][_0x8975('0x11')]===0x1f4){logger[_0x8975('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x37fb12,_0x1d5355[_0x8975('0x10')]['message']);return _0x414983(_0x1d5355[_0x8975('0x10')][_0x8975('0x12')]);}logger[_0x8975('0x10')](_0x8975('0x13'),_0x37fb12,_0x1d5355[_0x8975('0x10')][_0x8975('0x12')]);return _0x59e262(_0x1d5355['error']['message']);}else{logger[_0x8975('0xd')](_0x8975('0x13'),_0x37fb12,'request\x20sent');_0x59e262(_0x1d5355[_0x8975('0x14')][_0x8975('0x12')]);}})[_0x8975('0x15')](function(_0x445983){logger[_0x8975('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x37fb12,_0x445983);_0x414983(_0x445983);});});}exports[_0x8975('0x16')]=function(_0x282e77){var _0x28eca0=this;return new Promise(function(_0x4410b6,_0x50008e){return db['OpenchannelQueue']['findAll']({'raw':_0x282e77[_0x8975('0x17')]?_0x282e77[_0x8975('0x17')][_0x8975('0x18')]===undefined?!![]:![]:!![],'where':_0x282e77[_0x8975('0x17')]?_0x282e77[_0x8975('0x17')]['where']||null:null,'attributes':_0x282e77[_0x8975('0x17')]?_0x282e77[_0x8975('0x17')][_0x8975('0x19')]||null:null,'limit':_0x282e77[_0x8975('0x17')]?_0x282e77['options'][_0x8975('0x1a')]||null:null,'include':_0x282e77[_0x8975('0x17')]?_0x282e77[_0x8975('0x17')][_0x8975('0x1b')]?_['map'](_0x282e77[_0x8975('0x17')][_0x8975('0x1b')],function(_0xfa113){return{'model':db[_0xfa113[_0x8975('0x1c')]],'as':_0xfa113['as'],'attributes':_0xfa113[_0x8975('0x19')],'include':_0xfa113[_0x8975('0x1b')]?_['map'](_0xfa113[_0x8975('0x1b')],function(_0x705613){return{'model':db[_0x705613[_0x8975('0x1c')]],'as':_0x705613['as'],'attributes':_0x705613[_0x8975('0x19')],'include':_0x705613[_0x8975('0x1b')]?_[_0x8975('0x1d')](_0x705613[_0x8975('0x1b')],function(_0x1352f6){return{'model':db[_0x1352f6['model']],'as':_0x1352f6['as'],'attributes':_0x1352f6[_0x8975('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x279d63){logger['info'](_0x8975('0x16'),_0x282e77);logger[_0x8975('0x1e')]('GetOpenchannelQueue',_0x282e77,JSON[_0x8975('0xf')](_0x279d63));_0x4410b6(_0x279d63);})[_0x8975('0x15')](function(_0x4001fb){logger[_0x8975('0x10')](_0x8975('0x16'),_0x4001fb[_0x8975('0x12')],_0x282e77);_0x50008e(_0x28eca0[_0x8975('0x10')](0x1f4,_0x4001fb[_0x8975('0x12')]));});});};exports[_0x8975('0x1f')]=function(_0x3176b5){var _0x269cc7=this;return new Promise(function(_0x103c43,_0x37ed51){return db[_0x8975('0x20')][_0x8975('0x21')]({'raw':_0x3176b5['options']?_0x3176b5['options'][_0x8975('0x18')]===undefined?!![]:![]:!![],'where':_0x3176b5[_0x8975('0x17')]?_0x3176b5[_0x8975('0x17')][_0x8975('0x22')]||null:null,'attributes':_0x3176b5[_0x8975('0x17')]?_0x3176b5['options'][_0x8975('0x19')]||null:null,'include':_0x3176b5[_0x8975('0x17')]?_0x3176b5['options'][_0x8975('0x1b')]?_[_0x8975('0x1d')](_0x3176b5['options'][_0x8975('0x1b')],function(_0x46bdc9){return{'model':db[_0x46bdc9[_0x8975('0x1c')]],'as':_0x46bdc9['as'],'attributes':_0x46bdc9[_0x8975('0x19')],'include':_0x46bdc9[_0x8975('0x1b')]?_[_0x8975('0x1d')](_0x46bdc9[_0x8975('0x1b')],function(_0x332822){return{'model':db[_0x332822[_0x8975('0x1c')]],'as':_0x332822['as'],'attributes':_0x332822[_0x8975('0x19')],'include':_0x332822['include']?_[_0x8975('0x1d')](_0x332822[_0x8975('0x1b')],function(_0x235b65){return{'model':db[_0x235b65[_0x8975('0x1c')]],'as':_0x235b65['as'],'attributes':_0x235b65[_0x8975('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8975('0xc')](function(_0xc61351){logger[_0x8975('0xd')](_0x8975('0x1f'),_0x3176b5);logger[_0x8975('0x1e')](_0x8975('0x1f'),_0x3176b5,JSON[_0x8975('0xf')](_0xc61351));_0x103c43(_0xc61351);})[_0x8975('0x15')](function(_0x3684e3){logger[_0x8975('0x10')](_0x8975('0x1f'),_0x3684e3[_0x8975('0x12')],_0x3176b5);_0x37ed51(_0x269cc7[_0x8975('0x10')](0x1f4,_0x3684e3['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 298aef6..89af07c 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 _0x5c32=['length','./openchannelQueue.events','save','remove','update','emit','register'];(function(_0x49b39b,_0x561f3b){var _0x5e48c7=function(_0x40f8fa){while(--_0x40f8fa){_0x49b39b['push'](_0x49b39b['shift']());}};_0x5e48c7(++_0x561f3b);}(_0x5c32,0xd3));var _0x25c3=function(_0x522d5,_0x5d7d69){_0x522d5=_0x522d5-0x0;var _0x484beb=_0x5c32[_0x522d5];return _0x484beb;};'use strict';var OpenchannelQueueEvents=require(_0x25c3('0x0'));var events=[_0x25c3('0x1'),_0x25c3('0x2'),_0x25c3('0x3')];function createListener(_0x539715,_0x5935c9){return function(_0x402cc6){_0x5935c9[_0x25c3('0x4')](_0x539715,_0x402cc6);};}function removeListener(_0x25e3c7,_0x115b6b){return function(){OpenchannelQueueEvents['removeListener'](_0x25e3c7,_0x115b6b);};}exports[_0x25c3('0x5')]=function(_0x5dce0c){for(var _0x134aea=0x0,_0x10bfad=events[_0x25c3('0x6')];_0x134aea<_0x10bfad;_0x134aea++){var _0x5c47f=events[_0x134aea];var _0x2ad066=createListener('openchannelQueue:'+_0x5c47f,_0x5dce0c);OpenchannelQueueEvents['on'](_0x5c47f,_0x2ad066);}}; \ No newline at end of file +var _0x4ab1=['./openchannelQueue.events','save','remove','update','removeListener','length','openchannelQueue:'];(function(_0x3330d1,_0x42a9b0){var _0x3b78ef=function(_0x118f89){while(--_0x118f89){_0x3330d1['push'](_0x3330d1['shift']());}};_0x3b78ef(++_0x42a9b0);}(_0x4ab1,0xe0));var _0x14ab=function(_0x326610,_0x5d079a){_0x326610=_0x326610-0x0;var _0x4347b3=_0x4ab1[_0x326610];return _0x4347b3;};'use strict';var OpenchannelQueueEvents=require(_0x14ab('0x0'));var events=[_0x14ab('0x1'),_0x14ab('0x2'),_0x14ab('0x3')];function createListener(_0x5ae96c,_0x2aed25){return function(_0x160f9a){_0x2aed25['emit'](_0x5ae96c,_0x160f9a);};}function removeListener(_0x2cc41b,_0x552646){return function(){OpenchannelQueueEvents[_0x14ab('0x4')](_0x2cc41b,_0x552646);};}exports['register']=function(_0x5e7347){for(var _0x529768=0x0,_0x429de2=events[_0x14ab('0x5')];_0x529768<_0x429de2;_0x529768++){var _0x1e8aef=events[_0x529768];var _0x3c2d85=createListener(_0x14ab('0x6')+_0x1e8aef,_0x5e7347);OpenchannelQueueEvents['on'](_0x1e8aef,_0x3c2d85);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 043be14..4ddaaf0 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 _0x5526=['isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get'];(function(_0x585ed0,_0x1482be){var _0x19cbad=function(_0x37c28c){while(--_0x37c28c){_0x585ed0['push'](_0x585ed0['shift']());}};_0x19cbad(++_0x1482be);}(_0x5526,0x1da));var _0x6552=function(_0x18d9fc,_0x1f5eb3){_0x18d9fc=_0x18d9fc-0x0;var _0x191f05=_0x5526[_0x18d9fc];return _0x191f05;};'use strict';var multer=require(_0x6552('0x0'));var util=require('util');var path=require(_0x6552('0x1'));var timeout=require(_0x6552('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6552('0x3'));var auth=require(_0x6552('0x4'));var interaction=require(_0x6552('0x5'));var config=require(_0x6552('0x6'));var controller=require(_0x6552('0x7'));router[_0x6552('0x8')]('/',auth[_0x6552('0x9')](),controller[_0x6552('0xa')]);router['get'](_0x6552('0xb'),auth['isAuthenticated'](),controller[_0x6552('0xc')]);router['get'](_0x6552('0xd'),auth['isAuthenticated'](),controller[_0x6552('0xe')]);router[_0x6552('0xf')]('/',auth['isAuthenticated'](),controller[_0x6552('0x10')]);router['put'](_0x6552('0xd'),auth[_0x6552('0x9')](),controller[_0x6552('0x11')]);router[_0x6552('0x12')](_0x6552('0xd'),auth['isAuthenticated'](),controller[_0x6552('0x13')]);module[_0x6552('0x14')]=router; \ No newline at end of file +var _0xb493=['get','/describe','/:id','isAuthenticated','show','create','put','delete','destroy','exports','util','express','Router','fs-extra','../../components/interaction/service'];(function(_0x560c1b,_0x2a8f0a){var _0x898ec5=function(_0x4fa212){while(--_0x4fa212){_0x560c1b['push'](_0x560c1b['shift']());}};_0x898ec5(++_0x2a8f0a);}(_0xb493,0x109));var _0x3b49=function(_0x58153c,_0x40dff4){_0x58153c=_0x58153c-0x0;var _0x69e19d=_0xb493[_0x58153c];return _0x69e19d;};'use strict';var multer=require('multer');var util=require(_0x3b49('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3b49('0x1'));var router=express[_0x3b49('0x2')]();var fs_extra=require(_0x3b49('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3b49('0x4'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3b49('0x5')](_0x3b49('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0x3b49('0x5')](_0x3b49('0x7'),auth[_0x3b49('0x8')](),controller[_0x3b49('0x9')]);router['post']('/',auth[_0x3b49('0x8')](),controller[_0x3b49('0xa')]);router[_0x3b49('0xb')](_0x3b49('0x7'),auth[_0x3b49('0x8')](),controller['update']);router[_0x3b49('0xc')]('/:id',auth[_0x3b49('0x8')](),controller[_0x3b49('0xd')]);module[_0x3b49('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index e08024f..316f72d 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 _0x3c34=['STRING','DATE','moment','sequelize','exports'];(function(_0x2532e6,_0xb3d699){var _0x47c812=function(_0x4f89d6){while(--_0x4f89d6){_0x2532e6['push'](_0x2532e6['shift']());}};_0x47c812(++_0xb3d699);}(_0x3c34,0x14c));var _0x43c3=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x3c34[_0x4e9628];return _0x27bc8c;};'use strict';var moment=require(_0x43c3('0x0'));var Sequelize=require(_0x43c3('0x1'));module[_0x43c3('0x2')]={'uniqueid':{'type':Sequelize[_0x43c3('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x43c3('0x3')]},'joinAt':{'type':Sequelize[_0x43c3('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x43c3('0x4')]},'reason':{'type':Sequelize[_0x43c3('0x3')]}}; \ No newline at end of file +var _0x313c=['exports','STRING','DATE','moment'];(function(_0x5e3888,_0x5a8922){var _0x4b922a=function(_0x2e77ee){while(--_0x2e77ee){_0x5e3888['push'](_0x5e3888['shift']());}};_0x4b922a(++_0x5a8922);}(_0x313c,0x1f3));var _0xc313=function(_0x4b7dde,_0x421327){_0x4b7dde=_0x4b7dde-0x0;var _0x80141b=_0x313c[_0x4b7dde];return _0x80141b;};'use strict';var moment=require(_0xc313('0x0'));var Sequelize=require('sequelize');module[_0xc313('0x1')]={'uniqueid':{'type':Sequelize[_0xc313('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc313('0x2')]},'joinAt':{'type':Sequelize[_0xc313('0x3')]},'leaveAt':{'type':Sequelize[_0xc313('0x3')]},'acceptAt':{'type':Sequelize[_0xc313('0x3')]},'exitAt':{'type':Sequelize[_0xc313('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index ce159ee..35df2bb 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 _0xac5d=['describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','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/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','apply','save','update','then','destroy','error','name','send','map','OpenchannelQueueReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','sort','where','filters','pick','merge','VIRTUAL','options','count','include','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body'];(function(_0x2241d0,_0x4138de){var _0x36340c=function(_0x50bfb2){while(--_0x50bfb2){_0x2241d0['push'](_0x2241d0['shift']());}};_0x36340c(++_0x4138de);}(_0xac5d,0x91));var _0xdac5=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0xac5d[_0x55ff79];return _0x579067;};'use strict';var emlformat=require(_0xdac5('0x0'));var rimraf=require(_0xdac5('0x1'));var zipdir=require(_0xdac5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdac5('0x3'));var moment=require(_0xdac5('0x4'));var BPromise=require(_0xdac5('0x5'));var Mustache=require(_0xdac5('0x6'));var util=require(_0xdac5('0x7'));var path=require(_0xdac5('0x8'));var sox=require('sox');var csv=require(_0xdac5('0x9'));var ejs=require(_0xdac5('0xa'));var fs=require('fs');var fs_extra=require(_0xdac5('0xb'));var _=require(_0xdac5('0xc'));var squel=require(_0xdac5('0xd'));var crypto=require(_0xdac5('0xe'));var jsforce=require(_0xdac5('0xf'));var deskjs=require(_0xdac5('0x10'));var toCsv=require(_0xdac5('0x9'));var querystring=require(_0xdac5('0x11'));var Papa=require('papaparse');var Redis=require(_0xdac5('0x12'));var authService=require(_0xdac5('0x13'));var qs=require(_0xdac5('0x14'));var as=require(_0xdac5('0x15'));var hardwareService=require(_0xdac5('0x16'));var logger=require(_0xdac5('0x17'))(_0xdac5('0x18'));var utils=require('../../config/utils');var config=require(_0xdac5('0x19'));var licenseUtil=require(_0xdac5('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182ea3,_0x551ab3){_0x551ab3=_0x551ab3||0xcc;return function(_0x45d0bf){if(_0x45d0bf){return _0x182ea3[_0xdac5('0x1b')](_0x551ab3);}return _0x182ea3[_0xdac5('0x1c')](_0x551ab3)['end']();};}function respondWithResult(_0x1161ed,_0x1a09a0){_0x1a09a0=_0x1a09a0||0xc8;return function(_0x48bc38){if(_0x48bc38){return _0x1161ed[_0xdac5('0x1c')](_0x1a09a0)[_0xdac5('0x1d')](_0x48bc38);}};}function respondWithFilteredResult(_0x4daf7c,_0x1af48e){return function(_0x4f3859){if(_0x4f3859){var _0x3c22da=typeof _0x1af48e[_0xdac5('0x1e')]===_0xdac5('0x1f')&&typeof _0x1af48e[_0xdac5('0x20')]===_0xdac5('0x1f');var _0x5d96a7=_0x4f3859['count'];var _0x592576=_0x3c22da?0x0:_0x1af48e[_0xdac5('0x1e')];var _0x4de468=_0x3c22da?_0x4f3859['count']:_0x1af48e['offset']+_0x1af48e[_0xdac5('0x20')];var _0x41d87d;if(_0x4de468>=_0x5d96a7){_0x4de468=_0x5d96a7;_0x41d87d=0xc8;}else{_0x41d87d=0xce;}_0x4daf7c[_0xdac5('0x1c')](_0x41d87d);return _0x4daf7c['set']('Content-Range',_0x592576+'-'+_0x4de468+'/'+_0x5d96a7)[_0xdac5('0x1d')](_0x4f3859);}return null;};}function patchUpdates(_0x3d0cc4){return function(_0x5ced69){try{jsonpatch[_0xdac5('0x21')](_0x5ced69,_0x3d0cc4,!![]);}catch(_0x5f2d1a){return BPromise['reject'](_0x5f2d1a);}return _0x5ced69[_0xdac5('0x22')]();};}function saveUpdates(_0x3514ea,_0x23e33d){return function(_0x48f570){if(_0x48f570){return _0x48f570[_0xdac5('0x23')](_0x3514ea)[_0xdac5('0x24')](function(_0x292231){return _0x292231;});}return null;};}function removeEntity(_0x1c8254,_0x5506c3){return function(_0x32f6ee){if(_0x32f6ee){return _0x32f6ee[_0xdac5('0x25')]()[_0xdac5('0x24')](function(){_0x1c8254[_0xdac5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dbaea,_0x988d09){return function(_0x9ac54){if(!_0x9ac54){_0x1dbaea[_0xdac5('0x1b')](0x194);}return _0x9ac54;};}function handleError(_0x4de2ae,_0x366be1){_0x366be1=_0x366be1||0x1f4;return function(_0x339820){logger[_0xdac5('0x26')](_0x339820['stack']);if(_0x339820[_0xdac5('0x27')]){delete _0x339820['name'];}_0x4de2ae['status'](_0x366be1)[_0xdac5('0x28')](_0x339820);};}exports['index']=function(_0x4a7c25,_0x1b606b){var _0x5b5ac8={},_0x370490={},_0xa804aa={'count':0x0,'rows':[]};var _0x4508f7=_[_0xdac5('0x29')](db[_0xdac5('0x2a')]['rawAttributes'],function(_0x8b4c23){return{'name':_0x8b4c23[_0xdac5('0x2b')],'type':_0x8b4c23[_0xdac5('0x2c')][_0xdac5('0x2d')]};});_0x370490[_0xdac5('0x2e')]=_['map'](_0x4508f7,_0xdac5('0x27'));_0x370490[_0xdac5('0x2f')]=_[_0xdac5('0x30')](_0x4a7c25[_0xdac5('0x2f')]);_0x370490['filters']=_[_0xdac5('0x31')](_0x370490[_0xdac5('0x2e')],_0x370490['query']);_0x5b5ac8[_0xdac5('0x32')]=_[_0xdac5('0x31')](_0x370490[_0xdac5('0x2e')],qs[_0xdac5('0x33')](_0x4a7c25[_0xdac5('0x2f')][_0xdac5('0x33')]));_0x5b5ac8['attributes']=_0x5b5ac8[_0xdac5('0x32')]['length']?_0x5b5ac8['attributes']:_0x370490[_0xdac5('0x2e')];if(!_0x4a7c25[_0xdac5('0x2f')]['hasOwnProperty']('nolimit')){_0x5b5ac8[_0xdac5('0x20')]=qs['limit'](_0x4a7c25[_0xdac5('0x2f')]['limit']);_0x5b5ac8[_0xdac5('0x1e')]=qs[_0xdac5('0x1e')](_0x4a7c25[_0xdac5('0x2f')][_0xdac5('0x1e')]);}_0x5b5ac8['order']=qs[_0xdac5('0x34')](_0x4a7c25[_0xdac5('0x2f')]['sort']);_0x5b5ac8[_0xdac5('0x35')]=qs[_0xdac5('0x36')](_[_0xdac5('0x37')](_0x4a7c25[_0xdac5('0x2f')],_0x370490[_0xdac5('0x36')]),_0x4508f7);if(_0x4a7c25['query']['filter']){_0x5b5ac8[_0xdac5('0x35')]=_[_0xdac5('0x38')](_0x5b5ac8['where'],{'$or':_[_0xdac5('0x29')](_0x4508f7,function(_0xff65a0){if(_0xff65a0[_0xdac5('0x2c')]!==_0xdac5('0x39')){var _0x494823={};_0x494823[_0xff65a0[_0xdac5('0x27')]]={'$like':'%'+_0x4a7c25[_0xdac5('0x2f')]['filter']+'%'};return _0x494823;}})});}_0x5b5ac8=_[_0xdac5('0x38')]({},_0x5b5ac8,_0x4a7c25[_0xdac5('0x3a')]);var _0x33d646={'where':_0x5b5ac8['where']};return db['OpenchannelQueueReport']['count'](_0x33d646)['then'](function(_0x189439){_0xa804aa[_0xdac5('0x3b')]=_0x189439;if(_0x4a7c25[_0xdac5('0x2f')]['includeAll']){_0x5b5ac8[_0xdac5('0x3c')]=[{'all':!![]}];}return db[_0xdac5('0x2a')]['findAll'](_0x5b5ac8);})[_0xdac5('0x24')](function(_0xcbce08){_0xa804aa[_0xdac5('0x3d')]=_0xcbce08;return _0xa804aa;})[_0xdac5('0x24')](respondWithFilteredResult(_0x1b606b,_0x5b5ac8))[_0xdac5('0x3e')](handleError(_0x1b606b,null));};exports[_0xdac5('0x3f')]=function(_0x2f4e60,_0x1b42f){var _0x55fe2e={'raw':!![],'where':{'id':_0x2f4e60[_0xdac5('0x40')]['id']}},_0x5d972e={};_0x5d972e[_0xdac5('0x2e')]=_[_0xdac5('0x30')](db[_0xdac5('0x2a')][_0xdac5('0x41')]);_0x5d972e[_0xdac5('0x2f')]=_[_0xdac5('0x30')](_0x2f4e60['query']);_0x5d972e[_0xdac5('0x36')]=_[_0xdac5('0x31')](_0x5d972e['model'],_0x5d972e['query']);_0x55fe2e[_0xdac5('0x32')]=_[_0xdac5('0x31')](_0x5d972e[_0xdac5('0x2e')],qs['fields'](_0x2f4e60[_0xdac5('0x2f')][_0xdac5('0x33')]));_0x55fe2e[_0xdac5('0x32')]=_0x55fe2e[_0xdac5('0x32')][_0xdac5('0x42')]?_0x55fe2e[_0xdac5('0x32')]:_0x5d972e[_0xdac5('0x2e')];if(_0x2f4e60[_0xdac5('0x2f')][_0xdac5('0x43')]){_0x55fe2e[_0xdac5('0x3c')]=[{'all':!![]}];}_0x55fe2e=_[_0xdac5('0x38')]({},_0x55fe2e,_0x2f4e60[_0xdac5('0x3a')]);return db[_0xdac5('0x2a')][_0xdac5('0x44')](_0x55fe2e)[_0xdac5('0x24')](handleEntityNotFound(_0x1b42f,null))[_0xdac5('0x24')](respondWithResult(_0x1b42f,null))[_0xdac5('0x3e')](handleError(_0x1b42f,null));};exports['create']=function(_0x449fe4,_0x5a788c){return db[_0xdac5('0x2a')][_0xdac5('0x45')](_0x449fe4[_0xdac5('0x46')],{})[_0xdac5('0x24')](respondWithResult(_0x5a788c,0xc9))[_0xdac5('0x3e')](handleError(_0x5a788c,null));};exports[_0xdac5('0x23')]=function(_0x274bf0,_0x340fdb){if(_0x274bf0['body']['id']){delete _0x274bf0[_0xdac5('0x46')]['id'];}return db[_0xdac5('0x2a')][_0xdac5('0x44')]({'where':{'id':_0x274bf0[_0xdac5('0x40')]['id']}})[_0xdac5('0x24')](handleEntityNotFound(_0x340fdb,null))[_0xdac5('0x24')](saveUpdates(_0x274bf0[_0xdac5('0x46')],null))[_0xdac5('0x24')](respondWithResult(_0x340fdb,null))[_0xdac5('0x3e')](handleError(_0x340fdb,null));};exports[_0xdac5('0x25')]=function(_0x1da355,_0x50bb1c){return db[_0xdac5('0x2a')][_0xdac5('0x44')]({'where':{'id':_0x1da355[_0xdac5('0x40')]['id']}})[_0xdac5('0x24')](handleEntityNotFound(_0x50bb1c,null))[_0xdac5('0x24')](removeEntity(_0x50bb1c,null))['catch'](handleError(_0x50bb1c,null));};exports[_0xdac5('0x47')]=function(_0x19361d,_0xff2d97){return db['OpenchannelQueueReport'][_0xdac5('0x47')]()['then'](respondWithResult(_0xff2d97,null))[_0xdac5('0x3e')](handleError(_0xff2d97,null));}; \ No newline at end of file +var _0xc13f=['pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','length','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters'];(function(_0xd6961f,_0x271542){var _0x4c34d3=function(_0x659c58){while(--_0x659c58){_0xd6961f['push'](_0xd6961f['shift']());}};_0x4c34d3(++_0x271542);}(_0xc13f,0x138));var _0xfc13=function(_0x15fda2,_0x505a8a){_0x15fda2=_0x15fda2-0x0;var _0x40cfbf=_0xc13f[_0x15fda2];return _0x40cfbf;};'use strict';var emlformat=require(_0xfc13('0x0'));var rimraf=require(_0xfc13('0x1'));var zipdir=require(_0xfc13('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc13('0x3'));var Mustache=require(_0xfc13('0x4'));var util=require(_0xfc13('0x5'));var path=require(_0xfc13('0x6'));var sox=require(_0xfc13('0x7'));var csv=require(_0xfc13('0x8'));var ejs=require(_0xfc13('0x9'));var fs=require('fs');var fs_extra=require(_0xfc13('0xa'));var _=require(_0xfc13('0xb'));var squel=require(_0xfc13('0xc'));var crypto=require(_0xfc13('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfc13('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfc13('0xf'));var Redis=require(_0xfc13('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfc13('0x11'));var hardwareService=require(_0xfc13('0x12'));var logger=require(_0xfc13('0x13'))(_0xfc13('0x14'));var utils=require('../../config/utils');var config=require(_0xfc13('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfc13('0x16'))['db'];function respondWithStatusCode(_0x48c92b,_0x56ea0e){_0x56ea0e=_0x56ea0e||0xcc;return function(_0x2d2bc4){if(_0x2d2bc4){return _0x48c92b[_0xfc13('0x17')](_0x56ea0e);}return _0x48c92b[_0xfc13('0x18')](_0x56ea0e)[_0xfc13('0x19')]();};}function respondWithResult(_0x2917db,_0x906b2a){_0x906b2a=_0x906b2a||0xc8;return function(_0x307c3a){if(_0x307c3a){return _0x2917db['status'](_0x906b2a)[_0xfc13('0x1a')](_0x307c3a);}};}function respondWithFilteredResult(_0x40fc27,_0x3bf1cf){return function(_0x378017){if(_0x378017){var _0x378aac=typeof _0x3bf1cf[_0xfc13('0x1b')]===_0xfc13('0x1c')&&typeof _0x3bf1cf[_0xfc13('0x1d')]===_0xfc13('0x1c');var _0x47146d=_0x378017['count'];var _0x1b79d8=_0x378aac?0x0:_0x3bf1cf['offset'];var _0x56bfd2=_0x378aac?_0x378017[_0xfc13('0x1e')]:_0x3bf1cf[_0xfc13('0x1b')]+_0x3bf1cf['limit'];var _0x411aac;if(_0x56bfd2>=_0x47146d){_0x56bfd2=_0x47146d;_0x411aac=0xc8;}else{_0x411aac=0xce;}_0x40fc27[_0xfc13('0x18')](_0x411aac);return _0x40fc27[_0xfc13('0x1f')](_0xfc13('0x20'),_0x1b79d8+'-'+_0x56bfd2+'/'+_0x47146d)['json'](_0x378017);}return null;};}function patchUpdates(_0x52aed7){return function(_0x1008bd){try{jsonpatch[_0xfc13('0x21')](_0x1008bd,_0x52aed7,!![]);}catch(_0x5d944d){return BPromise['reject'](_0x5d944d);}return _0x1008bd[_0xfc13('0x22')]();};}function saveUpdates(_0x44c9f1,_0x32c5f2){return function(_0x24273){if(_0x24273){return _0x24273[_0xfc13('0x23')](_0x44c9f1)['then'](function(_0x3baffe){return _0x3baffe;});}return null;};}function removeEntity(_0x59ba39,_0x47a337){return function(_0x5a3615){if(_0x5a3615){return _0x5a3615['destroy']()[_0xfc13('0x24')](function(){_0x59ba39[_0xfc13('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45c528,_0x4fd963){return function(_0x718860){if(!_0x718860){_0x45c528[_0xfc13('0x17')](0x194);}return _0x718860;};}function handleError(_0x1f2586,_0x51c999){_0x51c999=_0x51c999||0x1f4;return function(_0x3af3ee){logger[_0xfc13('0x25')](_0x3af3ee[_0xfc13('0x26')]);if(_0x3af3ee[_0xfc13('0x27')]){delete _0x3af3ee['name'];}_0x1f2586[_0xfc13('0x18')](_0x51c999)[_0xfc13('0x28')](_0x3af3ee);};}exports[_0xfc13('0x29')]=function(_0x1b3ecb,_0x4cee9a){var _0x34b66f={},_0xbbb229={},_0x5ce5bc={'count':0x0,'rows':[]};var _0x9839cc=_[_0xfc13('0x2a')](db[_0xfc13('0x2b')][_0xfc13('0x2c')],function(_0x27e946){return{'name':_0x27e946[_0xfc13('0x2d')],'type':_0x27e946['type'][_0xfc13('0x2e')]};});_0xbbb229[_0xfc13('0x2f')]=_[_0xfc13('0x2a')](_0x9839cc,_0xfc13('0x27'));_0xbbb229['query']=_[_0xfc13('0x30')](_0x1b3ecb[_0xfc13('0x31')]);_0xbbb229['filters']=_[_0xfc13('0x32')](_0xbbb229[_0xfc13('0x2f')],_0xbbb229['query']);_0x34b66f[_0xfc13('0x33')]=_[_0xfc13('0x32')](_0xbbb229[_0xfc13('0x2f')],qs[_0xfc13('0x34')](_0x1b3ecb['query'][_0xfc13('0x34')]));_0x34b66f[_0xfc13('0x33')]=_0x34b66f[_0xfc13('0x33')]['length']?_0x34b66f[_0xfc13('0x33')]:_0xbbb229[_0xfc13('0x2f')];if(!_0x1b3ecb[_0xfc13('0x31')]['hasOwnProperty'](_0xfc13('0x35'))){_0x34b66f[_0xfc13('0x1d')]=qs[_0xfc13('0x1d')](_0x1b3ecb['query'][_0xfc13('0x1d')]);_0x34b66f[_0xfc13('0x1b')]=qs[_0xfc13('0x1b')](_0x1b3ecb[_0xfc13('0x31')][_0xfc13('0x1b')]);}_0x34b66f[_0xfc13('0x36')]=qs[_0xfc13('0x37')](_0x1b3ecb['query'][_0xfc13('0x37')]);_0x34b66f[_0xfc13('0x38')]=qs[_0xfc13('0x39')](_[_0xfc13('0x3a')](_0x1b3ecb[_0xfc13('0x31')],_0xbbb229[_0xfc13('0x39')]),_0x9839cc);if(_0x1b3ecb[_0xfc13('0x31')][_0xfc13('0x3b')]){_0x34b66f[_0xfc13('0x38')]=_[_0xfc13('0x3c')](_0x34b66f['where'],{'$or':_[_0xfc13('0x2a')](_0x9839cc,function(_0x33a044){if(_0x33a044['type']!==_0xfc13('0x3d')){var _0x1f8b6a={};_0x1f8b6a[_0x33a044[_0xfc13('0x27')]]={'$like':'%'+_0x1b3ecb[_0xfc13('0x31')]['filter']+'%'};return _0x1f8b6a;}})});}_0x34b66f=_['merge']({},_0x34b66f,_0x1b3ecb[_0xfc13('0x3e')]);var _0x3beafe={'where':_0x34b66f[_0xfc13('0x38')]};return db[_0xfc13('0x2b')][_0xfc13('0x1e')](_0x3beafe)[_0xfc13('0x24')](function(_0x2b8bdd){_0x5ce5bc[_0xfc13('0x1e')]=_0x2b8bdd;if(_0x1b3ecb[_0xfc13('0x31')][_0xfc13('0x3f')]){_0x34b66f[_0xfc13('0x40')]=[{'all':!![]}];}return db[_0xfc13('0x2b')]['findAll'](_0x34b66f);})[_0xfc13('0x24')](function(_0x979f2a){_0x5ce5bc['rows']=_0x979f2a;return _0x5ce5bc;})[_0xfc13('0x24')](respondWithFilteredResult(_0x4cee9a,_0x34b66f))[_0xfc13('0x41')](handleError(_0x4cee9a,null));};exports[_0xfc13('0x42')]=function(_0xdbb3b3,_0x5df4c9){var _0x5a1467={'raw':!![],'where':{'id':_0xdbb3b3[_0xfc13('0x43')]['id']}},_0x5c8e49={};_0x5c8e49['model']=_[_0xfc13('0x30')](db[_0xfc13('0x2b')][_0xfc13('0x2c')]);_0x5c8e49[_0xfc13('0x31')]=_[_0xfc13('0x30')](_0xdbb3b3[_0xfc13('0x31')]);_0x5c8e49[_0xfc13('0x39')]=_[_0xfc13('0x32')](_0x5c8e49[_0xfc13('0x2f')],_0x5c8e49[_0xfc13('0x31')]);_0x5a1467[_0xfc13('0x33')]=_['intersection'](_0x5c8e49[_0xfc13('0x2f')],qs[_0xfc13('0x34')](_0xdbb3b3[_0xfc13('0x31')]['fields']));_0x5a1467[_0xfc13('0x33')]=_0x5a1467[_0xfc13('0x33')][_0xfc13('0x44')]?_0x5a1467['attributes']:_0x5c8e49['model'];if(_0xdbb3b3[_0xfc13('0x31')][_0xfc13('0x3f')]){_0x5a1467[_0xfc13('0x40')]=[{'all':!![]}];}_0x5a1467=_['merge']({},_0x5a1467,_0xdbb3b3[_0xfc13('0x3e')]);return db[_0xfc13('0x2b')]['find'](_0x5a1467)[_0xfc13('0x24')](handleEntityNotFound(_0x5df4c9,null))[_0xfc13('0x24')](respondWithResult(_0x5df4c9,null))['catch'](handleError(_0x5df4c9,null));};exports[_0xfc13('0x45')]=function(_0x215aed,_0x560915){return db[_0xfc13('0x2b')][_0xfc13('0x45')](_0x215aed[_0xfc13('0x46')],{})[_0xfc13('0x24')](respondWithResult(_0x560915,0xc9))['catch'](handleError(_0x560915,null));};exports[_0xfc13('0x23')]=function(_0xcf9b0,_0x541429){if(_0xcf9b0[_0xfc13('0x46')]['id']){delete _0xcf9b0[_0xfc13('0x46')]['id'];}return db[_0xfc13('0x2b')][_0xfc13('0x47')]({'where':{'id':_0xcf9b0['params']['id']}})[_0xfc13('0x24')](handleEntityNotFound(_0x541429,null))['then'](saveUpdates(_0xcf9b0['body'],null))[_0xfc13('0x24')](respondWithResult(_0x541429,null))[_0xfc13('0x41')](handleError(_0x541429,null));};exports[_0xfc13('0x48')]=function(_0x4d886f,_0x2f510b){return db['OpenchannelQueueReport'][_0xfc13('0x47')]({'where':{'id':_0x4d886f[_0xfc13('0x43')]['id']}})[_0xfc13('0x24')](handleEntityNotFound(_0x2f510b,null))[_0xfc13('0x24')](removeEntity(_0x2f510b,null))['catch'](handleError(_0x2f510b,null));};exports[_0xfc13('0x49')]=function(_0x226e8a,_0x150942){return db[_0xfc13('0x2b')][_0xfc13('0x49')]()[_0xfc13('0x24')](respondWithResult(_0x150942,null))[_0xfc13('0x41')](handleError(_0x150942,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index f1ba209..4b95f3d 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 _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x358b10,_0x15e80e){var _0x257d25=function(_0x190771){while(--_0x190771){_0x358b10['push'](_0x358b10['shift']());}};_0x257d25(++_0x15e80e);}(_0x7a54,0x106));var _0x47a5=function(_0x451468,_0x20eebf){_0x451468=_0x451468-0x0;var _0x3da754=_0x7a54[_0x451468];return _0x3da754;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x422eb4,_0x543cec){var _0x9a6aea=function(_0x58ad59){while(--_0x58ad59){_0x422eb4['push'](_0x422eb4['shift']());}};_0x9a6aea(++_0x543cec);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 54e6718..420ff3e 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 _0x6215=['UpdateOpenchannelQueueReport','update','body','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','stringify'];(function(_0x5d0609,_0x127562){var _0xaa3fd1=function(_0x47f457){while(--_0x47f457){_0x5d0609['push'](_0x5d0609['shift']());}};_0xaa3fd1(++_0x127562);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5621('0x0'));var util=require(_0x5621('0x1'));var moment=require(_0x5621('0x2'));var BPromise=require('bluebird');var rs=require(_0x5621('0x3'));var fs=require('fs');var Redis=require(_0x5621('0x4'));var db=require(_0x5621('0x5'))['db'];var utils=require(_0x5621('0x6'));var logger=require(_0x5621('0x7'))(_0x5621('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x431e77,_0x13ed74,_0x2b7275){return new BPromise(function(_0x253c0b,_0x19427d){return client['request'](_0x431e77,_0x2b7275)[_0x5621('0x9')](function(_0x39b1c0){logger[_0x5621('0xa')](_0x5621('0xb'),_0x13ed74,'request\x20sent');logger[_0x5621('0xc')](_0x5621('0xd'),_0x13ed74,_0x5621('0xe'),JSON['stringify'](_0x39b1c0));if(_0x39b1c0[_0x5621('0xf')]){if(_0x39b1c0[_0x5621('0xf')][_0x5621('0x10')]===0x1f4){logger[_0x5621('0xf')](_0x5621('0xb'),_0x13ed74,_0x39b1c0[_0x5621('0xf')][_0x5621('0x11')]);return _0x19427d(_0x39b1c0[_0x5621('0xf')][_0x5621('0x11')]);}logger[_0x5621('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x13ed74,_0x39b1c0[_0x5621('0xf')][_0x5621('0x11')]);return _0x253c0b(_0x39b1c0[_0x5621('0xf')]['message']);}else{logger[_0x5621('0xa')](_0x5621('0xb'),_0x13ed74,'request\x20sent');_0x253c0b(_0x39b1c0[_0x5621('0x12')][_0x5621('0x11')]);}})[_0x5621('0x13')](function(_0x180926){logger[_0x5621('0xf')](_0x5621('0xb'),_0x13ed74,_0x180926);_0x19427d(_0x180926);});});}exports[_0x5621('0x14')]=function(_0x374f44){var _0x41941b=this;return new Promise(function(_0x2baba3,_0x4b55b0){return db[_0x5621('0x15')][_0x5621('0x16')](_0x374f44['body'],{'raw':_0x374f44[_0x5621('0x17')]?_0x374f44['options'][_0x5621('0x18')]===undefined?!![]:![]:!![]})[_0x5621('0x9')](function(_0x179830){logger[_0x5621('0xa')](_0x5621('0x14'),_0x374f44);logger['debug'](_0x5621('0x14'),_0x374f44,JSON[_0x5621('0x19')](_0x179830));_0x2baba3(_0x179830);})[_0x5621('0x13')](function(_0x3eaa1a){logger['error'](_0x5621('0x14'),_0x3eaa1a[_0x5621('0x11')],_0x374f44);_0x4b55b0(_0x41941b[_0x5621('0xf')](0x1f4,_0x3eaa1a[_0x5621('0x11')]));});});};exports[_0x5621('0x1a')]=function(_0x2af50a){var _0x470db7=this;return new Promise(function(_0x5c8ef5,_0x23ba00){return db['OpenchannelQueueReport'][_0x5621('0x1b')](_0x2af50a[_0x5621('0x1c')],{'raw':_0x2af50a[_0x5621('0x17')]?_0x2af50a[_0x5621('0x17')][_0x5621('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2af50a[_0x5621('0x17')]?_0x2af50a[_0x5621('0x17')]['where']||null:null,'attributes':_0x2af50a[_0x5621('0x17')]?_0x2af50a[_0x5621('0x17')][_0x5621('0x1d')]||null:null,'limit':_0x2af50a[_0x5621('0x17')]?_0x2af50a['options'][_0x5621('0x1e')]||null:null})[_0x5621('0x9')](function(_0x4ad3ac){logger['info'](_0x5621('0x1a'),_0x2af50a);logger[_0x5621('0xc')](_0x5621('0x1a'),_0x2af50a,JSON[_0x5621('0x19')](_0x4ad3ac));_0x5c8ef5(_0x4ad3ac);})[_0x5621('0x13')](function(_0xc1af98){logger[_0x5621('0xf')]('UpdateOpenchannelQueueReport',_0xc1af98[_0x5621('0x11')],_0x2af50a);_0x23ba00(_0x470db7[_0x5621('0xf')](0x1f4,_0xc1af98[_0x5621('0x11')]));});});}; \ No newline at end of file +var _0x5c3c=['../../config/environment','jayson/promise','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','catch','UpdateOpenchannelQueueReport','update','attributes','limit','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x46b3a2,_0x1c6ffd){var _0x574167=function(_0x41c418){while(--_0x41c418){_0x46b3a2['push'](_0x46b3a2['shift']());}};_0x574167(++_0x1c6ffd);}(_0x5c3c,0x132));var _0xc5c3=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x5c3c[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a392b,_0x4b8404,_0x591f7d){return new BPromise(function(_0x723c31,_0x522be1){return client['request'](_0x5a392b,_0x591f7d)[_0xc5c3('0xd')](function(_0x46e2c1){logger['info'](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));logger['debug'](_0xc5c3('0x10'),_0x4b8404,_0xc5c3('0xf'),JSON[_0xc5c3('0x11')](_0x46e2c1));if(_0x46e2c1['error']){if(_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x13')]===0x1f4){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x522be1(_0x46e2c1['error'][_0xc5c3('0x14')]);}logger[_0xc5c3('0x12')](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x723c31(_0x46e2c1['error']['message']);}else{logger[_0xc5c3('0x15')](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));_0x723c31(_0x46e2c1[_0xc5c3('0x16')]['message']);}})['catch'](function(_0x467ba9){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x467ba9);_0x522be1(_0x467ba9);});});}exports[_0xc5c3('0x17')]=function(_0x2ff158){var _0x13c867=this;return new Promise(function(_0x28bae6,_0x5e11d5){return db[_0xc5c3('0x18')][_0xc5c3('0x19')](_0x2ff158[_0xc5c3('0x1a')],{'raw':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158['options'][_0xc5c3('0x1c')]===undefined?!![]:![]:!![]})[_0xc5c3('0xd')](function(_0x3cc612){logger[_0xc5c3('0x15')](_0xc5c3('0x17'),_0x2ff158);logger['debug'](_0xc5c3('0x17'),_0x2ff158,JSON[_0xc5c3('0x11')](_0x3cc612));_0x28bae6(_0x3cc612);})[_0xc5c3('0x1d')](function(_0x2de266){logger[_0xc5c3('0x12')](_0xc5c3('0x17'),_0x2de266[_0xc5c3('0x14')],_0x2ff158);_0x5e11d5(_0x13c867['error'](0x1f4,_0x2de266['message']));});});};exports[_0xc5c3('0x1e')]=function(_0x38dd9e){var _0x53ab72=this;return new Promise(function(_0x5c7329,_0x23e2fb){return db[_0xc5c3('0x18')][_0xc5c3('0x1f')](_0x38dd9e['body'],{'raw':_0x38dd9e['options']?_0x38dd9e[_0xc5c3('0x1b')][_0xc5c3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38dd9e[_0xc5c3('0x1b')]?_0x38dd9e[_0xc5c3('0x1b')]['where']||null:null,'attributes':_0x38dd9e[_0xc5c3('0x1b')]?_0x38dd9e['options'][_0xc5c3('0x20')]||null:null,'limit':_0x38dd9e['options']?_0x38dd9e[_0xc5c3('0x1b')][_0xc5c3('0x21')]||null:null})[_0xc5c3('0xd')](function(_0x4773c5){logger[_0xc5c3('0x15')](_0xc5c3('0x1e'),_0x38dd9e);logger[_0xc5c3('0x22')]('UpdateOpenchannelQueueReport',_0x38dd9e,JSON[_0xc5c3('0x11')](_0x4773c5));_0x5c7329(_0x4773c5);})['catch'](function(_0xc4b134){logger[_0xc5c3('0x12')]('UpdateOpenchannelQueueReport',_0xc4b134['message'],_0x38dd9e);_0x23e2fb(_0x53ab72[_0xc5c3('0x12')](0x1f4,_0xc4b134[_0xc5c3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index f85a518..38dba7e 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 _0xd6ba=['../../components/auth/service','./openchannelTransferReport.controller','get','index','isAuthenticated','/:id','show','post','create','update','delete','exports','util','express','fs-extra'];(function(_0x38b56e,_0x1de6f9){var _0x34a3f1=function(_0x268011){while(--_0x268011){_0x38b56e['push'](_0x38b56e['shift']());}};_0x34a3f1(++_0x1de6f9);}(_0xd6ba,0x192));var _0xad6b=function(_0x125b20,_0x52b250){_0x125b20=_0x125b20-0x0;var _0x20650e=_0xd6ba[_0x125b20];return _0x20650e;};'use strict';var multer=require('multer');var util=require(_0xad6b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xad6b('0x1'));var router=express['Router']();var fs_extra=require(_0xad6b('0x2'));var auth=require(_0xad6b('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xad6b('0x4'));router[_0xad6b('0x5')]('/',auth['isAuthenticated'](),controller[_0xad6b('0x6')]);router['get']('/describe',auth[_0xad6b('0x7')](),controller['describe']);router[_0xad6b('0x5')](_0xad6b('0x8'),auth[_0xad6b('0x7')](),controller[_0xad6b('0x9')]);router[_0xad6b('0xa')]('/',auth[_0xad6b('0x7')](),controller[_0xad6b('0xb')]);router['put'](_0xad6b('0x8'),auth[_0xad6b('0x7')](),controller[_0xad6b('0xc')]);router[_0xad6b('0xd')](_0xad6b('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xad6b('0xe')]=router; \ No newline at end of file +var _0x9e2f=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete'];(function(_0xb2454d,_0x291753){var _0x5464fb=function(_0x386805){while(--_0x386805){_0xb2454d['push'](_0xb2454d['shift']());}};_0x5464fb(++_0x291753);}(_0x9e2f,0x1cf));var _0xf9e2=function(_0x222975,_0xf418d2){_0x222975=_0x222975-0x0;var _0x4de502=_0x9e2f[_0x222975];return _0x4de502;};'use strict';var multer=require(_0xf9e2('0x0'));var util=require(_0xf9e2('0x1'));var path=require(_0xf9e2('0x2'));var timeout=require(_0xf9e2('0x3'));var express=require(_0xf9e2('0x4'));var router=express[_0xf9e2('0x5')]();var fs_extra=require(_0xf9e2('0x6'));var auth=require(_0xf9e2('0x7'));var interaction=require(_0xf9e2('0x8'));var config=require(_0xf9e2('0x9'));var controller=require('./openchannelTransferReport.controller');router[_0xf9e2('0xa')]('/',auth[_0xf9e2('0xb')](),controller[_0xf9e2('0xc')]);router[_0xf9e2('0xa')](_0xf9e2('0xd'),auth[_0xf9e2('0xb')](),controller[_0xf9e2('0xe')]);router[_0xf9e2('0xa')](_0xf9e2('0xf'),auth[_0xf9e2('0xb')](),controller[_0xf9e2('0x10')]);router[_0xf9e2('0x11')]('/',auth[_0xf9e2('0xb')](),controller['create']);router['put'](_0xf9e2('0xf'),auth[_0xf9e2('0xb')](),controller[_0xf9e2('0x12')]);router[_0xf9e2('0x13')](_0xf9e2('0xf'),auth[_0xf9e2('0xb')](),controller['destroy']);module[_0xf9e2('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 29d37d7..aef9286 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x4eafcf,_0x458eb5){var _0x431945=function(_0x2f2777){while(--_0x2f2777){_0x4eafcf['push'](_0x4eafcf['shift']());}};_0x431945(++_0x458eb5);}(_0x34e8,0x12c));var _0x834e=function(_0x40126b,_0x5eefa8){_0x40126b=_0x40126b-0x0;var _0x5dfff8=_0x34e8[_0x40126b];return _0x5dfff8;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x59d68b,_0x21eabc){var _0x411cf3=function(_0x903c7d){while(--_0x903c7d){_0x59d68b['push'](_0x59d68b['shift']());}};_0x411cf3(++_0x21eabc);}(_0xedd9,0xfc));var _0x9edd=function(_0x241596,_0x209dab){_0x241596=_0x241596-0x0;var _0x3e05f5=_0xedd9[_0x241596];return _0x3e05f5;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 9a77751..72fd1f2 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 _0xf1f6=['params','keys','intersection','create','body','find','describe','eml-format','rimraf','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','options','where','OpenchannelTransferReport','includeAll','include','findAll','rows','catch'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0xf1f6,0xa1));var _0x6f1f=function(_0x3f3899,_0xde9370){_0x3f3899=_0x3f3899-0x0;var _0x14fa2f=_0xf1f6[_0x3f3899];return _0x14fa2f;};'use strict';var emlformat=require(_0x6f1f('0x0'));var rimraf=require(_0x6f1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f1f('0x2'));var rp=require('request-promise');var moment=require(_0x6f1f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6f1f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x6f1f('0x5'));var csv=require(_0x6f1f('0x6'));var ejs=require(_0x6f1f('0x7'));var fs=require('fs');var fs_extra=require(_0x6f1f('0x8'));var _=require(_0x6f1f('0x9'));var squel=require(_0x6f1f('0xa'));var crypto=require(_0x6f1f('0xb'));var jsforce=require(_0x6f1f('0xc'));var deskjs=require(_0x6f1f('0xd'));var toCsv=require(_0x6f1f('0x6'));var querystring=require(_0x6f1f('0xe'));var Papa=require('papaparse');var Redis=require(_0x6f1f('0xf'));var authService=require(_0x6f1f('0x10'));var qs=require(_0x6f1f('0x11'));var as=require(_0x6f1f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f1f('0x13'))(_0x6f1f('0x14'));var utils=require(_0x6f1f('0x15'));var config=require(_0x6f1f('0x16'));var licenseUtil=require(_0x6f1f('0x17'));var db=require(_0x6f1f('0x18'))['db'];function respondWithStatusCode(_0x408a8b,_0xf4a8f5){_0xf4a8f5=_0xf4a8f5||0xcc;return function(_0x5a6e19){if(_0x5a6e19){return _0x408a8b['sendStatus'](_0xf4a8f5);}return _0x408a8b['status'](_0xf4a8f5)[_0x6f1f('0x19')]();};}function respondWithResult(_0x4ca80c,_0xa47c6f){_0xa47c6f=_0xa47c6f||0xc8;return function(_0xee7075){if(_0xee7075){return _0x4ca80c[_0x6f1f('0x1a')](_0xa47c6f)[_0x6f1f('0x1b')](_0xee7075);}};}function respondWithFilteredResult(_0x54004a,_0x1dee46){return function(_0x4aa27d){if(_0x4aa27d){var _0xeaa434=typeof _0x1dee46[_0x6f1f('0x1c')]===_0x6f1f('0x1d')&&typeof _0x1dee46[_0x6f1f('0x1e')]==='undefined';var _0x4f8eaf=_0x4aa27d[_0x6f1f('0x1f')];var _0xde109c=_0xeaa434?0x0:_0x1dee46['offset'];var _0x4cd015=_0xeaa434?_0x4aa27d[_0x6f1f('0x1f')]:_0x1dee46[_0x6f1f('0x1c')]+_0x1dee46[_0x6f1f('0x1e')];var _0x29fe4e;if(_0x4cd015>=_0x4f8eaf){_0x4cd015=_0x4f8eaf;_0x29fe4e=0xc8;}else{_0x29fe4e=0xce;}_0x54004a[_0x6f1f('0x1a')](_0x29fe4e);return _0x54004a[_0x6f1f('0x20')](_0x6f1f('0x21'),_0xde109c+'-'+_0x4cd015+'/'+_0x4f8eaf)[_0x6f1f('0x1b')](_0x4aa27d);}return null;};}function patchUpdates(_0x2156bb){return function(_0xee92f2){try{jsonpatch[_0x6f1f('0x22')](_0xee92f2,_0x2156bb,!![]);}catch(_0x313104){return BPromise[_0x6f1f('0x23')](_0x313104);}return _0xee92f2[_0x6f1f('0x24')]();};}function saveUpdates(_0x3964e6,_0x5a1c7a){return function(_0x16e007){if(_0x16e007){return _0x16e007[_0x6f1f('0x25')](_0x3964e6)[_0x6f1f('0x26')](function(_0x680479){return _0x680479;});}return null;};}function removeEntity(_0x570d8e,_0x2909b6){return function(_0xf69df3){if(_0xf69df3){return _0xf69df3[_0x6f1f('0x27')]()[_0x6f1f('0x26')](function(){_0x570d8e[_0x6f1f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17d38e,_0x3cae09){return function(_0x3d65c5){if(!_0x3d65c5){_0x17d38e[_0x6f1f('0x28')](0x194);}return _0x3d65c5;};}function handleError(_0x30b87b,_0x19dc55){_0x19dc55=_0x19dc55||0x1f4;return function(_0x3cff5f){logger[_0x6f1f('0x29')](_0x3cff5f[_0x6f1f('0x2a')]);if(_0x3cff5f[_0x6f1f('0x2b')]){delete _0x3cff5f[_0x6f1f('0x2b')];}_0x30b87b[_0x6f1f('0x1a')](_0x19dc55)['send'](_0x3cff5f);};}exports[_0x6f1f('0x2c')]=function(_0x5904af,_0x5a6473){var _0x420f15={},_0x35cc7a={},_0x4c308e={'count':0x0,'rows':[]};var _0x451975=_[_0x6f1f('0x2d')](db['OpenchannelTransferReport'][_0x6f1f('0x2e')],function(_0x868e4e){return{'name':_0x868e4e[_0x6f1f('0x2f')],'type':_0x868e4e[_0x6f1f('0x30')]['key']};});_0x35cc7a[_0x6f1f('0x31')]=_['map'](_0x451975,_0x6f1f('0x2b'));_0x35cc7a['query']=_['keys'](_0x5904af[_0x6f1f('0x32')]);_0x35cc7a[_0x6f1f('0x33')]=_['intersection'](_0x35cc7a[_0x6f1f('0x31')],_0x35cc7a[_0x6f1f('0x32')]);_0x420f15[_0x6f1f('0x34')]=_['intersection'](_0x35cc7a['model'],qs['fields'](_0x5904af[_0x6f1f('0x32')][_0x6f1f('0x35')]));_0x420f15[_0x6f1f('0x34')]=_0x420f15['attributes'][_0x6f1f('0x36')]?_0x420f15[_0x6f1f('0x34')]:_0x35cc7a[_0x6f1f('0x31')];if(!_0x5904af['query'][_0x6f1f('0x37')](_0x6f1f('0x38'))){_0x420f15[_0x6f1f('0x1e')]=qs['limit'](_0x5904af[_0x6f1f('0x32')]['limit']);_0x420f15[_0x6f1f('0x1c')]=qs[_0x6f1f('0x1c')](_0x5904af['query'][_0x6f1f('0x1c')]);}_0x420f15[_0x6f1f('0x39')]=qs['sort'](_0x5904af[_0x6f1f('0x32')][_0x6f1f('0x3a')]);_0x420f15['where']=qs[_0x6f1f('0x33')](_[_0x6f1f('0x3b')](_0x5904af[_0x6f1f('0x32')],_0x35cc7a[_0x6f1f('0x33')]),_0x451975);if(_0x5904af[_0x6f1f('0x32')][_0x6f1f('0x3c')]){_0x420f15['where']=_[_0x6f1f('0x3d')](_0x420f15['where'],{'$or':_[_0x6f1f('0x2d')](_0x451975,function(_0x42e235){if(_0x42e235[_0x6f1f('0x30')]!=='VIRTUAL'){var _0x2eb860={};_0x2eb860[_0x42e235[_0x6f1f('0x2b')]]={'$like':'%'+_0x5904af[_0x6f1f('0x32')]['filter']+'%'};return _0x2eb860;}})});}_0x420f15=_[_0x6f1f('0x3d')]({},_0x420f15,_0x5904af[_0x6f1f('0x3e')]);var _0x3754f5={'where':_0x420f15[_0x6f1f('0x3f')]};return db[_0x6f1f('0x40')][_0x6f1f('0x1f')](_0x3754f5)[_0x6f1f('0x26')](function(_0x5e3a29){_0x4c308e['count']=_0x5e3a29;if(_0x5904af['query'][_0x6f1f('0x41')]){_0x420f15[_0x6f1f('0x42')]=[{'all':!![]}];}return db[_0x6f1f('0x40')][_0x6f1f('0x43')](_0x420f15);})['then'](function(_0x119707){_0x4c308e[_0x6f1f('0x44')]=_0x119707;return _0x4c308e;})['then'](respondWithFilteredResult(_0x5a6473,_0x420f15))[_0x6f1f('0x45')](handleError(_0x5a6473,null));};exports['show']=function(_0x307c3f,_0x54a010){var _0x43dbc4={'raw':!![],'where':{'id':_0x307c3f[_0x6f1f('0x46')]['id']}},_0x421d28={};_0x421d28[_0x6f1f('0x31')]=_[_0x6f1f('0x47')](db['OpenchannelTransferReport'][_0x6f1f('0x2e')]);_0x421d28[_0x6f1f('0x32')]=_[_0x6f1f('0x47')](_0x307c3f[_0x6f1f('0x32')]);_0x421d28[_0x6f1f('0x33')]=_[_0x6f1f('0x48')](_0x421d28['model'],_0x421d28[_0x6f1f('0x32')]);_0x43dbc4[_0x6f1f('0x34')]=_['intersection'](_0x421d28[_0x6f1f('0x31')],qs[_0x6f1f('0x35')](_0x307c3f[_0x6f1f('0x32')][_0x6f1f('0x35')]));_0x43dbc4['attributes']=_0x43dbc4[_0x6f1f('0x34')]['length']?_0x43dbc4[_0x6f1f('0x34')]:_0x421d28['model'];if(_0x307c3f[_0x6f1f('0x32')][_0x6f1f('0x41')]){_0x43dbc4[_0x6f1f('0x42')]=[{'all':!![]}];}_0x43dbc4=_[_0x6f1f('0x3d')]({},_0x43dbc4,_0x307c3f[_0x6f1f('0x3e')]);return db['OpenchannelTransferReport']['find'](_0x43dbc4)[_0x6f1f('0x26')](handleEntityNotFound(_0x54a010,null))['then'](respondWithResult(_0x54a010,null))[_0x6f1f('0x45')](handleError(_0x54a010,null));};exports[_0x6f1f('0x49')]=function(_0x4ccd65,_0xc2fb4){return db[_0x6f1f('0x40')][_0x6f1f('0x49')](_0x4ccd65[_0x6f1f('0x4a')],{})[_0x6f1f('0x26')](respondWithResult(_0xc2fb4,0xc9))['catch'](handleError(_0xc2fb4,null));};exports[_0x6f1f('0x25')]=function(_0x36c178,_0xf0592c){if(_0x36c178[_0x6f1f('0x4a')]['id']){delete _0x36c178[_0x6f1f('0x4a')]['id'];}return db[_0x6f1f('0x40')]['find']({'where':{'id':_0x36c178[_0x6f1f('0x46')]['id']}})[_0x6f1f('0x26')](handleEntityNotFound(_0xf0592c,null))[_0x6f1f('0x26')](saveUpdates(_0x36c178[_0x6f1f('0x4a')],null))[_0x6f1f('0x26')](respondWithResult(_0xf0592c,null))[_0x6f1f('0x45')](handleError(_0xf0592c,null));};exports['destroy']=function(_0x556be7,_0x57133c){return db[_0x6f1f('0x40')][_0x6f1f('0x4b')]({'where':{'id':_0x556be7[_0x6f1f('0x46')]['id']}})[_0x6f1f('0x26')](handleEntityNotFound(_0x57133c,null))[_0x6f1f('0x26')](removeEntity(_0x57133c,null))[_0x6f1f('0x45')](handleError(_0x57133c,null));};exports['describe']=function(_0x56187b,_0x1ca2ae){return db[_0x6f1f('0x40')][_0x6f1f('0x4c')]()['then'](respondWithResult(_0x1ca2ae,null))[_0x6f1f('0x45')](handleError(_0x1ca2ae,null));}; \ No newline at end of file +var _0xfc9a=['type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','findAll','catch','show','params','includeAll','options','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','limit','count','status','set','apply','reject','save','update','then','error','name','OpenchannelTransferReport','rawAttributes','fieldName'];(function(_0x5193fb,_0x3f3140){var _0x28bed0=function(_0x37bee1){while(--_0x37bee1){_0x5193fb['push'](_0x5193fb['shift']());}};_0x28bed0(++_0x3f3140);}(_0xfc9a,0x147));var _0xafc9=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xfc9a[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xafc9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xafc9('0x1'));var jsonpatch=require(_0xafc9('0x2'));var rp=require(_0xafc9('0x3'));var moment=require('moment');var BPromise=require(_0xafc9('0x4'));var Mustache=require(_0xafc9('0x5'));var util=require(_0xafc9('0x6'));var path=require(_0xafc9('0x7'));var sox=require(_0xafc9('0x8'));var csv=require('to-csv');var ejs=require(_0xafc9('0x9'));var fs=require('fs');var fs_extra=require(_0xafc9('0xa'));var _=require(_0xafc9('0xb'));var squel=require(_0xafc9('0xc'));var crypto=require('crypto');var jsforce=require(_0xafc9('0xd'));var deskjs=require(_0xafc9('0xe'));var toCsv=require(_0xafc9('0xf'));var querystring=require('querystring');var Papa=require(_0xafc9('0x10'));var Redis=require(_0xafc9('0x11'));var authService=require(_0xafc9('0x12'));var qs=require(_0xafc9('0x13'));var as=require(_0xafc9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xafc9('0x15'));var utils=require(_0xafc9('0x16'));var config=require(_0xafc9('0x17'));var licenseUtil=require(_0xafc9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd1e35,_0x5b86ab){_0x5b86ab=_0x5b86ab||0xcc;return function(_0x23a48a){if(_0x23a48a){return _0xd1e35[_0xafc9('0x19')](_0x5b86ab);}return _0xd1e35['status'](_0x5b86ab)[_0xafc9('0x1a')]();};}function respondWithResult(_0x9bdc8a,_0x1d7f8a){_0x1d7f8a=_0x1d7f8a||0xc8;return function(_0x562a1f){if(_0x562a1f){return _0x9bdc8a['status'](_0x1d7f8a)[_0xafc9('0x1b')](_0x562a1f);}};}function respondWithFilteredResult(_0x37d209,_0x3e581e){return function(_0x44e0e5){if(_0x44e0e5){var _0x19eff4=typeof _0x3e581e['offset']===_0xafc9('0x1c')&&typeof _0x3e581e[_0xafc9('0x1d')]===_0xafc9('0x1c');var _0x1dac6e=_0x44e0e5[_0xafc9('0x1e')];var _0x58b3d7=_0x19eff4?0x0:_0x3e581e['offset'];var _0x45d01c=_0x19eff4?_0x44e0e5[_0xafc9('0x1e')]:_0x3e581e['offset']+_0x3e581e[_0xafc9('0x1d')];var _0x17ba5d;if(_0x45d01c>=_0x1dac6e){_0x45d01c=_0x1dac6e;_0x17ba5d=0xc8;}else{_0x17ba5d=0xce;}_0x37d209[_0xafc9('0x1f')](_0x17ba5d);return _0x37d209[_0xafc9('0x20')]('Content-Range',_0x58b3d7+'-'+_0x45d01c+'/'+_0x1dac6e)['json'](_0x44e0e5);}return null;};}function patchUpdates(_0xbde185){return function(_0xae0808){try{jsonpatch[_0xafc9('0x21')](_0xae0808,_0xbde185,!![]);}catch(_0x596a87){return BPromise[_0xafc9('0x22')](_0x596a87);}return _0xae0808[_0xafc9('0x23')]();};}function saveUpdates(_0x42a152,_0x2c6e01){return function(_0x31af3d){if(_0x31af3d){return _0x31af3d[_0xafc9('0x24')](_0x42a152)[_0xafc9('0x25')](function(_0x55a4ec){return _0x55a4ec;});}return null;};}function removeEntity(_0x39af68,_0x2adebc){return function(_0x33add3){if(_0x33add3){return _0x33add3['destroy']()[_0xafc9('0x25')](function(){_0x39af68[_0xafc9('0x1f')](0xcc)[_0xafc9('0x1a')]();});}};}function handleEntityNotFound(_0x152f5a,_0x231440){return function(_0x4ad61a){if(!_0x4ad61a){_0x152f5a[_0xafc9('0x19')](0x194);}return _0x4ad61a;};}function handleError(_0x4af5dd,_0x35d71d){_0x35d71d=_0x35d71d||0x1f4;return function(_0x1c28bc){logger[_0xafc9('0x26')](_0x1c28bc['stack']);if(_0x1c28bc[_0xafc9('0x27')]){delete _0x1c28bc[_0xafc9('0x27')];}_0x4af5dd[_0xafc9('0x1f')](_0x35d71d)['send'](_0x1c28bc);};}exports['index']=function(_0x3e1c1f,_0x1c1546){var _0x47b8df={},_0x5895dc={},_0x4db720={'count':0x0,'rows':[]};var _0x15a1a8=_['map'](db[_0xafc9('0x28')][_0xafc9('0x29')],function(_0x37e59d){return{'name':_0x37e59d[_0xafc9('0x2a')],'type':_0x37e59d[_0xafc9('0x2b')][_0xafc9('0x2c')]};});_0x5895dc[_0xafc9('0x2d')]=_[_0xafc9('0x2e')](_0x15a1a8,'name');_0x5895dc[_0xafc9('0x2f')]=_[_0xafc9('0x30')](_0x3e1c1f[_0xafc9('0x2f')]);_0x5895dc[_0xafc9('0x31')]=_['intersection'](_0x5895dc[_0xafc9('0x2d')],_0x5895dc[_0xafc9('0x2f')]);_0x47b8df['attributes']=_[_0xafc9('0x32')](_0x5895dc[_0xafc9('0x2d')],qs[_0xafc9('0x33')](_0x3e1c1f[_0xafc9('0x2f')]['fields']));_0x47b8df[_0xafc9('0x34')]=_0x47b8df[_0xafc9('0x34')][_0xafc9('0x35')]?_0x47b8df[_0xafc9('0x34')]:_0x5895dc[_0xafc9('0x2d')];if(!_0x3e1c1f[_0xafc9('0x2f')][_0xafc9('0x36')]('nolimit')){_0x47b8df[_0xafc9('0x1d')]=qs['limit'](_0x3e1c1f['query'][_0xafc9('0x1d')]);_0x47b8df[_0xafc9('0x37')]=qs[_0xafc9('0x37')](_0x3e1c1f[_0xafc9('0x2f')]['offset']);}_0x47b8df[_0xafc9('0x38')]=qs[_0xafc9('0x39')](_0x3e1c1f[_0xafc9('0x2f')][_0xafc9('0x39')]);_0x47b8df[_0xafc9('0x3a')]=qs[_0xafc9('0x31')](_[_0xafc9('0x3b')](_0x3e1c1f[_0xafc9('0x2f')],_0x5895dc[_0xafc9('0x31')]),_0x15a1a8);if(_0x3e1c1f[_0xafc9('0x2f')][_0xafc9('0x3c')]){_0x47b8df[_0xafc9('0x3a')]=_[_0xafc9('0x3d')](_0x47b8df[_0xafc9('0x3a')],{'$or':_[_0xafc9('0x2e')](_0x15a1a8,function(_0x2d83fa){if(_0x2d83fa['type']!==_0xafc9('0x3e')){var _0x4c491e={};_0x4c491e[_0x2d83fa[_0xafc9('0x27')]]={'$like':'%'+_0x3e1c1f[_0xafc9('0x2f')][_0xafc9('0x3c')]+'%'};return _0x4c491e;}})});}_0x47b8df=_[_0xafc9('0x3d')]({},_0x47b8df,_0x3e1c1f['options']);var _0x4371e4={'where':_0x47b8df[_0xafc9('0x3a')]};return db[_0xafc9('0x28')][_0xafc9('0x1e')](_0x4371e4)[_0xafc9('0x25')](function(_0x462353){_0x4db720[_0xafc9('0x1e')]=_0x462353;if(_0x3e1c1f[_0xafc9('0x2f')]['includeAll']){_0x47b8df['include']=[{'all':!![]}];}return db[_0xafc9('0x28')][_0xafc9('0x3f')](_0x47b8df);})[_0xafc9('0x25')](function(_0x2ca24d){_0x4db720['rows']=_0x2ca24d;return _0x4db720;})[_0xafc9('0x25')](respondWithFilteredResult(_0x1c1546,_0x47b8df))[_0xafc9('0x40')](handleError(_0x1c1546,null));};exports[_0xafc9('0x41')]=function(_0x21d0eb,_0x3b1f7b){var _0xb16834={'raw':!![],'where':{'id':_0x21d0eb[_0xafc9('0x42')]['id']}},_0xfd963a={};_0xfd963a[_0xafc9('0x2d')]=_[_0xafc9('0x30')](db['OpenchannelTransferReport'][_0xafc9('0x29')]);_0xfd963a[_0xafc9('0x2f')]=_[_0xafc9('0x30')](_0x21d0eb[_0xafc9('0x2f')]);_0xfd963a[_0xafc9('0x31')]=_[_0xafc9('0x32')](_0xfd963a[_0xafc9('0x2d')],_0xfd963a[_0xafc9('0x2f')]);_0xb16834[_0xafc9('0x34')]=_['intersection'](_0xfd963a['model'],qs[_0xafc9('0x33')](_0x21d0eb['query'][_0xafc9('0x33')]));_0xb16834['attributes']=_0xb16834[_0xafc9('0x34')]['length']?_0xb16834[_0xafc9('0x34')]:_0xfd963a[_0xafc9('0x2d')];if(_0x21d0eb[_0xafc9('0x2f')][_0xafc9('0x43')]){_0xb16834['include']=[{'all':!![]}];}_0xb16834=_[_0xafc9('0x3d')]({},_0xb16834,_0x21d0eb[_0xafc9('0x44')]);return db[_0xafc9('0x28')][_0xafc9('0x45')](_0xb16834)[_0xafc9('0x25')](handleEntityNotFound(_0x3b1f7b,null))['then'](respondWithResult(_0x3b1f7b,null))[_0xafc9('0x40')](handleError(_0x3b1f7b,null));};exports[_0xafc9('0x46')]=function(_0x2633ce,_0x5c3a3d){return db[_0xafc9('0x28')][_0xafc9('0x46')](_0x2633ce[_0xafc9('0x47')],{})[_0xafc9('0x25')](respondWithResult(_0x5c3a3d,0xc9))[_0xafc9('0x40')](handleError(_0x5c3a3d,null));};exports['update']=function(_0x253bc7,_0x21db88){if(_0x253bc7['body']['id']){delete _0x253bc7[_0xafc9('0x47')]['id'];}return db[_0xafc9('0x28')][_0xafc9('0x45')]({'where':{'id':_0x253bc7['params']['id']}})[_0xafc9('0x25')](handleEntityNotFound(_0x21db88,null))[_0xafc9('0x25')](saveUpdates(_0x253bc7[_0xafc9('0x47')],null))[_0xafc9('0x25')](respondWithResult(_0x21db88,null))['catch'](handleError(_0x21db88,null));};exports[_0xafc9('0x48')]=function(_0x51d967,_0x59ca66){return db[_0xafc9('0x28')][_0xafc9('0x45')]({'where':{'id':_0x51d967[_0xafc9('0x42')]['id']}})[_0xafc9('0x25')](handleEntityNotFound(_0x59ca66,null))['then'](removeEntity(_0x59ca66,null))[_0xafc9('0x40')](handleError(_0x59ca66,null));};exports[_0xafc9('0x49')]=function(_0x5605c0,_0x4460d3){return db['OpenchannelTransferReport']['describe']()[_0xafc9('0x25')](respondWithResult(_0x4460d3,null))['catch'](handleError(_0x4460d3,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index fab90ae..fcc1fce 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 _0x26a8=['./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','lodash','../../config/logger','api','moment'];(function(_0x31cc0e,_0x24ba4c){var _0x144862=function(_0x4d236e){while(--_0x4d236e){_0x31cc0e['push'](_0x31cc0e['shift']());}};_0x144862(++_0x24ba4c);}(_0x26a8,0x1e4));var _0x826a=function(_0x2a0f8a,_0x182843){_0x2a0f8a=_0x2a0f8a-0x0;var _0x2ddf5f=_0x26a8[_0x2a0f8a];return _0x2ddf5f;};'use strict';var _=require(_0x826a('0x0'));var util=require('util');var logger=require(_0x826a('0x1'))(_0x826a('0x2'));var moment=require(_0x826a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x826a('0x4'));module[_0x826a('0x5')]=function(_0x2d5507,_0xa1c07a){return _0x2d5507['define'](_0x826a('0x6'),attributes,{'tableName':_0x826a('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb117=['moment','bluebird','request-promise','./openchannelTransferReport.attributes','exports','define','uniqueid','lodash','util','api'];(function(_0x42d788,_0x4e0f9d){var _0x4cfbc2=function(_0x55ce94){while(--_0x55ce94){_0x42d788['push'](_0x42d788['shift']());}};_0x4cfbc2(++_0x4e0f9d);}(_0xb117,0x18d));var _0x7b11=function(_0x3c8855,_0x132a95){_0x3c8855=_0x3c8855-0x0;var _0x4c7a36=_0xb117[_0x3c8855];return _0x4c7a36;};'use strict';var _=require(_0x7b11('0x0'));var util=require(_0x7b11('0x1'));var logger=require('../../config/logger')(_0x7b11('0x2'));var moment=require(_0x7b11('0x3'));var BPromise=require(_0x7b11('0x4'));var rp=require(_0x7b11('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7b11('0x6'));module[_0x7b11('0x7')]=function(_0x1b6915,_0x517fbc){return _0x1b6915[_0x7b11('0x8')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x7b11('0x9'),'fields':[_0x7b11('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 44b0ad1..16c5e7a 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 _0x448a=['../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x5b039b,_0x162e87){var _0x409502=function(_0x1e7e16){while(--_0x1e7e16){_0x5b039b['push'](_0x5b039b['shift']());}};_0x409502(++_0x162e87);}(_0x448a,0x1ef));var _0xa448=function(_0x34fba6,_0xc0058c){_0x34fba6=_0x34fba6-0x0;var _0x23440c=_0x448a[_0x34fba6];return _0x23440c;};'use strict';var _=require('lodash');var util=require(_0xa448('0x0'));var moment=require(_0xa448('0x1'));var BPromise=require('bluebird');var rs=require(_0xa448('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa448('0x3'));var logger=require(_0xa448('0x4'))('rpc');var config=require(_0xa448('0x5'));var jayson=require(_0xa448('0x6'));var client=jayson[_0xa448('0x7')][_0xa448('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12b0e2,_0x1f4749,_0x1ec2d8){return new BPromise(function(_0x54bdb0,_0x5df2c1){return client[_0xa448('0x9')](_0x12b0e2,_0x1ec2d8)[_0xa448('0xa')](function(_0x40006c){logger[_0xa448('0xb')](_0xa448('0xc'),_0x1f4749,_0xa448('0xd'));logger[_0xa448('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x1f4749,'request\x20sent',JSON[_0xa448('0xf')](_0x40006c));if(_0x40006c[_0xa448('0x10')]){if(_0x40006c['error'][_0xa448('0x11')]===0x1f4){logger[_0xa448('0x10')](_0xa448('0xc'),_0x1f4749,_0x40006c[_0xa448('0x10')][_0xa448('0x12')]);return _0x5df2c1(_0x40006c[_0xa448('0x10')][_0xa448('0x12')]);}logger[_0xa448('0x10')](_0xa448('0xc'),_0x1f4749,_0x40006c['error']['message']);return _0x54bdb0(_0x40006c[_0xa448('0x10')][_0xa448('0x12')]);}else{logger[_0xa448('0xb')](_0xa448('0xc'),_0x1f4749,_0xa448('0xd'));_0x54bdb0(_0x40006c[_0xa448('0x13')]['message']);}})['catch'](function(_0x5b8899){logger['error'](_0xa448('0xc'),_0x1f4749,_0x5b8899);_0x5df2c1(_0x5b8899);});});} \ No newline at end of file +var _0x3c94=['error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5b6f11,_0x40cdc7){var _0x2b13de=function(_0x2e687c){while(--_0x2e687c){_0x5b6f11['push'](_0x5b6f11['shift']());}};_0x2b13de(++_0x40cdc7);}(_0x3c94,0xcd));var _0x43c9=function(_0x503d48,_0x42e5a9){_0x503d48=_0x503d48-0x0;var _0x59743e=_0x3c94[_0x503d48];return _0x59743e;};'use strict';var _=require(_0x43c9('0x0'));var util=require(_0x43c9('0x1'));var moment=require(_0x43c9('0x2'));var BPromise=require(_0x43c9('0x3'));var rs=require(_0x43c9('0x4'));var fs=require('fs');var Redis=require(_0x43c9('0x5'));var db=require(_0x43c9('0x6'))['db'];var utils=require(_0x43c9('0x7'));var logger=require(_0x43c9('0x8'))(_0x43c9('0x9'));var config=require(_0x43c9('0xa'));var jayson=require(_0x43c9('0xb'));var client=jayson['client'][_0x43c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf03007,_0x695b4f,_0x37c029){return new BPromise(function(_0x383adb,_0x7a0f6b){return client[_0x43c9('0xd')](_0xf03007,_0x37c029)[_0x43c9('0xe')](function(_0x45f3a1){logger['info'](_0x43c9('0xf'),_0x695b4f,_0x43c9('0x10'));logger[_0x43c9('0x11')](_0x43c9('0x12'),_0x695b4f,_0x43c9('0x10'),JSON[_0x43c9('0x13')](_0x45f3a1));if(_0x45f3a1[_0x43c9('0x14')]){if(_0x45f3a1[_0x43c9('0x14')][_0x43c9('0x15')]===0x1f4){logger[_0x43c9('0x14')](_0x43c9('0xf'),_0x695b4f,_0x45f3a1[_0x43c9('0x14')][_0x43c9('0x16')]);return _0x7a0f6b(_0x45f3a1[_0x43c9('0x14')][_0x43c9('0x16')]);}logger[_0x43c9('0x14')](_0x43c9('0xf'),_0x695b4f,_0x45f3a1['error'][_0x43c9('0x16')]);return _0x383adb(_0x45f3a1[_0x43c9('0x14')][_0x43c9('0x16')]);}else{logger[_0x43c9('0x17')](_0x43c9('0xf'),_0x695b4f,'request\x20sent');_0x383adb(_0x45f3a1['result'][_0x43c9('0x16')]);}})[_0x43c9('0x18')](function(_0x15035a){logger[_0x43c9('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x695b4f,_0x15035a);_0x7a0f6b(_0x15035a);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 1534c80..e71810c 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 _0x783d=['/:id','show','post','put','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated'];(function(_0x1b1b3c,_0x40ff5b){var _0x3aa641=function(_0x16b0de){while(--_0x16b0de){_0x1b1b3c['push'](_0x1b1b3c['shift']());}};_0x3aa641(++_0x40ff5b);}(_0x783d,0x86));var _0xd783=function(_0x30390a,_0x2970b8){_0x30390a=_0x30390a-0x0;var _0x4dc574=_0x783d[_0x30390a];return _0x4dc574;};'use strict';var multer=require(_0xd783('0x0'));var util=require('util');var path=require(_0xd783('0x1'));var timeout=require(_0xd783('0x2'));var express=require(_0xd783('0x3'));var router=express[_0xd783('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd783('0x5'));var interaction=require(_0xd783('0x6'));var config=require('../../config/environment');var controller=require(_0xd783('0x7'));router[_0xd783('0x8')]('/',auth[_0xd783('0x9')](),controller['index']);router[_0xd783('0x8')](_0xd783('0xa'),auth['isAuthenticated'](),controller[_0xd783('0xb')]);router[_0xd783('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd783('0xd')]('/:id',auth[_0xd783('0x9')](),controller[_0xd783('0xe')]);router['delete'](_0xd783('0xa'),auth['isAuthenticated'](),controller[_0xd783('0xf')]);module['exports']=router; \ No newline at end of file +var _0x48f9=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','index','get','/:id','isAuthenticated','post','create','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x4cf531,_0x3e7912){var _0x419191=function(_0x3377da){while(--_0x3377da){_0x4cf531['push'](_0x4cf531['shift']());}};_0x419191(++_0x3e7912);}(_0x48f9,0x81));var _0x948f=function(_0x321c9d,_0x766391){_0x321c9d=_0x321c9d-0x0;var _0x52004e=_0x48f9[_0x321c9d];return _0x52004e;};'use strict';var multer=require(_0x948f('0x0'));var util=require(_0x948f('0x1'));var path=require(_0x948f('0x2'));var timeout=require(_0x948f('0x3'));var express=require(_0x948f('0x4'));var router=express['Router']();var fs_extra=require(_0x948f('0x5'));var auth=require(_0x948f('0x6'));var interaction=require(_0x948f('0x7'));var config=require(_0x948f('0x8'));var controller=require(_0x948f('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x948f('0xa')]);router[_0x948f('0xb')](_0x948f('0xc'),auth[_0x948f('0xd')](),controller['show']);router[_0x948f('0xe')]('/',auth['isAuthenticated'](),controller[_0x948f('0xf')]);router[_0x948f('0x10')](_0x948f('0xc'),auth[_0x948f('0xd')](),controller[_0x948f('0x11')]);router['delete'](_0x948f('0xc'),auth[_0x948f('0xd')](),controller[_0x948f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 882eabc..37b4866 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 _0xa588=['sequelize','exports','STRING'];(function(_0x22d72b,_0x112e6d){var _0x35f65f=function(_0x23d67f){while(--_0x23d67f){_0x22d72b['push'](_0x22d72b['shift']());}};_0x35f65f(++_0x112e6d);}(_0xa588,0xd8));var _0x8a58=function(_0x5e163f,_0x5343c8){_0x5e163f=_0x5e163f-0x0;var _0x282a35=_0xa588[_0x5e163f];return _0x282a35;};'use strict';var Sequelize=require(_0x8a58('0x0'));module[_0x8a58('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x8a58('0x2')]}}; \ No newline at end of file +var _0xa5a3=['exports','STRING','name','sequelize'];(function(_0x193e59,_0x16408f){var _0x578fb9=function(_0x1cf081){while(--_0x1cf081){_0x193e59['push'](_0x193e59['shift']());}};_0x578fb9(++_0x16408f);}(_0xa5a3,0x14f));var _0x3a5a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa5a3[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x3a5a('0x0'));module[_0x3a5a('0x1')]={'name':{'type':Sequelize[_0x3a5a('0x2')],'unique':_0x3a5a('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3a5a('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index e113b99..e0bc017 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 _0x7285=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','set','Content-Range','apply','update','destroy','get','Pauses','UserProfileResource','then','end','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','catch','show','params','length','includeAll','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x55944d,_0x3195f0){var _0x494a5b=function(_0x314ed3){while(--_0x314ed3){_0x55944d['push'](_0x55944d['shift']());}};_0x494a5b(++_0x3195f0);}(_0x7285,0x13a));var _0x5728=function(_0xda5d0d,_0x2df02a){_0xda5d0d=_0xda5d0d-0x0;var _0x6e80d2=_0x7285[_0xda5d0d];return _0x6e80d2;};'use strict';var emlformat=require(_0x5728('0x0'));var rimraf=require(_0x5728('0x1'));var zipdir=require(_0x5728('0x2'));var jsonpatch=require(_0x5728('0x3'));var rp=require(_0x5728('0x4'));var moment=require(_0x5728('0x5'));var BPromise=require(_0x5728('0x6'));var Mustache=require(_0x5728('0x7'));var util=require(_0x5728('0x8'));var path=require(_0x5728('0x9'));var sox=require(_0x5728('0xa'));var csv=require('to-csv');var ejs=require(_0x5728('0xb'));var fs=require('fs');var fs_extra=require(_0x5728('0xc'));var _=require(_0x5728('0xd'));var squel=require(_0x5728('0xe'));var crypto=require(_0x5728('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5728('0x10'));var querystring=require(_0x5728('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5728('0x12'));var qs=require(_0x5728('0x13'));var as=require(_0x5728('0x14'));var hardwareService=require(_0x5728('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x5728('0x16'));var config=require(_0x5728('0x17'));var licenseUtil=require(_0x5728('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33b0c7,_0x22a3cf){_0x22a3cf=_0x22a3cf||0xcc;return function(_0xbe2eb2){if(_0xbe2eb2){return _0x33b0c7[_0x5728('0x19')](_0x22a3cf);}return _0x33b0c7['status'](_0x22a3cf)['end']();};}function respondWithResult(_0x41ffbe,_0x279a4a){_0x279a4a=_0x279a4a||0xc8;return function(_0x5a864b){if(_0x5a864b){return _0x41ffbe[_0x5728('0x1a')](_0x279a4a)[_0x5728('0x1b')](_0x5a864b);}};}function respondWithFilteredResult(_0x5a844f,_0x89d61a){return function(_0x5c111f){if(_0x5c111f){var _0x178d7f=typeof _0x89d61a['offset']==='undefined'&&typeof _0x89d61a['limit']==='undefined';var _0x51d385=_0x5c111f['count'];var _0x6a5c59=_0x178d7f?0x0:_0x89d61a[_0x5728('0x1c')];var _0x47bdc0=_0x178d7f?_0x5c111f['count']:_0x89d61a[_0x5728('0x1c')]+_0x89d61a[_0x5728('0x1d')];var _0x484542;if(_0x47bdc0>=_0x51d385){_0x47bdc0=_0x51d385;_0x484542=0xc8;}else{_0x484542=0xce;}_0x5a844f['status'](_0x484542);return _0x5a844f[_0x5728('0x1e')](_0x5728('0x1f'),_0x6a5c59+'-'+_0x47bdc0+'/'+_0x51d385)['json'](_0x5c111f);}return null;};}function patchUpdates(_0x1b3710){return function(_0x5a4056){try{jsonpatch[_0x5728('0x20')](_0x5a4056,_0x1b3710,!![]);}catch(_0x44a3dd){return BPromise['reject'](_0x44a3dd);}return _0x5a4056['save']();};}function saveUpdates(_0x3ebf6f,_0x528141){return function(_0x332d1b){if(_0x332d1b){return _0x332d1b[_0x5728('0x21')](_0x3ebf6f)['then'](function(_0x269c87){return _0x269c87;});}return null;};}function removeEntity(_0x1c7349,_0x1be822){return function(_0x4a38f){if(_0x4a38f){return _0x4a38f[_0x5728('0x22')]()['then'](function(){var _0x2aae4d=_0x4a38f[_0x5728('0x23')]({'plain':!![]});var _0x24dc1f=_0x5728('0x24');return db[_0x5728('0x25')][_0x5728('0x22')]({'where':{'type':_0x24dc1f,'resourceId':_0x2aae4d['id']}})[_0x5728('0x26')](function(){return _0x4a38f;});})[_0x5728('0x26')](function(){_0x1c7349[_0x5728('0x1a')](0xcc)[_0x5728('0x27')]();});}};}function handleEntityNotFound(_0x1821fe,_0x11d671){return function(_0x41ec6a){if(!_0x41ec6a){_0x1821fe[_0x5728('0x19')](0x194);}return _0x41ec6a;};}function handleError(_0x2a5eff,_0x2e119d){_0x2e119d=_0x2e119d||0x1f4;return function(_0x584f55){logger[_0x5728('0x28')](_0x584f55[_0x5728('0x29')]);if(_0x584f55[_0x5728('0x2a')]){delete _0x584f55[_0x5728('0x2a')];}_0x2a5eff[_0x5728('0x1a')](_0x2e119d)[_0x5728('0x2b')](_0x584f55);};}exports[_0x5728('0x2c')]=function(_0x3effce,_0x3b67f9){var _0xbf2059={},_0x3379ec={},_0x5797f3={'count':0x0,'rows':[]};var _0x4ac7e1=_[_0x5728('0x2d')](db[_0x5728('0x2e')][_0x5728('0x2f')],function(_0x30cec1){return{'name':_0x30cec1[_0x5728('0x30')],'type':_0x30cec1[_0x5728('0x31')][_0x5728('0x32')]};});_0x3379ec[_0x5728('0x33')]=_[_0x5728('0x2d')](_0x4ac7e1,_0x5728('0x2a'));_0x3379ec[_0x5728('0x34')]=_[_0x5728('0x35')](_0x3effce[_0x5728('0x34')]);_0x3379ec[_0x5728('0x36')]=_[_0x5728('0x37')](_0x3379ec['model'],_0x3379ec[_0x5728('0x34')]);_0xbf2059[_0x5728('0x38')]=_[_0x5728('0x37')](_0x3379ec[_0x5728('0x33')],qs['fields'](_0x3effce['query'][_0x5728('0x39')]));_0xbf2059[_0x5728('0x38')]=_0xbf2059['attributes']['length']?_0xbf2059[_0x5728('0x38')]:_0x3379ec[_0x5728('0x33')];if(!_0x3effce[_0x5728('0x34')][_0x5728('0x3a')](_0x5728('0x3b'))){_0xbf2059[_0x5728('0x1d')]=qs['limit'](_0x3effce[_0x5728('0x34')][_0x5728('0x1d')]);_0xbf2059[_0x5728('0x1c')]=qs[_0x5728('0x1c')](_0x3effce[_0x5728('0x34')][_0x5728('0x1c')]);}_0xbf2059['order']=qs[_0x5728('0x3c')](_0x3effce[_0x5728('0x34')][_0x5728('0x3c')]);_0xbf2059[_0x5728('0x3d')]=qs['filters'](_[_0x5728('0x3e')](_0x3effce['query'],_0x3379ec[_0x5728('0x36')]),_0x4ac7e1);if(_0x3effce[_0x5728('0x34')][_0x5728('0x3f')]){_0xbf2059[_0x5728('0x3d')]=_[_0x5728('0x40')](_0xbf2059[_0x5728('0x3d')],{'$or':_[_0x5728('0x2d')](_0x4ac7e1,function(_0x23bbea){if(_0x23bbea['type']!==_0x5728('0x41')){var _0x1a9024={};_0x1a9024[_0x23bbea[_0x5728('0x2a')]]={'$like':'%'+_0x3effce[_0x5728('0x34')][_0x5728('0x3f')]+'%'};return _0x1a9024;}})});}_0xbf2059=_['merge']({},_0xbf2059,_0x3effce['options']);var _0x13765d={'where':_0xbf2059['where']};return db[_0x5728('0x2e')][_0x5728('0x42')](_0x13765d)[_0x5728('0x26')](function(_0x56cfbb){_0x5797f3[_0x5728('0x42')]=_0x56cfbb;if(_0x3effce[_0x5728('0x34')]['includeAll']){_0xbf2059[_0x5728('0x43')]=[{'all':!![]}];}return db[_0x5728('0x2e')][_0x5728('0x44')](_0xbf2059);})[_0x5728('0x26')](function(_0x433849){_0x5797f3[_0x5728('0x45')]=_0x433849;return _0x5797f3;})[_0x5728('0x26')](respondWithFilteredResult(_0x3b67f9,_0xbf2059))[_0x5728('0x46')](handleError(_0x3b67f9,null));};exports[_0x5728('0x47')]=function(_0x95ca4c,_0x2f5e3a){var _0x598e9a={'raw':!![],'where':{'id':_0x95ca4c[_0x5728('0x48')]['id']}},_0x815ff0={};_0x815ff0[_0x5728('0x33')]=_[_0x5728('0x35')](db[_0x5728('0x2e')][_0x5728('0x2f')]);_0x815ff0[_0x5728('0x34')]=_[_0x5728('0x35')](_0x95ca4c[_0x5728('0x34')]);_0x815ff0['filters']=_['intersection'](_0x815ff0[_0x5728('0x33')],_0x815ff0[_0x5728('0x34')]);_0x598e9a[_0x5728('0x38')]=_[_0x5728('0x37')](_0x815ff0[_0x5728('0x33')],qs[_0x5728('0x39')](_0x95ca4c[_0x5728('0x34')][_0x5728('0x39')]));_0x598e9a['attributes']=_0x598e9a[_0x5728('0x38')][_0x5728('0x49')]?_0x598e9a['attributes']:_0x815ff0[_0x5728('0x33')];if(_0x95ca4c['query'][_0x5728('0x4a')]){_0x598e9a[_0x5728('0x43')]=[{'all':!![]}];}_0x598e9a=_[_0x5728('0x40')]({},_0x598e9a,_0x95ca4c[_0x5728('0x4b')]);return db[_0x5728('0x2e')][_0x5728('0x4c')](_0x598e9a)[_0x5728('0x26')](handleEntityNotFound(_0x2f5e3a,null))[_0x5728('0x26')](respondWithResult(_0x2f5e3a,null))[_0x5728('0x46')](handleError(_0x2f5e3a,null));};exports[_0x5728('0x4d')]=function(_0x1007cc,_0x1a4d6c){return db['Pause'][_0x5728('0x4d')](_0x1007cc[_0x5728('0x4e')],{})[_0x5728('0x26')](function(_0x135749){var _0x5ec6b6=_0x1007cc[_0x5728('0x4f')][_0x5728('0x23')]({'plain':!![]});if(!_0x5ec6b6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ec6b6[_0x5728('0x50')]===_0x5728('0x4f')){var _0x1c4eae=_0x135749[_0x5728('0x23')]({'plain':!![]});var _0x5861b1=_0x5728('0x24');return db[_0x5728('0x51')]['find']({'where':{'name':_0x5861b1,'userProfileId':_0x5ec6b6[_0x5728('0x52')]},'raw':!![]})['then'](function(_0xb49b39){if(_0xb49b39&&_0xb49b39[_0x5728('0x53')]===0x0){return db['UserProfileResource'][_0x5728('0x4d')]({'name':_0x1c4eae[_0x5728('0x2a')],'resourceId':_0x1c4eae['id'],'type':_0xb49b39['name'],'sectionId':_0xb49b39['id']},{})[_0x5728('0x26')](function(){return _0x135749;});}else{return _0x135749;}})['catch'](function(_0x472f99){logger[_0x5728('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x472f99);throw _0x472f99;});}return _0x135749;})['then'](respondWithResult(_0x1a4d6c,0xc9))[_0x5728('0x46')](handleError(_0x1a4d6c,null));};exports[_0x5728('0x21')]=function(_0x3b1514,_0x1d1d16){if(_0x3b1514['body']['id']){delete _0x3b1514['body']['id'];}return db[_0x5728('0x2e')]['find']({'where':{'id':_0x3b1514[_0x5728('0x48')]['id']}})[_0x5728('0x26')](handleEntityNotFound(_0x1d1d16,null))[_0x5728('0x26')](saveUpdates(_0x3b1514['body'],null))[_0x5728('0x26')](respondWithResult(_0x1d1d16,null))['catch'](handleError(_0x1d1d16,null));};exports['destroy']=function(_0x1a0809,_0x3ddd06){return db[_0x5728('0x2e')][_0x5728('0x4c')]({'where':{'id':_0x1a0809[_0x5728('0x48')]['id']}})[_0x5728('0x26')](handleEntityNotFound(_0x3ddd06,null))[_0x5728('0x26')](removeEntity(_0x3ddd06,null))[_0x5728('0x46')](handleError(_0x3ddd06,null));}; \ No newline at end of file +var _0x3d81=['pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','rawAttributes','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','rimraf','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','apply','reject','update','then','destroy','get','end','error','name','send','index','map','Pause','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x41bdb7,_0x2d3c1c){var _0xa1e594=function(_0x4aa014){while(--_0x4aa014){_0x41bdb7['push'](_0x41bdb7['shift']());}};_0xa1e594(++_0x2d3c1c);}(_0x3d81,0x1dd));var _0x13d8=function(_0x40ae6d,_0x4d9242){_0x40ae6d=_0x40ae6d-0x0;var _0x58d456=_0x3d81[_0x40ae6d];return _0x58d456;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x13d8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x13d8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x13d8('0x2'));var util=require(_0x13d8('0x3'));var path=require('path');var sox=require(_0x13d8('0x4'));var csv=require(_0x13d8('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13d8('0x6'));var _=require(_0x13d8('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x13d8('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x13d8('0x5'));var querystring=require(_0x13d8('0x9'));var Papa=require(_0x13d8('0xa'));var Redis=require('ioredis');var authService=require(_0x13d8('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x13d8('0xc'));var hardwareService=require(_0x13d8('0xd'));var logger=require(_0x13d8('0xe'))(_0x13d8('0xf'));var utils=require(_0x13d8('0x10'));var config=require(_0x13d8('0x11'));var licenseUtil=require(_0x13d8('0x12'));var db=require(_0x13d8('0x13'))['db'];function respondWithStatusCode(_0x1bff55,_0x5c46ec){_0x5c46ec=_0x5c46ec||0xcc;return function(_0x4a7bc9){if(_0x4a7bc9){return _0x1bff55['sendStatus'](_0x5c46ec);}return _0x1bff55['status'](_0x5c46ec)['end']();};}function respondWithResult(_0x27cb15,_0x380325){_0x380325=_0x380325||0xc8;return function(_0x11ae2c){if(_0x11ae2c){return _0x27cb15[_0x13d8('0x14')](_0x380325)[_0x13d8('0x15')](_0x11ae2c);}};}function respondWithFilteredResult(_0x30a69c,_0x12c58b){return function(_0x595507){if(_0x595507){var _0x161a14=typeof _0x12c58b[_0x13d8('0x16')]===_0x13d8('0x17')&&typeof _0x12c58b['limit']===_0x13d8('0x17');var _0x336e0e=_0x595507['count'];var _0x29173f=_0x161a14?0x0:_0x12c58b[_0x13d8('0x16')];var _0x1496f0=_0x161a14?_0x595507[_0x13d8('0x18')]:_0x12c58b[_0x13d8('0x16')]+_0x12c58b['limit'];var _0x1a6956;if(_0x1496f0>=_0x336e0e){_0x1496f0=_0x336e0e;_0x1a6956=0xc8;}else{_0x1a6956=0xce;}_0x30a69c[_0x13d8('0x14')](_0x1a6956);return _0x30a69c[_0x13d8('0x19')]('Content-Range',_0x29173f+'-'+_0x1496f0+'/'+_0x336e0e)[_0x13d8('0x15')](_0x595507);}return null;};}function patchUpdates(_0x25dcd0){return function(_0x3f307b){try{jsonpatch[_0x13d8('0x1a')](_0x3f307b,_0x25dcd0,!![]);}catch(_0x1f399d){return BPromise[_0x13d8('0x1b')](_0x1f399d);}return _0x3f307b['save']();};}function saveUpdates(_0x38f5eb,_0xd5773f){return function(_0x47871f){if(_0x47871f){return _0x47871f[_0x13d8('0x1c')](_0x38f5eb)[_0x13d8('0x1d')](function(_0x12a1de){return _0x12a1de;});}return null;};}function removeEntity(_0x3ec3f8,_0xfdae0a){return function(_0x1cbf96){if(_0x1cbf96){return _0x1cbf96[_0x13d8('0x1e')]()[_0x13d8('0x1d')](function(){var _0x37b28b=_0x1cbf96[_0x13d8('0x1f')]({'plain':!![]});var _0x2a35f3='Pauses';return db['UserProfileResource']['destroy']({'where':{'type':_0x2a35f3,'resourceId':_0x37b28b['id']}})[_0x13d8('0x1d')](function(){return _0x1cbf96;});})[_0x13d8('0x1d')](function(){_0x3ec3f8[_0x13d8('0x14')](0xcc)[_0x13d8('0x20')]();});}};}function handleEntityNotFound(_0x465dd6,_0x2c8564){return function(_0x221f89){if(!_0x221f89){_0x465dd6['sendStatus'](0x194);}return _0x221f89;};}function handleError(_0x5edcb5,_0x834092){_0x834092=_0x834092||0x1f4;return function(_0x47baa7){logger[_0x13d8('0x21')](_0x47baa7['stack']);if(_0x47baa7[_0x13d8('0x22')]){delete _0x47baa7['name'];}_0x5edcb5[_0x13d8('0x14')](_0x834092)[_0x13d8('0x23')](_0x47baa7);};}exports[_0x13d8('0x24')]=function(_0x5f3a01,_0x3ef271){var _0x290903={},_0x1ab8ab={},_0x3f6750={'count':0x0,'rows':[]};var _0x45c0dd=_[_0x13d8('0x25')](db[_0x13d8('0x26')]['rawAttributes'],function(_0x114a35){return{'name':_0x114a35[_0x13d8('0x27')],'type':_0x114a35[_0x13d8('0x28')][_0x13d8('0x29')]};});_0x1ab8ab['model']=_[_0x13d8('0x25')](_0x45c0dd,_0x13d8('0x22'));_0x1ab8ab[_0x13d8('0x2a')]=_['keys'](_0x5f3a01['query']);_0x1ab8ab[_0x13d8('0x2b')]=_[_0x13d8('0x2c')](_0x1ab8ab[_0x13d8('0x2d')],_0x1ab8ab['query']);_0x290903[_0x13d8('0x2e')]=_[_0x13d8('0x2c')](_0x1ab8ab[_0x13d8('0x2d')],qs[_0x13d8('0x2f')](_0x5f3a01['query'][_0x13d8('0x2f')]));_0x290903[_0x13d8('0x2e')]=_0x290903[_0x13d8('0x2e')][_0x13d8('0x30')]?_0x290903[_0x13d8('0x2e')]:_0x1ab8ab[_0x13d8('0x2d')];if(!_0x5f3a01[_0x13d8('0x2a')][_0x13d8('0x31')](_0x13d8('0x32'))){_0x290903[_0x13d8('0x33')]=qs[_0x13d8('0x33')](_0x5f3a01['query'][_0x13d8('0x33')]);_0x290903[_0x13d8('0x16')]=qs[_0x13d8('0x16')](_0x5f3a01[_0x13d8('0x2a')]['offset']);}_0x290903[_0x13d8('0x34')]=qs[_0x13d8('0x35')](_0x5f3a01['query']['sort']);_0x290903[_0x13d8('0x36')]=qs['filters'](_[_0x13d8('0x37')](_0x5f3a01[_0x13d8('0x2a')],_0x1ab8ab['filters']),_0x45c0dd);if(_0x5f3a01['query'][_0x13d8('0x38')]){_0x290903[_0x13d8('0x36')]=_[_0x13d8('0x39')](_0x290903[_0x13d8('0x36')],{'$or':_['map'](_0x45c0dd,function(_0x55fb11){if(_0x55fb11[_0x13d8('0x28')]!==_0x13d8('0x3a')){var _0x367503={};_0x367503[_0x55fb11[_0x13d8('0x22')]]={'$like':'%'+_0x5f3a01[_0x13d8('0x2a')][_0x13d8('0x38')]+'%'};return _0x367503;}})});}_0x290903=_[_0x13d8('0x39')]({},_0x290903,_0x5f3a01[_0x13d8('0x3b')]);var _0x23b4dd={'where':_0x290903[_0x13d8('0x36')]};return db[_0x13d8('0x26')][_0x13d8('0x18')](_0x23b4dd)[_0x13d8('0x1d')](function(_0x5cd62f){_0x3f6750[_0x13d8('0x18')]=_0x5cd62f;if(_0x5f3a01['query'][_0x13d8('0x3c')]){_0x290903['include']=[{'all':!![]}];}return db[_0x13d8('0x26')]['findAll'](_0x290903);})[_0x13d8('0x1d')](function(_0x14c6b1){_0x3f6750['rows']=_0x14c6b1;return _0x3f6750;})[_0x13d8('0x1d')](respondWithFilteredResult(_0x3ef271,_0x290903))[_0x13d8('0x3d')](handleError(_0x3ef271,null));};exports[_0x13d8('0x3e')]=function(_0x3cb5c5,_0x459e90){var _0x3eeec8={'raw':!![],'where':{'id':_0x3cb5c5[_0x13d8('0x3f')]['id']}},_0x3b7282={};_0x3b7282[_0x13d8('0x2d')]=_['keys'](db[_0x13d8('0x26')][_0x13d8('0x40')]);_0x3b7282[_0x13d8('0x2a')]=_[_0x13d8('0x41')](_0x3cb5c5[_0x13d8('0x2a')]);_0x3b7282[_0x13d8('0x2b')]=_[_0x13d8('0x2c')](_0x3b7282[_0x13d8('0x2d')],_0x3b7282[_0x13d8('0x2a')]);_0x3eeec8[_0x13d8('0x2e')]=_[_0x13d8('0x2c')](_0x3b7282[_0x13d8('0x2d')],qs[_0x13d8('0x2f')](_0x3cb5c5[_0x13d8('0x2a')][_0x13d8('0x2f')]));_0x3eeec8[_0x13d8('0x2e')]=_0x3eeec8[_0x13d8('0x2e')][_0x13d8('0x30')]?_0x3eeec8['attributes']:_0x3b7282['model'];if(_0x3cb5c5[_0x13d8('0x2a')][_0x13d8('0x3c')]){_0x3eeec8['include']=[{'all':!![]}];}_0x3eeec8=_[_0x13d8('0x39')]({},_0x3eeec8,_0x3cb5c5[_0x13d8('0x3b')]);return db[_0x13d8('0x26')]['find'](_0x3eeec8)[_0x13d8('0x1d')](handleEntityNotFound(_0x459e90,null))[_0x13d8('0x1d')](respondWithResult(_0x459e90,null))['catch'](handleError(_0x459e90,null));};exports[_0x13d8('0x42')]=function(_0xb4f4f4,_0x96d1e3){return db[_0x13d8('0x26')]['create'](_0xb4f4f4[_0x13d8('0x43')],{})[_0x13d8('0x1d')](function(_0x4439af){var _0x40082f=_0xb4f4f4['user'][_0x13d8('0x1f')]({'plain':!![]});if(!_0x40082f)throw new Error(_0x13d8('0x44'));if(_0x40082f[_0x13d8('0x45')]===_0x13d8('0x46')){var _0x169b54=_0x4439af[_0x13d8('0x1f')]({'plain':!![]});var _0x319853='Pauses';return db[_0x13d8('0x47')][_0x13d8('0x48')]({'where':{'name':_0x319853,'userProfileId':_0x40082f[_0x13d8('0x49')]},'raw':!![]})[_0x13d8('0x1d')](function(_0x45898f){if(_0x45898f&&_0x45898f[_0x13d8('0x4a')]===0x0){return db[_0x13d8('0x4b')][_0x13d8('0x42')]({'name':_0x169b54[_0x13d8('0x22')],'resourceId':_0x169b54['id'],'type':_0x45898f[_0x13d8('0x22')],'sectionId':_0x45898f['id']},{})[_0x13d8('0x1d')](function(){return _0x4439af;});}else{return _0x4439af;}})[_0x13d8('0x3d')](function(_0xbc1fd6){logger[_0x13d8('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbc1fd6);throw _0xbc1fd6;});}return _0x4439af;})[_0x13d8('0x1d')](respondWithResult(_0x96d1e3,0xc9))[_0x13d8('0x3d')](handleError(_0x96d1e3,null));};exports[_0x13d8('0x1c')]=function(_0x21f742,_0x1e97ef){if(_0x21f742[_0x13d8('0x43')]['id']){delete _0x21f742[_0x13d8('0x43')]['id'];}return db['Pause'][_0x13d8('0x48')]({'where':{'id':_0x21f742['params']['id']}})[_0x13d8('0x1d')](handleEntityNotFound(_0x1e97ef,null))[_0x13d8('0x1d')](saveUpdates(_0x21f742['body'],null))[_0x13d8('0x1d')](respondWithResult(_0x1e97ef,null))[_0x13d8('0x3d')](handleError(_0x1e97ef,null));};exports[_0x13d8('0x1e')]=function(_0x46570e,_0x38db1a){return db[_0x13d8('0x26')][_0x13d8('0x48')]({'where':{'id':_0x46570e[_0x13d8('0x3f')]['id']}})[_0x13d8('0x1d')](handleEntityNotFound(_0x38db1a,null))[_0x13d8('0x1d')](removeEntity(_0x38db1a,null))[_0x13d8('0x3d')](handleError(_0x38db1a,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 4ee81d3..23fb279 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x17c144,_0x58ab5b){var _0x25719e=function(_0x202a40){while(--_0x202a40){_0x17c144['push'](_0x17c144['shift']());}};_0x25719e(++_0x58ab5b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x5fc3[_0x5ce3c8];return _0xa76867;};'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')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x7217,0x19e));var _0x7721=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7217[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 03dd5f0..f6b3cd2 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(_0x4d2fbe,_0x2281bd){var _0x49cc0d=function(_0x1e6e75){while(--_0x1e6e75){_0x4d2fbe['push'](_0x4d2fbe['shift']());}};_0x49cc0d(++_0x2281bd);}(_0xb10b,0x12a));var _0xbb10=function(_0x1fdf47,_0x1da0d0){_0x1fdf47=_0x1fdf47-0x0;var _0x2f42d3=_0xb10b[_0x1fdf47];return _0x2f42d3;};'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(_0x5d304f,_0x37ff64){var _0x4bc799=function(_0x1359b5){while(--_0x1359b5){_0x5d304f['push'](_0x5d304f['shift']());}};_0x4bc799(++_0x37ff64);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c93e2,_0x4fb5e2){_0x2c93e2=_0x2c93e2-0x0;var _0x57264e=_0xb10b[_0x2c93e2];return _0x57264e;};'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 6bfadf2..bb3422b 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 _0x0e85=['put','update','delete','exports','multer','util','connect-timeout','express','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','originalname','replace','format','%s-%s%s','extname','post','single','file','upload'];(function(_0x540911,_0xe22f8a){var _0xcadf2a=function(_0x5c3498){while(--_0x5c3498){_0x540911['push'](_0x540911['shift']());}};_0xcadf2a(++_0xe22f8a);}(_0x0e85,0x7c));var _0x50e8=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x0e85[_0x40a825];return _0x273a54;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x50e8('0x4'));var config=require('../../config/environment');var controller=require(_0x50e8('0x5'));router[_0x50e8('0x6')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0x8')]);router['get'](_0x50e8('0x9'),controller[_0x50e8('0xa')]);router[_0x50e8('0x6')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xc')]);router['get'](_0x50e8('0xd'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xe')]);var upload=multer({'storage':multer[_0x50e8('0xf')]({'destination':function(_0x154b9e,_0x194a89,_0x45dc6f){_0x45dc6f(null,path[_0x50e8('0x10')](config['root'],'server/files/plugins'));},'filename':function(_0xfc6bb9,_0x24d381,_0x508377){_0x24d381['originalname']=_0x24d381[_0x50e8('0x11')][_0x50e8('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x508377(null,util[_0x50e8('0x13')](_0x50e8('0x14'),path['basename'](_0x24d381[_0x50e8('0x11')],path[_0x50e8('0x15')](_0x24d381[_0x50e8('0x11')])),Date['now'](),path['extname'](_0x24d381[_0x50e8('0x11')])));}})});router[_0x50e8('0x16')]('/',upload[_0x50e8('0x17')](_0x50e8('0x18')),controller[_0x50e8('0x19')]);router[_0x50e8('0x16')]('/webhook',controller['webhookPost']);router[_0x50e8('0x1a')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller[_0x50e8('0x1b')]);router[_0x50e8('0x1c')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller['delete']);module[_0x50e8('0x1d')]=router; \ No newline at end of file +var _0x3937=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','show','/:id/download','download','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','now','single','upload','post','webhookPost','update','delete','/:id','exports','multer'];(function(_0x2bcdd4,_0x3a4691){var _0x44ac15=function(_0x1a4fb8){while(--_0x1a4fb8){_0x2bcdd4['push'](_0x2bcdd4['shift']());}};_0x44ac15(++_0x3a4691);}(_0x3937,0xbf));var _0x7393=function(_0x8d0fcf,_0x227359){_0x8d0fcf=_0x8d0fcf-0x0;var _0xa30452=_0x3937[_0x8d0fcf];return _0xa30452;};'use strict';var multer=require(_0x7393('0x0'));var util=require('util');var path=require(_0x7393('0x1'));var timeout=require(_0x7393('0x2'));var express=require('express');var router=express[_0x7393('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7393('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7393('0x5'));var controller=require(_0x7393('0x6'));router[_0x7393('0x7')]('/',auth[_0x7393('0x8')](),controller[_0x7393('0x9')]);router[_0x7393('0x7')](_0x7393('0xa'),controller[_0x7393('0xb')]);router[_0x7393('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7393('0xc')]);router[_0x7393('0x7')](_0x7393('0xd'),auth['isAuthenticated'](),controller[_0x7393('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x56ed4c,_0x47c5c6,_0x497b6b){_0x497b6b(null,path[_0x7393('0xf')](config[_0x7393('0x10')],_0x7393('0x11')));},'filename':function(_0x4fb764,_0x79fc4e,_0x470f09){_0x79fc4e[_0x7393('0x12')]=_0x79fc4e[_0x7393('0x12')][_0x7393('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x470f09(null,util[_0x7393('0x14')](_0x7393('0x15'),path[_0x7393('0x16')](_0x79fc4e[_0x7393('0x12')],path['extname'](_0x79fc4e['originalname'])),Date[_0x7393('0x17')](),path['extname'](_0x79fc4e['originalname'])));}})});router['post']('/',upload[_0x7393('0x18')]('file'),controller[_0x7393('0x19')]);router[_0x7393('0x1a')]('/webhook',controller[_0x7393('0x1b')]);router['put']('/:id',auth[_0x7393('0x8')](),controller[_0x7393('0x1c')]);router[_0x7393('0x1d')](_0x7393('0x1e'),auth[_0x7393('0x8')](),controller[_0x7393('0x1d')]);module[_0x7393('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 1a67f6e..7ea7d54 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 _0x7610=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT'];(function(_0x5877a7,_0x219986){var _0x3e04f8=function(_0x25095c){while(--_0x25095c){_0x5877a7['push'](_0x5877a7['shift']());}};_0x3e04f8(++_0x219986);}(_0x7610,0xc5));var _0x0761=function(_0x578309,_0x32c266){_0x578309=_0x578309-0x0;var _0x1944a6=_0x7610[_0x578309];return _0x1944a6;};'use strict';var Sequelize=require(_0x0761('0x0'));module[_0x0761('0x1')]={'name':{'type':Sequelize[_0x0761('0x2')]},'type':{'type':Sequelize[_0x0761('0x3')](_0x0761('0x4'),_0x0761('0x5'))},'description':{'type':Sequelize[_0x0761('0x6')]},'version':{'type':Sequelize[_0x0761('0x6')]},'path':{'type':Sequelize[_0x0761('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x0761('0x7')},'sidebar':{'type':Sequelize[_0x0761('0x3')](_0x0761('0x8'),'agentOnly',_0x0761('0x9'),_0x0761('0xa')),'defaultValue':_0x0761('0x9'),'comment':_0x0761('0xb')},'icon':{'type':Sequelize[_0x0761('0x2')]},'adminUrl':{'type':Sequelize[_0x0761('0x2')]},'agentUrl':{'type':Sequelize[_0x0761('0x2')]},'scriptName':{'type':Sequelize[_0x0761('0x2')]},'scriptPath':{'type':Sequelize[_0x0761('0x2')]}}; \ No newline at end of file +var _0x2914=['always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize','exports','html','TEXT','adminOnly','agentOnly'];(function(_0x4bcdc0,_0x30cc48){var _0x3340d5=function(_0x2e7e7e){while(--_0x2e7e7e){_0x4bcdc0['push'](_0x4bcdc0['shift']());}};_0x3340d5(++_0x30cc48);}(_0x2914,0xed));var _0x4291=function(_0x5851b5,_0x46b491){_0x5851b5=_0x5851b5-0x0;var _0x140f90=_0x2914[_0x5851b5];return _0x140f90;};'use strict';var Sequelize=require(_0x4291('0x0'));module[_0x4291('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x4291('0x2'),'script')},'description':{'type':Sequelize[_0x4291('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x4291('0x4'),_0x4291('0x5'),'always','never'),'defaultValue':_0x4291('0x6'),'comment':_0x4291('0x7')},'icon':{'type':Sequelize[_0x4291('0x8')]},'adminUrl':{'type':Sequelize[_0x4291('0x8')]},'agentUrl':{'type':Sequelize[_0x4291('0x8')]},'scriptName':{'type':Sequelize[_0x4291('0x8')]},'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 7afc8b9..4fcfd8c 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 _0x66b2=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','show','params','find','catch','download','join','root','server/files/plugins','%s.zip','basename','createWriteStream','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','length','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','method','%s%s','headers','content-length','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','content-type','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','end','error','stack','name','send','index','map','Plugin','rawAttributes','key','model','query','keys','filters'];(function(_0x95549c,_0x3111c7){var _0x6d9d36=function(_0x2a549d){while(--_0x2a549d){_0x95549c['push'](_0x95549c['shift']());}};_0x6d9d36(++_0x3111c7);}(_0x66b2,0x6e));var _0x266b=function(_0x319ff8,_0x45ca90){_0x319ff8=_0x319ff8-0x0;var _0x11d674=_0x66b2[_0x319ff8];return _0x11d674;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x266b('0x0'));var zipdir=require(_0x266b('0x1'));var jsonpatch=require(_0x266b('0x2'));var rp=require('request-promise');var moment=require(_0x266b('0x3'));var BPromise=require(_0x266b('0x4'));var Mustache=require(_0x266b('0x5'));var util=require(_0x266b('0x6'));var path=require(_0x266b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x266b('0x8'));var fs=require('fs');var fs_extra=require(_0x266b('0x9'));var _=require(_0x266b('0xa'));var squel=require('squel');var crypto=require(_0x266b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x266b('0xc'));var toCsv=require(_0x266b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0x266b('0xe'));var rimraf=require(_0x266b('0x0'));var archiver=require('archiver');var Redis=require(_0x266b('0xf'));var authService=require(_0x266b('0x10'));var qs=require(_0x266b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x266b('0x12'));var logger=require('../../config/logger')(_0x266b('0x13'));var utils=require('../../config/utils');var config=require(_0x266b('0x14'));var licenseUtil=require(_0x266b('0x15'));var db=require(_0x266b('0x16'))['db'];config[_0x266b('0x17')]=_[_0x266b('0x18')](config[_0x266b('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x266b('0x19'))(new Redis(config[_0x266b('0x17')]));require('./plugin.socket')[_0x266b('0x1a')](socket);function respondWithStatusCode(_0x38843a,_0x2d211e){_0x2d211e=_0x2d211e||0xcc;return function(_0x299503){if(_0x299503){return _0x38843a[_0x266b('0x1b')](_0x2d211e);}return _0x38843a[_0x266b('0x1c')](_0x2d211e)['end']();};}function respondWithResult(_0x4f0383,_0x26bdf5){_0x26bdf5=_0x26bdf5||0xc8;return function(_0x202d53){if(_0x202d53){return _0x4f0383['status'](_0x26bdf5)[_0x266b('0x1d')](_0x202d53);}};}function respondWithFilteredResult(_0x81a77,_0x32c708){return function(_0x2ac0d7){if(_0x2ac0d7){var _0x40d8c8=typeof _0x32c708[_0x266b('0x1e')]==='undefined'&&typeof _0x32c708[_0x266b('0x1f')]===_0x266b('0x20');var _0x4783a9=_0x2ac0d7[_0x266b('0x21')];var _0x1699d5=_0x40d8c8?0x0:_0x32c708['offset'];var _0x4fa7f2=_0x40d8c8?_0x2ac0d7[_0x266b('0x21')]:_0x32c708[_0x266b('0x1e')]+_0x32c708['limit'];var _0x10918f;if(_0x4fa7f2>=_0x4783a9){_0x4fa7f2=_0x4783a9;_0x10918f=0xc8;}else{_0x10918f=0xce;}_0x81a77['status'](_0x10918f);return _0x81a77[_0x266b('0x22')]('Content-Range',_0x1699d5+'-'+_0x4fa7f2+'/'+_0x4783a9)[_0x266b('0x1d')](_0x2ac0d7);}return null;};}function patchUpdates(_0x1a96cc){return function(_0x28e22d){try{jsonpatch[_0x266b('0x23')](_0x28e22d,_0x1a96cc,!![]);}catch(_0xf31524){return BPromise[_0x266b('0x24')](_0xf31524);}return _0x28e22d[_0x266b('0x25')]();};}function saveUpdates(_0x3e458c,_0x3394a0){return function(_0x27a9db){if(_0x27a9db){return _0x27a9db[_0x266b('0x26')](_0x3e458c)[_0x266b('0x27')](function(_0x11441b){return _0x11441b;});}return null;};}function removeEntity(_0x30dbff,_0x290e81){return function(_0x290e2c){if(_0x290e2c){return _0x290e2c[_0x266b('0x28')]()[_0x266b('0x27')](function(){var _0x466eec=_0x290e2c[_0x266b('0x29')]({'plain':!![]});var _0x4775c6=_0x266b('0x2a');return db[_0x266b('0x2b')][_0x266b('0x28')]({'where':{'type':_0x4775c6,'resourceId':_0x466eec['id']}})['then'](function(){return _0x290e2c;});})['then'](function(){_0x30dbff['status'](0xcc)[_0x266b('0x2c')]();});}};}function handleEntityNotFound(_0x1f61e1,_0x4e9ce8){return function(_0x15d93a){if(!_0x15d93a){_0x1f61e1['sendStatus'](0x194);}return _0x15d93a;};}function handleError(_0x2c19ed,_0x550eee){_0x550eee=_0x550eee||0x1f4;return function(_0x830124){logger[_0x266b('0x2d')](_0x830124[_0x266b('0x2e')]);if(_0x830124[_0x266b('0x2f')]){delete _0x830124[_0x266b('0x2f')];}_0x2c19ed[_0x266b('0x1c')](_0x550eee)[_0x266b('0x30')](_0x830124);};}exports[_0x266b('0x31')]=function(_0x4473d4,_0x3d9222){var _0x40d9e7={},_0x428687={},_0x2519db={'count':0x0,'rows':[]};var _0x520315=_[_0x266b('0x32')](db[_0x266b('0x33')][_0x266b('0x34')],function(_0x7725d4){return{'name':_0x7725d4['fieldName'],'type':_0x7725d4['type'][_0x266b('0x35')]};});_0x428687[_0x266b('0x36')]=_[_0x266b('0x32')](_0x520315,_0x266b('0x2f'));_0x428687[_0x266b('0x37')]=_[_0x266b('0x38')](_0x4473d4[_0x266b('0x37')]);_0x428687[_0x266b('0x39')]=_[_0x266b('0x3a')](_0x428687[_0x266b('0x36')],_0x428687[_0x266b('0x37')]);_0x40d9e7[_0x266b('0x3b')]=_['intersection'](_0x428687[_0x266b('0x36')],qs[_0x266b('0x3c')](_0x4473d4['query'][_0x266b('0x3c')]));_0x40d9e7[_0x266b('0x3b')]=_0x40d9e7[_0x266b('0x3b')]['length']?_0x40d9e7['attributes']:_0x428687['model'];if(!_0x4473d4['query'][_0x266b('0x3d')](_0x266b('0x3e'))){_0x40d9e7['limit']=qs[_0x266b('0x1f')](_0x4473d4['query'][_0x266b('0x1f')]);_0x40d9e7[_0x266b('0x1e')]=qs[_0x266b('0x1e')](_0x4473d4[_0x266b('0x37')]['offset']);}_0x40d9e7[_0x266b('0x3f')]=qs[_0x266b('0x40')](_0x4473d4['query'][_0x266b('0x40')]);_0x40d9e7[_0x266b('0x41')]=qs[_0x266b('0x39')](_[_0x266b('0x42')](_0x4473d4[_0x266b('0x37')],_0x428687[_0x266b('0x39')]),_0x520315);if(_0x4473d4[_0x266b('0x37')][_0x266b('0x43')]){_0x40d9e7[_0x266b('0x41')]=_['merge'](_0x40d9e7[_0x266b('0x41')],{'$or':_['map'](_0x520315,function(_0x312784){if(_0x312784[_0x266b('0x44')]!=='VIRTUAL'){var _0x603943={};_0x603943[_0x312784['name']]={'$like':'%'+_0x4473d4[_0x266b('0x37')][_0x266b('0x43')]+'%'};return _0x603943;}})});}_0x40d9e7=_[_0x266b('0x45')]({},_0x40d9e7,_0x4473d4[_0x266b('0x46')]);var _0x124c4a={'where':_0x40d9e7[_0x266b('0x41')]};return db[_0x266b('0x33')][_0x266b('0x21')](_0x124c4a)[_0x266b('0x27')](function(_0x28210e){_0x2519db[_0x266b('0x21')]=_0x28210e;if(_0x4473d4['query'][_0x266b('0x47')]){_0x40d9e7[_0x266b('0x48')]=[{'all':!![]}];}return db[_0x266b('0x33')][_0x266b('0x49')](_0x40d9e7);})[_0x266b('0x27')](function(_0x479acb){_0x2519db['rows']=_0x479acb;return _0x2519db;})['then'](respondWithFilteredResult(_0x3d9222,_0x40d9e7))['catch'](handleError(_0x3d9222,null));};exports[_0x266b('0x4a')]=function(_0x5e2d6e,_0x44f65b){var _0x1f5cf0={'raw':!![],'where':{'id':_0x5e2d6e[_0x266b('0x4b')]['id']}},_0xc9d3d={};_0xc9d3d['model']=_[_0x266b('0x38')](db[_0x266b('0x33')][_0x266b('0x34')]);_0xc9d3d[_0x266b('0x37')]=_[_0x266b('0x38')](_0x5e2d6e[_0x266b('0x37')]);_0xc9d3d[_0x266b('0x39')]=_['intersection'](_0xc9d3d[_0x266b('0x36')],_0xc9d3d['query']);_0x1f5cf0[_0x266b('0x3b')]=_[_0x266b('0x3a')](_0xc9d3d[_0x266b('0x36')],qs[_0x266b('0x3c')](_0x5e2d6e[_0x266b('0x37')][_0x266b('0x3c')]));_0x1f5cf0[_0x266b('0x3b')]=_0x1f5cf0[_0x266b('0x3b')]['length']?_0x1f5cf0['attributes']:_0xc9d3d[_0x266b('0x36')];if(_0x5e2d6e[_0x266b('0x37')][_0x266b('0x47')]){_0x1f5cf0[_0x266b('0x48')]=[{'all':!![]}];}_0x1f5cf0=_['merge']({},_0x1f5cf0,_0x5e2d6e[_0x266b('0x46')]);return db[_0x266b('0x33')][_0x266b('0x4c')](_0x1f5cf0)[_0x266b('0x27')](handleEntityNotFound(_0x44f65b,null))[_0x266b('0x27')](respondWithResult(_0x44f65b,null))[_0x266b('0x4d')](handleError(_0x44f65b,null));};exports[_0x266b('0x4e')]=function(_0x22fca1,_0x1ed05b,_0x4a9327){return db['Plugin'][_0x266b('0x4c')]({'where':{'id':_0x22fca1[_0x266b('0x4b')]['id']},'attributes':[_0x266b('0x2f'),_0x266b('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x1ed05b,null))[_0x266b('0x27')](function(_0x189898){if(_0x189898){var _0x5da109=path[_0x266b('0x4f')](config[_0x266b('0x50')],_0x266b('0x51'),util['format'](_0x266b('0x52'),path[_0x266b('0x53')](_0x189898['path'])));var _0x17a1a6=fs[_0x266b('0x54')](_0x5da109);var _0xad2e30=archiver('zip',{'zlib':{'level':0x9}});_0xad2e30['on']('warning',function(_0xeed8e7){if(_0xeed8e7[_0x266b('0x55')]==='ENOENT'){logger['error'](_0xeed8e7);}else{throw new db[(_0x266b('0x56'))][(_0x266b('0x57'))](_0x266b('0x58'));}});_0xad2e30['on'](_0x266b('0x2d'),function(_0x2b58ad){throw new db['Sequelize'][(_0x266b('0x57'))](_0x266b('0x58'));});_0xad2e30['pipe'](_0x17a1a6);_0xad2e30[_0x266b('0x59')](_0x266b('0x5a'),{'cwd':path['join'](config[_0x266b('0x50')],_0x266b('0x51'),path[_0x266b('0x5b')](_0x189898[_0x266b('0x7')])),'ignore':[path['join'](path[_0x266b('0x53')](_0x189898['path']),_0x266b('0x5c')),path[_0x266b('0x4f')](path['basename'](_0x189898['path']),_0x266b('0x5d'))],'nodir':!![]})[_0x266b('0x5e')]();_0x17a1a6['on'](_0x266b('0x5f'),function(){if(!fs[_0x266b('0x60')](_0x5da109)){throw new db[(_0x266b('0x56'))]['Error'](_0x266b('0x61'));}return _0x1ed05b[_0x266b('0x4e')](_0x5da109,util[_0x266b('0x62')](_0x266b('0x52'),path['basename'](_0x189898[_0x266b('0x7')])),function(_0x21c96d){if(_0x21c96d){throw new db['Sequelize'][(_0x266b('0x57'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x266b('0x63')](_0x5da109);logger[_0x266b('0x64')](_0x266b('0x65'));logger['info'](_0x266b('0x66'));});});}return null;})[_0x266b('0x4d')](handleError(_0x1ed05b,null));};exports[_0x266b('0x67')]=function(_0x52a9bc,_0x3a6bc0,_0x5c50ac){var _0x103d42=path[_0x266b('0x53')](_0x52a9bc[_0x266b('0x68')][_0x266b('0x69')],path[_0x266b('0x6a')](_0x52a9bc['file'][_0x266b('0x69')]));var _0xb4111c=path[_0x266b('0x4f')](config[_0x266b('0x50')],_0x266b('0x51'),_0x52a9bc[_0x266b('0x68')][_0x266b('0x69')]);var _0x5a6336=path[_0x266b('0x4f')](config[_0x266b('0x50')],'server/files/plugins',_0x103d42);logger['info'](_0x266b('0x6b'),_0xb4111c);logger[_0x266b('0x64')](_0x266b('0x6c'),_0x5a6336);try{fs[_0x266b('0x6d')](_0xb4111c,parseInt(_0x266b('0x6e'),0x8));extract(_0xb4111c,{'dir':_0x5a6336},function(_0x1ebdb2){if(_0x1ebdb2){logger[_0x266b('0x2d')](_0x1ebdb2);handleError(_0x1ebdb2,!![]);};var _0x46e099=fs[_0x266b('0x6f')](_0x5a6336);if(_0x46e099[_0x266b('0x70')]>0x1){removeReferences(_0xb4111c,_0x5a6336);logger['error'](_0x266b('0x71'));return _0x5c50ac(new Error('Invalid\x20plugin\x20structure'));}var _0x33287b=fs[_0x266b('0x72')](path[_0x266b('0x4f')](_0x5a6336,_0x46e099[0x0]));if(_0x33287b[_0x266b('0x73')]()){removeReferences(_0xb4111c,_0x5a6336);logger['error'](_0x266b('0x71'));return _0x5c50ac(new Error(_0x266b('0x71')));}if(_0x33287b[_0x266b('0x74')]()){var _0x16277b=fs[_0x266b('0x6f')](path[_0x266b('0x4f')](_0x5a6336,_0x46e099[0x0]));if(_0x16277b[_0x266b('0x70')]===0x0){removeReferences(_0xb4111c,_0x5a6336);logger['error'](_0x266b('0x71'));return _0x5c50ac(new Error(_0x266b('0x71')));}var _0xf91df1=_0x16277b[_0x266b('0x75')](function(_0x793034){return _0x793034===_0x266b('0x76');});if(!_0xf91df1){return _0x5c50ac(new Error(_0x266b('0x77')));}var _0x21502c=fs[_0x266b('0x78')](path[_0x266b('0x4f')](_0x5a6336,_0x46e099[0x0],_0x266b('0x76')));var _0x3b0d70=JSON['parse'](_0x21502c);if('undefined'==typeof _0x3b0d70[_0x266b('0x2f')]){return _0x5c50ac(new Error(_0x266b('0x79')));}if(_0x266b('0x20')==typeof _0x3b0d70[_0x266b('0x44')]){return _0x5c50ac(new Error(_0x266b('0x7a')));}if(_0x266b('0x20')==typeof _0x3b0d70[_0x266b('0x7b')]){return _0x5c50ac(new Error(_0x266b('0x7c')));}if(_0x266b('0x20')==typeof _0x3b0d70[_0x266b('0x7d')]){return _0x5c50ac(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x3b0d70[_0x266b('0x44')]===_0x266b('0x7e')){if(_0x266b('0x20')==typeof _0x3b0d70['parameters'][_0x266b('0x7f')]){return _0x5c50ac(new Error(_0x266b('0x80')));}if(_0x266b('0x20')==typeof _0x3b0d70[_0x266b('0x7d')]['views'][_0x266b('0x81')]&&_0x266b('0x20')==typeof _0x3b0d70[_0x266b('0x7d')][_0x266b('0x7f')][_0x266b('0x82')]){return _0x5c50ac(new Error(_0x266b('0x83')));}}else if(_0x3b0d70[_0x266b('0x44')]===_0x266b('0x84')){if('undefined'==typeof _0x3b0d70[_0x266b('0x7d')]['scriptName']){return _0x5c50ac(new Error(_0x266b('0x85')));}if('undefined'==typeof _0x3b0d70[_0x266b('0x7d')]['scriptPath']){return _0x5c50ac(new Error(_0x266b('0x86')));}}else{return _0x5c50ac(new Error(_0x266b('0x87')));}var _0x36aa5c=_0x3b0d70[_0x266b('0x2f')];var _0x476346=_0x3b0d70[_0x266b('0x88')];var _0x50d93c=_0x3b0d70[_0x266b('0x44')];var _0x2c0b13=_0x3b0d70[_0x266b('0x89')]?_0x3b0d70[_0x266b('0x89')]:_0x266b('0x8a');var _0x73d5e6=_0x3b0d70['icon']?_0x3b0d70[_0x266b('0x8b')]:'icon-apps';var _0x378b4b='';var _0x4d3d84='';var _0x28fa63='';var _0x45a3c6='';var _0x22d5ce=_0x3b0d70['version'];if(_0x50d93c===_0x266b('0x7e')){if(_0x266b('0x20')!=typeof _0x3b0d70[_0x266b('0x7d')][_0x266b('0x7f')][_0x266b('0x81')]){var _0x91e19b=_0x3b0d70['parameters'][_0x266b('0x7f')][_0x266b('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x266b('0x8c')](_0x91e19b)){_0x378b4b=path[_0x266b('0x4f')](_0x266b('0x8d'),_0x103d42,_0x46e099[0x0],_0x91e19b);}else{_0x378b4b=_0x91e19b;}}else{logger['info'](_0x266b('0x8e'));}if('undefined'!=typeof _0x3b0d70[_0x266b('0x7d')]['views'][_0x266b('0x82')]){var _0x44e801=_0x3b0d70['parameters']['views'][_0x266b('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x266b('0x8c')](_0x44e801)){_0x4d3d84=path[_0x266b('0x4f')]('plugins',_0x103d42,_0x46e099[0x0],_0x44e801);}else{_0x4d3d84=_0x44e801;}}else{logger['info'](_0x266b('0x8f'));}}else if(_0x50d93c===_0x266b('0x84')){_0x28fa63=_0x3b0d70[_0x266b('0x7d')]['scriptName'];_0x45a3c6=_0x3b0d70[_0x266b('0x7d')]['scriptPath'];if(_0x266b('0x20')!=typeof _0x3b0d70[_0x266b('0x7d')][_0x266b('0x7f')]){if(_0x266b('0x20')!=typeof _0x3b0d70[_0x266b('0x7d')][_0x266b('0x7f')]['admin']){var _0x91e19b=_0x3b0d70['parameters'][_0x266b('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x266b('0x8c')](_0x91e19b)){_0x378b4b=path[_0x266b('0x4f')]('plugins',_0x103d42,_0x46e099[0x0],_0x91e19b);}else{_0x378b4b=_0x91e19b;}}if('undefined'!=typeof _0x3b0d70[_0x266b('0x7d')][_0x266b('0x7f')]['agent']){var _0x44e801=_0x3b0d70[_0x266b('0x7d')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x266b('0x8c')](_0x44e801)){_0x4d3d84=path[_0x266b('0x4f')](_0x266b('0x8d'),_0x103d42,_0x46e099[0x0],_0x44e801);}else{_0x4d3d84=_0x44e801;}}}}var _0x3f7c31={'name':_0x36aa5c,'description':_0x476346,'path':path[_0x266b('0x4f')](_0x103d42,_0x46e099[0x0]),'type':_0x50d93c,'sidebar':_0x2c0b13,'icon':_0x73d5e6,'adminUrl':_0x378b4b,'agentUrl':_0x4d3d84,'scriptName':_0x28fa63,'scriptPath':_0x45a3c6,'version':_0x22d5ce};removeReferences(_0xb4111c,null);return db['Plugin'][_0x266b('0x90')](_0x3f7c31)[_0x266b('0x27')](function(_0x4ad32d){var _0x30c583={'role':_0x52a9bc[_0x266b('0x91')][_0x266b('0x92')],'userProfileId':_0x52a9bc[_0x266b('0x91')][_0x266b('0x93')]};if(!_0x30c583)throw new Error(_0x266b('0x94'));if(_0x30c583[_0x266b('0x92')]==='user'){var _0xffc1b2=_0x4ad32d[_0x266b('0x29')]({'plain':!![]});return db[_0x266b('0x95')]['find']({'where':{'name':_0x266b('0x2a'),'userProfileId':_0x30c583[_0x266b('0x93')]},'raw':!![]})['then'](function(_0x2a607d){if(_0x2a607d&&_0x2a607d[_0x266b('0x96')]===0x0){return db[_0x266b('0x2b')]['create']({'name':_0xffc1b2[_0x266b('0x2f')],'resourceId':_0xffc1b2['id'],'type':_0x2a607d[_0x266b('0x2f')],'sectionId':_0x2a607d['id']},{})['then'](function(){return _0x4ad32d;});}else{return _0x4ad32d;}})[_0x266b('0x4d')](function(_0x14dba3){logger[_0x266b('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14dba3);throw _0x14dba3;});}return _0x4ad32d;})[_0x266b('0x27')](respondWithResult(_0x3a6bc0,null))['catch'](handleError(_0x3a6bc0,null));}});}catch(_0xdc6d8d){_0x3a6bc0[_0x266b('0x1c')](0x1f4)['send'](_0xdc6d8d);}};function removeReferences(_0x586ac0,_0x584cb7){try{if(_0x586ac0){fs[_0x266b('0x63')](_0x586ac0);logger['info']('Zip\x20archive\x20removed');}if(_0x584cb7){rimraf(_0x584cb7,function(){});logger[_0x266b('0x64')](_0x266b('0x97'));}}catch(_0x2c96a1){logger['error'](_0x2c96a1);}}exports[_0x266b('0x26')]=function(_0x7d9798,_0x51ce0a,_0x14d853){return db[_0x266b('0x33')][_0x266b('0x4c')]({'where':{'id':_0x7d9798[_0x266b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x51ce0a,null))[_0x266b('0x27')](saveUpdates(_0x7d9798['body'],null))[_0x266b('0x27')](respondWithResult(_0x51ce0a,null))[_0x266b('0x4d')](handleError(_0x51ce0a,null));};exports['delete']=function(_0x32c5f6,_0x4ff842,_0x19de1e){return db[_0x266b('0x33')][_0x266b('0x4c')]({'where':{'id':_0x32c5f6[_0x266b('0x4b')]['id']}})[_0x266b('0x27')](function(_0x220ca3){if(_0x220ca3){return _0x220ca3[_0x266b('0x28')]();}})['then'](function(_0x98f034){rimraf(path[_0x266b('0x4f')](config[_0x266b('0x50')],_0x266b('0x51'),path[_0x266b('0x5b')](_0x98f034[_0x266b('0x7')])),function(){});return _0x98f034;})['then'](handleEntityNotFound(_0x4ff842,null))['then'](respondWithStatusCode(_0x4ff842,null))['catch'](handleError(_0x4ff842,null));};exports[_0x266b('0x98')]=function(_0x25bff8,_0x3bc3f0,_0x131d11){return BPromise[_0x266b('0x99')]()[_0x266b('0x27')](function(){if(!_0x25bff8[_0x266b('0x37')][_0x266b('0x7')]){throw new Error(_0x266b('0x9a'));}if(!_0x25bff8[_0x266b('0x37')][_0x266b('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3026ee=_0x25bff8[_0x266b('0x37')][_0x266b('0x9c')]?_0x25bff8[_0x266b('0x37')][_0x266b('0x9c')]+':'+_0x25bff8['query'][_0x266b('0x9b')]:'http://localhost:'+_0x25bff8[_0x266b('0x37')][_0x266b('0x9b')];var _0x5bbd29=_0x25bff8['query'][_0x266b('0x1d')]?_0x25bff8[_0x266b('0x37')][_0x266b('0x1d')]:!![];var _0x4cf77c=_0x25bff8[_0x266b('0x37')][_0x266b('0x9d')]?_0x25bff8[_0x266b('0x37')][_0x266b('0x9d')]:null;var _0x40b49f={'method':_0x25bff8[_0x266b('0x9e')],'uri':util[_0x266b('0x62')](_0x266b('0x9f'),_0x3026ee,_0x25bff8[_0x266b('0x37')][_0x266b('0x7')]),'json':_0x5bbd29,'resolveWithFullResponse':!![],'encoding':_0x4cf77c,'qs':_0x25bff8[_0x266b('0x37')]};if(_0x25bff8[_0x266b('0xa0')]){_0x40b49f[_0x266b('0xa0')]=_0x25bff8[_0x266b('0xa0')];if(_0x40b49f[_0x266b('0xa0')][_0x266b('0xa1')]){delete _0x40b49f[_0x266b('0xa0')][_0x266b('0xa1')];}}if(_0x40b49f[_0x266b('0xa0')]['content-type']){delete _0x40b49f[_0x266b('0xa0')]['content-type'];}return rp(_0x40b49f);})[_0x266b('0x27')](function(_0x2d8fb7){if(_0x2d8fb7){_0x3bc3f0[_0x266b('0x22')](_0x2d8fb7[_0x266b('0xa0')]);logger[_0x266b('0x64')](_0x2d8fb7[_0x266b('0x91')]);if(_[_0x266b('0xa2')](_0x25bff8[_0x266b('0x37')][_0x266b('0x7')],_0x266b('0x4e'))&&_0x2d8fb7[_0x266b('0xa3')]==0x1f4){return _0x3bc3f0[_0x266b('0x1b')](_0x2d8fb7[_0x266b('0xa3')]);}else{return _0x3bc3f0[_0x266b('0x1c')](_0x2d8fb7[_0x266b('0xa3')])[_0x266b('0x30')](_0x2d8fb7['body']);}}else{return _0x3bc3f0[_0x266b('0x1b')](0xc8);}})[_0x266b('0x4d')](handleError(_0x3bc3f0,null));};exports[_0x266b('0xa4')]=function(_0x21391f,_0x5dd1cd,_0x29abba){return BPromise[_0x266b('0x99')]()['then'](function(){if(!_0x21391f['query'][_0x266b('0x7')]){throw new Error(_0x266b('0x9a'));}if(!_0x21391f[_0x266b('0x37')]['port']){throw new Error(_0x266b('0xa5'));}var _0x3cb229=_0x21391f[_0x266b('0x37')][_0x266b('0x9c')]?_0x21391f['query'][_0x266b('0x9c')]+':'+_0x21391f['query'][_0x266b('0x9b')]:_0x266b('0xa6')+_0x21391f[_0x266b('0x37')][_0x266b('0x9b')];var _0x26f737=_0x21391f[_0x266b('0x37')][_0x266b('0x1d')]?_0x21391f['query']['json']:!![];var _0x569a94=_0x21391f[_0x266b('0x37')][_0x266b('0x9d')]?_0x21391f[_0x266b('0x37')][_0x266b('0x9d')]:null;var _0x3d98d3={'method':_0x21391f[_0x266b('0x9e')],'uri':util[_0x266b('0x62')]('%s%s',_0x3cb229,_0x21391f[_0x266b('0x37')][_0x266b('0x7')]),'json':_0x26f737,'resolveWithFullResponse':!![],'encoding':_0x569a94,'body':_0x21391f['body']};if(_0x21391f['headers']){_0x3d98d3[_0x266b('0xa0')]=_0x21391f[_0x266b('0xa0')];if(_0x3d98d3[_0x266b('0xa0')][_0x266b('0xa1')]){delete _0x3d98d3[_0x266b('0xa0')]['content-length'];}}if(_0x3d98d3[_0x266b('0xa0')][_0x266b('0xa7')]){delete _0x3d98d3[_0x266b('0xa0')][_0x266b('0xa7')];}return rp(_0x3d98d3);})[_0x266b('0x27')](function(_0x4e3fe5){if(_0x4e3fe5){_0x5dd1cd[_0x266b('0x22')](_0x4e3fe5[_0x266b('0xa0')]);logger[_0x266b('0x64')](_0x4e3fe5[_0x266b('0x91')]);return _0x5dd1cd[_0x266b('0x1c')](_0x4e3fe5[_0x266b('0xa3')])[_0x266b('0x30')](_0x4e3fe5[_0x266b('0x91')]);}else{return _0x5dd1cd[_0x266b('0x1b')](0xc8);}})[_0x266b('0x4d')](handleError(_0x5dd1cd,null));}; \ No newline at end of file +var _0x6322=['%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','querystring','papaparse','extract-zip','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','find','download','root','server/files/plugins','format','%s.zip','path','createWriteStream','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','join','basename','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','plugins','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','webhookGet','port','hostname','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:'];(function(_0x2270bc,_0x3b6274){var _0x5de1d5=function(_0x16a689){while(--_0x16a689){_0x2270bc['push'](_0x2270bc['shift']());}};_0x5de1d5(++_0x3b6274);}(_0x6322,0x15d));var _0x2632=function(_0x54b62b,_0x4a8b){_0x54b62b=_0x54b62b-0x0;var _0x4567ec=_0x6322[_0x54b62b];return _0x4567ec;};'use strict';var emlformat=require(_0x2632('0x0'));var rimraf=require(_0x2632('0x1'));var zipdir=require(_0x2632('0x2'));var jsonpatch=require(_0x2632('0x3'));var rp=require(_0x2632('0x4'));var moment=require(_0x2632('0x5'));var BPromise=require(_0x2632('0x6'));var Mustache=require(_0x2632('0x7'));var util=require(_0x2632('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x2632('0x9'));var ejs=require(_0x2632('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2632('0xb'));var squel=require(_0x2632('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2632('0x9'));var querystring=require(_0x2632('0xd'));var Papa=require(_0x2632('0xe'));var extract=require(_0x2632('0xf'));var rimraf=require('rimraf');var archiver=require(_0x2632('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2632('0x11'));var as=require(_0x2632('0x12'));var hardwareService=require(_0x2632('0x13'));var logger=require(_0x2632('0x14'))(_0x2632('0x15'));var utils=require(_0x2632('0x16'));var config=require(_0x2632('0x17'));var licenseUtil=require(_0x2632('0x18'));var db=require(_0x2632('0x19'))['db'];config[_0x2632('0x1a')]=_['defaults'](config[_0x2632('0x1a')],{'host':_0x2632('0x1b'),'port':0x18eb});var socket=require(_0x2632('0x1c'))(new Redis(config[_0x2632('0x1a')]));require(_0x2632('0x1d'))[_0x2632('0x1e')](socket);function respondWithStatusCode(_0x4e96c5,_0xf2f210){_0xf2f210=_0xf2f210||0xcc;return function(_0x2cc03e){if(_0x2cc03e){return _0x4e96c5[_0x2632('0x1f')](_0xf2f210);}return _0x4e96c5[_0x2632('0x20')](_0xf2f210)[_0x2632('0x21')]();};}function respondWithResult(_0x5aef67,_0x4d8294){_0x4d8294=_0x4d8294||0xc8;return function(_0x621f37){if(_0x621f37){return _0x5aef67['status'](_0x4d8294)['json'](_0x621f37);}};}function respondWithFilteredResult(_0x3d6df6,_0xd2979a){return function(_0x4a416e){if(_0x4a416e){var _0x399e98=typeof _0xd2979a[_0x2632('0x22')]===_0x2632('0x23')&&typeof _0xd2979a['limit']===_0x2632('0x23');var _0x5eeac7=_0x4a416e['count'];var _0x28ec7c=_0x399e98?0x0:_0xd2979a[_0x2632('0x22')];var _0x153822=_0x399e98?_0x4a416e['count']:_0xd2979a[_0x2632('0x22')]+_0xd2979a[_0x2632('0x24')];var _0x5ab5b7;if(_0x153822>=_0x5eeac7){_0x153822=_0x5eeac7;_0x5ab5b7=0xc8;}else{_0x5ab5b7=0xce;}_0x3d6df6[_0x2632('0x20')](_0x5ab5b7);return _0x3d6df6[_0x2632('0x25')](_0x2632('0x26'),_0x28ec7c+'-'+_0x153822+'/'+_0x5eeac7)[_0x2632('0x27')](_0x4a416e);}return null;};}function patchUpdates(_0xbc79d9){return function(_0xa0d63b){try{jsonpatch[_0x2632('0x28')](_0xa0d63b,_0xbc79d9,!![]);}catch(_0x290c3c){return BPromise[_0x2632('0x29')](_0x290c3c);}return _0xa0d63b['save']();};}function saveUpdates(_0x3771d5,_0x1863f2){return function(_0x5c876b){if(_0x5c876b){return _0x5c876b['update'](_0x3771d5)[_0x2632('0x2a')](function(_0x55259d){return _0x55259d;});}return null;};}function removeEntity(_0x5950f9,_0x135c04){return function(_0x4bb17a){if(_0x4bb17a){return _0x4bb17a[_0x2632('0x2b')]()['then'](function(){var _0x5b949a=_0x4bb17a[_0x2632('0x2c')]({'plain':!![]});var _0x4fa1ae=_0x2632('0x2d');return db[_0x2632('0x2e')][_0x2632('0x2b')]({'where':{'type':_0x4fa1ae,'resourceId':_0x5b949a['id']}})[_0x2632('0x2a')](function(){return _0x4bb17a;});})[_0x2632('0x2a')](function(){_0x5950f9[_0x2632('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a5a11,_0x559165){return function(_0x5c3a9b){if(!_0x5c3a9b){_0x1a5a11[_0x2632('0x1f')](0x194);}return _0x5c3a9b;};}function handleError(_0x28cee8,_0x3fc133){_0x3fc133=_0x3fc133||0x1f4;return function(_0x22e1d7){logger[_0x2632('0x2f')](_0x22e1d7[_0x2632('0x30')]);if(_0x22e1d7[_0x2632('0x31')]){delete _0x22e1d7[_0x2632('0x31')];}_0x28cee8[_0x2632('0x20')](_0x3fc133)[_0x2632('0x32')](_0x22e1d7);};}exports[_0x2632('0x33')]=function(_0x250107,_0xfc6741){var _0x485094={},_0x58303c={},_0x2696eb={'count':0x0,'rows':[]};var _0x31d37d=_[_0x2632('0x34')](db[_0x2632('0x35')]['rawAttributes'],function(_0x32b98f){return{'name':_0x32b98f[_0x2632('0x36')],'type':_0x32b98f[_0x2632('0x37')]['key']};});_0x58303c[_0x2632('0x38')]=_[_0x2632('0x34')](_0x31d37d,'name');_0x58303c[_0x2632('0x39')]=_['keys'](_0x250107[_0x2632('0x39')]);_0x58303c['filters']=_[_0x2632('0x3a')](_0x58303c['model'],_0x58303c[_0x2632('0x39')]);_0x485094[_0x2632('0x3b')]=_[_0x2632('0x3a')](_0x58303c['model'],qs[_0x2632('0x3c')](_0x250107[_0x2632('0x39')]['fields']));_0x485094['attributes']=_0x485094[_0x2632('0x3b')][_0x2632('0x3d')]?_0x485094[_0x2632('0x3b')]:_0x58303c[_0x2632('0x38')];if(!_0x250107['query']['hasOwnProperty'](_0x2632('0x3e'))){_0x485094[_0x2632('0x24')]=qs[_0x2632('0x24')](_0x250107[_0x2632('0x39')][_0x2632('0x24')]);_0x485094[_0x2632('0x22')]=qs[_0x2632('0x22')](_0x250107[_0x2632('0x39')][_0x2632('0x22')]);}_0x485094[_0x2632('0x3f')]=qs[_0x2632('0x40')](_0x250107['query'][_0x2632('0x40')]);_0x485094[_0x2632('0x41')]=qs[_0x2632('0x42')](_[_0x2632('0x43')](_0x250107[_0x2632('0x39')],_0x58303c[_0x2632('0x42')]),_0x31d37d);if(_0x250107[_0x2632('0x39')][_0x2632('0x44')]){_0x485094['where']=_[_0x2632('0x45')](_0x485094['where'],{'$or':_[_0x2632('0x34')](_0x31d37d,function(_0x61efc8){if(_0x61efc8['type']!==_0x2632('0x46')){var _0x32174f={};_0x32174f[_0x61efc8[_0x2632('0x31')]]={'$like':'%'+_0x250107[_0x2632('0x39')]['filter']+'%'};return _0x32174f;}})});}_0x485094=_['merge']({},_0x485094,_0x250107[_0x2632('0x47')]);var _0x81047d={'where':_0x485094['where']};return db[_0x2632('0x35')][_0x2632('0x48')](_0x81047d)[_0x2632('0x2a')](function(_0x191fa2){_0x2696eb[_0x2632('0x48')]=_0x191fa2;if(_0x250107[_0x2632('0x39')][_0x2632('0x49')]){_0x485094[_0x2632('0x4a')]=[{'all':!![]}];}return db[_0x2632('0x35')][_0x2632('0x4b')](_0x485094);})[_0x2632('0x2a')](function(_0x132ad6){_0x2696eb['rows']=_0x132ad6;return _0x2696eb;})['then'](respondWithFilteredResult(_0xfc6741,_0x485094))[_0x2632('0x4c')](handleError(_0xfc6741,null));};exports[_0x2632('0x4d')]=function(_0x4842fc,_0x34dafc){var _0x2839cc={'raw':!![],'where':{'id':_0x4842fc[_0x2632('0x4e')]['id']}},_0x3a1434={};_0x3a1434[_0x2632('0x38')]=_[_0x2632('0x4f')](db[_0x2632('0x35')]['rawAttributes']);_0x3a1434[_0x2632('0x39')]=_[_0x2632('0x4f')](_0x4842fc[_0x2632('0x39')]);_0x3a1434['filters']=_[_0x2632('0x3a')](_0x3a1434[_0x2632('0x38')],_0x3a1434[_0x2632('0x39')]);_0x2839cc[_0x2632('0x3b')]=_[_0x2632('0x3a')](_0x3a1434[_0x2632('0x38')],qs[_0x2632('0x3c')](_0x4842fc[_0x2632('0x39')][_0x2632('0x3c')]));_0x2839cc[_0x2632('0x3b')]=_0x2839cc[_0x2632('0x3b')][_0x2632('0x3d')]?_0x2839cc[_0x2632('0x3b')]:_0x3a1434[_0x2632('0x38')];if(_0x4842fc['query'][_0x2632('0x49')]){_0x2839cc[_0x2632('0x4a')]=[{'all':!![]}];}_0x2839cc=_[_0x2632('0x45')]({},_0x2839cc,_0x4842fc['options']);return db[_0x2632('0x35')][_0x2632('0x50')](_0x2839cc)[_0x2632('0x2a')](handleEntityNotFound(_0x34dafc,null))[_0x2632('0x2a')](respondWithResult(_0x34dafc,null))[_0x2632('0x4c')](handleError(_0x34dafc,null));};exports[_0x2632('0x51')]=function(_0x424982,_0x27e7ae,_0x2878f7){return db[_0x2632('0x35')]['find']({'where':{'id':_0x424982[_0x2632('0x4e')]['id']},'attributes':[_0x2632('0x31'),'path'],'raw':!![]})[_0x2632('0x2a')](handleEntityNotFound(_0x27e7ae,null))[_0x2632('0x2a')](function(_0x5d6323){if(_0x5d6323){var _0x59b7be=path['join'](config[_0x2632('0x52')],_0x2632('0x53'),util[_0x2632('0x54')](_0x2632('0x55'),path['basename'](_0x5d6323[_0x2632('0x56')])));var _0x1d576d=fs[_0x2632('0x57')](_0x59b7be);var _0x50f93d=archiver(_0x2632('0x58'),{'zlib':{'level':0x9}});_0x50f93d['on'](_0x2632('0x59'),function(_0x779d2b){if(_0x779d2b[_0x2632('0x5a')]==='ENOENT'){logger[_0x2632('0x2f')](_0x779d2b);}else{throw new db[(_0x2632('0x5b'))][(_0x2632('0x5c'))](_0x2632('0x5d'));}});_0x50f93d['on']('error',function(_0x238fbc){throw new db[(_0x2632('0x5b'))][(_0x2632('0x5c'))](_0x2632('0x5d'));});_0x50f93d[_0x2632('0x5e')](_0x1d576d);_0x50f93d[_0x2632('0x5f')](_0x2632('0x60'),{'cwd':path['join'](config[_0x2632('0x52')],_0x2632('0x53'),path[_0x2632('0x61')](_0x5d6323[_0x2632('0x56')])),'ignore':[path[_0x2632('0x62')](path[_0x2632('0x63')](_0x5d6323[_0x2632('0x56')]),_0x2632('0x64')),path['join'](path[_0x2632('0x63')](_0x5d6323[_0x2632('0x56')]),'attachments/**/*')],'nodir':!![]})[_0x2632('0x65')]();_0x1d576d['on'](_0x2632('0x66'),function(){if(!fs[_0x2632('0x67')](_0x59b7be)){throw new db[(_0x2632('0x5b'))]['Error'](_0x2632('0x68'));}return _0x27e7ae[_0x2632('0x51')](_0x59b7be,util[_0x2632('0x54')](_0x2632('0x55'),path[_0x2632('0x63')](_0x5d6323[_0x2632('0x56')])),function(_0x199ce2){if(_0x199ce2){throw new db['Sequelize'][(_0x2632('0x5c'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x59b7be);logger[_0x2632('0x69')](_0x2632('0x6a'));logger[_0x2632('0x69')](_0x2632('0x6b'));});});}return null;})[_0x2632('0x4c')](handleError(_0x27e7ae,null));};exports[_0x2632('0x6c')]=function(_0x53e8a7,_0x1c6d66,_0x2f6797){var _0xdaff7e=path[_0x2632('0x63')](_0x53e8a7['file'][_0x2632('0x6d')],path[_0x2632('0x6e')](_0x53e8a7['file'][_0x2632('0x6d')]));var _0x3fabd7=path[_0x2632('0x62')](config[_0x2632('0x52')],_0x2632('0x53'),_0x53e8a7[_0x2632('0x6f')]['filename']);var _0x40a6a3=path[_0x2632('0x62')](config[_0x2632('0x52')],_0x2632('0x53'),_0xdaff7e);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x3fabd7);logger[_0x2632('0x69')](_0x2632('0x70'),_0x40a6a3);try{fs[_0x2632('0x71')](_0x3fabd7,parseInt(_0x2632('0x72'),0x8));extract(_0x3fabd7,{'dir':_0x40a6a3},function(_0x2885f3){if(_0x2885f3){logger['error'](_0x2885f3);handleError(_0x2885f3,!![]);};var _0x1ff83f=fs[_0x2632('0x73')](_0x40a6a3);if(_0x1ff83f[_0x2632('0x3d')]>0x1){removeReferences(_0x3fabd7,_0x40a6a3);logger[_0x2632('0x2f')](_0x2632('0x74'));return _0x2f6797(new Error(_0x2632('0x74')));}var _0x10cf75=fs[_0x2632('0x75')](path[_0x2632('0x62')](_0x40a6a3,_0x1ff83f[0x0]));if(_0x10cf75[_0x2632('0x76')]()){removeReferences(_0x3fabd7,_0x40a6a3);logger[_0x2632('0x2f')]('Invalid\x20plugin\x20structure');return _0x2f6797(new Error('Invalid\x20plugin\x20structure'));}if(_0x10cf75[_0x2632('0x77')]()){var _0xb5851d=fs[_0x2632('0x73')](path[_0x2632('0x62')](_0x40a6a3,_0x1ff83f[0x0]));if(_0xb5851d[_0x2632('0x3d')]===0x0){removeReferences(_0x3fabd7,_0x40a6a3);logger[_0x2632('0x2f')](_0x2632('0x74'));return _0x2f6797(new Error(_0x2632('0x74')));}var _0x52c980=_0xb5851d[_0x2632('0x78')](function(_0x2899ac){return _0x2899ac===_0x2632('0x79');});if(!_0x52c980){return _0x2f6797(new Error('Plugin\x20manifest\x20missing'));}var _0x2f6283=fs['readFileSync'](path[_0x2632('0x62')](_0x40a6a3,_0x1ff83f[0x0],_0x2632('0x79')));var _0x5c9db3=JSON[_0x2632('0x7a')](_0x2f6283);if(_0x2632('0x23')==typeof _0x5c9db3[_0x2632('0x31')]){return _0x2f6797(new Error(_0x2632('0x7b')));}if('undefined'==typeof _0x5c9db3[_0x2632('0x37')]){return _0x2f6797(new Error(_0x2632('0x7c')));}if('undefined'==typeof _0x5c9db3[_0x2632('0x7d')]){return _0x2f6797(new Error(_0x2632('0x7e')));}if(_0x2632('0x23')==typeof _0x5c9db3[_0x2632('0x7f')]){return _0x2f6797(new Error(_0x2632('0x80')));}if(_0x5c9db3[_0x2632('0x37')]===_0x2632('0x81')){if('undefined'==typeof _0x5c9db3[_0x2632('0x7f')][_0x2632('0x82')]){return _0x2f6797(new Error(_0x2632('0x83')));}if(_0x2632('0x23')==typeof _0x5c9db3[_0x2632('0x7f')][_0x2632('0x82')]['admin']&&_0x2632('0x23')==typeof _0x5c9db3[_0x2632('0x7f')][_0x2632('0x82')][_0x2632('0x84')]){return _0x2f6797(new Error(_0x2632('0x85')));}}else if(_0x5c9db3[_0x2632('0x37')]===_0x2632('0x86')){if(_0x2632('0x23')==typeof _0x5c9db3['parameters'][_0x2632('0x87')]){return _0x2f6797(new Error(_0x2632('0x88')));}if(_0x2632('0x23')==typeof _0x5c9db3[_0x2632('0x7f')][_0x2632('0x89')]){return _0x2f6797(new Error(_0x2632('0x8a')));}}else{return _0x2f6797(new Error(_0x2632('0x8b')));}var _0xdaa68b=_0x5c9db3['name'];var _0x2230eb=_0x5c9db3[_0x2632('0x8c')];var _0x5f3698=_0x5c9db3['type'];var _0x56409a=_0x5c9db3[_0x2632('0x8d')]?_0x5c9db3[_0x2632('0x8d')]:_0x2632('0x8e');var _0x5713ba=_0x5c9db3[_0x2632('0x8f')]?_0x5c9db3[_0x2632('0x8f')]:_0x2632('0x90');var _0x58bae5='';var _0x1c0c6a='';var _0x5e9c66='';var _0x11d179='';var _0x1612ea=_0x5c9db3[_0x2632('0x7d')];if(_0x5f3698===_0x2632('0x81')){if(_0x2632('0x23')!=typeof _0x5c9db3['parameters'][_0x2632('0x82')][_0x2632('0x91')]){var _0xe795fe=_0x5c9db3[_0x2632('0x7f')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x2632('0x92')](_0xe795fe)){_0x58bae5=path[_0x2632('0x62')](_0x2632('0x93'),_0xdaff7e,_0x1ff83f[0x0],_0xe795fe);}else{_0x58bae5=_0xe795fe;}}else{logger[_0x2632('0x69')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x2632('0x23')!=typeof _0x5c9db3[_0x2632('0x7f')][_0x2632('0x82')][_0x2632('0x84')]){var _0x43ea8d=_0x5c9db3[_0x2632('0x7f')][_0x2632('0x82')][_0x2632('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x2632('0x92')](_0x43ea8d)){_0x1c0c6a=path[_0x2632('0x62')]('plugins',_0xdaff7e,_0x1ff83f[0x0],_0x43ea8d);}else{_0x1c0c6a=_0x43ea8d;}}else{logger[_0x2632('0x69')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x5f3698===_0x2632('0x86')){_0x5e9c66=_0x5c9db3[_0x2632('0x7f')][_0x2632('0x87')];_0x11d179=_0x5c9db3[_0x2632('0x7f')][_0x2632('0x89')];if(_0x2632('0x23')!=typeof _0x5c9db3[_0x2632('0x7f')]['views']){if(_0x2632('0x23')!=typeof _0x5c9db3[_0x2632('0x7f')][_0x2632('0x82')][_0x2632('0x91')]){var _0xe795fe=_0x5c9db3[_0x2632('0x7f')][_0x2632('0x82')][_0x2632('0x91')];if(!/^(f|ht)tps?:\/\//i[_0x2632('0x92')](_0xe795fe)){_0x58bae5=path[_0x2632('0x62')](_0x2632('0x93'),_0xdaff7e,_0x1ff83f[0x0],_0xe795fe);}else{_0x58bae5=_0xe795fe;}}if(_0x2632('0x23')!=typeof _0x5c9db3[_0x2632('0x7f')]['views'][_0x2632('0x84')]){var _0x43ea8d=_0x5c9db3[_0x2632('0x7f')][_0x2632('0x82')][_0x2632('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x2632('0x92')](_0x43ea8d)){_0x1c0c6a=path['join'](_0x2632('0x93'),_0xdaff7e,_0x1ff83f[0x0],_0x43ea8d);}else{_0x1c0c6a=_0x43ea8d;}}}}var _0x5e0e29={'name':_0xdaa68b,'description':_0x2230eb,'path':path[_0x2632('0x62')](_0xdaff7e,_0x1ff83f[0x0]),'type':_0x5f3698,'sidebar':_0x56409a,'icon':_0x5713ba,'adminUrl':_0x58bae5,'agentUrl':_0x1c0c6a,'scriptName':_0x5e9c66,'scriptPath':_0x11d179,'version':_0x1612ea};removeReferences(_0x3fabd7,null);return db['Plugin']['create'](_0x5e0e29)[_0x2632('0x2a')](function(_0x969ac1){var _0x5650f7={'role':_0x53e8a7[_0x2632('0x94')]['role'],'userProfileId':_0x53e8a7['body'][_0x2632('0x95')]};if(!_0x5650f7)throw new Error(_0x2632('0x96'));if(_0x5650f7[_0x2632('0x97')]===_0x2632('0x98')){var _0x3a9753=_0x969ac1[_0x2632('0x2c')]({'plain':!![]});return db[_0x2632('0x99')][_0x2632('0x50')]({'where':{'name':_0x2632('0x2d'),'userProfileId':_0x5650f7['userProfileId']},'raw':!![]})[_0x2632('0x2a')](function(_0xf5522a){if(_0xf5522a&&_0xf5522a[_0x2632('0x9a')]===0x0){return db[_0x2632('0x2e')][_0x2632('0x9b')]({'name':_0x3a9753[_0x2632('0x31')],'resourceId':_0x3a9753['id'],'type':_0xf5522a[_0x2632('0x31')],'sectionId':_0xf5522a['id']},{})[_0x2632('0x2a')](function(){return _0x969ac1;});}else{return _0x969ac1;}})['catch'](function(_0xfc0d16){logger[_0x2632('0x2f')](_0x2632('0x9c'),_0xfc0d16);throw _0xfc0d16;});}return _0x969ac1;})[_0x2632('0x2a')](respondWithResult(_0x1c6d66,null))['catch'](handleError(_0x1c6d66,null));}});}catch(_0x128df7){_0x1c6d66['status'](0x1f4)[_0x2632('0x32')](_0x128df7);}};function removeReferences(_0x301b1c,_0x45985e){try{if(_0x301b1c){fs['unlinkSync'](_0x301b1c);logger['info'](_0x2632('0x9d'));}if(_0x45985e){rimraf(_0x45985e,function(){});logger[_0x2632('0x69')]('Extracted\x20folder\x20removed');}}catch(_0x2ce3c0){logger['error'](_0x2ce3c0);}}exports['update']=function(_0x414d1d,_0x464687,_0x5b76af){return db['Plugin'][_0x2632('0x50')]({'where':{'id':_0x414d1d[_0x2632('0x4e')]['id']}})['then'](handleEntityNotFound(_0x464687,null))[_0x2632('0x2a')](saveUpdates(_0x414d1d[_0x2632('0x94')],null))['then'](respondWithResult(_0x464687,null))[_0x2632('0x4c')](handleError(_0x464687,null));};exports['delete']=function(_0xc4bb65,_0x4b08cd,_0x249e25){return db[_0x2632('0x35')][_0x2632('0x50')]({'where':{'id':_0xc4bb65['params']['id']}})['then'](function(_0x46795e){if(_0x46795e){return _0x46795e[_0x2632('0x2b')]();}})[_0x2632('0x2a')](function(_0x44c67c){rimraf(path[_0x2632('0x62')](config[_0x2632('0x52')],'server/files/plugins',path[_0x2632('0x61')](_0x44c67c[_0x2632('0x56')])),function(){});return _0x44c67c;})[_0x2632('0x2a')](handleEntityNotFound(_0x4b08cd,null))[_0x2632('0x2a')](respondWithStatusCode(_0x4b08cd,null))[_0x2632('0x4c')](handleError(_0x4b08cd,null));};exports[_0x2632('0x9e')]=function(_0x2dea29,_0xf1fdbe,_0xa59398){return BPromise['resolve']()[_0x2632('0x2a')](function(){if(!_0x2dea29['query'][_0x2632('0x56')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2dea29[_0x2632('0x39')][_0x2632('0x9f')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1a19ad=_0x2dea29[_0x2632('0x39')]['hostname']?_0x2dea29[_0x2632('0x39')][_0x2632('0xa0')]+':'+_0x2dea29[_0x2632('0x39')]['port']:'http://localhost:'+_0x2dea29['query'][_0x2632('0x9f')];var _0x52d979=_0x2dea29[_0x2632('0x39')][_0x2632('0x27')]?_0x2dea29[_0x2632('0x39')][_0x2632('0x27')]:!![];var _0x105927=_0x2dea29[_0x2632('0x39')][_0x2632('0xa1')]?_0x2dea29[_0x2632('0x39')]['encoding']:null;var _0x184ee0={'method':_0x2dea29[_0x2632('0xa2')],'uri':util[_0x2632('0x54')]('%s%s',_0x1a19ad,_0x2dea29[_0x2632('0x39')]['path']),'json':_0x52d979,'resolveWithFullResponse':!![],'encoding':_0x105927,'qs':_0x2dea29['query']};if(_0x2dea29[_0x2632('0xa3')]){_0x184ee0[_0x2632('0xa3')]=_0x2dea29[_0x2632('0xa3')];if(_0x184ee0[_0x2632('0xa3')][_0x2632('0xa4')]){delete _0x184ee0[_0x2632('0xa3')][_0x2632('0xa4')];}}if(_0x184ee0[_0x2632('0xa3')][_0x2632('0xa5')]){delete _0x184ee0[_0x2632('0xa3')][_0x2632('0xa5')];}return rp(_0x184ee0);})['then'](function(_0x1a74c0){if(_0x1a74c0){_0xf1fdbe[_0x2632('0x25')](_0x1a74c0[_0x2632('0xa3')]);logger[_0x2632('0x69')](_0x1a74c0[_0x2632('0x94')]);if(_[_0x2632('0xa6')](_0x2dea29[_0x2632('0x39')][_0x2632('0x56')],_0x2632('0x51'))&&_0x1a74c0[_0x2632('0xa7')]==0x1f4){return _0xf1fdbe[_0x2632('0x1f')](_0x1a74c0[_0x2632('0xa7')]);}else{return _0xf1fdbe['status'](_0x1a74c0['statusCode'])['send'](_0x1a74c0[_0x2632('0x94')]);}}else{return _0xf1fdbe[_0x2632('0x1f')](0xc8);}})['catch'](handleError(_0xf1fdbe,null));};exports[_0x2632('0xa8')]=function(_0x241901,_0x347b03,_0x3da9d0){return BPromise[_0x2632('0xa9')]()[_0x2632('0x2a')](function(){if(!_0x241901[_0x2632('0x39')]['path']){throw new Error(_0x2632('0xaa'));}if(!_0x241901[_0x2632('0x39')][_0x2632('0x9f')]){throw new Error(_0x2632('0xab'));}var _0x3155a1=_0x241901[_0x2632('0x39')]['hostname']?_0x241901[_0x2632('0x39')][_0x2632('0xa0')]+':'+_0x241901[_0x2632('0x39')][_0x2632('0x9f')]:_0x2632('0xac')+_0x241901['query'][_0x2632('0x9f')];var _0x24a530=_0x241901[_0x2632('0x39')][_0x2632('0x27')]?_0x241901[_0x2632('0x39')][_0x2632('0x27')]:!![];var _0x4cfabf=_0x241901[_0x2632('0x39')]['encoding']?_0x241901[_0x2632('0x39')][_0x2632('0xa1')]:null;var _0x21c7f7={'method':_0x241901[_0x2632('0xa2')],'uri':util['format'](_0x2632('0xad'),_0x3155a1,_0x241901[_0x2632('0x39')][_0x2632('0x56')]),'json':_0x24a530,'resolveWithFullResponse':!![],'encoding':_0x4cfabf,'body':_0x241901[_0x2632('0x94')]};if(_0x241901[_0x2632('0xa3')]){_0x21c7f7[_0x2632('0xa3')]=_0x241901[_0x2632('0xa3')];if(_0x21c7f7['headers']['content-length']){delete _0x21c7f7[_0x2632('0xa3')]['content-length'];}}if(_0x21c7f7[_0x2632('0xa3')][_0x2632('0xa5')]){delete _0x21c7f7['headers'][_0x2632('0xa5')];}return rp(_0x21c7f7);})[_0x2632('0x2a')](function(_0x3d67e6){if(_0x3d67e6){_0x347b03['set'](_0x3d67e6['headers']);logger['info'](_0x3d67e6[_0x2632('0x94')]);return _0x347b03['status'](_0x3d67e6[_0x2632('0xa7')])['send'](_0x3d67e6[_0x2632('0x94')]);}else{return _0x347b03[_0x2632('0x1f')](0xc8);}})[_0x2632('0x4c')](handleError(_0x347b03,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 7b8925a..191f102 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 _0x2484=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0xd1fff8,_0x13ad07){var _0x1fa31e=function(_0x3a54d0){while(--_0x3a54d0){_0xd1fff8['push'](_0xd1fff8['shift']());}};_0x1fa31e(++_0x13ad07);}(_0x2484,0x178));var _0x4248=function(_0x109dbd,_0x290d2b){_0x109dbd=_0x109dbd-0x0;var _0x395644=_0x2484[_0x109dbd];return _0x395644;};'use strict';var EventEmitter=require(_0x4248('0x0'));var Plugin=require(_0x4248('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x4248('0x2')](0x0);var events={'afterCreate':_0x4248('0x3'),'afterUpdate':_0x4248('0x4'),'afterDestroy':_0x4248('0x5')};function emitEvent(_0x20f0ec){return function(_0x3f98a6,_0x42b611,_0x588b99){PluginEvents[_0x4248('0x6')](_0x20f0ec+':'+_0x3f98a6['id'],_0x3f98a6);PluginEvents[_0x4248('0x6')](_0x20f0ec,_0x3f98a6);_0x588b99(null);};}for(var e in events){if(events[_0x4248('0x7')](e)){var event=events[e];Plugin[_0x4248('0x8')](e,emitEvent(event));}}module[_0x4248('0x9')]=PluginEvents; \ No newline at end of file +var _0x5e0c=['Plugin','setMaxListeners','save','update','remove','emit','exports','../../mysqldb'];(function(_0x8f2981,_0xd648d6){var _0x2cde7b=function(_0x684c25){while(--_0x684c25){_0x8f2981['push'](_0x8f2981['shift']());}};_0x2cde7b(++_0xd648d6);}(_0x5e0c,0x19f));var _0xc5e0=function(_0xf1af27,_0x598bb1){_0xf1af27=_0xf1af27-0x0;var _0x46b274=_0x5e0c[_0xf1af27];return _0x46b274;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xc5e0('0x0'))['db'][_0xc5e0('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xc5e0('0x2')](0x0);var events={'afterCreate':_0xc5e0('0x3'),'afterUpdate':_0xc5e0('0x4'),'afterDestroy':_0xc5e0('0x5')};function emitEvent(_0x4adda8){return function(_0x60c6c3,_0x108ea2,_0x43f754){PluginEvents[_0xc5e0('0x6')](_0x4adda8+':'+_0x60c6c3['id'],_0x60c6c3);PluginEvents[_0xc5e0('0x6')](_0x4adda8,_0x60c6c3);_0x43f754(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xc5e0('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 3b3d504..c3aa71c 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 _0x138c=['request-promise','path','rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','util','../../config/logger','api'];(function(_0x2b2b9a,_0x2a67a6){var _0x4e755e=function(_0x51c294){while(--_0x51c294){_0x2b2b9a['push'](_0x2b2b9a['shift']());}};_0x4e755e(++_0x2a67a6);}(_0x138c,0x13c));var _0xc138=function(_0x3f7afa,_0x3063e1){_0x3f7afa=_0x3f7afa-0x0;var _0x21b4a1=_0x138c[_0x3f7afa];return _0x21b4a1;};'use strict';var _=require('lodash');var util=require(_0xc138('0x0'));var logger=require(_0xc138('0x1'))(_0xc138('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc138('0x3'));var fs=require('fs');var path=require(_0xc138('0x4'));var rimraf=require(_0xc138('0x5'));var config=require(_0xc138('0x6'));var attributes=require(_0xc138('0x7'));module['exports']=function(_0x2b92dd,_0x25dfc9){return _0x2b92dd[_0xc138('0x8')](_0xc138('0x9'),attributes,{'tableName':_0xc138('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebd1=['util','api','moment','bluebird','request-promise','rimraf','exports','define','plugins','lodash'];(function(_0x3282cf,_0x5107d0){var _0x2e6730=function(_0x22bc31){while(--_0x22bc31){_0x3282cf['push'](_0x3282cf['shift']());}};_0x2e6730(++_0x5107d0);}(_0xebd1,0x1df));var _0x1ebd=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0xebd1[_0x459423];return _0x42ed14;};'use strict';var _=require(_0x1ebd('0x0'));var util=require(_0x1ebd('0x1'));var logger=require('../../config/logger')(_0x1ebd('0x2'));var moment=require(_0x1ebd('0x3'));var BPromise=require(_0x1ebd('0x4'));var rp=require(_0x1ebd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ebd('0x6'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0x1ebd('0x7')]=function(_0xb2cc22,_0x1afce7){return _0xb2cc22[_0x1ebd('0x8')]('Plugin',attributes,{'tableName':_0x1ebd('0x9'),'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 901810f..da8614e 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 _0xeaaf=['result','catch','CreatePlugin','Plugin','create','body','options','info','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','request\x20sent','stringify','error','code','message','Plugin,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xeaaf,0x1c8));var _0xfeaa=function(_0x4b4dfe,_0x3d3c96){_0x4b4dfe=_0x4b4dfe-0x0;var _0x53e84f=_0xeaaf[_0x4b4dfe];return _0x53e84f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfeaa('0x0'));var BPromise=require(_0xfeaa('0x1'));var rs=require(_0xfeaa('0x2'));var fs=require('fs');var Redis=require(_0xfeaa('0x3'));var db=require(_0xfeaa('0x4'))['db'];var utils=require(_0xfeaa('0x5'));var logger=require(_0xfeaa('0x6'))(_0xfeaa('0x7'));var config=require('../../config/environment');var jayson=require(_0xfeaa('0x8'));var client=jayson[_0xfeaa('0x9')]['http']({'port':0x232a});config[_0xfeaa('0xa')]=_[_0xfeaa('0xb')](config[_0xfeaa('0xa')],{'host':_0xfeaa('0xc'),'port':0x18eb});var socket=require(_0xfeaa('0xd'))(new Redis(config['redis']));require(_0xfeaa('0xe'))[_0xfeaa('0xf')](socket);function respondWithRpcPromise(_0x393d0a,_0x158bb3,_0x1f6c06){return new BPromise(function(_0x5919d5,_0x26934a){return client[_0xfeaa('0x10')](_0x393d0a,_0x1f6c06)[_0xfeaa('0x11')](function(_0x2eb3bf){logger['info']('Plugin,\x20%s,\x20%s',_0x158bb3,'request\x20sent');logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x158bb3,_0xfeaa('0x12'),JSON[_0xfeaa('0x13')](_0x2eb3bf));if(_0x2eb3bf[_0xfeaa('0x14')]){if(_0x2eb3bf[_0xfeaa('0x14')][_0xfeaa('0x15')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x158bb3,_0x2eb3bf[_0xfeaa('0x14')]['message']);return _0x26934a(_0x2eb3bf[_0xfeaa('0x14')][_0xfeaa('0x16')]);}logger[_0xfeaa('0x14')](_0xfeaa('0x17'),_0x158bb3,_0x2eb3bf['error']['message']);return _0x5919d5(_0x2eb3bf[_0xfeaa('0x14')][_0xfeaa('0x16')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x158bb3,'request\x20sent');_0x5919d5(_0x2eb3bf[_0xfeaa('0x18')]['message']);}})[_0xfeaa('0x19')](function(_0x5c1030){logger[_0xfeaa('0x14')]('Plugin,\x20%s,\x20%s',_0x158bb3,_0x5c1030);_0x26934a(_0x5c1030);});});}exports[_0xfeaa('0x1a')]=function(_0x3ea5ca){var _0xd2ce80=this;return new Promise(function(_0xdf3a12,_0x63b415){return db[_0xfeaa('0x1b')][_0xfeaa('0x1c')](_0x3ea5ca[_0xfeaa('0x1d')],{'raw':_0x3ea5ca[_0xfeaa('0x1e')]?_0x3ea5ca[_0xfeaa('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xfeaa('0x11')](function(_0x4593fe){logger[_0xfeaa('0x1f')]('CreatePlugin',_0x3ea5ca);logger['debug']('CreatePlugin',_0x3ea5ca,JSON['stringify'](_0x4593fe));_0xdf3a12(_0x4593fe);})[_0xfeaa('0x19')](function(_0x137621){logger[_0xfeaa('0x14')](_0xfeaa('0x1a'),_0x137621[_0xfeaa('0x16')],_0x3ea5ca);_0x63b415(_0xd2ce80[_0xfeaa('0x14')](0x1f4,_0x137621[_0xfeaa('0x16')]));});});}; \ No newline at end of file +var _0x2439=['Plugin,\x20%s,\x20%s','message','result','catch','CreatePlugin','Plugin','create','options','raw','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x32724a,_0x242334){var _0x39c409=function(_0x1461c2){while(--_0x1461c2){_0x32724a['push'](_0x32724a['shift']());}};_0x39c409(++_0x242334);}(_0x2439,0x155));var _0x9243=function(_0x35c1db,_0xd75c15){_0x35c1db=_0x35c1db-0x0;var _0x4173ff=_0x2439[_0x35c1db];return _0x4173ff;};'use strict';var _=require(_0x9243('0x0'));var util=require(_0x9243('0x1'));var moment=require(_0x9243('0x2'));var BPromise=require(_0x9243('0x3'));var rs=require(_0x9243('0x4'));var fs=require('fs');var Redis=require(_0x9243('0x5'));var db=require(_0x9243('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9243('0x7'))('rpc');var config=require(_0x9243('0x8'));var jayson=require(_0x9243('0x9'));var client=jayson[_0x9243('0xa')][_0x9243('0xb')]({'port':0x232a});config[_0x9243('0xc')]=_[_0x9243('0xd')](config[_0x9243('0xc')],{'host':_0x9243('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9243('0xc')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x5dddc8,_0x4f6790,_0x4345cf){return new BPromise(function(_0x1d5e7d,_0x319621){return client[_0x9243('0xf')](_0x5dddc8,_0x4345cf)['then'](function(_0x4614f4){logger[_0x9243('0x10')]('Plugin,\x20%s,\x20%s',_0x4f6790,_0x9243('0x11'));logger[_0x9243('0x12')](_0x9243('0x13'),_0x4f6790,'request\x20sent',JSON['stringify'](_0x4614f4));if(_0x4614f4['error']){if(_0x4614f4[_0x9243('0x14')][_0x9243('0x15')]===0x1f4){logger['error'](_0x9243('0x16'),_0x4f6790,_0x4614f4[_0x9243('0x14')][_0x9243('0x17')]);return _0x319621(_0x4614f4[_0x9243('0x14')][_0x9243('0x17')]);}logger[_0x9243('0x14')](_0x9243('0x16'),_0x4f6790,_0x4614f4[_0x9243('0x14')][_0x9243('0x17')]);return _0x1d5e7d(_0x4614f4[_0x9243('0x14')][_0x9243('0x17')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x4f6790,'request\x20sent');_0x1d5e7d(_0x4614f4[_0x9243('0x18')]['message']);}})[_0x9243('0x19')](function(_0x530f75){logger[_0x9243('0x14')](_0x9243('0x16'),_0x4f6790,_0x530f75);_0x319621(_0x530f75);});});}exports[_0x9243('0x1a')]=function(_0x29f5b3){var _0x59afdd=this;return new Promise(function(_0x2ad714,_0x343518){return db[_0x9243('0x1b')][_0x9243('0x1c')](_0x29f5b3['body'],{'raw':_0x29f5b3[_0x9243('0x1d')]?_0x29f5b3[_0x9243('0x1d')][_0x9243('0x1e')]===undefined?!![]:![]:!![]})[_0x9243('0x1f')](function(_0x3504c7){logger[_0x9243('0x10')](_0x9243('0x1a'),_0x29f5b3);logger[_0x9243('0x12')](_0x9243('0x1a'),_0x29f5b3,JSON[_0x9243('0x20')](_0x3504c7));_0x2ad714(_0x3504c7);})[_0x9243('0x19')](function(_0x2343fc){logger['error']('CreatePlugin',_0x2343fc[_0x9243('0x17')],_0x29f5b3);_0x343518(_0x59afdd[_0x9243('0x14')](0x1f4,_0x2343fc[_0x9243('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 16ab73e..3d24766 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 _0xb984=['plugin:','save','remove','update','emit','removeListener','register'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xb984,0xef));var _0x4b98=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xb984[_0x138f59];return _0x3d114d;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x4b98('0x0'),_0x4b98('0x1'),_0x4b98('0x2')];function createListener(_0x453a2e,_0x2c209c){return function(_0x55ca75){_0x2c209c[_0x4b98('0x3')](_0x453a2e,_0x55ca75);};}function removeListener(_0x556970,_0x40a194){return function(){PluginEvents[_0x4b98('0x4')](_0x556970,_0x40a194);};}exports[_0x4b98('0x5')]=function(_0x3bb435){for(var _0x38e15f=0x0,_0x1c8e13=events['length'];_0x38e15f<_0x1c8e13;_0x38e15f++){var _0x2359af=events[_0x38e15f];var _0x546838=createListener(_0x4b98('0x6')+_0x2359af,_0x3bb435);PluginEvents['on'](_0x2359af,_0x546838);}}; \ No newline at end of file +var _0x1cdb=['length','./plugin.events','save','remove','update','emit','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1cdb,0x179));var _0xb1cd=function(_0x41a5a5,_0x6ff62c){_0x41a5a5=_0x41a5a5-0x0;var _0x1f8471=_0x1cdb[_0x41a5a5];return _0x1f8471;};'use strict';var PluginEvents=require(_0xb1cd('0x0'));var events=[_0xb1cd('0x1'),_0xb1cd('0x2'),_0xb1cd('0x3')];function createListener(_0x560679,_0x4d9ba2){return function(_0x1dc090){_0x4d9ba2[_0xb1cd('0x4')](_0x560679,_0x1dc090);};}function removeListener(_0x3dd3f9,_0x4f7d88){return function(){PluginEvents[_0xb1cd('0x5')](_0x3dd3f9,_0x4f7d88);};}exports[_0xb1cd('0x6')]=function(_0x6a8520){for(var _0x23c0a0=0x0,_0x468b20=events[_0xb1cd('0x7')];_0x23c0a0<_0x468b20;_0x23c0a0++){var _0x90b770=events[_0x23c0a0];var _0x4923ed=createListener('plugin:'+_0x90b770,_0x6a8520);PluginEvents['on'](_0x90b770,_0x4923ed);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 318d859..8dc85b8 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(_0x42d807,_0x466d1c){var _0x2b4c01=function(_0x10b78d){while(--_0x10b78d){_0x42d807['push'](_0x42d807['shift']());}};_0x2b4c01(++_0x466d1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 dce6a7f..b718785 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 _0x0713=['Unknown\x20status','destroy','../../config/logger','api','path','child_process','exec','sendStatus','status','json','error','name','send','npm\x20install','info','index','list','reject','express','motion2','length','then','catch','show','describe','params','create','body','../../files/plugins','script','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty'];(function(_0x1caf3f,_0x1b4800){var _0x1905f0=function(_0x36e1eb){while(--_0x36e1eb){_0x1caf3f['push'](_0x1caf3f['shift']());}};_0x1905f0(++_0x1b4800);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var path=require(_0x3071('0x2'));var exec=require(_0x3071('0x3'))[_0x3071('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x2c547f,_0x7b18a4){return function(_0x33a70c){if(!_0x33a70c){_0x2c547f[_0x3071('0x5')](0x194);;}return _0x33a70c;};}function respondWithResult(_0xabd7b6,_0x41cf76){_0x41cf76=_0x41cf76||0xc8;return function(_0x1d3dd6){if(_0x1d3dd6){return _0xabd7b6[_0x3071('0x6')](_0x41cf76)[_0x3071('0x7')](_0x1d3dd6);}return null;};}function handleError(_0x22274c,_0x3e9a5e){_0x3e9a5e=_0x3e9a5e||0x1f4;return function(_0x2fce7a){logger[_0x3071('0x8')](_0x2fce7a['stack']);if(_0x2fce7a[_0x3071('0x9')]){delete _0x2fce7a[_0x3071('0x9')];}_0x22274c[_0x3071('0x6')](_0x3e9a5e)[_0x3071('0xa')](_0x2fce7a);};}function execChildProcess(){return new BPromise(function(_0x1ce844,_0x4a470a){exec(_0x3071('0xb'),function(_0x11a7ee,_0x401b4d,_0x3ed4a0){logger[_0x3071('0xc')](_0x401b4d);logger['info'](_0x3ed4a0);if(_0x11a7ee){logger['error'](_0x11a7ee);return _0x4a470a(_0x11a7ee);}return _0x1ce844(_0x401b4d);});});}exports[_0x3071('0xd')]=function(_0x5dc13b,_0x31c220){return pm2[_0x3071('0xe')]()['then'](function(_0x104e73){if(_0x104e73){var _0x4e1219=_[_0x3071('0xf')](_0x104e73,function(_0x45c93b){return _0x45c93b[_0x3071('0x9')]===_0x3071('0x10')||_0x45c93b[_0x3071('0x9')]===_0x3071('0x11');});return{'rows':_0x4e1219,'count':_0x4e1219[_0x3071('0x12')]};}return null;})[_0x3071('0x13')](respondWithResult(_0x31c220,null))[_0x3071('0x14')](handleError(_0x31c220,null));};exports[_0x3071('0x15')]=function(_0x5f3c22,_0x224996){return pm2[_0x3071('0x16')](_0x5f3c22[_0x3071('0x17')]['id'])[_0x3071('0x13')](respondWithResult(_0x224996,null))[_0x3071('0x13')](handleEntityNotFound(_0x224996,null))[_0x3071('0x14')](handleError(_0x224996,null));};exports[_0x3071('0x18')]=function(_0x26f113,_0x502a16){if(_0x26f113[_0x3071('0x19')][_0x3071('0x9')]&&_0x26f113[_0x3071('0x19')]['script']){var _0xb8f4e3=path['join'](__dirname,_0x3071('0x1a'),_0x26f113[_0x3071('0x19')][_0x3071('0x1b')]);var _0x457b57=process[_0x3071('0x1c')]();process[_0x3071('0x1d')](path[_0x3071('0x1e')](_0xb8f4e3));return execChildProcess()[_0x3071('0x13')](function(_0x542646){process['chdir'](_0x457b57);return pm2[_0x3071('0x1f')]({'name':_0x26f113[_0x3071('0x19')][_0x3071('0x9')],'script':_0xb8f4e3});})[_0x3071('0x13')](function(_0x2793ef){pm2[_0x3071('0x20')]();return _0x2793ef[0x0];})[_0x3071('0x13')](respondWithResult(_0x502a16,0xc9))[_0x3071('0x14')](handleError(_0x502a16,null));}else{return _0x502a16[_0x3071('0x6')](0x1f4)['send']({'message':_0x3071('0x21')});}};exports[_0x3071('0x22')]=function(_0x177138,_0x4d5c4b){if(_0x177138[_0x3071('0x19')]['id']){delete _0x177138[_0x3071('0x19')]['id'];}var _0x163604={'online':_0x3071('0x23'),'stopped':_0x3071('0x24')};if(_0x163604[_0x3071('0x25')](_0x177138[_0x3071('0x19')][_0x3071('0x6')])){return pm2[_0x163604[_0x177138[_0x3071('0x19')][_0x3071('0x6')]]](_0x177138[_0x3071('0x17')]['id'])['then'](respondWithResult(_0x4d5c4b,0xc8))['catch'](handleError(_0x4d5c4b,null));}else{return _0x4d5c4b[_0x3071('0x6')](0x1f4)[_0x3071('0xa')]({'message':_0x3071('0x26')});}};exports[_0x3071('0x27')]=function(_0x3f6d90,_0x29538c){if(_0x3f6d90[_0x3071('0x19')]['id']){delete _0x3f6d90[_0x3071('0x19')]['id'];}if(_0x3f6d90['params']['id']){return pm2['delete'](_0x3f6d90['params']['id'])[_0x3071('0x13')](function(_0x392800){pm2['dump']();return _0x392800[0x0];})[_0x3071('0x13')](respondWithResult(_0x29538c,null))[_0x3071('0x14')](handleError(_0x29538c,null));}else{return _0x29538c[_0x3071('0x6')](0x1f4)[_0x3071('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xda55=['Unknown\x20id','lodash','../../config/pm2','path','child_process','exec','bluebird','status','json','error','stack','name','send','npm\x20install','info','index','list','then','express','motion2','length','show','describe','params','catch','create','body','script','../../files/plugins','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty'];(function(_0x3a4d49,_0x3f1836){var _0x1a98d7=function(_0x162852){while(--_0x162852){_0x3a4d49['push'](_0x3a4d49['shift']());}};_0x1a98d7(++_0x3f1836);}(_0xda55,0x6d));var _0x5da5=function(_0x410c09,_0xe6e6ac){_0x410c09=_0x410c09-0x0;var _0x4d232d=_0xda55[_0x410c09];return _0x4d232d;};'use strict';var _=require(_0x5da5('0x0'));var pm2=require(_0x5da5('0x1'));var logger=require('../../config/logger')('api');var path=require(_0x5da5('0x2'));var exec=require(_0x5da5('0x3'))[_0x5da5('0x4')];var BPromise=require(_0x5da5('0x5'));function handleEntityNotFound(_0x1c3afd,_0x5da254){return function(_0x3400e9){if(!_0x3400e9){_0x1c3afd['sendStatus'](0x194);;}return _0x3400e9;};}function respondWithResult(_0x356a37,_0x58e7b3){_0x58e7b3=_0x58e7b3||0xc8;return function(_0x2fd877){if(_0x2fd877){return _0x356a37[_0x5da5('0x6')](_0x58e7b3)[_0x5da5('0x7')](_0x2fd877);}return null;};}function handleError(_0x46290d,_0x3debdf){_0x3debdf=_0x3debdf||0x1f4;return function(_0x25c873){logger[_0x5da5('0x8')](_0x25c873[_0x5da5('0x9')]);if(_0x25c873['name']){delete _0x25c873[_0x5da5('0xa')];}_0x46290d[_0x5da5('0x6')](_0x3debdf)[_0x5da5('0xb')](_0x25c873);};}function execChildProcess(){return new BPromise(function(_0x26fbe3,_0x1a047e){exec(_0x5da5('0xc'),function(_0x33313e,_0x589c14,_0x2f4e4b){logger[_0x5da5('0xd')](_0x589c14);logger['info'](_0x2f4e4b);if(_0x33313e){logger[_0x5da5('0x8')](_0x33313e);return _0x1a047e(_0x33313e);}return _0x26fbe3(_0x589c14);});});}exports[_0x5da5('0xe')]=function(_0x3ced00,_0x43d526){return pm2[_0x5da5('0xf')]()[_0x5da5('0x10')](function(_0x481562){if(_0x481562){var _0x489b60=_['reject'](_0x481562,function(_0x4267cd){return _0x4267cd[_0x5da5('0xa')]===_0x5da5('0x11')||_0x4267cd[_0x5da5('0xa')]===_0x5da5('0x12');});return{'rows':_0x489b60,'count':_0x489b60[_0x5da5('0x13')]};}return null;})[_0x5da5('0x10')](respondWithResult(_0x43d526,null))['catch'](handleError(_0x43d526,null));};exports[_0x5da5('0x14')]=function(_0x290136,_0x1a4849){return pm2[_0x5da5('0x15')](_0x290136[_0x5da5('0x16')]['id'])[_0x5da5('0x10')](respondWithResult(_0x1a4849,null))['then'](handleEntityNotFound(_0x1a4849,null))[_0x5da5('0x17')](handleError(_0x1a4849,null));};exports[_0x5da5('0x18')]=function(_0x3d3d26,_0x30cde5){if(_0x3d3d26[_0x5da5('0x19')]['name']&&_0x3d3d26[_0x5da5('0x19')][_0x5da5('0x1a')]){var _0x42a3cb=path['join'](__dirname,_0x5da5('0x1b'),_0x3d3d26[_0x5da5('0x19')][_0x5da5('0x1a')]);var _0x2e68d5=process[_0x5da5('0x1c')]();process[_0x5da5('0x1d')](path['dirname'](_0x42a3cb));return execChildProcess()[_0x5da5('0x10')](function(_0x568ddf){process[_0x5da5('0x1d')](_0x2e68d5);return pm2[_0x5da5('0x1e')]({'name':_0x3d3d26[_0x5da5('0x19')]['name'],'script':_0x42a3cb});})[_0x5da5('0x10')](function(_0x236bf3){pm2[_0x5da5('0x1f')]();return _0x236bf3[0x0];})[_0x5da5('0x10')](respondWithResult(_0x30cde5,0xc9))['catch'](handleError(_0x30cde5,null));}else{return _0x30cde5['status'](0x1f4)['send']({'message':_0x5da5('0x20')});}};exports['update']=function(_0x4e8890,_0x1f75f3){if(_0x4e8890[_0x5da5('0x19')]['id']){delete _0x4e8890['body']['id'];}var _0x1798ae={'online':_0x5da5('0x21'),'stopped':'stop'};if(_0x1798ae[_0x5da5('0x22')](_0x4e8890[_0x5da5('0x19')][_0x5da5('0x6')])){return pm2[_0x1798ae[_0x4e8890[_0x5da5('0x19')][_0x5da5('0x6')]]](_0x4e8890['params']['id'])[_0x5da5('0x10')](respondWithResult(_0x1f75f3,0xc8))[_0x5da5('0x17')](handleError(_0x1f75f3,null));}else{return _0x1f75f3[_0x5da5('0x6')](0x1f4)[_0x5da5('0xb')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x4cb022,_0x245273){if(_0x4cb022[_0x5da5('0x19')]['id']){delete _0x4cb022[_0x5da5('0x19')]['id'];}if(_0x4cb022[_0x5da5('0x16')]['id']){return pm2['delete'](_0x4cb022['params']['id'])[_0x5da5('0x10')](function(_0x4afb58){pm2['dump']();return _0x4afb58[0x0];})[_0x5da5('0x10')](respondWithResult(_0x245273,null))['catch'](handleError(_0x245273,null));}else{return _0x245273[_0x5da5('0x6')](0x1f4)[_0x5da5('0xb')]({'message':_0x5da5('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index d2aaac7..616d6fd 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 _0xf36b=['../../components/auth/service','./realtime.controller','/agents','isAuthenticated','getAgents','get','/queues','exports','express'];(function(_0x24087b,_0x10c09a){var _0x1ba8e4=function(_0x519f32){while(--_0x519f32){_0x24087b['push'](_0x24087b['shift']());}};_0x1ba8e4(++_0x10c09a);}(_0xf36b,0x98));var _0xbf36=function(_0x3e721b,_0x5d7898){_0x3e721b=_0x3e721b-0x0;var _0x108956=_0xf36b[_0x3e721b];return _0x108956;};'use strict';var express=require(_0xbf36('0x0'));var router=express['Router']();var auth=require(_0xbf36('0x1'));var controller=require(_0xbf36('0x2'));router['get'](_0xbf36('0x3'),auth[_0xbf36('0x4')](),controller[_0xbf36('0x5')]);router[_0xbf36('0x6')](_0xbf36('0x7'),auth['isAuthenticated'](),controller['getQueues']);module[_0xbf36('0x8')]=router; \ No newline at end of file +var _0x27ab=['./realtime.controller','/agents','get','/queues','isAuthenticated','getQueues','exports','express','Router','../../components/auth/service'];(function(_0x4b08a7,_0x4ae9c7){var _0x36ea7e=function(_0x389afa){while(--_0x389afa){_0x4b08a7['push'](_0x4b08a7['shift']());}};_0x36ea7e(++_0x4ae9c7);}(_0x27ab,0x151));var _0xb27a=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x27ab[_0x68ee8b];return _0x5148f7;};'use strict';var express=require(_0xb27a('0x0'));var router=express[_0xb27a('0x1')]();var auth=require(_0xb27a('0x2'));var controller=require(_0xb27a('0x3'));router['get'](_0xb27a('0x4'),auth['isAuthenticated'](),controller['getAgents']);router[_0xb27a('0x5')](_0xb27a('0x6'),auth[_0xb27a('0x7')](),controller[_0xb27a('0x8')]);module[_0xb27a('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 fa07a93..ab14948 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 _0x72ee=['forEach','push','Pause','where','user','Agents','agent','online','getResources','User','rows','map','filterAgentAttributes','merge','getAgentStatus','voice','voiceStatus','talking','sortAgentsByStatus','pick','catch','isValidChannel','startCase','Queue','name','userProfileId','outbound','QueueCampaigns','Queues','assign','UserProfile','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','limit','count','status','set','Content-Range','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pause','*pause','resolve','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','then','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','rawAttributes','fieldName','type','key','role','getOptions','raw','length'];(function(_0x91d019,_0x5223c4){var _0x19de1f=function(_0x3e1311){while(--_0x3e1311){_0x91d019['push'](_0x91d019['shift']());}};_0x19de1f(++_0x5223c4);}(_0x72ee,0x1bb));var _0xe72e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x72ee[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xe72e('0x0'));var util=require(_0xe72e('0x1'));var rta=require(_0xe72e('0x2'));var rtq=require(_0xe72e('0x3'));var qs=require(_0xe72e('0x4'));var utils=require(_0xe72e('0x5'));var db=require(_0xe72e('0x6'))['db'];var APIBadRequestError=require(_0xe72e('0x7'))[_0xe72e('0x8')];var APIHandleError=require(_0xe72e('0x7'))['handleError'];function respondWithFilteredResult(_0x1bd998,_0x159e6c){return function(_0x34c4ca){if(_0x34c4ca){var _0x387a02=typeof _0x159e6c[_0xe72e('0x9')]===_0xe72e('0xa')&&typeof _0x159e6c[_0xe72e('0xb')]===_0xe72e('0xa');var _0x407fcd=_0x34c4ca[_0xe72e('0xc')];var _0x3e2a3e=_0x387a02?0x0:_0x159e6c[_0xe72e('0x9')];var _0x57b6e4=_0x387a02?_0x34c4ca[_0xe72e('0xc')]:_0x159e6c[_0xe72e('0x9')]+_0x159e6c['limit'];var _0x518bef;if(_0x57b6e4>=_0x407fcd){_0x57b6e4=_0x407fcd;_0x518bef=0xc8;}else{_0x518bef=0xce;}_0x1bd998[_0xe72e('0xd')](_0x518bef);return _0x1bd998[_0xe72e('0xe')](_0xe72e('0xf'),_0x3e2a3e+'-'+_0x57b6e4+'/'+_0x407fcd)['json'](_0x34c4ca);}return null;};}exports[_0xe72e('0x10')]=function(_0xa161c0,_0x57a177){var _0x34b593={'count':0x0,'rows':[]};var _0x4c2a2={};var _0x58e738;var _0x30521d=utils[_0xe72e('0x11')]();var _0xa59dce;var _0x3f6320;var _0x1294f5=_0xa161c0[_0xe72e('0x12')][_0xe72e('0x13')];var _0x20a1cd=_0xa161c0[_0xe72e('0x12')][_0xe72e('0x14')];var _0xc6abd7=_0xa161c0['query']['pauseTypeFilter'];var _0x13cffe=_0x20a1cd===_0xe72e('0x15')||_0x20a1cd===_0xe72e('0x16')?!![]:![];var _0x1e75ca=[];var _0x32dea8;var _0x2f4b60;Promise[_0xe72e('0x17')]()['then'](function(){if(_0xa161c0[_0xe72e('0x12')][_0xe72e('0x18')]){if(!utils['isValidChannel'](_0xa161c0[_0xe72e('0x12')][_0xe72e('0x18')])){throw new APIBadRequestError(util[_0xe72e('0x19')](_0xe72e('0x1a'),_0xa161c0[_0xe72e('0x12')][_0xe72e('0x18')]));}_0x58e738=_0xa161c0[_0xe72e('0x12')][_0xe72e('0x18')][_0xe72e('0x1b')]();}if(!_0xa161c0[_0xe72e('0x12')][_0xe72e('0x1c')]||!_0xa161c0[_0xe72e('0x12')][_0xe72e('0x1c')][_0xe72e('0x1d')](_0xe72e('0x1e'))){_0xa161c0[_0xe72e('0x12')][_0xe72e('0x1c')]=rta[_0xe72e('0x1f')](_0xa161c0['query']['sort']);return;}var _0x55fcca=rta[_0xe72e('0x20')](_0xa161c0[_0xe72e('0x12')][_0xe72e('0x1c')]);_0xa161c0[_0xe72e('0x12')][_0xe72e('0x1c')]=_0x55fcca[_0xe72e('0x21')][_0xe72e('0x22')](',');_0x32dea8=_0x55fcca[_0xe72e('0x23')];})[_0xe72e('0x24')](function(){if(!_0x1294f5){return[];}return rta[_0xe72e('0x25')](_0x1294f5,_0x58e738);})['then'](function(_0xf1fa1e){_0x1e75ca=_0xf1fa1e;return rta[_0xe72e('0x26')]();})[_0xe72e('0x24')](function(_0x1e260d){_0x3f6320=_0x1e260d['rows'];if((!_0x20a1cd||_0x13cffe)&&!_0x32dea8){return _0x1e75ca;}if(_0x32dea8&&!_0x20a1cd){return rta[_0xe72e('0x27')](_0x3f6320,_0x1e75ca,_0x32dea8);}else{return rta[_0xe72e('0x28')](_0x3f6320,_0x1e75ca,_0x20a1cd);}})['then'](function(_0x1c1825){_0x1e75ca=_0x1c1825;var _0x3e5e46=![];if(_0x1e75ca['length']===0x0){if(_0x1294f5||_0x20a1cd){_0x3e5e46=!![];}if(_0x13cffe){_0x3e5e46=![];}}if(_0x3e5e46){return _0x34b593;}var _0x23c506=_['map'](db['User'][_0xe72e('0x29')],function(_0x7e9a21){return{'name':_0x7e9a21[_0xe72e('0x2a')],'type':_0x7e9a21[_0xe72e('0x2b')][_0xe72e('0x2c')]};});_0xa161c0[_0xe72e('0x12')][_0xe72e('0x2d')]='agent';_0x4c2a2=qs[_0xe72e('0x2e')](_0x23c506,_0xa161c0);_0x4c2a2[_0xe72e('0x2f')]=!![];var _0x73df56=[];if(_0x1e75ca[_0xe72e('0x30')]>0x0){_0x73df56['push']({'id':{'$in':_0x1e75ca}});if(_0x32dea8&&!_0x20a1cd){_0x2f4b60=[db['sequelize']['literal']('FIELD(id,'+_0x1e75ca+')')];_0x4c2a2['order']=_0x2f4b60;}}if(_0x13cffe){_0x30521d[_0xe72e('0x31')](function(_0x2b5e64){var _0x2ad173=!![];if(_0x20a1cd===_0xe72e('0x16')&&_0x58e738!==_0x2b5e64){_0x2ad173=![];}_0x73df56[_0xe72e('0x32')]({[_0x2b5e64+_0xe72e('0x33')]:_0x2ad173});});if(_0xc6abd7){_0x73df56[_0xe72e('0x32')]({'pauseType':_0xc6abd7});}}else if(_0x20a1cd){_0x30521d[_0xe72e('0x31')](function(_0x57daec){_0x73df56[_0xe72e('0x32')]({[_0x57daec+'Pause']:![]});});}_0x4c2a2[_0xe72e('0x34')]=_['merge'](_0x4c2a2[_0xe72e('0x34')],{'$and':_0x73df56});if(_0xa161c0[_0xe72e('0x35')][_0xe72e('0x2d')]===_0xe72e('0x35')){var _0x5b15fd={'params':{'id':_0xa161c0[_0xe72e('0x35')]['userProfileId']},'query':{'section':_0xe72e('0x36'),'role':_0xe72e('0x37'),'raw':!![],'ids':_0x1e75ca,'customSorting':_0x2f4b60}};if(_0xa161c0[_0xe72e('0x12')][_0xe72e('0x38')]){_0x5b15fd[_0xe72e('0x12')][_0xe72e('0x38')]=!![];}if(_0x13cffe){_0x5b15fd[_0xe72e('0x12')]['extraQueryConditions']=_0x73df56;}_0x5b15fd[_0xe72e('0x12')]=Object['assign'](_0x5b15fd[_0xe72e('0x12')],_['omit'](_0xa161c0['query'],'id'));return db['UserProfile'][_0xe72e('0x39')](_0x5b15fd);}return db[_0xe72e('0x3a')]['findAndCountAll'](_0x4c2a2);})[_0xe72e('0x24')](function(_0x6ba63c){_0x34b593[_0xe72e('0xc')]=_0x6ba63c[_0xe72e('0xc')];_0xa59dce=_0x6ba63c[_0xe72e('0x3b')];return _0xa59dce[_0xe72e('0x3c')](function(_0x34b375){var _0x5127d0=_['find'](_0x3f6320,['id',_0x34b375['id']]);if(_0x5127d0){var _0x2e03ee=rta[_0xe72e('0x3d')](_0x5127d0);_[_0xe72e('0x3e')](_0x34b375,_0x2e03ee);}_0x34b375[_0xe72e('0x1e')]=rta[_0xe72e('0x3f')](_0x34b375);if(_0x34b375[_0xe72e('0x1e')]['includes'](_0xe72e('0x15'))){_0x30521d[_0xe72e('0x31')](function(_0xea64df){if(_0x34b375[_0xea64df+_0xe72e('0x33')]){if(_0xea64df===_0xe72e('0x40')){if(_0x34b375[_0xe72e('0x41')]!==_0xe72e('0x42')){_0x34b375[_0xe72e('0x41')]=_0xe72e('0x15');}}else{_0x34b375[_0xea64df+'Status']=_0xe72e('0x15');}}});}return _0x34b375;});})[_0xe72e('0x24')](function(_0x29fe00){if(!_0x32dea8||_0x2f4b60){return _0x29fe00;}return rta[_0xe72e('0x43')](_0x29fe00,_0x32dea8);})[_0xe72e('0x24')](function(_0x54fd52){var _0x1defc5=rta['getRealtimeAgentsQueryFields']();_0x34b593[_0xe72e('0x3b')]=_0x54fd52[_0xe72e('0x3c')](function(_0x29f1a6){return _[_0xe72e('0x44')](_0x29f1a6,_0x1defc5);});return _0x34b593;})['then'](respondWithFilteredResult(_0x57a177,_0x4c2a2))[_0xe72e('0x45')](APIHandleError(_0x57a177));};exports['getQueues']=function(_0x372727,_0x181e09){var _0x59fae6={'count':0x0,'rows':[]};var _0x5b675e={};var _0x105f78;var _0x4320b1;var _0x1b2dec;Promise[_0xe72e('0x17')]()[_0xe72e('0x24')](function(){if(_0x372727[_0xe72e('0x12')][_0xe72e('0x18')]){if(!utils[_0xe72e('0x46')](_0x372727[_0xe72e('0x12')][_0xe72e('0x18')])){throw new APIBadRequestError(util[_0xe72e('0x19')](_0xe72e('0x1a'),_0x372727[_0xe72e('0x12')]['channel']));}_0x105f78=_0x372727[_0xe72e('0x12')][_0xe72e('0x18')][_0xe72e('0x1b')]();}var _0x496de4=_[_0xe72e('0x47')](_0x105f78)+_0xe72e('0x48');var _0x4135c0=_['map'](db[_0x496de4][_0xe72e('0x29')],function(_0x5b6da9){return{'name':_0x5b6da9[_0xe72e('0x2a')],'type':_0x5b6da9['type']['key']};});if(!_0x372727[_0xe72e('0x12')][_0xe72e('0x21')]){var _0x1e3113=['id',_0xe72e('0x49')];if(_0x105f78===_0xe72e('0x40')){_0x1e3113[_0xe72e('0x32')](_0xe72e('0x2b'));if(_0x372727['query'][_0xe72e('0x2b')]==='outbound'){_0x1e3113[_0xe72e('0x32')](['dialActive','dialMethod']);}}_0x372727[_0xe72e('0x12')][_0xe72e('0x21')]=_0x1e3113[_0xe72e('0x22')](',');}_0x5b675e=qs[_0xe72e('0x2e')](_0x4135c0,_0x372727);if(_0x372727[_0xe72e('0x35')][_0xe72e('0x2d')]===_0xe72e('0x35')){var _0x358344={'params':{'id':_0x372727[_0xe72e('0x35')][_0xe72e('0x4a')]},'query':{'section':_0x105f78===_0xe72e('0x40')&&_0x372727[_0xe72e('0x12')][_0xe72e('0x2b')]===_0xe72e('0x4b')?_0xe72e('0x4c'):_[_0xe72e('0x47')](_0x105f78)+_0xe72e('0x4d'),'type':_0x372727[_0xe72e('0x12')][_0xe72e('0x2b')],'nolimit':!![],'sort':_0xe72e('0x49'),'filter':_0x372727['query']['filter']}};_0x358344[_0xe72e('0x12')]=Object[_0xe72e('0x4e')](_0x358344['query'],_0x372727[_0xe72e('0x12')]);delete _0x358344['query']['id'];return db[_0xe72e('0x4f')][_0xe72e('0x39')](_0x358344);}return db[_0x496de4]['findAndCountAll'](_0x5b675e);})[_0xe72e('0x24')](function(_0x29615f){_0x59fae6[_0xe72e('0xc')]=_0x29615f['count'];_0x4320b1=_0x29615f['rows'];return rtq[_0xe72e('0x50')](_0x372727,_0x105f78);})['then'](function(_0x5dbf74){_0x1b2dec=_0x5dbf74[_0xe72e('0x3b')];return rtq[_0xe72e('0x51')](_0x4320b1,_0x1b2dec,_0x105f78,_0x372727['query'][_0xe72e('0x2b')]);})[_0xe72e('0x24')](function(_0x46a8ce){_0x59fae6['rows']=_0x46a8ce;return _0x59fae6;})[_0xe72e('0x24')](respondWithFilteredResult(_0x181e09,_0x5b675e))[_0xe72e('0x45')](APIHandleError(_0x181e09));}; \ No newline at end of file +var _0x0254=['map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','length','sequelize','literal','FIELD(id,','forEach','Pause','push','where','user','userProfileId','Agents','online','extraQueryConditions','UserProfile','getResources','find','filterAgentAttributes','getAgentStatus','includes','voice','voiceStatus','talking','Status','sortAgentsByStatus','pick','getQueues','isValidChannel','outbound','dialActive','dialMethod','startCase','Queues','name','filter','assign','getRealtimeQueues','initializeQueues','catch','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus'];(function(_0x3df312,_0x58719b){var _0x1ed2ac=function(_0x44c1df){while(--_0x44c1df){_0x3df312['push'](_0x3df312['shift']());}};_0x1ed2ac(++_0x58719b);}(_0x0254,0x13b));var _0x4025=function(_0x32658e,_0x3d37db){_0x32658e=_0x32658e-0x0;var _0x325274=_0x0254[_0x32658e];return _0x325274;};'use strict';var _=require(_0x4025('0x0'));var util=require(_0x4025('0x1'));var rta=require(_0x4025('0x2'));var rtq=require(_0x4025('0x3'));var qs=require(_0x4025('0x4'));var utils=require(_0x4025('0x5'));var db=require(_0x4025('0x6'))['db'];var APIBadRequestError=require(_0x4025('0x7'))[_0x4025('0x8')];var APIHandleError=require(_0x4025('0x7'))[_0x4025('0x9')];function respondWithFilteredResult(_0x20d4f1,_0x33bc3d){return function(_0x3e3579){if(_0x3e3579){var _0x1575fb=typeof _0x33bc3d[_0x4025('0xa')]===_0x4025('0xb')&&typeof _0x33bc3d['limit']===_0x4025('0xb');var _0x1cb98a=_0x3e3579['count'];var _0x595f53=_0x1575fb?0x0:_0x33bc3d['offset'];var _0x525299=_0x1575fb?_0x3e3579[_0x4025('0xc')]:_0x33bc3d['offset']+_0x33bc3d[_0x4025('0xd')];var _0x5125a5;if(_0x525299>=_0x1cb98a){_0x525299=_0x1cb98a;_0x5125a5=0xc8;}else{_0x5125a5=0xce;}_0x20d4f1[_0x4025('0xe')](_0x5125a5);return _0x20d4f1[_0x4025('0xf')](_0x4025('0x10'),_0x595f53+'-'+_0x525299+'/'+_0x1cb98a)[_0x4025('0x11')](_0x3e3579);}return null;};}exports[_0x4025('0x12')]=function(_0xa50f00,_0x1bf10f){var _0x5767cd={'count':0x0,'rows':[]};var _0x4c8d9f={};var _0xafb833;var _0x256114=utils[_0x4025('0x13')]();var _0x757928;var _0x37ee2f;var _0x25ba08=_0xa50f00[_0x4025('0x14')][_0x4025('0x15')];var _0x16ac69=_0xa50f00[_0x4025('0x14')]['globalStatusFilter'];var _0x42ff36=_0xa50f00[_0x4025('0x14')][_0x4025('0x16')];var _0xb5d599=_0x16ac69===_0x4025('0x17')||_0x16ac69===_0x4025('0x18')?!![]:![];var _0x419160=[];var _0x1c6171;var _0x537681;Promise[_0x4025('0x19')]()[_0x4025('0x1a')](function(){if(_0xa50f00[_0x4025('0x14')][_0x4025('0x1b')]){if(!utils['isValidChannel'](_0xa50f00[_0x4025('0x14')][_0x4025('0x1b')])){throw new APIBadRequestError(util[_0x4025('0x1c')](_0x4025('0x1d'),_0xa50f00[_0x4025('0x14')][_0x4025('0x1b')]));}_0xafb833=_0xa50f00[_0x4025('0x14')][_0x4025('0x1b')][_0x4025('0x1e')]();}if(!_0xa50f00[_0x4025('0x14')][_0x4025('0x1f')]||!_0xa50f00[_0x4025('0x14')][_0x4025('0x1f')]['includes'](_0x4025('0x20'))){_0xa50f00[_0x4025('0x14')][_0x4025('0x1f')]=rta[_0x4025('0x21')](_0xa50f00[_0x4025('0x14')][_0x4025('0x1f')]);return;}var _0xd6841d=rta[_0x4025('0x22')](_0xa50f00[_0x4025('0x14')]['sort']);_0xa50f00[_0x4025('0x14')][_0x4025('0x1f')]=_0xd6841d[_0x4025('0x23')][_0x4025('0x24')](',');_0x1c6171=_0xd6841d[_0x4025('0x25')];})[_0x4025('0x1a')](function(){if(!_0x25ba08){return[];}return rta[_0x4025('0x26')](_0x25ba08,_0xafb833);})[_0x4025('0x1a')](function(_0x4b10ba){_0x419160=_0x4b10ba;return rta['getRealtimeAgents']();})[_0x4025('0x1a')](function(_0x471d30){_0x37ee2f=_0x471d30[_0x4025('0x27')];if((!_0x16ac69||_0xb5d599)&&!_0x1c6171){return _0x419160;}if(_0x1c6171&&!_0x16ac69){return rta[_0x4025('0x28')](_0x37ee2f,_0x419160,_0x1c6171);}else{return rta['getAgentIdsByStatus'](_0x37ee2f,_0x419160,_0x16ac69);}})[_0x4025('0x1a')](function(_0x5f1d3c){_0x419160=_0x5f1d3c;var _0xafad1e=![];if(_0x419160['length']===0x0){if(_0x25ba08||_0x16ac69){_0xafad1e=!![];}if(_0xb5d599){_0xafad1e=![];}}if(_0xafad1e){return _0x5767cd;}var _0x3fc624=_[_0x4025('0x29')](db[_0x4025('0x2a')][_0x4025('0x2b')],function(_0x4fb8ef){return{'name':_0x4fb8ef[_0x4025('0x2c')],'type':_0x4fb8ef[_0x4025('0x2d')][_0x4025('0x2e')]};});_0xa50f00[_0x4025('0x14')][_0x4025('0x2f')]=_0x4025('0x30');_0x4c8d9f=qs[_0x4025('0x31')](_0x3fc624,_0xa50f00);_0x4c8d9f[_0x4025('0x32')]=!![];var _0x2c0c8e=[];if(_0x419160[_0x4025('0x33')]>0x0){_0x2c0c8e['push']({'id':{'$in':_0x419160}});if(_0x1c6171&&!_0x16ac69){_0x537681=[db[_0x4025('0x34')][_0x4025('0x35')](_0x4025('0x36')+_0x419160+')')];_0x4c8d9f['order']=_0x537681;}}if(_0xb5d599){_0x256114[_0x4025('0x37')](function(_0xd4ff){var _0x2ff8bd=!![];if(_0x16ac69===_0x4025('0x18')&&_0xafb833!==_0xd4ff){_0x2ff8bd=![];}_0x2c0c8e['push']({[_0xd4ff+_0x4025('0x38')]:_0x2ff8bd});});if(_0x42ff36){_0x2c0c8e[_0x4025('0x39')]({'pauseType':_0x42ff36});}}else if(_0x16ac69){_0x256114[_0x4025('0x37')](function(_0x4edbaf){_0x2c0c8e[_0x4025('0x39')]({[_0x4edbaf+'Pause']:![]});});}_0x4c8d9f[_0x4025('0x3a')]=_['merge'](_0x4c8d9f[_0x4025('0x3a')],{'$and':_0x2c0c8e});if(_0xa50f00['user'][_0x4025('0x2f')]==='user'){var _0x47e26e={'params':{'id':_0xa50f00[_0x4025('0x3b')][_0x4025('0x3c')]},'query':{'section':_0x4025('0x3d'),'role':'agent','raw':!![],'ids':_0x419160,'customSorting':_0x537681}};if(_0xa50f00[_0x4025('0x14')][_0x4025('0x3e')]){_0x47e26e[_0x4025('0x14')][_0x4025('0x3e')]=!![];}if(_0xb5d599){_0x47e26e[_0x4025('0x14')][_0x4025('0x3f')]=_0x2c0c8e;}_0x47e26e[_0x4025('0x14')]=Object['assign'](_0x47e26e['query'],_['omit'](_0xa50f00['query'],'id'));return db[_0x4025('0x40')][_0x4025('0x41')](_0x47e26e);}return db[_0x4025('0x2a')]['findAndCountAll'](_0x4c8d9f);})[_0x4025('0x1a')](function(_0x10fdc4){_0x5767cd[_0x4025('0xc')]=_0x10fdc4[_0x4025('0xc')];_0x757928=_0x10fdc4[_0x4025('0x27')];return _0x757928[_0x4025('0x29')](function(_0xc41200){var _0x39accc=_[_0x4025('0x42')](_0x37ee2f,['id',_0xc41200['id']]);if(_0x39accc){var _0x2e8c32=rta[_0x4025('0x43')](_0x39accc);_['merge'](_0xc41200,_0x2e8c32);}_0xc41200[_0x4025('0x20')]=rta[_0x4025('0x44')](_0xc41200);if(_0xc41200[_0x4025('0x20')][_0x4025('0x45')]('pause')){_0x256114['forEach'](function(_0x9aa369){if(_0xc41200[_0x9aa369+_0x4025('0x38')]){if(_0x9aa369===_0x4025('0x46')){if(_0xc41200[_0x4025('0x47')]!==_0x4025('0x48')){_0xc41200[_0x4025('0x47')]=_0x4025('0x17');}}else{_0xc41200[_0x9aa369+_0x4025('0x49')]='pause';}}});}return _0xc41200;});})['then'](function(_0x1f1656){if(!_0x1c6171||_0x537681){return _0x1f1656;}return rta[_0x4025('0x4a')](_0x1f1656,_0x1c6171);})['then'](function(_0x283d6b){var _0x3cb936=rta['getRealtimeAgentsQueryFields']();_0x5767cd['rows']=_0x283d6b[_0x4025('0x29')](function(_0x530802){return _[_0x4025('0x4b')](_0x530802,_0x3cb936);});return _0x5767cd;})[_0x4025('0x1a')](respondWithFilteredResult(_0x1bf10f,_0x4c8d9f))['catch'](APIHandleError(_0x1bf10f));};exports[_0x4025('0x4c')]=function(_0x3faa8b,_0xb3ae82){var _0xcb914b={'count':0x0,'rows':[]};var _0x405b43={};var _0x9a7314;var _0x2282dc;var _0xab62fe;Promise[_0x4025('0x19')]()['then'](function(){if(_0x3faa8b[_0x4025('0x14')][_0x4025('0x1b')]){if(!utils[_0x4025('0x4d')](_0x3faa8b[_0x4025('0x14')][_0x4025('0x1b')])){throw new APIBadRequestError(util['format'](_0x4025('0x1d'),_0x3faa8b[_0x4025('0x14')]['channel']));}_0x9a7314=_0x3faa8b[_0x4025('0x14')][_0x4025('0x1b')][_0x4025('0x1e')]();}var _0x311288=_['startCase'](_0x9a7314)+'Queue';var _0x3f0790=_[_0x4025('0x29')](db[_0x311288][_0x4025('0x2b')],function(_0x2c5e17){return{'name':_0x2c5e17[_0x4025('0x2c')],'type':_0x2c5e17[_0x4025('0x2d')][_0x4025('0x2e')]};});if(!_0x3faa8b[_0x4025('0x14')][_0x4025('0x23')]){var _0x595bff=['id','name'];if(_0x9a7314===_0x4025('0x46')){_0x595bff[_0x4025('0x39')]('type');if(_0x3faa8b[_0x4025('0x14')][_0x4025('0x2d')]===_0x4025('0x4e')){_0x595bff[_0x4025('0x39')]([_0x4025('0x4f'),_0x4025('0x50')]);}}_0x3faa8b[_0x4025('0x14')][_0x4025('0x23')]=_0x595bff['join'](',');}_0x405b43=qs['getOptions'](_0x3f0790,_0x3faa8b);if(_0x3faa8b[_0x4025('0x3b')][_0x4025('0x2f')]==='user'){var _0x230140={'params':{'id':_0x3faa8b[_0x4025('0x3b')][_0x4025('0x3c')]},'query':{'section':_0x9a7314===_0x4025('0x46')&&_0x3faa8b[_0x4025('0x14')][_0x4025('0x2d')]==='outbound'?'QueueCampaigns':_[_0x4025('0x51')](_0x9a7314)+_0x4025('0x52'),'type':_0x3faa8b[_0x4025('0x14')][_0x4025('0x2d')],'nolimit':!![],'sort':_0x4025('0x53'),'filter':_0x3faa8b['query'][_0x4025('0x54')]}};_0x230140[_0x4025('0x14')]=Object[_0x4025('0x55')](_0x230140['query'],_0x3faa8b[_0x4025('0x14')]);delete _0x230140[_0x4025('0x14')]['id'];return db[_0x4025('0x40')][_0x4025('0x41')](_0x230140);}return db[_0x311288]['findAndCountAll'](_0x405b43);})['then'](function(_0x267db1){_0xcb914b[_0x4025('0xc')]=_0x267db1[_0x4025('0xc')];_0x2282dc=_0x267db1[_0x4025('0x27')];return rtq[_0x4025('0x56')](_0x3faa8b,_0x9a7314);})[_0x4025('0x1a')](function(_0x20c199){_0xab62fe=_0x20c199[_0x4025('0x27')];return rtq[_0x4025('0x57')](_0x2282dc,_0xab62fe,_0x9a7314,_0x3faa8b[_0x4025('0x14')]['type']);})[_0x4025('0x1a')](function(_0x15f88b){_0xcb914b[_0x4025('0x27')]=_0x15f88b;return _0xcb914b;})[_0x4025('0x1a')](respondWithFilteredResult(_0xb3ae82,_0x405b43))[_0x4025('0x58')](APIHandleError(_0xb3ae82));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 7a8d397..dfaefb1 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x42d8cd,_0xa4fec4){var _0x5cd94a=function(_0x5f4585){while(--_0x5f4585){_0x42d8cd['push'](_0x42d8cd['shift']());}};_0x5cd94a(++_0xa4fec4);}(_0xe706,0xa3));var _0x6e70=function(_0xcb0eb2,_0x3906bf){_0xcb0eb2=_0xcb0eb2-0x0;var _0xbab9b8=_0xe706[_0xcb0eb2];return _0xbab9b8;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3f8137,_0x2e6a2b){var _0x10c8df=function(_0x5b80eb){while(--_0x5b80eb){_0x3f8137['push'](_0x3f8137['shift']());}};_0x10c8df(++_0x2e6a2b);}(_0xedd9,0xfc));var _0x9edd=function(_0xc926db,_0x47c94c){_0xc926db=_0xc926db-0x0;var _0x143da8=_0xedd9[_0xc926db];return _0x143da8;};'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 fde64b3..3eff9f4 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 _0xaf1b=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x1c7c1f,_0xe6be4e){var _0x550946=function(_0x1f1665){while(--_0x1f1665){_0x1c7c1f['push'](_0x1c7c1f['shift']());}};_0x550946(++_0xe6be4e);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x8744e8,_0x4e73af){_0x8744e8=_0x8744e8-0x0;var _0x45fee8=_0xaf1b[_0x8744e8];return _0x45fee8;};'use strict';var Sequelize=require(_0xbaf1('0x0'));module[_0xbaf1('0x1')]={'state':{'type':Sequelize[_0xbaf1('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xbaf1('0x3')]},'scheduledat':{'type':Sequelize[_0xbaf1('0x4')]},'uniqueid':{'type':Sequelize[_0xbaf1('0x3')]},'starttime':{'type':Sequelize[_0xbaf1('0x4')]},'responsetime':{'type':Sequelize[_0xbaf1('0x4')]},'ringtime':{'type':Sequelize[_0xbaf1('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xbaf1('0x3')]},'campaigntype':{'type':Sequelize[_0xbaf1('0x3')]},'membername':{'type':Sequelize[_0xbaf1('0x3')]}}; \ No newline at end of file +var _0xc051=['STRING','sequelize','exports','DATE'];(function(_0x21125f,_0x8079f8){var _0x2f421d=function(_0x231299){while(--_0x231299){_0x21125f['push'](_0x21125f['shift']());}};_0x2f421d(++_0x8079f8);}(_0xc051,0xb5));var _0x1c05=function(_0x5c366f,_0x1adea3){_0x5c366f=_0x5c366f-0x0;var _0x2e89af=_0xc051[_0x5c366f];return _0x2e89af;};'use strict';var Sequelize=require(_0x1c05('0x0'));module[_0x1c05('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1c05('0x2')]},'uniqueid':{'type':Sequelize[_0x1c05('0x3')]},'starttime':{'type':Sequelize[_0x1c05('0x2')]},'responsetime':{'type':Sequelize[_0x1c05('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1c05('0x3')]},'campaigntype':{'type':Sequelize[_0x1c05('0x3')]},'membername':{'type':Sequelize[_0x1c05('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index ffb1112..c009756 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 _0xb0bc=['exports','define','report_agent_preview','../../config/logger','api','moment','bluebird','path','./reportAgentPreview.attributes'];(function(_0x577f1d,_0x413b83){var _0x2d57e6=function(_0x399d89){while(--_0x399d89){_0x577f1d['push'](_0x577f1d['shift']());}};_0x2d57e6(++_0x413b83);}(_0xb0bc,0x16b));var _0xcb0b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb0bc[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcb0b('0x0'))(_0xcb0b('0x1'));var moment=require(_0xcb0b('0x2'));var BPromise=require(_0xcb0b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb0b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcb0b('0x5'));module[_0xcb0b('0x6')]=function(_0x2dca8a,_0x2de687){return _0x2dca8a[_0xcb0b('0x7')]('ReportAgentPreview',attributes,{'tableName':_0xcb0b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c5b=['../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x376d6b,_0xcb98bf){var _0x4f7d19=function(_0x121cbf){while(--_0x121cbf){_0x376d6b['push'](_0x376d6b['shift']());}};_0x4f7d19(++_0xcb98bf);}(_0x2c5b,0x7e));var _0xb2c5=function(_0x4cf372,_0x2682f3){_0x4cf372=_0x4cf372-0x0;var _0x43c8b2=_0x2c5b[_0x4cf372];return _0x43c8b2;};'use strict';var _=require(_0xb2c5('0x0'));var util=require('util');var logger=require(_0xb2c5('0x1'))(_0xb2c5('0x2'));var moment=require(_0xb2c5('0x3'));var BPromise=require(_0xb2c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb2c5('0x5'));var config=require(_0xb2c5('0x6'));var attributes=require(_0xb2c5('0x7'));module[_0xb2c5('0x8')]=function(_0x2eb01b,_0x11e21f){return _0x2eb01b[_0xb2c5('0x9')](_0xb2c5('0xa'),attributes,{'tableName':_0xb2c5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index ff55a11..d778832 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 _0x676a=['raw','CreateReportAgentPreview','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ReportAgentPreview','options'];(function(_0x3d9287,_0x12b2f1){var _0x28e30d=function(_0xb18d29){while(--_0xb18d29){_0x3d9287['push'](_0x3d9287['shift']());}};_0x28e30d(++_0x12b2f1);}(_0x676a,0x1dd));var _0xa676=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x676a[_0x4e1d03];return _0x362d4b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa676('0x0'));var BPromise=require(_0xa676('0x1'));var rs=require(_0xa676('0x2'));var fs=require('fs');var Redis=require(_0xa676('0x3'));var db=require(_0xa676('0x4'))['db'];var utils=require(_0xa676('0x5'));var logger=require('../../config/logger')(_0xa676('0x6'));var config=require('../../config/environment');var jayson=require(_0xa676('0x7'));var client=jayson[_0xa676('0x8')][_0xa676('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31e081,_0x21791c,_0x4375e0){return new BPromise(function(_0x513c5c,_0x1f5472){return client[_0xa676('0xa')](_0x31e081,_0x4375e0)['then'](function(_0x25412e){logger[_0xa676('0xb')](_0xa676('0xc'),_0x21791c,'request\x20sent');logger[_0xa676('0xd')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x21791c,_0xa676('0xe'),JSON[_0xa676('0xf')](_0x25412e));if(_0x25412e[_0xa676('0x10')]){if(_0x25412e[_0xa676('0x10')][_0xa676('0x11')]===0x1f4){logger[_0xa676('0x10')](_0xa676('0xc'),_0x21791c,_0x25412e[_0xa676('0x10')][_0xa676('0x12')]);return _0x1f5472(_0x25412e[_0xa676('0x10')][_0xa676('0x12')]);}logger[_0xa676('0x10')](_0xa676('0xc'),_0x21791c,_0x25412e['error'][_0xa676('0x12')]);return _0x513c5c(_0x25412e[_0xa676('0x10')][_0xa676('0x12')]);}else{logger[_0xa676('0xb')](_0xa676('0xc'),_0x21791c,_0xa676('0xe'));_0x513c5c(_0x25412e[_0xa676('0x13')][_0xa676('0x12')]);}})[_0xa676('0x14')](function(_0x278692){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x21791c,_0x278692);_0x1f5472(_0x278692);});});}exports['CreateReportAgentPreview']=function(_0x252d3a){var _0x3dc270=this;return new Promise(function(_0x553b3b,_0x2c22ce){return db[_0xa676('0x15')]['create'](_0x252d3a['body'],{'raw':_0x252d3a[_0xa676('0x16')]?_0x252d3a[_0xa676('0x16')][_0xa676('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x2b71ae){logger[_0xa676('0xb')](_0xa676('0x18'),_0x252d3a);logger[_0xa676('0xd')](_0xa676('0x18'),_0x252d3a,JSON[_0xa676('0xf')](_0x2b71ae));_0x553b3b(_0x2b71ae);})['catch'](function(_0x14120b){logger[_0xa676('0x10')](_0xa676('0x18'),_0x14120b[_0xa676('0x12')],_0x252d3a);_0x2c22ce(_0x3dc270[_0xa676('0x10')](0x1f4,_0x14120b[_0xa676('0x12')]));});});}; \ No newline at end of file +var _0x3506=['debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ReportAgentPreview','body','options','raw','CreateReportAgentPreview','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x48c7c2,_0x57cfd5){var _0x2038b5=function(_0x5cdd9e){while(--_0x5cdd9e){_0x48c7c2['push'](_0x48c7c2['shift']());}};_0x2038b5(++_0x57cfd5);}(_0x3506,0x86));var _0x6350=function(_0x31fde6,_0x2428dc){_0x31fde6=_0x31fde6-0x0;var _0x168b3e=_0x3506[_0x31fde6];return _0x168b3e;};'use strict';var _=require(_0x6350('0x0'));var util=require('util');var moment=require(_0x6350('0x1'));var BPromise=require(_0x6350('0x2'));var rs=require(_0x6350('0x3'));var fs=require('fs');var Redis=require(_0x6350('0x4'));var db=require(_0x6350('0x5'))['db'];var utils=require(_0x6350('0x6'));var logger=require(_0x6350('0x7'))(_0x6350('0x8'));var config=require(_0x6350('0x9'));var jayson=require(_0x6350('0xa'));var client=jayson['client'][_0x6350('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d46bb,_0x4883d9,_0x2815f8){return new BPromise(function(_0x164bf2,_0x50cc9b){return client[_0x6350('0xc')](_0x1d46bb,_0x2815f8)[_0x6350('0xd')](function(_0x3a2766){logger[_0x6350('0xe')](_0x6350('0xf'),_0x4883d9,'request\x20sent');logger[_0x6350('0x10')](_0x6350('0x11'),_0x4883d9,_0x6350('0x12'),JSON[_0x6350('0x13')](_0x3a2766));if(_0x3a2766[_0x6350('0x14')]){if(_0x3a2766[_0x6350('0x14')][_0x6350('0x15')]===0x1f4){logger[_0x6350('0x14')](_0x6350('0xf'),_0x4883d9,_0x3a2766[_0x6350('0x14')]['message']);return _0x50cc9b(_0x3a2766['error']['message']);}logger[_0x6350('0x14')](_0x6350('0xf'),_0x4883d9,_0x3a2766[_0x6350('0x14')][_0x6350('0x16')]);return _0x164bf2(_0x3a2766[_0x6350('0x14')][_0x6350('0x16')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x4883d9,_0x6350('0x12'));_0x164bf2(_0x3a2766[_0x6350('0x17')][_0x6350('0x16')]);}})[_0x6350('0x18')](function(_0x50846e){logger[_0x6350('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x4883d9,_0x50846e);_0x50cc9b(_0x50846e);});});}exports['CreateReportAgentPreview']=function(_0x408a9d){var _0x1754b5=this;return new Promise(function(_0x4305e2,_0x27f2e6){return db[_0x6350('0x19')]['create'](_0x408a9d[_0x6350('0x1a')],{'raw':_0x408a9d[_0x6350('0x1b')]?_0x408a9d[_0x6350('0x1b')][_0x6350('0x1c')]===undefined?!![]:![]:!![]})[_0x6350('0xd')](function(_0x5bc44c){logger[_0x6350('0xe')](_0x6350('0x1d'),_0x408a9d);logger[_0x6350('0x10')](_0x6350('0x1d'),_0x408a9d,JSON[_0x6350('0x13')](_0x5bc44c));_0x4305e2(_0x5bc44c);})[_0x6350('0x18')](function(_0x119313){logger['error']('CreateReportAgentPreview',_0x119313[_0x6350('0x16')],_0x408a9d);_0x27f2e6(_0x1754b5[_0x6350('0x14')](0x1f4,_0x119313['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index f90e11d..ab203bf 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 _0x976a=['/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','post','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','/agents/:id/notify','exports','util','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions'];(function(_0x29c358,_0x245d59){var _0x5783e9=function(_0x44172b){while(--_0x44172b){_0x29c358['push'](_0x29c358['shift']());}};_0x5783e9(++_0x245d59);}(_0x976a,0xb3));var _0xa976=function(_0x391df0,_0x51b2dc){_0x391df0=_0x391df0-0x0;var _0x30bec6=_0x976a[_0x391df0];return _0x30bec6;};'use strict';var multer=require('multer');var util=require(_0xa976('0x0'));var path=require(_0xa976('0x1'));var express=require(_0xa976('0x2'));var router=express['Router']();var auth=require(_0xa976('0x3'));var controller=require(_0xa976('0x4'));router[_0xa976('0x5')](_0xa976('0x6'),auth[_0xa976('0x7')](),controller[_0xa976('0x8')]);router[_0xa976('0x5')](_0xa976('0x9'),auth[_0xa976('0x7')](),controller['voiceChannelMixMonitor']);router[_0xa976('0x5')](_0xa976('0xa'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0xa976('0x5')]('/voice/queues',auth[_0xa976('0x7')](),controller['voiceQueues']);router['get']('/chat/queues',auth[_0xa976('0x7')](),controller[_0xa976('0xb')]);router[_0xa976('0x5')](_0xa976('0xc'),auth[_0xa976('0x7')](),controller[_0xa976('0xd')]);router[_0xa976('0x5')](_0xa976('0xe'),auth[_0xa976('0x7')](),controller[_0xa976('0xf')]);router[_0xa976('0x5')](_0xa976('0x10'),auth[_0xa976('0x7')](),controller[_0xa976('0x11')]);router[_0xa976('0x5')](_0xa976('0x12'),auth[_0xa976('0x7')](),controller[_0xa976('0x13')]);router['get'](_0xa976('0x14'),auth[_0xa976('0x7')](),controller[_0xa976('0x15')]);router[_0xa976('0x5')](_0xa976('0x16'),auth[_0xa976('0x7')](),controller[_0xa976('0x17')]);router[_0xa976('0x5')]('/voice/queues/preview/:id',auth[_0xa976('0x7')](),controller[_0xa976('0x18')]);router[_0xa976('0x5')](_0xa976('0x19'),auth[_0xa976('0x7')](),controller[_0xa976('0x1a')]);router[_0xa976('0x5')]('/voice/queues/channels/:uniqueid',auth[_0xa976('0x7')](),controller['voiceQueuesChannel']);router[_0xa976('0x5')](_0xa976('0x1b'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0xa976('0x5')](_0xa976('0x1c'),auth[_0xa976('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0xa976('0x5')](_0xa976('0x1d'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0xa976('0x1e')](_0xa976('0x1d'),auth[_0xa976('0x7')](),controller[_0xa976('0x1f')]);router[_0xa976('0x5')](_0xa976('0x20'),auth['isAuthenticated'](),controller[_0xa976('0x21')]);router['get'](_0xa976('0x22'),auth['isAuthenticated'](),controller['outboundChannels']);router[_0xa976('0x5')](_0xa976('0x23'),auth[_0xa976('0x7')](),controller[_0xa976('0x24')]);router[_0xa976('0x1e')](_0xa976('0x25'),auth[_0xa976('0x7')](),controller[_0xa976('0x26')]);router[_0xa976('0x5')](_0xa976('0x27'),auth[_0xa976('0x7')](),controller[_0xa976('0x28')]);router[_0xa976('0x5')](_0xa976('0x29'),auth[_0xa976('0x7')](),controller[_0xa976('0x2a')]);router[_0xa976('0x5')](_0xa976('0x2b'),auth[_0xa976('0x7')](),controller[_0xa976('0x2c')]);router[_0xa976('0x5')](_0xa976('0x2d'),auth[_0xa976('0x7')](),controller[_0xa976('0x2e')]);router[_0xa976('0x5')]('/chat/queues/waitinginteractions',auth[_0xa976('0x7')](),controller[_0xa976('0x2f')]);router['get']('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xa976('0x30')]);router[_0xa976('0x5')](_0xa976('0x31'),auth[_0xa976('0x7')](),controller[_0xa976('0x32')]);router['get'](_0xa976('0x33'),auth[_0xa976('0x7')](),controller[_0xa976('0x34')]);router['get'](_0xa976('0x35'),auth[_0xa976('0x7')](),controller[_0xa976('0x36')]);router[_0xa976('0x5')](_0xa976('0x37'),auth[_0xa976('0x7')](),controller['whatsappQueuesWaitingInteractions']);router[_0xa976('0x5')](_0xa976('0x38'),auth[_0xa976('0x7')](),controller['faxQueuesWaitingInteractions']);router['post'](_0xa976('0x39'),auth[_0xa976('0x7')](),controller[_0xa976('0x3a')](_0xa976('0x3b')));router['get']('/mail/queues/:id',auth['isAuthenticated'](),controller[_0xa976('0x3c')]);router[_0xa976('0x3d')]('/chat/queues/:id/notify',auth[_0xa976('0x7')](),controller[_0xa976('0x3a')]('chat'));router[_0xa976('0x5')](_0xa976('0x3e'),auth[_0xa976('0x7')](),controller[_0xa976('0x3f')]);router[_0xa976('0x3d')](_0xa976('0x40'),auth[_0xa976('0x7')](),controller[_0xa976('0x3a')]('fax'));router['get'](_0xa976('0x41'),auth[_0xa976('0x7')](),controller[_0xa976('0x42')]);router[_0xa976('0x3d')](_0xa976('0x43'),auth['isAuthenticated'](),controller[_0xa976('0x3a')](_0xa976('0x44')));router['get']('/openchannel/queues/:id',auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0xa976('0x3d')](_0xa976('0x45'),auth[_0xa976('0x7')](),controller[_0xa976('0x3a')]('sms'));router[_0xa976('0x3d')](_0xa976('0x46'),auth[_0xa976('0x7')](),controller[_0xa976('0x3a')](_0xa976('0x47')));router['get'](_0xa976('0x48'),auth[_0xa976('0x7')](),controller['showSmsQueues']);router[_0xa976('0x5')](_0xa976('0x49'),auth[_0xa976('0x7')](),controller['showWhatsappQueues']);router[_0xa976('0x3d')](_0xa976('0x4a'),auth['isAuthenticated'](),controller['agentNotify']);module[_0xa976('0x4b')]=router; \ No newline at end of file +var _0x8fe9=['/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents'];(function(_0x57a205,_0x288fee){var _0x149a79=function(_0xb4b7bb){while(--_0xb4b7bb){_0x57a205['push'](_0x57a205['shift']());}};_0x149a79(++_0x288fee);}(_0x8fe9,0x17b));var _0x98fe=function(_0x45c262,_0x2e3ce5){_0x45c262=_0x45c262-0x0;var _0x4f2ba6=_0x8fe9[_0x45c262];return _0x4f2ba6;};'use strict';var multer=require(_0x98fe('0x0'));var util=require(_0x98fe('0x1'));var path=require(_0x98fe('0x2'));var express=require(_0x98fe('0x3'));var router=express[_0x98fe('0x4')]();var auth=require(_0x98fe('0x5'));var controller=require(_0x98fe('0x6'));router[_0x98fe('0x7')](_0x98fe('0x8'),auth[_0x98fe('0x9')](),controller[_0x98fe('0xa')]);router[_0x98fe('0x7')](_0x98fe('0xb'),auth[_0x98fe('0x9')](),controller[_0x98fe('0xc')]);router[_0x98fe('0x7')](_0x98fe('0xd'),auth[_0x98fe('0x9')](),controller[_0x98fe('0xe')]);router[_0x98fe('0x7')](_0x98fe('0xf'),auth['isAuthenticated'](),controller[_0x98fe('0x10')]);router[_0x98fe('0x7')](_0x98fe('0x11'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x12')]);router[_0x98fe('0x7')](_0x98fe('0x13'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x14')]);router[_0x98fe('0x7')](_0x98fe('0x15'),auth['isAuthenticated'](),controller[_0x98fe('0x16')]);router[_0x98fe('0x7')](_0x98fe('0x17'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x18')]);router[_0x98fe('0x7')](_0x98fe('0x19'),auth[_0x98fe('0x9')](),controller['smsQueues']);router[_0x98fe('0x7')](_0x98fe('0x1a'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0x98fe('0x7')](_0x98fe('0x1b'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x1c')]);router[_0x98fe('0x7')](_0x98fe('0x1d'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x1e')]);router[_0x98fe('0x7')]('/voice/queues/channels',auth[_0x98fe('0x9')](),controller[_0x98fe('0x1f')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0x98fe('0x9')](),controller[_0x98fe('0x20')]);router['get'](_0x98fe('0x21'),auth['isAuthenticated'](),controller[_0x98fe('0x22')]);router[_0x98fe('0x7')](_0x98fe('0x23'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x24')]);router[_0x98fe('0x7')]('/voice/queues/:id',auth[_0x98fe('0x9')](),controller[_0x98fe('0x25')]);router[_0x98fe('0x26')]('/voice/queues/:id',auth[_0x98fe('0x9')](),controller[_0x98fe('0x27')]);router[_0x98fe('0x7')](_0x98fe('0x28'),auth['isAuthenticated'](),controller[_0x98fe('0x29')]);router[_0x98fe('0x7')](_0x98fe('0x2a'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x2b')]);router[_0x98fe('0x7')](_0x98fe('0x2c'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x2d')]);router[_0x98fe('0x26')](_0x98fe('0x2e'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x2f')]);router[_0x98fe('0x7')](_0x98fe('0x30'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x31')]);router['get'](_0x98fe('0x32'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x33')]);router[_0x98fe('0x7')]('/campaigns',auth[_0x98fe('0x9')](),controller[_0x98fe('0x34')]);router[_0x98fe('0x7')](_0x98fe('0x35'),auth[_0x98fe('0x9')](),controller['faxAccounts']);router[_0x98fe('0x7')](_0x98fe('0x36'),auth['isAuthenticated'](),controller[_0x98fe('0x37')]);router[_0x98fe('0x7')](_0x98fe('0x38'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x39')]);router[_0x98fe('0x7')](_0x98fe('0x3a'),auth[_0x98fe('0x9')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0x98fe('0x3b'),auth[_0x98fe('0x9')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x98fe('0x7')]('/sms/queues/waitinginteractions',auth[_0x98fe('0x9')](),controller[_0x98fe('0x3c')]);router[_0x98fe('0x7')]('/whatsapp/queues/waitinginteractions',auth[_0x98fe('0x9')](),controller['whatsappQueuesWaitingInteractions']);router[_0x98fe('0x7')](_0x98fe('0x3d'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x3e')]);router[_0x98fe('0x3f')](_0x98fe('0x40'),auth[_0x98fe('0x9')](),controller['queueNotify'](_0x98fe('0x41')));router[_0x98fe('0x7')](_0x98fe('0x42'),auth['isAuthenticated'](),controller[_0x98fe('0x43')]);router[_0x98fe('0x3f')](_0x98fe('0x44'),auth['isAuthenticated'](),controller[_0x98fe('0x45')]('chat'));router[_0x98fe('0x7')](_0x98fe('0x46'),auth['isAuthenticated'](),controller[_0x98fe('0x47')]);router[_0x98fe('0x3f')](_0x98fe('0x48'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x45')]('fax'));router[_0x98fe('0x7')]('/fax/queues/:id',auth[_0x98fe('0x9')](),controller[_0x98fe('0x49')]);router[_0x98fe('0x3f')](_0x98fe('0x4a'),auth['isAuthenticated'](),controller[_0x98fe('0x45')](_0x98fe('0x4b')));router['get']('/openchannel/queues/:id',auth[_0x98fe('0x9')](),controller['showOpenchannelQueues']);router[_0x98fe('0x3f')](_0x98fe('0x4c'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x45')]('sms'));router[_0x98fe('0x3f')](_0x98fe('0x4d'),auth['isAuthenticated'](),controller[_0x98fe('0x45')](_0x98fe('0x4e')));router['get'](_0x98fe('0x4f'),auth[_0x98fe('0x9')](),controller[_0x98fe('0x50')]);router[_0x98fe('0x7')](_0x98fe('0x51'),auth[_0x98fe('0x9')](),controller['showWhatsappQueues']);router['post'](_0x98fe('0x52'),auth['isAuthenticated'](),controller[_0x98fe('0x53')]);module[_0x98fe('0x54')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 2c89f61..16487c1 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 _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0xfe136,_0x2acee9){var _0x28322e=function(_0x32522b){while(--_0x32522b){_0xfe136['push'](_0xfe136['shift']());}};_0x28322e(++_0x2acee9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file +var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x5ed257,_0x2d51b8){var _0x143b23=function(_0x30c9a2){while(--_0x30c9a2){_0x5ed257['push'](_0x5ed257['shift']());}};_0x143b23(++_0x2d51b8);}(_0xe706,0xa3));var _0x6e70=function(_0x4454c3,_0x24c130){_0x4454c3=_0x4454c3-0x0;var _0x195fa6=_0xe706[_0x4454c3];return _0x195fa6;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 33f7c87..998d92a 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 _0x7657=['exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','/:id','isAuthenticated','show','run','post','put','update','delete','destroy'];(function(_0xeea9a4,_0x41a905){var _0x1fdef9=function(_0x100fd0){while(--_0x100fd0){_0xeea9a4['push'](_0xeea9a4['shift']());}};_0x1fdef9(++_0x41a905);}(_0x7657,0x1a5));var _0x7765=function(_0x5b113d,_0x12adaf){_0x5b113d=_0x5b113d-0x0;var _0x44b99d=_0x7657[_0x5b113d];return _0x44b99d;};'use strict';var multer=require(_0x7765('0x0'));var util=require(_0x7765('0x1'));var path=require(_0x7765('0x2'));var timeout=require('connect-timeout');var express=require(_0x7765('0x3'));var router=express[_0x7765('0x4')]();var fs_extra=require(_0x7765('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7765('0x6'));var config=require(_0x7765('0x7'));var controller=require(_0x7765('0x8'));router[_0x7765('0x9')]('/',auth['isAuthenticated'](),controller[_0x7765('0xa')]);router[_0x7765('0x9')](_0x7765('0xb'),auth[_0x7765('0xc')](),controller[_0x7765('0xd')]);router[_0x7765('0x9')]('/:id/run',auth[_0x7765('0xc')](),controller[_0x7765('0xe')]);router[_0x7765('0xf')]('/',auth[_0x7765('0xc')](),controller['create']);router[_0x7765('0x10')](_0x7765('0xb'),auth['isAuthenticated'](),controller[_0x7765('0x11')]);router[_0x7765('0x12')](_0x7765('0xb'),auth[_0x7765('0xc')](),controller[_0x7765('0x13')]);module[_0x7765('0x14')]=router; \ No newline at end of file +var _0x3fa5=['../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','/:id/run','run','create','put','delete','exports','multer','util','connect-timeout','Router'];(function(_0x4c5d3d,_0x4ce396){var _0x296bb7=function(_0xf40928){while(--_0xf40928){_0x4c5d3d['push'](_0x4c5d3d['shift']());}};_0x296bb7(++_0x4ce396);}(_0x3fa5,0x92));var _0x53fa=function(_0x3cc28c,_0x29bc75){_0x3cc28c=_0x3cc28c-0x0;var _0x92e4f3=_0x3fa5[_0x3cc28c];return _0x92e4f3;};'use strict';var multer=require(_0x53fa('0x0'));var util=require(_0x53fa('0x1'));var path=require('path');var timeout=require(_0x53fa('0x2'));var express=require('express');var router=express[_0x53fa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x53fa('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x53fa('0x5'));var controller=require('./schedule.controller');router[_0x53fa('0x6')]('/',auth[_0x53fa('0x7')](),controller['index']);router[_0x53fa('0x6')](_0x53fa('0x8'),auth[_0x53fa('0x7')](),controller['show']);router[_0x53fa('0x6')](_0x53fa('0x9'),auth['isAuthenticated'](),controller[_0x53fa('0xa')]);router['post']('/',auth[_0x53fa('0x7')](),controller[_0x53fa('0xb')]);router[_0x53fa('0xc')]('/:id',auth[_0x53fa('0x7')](),controller['update']);router[_0x53fa('0xd')](_0x53fa('0x8'),auth[_0x53fa('0x7')](),controller['destroy']);module[_0x53fa('0xe')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index d9e0f76..8e1f856 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 _0x9650=['weeks','days','hours','minutes','csv','pdf','custom','default','BOOLEAN','TEXT','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters'];(function(_0x532f13,_0x317c50){var _0x18f9d5=function(_0x26e05b){while(--_0x26e05b){_0x532f13['push'](_0x532f13['shift']());}};_0x18f9d5(++_0x317c50);}(_0x9650,0x160));var _0x0965=function(_0x42c774,_0xb3d17c){_0x42c774=_0x42c774-0x0;var _0x2358d7=_0x9650[_0x42c774];return _0x2358d7;};'use strict';var Sequelize=require('sequelize');module[_0x0965('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0965('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0965('0x2')},'startAt':{'type':Sequelize[_0x0965('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x0965('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0965('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0965('0x5')](_0x0965('0x6'),_0x0965('0x7'),'months',_0x0965('0x8'),_0x0965('0x9'),_0x0965('0xa'),_0x0965('0xb')),'allowNull':![],'defaultValue':_0x0965('0x9')},'output':{'type':Sequelize[_0x0965('0x5')](_0x0965('0xc'),_0x0965('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0x0965('0xc')},'type':{'type':Sequelize[_0x0965('0x5')](_0x0965('0xe'),_0x0965('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x0965('0x10')],'defaultValue':![]},'email':{'type':Sequelize[_0x0965('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x0965('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x0965('0x10')],'defaultValue':!![]}}; \ No newline at end of file +var _0xed70=['hours','days','csv','pdf','xlsx','default','custom','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','months','weeks'];(function(_0x328fe0,_0x3d3987){var _0x5e7aee=function(_0x3ced8c){while(--_0x3ced8c){_0x328fe0['push'](_0x328fe0['shift']());}};_0x5e7aee(++_0x3d3987);}(_0xed70,0x7f));var _0x0ed7=function(_0x617fbe,_0x40665b){_0x617fbe=_0x617fbe-0x0;var _0x6e76d=_0xed70[_0x617fbe];return _0x6e76d;};'use strict';var Sequelize=require(_0x0ed7('0x0'));module['exports']={'name':{'type':Sequelize[_0x0ed7('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x0ed7('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0ed7('0x1')],'allowNull':![],'defaultValue':_0x0ed7('0x3')},'startAt':{'type':Sequelize[_0x0ed7('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x0ed7('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0ed7('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0ed7('0x6')]('years','quarters',_0x0ed7('0x7'),_0x0ed7('0x8'),'days',_0x0ed7('0x9'),'minutes'),'allowNull':![],'defaultValue':_0x0ed7('0xa')},'output':{'type':Sequelize[_0x0ed7('0x6')](_0x0ed7('0xb'),_0x0ed7('0xc'),_0x0ed7('0xd')),'allowNull':![],'defaultValue':_0x0ed7('0xb')},'type':{'type':Sequelize[_0x0ed7('0x6')]('custom',_0x0ed7('0xe')),'allowNull':![],'defaultValue':_0x0ed7('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x0ed7('0x1')]},'cc':{'type':Sequelize[_0x0ed7('0x10')]},'bcc':{'type':Sequelize[_0x0ed7('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index c66924c..c5018c3 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 _0xc479=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','Content-Range','reject','update','destroy','then','get','Scheduler','UserProfileResource','error','stack','name','index','map','Schedule','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','user','role'];(function(_0x32a0b9,_0x5e11f6){var _0x6ea7b7=function(_0x506260){while(--_0x506260){_0x32a0b9['push'](_0x32a0b9['shift']());}};_0x6ea7b7(++_0x5e11f6);}(_0xc479,0x1f1));var _0x9c47=function(_0x13bd4,_0x2eb96e){_0x13bd4=_0x13bd4-0x0;var _0x49a3d0=_0xc479[_0x13bd4];return _0x49a3d0;};'use strict';var emlformat=require(_0x9c47('0x0'));var rimraf=require(_0x9c47('0x1'));var zipdir=require(_0x9c47('0x2'));var jsonpatch=require(_0x9c47('0x3'));var rp=require('request-promise');var moment=require(_0x9c47('0x4'));var BPromise=require(_0x9c47('0x5'));var Mustache=require(_0x9c47('0x6'));var util=require(_0x9c47('0x7'));var path=require('path');var sox=require(_0x9c47('0x8'));var csv=require(_0x9c47('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c47('0xa'));var _=require(_0x9c47('0xb'));var squel=require(_0x9c47('0xc'));var crypto=require(_0x9c47('0xd'));var jsforce=require(_0x9c47('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9c47('0x9'));var querystring=require(_0x9c47('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9c47('0x10'));var qs=require(_0x9c47('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c47('0x12'))(_0x9c47('0x13'));var utils=require(_0x9c47('0x14'));var config=require(_0x9c47('0x15'));var licenseUtil=require(_0x9c47('0x16'));var db=require(_0x9c47('0x17'))['db'];function respondWithStatusCode(_0x4779ab,_0x556952){_0x556952=_0x556952||0xcc;return function(_0x29394f){if(_0x29394f){return _0x4779ab['sendStatus'](_0x556952);}return _0x4779ab['status'](_0x556952)[_0x9c47('0x18')]();};}function respondWithResult(_0x24f0cf,_0x4ab28b){_0x4ab28b=_0x4ab28b||0xc8;return function(_0x415a36){if(_0x415a36){return _0x24f0cf[_0x9c47('0x19')](_0x4ab28b)[_0x9c47('0x1a')](_0x415a36);}};}function respondWithFilteredResult(_0x161da4,_0x2396ee){return function(_0x252f2c){if(_0x252f2c){var _0x53014d=typeof _0x2396ee[_0x9c47('0x1b')]===_0x9c47('0x1c')&&typeof _0x2396ee['limit']===_0x9c47('0x1c');var _0x2acde0=_0x252f2c[_0x9c47('0x1d')];var _0x132819=_0x53014d?0x0:_0x2396ee[_0x9c47('0x1b')];var _0x463531=_0x53014d?_0x252f2c[_0x9c47('0x1d')]:_0x2396ee[_0x9c47('0x1b')]+_0x2396ee[_0x9c47('0x1e')];var _0x21aeb7;if(_0x463531>=_0x2acde0){_0x463531=_0x2acde0;_0x21aeb7=0xc8;}else{_0x21aeb7=0xce;}_0x161da4[_0x9c47('0x19')](_0x21aeb7);return _0x161da4['set'](_0x9c47('0x1f'),_0x132819+'-'+_0x463531+'/'+_0x2acde0)[_0x9c47('0x1a')](_0x252f2c);}return null;};}function patchUpdates(_0x4a4795){return function(_0x3752ca){try{jsonpatch['apply'](_0x3752ca,_0x4a4795,!![]);}catch(_0xf6e777){return BPromise[_0x9c47('0x20')](_0xf6e777);}return _0x3752ca['save']();};}function saveUpdates(_0x5ee83c,_0x32e33f){return function(_0x4ce4ce){if(_0x4ce4ce){return _0x4ce4ce[_0x9c47('0x21')](_0x5ee83c)['then'](function(_0x118230){return _0x118230;});}return null;};}function removeEntity(_0x22416c,_0x27fc00){return function(_0x312c30){if(_0x312c30){return _0x312c30[_0x9c47('0x22')]()[_0x9c47('0x23')](function(){var _0x2dd9d6=_0x312c30[_0x9c47('0x24')]({'plain':!![]});var _0x2146fe=_0x9c47('0x25');return db[_0x9c47('0x26')]['destroy']({'where':{'type':_0x2146fe,'resourceId':_0x2dd9d6['id']}})['then'](function(){return _0x312c30;});})[_0x9c47('0x23')](function(){_0x22416c[_0x9c47('0x19')](0xcc)[_0x9c47('0x18')]();});}};}function handleEntityNotFound(_0x5e62b5,_0x2f8fb1){return function(_0x3f78c7){if(!_0x3f78c7){_0x5e62b5['sendStatus'](0x194);}return _0x3f78c7;};}function handleError(_0x1243ec,_0x301df0){_0x301df0=_0x301df0||0x1f4;return function(_0x519df6){logger[_0x9c47('0x27')](_0x519df6[_0x9c47('0x28')]);if(_0x519df6[_0x9c47('0x29')]){delete _0x519df6[_0x9c47('0x29')];}_0x1243ec[_0x9c47('0x19')](_0x301df0)['send'](_0x519df6);};}exports[_0x9c47('0x2a')]=function(_0x1c12af,_0x59cd1e){var _0x7f5aee={},_0x588fca={},_0x3746c6={'count':0x0,'rows':[]};var _0x4d1e07=_[_0x9c47('0x2b')](db[_0x9c47('0x2c')][_0x9c47('0x2d')],function(_0x3e7954){return{'name':_0x3e7954['fieldName'],'type':_0x3e7954['type']['key']};});_0x588fca[_0x9c47('0x2e')]=_['map'](_0x4d1e07,'name');_0x588fca['query']=_['keys'](_0x1c12af[_0x9c47('0x2f')]);_0x588fca[_0x9c47('0x30')]=_[_0x9c47('0x31')](_0x588fca[_0x9c47('0x2e')],_0x588fca[_0x9c47('0x2f')]);_0x7f5aee[_0x9c47('0x32')]=_[_0x9c47('0x31')](_0x588fca['model'],qs[_0x9c47('0x33')](_0x1c12af[_0x9c47('0x2f')][_0x9c47('0x33')]));_0x7f5aee[_0x9c47('0x32')]=_0x7f5aee[_0x9c47('0x32')][_0x9c47('0x34')]?_0x7f5aee[_0x9c47('0x32')]:_0x588fca[_0x9c47('0x2e')];if(!_0x1c12af[_0x9c47('0x2f')][_0x9c47('0x35')](_0x9c47('0x36'))){_0x7f5aee[_0x9c47('0x1e')]=qs[_0x9c47('0x1e')](_0x1c12af[_0x9c47('0x2f')][_0x9c47('0x1e')]);_0x7f5aee[_0x9c47('0x1b')]=qs[_0x9c47('0x1b')](_0x1c12af[_0x9c47('0x2f')][_0x9c47('0x1b')]);}_0x7f5aee[_0x9c47('0x37')]=qs[_0x9c47('0x38')](_0x1c12af[_0x9c47('0x2f')]['sort']);_0x7f5aee['where']=qs['filters'](_[_0x9c47('0x39')](_0x1c12af[_0x9c47('0x2f')],_0x588fca[_0x9c47('0x30')]),_0x4d1e07);if(_0x1c12af[_0x9c47('0x2f')][_0x9c47('0x3a')]){_0x7f5aee[_0x9c47('0x3b')]=_['merge'](_0x7f5aee[_0x9c47('0x3b')],{'$or':_['map'](_0x4d1e07,function(_0x40bf2f){if(_0x40bf2f[_0x9c47('0x3c')]!==_0x9c47('0x3d')){var _0x2598c2={};_0x2598c2[_0x40bf2f[_0x9c47('0x29')]]={'$like':'%'+_0x1c12af[_0x9c47('0x2f')]['filter']+'%'};return _0x2598c2;}})});}_0x7f5aee=_[_0x9c47('0x3e')]({},_0x7f5aee,_0x1c12af[_0x9c47('0x3f')]);var _0x34d3c4={'where':_0x7f5aee[_0x9c47('0x3b')]};return db['Schedule']['count'](_0x34d3c4)['then'](function(_0x59c375){_0x3746c6[_0x9c47('0x1d')]=_0x59c375;if(_0x1c12af[_0x9c47('0x2f')][_0x9c47('0x40')]){_0x7f5aee['include']=[{'all':!![]}];}return db[_0x9c47('0x2c')][_0x9c47('0x41')](_0x7f5aee);})['then'](function(_0x650bce){_0x3746c6[_0x9c47('0x42')]=_0x650bce;return _0x3746c6;})[_0x9c47('0x23')](respondWithFilteredResult(_0x59cd1e,_0x7f5aee))[_0x9c47('0x43')](handleError(_0x59cd1e,null));};exports[_0x9c47('0x44')]=function(_0x51b048,_0x58f51e){var _0x5c7fec={'raw':![],'where':{'id':_0x51b048[_0x9c47('0x45')]['id']}},_0x2e80c5={};_0x2e80c5['model']=_[_0x9c47('0x46')](db[_0x9c47('0x2c')][_0x9c47('0x2d')]);_0x2e80c5[_0x9c47('0x2f')]=_[_0x9c47('0x46')](_0x51b048['query']);_0x2e80c5[_0x9c47('0x30')]=_['intersection'](_0x2e80c5[_0x9c47('0x2e')],_0x2e80c5[_0x9c47('0x2f')]);_0x5c7fec[_0x9c47('0x32')]=_[_0x9c47('0x31')](_0x2e80c5['model'],qs[_0x9c47('0x33')](_0x51b048[_0x9c47('0x2f')][_0x9c47('0x33')]));_0x5c7fec[_0x9c47('0x32')]=_0x5c7fec['attributes']['length']?_0x5c7fec[_0x9c47('0x32')]:_0x2e80c5['model'];if(_0x51b048[_0x9c47('0x2f')][_0x9c47('0x40')]){_0x5c7fec[_0x9c47('0x47')]=[{'all':!![]}];}_0x5c7fec=_[_0x9c47('0x3e')]({},_0x5c7fec,_0x51b048[_0x9c47('0x3f')]);return db[_0x9c47('0x2c')][_0x9c47('0x48')](_0x5c7fec)[_0x9c47('0x23')](handleEntityNotFound(_0x58f51e,null))[_0x9c47('0x23')](respondWithResult(_0x58f51e,null))[_0x9c47('0x43')](handleError(_0x58f51e,null));};exports[_0x9c47('0x49')]=function(_0x586ff0,_0x4c4d57){return db[_0x9c47('0x2c')][_0x9c47('0x49')](_0x586ff0[_0x9c47('0x4a')],{})[_0x9c47('0x23')](function(_0x394cbf){var _0x20d4fc=_0x586ff0[_0x9c47('0x4b')]['get']({'plain':!![]});if(!_0x20d4fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20d4fc[_0x9c47('0x4c')]==='user'){var _0x4fa8a9=_0x394cbf[_0x9c47('0x24')]({'plain':!![]});var _0x16d3c2=_0x9c47('0x25');return db[_0x9c47('0x4d')][_0x9c47('0x48')]({'where':{'name':_0x16d3c2,'userProfileId':_0x20d4fc['userProfileId']},'raw':!![]})[_0x9c47('0x23')](function(_0x2a8de7){if(_0x2a8de7&&_0x2a8de7[_0x9c47('0x4e')]===0x0){return db['UserProfileResource'][_0x9c47('0x49')]({'name':_0x4fa8a9[_0x9c47('0x29')],'resourceId':_0x4fa8a9['id'],'type':_0x2a8de7['name'],'sectionId':_0x2a8de7['id']},{})[_0x9c47('0x23')](function(){return _0x394cbf;});}else{return _0x394cbf;}})[_0x9c47('0x43')](function(_0x2b1599){logger[_0x9c47('0x27')](_0x9c47('0x4f'),_0x2b1599);throw _0x2b1599;});}return _0x394cbf;})[_0x9c47('0x23')](respondWithResult(_0x4c4d57,0xc9))['catch'](handleError(_0x4c4d57,null));};exports[_0x9c47('0x21')]=function(_0x1c21ea,_0x3a6755){if(_0x1c21ea[_0x9c47('0x4a')]['id']){delete _0x1c21ea['body']['id'];}return db[_0x9c47('0x2c')][_0x9c47('0x48')]({'where':{'id':_0x1c21ea[_0x9c47('0x45')]['id']}})[_0x9c47('0x23')](handleEntityNotFound(_0x3a6755,null))[_0x9c47('0x23')](saveUpdates(_0x1c21ea[_0x9c47('0x4a')],null))['then'](respondWithResult(_0x3a6755,null))[_0x9c47('0x43')](handleError(_0x3a6755,null));};exports[_0x9c47('0x22')]=function(_0x3f172a,_0x391a52){return db[_0x9c47('0x2c')][_0x9c47('0x48')]({'where':{'id':_0x3f172a[_0x9c47('0x45')]['id']}})['then'](handleEntityNotFound(_0x391a52,null))[_0x9c47('0x23')](removeEntity(_0x391a52,null))[_0x9c47('0x43')](handleError(_0x391a52,null));};exports[_0x9c47('0x50')]=function(_0x3a77d6,_0x329b69,_0x3b2714){var _0x25cca1=require(_0x9c47('0x51'));return db[_0x9c47('0x2c')][_0x9c47('0x48')]({'where':{'id':_0x3a77d6[_0x9c47('0x45')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x329b69,null))[_0x9c47('0x23')](function(){_0x25cca1[_0x9c47('0x50')](_0x3a77d6['params']['id']);})[_0x9c47('0x23')](respondWithStatusCode(_0x329b69,null))[_0x9c47('0x43')](handleError(_0x329b69,null));}; \ No newline at end of file +var _0x914b=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','reject','update','then','Scheduler','destroy','stack','name','map','Schedule','rawAttributes','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','type','filter','merge','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','user'];(function(_0x42686f,_0x35f36d){var _0x131c8d=function(_0x3f0953){while(--_0x3f0953){_0x42686f['push'](_0x42686f['shift']());}};_0x131c8d(++_0x35f36d);}(_0x914b,0x14e));var _0xb914=function(_0xf35bc1,_0x510803){_0xf35bc1=_0xf35bc1-0x0;var _0xa6b162=_0x914b[_0xf35bc1];return _0xa6b162;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb914('0x0'));var zipdir=require(_0xb914('0x1'));var jsonpatch=require(_0xb914('0x2'));var rp=require(_0xb914('0x3'));var moment=require(_0xb914('0x4'));var BPromise=require(_0xb914('0x5'));var Mustache=require(_0xb914('0x6'));var util=require(_0xb914('0x7'));var path=require(_0xb914('0x8'));var sox=require(_0xb914('0x9'));var csv=require(_0xb914('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb914('0xb'));var _=require(_0xb914('0xc'));var squel=require(_0xb914('0xd'));var crypto=require(_0xb914('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb914('0xa'));var querystring=require(_0xb914('0xf'));var Papa=require('papaparse');var Redis=require(_0xb914('0x10'));var authService=require(_0xb914('0x11'));var qs=require(_0xb914('0x12'));var as=require(_0xb914('0x13'));var hardwareService=require(_0xb914('0x14'));var logger=require(_0xb914('0x15'))(_0xb914('0x16'));var utils=require(_0xb914('0x17'));var config=require(_0xb914('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb914('0x19'))['db'];function respondWithStatusCode(_0x3ec736,_0x2c8fa6){_0x2c8fa6=_0x2c8fa6||0xcc;return function(_0x33a8aa){if(_0x33a8aa){return _0x3ec736[_0xb914('0x1a')](_0x2c8fa6);}return _0x3ec736['status'](_0x2c8fa6)[_0xb914('0x1b')]();};}function respondWithResult(_0x3243cd,_0xea9e07){_0xea9e07=_0xea9e07||0xc8;return function(_0x10bdd0){if(_0x10bdd0){return _0x3243cd[_0xb914('0x1c')](_0xea9e07)[_0xb914('0x1d')](_0x10bdd0);}};}function respondWithFilteredResult(_0x85092f,_0x3d1e3e){return function(_0x552cef){if(_0x552cef){var _0xa33b61=typeof _0x3d1e3e[_0xb914('0x1e')]===_0xb914('0x1f')&&typeof _0x3d1e3e[_0xb914('0x20')]===_0xb914('0x1f');var _0x5de136=_0x552cef['count'];var _0x380b18=_0xa33b61?0x0:_0x3d1e3e[_0xb914('0x1e')];var _0x10904e=_0xa33b61?_0x552cef[_0xb914('0x21')]:_0x3d1e3e[_0xb914('0x1e')]+_0x3d1e3e[_0xb914('0x20')];var _0x4daf80;if(_0x10904e>=_0x5de136){_0x10904e=_0x5de136;_0x4daf80=0xc8;}else{_0x4daf80=0xce;}_0x85092f[_0xb914('0x1c')](_0x4daf80);return _0x85092f['set']('Content-Range',_0x380b18+'-'+_0x10904e+'/'+_0x5de136)[_0xb914('0x1d')](_0x552cef);}return null;};}function patchUpdates(_0x2d2fd4){return function(_0xec538f){try{jsonpatch['apply'](_0xec538f,_0x2d2fd4,!![]);}catch(_0x4bc9d4){return BPromise[_0xb914('0x22')](_0x4bc9d4);}return _0xec538f['save']();};}function saveUpdates(_0x4e4372,_0x56b865){return function(_0x578fe4){if(_0x578fe4){return _0x578fe4[_0xb914('0x23')](_0x4e4372)[_0xb914('0x24')](function(_0x303a86){return _0x303a86;});}return null;};}function removeEntity(_0x5d676f,_0x447db3){return function(_0x25d275){if(_0x25d275){return _0x25d275['destroy']()['then'](function(){var _0x1f50ee=_0x25d275['get']({'plain':!![]});var _0x6b6c5a=_0xb914('0x25');return db['UserProfileResource'][_0xb914('0x26')]({'where':{'type':_0x6b6c5a,'resourceId':_0x1f50ee['id']}})[_0xb914('0x24')](function(){return _0x25d275;});})[_0xb914('0x24')](function(){_0x5d676f[_0xb914('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ff7b3,_0x5dcf37){return function(_0x1df451){if(!_0x1df451){_0x1ff7b3[_0xb914('0x1a')](0x194);}return _0x1df451;};}function handleError(_0x1a6eda,_0x1dc655){_0x1dc655=_0x1dc655||0x1f4;return function(_0x1a8eeb){logger['error'](_0x1a8eeb[_0xb914('0x27')]);if(_0x1a8eeb['name']){delete _0x1a8eeb[_0xb914('0x28')];}_0x1a6eda[_0xb914('0x1c')](_0x1dc655)['send'](_0x1a8eeb);};}exports['index']=function(_0xa3b2e0,_0x1179b6){var _0x20921d={},_0x3ec517={},_0x47013f={'count':0x0,'rows':[]};var _0x26d189=_[_0xb914('0x29')](db[_0xb914('0x2a')][_0xb914('0x2b')],function(_0x462d1a){return{'name':_0x462d1a['fieldName'],'type':_0x462d1a['type']['key']};});_0x3ec517[_0xb914('0x2c')]=_[_0xb914('0x29')](_0x26d189,_0xb914('0x28'));_0x3ec517['query']=_['keys'](_0xa3b2e0[_0xb914('0x2d')]);_0x3ec517[_0xb914('0x2e')]=_[_0xb914('0x2f')](_0x3ec517['model'],_0x3ec517[_0xb914('0x2d')]);_0x20921d['attributes']=_[_0xb914('0x2f')](_0x3ec517['model'],qs[_0xb914('0x30')](_0xa3b2e0[_0xb914('0x2d')][_0xb914('0x30')]));_0x20921d[_0xb914('0x31')]=_0x20921d[_0xb914('0x31')][_0xb914('0x32')]?_0x20921d[_0xb914('0x31')]:_0x3ec517[_0xb914('0x2c')];if(!_0xa3b2e0[_0xb914('0x2d')][_0xb914('0x33')](_0xb914('0x34'))){_0x20921d[_0xb914('0x20')]=qs[_0xb914('0x20')](_0xa3b2e0['query'][_0xb914('0x20')]);_0x20921d[_0xb914('0x1e')]=qs[_0xb914('0x1e')](_0xa3b2e0['query'][_0xb914('0x1e')]);}_0x20921d[_0xb914('0x35')]=qs[_0xb914('0x36')](_0xa3b2e0[_0xb914('0x2d')][_0xb914('0x36')]);_0x20921d[_0xb914('0x37')]=qs[_0xb914('0x2e')](_['pick'](_0xa3b2e0['query'],_0x3ec517[_0xb914('0x2e')]),_0x26d189);if(_0xa3b2e0[_0xb914('0x2d')]['filter']){_0x20921d[_0xb914('0x37')]=_['merge'](_0x20921d[_0xb914('0x37')],{'$or':_[_0xb914('0x29')](_0x26d189,function(_0x75d93f){if(_0x75d93f[_0xb914('0x38')]!=='VIRTUAL'){var _0x338e42={};_0x338e42[_0x75d93f[_0xb914('0x28')]]={'$like':'%'+_0xa3b2e0[_0xb914('0x2d')][_0xb914('0x39')]+'%'};return _0x338e42;}})});}_0x20921d=_[_0xb914('0x3a')]({},_0x20921d,_0xa3b2e0[_0xb914('0x3b')]);var _0x3e20d6={'where':_0x20921d[_0xb914('0x37')]};return db[_0xb914('0x2a')]['count'](_0x3e20d6)[_0xb914('0x24')](function(_0x6e3315){_0x47013f[_0xb914('0x21')]=_0x6e3315;if(_0xa3b2e0[_0xb914('0x2d')][_0xb914('0x3c')]){_0x20921d[_0xb914('0x3d')]=[{'all':!![]}];}return db[_0xb914('0x2a')][_0xb914('0x3e')](_0x20921d);})[_0xb914('0x24')](function(_0x3bea79){_0x47013f[_0xb914('0x3f')]=_0x3bea79;return _0x47013f;})[_0xb914('0x24')](respondWithFilteredResult(_0x1179b6,_0x20921d))['catch'](handleError(_0x1179b6,null));};exports['show']=function(_0x954acb,_0x1f8993){var _0x3ef7c5={'raw':![],'where':{'id':_0x954acb[_0xb914('0x40')]['id']}},_0xbfa7c1={};_0xbfa7c1[_0xb914('0x2c')]=_[_0xb914('0x41')](db[_0xb914('0x2a')][_0xb914('0x2b')]);_0xbfa7c1['query']=_[_0xb914('0x41')](_0x954acb[_0xb914('0x2d')]);_0xbfa7c1[_0xb914('0x2e')]=_[_0xb914('0x2f')](_0xbfa7c1['model'],_0xbfa7c1[_0xb914('0x2d')]);_0x3ef7c5['attributes']=_['intersection'](_0xbfa7c1['model'],qs[_0xb914('0x30')](_0x954acb['query'][_0xb914('0x30')]));_0x3ef7c5[_0xb914('0x31')]=_0x3ef7c5[_0xb914('0x31')][_0xb914('0x32')]?_0x3ef7c5[_0xb914('0x31')]:_0xbfa7c1[_0xb914('0x2c')];if(_0x954acb[_0xb914('0x2d')][_0xb914('0x3c')]){_0x3ef7c5[_0xb914('0x3d')]=[{'all':!![]}];}_0x3ef7c5=_[_0xb914('0x3a')]({},_0x3ef7c5,_0x954acb[_0xb914('0x3b')]);return db[_0xb914('0x2a')][_0xb914('0x42')](_0x3ef7c5)['then'](handleEntityNotFound(_0x1f8993,null))[_0xb914('0x24')](respondWithResult(_0x1f8993,null))[_0xb914('0x43')](handleError(_0x1f8993,null));};exports[_0xb914('0x44')]=function(_0x1c525b,_0x2e45e9){return db[_0xb914('0x2a')][_0xb914('0x44')](_0x1c525b[_0xb914('0x45')],{})[_0xb914('0x24')](function(_0x329d59){var _0x47a0fd=_0x1c525b[_0xb914('0x46')]['get']({'plain':!![]});if(!_0x47a0fd)throw new Error(_0xb914('0x47'));if(_0x47a0fd[_0xb914('0x48')]===_0xb914('0x46')){var _0x5439cc=_0x329d59['get']({'plain':!![]});var _0x420dd0=_0xb914('0x25');return db[_0xb914('0x49')][_0xb914('0x42')]({'where':{'name':_0x420dd0,'userProfileId':_0x47a0fd[_0xb914('0x4a')]},'raw':!![]})[_0xb914('0x24')](function(_0x1ca17f){if(_0x1ca17f&&_0x1ca17f[_0xb914('0x4b')]===0x0){return db[_0xb914('0x4c')][_0xb914('0x44')]({'name':_0x5439cc[_0xb914('0x28')],'resourceId':_0x5439cc['id'],'type':_0x1ca17f[_0xb914('0x28')],'sectionId':_0x1ca17f['id']},{})['then'](function(){return _0x329d59;});}else{return _0x329d59;}})[_0xb914('0x43')](function(_0x327e2e){logger[_0xb914('0x4d')](_0xb914('0x4e'),_0x327e2e);throw _0x327e2e;});}return _0x329d59;})['then'](respondWithResult(_0x2e45e9,0xc9))[_0xb914('0x43')](handleError(_0x2e45e9,null));};exports['update']=function(_0x265ec5,_0x1319d8){if(_0x265ec5[_0xb914('0x45')]['id']){delete _0x265ec5[_0xb914('0x45')]['id'];}return db[_0xb914('0x2a')]['find']({'where':{'id':_0x265ec5[_0xb914('0x40')]['id']}})[_0xb914('0x24')](handleEntityNotFound(_0x1319d8,null))[_0xb914('0x24')](saveUpdates(_0x265ec5[_0xb914('0x45')],null))['then'](respondWithResult(_0x1319d8,null))[_0xb914('0x43')](handleError(_0x1319d8,null));};exports['destroy']=function(_0x4a2723,_0x5f8eff){return db[_0xb914('0x2a')][_0xb914('0x42')]({'where':{'id':_0x4a2723[_0xb914('0x40')]['id']}})['then'](handleEntityNotFound(_0x5f8eff,null))[_0xb914('0x24')](removeEntity(_0x5f8eff,null))[_0xb914('0x43')](handleError(_0x5f8eff,null));};exports[_0xb914('0x4f')]=function(_0x231e6e,_0x4b52e3,_0x5a8014){var _0x2c901a=require(_0xb914('0x50'));return db[_0xb914('0x2a')][_0xb914('0x42')]({'where':{'id':_0x231e6e[_0xb914('0x40')]['id']},'raw':!![]})[_0xb914('0x24')](handleEntityNotFound(_0x4b52e3,null))[_0xb914('0x24')](function(){_0x2c901a[_0xb914('0x4f')](_0x231e6e[_0xb914('0x40')]['id']);})[_0xb914('0x24')](respondWithStatusCode(_0x4b52e3,null))[_0xb914('0x43')](handleError(_0x4b52e3,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 793d5d6..72e9829 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 _0x216f=['moment','bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','tools_schedules','lodash','../../config/logger'];(function(_0x1063c5,_0x53ead5){var _0x4dcd91=function(_0x2284f3){while(--_0x2284f3){_0x1063c5['push'](_0x1063c5['shift']());}};_0x4dcd91(++_0x53ead5);}(_0x216f,0x139));var _0xf216=function(_0x42811a,_0x2d5aa6){_0x42811a=_0x42811a-0x0;var _0x2fc67c=_0x216f[_0x42811a];return _0x2fc67c;};'use strict';var _=require(_0xf216('0x0'));var util=require('util');var logger=require(_0xf216('0x1'))('api');var moment=require(_0xf216('0x2'));var BPromise=require(_0xf216('0x3'));var rp=require(_0xf216('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf216('0x5'));var config=require(_0xf216('0x6'));var attributes=require(_0xf216('0x7'));module['exports']=function(_0x1b843b,_0x596a0e){return _0x1b843b['define']('Schedule',attributes,{'tableName':_0xf216('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d24=['bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','define','tools_schedules','util','../../config/logger','api'];(function(_0x3d5351,_0x27bc80){var _0x1db4db=function(_0x3f572b){while(--_0x3f572b){_0x3d5351['push'](_0x3d5351['shift']());}};_0x1db4db(++_0x27bc80);}(_0x9d24,0x11b));var _0x49d2=function(_0x264b65,_0x509dd5){_0x264b65=_0x264b65-0x0;var _0xcd8a8e=_0x9d24[_0x264b65];return _0xcd8a8e;};'use strict';var _=require('lodash');var util=require(_0x49d2('0x0'));var logger=require(_0x49d2('0x1'))(_0x49d2('0x2'));var moment=require('moment');var BPromise=require(_0x49d2('0x3'));var rp=require(_0x49d2('0x4'));var fs=require('fs');var path=require(_0x49d2('0x5'));var rimraf=require(_0x49d2('0x6'));var config=require(_0x49d2('0x7'));var attributes=require(_0x49d2('0x8'));module['exports']=function(_0x3f6fa5,_0x46ef0a){return _0x3f6fa5[_0x49d2('0x9')]('Schedule',attributes,{'tableName':_0x49d2('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 3b66f9c..969c28a 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 _0x1dca=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','moment','bluebird'];(function(_0x26682e,_0x1f5470){var _0x2caa74=function(_0x45b44b){while(--_0x45b44b){_0x26682e['push'](_0x26682e['shift']());}};_0x2caa74(++_0x1f5470);}(_0x1dca,0x82));var _0xa1dc=function(_0x5b3e28,_0x2ad693){_0x5b3e28=_0x5b3e28-0x0;var _0x21a6f4=_0x1dca[_0x5b3e28];return _0x21a6f4;};'use strict';var _=require(_0xa1dc('0x0'));var util=require('util');var moment=require(_0xa1dc('0x1'));var BPromise=require(_0xa1dc('0x2'));var rs=require(_0xa1dc('0x3'));var fs=require('fs');var Redis=require(_0xa1dc('0x4'));var db=require(_0xa1dc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1dc('0x6'))(_0xa1dc('0x7'));var config=require(_0xa1dc('0x8'));var jayson=require(_0xa1dc('0x9'));var client=jayson['client'][_0xa1dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2254c3,_0x347f46,_0x241b01){return new BPromise(function(_0x506537,_0x3c5448){return client['request'](_0x2254c3,_0x241b01)['then'](function(_0x3ca2c0){logger[_0xa1dc('0xb')](_0xa1dc('0xc'),_0x347f46,_0xa1dc('0xd'));logger[_0xa1dc('0xe')]('Schedule,\x20%s,\x20%s,\x20%s',_0x347f46,'request\x20sent',JSON[_0xa1dc('0xf')](_0x3ca2c0));if(_0x3ca2c0[_0xa1dc('0x10')]){if(_0x3ca2c0[_0xa1dc('0x10')]['code']===0x1f4){logger[_0xa1dc('0x10')]('Schedule,\x20%s,\x20%s',_0x347f46,_0x3ca2c0['error'][_0xa1dc('0x11')]);return _0x3c5448(_0x3ca2c0['error']['message']);}logger[_0xa1dc('0x10')]('Schedule,\x20%s,\x20%s',_0x347f46,_0x3ca2c0[_0xa1dc('0x10')][_0xa1dc('0x11')]);return _0x506537(_0x3ca2c0[_0xa1dc('0x10')]['message']);}else{logger[_0xa1dc('0xb')]('Schedule,\x20%s,\x20%s',_0x347f46,_0xa1dc('0xd'));_0x506537(_0x3ca2c0['result'][_0xa1dc('0x11')]);}})[_0xa1dc('0x12')](function(_0x17166a){logger['error'](_0xa1dc('0xc'),_0x347f46,_0x17166a);_0x3c5448(_0x17166a);});});} \ No newline at end of file +var _0xd742=['stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent'];(function(_0x279f94,_0x211ea4){var _0x129b6d=function(_0x48ba86){while(--_0x48ba86){_0x279f94['push'](_0x279f94['shift']());}};_0x129b6d(++_0x211ea4);}(_0xd742,0x6a));var _0x2d74=function(_0x2dc457,_0x37b6b9){_0x2dc457=_0x2dc457-0x0;var _0xd65e48=_0xd742[_0x2dc457];return _0xd65e48;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2d74('0x0'));var rs=require(_0x2d74('0x1'));var fs=require('fs');var Redis=require(_0x2d74('0x2'));var db=require(_0x2d74('0x3'))['db'];var utils=require(_0x2d74('0x4'));var logger=require(_0x2d74('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2d74('0x6'));var client=jayson[_0x2d74('0x7')][_0x2d74('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24ee29,_0xdce9c4,_0x2ca46b){return new BPromise(function(_0x4d80e2,_0x4db6ba){return client[_0x2d74('0x9')](_0x24ee29,_0x2ca46b)[_0x2d74('0xa')](function(_0x3f3e90){logger[_0x2d74('0xb')](_0x2d74('0xc'),_0xdce9c4,_0x2d74('0xd'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0xdce9c4,_0x2d74('0xd'),JSON[_0x2d74('0xe')](_0x3f3e90));if(_0x3f3e90[_0x2d74('0xf')]){if(_0x3f3e90['error'][_0x2d74('0x10')]===0x1f4){logger[_0x2d74('0xf')](_0x2d74('0xc'),_0xdce9c4,_0x3f3e90[_0x2d74('0xf')][_0x2d74('0x11')]);return _0x4db6ba(_0x3f3e90[_0x2d74('0xf')]['message']);}logger[_0x2d74('0xf')]('Schedule,\x20%s,\x20%s',_0xdce9c4,_0x3f3e90['error'][_0x2d74('0x11')]);return _0x4d80e2(_0x3f3e90[_0x2d74('0xf')]['message']);}else{logger[_0x2d74('0xb')]('Schedule,\x20%s,\x20%s',_0xdce9c4,'request\x20sent');_0x4d80e2(_0x3f3e90[_0x2d74('0x12')]['message']);}})[_0x2d74('0x13')](function(_0x431bb3){logger['error'](_0x2d74('0xc'),_0xdce9c4,_0x431bb3);_0x4db6ba(_0x431bb3);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 2ab5e63..0f1e6d2 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 _0x20a7=['./screenRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2e767e,_0x591c30){var _0x539d6c=function(_0x1122fc){while(--_0x1122fc){_0x2e767e['push'](_0x2e767e['shift']());}};_0x539d6c(++_0x591c30);}(_0x20a7,0x185));var _0x720a=function(_0x5ab567,_0x23c9ac){_0x5ab567=_0x5ab567-0x0;var _0x1e3e70=_0x20a7[_0x5ab567];return _0x1e3e70;};'use strict';var multer=require(_0x720a('0x0'));var util=require(_0x720a('0x1'));var path=require(_0x720a('0x2'));var timeout=require(_0x720a('0x3'));var express=require(_0x720a('0x4'));var router=express[_0x720a('0x5')]();var fs_extra=require(_0x720a('0x6'));var auth=require(_0x720a('0x7'));var interaction=require(_0x720a('0x8'));var config=require(_0x720a('0x9'));var controller=require(_0x720a('0xa'));router[_0x720a('0xb')]('/',auth[_0x720a('0xc')](),controller[_0x720a('0xd')]);router[_0x720a('0xb')]('/describe',auth[_0x720a('0xc')](),controller['describe']);router[_0x720a('0xb')](_0x720a('0xe'),auth[_0x720a('0xc')](),controller[_0x720a('0xf')]);router['get'](_0x720a('0x10'),auth[_0x720a('0xc')](),controller['download']);router['post']('/',auth[_0x720a('0xc')](),controller[_0x720a('0x11')]);router['put'](_0x720a('0xe'),auth[_0x720a('0xc')](),controller[_0x720a('0x12')]);router[_0x720a('0x13')](_0x720a('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x720a('0x14')]=router; \ No newline at end of file +var _0x2ef9=['describe','show','/:id/download','download','post','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe'];(function(_0x223a00,_0x1f1e9f){var _0x152f91=function(_0x511bf6){while(--_0x511bf6){_0x223a00['push'](_0x223a00['shift']());}};_0x152f91(++_0x1f1e9f);}(_0x2ef9,0x154));var _0x92ef=function(_0x4d7753,_0x7fa2ac){_0x4d7753=_0x4d7753-0x0;var _0x40fd64=_0x2ef9[_0x4d7753];return _0x40fd64;};'use strict';var multer=require(_0x92ef('0x0'));var util=require(_0x92ef('0x1'));var path=require(_0x92ef('0x2'));var timeout=require(_0x92ef('0x3'));var express=require(_0x92ef('0x4'));var router=express['Router']();var fs_extra=require(_0x92ef('0x5'));var auth=require(_0x92ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x92ef('0x7'));var controller=require(_0x92ef('0x8'));router[_0x92ef('0x9')]('/',auth[_0x92ef('0xa')](),controller['index']);router[_0x92ef('0x9')](_0x92ef('0xb'),auth['isAuthenticated'](),controller[_0x92ef('0xc')]);router[_0x92ef('0x9')]('/:id',auth[_0x92ef('0xa')](),controller[_0x92ef('0xd')]);router[_0x92ef('0x9')](_0x92ef('0xe'),auth[_0x92ef('0xa')](),controller[_0x92ef('0xf')]);router[_0x92ef('0x10')]('/',auth[_0x92ef('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x92ef('0x11')]);router[_0x92ef('0x12')](_0x92ef('0x13'),auth[_0x92ef('0xa')](),controller[_0x92ef('0x14')]);module[_0x92ef('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 7c8cb38..24cbfc2 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 _0x47c5=['INTEGER','startedAt','subtract','closedAt','duration','DATE','format','toString','getDataValue','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','value','extname','STRING','replace','setDataValue'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0x47c5,0x165));var _0x547c=function(_0x590454,_0x30c9cf){_0x590454=_0x590454-0x0;var _0x21cb88=_0x47c5[_0x590454];return _0x21cb88;};'use strict';var Sequelize=require(_0x547c('0x0'));var moment=require(_0x547c('0x1'));var path=require(_0x547c('0x2'));var config=require(_0x547c('0x3'));module[_0x547c('0x4')]={'format':{'type':Sequelize[_0x547c('0x5')],'get':function(){return this['getDataValue'](_0x547c('0x6'))?path[_0x547c('0x7')](this['getDataValue'](_0x547c('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x547c('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x547c('0x8')],'set':function(_0x439f25){var _0x381f2e=_0x439f25[_0x547c('0x9')](/\\/g,'/');this[_0x547c('0xa')](_0x547c('0x6'),_0x381f2e);}},'rating':{'type':Sequelize[_0x547c('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x547c('0xb')],'set':function(_0x10dec9){this[_0x547c('0xa')](_0x547c('0xc'),moment()[_0x547c('0xd')](_0x10dec9,'ms'));this[_0x547c('0xa')](_0x547c('0xe'),moment());this[_0x547c('0xa')](_0x547c('0xf'),_0x10dec9);}},'startedAt':{'type':Sequelize[_0x547c('0x10')],'get':function(){return moment(this['getDataValue'](_0x547c('0xc')))[_0x547c('0x11')]('MM-DD-YYYY\x20HH:mm')[_0x547c('0x12')]();}},'closedAt':{'type':Sequelize[_0x547c('0x10')],'get':function(){return moment(this[_0x547c('0x13')](_0x547c('0xe')))[_0x547c('0x11')](_0x547c('0x14'))[_0x547c('0x12')]();}},'createdAt':{'type':Sequelize[_0x547c('0x10')],'get':function(){return moment(this[_0x547c('0x13')](_0x547c('0x15')))[_0x547c('0x11')](_0x547c('0x14'))[_0x547c('0x12')]();}},'updatedAt':{'type':Sequelize[_0x547c('0x10')],'get':function(){return moment(this[_0x547c('0x13')](_0x547c('0x16')))[_0x547c('0x11')](_0x547c('0x14'))['toString']();}}}; \ No newline at end of file +var _0xb8cb=['../../config/environment','exports','VIRTUAL','getDataValue','extname','STRING','replace','setDataValue','value','INTEGER','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x3c12c3,_0x370b5d){_0x3c12c3=_0x3c12c3-0x0;var _0x124bda=_0xb8cb[_0x3c12c3];return _0x124bda;};'use strict';var Sequelize=require(_0xbb8c('0x0'));var moment=require(_0xbb8c('0x1'));var path=require(_0xbb8c('0x2'));var config=require(_0xbb8c('0x3'));module[_0xbb8c('0x4')]={'format':{'type':Sequelize[_0xbb8c('0x5')],'get':function(){return this[_0xbb8c('0x6')]('value')?path[_0xbb8c('0x7')](this[_0xbb8c('0x6')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbb8c('0x8')]},'value':{'type':Sequelize[_0xbb8c('0x8')],'set':function(_0x3eb759){var _0x497956=_0x3eb759[_0xbb8c('0x9')](/\\/g,'/');this[_0xbb8c('0xa')](_0xbb8c('0xb'),_0x497956);}},'rating':{'type':Sequelize[_0xbb8c('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xbb8c('0xc')],'set':function(_0x2a9791){this[_0xbb8c('0xa')](_0xbb8c('0xd'),moment()[_0xbb8c('0xe')](_0x2a9791,'ms'));this[_0xbb8c('0xa')](_0xbb8c('0xf'),moment());this[_0xbb8c('0xa')]('duration',_0x2a9791);}},'startedAt':{'type':Sequelize[_0xbb8c('0x10')],'get':function(){return moment(this[_0xbb8c('0x6')](_0xbb8c('0xd')))[_0xbb8c('0x11')](_0xbb8c('0x12'))['toString']();}},'closedAt':{'type':Sequelize[_0xbb8c('0x10')],'get':function(){return moment(this[_0xbb8c('0x6')](_0xbb8c('0xf')))[_0xbb8c('0x11')](_0xbb8c('0x12'))[_0xbb8c('0x13')]();}},'createdAt':{'type':Sequelize[_0xbb8c('0x10')],'get':function(){return moment(this['getDataValue'](_0xbb8c('0x14')))[_0xbb8c('0x11')](_0xbb8c('0x12'))[_0xbb8c('0x13')]();}},'updatedAt':{'type':Sequelize[_0xbb8c('0x10')],'get':function(){return moment(this[_0xbb8c('0x6')](_0xbb8c('0x15')))[_0xbb8c('0x11')](_0xbb8c('0x12'))[_0xbb8c('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 3331f1a..d66e736 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 _0x4b84=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','show','params','find','catch','create','body','duration','createdAt','closedAt','value','download','uniqueid','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','join','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','send','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','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','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','rawAttributes','fieldName','type','key','model','differenceBy','map','format'];(function(_0x254060,_0x308726){var _0x423abd=function(_0x30c47){while(--_0x30c47){_0x254060['push'](_0x254060['shift']());}};_0x423abd(++_0x308726);}(_0x4b84,0x1cc));var _0x44b8=function(_0x8bb4c1,_0x2d6e53){_0x8bb4c1=_0x8bb4c1-0x0;var _0x67a6e1=_0x4b84[_0x8bb4c1];return _0x67a6e1;};'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(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x25a0c1,_0x47689e){return function(_0x230a3d){if(!_0x230a3d){_0x25a0c1['sendStatus'](0x194);}return _0x230a3d;};}function handleError(_0x474f01,_0x502acf){_0x502acf=_0x502acf||0x1f4;return function(_0x41d673){logger[_0x44b8('0x22')](_0x41d673['stack']);if(_0x41d673[_0x44b8('0x23')]){delete _0x41d673[_0x44b8('0x23')];}_0x474f01[_0x44b8('0x14')](_0x502acf)['send'](_0x41d673);};}exports[_0x44b8('0x24')]=function(_0x242342,_0x53d9c7){var _0x2e0174={},_0x4a182d={},_0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['ScreenRecording'][_0x44b8('0x25')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x26')],'type':_0x29b18d[_0x44b8('0x27')][_0x44b8('0x28')]};});_0x4a182d[_0x44b8('0x29')]=_[_0x44b8('0x2a')](_[_0x44b8('0x2b')](_0x5a544c,_0x44b8('0x23')),[_0x44b8('0x2c')]);_0x4a182d[_0x44b8('0x2d')]=_[_0x44b8('0x2e')](_0x242342[_0x44b8('0x2d')]);_0x4a182d['filters']=_[_0x44b8('0x2f')](_0x4a182d['model'],_0x4a182d[_0x44b8('0x2d')]);_0x2e0174[_0x44b8('0x30')]=_[_0x44b8('0x2f')](_0x4a182d[_0x44b8('0x29')],qs[_0x44b8('0x31')](_0x242342['query'][_0x44b8('0x31')]));_0x2e0174[_0x44b8('0x30')]=_0x2e0174[_0x44b8('0x30')][_0x44b8('0x32')]?_0x2e0174[_0x44b8('0x30')]:_0x4a182d['model'];if(!_0x242342[_0x44b8('0x2d')][_0x44b8('0x33')](_0x44b8('0x34'))){_0x2e0174[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x17')]);_0x2e0174[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x19')]);}_0x2e0174[_0x44b8('0x35')]=qs[_0x44b8('0x36')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x36')]);_0x2e0174[_0x44b8('0x37')]=qs[_0x44b8('0x38')](_[_0x44b8('0x39')](_0x242342[_0x44b8('0x2d')],_0x4a182d[_0x44b8('0x38')]),_0x5a544c);if(_0x242342[_0x44b8('0x2d')][_0x44b8('0x3a')]){_0x2e0174['where']=_[_0x44b8('0x3b')](_0x2e0174[_0x44b8('0x37')],{'$or':_['map'](_0x5a544c,function(_0x25688b){if(_0x25688b[_0x44b8('0x27')]!==_0x44b8('0x3c')){var _0x332c2b={};_0x332c2b[_0x25688b['name']]={'$like':'%'+_0x242342[_0x44b8('0x2d')][_0x44b8('0x3a')]+'%'};return _0x332c2b;}})});}_0x2e0174=_[_0x44b8('0x3b')]({},_0x2e0174,_0x242342[_0x44b8('0x3d')]);var _0x9cb2a={'where':_0x2e0174[_0x44b8('0x37')]};return db[_0x44b8('0x3e')][_0x44b8('0x18')](_0x9cb2a)[_0x44b8('0x20')](function(_0x3d1be1){_0xfb0028[_0x44b8('0x18')]=_0x3d1be1;if(_0x242342[_0x44b8('0x2d')][_0x44b8('0x3f')]){_0x2e0174[_0x44b8('0x40')]=[{'all':!![]}];}return db[_0x44b8('0x3e')][_0x44b8('0x41')](_0x2e0174);})['then'](function(_0x12a0a4){_0xfb0028[_0x44b8('0x42')]=_0x12a0a4;return _0xfb0028;})[_0x44b8('0x20')](respondWithFilteredResult(_0x53d9c7,_0x2e0174))['catch'](handleError(_0x53d9c7,null));};exports[_0x44b8('0x43')]=function(_0x1054c5,_0x229cc9){var _0x585a16={'raw':![],'where':{'id':_0x1054c5[_0x44b8('0x44')]['id']}},_0xbad4bb={};_0xbad4bb[_0x44b8('0x29')]=_[_0x44b8('0x2e')](db[_0x44b8('0x3e')]['rawAttributes']);_0xbad4bb['query']=_[_0x44b8('0x2e')](_0x1054c5[_0x44b8('0x2d')]);_0xbad4bb[_0x44b8('0x38')]=_[_0x44b8('0x2f')](_0xbad4bb[_0x44b8('0x29')],_0xbad4bb[_0x44b8('0x2d')]);_0x585a16[_0x44b8('0x30')]=_[_0x44b8('0x2f')](_0xbad4bb[_0x44b8('0x29')],qs[_0x44b8('0x31')](_0x1054c5[_0x44b8('0x2d')][_0x44b8('0x31')]));_0x585a16[_0x44b8('0x30')]=_0x585a16[_0x44b8('0x30')][_0x44b8('0x32')]?_0x585a16[_0x44b8('0x30')]:_0xbad4bb[_0x44b8('0x29')];if(_0x1054c5[_0x44b8('0x2d')][_0x44b8('0x3f')]){_0x585a16['include']=[{'all':!![]}];}_0x585a16=_['merge']({},_0x585a16,_0x1054c5[_0x44b8('0x3d')]);return db[_0x44b8('0x3e')][_0x44b8('0x45')](_0x585a16)[_0x44b8('0x20')](handleEntityNotFound(_0x229cc9,null))[_0x44b8('0x20')](respondWithResult(_0x229cc9,null))[_0x44b8('0x46')](handleError(_0x229cc9,null));};exports[_0x44b8('0x47')]=function(_0x4fe73f,_0x156070){return db['ScreenRecording'][_0x44b8('0x47')](_0x4fe73f[_0x44b8('0x48')],{})[_0x44b8('0x20')](respondWithResult(_0x156070,0xc9))[_0x44b8('0x46')](handleError(_0x156070,null));};exports[_0x44b8('0x1f')]=function(_0x35ca19,_0x491600){if(_0x35ca19[_0x44b8('0x48')]['id']){delete _0x35ca19[_0x44b8('0x48')]['id'];}delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x49')];delete _0x35ca19['body'][_0x44b8('0x4a')];delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x4b')];delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x4c')];return db[_0x44b8('0x3e')]['find']({'where':{'id':_0x35ca19[_0x44b8('0x44')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x491600,null))[_0x44b8('0x20')](saveUpdates(_0x35ca19[_0x44b8('0x48')],null))[_0x44b8('0x20')](respondWithResult(_0x491600,null))['catch'](handleError(_0x491600,null));};exports['describe']=function(_0x2516fc,_0x4eb344){return db[_0x44b8('0x3e')]['describe']()[_0x44b8('0x20')](respondWithResult(_0x4eb344,null))[_0x44b8('0x46')](handleError(_0x4eb344,null));};exports[_0x44b8('0x4d')]=function(_0x15f4c6,_0x2fa6b4,_0x32f588){var _0xdc67e8=require('../../components/encryptor');var _0x3ad278=![];var _0x37b2c2={};if(_0x15f4c6[_0x44b8('0x2d')]['type']&&_0x15f4c6[_0x44b8('0x2d')][_0x44b8('0x27')]===_0x44b8('0x4e')){_0x37b2c2[_0x44b8('0x4e')]=_0x15f4c6['params']['id'];}else{_0x37b2c2['id']=_0x15f4c6[_0x44b8('0x44')]['id'];}return db[_0x44b8('0x3e')]['find']({'where':_0x37b2c2,'attributes':['id',_0x44b8('0x4c')],'raw':!![]})[_0x44b8('0x20')](handleEntityNotFound(_0x2fa6b4,null))[_0x44b8('0x20')](function(_0x3df6aa){if(_0x3df6aa){var _0xe86e34=path['join'](config['root'],_0x44b8('0x4f'),_0x3df6aa[_0x44b8('0x4c')]);var _0xa30834=util[_0x44b8('0x2c')](_0x44b8('0x50'),_0xe86e34);if(fs[_0x44b8('0x51')](_0xa30834)){_0x3ad278=!![];return _0xdc67e8[_0x44b8('0x52')](_0xa30834,_0xe86e34,config[_0x44b8('0x53')][_0x44b8('0x54')])[_0x44b8('0x20')](function(){return _0x3df6aa;});}return _0x3df6aa;}})[_0x44b8('0x20')](function(_0x3f7576){if(_0x3f7576){var _0x5af3e6=path[_0x44b8('0x55')](config[_0x44b8('0x56')],_0x44b8('0x4f'),_0x3f7576[_0x44b8('0x4c')]);if(!fs[_0x44b8('0x51')](_0x5af3e6)){throw new db[(_0x44b8('0x57'))][(_0x44b8('0x58'))](_0x44b8('0x59'));}if(_0x3f7576[_0x44b8('0x5a')]){return _0x2fa6b4[_0x44b8('0x4d')](_0x5af3e6,_0x3f7576[_0x44b8('0x5a')]+path[_0x44b8('0x5b')](_0x5af3e6),function(){if(_0x3ad278){fs[_0x44b8('0x5c')](_0x5af3e6);}});}else{return _0x2fa6b4[_0x44b8('0x4d')](_0x5af3e6,function(_0x2250bb){if(_0x3ad278){fs[_0x44b8('0x5c')](_0x5af3e6);}});}}})[_0x44b8('0x46')](function(_0x20e563){if(_0x20e563['message']===_0x44b8('0x59')){_0x2fa6b4[_0x44b8('0x14')](0x194)[_0x44b8('0x5d')](_0x44b8('0x5e'));}else{return handleError(_0x2fa6b4,null);}});};exports[_0x44b8('0x21')]=function(_0x29ed5d,_0x2ecf65){return db['ScreenRecording'][_0x44b8('0x45')]({'where':{'id':_0x29ed5d[_0x44b8('0x44')]['id']}})['then'](function(_0x2a95f6){if(_[_0x44b8('0x5f')](_0x2a95f6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2a95f6;})[_0x44b8('0x20')](function(_0x454fe6){var _0x370618=path['join'](config[_0x44b8('0x56')],'server/files/screen_recordings',_0x454fe6[_0x44b8('0x4c')]);logger['info'](_0x44b8('0x60'),_0x370618);if(!_[_0x44b8('0x5f')](_0x454fe6[_0x44b8('0x4c')])&&fs[_0x44b8('0x51')](_0x370618)){logger[_0x44b8('0x61')](_0x44b8('0x62')+_0x370618+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x44b8('0x63')](_0x370618);}_0x370618=_0x370618+'.cypher';if(!_[_0x44b8('0x5f')](_0x454fe6[_0x44b8('0x4c')])&&fs['existsSync'](_0x370618)){logger[_0x44b8('0x61')](_0x44b8('0x62')+_0x370618+_0x44b8('0x64'));fs[_0x44b8('0x63')](_0x370618);}return _0x454fe6;})[_0x44b8('0x20')](function(_0x3774fe){if(!_0x3774fe)throw new InternalError();return _0x3774fe[_0x44b8('0x21')]();})[_0x44b8('0x20')](function(){_0x2ecf65[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();})[_0x44b8('0x46')](handleError(_0x2ecf65,null));}; \ No newline at end of file +var _0x00bb=['json','undefined','limit','offset','apply','reject','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ScreenRecording','count','then','includeAll','include','rows','catch','show','params','length','options','find','body','createdAt','closedAt','value','describe','download','uniqueid','join','root','format','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status'];(function(_0x58c14a,_0x52aa63){var _0x27d70a=function(_0x232622){while(--_0x232622){_0x58c14a['push'](_0x58c14a['shift']());}};_0x27d70a(++_0x52aa63);}(_0x00bb,0x1d8));var _0xb00b=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x00bb[_0x46aff0];return _0x9d78cf;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){_0x2896d1[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();});}};}function handleEntityNotFound(_0x3c9500,_0x8caadf){return function(_0x520e55){if(!_0x520e55){_0x3c9500['sendStatus'](0x194);}return _0x520e55;};}function handleError(_0x3785e9,_0x490380){_0x490380=_0x490380||0x1f4;return function(_0x550587){logger['error'](_0x550587[_0xb00b('0x20')]);if(_0x550587[_0xb00b('0x21')]){delete _0x550587[_0xb00b('0x21')];}_0x3785e9[_0xb00b('0x16')](_0x490380)[_0xb00b('0x22')](_0x550587);};}exports[_0xb00b('0x23')]=function(_0x15d3b9,_0x4a8d2b){var _0x22c22d={},_0x503c9c={},_0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x24')](db['ScreenRecording'][_0xb00b('0x25')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x26')],'type':_0x280ed3[_0xb00b('0x27')][_0xb00b('0x28')]};});_0x503c9c[_0xb00b('0x29')]=_[_0xb00b('0x2a')](_[_0xb00b('0x24')](_0x348165,_0xb00b('0x21')),['format']);_0x503c9c[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x15d3b9['query']);_0x503c9c[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x503c9c['model'],_0x503c9c[_0xb00b('0x2b')]);_0x22c22d['attributes']=_[_0xb00b('0x2e')](_0x503c9c[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x22c22d[_0xb00b('0x30')]=_0x22c22d[_0xb00b('0x30')]['length']?_0x22c22d['attributes']:_0x503c9c['model'];if(!_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x22c22d[_0xb00b('0x19')]=qs['limit'](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x22c22d[_0xb00b('0x1a')]=qs[_0xb00b('0x1a')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x1a')]);}_0x22c22d[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x15d3b9['query']['sort']);_0x22c22d[_0xb00b('0x35')]=qs['filters'](_[_0xb00b('0x36')](_0x15d3b9[_0xb00b('0x2b')],_0x503c9c[_0xb00b('0x2d')]),_0x348165);if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x22c22d[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x22c22d['where'],{'$or':_[_0xb00b('0x24')](_0x348165,function(_0x25578e){if(_0x25578e[_0xb00b('0x27')]!==_0xb00b('0x39')){var _0x2496e2={};_0x2496e2[_0x25578e[_0xb00b('0x21')]]={'$like':'%'+_0x15d3b9['query'][_0xb00b('0x37')]+'%'};return _0x2496e2;}})});}_0x22c22d=_[_0xb00b('0x38')]({},_0x22c22d,_0x15d3b9['options']);var _0x17ff34={'where':_0x22c22d[_0xb00b('0x35')]};return db[_0xb00b('0x3a')][_0xb00b('0x3b')](_0x17ff34)[_0xb00b('0x3c')](function(_0x5636b1){_0x450129[_0xb00b('0x3b')]=_0x5636b1;if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x3d')]){_0x22c22d[_0xb00b('0x3e')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x22c22d);})[_0xb00b('0x3c')](function(_0xf6ae0c){_0x450129[_0xb00b('0x3f')]=_0xf6ae0c;return _0x450129;})[_0xb00b('0x3c')](respondWithFilteredResult(_0x4a8d2b,_0x22c22d))[_0xb00b('0x40')](handleError(_0x4a8d2b,null));};exports[_0xb00b('0x41')]=function(_0x275664,_0x493841){var _0x36200d={'raw':![],'where':{'id':_0x275664[_0xb00b('0x42')]['id']}},_0x3b72c4={};_0x3b72c4[_0xb00b('0x29')]=_[_0xb00b('0x2c')](db[_0xb00b('0x3a')][_0xb00b('0x25')]);_0x3b72c4[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x275664[_0xb00b('0x2b')]);_0x3b72c4[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x3b72c4['model'],_0x3b72c4[_0xb00b('0x2b')]);_0x36200d[_0xb00b('0x30')]=_[_0xb00b('0x2e')](_0x3b72c4[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x275664[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x36200d[_0xb00b('0x30')]=_0x36200d[_0xb00b('0x30')][_0xb00b('0x43')]?_0x36200d[_0xb00b('0x30')]:_0x3b72c4[_0xb00b('0x29')];if(_0x275664['query']['includeAll']){_0x36200d['include']=[{'all':!![]}];}_0x36200d=_[_0xb00b('0x38')]({},_0x36200d,_0x275664[_0xb00b('0x44')]);return db['ScreenRecording'][_0xb00b('0x45')](_0x36200d)[_0xb00b('0x3c')](handleEntityNotFound(_0x493841,null))[_0xb00b('0x3c')](respondWithResult(_0x493841,null))[_0xb00b('0x40')](handleError(_0x493841,null));};exports['create']=function(_0x58e9cb,_0x172729){return db[_0xb00b('0x3a')]['create'](_0x58e9cb['body'],{})[_0xb00b('0x3c')](respondWithResult(_0x172729,0xc9))[_0xb00b('0x40')](handleError(_0x172729,null));};exports['update']=function(_0x2228e9,_0x47a814){if(_0x2228e9['body']['id']){delete _0x2228e9['body']['id'];}delete _0x2228e9[_0xb00b('0x46')]['duration'];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x47')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x48')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x49')];return db['ScreenRecording']['find']({'where':{'id':_0x2228e9[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](handleEntityNotFound(_0x47a814,null))['then'](saveUpdates(_0x2228e9[_0xb00b('0x46')],null))[_0xb00b('0x3c')](respondWithResult(_0x47a814,null))['catch'](handleError(_0x47a814,null));};exports[_0xb00b('0x4a')]=function(_0x10e066,_0x3b5d82){return db['ScreenRecording']['describe']()[_0xb00b('0x3c')](respondWithResult(_0x3b5d82,null))[_0xb00b('0x40')](handleError(_0x3b5d82,null));};exports[_0xb00b('0x4b')]=function(_0xde3cc1,_0x489b49,_0x380acb){var _0x3f31e5=require('../../components/encryptor');var _0x4cd9fd=![];var _0x160965={};if(_0xde3cc1['query'][_0xb00b('0x27')]&&_0xde3cc1[_0xb00b('0x2b')][_0xb00b('0x27')]===_0xb00b('0x4c')){_0x160965[_0xb00b('0x4c')]=_0xde3cc1[_0xb00b('0x42')]['id'];}else{_0x160965['id']=_0xde3cc1['params']['id'];}return db[_0xb00b('0x3a')]['find']({'where':_0x160965,'attributes':['id',_0xb00b('0x49')],'raw':!![]})[_0xb00b('0x3c')](handleEntityNotFound(_0x489b49,null))[_0xb00b('0x3c')](function(_0x5ac79e){if(_0x5ac79e){var _0x248335=path[_0xb00b('0x4d')](config[_0xb00b('0x4e')],'server/files/screen_recordings',_0x5ac79e[_0xb00b('0x49')]);var _0x309ae6=util[_0xb00b('0x4f')](_0xb00b('0x50'),_0x248335);if(fs[_0xb00b('0x51')](_0x309ae6)){_0x4cd9fd=!![];return _0x3f31e5[_0xb00b('0x52')](_0x309ae6,_0x248335,config[_0xb00b('0x53')][_0xb00b('0x54')])['then'](function(){return _0x5ac79e;});}return _0x5ac79e;}})[_0xb00b('0x3c')](function(_0x2cbe80){if(_0x2cbe80){var _0x1b4860=path['join'](config[_0xb00b('0x4e')],_0xb00b('0x55'),_0x2cbe80[_0xb00b('0x49')]);if(!fs[_0xb00b('0x51')](_0x1b4860)){throw new db[(_0xb00b('0x56'))]['ValidationError'](_0xb00b('0x57'));}if(_0x2cbe80[_0xb00b('0x58')]){return _0x489b49[_0xb00b('0x4b')](_0x1b4860,_0x2cbe80[_0xb00b('0x58')]+path['extname'](_0x1b4860),function(){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}else{return _0x489b49[_0xb00b('0x4b')](_0x1b4860,function(_0x2c93db){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}}})[_0xb00b('0x40')](function(_0x1e5ed8){if(_0x1e5ed8[_0xb00b('0x5a')]==='ScreenRecording\x20not\x20found'){_0x489b49[_0xb00b('0x16')](0x194)['send'](_0xb00b('0x5b'));}else{return handleError(_0x489b49,null);}});};exports['destroy']=function(_0x3b3272,_0x530d4a){return db[_0xb00b('0x3a')]['find']({'where':{'id':_0x3b3272[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](function(_0x3bae02){if(_['isNil'](_0x3bae02)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3bae02;})['then'](function(_0x21a53d){var _0x3126be=path[_0xb00b('0x4d')](config['root'],_0xb00b('0x55'),_0x21a53d[_0xb00b('0x49')]);logger[_0xb00b('0x5c')](_0xb00b('0x5d'),_0x3126be);if(!_[_0xb00b('0x5e')](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')]('File:\x20\x22'+_0x3126be+_0xb00b('0x5f'));fs[_0xb00b('0x60')](_0x3126be);}_0x3126be=_0x3126be+_0xb00b('0x61');if(!_['isNil'](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')](_0xb00b('0x62')+_0x3126be+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3126be);}return _0x21a53d;})['then'](function(_0x5e9677){if(!_0x5e9677)throw new InternalError();return _0x5e9677[_0xb00b('0x1e')]();})['then'](function(){_0x530d4a[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();})['catch'](handleError(_0x530d4a,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index daf69a5..748a385 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 _0x4ceb=['ScreenRecording','lodash','util','api','bluebird','request-promise','path','rimraf','./screenRecording.attributes','exports','define'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x4ceb,0x135));var _0xb4ce=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x4ceb[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0xb4ce('0x0'));var util=require(_0xb4ce('0x1'));var logger=require('../../config/logger')(_0xb4ce('0x2'));var moment=require('moment');var BPromise=require(_0xb4ce('0x3'));var rp=require(_0xb4ce('0x4'));var fs=require('fs');var path=require(_0xb4ce('0x5'));var rimraf=require(_0xb4ce('0x6'));var config=require('../../config/environment');var attributes=require(_0xb4ce('0x7'));module[_0xb4ce('0x8')]=function(_0x22b21d,_0x347a1f){return _0x22b21d[_0xb4ce('0x9')](_0xb4ce('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc45d=['bluebird','path','rimraf','../../config/environment','exports','define','ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xc45d,0x119));var _0xdc45=function(_0x251d43,_0xd5a05a){_0x251d43=_0x251d43-0x0;var _0x3d7759=_0xc45d[_0x251d43];return _0x3d7759;};'use strict';var _=require(_0xdc45('0x0'));var util=require(_0xdc45('0x1'));var logger=require(_0xdc45('0x2'))(_0xdc45('0x3'));var moment=require(_0xdc45('0x4'));var BPromise=require(_0xdc45('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc45('0x6'));var rimraf=require(_0xdc45('0x7'));var config=require(_0xdc45('0x8'));var attributes=require('./screenRecording.attributes');module[_0xdc45('0x9')]=function(_0x25667b,_0x237842){return _0x25667b[_0xdc45('0xa')](_0xdc45('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xdc45('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index d4c8094..720afa9 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 _0x81b0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','request\x20sent','error','message','result','lodash','moment'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x81b0,0x139));var _0x081b=function(_0x599929,_0x466c1a){_0x599929=_0x599929-0x0;var _0x30d427=_0x81b0[_0x599929];return _0x30d427;};'use strict';var _=require(_0x081b('0x0'));var util=require('util');var moment=require(_0x081b('0x1'));var BPromise=require(_0x081b('0x2'));var rs=require(_0x081b('0x3'));var fs=require('fs');var Redis=require(_0x081b('0x4'));var db=require(_0x081b('0x5'))['db'];var utils=require(_0x081b('0x6'));var logger=require(_0x081b('0x7'))(_0x081b('0x8'));var config=require(_0x081b('0x9'));var jayson=require(_0x081b('0xa'));var client=jayson[_0x081b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15a653,_0x24b233,_0x2df2ff){return new BPromise(function(_0x4acb27,_0x4a9216){return client[_0x081b('0xc')](_0x15a653,_0x2df2ff)[_0x081b('0xd')](function(_0x9c296b){logger[_0x081b('0xe')](_0x081b('0xf'),_0x24b233,'request\x20sent');logger[_0x081b('0x10')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x24b233,_0x081b('0x11'),JSON['stringify'](_0x9c296b));if(_0x9c296b[_0x081b('0x12')]){if(_0x9c296b[_0x081b('0x12')]['code']===0x1f4){logger['error'](_0x081b('0xf'),_0x24b233,_0x9c296b[_0x081b('0x12')][_0x081b('0x13')]);return _0x4a9216(_0x9c296b[_0x081b('0x12')][_0x081b('0x13')]);}logger[_0x081b('0x12')](_0x081b('0xf'),_0x24b233,_0x9c296b[_0x081b('0x12')][_0x081b('0x13')]);return _0x4acb27(_0x9c296b[_0x081b('0x12')]['message']);}else{logger[_0x081b('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x24b233,_0x081b('0x11'));_0x4acb27(_0x9c296b[_0x081b('0x14')][_0x081b('0x13')]);}})['catch'](function(_0x32c6c7){logger[_0x081b('0x12')](_0x081b('0xf'),_0x24b233,_0x32c6c7);_0x4a9216(_0x32c6c7);});});} \ No newline at end of file +var _0x3a58=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x32eb7f,_0x5cc11f){var _0x470a3e=function(_0x1e2009){while(--_0x1e2009){_0x32eb7f['push'](_0x32eb7f['shift']());}};_0x470a3e(++_0x5cc11f);}(_0x3a58,0x18b));var _0x83a5=function(_0x4eb822,_0x56d2ef){_0x4eb822=_0x4eb822-0x0;var _0x27d901=_0x3a58[_0x4eb822];return _0x27d901;};'use strict';var _=require(_0x83a5('0x0'));var util=require('util');var moment=require(_0x83a5('0x1'));var BPromise=require(_0x83a5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83a5('0x3'));var db=require(_0x83a5('0x4'))['db'];var utils=require(_0x83a5('0x5'));var logger=require(_0x83a5('0x6'))(_0x83a5('0x7'));var config=require(_0x83a5('0x8'));var jayson=require(_0x83a5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2895e7,_0xfb8c68,_0x3e038d){return new BPromise(function(_0x2cc75a,_0x4a52cb){return client[_0x83a5('0xa')](_0x2895e7,_0x3e038d)['then'](function(_0x1f4c01){logger[_0x83a5('0xb')]('ScreenRecording,\x20%s,\x20%s',_0xfb8c68,_0x83a5('0xc'));logger[_0x83a5('0xd')](_0x83a5('0xe'),_0xfb8c68,_0x83a5('0xc'),JSON[_0x83a5('0xf')](_0x1f4c01));if(_0x1f4c01[_0x83a5('0x10')]){if(_0x1f4c01['error'][_0x83a5('0x11')]===0x1f4){logger[_0x83a5('0x10')](_0x83a5('0x12'),_0xfb8c68,_0x1f4c01['error'][_0x83a5('0x13')]);return _0x4a52cb(_0x1f4c01[_0x83a5('0x10')][_0x83a5('0x13')]);}logger[_0x83a5('0x10')](_0x83a5('0x12'),_0xfb8c68,_0x1f4c01[_0x83a5('0x10')]['message']);return _0x2cc75a(_0x1f4c01[_0x83a5('0x10')][_0x83a5('0x13')]);}else{logger[_0x83a5('0xb')](_0x83a5('0x12'),_0xfb8c68,'request\x20sent');_0x2cc75a(_0x1f4c01[_0x83a5('0x14')]['message']);}})[_0x83a5('0x15')](function(_0x1662e6){logger[_0x83a5('0x10')](_0x83a5('0x12'),_0xfb8c68,_0x1662e6);_0x4a52cb(_0x1662e6);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 4451865..3b756a6 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 _0xf860=['addFavicon','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','show','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','logo','extname','originalname','post','/:id/logo','single','file','addLogo','diskStorage','addLogoLogin','preferred','addPreferred','%s%s'];(function(_0x623028,_0x5c3eb7){var _0x5ca7c6=function(_0x3f36cb){while(--_0x3f36cb){_0x623028['push'](_0x623028['shift']());}};_0x5ca7c6(++_0x5c3eb7);}(_0xf860,0x13f));var _0x0f86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf860[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0f86('0x0'));var util=require(_0x0f86('0x1'));var path=require(_0x0f86('0x2'));var timeout=require(_0x0f86('0x3'));var express=require(_0x0f86('0x4'));var router=express[_0x0f86('0x5')]();var fs_extra=require(_0x0f86('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0f86('0x7'));var config=require(_0x0f86('0x8'));var controller=require(_0x0f86('0x9'));router['get']('/',auth[_0x0f86('0xa')](),controller[_0x0f86('0xb')]);router[_0x0f86('0xc')](_0x0f86('0xd'),controller[_0x0f86('0xe')]);router[_0x0f86('0xc')]('/:id',controller[_0x0f86('0xf')]);router[_0x0f86('0xc')]('/:id/logo',controller[_0x0f86('0x10')]);router['get'](_0x0f86('0x11'),controller[_0x0f86('0x12')]);router[_0x0f86('0xc')]('/:id/gdpr',controller[_0x0f86('0x13')]);router['get'](_0x0f86('0x14'),controller[_0x0f86('0x15')]);router['get'](_0x0f86('0x16'),controller[_0x0f86('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4ab879,_0x2b9c57,_0x38b9fd){_0x38b9fd(null,path[_0x0f86('0x18')](config[_0x0f86('0x19')],_0x0f86('0x1a')));},'filename':function(_0x482255,_0x4e32ed,_0x1e8d4c){_0x1e8d4c(null,util[_0x0f86('0x1b')]('%s%s',_0x0f86('0x1c'),path[_0x0f86('0x1d')](_0x4e32ed[_0x0f86('0x1e')])));}})});router[_0x0f86('0x1f')](_0x0f86('0x20'),upload[_0x0f86('0x21')](_0x0f86('0x22')),controller[_0x0f86('0x23')]);var upload=multer({'storage':multer[_0x0f86('0x24')]({'destination':function(_0x3a4778,_0x3e1575,_0x4b40e8){_0x4b40e8(null,path['join'](config[_0x0f86('0x19')],_0x0f86('0x1a')));},'filename':function(_0x6749e5,_0x1478d2,_0xde6f8e){_0xde6f8e(null,util[_0x0f86('0x1b')]('%s%s','logologin',path[_0x0f86('0x1d')](_0x1478d2['originalname'])));}})});router['post']('/:id/logo_login',upload['single'](_0x0f86('0x22')),controller[_0x0f86('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5ac533,_0x4b2d49,_0x2c5719){_0x2c5719(null,path[_0x0f86('0x18')](config[_0x0f86('0x19')],_0x0f86('0x1a')));},'filename':function(_0x145e91,_0x12ea6e,_0x35ceba){_0x35ceba(null,util[_0x0f86('0x1b')]('%s%s',_0x0f86('0x26'),path[_0x0f86('0x1d')](_0x12ea6e[_0x0f86('0x1e')])));}})});router[_0x0f86('0x1f')]('/:id/preferred',upload[_0x0f86('0x21')](_0x0f86('0x22')),controller[_0x0f86('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x438645,_0x588b53,_0x2aa2a0){_0x2aa2a0(null,path[_0x0f86('0x18')](config[_0x0f86('0x19')],_0x0f86('0x1a')));},'filename':function(_0x1a9cda,_0x380b8c,_0x588f33){_0x588f33(null,util[_0x0f86('0x1b')](_0x0f86('0x28'),'favicon',path['extname'](_0x380b8c[_0x0f86('0x1e')])));}})});router[_0x0f86('0x1f')](_0x0f86('0x16'),upload['single']('file'),controller[_0x0f86('0x29')]);router['put'](_0x0f86('0x2a'),auth[_0x0f86('0xa')](),controller[_0x0f86('0x2b')]);module[_0x0f86('0x2c')]=router; \ No newline at end of file +var _0xd3c5=['../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','getLogo','/:id/logo_login','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','format','logo','extname','originalname','/:id/logo','single','addLogo','diskStorage','server/files/images/logos/','%s%s','post','file','addLogoLogin','join','root','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x567758,_0x533bba){var _0x1d0e7f=function(_0x1d9d06){while(--_0x1d9d06){_0x567758['push'](_0x567758['shift']());}};_0x1d0e7f(++_0x533bba);}(_0xd3c5,0x128));var _0x5d3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd3c5[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x5d3c('0x0'));var util=require(_0x5d3c('0x1'));var path=require(_0x5d3c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5d3c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5d3c('0x4'));var interaction=require(_0x5d3c('0x5'));var config=require(_0x5d3c('0x6'));var controller=require(_0x5d3c('0x7'));router[_0x5d3c('0x8')]('/',auth[_0x5d3c('0x9')](),controller[_0x5d3c('0xa')]);router[_0x5d3c('0x8')](_0x5d3c('0xb'),controller[_0x5d3c('0xc')]);router[_0x5d3c('0x8')](_0x5d3c('0xd'),controller['show']);router[_0x5d3c('0x8')]('/:id/logo',controller[_0x5d3c('0xe')]);router['get'](_0x5d3c('0xf'),controller['getLogoLogin']);router['get'](_0x5d3c('0x10'),controller['gdpr']);router[_0x5d3c('0x8')](_0x5d3c('0x11'),controller[_0x5d3c('0x12')]);router['get'](_0x5d3c('0x13'),controller[_0x5d3c('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x48add5,_0x3cceee,_0x3c4ba7){_0x3c4ba7(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x46593f,_0x4436ad,_0x31d5ce){_0x31d5ce(null,util[_0x5d3c('0x15')]('%s%s',_0x5d3c('0x16'),path[_0x5d3c('0x17')](_0x4436ad[_0x5d3c('0x18')])));}})});router['post'](_0x5d3c('0x19'),upload[_0x5d3c('0x1a')]('file'),controller[_0x5d3c('0x1b')]);var upload=multer({'storage':multer[_0x5d3c('0x1c')]({'destination':function(_0x376735,_0x10a502,_0x25c956){_0x25c956(null,path['join'](config['root'],_0x5d3c('0x1d')));},'filename':function(_0x238141,_0x378fa7,_0x63b752){_0x63b752(null,util['format'](_0x5d3c('0x1e'),'logologin',path[_0x5d3c('0x17')](_0x378fa7[_0x5d3c('0x18')])));}})});router[_0x5d3c('0x1f')]('/:id/logo_login',upload['single'](_0x5d3c('0x20')),controller[_0x5d3c('0x21')]);var upload=multer({'storage':multer[_0x5d3c('0x1c')]({'destination':function(_0x28e141,_0x1909aa,_0x551ea4){_0x551ea4(null,path[_0x5d3c('0x22')](config[_0x5d3c('0x23')],_0x5d3c('0x1d')));},'filename':function(_0x4d6dfc,_0x4668bd,_0x5cfa94){_0x5cfa94(null,util[_0x5d3c('0x15')](_0x5d3c('0x1e'),_0x5d3c('0x24'),path['extname'](_0x4668bd['originalname'])));}})});router['post'](_0x5d3c('0x11'),upload[_0x5d3c('0x1a')](_0x5d3c('0x20')),controller[_0x5d3c('0x25')]);var upload=multer({'storage':multer[_0x5d3c('0x1c')]({'destination':function(_0x1316a3,_0x55bcc9,_0x3a12b4){_0x3a12b4(null,path['join'](config[_0x5d3c('0x23')],'server/files/images/logos/'));},'filename':function(_0x5e7d76,_0x177d7a,_0x5cb9e9){_0x5cb9e9(null,util['format'](_0x5d3c('0x1e'),_0x5d3c('0x26'),path['extname'](_0x177d7a[_0x5d3c('0x18')])));}})});router['post']('/:id/favicon',upload[_0x5d3c('0x1a')](_0x5d3c('0x20')),controller[_0x5d3c('0x27')]);router[_0x5d3c('0x28')](_0x5d3c('0xd'),auth[_0x5d3c('0x9')](),controller[_0x5d3c('0x29')]);module[_0x5d3c('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 961f25a..88613b3 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 _0x0846=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','INTEGER','UNSIGNED','sequelize','exports','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING'];(function(_0x2f1908,_0x5d837d){var _0x357795=function(_0x5bf606){while(--_0x5bf606){_0x2f1908['push'](_0x2f1908['shift']());}};_0x357795(++_0x5d837d);}(_0x0846,0xea));var _0x6084=function(_0x373dee,_0xc7da30){_0x373dee=_0x373dee-0x0;var _0x528a48=_0x0846[_0x373dee];return _0x528a48;};'use strict';var Sequelize=require(_0x6084('0x0'));module[_0x6084('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x6084('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x6084('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x6084('0x4')},'logo':{'type':Sequelize[_0x6084('0x5')]},'defaultLogo':{'type':Sequelize[_0x6084('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x6084('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x6084('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x6084('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x6084('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x6084('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x6084('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x6084('0x5')]},'turnaddr':{'type':Sequelize[_0x6084('0x5')]},'turnusername':{'type':Sequelize[_0x6084('0x5')]},'turnpassword':{'type':Sequelize[_0x6084('0x5')]},'pageTitle':{'type':Sequelize[_0x6084('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x6084('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x6084('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x6084('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x6084('0x5')],'defaultValue':_0x6084('0x7')},'enableEmailPreview':{'type':Sequelize[_0x6084('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x6084('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x6084('0x8')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x6084('0x8')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x6084('0x8')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x6084('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x6084('0x8')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x6084('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x6084('0x5')]},'defaultPreferred':{'type':Sequelize[_0x6084('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x6084('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x6084('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x6084('0x5')]},'defaultFavicon':{'type':Sequelize[_0x6084('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x6084('0x8')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x6084('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x6084('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x6084('0x8')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x6084('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x6084('0x8')]},'sentimentRegion':{'type':Sequelize[_0x6084('0x5')]},'language':{'type':Sequelize[_0x6084('0x5')]},'bucket':{'type':Sequelize[_0x6084('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x6084('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x6084('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x6084('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x6084('0x8')](0x2)[_0x6084('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x6084('0x8')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x6084('0x8')](0x2)[_0x6084('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x6084('0x8')](0x2)[_0x6084('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x6084('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x6084('0x8')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x6084('0x8')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x6084('0x8')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x6084('0x8')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x6084('0x8')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x6084('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x6084('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x6084('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x6084('0x8')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x6084('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x4d29=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0xd85d9e,_0x22bef1){var _0x3f1e51=function(_0x366ee5){while(--_0x366ee5){_0xd85d9e['push'](_0xd85d9e['shift']());}};_0x3f1e51(++_0x22bef1);}(_0x4d29,0x1ab));var _0x94d2=function(_0x2e7e1e,_0x292649){_0x2e7e1e=_0x2e7e1e-0x0;var _0x59ed3a=_0x4d29[_0x2e7e1e];return _0x59ed3a;};'use strict';var Sequelize=require(_0x94d2('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x94d2('0x1')](0xb),'unique':_0x94d2('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x94d2('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x94d2('0x3')],'defaultValue':_0x94d2('0x4')},'logo':{'type':Sequelize[_0x94d2('0x3')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x94d2('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x94d2('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x94d2('0x3')]},'turnaddr':{'type':Sequelize[_0x94d2('0x3')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x94d2('0x3')]},'pageTitle':{'type':Sequelize[_0x94d2('0x3')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x94d2('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x94d2('0x3')],'defaultValue':_0x94d2('0x6')},'enableEmailPreview':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x94d2('0x3')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x94d2('0x3')]},'defaultPreferred':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x94d2('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x94d2('0x3')]},'defaultFavicon':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x94d2('0x1')]},'transcribeRegion':{'type':Sequelize[_0x94d2('0x3')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x94d2('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x94d2('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x94d2('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x94d2('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x94d2('0x1')](0x2)[_0x94d2('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x94d2('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x94d2('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 1ac5add..d6cc7f3 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 _0xadb2=['default_preferred.png','download','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','offset','limit','set','json','apply','reject','save','update','destroy','stack','name','send','map','Setting','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','find','body','file','logo','filename','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default','upperFirst','custom','default_logo.svg','existsSync','Sequelize','ValidationError','\x20not\x20found','loginLogo','default_loginLogo.svg','gdpr','securePassword','getPreferred'];(function(_0x5a1377,_0x33243d){var _0x34d321=function(_0x1aec24){while(--_0x1aec24){_0x5a1377['push'](_0x5a1377['shift']());}};_0x34d321(++_0x33243d);}(_0xadb2,0xf2));var _0x2adb=function(_0x1fdf7c,_0x22f91b){_0x1fdf7c=_0x1fdf7c-0x0;var _0x28abaa=_0xadb2[_0x1fdf7c];return _0x28abaa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2adb('0x0'));var zipdir=require(_0x2adb('0x1'));var jsonpatch=require(_0x2adb('0x2'));var rp=require(_0x2adb('0x3'));var moment=require('moment');var BPromise=require(_0x2adb('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2adb('0x5'));var sox=require(_0x2adb('0x6'));var csv=require('to-csv');var ejs=require(_0x2adb('0x7'));var fs=require('fs');var fs_extra=require(_0x2adb('0x8'));var _=require(_0x2adb('0x9'));var squel=require(_0x2adb('0xa'));var crypto=require(_0x2adb('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2adb('0xc'));var querystring=require(_0x2adb('0xd'));var Papa=require(_0x2adb('0xe'));var Redis=require('ioredis');var authService=require(_0x2adb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2adb('0x10'));var hardwareService=require(_0x2adb('0x11'));var logger=require(_0x2adb('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2adb('0x13'));var db=require(_0x2adb('0x14'))['db'];var jayson=require(_0x2adb('0x15'));var client=jayson[_0x2adb('0x16')][_0x2adb('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x32a17d,_0x224234,_0x45f430,_0x48d16a){return new BPromise(function(_0x26bcfe,_0x4e081f){var _0x585883=_0x48d16a||client;return _0x585883[_0x2adb('0x18')](_0x32a17d,_0x45f430)[_0x2adb('0x19')](function(_0x493e8f){logger[_0x2adb('0x1a')](_0x2adb('0x1b'),_0x224234,'request\x20sent');logger[_0x2adb('0x1c')](_0x2adb('0x1d'),_0x224234,_0x2adb('0x1e'),JSON[_0x2adb('0x1f')](_0x493e8f));if(_0x493e8f[_0x2adb('0x20')]){if(_0x493e8f[_0x2adb('0x20')]['code']===0x1f4){logger[_0x2adb('0x20')](_0x2adb('0x1b'),_0x224234,_0x493e8f[_0x2adb('0x20')][_0x2adb('0x21')]);return _0x4e081f(_0x493e8f[_0x2adb('0x20')][_0x2adb('0x21')]);}logger[_0x2adb('0x20')](_0x2adb('0x1b'),_0x224234,_0x493e8f[_0x2adb('0x20')]['message']);return _0x26bcfe(_0x493e8f[_0x2adb('0x20')][_0x2adb('0x21')]);}else{logger[_0x2adb('0x1a')](_0x2adb('0x1b'),_0x224234,_0x2adb('0x1e'));_0x26bcfe(_0x493e8f[_0x2adb('0x22')][_0x2adb('0x21')]);}})['catch'](function(_0x515401){logger[_0x2adb('0x20')](_0x2adb('0x1b'),_0x224234,_0x515401);_0x4e081f(_0x515401);});});}function respondWithStatusCode(_0xd0ba85,_0x4f2545){_0x4f2545=_0x4f2545||0xcc;return function(_0x137af6){if(_0x137af6){return _0xd0ba85[_0x2adb('0x23')](_0x4f2545);}return _0xd0ba85[_0x2adb('0x24')](_0x4f2545)[_0x2adb('0x25')]();};}function respondWithResult(_0x533e72,_0x54c3ec){_0x54c3ec=_0x54c3ec||0xc8;return function(_0x212a16){if(_0x212a16){return _0x533e72[_0x2adb('0x24')](_0x54c3ec)['json'](_0x212a16);}};}function respondWithFilteredResult(_0x4bdd70,_0x49b8a3){return function(_0x46110e){if(_0x46110e){var _0x38fc5c=typeof _0x49b8a3[_0x2adb('0x26')]==='undefined'&&typeof _0x49b8a3[_0x2adb('0x27')]==='undefined';var _0x39c24f=_0x46110e['count'];var _0x241a31=_0x38fc5c?0x0:_0x49b8a3[_0x2adb('0x26')];var _0x482f7e=_0x38fc5c?_0x46110e['count']:_0x49b8a3[_0x2adb('0x26')]+_0x49b8a3[_0x2adb('0x27')];var _0x1fe120;if(_0x482f7e>=_0x39c24f){_0x482f7e=_0x39c24f;_0x1fe120=0xc8;}else{_0x1fe120=0xce;}_0x4bdd70[_0x2adb('0x24')](_0x1fe120);return _0x4bdd70[_0x2adb('0x28')]('Content-Range',_0x241a31+'-'+_0x482f7e+'/'+_0x39c24f)[_0x2adb('0x29')](_0x46110e);}return null;};}function patchUpdates(_0xe78d24){return function(_0x2b789e){try{jsonpatch[_0x2adb('0x2a')](_0x2b789e,_0xe78d24,!![]);}catch(_0x39af1f){return BPromise[_0x2adb('0x2b')](_0x39af1f);}return _0x2b789e[_0x2adb('0x2c')]();};}function saveUpdates(_0x7519f,_0x472ea9){return function(_0x130fd3){if(_0x130fd3){return _0x130fd3[_0x2adb('0x2d')](_0x7519f)['then'](function(_0x208121){return _0x208121;});}return null;};}function removeEntity(_0x28b86a,_0x514604){return function(_0x269c1f){if(_0x269c1f){return _0x269c1f[_0x2adb('0x2e')]()['then'](function(){_0x28b86a[_0x2adb('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x176244,_0x42ba3c){return function(_0x18aacf){if(!_0x18aacf){_0x176244['sendStatus'](0x194);}return _0x18aacf;};}function handleError(_0x50e2c5,_0x25f21f){_0x25f21f=_0x25f21f||0x1f4;return function(_0x3ac880){logger[_0x2adb('0x20')](_0x3ac880[_0x2adb('0x2f')]);if(_0x3ac880[_0x2adb('0x30')]){delete _0x3ac880['name'];}_0x50e2c5[_0x2adb('0x24')](_0x25f21f)[_0x2adb('0x31')](_0x3ac880);};}exports['index']=function(_0x2c0abc,_0x4c4267){var _0x5d6b0e={},_0x212949={},_0x31ce60={'count':0x0,'rows':[]};var _0x48a9e0=_[_0x2adb('0x32')](db[_0x2adb('0x33')][_0x2adb('0x34')],function(_0x9fee5c){return{'name':_0x9fee5c[_0x2adb('0x35')],'type':_0x9fee5c[_0x2adb('0x36')]['key']};});_0x212949['model']=_[_0x2adb('0x32')](_0x48a9e0,_0x2adb('0x30'));_0x212949[_0x2adb('0x37')]=_[_0x2adb('0x38')](_0x2c0abc[_0x2adb('0x37')]);_0x212949[_0x2adb('0x39')]=_[_0x2adb('0x3a')](_0x212949['model'],_0x212949[_0x2adb('0x37')]);_0x5d6b0e[_0x2adb('0x3b')]=_[_0x2adb('0x3a')](_0x212949[_0x2adb('0x3c')],qs[_0x2adb('0x3d')](_0x2c0abc[_0x2adb('0x37')][_0x2adb('0x3d')]));_0x5d6b0e[_0x2adb('0x3b')]=_0x5d6b0e[_0x2adb('0x3b')][_0x2adb('0x3e')]?_0x5d6b0e[_0x2adb('0x3b')]:_0x212949[_0x2adb('0x3c')];if(!_0x2c0abc[_0x2adb('0x37')][_0x2adb('0x3f')]('nolimit')){_0x5d6b0e[_0x2adb('0x27')]=qs[_0x2adb('0x27')](_0x2c0abc['query']['limit']);_0x5d6b0e['offset']=qs[_0x2adb('0x26')](_0x2c0abc[_0x2adb('0x37')][_0x2adb('0x26')]);}_0x5d6b0e['order']=qs[_0x2adb('0x40')](_0x2c0abc[_0x2adb('0x37')][_0x2adb('0x40')]);_0x5d6b0e[_0x2adb('0x41')]=qs[_0x2adb('0x39')](_['pick'](_0x2c0abc[_0x2adb('0x37')],_0x212949[_0x2adb('0x39')]),_0x48a9e0);if(_0x2c0abc[_0x2adb('0x37')]['filter']){_0x5d6b0e[_0x2adb('0x41')]=_[_0x2adb('0x42')](_0x5d6b0e[_0x2adb('0x41')],{'$or':_['map'](_0x48a9e0,function(_0x37635c){if(_0x37635c[_0x2adb('0x36')]!==_0x2adb('0x43')){var _0x1835b8={};_0x1835b8[_0x37635c['name']]={'$like':'%'+_0x2c0abc[_0x2adb('0x37')]['filter']+'%'};return _0x1835b8;}})});}_0x5d6b0e=_['merge']({},_0x5d6b0e,_0x2c0abc[_0x2adb('0x44')]);var _0x24f197={'where':_0x5d6b0e[_0x2adb('0x41')]};return db[_0x2adb('0x33')][_0x2adb('0x45')](_0x24f197)['then'](function(_0x4b031d){_0x31ce60['count']=_0x4b031d;if(_0x2c0abc['query'][_0x2adb('0x46')]){_0x5d6b0e['include']=[{'all':!![]}];}return db[_0x2adb('0x33')][_0x2adb('0x47')](_0x5d6b0e);})[_0x2adb('0x19')](function(_0x5e6791){_0x31ce60[_0x2adb('0x48')]=_0x5e6791;return _0x31ce60;})[_0x2adb('0x19')](respondWithFilteredResult(_0x4c4267,_0x5d6b0e))[_0x2adb('0x49')](handleError(_0x4c4267,null));};exports[_0x2adb('0x4a')]=function(_0x9acbbb,_0x21eb91){var _0x1b2e70={'raw':![],'where':{'id':_0x9acbbb[_0x2adb('0x4b')]['id']}},_0x57e48d={};_0x57e48d['model']=_[_0x2adb('0x38')](db['Setting'][_0x2adb('0x34')]);_0x57e48d['query']=_['keys'](_0x9acbbb['query']);_0x57e48d[_0x2adb('0x39')]=_['intersection'](_0x57e48d[_0x2adb('0x3c')],_0x57e48d[_0x2adb('0x37')]);_0x1b2e70[_0x2adb('0x3b')]=_[_0x2adb('0x3a')](_0x57e48d[_0x2adb('0x3c')],qs[_0x2adb('0x3d')](_0x9acbbb[_0x2adb('0x37')][_0x2adb('0x3d')]));_0x1b2e70['attributes']=_0x1b2e70[_0x2adb('0x3b')]['length']?_0x1b2e70[_0x2adb('0x3b')]:_0x57e48d['model'];if(_0x9acbbb[_0x2adb('0x37')][_0x2adb('0x46')]){_0x1b2e70['include']=[{'all':!![]}];}_0x1b2e70=_[_0x2adb('0x42')]({},_0x1b2e70,_0x9acbbb[_0x2adb('0x44')]);return db[_0x2adb('0x33')][_0x2adb('0x4c')](_0x1b2e70)[_0x2adb('0x19')](handleEntityNotFound(_0x21eb91,null))['then'](respondWithResult(_0x21eb91,null))[_0x2adb('0x49')](handleError(_0x21eb91,null));};exports[_0x2adb('0x2d')]=function(_0x528223,_0x345407){if(_0x528223[_0x2adb('0x4d')]['id']){delete _0x528223[_0x2adb('0x4d')]['id'];}return db[_0x2adb('0x33')][_0x2adb('0x4c')]({'where':{'id':_0x528223[_0x2adb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x345407,null))[_0x2adb('0x19')](saveUpdates(_0x528223[_0x2adb('0x4d')],null))[_0x2adb('0x19')](respondWithResult(_0x345407,null))[_0x2adb('0x49')](handleError(_0x345407,null));};exports['addLogo']=function(_0x41d4b9,_0x4855db,_0x4e48e8){if(_0x41d4b9['file']&&_0x41d4b9[_0x2adb('0x4e')]['filename']){_0x41d4b9[_0x2adb('0x4d')][_0x2adb('0x4f')]=_0x41d4b9[_0x2adb('0x4e')][_0x2adb('0x50')];}return db[_0x2adb('0x33')][_0x2adb('0x4c')]({'where':{'id':_0x41d4b9[_0x2adb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4855db,null))['then'](saveUpdates(_0x41d4b9[_0x2adb('0x4d')],null))[_0x2adb('0x19')](respondWithResult(_0x4855db,null))['catch'](handleError(_0x4855db,null));};exports['addLogoLogin']=function(_0xca90f0,_0x183aa5,_0x54db9d){if(_0xca90f0['file']&&_0xca90f0['file']['filename']){_0xca90f0[_0x2adb('0x4d')]['loginLogo']=_0xca90f0[_0x2adb('0x4e')][_0x2adb('0x50')];}return db[_0x2adb('0x33')][_0x2adb('0x4c')]({'where':{'id':_0xca90f0[_0x2adb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x183aa5,null))[_0x2adb('0x19')](saveUpdates(_0xca90f0['body'],null))[_0x2adb('0x19')](respondWithResult(_0x183aa5,null))[_0x2adb('0x49')](handleError(_0x183aa5,null));};var utilLicense=require(_0x2adb('0x13'));exports[_0x2adb('0x51')]=function(_0x2ce75b,_0x503861,_0x1db296){var _0x5b0ebf=_0x2adb('0x52');var _0x60841a={'custom':![]};return utilLicense[_0x2adb('0x53')]()[_0x2adb('0x19')](function(_0x1e09bb){if(_0x1e09bb){_0x60841a=_0x1e09bb;}return db[_0x2adb('0x33')][_0x2adb('0x4c')]({'where':{'id':_0x2ce75b[_0x2adb('0x4b')]['id']},'attributes':[_0x2adb('0x4f'),'loginLogo',_0x2adb('0x54'),_0x2adb('0x55'),_0x2adb('0x56'),_0x2adb('0x57'),_0x2adb('0x58'),_0x2adb('0x59')],'raw':!![]});})['then'](handleEntityNotFound(_0x503861,null))[_0x2adb('0x19')](function(_0x5ca965){if(_0x5ca965){var _0x4d4e25=_0x5ca965[_0x2adb('0x4f')]&&fs['existsSync'](path[_0x2adb('0x5a')](config['root'],_0x5b0ebf,_['toLower'](_0x5ca965[_0x2adb('0x4f')])))?path[_0x2adb('0x5a')](config[_0x2adb('0x5b')],_0x5b0ebf,_[_0x2adb('0x5c')](_0x5ca965[_0x2adb('0x4f')])):path['join'](config[_0x2adb('0x5b')],_0x5b0ebf,_[_0x2adb('0x5c')]('default_logo.svg'));var _0x1884fb=_0x2adb('0x5d')+_[_0x2adb('0x5e')](_0x2adb('0x4f'));if(_0x5ca965[_0x1884fb]||!_0x60841a[_0x2adb('0x5f')]){_0x4d4e25=path[_0x2adb('0x5a')](config[_0x2adb('0x5b')],_0x5b0ebf,_['toLower'](_0x2adb('0x60')));}if(!fs[_0x2adb('0x61')](_0x4d4e25)){throw new db[(_0x2adb('0x62'))][(_0x2adb('0x63'))](_[_0x2adb('0x5e')]('logo')+_0x2adb('0x64'));}return _0x503861['download'](_0x4d4e25);}})[_0x2adb('0x49')](handleError(_0x503861,null));};var utilLicense=require(_0x2adb('0x13'));exports['getLogoLogin']=function(_0x5722bc,_0x7e5d9d,_0x185db0){var _0x40bb39='server/files/images/logos';var _0x217cc1={'custom':![]};return utilLicense['getLicense']()[_0x2adb('0x19')](function(_0x59b3d0){if(_0x59b3d0){_0x217cc1=_0x59b3d0;}return db[_0x2adb('0x33')][_0x2adb('0x4c')]({'where':{'id':_0x5722bc['params']['id']},'attributes':[_0x2adb('0x4f'),_0x2adb('0x65'),_0x2adb('0x54'),_0x2adb('0x55'),_0x2adb('0x56'),'defaultLoginLogo',_0x2adb('0x58'),'defaultFavicon'],'raw':!![]});})[_0x2adb('0x19')](handleEntityNotFound(_0x7e5d9d,null))['then'](function(_0x4c171e){if(_0x4c171e){var _0x2cfc59=_0x4c171e['loginLogo']&&fs['existsSync'](path[_0x2adb('0x5a')](config[_0x2adb('0x5b')],_0x40bb39,_[_0x2adb('0x5c')](_0x4c171e['loginLogo'])))?path[_0x2adb('0x5a')](config[_0x2adb('0x5b')],_0x40bb39,_[_0x2adb('0x5c')](_0x4c171e[_0x2adb('0x65')])):path['join'](config[_0x2adb('0x5b')],_0x40bb39,_[_0x2adb('0x5c')](_0x2adb('0x66')));var _0x248fa0=_0x2adb('0x5d')+_[_0x2adb('0x5e')](_0x2adb('0x65'));if(_0x4c171e[_0x248fa0]||!_0x217cc1[_0x2adb('0x5f')]){_0x2cfc59=path[_0x2adb('0x5a')](config['root'],_0x40bb39,_['toLower'](_0x2adb('0x66')));}if(!fs[_0x2adb('0x61')](_0x2cfc59)){throw new db[(_0x2adb('0x62'))]['ValidationError'](_[_0x2adb('0x5e')](_0x2adb('0x65'))+'\x20not\x20found');}return _0x7e5d9d['download'](_0x2cfc59);}})[_0x2adb('0x49')](handleError(_0x7e5d9d,null));};exports[_0x2adb('0x67')]=function(_0x1d3e3e,_0x36a7e5){return db[_0x2adb('0x33')]['find']({'where':{'id':_0x1d3e3e[_0x2adb('0x4b')]['id']},'attributes':[_0x2adb('0x68')]})[_0x2adb('0x19')](respondWithResult(_0x36a7e5,null))[_0x2adb('0x49')](handleError(_0x36a7e5,null));};exports['addPreferred']=function(_0x5a1031,_0x306406,_0x372862){if(_0x5a1031[_0x2adb('0x4e')]&&_0x5a1031['file'][_0x2adb('0x50')]){_0x5a1031[_0x2adb('0x4d')][_0x2adb('0x54')]=_0x5a1031['file'][_0x2adb('0x50')];}return db[_0x2adb('0x33')][_0x2adb('0x4c')]({'where':{'id':_0x5a1031[_0x2adb('0x4b')]['id']}})[_0x2adb('0x19')](handleEntityNotFound(_0x306406,null))[_0x2adb('0x19')](saveUpdates(_0x5a1031['body'],null))[_0x2adb('0x19')](respondWithResult(_0x306406,null))['catch'](handleError(_0x306406,null));};var utilLicense=require(_0x2adb('0x13'));exports[_0x2adb('0x69')]=function(_0x36f033,_0x918924,_0x4d06f7){var _0x43315f='server/files/images/logos';var _0x449131={'custom':![]};return utilLicense['getLicense']()[_0x2adb('0x19')](function(_0x5056df){if(_0x5056df){_0x449131=_0x5056df;}return db[_0x2adb('0x33')][_0x2adb('0x4c')]({'where':{'id':_0x36f033[_0x2adb('0x4b')]['id']},'attributes':[_0x2adb('0x4f'),'loginLogo',_0x2adb('0x54'),_0x2adb('0x55'),'defaultLogo',_0x2adb('0x57'),_0x2adb('0x58'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x918924,null))['then'](function(_0x3ec4ab){if(_0x3ec4ab){var _0x1f7dd5=_0x3ec4ab['preferred']&&fs[_0x2adb('0x61')](path[_0x2adb('0x5a')](config[_0x2adb('0x5b')],_0x43315f,_[_0x2adb('0x5c')](_0x3ec4ab[_0x2adb('0x54')])))?path[_0x2adb('0x5a')](config[_0x2adb('0x5b')],_0x43315f,_[_0x2adb('0x5c')](_0x3ec4ab[_0x2adb('0x54')])):path[_0x2adb('0x5a')](config[_0x2adb('0x5b')],_0x43315f,_[_0x2adb('0x5c')](_0x2adb('0x6a')));var _0x57a1c6=_0x2adb('0x5d')+_['upperFirst'](_0x2adb('0x54'));if(_0x3ec4ab[_0x57a1c6]||!_0x449131[_0x2adb('0x5f')]||!_0x449131[_0x2adb('0x54')]){_0x1f7dd5=path[_0x2adb('0x5a')](config[_0x2adb('0x5b')],_0x43315f,_[_0x2adb('0x5c')]('default_preferred.png'));}if(!fs[_0x2adb('0x61')](_0x1f7dd5)){throw new db['Sequelize'][(_0x2adb('0x63'))](_[_0x2adb('0x5e')](_0x2adb('0x54'))+_0x2adb('0x64'));}return _0x918924[_0x2adb('0x6b')](_0x1f7dd5);}})[_0x2adb('0x49')](handleError(_0x918924,null));};exports[_0x2adb('0x6c')]=function(_0x2c79c2,_0x1c5fd3,_0x2288a9){if(_0x2c79c2[_0x2adb('0x4e')]&&_0x2c79c2[_0x2adb('0x4e')][_0x2adb('0x50')]){_0x2c79c2[_0x2adb('0x4d')][_0x2adb('0x55')]=_0x2c79c2[_0x2adb('0x4e')][_0x2adb('0x50')];}return db[_0x2adb('0x33')][_0x2adb('0x4c')]({'where':{'id':_0x2c79c2[_0x2adb('0x4b')]['id']}})[_0x2adb('0x19')](handleEntityNotFound(_0x1c5fd3,null))[_0x2adb('0x19')](saveUpdates(_0x2c79c2[_0x2adb('0x4d')],null))['then'](respondWithResult(_0x1c5fd3,null))['catch'](handleError(_0x1c5fd3,null));};var utilLicense=require(_0x2adb('0x13'));exports[_0x2adb('0x6d')]=function(_0x2db017,_0x4ef3ea,_0x452f6c){var _0xdb7307='server/files/images/logos';var _0x320fb2={'custom':![]};return utilLicense['getLicense']()[_0x2adb('0x19')](function(_0x4f6c83){if(_0x4f6c83){_0x320fb2=_0x4f6c83;}return db[_0x2adb('0x33')][_0x2adb('0x4c')]({'where':{'id':_0x2db017[_0x2adb('0x4b')]['id']},'attributes':[_0x2adb('0x4f'),'loginLogo',_0x2adb('0x54'),_0x2adb('0x55'),_0x2adb('0x56'),_0x2adb('0x57'),_0x2adb('0x58'),_0x2adb('0x59')],'raw':!![]});})['then'](handleEntityNotFound(_0x4ef3ea,null))[_0x2adb('0x19')](function(_0x268c16){if(_0x268c16){var _0x4d6d2f=_0x268c16[_0x2adb('0x55')]&&fs['existsSync'](path['join'](config['root'],_0xdb7307,_['toLower'](_0x268c16['favicon'])))?path[_0x2adb('0x5a')](config['root'],_0xdb7307,_[_0x2adb('0x5c')](_0x268c16['favicon'])):path[_0x2adb('0x5a')](config[_0x2adb('0x5b')],_0xdb7307,_[_0x2adb('0x5c')]('default_favicon.ico'));var _0x4ec04f=_0x2adb('0x5d')+_['upperFirst'](_0x2adb('0x55'));if(_0x268c16[_0x4ec04f]||!_0x320fb2[_0x2adb('0x5f')]){_0x4d6d2f=path[_0x2adb('0x5a')](config[_0x2adb('0x5b')],_0xdb7307,_[_0x2adb('0x5c')](_0x2adb('0x6e')));}if(!fs['existsSync'](_0x4d6d2f)){throw new db[(_0x2adb('0x62'))][(_0x2adb('0x63'))](_[_0x2adb('0x5e')](_0x2adb('0x55'))+_0x2adb('0x64'));}return _0x4ef3ea[_0x2adb('0x6b')](_0x4d6d2f);}})[_0x2adb('0x49')](handleError(_0x4ef3ea,null));};exports[_0x2adb('0x6f')]=function(_0x52622a,_0x3773a5){var _0x49c23d={'offset':moment()[_0x2adb('0x70')]()};_0x49c23d[_0x2adb('0x71')]=moment()['utcOffset'](_0x49c23d[_0x2adb('0x26')])[_0x2adb('0x72')](_0x2adb('0x73'));return _0x3773a5['status'](0xc8)[_0x2adb('0x31')](_0x49c23d);}; \ No newline at end of file +var _0xee81=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','rows','show','params','keys','length','include','find','body','addLogo','file','filename','logo','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultFavicon','join','toLower','root','default','custom','default_logo.svg','Sequelize','upperFirst','\x20not\x20found','download','defaultLogo','defaultPreferred','existsSync','default_loginLogo.svg','ValidationError','gdpr','securePassword','getPreferred','defaultLoginLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x51d954,_0x31aae5){var _0x362f82=function(_0x215c3a){while(--_0x215c3a){_0x51d954['push'](_0x51d954['shift']());}};_0x362f82(++_0x31aae5);}(_0xee81,0x15e));var _0x1ee8=function(_0x152bfe,_0x197cdf){_0x152bfe=_0x152bfe-0x0;var _0x38401c=_0xee81[_0x152bfe];return _0x38401c;};'use strict';var emlformat=require(_0x1ee8('0x0'));var rimraf=require(_0x1ee8('0x1'));var zipdir=require(_0x1ee8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1ee8('0x3'));var BPromise=require(_0x1ee8('0x4'));var Mustache=require('mustache');var util=require(_0x1ee8('0x5'));var path=require(_0x1ee8('0x6'));var sox=require('sox');var csv=require(_0x1ee8('0x7'));var ejs=require(_0x1ee8('0x8'));var fs=require('fs');var fs_extra=require(_0x1ee8('0x9'));var _=require(_0x1ee8('0xa'));var squel=require(_0x1ee8('0xb'));var crypto=require(_0x1ee8('0xc'));var jsforce=require(_0x1ee8('0xd'));var deskjs=require(_0x1ee8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1ee8('0xf'));var Papa=require(_0x1ee8('0x10'));var Redis=require(_0x1ee8('0x11'));var authService=require(_0x1ee8('0x12'));var qs=require(_0x1ee8('0x13'));var as=require(_0x1ee8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ee8('0x15'))('api');var utils=require(_0x1ee8('0x16'));var config=require(_0x1ee8('0x17'));var licenseUtil=require(_0x1ee8('0x18'));var db=require(_0x1ee8('0x19'))['db'];var jayson=require(_0x1ee8('0x1a'));var client=jayson[_0x1ee8('0x1b')][_0x1ee8('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x40110a,_0x1ca389,_0x43ea5a,_0x523a18){return new BPromise(function(_0x57427a,_0x26634e){var _0x36c5f7=_0x523a18||client;return _0x36c5f7[_0x1ee8('0x1d')](_0x40110a,_0x43ea5a)['then'](function(_0x5754d5){logger['info']('Setting,\x20%s,\x20%s',_0x1ca389,_0x1ee8('0x1e'));logger[_0x1ee8('0x1f')](_0x1ee8('0x20'),_0x1ca389,_0x1ee8('0x1e'),JSON[_0x1ee8('0x21')](_0x5754d5));if(_0x5754d5[_0x1ee8('0x22')]){if(_0x5754d5['error'][_0x1ee8('0x23')]===0x1f4){logger['error'](_0x1ee8('0x24'),_0x1ca389,_0x5754d5['error'][_0x1ee8('0x25')]);return _0x26634e(_0x5754d5[_0x1ee8('0x22')][_0x1ee8('0x25')]);}logger[_0x1ee8('0x22')](_0x1ee8('0x24'),_0x1ca389,_0x5754d5[_0x1ee8('0x22')][_0x1ee8('0x25')]);return _0x57427a(_0x5754d5[_0x1ee8('0x22')][_0x1ee8('0x25')]);}else{logger['info'](_0x1ee8('0x24'),_0x1ca389,_0x1ee8('0x1e'));_0x57427a(_0x5754d5[_0x1ee8('0x26')]['message']);}})[_0x1ee8('0x27')](function(_0x8371bb){logger[_0x1ee8('0x22')](_0x1ee8('0x24'),_0x1ca389,_0x8371bb);_0x26634e(_0x8371bb);});});}function respondWithStatusCode(_0x25dc72,_0x224d4a){_0x224d4a=_0x224d4a||0xcc;return function(_0x55b042){if(_0x55b042){return _0x25dc72[_0x1ee8('0x28')](_0x224d4a);}return _0x25dc72[_0x1ee8('0x29')](_0x224d4a)['end']();};}function respondWithResult(_0x26c5d4,_0x70e2e1){_0x70e2e1=_0x70e2e1||0xc8;return function(_0x11888c){if(_0x11888c){return _0x26c5d4['status'](_0x70e2e1)[_0x1ee8('0x2a')](_0x11888c);}};}function respondWithFilteredResult(_0x2d22eb,_0x38caff){return function(_0x38a2ee){if(_0x38a2ee){var _0x85b1d1=typeof _0x38caff[_0x1ee8('0x2b')]===_0x1ee8('0x2c')&&typeof _0x38caff[_0x1ee8('0x2d')]===_0x1ee8('0x2c');var _0x295e94=_0x38a2ee[_0x1ee8('0x2e')];var _0x60ca74=_0x85b1d1?0x0:_0x38caff[_0x1ee8('0x2b')];var _0x327485=_0x85b1d1?_0x38a2ee[_0x1ee8('0x2e')]:_0x38caff[_0x1ee8('0x2b')]+_0x38caff['limit'];var _0x4d0398;if(_0x327485>=_0x295e94){_0x327485=_0x295e94;_0x4d0398=0xc8;}else{_0x4d0398=0xce;}_0x2d22eb[_0x1ee8('0x29')](_0x4d0398);return _0x2d22eb['set'](_0x1ee8('0x2f'),_0x60ca74+'-'+_0x327485+'/'+_0x295e94)['json'](_0x38a2ee);}return null;};}function patchUpdates(_0x5f2aa1){return function(_0x71b1e8){try{jsonpatch[_0x1ee8('0x30')](_0x71b1e8,_0x5f2aa1,!![]);}catch(_0x2af208){return BPromise[_0x1ee8('0x31')](_0x2af208);}return _0x71b1e8[_0x1ee8('0x32')]();};}function saveUpdates(_0x4a7d3c,_0x35bf92){return function(_0x1e13f4){if(_0x1e13f4){return _0x1e13f4[_0x1ee8('0x33')](_0x4a7d3c)['then'](function(_0x4b23db){return _0x4b23db;});}return null;};}function removeEntity(_0x3c3f83,_0x41b1f7){return function(_0x61bf69){if(_0x61bf69){return _0x61bf69[_0x1ee8('0x34')]()['then'](function(){_0x3c3f83[_0x1ee8('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5431bb,_0x41a71a){return function(_0x375e72){if(!_0x375e72){_0x5431bb[_0x1ee8('0x28')](0x194);}return _0x375e72;};}function handleError(_0x5ba2d7,_0x1b7532){_0x1b7532=_0x1b7532||0x1f4;return function(_0x44d041){logger[_0x1ee8('0x22')](_0x44d041[_0x1ee8('0x35')]);if(_0x44d041['name']){delete _0x44d041[_0x1ee8('0x36')];}_0x5ba2d7[_0x1ee8('0x29')](_0x1b7532)[_0x1ee8('0x37')](_0x44d041);};}exports['index']=function(_0x51b935,_0x30047f){var _0x21a019={},_0x2667cd={},_0x28b6c9={'count':0x0,'rows':[]};var _0x41a1c4=_[_0x1ee8('0x38')](db[_0x1ee8('0x39')][_0x1ee8('0x3a')],function(_0x56095a){return{'name':_0x56095a[_0x1ee8('0x3b')],'type':_0x56095a[_0x1ee8('0x3c')][_0x1ee8('0x3d')]};});_0x2667cd[_0x1ee8('0x3e')]=_[_0x1ee8('0x38')](_0x41a1c4,_0x1ee8('0x36'));_0x2667cd['query']=_['keys'](_0x51b935[_0x1ee8('0x3f')]);_0x2667cd[_0x1ee8('0x40')]=_[_0x1ee8('0x41')](_0x2667cd[_0x1ee8('0x3e')],_0x2667cd[_0x1ee8('0x3f')]);_0x21a019[_0x1ee8('0x42')]=_[_0x1ee8('0x41')](_0x2667cd[_0x1ee8('0x3e')],qs[_0x1ee8('0x43')](_0x51b935[_0x1ee8('0x3f')][_0x1ee8('0x43')]));_0x21a019[_0x1ee8('0x42')]=_0x21a019['attributes']['length']?_0x21a019[_0x1ee8('0x42')]:_0x2667cd['model'];if(!_0x51b935['query']['hasOwnProperty'](_0x1ee8('0x44'))){_0x21a019['limit']=qs['limit'](_0x51b935[_0x1ee8('0x3f')]['limit']);_0x21a019[_0x1ee8('0x2b')]=qs[_0x1ee8('0x2b')](_0x51b935[_0x1ee8('0x3f')]['offset']);}_0x21a019[_0x1ee8('0x45')]=qs[_0x1ee8('0x46')](_0x51b935[_0x1ee8('0x3f')][_0x1ee8('0x46')]);_0x21a019[_0x1ee8('0x47')]=qs[_0x1ee8('0x40')](_[_0x1ee8('0x48')](_0x51b935[_0x1ee8('0x3f')],_0x2667cd['filters']),_0x41a1c4);if(_0x51b935[_0x1ee8('0x3f')][_0x1ee8('0x49')]){_0x21a019[_0x1ee8('0x47')]=_[_0x1ee8('0x4a')](_0x21a019[_0x1ee8('0x47')],{'$or':_[_0x1ee8('0x38')](_0x41a1c4,function(_0x927a7c){if(_0x927a7c[_0x1ee8('0x3c')]!==_0x1ee8('0x4b')){var _0x447663={};_0x447663[_0x927a7c['name']]={'$like':'%'+_0x51b935[_0x1ee8('0x3f')][_0x1ee8('0x49')]+'%'};return _0x447663;}})});}_0x21a019=_['merge']({},_0x21a019,_0x51b935[_0x1ee8('0x4c')]);var _0x56d49a={'where':_0x21a019[_0x1ee8('0x47')]};return db[_0x1ee8('0x39')][_0x1ee8('0x2e')](_0x56d49a)[_0x1ee8('0x4d')](function(_0x4d6ac7){_0x28b6c9['count']=_0x4d6ac7;if(_0x51b935[_0x1ee8('0x3f')][_0x1ee8('0x4e')]){_0x21a019['include']=[{'all':!![]}];}return db['Setting']['findAll'](_0x21a019);})['then'](function(_0x141d44){_0x28b6c9[_0x1ee8('0x4f')]=_0x141d44;return _0x28b6c9;})[_0x1ee8('0x4d')](respondWithFilteredResult(_0x30047f,_0x21a019))[_0x1ee8('0x27')](handleError(_0x30047f,null));};exports[_0x1ee8('0x50')]=function(_0x4bdcfc,_0x2085d9){var _0x4487ff={'raw':![],'where':{'id':_0x4bdcfc[_0x1ee8('0x51')]['id']}},_0x1ce1c4={};_0x1ce1c4[_0x1ee8('0x3e')]=_[_0x1ee8('0x52')](db[_0x1ee8('0x39')][_0x1ee8('0x3a')]);_0x1ce1c4['query']=_[_0x1ee8('0x52')](_0x4bdcfc[_0x1ee8('0x3f')]);_0x1ce1c4[_0x1ee8('0x40')]=_[_0x1ee8('0x41')](_0x1ce1c4[_0x1ee8('0x3e')],_0x1ce1c4[_0x1ee8('0x3f')]);_0x4487ff[_0x1ee8('0x42')]=_[_0x1ee8('0x41')](_0x1ce1c4[_0x1ee8('0x3e')],qs[_0x1ee8('0x43')](_0x4bdcfc['query'][_0x1ee8('0x43')]));_0x4487ff[_0x1ee8('0x42')]=_0x4487ff[_0x1ee8('0x42')][_0x1ee8('0x53')]?_0x4487ff[_0x1ee8('0x42')]:_0x1ce1c4[_0x1ee8('0x3e')];if(_0x4bdcfc[_0x1ee8('0x3f')][_0x1ee8('0x4e')]){_0x4487ff[_0x1ee8('0x54')]=[{'all':!![]}];}_0x4487ff=_['merge']({},_0x4487ff,_0x4bdcfc[_0x1ee8('0x4c')]);return db['Setting'][_0x1ee8('0x55')](_0x4487ff)['then'](handleEntityNotFound(_0x2085d9,null))[_0x1ee8('0x4d')](respondWithResult(_0x2085d9,null))[_0x1ee8('0x27')](handleError(_0x2085d9,null));};exports[_0x1ee8('0x33')]=function(_0x1094d6,_0x2e7466){if(_0x1094d6[_0x1ee8('0x56')]['id']){delete _0x1094d6[_0x1ee8('0x56')]['id'];}return db[_0x1ee8('0x39')]['find']({'where':{'id':_0x1094d6[_0x1ee8('0x51')]['id']}})[_0x1ee8('0x4d')](handleEntityNotFound(_0x2e7466,null))['then'](saveUpdates(_0x1094d6[_0x1ee8('0x56')],null))[_0x1ee8('0x4d')](respondWithResult(_0x2e7466,null))[_0x1ee8('0x27')](handleError(_0x2e7466,null));};exports[_0x1ee8('0x57')]=function(_0x6c5e3d,_0x12c755,_0x3514ca){if(_0x6c5e3d[_0x1ee8('0x58')]&&_0x6c5e3d[_0x1ee8('0x58')][_0x1ee8('0x59')]){_0x6c5e3d[_0x1ee8('0x56')][_0x1ee8('0x5a')]=_0x6c5e3d['file'][_0x1ee8('0x59')];}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x6c5e3d['params']['id']}})[_0x1ee8('0x4d')](handleEntityNotFound(_0x12c755,null))[_0x1ee8('0x4d')](saveUpdates(_0x6c5e3d['body'],null))[_0x1ee8('0x4d')](respondWithResult(_0x12c755,null))[_0x1ee8('0x27')](handleError(_0x12c755,null));};exports['addLogoLogin']=function(_0x1e56bf,_0x3e7a26,_0x2e7612){if(_0x1e56bf[_0x1ee8('0x58')]&&_0x1e56bf[_0x1ee8('0x58')][_0x1ee8('0x59')]){_0x1e56bf[_0x1ee8('0x56')][_0x1ee8('0x5b')]=_0x1e56bf[_0x1ee8('0x58')][_0x1ee8('0x59')];}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x1e56bf['params']['id']}})[_0x1ee8('0x4d')](handleEntityNotFound(_0x3e7a26,null))[_0x1ee8('0x4d')](saveUpdates(_0x1e56bf[_0x1ee8('0x56')],null))[_0x1ee8('0x4d')](respondWithResult(_0x3e7a26,null))[_0x1ee8('0x27')](handleError(_0x3e7a26,null));};var utilLicense=require(_0x1ee8('0x18'));exports['getLogo']=function(_0x46202a,_0x405a7e,_0x21bee3){var _0xa3fab2=_0x1ee8('0x5c');var _0xb5a62d={'custom':![]};return utilLicense[_0x1ee8('0x5d')]()[_0x1ee8('0x4d')](function(_0x13de81){if(_0x13de81){_0xb5a62d=_0x13de81;}return db['Setting'][_0x1ee8('0x55')]({'where':{'id':_0x46202a['params']['id']},'attributes':[_0x1ee8('0x5a'),_0x1ee8('0x5b'),_0x1ee8('0x5e'),_0x1ee8('0x5f'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x1ee8('0x60')],'raw':!![]});})[_0x1ee8('0x4d')](handleEntityNotFound(_0x405a7e,null))[_0x1ee8('0x4d')](function(_0x1633c0){if(_0x1633c0){var _0x21b898=_0x1633c0[_0x1ee8('0x5a')]&&fs['existsSync'](path[_0x1ee8('0x61')](config['root'],_0xa3fab2,_[_0x1ee8('0x62')](_0x1633c0[_0x1ee8('0x5a')])))?path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0xa3fab2,_[_0x1ee8('0x62')](_0x1633c0[_0x1ee8('0x5a')])):path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0xa3fab2,_[_0x1ee8('0x62')]('default_logo.svg'));var _0x2b5cca=_0x1ee8('0x64')+_['upperFirst'](_0x1ee8('0x5a'));if(_0x1633c0[_0x2b5cca]||!_0xb5a62d[_0x1ee8('0x65')]){_0x21b898=path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0xa3fab2,_['toLower'](_0x1ee8('0x66')));}if(!fs['existsSync'](_0x21b898)){throw new db[(_0x1ee8('0x67'))]['ValidationError'](_[_0x1ee8('0x68')](_0x1ee8('0x5a'))+_0x1ee8('0x69'));}return _0x405a7e[_0x1ee8('0x6a')](_0x21b898);}})[_0x1ee8('0x27')](handleError(_0x405a7e,null));};var utilLicense=require(_0x1ee8('0x18'));exports['getLogoLogin']=function(_0x5c0d8e,_0x246f3b,_0x541136){var _0x1efe6f=_0x1ee8('0x5c');var _0x5d2633={'custom':![]};return utilLicense[_0x1ee8('0x5d')]()['then'](function(_0x48de77){if(_0x48de77){_0x5d2633=_0x48de77;}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x5c0d8e[_0x1ee8('0x51')]['id']},'attributes':[_0x1ee8('0x5a'),_0x1ee8('0x5b'),_0x1ee8('0x5e'),_0x1ee8('0x5f'),_0x1ee8('0x6b'),'defaultLoginLogo',_0x1ee8('0x6c'),_0x1ee8('0x60')],'raw':!![]});})[_0x1ee8('0x4d')](handleEntityNotFound(_0x246f3b,null))[_0x1ee8('0x4d')](function(_0x2b7d68){if(_0x2b7d68){var _0x500757=_0x2b7d68[_0x1ee8('0x5b')]&&fs[_0x1ee8('0x6d')](path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0x1efe6f,_[_0x1ee8('0x62')](_0x2b7d68[_0x1ee8('0x5b')])))?path[_0x1ee8('0x61')](config['root'],_0x1efe6f,_[_0x1ee8('0x62')](_0x2b7d68['loginLogo'])):path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0x1efe6f,_[_0x1ee8('0x62')]('default_loginLogo.svg'));var _0x1e3a62=_0x1ee8('0x64')+_[_0x1ee8('0x68')](_0x1ee8('0x5b'));if(_0x2b7d68[_0x1e3a62]||!_0x5d2633[_0x1ee8('0x65')]){_0x500757=path['join'](config[_0x1ee8('0x63')],_0x1efe6f,_['toLower'](_0x1ee8('0x6e')));}if(!fs[_0x1ee8('0x6d')](_0x500757)){throw new db[(_0x1ee8('0x67'))][(_0x1ee8('0x6f'))](_[_0x1ee8('0x68')](_0x1ee8('0x5b'))+_0x1ee8('0x69'));}return _0x246f3b[_0x1ee8('0x6a')](_0x500757);}})['catch'](handleError(_0x246f3b,null));};exports[_0x1ee8('0x70')]=function(_0x4953c2,_0x26fa9b){return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x4953c2['params']['id']},'attributes':[_0x1ee8('0x71')]})['then'](respondWithResult(_0x26fa9b,null))[_0x1ee8('0x27')](handleError(_0x26fa9b,null));};exports['addPreferred']=function(_0xf71d8f,_0x2bf3c4,_0x293338){if(_0xf71d8f['file']&&_0xf71d8f[_0x1ee8('0x58')][_0x1ee8('0x59')]){_0xf71d8f[_0x1ee8('0x56')][_0x1ee8('0x5e')]=_0xf71d8f[_0x1ee8('0x58')][_0x1ee8('0x59')];}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0xf71d8f[_0x1ee8('0x51')]['id']}})['then'](handleEntityNotFound(_0x2bf3c4,null))['then'](saveUpdates(_0xf71d8f['body'],null))[_0x1ee8('0x4d')](respondWithResult(_0x2bf3c4,null))['catch'](handleError(_0x2bf3c4,null));};var utilLicense=require(_0x1ee8('0x18'));exports[_0x1ee8('0x72')]=function(_0x3408ea,_0x555eec,_0x4d0d1b){var _0x5112d1='server/files/images/logos';var _0x10079b={'custom':![]};return utilLicense[_0x1ee8('0x5d')]()[_0x1ee8('0x4d')](function(_0x1056f3){if(_0x1056f3){_0x10079b=_0x1056f3;}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x3408ea[_0x1ee8('0x51')]['id']},'attributes':[_0x1ee8('0x5a'),_0x1ee8('0x5b'),_0x1ee8('0x5e'),_0x1ee8('0x5f'),'defaultLogo',_0x1ee8('0x73'),_0x1ee8('0x6c'),'defaultFavicon'],'raw':!![]});})[_0x1ee8('0x4d')](handleEntityNotFound(_0x555eec,null))[_0x1ee8('0x4d')](function(_0x4bb765){if(_0x4bb765){var _0x1ee247=_0x4bb765['preferred']&&fs[_0x1ee8('0x6d')](path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0x5112d1,_[_0x1ee8('0x62')](_0x4bb765[_0x1ee8('0x5e')])))?path['join'](config['root'],_0x5112d1,_[_0x1ee8('0x62')](_0x4bb765['preferred'])):path[_0x1ee8('0x61')](config['root'],_0x5112d1,_['toLower'](_0x1ee8('0x74')));var _0x5b3645=_0x1ee8('0x64')+_['upperFirst'](_0x1ee8('0x5e'));if(_0x4bb765[_0x5b3645]||!_0x10079b[_0x1ee8('0x65')]||!_0x10079b[_0x1ee8('0x5e')]){_0x1ee247=path['join'](config[_0x1ee8('0x63')],_0x5112d1,_[_0x1ee8('0x62')]('default_preferred.png'));}if(!fs[_0x1ee8('0x6d')](_0x1ee247)){throw new db[(_0x1ee8('0x67'))][(_0x1ee8('0x6f'))](_[_0x1ee8('0x68')](_0x1ee8('0x5e'))+_0x1ee8('0x69'));}return _0x555eec[_0x1ee8('0x6a')](_0x1ee247);}})[_0x1ee8('0x27')](handleError(_0x555eec,null));};exports[_0x1ee8('0x75')]=function(_0x4e0067,_0x4d3f43,_0x5bac10){if(_0x4e0067['file']&&_0x4e0067['file'][_0x1ee8('0x59')]){_0x4e0067['body']['favicon']=_0x4e0067[_0x1ee8('0x58')][_0x1ee8('0x59')];}return db['Setting'][_0x1ee8('0x55')]({'where':{'id':_0x4e0067[_0x1ee8('0x51')]['id']}})[_0x1ee8('0x4d')](handleEntityNotFound(_0x4d3f43,null))[_0x1ee8('0x4d')](saveUpdates(_0x4e0067[_0x1ee8('0x56')],null))[_0x1ee8('0x4d')](respondWithResult(_0x4d3f43,null))['catch'](handleError(_0x4d3f43,null));};var utilLicense=require('../../config/license/util');exports[_0x1ee8('0x76')]=function(_0x279c90,_0x51a5dd,_0x144257){var _0x2750ca=_0x1ee8('0x5c');var _0x5d8c5e={'custom':![]};return utilLicense[_0x1ee8('0x5d')]()[_0x1ee8('0x4d')](function(_0x24ba36){if(_0x24ba36){_0x5d8c5e=_0x24ba36;}return db[_0x1ee8('0x39')][_0x1ee8('0x55')]({'where':{'id':_0x279c90[_0x1ee8('0x51')]['id']},'attributes':['logo','loginLogo','preferred',_0x1ee8('0x5f'),_0x1ee8('0x6b'),_0x1ee8('0x73'),_0x1ee8('0x6c'),_0x1ee8('0x60')],'raw':!![]});})[_0x1ee8('0x4d')](handleEntityNotFound(_0x51a5dd,null))[_0x1ee8('0x4d')](function(_0x3ac2c2){if(_0x3ac2c2){var _0x33f7c2=_0x3ac2c2[_0x1ee8('0x5f')]&&fs['existsSync'](path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0x2750ca,_[_0x1ee8('0x62')](_0x3ac2c2[_0x1ee8('0x5f')])))?path[_0x1ee8('0x61')](config[_0x1ee8('0x63')],_0x2750ca,_[_0x1ee8('0x62')](_0x3ac2c2[_0x1ee8('0x5f')])):path[_0x1ee8('0x61')](config['root'],_0x2750ca,_[_0x1ee8('0x62')](_0x1ee8('0x77')));var _0x10d5eb=_0x1ee8('0x64')+_[_0x1ee8('0x68')](_0x1ee8('0x5f'));if(_0x3ac2c2[_0x10d5eb]||!_0x5d8c5e[_0x1ee8('0x65')]){_0x33f7c2=path['join'](config['root'],_0x2750ca,_[_0x1ee8('0x62')](_0x1ee8('0x77')));}if(!fs[_0x1ee8('0x6d')](_0x33f7c2)){throw new db[(_0x1ee8('0x67'))][(_0x1ee8('0x6f'))](_[_0x1ee8('0x68')](_0x1ee8('0x5f'))+_0x1ee8('0x69'));}return _0x51a5dd['download'](_0x33f7c2);}})[_0x1ee8('0x27')](handleError(_0x51a5dd,null));};exports[_0x1ee8('0x78')]=function(_0x45d0e6,_0x481945){var _0x389c96={'offset':moment()[_0x1ee8('0x79')]()};_0x389c96['now']=moment()[_0x1ee8('0x79')](_0x389c96[_0x1ee8('0x2b')])['format'](_0x1ee8('0x7a'));return _0x481945[_0x1ee8('0x29')](0xc8)['send'](_0x389c96);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 65edea0..07c484d 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x25e4a3,_0x1d69a7){var _0x85e43f=function(_0x49e695){while(--_0x49e695){_0x25e4a3['push'](_0x25e4a3['shift']());}};_0x85e43f(++_0x1d69a7);}(_0xedd9,0xfc));var _0x9edd=function(_0x5f09cb,_0x3118f1){_0x5f09cb=_0x5f09cb-0x0;var _0x3cbe10=_0xedd9[_0x5f09cb];return _0x3cbe10;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 4817f81..cecb22e 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 _0xca8c=['include','map','model','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','ShowSetting','Setting','find','options','attributes'];(function(_0x4bfec3,_0x3c5605){var _0x5c63bf=function(_0x2146c4){while(--_0x2146c4){_0x4bfec3['push'](_0x4bfec3['shift']());}};_0x5c63bf(++_0x3c5605);}(_0xca8c,0x107));var _0xcca8=function(_0x4ea162,_0x4a9bd5){_0x4ea162=_0x4ea162-0x0;var _0x1446fc=_0xca8c[_0x4ea162];return _0x1446fc;};'use strict';var _=require('lodash');var util=require(_0xcca8('0x0'));var moment=require(_0xcca8('0x1'));var BPromise=require(_0xcca8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcca8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcca8('0x4'));var logger=require(_0xcca8('0x5'))(_0xcca8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcca8('0x7')][_0xcca8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b37e8,_0x41fc48,_0x1881a1){return new BPromise(function(_0x514745,_0x15bd98){return client['request'](_0x5b37e8,_0x1881a1)[_0xcca8('0x9')](function(_0x11299b){logger[_0xcca8('0xa')](_0xcca8('0xb'),_0x41fc48,_0xcca8('0xc'));logger[_0xcca8('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x41fc48,_0xcca8('0xc'),JSON[_0xcca8('0xe')](_0x11299b));if(_0x11299b[_0xcca8('0xf')]){if(_0x11299b['error']['code']===0x1f4){logger[_0xcca8('0xf')](_0xcca8('0xb'),_0x41fc48,_0x11299b[_0xcca8('0xf')][_0xcca8('0x10')]);return _0x15bd98(_0x11299b[_0xcca8('0xf')][_0xcca8('0x10')]);}logger['error'](_0xcca8('0xb'),_0x41fc48,_0x11299b[_0xcca8('0xf')][_0xcca8('0x10')]);return _0x514745(_0x11299b[_0xcca8('0xf')][_0xcca8('0x10')]);}else{logger['info'](_0xcca8('0xb'),_0x41fc48,'request\x20sent');_0x514745(_0x11299b['result']['message']);}})[_0xcca8('0x11')](function(_0x2386e5){logger[_0xcca8('0xf')](_0xcca8('0xb'),_0x41fc48,_0x2386e5);_0x15bd98(_0x2386e5);});});}exports[_0xcca8('0x12')]=function(_0x513573){var _0x30a0d8=this;return new Promise(function(_0x136b7e,_0x47f0b7){return db[_0xcca8('0x13')][_0xcca8('0x14')]({'raw':_0x513573[_0xcca8('0x15')]?_0x513573[_0xcca8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x513573[_0xcca8('0x15')]?_0x513573[_0xcca8('0x15')]['where']||null:null,'attributes':_0x513573[_0xcca8('0x15')]?_0x513573[_0xcca8('0x15')][_0xcca8('0x16')]||null:null,'include':_0x513573[_0xcca8('0x15')]?_0x513573[_0xcca8('0x15')][_0xcca8('0x17')]?_[_0xcca8('0x18')](_0x513573[_0xcca8('0x15')][_0xcca8('0x17')],function(_0x2dc426){return{'model':db[_0x2dc426[_0xcca8('0x19')]],'as':_0x2dc426['as'],'attributes':_0x2dc426[_0xcca8('0x16')],'include':_0x2dc426[_0xcca8('0x17')]?_[_0xcca8('0x18')](_0x2dc426[_0xcca8('0x17')],function(_0x33c267){return{'model':db[_0x33c267[_0xcca8('0x19')]],'as':_0x33c267['as'],'attributes':_0x33c267[_0xcca8('0x16')],'include':_0x33c267[_0xcca8('0x17')]?_[_0xcca8('0x18')](_0x33c267[_0xcca8('0x17')],function(_0x237ac6){return{'model':db[_0x237ac6[_0xcca8('0x19')]],'as':_0x237ac6['as'],'attributes':_0x237ac6[_0xcca8('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2207f6){logger[_0xcca8('0xa')](_0xcca8('0x12'),_0x513573);logger[_0xcca8('0xd')](_0xcca8('0x12'),_0x513573,JSON[_0xcca8('0xe')](_0x2207f6));_0x136b7e(_0x2207f6);})['catch'](function(_0x2a3c95){logger[_0xcca8('0xf')](_0xcca8('0x12'),_0x2a3c95[_0xcca8('0x10')],_0x513573);_0x47f0b7(_0x30a0d8['error'](0x1f4,_0x2a3c95[_0xcca8('0x10')]));});});}; \ No newline at end of file +var _0xbcf3=['error','code','message','result','catch','ShowSetting','Setting','find','options','where','include','map','model','attributes','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1f1a27,_0x18eceb){var _0x3d454e=function(_0x57d889){while(--_0x57d889){_0x1f1a27['push'](_0x1f1a27['shift']());}};_0x3d454e(++_0x18eceb);}(_0xbcf3,0x1ee));var _0x3bcf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbcf3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x3bcf('0x0'));var moment=require(_0x3bcf('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bcf('0x2'))['db'];var utils=require(_0x3bcf('0x3'));var logger=require(_0x3bcf('0x4'))(_0x3bcf('0x5'));var config=require(_0x3bcf('0x6'));var jayson=require(_0x3bcf('0x7'));var client=jayson[_0x3bcf('0x8')][_0x3bcf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17676b,_0x2200d2,_0x1885af){return new BPromise(function(_0x2247a,_0x4c6c1d){return client[_0x3bcf('0xa')](_0x17676b,_0x1885af)[_0x3bcf('0xb')](function(_0x5f1f8b){logger[_0x3bcf('0xc')](_0x3bcf('0xd'),_0x2200d2,_0x3bcf('0xe'));logger[_0x3bcf('0xf')](_0x3bcf('0x10'),_0x2200d2,_0x3bcf('0xe'),JSON[_0x3bcf('0x11')](_0x5f1f8b));if(_0x5f1f8b[_0x3bcf('0x12')]){if(_0x5f1f8b['error'][_0x3bcf('0x13')]===0x1f4){logger[_0x3bcf('0x12')](_0x3bcf('0xd'),_0x2200d2,_0x5f1f8b[_0x3bcf('0x12')]['message']);return _0x4c6c1d(_0x5f1f8b[_0x3bcf('0x12')][_0x3bcf('0x14')]);}logger[_0x3bcf('0x12')](_0x3bcf('0xd'),_0x2200d2,_0x5f1f8b[_0x3bcf('0x12')][_0x3bcf('0x14')]);return _0x2247a(_0x5f1f8b['error'][_0x3bcf('0x14')]);}else{logger['info'](_0x3bcf('0xd'),_0x2200d2,'request\x20sent');_0x2247a(_0x5f1f8b[_0x3bcf('0x15')][_0x3bcf('0x14')]);}})[_0x3bcf('0x16')](function(_0x2a89b6){logger[_0x3bcf('0x12')](_0x3bcf('0xd'),_0x2200d2,_0x2a89b6);_0x4c6c1d(_0x2a89b6);});});}exports[_0x3bcf('0x17')]=function(_0x286d5e){var _0x53aee1=this;return new Promise(function(_0x15b70b,_0x158420){return db[_0x3bcf('0x18')][_0x3bcf('0x19')]({'raw':_0x286d5e[_0x3bcf('0x1a')]?_0x286d5e['options']['raw']===undefined?!![]:![]:!![],'where':_0x286d5e[_0x3bcf('0x1a')]?_0x286d5e[_0x3bcf('0x1a')][_0x3bcf('0x1b')]||null:null,'attributes':_0x286d5e[_0x3bcf('0x1a')]?_0x286d5e[_0x3bcf('0x1a')]['attributes']||null:null,'include':_0x286d5e[_0x3bcf('0x1a')]?_0x286d5e['options'][_0x3bcf('0x1c')]?_[_0x3bcf('0x1d')](_0x286d5e[_0x3bcf('0x1a')][_0x3bcf('0x1c')],function(_0x53bc2f){return{'model':db[_0x53bc2f[_0x3bcf('0x1e')]],'as':_0x53bc2f['as'],'attributes':_0x53bc2f[_0x3bcf('0x1f')],'include':_0x53bc2f[_0x3bcf('0x1c')]?_[_0x3bcf('0x1d')](_0x53bc2f[_0x3bcf('0x1c')],function(_0x11aa4f){return{'model':db[_0x11aa4f[_0x3bcf('0x1e')]],'as':_0x11aa4f['as'],'attributes':_0x11aa4f['attributes'],'include':_0x11aa4f['include']?_['map'](_0x11aa4f[_0x3bcf('0x1c')],function(_0x2129cc){return{'model':db[_0x2129cc[_0x3bcf('0x1e')]],'as':_0x2129cc['as'],'attributes':_0x2129cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x3bcf('0xb')](function(_0x36daf7){logger[_0x3bcf('0xc')]('ShowSetting',_0x286d5e);logger['debug']('ShowSetting',_0x286d5e,JSON[_0x3bcf('0x11')](_0x36daf7));_0x15b70b(_0x36daf7);})[_0x3bcf('0x16')](function(_0xeb952a){logger[_0x3bcf('0x12')](_0x3bcf('0x17'),_0xeb952a[_0x3bcf('0x14')],_0x286d5e);_0x158420(_0x53aee1[_0x3bcf('0x12')](0x1f4,_0xeb952a[_0x3bcf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index a74e22c..d85de02 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x45cd59,_0x5be7c0){var _0x39541a=function(_0xab724a){while(--_0xab724a){_0x45cd59['push'](_0x45cd59['shift']());}};_0x39541a(++_0x5be7c0);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0xa5e57f,_0x26de48){var _0x4ca614=function(_0x368b34){while(--_0x368b34){_0xa5e57f['push'](_0xa5e57f['shift']());}};_0x4ca614(++_0x26de48);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 45bd3eb..de23199 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 _0x58ef=['name','STRING','generate','ENUM','twilio','connectel','clicksend','clickatell','bandwidth','csc','infobip','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x8988c8,_0xe8d63e){var _0x4f8bd1=function(_0x2e5647){while(--_0x2e5647){_0x8988c8['push'](_0x8988c8['shift']());}};_0x4f8bd1(++_0xe8d63e);}(_0x58ef,0x123));var _0xf58e=function(_0x26f821,_0x30175b){_0x26f821=_0x26f821-0x0;var _0x4af27f=_0x58ef[_0x26f821];return _0x4af27f;};'use strict';var Sequelize=require(_0xf58e('0x0'));var rs=require(_0xf58e('0x1'));module[_0xf58e('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xf58e('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xf58e('0x4')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xf58e('0x4')],'defaultValue':function(){return rs[_0xf58e('0x5')]();}},'phone':{'type':Sequelize[_0xf58e('0x4')]},'type':{'type':Sequelize[_0xf58e('0x6')](_0xf58e('0x7'),'skebby',_0xf58e('0x8'),_0xf58e('0x9'),'plivo',_0xf58e('0xa'),_0xf58e('0xb'),_0xf58e('0xc'),_0xf58e('0xd'),'intelepeer')},'accountSid':{'type':Sequelize[_0xf58e('0x4')]},'authId':{'type':Sequelize[_0xf58e('0x4')]},'authToken':{'type':Sequelize[_0xf58e('0x4')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xf58e('0x4')]},'password':{'type':Sequelize[_0xf58e('0x4')]},'apiKey':{'type':Sequelize[_0xf58e('0x4')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xf58e('0x4')]},'senderString':{'type':Sequelize[_0xf58e('0x4')]},'deliveryReport':{'type':Sequelize[_0xf58e('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf58e('0xf');}},'notificationSound':{'type':Sequelize[_0xf58e('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf58e('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf58e('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf58e('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf58e('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf58e('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf58e('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf58e('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xf58e('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf58e('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf58e('0xe')],'defaultValue':![],'comment':_0xf58e('0x11'),'set':function(_0xf15e47){if(!_0xf15e47)this['setDataValue'](_0xf58e('0x12'),null);this[_0xf58e('0x13')](_0xf58e('0x14'),_0xf15e47);}}}; \ No newline at end of file +var _0x7f82=['csc','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','sequelize','randomstring','exports','STRING','name','ENUM','twilio','skebby','connectel','plivo'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0x7f82,0xc7));var _0x27f8=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x7f82[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0x27f8('0x0'));var rs=require(_0x27f8('0x1'));module[_0x27f8('0x2')]={'name':{'type':Sequelize[_0x27f8('0x3')],'unique':_0x27f8('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x27f8('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x27f8('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x27f8('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x27f8('0x3')]},'type':{'type':Sequelize[_0x27f8('0x5')](_0x27f8('0x6'),_0x27f8('0x7'),_0x27f8('0x8'),'clicksend',_0x27f8('0x9'),'clickatell','bandwidth',_0x27f8('0xa'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x27f8('0x3')]},'authId':{'type':Sequelize[_0x27f8('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x27f8('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x27f8('0x3')]},'password':{'type':Sequelize[_0x27f8('0x3')]},'apiKey':{'type':Sequelize[_0x27f8('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x27f8('0x3')]},'senderString':{'type':Sequelize[_0x27f8('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x27f8('0x3')]},'notificationTemplate':{'type':Sequelize[_0x27f8('0xb')],'defaultValue':function(){return _0x27f8('0xc');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x27f8('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x27f8('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x27f8('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x27f8('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x27f8('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x27f8('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x27f8('0x10'),'set':function(_0x4aaf86){if(!_0x4aaf86)this[_0x27f8('0x11')](_0x27f8('0x12'),null);this[_0x27f8('0x11')]('mandatoryDisposition',_0x4aaf86);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 503830f..e1f72b0 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 _0x3e9f=['message_id','groupName','clickatell','bandwidth','redif','error_code','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','statusGet','message-id','state','addAgents','emit','isArray','userSmsAccount:remove','getAgents','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','addDisposition','SmsAccountId','findOne','Disposition','pick','options','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','SmsApplication','account','applications','orderBy','Applications','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','From','Body','MessageSid','skebby','from','sender','text','messageId','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','defaults','mapKey','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','waitForTheAssignedQueue','startRouting','entity\x20found','stringify','twilio','set','Content-Type','text/xml','addApplications','sequelize','Transaction','ISOLATION_LEVELS','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','User','Owner','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','List','out','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','connectel','statusInt','requestid','clicksend'];(function(_0xa4f636,_0xaca1b6){var _0x37e02a=function(_0x49bd47){while(--_0x49bd47){_0xa4f636['push'](_0xa4f636['shift']());}};_0x37e02a(++_0xaca1b6);}(_0x3e9f,0x1d9));var _0xf3e9=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x3e9f[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0xf3e9('0x0'));var rimraf=require(_0xf3e9('0x1'));var zipdir=require(_0xf3e9('0x2'));var jsonpatch=require(_0xf3e9('0x3'));var rp=require(_0xf3e9('0x4'));var moment=require('moment');var BPromise=require(_0xf3e9('0x5'));var Mustache=require('mustache');var util=require(_0xf3e9('0x6'));var path=require(_0xf3e9('0x7'));var sox=require(_0xf3e9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf3e9('0x9'));var squel=require(_0xf3e9('0xa'));var crypto=require(_0xf3e9('0xb'));var jsforce=require(_0xf3e9('0xc'));var deskjs=require(_0xf3e9('0xd'));var toCsv=require(_0xf3e9('0xe'));var querystring=require(_0xf3e9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf3e9('0x10'));var as=require(_0xf3e9('0x11'));var hardwareService=require(_0xf3e9('0x12'));var logger=require('../../config/logger')(_0xf3e9('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf3e9('0x14'));var db=require(_0xf3e9('0x15'))['db'];config[_0xf3e9('0x16')]=_['defaults'](config[_0xf3e9('0x16')],{'host':_0xf3e9('0x17'),'port':0x18eb});var socket=require(_0xf3e9('0x18'))(new Redis(config[_0xf3e9('0x16')]));require(_0xf3e9('0x19'))[_0xf3e9('0x1a')](socket);var jayson=require(_0xf3e9('0x1b'));var client=jayson[_0xf3e9('0x1c')]['http']({'port':0x232c});function respondWithRpcPromise(_0x9e0414,_0x4ca718,_0x38a952,_0x2412ba){return new BPromise(function(_0x450bb,_0xb74cc5){var _0x204a18=_0x2412ba||client;return _0x204a18[_0xf3e9('0x1d')](_0x9e0414,_0x38a952)[_0xf3e9('0x1e')](function(_0x3638a6){logger['info'](_0xf3e9('0x1f'),_0x4ca718,_0xf3e9('0x20'));logger[_0xf3e9('0x21')](_0xf3e9('0x22'),_0x4ca718,_0xf3e9('0x20'),JSON['stringify'](_0x3638a6));if(_0x3638a6[_0xf3e9('0x23')]){if(_0x3638a6[_0xf3e9('0x23')]['code']===0x1f4){logger[_0xf3e9('0x23')](_0xf3e9('0x1f'),_0x4ca718,_0x3638a6[_0xf3e9('0x23')]['message']);return _0xb74cc5(_0x3638a6[_0xf3e9('0x23')]['message']);}logger[_0xf3e9('0x23')]('SmsAccount,\x20%s,\x20%s',_0x4ca718,_0x3638a6[_0xf3e9('0x23')]['message']);return _0x450bb(_0x3638a6[_0xf3e9('0x23')][_0xf3e9('0x24')]);}else{logger[_0xf3e9('0x25')](_0xf3e9('0x1f'),_0x4ca718,_0xf3e9('0x20'));_0x450bb(_0x3638a6[_0xf3e9('0x26')]['message']);}})['catch'](function(_0x12464f){logger[_0xf3e9('0x23')](_0xf3e9('0x1f'),_0x4ca718,_0x12464f);_0xb74cc5(_0x12464f);});});}function respondWithStatusCode(_0x567304,_0x999b06){_0x999b06=_0x999b06||0xcc;return function(_0x4488c9){if(_0x4488c9){return _0x567304[_0xf3e9('0x27')](_0x999b06);}return _0x567304[_0xf3e9('0x28')](_0x999b06)[_0xf3e9('0x29')]();};}function respondWithResult(_0x58d45d,_0x36fb07){_0x36fb07=_0x36fb07||0xc8;return function(_0xd3176f){if(_0xd3176f){return _0x58d45d[_0xf3e9('0x28')](_0x36fb07)[_0xf3e9('0x2a')](_0xd3176f);}};}function respondWithFilteredResult(_0x324efd,_0x4d2e2f){return function(_0x2a6838){if(_0x2a6838){var _0x20fbf8=typeof _0x4d2e2f['offset']===_0xf3e9('0x2b')&&typeof _0x4d2e2f[_0xf3e9('0x2c')]==='undefined';var _0x18754f=_0x2a6838[_0xf3e9('0x2d')];var _0x47a83e=_0x20fbf8?0x0:_0x4d2e2f[_0xf3e9('0x2e')];var _0x1da5ca=_0x20fbf8?_0x2a6838[_0xf3e9('0x2d')]:_0x4d2e2f['offset']+_0x4d2e2f['limit'];var _0x1dec48;if(_0x1da5ca>=_0x18754f){_0x1da5ca=_0x18754f;_0x1dec48=0xc8;}else{_0x1dec48=0xce;}_0x324efd[_0xf3e9('0x28')](_0x1dec48);return _0x324efd['set'](_0xf3e9('0x2f'),_0x47a83e+'-'+_0x1da5ca+'/'+_0x18754f)[_0xf3e9('0x2a')](_0x2a6838);}return null;};}function patchUpdates(_0xa8ad25){return function(_0x26ef6b){try{jsonpatch[_0xf3e9('0x30')](_0x26ef6b,_0xa8ad25,!![]);}catch(_0x23fa6d){return BPromise[_0xf3e9('0x31')](_0x23fa6d);}return _0x26ef6b[_0xf3e9('0x32')]();};}function saveUpdates(_0x21a323,_0x58fdda){return function(_0x31cb59){if(_0x31cb59){return _0x31cb59[_0xf3e9('0x33')](_0x21a323)[_0xf3e9('0x1e')](function(_0x4310a9){return _0x4310a9;});}return null;};}function removeEntity(_0x53dc2c,_0x3f6973){return function(_0x5e8416){if(_0x5e8416){return _0x5e8416[_0xf3e9('0x34')]()['then'](function(){var _0x4a7c95=_0x5e8416[_0xf3e9('0x35')]({'plain':!![]});var _0x24eab8=_0xf3e9('0x36');return db['UserProfileResource'][_0xf3e9('0x34')]({'where':{'type':_0x24eab8,'resourceId':_0x4a7c95['id']}})[_0xf3e9('0x1e')](function(){return _0x5e8416;});})['then'](function(){_0x53dc2c['status'](0xcc)[_0xf3e9('0x29')]();});}};}function handleEntityNotFound(_0x20e564,_0x55ed1a){return function(_0x481c42){if(!_0x481c42){_0x20e564[_0xf3e9('0x27')](0x194);}return _0x481c42;};}function handleError(_0x1ec34d,_0x402e1b){_0x402e1b=_0x402e1b||0x1f4;return function(_0x1763cb){logger['error'](_0x1763cb[_0xf3e9('0x37')]);if(_0x1763cb[_0xf3e9('0x38')]){delete _0x1763cb[_0xf3e9('0x38')];}_0x1ec34d['status'](_0x402e1b)[_0xf3e9('0x39')](_0x1763cb);};}exports[_0xf3e9('0x3a')]=function(_0x4e700f,_0x2c1323){var _0xc791e6={'include':[{'model':db[_0xf3e9('0x3b')],'as':_0xf3e9('0x3c')}]},_0x48ea31={},_0x167e65={'count':0x0,'rows':[]};var _0x14aacf=_[_0xf3e9('0x3d')](db[_0xf3e9('0x3e')][_0xf3e9('0x3f')],function(_0x385550){return{'name':_0x385550['fieldName'],'type':_0x385550[_0xf3e9('0x40')][_0xf3e9('0x41')]};});_0x48ea31['model']=_[_0xf3e9('0x3d')](_0x14aacf,'name');_0x48ea31[_0xf3e9('0x42')]=_[_0xf3e9('0x43')](_0x4e700f[_0xf3e9('0x42')]);_0x48ea31[_0xf3e9('0x44')]=_[_0xf3e9('0x45')](_0x48ea31[_0xf3e9('0x46')],_0x48ea31[_0xf3e9('0x42')]);_0xc791e6['attributes']=_[_0xf3e9('0x45')](_0x48ea31[_0xf3e9('0x46')],qs[_0xf3e9('0x47')](_0x4e700f[_0xf3e9('0x42')][_0xf3e9('0x47')]));_0xc791e6[_0xf3e9('0x48')]=_0xc791e6['attributes'][_0xf3e9('0x49')]?_0xc791e6[_0xf3e9('0x48')]:_0x48ea31['model'];if(!_0x4e700f[_0xf3e9('0x42')][_0xf3e9('0x4a')](_0xf3e9('0x4b'))){_0xc791e6[_0xf3e9('0x2c')]=qs[_0xf3e9('0x2c')](_0x4e700f['query'][_0xf3e9('0x2c')]);_0xc791e6[_0xf3e9('0x2e')]=qs['offset'](_0x4e700f[_0xf3e9('0x42')][_0xf3e9('0x2e')]);}_0xc791e6['order']=qs['sort'](_0x4e700f[_0xf3e9('0x42')][_0xf3e9('0x4c')]);_0xc791e6[_0xf3e9('0x4d')]=qs['filters'](_['pick'](_0x4e700f['query'],_0x48ea31['filters']),_0x14aacf);if(_0x4e700f[_0xf3e9('0x42')][_0xf3e9('0x4e')]){_0xc791e6[_0xf3e9('0x4d')]=_['merge'](_0xc791e6[_0xf3e9('0x4d')],{'$or':_[_0xf3e9('0x3d')](_0x14aacf,function(_0x1f7df5){if(_0x1f7df5[_0xf3e9('0x40')]!==_0xf3e9('0x4f')){var _0xce4b8c={};_0xce4b8c[_0x1f7df5[_0xf3e9('0x38')]]={'$like':'%'+_0x4e700f['query'][_0xf3e9('0x4e')]+'%'};return _0xce4b8c;}})});}_0xc791e6=_[_0xf3e9('0x50')]({},_0xc791e6,_0x4e700f['options']);var _0x16b1b3={'where':_0xc791e6[_0xf3e9('0x4d')]};return db['SmsAccount'][_0xf3e9('0x2d')](_0x16b1b3)[_0xf3e9('0x1e')](function(_0x2c747b){_0x167e65['count']=_0x2c747b;if(_0x4e700f[_0xf3e9('0x42')]['includeAll']){_0xc791e6[_0xf3e9('0x51')]=[{'all':!![]}];}return db['SmsAccount'][_0xf3e9('0x52')](_0xc791e6);})[_0xf3e9('0x1e')](function(_0x18a069){_0x167e65[_0xf3e9('0x53')]=_0x18a069;return _0x167e65;})[_0xf3e9('0x1e')](respondWithFilteredResult(_0x2c1323,_0xc791e6))[_0xf3e9('0x54')](handleError(_0x2c1323,null));};exports[_0xf3e9('0x55')]=function(_0x2eebe0,_0x2d51fc){var _0x12d5f8={'raw':![],'where':{'id':_0x2eebe0[_0xf3e9('0x56')]['id']},'include':[{'model':db[_0xf3e9('0x3b')],'as':_0xf3e9('0x3c')}]},_0x1b807e={};_0x1b807e[_0xf3e9('0x46')]=_[_0xf3e9('0x43')](db['SmsAccount']['rawAttributes']);_0x1b807e[_0xf3e9('0x42')]=_[_0xf3e9('0x43')](_0x2eebe0['query']);_0x1b807e['filters']=_[_0xf3e9('0x45')](_0x1b807e[_0xf3e9('0x46')],_0x1b807e['query']);_0x12d5f8[_0xf3e9('0x48')]=_[_0xf3e9('0x45')](_0x1b807e[_0xf3e9('0x46')],qs['fields'](_0x2eebe0[_0xf3e9('0x42')][_0xf3e9('0x47')]));_0x12d5f8[_0xf3e9('0x48')]=_0x12d5f8[_0xf3e9('0x48')][_0xf3e9('0x49')]?_0x12d5f8[_0xf3e9('0x48')]:_0x1b807e[_0xf3e9('0x46')];if(_0x2eebe0[_0xf3e9('0x42')][_0xf3e9('0x57')]){_0x12d5f8[_0xf3e9('0x51')]=[{'all':!![]}];}_0x12d5f8=_['merge']({},_0x12d5f8,_0x2eebe0['options']);return db['SmsAccount'][_0xf3e9('0x58')](_0x12d5f8)['then'](handleEntityNotFound(_0x2d51fc,null))['then'](respondWithResult(_0x2d51fc,null))[_0xf3e9('0x54')](handleError(_0x2d51fc,null));};exports[_0xf3e9('0x59')]=function(_0x15b647,_0x12e2cf){return db[_0xf3e9('0x3e')]['create'](_0x15b647[_0xf3e9('0x5a')],{})['then'](function(_0xe7c57f){var _0x165101=_0x15b647[_0xf3e9('0x5b')][_0xf3e9('0x35')]({'plain':!![]});if(!_0x165101)throw new Error(_0xf3e9('0x5c'));if(_0x165101[_0xf3e9('0x5d')]===_0xf3e9('0x5b')){var _0x542310=_0xe7c57f[_0xf3e9('0x35')]({'plain':!![]});var _0x592183=_0xf3e9('0x36');return db[_0xf3e9('0x5e')]['find']({'where':{'name':_0x592183,'userProfileId':_0x165101[_0xf3e9('0x5f')]},'raw':!![]})[_0xf3e9('0x1e')](function(_0x148456){if(_0x148456&&_0x148456[_0xf3e9('0x60')]===0x0){return db[_0xf3e9('0x61')][_0xf3e9('0x59')]({'name':_0x542310[_0xf3e9('0x38')],'resourceId':_0x542310['id'],'type':_0x148456['name'],'sectionId':_0x148456['id']},{})['then'](function(){return _0xe7c57f;});}else{return _0xe7c57f;}})[_0xf3e9('0x54')](function(_0x27e8d9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27e8d9);throw _0x27e8d9;});}return _0xe7c57f;})[_0xf3e9('0x1e')](respondWithResult(_0x12e2cf,0xc9))[_0xf3e9('0x54')](handleError(_0x12e2cf,null));};exports[_0xf3e9('0x33')]=function(_0x25deb3,_0x4a6d55){if(_0x25deb3['body']['id']){delete _0x25deb3[_0xf3e9('0x5a')]['id'];}return db[_0xf3e9('0x3e')][_0xf3e9('0x58')]({'where':{'id':_0x25deb3[_0xf3e9('0x56')]['id']},'include':[{'model':db[_0xf3e9('0x3b')],'as':_0xf3e9('0x3c')}]})[_0xf3e9('0x1e')](handleEntityNotFound(_0x4a6d55,null))[_0xf3e9('0x1e')](saveUpdates(_0x25deb3[_0xf3e9('0x5a')],null))[_0xf3e9('0x1e')](respondWithResult(_0x4a6d55,null))[_0xf3e9('0x54')](handleError(_0x4a6d55,null));};exports['destroy']=function(_0x23a9e2,_0x241a36){return db[_0xf3e9('0x3e')][_0xf3e9('0x58')]({'where':{'id':_0x23a9e2['params']['id']}})[_0xf3e9('0x1e')](handleEntityNotFound(_0x241a36,null))[_0xf3e9('0x1e')](removeEntity(_0x241a36,null))[_0xf3e9('0x54')](handleError(_0x241a36,null));};exports['describe']=function(_0x3bf141,_0xc376bf){return db[_0xf3e9('0x3e')]['describe']()[_0xf3e9('0x1e')](respondWithResult(_0xc376bf,null))[_0xf3e9('0x54')](handleError(_0xc376bf,null));};exports[_0xf3e9('0x62')]=function(_0x38e5eb,_0x1aadb7,_0x12a679){if(_0x38e5eb[_0xf3e9('0x5a')]['id']){delete _0x38e5eb['body']['id'];}return db[_0xf3e9('0x3e')][_0xf3e9('0x58')]({'where':{'id':_0x38e5eb[_0xf3e9('0x56')]['id']}})[_0xf3e9('0x1e')](handleEntityNotFound(_0x1aadb7,null))['then'](function(_0x27f532){if(_0x27f532){_0x38e5eb[_0xf3e9('0x5a')][_0xf3e9('0x63')]=_0x27f532['id'];return db['Disposition'][_0xf3e9('0x59')](_0x38e5eb[_0xf3e9('0x5a')]);}})[_0xf3e9('0x1e')](respondWithResult(_0x1aadb7,null))[_0xf3e9('0x54')](handleError(_0x1aadb7,null));};exports['getDispositions']=function(_0x3577ad,_0x12ff41,_0x42671b){var _0x4a06b8={'raw':![],'where':{}};var _0x5286e0={};var _0x20294a={'count':0x0,'rows':[]};return db['SmsAccount'][_0xf3e9('0x64')]({'where':{'id':_0x3577ad[_0xf3e9('0x56')]['id']}})[_0xf3e9('0x1e')](handleEntityNotFound(_0x12ff41,null))['then'](function(_0x1239a5){if(_0x1239a5){_0x5286e0[_0xf3e9('0x46')]=_[_0xf3e9('0x43')](db[_0xf3e9('0x65')]['rawAttributes']);_0x5286e0[_0xf3e9('0x42')]=_['keys'](_0x3577ad[_0xf3e9('0x42')]);_0x5286e0[_0xf3e9('0x44')]=_[_0xf3e9('0x45')](_0x5286e0[_0xf3e9('0x46')],_0x5286e0[_0xf3e9('0x42')]);_0x4a06b8[_0xf3e9('0x48')]=_[_0xf3e9('0x45')](_0x5286e0[_0xf3e9('0x46')],qs[_0xf3e9('0x47')](_0x3577ad[_0xf3e9('0x42')][_0xf3e9('0x47')]));_0x4a06b8['attributes']=_0x4a06b8[_0xf3e9('0x48')][_0xf3e9('0x49')]?_0x4a06b8['attributes']:_0x5286e0[_0xf3e9('0x46')];if(!_0x3577ad[_0xf3e9('0x42')]['hasOwnProperty']('nolimit')){_0x4a06b8[_0xf3e9('0x2c')]=qs[_0xf3e9('0x2c')](_0x3577ad[_0xf3e9('0x42')][_0xf3e9('0x2c')]);_0x4a06b8[_0xf3e9('0x2e')]=qs[_0xf3e9('0x2e')](_0x3577ad[_0xf3e9('0x42')][_0xf3e9('0x2e')]);}_0x4a06b8['order']=qs['sort'](_0x3577ad['query'][_0xf3e9('0x4c')]);_0x4a06b8[_0xf3e9('0x4d')]=qs['filters'](_[_0xf3e9('0x66')](_0x3577ad['query'],_0x5286e0['filters']));_0x4a06b8['where'][_0xf3e9('0x63')]=_0x1239a5['id'];if(_0x3577ad['query'][_0xf3e9('0x4e')]){_0x4a06b8[_0xf3e9('0x4d')]=_[_0xf3e9('0x50')](_0x4a06b8[_0xf3e9('0x4d')],{'$or':_[_0xf3e9('0x3d')](_0x4a06b8[_0xf3e9('0x48')],function(_0x55d2fb){var _0x137b75={};_0x137b75[_0x55d2fb]={'$like':'%'+_0x3577ad[_0xf3e9('0x42')][_0xf3e9('0x4e')]+'%'};return _0x137b75;})});}_0x4a06b8=_['merge']({},_0x4a06b8,_0x3577ad[_0xf3e9('0x67')]);return db[_0xf3e9('0x65')][_0xf3e9('0x2d')]({'where':_0x4a06b8['where']})[_0xf3e9('0x1e')](function(_0x18f571){_0x20294a[_0xf3e9('0x2d')]=_0x18f571;if(_0x3577ad[_0xf3e9('0x42')][_0xf3e9('0x57')]){_0x4a06b8[_0xf3e9('0x51')]=[{'all':!![]}];}return db[_0xf3e9('0x65')]['findAll'](_0x4a06b8);})[_0xf3e9('0x1e')](function(_0x47d21d){_0x20294a[_0xf3e9('0x53')]=_0x47d21d;return _0x20294a;});}})[_0xf3e9('0x1e')](respondWithFilteredResult(_0x12ff41,_0x4a06b8))[_0xf3e9('0x54')](handleError(_0x12ff41,null));};exports[_0xf3e9('0x68')]=function(_0x4a4743,_0x544f95,_0x184eb6){return db[_0xf3e9('0x3e')][_0xf3e9('0x58')]({'where':{'id':_0x4a4743[_0xf3e9('0x56')]['id']}})[_0xf3e9('0x1e')](handleEntityNotFound(_0x544f95,null))[_0xf3e9('0x1e')](function(_0x46148a){if(_0x46148a){return _0x46148a[_0xf3e9('0x68')](_0x4a4743[_0xf3e9('0x42')][_0xf3e9('0x69')]);}})['then'](respondWithStatusCode(_0x544f95,null))[_0xf3e9('0x54')](handleError(_0x544f95,null));};exports['addAnswer']=function(_0x54c347,_0x4cc191,_0x2fa503){if(_0x54c347[_0xf3e9('0x5a')]['id']){delete _0x54c347[_0xf3e9('0x5a')]['id'];}return db['SmsAccount'][_0xf3e9('0x58')]({'where':{'id':_0x54c347['params']['id']}})[_0xf3e9('0x1e')](handleEntityNotFound(_0x4cc191,null))[_0xf3e9('0x1e')](function(_0xe1fafa){if(_0xe1fafa){_0x54c347[_0xf3e9('0x5a')]['SmsAccountId']=_0xe1fafa['id'];return db['CannedAnswer'][_0xf3e9('0x59')](_0x54c347[_0xf3e9('0x5a')]);}})['then'](respondWithResult(_0x4cc191,null))[_0xf3e9('0x54')](handleError(_0x4cc191,null));};exports[_0xf3e9('0x6a')]=function(_0x10d05b,_0x2a6c43,_0x509548){var _0x2a1c42={'raw':![],'where':{}};var _0x59a1fa={};var _0x328f09={'count':0x0,'rows':[]};return db[_0xf3e9('0x3e')]['findOne']({'where':{'id':_0x10d05b['params']['id']}})[_0xf3e9('0x1e')](handleEntityNotFound(_0x2a6c43,null))[_0xf3e9('0x1e')](function(_0x2bbd58){if(_0x2bbd58){_0x59a1fa[_0xf3e9('0x46')]=_[_0xf3e9('0x43')](db[_0xf3e9('0x6b')]['rawAttributes']);_0x59a1fa[_0xf3e9('0x42')]=_[_0xf3e9('0x43')](_0x10d05b[_0xf3e9('0x42')]);_0x59a1fa[_0xf3e9('0x44')]=_[_0xf3e9('0x45')](_0x59a1fa[_0xf3e9('0x46')],_0x59a1fa['query']);_0x2a1c42[_0xf3e9('0x48')]=_[_0xf3e9('0x45')](_0x59a1fa[_0xf3e9('0x46')],qs['fields'](_0x10d05b['query'][_0xf3e9('0x47')]));_0x2a1c42[_0xf3e9('0x48')]=_0x2a1c42[_0xf3e9('0x48')][_0xf3e9('0x49')]?_0x2a1c42[_0xf3e9('0x48')]:_0x59a1fa[_0xf3e9('0x46')];if(!_0x10d05b[_0xf3e9('0x42')]['hasOwnProperty'](_0xf3e9('0x4b'))){_0x2a1c42[_0xf3e9('0x2c')]=qs[_0xf3e9('0x2c')](_0x10d05b[_0xf3e9('0x42')][_0xf3e9('0x2c')]);_0x2a1c42[_0xf3e9('0x2e')]=qs[_0xf3e9('0x2e')](_0x10d05b[_0xf3e9('0x42')]['offset']);}_0x2a1c42['order']=qs[_0xf3e9('0x4c')](_0x10d05b[_0xf3e9('0x42')][_0xf3e9('0x4c')]);_0x2a1c42[_0xf3e9('0x4d')]=qs[_0xf3e9('0x44')](_['pick'](_0x10d05b[_0xf3e9('0x42')],_0x59a1fa[_0xf3e9('0x44')]));_0x2a1c42['where'][_0xf3e9('0x63')]=_0x2bbd58['id'];if(_0x10d05b['query'][_0xf3e9('0x4e')]){_0x2a1c42[_0xf3e9('0x4d')]=_[_0xf3e9('0x50')](_0x2a1c42[_0xf3e9('0x4d')],{'$or':_[_0xf3e9('0x3d')](_0x2a1c42[_0xf3e9('0x48')],function(_0x3ea064){var _0x1abcd8={};_0x1abcd8[_0x3ea064]={'$like':'%'+_0x10d05b[_0xf3e9('0x42')][_0xf3e9('0x4e')]+'%'};return _0x1abcd8;})});}_0x2a1c42=_[_0xf3e9('0x50')]({},_0x2a1c42,_0x10d05b[_0xf3e9('0x67')]);return db[_0xf3e9('0x6b')][_0xf3e9('0x2d')]({'where':_0x2a1c42[_0xf3e9('0x4d')]})[_0xf3e9('0x1e')](function(_0x108680){_0x328f09['count']=_0x108680;if(_0x10d05b[_0xf3e9('0x42')][_0xf3e9('0x57')]){_0x2a1c42[_0xf3e9('0x51')]=[{'all':!![]}];}return db[_0xf3e9('0x6b')][_0xf3e9('0x52')](_0x2a1c42);})[_0xf3e9('0x1e')](function(_0xb8cb92){_0x328f09[_0xf3e9('0x53')]=_0xb8cb92;return _0x328f09;});}})[_0xf3e9('0x1e')](respondWithFilteredResult(_0x2a6c43,_0x2a1c42))[_0xf3e9('0x54')](handleError(_0x2a6c43,null));};exports[_0xf3e9('0x6c')]=function(_0x1c19ab,_0x25e701,_0x33bf64){return db['SmsAccount']['find']({'where':{'id':_0x1c19ab[_0xf3e9('0x56')]['id']}})[_0xf3e9('0x1e')](handleEntityNotFound(_0x25e701,null))[_0xf3e9('0x1e')](function(_0x228042){if(_0x228042){return _0x228042[_0xf3e9('0x6c')](_0x1c19ab['query']['ids']);}})['then'](respondWithStatusCode(_0x25e701,null))[_0xf3e9('0x54')](handleError(_0x25e701,null));};exports['notify']=function(_0x370839,_0x269a48,_0x35ac7a){var _0x2dce4a={'channel':'sms'};var _0x6eaecc=[];var _0x16dd68=[];var _0xac133f={};return db['SmsAccount'][_0xf3e9('0x58')]({'where':{'id':_0x370839[_0xf3e9('0x56')]['id']},'include':[{'model':db[_0xf3e9('0x6d')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x269a48,null))[_0xf3e9('0x1e')](function(_0x4495fa){_0x2dce4a[_0xf3e9('0x6e')]=_0x4495fa;_0x2dce4a[_0xf3e9('0x6f')]=_[_0xf3e9('0x70')](_0x4495fa[_0xf3e9('0x71')],['priority'],[_0xf3e9('0x72')]);if(_0x2dce4a[_0xf3e9('0x6e')]['Applications']){delete _0x2dce4a['account'][_0xf3e9('0x71')];}return db[_0xf3e9('0x73')]['describe']();})[_0xf3e9('0x1e')](function(_0x14019d){if(!_0x14019d){throw new db[(_0xf3e9('0x74'))][(_0xf3e9('0x75'))]('no\x20available\x20attributes');}_0x6eaecc=_[_0xf3e9('0x76')](_[_0xf3e9('0x43')](_0x14019d),[_0xf3e9('0x77'),_0xf3e9('0x78')]);_0x16dd68=_[_0xf3e9('0x76')](_[_0xf3e9('0x43')](_0x14019d),['createdAt',_0xf3e9('0x78'),'CompanyId',_0xf3e9('0x79')]);_0x2dce4a[_0xf3e9('0x5a')]={'mapKey':'mobile'};if(_0x2dce4a['account'][_0xf3e9('0x40')]){switch(_0x2dce4a[_0xf3e9('0x6e')][_0xf3e9('0x40')]){case'twilio':_0x2dce4a[_0xf3e9('0x5a')]['from']=_0x370839[_0xf3e9('0x5a')][_0xf3e9('0x7a')];_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0x5a')]=_0x370839[_0xf3e9('0x5a')][_0xf3e9('0x7b')];_0x2dce4a[_0xf3e9('0x5a')]['messageId']=_0x370839[_0xf3e9('0x5a')][_0xf3e9('0x7c')];break;case _0xf3e9('0x7d'):_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0x7e')]='+'+_0x370839['body'][_0xf3e9('0x7f')];_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0x5a')]=_0x370839[_0xf3e9('0x5a')][_0xf3e9('0x80')];break;case'connectel':_0x2dce4a[_0xf3e9('0x5a')]['from']=_0x370839[_0xf3e9('0x5a')]['from'];_0x2dce4a[_0xf3e9('0x5a')]['body']=_0x370839['body']['message'];break;case'clicksend':_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0x7e')]=_0x370839[_0xf3e9('0x5a')]['from'];_0x2dce4a[_0xf3e9('0x5a')]['body']=_0x370839['body'][_0xf3e9('0x5a')];_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0x81')]=_0x370839[_0xf3e9('0x5a')]['message_id'];break;case _0xf3e9('0x82'):_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0x7e')]=_0x370839['body']['From'];_0x2dce4a[_0xf3e9('0x5a')]['body']=_0x370839[_0xf3e9('0x5a')][_0xf3e9('0x83')];_0x2dce4a['body'][_0xf3e9('0x81')]=_0x370839['body'][_0xf3e9('0x84')];break;case _0xf3e9('0x85'):_0x2dce4a[_0xf3e9('0x5a')]['from']='+'+_0x370839[_0xf3e9('0x5a')][_0xf3e9('0x86')][0x0][_0xf3e9('0x7e')];_0x2dce4a['body'][_0xf3e9('0x5a')]=_0x370839[_0xf3e9('0x5a')][_0xf3e9('0x86')][0x0][_0xf3e9('0x80')];_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0x81')]=_0x370839[_0xf3e9('0x5a')][_0xf3e9('0x86')][0x0]['messageId'];break;case _0xf3e9('0x87'):_0x2dce4a['body'][_0xf3e9('0x7e')]=_0x370839['body'][_0xf3e9('0x88')];_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0x5a')]=_0x370839[_0xf3e9('0x5a')]['segmentedMessage']['message'];break;case'clickatell':_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0x7e')]=_0x370839[_0xf3e9('0x5a')]['fromNumber'];_0x2dce4a[_0xf3e9('0x5a')]['body']=_0x370839['body'][_0xf3e9('0x80')];_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0x81')]=_0x370839[_0xf3e9('0x5a')][_0xf3e9('0x89')];break;case'bandwidth':_0x2dce4a['body'][_0xf3e9('0x81')]=_0x370839[_0xf3e9('0x5a')][0x0][_0xf3e9('0x24')]['id'];_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0x7e')]=_0x370839[_0xf3e9('0x5a')][0x0][_0xf3e9('0x24')][_0xf3e9('0x7e')];_0x2dce4a['body']['body']=_0x370839[_0xf3e9('0x5a')][0x0][_0xf3e9('0x24')][_0xf3e9('0x80')];break;case _0xf3e9('0x8a'):_0x2dce4a['body'][_0xf3e9('0x7e')]=_0x370839[_0xf3e9('0x5a')]['from'];_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0x5a')]=_0x370839[_0xf3e9('0x5a')][_0xf3e9('0x24')];_0x2dce4a['body'][_0xf3e9('0x81')]=_0x370839[_0xf3e9('0x5a')][_0xf3e9('0x8b')];break;}}if(_0x2dce4a[_0xf3e9('0x5a')]['id']){delete _0x2dce4a[_0xf3e9('0x5a')]['id'];}if(_[_0xf3e9('0x8c')](_0x2dce4a[_0xf3e9('0x5a')]['from'])){throw new db[(_0xf3e9('0x74'))][(_0xf3e9('0x75'))](_0xf3e9('0x8d'));}if(_['isNil'](_0x2dce4a['body']['body'])||_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0x5a')]===''){throw new db['Sequelize']['ValidationError'](_0xf3e9('0x8e'));}if(_[_0xf3e9('0x8c')](_0x2dce4a[_0xf3e9('0x5a')]['mapKey'])){throw new db[(_0xf3e9('0x74'))][(_0xf3e9('0x75'))](_0xf3e9('0x8f')+_0x16dd68);}if(!_[_0xf3e9('0x90')](_0x16dd68,_0x2dce4a[_0xf3e9('0x5a')]['mapKey'])){throw new db['Sequelize'][(_0xf3e9('0x75'))](_0xf3e9('0x91')+_0x16dd68);}_0xac133f[_0x2dce4a['body']['mapKey']]=_0x2dce4a['body'][_0xf3e9('0x7e')];return db['CmList'][_0xf3e9('0x58')]({'where':{'id':_0x2dce4a['account'][_0xf3e9('0x79')]},'include':[{'model':db[_0xf3e9('0x73')],'as':_0xf3e9('0x92'),'where':_0xac133f,'limit':0x1,'order':[[_0xf3e9('0x78'),_0xf3e9('0x93')]]}]});})['then'](handleEntityNotFound(_0x269a48,null))[_0xf3e9('0x1e')](function(_0x5aa78c){if(_0x5aa78c){_0x2dce4a[_0xf3e9('0x94')]=_[_0xf3e9('0x95')](_0x5aa78c,['Contacts']);if(_0x5aa78c[_0xf3e9('0x92')][_0xf3e9('0x49')]){return _0x5aa78c['Contacts'][0x0];}var _0x3074e2=_[_0xf3e9('0x96')](_0x2dce4a[_0xf3e9('0x5a')],{'firstName':_0x2dce4a['body'][_0xf3e9('0x7e')],'ListId':_0x5aa78c['id']});_0x3074e2[_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0x97')]]=_0x2dce4a[_0xf3e9('0x5a')]['from'];return db['CmContact'][_0xf3e9('0x59')](_0x3074e2,{'fields':_0x6eaecc,'raw':!![]});}})[_0xf3e9('0x1e')](handleEntityNotFound(_0x269a48,null))[_0xf3e9('0x1e')](function(_0x1fc64a){if(_0x1fc64a){_0x2dce4a[_0xf3e9('0x98')]=_0x1fc64a;var _0x5648fa={'ContactId':_0x1fc64a['id'],'phone':_0x2dce4a[_0xf3e9('0x5a')]['from'],'SmsAccountId':_0x370839[_0xf3e9('0x56')]['id']};var _0x4e0305={'ContactId':_0x1fc64a['id'],'SmsAccountId':_0x370839[_0xf3e9('0x56')]['id'],'closed':![]};return db[_0xf3e9('0x99')][_0xf3e9('0x58')]({'where':_0x4e0305})[_0xf3e9('0x1e')](function(_0x336e60){if(_0x336e60){return[_0x336e60,![]];}return db[_0xf3e9('0x99')][_0xf3e9('0x59')](_0x5648fa)[_0xf3e9('0x1e')](function(_0x599200){return[_0x599200,!![]];});});}})[_0xf3e9('0x9a')](function(_0x1e8792,_0x301ad4){_0x2dce4a['interaction']=_0x1e8792[_0xf3e9('0x35')]({'plain':!![]});_0x2dce4a[_0xf3e9('0x9b')][_0xf3e9('0x9c')]=![];if(_0x301ad4){if(_0x2dce4a['account'][_0xf3e9('0x9d')]){_0x2dce4a['applications'][_0xf3e9('0x9e')]({'id':0x0,'priority':_0x2dce4a[_0xf3e9('0x6f')][_0xf3e9('0x49')]+0x1,'app':_0xf3e9('0x9f'),'appdata':_0xf3e9('0xa0'),'interval':_0xf3e9('0xa1')});}_0x2dce4a[_0xf3e9('0x9b')][_0xf3e9('0x9c')]=!![];}return db[_0xf3e9('0xa2')][_0xf3e9('0x59')]({'phone':_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0x7e')],'messageId':_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0x81')],'body':_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0x5a')],'SmsAccountId':_0x370839['params']['id'],'SmsInteractionId':_0x1e8792['id'],'direction':'in','ContactId':_0x1e8792[_0xf3e9('0xa3')],'AttachmentId':_0x2dce4a[_0xf3e9('0x5a')][_0xf3e9('0xa4')]});})[_0xf3e9('0x1e')](function(_0x8586f5){_0x2dce4a[_0xf3e9('0x24')]=_0x8586f5;if(!_0x2dce4a[_0xf3e9('0x9b')][_0xf3e9('0xa5')])return;return db['User'][_0xf3e9('0x58')]({'attributes':['id',_0xf3e9('0x38')],'where':{'id':_0x2dce4a[_0xf3e9('0x9b')][_0xf3e9('0xa5')]}});})[_0xf3e9('0x1e')](function(_0x91ef39){if(_0x91ef39){_0x2dce4a[_0xf3e9('0x6f')][_0xf3e9('0xa6')]({'id':0x0,'priority':0x0,'app':_0xf3e9('0xa7'),'appdata':_0x91ef39[_0xf3e9('0x38')]+','+(_0x2dce4a[_0xf3e9('0x6e')][_0xf3e9('0xa8')]||0xa),'interval':_0xf3e9('0xa1')});}if(!_0x2dce4a['interaction'][_0xf3e9('0xa9')])return;return db[_0xf3e9('0xaa')][_0xf3e9('0x58')]({'attributes':['id','name'],'where':{'id':_0x2dce4a[_0xf3e9('0x9b')][_0xf3e9('0xa9')]}});})['then'](function(_0x1960a1){if(_0x1960a1){_0x2dce4a[_0xf3e9('0x6f')][_0xf3e9('0xa6')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1960a1['name']+','+(_0x2dce4a[_0xf3e9('0x6e')][_0xf3e9('0xab')]||0x12c),'interval':_0xf3e9('0xa1')});}return respondWithRpcPromise('Start',_0xf3e9('0xac'),_0x2dce4a);})[_0xf3e9('0x1e')](function(_0x395ce3){if(_0x395ce3){var _0x3d3524=0xc8;var _0x5b70e0='receiveMessage';logger[_0xf3e9('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5b70e0,_0x3d3524,_0xf3e9('0xad'));logger[_0xf3e9('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x5b70e0,_0x3d3524,'entity\x20found',JSON[_0xf3e9('0xae')](_0x395ce3));if(_0x2dce4a[_0xf3e9('0x6e')][_0xf3e9('0x40')]===_0xf3e9('0xaf')){return _0x269a48[_0xf3e9('0x28')](_0x3d3524)[_0xf3e9('0xb0')](_0xf3e9('0xb1'),_0xf3e9('0xb2'))[_0xf3e9('0x39')]('\x0a');}else{return _0x269a48['status'](_0x3d3524)[_0xf3e9('0x2a')](_0x395ce3);}}})[_0xf3e9('0x54')](handleError(_0x269a48,null));};exports[_0xf3e9('0xb3')]=function(_0x1df41f,_0x255b60){var _0x1ea87f=_0x1df41f[_0xf3e9('0x56')]['id'];var _0x57205a=_0x1df41f['body'];var _0x4e3ac8=0xc8;var _0x4bc0b7=null;return db[_0xf3e9('0xb4')]['transaction']({'isolationLevel':db[_0xf3e9('0xb4')][_0xf3e9('0xb5')][_0xf3e9('0xb6')]['READ_COMMITTED']},function(_0x24b2cc){return db['SmsAccount'][_0xf3e9('0x64')]({'where':{'id':_0x1ea87f},'transaction':_0x24b2cc})['then'](function(_0x540c32){if(_0x540c32){return db[_0xf3e9('0x6d')][_0xf3e9('0x34')]({'where':{'SmsAccountId':_0x1ea87f},'transaction':_0x24b2cc})['then'](function(){var _0x31d19e=_[_0xf3e9('0x3d')](_0x57205a,function(_0x53179d){_0x53179d[_0xf3e9('0x63')]=_0x1ea87f;return _0x53179d;});return db[_0xf3e9('0x6d')]['bulkCreate'](_0x31d19e,{'transaction':_0x24b2cc});});}else{_0x4e3ac8=0x194;_0x4bc0b7=[];}});})['then'](function(){if(_0x4e3ac8!==0x194){return db[_0xf3e9('0x6d')][_0xf3e9('0xb7')]({'where':{'SmsAccountId':_0x1ea87f},'order':_0xf3e9('0xb8')})[_0xf3e9('0x1e')](function(_0x996c74){_0x4bc0b7=_0x996c74;});}})[_0xf3e9('0x54')](function(_0x3ab6db){_0x4e3ac8=0x1f4;logger['error'](_0x3ab6db[_0xf3e9('0x37')]);if(_0x3ab6db[_0xf3e9('0x38')]){delete _0x3ab6db['name'];}_0x4bc0b7=_0x3ab6db;})[_0xf3e9('0xb9')](function(){if(_0x4bc0b7===null){_0x255b60[_0xf3e9('0x27')](_0x4e3ac8);}else{if(_0x4e3ac8===0x1f4){_0x255b60[_0xf3e9('0x28')](_0x4e3ac8)['send'](_0x4bc0b7);}else{_0x255b60[_0xf3e9('0x28')](_0x4e3ac8)[_0xf3e9('0x2a')](_0x4bc0b7);}}});};exports[_0xf3e9('0xba')]=function(_0x447a6c,_0x5c0f1e,_0x1d4b57){var _0x576094={};var _0x50fa66={};var _0x202839;var _0x1412b1;return db[_0xf3e9('0x3e')]['findOne']({'where':{'id':_0x447a6c[_0xf3e9('0x56')]['id']}})[_0xf3e9('0x1e')](handleEntityNotFound(_0x5c0f1e,null))[_0xf3e9('0x1e')](function(_0x45264b){if(_0x45264b){_0x202839=_0x45264b;_0x50fa66[_0xf3e9('0x46')]=_[_0xf3e9('0x43')](db[_0xf3e9('0x6d')][_0xf3e9('0x3f')]);_0x50fa66[_0xf3e9('0x42')]=_[_0xf3e9('0x43')](_0x447a6c['query']);_0x50fa66[_0xf3e9('0x44')]=_[_0xf3e9('0x45')](_0x50fa66[_0xf3e9('0x46')],_0x50fa66[_0xf3e9('0x42')]);_0x576094[_0xf3e9('0x48')]=_[_0xf3e9('0x45')](_0x50fa66[_0xf3e9('0x46')],qs[_0xf3e9('0x47')](_0x447a6c[_0xf3e9('0x42')][_0xf3e9('0x47')]));_0x576094['attributes']=_0x576094[_0xf3e9('0x48')]['length']?_0x576094[_0xf3e9('0x48')]:_0x50fa66[_0xf3e9('0x46')];_0x576094['order']=qs['sort'](_0x447a6c[_0xf3e9('0x42')]['sort']);_0x576094[_0xf3e9('0x4d')]=qs[_0xf3e9('0x44')](_[_0xf3e9('0x66')](_0x447a6c[_0xf3e9('0x42')],_0x50fa66['filters']));if(_0x447a6c[_0xf3e9('0x42')][_0xf3e9('0x4e')]){_0x576094[_0xf3e9('0x4d')]=_[_0xf3e9('0x50')](_0x576094[_0xf3e9('0x4d')],{'$or':_[_0xf3e9('0x3d')](_0x576094[_0xf3e9('0x48')],function(_0x22cbb2){var _0x410063={};_0x410063[_0x22cbb2]={'$like':'%'+_0x447a6c['query'][_0xf3e9('0x4e')]+'%'};return _0x410063;})});}_0x576094=_[_0xf3e9('0x50')]({},_0x576094,_0x447a6c[_0xf3e9('0x67')]);return _0x202839['getApplications'](_0x576094);}})[_0xf3e9('0x1e')](function(_0x12a41a){if(_0x12a41a){_0x1412b1=_0x12a41a['length'];if(!_0x447a6c[_0xf3e9('0x42')][_0xf3e9('0x4a')](_0xf3e9('0x4b'))){_0x576094[_0xf3e9('0x2c')]=qs[_0xf3e9('0x2c')](_0x447a6c['query'][_0xf3e9('0x2c')]);_0x576094[_0xf3e9('0x2e')]=qs[_0xf3e9('0x2e')](_0x447a6c[_0xf3e9('0x42')][_0xf3e9('0x2e')]);}return _0x202839[_0xf3e9('0xba')](_0x576094);}})[_0xf3e9('0x1e')](function(_0x4df3fb){if(_0x4df3fb){return _0x4df3fb?{'count':_0x1412b1,'rows':_0x4df3fb}:null;}})[_0xf3e9('0x1e')](respondWithResult(_0x5c0f1e,null))[_0xf3e9('0x54')](handleError(_0x5c0f1e,null));};exports[_0xf3e9('0xbb')]=function(_0x4ba968,_0xba3217,_0x4d1e1d){var _0x2ef78b={'raw':![],'where':{}};var _0x229fa4={};var _0xe936f9={'count':0x0,'rows':[]};return db['SmsAccount'][_0xf3e9('0x64')]({'where':{'id':_0x4ba968[_0xf3e9('0x56')]['id']}})['then'](handleEntityNotFound(_0xba3217,null))[_0xf3e9('0x1e')](function(_0x1582e8){if(_0x1582e8){_0x229fa4['model']=_[_0xf3e9('0x43')](db[_0xf3e9('0x99')][_0xf3e9('0x3f')]);_0x229fa4[_0xf3e9('0x42')]=_[_0xf3e9('0x43')](_0x4ba968[_0xf3e9('0x42')]);_0x229fa4[_0xf3e9('0x44')]=_['intersection'](_0x229fa4['model'],_0x229fa4[_0xf3e9('0x42')]);_0x2ef78b['attributes']=_[_0xf3e9('0x45')](_0x229fa4['model'],qs[_0xf3e9('0x47')](_0x4ba968[_0xf3e9('0x42')]['fields']));_0x2ef78b['attributes']=_0x2ef78b['attributes'][_0xf3e9('0x49')]?_0x2ef78b[_0xf3e9('0x48')]:_0x229fa4[_0xf3e9('0x46')];if(!_0x4ba968['query'][_0xf3e9('0x4a')](_0xf3e9('0x4b'))){_0x2ef78b[_0xf3e9('0x2c')]=qs[_0xf3e9('0x2c')](_0x4ba968['query']['limit']);_0x2ef78b[_0xf3e9('0x2e')]=qs['offset'](_0x4ba968['query'][_0xf3e9('0x2e')]);}_0x2ef78b['order']=qs[_0xf3e9('0x4c')](_0x4ba968[_0xf3e9('0x42')][_0xf3e9('0x4c')]);_0x2ef78b[_0xf3e9('0x4d')]=qs[_0xf3e9('0x44')](_[_0xf3e9('0x66')](_0x4ba968[_0xf3e9('0x42')],_0x229fa4['filters']));_0x2ef78b['where'][_0xf3e9('0x63')]=_0x1582e8['id'];if(_0x4ba968[_0xf3e9('0x42')][_0xf3e9('0x4e')]){_0x2ef78b[_0xf3e9('0x4d')]=_['merge'](_0x2ef78b[_0xf3e9('0x4d')],{'$or':_['map'](_0x2ef78b[_0xf3e9('0x48')],function(_0x156b8e){var _0xd80660={};_0xd80660[_0x156b8e]={'$like':'%'+_0x4ba968[_0xf3e9('0x42')][_0xf3e9('0x4e')]+'%'};return _0xd80660;})});}_0x2ef78b=_[_0xf3e9('0x50')]({},_0x2ef78b,_0x4ba968[_0xf3e9('0x67')]);return db[_0xf3e9('0x99')][_0xf3e9('0x2d')]({'where':_0x2ef78b['where']})[_0xf3e9('0x1e')](function(_0x2a763e){_0xe936f9['count']=_0x2a763e;if(_0x4ba968['query']['includeAll']){_0x2ef78b[_0xf3e9('0x51')]=[{'model':db['CmContact'],'as':_0xf3e9('0xbc'),'required':![]},{'model':db[_0xf3e9('0xbd')],'as':_0xf3e9('0xbe'),'attributes':['name','fullname',_0xf3e9('0xbf')],'required':![]},{'model':db[_0xf3e9('0xc0')],'as':_0xf3e9('0xc1'),'attributes':['id',_0xf3e9('0x38'),_0xf3e9('0xc2')],'where':_0x4ba968['query'][_0xf3e9('0xc3')]?{'id':_0x4ba968[_0xf3e9('0x42')][_0xf3e9('0xc3')]}:undefined,'required':_0x4ba968[_0xf3e9('0x42')][_0xf3e9('0xc3')]?!![]:![]}];}return db['SmsInteraction'][_0xf3e9('0x52')](_0x2ef78b);})[_0xf3e9('0x1e')](function(_0x463019){_0xe936f9[_0xf3e9('0x53')]=_0x463019;return _0xe936f9;});}})[_0xf3e9('0x1e')](respondWithFilteredResult(_0xba3217,_0x2ef78b))[_0xf3e9('0x54')](handleError(_0xba3217,null));};exports[_0xf3e9('0x39')]=function(_0x581311,_0x5b25b3,_0x4dccb9){var _0x55c045,_0xc4fd74,_0x5eb0fb;if(_[_0xf3e9('0x8c')](_0x581311['body'][_0xf3e9('0x5a')])||_0x581311['body'][_0xf3e9('0x5a')]===''){throw new db[(_0xf3e9('0x74'))][(_0xf3e9('0x75'))](_0xf3e9('0x8e'));}if(_['isNil'](_0x581311[_0xf3e9('0x5a')]['to'])){throw new db[(_0xf3e9('0x74'))][(_0xf3e9('0x75'))](_0xf3e9('0xc4'));}_0x55c045=_0x581311[_0xf3e9('0x5a')]['to'];return db[_0xf3e9('0x3e')][_0xf3e9('0x58')]({'where':{'id':_0x581311['params']['id']},'include':[{'model':db[_0xf3e9('0xc5')],'as':_0xf3e9('0xc6'),'include':[{'model':db[_0xf3e9('0x73')],'as':_0xf3e9('0x92'),'where':{'mobile':_0x55c045},'limit':0x1,'order':[[_0xf3e9('0x78'),_0xf3e9('0x93')]]}]}]})[_0xf3e9('0x1e')](handleEntityNotFound(_0x5b25b3,null))['then'](function(_0x71f894){if(_0x71f894&&_0x71f894[_0xf3e9('0xc6')]){_0xc4fd74=_0x71f894['get']({'plain':!![]});if(_0xc4fd74[_0xf3e9('0xc6')]&&_0xc4fd74['List'][_0xf3e9('0x92')][_0xf3e9('0x49')]){return _0xc4fd74[_0xf3e9('0xc6')][_0xf3e9('0x92')][0x0];}return db[_0xf3e9('0x73')][_0xf3e9('0x59')](_['defaults'](_0x581311[_0xf3e9('0x5a')],{'firstName':_0x55c045,'mobile':_0x55c045,'phone':_0x55c045,'ListId':_0xc4fd74[_0xf3e9('0x79')]}));}})[_0xf3e9('0x1e')](handleEntityNotFound(_0x5b25b3,null))[_0xf3e9('0x1e')](function(_0x2e66c1){if(_0x2e66c1){_0x5eb0fb=_0x2e66c1;return db[_0xf3e9('0x99')][_0xf3e9('0x58')]({'where':{'ContactId':_0x5eb0fb['id'],'closed':![],'SmsAccountId':_0xc4fd74['id']}})[_0xf3e9('0x1e')](function(_0x4b43c6){if(_0x4b43c6){return[_0x4b43c6,![]];}return db[_0xf3e9('0x99')][_0xf3e9('0x59')]({'UserId':_0x581311['user']['id'],'ContactId':_0x5eb0fb['id'],'SmsAccountId':_0xc4fd74['id'],'phone':_0x55c045,'firstMsgDirection':_0xf3e9('0xc7'),'Messages':[_[_0xf3e9('0x50')](_0x581311[_0xf3e9('0x5a')],{'read':![],'body':_0x581311['body']['body'],'phone':_0x55c045,'SmsAccountId':_0xc4fd74['id'],'UserId':_0x581311[_0xf3e9('0x5b')]['id'],'ContactId':_0x5eb0fb['id']})]},{'include':[{'model':db[_0xf3e9('0xa2')],'as':'Messages'}]})[_0xf3e9('0x1e')](function(_0x33b64f){return[_0x33b64f,!![]];});});}})[_0xf3e9('0x9a')](function(_0x277378,_0x1bbd67){if(_0x1bbd67){return _0x277378;}return db[_0xf3e9('0xa2')][_0xf3e9('0x59')](_['merge'](_0x581311[_0xf3e9('0x5a')],{'read':![],'body':_0x581311['body'][_0xf3e9('0x5a')],'phone':_0x55c045,'SmsAccountId':_0xc4fd74['id'],'SmsInteractionId':_0x277378['id'],'UserId':_0x581311[_0xf3e9('0x5b')]['id'],'ContactId':_0x5eb0fb['id']}))[_0xf3e9('0x1e')](function(_0x1c0d3d){_0x277378['dataValues']['Messages']=[];_0x277378[_0xf3e9('0xc8')][_0xf3e9('0xc9')][_0xf3e9('0x9e')](_0x1c0d3d[_0xf3e9('0xc8')]);return _0x277378;});})['then'](respondWithResult(_0x5b25b3,null))['catch'](handleError(_0x5b25b3,null));};exports['status']=function(_0x4a235f,_0x578bd4,_0x5c33c3){if(_0x4a235f['body']['id']){delete _0x4a235f['body']['id'];}var _0x1936bf,_0x7386ca,_0x2f591;return db[_0xf3e9('0x3e')][_0xf3e9('0x58')]({'where':{'id':_0x4a235f['params']['id']}})['then'](handleEntityNotFound(_0x578bd4,null))[_0xf3e9('0x1e')](function(_0x447a2f){if(_0x447a2f){_0x2f591=_0x447a2f;logger[_0xf3e9('0x21')](_0xf3e9('0x22'),_0xf3e9('0x28'),_0xf3e9('0xca'),_0x447a2f['type'],util[_0xf3e9('0xcb')](_0x4a235f[_0xf3e9('0x5a')],{'showHidden':![],'depth':null}));switch(_0x447a2f[_0xf3e9('0x40')]){case'skebby':if(_0x4a235f['body']['skebby_dispatch_id']&&_0x4a235f[_0xf3e9('0x5a')][_0xf3e9('0x28')]){_0x7386ca=_0x4a235f[_0xf3e9('0x5a')][_0xf3e9('0x28')];return db['SmsMessage'][_0xf3e9('0x58')]({'where':{'messageId':_0x4a235f[_0xf3e9('0x5a')]['skebby_dispatch_id']}});}break;case _0xf3e9('0xcc'):if(_0x4a235f['body']['requestid']&&_0x4a235f[_0xf3e9('0x5a')][_0xf3e9('0xcd')]){_0x7386ca=_0x4a235f[_0xf3e9('0x5a')]['statusInt'];return db[_0xf3e9('0xa2')][_0xf3e9('0x58')]({'where':{'messageId':_0x4a235f['body'][_0xf3e9('0xce')]}});}break;case _0xf3e9('0xcf'):if(_0x4a235f[_0xf3e9('0x5a')][_0xf3e9('0xd0')]&&_0x4a235f[_0xf3e9('0x5a')]['status_code']){_0x7386ca=_0x4a235f['body']['status_code'];return db['SmsMessage'][_0xf3e9('0x58')]({'where':{'messageId':_0x4a235f['body']['message_id']}});}break;case _0xf3e9('0x85'):var _0x3e5eae=_0x4a235f[_0xf3e9('0x5a')][_0xf3e9('0x86')][0x0];if(_0x3e5eae['messageId']&&_0x3e5eae[_0xf3e9('0x28')][_0xf3e9('0xd1')]==='DELIVERED'){_0x7386ca=_0x3e5eae[_0xf3e9('0x28')][_0xf3e9('0xd1')];return db[_0xf3e9('0xa2')]['find']({'where':{'messageId':_0x3e5eae['messageId']}});}break;case _0xf3e9('0xd2'):if(_0x4a235f[_0xf3e9('0x5a')][_0xf3e9('0x81')]&&_0x4a235f[_0xf3e9('0x5a')][_0xf3e9('0x28')]){_0x7386ca=_0x4a235f[_0xf3e9('0x5a')][_0xf3e9('0x28')];return db[_0xf3e9('0xa2')][_0xf3e9('0x58')]({'where':{'messageId':_0x4a235f['body']['messageId']}});}break;case _0xf3e9('0xd3'):if(_0x4a235f[_0xf3e9('0x5a')][0x0][_0xf3e9('0x24')]['id']){_0x7386ca=_0x4a235f[_0xf3e9('0x5a')][0x0][_0xf3e9('0x40')];return db['SmsMessage']['find']({'where':{'messageId':_0x4a235f[_0xf3e9('0x5a')][0x0][_0xf3e9('0x24')]['id']}});}break;case _0xf3e9('0x8a'):if(_0x4a235f[_0xf3e9('0x5a')]['redif']&&_0x4a235f[_0xf3e9('0x5a')][_0xf3e9('0x28')]){_0x7386ca=_0x4a235f[_0xf3e9('0x5a')]['status'];return db[_0xf3e9('0xa2')][_0xf3e9('0x58')]({'where':{'messageId':_0x4a235f[_0xf3e9('0x5a')][_0xf3e9('0xd4')]}});}break;}}})['then'](handleEntityNotFound(_0x578bd4,null))[_0xf3e9('0x1e')](function(_0x3ade5c){if(_0x3ade5c){_0x1936bf=_0x3ade5c;switch(_0x2f591[_0xf3e9('0x40')]){case _0xf3e9('0x7d'):if(_0x7386ca==='DELIVERED'){return _0x1936bf[_0xf3e9('0x33')]({'read':!![]});}else{logger[_0xf3e9('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf3e9('0x28'),_0xf3e9('0x7d'),util[_0xf3e9('0xcb')](_0x4a235f['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x7386ca==='1'){return _0x1936bf[_0xf3e9('0x33')]({'read':!![]});}else{logger[_0xf3e9('0x23')](_0xf3e9('0x22'),_0xf3e9('0x28'),_0xf3e9('0x7d'),util[_0xf3e9('0xcb')](_0x4a235f['body'],{'showHidden':![],'depth':null}));}break;case _0xf3e9('0xcf'):if(!_0x4a235f[_0xf3e9('0x5a')][_0xf3e9('0xd5')]&&_0x7386ca>=0xc8&&_0x7386ca<=0xce){return _0x1936bf['update']({'read':!![]});}else{logger[_0xf3e9('0x23')](_0xf3e9('0x22'),_0xf3e9('0x28'),'clicksend',util[_0xf3e9('0xcb')](_0x4a235f['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5cba67=_0x4a235f[_0xf3e9('0x5a')][_0xf3e9('0x86')][0x0];if(_0x5cba67['status'][_0xf3e9('0xd1')]===_0xf3e9('0xd6')){return _0x1936bf[_0xf3e9('0x33')]({'read':!![]});}else{logger['error'](_0xf3e9('0x22'),'status','infobip',util[_0xf3e9('0xcb')](_0x4a235f[_0xf3e9('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xf3e9('0xd2'):if(_0x7386ca==_0xf3e9('0xd7')||_0x7386ca==_0xf3e9('0xd8')){return _0x1936bf[_0xf3e9('0x33')]({'read':!![]});}else{logger['error'](_0xf3e9('0x22'),_0xf3e9('0x28'),'clickatell',util[_0xf3e9('0xcb')](_0x4a235f[_0xf3e9('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xf3e9('0xd3'):if(_0x7386ca==_0xf3e9('0xd9')){return _0x1936bf[_0xf3e9('0x33')]({'read':!![]});}else{logger[_0xf3e9('0x23')](_0xf3e9('0x22'),'status',_0xf3e9('0xd3'),util[_0xf3e9('0xcb')](_0x4a235f[_0xf3e9('0x5a')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x7386ca==='DELIVRD'||_0x7386ca==='ACCEPTD'){return _0x1936bf[_0xf3e9('0x33')]({'read':!![]});}else{logger[_0xf3e9('0x23')](_0xf3e9('0x22'),_0xf3e9('0x28'),_0xf3e9('0x8a'),util[_0xf3e9('0xcb')](_0x4a235f[_0xf3e9('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x1936bf;}})[_0xf3e9('0x1e')](respondWithResult(_0x578bd4,null))[_0xf3e9('0x54')](handleError(_0x578bd4,null));};exports[_0xf3e9('0xda')]=function(_0x5f31d7,_0x269483,_0x44d1aa){var _0x225749,_0x54064c,_0xc003d8;return db[_0xf3e9('0x3e')][_0xf3e9('0x58')]({'where':{'id':_0x5f31d7[_0xf3e9('0x56')]['id']}})['then'](handleEntityNotFound(_0x269483,null))[_0xf3e9('0x1e')](function(_0x4dfb1d){if(_0x4dfb1d){_0xc003d8=_0x4dfb1d;logger['debug'](_0xf3e9('0x22'),_0xf3e9('0x28'),_0xf3e9('0xca'),_0x4dfb1d[_0xf3e9('0x40')],util[_0xf3e9('0xcb')](_0x5f31d7[_0xf3e9('0x42')],{'showHidden':![],'depth':null}));switch(_0x4dfb1d[_0xf3e9('0x40')]){case _0xf3e9('0x87'):if(_0x5f31d7['query'][_0xf3e9('0xdb')]&&_0x5f31d7[_0xf3e9('0x42')][_0xf3e9('0xdc')]){_0x54064c=_0x5f31d7[_0xf3e9('0x42')]['state'];return db[_0xf3e9('0xa2')][_0xf3e9('0x58')]({'where':{'messageId':_0x5f31d7[_0xf3e9('0x42')]['message-id']}});}break;}}})[_0xf3e9('0x1e')](handleEntityNotFound(_0x269483,null))[_0xf3e9('0x1e')](function(_0x381fe7){if(_0x381fe7){_0x225749=_0x381fe7;switch(_0xc003d8[_0xf3e9('0x40')]){case'csc':if(_0x54064c==='2'||_0x54064c==='6'){return _0x225749[_0xf3e9('0x33')]({'read':!![]});}else{logger[_0xf3e9('0x23')](_0xf3e9('0x22'),_0xf3e9('0x28'),'csc',util[_0xf3e9('0xcb')](_0x5f31d7[_0xf3e9('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x225749;}})['then'](respondWithResult(_0x269483,null))['catch'](handleError(_0x269483,null));};exports[_0xf3e9('0xdd')]=function(_0x54882e,_0x3a9ce6,_0x3187fc){return db['SmsAccount']['find']({'where':{'id':_0x54882e[_0xf3e9('0x56')]['id']}})['then'](handleEntityNotFound(_0x3a9ce6,null))['then'](function(_0x59ba1e){if(_0x59ba1e){return _0x59ba1e[_0xf3e9('0xdd')](_0x54882e[_0xf3e9('0x5a')][_0xf3e9('0x69')],_[_0xf3e9('0x95')](_0x54882e[_0xf3e9('0x5a')],[_0xf3e9('0x69'),'id'])||{})['spread'](function(_0x223d68){for(var _0x21869b=0x0;_0x21869b<_0x54882e[_0xf3e9('0x5a')][_0xf3e9('0x69')][_0xf3e9('0x49')];_0x21869b+=0x1){socket[_0xf3e9('0xde')]('userSmsAccount:save',{'UserId':Number(_0x54882e[_0xf3e9('0x5a')]['ids'][_0x21869b]),'SmsAccountId':Number(_0x54882e[_0xf3e9('0x56')]['id'])});}return _0x223d68;});}})['then'](respondWithResult(_0x3a9ce6,null))[_0xf3e9('0x54')](handleError(_0x3a9ce6,null));};exports['removeAgents']=function(_0x3a9c64,_0x28d158,_0x202eaa){return db['SmsAccount'][_0xf3e9('0x58')]({'where':{'id':_0x3a9c64[_0xf3e9('0x56')]['id']}})['then'](handleEntityNotFound(_0x28d158,null))[_0xf3e9('0x1e')](function(_0x158e1f){if(_0x158e1f){return _0x158e1f['removeAgents'](_0x3a9c64[_0xf3e9('0x42')]['ids'])[_0xf3e9('0x1e')](function(){if(_[_0xf3e9('0xdf')](_0x3a9c64[_0xf3e9('0x42')][_0xf3e9('0x69')])){for(var _0x496a9c=0x0;_0x496a9c<_0x3a9c64[_0xf3e9('0x42')][_0xf3e9('0x69')]['length'];_0x496a9c+=0x1){socket['emit'](_0xf3e9('0xe0'),{'UserId':Number(_0x3a9c64[_0xf3e9('0x42')][_0xf3e9('0x69')][_0x496a9c]),'SmsAccountId':Number(_0x3a9c64[_0xf3e9('0x56')]['id'])});}}else{socket['emit'](_0xf3e9('0xe0'),{'UserId':Number(_0x3a9c64[_0xf3e9('0x42')][_0xf3e9('0x69')]),'SmsAccountId':Number(_0x3a9c64[_0xf3e9('0x56')]['id'])});}});}})[_0xf3e9('0x1e')](respondWithStatusCode(_0x28d158,null))['catch'](handleError(_0x28d158,null));};exports[_0xf3e9('0xe1')]=function(_0x107096,_0x3c4a31,_0x613095){var _0x44fa32={};var _0x3079ff={};var _0x5f0c0b;var _0x1feaf7;return db[_0xf3e9('0x3e')]['findOne']({'where':{'id':_0x107096['params']['id']}})[_0xf3e9('0x1e')](handleEntityNotFound(_0x3c4a31,null))[_0xf3e9('0x1e')](function(_0x3612e1){if(_0x3612e1){_0x5f0c0b=_0x3612e1;_0x3079ff['model']=_[_0xf3e9('0x43')](db[_0xf3e9('0xbd')][_0xf3e9('0x3f')]);_0x3079ff[_0xf3e9('0x42')]=_[_0xf3e9('0x43')](_0x107096[_0xf3e9('0x42')]);_0x3079ff[_0xf3e9('0x44')]=_[_0xf3e9('0x45')](_0x3079ff[_0xf3e9('0x46')],_0x3079ff[_0xf3e9('0x42')]);_0x44fa32['attributes']=_[_0xf3e9('0x45')](_0x3079ff[_0xf3e9('0x46')],qs[_0xf3e9('0x47')](_0x107096[_0xf3e9('0x42')]['fields']));_0x44fa32[_0xf3e9('0x48')]=_0x44fa32[_0xf3e9('0x48')][_0xf3e9('0x49')]?_0x44fa32[_0xf3e9('0x48')]:_0x3079ff[_0xf3e9('0x46')];_0x44fa32[_0xf3e9('0xe2')]=qs['sort'](_0x107096['query'][_0xf3e9('0x4c')]);_0x44fa32['where']=qs[_0xf3e9('0x44')](_[_0xf3e9('0x66')](_0x107096[_0xf3e9('0x42')],_0x3079ff[_0xf3e9('0x44')]));if(_0x107096[_0xf3e9('0x42')]['filter']){_0x44fa32['where']=_[_0xf3e9('0x50')](_0x44fa32['where'],{'$or':_['map'](_0x44fa32['attributes'],function(_0x367d2a){var _0x10bfc5={};_0x10bfc5[_0x367d2a]={'$like':'%'+_0x107096[_0xf3e9('0x42')][_0xf3e9('0x4e')]+'%'};return _0x10bfc5;})});}_0x44fa32=_[_0xf3e9('0x50')]({},_0x44fa32,_0x107096[_0xf3e9('0x67')]);return _0x5f0c0b[_0xf3e9('0xe1')](_0x44fa32);}})[_0xf3e9('0x1e')](function(_0x29b3b7){if(_0x29b3b7){_0x1feaf7=_0x29b3b7[_0xf3e9('0x49')];if(!_0x107096[_0xf3e9('0x42')][_0xf3e9('0x4a')](_0xf3e9('0x4b'))){_0x44fa32[_0xf3e9('0x2c')]=qs[_0xf3e9('0x2c')](_0x107096[_0xf3e9('0x42')][_0xf3e9('0x2c')]);_0x44fa32['offset']=qs[_0xf3e9('0x2e')](_0x107096[_0xf3e9('0x42')][_0xf3e9('0x2e')]);}return _0x5f0c0b[_0xf3e9('0xe1')](_0x44fa32);}})[_0xf3e9('0x1e')](function(_0x4ab554){if(_0x4ab554){return _0x4ab554?{'count':_0x1feaf7,'rows':_0x4ab554}:null;}})[_0xf3e9('0x1e')](respondWithResult(_0x3c4a31,null))[_0xf3e9('0x54')](handleError(_0x3c4a31,null));}; \ No newline at end of file +var _0xc2c5=['ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','From','Body','messageId','MessageSid','skebby','sender','text','message_id','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','push','close','unmanaged','*,*,*,*','created','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','clicksend','status_code','groupName','intelepeer','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','bandwidth','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','info','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','update','then','destroy','SmsAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','Disposition','getDispositions','findOne','SmsAccountId','findAll','removeDispositions','ids','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','notify','SmsApplication','Applications','account','applications','orderBy','Sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc2c5,0x15b));var _0x5c2c=function(_0x4b3413,_0x58c416){_0x4b3413=_0x4b3413-0x0;var _0x3b01ba=_0xc2c5[_0x4b3413];return _0x3b01ba;};'use strict';var emlformat=require(_0x5c2c('0x0'));var rimraf=require(_0x5c2c('0x1'));var zipdir=require(_0x5c2c('0x2'));var jsonpatch=require(_0x5c2c('0x3'));var rp=require('request-promise');var moment=require(_0x5c2c('0x4'));var BPromise=require(_0x5c2c('0x5'));var Mustache=require('mustache');var util=require(_0x5c2c('0x6'));var path=require(_0x5c2c('0x7'));var sox=require(_0x5c2c('0x8'));var csv=require(_0x5c2c('0x9'));var ejs=require(_0x5c2c('0xa'));var fs=require('fs');var fs_extra=require(_0x5c2c('0xb'));var _=require(_0x5c2c('0xc'));var squel=require(_0x5c2c('0xd'));var crypto=require(_0x5c2c('0xe'));var jsforce=require(_0x5c2c('0xf'));var deskjs=require(_0x5c2c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5c2c('0x11'));var Papa=require(_0x5c2c('0x12'));var Redis=require(_0x5c2c('0x13'));var authService=require(_0x5c2c('0x14'));var qs=require(_0x5c2c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c2c('0x16'))(_0x5c2c('0x17'));var utils=require(_0x5c2c('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5c2c('0x19'))['db'];config[_0x5c2c('0x1a')]=_[_0x5c2c('0x1b')](config['redis'],{'host':_0x5c2c('0x1c'),'port':0x18eb});var socket=require(_0x5c2c('0x1d'))(new Redis(config[_0x5c2c('0x1a')]));require(_0x5c2c('0x1e'))[_0x5c2c('0x1f')](socket);var jayson=require(_0x5c2c('0x20'));var client=jayson['client'][_0x5c2c('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x46287f,_0x4044fb,_0x3df916,_0x4e4a5e){return new BPromise(function(_0x29981e,_0x2a5eae){var _0x1ca76b=_0x4e4a5e||client;return _0x1ca76b[_0x5c2c('0x22')](_0x46287f,_0x3df916)['then'](function(_0x4b743f){logger[_0x5c2c('0x23')]('SmsAccount,\x20%s,\x20%s',_0x4044fb,_0x5c2c('0x24'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4044fb,_0x5c2c('0x24'),JSON[_0x5c2c('0x25')](_0x4b743f));if(_0x4b743f[_0x5c2c('0x26')]){if(_0x4b743f[_0x5c2c('0x26')][_0x5c2c('0x27')]===0x1f4){logger['error'](_0x5c2c('0x28'),_0x4044fb,_0x4b743f[_0x5c2c('0x26')][_0x5c2c('0x29')]);return _0x2a5eae(_0x4b743f[_0x5c2c('0x26')][_0x5c2c('0x29')]);}logger[_0x5c2c('0x26')](_0x5c2c('0x28'),_0x4044fb,_0x4b743f[_0x5c2c('0x26')][_0x5c2c('0x29')]);return _0x29981e(_0x4b743f[_0x5c2c('0x26')][_0x5c2c('0x29')]);}else{logger[_0x5c2c('0x23')]('SmsAccount,\x20%s,\x20%s',_0x4044fb,_0x5c2c('0x24'));_0x29981e(_0x4b743f[_0x5c2c('0x2a')][_0x5c2c('0x29')]);}})[_0x5c2c('0x2b')](function(_0x45ec85){logger['error'](_0x5c2c('0x28'),_0x4044fb,_0x45ec85);_0x2a5eae(_0x45ec85);});});}function respondWithStatusCode(_0x3877d1,_0x1bd87a){_0x1bd87a=_0x1bd87a||0xcc;return function(_0x48ac65){if(_0x48ac65){return _0x3877d1[_0x5c2c('0x2c')](_0x1bd87a);}return _0x3877d1[_0x5c2c('0x2d')](_0x1bd87a)[_0x5c2c('0x2e')]();};}function respondWithResult(_0x15ed72,_0x22f09d){_0x22f09d=_0x22f09d||0xc8;return function(_0x68997f){if(_0x68997f){return _0x15ed72[_0x5c2c('0x2d')](_0x22f09d)['json'](_0x68997f);}};}function respondWithFilteredResult(_0x2f45af,_0x2fe18f){return function(_0x53aaea){if(_0x53aaea){var _0x50cfac=typeof _0x2fe18f[_0x5c2c('0x2f')]==='undefined'&&typeof _0x2fe18f[_0x5c2c('0x30')]===_0x5c2c('0x31');var _0x27b853=_0x53aaea[_0x5c2c('0x32')];var _0x2a5bd8=_0x50cfac?0x0:_0x2fe18f['offset'];var _0x4d7705=_0x50cfac?_0x53aaea[_0x5c2c('0x32')]:_0x2fe18f[_0x5c2c('0x2f')]+_0x2fe18f[_0x5c2c('0x30')];var _0x3f92d9;if(_0x4d7705>=_0x27b853){_0x4d7705=_0x27b853;_0x3f92d9=0xc8;}else{_0x3f92d9=0xce;}_0x2f45af[_0x5c2c('0x2d')](_0x3f92d9);return _0x2f45af[_0x5c2c('0x33')](_0x5c2c('0x34'),_0x2a5bd8+'-'+_0x4d7705+'/'+_0x27b853)[_0x5c2c('0x35')](_0x53aaea);}return null;};}function patchUpdates(_0x4918c2){return function(_0x340989){try{jsonpatch['apply'](_0x340989,_0x4918c2,!![]);}catch(_0x533152){return BPromise[_0x5c2c('0x36')](_0x533152);}return _0x340989['save']();};}function saveUpdates(_0x3e134a,_0x46b956){return function(_0x219f53){if(_0x219f53){return _0x219f53[_0x5c2c('0x37')](_0x3e134a)[_0x5c2c('0x38')](function(_0x5f5289){return _0x5f5289;});}return null;};}function removeEntity(_0x3d3f6e,_0x35e51c){return function(_0x26ce59){if(_0x26ce59){return _0x26ce59[_0x5c2c('0x39')]()[_0x5c2c('0x38')](function(){var _0x1c4470=_0x26ce59['get']({'plain':!![]});var _0x51762c=_0x5c2c('0x3a');return db[_0x5c2c('0x3b')][_0x5c2c('0x39')]({'where':{'type':_0x51762c,'resourceId':_0x1c4470['id']}})[_0x5c2c('0x38')](function(){return _0x26ce59;});})[_0x5c2c('0x38')](function(){_0x3d3f6e[_0x5c2c('0x2d')](0xcc)[_0x5c2c('0x2e')]();});}};}function handleEntityNotFound(_0x5f33f9,_0x21c0cc){return function(_0x42dccf){if(!_0x42dccf){_0x5f33f9[_0x5c2c('0x2c')](0x194);}return _0x42dccf;};}function handleError(_0x250f86,_0x5334bc){_0x5334bc=_0x5334bc||0x1f4;return function(_0x1bc7e4){logger[_0x5c2c('0x26')](_0x1bc7e4[_0x5c2c('0x3c')]);if(_0x1bc7e4[_0x5c2c('0x3d')]){delete _0x1bc7e4['name'];}_0x250f86['status'](_0x5334bc)['send'](_0x1bc7e4);};}exports[_0x5c2c('0x3e')]=function(_0x33a03b,_0x29d79e){var _0xfe2961={'include':[{'model':db['Pause'],'as':_0x5c2c('0x3f')}]},_0x45d771={},_0x4aa671={'count':0x0,'rows':[]};var _0x5f057b=_[_0x5c2c('0x40')](db[_0x5c2c('0x41')][_0x5c2c('0x42')],function(_0x45c134){return{'name':_0x45c134['fieldName'],'type':_0x45c134[_0x5c2c('0x43')][_0x5c2c('0x44')]};});_0x45d771[_0x5c2c('0x45')]=_[_0x5c2c('0x40')](_0x5f057b,_0x5c2c('0x3d'));_0x45d771[_0x5c2c('0x46')]=_[_0x5c2c('0x47')](_0x33a03b[_0x5c2c('0x46')]);_0x45d771[_0x5c2c('0x48')]=_[_0x5c2c('0x49')](_0x45d771[_0x5c2c('0x45')],_0x45d771['query']);_0xfe2961[_0x5c2c('0x4a')]=_[_0x5c2c('0x49')](_0x45d771[_0x5c2c('0x45')],qs['fields'](_0x33a03b[_0x5c2c('0x46')]['fields']));_0xfe2961[_0x5c2c('0x4a')]=_0xfe2961['attributes'][_0x5c2c('0x4b')]?_0xfe2961[_0x5c2c('0x4a')]:_0x45d771['model'];if(!_0x33a03b[_0x5c2c('0x46')]['hasOwnProperty'](_0x5c2c('0x4c'))){_0xfe2961['limit']=qs[_0x5c2c('0x30')](_0x33a03b[_0x5c2c('0x46')][_0x5c2c('0x30')]);_0xfe2961[_0x5c2c('0x2f')]=qs[_0x5c2c('0x2f')](_0x33a03b[_0x5c2c('0x46')]['offset']);}_0xfe2961[_0x5c2c('0x4d')]=qs[_0x5c2c('0x4e')](_0x33a03b[_0x5c2c('0x46')][_0x5c2c('0x4e')]);_0xfe2961[_0x5c2c('0x4f')]=qs[_0x5c2c('0x48')](_[_0x5c2c('0x50')](_0x33a03b[_0x5c2c('0x46')],_0x45d771['filters']),_0x5f057b);if(_0x33a03b[_0x5c2c('0x46')][_0x5c2c('0x51')]){_0xfe2961[_0x5c2c('0x4f')]=_[_0x5c2c('0x52')](_0xfe2961[_0x5c2c('0x4f')],{'$or':_[_0x5c2c('0x40')](_0x5f057b,function(_0x44d9a8){if(_0x44d9a8[_0x5c2c('0x43')]!=='VIRTUAL'){var _0x12a1eb={};_0x12a1eb[_0x44d9a8[_0x5c2c('0x3d')]]={'$like':'%'+_0x33a03b[_0x5c2c('0x46')][_0x5c2c('0x51')]+'%'};return _0x12a1eb;}})});}_0xfe2961=_[_0x5c2c('0x52')]({},_0xfe2961,_0x33a03b[_0x5c2c('0x53')]);var _0x3a09cd={'where':_0xfe2961[_0x5c2c('0x4f')]};return db[_0x5c2c('0x41')]['count'](_0x3a09cd)[_0x5c2c('0x38')](function(_0x7c234f){_0x4aa671[_0x5c2c('0x32')]=_0x7c234f;if(_0x33a03b['query'][_0x5c2c('0x54')]){_0xfe2961[_0x5c2c('0x55')]=[{'all':!![]}];}return db[_0x5c2c('0x41')]['findAll'](_0xfe2961);})[_0x5c2c('0x38')](function(_0x25f8dd){_0x4aa671[_0x5c2c('0x56')]=_0x25f8dd;return _0x4aa671;})[_0x5c2c('0x38')](respondWithFilteredResult(_0x29d79e,_0xfe2961))[_0x5c2c('0x2b')](handleError(_0x29d79e,null));};exports[_0x5c2c('0x57')]=function(_0x4684cd,_0x6b374d){var _0x4a9508={'raw':![],'where':{'id':_0x4684cd['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x15a5e6={};_0x15a5e6[_0x5c2c('0x45')]=_['keys'](db[_0x5c2c('0x41')][_0x5c2c('0x42')]);_0x15a5e6['query']=_[_0x5c2c('0x47')](_0x4684cd[_0x5c2c('0x46')]);_0x15a5e6[_0x5c2c('0x48')]=_[_0x5c2c('0x49')](_0x15a5e6['model'],_0x15a5e6[_0x5c2c('0x46')]);_0x4a9508[_0x5c2c('0x4a')]=_[_0x5c2c('0x49')](_0x15a5e6[_0x5c2c('0x45')],qs['fields'](_0x4684cd[_0x5c2c('0x46')][_0x5c2c('0x58')]));_0x4a9508[_0x5c2c('0x4a')]=_0x4a9508[_0x5c2c('0x4a')][_0x5c2c('0x4b')]?_0x4a9508[_0x5c2c('0x4a')]:_0x15a5e6[_0x5c2c('0x45')];if(_0x4684cd['query'][_0x5c2c('0x54')]){_0x4a9508[_0x5c2c('0x55')]=[{'all':!![]}];}_0x4a9508=_[_0x5c2c('0x52')]({},_0x4a9508,_0x4684cd['options']);return db[_0x5c2c('0x41')][_0x5c2c('0x59')](_0x4a9508)['then'](handleEntityNotFound(_0x6b374d,null))[_0x5c2c('0x38')](respondWithResult(_0x6b374d,null))['catch'](handleError(_0x6b374d,null));};exports[_0x5c2c('0x5a')]=function(_0x4ae5c0,_0x1886e6){return db[_0x5c2c('0x41')][_0x5c2c('0x5a')](_0x4ae5c0[_0x5c2c('0x5b')],{})[_0x5c2c('0x38')](function(_0x17c2dc){var _0x552a0a=_0x4ae5c0[_0x5c2c('0x5c')][_0x5c2c('0x5d')]({'plain':!![]});if(!_0x552a0a)throw new Error(_0x5c2c('0x5e'));if(_0x552a0a['role']===_0x5c2c('0x5c')){var _0x306938=_0x17c2dc['get']({'plain':!![]});var _0x1f8639=_0x5c2c('0x3a');return db[_0x5c2c('0x5f')]['find']({'where':{'name':_0x1f8639,'userProfileId':_0x552a0a[_0x5c2c('0x60')]},'raw':!![]})[_0x5c2c('0x38')](function(_0x54b284){if(_0x54b284&&_0x54b284[_0x5c2c('0x61')]===0x0){return db[_0x5c2c('0x3b')][_0x5c2c('0x5a')]({'name':_0x306938[_0x5c2c('0x3d')],'resourceId':_0x306938['id'],'type':_0x54b284[_0x5c2c('0x3d')],'sectionId':_0x54b284['id']},{})['then'](function(){return _0x17c2dc;});}else{return _0x17c2dc;}})[_0x5c2c('0x2b')](function(_0x3e12d1){logger[_0x5c2c('0x26')](_0x5c2c('0x62'),_0x3e12d1);throw _0x3e12d1;});}return _0x17c2dc;})[_0x5c2c('0x38')](respondWithResult(_0x1886e6,0xc9))[_0x5c2c('0x2b')](handleError(_0x1886e6,null));};exports['update']=function(_0x2dc868,_0x5ad34c){if(_0x2dc868[_0x5c2c('0x5b')]['id']){delete _0x2dc868[_0x5c2c('0x5b')]['id'];}return db[_0x5c2c('0x41')]['find']({'where':{'id':_0x2dc868[_0x5c2c('0x63')]['id']},'include':[{'model':db['Pause'],'as':_0x5c2c('0x3f')}]})[_0x5c2c('0x38')](handleEntityNotFound(_0x5ad34c,null))[_0x5c2c('0x38')](saveUpdates(_0x2dc868['body'],null))[_0x5c2c('0x38')](respondWithResult(_0x5ad34c,null))[_0x5c2c('0x2b')](handleError(_0x5ad34c,null));};exports[_0x5c2c('0x39')]=function(_0x504e3,_0x2c84fc){return db[_0x5c2c('0x41')][_0x5c2c('0x59')]({'where':{'id':_0x504e3[_0x5c2c('0x63')]['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x2c84fc,null))['then'](removeEntity(_0x2c84fc,null))[_0x5c2c('0x2b')](handleError(_0x2c84fc,null));};exports[_0x5c2c('0x64')]=function(_0xaaa530,_0x37c46e){return db['SmsAccount'][_0x5c2c('0x64')]()['then'](respondWithResult(_0x37c46e,null))[_0x5c2c('0x2b')](handleError(_0x37c46e,null));};exports['addDisposition']=function(_0x54c807,_0x3fcd20,_0x1e8eb9){if(_0x54c807['body']['id']){delete _0x54c807[_0x5c2c('0x5b')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x54c807[_0x5c2c('0x63')]['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x3fcd20,null))['then'](function(_0x290534){if(_0x290534){_0x54c807[_0x5c2c('0x5b')]['SmsAccountId']=_0x290534['id'];return db[_0x5c2c('0x65')]['create'](_0x54c807[_0x5c2c('0x5b')]);}})[_0x5c2c('0x38')](respondWithResult(_0x3fcd20,null))[_0x5c2c('0x2b')](handleError(_0x3fcd20,null));};exports[_0x5c2c('0x66')]=function(_0x2e2bd6,_0x2207f9,_0xad1c11){var _0x12d03c={'raw':![],'where':{}};var _0x4a3ea9={};var _0x5746d9={'count':0x0,'rows':[]};return db[_0x5c2c('0x41')][_0x5c2c('0x67')]({'where':{'id':_0x2e2bd6[_0x5c2c('0x63')]['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x2207f9,null))[_0x5c2c('0x38')](function(_0x585a1d){if(_0x585a1d){_0x4a3ea9[_0x5c2c('0x45')]=_[_0x5c2c('0x47')](db['Disposition']['rawAttributes']);_0x4a3ea9[_0x5c2c('0x46')]=_['keys'](_0x2e2bd6['query']);_0x4a3ea9[_0x5c2c('0x48')]=_['intersection'](_0x4a3ea9[_0x5c2c('0x45')],_0x4a3ea9['query']);_0x12d03c[_0x5c2c('0x4a')]=_[_0x5c2c('0x49')](_0x4a3ea9['model'],qs['fields'](_0x2e2bd6['query'][_0x5c2c('0x58')]));_0x12d03c['attributes']=_0x12d03c[_0x5c2c('0x4a')][_0x5c2c('0x4b')]?_0x12d03c[_0x5c2c('0x4a')]:_0x4a3ea9[_0x5c2c('0x45')];if(!_0x2e2bd6[_0x5c2c('0x46')]['hasOwnProperty']('nolimit')){_0x12d03c[_0x5c2c('0x30')]=qs[_0x5c2c('0x30')](_0x2e2bd6['query'][_0x5c2c('0x30')]);_0x12d03c[_0x5c2c('0x2f')]=qs[_0x5c2c('0x2f')](_0x2e2bd6[_0x5c2c('0x46')][_0x5c2c('0x2f')]);}_0x12d03c[_0x5c2c('0x4d')]=qs['sort'](_0x2e2bd6['query'][_0x5c2c('0x4e')]);_0x12d03c[_0x5c2c('0x4f')]=qs[_0x5c2c('0x48')](_[_0x5c2c('0x50')](_0x2e2bd6[_0x5c2c('0x46')],_0x4a3ea9[_0x5c2c('0x48')]));_0x12d03c[_0x5c2c('0x4f')][_0x5c2c('0x68')]=_0x585a1d['id'];if(_0x2e2bd6[_0x5c2c('0x46')][_0x5c2c('0x51')]){_0x12d03c[_0x5c2c('0x4f')]=_[_0x5c2c('0x52')](_0x12d03c[_0x5c2c('0x4f')],{'$or':_['map'](_0x12d03c[_0x5c2c('0x4a')],function(_0x1ec8a7){var _0x4a480b={};_0x4a480b[_0x1ec8a7]={'$like':'%'+_0x2e2bd6['query'][_0x5c2c('0x51')]+'%'};return _0x4a480b;})});}_0x12d03c=_['merge']({},_0x12d03c,_0x2e2bd6[_0x5c2c('0x53')]);return db[_0x5c2c('0x65')][_0x5c2c('0x32')]({'where':_0x12d03c[_0x5c2c('0x4f')]})[_0x5c2c('0x38')](function(_0x2105e4){_0x5746d9[_0x5c2c('0x32')]=_0x2105e4;if(_0x2e2bd6['query'][_0x5c2c('0x54')]){_0x12d03c[_0x5c2c('0x55')]=[{'all':!![]}];}return db[_0x5c2c('0x65')][_0x5c2c('0x69')](_0x12d03c);})['then'](function(_0x5cac5a){_0x5746d9[_0x5c2c('0x56')]=_0x5cac5a;return _0x5746d9;});}})[_0x5c2c('0x38')](respondWithFilteredResult(_0x2207f9,_0x12d03c))[_0x5c2c('0x2b')](handleError(_0x2207f9,null));};exports[_0x5c2c('0x6a')]=function(_0x49bd29,_0x821aa7,_0x4eec0b){return db[_0x5c2c('0x41')][_0x5c2c('0x59')]({'where':{'id':_0x49bd29[_0x5c2c('0x63')]['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x821aa7,null))[_0x5c2c('0x38')](function(_0x4bf65c){if(_0x4bf65c){return _0x4bf65c['removeDispositions'](_0x49bd29['query'][_0x5c2c('0x6b')]);}})[_0x5c2c('0x38')](respondWithStatusCode(_0x821aa7,null))[_0x5c2c('0x2b')](handleError(_0x821aa7,null));};exports['addAnswer']=function(_0x51683e,_0x1f88a0,_0x56cb1f){if(_0x51683e['body']['id']){delete _0x51683e[_0x5c2c('0x5b')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x51683e[_0x5c2c('0x63')]['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x1f88a0,null))[_0x5c2c('0x38')](function(_0x2edbf4){if(_0x2edbf4){_0x51683e[_0x5c2c('0x5b')][_0x5c2c('0x68')]=_0x2edbf4['id'];return db[_0x5c2c('0x6c')][_0x5c2c('0x5a')](_0x51683e[_0x5c2c('0x5b')]);}})['then'](respondWithResult(_0x1f88a0,null))[_0x5c2c('0x2b')](handleError(_0x1f88a0,null));};exports[_0x5c2c('0x6d')]=function(_0x2bdf6d,_0x1182a7,_0x4f4fad){var _0x3a659e={'raw':![],'where':{}};var _0x58073d={};var _0x4582fd={'count':0x0,'rows':[]};return db[_0x5c2c('0x41')][_0x5c2c('0x67')]({'where':{'id':_0x2bdf6d[_0x5c2c('0x63')]['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x1182a7,null))[_0x5c2c('0x38')](function(_0x4001cc){if(_0x4001cc){_0x58073d[_0x5c2c('0x45')]=_[_0x5c2c('0x47')](db['CannedAnswer'][_0x5c2c('0x42')]);_0x58073d['query']=_[_0x5c2c('0x47')](_0x2bdf6d['query']);_0x58073d[_0x5c2c('0x48')]=_['intersection'](_0x58073d['model'],_0x58073d[_0x5c2c('0x46')]);_0x3a659e['attributes']=_['intersection'](_0x58073d[_0x5c2c('0x45')],qs[_0x5c2c('0x58')](_0x2bdf6d[_0x5c2c('0x46')]['fields']));_0x3a659e[_0x5c2c('0x4a')]=_0x3a659e[_0x5c2c('0x4a')]['length']?_0x3a659e[_0x5c2c('0x4a')]:_0x58073d[_0x5c2c('0x45')];if(!_0x2bdf6d['query'][_0x5c2c('0x6e')](_0x5c2c('0x4c'))){_0x3a659e[_0x5c2c('0x30')]=qs['limit'](_0x2bdf6d[_0x5c2c('0x46')][_0x5c2c('0x30')]);_0x3a659e[_0x5c2c('0x2f')]=qs['offset'](_0x2bdf6d[_0x5c2c('0x46')]['offset']);}_0x3a659e[_0x5c2c('0x4d')]=qs['sort'](_0x2bdf6d[_0x5c2c('0x46')][_0x5c2c('0x4e')]);_0x3a659e[_0x5c2c('0x4f')]=qs[_0x5c2c('0x48')](_[_0x5c2c('0x50')](_0x2bdf6d['query'],_0x58073d[_0x5c2c('0x48')]));_0x3a659e[_0x5c2c('0x4f')][_0x5c2c('0x68')]=_0x4001cc['id'];if(_0x2bdf6d[_0x5c2c('0x46')]['filter']){_0x3a659e[_0x5c2c('0x4f')]=_[_0x5c2c('0x52')](_0x3a659e[_0x5c2c('0x4f')],{'$or':_[_0x5c2c('0x40')](_0x3a659e[_0x5c2c('0x4a')],function(_0x58df23){var _0x25d193={};_0x25d193[_0x58df23]={'$like':'%'+_0x2bdf6d[_0x5c2c('0x46')]['filter']+'%'};return _0x25d193;})});}_0x3a659e=_['merge']({},_0x3a659e,_0x2bdf6d[_0x5c2c('0x53')]);return db[_0x5c2c('0x6c')]['count']({'where':_0x3a659e[_0x5c2c('0x4f')]})[_0x5c2c('0x38')](function(_0x180a0d){_0x4582fd[_0x5c2c('0x32')]=_0x180a0d;if(_0x2bdf6d[_0x5c2c('0x46')][_0x5c2c('0x54')]){_0x3a659e[_0x5c2c('0x55')]=[{'all':!![]}];}return db[_0x5c2c('0x6c')]['findAll'](_0x3a659e);})[_0x5c2c('0x38')](function(_0xcb3495){_0x4582fd[_0x5c2c('0x56')]=_0xcb3495;return _0x4582fd;});}})[_0x5c2c('0x38')](respondWithFilteredResult(_0x1182a7,_0x3a659e))[_0x5c2c('0x2b')](handleError(_0x1182a7,null));};exports[_0x5c2c('0x6f')]=function(_0x2550a7,_0xbc1e9c,_0x2a6aca){return db[_0x5c2c('0x41')][_0x5c2c('0x59')]({'where':{'id':_0x2550a7[_0x5c2c('0x63')]['id']}})['then'](handleEntityNotFound(_0xbc1e9c,null))['then'](function(_0x28556b){if(_0x28556b){return _0x28556b['removeAnswers'](_0x2550a7[_0x5c2c('0x46')]['ids']);}})[_0x5c2c('0x38')](respondWithStatusCode(_0xbc1e9c,null))[_0x5c2c('0x2b')](handleError(_0xbc1e9c,null));};exports[_0x5c2c('0x70')]=function(_0x377a9b,_0x293946,_0x4bdeaf){var _0x3fdb5d={'channel':'sms'};var _0x15bb5e=[];var _0x447ef8=[];var _0x4bfff2={};return db[_0x5c2c('0x41')][_0x5c2c('0x59')]({'where':{'id':_0x377a9b[_0x5c2c('0x63')]['id']},'include':[{'model':db[_0x5c2c('0x71')],'as':_0x5c2c('0x72')}]})[_0x5c2c('0x38')](handleEntityNotFound(_0x293946,null))[_0x5c2c('0x38')](function(_0x41925e){_0x3fdb5d[_0x5c2c('0x73')]=_0x41925e;_0x3fdb5d[_0x5c2c('0x74')]=_[_0x5c2c('0x75')](_0x41925e[_0x5c2c('0x72')],['priority'],['asc']);if(_0x3fdb5d[_0x5c2c('0x73')][_0x5c2c('0x72')]){delete _0x3fdb5d[_0x5c2c('0x73')][_0x5c2c('0x72')];}return db['CmContact'][_0x5c2c('0x64')]();})[_0x5c2c('0x38')](function(_0xba9476){if(!_0xba9476){throw new db[(_0x5c2c('0x76'))][(_0x5c2c('0x77'))](_0x5c2c('0x78'));}_0x15bb5e=_[_0x5c2c('0x79')](_[_0x5c2c('0x47')](_0xba9476),[_0x5c2c('0x7a'),'updatedAt']);_0x447ef8=_[_0x5c2c('0x79')](_[_0x5c2c('0x47')](_0xba9476),['createdAt',_0x5c2c('0x7b'),_0x5c2c('0x7c'),_0x5c2c('0x7d')]);_0x3fdb5d[_0x5c2c('0x5b')]={'mapKey':'mobile'};if(_0x3fdb5d[_0x5c2c('0x73')]['type']){switch(_0x3fdb5d[_0x5c2c('0x73')]['type']){case'twilio':_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x7e')]=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x7f')];_0x3fdb5d['body']['body']=_0x377a9b['body'][_0x5c2c('0x80')];_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x81')]=_0x377a9b['body'][_0x5c2c('0x82')];break;case _0x5c2c('0x83'):_0x3fdb5d['body']['from']='+'+_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x84')];_0x3fdb5d[_0x5c2c('0x5b')]['body']=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x85')];break;case'connectel':_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x7e')]=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x7e')];_0x3fdb5d['body'][_0x5c2c('0x5b')]=_0x377a9b[_0x5c2c('0x5b')]['message'];break;case'clicksend':_0x3fdb5d['body'][_0x5c2c('0x7e')]=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x7e')];_0x3fdb5d['body'][_0x5c2c('0x5b')]=_0x377a9b['body'][_0x5c2c('0x5b')];_0x3fdb5d[_0x5c2c('0x5b')]['messageId']=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x86')];break;case'plivo':_0x3fdb5d[_0x5c2c('0x5b')]['from']=_0x377a9b['body'][_0x5c2c('0x7f')];_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x5b')]=_0x377a9b[_0x5c2c('0x5b')]['Text'];_0x3fdb5d[_0x5c2c('0x5b')]['messageId']=_0x377a9b['body'][_0x5c2c('0x87')];break;case _0x5c2c('0x88'):_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x7e')]='+'+_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x89')][0x0][_0x5c2c('0x7e')];_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x5b')]=_0x377a9b[_0x5c2c('0x5b')]['results'][0x0][_0x5c2c('0x85')];_0x3fdb5d['body'][_0x5c2c('0x81')]=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x89')][0x0]['messageId'];break;case _0x5c2c('0x8a'):_0x3fdb5d[_0x5c2c('0x5b')]['from']=_0x377a9b[_0x5c2c('0x5b')]['originatingAddress'];_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x5b')]=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x8b')][_0x5c2c('0x29')];break;case _0x5c2c('0x8c'):_0x3fdb5d['body']['from']=_0x377a9b[_0x5c2c('0x5b')]['fromNumber'];_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x5b')]=_0x377a9b['body']['text'];_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x81')]=_0x377a9b[_0x5c2c('0x5b')]['replyMessageId'];break;case'bandwidth':_0x3fdb5d['body'][_0x5c2c('0x81')]=_0x377a9b[_0x5c2c('0x5b')][0x0]['message']['id'];_0x3fdb5d['body'][_0x5c2c('0x7e')]=_0x377a9b[_0x5c2c('0x5b')][0x0][_0x5c2c('0x29')][_0x5c2c('0x7e')];_0x3fdb5d['body'][_0x5c2c('0x5b')]=_0x377a9b['body'][0x0][_0x5c2c('0x29')][_0x5c2c('0x85')];break;case'intelepeer':_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x7e')]=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x7e')];_0x3fdb5d['body'][_0x5c2c('0x5b')]=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x29')];_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x81')]=_0x377a9b[_0x5c2c('0x5b')][_0x5c2c('0x8d')];break;}}if(_0x3fdb5d['body']['id']){delete _0x3fdb5d[_0x5c2c('0x5b')]['id'];}if(_[_0x5c2c('0x8e')](_0x3fdb5d[_0x5c2c('0x5b')]['from'])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x5c2c('0x8e')](_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x5b')])||_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x5b')]===''){throw new db[(_0x5c2c('0x76'))]['ValidationError'](_0x5c2c('0x8f'));}if(_[_0x5c2c('0x8e')](_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x90')])){throw new db[(_0x5c2c('0x76'))][(_0x5c2c('0x77'))](_0x5c2c('0x91')+_0x447ef8);}if(!_[_0x5c2c('0x92')](_0x447ef8,_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x90')])){throw new db[(_0x5c2c('0x76'))][(_0x5c2c('0x77'))](_0x5c2c('0x93')+_0x447ef8);}_0x4bfff2[_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x90')]]=_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x7e')];return db[_0x5c2c('0x94')][_0x5c2c('0x59')]({'where':{'id':_0x3fdb5d['account']['ListId']},'include':[{'model':db[_0x5c2c('0x95')],'as':'Contacts','where':_0x4bfff2,'limit':0x1,'order':[[_0x5c2c('0x7b'),_0x5c2c('0x96')]]}]});})[_0x5c2c('0x38')](handleEntityNotFound(_0x293946,null))[_0x5c2c('0x38')](function(_0x15f4c7){if(_0x15f4c7){_0x3fdb5d[_0x5c2c('0x97')]=_[_0x5c2c('0x98')](_0x15f4c7,['Contacts']);if(_0x15f4c7['Contacts'][_0x5c2c('0x4b')]){return _0x15f4c7[_0x5c2c('0x99')][0x0];}var _0x39e941=_[_0x5c2c('0x1b')](_0x3fdb5d[_0x5c2c('0x5b')],{'firstName':_0x3fdb5d['body'][_0x5c2c('0x7e')],'ListId':_0x15f4c7['id']});_0x39e941[_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x90')]]=_0x3fdb5d['body'][_0x5c2c('0x7e')];return db[_0x5c2c('0x95')][_0x5c2c('0x5a')](_0x39e941,{'fields':_0x15bb5e,'raw':!![]});}})['then'](handleEntityNotFound(_0x293946,null))[_0x5c2c('0x38')](function(_0x4d384b){if(_0x4d384b){_0x3fdb5d[_0x5c2c('0x9a')]=_0x4d384b;var _0x1b25f9={'ContactId':_0x4d384b['id'],'phone':_0x3fdb5d['body']['from'],'SmsAccountId':_0x377a9b[_0x5c2c('0x63')]['id']};var _0x5a8358={'ContactId':_0x4d384b['id'],'SmsAccountId':_0x377a9b[_0x5c2c('0x63')]['id'],'closed':![]};return db[_0x5c2c('0x9b')][_0x5c2c('0x59')]({'where':_0x5a8358})[_0x5c2c('0x38')](function(_0x2a1c6d){if(_0x2a1c6d){return[_0x2a1c6d,![]];}return db[_0x5c2c('0x9b')][_0x5c2c('0x5a')](_0x1b25f9)[_0x5c2c('0x38')](function(_0x1f6f4c){return[_0x1f6f4c,!![]];});});}})[_0x5c2c('0x9c')](function(_0x5706e2,_0x2e51ea){_0x3fdb5d['interaction']=_0x5706e2[_0x5c2c('0x5d')]({'plain':!![]});_0x3fdb5d[_0x5c2c('0x9d')]['created']=![];if(_0x2e51ea){if(_0x3fdb5d['account']['autoclose']){_0x3fdb5d[_0x5c2c('0x74')][_0x5c2c('0x9e')]({'id':0x0,'priority':_0x3fdb5d[_0x5c2c('0x74')][_0x5c2c('0x4b')]+0x1,'app':_0x5c2c('0x9f'),'appdata':_0x5c2c('0xa0'),'interval':_0x5c2c('0xa1')});}_0x3fdb5d[_0x5c2c('0x9d')][_0x5c2c('0xa2')]=!![];}return db['SmsMessage']['create']({'phone':_0x3fdb5d[_0x5c2c('0x5b')]['from'],'messageId':_0x3fdb5d[_0x5c2c('0x5b')]['messageId'],'body':_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0x5b')],'SmsAccountId':_0x377a9b[_0x5c2c('0x63')]['id'],'SmsInteractionId':_0x5706e2['id'],'direction':'in','ContactId':_0x5706e2['ContactId'],'AttachmentId':_0x3fdb5d[_0x5c2c('0x5b')][_0x5c2c('0xa3')]});})[_0x5c2c('0x38')](function(_0x4f948f){_0x3fdb5d[_0x5c2c('0x29')]=_0x4f948f;if(!_0x3fdb5d[_0x5c2c('0x9d')][_0x5c2c('0xa4')])return;return db[_0x5c2c('0xa5')][_0x5c2c('0x59')]({'attributes':['id',_0x5c2c('0x3d')],'where':{'id':_0x3fdb5d['interaction'][_0x5c2c('0xa4')]}});})[_0x5c2c('0x38')](function(_0x47f6d4){if(_0x47f6d4){_0x3fdb5d['applications'][_0x5c2c('0xa6')]({'id':0x0,'priority':0x0,'app':_0x5c2c('0xa7'),'appdata':_0x47f6d4[_0x5c2c('0x3d')]+','+(_0x3fdb5d['account'][_0x5c2c('0xa8')]||0xa),'interval':_0x5c2c('0xa1')});}if(!_0x3fdb5d[_0x5c2c('0x9d')]['queueId'])return;return db[_0x5c2c('0xa9')][_0x5c2c('0x59')]({'attributes':['id',_0x5c2c('0x3d')],'where':{'id':_0x3fdb5d['interaction']['queueId']}});})[_0x5c2c('0x38')](function(_0x4c02ae){if(_0x4c02ae){_0x3fdb5d[_0x5c2c('0x74')][_0x5c2c('0xa6')]({'id':0x0,'priority':0x1,'app':_0x5c2c('0xaa'),'appdata':_0x4c02ae[_0x5c2c('0x3d')]+','+(_0x3fdb5d[_0x5c2c('0x73')][_0x5c2c('0xab')]||0x12c),'interval':_0x5c2c('0xa1')});}return respondWithRpcPromise(_0x5c2c('0xac'),_0x5c2c('0xad'),_0x3fdb5d);})[_0x5c2c('0x38')](function(_0x3bcb22){if(_0x3bcb22){var _0x1f4de0=0xc8;var _0x502e5f='receiveMessage';logger['info'](_0x5c2c('0xae'),_0x502e5f,_0x1f4de0,_0x5c2c('0xaf'));logger[_0x5c2c('0xb0')](_0x5c2c('0xb1'),_0x502e5f,_0x1f4de0,'entity\x20found',JSON[_0x5c2c('0x25')](_0x3bcb22));if(_0x3fdb5d[_0x5c2c('0x73')][_0x5c2c('0x43')]==='twilio'){return _0x293946['status'](_0x1f4de0)[_0x5c2c('0x33')](_0x5c2c('0xb2'),_0x5c2c('0xb3'))[_0x5c2c('0xb4')](_0x5c2c('0xb5'));}else{return _0x293946[_0x5c2c('0x2d')](_0x1f4de0)[_0x5c2c('0x35')](_0x3bcb22);}}})[_0x5c2c('0x2b')](handleError(_0x293946,null));};exports[_0x5c2c('0xb6')]=function(_0x5487c2,_0x57eac0){var _0x429a94=_0x5487c2[_0x5c2c('0x63')]['id'];var _0x2da779=_0x5487c2[_0x5c2c('0x5b')];var _0x32f10d=0xc8;var _0x8ff7c5=null;return db[_0x5c2c('0xb7')][_0x5c2c('0xb8')]({'isolationLevel':db[_0x5c2c('0xb7')][_0x5c2c('0xb9')][_0x5c2c('0xba')][_0x5c2c('0xbb')]},function(_0x3282db){return db[_0x5c2c('0x41')]['findOne']({'where':{'id':_0x429a94},'transaction':_0x3282db})[_0x5c2c('0x38')](function(_0x4bd20f){if(_0x4bd20f){return db[_0x5c2c('0x71')][_0x5c2c('0x39')]({'where':{'SmsAccountId':_0x429a94},'transaction':_0x3282db})[_0x5c2c('0x38')](function(){var _0x2ba93a=_[_0x5c2c('0x40')](_0x2da779,function(_0x17ab0e){_0x17ab0e[_0x5c2c('0x68')]=_0x429a94;return _0x17ab0e;});return db['SmsApplication']['bulkCreate'](_0x2ba93a,{'transaction':_0x3282db});});}else{_0x32f10d=0x194;_0x8ff7c5=[];}});})[_0x5c2c('0x38')](function(){if(_0x32f10d!==0x194){return db['SmsApplication'][_0x5c2c('0xbc')]({'where':{'SmsAccountId':_0x429a94},'order':_0x5c2c('0xbd')})[_0x5c2c('0x38')](function(_0x1c4993){_0x8ff7c5=_0x1c4993;});}})[_0x5c2c('0x2b')](function(_0x1cf040){_0x32f10d=0x1f4;logger[_0x5c2c('0x26')](_0x1cf040[_0x5c2c('0x3c')]);if(_0x1cf040[_0x5c2c('0x3d')]){delete _0x1cf040['name'];}_0x8ff7c5=_0x1cf040;})[_0x5c2c('0xbe')](function(){if(_0x8ff7c5===null){_0x57eac0[_0x5c2c('0x2c')](_0x32f10d);}else{if(_0x32f10d===0x1f4){_0x57eac0[_0x5c2c('0x2d')](_0x32f10d)[_0x5c2c('0xb4')](_0x8ff7c5);}else{_0x57eac0['status'](_0x32f10d)[_0x5c2c('0x35')](_0x8ff7c5);}}});};exports[_0x5c2c('0xbf')]=function(_0x265d0c,_0x307f,_0x3b5466){var _0x1bc1ff={};var _0x3276b6={};var _0x2eadc0;var _0x262d17;return db[_0x5c2c('0x41')][_0x5c2c('0x67')]({'where':{'id':_0x265d0c[_0x5c2c('0x63')]['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x307f,null))['then'](function(_0x5f42d5){if(_0x5f42d5){_0x2eadc0=_0x5f42d5;_0x3276b6['model']=_[_0x5c2c('0x47')](db[_0x5c2c('0x71')][_0x5c2c('0x42')]);_0x3276b6[_0x5c2c('0x46')]=_['keys'](_0x265d0c[_0x5c2c('0x46')]);_0x3276b6[_0x5c2c('0x48')]=_[_0x5c2c('0x49')](_0x3276b6[_0x5c2c('0x45')],_0x3276b6[_0x5c2c('0x46')]);_0x1bc1ff[_0x5c2c('0x4a')]=_['intersection'](_0x3276b6[_0x5c2c('0x45')],qs[_0x5c2c('0x58')](_0x265d0c[_0x5c2c('0x46')][_0x5c2c('0x58')]));_0x1bc1ff[_0x5c2c('0x4a')]=_0x1bc1ff[_0x5c2c('0x4a')]['length']?_0x1bc1ff['attributes']:_0x3276b6['model'];_0x1bc1ff[_0x5c2c('0x4d')]=qs['sort'](_0x265d0c[_0x5c2c('0x46')][_0x5c2c('0x4e')]);_0x1bc1ff[_0x5c2c('0x4f')]=qs[_0x5c2c('0x48')](_[_0x5c2c('0x50')](_0x265d0c[_0x5c2c('0x46')],_0x3276b6['filters']));if(_0x265d0c[_0x5c2c('0x46')][_0x5c2c('0x51')]){_0x1bc1ff[_0x5c2c('0x4f')]=_[_0x5c2c('0x52')](_0x1bc1ff[_0x5c2c('0x4f')],{'$or':_['map'](_0x1bc1ff[_0x5c2c('0x4a')],function(_0x256b2f){var _0x1cb86e={};_0x1cb86e[_0x256b2f]={'$like':'%'+_0x265d0c[_0x5c2c('0x46')][_0x5c2c('0x51')]+'%'};return _0x1cb86e;})});}_0x1bc1ff=_[_0x5c2c('0x52')]({},_0x1bc1ff,_0x265d0c[_0x5c2c('0x53')]);return _0x2eadc0[_0x5c2c('0xbf')](_0x1bc1ff);}})[_0x5c2c('0x38')](function(_0x1dbbcc){if(_0x1dbbcc){_0x262d17=_0x1dbbcc[_0x5c2c('0x4b')];if(!_0x265d0c['query'][_0x5c2c('0x6e')](_0x5c2c('0x4c'))){_0x1bc1ff['limit']=qs[_0x5c2c('0x30')](_0x265d0c[_0x5c2c('0x46')][_0x5c2c('0x30')]);_0x1bc1ff[_0x5c2c('0x2f')]=qs[_0x5c2c('0x2f')](_0x265d0c[_0x5c2c('0x46')]['offset']);}return _0x2eadc0[_0x5c2c('0xbf')](_0x1bc1ff);}})[_0x5c2c('0x38')](function(_0x2fb83f){if(_0x2fb83f){return _0x2fb83f?{'count':_0x262d17,'rows':_0x2fb83f}:null;}})['then'](respondWithResult(_0x307f,null))[_0x5c2c('0x2b')](handleError(_0x307f,null));};exports[_0x5c2c('0xc0')]=function(_0xe4c73d,_0x2b7ffb,_0x13ef72){var _0x18677c={'raw':![],'where':{}};var _0x5775f4={};var _0x1a19f9={'count':0x0,'rows':[]};return db[_0x5c2c('0x41')][_0x5c2c('0x67')]({'where':{'id':_0xe4c73d['params']['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x2b7ffb,null))[_0x5c2c('0x38')](function(_0x5f064c){if(_0x5f064c){_0x5775f4['model']=_[_0x5c2c('0x47')](db['SmsInteraction'][_0x5c2c('0x42')]);_0x5775f4[_0x5c2c('0x46')]=_[_0x5c2c('0x47')](_0xe4c73d['query']);_0x5775f4['filters']=_['intersection'](_0x5775f4['model'],_0x5775f4[_0x5c2c('0x46')]);_0x18677c[_0x5c2c('0x4a')]=_[_0x5c2c('0x49')](_0x5775f4[_0x5c2c('0x45')],qs[_0x5c2c('0x58')](_0xe4c73d[_0x5c2c('0x46')]['fields']));_0x18677c[_0x5c2c('0x4a')]=_0x18677c[_0x5c2c('0x4a')][_0x5c2c('0x4b')]?_0x18677c[_0x5c2c('0x4a')]:_0x5775f4[_0x5c2c('0x45')];if(!_0xe4c73d[_0x5c2c('0x46')]['hasOwnProperty']('nolimit')){_0x18677c[_0x5c2c('0x30')]=qs['limit'](_0xe4c73d[_0x5c2c('0x46')][_0x5c2c('0x30')]);_0x18677c[_0x5c2c('0x2f')]=qs[_0x5c2c('0x2f')](_0xe4c73d[_0x5c2c('0x46')][_0x5c2c('0x2f')]);}_0x18677c[_0x5c2c('0x4d')]=qs[_0x5c2c('0x4e')](_0xe4c73d[_0x5c2c('0x46')][_0x5c2c('0x4e')]);_0x18677c[_0x5c2c('0x4f')]=qs[_0x5c2c('0x48')](_[_0x5c2c('0x50')](_0xe4c73d[_0x5c2c('0x46')],_0x5775f4[_0x5c2c('0x48')]));_0x18677c['where'][_0x5c2c('0x68')]=_0x5f064c['id'];if(_0xe4c73d[_0x5c2c('0x46')][_0x5c2c('0x51')]){_0x18677c['where']=_[_0x5c2c('0x52')](_0x18677c['where'],{'$or':_['map'](_0x18677c[_0x5c2c('0x4a')],function(_0x3fe3de){var _0x2c0804={};_0x2c0804[_0x3fe3de]={'$like':'%'+_0xe4c73d[_0x5c2c('0x46')][_0x5c2c('0x51')]+'%'};return _0x2c0804;})});}_0x18677c=_[_0x5c2c('0x52')]({},_0x18677c,_0xe4c73d[_0x5c2c('0x53')]);return db[_0x5c2c('0x9b')][_0x5c2c('0x32')]({'where':_0x18677c[_0x5c2c('0x4f')]})[_0x5c2c('0x38')](function(_0x49ae1a){_0x1a19f9[_0x5c2c('0x32')]=_0x49ae1a;if(_0xe4c73d[_0x5c2c('0x46')]['includeAll']){_0x18677c[_0x5c2c('0x55')]=[{'model':db[_0x5c2c('0x95')],'as':'Contact','required':![]},{'model':db[_0x5c2c('0xa5')],'as':_0x5c2c('0xc1'),'attributes':[_0x5c2c('0x3d'),_0x5c2c('0xc2'),_0x5c2c('0xc3')],'required':![]},{'model':db[_0x5c2c('0xc4')],'as':_0x5c2c('0xc5'),'attributes':['id',_0x5c2c('0x3d'),_0x5c2c('0xc6')],'where':_0xe4c73d[_0x5c2c('0x46')][_0x5c2c('0xc7')]?{'id':_0xe4c73d[_0x5c2c('0x46')][_0x5c2c('0xc7')]}:undefined,'required':_0xe4c73d['query'][_0x5c2c('0xc7')]?!![]:![]}];}return db['SmsInteraction'][_0x5c2c('0x69')](_0x18677c);})[_0x5c2c('0x38')](function(_0x1e25ba){_0x1a19f9['rows']=_0x1e25ba;return _0x1a19f9;});}})[_0x5c2c('0x38')](respondWithFilteredResult(_0x2b7ffb,_0x18677c))[_0x5c2c('0x2b')](handleError(_0x2b7ffb,null));};exports[_0x5c2c('0xb4')]=function(_0x61f7c9,_0x50389a,_0x398169){var _0x7160d2,_0x296372,_0x20f4fb;if(_[_0x5c2c('0x8e')](_0x61f7c9[_0x5c2c('0x5b')][_0x5c2c('0x5b')])||_0x61f7c9[_0x5c2c('0x5b')][_0x5c2c('0x5b')]===''){throw new db['Sequelize'][(_0x5c2c('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5c2c('0x8e')](_0x61f7c9[_0x5c2c('0x5b')]['to'])){throw new db['Sequelize'][(_0x5c2c('0x77'))](_0x5c2c('0xc8'));}_0x7160d2=_0x61f7c9[_0x5c2c('0x5b')]['to'];return db['SmsAccount'][_0x5c2c('0x59')]({'where':{'id':_0x61f7c9[_0x5c2c('0x63')]['id']},'include':[{'model':db[_0x5c2c('0x94')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x7160d2},'limit':0x1,'order':[[_0x5c2c('0x7b'),_0x5c2c('0x96')]]}]}]})[_0x5c2c('0x38')](handleEntityNotFound(_0x50389a,null))[_0x5c2c('0x38')](function(_0x15be2a){if(_0x15be2a&&_0x15be2a[_0x5c2c('0xc9')]){_0x296372=_0x15be2a[_0x5c2c('0x5d')]({'plain':!![]});if(_0x296372[_0x5c2c('0xc9')]&&_0x296372['List'][_0x5c2c('0x99')][_0x5c2c('0x4b')]){return _0x296372[_0x5c2c('0xc9')]['Contacts'][0x0];}return db[_0x5c2c('0x95')][_0x5c2c('0x5a')](_[_0x5c2c('0x1b')](_0x61f7c9[_0x5c2c('0x5b')],{'firstName':_0x7160d2,'mobile':_0x7160d2,'phone':_0x7160d2,'ListId':_0x296372[_0x5c2c('0x7d')]}));}})[_0x5c2c('0x38')](handleEntityNotFound(_0x50389a,null))['then'](function(_0x42c358){if(_0x42c358){_0x20f4fb=_0x42c358;return db[_0x5c2c('0x9b')][_0x5c2c('0x59')]({'where':{'ContactId':_0x20f4fb['id'],'closed':![],'SmsAccountId':_0x296372['id']}})['then'](function(_0x56f847){if(_0x56f847){return[_0x56f847,![]];}return db['SmsInteraction'][_0x5c2c('0x5a')]({'UserId':_0x61f7c9[_0x5c2c('0x5c')]['id'],'ContactId':_0x20f4fb['id'],'SmsAccountId':_0x296372['id'],'phone':_0x7160d2,'firstMsgDirection':'out','Messages':[_[_0x5c2c('0x52')](_0x61f7c9[_0x5c2c('0x5b')],{'read':![],'body':_0x61f7c9[_0x5c2c('0x5b')][_0x5c2c('0x5b')],'phone':_0x7160d2,'SmsAccountId':_0x296372['id'],'UserId':_0x61f7c9[_0x5c2c('0x5c')]['id'],'ContactId':_0x20f4fb['id']})]},{'include':[{'model':db[_0x5c2c('0xca')],'as':_0x5c2c('0xcb')}]})[_0x5c2c('0x38')](function(_0x2d13c2){return[_0x2d13c2,!![]];});});}})[_0x5c2c('0x9c')](function(_0x4a67a5,_0x494c0d){if(_0x494c0d){return _0x4a67a5;}return db[_0x5c2c('0xca')]['create'](_[_0x5c2c('0x52')](_0x61f7c9[_0x5c2c('0x5b')],{'read':![],'body':_0x61f7c9['body'][_0x5c2c('0x5b')],'phone':_0x7160d2,'SmsAccountId':_0x296372['id'],'SmsInteractionId':_0x4a67a5['id'],'UserId':_0x61f7c9[_0x5c2c('0x5c')]['id'],'ContactId':_0x20f4fb['id']}))[_0x5c2c('0x38')](function(_0x1a9c61){_0x4a67a5[_0x5c2c('0xcc')][_0x5c2c('0xcb')]=[];_0x4a67a5[_0x5c2c('0xcc')][_0x5c2c('0xcb')][_0x5c2c('0x9e')](_0x1a9c61['dataValues']);return _0x4a67a5;});})[_0x5c2c('0x38')](respondWithResult(_0x50389a,null))['catch'](handleError(_0x50389a,null));};exports['status']=function(_0x5af382,_0x1237b6,_0x2a200f){if(_0x5af382[_0x5c2c('0x5b')]['id']){delete _0x5af382[_0x5c2c('0x5b')]['id'];}var _0x3ee107,_0x43511c,_0x373e14;return db[_0x5c2c('0x41')][_0x5c2c('0x59')]({'where':{'id':_0x5af382[_0x5c2c('0x63')]['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x1237b6,null))['then'](function(_0x3e02e6){if(_0x3e02e6){_0x373e14=_0x3e02e6;logger[_0x5c2c('0xb0')](_0x5c2c('0xae'),_0x5c2c('0x2d'),_0x5c2c('0xcd'),_0x3e02e6['type'],util[_0x5c2c('0xce')](_0x5af382[_0x5c2c('0x5b')],{'showHidden':![],'depth':null}));switch(_0x3e02e6[_0x5c2c('0x43')]){case _0x5c2c('0x83'):if(_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xcf')]&&_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x2d')]){_0x43511c=_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x2d')];return db[_0x5c2c('0xca')]['find']({'where':{'messageId':_0x5af382['body'][_0x5c2c('0xcf')]}});}break;case _0x5c2c('0xd0'):if(_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xd1')]&&_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xd2')]){_0x43511c=_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xd2')];return db[_0x5c2c('0xca')][_0x5c2c('0x59')]({'where':{'messageId':_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xd1')]}});}break;case _0x5c2c('0xd3'):if(_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x86')]&&_0x5af382['body']['status_code']){_0x43511c=_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xd4')];return db[_0x5c2c('0xca')]['find']({'where':{'messageId':_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x86')]}});}break;case _0x5c2c('0x88'):var _0x2e47ff=_0x5af382['body'][_0x5c2c('0x89')][0x0];if(_0x2e47ff[_0x5c2c('0x81')]&&_0x2e47ff[_0x5c2c('0x2d')][_0x5c2c('0xd5')]==='DELIVERED'){_0x43511c=_0x2e47ff[_0x5c2c('0x2d')]['groupName'];return db[_0x5c2c('0xca')][_0x5c2c('0x59')]({'where':{'messageId':_0x2e47ff[_0x5c2c('0x81')]}});}break;case _0x5c2c('0x8c'):if(_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x81')]&&_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x2d')]){_0x43511c=_0x5af382['body']['status'];return db[_0x5c2c('0xca')][_0x5c2c('0x59')]({'where':{'messageId':_0x5af382['body'][_0x5c2c('0x81')]}});}break;case'bandwidth':if(_0x5af382[_0x5c2c('0x5b')][0x0][_0x5c2c('0x29')]['id']){_0x43511c=_0x5af382['body'][0x0][_0x5c2c('0x43')];return db[_0x5c2c('0xca')][_0x5c2c('0x59')]({'where':{'messageId':_0x5af382[_0x5c2c('0x5b')][0x0][_0x5c2c('0x29')]['id']}});}break;case _0x5c2c('0xd6'):if(_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xd7')]&&_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x2d')]){_0x43511c=_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x2d')];return db[_0x5c2c('0xca')]['find']({'where':{'messageId':_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xd7')]}});}break;}}})[_0x5c2c('0x38')](handleEntityNotFound(_0x1237b6,null))[_0x5c2c('0x38')](function(_0x488081){if(_0x488081){_0x3ee107=_0x488081;switch(_0x373e14['type']){case _0x5c2c('0x83'):if(_0x43511c===_0x5c2c('0xd8')){return _0x3ee107[_0x5c2c('0x37')]({'read':!![]});}else{logger['error'](_0x5c2c('0xae'),_0x5c2c('0x2d'),'skebby',util[_0x5c2c('0xce')](_0x5af382['body'],{'showHidden':![],'depth':null}));}break;case _0x5c2c('0xd0'):if(_0x43511c==='1'){return _0x3ee107[_0x5c2c('0x37')]({'read':!![]});}else{logger[_0x5c2c('0x26')](_0x5c2c('0xae'),_0x5c2c('0x2d'),_0x5c2c('0x83'),util['inspect'](_0x5af382['body'],{'showHidden':![],'depth':null}));}break;case _0x5c2c('0xd3'):if(!_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0xd9')]&&_0x43511c>=0xc8&&_0x43511c<=0xce){return _0x3ee107[_0x5c2c('0x37')]({'read':!![]});}else{logger['error'](_0x5c2c('0xae'),_0x5c2c('0x2d'),_0x5c2c('0xd3'),util[_0x5c2c('0xce')](_0x5af382['body'],{'showHidden':![],'depth':null}));}break;case _0x5c2c('0x88'):var _0x128eaf=_0x5af382[_0x5c2c('0x5b')][_0x5c2c('0x89')][0x0];if(_0x128eaf[_0x5c2c('0x2d')][_0x5c2c('0xd5')]==='DELIVERED'){return _0x3ee107[_0x5c2c('0x37')]({'read':!![]});}else{logger[_0x5c2c('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5c2c('0x2d'),'infobip',util[_0x5c2c('0xce')](_0x5af382['body'],{'showHidden':![],'depth':null}));}break;case _0x5c2c('0x8c'):if(_0x43511c==_0x5c2c('0xda')||_0x43511c==_0x5c2c('0xdb')){return _0x3ee107[_0x5c2c('0x37')]({'read':!![]});}else{logger[_0x5c2c('0x26')](_0x5c2c('0xae'),_0x5c2c('0x2d'),_0x5c2c('0x8c'),util[_0x5c2c('0xce')](_0x5af382[_0x5c2c('0x5b')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x43511c==_0x5c2c('0xdc')){return _0x3ee107[_0x5c2c('0x37')]({'read':!![]});}else{logger[_0x5c2c('0x26')](_0x5c2c('0xae'),_0x5c2c('0x2d'),_0x5c2c('0xdd'),util['inspect'](_0x5af382['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x43511c===_0x5c2c('0xde')||_0x43511c===_0x5c2c('0xdf')){return _0x3ee107[_0x5c2c('0x37')]({'read':!![]});}else{logger[_0x5c2c('0x26')](_0x5c2c('0xae'),_0x5c2c('0x2d'),_0x5c2c('0xd6'),util[_0x5c2c('0xce')](_0x5af382[_0x5c2c('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x3ee107;}})['then'](respondWithResult(_0x1237b6,null))[_0x5c2c('0x2b')](handleError(_0x1237b6,null));};exports[_0x5c2c('0xe0')]=function(_0x2f0b6b,_0x39fd18,_0x5a111b){var _0xc8505f,_0x130ecc,_0x18c292;return db[_0x5c2c('0x41')][_0x5c2c('0x59')]({'where':{'id':_0x2f0b6b['params']['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x39fd18,null))[_0x5c2c('0x38')](function(_0x47fb8f){if(_0x47fb8f){_0x18c292=_0x47fb8f;logger[_0x5c2c('0xb0')](_0x5c2c('0xae'),_0x5c2c('0x2d'),_0x5c2c('0xcd'),_0x47fb8f[_0x5c2c('0x43')],util[_0x5c2c('0xce')](_0x2f0b6b['query'],{'showHidden':![],'depth':null}));switch(_0x47fb8f[_0x5c2c('0x43')]){case _0x5c2c('0x8a'):if(_0x2f0b6b[_0x5c2c('0x46')][_0x5c2c('0xe1')]&&_0x2f0b6b[_0x5c2c('0x46')]['state']){_0x130ecc=_0x2f0b6b[_0x5c2c('0x46')][_0x5c2c('0xe2')];return db['SmsMessage'][_0x5c2c('0x59')]({'where':{'messageId':_0x2f0b6b['query'][_0x5c2c('0xe1')]}});}break;}}})['then'](handleEntityNotFound(_0x39fd18,null))[_0x5c2c('0x38')](function(_0x187d38){if(_0x187d38){_0xc8505f=_0x187d38;switch(_0x18c292['type']){case'csc':if(_0x130ecc==='2'||_0x130ecc==='6'){return _0xc8505f[_0x5c2c('0x37')]({'read':!![]});}else{logger[_0x5c2c('0x26')](_0x5c2c('0xae'),_0x5c2c('0x2d'),_0x5c2c('0x8a'),util['inspect'](_0x2f0b6b[_0x5c2c('0x46')],{'showHidden':![],'depth':null}));};break;}return _0xc8505f;}})[_0x5c2c('0x38')](respondWithResult(_0x39fd18,null))['catch'](handleError(_0x39fd18,null));};exports[_0x5c2c('0xe3')]=function(_0x598246,_0x19bb48,_0x525bd8){return db[_0x5c2c('0x41')][_0x5c2c('0x59')]({'where':{'id':_0x598246[_0x5c2c('0x63')]['id']}})['then'](handleEntityNotFound(_0x19bb48,null))[_0x5c2c('0x38')](function(_0x76ff32){if(_0x76ff32){return _0x76ff32['addAgents'](_0x598246['body'][_0x5c2c('0x6b')],_['omit'](_0x598246[_0x5c2c('0x5b')],[_0x5c2c('0x6b'),'id'])||{})['spread'](function(_0x54b162){for(var _0x58e208=0x0;_0x58e208<_0x598246[_0x5c2c('0x5b')]['ids'][_0x5c2c('0x4b')];_0x58e208+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x598246[_0x5c2c('0x5b')][_0x5c2c('0x6b')][_0x58e208]),'SmsAccountId':Number(_0x598246[_0x5c2c('0x63')]['id'])});}return _0x54b162;});}})[_0x5c2c('0x38')](respondWithResult(_0x19bb48,null))[_0x5c2c('0x2b')](handleError(_0x19bb48,null));};exports[_0x5c2c('0xe4')]=function(_0x18dd86,_0x11451a,_0x5ca8d1){return db[_0x5c2c('0x41')][_0x5c2c('0x59')]({'where':{'id':_0x18dd86['params']['id']}})[_0x5c2c('0x38')](handleEntityNotFound(_0x11451a,null))['then'](function(_0x324641){if(_0x324641){return _0x324641[_0x5c2c('0xe4')](_0x18dd86[_0x5c2c('0x46')][_0x5c2c('0x6b')])[_0x5c2c('0x38')](function(){if(_[_0x5c2c('0xe5')](_0x18dd86[_0x5c2c('0x46')][_0x5c2c('0x6b')])){for(var _0x44ed93=0x0;_0x44ed93<_0x18dd86[_0x5c2c('0x46')][_0x5c2c('0x6b')][_0x5c2c('0x4b')];_0x44ed93+=0x1){socket[_0x5c2c('0xe6')](_0x5c2c('0xe7'),{'UserId':Number(_0x18dd86[_0x5c2c('0x46')][_0x5c2c('0x6b')][_0x44ed93]),'SmsAccountId':Number(_0x18dd86[_0x5c2c('0x63')]['id'])});}}else{socket['emit'](_0x5c2c('0xe7'),{'UserId':Number(_0x18dd86['query'][_0x5c2c('0x6b')]),'SmsAccountId':Number(_0x18dd86[_0x5c2c('0x63')]['id'])});}});}})[_0x5c2c('0x38')](respondWithStatusCode(_0x11451a,null))[_0x5c2c('0x2b')](handleError(_0x11451a,null));};exports[_0x5c2c('0xe8')]=function(_0x119aa1,_0x52a787,_0x4e6a15){var _0x1ce119={};var _0x5ad5b7={};var _0x4e39a1;var _0x41e9d4;return db[_0x5c2c('0x41')]['findOne']({'where':{'id':_0x119aa1[_0x5c2c('0x63')]['id']}})['then'](handleEntityNotFound(_0x52a787,null))['then'](function(_0x3b4eb1){if(_0x3b4eb1){_0x4e39a1=_0x3b4eb1;_0x5ad5b7[_0x5c2c('0x45')]=_[_0x5c2c('0x47')](db['User']['rawAttributes']);_0x5ad5b7['query']=_[_0x5c2c('0x47')](_0x119aa1[_0x5c2c('0x46')]);_0x5ad5b7[_0x5c2c('0x48')]=_[_0x5c2c('0x49')](_0x5ad5b7[_0x5c2c('0x45')],_0x5ad5b7[_0x5c2c('0x46')]);_0x1ce119[_0x5c2c('0x4a')]=_[_0x5c2c('0x49')](_0x5ad5b7[_0x5c2c('0x45')],qs[_0x5c2c('0x58')](_0x119aa1['query'][_0x5c2c('0x58')]));_0x1ce119[_0x5c2c('0x4a')]=_0x1ce119[_0x5c2c('0x4a')]['length']?_0x1ce119['attributes']:_0x5ad5b7[_0x5c2c('0x45')];_0x1ce119['order']=qs[_0x5c2c('0x4e')](_0x119aa1['query']['sort']);_0x1ce119[_0x5c2c('0x4f')]=qs[_0x5c2c('0x48')](_[_0x5c2c('0x50')](_0x119aa1[_0x5c2c('0x46')],_0x5ad5b7['filters']));if(_0x119aa1[_0x5c2c('0x46')][_0x5c2c('0x51')]){_0x1ce119[_0x5c2c('0x4f')]=_[_0x5c2c('0x52')](_0x1ce119['where'],{'$or':_[_0x5c2c('0x40')](_0x1ce119[_0x5c2c('0x4a')],function(_0x345a4a){var _0x5ef37d={};_0x5ef37d[_0x345a4a]={'$like':'%'+_0x119aa1[_0x5c2c('0x46')]['filter']+'%'};return _0x5ef37d;})});}_0x1ce119=_[_0x5c2c('0x52')]({},_0x1ce119,_0x119aa1[_0x5c2c('0x53')]);return _0x4e39a1[_0x5c2c('0xe8')](_0x1ce119);}})['then'](function(_0x157477){if(_0x157477){_0x41e9d4=_0x157477['length'];if(!_0x119aa1['query'][_0x5c2c('0x6e')](_0x5c2c('0x4c'))){_0x1ce119[_0x5c2c('0x30')]=qs[_0x5c2c('0x30')](_0x119aa1[_0x5c2c('0x46')]['limit']);_0x1ce119[_0x5c2c('0x2f')]=qs[_0x5c2c('0x2f')](_0x119aa1['query']['offset']);}return _0x4e39a1[_0x5c2c('0xe8')](_0x1ce119);}})[_0x5c2c('0x38')](function(_0x2194b5){if(_0x2194b5){return _0x2194b5?{'count':_0x41e9d4,'rows':_0x2194b5}:null;}})[_0x5c2c('0x38')](respondWithResult(_0x52a787,null))[_0x5c2c('0x2b')](handleError(_0x52a787,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index d6f9de6..ff4a7c9 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 _0x60ed=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x239465,_0x17fff1){var _0x2c2cc5=function(_0x33cd11){while(--_0x33cd11){_0x239465['push'](_0x239465['shift']());}};_0x2c2cc5(++_0x17fff1);}(_0x60ed,0xa2));var _0xd60e=function(_0x4446fa,_0x3bc3f4){_0x4446fa=_0x4446fa-0x0;var _0x52f754=_0x60ed[_0x4446fa];return _0x52f754;};'use strict';var EventEmitter=require(_0xd60e('0x0'));var SmsAccount=require(_0xd60e('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xd60e('0x2')](0x0);var events={'afterCreate':_0xd60e('0x3'),'afterUpdate':_0xd60e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2fbcf1){return function(_0x304352,_0x280c06,_0x27e5ae){SmsAccountEvents[_0xd60e('0x5')](_0x2fbcf1+':'+_0x304352['id'],_0x304352);SmsAccountEvents[_0xd60e('0x5')](_0x2fbcf1,_0x304352);_0x27e5ae(null);};}for(var e in events){if(events[_0xd60e('0x6')](e)){var event=events[e];SmsAccount[_0xd60e('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xd6b5=['remove','emit','hasOwnProperty','hook','exports','setMaxListeners','save'];(function(_0x497474,_0x367eec){var _0xf03340=function(_0x4cac62){while(--_0x4cac62){_0x497474['push'](_0x497474['shift']());}};_0xf03340(++_0x367eec);}(_0xd6b5,0xad));var _0x5d6b=function(_0x5e9d51,_0x6d2256){_0x5e9d51=_0x5e9d51-0x0;var _0x10ec8f=_0xd6b5[_0x5e9d51];return _0x10ec8f;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5d6b('0x0')](0x0);var events={'afterCreate':_0x5d6b('0x1'),'afterUpdate':'update','afterDestroy':_0x5d6b('0x2')};function emitEvent(_0x35b60b){return function(_0x11468b,_0x843412,_0x55ba90){SmsAccountEvents[_0x5d6b('0x3')](_0x35b60b+':'+_0x11468b['id'],_0x11468b);SmsAccountEvents[_0x5d6b('0x3')](_0x35b60b,_0x11468b);_0x55ba90(null);};}for(var e in events){if(events[_0x5d6b('0x4')](e)){var event=events[e];SmsAccount[_0x5d6b('0x5')](e,emitEvent(event));}}module[_0x5d6b('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 2ffac89..d7e3da2 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 _0x4ef4=['sms_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','define','SmsAccount'];(function(_0x1accb5,_0x36dc61){var _0x3f6291=function(_0x416289){while(--_0x416289){_0x1accb5['push'](_0x1accb5['shift']());}};_0x3f6291(++_0x36dc61);}(_0x4ef4,0x12d));var _0x44ef=function(_0x49e1c5,_0x1f4a4f){_0x49e1c5=_0x49e1c5-0x0;var _0x576240=_0x4ef4[_0x49e1c5];return _0x576240;};'use strict';var _=require(_0x44ef('0x0'));var util=require(_0x44ef('0x1'));var logger=require(_0x44ef('0x2'))(_0x44ef('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x44ef('0x4'));var fs=require('fs');var path=require(_0x44ef('0x5'));var rimraf=require(_0x44ef('0x6'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module['exports']=function(_0x38e405,_0x4806eb){return _0x38e405[_0x44ef('0x7')](_0x44ef('0x8'),attributes,{'tableName':_0x44ef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4402=['path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts','util','../../config/logger','api','request-promise'];(function(_0x5763f7,_0x55469b){var _0x45905a=function(_0x1eae5c){while(--_0x1eae5c){_0x5763f7['push'](_0x5763f7['shift']());}};_0x45905a(++_0x55469b);}(_0x4402,0x1b4));var _0x2440=function(_0x20d93a,_0x422a10){_0x20d93a=_0x20d93a-0x0;var _0x4e5cec=_0x4402[_0x20d93a];return _0x4e5cec;};'use strict';var _=require('lodash');var util=require(_0x2440('0x0'));var logger=require(_0x2440('0x1'))(_0x2440('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2440('0x3'));var fs=require('fs');var path=require(_0x2440('0x4'));var rimraf=require(_0x2440('0x5'));var config=require(_0x2440('0x6'));var attributes=require(_0x2440('0x7'));module[_0x2440('0x8')]=function(_0x5717fa,_0x5bc164){return _0x5717fa[_0x2440('0x9')]('SmsAccount',attributes,{'tableName':_0x2440('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 40fd545..0e023fe 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 _0xb8ee=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','ShowSmsAccount','find','options','raw','where','attributes','include','map','model','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2b4448,_0x5bcc69){var _0xb4b465=function(_0x5ac741){while(--_0x5ac741){_0x2b4448['push'](_0x2b4448['shift']());}};_0xb4b465(++_0x5bcc69);}(_0xb8ee,0x145));var _0xeb8e=function(_0x412c8f,_0x11ec94){_0x412c8f=_0x412c8f-0x0;var _0x27c005=_0xb8ee[_0x412c8f];return _0x27c005;};'use strict';var _=require(_0xeb8e('0x0'));var util=require('util');var moment=require(_0xeb8e('0x1'));var BPromise=require(_0xeb8e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb8e('0x3'));var db=require(_0xeb8e('0x4'))['db'];var utils=require(_0xeb8e('0x5'));var logger=require(_0xeb8e('0x6'))(_0xeb8e('0x7'));var config=require(_0xeb8e('0x8'));var jayson=require(_0xeb8e('0x9'));var client=jayson['client'][_0xeb8e('0xa')]({'port':0x232a});config[_0xeb8e('0xb')]=_[_0xeb8e('0xc')](config[_0xeb8e('0xb')],{'host':_0xeb8e('0xd'),'port':0x18eb});var socket=require(_0xeb8e('0xe'))(new Redis(config[_0xeb8e('0xb')]));require(_0xeb8e('0xf'))[_0xeb8e('0x10')](socket);function respondWithRpcPromise(_0x3d917a,_0x4af643,_0x562cd9){return new BPromise(function(_0x472757,_0x2f6336){return client['request'](_0x3d917a,_0x562cd9)[_0xeb8e('0x11')](function(_0x11d3c1){logger['info'](_0xeb8e('0x12'),_0x4af643,_0xeb8e('0x13'));logger[_0xeb8e('0x14')](_0xeb8e('0x15'),_0x4af643,_0xeb8e('0x13'),JSON[_0xeb8e('0x16')](_0x11d3c1));if(_0x11d3c1['error']){if(_0x11d3c1[_0xeb8e('0x17')]['code']===0x1f4){logger['error'](_0xeb8e('0x12'),_0x4af643,_0x11d3c1[_0xeb8e('0x17')][_0xeb8e('0x18')]);return _0x2f6336(_0x11d3c1['error'][_0xeb8e('0x18')]);}logger[_0xeb8e('0x17')](_0xeb8e('0x12'),_0x4af643,_0x11d3c1[_0xeb8e('0x17')][_0xeb8e('0x18')]);return _0x472757(_0x11d3c1[_0xeb8e('0x17')][_0xeb8e('0x18')]);}else{logger[_0xeb8e('0x19')](_0xeb8e('0x12'),_0x4af643,_0xeb8e('0x13'));_0x472757(_0x11d3c1[_0xeb8e('0x1a')][_0xeb8e('0x18')]);}})['catch'](function(_0x2456a3){logger[_0xeb8e('0x17')](_0xeb8e('0x12'),_0x4af643,_0x2456a3);_0x2f6336(_0x2456a3);});});}exports[_0xeb8e('0x1b')]=function(_0x3ea0c9){var _0x11dfcd=this;return new Promise(function(_0x403a54,_0x38ed65){return db['SmsAccount'][_0xeb8e('0x1c')]({'raw':_0x3ea0c9[_0xeb8e('0x1d')]?_0x3ea0c9[_0xeb8e('0x1d')][_0xeb8e('0x1e')]===undefined?!![]:![]:!![],'where':_0x3ea0c9[_0xeb8e('0x1d')]?_0x3ea0c9['options'][_0xeb8e('0x1f')]||null:null,'attributes':_0x3ea0c9[_0xeb8e('0x1d')]?_0x3ea0c9[_0xeb8e('0x1d')][_0xeb8e('0x20')]||null:null,'include':_0x3ea0c9[_0xeb8e('0x1d')]?_0x3ea0c9[_0xeb8e('0x1d')][_0xeb8e('0x21')]?_[_0xeb8e('0x22')](_0x3ea0c9[_0xeb8e('0x1d')][_0xeb8e('0x21')],function(_0x3a668c){return{'model':db[_0x3a668c['model']],'as':_0x3a668c['as'],'attributes':_0x3a668c[_0xeb8e('0x20')],'include':_0x3a668c[_0xeb8e('0x21')]?_[_0xeb8e('0x22')](_0x3a668c[_0xeb8e('0x21')],function(_0x5d26a8){return{'model':db[_0x5d26a8[_0xeb8e('0x23')]],'as':_0x5d26a8['as'],'attributes':_0x5d26a8[_0xeb8e('0x20')],'include':_0x5d26a8[_0xeb8e('0x21')]?_['map'](_0x5d26a8[_0xeb8e('0x21')],function(_0x3071a6){return{'model':db[_0x3071a6[_0xeb8e('0x23')]],'as':_0x3071a6['as'],'attributes':_0x3071a6[_0xeb8e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xeb8e('0x11')](function(_0x180ca9){logger[_0xeb8e('0x19')](_0xeb8e('0x1b'),_0x3ea0c9);logger[_0xeb8e('0x14')](_0xeb8e('0x1b'),_0x3ea0c9,JSON[_0xeb8e('0x16')](_0x180ca9));_0x403a54(_0x180ca9);})[_0xeb8e('0x24')](function(_0x517150){logger['error'](_0xeb8e('0x1b'),_0x517150[_0xeb8e('0x18')],_0x3ea0c9);_0x38ed65(_0x11dfcd[_0xeb8e('0x17')](0x1f4,_0x517150[_0xeb8e('0x18')]));});});}; \ No newline at end of file +var _0x8445=['stringify','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','request\x20sent','debug'];(function(_0x525d24,_0x503fcc){var _0x5d96ba=function(_0x42e3dd){while(--_0x42e3dd){_0x525d24['push'](_0x525d24['shift']());}};_0x5d96ba(++_0x503fcc);}(_0x8445,0x154));var _0x5844=function(_0x49225d,_0x312d6c){_0x49225d=_0x49225d-0x0;var _0x2c228f=_0x8445[_0x49225d];return _0x2c228f;};'use strict';var _=require(_0x5844('0x0'));var util=require(_0x5844('0x1'));var moment=require(_0x5844('0x2'));var BPromise=require(_0x5844('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5844('0x4'));var db=require(_0x5844('0x5'))['db'];var utils=require(_0x5844('0x6'));var logger=require('../../config/logger')(_0x5844('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5844('0x8')][_0x5844('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5844('0xa')],{'host':_0x5844('0xb'),'port':0x18eb});var socket=require(_0x5844('0xc'))(new Redis(config[_0x5844('0xa')]));require(_0x5844('0xd'))[_0x5844('0xe')](socket);function respondWithRpcPromise(_0x11eece,_0x283d99,_0x3b100b){return new BPromise(function(_0x4c98c3,_0x256df9){return client[_0x5844('0xf')](_0x11eece,_0x3b100b)[_0x5844('0x10')](function(_0x3be62b){logger[_0x5844('0x11')]('SmsAccount,\x20%s,\x20%s',_0x283d99,_0x5844('0x12'));logger[_0x5844('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x283d99,_0x5844('0x12'),JSON[_0x5844('0x14')](_0x3be62b));if(_0x3be62b['error']){if(_0x3be62b[_0x5844('0x15')][_0x5844('0x16')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x283d99,_0x3be62b[_0x5844('0x15')][_0x5844('0x17')]);return _0x256df9(_0x3be62b[_0x5844('0x15')][_0x5844('0x17')]);}logger[_0x5844('0x15')](_0x5844('0x18'),_0x283d99,_0x3be62b[_0x5844('0x15')][_0x5844('0x17')]);return _0x4c98c3(_0x3be62b['error'][_0x5844('0x17')]);}else{logger[_0x5844('0x11')](_0x5844('0x18'),_0x283d99,_0x5844('0x12'));_0x4c98c3(_0x3be62b[_0x5844('0x19')][_0x5844('0x17')]);}})[_0x5844('0x1a')](function(_0xab9f3){logger[_0x5844('0x15')]('SmsAccount,\x20%s,\x20%s',_0x283d99,_0xab9f3);_0x256df9(_0xab9f3);});});}exports[_0x5844('0x1b')]=function(_0x798263){var _0x499033=this;return new Promise(function(_0x277712,_0x470dbf){return db[_0x5844('0x1c')][_0x5844('0x1d')]({'raw':_0x798263[_0x5844('0x1e')]?_0x798263['options'][_0x5844('0x1f')]===undefined?!![]:![]:!![],'where':_0x798263[_0x5844('0x1e')]?_0x798263[_0x5844('0x1e')][_0x5844('0x20')]||null:null,'attributes':_0x798263[_0x5844('0x1e')]?_0x798263['options'][_0x5844('0x21')]||null:null,'include':_0x798263['options']?_0x798263[_0x5844('0x1e')][_0x5844('0x22')]?_['map'](_0x798263[_0x5844('0x1e')][_0x5844('0x22')],function(_0x1c0034){return{'model':db[_0x1c0034[_0x5844('0x23')]],'as':_0x1c0034['as'],'attributes':_0x1c0034[_0x5844('0x21')],'include':_0x1c0034['include']?_['map'](_0x1c0034['include'],function(_0x17bd93){return{'model':db[_0x17bd93['model']],'as':_0x17bd93['as'],'attributes':_0x17bd93[_0x5844('0x21')],'include':_0x17bd93[_0x5844('0x22')]?_['map'](_0x17bd93['include'],function(_0x147722){return{'model':db[_0x147722[_0x5844('0x23')]],'as':_0x147722['as'],'attributes':_0x147722[_0x5844('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5844('0x10')](function(_0xf3c148){logger[_0x5844('0x11')]('ShowSmsAccount',_0x798263);logger['debug'](_0x5844('0x1b'),_0x798263,JSON[_0x5844('0x14')](_0xf3c148));_0x277712(_0xf3c148);})[_0x5844('0x1a')](function(_0x5ea2ba){logger['error'](_0x5844('0x1b'),_0x5ea2ba[_0x5844('0x17')],_0x798263);_0x470dbf(_0x499033[_0x5844('0x15')](0x1f4,_0x5ea2ba['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 370a160..661ac0e 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index dcbf2e3..86a7e03 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(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0x3e74,0x175));var _0x43e7=function(_0x3c1397,_0x39bf40){_0x3c1397=_0x3c1397-0x0;var _0x3901f8=_0x3e74[_0x3c1397];return _0x3901f8;};'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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 31abde7..3a2d43a 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 _0xa38d=['STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x38616d,_0x22fbe5){var _0x505626=function(_0x5b3a5a){while(--_0x5b3a5a){_0x38616d['push'](_0x38616d['shift']());}};_0x505626(++_0x22fbe5);}(_0xa38d,0xa8));var _0xda38=function(_0x5f4870,_0x3d6316){_0x5f4870=_0x5f4870-0x0;var _0x2be21d=_0xa38d[_0x5f4870];return _0x2be21d;};'use strict';var Sequelize=require(_0xda38('0x0'));module[_0xda38('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xda38('0x2')],'allowNull':![],'defaultValue':_0xda38('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xda38('0x2')]},'interval':{'type':Sequelize[_0xda38('0x2')],'defaultValue':_0xda38('0x4')}}; \ No newline at end of file +var _0x676f=['sequelize','exports','STRING','noop','*,*,*,*'];(function(_0x390fa6,_0x5c9856){var _0x2c814a=function(_0x204a36){while(--_0x204a36){_0x390fa6['push'](_0x390fa6['shift']());}};_0x2c814a(++_0x5c9856);}(_0x676f,0x159));var _0xf676=function(_0x46c013,_0x323ba6){_0x46c013=_0x46c013-0x0;var _0x297dce=_0x676f[_0x46c013];return _0x297dce;};'use strict';var Sequelize=require(_0xf676('0x0'));module[_0xf676('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf676('0x2')],'allowNull':![],'defaultValue':_0xf676('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf676('0x2')]},'interval':{'type':Sequelize[_0xf676('0x2')],'defaultValue':_0xf676('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 6775f3a..b93ac27 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 _0x210d=['moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','send','index','SmsApplication','rawAttributes','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x210d,0x1a6));var _0xd210=function(_0x4fa0ea,_0x2cd534){_0x4fa0ea=_0x4fa0ea-0x0;var _0x51d027=_0x210d[_0x4fa0ea];return _0x51d027;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd210('0x0'));var zipdir=require(_0xd210('0x1'));var jsonpatch=require(_0xd210('0x2'));var rp=require(_0xd210('0x3'));var moment=require(_0xd210('0x4'));var BPromise=require(_0xd210('0x5'));var Mustache=require(_0xd210('0x6'));var util=require('util');var path=require(_0xd210('0x7'));var sox=require(_0xd210('0x8'));var csv=require(_0xd210('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd210('0xa'));var _=require(_0xd210('0xb'));var squel=require('squel');var crypto=require(_0xd210('0xc'));var jsforce=require(_0xd210('0xd'));var deskjs=require(_0xd210('0xe'));var toCsv=require(_0xd210('0x9'));var querystring=require('querystring');var Papa=require(_0xd210('0xf'));var Redis=require('ioredis');var authService=require(_0xd210('0x10'));var qs=require(_0xd210('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd210('0x12'));var logger=require('../../config/logger')(_0xd210('0x13'));var utils=require(_0xd210('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd210('0x15'))['db'];function respondWithStatusCode(_0x983694,_0x2d9d89){_0x2d9d89=_0x2d9d89||0xcc;return function(_0x22cca2){if(_0x22cca2){return _0x983694['sendStatus'](_0x2d9d89);}return _0x983694[_0xd210('0x16')](_0x2d9d89)[_0xd210('0x17')]();};}function respondWithResult(_0x27fd57,_0x76f196){_0x76f196=_0x76f196||0xc8;return function(_0xe7b518){if(_0xe7b518){return _0x27fd57[_0xd210('0x16')](_0x76f196)[_0xd210('0x18')](_0xe7b518);}};}function respondWithFilteredResult(_0x3599de,_0x189f36){return function(_0x235ced){if(_0x235ced){var _0xac2e30=typeof _0x189f36['offset']===_0xd210('0x19')&&typeof _0x189f36[_0xd210('0x1a')]===_0xd210('0x19');var _0x5f2e39=_0x235ced[_0xd210('0x1b')];var _0x11b79d=_0xac2e30?0x0:_0x189f36[_0xd210('0x1c')];var _0x2b7842=_0xac2e30?_0x235ced['count']:_0x189f36[_0xd210('0x1c')]+_0x189f36['limit'];var _0x2970d8;if(_0x2b7842>=_0x5f2e39){_0x2b7842=_0x5f2e39;_0x2970d8=0xc8;}else{_0x2970d8=0xce;}_0x3599de['status'](_0x2970d8);return _0x3599de[_0xd210('0x1d')](_0xd210('0x1e'),_0x11b79d+'-'+_0x2b7842+'/'+_0x5f2e39)[_0xd210('0x18')](_0x235ced);}return null;};}function patchUpdates(_0x2c94d1){return function(_0x1e5894){try{jsonpatch['apply'](_0x1e5894,_0x2c94d1,!![]);}catch(_0x5e23ef){return BPromise[_0xd210('0x1f')](_0x5e23ef);}return _0x1e5894[_0xd210('0x20')]();};}function saveUpdates(_0x4f5161,_0x9b68f1){return function(_0x5d3074){if(_0x5d3074){return _0x5d3074[_0xd210('0x21')](_0x4f5161)[_0xd210('0x22')](function(_0x35f626){return _0x35f626;});}return null;};}function removeEntity(_0x46d9d7,_0x2f3722){return function(_0x2772ef){if(_0x2772ef){return _0x2772ef[_0xd210('0x23')]()[_0xd210('0x22')](function(){_0x46d9d7['status'](0xcc)[_0xd210('0x17')]();});}};}function handleEntityNotFound(_0x215f04,_0x43aa36){return function(_0x46d91b){if(!_0x46d91b){_0x215f04[_0xd210('0x24')](0x194);}return _0x46d91b;};}function handleError(_0x5dc746,_0x35d8c7){_0x35d8c7=_0x35d8c7||0x1f4;return function(_0x1edefe){logger[_0xd210('0x25')](_0x1edefe[_0xd210('0x26')]);if(_0x1edefe['name']){delete _0x1edefe['name'];}_0x5dc746['status'](_0x35d8c7)[_0xd210('0x27')](_0x1edefe);};}exports[_0xd210('0x28')]=function(_0x4d2b61,_0x3f8246){var _0x5a5571={},_0x1e302d={},_0x41973e={'count':0x0,'rows':[]};var _0x2ba354=_['map'](db[_0xd210('0x29')][_0xd210('0x2a')],function(_0x5c755e){return{'name':_0x5c755e['fieldName'],'type':_0x5c755e[_0xd210('0x2b')]['key']};});_0x1e302d[_0xd210('0x2c')]=_[_0xd210('0x2d')](_0x2ba354,_0xd210('0x2e'));_0x1e302d[_0xd210('0x2f')]=_[_0xd210('0x30')](_0x4d2b61[_0xd210('0x2f')]);_0x1e302d[_0xd210('0x31')]=_[_0xd210('0x32')](_0x1e302d[_0xd210('0x2c')],_0x1e302d[_0xd210('0x2f')]);_0x5a5571[_0xd210('0x33')]=_['intersection'](_0x1e302d[_0xd210('0x2c')],qs[_0xd210('0x34')](_0x4d2b61[_0xd210('0x2f')][_0xd210('0x34')]));_0x5a5571[_0xd210('0x33')]=_0x5a5571[_0xd210('0x33')][_0xd210('0x35')]?_0x5a5571[_0xd210('0x33')]:_0x1e302d['model'];if(!_0x4d2b61[_0xd210('0x2f')]['hasOwnProperty'](_0xd210('0x36'))){_0x5a5571['limit']=qs[_0xd210('0x1a')](_0x4d2b61['query'][_0xd210('0x1a')]);_0x5a5571[_0xd210('0x1c')]=qs[_0xd210('0x1c')](_0x4d2b61[_0xd210('0x2f')][_0xd210('0x1c')]);}_0x5a5571[_0xd210('0x37')]=qs[_0xd210('0x38')](_0x4d2b61[_0xd210('0x2f')][_0xd210('0x38')]);_0x5a5571[_0xd210('0x39')]=qs[_0xd210('0x31')](_['pick'](_0x4d2b61[_0xd210('0x2f')],_0x1e302d[_0xd210('0x31')]),_0x2ba354);if(_0x4d2b61[_0xd210('0x2f')][_0xd210('0x3a')]){_0x5a5571['where']=_['merge'](_0x5a5571['where'],{'$or':_['map'](_0x2ba354,function(_0x237895){if(_0x237895[_0xd210('0x2b')]!==_0xd210('0x3b')){var _0x5d2be3={};_0x5d2be3[_0x237895[_0xd210('0x2e')]]={'$like':'%'+_0x4d2b61[_0xd210('0x2f')]['filter']+'%'};return _0x5d2be3;}})});}_0x5a5571=_[_0xd210('0x3c')]({},_0x5a5571,_0x4d2b61['options']);var _0x36acc5={'where':_0x5a5571[_0xd210('0x39')]};return db[_0xd210('0x29')][_0xd210('0x1b')](_0x36acc5)[_0xd210('0x22')](function(_0x177ed0){_0x41973e[_0xd210('0x1b')]=_0x177ed0;if(_0x4d2b61['query'][_0xd210('0x3d')]){_0x5a5571[_0xd210('0x3e')]=[{'all':!![]}];}return db[_0xd210('0x29')][_0xd210('0x3f')](_0x5a5571);})[_0xd210('0x22')](function(_0x3b3e71){_0x41973e['rows']=_0x3b3e71;return _0x41973e;})[_0xd210('0x22')](respondWithFilteredResult(_0x3f8246,_0x5a5571))[_0xd210('0x40')](handleError(_0x3f8246,null));};exports[_0xd210('0x41')]=function(_0x162e6c,_0x3dc063){var _0x16d37a={'raw':!![],'where':{'id':_0x162e6c['params']['id']}},_0x5dc17e={};_0x5dc17e[_0xd210('0x2c')]=_['keys'](db[_0xd210('0x29')][_0xd210('0x2a')]);_0x5dc17e['query']=_[_0xd210('0x30')](_0x162e6c[_0xd210('0x2f')]);_0x5dc17e[_0xd210('0x31')]=_[_0xd210('0x32')](_0x5dc17e[_0xd210('0x2c')],_0x5dc17e[_0xd210('0x2f')]);_0x16d37a['attributes']=_[_0xd210('0x32')](_0x5dc17e['model'],qs[_0xd210('0x34')](_0x162e6c[_0xd210('0x2f')][_0xd210('0x34')]));_0x16d37a[_0xd210('0x33')]=_0x16d37a[_0xd210('0x33')][_0xd210('0x35')]?_0x16d37a[_0xd210('0x33')]:_0x5dc17e[_0xd210('0x2c')];if(_0x162e6c[_0xd210('0x2f')]['includeAll']){_0x16d37a[_0xd210('0x3e')]=[{'all':!![]}];}_0x16d37a=_['merge']({},_0x16d37a,_0x162e6c[_0xd210('0x42')]);return db['SmsApplication'][_0xd210('0x43')](_0x16d37a)['then'](handleEntityNotFound(_0x3dc063,null))[_0xd210('0x22')](respondWithResult(_0x3dc063,null))[_0xd210('0x40')](handleError(_0x3dc063,null));};exports[_0xd210('0x44')]=function(_0x57d926,_0x399350){return db[_0xd210('0x29')][_0xd210('0x44')](_0x57d926[_0xd210('0x45')],{})[_0xd210('0x22')](respondWithResult(_0x399350,0xc9))['catch'](handleError(_0x399350,null));};exports[_0xd210('0x21')]=function(_0x329540,_0x55219c){if(_0x329540[_0xd210('0x45')]['id']){delete _0x329540[_0xd210('0x45')]['id'];}return db[_0xd210('0x29')][_0xd210('0x43')]({'where':{'id':_0x329540['params']['id']}})[_0xd210('0x22')](handleEntityNotFound(_0x55219c,null))[_0xd210('0x22')](saveUpdates(_0x329540[_0xd210('0x45')],null))[_0xd210('0x22')](respondWithResult(_0x55219c,null))['catch'](handleError(_0x55219c,null));};exports[_0xd210('0x23')]=function(_0x45cdec,_0x19d57b){return db[_0xd210('0x29')][_0xd210('0x43')]({'where':{'id':_0x45cdec[_0xd210('0x46')]['id']}})[_0xd210('0x22')](handleEntityNotFound(_0x19d57b,null))[_0xd210('0x22')](removeEntity(_0x19d57b,null))[_0xd210('0x40')](handleError(_0x19d57b,null));}; \ No newline at end of file +var _0x42d9=['reject','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsApplication','then','includeAll','include','rows','catch','show','intersection','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0x42d9,0x72));var _0x942d=function(_0x1dbbce,_0x48410a){_0x1dbbce=_0x1dbbce-0x0;var _0x30b20d=_0x42d9[_0x1dbbce];return _0x30b20d;};'use strict';var emlformat=require(_0x942d('0x0'));var rimraf=require(_0x942d('0x1'));var zipdir=require(_0x942d('0x2'));var jsonpatch=require(_0x942d('0x3'));var rp=require('request-promise');var moment=require(_0x942d('0x4'));var BPromise=require(_0x942d('0x5'));var Mustache=require(_0x942d('0x6'));var util=require(_0x942d('0x7'));var path=require(_0x942d('0x8'));var sox=require('sox');var csv=require(_0x942d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x942d('0xa'));var _=require(_0x942d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x942d('0xc'));var deskjs=require(_0x942d('0xd'));var toCsv=require(_0x942d('0x9'));var querystring=require(_0x942d('0xe'));var Papa=require('papaparse');var Redis=require(_0x942d('0xf'));var authService=require(_0x942d('0x10'));var qs=require(_0x942d('0x11'));var as=require(_0x942d('0x12'));var hardwareService=require(_0x942d('0x13'));var logger=require(_0x942d('0x14'))(_0x942d('0x15'));var utils=require(_0x942d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x942d('0x17'));var db=require(_0x942d('0x18'))['db'];function respondWithStatusCode(_0xaa3040,_0x4509ac){_0x4509ac=_0x4509ac||0xcc;return function(_0x241296){if(_0x241296){return _0xaa3040[_0x942d('0x19')](_0x4509ac);}return _0xaa3040['status'](_0x4509ac)[_0x942d('0x1a')]();};}function respondWithResult(_0x2b10cd,_0x11f1f1){_0x11f1f1=_0x11f1f1||0xc8;return function(_0x5536c4){if(_0x5536c4){return _0x2b10cd[_0x942d('0x1b')](_0x11f1f1)[_0x942d('0x1c')](_0x5536c4);}};}function respondWithFilteredResult(_0x46a80f,_0x1b1295){return function(_0x317617){if(_0x317617){var _0x326d6b=typeof _0x1b1295['offset']===_0x942d('0x1d')&&typeof _0x1b1295[_0x942d('0x1e')]===_0x942d('0x1d');var _0xa3c872=_0x317617[_0x942d('0x1f')];var _0x5815f9=_0x326d6b?0x0:_0x1b1295['offset'];var _0x37261f=_0x326d6b?_0x317617['count']:_0x1b1295[_0x942d('0x20')]+_0x1b1295['limit'];var _0x12c228;if(_0x37261f>=_0xa3c872){_0x37261f=_0xa3c872;_0x12c228=0xc8;}else{_0x12c228=0xce;}_0x46a80f[_0x942d('0x1b')](_0x12c228);return _0x46a80f[_0x942d('0x21')](_0x942d('0x22'),_0x5815f9+'-'+_0x37261f+'/'+_0xa3c872)[_0x942d('0x1c')](_0x317617);}return null;};}function patchUpdates(_0x58eb23){return function(_0x113317){try{jsonpatch[_0x942d('0x23')](_0x113317,_0x58eb23,!![]);}catch(_0x5ddef9){return BPromise[_0x942d('0x24')](_0x5ddef9);}return _0x113317['save']();};}function saveUpdates(_0x5c96f8,_0x2cee41){return function(_0x23414c){if(_0x23414c){return _0x23414c[_0x942d('0x25')](_0x5c96f8)['then'](function(_0x3eb042){return _0x3eb042;});}return null;};}function removeEntity(_0x4a59f5,_0x1cdc17){return function(_0x44e7f7){if(_0x44e7f7){return _0x44e7f7[_0x942d('0x26')]()['then'](function(){_0x4a59f5[_0x942d('0x1b')](0xcc)[_0x942d('0x1a')]();});}};}function handleEntityNotFound(_0x4c031b,_0x33b324){return function(_0x2c1eee){if(!_0x2c1eee){_0x4c031b[_0x942d('0x19')](0x194);}return _0x2c1eee;};}function handleError(_0x434ea7,_0x3cfd96){_0x3cfd96=_0x3cfd96||0x1f4;return function(_0x3d7102){logger['error'](_0x3d7102[_0x942d('0x27')]);if(_0x3d7102[_0x942d('0x28')]){delete _0x3d7102[_0x942d('0x28')];}_0x434ea7[_0x942d('0x1b')](_0x3cfd96)[_0x942d('0x29')](_0x3d7102);};}exports['index']=function(_0x592f66,_0x318458){var _0x38d0bb={},_0x2c2999={},_0x1a7566={'count':0x0,'rows':[]};var _0x1e0f3c=_[_0x942d('0x2a')](db['SmsApplication'][_0x942d('0x2b')],function(_0x2dc846){return{'name':_0x2dc846[_0x942d('0x2c')],'type':_0x2dc846[_0x942d('0x2d')][_0x942d('0x2e')]};});_0x2c2999['model']=_[_0x942d('0x2a')](_0x1e0f3c,_0x942d('0x28'));_0x2c2999[_0x942d('0x2f')]=_[_0x942d('0x30')](_0x592f66[_0x942d('0x2f')]);_0x2c2999['filters']=_['intersection'](_0x2c2999[_0x942d('0x31')],_0x2c2999[_0x942d('0x2f')]);_0x38d0bb[_0x942d('0x32')]=_['intersection'](_0x2c2999[_0x942d('0x31')],qs[_0x942d('0x33')](_0x592f66['query'][_0x942d('0x33')]));_0x38d0bb[_0x942d('0x32')]=_0x38d0bb['attributes'][_0x942d('0x34')]?_0x38d0bb[_0x942d('0x32')]:_0x2c2999['model'];if(!_0x592f66['query'][_0x942d('0x35')](_0x942d('0x36'))){_0x38d0bb['limit']=qs[_0x942d('0x1e')](_0x592f66['query'][_0x942d('0x1e')]);_0x38d0bb[_0x942d('0x20')]=qs[_0x942d('0x20')](_0x592f66[_0x942d('0x2f')][_0x942d('0x20')]);}_0x38d0bb['order']=qs[_0x942d('0x37')](_0x592f66['query'][_0x942d('0x37')]);_0x38d0bb[_0x942d('0x38')]=qs[_0x942d('0x39')](_[_0x942d('0x3a')](_0x592f66[_0x942d('0x2f')],_0x2c2999[_0x942d('0x39')]),_0x1e0f3c);if(_0x592f66[_0x942d('0x2f')][_0x942d('0x3b')]){_0x38d0bb[_0x942d('0x38')]=_[_0x942d('0x3c')](_0x38d0bb['where'],{'$or':_[_0x942d('0x2a')](_0x1e0f3c,function(_0xae72f7){if(_0xae72f7[_0x942d('0x2d')]!==_0x942d('0x3d')){var _0x392477={};_0x392477[_0xae72f7[_0x942d('0x28')]]={'$like':'%'+_0x592f66['query']['filter']+'%'};return _0x392477;}})});}_0x38d0bb=_[_0x942d('0x3c')]({},_0x38d0bb,_0x592f66[_0x942d('0x3e')]);var _0x4533ea={'where':_0x38d0bb['where']};return db[_0x942d('0x3f')][_0x942d('0x1f')](_0x4533ea)[_0x942d('0x40')](function(_0x1ab818){_0x1a7566[_0x942d('0x1f')]=_0x1ab818;if(_0x592f66[_0x942d('0x2f')][_0x942d('0x41')]){_0x38d0bb[_0x942d('0x42')]=[{'all':!![]}];}return db[_0x942d('0x3f')]['findAll'](_0x38d0bb);})['then'](function(_0x292c95){_0x1a7566[_0x942d('0x43')]=_0x292c95;return _0x1a7566;})[_0x942d('0x40')](respondWithFilteredResult(_0x318458,_0x38d0bb))[_0x942d('0x44')](handleError(_0x318458,null));};exports[_0x942d('0x45')]=function(_0x57dafc,_0x4b6fb4){var _0x331b2c={'raw':!![],'where':{'id':_0x57dafc['params']['id']}},_0x528ffb={};_0x528ffb[_0x942d('0x31')]=_[_0x942d('0x30')](db['SmsApplication'][_0x942d('0x2b')]);_0x528ffb[_0x942d('0x2f')]=_['keys'](_0x57dafc[_0x942d('0x2f')]);_0x528ffb['filters']=_[_0x942d('0x46')](_0x528ffb[_0x942d('0x31')],_0x528ffb[_0x942d('0x2f')]);_0x331b2c['attributes']=_[_0x942d('0x46')](_0x528ffb[_0x942d('0x31')],qs[_0x942d('0x33')](_0x57dafc[_0x942d('0x2f')]['fields']));_0x331b2c['attributes']=_0x331b2c['attributes'][_0x942d('0x34')]?_0x331b2c[_0x942d('0x32')]:_0x528ffb[_0x942d('0x31')];if(_0x57dafc[_0x942d('0x2f')]['includeAll']){_0x331b2c[_0x942d('0x42')]=[{'all':!![]}];}_0x331b2c=_[_0x942d('0x3c')]({},_0x331b2c,_0x57dafc[_0x942d('0x3e')]);return db[_0x942d('0x3f')][_0x942d('0x47')](_0x331b2c)[_0x942d('0x40')](handleEntityNotFound(_0x4b6fb4,null))[_0x942d('0x40')](respondWithResult(_0x4b6fb4,null))[_0x942d('0x44')](handleError(_0x4b6fb4,null));};exports[_0x942d('0x48')]=function(_0x459133,_0x2b2245){return db[_0x942d('0x3f')][_0x942d('0x48')](_0x459133[_0x942d('0x49')],{})[_0x942d('0x40')](respondWithResult(_0x2b2245,0xc9))[_0x942d('0x44')](handleError(_0x2b2245,null));};exports[_0x942d('0x25')]=function(_0x2d1d2a,_0x1bd5fe){if(_0x2d1d2a[_0x942d('0x49')]['id']){delete _0x2d1d2a['body']['id'];}return db[_0x942d('0x3f')][_0x942d('0x47')]({'where':{'id':_0x2d1d2a[_0x942d('0x4a')]['id']}})[_0x942d('0x40')](handleEntityNotFound(_0x1bd5fe,null))[_0x942d('0x40')](saveUpdates(_0x2d1d2a[_0x942d('0x49')],null))[_0x942d('0x40')](respondWithResult(_0x1bd5fe,null))[_0x942d('0x44')](handleError(_0x1bd5fe,null));};exports[_0x942d('0x26')]=function(_0x35ecfa,_0x387112){return db['SmsApplication'][_0x942d('0x47')]({'where':{'id':_0x35ecfa[_0x942d('0x4a')]['id']}})[_0x942d('0x40')](handleEntityNotFound(_0x387112,null))['then'](removeEntity(_0x387112,null))[_0x942d('0x44')](handleError(_0x387112,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 24d64f6..16f0f4b 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 _0x50fe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','utf8mb4','lodash','util'];(function(_0x29dea7,_0x16180e){var _0x267fb2=function(_0x66b0a7){while(--_0x66b0a7){_0x29dea7['push'](_0x29dea7['shift']());}};_0x267fb2(++_0x16180e);}(_0x50fe,0x12a));var _0xe50f=function(_0x5db17e,_0x11bc5d){_0x5db17e=_0x5db17e-0x0;var _0x498ab2=_0x50fe[_0x5db17e];return _0x498ab2;};'use strict';var _=require(_0xe50f('0x0'));var util=require(_0xe50f('0x1'));var logger=require(_0xe50f('0x2'))(_0xe50f('0x3'));var moment=require(_0xe50f('0x4'));var BPromise=require(_0xe50f('0x5'));var rp=require(_0xe50f('0x6'));var fs=require('fs');var path=require(_0xe50f('0x7'));var rimraf=require(_0xe50f('0x8'));var config=require(_0xe50f('0x9'));var attributes=require(_0xe50f('0xa'));module[_0xe50f('0xb')]=function(_0x2d5f2d,_0x13333c){return _0x2d5f2d[_0xe50f('0xc')](_0xe50f('0xd'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe50f('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7080=['exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x20533c,_0x462c3f){var _0x3ca723=function(_0x2292ff){while(--_0x2292ff){_0x20533c['push'](_0x20533c['shift']());}};_0x3ca723(++_0x462c3f);}(_0x7080,0xa0));var _0x0708=function(_0x54daf5,_0x528643){_0x54daf5=_0x54daf5-0x0;var _0xf70158=_0x7080[_0x54daf5];return _0xf70158;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0708('0x0'))(_0x0708('0x1'));var moment=require(_0x0708('0x2'));var BPromise=require(_0x0708('0x3'));var rp=require(_0x0708('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0708('0x5'));var config=require(_0x0708('0x6'));var attributes=require(_0x0708('0x7'));module[_0x0708('0x8')]=function(_0x485d5a,_0x278cab){return _0x485d5a[_0x0708('0x9')](_0x0708('0xa'),attributes,{'tableName':_0x0708('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0708('0xc'),'collate':_0x0708('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index c619b5c..d0a309f 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 _0x6b1b=['info','request\x20sent','stringify','error','SmsApplication,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x10f71e,_0x56a6f4){var _0x110a16=function(_0x154952){while(--_0x154952){_0x10f71e['push'](_0x10f71e['shift']());}};_0x110a16(++_0x56a6f4);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6b1b[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xb6b1('0x0'));var moment=require(_0xb6b1('0x1'));var BPromise=require(_0xb6b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6b1('0x3'));var db=require(_0xb6b1('0x4'))['db'];var utils=require(_0xb6b1('0x5'));var logger=require(_0xb6b1('0x6'))(_0xb6b1('0x7'));var config=require(_0xb6b1('0x8'));var jayson=require(_0xb6b1('0x9'));var client=jayson[_0xb6b1('0xa')][_0xb6b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13334e,_0x1a4cd0,_0x5b440a){return new BPromise(function(_0x2734cc,_0x52aa76){return client['request'](_0x13334e,_0x5b440a)[_0xb6b1('0xc')](function(_0x58027c){logger[_0xb6b1('0xd')]('SmsApplication,\x20%s,\x20%s',_0x1a4cd0,'request\x20sent');logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x1a4cd0,_0xb6b1('0xe'),JSON[_0xb6b1('0xf')](_0x58027c));if(_0x58027c['error']){if(_0x58027c[_0xb6b1('0x10')]['code']===0x1f4){logger['error'](_0xb6b1('0x11'),_0x1a4cd0,_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);return _0x52aa76(_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);}logger[_0xb6b1('0x10')](_0xb6b1('0x11'),_0x1a4cd0,_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);return _0x2734cc(_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);}else{logger[_0xb6b1('0xd')]('SmsApplication,\x20%s,\x20%s',_0x1a4cd0,'request\x20sent');_0x2734cc(_0x58027c['result']['message']);}})[_0xb6b1('0x13')](function(_0x12c595){logger[_0xb6b1('0x10')](_0xb6b1('0x11'),_0x1a4cd0,_0x12c595);_0x52aa76(_0x12c595);});});} \ No newline at end of file +var _0x87bc=['http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','client'];(function(_0xab9f3d,_0xb336fa){var _0x5283bf=function(_0x505e6c){while(--_0x505e6c){_0xab9f3d['push'](_0xab9f3d['shift']());}};_0x5283bf(++_0xb336fa);}(_0x87bc,0x189));var _0xc87b=function(_0x28a37a,_0x5a41f1){_0x28a37a=_0x28a37a-0x0;var _0xdc47a5=_0x87bc[_0x28a37a];return _0xdc47a5;};'use strict';var _=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var moment=require('moment');var BPromise=require(_0xc87b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc87b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc87b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc87b('0x5')][_0xc87b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x402aac,_0x5d1813,_0x50b19b){return new BPromise(function(_0x4ed0c5,_0x1999f8){return client[_0xc87b('0x7')](_0x402aac,_0x50b19b)[_0xc87b('0x8')](function(_0x19b571){logger[_0xc87b('0x9')](_0xc87b('0xa'),_0x5d1813,_0xc87b('0xb'));logger[_0xc87b('0xc')](_0xc87b('0xd'),_0x5d1813,'request\x20sent',JSON['stringify'](_0x19b571));if(_0x19b571[_0xc87b('0xe')]){if(_0x19b571['error'][_0xc87b('0xf')]===0x1f4){logger[_0xc87b('0xe')](_0xc87b('0xa'),_0x5d1813,_0x19b571[_0xc87b('0xe')]['message']);return _0x1999f8(_0x19b571[_0xc87b('0xe')]['message']);}logger[_0xc87b('0xe')](_0xc87b('0xa'),_0x5d1813,_0x19b571['error'][_0xc87b('0x10')]);return _0x4ed0c5(_0x19b571[_0xc87b('0xe')]['message']);}else{logger[_0xc87b('0x9')](_0xc87b('0xa'),_0x5d1813,_0xc87b('0xb'));_0x4ed0c5(_0x19b571[_0xc87b('0x11')][_0xc87b('0x10')]);}})[_0xc87b('0x12')](function(_0x4009ef){logger[_0xc87b('0xe')]('SmsApplication,\x20%s,\x20%s',_0x5d1813,_0x4009ef);_0x1999f8(_0x4009ef);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 3a337de..457c908 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 _0x3266=['isAuthenticated','index','get','/:id','show','getMessages','/:id/download','download','post','create','addMessage','sms','smsinteraction:addtags','addTags','put','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller'];(function(_0x271f5b,_0x2c9f13){var _0x184066=function(_0x2f307f){while(--_0x2f307f){_0x271f5b['push'](_0x271f5b['shift']());}};_0x184066(++_0x2c9f13);}(_0x3266,0x6a));var _0x6326=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0x3266[_0x22b8a3];return _0x199a0c;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var fs_extra=require(_0x6326('0x6'));var auth=require(_0x6326('0x7'));var interaction=require(_0x6326('0x8'));var config=require('../../config/environment');var controller=require(_0x6326('0x9'));router['get']('/',auth[_0x6326('0xa')](),controller[_0x6326('0xb')]);router[_0x6326('0xc')]('/describe',auth[_0x6326('0xa')](),controller['describe']);router[_0x6326('0xc')](_0x6326('0xd'),auth[_0x6326('0xa')](),controller[_0x6326('0xe')]);router[_0x6326('0xc')]('/:id/messages',auth[_0x6326('0xa')](),controller[_0x6326('0xf')]);router[_0x6326('0xc')](_0x6326('0x10'),auth[_0x6326('0xa')](),controller[_0x6326('0x11')]);router[_0x6326('0x12')]('/',auth[_0x6326('0xa')](),controller[_0x6326('0x13')]);router[_0x6326('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6326('0x14')]);router[_0x6326('0x12')]('/:id/tags',auth[_0x6326('0xa')](),interaction['tracked'](_0x6326('0x15'),_0x6326('0x16')),controller[_0x6326('0x17')]);router[_0x6326('0x18')](_0x6326('0xd'),auth[_0x6326('0xa')](),interaction['tracked'](_0x6326('0x15'),'smsinteraction:update'),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x6326('0x15'),_0x6326('0x19')),controller[_0x6326('0x1a')]);router['delete']('/:id/tags',auth[_0x6326('0xa')](),controller[_0x6326('0x1b')]);module[_0x6326('0x1c')]=router; \ No newline at end of file +var _0x0abf=['create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','removeTags','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','download','post'];(function(_0x526367,_0x2d0939){var _0x1f35fe=function(_0x35389f){while(--_0x35389f){_0x526367['push'](_0x526367['shift']());}};_0x1f35fe(++_0x2d0939);}(_0x0abf,0xe8));var _0xf0ab=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0abf[_0x6c993a];return _0x27f547;};'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')]('/describe',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x7')](_0xf0ab('0xb'),auth['isAuthenticated'](),controller[_0xf0ab('0xc')]);router[_0xf0ab('0x7')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0xf0ab('0x7')]('/:id/download',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xe')]);router[_0xf0ab('0xf')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x10')]);router[_0xf0ab('0xf')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller[_0xf0ab('0x11')]);router[_0xf0ab('0xf')](_0xf0ab('0x12'),auth[_0xf0ab('0x8')](),interaction[_0xf0ab('0x13')](_0xf0ab('0x14'),_0xf0ab('0x15')),controller[_0xf0ab('0x16')]);router[_0xf0ab('0x17')](_0xf0ab('0xb'),auth[_0xf0ab('0x8')](),interaction[_0xf0ab('0x13')](_0xf0ab('0x14'),_0xf0ab('0x18')),controller[_0xf0ab('0x19')]);router['delete'](_0xf0ab('0xb'),auth[_0xf0ab('0x8')](),interaction[_0xf0ab('0x13')](_0xf0ab('0x14'),_0xf0ab('0x1a')),controller[_0xf0ab('0x1b')]);router[_0xf0ab('0x1c')](_0xf0ab('0x12'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x1d')]);module[_0xf0ab('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 86fb591..80e1c82 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 _0x531a=['STRING','ENUM','out','INTEGER','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x423de3,_0x187b5a){var _0x472e7f=function(_0x59bc83){while(--_0x59bc83){_0x423de3['push'](_0x423de3['shift']());}};_0x472e7f(++_0x187b5a);}(_0x531a,0x100));var _0xa531=function(_0x562cc9,_0x1cb01e){_0x562cc9=_0x562cc9-0x0;var _0x5ddbf8=_0x531a[_0x562cc9];return _0x5ddbf8;};'use strict';var Sequelize=require(_0xa531('0x0'));var moment=require(_0xa531('0x1'));module[_0xa531('0x2')]={'closed':{'type':Sequelize[_0xa531('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa531('0x4')]},'disposition':{'type':Sequelize[_0xa531('0x5')]},'secondDisposition':{'type':Sequelize[_0xa531('0x5')]},'thirdDisposition':{'type':Sequelize[_0xa531('0x5')]},'note':{'type':Sequelize[_0xa531('0x5')]},'phone':{'type':Sequelize[_0xa531('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa531('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa531('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xa531('0x6')]('in',_0xa531('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa531('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa531('0x8')]}}; \ No newline at end of file +var _0x8286=['exports','BOOLEAN','DATE','STRING','out','INTEGER','sequelize','moment'];(function(_0x454bd3,_0x3e4d94){var _0x4eb066=function(_0x4478fa){while(--_0x4478fa){_0x454bd3['push'](_0x454bd3['shift']());}};_0x4eb066(++_0x3e4d94);}(_0x8286,0x66));var _0x6828=function(_0xf82f74,_0x5c229a){_0xf82f74=_0xf82f74-0x0;var _0x37bc7a=_0x8286[_0xf82f74];return _0x37bc7a;};'use strict';var Sequelize=require(_0x6828('0x0'));var moment=require(_0x6828('0x1'));module[_0x6828('0x2')]={'closed':{'type':Sequelize[_0x6828('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6828('0x4')]},'disposition':{'type':Sequelize[_0x6828('0x5')]},'secondDisposition':{'type':Sequelize[_0x6828('0x5')]},'thirdDisposition':{'type':Sequelize[_0x6828('0x5')]},'note':{'type':Sequelize[_0x6828('0x5')]},'phone':{'type':Sequelize[_0x6828('0x5')]},'read1stAt':{'type':Sequelize[_0x6828('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6828('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6828('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6828('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6828('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6828('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 6b7dae7..52bf640 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 _0x884b=['../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','update','then','destroy','error','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','catch','show','params','model','keys','intersection','fields','attributes','includeAll','include','merge','options','find','create','body','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','filters','length','nolimit','order','sort','where','SmsInteractionId','filter','map','rows','addTags','setTags','Tag','color','emit','removeTags','toString','join','root','server','files','tmp','push','User','fullname','CmContact','Contact','Messages','direction','secret','read','SmsAccount','Account','Owner','mkdirSync','N.A.','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','out','System','firstName','lastName','value','renderFile','views','transcript-','.pdf','Sms','download','err','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x884b,0xe2));var _0xb884=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x884b[_0x37ffea];return _0x2e2615;};'use strict';var rimraf=require(_0xb884('0x0'));var zipdir=require(_0xb884('0x1'));var moment=require(_0xb884('0x2'));var BPromise=require(_0xb884('0x3'));var util=require(_0xb884('0x4'));var path=require(_0xb884('0x5'));var ejs=require(_0xb884('0x6'));var fs=require('fs');var _=require(_0xb884('0x7'));var Redis=require('ioredis');var interaction=require(_0xb884('0x8'));var qs=require(_0xb884('0x9'));var pdf=require(_0xb884('0xa'));var logger=require(_0xb884('0xb'))('api');var config=require(_0xb884('0xc'));var db=require(_0xb884('0xd'))['db'];config[_0xb884('0xe')]=_[_0xb884('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb884('0x10'))(new Redis(config[_0xb884('0xe')]));require(_0xb884('0x11'))[_0xb884('0x12')](socket);function respondWithStatusCode(_0x273ffa,_0x4076ba){_0x4076ba=_0x4076ba||0xcc;return function(_0x81fd0d){if(_0x81fd0d){return _0x273ffa[_0xb884('0x13')](_0x4076ba);}return _0x273ffa[_0xb884('0x14')](_0x4076ba)[_0xb884('0x15')]();};}function respondWithResult(_0x18662f,_0x37fdd7){_0x37fdd7=_0x37fdd7||0xc8;return function(_0x588749){if(_0x588749){return _0x18662f[_0xb884('0x14')](_0x37fdd7)[_0xb884('0x16')](_0x588749);}};}function respondWithFilteredResult(_0xa08789,_0x5a3ec7){return function(_0x2e7166){if(_0x2e7166){var _0x283535=typeof _0x5a3ec7['offset']===_0xb884('0x17')&&typeof _0x5a3ec7['limit']===_0xb884('0x17');var _0x190e95=_0x2e7166[_0xb884('0x18')];var _0x530c75=_0x283535?0x0:_0x5a3ec7[_0xb884('0x19')];var _0x5b3c02=_0x283535?_0x2e7166[_0xb884('0x18')]:_0x5a3ec7['offset']+_0x5a3ec7[_0xb884('0x1a')];var _0x39807c;if(_0x5b3c02>=_0x190e95){_0x5b3c02=_0x190e95;_0x39807c=0xc8;}else{_0x39807c=0xce;}_0xa08789[_0xb884('0x14')](_0x39807c);return _0xa08789['set'](_0xb884('0x1b'),_0x530c75+'-'+_0x5b3c02+'/'+_0x190e95)[_0xb884('0x16')](_0x2e7166);}return null;};}function saveUpdates(_0x3db43d){return function(_0x146c8c){if(_0x146c8c){return _0x146c8c[_0xb884('0x1c')](_0x3db43d)[_0xb884('0x1d')](function(_0x363cc4){return _0x363cc4;});}return null;};}function removeEntity(_0x5240a3){return function(_0x1f505b){if(_0x1f505b){return _0x1f505b[_0xb884('0x1e')]()[_0xb884('0x1d')](function(){_0x5240a3[_0xb884('0x14')](0xcc)[_0xb884('0x15')]();});}};}function handleEntityNotFound(_0x154fd5){return function(_0x4713eb){if(!_0x4713eb){_0x154fd5[_0xb884('0x13')](0x194);}return _0x4713eb;};}function handleError(_0x3a5622,_0x4d99fe){_0x4d99fe=_0x4d99fe||0x1f4;return function(_0xca6a98){logger[_0xb884('0x1f')](_0xca6a98[_0xb884('0x20')]);if(_0xca6a98[_0xb884('0x21')]){delete _0xca6a98['name'];}_0x3a5622[_0xb884('0x14')](_0x4d99fe)[_0xb884('0x22')](_0xca6a98);};}exports[_0xb884('0x23')]=function(_0x1ec294,_0x404168){var _0x350fc6={};var _0x4ea19a=_['map'](db[_0xb884('0x24')][_0xb884('0x25')],function(_0x5051ff){return{'name':_0x5051ff[_0xb884('0x26')],'type':_0x5051ff[_0xb884('0x27')][_0xb884('0x28')]};});_0x350fc6=qs[_0xb884('0x29')](_0x4ea19a,_0x1ec294);return interaction[_0xb884('0x2a')]('sms',_0x1ec294[_0xb884('0x2b')],_0x1ec294['user'],_0x350fc6,_0x4ea19a)[_0xb884('0x1d')](respondWithFilteredResult(_0x404168,_0x350fc6))[_0xb884('0x2c')](handleError(_0x404168,null));};exports[_0xb884('0x2d')]=function(_0x3f0736,_0x331ca9){var _0x506644={'raw':![],'where':{'id':_0x3f0736[_0xb884('0x2e')]['id']}},_0x4fb7bf={};_0x4fb7bf[_0xb884('0x2f')]=_[_0xb884('0x30')](db[_0xb884('0x24')]['rawAttributes']);_0x4fb7bf[_0xb884('0x2b')]=_[_0xb884('0x30')](_0x3f0736[_0xb884('0x2b')]);_0x4fb7bf['filters']=_[_0xb884('0x31')](_0x4fb7bf[_0xb884('0x2f')],_0x4fb7bf[_0xb884('0x2b')]);_0x506644['attributes']=_[_0xb884('0x31')](_0x4fb7bf['model'],qs[_0xb884('0x32')](_0x3f0736[_0xb884('0x2b')][_0xb884('0x32')]));_0x506644[_0xb884('0x33')]=_0x506644['attributes']['length']?_0x506644[_0xb884('0x33')]:_0x4fb7bf[_0xb884('0x2f')];if(_0x3f0736[_0xb884('0x2b')][_0xb884('0x34')]){_0x506644[_0xb884('0x35')]=[{'all':!![]}];}_0x506644=_[_0xb884('0x36')]({},_0x506644,_0x3f0736[_0xb884('0x37')]);return db[_0xb884('0x24')][_0xb884('0x38')](_0x506644)['then'](handleEntityNotFound(_0x331ca9,null))[_0xb884('0x1d')](respondWithResult(_0x331ca9,null))['catch'](handleError(_0x331ca9,null));};exports[_0xb884('0x39')]=function(_0x5a3a6b,_0x46ad8a){return db[_0xb884('0x24')][_0xb884('0x39')](_0x5a3a6b[_0xb884('0x3a')],{})[_0xb884('0x1d')](respondWithResult(_0x46ad8a,0xc9))[_0xb884('0x2c')](handleError(_0x46ad8a,null));};exports['update']=function(_0x49fa22,_0x5728c3){if(_0x49fa22[_0xb884('0x3a')]['id']){delete _0x49fa22['body']['id'];}return db[_0xb884('0x24')]['find']({'where':{'id':_0x49fa22[_0xb884('0x2e')]['id']}})[_0xb884('0x1d')](handleEntityNotFound(_0x5728c3,null))['then'](saveUpdates(_0x49fa22['body'],null))['then'](respondWithResult(_0x5728c3,null))[_0xb884('0x2c')](handleError(_0x5728c3,null));};exports['destroy']=function(_0x5d5c7c,_0x3991e7){return db['SmsInteraction'][_0xb884('0x38')]({'where':{'id':_0x5d5c7c[_0xb884('0x2e')]['id']}})['then'](handleEntityNotFound(_0x3991e7,null))[_0xb884('0x1d')](removeEntity(_0x3991e7,null))[_0xb884('0x2c')](handleError(_0x3991e7,null));};exports[_0xb884('0x3b')]=function(_0x41dbda,_0x522952){return db[_0xb884('0x24')][_0xb884('0x3b')]()[_0xb884('0x1d')](respondWithResult(_0x522952,null))[_0xb884('0x2c')](handleError(_0x522952,null));};exports[_0xb884('0x3c')]=function(_0xd95ed9,_0x1c7447){return db[_0xb884('0x3d')]['find']({'where':{'id':_0xd95ed9['params']['id']}})['then'](handleEntityNotFound(_0x1c7447,null))['then'](function(_0x59d0b9){if(_0x59d0b9){return _0x59d0b9[_0xb884('0x3c')](_0xd95ed9[_0xb884('0x3a')][_0xb884('0x3e')],_[_0xb884('0x3f')](_0xd95ed9[_0xb884('0x3a')],['ids','id'])||{});}})[_0xb884('0x1d')](respondWithResult(_0x1c7447,null))[_0xb884('0x2c')](handleError(_0x1c7447,null));};exports[_0xb884('0x40')]=function(_0x537a6f,_0x485358){var _0x2b39e7={'raw':![],'where':{}};var _0x3693a0={};var _0x19951c={'count':0x0,'rows':[]};return db[_0xb884('0x24')][_0xb884('0x41')]({'where':{'id':_0x537a6f[_0xb884('0x2e')]['id']}})['then'](handleEntityNotFound(_0x485358,null))['then'](function(_0x39aa51){if(_0x39aa51){_0x3693a0['model']=_['keys'](db['SmsMessage'][_0xb884('0x25')]);_0x3693a0[_0xb884('0x2b')]=_[_0xb884('0x30')](_0x537a6f[_0xb884('0x2b')]);_0x3693a0[_0xb884('0x42')]=_['intersection'](_0x3693a0[_0xb884('0x2f')],_0x3693a0[_0xb884('0x2b')]);_0x2b39e7[_0xb884('0x33')]=_['intersection'](_0x3693a0['model'],qs[_0xb884('0x32')](_0x537a6f['query'][_0xb884('0x32')]));_0x2b39e7[_0xb884('0x33')]=_0x2b39e7['attributes'][_0xb884('0x43')]?_0x2b39e7[_0xb884('0x33')]:_0x3693a0['model'];if(!_0x537a6f[_0xb884('0x2b')]['hasOwnProperty'](_0xb884('0x44'))){_0x2b39e7['limit']=qs[_0xb884('0x1a')](_0x537a6f[_0xb884('0x2b')][_0xb884('0x1a')]);_0x2b39e7['offset']=qs['offset'](_0x537a6f[_0xb884('0x2b')][_0xb884('0x19')]);}_0x2b39e7[_0xb884('0x45')]=qs[_0xb884('0x46')](_0x537a6f[_0xb884('0x2b')][_0xb884('0x46')]);_0x2b39e7[_0xb884('0x47')]=qs[_0xb884('0x42')](_['pick'](_0x537a6f[_0xb884('0x2b')],_0x3693a0[_0xb884('0x42')]));_0x2b39e7[_0xb884('0x47')][_0xb884('0x48')]=_0x39aa51['id'];if(_0x537a6f[_0xb884('0x2b')][_0xb884('0x49')]){_0x2b39e7['where']=_[_0xb884('0x36')](_0x2b39e7['where'],{'$or':_[_0xb884('0x4a')](_0x2b39e7[_0xb884('0x33')],function(_0x3221a5){var _0x3eba80={};_0x3eba80[_0x3221a5]={'$like':'%'+_0x537a6f[_0xb884('0x2b')][_0xb884('0x49')]+'%'};return _0x3eba80;})});}if(_0x537a6f['query']['$gte']){var _0x6a723c=_0x537a6f[_0xb884('0x2b')]['$gte']['split'](',');var _0x31a7f6={};_0x31a7f6[_0x6a723c[0x0]]={'$gte':moment(_0x6a723c[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2b39e7['where']=_[_0xb884('0x36')](_0x2b39e7[_0xb884('0x47')],_0x31a7f6);}_0x2b39e7=_[_0xb884('0x36')]({},_0x2b39e7,_0x537a6f['options']);return db[_0xb884('0x3d')][_0xb884('0x18')]({'where':_0x2b39e7[_0xb884('0x47')]})['then'](function(_0x13dfa4){_0x19951c[_0xb884('0x18')]=_0x13dfa4;if(_0x537a6f[_0xb884('0x2b')][_0xb884('0x34')]){_0x2b39e7['include']=[{'all':!![]}];}return db['SmsMessage'][_0xb884('0x2a')](_0x2b39e7);})['then'](function(_0x52ebc3){_0x19951c[_0xb884('0x4b')]=_0x52ebc3;return _0x19951c;});}})[_0xb884('0x1d')](respondWithFilteredResult(_0x485358,_0x2b39e7))['catch'](handleError(_0x485358,null));};exports[_0xb884('0x4c')]=function(_0x4f6a0f,_0x626265){return db['SmsInteraction']['find']({'where':{'id':_0x4f6a0f['params']['id']}})[_0xb884('0x1d')](handleEntityNotFound(_0x626265,null))['then'](function(_0x16c650){if(_0x16c650){return _0x16c650[_0xb884('0x4d')](_0x4f6a0f[_0xb884('0x3a')][_0xb884('0x3e')],_[_0xb884('0x3f')](_0x4f6a0f[_0xb884('0x3a')],[_0xb884('0x3e'),'id'])||{})['spread'](function(){return db[_0xb884('0x4e')][_0xb884('0x2a')]({'attributes':['id',_0xb884('0x21'),_0xb884('0x4f')],'where':{'id':_0x4f6a0f[_0xb884('0x3a')][_0xb884('0x3e')]}});})['then'](function(_0x1dc3bd){socket[_0xb884('0x50')]('smsInteractionTags:save',{'id':Number(_0x4f6a0f['params']['id']),'tags':_0x1dc3bd||[]});return{'id':Number(_0x4f6a0f['params']['id']),'tags':_0x1dc3bd||[]};});}})[_0xb884('0x1d')](respondWithResult(_0x626265,null))[_0xb884('0x2c')](handleError(_0x626265,null));};exports[_0xb884('0x51')]=function(_0x3ce1c1,_0x41500e){return db['SmsInteraction']['find']({'where':{'id':_0x3ce1c1[_0xb884('0x2e')]['id']}})[_0xb884('0x1d')](handleEntityNotFound(_0x41500e,null))['then'](function(_0x867050){if(_0x867050){return _0x867050['removeTags'](_0x3ce1c1['query'][_0xb884('0x3e')]);}})[_0xb884('0x1d')](respondWithStatusCode(_0x41500e,null))[_0xb884('0x2c')](handleError(_0x41500e,null));};exports['download']=function(_0x1929af,_0x2045b0){var _0x43736c=moment()['unix']()[_0xb884('0x52')]();var _0x501b69=path[_0xb884('0x53')](config[_0xb884('0x54')],_0xb884('0x55'),_0xb884('0x56'),_0xb884('0x57'));var _0x5afe64=path[_0xb884('0x53')](_0x501b69,_0x43736c);var _0x44f3fc=util['format']('transcript-%d-%s.zip',_0x1929af[_0xb884('0x2e')]['id'],_0x43736c);var _0x4713fb=path[_0xb884('0x53')](_0x501b69,_0x44f3fc);var _0x128bba=[];_0x128bba[_0xb884('0x58')]({'model':db[_0xb884('0x59')],'as':'User','attributes':['id',_0xb884('0x5a')],'raw':!![]});_0x128bba[_0xb884('0x58')]({'model':db[_0xb884('0x5b')],'as':_0xb884('0x5c'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x55304b=[{'model':db['SmsMessage'],'as':_0xb884('0x5d'),'attributes':['id',_0xb884('0x3a'),'createdAt',_0xb884('0x5e'),_0xb884('0x5f'),_0xb884('0x60')],'include':_0x128bba}];_0x55304b['push']({'model':db[_0xb884('0x61')],'as':_0xb884('0x62'),'attributes':['id',_0xb884('0x21')]});_0x55304b['push']({'model':db[_0xb884('0x59')],'as':_0xb884('0x63'),'attributes':['id',_0xb884('0x5a')]});return db['SmsInteraction'][_0xb884('0x38')]({'where':{'id':_0x1929af[_0xb884('0x2e')]['id']},'include':_0x55304b})['then'](handleEntityNotFound(_0x2045b0,null))[_0xb884('0x1d')](function(_0xfb6d08){if(_0xfb6d08){var _0x2af841=_0xfb6d08['get']({'plain':!![]});fs[_0xb884('0x64')](_0x5afe64);var _0xa1642={'channel':'Sms','account':_0x2af841[_0xb884('0x62')][_0xb884('0x21')],'agent':_0x2af841[_0xb884('0x63')]?_0x2af841[_0xb884('0x63')]['fullname']:_0xb884('0x65'),'createdAt':moment(_0x2af841[_0xb884('0x66')])[_0xb884('0x67')](_0xb884('0x68'))[_0xb884('0x52')](),'closedAt':_0x2af841['closed']?moment(_0x2af841[_0xb884('0x69')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xb884('0x52')]():'','disposition':_0x2af841[_0xb884('0x6a')],'messages':_(_0x2af841[_0xb884('0x5d')])['filter']({'secret':![]})[_0xb884('0x4a')](function(_0x1ed89a){return{'date':moment(_0x1ed89a[_0xb884('0x66')])[_0xb884('0x67')](_0xb884('0x68'))['toString'](),'sender':_0x1ed89a['direction']===_0xb884('0x6b')?_0x1ed89a[_0xb884('0x59')]?_0x1ed89a['User'][_0xb884('0x5a')]:_0xb884('0x6c'):_0x1ed89a['Contact'][_0xb884('0x6d')]+(_0x1ed89a[_0xb884('0x5c')][_0xb884('0x6e')]?'\x20'+_0x1ed89a['Contact'][_0xb884('0x6e')]:''),'body':_0x1ed89a[_0xb884('0x3a')],'direction':_0x1ed89a['direction']==='out'?'A':'C','secret':_0x1ed89a[_0xb884('0x5f')],'read':_0x1ed89a[_0xb884('0x60')]};})[_0xb884('0x6f')]()};return ejs[_0xb884('0x70')](path[_0xb884('0x53')](config[_0xb884('0x54')],_0xb884('0x55'),_0xb884('0x71'),'downloadInteraction.ejs'),{'interaction':_0xa1642})[_0xb884('0x1d')](function(_0x14e303){var _0x51d40b=path[_0xb884('0x53')](_0x5afe64,_0xb884('0x72')+_0x2af841['id']+'-'+_0x43736c+_0xb884('0x73'));var _0x45a3ec={'path':_0x51d40b,'channel':_0xb884('0x74'),'interactionId':_0x2af841['id']};return pdf['createPdfFromHTML'](_0x14e303,_0x45a3ec);})[_0xb884('0x1d')](function(){return new BPromise(function(_0x48a98d,_0x39cd8c){zipdir(_0x5afe64,{'saveTo':_0x4713fb},function(_0x187594,_0x44b49c){if(_0x187594)return _0x39cd8c(_0x187594);return _0x48a98d(_0x44b49c);});})['then'](function(){return new BPromise(function(_0x1ff455,_0x5556f2){rimraf(_0x5afe64,function(_0x3bf89c){if(_0x3bf89c)_0x5556f2(_0x3bf89c);return _0x1ff455();});});})[_0xb884('0x1d')](function(){return _0x2045b0[_0xb884('0x75')](_0x4713fb,_0x44f3fc,function(_0x25051e){if(_0x25051e){console['log'](_0xb884('0x76'),_0x25051e);}else{fs['unlinkSync'](_0x4713fb);}});});});}else{return _0x2045b0[_0xb884('0x13')](0xc8);}})[_0xb884('0x2c')](handleError(_0x2045b0,null));}; \ No newline at end of file +var _0x9a05=['key','getOptions','findAll','user','show','params','model','keys','query','intersection','fields','attributes','includeAll','include','merge','options','find','catch','create','body','destroy','describe','SmsMessage','addMessage','ids','omit','getMessages','findOne','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','$gte','split','format','count','rows','addTags','spread','Tag','smsInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','join','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','out','System','value','renderFile','views','transcript-','.pdf','Sms','log','err','unlinkSync','rimraf','moment','util','path','lodash','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','json','offset','limit','set','Content-Range','then','name','send','index','map','SmsInteraction','rawAttributes','fieldName'];(function(_0x127ddd,_0x1d6210){var _0x355b24=function(_0x2c4304){while(--_0x2c4304){_0x127ddd['push'](_0x127ddd['shift']());}};_0x355b24(++_0x1d6210);}(_0x9a05,0xc9));var _0x59a0=function(_0x2ff560,_0x20d5f2){_0x2ff560=_0x2ff560-0x0;var _0x40df3a=_0x9a05[_0x2ff560];return _0x40df3a;};'use strict';var rimraf=require(_0x59a0('0x0'));var zipdir=require('zip-dir');var moment=require(_0x59a0('0x1'));var BPromise=require('bluebird');var util=require(_0x59a0('0x2'));var path=require(_0x59a0('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x59a0('0x4'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x59a0('0x5'));var pdf=require(_0x59a0('0x6'));var logger=require('../../config/logger')(_0x59a0('0x7'));var config=require(_0x59a0('0x8'));var db=require(_0x59a0('0x9'))['db'];config[_0x59a0('0xa')]=_[_0x59a0('0xb')](config[_0x59a0('0xa')],{'host':_0x59a0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x59a0('0xa')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1b796f,_0x31b82d){_0x31b82d=_0x31b82d||0xcc;return function(_0x1cbb65){if(_0x1cbb65){return _0x1b796f[_0x59a0('0xd')](_0x31b82d);}return _0x1b796f[_0x59a0('0xe')](_0x31b82d)[_0x59a0('0xf')]();};}function respondWithResult(_0x1cd2d9,_0x39cfca){_0x39cfca=_0x39cfca||0xc8;return function(_0x55d118){if(_0x55d118){return _0x1cd2d9[_0x59a0('0xe')](_0x39cfca)[_0x59a0('0x10')](_0x55d118);}};}function respondWithFilteredResult(_0x44b036,_0x130faf){return function(_0x4e3601){if(_0x4e3601){var _0x40da74=typeof _0x130faf[_0x59a0('0x11')]==='undefined'&&typeof _0x130faf[_0x59a0('0x12')]==='undefined';var _0x53fdf7=_0x4e3601['count'];var _0x4e3cbc=_0x40da74?0x0:_0x130faf[_0x59a0('0x11')];var _0x50f77a=_0x40da74?_0x4e3601['count']:_0x130faf['offset']+_0x130faf[_0x59a0('0x12')];var _0x117478;if(_0x50f77a>=_0x53fdf7){_0x50f77a=_0x53fdf7;_0x117478=0xc8;}else{_0x117478=0xce;}_0x44b036[_0x59a0('0xe')](_0x117478);return _0x44b036[_0x59a0('0x13')](_0x59a0('0x14'),_0x4e3cbc+'-'+_0x50f77a+'/'+_0x53fdf7)[_0x59a0('0x10')](_0x4e3601);}return null;};}function saveUpdates(_0x1ddeda){return function(_0x3da057){if(_0x3da057){return _0x3da057['update'](_0x1ddeda)[_0x59a0('0x15')](function(_0x519b63){return _0x519b63;});}return null;};}function removeEntity(_0x36ac4a){return function(_0x2f5555){if(_0x2f5555){return _0x2f5555['destroy']()[_0x59a0('0x15')](function(){_0x36ac4a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x598eac){return function(_0x350d71){if(!_0x350d71){_0x598eac[_0x59a0('0xd')](0x194);}return _0x350d71;};}function handleError(_0x118014,_0x128ed8){_0x128ed8=_0x128ed8||0x1f4;return function(_0x143147){logger['error'](_0x143147['stack']);if(_0x143147[_0x59a0('0x16')]){delete _0x143147['name'];}_0x118014['status'](_0x128ed8)[_0x59a0('0x17')](_0x143147);};}exports[_0x59a0('0x18')]=function(_0x4654e6,_0x325b33){var _0x4805cb={};var _0x1b1337=_[_0x59a0('0x19')](db[_0x59a0('0x1a')][_0x59a0('0x1b')],function(_0x1d1385){return{'name':_0x1d1385[_0x59a0('0x1c')],'type':_0x1d1385['type'][_0x59a0('0x1d')]};});_0x4805cb=qs[_0x59a0('0x1e')](_0x1b1337,_0x4654e6);return interaction[_0x59a0('0x1f')]('sms',_0x4654e6['query'],_0x4654e6[_0x59a0('0x20')],_0x4805cb,_0x1b1337)[_0x59a0('0x15')](respondWithFilteredResult(_0x325b33,_0x4805cb))['catch'](handleError(_0x325b33,null));};exports[_0x59a0('0x21')]=function(_0x38eb47,_0x26341d){var _0x3fd59c={'raw':![],'where':{'id':_0x38eb47[_0x59a0('0x22')]['id']}},_0x46f61b={};_0x46f61b[_0x59a0('0x23')]=_[_0x59a0('0x24')](db[_0x59a0('0x1a')][_0x59a0('0x1b')]);_0x46f61b[_0x59a0('0x25')]=_[_0x59a0('0x24')](_0x38eb47[_0x59a0('0x25')]);_0x46f61b['filters']=_[_0x59a0('0x26')](_0x46f61b[_0x59a0('0x23')],_0x46f61b[_0x59a0('0x25')]);_0x3fd59c['attributes']=_[_0x59a0('0x26')](_0x46f61b[_0x59a0('0x23')],qs[_0x59a0('0x27')](_0x38eb47['query'][_0x59a0('0x27')]));_0x3fd59c[_0x59a0('0x28')]=_0x3fd59c[_0x59a0('0x28')]['length']?_0x3fd59c['attributes']:_0x46f61b[_0x59a0('0x23')];if(_0x38eb47[_0x59a0('0x25')][_0x59a0('0x29')]){_0x3fd59c[_0x59a0('0x2a')]=[{'all':!![]}];}_0x3fd59c=_[_0x59a0('0x2b')]({},_0x3fd59c,_0x38eb47[_0x59a0('0x2c')]);return db[_0x59a0('0x1a')][_0x59a0('0x2d')](_0x3fd59c)[_0x59a0('0x15')](handleEntityNotFound(_0x26341d,null))[_0x59a0('0x15')](respondWithResult(_0x26341d,null))[_0x59a0('0x2e')](handleError(_0x26341d,null));};exports[_0x59a0('0x2f')]=function(_0x4837ab,_0x2d51db){return db[_0x59a0('0x1a')][_0x59a0('0x2f')](_0x4837ab[_0x59a0('0x30')],{})[_0x59a0('0x15')](respondWithResult(_0x2d51db,0xc9))[_0x59a0('0x2e')](handleError(_0x2d51db,null));};exports['update']=function(_0x3cd677,_0x20367c){if(_0x3cd677['body']['id']){delete _0x3cd677[_0x59a0('0x30')]['id'];}return db[_0x59a0('0x1a')][_0x59a0('0x2d')]({'where':{'id':_0x3cd677[_0x59a0('0x22')]['id']}})[_0x59a0('0x15')](handleEntityNotFound(_0x20367c,null))['then'](saveUpdates(_0x3cd677[_0x59a0('0x30')],null))[_0x59a0('0x15')](respondWithResult(_0x20367c,null))[_0x59a0('0x2e')](handleError(_0x20367c,null));};exports[_0x59a0('0x31')]=function(_0x110418,_0x8d25b){return db[_0x59a0('0x1a')][_0x59a0('0x2d')]({'where':{'id':_0x110418[_0x59a0('0x22')]['id']}})[_0x59a0('0x15')](handleEntityNotFound(_0x8d25b,null))[_0x59a0('0x15')](removeEntity(_0x8d25b,null))[_0x59a0('0x2e')](handleError(_0x8d25b,null));};exports[_0x59a0('0x32')]=function(_0x49a1c9,_0x543c6e){return db['SmsInteraction'][_0x59a0('0x32')]()[_0x59a0('0x15')](respondWithResult(_0x543c6e,null))[_0x59a0('0x2e')](handleError(_0x543c6e,null));};exports['addMessage']=function(_0x153f12,_0x4acbfe){return db[_0x59a0('0x33')][_0x59a0('0x2d')]({'where':{'id':_0x153f12[_0x59a0('0x22')]['id']}})[_0x59a0('0x15')](handleEntityNotFound(_0x4acbfe,null))['then'](function(_0x305125){if(_0x305125){return _0x305125[_0x59a0('0x34')](_0x153f12[_0x59a0('0x30')][_0x59a0('0x35')],_[_0x59a0('0x36')](_0x153f12[_0x59a0('0x30')],[_0x59a0('0x35'),'id'])||{});}})[_0x59a0('0x15')](respondWithResult(_0x4acbfe,null))[_0x59a0('0x2e')](handleError(_0x4acbfe,null));};exports[_0x59a0('0x37')]=function(_0x3aee22,_0x25deb2){var _0x27c1e7={'raw':![],'where':{}};var _0xfa0e63={};var _0x4a240b={'count':0x0,'rows':[]};return db[_0x59a0('0x1a')][_0x59a0('0x38')]({'where':{'id':_0x3aee22[_0x59a0('0x22')]['id']}})['then'](handleEntityNotFound(_0x25deb2,null))[_0x59a0('0x15')](function(_0x407abd){if(_0x407abd){_0xfa0e63[_0x59a0('0x23')]=_['keys'](db[_0x59a0('0x33')][_0x59a0('0x1b')]);_0xfa0e63['query']=_[_0x59a0('0x24')](_0x3aee22[_0x59a0('0x25')]);_0xfa0e63['filters']=_['intersection'](_0xfa0e63[_0x59a0('0x23')],_0xfa0e63[_0x59a0('0x25')]);_0x27c1e7[_0x59a0('0x28')]=_['intersection'](_0xfa0e63[_0x59a0('0x23')],qs[_0x59a0('0x27')](_0x3aee22[_0x59a0('0x25')]['fields']));_0x27c1e7['attributes']=_0x27c1e7['attributes'][_0x59a0('0x39')]?_0x27c1e7['attributes']:_0xfa0e63[_0x59a0('0x23')];if(!_0x3aee22[_0x59a0('0x25')][_0x59a0('0x3a')](_0x59a0('0x3b'))){_0x27c1e7['limit']=qs[_0x59a0('0x12')](_0x3aee22[_0x59a0('0x25')][_0x59a0('0x12')]);_0x27c1e7[_0x59a0('0x11')]=qs[_0x59a0('0x11')](_0x3aee22['query'][_0x59a0('0x11')]);}_0x27c1e7[_0x59a0('0x3c')]=qs['sort'](_0x3aee22[_0x59a0('0x25')]['sort']);_0x27c1e7['where']=qs[_0x59a0('0x3d')](_[_0x59a0('0x3e')](_0x3aee22['query'],_0xfa0e63[_0x59a0('0x3d')]));_0x27c1e7['where']['SmsInteractionId']=_0x407abd['id'];if(_0x3aee22[_0x59a0('0x25')][_0x59a0('0x3f')]){_0x27c1e7[_0x59a0('0x40')]=_[_0x59a0('0x2b')](_0x27c1e7[_0x59a0('0x40')],{'$or':_['map'](_0x27c1e7['attributes'],function(_0x33bd23){var _0x25dde7={};_0x25dde7[_0x33bd23]={'$like':'%'+_0x3aee22[_0x59a0('0x25')][_0x59a0('0x3f')]+'%'};return _0x25dde7;})});}if(_0x3aee22[_0x59a0('0x25')][_0x59a0('0x41')]){var _0xe344fd=_0x3aee22[_0x59a0('0x25')]['$gte'][_0x59a0('0x42')](',');var _0x492c77={};_0x492c77[_0xe344fd[0x0]]={'$gte':moment(_0xe344fd[0x1])[_0x59a0('0x43')]('YYYY-MM-DD\x20HH:mm:ss')};_0x27c1e7[_0x59a0('0x40')]=_['merge'](_0x27c1e7[_0x59a0('0x40')],_0x492c77);}_0x27c1e7=_[_0x59a0('0x2b')]({},_0x27c1e7,_0x3aee22[_0x59a0('0x2c')]);return db[_0x59a0('0x33')][_0x59a0('0x44')]({'where':_0x27c1e7[_0x59a0('0x40')]})['then'](function(_0x7cc99d){_0x4a240b[_0x59a0('0x44')]=_0x7cc99d;if(_0x3aee22[_0x59a0('0x25')]['includeAll']){_0x27c1e7[_0x59a0('0x2a')]=[{'all':!![]}];}return db[_0x59a0('0x33')]['findAll'](_0x27c1e7);})[_0x59a0('0x15')](function(_0x4f6d3b){_0x4a240b[_0x59a0('0x45')]=_0x4f6d3b;return _0x4a240b;});}})[_0x59a0('0x15')](respondWithFilteredResult(_0x25deb2,_0x27c1e7))[_0x59a0('0x2e')](handleError(_0x25deb2,null));};exports[_0x59a0('0x46')]=function(_0x33ef41,_0x55e24a){return db[_0x59a0('0x1a')]['find']({'where':{'id':_0x33ef41['params']['id']}})[_0x59a0('0x15')](handleEntityNotFound(_0x55e24a,null))[_0x59a0('0x15')](function(_0x9c1f0f){if(_0x9c1f0f){return _0x9c1f0f['setTags'](_0x33ef41[_0x59a0('0x30')][_0x59a0('0x35')],_['omit'](_0x33ef41[_0x59a0('0x30')],['ids','id'])||{})[_0x59a0('0x47')](function(){return db[_0x59a0('0x48')][_0x59a0('0x1f')]({'attributes':['id','name','color'],'where':{'id':_0x33ef41[_0x59a0('0x30')][_0x59a0('0x35')]}});})['then'](function(_0xbdd94d){socket['emit'](_0x59a0('0x49'),{'id':Number(_0x33ef41[_0x59a0('0x22')]['id']),'tags':_0xbdd94d||[]});return{'id':Number(_0x33ef41['params']['id']),'tags':_0xbdd94d||[]};});}})[_0x59a0('0x15')](respondWithResult(_0x55e24a,null))[_0x59a0('0x2e')](handleError(_0x55e24a,null));};exports[_0x59a0('0x4a')]=function(_0x27545c,_0x343608){return db[_0x59a0('0x1a')][_0x59a0('0x2d')]({'where':{'id':_0x27545c['params']['id']}})[_0x59a0('0x15')](handleEntityNotFound(_0x343608,null))['then'](function(_0x511b26){if(_0x511b26){return _0x511b26[_0x59a0('0x4a')](_0x27545c[_0x59a0('0x25')][_0x59a0('0x35')]);}})[_0x59a0('0x15')](respondWithStatusCode(_0x343608,null))[_0x59a0('0x2e')](handleError(_0x343608,null));};exports[_0x59a0('0x4b')]=function(_0x4f68df,_0x3c827f){var _0xc08ebc=moment()[_0x59a0('0x4c')]()[_0x59a0('0x4d')]();var _0x4dec4f=path['join'](config['root'],_0x59a0('0x4e'),_0x59a0('0x4f'),_0x59a0('0x50'));var _0x180914=path[_0x59a0('0x51')](_0x4dec4f,_0xc08ebc);var _0x3b4c92=util[_0x59a0('0x43')](_0x59a0('0x52'),_0x4f68df['params']['id'],_0xc08ebc);var _0x1e031c=path[_0x59a0('0x51')](_0x4dec4f,_0x3b4c92);var _0x570004=[];_0x570004[_0x59a0('0x53')]({'model':db[_0x59a0('0x54')],'as':_0x59a0('0x54'),'attributes':['id',_0x59a0('0x55')],'raw':!![]});_0x570004[_0x59a0('0x53')]({'model':db[_0x59a0('0x56')],'as':_0x59a0('0x57'),'attributes':['id',_0x59a0('0x58'),_0x59a0('0x59')],'raw':!![]});var _0x1362b1=[{'model':db[_0x59a0('0x33')],'as':_0x59a0('0x5a'),'attributes':['id','body',_0x59a0('0x5b'),_0x59a0('0x5c'),_0x59a0('0x5d'),_0x59a0('0x5e')],'include':_0x570004}];_0x1362b1[_0x59a0('0x53')]({'model':db[_0x59a0('0x5f')],'as':_0x59a0('0x60'),'attributes':['id','name']});_0x1362b1['push']({'model':db[_0x59a0('0x54')],'as':_0x59a0('0x61'),'attributes':['id',_0x59a0('0x55')]});return db[_0x59a0('0x1a')]['find']({'where':{'id':_0x4f68df[_0x59a0('0x22')]['id']},'include':_0x1362b1})[_0x59a0('0x15')](handleEntityNotFound(_0x3c827f,null))[_0x59a0('0x15')](function(_0x316ed5){if(_0x316ed5){var _0x161689=_0x316ed5['get']({'plain':!![]});fs[_0x59a0('0x62')](_0x180914);var _0xe91bd5={'channel':'Sms','account':_0x161689['Account'][_0x59a0('0x16')],'agent':_0x161689[_0x59a0('0x61')]?_0x161689[_0x59a0('0x61')][_0x59a0('0x55')]:_0x59a0('0x63'),'createdAt':moment(_0x161689[_0x59a0('0x5b')])[_0x59a0('0x43')](_0x59a0('0x64'))[_0x59a0('0x4d')](),'closedAt':_0x161689[_0x59a0('0x65')]?moment(_0x161689[_0x59a0('0x66')])[_0x59a0('0x43')](_0x59a0('0x64'))['toString']():'','disposition':_0x161689[_0x59a0('0x67')],'messages':_(_0x161689[_0x59a0('0x5a')])[_0x59a0('0x3f')]({'secret':![]})[_0x59a0('0x19')](function(_0x237500){return{'date':moment(_0x237500[_0x59a0('0x5b')])[_0x59a0('0x43')](_0x59a0('0x64'))[_0x59a0('0x4d')](),'sender':_0x237500[_0x59a0('0x5c')]===_0x59a0('0x68')?_0x237500['User']?_0x237500[_0x59a0('0x54')][_0x59a0('0x55')]:_0x59a0('0x69'):_0x237500[_0x59a0('0x57')]['firstName']+(_0x237500[_0x59a0('0x57')][_0x59a0('0x59')]?'\x20'+_0x237500['Contact']['lastName']:''),'body':_0x237500[_0x59a0('0x30')],'direction':_0x237500[_0x59a0('0x5c')]==='out'?'A':'C','secret':_0x237500[_0x59a0('0x5d')],'read':_0x237500['read']};})[_0x59a0('0x6a')]()};return ejs[_0x59a0('0x6b')](path['join'](config['root'],_0x59a0('0x4e'),_0x59a0('0x6c'),'downloadInteraction.ejs'),{'interaction':_0xe91bd5})[_0x59a0('0x15')](function(_0x11a7e0){var _0x3160a9=path['join'](_0x180914,_0x59a0('0x6d')+_0x161689['id']+'-'+_0xc08ebc+_0x59a0('0x6e'));var _0x30babc={'path':_0x3160a9,'channel':_0x59a0('0x6f'),'interactionId':_0x161689['id']};return pdf['createPdfFromHTML'](_0x11a7e0,_0x30babc);})['then'](function(){return new BPromise(function(_0xb0dd38,_0x105647){zipdir(_0x180914,{'saveTo':_0x1e031c},function(_0x288fa0,_0x4de9ee){if(_0x288fa0)return _0x105647(_0x288fa0);return _0xb0dd38(_0x4de9ee);});})[_0x59a0('0x15')](function(){return new BPromise(function(_0x18773b,_0xfe0b6d){rimraf(_0x180914,function(_0x4e3165){if(_0x4e3165)_0xfe0b6d(_0x4e3165);return _0x18773b();});});})[_0x59a0('0x15')](function(){return _0x3c827f[_0x59a0('0x4b')](_0x1e031c,_0x3b4c92,function(_0x4c4186){if(_0x4c4186){console[_0x59a0('0x70')](_0x59a0('0x71'),_0x4c4186);}else{fs[_0x59a0('0x72')](_0x1e031c);}});});});}else{return _0x3c827f[_0x59a0('0xd')](0xc8);}})['catch'](handleError(_0x3c827f,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 7873dc3..561d70f 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 _0x0972=['save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x32c099,_0x1f2719){var _0x51255f=function(_0x50a835){while(--_0x50a835){_0x32c099['push'](_0x32c099['shift']());}};_0x51255f(++_0x1f2719);}(_0x0972,0x64));var _0x2097=function(_0x2e0eba,_0x455233){_0x2e0eba=_0x2e0eba-0x0;var _0x2bd1cb=_0x0972[_0x2e0eba];return _0x2bd1cb;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x2097('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x2097('0x0'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x2097('0x1')](0x0);var events={'afterCreate':_0x2097('0x2'),'afterUpdate':'update','afterDestroy':_0x2097('0x3')};function emitEvent(_0x431d1c){return function(_0xe6fbae,_0x1a7d26,_0x2f84d8){_0xe6fbae[_0x2097('0x4')]({'attributes':['id'],'raw':!![]})[_0x2097('0x5')](function(_0x59739f){_0xe6fbae[_0x2097('0x6')](_0x2097('0x7'),_0x59739f[_0x2097('0x8')](function(_0x1d94e2){return{'id':_0x1d94e2['id']};}));return SmsMessage[_0x2097('0x9')]({'where':{'SmsInteractionId':_0xe6fbae['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2e0024){_0xe6fbae[_0x2097('0x6')](_0x2097('0xa'),_0x2e0024[_0x2097('0xb')]);SmsInteractionEvents[_0x2097('0xc')](_0x431d1c+':'+_0xe6fbae['id'],_0xe6fbae);SmsInteractionEvents[_0x2097('0xc')](_0x431d1c,_0xe6fbae);_0x2f84d8(null);})[_0x2097('0xd')](_0x2f84d8(null));};}for(var e in events){if(events[_0x2097('0xe')](e)){var event=events[e];SmsInteraction[_0x2097('0xf')](e,emitEvent(event));}}module[_0x2097('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0x627e=['remove','getUsers','then','setDataValue','Users','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update'];(function(_0x166f68,_0x2cc701){var _0x5580e3=function(_0x39ed65){while(--_0x39ed65){_0x166f68['push'](_0x166f68['shift']());}};_0x5580e3(++_0x2cc701);}(_0x627e,0x14a));var _0xe627=function(_0x2d4126,_0x4a9038){_0x2d4126=_0x2d4126-0x0;var _0x36d19f=_0x627e[_0x2d4126];return _0x36d19f;};'use strict';var EventEmitter=require(_0xe627('0x0'));var SmsInteraction=require(_0xe627('0x1'))['db'][_0xe627('0x2')];var SmsMessage=require(_0xe627('0x1'))['db'][_0xe627('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe627('0x4'),'afterUpdate':_0xe627('0x5'),'afterDestroy':_0xe627('0x6')};function emitEvent(_0x59a2c8){return function(_0x52923f,_0x4efcad,_0x1a1a3d){_0x52923f[_0xe627('0x7')]({'attributes':['id'],'raw':!![]})[_0xe627('0x8')](function(_0x2d4f63){_0x52923f[_0xe627('0x9')](_0xe627('0xa'),_0x2d4f63['map'](function(_0x3f2948){return{'id':_0x3f2948['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x52923f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4411c0){_0x52923f[_0xe627('0x9')]('unreadMessages',_0x4411c0['length']);SmsInteractionEvents[_0xe627('0xb')](_0x59a2c8+':'+_0x52923f['id'],_0x52923f);SmsInteractionEvents[_0xe627('0xb')](_0x59a2c8,_0x52923f);_0x1a1a3d(null);})[_0xe627('0xc')](_0x1a1a3d(null));};}for(var e in events){if(events[_0xe627('0xd')](e)){var event=events[e];SmsInteraction[_0xe627('0xe')](e,emitEvent(event));}}module[_0xe627('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 95a8ef8..4dfdc42 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 _0x60c8=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','changed','closed','format'];(function(_0x4cba56,_0x5b2c44){var _0x3cc9f3=function(_0x5bb80a){while(--_0x5bb80a){_0x4cba56['push'](_0x4cba56['shift']());}};_0x3cc9f3(++_0x5b2c44);}(_0x60c8,0xfa));var _0x860c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x60c8[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x860c('0x0'))(_0x860c('0x1'));var moment=require('moment');var BPromise=require(_0x860c('0x2'));var rp=require(_0x860c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x860c('0x4'));var config=require(_0x860c('0x5'));var attributes=require(_0x860c('0x6'));module['exports']=function(_0x460481,_0x10349f){return _0x460481['define']('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b71c9,_0xe9e811,_0x191936){if(_0x3b71c9[_0x860c('0x7')](_0x860c('0x8'))){_0x3b71c9['closedAt']=moment()[_0x860c('0x9')]('YYYY-MM-DD\x20HH:mm:ss');}_0x191936(null,_0x3b71c9);}}});}; \ No newline at end of file +var _0xadce=['exports','define','SmsInteraction','sms_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xadce,0xf1));var _0xeadc=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xadce[_0x20589d];return _0x422de9;};'use strict';var _=require(_0xeadc('0x0'));var util=require(_0xeadc('0x1'));var logger=require(_0xeadc('0x2'))(_0xeadc('0x3'));var moment=require(_0xeadc('0x4'));var BPromise=require(_0xeadc('0x5'));var rp=require(_0xeadc('0x6'));var fs=require('fs');var path=require(_0xeadc('0x7'));var rimraf=require(_0xeadc('0x8'));var config=require(_0xeadc('0x9'));var attributes=require(_0xeadc('0xa'));module[_0xeadc('0xb')]=function(_0x2d7f43,_0x115ae0){return _0x2d7f43[_0xeadc('0xc')](_0xeadc('0xd'),attributes,{'tableName':_0xeadc('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x152b20,_0x5d3bf,_0x2fdaf7){if(_0x152b20['changed']('closed')){_0x152b20[_0xeadc('0xf')]=moment()[_0xeadc('0x10')](_0xeadc('0x11'));}_0x2fdaf7(null,_0x152b20);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index bd75cab..2f7b34e 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 _0x833b=['stringify','error','code','message','result','catch','update','body','options','raw','where','attributes','UpdateSmsInteraction','AddTagsToSmsInteraction','SmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x304411,_0x1c8764){var _0x5c3bad=function(_0x3cc436){while(--_0x3cc436){_0x304411['push'](_0x304411['shift']());}};_0x5c3bad(++_0x1c8764);}(_0x833b,0x1ee));var _0xb833=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x833b[_0x1a72f3];return _0x57ef47;};'use strict';var _=require(_0xb833('0x0'));var util=require(_0xb833('0x1'));var moment=require(_0xb833('0x2'));var BPromise=require(_0xb833('0x3'));var rs=require(_0xb833('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb833('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb833('0x6'))(_0xb833('0x7'));var config=require(_0xb833('0x8'));var jayson=require(_0xb833('0x9'));var client=jayson['client'][_0xb833('0xa')]({'port':0x232a});config['redis']=_[_0xb833('0xb')](config[_0xb833('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb833('0xd'))(new Redis(config[_0xb833('0xc')]));require('./smsInteraction.socket')[_0xb833('0xe')](socket);function respondWithRpcPromise(_0x5d8212,_0x59d13b,_0x5d2e94){return new BPromise(function(_0x47a07e,_0x349b11){return client[_0xb833('0xf')](_0x5d8212,_0x5d2e94)[_0xb833('0x10')](function(_0x1eec06){logger[_0xb833('0x11')](_0xb833('0x12'),_0x59d13b,_0xb833('0x13'));logger[_0xb833('0x14')](_0xb833('0x15'),_0x59d13b,_0xb833('0x13'),JSON[_0xb833('0x16')](_0x1eec06));if(_0x1eec06[_0xb833('0x17')]){if(_0x1eec06[_0xb833('0x17')][_0xb833('0x18')]===0x1f4){logger[_0xb833('0x17')](_0xb833('0x12'),_0x59d13b,_0x1eec06[_0xb833('0x17')]['message']);return _0x349b11(_0x1eec06['error'][_0xb833('0x19')]);}logger[_0xb833('0x17')](_0xb833('0x12'),_0x59d13b,_0x1eec06['error']['message']);return _0x47a07e(_0x1eec06[_0xb833('0x17')][_0xb833('0x19')]);}else{logger[_0xb833('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x59d13b,_0xb833('0x13'));_0x47a07e(_0x1eec06[_0xb833('0x1a')][_0xb833('0x19')]);}})[_0xb833('0x1b')](function(_0xf4889c){logger[_0xb833('0x17')](_0xb833('0x12'),_0x59d13b,_0xf4889c);_0x349b11(_0xf4889c);});});}exports['UpdateSmsInteraction']=function(_0xcdfecf){var _0x44f689=this;return new Promise(function(_0x761ee7,_0x2e87ed){return db['SmsInteraction'][_0xb833('0x1c')](_0xcdfecf[_0xb833('0x1d')],{'raw':_0xcdfecf[_0xb833('0x1e')]?_0xcdfecf['options'][_0xb833('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcdfecf[_0xb833('0x1e')]?_0xcdfecf[_0xb833('0x1e')][_0xb833('0x20')]||null:null,'attributes':_0xcdfecf['options']?_0xcdfecf['options'][_0xb833('0x21')]||null:null,'limit':_0xcdfecf[_0xb833('0x1e')]?_0xcdfecf[_0xb833('0x1e')]['limit']||null:null})[_0xb833('0x10')](function(_0x42e36d){logger[_0xb833('0x11')](_0xb833('0x22'),_0xcdfecf);logger['debug'](_0xb833('0x22'),_0xcdfecf,JSON[_0xb833('0x16')](_0x42e36d));_0x761ee7(_0x42e36d);})['catch'](function(_0xea4916){logger[_0xb833('0x17')](_0xb833('0x22'),_0xea4916[_0xb833('0x19')],_0xcdfecf);_0x2e87ed(_0x44f689[_0xb833('0x17')](0x1f4,_0xea4916[_0xb833('0x19')]));});});};exports[_0xb833('0x23')]=function(_0x482ef9){return new Promise(function(_0x308970,_0x2263e6){return db[_0xb833('0x24')][_0xb833('0x25')]({'where':_0x482ef9[_0xb833('0x1e')]?_0x482ef9[_0xb833('0x1e')][_0xb833('0x20')]||null:null})[_0xb833('0x10')](function(_0x38e2e4){if(_0x38e2e4){return _0x38e2e4[_0xb833('0x26')](_0x482ef9[_0xb833('0x1d')][_0xb833('0x27')],_[_0xb833('0x28')](_0x482ef9[_0xb833('0x1d')],[_0xb833('0x27'),'id'])||{});}})[_0xb833('0x29')](function(_0x3598f0){logger[_0xb833('0x11')](_0xb833('0x2a'),_0x482ef9);logger[_0xb833('0x14')](_0xb833('0x2a'),_0x482ef9,JSON[_0xb833('0x16')](_0x3598f0));_0x308970(_0x3598f0);})['catch'](function(_0x466d2c){logger['error']('AddTags',_0x466d2c[_0xb833('0x19')],_0x482ef9);_0x2263e6(_this[_0xb833('0x17')](0x1f4,_0x466d2c[_0xb833('0x19')]));});});}; \ No newline at end of file +var _0x95c8=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x95c8,0xa3));var _0x895c=function(_0x5634e2,_0xcbc3d6){_0x5634e2=_0x5634e2-0x0;var _0x50b5f2=_0x95c8[_0x5634e2];return _0x50b5f2;};'use strict';var _=require(_0x895c('0x0'));var util=require(_0x895c('0x1'));var moment=require(_0x895c('0x2'));var BPromise=require(_0x895c('0x3'));var rs=require(_0x895c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x895c('0x5'))['db'];var utils=require(_0x895c('0x6'));var logger=require(_0x895c('0x7'))(_0x895c('0x8'));var config=require(_0x895c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x895c('0xa')][_0x895c('0xb')]({'port':0x232a});config['redis']=_[_0x895c('0xc')](config['redis'],{'host':_0x895c('0xd'),'port':0x18eb});var socket=require(_0x895c('0xe'))(new Redis(config['redis']));require(_0x895c('0xf'))[_0x895c('0x10')](socket);function respondWithRpcPromise(_0x1d61d7,_0xe7dd8b,_0x30d7d8){return new BPromise(function(_0x532535,_0x1900a2){return client[_0x895c('0x11')](_0x1d61d7,_0x30d7d8)[_0x895c('0x12')](function(_0x1cf6b3){logger[_0x895c('0x13')](_0x895c('0x14'),_0xe7dd8b,_0x895c('0x15'));logger[_0x895c('0x16')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0xe7dd8b,_0x895c('0x15'),JSON[_0x895c('0x17')](_0x1cf6b3));if(_0x1cf6b3['error']){if(_0x1cf6b3[_0x895c('0x18')]['code']===0x1f4){logger[_0x895c('0x18')]('SmsInteraction,\x20%s,\x20%s',_0xe7dd8b,_0x1cf6b3[_0x895c('0x18')]['message']);return _0x1900a2(_0x1cf6b3[_0x895c('0x18')][_0x895c('0x19')]);}logger[_0x895c('0x18')]('SmsInteraction,\x20%s,\x20%s',_0xe7dd8b,_0x1cf6b3['error'][_0x895c('0x19')]);return _0x532535(_0x1cf6b3[_0x895c('0x18')][_0x895c('0x19')]);}else{logger[_0x895c('0x13')]('SmsInteraction,\x20%s,\x20%s',_0xe7dd8b,_0x895c('0x15'));_0x532535(_0x1cf6b3[_0x895c('0x1a')]['message']);}})[_0x895c('0x1b')](function(_0x206a8a){logger[_0x895c('0x18')](_0x895c('0x14'),_0xe7dd8b,_0x206a8a);_0x1900a2(_0x206a8a);});});}exports[_0x895c('0x1c')]=function(_0x1ff4b2){var _0x14281e=this;return new Promise(function(_0x13892d,_0xc016ad){return db[_0x895c('0x1d')][_0x895c('0x1e')](_0x1ff4b2[_0x895c('0x1f')],{'raw':_0x1ff4b2[_0x895c('0x20')]?_0x1ff4b2[_0x895c('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ff4b2[_0x895c('0x20')]?_0x1ff4b2[_0x895c('0x20')][_0x895c('0x21')]||null:null,'attributes':_0x1ff4b2[_0x895c('0x20')]?_0x1ff4b2[_0x895c('0x20')][_0x895c('0x22')]||null:null,'limit':_0x1ff4b2['options']?_0x1ff4b2['options'][_0x895c('0x23')]||null:null})[_0x895c('0x12')](function(_0x969ed6){logger[_0x895c('0x13')](_0x895c('0x1c'),_0x1ff4b2);logger[_0x895c('0x16')](_0x895c('0x1c'),_0x1ff4b2,JSON[_0x895c('0x17')](_0x969ed6));_0x13892d(_0x969ed6);})[_0x895c('0x1b')](function(_0x1d21f3){logger[_0x895c('0x18')](_0x895c('0x1c'),_0x1d21f3[_0x895c('0x19')],_0x1ff4b2);_0xc016ad(_0x14281e['error'](0x1f4,_0x1d21f3[_0x895c('0x19')]));});});};exports[_0x895c('0x24')]=function(_0x3ffb31){return new Promise(function(_0x3260c1,_0x2a7907){return db[_0x895c('0x1d')][_0x895c('0x25')]({'where':_0x3ffb31['options']?_0x3ffb31[_0x895c('0x20')][_0x895c('0x21')]||null:null})[_0x895c('0x12')](function(_0x446094){if(_0x446094){return _0x446094[_0x895c('0x26')](_0x3ffb31[_0x895c('0x1f')][_0x895c('0x27')],_[_0x895c('0x28')](_0x3ffb31[_0x895c('0x1f')],[_0x895c('0x27'),'id'])||{});}})['spread'](function(_0xc8de5b){logger[_0x895c('0x13')]('AddTags',_0x3ffb31);logger[_0x895c('0x16')](_0x895c('0x29'),_0x3ffb31,JSON[_0x895c('0x17')](_0xc8de5b));_0x3260c1(_0xc8de5b);})[_0x895c('0x1b')](function(_0x13aa15){logger['error'](_0x895c('0x29'),_0x13aa15[_0x895c('0x19')],_0x3ffb31);_0x2a7907(_this[_0x895c('0x18')](0x1f4,_0x13aa15[_0x895c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 88730b6..9003c9a 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 _0xc7bd=['update','emit','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x4e938e,_0x37dba9){var _0x47aacf=function(_0x214269){while(--_0x214269){_0x4e938e['push'](_0x4e938e['shift']());}};_0x47aacf(++_0x37dba9);}(_0xc7bd,0x76));var _0xdc7b=function(_0x59f92c,_0x1bb856){_0x59f92c=_0x59f92c-0x0;var _0x4dcc80=_0xc7bd[_0x59f92c];return _0x4dcc80;};'use strict';var SmsInteractionEvents=require(_0xdc7b('0x0'));var events=[_0xdc7b('0x1'),'remove',_0xdc7b('0x2')];function createListener(_0xd10ff,_0x2373c2){return function(_0x3092ea){_0x2373c2[_0xdc7b('0x3')](_0xd10ff,_0x3092ea);};}function removeListener(_0x4f1e90,_0x145e72){return function(){SmsInteractionEvents['removeListener'](_0x4f1e90,_0x145e72);};}exports['register']=function(_0x1a898e){for(var _0x52609d=0x0,_0x72347b=events[_0xdc7b('0x4')];_0x52609d<_0x72347b;_0x52609d++){var _0x26737c=events[_0x52609d];var _0xdc24d8=createListener(_0xdc7b('0x5')+_0x26737c,_0x1a898e);SmsInteractionEvents['on'](_0x26737c,_0xdc24d8);}}; \ No newline at end of file +var _0x1b53=['register','length','smsInteraction:','./smsInteraction.events','save','remove','update','emit'];(function(_0x3ea647,_0x2a346d){var _0x4a7c98=function(_0x4c905c){while(--_0x4c905c){_0x3ea647['push'](_0x3ea647['shift']());}};_0x4a7c98(++_0x2a346d);}(_0x1b53,0x14b));var _0x31b5=function(_0xa3c044,_0x19d123){_0xa3c044=_0xa3c044-0x0;var _0x1d376f=_0x1b53[_0xa3c044];return _0x1d376f;};'use strict';var SmsInteractionEvents=require(_0x31b5('0x0'));var events=[_0x31b5('0x1'),_0x31b5('0x2'),_0x31b5('0x3')];function createListener(_0x21937a,_0xc4ea5a){return function(_0x1f7be9){_0xc4ea5a[_0x31b5('0x4')](_0x21937a,_0x1f7be9);};}function removeListener(_0x1d28b8,_0x48a1ad){return function(){SmsInteractionEvents['removeListener'](_0x1d28b8,_0x48a1ad);};}exports[_0x31b5('0x5')]=function(_0x169290){for(var _0x2cd154=0x0,_0x3699b6=events[_0x31b5('0x6')];_0x2cd154<_0x3699b6;_0x2cd154++){var _0x1bd045=events[_0x2cd154];var _0x16b660=createListener(_0x31b5('0x7')+_0x1bd045,_0x169290);SmsInteractionEvents['on'](_0x1bd045,_0x16b660);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 55bd0a5..20554db 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 _0x5f75=['update','/:id/accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','show','sms','create','/:id/status','status','put','/:id'];(function(_0x241a37,_0x18655c){var _0x4c1af3=function(_0xb24efe){while(--_0xb24efe){_0x241a37['push'](_0x241a37['shift']());}};_0x4c1af3(++_0x18655c);}(_0x5f75,0x1af));var _0x55f7=function(_0xe60eeb,_0x1e1c8b){_0xe60eeb=_0xe60eeb-0x0;var _0xe61831=_0x5f75[_0xe60eeb];return _0xe61831;};'use strict';var multer=require(_0x55f7('0x0'));var util=require(_0x55f7('0x1'));var path=require('path');var timeout=require(_0x55f7('0x2'));var express=require('express');var router=express[_0x55f7('0x3')]();var fs_extra=require(_0x55f7('0x4'));var auth=require(_0x55f7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x55f7('0x6'));var controller=require(_0x55f7('0x7'));router[_0x55f7('0x8')]('/',auth[_0x55f7('0x9')](),controller[_0x55f7('0xa')]);router['get'](_0x55f7('0xb'),auth[_0x55f7('0x9')](),controller['describe']);router[_0x55f7('0x8')]('/:id',auth[_0x55f7('0x9')](),controller[_0x55f7('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0x55f7('0xd'),'smsmessage:create'),controller[_0x55f7('0xe')]);router['post'](_0x55f7('0xf'),controller[_0x55f7('0x10')]);router[_0x55f7('0x11')](_0x55f7('0x12'),auth[_0x55f7('0x9')](),controller[_0x55f7('0x13')]);router[_0x55f7('0x11')](_0x55f7('0x14'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x55f7('0x15'),auth[_0x55f7('0x9')](),controller[_0x55f7('0x16')]);router[_0x55f7('0x17')](_0x55f7('0x12'),auth['isAuthenticated'](),controller[_0x55f7('0x18')]);module['exports']=router; \ No newline at end of file +var _0xf12f=['isAuthenticated','index','/describe','describe','/:id','show','tracked','sms','create','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get'];(function(_0x40a9c8,_0x593b7f){var _0x4b341d=function(_0x426cc2){while(--_0x426cc2){_0x40a9c8['push'](_0x40a9c8['shift']());}};_0x4b341d(++_0x593b7f);}(_0xf12f,0x104));var _0xff12=function(_0x30d4b8,_0x176f45){_0x30d4b8=_0x30d4b8-0x0;var _0x54c9a4=_0xf12f[_0x30d4b8];return _0x54c9a4;};'use strict';var multer=require(_0xff12('0x0'));var util=require(_0xff12('0x1'));var path=require(_0xff12('0x2'));var timeout=require(_0xff12('0x3'));var express=require('express');var router=express[_0xff12('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xff12('0x5'));var interaction=require(_0xff12('0x6'));var config=require(_0xff12('0x7'));var controller=require(_0xff12('0x8'));router[_0xff12('0x9')]('/',auth[_0xff12('0xa')](),controller[_0xff12('0xb')]);router['get'](_0xff12('0xc'),auth['isAuthenticated'](),controller[_0xff12('0xd')]);router[_0xff12('0x9')](_0xff12('0xe'),auth[_0xff12('0xa')](),controller[_0xff12('0xf')]);router['post']('/',auth[_0xff12('0xa')](),interaction[_0xff12('0x10')](_0xff12('0x11'),'smsmessage:create'),controller[_0xff12('0x12')]);router['post'](_0xff12('0x13'),controller[_0xff12('0x14')]);router['put']('/:id',auth[_0xff12('0xa')](),controller[_0xff12('0x15')]);router[_0xff12('0x16')](_0xff12('0x17'),auth[_0xff12('0xa')](),controller[_0xff12('0x18')]);router[_0xff12('0x16')](_0xff12('0x19'),auth['isAuthenticated'](),controller[_0xff12('0x1a')]);router[_0xff12('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xff12('0x1c')]);module[_0xff12('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 06066b3..8136c7b 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 _0xda3f=['DATE','sequelize','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xda3f,0x120));var _0xfda3=function(_0x4cbc2f,_0x55474f){_0x4cbc2f=_0x4cbc2f-0x0;var _0x32177a=_0xda3f[_0x4cbc2f];return _0x32177a;};'use strict';var Sequelize=require(_0xfda3('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xfda3('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xfda3('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfda3('0x3')]('in',_0xfda3('0x4')),'defaultValue':_0xfda3('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xfda3('0x5')]},'readAt':{'type':Sequelize[_0xfda3('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xfda3('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5c44=['out','DATE','STRING','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0xebb59a,_0x3e69c1){var _0x818667=function(_0x1992ce){while(--_0x1992ce){_0xebb59a['push'](_0xebb59a['shift']());}};_0x818667(++_0x3e69c1);}(_0x5c44,0x10b));var _0x45c4=function(_0x5da344,_0x5ded49){_0x5da344=_0x5da344-0x0;var _0x360cce=_0x5c44[_0x5da344];return _0x360cce;};'use strict';var Sequelize=require('sequelize');module[_0x45c4('0x0')]={'body':{'type':Sequelize[_0x45c4('0x1')](_0x45c4('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x45c4('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x45c4('0x4')]('in',_0x45c4('0x5')),'defaultValue':_0x45c4('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x45c4('0x6')]},'secret':{'type':Sequelize[_0x45c4('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x45c4('0x7')]},'providerResponse':{'type':Sequelize[_0x45c4('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 02d45c0..fd0aec1 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 _0x4b8b=['type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','VIRTUAL','options','SmsMessage','includeAll','findAll','rows','show','params','include','find','create','body','destroy','describe','accept','acceptMessage','UserId','user','agent','get','SmsInteraction','SmsInteractionId','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','format','channel','rejectmessage','received\x20delivery\x20report\x20from','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','messageId','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','offset','undefined','count','set','Content-Range','json','update','status','end','sendStatus','name','send','rawAttributes','fieldName'];(function(_0x251fa9,_0x458b2e){var _0x49b60d=function(_0x4ed582){while(--_0x4ed582){_0x251fa9['push'](_0x251fa9['shift']());}};_0x49b60d(++_0x458b2e);}(_0x4b8b,0x133));var _0xb4b8=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x4b8b[_0x5a9c0c];return _0x53c77d;};'use strict';var util=require(_0xb4b8('0x0'));var _=require(_0xb4b8('0x1'));var Redis=require(_0xb4b8('0x2'));var interactionService=require(_0xb4b8('0x3'));var qs=require(_0xb4b8('0x4'));var logger=require(_0xb4b8('0x5'))(_0xb4b8('0x6'));var config=require(_0xb4b8('0x7'));var db=require(_0xb4b8('0x8'))['db'];config[_0xb4b8('0x9')]=_[_0xb4b8('0xa')](config[_0xb4b8('0x9')],{'host':_0xb4b8('0xb'),'port':0x18eb});var socket=require(_0xb4b8('0xc'))(new Redis(config[_0xb4b8('0x9')]));require(_0xb4b8('0xd'))[_0xb4b8('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb4b8('0xf')][_0xb4b8('0x10')]({'port':0x232c});var client9002=jayson[_0xb4b8('0xf')][_0xb4b8('0x10')]({'port':0x232a});var interaction_log=require(_0xb4b8('0x5'))('sms-interactions');function respondWithRpcPromise(_0x47240f,_0x391d44,_0x5eba26,_0x4361ce){return new Promise(function(_0x242a61,_0x13ad91){var _0x38ae7d=_0x4361ce||client;return _0x38ae7d[_0xb4b8('0x11')](_0x47240f,_0x5eba26)[_0xb4b8('0x12')](function(_0x3e7a46){logger[_0xb4b8('0x13')](_0xb4b8('0x14'),_0x391d44,_0xb4b8('0x15'));logger[_0xb4b8('0x16')](_0xb4b8('0x17'),_0x391d44,_0xb4b8('0x15'),JSON[_0xb4b8('0x18')](_0x3e7a46));if(_0x3e7a46[_0xb4b8('0x19')]){if(_0x3e7a46[_0xb4b8('0x19')][_0xb4b8('0x1a')]===0x1f4){logger['error'](_0xb4b8('0x14'),_0x391d44,_0x3e7a46['error'][_0xb4b8('0x1b')]);return _0x13ad91(_0x3e7a46[_0xb4b8('0x19')][_0xb4b8('0x1b')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x391d44,_0x3e7a46[_0xb4b8('0x19')]['message']);return _0x242a61(_0x3e7a46[_0xb4b8('0x19')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x391d44,_0xb4b8('0x15'));_0x242a61(_0x3e7a46[_0xb4b8('0x1c')][_0xb4b8('0x1b')]);}})[_0xb4b8('0x1d')](function(_0x2568c6){logger[_0xb4b8('0x19')](_0xb4b8('0x14'),_0x391d44,_0x2568c6);_0x13ad91(_0x2568c6);});});}function respondWithResult(_0x5aabf2,_0xaf680f){_0xaf680f=_0xaf680f||0xc8;return function(_0xe444d9){if(_0xe444d9){return _0x5aabf2['status'](_0xaf680f)['json'](_0xe444d9);}};}function respondWithFilteredResult(_0x566495,_0x4f802b){return function(_0x572451){if(_0x572451){var _0xd3b4d8=typeof _0x4f802b[_0xb4b8('0x1e')]===_0xb4b8('0x1f')&&typeof _0x4f802b['limit']===_0xb4b8('0x1f');var _0x2fc96a=_0x572451['count'];var _0x19dd0d=_0xd3b4d8?0x0:_0x4f802b[_0xb4b8('0x1e')];var _0x17cdd8=_0xd3b4d8?_0x572451[_0xb4b8('0x20')]:_0x4f802b[_0xb4b8('0x1e')]+_0x4f802b['limit'];var _0x156cf6;if(_0x17cdd8>=_0x2fc96a){_0x17cdd8=_0x2fc96a;_0x156cf6=0xc8;}else{_0x156cf6=0xce;}_0x566495['status'](_0x156cf6);return _0x566495[_0xb4b8('0x21')](_0xb4b8('0x22'),_0x19dd0d+'-'+_0x17cdd8+'/'+_0x2fc96a)[_0xb4b8('0x23')](_0x572451);}return null;};}function saveUpdates(_0x405c18){return function(_0x49a879){if(_0x49a879){return _0x49a879[_0xb4b8('0x24')](_0x405c18)['then'](function(_0x53282e){return _0x53282e;});}return null;};}function removeEntity(_0x4c564e){return function(_0x47fe96){if(_0x47fe96){return _0x47fe96['destroy']()[_0xb4b8('0x12')](function(){_0x4c564e[_0xb4b8('0x25')](0xcc)[_0xb4b8('0x26')]();});}};}function handleEntityNotFound(_0x4b0a38){return function(_0x424d79){if(!_0x424d79){_0x4b0a38[_0xb4b8('0x27')](0x194);}return _0x424d79;};}function handleError(_0x4656b1,_0xb57bc3){_0xb57bc3=_0xb57bc3||0x1f4;return function(_0x1f65b6){logger[_0xb4b8('0x19')](_0x1f65b6['stack']);if(_0x1f65b6[_0xb4b8('0x28')]){delete _0x1f65b6['name'];}_0x4656b1[_0xb4b8('0x25')](_0xb57bc3)[_0xb4b8('0x29')](_0x1f65b6);};}exports['index']=function(_0x4755da,_0x4869cf){var _0x1b0fe0={},_0x10957f={},_0x5e67e5={'count':0x0,'rows':[]};var _0x3801cb=_['map'](db['SmsMessage'][_0xb4b8('0x2a')],function(_0xf40848){return{'name':_0xf40848[_0xb4b8('0x2b')],'type':_0xf40848[_0xb4b8('0x2c')][_0xb4b8('0x2d')]};});_0x10957f[_0xb4b8('0x2e')]=_['map'](_0x3801cb,_0xb4b8('0x28'));_0x10957f[_0xb4b8('0x2f')]=_[_0xb4b8('0x30')](_0x4755da[_0xb4b8('0x2f')]);_0x10957f[_0xb4b8('0x31')]=_['intersection'](_0x10957f[_0xb4b8('0x2e')],_0x10957f['query']);_0x1b0fe0[_0xb4b8('0x32')]=_[_0xb4b8('0x33')](_0x10957f[_0xb4b8('0x2e')],qs[_0xb4b8('0x34')](_0x4755da[_0xb4b8('0x2f')][_0xb4b8('0x34')]));_0x1b0fe0[_0xb4b8('0x32')]=_0x1b0fe0[_0xb4b8('0x32')][_0xb4b8('0x35')]?_0x1b0fe0[_0xb4b8('0x32')]:_0x10957f[_0xb4b8('0x2e')];if(!_0x4755da[_0xb4b8('0x2f')][_0xb4b8('0x36')](_0xb4b8('0x37'))){_0x1b0fe0[_0xb4b8('0x38')]=qs[_0xb4b8('0x38')](_0x4755da[_0xb4b8('0x2f')]['limit']);_0x1b0fe0[_0xb4b8('0x1e')]=qs[_0xb4b8('0x1e')](_0x4755da[_0xb4b8('0x2f')][_0xb4b8('0x1e')]);}_0x1b0fe0['order']=qs[_0xb4b8('0x39')](_0x4755da[_0xb4b8('0x2f')]['sort']);_0x1b0fe0[_0xb4b8('0x3a')]=qs[_0xb4b8('0x31')](_[_0xb4b8('0x3b')](_0x4755da['query'],_0x10957f[_0xb4b8('0x31')]),_0x3801cb);if(_0x4755da['query'][_0xb4b8('0x3c')]){_0x1b0fe0[_0xb4b8('0x3a')]=_[_0xb4b8('0x3d')](_0x1b0fe0['where'],{'$or':_[_0xb4b8('0x3e')](_0x3801cb,function(_0x40d40f){if(_0x40d40f[_0xb4b8('0x2c')]!==_0xb4b8('0x3f')){var _0x2fbf1f={};_0x2fbf1f[_0x40d40f[_0xb4b8('0x28')]]={'$like':'%'+_0x4755da['query']['filter']+'%'};return _0x2fbf1f;}})});}_0x1b0fe0=_[_0xb4b8('0x3d')]({},_0x1b0fe0,_0x4755da[_0xb4b8('0x40')]);var _0x7793fc={'where':_0x1b0fe0[_0xb4b8('0x3a')]};return db[_0xb4b8('0x41')]['count'](_0x7793fc)['then'](function(_0x1ec27){_0x5e67e5['count']=_0x1ec27;if(_0x4755da[_0xb4b8('0x2f')][_0xb4b8('0x42')]){_0x1b0fe0['include']=[{'all':!![]}];}return db[_0xb4b8('0x41')][_0xb4b8('0x43')](_0x1b0fe0);})[_0xb4b8('0x12')](function(_0x5aa053){_0x5e67e5[_0xb4b8('0x44')]=_0x5aa053;return _0x5e67e5;})['then'](respondWithFilteredResult(_0x4869cf,_0x1b0fe0))[_0xb4b8('0x1d')](handleError(_0x4869cf,null));};exports[_0xb4b8('0x45')]=function(_0x204759,_0x15560a){var _0xa4b1ab={'raw':!![],'where':{'id':_0x204759[_0xb4b8('0x46')]['id']}},_0x35e31a={};_0x35e31a[_0xb4b8('0x2e')]=_[_0xb4b8('0x30')](db[_0xb4b8('0x41')]['rawAttributes']);_0x35e31a[_0xb4b8('0x2f')]=_[_0xb4b8('0x30')](_0x204759[_0xb4b8('0x2f')]);_0x35e31a[_0xb4b8('0x31')]=_[_0xb4b8('0x33')](_0x35e31a[_0xb4b8('0x2e')],_0x35e31a[_0xb4b8('0x2f')]);_0xa4b1ab['attributes']=_['intersection'](_0x35e31a[_0xb4b8('0x2e')],qs['fields'](_0x204759[_0xb4b8('0x2f')][_0xb4b8('0x34')]));_0xa4b1ab[_0xb4b8('0x32')]=_0xa4b1ab[_0xb4b8('0x32')][_0xb4b8('0x35')]?_0xa4b1ab[_0xb4b8('0x32')]:_0x35e31a[_0xb4b8('0x2e')];if(_0x204759[_0xb4b8('0x2f')]['includeAll']){_0xa4b1ab[_0xb4b8('0x47')]=[{'all':!![]}];}_0xa4b1ab=_[_0xb4b8('0x3d')]({},_0xa4b1ab,_0x204759[_0xb4b8('0x40')]);return db[_0xb4b8('0x41')][_0xb4b8('0x48')](_0xa4b1ab)[_0xb4b8('0x12')](handleEntityNotFound(_0x15560a,null))[_0xb4b8('0x12')](respondWithResult(_0x15560a,null))[_0xb4b8('0x1d')](handleError(_0x15560a,null));};exports['create']=function(_0x2b6963,_0x40eb83){return db[_0xb4b8('0x41')][_0xb4b8('0x49')](_0x2b6963['body'],{})[_0xb4b8('0x12')](respondWithResult(_0x40eb83,0xc9))[_0xb4b8('0x1d')](handleError(_0x40eb83,null));};exports[_0xb4b8('0x24')]=function(_0x586b57,_0x1146d3){if(_0x586b57[_0xb4b8('0x4a')]['id']){delete _0x586b57['body']['id'];}return db[_0xb4b8('0x41')]['find']({'where':{'id':_0x586b57[_0xb4b8('0x46')]['id']}})['then'](handleEntityNotFound(_0x1146d3,null))['then'](saveUpdates(_0x586b57[_0xb4b8('0x4a')],null))[_0xb4b8('0x12')](respondWithResult(_0x1146d3,null))[_0xb4b8('0x1d')](handleError(_0x1146d3,null));};exports[_0xb4b8('0x4b')]=function(_0xe8e4bb,_0x3f7eeb){return db[_0xb4b8('0x41')][_0xb4b8('0x48')]({'where':{'id':_0xe8e4bb[_0xb4b8('0x46')]['id']}})[_0xb4b8('0x12')](handleEntityNotFound(_0x3f7eeb,null))['then'](removeEntity(_0x3f7eeb,null))[_0xb4b8('0x1d')](handleError(_0x3f7eeb,null));};exports['describe']=function(_0x35a94a,_0x48d617){return db[_0xb4b8('0x41')][_0xb4b8('0x4c')]()[_0xb4b8('0x12')](respondWithResult(_0x48d617,null))[_0xb4b8('0x1d')](handleError(_0x48d617,null));};exports[_0xb4b8('0x4d')]=function(_0x3c424a,_0x263b66){var _0x5ad84d='sms';return interactionService[_0xb4b8('0x4e')](_0x3c424a,_0x5ad84d)[_0xb4b8('0x12')](respondWithResult(_0x263b66,null))[_0xb4b8('0x1d')](handleError(_0x263b66,null));};exports['reject']=function(_0x2cce2b,_0x571e18){var _0x135748={'agent':{},'channel':'sms'};if(_0x2cce2b[_0xb4b8('0x4a')]['id']){delete _0x2cce2b['body']['id'];}_0x2cce2b[_0xb4b8('0x4a')][_0xb4b8('0x4f')]=_0x2cce2b['body'][_0xb4b8('0x4f')]||_0x2cce2b[_0xb4b8('0x50')]['id'];_0x135748[_0xb4b8('0x51')]['id']=_0x2cce2b[_0xb4b8('0x4a')]['UserId'];return db[_0xb4b8('0x41')][_0xb4b8('0x48')]({'where':{'id':_0x2cce2b[_0xb4b8('0x46')]['id'],'UserId':null}})[_0xb4b8('0x12')](handleEntityNotFound(_0x571e18,null))['then'](function(_0x444475){if(_0x444475){_0x135748['message']=_0x444475[_0xb4b8('0x52')]({'plain':!![]});return db[_0xb4b8('0x53')][_0xb4b8('0x48')]({'where':{'id':_0x444475[_0xb4b8('0x54')]}});}return null;})[_0xb4b8('0x12')](handleEntityNotFound(_0x571e18,null))[_0xb4b8('0x12')](function(_0x291585){if(_0x291585){_0x135748[_0xb4b8('0x55')]=_0x291585[_0xb4b8('0x52')]({'plain':!![]});interaction_log['info'](_0xb4b8('0x56'),_0x2cce2b[_0xb4b8('0x50')]['id'],_0x2cce2b[_0xb4b8('0x50')][_0xb4b8('0x28')],_0x2cce2b[_0xb4b8('0x50')]['role'],_0x135748[_0xb4b8('0x55')]['id'],_0x2cce2b['body']?JSON[_0xb4b8('0x18')](_0x2cce2b[_0xb4b8('0x4a')]):_0xb4b8('0x57'));return respondWithRpcPromise(_0xb4b8('0x58'),_0xb4b8('0x59'),_0x135748);}return null;})[_0xb4b8('0x12')](function(_0x233ce1){var _0x1915ea=_0xb4b8('0x5a')+_0x233ce1[_0xb4b8('0x1b')][_0xb4b8('0x5b')];return db[_0xb4b8('0x5c')]['query'](_0x1915ea,{'type':db['Sequelize'][_0xb4b8('0x5d')][_0xb4b8('0x5e')],'raw':!![]})[_0xb4b8('0x12')](function(_0xdf821a){return _0xdf821a;});})[_0xb4b8('0x12')](function(_0x3ee6ca){if(_0x3ee6ca){_0x135748['message'][_0xb4b8('0x5f')]=_0x3ee6ca[0x0];if(!_0x2cce2b[_0xb4b8('0x4a')]['UserId'])return;return db['User'][_0xb4b8('0x48')]({'where':{'id':_0x2cce2b[_0xb4b8('0x4a')][_0xb4b8('0x4f')],'role':_0xb4b8('0x51')},'attributes':['id',_0xb4b8('0x28'),_0xb4b8('0x60'),_0xb4b8('0x61'),'internal'],'raw':!![]});}return null;})[_0xb4b8('0x12')](function(_0x4d3cd0){if(!_0x4d3cd0)return null;_0x135748[_0xb4b8('0x1b')][_0xb4b8('0x51')]=_0x4d3cd0;return _0x135748;})[_0xb4b8('0x12')](function(_0xbee00b){if(_0xbee00b){_0xbee00b[_0xb4b8('0x1b')]['interface']=util[_0xb4b8('0x62')]('SIP/%s',_0x2cce2b[_0xb4b8('0x50')][_0xb4b8('0x28')]);_0xbee00b['message']['channel']=_0x135748[_0xb4b8('0x63')];_0xbee00b[_0xb4b8('0x1b')]['motionChannel']=_0x135748[_0xb4b8('0x63')];_0xbee00b[_0xb4b8('0x1b')]['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0xb4b8('0x64'),'message':_0xbee00b[_0xb4b8('0x1b')]},client9002);return _0x135748;}return null;})[_0xb4b8('0x12')](respondWithResult(_0x571e18,null))[_0xb4b8('0x1d')](handleError(_0x571e18,null));};exports[_0xb4b8('0x25')]=function(_0x5d2965,_0x576759){if(_0x5d2965[_0xb4b8('0x4a')]['id']){delete _0x5d2965['body']['id'];}var _0x3631e1;return db[_0xb4b8('0x41')]['find']({'where':{'id':_0x5d2965['params']['id']}})[_0xb4b8('0x12')](handleEntityNotFound(_0x576759,null))[_0xb4b8('0x12')](function(_0x3a608e){if(_0x3a608e){_0x3631e1=_0x3a608e;return db['SmsAccount'][_0xb4b8('0x48')]({'where':{'id':_0x3a608e['SmsAccountId']}});}})[_0xb4b8('0x12')](handleEntityNotFound(_0x576759,null))[_0xb4b8('0x12')](function(_0x4c416d){if(_0x4c416d){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb4b8('0x25'),_0xb4b8('0x65'),_0x4c416d[_0xb4b8('0x2c')],util['inspect'](_0x5d2965[_0xb4b8('0x4a')],{'showHidden':![],'depth':null}));switch(_0x4c416d[_0xb4b8('0x2c')]){case _0xb4b8('0x66'):if(_0x5d2965[_0xb4b8('0x4a')][_0xb4b8('0x67')]&&_0x5d2965[_0xb4b8('0x4a')]['MessageSid']===_0x3631e1['messageId']){return _0x3631e1[_0xb4b8('0x24')]({'read':!![]});}else{logger[_0xb4b8('0x19')](_0xb4b8('0x68'),_0xb4b8('0x25'),_0xb4b8('0x66'),util[_0xb4b8('0x69')](_0x5d2965['body'],{'showHidden':![],'depth':null}));}break;case _0xb4b8('0x6a'):if(_0x5d2965[_0xb4b8('0x4a')]['MessageUUID']&&_0x5d2965[_0xb4b8('0x4a')][_0xb4b8('0x6b')]===_0x3631e1[_0xb4b8('0x6c')]&&_['indexOf']([_0xb4b8('0x6d'),_0xb4b8('0x6e')],_0x5d2965['body'][_0xb4b8('0x6f')])>=0x0){return _0x3631e1[_0xb4b8('0x24')]({'read':!![]});}else{logger[_0xb4b8('0x19')](_0xb4b8('0x68'),_0xb4b8('0x25'),_0xb4b8('0x70'),util[_0xb4b8('0x69')](_0x5d2965[_0xb4b8('0x4a')],{'showHidden':![],'depth':null}));}break;case _0xb4b8('0x71'):var _0x1f5039=_0x5d2965['body'][_0xb4b8('0x72')][0x0];if(_0x1f5039[_0xb4b8('0x25')][_0xb4b8('0x73')]===_0xb4b8('0x74')){return _0x3631e1[_0xb4b8('0x24')]({'read':!![]});}else{logger[_0xb4b8('0x19')](_0xb4b8('0x68'),'status',_0xb4b8('0x71'),util[_0xb4b8('0x69')](_0x5d2965[_0xb4b8('0x4a')],{'showHidden':![],'depth':null}));}break;}return _0x3631e1;}})[_0xb4b8('0x12')](respondWithResult(_0x576759,null))['catch'](handleError(_0x576759,null));}; \ No newline at end of file +var _0x2564=['sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','interface','format','channel','motionChannel','event','EventManager','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','sent','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','results','groupName','DELIVERED','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client','sms-interactions','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','undefined','limit','count','set','Content-Range','update','sendStatus','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','params','includeAll','find','catch','create','body','destroy','describe','acceptMessage','reject','sms','UserId','user','agent','get','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','rejectMessage','ContactId'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x2564,0x17b));var _0x4256=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2564[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var _=require(_0x4256('0x0'));var Redis=require(_0x4256('0x1'));var interactionService=require('../../components/interaction/service');var qs=require(_0x4256('0x2'));var logger=require(_0x4256('0x3'))(_0x4256('0x4'));var config=require(_0x4256('0x5'));var db=require('../../mysqldb')['db'];config[_0x4256('0x6')]=_[_0x4256('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4256('0x8'))(new Redis(config[_0x4256('0x6')]));require(_0x4256('0x9'))[_0x4256('0xa')](socket);var jayson=require(_0x4256('0xb'));var client=jayson['client'][_0x4256('0xc')]({'port':0x232c});var client9002=jayson[_0x4256('0xd')]['http']({'port':0x232a});var interaction_log=require(_0x4256('0x3'))(_0x4256('0xe'));function respondWithRpcPromise(_0x374d82,_0x1bf286,_0x1a1301,_0xf182be){return new Promise(function(_0x36ed79,_0x2b435c){var _0x4a926c=_0xf182be||client;return _0x4a926c[_0x4256('0xf')](_0x374d82,_0x1a1301)[_0x4256('0x10')](function(_0x1e09b1){logger[_0x4256('0x11')](_0x4256('0x12'),_0x1bf286,_0x4256('0x13'));logger['debug'](_0x4256('0x14'),_0x1bf286,'request\x20sent',JSON[_0x4256('0x15')](_0x1e09b1));if(_0x1e09b1[_0x4256('0x16')]){if(_0x1e09b1[_0x4256('0x16')][_0x4256('0x17')]===0x1f4){logger[_0x4256('0x16')](_0x4256('0x12'),_0x1bf286,_0x1e09b1[_0x4256('0x16')]['message']);return _0x2b435c(_0x1e09b1[_0x4256('0x16')][_0x4256('0x18')]);}logger[_0x4256('0x16')](_0x4256('0x12'),_0x1bf286,_0x1e09b1[_0x4256('0x16')][_0x4256('0x18')]);return _0x36ed79(_0x1e09b1[_0x4256('0x16')][_0x4256('0x18')]);}else{logger[_0x4256('0x11')](_0x4256('0x12'),_0x1bf286,'request\x20sent');_0x36ed79(_0x1e09b1[_0x4256('0x19')]['message']);}})['catch'](function(_0x3698eb){logger[_0x4256('0x16')](_0x4256('0x12'),_0x1bf286,_0x3698eb);_0x2b435c(_0x3698eb);});});}function respondWithResult(_0x5812b4,_0x2f903e){_0x2f903e=_0x2f903e||0xc8;return function(_0x2b5930){if(_0x2b5930){return _0x5812b4[_0x4256('0x1a')](_0x2f903e)[_0x4256('0x1b')](_0x2b5930);}};}function respondWithFilteredResult(_0x25985c,_0x2760fb){return function(_0x3bcc33){if(_0x3bcc33){var _0x5166e7=typeof _0x2760fb[_0x4256('0x1c')]===_0x4256('0x1d')&&typeof _0x2760fb[_0x4256('0x1e')]===_0x4256('0x1d');var _0x3c28a2=_0x3bcc33[_0x4256('0x1f')];var _0x1c59cf=_0x5166e7?0x0:_0x2760fb[_0x4256('0x1c')];var _0x5d41e7=_0x5166e7?_0x3bcc33[_0x4256('0x1f')]:_0x2760fb[_0x4256('0x1c')]+_0x2760fb['limit'];var _0x46e864;if(_0x5d41e7>=_0x3c28a2){_0x5d41e7=_0x3c28a2;_0x46e864=0xc8;}else{_0x46e864=0xce;}_0x25985c[_0x4256('0x1a')](_0x46e864);return _0x25985c[_0x4256('0x20')](_0x4256('0x21'),_0x1c59cf+'-'+_0x5d41e7+'/'+_0x3c28a2)[_0x4256('0x1b')](_0x3bcc33);}return null;};}function saveUpdates(_0x24296e){return function(_0x1fdd7b){if(_0x1fdd7b){return _0x1fdd7b[_0x4256('0x22')](_0x24296e)[_0x4256('0x10')](function(_0x2d2530){return _0x2d2530;});}return null;};}function removeEntity(_0x47d378){return function(_0x335c40){if(_0x335c40){return _0x335c40['destroy']()[_0x4256('0x10')](function(){_0x47d378[_0x4256('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d2fc9){return function(_0x3b064b){if(!_0x3b064b){_0x3d2fc9[_0x4256('0x23')](0x194);}return _0x3b064b;};}function handleError(_0x28f9e3,_0xc54189){_0xc54189=_0xc54189||0x1f4;return function(_0x5d6ea0){logger[_0x4256('0x16')](_0x5d6ea0[_0x4256('0x24')]);if(_0x5d6ea0[_0x4256('0x25')]){delete _0x5d6ea0['name'];}_0x28f9e3[_0x4256('0x1a')](_0xc54189)[_0x4256('0x26')](_0x5d6ea0);};}exports[_0x4256('0x27')]=function(_0x5351c0,_0x63f192){var _0x38952c={},_0x267630={},_0x16647f={'count':0x0,'rows':[]};var _0x3881f2=_[_0x4256('0x28')](db[_0x4256('0x29')][_0x4256('0x2a')],function(_0x100c3a){return{'name':_0x100c3a[_0x4256('0x2b')],'type':_0x100c3a[_0x4256('0x2c')][_0x4256('0x2d')]};});_0x267630[_0x4256('0x2e')]=_[_0x4256('0x28')](_0x3881f2,'name');_0x267630[_0x4256('0x2f')]=_[_0x4256('0x30')](_0x5351c0[_0x4256('0x2f')]);_0x267630['filters']=_['intersection'](_0x267630[_0x4256('0x2e')],_0x267630[_0x4256('0x2f')]);_0x38952c[_0x4256('0x31')]=_[_0x4256('0x32')](_0x267630[_0x4256('0x2e')],qs[_0x4256('0x33')](_0x5351c0[_0x4256('0x2f')][_0x4256('0x33')]));_0x38952c[_0x4256('0x31')]=_0x38952c['attributes'][_0x4256('0x34')]?_0x38952c[_0x4256('0x31')]:_0x267630[_0x4256('0x2e')];if(!_0x5351c0['query'][_0x4256('0x35')](_0x4256('0x36'))){_0x38952c[_0x4256('0x1e')]=qs[_0x4256('0x1e')](_0x5351c0[_0x4256('0x2f')][_0x4256('0x1e')]);_0x38952c[_0x4256('0x1c')]=qs[_0x4256('0x1c')](_0x5351c0[_0x4256('0x2f')][_0x4256('0x1c')]);}_0x38952c[_0x4256('0x37')]=qs['sort'](_0x5351c0['query']['sort']);_0x38952c['where']=qs[_0x4256('0x38')](_[_0x4256('0x39')](_0x5351c0[_0x4256('0x2f')],_0x267630[_0x4256('0x38')]),_0x3881f2);if(_0x5351c0[_0x4256('0x2f')][_0x4256('0x3a')]){_0x38952c[_0x4256('0x3b')]=_[_0x4256('0x3c')](_0x38952c[_0x4256('0x3b')],{'$or':_[_0x4256('0x28')](_0x3881f2,function(_0xa39f89){if(_0xa39f89[_0x4256('0x2c')]!==_0x4256('0x3d')){var _0x10e217={};_0x10e217[_0xa39f89[_0x4256('0x25')]]={'$like':'%'+_0x5351c0[_0x4256('0x2f')]['filter']+'%'};return _0x10e217;}})});}_0x38952c=_[_0x4256('0x3c')]({},_0x38952c,_0x5351c0[_0x4256('0x3e')]);var _0x459107={'where':_0x38952c[_0x4256('0x3b')]};return db[_0x4256('0x29')][_0x4256('0x1f')](_0x459107)[_0x4256('0x10')](function(_0x47f779){_0x16647f['count']=_0x47f779;if(_0x5351c0['query']['includeAll']){_0x38952c[_0x4256('0x3f')]=[{'all':!![]}];}return db[_0x4256('0x29')][_0x4256('0x40')](_0x38952c);})[_0x4256('0x10')](function(_0x4c9cc0){_0x16647f['rows']=_0x4c9cc0;return _0x16647f;})[_0x4256('0x10')](respondWithFilteredResult(_0x63f192,_0x38952c))['catch'](handleError(_0x63f192,null));};exports[_0x4256('0x41')]=function(_0xd1c308,_0x31415d){var _0x594e5d={'raw':!![],'where':{'id':_0xd1c308[_0x4256('0x42')]['id']}},_0x1f81da={};_0x1f81da[_0x4256('0x2e')]=_[_0x4256('0x30')](db[_0x4256('0x29')][_0x4256('0x2a')]);_0x1f81da['query']=_[_0x4256('0x30')](_0xd1c308[_0x4256('0x2f')]);_0x1f81da[_0x4256('0x38')]=_['intersection'](_0x1f81da['model'],_0x1f81da[_0x4256('0x2f')]);_0x594e5d[_0x4256('0x31')]=_[_0x4256('0x32')](_0x1f81da[_0x4256('0x2e')],qs[_0x4256('0x33')](_0xd1c308[_0x4256('0x2f')][_0x4256('0x33')]));_0x594e5d[_0x4256('0x31')]=_0x594e5d['attributes'][_0x4256('0x34')]?_0x594e5d[_0x4256('0x31')]:_0x1f81da[_0x4256('0x2e')];if(_0xd1c308[_0x4256('0x2f')][_0x4256('0x43')]){_0x594e5d[_0x4256('0x3f')]=[{'all':!![]}];}_0x594e5d=_['merge']({},_0x594e5d,_0xd1c308[_0x4256('0x3e')]);return db[_0x4256('0x29')][_0x4256('0x44')](_0x594e5d)[_0x4256('0x10')](handleEntityNotFound(_0x31415d,null))[_0x4256('0x10')](respondWithResult(_0x31415d,null))[_0x4256('0x45')](handleError(_0x31415d,null));};exports[_0x4256('0x46')]=function(_0x26bf7a,_0x285c64){return db['SmsMessage']['create'](_0x26bf7a[_0x4256('0x47')],{})['then'](respondWithResult(_0x285c64,0xc9))['catch'](handleError(_0x285c64,null));};exports['update']=function(_0x58ca09,_0x3429a9){if(_0x58ca09[_0x4256('0x47')]['id']){delete _0x58ca09[_0x4256('0x47')]['id'];}return db[_0x4256('0x29')][_0x4256('0x44')]({'where':{'id':_0x58ca09[_0x4256('0x42')]['id']}})['then'](handleEntityNotFound(_0x3429a9,null))[_0x4256('0x10')](saveUpdates(_0x58ca09[_0x4256('0x47')],null))['then'](respondWithResult(_0x3429a9,null))[_0x4256('0x45')](handleError(_0x3429a9,null));};exports[_0x4256('0x48')]=function(_0x5946e6,_0x49545d){return db[_0x4256('0x29')]['find']({'where':{'id':_0x5946e6[_0x4256('0x42')]['id']}})[_0x4256('0x10')](handleEntityNotFound(_0x49545d,null))[_0x4256('0x10')](removeEntity(_0x49545d,null))[_0x4256('0x45')](handleError(_0x49545d,null));};exports[_0x4256('0x49')]=function(_0x594f5f,_0x3760db){return db['SmsMessage']['describe']()['then'](respondWithResult(_0x3760db,null))[_0x4256('0x45')](handleError(_0x3760db,null));};exports['accept']=function(_0xb6aa34,_0x131a1d){var _0x40170c='sms';return interactionService[_0x4256('0x4a')](_0xb6aa34,_0x40170c)[_0x4256('0x10')](respondWithResult(_0x131a1d,null))[_0x4256('0x45')](handleError(_0x131a1d,null));};exports[_0x4256('0x4b')]=function(_0x3166d2,_0x4ada2b){var _0x22826e={'agent':{},'channel':_0x4256('0x4c')};if(_0x3166d2[_0x4256('0x47')]['id']){delete _0x3166d2[_0x4256('0x47')]['id'];}_0x3166d2[_0x4256('0x47')]['UserId']=_0x3166d2[_0x4256('0x47')][_0x4256('0x4d')]||_0x3166d2[_0x4256('0x4e')]['id'];_0x22826e[_0x4256('0x4f')]['id']=_0x3166d2['body'][_0x4256('0x4d')];return db[_0x4256('0x29')]['find']({'where':{'id':_0x3166d2[_0x4256('0x42')]['id'],'UserId':null}})[_0x4256('0x10')](handleEntityNotFound(_0x4ada2b,null))[_0x4256('0x10')](function(_0x375d7a){if(_0x375d7a){_0x22826e[_0x4256('0x18')]=_0x375d7a[_0x4256('0x50')]({'plain':!![]});return db[_0x4256('0x51')]['find']({'where':{'id':_0x375d7a[_0x4256('0x52')]}});}return null;})[_0x4256('0x10')](handleEntityNotFound(_0x4ada2b,null))[_0x4256('0x10')](function(_0x3c0b16){if(_0x3c0b16){_0x22826e['interaction']=_0x3c0b16[_0x4256('0x50')]({'plain':!![]});interaction_log['info'](_0x4256('0x53'),_0x3166d2['user']['id'],_0x3166d2['user'][_0x4256('0x25')],_0x3166d2[_0x4256('0x4e')][_0x4256('0x54')],_0x22826e[_0x4256('0x55')]['id'],_0x3166d2[_0x4256('0x47')]?JSON[_0x4256('0x15')](_0x3166d2['body']):_0x4256('0x56'));return respondWithRpcPromise('RejectMessage',_0x4256('0x57'),_0x22826e);}return null;})[_0x4256('0x10')](function(_0x2b15df){var _0x233939='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2b15df[_0x4256('0x18')][_0x4256('0x58')];return db[_0x4256('0x59')][_0x4256('0x2f')](_0x233939,{'type':db[_0x4256('0x5a')][_0x4256('0x5b')][_0x4256('0x5c')],'raw':!![]})['then'](function(_0x2ba224){return _0x2ba224;});})[_0x4256('0x10')](function(_0x9c5ab4){if(_0x9c5ab4){_0x22826e['message']['contact']=_0x9c5ab4[0x0];if(!_0x3166d2[_0x4256('0x47')]['UserId'])return;return db[_0x4256('0x5d')]['find']({'where':{'id':_0x3166d2[_0x4256('0x47')]['UserId'],'role':'agent'},'attributes':['id',_0x4256('0x25'),_0x4256('0x5e'),_0x4256('0x5f'),'internal'],'raw':!![]});}return null;})[_0x4256('0x10')](function(_0x5584d9){if(!_0x5584d9)return null;_0x22826e[_0x4256('0x18')][_0x4256('0x4f')]=_0x5584d9;return _0x22826e;})[_0x4256('0x10')](function(_0x2ea2d0){if(_0x2ea2d0){_0x2ea2d0[_0x4256('0x18')][_0x4256('0x60')]=util[_0x4256('0x61')]('SIP/%s',_0x3166d2[_0x4256('0x4e')][_0x4256('0x25')]);_0x2ea2d0[_0x4256('0x18')][_0x4256('0x62')]=_0x22826e[_0x4256('0x62')];_0x2ea2d0[_0x4256('0x18')][_0x4256('0x63')]=_0x22826e['channel'];_0x2ea2d0[_0x4256('0x18')][_0x4256('0x64')]=_0x4256('0x4b');respondWithRpcPromise('EventManager',_0x4256('0x65'),{'event':'rejectmessage','message':_0x2ea2d0['message']},client9002);return _0x22826e;}return null;})[_0x4256('0x10')](respondWithResult(_0x4ada2b,null))[_0x4256('0x45')](handleError(_0x4ada2b,null));};exports[_0x4256('0x1a')]=function(_0x1006dd,_0xb7b42d){if(_0x1006dd[_0x4256('0x47')]['id']){delete _0x1006dd['body']['id'];}var _0x565dec;return db[_0x4256('0x29')][_0x4256('0x44')]({'where':{'id':_0x1006dd[_0x4256('0x42')]['id']}})['then'](handleEntityNotFound(_0xb7b42d,null))[_0x4256('0x10')](function(_0x5a47e1){if(_0x5a47e1){_0x565dec=_0x5a47e1;return db[_0x4256('0x66')]['find']({'where':{'id':_0x5a47e1[_0x4256('0x67')]}});}})[_0x4256('0x10')](handleEntityNotFound(_0xb7b42d,null))[_0x4256('0x10')](function(_0x4351a8){if(_0x4351a8){logger['debug'](_0x4256('0x14'),_0x4256('0x1a'),_0x4256('0x68'),_0x4351a8[_0x4256('0x2c')],util[_0x4256('0x69')](_0x1006dd[_0x4256('0x47')],{'showHidden':![],'depth':null}));switch(_0x4351a8[_0x4256('0x2c')]){case _0x4256('0x6a'):if(_0x1006dd[_0x4256('0x47')][_0x4256('0x6b')]&&_0x1006dd[_0x4256('0x47')][_0x4256('0x6b')]===_0x565dec[_0x4256('0x6c')]){return _0x565dec['update']({'read':!![]});}else{logger[_0x4256('0x16')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x4256('0x6a'),util[_0x4256('0x69')](_0x1006dd[_0x4256('0x47')],{'showHidden':![],'depth':null}));}break;case _0x4256('0x6d'):if(_0x1006dd[_0x4256('0x47')]['MessageUUID']&&_0x1006dd[_0x4256('0x47')][_0x4256('0x6e')]===_0x565dec[_0x4256('0x6c')]&&_['indexOf']([_0x4256('0x6f'),'delivered'],_0x1006dd['body']['Status'])>=0x0){return _0x565dec[_0x4256('0x22')]({'read':!![]});}else{logger['error'](_0x4256('0x70'),_0x4256('0x1a'),'plivio',util['inspect'](_0x1006dd[_0x4256('0x47')],{'showHidden':![],'depth':null}));}break;case _0x4256('0x71'):var _0x2b3933=_0x1006dd['body'][_0x4256('0x72')][0x0];if(_0x2b3933[_0x4256('0x1a')][_0x4256('0x73')]===_0x4256('0x74')){return _0x565dec[_0x4256('0x22')]({'read':!![]});}else{logger[_0x4256('0x16')](_0x4256('0x70'),'status',_0x4256('0x71'),util['inspect'](_0x1006dd[_0x4256('0x47')],{'showHidden':![],'depth':null}));}break;}return _0x565dec;}})['then'](respondWithResult(_0xb7b42d,null))[_0x4256('0x45')](handleError(_0xb7b42d,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index c4d0e1c..ad28b07 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 _0x773c=['../../mysqldb','SmsMessage','setMaxListeners','remove','hook','exports','events'];(function(_0x4e11d5,_0x1ce514){var _0x5e4e4c=function(_0xbee63d){while(--_0xbee63d){_0x4e11d5['push'](_0x4e11d5['shift']());}};_0x5e4e4c(++_0x1ce514);}(_0x773c,0x1aa));var _0xc773=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x773c[_0x1a8f86];return _0x20d876;};'use strict';var EventEmitter=require(_0xc773('0x0'));var SmsMessage=require(_0xc773('0x1'))['db'][_0xc773('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc773('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc773('0x4')};function emitEvent(_0x4e1bcf){return function(_0x14f79f,_0x2b986a,_0x250dd4){SmsMessageEvents['emit'](_0x4e1bcf+':'+_0x14f79f['id'],_0x14f79f);SmsMessageEvents['emit'](_0x4e1bcf,_0x14f79f);_0x250dd4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xc773('0x5')](e,emitEvent(event));}}module[_0xc773('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0xc6ef=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xc6ef,0x186));var _0xfc6e=function(_0x53774b,_0x452684){_0x53774b=_0x53774b-0x0;var _0xb06fbc=_0xc6ef[_0x53774b];return _0xb06fbc;};'use strict';var EventEmitter=require(_0xfc6e('0x0'));var SmsMessage=require(_0xfc6e('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xfc6e('0x2')](0x0);var events={'afterCreate':_0xfc6e('0x3'),'afterUpdate':_0xfc6e('0x4'),'afterDestroy':_0xfc6e('0x5')};function emitEvent(_0x451c46){return function(_0x459dd4,_0x2ca8cc,_0x15b1a6){SmsMessageEvents['emit'](_0x451c46+':'+_0x459dd4['id'],_0x459dd4);SmsMessageEvents[_0xfc6e('0x6')](_0x451c46,_0x459dd4);_0x15b1a6(null);};}for(var e in events){if(events[_0xfc6e('0x7')](e)){var event=events[e];SmsMessage[_0xfc6e('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index a1bc06c..c7feaa8 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 _0xfed4=['accountId','/messages','applicationId','intelepeer','Bearer\x20','code','message','refid','status','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','UserId','isNil','SmsInteractionId','then','update','createdAt','catch','error','out','secret','SmsAccount','accountSid','phone','create','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','smsMethod','sender','&password=','GET','split','POST','user_key','total_sent','internal_order_id','deliveryReport','skebby','inspect','Missing\x20parameters:\x20username,\x20password','connectel','authToken','senderString','https://smsapi.connectel.se/api/v2/send/','read','Missing\x20parameters:\x20authToken','clicksend','%s:%s','format','Basic\x20%s','http_code','data','queued_count','messages','message_id','clickSend','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','toString','base64','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','keys','sort','createHash','md5','digest','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','uuid','UTF-8','clickatell','bandwidth'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xfed4,0x16e));var _0x4fed=function(_0x4820e0,_0x380dd3){_0x4820e0=_0x4820e0-0x0;var _0xb03e4f=_0xfed4[_0x4820e0];return _0xb03e4f;};'use strict';var _=require(_0x4fed('0x0'));var util=require(_0x4fed('0x1'));var logger=require(_0x4fed('0x2'))(_0x4fed('0x3'));var moment=require(_0x4fed('0x4'));var BPromise=require('bluebird');var rp=require(_0x4fed('0x5'));var fs=require('fs');var path=require(_0x4fed('0x6'));var rimraf=require(_0x4fed('0x7'));var config=require(_0x4fed('0x8'));var attributes=require(_0x4fed('0x9'));module[_0x4fed('0xa')]=function(_0x35b551,_0x13c197){return _0x35b551[_0x4fed('0xb')](_0x4fed('0xc'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x4fed('0xd'),'fields':[_0x4fed('0xd')]},{'name':_0x4fed('0xe'),'fields':[_0x4fed('0xf')],'type':_0x4fed('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e01b3,_0x50bae5,_0x57efd2){var _0x28dcbf=_0x35b551[_0x4fed('0x11')];var _0x24a45b=_0x5e01b3['get']({'plain':!![]});if(_0x24a45b[_0x4fed('0x12')]['toLowerCase']()==='in'||_0x24a45b[_0x4fed('0x12')][_0x4fed('0x13')]()==='out'&&!_0x24a45b['secret']&&!_['isNil'](_0x24a45b[_0x4fed('0x14')])&&!_[_0x4fed('0x15')](_0x24a45b[_0x4fed('0x16')])){_0x28dcbf['SmsInteraction']['findOne']({'where':{'id':_0x24a45b['SmsInteractionId']}})[_0x4fed('0x17')](function(_0x2439e3){if(_0x2439e3){_0x2439e3[_0x4fed('0x18')]({'lastMsgAt':_0x24a45b[_0x4fed('0x19')],'lastMsgDirection':_0x24a45b['direction'][_0x4fed('0x13')]()});}})[_0x4fed('0x1a')](function(_0x3225db){console[_0x4fed('0x1b')](_0x3225db);});}if(_0x24a45b['direction']===_0x4fed('0x1c')&&!_0x24a45b[_0x4fed('0x1d')]){var _0x573c8c;_0x28dcbf[_0x4fed('0x1e')]['find']({'where':{'id':_0x24a45b['SmsAccountId']},'raw':!![]})[_0x4fed('0x17')](function(_0x4c6230){_0x573c8c=_0x4c6230;if(_0x573c8c&&_0x573c8c['type']){switch(_0x573c8c['type']){case'twilio':var _0x2b2aae=require('twilio');if(_0x573c8c[_0x4fed('0x1f')]&&_0x573c8c['authToken']&&_0x573c8c[_0x4fed('0x20')]){var _0x4865a0=new _0x2b2aae(_0x573c8c[_0x4fed('0x1f')],_0x573c8c['authToken']);_0x4865a0['messages'][_0x4fed('0x21')]({'body':_0x24a45b[_0x4fed('0xf')],'to':_0x24a45b['phone'],'from':_0x573c8c[_0x4fed('0x20')],'statusCallback':_0x573c8c[_0x4fed('0x22')]+'/api/sms/messages/'+_0x24a45b['id']+_0x4fed('0x23')+_0x573c8c[_0x4fed('0x24')]})[_0x4fed('0x17')](function(_0x45884d){if(_0x45884d['sid']){return _0x5e01b3[_0x4fed('0x18')]({'messageId':_0x45884d[_0x4fed('0x25')]});}})[_0x4fed('0x1a')](function(_0x367b64){logger[_0x4fed('0x1b')](_0x4fed('0x26'),_0x4fed('0x27'),'twilio',util['inspect'](_0x367b64,{'showHidden':![],'depth':null}));});}else{logger[_0x4fed('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4fed('0x28'),_0x4fed('0x29'));}break;case'skebby':var _0xaa9260='https://api.skebby.it/API/v1.0/REST/';if(_0x573c8c[_0x4fed('0x2a')]&&_0x573c8c[_0x4fed('0x2b')]){var _0x4334c5={'recipient':[_0x24a45b[_0x4fed('0x20')]],'message':_0x24a45b[_0x4fed('0xf')],'message_type':_0x573c8c[_0x4fed('0x2c')]};if(_0x573c8c[_0x4fed('0x2c')]&&_0x573c8c[_0x4fed('0x2c')]!=='SI'){_0x4334c5[_0x4fed('0x2d')]=_0x573c8c[_0x4fed('0x20')];}var _0x3fb25e={'url':_0xaa9260+'login?username='+_0x573c8c['username']+_0x4fed('0x2e')+_0x573c8c[_0x4fed('0x2b')],'method':_0x4fed('0x2f')};rp(_0x3fb25e)[_0x4fed('0x17')](function(_0x3019d1){var _0x48b590=_0x3019d1[_0x4fed('0x30')](';');var _0x36da80={'user_key':_0x48b590[0x0],'session_key':_0x48b590[0x1]};_0x3fb25e={'url':_0xaa9260+'sms','method':_0x4fed('0x31'),'headers':{'user_key':_0x36da80[_0x4fed('0x32')],'Session_key':_0x36da80['session_key']},'json':!![],'body':_0x4334c5};return rp(_0x3fb25e);})[_0x4fed('0x17')](function(_0x456b1a){if(_0x456b1a[_0x4fed('0x33')]>=0x1){var _0x265f1d={'messageId':_0x456b1a[_0x4fed('0x34')]};if(_0x573c8c['smsMethod']!=='GP'||!_0x573c8c[_0x4fed('0x35')]){_0x265f1d['read']=!![];}return _0x5e01b3[_0x4fed('0x18')](_0x265f1d);}else{return logger['error'](_0x4fed('0x26'),_0x4fed('0x27'),_0x4fed('0x36'),util[_0x4fed('0x37')](_0x456b1a,{'showHidden':![],'depth':null}));}})[_0x4fed('0x1a')](function(_0x1e28ff){return logger[_0x4fed('0x1b')](_0x4fed('0x26'),_0x4fed('0x27'),_0x4fed('0x36'),util[_0x4fed('0x37')](_0x1e28ff,{'showHidden':![],'depth':null}));});}else{logger[_0x4fed('0x1b')](_0x4fed('0x26'),_0x4fed('0x27'),_0x4fed('0x36'),_0x4fed('0x38'));}break;case _0x4fed('0x39'):if(_0x573c8c[_0x4fed('0x3a')]){var _0x4a8bff={'recipient':_0x24a45b[_0x4fed('0x20')],'message':_0x24a45b[_0x4fed('0xf')],'sender':_0x573c8c[_0x4fed('0x3b')]||_0x573c8c[_0x4fed('0x20')],'authorization':_0x573c8c[_0x4fed('0x3a')]};var _0x50bae5={'method':_0x4fed('0x31'),'uri':_0x4fed('0x3c'),'body':_0x4a8bff,'json':!![]};rp(_0x50bae5)[_0x4fed('0x17')](function(_0x10e19f){var _0x42a9ee={'messageId':_0x10e19f['requestid']};if(!_0x573c8c['deliveryReport']){_0x42a9ee[_0x4fed('0x3d')]=!![];}return _0x5e01b3[_0x4fed('0x18')](_0x42a9ee);})['catch'](function(_0x408c84){logger['error'](_0x4fed('0x26'),'afterCreate',_0x4fed('0x39'),util['inspect'](_0x408c84,{'showHidden':![],'depth':null}));});}else{logger[_0x4fed('0x1b')](_0x4fed('0x26'),'afterCreate',_0x4fed('0x39'),_0x4fed('0x3e'));}break;case _0x4fed('0x3f'):if(_0x573c8c[_0x4fed('0x2a')]&&_0x573c8c[_0x4fed('0x2b')]){var _0x4a8bff={'messages':[{'source':'xCALLY\x20Motion','to':_0x24a45b[_0x4fed('0x20')],'body':_0x24a45b['body'],'from':_0x573c8c[_0x4fed('0x3b')]||_0x573c8c[_0x4fed('0x20')]}]};var _0x11616a=util['format'](_0x4fed('0x40'),_0x573c8c[_0x4fed('0x2a')],_0x573c8c[_0x4fed('0x2b')]);var _0x50bae5={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x4a8bff,'headers':{'Authorization':util[_0x4fed('0x41')](_0x4fed('0x42'),new Buffer(_0x11616a)['toString']('base64'))},'json':!![]};rp(_0x50bae5)['then'](function(_0x56ceaf){if(_0x56ceaf[_0x4fed('0x43')]>=0xc8&&_0x56ceaf[_0x4fed('0x43')]<=0xce){if(_0x56ceaf['data']&&_0x56ceaf[_0x4fed('0x44')][_0x4fed('0x45')]>0x0){var _0x4919db=_['head'](_0x56ceaf['data'][_0x4fed('0x46')]);var _0x1297ea={'messageId':_0x4919db[_0x4fed('0x47')]};if(!_0x573c8c[_0x4fed('0x35')]){_0x1297ea[_0x4fed('0x3d')]=!![];}return _0x5e01b3[_0x4fed('0x18')](_0x1297ea);}else{logger[_0x4fed('0x1b')](_0x4fed('0x26'),_0x4fed('0x27'),'clickSend',util[_0x4fed('0x37')](_0x56ceaf,{'showHidden':![],'depth':null}));}}else{logger[_0x4fed('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4fed('0x27'),_0x4fed('0x48'),util[_0x4fed('0x37')](_0x56ceaf,{'showHidden':![],'depth':null}));}})['catch'](function(_0xb6d5a2){logger[_0x4fed('0x1b')](_0x4fed('0x26'),_0x4fed('0x27'),_0x4fed('0x48'),util['inspect'](_0xb6d5a2,{'showHidden':![],'depth':null}));});}else{logger[_0x4fed('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4fed('0x27'),_0x4fed('0x48'),_0x4fed('0x38'));}break;case'plivo':if(_0x573c8c[_0x4fed('0x49')]&&_0x573c8c[_0x4fed('0x3a')]){var _0x4a8bff={'dst':_0x24a45b[_0x4fed('0x20')],'text':_0x24a45b[_0x4fed('0xf')],'src':_0x573c8c[_0x4fed('0x3b')]||_0x573c8c[_0x4fed('0x20')],'url':_0x573c8c[_0x4fed('0x22')]+_0x4fed('0x4a')+_0x24a45b['id']+'/status?token='+_0x573c8c[_0x4fed('0x24')]};var _0x11616a=util[_0x4fed('0x41')](_0x4fed('0x40'),_0x573c8c[_0x4fed('0x49')],_0x573c8c[_0x4fed('0x3a')]);var _0x50bae5={'method':_0x4fed('0x31'),'uri':util[_0x4fed('0x41')](_0x4fed('0x4b'),_0x573c8c['authId']),'body':_0x4a8bff,'headers':{'Authorization':util[_0x4fed('0x41')](_0x4fed('0x42'),new Buffer(_0x11616a)[_0x4fed('0x4c')](_0x4fed('0x4d')))},'json':!![]};rp(_0x50bae5)[_0x4fed('0x17')](function(_0x2c14d6){var _0x59063e={'messageId':_0x2c14d6[_0x4fed('0x4e')][0x0]};return _0x5e01b3[_0x4fed('0x18')](_0x59063e);})['catch'](function(_0x2b535d){logger[_0x4fed('0x1b')](_0x4fed('0x26'),_0x4fed('0x27'),_0x4fed('0x4f'),util[_0x4fed('0x37')](_0x2b535d,{'showHidden':![],'depth':null}));});}else{logger[_0x4fed('0x1b')](_0x4fed('0x26'),'afterCreate',_0x4fed('0x4f'),_0x4fed('0x50'));}break;case'infobip':if(_0x573c8c[_0x4fed('0x2a')]&&_0x573c8c[_0x4fed('0x2b')]){if(_0x573c8c['baseUrl']){var _0x53c928={'method':'POST','uri':_0x573c8c[_0x4fed('0x51')]+_0x4fed('0x52'),'body':{'username':_0x573c8c['username'],'password':_0x573c8c[_0x4fed('0x2b')]},'json':!![]};return rp(_0x53c928)[_0x4fed('0x17')](function(_0x44f4ec){var _0x50e53d={'method':_0x4fed('0x31'),'uri':_0x573c8c[_0x4fed('0x51')]+_0x4fed('0x53'),'body':{'messages':[{'from':_0x573c8c[_0x4fed('0x20')],'destinations':[{'to':_0x24a45b[_0x4fed('0x20')]}],'text':_0x24a45b[_0x4fed('0xf')],'notifyUrl':_0x573c8c[_0x4fed('0x22')]+'/api/sms/messages/'+_0x24a45b['id']+_0x4fed('0x23')+_0x573c8c[_0x4fed('0x24')],'notifyContentType':_0x4fed('0x54'),'callbackData':_0x573c8c[_0x4fed('0x20')]+';'+_0x24a45b[_0x4fed('0xf')]}]},'headers':{'Authorization':_0x4fed('0x55')+_0x44f4ec[_0x4fed('0x24')]},'json':!![]};return rp(_0x50e53d)[_0x4fed('0x17')](function(_0x913e68){if(_0x913e68[_0x4fed('0x46')]){var _0x2afce4={'messageId':_0x913e68[_0x4fed('0x46')][0x0][_0x4fed('0xd')]};if(!_0x573c8c['deliveryReport']){_0x2afce4[_0x4fed('0x3d')]=!![];}return _0x5e01b3['update'](_0x2afce4);}else{return logger[_0x4fed('0x1b')](_0x4fed('0x26'),_0x4fed('0x27'),_0x4fed('0x56'),util[_0x4fed('0x37')](_0x913e68,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x1fec4c){return logger['error'](_0x4fed('0x26'),_0x4fed('0x27'),_0x4fed('0x56'),util[_0x4fed('0x37')](_0x1fec4c,{'showHidden':![],'depth':null}));});}else{logger[_0x4fed('0x1b')](_0x4fed('0x26'),'afterCreate',_0x4fed('0x56'),_0x4fed('0x57'));}}else{logger['error'](_0x4fed('0x26'),_0x4fed('0x27'),_0x4fed('0x56'),_0x4fed('0x38'));}break;case _0x4fed('0x58'):var _0x3108e5=require(_0x4fed('0x59'));if(_0x573c8c[_0x4fed('0x5a')]){var _0x2825f3={};_0x2825f3[_0x4fed('0x5b')]=_0x573c8c[_0x4fed('0x2a')];_0x2825f3[_0x4fed('0x20')]=_0x24a45b[_0x4fed('0x20')];_0x2825f3[_0x4fed('0x2d')]=_0x573c8c[_0x4fed('0x20')];_0x2825f3[_0x4fed('0x5c')]=_0x24a45b['body'];_0x2825f3['timestamp']=+new Date();var _0x1f5a77='';var _0xde80f7='';var _0x57b964=Object[_0x4fed('0x5d')](_0x2825f3);_0x57b964[_0x4fed('0x5e')]();for(var _0x386c4c=0x0;_0x386c4c<_0x57b964['length'];_0x386c4c++){if(_0x1f5a77!=''){_0x1f5a77+='&';}_0x1f5a77+=_0x57b964[_0x386c4c]+'='+encodeURIComponent(_0x2825f3[_0x57b964[_0x386c4c]]);_0xde80f7+=_0x2825f3[_0x57b964[_0x386c4c]];}_0xde80f7+=_0x573c8c['apiKey'];_0xde80f7=_0x3108e5[_0x4fed('0x5f')](_0x4fed('0x60'))[_0x4fed('0x18')](_0xde80f7)[_0x4fed('0x61')](_0x4fed('0x62'));if(_0x1f5a77!==''){_0x1f5a77+='&';}_0x1f5a77+='signature='+_0xde80f7;var _0x3fb25e={'method':_0x4fed('0x2f'),'uri':_0x573c8c['baseUrl']+_0x4fed('0x63')+_0x1f5a77,'json':!![]};return rp(_0x3fb25e)[_0x4fed('0x17')](function(_0x3b9551){var _0x1b34a8=Object[_0x4fed('0x5d')](_0x3b9551);if(_0x3b9551[_0x1b34a8[0x0]][_0x4fed('0x1b')]&&parseInt(_0x3b9551[_0x1b34a8[0x0]][_0x4fed('0x1b')])===0x0){var _0x1be667={'messageId':_0x3b9551[_0x1b34a8[0x0]][_0x4fed('0x64')]};if(!_0x573c8c['deliveryReport']){_0x1be667[_0x4fed('0x3d')]=!![];}return _0x5e01b3[_0x4fed('0x18')](_0x1be667);}else{return logger[_0x4fed('0x1b')](_0x4fed('0x26'),'afterCreate',_0x4fed('0x58'),util[_0x4fed('0x37')](_0x3b9551['error'],{'showHidden':![],'depth':null}));}})[_0x4fed('0x1a')](function(_0x51691c){return logger[_0x4fed('0x1b')](_0x4fed('0x26'),'afterCreate',_0x4fed('0x58'),util['inspect'](_0x51691c,{'showHidden':![],'depth':null}));});}else{logger[_0x4fed('0x1b')](_0x4fed('0x26'),_0x4fed('0x27'),_0x4fed('0x58'),_0x4fed('0x65'));}break;case'clickatell':if(_0x573c8c[_0x4fed('0x5a')]){var _0x10ccf7={'method':_0x4fed('0x31'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x573c8c[_0x4fed('0x5a')]},'body':{'content':_0x24a45b[_0x4fed('0xf')],'to':[_0x24a45b['phone']],'from':_0x573c8c[_0x4fed('0x20')],'binary':![],'clientMessageId':_0x4fed('0x66'),'charset':_0x4fed('0x67')},'json':!![]};rp(_0x10ccf7)['then'](function(_0x1dc6e4){if(!_0x1dc6e4['error']){var _0x197efc={'messageId':_0x1dc6e4['messages'][0x0]['apiMessageId']};if(!_0x573c8c[_0x4fed('0x35')]){_0x197efc['read']=!![];}return _0x5e01b3[_0x4fed('0x18')](_0x197efc);}else{return logger[_0x4fed('0x1b')](_0x4fed('0x26'),'afterCreate',_0x4fed('0x68'),util[_0x4fed('0x37')](_0x1dc6e4[_0x4fed('0x1b')],{'showHidden':![],'depth':null}));}})[_0x4fed('0x1a')](function(_0x5bbbd){return logger[_0x4fed('0x1b')](_0x4fed('0x26'),_0x4fed('0x27'),'clickatell',util[_0x4fed('0x37')](_0x5bbbd,{'showHidden':![],'depth':null}));});}else{logger[_0x4fed('0x1b')](_0x4fed('0x26'),_0x4fed('0x27'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0x4fed('0x69'):if(_0x573c8c[_0x4fed('0x2a')]&&_0x573c8c[_0x4fed('0x2b')]){var _0x11616a=util[_0x4fed('0x41')]('%s:%s',_0x573c8c['username'],_0x573c8c[_0x4fed('0x2b')]);var _0x50bae5={'method':_0x4fed('0x31'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x573c8c[_0x4fed('0x6a')]+_0x4fed('0x6b'),'body':{'to':[_0x24a45b[_0x4fed('0x20')]],'text':_0x24a45b[_0x4fed('0xf')],'from':_0x573c8c['phone'],'applicationId':_0x573c8c[_0x4fed('0x6c')]},'headers':{'Authorization':util['format'](_0x4fed('0x42'),new Buffer(_0x11616a)[_0x4fed('0x4c')](_0x4fed('0x4d')))},'json':!![]};rp(_0x50bae5)[_0x4fed('0x17')](function(_0x3128a5){if(_0x3128a5['id']){var _0x20abe8={'messageId':_0x3128a5['id']};return _0x5e01b3['update'](_0x20abe8);}else{logger[_0x4fed('0x1b')](_0x4fed('0x26'),'afterCreate',_0x4fed('0x69'),util['inspect'](_0x3128a5,{'showHidden':![],'depth':null}));}})[_0x4fed('0x1a')](function(_0x2bee98){logger[_0x4fed('0x1b')](_0x4fed('0x26'),_0x4fed('0x27'),'bandwidth',util[_0x4fed('0x37')](_0x2bee98,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4fed('0x69'),_0x4fed('0x38'));}break;case _0x4fed('0x6d'):if(_0x573c8c['apiKey']){var _0x4592da={};var _0x3fb25e={'method':_0x4fed('0x31'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x4fed('0x6e')+_0x573c8c[_0x4fed('0x5a')],'Content-Type':_0x4fed('0x54')},'body':{'from':_0x573c8c[_0x4fed('0x20')],'to':_0x24a45b[_0x4fed('0x20')],'text':_0x24a45b[_0x4fed('0xf')]},'json':!![]};return rp(_0x3fb25e)[_0x4fed('0x17')](function(_0x2d9b25){if(_0x2d9b25[_0x4fed('0x6f')]==0xca){_0x4592da[_0x4fed('0x70')]=_0x2d9b25;var _0x1e1000={'method':_0x4fed('0x31'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x4fed('0x6e')+_0x573c8c[_0x4fed('0x5a')],'Content-Type':'application/json'},'body':{'refid':_0x4592da[_0x4fed('0x70')][_0x4fed('0x71')]},'json':!![]};return rp(_0x1e1000)[_0x4fed('0x17')](function(_0x370ac6){_0x4592da[_0x4fed('0x72')]=_0x370ac6;var _0x58d3e0={'messageId':_0x4592da[_0x4fed('0x70')][_0x4fed('0x71')],'read':!![]};return _0x5e01b3[_0x4fed('0x18')](_0x58d3e0);});}else{return logger[_0x4fed('0x1b')](_0x4fed('0x26'),_0x4fed('0x27'),'intelepeer',util[_0x4fed('0x37')](_0x2d9b25,{'showHidden':![],'depth':null}));}})[_0x4fed('0x1a')](function(_0x4a6563){return logger[_0x4fed('0x1b')](_0x4fed('0x26'),_0x4fed('0x27'),_0x4fed('0x6d'),util['inspect'](_0x4a6563,{'showHidden':![],'depth':null}));});}else{return logger[_0x4fed('0x1b')](_0x4fed('0x26'),_0x4fed('0x27'),_0x4fed('0x6d'),_0x4fed('0x73'));}break;}}})[_0x4fed('0x74')](function(){_0x57efd2();});}else{_0x57efd2();}}},'charset':_0x4fed('0x75'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0d9f=['csc','crypto','apiKey','login','keys','sort','createHash','md5','digest','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','then','createdAt','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','sid','update','inspect','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','login?username=','&password=','password','GET','split','POST','user_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','senderString','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20'];(function(_0x317c1f,_0x3047b8){var _0x402d73=function(_0x167e00){while(--_0x167e00){_0x317c1f['push'](_0x317c1f['shift']());}};_0x402d73(++_0x3047b8);}(_0x0d9f,0x96));var _0xf0d9=function(_0x4b784d,_0x5efb2f){_0x4b784d=_0x4b784d-0x0;var _0x2cdeaf=_0x0d9f[_0x4b784d];return _0x2cdeaf;};'use strict';var _=require('lodash');var util=require(_0xf0d9('0x0'));var logger=require(_0xf0d9('0x1'))(_0xf0d9('0x2'));var moment=require(_0xf0d9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0d9('0x4'));var rimraf=require('rimraf');var config=require(_0xf0d9('0x5'));var attributes=require(_0xf0d9('0x6'));module[_0xf0d9('0x7')]=function(_0x3d4e03,_0x2f9f91){return _0x3d4e03[_0xf0d9('0x8')](_0xf0d9('0x9'),attributes,{'tableName':_0xf0d9('0xa'),'paranoid':![],'indexes':[{'name':_0xf0d9('0xb'),'fields':['messageId']},{'name':_0xf0d9('0xc'),'fields':[_0xf0d9('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a8b1d,_0xc7c91c,_0x79588e){var _0x41cd62=_0x3d4e03['models'];var _0x34ec08=_0x1a8b1d[_0xf0d9('0xe')]({'plain':!![]});if(_0x34ec08[_0xf0d9('0xf')][_0xf0d9('0x10')]()==='in'||_0x34ec08[_0xf0d9('0xf')][_0xf0d9('0x10')]()===_0xf0d9('0x11')&&!_0x34ec08[_0xf0d9('0x12')]&&!_[_0xf0d9('0x13')](_0x34ec08[_0xf0d9('0x14')])&&!_[_0xf0d9('0x13')](_0x34ec08[_0xf0d9('0x15')])){_0x41cd62['SmsInteraction']['findOne']({'where':{'id':_0x34ec08['SmsInteractionId']}})[_0xf0d9('0x16')](function(_0x380252){if(_0x380252){_0x380252['update']({'lastMsgAt':_0x34ec08[_0xf0d9('0x17')],'lastMsgDirection':_0x34ec08[_0xf0d9('0xf')][_0xf0d9('0x10')]()});}})[_0xf0d9('0x18')](function(_0x50ab7f){console['error'](_0x50ab7f);});}if(_0x34ec08[_0xf0d9('0xf')]==='out'&&!_0x34ec08[_0xf0d9('0x12')]){var _0x4456da;_0x41cd62[_0xf0d9('0x19')][_0xf0d9('0x1a')]({'where':{'id':_0x34ec08[_0xf0d9('0x1b')]},'raw':!![]})[_0xf0d9('0x16')](function(_0x369524){_0x4456da=_0x369524;if(_0x4456da&&_0x4456da['type']){switch(_0x4456da[_0xf0d9('0x1c')]){case _0xf0d9('0x1d'):var _0x27ef2d=require('twilio');if(_0x4456da[_0xf0d9('0x1e')]&&_0x4456da[_0xf0d9('0x1f')]&&_0x4456da[_0xf0d9('0x20')]){var _0x1a7d75=new _0x27ef2d(_0x4456da[_0xf0d9('0x1e')],_0x4456da['authToken']);_0x1a7d75[_0xf0d9('0x21')][_0xf0d9('0x22')]({'body':_0x34ec08[_0xf0d9('0xd')],'to':_0x34ec08[_0xf0d9('0x20')],'from':_0x4456da[_0xf0d9('0x20')],'statusCallback':_0x4456da[_0xf0d9('0x23')]+_0xf0d9('0x24')+_0x34ec08['id']+_0xf0d9('0x25')+_0x4456da['token']})[_0xf0d9('0x16')](function(_0x47fc84){if(_0x47fc84[_0xf0d9('0x26')]){return _0x1a8b1d[_0xf0d9('0x27')]({'messageId':_0x47fc84[_0xf0d9('0x26')]});}})[_0xf0d9('0x18')](function(_0x215746){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf0d9('0x1d'),util[_0xf0d9('0x28')](_0x215746,{'showHidden':![],'depth':null}));});}else{logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x166800=_0xf0d9('0x2c');if(_0x4456da[_0xf0d9('0x2d')]&&_0x4456da['password']){var _0x5b664c={'recipient':[_0x34ec08[_0xf0d9('0x20')]],'message':_0x34ec08[_0xf0d9('0xd')],'message_type':_0x4456da['smsMethod']};if(_0x4456da['smsMethod']&&_0x4456da[_0xf0d9('0x2e')]!=='SI'){_0x5b664c['sender']=_0x4456da[_0xf0d9('0x20')];}var _0x583b36={'url':_0x166800+_0xf0d9('0x2f')+_0x4456da[_0xf0d9('0x2d')]+_0xf0d9('0x30')+_0x4456da[_0xf0d9('0x31')],'method':_0xf0d9('0x32')};rp(_0x583b36)[_0xf0d9('0x16')](function(_0x40ba3a){var _0x2b6bab=_0x40ba3a[_0xf0d9('0x33')](';');var _0x2e6773={'user_key':_0x2b6bab[0x0],'session_key':_0x2b6bab[0x1]};_0x583b36={'url':_0x166800+'sms','method':_0xf0d9('0x34'),'headers':{'user_key':_0x2e6773[_0xf0d9('0x35')],'Session_key':_0x2e6773['session_key']},'json':!![],'body':_0x5b664c};return rp(_0x583b36);})[_0xf0d9('0x16')](function(_0x2de65d){if(_0x2de65d[_0xf0d9('0x36')]>=0x1){var _0x266841={'messageId':_0x2de65d[_0xf0d9('0x37')]};if(_0x4456da[_0xf0d9('0x2e')]!=='GP'||!_0x4456da[_0xf0d9('0x38')]){_0x266841[_0xf0d9('0x39')]=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x266841);}else{return logger['error'](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x3a'),util['inspect'](_0x2de65d,{'showHidden':![],'depth':null}));}})[_0xf0d9('0x18')](function(_0x47808b){return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x3a'),util[_0xf0d9('0x28')](_0x47808b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x3a'),_0xf0d9('0x3b'));}break;case _0xf0d9('0x3c'):if(_0x4456da['authToken']){var _0x41920b={'recipient':_0x34ec08[_0xf0d9('0x20')],'message':_0x34ec08['body'],'sender':_0x4456da['senderString']||_0x4456da[_0xf0d9('0x20')],'authorization':_0x4456da[_0xf0d9('0x1f')]};var _0xc7c91c={'method':'POST','uri':_0xf0d9('0x3d'),'body':_0x41920b,'json':!![]};rp(_0xc7c91c)[_0xf0d9('0x16')](function(_0x1cf360){var _0x37320a={'messageId':_0x1cf360[_0xf0d9('0x3e')]};if(!_0x4456da[_0xf0d9('0x38')]){_0x37320a['read']=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x37320a);})[_0xf0d9('0x18')](function(_0x1ca5c1){logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x3c'),util[_0xf0d9('0x28')](_0x1ca5c1,{'showHidden':![],'depth':null}));});}else{logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),'afterCreate','connectel',_0xf0d9('0x3f'));}break;case'clicksend':if(_0x4456da[_0xf0d9('0x2d')]&&_0x4456da[_0xf0d9('0x31')]){var _0x41920b={'messages':[{'source':'xCALLY\x20Motion','to':_0x34ec08[_0xf0d9('0x20')],'body':_0x34ec08['body'],'from':_0x4456da[_0xf0d9('0x40')]||_0x4456da[_0xf0d9('0x20')]}]};var _0x56cb50=util['format'](_0xf0d9('0x41'),_0x4456da[_0xf0d9('0x2d')],_0x4456da[_0xf0d9('0x31')]);var _0xc7c91c={'method':_0xf0d9('0x34'),'uri':_0xf0d9('0x42'),'body':_0x41920b,'headers':{'Authorization':util[_0xf0d9('0x43')](_0xf0d9('0x44'),new Buffer(_0x56cb50)[_0xf0d9('0x45')](_0xf0d9('0x46')))},'json':!![]};rp(_0xc7c91c)[_0xf0d9('0x16')](function(_0x22afc0){if(_0x22afc0['http_code']>=0xc8&&_0x22afc0[_0xf0d9('0x47')]<=0xce){if(_0x22afc0[_0xf0d9('0x48')]&&_0x22afc0['data']['queued_count']>0x0){var _0x5117a9=_[_0xf0d9('0x49')](_0x22afc0[_0xf0d9('0x48')]['messages']);var _0x1ea496={'messageId':_0x5117a9[_0xf0d9('0x4a')]};if(!_0x4456da['deliveryReport']){_0x1ea496[_0xf0d9('0x39')]=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x1ea496);}else{logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x4b'),util[_0xf0d9('0x28')](_0x22afc0,{'showHidden':![],'depth':null}));}}else{logger[_0xf0d9('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),_0xf0d9('0x4b'),util[_0xf0d9('0x28')](_0x22afc0,{'showHidden':![],'depth':null}));}})[_0xf0d9('0x18')](function(_0x351958){logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),'afterCreate','clickSend',util[_0xf0d9('0x28')](_0x351958,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x4b'),_0xf0d9('0x3b'));}break;case _0xf0d9('0x4c'):if(_0x4456da[_0xf0d9('0x4d')]&&_0x4456da[_0xf0d9('0x1f')]){var _0x41920b={'dst':_0x34ec08[_0xf0d9('0x20')],'text':_0x34ec08[_0xf0d9('0xd')],'src':_0x4456da[_0xf0d9('0x40')]||_0x4456da[_0xf0d9('0x20')],'url':_0x4456da['remote']+_0xf0d9('0x24')+_0x34ec08['id']+_0xf0d9('0x25')+_0x4456da[_0xf0d9('0x4e')]};var _0x56cb50=util[_0xf0d9('0x43')]('%s:%s',_0x4456da['authId'],_0x4456da[_0xf0d9('0x1f')]);var _0xc7c91c={'method':'POST','uri':util[_0xf0d9('0x43')](_0xf0d9('0x4f'),_0x4456da['authId']),'body':_0x41920b,'headers':{'Authorization':util[_0xf0d9('0x43')](_0xf0d9('0x44'),new Buffer(_0x56cb50)[_0xf0d9('0x45')](_0xf0d9('0x46')))},'json':!![]};rp(_0xc7c91c)[_0xf0d9('0x16')](function(_0x2e8728){var _0x111959={'messageId':_0x2e8728[_0xf0d9('0x50')][0x0]};return _0x1a8b1d[_0xf0d9('0x27')](_0x111959);})[_0xf0d9('0x18')](function(_0x1c6743){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),_0xf0d9('0x4c'),util[_0xf0d9('0x28')](_0x1c6743,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),_0xf0d9('0x4c'),_0xf0d9('0x51'));}break;case _0xf0d9('0x52'):if(_0x4456da[_0xf0d9('0x2d')]&&_0x4456da[_0xf0d9('0x31')]){if(_0x4456da[_0xf0d9('0x53')]){var _0x47ccdd={'method':_0xf0d9('0x34'),'uri':_0x4456da['baseUrl']+_0xf0d9('0x54'),'body':{'username':_0x4456da['username'],'password':_0x4456da[_0xf0d9('0x31')]},'json':!![]};return rp(_0x47ccdd)['then'](function(_0x56eafd){var _0x1f8c76={'method':'POST','uri':_0x4456da[_0xf0d9('0x53')]+_0xf0d9('0x55'),'body':{'messages':[{'from':_0x4456da['phone'],'destinations':[{'to':_0x34ec08['phone']}],'text':_0x34ec08[_0xf0d9('0xd')],'notifyUrl':_0x4456da[_0xf0d9('0x23')]+_0xf0d9('0x24')+_0x34ec08['id']+_0xf0d9('0x25')+_0x4456da['token'],'notifyContentType':_0xf0d9('0x56'),'callbackData':_0x4456da[_0xf0d9('0x20')]+';'+_0x34ec08[_0xf0d9('0xd')]}]},'headers':{'Authorization':_0xf0d9('0x57')+_0x56eafd[_0xf0d9('0x4e')]},'json':!![]};return rp(_0x1f8c76)[_0xf0d9('0x16')](function(_0x1b7d2c){if(_0x1b7d2c['messages']){var _0x4214ea={'messageId':_0x1b7d2c['messages'][0x0][_0xf0d9('0xb')]};if(!_0x4456da[_0xf0d9('0x38')]){_0x4214ea[_0xf0d9('0x39')]=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x4214ea);}else{return logger[_0xf0d9('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf0d9('0x52'),util[_0xf0d9('0x28')](_0x1b7d2c,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x509c26){return logger[_0xf0d9('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),_0xf0d9('0x52'),util[_0xf0d9('0x28')](_0x509c26,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf0d9('0x2a'),_0xf0d9('0x2b'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0xf0d9('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),'infobip',_0xf0d9('0x3b'));}break;case _0xf0d9('0x58'):var _0x3955f9=require(_0xf0d9('0x59'));if(_0x4456da[_0xf0d9('0x5a')]){var _0x20d421={};_0x20d421[_0xf0d9('0x5b')]=_0x4456da[_0xf0d9('0x2d')];_0x20d421[_0xf0d9('0x20')]=_0x34ec08[_0xf0d9('0x20')];_0x20d421['sender']=_0x4456da[_0xf0d9('0x20')];_0x20d421['text']=_0x34ec08[_0xf0d9('0xd')];_0x20d421['timestamp']=+new Date();var _0x290f81='';var _0x4455d3='';var _0x34e181=Object[_0xf0d9('0x5c')](_0x20d421);_0x34e181[_0xf0d9('0x5d')]();for(var _0x305b6e=0x0;_0x305b6e<_0x34e181['length'];_0x305b6e++){if(_0x290f81!=''){_0x290f81+='&';}_0x290f81+=_0x34e181[_0x305b6e]+'='+encodeURIComponent(_0x20d421[_0x34e181[_0x305b6e]]);_0x4455d3+=_0x20d421[_0x34e181[_0x305b6e]];}_0x4455d3+=_0x4456da[_0xf0d9('0x5a')];_0x4455d3=_0x3955f9[_0xf0d9('0x5e')](_0xf0d9('0x5f'))[_0xf0d9('0x27')](_0x4455d3)[_0xf0d9('0x60')](_0xf0d9('0x61'));if(_0x290f81!==''){_0x290f81+='&';}_0x290f81+='signature='+_0x4455d3;var _0x583b36={'method':_0xf0d9('0x32'),'uri':_0x4456da[_0xf0d9('0x53')]+_0xf0d9('0x62')+_0x290f81,'json':!![]};return rp(_0x583b36)[_0xf0d9('0x16')](function(_0xd11523){var _0xa4e394=Object[_0xf0d9('0x5c')](_0xd11523);if(_0xd11523[_0xa4e394[0x0]][_0xf0d9('0x29')]&&parseInt(_0xd11523[_0xa4e394[0x0]][_0xf0d9('0x29')])===0x0){var _0x34703d={'messageId':_0xd11523[_0xa4e394[0x0]][_0xf0d9('0x63')]};if(!_0x4456da[_0xf0d9('0x38')]){_0x34703d[_0xf0d9('0x39')]=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x34703d);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),_0xf0d9('0x58'),util['inspect'](_0xd11523[_0xf0d9('0x29')],{'showHidden':![],'depth':null}));}})[_0xf0d9('0x18')](function(_0x4d0175){return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x58'),util[_0xf0d9('0x28')](_0x4d0175,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x58'),_0xf0d9('0x64'));}break;case _0xf0d9('0x65'):if(_0x4456da[_0xf0d9('0x5a')]){var _0x31bd1c={'method':_0xf0d9('0x34'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x4456da['apiKey']},'body':{'content':_0x34ec08[_0xf0d9('0xd')],'to':[_0x34ec08[_0xf0d9('0x20')]],'from':_0x4456da[_0xf0d9('0x20')],'binary':![],'clientMessageId':_0xf0d9('0x66'),'charset':_0xf0d9('0x67')},'json':!![]};rp(_0x31bd1c)[_0xf0d9('0x16')](function(_0x2a6439){if(!_0x2a6439[_0xf0d9('0x29')]){var _0x16b31b={'messageId':_0x2a6439[_0xf0d9('0x21')][0x0][_0xf0d9('0x68')]};if(!_0x4456da[_0xf0d9('0x38')]){_0x16b31b[_0xf0d9('0x39')]=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x16b31b);}else{return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x65'),util[_0xf0d9('0x28')](_0x2a6439[_0xf0d9('0x29')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x312c6b){return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),'afterCreate','clickatell',util[_0xf0d9('0x28')](_0x312c6b,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf0d9('0x65'),_0xf0d9('0x64'));}break;case _0xf0d9('0x69'):if(_0x4456da[_0xf0d9('0x2d')]&&_0x4456da[_0xf0d9('0x31')]){var _0x56cb50=util['format']('%s:%s',_0x4456da[_0xf0d9('0x2d')],_0x4456da[_0xf0d9('0x31')]);var _0xc7c91c={'method':_0xf0d9('0x34'),'uri':_0xf0d9('0x6a')+_0x4456da[_0xf0d9('0x6b')]+_0xf0d9('0x6c'),'body':{'to':[_0x34ec08[_0xf0d9('0x20')]],'text':_0x34ec08['body'],'from':_0x4456da[_0xf0d9('0x20')],'applicationId':_0x4456da[_0xf0d9('0x6d')]},'headers':{'Authorization':util[_0xf0d9('0x43')]('Basic\x20%s',new Buffer(_0x56cb50)[_0xf0d9('0x45')](_0xf0d9('0x46')))},'json':!![]};rp(_0xc7c91c)[_0xf0d9('0x16')](function(_0x1a2bb6){if(_0x1a2bb6['id']){var _0x13a053={'messageId':_0x1a2bb6['id']};return _0x1a8b1d[_0xf0d9('0x27')](_0x13a053);}else{logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),'bandwidth',util[_0xf0d9('0x28')](_0x1a2bb6,{'showHidden':![],'depth':null}));}})[_0xf0d9('0x18')](function(_0x2c3218){logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),'bandwidth',util[_0xf0d9('0x28')](_0x2c3218,{'showHidden':![],'depth':null}));});}else{logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),'afterCreate',_0xf0d9('0x69'),_0xf0d9('0x3b'));}break;case _0xf0d9('0x6e'):if(_0x4456da[_0xf0d9('0x5a')]){var _0x26d5e7={};var _0x583b36={'method':'POST','uri':_0xf0d9('0x6f'),'headers':{'Authorization':_0xf0d9('0x70')+_0x4456da[_0xf0d9('0x5a')],'Content-Type':_0xf0d9('0x56')},'body':{'from':_0x4456da[_0xf0d9('0x20')],'to':_0x34ec08[_0xf0d9('0x20')],'text':_0x34ec08[_0xf0d9('0xd')]},'json':!![]};return rp(_0x583b36)[_0xf0d9('0x16')](function(_0x12a9fd){if(_0x12a9fd['code']==0xca){_0x26d5e7[_0xf0d9('0x71')]=_0x12a9fd;var _0x34d242={'method':_0xf0d9('0x34'),'uri':_0xf0d9('0x72'),'headers':{'Authorization':_0xf0d9('0x70')+_0x4456da[_0xf0d9('0x5a')],'Content-Type':_0xf0d9('0x56')},'body':{'refid':_0x26d5e7['message'][_0xf0d9('0x73')]},'json':!![]};return rp(_0x34d242)[_0xf0d9('0x16')](function(_0x220cb4){_0x26d5e7[_0xf0d9('0x74')]=_0x220cb4;var _0x352bd2={'messageId':_0x26d5e7['message']['refid'],'read':!![]};return _0x1a8b1d[_0xf0d9('0x27')](_0x352bd2);});}else{return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x6e'),util[_0xf0d9('0x28')](_0x12a9fd,{'showHidden':![],'depth':null}));}})[_0xf0d9('0x18')](function(_0x338518){return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x6e'),util[_0xf0d9('0x28')](_0x338518,{'showHidden':![],'depth':null}));});}else{return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),'afterCreate',_0xf0d9('0x6e'),'Token\x20not\x20received');}break;}}})[_0xf0d9('0x75')](function(){_0x79588e();});}else{_0x79588e();}}},'charset':'utf8mb4','collate':_0xf0d9('0x76')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index aa24dd0..529a755 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 _0x37c7=['raw','CreateSmsMessage','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsMessage','create','body','options'];(function(_0x55fc56,_0x3f0a37){var _0x3ff96d=function(_0x1d5c42){while(--_0x1d5c42){_0x55fc56['push'](_0x55fc56['shift']());}};_0x3ff96d(++_0x3f0a37);}(_0x37c7,0xac));var _0x737c=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0x37c7[_0x28b0a1];return _0x21470c;};'use strict';var _=require('lodash');var util=require(_0x737c('0x0'));var moment=require(_0x737c('0x1'));var BPromise=require(_0x737c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x737c('0x3'));var db=require(_0x737c('0x4'))['db'];var utils=require(_0x737c('0x5'));var logger=require('../../config/logger')(_0x737c('0x6'));var config=require(_0x737c('0x7'));var jayson=require(_0x737c('0x8'));var client=jayson[_0x737c('0x9')][_0x737c('0xa')]({'port':0x232a});config[_0x737c('0xb')]=_[_0x737c('0xc')](config[_0x737c('0xb')],{'host':_0x737c('0xd'),'port':0x18eb});var socket=require(_0x737c('0xe'))(new Redis(config[_0x737c('0xb')]));require(_0x737c('0xf'))['register'](socket);function respondWithRpcPromise(_0x14c850,_0x492ef5,_0xdc31e6){return new BPromise(function(_0x5b8192,_0x57edaf){return client[_0x737c('0x10')](_0x14c850,_0xdc31e6)[_0x737c('0x11')](function(_0x1b7fff){logger[_0x737c('0x12')](_0x737c('0x13'),_0x492ef5,_0x737c('0x14'));logger[_0x737c('0x15')](_0x737c('0x16'),_0x492ef5,_0x737c('0x14'),JSON['stringify'](_0x1b7fff));if(_0x1b7fff[_0x737c('0x17')]){if(_0x1b7fff[_0x737c('0x17')][_0x737c('0x18')]===0x1f4){logger[_0x737c('0x17')](_0x737c('0x13'),_0x492ef5,_0x1b7fff[_0x737c('0x17')][_0x737c('0x19')]);return _0x57edaf(_0x1b7fff[_0x737c('0x17')]['message']);}logger[_0x737c('0x17')](_0x737c('0x13'),_0x492ef5,_0x1b7fff[_0x737c('0x17')][_0x737c('0x19')]);return _0x5b8192(_0x1b7fff['error'][_0x737c('0x19')]);}else{logger['info'](_0x737c('0x13'),_0x492ef5,_0x737c('0x14'));_0x5b8192(_0x1b7fff[_0x737c('0x1a')][_0x737c('0x19')]);}})[_0x737c('0x1b')](function(_0x3c2467){logger['error'](_0x737c('0x13'),_0x492ef5,_0x3c2467);_0x57edaf(_0x3c2467);});});}exports['CreateSmsMessage']=function(_0x492d33){var _0x141c99=this;return new Promise(function(_0x3264f3,_0x3cd5aa){return db[_0x737c('0x1c')][_0x737c('0x1d')](_0x492d33[_0x737c('0x1e')],{'raw':_0x492d33[_0x737c('0x1f')]?_0x492d33[_0x737c('0x1f')][_0x737c('0x20')]===undefined?!![]:![]:!![]})[_0x737c('0x11')](function(_0x4aeda8){logger['info'](_0x737c('0x21'),_0x492d33);logger[_0x737c('0x15')](_0x737c('0x21'),_0x492d33,JSON['stringify'](_0x4aeda8));_0x3264f3(_0x4aeda8);})[_0x737c('0x1b')](function(_0x4f9cbb){logger[_0x737c('0x17')]('CreateSmsMessage',_0x4f9cbb[_0x737c('0x19')],_0x492d33);_0x3cd5aa(_0x141c99[_0x737c('0x17')](0x1f4,_0x4f9cbb[_0x737c('0x19')]));});});}; \ No newline at end of file +var _0xed9b=['body','options','raw','CreateSmsMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','create'];(function(_0x58d9a8,_0x32acd9){var _0x426ffd=function(_0xb0d946){while(--_0xb0d946){_0x58d9a8['push'](_0x58d9a8['shift']());}};_0x426ffd(++_0x32acd9);}(_0xed9b,0x16f));var _0xbed9=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0xed9b[_0x163040];return _0x364667;};'use strict';var _=require(_0xbed9('0x0'));var util=require('util');var moment=require(_0xbed9('0x1'));var BPromise=require(_0xbed9('0x2'));var rs=require(_0xbed9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbed9('0x4'))['db'];var utils=require(_0xbed9('0x5'));var logger=require(_0xbed9('0x6'))('rpc');var config=require(_0xbed9('0x7'));var jayson=require(_0xbed9('0x8'));var client=jayson[_0xbed9('0x9')][_0xbed9('0xa')]({'port':0x232a});config[_0xbed9('0xb')]=_['defaults'](config[_0xbed9('0xb')],{'host':_0xbed9('0xc'),'port':0x18eb});var socket=require(_0xbed9('0xd'))(new Redis(config[_0xbed9('0xb')]));require('./smsMessage.socket')[_0xbed9('0xe')](socket);function respondWithRpcPromise(_0x4fa9e1,_0x4bb6dd,_0x736a2e){return new BPromise(function(_0x57448b,_0x56abd1){return client[_0xbed9('0xf')](_0x4fa9e1,_0x736a2e)[_0xbed9('0x10')](function(_0x7d67eb){logger['info'](_0xbed9('0x11'),_0x4bb6dd,_0xbed9('0x12'));logger[_0xbed9('0x13')](_0xbed9('0x14'),_0x4bb6dd,_0xbed9('0x12'),JSON[_0xbed9('0x15')](_0x7d67eb));if(_0x7d67eb['error']){if(_0x7d67eb['error'][_0xbed9('0x16')]===0x1f4){logger[_0xbed9('0x17')]('SmsMessage,\x20%s,\x20%s',_0x4bb6dd,_0x7d67eb[_0xbed9('0x17')][_0xbed9('0x18')]);return _0x56abd1(_0x7d67eb[_0xbed9('0x17')][_0xbed9('0x18')]);}logger[_0xbed9('0x17')](_0xbed9('0x11'),_0x4bb6dd,_0x7d67eb['error'][_0xbed9('0x18')]);return _0x57448b(_0x7d67eb['error']['message']);}else{logger[_0xbed9('0x19')]('SmsMessage,\x20%s,\x20%s',_0x4bb6dd,'request\x20sent');_0x57448b(_0x7d67eb[_0xbed9('0x1a')][_0xbed9('0x18')]);}})[_0xbed9('0x1b')](function(_0x5a0da7){logger[_0xbed9('0x17')](_0xbed9('0x11'),_0x4bb6dd,_0x5a0da7);_0x56abd1(_0x5a0da7);});});}exports['CreateSmsMessage']=function(_0x36d8b7){var _0x3f8638=this;return new Promise(function(_0x337d82,_0x4af369){return db['SmsMessage'][_0xbed9('0x1c')](_0x36d8b7[_0xbed9('0x1d')],{'raw':_0x36d8b7[_0xbed9('0x1e')]?_0x36d8b7[_0xbed9('0x1e')][_0xbed9('0x1f')]===undefined?!![]:![]:!![]})[_0xbed9('0x10')](function(_0x39fb3f){logger[_0xbed9('0x19')](_0xbed9('0x20'),_0x36d8b7);logger[_0xbed9('0x13')]('CreateSmsMessage',_0x36d8b7,JSON[_0xbed9('0x15')](_0x39fb3f));_0x337d82(_0x39fb3f);})[_0xbed9('0x1b')](function(_0x512ce3){logger[_0xbed9('0x17')]('CreateSmsMessage',_0x512ce3[_0xbed9('0x18')],_0x36d8b7);_0x4af369(_0x3f8638[_0xbed9('0x17')](0x1f4,_0x512ce3[_0xbed9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index eec4eaf..72fc04e 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 _0x34e3=['remove','update','removeListener','register','length','./smsMessage.events','save'];(function(_0x653c03,_0x22bd36){var _0x29ee5a=function(_0x209d1e){while(--_0x209d1e){_0x653c03['push'](_0x653c03['shift']());}};_0x29ee5a(++_0x22bd36);}(_0x34e3,0x16a));var _0x334e=function(_0x1936f6,_0x47a125){_0x1936f6=_0x1936f6-0x0;var _0x32e727=_0x34e3[_0x1936f6];return _0x32e727;};'use strict';var SmsMessageEvents=require(_0x334e('0x0'));var events=[_0x334e('0x1'),_0x334e('0x2'),_0x334e('0x3')];function createListener(_0x179efa,_0x3709bb){return function(_0x17204c){_0x3709bb['emit'](_0x179efa,_0x17204c);};}function removeListener(_0x11d132,_0x4354d1){return function(){SmsMessageEvents[_0x334e('0x4')](_0x11d132,_0x4354d1);};}exports[_0x334e('0x5')]=function(_0x473915){for(var _0x43e872=0x0,_0x56edc3=events[_0x334e('0x6')];_0x43e872<_0x56edc3;_0x43e872++){var _0x112a38=events[_0x43e872];var _0xc29cd0=createListener('smsMessage:'+_0x112a38,_0x473915);SmsMessageEvents['on'](_0x112a38,_0xc29cd0);}}; \ No newline at end of file +var _0xc50b=['./smsMessage.events','save','update','emit','removeListener','length','smsMessage:'];(function(_0x448bd3,_0x5009fd){var _0x26bb4e=function(_0xc98cdf){while(--_0xc98cdf){_0x448bd3['push'](_0x448bd3['shift']());}};_0x26bb4e(++_0x5009fd);}(_0xc50b,0x69));var _0xbc50=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0xc50b[_0xaaf2e2];return _0x28bc36;};'use strict';var SmsMessageEvents=require(_0xbc50('0x0'));var events=[_0xbc50('0x1'),'remove',_0xbc50('0x2')];function createListener(_0x20a1b3,_0x3b4d10){return function(_0x408ee4){_0x3b4d10[_0xbc50('0x3')](_0x20a1b3,_0x408ee4);};}function removeListener(_0x51af4d,_0x3a841f){return function(){SmsMessageEvents[_0xbc50('0x4')](_0x51af4d,_0x3a841f);};}exports['register']=function(_0x33f070){for(var _0x53cd2f=0x0,_0x2de2a8=events[_0xbc50('0x5')];_0x53cd2f<_0x2de2a8;_0x53cd2f++){var _0x115d80=events[_0x53cd2f];var _0x32999a=createListener(_0xbc50('0x6')+_0x115d80,_0x33f070);SmsMessageEvents['on'](_0x115d80,_0x32999a);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 97413d7..617bb96 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 _0x5672=['/:id/teams','getTeams','/:id/users','getAgents','create','post','put','/:id','delete','destroy','removeTeams','exports','path','connect-timeout','Router','../../components/interaction/service','./smsQueue.controller','get','/describe','isAuthenticated','describe','show','/:id/members','getMembers'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x5672,0x174));var _0x2567=function(_0x199bc4,_0x338105){_0x199bc4=_0x199bc4-0x0;var _0x136ffb=_0x5672[_0x199bc4];return _0x136ffb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2567('0x0'));var timeout=require(_0x2567('0x1'));var express=require('express');var router=express[_0x2567('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2567('0x3'));var config=require('../../config/environment');var controller=require(_0x2567('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2567('0x5')](_0x2567('0x6'),auth[_0x2567('0x7')](),controller[_0x2567('0x8')]);router['get']('/:id',auth[_0x2567('0x7')](),controller[_0x2567('0x9')]);router[_0x2567('0x5')](_0x2567('0xa'),auth[_0x2567('0x7')](),controller[_0x2567('0xb')]);router[_0x2567('0x5')](_0x2567('0xc'),auth[_0x2567('0x7')](),controller[_0x2567('0xd')]);router[_0x2567('0x5')](_0x2567('0xe'),auth['isAuthenticated'](),controller[_0x2567('0xf')]);router['post']('/',auth[_0x2567('0x7')](),controller[_0x2567('0x10')]);router[_0x2567('0x11')](_0x2567('0xc'),auth[_0x2567('0x7')](),controller['addTeams']);router['post'](_0x2567('0xe'),auth[_0x2567('0x7')](),controller['addAgents']);router[_0x2567('0x12')](_0x2567('0x13'),auth[_0x2567('0x7')](),controller['update']);router[_0x2567('0x14')](_0x2567('0x13'),auth[_0x2567('0x7')](),controller[_0x2567('0x15')]);router[_0x2567('0x14')]('/:id/teams',auth[_0x2567('0x7')](),controller[_0x2567('0x16')]);router['delete'](_0x2567('0xe'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x2567('0x17')]=router; \ No newline at end of file +var _0x0add=['isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','create','post','put','update','delete','destroy','/:id/teams','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0x0add,0x122));var _0xd0ad=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x0add[_0x4d8666];return _0x37175b;};'use strict';var multer=require(_0xd0ad('0x0'));var util=require(_0xd0ad('0x1'));var path=require(_0xd0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xd0ad('0x3'));var router=express[_0xd0ad('0x4')]();var fs_extra=require(_0xd0ad('0x5'));var auth=require(_0xd0ad('0x6'));var interaction=require(_0xd0ad('0x7'));var config=require(_0xd0ad('0x8'));var controller=require('./smsQueue.controller');router[_0xd0ad('0x9')]('/',auth[_0xd0ad('0xa')](),controller[_0xd0ad('0xb')]);router[_0xd0ad('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xd0ad('0xc')]);router[_0xd0ad('0x9')](_0xd0ad('0xd'),auth[_0xd0ad('0xa')](),controller[_0xd0ad('0xe')]);router['get'](_0xd0ad('0xf'),auth[_0xd0ad('0xa')](),controller[_0xd0ad('0x10')]);router[_0xd0ad('0x9')]('/:id/teams',auth[_0xd0ad('0xa')](),controller[_0xd0ad('0x11')]);router[_0xd0ad('0x9')](_0xd0ad('0x12'),auth[_0xd0ad('0xa')](),controller[_0xd0ad('0x13')]);router['post']('/',auth[_0xd0ad('0xa')](),controller[_0xd0ad('0x14')]);router[_0xd0ad('0x15')]('/:id/teams',auth[_0xd0ad('0xa')](),controller['addTeams']);router['post'](_0xd0ad('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0xd0ad('0x16')]('/:id',auth[_0xd0ad('0xa')](),controller[_0xd0ad('0x17')]);router[_0xd0ad('0x18')](_0xd0ad('0xd'),auth[_0xd0ad('0xa')](),controller[_0xd0ad('0x19')]);router[_0xd0ad('0x18')](_0xd0ad('0x1a'),auth['isAuthenticated'](),controller[_0xd0ad('0x1b')]);router[_0xd0ad('0x18')](_0xd0ad('0x12'),auth[_0xd0ad('0xa')](),controller[_0xd0ad('0x1c')]);module[_0xd0ad('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index f0e18d9..b2dd770 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 _0x2cb1=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x282187,_0x2c4fc5){var _0x561d20=function(_0x45c8d4){while(--_0x45c8d4){_0x282187['push'](_0x282187['shift']());}};_0x561d20(++_0x2c4fc5);}(_0x2cb1,0xac));var _0x12cb=function(_0x25737c,_0x43b608){_0x25737c=_0x25737c-0x0;var _0x574669=_0x2cb1[_0x25737c];return _0x574669;};'use strict';var Sequelize=require(_0x12cb('0x0'));module[_0x12cb('0x1')]={'name':{'type':Sequelize[_0x12cb('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x12cb('0x2')]},'timeout':{'type':Sequelize[_0x12cb('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x12cb('0x4'),_0x12cb('0x5'),_0x12cb('0x6'))}}; \ No newline at end of file +var _0x281d=['rrmemory','beepall','exports','STRING','name','INTEGER','ENUM'];(function(_0x1a8bf6,_0x2fb58d){var _0x2e5e1f=function(_0x2c5f9f){while(--_0x2c5f9f){_0x1a8bf6['push'](_0x1a8bf6['shift']());}};_0x2e5e1f(++_0x2fb58d);}(_0x281d,0xbf));var _0xd281=function(_0x4c3f64,_0x2a320d){_0x4c3f64=_0x4c3f64-0x0;var _0x1fca7a=_0x281d[_0x4c3f64];return _0x1fca7a;};'use strict';var Sequelize=require('sequelize');module[_0xd281('0x0')]={'name':{'type':Sequelize[_0xd281('0x1')],'unique':_0xd281('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd281('0x1')]},'timeout':{'type':Sequelize[_0xd281('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd281('0x4')](_0xd281('0x5'),_0xd281('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index effb630..01f47ba 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 _0x7a54=['transaction','addTeams','each','findOrCreate','userSmsQueue:save','removeTeams','Team','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','QueryTypes','SELECT','every','includes','all','compact','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','emit','removeAgents','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','then','get','SmsQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','SmsQueue','include','rows','catch','show','params','model','query','intersection','fields','attributes','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','limit','order','sort','filters','pick','filter','User','UserId','createdAt','format','%s/%s','smsPause','getTeams','keys','nolimit','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize'];(function(_0x3976f3,_0x357306){var _0x81cda6=function(_0x497bed){while(--_0x497bed){_0x3976f3['push'](_0x3976f3['shift']());}};_0x81cda6(++_0x357306);}(_0x7a54,0x106));var _0x47a5=function(_0x55b053,_0x39eedf){_0x55b053=_0x55b053-0x0;var _0x462a55=_0x7a54[_0x55b053];return _0x462a55;};'use strict';var BPromise=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var squel=require('squel');var Redis=require(_0x47a5('0x3'));var qs=require(_0x47a5('0x4'));var logger=require('../../config/logger')(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var db=require(_0x47a5('0x7'))['db'];config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));require(_0x47a5('0xb'))['register'](socket);function respondWithStatusCode(_0x194fb0,_0x5077f3){_0x5077f3=_0x5077f3||0xcc;return function(_0x5d90b3){if(_0x5d90b3){return _0x194fb0['sendStatus'](_0x5077f3);}return _0x194fb0[_0x47a5('0xc')](_0x5077f3)[_0x47a5('0xd')]();};}function respondWithResult(_0x5e31dd,_0x2eb0dd){_0x2eb0dd=_0x2eb0dd||0xc8;return function(_0x49e844){if(_0x49e844){return _0x5e31dd['status'](_0x2eb0dd)[_0x47a5('0xe')](_0x49e844);}};}function respondWithFilteredResult(_0x69e4d4,_0x2f399b){return function(_0x250fad){if(_0x250fad){var _0xd612dd=typeof _0x2f399b[_0x47a5('0xf')]===_0x47a5('0x10')&&typeof _0x2f399b['limit']===_0x47a5('0x10');var _0x221b54=_0x250fad[_0x47a5('0x11')];var _0x711793=_0xd612dd?0x0:_0x2f399b[_0x47a5('0xf')];var _0x620ee9=_0xd612dd?_0x250fad[_0x47a5('0x11')]:_0x2f399b[_0x47a5('0xf')]+_0x2f399b['limit'];var _0x362359;if(_0x620ee9>=_0x221b54){_0x620ee9=_0x221b54;_0x362359=0xc8;}else{_0x362359=0xce;}_0x69e4d4[_0x47a5('0xc')](_0x362359);return _0x69e4d4[_0x47a5('0x12')](_0x47a5('0x13'),_0x711793+'-'+_0x620ee9+'/'+_0x221b54)[_0x47a5('0xe')](_0x250fad);}return null;};}function saveUpdates(_0x574af6){return function(_0x549de3){if(_0x549de3){return _0x549de3[_0x47a5('0x14')](_0x574af6)['then'](function(_0x5247fd){return _0x5247fd;});}return null;};}function removeEntity(_0x423a81){return function(_0xaf70a6){if(_0xaf70a6){return _0xaf70a6[_0x47a5('0x15')]()[_0x47a5('0x16')](function(){var _0x477b1d=_0xaf70a6[_0x47a5('0x17')]({'plain':!![]});var _0x2763d6=_0x47a5('0x18');return db[_0x47a5('0x19')]['destroy']({'where':{'type':_0x2763d6,'resourceId':_0x477b1d['id']}})[_0x47a5('0x16')](function(){return _0xaf70a6;});})[_0x47a5('0x16')](function(){_0x423a81['status'](0xcc)[_0x47a5('0xd')]();});}};}function handleEntityNotFound(_0x1f03f7){return function(_0x36874d){if(!_0x36874d){_0x1f03f7['sendStatus'](0x194);}return _0x36874d;};}function handleError(_0xb8ae6c,_0x2f142b){_0x2f142b=_0x2f142b||0x1f4;return function(_0x23db32){logger[_0x47a5('0x1a')](_0x23db32['stack']);if(_0x23db32[_0x47a5('0x1b')]){delete _0x23db32[_0x47a5('0x1b')];}_0xb8ae6c['status'](_0x2f142b)[_0x47a5('0x1c')](_0x23db32);};}exports[_0x47a5('0x1d')]=function(_0x4437f1,_0x129ce5){var _0x3abd6a={};var _0x50bf17={'count':0x0,'rows':[]};var _0x53078a=_[_0x47a5('0x1e')](db['SmsQueue'][_0x47a5('0x1f')],function(_0x5b6c4e){return{'name':_0x5b6c4e[_0x47a5('0x20')],'type':_0x5b6c4e[_0x47a5('0x21')][_0x47a5('0x22')]};});_0x3abd6a=qs[_0x47a5('0x23')](_0x53078a,_0x4437f1);var _0x21f296={'where':_0x3abd6a[_0x47a5('0x24')]};return db[_0x47a5('0x25')][_0x47a5('0x11')](_0x21f296)[_0x47a5('0x16')](function(_0x361bfa){_0x50bf17[_0x47a5('0x11')]=_0x361bfa;_0x3abd6a[_0x47a5('0x26')]=qs[_0x47a5('0x26')](_0x4437f1['query']);return db[_0x47a5('0x25')]['findAll'](_0x3abd6a);})[_0x47a5('0x16')](function(_0x9ac908){_0x50bf17[_0x47a5('0x27')]=_0x9ac908;return _0x50bf17;})['then'](respondWithFilteredResult(_0x129ce5,_0x3abd6a))[_0x47a5('0x28')](handleError(_0x129ce5,null));};exports[_0x47a5('0x29')]=function(_0x39b50b,_0x1f1c68){var _0x51cc81={'raw':!![],'where':{'id':_0x39b50b[_0x47a5('0x2a')]['id']}},_0x50d875={};_0x50d875[_0x47a5('0x2b')]=_['keys'](db['SmsQueue'][_0x47a5('0x1f')]);_0x50d875[_0x47a5('0x2c')]=_['keys'](_0x39b50b[_0x47a5('0x2c')]);_0x50d875['filters']=_[_0x47a5('0x2d')](_0x50d875[_0x47a5('0x2b')],_0x50d875['query']);_0x51cc81['attributes']=_[_0x47a5('0x2d')](_0x50d875['model'],qs[_0x47a5('0x2e')](_0x39b50b[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x51cc81['attributes']=_0x51cc81[_0x47a5('0x2f')]['length']?_0x51cc81['attributes']:_0x50d875[_0x47a5('0x2b')];if(_0x39b50b['query'][_0x47a5('0x30')]){_0x51cc81['include']=[{'all':!![]}];}_0x51cc81=_[_0x47a5('0x31')]({},_0x51cc81,_0x39b50b[_0x47a5('0x32')]);return db[_0x47a5('0x25')][_0x47a5('0x33')](_0x51cc81)[_0x47a5('0x16')](handleEntityNotFound(_0x1f1c68,null))[_0x47a5('0x16')](respondWithResult(_0x1f1c68,null))[_0x47a5('0x28')](handleError(_0x1f1c68,null));};exports[_0x47a5('0x34')]=function(_0x1a0d23,_0x4caed5){return db[_0x47a5('0x25')][_0x47a5('0x34')](_0x1a0d23['body'],{})[_0x47a5('0x16')](function(_0x2bf53d){var _0x1d4348=_0x1a0d23['user'][_0x47a5('0x17')]({'plain':!![]});if(!_0x1d4348)throw new Error(_0x47a5('0x35'));if(_0x1d4348['role']===_0x47a5('0x36')){var _0x19218a=_0x2bf53d['get']({'plain':!![]});var _0x55c5eb='SmsQueues';return db[_0x47a5('0x37')]['find']({'where':{'name':_0x55c5eb,'userProfileId':_0x1d4348[_0x47a5('0x38')]},'raw':!![]})[_0x47a5('0x16')](function(_0x301a85){if(_0x301a85&&_0x301a85[_0x47a5('0x39')]===0x0){return db[_0x47a5('0x19')][_0x47a5('0x34')]({'name':_0x19218a[_0x47a5('0x1b')],'resourceId':_0x19218a['id'],'type':_0x301a85[_0x47a5('0x1b')],'sectionId':_0x301a85['id']},{})[_0x47a5('0x16')](function(){return _0x2bf53d;});}else{return _0x2bf53d;}})[_0x47a5('0x28')](function(_0x280500){logger[_0x47a5('0x1a')](_0x47a5('0x3a'),_0x280500);throw _0x280500;});}return _0x2bf53d;})['then'](respondWithResult(_0x4caed5,0xc9))[_0x47a5('0x28')](handleError(_0x4caed5,null));};exports[_0x47a5('0x14')]=function(_0x331474,_0x23bd8d){if(_0x331474['body']['id']){delete _0x331474[_0x47a5('0x3b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x331474['params']['id']}})['then'](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x16')](saveUpdates(_0x331474['body'],null))[_0x47a5('0x16')](respondWithResult(_0x23bd8d,null))[_0x47a5('0x28')](handleError(_0x23bd8d,null));};exports[_0x47a5('0x15')]=function(_0x494526,_0x3805fd){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x494526['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3805fd,null))['then'](removeEntity(_0x3805fd,null))[_0x47a5('0x28')](handleError(_0x3805fd,null));};exports[_0x47a5('0x3c')]=function(_0x188614,_0xd75ca3){return db[_0x47a5('0x25')][_0x47a5('0x3c')]()[_0x47a5('0x16')](respondWithResult(_0xd75ca3,null))[_0x47a5('0x28')](handleError(_0xd75ca3,null));};exports[_0x47a5('0x3d')]=function(_0x162fa0,_0x24ecb1){var _0x3c3ebf={'raw':!![],'where':{}},_0xe28d76={},_0x3574d4;return db[_0x47a5('0x25')][_0x47a5('0x3e')]({'where':{'id':_0x162fa0['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x24ecb1,null))[_0x47a5('0x16')](function(_0x49eab1){if(_0x49eab1){_0x3574d4=_0x49eab1['get']({'plain':!![]});_0xe28d76[_0x47a5('0x2b')]=_['keys'](db[_0x47a5('0x3f')][_0x47a5('0x1f')]);_0xe28d76['query']=_['keys'](_0x162fa0[_0x47a5('0x2c')]);_0xe28d76['filters']=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],_0xe28d76[_0x47a5('0x2c')]);_0x3c3ebf[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x162fa0['query']['fields']));_0x3c3ebf[_0x47a5('0x2f')]=_0x3c3ebf[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x3c3ebf[_0x47a5('0x2f')]:_0xe28d76[_0x47a5('0x2b')];if(!_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x41')]('nolimit')){_0x3c3ebf[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x162fa0[_0x47a5('0x2c')]['limit']);_0x3c3ebf[_0x47a5('0xf')]=qs['offset'](_0x162fa0[_0x47a5('0x2c')][_0x47a5('0xf')]);}_0x3c3ebf[_0x47a5('0x43')]=qs[_0x47a5('0x44')](_0x162fa0['query'][_0x47a5('0x44')]);_0x3c3ebf[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_[_0x47a5('0x46')](_0x162fa0[_0x47a5('0x2c')],_0xe28d76[_0x47a5('0x45')]));_0x3c3ebf[_0x47a5('0x24')]['SmsQueueId']=_0x49eab1['id'];if(_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x3c3ebf[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x3c3ebf[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x3c3ebf['attributes'],function(_0x1ad6a9){var _0x245a15={};_0x245a15[_0x1ad6a9]={'$like':'%'+_0x162fa0[_0x47a5('0x2c')]['filter']+'%'};return _0x245a15;})});}_0x3c3ebf=_[_0x47a5('0x31')]({},_0x3c3ebf,_0x162fa0[_0x47a5('0x32')]);return db[_0x47a5('0x3f')]['findAll'](_0x3c3ebf);}})['then'](function(_0x274e38){if(_0x274e38){return db[_0x47a5('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x274e38,_0x47a5('0x49')),'role':'agent'},'attributes':['id',_0x47a5('0x1b'),'smsPause','updatedAt',_0x47a5('0x4a')]});}})[_0x47a5('0x16')](function(_0x53eedf){if(_0x53eedf){return{'count':_0x53eedf[_0x47a5('0x11')],'rows':_[_0x47a5('0x1e')](_0x53eedf['rows'],function(_0x5b6127){return{'membername':_0x5b6127[_0x47a5('0x1b')],'UserId':_0x5b6127['id'],'queue_name':_0x3574d4[_0x47a5('0x1b')],'SmsQueueId':_0x3574d4['id'],'interface':util[_0x47a5('0x4b')](_0x47a5('0x4c'),'SIP',_0x5b6127[_0x47a5('0x1b')]),'penalty':0x0,'paused':_0x5b6127[_0x47a5('0x4d')],'createdAt':_0x5b6127[_0x47a5('0x4a')],'updatedAt':_0x5b6127['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x47a5('0x16')](respondWithFilteredResult(_0x24ecb1,_0x3c3ebf))['catch'](handleError(_0x24ecb1,null));};exports[_0x47a5('0x4e')]=function(_0x470da6,_0x943a15){var _0x1c485b={};var _0x3603b7={};var _0x4966af;var _0x144af9;return db['SmsQueue']['findOne']({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))[_0x47a5('0x16')](function(_0x6cd4ea){if(_0x6cd4ea){_0x4966af=_0x6cd4ea;_0x3603b7[_0x47a5('0x2b')]=_['keys'](db['Team'][_0x47a5('0x1f')]);_0x3603b7[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x470da6[_0x47a5('0x2c')]);_0x3603b7[_0x47a5('0x45')]=_['intersection'](_0x3603b7[_0x47a5('0x2b')],_0x3603b7['query']);_0x1c485b[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0x3603b7['model'],qs[_0x47a5('0x2e')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x1c485b[_0x47a5('0x2f')]=_0x1c485b[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x1c485b[_0x47a5('0x2f')]:_0x3603b7[_0x47a5('0x2b')];_0x1c485b['order']=qs[_0x47a5('0x44')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x44')]);_0x1c485b[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x470da6[_0x47a5('0x2c')],_0x3603b7[_0x47a5('0x45')]));if(_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x1c485b[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x1c485b[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x1c485b[_0x47a5('0x2f')],function(_0x44cb90){var _0x1d56f3={};_0x1d56f3[_0x44cb90]={'$like':'%'+_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x1d56f3;})});}_0x1c485b=_[_0x47a5('0x31')]({},_0x1c485b,_0x470da6[_0x47a5('0x32')]);return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x284fb8){if(_0x284fb8){_0x144af9=_0x284fb8[_0x47a5('0x40')];if(!_0x470da6['query'][_0x47a5('0x41')](_0x47a5('0x50'))){_0x1c485b[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x470da6['query'][_0x47a5('0x42')]);_0x1c485b['offset']=qs[_0x47a5('0xf')](_0x470da6['query'][_0x47a5('0xf')]);}return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x2f27c3){if(_0x2f27c3){return _0x2f27c3?{'count':_0x144af9,'rows':_0x2f27c3}:null;}})[_0x47a5('0x16')](respondWithResult(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports['addTeams']=function(_0x4b8084,_0x4164a3){var _0x2b1303=_0x4b8084[_0x47a5('0x3b')][_0x47a5('0x51')];return db['Team'][_0x47a5('0x52')]({'where':{'id':_0x2b1303},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id',_0x47a5('0x1b'),_0x47a5('0x54'),_0x47a5('0x55'),_0x47a5('0x56')],'raw':!![]}]})[_0x47a5('0x16')](function(_0x4618a0){if(_0x4618a0){var _0xc69a68=_[_0x47a5('0x57')](_0x4618a0,function(_0x463e5e){var _0x49d3dc=_0x463e5e[_0x47a5('0x17')]({'plain':!![]});return _0x49d3dc['Agents'];});return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x4b8084[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x40e584){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x448981){return _0x40e584[_0x47a5('0x5a')](_0x2b1303,{'transaction':_0x448981})[_0x47a5('0x16')](function(){return BPromise[_0x47a5('0x5b')](_0xc69a68,function(_0x1f07ac){return db[_0x47a5('0x3f')][_0x47a5('0x5c')]({'where':{'UserId':_0x1f07ac['id'],'SmsQueueId':_0x4b8084[_0x47a5('0x2a')]['id']},'transaction':_0x448981});});})['then'](function(){_0xc69a68['forEach'](function(_0x5ccc89){socket['emit'](_0x47a5('0x5d'),{'UserId':_0x5ccc89['id'],'SmsQueueId':_0x40e584['id']});});});});});}})[_0x47a5('0x16')](respondWithStatusCode(_0x4164a3,null))['catch'](handleError(_0x4164a3,null));};exports[_0x47a5('0x5e')]=function(_0x44dda2,_0x1baa5a){return db[_0x47a5('0x5f')][_0x47a5('0x52')]({'where':{'id':_0x44dda2[_0x47a5('0x2c')][_0x47a5('0x51')]},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id'],'raw':!![]}]})[_0x47a5('0x16')](handleEntityNotFound(_0x1baa5a,null))[_0x47a5('0x16')](function(_0x5e5f16){var _0x18fa31=_[_0x47a5('0x1e')](_0x5e5f16,'id');var _0x420671=[];var _0x4f35ff=[];var _0x340846=squel[_0x47a5('0x60')]();_0x340846[_0x47a5('0x61')]('tq.TeamId')[_0x47a5('0x62')]('team_has_sms_queues','tq')['join'](_0x47a5('0x63'),'ut',_0x47a5('0x64'))[_0x47a5('0x24')](_0x47a5('0x65'),_0x44dda2[_0x47a5('0x2a')]['id']);for(var _0xea50f3=0x0;_0xea50f3<_0x5e5f16['length'];_0xea50f3+=0x1){let _0x592322=_0x5e5f16[_0xea50f3];for(var _0x3e0dbd=0x0;_0x3e0dbd<_0x592322['Agents'][_0x47a5('0x40')];_0x3e0dbd+=0x1){let _0x3fffd1=_0x592322[_0x47a5('0x53')][_0x3e0dbd];var _0xb16bdd=_0x340846['clone']();_0xb16bdd[_0x47a5('0x24')]('ut.UserId\x20=\x20?',_0x3fffd1['id']);_0x4f35ff['push'](db[_0x47a5('0x58')][_0x47a5('0x2c')](_0xb16bdd['toString'](),{'type':db[_0x47a5('0x58')][_0x47a5('0x66')][_0x47a5('0x67')]})['then'](function(_0x280372){if(_0x280372['length']===0x1){return _0x3fffd1['id'];}else{var _0x2307da=_[_0x47a5('0x68')](_[_0x47a5('0x1e')](_0x280372,'TeamId'),function(_0x2e0af1){return _[_0x47a5('0x69')](_0x18fa31,_0x2e0af1);});if(_0x2307da){return _0x3fffd1['id'];}}}));}}return BPromise[_0x47a5('0x6a')](_0x4f35ff)['then'](function(_0x3525e7){_0x420671=_(_0x420671)['union'](_0x3525e7)[_0x47a5('0x6b')]()['value']();return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x44dda2[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x51738b){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x23c393){return _0x51738b[_0x47a5('0x5e')](_0x44dda2[_0x47a5('0x2c')]['ids'],{'transaction':_0x23c393})['then'](function(){if(!_[_0x47a5('0x6c')](_0x420671)){return _0x51738b['removeAgents'](_0x420671,{'transaction':_0x23c393});}})[_0x47a5('0x16')](function(){_0x420671[_0x47a5('0x6d')](function(_0x216402){socket['emit'](_0x47a5('0x6e'),{'UserId':_0x216402,'SmsQueueId':_0x51738b['id']});});});});});});})[_0x47a5('0x16')](respondWithStatusCode(_0x1baa5a,null))['catch'](handleError(_0x1baa5a,null));};exports[_0x47a5('0x6f')]=function(_0x8a9dea,_0x19acfa){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x8a9dea['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x19acfa,null))[_0x47a5('0x16')](function(_0x48e7f3){if(_0x48e7f3){return _0x48e7f3[_0x47a5('0x6f')](_0x8a9dea[_0x47a5('0x3b')]['ids'],_[_0x47a5('0x70')](_0x8a9dea[_0x47a5('0x3b')],[_0x47a5('0x51'),'id'])||{})['spread'](function(_0x3f2ad9){for(var _0x59b4a5=0x0;_0x59b4a5<_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x47a5('0x40')];_0x59b4a5+=0x1){socket[_0x47a5('0x71')]('userSmsQueue:save',{'UserId':Number(_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x59b4a5]),'SmsQueueId':Number(_0x8a9dea[_0x47a5('0x2a')]['id'])});}return _0x3f2ad9;});}})[_0x47a5('0x16')](respondWithResult(_0x19acfa,null))[_0x47a5('0x28')](handleError(_0x19acfa,null));};exports[_0x47a5('0x72')]=function(_0x49b76a,_0x3eb5c1){return db['SmsQueue']['find']({'where':{'id':_0x49b76a[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3eb5c1,null))[_0x47a5('0x16')](function(_0x96fb22){if(_0x96fb22){return _0x96fb22[_0x47a5('0x72')](_0x49b76a['query'][_0x47a5('0x51')])[_0x47a5('0x16')](function(){if(_[_0x47a5('0x73')](_0x49b76a[_0x47a5('0x2c')]['ids'])){for(var _0x240db9=0x0;_0x240db9<_0x49b76a['query'][_0x47a5('0x51')][_0x47a5('0x40')];_0x240db9+=0x1){socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a[_0x47a5('0x2c')][_0x47a5('0x51')][_0x240db9]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}}else{socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a['query'][_0x47a5('0x51')]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3eb5c1,null))[_0x47a5('0x28')](handleError(_0x3eb5c1,null));};exports[_0x47a5('0x74')]=function(_0x6d6a5,_0x5b85cd){var _0x4bf1f5={};var _0x126bb1={};var _0x3d7371;var _0x47fbb6;return db['SmsQueue'][_0x47a5('0x3e')]({'where':{'id':_0x6d6a5[_0x47a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x16')](function(_0x269ff6){if(_0x269ff6){_0x3d7371=_0x269ff6;_0x126bb1['model']=_[_0x47a5('0x4f')](db[_0x47a5('0x48')][_0x47a5('0x1f')]);_0x126bb1[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x6d6a5[_0x47a5('0x2c')]);_0x126bb1['filters']=_['intersection'](_0x126bb1['model'],_0x126bb1[_0x47a5('0x2c')]);_0x4bf1f5[_0x47a5('0x2f')]=_['intersection'](_0x126bb1[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x4bf1f5[_0x47a5('0x2f')]=_0x4bf1f5['attributes'][_0x47a5('0x40')]?_0x4bf1f5['attributes']:_0x126bb1['model'];_0x4bf1f5['order']=qs[_0x47a5('0x44')](_0x6d6a5['query'][_0x47a5('0x44')]);_0x4bf1f5[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x6d6a5[_0x47a5('0x2c')],_0x126bb1[_0x47a5('0x45')]));if(_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x4bf1f5[_0x47a5('0x24')]=_['merge'](_0x4bf1f5[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x4bf1f5['attributes'],function(_0x42ba59){var _0x419870={};_0x419870[_0x42ba59]={'$like':'%'+_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x419870;})});}_0x4bf1f5=_[_0x47a5('0x31')]({},_0x4bf1f5,_0x6d6a5[_0x47a5('0x32')]);return _0x3d7371['getAgents'](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x2e418d){if(_0x2e418d){_0x47fbb6=_0x2e418d['length'];if(!_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x41')](_0x47a5('0x50'))){_0x4bf1f5[_0x47a5('0x42')]=qs['limit'](_0x6d6a5['query']['limit']);_0x4bf1f5['offset']=qs[_0x47a5('0xf')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0xf')]);}return _0x3d7371[_0x47a5('0x74')](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x6bc37b){if(_0x6bc37b){return _0x6bc37b?{'count':_0x47fbb6,'rows':_0x6bc37b}:null;}})[_0x47a5('0x16')](respondWithResult(_0x5b85cd,null))[_0x47a5('0x28')](handleError(_0x5b85cd,null));}; \ No newline at end of file +var _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x51eabb,_0x11770e){var _0x467ea6=function(_0x4dc0a3){while(--_0x4dc0a3){_0x51eabb['push'](_0x51eabb['shift']());}};_0x467ea6(++_0x11770e);}(_0x2ef3,0xba));var _0x32ef=function(_0x49b167,_0xe566c){_0x49b167=_0x49b167-0x0;var _0x30eddb=_0x2ef3[_0x49b167];return _0x30eddb;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 3eb3bac..fe92956 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 _0x6f32=['hasOwnProperty','exports','events','SmsQueue','setMaxListeners','save','update','remove','emit'];(function(_0x1fd027,_0x3d46ce){var _0x20678a=function(_0x5e312f){while(--_0x5e312f){_0x1fd027['push'](_0x1fd027['shift']());}};_0x20678a(++_0x3d46ce);}(_0x6f32,0x1c4));var _0x26f3=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x6f32[_0x3e5086];return _0xfeb102;};'use strict';var EventEmitter=require(_0x26f3('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x26f3('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x26f3('0x2')](0x0);var events={'afterCreate':_0x26f3('0x3'),'afterUpdate':_0x26f3('0x4'),'afterDestroy':_0x26f3('0x5')};function emitEvent(_0x1a3f0e){return function(_0x4931a7,_0x1cbb52,_0x1b4790){SmsQueueEvents[_0x26f3('0x6')](_0x1a3f0e+':'+_0x4931a7['id'],_0x4931a7);SmsQueueEvents['emit'](_0x1a3f0e,_0x4931a7);_0x1b4790(null);};}for(var e in events){if(events[_0x26f3('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x26f3('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x904a=['events','../../mysqldb','save','update','remove','hasOwnProperty','exports'];(function(_0x359340,_0xf9f36a){var _0x473264=function(_0x276c26){while(--_0x276c26){_0x359340['push'](_0x359340['shift']());}};_0x473264(++_0xf9f36a);}(_0x904a,0x111));var _0xa904=function(_0x32389c,_0x5cfd45){_0x32389c=_0x32389c-0x0;var _0x3ba2d7=_0x904a[_0x32389c];return _0x3ba2d7;};'use strict';var EventEmitter=require(_0xa904('0x0'));var SmsQueue=require(_0xa904('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa904('0x2'),'afterUpdate':_0xa904('0x3'),'afterDestroy':_0xa904('0x4')};function emitEvent(_0x5cfd42){return function(_0x225299,_0x2b0602,_0x31e146){SmsQueueEvents['emit'](_0x5cfd42+':'+_0x225299['id'],_0x225299);SmsQueueEvents['emit'](_0x5cfd42,_0x225299);_0x31e146(null);};}for(var e in events){if(events[_0xa904('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xa904('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 af15623..0ed8d5f 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 _0x539d=['api','moment','bluebird','path','rimraf','../../config/environment','./smsQueue.attributes','SmsQueue','sms_queues','lodash','util','../../config/logger'];(function(_0x1cf130,_0x2135ed){var _0x1e8bd2=function(_0x11764e){while(--_0x11764e){_0x1cf130['push'](_0x1cf130['shift']());}};_0x1e8bd2(++_0x2135ed);}(_0x539d,0xc9));var _0xd539=function(_0x50d84b,_0x1d7ea7){_0x50d84b=_0x50d84b-0x0;var _0x6d4270=_0x539d[_0x50d84b];return _0x6d4270;};'use strict';var _=require(_0xd539('0x0'));var util=require(_0xd539('0x1'));var logger=require(_0xd539('0x2'))(_0xd539('0x3'));var moment=require(_0xd539('0x4'));var BPromise=require(_0xd539('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd539('0x6'));var rimraf=require(_0xd539('0x7'));var config=require(_0xd539('0x8'));var attributes=require(_0xd539('0x9'));module['exports']=function(_0x374fa6,_0x3b6c8b){return _0x374fa6['define'](_0xd539('0xa'),attributes,{'tableName':_0xd539('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeba4=['exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xeba4,0xad));var _0x4eba=function(_0x5e4503,_0x5b9cf3){_0x5e4503=_0x5e4503-0x0;var _0x1cc872=_0xeba4[_0x5e4503];return _0x1cc872;};'use strict';var _=require(_0x4eba('0x0'));var util=require(_0x4eba('0x1'));var logger=require(_0x4eba('0x2'))(_0x4eba('0x3'));var moment=require(_0x4eba('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4eba('0x5'));var rimraf=require(_0x4eba('0x6'));var config=require(_0x4eba('0x7'));var attributes=require(_0x4eba('0x8'));module[_0x4eba('0x9')]=function(_0xbad439,_0x410a35){return _0xbad439[_0x4eba('0xa')](_0x4eba('0xb'),attributes,{'tableName':_0x4eba('0xc'),'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 b0f3807..c6f904f 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 _0xace1=['GetSmsQueue','SmsQueue','where','options','attributes','limit','include','map','model','ShowSmsQueue','raw','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./smsQueue.socket','then','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','info'];(function(_0x53ffb3,_0x3d5a49){var _0x2fcecb=function(_0x549b2f){while(--_0x549b2f){_0x53ffb3['push'](_0x53ffb3['shift']());}};_0x2fcecb(++_0x3d5a49);}(_0xace1,0x1c5));var _0x1ace=function(_0x3512ed,_0x2f3d21){_0x3512ed=_0x3512ed-0x0;var _0x49c456=_0xace1[_0x3512ed];return _0x49c456;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1ace('0x0'));var BPromise=require(_0x1ace('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ace('0x2'));var db=require(_0x1ace('0x3'))['db'];var utils=require(_0x1ace('0x4'));var logger=require(_0x1ace('0x5'))('rpc');var config=require(_0x1ace('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1ace('0x7')][_0x1ace('0x8')]({'port':0x232a});config[_0x1ace('0x9')]=_[_0x1ace('0xa')](config[_0x1ace('0x9')],{'host':_0x1ace('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1ace('0x9')]));require(_0x1ace('0xc'))['register'](socket);function respondWithRpcPromise(_0x234ed7,_0x340e8d,_0xc27b46){return new BPromise(function(_0x59fd5e,_0x44add7){return client['request'](_0x234ed7,_0xc27b46)[_0x1ace('0xd')](function(_0x5754a9){logger['info']('SmsQueue,\x20%s,\x20%s',_0x340e8d,_0x1ace('0xe'));logger[_0x1ace('0xf')](_0x1ace('0x10'),_0x340e8d,_0x1ace('0xe'),JSON[_0x1ace('0x11')](_0x5754a9));if(_0x5754a9[_0x1ace('0x12')]){if(_0x5754a9[_0x1ace('0x12')][_0x1ace('0x13')]===0x1f4){logger[_0x1ace('0x12')](_0x1ace('0x14'),_0x340e8d,_0x5754a9[_0x1ace('0x12')]['message']);return _0x44add7(_0x5754a9['error'][_0x1ace('0x15')]);}logger[_0x1ace('0x12')](_0x1ace('0x14'),_0x340e8d,_0x5754a9[_0x1ace('0x12')][_0x1ace('0x15')]);return _0x59fd5e(_0x5754a9[_0x1ace('0x12')][_0x1ace('0x15')]);}else{logger[_0x1ace('0x16')](_0x1ace('0x14'),_0x340e8d,_0x1ace('0xe'));_0x59fd5e(_0x5754a9['result']['message']);}})['catch'](function(_0x1d2122){logger['error'](_0x1ace('0x14'),_0x340e8d,_0x1d2122);_0x44add7(_0x1d2122);});});}exports[_0x1ace('0x17')]=function(_0x3beebf){var _0x39f73c=this;return new Promise(function(_0x9e4c60,_0x3a2e7f){return db[_0x1ace('0x18')]['findAll']({'raw':_0x3beebf['options']?_0x3beebf['options']['raw']===undefined?!![]:![]:!![],'where':_0x3beebf['options']?_0x3beebf['options'][_0x1ace('0x19')]||null:null,'attributes':_0x3beebf[_0x1ace('0x1a')]?_0x3beebf[_0x1ace('0x1a')][_0x1ace('0x1b')]||null:null,'limit':_0x3beebf[_0x1ace('0x1a')]?_0x3beebf[_0x1ace('0x1a')][_0x1ace('0x1c')]||null:null,'include':_0x3beebf[_0x1ace('0x1a')]?_0x3beebf[_0x1ace('0x1a')][_0x1ace('0x1d')]?_[_0x1ace('0x1e')](_0x3beebf['options'][_0x1ace('0x1d')],function(_0x33c7f1){return{'model':db[_0x33c7f1[_0x1ace('0x1f')]],'as':_0x33c7f1['as'],'attributes':_0x33c7f1[_0x1ace('0x1b')],'include':_0x33c7f1['include']?_[_0x1ace('0x1e')](_0x33c7f1[_0x1ace('0x1d')],function(_0x497662){return{'model':db[_0x497662[_0x1ace('0x1f')]],'as':_0x497662['as'],'attributes':_0x497662[_0x1ace('0x1b')],'include':_0x497662[_0x1ace('0x1d')]?_['map'](_0x497662[_0x1ace('0x1d')],function(_0x3071b5){return{'model':db[_0x3071b5[_0x1ace('0x1f')]],'as':_0x3071b5['as'],'attributes':_0x3071b5[_0x1ace('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1ace('0xd')](function(_0x1d5807){logger[_0x1ace('0x16')](_0x1ace('0x17'),_0x3beebf);logger[_0x1ace('0xf')](_0x1ace('0x17'),_0x3beebf,JSON['stringify'](_0x1d5807));_0x9e4c60(_0x1d5807);})['catch'](function(_0xde2bea){logger[_0x1ace('0x12')](_0x1ace('0x17'),_0xde2bea[_0x1ace('0x15')],_0x3beebf);_0x3a2e7f(_0x39f73c[_0x1ace('0x12')](0x1f4,_0xde2bea['message']));});});};exports[_0x1ace('0x20')]=function(_0x5b0836){var _0x4d8f64=this;return new Promise(function(_0x49a019,_0x1fecc5){return db[_0x1ace('0x18')]['find']({'raw':_0x5b0836[_0x1ace('0x1a')]?_0x5b0836[_0x1ace('0x1a')][_0x1ace('0x21')]===undefined?!![]:![]:!![],'where':_0x5b0836[_0x1ace('0x1a')]?_0x5b0836[_0x1ace('0x1a')][_0x1ace('0x19')]||null:null,'attributes':_0x5b0836['options']?_0x5b0836['options'][_0x1ace('0x1b')]||null:null,'include':_0x5b0836[_0x1ace('0x1a')]?_0x5b0836[_0x1ace('0x1a')]['include']?_[_0x1ace('0x1e')](_0x5b0836[_0x1ace('0x1a')][_0x1ace('0x1d')],function(_0x112ef7){return{'model':db[_0x112ef7[_0x1ace('0x1f')]],'as':_0x112ef7['as'],'attributes':_0x112ef7[_0x1ace('0x1b')],'include':_0x112ef7[_0x1ace('0x1d')]?_[_0x1ace('0x1e')](_0x112ef7[_0x1ace('0x1d')],function(_0x316437){return{'model':db[_0x316437['model']],'as':_0x316437['as'],'attributes':_0x316437[_0x1ace('0x1b')],'include':_0x316437['include']?_['map'](_0x316437[_0x1ace('0x1d')],function(_0x36b667){return{'model':db[_0x36b667[_0x1ace('0x1f')]],'as':_0x36b667['as'],'attributes':_0x36b667[_0x1ace('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1ace('0xd')](function(_0x73fc03){logger[_0x1ace('0x16')](_0x1ace('0x20'),_0x5b0836);logger[_0x1ace('0xf')](_0x1ace('0x20'),_0x5b0836,JSON[_0x1ace('0x11')](_0x73fc03));_0x49a019(_0x73fc03);})['catch'](function(_0x385a0c){logger[_0x1ace('0x12')](_0x1ace('0x20'),_0x385a0c[_0x1ace('0x15')],_0x5b0836);_0x1fecc5(_0x4d8f64[_0x1ace('0x12')](0x1f4,_0x385a0c[_0x1ace('0x15')]));});});}; \ No newline at end of file +var _0x49bb=['result','catch','SmsQueue','options','raw','where','attributes','limit','include','map','model','GetSmsQueue','ShowSmsQueue','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x50e71d,_0xe02506){var _0x308f34=function(_0x456801){while(--_0x456801){_0x50e71d['push'](_0x50e71d['shift']());}};_0x308f34(++_0xe02506);}(_0x49bb,0x11f));var _0xb49b=function(_0x2f181f,_0x3c2211){_0x2f181f=_0x2f181f-0x0;var _0x49085e=_0x49bb[_0x2f181f];return _0x49085e;};'use strict';var _=require(_0xb49b('0x0'));var util=require(_0xb49b('0x1'));var moment=require('moment');var BPromise=require(_0xb49b('0x2'));var rs=require(_0xb49b('0x3'));var fs=require('fs');var Redis=require(_0xb49b('0x4'));var db=require(_0xb49b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb49b('0x6'))('rpc');var config=require(_0xb49b('0x7'));var jayson=require(_0xb49b('0x8'));var client=jayson['client'][_0xb49b('0x9')]({'port':0x232a});config[_0xb49b('0xa')]=_[_0xb49b('0xb')](config['redis'],{'host':_0xb49b('0xc'),'port':0x18eb});var socket=require(_0xb49b('0xd'))(new Redis(config[_0xb49b('0xa')]));require(_0xb49b('0xe'))['register'](socket);function respondWithRpcPromise(_0x29b9a4,_0x4a210c,_0x46c579){return new BPromise(function(_0x35409e,_0x31b995){return client[_0xb49b('0xf')](_0x29b9a4,_0x46c579)[_0xb49b('0x10')](function(_0x39caee){logger[_0xb49b('0x11')](_0xb49b('0x12'),_0x4a210c,'request\x20sent');logger[_0xb49b('0x13')](_0xb49b('0x14'),_0x4a210c,_0xb49b('0x15'),JSON['stringify'](_0x39caee));if(_0x39caee[_0xb49b('0x16')]){if(_0x39caee['error'][_0xb49b('0x17')]===0x1f4){logger[_0xb49b('0x16')](_0xb49b('0x12'),_0x4a210c,_0x39caee[_0xb49b('0x16')][_0xb49b('0x18')]);return _0x31b995(_0x39caee['error'][_0xb49b('0x18')]);}logger[_0xb49b('0x16')](_0xb49b('0x12'),_0x4a210c,_0x39caee[_0xb49b('0x16')]['message']);return _0x35409e(_0x39caee[_0xb49b('0x16')][_0xb49b('0x18')]);}else{logger[_0xb49b('0x11')](_0xb49b('0x12'),_0x4a210c,_0xb49b('0x15'));_0x35409e(_0x39caee[_0xb49b('0x19')]['message']);}})[_0xb49b('0x1a')](function(_0x900575){logger['error'](_0xb49b('0x12'),_0x4a210c,_0x900575);_0x31b995(_0x900575);});});}exports['GetSmsQueue']=function(_0x52f4cc){var _0x33f2be=this;return new Promise(function(_0x5d27ae,_0x40d5a3){return db[_0xb49b('0x1b')]['findAll']({'raw':_0x52f4cc[_0xb49b('0x1c')]?_0x52f4cc['options'][_0xb49b('0x1d')]===undefined?!![]:![]:!![],'where':_0x52f4cc['options']?_0x52f4cc['options'][_0xb49b('0x1e')]||null:null,'attributes':_0x52f4cc['options']?_0x52f4cc['options'][_0xb49b('0x1f')]||null:null,'limit':_0x52f4cc[_0xb49b('0x1c')]?_0x52f4cc['options'][_0xb49b('0x20')]||null:null,'include':_0x52f4cc[_0xb49b('0x1c')]?_0x52f4cc[_0xb49b('0x1c')][_0xb49b('0x21')]?_[_0xb49b('0x22')](_0x52f4cc[_0xb49b('0x1c')][_0xb49b('0x21')],function(_0x3bb089){return{'model':db[_0x3bb089['model']],'as':_0x3bb089['as'],'attributes':_0x3bb089[_0xb49b('0x1f')],'include':_0x3bb089['include']?_[_0xb49b('0x22')](_0x3bb089[_0xb49b('0x21')],function(_0x53c6be){return{'model':db[_0x53c6be[_0xb49b('0x23')]],'as':_0x53c6be['as'],'attributes':_0x53c6be[_0xb49b('0x1f')],'include':_0x53c6be['include']?_[_0xb49b('0x22')](_0x53c6be[_0xb49b('0x21')],function(_0x404031){return{'model':db[_0x404031[_0xb49b('0x23')]],'as':_0x404031['as'],'attributes':_0x404031[_0xb49b('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3747ae){logger['info'](_0xb49b('0x24'),_0x52f4cc);logger[_0xb49b('0x13')](_0xb49b('0x24'),_0x52f4cc,JSON['stringify'](_0x3747ae));_0x5d27ae(_0x3747ae);})[_0xb49b('0x1a')](function(_0x57a8a7){logger[_0xb49b('0x16')](_0xb49b('0x24'),_0x57a8a7[_0xb49b('0x18')],_0x52f4cc);_0x40d5a3(_0x33f2be[_0xb49b('0x16')](0x1f4,_0x57a8a7[_0xb49b('0x18')]));});});};exports[_0xb49b('0x25')]=function(_0x4d12e6){var _0x45443a=this;return new Promise(function(_0x4604b8,_0x437305){return db[_0xb49b('0x1b')]['find']({'raw':_0x4d12e6[_0xb49b('0x1c')]?_0x4d12e6[_0xb49b('0x1c')][_0xb49b('0x1d')]===undefined?!![]:![]:!![],'where':_0x4d12e6[_0xb49b('0x1c')]?_0x4d12e6[_0xb49b('0x1c')]['where']||null:null,'attributes':_0x4d12e6['options']?_0x4d12e6['options']['attributes']||null:null,'include':_0x4d12e6[_0xb49b('0x1c')]?_0x4d12e6[_0xb49b('0x1c')][_0xb49b('0x21')]?_[_0xb49b('0x22')](_0x4d12e6['options'][_0xb49b('0x21')],function(_0x3c0772){return{'model':db[_0x3c0772[_0xb49b('0x23')]],'as':_0x3c0772['as'],'attributes':_0x3c0772[_0xb49b('0x1f')],'include':_0x3c0772[_0xb49b('0x21')]?_['map'](_0x3c0772['include'],function(_0x9e5706){return{'model':db[_0x9e5706[_0xb49b('0x23')]],'as':_0x9e5706['as'],'attributes':_0x9e5706[_0xb49b('0x1f')],'include':_0x9e5706[_0xb49b('0x21')]?_['map'](_0x9e5706[_0xb49b('0x21')],function(_0x12de0){return{'model':db[_0x12de0[_0xb49b('0x23')]],'as':_0x12de0['as'],'attributes':_0x12de0['attributes']};}):[]};}):[]};}):[]:[]})[_0xb49b('0x10')](function(_0x37620c){logger[_0xb49b('0x11')](_0xb49b('0x25'),_0x4d12e6);logger['debug'](_0xb49b('0x25'),_0x4d12e6,JSON[_0xb49b('0x26')](_0x37620c));_0x4604b8(_0x37620c);})[_0xb49b('0x1a')](function(_0x5c1588){logger['error'](_0xb49b('0x25'),_0x5c1588[_0xb49b('0x18')],_0x4d12e6);_0x437305(_0x45443a[_0xb49b('0x16')](0x1f4,_0x5c1588[_0xb49b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 31becac..2a8a8e1 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 _0x5b44=['register','length','smsQueue:','./smsQueue.events','remove','emit'];(function(_0x232e5c,_0x174bd0){var _0x5cc646=function(_0x131449){while(--_0x131449){_0x232e5c['push'](_0x232e5c['shift']());}};_0x5cc646(++_0x174bd0);}(_0x5b44,0xb1));var _0x45b4=function(_0x44f80b,_0x41349a){_0x44f80b=_0x44f80b-0x0;var _0x452c0b=_0x5b44[_0x44f80b];return _0x452c0b;};'use strict';var SmsQueueEvents=require(_0x45b4('0x0'));var events=['save',_0x45b4('0x1'),'update'];function createListener(_0x254e59,_0x5f3bff){return function(_0x92c0b){_0x5f3bff[_0x45b4('0x2')](_0x254e59,_0x92c0b);};}function removeListener(_0x14d8fd,_0x4e6a1c){return function(){SmsQueueEvents['removeListener'](_0x14d8fd,_0x4e6a1c);};}exports[_0x45b4('0x3')]=function(_0x1f4d4d){for(var _0x1d2906=0x0,_0x42498f=events[_0x45b4('0x4')];_0x1d2906<_0x42498f;_0x1d2906++){var _0x373c40=events[_0x1d2906];var _0x12cce2=createListener(_0x45b4('0x5')+_0x373c40,_0x1f4d4d);SmsQueueEvents['on'](_0x373c40,_0x12cce2);}}; \ No newline at end of file +var _0xd598=['register','length','smsQueue:','emit'];(function(_0x571dbc,_0x400df9){var _0x55043c=function(_0x47df3b){while(--_0x47df3b){_0x571dbc['push'](_0x571dbc['shift']());}};_0x55043c(++_0x400df9);}(_0xd598,0x1bf));var _0x8d59=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd598[_0xa464c9];return _0x3d73c4;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove','update'];function createListener(_0xc1de4c,_0x1343a6){return function(_0x3c1f1e){_0x1343a6[_0x8d59('0x0')](_0xc1de4c,_0x3c1f1e);};}function removeListener(_0x1f9cc4,_0x902a8a){return function(){SmsQueueEvents['removeListener'](_0x1f9cc4,_0x902a8a);};}exports[_0x8d59('0x1')]=function(_0x1253da){for(var _0x5196b0=0x0,_0xd39afa=events[_0x8d59('0x2')];_0x5196b0<_0xd39afa;_0x5196b0++){var _0x259661=events[_0x5196b0];var _0x33133c=createListener(_0x8d59('0x3')+_0x259661,_0x1253da);SmsQueueEvents['on'](_0x259661,_0x33133c);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 03b09ec..843d302 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 _0xbcf7=['destroy','exports','multer','util','path','express','Router','fs-extra','isAuthenticated','index','get','/describe','describe','show','create','put','update'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xbcf7,0x134));var _0x7bcf=function(_0x43c7a8,_0x1aa7e8){_0x43c7a8=_0x43c7a8-0x0;var _0x2ba767=_0xbcf7[_0x43c7a8];return _0x2ba767;};'use strict';var multer=require(_0x7bcf('0x0'));var util=require(_0x7bcf('0x1'));var path=require(_0x7bcf('0x2'));var timeout=require('connect-timeout');var express=require(_0x7bcf('0x3'));var router=express[_0x7bcf('0x4')]();var fs_extra=require(_0x7bcf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0x7bcf('0x6')](),controller[_0x7bcf('0x7')]);router[_0x7bcf('0x8')](_0x7bcf('0x9'),auth[_0x7bcf('0x6')](),controller[_0x7bcf('0xa')]);router[_0x7bcf('0x8')]('/:id',auth[_0x7bcf('0x6')](),controller[_0x7bcf('0xb')]);router['post']('/',auth[_0x7bcf('0x6')](),controller[_0x7bcf('0xc')]);router[_0x7bcf('0xd')]('/:id',auth[_0x7bcf('0x6')](),controller[_0x7bcf('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7bcf('0xf')]);module[_0x7bcf('0x10')]=router; \ No newline at end of file +var _0x99d6=['update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put'];(function(_0x31aaed,_0xae499c){var _0x424075=function(_0x4963e){while(--_0x4963e){_0x31aaed['push'](_0x31aaed['shift']());}};_0x424075(++_0xae499c);}(_0x99d6,0x193));var _0x699d=function(_0x5d0609,_0x127562){_0x5d0609=_0x5d0609-0x0;var _0xaa3fd1=_0x99d6[_0x5d0609];return _0xaa3fd1;};'use strict';var multer=require(_0x699d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x699d('0x1'));var router=express[_0x699d('0x2')]();var fs_extra=require(_0x699d('0x3'));var auth=require(_0x699d('0x4'));var interaction=require(_0x699d('0x5'));var config=require(_0x699d('0x6'));var controller=require(_0x699d('0x7'));router[_0x699d('0x8')]('/',auth[_0x699d('0x9')](),controller[_0x699d('0xa')]);router[_0x699d('0x8')](_0x699d('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x699d('0x8')](_0x699d('0xc'),auth['isAuthenticated'](),controller[_0x699d('0xd')]);router[_0x699d('0xe')]('/',auth['isAuthenticated'](),controller[_0x699d('0xf')]);router[_0x699d('0x10')](_0x699d('0xc'),auth[_0x699d('0x9')](),controller[_0x699d('0x11')]);router[_0x699d('0x12')](_0x699d('0xc'),auth['isAuthenticated'](),controller[_0x699d('0x13')]);module[_0x699d('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 35438cb..773fccd 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 _0x0dc1=['sequelize','exports','STRING','DATE'];(function(_0x3c6456,_0x3be8db){var _0x258853=function(_0x57d5bd){while(--_0x57d5bd){_0x3c6456['push'](_0x3c6456['shift']());}};_0x258853(++_0x3be8db);}(_0x0dc1,0x198));var _0x10dc=function(_0xac78c7,_0x38bbf6){_0xac78c7=_0xac78c7-0x0;var _0x274703=_0x0dc1[_0xac78c7];return _0x274703;};'use strict';var moment=require('moment');var Sequelize=require(_0x10dc('0x0'));module[_0x10dc('0x1')]={'uniqueid':{'type':Sequelize[_0x10dc('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x10dc('0x2')]},'joinAt':{'type':Sequelize[_0x10dc('0x3')]},'leaveAt':{'type':Sequelize[_0x10dc('0x3')]},'acceptAt':{'type':Sequelize[_0x10dc('0x3')]},'exitAt':{'type':Sequelize[_0x10dc('0x3')]},'reason':{'type':Sequelize[_0x10dc('0x2')]}}; \ No newline at end of file +var _0xc409=['exports','STRING','DATE','moment','sequelize'];(function(_0x5d04ee,_0x2a38ca){var _0x4a666a=function(_0x1883e4){while(--_0x1883e4){_0x5d04ee['push'](_0x5d04ee['shift']());}};_0x4a666a(++_0x2a38ca);}(_0xc409,0xc6));var _0x9c40=function(_0x40519b,_0x3033ae){_0x40519b=_0x40519b-0x0;var _0x57b890=_0xc409[_0x40519b];return _0x57b890;};'use strict';var moment=require(_0x9c40('0x0'));var Sequelize=require(_0x9c40('0x1'));module[_0x9c40('0x2')]={'uniqueid':{'type':Sequelize[_0x9c40('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9c40('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9c40('0x4')]},'exitAt':{'type':Sequelize[_0x9c40('0x4')]},'reason':{'type':Sequelize[_0x9c40('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 94a6f31..2234bac 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 _0xb179=['reject','save','update','then','error','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','filters','options','create','body','find','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply'];(function(_0x1f4dd0,_0x2dae67){var _0x1fd3a9=function(_0x13dcfa){while(--_0x13dcfa){_0x1f4dd0['push'](_0x1f4dd0['shift']());}};_0x1fd3a9(++_0x2dae67);}(_0xb179,0xc7));var _0x9b17=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb179[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x9b17('0x0'));var rimraf=require(_0x9b17('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9b17('0x2'));var rp=require(_0x9b17('0x3'));var moment=require(_0x9b17('0x4'));var BPromise=require(_0x9b17('0x5'));var Mustache=require(_0x9b17('0x6'));var util=require(_0x9b17('0x7'));var path=require(_0x9b17('0x8'));var sox=require('sox');var csv=require(_0x9b17('0x9'));var ejs=require(_0x9b17('0xa'));var fs=require('fs');var fs_extra=require(_0x9b17('0xb'));var _=require('lodash');var squel=require(_0x9b17('0xc'));var crypto=require(_0x9b17('0xd'));var jsforce=require(_0x9b17('0xe'));var deskjs=require(_0x9b17('0xf'));var toCsv=require(_0x9b17('0x9'));var querystring=require('querystring');var Papa=require(_0x9b17('0x10'));var Redis=require(_0x9b17('0x11'));var authService=require(_0x9b17('0x12'));var qs=require(_0x9b17('0x13'));var as=require(_0x9b17('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b17('0x15'))(_0x9b17('0x16'));var utils=require(_0x9b17('0x17'));var config=require(_0x9b17('0x18'));var licenseUtil=require(_0x9b17('0x19'));var db=require(_0x9b17('0x1a'))['db'];function respondWithStatusCode(_0x32cdc0,_0x1fd9be){_0x1fd9be=_0x1fd9be||0xcc;return function(_0x4026ee){if(_0x4026ee){return _0x32cdc0[_0x9b17('0x1b')](_0x1fd9be);}return _0x32cdc0[_0x9b17('0x1c')](_0x1fd9be)[_0x9b17('0x1d')]();};}function respondWithResult(_0x13fafd,_0x272d59){_0x272d59=_0x272d59||0xc8;return function(_0x170e3e){if(_0x170e3e){return _0x13fafd[_0x9b17('0x1c')](_0x272d59)[_0x9b17('0x1e')](_0x170e3e);}};}function respondWithFilteredResult(_0x134c14,_0x5d06f2){return function(_0x4e65e4){if(_0x4e65e4){var _0x50546e=typeof _0x5d06f2[_0x9b17('0x1f')]==='undefined'&&typeof _0x5d06f2[_0x9b17('0x20')]===_0x9b17('0x21');var _0x27808a=_0x4e65e4[_0x9b17('0x22')];var _0x1bb127=_0x50546e?0x0:_0x5d06f2[_0x9b17('0x1f')];var _0x1c00f2=_0x50546e?_0x4e65e4[_0x9b17('0x22')]:_0x5d06f2['offset']+_0x5d06f2[_0x9b17('0x20')];var _0x222fb1;if(_0x1c00f2>=_0x27808a){_0x1c00f2=_0x27808a;_0x222fb1=0xc8;}else{_0x222fb1=0xce;}_0x134c14['status'](_0x222fb1);return _0x134c14[_0x9b17('0x23')](_0x9b17('0x24'),_0x1bb127+'-'+_0x1c00f2+'/'+_0x27808a)[_0x9b17('0x1e')](_0x4e65e4);}return null;};}function patchUpdates(_0x136ead){return function(_0x2eb54b){try{jsonpatch[_0x9b17('0x25')](_0x2eb54b,_0x136ead,!![]);}catch(_0x4a512d){return BPromise[_0x9b17('0x26')](_0x4a512d);}return _0x2eb54b[_0x9b17('0x27')]();};}function saveUpdates(_0x543f9f,_0x224858){return function(_0x2f9991){if(_0x2f9991){return _0x2f9991[_0x9b17('0x28')](_0x543f9f)[_0x9b17('0x29')](function(_0x5f0350){return _0x5f0350;});}return null;};}function removeEntity(_0x40485e,_0x69cf6){return function(_0x2b9f6c){if(_0x2b9f6c){return _0x2b9f6c['destroy']()[_0x9b17('0x29')](function(){_0x40485e[_0x9b17('0x1c')](0xcc)[_0x9b17('0x1d')]();});}};}function handleEntityNotFound(_0x36a35b,_0x22bfc6){return function(_0x5dfc7e){if(!_0x5dfc7e){_0x36a35b[_0x9b17('0x1b')](0x194);}return _0x5dfc7e;};}function handleError(_0xf200b0,_0x17decb){_0x17decb=_0x17decb||0x1f4;return function(_0x1c1053){logger[_0x9b17('0x2a')](_0x1c1053['stack']);if(_0x1c1053[_0x9b17('0x2b')]){delete _0x1c1053[_0x9b17('0x2b')];}_0xf200b0[_0x9b17('0x1c')](_0x17decb)[_0x9b17('0x2c')](_0x1c1053);};}exports[_0x9b17('0x2d')]=function(_0x311727,_0x3c8f44){var _0x8934cd={},_0x3f8016={},_0x365f25={'count':0x0,'rows':[]};var _0x51ee14=_[_0x9b17('0x2e')](db[_0x9b17('0x2f')][_0x9b17('0x30')],function(_0xef9b1b){return{'name':_0xef9b1b[_0x9b17('0x31')],'type':_0xef9b1b[_0x9b17('0x32')][_0x9b17('0x33')]};});_0x3f8016[_0x9b17('0x34')]=_[_0x9b17('0x2e')](_0x51ee14,_0x9b17('0x2b'));_0x3f8016['query']=_[_0x9b17('0x35')](_0x311727[_0x9b17('0x36')]);_0x3f8016['filters']=_[_0x9b17('0x37')](_0x3f8016[_0x9b17('0x34')],_0x3f8016[_0x9b17('0x36')]);_0x8934cd[_0x9b17('0x38')]=_[_0x9b17('0x37')](_0x3f8016['model'],qs[_0x9b17('0x39')](_0x311727[_0x9b17('0x36')][_0x9b17('0x39')]));_0x8934cd[_0x9b17('0x38')]=_0x8934cd['attributes'][_0x9b17('0x3a')]?_0x8934cd[_0x9b17('0x38')]:_0x3f8016[_0x9b17('0x34')];if(!_0x311727[_0x9b17('0x36')][_0x9b17('0x3b')]('nolimit')){_0x8934cd[_0x9b17('0x20')]=qs['limit'](_0x311727[_0x9b17('0x36')][_0x9b17('0x20')]);_0x8934cd[_0x9b17('0x1f')]=qs['offset'](_0x311727['query'][_0x9b17('0x1f')]);}_0x8934cd['order']=qs[_0x9b17('0x3c')](_0x311727['query'][_0x9b17('0x3c')]);_0x8934cd[_0x9b17('0x3d')]=qs['filters'](_[_0x9b17('0x3e')](_0x311727['query'],_0x3f8016['filters']),_0x51ee14);if(_0x311727[_0x9b17('0x36')][_0x9b17('0x3f')]){_0x8934cd[_0x9b17('0x3d')]=_[_0x9b17('0x40')](_0x8934cd['where'],{'$or':_['map'](_0x51ee14,function(_0x2b8ad4){if(_0x2b8ad4[_0x9b17('0x32')]!==_0x9b17('0x41')){var _0x3474db={};_0x3474db[_0x2b8ad4[_0x9b17('0x2b')]]={'$like':'%'+_0x311727[_0x9b17('0x36')][_0x9b17('0x3f')]+'%'};return _0x3474db;}})});}_0x8934cd=_[_0x9b17('0x40')]({},_0x8934cd,_0x311727['options']);var _0x3cf73c={'where':_0x8934cd[_0x9b17('0x3d')]};return db[_0x9b17('0x2f')][_0x9b17('0x22')](_0x3cf73c)['then'](function(_0x1a8381){_0x365f25[_0x9b17('0x22')]=_0x1a8381;if(_0x311727[_0x9b17('0x36')][_0x9b17('0x42')]){_0x8934cd['include']=[{'all':!![]}];}return db[_0x9b17('0x2f')][_0x9b17('0x43')](_0x8934cd);})[_0x9b17('0x29')](function(_0x5d2460){_0x365f25[_0x9b17('0x44')]=_0x5d2460;return _0x365f25;})[_0x9b17('0x29')](respondWithFilteredResult(_0x3c8f44,_0x8934cd))[_0x9b17('0x45')](handleError(_0x3c8f44,null));};exports[_0x9b17('0x46')]=function(_0x506b16,_0x53a91c){var _0x27d955={'raw':!![],'where':{'id':_0x506b16['params']['id']}},_0x27e3d1={};_0x27e3d1[_0x9b17('0x34')]=_['keys'](db[_0x9b17('0x2f')]['rawAttributes']);_0x27e3d1[_0x9b17('0x36')]=_[_0x9b17('0x35')](_0x506b16['query']);_0x27e3d1[_0x9b17('0x47')]=_[_0x9b17('0x37')](_0x27e3d1[_0x9b17('0x34')],_0x27e3d1[_0x9b17('0x36')]);_0x27d955['attributes']=_[_0x9b17('0x37')](_0x27e3d1[_0x9b17('0x34')],qs['fields'](_0x506b16['query'][_0x9b17('0x39')]));_0x27d955[_0x9b17('0x38')]=_0x27d955[_0x9b17('0x38')]['length']?_0x27d955[_0x9b17('0x38')]:_0x27e3d1['model'];if(_0x506b16[_0x9b17('0x36')][_0x9b17('0x42')]){_0x27d955['include']=[{'all':!![]}];}_0x27d955=_['merge']({},_0x27d955,_0x506b16[_0x9b17('0x48')]);return db[_0x9b17('0x2f')]['find'](_0x27d955)[_0x9b17('0x29')](handleEntityNotFound(_0x53a91c,null))[_0x9b17('0x29')](respondWithResult(_0x53a91c,null))[_0x9b17('0x45')](handleError(_0x53a91c,null));};exports['create']=function(_0x47869e,_0x1e6cf3){return db[_0x9b17('0x2f')][_0x9b17('0x49')](_0x47869e[_0x9b17('0x4a')],{})[_0x9b17('0x29')](respondWithResult(_0x1e6cf3,0xc9))[_0x9b17('0x45')](handleError(_0x1e6cf3,null));};exports[_0x9b17('0x28')]=function(_0x384480,_0xbfb484){if(_0x384480[_0x9b17('0x4a')]['id']){delete _0x384480[_0x9b17('0x4a')]['id'];}return db[_0x9b17('0x2f')][_0x9b17('0x4b')]({'where':{'id':_0x384480[_0x9b17('0x4c')]['id']}})[_0x9b17('0x29')](handleEntityNotFound(_0xbfb484,null))[_0x9b17('0x29')](saveUpdates(_0x384480[_0x9b17('0x4a')],null))[_0x9b17('0x29')](respondWithResult(_0xbfb484,null))[_0x9b17('0x45')](handleError(_0xbfb484,null));};exports[_0x9b17('0x4d')]=function(_0x48b04f,_0x4619c8){return db[_0x9b17('0x2f')][_0x9b17('0x4b')]({'where':{'id':_0x48b04f[_0x9b17('0x4c')]['id']}})[_0x9b17('0x29')](handleEntityNotFound(_0x4619c8,null))[_0x9b17('0x29')](removeEntity(_0x4619c8,null))[_0x9b17('0x45')](handleError(_0x4619c8,null));};exports[_0x9b17('0x4e')]=function(_0x5434c6,_0x234076){return db[_0x9b17('0x2f')]['describe']()['then'](respondWithResult(_0x234076,null))[_0x9b17('0x45')](handleError(_0x234076,null));}; \ No newline at end of file +var _0x82be=['catch','show','fields','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','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','offset','undefined','count','apply','reject','save','update','then','destroy','stack','send','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','limit','sort','where','filter','merge','VIRTUAL','options','include','findAll'];(function(_0x26bbd1,_0xb274f3){var _0x26b1eb=function(_0x4cf794){while(--_0x4cf794){_0x26bbd1['push'](_0x26bbd1['shift']());}};_0x26b1eb(++_0xb274f3);}(_0x82be,0x18f));var _0xe82b=function(_0xaa1316,_0x282b13){_0xaa1316=_0xaa1316-0x0;var _0x28866c=_0x82be[_0xaa1316];return _0x28866c;};'use strict';var emlformat=require(_0xe82b('0x0'));var rimraf=require(_0xe82b('0x1'));var zipdir=require(_0xe82b('0x2'));var jsonpatch=require(_0xe82b('0x3'));var rp=require(_0xe82b('0x4'));var moment=require(_0xe82b('0x5'));var BPromise=require(_0xe82b('0x6'));var Mustache=require(_0xe82b('0x7'));var util=require(_0xe82b('0x8'));var path=require('path');var sox=require(_0xe82b('0x9'));var csv=require('to-csv');var ejs=require(_0xe82b('0xa'));var fs=require('fs');var fs_extra=require(_0xe82b('0xb'));var _=require(_0xe82b('0xc'));var squel=require(_0xe82b('0xd'));var crypto=require(_0xe82b('0xe'));var jsforce=require(_0xe82b('0xf'));var deskjs=require(_0xe82b('0x10'));var toCsv=require(_0xe82b('0x11'));var querystring=require(_0xe82b('0x12'));var Papa=require(_0xe82b('0x13'));var Redis=require(_0xe82b('0x14'));var authService=require(_0xe82b('0x15'));var qs=require(_0xe82b('0x16'));var as=require(_0xe82b('0x17'));var hardwareService=require(_0xe82b('0x18'));var logger=require(_0xe82b('0x19'))(_0xe82b('0x1a'));var utils=require('../../config/utils');var config=require(_0xe82b('0x1b'));var licenseUtil=require(_0xe82b('0x1c'));var db=require(_0xe82b('0x1d'))['db'];function respondWithStatusCode(_0x4dbe45,_0x370765){_0x370765=_0x370765||0xcc;return function(_0x2207b3){if(_0x2207b3){return _0x4dbe45[_0xe82b('0x1e')](_0x370765);}return _0x4dbe45[_0xe82b('0x1f')](_0x370765)[_0xe82b('0x20')]();};}function respondWithResult(_0x2eb676,_0x4c5cc8){_0x4c5cc8=_0x4c5cc8||0xc8;return function(_0x113497){if(_0x113497){return _0x2eb676[_0xe82b('0x1f')](_0x4c5cc8)[_0xe82b('0x21')](_0x113497);}};}function respondWithFilteredResult(_0x4f23eb,_0x7346c8){return function(_0x31b814){if(_0x31b814){var _0x2e5dea=typeof _0x7346c8[_0xe82b('0x22')]===_0xe82b('0x23')&&typeof _0x7346c8['limit']==='undefined';var _0x4ced22=_0x31b814[_0xe82b('0x24')];var _0x37577d=_0x2e5dea?0x0:_0x7346c8[_0xe82b('0x22')];var _0xd8562=_0x2e5dea?_0x31b814['count']:_0x7346c8[_0xe82b('0x22')]+_0x7346c8['limit'];var _0x3fe5fa;if(_0xd8562>=_0x4ced22){_0xd8562=_0x4ced22;_0x3fe5fa=0xc8;}else{_0x3fe5fa=0xce;}_0x4f23eb[_0xe82b('0x1f')](_0x3fe5fa);return _0x4f23eb['set']('Content-Range',_0x37577d+'-'+_0xd8562+'/'+_0x4ced22)[_0xe82b('0x21')](_0x31b814);}return null;};}function patchUpdates(_0x1402cc){return function(_0x2f1abe){try{jsonpatch[_0xe82b('0x25')](_0x2f1abe,_0x1402cc,!![]);}catch(_0x557dbc){return BPromise[_0xe82b('0x26')](_0x557dbc);}return _0x2f1abe[_0xe82b('0x27')]();};}function saveUpdates(_0x48758b,_0x3fdfc5){return function(_0x55df50){if(_0x55df50){return _0x55df50[_0xe82b('0x28')](_0x48758b)[_0xe82b('0x29')](function(_0x45853e){return _0x45853e;});}return null;};}function removeEntity(_0x3e49d4,_0x2acb63){return function(_0x1c04f4){if(_0x1c04f4){return _0x1c04f4[_0xe82b('0x2a')]()[_0xe82b('0x29')](function(){_0x3e49d4[_0xe82b('0x1f')](0xcc)[_0xe82b('0x20')]();});}};}function handleEntityNotFound(_0x5dbada,_0x202903){return function(_0x39e8bf){if(!_0x39e8bf){_0x5dbada[_0xe82b('0x1e')](0x194);}return _0x39e8bf;};}function handleError(_0x27ddda,_0x122d80){_0x122d80=_0x122d80||0x1f4;return function(_0x513cbe){logger['error'](_0x513cbe[_0xe82b('0x2b')]);if(_0x513cbe['name']){delete _0x513cbe['name'];}_0x27ddda[_0xe82b('0x1f')](_0x122d80)[_0xe82b('0x2c')](_0x513cbe);};}exports['index']=function(_0x3a579c,_0x4124f4){var _0x2c5a4a={},_0x1cdf40={},_0x72137a={'count':0x0,'rows':[]};var _0x417f3c=_[_0xe82b('0x2d')](db[_0xe82b('0x2e')][_0xe82b('0x2f')],function(_0x288d8d){return{'name':_0x288d8d[_0xe82b('0x30')],'type':_0x288d8d[_0xe82b('0x31')][_0xe82b('0x32')]};});_0x1cdf40[_0xe82b('0x33')]=_[_0xe82b('0x2d')](_0x417f3c,_0xe82b('0x34'));_0x1cdf40[_0xe82b('0x35')]=_[_0xe82b('0x36')](_0x3a579c['query']);_0x1cdf40[_0xe82b('0x37')]=_[_0xe82b('0x38')](_0x1cdf40[_0xe82b('0x33')],_0x1cdf40['query']);_0x2c5a4a[_0xe82b('0x39')]=_[_0xe82b('0x38')](_0x1cdf40[_0xe82b('0x33')],qs['fields'](_0x3a579c[_0xe82b('0x35')]['fields']));_0x2c5a4a[_0xe82b('0x39')]=_0x2c5a4a[_0xe82b('0x39')][_0xe82b('0x3a')]?_0x2c5a4a['attributes']:_0x1cdf40[_0xe82b('0x33')];if(!_0x3a579c[_0xe82b('0x35')][_0xe82b('0x3b')]('nolimit')){_0x2c5a4a[_0xe82b('0x3c')]=qs[_0xe82b('0x3c')](_0x3a579c[_0xe82b('0x35')][_0xe82b('0x3c')]);_0x2c5a4a[_0xe82b('0x22')]=qs[_0xe82b('0x22')](_0x3a579c[_0xe82b('0x35')][_0xe82b('0x22')]);}_0x2c5a4a['order']=qs[_0xe82b('0x3d')](_0x3a579c[_0xe82b('0x35')]['sort']);_0x2c5a4a[_0xe82b('0x3e')]=qs['filters'](_['pick'](_0x3a579c[_0xe82b('0x35')],_0x1cdf40[_0xe82b('0x37')]),_0x417f3c);if(_0x3a579c[_0xe82b('0x35')][_0xe82b('0x3f')]){_0x2c5a4a[_0xe82b('0x3e')]=_[_0xe82b('0x40')](_0x2c5a4a[_0xe82b('0x3e')],{'$or':_[_0xe82b('0x2d')](_0x417f3c,function(_0x4d8a92){if(_0x4d8a92['type']!==_0xe82b('0x41')){var _0x5b9545={};_0x5b9545[_0x4d8a92[_0xe82b('0x34')]]={'$like':'%'+_0x3a579c[_0xe82b('0x35')][_0xe82b('0x3f')]+'%'};return _0x5b9545;}})});}_0x2c5a4a=_[_0xe82b('0x40')]({},_0x2c5a4a,_0x3a579c[_0xe82b('0x42')]);var _0x3a3c0a={'where':_0x2c5a4a['where']};return db[_0xe82b('0x2e')][_0xe82b('0x24')](_0x3a3c0a)['then'](function(_0x1434cc){_0x72137a[_0xe82b('0x24')]=_0x1434cc;if(_0x3a579c[_0xe82b('0x35')]['includeAll']){_0x2c5a4a[_0xe82b('0x43')]=[{'all':!![]}];}return db[_0xe82b('0x2e')][_0xe82b('0x44')](_0x2c5a4a);})['then'](function(_0xc852f4){_0x72137a['rows']=_0xc852f4;return _0x72137a;})[_0xe82b('0x29')](respondWithFilteredResult(_0x4124f4,_0x2c5a4a))[_0xe82b('0x45')](handleError(_0x4124f4,null));};exports[_0xe82b('0x46')]=function(_0xf8fc10,_0x8b0ea6){var _0x1dddbd={'raw':!![],'where':{'id':_0xf8fc10['params']['id']}},_0x112b12={};_0x112b12[_0xe82b('0x33')]=_[_0xe82b('0x36')](db[_0xe82b('0x2e')][_0xe82b('0x2f')]);_0x112b12[_0xe82b('0x35')]=_[_0xe82b('0x36')](_0xf8fc10['query']);_0x112b12['filters']=_[_0xe82b('0x38')](_0x112b12['model'],_0x112b12[_0xe82b('0x35')]);_0x1dddbd['attributes']=_[_0xe82b('0x38')](_0x112b12[_0xe82b('0x33')],qs[_0xe82b('0x47')](_0xf8fc10[_0xe82b('0x35')][_0xe82b('0x47')]));_0x1dddbd[_0xe82b('0x39')]=_0x1dddbd['attributes'][_0xe82b('0x3a')]?_0x1dddbd[_0xe82b('0x39')]:_0x112b12['model'];if(_0xf8fc10[_0xe82b('0x35')][_0xe82b('0x48')]){_0x1dddbd[_0xe82b('0x43')]=[{'all':!![]}];}_0x1dddbd=_[_0xe82b('0x40')]({},_0x1dddbd,_0xf8fc10['options']);return db[_0xe82b('0x2e')][_0xe82b('0x49')](_0x1dddbd)[_0xe82b('0x29')](handleEntityNotFound(_0x8b0ea6,null))[_0xe82b('0x29')](respondWithResult(_0x8b0ea6,null))[_0xe82b('0x45')](handleError(_0x8b0ea6,null));};exports[_0xe82b('0x4a')]=function(_0xc60a66,_0x19c2c8){return db[_0xe82b('0x2e')]['create'](_0xc60a66[_0xe82b('0x4b')],{})[_0xe82b('0x29')](respondWithResult(_0x19c2c8,0xc9))[_0xe82b('0x45')](handleError(_0x19c2c8,null));};exports[_0xe82b('0x28')]=function(_0xc13415,_0x1b2066){if(_0xc13415['body']['id']){delete _0xc13415[_0xe82b('0x4b')]['id'];}return db[_0xe82b('0x2e')][_0xe82b('0x49')]({'where':{'id':_0xc13415[_0xe82b('0x4c')]['id']}})[_0xe82b('0x29')](handleEntityNotFound(_0x1b2066,null))[_0xe82b('0x29')](saveUpdates(_0xc13415[_0xe82b('0x4b')],null))[_0xe82b('0x29')](respondWithResult(_0x1b2066,null))[_0xe82b('0x45')](handleError(_0x1b2066,null));};exports[_0xe82b('0x2a')]=function(_0x487cd2,_0xcdafef){return db[_0xe82b('0x2e')][_0xe82b('0x49')]({'where':{'id':_0x487cd2['params']['id']}})[_0xe82b('0x29')](handleEntityNotFound(_0xcdafef,null))[_0xe82b('0x29')](removeEntity(_0xcdafef,null))['catch'](handleError(_0xcdafef,null));};exports[_0xe82b('0x4d')]=function(_0x227f6d,_0x26b02e){return db[_0xe82b('0x2e')]['describe']()[_0xe82b('0x29')](respondWithResult(_0x26b02e,null))[_0xe82b('0x45')](handleError(_0x26b02e,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index bc68bb9..9e62a11 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x996bc8,_0x291e01){var _0x20b0ea=function(_0x5ba992){while(--_0x5ba992){_0x996bc8['push'](_0x996bc8['shift']());}};_0x20b0ea(++_0x291e01);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x19ba3b,_0x46dfd6){var _0xe5f3f6=function(_0x261b6e){while(--_0x261b6e){_0x19ba3b['push'](_0x19ba3b['shift']());}};_0xe5f3f6(++_0x46dfd6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index ae3eee2..9f3bfd2 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 _0x4f65=['CreateSmsQueueReport','options','raw','debug','UpdateSmsQueueReport','SmsQueueReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x19906c,_0xe20691){var _0x2e48be=function(_0x55d671){while(--_0x55d671){_0x19906c['push'](_0x19906c['shift']());}};_0x2e48be(++_0xe20691);}(_0x4f65,0x153));var _0x54f6=function(_0x2f5873,_0x5b3de6){_0x2f5873=_0x2f5873-0x0;var _0x122320=_0x4f65[_0x2f5873];return _0x122320;};'use strict';var _=require(_0x54f6('0x0'));var util=require(_0x54f6('0x1'));var moment=require('moment');var BPromise=require(_0x54f6('0x2'));var rs=require(_0x54f6('0x3'));var fs=require('fs');var Redis=require(_0x54f6('0x4'));var db=require(_0x54f6('0x5'))['db'];var utils=require(_0x54f6('0x6'));var logger=require('../../config/logger')(_0x54f6('0x7'));var config=require(_0x54f6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x54f6('0x9')][_0x54f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a3301,_0xf742e6,_0x33ea1d){return new BPromise(function(_0x714dfa,_0x32f4cd){return client['request'](_0x2a3301,_0x33ea1d)[_0x54f6('0xb')](function(_0x11d403){logger[_0x54f6('0xc')](_0x54f6('0xd'),_0xf742e6,'request\x20sent');logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0xf742e6,_0x54f6('0xe'),JSON[_0x54f6('0xf')](_0x11d403));if(_0x11d403['error']){if(_0x11d403[_0x54f6('0x10')][_0x54f6('0x11')]===0x1f4){logger[_0x54f6('0x10')](_0x54f6('0xd'),_0xf742e6,_0x11d403[_0x54f6('0x10')][_0x54f6('0x12')]);return _0x32f4cd(_0x11d403[_0x54f6('0x10')][_0x54f6('0x12')]);}logger['error'](_0x54f6('0xd'),_0xf742e6,_0x11d403[_0x54f6('0x10')][_0x54f6('0x12')]);return _0x714dfa(_0x11d403[_0x54f6('0x10')]['message']);}else{logger[_0x54f6('0xc')](_0x54f6('0xd'),_0xf742e6,_0x54f6('0xe'));_0x714dfa(_0x11d403[_0x54f6('0x13')][_0x54f6('0x12')]);}})[_0x54f6('0x14')](function(_0x5c2c5){logger[_0x54f6('0x10')](_0x54f6('0xd'),_0xf742e6,_0x5c2c5);_0x32f4cd(_0x5c2c5);});});}exports[_0x54f6('0x15')]=function(_0x1f2e8f){var _0x4d7c4e=this;return new Promise(function(_0x696502,_0x2b7655){return db['SmsQueueReport']['create'](_0x1f2e8f['body'],{'raw':_0x1f2e8f[_0x54f6('0x16')]?_0x1f2e8f[_0x54f6('0x16')][_0x54f6('0x17')]===undefined?!![]:![]:!![]})[_0x54f6('0xb')](function(_0x2405d5){logger[_0x54f6('0xc')](_0x54f6('0x15'),_0x1f2e8f);logger[_0x54f6('0x18')](_0x54f6('0x15'),_0x1f2e8f,JSON[_0x54f6('0xf')](_0x2405d5));_0x696502(_0x2405d5);})[_0x54f6('0x14')](function(_0x98175d){logger[_0x54f6('0x10')](_0x54f6('0x15'),_0x98175d[_0x54f6('0x12')],_0x1f2e8f);_0x2b7655(_0x4d7c4e[_0x54f6('0x10')](0x1f4,_0x98175d[_0x54f6('0x12')]));});});};exports[_0x54f6('0x19')]=function(_0x3fe58b){var _0x35f91a=this;return new Promise(function(_0x30e6e7,_0x28cfb9){return db[_0x54f6('0x1a')][_0x54f6('0x1b')](_0x3fe58b['body'],{'raw':_0x3fe58b[_0x54f6('0x16')]?_0x3fe58b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fe58b['options']?_0x3fe58b['options']['where']||null:null,'attributes':_0x3fe58b[_0x54f6('0x16')]?_0x3fe58b[_0x54f6('0x16')][_0x54f6('0x1c')]||null:null,'limit':_0x3fe58b['options']?_0x3fe58b[_0x54f6('0x16')][_0x54f6('0x1d')]||null:null})[_0x54f6('0xb')](function(_0x179da8){logger[_0x54f6('0xc')](_0x54f6('0x19'),_0x3fe58b);logger['debug'](_0x54f6('0x19'),_0x3fe58b,JSON[_0x54f6('0xf')](_0x179da8));_0x30e6e7(_0x179da8);})['catch'](function(_0x13f58e){logger['error'](_0x54f6('0x19'),_0x13f58e[_0x54f6('0x12')],_0x3fe58b);_0x28cfb9(_0x35f91a['error'](0x1f4,_0x13f58e[_0x54f6('0x12')]));});});}; \ No newline at end of file +var _0x734f=['raw','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','SmsQueueReport','options','then','CreateSmsQueueReport','UpdateSmsQueueReport','body'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x734f,0x1df));var _0xf734=function(_0x54833a,_0x2b5714){_0x54833a=_0x54833a-0x0;var _0x4f3dc6=_0x734f[_0x54833a];return _0x4f3dc6;};'use strict';var _=require(_0xf734('0x0'));var util=require(_0xf734('0x1'));var moment=require(_0xf734('0x2'));var BPromise=require(_0xf734('0x3'));var rs=require(_0xf734('0x4'));var fs=require('fs');var Redis=require(_0xf734('0x5'));var db=require(_0xf734('0x6'))['db'];var utils=require(_0xf734('0x7'));var logger=require(_0xf734('0x8'))(_0xf734('0x9'));var config=require('../../config/environment');var jayson=require(_0xf734('0xa'));var client=jayson[_0xf734('0xb')][_0xf734('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5bf7bd,_0x752efa,_0x5f92bc){return new BPromise(function(_0xcc1e6a,_0x2c70d4){return client[_0xf734('0xd')](_0x5bf7bd,_0x5f92bc)['then'](function(_0x27f78c){logger['info'](_0xf734('0xe'),_0x752efa,'request\x20sent');logger[_0xf734('0xf')](_0xf734('0x10'),_0x752efa,_0xf734('0x11'),JSON[_0xf734('0x12')](_0x27f78c));if(_0x27f78c[_0xf734('0x13')]){if(_0x27f78c['error'][_0xf734('0x14')]===0x1f4){logger[_0xf734('0x13')](_0xf734('0xe'),_0x752efa,_0x27f78c[_0xf734('0x13')][_0xf734('0x15')]);return _0x2c70d4(_0x27f78c[_0xf734('0x13')][_0xf734('0x15')]);}logger[_0xf734('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x752efa,_0x27f78c[_0xf734('0x13')][_0xf734('0x15')]);return _0xcc1e6a(_0x27f78c[_0xf734('0x13')][_0xf734('0x15')]);}else{logger[_0xf734('0x16')](_0xf734('0xe'),_0x752efa,_0xf734('0x11'));_0xcc1e6a(_0x27f78c[_0xf734('0x17')]['message']);}})[_0xf734('0x18')](function(_0x1e2ec3){logger['error'](_0xf734('0xe'),_0x752efa,_0x1e2ec3);_0x2c70d4(_0x1e2ec3);});});}exports['CreateSmsQueueReport']=function(_0x2fd838){var _0x5db2c3=this;return new Promise(function(_0x2e62ec,_0xca0c13){return db[_0xf734('0x19')]['create'](_0x2fd838['body'],{'raw':_0x2fd838[_0xf734('0x1a')]?_0x2fd838[_0xf734('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xf734('0x1b')](function(_0x34d1fe){logger[_0xf734('0x16')](_0xf734('0x1c'),_0x2fd838);logger[_0xf734('0xf')](_0xf734('0x1c'),_0x2fd838,JSON['stringify'](_0x34d1fe));_0x2e62ec(_0x34d1fe);})[_0xf734('0x18')](function(_0x15f7b6){logger['error'](_0xf734('0x1c'),_0x15f7b6[_0xf734('0x15')],_0x2fd838);_0xca0c13(_0x5db2c3[_0xf734('0x13')](0x1f4,_0x15f7b6['message']));});});};exports[_0xf734('0x1d')]=function(_0x4fc350){var _0x3aecca=this;return new Promise(function(_0x3e32a0,_0x4ecf02){return db['SmsQueueReport']['update'](_0x4fc350[_0xf734('0x1e')],{'raw':_0x4fc350[_0xf734('0x1a')]?_0x4fc350[_0xf734('0x1a')][_0xf734('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fc350[_0xf734('0x1a')]?_0x4fc350['options']['where']||null:null,'attributes':_0x4fc350[_0xf734('0x1a')]?_0x4fc350[_0xf734('0x1a')][_0xf734('0x20')]||null:null,'limit':_0x4fc350[_0xf734('0x1a')]?_0x4fc350[_0xf734('0x1a')][_0xf734('0x21')]||null:null})['then'](function(_0x28b706){logger['info'](_0xf734('0x1d'),_0x4fc350);logger[_0xf734('0xf')]('UpdateSmsQueueReport',_0x4fc350,JSON[_0xf734('0x12')](_0x28b706));_0x3e32a0(_0x28b706);})['catch'](function(_0x575b8c){logger[_0xf734('0x13')]('UpdateSmsQueueReport',_0x575b8c[_0xf734('0x15')],_0x4fc350);_0x4ecf02(_0x3aecca[_0xf734('0x13')](0x1f4,_0x575b8c['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 4fd5759..a304cb9 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 _0x8ef6=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x382e19,_0x33b32e){var _0x337622=function(_0x220e4d){while(--_0x220e4d){_0x382e19['push'](_0x382e19['shift']());}};_0x337622(++_0x33b32e);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2b6f62,_0x22be28){_0x2b6f62=_0x2b6f62-0x0;var _0x4309ab=_0x8ef6[_0x2b6f62];return _0x4309ab;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xf')]('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router[_0x68ef('0x13')]('/:id',auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);module[_0x68ef('0x15')]=router; \ No newline at end of file +var _0x0fda=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x4effde,_0x46ba28){var _0x5a01d5=function(_0x1a2962){while(--_0x1a2962){_0x4effde['push'](_0x4effde['shift']());}};_0x5a01d5(++_0x46ba28);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x392a5c,_0x209502){_0x392a5c=_0x392a5c-0x0;var _0xc5ea8d=_0x0fda[_0x392a5c];return _0xc5ea8d;};'use strict';var multer=require(_0xa0fd('0x0'));var util=require('util');var path=require(_0xa0fd('0x1'));var timeout=require(_0xa0fd('0x2'));var express=require(_0xa0fd('0x3'));var router=express[_0xa0fd('0x4')]();var fs_extra=require(_0xa0fd('0x5'));var auth=require(_0xa0fd('0x6'));var interaction=require(_0xa0fd('0x7'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0xa0fd('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa0fd('0x8')](_0xa0fd('0x9'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0xb')]);router['get'](_0xa0fd('0xc'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0xd')]);router[_0xa0fd('0xe')]('/',auth['isAuthenticated'](),controller[_0xa0fd('0xf')]);router[_0xa0fd('0x10')](_0xa0fd('0xc'),auth['isAuthenticated'](),controller[_0xa0fd('0x11')]);router[_0xa0fd('0x12')](_0xa0fd('0xc'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0x13')]);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 4d62b06..47cff4d 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x154818,_0x17ae16){var _0xe7de7e=function(_0x33fe3a){while(--_0x33fe3a){_0x154818['push'](_0x154818['shift']());}};_0xe7de7e(++_0x17ae16);}(_0x34e8,0x12c));var _0x834e=function(_0x158f59,_0x390f2d){_0x158f59=_0x158f59-0x0;var _0x47cae5=_0x34e8[_0x158f59];return _0x47cae5;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x4402b6,_0x2c8543){var _0x1c9a9b=function(_0x3f2f80){while(--_0x3f2f80){_0x4402b6['push'](_0x4402b6['shift']());}};_0x1c9a9b(++_0x2c8543);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 5772562..cd5fc8e 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 _0x7a8a=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','SmsTransferReport','include','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x879e31,_0x139d02){var _0x3467e8=function(_0x544fc6){while(--_0x544fc6){_0x879e31['push'](_0x879e31['shift']());}};_0x3467e8(++_0x139d02);}(_0x7a8a,0x173));var _0xa7a8=function(_0x1807ff,_0x13e198){_0x1807ff=_0x1807ff-0x0;var _0x286e22=_0x7a8a[_0x1807ff];return _0x286e22;};'use strict';var emlformat=require(_0xa7a8('0x0'));var rimraf=require(_0xa7a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa7a8('0x2'));var rp=require(_0xa7a8('0x3'));var moment=require('moment');var BPromise=require(_0xa7a8('0x4'));var Mustache=require('mustache');var util=require(_0xa7a8('0x5'));var path=require(_0xa7a8('0x6'));var sox=require(_0xa7a8('0x7'));var csv=require(_0xa7a8('0x8'));var ejs=require(_0xa7a8('0x9'));var fs=require('fs');var fs_extra=require(_0xa7a8('0xa'));var _=require(_0xa7a8('0xb'));var squel=require(_0xa7a8('0xc'));var crypto=require(_0xa7a8('0xd'));var jsforce=require(_0xa7a8('0xe'));var deskjs=require(_0xa7a8('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa7a8('0x10'));var Papa=require(_0xa7a8('0x11'));var Redis=require('ioredis');var authService=require(_0xa7a8('0x12'));var qs=require(_0xa7a8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7a8('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xa7a8('0x15'));var config=require(_0xa7a8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa7a8('0x17'))['db'];function respondWithStatusCode(_0x50a639,_0x152482){_0x152482=_0x152482||0xcc;return function(_0x12e02f){if(_0x12e02f){return _0x50a639[_0xa7a8('0x18')](_0x152482);}return _0x50a639[_0xa7a8('0x19')](_0x152482)['end']();};}function respondWithResult(_0x39b319,_0xc7a2ab){_0xc7a2ab=_0xc7a2ab||0xc8;return function(_0x31cf96){if(_0x31cf96){return _0x39b319[_0xa7a8('0x19')](_0xc7a2ab)[_0xa7a8('0x1a')](_0x31cf96);}};}function respondWithFilteredResult(_0x573a84,_0x2f6fae){return function(_0x5b3f36){if(_0x5b3f36){var _0x598989=typeof _0x2f6fae['offset']==='undefined'&&typeof _0x2f6fae[_0xa7a8('0x1b')]===_0xa7a8('0x1c');var _0x169586=_0x5b3f36[_0xa7a8('0x1d')];var _0x37d724=_0x598989?0x0:_0x2f6fae[_0xa7a8('0x1e')];var _0x346d96=_0x598989?_0x5b3f36[_0xa7a8('0x1d')]:_0x2f6fae[_0xa7a8('0x1e')]+_0x2f6fae[_0xa7a8('0x1b')];var _0x40ca84;if(_0x346d96>=_0x169586){_0x346d96=_0x169586;_0x40ca84=0xc8;}else{_0x40ca84=0xce;}_0x573a84[_0xa7a8('0x19')](_0x40ca84);return _0x573a84[_0xa7a8('0x1f')](_0xa7a8('0x20'),_0x37d724+'-'+_0x346d96+'/'+_0x169586)[_0xa7a8('0x1a')](_0x5b3f36);}return null;};}function patchUpdates(_0x507f63){return function(_0x5685c3){try{jsonpatch[_0xa7a8('0x21')](_0x5685c3,_0x507f63,!![]);}catch(_0x52c547){return BPromise[_0xa7a8('0x22')](_0x52c547);}return _0x5685c3['save']();};}function saveUpdates(_0x3ab84e,_0x5dd4e4){return function(_0x5dff6b){if(_0x5dff6b){return _0x5dff6b[_0xa7a8('0x23')](_0x3ab84e)[_0xa7a8('0x24')](function(_0x2176ce){return _0x2176ce;});}return null;};}function removeEntity(_0x3c19e3,_0x4e31b6){return function(_0x2506b0){if(_0x2506b0){return _0x2506b0[_0xa7a8('0x25')]()[_0xa7a8('0x24')](function(){_0x3c19e3[_0xa7a8('0x19')](0xcc)[_0xa7a8('0x26')]();});}};}function handleEntityNotFound(_0xe3b9c7,_0x4d4b4a){return function(_0x3f836d){if(!_0x3f836d){_0xe3b9c7[_0xa7a8('0x18')](0x194);}return _0x3f836d;};}function handleError(_0x456c8b,_0x48d8bd){_0x48d8bd=_0x48d8bd||0x1f4;return function(_0x10b968){logger[_0xa7a8('0x27')](_0x10b968[_0xa7a8('0x28')]);if(_0x10b968[_0xa7a8('0x29')]){delete _0x10b968[_0xa7a8('0x29')];}_0x456c8b['status'](_0x48d8bd)[_0xa7a8('0x2a')](_0x10b968);};}exports[_0xa7a8('0x2b')]=function(_0x5be739,_0x2a8e1b){var _0x15f701={},_0x2e0939={},_0x353b0f={'count':0x0,'rows':[]};var _0x269049=_[_0xa7a8('0x2c')](db['SmsTransferReport'][_0xa7a8('0x2d')],function(_0xfdc4c7){return{'name':_0xfdc4c7[_0xa7a8('0x2e')],'type':_0xfdc4c7[_0xa7a8('0x2f')]['key']};});_0x2e0939[_0xa7a8('0x30')]=_[_0xa7a8('0x2c')](_0x269049,_0xa7a8('0x29'));_0x2e0939[_0xa7a8('0x31')]=_['keys'](_0x5be739[_0xa7a8('0x31')]);_0x2e0939[_0xa7a8('0x32')]=_[_0xa7a8('0x33')](_0x2e0939[_0xa7a8('0x30')],_0x2e0939[_0xa7a8('0x31')]);_0x15f701[_0xa7a8('0x34')]=_[_0xa7a8('0x33')](_0x2e0939['model'],qs[_0xa7a8('0x35')](_0x5be739[_0xa7a8('0x31')][_0xa7a8('0x35')]));_0x15f701[_0xa7a8('0x34')]=_0x15f701['attributes'][_0xa7a8('0x36')]?_0x15f701[_0xa7a8('0x34')]:_0x2e0939[_0xa7a8('0x30')];if(!_0x5be739[_0xa7a8('0x31')]['hasOwnProperty'](_0xa7a8('0x37'))){_0x15f701[_0xa7a8('0x1b')]=qs[_0xa7a8('0x1b')](_0x5be739[_0xa7a8('0x31')]['limit']);_0x15f701[_0xa7a8('0x1e')]=qs[_0xa7a8('0x1e')](_0x5be739[_0xa7a8('0x31')][_0xa7a8('0x1e')]);}_0x15f701[_0xa7a8('0x38')]=qs[_0xa7a8('0x39')](_0x5be739[_0xa7a8('0x31')][_0xa7a8('0x39')]);_0x15f701[_0xa7a8('0x3a')]=qs[_0xa7a8('0x32')](_[_0xa7a8('0x3b')](_0x5be739[_0xa7a8('0x31')],_0x2e0939[_0xa7a8('0x32')]),_0x269049);if(_0x5be739[_0xa7a8('0x31')][_0xa7a8('0x3c')]){_0x15f701[_0xa7a8('0x3a')]=_[_0xa7a8('0x3d')](_0x15f701[_0xa7a8('0x3a')],{'$or':_['map'](_0x269049,function(_0x500b8c){if(_0x500b8c[_0xa7a8('0x2f')]!==_0xa7a8('0x3e')){var _0x13c5f7={};_0x13c5f7[_0x500b8c[_0xa7a8('0x29')]]={'$like':'%'+_0x5be739[_0xa7a8('0x31')][_0xa7a8('0x3c')]+'%'};return _0x13c5f7;}})});}_0x15f701=_['merge']({},_0x15f701,_0x5be739[_0xa7a8('0x3f')]);var _0x3fb57a={'where':_0x15f701[_0xa7a8('0x3a')]};return db['SmsTransferReport']['count'](_0x3fb57a)['then'](function(_0x8b49a0){_0x353b0f[_0xa7a8('0x1d')]=_0x8b49a0;if(_0x5be739[_0xa7a8('0x31')][_0xa7a8('0x40')]){_0x15f701['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0xa7a8('0x41')](_0x15f701);})['then'](function(_0x239fcf){_0x353b0f[_0xa7a8('0x42')]=_0x239fcf;return _0x353b0f;})[_0xa7a8('0x24')](respondWithFilteredResult(_0x2a8e1b,_0x15f701))[_0xa7a8('0x43')](handleError(_0x2a8e1b,null));};exports[_0xa7a8('0x44')]=function(_0x106c4c,_0x3856c1){var _0x7caa60={'raw':!![],'where':{'id':_0x106c4c[_0xa7a8('0x45')]['id']}},_0x5ec863={};_0x5ec863['model']=_[_0xa7a8('0x46')](db[_0xa7a8('0x47')][_0xa7a8('0x2d')]);_0x5ec863['query']=_[_0xa7a8('0x46')](_0x106c4c[_0xa7a8('0x31')]);_0x5ec863[_0xa7a8('0x32')]=_['intersection'](_0x5ec863[_0xa7a8('0x30')],_0x5ec863[_0xa7a8('0x31')]);_0x7caa60[_0xa7a8('0x34')]=_[_0xa7a8('0x33')](_0x5ec863[_0xa7a8('0x30')],qs[_0xa7a8('0x35')](_0x106c4c[_0xa7a8('0x31')][_0xa7a8('0x35')]));_0x7caa60['attributes']=_0x7caa60[_0xa7a8('0x34')][_0xa7a8('0x36')]?_0x7caa60[_0xa7a8('0x34')]:_0x5ec863[_0xa7a8('0x30')];if(_0x106c4c['query'][_0xa7a8('0x40')]){_0x7caa60[_0xa7a8('0x48')]=[{'all':!![]}];}_0x7caa60=_[_0xa7a8('0x3d')]({},_0x7caa60,_0x106c4c[_0xa7a8('0x3f')]);return db['SmsTransferReport']['find'](_0x7caa60)[_0xa7a8('0x24')](handleEntityNotFound(_0x3856c1,null))['then'](respondWithResult(_0x3856c1,null))[_0xa7a8('0x43')](handleError(_0x3856c1,null));};exports[_0xa7a8('0x49')]=function(_0x5b3d5f,_0x2396f3){return db[_0xa7a8('0x47')][_0xa7a8('0x49')](_0x5b3d5f[_0xa7a8('0x4a')],{})[_0xa7a8('0x24')](respondWithResult(_0x2396f3,0xc9))[_0xa7a8('0x43')](handleError(_0x2396f3,null));};exports[_0xa7a8('0x23')]=function(_0x69aa92,_0x2b62cc){if(_0x69aa92[_0xa7a8('0x4a')]['id']){delete _0x69aa92['body']['id'];}return db[_0xa7a8('0x47')][_0xa7a8('0x4b')]({'where':{'id':_0x69aa92['params']['id']}})['then'](handleEntityNotFound(_0x2b62cc,null))[_0xa7a8('0x24')](saveUpdates(_0x69aa92[_0xa7a8('0x4a')],null))[_0xa7a8('0x24')](respondWithResult(_0x2b62cc,null))[_0xa7a8('0x43')](handleError(_0x2b62cc,null));};exports[_0xa7a8('0x25')]=function(_0x6c1272,_0x426f6f){return db['SmsTransferReport'][_0xa7a8('0x4b')]({'where':{'id':_0x6c1272['params']['id']}})[_0xa7a8('0x24')](handleEntityNotFound(_0x426f6f,null))[_0xa7a8('0x24')](removeEntity(_0x426f6f,null))['catch'](handleError(_0x426f6f,null));};exports['describe']=function(_0x199bb5,_0x1e5783){return db[_0xa7a8('0x47')][_0xa7a8('0x4c')]()[_0xa7a8('0x24')](respondWithResult(_0x1e5783,null))[_0xa7a8('0x43')](handleError(_0x1e5783,null));}; \ No newline at end of file +var _0x14de=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SmsTransferReport','include','findAll','rows','catch','show','includeAll','create','update','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x3b9ec6,_0x49c207){var _0x5cac43=function(_0x6d23e){while(--_0x6d23e){_0x3b9ec6['push'](_0x3b9ec6['shift']());}};_0x5cac43(++_0x49c207);}(_0x14de,0x1d4));var _0xe14d=function(_0x513f2e,_0x476378){_0x513f2e=_0x513f2e-0x0;var _0x348c26=_0x14de[_0x513f2e];return _0x348c26;};'use strict';var emlformat=require(_0xe14d('0x0'));var rimraf=require(_0xe14d('0x1'));var zipdir=require(_0xe14d('0x2'));var jsonpatch=require(_0xe14d('0x3'));var rp=require(_0xe14d('0x4'));var moment=require(_0xe14d('0x5'));var BPromise=require(_0xe14d('0x6'));var Mustache=require('mustache');var util=require(_0xe14d('0x7'));var path=require(_0xe14d('0x8'));var sox=require(_0xe14d('0x9'));var csv=require(_0xe14d('0xa'));var ejs=require(_0xe14d('0xb'));var fs=require('fs');var fs_extra=require(_0xe14d('0xc'));var _=require(_0xe14d('0xd'));var squel=require(_0xe14d('0xe'));var crypto=require(_0xe14d('0xf'));var jsforce=require(_0xe14d('0x10'));var deskjs=require(_0xe14d('0x11'));var toCsv=require(_0xe14d('0xa'));var querystring=require(_0xe14d('0x12'));var Papa=require(_0xe14d('0x13'));var Redis=require(_0xe14d('0x14'));var authService=require(_0xe14d('0x15'));var qs=require(_0xe14d('0x16'));var as=require(_0xe14d('0x17'));var hardwareService=require(_0xe14d('0x18'));var logger=require(_0xe14d('0x19'))(_0xe14d('0x1a'));var utils=require('../../config/utils');var config=require(_0xe14d('0x1b'));var licenseUtil=require(_0xe14d('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d90b7,_0x5d2373){_0x5d2373=_0x5d2373||0xcc;return function(_0x2d1d08){if(_0x2d1d08){return _0x4d90b7[_0xe14d('0x1d')](_0x5d2373);}return _0x4d90b7['status'](_0x5d2373)[_0xe14d('0x1e')]();};}function respondWithResult(_0x4d11a2,_0x57b7f1){_0x57b7f1=_0x57b7f1||0xc8;return function(_0x184629){if(_0x184629){return _0x4d11a2[_0xe14d('0x1f')](_0x57b7f1)['json'](_0x184629);}};}function respondWithFilteredResult(_0x3557f5,_0x19123e){return function(_0x40c713){if(_0x40c713){var _0x2252f5=typeof _0x19123e['offset']===_0xe14d('0x20')&&typeof _0x19123e[_0xe14d('0x21')]===_0xe14d('0x20');var _0x24f66c=_0x40c713[_0xe14d('0x22')];var _0x4a0359=_0x2252f5?0x0:_0x19123e[_0xe14d('0x23')];var _0x3613b2=_0x2252f5?_0x40c713[_0xe14d('0x22')]:_0x19123e['offset']+_0x19123e[_0xe14d('0x21')];var _0x3b4dcd;if(_0x3613b2>=_0x24f66c){_0x3613b2=_0x24f66c;_0x3b4dcd=0xc8;}else{_0x3b4dcd=0xce;}_0x3557f5['status'](_0x3b4dcd);return _0x3557f5[_0xe14d('0x24')](_0xe14d('0x25'),_0x4a0359+'-'+_0x3613b2+'/'+_0x24f66c)['json'](_0x40c713);}return null;};}function patchUpdates(_0xb8b894){return function(_0x2e5885){try{jsonpatch['apply'](_0x2e5885,_0xb8b894,!![]);}catch(_0x138bb5){return BPromise[_0xe14d('0x26')](_0x138bb5);}return _0x2e5885[_0xe14d('0x27')]();};}function saveUpdates(_0x58eafb,_0xa10c95){return function(_0x197371){if(_0x197371){return _0x197371['update'](_0x58eafb)[_0xe14d('0x28')](function(_0x4a57af){return _0x4a57af;});}return null;};}function removeEntity(_0x283804,_0x2995e7){return function(_0x26bd0d){if(_0x26bd0d){return _0x26bd0d[_0xe14d('0x29')]()[_0xe14d('0x28')](function(){_0x283804['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4366d3,_0x42e33a){return function(_0x5257db){if(!_0x5257db){_0x4366d3[_0xe14d('0x1d')](0x194);}return _0x5257db;};}function handleError(_0x74e525,_0x4345cd){_0x4345cd=_0x4345cd||0x1f4;return function(_0x4aa93b){logger[_0xe14d('0x2a')](_0x4aa93b[_0xe14d('0x2b')]);if(_0x4aa93b['name']){delete _0x4aa93b[_0xe14d('0x2c')];}_0x74e525['status'](_0x4345cd)['send'](_0x4aa93b);};}exports[_0xe14d('0x2d')]=function(_0x389456,_0xb922cd){var _0x47bbaf={},_0x33e6e3={},_0x4fc624={'count':0x0,'rows':[]};var _0x44bce8=_[_0xe14d('0x2e')](db['SmsTransferReport'][_0xe14d('0x2f')],function(_0x52c9b2){return{'name':_0x52c9b2['fieldName'],'type':_0x52c9b2[_0xe14d('0x30')]['key']};});_0x33e6e3[_0xe14d('0x31')]=_['map'](_0x44bce8,_0xe14d('0x2c'));_0x33e6e3[_0xe14d('0x32')]=_[_0xe14d('0x33')](_0x389456[_0xe14d('0x32')]);_0x33e6e3[_0xe14d('0x34')]=_[_0xe14d('0x35')](_0x33e6e3['model'],_0x33e6e3[_0xe14d('0x32')]);_0x47bbaf[_0xe14d('0x36')]=_['intersection'](_0x33e6e3['model'],qs['fields'](_0x389456['query'][_0xe14d('0x37')]));_0x47bbaf[_0xe14d('0x36')]=_0x47bbaf[_0xe14d('0x36')][_0xe14d('0x38')]?_0x47bbaf[_0xe14d('0x36')]:_0x33e6e3[_0xe14d('0x31')];if(!_0x389456[_0xe14d('0x32')][_0xe14d('0x39')](_0xe14d('0x3a'))){_0x47bbaf[_0xe14d('0x21')]=qs[_0xe14d('0x21')](_0x389456[_0xe14d('0x32')][_0xe14d('0x21')]);_0x47bbaf[_0xe14d('0x23')]=qs[_0xe14d('0x23')](_0x389456[_0xe14d('0x32')]['offset']);}_0x47bbaf[_0xe14d('0x3b')]=qs[_0xe14d('0x3c')](_0x389456[_0xe14d('0x32')][_0xe14d('0x3c')]);_0x47bbaf[_0xe14d('0x3d')]=qs[_0xe14d('0x34')](_[_0xe14d('0x3e')](_0x389456['query'],_0x33e6e3[_0xe14d('0x34')]),_0x44bce8);if(_0x389456[_0xe14d('0x32')]['filter']){_0x47bbaf[_0xe14d('0x3d')]=_[_0xe14d('0x3f')](_0x47bbaf[_0xe14d('0x3d')],{'$or':_[_0xe14d('0x2e')](_0x44bce8,function(_0x4eba7f){if(_0x4eba7f[_0xe14d('0x30')]!==_0xe14d('0x40')){var _0x5d0976={};_0x5d0976[_0x4eba7f[_0xe14d('0x2c')]]={'$like':'%'+_0x389456['query'][_0xe14d('0x41')]+'%'};return _0x5d0976;}})});}_0x47bbaf=_[_0xe14d('0x3f')]({},_0x47bbaf,_0x389456[_0xe14d('0x42')]);var _0x431f46={'where':_0x47bbaf['where']};return db[_0xe14d('0x43')]['count'](_0x431f46)[_0xe14d('0x28')](function(_0x2370ca){_0x4fc624[_0xe14d('0x22')]=_0x2370ca;if(_0x389456['query']['includeAll']){_0x47bbaf[_0xe14d('0x44')]=[{'all':!![]}];}return db[_0xe14d('0x43')][_0xe14d('0x45')](_0x47bbaf);})[_0xe14d('0x28')](function(_0x42cf77){_0x4fc624[_0xe14d('0x46')]=_0x42cf77;return _0x4fc624;})[_0xe14d('0x28')](respondWithFilteredResult(_0xb922cd,_0x47bbaf))[_0xe14d('0x47')](handleError(_0xb922cd,null));};exports[_0xe14d('0x48')]=function(_0x5429f3,_0x111a45){var _0x27dc4c={'raw':!![],'where':{'id':_0x5429f3['params']['id']}},_0x3fae64={};_0x3fae64['model']=_[_0xe14d('0x33')](db[_0xe14d('0x43')][_0xe14d('0x2f')]);_0x3fae64[_0xe14d('0x32')]=_[_0xe14d('0x33')](_0x5429f3[_0xe14d('0x32')]);_0x3fae64[_0xe14d('0x34')]=_[_0xe14d('0x35')](_0x3fae64['model'],_0x3fae64['query']);_0x27dc4c[_0xe14d('0x36')]=_[_0xe14d('0x35')](_0x3fae64[_0xe14d('0x31')],qs['fields'](_0x5429f3['query'][_0xe14d('0x37')]));_0x27dc4c[_0xe14d('0x36')]=_0x27dc4c['attributes']['length']?_0x27dc4c[_0xe14d('0x36')]:_0x3fae64[_0xe14d('0x31')];if(_0x5429f3[_0xe14d('0x32')][_0xe14d('0x49')]){_0x27dc4c[_0xe14d('0x44')]=[{'all':!![]}];}_0x27dc4c=_[_0xe14d('0x3f')]({},_0x27dc4c,_0x5429f3[_0xe14d('0x42')]);return db[_0xe14d('0x43')]['find'](_0x27dc4c)[_0xe14d('0x28')](handleEntityNotFound(_0x111a45,null))[_0xe14d('0x28')](respondWithResult(_0x111a45,null))[_0xe14d('0x47')](handleError(_0x111a45,null));};exports[_0xe14d('0x4a')]=function(_0x236b6b,_0x9da3c0){return db[_0xe14d('0x43')]['create'](_0x236b6b['body'],{})[_0xe14d('0x28')](respondWithResult(_0x9da3c0,0xc9))[_0xe14d('0x47')](handleError(_0x9da3c0,null));};exports[_0xe14d('0x4b')]=function(_0x37a852,_0x37468f){if(_0x37a852[_0xe14d('0x4c')]['id']){delete _0x37a852[_0xe14d('0x4c')]['id'];}return db[_0xe14d('0x43')][_0xe14d('0x4d')]({'where':{'id':_0x37a852[_0xe14d('0x4e')]['id']}})[_0xe14d('0x28')](handleEntityNotFound(_0x37468f,null))[_0xe14d('0x28')](saveUpdates(_0x37a852['body'],null))[_0xe14d('0x28')](respondWithResult(_0x37468f,null))[_0xe14d('0x47')](handleError(_0x37468f,null));};exports[_0xe14d('0x29')]=function(_0xd7a682,_0x463ccc){return db[_0xe14d('0x43')][_0xe14d('0x4d')]({'where':{'id':_0xd7a682['params']['id']}})[_0xe14d('0x28')](handleEntityNotFound(_0x463ccc,null))[_0xe14d('0x28')](removeEntity(_0x463ccc,null))['catch'](handleError(_0x463ccc,null));};exports[_0xe14d('0x4f')]=function(_0x1798fb,_0x275eb8){return db['SmsTransferReport']['describe']()[_0xe14d('0x28')](respondWithResult(_0x275eb8,null))[_0xe14d('0x47')](handleError(_0x275eb8,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index b0aaa1b..535ffc0 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 _0x68fc=['uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport'];(function(_0x209ad0,_0x178ba3){var _0x1859dd=function(_0x592de6){while(--_0x592de6){_0x209ad0['push'](_0x209ad0['shift']());}};_0x1859dd(++_0x178ba3);}(_0x68fc,0x9d));var _0xc68f=function(_0x100827,_0x49215d){_0x100827=_0x100827-0x0;var _0x1e6245=_0x68fc[_0x100827];return _0x1e6245;};'use strict';var _=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var logger=require('../../config/logger')(_0xc68f('0x2'));var moment=require(_0xc68f('0x3'));var BPromise=require(_0xc68f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc68f('0x5'));var rimraf=require(_0xc68f('0x6'));var config=require(_0xc68f('0x7'));var attributes=require(_0xc68f('0x8'));module[_0xc68f('0x9')]=function(_0x300557,_0x41ceff){return _0x300557[_0xc68f('0xa')](_0xc68f('0xb'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc68f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9364=['report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','exports','SmsTransferReport'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x9364,0x141));var _0x4936=function(_0x2874bb,_0x4b1c29){_0x2874bb=_0x2874bb-0x0;var _0x3d6bfd=_0x9364[_0x2874bb];return _0x3d6bfd;};'use strict';var _=require(_0x4936('0x0'));var util=require(_0x4936('0x1'));var logger=require(_0x4936('0x2'))(_0x4936('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4936('0x4'));var rimraf=require(_0x4936('0x5'));var config=require(_0x4936('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x4936('0x7')]=function(_0x22d4c0,_0x16642c){return _0x22d4c0['define'](_0x4936('0x8'),attributes,{'tableName':_0x4936('0x9'),'paranoid':![],'indexes':[{'name':_0x4936('0xa'),'fields':[_0x4936('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 7fe57c9..848720c 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 _0x6bb4=['message','info','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x3ffc08,_0x10c357){var _0x334859=function(_0x4480f4){while(--_0x4480f4){_0x3ffc08['push'](_0x3ffc08['shift']());}};_0x334859(++_0x10c357);}(_0x6bb4,0x1a7));var _0x46bb=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0x6bb4[_0x4bd950];return _0x5dc59a;};'use strict';var _=require(_0x46bb('0x0'));var util=require(_0x46bb('0x1'));var moment=require(_0x46bb('0x2'));var BPromise=require('bluebird');var rs=require(_0x46bb('0x3'));var fs=require('fs');var Redis=require(_0x46bb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x46bb('0x5'));var logger=require(_0x46bb('0x6'))(_0x46bb('0x7'));var config=require(_0x46bb('0x8'));var jayson=require(_0x46bb('0x9'));var client=jayson[_0x46bb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fa5c4,_0x2f1e64,_0x4338c9){return new BPromise(function(_0x57fb08,_0x5809f5){return client['request'](_0x4fa5c4,_0x4338c9)[_0x46bb('0xb')](function(_0x2c7e4c){logger['info'](_0x46bb('0xc'),_0x2f1e64,_0x46bb('0xd'));logger[_0x46bb('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x2f1e64,_0x46bb('0xd'),JSON[_0x46bb('0xf')](_0x2c7e4c));if(_0x2c7e4c['error']){if(_0x2c7e4c[_0x46bb('0x10')][_0x46bb('0x11')]===0x1f4){logger[_0x46bb('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x2f1e64,_0x2c7e4c[_0x46bb('0x10')]['message']);return _0x5809f5(_0x2c7e4c['error'][_0x46bb('0x12')]);}logger['error'](_0x46bb('0xc'),_0x2f1e64,_0x2c7e4c[_0x46bb('0x10')]['message']);return _0x57fb08(_0x2c7e4c[_0x46bb('0x10')]['message']);}else{logger[_0x46bb('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x2f1e64,_0x46bb('0xd'));_0x57fb08(_0x2c7e4c['result']['message']);}})[_0x46bb('0x14')](function(_0x3965ed){logger['error'](_0x46bb('0xc'),_0x2f1e64,_0x3965ed);_0x5809f5(_0x3965ed);});});} \ No newline at end of file +var _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x513b39,_0x1202e0){var _0x4e5f74=function(_0x10eeb8){while(--_0x10eeb8){_0x513b39['push'](_0x513b39['shift']());}};_0x4e5f74(++_0x1202e0);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x00bb[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 03e2830..81eea40 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 _0x4494=['get','isAuthenticated','index','/:id','show','/:id/download','download','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','update','delete','exports','multer','util','express','../../components/auth/service','../../config/environment','./sound.controller'];(function(_0x49adf9,_0x5beeda){var _0x31c29d=function(_0x13c9ac){while(--_0x13c9ac){_0x49adf9['push'](_0x49adf9['shift']());}};_0x31c29d(++_0x5beeda);}(_0x4494,0x14a));var _0x4449=function(_0x29b3b6,_0x1f361d){_0x29b3b6=_0x29b3b6-0x0;var _0x2a2d24=_0x4494[_0x29b3b6];return _0x2a2d24;};'use strict';var multer=require(_0x4449('0x0'));var util=require(_0x4449('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4449('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4449('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4449('0x4'));var controller=require(_0x4449('0x5'));router[_0x4449('0x6')]('/',auth[_0x4449('0x7')](),controller[_0x4449('0x8')]);router['get'](_0x4449('0x9'),auth[_0x4449('0x7')](),controller[_0x4449('0xa')]);router['get'](_0x4449('0xb'),auth[_0x4449('0x7')](),controller[_0x4449('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d50b8,_0x3f24c2,_0x191407){_0x191407(null,path['join'](config[_0x4449('0xd')],'server/files/sounds/original/'));},'filename':function(_0x35bcbd,_0xd2ab03,_0x5e6812){_0xd2ab03[_0x4449('0xe')]=_0xd2ab03[_0x4449('0xe')][_0x4449('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5e6812(null,util[_0x4449('0x10')](_0x4449('0x11'),path[_0x4449('0x12')](_0xd2ab03['originalname'],path[_0x4449('0x13')](_0xd2ab03['originalname'])),Date[_0x4449('0x14')](),path[_0x4449('0x13')](_0xd2ab03[_0x4449('0xe')])));}})});router[_0x4449('0x15')]('/',upload[_0x4449('0x16')](_0x4449('0x17')),controller[_0x4449('0x18')]);router['put'](_0x4449('0x9'),auth[_0x4449('0x7')](),controller[_0x4449('0x19')]);router[_0x4449('0x1a')]('/:id',auth[_0x4449('0x7')](),controller[_0x4449('0x1a')]);module[_0x4449('0x1b')]=router; \ No newline at end of file +var _0xe4c8=['/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','post','file','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','index','get','/:id','isAuthenticated','show'];(function(_0x3224fb,_0x29b100){var _0x2f9a63=function(_0x112aff){while(--_0x112aff){_0x3224fb['push'](_0x3224fb['shift']());}};_0x2f9a63(++_0x29b100);}(_0xe4c8,0x1c3));var _0x8e4c=function(_0x19ab0c,_0x5798c5){_0x19ab0c=_0x19ab0c-0x0;var _0x62d7b2=_0xe4c8[_0x19ab0c];return _0x62d7b2;};'use strict';var multer=require(_0x8e4c('0x0'));var util=require(_0x8e4c('0x1'));var path=require(_0x8e4c('0x2'));var timeout=require('connect-timeout');var express=require(_0x8e4c('0x3'));var router=express[_0x8e4c('0x4')]();var fs_extra=require(_0x8e4c('0x5'));var auth=require(_0x8e4c('0x6'));var interaction=require(_0x8e4c('0x7'));var config=require('../../config/environment');var controller=require(_0x8e4c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x8e4c('0x9')]);router[_0x8e4c('0xa')](_0x8e4c('0xb'),auth[_0x8e4c('0xc')](),controller[_0x8e4c('0xd')]);router[_0x8e4c('0xa')](_0x8e4c('0xe'),auth[_0x8e4c('0xc')](),controller[_0x8e4c('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2dea86,_0x5ee665,_0x209fca){_0x209fca(null,path[_0x8e4c('0x10')](config[_0x8e4c('0x11')],_0x8e4c('0x12')));},'filename':function(_0x3920ac,_0x270c72,_0x297359){_0x270c72[_0x8e4c('0x13')]=_0x270c72[_0x8e4c('0x13')][_0x8e4c('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x297359(null,util[_0x8e4c('0x15')](_0x8e4c('0x16'),path[_0x8e4c('0x17')](_0x270c72['originalname'],path['extname'](_0x270c72['originalname'])),Date[_0x8e4c('0x18')](),path['extname'](_0x270c72[_0x8e4c('0x13')])));}})});router[_0x8e4c('0x19')]('/',upload['single'](_0x8e4c('0x1a')),controller['create']);router[_0x8e4c('0x1b')](_0x8e4c('0xb'),auth['isAuthenticated'](),controller[_0x8e4c('0x1c')]);router[_0x8e4c('0x1d')]('/:id',auth[_0x8e4c('0xc')](),controller[_0x8e4c('0x1d')]);module[_0x8e4c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 46ba6ab..dbc5a45 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 _0xf5b0=['name','FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x1b36f4,_0x255c8d){var _0x3c7a42=function(_0x312bff){while(--_0x312bff){_0x1b36f4['push'](_0x1b36f4['shift']());}};_0x3c7a42(++_0x255c8d);}(_0xf5b0,0x10e));var _0x0f5b=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xf5b0[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0x0f5b('0x0'));module[_0x0f5b('0x1')]={'name':{'type':Sequelize[_0x0f5b('0x2')],'unique':_0x0f5b('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x0f5b('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x0f5b('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x0f5b('0x4')]},'original_sampleCount':{'type':Sequelize[_0x0f5b('0x5')]},'original_channelCount':{'type':Sequelize[_0x0f5b('0x6')]},'original_bitRate':{'type':Sequelize[_0x0f5b('0x5')]},'original_sampleRate':{'type':Sequelize[_0x0f5b('0x6')]},'converted_format':{'type':Sequelize[_0x0f5b('0x2')]},'converted_duration':{'type':Sequelize[_0x0f5b('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x0f5b('0x5')]},'converted_channelCount':{'type':Sequelize[_0x0f5b('0x6')]},'converted_bitRate':{'type':Sequelize[_0x0f5b('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x0f5b('0x6')]}}; \ No newline at end of file +var _0xb51c=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x3a4c07,_0x18440c){var _0x5a4943=function(_0x4afb24){while(--_0x4afb24){_0x3a4c07['push'](_0x3a4c07['shift']());}};_0x5a4943(++_0x18440c);}(_0xb51c,0x1c5));var _0xcb51=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xb51c[_0x32d457];return _0x338386;};'use strict';var Sequelize=require(_0xcb51('0x0'));module[_0xcb51('0x1')]={'name':{'type':Sequelize[_0xcb51('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xcb51('0x2')]},'display_name':{'type':Sequelize[_0xcb51('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xcb51('0x3')]},'original_sampleCount':{'type':Sequelize[_0xcb51('0x4')]},'original_channelCount':{'type':Sequelize[_0xcb51('0x5')]},'original_bitRate':{'type':Sequelize[_0xcb51('0x4')]},'original_sampleRate':{'type':Sequelize[_0xcb51('0x5')]},'converted_format':{'type':Sequelize[_0xcb51('0x2')]},'converted_duration':{'type':Sequelize[_0xcb51('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xcb51('0x4')]},'converted_channelCount':{'type':Sequelize[_0xcb51('0x5')]},'converted_bitRate':{'type':Sequelize[_0xcb51('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xcb51('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 0c249de..6eb8d4b 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 _0x415f=['server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','chmodSync','0777','transcode','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','send','pick','description','delete','original_format','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','index','map','Sound','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','download','save_name','converted_format','existsSync','join','root'];(function(_0x27bd2c,_0x24bd98){var _0x3784ea=function(_0x4ca802){while(--_0x4ca802){_0x27bd2c['push'](_0x27bd2c['shift']());}};_0x3784ea(++_0x24bd98);}(_0x415f,0x12f));var _0xf415=function(_0x542459,_0x4a1296){_0x542459=_0x542459-0x0;var _0x3eaf66=_0x415f[_0x542459];return _0x3eaf66;};'use strict';var emlformat=require(_0xf415('0x0'));var rimraf=require(_0xf415('0x1'));var zipdir=require(_0xf415('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf415('0x3'));var moment=require(_0xf415('0x4'));var BPromise=require(_0xf415('0x5'));var Mustache=require(_0xf415('0x6'));var util=require(_0xf415('0x7'));var path=require(_0xf415('0x8'));var sox=require(_0xf415('0x9'));var csv=require(_0xf415('0xa'));var ejs=require(_0xf415('0xb'));var fs=require('fs');var fs_extra=require(_0xf415('0xc'));var _=require(_0xf415('0xd'));var squel=require('squel');var crypto=require(_0xf415('0xe'));var jsforce=require(_0xf415('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf415('0xa'));var querystring=require(_0xf415('0x10'));var Papa=require(_0xf415('0x11'));var Redis=require(_0xf415('0x12'));var authService=require(_0xf415('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf415('0x14'));var hardwareService=require(_0xf415('0x15'));var logger=require('../../config/logger')(_0xf415('0x16'));var utils=require('../../config/utils');var config=require(_0xf415('0x17'));var licenseUtil=require(_0xf415('0x18'));var db=require(_0xf415('0x19'))['db'];function respondWithStatusCode(_0x44aa16,_0x1349ea){_0x1349ea=_0x1349ea||0xcc;return function(_0xc9f2f4){if(_0xc9f2f4){return _0x44aa16[_0xf415('0x1a')](_0x1349ea);}return _0x44aa16['status'](_0x1349ea)[_0xf415('0x1b')]();};}function respondWithResult(_0x5e8690,_0x55d78d){_0x55d78d=_0x55d78d||0xc8;return function(_0x49c217){if(_0x49c217){return _0x5e8690[_0xf415('0x1c')](_0x55d78d)[_0xf415('0x1d')](_0x49c217);}};}function respondWithFilteredResult(_0x421690,_0x22c154){return function(_0x533309){if(_0x533309){var _0x560f7c=typeof _0x22c154[_0xf415('0x1e')]===_0xf415('0x1f')&&typeof _0x22c154[_0xf415('0x20')]==='undefined';var _0xa33850=_0x533309[_0xf415('0x21')];var _0x265993=_0x560f7c?0x0:_0x22c154[_0xf415('0x1e')];var _0x207d84=_0x560f7c?_0x533309['count']:_0x22c154[_0xf415('0x1e')]+_0x22c154[_0xf415('0x20')];var _0x456b03;if(_0x207d84>=_0xa33850){_0x207d84=_0xa33850;_0x456b03=0xc8;}else{_0x456b03=0xce;}_0x421690[_0xf415('0x1c')](_0x456b03);return _0x421690[_0xf415('0x22')](_0xf415('0x23'),_0x265993+'-'+_0x207d84+'/'+_0xa33850)['json'](_0x533309);}return null;};}function patchUpdates(_0x4bd8e9){return function(_0x1a86d4){try{jsonpatch['apply'](_0x1a86d4,_0x4bd8e9,!![]);}catch(_0x369208){return BPromise[_0xf415('0x24')](_0x369208);}return _0x1a86d4[_0xf415('0x25')]();};}function saveUpdates(_0x178ecb,_0x23ab2b){return function(_0x5ac04f){if(_0x5ac04f){return _0x5ac04f[_0xf415('0x26')](_0x178ecb)[_0xf415('0x27')](function(_0x1e9b00){return _0x1e9b00;});}return null;};}function removeEntity(_0x5610f8,_0x359114){return function(_0x1e82ce){if(_0x1e82ce){return _0x1e82ce[_0xf415('0x28')]()['then'](function(){var _0x1bf35f=_0x1e82ce[_0xf415('0x29')]({'plain':!![]});var _0x1c98a7=_0xf415('0x2a');return db[_0xf415('0x2b')][_0xf415('0x28')]({'where':{'type':_0x1c98a7,'resourceId':_0x1bf35f['id']}})[_0xf415('0x27')](function(){return _0x1e82ce;});})[_0xf415('0x27')](function(){_0x5610f8['status'](0xcc)[_0xf415('0x1b')]();});}};}function handleEntityNotFound(_0x4eec94,_0x43facd){return function(_0x1aa1fa){if(!_0x1aa1fa){_0x4eec94['sendStatus'](0x194);}return _0x1aa1fa;};}function handleError(_0x16153d,_0x974741){_0x974741=_0x974741||0x1f4;return function(_0x2b3b0d){logger[_0xf415('0x2c')](_0x2b3b0d[_0xf415('0x2d')]);if(_0x2b3b0d[_0xf415('0x2e')]){delete _0x2b3b0d['name'];}_0x16153d[_0xf415('0x1c')](_0x974741)['send'](_0x2b3b0d);};}exports[_0xf415('0x2f')]=function(_0x4ee7cd,_0xfc64fa){var _0x1b49a4={},_0x3c9ef3={},_0xe0d37b={'count':0x0,'rows':[]};var _0x1c56a9=_[_0xf415('0x30')](db[_0xf415('0x31')][_0xf415('0x32')],function(_0x452e70){return{'name':_0x452e70[_0xf415('0x33')],'type':_0x452e70[_0xf415('0x34')][_0xf415('0x35')]};});_0x3c9ef3[_0xf415('0x36')]=_[_0xf415('0x30')](_0x1c56a9,_0xf415('0x2e'));_0x3c9ef3['query']=_[_0xf415('0x37')](_0x4ee7cd[_0xf415('0x38')]);_0x3c9ef3[_0xf415('0x39')]=_['intersection'](_0x3c9ef3[_0xf415('0x36')],_0x3c9ef3['query']);_0x1b49a4[_0xf415('0x3a')]=_[_0xf415('0x3b')](_0x3c9ef3[_0xf415('0x36')],qs['fields'](_0x4ee7cd[_0xf415('0x38')][_0xf415('0x3c')]));_0x1b49a4[_0xf415('0x3a')]=_0x1b49a4[_0xf415('0x3a')][_0xf415('0x3d')]?_0x1b49a4['attributes']:_0x3c9ef3[_0xf415('0x36')];if(!_0x4ee7cd[_0xf415('0x38')][_0xf415('0x3e')]('nolimit')){_0x1b49a4[_0xf415('0x20')]=qs[_0xf415('0x20')](_0x4ee7cd[_0xf415('0x38')][_0xf415('0x20')]);_0x1b49a4[_0xf415('0x1e')]=qs['offset'](_0x4ee7cd[_0xf415('0x38')][_0xf415('0x1e')]);}_0x1b49a4['order']=qs[_0xf415('0x3f')](_0x4ee7cd['query'][_0xf415('0x3f')]);_0x1b49a4[_0xf415('0x40')]=qs['filters'](_['pick'](_0x4ee7cd['query'],_0x3c9ef3['filters']),_0x1c56a9);if(_0x4ee7cd['query'][_0xf415('0x41')]){_0x1b49a4[_0xf415('0x40')]=_[_0xf415('0x42')](_0x1b49a4[_0xf415('0x40')],{'$or':_['map'](_0x1c56a9,function(_0x530118){if(_0x530118[_0xf415('0x34')]!==_0xf415('0x43')){var _0x2eb522={};_0x2eb522[_0x530118[_0xf415('0x2e')]]={'$like':'%'+_0x4ee7cd[_0xf415('0x38')][_0xf415('0x41')]+'%'};return _0x2eb522;}})});}_0x1b49a4=_['merge']({},_0x1b49a4,_0x4ee7cd[_0xf415('0x44')]);var _0x448d95={'where':_0x1b49a4[_0xf415('0x40')]};return db[_0xf415('0x31')][_0xf415('0x21')](_0x448d95)['then'](function(_0x538853){_0xe0d37b[_0xf415('0x21')]=_0x538853;if(_0x4ee7cd[_0xf415('0x38')][_0xf415('0x45')]){_0x1b49a4[_0xf415('0x46')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x1b49a4);})[_0xf415('0x27')](function(_0xa2bf6e){_0xe0d37b['rows']=_0xa2bf6e;return _0xe0d37b;})[_0xf415('0x27')](respondWithFilteredResult(_0xfc64fa,_0x1b49a4))[_0xf415('0x47')](handleError(_0xfc64fa,null));};exports[_0xf415('0x48')]=function(_0x1c4bee,_0x7a76e4){var _0x1dcb3a={'raw':!![],'where':{'id':_0x1c4bee[_0xf415('0x49')]['id']}},_0x55d3e3={};_0x55d3e3[_0xf415('0x36')]=_[_0xf415('0x37')](db['Sound'][_0xf415('0x32')]);_0x55d3e3['query']=_['keys'](_0x1c4bee[_0xf415('0x38')]);_0x55d3e3[_0xf415('0x39')]=_[_0xf415('0x3b')](_0x55d3e3[_0xf415('0x36')],_0x55d3e3[_0xf415('0x38')]);_0x1dcb3a[_0xf415('0x3a')]=_[_0xf415('0x3b')](_0x55d3e3[_0xf415('0x36')],qs[_0xf415('0x3c')](_0x1c4bee[_0xf415('0x38')][_0xf415('0x3c')]));_0x1dcb3a[_0xf415('0x3a')]=_0x1dcb3a[_0xf415('0x3a')][_0xf415('0x3d')]?_0x1dcb3a[_0xf415('0x3a')]:_0x55d3e3[_0xf415('0x36')];if(_0x1c4bee[_0xf415('0x38')][_0xf415('0x45')]){_0x1dcb3a[_0xf415('0x46')]=[{'all':!![]}];}_0x1dcb3a=_[_0xf415('0x42')]({},_0x1dcb3a,_0x1c4bee[_0xf415('0x44')]);return db['Sound'][_0xf415('0x4a')](_0x1dcb3a)[_0xf415('0x27')](handleEntityNotFound(_0x7a76e4,null))[_0xf415('0x27')](respondWithResult(_0x7a76e4,null))[_0xf415('0x47')](handleError(_0x7a76e4,null));};exports[_0xf415('0x4b')]=function(_0x2f52fd,_0x27fe44,_0x2524e9){return db['Sound'][_0xf415('0x4a')]({'where':{'id':_0x2f52fd[_0xf415('0x49')]['id']},'attributes':[_0xf415('0x2e'),_0xf415('0x4c'),_0xf415('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x27fe44,null))['then'](function(_0x228c95){if(_0x228c95){if(!fs[_0xf415('0x4e')](path[_0xf415('0x4f')](config[_0xf415('0x50')],_0xf415('0x51'),_0x228c95[_0xf415('0x4c')]+'.'+_0x228c95[_0xf415('0x4d')]))){throw new db[(_0xf415('0x52'))][(_0xf415('0x53'))](_0xf415('0x54'));}return _0x27fe44['download'](path[_0xf415('0x4f')](config[_0xf415('0x50')],_0xf415('0x51'),util['format']('%s.%s',_0x228c95[_0xf415('0x4c')],_0x228c95[_0xf415('0x4d')])),util[_0xf415('0x55')](_0xf415('0x56'),_0x228c95[_0xf415('0x2e')],_0x228c95[_0xf415('0x4d')]));}return null;})[_0xf415('0x47')](handleError(_0x27fe44,null));};exports[_0xf415('0x57')]=function(_0x1d231e,_0x44f640,_0x1844ac){var _0x596875={'name':path[_0xf415('0x58')](_0x1d231e[_0xf415('0x59')][_0xf415('0x5a')],path[_0xf415('0x5b')](_0x1d231e[_0xf415('0x59')][_0xf415('0x5a')])),'save_name':path[_0xf415('0x58')](_0x1d231e[_0xf415('0x59')]['filename'],path[_0xf415('0x5b')](_0x1d231e['file'][_0xf415('0x5c')])),'original_format':path[_0xf415('0x5b')](_0x1d231e[_0xf415('0x59')]['originalname'])[_0xf415('0x5d')](0x1),'converted_format':_0xf415('0x5e')};var _0x6994ff=path[_0xf415('0x4f')](config[_0xf415('0x50')],_0xf415('0x5f'),_0x1d231e[_0xf415('0x59')][_0xf415('0x5c')]);var _0x14556c=path['join'](config[_0xf415('0x50')],'server/files/sounds/converted',util[_0xf415('0x55')](_0xf415('0x56'),path['basename'](_0x1d231e['file']['filename'],path[_0xf415('0x5b')](_0x1d231e[_0xf415('0x59')][_0xf415('0x5c')])),_0x596875[_0xf415('0x4d')]));logger[_0xf415('0x60')]('Sound\x20upload\x20filepath:\x20%s',_0x6994ff);logger[_0xf415('0x60')]('Sound\x20upload\x20destination:\x20%s',_0x14556c);try{fs[_0xf415('0x61')](_0x6994ff,parseInt(_0xf415('0x62'),0x8));var _0x4dabdf=sox[_0xf415('0x63')](_0x6994ff,_0x14556c,{'sampleRate':0x1f40,'format':_0xf415('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4dabdf['on'](_0xf415('0x2c'),function(_0xf883e3){fs[_0xf415('0x64')](_0x6994ff);_0x44f640[_0xf415('0x1c')](0x1f4)['send'](_0xf883e3);});_0x4dabdf['on'](_0xf415('0x65'),function(_0xba0cd3){_0x596875['original_duration']=isNaN(_0xba0cd3[_0xf415('0x66')])?null:_0xba0cd3[_0xf415('0x66')]*0x3e8;_0x596875[_0xf415('0x67')]=isNaN(_0xba0cd3[_0xf415('0x68')])?null:_0xba0cd3[_0xf415('0x68')];_0x596875[_0xf415('0x69')]=isNaN(_0xba0cd3[_0xf415('0x6a')])?null:_0xba0cd3[_0xf415('0x6a')];_0x596875[_0xf415('0x6b')]=isNaN(_0xba0cd3[_0xf415('0x6c')])?null:_0xba0cd3[_0xf415('0x6c')];_0x596875[_0xf415('0x6d')]=isNaN(_0xba0cd3[_0xf415('0x6e')])?null:_0xba0cd3['sampleRate'];});_0x4dabdf['on']('dest',function(_0x275401){_0x596875[_0xf415('0x6f')]=isNaN(_0x275401[_0xf415('0x66')])?null:_0x275401[_0xf415('0x66')]*0x3e8;_0x596875['converted_sampleCount']=isNaN(_0x275401[_0xf415('0x68')])?null:_0x275401['sampleCount'];_0x596875[_0xf415('0x70')]=isNaN(_0x275401[_0xf415('0x6a')])?null:_0x275401[_0xf415('0x6a')];_0x596875[_0xf415('0x71')]=isNaN(_0x275401[_0xf415('0x6c')])?null:_0x275401['bitRate'];_0x596875[_0xf415('0x72')]=isNaN(_0x275401[_0xf415('0x6e')])?null:_0x275401[_0xf415('0x6e')];});_0x4dabdf['on'](_0xf415('0x1b'),function(){fs[_0xf415('0x61')](_0x14556c,parseInt(_0xf415('0x62'),0x8));return db[_0xf415('0x31')][_0xf415('0x57')](_0x596875)[_0xf415('0x27')](function(_0x47d947){var _0x43287a={'role':_0x1d231e[_0xf415('0x73')]['role'],'userProfileId':_0x1d231e[_0xf415('0x73')][_0xf415('0x74')]};if(!_0x43287a)throw new Error(_0xf415('0x75'));if(_0x43287a[_0xf415('0x76')]===_0xf415('0x77')){var _0x482e7a=_0x47d947[_0xf415('0x29')]({'plain':!![]});return db[_0xf415('0x78')][_0xf415('0x4a')]({'where':{'name':_0xf415('0x2a'),'userProfileId':_0x43287a[_0xf415('0x74')]},'raw':!![]})[_0xf415('0x27')](function(_0x2ea78f){if(_0x2ea78f&&_0x2ea78f['autoAssociation']===0x0){return db[_0xf415('0x2b')][_0xf415('0x57')]({'name':_0x482e7a[_0xf415('0x2e')],'resourceId':_0x482e7a['id'],'type':_0x2ea78f[_0xf415('0x2e')],'sectionId':_0x2ea78f['id']},{})['then'](function(){return _0x47d947;});}else{return _0x47d947;}})['catch'](function(_0x19c754){logger[_0xf415('0x2c')](_0xf415('0x79'),_0x19c754);throw _0x19c754;});}return _0x47d947;})[_0xf415('0x27')](respondWithResult(_0x44f640,null))[_0xf415('0x47')](handleError(_0x44f640,null));});_0x4dabdf[_0xf415('0x7a')]();}catch(_0x4ade7d){_0x44f640[_0xf415('0x1c')](0x1f4)[_0xf415('0x7b')](_0x4ade7d);}};exports[_0xf415('0x26')]=function(_0x329ec0,_0x2c2d11,_0x31bb4d){return db[_0xf415('0x31')]['find']({'where':{'id':_0x329ec0[_0xf415('0x49')]['id']}})[_0xf415('0x27')](handleEntityNotFound(_0x2c2d11,null))[_0xf415('0x27')](saveUpdates(_[_0xf415('0x7c')](_0x329ec0[_0xf415('0x73')],[_0xf415('0x2e'),_0xf415('0x7d')]),null))[_0xf415('0x27')](respondWithResult(_0x2c2d11,null))[_0xf415('0x47')](handleError(_0x2c2d11,null));};exports[_0xf415('0x7e')]=function(_0x4415f2,_0x5245b4,_0x10a0d0){return db[_0xf415('0x31')][_0xf415('0x4a')]({'where':{'id':_0x4415f2[_0xf415('0x49')]['id']}})[_0xf415('0x27')](function(_0x284914){if(_0x284914){return _0x284914[_0xf415('0x28')]();}})[_0xf415('0x27')](function(_0x179b56){var _0x150377=path[_0xf415('0x4f')](config[_0xf415('0x50')],_0xf415('0x5f'),util[_0xf415('0x55')]('%s.%s',_0x179b56[_0xf415('0x4c')],_0x179b56[_0xf415('0x7f')]));var _0x7f1c6b=path[_0xf415('0x4f')](config[_0xf415('0x50')],_0xf415('0x51'),util[_0xf415('0x55')]('%s.%s',_0x179b56[_0xf415('0x4c')],_0x179b56[_0xf415('0x4d')]));fs[_0xf415('0x64')](_0x150377);fs[_0xf415('0x64')](_0x7f1c6b);return _0x179b56;})[_0xf415('0x27')](function(_0x2ab9f0){if(_0x2ab9f0){return _0x5245b4[_0xf415('0x1c')](0xcc)[_0xf415('0x1b')]();}})['then'](handleEntityNotFound(_0x5245b4,null))[_0xf415('0x47')](handleError(_0x5245b4,null));}; \ No newline at end of file +var _0x75e1=['download','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','then','destroy','get','Sounds','UserProfileResource','error','stack','send','index','Sound','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find'];(function(_0x151762,_0x17691f){var _0x27f596=function(_0x4ca750){while(--_0x4ca750){_0x151762['push'](_0x151762['shift']());}};_0x27f596(++_0x17691f);}(_0x75e1,0x1b7));var _0x175e=function(_0x4ee881,_0x10ddc8){_0x4ee881=_0x4ee881-0x0;var _0x305f48=_0x75e1[_0x4ee881];return _0x305f48;};'use strict';var emlformat=require(_0x175e('0x0'));var rimraf=require(_0x175e('0x1'));var zipdir=require(_0x175e('0x2'));var jsonpatch=require(_0x175e('0x3'));var rp=require(_0x175e('0x4'));var moment=require(_0x175e('0x5'));var BPromise=require(_0x175e('0x6'));var Mustache=require(_0x175e('0x7'));var util=require(_0x175e('0x8'));var path=require(_0x175e('0x9'));var sox=require(_0x175e('0xa'));var csv=require(_0x175e('0xb'));var ejs=require(_0x175e('0xc'));var fs=require('fs');var fs_extra=require(_0x175e('0xd'));var _=require(_0x175e('0xe'));var squel=require(_0x175e('0xf'));var crypto=require(_0x175e('0x10'));var jsforce=require(_0x175e('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x175e('0xb'));var querystring=require(_0x175e('0x12'));var Papa=require(_0x175e('0x13'));var Redis=require('ioredis');var authService=require(_0x175e('0x14'));var qs=require(_0x175e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x175e('0x16'));var utils=require(_0x175e('0x17'));var config=require(_0x175e('0x18'));var licenseUtil=require(_0x175e('0x19'));var db=require(_0x175e('0x1a'))['db'];function respondWithStatusCode(_0x2a4b86,_0x58a4b7){_0x58a4b7=_0x58a4b7||0xcc;return function(_0x3fca83){if(_0x3fca83){return _0x2a4b86[_0x175e('0x1b')](_0x58a4b7);}return _0x2a4b86[_0x175e('0x1c')](_0x58a4b7)[_0x175e('0x1d')]();};}function respondWithResult(_0x578c35,_0x1fcbcf){_0x1fcbcf=_0x1fcbcf||0xc8;return function(_0x207fbd){if(_0x207fbd){return _0x578c35[_0x175e('0x1c')](_0x1fcbcf)[_0x175e('0x1e')](_0x207fbd);}};}function respondWithFilteredResult(_0x56579e,_0x23b212){return function(_0x3069f5){if(_0x3069f5){var _0x3dfb4c=typeof _0x23b212['offset']==='undefined'&&typeof _0x23b212['limit']===_0x175e('0x1f');var _0x32be50=_0x3069f5[_0x175e('0x20')];var _0x5467d8=_0x3dfb4c?0x0:_0x23b212[_0x175e('0x21')];var _0x434df1=_0x3dfb4c?_0x3069f5['count']:_0x23b212[_0x175e('0x21')]+_0x23b212[_0x175e('0x22')];var _0x3b3f57;if(_0x434df1>=_0x32be50){_0x434df1=_0x32be50;_0x3b3f57=0xc8;}else{_0x3b3f57=0xce;}_0x56579e[_0x175e('0x1c')](_0x3b3f57);return _0x56579e['set'](_0x175e('0x23'),_0x5467d8+'-'+_0x434df1+'/'+_0x32be50)[_0x175e('0x1e')](_0x3069f5);}return null;};}function patchUpdates(_0x4b3616){return function(_0x57169f){try{jsonpatch[_0x175e('0x24')](_0x57169f,_0x4b3616,!![]);}catch(_0x45d638){return BPromise[_0x175e('0x25')](_0x45d638);}return _0x57169f['save']();};}function saveUpdates(_0x2b35d5,_0x1692a3){return function(_0x12a0f9){if(_0x12a0f9){return _0x12a0f9['update'](_0x2b35d5)[_0x175e('0x26')](function(_0x2710f8){return _0x2710f8;});}return null;};}function removeEntity(_0x33287b,_0xf8c3d6){return function(_0x3ecd8f){if(_0x3ecd8f){return _0x3ecd8f[_0x175e('0x27')]()[_0x175e('0x26')](function(){var _0x3df812=_0x3ecd8f[_0x175e('0x28')]({'plain':!![]});var _0x1f781e=_0x175e('0x29');return db[_0x175e('0x2a')]['destroy']({'where':{'type':_0x1f781e,'resourceId':_0x3df812['id']}})[_0x175e('0x26')](function(){return _0x3ecd8f;});})['then'](function(){_0x33287b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16f80d,_0x37d080){return function(_0x475814){if(!_0x475814){_0x16f80d['sendStatus'](0x194);}return _0x475814;};}function handleError(_0x1cc38c,_0x5384d4){_0x5384d4=_0x5384d4||0x1f4;return function(_0x5c7441){logger[_0x175e('0x2b')](_0x5c7441[_0x175e('0x2c')]);if(_0x5c7441['name']){delete _0x5c7441['name'];}_0x1cc38c[_0x175e('0x1c')](_0x5384d4)[_0x175e('0x2d')](_0x5c7441);};}exports[_0x175e('0x2e')]=function(_0x3af968,_0x420dcc){var _0x3db183={},_0x432206={},_0x14390b={'count':0x0,'rows':[]};var _0x421ee3=_['map'](db[_0x175e('0x2f')]['rawAttributes'],function(_0x4c9259){return{'name':_0x4c9259['fieldName'],'type':_0x4c9259[_0x175e('0x30')]['key']};});_0x432206[_0x175e('0x31')]=_['map'](_0x421ee3,_0x175e('0x32'));_0x432206[_0x175e('0x33')]=_[_0x175e('0x34')](_0x3af968[_0x175e('0x33')]);_0x432206[_0x175e('0x35')]=_[_0x175e('0x36')](_0x432206[_0x175e('0x31')],_0x432206['query']);_0x3db183['attributes']=_[_0x175e('0x36')](_0x432206[_0x175e('0x31')],qs[_0x175e('0x37')](_0x3af968[_0x175e('0x33')][_0x175e('0x37')]));_0x3db183[_0x175e('0x38')]=_0x3db183[_0x175e('0x38')][_0x175e('0x39')]?_0x3db183[_0x175e('0x38')]:_0x432206[_0x175e('0x31')];if(!_0x3af968[_0x175e('0x33')][_0x175e('0x3a')](_0x175e('0x3b'))){_0x3db183[_0x175e('0x22')]=qs[_0x175e('0x22')](_0x3af968[_0x175e('0x33')][_0x175e('0x22')]);_0x3db183['offset']=qs[_0x175e('0x21')](_0x3af968[_0x175e('0x33')][_0x175e('0x21')]);}_0x3db183[_0x175e('0x3c')]=qs[_0x175e('0x3d')](_0x3af968['query'][_0x175e('0x3d')]);_0x3db183['where']=qs[_0x175e('0x35')](_[_0x175e('0x3e')](_0x3af968[_0x175e('0x33')],_0x432206['filters']),_0x421ee3);if(_0x3af968[_0x175e('0x33')][_0x175e('0x3f')]){_0x3db183[_0x175e('0x40')]=_[_0x175e('0x41')](_0x3db183[_0x175e('0x40')],{'$or':_[_0x175e('0x42')](_0x421ee3,function(_0x28fdd2){if(_0x28fdd2[_0x175e('0x30')]!==_0x175e('0x43')){var _0x1b0f73={};_0x1b0f73[_0x28fdd2[_0x175e('0x32')]]={'$like':'%'+_0x3af968['query'][_0x175e('0x3f')]+'%'};return _0x1b0f73;}})});}_0x3db183=_[_0x175e('0x41')]({},_0x3db183,_0x3af968[_0x175e('0x44')]);var _0x5bc0d1={'where':_0x3db183[_0x175e('0x40')]};return db[_0x175e('0x2f')]['count'](_0x5bc0d1)[_0x175e('0x26')](function(_0x1ac3bc){_0x14390b[_0x175e('0x20')]=_0x1ac3bc;if(_0x3af968[_0x175e('0x33')][_0x175e('0x45')]){_0x3db183['include']=[{'all':!![]}];}return db['Sound'][_0x175e('0x46')](_0x3db183);})[_0x175e('0x26')](function(_0xd36ad1){_0x14390b[_0x175e('0x47')]=_0xd36ad1;return _0x14390b;})[_0x175e('0x26')](respondWithFilteredResult(_0x420dcc,_0x3db183))[_0x175e('0x48')](handleError(_0x420dcc,null));};exports['show']=function(_0x3b1271,_0x58e4d1){var _0x3097bf={'raw':!![],'where':{'id':_0x3b1271[_0x175e('0x49')]['id']}},_0x2bd1ee={};_0x2bd1ee[_0x175e('0x31')]=_[_0x175e('0x34')](db[_0x175e('0x2f')][_0x175e('0x4a')]);_0x2bd1ee[_0x175e('0x33')]=_[_0x175e('0x34')](_0x3b1271[_0x175e('0x33')]);_0x2bd1ee[_0x175e('0x35')]=_[_0x175e('0x36')](_0x2bd1ee[_0x175e('0x31')],_0x2bd1ee[_0x175e('0x33')]);_0x3097bf[_0x175e('0x38')]=_[_0x175e('0x36')](_0x2bd1ee[_0x175e('0x31')],qs[_0x175e('0x37')](_0x3b1271[_0x175e('0x33')][_0x175e('0x37')]));_0x3097bf[_0x175e('0x38')]=_0x3097bf[_0x175e('0x38')][_0x175e('0x39')]?_0x3097bf[_0x175e('0x38')]:_0x2bd1ee['model'];if(_0x3b1271[_0x175e('0x33')]['includeAll']){_0x3097bf[_0x175e('0x4b')]=[{'all':!![]}];}_0x3097bf=_[_0x175e('0x41')]({},_0x3097bf,_0x3b1271[_0x175e('0x44')]);return db['Sound'][_0x175e('0x4c')](_0x3097bf)[_0x175e('0x26')](handleEntityNotFound(_0x58e4d1,null))[_0x175e('0x26')](respondWithResult(_0x58e4d1,null))[_0x175e('0x48')](handleError(_0x58e4d1,null));};exports[_0x175e('0x4d')]=function(_0x3af412,_0x1dabc5,_0xe2c1b2){return db[_0x175e('0x2f')]['find']({'where':{'id':_0x3af412['params']['id']},'attributes':[_0x175e('0x32'),'save_name',_0x175e('0x4e')],'raw':!![]})[_0x175e('0x26')](handleEntityNotFound(_0x1dabc5,null))[_0x175e('0x26')](function(_0x1ad704){if(_0x1ad704){if(!fs[_0x175e('0x4f')](path[_0x175e('0x50')](config[_0x175e('0x51')],_0x175e('0x52'),_0x1ad704[_0x175e('0x53')]+'.'+_0x1ad704[_0x175e('0x4e')]))){throw new db[(_0x175e('0x54'))][(_0x175e('0x55'))](_0x175e('0x56'));}return _0x1dabc5[_0x175e('0x4d')](path[_0x175e('0x50')](config['root'],_0x175e('0x52'),util[_0x175e('0x57')](_0x175e('0x58'),_0x1ad704[_0x175e('0x53')],_0x1ad704['converted_format'])),util['format'](_0x175e('0x58'),_0x1ad704[_0x175e('0x32')],_0x1ad704['converted_format']));}return null;})['catch'](handleError(_0x1dabc5,null));};exports['create']=function(_0x209ef3,_0x4f064f,_0x4bfe65){var _0x1a83d1={'name':path[_0x175e('0x59')](_0x209ef3[_0x175e('0x5a')][_0x175e('0x5b')],path[_0x175e('0x5c')](_0x209ef3[_0x175e('0x5a')]['originalname'])),'save_name':path[_0x175e('0x59')](_0x209ef3[_0x175e('0x5a')][_0x175e('0x5d')],path['extname'](_0x209ef3[_0x175e('0x5a')][_0x175e('0x5d')])),'original_format':path[_0x175e('0x5c')](_0x209ef3[_0x175e('0x5a')][_0x175e('0x5b')])[_0x175e('0x5e')](0x1),'converted_format':_0x175e('0x5f')};var _0x3c39d7=path[_0x175e('0x50')](config['root'],_0x175e('0x60'),_0x209ef3[_0x175e('0x5a')][_0x175e('0x5d')]);var _0x42c780=path[_0x175e('0x50')](config[_0x175e('0x51')],'server/files/sounds/converted',util[_0x175e('0x57')](_0x175e('0x58'),path[_0x175e('0x59')](_0x209ef3['file'][_0x175e('0x5d')],path[_0x175e('0x5c')](_0x209ef3['file'][_0x175e('0x5d')])),_0x1a83d1[_0x175e('0x4e')]));logger['info'](_0x175e('0x61'),_0x3c39d7);logger[_0x175e('0x62')](_0x175e('0x63'),_0x42c780);try{fs[_0x175e('0x64')](_0x3c39d7,parseInt('0777',0x8));var _0x6d3e26=sox['transcode'](_0x3c39d7,_0x42c780,{'sampleRate':0x1f40,'format':_0x175e('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x6d3e26['on'](_0x175e('0x2b'),function(_0xaf89f3){fs[_0x175e('0x65')](_0x3c39d7);_0x4f064f['status'](0x1f4)[_0x175e('0x2d')](_0xaf89f3);});_0x6d3e26['on'](_0x175e('0x66'),function(_0x10be55){_0x1a83d1[_0x175e('0x67')]=isNaN(_0x10be55[_0x175e('0x68')])?null:_0x10be55[_0x175e('0x68')]*0x3e8;_0x1a83d1[_0x175e('0x69')]=isNaN(_0x10be55[_0x175e('0x6a')])?null:_0x10be55[_0x175e('0x6a')];_0x1a83d1[_0x175e('0x6b')]=isNaN(_0x10be55['channelCount'])?null:_0x10be55[_0x175e('0x6c')];_0x1a83d1[_0x175e('0x6d')]=isNaN(_0x10be55[_0x175e('0x6e')])?null:_0x10be55['bitRate'];_0x1a83d1['original_sampleRate']=isNaN(_0x10be55['sampleRate'])?null:_0x10be55[_0x175e('0x6f')];});_0x6d3e26['on'](_0x175e('0x70'),function(_0x186d63){_0x1a83d1[_0x175e('0x71')]=isNaN(_0x186d63[_0x175e('0x68')])?null:_0x186d63[_0x175e('0x68')]*0x3e8;_0x1a83d1[_0x175e('0x72')]=isNaN(_0x186d63['sampleCount'])?null:_0x186d63[_0x175e('0x6a')];_0x1a83d1[_0x175e('0x73')]=isNaN(_0x186d63[_0x175e('0x6c')])?null:_0x186d63[_0x175e('0x6c')];_0x1a83d1[_0x175e('0x74')]=isNaN(_0x186d63[_0x175e('0x6e')])?null:_0x186d63[_0x175e('0x6e')];_0x1a83d1[_0x175e('0x75')]=isNaN(_0x186d63[_0x175e('0x6f')])?null:_0x186d63[_0x175e('0x6f')];});_0x6d3e26['on']('end',function(){fs[_0x175e('0x64')](_0x42c780,parseInt('0777',0x8));return db[_0x175e('0x2f')][_0x175e('0x76')](_0x1a83d1)[_0x175e('0x26')](function(_0x48799f){var _0xe4597a={'role':_0x209ef3['body'][_0x175e('0x77')],'userProfileId':_0x209ef3[_0x175e('0x78')][_0x175e('0x79')]};if(!_0xe4597a)throw new Error(_0x175e('0x7a'));if(_0xe4597a[_0x175e('0x77')]===_0x175e('0x7b')){var _0x5e607d=_0x48799f[_0x175e('0x28')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Sounds','userProfileId':_0xe4597a['userProfileId']},'raw':!![]})['then'](function(_0x416df9){if(_0x416df9&&_0x416df9[_0x175e('0x7c')]===0x0){return db[_0x175e('0x2a')][_0x175e('0x76')]({'name':_0x5e607d['name'],'resourceId':_0x5e607d['id'],'type':_0x416df9[_0x175e('0x32')],'sectionId':_0x416df9['id']},{})[_0x175e('0x26')](function(){return _0x48799f;});}else{return _0x48799f;}})[_0x175e('0x48')](function(_0x43443a){logger[_0x175e('0x2b')](_0x175e('0x7d'),_0x43443a);throw _0x43443a;});}return _0x48799f;})[_0x175e('0x26')](respondWithResult(_0x4f064f,null))[_0x175e('0x48')](handleError(_0x4f064f,null));});_0x6d3e26[_0x175e('0x7e')]();}catch(_0x434632){_0x4f064f['status'](0x1f4)[_0x175e('0x2d')](_0x434632);}};exports['update']=function(_0x366e87,_0x2ed4a4,_0x1a6282){return db[_0x175e('0x2f')]['find']({'where':{'id':_0x366e87[_0x175e('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ed4a4,null))[_0x175e('0x26')](saveUpdates(_['pick'](_0x366e87[_0x175e('0x78')],[_0x175e('0x32'),_0x175e('0x7f')]),null))[_0x175e('0x26')](respondWithResult(_0x2ed4a4,null))[_0x175e('0x48')](handleError(_0x2ed4a4,null));};exports['delete']=function(_0x4ecad1,_0x448ae4,_0x5c5b04){return db[_0x175e('0x2f')][_0x175e('0x4c')]({'where':{'id':_0x4ecad1[_0x175e('0x49')]['id']}})[_0x175e('0x26')](function(_0x5dbfcb){if(_0x5dbfcb){return _0x5dbfcb['destroy']();}})[_0x175e('0x26')](function(_0xcbf2d6){var _0x208835=path[_0x175e('0x50')](config['root'],'server/files/sounds/original',util[_0x175e('0x57')]('%s.%s',_0xcbf2d6['save_name'],_0xcbf2d6[_0x175e('0x80')]));var _0x8f22a6=path[_0x175e('0x50')](config[_0x175e('0x51')],_0x175e('0x52'),util[_0x175e('0x57')](_0x175e('0x58'),_0xcbf2d6[_0x175e('0x53')],_0xcbf2d6[_0x175e('0x4e')]));fs[_0x175e('0x65')](_0x208835);fs[_0x175e('0x65')](_0x8f22a6);return _0xcbf2d6;})['then'](function(_0x3ccaf9){if(_0x3ccaf9){return _0x448ae4[_0x175e('0x1c')](0xcc)[_0x175e('0x1d')]();}})[_0x175e('0x26')](handleEntityNotFound(_0x448ae4,null))[_0x175e('0x48')](handleError(_0x448ae4,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 369622e..bfdc28f 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 _0xcab9=['request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','Sound','lodash','../../config/logger','api','moment','bluebird'];(function(_0x28a7db,_0x27bd8f){var _0x47a6a5=function(_0x43bb98){while(--_0x43bb98){_0x28a7db['push'](_0x28a7db['shift']());}};_0x47a6a5(++_0x27bd8f);}(_0xcab9,0x8b));var _0x9cab=function(_0x22074d,_0x33df85){_0x22074d=_0x22074d-0x0;var _0x3a24ce=_0xcab9[_0x22074d];return _0x3a24ce;};'use strict';var _=require(_0x9cab('0x0'));var util=require('util');var logger=require(_0x9cab('0x1'))(_0x9cab('0x2'));var moment=require(_0x9cab('0x3'));var BPromise=require(_0x9cab('0x4'));var rp=require(_0x9cab('0x5'));var fs=require('fs');var path=require(_0x9cab('0x6'));var rimraf=require(_0x9cab('0x7'));var config=require(_0x9cab('0x8'));var attributes=require(_0x9cab('0x9'));module[_0x9cab('0xa')]=function(_0x1ded95,_0x1c8915){return _0x1ded95['define'](_0x9cab('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f9f=['rimraf','../../config/environment','define','Sound','tools_sounds','lodash','util','moment','bluebird','request-promise','path'];(function(_0x14900c,_0x401f5d){var _0x5783fa=function(_0xf98a5c){while(--_0xf98a5c){_0x14900c['push'](_0x14900c['shift']());}};_0x5783fa(++_0x401f5d);}(_0x8f9f,0x139));var _0xf8f9=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x8f9f[_0x9c2427];return _0x51984f;};'use strict';var _=require(_0xf8f9('0x0'));var util=require(_0xf8f9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf8f9('0x2'));var BPromise=require(_0xf8f9('0x3'));var rp=require(_0xf8f9('0x4'));var fs=require('fs');var path=require(_0xf8f9('0x5'));var rimraf=require(_0xf8f9('0x6'));var config=require(_0xf8f9('0x7'));var attributes=require('./sound.attributes');module['exports']=function(_0x3684bd,_0x4a3e08){return _0x3684bd[_0xf8f9('0x8')](_0xf8f9('0x9'),attributes,{'tableName':_0xf8f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 1d107b2..3ad944f 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 _0x8b14=['Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','raw','options','where','attributes','include','model','map','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x275863,_0x429a19){var _0x31a24e=function(_0x1f7eff){while(--_0x1f7eff){_0x275863['push'](_0x275863['shift']());}};_0x31a24e(++_0x429a19);}(_0x8b14,0xb6));var _0x48b1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8b14[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x48b1('0x0'));var util=require(_0x48b1('0x1'));var moment=require(_0x48b1('0x2'));var BPromise=require(_0x48b1('0x3'));var rs=require(_0x48b1('0x4'));var fs=require('fs');var Redis=require(_0x48b1('0x5'));var db=require(_0x48b1('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x48b1('0x7'));var config=require(_0x48b1('0x8'));var jayson=require(_0x48b1('0x9'));var client=jayson[_0x48b1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e2689,_0x21076a,_0x3120b7){return new BPromise(function(_0x2c2b4d,_0x35c26a){return client[_0x48b1('0xb')](_0x1e2689,_0x3120b7)[_0x48b1('0xc')](function(_0x4c4630){logger['info'](_0x48b1('0xd'),_0x21076a,_0x48b1('0xe'));logger[_0x48b1('0xf')](_0x48b1('0x10'),_0x21076a,'request\x20sent',JSON[_0x48b1('0x11')](_0x4c4630));if(_0x4c4630[_0x48b1('0x12')]){if(_0x4c4630[_0x48b1('0x12')][_0x48b1('0x13')]===0x1f4){logger[_0x48b1('0x12')](_0x48b1('0xd'),_0x21076a,_0x4c4630['error'][_0x48b1('0x14')]);return _0x35c26a(_0x4c4630[_0x48b1('0x12')]['message']);}logger[_0x48b1('0x12')](_0x48b1('0xd'),_0x21076a,_0x4c4630[_0x48b1('0x12')][_0x48b1('0x14')]);return _0x2c2b4d(_0x4c4630[_0x48b1('0x12')][_0x48b1('0x14')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x21076a,_0x48b1('0xe'));_0x2c2b4d(_0x4c4630[_0x48b1('0x15')][_0x48b1('0x14')]);}})[_0x48b1('0x16')](function(_0x4de1eb){logger['error'](_0x48b1('0xd'),_0x21076a,_0x4de1eb);_0x35c26a(_0x4de1eb);});});}exports[_0x48b1('0x17')]=function(_0x1c9777){var _0x373e0a=this;return new Promise(function(_0xa86bfb,_0x1bbef2){return db[_0x48b1('0x18')]['find']({'raw':_0x1c9777['options']?_0x1c9777['options'][_0x48b1('0x19')]===undefined?!![]:![]:!![],'where':_0x1c9777['options']?_0x1c9777[_0x48b1('0x1a')][_0x48b1('0x1b')]||null:null,'attributes':_0x1c9777['options']?_0x1c9777['options'][_0x48b1('0x1c')]||null:null,'include':_0x1c9777[_0x48b1('0x1a')]?_0x1c9777['options'][_0x48b1('0x1d')]?_['map'](_0x1c9777[_0x48b1('0x1a')][_0x48b1('0x1d')],function(_0x58d1db){return{'model':db[_0x58d1db[_0x48b1('0x1e')]],'as':_0x58d1db['as'],'attributes':_0x58d1db[_0x48b1('0x1c')],'include':_0x58d1db[_0x48b1('0x1d')]?_['map'](_0x58d1db[_0x48b1('0x1d')],function(_0x166112){return{'model':db[_0x166112['model']],'as':_0x166112['as'],'attributes':_0x166112['attributes'],'include':_0x166112[_0x48b1('0x1d')]?_[_0x48b1('0x1f')](_0x166112[_0x48b1('0x1d')],function(_0xe5a0ef){return{'model':db[_0xe5a0ef[_0x48b1('0x1e')]],'as':_0xe5a0ef['as'],'attributes':_0xe5a0ef[_0x48b1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x48b1('0xc')](function(_0x4227a0){logger[_0x48b1('0x20')](_0x48b1('0x17'),_0x1c9777);logger[_0x48b1('0xf')]('ShowSound',_0x1c9777,JSON[_0x48b1('0x11')](_0x4227a0));_0xa86bfb(_0x4227a0);})[_0x48b1('0x16')](function(_0x59c490){logger['error'](_0x48b1('0x17'),_0x59c490['message'],_0x1c9777);_0x1bbef2(_0x373e0a[_0x48b1('0x12')](0x1f4,_0x59c490[_0x48b1('0x14')]));});});}; \ No newline at end of file +var _0x909d=['moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','Sound','find','options','raw','where','attributes','map','include','model','ShowSound','catch','lodash','util'];(function(_0x2b10b5,_0x5c1f2e){var _0x545669=function(_0x4208be){while(--_0x4208be){_0x2b10b5['push'](_0x2b10b5['shift']());}};_0x545669(++_0x5c1f2e);}(_0x909d,0x15e));var _0xd909=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x909d[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0xd909('0x0'));var util=require(_0xd909('0x1'));var moment=require(_0xd909('0x2'));var BPromise=require('bluebird');var rs=require(_0xd909('0x3'));var fs=require('fs');var Redis=require(_0xd909('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd909('0x5'));var logger=require('../../config/logger')(_0xd909('0x6'));var config=require(_0xd909('0x7'));var jayson=require(_0xd909('0x8'));var client=jayson[_0xd909('0x9')][_0xd909('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a3135,_0x32ad12,_0x4a0336){return new BPromise(function(_0x282428,_0x2a82c6){return client[_0xd909('0xb')](_0x2a3135,_0x4a0336)[_0xd909('0xc')](function(_0x3359ff){logger['info'](_0xd909('0xd'),_0x32ad12,'request\x20sent');logger[_0xd909('0xe')](_0xd909('0xf'),_0x32ad12,_0xd909('0x10'),JSON[_0xd909('0x11')](_0x3359ff));if(_0x3359ff[_0xd909('0x12')]){if(_0x3359ff[_0xd909('0x12')]['code']===0x1f4){logger[_0xd909('0x12')](_0xd909('0xd'),_0x32ad12,_0x3359ff[_0xd909('0x12')][_0xd909('0x13')]);return _0x2a82c6(_0x3359ff['error'][_0xd909('0x13')]);}logger[_0xd909('0x12')](_0xd909('0xd'),_0x32ad12,_0x3359ff['error'][_0xd909('0x13')]);return _0x282428(_0x3359ff[_0xd909('0x12')][_0xd909('0x13')]);}else{logger[_0xd909('0x14')](_0xd909('0xd'),_0x32ad12,'request\x20sent');_0x282428(_0x3359ff['result'][_0xd909('0x13')]);}})['catch'](function(_0x29b37e){logger['error']('Sound,\x20%s,\x20%s',_0x32ad12,_0x29b37e);_0x2a82c6(_0x29b37e);});});}exports['ShowSound']=function(_0x45a7c9){var _0x1a9ead=this;return new Promise(function(_0x52712f,_0x317c2b){return db[_0xd909('0x15')][_0xd909('0x16')]({'raw':_0x45a7c9['options']?_0x45a7c9[_0xd909('0x17')][_0xd909('0x18')]===undefined?!![]:![]:!![],'where':_0x45a7c9['options']?_0x45a7c9[_0xd909('0x17')][_0xd909('0x19')]||null:null,'attributes':_0x45a7c9[_0xd909('0x17')]?_0x45a7c9['options'][_0xd909('0x1a')]||null:null,'include':_0x45a7c9[_0xd909('0x17')]?_0x45a7c9[_0xd909('0x17')]['include']?_[_0xd909('0x1b')](_0x45a7c9[_0xd909('0x17')][_0xd909('0x1c')],function(_0x2ab17e){return{'model':db[_0x2ab17e[_0xd909('0x1d')]],'as':_0x2ab17e['as'],'attributes':_0x2ab17e[_0xd909('0x1a')],'include':_0x2ab17e[_0xd909('0x1c')]?_[_0xd909('0x1b')](_0x2ab17e[_0xd909('0x1c')],function(_0x2903de){return{'model':db[_0x2903de['model']],'as':_0x2903de['as'],'attributes':_0x2903de[_0xd909('0x1a')],'include':_0x2903de[_0xd909('0x1c')]?_['map'](_0x2903de[_0xd909('0x1c')],function(_0x26cc8f){return{'model':db[_0x26cc8f[_0xd909('0x1d')]],'as':_0x26cc8f['as'],'attributes':_0x26cc8f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1780a6){logger[_0xd909('0x14')](_0xd909('0x1e'),_0x45a7c9);logger[_0xd909('0xe')]('ShowSound',_0x45a7c9,JSON[_0xd909('0x11')](_0x1780a6));_0x52712f(_0x1780a6);})[_0xd909('0x1f')](function(_0x1ca577){logger[_0xd909('0x12')]('ShowSound',_0x1ca577['message'],_0x45a7c9);_0x317c2b(_0x1a9ead['error'](0x1f4,_0x1ca577[_0xd909('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 6a701dd..43a25a9 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(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x34c27a,_0x320c95){_0x34c27a=_0x34c27a-0x0;var _0x594d84=_0x9ffd[_0x34c27a];return _0x594d84;};'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 _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x3d83ac,_0x1d0135){var _0x299760=function(_0x40c1a3){while(--_0x40c1a3){_0x3d83ac['push'](_0x3d83ac['shift']());}};_0x299760(++_0x1d0135);}(_0xda2d,0x102));var _0xdda2=function(_0x30a273,_0x1d8d6e){_0x30a273=_0x30a273-0x0;var _0xb0812e=_0xda2d[_0x30a273];return _0xb0812e;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 110d47f..682b569 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 _0xe277=['out','sequelize','exports','STRING','TEXT'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xe277,0x119));var _0x7e27=function(_0x206c97,_0x1180b0){_0x206c97=_0x206c97-0x0;var _0x3244d7=_0xe277[_0x206c97];return _0x3244d7;};'use strict';var Sequelize=require(_0x7e27('0x0'));module[_0x7e27('0x1')]={'uniqueid':{'type':Sequelize[_0x7e27('0x2')]},'body':{'type':Sequelize[_0x7e27('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x7e27('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7e27('0x3')]}}; \ No newline at end of file +var _0xc36d=['exports','TEXT','medium','ENUM','out','sequelize'];(function(_0x590c1b,_0x4961c3){var _0xd53864=function(_0x43a8cd){while(--_0x43a8cd){_0x590c1b['push'](_0x590c1b['shift']());}};_0xd53864(++_0x4961c3);}(_0xc36d,0x125));var _0xdc36=function(_0x5e0bfe,_0x747312){_0x5e0bfe=_0x5e0bfe-0x0;var _0x6468b8=_0xc36d[_0x5e0bfe];return _0x6468b8;};'use strict';var Sequelize=require(_0xdc36('0x0'));module[_0xdc36('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xdc36('0x2')](_0xdc36('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xdc36('0x4')]('in',_0xdc36('0x5')),'defaultValue':_0xdc36('0x5'),'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 5f0832e..64078a4 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 _0x8d62=['filter','merge','VIRTUAL','include','findAll','rows','catch','params','fields','includeAll','options','find','update','body','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','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','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8d62,0xf8));var _0x28d6=function(_0x51547b,_0x55ac59){_0x51547b=_0x51547b-0x0;var _0x196f6e=_0x8d62[_0x51547b];return _0x196f6e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28d6('0x0'));var zipdir=require(_0x28d6('0x1'));var jsonpatch=require(_0x28d6('0x2'));var rp=require(_0x28d6('0x3'));var moment=require(_0x28d6('0x4'));var BPromise=require(_0x28d6('0x5'));var Mustache=require(_0x28d6('0x6'));var util=require(_0x28d6('0x7'));var path=require(_0x28d6('0x8'));var sox=require(_0x28d6('0x9'));var csv=require(_0x28d6('0xa'));var ejs=require(_0x28d6('0xb'));var fs=require('fs');var fs_extra=require(_0x28d6('0xc'));var _=require(_0x28d6('0xd'));var squel=require('squel');var crypto=require(_0x28d6('0xe'));var jsforce=require(_0x28d6('0xf'));var deskjs=require(_0x28d6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x28d6('0x11'));var Papa=require('papaparse');var Redis=require(_0x28d6('0x12'));var authService=require(_0x28d6('0x13'));var qs=require(_0x28d6('0x14'));var as=require(_0x28d6('0x15'));var hardwareService=require(_0x28d6('0x16'));var logger=require('../../config/logger')(_0x28d6('0x17'));var utils=require(_0x28d6('0x18'));var config=require(_0x28d6('0x19'));var licenseUtil=require(_0x28d6('0x1a'));var db=require(_0x28d6('0x1b'))['db'];function respondWithStatusCode(_0x240839,_0x2c29bd){_0x2c29bd=_0x2c29bd||0xcc;return function(_0x43d460){if(_0x43d460){return _0x240839['sendStatus'](_0x2c29bd);}return _0x240839[_0x28d6('0x1c')](_0x2c29bd)[_0x28d6('0x1d')]();};}function respondWithResult(_0x33ba38,_0x549b39){_0x549b39=_0x549b39||0xc8;return function(_0x1621ee){if(_0x1621ee){return _0x33ba38['status'](_0x549b39)[_0x28d6('0x1e')](_0x1621ee);}};}function respondWithFilteredResult(_0x425ffb,_0x4b82e2){return function(_0x1881a8){if(_0x1881a8){var _0x159d2a=typeof _0x4b82e2[_0x28d6('0x1f')]===_0x28d6('0x20')&&typeof _0x4b82e2[_0x28d6('0x21')]==='undefined';var _0x35317d=_0x1881a8['count'];var _0x44db1a=_0x159d2a?0x0:_0x4b82e2[_0x28d6('0x1f')];var _0x2824bd=_0x159d2a?_0x1881a8[_0x28d6('0x22')]:_0x4b82e2[_0x28d6('0x1f')]+_0x4b82e2[_0x28d6('0x21')];var _0x2d521d;if(_0x2824bd>=_0x35317d){_0x2824bd=_0x35317d;_0x2d521d=0xc8;}else{_0x2d521d=0xce;}_0x425ffb['status'](_0x2d521d);return _0x425ffb[_0x28d6('0x23')](_0x28d6('0x24'),_0x44db1a+'-'+_0x2824bd+'/'+_0x35317d)['json'](_0x1881a8);}return null;};}function patchUpdates(_0x26362e){return function(_0x24f764){try{jsonpatch[_0x28d6('0x25')](_0x24f764,_0x26362e,!![]);}catch(_0x252c1d){return BPromise[_0x28d6('0x26')](_0x252c1d);}return _0x24f764[_0x28d6('0x27')]();};}function saveUpdates(_0x376a64,_0x506be6){return function(_0xcf8fa0){if(_0xcf8fa0){return _0xcf8fa0['update'](_0x376a64)[_0x28d6('0x28')](function(_0x2288eb){return _0x2288eb;});}return null;};}function removeEntity(_0x455dd6,_0x3d128b){return function(_0x26809d){if(_0x26809d){return _0x26809d[_0x28d6('0x29')]()['then'](function(){_0x455dd6['status'](0xcc)[_0x28d6('0x1d')]();});}};}function handleEntityNotFound(_0x2fb6f7,_0x31aa98){return function(_0x210bfc){if(!_0x210bfc){_0x2fb6f7['sendStatus'](0x194);}return _0x210bfc;};}function handleError(_0x18edec,_0x2c4594){_0x2c4594=_0x2c4594||0x1f4;return function(_0x2b9862){logger[_0x28d6('0x2a')](_0x2b9862[_0x28d6('0x2b')]);if(_0x2b9862[_0x28d6('0x2c')]){delete _0x2b9862[_0x28d6('0x2c')];}_0x18edec[_0x28d6('0x1c')](_0x2c4594)[_0x28d6('0x2d')](_0x2b9862);};}exports[_0x28d6('0x2e')]=function(_0x28aaa6,_0x1f2298){var _0x30e05c={},_0x3ba89f={},_0x4b140e={'count':0x0,'rows':[]};var _0x48ada1=_[_0x28d6('0x2f')](db[_0x28d6('0x30')][_0x28d6('0x31')],function(_0x124404){return{'name':_0x124404[_0x28d6('0x32')],'type':_0x124404[_0x28d6('0x33')]['key']};});_0x3ba89f[_0x28d6('0x34')]=_['map'](_0x48ada1,_0x28d6('0x2c'));_0x3ba89f['query']=_[_0x28d6('0x35')](_0x28aaa6[_0x28d6('0x36')]);_0x3ba89f[_0x28d6('0x37')]=_[_0x28d6('0x38')](_0x3ba89f[_0x28d6('0x34')],_0x3ba89f['query']);_0x30e05c['attributes']=_[_0x28d6('0x38')](_0x3ba89f[_0x28d6('0x34')],qs['fields'](_0x28aaa6[_0x28d6('0x36')]['fields']));_0x30e05c[_0x28d6('0x39')]=_0x30e05c['attributes'][_0x28d6('0x3a')]?_0x30e05c['attributes']:_0x3ba89f[_0x28d6('0x34')];if(!_0x28aaa6[_0x28d6('0x36')][_0x28d6('0x3b')](_0x28d6('0x3c'))){_0x30e05c[_0x28d6('0x21')]=qs[_0x28d6('0x21')](_0x28aaa6[_0x28d6('0x36')]['limit']);_0x30e05c[_0x28d6('0x1f')]=qs[_0x28d6('0x1f')](_0x28aaa6[_0x28d6('0x36')][_0x28d6('0x1f')]);}_0x30e05c['order']=qs[_0x28d6('0x3d')](_0x28aaa6[_0x28d6('0x36')][_0x28d6('0x3d')]);_0x30e05c[_0x28d6('0x3e')]=qs['filters'](_[_0x28d6('0x3f')](_0x28aaa6[_0x28d6('0x36')],_0x3ba89f[_0x28d6('0x37')]),_0x48ada1);if(_0x28aaa6[_0x28d6('0x36')][_0x28d6('0x40')]){_0x30e05c[_0x28d6('0x3e')]=_[_0x28d6('0x41')](_0x30e05c[_0x28d6('0x3e')],{'$or':_[_0x28d6('0x2f')](_0x48ada1,function(_0x163a10){if(_0x163a10[_0x28d6('0x33')]!==_0x28d6('0x42')){var _0x286b3d={};_0x286b3d[_0x163a10[_0x28d6('0x2c')]]={'$like':'%'+_0x28aaa6[_0x28d6('0x36')][_0x28d6('0x40')]+'%'};return _0x286b3d;}})});}_0x30e05c=_['merge']({},_0x30e05c,_0x28aaa6['options']);var _0x4ea872={'where':_0x30e05c[_0x28d6('0x3e')]};return db['SquareMessage']['count'](_0x4ea872)[_0x28d6('0x28')](function(_0x4ea383){_0x4b140e[_0x28d6('0x22')]=_0x4ea383;if(_0x28aaa6[_0x28d6('0x36')]['includeAll']){_0x30e05c[_0x28d6('0x43')]=[{'all':!![]}];}return db[_0x28d6('0x30')][_0x28d6('0x44')](_0x30e05c);})[_0x28d6('0x28')](function(_0x3388dc){_0x4b140e[_0x28d6('0x45')]=_0x3388dc;return _0x4b140e;})[_0x28d6('0x28')](respondWithFilteredResult(_0x1f2298,_0x30e05c))[_0x28d6('0x46')](handleError(_0x1f2298,null));};exports['show']=function(_0x1bc066,_0x3acc76){var _0x553d13={'raw':!![],'where':{'id':_0x1bc066[_0x28d6('0x47')]['id']}},_0x25ac32={};_0x25ac32[_0x28d6('0x34')]=_['keys'](db[_0x28d6('0x30')][_0x28d6('0x31')]);_0x25ac32[_0x28d6('0x36')]=_[_0x28d6('0x35')](_0x1bc066['query']);_0x25ac32[_0x28d6('0x37')]=_[_0x28d6('0x38')](_0x25ac32[_0x28d6('0x34')],_0x25ac32['query']);_0x553d13[_0x28d6('0x39')]=_[_0x28d6('0x38')](_0x25ac32[_0x28d6('0x34')],qs[_0x28d6('0x48')](_0x1bc066['query'][_0x28d6('0x48')]));_0x553d13[_0x28d6('0x39')]=_0x553d13[_0x28d6('0x39')][_0x28d6('0x3a')]?_0x553d13[_0x28d6('0x39')]:_0x25ac32['model'];if(_0x1bc066[_0x28d6('0x36')][_0x28d6('0x49')]){_0x553d13[_0x28d6('0x43')]=[{'all':!![]}];}_0x553d13=_[_0x28d6('0x41')]({},_0x553d13,_0x1bc066[_0x28d6('0x4a')]);return db[_0x28d6('0x30')][_0x28d6('0x4b')](_0x553d13)[_0x28d6('0x28')](handleEntityNotFound(_0x3acc76,null))[_0x28d6('0x28')](respondWithResult(_0x3acc76,null))[_0x28d6('0x46')](handleError(_0x3acc76,null));};exports['create']=function(_0x4c8edb,_0x261c01){return db['SquareMessage']['create'](_0x4c8edb['body'],{})[_0x28d6('0x28')](respondWithResult(_0x261c01,0xc9))['catch'](handleError(_0x261c01,null));};exports[_0x28d6('0x4c')]=function(_0x543f58,_0x1cfe1f){if(_0x543f58[_0x28d6('0x4d')]['id']){delete _0x543f58[_0x28d6('0x4d')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x543f58['params']['id']}})[_0x28d6('0x28')](handleEntityNotFound(_0x1cfe1f,null))[_0x28d6('0x28')](saveUpdates(_0x543f58['body'],null))[_0x28d6('0x28')](respondWithResult(_0x1cfe1f,null))[_0x28d6('0x46')](handleError(_0x1cfe1f,null));};exports[_0x28d6('0x29')]=function(_0x27e8e6,_0x1d3d61){return db[_0x28d6('0x30')][_0x28d6('0x4b')]({'where':{'id':_0x27e8e6[_0x28d6('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d3d61,null))[_0x28d6('0x28')](removeEntity(_0x1d3d61,null))[_0x28d6('0x46')](handleError(_0x1d3d61,null));}; \ No newline at end of file +var _0x3eaf=['key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','send','index','SquareMessage','rawAttributes','fieldName','type'];(function(_0x4d6fc9,_0x32fb02){var _0x412379=function(_0x5c1260){while(--_0x5c1260){_0x4d6fc9['push'](_0x4d6fc9['shift']());}};_0x412379(++_0x32fb02);}(_0x3eaf,0x190));var _0xf3ea=function(_0x54c049,_0x21d825){_0x54c049=_0x54c049-0x0;var _0x937b0b=_0x3eaf[_0x54c049];return _0x937b0b;};'use strict';var emlformat=require(_0xf3ea('0x0'));var rimraf=require(_0xf3ea('0x1'));var zipdir=require(_0xf3ea('0x2'));var jsonpatch=require(_0xf3ea('0x3'));var rp=require(_0xf3ea('0x4'));var moment=require(_0xf3ea('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf3ea('0x6'));var util=require(_0xf3ea('0x7'));var path=require(_0xf3ea('0x8'));var sox=require('sox');var csv=require(_0xf3ea('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf3ea('0xa'));var _=require(_0xf3ea('0xb'));var squel=require(_0xf3ea('0xc'));var crypto=require('crypto');var jsforce=require(_0xf3ea('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf3ea('0x9'));var querystring=require(_0xf3ea('0xe'));var Papa=require('papaparse');var Redis=require(_0xf3ea('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf3ea('0x10'));var as=require(_0xf3ea('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf3ea('0x12'));var utils=require(_0xf3ea('0x13'));var config=require(_0xf3ea('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf3ea('0x15'))['db'];function respondWithStatusCode(_0x174c19,_0x146c8a){_0x146c8a=_0x146c8a||0xcc;return function(_0x4c3801){if(_0x4c3801){return _0x174c19[_0xf3ea('0x16')](_0x146c8a);}return _0x174c19[_0xf3ea('0x17')](_0x146c8a)[_0xf3ea('0x18')]();};}function respondWithResult(_0x462567,_0x25e16a){_0x25e16a=_0x25e16a||0xc8;return function(_0x212521){if(_0x212521){return _0x462567[_0xf3ea('0x17')](_0x25e16a)[_0xf3ea('0x19')](_0x212521);}};}function respondWithFilteredResult(_0x56fa75,_0x46f3c4){return function(_0x5a560b){if(_0x5a560b){var _0x56d00f=typeof _0x46f3c4[_0xf3ea('0x1a')]==='undefined'&&typeof _0x46f3c4[_0xf3ea('0x1b')]===_0xf3ea('0x1c');var _0x24f0ac=_0x5a560b[_0xf3ea('0x1d')];var _0x4806fb=_0x56d00f?0x0:_0x46f3c4[_0xf3ea('0x1a')];var _0x1806ec=_0x56d00f?_0x5a560b[_0xf3ea('0x1d')]:_0x46f3c4[_0xf3ea('0x1a')]+_0x46f3c4[_0xf3ea('0x1b')];var _0x4fb6c0;if(_0x1806ec>=_0x24f0ac){_0x1806ec=_0x24f0ac;_0x4fb6c0=0xc8;}else{_0x4fb6c0=0xce;}_0x56fa75['status'](_0x4fb6c0);return _0x56fa75[_0xf3ea('0x1e')](_0xf3ea('0x1f'),_0x4806fb+'-'+_0x1806ec+'/'+_0x24f0ac)['json'](_0x5a560b);}return null;};}function patchUpdates(_0x2c7419){return function(_0x42f13c){try{jsonpatch[_0xf3ea('0x20')](_0x42f13c,_0x2c7419,!![]);}catch(_0xc85489){return BPromise[_0xf3ea('0x21')](_0xc85489);}return _0x42f13c[_0xf3ea('0x22')]();};}function saveUpdates(_0x134b7d,_0x27d607){return function(_0x34ec8f){if(_0x34ec8f){return _0x34ec8f[_0xf3ea('0x23')](_0x134b7d)[_0xf3ea('0x24')](function(_0x591fca){return _0x591fca;});}return null;};}function removeEntity(_0x2aee66,_0x23ed4a){return function(_0x5931e1){if(_0x5931e1){return _0x5931e1['destroy']()['then'](function(){_0x2aee66[_0xf3ea('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e089a,_0x38a1c8){return function(_0x4ea971){if(!_0x4ea971){_0x2e089a[_0xf3ea('0x16')](0x194);}return _0x4ea971;};}function handleError(_0x2877a2,_0x3e156d){_0x3e156d=_0x3e156d||0x1f4;return function(_0x4c29cc){logger[_0xf3ea('0x25')](_0x4c29cc['stack']);if(_0x4c29cc['name']){delete _0x4c29cc['name'];}_0x2877a2['status'](_0x3e156d)[_0xf3ea('0x26')](_0x4c29cc);};}exports[_0xf3ea('0x27')]=function(_0x120232,_0x10ef5f){var _0x15eed5={},_0x3ee79e={},_0x3c2cdb={'count':0x0,'rows':[]};var _0x65cdff=_['map'](db[_0xf3ea('0x28')][_0xf3ea('0x29')],function(_0x246103){return{'name':_0x246103[_0xf3ea('0x2a')],'type':_0x246103[_0xf3ea('0x2b')][_0xf3ea('0x2c')]};});_0x3ee79e[_0xf3ea('0x2d')]=_[_0xf3ea('0x2e')](_0x65cdff,_0xf3ea('0x2f'));_0x3ee79e[_0xf3ea('0x30')]=_['keys'](_0x120232['query']);_0x3ee79e[_0xf3ea('0x31')]=_[_0xf3ea('0x32')](_0x3ee79e[_0xf3ea('0x2d')],_0x3ee79e[_0xf3ea('0x30')]);_0x15eed5[_0xf3ea('0x33')]=_[_0xf3ea('0x32')](_0x3ee79e[_0xf3ea('0x2d')],qs[_0xf3ea('0x34')](_0x120232[_0xf3ea('0x30')]['fields']));_0x15eed5[_0xf3ea('0x33')]=_0x15eed5[_0xf3ea('0x33')][_0xf3ea('0x35')]?_0x15eed5[_0xf3ea('0x33')]:_0x3ee79e[_0xf3ea('0x2d')];if(!_0x120232[_0xf3ea('0x30')][_0xf3ea('0x36')](_0xf3ea('0x37'))){_0x15eed5[_0xf3ea('0x1b')]=qs[_0xf3ea('0x1b')](_0x120232[_0xf3ea('0x30')][_0xf3ea('0x1b')]);_0x15eed5[_0xf3ea('0x1a')]=qs[_0xf3ea('0x1a')](_0x120232[_0xf3ea('0x30')]['offset']);}_0x15eed5['order']=qs[_0xf3ea('0x38')](_0x120232[_0xf3ea('0x30')][_0xf3ea('0x38')]);_0x15eed5['where']=qs[_0xf3ea('0x31')](_['pick'](_0x120232[_0xf3ea('0x30')],_0x3ee79e['filters']),_0x65cdff);if(_0x120232[_0xf3ea('0x30')]['filter']){_0x15eed5[_0xf3ea('0x39')]=_[_0xf3ea('0x3a')](_0x15eed5[_0xf3ea('0x39')],{'$or':_[_0xf3ea('0x2e')](_0x65cdff,function(_0x26217b){if(_0x26217b[_0xf3ea('0x2b')]!==_0xf3ea('0x3b')){var _0x20505f={};_0x20505f[_0x26217b[_0xf3ea('0x2f')]]={'$like':'%'+_0x120232[_0xf3ea('0x30')][_0xf3ea('0x3c')]+'%'};return _0x20505f;}})});}_0x15eed5=_['merge']({},_0x15eed5,_0x120232[_0xf3ea('0x3d')]);var _0x49b938={'where':_0x15eed5['where']};return db[_0xf3ea('0x28')][_0xf3ea('0x1d')](_0x49b938)[_0xf3ea('0x24')](function(_0x55d496){_0x3c2cdb[_0xf3ea('0x1d')]=_0x55d496;if(_0x120232[_0xf3ea('0x30')]['includeAll']){_0x15eed5[_0xf3ea('0x3e')]=[{'all':!![]}];}return db[_0xf3ea('0x28')][_0xf3ea('0x3f')](_0x15eed5);})[_0xf3ea('0x24')](function(_0x4adffc){_0x3c2cdb[_0xf3ea('0x40')]=_0x4adffc;return _0x3c2cdb;})[_0xf3ea('0x24')](respondWithFilteredResult(_0x10ef5f,_0x15eed5))[_0xf3ea('0x41')](handleError(_0x10ef5f,null));};exports[_0xf3ea('0x42')]=function(_0x2badff,_0x4d688e){var _0x2ed142={'raw':!![],'where':{'id':_0x2badff[_0xf3ea('0x43')]['id']}},_0xe09c97={};_0xe09c97[_0xf3ea('0x2d')]=_[_0xf3ea('0x44')](db[_0xf3ea('0x28')][_0xf3ea('0x29')]);_0xe09c97[_0xf3ea('0x30')]=_[_0xf3ea('0x44')](_0x2badff[_0xf3ea('0x30')]);_0xe09c97['filters']=_[_0xf3ea('0x32')](_0xe09c97[_0xf3ea('0x2d')],_0xe09c97['query']);_0x2ed142[_0xf3ea('0x33')]=_['intersection'](_0xe09c97[_0xf3ea('0x2d')],qs['fields'](_0x2badff['query'][_0xf3ea('0x34')]));_0x2ed142[_0xf3ea('0x33')]=_0x2ed142[_0xf3ea('0x33')][_0xf3ea('0x35')]?_0x2ed142[_0xf3ea('0x33')]:_0xe09c97[_0xf3ea('0x2d')];if(_0x2badff['query'][_0xf3ea('0x45')]){_0x2ed142[_0xf3ea('0x3e')]=[{'all':!![]}];}_0x2ed142=_[_0xf3ea('0x3a')]({},_0x2ed142,_0x2badff[_0xf3ea('0x3d')]);return db['SquareMessage'][_0xf3ea('0x46')](_0x2ed142)['then'](handleEntityNotFound(_0x4d688e,null))[_0xf3ea('0x24')](respondWithResult(_0x4d688e,null))['catch'](handleError(_0x4d688e,null));};exports[_0xf3ea('0x47')]=function(_0x139666,_0x5d5a82){return db[_0xf3ea('0x28')][_0xf3ea('0x47')](_0x139666[_0xf3ea('0x48')],{})['then'](respondWithResult(_0x5d5a82,0xc9))['catch'](handleError(_0x5d5a82,null));};exports[_0xf3ea('0x23')]=function(_0xea830e,_0x34dcdc){if(_0xea830e[_0xf3ea('0x48')]['id']){delete _0xea830e['body']['id'];}return db['SquareMessage'][_0xf3ea('0x46')]({'where':{'id':_0xea830e[_0xf3ea('0x43')]['id']}})[_0xf3ea('0x24')](handleEntityNotFound(_0x34dcdc,null))['then'](saveUpdates(_0xea830e[_0xf3ea('0x48')],null))['then'](respondWithResult(_0x34dcdc,null))[_0xf3ea('0x41')](handleError(_0x34dcdc,null));};exports[_0xf3ea('0x49')]=function(_0x366202,_0x3be311){return db['SquareMessage'][_0xf3ea('0x46')]({'where':{'id':_0x366202['params']['id']}})[_0xf3ea('0x24')](handleEntityNotFound(_0x3be311,null))['then'](removeEntity(_0x3be311,null))[_0xf3ea('0x41')](handleError(_0x3be311,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 6a4c2c0..fc725ed 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 _0x7cc0=['api','bluebird','request-promise','path','rimraf','./squareMessage.attributes','define','util','../../config/logger'];(function(_0x1f6813,_0x25bc78){var _0x5966df=function(_0x397eaa){while(--_0x397eaa){_0x1f6813['push'](_0x1f6813['shift']());}};_0x5966df(++_0x25bc78);}(_0x7cc0,0x1a5));var _0x07cc=function(_0x2c101a,_0x5d1266){_0x2c101a=_0x2c101a-0x0;var _0x5b16f9=_0x7cc0[_0x2c101a];return _0x5b16f9;};'use strict';var _=require('lodash');var util=require(_0x07cc('0x0'));var logger=require(_0x07cc('0x1'))(_0x07cc('0x2'));var moment=require('moment');var BPromise=require(_0x07cc('0x3'));var rp=require(_0x07cc('0x4'));var fs=require('fs');var path=require(_0x07cc('0x5'));var rimraf=require(_0x07cc('0x6'));var config=require('../../config/environment');var attributes=require(_0x07cc('0x7'));module['exports']=function(_0x1f05de,_0x178593){return _0x1f05de[_0x07cc('0x8')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc34=['SquareMessage','../../config/logger','api','request-promise','rimraf','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0x4aa299,_0x3aba13){var _0x49018e=function(_0x200d2d){while(--_0x200d2d){_0x4aa299['push'](_0x4aa299['shift']());}};_0x49018e(++_0x3aba13);}(_0xdc34,0xa3));var _0x4dc3=function(_0x39d9af,_0x2d7a7b){_0x39d9af=_0x39d9af-0x0;var _0x55b9e2=_0xdc34[_0x39d9af];return _0x55b9e2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4dc3('0x0'))(_0x4dc3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4dc3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4dc3('0x3'));var config=require(_0x4dc3('0x4'));var attributes=require(_0x4dc3('0x5'));module[_0x4dc3('0x6')]=function(_0x59a3af,_0x21b9e9){return _0x59a3af[_0x4dc3('0x7')](_0x4dc3('0x8'),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 8d3ab94..b8c5dc5 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 _0x7fa6=['code','message','result','CreateSquareMessage','SquareMessage','create','body','options','stringify','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x30a5e9,_0x2610a1){var _0x5b10af=function(_0xb3cae7){while(--_0xb3cae7){_0x30a5e9['push'](_0x30a5e9['shift']());}};_0x5b10af(++_0x2610a1);}(_0x7fa6,0xda));var _0x67fa=function(_0x15c710,_0x4222c9){_0x15c710=_0x15c710-0x0;var _0x4de0da=_0x7fa6[_0x15c710];return _0x4de0da;};'use strict';var _=require('lodash');var util=require(_0x67fa('0x0'));var moment=require(_0x67fa('0x1'));var BPromise=require(_0x67fa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x67fa('0x3'));var db=require(_0x67fa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x67fa('0x5'))(_0x67fa('0x6'));var config=require(_0x67fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x67fa('0x8')][_0x67fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x482cec,_0x2d42b7,_0x5049fd){return new BPromise(function(_0x5c0000,_0x18f42d){return client['request'](_0x482cec,_0x5049fd)[_0x67fa('0xa')](function(_0x224610){logger[_0x67fa('0xb')](_0x67fa('0xc'),_0x2d42b7,_0x67fa('0xd'));logger[_0x67fa('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x2d42b7,_0x67fa('0xd'),JSON['stringify'](_0x224610));if(_0x224610[_0x67fa('0xf')]){if(_0x224610[_0x67fa('0xf')][_0x67fa('0x10')]===0x1f4){logger[_0x67fa('0xf')](_0x67fa('0xc'),_0x2d42b7,_0x224610[_0x67fa('0xf')][_0x67fa('0x11')]);return _0x18f42d(_0x224610['error'][_0x67fa('0x11')]);}logger[_0x67fa('0xf')](_0x67fa('0xc'),_0x2d42b7,_0x224610[_0x67fa('0xf')][_0x67fa('0x11')]);return _0x5c0000(_0x224610[_0x67fa('0xf')][_0x67fa('0x11')]);}else{logger[_0x67fa('0xb')](_0x67fa('0xc'),_0x2d42b7,_0x67fa('0xd'));_0x5c0000(_0x224610[_0x67fa('0x12')]['message']);}})['catch'](function(_0x84bb5d){logger[_0x67fa('0xf')](_0x67fa('0xc'),_0x2d42b7,_0x84bb5d);_0x18f42d(_0x84bb5d);});});}exports[_0x67fa('0x13')]=function(_0x31aa19){var _0x257124=this;return new Promise(function(_0x4393d6,_0x11fbe3){return db[_0x67fa('0x14')][_0x67fa('0x15')](_0x31aa19[_0x67fa('0x16')],{'raw':_0x31aa19[_0x67fa('0x17')]?_0x31aa19[_0x67fa('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x67fa('0xa')](function(_0x53b39d){logger[_0x67fa('0xb')](_0x67fa('0x13'),_0x31aa19);logger[_0x67fa('0xe')](_0x67fa('0x13'),_0x31aa19,JSON[_0x67fa('0x18')](_0x53b39d));_0x4393d6(_0x53b39d);})[_0x67fa('0x19')](function(_0x416776){logger['error'](_0x67fa('0x13'),_0x416776[_0x67fa('0x11')],_0x31aa19);_0x11fbe3(_0x257124[_0x67fa('0xf')](0x1f4,_0x416776[_0x67fa('0x11')]));});});}; \ No newline at end of file +var _0x19e0=['raw','then','CreateSquareMessage','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareMessage','create','body','options'];(function(_0x166fc3,_0xdded0f){var _0x49064a=function(_0x59ca76){while(--_0x59ca76){_0x166fc3['push'](_0x166fc3['shift']());}};_0x49064a(++_0xdded0f);}(_0x19e0,0x9f));var _0x019e=function(_0x5b1ec7,_0x4904ba){_0x5b1ec7=_0x5b1ec7-0x0;var _0x11d210=_0x19e0[_0x5b1ec7];return _0x11d210;};'use strict';var _=require(_0x019e('0x0'));var util=require(_0x019e('0x1'));var moment=require(_0x019e('0x2'));var BPromise=require(_0x019e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x019e('0x4'));var db=require(_0x019e('0x5'))['db'];var utils=require(_0x019e('0x6'));var logger=require(_0x019e('0x7'))(_0x019e('0x8'));var config=require(_0x019e('0x9'));var jayson=require(_0x019e('0xa'));var client=jayson[_0x019e('0xb')][_0x019e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x35680e,_0x4a49c3,_0x47533d){return new BPromise(function(_0x17c16a,_0x2785c8){return client['request'](_0x35680e,_0x47533d)['then'](function(_0x4079b7){logger[_0x019e('0xd')](_0x019e('0xe'),_0x4a49c3,_0x019e('0xf'));logger[_0x019e('0x10')](_0x019e('0x11'),_0x4a49c3,_0x019e('0xf'),JSON[_0x019e('0x12')](_0x4079b7));if(_0x4079b7[_0x019e('0x13')]){if(_0x4079b7['error'][_0x019e('0x14')]===0x1f4){logger['error'](_0x019e('0xe'),_0x4a49c3,_0x4079b7[_0x019e('0x13')][_0x019e('0x15')]);return _0x2785c8(_0x4079b7[_0x019e('0x13')][_0x019e('0x15')]);}logger[_0x019e('0x13')]('SquareMessage,\x20%s,\x20%s',_0x4a49c3,_0x4079b7[_0x019e('0x13')]['message']);return _0x17c16a(_0x4079b7['error']['message']);}else{logger[_0x019e('0xd')]('SquareMessage,\x20%s,\x20%s',_0x4a49c3,'request\x20sent');_0x17c16a(_0x4079b7[_0x019e('0x16')][_0x019e('0x15')]);}})['catch'](function(_0x453ca1){logger[_0x019e('0x13')]('SquareMessage,\x20%s,\x20%s',_0x4a49c3,_0x453ca1);_0x2785c8(_0x453ca1);});});}exports['CreateSquareMessage']=function(_0x34d1d7){var _0x3e65a9=this;return new Promise(function(_0x27acd4,_0x5b0ef9){return db[_0x019e('0x17')][_0x019e('0x18')](_0x34d1d7[_0x019e('0x19')],{'raw':_0x34d1d7[_0x019e('0x1a')]?_0x34d1d7['options'][_0x019e('0x1b')]===undefined?!![]:![]:!![]})[_0x019e('0x1c')](function(_0x2bc034){logger['info'](_0x019e('0x1d'),_0x34d1d7);logger['debug']('CreateSquareMessage',_0x34d1d7,JSON['stringify'](_0x2bc034));_0x27acd4(_0x2bc034);})[_0x019e('0x1e')](function(_0x3f7232){logger['error'](_0x019e('0x1d'),_0x3f7232['message'],_0x34d1d7);_0x5b0ef9(_0x3e65a9['error'](0x1f4,_0x3f7232[_0x019e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 604fad6..e913183 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 _0x1705=['/:id/test','isAuthenticated','15s','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','index','/:id'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1705,0x1ac));var _0x5170=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x1705[_0x3a7a9c];return _0x59156e;};'use strict';var multer=require(_0x5170('0x0'));var util=require(_0x5170('0x1'));var path=require(_0x5170('0x2'));var timeout=require(_0x5170('0x3'));var express=require(_0x5170('0x4'));var router=express[_0x5170('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5170('0x6'));var interaction=require(_0x5170('0x7'));var config=require('../../config/environment');var controller=require(_0x5170('0x8'));router[_0x5170('0x9')]('/',auth['isAuthenticated'](),controller[_0x5170('0xa')]);router[_0x5170('0x9')](_0x5170('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x5170('0xc'),auth[_0x5170('0xd')](),timeout(_0x5170('0xe')),controller['test']);router[_0x5170('0xf')]('/',auth[_0x5170('0xd')](),controller[_0x5170('0x10')]);router[_0x5170('0x11')](_0x5170('0xb'),auth[_0x5170('0xd')](),controller['update']);router[_0x5170('0x12')](_0x5170('0xb'),auth[_0x5170('0xd')](),controller[_0x5170('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3cbb=['Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','/:id/test','15s','test','put','update','exports','multer','path','connect-timeout','express'];(function(_0x3ac7e6,_0x392fe5){var _0x592a9b=function(_0x515656){while(--_0x515656){_0x3ac7e6['push'](_0x3ac7e6['shift']());}};_0x592a9b(++_0x392fe5);}(_0x3cbb,0x1a5));var _0xb3cb=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x3cbb[_0x4b174a];return _0x3cd7bf;};'use strict';var multer=require(_0xb3cb('0x0'));var util=require('util');var path=require(_0xb3cb('0x1'));var timeout=require(_0xb3cb('0x2'));var express=require(_0xb3cb('0x3'));var router=express[_0xb3cb('0x4')]();var fs_extra=require(_0xb3cb('0x5'));var auth=require(_0xb3cb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb3cb('0x7'));var controller=require('./squareOdbc.controller');router[_0xb3cb('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb3cb('0x9'),auth[_0xb3cb('0xa')](),controller['show']);router[_0xb3cb('0x8')](_0xb3cb('0xb'),auth[_0xb3cb('0xa')](),timeout(_0xb3cb('0xc')),controller[_0xb3cb('0xd')]);router['post']('/',auth[_0xb3cb('0xa')](),controller['create']);router[_0xb3cb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb3cb('0xf')]);router['delete'](_0xb3cb('0x9'),auth[_0xb3cb('0xa')](),controller['destroy']);module[_0xb3cb('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index a1b3ff1..2ba65ab 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 _0x049d=['STRING','name','sequelize','exports'];(function(_0xfbca53,_0x4967d5){var _0x4938f6=function(_0x5798ee){while(--_0x5798ee){_0xfbca53['push'](_0xfbca53['shift']());}};_0x4938f6(++_0x4967d5);}(_0x049d,0xa2));var _0xd049=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x049d[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xd049('0x0'));module[_0xd049('0x1')]={'name':{'type':Sequelize[_0xd049('0x2')],'unique':_0xd049('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xd049('0x2')]},'description':{'type':Sequelize[_0xd049('0x2')]}}; \ No newline at end of file +var _0x25c7=['sequelize','exports','STRING','name'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x25c7,0x128));var _0x725c=function(_0x1fcee5,_0x122e35){_0x1fcee5=_0x1fcee5-0x0;var _0x7bb651=_0x25c7[_0x1fcee5];return _0x7bb651;};'use strict';var Sequelize=require(_0x725c('0x0'));module[_0x725c('0x1')]={'name':{'type':Sequelize[_0x725c('0x2')],'unique':_0x725c('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x725c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index e6e9d21..60b2c29 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 _0xd340=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','UserProfileResource','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','merge','options','includeAll','findAll','rows','catch','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','closeSync','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x545ce5,_0x13b27a){var _0x1fa3f1=function(_0x18317f){while(--_0x18317f){_0x545ce5['push'](_0x545ce5['shift']());}};_0x1fa3f1(++_0x13b27a);}(_0xd340,0x194));var _0x0d34=function(_0x4d41c9,_0x51fbd9){_0x4d41c9=_0x4d41c9-0x0;var _0x1f1b6d=_0xd340[_0x4d41c9];return _0x1f1b6d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d34('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d34('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0d34('0x2'));var Mustache=require(_0x0d34('0x3'));var util=require(_0x0d34('0x4'));var path=require(_0x0d34('0x5'));var sox=require('sox');var csv=require(_0x0d34('0x6'));var ejs=require(_0x0d34('0x7'));var fs=require('fs');var fs_extra=require(_0x0d34('0x8'));var _=require(_0x0d34('0x9'));var squel=require(_0x0d34('0xa'));var crypto=require(_0x0d34('0xb'));var jsforce=require(_0x0d34('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0d34('0x6'));var querystring=require('querystring');var Papa=require(_0x0d34('0xd'));var Redis=require(_0x0d34('0xe'));var authService=require(_0x0d34('0xf'));var qs=require(_0x0d34('0x10'));var as=require(_0x0d34('0x11'));var hardwareService=require(_0x0d34('0x12'));var logger=require(_0x0d34('0x13'))(_0x0d34('0x14'));var utils=require(_0x0d34('0x15'));var config=require(_0x0d34('0x16'));var licenseUtil=require(_0x0d34('0x17'));var db=require(_0x0d34('0x18'))['db'];function respondWithStatusCode(_0x5b0980,_0x4d4241){_0x4d4241=_0x4d4241||0xcc;return function(_0x3ae293){if(_0x3ae293){return _0x5b0980[_0x0d34('0x19')](_0x4d4241);}return _0x5b0980[_0x0d34('0x1a')](_0x4d4241)[_0x0d34('0x1b')]();};}function respondWithResult(_0x3bcc89,_0x389328){_0x389328=_0x389328||0xc8;return function(_0x354ba1){if(_0x354ba1){return _0x3bcc89[_0x0d34('0x1a')](_0x389328)['json'](_0x354ba1);}};}function respondWithFilteredResult(_0x2f2aa0,_0x156817){return function(_0x5abaec){if(_0x5abaec){var _0x49a772=typeof _0x156817['offset']==='undefined'&&typeof _0x156817[_0x0d34('0x1c')]===_0x0d34('0x1d');var _0x3f8e95=_0x5abaec[_0x0d34('0x1e')];var _0x5f52b4=_0x49a772?0x0:_0x156817['offset'];var _0x2ef096=_0x49a772?_0x5abaec[_0x0d34('0x1e')]:_0x156817['offset']+_0x156817[_0x0d34('0x1c')];var _0x64305b;if(_0x2ef096>=_0x3f8e95){_0x2ef096=_0x3f8e95;_0x64305b=0xc8;}else{_0x64305b=0xce;}_0x2f2aa0[_0x0d34('0x1a')](_0x64305b);return _0x2f2aa0[_0x0d34('0x1f')](_0x0d34('0x20'),_0x5f52b4+'-'+_0x2ef096+'/'+_0x3f8e95)[_0x0d34('0x21')](_0x5abaec);}return null;};}function patchUpdates(_0x430589){return function(_0x52ae1f){try{jsonpatch[_0x0d34('0x22')](_0x52ae1f,_0x430589,!![]);}catch(_0x295a08){return BPromise[_0x0d34('0x23')](_0x295a08);}return _0x52ae1f[_0x0d34('0x24')]();};}function saveUpdates(_0x44e687,_0x5cd906){return function(_0x3d3d35){if(_0x3d3d35){return _0x3d3d35[_0x0d34('0x25')](_0x44e687)['then'](function(_0x3caff){return _0x3caff;});}return null;};}function removeEntity(_0x26e20d,_0x1d273c){return function(_0x50daa9){if(_0x50daa9){return _0x50daa9[_0x0d34('0x26')]()[_0x0d34('0x27')](function(){var _0x4261d6=_0x50daa9[_0x0d34('0x28')]({'plain':!![]});var _0x5b0912='ODBC';return db[_0x0d34('0x29')]['destroy']({'where':{'type':_0x5b0912,'resourceId':_0x4261d6['id']}})[_0x0d34('0x27')](function(){return _0x50daa9;});})[_0x0d34('0x27')](function(){_0x26e20d[_0x0d34('0x1a')](0xcc)[_0x0d34('0x1b')]();});}};}function handleEntityNotFound(_0x1d0293,_0x3062f3){return function(_0x28a629){if(!_0x28a629){_0x1d0293['sendStatus'](0x194);}return _0x28a629;};}function handleError(_0x134eff,_0x53e780){_0x53e780=_0x53e780||0x1f4;return function(_0x225112){logger['error'](_0x225112[_0x0d34('0x2a')]);if(_0x225112[_0x0d34('0x2b')]){delete _0x225112['name'];}_0x134eff[_0x0d34('0x1a')](_0x53e780)[_0x0d34('0x2c')](_0x225112);};}exports[_0x0d34('0x2d')]=function(_0x3d3f3b,_0x2f21a9){var _0x592ee1={},_0x132b04={},_0x5dd5f3={'count':0x0,'rows':[]};var _0x286096=_[_0x0d34('0x2e')](db[_0x0d34('0x2f')][_0x0d34('0x30')],function(_0x29078b){return{'name':_0x29078b[_0x0d34('0x31')],'type':_0x29078b[_0x0d34('0x32')]['key']};});_0x132b04[_0x0d34('0x33')]=_['map'](_0x286096,_0x0d34('0x2b'));_0x132b04[_0x0d34('0x34')]=_[_0x0d34('0x35')](_0x3d3f3b[_0x0d34('0x34')]);_0x132b04['filters']=_['intersection'](_0x132b04[_0x0d34('0x33')],_0x132b04[_0x0d34('0x34')]);_0x592ee1[_0x0d34('0x36')]=_[_0x0d34('0x37')](_0x132b04[_0x0d34('0x33')],qs['fields'](_0x3d3f3b[_0x0d34('0x34')][_0x0d34('0x38')]));_0x592ee1[_0x0d34('0x36')]=_0x592ee1[_0x0d34('0x36')]['length']?_0x592ee1['attributes']:_0x132b04[_0x0d34('0x33')];if(!_0x3d3f3b[_0x0d34('0x34')][_0x0d34('0x39')](_0x0d34('0x3a'))){_0x592ee1[_0x0d34('0x1c')]=qs[_0x0d34('0x1c')](_0x3d3f3b['query'][_0x0d34('0x1c')]);_0x592ee1[_0x0d34('0x3b')]=qs['offset'](_0x3d3f3b[_0x0d34('0x34')]['offset']);}_0x592ee1[_0x0d34('0x3c')]=qs[_0x0d34('0x3d')](_0x3d3f3b['query'][_0x0d34('0x3d')]);_0x592ee1[_0x0d34('0x3e')]=qs[_0x0d34('0x3f')](_['pick'](_0x3d3f3b[_0x0d34('0x34')],_0x132b04[_0x0d34('0x3f')]),_0x286096);if(_0x3d3f3b[_0x0d34('0x34')]['filter']){_0x592ee1[_0x0d34('0x3e')]=_[_0x0d34('0x40')](_0x592ee1['where'],{'$or':_[_0x0d34('0x2e')](_0x286096,function(_0x370e5b){if(_0x370e5b[_0x0d34('0x32')]!=='VIRTUAL'){var _0x4cac94={};_0x4cac94[_0x370e5b[_0x0d34('0x2b')]]={'$like':'%'+_0x3d3f3b[_0x0d34('0x34')]['filter']+'%'};return _0x4cac94;}})});}_0x592ee1=_[_0x0d34('0x40')]({},_0x592ee1,_0x3d3f3b[_0x0d34('0x41')]);var _0x3d7e98={'where':_0x592ee1[_0x0d34('0x3e')]};return db[_0x0d34('0x2f')][_0x0d34('0x1e')](_0x3d7e98)[_0x0d34('0x27')](function(_0x64084f){_0x5dd5f3[_0x0d34('0x1e')]=_0x64084f;if(_0x3d3f3b[_0x0d34('0x34')][_0x0d34('0x42')]){_0x592ee1['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x0d34('0x43')](_0x592ee1);})[_0x0d34('0x27')](function(_0x12705c){_0x5dd5f3[_0x0d34('0x44')]=_0x12705c;return _0x5dd5f3;})[_0x0d34('0x27')](respondWithFilteredResult(_0x2f21a9,_0x592ee1))[_0x0d34('0x45')](handleError(_0x2f21a9,null));};exports['show']=function(_0x31e0f6,_0x4e0d99){var _0x1c2ed1={'raw':!![],'where':{'id':_0x31e0f6['params']['id']}},_0x4eb31c={};_0x4eb31c[_0x0d34('0x33')]=_['keys'](db[_0x0d34('0x2f')][_0x0d34('0x30')]);_0x4eb31c[_0x0d34('0x34')]=_[_0x0d34('0x35')](_0x31e0f6['query']);_0x4eb31c[_0x0d34('0x3f')]=_['intersection'](_0x4eb31c[_0x0d34('0x33')],_0x4eb31c[_0x0d34('0x34')]);_0x1c2ed1[_0x0d34('0x36')]=_[_0x0d34('0x37')](_0x4eb31c[_0x0d34('0x33')],qs[_0x0d34('0x38')](_0x31e0f6[_0x0d34('0x34')][_0x0d34('0x38')]));_0x1c2ed1[_0x0d34('0x36')]=_0x1c2ed1['attributes'][_0x0d34('0x46')]?_0x1c2ed1[_0x0d34('0x36')]:_0x4eb31c[_0x0d34('0x33')];if(_0x31e0f6[_0x0d34('0x34')]['includeAll']){_0x1c2ed1[_0x0d34('0x47')]=[{'all':!![]}];}_0x1c2ed1=_['merge']({},_0x1c2ed1,_0x31e0f6[_0x0d34('0x41')]);return db[_0x0d34('0x2f')][_0x0d34('0x48')](_0x1c2ed1)[_0x0d34('0x27')](handleEntityNotFound(_0x4e0d99,null))[_0x0d34('0x27')](respondWithResult(_0x4e0d99,null))[_0x0d34('0x45')](handleError(_0x4e0d99,null));};exports[_0x0d34('0x49')]=function(_0x39bf92,_0x34d53d){return db[_0x0d34('0x2f')][_0x0d34('0x49')](_0x39bf92[_0x0d34('0x4a')],{})[_0x0d34('0x27')](function(_0x3e3f23){var _0x143b81=_0x39bf92['user'][_0x0d34('0x28')]({'plain':!![]});if(!_0x143b81)throw new Error(_0x0d34('0x4b'));if(_0x143b81[_0x0d34('0x4c')]==='user'){var _0x3011c2=_0x3e3f23['get']({'plain':!![]});var _0x2d860e='ODBC';return db['UserProfileSection'][_0x0d34('0x48')]({'where':{'name':_0x2d860e,'userProfileId':_0x143b81[_0x0d34('0x4d')]},'raw':!![]})[_0x0d34('0x27')](function(_0xb4ae8c){if(_0xb4ae8c&&_0xb4ae8c[_0x0d34('0x4e')]===0x0){return db[_0x0d34('0x29')]['create']({'name':_0x3011c2[_0x0d34('0x2b')],'resourceId':_0x3011c2['id'],'type':_0xb4ae8c[_0x0d34('0x2b')],'sectionId':_0xb4ae8c['id']},{})[_0x0d34('0x27')](function(){return _0x3e3f23;});}else{return _0x3e3f23;}})[_0x0d34('0x45')](function(_0x586e72){logger[_0x0d34('0x4f')](_0x0d34('0x50'),_0x586e72);throw _0x586e72;});}return _0x3e3f23;})[_0x0d34('0x27')](respondWithResult(_0x34d53d,0xc9))['catch'](handleError(_0x34d53d,null));};exports[_0x0d34('0x25')]=function(_0x579b46,_0x39f96a){if(_0x579b46[_0x0d34('0x4a')]['id']){delete _0x579b46[_0x0d34('0x4a')]['id'];}return db[_0x0d34('0x2f')][_0x0d34('0x48')]({'where':{'id':_0x579b46[_0x0d34('0x51')]['id']}})[_0x0d34('0x27')](handleEntityNotFound(_0x39f96a,null))[_0x0d34('0x27')](saveUpdates(_0x579b46[_0x0d34('0x4a')],null))['then'](respondWithResult(_0x39f96a,null))['catch'](handleError(_0x39f96a,null));};exports[_0x0d34('0x26')]=function(_0x38c75e,_0x1c3633){return db[_0x0d34('0x2f')][_0x0d34('0x48')]({'where':{'id':_0x38c75e['params']['id']}})[_0x0d34('0x27')](handleEntityNotFound(_0x1c3633,null))[_0x0d34('0x27')](removeEntity(_0x1c3633,null))['catch'](handleError(_0x1c3633,null));};exports[_0x0d34('0x52')]=function(_0x3732f5,_0x5af3da,_0x41ed0f){var _0x592a11;return db[_0x0d34('0x2f')][_0x0d34('0x48')]({'where':{'id':_0x3732f5[_0x0d34('0x51')]['id']},'attributes':['id',_0x0d34('0x53')]})[_0x0d34('0x27')](handleEntityNotFound(_0x5af3da,null))[_0x0d34('0x27')](function(_0xb3ba32){if(_0xb3ba32){var _0x568598=require('odbc')();_0x568598['openSync'](_0xb3ba32['dsn']);_0x568598[_0x0d34('0x54')]();return _0xb3ba32;}})[_0x0d34('0x27')](respondWithResult(_0x5af3da,null))[_0x0d34('0x45')](handleError(_0x5af3da,null));}; \ No newline at end of file +var _0xb263=['json','offset','limit','undefined','count','apply','save','update','then','destroy','get','ODBC','UserProfileResource','error','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','body','dsn','openSync','closeSync','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','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','sendStatus','status','end'];(function(_0x115d5b,_0x26aff2){var _0x6cfc50=function(_0x39a786){while(--_0x39a786){_0x115d5b['push'](_0x115d5b['shift']());}};_0x6cfc50(++_0x26aff2);}(_0xb263,0x123));var _0x3b26=function(_0x53bcfb,_0x2ca4b2){_0x53bcfb=_0x53bcfb-0x0;var _0x1e6f99=_0xb263[_0x53bcfb];return _0x1e6f99;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b26('0x0'));var zipdir=require(_0x3b26('0x1'));var jsonpatch=require(_0x3b26('0x2'));var rp=require('request-promise');var moment=require(_0x3b26('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3b26('0x4'));var path=require(_0x3b26('0x5'));var sox=require(_0x3b26('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3b26('0x7'));var crypto=require(_0x3b26('0x8'));var jsforce=require(_0x3b26('0x9'));var deskjs=require(_0x3b26('0xa'));var toCsv=require(_0x3b26('0xb'));var querystring=require(_0x3b26('0xc'));var Papa=require(_0x3b26('0xd'));var Redis=require('ioredis');var authService=require(_0x3b26('0xe'));var qs=require(_0x3b26('0xf'));var as=require(_0x3b26('0x10'));var hardwareService=require(_0x3b26('0x11'));var logger=require(_0x3b26('0x12'))(_0x3b26('0x13'));var utils=require(_0x3b26('0x14'));var config=require(_0x3b26('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fa96e,_0x2c7a12){_0x2c7a12=_0x2c7a12||0xcc;return function(_0x33b04f){if(_0x33b04f){return _0x1fa96e[_0x3b26('0x16')](_0x2c7a12);}return _0x1fa96e[_0x3b26('0x17')](_0x2c7a12)[_0x3b26('0x18')]();};}function respondWithResult(_0x239a45,_0x4fb1c1){_0x4fb1c1=_0x4fb1c1||0xc8;return function(_0x1cf93a){if(_0x1cf93a){return _0x239a45[_0x3b26('0x17')](_0x4fb1c1)[_0x3b26('0x19')](_0x1cf93a);}};}function respondWithFilteredResult(_0x4674a8,_0x16b0f6){return function(_0xb8ecc2){if(_0xb8ecc2){var _0x9d6c06=typeof _0x16b0f6[_0x3b26('0x1a')]==='undefined'&&typeof _0x16b0f6[_0x3b26('0x1b')]===_0x3b26('0x1c');var _0x2b3d58=_0xb8ecc2[_0x3b26('0x1d')];var _0x20e90d=_0x9d6c06?0x0:_0x16b0f6[_0x3b26('0x1a')];var _0x4a904a=_0x9d6c06?_0xb8ecc2[_0x3b26('0x1d')]:_0x16b0f6['offset']+_0x16b0f6[_0x3b26('0x1b')];var _0x3b2d25;if(_0x4a904a>=_0x2b3d58){_0x4a904a=_0x2b3d58;_0x3b2d25=0xc8;}else{_0x3b2d25=0xce;}_0x4674a8[_0x3b26('0x17')](_0x3b2d25);return _0x4674a8['set']('Content-Range',_0x20e90d+'-'+_0x4a904a+'/'+_0x2b3d58)[_0x3b26('0x19')](_0xb8ecc2);}return null;};}function patchUpdates(_0x44bbb8){return function(_0x56597e){try{jsonpatch[_0x3b26('0x1e')](_0x56597e,_0x44bbb8,!![]);}catch(_0x1be363){return BPromise['reject'](_0x1be363);}return _0x56597e[_0x3b26('0x1f')]();};}function saveUpdates(_0x197a61,_0x5c1180){return function(_0x623c27){if(_0x623c27){return _0x623c27[_0x3b26('0x20')](_0x197a61)[_0x3b26('0x21')](function(_0x29b22f){return _0x29b22f;});}return null;};}function removeEntity(_0x8cbd65,_0x1597fd){return function(_0x45548f){if(_0x45548f){return _0x45548f[_0x3b26('0x22')]()[_0x3b26('0x21')](function(){var _0x5ceec6=_0x45548f[_0x3b26('0x23')]({'plain':!![]});var _0x42423e=_0x3b26('0x24');return db[_0x3b26('0x25')][_0x3b26('0x22')]({'where':{'type':_0x42423e,'resourceId':_0x5ceec6['id']}})['then'](function(){return _0x45548f;});})[_0x3b26('0x21')](function(){_0x8cbd65[_0x3b26('0x17')](0xcc)[_0x3b26('0x18')]();});}};}function handleEntityNotFound(_0x4b433f,_0x3db184){return function(_0x1b1b93){if(!_0x1b1b93){_0x4b433f[_0x3b26('0x16')](0x194);}return _0x1b1b93;};}function handleError(_0x17938f,_0x2b4801){_0x2b4801=_0x2b4801||0x1f4;return function(_0x282f21){logger[_0x3b26('0x26')](_0x282f21['stack']);if(_0x282f21[_0x3b26('0x27')]){delete _0x282f21[_0x3b26('0x27')];}_0x17938f[_0x3b26('0x17')](_0x2b4801)[_0x3b26('0x28')](_0x282f21);};}exports[_0x3b26('0x29')]=function(_0x4cf06a,_0x40c999){var _0x3f3bb5={},_0x9fed47={},_0x427d5d={'count':0x0,'rows':[]};var _0x47c79f=_[_0x3b26('0x2a')](db[_0x3b26('0x2b')]['rawAttributes'],function(_0x38722e){return{'name':_0x38722e[_0x3b26('0x2c')],'type':_0x38722e[_0x3b26('0x2d')][_0x3b26('0x2e')]};});_0x9fed47[_0x3b26('0x2f')]=_[_0x3b26('0x2a')](_0x47c79f,_0x3b26('0x27'));_0x9fed47[_0x3b26('0x30')]=_['keys'](_0x4cf06a[_0x3b26('0x30')]);_0x9fed47[_0x3b26('0x31')]=_[_0x3b26('0x32')](_0x9fed47[_0x3b26('0x2f')],_0x9fed47[_0x3b26('0x30')]);_0x3f3bb5[_0x3b26('0x33')]=_['intersection'](_0x9fed47[_0x3b26('0x2f')],qs[_0x3b26('0x34')](_0x4cf06a[_0x3b26('0x30')][_0x3b26('0x34')]));_0x3f3bb5['attributes']=_0x3f3bb5[_0x3b26('0x33')]['length']?_0x3f3bb5['attributes']:_0x9fed47[_0x3b26('0x2f')];if(!_0x4cf06a[_0x3b26('0x30')][_0x3b26('0x35')](_0x3b26('0x36'))){_0x3f3bb5[_0x3b26('0x1b')]=qs[_0x3b26('0x1b')](_0x4cf06a['query']['limit']);_0x3f3bb5[_0x3b26('0x1a')]=qs[_0x3b26('0x1a')](_0x4cf06a[_0x3b26('0x30')][_0x3b26('0x1a')]);}_0x3f3bb5[_0x3b26('0x37')]=qs['sort'](_0x4cf06a['query']['sort']);_0x3f3bb5['where']=qs[_0x3b26('0x31')](_[_0x3b26('0x38')](_0x4cf06a['query'],_0x9fed47[_0x3b26('0x31')]),_0x47c79f);if(_0x4cf06a['query'][_0x3b26('0x39')]){_0x3f3bb5[_0x3b26('0x3a')]=_[_0x3b26('0x3b')](_0x3f3bb5[_0x3b26('0x3a')],{'$or':_[_0x3b26('0x2a')](_0x47c79f,function(_0x1726a2){if(_0x1726a2[_0x3b26('0x2d')]!==_0x3b26('0x3c')){var _0x35984a={};_0x35984a[_0x1726a2[_0x3b26('0x27')]]={'$like':'%'+_0x4cf06a[_0x3b26('0x30')][_0x3b26('0x39')]+'%'};return _0x35984a;}})});}_0x3f3bb5=_[_0x3b26('0x3b')]({},_0x3f3bb5,_0x4cf06a[_0x3b26('0x3d')]);var _0xdabd7b={'where':_0x3f3bb5['where']};return db['SquareOdbc'][_0x3b26('0x1d')](_0xdabd7b)[_0x3b26('0x21')](function(_0x40340c){_0x427d5d[_0x3b26('0x1d')]=_0x40340c;if(_0x4cf06a[_0x3b26('0x30')][_0x3b26('0x3e')]){_0x3f3bb5['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x3b26('0x3f')](_0x3f3bb5);})[_0x3b26('0x21')](function(_0x1e1e67){_0x427d5d[_0x3b26('0x40')]=_0x1e1e67;return _0x427d5d;})[_0x3b26('0x21')](respondWithFilteredResult(_0x40c999,_0x3f3bb5))[_0x3b26('0x41')](handleError(_0x40c999,null));};exports['show']=function(_0x371a3c,_0x40320e){var _0x3fcb92={'raw':!![],'where':{'id':_0x371a3c[_0x3b26('0x42')]['id']}},_0x8dc605={};_0x8dc605[_0x3b26('0x2f')]=_['keys'](db[_0x3b26('0x2b')]['rawAttributes']);_0x8dc605[_0x3b26('0x30')]=_['keys'](_0x371a3c['query']);_0x8dc605['filters']=_[_0x3b26('0x32')](_0x8dc605[_0x3b26('0x2f')],_0x8dc605[_0x3b26('0x30')]);_0x3fcb92[_0x3b26('0x33')]=_[_0x3b26('0x32')](_0x8dc605[_0x3b26('0x2f')],qs[_0x3b26('0x34')](_0x371a3c['query'][_0x3b26('0x34')]));_0x3fcb92[_0x3b26('0x33')]=_0x3fcb92['attributes'][_0x3b26('0x43')]?_0x3fcb92[_0x3b26('0x33')]:_0x8dc605[_0x3b26('0x2f')];if(_0x371a3c[_0x3b26('0x30')][_0x3b26('0x3e')]){_0x3fcb92[_0x3b26('0x44')]=[{'all':!![]}];}_0x3fcb92=_['merge']({},_0x3fcb92,_0x371a3c['options']);return db[_0x3b26('0x2b')][_0x3b26('0x45')](_0x3fcb92)['then'](handleEntityNotFound(_0x40320e,null))[_0x3b26('0x21')](respondWithResult(_0x40320e,null))[_0x3b26('0x41')](handleError(_0x40320e,null));};exports[_0x3b26('0x46')]=function(_0x1d8d48,_0x4dca78){return db[_0x3b26('0x2b')]['create'](_0x1d8d48['body'],{})[_0x3b26('0x21')](function(_0x16ea82){var _0x15888e=_0x1d8d48['user'][_0x3b26('0x23')]({'plain':!![]});if(!_0x15888e)throw new Error(_0x3b26('0x47'));if(_0x15888e['role']===_0x3b26('0x48')){var _0x57494c=_0x16ea82[_0x3b26('0x23')]({'plain':!![]});var _0x515add=_0x3b26('0x24');return db[_0x3b26('0x49')]['find']({'where':{'name':_0x515add,'userProfileId':_0x15888e['userProfileId']},'raw':!![]})[_0x3b26('0x21')](function(_0x22b009){if(_0x22b009&&_0x22b009[_0x3b26('0x4a')]===0x0){return db[_0x3b26('0x25')][_0x3b26('0x46')]({'name':_0x57494c[_0x3b26('0x27')],'resourceId':_0x57494c['id'],'type':_0x22b009[_0x3b26('0x27')],'sectionId':_0x22b009['id']},{})[_0x3b26('0x21')](function(){return _0x16ea82;});}else{return _0x16ea82;}})['catch'](function(_0x6209f4){logger[_0x3b26('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6209f4);throw _0x6209f4;});}return _0x16ea82;})['then'](respondWithResult(_0x4dca78,0xc9))[_0x3b26('0x41')](handleError(_0x4dca78,null));};exports['update']=function(_0x141bb1,_0x1d09e2){if(_0x141bb1[_0x3b26('0x4b')]['id']){delete _0x141bb1[_0x3b26('0x4b')]['id'];}return db[_0x3b26('0x2b')][_0x3b26('0x45')]({'where':{'id':_0x141bb1[_0x3b26('0x42')]['id']}})[_0x3b26('0x21')](handleEntityNotFound(_0x1d09e2,null))[_0x3b26('0x21')](saveUpdates(_0x141bb1['body'],null))[_0x3b26('0x21')](respondWithResult(_0x1d09e2,null))[_0x3b26('0x41')](handleError(_0x1d09e2,null));};exports['destroy']=function(_0x430d89,_0xd2aad8){return db['SquareOdbc'][_0x3b26('0x45')]({'where':{'id':_0x430d89[_0x3b26('0x42')]['id']}})['then'](handleEntityNotFound(_0xd2aad8,null))[_0x3b26('0x21')](removeEntity(_0xd2aad8,null))[_0x3b26('0x41')](handleError(_0xd2aad8,null));};exports['test']=function(_0x9a6ed8,_0x94a94b,_0x1ae84e){var _0x1774b4;return db['SquareOdbc'][_0x3b26('0x45')]({'where':{'id':_0x9a6ed8[_0x3b26('0x42')]['id']},'attributes':['id',_0x3b26('0x4c')]})[_0x3b26('0x21')](handleEntityNotFound(_0x94a94b,null))[_0x3b26('0x21')](function(_0x436ec7){if(_0x436ec7){var _0x206ff8=require('odbc')();_0x206ff8[_0x3b26('0x4d')](_0x436ec7[_0x3b26('0x4c')]);_0x206ff8[_0x3b26('0x4e')]();return _0x436ec7;}})[_0x3b26('0x21')](respondWithResult(_0x94a94b,null))[_0x3b26('0x41')](handleError(_0x94a94b,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 8a59fc0..0ba65ab 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 _0xad00=['./squareOdbc.attributes','exports','SquareOdbc','square_odbc','lodash','api','moment','bluebird','path','rimraf'];(function(_0x400096,_0x101dc3){var _0x31755a=function(_0x2d29b4){while(--_0x2d29b4){_0x400096['push'](_0x400096['shift']());}};_0x31755a(++_0x101dc3);}(_0xad00,0x194));var _0x0ad0=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xad00[_0xdc37a1];return _0x99b4fe;};'use strict';var _=require(_0x0ad0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0ad0('0x1'));var moment=require(_0x0ad0('0x2'));var BPromise=require(_0x0ad0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ad0('0x4'));var rimraf=require(_0x0ad0('0x5'));var config=require('../../config/environment');var attributes=require(_0x0ad0('0x6'));module[_0x0ad0('0x7')]=function(_0x3ba08a,_0x9cd7ce){return _0x3ba08a['define'](_0x0ad0('0x8'),attributes,{'tableName':_0x0ad0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25dd=['../../config/environment','./squareOdbc.attributes','exports','define','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x20e229,_0x2f599e){var _0x30cc44=function(_0x1d6004){while(--_0x1d6004){_0x20e229['push'](_0x20e229['shift']());}};_0x30cc44(++_0x2f599e);}(_0x25dd,0x9e));var _0xd25d=function(_0x9e9b7b,_0x11465e){_0x9e9b7b=_0x9e9b7b-0x0;var _0x3c73ea=_0x25dd[_0x9e9b7b];return _0x3c73ea;};'use strict';var _=require('lodash');var util=require(_0xd25d('0x0'));var logger=require(_0xd25d('0x1'))(_0xd25d('0x2'));var moment=require(_0xd25d('0x3'));var BPromise=require('bluebird');var rp=require(_0xd25d('0x4'));var fs=require('fs');var path=require(_0xd25d('0x5'));var rimraf=require(_0xd25d('0x6'));var config=require(_0xd25d('0x7'));var attributes=require(_0xd25d('0x8'));module[_0xd25d('0x9')]=function(_0x4623bf,_0xaacbce){return _0x4623bf[_0xd25d('0xa')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index ed624b2..fbc506d 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 _0xf331=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','include','map','model','catch'];(function(_0x4dd85b,_0x8c272a){var _0x2df1bc=function(_0x728d61){while(--_0x728d61){_0x4dd85b['push'](_0x4dd85b['shift']());}};_0x2df1bc(++_0x8c272a);}(_0xf331,0xe7));var _0x1f33=function(_0x4e533f,_0x53a0c2){_0x4e533f=_0x4e533f-0x0;var _0x12c49a=_0xf331[_0x4e533f];return _0x12c49a;};'use strict';var _=require(_0x1f33('0x0'));var util=require(_0x1f33('0x1'));var moment=require('moment');var BPromise=require(_0x1f33('0x2'));var rs=require(_0x1f33('0x3'));var fs=require('fs');var Redis=require(_0x1f33('0x4'));var db=require(_0x1f33('0x5'))['db'];var utils=require(_0x1f33('0x6'));var logger=require('../../config/logger')(_0x1f33('0x7'));var config=require(_0x1f33('0x8'));var jayson=require(_0x1f33('0x9'));var client=jayson[_0x1f33('0xa')][_0x1f33('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39152,_0x15b4fb,_0x21ef1d){return new BPromise(function(_0x2451df,_0x23b564){return client[_0x1f33('0xc')](_0x39152,_0x21ef1d)[_0x1f33('0xd')](function(_0x40be7c){logger[_0x1f33('0xe')](_0x1f33('0xf'),_0x15b4fb,_0x1f33('0x10'));logger[_0x1f33('0x11')](_0x1f33('0x12'),_0x15b4fb,'request\x20sent',JSON[_0x1f33('0x13')](_0x40be7c));if(_0x40be7c['error']){if(_0x40be7c[_0x1f33('0x14')]['code']===0x1f4){logger[_0x1f33('0x14')](_0x1f33('0xf'),_0x15b4fb,_0x40be7c[_0x1f33('0x14')][_0x1f33('0x15')]);return _0x23b564(_0x40be7c[_0x1f33('0x14')][_0x1f33('0x15')]);}logger[_0x1f33('0x14')](_0x1f33('0xf'),_0x15b4fb,_0x40be7c[_0x1f33('0x14')][_0x1f33('0x15')]);return _0x2451df(_0x40be7c[_0x1f33('0x14')]['message']);}else{logger['info'](_0x1f33('0xf'),_0x15b4fb,_0x1f33('0x10'));_0x2451df(_0x40be7c[_0x1f33('0x16')]['message']);}})['catch'](function(_0x3b84c9){logger[_0x1f33('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x15b4fb,_0x3b84c9);_0x23b564(_0x3b84c9);});});}exports[_0x1f33('0x17')]=function(_0x40a974){var _0x3160f8=this;return new Promise(function(_0x36e45d,_0x623601){return db[_0x1f33('0x18')]['find']({'raw':_0x40a974[_0x1f33('0x19')]?_0x40a974[_0x1f33('0x19')][_0x1f33('0x1a')]===undefined?!![]:![]:!![],'where':_0x40a974[_0x1f33('0x19')]?_0x40a974[_0x1f33('0x19')][_0x1f33('0x1b')]||null:null,'attributes':_0x40a974[_0x1f33('0x19')]?_0x40a974[_0x1f33('0x19')][_0x1f33('0x1c')]||null:null,'include':_0x40a974[_0x1f33('0x19')]?_0x40a974[_0x1f33('0x19')][_0x1f33('0x1d')]?_[_0x1f33('0x1e')](_0x40a974[_0x1f33('0x19')]['include'],function(_0x5b27f8){return{'model':db[_0x5b27f8[_0x1f33('0x1f')]],'as':_0x5b27f8['as'],'attributes':_0x5b27f8[_0x1f33('0x1c')],'include':_0x5b27f8[_0x1f33('0x1d')]?_[_0x1f33('0x1e')](_0x5b27f8[_0x1f33('0x1d')],function(_0x41fa5e){return{'model':db[_0x41fa5e['model']],'as':_0x41fa5e['as'],'attributes':_0x41fa5e[_0x1f33('0x1c')],'include':_0x41fa5e[_0x1f33('0x1d')]?_[_0x1f33('0x1e')](_0x41fa5e[_0x1f33('0x1d')],function(_0x3e19e7){return{'model':db[_0x3e19e7[_0x1f33('0x1f')]],'as':_0x3e19e7['as'],'attributes':_0x3e19e7[_0x1f33('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1f33('0xd')](function(_0x2c40b0){logger[_0x1f33('0xe')]('ShowSquareOdbc',_0x40a974);logger['debug']('ShowSquareOdbc',_0x40a974,JSON[_0x1f33('0x13')](_0x2c40b0));_0x36e45d(_0x2c40b0);})[_0x1f33('0x20')](function(_0x57a7ab){logger[_0x1f33('0x14')](_0x1f33('0x17'),_0x57a7ab[_0x1f33('0x15')],_0x40a974);_0x623601(_0x3160f8['error'](0x1f4,_0x57a7ab[_0x1f33('0x15')]));});});}; \ No newline at end of file +var _0xea74=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','SquareOdbc','find','options','raw','where','attributes','map','include','model','ShowSquareOdbc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xea74,0x1f1));var _0x4ea7=function(_0x5c6b0c,_0x5d7414){_0x5c6b0c=_0x5c6b0c-0x0;var _0x1e7e5c=_0xea74[_0x5c6b0c];return _0x1e7e5c;};'use strict';var _=require(_0x4ea7('0x0'));var util=require('util');var moment=require(_0x4ea7('0x1'));var BPromise=require(_0x4ea7('0x2'));var rs=require(_0x4ea7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ea7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ea7('0x5'))('rpc');var config=require(_0x4ea7('0x6'));var jayson=require(_0x4ea7('0x7'));var client=jayson[_0x4ea7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18fce2,_0x512bd6,_0x49628c){return new BPromise(function(_0x4bfa34,_0x1ec639){return client[_0x4ea7('0x9')](_0x18fce2,_0x49628c)[_0x4ea7('0xa')](function(_0x45fe4a){logger['info'](_0x4ea7('0xb'),_0x512bd6,'request\x20sent');logger['debug'](_0x4ea7('0xc'),_0x512bd6,_0x4ea7('0xd'),JSON['stringify'](_0x45fe4a));if(_0x45fe4a[_0x4ea7('0xe')]){if(_0x45fe4a[_0x4ea7('0xe')][_0x4ea7('0xf')]===0x1f4){logger['error'](_0x4ea7('0xb'),_0x512bd6,_0x45fe4a['error'][_0x4ea7('0x10')]);return _0x1ec639(_0x45fe4a[_0x4ea7('0xe')][_0x4ea7('0x10')]);}logger[_0x4ea7('0xe')](_0x4ea7('0xb'),_0x512bd6,_0x45fe4a[_0x4ea7('0xe')][_0x4ea7('0x10')]);return _0x4bfa34(_0x45fe4a['error'][_0x4ea7('0x10')]);}else{logger[_0x4ea7('0x11')](_0x4ea7('0xb'),_0x512bd6,_0x4ea7('0xd'));_0x4bfa34(_0x45fe4a[_0x4ea7('0x12')]['message']);}})[_0x4ea7('0x13')](function(_0x493695){logger[_0x4ea7('0xe')](_0x4ea7('0xb'),_0x512bd6,_0x493695);_0x1ec639(_0x493695);});});}exports['ShowSquareOdbc']=function(_0x327ea6){var _0x5afafb=this;return new Promise(function(_0x4772ff,_0x330d5f){return db[_0x4ea7('0x14')][_0x4ea7('0x15')]({'raw':_0x327ea6[_0x4ea7('0x16')]?_0x327ea6[_0x4ea7('0x16')][_0x4ea7('0x17')]===undefined?!![]:![]:!![],'where':_0x327ea6[_0x4ea7('0x16')]?_0x327ea6[_0x4ea7('0x16')][_0x4ea7('0x18')]||null:null,'attributes':_0x327ea6[_0x4ea7('0x16')]?_0x327ea6[_0x4ea7('0x16')][_0x4ea7('0x19')]||null:null,'include':_0x327ea6[_0x4ea7('0x16')]?_0x327ea6[_0x4ea7('0x16')]['include']?_[_0x4ea7('0x1a')](_0x327ea6[_0x4ea7('0x16')][_0x4ea7('0x1b')],function(_0x2aa5eb){return{'model':db[_0x2aa5eb[_0x4ea7('0x1c')]],'as':_0x2aa5eb['as'],'attributes':_0x2aa5eb['attributes'],'include':_0x2aa5eb[_0x4ea7('0x1b')]?_[_0x4ea7('0x1a')](_0x2aa5eb[_0x4ea7('0x1b')],function(_0x17e25d){return{'model':db[_0x17e25d[_0x4ea7('0x1c')]],'as':_0x17e25d['as'],'attributes':_0x17e25d[_0x4ea7('0x19')],'include':_0x17e25d['include']?_[_0x4ea7('0x1a')](_0x17e25d[_0x4ea7('0x1b')],function(_0x55f4f1){return{'model':db[_0x55f4f1[_0x4ea7('0x1c')]],'as':_0x55f4f1['as'],'attributes':_0x55f4f1[_0x4ea7('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c60bf){logger[_0x4ea7('0x11')](_0x4ea7('0x1d'),_0x327ea6);logger[_0x4ea7('0x1e')](_0x4ea7('0x1d'),_0x327ea6,JSON['stringify'](_0x3c60bf));_0x4772ff(_0x3c60bf);})['catch'](function(_0x36dbf7){logger[_0x4ea7('0xe')]('ShowSquareOdbc',_0x36dbf7['message'],_0x327ea6);_0x330d5f(_0x5afafb[_0x4ea7('0xe')](0x1f4,_0x36dbf7[_0x4ea7('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 44cd297..4451e07 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 _0x9aee=['post','create','put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x9aee,0x9e));var _0xe9ae=function(_0x432044,_0x35d99b){_0x432044=_0x432044-0x0;var _0x108d8d=_0x9aee[_0x432044];return _0x108d8d;};'use strict';var multer=require(_0xe9ae('0x0'));var util=require(_0xe9ae('0x1'));var path=require('path');var timeout=require(_0xe9ae('0x2'));var express=require('express');var router=express[_0xe9ae('0x3')]();var fs_extra=require(_0xe9ae('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe9ae('0x5'));var config=require(_0xe9ae('0x6'));var controller=require(_0xe9ae('0x7'));router['get']('/',auth[_0xe9ae('0x8')](),controller[_0xe9ae('0x9')]);router[_0xe9ae('0xa')](_0xe9ae('0xb'),auth[_0xe9ae('0x8')](),controller[_0xe9ae('0xc')]);router[_0xe9ae('0xd')]('/',auth['isAuthenticated'](),controller[_0xe9ae('0xe')]);router[_0xe9ae('0xf')](_0xe9ae('0xb'),auth['isAuthenticated'](),controller[_0xe9ae('0x10')]);router[_0xe9ae('0x11')](_0xe9ae('0xb'),auth[_0xe9ae('0x8')](),controller['destroy']);module[_0xe9ae('0x12')]=router; \ No newline at end of file +var _0x77d6=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated','post','put','delete','exports','util'];(function(_0x1811a7,_0x796845){var _0x309947=function(_0x42fc70){while(--_0x42fc70){_0x1811a7['push'](_0x1811a7['shift']());}};_0x309947(++_0x796845);}(_0x77d6,0x120));var _0x677d=function(_0x25356d,_0x3c07d9){_0x25356d=_0x25356d-0x0;var _0x272a46=_0x77d6[_0x25356d];return _0x272a46;};'use strict';var multer=require('multer');var util=require(_0x677d('0x0'));var path=require(_0x677d('0x1'));var timeout=require(_0x677d('0x2'));var express=require(_0x677d('0x3'));var router=express[_0x677d('0x4')]();var fs_extra=require(_0x677d('0x5'));var auth=require(_0x677d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x677d('0x7'));var controller=require(_0x677d('0x8'));router[_0x677d('0x9')]('/',auth['isAuthenticated'](),controller[_0x677d('0xa')]);router[_0x677d('0x9')](_0x677d('0xb'),auth[_0x677d('0xc')](),controller['show']);router[_0x677d('0xd')]('/',auth[_0x677d('0xc')](),controller['create']);router[_0x677d('0xe')](_0x677d('0xb'),auth[_0x677d('0xc')](),controller['update']);router[_0x677d('0xf')](_0x677d('0xb'),auth[_0x677d('0xc')](),controller['destroy']);module[_0x677d('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 1f271e8..9cf73e3 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 _0xf11e=['long','getDataValue','preproduction','toString','utf8','BLOB','production','DATE','sequelize','STRING','name'];(function(_0x4f1ed8,_0xf41af7){var _0x5566d5=function(_0x239193){while(--_0x239193){_0x4f1ed8['push'](_0x4f1ed8['shift']());}};_0x5566d5(++_0xf41af7);}(_0xf11e,0x11b));var _0xef11=function(_0x3a2d4e,_0x5f154c){_0x3a2d4e=_0x3a2d4e-0x0;var _0x3c62b8=_0xf11e[_0x3a2d4e];return _0x3c62b8;};'use strict';var Sequelize=require(_0xef11('0x0'));module['exports']={'name':{'type':Sequelize[_0xef11('0x1')],'unique':_0xef11('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xef11('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0xef11('0x3')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0xef11('0x4')](_0xef11('0x5'))[_0xef11('0x6')](_0xef11('0x7'));}}},'production':{'type':Sequelize[_0xef11('0x8')](_0xef11('0x3')),'get':function(){if(this[_0xef11('0x4')]('production')){return this[_0xef11('0x4')](_0xef11('0x9'))[_0xef11('0x6')](_0xef11('0x7'));}}},'savedAt':{'type':Sequelize[_0xef11('0xa')]},'publishedAt':{'type':Sequelize[_0xef11('0xa')]}}; \ No newline at end of file +var _0x74a7=['production','DATE','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8'];(function(_0x1d2cd,_0x5b4e3f){var _0x214827=function(_0x2645b9){while(--_0x2645b9){_0x1d2cd['push'](_0x1d2cd['shift']());}};_0x214827(++_0x5b4e3f);}(_0x74a7,0x91));var _0x774a=function(_0x1ab6b1,_0x430845){_0x1ab6b1=_0x1ab6b1-0x0;var _0x18a719=_0x74a7[_0x1ab6b1];return _0x18a719;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x774a('0x0')],'unique':_0x774a('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x774a('0x2')]},'preproduction':{'type':Sequelize[_0x774a('0x3')](_0x774a('0x4')),'get':function(){if(this[_0x774a('0x5')]('preproduction')){return this[_0x774a('0x5')](_0x774a('0x6'))[_0x774a('0x7')](_0x774a('0x8'));}}},'production':{'type':Sequelize[_0x774a('0x3')](_0x774a('0x4')),'get':function(){if(this['getDataValue'](_0x774a('0x9'))){return this[_0x774a('0x5')](_0x774a('0x9'))[_0x774a('0x7')](_0x774a('0x8'));}}},'savedAt':{'type':Sequelize[_0x774a('0xa')]},'publishedAt':{'type':Sequelize[_0x774a('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 7a75bcd..19040ed 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 _0xcb55=['params','fields','includeAll','include','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','stringify','pick','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','register','status','json','offset','limit','undefined','count','set','Content-Range','update','then','get','SquareProjects','UserProfileResource','destroy','publish','agi','end','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','SquareProject','catch'];(function(_0x2cf79c,_0x7f5674){var _0x395226=function(_0x434710){while(--_0x434710){_0x2cf79c['push'](_0x2cf79c['shift']());}};_0x395226(++_0x7f5674);}(_0xcb55,0x118));var _0x5cb5=function(_0x3bc5f8,_0x18f5f9){_0x3bc5f8=_0x3bc5f8-0x0;var _0x5c0787=_0xcb55[_0x3bc5f8];return _0x5c0787;};'use strict';var _=require(_0x5cb5('0x0'));var Redis=require(_0x5cb5('0x1'));var qs=require(_0x5cb5('0x2'));var logger=require(_0x5cb5('0x3'))(_0x5cb5('0x4'));var config=require(_0x5cb5('0x5'));var db=require('../../mysqldb')['db'];config[_0x5cb5('0x6')]=_[_0x5cb5('0x7')](config['redis'],{'host':_0x5cb5('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5cb5('0x6')]));require('./squareProject.socket')[_0x5cb5('0x9')](socket);function respondWithResult(_0x2f4b67,_0x38db7f){_0x38db7f=_0x38db7f||0xc8;return function(_0x4f4c5e){if(_0x4f4c5e){return _0x2f4b67[_0x5cb5('0xa')](_0x38db7f)[_0x5cb5('0xb')](_0x4f4c5e);}};}function respondWithFilteredResult(_0x18b06b,_0x3b5bf1){return function(_0x2937e0){if(_0x2937e0){var _0x50d9c2=typeof _0x3b5bf1[_0x5cb5('0xc')]==='undefined'&&typeof _0x3b5bf1[_0x5cb5('0xd')]===_0x5cb5('0xe');var _0x208aeb=_0x2937e0[_0x5cb5('0xf')];var _0x40e73e=_0x50d9c2?0x0:_0x3b5bf1[_0x5cb5('0xc')];var _0x2840f7=_0x50d9c2?_0x2937e0[_0x5cb5('0xf')]:_0x3b5bf1[_0x5cb5('0xc')]+_0x3b5bf1[_0x5cb5('0xd')];var _0x3a4add;if(_0x2840f7>=_0x208aeb){_0x2840f7=_0x208aeb;_0x3a4add=0xc8;}else{_0x3a4add=0xce;}_0x18b06b[_0x5cb5('0xa')](_0x3a4add);return _0x18b06b[_0x5cb5('0x10')](_0x5cb5('0x11'),_0x40e73e+'-'+_0x2840f7+'/'+_0x208aeb)[_0x5cb5('0xb')](_0x2937e0);}return null;};}function saveUpdates(_0x2fb9a8){return function(_0x369539){if(_0x369539){return _0x369539[_0x5cb5('0x12')](_0x2fb9a8)[_0x5cb5('0x13')](function(_0x560e5d){return _0x560e5d;});}return null;};}function removeEntity(_0x33ad0f){return function(_0x19072c){if(_0x19072c){return _0x19072c['destroy']()[_0x5cb5('0x13')](function(){var _0x595fd4=_0x19072c[_0x5cb5('0x14')]({'plain':!![]});var _0xf38ee9=_0x5cb5('0x15');return db[_0x5cb5('0x16')][_0x5cb5('0x17')]({'where':{'type':_0xf38ee9,'resourceId':_0x595fd4['id']}})[_0x5cb5('0x13')](function(){return _0x19072c;});})[_0x5cb5('0x13')](function(){var _0x4b0727=new Redis(config[_0x5cb5('0x6')]);_0x4b0727[_0x5cb5('0x18')](_0x5cb5('0x19'),JSON['stringify']({'id':_0x19072c['id'],'deleted':!![]}));})[_0x5cb5('0x13')](function(){_0x33ad0f[_0x5cb5('0xa')](0xcc)[_0x5cb5('0x1a')]();});}};}function handleEntityNotFound(_0x263565){return function(_0x196f7e){if(!_0x196f7e){_0x263565['sendStatus'](0x194);}return _0x196f7e;};}function handleError(_0x42b5cd,_0x4fa889){_0x4fa889=_0x4fa889||0x1f4;return function(_0x47ef66){logger[_0x5cb5('0x1b')](_0x47ef66[_0x5cb5('0x1c')]);if(_0x47ef66['name']){delete _0x47ef66[_0x5cb5('0x1d')];}_0x42b5cd['status'](_0x4fa889)[_0x5cb5('0x1e')](_0x47ef66);};}exports[_0x5cb5('0x1f')]=function(_0x217b8d,_0x18d92c){var _0x3f55c5={},_0xdda563={},_0x270740={'count':0x0,'rows':[]};var _0x3ea0c2=_[_0x5cb5('0x20')](db['SquareProject'][_0x5cb5('0x21')],function(_0x1b00e2){return{'name':_0x1b00e2['fieldName'],'type':_0x1b00e2[_0x5cb5('0x22')][_0x5cb5('0x23')]};});_0xdda563[_0x5cb5('0x24')]=_[_0x5cb5('0x20')](_0x3ea0c2,_0x5cb5('0x1d'));_0xdda563['query']=_[_0x5cb5('0x25')](_0x217b8d[_0x5cb5('0x26')]);_0xdda563[_0x5cb5('0x27')]=_[_0x5cb5('0x28')](_0xdda563[_0x5cb5('0x24')],_0xdda563['query']);_0x3f55c5[_0x5cb5('0x29')]=_[_0x5cb5('0x28')](_0xdda563[_0x5cb5('0x24')],qs['fields'](_0x217b8d[_0x5cb5('0x26')]['fields']));_0x3f55c5[_0x5cb5('0x29')]=_0x3f55c5[_0x5cb5('0x29')]['length']?_0x3f55c5[_0x5cb5('0x29')]:_0xdda563[_0x5cb5('0x24')];if(!_0x217b8d[_0x5cb5('0x26')][_0x5cb5('0x2a')](_0x5cb5('0x2b'))){_0x3f55c5[_0x5cb5('0xd')]=qs[_0x5cb5('0xd')](_0x217b8d[_0x5cb5('0x26')][_0x5cb5('0xd')]);_0x3f55c5[_0x5cb5('0xc')]=qs[_0x5cb5('0xc')](_0x217b8d['query'][_0x5cb5('0xc')]);}_0x3f55c5[_0x5cb5('0x2c')]=qs['sort'](_0x217b8d['query']['sort']);_0x3f55c5[_0x5cb5('0x2d')]=qs['filters'](_['pick'](_0x217b8d['query'],_0xdda563[_0x5cb5('0x27')]),_0x3ea0c2);if(_0x217b8d[_0x5cb5('0x26')]['filter']){_0x3f55c5[_0x5cb5('0x2d')]=_[_0x5cb5('0x2e')](_0x3f55c5[_0x5cb5('0x2d')],{'$or':_[_0x5cb5('0x20')](_0x3ea0c2,function(_0x46a7e0){if(_0x46a7e0[_0x5cb5('0x22')]!==_0x5cb5('0x2f')){var _0x35cd1e={};_0x35cd1e[_0x46a7e0[_0x5cb5('0x1d')]]={'$like':'%'+_0x217b8d[_0x5cb5('0x26')]['filter']+'%'};return _0x35cd1e;}})});}_0x3f55c5=_[_0x5cb5('0x2e')]({},_0x3f55c5,_0x217b8d['options']);var _0x1c798a={'where':_0x3f55c5[_0x5cb5('0x2d')]};return db[_0x5cb5('0x30')][_0x5cb5('0xf')](_0x1c798a)[_0x5cb5('0x13')](function(_0x26c756){_0x270740[_0x5cb5('0xf')]=_0x26c756;if(_0x217b8d['query']['includeAll']){_0x3f55c5['include']=[{'all':!![]}];}return db[_0x5cb5('0x30')]['findAll'](_0x3f55c5);})[_0x5cb5('0x13')](function(_0x56d41b){_0x270740['rows']=_0x56d41b;return _0x270740;})[_0x5cb5('0x13')](respondWithFilteredResult(_0x18d92c,_0x3f55c5))[_0x5cb5('0x31')](handleError(_0x18d92c,null));};exports['show']=function(_0x5072ee,_0x5eb6ad){var _0x128de7={'raw':![],'where':{'id':_0x5072ee[_0x5cb5('0x32')]['id']}},_0x247e36={};_0x247e36['model']=_[_0x5cb5('0x25')](db['SquareProject']['rawAttributes']);_0x247e36[_0x5cb5('0x26')]=_['keys'](_0x5072ee[_0x5cb5('0x26')]);_0x247e36[_0x5cb5('0x27')]=_[_0x5cb5('0x28')](_0x247e36[_0x5cb5('0x24')],_0x247e36[_0x5cb5('0x26')]);_0x128de7[_0x5cb5('0x29')]=_[_0x5cb5('0x28')](_0x247e36['model'],qs['fields'](_0x5072ee[_0x5cb5('0x26')][_0x5cb5('0x33')]));_0x128de7[_0x5cb5('0x29')]=_0x128de7[_0x5cb5('0x29')]['length']?_0x128de7['attributes']:_0x247e36['model'];if(_0x5072ee['query'][_0x5cb5('0x34')]){_0x128de7[_0x5cb5('0x35')]=[{'all':!![]}];}_0x128de7=_[_0x5cb5('0x2e')]({},_0x128de7,_0x5072ee[_0x5cb5('0x36')]);return db[_0x5cb5('0x30')][_0x5cb5('0x37')](_0x128de7)[_0x5cb5('0x13')](handleEntityNotFound(_0x5eb6ad,null))[_0x5cb5('0x13')](respondWithResult(_0x5eb6ad,null))[_0x5cb5('0x31')](handleError(_0x5eb6ad,null));};exports[_0x5cb5('0x38')]=function(_0x5648b0,_0x1c747c){return db[_0x5cb5('0x30')]['create'](_0x5648b0['body'],{})[_0x5cb5('0x13')](function(_0x84468e){var _0x4dd1a1=_0x5648b0['user'][_0x5cb5('0x14')]({'plain':!![]});if(!_0x4dd1a1)throw new Error(_0x5cb5('0x39'));if(_0x4dd1a1[_0x5cb5('0x3a')]==='user'){var _0x1b6860=_0x84468e[_0x5cb5('0x14')]({'plain':!![]});var _0x1cd187='SquareProjects';return db['UserProfileSection']['find']({'where':{'name':_0x1cd187,'userProfileId':_0x4dd1a1[_0x5cb5('0x3b')]},'raw':!![]})[_0x5cb5('0x13')](function(_0x47e672){if(_0x47e672&&_0x47e672[_0x5cb5('0x3c')]===0x0){return db[_0x5cb5('0x16')][_0x5cb5('0x38')]({'name':_0x1b6860['name'],'resourceId':_0x1b6860['id'],'type':_0x47e672[_0x5cb5('0x1d')],'sectionId':_0x47e672['id']},{})[_0x5cb5('0x13')](function(){return _0x84468e;});}else{return _0x84468e;}})['catch'](function(_0x372f11){logger[_0x5cb5('0x1b')](_0x5cb5('0x3d'),_0x372f11);throw _0x372f11;});}return _0x84468e;})[_0x5cb5('0x13')](respondWithResult(_0x1c747c,0xc9))[_0x5cb5('0x31')](handleError(_0x1c747c,null));};exports[_0x5cb5('0x12')]=function(_0x5502b5,_0x44fef8){if(_0x5502b5[_0x5cb5('0x3e')]['id']){delete _0x5502b5[_0x5cb5('0x3e')]['id'];}return db[_0x5cb5('0x30')]['find']({'where':{'id':_0x5502b5[_0x5cb5('0x32')]['id']}})[_0x5cb5('0x13')](handleEntityNotFound(_0x44fef8,null))[_0x5cb5('0x13')](saveUpdates(_0x5502b5[_0x5cb5('0x3e')],null))['then'](function(_0x1c998b){if(!_0x1c998b)return;var _0x2f1de9=_0x1c998b[_0x5cb5('0x14')]({'plain':!![]});return _0x2f1de9;})[_0x5cb5('0x13')](function(_0x3aa8d7){var _0x284a14=new Redis(config[_0x5cb5('0x6')]);_0x284a14[_0x5cb5('0x18')](_0x5cb5('0x19'),JSON[_0x5cb5('0x3f')](_[_0x5cb5('0x40')](_0x3aa8d7,['id',_0x5cb5('0x1d'),_0x5cb5('0x41')])));return _0x3aa8d7;})[_0x5cb5('0x13')](respondWithResult(_0x44fef8,null))['catch'](handleError(_0x44fef8,null));};exports[_0x5cb5('0x17')]=function(_0x326bc6,_0xfa74ef){return db['SquareProject'][_0x5cb5('0x37')]({'where':{'id':_0x326bc6[_0x5cb5('0x32')]['id']}})['then'](handleEntityNotFound(_0xfa74ef,null))['then'](removeEntity(_0xfa74ef,null))[_0x5cb5('0x31')](handleError(_0xfa74ef,null));}; \ No newline at end of file +var _0x12d7=['update','then','destroy','get','SquareProjects','publish','agi','stringify','sendStatus','name','send','index','map','SquareProject','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','where','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','production','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','redis','./squareProject.socket','status','json','offset','limit','undefined','count','set'];(function(_0x713978,_0x1a9ddf){var _0x2730ee=function(_0x35d6df){while(--_0x35d6df){_0x713978['push'](_0x713978['shift']());}};_0x2730ee(++_0x1a9ddf);}(_0x12d7,0x139));var _0x712d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x712d('0x0'));var Redis=require(_0x712d('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x712d('0x2'))(_0x712d('0x3'));var config=require(_0x712d('0x4'));var db=require(_0x712d('0x5'))['db'];config['redis']=_[_0x712d('0x6')](config['redis'],{'host':_0x712d('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x712d('0x8')]));require(_0x712d('0x9'))['register'](socket);function respondWithResult(_0x1c7a59,_0x2e642b){_0x2e642b=_0x2e642b||0xc8;return function(_0x1038e9){if(_0x1038e9){return _0x1c7a59[_0x712d('0xa')](_0x2e642b)[_0x712d('0xb')](_0x1038e9);}};}function respondWithFilteredResult(_0x5e5491,_0xd2ba46){return function(_0x3e9056){if(_0x3e9056){var _0x17436a=typeof _0xd2ba46[_0x712d('0xc')]==='undefined'&&typeof _0xd2ba46[_0x712d('0xd')]===_0x712d('0xe');var _0x3825cb=_0x3e9056['count'];var _0x88f9c8=_0x17436a?0x0:_0xd2ba46[_0x712d('0xc')];var _0x5027dc=_0x17436a?_0x3e9056[_0x712d('0xf')]:_0xd2ba46['offset']+_0xd2ba46['limit'];var _0x100166;if(_0x5027dc>=_0x3825cb){_0x5027dc=_0x3825cb;_0x100166=0xc8;}else{_0x100166=0xce;}_0x5e5491[_0x712d('0xa')](_0x100166);return _0x5e5491[_0x712d('0x10')]('Content-Range',_0x88f9c8+'-'+_0x5027dc+'/'+_0x3825cb)[_0x712d('0xb')](_0x3e9056);}return null;};}function saveUpdates(_0xfcba3b){return function(_0x20d0c1){if(_0x20d0c1){return _0x20d0c1[_0x712d('0x11')](_0xfcba3b)[_0x712d('0x12')](function(_0x4c7cd3){return _0x4c7cd3;});}return null;};}function removeEntity(_0xb9e8a){return function(_0x48c388){if(_0x48c388){return _0x48c388[_0x712d('0x13')]()[_0x712d('0x12')](function(){var _0x576216=_0x48c388[_0x712d('0x14')]({'plain':!![]});var _0x50adcb=_0x712d('0x15');return db['UserProfileResource'][_0x712d('0x13')]({'where':{'type':_0x50adcb,'resourceId':_0x576216['id']}})['then'](function(){return _0x48c388;});})[_0x712d('0x12')](function(){var _0x3557f5=new Redis(config['redis']);_0x3557f5[_0x712d('0x16')](_0x712d('0x17'),JSON[_0x712d('0x18')]({'id':_0x48c388['id'],'deleted':!![]}));})[_0x712d('0x12')](function(){_0xb9e8a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c5d8a){return function(_0x5980e8){if(!_0x5980e8){_0x1c5d8a[_0x712d('0x19')](0x194);}return _0x5980e8;};}function handleError(_0x338cbc,_0x4c0a45){_0x4c0a45=_0x4c0a45||0x1f4;return function(_0x2720e9){logger['error'](_0x2720e9['stack']);if(_0x2720e9[_0x712d('0x1a')]){delete _0x2720e9[_0x712d('0x1a')];}_0x338cbc[_0x712d('0xa')](_0x4c0a45)[_0x712d('0x1b')](_0x2720e9);};}exports[_0x712d('0x1c')]=function(_0x32b467,_0x4f7ee1){var _0x294b38={},_0x5a8069={},_0x4d3ab8={'count':0x0,'rows':[]};var _0x657952=_[_0x712d('0x1d')](db[_0x712d('0x1e')]['rawAttributes'],function(_0x4f0600){return{'name':_0x4f0600[_0x712d('0x1f')],'type':_0x4f0600[_0x712d('0x20')][_0x712d('0x21')]};});_0x5a8069['model']=_['map'](_0x657952,_0x712d('0x1a'));_0x5a8069[_0x712d('0x22')]=_[_0x712d('0x23')](_0x32b467[_0x712d('0x22')]);_0x5a8069[_0x712d('0x24')]=_['intersection'](_0x5a8069[_0x712d('0x25')],_0x5a8069['query']);_0x294b38['attributes']=_[_0x712d('0x26')](_0x5a8069['model'],qs[_0x712d('0x27')](_0x32b467[_0x712d('0x22')]['fields']));_0x294b38[_0x712d('0x28')]=_0x294b38[_0x712d('0x28')][_0x712d('0x29')]?_0x294b38['attributes']:_0x5a8069[_0x712d('0x25')];if(!_0x32b467[_0x712d('0x22')][_0x712d('0x2a')]('nolimit')){_0x294b38[_0x712d('0xd')]=qs['limit'](_0x32b467['query'][_0x712d('0xd')]);_0x294b38[_0x712d('0xc')]=qs['offset'](_0x32b467['query']['offset']);}_0x294b38[_0x712d('0x2b')]=qs[_0x712d('0x2c')](_0x32b467[_0x712d('0x22')][_0x712d('0x2c')]);_0x294b38['where']=qs[_0x712d('0x24')](_[_0x712d('0x2d')](_0x32b467[_0x712d('0x22')],_0x5a8069[_0x712d('0x24')]),_0x657952);if(_0x32b467['query'][_0x712d('0x2e')]){_0x294b38['where']=_[_0x712d('0x2f')](_0x294b38['where'],{'$or':_[_0x712d('0x1d')](_0x657952,function(_0xf1566d){if(_0xf1566d[_0x712d('0x20')]!==_0x712d('0x30')){var _0x2831fa={};_0x2831fa[_0xf1566d['name']]={'$like':'%'+_0x32b467['query'][_0x712d('0x2e')]+'%'};return _0x2831fa;}})});}_0x294b38=_['merge']({},_0x294b38,_0x32b467['options']);var _0x4d6986={'where':_0x294b38[_0x712d('0x31')]};return db['SquareProject'][_0x712d('0xf')](_0x4d6986)[_0x712d('0x12')](function(_0x1e9aa1){_0x4d3ab8[_0x712d('0xf')]=_0x1e9aa1;if(_0x32b467['query'][_0x712d('0x32')]){_0x294b38[_0x712d('0x33')]=[{'all':!![]}];}return db[_0x712d('0x1e')][_0x712d('0x34')](_0x294b38);})[_0x712d('0x12')](function(_0x5b7b51){_0x4d3ab8[_0x712d('0x35')]=_0x5b7b51;return _0x4d3ab8;})['then'](respondWithFilteredResult(_0x4f7ee1,_0x294b38))[_0x712d('0x36')](handleError(_0x4f7ee1,null));};exports['show']=function(_0x54d497,_0x1dbce7){var _0x5f29de={'raw':![],'where':{'id':_0x54d497[_0x712d('0x37')]['id']}},_0x4dfe1b={};_0x4dfe1b[_0x712d('0x25')]=_[_0x712d('0x23')](db[_0x712d('0x1e')][_0x712d('0x38')]);_0x4dfe1b['query']=_['keys'](_0x54d497[_0x712d('0x22')]);_0x4dfe1b[_0x712d('0x24')]=_[_0x712d('0x26')](_0x4dfe1b[_0x712d('0x25')],_0x4dfe1b['query']);_0x5f29de[_0x712d('0x28')]=_['intersection'](_0x4dfe1b[_0x712d('0x25')],qs[_0x712d('0x27')](_0x54d497['query'][_0x712d('0x27')]));_0x5f29de['attributes']=_0x5f29de[_0x712d('0x28')][_0x712d('0x29')]?_0x5f29de['attributes']:_0x4dfe1b[_0x712d('0x25')];if(_0x54d497['query']['includeAll']){_0x5f29de[_0x712d('0x33')]=[{'all':!![]}];}_0x5f29de=_[_0x712d('0x2f')]({},_0x5f29de,_0x54d497[_0x712d('0x39')]);return db[_0x712d('0x1e')][_0x712d('0x3a')](_0x5f29de)['then'](handleEntityNotFound(_0x1dbce7,null))[_0x712d('0x12')](respondWithResult(_0x1dbce7,null))[_0x712d('0x36')](handleError(_0x1dbce7,null));};exports[_0x712d('0x3b')]=function(_0x298efe,_0x1fca83){return db[_0x712d('0x1e')][_0x712d('0x3b')](_0x298efe['body'],{})[_0x712d('0x12')](function(_0x17bfb2){var _0x415ea2=_0x298efe[_0x712d('0x3c')]['get']({'plain':!![]});if(!_0x415ea2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x415ea2['role']===_0x712d('0x3c')){var _0x44dcf8=_0x17bfb2[_0x712d('0x14')]({'plain':!![]});var _0x1645f7=_0x712d('0x15');return db['UserProfileSection'][_0x712d('0x3a')]({'where':{'name':_0x1645f7,'userProfileId':_0x415ea2['userProfileId']},'raw':!![]})[_0x712d('0x12')](function(_0x122e1c){if(_0x122e1c&&_0x122e1c[_0x712d('0x3d')]===0x0){return db['UserProfileResource'][_0x712d('0x3b')]({'name':_0x44dcf8[_0x712d('0x1a')],'resourceId':_0x44dcf8['id'],'type':_0x122e1c[_0x712d('0x1a')],'sectionId':_0x122e1c['id']},{})[_0x712d('0x12')](function(){return _0x17bfb2;});}else{return _0x17bfb2;}})[_0x712d('0x36')](function(_0x599574){logger[_0x712d('0x3e')](_0x712d('0x3f'),_0x599574);throw _0x599574;});}return _0x17bfb2;})[_0x712d('0x12')](respondWithResult(_0x1fca83,0xc9))[_0x712d('0x36')](handleError(_0x1fca83,null));};exports[_0x712d('0x11')]=function(_0x581ee2,_0x545240){if(_0x581ee2['body']['id']){delete _0x581ee2[_0x712d('0x40')]['id'];}return db[_0x712d('0x1e')]['find']({'where':{'id':_0x581ee2[_0x712d('0x37')]['id']}})[_0x712d('0x12')](handleEntityNotFound(_0x545240,null))['then'](saveUpdates(_0x581ee2['body'],null))[_0x712d('0x12')](function(_0x346770){if(!_0x346770)return;var _0x14f8d9=_0x346770[_0x712d('0x14')]({'plain':!![]});return _0x14f8d9;})[_0x712d('0x12')](function(_0xf41218){var _0x1e9887=new Redis(config[_0x712d('0x8')]);_0x1e9887[_0x712d('0x16')](_0x712d('0x17'),JSON[_0x712d('0x18')](_[_0x712d('0x2d')](_0xf41218,['id','name',_0x712d('0x41')])));return _0xf41218;})[_0x712d('0x12')](respondWithResult(_0x545240,null))['catch'](handleError(_0x545240,null));};exports[_0x712d('0x13')]=function(_0xa87279,_0x57cbc8){return db[_0x712d('0x1e')][_0x712d('0x3a')]({'where':{'id':_0xa87279[_0x712d('0x37')]['id']}})[_0x712d('0x12')](handleEntityNotFound(_0x57cbc8,null))[_0x712d('0x12')](removeEntity(_0x57cbc8,null))[_0x712d('0x36')](handleError(_0x57cbc8,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index ce85bac..7341971 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 _0xf50a=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3a67a5,_0x5d25b3){var _0x309e23=function(_0x5e646b){while(--_0x5e646b){_0x3a67a5['push'](_0x3a67a5['shift']());}};_0x309e23(++_0x5d25b3);}(_0xf50a,0xbc));var _0xaf50=function(_0xf4eae3,_0x438eba){_0xf4eae3=_0xf4eae3-0x0;var _0x441c2a=_0xf50a[_0xf4eae3];return _0x441c2a;};'use strict';var EventEmitter=require(_0xaf50('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xaf50('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xaf50('0x2')};function emitEvent(_0x3ef771){return function(_0x384e45,_0x345686,_0x197139){SquareProjectEvents[_0xaf50('0x3')](_0x3ef771+':'+_0x384e45['id'],_0x384e45);SquareProjectEvents[_0xaf50('0x3')](_0x3ef771,_0x384e45);_0x197139(null);};}for(var e in events){if(events[_0xaf50('0x4')](e)){var event=events[e];SquareProject[_0xaf50('0x5')](e,emitEvent(event));}}module[_0xaf50('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0xe4f4=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe4f4,0xb5));var _0x4e4f=function(_0x50a864,_0x3303e2){_0x50a864=_0x50a864-0x0;var _0x2fb82f=_0xe4f4[_0x50a864];return _0x2fb82f;};'use strict';var EventEmitter=require(_0x4e4f('0x0'));var SquareProject=require(_0x4e4f('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x4e4f('0x2')](0x0);var events={'afterCreate':_0x4e4f('0x3'),'afterUpdate':_0x4e4f('0x4'),'afterDestroy':_0x4e4f('0x5')};function emitEvent(_0x4cfaa8){return function(_0x5df9e7,_0x3bbba1,_0x349d1f){SquareProjectEvents[_0x4e4f('0x6')](_0x4cfaa8+':'+_0x5df9e7['id'],_0x5df9e7);SquareProjectEvents[_0x4e4f('0x6')](_0x4cfaa8,_0x5df9e7);_0x349d1f(null);};}for(var e in events){if(events[_0x4e4f('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x4e4f('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index f482011..630b6eb 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 _0x7028=['SquareProject','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','moment','request-promise','./squareProject.attributes','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7028,0xad));var _0x8702=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0x7028[_0x11946c];return _0x383935;};'use strict';var _=require(_0x8702('0x0'));var util=require(_0x8702('0x1'));var logger=require(_0x8702('0x2'))('api');var moment=require(_0x8702('0x3'));var BPromise=require('bluebird');var rp=require(_0x8702('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8702('0x5'));module[_0x8702('0x6')]=function(_0x381929,_0x3ebb0c){return _0x381929['define'](_0x8702('0x7'),attributes,{'tableName':_0x8702('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x343fac,_0x127cc9,_0x3101b2){if(_0x343fac[_0x8702('0x9')]('preproduction')){_0x343fac[_0x8702('0xa')]=moment()[_0x8702('0xb')](_0x8702('0xc'));}if(_0x343fac[_0x8702('0x9')](_0x8702('0xd'))){_0x343fac[_0x8702('0xe')]=moment()[_0x8702('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3101b2(null,_0x343fac);}}});}; \ No newline at end of file +var _0xfc5c=['YYYY-MM-DD\x20HH:mm:ss','publishedAt','../../config/logger','api','moment','path','rimraf','../../config/environment','define','SquareProject','square_projects','changed','preproduction','savedAt','format'];(function(_0x1bb161,_0x25b93c){var _0x2d4246=function(_0x1bac38){while(--_0x1bac38){_0x1bb161['push'](_0x1bb161['shift']());}};_0x2d4246(++_0x25b93c);}(_0xfc5c,0x16a));var _0xcfc5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfc5c[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcfc5('0x0'))(_0xcfc5('0x1'));var moment=require(_0xcfc5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcfc5('0x3'));var rimraf=require(_0xcfc5('0x4'));var config=require(_0xcfc5('0x5'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x5abb6a,_0x2a2181){return _0x5abb6a[_0xcfc5('0x6')](_0xcfc5('0x7'),attributes,{'tableName':_0xcfc5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e6215,_0x1aa947,_0x4fe46e){if(_0x5e6215[_0xcfc5('0x9')](_0xcfc5('0xa'))){_0x5e6215[_0xcfc5('0xb')]=moment()[_0xcfc5('0xc')](_0xcfc5('0xd'));}if(_0x5e6215[_0xcfc5('0x9')]('production')){_0x5e6215[_0xcfc5('0xe')]=moment()[_0xcfc5('0xc')](_0xcfc5('0xd'));}_0x4fe46e(null,_0x5e6215);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 4fd1964..b973630 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 _0x67e3=['socket.io-emitter','./squareProject.socket','register','SquareProject','findAll','options','attributes','limit','include','map','model','then','GetSquareProjects','debug','catch','error','message','ShowSquareProject','raw','where','info','lodash','rpc','../../config/environment','redis','localhost'];(function(_0x375cf6,_0x59035b){var _0x4c2e44=function(_0x1b29bd){while(--_0x1b29bd){_0x375cf6['push'](_0x375cf6['shift']());}};_0x4c2e44(++_0x59035b);}(_0x67e3,0x1cf));var _0x367e=function(_0x19b38f,_0x238654){_0x19b38f=_0x19b38f-0x0;var _0xe9e49a=_0x67e3[_0x19b38f];return _0xe9e49a;};'use strict';var _=require(_0x367e('0x0'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x367e('0x1'));var config=require(_0x367e('0x2'));config[_0x367e('0x3')]=_['defaults'](config[_0x367e('0x3')],{'host':_0x367e('0x4'),'port':0x18eb});var socket=require(_0x367e('0x5'))(new Redis(config[_0x367e('0x3')]));require(_0x367e('0x6'))[_0x367e('0x7')](socket);exports['GetSquareProjects']=function(_0x5207d3){var _0x1e0a81=this;return new Promise(function(_0x4ac9c5,_0x3e5d88){return db[_0x367e('0x8')][_0x367e('0x9')]({'raw':_0x5207d3[_0x367e('0xa')]?_0x5207d3[_0x367e('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x5207d3[_0x367e('0xa')]?_0x5207d3[_0x367e('0xa')]['where']||null:null,'attributes':_0x5207d3[_0x367e('0xa')]?_0x5207d3[_0x367e('0xa')][_0x367e('0xb')]||null:null,'limit':_0x5207d3['options']?_0x5207d3[_0x367e('0xa')][_0x367e('0xc')]||null:null,'include':_0x5207d3['options']?_0x5207d3[_0x367e('0xa')][_0x367e('0xd')]?_[_0x367e('0xe')](_0x5207d3[_0x367e('0xa')][_0x367e('0xd')],function(_0x2f5cd1){return{'model':db[_0x2f5cd1['model']],'as':_0x2f5cd1['as'],'attributes':_0x2f5cd1['attributes'],'include':_0x2f5cd1[_0x367e('0xd')]?_[_0x367e('0xe')](_0x2f5cd1[_0x367e('0xd')],function(_0x31f4c2){return{'model':db[_0x31f4c2[_0x367e('0xf')]],'as':_0x31f4c2['as'],'attributes':_0x31f4c2[_0x367e('0xb')],'include':_0x31f4c2[_0x367e('0xd')]?_['map'](_0x31f4c2[_0x367e('0xd')],function(_0x2abc0b){return{'model':db[_0x2abc0b[_0x367e('0xf')]],'as':_0x2abc0b['as'],'attributes':_0x2abc0b[_0x367e('0xb')]};}):[]};}):[]};}):[]:[]})[_0x367e('0x10')](function(_0x20b43c){logger['info'](_0x367e('0x11'),_0x5207d3);logger[_0x367e('0x12')](_0x367e('0x11'),_0x5207d3,JSON['stringify'](_0x20b43c));_0x4ac9c5(_0x20b43c);})[_0x367e('0x13')](function(_0x20bc57){logger[_0x367e('0x14')](_0x367e('0x11'),_0x20bc57[_0x367e('0x15')],_0x5207d3);_0x3e5d88(_0x1e0a81[_0x367e('0x14')](0x1f4,_0x20bc57['message']));});});};exports[_0x367e('0x16')]=function(_0x2be759){var _0x49d560=this;return new Promise(function(_0x1a9cca,_0x4e4a53){return db['SquareProject']['find']({'raw':_0x2be759[_0x367e('0xa')]?_0x2be759[_0x367e('0xa')][_0x367e('0x17')]===undefined?!![]:![]:!![],'where':_0x2be759['options']?_0x2be759[_0x367e('0xa')][_0x367e('0x18')]||null:null,'attributes':_0x2be759[_0x367e('0xa')]?_0x2be759['options'][_0x367e('0xb')]||null:null,'include':_0x2be759[_0x367e('0xa')]?_0x2be759[_0x367e('0xa')]['include']?_[_0x367e('0xe')](_0x2be759['options'][_0x367e('0xd')],function(_0x4cfc51){return{'model':db[_0x4cfc51[_0x367e('0xf')]],'as':_0x4cfc51['as'],'attributes':_0x4cfc51['attributes'],'include':_0x4cfc51[_0x367e('0xd')]?_[_0x367e('0xe')](_0x4cfc51[_0x367e('0xd')],function(_0x1e4bb9){return{'model':db[_0x1e4bb9[_0x367e('0xf')]],'as':_0x1e4bb9['as'],'attributes':_0x1e4bb9[_0x367e('0xb')],'include':_0x1e4bb9[_0x367e('0xd')]?_[_0x367e('0xe')](_0x1e4bb9[_0x367e('0xd')],function(_0x1d2336){return{'model':db[_0x1d2336['model']],'as':_0x1d2336['as'],'attributes':_0x1d2336[_0x367e('0xb')]};}):[]};}):[]};}):[]:[]})[_0x367e('0x10')](function(_0x49af0d){logger[_0x367e('0x19')](_0x367e('0x16'),_0x2be759);logger[_0x367e('0x12')]('ShowSquareProject',_0x2be759,JSON['stringify'](_0x49af0d));_0x1a9cca(_0x49af0d);})[_0x367e('0x13')](function(_0x13c2be){logger[_0x367e('0x14')](_0x367e('0x16'),_0x13c2be['message'],_0x2be759);_0x4e4a53(_0x49d560[_0x367e('0x14')](0x1f4,_0x13c2be[_0x367e('0x15')]));});});}; \ No newline at end of file +var _0x105d=['where','attributes','limit','include','map','model','then','info','debug','stringify','message','error','find','raw','ShowSquareProject','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options'];(function(_0x5344c0,_0x4ff180){var _0x25f1e4=function(_0x50e709){while(--_0x50e709){_0x5344c0['push'](_0x5344c0['shift']());}};_0x25f1e4(++_0x4ff180);}(_0x105d,0x1e0));var _0xd105=function(_0x51a004,_0x504f1b){_0x51a004=_0x51a004-0x0;var _0x4403a1=_0x105d[_0x51a004];return _0x4403a1;};'use strict';var _=require(_0xd105('0x0'));var Redis=require(_0xd105('0x1'));var db=require(_0xd105('0x2'))['db'];var logger=require(_0xd105('0x3'))(_0xd105('0x4'));var config=require(_0xd105('0x5'));config[_0xd105('0x6')]=_['defaults'](config[_0xd105('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd105('0x6')]));require(_0xd105('0x7'))[_0xd105('0x8')](socket);exports[_0xd105('0x9')]=function(_0x3758cc){var _0x151b67=this;return new Promise(function(_0x754dab,_0xf569f0){return db[_0xd105('0xa')][_0xd105('0xb')]({'raw':_0x3758cc['options']?_0x3758cc['options']['raw']===undefined?!![]:![]:!![],'where':_0x3758cc[_0xd105('0xc')]?_0x3758cc[_0xd105('0xc')][_0xd105('0xd')]||null:null,'attributes':_0x3758cc[_0xd105('0xc')]?_0x3758cc[_0xd105('0xc')][_0xd105('0xe')]||null:null,'limit':_0x3758cc['options']?_0x3758cc[_0xd105('0xc')][_0xd105('0xf')]||null:null,'include':_0x3758cc[_0xd105('0xc')]?_0x3758cc[_0xd105('0xc')][_0xd105('0x10')]?_[_0xd105('0x11')](_0x3758cc['options'][_0xd105('0x10')],function(_0x25758d){return{'model':db[_0x25758d[_0xd105('0x12')]],'as':_0x25758d['as'],'attributes':_0x25758d[_0xd105('0xe')],'include':_0x25758d['include']?_[_0xd105('0x11')](_0x25758d['include'],function(_0x4bbe18){return{'model':db[_0x4bbe18[_0xd105('0x12')]],'as':_0x4bbe18['as'],'attributes':_0x4bbe18[_0xd105('0xe')],'include':_0x4bbe18[_0xd105('0x10')]?_[_0xd105('0x11')](_0x4bbe18[_0xd105('0x10')],function(_0x40ff20){return{'model':db[_0x40ff20['model']],'as':_0x40ff20['as'],'attributes':_0x40ff20['attributes']};}):[]};}):[]};}):[]:[]})[_0xd105('0x13')](function(_0x286c3a){logger[_0xd105('0x14')](_0xd105('0x9'),_0x3758cc);logger[_0xd105('0x15')](_0xd105('0x9'),_0x3758cc,JSON[_0xd105('0x16')](_0x286c3a));_0x754dab(_0x286c3a);})['catch'](function(_0x25c4ae){logger['error'](_0xd105('0x9'),_0x25c4ae[_0xd105('0x17')],_0x3758cc);_0xf569f0(_0x151b67[_0xd105('0x18')](0x1f4,_0x25c4ae[_0xd105('0x17')]));});});};exports['ShowSquareProject']=function(_0x56d4e5){var _0x2aa80c=this;return new Promise(function(_0x432dd8,_0x27cbe0){return db[_0xd105('0xa')][_0xd105('0x19')]({'raw':_0x56d4e5['options']?_0x56d4e5[_0xd105('0xc')][_0xd105('0x1a')]===undefined?!![]:![]:!![],'where':_0x56d4e5[_0xd105('0xc')]?_0x56d4e5[_0xd105('0xc')][_0xd105('0xd')]||null:null,'attributes':_0x56d4e5[_0xd105('0xc')]?_0x56d4e5['options'][_0xd105('0xe')]||null:null,'include':_0x56d4e5[_0xd105('0xc')]?_0x56d4e5[_0xd105('0xc')][_0xd105('0x10')]?_['map'](_0x56d4e5[_0xd105('0xc')][_0xd105('0x10')],function(_0x1dc05e){return{'model':db[_0x1dc05e['model']],'as':_0x1dc05e['as'],'attributes':_0x1dc05e[_0xd105('0xe')],'include':_0x1dc05e['include']?_[_0xd105('0x11')](_0x1dc05e[_0xd105('0x10')],function(_0x2157e3){return{'model':db[_0x2157e3[_0xd105('0x12')]],'as':_0x2157e3['as'],'attributes':_0x2157e3[_0xd105('0xe')],'include':_0x2157e3[_0xd105('0x10')]?_[_0xd105('0x11')](_0x2157e3['include'],function(_0x2e0bba){return{'model':db[_0x2e0bba['model']],'as':_0x2e0bba['as'],'attributes':_0x2e0bba['attributes']};}):[]};}):[]};}):[]:[]})[_0xd105('0x13')](function(_0xf37ad6){logger[_0xd105('0x14')]('ShowSquareProject',_0x56d4e5);logger[_0xd105('0x15')](_0xd105('0x1b'),_0x56d4e5,JSON[_0xd105('0x16')](_0xf37ad6));_0x432dd8(_0xf37ad6);})[_0xd105('0x1c')](function(_0x504aee){logger[_0xd105('0x18')](_0xd105('0x1b'),_0x504aee['message'],_0x56d4e5);_0x27cbe0(_0x2aa80c['error'](0x1f4,_0x504aee[_0xd105('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 2372a65..d5e5068 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 _0xa9af=['squareProject:','./squareProject.events','save','update','emit','removeListener'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa9af,0x17b));var _0xfa9a=function(_0x539505,_0x570ec5){_0x539505=_0x539505-0x0;var _0x3ac150=_0xa9af[_0x539505];return _0x3ac150;};'use strict';var SquareProjectEvents=require(_0xfa9a('0x0'));var events=[_0xfa9a('0x1'),'remove',_0xfa9a('0x2')];function createListener(_0x43733b,_0x3c4f31){return function(_0x7274e7){_0x3c4f31[_0xfa9a('0x3')](_0x43733b,_0x7274e7);};}function removeListener(_0x2282e0,_0x56c72c){return function(){SquareProjectEvents[_0xfa9a('0x4')](_0x2282e0,_0x56c72c);};}exports['register']=function(_0x3fadff){for(var _0x5a4208=0x0,_0x255c8f=events['length'];_0x5a4208<_0x255c8f;_0x5a4208++){var _0x1e816c=events[_0x5a4208];var _0x1f1f87=createListener(_0xfa9a('0x5')+_0x1e816c,_0x3fadff);SquareProjectEvents['on'](_0x1e816c,_0x1f1f87);}}; \ No newline at end of file +var _0x862d=['length','squareProject:','./squareProject.events','update','emit','removeListener','register'];(function(_0x33ac17,_0x536bda){var _0x3a84aa=function(_0x319170){while(--_0x319170){_0x33ac17['push'](_0x33ac17['shift']());}};_0x3a84aa(++_0x536bda);}(_0x862d,0x113));var _0xd862=function(_0x26057a,_0x8e9804){_0x26057a=_0x26057a-0x0;var _0x44ca29=_0x862d[_0x26057a];return _0x44ca29;};'use strict';var SquareProjectEvents=require(_0xd862('0x0'));var events=['save','remove',_0xd862('0x1')];function createListener(_0x3debf8,_0x1afe1a){return function(_0x544c1a){_0x1afe1a[_0xd862('0x2')](_0x3debf8,_0x544c1a);};}function removeListener(_0x8ddfc7,_0x2d3e4c){return function(){SquareProjectEvents[_0xd862('0x3')](_0x8ddfc7,_0x2d3e4c);};}exports[_0xd862('0x4')]=function(_0x5aa7a0){for(var _0x2d9b87=0x0,_0x3cbc63=events[_0xd862('0x5')];_0x2d9b87<_0x3cbc63;_0x2d9b87++){var _0xf63591=events[_0x2d9b87];var _0x32b157=createListener(_0xd862('0x6')+_0xf63591,_0x5aa7a0);SquareProjectEvents['on'](_0xf63591,_0x32b157);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 4690b9d..82a2000 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 _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x39a216,_0x42dfb4){var _0x3a8764=function(_0x22caad){while(--_0x22caad){_0x39a216['push'](_0x39a216['shift']());}};_0x3a8764(++_0x42dfb4);}(_0x7a54,0x106));var _0x47a5=function(_0x1afd1c,_0x4b7ba3){_0x1afd1c=_0x1afd1c-0x0;var _0x4744a3=_0x7a54[_0x1afd1c];return _0x4744a3;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=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(_0x4e7551,_0x398ee5){var _0x2c2ae8=function(_0x31f000){while(--_0x31f000){_0x4e7551['push'](_0x4e7551['shift']());}};_0x2c2ae8(++_0x398ee5);}(_0x326f,0xd1));var _0xf326=function(_0x5e811d,_0x433798){_0x5e811d=_0x5e811d-0x0;var _0x3b5715=_0x326f[_0x5e811d];return _0x3b5715;};'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 0ed2354..ffc3dc5 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 _0xeff8=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0xa2d0ce,_0x6f3918){var _0x20b290=function(_0x1045f5){while(--_0x1045f5){_0xa2d0ce['push'](_0xa2d0ce['shift']());}};_0x20b290(++_0x6f3918);}(_0xeff8,0x186));var _0x8eff=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xeff8[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x8eff('0x2')]},'calleridname':{'type':Sequelize[_0x8eff('0x2')]},'context':{'type':Sequelize[_0x8eff('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x8eff('0x2')]},'accountcode':{'type':Sequelize[_0x8eff('0x2')]},'dnid':{'type':Sequelize[_0x8eff('0x2')]},'projectName':{'type':Sequelize[_0x8eff('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x8eff('0x2')]},'savePath':{'type':Sequelize[_0x8eff('0x2')]},'format':{'type':Sequelize[_0x8eff('0x3')],'get':function(){var _0x323b2='';var _0x491f01=this[_0x8eff('0x4')](_0x8eff('0x5'));if(_0x491f01){_0x323b2=_0x491f01[_0x8eff('0x6')](_0x491f01[_0x8eff('0x7')]('.'));}return _0x323b2;}}}; \ No newline at end of file +var _0x3eea=['getDataValue','substring','sequelize','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x5f1306,_0x5947ff){_0x5f1306=_0x5f1306-0x0;var _0x540282=_0x3eea[_0x5f1306];return _0x540282;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa3ee('0x1')]},'callerid':{'type':Sequelize[_0xa3ee('0x1')]},'calleridname':{'type':Sequelize[_0xa3ee('0x1')]},'context':{'type':Sequelize[_0xa3ee('0x1')]},'extension':{'type':Sequelize[_0xa3ee('0x1')]},'priority':{'type':Sequelize[_0xa3ee('0x1')]},'accountcode':{'type':Sequelize[_0xa3ee('0x1')]},'dnid':{'type':Sequelize[_0xa3ee('0x1')]},'projectName':{'type':Sequelize[_0xa3ee('0x1')]},'saveName':{'type':Sequelize[_0xa3ee('0x1')]},'filename':{'type':Sequelize[_0xa3ee('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x4183ee='';var _0x4e4588=this[_0xa3ee('0x2')]('savePath');if(_0x4e4588){_0x4183ee=_0x4e4588[_0xa3ee('0x3')](_0x4e4588['lastIndexOf']('.'));}return _0x4183ee;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index e6ab006..27549a2 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 _0x6872=['nolimit','order','sort','where','pick','filter','merge','options','include','catch','params','keys','rawAttributes','includeAll','find','create','body','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','name','index','map','SquareRecording','fieldName','type','model','query','filters','intersection','attributes','fields','length'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6872,0x84));var _0x2687=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x6872[_0x5627e1];return _0x2f013f;};'use strict';var emlformat=require(_0x2687('0x0'));var rimraf=require(_0x2687('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2687('0x2'));var rp=require('request-promise');var moment=require(_0x2687('0x3'));var BPromise=require(_0x2687('0x4'));var Mustache=require(_0x2687('0x5'));var util=require('util');var path=require(_0x2687('0x6'));var sox=require(_0x2687('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2687('0x8'));var _=require(_0x2687('0x9'));var squel=require(_0x2687('0xa'));var crypto=require('crypto');var jsforce=require(_0x2687('0xb'));var deskjs=require(_0x2687('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2687('0xd'));var Redis=require(_0x2687('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2687('0xf'));var as=require(_0x2687('0x10'));var hardwareService=require(_0x2687('0x11'));var logger=require(_0x2687('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2687('0x13'));var db=require(_0x2687('0x14'))['db'];function respondWithStatusCode(_0x459f56,_0x55c6e6){_0x55c6e6=_0x55c6e6||0xcc;return function(_0x285bc7){if(_0x285bc7){return _0x459f56[_0x2687('0x15')](_0x55c6e6);}return _0x459f56[_0x2687('0x16')](_0x55c6e6)['end']();};}function respondWithResult(_0x42a05f,_0x24e16a){_0x24e16a=_0x24e16a||0xc8;return function(_0x25acba){if(_0x25acba){return _0x42a05f[_0x2687('0x16')](_0x24e16a)[_0x2687('0x17')](_0x25acba);}};}function respondWithFilteredResult(_0x27fd1c,_0x49fd35){return function(_0x3eb36f){if(_0x3eb36f){var _0x50069d=typeof _0x49fd35[_0x2687('0x18')]==='undefined'&&typeof _0x49fd35['limit']===_0x2687('0x19');var _0x5decdc=_0x3eb36f[_0x2687('0x1a')];var _0x3cffbf=_0x50069d?0x0:_0x49fd35['offset'];var _0x2c80e3=_0x50069d?_0x3eb36f['count']:_0x49fd35['offset']+_0x49fd35[_0x2687('0x1b')];var _0x37f454;if(_0x2c80e3>=_0x5decdc){_0x2c80e3=_0x5decdc;_0x37f454=0xc8;}else{_0x37f454=0xce;}_0x27fd1c['status'](_0x37f454);return _0x27fd1c[_0x2687('0x1c')](_0x2687('0x1d'),_0x3cffbf+'-'+_0x2c80e3+'/'+_0x5decdc)[_0x2687('0x17')](_0x3eb36f);}return null;};}function patchUpdates(_0x1776a7){return function(_0x47f0b2){try{jsonpatch['apply'](_0x47f0b2,_0x1776a7,!![]);}catch(_0x131ba8){return BPromise[_0x2687('0x1e')](_0x131ba8);}return _0x47f0b2[_0x2687('0x1f')]();};}function saveUpdates(_0x293ac2,_0x373ad8){return function(_0x2fd97b){if(_0x2fd97b){return _0x2fd97b[_0x2687('0x20')](_0x293ac2)['then'](function(_0x201ab8){return _0x201ab8;});}return null;};}function removeEntity(_0x21fd9d,_0x33bb01){return function(_0x360f6a){if(_0x360f6a){return _0x360f6a[_0x2687('0x21')]()[_0x2687('0x22')](function(){_0x21fd9d[_0x2687('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17f948,_0x1478e0){return function(_0xfd0618){if(!_0xfd0618){_0x17f948[_0x2687('0x15')](0x194);}return _0xfd0618;};}function handleError(_0x348fa0,_0x4fea72){_0x4fea72=_0x4fea72||0x1f4;return function(_0x146830){logger[_0x2687('0x23')](_0x146830[_0x2687('0x24')]);if(_0x146830['name']){delete _0x146830[_0x2687('0x25')];}_0x348fa0[_0x2687('0x16')](_0x4fea72)['send'](_0x146830);};}exports[_0x2687('0x26')]=function(_0x168d1c,_0x5e2875){var _0x3b7893={},_0x352703={},_0x273859={'count':0x0,'rows':[]};var _0x458348=_[_0x2687('0x27')](db[_0x2687('0x28')]['rawAttributes'],function(_0x42a549){return{'name':_0x42a549[_0x2687('0x29')],'type':_0x42a549[_0x2687('0x2a')]['key']};});_0x352703[_0x2687('0x2b')]=_['map'](_0x458348,_0x2687('0x25'));_0x352703[_0x2687('0x2c')]=_['keys'](_0x168d1c[_0x2687('0x2c')]);_0x352703[_0x2687('0x2d')]=_[_0x2687('0x2e')](_0x352703[_0x2687('0x2b')],_0x352703[_0x2687('0x2c')]);_0x3b7893[_0x2687('0x2f')]=_[_0x2687('0x2e')](_0x352703[_0x2687('0x2b')],qs[_0x2687('0x30')](_0x168d1c['query'][_0x2687('0x30')]));_0x3b7893[_0x2687('0x2f')]=_0x3b7893[_0x2687('0x2f')][_0x2687('0x31')]?_0x3b7893[_0x2687('0x2f')]:_0x352703[_0x2687('0x2b')];if(!_0x168d1c[_0x2687('0x2c')]['hasOwnProperty'](_0x2687('0x32'))){_0x3b7893[_0x2687('0x1b')]=qs[_0x2687('0x1b')](_0x168d1c[_0x2687('0x2c')][_0x2687('0x1b')]);_0x3b7893[_0x2687('0x18')]=qs[_0x2687('0x18')](_0x168d1c[_0x2687('0x2c')]['offset']);}_0x3b7893[_0x2687('0x33')]=qs['sort'](_0x168d1c[_0x2687('0x2c')][_0x2687('0x34')]);_0x3b7893[_0x2687('0x35')]=qs['filters'](_[_0x2687('0x36')](_0x168d1c[_0x2687('0x2c')],_0x352703[_0x2687('0x2d')]),_0x458348);if(_0x168d1c[_0x2687('0x2c')][_0x2687('0x37')]){_0x3b7893['where']=_[_0x2687('0x38')](_0x3b7893[_0x2687('0x35')],{'$or':_['map'](_0x458348,function(_0x47c0da){if(_0x47c0da[_0x2687('0x2a')]!=='VIRTUAL'){var _0x15da52={};_0x15da52[_0x47c0da[_0x2687('0x25')]]={'$like':'%'+_0x168d1c[_0x2687('0x2c')]['filter']+'%'};return _0x15da52;}})});}_0x3b7893=_[_0x2687('0x38')]({},_0x3b7893,_0x168d1c[_0x2687('0x39')]);var _0x4ae138={'where':_0x3b7893[_0x2687('0x35')]};return db[_0x2687('0x28')]['count'](_0x4ae138)[_0x2687('0x22')](function(_0x5a8c8e){_0x273859[_0x2687('0x1a')]=_0x5a8c8e;if(_0x168d1c['query']['includeAll']){_0x3b7893[_0x2687('0x3a')]=[{'all':!![]}];}return db[_0x2687('0x28')]['findAll'](_0x3b7893);})['then'](function(_0x2d4e0b){_0x273859['rows']=_0x2d4e0b;return _0x273859;})[_0x2687('0x22')](respondWithFilteredResult(_0x5e2875,_0x3b7893))[_0x2687('0x3b')](handleError(_0x5e2875,null));};exports['show']=function(_0x297c92,_0x174654){var _0x55772e={'raw':!![],'where':{'id':_0x297c92[_0x2687('0x3c')]['id']}},_0x356f97={};_0x356f97['model']=_[_0x2687('0x3d')](db[_0x2687('0x28')][_0x2687('0x3e')]);_0x356f97[_0x2687('0x2c')]=_[_0x2687('0x3d')](_0x297c92[_0x2687('0x2c')]);_0x356f97[_0x2687('0x2d')]=_[_0x2687('0x2e')](_0x356f97['model'],_0x356f97[_0x2687('0x2c')]);_0x55772e['attributes']=_[_0x2687('0x2e')](_0x356f97[_0x2687('0x2b')],qs['fields'](_0x297c92['query']['fields']));_0x55772e[_0x2687('0x2f')]=_0x55772e['attributes'][_0x2687('0x31')]?_0x55772e[_0x2687('0x2f')]:_0x356f97['model'];if(_0x297c92[_0x2687('0x2c')][_0x2687('0x3f')]){_0x55772e[_0x2687('0x3a')]=[{'all':!![]}];}_0x55772e=_[_0x2687('0x38')]({},_0x55772e,_0x297c92[_0x2687('0x39')]);return db[_0x2687('0x28')][_0x2687('0x40')](_0x55772e)[_0x2687('0x22')](handleEntityNotFound(_0x174654,null))[_0x2687('0x22')](respondWithResult(_0x174654,null))[_0x2687('0x3b')](handleError(_0x174654,null));};exports[_0x2687('0x41')]=function(_0x1f7738,_0x514c78){return db[_0x2687('0x28')][_0x2687('0x41')](_0x1f7738[_0x2687('0x42')],{})[_0x2687('0x22')](respondWithResult(_0x514c78,0xc9))[_0x2687('0x3b')](handleError(_0x514c78,null));};exports['update']=function(_0x176553,_0x1ee1c6){if(_0x176553[_0x2687('0x42')]['id']){delete _0x176553[_0x2687('0x42')]['id'];}return db[_0x2687('0x28')][_0x2687('0x40')]({'where':{'id':_0x176553[_0x2687('0x3c')]['id']}})[_0x2687('0x22')](handleEntityNotFound(_0x1ee1c6,null))[_0x2687('0x22')](saveUpdates(_0x176553[_0x2687('0x42')],null))[_0x2687('0x22')](respondWithResult(_0x1ee1c6,null))['catch'](handleError(_0x1ee1c6,null));};exports['download']=function(_0x2cbfbe,_0xb011d1,_0xf7bda8){var _0x237d1b=require(_0x2687('0x43'));var _0x3e1137=![];var _0x5e7e09={};if(_0x2cbfbe['query'][_0x2687('0x2a')]&&_0x2cbfbe[_0x2687('0x2c')]['type']==='uniqueid'){_0x5e7e09[_0x2687('0x44')]=_0x2cbfbe['params']['id'];}else{_0x5e7e09['id']=_0x2cbfbe[_0x2687('0x3c')]['id'];}return db['SquareRecording'][_0x2687('0x40')]({'where':_0x5e7e09,'attributes':['id',_0x2687('0x45'),_0x2687('0x46')],'raw':!![]})[_0x2687('0x22')](handleEntityNotFound(_0xb011d1,null))[_0x2687('0x22')](function(_0xc2f4e9){if(_0xc2f4e9){var _0x212ae7=_0xc2f4e9[_0x2687('0x45')];var _0x5e8d60=util[_0x2687('0x47')]('%s.cypher',_0x212ae7);if(fs[_0x2687('0x48')](_0x5e8d60)){_0x3e1137=!![];return _0x237d1b[_0x2687('0x49')](_0x5e8d60,_0x212ae7,config[_0x2687('0x4a')][_0x2687('0x4b')])[_0x2687('0x22')](function(){return _0xc2f4e9;});}return _0xc2f4e9;}})[_0x2687('0x22')](function(_0x3c9b8c){if(_0x3c9b8c){var _0x7fe55=_0x3c9b8c[_0x2687('0x45')];if(!fs[_0x2687('0x48')](_0x7fe55)){throw new db['Sequelize'][(_0x2687('0x4c'))](_0x2687('0x4d'));}if(_0x3c9b8c['filename']){return _0xb011d1[_0x2687('0x4e')](_0x7fe55,_0x3c9b8c[_0x2687('0x46')]+path[_0x2687('0x4f')](_0x7fe55),function(){if(_0x3e1137){fs[_0x2687('0x50')](_0x7fe55);}});}else{return _0xb011d1[_0x2687('0x4e')](_0x7fe55,function(_0x4cb198){if(_0x3e1137){fs[_0x2687('0x50')](_0x7fe55);}});}}})[_0x2687('0x3b')](function(_0x236126){if(_0x236126[_0x2687('0x51')]===_0x2687('0x4d')){_0xb011d1[_0x2687('0x16')](0x194)[_0x2687('0x52')](_0x2687('0x53'));}else{return handleError(_0xb011d1,null);}});};exports[_0x2687('0x21')]=function(_0x27b73c,_0x52c6e7){return db[_0x2687('0x28')][_0x2687('0x40')]({'where':{'id':_0x27b73c[_0x2687('0x3c')]['id']}})[_0x2687('0x22')](function(_0x19b104){if(_[_0x2687('0x54')](_0x19b104)){throw new ReferenceError(_0x2687('0x55'));}return _0x19b104;})[_0x2687('0x22')](function(_0x266211){var _0x2b8c56=_0x266211[_0x2687('0x45')];logger[_0x2687('0x56')](_0x2687('0x57'),_0x2b8c56);if(!_[_0x2687('0x54')](_0x266211[_0x2687('0x45')])&&fs[_0x2687('0x48')](_0x2b8c56)){logger[_0x2687('0x56')](_0x2687('0x58')+_0x2b8c56+_0x2687('0x59'));fs['unlinkSync'](_0x2b8c56);}_0x2b8c56=_0x2b8c56+_0x2687('0x5a');if(!_[_0x2687('0x54')](_0x266211[_0x2687('0x45')])&&fs[_0x2687('0x48')](_0x2b8c56)){logger[_0x2687('0x56')](_0x2687('0x58')+_0x2b8c56+_0x2687('0x59'));fs['unlinkSync'](_0x2b8c56);}return _0x266211;})[_0x2687('0x22')](function(_0x57c94e){if(!_0x57c94e)throw new InternalError();return _0x57c94e[_0x2687('0x21')]();})['then'](function(){_0x52c6e7[_0x2687('0x16')](0xcc)['end']();})[_0x2687('0x3b')](handleError(_0x52c6e7,null));}; \ No newline at end of file +var _0xdbf0=['SquareRecording\x20not\x20found','download','unlink','message','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','save','update','then','destroy','error','name','send','index','rawAttributes','type','key','map','query','filters','model','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll','rows','catch','show','params','keys','fields','include','find','create','body','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError'];(function(_0x3e1a0e,_0x5d847b){var _0x423f71=function(_0x43c058){while(--_0x43c058){_0x3e1a0e['push'](_0x3e1a0e['shift']());}};_0x423f71(++_0x5d847b);}(_0xdbf0,0x190));var _0x0dbf=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xdbf0[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x0dbf('0x0'));var rimraf=require(_0x0dbf('0x1'));var zipdir=require(_0x0dbf('0x2'));var jsonpatch=require(_0x0dbf('0x3'));var rp=require(_0x0dbf('0x4'));var moment=require(_0x0dbf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0dbf('0x6'));var util=require(_0x0dbf('0x7'));var path=require(_0x0dbf('0x8'));var sox=require(_0x0dbf('0x9'));var csv=require(_0x0dbf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0dbf('0xb'));var _=require('lodash');var squel=require(_0x0dbf('0xc'));var crypto=require(_0x0dbf('0xd'));var jsforce=require(_0x0dbf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0dbf('0xa'));var querystring=require(_0x0dbf('0xf'));var Papa=require('papaparse');var Redis=require(_0x0dbf('0x10'));var authService=require(_0x0dbf('0x11'));var qs=require(_0x0dbf('0x12'));var as=require(_0x0dbf('0x13'));var hardwareService=require(_0x0dbf('0x14'));var logger=require(_0x0dbf('0x15'))('api');var utils=require(_0x0dbf('0x16'));var config=require(_0x0dbf('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0dbf('0x18'))['db'];function respondWithStatusCode(_0x2a7b70,_0x31ce01){_0x31ce01=_0x31ce01||0xcc;return function(_0x4a44ac){if(_0x4a44ac){return _0x2a7b70[_0x0dbf('0x19')](_0x31ce01);}return _0x2a7b70[_0x0dbf('0x1a')](_0x31ce01)[_0x0dbf('0x1b')]();};}function respondWithResult(_0x1a38ef,_0x21c5a4){_0x21c5a4=_0x21c5a4||0xc8;return function(_0x482fdd){if(_0x482fdd){return _0x1a38ef[_0x0dbf('0x1a')](_0x21c5a4)[_0x0dbf('0x1c')](_0x482fdd);}};}function respondWithFilteredResult(_0x4dc6e0,_0x27231a){return function(_0x9b0f28){if(_0x9b0f28){var _0xbad276=typeof _0x27231a[_0x0dbf('0x1d')]==='undefined'&&typeof _0x27231a[_0x0dbf('0x1e')]===_0x0dbf('0x1f');var _0x3f4b0f=_0x9b0f28[_0x0dbf('0x20')];var _0x34c81d=_0xbad276?0x0:_0x27231a['offset'];var _0x184cf1=_0xbad276?_0x9b0f28[_0x0dbf('0x20')]:_0x27231a[_0x0dbf('0x1d')]+_0x27231a[_0x0dbf('0x1e')];var _0x42c29f;if(_0x184cf1>=_0x3f4b0f){_0x184cf1=_0x3f4b0f;_0x42c29f=0xc8;}else{_0x42c29f=0xce;}_0x4dc6e0[_0x0dbf('0x1a')](_0x42c29f);return _0x4dc6e0['set'](_0x0dbf('0x21'),_0x34c81d+'-'+_0x184cf1+'/'+_0x3f4b0f)[_0x0dbf('0x1c')](_0x9b0f28);}return null;};}function patchUpdates(_0x159edc){return function(_0x2f4781){try{jsonpatch['apply'](_0x2f4781,_0x159edc,!![]);}catch(_0x44839d){return BPromise['reject'](_0x44839d);}return _0x2f4781[_0x0dbf('0x22')]();};}function saveUpdates(_0x48959e,_0x240715){return function(_0x440262){if(_0x440262){return _0x440262[_0x0dbf('0x23')](_0x48959e)[_0x0dbf('0x24')](function(_0x20dd6e){return _0x20dd6e;});}return null;};}function removeEntity(_0x2a955a,_0x3986d6){return function(_0x4152dd){if(_0x4152dd){return _0x4152dd[_0x0dbf('0x25')]()['then'](function(){_0x2a955a[_0x0dbf('0x1a')](0xcc)[_0x0dbf('0x1b')]();});}};}function handleEntityNotFound(_0x5440c3,_0x28ef1c){return function(_0x274b96){if(!_0x274b96){_0x5440c3[_0x0dbf('0x19')](0x194);}return _0x274b96;};}function handleError(_0x11279e,_0x1f779b){_0x1f779b=_0x1f779b||0x1f4;return function(_0x4ae966){logger[_0x0dbf('0x26')](_0x4ae966['stack']);if(_0x4ae966[_0x0dbf('0x27')]){delete _0x4ae966['name'];}_0x11279e[_0x0dbf('0x1a')](_0x1f779b)[_0x0dbf('0x28')](_0x4ae966);};}exports[_0x0dbf('0x29')]=function(_0x38e5f9,_0x106167){var _0x26da52={},_0x3b2635={},_0x5c1034={'count':0x0,'rows':[]};var _0x236243=_['map'](db['SquareRecording'][_0x0dbf('0x2a')],function(_0x547aa2){return{'name':_0x547aa2['fieldName'],'type':_0x547aa2[_0x0dbf('0x2b')][_0x0dbf('0x2c')]};});_0x3b2635['model']=_[_0x0dbf('0x2d')](_0x236243,_0x0dbf('0x27'));_0x3b2635[_0x0dbf('0x2e')]=_['keys'](_0x38e5f9[_0x0dbf('0x2e')]);_0x3b2635[_0x0dbf('0x2f')]=_['intersection'](_0x3b2635[_0x0dbf('0x30')],_0x3b2635[_0x0dbf('0x2e')]);_0x26da52['attributes']=_[_0x0dbf('0x31')](_0x3b2635[_0x0dbf('0x30')],qs['fields'](_0x38e5f9[_0x0dbf('0x2e')]['fields']));_0x26da52[_0x0dbf('0x32')]=_0x26da52[_0x0dbf('0x32')][_0x0dbf('0x33')]?_0x26da52[_0x0dbf('0x32')]:_0x3b2635[_0x0dbf('0x30')];if(!_0x38e5f9[_0x0dbf('0x2e')][_0x0dbf('0x34')](_0x0dbf('0x35'))){_0x26da52[_0x0dbf('0x1e')]=qs['limit'](_0x38e5f9['query']['limit']);_0x26da52[_0x0dbf('0x1d')]=qs[_0x0dbf('0x1d')](_0x38e5f9[_0x0dbf('0x2e')][_0x0dbf('0x1d')]);}_0x26da52['order']=qs[_0x0dbf('0x36')](_0x38e5f9['query'][_0x0dbf('0x36')]);_0x26da52[_0x0dbf('0x37')]=qs['filters'](_[_0x0dbf('0x38')](_0x38e5f9[_0x0dbf('0x2e')],_0x3b2635[_0x0dbf('0x2f')]),_0x236243);if(_0x38e5f9[_0x0dbf('0x2e')][_0x0dbf('0x39')]){_0x26da52[_0x0dbf('0x37')]=_[_0x0dbf('0x3a')](_0x26da52['where'],{'$or':_['map'](_0x236243,function(_0x314cba){if(_0x314cba[_0x0dbf('0x2b')]!==_0x0dbf('0x3b')){var _0x4dd63f={};_0x4dd63f[_0x314cba[_0x0dbf('0x27')]]={'$like':'%'+_0x38e5f9[_0x0dbf('0x2e')][_0x0dbf('0x39')]+'%'};return _0x4dd63f;}})});}_0x26da52=_[_0x0dbf('0x3a')]({},_0x26da52,_0x38e5f9[_0x0dbf('0x3c')]);var _0x37c326={'where':_0x26da52[_0x0dbf('0x37')]};return db[_0x0dbf('0x3d')]['count'](_0x37c326)[_0x0dbf('0x24')](function(_0x4b9eb0){_0x5c1034[_0x0dbf('0x20')]=_0x4b9eb0;if(_0x38e5f9[_0x0dbf('0x2e')][_0x0dbf('0x3e')]){_0x26da52['include']=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x26da52);})['then'](function(_0x59efb6){_0x5c1034[_0x0dbf('0x3f')]=_0x59efb6;return _0x5c1034;})[_0x0dbf('0x24')](respondWithFilteredResult(_0x106167,_0x26da52))[_0x0dbf('0x40')](handleError(_0x106167,null));};exports[_0x0dbf('0x41')]=function(_0x5df3ad,_0x1e1900){var _0x4eba4c={'raw':!![],'where':{'id':_0x5df3ad[_0x0dbf('0x42')]['id']}},_0x42980f={};_0x42980f['model']=_[_0x0dbf('0x43')](db[_0x0dbf('0x3d')][_0x0dbf('0x2a')]);_0x42980f[_0x0dbf('0x2e')]=_[_0x0dbf('0x43')](_0x5df3ad['query']);_0x42980f[_0x0dbf('0x2f')]=_[_0x0dbf('0x31')](_0x42980f[_0x0dbf('0x30')],_0x42980f[_0x0dbf('0x2e')]);_0x4eba4c[_0x0dbf('0x32')]=_['intersection'](_0x42980f[_0x0dbf('0x30')],qs[_0x0dbf('0x44')](_0x5df3ad[_0x0dbf('0x2e')][_0x0dbf('0x44')]));_0x4eba4c['attributes']=_0x4eba4c[_0x0dbf('0x32')][_0x0dbf('0x33')]?_0x4eba4c['attributes']:_0x42980f[_0x0dbf('0x30')];if(_0x5df3ad[_0x0dbf('0x2e')][_0x0dbf('0x3e')]){_0x4eba4c[_0x0dbf('0x45')]=[{'all':!![]}];}_0x4eba4c=_[_0x0dbf('0x3a')]({},_0x4eba4c,_0x5df3ad[_0x0dbf('0x3c')]);return db[_0x0dbf('0x3d')][_0x0dbf('0x46')](_0x4eba4c)['then'](handleEntityNotFound(_0x1e1900,null))[_0x0dbf('0x24')](respondWithResult(_0x1e1900,null))[_0x0dbf('0x40')](handleError(_0x1e1900,null));};exports[_0x0dbf('0x47')]=function(_0x18e252,_0x47c113){return db['SquareRecording']['create'](_0x18e252[_0x0dbf('0x48')],{})[_0x0dbf('0x24')](respondWithResult(_0x47c113,0xc9))[_0x0dbf('0x40')](handleError(_0x47c113,null));};exports[_0x0dbf('0x23')]=function(_0x36e2fa,_0x347915){if(_0x36e2fa[_0x0dbf('0x48')]['id']){delete _0x36e2fa[_0x0dbf('0x48')]['id'];}return db[_0x0dbf('0x3d')][_0x0dbf('0x46')]({'where':{'id':_0x36e2fa[_0x0dbf('0x42')]['id']}})[_0x0dbf('0x24')](handleEntityNotFound(_0x347915,null))[_0x0dbf('0x24')](saveUpdates(_0x36e2fa[_0x0dbf('0x48')],null))[_0x0dbf('0x24')](respondWithResult(_0x347915,null))['catch'](handleError(_0x347915,null));};exports['download']=function(_0x4aa7e4,_0x391f16,_0x7683f4){var _0x2e35bc=require(_0x0dbf('0x49'));var _0x5b9f9e=![];var _0x4b6bfd={};if(_0x4aa7e4[_0x0dbf('0x2e')][_0x0dbf('0x2b')]&&_0x4aa7e4['query'][_0x0dbf('0x2b')]==='uniqueid'){_0x4b6bfd[_0x0dbf('0x4a')]=_0x4aa7e4['params']['id'];}else{_0x4b6bfd['id']=_0x4aa7e4[_0x0dbf('0x42')]['id'];}return db[_0x0dbf('0x3d')][_0x0dbf('0x46')]({'where':_0x4b6bfd,'attributes':['id',_0x0dbf('0x4b'),_0x0dbf('0x4c')],'raw':!![]})[_0x0dbf('0x24')](handleEntityNotFound(_0x391f16,null))[_0x0dbf('0x24')](function(_0x5a4c2d){if(_0x5a4c2d){var _0x22dd19=_0x5a4c2d['savePath'];var _0x574907=util[_0x0dbf('0x4d')](_0x0dbf('0x4e'),_0x22dd19);if(fs[_0x0dbf('0x4f')](_0x574907)){_0x5b9f9e=!![];return _0x2e35bc[_0x0dbf('0x50')](_0x574907,_0x22dd19,config[_0x0dbf('0x51')][_0x0dbf('0x52')])['then'](function(){return _0x5a4c2d;});}return _0x5a4c2d;}})[_0x0dbf('0x24')](function(_0x365344){if(_0x365344){var _0x3717a8=_0x365344['savePath'];if(!fs[_0x0dbf('0x4f')](_0x3717a8)){throw new db[(_0x0dbf('0x53'))][(_0x0dbf('0x54'))](_0x0dbf('0x55'));}if(_0x365344[_0x0dbf('0x4c')]){return _0x391f16[_0x0dbf('0x56')](_0x3717a8,_0x365344[_0x0dbf('0x4c')]+path['extname'](_0x3717a8),function(){if(_0x5b9f9e){fs[_0x0dbf('0x57')](_0x3717a8);}});}else{return _0x391f16[_0x0dbf('0x56')](_0x3717a8,function(_0x3c4691){if(_0x5b9f9e){fs[_0x0dbf('0x57')](_0x3717a8);}});}}})['catch'](function(_0x3556a5){if(_0x3556a5[_0x0dbf('0x58')]===_0x0dbf('0x55')){_0x391f16[_0x0dbf('0x1a')](0x194)[_0x0dbf('0x28')](_0x0dbf('0x59'));}else{return handleError(_0x391f16,null);}});};exports[_0x0dbf('0x25')]=function(_0x864b24,_0x2d1420){return db[_0x0dbf('0x3d')]['find']({'where':{'id':_0x864b24['params']['id']}})[_0x0dbf('0x24')](function(_0x50942d){if(_[_0x0dbf('0x5a')](_0x50942d)){throw new ReferenceError('Entity\x20not\x20found');}return _0x50942d;})[_0x0dbf('0x24')](function(_0x205e80){var _0x126b93=_0x205e80[_0x0dbf('0x4b')];logger['info'](_0x0dbf('0x5b'),_0x126b93);if(!_[_0x0dbf('0x5a')](_0x205e80[_0x0dbf('0x4b')])&&fs['existsSync'](_0x126b93)){logger[_0x0dbf('0x5c')](_0x0dbf('0x5d')+_0x126b93+_0x0dbf('0x5e'));fs[_0x0dbf('0x5f')](_0x126b93);}_0x126b93=_0x126b93+_0x0dbf('0x60');if(!_[_0x0dbf('0x5a')](_0x205e80[_0x0dbf('0x4b')])&&fs[_0x0dbf('0x4f')](_0x126b93)){logger['info'](_0x0dbf('0x5d')+_0x126b93+_0x0dbf('0x5e'));fs[_0x0dbf('0x5f')](_0x126b93);}return _0x205e80;})[_0x0dbf('0x24')](function(_0x5637dd){if(!_0x5637dd)throw new InternalError();return _0x5637dd[_0x0dbf('0x25')]();})[_0x0dbf('0x24')](function(){_0x2d1420['status'](0xcc)[_0x0dbf('0x1b')]();})['catch'](handleError(_0x2d1420,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 09ebe01..f23a55e 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 _0xdfa0=['path','../../config/environment','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x57fa05,_0x2a4ea6){var _0x1e9172=function(_0x3f234b){while(--_0x3f234b){_0x57fa05['push'](_0x57fa05['shift']());}};_0x1e9172(++_0x2a4ea6);}(_0xdfa0,0x69));var _0x0dfa=function(_0x164f93,_0x1dfc8d){_0x164f93=_0x164f93-0x0;var _0x107d36=_0xdfa0[_0x164f93];return _0x107d36;};'use strict';var _=require(_0x0dfa('0x0'));var util=require('util');var logger=require(_0x0dfa('0x1'))(_0x0dfa('0x2'));var moment=require('moment');var BPromise=require(_0x0dfa('0x3'));var rp=require(_0x0dfa('0x4'));var fs=require('fs');var path=require(_0x0dfa('0x5'));var rimraf=require('rimraf');var config=require(_0x0dfa('0x6'));var attributes=require('./squareRecording.attributes');module[_0x0dfa('0x7')]=function(_0x2efe20,_0x4830b6){return _0x2efe20[_0x0dfa('0x8')](_0x0dfa('0x9'),attributes,{'tableName':_0x0dfa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0755=['rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xfca0bf,_0x8ac9f9){var _0xc72568=function(_0x4b4a90){while(--_0x4b4a90){_0xfca0bf['push'](_0xfca0bf['shift']());}};_0xc72568(++_0x8ac9f9);}(_0x0755,0x7c));var _0x5075=function(_0x453271,_0x52ee0f){_0x453271=_0x453271-0x0;var _0x54530b=_0x0755[_0x453271];return _0x54530b;};'use strict';var _=require(_0x5075('0x0'));var util=require(_0x5075('0x1'));var logger=require(_0x5075('0x2'))(_0x5075('0x3'));var moment=require(_0x5075('0x4'));var BPromise=require(_0x5075('0x5'));var rp=require(_0x5075('0x6'));var fs=require('fs');var path=require(_0x5075('0x7'));var rimraf=require(_0x5075('0x8'));var config=require(_0x5075('0x9'));var attributes=require('./squareRecording.attributes');module[_0x5075('0xa')]=function(_0x2a7be,_0x3f4fea){return _0x2a7be[_0x5075('0xb')]('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index c68ce9b..2d40fe0 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 _0x5955=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1af013,_0x1b5d19){var _0x31532f=function(_0xdb965d){while(--_0xdb965d){_0x1af013['push'](_0x1af013['shift']());}};_0x31532f(++_0x1b5d19);}(_0x5955,0x182));var _0x5595=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0x5955[_0x4bed75];return _0x2dd8e8;};'use strict';var _=require(_0x5595('0x0'));var util=require(_0x5595('0x1'));var moment=require(_0x5595('0x2'));var BPromise=require(_0x5595('0x3'));var rs=require(_0x5595('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5595('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5595('0x6'))('rpc');var config=require(_0x5595('0x7'));var jayson=require(_0x5595('0x8'));var client=jayson[_0x5595('0x9')][_0x5595('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2aed61,_0x535c7e,_0x146fb5){return new BPromise(function(_0x3414ad,_0x4304b5){return client[_0x5595('0xb')](_0x2aed61,_0x146fb5)[_0x5595('0xc')](function(_0x248580){logger[_0x5595('0xd')](_0x5595('0xe'),_0x535c7e,_0x5595('0xf'));logger[_0x5595('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x535c7e,'request\x20sent',JSON[_0x5595('0x11')](_0x248580));if(_0x248580[_0x5595('0x12')]){if(_0x248580[_0x5595('0x12')][_0x5595('0x13')]===0x1f4){logger[_0x5595('0x12')](_0x5595('0xe'),_0x535c7e,_0x248580[_0x5595('0x12')][_0x5595('0x14')]);return _0x4304b5(_0x248580[_0x5595('0x12')][_0x5595('0x14')]);}logger['error'](_0x5595('0xe'),_0x535c7e,_0x248580[_0x5595('0x12')][_0x5595('0x14')]);return _0x3414ad(_0x248580['error'][_0x5595('0x14')]);}else{logger[_0x5595('0xd')]('SquareRecording,\x20%s,\x20%s',_0x535c7e,_0x5595('0xf'));_0x3414ad(_0x248580['result']['message']);}})[_0x5595('0x15')](function(_0x1a3a28){logger[_0x5595('0x12')](_0x5595('0xe'),_0x535c7e,_0x1a3a28);_0x4304b5(_0x1a3a28);});});}exports[_0x5595('0x16')]=function(_0x3caa78){var _0x5bc6f5=this;return new Promise(function(_0xfde3dc,_0x58b794){return db[_0x5595('0x17')][_0x5595('0x18')](_0x3caa78[_0x5595('0x19')],{'raw':_0x3caa78['options']?_0x3caa78[_0x5595('0x1a')][_0x5595('0x1b')]===undefined?!![]:![]:!![]})[_0x5595('0xc')](function(_0x41d43c){logger[_0x5595('0xd')]('CreateSquareRecording',_0x3caa78);logger[_0x5595('0x10')](_0x5595('0x16'),_0x3caa78,JSON[_0x5595('0x11')](_0x41d43c));_0xfde3dc(_0x41d43c);})[_0x5595('0x15')](function(_0x534347){logger['error']('CreateSquareRecording',_0x534347[_0x5595('0x14')],_0x3caa78);_0x58b794(_0x5bc6f5[_0x5595('0x12')](0x1f4,_0x534347[_0x5595('0x14')]));});});}; \ No newline at end of file +var _0x5c41=['SquareRecording','body','options','raw','catch','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareRecording,\x20%s,\x20%s','CreateSquareRecording'];(function(_0x7cc1d1,_0x29c3bc){var _0x3fef7a=function(_0x2e2419){while(--_0x2e2419){_0x7cc1d1['push'](_0x7cc1d1['shift']());}};_0x3fef7a(++_0x29c3bc);}(_0x5c41,0xb4));var _0x15c4=function(_0x5a9dbc,_0x33bf95){_0x5a9dbc=_0x5a9dbc-0x0;var _0x5e9022=_0x5c41[_0x5a9dbc];return _0x5e9022;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x15c4('0x0'));var fs=require('fs');var Redis=require(_0x15c4('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x15c4('0x2'));var logger=require(_0x15c4('0x3'))(_0x15c4('0x4'));var config=require('../../config/environment');var jayson=require(_0x15c4('0x5'));var client=jayson[_0x15c4('0x6')][_0x15c4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4df3cb,_0x332fe2,_0xdbfca9){return new BPromise(function(_0x58ec59,_0x3ca593){return client[_0x15c4('0x8')](_0x4df3cb,_0xdbfca9)[_0x15c4('0x9')](function(_0x4c6a7d){logger[_0x15c4('0xa')]('SquareRecording,\x20%s,\x20%s',_0x332fe2,_0x15c4('0xb'));logger['debug'](_0x15c4('0xc'),_0x332fe2,_0x15c4('0xb'),JSON[_0x15c4('0xd')](_0x4c6a7d));if(_0x4c6a7d[_0x15c4('0xe')]){if(_0x4c6a7d['error'][_0x15c4('0xf')]===0x1f4){logger[_0x15c4('0xe')]('SquareRecording,\x20%s,\x20%s',_0x332fe2,_0x4c6a7d[_0x15c4('0xe')][_0x15c4('0x10')]);return _0x3ca593(_0x4c6a7d['error']['message']);}logger[_0x15c4('0xe')]('SquareRecording,\x20%s,\x20%s',_0x332fe2,_0x4c6a7d[_0x15c4('0xe')][_0x15c4('0x10')]);return _0x58ec59(_0x4c6a7d[_0x15c4('0xe')]['message']);}else{logger[_0x15c4('0xa')]('SquareRecording,\x20%s,\x20%s',_0x332fe2,_0x15c4('0xb'));_0x58ec59(_0x4c6a7d[_0x15c4('0x11')][_0x15c4('0x10')]);}})['catch'](function(_0x25146b){logger[_0x15c4('0xe')](_0x15c4('0x12'),_0x332fe2,_0x25146b);_0x3ca593(_0x25146b);});});}exports[_0x15c4('0x13')]=function(_0x5969b2){var _0x757e6e=this;return new Promise(function(_0x2247e7,_0x6ecf48){return db[_0x15c4('0x14')]['create'](_0x5969b2[_0x15c4('0x15')],{'raw':_0x5969b2[_0x15c4('0x16')]?_0x5969b2['options'][_0x15c4('0x17')]===undefined?!![]:![]:!![]})[_0x15c4('0x9')](function(_0x509d17){logger[_0x15c4('0xa')](_0x15c4('0x13'),_0x5969b2);logger['debug'](_0x15c4('0x13'),_0x5969b2,JSON[_0x15c4('0xd')](_0x509d17));_0x2247e7(_0x509d17);})[_0x15c4('0x18')](function(_0x5484fe){logger[_0x15c4('0xe')](_0x15c4('0x13'),_0x5484fe[_0x15c4('0x10')],_0x5969b2);_0x6ecf48(_0x757e6e['error'](0x1f4,_0x5484fe['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 126ec6f..715e902 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 _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x718cb6,_0x4c5520){var _0x10dddd=function(_0x26a36e){while(--_0x26a36e){_0x718cb6['push'](_0x718cb6['shift']());}};_0x10dddd(++_0x4c5520);}(_0xe706,0xa3));var _0x6e70=function(_0x15718e,_0x2f5096){_0x15718e=_0x15718e-0x0;var _0xf3b1d2=_0xe706[_0x15718e];return _0xf3b1d2;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _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(_0x547a56,_0x3f7ef1){var _0x29f48e=function(_0x231395){while(--_0x231395){_0x547a56['push'](_0x547a56['shift']());}};_0x29f48e(++_0x3f7ef1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'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 3d28924..b904b4c 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 _0x82d8=['sequelize','exports','STRING','DATE'];(function(_0x2bb00e,_0x53e086){var _0x5eea57=function(_0x5e6809){while(--_0x5e6809){_0x2bb00e['push'](_0x2bb00e['shift']());}};_0x5eea57(++_0x53e086);}(_0x82d8,0x1a8));var _0x882d=function(_0x5325c6,_0x570917){_0x5325c6=_0x5325c6-0x0;var _0x562933=_0x82d8[_0x5325c6];return _0x562933;};'use strict';var Sequelize=require(_0x882d('0x0'));module[_0x882d('0x1')]={'network':{'type':Sequelize[_0x882d('0x2')]},'network_script':{'type':Sequelize[_0x882d('0x2')]},'request':{'type':Sequelize[_0x882d('0x2')]},'channel':{'type':Sequelize[_0x882d('0x2')]},'language':{'type':Sequelize[_0x882d('0x2')]},'type':{'type':Sequelize[_0x882d('0x2')]},'uniqueid':{'type':Sequelize[_0x882d('0x2')]},'version':{'type':Sequelize[_0x882d('0x2')]},'callerid':{'type':Sequelize[_0x882d('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x882d('0x2')]},'callingani2':{'type':Sequelize[_0x882d('0x2')]},'callington':{'type':Sequelize[_0x882d('0x2')]},'callingtns':{'type':Sequelize[_0x882d('0x2')]},'dnid':{'type':Sequelize[_0x882d('0x2')]},'rdnis':{'type':Sequelize[_0x882d('0x2')]},'context':{'type':Sequelize[_0x882d('0x2')]},'extension':{'type':Sequelize[_0x882d('0x2')]},'priority':{'type':Sequelize[_0x882d('0x2')]},'enhanced':{'type':Sequelize[_0x882d('0x2')]},'accountcode':{'type':Sequelize[_0x882d('0x2')]},'threadid':{'type':Sequelize[_0x882d('0x2')]},'project_name':{'type':Sequelize[_0x882d('0x2')]},'joinAt':{'type':Sequelize[_0x882d('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd422=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x207aea,_0x2a9163){var _0x27ce5a=function(_0x2a58d6){while(--_0x2a58d6){_0x207aea['push'](_0x207aea['shift']());}};_0x27ce5a(++_0x2a9163);}(_0xd422,0x1de));var _0x2d42=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xd422[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0x2d42('0x0'));module['exports']={'network':{'type':Sequelize[_0x2d42('0x1')]},'network_script':{'type':Sequelize[_0x2d42('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2d42('0x1')]},'language':{'type':Sequelize[_0x2d42('0x1')]},'type':{'type':Sequelize[_0x2d42('0x1')]},'uniqueid':{'type':Sequelize[_0x2d42('0x1')]},'version':{'type':Sequelize[_0x2d42('0x1')]},'callerid':{'type':Sequelize[_0x2d42('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x2d42('0x1')]},'callingani2':{'type':Sequelize[_0x2d42('0x1')]},'callington':{'type':Sequelize[_0x2d42('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x2d42('0x1')]},'context':{'type':Sequelize[_0x2d42('0x1')]},'extension':{'type':Sequelize[_0x2d42('0x1')]},'priority':{'type':Sequelize[_0x2d42('0x1')]},'enhanced':{'type':Sequelize[_0x2d42('0x1')]},'accountcode':{'type':Sequelize[_0x2d42('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x2d42('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x2d42('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 2828b53..5328d69 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 _0xcea6=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','limit','undefined','count','offset','Content-Range','json','apply','reject','update','then','destroy','stack','send','index','map','SquareReport','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','merge','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','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'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0xcea6,0x84));var _0x6cea=function(_0x38b40f,_0x3ea6cf){_0x38b40f=_0x38b40f-0x0;var _0x1799f6=_0xcea6[_0x38b40f];return _0x1799f6;};'use strict';var emlformat=require(_0x6cea('0x0'));var rimraf=require(_0x6cea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6cea('0x2'));var rp=require(_0x6cea('0x3'));var moment=require('moment');var BPromise=require(_0x6cea('0x4'));var Mustache=require(_0x6cea('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6cea('0x6'));var csv=require(_0x6cea('0x7'));var ejs=require(_0x6cea('0x8'));var fs=require('fs');var fs_extra=require(_0x6cea('0x9'));var _=require(_0x6cea('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6cea('0xb'));var deskjs=require(_0x6cea('0xc'));var toCsv=require(_0x6cea('0x7'));var querystring=require(_0x6cea('0xd'));var Papa=require(_0x6cea('0xe'));var Redis=require('ioredis');var authService=require(_0x6cea('0xf'));var qs=require(_0x6cea('0x10'));var as=require(_0x6cea('0x11'));var hardwareService=require(_0x6cea('0x12'));var logger=require(_0x6cea('0x13'))(_0x6cea('0x14'));var utils=require(_0x6cea('0x15'));var config=require(_0x6cea('0x16'));var licenseUtil=require(_0x6cea('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b13a1,_0x1f4ec1){_0x1f4ec1=_0x1f4ec1||0xcc;return function(_0x230953){if(_0x230953){return _0x1b13a1[_0x6cea('0x18')](_0x1f4ec1);}return _0x1b13a1[_0x6cea('0x19')](_0x1f4ec1)[_0x6cea('0x1a')]();};}function respondWithResult(_0x271806,_0xbfa06e){_0xbfa06e=_0xbfa06e||0xc8;return function(_0x72b4c7){if(_0x72b4c7){return _0x271806[_0x6cea('0x19')](_0xbfa06e)['json'](_0x72b4c7);}};}function respondWithFilteredResult(_0x5efca7,_0x29333a){return function(_0x3c1730){if(_0x3c1730){var _0x539e9c=typeof _0x29333a['offset']==='undefined'&&typeof _0x29333a[_0x6cea('0x1b')]===_0x6cea('0x1c');var _0x3a0b47=_0x3c1730['count'];var _0x4c4bb3=_0x539e9c?0x0:_0x29333a['offset'];var _0x3879f0=_0x539e9c?_0x3c1730[_0x6cea('0x1d')]:_0x29333a[_0x6cea('0x1e')]+_0x29333a['limit'];var _0x75c104;if(_0x3879f0>=_0x3a0b47){_0x3879f0=_0x3a0b47;_0x75c104=0xc8;}else{_0x75c104=0xce;}_0x5efca7['status'](_0x75c104);return _0x5efca7['set'](_0x6cea('0x1f'),_0x4c4bb3+'-'+_0x3879f0+'/'+_0x3a0b47)[_0x6cea('0x20')](_0x3c1730);}return null;};}function patchUpdates(_0x1b2fac){return function(_0x449575){try{jsonpatch[_0x6cea('0x21')](_0x449575,_0x1b2fac,!![]);}catch(_0x29cdab){return BPromise[_0x6cea('0x22')](_0x29cdab);}return _0x449575['save']();};}function saveUpdates(_0x9053b6,_0x11e676){return function(_0x2fd17c){if(_0x2fd17c){return _0x2fd17c[_0x6cea('0x23')](_0x9053b6)[_0x6cea('0x24')](function(_0xbe2719){return _0xbe2719;});}return null;};}function removeEntity(_0x36f807,_0x2876e5){return function(_0x344051){if(_0x344051){return _0x344051[_0x6cea('0x25')]()[_0x6cea('0x24')](function(){_0x36f807[_0x6cea('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19c68a,_0x157e21){return function(_0x2428ac){if(!_0x2428ac){_0x19c68a[_0x6cea('0x18')](0x194);}return _0x2428ac;};}function handleError(_0x4455bd,_0xa4f168){_0xa4f168=_0xa4f168||0x1f4;return function(_0x345262){logger['error'](_0x345262[_0x6cea('0x26')]);if(_0x345262['name']){delete _0x345262['name'];}_0x4455bd[_0x6cea('0x19')](_0xa4f168)[_0x6cea('0x27')](_0x345262);};}exports[_0x6cea('0x28')]=function(_0x54328c,_0x22f5d2){var _0x3b89e4={},_0x4d63c5={},_0x3c0145={'count':0x0,'rows':[]};var _0x55d7a5=_[_0x6cea('0x29')](db[_0x6cea('0x2a')][_0x6cea('0x2b')],function(_0x21b450){return{'name':_0x21b450[_0x6cea('0x2c')],'type':_0x21b450['type'][_0x6cea('0x2d')]};});_0x4d63c5[_0x6cea('0x2e')]=_[_0x6cea('0x29')](_0x55d7a5,_0x6cea('0x2f'));_0x4d63c5[_0x6cea('0x30')]=_[_0x6cea('0x31')](_0x54328c[_0x6cea('0x30')]);_0x4d63c5[_0x6cea('0x32')]=_['intersection'](_0x4d63c5['model'],_0x4d63c5[_0x6cea('0x30')]);_0x3b89e4[_0x6cea('0x33')]=_[_0x6cea('0x34')](_0x4d63c5[_0x6cea('0x2e')],qs[_0x6cea('0x35')](_0x54328c[_0x6cea('0x30')]['fields']));_0x3b89e4[_0x6cea('0x33')]=_0x3b89e4[_0x6cea('0x33')][_0x6cea('0x36')]?_0x3b89e4[_0x6cea('0x33')]:_0x4d63c5[_0x6cea('0x2e')];if(!_0x54328c['query'][_0x6cea('0x37')](_0x6cea('0x38'))){_0x3b89e4['limit']=qs[_0x6cea('0x1b')](_0x54328c[_0x6cea('0x30')]['limit']);_0x3b89e4[_0x6cea('0x1e')]=qs['offset'](_0x54328c[_0x6cea('0x30')]['offset']);}_0x3b89e4['order']=qs[_0x6cea('0x39')](_0x54328c['query'][_0x6cea('0x39')]);_0x3b89e4[_0x6cea('0x3a')]=qs[_0x6cea('0x32')](_[_0x6cea('0x3b')](_0x54328c[_0x6cea('0x30')],_0x4d63c5[_0x6cea('0x32')]),_0x55d7a5);if(_0x54328c[_0x6cea('0x30')][_0x6cea('0x3c')]){_0x3b89e4[_0x6cea('0x3a')]=_['merge'](_0x3b89e4[_0x6cea('0x3a')],{'$or':_[_0x6cea('0x29')](_0x55d7a5,function(_0x42c8d0){if(_0x42c8d0[_0x6cea('0x3d')]!==_0x6cea('0x3e')){var _0x1ebd8e={};_0x1ebd8e[_0x42c8d0['name']]={'$like':'%'+_0x54328c[_0x6cea('0x30')][_0x6cea('0x3c')]+'%'};return _0x1ebd8e;}})});}_0x3b89e4=_['merge']({},_0x3b89e4,_0x54328c['options']);var _0x13ad8e={'where':_0x3b89e4[_0x6cea('0x3a')]};return db[_0x6cea('0x2a')][_0x6cea('0x1d')](_0x13ad8e)['then'](function(_0x5291e6){_0x3c0145[_0x6cea('0x1d')]=_0x5291e6;if(_0x54328c[_0x6cea('0x30')][_0x6cea('0x3f')]){_0x3b89e4['include']=[{'all':!![]}];}return db['SquareReport'][_0x6cea('0x40')](_0x3b89e4);})[_0x6cea('0x24')](function(_0x599afe){_0x3c0145[_0x6cea('0x41')]=_0x599afe;return _0x3c0145;})['then'](respondWithFilteredResult(_0x22f5d2,_0x3b89e4))[_0x6cea('0x42')](handleError(_0x22f5d2,null));};exports[_0x6cea('0x43')]=function(_0x1e9300,_0x302cbc){var _0x4d95e6={'raw':!![],'where':{'id':_0x1e9300[_0x6cea('0x44')]['id']}},_0x246555={};_0x246555[_0x6cea('0x2e')]=_[_0x6cea('0x31')](db[_0x6cea('0x2a')]['rawAttributes']);_0x246555[_0x6cea('0x30')]=_['keys'](_0x1e9300[_0x6cea('0x30')]);_0x246555[_0x6cea('0x32')]=_[_0x6cea('0x34')](_0x246555[_0x6cea('0x2e')],_0x246555['query']);_0x4d95e6[_0x6cea('0x33')]=_[_0x6cea('0x34')](_0x246555[_0x6cea('0x2e')],qs[_0x6cea('0x35')](_0x1e9300['query'][_0x6cea('0x35')]));_0x4d95e6['attributes']=_0x4d95e6[_0x6cea('0x33')][_0x6cea('0x36')]?_0x4d95e6[_0x6cea('0x33')]:_0x246555[_0x6cea('0x2e')];if(_0x1e9300['query'][_0x6cea('0x3f')]){_0x4d95e6[_0x6cea('0x45')]=[{'all':!![]}];}_0x4d95e6=_[_0x6cea('0x46')]({},_0x4d95e6,_0x1e9300[_0x6cea('0x47')]);return db[_0x6cea('0x2a')][_0x6cea('0x48')](_0x4d95e6)[_0x6cea('0x24')](handleEntityNotFound(_0x302cbc,null))[_0x6cea('0x24')](respondWithResult(_0x302cbc,null))['catch'](handleError(_0x302cbc,null));};exports[_0x6cea('0x49')]=function(_0x4d7a4e,_0x19f0d0){return db['SquareReport']['create'](_0x4d7a4e[_0x6cea('0x4a')],{})[_0x6cea('0x24')](respondWithResult(_0x19f0d0,0xc9))[_0x6cea('0x42')](handleError(_0x19f0d0,null));};exports[_0x6cea('0x23')]=function(_0x393a26,_0x25e484){if(_0x393a26['body']['id']){delete _0x393a26[_0x6cea('0x4a')]['id'];}return db[_0x6cea('0x2a')][_0x6cea('0x48')]({'where':{'id':_0x393a26[_0x6cea('0x44')]['id']}})[_0x6cea('0x24')](handleEntityNotFound(_0x25e484,null))[_0x6cea('0x24')](saveUpdates(_0x393a26[_0x6cea('0x4a')],null))[_0x6cea('0x24')](respondWithResult(_0x25e484,null))[_0x6cea('0x42')](handleError(_0x25e484,null));};exports[_0x6cea('0x25')]=function(_0x5b91a2,_0x162dbf){return db[_0x6cea('0x2a')][_0x6cea('0x48')]({'where':{'id':_0x5b91a2[_0x6cea('0x44')]['id']}})['then'](handleEntityNotFound(_0x162dbf,null))[_0x6cea('0x24')](removeEntity(_0x162dbf,null))[_0x6cea('0x42')](handleError(_0x162dbf,null));};exports[_0x6cea('0x4b')]=function(_0x584ed9,_0x435d75){return db[_0x6cea('0x2a')]['describe']()['then'](respondWithResult(_0x435d75,null))[_0x6cea('0x42')](handleError(_0x435d75,null));}; \ No newline at end of file +var _0xd9f2=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','send','index','map','SquareReport','rawAttributes','type','name','query','keys','filters','intersection','attributes','fields','length','sort','pick','merge','where','filter','options','includeAll','rows','show','params','model','include','find','create','body','catch','update','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xa990b7,_0x26c527){var _0x52c99c=function(_0xf94328){while(--_0xf94328){_0xa990b7['push'](_0xa990b7['shift']());}};_0x52c99c(++_0x26c527);}(_0xd9f2,0x14c));var _0x2d9f=function(_0x38d8b5,_0x383873){_0x38d8b5=_0x38d8b5-0x0;var _0x21f68e=_0xd9f2[_0x38d8b5];return _0x21f68e;};'use strict';var emlformat=require(_0x2d9f('0x0'));var rimraf=require(_0x2d9f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2d9f('0x2'));var moment=require(_0x2d9f('0x3'));var BPromise=require(_0x2d9f('0x4'));var Mustache=require(_0x2d9f('0x5'));var util=require(_0x2d9f('0x6'));var path=require(_0x2d9f('0x7'));var sox=require(_0x2d9f('0x8'));var csv=require(_0x2d9f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d9f('0xa'));var _=require('lodash');var squel=require(_0x2d9f('0xb'));var crypto=require(_0x2d9f('0xc'));var jsforce=require(_0x2d9f('0xd'));var deskjs=require(_0x2d9f('0xe'));var toCsv=require(_0x2d9f('0x9'));var querystring=require(_0x2d9f('0xf'));var Papa=require('papaparse');var Redis=require(_0x2d9f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2d9f('0x11'));var hardwareService=require(_0x2d9f('0x12'));var logger=require(_0x2d9f('0x13'))('api');var utils=require(_0x2d9f('0x14'));var config=require(_0x2d9f('0x15'));var licenseUtil=require(_0x2d9f('0x16'));var db=require(_0x2d9f('0x17'))['db'];function respondWithStatusCode(_0x2ccc67,_0x1e1e14){_0x1e1e14=_0x1e1e14||0xcc;return function(_0x2d5875){if(_0x2d5875){return _0x2ccc67[_0x2d9f('0x18')](_0x1e1e14);}return _0x2ccc67[_0x2d9f('0x19')](_0x1e1e14)[_0x2d9f('0x1a')]();};}function respondWithResult(_0x84f24f,_0x2ee16d){_0x2ee16d=_0x2ee16d||0xc8;return function(_0x31377a){if(_0x31377a){return _0x84f24f[_0x2d9f('0x19')](_0x2ee16d)[_0x2d9f('0x1b')](_0x31377a);}};}function respondWithFilteredResult(_0x12390a,_0x1f0c3f){return function(_0x5b43d0){if(_0x5b43d0){var _0x157a4c=typeof _0x1f0c3f[_0x2d9f('0x1c')]===_0x2d9f('0x1d')&&typeof _0x1f0c3f[_0x2d9f('0x1e')]===_0x2d9f('0x1d');var _0x1116f3=_0x5b43d0[_0x2d9f('0x1f')];var _0x24ba66=_0x157a4c?0x0:_0x1f0c3f[_0x2d9f('0x1c')];var _0x5079bb=_0x157a4c?_0x5b43d0[_0x2d9f('0x1f')]:_0x1f0c3f[_0x2d9f('0x1c')]+_0x1f0c3f[_0x2d9f('0x1e')];var _0xcc4c14;if(_0x5079bb>=_0x1116f3){_0x5079bb=_0x1116f3;_0xcc4c14=0xc8;}else{_0xcc4c14=0xce;}_0x12390a[_0x2d9f('0x19')](_0xcc4c14);return _0x12390a[_0x2d9f('0x20')](_0x2d9f('0x21'),_0x24ba66+'-'+_0x5079bb+'/'+_0x1116f3)[_0x2d9f('0x1b')](_0x5b43d0);}return null;};}function patchUpdates(_0x47e05f){return function(_0x4b3b4b){try{jsonpatch[_0x2d9f('0x22')](_0x4b3b4b,_0x47e05f,!![]);}catch(_0x25c94a){return BPromise[_0x2d9f('0x23')](_0x25c94a);}return _0x4b3b4b[_0x2d9f('0x24')]();};}function saveUpdates(_0x15b5f1,_0x4deba8){return function(_0x2b8157){if(_0x2b8157){return _0x2b8157['update'](_0x15b5f1)[_0x2d9f('0x25')](function(_0x58e4ac){return _0x58e4ac;});}return null;};}function removeEntity(_0x124169,_0x3683b7){return function(_0x185938){if(_0x185938){return _0x185938[_0x2d9f('0x26')]()['then'](function(){_0x124169['status'](0xcc)[_0x2d9f('0x1a')]();});}};}function handleEntityNotFound(_0x4a3cc2,_0x4716b7){return function(_0x1ea639){if(!_0x1ea639){_0x4a3cc2[_0x2d9f('0x18')](0x194);}return _0x1ea639;};}function handleError(_0x38f8e0,_0x1d62b8){_0x1d62b8=_0x1d62b8||0x1f4;return function(_0x59c211){logger['error'](_0x59c211['stack']);if(_0x59c211['name']){delete _0x59c211['name'];}_0x38f8e0[_0x2d9f('0x19')](_0x1d62b8)[_0x2d9f('0x27')](_0x59c211);};}exports[_0x2d9f('0x28')]=function(_0x3bca58,_0x1ee8b8){var _0x54e1e1={},_0x15e698={},_0x50ac4b={'count':0x0,'rows':[]};var _0x2ae065=_[_0x2d9f('0x29')](db[_0x2d9f('0x2a')][_0x2d9f('0x2b')],function(_0x3cedba){return{'name':_0x3cedba['fieldName'],'type':_0x3cedba[_0x2d9f('0x2c')]['key']};});_0x15e698['model']=_[_0x2d9f('0x29')](_0x2ae065,_0x2d9f('0x2d'));_0x15e698[_0x2d9f('0x2e')]=_[_0x2d9f('0x2f')](_0x3bca58[_0x2d9f('0x2e')]);_0x15e698[_0x2d9f('0x30')]=_[_0x2d9f('0x31')](_0x15e698['model'],_0x15e698[_0x2d9f('0x2e')]);_0x54e1e1[_0x2d9f('0x32')]=_[_0x2d9f('0x31')](_0x15e698['model'],qs[_0x2d9f('0x33')](_0x3bca58[_0x2d9f('0x2e')][_0x2d9f('0x33')]));_0x54e1e1[_0x2d9f('0x32')]=_0x54e1e1[_0x2d9f('0x32')][_0x2d9f('0x34')]?_0x54e1e1[_0x2d9f('0x32')]:_0x15e698['model'];if(!_0x3bca58[_0x2d9f('0x2e')]['hasOwnProperty']('nolimit')){_0x54e1e1['limit']=qs[_0x2d9f('0x1e')](_0x3bca58['query'][_0x2d9f('0x1e')]);_0x54e1e1[_0x2d9f('0x1c')]=qs[_0x2d9f('0x1c')](_0x3bca58['query'][_0x2d9f('0x1c')]);}_0x54e1e1['order']=qs['sort'](_0x3bca58[_0x2d9f('0x2e')][_0x2d9f('0x35')]);_0x54e1e1['where']=qs['filters'](_[_0x2d9f('0x36')](_0x3bca58[_0x2d9f('0x2e')],_0x15e698[_0x2d9f('0x30')]),_0x2ae065);if(_0x3bca58['query']['filter']){_0x54e1e1['where']=_[_0x2d9f('0x37')](_0x54e1e1[_0x2d9f('0x38')],{'$or':_[_0x2d9f('0x29')](_0x2ae065,function(_0x53df43){if(_0x53df43['type']!=='VIRTUAL'){var _0x3afc93={};_0x3afc93[_0x53df43[_0x2d9f('0x2d')]]={'$like':'%'+_0x3bca58[_0x2d9f('0x2e')][_0x2d9f('0x39')]+'%'};return _0x3afc93;}})});}_0x54e1e1=_['merge']({},_0x54e1e1,_0x3bca58[_0x2d9f('0x3a')]);var _0x56da38={'where':_0x54e1e1[_0x2d9f('0x38')]};return db[_0x2d9f('0x2a')][_0x2d9f('0x1f')](_0x56da38)[_0x2d9f('0x25')](function(_0xb0271d){_0x50ac4b['count']=_0xb0271d;if(_0x3bca58[_0x2d9f('0x2e')][_0x2d9f('0x3b')]){_0x54e1e1['include']=[{'all':!![]}];}return db[_0x2d9f('0x2a')]['findAll'](_0x54e1e1);})[_0x2d9f('0x25')](function(_0x1915c6){_0x50ac4b[_0x2d9f('0x3c')]=_0x1915c6;return _0x50ac4b;})[_0x2d9f('0x25')](respondWithFilteredResult(_0x1ee8b8,_0x54e1e1))['catch'](handleError(_0x1ee8b8,null));};exports[_0x2d9f('0x3d')]=function(_0x9fe589,_0x4d1a60){var _0x9dffa3={'raw':!![],'where':{'id':_0x9fe589[_0x2d9f('0x3e')]['id']}},_0x460757={};_0x460757[_0x2d9f('0x3f')]=_[_0x2d9f('0x2f')](db[_0x2d9f('0x2a')][_0x2d9f('0x2b')]);_0x460757[_0x2d9f('0x2e')]=_[_0x2d9f('0x2f')](_0x9fe589[_0x2d9f('0x2e')]);_0x460757['filters']=_[_0x2d9f('0x31')](_0x460757['model'],_0x460757['query']);_0x9dffa3[_0x2d9f('0x32')]=_[_0x2d9f('0x31')](_0x460757[_0x2d9f('0x3f')],qs['fields'](_0x9fe589[_0x2d9f('0x2e')]['fields']));_0x9dffa3[_0x2d9f('0x32')]=_0x9dffa3['attributes']['length']?_0x9dffa3[_0x2d9f('0x32')]:_0x460757[_0x2d9f('0x3f')];if(_0x9fe589['query']['includeAll']){_0x9dffa3[_0x2d9f('0x40')]=[{'all':!![]}];}_0x9dffa3=_[_0x2d9f('0x37')]({},_0x9dffa3,_0x9fe589[_0x2d9f('0x3a')]);return db[_0x2d9f('0x2a')][_0x2d9f('0x41')](_0x9dffa3)[_0x2d9f('0x25')](handleEntityNotFound(_0x4d1a60,null))[_0x2d9f('0x25')](respondWithResult(_0x4d1a60,null))['catch'](handleError(_0x4d1a60,null));};exports[_0x2d9f('0x42')]=function(_0x358281,_0x5b871c){return db[_0x2d9f('0x2a')][_0x2d9f('0x42')](_0x358281[_0x2d9f('0x43')],{})['then'](respondWithResult(_0x5b871c,0xc9))[_0x2d9f('0x44')](handleError(_0x5b871c,null));};exports[_0x2d9f('0x45')]=function(_0x421f15,_0x5ef7bb){if(_0x421f15[_0x2d9f('0x43')]['id']){delete _0x421f15[_0x2d9f('0x43')]['id'];}return db['SquareReport'][_0x2d9f('0x41')]({'where':{'id':_0x421f15[_0x2d9f('0x3e')]['id']}})[_0x2d9f('0x25')](handleEntityNotFound(_0x5ef7bb,null))[_0x2d9f('0x25')](saveUpdates(_0x421f15[_0x2d9f('0x43')],null))[_0x2d9f('0x25')](respondWithResult(_0x5ef7bb,null))[_0x2d9f('0x44')](handleError(_0x5ef7bb,null));};exports[_0x2d9f('0x26')]=function(_0x34543f,_0x591468){return db['SquareReport'][_0x2d9f('0x41')]({'where':{'id':_0x34543f[_0x2d9f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x591468,null))[_0x2d9f('0x25')](removeEntity(_0x591468,null))[_0x2d9f('0x44')](handleError(_0x591468,null));};exports['describe']=function(_0x1dd0b1,_0x2a2b27){return db['SquareReport'][_0x2d9f('0x46')]()[_0x2d9f('0x25')](respondWithResult(_0x2a2b27,null))[_0x2d9f('0x44')](handleError(_0x2a2b27,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index cadee8d..8b71c6f 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 _0xcd58=['moment','bluebird','path','../../config/environment','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','util','../../config/logger'];(function(_0x389b46,_0x48ca69){var _0x3e335c=function(_0x5e3e7f){while(--_0x5e3e7f){_0x389b46['push'](_0x389b46['shift']());}};_0x3e335c(++_0x48ca69);}(_0xcd58,0x150));var _0x8cd5=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0xcd58[_0x2d344f];return _0x2e796b;};'use strict';var _=require('lodash');var util=require(_0x8cd5('0x0'));var logger=require(_0x8cd5('0x1'))('api');var moment=require(_0x8cd5('0x2'));var BPromise=require(_0x8cd5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8cd5('0x4'));var rimraf=require('rimraf');var config=require(_0x8cd5('0x5'));var attributes=require('./squareReport.attributes');module['exports']=function(_0x2a8e04,_0x4e22ba){return _0x2a8e04[_0x8cd5('0x6')](_0x8cd5('0x7'),attributes,{'tableName':_0x8cd5('0x8'),'paranoid':![],'indexes':[{'name':_0x8cd5('0x9'),'fields':[_0x8cd5('0xa'),_0x8cd5('0xb')]},{'name':_0x8cd5('0xc'),'fields':[_0x8cd5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x45ab=['report_square','uniqueid','leaveAt','lodash','api','moment','request-promise','../../config/environment','./squareReport.attributes','exports','define','SquareReport'];(function(_0x5e6c41,_0x11e182){var _0x254e22=function(_0x387977){while(--_0x387977){_0x5e6c41['push'](_0x5e6c41['shift']());}};_0x254e22(++_0x11e182);}(_0x45ab,0x87));var _0xb45a=function(_0x22eb5d,_0x2e519d){_0x22eb5d=_0x22eb5d-0x0;var _0x4a39ad=_0x45ab[_0x22eb5d];return _0x4a39ad;};'use strict';var _=require(_0xb45a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb45a('0x1'));var moment=require(_0xb45a('0x2'));var BPromise=require('bluebird');var rp=require(_0xb45a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb45a('0x4'));var attributes=require(_0xb45a('0x5'));module[_0xb45a('0x6')]=function(_0x30b7df,_0x5dbee8){return _0x30b7df[_0xb45a('0x7')](_0xb45a('0x8'),attributes,{'tableName':_0xb45a('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xb45a('0xa'),'project_name']},{'name':_0xb45a('0xb'),'fields':[_0xb45a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index a8eb0d4..65ac8d8 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 _0x1b6d=['message','info','result','catch','CreateSquareReport','SquareReport','create','options','raw','UpdateSquareReport','where','stringify','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','SquareReport,\x20%s,\x20%s'];(function(_0x337c33,_0x508d9a){var _0x23f2da=function(_0x4f4030){while(--_0x4f4030){_0x337c33['push'](_0x337c33['shift']());}};_0x23f2da(++_0x508d9a);}(_0x1b6d,0xde));var _0xd1b6=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x1b6d[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xd1b6('0x0'));var util=require('util');var moment=require(_0xd1b6('0x1'));var BPromise=require('bluebird');var rs=require(_0xd1b6('0x2'));var fs=require('fs');var Redis=require(_0xd1b6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd1b6('0x4'));var logger=require(_0xd1b6('0x5'))('rpc');var config=require(_0xd1b6('0x6'));var jayson=require(_0xd1b6('0x7'));var client=jayson[_0xd1b6('0x8')][_0xd1b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6374e8,_0x19fee1,_0x5296b){return new BPromise(function(_0x5ba691,_0x58234b){return client[_0xd1b6('0xa')](_0x6374e8,_0x5296b)[_0xd1b6('0xb')](function(_0x44c916){logger['info']('SquareReport,\x20%s,\x20%s',_0x19fee1,_0xd1b6('0xc'));logger[_0xd1b6('0xd')](_0xd1b6('0xe'),_0x19fee1,'request\x20sent',JSON['stringify'](_0x44c916));if(_0x44c916[_0xd1b6('0xf')]){if(_0x44c916[_0xd1b6('0xf')][_0xd1b6('0x10')]===0x1f4){logger[_0xd1b6('0xf')](_0xd1b6('0x11'),_0x19fee1,_0x44c916[_0xd1b6('0xf')][_0xd1b6('0x12')]);return _0x58234b(_0x44c916[_0xd1b6('0xf')]['message']);}logger[_0xd1b6('0xf')](_0xd1b6('0x11'),_0x19fee1,_0x44c916[_0xd1b6('0xf')][_0xd1b6('0x12')]);return _0x5ba691(_0x44c916[_0xd1b6('0xf')][_0xd1b6('0x12')]);}else{logger[_0xd1b6('0x13')](_0xd1b6('0x11'),_0x19fee1,_0xd1b6('0xc'));_0x5ba691(_0x44c916[_0xd1b6('0x14')][_0xd1b6('0x12')]);}})[_0xd1b6('0x15')](function(_0x3220a2){logger[_0xd1b6('0xf')](_0xd1b6('0x11'),_0x19fee1,_0x3220a2);_0x58234b(_0x3220a2);});});}exports[_0xd1b6('0x16')]=function(_0x5d2b14){var _0x4715b2=this;return new Promise(function(_0x491d3a,_0x5ad479){return db[_0xd1b6('0x17')][_0xd1b6('0x18')](_0x5d2b14['body'],{'raw':_0x5d2b14[_0xd1b6('0x19')]?_0x5d2b14['options'][_0xd1b6('0x1a')]===undefined?!![]:![]:!![]})[_0xd1b6('0xb')](function(_0x5abf1e){logger[_0xd1b6('0x13')](_0xd1b6('0x16'),_0x5d2b14);logger['debug']('CreateSquareReport',_0x5d2b14,JSON['stringify'](_0x5abf1e));_0x491d3a(_0x5abf1e);})['catch'](function(_0x3fd69c){logger['error']('CreateSquareReport',_0x3fd69c[_0xd1b6('0x12')],_0x5d2b14);_0x5ad479(_0x4715b2['error'](0x1f4,_0x3fd69c[_0xd1b6('0x12')]));});});};exports[_0xd1b6('0x1b')]=function(_0x8c378e){var _0x2c47d1=this;return new Promise(function(_0x4164d8,_0x3ae2ed){return db[_0xd1b6('0x17')]['update'](_0x8c378e['body'],{'raw':_0x8c378e['options']?_0x8c378e[_0xd1b6('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8c378e[_0xd1b6('0x19')]?_0x8c378e['options'][_0xd1b6('0x1c')]||null:null,'attributes':_0x8c378e[_0xd1b6('0x19')]?_0x8c378e[_0xd1b6('0x19')]['attributes']||null:null,'limit':_0x8c378e[_0xd1b6('0x19')]?_0x8c378e[_0xd1b6('0x19')]['limit']||null:null})[_0xd1b6('0xb')](function(_0x3c8775){logger[_0xd1b6('0x13')](_0xd1b6('0x1b'),_0x8c378e);logger[_0xd1b6('0xd')](_0xd1b6('0x1b'),_0x8c378e,JSON[_0xd1b6('0x1d')](_0x3c8775));_0x4164d8(_0x3c8775);})['catch'](function(_0x2581dc){logger['error'](_0xd1b6('0x1b'),_0x2581dc['message'],_0x8c378e);_0x3ae2ed(_0x2c47d1[_0xd1b6('0xf')](0x1f4,_0x2581dc[_0xd1b6('0x12')]));});});}; \ No newline at end of file +var _0x6d4b=['code','message','info','result','catch','create','body','options','raw','then','CreateSquareReport','UpdateSquareReport','update','where','limit','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6d4b,0xc3));var _0xb6d4=function(_0x943def,_0x285043){_0x943def=_0x943def-0x0;var _0x83e7de=_0x6d4b[_0x943def];return _0x83e7de;};'use strict';var _=require('lodash');var util=require(_0xb6d4('0x0'));var moment=require('moment');var BPromise=require(_0xb6d4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6d4('0x2'));var db=require(_0xb6d4('0x3'))['db'];var utils=require(_0xb6d4('0x4'));var logger=require(_0xb6d4('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb6d4('0x6'));var client=jayson['client'][_0xb6d4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x188089,_0x5a13db,_0x41bfa7){return new BPromise(function(_0x5c4e77,_0x130e34){return client[_0xb6d4('0x8')](_0x188089,_0x41bfa7)['then'](function(_0xc9de8){logger['info'](_0xb6d4('0x9'),_0x5a13db,_0xb6d4('0xa'));logger[_0xb6d4('0xb')](_0xb6d4('0xc'),_0x5a13db,'request\x20sent',JSON[_0xb6d4('0xd')](_0xc9de8));if(_0xc9de8[_0xb6d4('0xe')]){if(_0xc9de8[_0xb6d4('0xe')][_0xb6d4('0xf')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x5a13db,_0xc9de8['error'][_0xb6d4('0x10')]);return _0x130e34(_0xc9de8[_0xb6d4('0xe')][_0xb6d4('0x10')]);}logger['error'](_0xb6d4('0x9'),_0x5a13db,_0xc9de8[_0xb6d4('0xe')][_0xb6d4('0x10')]);return _0x5c4e77(_0xc9de8[_0xb6d4('0xe')][_0xb6d4('0x10')]);}else{logger[_0xb6d4('0x11')](_0xb6d4('0x9'),_0x5a13db,_0xb6d4('0xa'));_0x5c4e77(_0xc9de8[_0xb6d4('0x12')]['message']);}})[_0xb6d4('0x13')](function(_0x43a705){logger[_0xb6d4('0xe')](_0xb6d4('0x9'),_0x5a13db,_0x43a705);_0x130e34(_0x43a705);});});}exports['CreateSquareReport']=function(_0x4db8c2){var _0x14ec0f=this;return new Promise(function(_0x53b188,_0x4f33fe){return db['SquareReport'][_0xb6d4('0x14')](_0x4db8c2[_0xb6d4('0x15')],{'raw':_0x4db8c2[_0xb6d4('0x16')]?_0x4db8c2[_0xb6d4('0x16')][_0xb6d4('0x17')]===undefined?!![]:![]:!![]})[_0xb6d4('0x18')](function(_0x4b8155){logger[_0xb6d4('0x11')]('CreateSquareReport',_0x4db8c2);logger['debug'](_0xb6d4('0x19'),_0x4db8c2,JSON[_0xb6d4('0xd')](_0x4b8155));_0x53b188(_0x4b8155);})['catch'](function(_0xa00e95){logger[_0xb6d4('0xe')](_0xb6d4('0x19'),_0xa00e95[_0xb6d4('0x10')],_0x4db8c2);_0x4f33fe(_0x14ec0f[_0xb6d4('0xe')](0x1f4,_0xa00e95[_0xb6d4('0x10')]));});});};exports[_0xb6d4('0x1a')]=function(_0x881d02){var _0x48a025=this;return new Promise(function(_0x56d802,_0x2d035d){return db['SquareReport'][_0xb6d4('0x1b')](_0x881d02['body'],{'raw':_0x881d02[_0xb6d4('0x16')]?_0x881d02[_0xb6d4('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x881d02['options']?_0x881d02[_0xb6d4('0x16')][_0xb6d4('0x1c')]||null:null,'attributes':_0x881d02[_0xb6d4('0x16')]?_0x881d02['options']['attributes']||null:null,'limit':_0x881d02[_0xb6d4('0x16')]?_0x881d02['options'][_0xb6d4('0x1d')]||null:null})[_0xb6d4('0x18')](function(_0x3d80fd){logger['info'](_0xb6d4('0x1a'),_0x881d02);logger['debug'](_0xb6d4('0x1a'),_0x881d02,JSON[_0xb6d4('0xd')](_0x3d80fd));_0x56d802(_0x3d80fd);})[_0xb6d4('0x13')](function(_0x2beccc){logger[_0xb6d4('0xe')](_0xb6d4('0x1a'),_0x2beccc['message'],_0x881d02);_0x2d035d(_0x48a025[_0xb6d4('0xe')](0x1f4,_0x2beccc[_0xb6d4('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index d81958d..c40527a 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 _0x1290=['../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xe37f64,_0x448503){var _0x4b6e5d=function(_0x58f638){while(--_0x58f638){_0xe37f64['push'](_0xe37f64['shift']());}};_0x4b6e5d(++_0x448503);}(_0x1290,0xd6));var _0x0129=function(_0x1ae71a,_0x59701d){_0x1ae71a=_0x1ae71a-0x0;var _0x2b67c3=_0x1290[_0x1ae71a];return _0x2b67c3;};'use strict';var multer=require(_0x0129('0x0'));var util=require(_0x0129('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0129('0x2'));var router=express['Router']();var fs_extra=require(_0x0129('0x3'));var auth=require(_0x0129('0x4'));var interaction=require(_0x0129('0x5'));var config=require(_0x0129('0x6'));var controller=require(_0x0129('0x7'));router[_0x0129('0x8')]('/',auth[_0x0129('0x9')](),controller[_0x0129('0xa')]);router[_0x0129('0x8')]('/describe',auth[_0x0129('0x9')](),controller[_0x0129('0xb')]);router[_0x0129('0x8')](_0x0129('0xc'),auth['isAuthenticated'](),controller[_0x0129('0xd')]);router['post']('/',auth[_0x0129('0x9')](),controller[_0x0129('0xe')]);router[_0x0129('0xf')]('/:id',auth[_0x0129('0x9')](),controller[_0x0129('0x10')]);router[_0x0129('0x11')](_0x0129('0xc'),auth[_0x0129('0x9')](),controller[_0x0129('0x12')]);module[_0x0129('0x13')]=router; \ No newline at end of file +var _0x200e=['/describe','describe','create','put','update','/:id','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index'];(function(_0x4199a9,_0xf0a5c8){var _0x4aef66=function(_0x49ed67){while(--_0x49ed67){_0x4199a9['push'](_0x4199a9['shift']());}};_0x4aef66(++_0xf0a5c8);}(_0x200e,0x15e));var _0xe200=function(_0x3303d7,_0x32b4f5){_0x3303d7=_0x3303d7-0x0;var _0x52bf89=_0x200e[_0x3303d7];return _0x52bf89;};'use strict';var multer=require('multer');var util=require(_0xe200('0x0'));var path=require('path');var timeout=require(_0xe200('0x1'));var express=require(_0xe200('0x2'));var router=express[_0xe200('0x3')]();var fs_extra=require(_0xe200('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe200('0x5'));var config=require('../../config/environment');var controller=require(_0xe200('0x6'));router[_0xe200('0x7')]('/',auth[_0xe200('0x8')](),controller[_0xe200('0x9')]);router[_0xe200('0x7')](_0xe200('0xa'),auth[_0xe200('0x8')](),controller[_0xe200('0xb')]);router[_0xe200('0x7')]('/:id',auth[_0xe200('0x8')](),controller['show']);router['post']('/',auth[_0xe200('0x8')](),controller[_0xe200('0xc')]);router[_0xe200('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xe200('0xe')]);router['delete'](_0xe200('0xf'),auth['isAuthenticated'](),controller[_0xe200('0x10')]);module[_0xe200('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index c4bcc49..9ffadbd 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 _0x06ca=['TEXT','sequelize','exports','STRING'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0x06ca,0x10d));var _0xa06c=function(_0x3e19ec,_0x107de9){_0x3e19ec=_0x3e19ec-0x0;var _0x2e5e96=_0x06ca[_0x3e19ec];return _0x2e5e96;};'use strict';var Sequelize=require(_0xa06c('0x0'));module[_0xa06c('0x1')]={'uniqueid':{'type':Sequelize[_0xa06c('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xa06c('0x2')]},'data':{'type':Sequelize[_0xa06c('0x3')]},'project_name':{'type':Sequelize[_0xa06c('0x2')]},'callerid':{'type':Sequelize[_0xa06c('0x2')]}}; \ No newline at end of file +var _0xdcc5=['STRING','TEXT','exports'];(function(_0x4a8600,_0x1e723e){var _0x4458b6=function(_0x4b4b37){while(--_0x4b4b37){_0x4a8600['push'](_0x4a8600['shift']());}};_0x4458b6(++_0x1e723e);}(_0xdcc5,0x146));var _0x5dcc=function(_0x2f0731,_0x5f4ebb){_0x2f0731=_0x2f0731-0x0;var _0x449d79=_0xdcc5[_0x2f0731];return _0x449d79;};'use strict';var Sequelize=require('sequelize');module[_0x5dcc('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x5dcc('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x5dcc('0x2')]},'project_name':{'type':Sequelize[_0x5dcc('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 6547171..8dd1906 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 _0x4560=['include','create','update','body','find','describe','eml-format','rimraf','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','then','destroy','error','stack','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','options','includeAll','findAll','rows','catch','show','params'];(function(_0x1bc68e,_0x2a6dc5){var _0x2d65ca=function(_0x4ff6b2){while(--_0x4ff6b2){_0x1bc68e['push'](_0x1bc68e['shift']());}};_0x2d65ca(++_0x2a6dc5);}(_0x4560,0x1d4));var _0x0456=function(_0x2ae0b5,_0x319ed7){_0x2ae0b5=_0x2ae0b5-0x0;var _0x4c3bda=_0x4560[_0x2ae0b5];return _0x4c3bda;};'use strict';var emlformat=require(_0x0456('0x0'));var rimraf=require(_0x0456('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0456('0x2'));var util=require(_0x0456('0x3'));var path=require(_0x0456('0x4'));var sox=require(_0x0456('0x5'));var csv=require(_0x0456('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0456('0x7'));var crypto=require(_0x0456('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x0456('0x9'));var toCsv=require(_0x0456('0x6'));var querystring=require(_0x0456('0xa'));var Papa=require('papaparse');var Redis=require(_0x0456('0xb'));var authService=require(_0x0456('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x0456('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0456('0xe'))(_0x0456('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0456('0x10'))['db'];function respondWithStatusCode(_0x415cd5,_0x46b463){_0x46b463=_0x46b463||0xcc;return function(_0x2f147c){if(_0x2f147c){return _0x415cd5[_0x0456('0x11')](_0x46b463);}return _0x415cd5[_0x0456('0x12')](_0x46b463)[_0x0456('0x13')]();};}function respondWithResult(_0xe74de1,_0x4654d9){_0x4654d9=_0x4654d9||0xc8;return function(_0x17ecfd){if(_0x17ecfd){return _0xe74de1[_0x0456('0x12')](_0x4654d9)[_0x0456('0x14')](_0x17ecfd);}};}function respondWithFilteredResult(_0x3f07b6,_0x200de9){return function(_0x63e1d1){if(_0x63e1d1){var _0x2ba60f=typeof _0x200de9[_0x0456('0x15')]===_0x0456('0x16')&&typeof _0x200de9['limit']===_0x0456('0x16');var _0x4f4147=_0x63e1d1['count'];var _0x23e3c7=_0x2ba60f?0x0:_0x200de9[_0x0456('0x15')];var _0x65c456=_0x2ba60f?_0x63e1d1['count']:_0x200de9['offset']+_0x200de9[_0x0456('0x17')];var _0x3990d6;if(_0x65c456>=_0x4f4147){_0x65c456=_0x4f4147;_0x3990d6=0xc8;}else{_0x3990d6=0xce;}_0x3f07b6[_0x0456('0x12')](_0x3990d6);return _0x3f07b6[_0x0456('0x18')]('Content-Range',_0x23e3c7+'-'+_0x65c456+'/'+_0x4f4147)[_0x0456('0x14')](_0x63e1d1);}return null;};}function patchUpdates(_0x343743){return function(_0x3ab556){try{jsonpatch[_0x0456('0x19')](_0x3ab556,_0x343743,!![]);}catch(_0x3a1307){return BPromise[_0x0456('0x1a')](_0x3a1307);}return _0x3ab556['save']();};}function saveUpdates(_0xb2aa8b,_0x1f3691){return function(_0x8285d5){if(_0x8285d5){return _0x8285d5['update'](_0xb2aa8b)[_0x0456('0x1b')](function(_0x5a7ed6){return _0x5a7ed6;});}return null;};}function removeEntity(_0xd18f11,_0x52aa9e){return function(_0x1062f3){if(_0x1062f3){return _0x1062f3[_0x0456('0x1c')]()['then'](function(){_0xd18f11[_0x0456('0x12')](0xcc)[_0x0456('0x13')]();});}};}function handleEntityNotFound(_0x4debd9,_0x58017b){return function(_0x2fef35){if(!_0x2fef35){_0x4debd9[_0x0456('0x11')](0x194);}return _0x2fef35;};}function handleError(_0x9b66d3,_0x5eb67f){_0x5eb67f=_0x5eb67f||0x1f4;return function(_0x3122b8){logger[_0x0456('0x1d')](_0x3122b8[_0x0456('0x1e')]);if(_0x3122b8[_0x0456('0x1f')]){delete _0x3122b8[_0x0456('0x1f')];}_0x9b66d3[_0x0456('0x12')](_0x5eb67f)[_0x0456('0x20')](_0x3122b8);};}exports['index']=function(_0xdbe2eb,_0x2364be){var _0x280375={},_0x4dec6f={},_0x3b2d8f={'count':0x0,'rows':[]};var _0x37a421=_[_0x0456('0x21')](db[_0x0456('0x22')][_0x0456('0x23')],function(_0x36d8ea){return{'name':_0x36d8ea[_0x0456('0x24')],'type':_0x36d8ea[_0x0456('0x25')][_0x0456('0x26')]};});_0x4dec6f[_0x0456('0x27')]=_[_0x0456('0x21')](_0x37a421,'name');_0x4dec6f[_0x0456('0x28')]=_[_0x0456('0x29')](_0xdbe2eb['query']);_0x4dec6f[_0x0456('0x2a')]=_['intersection'](_0x4dec6f['model'],_0x4dec6f[_0x0456('0x28')]);_0x280375[_0x0456('0x2b')]=_[_0x0456('0x2c')](_0x4dec6f[_0x0456('0x27')],qs[_0x0456('0x2d')](_0xdbe2eb[_0x0456('0x28')][_0x0456('0x2d')]));_0x280375[_0x0456('0x2b')]=_0x280375[_0x0456('0x2b')][_0x0456('0x2e')]?_0x280375[_0x0456('0x2b')]:_0x4dec6f[_0x0456('0x27')];if(!_0xdbe2eb['query'][_0x0456('0x2f')](_0x0456('0x30'))){_0x280375['limit']=qs[_0x0456('0x17')](_0xdbe2eb[_0x0456('0x28')][_0x0456('0x17')]);_0x280375[_0x0456('0x15')]=qs[_0x0456('0x15')](_0xdbe2eb[_0x0456('0x28')]['offset']);}_0x280375['order']=qs[_0x0456('0x31')](_0xdbe2eb[_0x0456('0x28')][_0x0456('0x31')]);_0x280375['where']=qs[_0x0456('0x2a')](_[_0x0456('0x32')](_0xdbe2eb[_0x0456('0x28')],_0x4dec6f[_0x0456('0x2a')]),_0x37a421);if(_0xdbe2eb['query']['filter']){_0x280375[_0x0456('0x33')]=_[_0x0456('0x34')](_0x280375[_0x0456('0x33')],{'$or':_['map'](_0x37a421,function(_0xcedaa9){if(_0xcedaa9[_0x0456('0x25')]!=='VIRTUAL'){var _0x48087e={};_0x48087e[_0xcedaa9['name']]={'$like':'%'+_0xdbe2eb[_0x0456('0x28')]['filter']+'%'};return _0x48087e;}})});}_0x280375=_[_0x0456('0x34')]({},_0x280375,_0xdbe2eb[_0x0456('0x35')]);var _0x4a420b={'where':_0x280375[_0x0456('0x33')]};return db[_0x0456('0x22')]['count'](_0x4a420b)[_0x0456('0x1b')](function(_0x110df5){_0x3b2d8f['count']=_0x110df5;if(_0xdbe2eb['query'][_0x0456('0x36')]){_0x280375['include']=[{'all':!![]}];}return db[_0x0456('0x22')][_0x0456('0x37')](_0x280375);})[_0x0456('0x1b')](function(_0x1f1906){_0x3b2d8f[_0x0456('0x38')]=_0x1f1906;return _0x3b2d8f;})['then'](respondWithFilteredResult(_0x2364be,_0x280375))[_0x0456('0x39')](handleError(_0x2364be,null));};exports[_0x0456('0x3a')]=function(_0x105f84,_0x37951d){var _0x26a76c={'raw':!![],'where':{'id':_0x105f84[_0x0456('0x3b')]['id']}},_0x390a55={};_0x390a55[_0x0456('0x27')]=_[_0x0456('0x29')](db['SquareDetailsReport'][_0x0456('0x23')]);_0x390a55['query']=_['keys'](_0x105f84['query']);_0x390a55[_0x0456('0x2a')]=_[_0x0456('0x2c')](_0x390a55[_0x0456('0x27')],_0x390a55[_0x0456('0x28')]);_0x26a76c[_0x0456('0x2b')]=_[_0x0456('0x2c')](_0x390a55[_0x0456('0x27')],qs[_0x0456('0x2d')](_0x105f84[_0x0456('0x28')][_0x0456('0x2d')]));_0x26a76c[_0x0456('0x2b')]=_0x26a76c['attributes'][_0x0456('0x2e')]?_0x26a76c[_0x0456('0x2b')]:_0x390a55['model'];if(_0x105f84['query'][_0x0456('0x36')]){_0x26a76c[_0x0456('0x3c')]=[{'all':!![]}];}_0x26a76c=_[_0x0456('0x34')]({},_0x26a76c,_0x105f84['options']);return db['SquareDetailsReport']['find'](_0x26a76c)['then'](handleEntityNotFound(_0x37951d,null))[_0x0456('0x1b')](respondWithResult(_0x37951d,null))[_0x0456('0x39')](handleError(_0x37951d,null));};exports[_0x0456('0x3d')]=function(_0x18fb5c,_0x25f07b){return db['SquareDetailsReport']['create'](_0x18fb5c['body'],{})[_0x0456('0x1b')](respondWithResult(_0x25f07b,0xc9))[_0x0456('0x39')](handleError(_0x25f07b,null));};exports[_0x0456('0x3e')]=function(_0x109655,_0x39ed16){if(_0x109655['body']['id']){delete _0x109655[_0x0456('0x3f')]['id'];}return db['SquareDetailsReport'][_0x0456('0x40')]({'where':{'id':_0x109655['params']['id']}})[_0x0456('0x1b')](handleEntityNotFound(_0x39ed16,null))[_0x0456('0x1b')](saveUpdates(_0x109655[_0x0456('0x3f')],null))[_0x0456('0x1b')](respondWithResult(_0x39ed16,null))[_0x0456('0x39')](handleError(_0x39ed16,null));};exports[_0x0456('0x1c')]=function(_0x16d1f0,_0x11537c){return db[_0x0456('0x22')][_0x0456('0x40')]({'where':{'id':_0x16d1f0[_0x0456('0x3b')]['id']}})[_0x0456('0x1b')](handleEntityNotFound(_0x11537c,null))[_0x0456('0x1b')](removeEntity(_0x11537c,null))['catch'](handleError(_0x11537c,null));};exports[_0x0456('0x41')]=function(_0x18af4b,_0x4e9e3a){return db['SquareDetailsReport']['describe']()[_0x0456('0x1b')](respondWithResult(_0x4e9e3a,null))[_0x0456('0x39')](handleError(_0x4e9e3a,null));}; \ No newline at end of file +var _0x00b8=['filter','options','SquareDetailsReport','includeAll','include','catch','show','find','create','body','params','describe','eml-format','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL'];(function(_0x90b342,_0x13a7d3){var _0x37845e=function(_0x4552d6){while(--_0x4552d6){_0x90b342['push'](_0x90b342['shift']());}};_0x37845e(++_0x13a7d3);}(_0x00b8,0x1e0));var _0x800b=function(_0x27a7eb,_0x340bae){_0x27a7eb=_0x27a7eb-0x0;var _0x158a4a=_0x00b8[_0x27a7eb];return _0x158a4a;};'use strict';var emlformat=require(_0x800b('0x0'));var rimraf=require(_0x800b('0x1'));var zipdir=require(_0x800b('0x2'));var jsonpatch=require(_0x800b('0x3'));var rp=require(_0x800b('0x4'));var moment=require(_0x800b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x800b('0x6'));var util=require('util');var path=require(_0x800b('0x7'));var sox=require(_0x800b('0x8'));var csv=require(_0x800b('0x9'));var ejs=require(_0x800b('0xa'));var fs=require('fs');var fs_extra=require(_0x800b('0xb'));var _=require(_0x800b('0xc'));var squel=require(_0x800b('0xd'));var crypto=require(_0x800b('0xe'));var jsforce=require(_0x800b('0xf'));var deskjs=require(_0x800b('0x10'));var toCsv=require(_0x800b('0x9'));var querystring=require(_0x800b('0x11'));var Papa=require(_0x800b('0x12'));var Redis=require('ioredis');var authService=require(_0x800b('0x13'));var qs=require(_0x800b('0x14'));var as=require(_0x800b('0x15'));var hardwareService=require(_0x800b('0x16'));var logger=require('../../config/logger')(_0x800b('0x17'));var utils=require(_0x800b('0x18'));var config=require(_0x800b('0x19'));var licenseUtil=require(_0x800b('0x1a'));var db=require(_0x800b('0x1b'))['db'];function respondWithStatusCode(_0x471316,_0x363ec0){_0x363ec0=_0x363ec0||0xcc;return function(_0x1512e8){if(_0x1512e8){return _0x471316[_0x800b('0x1c')](_0x363ec0);}return _0x471316[_0x800b('0x1d')](_0x363ec0)[_0x800b('0x1e')]();};}function respondWithResult(_0x2cb5cb,_0x3aed4c){_0x3aed4c=_0x3aed4c||0xc8;return function(_0x1c4546){if(_0x1c4546){return _0x2cb5cb[_0x800b('0x1d')](_0x3aed4c)['json'](_0x1c4546);}};}function respondWithFilteredResult(_0xf6fd83,_0x19b7e9){return function(_0x564d27){if(_0x564d27){var _0x43249b=typeof _0x19b7e9[_0x800b('0x1f')]===_0x800b('0x20')&&typeof _0x19b7e9[_0x800b('0x21')]===_0x800b('0x20');var _0x311784=_0x564d27[_0x800b('0x22')];var _0x50e857=_0x43249b?0x0:_0x19b7e9[_0x800b('0x1f')];var _0x117680=_0x43249b?_0x564d27['count']:_0x19b7e9[_0x800b('0x1f')]+_0x19b7e9[_0x800b('0x21')];var _0x2637f3;if(_0x117680>=_0x311784){_0x117680=_0x311784;_0x2637f3=0xc8;}else{_0x2637f3=0xce;}_0xf6fd83[_0x800b('0x1d')](_0x2637f3);return _0xf6fd83['set'](_0x800b('0x23'),_0x50e857+'-'+_0x117680+'/'+_0x311784)[_0x800b('0x24')](_0x564d27);}return null;};}function patchUpdates(_0x4e8d92){return function(_0xc96ff6){try{jsonpatch['apply'](_0xc96ff6,_0x4e8d92,!![]);}catch(_0x5e476e){return BPromise['reject'](_0x5e476e);}return _0xc96ff6[_0x800b('0x25')]();};}function saveUpdates(_0x24a2a8,_0x2d645b){return function(_0x4611e5){if(_0x4611e5){return _0x4611e5[_0x800b('0x26')](_0x24a2a8)[_0x800b('0x27')](function(_0x174de7){return _0x174de7;});}return null;};}function removeEntity(_0x2ae20a,_0x338d64){return function(_0xcde909){if(_0xcde909){return _0xcde909[_0x800b('0x28')]()[_0x800b('0x27')](function(){_0x2ae20a['status'](0xcc)[_0x800b('0x1e')]();});}};}function handleEntityNotFound(_0x52d4cd,_0x1aa519){return function(_0x59ea97){if(!_0x59ea97){_0x52d4cd[_0x800b('0x1c')](0x194);}return _0x59ea97;};}function handleError(_0x3f5411,_0x1d118b){_0x1d118b=_0x1d118b||0x1f4;return function(_0x5ad03a){logger[_0x800b('0x29')](_0x5ad03a[_0x800b('0x2a')]);if(_0x5ad03a[_0x800b('0x2b')]){delete _0x5ad03a[_0x800b('0x2b')];}_0x3f5411[_0x800b('0x1d')](_0x1d118b)[_0x800b('0x2c')](_0x5ad03a);};}exports[_0x800b('0x2d')]=function(_0x57b7f2,_0x4ad806){var _0x5dcd20={},_0x535131={},_0x65bef9={'count':0x0,'rows':[]};var _0x23c5f3=_['map'](db['SquareDetailsReport'][_0x800b('0x2e')],function(_0x17f791){return{'name':_0x17f791[_0x800b('0x2f')],'type':_0x17f791[_0x800b('0x30')][_0x800b('0x31')]};});_0x535131[_0x800b('0x32')]=_[_0x800b('0x33')](_0x23c5f3,'name');_0x535131[_0x800b('0x34')]=_[_0x800b('0x35')](_0x57b7f2['query']);_0x535131[_0x800b('0x36')]=_['intersection'](_0x535131['model'],_0x535131[_0x800b('0x34')]);_0x5dcd20[_0x800b('0x37')]=_[_0x800b('0x38')](_0x535131[_0x800b('0x32')],qs[_0x800b('0x39')](_0x57b7f2['query'][_0x800b('0x39')]));_0x5dcd20[_0x800b('0x37')]=_0x5dcd20[_0x800b('0x37')][_0x800b('0x3a')]?_0x5dcd20[_0x800b('0x37')]:_0x535131[_0x800b('0x32')];if(!_0x57b7f2[_0x800b('0x34')][_0x800b('0x3b')](_0x800b('0x3c'))){_0x5dcd20[_0x800b('0x21')]=qs['limit'](_0x57b7f2['query']['limit']);_0x5dcd20[_0x800b('0x1f')]=qs[_0x800b('0x1f')](_0x57b7f2[_0x800b('0x34')][_0x800b('0x1f')]);}_0x5dcd20['order']=qs[_0x800b('0x3d')](_0x57b7f2['query'][_0x800b('0x3d')]);_0x5dcd20[_0x800b('0x3e')]=qs[_0x800b('0x36')](_[_0x800b('0x3f')](_0x57b7f2['query'],_0x535131[_0x800b('0x36')]),_0x23c5f3);if(_0x57b7f2[_0x800b('0x34')]['filter']){_0x5dcd20[_0x800b('0x3e')]=_[_0x800b('0x40')](_0x5dcd20['where'],{'$or':_[_0x800b('0x33')](_0x23c5f3,function(_0x1195e4){if(_0x1195e4[_0x800b('0x30')]!==_0x800b('0x41')){var _0x24054c={};_0x24054c[_0x1195e4['name']]={'$like':'%'+_0x57b7f2[_0x800b('0x34')][_0x800b('0x42')]+'%'};return _0x24054c;}})});}_0x5dcd20=_[_0x800b('0x40')]({},_0x5dcd20,_0x57b7f2[_0x800b('0x43')]);var _0x4b8134={'where':_0x5dcd20[_0x800b('0x3e')]};return db[_0x800b('0x44')][_0x800b('0x22')](_0x4b8134)['then'](function(_0x35cf61){_0x65bef9[_0x800b('0x22')]=_0x35cf61;if(_0x57b7f2[_0x800b('0x34')][_0x800b('0x45')]){_0x5dcd20[_0x800b('0x46')]=[{'all':!![]}];}return db[_0x800b('0x44')]['findAll'](_0x5dcd20);})[_0x800b('0x27')](function(_0x4fc847){_0x65bef9['rows']=_0x4fc847;return _0x65bef9;})[_0x800b('0x27')](respondWithFilteredResult(_0x4ad806,_0x5dcd20))[_0x800b('0x47')](handleError(_0x4ad806,null));};exports[_0x800b('0x48')]=function(_0x44653b,_0x1fb288){var _0x174712={'raw':!![],'where':{'id':_0x44653b['params']['id']}},_0x38a2a8={};_0x38a2a8[_0x800b('0x32')]=_[_0x800b('0x35')](db[_0x800b('0x44')][_0x800b('0x2e')]);_0x38a2a8[_0x800b('0x34')]=_[_0x800b('0x35')](_0x44653b[_0x800b('0x34')]);_0x38a2a8[_0x800b('0x36')]=_[_0x800b('0x38')](_0x38a2a8[_0x800b('0x32')],_0x38a2a8[_0x800b('0x34')]);_0x174712[_0x800b('0x37')]=_['intersection'](_0x38a2a8[_0x800b('0x32')],qs[_0x800b('0x39')](_0x44653b[_0x800b('0x34')]['fields']));_0x174712['attributes']=_0x174712[_0x800b('0x37')][_0x800b('0x3a')]?_0x174712['attributes']:_0x38a2a8[_0x800b('0x32')];if(_0x44653b[_0x800b('0x34')]['includeAll']){_0x174712[_0x800b('0x46')]=[{'all':!![]}];}_0x174712=_[_0x800b('0x40')]({},_0x174712,_0x44653b['options']);return db['SquareDetailsReport'][_0x800b('0x49')](_0x174712)['then'](handleEntityNotFound(_0x1fb288,null))['then'](respondWithResult(_0x1fb288,null))[_0x800b('0x47')](handleError(_0x1fb288,null));};exports[_0x800b('0x4a')]=function(_0xa017c6,_0x13767c){return db['SquareDetailsReport']['create'](_0xa017c6[_0x800b('0x4b')],{})[_0x800b('0x27')](respondWithResult(_0x13767c,0xc9))[_0x800b('0x47')](handleError(_0x13767c,null));};exports[_0x800b('0x26')]=function(_0xc853de,_0x8b0d78){if(_0xc853de[_0x800b('0x4b')]['id']){delete _0xc853de[_0x800b('0x4b')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0xc853de['params']['id']}})['then'](handleEntityNotFound(_0x8b0d78,null))['then'](saveUpdates(_0xc853de[_0x800b('0x4b')],null))[_0x800b('0x27')](respondWithResult(_0x8b0d78,null))[_0x800b('0x47')](handleError(_0x8b0d78,null));};exports[_0x800b('0x28')]=function(_0x3c83ec,_0x10fcf4){return db[_0x800b('0x44')][_0x800b('0x49')]({'where':{'id':_0x3c83ec[_0x800b('0x4c')]['id']}})[_0x800b('0x27')](handleEntityNotFound(_0x10fcf4,null))['then'](removeEntity(_0x10fcf4,null))[_0x800b('0x47')](handleError(_0x10fcf4,null));};exports[_0x800b('0x4d')]=function(_0x11e67d,_0x492810){return db[_0x800b('0x44')][_0x800b('0x4d')]()[_0x800b('0x27')](respondWithResult(_0x492810,null))[_0x800b('0x47')](handleError(_0x492810,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index e30d590..add72ad 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 _0xe338=['SquareDetailsReport','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xe338,0x17b));var _0x8e33=function(_0x586e15,_0x931f57){_0x586e15=_0x586e15-0x0;var _0x4308e2=_0xe338[_0x586e15];return _0x4308e2;};'use strict';var _=require(_0x8e33('0x0'));var util=require(_0x8e33('0x1'));var logger=require(_0x8e33('0x2'))(_0x8e33('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8e33('0x4'));var fs=require('fs');var path=require(_0x8e33('0x5'));var rimraf=require(_0x8e33('0x6'));var config=require(_0x8e33('0x7'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x125d51,_0x2a8dff){return _0x125d51['define'](_0x8e33('0x8'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0634=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0634,0x70));var _0x4063=function(_0x477f94,_0x42fdfa){_0x477f94=_0x477f94-0x0;var _0x1fdf10=_0x0634[_0x477f94];return _0x1fdf10;};'use strict';var _=require(_0x4063('0x0'));var util=require(_0x4063('0x1'));var logger=require(_0x4063('0x2'))(_0x4063('0x3'));var moment=require(_0x4063('0x4'));var BPromise=require(_0x4063('0x5'));var rp=require(_0x4063('0x6'));var fs=require('fs');var path=require(_0x4063('0x7'));var rimraf=require('rimraf');var config=require(_0x4063('0x8'));var attributes=require(_0x4063('0x9'));module[_0x4063('0xa')]=function(_0x2f2dcd,_0x46f4e4){return _0x2f2dcd[_0x4063('0xb')](_0x4063('0xc'),attributes,{'tableName':_0x4063('0xd'),'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 d245627..bb8e284 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 _0x32b6=['request','then','debug','request\x20sent','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','info','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x32b6,0x1d1));var _0x632b=function(_0x12c1bd,_0x153961){_0x12c1bd=_0x12c1bd-0x0;var _0x3db471=_0x32b6[_0x12c1bd];return _0x3db471;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});}exports[_0x632b('0x15')]=function(_0x3bb27f){var _0x28c472=this;return new Promise(function(_0x51c894,_0x2f3e88){return db[_0x632b('0x16')][_0x632b('0x17')](_0x3bb27f[_0x632b('0x18')],{'raw':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')][_0x632b('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x116f62){logger['info']('CreateSquareDetailsReport',_0x3bb27f);logger[_0x632b('0xd')]('CreateSquareDetailsReport',_0x3bb27f,JSON[_0x632b('0xf')](_0x116f62));_0x51c894(_0x116f62);})[_0x632b('0x1b')](function(_0x2a6833){logger['error'](_0x632b('0x15'),_0x2a6833[_0x632b('0x13')],_0x3bb27f);_0x2f3e88(_0x28c472['error'](0x1f4,_0x2a6833[_0x632b('0x13')]));});});}; \ No newline at end of file +var _0x8a5c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSquareDetailsReport','create','options','lodash','util'];(function(_0x51f94e,_0x2f0b65){var _0x5d8d15=function(_0x11cac7){while(--_0x11cac7){_0x51f94e['push'](_0x51f94e['shift']());}};_0x5d8d15(++_0x2f0b65);}(_0x8a5c,0x136));var _0xc8a5=function(_0x438465,_0x24a17a){_0x438465=_0x438465-0x0;var _0x1455b0=_0x8a5c[_0x438465];return _0x1455b0;};'use strict';var _=require(_0xc8a5('0x0'));var util=require(_0xc8a5('0x1'));var moment=require(_0xc8a5('0x2'));var BPromise=require(_0xc8a5('0x3'));var rs=require(_0xc8a5('0x4'));var fs=require('fs');var Redis=require(_0xc8a5('0x5'));var db=require(_0xc8a5('0x6'))['db'];var utils=require(_0xc8a5('0x7'));var logger=require(_0xc8a5('0x8'))('rpc');var config=require(_0xc8a5('0x9'));var jayson=require(_0xc8a5('0xa'));var client=jayson['client'][_0xc8a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcee97e,_0xd6de78,_0xa9f42c){return new BPromise(function(_0x4d25e4,_0x3ecf08){return client[_0xc8a5('0xc')](_0xcee97e,_0xa9f42c)[_0xc8a5('0xd')](function(_0x2c1fe9){logger[_0xc8a5('0xe')](_0xc8a5('0xf'),_0xd6de78,_0xc8a5('0x10'));logger[_0xc8a5('0x11')](_0xc8a5('0x12'),_0xd6de78,'request\x20sent',JSON['stringify'](_0x2c1fe9));if(_0x2c1fe9[_0xc8a5('0x13')]){if(_0x2c1fe9['error'][_0xc8a5('0x14')]===0x1f4){logger[_0xc8a5('0x13')](_0xc8a5('0xf'),_0xd6de78,_0x2c1fe9[_0xc8a5('0x13')][_0xc8a5('0x15')]);return _0x3ecf08(_0x2c1fe9['error'][_0xc8a5('0x15')]);}logger[_0xc8a5('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0xd6de78,_0x2c1fe9[_0xc8a5('0x13')][_0xc8a5('0x15')]);return _0x4d25e4(_0x2c1fe9[_0xc8a5('0x13')][_0xc8a5('0x15')]);}else{logger[_0xc8a5('0xe')](_0xc8a5('0xf'),_0xd6de78,'request\x20sent');_0x4d25e4(_0x2c1fe9[_0xc8a5('0x16')][_0xc8a5('0x15')]);}})['catch'](function(_0x36a78b){logger[_0xc8a5('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0xd6de78,_0x36a78b);_0x3ecf08(_0x36a78b);});});}exports[_0xc8a5('0x17')]=function(_0x3ef8d3){var _0x12a441=this;return new Promise(function(_0x1326e2,_0x1ea105){return db['SquareDetailsReport'][_0xc8a5('0x18')](_0x3ef8d3['body'],{'raw':_0x3ef8d3[_0xc8a5('0x19')]?_0x3ef8d3[_0xc8a5('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x866737){logger[_0xc8a5('0xe')](_0xc8a5('0x17'),_0x3ef8d3);logger[_0xc8a5('0x11')](_0xc8a5('0x17'),_0x3ef8d3,JSON['stringify'](_0x866737));_0x1326e2(_0x866737);})['catch'](function(_0x3e2058){logger[_0xc8a5('0x13')](_0xc8a5('0x17'),_0x3e2058[_0xc8a5('0x15')],_0x3ef8d3);_0x1ea105(_0x12a441[_0xc8a5('0x13')](0x1f4,_0x3e2058[_0xc8a5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 13030c6..b009974 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 _0x95b4=['exports','express','Router','../../components/auth/service','./system.controller','isAuthenticated','index','get','/process/:pid/kill','killProcess'];(function(_0x42ab64,_0x16648b){var _0x59e1ba=function(_0x5bdce9){while(--_0x5bdce9){_0x42ab64['push'](_0x42ab64['shift']());}};_0x59e1ba(++_0x16648b);}(_0x95b4,0x6f));var _0x495b=function(_0x4044af,_0x598cd4){_0x4044af=_0x4044af-0x0;var _0x18e39f=_0x95b4[_0x4044af];return _0x18e39f;};'use strict';var express=require(_0x495b('0x0'));var router=express[_0x495b('0x1')]();var auth=require(_0x495b('0x2'));var controller=require(_0x495b('0x3'));router['get']('/',auth[_0x495b('0x4')](),controller[_0x495b('0x5')]);router[_0x495b('0x6')](_0x495b('0x7'),auth[_0x495b('0x4')](),controller[_0x495b('0x8')]);module[_0x495b('0x9')]=router; \ No newline at end of file +var _0x1336=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','killProcess','exports','express'];(function(_0x4e48d0,_0xcee4c2){var _0xe52a88=function(_0x4b9380){while(--_0x4b9380){_0x4e48d0['push'](_0x4e48d0['shift']());}};_0xe52a88(++_0xcee4c2);}(_0x1336,0x16f));var _0x6133=function(_0x5a2391,_0x21cda3){_0x5a2391=_0x5a2391-0x0;var _0x50989c=_0x1336[_0x5a2391];return _0x50989c;};'use strict';var express=require(_0x6133('0x0'));var router=express[_0x6133('0x1')]();var auth=require(_0x6133('0x2'));var controller=require(_0x6133('0x3'));router[_0x6133('0x4')]('/',auth[_0x6133('0x5')](),controller['index']);router[_0x6133('0x4')]('/process/:pid/kill',auth[_0x6133('0x5')](),controller[_0x6133('0x6')]);module[_0x6133('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 44679e4..b4e394b 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 _0x928b=['params','pid','split','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','exec','api','util','lodash','error','inspect','name','status','index','getAllData','json','catch','components/import/cm','format'];(function(_0x685e8c,_0x37c228){var _0x3f1db9=function(_0x2501de){while(--_0x2501de){_0x685e8c['push'](_0x685e8c['shift']());}};_0x3f1db9(++_0x37c228);}(_0x928b,0x1b8));var _0xb928=function(_0x2910d2,_0x1faad9){_0x2910d2=_0x2910d2-0x0;var _0x6174c1=_0x928b[_0x2910d2];return _0x6174c1;};'use strict';var info=require(_0xb928('0x0'));var exec=require(_0xb928('0x1'))[_0xb928('0x2')];var logger=require('../../config/logger')(_0xb928('0x3'));var util=require(_0xb928('0x4'));var BPromise=require('bluebird');var _=require(_0xb928('0x5'));function handleError(_0x20f9a1,_0x15781e,_0x4a6874){_0x15781e=_0x15781e||0x1f4;return function(_0xa47da7){logger[_0xb928('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4a6874,_0x15781e,util[_0xb928('0x7')](_0xa47da7,{'showHidden':![],'depth':null}));delete _0xa47da7[_0xb928('0x8')];_0x20f9a1[_0xb928('0x9')](_0x15781e)['send'](_0xa47da7);};}exports[_0xb928('0xa')]=function(_0x3628ba,_0x59eb13){return info[_0xb928('0xb')]()['then'](function(_0x40f968){return _0x59eb13[_0xb928('0x9')](0xc8)[_0xb928('0xc')](_0x40f968);})[_0xb928('0xd')](function(_0x4cdaf6){return _0x59eb13['status'](0x1f4)['json'](_0x4cdaf6);});};exports['killProcess']=function(_0x1d76c7,_0x360cb8){var _0x14e30c=[_0xb928('0xe')];return new BPromise(function(_0x15a8c6,_0x1c76ba){return exec(util[_0xb928('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1d76c7[_0xb928('0x10')][_0xb928('0x11')]),function(_0x31429e,_0x53d356,_0x37cdac){if(_0x31429e){return _0x1c76ba(_0x31429e);}return _0x15a8c6(_0x53d356);});})['then'](function(_0x2a9d18){var _0x18c3e5=![];var _0x4d25cb=_0x2a9d18[_0xb928('0x12')](/\n/);for(var _0x252eb0=0x0,_0x572a72=_0x14e30c['length'];_0x252eb0<_0x572a72,_0x18c3e5===![];_0x252eb0+=0x1){if(_0x2a9d18['indexOf'](_0x14e30c[_0x252eb0])>=0x0){_0x18c3e5=!![];}}if(!_0x18c3e5){throw new Error(util[_0xb928('0xf')](_0xb928('0x13'),_0x1d76c7['params'][_0xb928('0x11')]));}process[_0xb928('0x14')](_0x1d76c7[_0xb928('0x10')][_0xb928('0x11')],_0xb928('0x15'));return _0x360cb8[_0xb928('0x9')](0xc8)[_0xb928('0xc')]({'message':util[_0xb928('0xf')](_0xb928('0x16'),_0x1d76c7['params'][_0xb928('0x11')])});})[_0xb928('0xd')](handleError(_0x360cb8,null,_0xb928('0x17')));}; \ No newline at end of file +var _0xb236=['then','json','catch','killProcess','format','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb236,0x142));var _0x6b23=function(_0x20bd71,_0x6f6de9){_0x20bd71=_0x20bd71-0x0;var _0x4ae2fe=_0xb236[_0x20bd71];return _0x4ae2fe;};'use strict';var info=require('systeminformation');var exec=require(_0x6b23('0x0'))[_0x6b23('0x1')];var logger=require(_0x6b23('0x2'))(_0x6b23('0x3'));var util=require(_0x6b23('0x4'));var BPromise=require(_0x6b23('0x5'));var _=require(_0x6b23('0x6'));function handleError(_0x20b025,_0x5dfca6,_0x15c886){_0x5dfca6=_0x5dfca6||0x1f4;return function(_0x7d22bc){logger[_0x6b23('0x7')](_0x6b23('0x8'),_0x15c886,_0x5dfca6,util[_0x6b23('0x9')](_0x7d22bc,{'showHidden':![],'depth':null}));delete _0x7d22bc[_0x6b23('0xa')];_0x20b025[_0x6b23('0xb')](_0x5dfca6)[_0x6b23('0xc')](_0x7d22bc);};}exports['index']=function(_0x544c11,_0x5a359a){return info[_0x6b23('0xd')]()[_0x6b23('0xe')](function(_0x55773c){return _0x5a359a['status'](0xc8)[_0x6b23('0xf')](_0x55773c);})[_0x6b23('0x10')](function(_0x35bca6){return _0x5a359a['status'](0x1f4)[_0x6b23('0xf')](_0x35bca6);});};exports[_0x6b23('0x11')]=function(_0x5db77c,_0x5194ff){var _0x45a61e=['components/import/cm'];return new BPromise(function(_0x58d5fe,_0x2409a9){return exec(util[_0x6b23('0x12')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x5db77c[_0x6b23('0x13')][_0x6b23('0x14')]),function(_0x5c798b,_0x567761,_0x257970){if(_0x5c798b){return _0x2409a9(_0x5c798b);}return _0x58d5fe(_0x567761);});})[_0x6b23('0xe')](function(_0x25a100){var _0x45b1f8=![];var _0x58cbbf=_0x25a100[_0x6b23('0x15')](/\n/);for(var _0x1bf374=0x0,_0x5763c8=_0x45a61e[_0x6b23('0x16')];_0x1bf374<_0x5763c8,_0x45b1f8===![];_0x1bf374+=0x1){if(_0x25a100[_0x6b23('0x17')](_0x45a61e[_0x1bf374])>=0x0){_0x45b1f8=!![];}}if(!_0x45b1f8){throw new Error(util['format'](_0x6b23('0x18'),_0x5db77c[_0x6b23('0x13')]['pid']));}process[_0x6b23('0x19')](_0x5db77c[_0x6b23('0x13')]['pid'],_0x6b23('0x1a'));return _0x5194ff[_0x6b23('0xb')](0xc8)[_0x6b23('0xf')]({'message':util[_0x6b23('0x12')](_0x6b23('0x1b'),_0x5db77c['params']['pid'])});})[_0x6b23('0x10')](handleError(_0x5194ff,null,_0x6b23('0x11')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 05ef8fa..2215333 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 _0x5c12=['./tag.controller','isAuthenticated','index','get','describe','/:id','show','create','put','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x39a2d6,_0x477459){var _0x23af66=function(_0x2eb95e){while(--_0x2eb95e){_0x39a2d6['push'](_0x39a2d6['shift']());}};_0x23af66(++_0x477459);}(_0x5c12,0x188));var _0x25c1=function(_0x2718c7,_0x5a1636){_0x2718c7=_0x2718c7-0x0;var _0x59d89c=_0x5c12[_0x2718c7];return _0x59d89c;};'use strict';var multer=require('multer');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x25c1('0x2'));var router=express[_0x25c1('0x3')]();var fs_extra=require(_0x25c1('0x4'));var auth=require(_0x25c1('0x5'));var interaction=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var controller=require(_0x25c1('0x8'));router['get']('/',auth[_0x25c1('0x9')](),controller[_0x25c1('0xa')]);router[_0x25c1('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x25c1('0xc')]);router[_0x25c1('0xb')](_0x25c1('0xd'),auth[_0x25c1('0x9')](),controller[_0x25c1('0xe')]);router['post']('/',auth[_0x25c1('0x9')](),controller[_0x25c1('0xf')]);router[_0x25c1('0x10')](_0x25c1('0xd'),auth[_0x25c1('0x9')](),controller['update']);router[_0x25c1('0x11')](_0x25c1('0xd'),auth['isAuthenticated'](),controller[_0x25c1('0x12')]);module[_0x25c1('0x13')]=router; \ No newline at end of file +var _0x41bb=['show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated','describe','/:id'];(function(_0x48fc3f,_0x2852be){var _0x363818=function(_0x5419e5){while(--_0x5419e5){_0x48fc3f['push'](_0x48fc3f['shift']());}};_0x363818(++_0x2852be);}(_0x41bb,0xc5));var _0xb41b=function(_0x817567,_0xa61db7){_0x817567=_0x817567-0x0;var _0x2c9833=_0x41bb[_0x817567];return _0x2c9833;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var fs_extra=require(_0xb41b('0x4'));var auth=require(_0xb41b('0x5'));var interaction=require(_0xb41b('0x6'));var config=require('../../config/environment');var controller=require(_0xb41b('0x7'));router[_0xb41b('0x8')]('/',auth[_0xb41b('0x9')](),controller['index']);router['get']('/describe',auth[_0xb41b('0x9')](),controller[_0xb41b('0xa')]);router['get'](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xc')]);router[_0xb41b('0xd')]('/',auth[_0xb41b('0x9')](),controller[_0xb41b('0xe')]);router[_0xb41b('0xf')]('/:id',auth[_0xb41b('0x9')](),controller['update']);router[_0xb41b('0x10')](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x11')]);module[_0xb41b('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 519a742..bebd6f3 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 _0xf2a6=['STRING','sequelize'];(function(_0x35d8af,_0x14fd75){var _0x1d08b0=function(_0x36b437){while(--_0x36b437){_0x35d8af['push'](_0x35d8af['shift']());}};_0x1d08b0(++_0x14fd75);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x111cc4,_0x5db22b){_0x111cc4=_0x111cc4-0x0;var _0x3fbde8=_0xf2a6[_0x111cc4];return _0x3fbde8;};'use strict';var Sequelize=require(_0x6f2a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x6f2a('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x6f2a('0x1')]}}; \ No newline at end of file +var _0xc584=['exports','STRING','#0091EA'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc584,0xa8));var _0x4c58=function(_0x5e462b,_0x187b06){_0x5e462b=_0x5e462b-0x0;var _0xb01a65=_0xc584[_0x5e462b];return _0xb01a65;};'use strict';var Sequelize=require('sequelize');module[_0x4c58('0x0')]={'name':{'type':Sequelize[_0x4c58('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x4c58('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index ed842e4..ceb8294 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 _0xb50f=['findAll','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','then','get','Tags','UserProfileResource','error','name','send','index','map','Tag','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xb50f,0x66));var _0xfb50=function(_0x34c3ac,_0x40a7f4){_0x34c3ac=_0x34c3ac-0x0;var _0x6661a1=_0xb50f[_0x34c3ac];return _0x6661a1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfb50('0x0'));var jsonpatch=require(_0xfb50('0x1'));var rp=require(_0xfb50('0x2'));var moment=require(_0xfb50('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xfb50('0x4'));var csv=require(_0xfb50('0x5'));var ejs=require(_0xfb50('0x6'));var fs=require('fs');var fs_extra=require(_0xfb50('0x7'));var _=require(_0xfb50('0x8'));var squel=require(_0xfb50('0x9'));var crypto=require(_0xfb50('0xa'));var jsforce=require(_0xfb50('0xb'));var deskjs=require(_0xfb50('0xc'));var toCsv=require(_0xfb50('0x5'));var querystring=require(_0xfb50('0xd'));var Papa=require(_0xfb50('0xe'));var Redis=require(_0xfb50('0xf'));var authService=require(_0xfb50('0x10'));var qs=require(_0xfb50('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfb50('0x12'));var utils=require(_0xfb50('0x13'));var config=require(_0xfb50('0x14'));var licenseUtil=require(_0xfb50('0x15'));var db=require(_0xfb50('0x16'))['db'];function respondWithStatusCode(_0x209342,_0x5d2a89){_0x5d2a89=_0x5d2a89||0xcc;return function(_0x382fd2){if(_0x382fd2){return _0x209342[_0xfb50('0x17')](_0x5d2a89);}return _0x209342[_0xfb50('0x18')](_0x5d2a89)[_0xfb50('0x19')]();};}function respondWithResult(_0x1438b9,_0x483778){_0x483778=_0x483778||0xc8;return function(_0x196c17){if(_0x196c17){return _0x1438b9[_0xfb50('0x18')](_0x483778)[_0xfb50('0x1a')](_0x196c17);}};}function respondWithFilteredResult(_0x3de2ea,_0x301cfc){return function(_0xeca9f4){if(_0xeca9f4){var _0x5e7c33=typeof _0x301cfc[_0xfb50('0x1b')]===_0xfb50('0x1c')&&typeof _0x301cfc[_0xfb50('0x1d')]===_0xfb50('0x1c');var _0x3c22e0=_0xeca9f4['count'];var _0x3f50e9=_0x5e7c33?0x0:_0x301cfc[_0xfb50('0x1b')];var _0x6b6e30=_0x5e7c33?_0xeca9f4['count']:_0x301cfc[_0xfb50('0x1b')]+_0x301cfc['limit'];var _0x224016;if(_0x6b6e30>=_0x3c22e0){_0x6b6e30=_0x3c22e0;_0x224016=0xc8;}else{_0x224016=0xce;}_0x3de2ea[_0xfb50('0x18')](_0x224016);return _0x3de2ea['set'](_0xfb50('0x1e'),_0x3f50e9+'-'+_0x6b6e30+'/'+_0x3c22e0)[_0xfb50('0x1a')](_0xeca9f4);}return null;};}function patchUpdates(_0x29d9da){return function(_0x11d43d){try{jsonpatch[_0xfb50('0x1f')](_0x11d43d,_0x29d9da,!![]);}catch(_0x458bef){return BPromise[_0xfb50('0x20')](_0x458bef);}return _0x11d43d[_0xfb50('0x21')]();};}function saveUpdates(_0x1e4a71,_0x1b7146){return function(_0x5bacbb){if(_0x5bacbb){return _0x5bacbb[_0xfb50('0x22')](_0x1e4a71)['then'](function(_0x119fc5){return _0x119fc5;});}return null;};}function removeEntity(_0xeafb01,_0x2b271c){return function(_0x52840a){if(_0x52840a){return _0x52840a[_0xfb50('0x23')]()[_0xfb50('0x24')](function(){var _0x2bf5b3=_0x52840a[_0xfb50('0x25')]({'plain':!![]});var _0x2df4e0=_0xfb50('0x26');return db[_0xfb50('0x27')][_0xfb50('0x23')]({'where':{'type':_0x2df4e0,'resourceId':_0x2bf5b3['id']}})['then'](function(){return _0x52840a;});})[_0xfb50('0x24')](function(){_0xeafb01[_0xfb50('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bc2e4,_0xf175a1){return function(_0x334bcc){if(!_0x334bcc){_0x2bc2e4[_0xfb50('0x17')](0x194);}return _0x334bcc;};}function handleError(_0x48cebc,_0x16108c){_0x16108c=_0x16108c||0x1f4;return function(_0x32c98a){logger[_0xfb50('0x28')](_0x32c98a['stack']);if(_0x32c98a[_0xfb50('0x29')]){delete _0x32c98a[_0xfb50('0x29')];}_0x48cebc[_0xfb50('0x18')](_0x16108c)[_0xfb50('0x2a')](_0x32c98a);};}exports[_0xfb50('0x2b')]=function(_0xd81580,_0x4ef124){var _0x442b14={},_0x48b4cd={},_0x296688={'count':0x0,'rows':[]};var _0x59a477=_[_0xfb50('0x2c')](db[_0xfb50('0x2d')][_0xfb50('0x2e')],function(_0x93c004){return{'name':_0x93c004['fieldName'],'type':_0x93c004[_0xfb50('0x2f')][_0xfb50('0x30')]};});_0x48b4cd['model']=_[_0xfb50('0x2c')](_0x59a477,_0xfb50('0x29'));_0x48b4cd[_0xfb50('0x31')]=_[_0xfb50('0x32')](_0xd81580[_0xfb50('0x31')]);_0x48b4cd[_0xfb50('0x33')]=_[_0xfb50('0x34')](_0x48b4cd[_0xfb50('0x35')],_0x48b4cd[_0xfb50('0x31')]);_0x442b14[_0xfb50('0x36')]=_[_0xfb50('0x34')](_0x48b4cd[_0xfb50('0x35')],qs[_0xfb50('0x37')](_0xd81580['query'][_0xfb50('0x37')]));_0x442b14[_0xfb50('0x36')]=_0x442b14['attributes'][_0xfb50('0x38')]?_0x442b14['attributes']:_0x48b4cd[_0xfb50('0x35')];if(!_0xd81580[_0xfb50('0x31')]['hasOwnProperty'](_0xfb50('0x39'))){_0x442b14[_0xfb50('0x1d')]=qs[_0xfb50('0x1d')](_0xd81580['query'][_0xfb50('0x1d')]);_0x442b14['offset']=qs[_0xfb50('0x1b')](_0xd81580[_0xfb50('0x31')][_0xfb50('0x1b')]);}_0x442b14[_0xfb50('0x3a')]=qs[_0xfb50('0x3b')](_0xd81580['query'][_0xfb50('0x3b')]);_0x442b14[_0xfb50('0x3c')]=qs[_0xfb50('0x33')](_[_0xfb50('0x3d')](_0xd81580[_0xfb50('0x31')],_0x48b4cd[_0xfb50('0x33')]),_0x59a477);if(_0xd81580[_0xfb50('0x31')][_0xfb50('0x3e')]){_0x442b14[_0xfb50('0x3c')]=_[_0xfb50('0x3f')](_0x442b14[_0xfb50('0x3c')],{'$or':_[_0xfb50('0x2c')](_0x59a477,function(_0x5e7117){if(_0x5e7117[_0xfb50('0x2f')]!==_0xfb50('0x40')){var _0x1b33b3={};_0x1b33b3[_0x5e7117[_0xfb50('0x29')]]={'$like':'%'+_0xd81580[_0xfb50('0x31')][_0xfb50('0x3e')]+'%'};return _0x1b33b3;}})});}_0x442b14=_[_0xfb50('0x3f')]({},_0x442b14,_0xd81580['options']);var _0x54403e={'where':_0x442b14[_0xfb50('0x3c')]};return db['Tag'][_0xfb50('0x41')](_0x54403e)[_0xfb50('0x24')](function(_0x177d07){_0x296688[_0xfb50('0x41')]=_0x177d07;if(_0xd81580[_0xfb50('0x31')][_0xfb50('0x42')]){_0x442b14[_0xfb50('0x43')]=[{'all':!![]}];}return db[_0xfb50('0x2d')][_0xfb50('0x44')](_0x442b14);})[_0xfb50('0x24')](function(_0x5be342){_0x296688[_0xfb50('0x45')]=_0x5be342;return _0x296688;})[_0xfb50('0x24')](respondWithFilteredResult(_0x4ef124,_0x442b14))[_0xfb50('0x46')](handleError(_0x4ef124,null));};exports[_0xfb50('0x47')]=function(_0x39724b,_0x5da256){var _0x21e370={'raw':!![],'where':{'id':_0x39724b[_0xfb50('0x48')]['id']}},_0x308ba1={};_0x308ba1[_0xfb50('0x35')]=_['keys'](db[_0xfb50('0x2d')][_0xfb50('0x2e')]);_0x308ba1[_0xfb50('0x31')]=_['keys'](_0x39724b[_0xfb50('0x31')]);_0x308ba1[_0xfb50('0x33')]=_[_0xfb50('0x34')](_0x308ba1[_0xfb50('0x35')],_0x308ba1[_0xfb50('0x31')]);_0x21e370[_0xfb50('0x36')]=_[_0xfb50('0x34')](_0x308ba1[_0xfb50('0x35')],qs[_0xfb50('0x37')](_0x39724b[_0xfb50('0x31')]['fields']));_0x21e370['attributes']=_0x21e370[_0xfb50('0x36')][_0xfb50('0x38')]?_0x21e370['attributes']:_0x308ba1[_0xfb50('0x35')];if(_0x39724b[_0xfb50('0x31')][_0xfb50('0x42')]){_0x21e370[_0xfb50('0x43')]=[{'all':!![]}];}_0x21e370=_['merge']({},_0x21e370,_0x39724b[_0xfb50('0x49')]);return db[_0xfb50('0x2d')][_0xfb50('0x4a')](_0x21e370)['then'](handleEntityNotFound(_0x5da256,null))[_0xfb50('0x24')](respondWithResult(_0x5da256,null))[_0xfb50('0x46')](handleError(_0x5da256,null));};exports[_0xfb50('0x4b')]=function(_0x6dce4c,_0x38574d){return db['Tag']['create'](_0x6dce4c['body'],{})[_0xfb50('0x24')](function(_0xfa4771){var _0x51c392=_0x6dce4c[_0xfb50('0x4c')][_0xfb50('0x25')]({'plain':!![]});if(!_0x51c392)throw new Error(_0xfb50('0x4d'));if(_0x51c392[_0xfb50('0x4e')]===_0xfb50('0x4c')){var _0x2a27df=_0xfa4771[_0xfb50('0x25')]({'plain':!![]});var _0x2fb457='Tags';return db[_0xfb50('0x4f')][_0xfb50('0x4a')]({'where':{'name':_0x2fb457,'userProfileId':_0x51c392[_0xfb50('0x50')]},'raw':!![]})[_0xfb50('0x24')](function(_0x470e98){if(_0x470e98&&_0x470e98[_0xfb50('0x51')]===0x0){return db[_0xfb50('0x27')][_0xfb50('0x4b')]({'name':_0x2a27df[_0xfb50('0x29')],'resourceId':_0x2a27df['id'],'type':_0x470e98[_0xfb50('0x29')],'sectionId':_0x470e98['id']},{})[_0xfb50('0x24')](function(){return _0xfa4771;});}else{return _0xfa4771;}})[_0xfb50('0x46')](function(_0x251a17){logger[_0xfb50('0x28')](_0xfb50('0x52'),_0x251a17);throw _0x251a17;});}return _0xfa4771;})[_0xfb50('0x24')](respondWithResult(_0x38574d,0xc9))[_0xfb50('0x46')](handleError(_0x38574d,null));};exports['update']=function(_0x15f450,_0x45cc08){if(_0x15f450[_0xfb50('0x53')]['id']){delete _0x15f450[_0xfb50('0x53')]['id'];}return db[_0xfb50('0x2d')][_0xfb50('0x4a')]({'where':{'id':_0x15f450[_0xfb50('0x48')]['id']}})['then'](handleEntityNotFound(_0x45cc08,null))[_0xfb50('0x24')](saveUpdates(_0x15f450[_0xfb50('0x53')],null))[_0xfb50('0x24')](respondWithResult(_0x45cc08,null))['catch'](handleError(_0x45cc08,null));};exports['destroy']=function(_0x1885eb,_0x59b0de){return db['Tag'][_0xfb50('0x4a')]({'where':{'id':_0x1885eb[_0xfb50('0x48')]['id']}})[_0xfb50('0x24')](handleEntityNotFound(_0x59b0de,null))[_0xfb50('0x24')](removeEntity(_0x59b0de,null))[_0xfb50('0x46')](handleError(_0x59b0de,null));};exports[_0xfb50('0x54')]=function(_0x41e5a7,_0x45cf14){return db[_0xfb50('0x2d')][_0xfb50('0x54')]()[_0xfb50('0x24')](respondWithResult(_0x45cf14,null))['catch'](handleError(_0x45cf14,null));}; \ No newline at end of file +var _0x0541=['send','index','map','Tag','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','offset','order','where','pick','filter','VIRTUAL','merge','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name'];(function(_0x28ee48,_0x428701){var _0x33741f=function(_0x15ce6c){while(--_0x15ce6c){_0x28ee48['push'](_0x28ee48['shift']());}};_0x33741f(++_0x428701);}(_0x0541,0x1c5));var _0x1054=function(_0x35ec01,_0x5c44ac){_0x35ec01=_0x35ec01-0x0;var _0x4f75d5=_0x0541[_0x35ec01];return _0x4f75d5;};'use strict';var emlformat=require(_0x1054('0x0'));var rimraf=require(_0x1054('0x1'));var zipdir=require(_0x1054('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1054('0x3'));var moment=require(_0x1054('0x4'));var BPromise=require(_0x1054('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1054('0x6'));var sox=require(_0x1054('0x7'));var csv=require(_0x1054('0x8'));var ejs=require(_0x1054('0x9'));var fs=require('fs');var fs_extra=require(_0x1054('0xa'));var _=require(_0x1054('0xb'));var squel=require(_0x1054('0xc'));var crypto=require(_0x1054('0xd'));var jsforce=require(_0x1054('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1054('0x8'));var querystring=require(_0x1054('0xf'));var Papa=require(_0x1054('0x10'));var Redis=require(_0x1054('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1054('0x12'));var as=require(_0x1054('0x13'));var hardwareService=require(_0x1054('0x14'));var logger=require('../../config/logger')(_0x1054('0x15'));var utils=require(_0x1054('0x16'));var config=require(_0x1054('0x17'));var licenseUtil=require(_0x1054('0x18'));var db=require(_0x1054('0x19'))['db'];function respondWithStatusCode(_0x338e91,_0x280922){_0x280922=_0x280922||0xcc;return function(_0x2d9592){if(_0x2d9592){return _0x338e91['sendStatus'](_0x280922);}return _0x338e91[_0x1054('0x1a')](_0x280922)['end']();};}function respondWithResult(_0x408ee8,_0x1fef37){_0x1fef37=_0x1fef37||0xc8;return function(_0x31890a){if(_0x31890a){return _0x408ee8[_0x1054('0x1a')](_0x1fef37)['json'](_0x31890a);}};}function respondWithFilteredResult(_0x3c809a,_0x309502){return function(_0x1febae){if(_0x1febae){var _0x307b80=typeof _0x309502['offset']==='undefined'&&typeof _0x309502[_0x1054('0x1b')]===_0x1054('0x1c');var _0x32c1c3=_0x1febae[_0x1054('0x1d')];var _0x337800=_0x307b80?0x0:_0x309502['offset'];var _0x3f1ebe=_0x307b80?_0x1febae[_0x1054('0x1d')]:_0x309502['offset']+_0x309502[_0x1054('0x1b')];var _0x40a1b7;if(_0x3f1ebe>=_0x32c1c3){_0x3f1ebe=_0x32c1c3;_0x40a1b7=0xc8;}else{_0x40a1b7=0xce;}_0x3c809a[_0x1054('0x1a')](_0x40a1b7);return _0x3c809a[_0x1054('0x1e')](_0x1054('0x1f'),_0x337800+'-'+_0x3f1ebe+'/'+_0x32c1c3)[_0x1054('0x20')](_0x1febae);}return null;};}function patchUpdates(_0x2720bb){return function(_0x48bd8f){try{jsonpatch[_0x1054('0x21')](_0x48bd8f,_0x2720bb,!![]);}catch(_0x1eef9e){return BPromise[_0x1054('0x22')](_0x1eef9e);}return _0x48bd8f[_0x1054('0x23')]();};}function saveUpdates(_0x1e3544,_0x206073){return function(_0x524125){if(_0x524125){return _0x524125[_0x1054('0x24')](_0x1e3544)[_0x1054('0x25')](function(_0x230a02){return _0x230a02;});}return null;};}function removeEntity(_0x34863,_0x215d7c){return function(_0x34d33d){if(_0x34d33d){return _0x34d33d[_0x1054('0x26')]()[_0x1054('0x25')](function(){var _0x623328=_0x34d33d[_0x1054('0x27')]({'plain':!![]});var _0x1dd499=_0x1054('0x28');return db[_0x1054('0x29')][_0x1054('0x26')]({'where':{'type':_0x1dd499,'resourceId':_0x623328['id']}})[_0x1054('0x25')](function(){return _0x34d33d;});})[_0x1054('0x25')](function(){_0x34863['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf469d4,_0x19f0f9){return function(_0x1ef3e9){if(!_0x1ef3e9){_0xf469d4['sendStatus'](0x194);}return _0x1ef3e9;};}function handleError(_0x180273,_0x234426){_0x234426=_0x234426||0x1f4;return function(_0x17eb36){logger[_0x1054('0x2a')](_0x17eb36[_0x1054('0x2b')]);if(_0x17eb36[_0x1054('0x2c')]){delete _0x17eb36['name'];}_0x180273[_0x1054('0x1a')](_0x234426)[_0x1054('0x2d')](_0x17eb36);};}exports[_0x1054('0x2e')]=function(_0x58b76d,_0x463d16){var _0x3d3e22={},_0x49b358={},_0x5941ea={'count':0x0,'rows':[]};var _0x28348c=_[_0x1054('0x2f')](db[_0x1054('0x30')]['rawAttributes'],function(_0x4771b1){return{'name':_0x4771b1['fieldName'],'type':_0x4771b1[_0x1054('0x31')]['key']};});_0x49b358[_0x1054('0x32')]=_[_0x1054('0x2f')](_0x28348c,'name');_0x49b358[_0x1054('0x33')]=_['keys'](_0x58b76d['query']);_0x49b358[_0x1054('0x34')]=_['intersection'](_0x49b358[_0x1054('0x32')],_0x49b358[_0x1054('0x33')]);_0x3d3e22[_0x1054('0x35')]=_[_0x1054('0x36')](_0x49b358[_0x1054('0x32')],qs[_0x1054('0x37')](_0x58b76d[_0x1054('0x33')]['fields']));_0x3d3e22[_0x1054('0x35')]=_0x3d3e22[_0x1054('0x35')]['length']?_0x3d3e22[_0x1054('0x35')]:_0x49b358['model'];if(!_0x58b76d[_0x1054('0x33')][_0x1054('0x38')]('nolimit')){_0x3d3e22['limit']=qs[_0x1054('0x1b')](_0x58b76d[_0x1054('0x33')][_0x1054('0x1b')]);_0x3d3e22[_0x1054('0x39')]=qs[_0x1054('0x39')](_0x58b76d[_0x1054('0x33')]['offset']);}_0x3d3e22[_0x1054('0x3a')]=qs['sort'](_0x58b76d[_0x1054('0x33')]['sort']);_0x3d3e22[_0x1054('0x3b')]=qs[_0x1054('0x34')](_[_0x1054('0x3c')](_0x58b76d['query'],_0x49b358['filters']),_0x28348c);if(_0x58b76d['query'][_0x1054('0x3d')]){_0x3d3e22[_0x1054('0x3b')]=_['merge'](_0x3d3e22[_0x1054('0x3b')],{'$or':_[_0x1054('0x2f')](_0x28348c,function(_0x3cd9f){if(_0x3cd9f[_0x1054('0x31')]!==_0x1054('0x3e')){var _0x3fd3cc={};_0x3fd3cc[_0x3cd9f['name']]={'$like':'%'+_0x58b76d[_0x1054('0x33')][_0x1054('0x3d')]+'%'};return _0x3fd3cc;}})});}_0x3d3e22=_[_0x1054('0x3f')]({},_0x3d3e22,_0x58b76d['options']);var _0x497cf6={'where':_0x3d3e22[_0x1054('0x3b')]};return db['Tag'][_0x1054('0x1d')](_0x497cf6)[_0x1054('0x25')](function(_0x58b517){_0x5941ea[_0x1054('0x1d')]=_0x58b517;if(_0x58b76d[_0x1054('0x33')]['includeAll']){_0x3d3e22['include']=[{'all':!![]}];}return db[_0x1054('0x30')][_0x1054('0x40')](_0x3d3e22);})[_0x1054('0x25')](function(_0x487820){_0x5941ea[_0x1054('0x41')]=_0x487820;return _0x5941ea;})['then'](respondWithFilteredResult(_0x463d16,_0x3d3e22))[_0x1054('0x42')](handleError(_0x463d16,null));};exports[_0x1054('0x43')]=function(_0x450358,_0x322310){var _0x20eaab={'raw':!![],'where':{'id':_0x450358[_0x1054('0x44')]['id']}},_0x378abe={};_0x378abe['model']=_[_0x1054('0x45')](db[_0x1054('0x30')][_0x1054('0x46')]);_0x378abe[_0x1054('0x33')]=_[_0x1054('0x45')](_0x450358[_0x1054('0x33')]);_0x378abe[_0x1054('0x34')]=_[_0x1054('0x36')](_0x378abe[_0x1054('0x32')],_0x378abe[_0x1054('0x33')]);_0x20eaab[_0x1054('0x35')]=_[_0x1054('0x36')](_0x378abe[_0x1054('0x32')],qs[_0x1054('0x37')](_0x450358[_0x1054('0x33')][_0x1054('0x37')]));_0x20eaab[_0x1054('0x35')]=_0x20eaab['attributes']['length']?_0x20eaab[_0x1054('0x35')]:_0x378abe[_0x1054('0x32')];if(_0x450358['query'][_0x1054('0x47')]){_0x20eaab['include']=[{'all':!![]}];}_0x20eaab=_[_0x1054('0x3f')]({},_0x20eaab,_0x450358[_0x1054('0x48')]);return db[_0x1054('0x30')][_0x1054('0x49')](_0x20eaab)[_0x1054('0x25')](handleEntityNotFound(_0x322310,null))['then'](respondWithResult(_0x322310,null))[_0x1054('0x42')](handleError(_0x322310,null));};exports[_0x1054('0x4a')]=function(_0x149312,_0x11e015){return db[_0x1054('0x30')][_0x1054('0x4a')](_0x149312[_0x1054('0x4b')],{})[_0x1054('0x25')](function(_0x1575db){var _0x1bb950=_0x149312[_0x1054('0x4c')]['get']({'plain':!![]});if(!_0x1bb950)throw new Error(_0x1054('0x4d'));if(_0x1bb950[_0x1054('0x4e')]===_0x1054('0x4c')){var _0x479f60=_0x1575db[_0x1054('0x27')]({'plain':!![]});var _0x4b20f7=_0x1054('0x28');return db['UserProfileSection'][_0x1054('0x49')]({'where':{'name':_0x4b20f7,'userProfileId':_0x1bb950[_0x1054('0x4f')]},'raw':!![]})[_0x1054('0x25')](function(_0x231fd9){if(_0x231fd9&&_0x231fd9[_0x1054('0x50')]===0x0){return db[_0x1054('0x29')][_0x1054('0x4a')]({'name':_0x479f60[_0x1054('0x2c')],'resourceId':_0x479f60['id'],'type':_0x231fd9[_0x1054('0x2c')],'sectionId':_0x231fd9['id']},{})[_0x1054('0x25')](function(){return _0x1575db;});}else{return _0x1575db;}})['catch'](function(_0x58fa0b){logger[_0x1054('0x2a')](_0x1054('0x51'),_0x58fa0b);throw _0x58fa0b;});}return _0x1575db;})[_0x1054('0x25')](respondWithResult(_0x11e015,0xc9))['catch'](handleError(_0x11e015,null));};exports[_0x1054('0x24')]=function(_0x7a7349,_0x4cf9fe){if(_0x7a7349[_0x1054('0x4b')]['id']){delete _0x7a7349[_0x1054('0x4b')]['id'];}return db['Tag'][_0x1054('0x49')]({'where':{'id':_0x7a7349[_0x1054('0x44')]['id']}})['then'](handleEntityNotFound(_0x4cf9fe,null))[_0x1054('0x25')](saveUpdates(_0x7a7349['body'],null))[_0x1054('0x25')](respondWithResult(_0x4cf9fe,null))[_0x1054('0x42')](handleError(_0x4cf9fe,null));};exports[_0x1054('0x26')]=function(_0x16dafe,_0x46d954){return db[_0x1054('0x30')]['find']({'where':{'id':_0x16dafe[_0x1054('0x44')]['id']}})[_0x1054('0x25')](handleEntityNotFound(_0x46d954,null))[_0x1054('0x25')](removeEntity(_0x46d954,null))['catch'](handleError(_0x46d954,null));};exports[_0x1054('0x52')]=function(_0x4476bd,_0xd3c6ad){return db['Tag'][_0x1054('0x52')]()[_0x1054('0x25')](respondWithResult(_0xd3c6ad,null))[_0x1054('0x42')](handleError(_0xd3c6ad,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 265534f..f70fc43 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 _0x0a2f=['define','Tag','tools_tags','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x280ad2,_0x4e8a06){var _0x36c085=function(_0x4767e3){while(--_0x4767e3){_0x280ad2['push'](_0x280ad2['shift']());}};_0x36c085(++_0x4e8a06);}(_0x0a2f,0x1d1));var _0xf0a2=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x0a2f[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0xf0a2('0x0'));var util=require(_0xf0a2('0x1'));var logger=require(_0xf0a2('0x2'))(_0xf0a2('0x3'));var moment=require('moment');var BPromise=require(_0xf0a2('0x4'));var rp=require(_0xf0a2('0x5'));var fs=require('fs');var path=require(_0xf0a2('0x6'));var rimraf=require(_0xf0a2('0x7'));var config=require(_0xf0a2('0x8'));var attributes=require(_0xf0a2('0x9'));module[_0xf0a2('0xa')]=function(_0x1c9932,_0x58e280){return _0x1c9932[_0xf0a2('0xb')](_0xf0a2('0xc'),attributes,{'tableName':_0xf0a2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51e5=['bluebird','rimraf','./tag.attributes','exports','tools_tags','lodash','util','../../config/logger','api'];(function(_0x5110f4,_0x384b97){var _0xed6b9e=function(_0x55fca9){while(--_0x55fca9){_0x5110f4['push'](_0x5110f4['shift']());}};_0xed6b9e(++_0x384b97);}(_0x51e5,0x12e));var _0x551e=function(_0x2c7461,_0x1e9d3a){_0x2c7461=_0x2c7461-0x0;var _0x2941ec=_0x51e5[_0x2c7461];return _0x2941ec;};'use strict';var _=require(_0x551e('0x0'));var util=require(_0x551e('0x1'));var logger=require(_0x551e('0x2'))(_0x551e('0x3'));var moment=require('moment');var BPromise=require(_0x551e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x551e('0x5'));var config=require('../../config/environment');var attributes=require(_0x551e('0x6'));module[_0x551e('0x7')]=function(_0xa031bd,_0xc8211e){return _0xa031bd['define']('Tag',attributes,{'tableName':_0x551e('0x8'),'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 06fc41b..b560ec3 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 _0xaf80=['result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x3f5b57,_0x27fbab){var _0x36636f=function(_0x4e9112){while(--_0x4e9112){_0x3f5b57['push'](_0x3f5b57['shift']());}};_0x36636f(++_0x27fbab);}(_0xaf80,0x1ef));var _0x0af8=function(_0x53460b,_0x4ee19f){_0x53460b=_0x53460b-0x0;var _0x242cb2=_0xaf80[_0x53460b];return _0x242cb2;};'use strict';var _=require(_0x0af8('0x0'));var util=require(_0x0af8('0x1'));var moment=require(_0x0af8('0x2'));var BPromise=require(_0x0af8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0af8('0x4'));var logger=require(_0x0af8('0x5'))(_0x0af8('0x6'));var config=require(_0x0af8('0x7'));var jayson=require(_0x0af8('0x8'));var client=jayson[_0x0af8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bce2c,_0x28f555,_0x538c1c){return new BPromise(function(_0x207a9b,_0x430bd4){return client[_0x0af8('0xa')](_0x4bce2c,_0x538c1c)['then'](function(_0xc0d5eb){logger[_0x0af8('0xb')](_0x0af8('0xc'),_0x28f555,'request\x20sent');logger['debug'](_0x0af8('0xd'),_0x28f555,_0x0af8('0xe'),JSON[_0x0af8('0xf')](_0xc0d5eb));if(_0xc0d5eb[_0x0af8('0x10')]){if(_0xc0d5eb[_0x0af8('0x10')]['code']===0x1f4){logger[_0x0af8('0x10')](_0x0af8('0xc'),_0x28f555,_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);return _0x430bd4(_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);}logger[_0x0af8('0x10')]('Tag,\x20%s,\x20%s',_0x28f555,_0xc0d5eb['error'][_0x0af8('0x11')]);return _0x207a9b(_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);}else{logger[_0x0af8('0xb')](_0x0af8('0xc'),_0x28f555,_0x0af8('0xe'));_0x207a9b(_0xc0d5eb[_0x0af8('0x12')][_0x0af8('0x11')]);}})['catch'](function(_0x5f4275){logger['error'](_0x0af8('0xc'),_0x28f555,_0x5f4275);_0x430bd4(_0x5f4275);});});} \ No newline at end of file +var _0x1af3=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3cb934,_0x319b50){var _0x269e98=function(_0x5b5a27){while(--_0x5b5a27){_0x3cb934['push'](_0x3cb934['shift']());}};_0x269e98(++_0x319b50);}(_0x1af3,0x1ca));var _0x31af=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0x1af3[_0x3c81b5];return _0x5888c4;};'use strict';var _=require(_0x31af('0x0'));var util=require(_0x31af('0x1'));var moment=require(_0x31af('0x2'));var BPromise=require(_0x31af('0x3'));var rs=require(_0x31af('0x4'));var fs=require('fs');var Redis=require(_0x31af('0x5'));var db=require(_0x31af('0x6'))['db'];var utils=require(_0x31af('0x7'));var logger=require(_0x31af('0x8'))(_0x31af('0x9'));var config=require('../../config/environment');var jayson=require(_0x31af('0xa'));var client=jayson[_0x31af('0xb')][_0x31af('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21ddc5,_0x485717,_0x6be8e9){return new BPromise(function(_0x1833de,_0x406dd8){return client['request'](_0x21ddc5,_0x6be8e9)[_0x31af('0xd')](function(_0x2f1973){logger[_0x31af('0xe')](_0x31af('0xf'),_0x485717,_0x31af('0x10'));logger[_0x31af('0x11')](_0x31af('0x12'),_0x485717,_0x31af('0x10'),JSON['stringify'](_0x2f1973));if(_0x2f1973[_0x31af('0x13')]){if(_0x2f1973[_0x31af('0x13')][_0x31af('0x14')]===0x1f4){logger[_0x31af('0x13')](_0x31af('0xf'),_0x485717,_0x2f1973['error'][_0x31af('0x15')]);return _0x406dd8(_0x2f1973[_0x31af('0x13')]['message']);}logger['error'](_0x31af('0xf'),_0x485717,_0x2f1973[_0x31af('0x13')][_0x31af('0x15')]);return _0x1833de(_0x2f1973[_0x31af('0x13')][_0x31af('0x15')]);}else{logger[_0x31af('0xe')](_0x31af('0xf'),_0x485717,_0x31af('0x10'));_0x1833de(_0x2f1973[_0x31af('0x16')][_0x31af('0x15')]);}})[_0x31af('0x17')](function(_0x51bae2){logger[_0x31af('0x13')](_0x31af('0xf'),_0x485717,_0x51bae2);_0x406dd8(_0x51bae2);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 66c1c22..e4e13df 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 7a9441d..d50a022 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x1b33fe,_0x2149c7){var _0x5aa05c=function(_0x42bdd9){while(--_0x42bdd9){_0x1b33fe['push'](_0x1b33fe['shift']());}};_0x5aa05c(++_0x2149c7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe706,0xa3));var _0x6e70=function(_0x185063,_0x3f0bb7){_0x185063=_0x185063-0x0;var _0x16d9d3=_0xe706[_0x185063];return _0x16d9d3;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 1614d51..89f9c14 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 _0x6380=['Queue','Queues','ValidationError','add','removeQueues','remove','addAgents','isArray','ids','Voice','Chat','Mail','Sms','Openchannel','Whatsapp','through','penalty','QueueId','defaults','TeamVoiceQueue','User','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Fax','Queue:remove','getAgents','hasOwnProperty','zip-dir','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','save','error','stack','name','send','index','Team','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','then','rows','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','body','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','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase'];(function(_0x44260e,_0x562865){var _0x244282=function(_0x4d5be6){while(--_0x4d5be6){_0x44260e['push'](_0x44260e['shift']());}};_0x244282(++_0x562865);}(_0x6380,0x1e4));var _0x0638=function(_0x2e9916,_0x1233c3){_0x2e9916=_0x2e9916-0x0;var _0x39af2b=_0x6380[_0x2e9916];return _0x39af2b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0638('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0638('0x1'));var Mustache=require(_0x0638('0x2'));var util=require(_0x0638('0x3'));var path=require('path');var sox=require(_0x0638('0x4'));var csv=require(_0x0638('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0638('0x6'));var squel=require(_0x0638('0x7'));var crypto=require(_0x0638('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x0638('0x9'));var toCsv=require(_0x0638('0x5'));var querystring=require(_0x0638('0xa'));var Papa=require(_0x0638('0xb'));var Redis=require(_0x0638('0xc'));var authService=require(_0x0638('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0638('0xe'));var logger=require('../../config/logger')(_0x0638('0xf'));var utils=require(_0x0638('0x10'));var config=require(_0x0638('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x0638('0x12'))['db'];config[_0x0638('0x13')]=_['defaults'](config[_0x0638('0x13')],{'host':_0x0638('0x14'),'port':0x18eb});var socket=require(_0x0638('0x15'))(new Redis(config[_0x0638('0x13')]));require(_0x0638('0x16'))[_0x0638('0x17')](socket);function respondWithStatusCode(_0x514a9f,_0x9277bf){_0x9277bf=_0x9277bf||0xcc;return function(_0x5a5aae){if(_0x5a5aae){return _0x514a9f[_0x0638('0x18')](_0x9277bf);}return _0x514a9f[_0x0638('0x19')](_0x9277bf)[_0x0638('0x1a')]();};}function respondWithResult(_0x5dd86a,_0x59e031){_0x59e031=_0x59e031||0xc8;return function(_0x2d0b6d){if(_0x2d0b6d){return _0x5dd86a['status'](_0x59e031)[_0x0638('0x1b')](_0x2d0b6d);}};}function respondWithFilteredResult(_0x3fbb5c,_0xe78f58){return function(_0x2c4523){if(_0x2c4523){var _0x35a698=typeof _0xe78f58[_0x0638('0x1c')]===_0x0638('0x1d')&&typeof _0xe78f58[_0x0638('0x1e')]==='undefined';var _0x3319d9=_0x2c4523['count'];var _0x1a62a2=_0x35a698?0x0:_0xe78f58['offset'];var _0x321ece=_0x35a698?_0x2c4523[_0x0638('0x1f')]:_0xe78f58[_0x0638('0x1c')]+_0xe78f58[_0x0638('0x1e')];var _0xa5d939;if(_0x321ece>=_0x3319d9){_0x321ece=_0x3319d9;_0xa5d939=0xc8;}else{_0xa5d939=0xce;}_0x3fbb5c['status'](_0xa5d939);return _0x3fbb5c['set']('Content-Range',_0x1a62a2+'-'+_0x321ece+'/'+_0x3319d9)[_0x0638('0x1b')](_0x2c4523);}return null;};}function patchUpdates(_0x46447e){return function(_0x2e41c4){try{jsonpatch['apply'](_0x2e41c4,_0x46447e,!![]);}catch(_0x306c8a){return BPromise['reject'](_0x306c8a);}return _0x2e41c4[_0x0638('0x20')]();};}function saveUpdates(_0x3ad81f,_0x47da71){return function(_0x5b5a1c){if(_0x5b5a1c){return _0x5b5a1c['update'](_0x3ad81f)['then'](function(_0x2b36bc){return _0x2b36bc;});}return null;};}function handleEntityNotFound(_0x4538c8,_0x507250){return function(_0x5603a1){if(!_0x5603a1){_0x4538c8[_0x0638('0x18')](0x194);}return _0x5603a1;};}function handleError(_0x4fbeeb,_0x2688d5){_0x2688d5=_0x2688d5||0x1f4;return function(_0x1618f5){logger[_0x0638('0x21')](_0x1618f5[_0x0638('0x22')]);if(_0x1618f5[_0x0638('0x23')]){delete _0x1618f5['name'];}_0x4fbeeb[_0x0638('0x19')](_0x2688d5)[_0x0638('0x24')](_0x1618f5);};}exports[_0x0638('0x25')]=function(_0x124a7d,_0x595f4a){var _0x162603={},_0x3d7a1b={},_0x4564f4={'count':0x0,'rows':[]};var _0x18b501=_['map'](db[_0x0638('0x26')][_0x0638('0x27')],function(_0x5d452f){return{'name':_0x5d452f[_0x0638('0x28')],'type':_0x5d452f[_0x0638('0x29')][_0x0638('0x2a')]};});_0x3d7a1b['model']=_[_0x0638('0x2b')](_0x18b501,'name');_0x3d7a1b[_0x0638('0x2c')]=_[_0x0638('0x2d')](_0x124a7d[_0x0638('0x2c')]);_0x3d7a1b['filters']=_[_0x0638('0x2e')](_0x3d7a1b[_0x0638('0x2f')],_0x3d7a1b[_0x0638('0x2c')]);_0x162603[_0x0638('0x30')]=_['intersection'](_0x3d7a1b[_0x0638('0x2f')],qs['fields'](_0x124a7d[_0x0638('0x2c')][_0x0638('0x31')]));_0x162603[_0x0638('0x30')]=_0x162603[_0x0638('0x30')][_0x0638('0x32')]?_0x162603[_0x0638('0x30')]:_0x3d7a1b['model'];if(!_0x124a7d['query']['hasOwnProperty']('nolimit')){_0x162603[_0x0638('0x1e')]=qs[_0x0638('0x1e')](_0x124a7d[_0x0638('0x2c')][_0x0638('0x1e')]);_0x162603['offset']=qs[_0x0638('0x1c')](_0x124a7d[_0x0638('0x2c')]['offset']);}_0x162603[_0x0638('0x33')]=qs[_0x0638('0x34')](_0x124a7d['query'][_0x0638('0x34')]);_0x162603[_0x0638('0x35')]=qs[_0x0638('0x36')](_[_0x0638('0x37')](_0x124a7d['query'],_0x3d7a1b[_0x0638('0x36')]),_0x18b501);if(_0x124a7d[_0x0638('0x2c')]['filter']){_0x162603[_0x0638('0x35')]=_[_0x0638('0x38')](_0x162603[_0x0638('0x35')],{'$or':_[_0x0638('0x2b')](_0x18b501,function(_0x4283b3){if(_0x4283b3['type']!==_0x0638('0x39')){var _0x48d9a1={};_0x48d9a1[_0x4283b3['name']]={'$like':'%'+_0x124a7d[_0x0638('0x2c')][_0x0638('0x3a')]+'%'};return _0x48d9a1;}})});}_0x162603=_[_0x0638('0x38')]({},_0x162603,_0x124a7d[_0x0638('0x3b')]);var _0x223d48={'where':_0x162603[_0x0638('0x35')]};return db[_0x0638('0x26')][_0x0638('0x1f')](_0x223d48)['then'](function(_0x261d0f){_0x4564f4['count']=_0x261d0f;if(_0x124a7d['query'][_0x0638('0x3c')]){_0x162603[_0x0638('0x3d')]=[{'all':!![]}];}return db['Team'][_0x0638('0x3e')](_0x162603);})[_0x0638('0x3f')](function(_0x21ae57){_0x4564f4[_0x0638('0x40')]=_0x21ae57;return _0x4564f4;})[_0x0638('0x3f')](respondWithFilteredResult(_0x595f4a,_0x162603))['catch'](handleError(_0x595f4a,null));};exports['show']=function(_0x12883f,_0x19ff11){var _0x566c75={'raw':![],'where':{'id':_0x12883f[_0x0638('0x41')]['id']}},_0x232105={};_0x232105[_0x0638('0x2f')]=_[_0x0638('0x2d')](db[_0x0638('0x26')][_0x0638('0x27')]);_0x232105['query']=_['keys'](_0x12883f['query']);_0x232105['filters']=_[_0x0638('0x2e')](_0x232105[_0x0638('0x2f')],_0x232105[_0x0638('0x2c')]);_0x566c75['attributes']=_[_0x0638('0x2e')](_0x232105[_0x0638('0x2f')],qs[_0x0638('0x31')](_0x12883f[_0x0638('0x2c')][_0x0638('0x31')]));_0x566c75[_0x0638('0x30')]=_0x566c75[_0x0638('0x30')]['length']?_0x566c75['attributes']:_0x232105[_0x0638('0x2f')];if(_0x12883f[_0x0638('0x2c')]['includeAll']){_0x566c75[_0x0638('0x3d')]=[{'all':!![]}];}_0x566c75=_[_0x0638('0x38')]({},_0x566c75,_0x12883f['options']);return db[_0x0638('0x26')][_0x0638('0x42')](_0x566c75)[_0x0638('0x3f')](handleEntityNotFound(_0x19ff11,null))['then'](respondWithResult(_0x19ff11,null))[_0x0638('0x43')](handleError(_0x19ff11,null));};exports[_0x0638('0x44')]=function(_0x3df8ac,_0x7ed923){return db[_0x0638('0x26')]['create'](_0x3df8ac['body'],{})[_0x0638('0x3f')](function(_0x28959d){var _0x3202a5=_0x3df8ac[_0x0638('0x45')][_0x0638('0x46')]({'plain':!![]});if(!_0x3202a5)throw new Error(_0x0638('0x47'));if(_0x3202a5[_0x0638('0x48')]===_0x0638('0x45')){var _0x504e0c=_0x28959d[_0x0638('0x46')]({'plain':!![]});var _0x5722c9='Teams';return db[_0x0638('0x49')]['find']({'where':{'name':_0x5722c9,'userProfileId':_0x3202a5[_0x0638('0x4a')]},'raw':!![]})['then'](function(_0xc20e98){if(_0xc20e98&&_0xc20e98[_0x0638('0x4b')]===0x0){return db[_0x0638('0x4c')]['create']({'name':_0x504e0c[_0x0638('0x23')],'resourceId':_0x504e0c['id'],'type':_0xc20e98[_0x0638('0x23')],'sectionId':_0xc20e98['id']},{})['then'](function(){return _0x28959d;});}else{return _0x28959d;}})[_0x0638('0x43')](function(_0x453584){logger[_0x0638('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x453584);throw _0x453584;});}return _0x28959d;})['then'](respondWithResult(_0x7ed923,0xc9))['catch'](handleError(_0x7ed923,null));};exports[_0x0638('0x4d')]=function(_0x250298,_0xa65efa){if(_0x250298[_0x0638('0x4e')]['id']){delete _0x250298[_0x0638('0x4e')]['id'];}return db[_0x0638('0x26')][_0x0638('0x42')]({'where':{'id':_0x250298['params']['id']}})[_0x0638('0x3f')](handleEntityNotFound(_0xa65efa,null))[_0x0638('0x3f')](saveUpdates(_0x250298[_0x0638('0x4e')],null))[_0x0638('0x3f')](respondWithResult(_0xa65efa,null))[_0x0638('0x43')](handleError(_0xa65efa,null));};exports['destroy']=function(_0x5c19dd,_0x222a69){var _0x21f69f=_0x5c19dd[_0x0638('0x41')]['id'];var _0x446a51=[];return db[_0x0638('0x4f')][_0x0638('0x50')](function(_0x5b8793){var _0x4a10e3=_0x0638('0x51')+_0x21f69f;return db[_0x0638('0x4f')][_0x0638('0x2c')](_0x4a10e3,{'type':db[_0x0638('0x52')][_0x0638('0x53')][_0x0638('0x54')],'raw':!![],'transaction':_0x5b8793})['then'](function(_0x4001c7){_0x446a51=_['map'](_0x4001c7,function(_0x1c5684){return Number(_0x1c5684['UserId']);});})[_0x0638('0x3f')](function(){var _0x191548=_0x0638('0x55')+_0x21f69f;return db['sequelize'][_0x0638('0x2c')](_0x191548,{'type':db[_0x0638('0x52')][_0x0638('0x53')][_0x0638('0x54')],'raw':!![],'transaction':_0x5b8793});})[_0x0638('0x3f')](function(_0x2adaf8){var _0x1d951e=_['map'](_0x2adaf8,function(_0x28ad67){return Number(_0x28ad67[_0x0638('0x56')]);});return db[_0x0638('0x57')][_0x0638('0x58')]({'where':{'UserId':{'$in':_0x446a51},'VoiceQueueId':{'$in':_0x1d951e}},'transaction':_0x5b8793});})['then'](function(){var _0x32e786=_0x0638('0x59')+_0x21f69f;return db['sequelize'][_0x0638('0x2c')](_0x32e786,{'type':db[_0x0638('0x52')][_0x0638('0x53')][_0x0638('0x54')],'raw':!![],'transaction':_0x5b8793});})[_0x0638('0x3f')](function(_0x2e11c1){var _0x404a14=_['map'](_0x2e11c1,function(_0x459fbb){return Number(_0x459fbb[_0x0638('0x5a')]);});return db[_0x0638('0x5b')]['destroy']({'where':{'UserId':{'$in':_0x446a51},'MailQueueId':{'$in':_0x404a14}},'transaction':_0x5b8793});})['then'](function(){var _0x558071='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x21f69f;return db['sequelize'][_0x0638('0x2c')](_0x558071,{'type':db['Sequelize'][_0x0638('0x53')]['SELECT'],'raw':!![],'transaction':_0x5b8793});})[_0x0638('0x3f')](function(_0x4032b4){var _0x15d9f7=_[_0x0638('0x2b')](_0x4032b4,function(_0x1bffe0){return Number(_0x1bffe0['SmsQueueId']);});return db[_0x0638('0x5c')][_0x0638('0x58')]({'where':{'UserId':{'$in':_0x446a51},'SmsQueueId':{'$in':_0x15d9f7}},'transaction':_0x5b8793});})[_0x0638('0x3f')](function(){var _0x54ae3a=_0x0638('0x5d')+_0x21f69f;return db[_0x0638('0x4f')][_0x0638('0x2c')](_0x54ae3a,{'type':db[_0x0638('0x52')][_0x0638('0x53')]['SELECT'],'raw':!![],'transaction':_0x5b8793});})['then'](function(_0xac88aa){var _0x429c56=_['map'](_0xac88aa,function(_0x4cd70f){return Number(_0x4cd70f[_0x0638('0x5e')]);});return db[_0x0638('0x5f')][_0x0638('0x58')]({'where':{'UserId':{'$in':_0x446a51},'ChatQueueId':{'$in':_0x429c56}},'transaction':_0x5b8793});})['then'](function(){var _0x113672='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x21f69f;return db['sequelize'][_0x0638('0x2c')](_0x113672,{'type':db[_0x0638('0x52')][_0x0638('0x53')][_0x0638('0x54')],'raw':!![],'transaction':_0x5b8793});})[_0x0638('0x3f')](function(_0x24fc3e){var _0x38ba95=_[_0x0638('0x2b')](_0x24fc3e,function(_0x8011e7){return Number(_0x8011e7['FaxQueueId']);});return db[_0x0638('0x60')][_0x0638('0x58')]({'where':{'UserId':{'$in':_0x446a51},'FaxQueueId':{'$in':_0x38ba95}},'transaction':_0x5b8793});})[_0x0638('0x3f')](function(){var _0x114770='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x21f69f;return db[_0x0638('0x4f')]['query'](_0x114770,{'type':db[_0x0638('0x52')][_0x0638('0x53')][_0x0638('0x54')],'raw':!![],'transaction':_0x5b8793});})[_0x0638('0x3f')](function(_0x3b3a70){var _0x4a7a06=_[_0x0638('0x2b')](_0x3b3a70,function(_0x2276a4){return Number(_0x2276a4[_0x0638('0x61')]);});return db[_0x0638('0x62')][_0x0638('0x58')]({'where':{'UserId':{'$in':_0x446a51},'OpenchannelQueueId':{'$in':_0x4a7a06}},'transaction':_0x5b8793});})[_0x0638('0x3f')](function(){var _0x4b654e=_0x0638('0x63')+_0x21f69f;return db['sequelize']['query'](_0x4b654e,{'type':db[_0x0638('0x52')][_0x0638('0x53')][_0x0638('0x54')],'raw':!![],'transaction':_0x5b8793});})[_0x0638('0x3f')](function(_0x22bfcd){var _0x3a050f=_[_0x0638('0x2b')](_0x22bfcd,function(_0x31010a){return Number(_0x31010a[_0x0638('0x64')]);});return db[_0x0638('0x65')][_0x0638('0x58')]({'where':{'UserId':{'$in':_0x446a51},'WhatsappQueueId':{'$in':_0x3a050f}},'transaction':_0x5b8793});})[_0x0638('0x3f')](function(){return db[_0x0638('0x66')][_0x0638('0x42')]({'where':{'TeamId':_0x21f69f}});})[_0x0638('0x3f')](function(_0x15b1a5){if(_0x15b1a5===null){return;}return db[_0x0638('0x67')][_0x0638('0x58')]({'where':{'UserId':{'$in':_0x446a51},'VoicePrefixId':_0x15b1a5[_0x0638('0x68')]},'transaction':_0x5b8793});})[_0x0638('0x3f')](function(){return db['Team'][_0x0638('0x58')]({'where':{'id':_0x21f69f},'cascade':!![],'transaction':_0x5b8793});})[_0x0638('0x3f')](function(_0x131636){if(_0x131636===0x0){_0x222a69['sendStatus'](0x194);}else{return db[_0x0638('0x4c')]['destroy']({'where':{'type':'Teams','resourceId':_0x21f69f},'cascade':!![],'transaction':_0x5b8793})[_0x0638('0x3f')](function(){_0x222a69[_0x0638('0x19')](0xcc)[_0x0638('0x1a')]();});}})['catch'](function(_0xb6503f){_0x222a69[_0x0638('0x19')](0x1f4)[_0x0638('0x24')](_0xb6503f);});});};exports[_0x0638('0x69')]=function(_0x3fa5d2,_0x34fce4,_0x2c4a4a){return db[_0x0638('0x26')][_0x0638('0x6a')]({'where':{'id':_0x3fa5d2[_0x0638('0x41')]['id']}})[_0x0638('0x3f')](handleEntityNotFound(_0x34fce4,null))[_0x0638('0x3f')](function(_0x3ce0e3){if(!_0x3fa5d2['query'][_0x0638('0x6b')]||!utils[_0x0638('0x6c')](_0x3fa5d2[_0x0638('0x2c')][_0x0638('0x6b')])){throw new db[(_0x0638('0x52'))]['ValidationError'](_0x0638('0x6d'));}var _0x53bd49={};var _0x5bfe64={};_0x5bfe64[_0x0638('0x2f')]=_[_0x0638('0x2d')](db[_[_0x0638('0x6e')](_0x3fa5d2['query'][_0x0638('0x6b')][_0x0638('0x6f')]())+_0x0638('0x70')][_0x0638('0x27')]);_0x5bfe64[_0x0638('0x2c')]=_[_0x0638('0x2d')](_0x3fa5d2[_0x0638('0x2c')]);_0x5bfe64['filters']=_['intersection'](_0x5bfe64['model'],_0x5bfe64[_0x0638('0x2c')]);_0x53bd49[_0x0638('0x30')]=_[_0x0638('0x2e')](_0x5bfe64[_0x0638('0x2f')],qs['fields'](_0x3fa5d2[_0x0638('0x2c')]['fields']));_0x53bd49[_0x0638('0x30')]=_0x53bd49[_0x0638('0x30')][_0x0638('0x32')]?_0x53bd49['attributes']:_0x5bfe64[_0x0638('0x2f')];_0x53bd49[_0x0638('0x1e')]=qs['limit'](_0x3fa5d2['query'][_0x0638('0x1e')]);_0x53bd49[_0x0638('0x1c')]=qs[_0x0638('0x1c')](_0x3fa5d2[_0x0638('0x2c')][_0x0638('0x1c')]);_0x53bd49[_0x0638('0x33')]=qs['sort'](_0x3fa5d2[_0x0638('0x2c')][_0x0638('0x34')]);_0x53bd49[_0x0638('0x35')]=qs[_0x0638('0x36')](_[_0x0638('0x37')](_0x3fa5d2[_0x0638('0x2c')],_0x5bfe64[_0x0638('0x36')]));_0x53bd49=_[_0x0638('0x38')]({},_0x53bd49,_0x3fa5d2[_0x0638('0x3b')]);return _0x3ce0e3[_0x0638('0x46')+_[_0x0638('0x6e')](_0x3fa5d2[_0x0638('0x2c')]['channel']['toLowerCase']())+_0x0638('0x71')](_0x53bd49);})[_0x0638('0x3f')](respondWithResult(_0x34fce4,null))[_0x0638('0x43')](handleError(_0x34fce4,null));};exports['addQueues']=function(_0x432bfa,_0x3ffab3,_0x492d5d){return db[_0x0638('0x26')]['findOne']({'where':{'id':_0x432bfa['params']['id']}})[_0x0638('0x3f')](function(_0x3385e5){if(_0x3385e5){if(!_0x432bfa[_0x0638('0x4e')][_0x0638('0x6b')]||!utils[_0x0638('0x6c')](_0x432bfa['body'][_0x0638('0x6b')])){throw new db['Sequelize'][(_0x0638('0x72'))](_0x0638('0x6d'));}return _0x3385e5[_0x0638('0x73')+_[_0x0638('0x6e')](_0x432bfa[_0x0638('0x4e')][_0x0638('0x6b')][_0x0638('0x6f')]())+_0x0638('0x71')](_0x432bfa[_0x0638('0x4e')]['ids']);}return null;})[_0x0638('0x3f')](handleEntityNotFound(_0x3ffab3,null))[_0x0638('0x3f')](respondWithStatusCode(_0x3ffab3,null))[_0x0638('0x43')](handleError(_0x3ffab3,null));};exports[_0x0638('0x74')]=function(_0x416b21,_0x50d104,_0x3027ca){return db[_0x0638('0x26')][_0x0638('0x6a')]({'where':{'id':_0x416b21[_0x0638('0x41')]['id']}})[_0x0638('0x3f')](function(_0x41f2d7){if(_0x41f2d7){if(!_0x416b21[_0x0638('0x2c')][_0x0638('0x6b')]||!utils[_0x0638('0x6c')](_0x416b21[_0x0638('0x2c')][_0x0638('0x6b')])){throw new db[(_0x0638('0x52'))]['ValidationError']('Unknown\x20channel');}return _0x41f2d7[_0x0638('0x75')+_['capitalize'](_0x416b21[_0x0638('0x2c')][_0x0638('0x6b')]['toLowerCase']())+_0x0638('0x71')](_0x416b21['query']['ids']);}return null;})[_0x0638('0x3f')](handleEntityNotFound(_0x50d104,null))['then'](respondWithStatusCode(_0x50d104,null))['catch'](handleError(_0x50d104,null));};exports[_0x0638('0x76')]=function(_0x117b35,_0x135288){var _0x297d51=_[_0x0638('0x77')](_0x117b35['body'][_0x0638('0x78')])?_0x117b35['body'][_0x0638('0x78')]:[_0x117b35['body'][_0x0638('0x78')]];var _0x8ae1f5=_0x117b35[_0x0638('0x41')]['id'];return db[_0x0638('0x26')][_0x0638('0x42')]({'where':{'id':_0x8ae1f5}})[_0x0638('0x3f')](handleEntityNotFound(_0x135288,null))['then'](function(_0x247a12){if(_0x247a12){var _0x3ef298=[_0x0638('0x79'),_0x0638('0x7a'),_0x0638('0x7b'),_0x0638('0x7c'),'Fax',_0x0638('0x7d'),_0x0638('0x7e')];return db[_0x0638('0x4f')][_0x0638('0x50')](function(_0x2ddfd2){var _0x3a0aa9=_[_0x0638('0x2b')](_0x3ef298,function(_0x175bc6){var _0xed155f={'attributes':['id',_0x0638('0x23')]};if(_0x175bc6==='Voice'){_0xed155f[_0x0638('0x7f')]={'attributes':[_0x0638('0x80')]};}return _0x247a12[_0x0638('0x46')+_0x175bc6+_0x0638('0x71')](_0xed155f)['then'](function(_0x112b20){var _0x3cf005=_[_0x0638('0x2b')](_0x112b20,function(_0x56583b){var _0x56a830=_[_0x0638('0x2b')](_0x297d51,function(_0x5c5088){var _0x7e80b8={'where':{'UserId':_0x5c5088,[_0x175bc6+_0x0638('0x81')]:_0x56583b['id']},'transaction':_0x2ddfd2};if(_0x175bc6===_0x0638('0x79')){_0x7e80b8[_0x0638('0x82')]={'penalty':_0x56583b[_0x0638('0x83')][_0x0638('0x80')]};}return db[_0x0638('0x84')+_0x175bc6+_0x0638('0x70')]['findOrCreate'](_0x7e80b8)[_0x0638('0x3f')](function(){socket['emit']('user'+_0x175bc6+_0x0638('0x85'),{'UserId':_0x5c5088,[_0x175bc6+_0x0638('0x81')]:_0x56583b['id']});if(_0x175bc6!==_0x0638('0x79')){return;}return db[_0x0638('0x84')]['findAll']({'where':{'id':_0x297d51,'online':0x1},'attributes':['id','name',_0x0638('0x86'),_0x0638('0x87'),_0x0638('0x88')],'raw':!![]})[_0x0638('0x3f')](function(_0x11a91f){var _0x1f8b39=_['map'](_0x11a91f,function(_0x2e6b07){return db[_0x0638('0x89')][_0x0638('0x8a')]({'membername':_0x2e6b07[_0x0638('0x23')],'UserId':_0x2e6b07['id'],'queue_name':_0x56583b[_0x0638('0x23')],'VoiceQueueId':_0x56583b['id'],'interface':_[_0x0638('0x8b')](_0x2e6b07[_0x0638('0x88')])?util[_0x0638('0x8c')](_0x0638('0x8d'),_0x2e6b07['name']):_0x2e6b07[_0x0638('0x88')],'paused':_0x2e6b07[_0x0638('0x87')]||![],'penalty':_0x56583b[_0x0638('0x83')][_0x0638('0x80')]},{'transaction':_0x2ddfd2});});return Promise[_0x0638('0x8e')](_0x1f8b39);});});});return Promise[_0x0638('0x8e')](_0x56a830);});return Promise[_0x0638('0x8e')](_0x3cf005);})[_0x0638('0x3f')](function(){return db[_0x0638('0x66')][_0x0638('0x6a')]({'where':{'teamId':_0x8ae1f5}})[_0x0638('0x3f')](function(_0x26cc23){if(_0x26cc23){var _0x1a0bb3=_[_0x0638('0x2b')](_0x297d51,function(_0x501e88){db[_0x0638('0x67')]['upsert']({'UserId':_0x501e88,'VoicePrefixId':_0x26cc23[_0x0638('0x68')]});});return Promise[_0x0638('0x8e')](_0x1a0bb3);}});});});return Promise[_0x0638('0x8e')](_0x3a0aa9)[_0x0638('0x3f')](function(){return _0x247a12[_0x0638('0x76')](_0x297d51,{'transaction':_0x2ddfd2})[_0x0638('0x8f')](function(_0x397ed7){return _0x397ed7;});});});}})['then'](respondWithResult(_0x135288,null))[_0x0638('0x43')](handleError(_0x135288,null));};exports[_0x0638('0x90')]=function(_0x121ce9,_0x16a38c){var _0x4c0947=_[_0x0638('0x77')](_0x121ce9['query'][_0x0638('0x78')])?_0x121ce9[_0x0638('0x2c')][_0x0638('0x78')]:[_0x121ce9[_0x0638('0x2c')][_0x0638('0x78')]];var _0x40800f=_0x121ce9[_0x0638('0x41')]['id'];return db[_0x0638('0x26')][_0x0638('0x42')]({'where':{'id':_0x40800f}})[_0x0638('0x3f')](handleEntityNotFound(_0x16a38c,null))[_0x0638('0x3f')](function(_0x547537){if(_0x547537){var _0x236244=[_0x0638('0x79'),'Chat',_0x0638('0x7b'),_0x0638('0x7c'),_0x0638('0x91'),_0x0638('0x7d'),_0x0638('0x7e')];return db[_0x0638('0x4f')][_0x0638('0x50')](function(_0x592a5){var _0x148dc7=_[_0x0638('0x2b')](_0x236244,function(_0x26408d){var _0x294e3a={'attributes':['id','name']};return _0x547537[_0x0638('0x46')+_0x26408d+_0x0638('0x71')](_0x294e3a)['then'](function(_0x4bf80){var _0x4d9123=_[_0x0638('0x2b')](_0x4bf80,function(_0x197fb5){return _0x197fb5[_0x0638('0x90')](_0x4c0947,{'transaction':_0x592a5})[_0x0638('0x3f')](function(){var _0x4d3888=_[_0x0638('0x2b')](_0x4c0947,function(_0x132517){socket['emit'](_0x0638('0x45')+_0x26408d+_0x0638('0x92'),{'UserId':Number(_0x132517),[_0x26408d+_0x0638('0x81')]:_0x197fb5['id']});if(_0x26408d!==_0x0638('0x79')){return;}return db['UserVoiceQueueRt'][_0x0638('0x58')]({'where':{'VoiceQueueId':_0x197fb5['id'],'UserId':_0x132517},'transaction':_0x592a5});});return Promise[_0x0638('0x8e')](_0x4d3888);});});return Promise['all'](_0x4d9123);});});return Promise[_0x0638('0x8e')](_0x148dc7)[_0x0638('0x3f')](function(){return _0x547537[_0x0638('0x90')](_0x4c0947,{'transaction':_0x592a5});})[_0x0638('0x3f')](function(){return db['TeamVoicePrefix'][_0x0638('0x6a')]({'where':{'teamId':_0x40800f}})[_0x0638('0x3f')](function(_0x4633bc){if(_0x4633bc){var _0x3d4cbe=_['map'](_0x4c0947,function(_0xe30c4d){db[_0x0638('0x67')][_0x0638('0x58')]({'where':{'UserId':_0xe30c4d,'VoicePrefixId':_0x4633bc[_0x0638('0x68')]}});});return Promise[_0x0638('0x8e')](_0x3d4cbe);}});});});}})[_0x0638('0x3f')](respondWithStatusCode(_0x16a38c,null))[_0x0638('0x43')](handleError(_0x16a38c,null));};exports[_0x0638('0x93')]=function(_0x384164,_0x31b756,_0x3d6cc9){var _0x65d476={};var _0x3423fa={};var _0x1fb457;var _0x5d172e;return db[_0x0638('0x26')][_0x0638('0x6a')]({'where':{'id':_0x384164[_0x0638('0x41')]['id']}})[_0x0638('0x3f')](handleEntityNotFound(_0x31b756,null))[_0x0638('0x3f')](function(_0x2b1863){if(_0x2b1863){_0x1fb457=_0x2b1863;_0x3423fa[_0x0638('0x2f')]=_[_0x0638('0x2d')](db[_0x0638('0x84')][_0x0638('0x27')]);_0x3423fa[_0x0638('0x2c')]=_[_0x0638('0x2d')](_0x384164[_0x0638('0x2c')]);_0x3423fa[_0x0638('0x36')]=_[_0x0638('0x2e')](_0x3423fa[_0x0638('0x2f')],_0x3423fa[_0x0638('0x2c')]);_0x65d476[_0x0638('0x30')]=_['intersection'](_0x3423fa[_0x0638('0x2f')],qs[_0x0638('0x31')](_0x384164[_0x0638('0x2c')][_0x0638('0x31')]));_0x65d476['attributes']=_0x65d476[_0x0638('0x30')][_0x0638('0x32')]?_0x65d476[_0x0638('0x30')]:_0x3423fa[_0x0638('0x2f')];_0x65d476[_0x0638('0x33')]=qs[_0x0638('0x34')](_0x384164['query'][_0x0638('0x34')]);_0x65d476[_0x0638('0x35')]=qs[_0x0638('0x36')](_[_0x0638('0x37')](_0x384164[_0x0638('0x2c')],_0x3423fa[_0x0638('0x36')]));if(_0x384164[_0x0638('0x2c')][_0x0638('0x3a')]){_0x65d476[_0x0638('0x35')]=_[_0x0638('0x38')](_0x65d476[_0x0638('0x35')],{'$or':_[_0x0638('0x2b')](_0x65d476[_0x0638('0x30')],function(_0x350062){var _0x1569aa={};_0x1569aa[_0x350062]={'$like':'%'+_0x384164['query'][_0x0638('0x3a')]+'%'};return _0x1569aa;})});}_0x65d476=_[_0x0638('0x38')]({},_0x65d476,_0x384164['options']);return _0x1fb457[_0x0638('0x93')](_0x65d476);}})[_0x0638('0x3f')](function(_0x49a0db){if(_0x49a0db){_0x5d172e=_0x49a0db[_0x0638('0x32')];if(!_0x384164[_0x0638('0x2c')][_0x0638('0x94')]('nolimit')){_0x65d476['limit']=qs[_0x0638('0x1e')](_0x384164[_0x0638('0x2c')]['limit']);_0x65d476[_0x0638('0x1c')]=qs[_0x0638('0x1c')](_0x384164['query'][_0x0638('0x1c')]);}return _0x1fb457['getAgents'](_0x65d476);}})[_0x0638('0x3f')](function(_0x403c53){if(_0x403c53){return _0x403c53?{'count':_0x5d172e,'rows':_0x403c53}:null;}})[_0x0638('0x3f')](respondWithResult(_0x31b756,null))['catch'](handleError(_0x31b756,null));}; \ No newline at end of file +var _0xe6f2=['OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','getQueues','params','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','findOne','add','ids','removeQueues','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','through','penalty','findOrCreate','Queue:save','QueueId','User','findAll','online','voicePause','interface','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix','VoicePrefixId','spread','removeAgents','emit','Queue:remove','getAgents','nolimit','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','reject','save','update','error','send','index','map','Team','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','options','then','includeAll','rows','catch','show','keys','include','find','create','get','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','sequelize','transaction','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','destroy','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'];(function(_0x5d4c75,_0x13deae){var _0x8410b1=function(_0x3a76f3){while(--_0x3a76f3){_0x5d4c75['push'](_0x5d4c75['shift']());}};_0x8410b1(++_0x13deae);}(_0xe6f2,0xd1));var _0x2e6f=function(_0x425008,_0x21c494){_0x425008=_0x425008-0x0;var _0x5f1001=_0xe6f2[_0x425008];return _0x5f1001;};'use strict';var emlformat=require(_0x2e6f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2e6f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2e6f('0x2'));var moment=require('moment');var BPromise=require(_0x2e6f('0x3'));var Mustache=require(_0x2e6f('0x4'));var util=require(_0x2e6f('0x5'));var path=require(_0x2e6f('0x6'));var sox=require('sox');var csv=require(_0x2e6f('0x7'));var ejs=require(_0x2e6f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2e6f('0x9'));var squel=require(_0x2e6f('0xa'));var crypto=require(_0x2e6f('0xb'));var jsforce=require(_0x2e6f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2e6f('0xd'));var Papa=require(_0x2e6f('0xe'));var Redis=require(_0x2e6f('0xf'));var authService=require(_0x2e6f('0x10'));var qs=require(_0x2e6f('0x11'));var as=require(_0x2e6f('0x12'));var hardwareService=require(_0x2e6f('0x13'));var logger=require(_0x2e6f('0x14'))(_0x2e6f('0x15'));var utils=require(_0x2e6f('0x16'));var config=require(_0x2e6f('0x17'));var licenseUtil=require(_0x2e6f('0x18'));var db=require(_0x2e6f('0x19'))['db'];config[_0x2e6f('0x1a')]=_[_0x2e6f('0x1b')](config[_0x2e6f('0x1a')],{'host':_0x2e6f('0x1c'),'port':0x18eb});var socket=require(_0x2e6f('0x1d'))(new Redis(config[_0x2e6f('0x1a')]));require('./team.socket')[_0x2e6f('0x1e')](socket);function respondWithStatusCode(_0x3400b9,_0x2bb0c3){_0x2bb0c3=_0x2bb0c3||0xcc;return function(_0x2fd653){if(_0x2fd653){return _0x3400b9[_0x2e6f('0x1f')](_0x2bb0c3);}return _0x3400b9['status'](_0x2bb0c3)['end']();};}function respondWithResult(_0x25eafa,_0x51e74e){_0x51e74e=_0x51e74e||0xc8;return function(_0x24b925){if(_0x24b925){return _0x25eafa[_0x2e6f('0x20')](_0x51e74e)[_0x2e6f('0x21')](_0x24b925);}};}function respondWithFilteredResult(_0x3d04d5,_0x3973d0){return function(_0x514283){if(_0x514283){var _0x10d424=typeof _0x3973d0[_0x2e6f('0x22')]===_0x2e6f('0x23')&&typeof _0x3973d0[_0x2e6f('0x24')]===_0x2e6f('0x23');var _0x4ba1ed=_0x514283['count'];var _0xe0d2c7=_0x10d424?0x0:_0x3973d0[_0x2e6f('0x22')];var _0x1b0115=_0x10d424?_0x514283[_0x2e6f('0x25')]:_0x3973d0[_0x2e6f('0x22')]+_0x3973d0[_0x2e6f('0x24')];var _0x5f25dc;if(_0x1b0115>=_0x4ba1ed){_0x1b0115=_0x4ba1ed;_0x5f25dc=0xc8;}else{_0x5f25dc=0xce;}_0x3d04d5[_0x2e6f('0x20')](_0x5f25dc);return _0x3d04d5['set']('Content-Range',_0xe0d2c7+'-'+_0x1b0115+'/'+_0x4ba1ed)['json'](_0x514283);}return null;};}function patchUpdates(_0x2c09b2){return function(_0x3ad924){try{jsonpatch['apply'](_0x3ad924,_0x2c09b2,!![]);}catch(_0xbba393){return BPromise[_0x2e6f('0x26')](_0xbba393);}return _0x3ad924[_0x2e6f('0x27')]();};}function saveUpdates(_0xf91ba2,_0x122801){return function(_0x22ac15){if(_0x22ac15){return _0x22ac15[_0x2e6f('0x28')](_0xf91ba2)['then'](function(_0x44c26c){return _0x44c26c;});}return null;};}function handleEntityNotFound(_0x2bc517,_0x48385e){return function(_0x2ddd71){if(!_0x2ddd71){_0x2bc517['sendStatus'](0x194);}return _0x2ddd71;};}function handleError(_0xf66b89,_0x5e637f){_0x5e637f=_0x5e637f||0x1f4;return function(_0x596c04){logger[_0x2e6f('0x29')](_0x596c04['stack']);if(_0x596c04['name']){delete _0x596c04['name'];}_0xf66b89[_0x2e6f('0x20')](_0x5e637f)[_0x2e6f('0x2a')](_0x596c04);};}exports[_0x2e6f('0x2b')]=function(_0x47c2de,_0x21bd3e){var _0x45f12a={},_0x4a9cce={},_0x175e97={'count':0x0,'rows':[]};var _0x320b30=_[_0x2e6f('0x2c')](db[_0x2e6f('0x2d')][_0x2e6f('0x2e')],function(_0x26e42b){return{'name':_0x26e42b['fieldName'],'type':_0x26e42b[_0x2e6f('0x2f')][_0x2e6f('0x30')]};});_0x4a9cce[_0x2e6f('0x31')]=_[_0x2e6f('0x2c')](_0x320b30,'name');_0x4a9cce[_0x2e6f('0x32')]=_['keys'](_0x47c2de[_0x2e6f('0x32')]);_0x4a9cce[_0x2e6f('0x33')]=_[_0x2e6f('0x34')](_0x4a9cce[_0x2e6f('0x31')],_0x4a9cce['query']);_0x45f12a['attributes']=_[_0x2e6f('0x34')](_0x4a9cce[_0x2e6f('0x31')],qs[_0x2e6f('0x35')](_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x35')]));_0x45f12a['attributes']=_0x45f12a[_0x2e6f('0x36')][_0x2e6f('0x37')]?_0x45f12a['attributes']:_0x4a9cce['model'];if(!_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x38')]('nolimit')){_0x45f12a[_0x2e6f('0x24')]=qs['limit'](_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x24')]);_0x45f12a[_0x2e6f('0x22')]=qs[_0x2e6f('0x22')](_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x22')]);}_0x45f12a[_0x2e6f('0x39')]=qs[_0x2e6f('0x3a')](_0x47c2de[_0x2e6f('0x32')]['sort']);_0x45f12a[_0x2e6f('0x3b')]=qs[_0x2e6f('0x33')](_[_0x2e6f('0x3c')](_0x47c2de[_0x2e6f('0x32')],_0x4a9cce[_0x2e6f('0x33')]),_0x320b30);if(_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x3d')]){_0x45f12a[_0x2e6f('0x3b')]=_[_0x2e6f('0x3e')](_0x45f12a[_0x2e6f('0x3b')],{'$or':_['map'](_0x320b30,function(_0x550604){if(_0x550604[_0x2e6f('0x2f')]!==_0x2e6f('0x3f')){var _0x5dc99c={};_0x5dc99c[_0x550604[_0x2e6f('0x40')]]={'$like':'%'+_0x47c2de['query'][_0x2e6f('0x3d')]+'%'};return _0x5dc99c;}})});}_0x45f12a=_[_0x2e6f('0x3e')]({},_0x45f12a,_0x47c2de[_0x2e6f('0x41')]);var _0x6a911b={'where':_0x45f12a[_0x2e6f('0x3b')]};return db[_0x2e6f('0x2d')]['count'](_0x6a911b)[_0x2e6f('0x42')](function(_0x505268){_0x175e97[_0x2e6f('0x25')]=_0x505268;if(_0x47c2de[_0x2e6f('0x32')][_0x2e6f('0x43')]){_0x45f12a['include']=[{'all':!![]}];}return db[_0x2e6f('0x2d')]['findAll'](_0x45f12a);})['then'](function(_0x1334e6){_0x175e97[_0x2e6f('0x44')]=_0x1334e6;return _0x175e97;})[_0x2e6f('0x42')](respondWithFilteredResult(_0x21bd3e,_0x45f12a))[_0x2e6f('0x45')](handleError(_0x21bd3e,null));};exports[_0x2e6f('0x46')]=function(_0x437716,_0x22c396){var _0x5837b3={'raw':![],'where':{'id':_0x437716['params']['id']}},_0x1bc063={};_0x1bc063[_0x2e6f('0x31')]=_[_0x2e6f('0x47')](db[_0x2e6f('0x2d')][_0x2e6f('0x2e')]);_0x1bc063['query']=_[_0x2e6f('0x47')](_0x437716['query']);_0x1bc063['filters']=_[_0x2e6f('0x34')](_0x1bc063['model'],_0x1bc063[_0x2e6f('0x32')]);_0x5837b3[_0x2e6f('0x36')]=_[_0x2e6f('0x34')](_0x1bc063[_0x2e6f('0x31')],qs[_0x2e6f('0x35')](_0x437716[_0x2e6f('0x32')][_0x2e6f('0x35')]));_0x5837b3[_0x2e6f('0x36')]=_0x5837b3[_0x2e6f('0x36')]['length']?_0x5837b3[_0x2e6f('0x36')]:_0x1bc063[_0x2e6f('0x31')];if(_0x437716[_0x2e6f('0x32')][_0x2e6f('0x43')]){_0x5837b3[_0x2e6f('0x48')]=[{'all':!![]}];}_0x5837b3=_[_0x2e6f('0x3e')]({},_0x5837b3,_0x437716[_0x2e6f('0x41')]);return db[_0x2e6f('0x2d')][_0x2e6f('0x49')](_0x5837b3)['then'](handleEntityNotFound(_0x22c396,null))[_0x2e6f('0x42')](respondWithResult(_0x22c396,null))[_0x2e6f('0x45')](handleError(_0x22c396,null));};exports[_0x2e6f('0x4a')]=function(_0x478a6c,_0xad246){return db['Team'][_0x2e6f('0x4a')](_0x478a6c['body'],{})[_0x2e6f('0x42')](function(_0x391e58){var _0x3d9741=_0x478a6c['user'][_0x2e6f('0x4b')]({'plain':!![]});if(!_0x3d9741)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d9741[_0x2e6f('0x4c')]===_0x2e6f('0x4d')){var _0x15c585=_0x391e58[_0x2e6f('0x4b')]({'plain':!![]});var _0x528271=_0x2e6f('0x4e');return db[_0x2e6f('0x4f')][_0x2e6f('0x49')]({'where':{'name':_0x528271,'userProfileId':_0x3d9741[_0x2e6f('0x50')]},'raw':!![]})[_0x2e6f('0x42')](function(_0x212e40){if(_0x212e40&&_0x212e40[_0x2e6f('0x51')]===0x0){return db[_0x2e6f('0x52')]['create']({'name':_0x15c585[_0x2e6f('0x40')],'resourceId':_0x15c585['id'],'type':_0x212e40[_0x2e6f('0x40')],'sectionId':_0x212e40['id']},{})[_0x2e6f('0x42')](function(){return _0x391e58;});}else{return _0x391e58;}})[_0x2e6f('0x45')](function(_0x23f9de){logger[_0x2e6f('0x29')](_0x2e6f('0x53'),_0x23f9de);throw _0x23f9de;});}return _0x391e58;})[_0x2e6f('0x42')](respondWithResult(_0xad246,0xc9))[_0x2e6f('0x45')](handleError(_0xad246,null));};exports[_0x2e6f('0x28')]=function(_0x16722c,_0x5c4172){if(_0x16722c['body']['id']){delete _0x16722c['body']['id'];}return db[_0x2e6f('0x2d')][_0x2e6f('0x49')]({'where':{'id':_0x16722c['params']['id']}})[_0x2e6f('0x42')](handleEntityNotFound(_0x5c4172,null))[_0x2e6f('0x42')](saveUpdates(_0x16722c[_0x2e6f('0x54')],null))[_0x2e6f('0x42')](respondWithResult(_0x5c4172,null))[_0x2e6f('0x45')](handleError(_0x5c4172,null));};exports['destroy']=function(_0x111239,_0x48d883){var _0x20af16=_0x111239['params']['id'];var _0x50f657=[];return db[_0x2e6f('0x55')][_0x2e6f('0x56')](function(_0x4ef695){var _0x4e1703='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x4e1703,{'type':db[_0x2e6f('0x57')][_0x2e6f('0x58')][_0x2e6f('0x59')],'raw':!![],'transaction':_0x4ef695})[_0x2e6f('0x42')](function(_0x55479a){_0x50f657=_['map'](_0x55479a,function(_0x9f2d20){return Number(_0x9f2d20[_0x2e6f('0x5a')]);});})[_0x2e6f('0x42')](function(){var _0x21c807=_0x2e6f('0x5b')+_0x20af16;return db[_0x2e6f('0x55')]['query'](_0x21c807,{'type':db['Sequelize'][_0x2e6f('0x58')][_0x2e6f('0x59')],'raw':!![],'transaction':_0x4ef695});})['then'](function(_0x2f70ef){var _0x9bfcb=_[_0x2e6f('0x2c')](_0x2f70ef,function(_0x2ee20a){return Number(_0x2ee20a[_0x2e6f('0x5c')]);});return db[_0x2e6f('0x5d')][_0x2e6f('0x5e')]({'where':{'UserId':{'$in':_0x50f657},'VoiceQueueId':{'$in':_0x9bfcb}},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){var _0x4f13a8='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x4f13a8,{'type':db[_0x2e6f('0x57')]['QueryTypes'][_0x2e6f('0x59')],'raw':!![],'transaction':_0x4ef695});})['then'](function(_0x51da1d){var _0x55938e=_[_0x2e6f('0x2c')](_0x51da1d,function(_0x420981){return Number(_0x420981[_0x2e6f('0x5f')]);});return db[_0x2e6f('0x60')][_0x2e6f('0x5e')]({'where':{'UserId':{'$in':_0x50f657},'MailQueueId':{'$in':_0x55938e}},'transaction':_0x4ef695});})['then'](function(){var _0x362a26=_0x2e6f('0x61')+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x362a26,{'type':db[_0x2e6f('0x57')][_0x2e6f('0x58')]['SELECT'],'raw':!![],'transaction':_0x4ef695});})['then'](function(_0x16a420){var _0x127ebe=_[_0x2e6f('0x2c')](_0x16a420,function(_0x2d0845){return Number(_0x2d0845[_0x2e6f('0x62')]);});return db[_0x2e6f('0x63')]['destroy']({'where':{'UserId':{'$in':_0x50f657},'SmsQueueId':{'$in':_0x127ebe}},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){var _0x35ada3=_0x2e6f('0x64')+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x35ada3,{'type':db[_0x2e6f('0x57')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(_0x1d41e7){var _0x4c7798=_['map'](_0x1d41e7,function(_0x5ce265){return Number(_0x5ce265[_0x2e6f('0x65')]);});return db[_0x2e6f('0x66')][_0x2e6f('0x5e')]({'where':{'UserId':{'$in':_0x50f657},'ChatQueueId':{'$in':_0x4c7798}},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){var _0x2b88b2=_0x2e6f('0x67')+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x2b88b2,{'type':db[_0x2e6f('0x57')][_0x2e6f('0x58')][_0x2e6f('0x59')],'raw':!![],'transaction':_0x4ef695});})['then'](function(_0x510221){var _0x13b788=_['map'](_0x510221,function(_0x2660b8){return Number(_0x2660b8['FaxQueueId']);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0x50f657},'FaxQueueId':{'$in':_0x13b788}},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){var _0x523846=_0x2e6f('0x68')+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x523846,{'type':db['Sequelize'][_0x2e6f('0x58')]['SELECT'],'raw':!![],'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(_0x27ac86){var _0x4ebce4=_['map'](_0x27ac86,function(_0x3f719b){return Number(_0x3f719b[_0x2e6f('0x69')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x50f657},'OpenchannelQueueId':{'$in':_0x4ebce4}},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){var _0x1ce2c1=_0x2e6f('0x6a')+_0x20af16;return db[_0x2e6f('0x55')][_0x2e6f('0x32')](_0x1ce2c1,{'type':db['Sequelize'][_0x2e6f('0x58')][_0x2e6f('0x59')],'raw':!![],'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(_0x33f6f4){var _0x2de16c=_[_0x2e6f('0x2c')](_0x33f6f4,function(_0xf75eee){return Number(_0xf75eee[_0x2e6f('0x6b')]);});return db[_0x2e6f('0x6c')][_0x2e6f('0x5e')]({'where':{'UserId':{'$in':_0x50f657},'WhatsappQueueId':{'$in':_0x2de16c}},'transaction':_0x4ef695});})['then'](function(){return db['TeamVoicePrefix'][_0x2e6f('0x49')]({'where':{'TeamId':_0x20af16}});})[_0x2e6f('0x42')](function(_0x37906a){if(_0x37906a===null){return;}return db[_0x2e6f('0x6d')][_0x2e6f('0x5e')]({'where':{'UserId':{'$in':_0x50f657},'VoicePrefixId':_0x37906a['VoicePrefixId']},'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(){return db['Team'][_0x2e6f('0x5e')]({'where':{'id':_0x20af16},'cascade':!![],'transaction':_0x4ef695});})[_0x2e6f('0x42')](function(_0x313e1a){if(_0x313e1a===0x0){_0x48d883[_0x2e6f('0x1f')](0x194);}else{return db[_0x2e6f('0x52')][_0x2e6f('0x5e')]({'where':{'type':_0x2e6f('0x4e'),'resourceId':_0x20af16},'cascade':!![],'transaction':_0x4ef695})[_0x2e6f('0x42')](function(){_0x48d883[_0x2e6f('0x20')](0xcc)['end']();});}})[_0x2e6f('0x45')](function(_0x5dd798){_0x48d883[_0x2e6f('0x20')](0x1f4)[_0x2e6f('0x2a')](_0x5dd798);});});};exports[_0x2e6f('0x6e')]=function(_0xaec12b,_0x1be033,_0x1e0a02){return db[_0x2e6f('0x2d')]['findOne']({'where':{'id':_0xaec12b[_0x2e6f('0x6f')]['id']}})[_0x2e6f('0x42')](handleEntityNotFound(_0x1be033,null))[_0x2e6f('0x42')](function(_0xa44446){if(!_0xaec12b[_0x2e6f('0x32')][_0x2e6f('0x70')]||!utils[_0x2e6f('0x71')](_0xaec12b['query']['channel'])){throw new db[(_0x2e6f('0x57'))][(_0x2e6f('0x72'))](_0x2e6f('0x73'));}var _0x2364b1={};var _0x34c8b1={};_0x34c8b1[_0x2e6f('0x31')]=_['keys'](db[_[_0x2e6f('0x74')](_0xaec12b[_0x2e6f('0x32')][_0x2e6f('0x70')][_0x2e6f('0x75')]())+_0x2e6f('0x76')][_0x2e6f('0x2e')]);_0x34c8b1['query']=_['keys'](_0xaec12b[_0x2e6f('0x32')]);_0x34c8b1[_0x2e6f('0x33')]=_[_0x2e6f('0x34')](_0x34c8b1[_0x2e6f('0x31')],_0x34c8b1[_0x2e6f('0x32')]);_0x2364b1['attributes']=_[_0x2e6f('0x34')](_0x34c8b1[_0x2e6f('0x31')],qs['fields'](_0xaec12b['query'][_0x2e6f('0x35')]));_0x2364b1[_0x2e6f('0x36')]=_0x2364b1['attributes'][_0x2e6f('0x37')]?_0x2364b1[_0x2e6f('0x36')]:_0x34c8b1['model'];_0x2364b1[_0x2e6f('0x24')]=qs[_0x2e6f('0x24')](_0xaec12b[_0x2e6f('0x32')][_0x2e6f('0x24')]);_0x2364b1[_0x2e6f('0x22')]=qs[_0x2e6f('0x22')](_0xaec12b[_0x2e6f('0x32')]['offset']);_0x2364b1['order']=qs[_0x2e6f('0x3a')](_0xaec12b['query'][_0x2e6f('0x3a')]);_0x2364b1[_0x2e6f('0x3b')]=qs[_0x2e6f('0x33')](_[_0x2e6f('0x3c')](_0xaec12b[_0x2e6f('0x32')],_0x34c8b1[_0x2e6f('0x33')]));_0x2364b1=_[_0x2e6f('0x3e')]({},_0x2364b1,_0xaec12b['options']);return _0xa44446[_0x2e6f('0x4b')+_[_0x2e6f('0x74')](_0xaec12b['query'][_0x2e6f('0x70')][_0x2e6f('0x75')]())+_0x2e6f('0x77')](_0x2364b1);})[_0x2e6f('0x42')](respondWithResult(_0x1be033,null))[_0x2e6f('0x45')](handleError(_0x1be033,null));};exports[_0x2e6f('0x78')]=function(_0x4d44ff,_0x28bcab,_0x1d87a6){return db[_0x2e6f('0x2d')][_0x2e6f('0x79')]({'where':{'id':_0x4d44ff[_0x2e6f('0x6f')]['id']}})[_0x2e6f('0x42')](function(_0x2b92ea){if(_0x2b92ea){if(!_0x4d44ff['body']['channel']||!utils[_0x2e6f('0x71')](_0x4d44ff[_0x2e6f('0x54')][_0x2e6f('0x70')])){throw new db[(_0x2e6f('0x57'))]['ValidationError'](_0x2e6f('0x73'));}return _0x2b92ea[_0x2e6f('0x7a')+_[_0x2e6f('0x74')](_0x4d44ff[_0x2e6f('0x54')][_0x2e6f('0x70')]['toLowerCase']())+'Queues'](_0x4d44ff[_0x2e6f('0x54')][_0x2e6f('0x7b')]);}return null;})[_0x2e6f('0x42')](handleEntityNotFound(_0x28bcab,null))[_0x2e6f('0x42')](respondWithStatusCode(_0x28bcab,null))['catch'](handleError(_0x28bcab,null));};exports[_0x2e6f('0x7c')]=function(_0x38b3bb,_0xff83,_0x55eff2){return db['Team'][_0x2e6f('0x79')]({'where':{'id':_0x38b3bb['params']['id']}})['then'](function(_0xbdd00c){if(_0xbdd00c){if(!_0x38b3bb[_0x2e6f('0x32')]['channel']||!utils[_0x2e6f('0x71')](_0x38b3bb[_0x2e6f('0x32')][_0x2e6f('0x70')])){throw new db[(_0x2e6f('0x57'))][(_0x2e6f('0x72'))](_0x2e6f('0x73'));}return _0xbdd00c['remove'+_['capitalize'](_0x38b3bb[_0x2e6f('0x32')]['channel'][_0x2e6f('0x75')]())+_0x2e6f('0x77')](_0x38b3bb['query']['ids']);}return null;})[_0x2e6f('0x42')](handleEntityNotFound(_0xff83,null))[_0x2e6f('0x42')](respondWithStatusCode(_0xff83,null))[_0x2e6f('0x45')](handleError(_0xff83,null));};exports[_0x2e6f('0x7d')]=function(_0xd9b351,_0x2b92f2){var _0x586bd0=_[_0x2e6f('0x7e')](_0xd9b351[_0x2e6f('0x54')][_0x2e6f('0x7b')])?_0xd9b351[_0x2e6f('0x54')][_0x2e6f('0x7b')]:[_0xd9b351[_0x2e6f('0x54')][_0x2e6f('0x7b')]];var _0x8d2f7d=_0xd9b351['params']['id'];return db[_0x2e6f('0x2d')][_0x2e6f('0x49')]({'where':{'id':_0x8d2f7d}})[_0x2e6f('0x42')](handleEntityNotFound(_0x2b92f2,null))[_0x2e6f('0x42')](function(_0x527033){if(_0x527033){var _0x5a35cf=[_0x2e6f('0x7f'),_0x2e6f('0x80'),_0x2e6f('0x81'),_0x2e6f('0x82'),_0x2e6f('0x83'),_0x2e6f('0x84'),'Whatsapp'];return db[_0x2e6f('0x55')][_0x2e6f('0x56')](function(_0x17e639){var _0x451945=_[_0x2e6f('0x2c')](_0x5a35cf,function(_0x1f7bbc){var _0x28b867={'attributes':['id',_0x2e6f('0x40')]};if(_0x1f7bbc==='Voice'){_0x28b867[_0x2e6f('0x85')]={'attributes':[_0x2e6f('0x86')]};}return _0x527033[_0x2e6f('0x4b')+_0x1f7bbc+_0x2e6f('0x77')](_0x28b867)['then'](function(_0x521ee1){var _0x1cc5c8=_['map'](_0x521ee1,function(_0x5384d8){var _0x3613c6=_[_0x2e6f('0x2c')](_0x586bd0,function(_0x59777f){var _0x40be94={'where':{'UserId':_0x59777f,[_0x1f7bbc+'QueueId']:_0x5384d8['id']},'transaction':_0x17e639};if(_0x1f7bbc===_0x2e6f('0x7f')){_0x40be94[_0x2e6f('0x1b')]={'penalty':_0x5384d8['TeamVoiceQueue']['penalty']};}return db['User'+_0x1f7bbc+_0x2e6f('0x76')][_0x2e6f('0x87')](_0x40be94)['then'](function(){socket['emit'](_0x2e6f('0x4d')+_0x1f7bbc+_0x2e6f('0x88'),{'UserId':_0x59777f,[_0x1f7bbc+_0x2e6f('0x89')]:_0x5384d8['id']});if(_0x1f7bbc!==_0x2e6f('0x7f')){return;}return db[_0x2e6f('0x8a')][_0x2e6f('0x8b')]({'where':{'id':_0x586bd0,'online':0x1},'attributes':['id',_0x2e6f('0x40'),_0x2e6f('0x8c'),_0x2e6f('0x8d'),_0x2e6f('0x8e')],'raw':!![]})[_0x2e6f('0x42')](function(_0x934108){var _0x359891=_[_0x2e6f('0x2c')](_0x934108,function(_0xddc7fe){return db['UserVoiceQueueRt'][_0x2e6f('0x8f')]({'membername':_0xddc7fe[_0x2e6f('0x40')],'UserId':_0xddc7fe['id'],'queue_name':_0x5384d8['name'],'VoiceQueueId':_0x5384d8['id'],'interface':_[_0x2e6f('0x90')](_0xddc7fe[_0x2e6f('0x8e')])?util[_0x2e6f('0x91')](_0x2e6f('0x92'),_0xddc7fe['name']):_0xddc7fe[_0x2e6f('0x8e')],'paused':_0xddc7fe[_0x2e6f('0x8d')]||![],'penalty':_0x5384d8[_0x2e6f('0x93')]['penalty']},{'transaction':_0x17e639});});return Promise[_0x2e6f('0x94')](_0x359891);});});});return Promise[_0x2e6f('0x94')](_0x3613c6);});return Promise[_0x2e6f('0x94')](_0x1cc5c8);})[_0x2e6f('0x42')](function(){return db[_0x2e6f('0x95')][_0x2e6f('0x79')]({'where':{'teamId':_0x8d2f7d}})[_0x2e6f('0x42')](function(_0x5e1def){if(_0x5e1def){var _0x3906d6=_[_0x2e6f('0x2c')](_0x586bd0,function(_0x588039){db['UserVoicePrefix'][_0x2e6f('0x8f')]({'UserId':_0x588039,'VoicePrefixId':_0x5e1def[_0x2e6f('0x96')]});});return Promise[_0x2e6f('0x94')](_0x3906d6);}});});});return Promise[_0x2e6f('0x94')](_0x451945)[_0x2e6f('0x42')](function(){return _0x527033[_0x2e6f('0x7d')](_0x586bd0,{'transaction':_0x17e639})[_0x2e6f('0x97')](function(_0x475538){return _0x475538;});});});}})[_0x2e6f('0x42')](respondWithResult(_0x2b92f2,null))[_0x2e6f('0x45')](handleError(_0x2b92f2,null));};exports[_0x2e6f('0x98')]=function(_0x436911,_0x1c5978){var _0x3ca774=_[_0x2e6f('0x7e')](_0x436911[_0x2e6f('0x32')]['ids'])?_0x436911[_0x2e6f('0x32')][_0x2e6f('0x7b')]:[_0x436911[_0x2e6f('0x32')][_0x2e6f('0x7b')]];var _0xbb7d32=_0x436911[_0x2e6f('0x6f')]['id'];return db[_0x2e6f('0x2d')][_0x2e6f('0x49')]({'where':{'id':_0xbb7d32}})[_0x2e6f('0x42')](handleEntityNotFound(_0x1c5978,null))[_0x2e6f('0x42')](function(_0x30bb2b){if(_0x30bb2b){var _0x26c06d=[_0x2e6f('0x7f'),_0x2e6f('0x80'),_0x2e6f('0x81'),_0x2e6f('0x82'),_0x2e6f('0x83'),_0x2e6f('0x84'),'Whatsapp'];return db[_0x2e6f('0x55')][_0x2e6f('0x56')](function(_0x5dde5c){var _0x2191f3=_['map'](_0x26c06d,function(_0x42496d){var _0x24d158={'attributes':['id',_0x2e6f('0x40')]};return _0x30bb2b[_0x2e6f('0x4b')+_0x42496d+'Queues'](_0x24d158)['then'](function(_0x334575){var _0x54645d=_[_0x2e6f('0x2c')](_0x334575,function(_0x445d16){return _0x445d16[_0x2e6f('0x98')](_0x3ca774,{'transaction':_0x5dde5c})['then'](function(){var _0x902beb=_[_0x2e6f('0x2c')](_0x3ca774,function(_0x1670ab){socket[_0x2e6f('0x99')](_0x2e6f('0x4d')+_0x42496d+_0x2e6f('0x9a'),{'UserId':Number(_0x1670ab),[_0x42496d+_0x2e6f('0x89')]:_0x445d16['id']});if(_0x42496d!==_0x2e6f('0x7f')){return;}return db['UserVoiceQueueRt'][_0x2e6f('0x5e')]({'where':{'VoiceQueueId':_0x445d16['id'],'UserId':_0x1670ab},'transaction':_0x5dde5c});});return Promise[_0x2e6f('0x94')](_0x902beb);});});return Promise[_0x2e6f('0x94')](_0x54645d);});});return Promise[_0x2e6f('0x94')](_0x2191f3)['then'](function(){return _0x30bb2b[_0x2e6f('0x98')](_0x3ca774,{'transaction':_0x5dde5c});})[_0x2e6f('0x42')](function(){return db[_0x2e6f('0x95')][_0x2e6f('0x79')]({'where':{'teamId':_0xbb7d32}})['then'](function(_0x24b7a3){if(_0x24b7a3){var _0x104c1b=_[_0x2e6f('0x2c')](_0x3ca774,function(_0x432a35){db[_0x2e6f('0x6d')][_0x2e6f('0x5e')]({'where':{'UserId':_0x432a35,'VoicePrefixId':_0x24b7a3['VoicePrefixId']}});});return Promise[_0x2e6f('0x94')](_0x104c1b);}});});});}})['then'](respondWithStatusCode(_0x1c5978,null))[_0x2e6f('0x45')](handleError(_0x1c5978,null));};exports[_0x2e6f('0x9b')]=function(_0x3ad053,_0x5ece8f,_0x1b8ca7){var _0x50b9af={};var _0x3dccca={};var _0x319014;var _0xef33de;return db[_0x2e6f('0x2d')]['findOne']({'where':{'id':_0x3ad053[_0x2e6f('0x6f')]['id']}})[_0x2e6f('0x42')](handleEntityNotFound(_0x5ece8f,null))[_0x2e6f('0x42')](function(_0x317523){if(_0x317523){_0x319014=_0x317523;_0x3dccca[_0x2e6f('0x31')]=_['keys'](db[_0x2e6f('0x8a')][_0x2e6f('0x2e')]);_0x3dccca[_0x2e6f('0x32')]=_[_0x2e6f('0x47')](_0x3ad053[_0x2e6f('0x32')]);_0x3dccca['filters']=_[_0x2e6f('0x34')](_0x3dccca['model'],_0x3dccca[_0x2e6f('0x32')]);_0x50b9af[_0x2e6f('0x36')]=_[_0x2e6f('0x34')](_0x3dccca['model'],qs[_0x2e6f('0x35')](_0x3ad053['query'][_0x2e6f('0x35')]));_0x50b9af['attributes']=_0x50b9af[_0x2e6f('0x36')][_0x2e6f('0x37')]?_0x50b9af[_0x2e6f('0x36')]:_0x3dccca[_0x2e6f('0x31')];_0x50b9af['order']=qs[_0x2e6f('0x3a')](_0x3ad053['query'][_0x2e6f('0x3a')]);_0x50b9af[_0x2e6f('0x3b')]=qs[_0x2e6f('0x33')](_[_0x2e6f('0x3c')](_0x3ad053['query'],_0x3dccca[_0x2e6f('0x33')]));if(_0x3ad053[_0x2e6f('0x32')][_0x2e6f('0x3d')]){_0x50b9af[_0x2e6f('0x3b')]=_[_0x2e6f('0x3e')](_0x50b9af[_0x2e6f('0x3b')],{'$or':_['map'](_0x50b9af['attributes'],function(_0x325a4c){var _0x93fdf6={};_0x93fdf6[_0x325a4c]={'$like':'%'+_0x3ad053[_0x2e6f('0x32')]['filter']+'%'};return _0x93fdf6;})});}_0x50b9af=_['merge']({},_0x50b9af,_0x3ad053['options']);return _0x319014[_0x2e6f('0x9b')](_0x50b9af);}})[_0x2e6f('0x42')](function(_0x2c1284){if(_0x2c1284){_0xef33de=_0x2c1284[_0x2e6f('0x37')];if(!_0x3ad053['query'][_0x2e6f('0x38')](_0x2e6f('0x9c'))){_0x50b9af[_0x2e6f('0x24')]=qs[_0x2e6f('0x24')](_0x3ad053['query'][_0x2e6f('0x24')]);_0x50b9af[_0x2e6f('0x22')]=qs[_0x2e6f('0x22')](_0x3ad053[_0x2e6f('0x32')]['offset']);}return _0x319014['getAgents'](_0x50b9af);}})[_0x2e6f('0x42')](function(_0x1f8273){if(_0x1f8273){return _0x1f8273?{'count':_0xef33de,'rows':_0x1f8273}:null;}})[_0x2e6f('0x42')](respondWithResult(_0x5ece8f,null))[_0x2e6f('0x45')](handleError(_0x5ece8f,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 58f2b9c..9c03846 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 _0x2067=['emit','hook','exports','../../mysqldb','Team','setMaxListeners','save','remove'];(function(_0x41ca7d,_0x3e8640){var _0x2cd0db=function(_0x59c1a2){while(--_0x59c1a2){_0x41ca7d['push'](_0x41ca7d['shift']());}};_0x2cd0db(++_0x3e8640);}(_0x2067,0xcb));var _0x7206=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x2067[_0x36ed3c];return _0x52a2e0;};'use strict';var EventEmitter=require('events');var Team=require(_0x7206('0x0'))['db'][_0x7206('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x7206('0x2')](0x0);var events={'afterCreate':_0x7206('0x3'),'afterUpdate':'update','afterDestroy':_0x7206('0x4')};function emitEvent(_0x3099c7){return function(_0x527735,_0x368b41,_0x3d3df4){TeamEvents[_0x7206('0x5')](_0x3099c7+':'+_0x527735['id'],_0x527735);TeamEvents[_0x7206('0x5')](_0x3099c7,_0x527735);_0x3d3df4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x7206('0x6')](e,emitEvent(event));}}module[_0x7206('0x7')]=TeamEvents; \ No newline at end of file +var _0xaff0=['exports','events','../../mysqldb','Team','update','emit','hasOwnProperty'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0xaff0,0xc5));var _0x0aff=function(_0x96994b,_0x163958){_0x96994b=_0x96994b-0x0;var _0x1560f1=_0xaff0[_0x96994b];return _0x1560f1;};'use strict';var EventEmitter=require(_0x0aff('0x0'));var Team=require(_0x0aff('0x1'))['db'][_0x0aff('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0aff('0x3'),'afterDestroy':'remove'};function emitEvent(_0x13e6d6){return function(_0x35b010,_0x3fed46,_0x4f2fde){TeamEvents['emit'](_0x13e6d6+':'+_0x35b010['id'],_0x35b010);TeamEvents[_0x0aff('0x4')](_0x13e6d6,_0x35b010);_0x4f2fde(null);};}for(var e in events){if(events[_0x0aff('0x5')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x0aff('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 4ffd551..0b7362a 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 _0xf878=['channel','catch','exports','Team','teams','Chat','Fax','Openchannel','Sms','Voice','lodash','get','Queues','then','map','setDataValue'];(function(_0x1db923,_0x426bc8){var _0x2bf565=function(_0x381b74){while(--_0x381b74){_0x1db923['push'](_0x1db923['shift']());}};_0x2bf565(++_0x426bc8);}(_0xf878,0x12a));var _0x8f87=function(_0x311dab,_0x3638fc){_0x311dab=_0x311dab-0x0;var _0x16f0f8=_0xf878[_0x311dab];return _0x16f0f8;};'use strict';var _=require(_0x8f87('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x21726a,_0xc1ccce){var _0x4e29e5=_0x8f87('0x1')+_0xc1ccce+_0x8f87('0x2');return _0x21726a[_0x4e29e5]()[_0x8f87('0x3')](function(_0x228ef3){return _[_0x8f87('0x4')](_0x228ef3,function(_0x1ac0bb){_0x1ac0bb[_0x8f87('0x5')](_0x8f87('0x6'),_0xc1ccce);return _0x1ac0bb;});})[_0x8f87('0x7')](function(_0x3d5e73){throw _0x3d5e73;});}module[_0x8f87('0x8')]=function(_0x4c9e65){return _0x4c9e65['define'](_0x8f87('0x9'),attributes,{'tableName':_0x8f87('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xb2b8b1=this;var _0x2db2c3=[_0x8f87('0xb'),_0x8f87('0xc'),'Mail',_0x8f87('0xd'),_0x8f87('0xe'),_0x8f87('0xf'),'Whatsapp'];return Promise['resolve']()['then'](function(){var _0x5ec341=_['map'](_0x2db2c3,function(_0x1941a4){return getQueuesByChannel(_0xb2b8b1,_0x1941a4);});return Promise['all'](_0x5ec341);})['catch'](function(_0x4d938e){throw _0x4d938e;});}}});}; \ No newline at end of file +var _0x6b7f=['Whatsapp','resolve','catch','lodash','./team.attributes','get','Queues','then','map','setDataValue','exports','define','teams','Chat','Fax','Openchannel','Sms','Voice'];(function(_0x504fa8,_0x448235){var _0x2abdf3=function(_0x2a3906){while(--_0x2a3906){_0x504fa8['push'](_0x504fa8['shift']());}};_0x2abdf3(++_0x448235);}(_0x6b7f,0x6f));var _0xf6b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b7f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6b7('0x0'));var attributes=require(_0xf6b7('0x1'));function getQueuesByChannel(_0x2692cf,_0x3379b0){var _0x52707e=_0xf6b7('0x2')+_0x3379b0+_0xf6b7('0x3');return _0x2692cf[_0x52707e]()[_0xf6b7('0x4')](function(_0x3516c2){return _[_0xf6b7('0x5')](_0x3516c2,function(_0x2ae708){_0x2ae708[_0xf6b7('0x6')]('channel',_0x3379b0);return _0x2ae708;});})['catch'](function(_0x56890c){throw _0x56890c;});}module[_0xf6b7('0x7')]=function(_0x4a0c70){return _0x4a0c70[_0xf6b7('0x8')]('Team',attributes,{'tableName':_0xf6b7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x514402=this;var _0x2db7fb=[_0xf6b7('0xa'),_0xf6b7('0xb'),'Mail',_0xf6b7('0xc'),_0xf6b7('0xd'),_0xf6b7('0xe'),_0xf6b7('0xf')];return Promise[_0xf6b7('0x10')]()[_0xf6b7('0x4')](function(){var _0x390cca=_[_0xf6b7('0x5')](_0x2db7fb,function(_0x56acea){return getQueuesByChannel(_0x514402,_0x56acea);});return Promise['all'](_0x390cca);})[_0xf6b7('0x11')](function(_0x3e6744){throw _0x3e6744;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 5f73a51..0f86578 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 _0x3823=['randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','info','request\x20sent','debug','stringify','error','Team,\x20%s,\x20%s','message','catch','util','moment'];(function(_0x4c7ddb,_0x41a6cf){var _0x535cc8=function(_0x1ded3b){while(--_0x1ded3b){_0x4c7ddb['push'](_0x4c7ddb['shift']());}};_0x535cc8(++_0x41a6cf);}(_0x3823,0x71));var _0x3382=function(_0xcee411,_0x59f634){_0xcee411=_0xcee411-0x0;var _0x5c3735=_0x3823[_0xcee411];return _0x5c3735;};'use strict';var _=require('lodash');var util=require(_0x3382('0x0'));var moment=require(_0x3382('0x1'));var BPromise=require('bluebird');var rs=require(_0x3382('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3382('0x3'));var logger=require(_0x3382('0x4'))(_0x3382('0x5'));var config=require('../../config/environment');var jayson=require(_0x3382('0x6'));var client=jayson[_0x3382('0x7')][_0x3382('0x8')]({'port':0x232a});config[_0x3382('0x9')]=_[_0x3382('0xa')](config['redis'],{'host':_0x3382('0xb'),'port':0x18eb});var socket=require(_0x3382('0xc'))(new Redis(config[_0x3382('0x9')]));require(_0x3382('0xd'))[_0x3382('0xe')](socket);function respondWithRpcPromise(_0x3d42ad,_0x2979e3,_0x29c771){return new BPromise(function(_0x5689e0,_0x34a3b7){return client['request'](_0x3d42ad,_0x29c771)['then'](function(_0x21022d){logger[_0x3382('0xf')]('Team,\x20%s,\x20%s',_0x2979e3,_0x3382('0x10'));logger[_0x3382('0x11')]('Team,\x20%s,\x20%s,\x20%s',_0x2979e3,_0x3382('0x10'),JSON[_0x3382('0x12')](_0x21022d));if(_0x21022d[_0x3382('0x13')]){if(_0x21022d[_0x3382('0x13')]['code']===0x1f4){logger[_0x3382('0x13')](_0x3382('0x14'),_0x2979e3,_0x21022d[_0x3382('0x13')][_0x3382('0x15')]);return _0x34a3b7(_0x21022d[_0x3382('0x13')][_0x3382('0x15')]);}logger[_0x3382('0x13')]('Team,\x20%s,\x20%s',_0x2979e3,_0x21022d[_0x3382('0x13')][_0x3382('0x15')]);return _0x5689e0(_0x21022d[_0x3382('0x13')][_0x3382('0x15')]);}else{logger['info'](_0x3382('0x14'),_0x2979e3,_0x3382('0x10'));_0x5689e0(_0x21022d['result'][_0x3382('0x15')]);}})[_0x3382('0x16')](function(_0x35b6a1){logger[_0x3382('0x13')](_0x3382('0x14'),_0x2979e3,_0x35b6a1);_0x34a3b7(_0x35b6a1);});});} \ No newline at end of file +var _0x61a8=['Team,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xebb85e,_0x7810eb){var _0x118ceb=function(_0x1150a5){while(--_0x1150a5){_0xebb85e['push'](_0xebb85e['shift']());}};_0x118ceb(++_0x7810eb);}(_0x61a8,0x1be));var _0x861a=function(_0x5ed5e4,_0x15d7fc){_0x5ed5e4=_0x5ed5e4-0x0;var _0xcc956a=_0x61a8[_0x5ed5e4];return _0xcc956a;};'use strict';var _=require('lodash');var util=require(_0x861a('0x0'));var moment=require(_0x861a('0x1'));var BPromise=require('bluebird');var rs=require(_0x861a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x861a('0x3'))['db'];var utils=require(_0x861a('0x4'));var logger=require(_0x861a('0x5'))('rpc');var config=require(_0x861a('0x6'));var jayson=require(_0x861a('0x7'));var client=jayson[_0x861a('0x8')][_0x861a('0x9')]({'port':0x232a});config[_0x861a('0xa')]=_['defaults'](config['redis'],{'host':_0x861a('0xb'),'port':0x18eb});var socket=require(_0x861a('0xc'))(new Redis(config[_0x861a('0xa')]));require('./team.socket')[_0x861a('0xd')](socket);function respondWithRpcPromise(_0x15b0d9,_0x1c35cd,_0x3d6b79){return new BPromise(function(_0x3b65c7,_0x34e3ce){return client['request'](_0x15b0d9,_0x3d6b79)[_0x861a('0xe')](function(_0x4908cc){logger[_0x861a('0xf')]('Team,\x20%s,\x20%s',_0x1c35cd,_0x861a('0x10'));logger[_0x861a('0x11')](_0x861a('0x12'),_0x1c35cd,'request\x20sent',JSON[_0x861a('0x13')](_0x4908cc));if(_0x4908cc[_0x861a('0x14')]){if(_0x4908cc[_0x861a('0x14')][_0x861a('0x15')]===0x1f4){logger['error'](_0x861a('0x16'),_0x1c35cd,_0x4908cc[_0x861a('0x14')][_0x861a('0x17')]);return _0x34e3ce(_0x4908cc['error'][_0x861a('0x17')]);}logger[_0x861a('0x14')](_0x861a('0x16'),_0x1c35cd,_0x4908cc[_0x861a('0x14')][_0x861a('0x17')]);return _0x3b65c7(_0x4908cc[_0x861a('0x14')]['message']);}else{logger[_0x861a('0xf')](_0x861a('0x16'),_0x1c35cd,_0x861a('0x10'));_0x3b65c7(_0x4908cc[_0x861a('0x18')][_0x861a('0x17')]);}})[_0x861a('0x19')](function(_0xdcb2dd){logger['error'](_0x861a('0x16'),_0x1c35cd,_0xdcb2dd);_0x34e3ce(_0xdcb2dd);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index a45ba5a..79098ad 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 _0x13cf=['emit','removeListener','register','length','team:','./team.events','save','remove'];(function(_0x5b3c1e,_0x12a421){var _0x1485c0=function(_0xc8fe9c){while(--_0xc8fe9c){_0x5b3c1e['push'](_0x5b3c1e['shift']());}};_0x1485c0(++_0x12a421);}(_0x13cf,0x11d));var _0xf13c=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x13cf[_0x32d457];return _0x338386;};'use strict';var TeamEvents=require(_0xf13c('0x0'));var events=[_0xf13c('0x1'),_0xf13c('0x2'),'update'];function createListener(_0x3d484c,_0x310591){return function(_0x3d0428){_0x310591[_0xf13c('0x3')](_0x3d484c,_0x3d0428);};}function removeListener(_0x59dc38,_0x5614c1){return function(){TeamEvents[_0xf13c('0x4')](_0x59dc38,_0x5614c1);};}exports[_0xf13c('0x5')]=function(_0x910ac1){for(var _0x5e61fc=0x0,_0x33f762=events[_0xf13c('0x6')];_0x5e61fc<_0x33f762;_0x5e61fc++){var _0x2aa4ee=events[_0x5e61fc];var _0x150450=createListener(_0xf13c('0x7')+_0x2aa4ee,_0x910ac1);TeamEvents['on'](_0x2aa4ee,_0x150450);}}; \ No newline at end of file +var _0x7759=['update','emit','team:','./team.events','remove'];(function(_0x1f0ab2,_0x368d5c){var _0x59f8db=function(_0x7ef738){while(--_0x7ef738){_0x1f0ab2['push'](_0x1f0ab2['shift']());}};_0x59f8db(++_0x368d5c);}(_0x7759,0x143));var _0x9775=function(_0x4e37bc,_0x8df15){_0x4e37bc=_0x4e37bc-0x0;var _0xab5db5=_0x7759[_0x4e37bc];return _0xab5db5;};'use strict';var TeamEvents=require(_0x9775('0x0'));var events=['save',_0x9775('0x1'),_0x9775('0x2')];function createListener(_0xc378ca,_0x132956){return function(_0x21c74e){_0x132956[_0x9775('0x3')](_0xc378ca,_0x21c74e);};}function removeListener(_0x421ea7,_0x3e358a){return function(){TeamEvents['removeListener'](_0x421ea7,_0x3e358a);};}exports['register']=function(_0x2543f1){for(var _0x540bb3=0x0,_0x249a09=events['length'];_0x540bb3<_0x249a09;_0x540bb3++){var _0x49c873=events[_0x540bb3];var _0x32786c=createListener(_0x9775('0x4')+_0x49c873,_0x2543f1);TeamEvents['on'](_0x49c873,_0x32786c);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 8e3408c..a4d0912 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 _0x8cc8=['sequelize','exports','INTEGER'];(function(_0x22e0c1,_0x1b8660){var _0x174839=function(_0x319dc0){while(--_0x319dc0){_0x22e0c1['push'](_0x22e0c1['shift']());}};_0x174839(++_0x1b8660);}(_0x8cc8,0x177));var _0x88cc=function(_0x5910f1,_0x420ed5){_0x5910f1=_0x5910f1-0x0;var _0x47c411=_0x8cc8[_0x5910f1];return _0x47c411;};'use strict';var Sequelize=require(_0x88cc('0x0'));module[_0x88cc('0x1')]={'TeamId':{'type':Sequelize[_0x88cc('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x88cc('0x2')]}}; \ No newline at end of file +var _0x6599=['exports','INTEGER'];(function(_0x268b2f,_0x563089){var _0x4e308f=function(_0x4fefd2){while(--_0x4fefd2){_0x268b2f['push'](_0x268b2f['shift']());}};_0x4e308f(++_0x563089);}(_0x6599,0xb0));var _0x9659=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x6599[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require('sequelize');module[_0x9659('0x0')]={'TeamId':{'type':Sequelize[_0x9659('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x9659('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 8264551..8233bf7 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 _0x96f9=['moment','bluebird','request-promise','path','rimraf','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96f9,0x64));var _0x996f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x96f9[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x996f('0x0'));var util=require(_0x996f('0x1'));var logger=require(_0x996f('0x2'))(_0x996f('0x3'));var moment=require(_0x996f('0x4'));var BPromise=require(_0x996f('0x5'));var rp=require(_0x996f('0x6'));var fs=require('fs');var path=require(_0x996f('0x7'));var rimraf=require(_0x996f('0x8'));var config=require('../../config/environment');var attributes=require(_0x996f('0x9'));module[_0x996f('0xa')]=function(_0x4846b8,_0x1e1b9d){return _0x4846b8[_0x996f('0xb')](_0x996f('0xc'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88a6=['TeamVoicePrefix','util','../../config/logger','moment','bluebird','request-promise','path','./teamVoicePrefix.attributes','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x88a6,0x121));var _0x688a=function(_0x3e4e06,_0x577430){_0x3e4e06=_0x3e4e06-0x0;var _0x58e857=_0x88a6[_0x3e4e06];return _0x58e857;};'use strict';var _=require('lodash');var util=require(_0x688a('0x0'));var logger=require(_0x688a('0x1'))('api');var moment=require(_0x688a('0x2'));var BPromise=require(_0x688a('0x3'));var rp=require(_0x688a('0x4'));var fs=require('fs');var path=require(_0x688a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x688a('0x6'));module['exports']=function(_0x1743a3,_0x357896){return _0x1743a3[_0x688a('0x7')](_0x688a('0x8'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index dcc3531..7b700a2 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4e25eb,_0x1f4ad7){var _0x346127=function(_0xc9b51e){while(--_0xc9b51e){_0x4e25eb['push'](_0x4e25eb['shift']());}};_0x346127(++_0x1f4ad7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x291d47,_0x20086b){var _0x2cb6ae=function(_0x5bb555){while(--_0x5bb555){_0x291d47['push'](_0x291d47['shift']());}};_0x2cb6ae(++_0x20086b);}(_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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index d52eb60..e4754c1 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 _0xbea5=['exports','sequelize'];(function(_0x3d8dec,_0x3f4b9e){var _0x2cee90=function(_0x1b5f3e){while(--_0x1b5f3e){_0x3d8dec['push'](_0x3d8dec['shift']());}};_0x2cee90(++_0x3f4b9e);}(_0xbea5,0x177));var _0x5bea=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0xbea5[_0xd299c3];return _0x376574;};'use strict';var Sequelize=require(_0x5bea('0x0'));module[_0x5bea('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x634a=['exports','INTEGER','sequelize'];(function(_0x51bb38,_0x4e57a0){var _0x51c09b=function(_0x3321e2){while(--_0x3321e2){_0x51bb38['push'](_0x51bb38['shift']());}};_0x51c09b(++_0x4e57a0);}(_0x634a,0x17f));var _0xa634=function(_0x208ce7,_0x2c8d79){_0x208ce7=_0x208ce7-0x0;var _0x68a2c4=_0x634a[_0x208ce7];return _0x68a2c4;};'use strict';var Sequelize=require(_0xa634('0x0'));module[_0xa634('0x1')]={'penalty':{'type':Sequelize[_0xa634('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 a9c25e0..3fbf4ca 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 _0x5eb8=['define','TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x2e4c3f,_0x590cb7){var _0x3ad19d=function(_0x16a2a7){while(--_0x16a2a7){_0x2e4c3f['push'](_0x2e4c3f['shift']());}};_0x3ad19d(++_0x590cb7);}(_0x5eb8,0x1d1));var _0x85eb=function(_0x5ca3d6,_0x5c7599){_0x5ca3d6=_0x5ca3d6-0x0;var _0x3a1032=_0x5eb8[_0x5ca3d6];return _0x3a1032;};'use strict';var _=require('lodash');var util=require(_0x85eb('0x0'));var logger=require(_0x85eb('0x1'))('api');var moment=require('moment');var BPromise=require(_0x85eb('0x2'));var rp=require(_0x85eb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85eb('0x4'));var config=require(_0x85eb('0x5'));var attributes=require(_0x85eb('0x6'));module[_0x85eb('0x7')]=function(_0x4c6606,_0xec020a){return _0x4c6606[_0x85eb('0x8')](_0x85eb('0x9'),attributes,{'tableName':_0x85eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb38e=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','team_has_voice_queues','lodash'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb38e,0xa7));var _0xeb38=function(_0x17002e,_0x5d36d6){_0x17002e=_0x17002e-0x0;var _0x17b3c0=_0xb38e[_0x17002e];return _0x17b3c0;};'use strict';var _=require(_0xeb38('0x0'));var util=require(_0xeb38('0x1'));var logger=require(_0xeb38('0x2'))(_0xeb38('0x3'));var moment=require(_0xeb38('0x4'));var BPromise=require(_0xeb38('0x5'));var rp=require(_0xeb38('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb38('0x7'));var config=require(_0xeb38('0x8'));var attributes=require('./teamVoiceQueue.attributes');module[_0xeb38('0x9')]=function(_0xd3e5dc,_0x28e501){return _0xd3e5dc[_0xeb38('0xa')]('TeamVoiceQueue',attributes,{'tableName':_0xeb38('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 c334e0e..10708be 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 _0xe14b=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x10ea62,_0xe37085){var _0x2c7541=function(_0x21fe8b){while(--_0x21fe8b){_0x10ea62['push'](_0x10ea62['shift']());}};_0x2c7541(++_0xe37085);}(_0xe14b,0xbf));var _0xbe14=function(_0x55d277,_0x124953){_0x55d277=_0x55d277-0x0;var _0xb4f767=_0xe14b[_0x55d277];return _0xb4f767;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require(_0xbe14('0x2'));var rs=require(_0xbe14('0x3'));var fs=require('fs');var Redis=require(_0xbe14('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x5'));var logger=require(_0xbe14('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbe14('0x7'));var client=jayson[_0xbe14('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e51eb,_0x360ab0,_0x1357da){return new BPromise(function(_0x3e9f10,_0x1c10e3){return client['request'](_0x2e51eb,_0x1357da)[_0xbe14('0x9')](function(_0x312179){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x360ab0,'request\x20sent');logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x360ab0,_0xbe14('0xc'),JSON[_0xbe14('0xd')](_0x312179));if(_0x312179[_0xbe14('0xe')]){if(_0x312179[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x360ab0,_0x312179[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x1c10e3(_0x312179[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x360ab0,_0x312179[_0xbe14('0xe')]['message']);return _0x3e9f10(_0x312179[_0xbe14('0xe')][_0xbe14('0x10')]);}else{logger[_0xbe14('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x360ab0,_0xbe14('0xc'));_0x3e9f10(_0x312179[_0xbe14('0x11')][_0xbe14('0x10')]);}})[_0xbe14('0x12')](function(_0x12c8c5){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x360ab0,_0x12c8c5);_0x1c10e3(_0x12c8c5);});});} \ No newline at end of file +var _0x8ccb=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','TeamVoiceQueue,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','bluebird','randomstring'];(function(_0x4d993a,_0x150d3c){var _0x5a004e=function(_0x2e3abc){while(--_0x2e3abc){_0x4d993a['push'](_0x4d993a['shift']());}};_0x5a004e(++_0x150d3c);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x4ea6af,_0x4aa32e){_0x4ea6af=_0x4ea6af-0x0;var _0x4cb1e6=_0x8ccb[_0x4ea6af];return _0x4cb1e6;};'use strict';var _=require(_0xb8cc('0x0'));var util=require(_0xb8cc('0x1'));var moment=require('moment');var BPromise=require(_0xb8cc('0x2'));var rs=require(_0xb8cc('0x3'));var fs=require('fs');var Redis=require(_0xb8cc('0x4'));var db=require(_0xb8cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb8cc('0x6'));var config=require(_0xb8cc('0x7'));var jayson=require(_0xb8cc('0x8'));var client=jayson['client'][_0xb8cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x349552,_0x139945,_0x56951f){return new BPromise(function(_0x35c86d,_0x2c338f){return client[_0xb8cc('0xa')](_0x349552,_0x56951f)['then'](function(_0x175473){logger[_0xb8cc('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x139945,'request\x20sent');logger[_0xb8cc('0xc')](_0xb8cc('0xd'),_0x139945,'request\x20sent',JSON['stringify'](_0x175473));if(_0x175473[_0xb8cc('0xe')]){if(_0x175473[_0xb8cc('0xe')]['code']===0x1f4){logger[_0xb8cc('0xe')](_0xb8cc('0xf'),_0x139945,_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);return _0x2c338f(_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);}logger[_0xb8cc('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x139945,_0x175473[_0xb8cc('0xe')]['message']);return _0x35c86d(_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);}else{logger[_0xb8cc('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x139945,_0xb8cc('0x11'));_0x35c86d(_0x175473[_0xb8cc('0x12')][_0xb8cc('0x10')]);}})['catch'](function(_0x2ba498){logger['error'](_0xb8cc('0xf'),_0x139945,_0x2ba498);_0x2c338f(_0x2ba498);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index ca318d4..f6914df 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 _0x082a=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','create','put','/:id','update','destroy','util','path'];(function(_0x3dbc12,_0x3fac50){var _0xe65d7a=function(_0x379d4e){while(--_0x379d4e){_0x3dbc12['push'](_0x3dbc12['shift']());}};_0xe65d7a(++_0x3fac50);}(_0x082a,0x154));var _0xa082=function(_0x311a16,_0x260064){_0x311a16=_0x311a16-0x0;var _0x2c6dca=_0x082a[_0x311a16];return _0x2c6dca;};'use strict';var multer=require('multer');var util=require(_0xa082('0x0'));var path=require(_0xa082('0x1'));var timeout=require(_0xa082('0x2'));var express=require('express');var router=express[_0xa082('0x3')]();var fs_extra=require(_0xa082('0x4'));var auth=require(_0xa082('0x5'));var interaction=require(_0xa082('0x6'));var config=require(_0xa082('0x7'));var controller=require('./template.controller');router[_0xa082('0x8')]('/',auth['isAuthenticated'](),controller[_0xa082('0x9')]);router[_0xa082('0x8')]('/:id',auth[_0xa082('0xa')](),controller[_0xa082('0xb')]);router[_0xa082('0xc')]('/',auth['isAuthenticated'](),controller[_0xa082('0xd')]);router[_0xa082('0xe')](_0xa082('0xf'),auth[_0xa082('0xa')](),controller[_0xa082('0x10')]);router['delete'](_0xa082('0xf'),auth[_0xa082('0xa')](),controller[_0xa082('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc5c8=['../../components/interaction/service','./template.controller','get','isAuthenticated','index','/:id','show','post','update','destroy','multer','util','path','express','../../components/auth/service'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc5c8,0x118));var _0x8c5c=function(_0x27af3b,_0x137570){_0x27af3b=_0x27af3b-0x0;var _0x1e4b81=_0xc5c8[_0x27af3b];return _0x1e4b81;};'use strict';var multer=require(_0x8c5c('0x0'));var util=require(_0x8c5c('0x1'));var path=require(_0x8c5c('0x2'));var timeout=require('connect-timeout');var express=require(_0x8c5c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8c5c('0x4'));var interaction=require(_0x8c5c('0x5'));var config=require('../../config/environment');var controller=require(_0x8c5c('0x6'));router[_0x8c5c('0x7')]('/',auth[_0x8c5c('0x8')](),controller[_0x8c5c('0x9')]);router[_0x8c5c('0x7')](_0x8c5c('0xa'),auth[_0x8c5c('0x8')](),controller[_0x8c5c('0xb')]);router[_0x8c5c('0xc')]('/',auth[_0x8c5c('0x8')](),controller['create']);router['put']('/:id',auth[_0x8c5c('0x8')](),controller[_0x8c5c('0xd')]);router['delete']('/:id',auth[_0x8c5c('0x8')](),controller[_0x8c5c('0xe')]);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 1b23671..ff34d43 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 _0x8057=['sequelize','exports','TEXT'];(function(_0x2d8f6c,_0x44db4c){var _0x3a00f6=function(_0x1b16ea){while(--_0x1b16ea){_0x2d8f6c['push'](_0x2d8f6c['shift']());}};_0x3a00f6(++_0x44db4c);}(_0x8057,0x1ef));var _0x7805=function(_0x1bd74e,_0xcfe425){_0x1bd74e=_0x1bd74e-0x0;var _0x5f45c1=_0x8057[_0x1bd74e];return _0x5f45c1;};'use strict';var Sequelize=require(_0x7805('0x0'));module[_0x7805('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x7805('0x2')]}}; \ No newline at end of file +var _0x2b7d=['TEXT','sequelize','STRING'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0x2b7d,0x163));var _0xd2b7=function(_0x5843d2,_0x121877){_0x5843d2=_0x5843d2-0x0;var _0x6dd37=_0x2b7d[_0x5843d2];return _0x6dd37;};'use strict';var Sequelize=require(_0xd2b7('0x0'));module['exports']={'name':{'type':Sequelize[_0xd2b7('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xd2b7('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index f0b178a..20cbc78 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 _0xb446=['rows','catch','params','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Templates','UserProfileResource','end','sendStatus','error','name','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Template','includeAll','include','findAll'];(function(_0x45377c,_0x5034d7){var _0x138f76=function(_0x1f13f8){while(--_0x1f13f8){_0x45377c['push'](_0x45377c['shift']());}};_0x138f76(++_0x5034d7);}(_0xb446,0x1a2));var _0x6b44=function(_0x34acff,_0x2637b3){_0x34acff=_0x34acff-0x0;var _0x3eacb6=_0xb446[_0x34acff];return _0x3eacb6;};'use strict';var emlformat=require(_0x6b44('0x0'));var rimraf=require(_0x6b44('0x1'));var zipdir=require(_0x6b44('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6b44('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6b44('0x4'));var util=require(_0x6b44('0x5'));var path=require('path');var sox=require(_0x6b44('0x6'));var csv=require(_0x6b44('0x7'));var ejs=require(_0x6b44('0x8'));var fs=require('fs');var fs_extra=require(_0x6b44('0x9'));var _=require(_0x6b44('0xa'));var squel=require('squel');var crypto=require(_0x6b44('0xb'));var jsforce=require(_0x6b44('0xc'));var deskjs=require(_0x6b44('0xd'));var toCsv=require(_0x6b44('0x7'));var querystring=require(_0x6b44('0xe'));var Papa=require('papaparse');var Redis=require(_0x6b44('0xf'));var authService=require(_0x6b44('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6b44('0x11'));var hardwareService=require(_0x6b44('0x12'));var logger=require('../../config/logger')(_0x6b44('0x13'));var utils=require('../../config/utils');var config=require(_0x6b44('0x14'));var licenseUtil=require(_0x6b44('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d6fa7,_0x3fa362){_0x3fa362=_0x3fa362||0xcc;return function(_0x547020){if(_0x547020){return _0x1d6fa7['sendStatus'](_0x3fa362);}return _0x1d6fa7[_0x6b44('0x16')](_0x3fa362)['end']();};}function respondWithResult(_0x5a43c0,_0x4f420e){_0x4f420e=_0x4f420e||0xc8;return function(_0x3ec48d){if(_0x3ec48d){return _0x5a43c0[_0x6b44('0x16')](_0x4f420e)[_0x6b44('0x17')](_0x3ec48d);}};}function respondWithFilteredResult(_0x16504e,_0x265b66){return function(_0x37c63d){if(_0x37c63d){var _0x5d49d4=typeof _0x265b66[_0x6b44('0x18')]===_0x6b44('0x19')&&typeof _0x265b66[_0x6b44('0x1a')]==='undefined';var _0x3f01fa=_0x37c63d[_0x6b44('0x1b')];var _0x12902a=_0x5d49d4?0x0:_0x265b66[_0x6b44('0x18')];var _0x1cbb23=_0x5d49d4?_0x37c63d[_0x6b44('0x1b')]:_0x265b66[_0x6b44('0x18')]+_0x265b66[_0x6b44('0x1a')];var _0x532ec5;if(_0x1cbb23>=_0x3f01fa){_0x1cbb23=_0x3f01fa;_0x532ec5=0xc8;}else{_0x532ec5=0xce;}_0x16504e['status'](_0x532ec5);return _0x16504e[_0x6b44('0x1c')](_0x6b44('0x1d'),_0x12902a+'-'+_0x1cbb23+'/'+_0x3f01fa)[_0x6b44('0x17')](_0x37c63d);}return null;};}function patchUpdates(_0x500c0a){return function(_0x35e800){try{jsonpatch[_0x6b44('0x1e')](_0x35e800,_0x500c0a,!![]);}catch(_0x289da4){return BPromise[_0x6b44('0x1f')](_0x289da4);}return _0x35e800[_0x6b44('0x20')]();};}function saveUpdates(_0x2abbd5,_0x10ab30){return function(_0x17808d){if(_0x17808d){return _0x17808d[_0x6b44('0x21')](_0x2abbd5)['then'](function(_0x2299f4){return _0x2299f4;});}return null;};}function removeEntity(_0x1a24b3,_0x76407e){return function(_0x5619dc){if(_0x5619dc){return _0x5619dc[_0x6b44('0x22')]()[_0x6b44('0x23')](function(){var _0x302910=_0x5619dc[_0x6b44('0x24')]({'plain':!![]});var _0x31d376=_0x6b44('0x25');return db[_0x6b44('0x26')][_0x6b44('0x22')]({'where':{'type':_0x31d376,'resourceId':_0x302910['id']}})[_0x6b44('0x23')](function(){return _0x5619dc;});})['then'](function(){_0x1a24b3[_0x6b44('0x16')](0xcc)[_0x6b44('0x27')]();});}};}function handleEntityNotFound(_0x3f2f0e,_0x186f88){return function(_0x2f95d4){if(!_0x2f95d4){_0x3f2f0e[_0x6b44('0x28')](0x194);}return _0x2f95d4;};}function handleError(_0x47c5dd,_0x43bac9){_0x43bac9=_0x43bac9||0x1f4;return function(_0x29547e){logger[_0x6b44('0x29')](_0x29547e['stack']);if(_0x29547e[_0x6b44('0x2a')]){delete _0x29547e[_0x6b44('0x2a')];}_0x47c5dd[_0x6b44('0x16')](_0x43bac9)['send'](_0x29547e);};}exports['index']=function(_0x165d98,_0x18b456){var _0x1651ef={},_0x152984={},_0x1db3c2={'count':0x0,'rows':[]};var _0x4162bb=_['map'](db['Template']['rawAttributes'],function(_0x5898c7){return{'name':_0x5898c7[_0x6b44('0x2b')],'type':_0x5898c7[_0x6b44('0x2c')][_0x6b44('0x2d')]};});_0x152984[_0x6b44('0x2e')]=_['map'](_0x4162bb,_0x6b44('0x2a'));_0x152984[_0x6b44('0x2f')]=_[_0x6b44('0x30')](_0x165d98[_0x6b44('0x2f')]);_0x152984[_0x6b44('0x31')]=_[_0x6b44('0x32')](_0x152984['model'],_0x152984[_0x6b44('0x2f')]);_0x1651ef['attributes']=_[_0x6b44('0x32')](_0x152984['model'],qs[_0x6b44('0x33')](_0x165d98[_0x6b44('0x2f')][_0x6b44('0x33')]));_0x1651ef[_0x6b44('0x34')]=_0x1651ef[_0x6b44('0x34')][_0x6b44('0x35')]?_0x1651ef['attributes']:_0x152984[_0x6b44('0x2e')];if(!_0x165d98[_0x6b44('0x2f')][_0x6b44('0x36')](_0x6b44('0x37'))){_0x1651ef[_0x6b44('0x1a')]=qs[_0x6b44('0x1a')](_0x165d98[_0x6b44('0x2f')][_0x6b44('0x1a')]);_0x1651ef[_0x6b44('0x18')]=qs[_0x6b44('0x18')](_0x165d98['query'][_0x6b44('0x18')]);}_0x1651ef[_0x6b44('0x38')]=qs[_0x6b44('0x39')](_0x165d98[_0x6b44('0x2f')][_0x6b44('0x39')]);_0x1651ef['where']=qs[_0x6b44('0x31')](_[_0x6b44('0x3a')](_0x165d98['query'],_0x152984[_0x6b44('0x31')]),_0x4162bb);if(_0x165d98['query'][_0x6b44('0x3b')]){_0x1651ef[_0x6b44('0x3c')]=_[_0x6b44('0x3d')](_0x1651ef['where'],{'$or':_['map'](_0x4162bb,function(_0x2ab8a3){if(_0x2ab8a3[_0x6b44('0x2c')]!==_0x6b44('0x3e')){var _0xc3b308={};_0xc3b308[_0x2ab8a3['name']]={'$like':'%'+_0x165d98[_0x6b44('0x2f')][_0x6b44('0x3b')]+'%'};return _0xc3b308;}})});}_0x1651ef=_[_0x6b44('0x3d')]({},_0x1651ef,_0x165d98[_0x6b44('0x3f')]);var _0x5268d5={'where':_0x1651ef[_0x6b44('0x3c')]};return db[_0x6b44('0x40')][_0x6b44('0x1b')](_0x5268d5)[_0x6b44('0x23')](function(_0x4534b1){_0x1db3c2[_0x6b44('0x1b')]=_0x4534b1;if(_0x165d98[_0x6b44('0x2f')][_0x6b44('0x41')]){_0x1651ef[_0x6b44('0x42')]=[{'all':!![]}];}return db[_0x6b44('0x40')][_0x6b44('0x43')](_0x1651ef);})[_0x6b44('0x23')](function(_0x477826){_0x1db3c2[_0x6b44('0x44')]=_0x477826;return _0x1db3c2;})['then'](respondWithFilteredResult(_0x18b456,_0x1651ef))[_0x6b44('0x45')](handleError(_0x18b456,null));};exports['show']=function(_0x54ecbf,_0x521352){var _0xc70826={'raw':!![],'where':{'id':_0x54ecbf[_0x6b44('0x46')]['id']}},_0x2150d8={};_0x2150d8[_0x6b44('0x2e')]=_[_0x6b44('0x30')](db[_0x6b44('0x40')][_0x6b44('0x47')]);_0x2150d8[_0x6b44('0x2f')]=_['keys'](_0x54ecbf[_0x6b44('0x2f')]);_0x2150d8[_0x6b44('0x31')]=_[_0x6b44('0x32')](_0x2150d8[_0x6b44('0x2e')],_0x2150d8[_0x6b44('0x2f')]);_0xc70826[_0x6b44('0x34')]=_[_0x6b44('0x32')](_0x2150d8[_0x6b44('0x2e')],qs[_0x6b44('0x33')](_0x54ecbf[_0x6b44('0x2f')]['fields']));_0xc70826[_0x6b44('0x34')]=_0xc70826[_0x6b44('0x34')]['length']?_0xc70826['attributes']:_0x2150d8[_0x6b44('0x2e')];if(_0x54ecbf[_0x6b44('0x2f')][_0x6b44('0x41')]){_0xc70826[_0x6b44('0x42')]=[{'all':!![]}];}_0xc70826=_[_0x6b44('0x3d')]({},_0xc70826,_0x54ecbf[_0x6b44('0x3f')]);return db[_0x6b44('0x40')]['find'](_0xc70826)['then'](handleEntityNotFound(_0x521352,null))[_0x6b44('0x23')](respondWithResult(_0x521352,null))[_0x6b44('0x45')](handleError(_0x521352,null));};exports[_0x6b44('0x48')]=function(_0x488c03,_0x48ac4f){return db[_0x6b44('0x40')][_0x6b44('0x48')](_0x488c03['body'],{})[_0x6b44('0x23')](function(_0x2a5fc6){var _0x659959=_0x488c03[_0x6b44('0x49')][_0x6b44('0x24')]({'plain':!![]});if(!_0x659959)throw new Error(_0x6b44('0x4a'));if(_0x659959[_0x6b44('0x4b')]===_0x6b44('0x49')){var _0x39a986=_0x2a5fc6['get']({'plain':!![]});var _0x4717cc='Templates';return db['UserProfileSection']['find']({'where':{'name':_0x4717cc,'userProfileId':_0x659959[_0x6b44('0x4c')]},'raw':!![]})[_0x6b44('0x23')](function(_0x5b3758){if(_0x5b3758&&_0x5b3758[_0x6b44('0x4d')]===0x0){return db[_0x6b44('0x26')][_0x6b44('0x48')]({'name':_0x39a986['name'],'resourceId':_0x39a986['id'],'type':_0x5b3758['name'],'sectionId':_0x5b3758['id']},{})['then'](function(){return _0x2a5fc6;});}else{return _0x2a5fc6;}})['catch'](function(_0x437939){logger[_0x6b44('0x29')](_0x6b44('0x4e'),_0x437939);throw _0x437939;});}return _0x2a5fc6;})[_0x6b44('0x23')](respondWithResult(_0x48ac4f,0xc9))[_0x6b44('0x45')](handleError(_0x48ac4f,null));};exports[_0x6b44('0x21')]=function(_0x15e848,_0x14687a){if(_0x15e848[_0x6b44('0x4f')]['id']){delete _0x15e848['body']['id'];}return db['Template']['find']({'where':{'id':_0x15e848[_0x6b44('0x46')]['id']}})['then'](handleEntityNotFound(_0x14687a,null))[_0x6b44('0x23')](saveUpdates(_0x15e848['body'],null))[_0x6b44('0x23')](respondWithResult(_0x14687a,null))[_0x6b44('0x45')](handleError(_0x14687a,null));};exports['destroy']=function(_0x1cf7dc,_0x54be28){return db[_0x6b44('0x40')][_0x6b44('0x50')]({'where':{'id':_0x1cf7dc[_0x6b44('0x46')]['id']}})[_0x6b44('0x23')](handleEntityNotFound(_0x54be28,null))[_0x6b44('0x23')](removeEntity(_0x54be28,null))[_0x6b44('0x45')](handleError(_0x54be28,null));}; \ No newline at end of file +var _0x5932=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','Templates','end','sendStatus','stack','name','send','index','map','Template','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x4323be,_0x4127a9){var _0x51e495=function(_0x12208c){while(--_0x12208c){_0x4323be['push'](_0x4323be['shift']());}};_0x51e495(++_0x4127a9);}(_0x5932,0xb0));var _0x2593=function(_0x783771,_0xc3eb12){_0x783771=_0x783771-0x0;var _0x205546=_0x5932[_0x783771];return _0x205546;};'use strict';var emlformat=require(_0x2593('0x0'));var rimraf=require(_0x2593('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2593('0x2'));var rp=require(_0x2593('0x3'));var moment=require(_0x2593('0x4'));var BPromise=require(_0x2593('0x5'));var Mustache=require('mustache');var util=require(_0x2593('0x6'));var path=require(_0x2593('0x7'));var sox=require(_0x2593('0x8'));var csv=require('to-csv');var ejs=require(_0x2593('0x9'));var fs=require('fs');var fs_extra=require(_0x2593('0xa'));var _=require(_0x2593('0xb'));var squel=require(_0x2593('0xc'));var crypto=require('crypto');var jsforce=require(_0x2593('0xd'));var deskjs=require(_0x2593('0xe'));var toCsv=require(_0x2593('0xf'));var querystring=require(_0x2593('0x10'));var Papa=require(_0x2593('0x11'));var Redis=require(_0x2593('0x12'));var authService=require(_0x2593('0x13'));var qs=require(_0x2593('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2593('0x15'));var logger=require(_0x2593('0x16'))(_0x2593('0x17'));var utils=require(_0x2593('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2593('0x19'));var db=require(_0x2593('0x1a'))['db'];function respondWithStatusCode(_0xd46267,_0x1752b0){_0x1752b0=_0x1752b0||0xcc;return function(_0x4882f6){if(_0x4882f6){return _0xd46267['sendStatus'](_0x1752b0);}return _0xd46267[_0x2593('0x1b')](_0x1752b0)['end']();};}function respondWithResult(_0x323d9f,_0x39b848){_0x39b848=_0x39b848||0xc8;return function(_0xaf3033){if(_0xaf3033){return _0x323d9f[_0x2593('0x1b')](_0x39b848)[_0x2593('0x1c')](_0xaf3033);}};}function respondWithFilteredResult(_0x4ea280,_0x3201b7){return function(_0x53f2b5){if(_0x53f2b5){var _0x582781=typeof _0x3201b7['offset']===_0x2593('0x1d')&&typeof _0x3201b7[_0x2593('0x1e')]===_0x2593('0x1d');var _0x284b0b=_0x53f2b5[_0x2593('0x1f')];var _0x288f47=_0x582781?0x0:_0x3201b7[_0x2593('0x20')];var _0x40401d=_0x582781?_0x53f2b5['count']:_0x3201b7[_0x2593('0x20')]+_0x3201b7[_0x2593('0x1e')];var _0x1c9c66;if(_0x40401d>=_0x284b0b){_0x40401d=_0x284b0b;_0x1c9c66=0xc8;}else{_0x1c9c66=0xce;}_0x4ea280[_0x2593('0x1b')](_0x1c9c66);return _0x4ea280[_0x2593('0x21')]('Content-Range',_0x288f47+'-'+_0x40401d+'/'+_0x284b0b)['json'](_0x53f2b5);}return null;};}function patchUpdates(_0x3ad946){return function(_0x2d486c){try{jsonpatch[_0x2593('0x22')](_0x2d486c,_0x3ad946,!![]);}catch(_0x3127d0){return BPromise[_0x2593('0x23')](_0x3127d0);}return _0x2d486c[_0x2593('0x24')]();};}function saveUpdates(_0xb49954,_0x3dff65){return function(_0x3883f9){if(_0x3883f9){return _0x3883f9[_0x2593('0x25')](_0xb49954)[_0x2593('0x26')](function(_0x2675e6){return _0x2675e6;});}return null;};}function removeEntity(_0x20c2b4,_0x3d6c36){return function(_0xa9a8f5){if(_0xa9a8f5){return _0xa9a8f5[_0x2593('0x27')]()[_0x2593('0x26')](function(){var _0x47b28f=_0xa9a8f5['get']({'plain':!![]});var _0x20f392=_0x2593('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x20f392,'resourceId':_0x47b28f['id']}})[_0x2593('0x26')](function(){return _0xa9a8f5;});})[_0x2593('0x26')](function(){_0x20c2b4[_0x2593('0x1b')](0xcc)[_0x2593('0x29')]();});}};}function handleEntityNotFound(_0x498447,_0x3a6a74){return function(_0x406512){if(!_0x406512){_0x498447[_0x2593('0x2a')](0x194);}return _0x406512;};}function handleError(_0x24632a,_0x8271e4){_0x8271e4=_0x8271e4||0x1f4;return function(_0x16ce38){logger['error'](_0x16ce38[_0x2593('0x2b')]);if(_0x16ce38[_0x2593('0x2c')]){delete _0x16ce38[_0x2593('0x2c')];}_0x24632a[_0x2593('0x1b')](_0x8271e4)[_0x2593('0x2d')](_0x16ce38);};}exports[_0x2593('0x2e')]=function(_0x1fe73b,_0x2cf76a){var _0x2a31a5={},_0x581fae={},_0xc4466f={'count':0x0,'rows':[]};var _0x1949c2=_[_0x2593('0x2f')](db[_0x2593('0x30')]['rawAttributes'],function(_0xe2441e){return{'name':_0xe2441e[_0x2593('0x31')],'type':_0xe2441e[_0x2593('0x32')]['key']};});_0x581fae[_0x2593('0x33')]=_['map'](_0x1949c2,_0x2593('0x2c'));_0x581fae[_0x2593('0x34')]=_['keys'](_0x1fe73b[_0x2593('0x34')]);_0x581fae[_0x2593('0x35')]=_[_0x2593('0x36')](_0x581fae['model'],_0x581fae[_0x2593('0x34')]);_0x2a31a5[_0x2593('0x37')]=_[_0x2593('0x36')](_0x581fae[_0x2593('0x33')],qs[_0x2593('0x38')](_0x1fe73b['query']['fields']));_0x2a31a5[_0x2593('0x37')]=_0x2a31a5[_0x2593('0x37')][_0x2593('0x39')]?_0x2a31a5[_0x2593('0x37')]:_0x581fae['model'];if(!_0x1fe73b[_0x2593('0x34')][_0x2593('0x3a')](_0x2593('0x3b'))){_0x2a31a5[_0x2593('0x1e')]=qs[_0x2593('0x1e')](_0x1fe73b[_0x2593('0x34')][_0x2593('0x1e')]);_0x2a31a5[_0x2593('0x20')]=qs[_0x2593('0x20')](_0x1fe73b[_0x2593('0x34')][_0x2593('0x20')]);}_0x2a31a5[_0x2593('0x3c')]=qs['sort'](_0x1fe73b[_0x2593('0x34')][_0x2593('0x3d')]);_0x2a31a5[_0x2593('0x3e')]=qs[_0x2593('0x35')](_[_0x2593('0x3f')](_0x1fe73b['query'],_0x581fae['filters']),_0x1949c2);if(_0x1fe73b[_0x2593('0x34')][_0x2593('0x40')]){_0x2a31a5['where']=_['merge'](_0x2a31a5[_0x2593('0x3e')],{'$or':_[_0x2593('0x2f')](_0x1949c2,function(_0x152bfb){if(_0x152bfb[_0x2593('0x32')]!==_0x2593('0x41')){var _0x4f1c05={};_0x4f1c05[_0x152bfb[_0x2593('0x2c')]]={'$like':'%'+_0x1fe73b[_0x2593('0x34')]['filter']+'%'};return _0x4f1c05;}})});}_0x2a31a5=_[_0x2593('0x42')]({},_0x2a31a5,_0x1fe73b['options']);var _0x1e9eb4={'where':_0x2a31a5[_0x2593('0x3e')]};return db[_0x2593('0x30')]['count'](_0x1e9eb4)[_0x2593('0x26')](function(_0x5a0f2f){_0xc4466f[_0x2593('0x1f')]=_0x5a0f2f;if(_0x1fe73b['query'][_0x2593('0x43')]){_0x2a31a5[_0x2593('0x44')]=[{'all':!![]}];}return db[_0x2593('0x30')][_0x2593('0x45')](_0x2a31a5);})['then'](function(_0x23baf8){_0xc4466f[_0x2593('0x46')]=_0x23baf8;return _0xc4466f;})['then'](respondWithFilteredResult(_0x2cf76a,_0x2a31a5))[_0x2593('0x47')](handleError(_0x2cf76a,null));};exports[_0x2593('0x48')]=function(_0x5bbcd8,_0x4a05bf){var _0x24a791={'raw':!![],'where':{'id':_0x5bbcd8[_0x2593('0x49')]['id']}},_0x25f251={};_0x25f251[_0x2593('0x33')]=_[_0x2593('0x4a')](db[_0x2593('0x30')][_0x2593('0x4b')]);_0x25f251[_0x2593('0x34')]=_[_0x2593('0x4a')](_0x5bbcd8['query']);_0x25f251[_0x2593('0x35')]=_[_0x2593('0x36')](_0x25f251['model'],_0x25f251['query']);_0x24a791[_0x2593('0x37')]=_[_0x2593('0x36')](_0x25f251[_0x2593('0x33')],qs[_0x2593('0x38')](_0x5bbcd8[_0x2593('0x34')]['fields']));_0x24a791['attributes']=_0x24a791[_0x2593('0x37')][_0x2593('0x39')]?_0x24a791[_0x2593('0x37')]:_0x25f251[_0x2593('0x33')];if(_0x5bbcd8[_0x2593('0x34')]['includeAll']){_0x24a791[_0x2593('0x44')]=[{'all':!![]}];}_0x24a791=_[_0x2593('0x42')]({},_0x24a791,_0x5bbcd8[_0x2593('0x4c')]);return db[_0x2593('0x30')][_0x2593('0x4d')](_0x24a791)[_0x2593('0x26')](handleEntityNotFound(_0x4a05bf,null))[_0x2593('0x26')](respondWithResult(_0x4a05bf,null))[_0x2593('0x47')](handleError(_0x4a05bf,null));};exports['create']=function(_0x22fcb3,_0x2b29f1){return db['Template'][_0x2593('0x4e')](_0x22fcb3[_0x2593('0x4f')],{})[_0x2593('0x26')](function(_0x22165b){var _0x462088=_0x22fcb3['user'][_0x2593('0x50')]({'plain':!![]});if(!_0x462088)throw new Error(_0x2593('0x51'));if(_0x462088['role']===_0x2593('0x52')){var _0x202d47=_0x22165b[_0x2593('0x50')]({'plain':!![]});var _0x3208ee='Templates';return db[_0x2593('0x53')]['find']({'where':{'name':_0x3208ee,'userProfileId':_0x462088[_0x2593('0x54')]},'raw':!![]})[_0x2593('0x26')](function(_0x5d675f){if(_0x5d675f&&_0x5d675f[_0x2593('0x55')]===0x0){return db['UserProfileResource'][_0x2593('0x4e')]({'name':_0x202d47[_0x2593('0x2c')],'resourceId':_0x202d47['id'],'type':_0x5d675f[_0x2593('0x2c')],'sectionId':_0x5d675f['id']},{})['then'](function(){return _0x22165b;});}else{return _0x22165b;}})['catch'](function(_0x33b3c5){logger[_0x2593('0x56')](_0x2593('0x57'),_0x33b3c5);throw _0x33b3c5;});}return _0x22165b;})[_0x2593('0x26')](respondWithResult(_0x2b29f1,0xc9))['catch'](handleError(_0x2b29f1,null));};exports[_0x2593('0x25')]=function(_0x2e40f4,_0x5d3739){if(_0x2e40f4['body']['id']){delete _0x2e40f4[_0x2593('0x4f')]['id'];}return db[_0x2593('0x30')][_0x2593('0x4d')]({'where':{'id':_0x2e40f4[_0x2593('0x49')]['id']}})[_0x2593('0x26')](handleEntityNotFound(_0x5d3739,null))[_0x2593('0x26')](saveUpdates(_0x2e40f4[_0x2593('0x4f')],null))[_0x2593('0x26')](respondWithResult(_0x5d3739,null))[_0x2593('0x47')](handleError(_0x5d3739,null));};exports[_0x2593('0x27')]=function(_0x172a9d,_0x10fce3){return db['Template'][_0x2593('0x4d')]({'where':{'id':_0x172a9d['params']['id']}})['then'](handleEntityNotFound(_0x10fce3,null))['then'](removeEntity(_0x10fce3,null))[_0x2593('0x47')](handleError(_0x10fce3,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 0faa206..1151efa 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 _0xace2=['rimraf','../../config/environment','exports','define','Template','tools_templates','lodash','util','api','moment','path'];(function(_0x390421,_0x2c96aa){var _0x5677a8=function(_0x6fe03b){while(--_0x6fe03b){_0x390421['push'](_0x390421['shift']());}};_0x5677a8(++_0x2c96aa);}(_0xace2,0x10e));var _0x2ace=function(_0x7185f7,_0x37065){_0x7185f7=_0x7185f7-0x0;var _0x182e45=_0xace2[_0x7185f7];return _0x182e45;};'use strict';var _=require(_0x2ace('0x0'));var util=require(_0x2ace('0x1'));var logger=require('../../config/logger')(_0x2ace('0x2'));var moment=require(_0x2ace('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ace('0x4'));var rimraf=require(_0x2ace('0x5'));var config=require(_0x2ace('0x6'));var attributes=require('./template.attributes');module[_0x2ace('0x7')]=function(_0x420093,_0x1d959f){return _0x420093[_0x2ace('0x8')](_0x2ace('0x9'),attributes,{'tableName':_0x2ace('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41aa=['util','moment','bluebird','request-promise','path','../../config/environment','./template.attributes','exports','tools_templates','lodash'];(function(_0x53f04f,_0x419aa8){var _0x16a824=function(_0x5712c9){while(--_0x5712c9){_0x53f04f['push'](_0x53f04f['shift']());}};_0x16a824(++_0x419aa8);}(_0x41aa,0x135));var _0xa41a=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x41aa[_0x48d6a3];return _0x38bfa0;};'use strict';var _=require(_0xa41a('0x0'));var util=require(_0xa41a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa41a('0x2'));var BPromise=require(_0xa41a('0x3'));var rp=require(_0xa41a('0x4'));var fs=require('fs');var path=require(_0xa41a('0x5'));var rimraf=require('rimraf');var config=require(_0xa41a('0x6'));var attributes=require(_0xa41a('0x7'));module[_0xa41a('0x8')]=function(_0x113831,_0xd499f0){return _0x113831['define']('Template',attributes,{'tableName':_0xa41a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 5c97427..9a94777 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 _0x5eee=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetTemplate','Template','options','raw','attributes','include','map','model','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5eee,0xb9));var _0xe5ee=function(_0x292c76,_0x23cd33){_0x292c76=_0x292c76-0x0;var _0x45c83a=_0x5eee[_0x292c76];return _0x45c83a;};'use strict';var _=require(_0xe5ee('0x0'));var util=require(_0xe5ee('0x1'));var moment=require(_0xe5ee('0x2'));var BPromise=require(_0xe5ee('0x3'));var rs=require(_0xe5ee('0x4'));var fs=require('fs');var Redis=require(_0xe5ee('0x5'));var db=require(_0xe5ee('0x6'))['db'];var utils=require(_0xe5ee('0x7'));var logger=require(_0xe5ee('0x8'))(_0xe5ee('0x9'));var config=require('../../config/environment');var jayson=require(_0xe5ee('0xa'));var client=jayson[_0xe5ee('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fd32f,_0x1ca5fa,_0x36fb6d){return new BPromise(function(_0x1a5ec9,_0x55b49a){return client['request'](_0x4fd32f,_0x36fb6d)[_0xe5ee('0xc')](function(_0x200f3e){logger['info'](_0xe5ee('0xd'),_0x1ca5fa,_0xe5ee('0xe'));logger[_0xe5ee('0xf')](_0xe5ee('0x10'),_0x1ca5fa,'request\x20sent',JSON[_0xe5ee('0x11')](_0x200f3e));if(_0x200f3e[_0xe5ee('0x12')]){if(_0x200f3e['error']['code']===0x1f4){logger['error'](_0xe5ee('0xd'),_0x1ca5fa,_0x200f3e['error']['message']);return _0x55b49a(_0x200f3e[_0xe5ee('0x12')][_0xe5ee('0x13')]);}logger[_0xe5ee('0x12')](_0xe5ee('0xd'),_0x1ca5fa,_0x200f3e['error']['message']);return _0x1a5ec9(_0x200f3e[_0xe5ee('0x12')][_0xe5ee('0x13')]);}else{logger[_0xe5ee('0x14')](_0xe5ee('0xd'),_0x1ca5fa,_0xe5ee('0xe'));_0x1a5ec9(_0x200f3e[_0xe5ee('0x15')][_0xe5ee('0x13')]);}})[_0xe5ee('0x16')](function(_0x1102a6){logger['error'](_0xe5ee('0xd'),_0x1ca5fa,_0x1102a6);_0x55b49a(_0x1102a6);});});}exports[_0xe5ee('0x17')]=function(_0x1cba2c){var _0x478c1d=this;return new Promise(function(_0x5bbf66,_0x4adf95){return db[_0xe5ee('0x18')]['findAll']({'raw':_0x1cba2c[_0xe5ee('0x19')]?_0x1cba2c[_0xe5ee('0x19')][_0xe5ee('0x1a')]===undefined?!![]:![]:!![],'where':_0x1cba2c['options']?_0x1cba2c[_0xe5ee('0x19')]['where']||null:null,'attributes':_0x1cba2c['options']?_0x1cba2c['options'][_0xe5ee('0x1b')]||null:null,'limit':_0x1cba2c[_0xe5ee('0x19')]?_0x1cba2c[_0xe5ee('0x19')]['limit']||null:null,'include':_0x1cba2c[_0xe5ee('0x19')]?_0x1cba2c['options'][_0xe5ee('0x1c')]?_[_0xe5ee('0x1d')](_0x1cba2c[_0xe5ee('0x19')][_0xe5ee('0x1c')],function(_0x348084){return{'model':db[_0x348084[_0xe5ee('0x1e')]],'as':_0x348084['as'],'attributes':_0x348084['attributes'],'include':_0x348084[_0xe5ee('0x1c')]?_[_0xe5ee('0x1d')](_0x348084[_0xe5ee('0x1c')],function(_0x5cbe64){return{'model':db[_0x5cbe64[_0xe5ee('0x1e')]],'as':_0x5cbe64['as'],'attributes':_0x5cbe64[_0xe5ee('0x1b')],'include':_0x5cbe64[_0xe5ee('0x1c')]?_[_0xe5ee('0x1d')](_0x5cbe64[_0xe5ee('0x1c')],function(_0x330eb){return{'model':db[_0x330eb['model']],'as':_0x330eb['as'],'attributes':_0x330eb[_0xe5ee('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe5ee('0xc')](function(_0x25c988){logger[_0xe5ee('0x14')](_0xe5ee('0x17'),_0x1cba2c);logger[_0xe5ee('0xf')](_0xe5ee('0x17'),_0x1cba2c,JSON[_0xe5ee('0x11')](_0x25c988));_0x5bbf66(_0x25c988);})[_0xe5ee('0x16')](function(_0x206ab7){logger[_0xe5ee('0x12')]('GetTemplate',_0x206ab7[_0xe5ee('0x13')],_0x1cba2c);_0x4adf95(_0x478c1d[_0xe5ee('0x12')](0x1f4,_0x206ab7['message']));});});}; \ No newline at end of file +var _0x552c=['request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Template','findAll','options','where','attributes','limit','include','map','model','GetTemplate','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s'];(function(_0x6e9b19,_0x3f9a2f){var _0x2ae93c=function(_0x1cc9c1){while(--_0x1cc9c1){_0x6e9b19['push'](_0x6e9b19['shift']());}};_0x2ae93c(++_0x3f9a2f);}(_0x552c,0xd2));var _0xc552=function(_0x46437e,_0x20c7d8){_0x46437e=_0x46437e-0x0;var _0x1189bd=_0x552c[_0x46437e];return _0x1189bd;};'use strict';var _=require(_0xc552('0x0'));var util=require(_0xc552('0x1'));var moment=require(_0xc552('0x2'));var BPromise=require(_0xc552('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc552('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc552('0x5'))(_0xc552('0x6'));var config=require(_0xc552('0x7'));var jayson=require(_0xc552('0x8'));var client=jayson[_0xc552('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1196c5,_0x3c96ac,_0xccf6ba){return new BPromise(function(_0x3e2a13,_0x2d92a8){return client[_0xc552('0xa')](_0x1196c5,_0xccf6ba)[_0xc552('0xb')](function(_0x419fd0){logger[_0xc552('0xc')](_0xc552('0xd'),_0x3c96ac,_0xc552('0xe'));logger[_0xc552('0xf')](_0xc552('0x10'),_0x3c96ac,_0xc552('0xe'),JSON[_0xc552('0x11')](_0x419fd0));if(_0x419fd0[_0xc552('0x12')]){if(_0x419fd0[_0xc552('0x12')]['code']===0x1f4){logger[_0xc552('0x12')](_0xc552('0xd'),_0x3c96ac,_0x419fd0['error']['message']);return _0x2d92a8(_0x419fd0[_0xc552('0x12')][_0xc552('0x13')]);}logger[_0xc552('0x12')](_0xc552('0xd'),_0x3c96ac,_0x419fd0[_0xc552('0x12')][_0xc552('0x13')]);return _0x3e2a13(_0x419fd0[_0xc552('0x12')][_0xc552('0x13')]);}else{logger[_0xc552('0xc')](_0xc552('0xd'),_0x3c96ac,_0xc552('0xe'));_0x3e2a13(_0x419fd0[_0xc552('0x14')][_0xc552('0x13')]);}})[_0xc552('0x15')](function(_0x4eaa9a){logger[_0xc552('0x12')]('Template,\x20%s,\x20%s',_0x3c96ac,_0x4eaa9a);_0x2d92a8(_0x4eaa9a);});});}exports['GetTemplate']=function(_0x306786){var _0x196421=this;return new Promise(function(_0x3360d6,_0x454a84){return db[_0xc552('0x16')][_0xc552('0x17')]({'raw':_0x306786[_0xc552('0x18')]?_0x306786[_0xc552('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x306786[_0xc552('0x18')]?_0x306786[_0xc552('0x18')][_0xc552('0x19')]||null:null,'attributes':_0x306786[_0xc552('0x18')]?_0x306786[_0xc552('0x18')][_0xc552('0x1a')]||null:null,'limit':_0x306786[_0xc552('0x18')]?_0x306786[_0xc552('0x18')][_0xc552('0x1b')]||null:null,'include':_0x306786[_0xc552('0x18')]?_0x306786[_0xc552('0x18')][_0xc552('0x1c')]?_[_0xc552('0x1d')](_0x306786[_0xc552('0x18')][_0xc552('0x1c')],function(_0x1bf060){return{'model':db[_0x1bf060[_0xc552('0x1e')]],'as':_0x1bf060['as'],'attributes':_0x1bf060[_0xc552('0x1a')],'include':_0x1bf060['include']?_[_0xc552('0x1d')](_0x1bf060[_0xc552('0x1c')],function(_0x4e0ae7){return{'model':db[_0x4e0ae7[_0xc552('0x1e')]],'as':_0x4e0ae7['as'],'attributes':_0x4e0ae7[_0xc552('0x1a')],'include':_0x4e0ae7[_0xc552('0x1c')]?_[_0xc552('0x1d')](_0x4e0ae7[_0xc552('0x1c')],function(_0x46ff1c){return{'model':db[_0x46ff1c[_0xc552('0x1e')]],'as':_0x46ff1c['as'],'attributes':_0x46ff1c[_0xc552('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc552('0xb')](function(_0x12cfab){logger[_0xc552('0xc')](_0xc552('0x1f'),_0x306786);logger[_0xc552('0xf')](_0xc552('0x1f'),_0x306786,JSON[_0xc552('0x11')](_0x12cfab));_0x3360d6(_0x12cfab);})[_0xc552('0x15')](function(_0x19a088){logger[_0xc552('0x12')](_0xc552('0x1f'),_0x19a088[_0xc552('0x13')],_0x306786);_0x454a84(_0x196421['error'](0x1f4,_0x19a088[_0xc552('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 7b6caf3..8cae5d5 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 _0x6fd6=['fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/any_conditions','getAnyConditions','getActions','create','post','/:id/all_conditions','addAllCondition','addAnyCondition','/:id/actions','addAction','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6fd6,0x86));var _0x66fd=function(_0x32aac1,_0x40b7b4){_0x32aac1=_0x32aac1-0x0;var _0x3d25b1=_0x6fd6[_0x32aac1];return _0x3d25b1;};'use strict';var multer=require(_0x66fd('0x0'));var util=require(_0x66fd('0x1'));var path=require(_0x66fd('0x2'));var timeout=require(_0x66fd('0x3'));var express=require(_0x66fd('0x4'));var router=express[_0x66fd('0x5')]();var fs_extra=require(_0x66fd('0x6'));var auth=require(_0x66fd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x66fd('0x8'));var controller=require(_0x66fd('0x9'));router[_0x66fd('0xa')]('/',auth[_0x66fd('0xb')](),controller[_0x66fd('0xc')]);router[_0x66fd('0xa')](_0x66fd('0xd'),auth[_0x66fd('0xb')](),controller[_0x66fd('0xe')]);router['get']('/:id/all_conditions',auth[_0x66fd('0xb')](),controller['getAllConditions']);router['get'](_0x66fd('0xf'),auth[_0x66fd('0xb')](),controller[_0x66fd('0x10')]);router[_0x66fd('0xa')]('/:id/actions',auth[_0x66fd('0xb')](),controller[_0x66fd('0x11')]);router['post']('/',auth[_0x66fd('0xb')](),controller[_0x66fd('0x12')]);router[_0x66fd('0x13')](_0x66fd('0x14'),auth[_0x66fd('0xb')](),controller[_0x66fd('0x15')]);router[_0x66fd('0x13')](_0x66fd('0xf'),auth[_0x66fd('0xb')](),controller[_0x66fd('0x16')]);router[_0x66fd('0x13')](_0x66fd('0x17'),auth[_0x66fd('0xb')](),controller[_0x66fd('0x18')]);router['put']('/:id',auth[_0x66fd('0xb')](),controller[_0x66fd('0x19')]);router['delete']('/:id',auth[_0x66fd('0xb')](),controller[_0x66fd('0x1a')]);module[_0x66fd('0x1b')]=router; \ No newline at end of file +var _0xc3ed=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','put','update','destroy','exports','multer','util'];(function(_0x166f43,_0x3bc8cb){var _0x43ae50=function(_0x5c562){while(--_0x5c562){_0x166f43['push'](_0x166f43['shift']());}};_0x43ae50(++_0x3bc8cb);}(_0xc3ed,0x111));var _0xdc3e=function(_0x29c708,_0x86df4f){_0x29c708=_0x29c708-0x0;var _0x18e405=_0xc3ed[_0x29c708];return _0x18e405;};'use strict';var multer=require(_0xdc3e('0x0'));var util=require(_0xdc3e('0x1'));var path=require('path');var timeout=require(_0xdc3e('0x2'));var express=require(_0xdc3e('0x3'));var router=express[_0xdc3e('0x4')]();var fs_extra=require(_0xdc3e('0x5'));var auth=require(_0xdc3e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdc3e('0x7'));var controller=require('./trigger.controller');router[_0xdc3e('0x8')]('/',auth[_0xdc3e('0x9')](),controller[_0xdc3e('0xa')]);router[_0xdc3e('0x8')](_0xdc3e('0xb'),auth[_0xdc3e('0x9')](),controller[_0xdc3e('0xc')]);router[_0xdc3e('0x8')](_0xdc3e('0xd'),auth[_0xdc3e('0x9')](),controller[_0xdc3e('0xe')]);router[_0xdc3e('0x8')](_0xdc3e('0xf'),auth[_0xdc3e('0x9')](),controller[_0xdc3e('0x10')]);router[_0xdc3e('0x8')](_0xdc3e('0x11'),auth['isAuthenticated'](),controller[_0xdc3e('0x12')]);router[_0xdc3e('0x13')]('/',auth[_0xdc3e('0x9')](),controller['create']);router[_0xdc3e('0x13')]('/:id/all_conditions',auth[_0xdc3e('0x9')](),controller[_0xdc3e('0x14')]);router['post']('/:id/any_conditions',auth[_0xdc3e('0x9')](),controller['addAnyCondition']);router[_0xdc3e('0x13')](_0xdc3e('0x11'),auth[_0xdc3e('0x9')](),controller['addAction']);router[_0xdc3e('0x15')](_0xdc3e('0xb'),auth[_0xdc3e('0x9')](),controller[_0xdc3e('0x16')]);router['delete'](_0xdc3e('0xb'),auth[_0xdc3e('0x9')](),controller[_0xdc3e('0x17')]);module[_0xdc3e('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 086d996..0a9dc16 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 _0x5f71=['STRING','BOOLEAN','sequelize','exports'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x5f71,0xde));var _0x15f7=function(_0x5a075a,_0x3e73c1){_0x5a075a=_0x5a075a-0x0;var _0x240550=_0x5f71[_0x5a075a];return _0x240550;};'use strict';var Sequelize=require(_0x15f7('0x0'));module[_0x15f7('0x1')]={'name':{'type':Sequelize[_0x15f7('0x2')]},'channel':{'type':Sequelize[_0x15f7('0x2')]},'description':{'type':Sequelize[_0x15f7('0x2')]},'status':{'type':Sequelize[_0x15f7('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3482=['STRING','BOOLEAN','sequelize'];(function(_0x244339,_0x43f890){var _0x3210bd=function(_0x50410a){while(--_0x50410a){_0x244339['push'](_0x244339['shift']());}};_0x3210bd(++_0x43f890);}(_0x3482,0x9e));var _0x2348=function(_0x35d9d6,_0x2a4184){_0x35d9d6=_0x35d9d6-0x0;var _0x5d8371=_0x3482[_0x35d9d6];return _0x5d8371;};'use strict';var Sequelize=require(_0x2348('0x0'));module['exports']={'name':{'type':Sequelize[_0x2348('0x1')]},'channel':{'type':Sequelize[_0x2348('0x1')]},'description':{'type':Sequelize[_0x2348('0x1')]},'status':{'type':Sequelize[_0x2348('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 9fe22c4..de86c35 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 _0xf108=['params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','length','getAllConditions','getAnyConditions','order','nolimit','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','get','Triggers','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','include','find','create','body','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xf108,0x1cd));var _0x8f10=function(_0xb0dfae,_0x226e4e){_0xb0dfae=_0xb0dfae-0x0;var _0x382016=_0xf108[_0xb0dfae];return _0x382016;};'use strict';var emlformat=require(_0x8f10('0x0'));var rimraf=require(_0x8f10('0x1'));var zipdir=require(_0x8f10('0x2'));var jsonpatch=require(_0x8f10('0x3'));var rp=require(_0x8f10('0x4'));var moment=require(_0x8f10('0x5'));var BPromise=require(_0x8f10('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8f10('0x7'));var sox=require(_0x8f10('0x8'));var csv=require(_0x8f10('0x9'));var ejs=require(_0x8f10('0xa'));var fs=require('fs');var fs_extra=require(_0x8f10('0xb'));var _=require(_0x8f10('0xc'));var squel=require(_0x8f10('0xd'));var crypto=require(_0x8f10('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8f10('0xf'));var toCsv=require(_0x8f10('0x9'));var querystring=require(_0x8f10('0x10'));var Papa=require('papaparse');var Redis=require(_0x8f10('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8f10('0x12'));var as=require(_0x8f10('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8f10('0x14'));var utils=require('../../config/utils');var config=require(_0x8f10('0x15'));var licenseUtil=require(_0x8f10('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bc458,_0x4158dc){_0x4158dc=_0x4158dc||0xcc;return function(_0x10c2e4){if(_0x10c2e4){return _0x1bc458[_0x8f10('0x17')](_0x4158dc);}return _0x1bc458[_0x8f10('0x18')](_0x4158dc)['end']();};}function respondWithResult(_0x34cf04,_0x595221){_0x595221=_0x595221||0xc8;return function(_0x2bfa06){if(_0x2bfa06){return _0x34cf04[_0x8f10('0x18')](_0x595221)[_0x8f10('0x19')](_0x2bfa06);}};}function respondWithFilteredResult(_0x2ae6df,_0x1817e){return function(_0x983b4){if(_0x983b4){var _0xf655e0=typeof _0x1817e['offset']===_0x8f10('0x1a')&&typeof _0x1817e[_0x8f10('0x1b')]===_0x8f10('0x1a');var _0x4b864a=_0x983b4[_0x8f10('0x1c')];var _0x3d0cfc=_0xf655e0?0x0:_0x1817e[_0x8f10('0x1d')];var _0x5b27db=_0xf655e0?_0x983b4[_0x8f10('0x1c')]:_0x1817e['offset']+_0x1817e[_0x8f10('0x1b')];var _0x15e337;if(_0x5b27db>=_0x4b864a){_0x5b27db=_0x4b864a;_0x15e337=0xc8;}else{_0x15e337=0xce;}_0x2ae6df[_0x8f10('0x18')](_0x15e337);return _0x2ae6df[_0x8f10('0x1e')](_0x8f10('0x1f'),_0x3d0cfc+'-'+_0x5b27db+'/'+_0x4b864a)['json'](_0x983b4);}return null;};}function patchUpdates(_0x2f5c10){return function(_0x164c91){try{jsonpatch['apply'](_0x164c91,_0x2f5c10,!![]);}catch(_0x2888cf){return BPromise['reject'](_0x2888cf);}return _0x164c91['save']();};}function saveUpdates(_0x3e916a,_0x35f990){return function(_0x314613){if(_0x314613){return _0x314613[_0x8f10('0x20')](_0x3e916a)[_0x8f10('0x21')](function(_0x27fd49){return _0x27fd49;});}return null;};}function removeEntity(_0x23d7e8,_0x7cb15f){return function(_0x4eb9){if(_0x4eb9){return _0x4eb9[_0x8f10('0x22')]()[_0x8f10('0x21')](function(){var _0x31fd1d=_0x4eb9[_0x8f10('0x23')]({'plain':!![]});var _0x2537e2=_0x8f10('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x2537e2,'resourceId':_0x31fd1d['id']}})[_0x8f10('0x21')](function(){return _0x4eb9;});})['then'](function(){_0x23d7e8[_0x8f10('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b5c20,_0x540dae){return function(_0x2f11bc){if(!_0x2f11bc){_0x4b5c20['sendStatus'](0x194);}return _0x2f11bc;};}function handleError(_0x2dd999,_0x3dcba1){_0x3dcba1=_0x3dcba1||0x1f4;return function(_0x5ef125){logger[_0x8f10('0x25')](_0x5ef125[_0x8f10('0x26')]);if(_0x5ef125[_0x8f10('0x27')]){delete _0x5ef125['name'];}_0x2dd999['status'](_0x3dcba1)[_0x8f10('0x28')](_0x5ef125);};}exports[_0x8f10('0x29')]=function(_0x52ee1f,_0x580b4d){var _0x453d84={},_0x23eb38={},_0x22689b={'count':0x0,'rows':[]};var _0xe7a283=_[_0x8f10('0x2a')](db[_0x8f10('0x2b')][_0x8f10('0x2c')],function(_0x52a94c){return{'name':_0x52a94c[_0x8f10('0x2d')],'type':_0x52a94c['type'][_0x8f10('0x2e')]};});_0x23eb38[_0x8f10('0x2f')]=_[_0x8f10('0x2a')](_0xe7a283,'name');_0x23eb38[_0x8f10('0x30')]=_[_0x8f10('0x31')](_0x52ee1f[_0x8f10('0x30')]);_0x23eb38['filters']=_[_0x8f10('0x32')](_0x23eb38[_0x8f10('0x2f')],_0x23eb38[_0x8f10('0x30')]);_0x453d84[_0x8f10('0x33')]=_[_0x8f10('0x32')](_0x23eb38[_0x8f10('0x2f')],qs['fields'](_0x52ee1f[_0x8f10('0x30')][_0x8f10('0x34')]));_0x453d84['attributes']=_0x453d84[_0x8f10('0x33')]['length']?_0x453d84[_0x8f10('0x33')]:_0x23eb38[_0x8f10('0x2f')];if(!_0x52ee1f[_0x8f10('0x30')][_0x8f10('0x35')]('nolimit')){_0x453d84[_0x8f10('0x1b')]=qs['limit'](_0x52ee1f['query'][_0x8f10('0x1b')]);_0x453d84[_0x8f10('0x1d')]=qs[_0x8f10('0x1d')](_0x52ee1f['query'][_0x8f10('0x1d')]);}_0x453d84['order']=qs[_0x8f10('0x36')](_0x52ee1f[_0x8f10('0x30')]['sort']);_0x453d84[_0x8f10('0x37')]=qs[_0x8f10('0x38')](_[_0x8f10('0x39')](_0x52ee1f[_0x8f10('0x30')],_0x23eb38[_0x8f10('0x38')]),_0xe7a283);if(_0x52ee1f['query'][_0x8f10('0x3a')]){_0x453d84[_0x8f10('0x37')]=_[_0x8f10('0x3b')](_0x453d84[_0x8f10('0x37')],{'$or':_[_0x8f10('0x2a')](_0xe7a283,function(_0x5305d5){if(_0x5305d5[_0x8f10('0x3c')]!==_0x8f10('0x3d')){var _0x2e6e27={};_0x2e6e27[_0x5305d5[_0x8f10('0x27')]]={'$like':'%'+_0x52ee1f[_0x8f10('0x30')][_0x8f10('0x3a')]+'%'};return _0x2e6e27;}})});}_0x453d84=_[_0x8f10('0x3b')]({},_0x453d84,_0x52ee1f[_0x8f10('0x3e')]);var _0x5c830e={'where':_0x453d84[_0x8f10('0x37')]};return db[_0x8f10('0x2b')][_0x8f10('0x1c')](_0x5c830e)[_0x8f10('0x21')](function(_0x5c4368){_0x22689b[_0x8f10('0x1c')]=_0x5c4368;if(_0x52ee1f[_0x8f10('0x30')][_0x8f10('0x3f')]){_0x453d84['include']=[{'all':!![]}];}return db[_0x8f10('0x2b')]['findAll'](_0x453d84);})[_0x8f10('0x21')](function(_0x41df69){_0x22689b[_0x8f10('0x40')]=_0x41df69;return _0x22689b;})['then'](respondWithFilteredResult(_0x580b4d,_0x453d84))[_0x8f10('0x41')](handleError(_0x580b4d,null));};exports['show']=function(_0x28f134,_0x22e02e){var _0x25349e={'raw':![],'where':{'id':_0x28f134['params']['id']}},_0xedfe9c={};_0xedfe9c[_0x8f10('0x2f')]=_[_0x8f10('0x31')](db[_0x8f10('0x2b')][_0x8f10('0x2c')]);_0xedfe9c['query']=_[_0x8f10('0x31')](_0x28f134[_0x8f10('0x30')]);_0xedfe9c[_0x8f10('0x38')]=_[_0x8f10('0x32')](_0xedfe9c[_0x8f10('0x2f')],_0xedfe9c[_0x8f10('0x30')]);_0x25349e['attributes']=_[_0x8f10('0x32')](_0xedfe9c[_0x8f10('0x2f')],qs[_0x8f10('0x34')](_0x28f134[_0x8f10('0x30')][_0x8f10('0x34')]));_0x25349e[_0x8f10('0x33')]=_0x25349e[_0x8f10('0x33')]['length']?_0x25349e['attributes']:_0xedfe9c[_0x8f10('0x2f')];if(_0x28f134[_0x8f10('0x30')][_0x8f10('0x3f')]){_0x25349e[_0x8f10('0x42')]=[{'all':!![]}];}_0x25349e=_[_0x8f10('0x3b')]({},_0x25349e,_0x28f134['options']);return db[_0x8f10('0x2b')][_0x8f10('0x43')](_0x25349e)[_0x8f10('0x21')](handleEntityNotFound(_0x22e02e,null))[_0x8f10('0x21')](respondWithResult(_0x22e02e,null))[_0x8f10('0x41')](handleError(_0x22e02e,null));};exports[_0x8f10('0x44')]=function(_0x4f81ab,_0x49d013){return db['Trigger']['create'](_0x4f81ab[_0x8f10('0x45')],{})[_0x8f10('0x21')](function(_0x262636){var _0x378084=_0x4f81ab[_0x8f10('0x46')][_0x8f10('0x23')]({'plain':!![]});if(!_0x378084)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378084['role']===_0x8f10('0x46')){var _0x242b37=_0x262636[_0x8f10('0x23')]({'plain':!![]});var _0x1c9843='Triggers';return db[_0x8f10('0x47')]['find']({'where':{'name':_0x1c9843,'userProfileId':_0x378084['userProfileId']},'raw':!![]})[_0x8f10('0x21')](function(_0x2bf1a1){if(_0x2bf1a1&&_0x2bf1a1['autoAssociation']===0x0){return db['UserProfileResource'][_0x8f10('0x44')]({'name':_0x242b37[_0x8f10('0x27')],'resourceId':_0x242b37['id'],'type':_0x2bf1a1[_0x8f10('0x27')],'sectionId':_0x2bf1a1['id']},{})[_0x8f10('0x21')](function(){return _0x262636;});}else{return _0x262636;}})[_0x8f10('0x41')](function(_0x4a712d){logger['error'](_0x8f10('0x48'),_0x4a712d);throw _0x4a712d;});}return _0x262636;})[_0x8f10('0x21')](respondWithResult(_0x49d013,0xc9))[_0x8f10('0x41')](handleError(_0x49d013,null));};exports['update']=function(_0x30be68,_0x523d56){if(_0x30be68['body']['id']){delete _0x30be68[_0x8f10('0x45')]['id'];}return db['Trigger'][_0x8f10('0x43')]({'where':{'id':_0x30be68[_0x8f10('0x49')]['id']}})[_0x8f10('0x21')](handleEntityNotFound(_0x523d56,null))[_0x8f10('0x21')](saveUpdates(_0x30be68['body'],null))[_0x8f10('0x21')](respondWithResult(_0x523d56,null))[_0x8f10('0x41')](handleError(_0x523d56,null));};exports[_0x8f10('0x22')]=function(_0x499835,_0x289b51){return db[_0x8f10('0x2b')][_0x8f10('0x43')]({'where':{'id':_0x499835[_0x8f10('0x49')]['id']}})['then'](handleEntityNotFound(_0x289b51,null))[_0x8f10('0x21')](removeEntity(_0x289b51,null))[_0x8f10('0x41')](handleError(_0x289b51,null));};exports[_0x8f10('0x4a')]=function(_0x21a594,_0x1900b9,_0x20035d){if(_0x21a594[_0x8f10('0x45')]['id']){delete _0x21a594['body']['id'];}return db['Trigger'][_0x8f10('0x43')]({'where':{'id':_0x21a594[_0x8f10('0x49')]['id']}})[_0x8f10('0x21')](handleEntityNotFound(_0x1900b9,null))[_0x8f10('0x21')](function(_0x5b3d3a){if(_0x5b3d3a){_0x21a594[_0x8f10('0x45')][_0x8f10('0x4b')]=_0x5b3d3a['id'];return db[_0x8f10('0x4c')][_0x8f10('0x44')](_0x21a594[_0x8f10('0x45')]);}})['then'](respondWithResult(_0x1900b9,null))[_0x8f10('0x41')](handleError(_0x1900b9,null));};exports[_0x8f10('0x4d')]=function(_0x3d21e8,_0x411fde,_0x5cd2ee){if(_0x3d21e8[_0x8f10('0x45')]['id']){delete _0x3d21e8['body']['id'];}return db[_0x8f10('0x2b')]['find']({'where':{'id':_0x3d21e8[_0x8f10('0x49')]['id']}})[_0x8f10('0x21')](handleEntityNotFound(_0x411fde,null))[_0x8f10('0x21')](function(_0x53305d){if(_0x53305d){_0x3d21e8[_0x8f10('0x45')][_0x8f10('0x4e')]=_0x53305d['id'];return db[_0x8f10('0x4c')][_0x8f10('0x44')](_0x3d21e8[_0x8f10('0x45')]);}})[_0x8f10('0x21')](respondWithResult(_0x411fde,null))[_0x8f10('0x41')](handleError(_0x411fde,null));};exports['getAllConditions']=function(_0x51d038,_0x44c1e9,_0x5524da){var _0x5f1f57={};var _0x25116f={};var _0x170143;var _0x27f235;return db['Trigger'][_0x8f10('0x4f')]({'where':{'id':_0x51d038[_0x8f10('0x49')]['id']}})[_0x8f10('0x21')](handleEntityNotFound(_0x44c1e9,null))[_0x8f10('0x21')](function(_0x49f250){if(_0x49f250){_0x170143=_0x49f250;_0x25116f[_0x8f10('0x2f')]=_[_0x8f10('0x31')](db['Condition'][_0x8f10('0x2c')]);_0x25116f[_0x8f10('0x30')]=_[_0x8f10('0x31')](_0x51d038[_0x8f10('0x30')]);_0x25116f['filters']=_['intersection'](_0x25116f[_0x8f10('0x2f')],_0x25116f[_0x8f10('0x30')]);_0x5f1f57[_0x8f10('0x33')]=_[_0x8f10('0x32')](_0x25116f[_0x8f10('0x2f')],qs['fields'](_0x51d038['query']['fields']));_0x5f1f57[_0x8f10('0x33')]=_0x5f1f57[_0x8f10('0x33')][_0x8f10('0x50')]?_0x5f1f57[_0x8f10('0x33')]:_0x25116f[_0x8f10('0x2f')];_0x5f1f57['order']=qs[_0x8f10('0x36')](_0x51d038[_0x8f10('0x30')][_0x8f10('0x36')]);_0x5f1f57['where']=qs[_0x8f10('0x38')](_[_0x8f10('0x39')](_0x51d038['query'],_0x25116f['filters']));if(_0x51d038[_0x8f10('0x30')][_0x8f10('0x3a')]){_0x5f1f57[_0x8f10('0x37')]=_['merge'](_0x5f1f57[_0x8f10('0x37')],{'$or':_[_0x8f10('0x2a')](_0x5f1f57['attributes'],function(_0x5d4d2f){var _0x55a526={};_0x55a526[_0x5d4d2f]={'$like':'%'+_0x51d038[_0x8f10('0x30')][_0x8f10('0x3a')]+'%'};return _0x55a526;})});}_0x5f1f57=_['merge']({},_0x5f1f57,_0x51d038[_0x8f10('0x3e')]);return _0x170143[_0x8f10('0x51')](_0x5f1f57);}})[_0x8f10('0x21')](function(_0x47a0ac){if(_0x47a0ac){_0x27f235=_0x47a0ac['length'];if(!_0x51d038[_0x8f10('0x30')]['hasOwnProperty']('nolimit')){_0x5f1f57[_0x8f10('0x1b')]=qs[_0x8f10('0x1b')](_0x51d038['query']['limit']);_0x5f1f57[_0x8f10('0x1d')]=qs[_0x8f10('0x1d')](_0x51d038[_0x8f10('0x30')][_0x8f10('0x1d')]);}return _0x170143['getAllConditions'](_0x5f1f57);}})['then'](function(_0xe62738){if(_0xe62738){return _0xe62738?{'count':_0x27f235,'rows':_0xe62738}:null;}})[_0x8f10('0x21')](respondWithResult(_0x44c1e9,null))[_0x8f10('0x41')](handleError(_0x44c1e9,null));};exports[_0x8f10('0x52')]=function(_0x1759f9,_0x13c788,_0x2ec9ff){var _0x46e4d6={};var _0x45004a={};var _0x434032;var _0x135a0a;return db['Trigger'][_0x8f10('0x4f')]({'where':{'id':_0x1759f9[_0x8f10('0x49')]['id']}})[_0x8f10('0x21')](handleEntityNotFound(_0x13c788,null))[_0x8f10('0x21')](function(_0x403e6f){if(_0x403e6f){_0x434032=_0x403e6f;_0x45004a['model']=_[_0x8f10('0x31')](db[_0x8f10('0x4c')]['rawAttributes']);_0x45004a[_0x8f10('0x30')]=_[_0x8f10('0x31')](_0x1759f9[_0x8f10('0x30')]);_0x45004a[_0x8f10('0x38')]=_[_0x8f10('0x32')](_0x45004a[_0x8f10('0x2f')],_0x45004a[_0x8f10('0x30')]);_0x46e4d6[_0x8f10('0x33')]=_[_0x8f10('0x32')](_0x45004a[_0x8f10('0x2f')],qs['fields'](_0x1759f9['query'][_0x8f10('0x34')]));_0x46e4d6[_0x8f10('0x33')]=_0x46e4d6[_0x8f10('0x33')][_0x8f10('0x50')]?_0x46e4d6[_0x8f10('0x33')]:_0x45004a[_0x8f10('0x2f')];_0x46e4d6[_0x8f10('0x53')]=qs[_0x8f10('0x36')](_0x1759f9['query']['sort']);_0x46e4d6[_0x8f10('0x37')]=qs[_0x8f10('0x38')](_[_0x8f10('0x39')](_0x1759f9['query'],_0x45004a[_0x8f10('0x38')]));if(_0x1759f9[_0x8f10('0x30')]['filter']){_0x46e4d6[_0x8f10('0x37')]=_['merge'](_0x46e4d6[_0x8f10('0x37')],{'$or':_['map'](_0x46e4d6['attributes'],function(_0x52feb9){var _0x135378={};_0x135378[_0x52feb9]={'$like':'%'+_0x1759f9[_0x8f10('0x30')][_0x8f10('0x3a')]+'%'};return _0x135378;})});}_0x46e4d6=_['merge']({},_0x46e4d6,_0x1759f9[_0x8f10('0x3e')]);return _0x434032['getAnyConditions'](_0x46e4d6);}})[_0x8f10('0x21')](function(_0x1df02a){if(_0x1df02a){_0x135a0a=_0x1df02a[_0x8f10('0x50')];if(!_0x1759f9[_0x8f10('0x30')]['hasOwnProperty'](_0x8f10('0x54'))){_0x46e4d6[_0x8f10('0x1b')]=qs[_0x8f10('0x1b')](_0x1759f9[_0x8f10('0x30')][_0x8f10('0x1b')]);_0x46e4d6[_0x8f10('0x1d')]=qs[_0x8f10('0x1d')](_0x1759f9['query'][_0x8f10('0x1d')]);}return _0x434032[_0x8f10('0x52')](_0x46e4d6);}})[_0x8f10('0x21')](function(_0x3e64c7){if(_0x3e64c7){return _0x3e64c7?{'count':_0x135a0a,'rows':_0x3e64c7}:null;}})[_0x8f10('0x21')](respondWithResult(_0x13c788,null))[_0x8f10('0x41')](handleError(_0x13c788,null));};exports[_0x8f10('0x55')]=function(_0x551bd6,_0x5ce5cf,_0x31382c){if(_0x551bd6[_0x8f10('0x45')]['id']){delete _0x551bd6['body']['id'];}return db[_0x8f10('0x2b')][_0x8f10('0x43')]({'where':{'id':_0x551bd6['params']['id']}})[_0x8f10('0x21')](handleEntityNotFound(_0x5ce5cf,null))[_0x8f10('0x21')](function(_0x423048){if(_0x423048){_0x551bd6['body'][_0x8f10('0x56')]=_0x423048['id'];return db[_0x8f10('0x57')]['create'](_0x551bd6['body']);}})[_0x8f10('0x21')](respondWithResult(_0x5ce5cf,null))['catch'](handleError(_0x5ce5cf,null));};exports[_0x8f10('0x58')]=function(_0x32481e,_0x14c04d,_0x4b7a60){var _0x131b51={};var _0x17cc07={};var _0x2fca87;var _0x310760;return db['Trigger'][_0x8f10('0x4f')]({'where':{'id':_0x32481e[_0x8f10('0x49')]['id']}})['then'](handleEntityNotFound(_0x14c04d,null))[_0x8f10('0x21')](function(_0x412ce6){if(_0x412ce6){_0x2fca87=_0x412ce6;_0x17cc07[_0x8f10('0x2f')]=_['keys'](db['Action'][_0x8f10('0x2c')]);_0x17cc07[_0x8f10('0x30')]=_[_0x8f10('0x31')](_0x32481e[_0x8f10('0x30')]);_0x17cc07[_0x8f10('0x38')]=_[_0x8f10('0x32')](_0x17cc07[_0x8f10('0x2f')],_0x17cc07[_0x8f10('0x30')]);_0x131b51[_0x8f10('0x33')]=_[_0x8f10('0x32')](_0x17cc07['model'],qs[_0x8f10('0x34')](_0x32481e[_0x8f10('0x30')]['fields']));_0x131b51[_0x8f10('0x33')]=_0x131b51[_0x8f10('0x33')][_0x8f10('0x50')]?_0x131b51[_0x8f10('0x33')]:_0x17cc07['model'];_0x131b51[_0x8f10('0x53')]=qs[_0x8f10('0x36')](_0x32481e['query'][_0x8f10('0x36')]);_0x131b51[_0x8f10('0x37')]=qs['filters'](_[_0x8f10('0x39')](_0x32481e[_0x8f10('0x30')],_0x17cc07[_0x8f10('0x38')]));if(_0x32481e[_0x8f10('0x30')]['filter']){_0x131b51[_0x8f10('0x37')]=_['merge'](_0x131b51['where'],{'$or':_[_0x8f10('0x2a')](_0x131b51[_0x8f10('0x33')],function(_0x174e74){var _0x5ecb64={};_0x5ecb64[_0x174e74]={'$like':'%'+_0x32481e['query'][_0x8f10('0x3a')]+'%'};return _0x5ecb64;})});}_0x131b51=_['merge']({},_0x131b51,_0x32481e[_0x8f10('0x3e')]);return _0x2fca87[_0x8f10('0x58')](_0x131b51);}})[_0x8f10('0x21')](function(_0x15b82d){if(_0x15b82d){_0x310760=_0x15b82d['length'];if(!_0x32481e[_0x8f10('0x30')][_0x8f10('0x35')](_0x8f10('0x54'))){_0x131b51[_0x8f10('0x1b')]=qs['limit'](_0x32481e[_0x8f10('0x30')][_0x8f10('0x1b')]);_0x131b51[_0x8f10('0x1d')]=qs['offset'](_0x32481e['query'][_0x8f10('0x1d')]);}return _0x2fca87[_0x8f10('0x58')](_0x131b51);}})['then'](function(_0x5daf01){if(_0x5daf01){return _0x5daf01?{'count':_0x310760,'rows':_0x5daf01}:null;}})[_0x8f10('0x21')](respondWithResult(_0x14c04d,null))['catch'](handleError(_0x14c04d,null));}; \ No newline at end of file +var _0xb04e=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','body','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','Trigger','rawAttributes','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','user'];(function(_0x9f6556,_0x28414f){var _0x5ee21e=function(_0x337b35){while(--_0x337b35){_0x9f6556['push'](_0x9f6556['shift']());}};_0x5ee21e(++_0x28414f);}(_0xb04e,0x185));var _0xeb04=function(_0x18329c,_0x5804b7){_0x18329c=_0x18329c-0x0;var _0x19cbc5=_0xb04e[_0x18329c];return _0x19cbc5;};'use strict';var emlformat=require(_0xeb04('0x0'));var rimraf=require(_0xeb04('0x1'));var zipdir=require(_0xeb04('0x2'));var jsonpatch=require(_0xeb04('0x3'));var rp=require(_0xeb04('0x4'));var moment=require(_0xeb04('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xeb04('0x6'));var util=require(_0xeb04('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeb04('0x8'));var ejs=require(_0xeb04('0x9'));var fs=require('fs');var fs_extra=require(_0xeb04('0xa'));var _=require(_0xeb04('0xb'));var squel=require(_0xeb04('0xc'));var crypto=require(_0xeb04('0xd'));var jsforce=require(_0xeb04('0xe'));var deskjs=require(_0xeb04('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb04('0x10'));var Papa=require(_0xeb04('0x11'));var Redis=require(_0xeb04('0x12'));var authService=require(_0xeb04('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb04('0x14'));var hardwareService=require(_0xeb04('0x15'));var logger=require(_0xeb04('0x16'))(_0xeb04('0x17'));var utils=require(_0xeb04('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xeb04('0x19'));var db=require(_0xeb04('0x1a'))['db'];function respondWithStatusCode(_0x413d39,_0x45512a){_0x45512a=_0x45512a||0xcc;return function(_0x1affae){if(_0x1affae){return _0x413d39['sendStatus'](_0x45512a);}return _0x413d39[_0xeb04('0x1b')](_0x45512a)[_0xeb04('0x1c')]();};}function respondWithResult(_0x8aaa97,_0xfcf7ed){_0xfcf7ed=_0xfcf7ed||0xc8;return function(_0x43c44d){if(_0x43c44d){return _0x8aaa97[_0xeb04('0x1b')](_0xfcf7ed)[_0xeb04('0x1d')](_0x43c44d);}};}function respondWithFilteredResult(_0xa5ab17,_0x1ce32f){return function(_0x3c6960){if(_0x3c6960){var _0xb1e9cf=typeof _0x1ce32f[_0xeb04('0x1e')]===_0xeb04('0x1f')&&typeof _0x1ce32f[_0xeb04('0x20')]===_0xeb04('0x1f');var _0x472da9=_0x3c6960[_0xeb04('0x21')];var _0x442555=_0xb1e9cf?0x0:_0x1ce32f[_0xeb04('0x1e')];var _0x2f80a1=_0xb1e9cf?_0x3c6960['count']:_0x1ce32f[_0xeb04('0x1e')]+_0x1ce32f[_0xeb04('0x20')];var _0x25bec9;if(_0x2f80a1>=_0x472da9){_0x2f80a1=_0x472da9;_0x25bec9=0xc8;}else{_0x25bec9=0xce;}_0xa5ab17[_0xeb04('0x1b')](_0x25bec9);return _0xa5ab17['set'](_0xeb04('0x22'),_0x442555+'-'+_0x2f80a1+'/'+_0x472da9)[_0xeb04('0x1d')](_0x3c6960);}return null;};}function patchUpdates(_0x2925b9){return function(_0x30ba1b){try{jsonpatch[_0xeb04('0x23')](_0x30ba1b,_0x2925b9,!![]);}catch(_0xae52bc){return BPromise[_0xeb04('0x24')](_0xae52bc);}return _0x30ba1b['save']();};}function saveUpdates(_0x4b1cf8,_0x1d3376){return function(_0x21aec0){if(_0x21aec0){return _0x21aec0[_0xeb04('0x25')](_0x4b1cf8)[_0xeb04('0x26')](function(_0x413032){return _0x413032;});}return null;};}function removeEntity(_0x3567e4,_0x4dc02b){return function(_0x38e92e){if(_0x38e92e){return _0x38e92e[_0xeb04('0x27')]()[_0xeb04('0x26')](function(){var _0x4cea31=_0x38e92e['get']({'plain':!![]});var _0x231488='Triggers';return db['UserProfileResource']['destroy']({'where':{'type':_0x231488,'resourceId':_0x4cea31['id']}})['then'](function(){return _0x38e92e;});})[_0xeb04('0x26')](function(){_0x3567e4[_0xeb04('0x1b')](0xcc)[_0xeb04('0x1c')]();});}};}function handleEntityNotFound(_0x5370a4,_0x395052){return function(_0x2d9061){if(!_0x2d9061){_0x5370a4['sendStatus'](0x194);}return _0x2d9061;};}function handleError(_0x1a6418,_0x358578){_0x358578=_0x358578||0x1f4;return function(_0x5c0756){logger[_0xeb04('0x28')](_0x5c0756[_0xeb04('0x29')]);if(_0x5c0756[_0xeb04('0x2a')]){delete _0x5c0756[_0xeb04('0x2a')];}_0x1a6418[_0xeb04('0x1b')](_0x358578)[_0xeb04('0x2b')](_0x5c0756);};}exports['index']=function(_0x15d7e5,_0x5859c2){var _0x1fe452={},_0x2dae2c={},_0x405199={'count':0x0,'rows':[]};var _0x324585=_[_0xeb04('0x2c')](db[_0xeb04('0x2d')][_0xeb04('0x2e')],function(_0x253cbb){return{'name':_0x253cbb['fieldName'],'type':_0x253cbb['type'][_0xeb04('0x2f')]};});_0x2dae2c[_0xeb04('0x30')]=_[_0xeb04('0x2c')](_0x324585,_0xeb04('0x2a'));_0x2dae2c[_0xeb04('0x31')]=_[_0xeb04('0x32')](_0x15d7e5[_0xeb04('0x31')]);_0x2dae2c['filters']=_['intersection'](_0x2dae2c['model'],_0x2dae2c[_0xeb04('0x31')]);_0x1fe452[_0xeb04('0x33')]=_['intersection'](_0x2dae2c[_0xeb04('0x30')],qs[_0xeb04('0x34')](_0x15d7e5[_0xeb04('0x31')]['fields']));_0x1fe452[_0xeb04('0x33')]=_0x1fe452['attributes'][_0xeb04('0x35')]?_0x1fe452['attributes']:_0x2dae2c['model'];if(!_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x36')](_0xeb04('0x37'))){_0x1fe452[_0xeb04('0x20')]=qs[_0xeb04('0x20')](_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x20')]);_0x1fe452[_0xeb04('0x1e')]=qs['offset'](_0x15d7e5[_0xeb04('0x31')]['offset']);}_0x1fe452[_0xeb04('0x38')]=qs[_0xeb04('0x39')](_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x39')]);_0x1fe452[_0xeb04('0x3a')]=qs['filters'](_[_0xeb04('0x3b')](_0x15d7e5[_0xeb04('0x31')],_0x2dae2c[_0xeb04('0x3c')]),_0x324585);if(_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x3d')]){_0x1fe452['where']=_[_0xeb04('0x3e')](_0x1fe452['where'],{'$or':_[_0xeb04('0x2c')](_0x324585,function(_0x41c362){if(_0x41c362['type']!==_0xeb04('0x3f')){var _0x36a0a5={};_0x36a0a5[_0x41c362['name']]={'$like':'%'+_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x3d')]+'%'};return _0x36a0a5;}})});}_0x1fe452=_[_0xeb04('0x3e')]({},_0x1fe452,_0x15d7e5[_0xeb04('0x40')]);var _0x532a22={'where':_0x1fe452[_0xeb04('0x3a')]};return db[_0xeb04('0x2d')][_0xeb04('0x21')](_0x532a22)[_0xeb04('0x26')](function(_0x5009d6){_0x405199[_0xeb04('0x21')]=_0x5009d6;if(_0x15d7e5[_0xeb04('0x31')][_0xeb04('0x41')]){_0x1fe452[_0xeb04('0x42')]=[{'all':!![]}];}return db[_0xeb04('0x2d')][_0xeb04('0x43')](_0x1fe452);})['then'](function(_0x163f4b){_0x405199[_0xeb04('0x44')]=_0x163f4b;return _0x405199;})[_0xeb04('0x26')](respondWithFilteredResult(_0x5859c2,_0x1fe452))[_0xeb04('0x45')](handleError(_0x5859c2,null));};exports[_0xeb04('0x46')]=function(_0x46a67e,_0x1e5870){var _0x4210f4={'raw':![],'where':{'id':_0x46a67e[_0xeb04('0x47')]['id']}},_0x1fe994={};_0x1fe994[_0xeb04('0x30')]=_[_0xeb04('0x32')](db[_0xeb04('0x2d')]['rawAttributes']);_0x1fe994['query']=_[_0xeb04('0x32')](_0x46a67e[_0xeb04('0x31')]);_0x1fe994[_0xeb04('0x3c')]=_[_0xeb04('0x48')](_0x1fe994[_0xeb04('0x30')],_0x1fe994['query']);_0x4210f4[_0xeb04('0x33')]=_['intersection'](_0x1fe994[_0xeb04('0x30')],qs['fields'](_0x46a67e[_0xeb04('0x31')][_0xeb04('0x34')]));_0x4210f4['attributes']=_0x4210f4[_0xeb04('0x33')]['length']?_0x4210f4[_0xeb04('0x33')]:_0x1fe994[_0xeb04('0x30')];if(_0x46a67e['query'][_0xeb04('0x41')]){_0x4210f4[_0xeb04('0x42')]=[{'all':!![]}];}_0x4210f4=_[_0xeb04('0x3e')]({},_0x4210f4,_0x46a67e['options']);return db['Trigger'][_0xeb04('0x49')](_0x4210f4)[_0xeb04('0x26')](handleEntityNotFound(_0x1e5870,null))[_0xeb04('0x26')](respondWithResult(_0x1e5870,null))['catch'](handleError(_0x1e5870,null));};exports['create']=function(_0x1e7a9b,_0x46ec82){return db['Trigger'][_0xeb04('0x4a')](_0x1e7a9b['body'],{})[_0xeb04('0x26')](function(_0x421edc){var _0x2aa7ca=_0x1e7a9b[_0xeb04('0x4b')][_0xeb04('0x4c')]({'plain':!![]});if(!_0x2aa7ca)throw new Error(_0xeb04('0x4d'));if(_0x2aa7ca[_0xeb04('0x4e')]===_0xeb04('0x4b')){var _0x590464=_0x421edc[_0xeb04('0x4c')]({'plain':!![]});var _0x260692='Triggers';return db[_0xeb04('0x4f')]['find']({'where':{'name':_0x260692,'userProfileId':_0x2aa7ca['userProfileId']},'raw':!![]})[_0xeb04('0x26')](function(_0x51ddea){if(_0x51ddea&&_0x51ddea['autoAssociation']===0x0){return db[_0xeb04('0x50')]['create']({'name':_0x590464[_0xeb04('0x2a')],'resourceId':_0x590464['id'],'type':_0x51ddea[_0xeb04('0x2a')],'sectionId':_0x51ddea['id']},{})[_0xeb04('0x26')](function(){return _0x421edc;});}else{return _0x421edc;}})[_0xeb04('0x45')](function(_0x51e1d6){logger[_0xeb04('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51e1d6);throw _0x51e1d6;});}return _0x421edc;})[_0xeb04('0x26')](respondWithResult(_0x46ec82,0xc9))[_0xeb04('0x45')](handleError(_0x46ec82,null));};exports[_0xeb04('0x25')]=function(_0x37bcf2,_0x49a0aa){if(_0x37bcf2['body']['id']){delete _0x37bcf2[_0xeb04('0x51')]['id'];}return db[_0xeb04('0x2d')]['find']({'where':{'id':_0x37bcf2['params']['id']}})['then'](handleEntityNotFound(_0x49a0aa,null))[_0xeb04('0x26')](saveUpdates(_0x37bcf2['body'],null))['then'](respondWithResult(_0x49a0aa,null))[_0xeb04('0x45')](handleError(_0x49a0aa,null));};exports[_0xeb04('0x27')]=function(_0x15fe25,_0x271339){return db[_0xeb04('0x2d')][_0xeb04('0x49')]({'where':{'id':_0x15fe25[_0xeb04('0x47')]['id']}})[_0xeb04('0x26')](handleEntityNotFound(_0x271339,null))[_0xeb04('0x26')](removeEntity(_0x271339,null))[_0xeb04('0x45')](handleError(_0x271339,null));};exports['addAllCondition']=function(_0x4b9171,_0x4a075a,_0x34e070){if(_0x4b9171[_0xeb04('0x51')]['id']){delete _0x4b9171[_0xeb04('0x51')]['id'];}return db[_0xeb04('0x2d')][_0xeb04('0x49')]({'where':{'id':_0x4b9171['params']['id']}})['then'](handleEntityNotFound(_0x4a075a,null))['then'](function(_0x323ef8){if(_0x323ef8){_0x4b9171[_0xeb04('0x51')][_0xeb04('0x52')]=_0x323ef8['id'];return db[_0xeb04('0x53')]['create'](_0x4b9171[_0xeb04('0x51')]);}})['then'](respondWithResult(_0x4a075a,null))['catch'](handleError(_0x4a075a,null));};exports[_0xeb04('0x54')]=function(_0x169062,_0x323c93,_0x117cfc){if(_0x169062['body']['id']){delete _0x169062[_0xeb04('0x51')]['id'];}return db[_0xeb04('0x2d')][_0xeb04('0x49')]({'where':{'id':_0x169062[_0xeb04('0x47')]['id']}})[_0xeb04('0x26')](handleEntityNotFound(_0x323c93,null))[_0xeb04('0x26')](function(_0x152b3f){if(_0x152b3f){_0x169062[_0xeb04('0x51')][_0xeb04('0x55')]=_0x152b3f['id'];return db[_0xeb04('0x53')][_0xeb04('0x4a')](_0x169062[_0xeb04('0x51')]);}})[_0xeb04('0x26')](respondWithResult(_0x323c93,null))[_0xeb04('0x45')](handleError(_0x323c93,null));};exports[_0xeb04('0x56')]=function(_0x146a10,_0x2dadf6,_0x2b1b2b){var _0x49c3f3={};var _0x57ca1f={};var _0x2b558e;var _0x2eb9fa;return db[_0xeb04('0x2d')][_0xeb04('0x57')]({'where':{'id':_0x146a10[_0xeb04('0x47')]['id']}})[_0xeb04('0x26')](handleEntityNotFound(_0x2dadf6,null))[_0xeb04('0x26')](function(_0x3039b1){if(_0x3039b1){_0x2b558e=_0x3039b1;_0x57ca1f[_0xeb04('0x30')]=_['keys'](db['Condition'][_0xeb04('0x2e')]);_0x57ca1f[_0xeb04('0x31')]=_['keys'](_0x146a10['query']);_0x57ca1f['filters']=_[_0xeb04('0x48')](_0x57ca1f['model'],_0x57ca1f[_0xeb04('0x31')]);_0x49c3f3['attributes']=_['intersection'](_0x57ca1f[_0xeb04('0x30')],qs[_0xeb04('0x34')](_0x146a10[_0xeb04('0x31')][_0xeb04('0x34')]));_0x49c3f3['attributes']=_0x49c3f3['attributes'][_0xeb04('0x35')]?_0x49c3f3[_0xeb04('0x33')]:_0x57ca1f[_0xeb04('0x30')];_0x49c3f3['order']=qs[_0xeb04('0x39')](_0x146a10[_0xeb04('0x31')][_0xeb04('0x39')]);_0x49c3f3[_0xeb04('0x3a')]=qs[_0xeb04('0x3c')](_['pick'](_0x146a10[_0xeb04('0x31')],_0x57ca1f[_0xeb04('0x3c')]));if(_0x146a10[_0xeb04('0x31')][_0xeb04('0x3d')]){_0x49c3f3[_0xeb04('0x3a')]=_[_0xeb04('0x3e')](_0x49c3f3[_0xeb04('0x3a')],{'$or':_['map'](_0x49c3f3[_0xeb04('0x33')],function(_0x5b79ad){var _0x21c60b={};_0x21c60b[_0x5b79ad]={'$like':'%'+_0x146a10[_0xeb04('0x31')]['filter']+'%'};return _0x21c60b;})});}_0x49c3f3=_['merge']({},_0x49c3f3,_0x146a10[_0xeb04('0x40')]);return _0x2b558e[_0xeb04('0x56')](_0x49c3f3);}})[_0xeb04('0x26')](function(_0x7925b){if(_0x7925b){_0x2eb9fa=_0x7925b[_0xeb04('0x35')];if(!_0x146a10[_0xeb04('0x31')]['hasOwnProperty'](_0xeb04('0x37'))){_0x49c3f3[_0xeb04('0x20')]=qs[_0xeb04('0x20')](_0x146a10['query']['limit']);_0x49c3f3[_0xeb04('0x1e')]=qs[_0xeb04('0x1e')](_0x146a10[_0xeb04('0x31')][_0xeb04('0x1e')]);}return _0x2b558e[_0xeb04('0x56')](_0x49c3f3);}})[_0xeb04('0x26')](function(_0x126965){if(_0x126965){return _0x126965?{'count':_0x2eb9fa,'rows':_0x126965}:null;}})[_0xeb04('0x26')](respondWithResult(_0x2dadf6,null))[_0xeb04('0x45')](handleError(_0x2dadf6,null));};exports[_0xeb04('0x58')]=function(_0x5c7875,_0x1623ea,_0x3eb531){var _0x1754ae={};var _0x3cd737={};var _0x12ba9b;var _0x49d34b;return db[_0xeb04('0x2d')][_0xeb04('0x57')]({'where':{'id':_0x5c7875[_0xeb04('0x47')]['id']}})[_0xeb04('0x26')](handleEntityNotFound(_0x1623ea,null))[_0xeb04('0x26')](function(_0x1f3065){if(_0x1f3065){_0x12ba9b=_0x1f3065;_0x3cd737[_0xeb04('0x30')]=_[_0xeb04('0x32')](db[_0xeb04('0x53')][_0xeb04('0x2e')]);_0x3cd737[_0xeb04('0x31')]=_[_0xeb04('0x32')](_0x5c7875[_0xeb04('0x31')]);_0x3cd737['filters']=_['intersection'](_0x3cd737[_0xeb04('0x30')],_0x3cd737[_0xeb04('0x31')]);_0x1754ae[_0xeb04('0x33')]=_[_0xeb04('0x48')](_0x3cd737[_0xeb04('0x30')],qs['fields'](_0x5c7875['query'][_0xeb04('0x34')]));_0x1754ae['attributes']=_0x1754ae[_0xeb04('0x33')][_0xeb04('0x35')]?_0x1754ae[_0xeb04('0x33')]:_0x3cd737['model'];_0x1754ae[_0xeb04('0x38')]=qs[_0xeb04('0x39')](_0x5c7875[_0xeb04('0x31')]['sort']);_0x1754ae['where']=qs['filters'](_[_0xeb04('0x3b')](_0x5c7875['query'],_0x3cd737[_0xeb04('0x3c')]));if(_0x5c7875[_0xeb04('0x31')][_0xeb04('0x3d')]){_0x1754ae[_0xeb04('0x3a')]=_[_0xeb04('0x3e')](_0x1754ae[_0xeb04('0x3a')],{'$or':_[_0xeb04('0x2c')](_0x1754ae[_0xeb04('0x33')],function(_0x144b43){var _0x25d7e4={};_0x25d7e4[_0x144b43]={'$like':'%'+_0x5c7875['query'][_0xeb04('0x3d')]+'%'};return _0x25d7e4;})});}_0x1754ae=_[_0xeb04('0x3e')]({},_0x1754ae,_0x5c7875[_0xeb04('0x40')]);return _0x12ba9b[_0xeb04('0x58')](_0x1754ae);}})[_0xeb04('0x26')](function(_0x459b86){if(_0x459b86){_0x49d34b=_0x459b86[_0xeb04('0x35')];if(!_0x5c7875[_0xeb04('0x31')][_0xeb04('0x36')](_0xeb04('0x37'))){_0x1754ae[_0xeb04('0x20')]=qs['limit'](_0x5c7875['query'][_0xeb04('0x20')]);_0x1754ae[_0xeb04('0x1e')]=qs[_0xeb04('0x1e')](_0x5c7875[_0xeb04('0x31')][_0xeb04('0x1e')]);}return _0x12ba9b[_0xeb04('0x58')](_0x1754ae);}})[_0xeb04('0x26')](function(_0x1387de){if(_0x1387de){return _0x1387de?{'count':_0x49d34b,'rows':_0x1387de}:null;}})[_0xeb04('0x26')](respondWithResult(_0x1623ea,null))['catch'](handleError(_0x1623ea,null));};exports[_0xeb04('0x59')]=function(_0x3d6ffb,_0x1f4587,_0x27caa3){if(_0x3d6ffb['body']['id']){delete _0x3d6ffb[_0xeb04('0x51')]['id'];}return db[_0xeb04('0x2d')][_0xeb04('0x49')]({'where':{'id':_0x3d6ffb[_0xeb04('0x47')]['id']}})['then'](handleEntityNotFound(_0x1f4587,null))['then'](function(_0x5e4d4b){if(_0x5e4d4b){_0x3d6ffb['body'][_0xeb04('0x5a')]=_0x5e4d4b['id'];return db[_0xeb04('0x5b')][_0xeb04('0x4a')](_0x3d6ffb[_0xeb04('0x51')]);}})[_0xeb04('0x26')](respondWithResult(_0x1f4587,null))[_0xeb04('0x45')](handleError(_0x1f4587,null));};exports['getActions']=function(_0x894ba9,_0xa27e79,_0xb12294){var _0x27b44f={};var _0x1aa65b={};var _0x3601b3;var _0x43d482;return db[_0xeb04('0x2d')][_0xeb04('0x57')]({'where':{'id':_0x894ba9[_0xeb04('0x47')]['id']}})[_0xeb04('0x26')](handleEntityNotFound(_0xa27e79,null))['then'](function(_0x3f2c14){if(_0x3f2c14){_0x3601b3=_0x3f2c14;_0x1aa65b[_0xeb04('0x30')]=_[_0xeb04('0x32')](db[_0xeb04('0x5b')][_0xeb04('0x2e')]);_0x1aa65b[_0xeb04('0x31')]=_[_0xeb04('0x32')](_0x894ba9[_0xeb04('0x31')]);_0x1aa65b['filters']=_[_0xeb04('0x48')](_0x1aa65b['model'],_0x1aa65b[_0xeb04('0x31')]);_0x27b44f[_0xeb04('0x33')]=_['intersection'](_0x1aa65b[_0xeb04('0x30')],qs[_0xeb04('0x34')](_0x894ba9[_0xeb04('0x31')][_0xeb04('0x34')]));_0x27b44f[_0xeb04('0x33')]=_0x27b44f[_0xeb04('0x33')][_0xeb04('0x35')]?_0x27b44f[_0xeb04('0x33')]:_0x1aa65b[_0xeb04('0x30')];_0x27b44f['order']=qs[_0xeb04('0x39')](_0x894ba9['query']['sort']);_0x27b44f['where']=qs['filters'](_[_0xeb04('0x3b')](_0x894ba9[_0xeb04('0x31')],_0x1aa65b[_0xeb04('0x3c')]));if(_0x894ba9['query'][_0xeb04('0x3d')]){_0x27b44f['where']=_[_0xeb04('0x3e')](_0x27b44f[_0xeb04('0x3a')],{'$or':_[_0xeb04('0x2c')](_0x27b44f[_0xeb04('0x33')],function(_0x49ce0e){var _0x402e49={};_0x402e49[_0x49ce0e]={'$like':'%'+_0x894ba9['query'][_0xeb04('0x3d')]+'%'};return _0x402e49;})});}_0x27b44f=_[_0xeb04('0x3e')]({},_0x27b44f,_0x894ba9[_0xeb04('0x40')]);return _0x3601b3[_0xeb04('0x5c')](_0x27b44f);}})['then'](function(_0x38f8f2){if(_0x38f8f2){_0x43d482=_0x38f8f2[_0xeb04('0x35')];if(!_0x894ba9[_0xeb04('0x31')][_0xeb04('0x36')](_0xeb04('0x37'))){_0x27b44f[_0xeb04('0x20')]=qs['limit'](_0x894ba9[_0xeb04('0x31')][_0xeb04('0x20')]);_0x27b44f[_0xeb04('0x1e')]=qs['offset'](_0x894ba9['query']['offset']);}return _0x3601b3[_0xeb04('0x5c')](_0x27b44f);}})[_0xeb04('0x26')](function(_0x407b0b){if(_0x407b0b){return _0x407b0b?{'count':_0x43d482,'rows':_0x407b0b}:null;}})[_0xeb04('0x26')](respondWithResult(_0xa27e79,null))['catch'](handleError(_0xa27e79,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 82894ee..8156b5d 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 _0xac31=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','Trigger','tools_triggers','lodash','util'];(function(_0x43a1a9,_0x14c9a4){var _0x28f937=function(_0x3dfd79){while(--_0x3dfd79){_0x43a1a9['push'](_0x43a1a9['shift']());}};_0x28f937(++_0x14c9a4);}(_0xac31,0xca));var _0x1ac3=function(_0x2257e3,_0x2a445a){_0x2257e3=_0x2257e3-0x0;var _0x481ef6=_0xac31[_0x2257e3];return _0x481ef6;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var attributes=require('./trigger.attributes');module['exports']=function(_0xbe22b7,_0x20027f){return _0xbe22b7[_0x1ac3('0x9')](_0x1ac3('0xa'),attributes,{'tableName':_0x1ac3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x078c=['path','rimraf','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x33e0f1,_0xc31088){var _0x500b8e=function(_0x3ac721){while(--_0x3ac721){_0x33e0f1['push'](_0x33e0f1['shift']());}};_0x500b8e(++_0xc31088);}(_0x078c,0x19f));var _0xc078=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0x078c[_0x11e30d];return _0x2d4e29;};'use strict';var _=require(_0xc078('0x0'));var util=require('util');var logger=require(_0xc078('0x1'))(_0xc078('0x2'));var moment=require('moment');var BPromise=require(_0xc078('0x3'));var rp=require(_0xc078('0x4'));var fs=require('fs');var path=require(_0xc078('0x5'));var rimraf=require(_0xc078('0x6'));var config=require('../../config/environment');var attributes=require(_0xc078('0x7'));module[_0xc078('0x8')]=function(_0x394068,_0x24b241){return _0x394068[_0xc078('0x9')](_0xc078('0xa'),attributes,{'tableName':_0xc078('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 2f21840..5f7dd55 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 _0xd64f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowTrigger','catch','lodash'];(function(_0x27e93b,_0x159942){var _0x5a2b48=function(_0x1b6a22){while(--_0x1b6a22){_0x27e93b['push'](_0x27e93b['shift']());}};_0x5a2b48(++_0x159942);}(_0xd64f,0x1a1));var _0xfd64=function(_0x1e8ac9,_0x1bd0fe){_0x1e8ac9=_0x1e8ac9-0x0;var _0x4c895c=_0xd64f[_0x1e8ac9];return _0x4c895c;};'use strict';var _=require(_0xfd64('0x0'));var util=require(_0xfd64('0x1'));var moment=require(_0xfd64('0x2'));var BPromise=require(_0xfd64('0x3'));var rs=require(_0xfd64('0x4'));var fs=require('fs');var Redis=require(_0xfd64('0x5'));var db=require(_0xfd64('0x6'))['db'];var utils=require(_0xfd64('0x7'));var logger=require(_0xfd64('0x8'))(_0xfd64('0x9'));var config=require(_0xfd64('0xa'));var jayson=require(_0xfd64('0xb'));var client=jayson['client'][_0xfd64('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x76c0b9,_0xd55a0a,_0x3ff067){return new BPromise(function(_0x58e3d8,_0x245aea){return client['request'](_0x76c0b9,_0x3ff067)[_0xfd64('0xd')](function(_0x4c8e2e){logger[_0xfd64('0xe')](_0xfd64('0xf'),_0xd55a0a,_0xfd64('0x10'));logger[_0xfd64('0x11')](_0xfd64('0x12'),_0xd55a0a,_0xfd64('0x10'),JSON[_0xfd64('0x13')](_0x4c8e2e));if(_0x4c8e2e[_0xfd64('0x14')]){if(_0x4c8e2e['error'][_0xfd64('0x15')]===0x1f4){logger['error'](_0xfd64('0xf'),_0xd55a0a,_0x4c8e2e[_0xfd64('0x14')][_0xfd64('0x16')]);return _0x245aea(_0x4c8e2e[_0xfd64('0x14')]['message']);}logger['error'](_0xfd64('0xf'),_0xd55a0a,_0x4c8e2e['error'][_0xfd64('0x16')]);return _0x58e3d8(_0x4c8e2e[_0xfd64('0x14')]['message']);}else{logger[_0xfd64('0xe')](_0xfd64('0xf'),_0xd55a0a,_0xfd64('0x10'));_0x58e3d8(_0x4c8e2e[_0xfd64('0x17')][_0xfd64('0x16')]);}})['catch'](function(_0x28ed87){logger[_0xfd64('0x14')](_0xfd64('0xf'),_0xd55a0a,_0x28ed87);_0x245aea(_0x28ed87);});});}exports[_0xfd64('0x18')]=function(_0x1c7d0c){var _0x5d1b3b=this;return new Promise(function(_0x1a23bc,_0x5b99fb){return db[_0xfd64('0x19')][_0xfd64('0x1a')]({'raw':_0x1c7d0c[_0xfd64('0x1b')]?_0x1c7d0c['options'][_0xfd64('0x1c')]===undefined?!![]:![]:!![],'where':_0x1c7d0c[_0xfd64('0x1b')]?_0x1c7d0c['options'][_0xfd64('0x1d')]||null:null,'attributes':_0x1c7d0c[_0xfd64('0x1b')]?_0x1c7d0c[_0xfd64('0x1b')][_0xfd64('0x1e')]||null:null,'limit':_0x1c7d0c[_0xfd64('0x1b')]?_0x1c7d0c[_0xfd64('0x1b')][_0xfd64('0x1f')]||null:null,'include':_0x1c7d0c['options']?_0x1c7d0c[_0xfd64('0x1b')][_0xfd64('0x20')]?_['map'](_0x1c7d0c[_0xfd64('0x1b')][_0xfd64('0x20')],function(_0x4c99ab){return{'model':db[_0x4c99ab['model']],'as':_0x4c99ab['as'],'attributes':_0x4c99ab[_0xfd64('0x1e')],'include':_0x4c99ab[_0xfd64('0x20')]?_[_0xfd64('0x21')](_0x4c99ab[_0xfd64('0x20')],function(_0x59198f){return{'model':db[_0x59198f['model']],'as':_0x59198f['as'],'attributes':_0x59198f[_0xfd64('0x1e')],'include':_0x59198f['include']?_['map'](_0x59198f[_0xfd64('0x20')],function(_0x49888b){return{'model':db[_0x49888b[_0xfd64('0x22')]],'as':_0x49888b['as'],'attributes':_0x49888b[_0xfd64('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfd64('0xd')](function(_0x516f81){logger['info']('GetTrigger',_0x1c7d0c);logger['debug']('GetTrigger',_0x1c7d0c,JSON['stringify'](_0x516f81));_0x1a23bc(_0x516f81);})['catch'](function(_0x2cd083){logger['error'](_0xfd64('0x18'),_0x2cd083['message'],_0x1c7d0c);_0x5b99fb(_0x5d1b3b['error'](0x1f4,_0x2cd083[_0xfd64('0x16')]));});});};exports['ShowTrigger']=function(_0x5c7b00){var _0x303673=this;return new Promise(function(_0x2844c5,_0x1623bd){return db[_0xfd64('0x19')][_0xfd64('0x23')]({'raw':_0x5c7b00[_0xfd64('0x1b')]?_0x5c7b00['options']['raw']===undefined?!![]:![]:!![],'where':_0x5c7b00[_0xfd64('0x1b')]?_0x5c7b00[_0xfd64('0x1b')]['where']||null:null,'attributes':_0x5c7b00[_0xfd64('0x1b')]?_0x5c7b00['options'][_0xfd64('0x1e')]||null:null,'include':_0x5c7b00[_0xfd64('0x1b')]?_0x5c7b00[_0xfd64('0x1b')][_0xfd64('0x20')]?_[_0xfd64('0x21')](_0x5c7b00[_0xfd64('0x1b')][_0xfd64('0x20')],function(_0x4258b9){return{'model':db[_0x4258b9['model']],'as':_0x4258b9['as'],'attributes':_0x4258b9[_0xfd64('0x1e')],'include':_0x4258b9['include']?_[_0xfd64('0x21')](_0x4258b9['include'],function(_0x2460f2){return{'model':db[_0x2460f2[_0xfd64('0x22')]],'as':_0x2460f2['as'],'attributes':_0x2460f2[_0xfd64('0x1e')],'include':_0x2460f2[_0xfd64('0x20')]?_[_0xfd64('0x21')](_0x2460f2[_0xfd64('0x20')],function(_0x477233){return{'model':db[_0x477233['model']],'as':_0x477233['as'],'attributes':_0x477233[_0xfd64('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a9f6d){logger[_0xfd64('0xe')](_0xfd64('0x24'),_0x5c7b00);logger['debug'](_0xfd64('0x24'),_0x5c7b00,JSON[_0xfd64('0x13')](_0x4a9f6d));_0x2844c5(_0x4a9f6d);})[_0xfd64('0x25')](function(_0xb69d78){logger[_0xfd64('0x14')]('ShowTrigger',_0xb69d78[_0xfd64('0x16')],_0x5c7b00);_0x1623bd(_0x303673[_0xfd64('0x14')](0x1f4,_0xb69d78[_0xfd64('0x16')]));});});}; \ No newline at end of file +var _0x0ca7=['Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetTrigger','findAll','options','raw','where','attributes','limit','map','include','model','ShowTrigger','Trigger','find','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then'];(function(_0x1ad159,_0x12c5d7){var _0x27eb2c=function(_0x2e6433){while(--_0x2e6433){_0x1ad159['push'](_0x1ad159['shift']());}};_0x27eb2c(++_0x12c5d7);}(_0x0ca7,0xcb));var _0x70ca=function(_0x3d27a,_0x31311d){_0x3d27a=_0x3d27a-0x0;var _0x314fd7=_0x0ca7[_0x3d27a];return _0x314fd7;};'use strict';var _=require(_0x70ca('0x0'));var util=require(_0x70ca('0x1'));var moment=require(_0x70ca('0x2'));var BPromise=require(_0x70ca('0x3'));var rs=require(_0x70ca('0x4'));var fs=require('fs');var Redis=require(_0x70ca('0x5'));var db=require(_0x70ca('0x6'))['db'];var utils=require(_0x70ca('0x7'));var logger=require(_0x70ca('0x8'))('rpc');var config=require(_0x70ca('0x9'));var jayson=require(_0x70ca('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1dc768,_0x1eb10d,_0x20ea07){return new BPromise(function(_0x36151c,_0x39a30b){return client[_0x70ca('0xb')](_0x1dc768,_0x20ea07)[_0x70ca('0xc')](function(_0x5b1e42){logger['info'](_0x70ca('0xd'),_0x1eb10d,_0x70ca('0xe'));logger[_0x70ca('0xf')](_0x70ca('0x10'),_0x1eb10d,'request\x20sent',JSON[_0x70ca('0x11')](_0x5b1e42));if(_0x5b1e42['error']){if(_0x5b1e42[_0x70ca('0x12')]['code']===0x1f4){logger['error'](_0x70ca('0xd'),_0x1eb10d,_0x5b1e42[_0x70ca('0x12')][_0x70ca('0x13')]);return _0x39a30b(_0x5b1e42[_0x70ca('0x12')]['message']);}logger[_0x70ca('0x12')](_0x70ca('0xd'),_0x1eb10d,_0x5b1e42[_0x70ca('0x12')]['message']);return _0x36151c(_0x5b1e42[_0x70ca('0x12')]['message']);}else{logger[_0x70ca('0x14')](_0x70ca('0xd'),_0x1eb10d,_0x70ca('0xe'));_0x36151c(_0x5b1e42[_0x70ca('0x15')][_0x70ca('0x13')]);}})['catch'](function(_0x365b4a){logger[_0x70ca('0x12')](_0x70ca('0xd'),_0x1eb10d,_0x365b4a);_0x39a30b(_0x365b4a);});});}exports[_0x70ca('0x16')]=function(_0x5007e8){var _0x5dcb96=this;return new Promise(function(_0x584d40,_0x4a35b3){return db['Trigger'][_0x70ca('0x17')]({'raw':_0x5007e8[_0x70ca('0x18')]?_0x5007e8[_0x70ca('0x18')][_0x70ca('0x19')]===undefined?!![]:![]:!![],'where':_0x5007e8[_0x70ca('0x18')]?_0x5007e8[_0x70ca('0x18')][_0x70ca('0x1a')]||null:null,'attributes':_0x5007e8[_0x70ca('0x18')]?_0x5007e8['options'][_0x70ca('0x1b')]||null:null,'limit':_0x5007e8['options']?_0x5007e8['options'][_0x70ca('0x1c')]||null:null,'include':_0x5007e8[_0x70ca('0x18')]?_0x5007e8['options']['include']?_[_0x70ca('0x1d')](_0x5007e8[_0x70ca('0x18')]['include'],function(_0x2add01){return{'model':db[_0x2add01['model']],'as':_0x2add01['as'],'attributes':_0x2add01['attributes'],'include':_0x2add01[_0x70ca('0x1e')]?_[_0x70ca('0x1d')](_0x2add01[_0x70ca('0x1e')],function(_0xf9b00d){return{'model':db[_0xf9b00d['model']],'as':_0xf9b00d['as'],'attributes':_0xf9b00d[_0x70ca('0x1b')],'include':_0xf9b00d[_0x70ca('0x1e')]?_[_0x70ca('0x1d')](_0xf9b00d[_0x70ca('0x1e')],function(_0x26a7f7){return{'model':db[_0x26a7f7[_0x70ca('0x1f')]],'as':_0x26a7f7['as'],'attributes':_0x26a7f7[_0x70ca('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x70ca('0xc')](function(_0x5d0464){logger['info'](_0x70ca('0x16'),_0x5007e8);logger[_0x70ca('0xf')](_0x70ca('0x16'),_0x5007e8,JSON['stringify'](_0x5d0464));_0x584d40(_0x5d0464);})['catch'](function(_0x2566f5){logger[_0x70ca('0x12')](_0x70ca('0x16'),_0x2566f5[_0x70ca('0x13')],_0x5007e8);_0x4a35b3(_0x5dcb96[_0x70ca('0x12')](0x1f4,_0x2566f5[_0x70ca('0x13')]));});});};exports[_0x70ca('0x20')]=function(_0x19cc34){var _0x2aefef=this;return new Promise(function(_0x208c1c,_0x3db94d){return db[_0x70ca('0x21')][_0x70ca('0x22')]({'raw':_0x19cc34[_0x70ca('0x18')]?_0x19cc34[_0x70ca('0x18')][_0x70ca('0x19')]===undefined?!![]:![]:!![],'where':_0x19cc34[_0x70ca('0x18')]?_0x19cc34['options'][_0x70ca('0x1a')]||null:null,'attributes':_0x19cc34['options']?_0x19cc34[_0x70ca('0x18')][_0x70ca('0x1b')]||null:null,'include':_0x19cc34['options']?_0x19cc34[_0x70ca('0x18')][_0x70ca('0x1e')]?_[_0x70ca('0x1d')](_0x19cc34[_0x70ca('0x18')][_0x70ca('0x1e')],function(_0x3f1818){return{'model':db[_0x3f1818[_0x70ca('0x1f')]],'as':_0x3f1818['as'],'attributes':_0x3f1818[_0x70ca('0x1b')],'include':_0x3f1818['include']?_[_0x70ca('0x1d')](_0x3f1818[_0x70ca('0x1e')],function(_0x3e6a00){return{'model':db[_0x3e6a00[_0x70ca('0x1f')]],'as':_0x3e6a00['as'],'attributes':_0x3e6a00[_0x70ca('0x1b')],'include':_0x3e6a00['include']?_[_0x70ca('0x1d')](_0x3e6a00[_0x70ca('0x1e')],function(_0x143546){return{'model':db[_0x143546['model']],'as':_0x143546['as'],'attributes':_0x143546[_0x70ca('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x70ca('0xc')](function(_0x15ae67){logger['info'](_0x70ca('0x20'),_0x19cc34);logger[_0x70ca('0xf')](_0x70ca('0x20'),_0x19cc34,JSON[_0x70ca('0x11')](_0x15ae67));_0x208c1c(_0x15ae67);})[_0x70ca('0x23')](function(_0x3ea677){logger[_0x70ca('0x12')](_0x70ca('0x20'),_0x3ea677[_0x70ca('0x13')],_0x19cc34);_0x3db94d(_0x2aefef[_0x70ca('0x12')](0x1f4,_0x3ea677['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index a5ee069..be52f0a 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 _0xefa3=['destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','update','delete'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0xefa3,0x8d));var _0x3efa=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0xefa3[_0x506d2f];return _0x101255;};'use strict';var multer=require(_0x3efa('0x0'));var util=require('util');var path=require(_0x3efa('0x1'));var timeout=require(_0x3efa('0x2'));var express=require(_0x3efa('0x3'));var router=express[_0x3efa('0x4')]();var fs_extra=require(_0x3efa('0x5'));var auth=require(_0x3efa('0x6'));var interaction=require(_0x3efa('0x7'));var config=require('../../config/environment');var controller=require(_0x3efa('0x8'));router[_0x3efa('0x9')]('/',auth[_0x3efa('0xa')](),controller[_0x3efa('0xb')]);router[_0x3efa('0x9')](_0x3efa('0xc'),auth['isAuthenticated'](),controller[_0x3efa('0xd')]);router[_0x3efa('0xe')](_0x3efa('0xf'),auth['isAuthenticated'](),controller[_0x3efa('0x10')]);router[_0x3efa('0xe')]('/',auth[_0x3efa('0xa')](),controller['create']);router['put'](_0x3efa('0xc'),auth[_0x3efa('0xa')](),controller[_0x3efa('0x11')]);router[_0x3efa('0x12')]('/:id',auth[_0x3efa('0xa')](),controller[_0x3efa('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0f6d=['/:id/clone','clone','create','put','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','index','get','/:id','isAuthenticated','show','post'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0x0f6d,0x6b));var _0xd0f6=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x0f6d[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require(_0xd0f6('0x0'));var path=require('path');var timeout=require(_0xd0f6('0x1'));var express=require(_0xd0f6('0x2'));var router=express['Router']();var fs_extra=require(_0xd0f6('0x3'));var auth=require(_0xd0f6('0x4'));var interaction=require(_0xd0f6('0x5'));var config=require('../../config/environment');var controller=require(_0xd0f6('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xd0f6('0x7')]);router[_0xd0f6('0x8')](_0xd0f6('0x9'),auth[_0xd0f6('0xa')](),controller[_0xd0f6('0xb')]);router[_0xd0f6('0xc')](_0xd0f6('0xd'),auth[_0xd0f6('0xa')](),controller[_0xd0f6('0xe')]);router[_0xd0f6('0xc')]('/',auth[_0xd0f6('0xa')](),controller[_0xd0f6('0xf')]);router[_0xd0f6('0x10')](_0xd0f6('0x9'),auth['isAuthenticated'](),controller[_0xd0f6('0x11')]);router[_0xd0f6('0x12')](_0xd0f6('0x9'),auth[_0xd0f6('0xa')](),controller['destroy']);module[_0xd0f6('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 59952ac..f8d6d8f 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 _0x51cd=['ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','outgoing','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','INTEGER','uas','fingerprint','actpass','update','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','friend','user','peer','from-voip-provider'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x51cd,0x180));var _0xd51c=function(_0x5d15d2,_0x34ef3f){_0x5d15d2=_0x5d15d2-0x0;var _0x4d72d2=_0x51cd[_0x5d15d2];return _0x4d72d2;};'use strict';var Sequelize=require(_0xd51c('0x0'));module[_0xd51c('0x1')]={'name':{'type':Sequelize[_0xd51c('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x4'),_0xd51c('0x5'),_0xd51c('0x6')),'allowNull':![],'defaultValue':_0xd51c('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd51c('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0xd51c('0x8'),_0xd51c('0x9'),_0xd51c('0xa'),_0xd51c('0xb'),_0xd51c('0xc'),_0xd51c('0xd'),_0xd51c('0xe'),'PROHIB')},'deny':{'type':Sequelize[_0xd51c('0x2')]},'permit':{'type':Sequelize[_0xd51c('0x2')]},'secret':{'type':Sequelize[_0xd51c('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xd51c('0x2')],'defaultValue':_0xd51c('0xf'),'set':function(_0xe8600d){this[_0xd51c('0x10')](_0xd51c('0x11'),_0xe8600d?_0xe8600d['join'](','):null);},'get':function(){return this[_0xd51c('0x12')](_0xd51c('0x11'))?this[_0xd51c('0x12')](_0xd51c('0x11'))[_0xd51c('0x13')](','):null;},'comment':_0xd51c('0x14')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xd51c('0x15'),_0xd51c('0x16'),_0xd51c('0x17'),_0xd51c('0x18')),'defaultValue':_0xd51c('0x19')},'directmedia':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x1a'),'no',_0xd51c('0x1b'),'update',_0xd51c('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd51c('0x2')]},'directmediadeny':{'type':Sequelize[_0xd51c('0x2')]},'nat':{'type':Sequelize[_0xd51c('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x4e3941){this[_0xd51c('0x10')](_0xd51c('0x1d'),_0x4e3941?_0x4e3941[_0xd51c('0x1e')](','):null);},'get':function(){return this[_0xd51c('0x12')]('nat')?this[_0xd51c('0x12')](_0xd51c('0x1d'))[_0xd51c('0x13')](','):null;},'comment':_0xd51c('0x1f')},'callgroup':{'type':Sequelize[_0xd51c('0x2')]},'namedcallgroup':{'type':Sequelize[_0xd51c('0x2')]},'pickupgroup':{'type':Sequelize[_0xd51c('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xd51c('0x2')]},'language':{'type':Sequelize[_0xd51c('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd51c('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0xd51c('0x2')],'allowNull':![],'defaultValue':_0xd51c('0x20'),'set':function(_0xc6f8ea){this[_0xd51c('0x10')](_0xd51c('0x21'),_0xc6f8ea?_0xc6f8ea[_0xd51c('0x1e')](';'):_0xd51c('0x20'));},'get':function(){return this['getDataValue']('allow')?this[_0xd51c('0x12')](_0xd51c('0x21'))[_0xd51c('0x13')](';'):null;},'comment':_0xd51c('0x22')},'autoframing':{'type':Sequelize['ENUM'](_0xd51c('0x1a'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x129c81){this[_0xd51c('0x10')](_0xd51c('0x23'),_0x129c81?_0x129c81['join'](','):null);},'get':function(){return this[_0xd51c('0x12')](_0xd51c('0x23'))?this[_0xd51c('0x12')](_0xd51c('0x23'))[_0xd51c('0x13')](','):null;},'comment':_0xd51c('0x24')},'trustrpid':{'type':Sequelize['ENUM'](_0xd51c('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x1a'),'no',_0xd51c('0x25'))},'promiscredir':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x1a'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xd51c('0x2')]},'callerid':{'type':Sequelize[_0xd51c('0x2')],'defaultValue':_0xd51c('0x26')},'amaflags':{'type':Sequelize[_0xd51c('0x2')]},'callcounter':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x1a'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x1a'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xd51c('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0xd51c('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xd51c('0x2')]},'videosupport':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x1a'),'no',_0xd51c('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xd51c('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0xd51c('0x2')]},'session_timers':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x28'),'refuse',_0xd51c('0x29'))},'session_expires':{'type':Sequelize[_0xd51c('0x2a')](0xb)},'session_minse':{'type':Sequelize[_0xd51c('0x2a')](0xb)},'session_refresher':{'type':Sequelize[_0xd51c('0x3')]('uac',_0xd51c('0x2b')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xd51c('0x2')]},'regexten':{'type':Sequelize[_0xd51c('0x2')]},'fromdomain':{'type':Sequelize[_0xd51c('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xd51c('0x1a'),'no'),'defaultValue':_0xd51c('0x1a')},'keepalive':{'type':Sequelize[_0xd51c('0x2a')](0xb)},'defaultip':{'type':Sequelize[_0xd51c('0x2')]},'defaultuser':{'type':Sequelize[_0xd51c('0x2')]},'rtptimeout':{'type':Sequelize[_0xd51c('0x2a')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xd51c('0x2a')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd51c('0x2a')](0xb)},'sendrpid':{'type':Sequelize[_0xd51c('0x3')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xd51c('0x2a')](0xb)},'timerb':{'type':Sequelize[_0xd51c('0x2a')](0xb)},'qualifyfreq':{'type':Sequelize[_0xd51c('0x2a')](0xb)},'contactpermit':{'type':Sequelize[_0xd51c('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xd51c('0x2')]},'use_q850_reason':{'type':Sequelize[_0xd51c('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x1a'),'no')},'force_avp':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x1a'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xd51c('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x1a'),'no',_0xd51c('0x2c'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xd51c('0x2a')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd51c('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xd51c('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xd51c('0x3')]('active','passive',_0xd51c('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd51c('0x2')]},'usereqphone':{'type':Sequelize[_0xd51c('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd51c('0x2')]},'recordofffeature':{'type':Sequelize[_0xd51c('0x2')]},'call_limit':{'type':Sequelize[_0xd51c('0x2a')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x1a'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xd51c('0x2')]},'mohsuggest':{'type':Sequelize[_0xd51c('0x2')]},'parkinglot':{'type':Sequelize[_0xd51c('0x2')]},'description':{'type':Sequelize[_0xd51c('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xd51c('0x3')](_0xd51c('0x1a'),'no',_0xd51c('0x1b'),_0xd51c('0x2e'),_0xd51c('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xd51c('0x2')]},'active':{'type':Sequelize[_0xd51c('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd51c('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x51e2=['udp','setDataValue','join','getDataValue','transport','rfc2833','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','active','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','peer','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN'];(function(_0x3b7382,_0x2d9f6b){var _0x7e734=function(_0xda39a9){while(--_0xda39a9){_0x3b7382['push'](_0x3b7382['shift']());}};_0x7e734(++_0x2d9f6b);}(_0x51e2,0x1ac));var _0x251e=function(_0x7ff2b4,_0x414d66){_0x7ff2b4=_0x7ff2b4-0x0;var _0xc864d8=_0x51e2[_0x7ff2b4];return _0xc864d8;};'use strict';var Sequelize=require(_0x251e('0x0'));module[_0x251e('0x1')]={'name':{'type':Sequelize[_0x251e('0x2')],'allowNull':![],'unique':_0x251e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x251e('0x4'),'user',_0x251e('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x251e('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x251e('0x6')]('ALLOWED_NOT_SCREENED',_0x251e('0x7'),_0x251e('0x8'),_0x251e('0x9'),_0x251e('0xa'),_0x251e('0xb'),_0x251e('0xc'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x251e('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x251e('0x2')]},'transport':{'type':Sequelize[_0x251e('0x2')],'defaultValue':_0x251e('0xd'),'set':function(_0x4e9545){this[_0x251e('0xe')]('transport',_0x4e9545?_0x4e9545[_0x251e('0xf')](','):null);},'get':function(){return this[_0x251e('0x10')](_0x251e('0x11'))?this['getDataValue'](_0x251e('0x11'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x12'),'info','shortinfo','inband',_0x251e('0x13')),'defaultValue':_0x251e('0x12')},'directmedia':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no',_0x251e('0x15'),_0x251e('0x16'),_0x251e('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x251e('0x2')]},'directmediadeny':{'type':Sequelize[_0x251e('0x2')]},'nat':{'type':Sequelize[_0x251e('0x2')],'defaultValue':_0x251e('0x18'),'set':function(_0x4f4bea){this[_0x251e('0xe')]('nat',_0x4f4bea?_0x4f4bea[_0x251e('0xf')](','):null);},'get':function(){return this[_0x251e('0x10')](_0x251e('0x19'))?this[_0x251e('0x10')]('nat')[_0x251e('0x1a')](','):null;},'comment':_0x251e('0x1b')},'callgroup':{'type':Sequelize[_0x251e('0x2')]},'namedcallgroup':{'type':Sequelize[_0x251e('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x251e('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x251e('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x251e('0x2')],'defaultValue':_0x251e('0x1c')},'allow':{'type':Sequelize[_0x251e('0x2')],'allowNull':![],'defaultValue':_0x251e('0x1d'),'set':function(_0x3ce20c){this[_0x251e('0xe')](_0x251e('0x1e'),_0x3ce20c?_0x3ce20c['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x251e('0x10')](_0x251e('0x1e'))?this['getDataValue']('allow')['split'](';'):null;},'comment':_0x251e('0x1f')},'autoframing':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no')},'insecure':{'type':Sequelize[_0x251e('0x2')],'defaultValue':_0x251e('0x20'),'set':function(_0x6e8a5d){this[_0x251e('0xe')]('insecure',_0x6e8a5d?_0x6e8a5d[_0x251e('0xf')](','):null);},'get':function(){return this[_0x251e('0x10')](_0x251e('0x21'))?this[_0x251e('0x10')]('insecure')['split'](','):null;},'comment':_0x251e('0x22')},'trustrpid':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no',_0x251e('0x23'))},'promiscredir':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no')},'useclientcode':{'type':Sequelize[_0x251e('0x6')]('yes','no')},'accountcode':{'type':Sequelize[_0x251e('0x24')](0xb)},'setvar':{'type':Sequelize[_0x251e('0x2')]},'callerid':{'type':Sequelize[_0x251e('0x2')],'defaultValue':_0x251e('0x25')},'amaflags':{'type':Sequelize[_0x251e('0x2')]},'callcounter':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no'),'defaultValue':_0x251e('0x14')},'busylevel':{'type':Sequelize[_0x251e('0x24')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x251e('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0x251e('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no',_0x251e('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x251e('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x251e('0x14'),'no')},'mailbox':{'type':Sequelize[_0x251e('0x2')]},'session_timers':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x27'),_0x251e('0x28'),_0x251e('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x251e('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x251e('0x6')]('uac',_0x251e('0x2a')),'defaultValue':_0x251e('0x2a')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x251e('0x2')]},'fromdomain':{'type':Sequelize[_0x251e('0x2')]},'fromuser':{'type':Sequelize[_0x251e('0x2')]},'port':{'type':Sequelize[_0x251e('0x24')](0x5)},'qualify':{'type':Sequelize[_0x251e('0x6')]('yes','no'),'defaultValue':_0x251e('0x14')},'keepalive':{'type':Sequelize[_0x251e('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x251e('0x2')]},'defaultuser':{'type':Sequelize[_0x251e('0x2')]},'rtptimeout':{'type':Sequelize[_0x251e('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x251e('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x251e('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x251e('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x251e('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x251e('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x251e('0x2')]},'contactdeny':{'type':Sequelize[_0x251e('0x2')]},'contactacl':{'type':Sequelize[_0x251e('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x251e('0x2')]},'use_q850_reason':{'type':Sequelize[_0x251e('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x251e('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x251e('0x14'),'no')},'icesupport':{'type':Sequelize[_0x251e('0x6')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no',_0x251e('0x2b'),_0x251e('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x251e('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x251e('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x251e('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x251e('0x2')]},'dtlssetup':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x2d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x251e('0x2')]},'recordofffeature':{'type':Sequelize[_0x251e('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x251e('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0x251e('0x6')]('yes','no')},'vmexten':{'type':Sequelize[_0x251e('0x2')]},'mohinterpret':{'type':Sequelize[_0x251e('0x2')]},'mohsuggest':{'type':Sequelize[_0x251e('0x2')]},'parkinglot':{'type':Sequelize[_0x251e('0x2')]},'description':{'type':Sequelize[_0x251e('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x251e('0x2e')},'canreinvite':{'type':Sequelize[_0x251e('0x6')](_0x251e('0x14'),'no',_0x251e('0x15'),'update',_0x251e('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x251e('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x251e('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x251e('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 8b52505..94bcbeb 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 _0x55ca=['catch','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','Trunk','rawAttributes','type','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','length','options','find','clone','omit','updatedAt','body','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','Reload','chan_sip.so','readFileSync','/etc/asterisk/sip_xcally_registers.conf','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','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x5aef92,_0x50ef28){var _0x58385c=function(_0x1e1be3){while(--_0x1e1be3){_0x5aef92['push'](_0x5aef92['shift']());}};_0x58385c(++_0x50ef28);}(_0x55ca,0x126));var _0xa55c=function(_0x301064,_0x1985aa){_0x301064=_0x301064-0x0;var _0x5bc841=_0x55ca[_0x301064];return _0x5bc841;};'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'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576044,_0x5a3672,_0x59ea8d,_0x18ee85){return new BPromise(function(_0x3930e4,_0x462cd6){var _0x938bd6=_0x18ee85||client;return _0x938bd6[_0xa55c('0x19')](_0x576044,_0x59ea8d)[_0xa55c('0x1a')](function(_0x4e0b2f){logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,_0xa55c('0x1d'));logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x5a3672,_0xa55c('0x1d'),JSON[_0xa55c('0x20')](_0x4e0b2f));if(_0x4e0b2f[_0xa55c('0x21')]){if(_0x4e0b2f[_0xa55c('0x21')]['code']===0x1f4){logger[_0xa55c('0x21')](_0xa55c('0x1c'),_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x462cd6(_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x3930e4(_0x4e0b2f[_0xa55c('0x21')]['message']);}else{logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,'request\x20sent');_0x3930e4(_0x4e0b2f[_0xa55c('0x23')][_0xa55c('0x22')]);}})[_0xa55c('0x24')](function(_0x1965f1){logger[_0xa55c('0x21')]('Trunk,\x20%s,\x20%s',_0x5a3672,_0x1965f1);_0x462cd6(_0x1965f1);});});}function respondWithStatusCode(_0x1fc828,_0x504c24){_0x504c24=_0x504c24||0xcc;return function(_0x5ba836){if(_0x5ba836){return _0x1fc828['sendStatus'](_0x504c24);}return _0x1fc828[_0xa55c('0x25')](_0x504c24)['end']();};}function respondWithResult(_0x3ecbe7,_0x190757){_0x190757=_0x190757||0xc8;return function(_0x3f64de){if(_0x3f64de){return _0x3ecbe7[_0xa55c('0x25')](_0x190757)[_0xa55c('0x26')](_0x3f64de);}};}function respondWithFilteredResult(_0x170ba4,_0x1da633){return function(_0x11e7f7){if(_0x11e7f7){var _0x192df2=typeof _0x1da633[_0xa55c('0x27')]===_0xa55c('0x28')&&typeof _0x1da633['limit']===_0xa55c('0x28');var _0x28814f=_0x11e7f7[_0xa55c('0x29')];var _0x906caa=_0x192df2?0x0:_0x1da633['offset'];var _0x1377b0=_0x192df2?_0x11e7f7[_0xa55c('0x29')]:_0x1da633[_0xa55c('0x27')]+_0x1da633[_0xa55c('0x2a')];var _0x45ee8d;if(_0x1377b0>=_0x28814f){_0x1377b0=_0x28814f;_0x45ee8d=0xc8;}else{_0x45ee8d=0xce;}_0x170ba4[_0xa55c('0x25')](_0x45ee8d);return _0x170ba4['set'](_0xa55c('0x2b'),_0x906caa+'-'+_0x1377b0+'/'+_0x28814f)['json'](_0x11e7f7);}return null;};}function patchUpdates(_0x35c9c2){return function(_0x1d730b){try{jsonpatch[_0xa55c('0x2c')](_0x1d730b,_0x35c9c2,!![]);}catch(_0x223813){return BPromise['reject'](_0x223813);}return _0x1d730b[_0xa55c('0x2d')]();};}function saveUpdates(_0x2096ae,_0x331e58){return function(_0x20da31){if(_0x20da31){return _0x20da31[_0xa55c('0x2e')](_0x2096ae)[_0xa55c('0x1a')](function(_0x29748a){return _0x29748a;});}return null;};}function removeEntity(_0x24d44d,_0x2808e9){return function(_0xcbaf2e){if(_0xcbaf2e){return _0xcbaf2e[_0xa55c('0x2f')]()['then'](function(){var _0x54ca97=_0xcbaf2e[_0xa55c('0x30')]({'plain':!![]});var _0x19733e='Trunks';return db[_0xa55c('0x31')][_0xa55c('0x2f')]({'where':{'type':_0x19733e,'resourceId':_0x54ca97['id']}})[_0xa55c('0x1a')](function(){return _0xcbaf2e;});})[_0xa55c('0x1a')](function(){_0x24d44d[_0xa55c('0x25')](0xcc)[_0xa55c('0x32')]();});}};}function handleEntityNotFound(_0x3ce1b3,_0x222d4b){return function(_0x3959e3){if(!_0x3959e3){_0x3ce1b3['sendStatus'](0x194);}return _0x3959e3;};}function handleError(_0x5f3e99,_0x4b23d3){_0x4b23d3=_0x4b23d3||0x1f4;return function(_0x3fd75f){logger[_0xa55c('0x21')](_0x3fd75f[_0xa55c('0x33')]);if(_0x3fd75f['name']){delete _0x3fd75f[_0xa55c('0x34')];}_0x5f3e99['status'](_0x4b23d3)[_0xa55c('0x35')](_0x3fd75f);};}exports['index']=function(_0x18c6f1,_0x39267c){var _0x3c0ec1={},_0x4d3eb5={},_0x7c4a47={'count':0x0,'rows':[]};var _0x30f23b=_['map'](db[_0xa55c('0x36')][_0xa55c('0x37')],function(_0x4d9083){return{'name':_0x4d9083['fieldName'],'type':_0x4d9083[_0xa55c('0x38')]['key']};});_0x4d3eb5[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x30f23b,'name');_0x4d3eb5['query']=_['keys'](_0x18c6f1['query']);_0x4d3eb5[_0xa55c('0x3b')]=_[_0xa55c('0x3c')](_0x4d3eb5[_0xa55c('0x39')],_0x4d3eb5[_0xa55c('0x3d')]);_0x3c0ec1[_0xa55c('0x3e')]=_['intersection'](_0x4d3eb5[_0xa55c('0x39')],qs[_0xa55c('0x3f')](_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x3f')]));_0x3c0ec1[_0xa55c('0x3e')]=_0x3c0ec1[_0xa55c('0x3e')]['length']?_0x3c0ec1[_0xa55c('0x3e')]:_0x4d3eb5['model'];if(!_0x18c6f1['query'][_0xa55c('0x40')](_0xa55c('0x41'))){_0x3c0ec1['limit']=qs[_0xa55c('0x2a')](_0x18c6f1['query']['limit']);_0x3c0ec1[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x18c6f1[_0xa55c('0x3d')]['offset']);}_0x3c0ec1[_0xa55c('0x42')]=qs[_0xa55c('0x43')](_0x18c6f1['query'][_0xa55c('0x43')]);_0x3c0ec1['where']=qs[_0xa55c('0x3b')](_[_0xa55c('0x44')](_0x18c6f1['query'],_0x4d3eb5[_0xa55c('0x3b')]),_0x30f23b);if(_0x18c6f1[_0xa55c('0x3d')]['filter']){_0x3c0ec1[_0xa55c('0x45')]=_[_0xa55c('0x46')](_0x3c0ec1[_0xa55c('0x45')],{'$or':_['map'](_0x30f23b,function(_0x334f52){if(_0x334f52['type']!==_0xa55c('0x47')){var _0x3a8af4={};_0x3a8af4[_0x334f52[_0xa55c('0x34')]]={'$like':'%'+_0x18c6f1['query'][_0xa55c('0x48')]+'%'};return _0x3a8af4;}})});}_0x3c0ec1=_[_0xa55c('0x46')]({},_0x3c0ec1,_0x18c6f1['options']);var _0x3d19f5={'where':_0x3c0ec1[_0xa55c('0x45')]};return db['Trunk'][_0xa55c('0x29')](_0x3d19f5)[_0xa55c('0x1a')](function(_0x52f9a7){_0x7c4a47[_0xa55c('0x29')]=_0x52f9a7;if(_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x49')]){_0x3c0ec1[_0xa55c('0x4a')]=[{'all':!![]}];}return db['Trunk'][_0xa55c('0x4b')](_0x3c0ec1);})['then'](function(_0x2157d6){_0x7c4a47[_0xa55c('0x4c')]=_0x2157d6;return _0x7c4a47;})[_0xa55c('0x1a')](respondWithFilteredResult(_0x39267c,_0x3c0ec1))['catch'](handleError(_0x39267c,null));};exports[_0xa55c('0x4d')]=function(_0x250b00,_0x574fe9){var _0x5be06={'raw':![],'where':{'id':_0x250b00[_0xa55c('0x4e')]['id']}},_0x34de95={};_0x34de95[_0xa55c('0x39')]=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x34de95[_0xa55c('0x3d')]=_[_0xa55c('0x4f')](_0x250b00[_0xa55c('0x3d')]);_0x34de95['filters']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],_0x34de95[_0xa55c('0x3d')]);_0x5be06['attributes']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],qs['fields'](_0x250b00[_0xa55c('0x3d')]['fields']));_0x5be06[_0xa55c('0x3e')]=_0x5be06[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x5be06[_0xa55c('0x3e')]:_0x34de95[_0xa55c('0x39')];if(_0x250b00['query'][_0xa55c('0x49')]){_0x5be06[_0xa55c('0x4a')]=[{'all':!![]}];}_0x5be06=_['merge']({},_0x5be06,_0x250b00[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x5be06)[_0xa55c('0x1a')](handleEntityNotFound(_0x574fe9,null))['then'](respondWithResult(_0x574fe9,null))['catch'](handleError(_0x574fe9,null));};exports[_0xa55c('0x53')]=function(_0x250dea,_0x3ca5b8){var _0x44ac57={'where':{'id':_0x250dea[_0xa55c('0x4e')]['id']}},_0x54cbde={};_0x54cbde['model']=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x44ac57[_0xa55c('0x3e')]=_[_0xa55c('0x3c')](_0x54cbde['model'],qs[_0xa55c('0x3f')](_0x250dea['query'][_0xa55c('0x3f')]));_0x44ac57[_0xa55c('0x3e')]=_0x44ac57[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x44ac57[_0xa55c('0x3e')]:_0x54cbde[_0xa55c('0x39')];if(_0x250dea[_0xa55c('0x3d')]['includeAll']){_0x44ac57[_0xa55c('0x4a')]=[{'all':!![]}];}_0x44ac57=_[_0xa55c('0x46')]({},_0x44ac57,_0x250dea[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x44ac57)['then'](handleEntityNotFound(_0x3ca5b8,null))[_0xa55c('0x1a')](function(_0x3cd40d){if(_0x3cd40d){var _0x28bac4=_0x3cd40d[_0xa55c('0x30')]({'plain':!![]});_0x28bac4=qs[_0xa55c('0x54')](_0x28bac4,['id','createdAt',_0xa55c('0x55')]);_0x250dea[_0xa55c('0x56')]=_[_0xa55c('0x54')](_0x250dea[_0xa55c('0x56')],['id',_0xa55c('0x57'),'updatedAt']);return db[_0xa55c('0x36')]['create'](_[_0xa55c('0x46')](_0x28bac4,_0x250dea['body']),{'include':_0x250dea[_0xa55c('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x1a')](function(_0x1333da){var _0x21d6b4=_0x250dea[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x21d6b4)throw new Error(_0xa55c('0x59'));if(_0x21d6b4[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0x14b515=_0x1333da[_0xa55c('0x30')]({'plain':!![]});var _0x51c736=_0xa55c('0x5b');return db[_0xa55c('0x5c')]['find']({'where':{'name':_0x51c736,'userProfileId':_0x21d6b4[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x3e3b4b){if(_0x3e3b4b&&_0x3e3b4b[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')][_0xa55c('0x5f')]({'name':_0x14b515[_0xa55c('0x34')],'resourceId':_0x14b515['id'],'type':_0x3e3b4b[_0xa55c('0x34')],'sectionId':_0x3e3b4b['id']},{})['then'](function(){return _0x1333da;});}else{return _0x1333da;}})[_0xa55c('0x24')](function(_0x475131){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x475131);throw _0x475131;});}return _0x1333da;});}})[_0xa55c('0x1a')](respondWithResult(_0x3ca5b8,0xc9))[_0xa55c('0x24')](handleError(_0x3ca5b8,null));};exports[_0xa55c('0x5f')]=function(_0x4249c1,_0x25d5a1,_0x4a08ca){var _0x347562;return db[_0xa55c('0x36')][_0xa55c('0x5f')](_0x4249c1[_0xa55c('0x56')],{'raw':!![]})[_0xa55c('0x1a')](function(_0x10e711){_0x347562=_0x10e711;return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x3178a6){var _0x3bbc4b=fs['readFileSync'](path[_0xa55c('0x61')](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0x129bb4=fs['readFileSync'](path['join'](config[_0xa55c('0x64')],_0xa55c('0x65')),_0xa55c('0x63'));var _0x42529f=ejs['render'](_0x3bbc4b,{'trunks':_0x3178a6||[]});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x42529f);if(_0x347562[_0xa55c('0x68')]){var _0x3a9910=ejs[_0xa55c('0x69')](_0x129bb4,{'trunks':_0x3178a6||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x3a9910);}})[_0xa55c('0x1a')](function(){return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x5f'),{'module':_0xa55c('0x6b')});})[_0xa55c('0x1a')](function(){var _0x4b2032=_0x4249c1[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x4b2032)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2032[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0xa340fb=_0x347562['get']({'plain':!![]});return db[_0xa55c('0x5c')][_0xa55c('0x52')]({'where':{'name':_0xa55c('0x5b'),'userProfileId':_0x4b2032[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x506f74){if(_0x506f74&&_0x506f74[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')]['create']({'name':_0xa340fb['name'],'resourceId':_0xa340fb['id'],'type':_0x506f74[_0xa55c('0x34')],'sectionId':_0x506f74['id']},{})['then'](function(){return _0x347562;});}else{return _0x347562;}})[_0xa55c('0x24')](function(_0x5ca0bc){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x5ca0bc);throw _0x5ca0bc;});}return _0x347562;})[_0xa55c('0x1a')](respondWithResult(_0x25d5a1,0xc9))[_0xa55c('0x24')](handleError(_0x25d5a1,null));};exports[_0xa55c('0x2e')]=function(_0xff7b1c,_0x16dfc6,_0x5d8551){var _0x463195;return db[_0xa55c('0x36')][_0xa55c('0x52')]({'where':{'id':_0xff7b1c[_0xa55c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16dfc6,null))[_0xa55c('0x1a')](saveUpdates(_0xff7b1c[_0xa55c('0x56')],null))[_0xa55c('0x1a')](function(_0x2298ac){if(_0x2298ac){_0x463195=_0x2298ac;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa55c('0x1a')](function(_0x428872){if(_0x428872){var _0x12e3a8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0xd33c9c=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x65')),'utf8');var _0x19497b=ejs['render'](_0x12e3a8,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x19497b);var _0x36ded7=ejs[_0xa55c('0x69')](_0xd33c9c,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x36ded7);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2e'),{'module':_0xa55c('0x6b')});}return null;})[_0xa55c('0x1a')](function(_0x576a1b){if(_0x576a1b){return _0x463195;}})['then'](respondWithResult(_0x16dfc6,null))[_0xa55c('0x24')](handleError(_0x16dfc6,null));};exports[_0xa55c('0x2f')]=function(_0xc2ad5c,_0x256db0,_0x1622cb){var _0x137728;return db['Trunk'][_0xa55c('0x52')]({'where':{'id':_0xc2ad5c[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x256db0,null))[_0xa55c('0x1a')](removeEntity(_0x256db0,null))[_0xa55c('0x1a')](function(){return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x58b670){var _0x25d09d=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x62')),'utf8');var _0x2685d8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x65')),_0xa55c('0x63'));var _0x5c2229=ejs['render'](_0x25d09d,{'trunks':_0x58b670});var _0x579726=ejs['render'](_0x2685d8,{'trunks':_0x58b670});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x5c2229);fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x579726);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2f'),{'module':'chan_sip.so'});})[_0xa55c('0x24')](handleError(_0x256db0,null));}; \ No newline at end of file +var _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x171c6e,_0x3a544c){var _0x50148e=function(_0x5dff6d){while(--_0x5dff6d){_0x171c6e['push'](_0x171c6e['shift']());}};_0x50148e(++_0x3a544c);}(_0xe14d,0x1ee));var _0xde14=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xe14d[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 1debfd8..f9f65b0 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 _0x23ec=['Trunk','tools_trunks','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./trunk.attributes','exports','define'];(function(_0x50fddd,_0x220790){var _0x1cda2f=function(_0x54fb25){while(--_0x54fb25){_0x50fddd['push'](_0x50fddd['shift']());}};_0x1cda2f(++_0x220790);}(_0x23ec,0xdf));var _0xc23e=function(_0x3bc068,_0x15b277){_0x3bc068=_0x3bc068-0x0;var _0x462329=_0x23ec[_0x3bc068];return _0x462329;};'use strict';var _=require(_0xc23e('0x0'));var util=require(_0xc23e('0x1'));var logger=require('../../config/logger')(_0xc23e('0x2'));var moment=require(_0xc23e('0x3'));var BPromise=require(_0xc23e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc23e('0x5'));var rimraf=require(_0xc23e('0x6'));var config=require(_0xc23e('0x7'));var attributes=require(_0xc23e('0x8'));module[_0xc23e('0x9')]=function(_0x4a5e8d,_0x395013){return _0x4a5e8d[_0xc23e('0xa')](_0xc23e('0xb'),attributes,{'tableName':_0xc23e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbccf=['bluebird','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbccf,0xed));var _0xfbcc=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0xbccf[_0x207811];return _0x170d56;};'use strict';var _=require(_0xfbcc('0x0'));var util=require('util');var logger=require(_0xfbcc('0x1'))('api');var moment=require(_0xfbcc('0x2'));var BPromise=require(_0xfbcc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfbcc('0x4'));var rimraf=require(_0xfbcc('0x5'));var config=require(_0xfbcc('0x6'));var attributes=require(_0xfbcc('0x7'));module[_0xfbcc('0x8')]=function(_0x5eb8df,_0x411a41){return _0x5eb8df[_0xfbcc('0x9')](_0xfbcc('0xa'),attributes,{'tableName':_0xfbcc('0xb'),'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 7ea663a..b8b41ca 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 _0x0253=['map','model','stringify','ShowTrunk','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetTrunk','findAll','options','where','attributes','limit','include'];(function(_0x824e2b,_0x296489){var _0x55d1e1=function(_0x463c27){while(--_0x463c27){_0x824e2b['push'](_0x824e2b['shift']());}};_0x55d1e1(++_0x296489);}(_0x0253,0x16f));var _0x3025=function(_0x37f21d,_0xf276c7){_0x37f21d=_0x37f21d-0x0;var _0x3bc474=_0x0253[_0x37f21d];return _0x3bc474;};'use strict';var _=require(_0x3025('0x0'));var util=require(_0x3025('0x1'));var moment=require('moment');var BPromise=require(_0x3025('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3025('0x3'));var db=require(_0x3025('0x4'))['db'];var utils=require(_0x3025('0x5'));var logger=require(_0x3025('0x6'))(_0x3025('0x7'));var config=require(_0x3025('0x8'));var jayson=require(_0x3025('0x9'));var client=jayson[_0x3025('0xa')][_0x3025('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x412e86,_0x372e4a,_0x5e785f){return new BPromise(function(_0x272315,_0x333216){return client['request'](_0x412e86,_0x5e785f)[_0x3025('0xc')](function(_0x1a784a){logger['info'](_0x3025('0xd'),_0x372e4a,'request\x20sent');logger[_0x3025('0xe')](_0x3025('0xf'),_0x372e4a,_0x3025('0x10'),JSON['stringify'](_0x1a784a));if(_0x1a784a[_0x3025('0x11')]){if(_0x1a784a[_0x3025('0x11')][_0x3025('0x12')]===0x1f4){logger['error'](_0x3025('0xd'),_0x372e4a,_0x1a784a[_0x3025('0x11')][_0x3025('0x13')]);return _0x333216(_0x1a784a[_0x3025('0x11')][_0x3025('0x13')]);}logger[_0x3025('0x11')](_0x3025('0xd'),_0x372e4a,_0x1a784a[_0x3025('0x11')][_0x3025('0x13')]);return _0x272315(_0x1a784a[_0x3025('0x11')][_0x3025('0x13')]);}else{logger['info'](_0x3025('0xd'),_0x372e4a,_0x3025('0x10'));_0x272315(_0x1a784a[_0x3025('0x14')]['message']);}})[_0x3025('0x15')](function(_0x2cf5dc){logger[_0x3025('0x11')](_0x3025('0xd'),_0x372e4a,_0x2cf5dc);_0x333216(_0x2cf5dc);});});}exports[_0x3025('0x16')]=function(_0x27b097){var _0x1cf2d4=this;return new Promise(function(_0x5872c1,_0x391418){return db['Trunk'][_0x3025('0x17')]({'raw':_0x27b097[_0x3025('0x18')]?_0x27b097[_0x3025('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x27b097[_0x3025('0x18')]?_0x27b097['options'][_0x3025('0x19')]||null:null,'attributes':_0x27b097[_0x3025('0x18')]?_0x27b097[_0x3025('0x18')][_0x3025('0x1a')]||null:null,'limit':_0x27b097[_0x3025('0x18')]?_0x27b097[_0x3025('0x18')][_0x3025('0x1b')]||null:null,'include':_0x27b097[_0x3025('0x18')]?_0x27b097['options'][_0x3025('0x1c')]?_[_0x3025('0x1d')](_0x27b097[_0x3025('0x18')]['include'],function(_0x46c75e){return{'model':db[_0x46c75e[_0x3025('0x1e')]],'as':_0x46c75e['as'],'attributes':_0x46c75e[_0x3025('0x1a')],'include':_0x46c75e[_0x3025('0x1c')]?_[_0x3025('0x1d')](_0x46c75e[_0x3025('0x1c')],function(_0x40c7fd){return{'model':db[_0x40c7fd['model']],'as':_0x40c7fd['as'],'attributes':_0x40c7fd[_0x3025('0x1a')],'include':_0x40c7fd[_0x3025('0x1c')]?_['map'](_0x40c7fd[_0x3025('0x1c')],function(_0x2ed96e){return{'model':db[_0x2ed96e[_0x3025('0x1e')]],'as':_0x2ed96e['as'],'attributes':_0x2ed96e[_0x3025('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3025('0xc')](function(_0x257944){logger['info'](_0x3025('0x16'),_0x27b097);logger[_0x3025('0xe')](_0x3025('0x16'),_0x27b097,JSON[_0x3025('0x1f')](_0x257944));_0x5872c1(_0x257944);})[_0x3025('0x15')](function(_0x395dd1){logger[_0x3025('0x11')]('GetTrunk',_0x395dd1[_0x3025('0x13')],_0x27b097);_0x391418(_0x1cf2d4[_0x3025('0x11')](0x1f4,_0x395dd1[_0x3025('0x13')]));});});};exports[_0x3025('0x20')]=function(_0x65b944){var _0x150d50=this;return new Promise(function(_0x4e78dd,_0xa6c3b9){return db['Trunk']['find']({'raw':_0x65b944[_0x3025('0x18')]?_0x65b944['options']['raw']===undefined?!![]:![]:!![],'where':_0x65b944[_0x3025('0x18')]?_0x65b944[_0x3025('0x18')][_0x3025('0x19')]||null:null,'attributes':_0x65b944['options']?_0x65b944[_0x3025('0x18')]['attributes']||null:null,'include':_0x65b944[_0x3025('0x18')]?_0x65b944[_0x3025('0x18')][_0x3025('0x1c')]?_[_0x3025('0x1d')](_0x65b944[_0x3025('0x18')][_0x3025('0x1c')],function(_0x3ae2ed){return{'model':db[_0x3ae2ed['model']],'as':_0x3ae2ed['as'],'attributes':_0x3ae2ed[_0x3025('0x1a')],'include':_0x3ae2ed['include']?_[_0x3025('0x1d')](_0x3ae2ed[_0x3025('0x1c')],function(_0x4453d3){return{'model':db[_0x4453d3[_0x3025('0x1e')]],'as':_0x4453d3['as'],'attributes':_0x4453d3[_0x3025('0x1a')],'include':_0x4453d3[_0x3025('0x1c')]?_[_0x3025('0x1d')](_0x4453d3['include'],function(_0x3ab2c4){return{'model':db[_0x3ab2c4[_0x3025('0x1e')]],'as':_0x3ab2c4['as'],'attributes':_0x3ab2c4[_0x3025('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3025('0xc')](function(_0xe9ee30){logger['info']('ShowTrunk',_0x65b944);logger[_0x3025('0xe')](_0x3025('0x20'),_0x65b944,JSON[_0x3025('0x1f')](_0xe9ee30));_0x4e78dd(_0xe9ee30);})['catch'](function(_0x3acfee){logger[_0x3025('0x11')](_0x3025('0x20'),_0x3acfee['message'],_0x65b944);_0xa6c3b9(_0x150d50[_0x3025('0x11')](0x1f4,_0x3acfee['message']));});});}; \ No newline at end of file +var _0xf6d4=['raw','where','attributes','limit','map','model','include','GetTrunk','stringify','ShowTrunk','find','debug','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Trunk','findAll','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf6d4,0x75));var _0x4f6d=function(_0x44438d,_0x44044b){_0x44438d=_0x44438d-0x0;var _0xf65d59=_0xf6d4[_0x44438d];return _0xf65d59;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f6d('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f6d('0x1'));var db=require(_0x4f6d('0x2'))['db'];var utils=require(_0x4f6d('0x3'));var logger=require(_0x4f6d('0x4'))(_0x4f6d('0x5'));var config=require('../../config/environment');var jayson=require(_0x4f6d('0x6'));var client=jayson[_0x4f6d('0x7')][_0x4f6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a264a,_0x419b8f,_0x2fe1cf){return new BPromise(function(_0x49fe7b,_0x566333){return client[_0x4f6d('0x9')](_0x4a264a,_0x2fe1cf)[_0x4f6d('0xa')](function(_0x2e0775){logger[_0x4f6d('0xb')](_0x4f6d('0xc'),_0x419b8f,_0x4f6d('0xd'));logger['debug'](_0x4f6d('0xe'),_0x419b8f,_0x4f6d('0xd'),JSON['stringify'](_0x2e0775));if(_0x2e0775['error']){if(_0x2e0775[_0x4f6d('0xf')][_0x4f6d('0x10')]===0x1f4){logger[_0x4f6d('0xf')](_0x4f6d('0xc'),_0x419b8f,_0x2e0775[_0x4f6d('0xf')][_0x4f6d('0x11')]);return _0x566333(_0x2e0775[_0x4f6d('0xf')][_0x4f6d('0x11')]);}logger['error'](_0x4f6d('0xc'),_0x419b8f,_0x2e0775[_0x4f6d('0xf')][_0x4f6d('0x11')]);return _0x49fe7b(_0x2e0775[_0x4f6d('0xf')][_0x4f6d('0x11')]);}else{logger[_0x4f6d('0xb')](_0x4f6d('0xc'),_0x419b8f,_0x4f6d('0xd'));_0x49fe7b(_0x2e0775[_0x4f6d('0x12')][_0x4f6d('0x11')]);}})[_0x4f6d('0x13')](function(_0x475a47){logger[_0x4f6d('0xf')]('Trunk,\x20%s,\x20%s',_0x419b8f,_0x475a47);_0x566333(_0x475a47);});});}exports['GetTrunk']=function(_0x5237cd){var _0x38cf1d=this;return new Promise(function(_0x4a64ca,_0x4b4721){return db[_0x4f6d('0x14')][_0x4f6d('0x15')]({'raw':_0x5237cd[_0x4f6d('0x16')]?_0x5237cd[_0x4f6d('0x16')][_0x4f6d('0x17')]===undefined?!![]:![]:!![],'where':_0x5237cd[_0x4f6d('0x16')]?_0x5237cd[_0x4f6d('0x16')][_0x4f6d('0x18')]||null:null,'attributes':_0x5237cd[_0x4f6d('0x16')]?_0x5237cd[_0x4f6d('0x16')][_0x4f6d('0x19')]||null:null,'limit':_0x5237cd[_0x4f6d('0x16')]?_0x5237cd[_0x4f6d('0x16')][_0x4f6d('0x1a')]||null:null,'include':_0x5237cd[_0x4f6d('0x16')]?_0x5237cd[_0x4f6d('0x16')]['include']?_[_0x4f6d('0x1b')](_0x5237cd['options']['include'],function(_0x4ad8e3){return{'model':db[_0x4ad8e3[_0x4f6d('0x1c')]],'as':_0x4ad8e3['as'],'attributes':_0x4ad8e3['attributes'],'include':_0x4ad8e3[_0x4f6d('0x1d')]?_[_0x4f6d('0x1b')](_0x4ad8e3[_0x4f6d('0x1d')],function(_0x2005f0){return{'model':db[_0x2005f0[_0x4f6d('0x1c')]],'as':_0x2005f0['as'],'attributes':_0x2005f0['attributes'],'include':_0x2005f0['include']?_['map'](_0x2005f0[_0x4f6d('0x1d')],function(_0x5448bf){return{'model':db[_0x5448bf[_0x4f6d('0x1c')]],'as':_0x5448bf['as'],'attributes':_0x5448bf[_0x4f6d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4f6d('0xa')](function(_0x1ed6e3){logger[_0x4f6d('0xb')](_0x4f6d('0x1e'),_0x5237cd);logger['debug']('GetTrunk',_0x5237cd,JSON[_0x4f6d('0x1f')](_0x1ed6e3));_0x4a64ca(_0x1ed6e3);})[_0x4f6d('0x13')](function(_0x2fcf91){logger['error'](_0x4f6d('0x1e'),_0x2fcf91[_0x4f6d('0x11')],_0x5237cd);_0x4b4721(_0x38cf1d[_0x4f6d('0xf')](0x1f4,_0x2fcf91[_0x4f6d('0x11')]));});});};exports[_0x4f6d('0x20')]=function(_0x3fd30d){var _0x230d81=this;return new Promise(function(_0x1d827b,_0x478136){return db[_0x4f6d('0x14')][_0x4f6d('0x21')]({'raw':_0x3fd30d[_0x4f6d('0x16')]?_0x3fd30d[_0x4f6d('0x16')][_0x4f6d('0x17')]===undefined?!![]:![]:!![],'where':_0x3fd30d[_0x4f6d('0x16')]?_0x3fd30d[_0x4f6d('0x16')][_0x4f6d('0x18')]||null:null,'attributes':_0x3fd30d[_0x4f6d('0x16')]?_0x3fd30d['options'][_0x4f6d('0x19')]||null:null,'include':_0x3fd30d[_0x4f6d('0x16')]?_0x3fd30d[_0x4f6d('0x16')][_0x4f6d('0x1d')]?_['map'](_0x3fd30d['options'][_0x4f6d('0x1d')],function(_0x480ca4){return{'model':db[_0x480ca4[_0x4f6d('0x1c')]],'as':_0x480ca4['as'],'attributes':_0x480ca4[_0x4f6d('0x19')],'include':_0x480ca4['include']?_[_0x4f6d('0x1b')](_0x480ca4[_0x4f6d('0x1d')],function(_0x23d99e){return{'model':db[_0x23d99e[_0x4f6d('0x1c')]],'as':_0x23d99e['as'],'attributes':_0x23d99e[_0x4f6d('0x19')],'include':_0x23d99e['include']?_[_0x4f6d('0x1b')](_0x23d99e[_0x4f6d('0x1d')],function(_0x2b4c5d){return{'model':db[_0x2b4c5d[_0x4f6d('0x1c')]],'as':_0x2b4c5d['as'],'attributes':_0x2b4c5d[_0x4f6d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4f6d('0xa')](function(_0x211113){logger[_0x4f6d('0xb')](_0x4f6d('0x20'),_0x3fd30d);logger[_0x4f6d('0x22')]('ShowTrunk',_0x3fd30d,JSON[_0x4f6d('0x1f')](_0x211113));_0x1d827b(_0x211113);})[_0x4f6d('0x13')](function(_0x2de03c){logger[_0x4f6d('0xf')](_0x4f6d('0x20'),_0x2de03c['message'],_0x3fd30d);_0x478136(_0x230d81['error'](0x1f4,_0x2de03c[_0x4f6d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 7c9c1a3..b3ac688 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 _0xe5a3=['express','Router','./user-setting.controller','/:id','update','exports'];(function(_0x4ec944,_0xed8065){var _0x4b924b=function(_0x2b05d5){while(--_0x2b05d5){_0x4ec944['push'](_0x4ec944['shift']());}};_0x4b924b(++_0xed8065);}(_0xe5a3,0xde));var _0x3e5a=function(_0x3950f5,_0x3f7b3d){_0x3950f5=_0x3950f5-0x0;var _0x5089f5=_0xe5a3[_0x3950f5];return _0x5089f5;};'use strict';var express=require(_0x3e5a('0x0'));var router=express[_0x3e5a('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x3e5a('0x2'));router['put'](_0x3e5a('0x3'),auth['isAuthenticated'](),controller[_0x3e5a('0x4')]);module[_0x3e5a('0x5')]=router; \ No newline at end of file +var _0x3c8b=['isAuthenticated','update','express','Router','../../components/auth/service','./user-setting.controller','put','/:id'];(function(_0x2923bf,_0x5bd8d5){var _0x1f60f6=function(_0x1e7d88){while(--_0x1e7d88){_0x2923bf['push'](_0x2923bf['shift']());}};_0x1f60f6(++_0x5bd8d5);}(_0x3c8b,0x152));var _0xb3c8=function(_0x44bac9,_0x3ad5b8){_0x44bac9=_0x44bac9-0x0;var _0x2948b5=_0x3c8b[_0x44bac9];return _0x2948b5;};'use strict';var express=require(_0xb3c8('0x0'));var router=express[_0xb3c8('0x1')]();var auth=require(_0xb3c8('0x2'));var controller=require(_0xb3c8('0x3'));router[_0xb3c8('0x4')](_0xb3c8('0x5'),auth[_0xb3c8('0x6')](),controller[_0xb3c8('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 8fd5ee6..66fe774 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 _0x2202=['debug','exports','ENUM','error','TEXT','DATE','INTEGER','UserId','sequelize','warning','info'];(function(_0xcf3fb4,_0x495be4){var _0x2bbf0d=function(_0xf9f986){while(--_0xf9f986){_0xcf3fb4['push'](_0xcf3fb4['shift']());}};_0x2bbf0d(++_0x495be4);}(_0x2202,0x1e1));var _0x2220=function(_0x580fa9,_0x4b6b83){_0x580fa9=_0x580fa9-0x0;var _0x1d298c=_0x2202[_0x580fa9];return _0x1d298c;};'use strict';var Sequelize=require(_0x2220('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x2220('0x1'),_0x2220('0x2'),_0x2220('0x3')];module[_0x2220('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x2220('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x2220('0x6'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x2220('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x2220('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x2220('0x9')],'unique':_0x2220('0xa')}}; \ No newline at end of file +var _0xd003=['exports','BOOLEAN','DATE','INTEGER','UserId','sequelize','error','warning','info','debug'];(function(_0x408cc5,_0x21df00){var _0x187697=function(_0x1a306e){while(--_0x1a306e){_0x408cc5['push'](_0x408cc5['shift']());}};_0x187697(++_0x21df00);}(_0xd003,0x113));var _0x3d00=function(_0x55a523,_0x8ed653){_0x55a523=_0x55a523-0x0;var _0x75c98d=_0xd003[_0x55a523];return _0x75c98d;};'use strict';var Sequelize=require(_0x3d00('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x3d00('0x1'),_0x3d00('0x2'),_0x3d00('0x3'),_0x3d00('0x4')];module[_0x3d00('0x5')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x3d00('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x3d00('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x3d00('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x3d00('0x8')],'unique':_0x3d00('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index db40af6..f64f19c 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 _0xa9e0=['json','update','then','sendStatus','stack','name','status','send','user','role','admin','Unauthorized','params','UserSetting','body','catch','lodash','ioredis','../../config/logger','../../mysqldb','redis','./user-setting.socket','register','defaults','localhost'];(function(_0x5e3887,_0xba1976){var _0x4e4da9=function(_0x4c10f0){while(--_0x4c10f0){_0x5e3887['push'](_0x5e3887['shift']());}};_0x4e4da9(++_0xba1976);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x0a9e('0x0'));var Redis=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var config=require('../../config/environment');var db=require(_0x0a9e('0x3'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x4')]));require(_0x0a9e('0x5'))[_0x0a9e('0x6')](socket);config[_0x0a9e('0x4')]=_[_0x0a9e('0x7')](config['redis'],{'host':_0x0a9e('0x8'),'port':0x18eb});function respondWithResult(_0x441e3a,_0x2cc193){_0x2cc193=_0x2cc193||0xc8;return function(_0x5f41ea){if(_0x5f41ea){return _0x441e3a['status'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea);}};}function saveUpdates(_0x56465b){return function(_0x52cace){if(_0x52cace){return _0x52cace[_0x0a9e('0xa')](_0x56465b)[_0x0a9e('0xb')](function(_0x307b3e){return _0x307b3e;});}return null;};}function handleEntityNotFound(_0x3ab53f){return function(_0xfeb75b){if(!_0xfeb75b){_0x3ab53f[_0x0a9e('0xc')](0x194);}return _0xfeb75b;};}function handleError(_0x4a4c56,_0x50dfb2){_0x50dfb2=_0x50dfb2||0x1f4;return function(_0x527cdd){logger['error'](_0x527cdd[_0x0a9e('0xd')]);if(_0x527cdd[_0x0a9e('0xe')]){delete _0x527cdd[_0x0a9e('0xe')];}_0x4a4c56[_0x0a9e('0xf')](_0x50dfb2)[_0x0a9e('0x10')](_0x527cdd);};}exports[_0x0a9e('0xa')]=function(_0x5db4b0,_0x4283ce){if(_0x5db4b0[_0x0a9e('0x11')][_0x0a9e('0x12')]!==_0x0a9e('0x13'))throw new Error(_0x0a9e('0x14'));if(isNaN(Number(_0x5db4b0[_0x0a9e('0x15')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x0a9e('0x16')]['find']({'where':{'id':_0x5db4b0[_0x0a9e('0x15')]['id']}})['then'](handleEntityNotFound(_0x4283ce,null))[_0x0a9e('0xb')](saveUpdates(_0x5db4b0[_0x0a9e('0x17')],null))['then'](respondWithResult(_0x4283ce,null))[_0x0a9e('0x18')](handleError(_0x4283ce,null));}; \ No newline at end of file +var _0xf120=['../../config/logger','api','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','json','update','then','sendStatus','error','stack','name','status','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','ioredis'];(function(_0x4ea17a,_0x4b9c83){var _0x58e65f=function(_0x46ad6d){while(--_0x46ad6d){_0x4ea17a['push'](_0x4ea17a['shift']());}};_0x58e65f(++_0x4b9c83);}(_0xf120,0x179));var _0x0f12=function(_0x49e9c4,_0x707ed4){_0x49e9c4=_0x49e9c4-0x0;var _0x354219=_0xf120[_0x49e9c4];return _0x354219;};'use strict';var _=require('lodash');var Redis=require(_0x0f12('0x0'));var logger=require(_0x0f12('0x1'))(_0x0f12('0x2'));var config=require('../../config/environment');var db=require(_0x0f12('0x3'))['db'];var socket=require(_0x0f12('0x4'))(new Redis(config[_0x0f12('0x5')]));require('./user-setting.socket')[_0x0f12('0x6')](socket);config[_0x0f12('0x5')]=_[_0x0f12('0x7')](config[_0x0f12('0x5')],{'host':_0x0f12('0x8'),'port':0x18eb});function respondWithResult(_0x341516,_0x1f32b7){_0x1f32b7=_0x1f32b7||0xc8;return function(_0x457122){if(_0x457122){return _0x341516['status'](_0x1f32b7)[_0x0f12('0x9')](_0x457122);}};}function saveUpdates(_0x4bbb62){return function(_0x3b909b){if(_0x3b909b){return _0x3b909b[_0x0f12('0xa')](_0x4bbb62)[_0x0f12('0xb')](function(_0x48ebce){return _0x48ebce;});}return null;};}function handleEntityNotFound(_0x5f158a){return function(_0x23f708){if(!_0x23f708){_0x5f158a[_0x0f12('0xc')](0x194);}return _0x23f708;};}function handleError(_0x728460,_0xd85187){_0xd85187=_0xd85187||0x1f4;return function(_0x42eec3){logger[_0x0f12('0xd')](_0x42eec3[_0x0f12('0xe')]);if(_0x42eec3['name']){delete _0x42eec3[_0x0f12('0xf')];}_0x728460[_0x0f12('0x10')](_0xd85187)[_0x0f12('0x11')](_0x42eec3);};}exports[_0x0f12('0xa')]=function(_0x22f390,_0xc019be){if(_0x22f390[_0x0f12('0x12')][_0x0f12('0x13')]!==_0x0f12('0x14'))throw new Error(_0x0f12('0x15'));if(isNaN(Number(_0x22f390[_0x0f12('0x16')]['id'])))throw new Error(_0x0f12('0x17'));return db[_0x0f12('0x18')][_0x0f12('0x19')]({'where':{'id':_0x22f390[_0x0f12('0x16')]['id']}})['then'](handleEntityNotFound(_0xc019be,null))[_0x0f12('0xb')](saveUpdates(_0x22f390['body'],null))[_0x0f12('0xb')](respondWithResult(_0xc019be,null))[_0x0f12('0x1a')](handleError(_0xc019be,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 2cc4298..3fb1d0c 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 _0x0553=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0553,0x168));var _0x3055=function(_0x3033a,_0x481c8e){_0x3033a=_0x3033a-0x0;var _0x10c4a7=_0x0553[_0x3033a];return _0x10c4a7;};'use strict';var EventEmitter=require(_0x3055('0x0'));var UserSetting=require(_0x3055('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x3055('0x2')](0x0);var events={'afterCreate':_0x3055('0x3'),'afterUpdate':_0x3055('0x4'),'afterDestroy':_0x3055('0x5')};function emitEvent(_0x36d135){return function(_0x4695b3,_0x61b5d,_0x253900){UserSettingEvents[_0x3055('0x6')](_0x36d135+':'+_0x4695b3['id'],_0x4695b3);UserSettingEvents[_0x3055('0x6')](_0x36d135,_0x4695b3);_0x253900(null);};}for(var e in events){if(events[_0x3055('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x3055('0x8')]=UserSettingEvents; \ No newline at end of file +var _0xc03b=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xc03b,0xd5));var _0xbc03=function(_0x43db86,_0x34184b){_0x43db86=_0x43db86-0x0;var _0x27bda2=_0xc03b[_0x43db86];return _0x27bda2;};'use strict';var EventEmitter=require(_0xbc03('0x0'));var UserSetting=require(_0xbc03('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xbc03('0x2')](0x0);var events={'afterCreate':_0xbc03('0x3'),'afterUpdate':'update','afterDestroy':_0xbc03('0x4')};function emitEvent(_0x518963){return function(_0x58d776,_0x16a7c4,_0x44c0a8){UserSettingEvents['emit'](_0x518963+':'+_0x58d776['id'],_0x58d776);UserSettingEvents[_0xbc03('0x5')](_0x518963,_0x58d776);_0x44c0a8(null);};}for(var e in events){if(events[_0xbc03('0x6')](e)){var event=events[e];UserSetting[_0xbc03('0x7')](e,emitEvent(event));}}module[_0xbc03('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 9d332ef..b029a44 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 _0x6b20=['exports','define','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x3b8428,_0xe3c0d){var _0x4127a8=function(_0x2abb1d){while(--_0x2abb1d){_0x3b8428['push'](_0x3b8428['shift']());}};_0x4127a8(++_0xe3c0d);}(_0x6b20,0xd1));var _0x06b2=function(_0x344412,_0x983e88){_0x344412=_0x344412-0x0;var _0x48fc21=_0x6b20[_0x344412];return _0x48fc21;};'use strict';var attributes=require(_0x06b2('0x0'));module[_0x06b2('0x1')]=function(_0x52753b){return _0x52753b[_0x06b2('0x2')]('UserSetting',attributes,{'tableName':_0x06b2('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xdcad44){if(!_0xdcad44[_0x06b2('0x4')])_0xdcad44['clientSideLoggingEnabledSince']=null;else if(_0xdcad44[_0x06b2('0x5')]===null)_0xdcad44[_0x06b2('0x5')]=new Date();}}});}; \ No newline at end of file +var _0xe605=['exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x227c55,_0x49db56){var _0x49e02b=function(_0x5bdd70){while(--_0x5bdd70){_0x227c55['push'](_0x227c55['shift']());}};_0x49e02b(++_0x49db56);}(_0xe605,0x92));var _0x5e60=function(_0x2ebdfd,_0x3e86bf){_0x2ebdfd=_0x2ebdfd-0x0;var _0x4a6531=_0xe605[_0x2ebdfd];return _0x4a6531;};'use strict';var attributes=require(_0x5e60('0x0'));module[_0x5e60('0x1')]=function(_0x5deab2){return _0x5deab2[_0x5e60('0x2')](_0x5e60('0x3'),attributes,{'tableName':_0x5e60('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1133f0){if(!_0x1133f0[_0x5e60('0x5')])_0x1133f0[_0x5e60('0x6')]=null;else if(_0x1133f0[_0x5e60('0x6')]===null)_0x1133f0[_0x5e60('0x6')]=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 dbd9c59..2b9f54e 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 _0x7e7b=['user-setting:','./user-setting.events','save','update','emit','user-setting:update','user-setting:update:user-','UserId','length'];(function(_0x32f494,_0x354f07){var _0x4331ab=function(_0x4a4681){while(--_0x4a4681){_0x32f494['push'](_0x32f494['shift']());}};_0x4331ab(++_0x354f07);}(_0x7e7b,0x133));var _0xb7e7=function(_0x5de3a6,_0xa0b6bf){_0x5de3a6=_0x5de3a6-0x0;var _0x4025f4=_0x7e7b[_0x5de3a6];return _0x4025f4;};'use strict';var UserSettingEvents=require(_0xb7e7('0x0'));var events=[_0xb7e7('0x1'),'remove',_0xb7e7('0x2')];function createListener(_0x3c2af0,_0xd5f959){return function(_0x177dd4){_0xd5f959[_0xb7e7('0x3')](_0x3c2af0,_0x177dd4);if(_0x3c2af0===_0xb7e7('0x4')){_0xd5f959[_0xb7e7('0x3')](_0xb7e7('0x5')+_0x177dd4[_0xb7e7('0x6')],_0x177dd4);}};}exports['register']=function(_0x4c1ca6){for(var _0x2c95f8=0x0,_0x18c554=events[_0xb7e7('0x7')];_0x2c95f8<_0x18c554;_0x2c95f8++){var _0x5b23b0=events[_0x2c95f8];var _0x4eff24=createListener(_0xb7e7('0x8')+_0x5b23b0,_0x4c1ca6);UserSettingEvents['on'](_0x5b23b0,_0x4eff24);}}; \ No newline at end of file +var _0xb79e=['user-setting:update:user-','register','length','user-setting:','./user-setting.events','save','emit','user-setting:update'];(function(_0x462dfc,_0x5ca8e1){var _0x14d933=function(_0x2d55e8){while(--_0x2d55e8){_0x462dfc['push'](_0x462dfc['shift']());}};_0x14d933(++_0x5ca8e1);}(_0xb79e,0x7c));var _0xeb79=function(_0x2c9553,_0x90df0b){_0x2c9553=_0x2c9553-0x0;var _0x42b3d6=_0xb79e[_0x2c9553];return _0x42b3d6;};'use strict';var UserSettingEvents=require(_0xeb79('0x0'));var events=[_0xeb79('0x1'),'remove','update'];function createListener(_0x548e4b,_0x47152a){return function(_0x47ae70){_0x47152a[_0xeb79('0x2')](_0x548e4b,_0x47ae70);if(_0x548e4b===_0xeb79('0x3')){_0x47152a[_0xeb79('0x2')](_0xeb79('0x4')+_0x47ae70['UserId'],_0x47ae70);}};}exports[_0xeb79('0x5')]=function(_0x3b7c15){for(var _0x38c124=0x0,_0x2445e8=events[_0xeb79('0x6')];_0x38c124<_0x2445e8;_0x38c124++){var _0x4df4b8=events[_0x38c124];var _0xba7e80=createListener(_0xeb79('0x7')+_0x4df4b8,_0x3b7c15);UserSettingEvents['on'](_0x4df4b8,_0xba7e80);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 13fc4f6..5fb12aa 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 _0xd668=['create','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','createApiKey','put','update','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','multer','path','connect-timeout','express','Router','fs-extra','isAuthenticated','index','/describe','describe','get','/whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts'];(function(_0x2186a5,_0x4f8dae){var _0x2745cb=function(_0x3ed86b){while(--_0x3ed86b){_0x2186a5['push'](_0x2186a5['shift']());}};_0x2745cb(++_0x4f8dae);}(_0xd668,0x18e));var _0x8d66=function(_0x5a09fd,_0x487978){_0x5a09fd=_0x5a09fd-0x0;var _0x51dc26=_0xd668[_0x5a09fd];return _0x51dc26;};'use strict';var multer=require(_0x8d66('0x0'));var util=require('util');var path=require(_0x8d66('0x1'));var timeout=require(_0x8d66('0x2'));var express=require(_0x8d66('0x3'));var router=express[_0x8d66('0x4')]();var fs_extra=require(_0x8d66('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./user.controller');router['get']('/',auth[_0x8d66('0x6')](),controller[_0x8d66('0x7')]);router['get'](_0x8d66('0x8'),auth['isAuthenticated'](),controller[_0x8d66('0x9')]);router[_0x8d66('0xa')](_0x8d66('0xb'),auth[_0x8d66('0x6')](),controller['whoami']);router[_0x8d66('0xa')](_0x8d66('0xc'),auth[_0x8d66('0x6')](),controller[_0x8d66('0xd')]);router[_0x8d66('0xa')](_0x8d66('0xe'),auth[_0x8d66('0x6')](),controller['show']);router[_0x8d66('0xa')](_0x8d66('0xf'),controller[_0x8d66('0x10')]);router[_0x8d66('0xa')](_0x8d66('0x11'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x12')]);router[_0x8d66('0xa')](_0x8d66('0x13'),auth['isAuthenticated'](),controller[_0x8d66('0x14')]);router['get'](_0x8d66('0x15'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x16')]);router[_0x8d66('0xa')](_0x8d66('0x17'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x18')]);router['get']('/:id/groups',auth[_0x8d66('0x6')](),controller[_0x8d66('0x19')]);router['get']('/:id/recordings',auth[_0x8d66('0x6')](),controller['getRecordings']);router['get']('/:id/screen_recordings',auth[_0x8d66('0x6')](),controller[_0x8d66('0x1a')]);router[_0x8d66('0xa')](_0x8d66('0x1b'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x1c')]);router[_0x8d66('0xa')](_0x8d66('0x1d'),auth[_0x8d66('0x6')](),controller['getOpenchannelInteractions']);router[_0x8d66('0xa')](_0x8d66('0x1e'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x1f')]);router[_0x8d66('0xa')](_0x8d66('0x20'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x21')]);router[_0x8d66('0xa')](_0x8d66('0x22'),auth[_0x8d66('0x6')](),controller['getFaxInteractions']);router[_0x8d66('0xa')](_0x8d66('0x23'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x24')]);router[_0x8d66('0xa')]('/:id/teams',auth[_0x8d66('0x6')](),controller[_0x8d66('0x25')]);router[_0x8d66('0xa')](_0x8d66('0x26'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x27')]);router[_0x8d66('0xa')](_0x8d66('0x28'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x29')]);router[_0x8d66('0xa')](_0x8d66('0x2a'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x2b')]);router[_0x8d66('0xa')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0x8d66('0xa')](_0x8d66('0x2c'),auth[_0x8d66('0x6')](),controller['getMailAccounts']);router['get'](_0x8d66('0x2d'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x2e')]);router[_0x8d66('0xa')](_0x8d66('0x2f'),auth['isAuthenticated'](),controller[_0x8d66('0x30')]);router[_0x8d66('0xa')](_0x8d66('0x31'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x32')]);router['get'](_0x8d66('0x33'),auth['isAuthenticated'](),controller[_0x8d66('0x34')]);router[_0x8d66('0xa')]('/:id/scheduled_calls',auth[_0x8d66('0x6')](),controller[_0x8d66('0x35')]);router['get'](_0x8d66('0x36'),auth['isAuthenticated'](),controller[_0x8d66('0x37')]);router[_0x8d66('0x38')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x8d66('0x39')]);router[_0x8d66('0x38')]('/',auth['isAuthenticated'](),controller[_0x8d66('0x3a')]);router[_0x8d66('0x38')]('/create_many',auth[_0x8d66('0x6')](),controller[_0x8d66('0x3b')]);router[_0x8d66('0x38')]('/:id/queues',auth[_0x8d66('0x6')](),controller[_0x8d66('0x3c')]);var upload=multer({'storage':multer[_0x8d66('0x3d')]({'destination':function(_0x240a82,_0x189acb,_0x4bf260){_0x4bf260(null,path[_0x8d66('0x3e')](config[_0x8d66('0x3f')],_0x8d66('0x40')));},'filename':function(_0xcc8b2,_0x183dfb,_0x4ffe15){_0x4ffe15(null,util[_0x8d66('0x41')](_0x8d66('0x42'),Date[_0x8d66('0x43')](),_0x183dfb[_0x8d66('0x44')]));}})});router['post']('/:id/avatar',upload['single'](_0x8d66('0x45')),controller[_0x8d66('0x46')]);router['post'](_0x8d66('0x47'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x48')]);router[_0x8d66('0x38')]('/:id/logout',auth[_0x8d66('0x6')](),controller[_0x8d66('0x49')]);router['post'](_0x8d66('0x4a'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x4b')]);router['post'](_0x8d66('0x4c'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x4d')]);router['post']('/:id/teams',auth[_0x8d66('0x6')](),controller['addTeams']);router['post'](_0x8d66('0x4e'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x4f')]);router[_0x8d66('0x38')](_0x8d66('0x50'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x51')]);router[_0x8d66('0x38')](_0x8d66('0x52'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x53')]);router[_0x8d66('0x38')]('/:id/sms_interactions',auth[_0x8d66('0x6')](),controller[_0x8d66('0x54')]);router['post'](_0x8d66('0x55'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x56')]);router[_0x8d66('0x38')](_0x8d66('0x57'),auth['isAuthenticated'](),controller[_0x8d66('0x58')]);router['post'](_0x8d66('0x59'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x5a')]);router[_0x8d66('0x38')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x8d66('0x5b')]);router[_0x8d66('0x38')](_0x8d66('0x2d'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x5c')]);router['post'](_0x8d66('0x2f'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x5d')]);router[_0x8d66('0x38')]('/:id/chat_websites',auth[_0x8d66('0x6')](),controller[_0x8d66('0x5e')]);router['post']('/:id/whatsapp_accounts',auth[_0x8d66('0x6')](),controller['addWhatsappAccounts']);router[_0x8d66('0x38')](_0x8d66('0x36'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x5f')]);router[_0x8d66('0x60')](_0x8d66('0xe'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x61')]);router[_0x8d66('0x60')](_0x8d66('0x62'),auth[_0x8d66('0x6')](),controller['changePassword']);router[_0x8d66('0x63')]('/:id/queues',auth['isAuthenticated'](),controller[_0x8d66('0x64')]);router[_0x8d66('0x63')]('/:id/teams',auth[_0x8d66('0x6')](),controller[_0x8d66('0x65')]);router[_0x8d66('0x63')](_0x8d66('0xe'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x66')]);router[_0x8d66('0x63')]('/:id/chat_interactions',auth[_0x8d66('0x6')](),controller[_0x8d66('0x67')]);router[_0x8d66('0x63')](_0x8d66('0x50'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x68')]);router[_0x8d66('0x63')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x8d66('0x69')]);router[_0x8d66('0x63')]('/:id/sms_interactions',auth[_0x8d66('0x6')](),controller[_0x8d66('0x6a')]);router['delete'](_0x8d66('0x55'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0x8d66('0x63')](_0x8d66('0x57'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x6b')]);router[_0x8d66('0x63')]('/:id/fax_accounts',auth[_0x8d66('0x6')](),controller[_0x8d66('0x6c')]);router[_0x8d66('0x63')](_0x8d66('0x2c'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x6d')]);router[_0x8d66('0x63')](_0x8d66('0x2d'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x6e')]);router['delete'](_0x8d66('0x2f'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x6f')]);router[_0x8d66('0x63')](_0x8d66('0x31'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x70')]);router[_0x8d66('0x63')](_0x8d66('0x33'),auth[_0x8d66('0x6')](),controller[_0x8d66('0x71')]);router[_0x8d66('0x63')](_0x8d66('0x36'),auth['isAuthenticated'](),controller['removeApiKey']);router[_0x8d66('0x38')]('/:id/messengerSoundNotification',auth['isAuthenticated'](),controller['messengerSoundNotification']);module['exports']=router; \ No newline at end of file +var _0x2902=['removeWhatsappAccounts','messengerSoundNotification','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','index','describe','/whoami','whoami','/presence','isAuthenticated','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/:id/contacts','addContacts','create','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','file','addAvatar','login','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/fax_accounts','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','removeQueues','delete','/:id/teams','removeTeams','/:id','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites'];(function(_0x5aea5a,_0x346fe0){var _0x557a58=function(_0x4faa12){while(--_0x4faa12){_0x5aea5a['push'](_0x5aea5a['shift']());}};_0x557a58(++_0x346fe0);}(_0x2902,0x77));var _0x2290=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x2902[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x2290('0x0'));var util=require(_0x2290('0x1'));var path=require(_0x2290('0x2'));var timeout=require(_0x2290('0x3'));var express=require('express');var router=express[_0x2290('0x4')]();var fs_extra=require(_0x2290('0x5'));var auth=require(_0x2290('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2290('0x7'));var controller=require(_0x2290('0x8'));router[_0x2290('0x9')]('/',auth['isAuthenticated'](),controller[_0x2290('0xa')]);router[_0x2290('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x2290('0xb')]);router[_0x2290('0x9')](_0x2290('0xc'),auth['isAuthenticated'](),controller[_0x2290('0xd')]);router['get'](_0x2290('0xe'),auth[_0x2290('0xf')](),controller[_0x2290('0x10')]);router[_0x2290('0x9')]('/:id',auth[_0x2290('0xf')](),controller[_0x2290('0x11')]);router[_0x2290('0x9')](_0x2290('0x12'),controller[_0x2290('0x13')]);router[_0x2290('0x9')](_0x2290('0x14'),auth[_0x2290('0xf')](),controller['getOpenTabs']);router[_0x2290('0x9')]('/:id/contacts',auth[_0x2290('0xf')](),controller[_0x2290('0x15')]);router[_0x2290('0x9')](_0x2290('0x16'),auth['isAuthenticated'](),controller['getQueues']);router[_0x2290('0x9')](_0x2290('0x17'),auth[_0x2290('0xf')](),controller[_0x2290('0x18')]);router[_0x2290('0x9')](_0x2290('0x19'),auth[_0x2290('0xf')](),controller[_0x2290('0x1a')]);router[_0x2290('0x9')]('/:id/recordings',auth[_0x2290('0xf')](),controller[_0x2290('0x1b')]);router[_0x2290('0x9')](_0x2290('0x1c'),auth['isAuthenticated'](),controller[_0x2290('0x1d')]);router[_0x2290('0x9')](_0x2290('0x1e'),auth[_0x2290('0xf')](),controller[_0x2290('0x1f')]);router[_0x2290('0x9')](_0x2290('0x20'),auth[_0x2290('0xf')](),controller[_0x2290('0x21')]);router[_0x2290('0x9')]('/:id/mail/interactions',auth[_0x2290('0xf')](),controller[_0x2290('0x22')]);router[_0x2290('0x9')](_0x2290('0x23'),auth['isAuthenticated'](),controller[_0x2290('0x24')]);router[_0x2290('0x9')](_0x2290('0x25'),auth[_0x2290('0xf')](),controller['getFaxInteractions']);router[_0x2290('0x9')](_0x2290('0x26'),auth['isAuthenticated'](),controller[_0x2290('0x27')]);router[_0x2290('0x9')]('/:id/teams',auth[_0x2290('0xf')](),controller[_0x2290('0x28')]);router[_0x2290('0x9')](_0x2290('0x29'),auth[_0x2290('0xf')](),controller[_0x2290('0x2a')]);router[_0x2290('0x9')](_0x2290('0x2b'),auth[_0x2290('0xf')](),controller[_0x2290('0x2c')]);router['get'](_0x2290('0x2d'),auth[_0x2290('0xf')](),controller[_0x2290('0x2e')]);router[_0x2290('0x9')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x2290('0x2f')]);router[_0x2290('0x9')](_0x2290('0x30'),auth[_0x2290('0xf')](),controller['getMailAccounts']);router[_0x2290('0x9')](_0x2290('0x31'),auth['isAuthenticated'](),controller[_0x2290('0x32')]);router[_0x2290('0x9')](_0x2290('0x33'),auth[_0x2290('0xf')](),controller['getSmsAccounts']);router[_0x2290('0x9')](_0x2290('0x34'),auth[_0x2290('0xf')](),controller[_0x2290('0x35')]);router['get']('/:id/whatsapp_accounts',auth[_0x2290('0xf')](),controller[_0x2290('0x36')]);router['get'](_0x2290('0x37'),auth[_0x2290('0xf')](),controller[_0x2290('0x38')]);router[_0x2290('0x9')](_0x2290('0x39'),auth[_0x2290('0xf')](),controller['getApiKey']);router[_0x2290('0x3a')](_0x2290('0x3b'),auth[_0x2290('0xf')](),controller[_0x2290('0x3c')]);router['post']('/',auth[_0x2290('0xf')](),controller[_0x2290('0x3d')]);router[_0x2290('0x3a')]('/create_many',auth['isAuthenticated'](),controller[_0x2290('0x3e')]);router[_0x2290('0x3a')]('/:id/queues',auth[_0x2290('0xf')](),controller[_0x2290('0x3f')]);var upload=multer({'storage':multer[_0x2290('0x40')]({'destination':function(_0x2e1989,_0x40e4cb,_0x383138){_0x383138(null,path[_0x2290('0x41')](config[_0x2290('0x42')],_0x2290('0x43')));},'filename':function(_0x570c86,_0x1d83a1,_0x27e45e){_0x27e45e(null,util[_0x2290('0x44')](_0x2290('0x45'),Date[_0x2290('0x46')](),_0x1d83a1['originalname']));}})});router[_0x2290('0x3a')](_0x2290('0x12'),upload[_0x2290('0x47')](_0x2290('0x48')),controller[_0x2290('0x49')]);router[_0x2290('0x3a')]('/:id/login',auth[_0x2290('0xf')](),controller[_0x2290('0x4a')]);router[_0x2290('0x3a')]('/:id/logout',auth[_0x2290('0xf')](),controller['logout']);router[_0x2290('0x3a')](_0x2290('0x4b'),auth['isAuthenticated'](),controller[_0x2290('0x4c')]);router[_0x2290('0x3a')](_0x2290('0x4d'),auth[_0x2290('0xf')](),controller[_0x2290('0x4e')]);router[_0x2290('0x3a')]('/:id/teams',auth[_0x2290('0xf')](),controller[_0x2290('0x4f')]);router['post'](_0x2290('0x50'),auth[_0x2290('0xf')](),controller[_0x2290('0x51')]);router[_0x2290('0x3a')](_0x2290('0x52'),auth['isAuthenticated'](),controller[_0x2290('0x53')]);router[_0x2290('0x3a')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x2290('0x54')]);router[_0x2290('0x3a')](_0x2290('0x55'),auth[_0x2290('0xf')](),controller[_0x2290('0x56')]);router['post']('/:id/openchannel_interactions',auth[_0x2290('0xf')](),controller['addOpenchannelInteractions']);router[_0x2290('0x3a')]('/:id/whatsapp_interactions',auth[_0x2290('0xf')](),controller['addWhatsappInteractions']);router[_0x2290('0x3a')](_0x2290('0x57'),auth['isAuthenticated'](),controller[_0x2290('0x58')]);router[_0x2290('0x3a')](_0x2290('0x30'),auth[_0x2290('0xf')](),controller['addMailAccounts']);router[_0x2290('0x3a')](_0x2290('0x31'),auth[_0x2290('0xf')](),controller[_0x2290('0x59')]);router[_0x2290('0x3a')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x2290('0x5a')]);router['post'](_0x2290('0x34'),auth[_0x2290('0xf')](),controller[_0x2290('0x5b')]);router[_0x2290('0x3a')](_0x2290('0x5c'),auth['isAuthenticated'](),controller[_0x2290('0x5d')]);router[_0x2290('0x3a')](_0x2290('0x39'),auth['isAuthenticated'](),controller[_0x2290('0x5e')]);router['put']('/:id',auth[_0x2290('0xf')](),controller['update']);router[_0x2290('0x5f')](_0x2290('0x60'),auth[_0x2290('0xf')](),controller[_0x2290('0x61')]);router['delete'](_0x2290('0x16'),auth[_0x2290('0xf')](),controller[_0x2290('0x62')]);router[_0x2290('0x63')](_0x2290('0x64'),auth['isAuthenticated'](),controller[_0x2290('0x65')]);router['delete'](_0x2290('0x66'),auth['isAuthenticated'](),controller[_0x2290('0x67')]);router[_0x2290('0x63')](_0x2290('0x50'),auth[_0x2290('0xf')](),controller[_0x2290('0x68')]);router['delete'](_0x2290('0x52'),auth[_0x2290('0xf')](),controller[_0x2290('0x69')]);router['delete']('/:id/fax_interactions',auth[_0x2290('0xf')](),controller[_0x2290('0x6a')]);router['delete'](_0x2290('0x55'),auth[_0x2290('0xf')](),controller[_0x2290('0x6b')]);router['delete']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x2290('0x6c')]);router[_0x2290('0x63')](_0x2290('0x6d'),auth[_0x2290('0xf')](),controller[_0x2290('0x6e')]);router[_0x2290('0x63')](_0x2290('0x57'),auth[_0x2290('0xf')](),controller['removeFaxAccounts']);router[_0x2290('0x63')](_0x2290('0x30'),auth['isAuthenticated'](),controller[_0x2290('0x6f')]);router[_0x2290('0x63')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x2290('0x70')]);router[_0x2290('0x63')](_0x2290('0x33'),auth[_0x2290('0xf')](),controller[_0x2290('0x71')]);router[_0x2290('0x63')]('/:id/chat_websites',auth[_0x2290('0xf')](),controller[_0x2290('0x72')]);router[_0x2290('0x63')](_0x2290('0x5c'),auth[_0x2290('0xf')](),controller[_0x2290('0x73')]);router[_0x2290('0x63')](_0x2290('0x39'),auth[_0x2290('0xf')](),controller['removeApiKey']);router[_0x2290('0x3a')]('/:id/messengerSoundNotification',auth['isAuthenticated'](),controller[_0x2290('0x74')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index d27a5f6..81f5615 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 _0x2731=['PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','rfc2833','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','uac','uas','certificate','active','passive','actpass','nonat','update,nonat','TEXT','showWebBar','get','udp','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','force_avp','dtlssetup','/etc/pki/tls/certs/motion.crt','permissions','map','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','UNSIGNED','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','ENUM','user','agent','local','INTEGER','internal','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0x39899c,_0x566d02){var _0x5e1fe4=function(_0x3bb39d){while(--_0x3bb39d){_0x39899c['push'](_0x39899c['shift']());}};_0x5e1fe4(++_0x566d02);}(_0x2731,0x1a9));var _0x1273=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2731[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x1273('0x0'));var moment=require(_0x1273('0x1'));var util=require(_0x1273('0x2'));var _=require(_0x1273('0x3'));module['exports']={'name':{'type':Sequelize[_0x1273('0x4')],'allowNull':![],'unique':_0x1273('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x32fe82){this[_0x1273('0x6')](_0x1273('0x5'),_0x32fe82);this[_0x1273('0x6')](_0x1273('0x7'),_0x32fe82);},'comment':_0x1273('0x8')},'fullname':{'type':Sequelize[_0x1273('0x4')],'allowNull':![],'set':function(_0x5180dc){this[_0x1273('0x6')](_0x1273('0x9'),_0x5180dc);this['setDataValue'](_0x1273('0xa'),util[_0x1273('0xb')](_0x1273('0xc'),_0x5180dc,this[_0x1273('0xd')]('internal')));}},'alias':{'type':Sequelize[_0x1273('0x4')]},'email':{'type':Sequelize[_0x1273('0x4')],'allowNull':![],'unique':_0x1273('0xe'),'validate':{'isEmail':!![]},'set':function(_0x202aac){if(_0x202aac){this[_0x1273('0x6')](_0x1273('0xe'),_0x202aac[_0x1273('0xf')]());}}},'role':{'type':Sequelize[_0x1273('0x10')]('admin',_0x1273('0x11'),_0x1273('0x12'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x1273('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x1273('0x13')},'internal':{'type':Sequelize[_0x1273('0x14')](0xb),'allowNull':![],'unique':_0x1273('0x15'),'set':function(_0x19ce21){this['setDataValue']('internal',_0x19ce21);this['setDataValue'](_0x1273('0x16'),_0x19ce21);this[_0x1273('0x6')](_0x1273('0xa'),util[_0x1273('0xb')]('\x22%s\x22\x20<%s>',this['getDataValue'](_0x1273('0x9')),_0x19ce21));}},'salt':{'type':Sequelize[_0x1273('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x1273('0x4')]},'address':{'type':Sequelize[_0x1273('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x1273('0x4')]},'city':{'type':Sequelize[_0x1273('0x4')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1273('0x18')]},'voicePause':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x1273('0x19')},'lastPauseAt':{'type':Sequelize[_0x1273('0x18')]},'chatCapacity':{'type':Sequelize[_0x1273('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1273('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1273('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1273('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1273('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1273('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x1273('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x1273('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1273('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1273('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![],'defaultValue':_0x1273('0x1a')},'ipaddr':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x1273('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1273('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x1b'),'user',_0x1273('0x1c')),'allowNull':!![],'defaultValue':_0x1273('0x1b')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x1d'),_0x1273('0x1e'),_0x1273('0x1f'),_0x1273('0x20'),_0x1273('0x21'),_0x1273('0x22'),_0x1273('0x23'),_0x1273('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x46dab4){this['setDataValue'](_0x1273('0x25'),_0x46dab4?_0x46dab4[_0x1273('0x26')](','):null);},'get':function(){return this[_0x1273('0xd')](_0x1273('0x25'))?this[_0x1273('0xd')](_0x1273('0x25'))[_0x1273('0x27')](','):null;},'comment':_0x1273('0x28')},'dtmfmode':{'type':Sequelize[_0x1273('0x10')]('rfc2833',_0x1273('0x29'),_0x1273('0x2a'),_0x1273('0x2b'),'auto'),'allowNull':!![],'defaultValue':_0x1273('0x2c')},'directmedia':{'type':Sequelize[_0x1273('0x10')]('yes','no','nonat',_0x1273('0x2d'),_0x1273('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![],'defaultValue':_0x1273('0x30'),'set':function(_0x644712){this[_0x1273('0x6')](_0x1273('0x31'),_0x644712?_0x644712[_0x1273('0x26')](','):null);},'get':function(){return this['getDataValue'](_0x1273('0x31'))?this[_0x1273('0xd')](_0x1273('0x31'))[_0x1273('0x27')](','):null;},'comment':_0x1273('0x32')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x1273('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1273('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1273('0x4')]},'disallow':{'type':Sequelize[_0x1273('0x4')],'allowNull':![],'defaultValue':_0x1273('0x33')},'allow':{'type':Sequelize[_0x1273('0x4')],'allowNull':![],'defaultValue':_0x1273('0x34'),'set':function(_0x209c67){this[_0x1273('0x6')](_0x1273('0x35'),_0x209c67?_0x209c67[_0x1273('0x26')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x1273('0xd')]('allow')?this[_0x1273('0xd')]('allow')[_0x1273('0x27')](';'):null;},'comment':_0x1273('0x36')},'autoframing':{'type':Sequelize[_0x1273('0x10')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![],'set':function(_0x35d2fa){this[_0x1273('0x6')](_0x1273('0x37'),_0x35d2fa?_0x35d2fa['join'](','):null);},'get':function(){return this[_0x1273('0xd')](_0x1273('0x37'))?this[_0x1273('0xd')]('insecure')[_0x1273('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no',_0x1273('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x1273('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x1273('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![],'defaultValue':_0x1273('0x39')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x1273('0x2f')},'busylevel':{'type':Sequelize[_0x1273('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1273('0x10')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no',_0x1273('0x3a')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1273('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1273('0x3b'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x1273('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x3c'),_0x1273('0x3d')),'allowNull':!![],'defaultValue':_0x1273('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x1273('0x2f')},'keepalive':{'type':Sequelize[_0x1273('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x1273('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1273('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1273('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1273('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1273('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no','fingerprint',_0x1273('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1273('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x3f'),_0x1273('0x40'),_0x1273('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x1273('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no',_0x1273('0x42'),_0x1273('0x2d'),_0x1273('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1273('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x1273('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x1273('0x44')]},'showWebBar':{'type':Sequelize[_0x1273('0x14')],'defaultValue':0x0,'set':function(_0x5ececb){this[_0x1273('0x6')](_0x1273('0x45'),_0x5ececb);var _0x4417e3=this[_0x1273('0x46')]({'plain':!![]});switch(_0x5ececb){case 0x0:case 0x1:var _0x1176cd=_0x4417e3[_0x1273('0x25')]?_['isArray'](_0x4417e3[_0x1273('0x25')])?_0x4417e3[_0x1273('0x25')]['join']():_0x4417e3['transport']:_0x1273('0x47');if(_0x1176cd===_0x1273('0x48')){_0x1176cd=_0x1273('0x47');}this['setDataValue'](_0x1273('0x25'),_0x1176cd);this['setDataValue'](_0x1273('0x49'),'no');this[_0x1273('0x6')](_0x1273('0x4a'),null);this[_0x1273('0x6')]('force_avp',null);this[_0x1273('0x6')](_0x1273('0x4b'),null);this['setDataValue'](_0x1273('0x4c'),null);this['setDataValue'](_0x1273('0x4d'),null);this[_0x1273('0x6')]('dtlssetup',null);this[_0x1273('0x6')](_0x1273('0x4e'),null);this['setDataValue'](_0x1273('0x4f'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0x1273('0x6')](_0x1273('0x25'),_0x1273('0x48'));this[_0x1273('0x6')](_0x1273('0x49'),_0x1273('0x2f'));this['setDataValue'](_0x1273('0x4a'),'yes');this['setDataValue'](_0x1273('0x50'),_0x1273('0x2f'));this[_0x1273('0x6')]('icesupport',_0x1273('0x2f'));this['setDataValue']('dtlsenable','yes');this[_0x1273('0x6')](_0x1273('0x4d'),'no');this[_0x1273('0x6')](_0x1273('0x51'),_0x1273('0x41'));this['setDataValue']('dtlscertfile',_0x4417e3['dtlscertfile']||_0x1273('0x52'));this[_0x1273('0x6')]('dtlsprivatekey',_0x4417e3[_0x1273('0x4f')]||'/etc/pki/tls/private/motion.key');this['setDataValue']('rtcp_mux',_0x1273('0x2f'));break;default:}}},'permissions':{'type':Sequelize[_0x1273('0x44')],'set':function(_0x2c298a){this['setDataValue'](_0x1273('0x53'),_0x2c298a?_0x2c298a[_0x1273('0x26')](','):[]);},'get':function(){return this[_0x1273('0xd')](_0x1273('0x53'))?_[_0x1273('0x54')](this['getDataValue'](_0x1273('0x53'))[_0x1273('0x27')](','),function(_0x4685b6){return parseInt(_0x4685b6,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x1273('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1273('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1273('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1273('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1273('0x10')](_0x1273('0x2f'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1273('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x1273('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x1273('0x55'))?this[_0x1273('0xd')](_0x1273('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x1273('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1273('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1cc4bd){if(typeof _0x1cc4bd==='string'){var _0x38f7bc=_0x1cc4bd==='1'?!![]:_0x1cc4bd==='0'?![]:_0x1cc4bd===_0x1273('0x56')?!![]:_0x1cc4bd===_0x1273('0x57')?![]:![];this['setDataValue'](_0x1273('0x58'),_0x38f7bc);}else{this[_0x1273('0x6')]('screenrecording',_0x1cc4bd);}}},'blocked':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![],'set':function(_0x6c0974){this[_0x1273('0x6')](_0x1273('0x59'),_0x6c0974);if(_0x6c0974===!![]){this[_0x1273('0x6')](_0x1273('0x5a'),moment());this[_0x1273('0x6')]('loginAttempts',0x0);}else{this[_0x1273('0x6')](_0x1273('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0x1273('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x1273('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x1273('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1273('0x14')](0x5)[_0x1273('0x5b')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x1273('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1273('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1273('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1273('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1273('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1273('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1273('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x1273('0x14')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x1273('0x17')],'defaultValue':![]}}; \ No newline at end of file +var _0xa2a6=['PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','uac','uas','fingerprint','active','actpass','update,nonat','TEXT','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','force_avp','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','ENUM','admin','user','telephone','internal','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED'];(function(_0x45aa72,_0x8af642){var _0x75adaa=function(_0x1f6809){while(--_0x1f6809){_0x45aa72['push'](_0x45aa72['shift']());}};_0x75adaa(++_0x8af642);}(_0xa2a6,0x94));var _0x6a2a=function(_0x5b689c,_0x197203){_0x5b689c=_0x5b689c-0x0;var _0x14b057=_0xa2a6[_0x5b689c];return _0x14b057;};'use strict';var Sequelize=require(_0x6a2a('0x0'));var moment=require(_0x6a2a('0x1'));var util=require('util');var _=require(_0x6a2a('0x2'));module[_0x6a2a('0x3')]={'name':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':![],'unique':_0x6a2a('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3b780f){this[_0x6a2a('0x6')](_0x6a2a('0x5'),_0x3b780f);this[_0x6a2a('0x6')]('defaultuser',_0x3b780f);},'comment':_0x6a2a('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x940c12){this[_0x6a2a('0x6')](_0x6a2a('0x8'),_0x940c12);this['setDataValue'](_0x6a2a('0x9'),util[_0x6a2a('0xa')](_0x6a2a('0xb'),_0x940c12,this[_0x6a2a('0xc')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':![],'unique':_0x6a2a('0xd'),'validate':{'isEmail':!![]},'set':function(_0x23dbcf){if(_0x23dbcf){this[_0x6a2a('0x6')](_0x6a2a('0xd'),_0x23dbcf['toLowerCase']());}}},'role':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0xf'),_0x6a2a('0x10'),'agent',_0x6a2a('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x6a2a('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x6a2a('0x12'),'set':function(_0x2c12b3){this[_0x6a2a('0x6')](_0x6a2a('0x12'),_0x2c12b3);this[_0x6a2a('0x6')](_0x6a2a('0x13'),_0x2c12b3);this[_0x6a2a('0x6')](_0x6a2a('0x9'),util['format'](_0x6a2a('0xb'),this[_0x6a2a('0xc')]('fullname'),_0x2c12b3));}},'salt':{'type':Sequelize[_0x6a2a('0x4')]},'phone':{'type':Sequelize[_0x6a2a('0x4')]},'mobile':{'type':Sequelize[_0x6a2a('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x6a2a('0x4')]},'userpic':{'type':Sequelize[_0x6a2a('0x4')]},'city':{'type':Sequelize[_0x6a2a('0x4')]},'country':{'type':Sequelize[_0x6a2a('0x4')]},'online':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x6a2a('0x15')]},'voicePause':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x6a2a('0x4')],'defaultValue':_0x6a2a('0x16')},'lastPauseAt':{'type':Sequelize[_0x6a2a('0x15')]},'chatCapacity':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x6a2a('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x6a2a('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x6a2a('0x18'),_0x6a2a('0x10'),_0x6a2a('0x19')),'allowNull':!![],'defaultValue':_0x6a2a('0x18')},'context':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x1a'),_0x6a2a('0x1b'),'ALLOWED_FAILED_SCREEN',_0x6a2a('0x1c'),_0x6a2a('0x1d'),'PROHIB_PASSED_SCREEN',_0x6a2a('0x1e'),_0x6a2a('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6a2a('0x20'),'set':function(_0x2ce023){this[_0x6a2a('0x6')](_0x6a2a('0x21'),_0x2ce023?_0x2ce023[_0x6a2a('0x22')](','):null);},'get':function(){return this[_0x6a2a('0xc')]('transport')?this[_0x6a2a('0xc')]('transport')[_0x6a2a('0x23')](','):null;},'comment':_0x6a2a('0x24')},'dtmfmode':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x25'),_0x6a2a('0x26'),'shortinfo',_0x6a2a('0x27'),'auto'),'allowNull':!![],'defaultValue':_0x6a2a('0x25')},'directmedia':{'type':Sequelize['ENUM'](_0x6a2a('0x28'),'no',_0x6a2a('0x29'),_0x6a2a('0x2a'),_0x6a2a('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![],'defaultValue':_0x6a2a('0x2c'),'set':function(_0x358ecd){this['setDataValue'](_0x6a2a('0x2d'),_0x358ecd?_0x358ecd['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x6a2a('0xc')](_0x6a2a('0x2d'))[_0x6a2a('0x23')](','):null;},'comment':_0x6a2a('0x2e')},'callgroup':{'type':Sequelize[_0x6a2a('0x4')]},'namedcallgroup':{'type':Sequelize[_0x6a2a('0x4')]},'pickupgroup':{'type':Sequelize[_0x6a2a('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x6a2a('0x4')]},'language':{'type':Sequelize[_0x6a2a('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6a2a('0x4')]},'disallow':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':![],'defaultValue':_0x6a2a('0x2f'),'set':function(_0x3f7744){this[_0x6a2a('0x6')](_0x6a2a('0x30'),_0x3f7744?_0x3f7744[_0x6a2a('0x22')](';'):_0x6a2a('0x2f'));},'get':function(){return this[_0x6a2a('0xc')](_0x6a2a('0x30'))?this[_0x6a2a('0xc')](_0x6a2a('0x30'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![],'set':function(_0x2bd376){this[_0x6a2a('0x6')](_0x6a2a('0x31'),_0x2bd376?_0x2bd376[_0x6a2a('0x22')](','):null);},'get':function(){return this[_0x6a2a('0xc')](_0x6a2a('0x31'))?this[_0x6a2a('0xc')](_0x6a2a('0x31'))[_0x6a2a('0x23')](','):null;},'comment':_0x6a2a('0x32')},'trustrpid':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no',_0x6a2a('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6a2a('0x34')},'amaflags':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![],'defaultValue':_0x6a2a('0x28')},'busylevel':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x6a2a('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x6a2a('0xe')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no',_0x6a2a('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x6a2a('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x36'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x37'),_0x6a2a('0x38')),'allowNull':!![],'defaultValue':_0x6a2a('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![],'defaultValue':_0x6a2a('0x28')},'keepalive':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x6a2a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x6a2a('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x6a2a('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x6a2a('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x6a2a('0xe')]('yes','no',_0x6a2a('0x39'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x3a'),'passive',_0x6a2a('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x6a2a('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x6a2a('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x6a2a('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x6a2a('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x6a2a('0x28'),'no',_0x6a2a('0x29'),'update',_0x6a2a('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x6a2a('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x6a2a('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x6a2a('0x3d')]},'showWebBar':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0,'set':function(_0xf13ad2){this[_0x6a2a('0x6')](_0x6a2a('0x3e'),_0xf13ad2);var _0x37cc31=this[_0x6a2a('0x3f')]({'plain':!![]});switch(_0xf13ad2){case 0x0:case 0x1:var _0x3d0b79=_0x37cc31['transport']?_[_0x6a2a('0x40')](_0x37cc31[_0x6a2a('0x21')])?_0x37cc31[_0x6a2a('0x21')][_0x6a2a('0x22')]():_0x37cc31[_0x6a2a('0x21')]:_0x6a2a('0x20');if(_0x3d0b79==='wss'){_0x3d0b79=_0x6a2a('0x20');}this['setDataValue'](_0x6a2a('0x21'),_0x3d0b79);this['setDataValue'](_0x6a2a('0x41'),'no');this[_0x6a2a('0x6')](_0x6a2a('0x42'),null);this[_0x6a2a('0x6')]('force_avp',null);this[_0x6a2a('0x6')](_0x6a2a('0x43'),null);this['setDataValue'](_0x6a2a('0x44'),null);this[_0x6a2a('0x6')](_0x6a2a('0x45'),null);this[_0x6a2a('0x6')](_0x6a2a('0x46'),null);this['setDataValue'](_0x6a2a('0x47'),null);this['setDataValue'](_0x6a2a('0x48'),null);this['setDataValue'](_0x6a2a('0x49'),'no');break;case 0x2:this[_0x6a2a('0x6')](_0x6a2a('0x21'),_0x6a2a('0x4a'));this[_0x6a2a('0x6')]('encryption',_0x6a2a('0x28'));this[_0x6a2a('0x6')](_0x6a2a('0x42'),_0x6a2a('0x28'));this['setDataValue'](_0x6a2a('0x4b'),_0x6a2a('0x28'));this['setDataValue'](_0x6a2a('0x43'),_0x6a2a('0x28'));this[_0x6a2a('0x6')]('dtlsenable','yes');this[_0x6a2a('0x6')]('dtlsverify','no');this[_0x6a2a('0x6')]('dtlssetup',_0x6a2a('0x3b'));this[_0x6a2a('0x6')](_0x6a2a('0x47'),_0x37cc31['dtlscertfile']||_0x6a2a('0x4c'));this['setDataValue'](_0x6a2a('0x48'),_0x37cc31['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0x6a2a('0x6')](_0x6a2a('0x49'),_0x6a2a('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x6a2a('0x3d')],'set':function(_0x1e8c70){this[_0x6a2a('0x6')](_0x6a2a('0x4d'),_0x1e8c70?_0x1e8c70[_0x6a2a('0x22')](','):[]);},'get':function(){return this[_0x6a2a('0xc')]('permissions')?_[_0x6a2a('0x4e')](this[_0x6a2a('0xc')](_0x6a2a('0x4d'))[_0x6a2a('0x23')](','),function(_0x164703){return parseInt(_0x164703,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x6a2a('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x6a2a('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x6a2a('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x6a2a('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x6a2a('0xe')](_0x6a2a('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6a2a('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x6a2a('0x4f')],'get':function(){return this['getDataValue'](_0x6a2a('0x50'))?this['getDataValue'](_0x6a2a('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x6a2a('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![],'set':function(_0x5e94c9){if(typeof _0x5e94c9===_0x6a2a('0x51')){var _0x4686a2=_0x5e94c9==='1'?!![]:_0x5e94c9==='0'?![]:_0x5e94c9===_0x6a2a('0x52')?!![]:_0x5e94c9===_0x6a2a('0x53')?![]:![];this[_0x6a2a('0x6')](_0x6a2a('0x54'),_0x4686a2);}else{this[_0x6a2a('0x6')](_0x6a2a('0x54'),_0x5e94c9);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x934c1d){this[_0x6a2a('0x6')](_0x6a2a('0x55'),_0x934c1d);if(_0x934c1d===!![]){this[_0x6a2a('0x6')](_0x6a2a('0x56'),moment());this['setDataValue'](_0x6a2a('0x57'),0x0);}else{this[_0x6a2a('0x6')](_0x6a2a('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x6a2a('0x17')](0x5)[_0x6a2a('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x6a2a('0x17')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x6a2a('0x14')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index cd421a7..e855e54 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 _0x333d=['fax','mail','whatsapp','all','show','params','merge','options','find','openchannel','body','describe','addContacts','ids','omit','internal','findById','securePassword','max','isNil','min_internal','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','email','permissions','101','103','113','110','104','105','106','107','108','100','111','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','UserProfileSection','isEmpty','compact','changePassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Wrong\x20credentials','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','spread','emit','Queue:save','voice','SIP/%s','penalty','UserVoiceQueueRt','removeQueues','Queues','isArray','QueueId','Queue:remove','userpic','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','getOpenTabs','CHAT','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','format','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','Tag','Tags','color','tag','getQueues','model','keys','filters','intersection','fields','order','sort','pick','Queue','limit','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','nolimit','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:forcelogout','x-forwarded-for','remoteAddress','socket','connection','commit','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','LOGININPAUSE','concat','isMiddleware','pause','PAUSE','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','getTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','Team','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','upsert','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','removeAgent','getLists','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','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','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$or','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$like','$notLike','$notILike','$overlap','$contains','$contained','firstName','Contact','dialActive','VoiceQueue','getApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','apiKeyNonce','apiKeyIat','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','unknown','ringing','queues','resolve','inbound','flatten','toString','lower','col','asc','desc','substring','offline','voiceStatus','unavailable','busy','slice','charAt','select','field','ui.','ui.createdAt','user_has_','ui.UserId\x20=\x20?','OpenTabs','enabled','moment','util','path','lodash','squel','jayson/promise','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIForbiddenrror','handleError','../../mysqldb','socket.io-emitter','redis','register','defaults','client','http','status','end','json','offset','undefined','count','set','Content-Range','request','then','info','User,\x20%s,\x20%s','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','update','get','role','admin','Users','user','Agents','agent','Telephones','telephone','filter','ignore','map','value','includes','name','destroy','sendStatus','stack','send','User','rawAttributes','fieldName','type','key','password','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','index','getOptions','where','includeAll','include','query','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','length','chat','dataValues','sms'];(function(_0x1782c5,_0x4d3e8c){var _0x339789=function(_0x2c3d88){while(--_0x2c3d88){_0x1782c5['push'](_0x1782c5['shift']());}};_0x339789(++_0x4d3e8c);}(_0x333d,0x12f));var _0xd333=function(_0x2d8434,_0x43d781){_0x2d8434=_0x2d8434-0x0;var _0x26b9e4=_0x333d[_0x2d8434];return _0x26b9e4;};'use strict';var moment=require(_0xd333('0x0'));var util=require(_0xd333('0x1'));var path=require(_0xd333('0x2'));var fs=require('fs');var _=require(_0xd333('0x3'));var squel=require(_0xd333('0x4'));var Redis=require('ioredis');var jayson=require(_0xd333('0x5'));var authService=require('../../components/auth/service');var contacts=require(_0xd333('0x6'));var qs=require(_0xd333('0x7'));var rta=require(_0xd333('0x8'));var logger=require(_0xd333('0x9'))(_0xd333('0xa'));var utils=require(_0xd333('0xb'));var config=require(_0xd333('0xc'));var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0xd333('0xd'))[_0xd333('0xe')];var APINotFoundError=require(_0xd333('0xd'))[_0xd333('0xf')];var APIForbiddenError=require(_0xd333('0xd'))[_0xd333('0x10')];var APIHandleError=require('../../errors/api')[_0xd333('0x11')];var db=require(_0xd333('0x12'))['db'];var socket=require(_0xd333('0x13'))(new Redis(config[_0xd333('0x14')]));require('./user.socket')[_0xd333('0x15')](socket);config[_0xd333('0x14')]=_[_0xd333('0x16')](config[_0xd333('0x14')],{'host':'localhost','port':0x18eb});var amiClient=jayson[_0xd333('0x17')][_0xd333('0x18')]({'port':0x232a});var values;function respondWithStatusCode(_0x54757c,_0x47b4ba){_0x47b4ba=_0x47b4ba||0xcc;return function(_0x49ff27){if(_0x49ff27){return _0x54757c['sendStatus'](_0x47b4ba);}return _0x54757c[_0xd333('0x19')](_0x47b4ba)[_0xd333('0x1a')]();};}function respondWithResult(_0x5a814c,_0x2c1731){_0x2c1731=_0x2c1731||0xc8;return function(_0x479d9c){if(_0x479d9c){return _0x5a814c[_0xd333('0x19')](_0x2c1731)[_0xd333('0x1b')](_0x479d9c);}};}function respondWithFilteredResult(_0x595ebe,_0x3b2d5f){return function(_0x360c83){if(_0x360c83){var _0x378ee7=typeof _0x3b2d5f[_0xd333('0x1c')]===_0xd333('0x1d')&&typeof _0x3b2d5f['limit']===_0xd333('0x1d');var _0x1424bf=_0x360c83[_0xd333('0x1e')];var _0x53a64a=_0x378ee7?0x0:_0x3b2d5f['offset'];var _0x160b0c=_0x378ee7?_0x360c83[_0xd333('0x1e')]:_0x3b2d5f[_0xd333('0x1c')]+_0x3b2d5f['limit'];var _0x47bf69;if(_0x160b0c>=_0x1424bf){_0x160b0c=_0x1424bf;_0x47bf69=0xc8;}else{_0x47bf69=0xce;}_0x595ebe[_0xd333('0x19')](_0x47bf69);return _0x595ebe[_0xd333('0x1f')](_0xd333('0x20'),_0x53a64a+'-'+_0x160b0c+'/'+_0x1424bf)[_0xd333('0x1b')](_0x360c83);}return null;};}function respondWithRpcPromise(_0x3a2cfc,_0x45eb8a,_0x2a11f4,_0x5c6f33){return new Promise(function(_0x55eda4,_0x526ee8){var _0x2581a5=_0x5c6f33||amiClient;return _0x2581a5[_0xd333('0x21')](_0x3a2cfc,_0x2a11f4)[_0xd333('0x22')](function(_0x1dca75){logger[_0xd333('0x23')](_0xd333('0x24'),_0x45eb8a,'request\x20sent');logger['debug'](_0xd333('0x25'),_0x45eb8a,_0xd333('0x26'),JSON[_0xd333('0x27')](_0x1dca75));if(_0x1dca75['error']){if(_0x1dca75[_0xd333('0x28')]['code']===0x1f4){logger[_0xd333('0x28')]('User,\x20%s,\x20%s',_0x45eb8a,_0x1dca75[_0xd333('0x28')][_0xd333('0x29')]);return _0x526ee8(_0x1dca75[_0xd333('0x28')]['message']);}logger[_0xd333('0x28')](_0xd333('0x24'),_0x45eb8a,_0x1dca75[_0xd333('0x28')][_0xd333('0x29')]);return _0x55eda4(_0x1dca75[_0xd333('0x28')]['message']);}else{logger[_0xd333('0x23')](_0xd333('0x24'),_0x45eb8a,_0xd333('0x26'));_0x55eda4(_0x1dca75[_0xd333('0x2a')]['message']);}})[_0xd333('0x2b')](function(_0x5f349c){logger['error'](_0xd333('0x24'),_0x45eb8a,_0x5f349c);_0x526ee8(_0x5f349c);});});}function saveUpdates(_0x4a95e0){return function(_0x55a0a1){if(_0x55a0a1){return _0x55a0a1[_0xd333('0x2c')](_0x4a95e0)[_0xd333('0x22')](function(_0x23220f){if(_0x23220f['role']==='agent'){socket['emit']('userNotification:recalc:'+_0x23220f['id'],_0x23220f);}return _0x23220f;});}return null;};}function removeEntity(_0x3af2eb,_0x5517c0){return function(_0x5acaa6){if(_0x5acaa6){return _0x5acaa6['destroy']({'transaction':_0x5517c0})[_0xd333('0x22')](function(){var _0x15d061=_0x5acaa6[_0xd333('0x2d')]({'plain':!![]});if(_0x15d061[_0xd333('0x2e')]===_0xd333('0x2f'))return;var _0x271265=[{'name':_0xd333('0x30'),'value':_0xd333('0x31'),'ignore':!![]},{'name':_0xd333('0x32'),'value':_0xd333('0x33'),'ignore':![]},{'name':_0xd333('0x34'),'value':_0xd333('0x35'),'ignore':![]}];var _0x14de5f=_(_0x271265)[_0xd333('0x36')](_0xd333('0x37'))[_0xd333('0x38')](_0xd333('0x39'))['value']();if(_[_0xd333('0x3a')](_0x14de5f,_0x15d061[_0xd333('0x2e')])){return;}var _0xa2ac9d=_['find'](_0x271265,[_0xd333('0x39'),_0x15d061[_0xd333('0x2e')]])[_0xd333('0x3b')];return db['UserProfileResource'][_0xd333('0x3c')]({'where':{'type':_0xa2ac9d,'resourceId':_0x15d061['id']},'transaction':_0x5517c0})[_0xd333('0x22')](function(){return _0x5acaa6;});})[_0xd333('0x22')](function(){_0x3af2eb['status'](0xcc)[_0xd333('0x1a')]();});}};}function handleEntityNotFound(_0x2d5449){return function(_0x2761ba){if(!_0x2761ba){_0x2d5449[_0xd333('0x3d')](0x194);}return _0x2761ba;};}function handleError(_0x2da892,_0x738572){_0x738572=_0x738572||0x1f4;return function(_0x14c527){logger[_0xd333('0x28')](_0x14c527[_0xd333('0x3e')]);if(_0x14c527[_0xd333('0x3b')]){delete _0x14c527[_0xd333('0x3b')];}_0x2da892[_0xd333('0x19')](_0x738572)[_0xd333('0x3f')](_0x14c527);};}function getUserAttributes(){return _(db[_0xd333('0x40')][_0xd333('0x41')])[_0xd333('0x38')](function(_0x49018f){return{'name':_0x49018f[_0xd333('0x42')],'type':_0x49018f[_0xd333('0x43')][_0xd333('0x44')]};})[_0xd333('0x36')](function(_0x308a18){return![_0xd333('0x45'),_0xd333('0x46'),_0xd333('0x47'),_0xd333('0x48'),_0xd333('0x49'),'md5secret'][_0xd333('0x3a')](_0x308a18[_0xd333('0x3b')]);})[_0xd333('0x39')]();}exports[_0xd333('0x4a')]=function(_0xd3317c,_0xef19f4){var _0x328a1c={},_0x4304b5={'count':0x0,'rows':[]};var _0x2ba474=getUserAttributes();_0x328a1c=qs[_0xd333('0x4b')](_0x2ba474,_0xd3317c);var _0x706f2c={'where':_0x328a1c[_0xd333('0x4c')]};return db[_0xd333('0x40')]['count'](_0x706f2c)[_0xd333('0x22')](function(_0x139b9d){_0x4304b5[_0xd333('0x1e')]=_0x139b9d;if(_0xd3317c['query'][_0xd333('0x4d')]){_0x328a1c[_0xd333('0x4e')]=[{'all':!![]}];}if(_0xd3317c[_0xd333('0x4f')][_0xd333('0x50')]===_0xd333('0x51')){_0x328a1c[_0xd333('0x4e')]=[{'model':db[_0xd333('0x52')],'as':_0xd333('0x50')}];}if(!_[_0xd333('0x3a')](_0x328a1c[_0xd333('0x53')],'id')){_0x328a1c['attributes'][_0xd333('0x54')]('id');}return db[_0xd333('0x40')][_0xd333('0x55')](_0x328a1c);})[_0xd333('0x22')](function(_0x3350b3){_0x4304b5[_0xd333('0x56')]=_0x3350b3;if(_0xd3317c[_0xd333('0x4f')][_0xd333('0x57')]==='true'){var _0x2e4bc2=[];for(var _0xd23574=0x0;_0xd23574<_0x4304b5[_0xd333('0x56')][_0xd333('0x58')];_0xd23574++){_0x2e4bc2['push'](get_open_tabs(_0xd333('0x59'),_0x4304b5[_0xd333('0x56')][_0xd23574][_0xd333('0x5a')]));_0x2e4bc2[_0xd333('0x54')](get_open_tabs(_0xd333('0x5b'),_0x4304b5[_0xd333('0x56')][_0xd23574][_0xd333('0x5a')]));_0x2e4bc2[_0xd333('0x54')](get_open_tabs(_0xd333('0x5c'),_0x4304b5['rows'][_0xd23574]['dataValues']));_0x2e4bc2[_0xd333('0x54')](get_open_tabs(_0xd333('0x5d'),_0x4304b5[_0xd333('0x56')][_0xd23574][_0xd333('0x5a')]));_0x2e4bc2[_0xd333('0x54')](get_open_tabs('openchannel',_0x4304b5['rows'][_0xd23574][_0xd333('0x5a')]));_0x2e4bc2['push'](get_open_tabs(_0xd333('0x5e'),_0x4304b5['rows'][_0xd23574][_0xd333('0x5a')]));}return Promise[_0xd333('0x5f')](_0x2e4bc2)[_0xd333('0x22')](function(){return _0x4304b5;});}else{return _0x4304b5;}})[_0xd333('0x22')](respondWithFilteredResult(_0xef19f4,_0x328a1c))[_0xd333('0x2b')](handleError(_0xef19f4,null));};exports[_0xd333('0x60')]=function(_0x5afec0,_0x3322b1){var _0x1c1e4=getUserAttributes();_0x5afec0['query']['id']=_0x5afec0[_0xd333('0x61')]['id'];var _0xf3db3a=qs[_0xd333('0x4b')](_0x1c1e4,_0x5afec0);if(_0x5afec0['query'][_0xd333('0x4d')]){_0xf3db3a['include']=[{'all':!![]}];}if(_0x5afec0[_0xd333('0x4f')][_0xd333('0x50')]===_0xd333('0x51')){_0xf3db3a[_0xd333('0x4e')]=[{'model':db[_0xd333('0x52')],'as':'userSetting'}];}_0xf3db3a=_[_0xd333('0x62')]({},_0xf3db3a,_0x5afec0[_0xd333('0x63')]);if(!_['includes'](_0xf3db3a['attributes'],'id')){_0xf3db3a[_0xd333('0x53')][_0xd333('0x54')]('id');}return db[_0xd333('0x40')][_0xd333('0x64')](_0xf3db3a)[_0xd333('0x22')](handleEntityNotFound(_0x3322b1,null))['then'](function(_0x8a3b3e){var _0x5e664c=[];values=_0x8a3b3e;if(_0x5afec0[_0xd333('0x4f')][_0xd333('0x57')]===_0xd333('0x51')){_0x5e664c[_0xd333('0x54')](get_open_tabs(_0xd333('0x59'),_0x8a3b3e[_0xd333('0x5a')]));_0x5e664c[_0xd333('0x54')](get_open_tabs(_0xd333('0x5b'),_0x8a3b3e[_0xd333('0x5a')]));_0x5e664c[_0xd333('0x54')](get_open_tabs(_0xd333('0x65'),_0x8a3b3e[_0xd333('0x5a')]));_0x5e664c[_0xd333('0x54')](get_open_tabs(_0xd333('0x5e'),_0x8a3b3e['dataValues']));_0x5e664c[_0xd333('0x54')](get_open_tabs(_0xd333('0x5c'),_0x8a3b3e[_0xd333('0x5a')]));_0x5e664c[_0xd333('0x54')](get_open_tabs(_0xd333('0x5d'),_0x8a3b3e[_0xd333('0x5a')]));return Promise[_0xd333('0x5f')](_0x5e664c);}else{return values;}})[_0xd333('0x22')](function(){return values;})['then'](respondWithResult(_0x3322b1,null))['catch'](handleError(_0x3322b1,null));};exports[_0xd333('0x2c')]=function(_0x25b908,_0x26bde2){if(_0x25b908['body']['id']){delete _0x25b908[_0xd333('0x66')]['id'];}delete _0x25b908[_0xd333('0x66')]['role'];return db[_0xd333('0x40')]['find']({'where':{'id':_0x25b908[_0xd333('0x61')]['id']}})[_0xd333('0x22')](handleEntityNotFound(_0x26bde2,null))[_0xd333('0x22')](saveUpdates(_0x25b908[_0xd333('0x66')],null))['then'](respondWithResult(_0x26bde2,null))[_0xd333('0x2b')](handleError(_0x26bde2,null));};exports['describe']=function(_0xa004bd,_0x2f8447){return db['User'][_0xd333('0x67')]()[_0xd333('0x22')](respondWithResult(_0x2f8447,null))[_0xd333('0x2b')](handleError(_0x2f8447,null));};exports['addContacts']=function(_0x152ae2,_0x274832){return db[_0xd333('0x40')]['find']({'where':{'id':_0x152ae2[_0xd333('0x61')]['id']}})[_0xd333('0x22')](handleEntityNotFound(_0x274832,null))['then'](function(_0x40df01){if(_0x40df01){return _0x40df01[_0xd333('0x68')](_0x152ae2['body'][_0xd333('0x69')],_[_0xd333('0x6a')](_0x152ae2[_0xd333('0x66')],['ids','id'])||{});}})[_0xd333('0x22')](respondWithResult(_0x274832,null))[_0xd333('0x2b')](handleError(_0x274832,null));};function validateUser(_0x35a16e){return new Promise(function(_0x536dae,_0x765ae){if(_0x35a16e[_0xd333('0x6b')])return _0x536dae(_0x35a16e);return db['Setting'][_0xd333('0x6c')](0x1)[_0xd333('0x22')](function(_0x48d48c){if(_0x48d48c[_0xd333('0x6d')])authService['validatePasswordPattern'](_0x35a16e[_0xd333('0x45')]);db[_0xd333('0x40')][_0xd333('0x6e')]('internal')[_0xd333('0x22')](function(_0x1c35d0){if(_[_0xd333('0x6f')](_0x1c35d0)){_0x35a16e[_0xd333('0x6b')]=_0x48d48c['min_internal']||0x1;return;}if(_[_0xd333('0x6f')](_0x48d48c[_0xd333('0x70')])||_0x48d48c[_0xd333('0x70')]===_0x1c35d0){_0x35a16e[_0xd333('0x6b')]=_0x1c35d0+0x1;return;}if(_0x48d48c[_0xd333('0x70')]>_0x1c35d0){_0x35a16e['internal']=_0x48d48c['min_internal'];return;}return db[_0xd333('0x71')][_0xd333('0x4f')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xd333('0x71')][_0xd333('0x72')][_0xd333('0x73')]})[_0xd333('0x22')](function(_0x2ece6e){if(_0x2ece6e&&_0x2ece6e[_0xd333('0x58')]){for(var _0x43f653=0x0,_0x48f28e=_0x2ece6e[_0xd333('0x58')];_0x43f653<_0x48f28e&&_['isNil'](_0x35a16e['internal']);_0x43f653++){if(_0x48d48c[_0xd333('0x70')]<=_0x2ece6e[_0x43f653]['from']){_0x35a16e['internal']=_0x2ece6e[_0x43f653][_0xd333('0x74')];}else if(_0x48d48c['min_internal']>_0x2ece6e[_0x43f653][_0xd333('0x74')]&&_0x48d48c[_0xd333('0x70')]<=_0x2ece6e[_0x43f653]['to']){_0x35a16e['internal']=_0x48d48c[_0xd333('0x70')];}}}if(_[_0xd333('0x6f')](_0x35a16e[_0xd333('0x6b')])){_0x35a16e[_0xd333('0x6b')]=_0x1c35d0+0x1;}return _0x536dae(_0x35a16e);});});})[_0xd333('0x2b')](function(_0x169895){_0x765ae(_0x169895);});});}function updateUser(_0x29332b){return new Promise(function(_0x1afe40,_0x1f14b8){try{if(_0x29332b[_0xd333('0x75')]){_0x29332b[_0xd333('0x76')]=_0x29332b[_0xd333('0x6b')];_0x29332b[_0xd333('0x77')]={'mailbox':_0x29332b[_0xd333('0x6b')],'password':_0x29332b[_0xd333('0x45')],'fullname':_0x29332b['fullname'],'email':_0x29332b[_0xd333('0x78')]};}if(_0x29332b[_0xd333('0x2e')]==='agent'){if(!_0x29332b[_0xd333('0x79')])_0x29332b[_0xd333('0x79')]=[_0xd333('0x7a'),'102',_0xd333('0x7b'),_0xd333('0x7c'),_0xd333('0x7d'),_0xd333('0x7e'),_0xd333('0x7f'),_0xd333('0x80'),_0xd333('0x81'),_0xd333('0x82'),'109',_0xd333('0x83'),_0xd333('0x84'),'114',_0xd333('0x85')];}_0x1afe40(_0x29332b);}catch(_0x53a0a0){_0x1f14b8(_0x53a0a0);}});}exports[_0xd333('0x86')]=function(_0x579bdb,_0x33b7c9){if(_0x579bdb[_0xd333('0x31')][_0xd333('0x2e')]===_0xd333('0x33'))throw new Error(_0xd333('0x87'));if(_0x579bdb[_0xd333('0x66')][_0xd333('0x2e')]===_0xd333('0x31')&&_0x579bdb['user'][_0xd333('0x2e')]!=='admin'){throw new Error(_0xd333('0x88'));}if(_0x579bdb[_0xd333('0x66')]['role']===_0xd333('0x2f')&&_0x579bdb['user'][_0xd333('0x2e')]!==_0xd333('0x2f')){throw new Error(_0xd333('0x89'));}return licenseUtil[_0xd333('0x8a')]([_0x579bdb[_0xd333('0x66')]])['then'](function(){return validateUser(_0x579bdb[_0xd333('0x66')]);})[_0xd333('0x22')](function(_0x51661b){return updateUser(_0x51661b)[_0xd333('0x22')](function(_0xf3ba6e){if(_0xf3ba6e[_0xd333('0x2e')]===_0xd333('0x2f')){_0xf3ba6e[_0xd333('0x8b')]=_0x579bdb['user']['settingsEnabled'];delete _0xf3ba6e[_0xd333('0x8c')];}return _0xf3ba6e;});})[_0xd333('0x22')](function(_0x345b9f){return db['User'][_0xd333('0x86')](_0x345b9f,{'include':[{'model':db[_0xd333('0x77')],'as':_0xd333('0x77')}]});})['then'](function(_0x21cce4){if(_0x579bdb[_0xd333('0x66')][_0xd333('0x2e')]===_0xd333('0x31'))return _0x21cce4;if(_0x579bdb['user']['role']!==_0xd333('0x31'))return _0x21cce4;return db['UserProfileSection'][_0xd333('0x64')]({'where':{'name':_0x21cce4['role']==='agent'?_0xd333('0x32'):_0xd333('0x34'),'userProfileId':_0x579bdb[_0xd333('0x31')][_0xd333('0x8c')]},'raw':!![]})[_0xd333('0x22')](function(_0x5101f5){if(!_0x5101f5||_0x5101f5[_0xd333('0x8d')]!=0x0)return _0x21cce4;return db[_0xd333('0x8e')][_0xd333('0x86')]({'name':_0x21cce4[_0xd333('0x3b')],'resourceId':_0x21cce4['id'],'type':_0x5101f5[_0xd333('0x3b')],'sectionId':_0x5101f5['id']},{})['then'](function(){return _0x21cce4;});})[_0xd333('0x2b')](function(_0x593577){logger[_0xd333('0x28')](_0xd333('0x8f'),_0x593577);throw _0x593577;});})['then'](respondWithResult(_0x33b7c9,0xc9))[_0xd333('0x2b')](handleError(_0x33b7c9,null));};exports[_0xd333('0x90')]=function(_0x380fdc,_0x47f2f1){var _0x21d33e=_0x380fdc['body'];var _0x352f93=[];if(_0x380fdc[_0xd333('0x31')][_0xd333('0x2e')]===_0xd333('0x33'))throw new Error(_0xd333('0x87'));if(_[_0xd333('0x91')](_0x21d33e,[_0xd333('0x2e'),_0xd333('0x31')])&&_0x380fdc['user']['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x21d33e,[_0xd333('0x2e'),_0xd333('0x2f')])&&_0x380fdc['user'][_0xd333('0x2e')]!==_0xd333('0x2f')){throw new Error(_0xd333('0x92'));}return licenseUtil[_0xd333('0x8a')](_0x21d33e)[_0xd333('0x22')](function(){return validateUser(_0x21d33e[0x0]);})[_0xd333('0x22')](function(){for(var _0x424e91=0x1;_0x424e91<_0x21d33e[_0xd333('0x58')];_0x424e91++){var _0x28ddb6=_0x21d33e[_0x424e91-0x1][_0xd333('0x6b')];if(!_0x21d33e[_0x424e91][_0xd333('0x6b')])_0x21d33e[_0x424e91][_0xd333('0x6b')]=_0x28ddb6+0x1;_0x352f93[_0xd333('0x54')](validateUser(_0x21d33e[_0x424e91]));}return Promise[_0xd333('0x5f')](_0x352f93);})['then'](function(){_0x352f93=[];for(var _0x39a5a5=0x0;_0x39a5a5<_0x21d33e[_0xd333('0x58')];_0x39a5a5++){_0x352f93[_0xd333('0x54')](updateUser(_0x21d33e[_0x39a5a5]));}return Promise['all'](_0x352f93);})[_0xd333('0x22')](function(){_0x352f93=_0x21d33e[_0xd333('0x38')](function(_0x4a9ad8){return db[_0xd333('0x40')][_0xd333('0x86')](_0x4a9ad8,{'include':[{'model':db[_0xd333('0x77')],'as':'VoiceMail'}]})[_0xd333('0x22')](function(_0x30ffcd){_0x4a9ad8['id']=_0x30ffcd['id'];return _0x4a9ad8;});});return Promise['all'](_0x352f93);})[_0xd333('0x22')](function(_0xf0e027){if(_0x380fdc[_0xd333('0x66')]['role']==='user')return _0xf0e027;if(_0x380fdc[_0xd333('0x31')][_0xd333('0x2e')]!==_0xd333('0x31'))return _0xf0e027;var _0x405918=_[_0xd333('0x91')](_0xf0e027,function(_0x1b9466){return _0x1b9466['role']==='agent'||_0x1b9466[_0xd333('0x2e')]===_0xd333('0x35');});if(!_0x405918)return _0xf0e027;return db[_0xd333('0x93')][_0xd333('0x55')]({'where':{'name':{'$or':[_0xd333('0x32'),'Telephones']},'userProfileId':_0x380fdc['user']['userProfileId']},'raw':!![]})[_0xd333('0x22')](function(_0x11f5e6){if(_[_0xd333('0x94')](_0x11f5e6)||!_['some'](_0x11f5e6,['autoAssociation',0x0]))return _0xf0e027;_0x352f93=[];var _0x3c0bf9=_(_0x11f5e6)[_0xd333('0x38')](function(_0x92938f){if(_0x92938f['autoAssociation']===0x1)return;return _0x92938f[_0xd333('0x3b')]===_0xd333('0x32')?'agent':_0xd333('0x35');})[_0xd333('0x95')]()[_0xd333('0x39')]();for(var _0x5e3de7=0x0;_0x5e3de7<_0xf0e027['length'];_0x5e3de7++){if(!_[_0xd333('0x3a')](_0x3c0bf9,_0xf0e027[_0x5e3de7][_0xd333('0x2e')]))return;var _0x36123b=_0xf0e027[_0x5e3de7]['role']==='agent'?'Agents':_0xd333('0x34');_0x352f93[_0xd333('0x54')](db[_0xd333('0x8e')][_0xd333('0x86')]({'name':_0xf0e027[_0x5e3de7][_0xd333('0x3b')],'resourceId':_0xf0e027[_0x5e3de7]['id'],'type':_0x36123b,'sectionId':_[_0xd333('0x64')](_0x11f5e6,[_0xd333('0x3b'),_0x36123b])['id']},{}));}return Promise[_0xd333('0x5f')](_0x352f93);});})[_0xd333('0x22')](respondWithResult(_0x47f2f1,0xc9))[_0xd333('0x2b')](handleError(_0x47f2f1,null));};exports[_0xd333('0x96')]=function(_0xb4ca01,_0x235045){if(_0xb4ca01['body']['id']){delete _0xb4ca01['body']['id'];}return db[_0xd333('0x40')]['find']({'where':{'id':_0xb4ca01[_0xd333('0x61')]['id']}})[_0xd333('0x22')](function(_0x2ce6b7){if(!_0x2ce6b7)return null;if(_0x2ce6b7['id']===_0xb4ca01[_0xd333('0x31')]['id']){if(!_0xb4ca01[_0xd333('0x66')]['oldPassword']||!_0xb4ca01[_0xd333('0x66')]['newPassword']){throw new db[(_0xd333('0x97'))][(_0xd333('0x98'))](_0xd333('0x99'));}if(!_0x2ce6b7['authenticate'](_0xb4ca01[_0xd333('0x66')]['oldPassword'])){throw new db[(_0xd333('0x97'))][(_0xd333('0x98'))](_0xd333('0x9a'));}if(_0xb4ca01[_0xd333('0x66')][_0xd333('0x9b')]===_0xb4ca01['body'][_0xd333('0x9c')]){throw new db[(_0xd333('0x97'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0xb4ca01['user'][_0xd333('0x2e')]===_0xd333('0x2f')){if(!_0xb4ca01['body']['newPassword']){throw new db[(_0xd333('0x97'))][(_0xd333('0x98'))](_0xd333('0x9d'));}}else if(_0xb4ca01[_0xd333('0x31')]['role']==='user'){if(!_0xb4ca01[_0xd333('0x66')][_0xd333('0x9c')]){throw new db['Sequelize'][(_0xd333('0x98'))](_0xd333('0x9d'));}if(_0x2ce6b7[_0xd333('0x2e')]!==_0xd333('0x33')){throw new db[(_0xd333('0x97'))][(_0xd333('0x98'))](_0xd333('0x87'));}}else{throw new db['Sequelize'][(_0xd333('0x98'))](_0xd333('0x87'));}return _0x2ce6b7;})[_0xd333('0x22')](handleEntityNotFound(_0x235045,null))[_0xd333('0x22')](function(_0xf93e60){return db[_0xd333('0x9e')][_0xd333('0x9f')]({'attributes':['id',_0xd333('0x6d'),_0xd333('0xa0'),_0xd333('0xa1')]})['then'](function(_0xd1feca){if(_0xd1feca['securePassword'])authService[_0xd333('0xa2')](_0xb4ca01[_0xd333('0x66')][_0xd333('0x9c')]);if(!_0xd1feca['enforcePasswordHistory']||!_0xf93e60[_0xd333('0x47')])return _0xf93e60;authService['validatePasswordHistory'](_0xb4ca01[_0xd333('0x66')]['newPassword'],_0xf93e60[_0xd333('0x47')],_0xd1feca[_0xd333('0xa1')]);return _0xf93e60;})[_0xd333('0x22')](saveUpdates({'password':_0xb4ca01[_0xd333('0x66')][_0xd333('0x9c')],'passwordResetAt':_0xb4ca01[_0xd333('0x31')]['id']==_0xb4ca01['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0xb4ca01[_0xd333('0x66')]['newPassword'],_0xf93e60[_0xd333('0x47')])},null));})['then'](respondWithResult(_0x235045,null))[_0xd333('0x2b')](handleError(_0x235045,null));};exports['addQueues']=function(_0x3d3071,_0x2244cc){var _0x5308b4=_0x3d3071[_0xd333('0x66')][_0xd333('0xa3')];return db[_0xd333('0x40')][_0xd333('0x64')]({'where':{'id':_0x3d3071[_0xd333('0x61')]['id']},'attributes':['id',_0xd333('0x3b'),'role',_0xd333('0xa4'),_0xd333('0xa5'),_0xd333('0xa6'),_0xd333('0xa7')]})[_0xd333('0x22')](handleEntityNotFound(_0x2244cc,null))[_0xd333('0x22')](function(_0x87ce70){if(_0x87ce70){if(!utils[_0xd333('0xa8')](_0x5308b4)){throw new db['Sequelize'][(_0xd333('0x98'))](_0xd333('0xa9'));}return _0x87ce70[_0xd333('0xaa')+_[_0xd333('0xab')](_0x5308b4[_0xd333('0xac')]())+'Queues'](_0x3d3071[_0xd333('0x66')][_0xd333('0x69')],{'penalty':_0x3d3071[_0xd333('0x66')]['penalty']||0x0})[_0xd333('0xad')](function(_0x3cf3a8){for(var _0x546f8f=0x0;_0x546f8f<_0x3d3071['body'][_0xd333('0x69')][_0xd333('0x58')];_0x546f8f+=0x1){var _0x50e79e={'UserId':Number(_0x3d3071['params']['id'])};_0x50e79e[_[_0xd333('0xab')](_0x5308b4[_0xd333('0xac')]())+'QueueId']=Number(_0x3d3071[_0xd333('0x66')][_0xd333('0x69')][_0x546f8f]);socket[_0xd333('0xae')]('user'+_['capitalize'](_0x5308b4[_0xd333('0xac')]())+_0xd333('0xaf'),_0x50e79e);}return _0x3cf3a8;})[_0xd333('0x22')](function(){if(_0x5308b4==='voice'){return db['VoiceQueue']['findAll']({'where':{'id':_0x3d3071[_0xd333('0x66')][_0xd333('0x69')]||[]},'raw':!![],'attributes':['id',_0xd333('0x3b')]});}})['then'](function(_0x2a55bf){var _0x3ed87a=_0x87ce70[_0xd333('0x2d')]({'plain':!![]});var _0x149714=[];if(_0x5308b4===_0xd333('0xb0')&&_0x3ed87a[_0xd333('0x2e')]===_0xd333('0x33')&&_0x3ed87a[_0xd333('0xa4')]){for(let _0x15ecd3=0x0;_0x15ecd3<_0x2a55bf[_0xd333('0x58')];_0x15ecd3+=0x1){_0x149714['push']({'membername':_0x3ed87a[_0xd333('0x3b')],'UserId':_0x3ed87a['id'],'queue_name':_0x2a55bf[_0x15ecd3][_0xd333('0x3b')],'VoiceQueueId':_0x2a55bf[_0x15ecd3]['id'],'interface':_[_0xd333('0x6f')](_0x3ed87a[_0xd333('0xa7')])?util['format'](_0xd333('0xb1'),_0x3ed87a[_0xd333('0x3b')]):_0x3ed87a[_0xd333('0xa7')],'paused':_0x3ed87a[_0xd333('0xa6')]||![],'penalty':_0x3d3071[_0xd333('0x66')][_0xd333('0xb2')]||0x0});}return Promise['all'](_0x149714[_0xd333('0x38')](function(_0x384ddc){return db[_0xd333('0xb3')]['upsert'](_0x384ddc);}));}return _0x87ce70;});}})[_0xd333('0x22')](respondWithStatusCode(_0x2244cc,null))[_0xd333('0x2b')](handleError(_0x2244cc,null));};exports[_0xd333('0xb4')]=function(_0x46d7b5,_0x50283d){var _0x221142,_0x3cf4ae;return db['User']['find']({'where':{'id':_0x46d7b5[_0xd333('0x61')]['id']},'attributes':['id',_0xd333('0x3b'),'role']})['then'](handleEntityNotFound(_0x50283d,null))[_0xd333('0x22')](function(_0x34a563){if(_0x34a563){_0x221142=_0x34a563;if(!_0x46d7b5['query'][_0xd333('0xa3')]||!utils[_0xd333('0xa8')](_0x46d7b5[_0xd333('0x4f')][_0xd333('0xa3')])){throw new db[(_0xd333('0x97'))][(_0xd333('0x98'))](_0xd333('0xa9'));}return _0x34a563['remove'+_[_0xd333('0xab')](_0x46d7b5['query'][_0xd333('0xa3')][_0xd333('0xac')]())+_0xd333('0xb5')](_0x46d7b5[_0xd333('0x4f')][_0xd333('0x69')]);}})[_0xd333('0x22')](function(_0x1bbc9e){if(_[_0xd333('0xb6')](_0x46d7b5[_0xd333('0x4f')][_0xd333('0x69')])){for(var _0x5e5bb3=0x0;_0x5e5bb3<_0x46d7b5[_0xd333('0x4f')]['ids'][_0xd333('0x58')];_0x5e5bb3+=0x1){_0x3cf4ae={'UserId':Number(_0x46d7b5['params']['id'])};_0x3cf4ae[_[_0xd333('0xab')](_0x46d7b5[_0xd333('0x4f')][_0xd333('0xa3')][_0xd333('0xac')]())+_0xd333('0xb7')]=Number(_0x46d7b5[_0xd333('0x4f')]['ids'][_0x5e5bb3]);socket['emit'](_0xd333('0x31')+_[_0xd333('0xab')](_0x46d7b5[_0xd333('0x4f')]['channel'][_0xd333('0xac')]())+_0xd333('0xb8'),_0x3cf4ae);}}else{_0x3cf4ae={'UserId':Number(_0x46d7b5['params']['id'])};_0x3cf4ae[_[_0xd333('0xab')](_0x46d7b5[_0xd333('0x4f')][_0xd333('0xa3')][_0xd333('0xac')]())+'QueueId']=Number(_0x46d7b5[_0xd333('0x4f')][_0xd333('0x69')]);socket[_0xd333('0xae')](_0xd333('0x31')+_[_0xd333('0xab')](_0x46d7b5['query'][_0xd333('0xa3')][_0xd333('0xac')]())+_0xd333('0xb8'),_0x3cf4ae);}return _0x1bbc9e;})['then'](function(){if(_0x46d7b5[_0xd333('0x4f')]['channel']===_0xd333('0xb0')){return db[_0xd333('0xb3')][_0xd333('0x3c')]({'where':{'UserId':_0x46d7b5[_0xd333('0x61')]['id'],'VoiceQueueId':_0x46d7b5[_0xd333('0x4f')][_0xd333('0x69')]},'individualHooks':!![]})[_0xd333('0x22')](function(){return _0x221142;});}return _0x221142;})[_0xd333('0x22')](respondWithStatusCode(_0x50283d,null))['catch'](handleError(_0x50283d,null));};exports['addAvatar']=function(_0xb685c,_0x3464c0){_0xb685c['body'][_0xd333('0xb9')]=_0xb685c['file']['filename'];return db[_0xd333('0x40')][_0xd333('0x64')]({'where':{'id':_0xb685c[_0xd333('0x61')]['id']}})['then'](handleEntityNotFound(_0x3464c0,null))[_0xd333('0x22')](saveUpdates(_0xb685c['body'],null))[_0xd333('0x22')](respondWithResult(_0x3464c0,null))[_0xd333('0x2b')](handleError(_0x3464c0,null));};exports[_0xd333('0xba')]=function(_0x2da550,_0x583214){var _0x39dad6=path[_0xd333('0xbb')](config[_0xd333('0xbc')],_0xd333('0xbd'));return db[_0xd333('0x40')]['find']({'where':{'id':_0x2da550[_0xd333('0x61')]['id']},'attributes':['id',_0xd333('0xb9')],'raw':!![]})[_0xd333('0x22')](handleEntityNotFound(_0x583214,null))[_0xd333('0x22')](function(_0x16e4dc){if(_0x16e4dc){if(_[_0xd333('0x6f')](_0x16e4dc[_0xd333('0xb9')])){return _0x583214[_0xd333('0xbe')](_0x39dad6);}else{if(!fs[_0xd333('0xbf')](path[_0xd333('0xbb')](config[_0xd333('0xbc')],'server/files/images/',_0x16e4dc[_0xd333('0xb9')]))){return _0x583214[_0xd333('0xbe')](_0x39dad6);}return _0x583214[_0xd333('0xbe')](path[_0xd333('0xbb')](config[_0xd333('0xbc')],'server/files/images/',_0x16e4dc['userpic']));}}})[_0xd333('0x2b')](handleError(_0x583214,null));};exports[_0xd333('0xc0')]=function(_0x478eab,_0x38dc24){return db['User'][_0xd333('0x64')]({'where':{'id':_0x478eab['params']['id']},'attributes':['id']})[_0xd333('0x22')](handleEntityNotFound(_0x38dc24,null))[_0xd333('0x22')](function(_0x3a1026){var _0x20583b=[];values=_0x3a1026[_0xd333('0x5a')];_0x20583b['push'](get_open_tabs('chat',_0x3a1026[_0xd333('0x5a')]));_0x20583b['push'](get_open_tabs('sms',_0x3a1026[_0xd333('0x5a')]));_0x20583b[_0xd333('0x54')](get_open_tabs('openchannel',_0x3a1026[_0xd333('0x5a')]));_0x20583b[_0xd333('0x54')](get_open_tabs('whatsapp',_0x3a1026[_0xd333('0x5a')]));_0x20583b['push'](get_open_tabs(_0xd333('0x5c'),_0x3a1026[_0xd333('0x5a')]));_0x20583b['push'](get_open_tabs('mail',_0x3a1026['dataValues']));return Promise[_0xd333('0x5f')](_0x20583b);})[_0xd333('0x22')](function(_0x111c07){if(_0x111c07){var _0x3511a7=_[_0xd333('0x38')](values['ChatOpenTabs'],function(_0x2d52ec){return{'channel':_0xd333('0xc1'),'id':_0x2d52ec['id'],'createdAt':_0x2d52ec['createdAt']};});var _0x1f7cdc=_['map'](values[_0xd333('0xc2')],function(_0x1bd760){return{'channel':_0xd333('0xc3'),'id':_0x1bd760['id'],'createdAt':_0x1bd760[_0xd333('0xc4')]};});var _0x3fdab5=_[_0xd333('0x38')](values[_0xd333('0xc5')],function(_0x906481){return{'channel':_0xd333('0xc6'),'id':_0x906481['id'],'createdAt':_0x906481[_0xd333('0xc4')]};});var _0x315774=_['map'](values[_0xd333('0xc7')],function(_0x49eec4){return{'channel':_0xd333('0xc8'),'id':_0x49eec4['id'],'createdAt':_0x49eec4[_0xd333('0xc4')]};});var _0x3ea57d=_[_0xd333('0x38')](values[_0xd333('0xc9')],function(_0x12d3f4){return{'channel':'SMS','id':_0x12d3f4['id'],'createdAt':_0x12d3f4['createdAt']};});var _0x2fc706=_[_0xd333('0x38')](values[_0xd333('0xca')],function(_0x342f14){return{'channel':_0xd333('0xcb'),'id':_0x342f14['id'],'createdAt':_0x342f14[_0xd333('0xc4')]};});var _0x284390=_['concat'](_0x3511a7,_0x1f7cdc,_0x3fdab5,_0x315774,_0x3ea57d,_0x2fc706);var _0x4c82ce={'count':_0x284390[_0xd333('0x58')],'rows':_0x284390};return _0x4c82ce;}else return null;})[_0xd333('0x22')](respondWithResult(_0x38dc24,null))[_0xd333('0x2b')](handleError(_0x38dc24,null));};exports['getContacts']=function(_0x3e8ab8,_0x94f992){var _0x19fea4={};return db[_0xd333('0x40')][_0xd333('0x9f')]({'where':{'id':_0x3e8ab8[_0xd333('0x61')]['id']}})[_0xd333('0x22')](function(_0x3ffb28){if(!_0x3ffb28){throw new APINotFoundError(util[_0xd333('0xcc')](_0xd333('0xcd'),_0x3e8ab8[_0xd333('0x61')]['id']));}return contacts[_0xd333('0x67')]();})[_0xd333('0x22')](function(_0x34570d){_0x3e8ab8['query']['User']=_0x3e8ab8[_0xd333('0x61')]['id'];_0x19fea4=qs[_0xd333('0x4b')](_0x34570d,_0x3e8ab8);if(_0x3e8ab8[_0xd333('0x4f')][_0xd333('0xce')]('includeAll')){_0x19fea4['include']=[{'model':db[_0xd333('0xcf')],'as':'List','required':![]},{'model':db[_0xd333('0xd0')],'as':_0xd333('0xd1'),'attributes':['id','name',_0xd333('0xd2')],'where':_0x3e8ab8[_0xd333('0x4f')][_0xd333('0xd3')]?{'id':_0x3e8ab8[_0xd333('0x4f')][_0xd333('0xd3')]}:undefined,'required':_0x3e8ab8[_0xd333('0x4f')][_0xd333('0xd3')]?!![]:![]}];}return contacts[_0xd333('0x55')](_0x3e8ab8[_0xd333('0x4f')],_0x3e8ab8[_0xd333('0x31')],_0x19fea4,_0x34570d);})[_0xd333('0x22')](respondWithFilteredResult(_0x94f992,_0x19fea4))[_0xd333('0x2b')](APIHandleError(_0x94f992));};exports[_0xd333('0xd4')]=function(_0x56db24,_0x1411fb){var _0x4eafb5;var _0x2d9da4={};var _0x5adfca;return db[_0xd333('0x40')][_0xd333('0x9f')]({'where':{'id':_0x56db24[_0xd333('0x61')]['id']},'attributes':['id',_0xd333('0x3b'),_0xd333('0x2e')]})[_0xd333('0x22')](handleEntityNotFound(_0x1411fb,null))[_0xd333('0x22')](function(_0x504165){if(!utils[_0xd333('0xa8')](_0x56db24[_0xd333('0x4f')]['channel'])){throw new db[(_0xd333('0x97'))][(_0xd333('0x98'))](_0xd333('0xa9'));}_0x4eafb5=_0x504165;var _0x1f95c6={};_0x1f95c6[_0xd333('0xd5')]=_[_0xd333('0xd6')](db[_[_0xd333('0xab')](_0x56db24[_0xd333('0x4f')][_0xd333('0xa3')])+'Queue']['rawAttributes']);_0x1f95c6[_0xd333('0x4f')]=_[_0xd333('0xd6')](_0x56db24[_0xd333('0x4f')]);_0x1f95c6[_0xd333('0xd7')]=_[_0xd333('0xd8')](_0x1f95c6[_0xd333('0xd5')],_0x1f95c6[_0xd333('0x4f')]);_0x2d9da4['attributes']=_[_0xd333('0xd8')](_0x1f95c6[_0xd333('0xd5')],qs['fields'](_0x56db24[_0xd333('0x4f')][_0xd333('0xd9')]));_0x2d9da4[_0xd333('0x53')]=_0x2d9da4[_0xd333('0x53')][_0xd333('0x58')]?_0x2d9da4[_0xd333('0x53')]:_0x1f95c6['model'];_0x2d9da4[_0xd333('0xda')]=qs[_0xd333('0xdb')](_0x56db24['query'][_0xd333('0xdb')]);_0x2d9da4[_0xd333('0x4c')]=qs[_0xd333('0xd7')](_[_0xd333('0xdc')](_0x56db24[_0xd333('0x4f')],_0x1f95c6[_0xd333('0xd7')]));if(_0x56db24[_0xd333('0x4f')][_0xd333('0x36')]){_0x2d9da4[_0xd333('0x4c')]=_[_0xd333('0x62')](_0x2d9da4[_0xd333('0x4c')],{'$or':_[_0xd333('0x38')](_0x2d9da4['attributes'],function(_0x1b52ae){var _0x38c099={};_0x38c099[_0x1b52ae]={'$like':'%'+_0x56db24['query'][_0xd333('0x36')]+'%'};return _0x38c099;})});}_0x2d9da4=_[_0xd333('0x62')]({},_0x2d9da4,_0x56db24[_0xd333('0x63')]);switch(_0x4eafb5['role']){case'admin':return db[_['capitalize'](_0x56db24[_0xd333('0x4f')]['channel'])+_0xd333('0xdd')][_0xd333('0x55')](_0x2d9da4);case _0xd333('0x31'):case _0xd333('0x33'):return _0x4eafb5[_0xd333('0x2d')+_[_0xd333('0xab')](_0x56db24['query'][_0xd333('0xa3')])+_0xd333('0xb5')](_0x2d9da4);default:throw new db[(_0xd333('0x97'))]['ValidationError']('Unknown\x20role');}})[_0xd333('0x22')](function(_0x4fbd63){_0x5adfca=_0x4fbd63[_0xd333('0x58')];if(!_0x56db24[_0xd333('0x4f')]['hasOwnProperty']('nolimit')){_0x2d9da4['limit']=qs['limit'](_0x56db24[_0xd333('0x4f')]['limit']);_0x2d9da4[_0xd333('0x1c')]=qs['offset'](_0x56db24[_0xd333('0x4f')][_0xd333('0x1c')]);}switch(_0x4eafb5[_0xd333('0x2e')]){case _0xd333('0x2f'):return db[_['capitalize'](_0x56db24[_0xd333('0x4f')][_0xd333('0xa3')])+_0xd333('0xdd')][_0xd333('0x55')](_0x2d9da4);case _0xd333('0x31'):case _0xd333('0x33'):return _0x4eafb5['get'+_['capitalize'](_0x56db24[_0xd333('0x4f')]['channel'])+_0xd333('0xb5')](_0x2d9da4);}})[_0xd333('0x22')](function(_0x810a4d){return{'count':_0x5adfca,'rows':_0x810a4d};})[_0xd333('0x22')](respondWithResult(_0x1411fb,null))[_0xd333('0x2b')](handleError(_0x1411fb,null));};exports['getVoiceQueuesRt']=function(_0x116c5f,_0x76cc){var _0xdd18d4={};var _0x419f63={};var _0x5edcef;var _0x5dd4be;return db['User'][_0xd333('0x9f')]({'where':{'id':_0x116c5f[_0xd333('0x61')]['id']}})[_0xd333('0x22')](handleEntityNotFound(_0x76cc,null))[_0xd333('0x22')](function(_0x185bfd){if(_0x185bfd){_0x5edcef=_0x185bfd;_0x419f63[_0xd333('0xd5')]=_[_0xd333('0xd6')](db[_0xd333('0xb3')][_0xd333('0x41')]);_0x419f63[_0xd333('0x4f')]=_['keys'](_0x116c5f[_0xd333('0x4f')]);_0x419f63[_0xd333('0xd7')]=_[_0xd333('0xd8')](_0x419f63['model'],_0x419f63[_0xd333('0x4f')]);_0xdd18d4[_0xd333('0x53')]=_[_0xd333('0xd8')](_0x419f63[_0xd333('0xd5')],qs[_0xd333('0xd9')](_0x116c5f[_0xd333('0x4f')]['fields']));_0xdd18d4[_0xd333('0x53')]=_0xdd18d4[_0xd333('0x53')][_0xd333('0x58')]?_0xdd18d4[_0xd333('0x53')]:_0x419f63[_0xd333('0xd5')];_0xdd18d4[_0xd333('0xda')]=qs['sort'](_0x116c5f[_0xd333('0x4f')]['sort']);_0xdd18d4[_0xd333('0x4c')]=qs[_0xd333('0xd7')](_['pick'](_0x116c5f[_0xd333('0x4f')],_0x419f63['filters']));if(_0x116c5f[_0xd333('0x4f')][_0xd333('0x36')]){_0xdd18d4[_0xd333('0x4c')]=_['merge'](_0xdd18d4[_0xd333('0x4c')],{'$or':_[_0xd333('0x38')](_0xdd18d4[_0xd333('0x53')],function(_0x2329eb){var _0x2bad5e={};_0x2bad5e[_0x2329eb]={'$like':'%'+_0x116c5f['query'][_0xd333('0x36')]+'%'};return _0x2bad5e;})});}_0xdd18d4=_[_0xd333('0x62')]({},_0xdd18d4,_0x116c5f[_0xd333('0x63')]);return _0x5edcef['getVoiceQueuesRt'](_0xdd18d4);}})['then'](function(_0x3b39bd){if(_0x3b39bd){_0x5dd4be=_0x3b39bd[_0xd333('0x58')];if(!_0x116c5f[_0xd333('0x4f')][_0xd333('0xce')]('nolimit')){_0xdd18d4[_0xd333('0xde')]=qs[_0xd333('0xde')](_0x116c5f[_0xd333('0x4f')]['limit']);_0xdd18d4[_0xd333('0x1c')]=qs[_0xd333('0x1c')](_0x116c5f[_0xd333('0x4f')][_0xd333('0x1c')]);}return _0x5edcef[_0xd333('0xdf')](_0xdd18d4);}})[_0xd333('0x22')](function(_0x3272f1){if(_0x3272f1){return _0x3272f1?{'count':_0x5dd4be,'rows':_0x3272f1}:null;}})[_0xd333('0x22')](respondWithResult(_0x76cc,null))['catch'](handleError(_0x76cc,null));};exports[_0xd333('0xe0')]=function(_0x45aede,_0xda8271){var _0x134590={};var _0x541dfb={};var _0x3875b2;var _0x5a1c4d;return db[_0xd333('0x40')]['findOne']({'where':{'id':_0x45aede[_0xd333('0x61')]['id']}})['then'](handleEntityNotFound(_0xda8271,null))[_0xd333('0x22')](function(_0xc0353f){if(_0xc0353f){_0x3875b2=_0xc0353f;_0x541dfb['model']=_[_0xd333('0xd6')](db['ChatGroup'][_0xd333('0x41')]);_0x541dfb[_0xd333('0x4f')]=_[_0xd333('0xd6')](_0x45aede['query']);_0x541dfb[_0xd333('0xd7')]=_[_0xd333('0xd8')](_0x541dfb[_0xd333('0xd5')],_0x541dfb[_0xd333('0x4f')]);_0x134590['attributes']=_[_0xd333('0xd8')](_0x541dfb[_0xd333('0xd5')],qs[_0xd333('0xd9')](_0x45aede[_0xd333('0x4f')]['fields']));_0x134590[_0xd333('0x53')]=_0x134590[_0xd333('0x53')]['length']?_0x134590[_0xd333('0x53')]:_0x541dfb[_0xd333('0xd5')];_0x134590[_0xd333('0xda')]=qs[_0xd333('0xdb')](_0x45aede[_0xd333('0x4f')][_0xd333('0xdb')]);_0x134590[_0xd333('0x4c')]=qs[_0xd333('0xd7')](_[_0xd333('0xdc')](_0x45aede['query'],_0x541dfb['filters']));if(_0x45aede[_0xd333('0x4f')][_0xd333('0x36')]){_0x134590[_0xd333('0x4c')]=_[_0xd333('0x62')](_0x134590[_0xd333('0x4c')],{'$or':_[_0xd333('0x38')](_0x134590[_0xd333('0x53')],function(_0x5e1d67){var _0x133683={};_0x133683[_0x5e1d67]={'$like':'%'+_0x45aede[_0xd333('0x4f')][_0xd333('0x36')]+'%'};return _0x133683;})});}_0x134590=_[_0xd333('0x62')]({},_0x134590,_0x45aede[_0xd333('0x63')]);return _0x3875b2[_0xd333('0xe0')](_0x134590);}})[_0xd333('0x22')](function(_0x46516b){if(_0x46516b){_0x5a1c4d=_0x46516b[_0xd333('0x58')];if(!_0x45aede[_0xd333('0x4f')][_0xd333('0xce')]('nolimit')){_0x134590['limit']=qs[_0xd333('0xde')](_0x45aede[_0xd333('0x4f')][_0xd333('0xde')]);_0x134590[_0xd333('0x1c')]=qs[_0xd333('0x1c')](_0x45aede['query'][_0xd333('0x1c')]);}return _0x3875b2[_0xd333('0xe0')](_0x134590);}})[_0xd333('0x22')](function(_0x42e2b4){if(_0x42e2b4){return _0x42e2b4?{'count':_0x5a1c4d,'rows':_0x42e2b4}:null;}})[_0xd333('0x22')](respondWithResult(_0xda8271,null))['catch'](handleError(_0xda8271,null));};exports[_0xd333('0xe1')]=function(_0x3f7331,_0x44b395){var _0x10830a={'raw':!![],'where':{}};var _0x394ab2={};var _0x4f1fa1={'count':0x0,'rows':[]};return db['User'][_0xd333('0x9f')]({'where':{'id':_0x3f7331['params']['id']}})['then'](handleEntityNotFound(_0x44b395,null))[_0xd333('0x22')](function(_0x56466b){if(_0x56466b){_0x394ab2[_0xd333('0xd5')]=_[_0xd333('0xd6')](db[_0xd333('0xe2')][_0xd333('0x41')]);_0x394ab2[_0xd333('0x4f')]=_[_0xd333('0xd6')](_0x3f7331[_0xd333('0x4f')]);_0x394ab2['filters']=_[_0xd333('0xd8')](_0x394ab2[_0xd333('0xd5')],_0x394ab2[_0xd333('0x4f')]);_0x10830a['attributes']=_['intersection'](_0x394ab2['model'],qs['fields'](_0x3f7331[_0xd333('0x4f')][_0xd333('0xd9')]));_0x10830a[_0xd333('0x53')]=_0x10830a['attributes']['length']?_0x10830a[_0xd333('0x53')]:_0x394ab2[_0xd333('0xd5')];if(!_0x3f7331[_0xd333('0x4f')][_0xd333('0xce')](_0xd333('0xe3'))){_0x10830a['limit']=qs[_0xd333('0xde')](_0x3f7331[_0xd333('0x4f')]['limit']);_0x10830a['offset']=qs['offset'](_0x3f7331[_0xd333('0x4f')][_0xd333('0x1c')]);}_0x10830a['order']=qs[_0xd333('0xdb')](_0x3f7331[_0xd333('0x4f')][_0xd333('0xdb')]);_0x10830a[_0xd333('0x4c')]=qs[_0xd333('0xd7')](_[_0xd333('0xdc')](_0x3f7331['query'],_0x394ab2['filters']));_0x10830a['where'][_0xd333('0xe4')]=_0x56466b['id'];if(_0x3f7331[_0xd333('0x4f')][_0xd333('0x36')]){_0x10830a['where']=_[_0xd333('0x62')](_0x10830a[_0xd333('0x4c')],{'$or':_[_0xd333('0x38')](_0x10830a[_0xd333('0x53')],function(_0x518925){var _0x22e7e6={};_0x22e7e6[_0x518925]={'$like':'%'+_0x3f7331[_0xd333('0x4f')]['filter']+'%'};return _0x22e7e6;})});}_0x10830a=_['merge']({},_0x10830a,_0x3f7331[_0xd333('0x63')]);return db[_0xd333('0xe2')][_0xd333('0x1e')]({'where':_0x10830a[_0xd333('0x4c')]})[_0xd333('0x22')](function(_0x10cf80){_0x4f1fa1[_0xd333('0x1e')]=_0x10cf80;if(_0x3f7331[_0xd333('0x4f')][_0xd333('0x4d')]){_0x10830a[_0xd333('0x4e')]=[{'all':!![]}];}return db[_0xd333('0xe2')][_0xd333('0x55')](_0x10830a);})[_0xd333('0x22')](function(_0x36ad7e){_0x4f1fa1['rows']=_0x36ad7e;return _0x4f1fa1;});}})[_0xd333('0x22')](respondWithFilteredResult(_0x44b395,_0x10830a))['catch'](handleError(_0x44b395,null));};exports['getScreenRecordings']=function(_0x41f38d,_0x591281){var _0x1b38d8={'raw':!![],'where':{}};var _0x3733a6={};var _0x453948={'count':0x0,'rows':[]};return db[_0xd333('0x40')]['findOne']({'where':{'id':_0x41f38d['params']['id']}})[_0xd333('0x22')](handleEntityNotFound(_0x591281,null))['then'](function(_0x5a8d5a){if(_0x5a8d5a){_0x3733a6['model']=_[_0xd333('0xd6')](db[_0xd333('0xe5')][_0xd333('0x41')]);_0x3733a6[_0xd333('0x4f')]=_[_0xd333('0xd6')](_0x41f38d[_0xd333('0x4f')]);_0x3733a6['filters']=_[_0xd333('0xd8')](_0x3733a6[_0xd333('0xd5')],_0x3733a6[_0xd333('0x4f')]);_0x1b38d8[_0xd333('0x53')]=_['intersection'](_0x3733a6[_0xd333('0xd5')],qs[_0xd333('0xd9')](_0x41f38d[_0xd333('0x4f')][_0xd333('0xd9')]));_0x1b38d8[_0xd333('0x53')]=_0x1b38d8[_0xd333('0x53')]['length']?_0x1b38d8[_0xd333('0x53')]:_0x3733a6[_0xd333('0xd5')];if(!_0x41f38d['query'][_0xd333('0xce')](_0xd333('0xe3'))){_0x1b38d8['limit']=qs[_0xd333('0xde')](_0x41f38d[_0xd333('0x4f')][_0xd333('0xde')]);_0x1b38d8[_0xd333('0x1c')]=qs[_0xd333('0x1c')](_0x41f38d['query']['offset']);}_0x1b38d8[_0xd333('0xda')]=qs['sort'](_0x41f38d[_0xd333('0x4f')][_0xd333('0xdb')]);_0x1b38d8['where']=qs['filters'](_[_0xd333('0xdc')](_0x41f38d[_0xd333('0x4f')],_0x3733a6['filters']));_0x1b38d8['where'][_0xd333('0xe4')]=_0x5a8d5a['id'];if(_0x41f38d[_0xd333('0x4f')]['filter']){_0x1b38d8[_0xd333('0x4c')]=_[_0xd333('0x62')](_0x1b38d8[_0xd333('0x4c')],{'$or':_[_0xd333('0x38')](_0x1b38d8[_0xd333('0x53')],function(_0x2c6196){var _0x27e7bc={};_0x27e7bc[_0x2c6196]={'$like':'%'+_0x41f38d['query'][_0xd333('0x36')]+'%'};return _0x27e7bc;})});}_0x1b38d8=_['merge']({},_0x1b38d8,_0x41f38d[_0xd333('0x63')]);return db[_0xd333('0xe5')][_0xd333('0x1e')]({'where':_0x1b38d8[_0xd333('0x4c')]})['then'](function(_0x4aba3a){_0x453948[_0xd333('0x1e')]=_0x4aba3a;if(_0x41f38d[_0xd333('0x4f')]['includeAll']){_0x1b38d8[_0xd333('0x4e')]=[{'all':!![]}];}return db['ScreenRecording'][_0xd333('0x55')](_0x1b38d8);})['then'](function(_0x2ed678){_0x453948['rows']=_0x2ed678;return _0x453948;});}})['then'](respondWithFilteredResult(_0x591281,_0x1b38d8))[_0xd333('0x2b')](handleError(_0x591281,null));};exports[_0xd333('0xe6')]=function(_0x26aa7c,_0x5e062b){var _0x4b4585={};var _0x38cd9b={};var _0x32c0d9;var _0x192719;return db['User'][_0xd333('0x9f')]({'where':{'id':_0x26aa7c[_0xd333('0x61')]['id']}})['then'](handleEntityNotFound(_0x5e062b,null))[_0xd333('0x22')](function(_0x3593ae){if(_0x3593ae){_0x32c0d9=_0x3593ae;_0x38cd9b[_0xd333('0xd5')]=_[_0xd333('0xd6')](db[_0xd333('0xe7')][_0xd333('0x41')]);_0x38cd9b[_0xd333('0x4f')]=_[_0xd333('0xd6')](_0x26aa7c['query']);_0x38cd9b[_0xd333('0xd7')]=_[_0xd333('0xd8')](_0x38cd9b[_0xd333('0xd5')],_0x38cd9b[_0xd333('0x4f')]);_0x4b4585[_0xd333('0x53')]=_[_0xd333('0xd8')](_0x38cd9b['model'],qs[_0xd333('0xd9')](_0x26aa7c[_0xd333('0x4f')][_0xd333('0xd9')]));_0x4b4585['attributes']=_0x4b4585[_0xd333('0x53')]['length']?_0x4b4585[_0xd333('0x53')]:_0x38cd9b[_0xd333('0xd5')];_0x4b4585[_0xd333('0xda')]=qs[_0xd333('0xdb')](_0x26aa7c[_0xd333('0x4f')]['sort']);_0x4b4585[_0xd333('0x4c')]=qs['filters'](_[_0xd333('0xdc')](_0x26aa7c[_0xd333('0x4f')],_0x38cd9b[_0xd333('0xd7')]));if(_0x26aa7c['query'][_0xd333('0x36')]){_0x4b4585['where']=_[_0xd333('0x62')](_0x4b4585[_0xd333('0x4c')],{'$or':_[_0xd333('0x38')](_0x4b4585['attributes'],function(_0x2d6e53){var _0x477c6e={};_0x477c6e[_0x2d6e53]={'$like':'%'+_0x26aa7c['query'][_0xd333('0x36')]+'%'};return _0x477c6e;})});}_0x4b4585=_[_0xd333('0x62')]({},_0x4b4585,_0x26aa7c['options']);return _0x32c0d9[_0xd333('0xe6')](_0x4b4585);}})['then'](function(_0x58b997){if(_0x58b997){_0x192719=_0x58b997['length'];if(!_0x26aa7c['query']['hasOwnProperty'](_0xd333('0xe3'))){_0x4b4585[_0xd333('0xde')]=qs[_0xd333('0xde')](_0x26aa7c[_0xd333('0x4f')][_0xd333('0xde')]);_0x4b4585['offset']=qs[_0xd333('0x1c')](_0x26aa7c[_0xd333('0x4f')][_0xd333('0x1c')]);}return _0x32c0d9[_0xd333('0xe6')](_0x4b4585);}})[_0xd333('0x22')](function(_0x3a0471){if(_0x3a0471){return _0x3a0471?{'count':_0x192719,'rows':_0x3a0471}:null;}})[_0xd333('0x22')](respondWithResult(_0x5e062b,null))[_0xd333('0x2b')](handleError(_0x5e062b,null));};exports[_0xd333('0xe8')]=function(_0x14779e,_0x11b1e9){var _0x2836b8={};var _0x4fe949={};var _0x15f355;var _0x1053e8;return db[_0xd333('0x40')][_0xd333('0x9f')]({'where':{'id':_0x14779e[_0xd333('0x61')]['id']}})[_0xd333('0x22')](handleEntityNotFound(_0x11b1e9,null))[_0xd333('0x22')](function(_0x1e4487){if(_0x1e4487){_0x15f355=_0x1e4487;_0x4fe949['model']=_[_0xd333('0xd6')](db[_0xd333('0xe9')][_0xd333('0x41')]);_0x4fe949['query']=_[_0xd333('0xd6')](_0x14779e[_0xd333('0x4f')]);_0x4fe949[_0xd333('0xd7')]=_['intersection'](_0x4fe949[_0xd333('0xd5')],_0x4fe949[_0xd333('0x4f')]);_0x2836b8[_0xd333('0x53')]=_[_0xd333('0xd8')](_0x4fe949[_0xd333('0xd5')],qs[_0xd333('0xd9')](_0x14779e[_0xd333('0x4f')][_0xd333('0xd9')]));_0x2836b8[_0xd333('0x53')]=_0x2836b8[_0xd333('0x53')][_0xd333('0x58')]?_0x2836b8[_0xd333('0x53')]:_0x4fe949[_0xd333('0xd5')];_0x2836b8[_0xd333('0xda')]=qs['sort'](_0x14779e['query'][_0xd333('0xdb')]);_0x2836b8[_0xd333('0x4c')]=qs[_0xd333('0xd7')](_[_0xd333('0xdc')](_0x14779e[_0xd333('0x4f')],_0x4fe949['filters']));if(_0x14779e[_0xd333('0x4f')][_0xd333('0x36')]){_0x2836b8[_0xd333('0x4c')]=_['merge'](_0x2836b8[_0xd333('0x4c')],{'$or':_[_0xd333('0x38')](_0x2836b8['attributes'],function(_0x25c7c9){var _0x5318b9={};_0x5318b9[_0x25c7c9]={'$like':'%'+_0x14779e[_0xd333('0x4f')][_0xd333('0x36')]+'%'};return _0x5318b9;})});}_0x2836b8=_[_0xd333('0x62')]({},_0x2836b8,_0x14779e[_0xd333('0x63')]);return _0x15f355[_0xd333('0xe8')](_0x2836b8);}})[_0xd333('0x22')](function(_0x262af9){if(_0x262af9){_0x1053e8=_0x262af9[_0xd333('0x58')];if(!_0x14779e[_0xd333('0x4f')][_0xd333('0xce')](_0xd333('0xe3'))){_0x2836b8['limit']=qs[_0xd333('0xde')](_0x14779e[_0xd333('0x4f')][_0xd333('0xde')]);_0x2836b8['offset']=qs[_0xd333('0x1c')](_0x14779e[_0xd333('0x4f')][_0xd333('0x1c')]);}return _0x15f355[_0xd333('0xe8')](_0x2836b8);}})[_0xd333('0x22')](function(_0x2d04cc){if(_0x2d04cc){return _0x2d04cc?{'count':_0x1053e8,'rows':_0x2d04cc}:null;}})[_0xd333('0x22')](respondWithResult(_0x11b1e9,null))['catch'](handleError(_0x11b1e9,null));};exports[_0xd333('0xea')]=function(_0x2fd3a3,_0x3445a8){var _0x2eced2={'raw':!![],'where':{}};var _0x48a9e5={};var _0x36b4a3={'count':0x0,'rows':[]};return db[_0xd333('0x40')]['findOne']({'where':{'id':_0x2fd3a3['params']['id']}})['then'](handleEntityNotFound(_0x3445a8,null))[_0xd333('0x22')](function(_0x540448){if(_0x540448){_0x48a9e5['model']=_['keys'](db[_0xd333('0xeb')][_0xd333('0x41')]);_0x48a9e5[_0xd333('0x4f')]=_[_0xd333('0xd6')](_0x2fd3a3[_0xd333('0x4f')]);_0x48a9e5[_0xd333('0xd7')]=_[_0xd333('0xd8')](_0x48a9e5[_0xd333('0xd5')],_0x48a9e5['query']);_0x2eced2[_0xd333('0x53')]=_[_0xd333('0xd8')](_0x48a9e5['model'],qs[_0xd333('0xd9')](_0x2fd3a3[_0xd333('0x4f')]['fields']));_0x2eced2[_0xd333('0x53')]=_0x2eced2[_0xd333('0x53')][_0xd333('0x58')]?_0x2eced2[_0xd333('0x53')]:_0x48a9e5[_0xd333('0xd5')];if(!_0x2fd3a3[_0xd333('0x4f')][_0xd333('0xce')](_0xd333('0xe3'))){_0x2eced2[_0xd333('0xde')]=qs[_0xd333('0xde')](_0x2fd3a3['query'][_0xd333('0xde')]);_0x2eced2[_0xd333('0x1c')]=qs[_0xd333('0x1c')](_0x2fd3a3[_0xd333('0x4f')][_0xd333('0x1c')]);}_0x2eced2['order']=qs[_0xd333('0xdb')](_0x2fd3a3['query']['sort']);_0x2eced2[_0xd333('0x4c')]=qs['filters'](_[_0xd333('0xdc')](_0x2fd3a3[_0xd333('0x4f')],_0x48a9e5[_0xd333('0xd7')]));_0x2eced2[_0xd333('0x4c')][_0xd333('0xe4')]=_0x540448['id'];if(_0x2fd3a3[_0xd333('0x4f')][_0xd333('0x36')]){_0x2eced2[_0xd333('0x4c')]=_[_0xd333('0x62')](_0x2eced2[_0xd333('0x4c')],{'$or':_[_0xd333('0x38')](_0x2eced2[_0xd333('0x53')],function(_0x420f70){var _0x3be5cf={};_0x3be5cf[_0x420f70]={'$like':'%'+_0x2fd3a3[_0xd333('0x4f')][_0xd333('0x36')]+'%'};return _0x3be5cf;})});}_0x2eced2=_[_0xd333('0x62')]({},_0x2eced2,_0x2fd3a3['options']);return db[_0xd333('0xeb')][_0xd333('0x1e')]({'where':_0x2eced2[_0xd333('0x4c')]})[_0xd333('0x22')](function(_0x3ee280){_0x36b4a3['count']=_0x3ee280;if(_0x2fd3a3[_0xd333('0x4f')]['includeAll']){_0x2eced2[_0xd333('0x4e')]=[{'all':!![]}];}return db[_0xd333('0xeb')][_0xd333('0x55')](_0x2eced2);})[_0xd333('0x22')](function(_0x526234){_0x36b4a3[_0xd333('0x56')]=_0x526234;return _0x36b4a3;});}})['then'](respondWithFilteredResult(_0x3445a8,_0x2eced2))[_0xd333('0x2b')](handleError(_0x3445a8,null));};exports[_0xd333('0xec')]=function(_0x2d2554,_0x3e5d4c){var _0x51276b={};var _0x60b560={};var _0x4d196c;var _0x9487a3;return db[_0xd333('0x40')][_0xd333('0x9f')]({'where':{'id':_0x2d2554[_0xd333('0x61')]['id']}})['then'](handleEntityNotFound(_0x3e5d4c,null))[_0xd333('0x22')](function(_0x1842da){if(_0x1842da){_0x4d196c=_0x1842da;_0x60b560[_0xd333('0xd5')]=_[_0xd333('0xd6')](db['SmsInteraction']['rawAttributes']);_0x60b560[_0xd333('0x4f')]=_[_0xd333('0xd6')](_0x2d2554[_0xd333('0x4f')]);_0x60b560[_0xd333('0xd7')]=_[_0xd333('0xd8')](_0x60b560[_0xd333('0xd5')],_0x60b560[_0xd333('0x4f')]);_0x51276b['attributes']=_['intersection'](_0x60b560[_0xd333('0xd5')],qs['fields'](_0x2d2554[_0xd333('0x4f')][_0xd333('0xd9')]));_0x51276b[_0xd333('0x53')]=_0x51276b['attributes'][_0xd333('0x58')]?_0x51276b[_0xd333('0x53')]:_0x60b560['model'];_0x51276b[_0xd333('0xda')]=qs[_0xd333('0xdb')](_0x2d2554[_0xd333('0x4f')][_0xd333('0xdb')]);_0x51276b[_0xd333('0x4c')]=qs['filters'](_[_0xd333('0xdc')](_0x2d2554['query'],_0x60b560[_0xd333('0xd7')]));if(_0x2d2554['query'][_0xd333('0x36')]){_0x51276b['where']=_[_0xd333('0x62')](_0x51276b[_0xd333('0x4c')],{'$or':_['map'](_0x51276b[_0xd333('0x53')],function(_0xf30aea){var _0x47fea9={};_0x47fea9[_0xf30aea]={'$like':'%'+_0x2d2554['query'][_0xd333('0x36')]+'%'};return _0x47fea9;})});}_0x51276b=_[_0xd333('0x62')]({},_0x51276b,_0x2d2554[_0xd333('0x63')]);return _0x4d196c[_0xd333('0xec')](_0x51276b);}})[_0xd333('0x22')](function(_0x483af3){if(_0x483af3){_0x9487a3=_0x483af3[_0xd333('0x58')];if(!_0x2d2554['query'][_0xd333('0xce')](_0xd333('0xe3'))){_0x51276b[_0xd333('0xde')]=qs[_0xd333('0xde')](_0x2d2554[_0xd333('0x4f')]['limit']);_0x51276b[_0xd333('0x1c')]=qs['offset'](_0x2d2554[_0xd333('0x4f')][_0xd333('0x1c')]);}return _0x4d196c[_0xd333('0xec')](_0x51276b);}})[_0xd333('0x22')](function(_0x40719a){if(_0x40719a){return _0x40719a?{'count':_0x9487a3,'rows':_0x40719a}:null;}})[_0xd333('0x22')](respondWithResult(_0x3e5d4c,null))[_0xd333('0x2b')](handleError(_0x3e5d4c,null));};exports[_0xd333('0xed')]=function(_0x2205a3,_0x1e5743){var _0xa685ba={};var _0x4fc435={};var _0x446ffb;var _0x3f4dc7;return db[_0xd333('0x40')]['findOne']({'where':{'id':_0x2205a3['params']['id']}})['then'](handleEntityNotFound(_0x1e5743,null))[_0xd333('0x22')](function(_0x4bc265){if(_0x4bc265){_0x446ffb=_0x4bc265;_0x4fc435[_0xd333('0xd5')]=_[_0xd333('0xd6')](db['FaxInteraction'][_0xd333('0x41')]);_0x4fc435[_0xd333('0x4f')]=_['keys'](_0x2205a3[_0xd333('0x4f')]);_0x4fc435[_0xd333('0xd7')]=_[_0xd333('0xd8')](_0x4fc435['model'],_0x4fc435['query']);_0xa685ba[_0xd333('0x53')]=_[_0xd333('0xd8')](_0x4fc435[_0xd333('0xd5')],qs[_0xd333('0xd9')](_0x2205a3[_0xd333('0x4f')][_0xd333('0xd9')]));_0xa685ba[_0xd333('0x53')]=_0xa685ba[_0xd333('0x53')][_0xd333('0x58')]?_0xa685ba[_0xd333('0x53')]:_0x4fc435['model'];_0xa685ba[_0xd333('0xda')]=qs[_0xd333('0xdb')](_0x2205a3[_0xd333('0x4f')][_0xd333('0xdb')]);_0xa685ba[_0xd333('0x4c')]=qs[_0xd333('0xd7')](_['pick'](_0x2205a3[_0xd333('0x4f')],_0x4fc435['filters']));if(_0x2205a3[_0xd333('0x4f')][_0xd333('0x36')]){_0xa685ba['where']=_[_0xd333('0x62')](_0xa685ba[_0xd333('0x4c')],{'$or':_[_0xd333('0x38')](_0xa685ba[_0xd333('0x53')],function(_0x2b782e){var _0x5b12e2={};_0x5b12e2[_0x2b782e]={'$like':'%'+_0x2205a3[_0xd333('0x4f')][_0xd333('0x36')]+'%'};return _0x5b12e2;})});}_0xa685ba=_[_0xd333('0x62')]({},_0xa685ba,_0x2205a3['options']);return _0x446ffb[_0xd333('0xed')](_0xa685ba);}})[_0xd333('0x22')](function(_0x431356){if(_0x431356){_0x3f4dc7=_0x431356['length'];if(!_0x2205a3[_0xd333('0x4f')]['hasOwnProperty'](_0xd333('0xe3'))){_0xa685ba[_0xd333('0xde')]=qs[_0xd333('0xde')](_0x2205a3['query']['limit']);_0xa685ba[_0xd333('0x1c')]=qs['offset'](_0x2205a3['query'][_0xd333('0x1c')]);}return _0x446ffb[_0xd333('0xed')](_0xa685ba);}})['then'](function(_0x46884d){if(_0x46884d){return _0x46884d?{'count':_0x3f4dc7,'rows':_0x46884d}:null;}})[_0xd333('0x22')](respondWithResult(_0x1e5743,null))[_0xd333('0x2b')](handleError(_0x1e5743,null));};exports[_0xd333('0xee')]=function(_0x4ce4d2,_0x3c3630){var _0x263ae1={};var _0xe0735c={};var _0x2f138c;var _0x3e8c63;return db['User'][_0xd333('0x9f')]({'where':{'id':_0x4ce4d2[_0xd333('0x61')]['id']}})[_0xd333('0x22')](handleEntityNotFound(_0x3c3630,null))[_0xd333('0x22')](function(_0x3a9b15){if(_0x3a9b15){_0x2f138c=_0x3a9b15;_0xe0735c[_0xd333('0xd5')]=_[_0xd333('0xd6')](db['WhatsappInteraction']['rawAttributes']);_0xe0735c['query']=_[_0xd333('0xd6')](_0x4ce4d2[_0xd333('0x4f')]);_0xe0735c[_0xd333('0xd7')]=_[_0xd333('0xd8')](_0xe0735c[_0xd333('0xd5')],_0xe0735c[_0xd333('0x4f')]);_0x263ae1['attributes']=_[_0xd333('0xd8')](_0xe0735c[_0xd333('0xd5')],qs[_0xd333('0xd9')](_0x4ce4d2['query'][_0xd333('0xd9')]));_0x263ae1[_0xd333('0x53')]=_0x263ae1['attributes'][_0xd333('0x58')]?_0x263ae1[_0xd333('0x53')]:_0xe0735c[_0xd333('0xd5')];_0x263ae1['order']=qs['sort'](_0x4ce4d2[_0xd333('0x4f')]['sort']);_0x263ae1[_0xd333('0x4c')]=qs['filters'](_[_0xd333('0xdc')](_0x4ce4d2[_0xd333('0x4f')],_0xe0735c[_0xd333('0xd7')]));if(_0x4ce4d2[_0xd333('0x4f')][_0xd333('0x36')]){_0x263ae1[_0xd333('0x4c')]=_[_0xd333('0x62')](_0x263ae1[_0xd333('0x4c')],{'$or':_[_0xd333('0x38')](_0x263ae1[_0xd333('0x53')],function(_0x1ac0e9){var _0x9e2f71={};_0x9e2f71[_0x1ac0e9]={'$like':'%'+_0x4ce4d2['query'][_0xd333('0x36')]+'%'};return _0x9e2f71;})});}_0x263ae1=_[_0xd333('0x62')]({},_0x263ae1,_0x4ce4d2[_0xd333('0x63')]);return _0x2f138c[_0xd333('0xee')](_0x263ae1);}})[_0xd333('0x22')](function(_0x57fe6a){if(_0x57fe6a){_0x3e8c63=_0x57fe6a[_0xd333('0x58')];if(!_0x4ce4d2[_0xd333('0x4f')]['hasOwnProperty']('nolimit')){_0x263ae1[_0xd333('0xde')]=qs['limit'](_0x4ce4d2['query'][_0xd333('0xde')]);_0x263ae1[_0xd333('0x1c')]=qs[_0xd333('0x1c')](_0x4ce4d2[_0xd333('0x4f')][_0xd333('0x1c')]);}return _0x2f138c[_0xd333('0xee')](_0x263ae1);}})['then'](function(_0x28780f){if(_0x28780f){return _0x28780f?{'count':_0x3e8c63,'rows':_0x28780f}:null;}})['then'](respondWithResult(_0x3c3630,null))[_0xd333('0x2b')](handleError(_0x3c3630,null));};exports[_0xd333('0xef')]=function(_0xbacea4,_0x26b775,_0x57956f){var _0x1c2485;var _0x60d9f6;var _0x560238;var _0x5d217b=!_['isNil'](_0xbacea4[_0xd333('0x61')]['id'])?_0xbacea4[_0xd333('0x61')]['id']:!_[_0xd333('0x6f')](_0xbacea4[_0xd333('0x31')]['id'])?_0xbacea4[_0xd333('0x31')]['id']:null;return db[_0xd333('0x40')][_0xd333('0x64')]({'where':{'id':_0x5d217b,'role':{'$or':[_0xd333('0x2f'),_0xd333('0x31'),_0xd333('0x33')]}},'attributes':['id',_0xd333('0x3b'),_0xd333('0xf0'),_0xd333('0xf1'),_0xd333('0x2e'),_0xd333('0x6b'),_0xd333('0xa5')]})['then'](function(_0x1c93f7){if(_0x1c93f7){if(_0x1c93f7[_0xd333('0x2e')]===_0xd333('0x33')){_0x1c2485=_0x1c93f7;if(_0xbacea4[_0xd333('0x66')]['interface']){_0x560238=util[_0xd333('0xcc')](_0xd333('0xf2'),_0x1c2485[_0xbacea4[_0xd333('0x66')]['interface']]);}else if(_0xbacea4[_0xd333('0x66')][_0xd333('0xf3')]){_0x560238=util[_0xd333('0xcc')](_0xd333('0xb1'),_0xbacea4[_0xd333('0x66')][_0xd333('0xf3')]);}else{_0x560238=util[_0xd333('0xcc')](_0xd333('0xb1'),_0x1c2485[_0xd333('0x3b')]);}socket['to'](util[_0xd333('0xcc')]('user:%s',_0x1c2485[_0xd333('0x3b')]))[_0xd333('0xae')](_0xd333('0xf4'),{'user':{'id':_0x1c2485['id'],'name':_0x1c2485['name']},'ip':_0xbacea4['headers'][_0xd333('0xf5')]||_0xbacea4['connection'][_0xd333('0xf6')]||_0xbacea4[_0xd333('0xf7')][_0xd333('0xf6')]||_0xbacea4[_0xd333('0xf8')][_0xd333('0xf7')][_0xd333('0xf6')]});return new Promise(function(_0x1cef1c,_0x489789){db[_0xd333('0x71')]['transaction']()['then'](_0x54b9fb=>{db[_0xd333('0xb3')][_0xd333('0x3c')]({'where':{'membername':_0x1c2485[_0xd333('0x3b')]},'individualHooks':!![]},{'transaction':_0x54b9fb})[_0xd333('0x22')](function(){return _0x54b9fb[_0xd333('0xf9')]();})['then'](_0x1cef1c)['catch'](_0x489789);});});}}else{throw new db[(_0xd333('0x97'))]['ValidationError'](_0xd333('0xfa'));}})[_0xd333('0x22')](function(){if(_0x1c2485){return _0x1c2485[_0xd333('0xfb')]({'raw':!![]});}})['then'](function(_0x521e31){if(_0x1c2485){if(_0x521e31){_0x60d9f6=_0x521e31;if(_0x60d9f6[_0xd333('0x58')]){var _0x510290=_0x60d9f6[_0xd333('0x38')](function(_0x383e73){return{'membername':_0x1c2485['name'],'UserId':_0x1c2485['id'],'queue_name':_0x383e73[_0xd333('0x3b')],'VoiceQueueId':_0x383e73['id'],'interface':_0x560238,'paused':_0x1c2485[_0xd333('0xa5')]||![],'penalty':_0x383e73['UserVoiceQueue.penalty']||0x0};});return db['UserVoiceQueueRt'][_0xd333('0x90')](_0x510290);}}}})['then'](function(){if(_0x1c2485){return db[_0xd333('0xfc')][_0xd333('0x55')]({'where':{'membername':_0x1c2485[_0xd333('0x3b')],'exitAt':null}});}})[_0xd333('0x22')](function(_0x4030f2){if(_0x1c2485){var _0x4d317b=[];_0x4030f2[_0xd333('0xfd')](function(_0x52b447){_0x4d317b[_0xd333('0x54')](_0x52b447[_0xd333('0x2c')]({'exitAt':moment()[_0xd333('0xcc')](_0xd333('0xfe'))}));});return Promise['all'](_0x4d317b);}})[_0xd333('0x22')](function(){if(_0x1c2485){var _0x909004=[];var _0x757fa8=[];var _0x271377=utils[_0xd333('0xff')]();var _0x3cc8c2={'membername':_0x1c2485[_0xd333('0x3b')],'interface':_0x560238,'enterAt':moment()[_0xd333('0xcc')](_0xd333('0xfe')),'role':_0x1c2485[_0xd333('0x2e')],'internal':_0x1c2485[_0xd333('0x6b')]};_0x271377[_0xd333('0xfd')](function(_0x3292a3){_0x909004[_0xd333('0x54')](_[_0xd333('0x62')]({'channel':_0x3292a3,'type':_0xd333('0x100'),'data1':_0xbacea4[_0xd333('0x66')][_0xd333('0x101')],'data2':_0x560238},_0x3cc8c2));if(_0x1c2485[_0xd333('0xa5')]){_0x757fa8[_0xd333('0x54')](_['merge']({'channel':_0x3292a3,'type':'PAUSE','data1':_0xd333('0x102')},_0x3cc8c2));}});return db[_0xd333('0xfc')]['bulkCreate'](_0x909004[_0xd333('0x103')](_0x757fa8),{'individualHooks':!![]});}})[_0xd333('0x22')](function(){if(_0x1c2485){return _0x1c2485['update']({'online':!![],'lastLoginAt':moment()[_0xd333('0xcc')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x1c2485[_0xd333('0xa5')]||![],'mailPause':_0x1c2485[_0xd333('0xa5')]||![],'chatPause':_0x1c2485[_0xd333('0xa5')]||![],'faxPause':_0x1c2485['loginInPause']||![],'smsPause':_0x1c2485[_0xd333('0xa5')]||![],'openchannelPause':_0x1c2485[_0xd333('0xa5')]||![],'whatsappPause':_0x1c2485[_0xd333('0xa5')]||![],'pauseType':_0x1c2485[_0xd333('0xa5')]?_0xd333('0x102'):null,'interface':_0x560238,'lastPauseAt':moment()[_0xd333('0xcc')](_0xd333('0xfe'))});}})[_0xd333('0x22')](function(_0x57412d){if(_0xbacea4[_0xd333('0x104')]){return _0x57956f();}else{return Promise['resolve'](_0x57412d)['then'](respondWithResult(_0x26b775,null));}})[_0xd333('0x2b')](handleError(_0x26b775,null));};exports['logout']=function(_0x4770aa,_0x3c2ae3){var _0x3a2744;return db[_0xd333('0x40')]['find']({'where':{'id':_0x4770aa[_0xd333('0x61')]['id'],'role':_0xd333('0x33')},'attributes':['id','name',_0xd333('0x2e')]})[_0xd333('0x22')](handleEntityNotFound(_0x3c2ae3,null))[_0xd333('0x22')](function(_0x3d7b38){if(_0x3d7b38){_0x3a2744=_0x3d7b38;return db[_0xd333('0xb3')]['destroy']({'where':{'membername':_0x3a2744[_0xd333('0x3b')]},'individualHooks':!![]});}})[_0xd333('0x22')](function(){return db[_0xd333('0xfc')][_0xd333('0x55')]({'where':{'membername':_0x3a2744[_0xd333('0x3b')],'exitAt':null}});})[_0xd333('0x22')](function(_0x20b95f){var _0x3e94e3=[];_0x20b95f['forEach'](function(_0x3d2bbc){_0x3e94e3[_0xd333('0x54')](_0x3d2bbc['update']({'exitAt':moment()['format'](_0xd333('0xfe'))}));});return Promise['all'](_0x3e94e3);})['then'](function(){return _0x3a2744[_0xd333('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xd333('0x22')](respondWithResult(_0x3c2ae3,null))[_0xd333('0x2b')](handleError(_0x3c2ae3,null));};exports[_0xd333('0x105')]=function(_0x4d20e9,_0xe49e60){var _0x292d14;return db[_0xd333('0xb3')]['update']({'paused':0x1},{'where':{'UserId':_0x4d20e9[_0xd333('0x61')]['id']},'individualHooks':!![]})[_0xd333('0x22')](function(){return db[_0xd333('0x40')]['find']({'where':{'id':_0x4d20e9['params']['id'],'role':_0xd333('0x33')},'attributes':['id',_0xd333('0x3b'),_0xd333('0x2e'),'internal',_0xd333('0xa7'),_0xd333('0xa4')]});})[_0xd333('0x22')](handleEntityNotFound(_0xe49e60,null))[_0xd333('0x22')](function(_0x31ca66){if(_0x31ca66){_0x292d14=_0x31ca66;return respondWithRpcPromise('QueuePause',_0xd333('0x105'),{'id':_0x292d14['id'],'name':_0x292d14['name'],'pause':!![]});}})[_0xd333('0x22')](function(){if(_0x292d14){return db[_0xd333('0xfc')]['findAll']({'where':{'membername':_0x292d14[_0xd333('0x3b')],'type':_0xd333('0x106'),'exitAt':null}});}})[_0xd333('0x22')](function(_0x886b59){if(_0x886b59['length']){var _0x2832c3=moment()['format'](_0xd333('0xfe'));for(var _0x397a58=0x0,_0x2b16e7=_0x886b59['length'];_0x397a58<_0x2b16e7;_0x397a58++){_0x886b59[_0x397a58][_0xd333('0x107')]({'exitAt':_0x2832c3});}}})[_0xd333('0x22')](function(){var _0x3665c7=[];var _0x415b8e=utils[_0xd333('0xff')]();_0x415b8e[_0xd333('0xfd')](function(_0x5d372f){_0x3665c7[_0xd333('0x54')]({'channel':_0x5d372f,'membername':_0x292d14[_0xd333('0x3b')],'interface':_['isNil'](_0x292d14[_0xd333('0xa7')])?util['format'](_0xd333('0xb1'),_0x292d14[_0xd333('0x3b')]):_0x292d14[_0xd333('0xa7')],'type':_0xd333('0x106'),'enterAt':moment()[_0xd333('0xcc')](_0xd333('0xfe')),'data1':_0x4d20e9[_0xd333('0x66')][_0xd333('0x43')]||'DEFAULT\x20PAUSE','role':_0x292d14['role'],'internal':_0x292d14[_0xd333('0x6b')]});});return db[_0xd333('0xfc')][_0xd333('0x90')](_0x3665c7,{'individualHooks':!![]});})['then'](function(){return _0x292d14['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4d20e9['body']['type']||_0xd333('0x108'),'lastPauseAt':moment()[_0xd333('0xcc')](_0xd333('0xfe'))});})[_0xd333('0x22')](respondWithResult(_0xe49e60,null))['catch'](handleError(_0xe49e60,null));};exports[_0xd333('0x109')]=function(_0x19ab53,_0x13113f){if(_0x19ab53['body'][_0xd333('0xa3')]&&!utils[_0xd333('0xa8')](_0x19ab53['body'][_0xd333('0xa3')])){throw new APIBadRequestError(util[_0xd333('0xcc')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x19ab53[_0xd333('0x66')][_0xd333('0xa3')]));}return db[_0xd333('0x40')][_0xd333('0x64')]({'where':{'id':_0x19ab53['params']['id']},'attributes':['id',_0xd333('0x3b'),_0xd333('0x2e'),'internal',_0xd333('0xa7'),_0xd333('0xa4'),_0xd333('0xa6'),_0xd333('0x10a'),'chatPause',_0xd333('0x10b'),_0xd333('0x10c'),_0xd333('0x10d'),_0xd333('0x10e'),_0xd333('0x10f'),'lastPauseAt']})['then'](function(_0x4cce40){if(!_0x4cce40){throw new APINotFoundError(util[_0xd333('0xcc')](_0xd333('0xcd'),_0x19ab53[_0xd333('0x61')]['id']));}return _0x4cce40[_0xd333('0x109')](_0x19ab53[_0xd333('0x66')]['channel']);})[_0xd333('0x22')](respondWithResult(_0x13113f,null))['catch'](APIHandleError(_0x13113f));};exports[_0xd333('0x110')]=function(_0x220a83,_0x3cc295){var _0x2456ab={};var _0x5ee4c0={};var _0xb9b67d;var _0x4ee626;return db[_0xd333('0x40')][_0xd333('0x9f')]({'where':{'id':_0x220a83[_0xd333('0x61')]['id']}})[_0xd333('0x22')](handleEntityNotFound(_0x3cc295,null))[_0xd333('0x22')](function(_0x2ef604){if(_0x2ef604){_0xb9b67d=_0x2ef604;_0x5ee4c0[_0xd333('0xd5')]=_[_0xd333('0xd6')](db['Team'][_0xd333('0x41')]);_0x5ee4c0['query']=_['keys'](_0x220a83[_0xd333('0x4f')]);_0x5ee4c0[_0xd333('0xd7')]=_[_0xd333('0xd8')](_0x5ee4c0[_0xd333('0xd5')],_0x5ee4c0[_0xd333('0x4f')]);_0x2456ab[_0xd333('0x53')]=_['intersection'](_0x5ee4c0['model'],qs[_0xd333('0xd9')](_0x220a83['query'][_0xd333('0xd9')]));_0x2456ab[_0xd333('0x53')]=_0x2456ab['attributes']['length']?_0x2456ab[_0xd333('0x53')]:_0x5ee4c0['model'];_0x2456ab[_0xd333('0xda')]=qs[_0xd333('0xdb')](_0x220a83[_0xd333('0x4f')]['sort']);_0x2456ab[_0xd333('0x4c')]=qs['filters'](_[_0xd333('0xdc')](_0x220a83[_0xd333('0x4f')],_0x5ee4c0[_0xd333('0xd7')]));if(_0x220a83[_0xd333('0x4f')][_0xd333('0x36')]){_0x2456ab[_0xd333('0x4c')]=_[_0xd333('0x62')](_0x2456ab[_0xd333('0x4c')],{'$or':_[_0xd333('0x38')](_0x2456ab[_0xd333('0x53')],function(_0xfe43e1){var _0xf64fa8={};_0xf64fa8[_0xfe43e1]={'$like':'%'+_0x220a83[_0xd333('0x4f')][_0xd333('0x36')]+'%'};return _0xf64fa8;})});}_0x2456ab=_[_0xd333('0x62')]({},_0x2456ab,_0x220a83[_0xd333('0x63')]);return _0xb9b67d['getTeams'](_0x2456ab);}})[_0xd333('0x22')](function(_0x1fc0b2){if(_0x1fc0b2){_0x4ee626=_0x1fc0b2[_0xd333('0x58')];if(!_0x220a83[_0xd333('0x4f')][_0xd333('0xce')](_0xd333('0xe3'))){_0x2456ab[_0xd333('0xde')]=qs[_0xd333('0xde')](_0x220a83['query'][_0xd333('0xde')]);_0x2456ab['offset']=qs['offset'](_0x220a83['query'][_0xd333('0x1c')]);}return _0xb9b67d['getTeams'](_0x2456ab);}})[_0xd333('0x22')](function(_0x1cb012){if(_0x1cb012){return _0x1cb012?{'count':_0x4ee626,'rows':_0x1cb012}:null;}})['then'](respondWithResult(_0x3cc295,null))[_0xd333('0x2b')](handleError(_0x3cc295,null));};exports['addTeams']=function(_0x2cd3a6,_0x54df64){var _0x4ec67a=_0x2cd3a6[_0xd333('0x61')]['id'];var _0x53388e=_0x2cd3a6[_0xd333('0x66')]?_0x2cd3a6[_0xd333('0x66')][_0xd333('0x69')]:null;var _0x2b5942=[];return Promise['resolve']()[_0xd333('0x22')](function(){if(!_0x53388e)throw new APIBadRequestError(_0xd333('0x111'));})[_0xd333('0x22')](function(){return db['User'][_0xd333('0x9f')]({'where':{'id':_0x4ec67a}});})[_0xd333('0x22')](function(_0x4bad72){if(!_0x4bad72)throw new APINotFoundError(util[_0xd333('0xcc')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2cd3a6[_0xd333('0x61')]['id']));return db['sequelize']['transaction'](function(_0xfb38d5){return _0x4bad72['addTeams'](_0x53388e,{'transaction':_0xfb38d5})['then'](function(){return db[_0xd333('0x112')]['findAll']({'where':{'id':{'$in':_0x53388e}}});})[_0xd333('0x22')](function(_0x227820){var _0x29531a=_[_0xd333('0x38')](_0x227820,function(_0x2001cd){return _0x2001cd[_0xd333('0x113')]();});return Promise[_0xd333('0x5f')](_0x29531a);})['then'](function(_0x4c848b){_0x2b5942=_[_0xd333('0x114')](_0x4c848b);var _0x3d3d31=_[_0xd333('0x38')](_0x2b5942,function(_0x339058){return _0x339058[_0xd333('0x115')](_0x4bad72['id'],{'transaction':_0xfb38d5});});return Promise[_0xd333('0x5f')](_0x3d3d31);})[_0xd333('0x22')](function(){if(!_0x4bad72[_0xd333('0xa4')])return;var _0x49bf29=_[_0xd333('0x36')](_0x2b5942,function(_0x3db27c){return _0x3db27c[_0xd333('0x116')](_0xd333('0xa3'))===_0xd333('0x117');});var _0x324204=_[_0xd333('0x38')](_0x49bf29,function(_0x469ae5){return db[_0xd333('0xb3')][_0xd333('0x118')]({'membername':_0x4bad72[_0xd333('0x3b')],'UserId':_0x4bad72['id'],'queue_name':_0x469ae5[_0xd333('0x3b')],'VoiceQueueId':_0x469ae5['id'],'interface':_[_0xd333('0x6f')](_0x4bad72['interface'])?util[_0xd333('0xcc')](_0xd333('0xb1'),_0x4bad72[_0xd333('0x3b')]):_0x4bad72[_0xd333('0xa7')],'paused':_0x4bad72[_0xd333('0xa6')]||![],'penalty':_0x4bad72[_0xd333('0xb2')]},{'transaction':_0xfb38d5});});return Promise[_0xd333('0x5f')](_0x324204);})[_0xd333('0x22')](function(){return db[_0xd333('0x119')]['findAll']({'where':{'teamId':{'$in':_0x53388e}}});})[_0xd333('0x22')](function(_0x3b2280){var _0x5a0d81=_[_0xd333('0x38')](_0x3b2280,function(_0x25e22b){return db[_0xd333('0x11a')][_0xd333('0x86')]({'UserId':_0x4bad72['id'],'VoicePrefixId':_0x25e22b[_0xd333('0x11b')]},{'transaction':_0xfb38d5});});return Promise['all'](_0x5a0d81);});});})[_0xd333('0x22')](function(){for(var _0x5a9ce6=0x0;_0x5a9ce6<_0x2b5942[_0xd333('0x58')];_0x5a9ce6++){var _0x5acb56=_0x2b5942[_0x5a9ce6]['getDataValue'](_0xd333('0xa3'));var _0x2669c6=_0x5acb56+_0xd333('0xb7');socket['emit']('user'+_0x5acb56+_0xd333('0xaf'),{'UserId':_0x4ec67a,['queueField']:_0x2b5942[_0x5a9ce6]['id']});}})[_0xd333('0x22')](respondWithStatusCode(_0x54df64,null))[_0xd333('0x2b')](APIHandleError(_0x54df64));};exports[_0xd333('0x11c')]=function(_0x35e193,_0x37fbee){var _0xb97846=_0x35e193[_0xd333('0x61')]['id'];var _0xa7bd74=null;if(_0x35e193[_0xd333('0x4f')][_0xd333('0x69')]){_0xa7bd74=_['isArray'](_0x35e193[_0xd333('0x4f')][_0xd333('0x69')])?_0x35e193[_0xd333('0x4f')][_0xd333('0x69')]:[_0x35e193['query'][_0xd333('0x69')]];}var _0x2bb311=[];return Promise['resolve']()[_0xd333('0x22')](function(){if(!_0xa7bd74)throw new APIBadRequestError(_0xd333('0x11d'));})[_0xd333('0x22')](function(){return db[_0xd333('0x40')][_0xd333('0x9f')]({'where':{'id':_0xb97846}});})[_0xd333('0x22')](function(_0x59edc3){if(!_0x59edc3)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x35e193[_0xd333('0x61')]['id']));return db[_0xd333('0x71')][_0xd333('0x11e')](function(_0x55abed){return _0x59edc3['removeTeams'](_0xa7bd74,{'transaction':_0x55abed})[_0xd333('0x22')](function(){return db[_0xd333('0x112')][_0xd333('0x55')]({'where':{'id':{'$in':_0xa7bd74}}});})['then'](function(_0x4764eb){var _0x4c9cda=_[_0xd333('0x38')](_0x4764eb,function(_0x90190c){return _0x90190c[_0xd333('0x113')]();});return Promise[_0xd333('0x5f')](_0x4c9cda);})['then'](function(_0x1f9277){_0x2bb311=_[_0xd333('0x114')](_0x1f9277);var _0x923430=_['map'](_0x2bb311,function(_0x5b71c4){return _0x5b71c4[_0xd333('0x11f')](_0x59edc3['id'],{'transaction':_0x55abed});});return Promise[_0xd333('0x5f')](_0x923430);})['then'](function(){if(!_0x59edc3[_0xd333('0xa4')])return;var _0x51c3ba=_[_0xd333('0x36')](_0x2bb311,function(_0x4b98bf){return _0x4b98bf['getDataValue'](_0xd333('0xa3'))===_0xd333('0x117');});var _0x334292=_[_0xd333('0x38')](_0x51c3ba,function(_0xd60025){return db[_0xd333('0xb3')][_0xd333('0x3c')]({'where':{'VoiceQueueId':_0xd60025['id'],'UserId':_0x59edc3['id']},'transaction':_0x55abed});});return Promise[_0xd333('0x5f')](_0x334292);})[_0xd333('0x22')](function(){return db[_0xd333('0x119')][_0xd333('0x55')]({'where':{'teamId':{'$in':_0xa7bd74}}});})[_0xd333('0x22')](function(_0x5cf732){var _0x5a5f8e=_[_0xd333('0x38')](_0x5cf732,function(_0x50a761){return db[_0xd333('0x11a')][_0xd333('0x3c')]({'where':{'UserId':_0x59edc3['id'],'VoicePrefixId':_0x50a761[_0xd333('0x11b')]}},{'transaction':_0x55abed});});return Promise[_0xd333('0x5f')](_0x5a5f8e);});});})[_0xd333('0x22')](function(){for(var _0x133642=0x0;_0x133642<_0x2bb311[_0xd333('0x58')];_0x133642++){var _0x50f2e6=_0x2bb311[_0x133642][_0xd333('0x116')](_0xd333('0xa3'));var _0x123cae=_0x50f2e6+_0xd333('0xb7');socket[_0xd333('0xae')](_0xd333('0x31')+_0x50f2e6+'Queue:remove',{'UserId':_0xb97846,['queueField']:_0x2bb311[_0x133642]['id']});}})[_0xd333('0x22')](respondWithStatusCode(_0x37fbee,null))[_0xd333('0x2b')](APIHandleError(_0x37fbee));};exports[_0xd333('0x120')]=function(_0xa9edd5,_0x37419d){var _0x1f178f={};var _0x1ef54e={};var _0x813508;var _0xeae31f;return db[_0xd333('0x40')][_0xd333('0x9f')]({'where':{'id':_0xa9edd5[_0xd333('0x61')]['id']}})[_0xd333('0x22')](handleEntityNotFound(_0x37419d,null))[_0xd333('0x22')](function(_0x4f4564){if(_0x4f4564){_0x813508=_0x4f4564;_0x1ef54e['model']=_['keys'](db[_0xd333('0xcf')]['rawAttributes']);_0x1ef54e[_0xd333('0x4f')]=_[_0xd333('0xd6')](_0xa9edd5['query']);_0x1ef54e[_0xd333('0xd7')]=_['intersection'](_0x1ef54e['model'],_0x1ef54e[_0xd333('0x4f')]);_0x1f178f['attributes']=_['intersection'](_0x1ef54e[_0xd333('0xd5')],qs[_0xd333('0xd9')](_0xa9edd5[_0xd333('0x4f')][_0xd333('0xd9')]));_0x1f178f[_0xd333('0x53')]=_0x1f178f['attributes'][_0xd333('0x58')]?_0x1f178f[_0xd333('0x53')]:_0x1ef54e[_0xd333('0xd5')];_0x1f178f[_0xd333('0xda')]=qs['sort'](_0xa9edd5[_0xd333('0x4f')]['sort']);_0x1f178f[_0xd333('0x4c')]=qs['filters'](_[_0xd333('0xdc')](_0xa9edd5[_0xd333('0x4f')],_0x1ef54e[_0xd333('0xd7')]));if(_0xa9edd5[_0xd333('0x4f')][_0xd333('0x36')]){_0x1f178f['where']=_['merge'](_0x1f178f['where'],{'$or':_['map'](_0x1f178f['attributes'],function(_0x532a27){var _0x57a05c={};_0x57a05c[_0x532a27]={'$like':'%'+_0xa9edd5[_0xd333('0x4f')][_0xd333('0x36')]+'%'};return _0x57a05c;})});}_0x1f178f=_[_0xd333('0x62')]({},_0x1f178f,_0xa9edd5[_0xd333('0x63')]);return _0x813508['getLists'](_0x1f178f);}})[_0xd333('0x22')](function(_0x3abe21){if(_0x3abe21){_0xeae31f=_0x3abe21[_0xd333('0x58')];if(!_0xa9edd5[_0xd333('0x4f')]['hasOwnProperty'](_0xd333('0xe3'))){_0x1f178f[_0xd333('0xde')]=qs['limit'](_0xa9edd5[_0xd333('0x4f')][_0xd333('0xde')]);_0x1f178f[_0xd333('0x1c')]=qs[_0xd333('0x1c')](_0xa9edd5[_0xd333('0x4f')][_0xd333('0x1c')]);}return _0x813508[_0xd333('0x120')](_0x1f178f);}})['then'](function(_0x46b896){if(_0x46b896){return _0x46b896?{'count':_0xeae31f,'rows':_0x46b896}:null;}})[_0xd333('0x22')](respondWithResult(_0x37419d,null))['catch'](handleError(_0x37419d,null));};exports['getAgents']=function(_0x1aed0f,_0xb92c1){var _0xc66eb6={};var _0x16dbdc={};var _0x43eef6;return db[_0xd333('0x40')]['findOne']({'where':{'id':_0x1aed0f[_0xd333('0x61')]['id']}})[_0xd333('0x22')](handleEntityNotFound(_0xb92c1,null))['then'](function(_0x18823d){if(_0x18823d){_0x43eef6=_0x18823d;_0x16dbdc[_0xd333('0xd5')]=_[_0xd333('0xd6')](db['User']['rawAttributes']);_0x16dbdc[_0xd333('0x4f')]=_[_0xd333('0xd6')](_0x1aed0f['query']);_0x16dbdc[_0xd333('0xd7')]=_[_0xd333('0xd8')](_0x16dbdc[_0xd333('0xd5')],_0x16dbdc[_0xd333('0x4f')]);_0xc66eb6[_0xd333('0x53')]=_[_0xd333('0xd8')](_0x16dbdc['model'],qs['fields'](_0x1aed0f[_0xd333('0x4f')][_0xd333('0xd9')]));_0xc66eb6[_0xd333('0x53')]=_0xc66eb6['attributes'][_0xd333('0x58')]?_0xc66eb6[_0xd333('0x53')]:_0x16dbdc[_0xd333('0xd5')];_0xc66eb6[_0xd333('0xda')]=qs[_0xd333('0xdb')](_0x1aed0f[_0xd333('0x4f')][_0xd333('0xdb')]);_0xc66eb6[_0xd333('0x4c')]=qs[_0xd333('0xd7')](_[_0xd333('0xdc')](_0x1aed0f[_0xd333('0x4f')],_0x16dbdc[_0xd333('0xd7')]));if(_0x1aed0f[_0xd333('0x4f')][_0xd333('0x36')]){_0xc66eb6[_0xd333('0x4c')]=_['merge'](_0xc66eb6[_0xd333('0x4c')],{'$or':_[_0xd333('0x38')](_0xc66eb6[_0xd333('0x53')],function(_0x57ccb8){var _0x1b3041={};_0x1b3041[_0x57ccb8]={'$like':'%'+_0x1aed0f[_0xd333('0x4f')][_0xd333('0x36')]+'%'};return _0x1b3041;})});}_0xc66eb6[_0xd333('0xd5')]=db['User'];_0xc66eb6['as']='Agents';_0xc66eb6=_[_0xd333('0x62')]({},_0xc66eb6,_0x1aed0f[_0xd333('0x63')]);return _0x43eef6[_0xd333('0xfb')]({'include':[_0xc66eb6]});}})[_0xd333('0x22')](function(_0x8d9805){if(_0x8d9805){var _0x2952ca={},_0x453841=[];for(var _0x3fbf99=0x0;_0x3fbf99<_0x8d9805[_0xd333('0x58')];_0x3fbf99+=0x1){for(var _0x4757e7=0x0,_0x38d643;_0x4757e7<_0x8d9805[_0x3fbf99][_0xd333('0x32')]['length'];_0x4757e7+=0x1){_0x38d643=_0x8d9805[_0x3fbf99]['Agents'][_0x4757e7]['get']({'plain':!![]});_0x2952ca[_0x38d643['id']]=_0x38d643;}}_0x2952ca=_[_0xd333('0x121')](_0x2952ca);for(var _0x26c846=qs[_0xd333('0x1c')](_0x1aed0f[_0xd333('0x4f')][_0xd333('0x1c')]);_0x26c846<_0x2952ca['length']&&_0x453841['length']=_0x103f85){_0x49e292=_0x103f85;_0x414d6f=0xc8;}else{_0x414d6f=0xce;}_0x5e6b28[_0xdd99('0x17')](_0x414d6f);return _0x5e6b28[_0xdd99('0x1d')](_0xdd99('0x1e'),_0x3b8be1+'-'+_0x49e292+'/'+_0x103f85)[_0xdd99('0x18')](_0x4bf66b);}return null;};}function respondWithRpcPromise(_0x34ee31,_0x352ab8,_0x1e8802,_0x1d3d41){return new Promise(function(_0x4fcfa4,_0x2692c0){var _0x521866=_0x1d3d41||amiClient;return _0x521866[_0xdd99('0x1f')](_0x34ee31,_0x1e8802)[_0xdd99('0x20')](function(_0x12588f){logger[_0xdd99('0x21')](_0xdd99('0x22'),_0x352ab8,_0xdd99('0x23'));logger['debug'](_0xdd99('0x24'),_0x352ab8,_0xdd99('0x23'),JSON['stringify'](_0x12588f));if(_0x12588f['error']){if(_0x12588f[_0xdd99('0x25')]['code']===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x352ab8,_0x12588f[_0xdd99('0x25')]['message']);return _0x2692c0(_0x12588f[_0xdd99('0x25')][_0xdd99('0x26')]);}logger[_0xdd99('0x25')](_0xdd99('0x22'),_0x352ab8,_0x12588f['error'][_0xdd99('0x26')]);return _0x4fcfa4(_0x12588f[_0xdd99('0x25')][_0xdd99('0x26')]);}else{logger[_0xdd99('0x21')](_0xdd99('0x22'),_0x352ab8,_0xdd99('0x23'));_0x4fcfa4(_0x12588f[_0xdd99('0x27')][_0xdd99('0x26')]);}})[_0xdd99('0x28')](function(_0x230c04){logger[_0xdd99('0x25')]('User,\x20%s,\x20%s',_0x352ab8,_0x230c04);_0x2692c0(_0x230c04);});});}function saveUpdates(_0xed1aa6){return function(_0x41e488){if(_0x41e488){return _0x41e488[_0xdd99('0x29')](_0xed1aa6)[_0xdd99('0x20')](function(_0x759897){if(_0x759897[_0xdd99('0x2a')]===_0xdd99('0x2b')){socket[_0xdd99('0x2c')](_0xdd99('0x2d')+_0x759897['id'],_0x759897);}return _0x759897;});}return null;};}function removeEntity(_0x530891,_0x50b5ee){return function(_0x397596){if(_0x397596){return _0x397596['destroy']({'transaction':_0x50b5ee})[_0xdd99('0x20')](function(){var _0xe33348=_0x397596['get']({'plain':!![]});if(_0xe33348[_0xdd99('0x2a')]==='admin')return;var _0x12cb17=[{'name':_0xdd99('0x2e'),'value':_0xdd99('0x2f'),'ignore':!![]},{'name':_0xdd99('0x30'),'value':_0xdd99('0x2b'),'ignore':![]},{'name':_0xdd99('0x31'),'value':_0xdd99('0x32'),'ignore':![]}];var _0x314d46=_(_0x12cb17)[_0xdd99('0x33')]('ignore')[_0xdd99('0x34')]('value')[_0xdd99('0x35')]();if(_[_0xdd99('0x36')](_0x314d46,_0xe33348[_0xdd99('0x2a')])){return;}var _0x29222f=_['find'](_0x12cb17,[_0xdd99('0x35'),_0xe33348[_0xdd99('0x2a')]])[_0xdd99('0x37')];return db[_0xdd99('0x38')][_0xdd99('0x39')]({'where':{'type':_0x29222f,'resourceId':_0xe33348['id']},'transaction':_0x50b5ee})[_0xdd99('0x20')](function(){return _0x397596;});})[_0xdd99('0x20')](function(){_0x530891[_0xdd99('0x17')](0xcc)[_0xdd99('0x3a')]();});}};}function handleEntityNotFound(_0x4a0499){return function(_0x14bf11){if(!_0x14bf11){_0x4a0499['sendStatus'](0x194);}return _0x14bf11;};}function handleError(_0x31229f,_0x216e43){_0x216e43=_0x216e43||0x1f4;return function(_0x20acfc){logger[_0xdd99('0x25')](_0x20acfc[_0xdd99('0x3b')]);if(_0x20acfc['name']){delete _0x20acfc[_0xdd99('0x37')];}_0x31229f[_0xdd99('0x17')](_0x216e43)['send'](_0x20acfc);};}function getUserAttributes(){return _(db[_0xdd99('0x3c')][_0xdd99('0x3d')])[_0xdd99('0x34')](function(_0x2c46ad){return{'name':_0x2c46ad['fieldName'],'type':_0x2c46ad['type']['key']};})[_0xdd99('0x33')](function(_0x4d42a3){return![_0xdd99('0x3e'),'salt','previousPasswords',_0xdd99('0x3f'),_0xdd99('0x40'),_0xdd99('0x41')]['includes'](_0x4d42a3[_0xdd99('0x37')]);})['value']();}exports[_0xdd99('0x42')]=function(_0x5242ec,_0x1fda14){var _0x280193={},_0x58f366={'count':0x0,'rows':[]};var _0x156c1a=getUserAttributes();_0x280193=qs[_0xdd99('0x43')](_0x156c1a,_0x5242ec);var _0x4f0464={'where':_0x280193[_0xdd99('0x44')]};return db['User'][_0xdd99('0x1a')](_0x4f0464)[_0xdd99('0x20')](function(_0x14474e){_0x58f366[_0xdd99('0x1a')]=_0x14474e;if(_0x5242ec[_0xdd99('0x45')][_0xdd99('0x46')]){_0x280193['include']=[{'all':!![]}];}if(_0x5242ec[_0xdd99('0x45')][_0xdd99('0x47')]===_0xdd99('0x48')){_0x280193[_0xdd99('0x49')]=[{'model':db[_0xdd99('0x4a')],'as':_0xdd99('0x47')}];}if(!_[_0xdd99('0x36')](_0x280193['attributes'],'id')){_0x280193['attributes'][_0xdd99('0x4b')]('id');}return db['User'][_0xdd99('0x4c')](_0x280193);})[_0xdd99('0x20')](function(_0x683e1c){_0x58f366[_0xdd99('0x4d')]=_0x683e1c;if(_0x5242ec[_0xdd99('0x45')][_0xdd99('0x4e')]===_0xdd99('0x48')){var _0x3335cc=[];for(var _0x24ac10=0x0;_0x24ac10<_0x58f366[_0xdd99('0x4d')]['length'];_0x24ac10++){_0x3335cc['push'](get_open_tabs('chat',_0x58f366[_0xdd99('0x4d')][_0x24ac10][_0xdd99('0x4f')]));_0x3335cc[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x50'),_0x58f366['rows'][_0x24ac10][_0xdd99('0x4f')]));_0x3335cc[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x51'),_0x58f366[_0xdd99('0x4d')][_0x24ac10][_0xdd99('0x4f')]));_0x3335cc[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x52'),_0x58f366[_0xdd99('0x4d')][_0x24ac10][_0xdd99('0x4f')]));_0x3335cc[_0xdd99('0x4b')](get_open_tabs('openchannel',_0x58f366[_0xdd99('0x4d')][_0x24ac10][_0xdd99('0x4f')]));_0x3335cc['push'](get_open_tabs(_0xdd99('0x53'),_0x58f366[_0xdd99('0x4d')][_0x24ac10][_0xdd99('0x4f')]));}return Promise['all'](_0x3335cc)['then'](function(){return _0x58f366;});}else{return _0x58f366;}})[_0xdd99('0x20')](respondWithFilteredResult(_0x1fda14,_0x280193))[_0xdd99('0x28')](handleError(_0x1fda14,null));};exports['show']=function(_0x1ede07,_0x2c582f){var _0x37b0f4=getUserAttributes();_0x1ede07[_0xdd99('0x45')]['id']=_0x1ede07[_0xdd99('0x54')]['id'];var _0x301972=qs['getOptions'](_0x37b0f4,_0x1ede07);if(_0x1ede07['query'][_0xdd99('0x46')]){_0x301972[_0xdd99('0x49')]=[{'all':!![]}];}if(_0x1ede07[_0xdd99('0x45')][_0xdd99('0x47')]===_0xdd99('0x48')){_0x301972[_0xdd99('0x49')]=[{'model':db['UserSetting'],'as':_0xdd99('0x47')}];}_0x301972=_[_0xdd99('0x55')]({},_0x301972,_0x1ede07[_0xdd99('0x56')]);if(!_['includes'](_0x301972[_0xdd99('0x57')],'id')){_0x301972[_0xdd99('0x57')][_0xdd99('0x4b')]('id');}return db[_0xdd99('0x3c')][_0xdd99('0x58')](_0x301972)[_0xdd99('0x20')](handleEntityNotFound(_0x2c582f,null))[_0xdd99('0x20')](function(_0x3c4eb9){var _0xd2835a=[];values=_0x3c4eb9;if(_0x1ede07[_0xdd99('0x45')][_0xdd99('0x4e')]===_0xdd99('0x48')){_0xd2835a[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x59'),_0x3c4eb9['dataValues']));_0xd2835a[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x50'),_0x3c4eb9['dataValues']));_0xd2835a['push'](get_open_tabs(_0xdd99('0x5a'),_0x3c4eb9['dataValues']));_0xd2835a[_0xdd99('0x4b')](get_open_tabs('whatsapp',_0x3c4eb9[_0xdd99('0x4f')]));_0xd2835a['push'](get_open_tabs('fax',_0x3c4eb9[_0xdd99('0x4f')]));_0xd2835a[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x52'),_0x3c4eb9['dataValues']));return Promise[_0xdd99('0x5b')](_0xd2835a);}else{return values;}})[_0xdd99('0x20')](function(){return values;})[_0xdd99('0x20')](respondWithResult(_0x2c582f,null))[_0xdd99('0x28')](handleError(_0x2c582f,null));};exports['update']=function(_0x4a074d,_0x5559f5){if(_0x4a074d['body']['id']){delete _0x4a074d[_0xdd99('0x5c')]['id'];}delete _0x4a074d['body'][_0xdd99('0x2a')];return db[_0xdd99('0x3c')][_0xdd99('0x58')]({'where':{'id':_0x4a074d[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x5559f5,null))['then'](saveUpdates(_0x4a074d[_0xdd99('0x5c')],null))[_0xdd99('0x20')](respondWithResult(_0x5559f5,null))['catch'](handleError(_0x5559f5,null));};exports[_0xdd99('0x5d')]=function(_0x59adc5,_0x186ba3){return db['User'][_0xdd99('0x5d')]()[_0xdd99('0x20')](respondWithResult(_0x186ba3,null))[_0xdd99('0x28')](handleError(_0x186ba3,null));};exports[_0xdd99('0x5e')]=function(_0x5e5261,_0x354782){return db[_0xdd99('0x3c')]['find']({'where':{'id':_0x5e5261[_0xdd99('0x54')]['id']}})['then'](handleEntityNotFound(_0x354782,null))[_0xdd99('0x20')](function(_0x5d6538){if(_0x5d6538){return _0x5d6538[_0xdd99('0x5e')](_0x5e5261[_0xdd99('0x5c')][_0xdd99('0x5f')],_[_0xdd99('0x60')](_0x5e5261[_0xdd99('0x5c')],[_0xdd99('0x5f'),'id'])||{});}})[_0xdd99('0x20')](respondWithResult(_0x354782,null))[_0xdd99('0x28')](handleError(_0x354782,null));};function validateUser(_0x45c890){return new Promise(function(_0x171352,_0x208e27){if(_0x45c890[_0xdd99('0x61')])return _0x171352(_0x45c890);return db[_0xdd99('0x62')][_0xdd99('0x63')](0x1)[_0xdd99('0x20')](function(_0x25385a){if(_0x25385a[_0xdd99('0x64')])authService[_0xdd99('0x65')](_0x45c890['password']);db['User'][_0xdd99('0x66')](_0xdd99('0x61'))[_0xdd99('0x20')](function(_0xa8c218){if(_['isNil'](_0xa8c218)){_0x45c890[_0xdd99('0x61')]=_0x25385a['min_internal']||0x1;return;}if(_[_0xdd99('0x67')](_0x25385a[_0xdd99('0x68')])||_0x25385a['min_internal']===_0xa8c218){_0x45c890[_0xdd99('0x61')]=_0xa8c218+0x1;return;}if(_0x25385a[_0xdd99('0x68')]>_0xa8c218){_0x45c890[_0xdd99('0x61')]=_0x25385a[_0xdd99('0x68')];return;}return db[_0xdd99('0x69')][_0xdd99('0x45')](_0xdd99('0x6a'),{'type':db[_0xdd99('0x69')][_0xdd99('0x6b')][_0xdd99('0x6c')]})[_0xdd99('0x20')](function(_0x16e323){if(_0x16e323&&_0x16e323[_0xdd99('0x6d')]){for(var _0x2cd418=0x0,_0x4527ea=_0x16e323[_0xdd99('0x6d')];_0x2cd418<_0x4527ea&&_[_0xdd99('0x67')](_0x45c890['internal']);_0x2cd418++){if(_0x25385a[_0xdd99('0x68')]<=_0x16e323[_0x2cd418][_0xdd99('0x6e')]){_0x45c890['internal']=_0x16e323[_0x2cd418][_0xdd99('0x6e')];}else if(_0x25385a[_0xdd99('0x68')]>_0x16e323[_0x2cd418]['from']&&_0x25385a['min_internal']<=_0x16e323[_0x2cd418]['to']){_0x45c890[_0xdd99('0x61')]=_0x25385a[_0xdd99('0x68')];}}}if(_['isNil'](_0x45c890[_0xdd99('0x61')])){_0x45c890[_0xdd99('0x61')]=_0xa8c218+0x1;}return _0x171352(_0x45c890);});});})['catch'](function(_0x329cbe){_0x208e27(_0x329cbe);});});}function updateUser(_0x3c060b){return new Promise(function(_0x5e21a2,_0x23b168){try{if(_0x3c060b[_0xdd99('0x6f')]){_0x3c060b[_0xdd99('0x70')]=_0x3c060b[_0xdd99('0x61')];_0x3c060b[_0xdd99('0x71')]={'mailbox':_0x3c060b[_0xdd99('0x61')],'password':_0x3c060b['password'],'fullname':_0x3c060b[_0xdd99('0x72')],'email':_0x3c060b[_0xdd99('0x73')]};}if(_0x3c060b[_0xdd99('0x2a')]===_0xdd99('0x2b')){if(!_0x3c060b[_0xdd99('0x74')])_0x3c060b[_0xdd99('0x74')]=['101',_0xdd99('0x75'),'103',_0xdd99('0x76'),_0xdd99('0x77'),'104',_0xdd99('0x78'),'106',_0xdd99('0x79'),_0xdd99('0x7a'),'109',_0xdd99('0x7b'),_0xdd99('0x7c'),_0xdd99('0x7d'),_0xdd99('0x7e')];}_0x5e21a2(_0x3c060b);}catch(_0x324618){_0x23b168(_0x324618);}});}exports[_0xdd99('0x7f')]=function(_0x4fe729,_0x3f8615){if(_0x4fe729[_0xdd99('0x2f')]['role']===_0xdd99('0x2b'))throw new Error(_0xdd99('0x80'));if(_0x4fe729[_0xdd99('0x5c')][_0xdd99('0x2a')]===_0xdd99('0x2f')&&_0x4fe729['user'][_0xdd99('0x2a')]!==_0xdd99('0x81')){throw new Error(_0xdd99('0x82'));}if(_0x4fe729[_0xdd99('0x5c')][_0xdd99('0x2a')]==='admin'&&_0x4fe729['user'][_0xdd99('0x2a')]!==_0xdd99('0x81')){throw new Error(_0xdd99('0x83'));}return licenseUtil[_0xdd99('0x84')]([_0x4fe729['body']])[_0xdd99('0x20')](function(){return validateUser(_0x4fe729[_0xdd99('0x5c')]);})[_0xdd99('0x20')](function(_0x2e5f16){return updateUser(_0x2e5f16)[_0xdd99('0x20')](function(_0xa25ae9){if(_0xa25ae9['role']===_0xdd99('0x81')){_0xa25ae9['settingsEnabled']=_0x4fe729[_0xdd99('0x2f')][_0xdd99('0x85')];delete _0xa25ae9[_0xdd99('0x86')];}return _0xa25ae9;});})[_0xdd99('0x20')](function(_0xafd9c3){return db[_0xdd99('0x3c')][_0xdd99('0x7f')](_0xafd9c3,{'include':[{'model':db['VoiceMail'],'as':_0xdd99('0x71')}]});})[_0xdd99('0x20')](function(_0x3aa055){if(_0x4fe729[_0xdd99('0x5c')][_0xdd99('0x2a')]===_0xdd99('0x2f'))return _0x3aa055;if(_0x4fe729[_0xdd99('0x2f')]['role']!==_0xdd99('0x2f'))return _0x3aa055;return db[_0xdd99('0x87')][_0xdd99('0x58')]({'where':{'name':_0x3aa055[_0xdd99('0x2a')]===_0xdd99('0x2b')?_0xdd99('0x30'):_0xdd99('0x31'),'userProfileId':_0x4fe729[_0xdd99('0x2f')][_0xdd99('0x86')]},'raw':!![]})[_0xdd99('0x20')](function(_0x1998f4){if(!_0x1998f4||_0x1998f4[_0xdd99('0x88')]!=0x0)return _0x3aa055;return db['UserProfileResource'][_0xdd99('0x7f')]({'name':_0x3aa055[_0xdd99('0x37')],'resourceId':_0x3aa055['id'],'type':_0x1998f4['name'],'sectionId':_0x1998f4['id']},{})[_0xdd99('0x20')](function(){return _0x3aa055;});})['catch'](function(_0x849ba6){logger[_0xdd99('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x849ba6);throw _0x849ba6;});})[_0xdd99('0x20')](respondWithResult(_0x3f8615,0xc9))[_0xdd99('0x28')](handleError(_0x3f8615,null));};exports[_0xdd99('0x89')]=function(_0x553cbb,_0x4757f9){var _0x14153d=_0x553cbb[_0xdd99('0x5c')];var _0x2180aa=[];if(_0x553cbb[_0xdd99('0x2f')][_0xdd99('0x2a')]===_0xdd99('0x2b'))throw new Error(_0xdd99('0x80'));if(_[_0xdd99('0x8a')](_0x14153d,['role',_0xdd99('0x2f')])&&_0x553cbb[_0xdd99('0x2f')][_0xdd99('0x2a')]!==_0xdd99('0x81')){throw new Error(_0xdd99('0x82'));}if(_['some'](_0x14153d,[_0xdd99('0x2a'),_0xdd99('0x81')])&&_0x553cbb['user'][_0xdd99('0x2a')]!=='admin'){throw new Error(_0xdd99('0x8b'));}return licenseUtil[_0xdd99('0x84')](_0x14153d)[_0xdd99('0x20')](function(){return validateUser(_0x14153d[0x0]);})[_0xdd99('0x20')](function(){for(var _0x49f32f=0x1;_0x49f32f<_0x14153d[_0xdd99('0x6d')];_0x49f32f++){var _0x1713fb=_0x14153d[_0x49f32f-0x1]['internal'];if(!_0x14153d[_0x49f32f][_0xdd99('0x61')])_0x14153d[_0x49f32f][_0xdd99('0x61')]=_0x1713fb+0x1;_0x2180aa[_0xdd99('0x4b')](validateUser(_0x14153d[_0x49f32f]));}return Promise[_0xdd99('0x5b')](_0x2180aa);})[_0xdd99('0x20')](function(){_0x2180aa=[];for(var _0x2280a0=0x0;_0x2280a0<_0x14153d['length'];_0x2280a0++){_0x2180aa['push'](updateUser(_0x14153d[_0x2280a0]));}return Promise[_0xdd99('0x5b')](_0x2180aa);})[_0xdd99('0x20')](function(){_0x2180aa=_0x14153d[_0xdd99('0x34')](function(_0x113f67){return db[_0xdd99('0x3c')]['create'](_0x113f67,{'include':[{'model':db[_0xdd99('0x71')],'as':_0xdd99('0x71')}]})[_0xdd99('0x20')](function(_0x37936b){_0x113f67['id']=_0x37936b['id'];return _0x113f67;});});return Promise['all'](_0x2180aa);})['then'](function(_0x4bb461){if(_0x553cbb['body'][_0xdd99('0x2a')]==='user')return _0x4bb461;if(_0x553cbb[_0xdd99('0x2f')][_0xdd99('0x2a')]!==_0xdd99('0x2f'))return _0x4bb461;var _0x3ea52c=_[_0xdd99('0x8a')](_0x4bb461,function(_0x2b64da){return _0x2b64da['role']===_0xdd99('0x2b')||_0x2b64da[_0xdd99('0x2a')]===_0xdd99('0x32');});if(!_0x3ea52c)return _0x4bb461;return db[_0xdd99('0x87')]['findAll']({'where':{'name':{'$or':[_0xdd99('0x30'),_0xdd99('0x31')]},'userProfileId':_0x553cbb[_0xdd99('0x2f')][_0xdd99('0x86')]},'raw':!![]})[_0xdd99('0x20')](function(_0x5a377b){if(_[_0xdd99('0x8c')](_0x5a377b)||!_['some'](_0x5a377b,[_0xdd99('0x88'),0x0]))return _0x4bb461;_0x2180aa=[];var _0x530989=_(_0x5a377b)[_0xdd99('0x34')](function(_0x42e9fe){if(_0x42e9fe[_0xdd99('0x88')]===0x1)return;return _0x42e9fe[_0xdd99('0x37')]===_0xdd99('0x30')?_0xdd99('0x2b'):_0xdd99('0x32');})['compact']()['value']();for(var _0x12c5c0=0x0;_0x12c5c0<_0x4bb461[_0xdd99('0x6d')];_0x12c5c0++){if(!_[_0xdd99('0x36')](_0x530989,_0x4bb461[_0x12c5c0][_0xdd99('0x2a')]))return;var _0x3e8622=_0x4bb461[_0x12c5c0]['role']===_0xdd99('0x2b')?_0xdd99('0x30'):_0xdd99('0x31');_0x2180aa[_0xdd99('0x4b')](db[_0xdd99('0x38')][_0xdd99('0x7f')]({'name':_0x4bb461[_0x12c5c0][_0xdd99('0x37')],'resourceId':_0x4bb461[_0x12c5c0]['id'],'type':_0x3e8622,'sectionId':_[_0xdd99('0x58')](_0x5a377b,[_0xdd99('0x37'),_0x3e8622])['id']},{}));}return Promise[_0xdd99('0x5b')](_0x2180aa);});})[_0xdd99('0x20')](respondWithResult(_0x4757f9,0xc9))[_0xdd99('0x28')](handleError(_0x4757f9,null));};exports['changePassword']=function(_0x5b8cfb,_0x492588){if(_0x5b8cfb['body']['id']){delete _0x5b8cfb[_0xdd99('0x5c')]['id'];}return db[_0xdd99('0x3c')]['find']({'where':{'id':_0x5b8cfb['params']['id']}})[_0xdd99('0x20')](function(_0x13df3c){if(!_0x13df3c)return null;if(_0x13df3c['id']===_0x5b8cfb['user']['id']){if(!_0x5b8cfb[_0xdd99('0x5c')]['oldPassword']||!_0x5b8cfb[_0xdd99('0x5c')][_0xdd99('0x8d')]){throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0x90'));}if(!_0x13df3c[_0xdd99('0x91')](_0x5b8cfb[_0xdd99('0x5c')]['oldPassword'])){throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0x92'));}if(_0x5b8cfb['body'][_0xdd99('0x93')]===_0x5b8cfb['body'][_0xdd99('0x8d')]){throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x5b8cfb[_0xdd99('0x2f')][_0xdd99('0x2a')]===_0xdd99('0x81')){if(!_0x5b8cfb[_0xdd99('0x5c')][_0xdd99('0x8d')]){throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0x94'));}}else if(_0x5b8cfb['user']['role']==='user'){if(!_0x5b8cfb[_0xdd99('0x5c')][_0xdd99('0x8d')]){throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0x94'));}if(_0x13df3c[_0xdd99('0x2a')]!=='agent'){throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0x80'));}}else{throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0x80'));}return _0x13df3c;})[_0xdd99('0x20')](handleEntityNotFound(_0x492588,null))[_0xdd99('0x20')](function(_0xdcc380){return db[_0xdd99('0x62')][_0xdd99('0x95')]({'attributes':['id',_0xdd99('0x64'),'enforcePasswordHistory',_0xdd99('0x96')]})[_0xdd99('0x20')](function(_0x24def6){if(_0x24def6['securePassword'])authService[_0xdd99('0x65')](_0x5b8cfb[_0xdd99('0x5c')][_0xdd99('0x8d')]);if(!_0x24def6['enforcePasswordHistory']||!_0xdcc380['previousPasswords'])return _0xdcc380;authService[_0xdd99('0x97')](_0x5b8cfb[_0xdd99('0x5c')]['newPassword'],_0xdcc380['previousPasswords'],_0x24def6[_0xdd99('0x96')]);return _0xdcc380;})[_0xdd99('0x20')](saveUpdates({'password':_0x5b8cfb[_0xdd99('0x5c')][_0xdd99('0x8d')],'passwordResetAt':_0x5b8cfb['user']['id']==_0x5b8cfb['params']['id']?moment():null,'previousPasswords':authService[_0xdd99('0x98')](_0x5b8cfb[_0xdd99('0x5c')]['newPassword'],_0xdcc380[_0xdd99('0x99')])},null));})[_0xdd99('0x20')](respondWithResult(_0x492588,null))[_0xdd99('0x28')](handleError(_0x492588,null));};exports[_0xdd99('0x9a')]=function(_0x3d5579,_0x2764f0){var _0x543938=_0x3d5579['body'][_0xdd99('0x9b')];return db[_0xdd99('0x3c')][_0xdd99('0x58')]({'where':{'id':_0x3d5579[_0xdd99('0x54')]['id']},'attributes':['id',_0xdd99('0x37'),_0xdd99('0x2a'),_0xdd99('0x9c'),_0xdd99('0x9d'),_0xdd99('0x9e'),_0xdd99('0x9f')]})[_0xdd99('0x20')](handleEntityNotFound(_0x2764f0,null))['then'](function(_0x55d723){if(_0x55d723){if(!utils[_0xdd99('0xa0')](_0x543938)){throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0xa1'));}return _0x55d723[_0xdd99('0xa2')+_['capitalize'](_0x543938[_0xdd99('0xa3')]())+_0xdd99('0xa4')](_0x3d5579[_0xdd99('0x5c')]['ids'],{'penalty':_0x3d5579[_0xdd99('0x5c')][_0xdd99('0xa5')]||0x0})['spread'](function(_0x3a2f33){for(var _0xac256f=0x0;_0xac256f<_0x3d5579[_0xdd99('0x5c')]['ids']['length'];_0xac256f+=0x1){var _0x431b17={'UserId':Number(_0x3d5579[_0xdd99('0x54')]['id'])};_0x431b17[_[_0xdd99('0xa6')](_0x543938[_0xdd99('0xa3')]())+_0xdd99('0xa7')]=Number(_0x3d5579[_0xdd99('0x5c')]['ids'][_0xac256f]);socket['emit']('user'+_[_0xdd99('0xa6')](_0x543938[_0xdd99('0xa3')]())+_0xdd99('0xa8'),_0x431b17);}return _0x3a2f33;})['then'](function(){if(_0x543938===_0xdd99('0xa9')){return db[_0xdd99('0xaa')][_0xdd99('0x4c')]({'where':{'id':_0x3d5579['body'][_0xdd99('0x5f')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xdd99('0x20')](function(_0x36962a){var _0x1d16d4=_0x55d723[_0xdd99('0xab')]({'plain':!![]});var _0x5499d6=[];if(_0x543938==='voice'&&_0x1d16d4['role']===_0xdd99('0x2b')&&_0x1d16d4[_0xdd99('0x9c')]){for(let _0xaaeeef=0x0;_0xaaeeef<_0x36962a[_0xdd99('0x6d')];_0xaaeeef+=0x1){_0x5499d6[_0xdd99('0x4b')]({'membername':_0x1d16d4[_0xdd99('0x37')],'UserId':_0x1d16d4['id'],'queue_name':_0x36962a[_0xaaeeef]['name'],'VoiceQueueId':_0x36962a[_0xaaeeef]['id'],'interface':_['isNil'](_0x1d16d4[_0xdd99('0x9f')])?util[_0xdd99('0xac')](_0xdd99('0xad'),_0x1d16d4['name']):_0x1d16d4['interface'],'paused':_0x1d16d4[_0xdd99('0x9e')]||![],'penalty':_0x3d5579['body'][_0xdd99('0xa5')]||0x0});}return Promise[_0xdd99('0x5b')](_0x5499d6[_0xdd99('0x34')](function(_0xa96bd){return db[_0xdd99('0xae')]['upsert'](_0xa96bd);}));}return _0x55d723;});}})[_0xdd99('0x20')](respondWithStatusCode(_0x2764f0,null))[_0xdd99('0x28')](handleError(_0x2764f0,null));};exports[_0xdd99('0xaf')]=function(_0x3fe28e,_0x1015a9){var _0x59711a,_0x72e329;return db['User'][_0xdd99('0x58')]({'where':{'id':_0x3fe28e[_0xdd99('0x54')]['id']},'attributes':['id',_0xdd99('0x37'),_0xdd99('0x2a')]})[_0xdd99('0x20')](handleEntityNotFound(_0x1015a9,null))['then'](function(_0x1a036a){if(_0x1a036a){_0x59711a=_0x1a036a;if(!_0x3fe28e[_0xdd99('0x45')][_0xdd99('0x9b')]||!utils[_0xdd99('0xa0')](_0x3fe28e[_0xdd99('0x45')]['channel'])){throw new db[(_0xdd99('0x8e'))]['ValidationError']('Unknown\x20channel');}return _0x1a036a[_0xdd99('0xb0')+_[_0xdd99('0xa6')](_0x3fe28e[_0xdd99('0x45')][_0xdd99('0x9b')][_0xdd99('0xa3')]())+_0xdd99('0xa4')](_0x3fe28e['query'][_0xdd99('0x5f')]);}})[_0xdd99('0x20')](function(_0x10804a){if(_['isArray'](_0x3fe28e[_0xdd99('0x45')][_0xdd99('0x5f')])){for(var _0x233e34=0x0;_0x233e34<_0x3fe28e[_0xdd99('0x45')][_0xdd99('0x5f')][_0xdd99('0x6d')];_0x233e34+=0x1){_0x72e329={'UserId':Number(_0x3fe28e[_0xdd99('0x54')]['id'])};_0x72e329[_[_0xdd99('0xa6')](_0x3fe28e['query']['channel']['toLowerCase']())+_0xdd99('0xa7')]=Number(_0x3fe28e[_0xdd99('0x45')]['ids'][_0x233e34]);socket[_0xdd99('0x2c')]('user'+_[_0xdd99('0xa6')](_0x3fe28e['query'][_0xdd99('0x9b')]['toLowerCase']())+_0xdd99('0xb1'),_0x72e329);}}else{_0x72e329={'UserId':Number(_0x3fe28e[_0xdd99('0x54')]['id'])};_0x72e329[_[_0xdd99('0xa6')](_0x3fe28e[_0xdd99('0x45')][_0xdd99('0x9b')][_0xdd99('0xa3')]())+_0xdd99('0xa7')]=Number(_0x3fe28e[_0xdd99('0x45')][_0xdd99('0x5f')]);socket[_0xdd99('0x2c')]('user'+_[_0xdd99('0xa6')](_0x3fe28e[_0xdd99('0x45')][_0xdd99('0x9b')][_0xdd99('0xa3')]())+_0xdd99('0xb1'),_0x72e329);}return _0x10804a;})[_0xdd99('0x20')](function(){if(_0x3fe28e['query'][_0xdd99('0x9b')]===_0xdd99('0xa9')){return db['UserVoiceQueueRt'][_0xdd99('0x39')]({'where':{'UserId':_0x3fe28e[_0xdd99('0x54')]['id'],'VoiceQueueId':_0x3fe28e[_0xdd99('0x45')][_0xdd99('0x5f')]},'individualHooks':!![]})[_0xdd99('0x20')](function(){return _0x59711a;});}return _0x59711a;})[_0xdd99('0x20')](respondWithStatusCode(_0x1015a9,null))['catch'](handleError(_0x1015a9,null));};exports[_0xdd99('0xb2')]=function(_0x21b43a,_0x4f2a11){_0x21b43a[_0xdd99('0x5c')][_0xdd99('0xb3')]=_0x21b43a['file'][_0xdd99('0xb4')];return db[_0xdd99('0x3c')][_0xdd99('0x58')]({'where':{'id':_0x21b43a[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x4f2a11,null))[_0xdd99('0x20')](saveUpdates(_0x21b43a[_0xdd99('0x5c')],null))[_0xdd99('0x20')](respondWithResult(_0x4f2a11,null))[_0xdd99('0x28')](handleError(_0x4f2a11,null));};exports[_0xdd99('0xb5')]=function(_0x2c4f92,_0x49c61b){var _0x54bed8=path['join'](config[_0xdd99('0xb6')],_0xdd99('0xb7'));return db['User'][_0xdd99('0x58')]({'where':{'id':_0x2c4f92[_0xdd99('0x54')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x49c61b,null))[_0xdd99('0x20')](function(_0x40e29b){if(_0x40e29b){if(_[_0xdd99('0x67')](_0x40e29b['userpic'])){return _0x49c61b[_0xdd99('0xb8')](_0x54bed8);}else{if(!fs[_0xdd99('0xb9')](path[_0xdd99('0xba')](config[_0xdd99('0xb6')],_0xdd99('0xbb'),_0x40e29b[_0xdd99('0xb3')]))){return _0x49c61b['download'](_0x54bed8);}return _0x49c61b[_0xdd99('0xb8')](path[_0xdd99('0xba')](config[_0xdd99('0xb6')],_0xdd99('0xbb'),_0x40e29b[_0xdd99('0xb3')]));}}})['catch'](handleError(_0x49c61b,null));};exports[_0xdd99('0xbc')]=function(_0x412896,_0x43b062){return db[_0xdd99('0x3c')]['find']({'where':{'id':_0x412896[_0xdd99('0x54')]['id']},'attributes':['id']})[_0xdd99('0x20')](handleEntityNotFound(_0x43b062,null))['then'](function(_0x32de15){var _0xef7dcf=[];values=_0x32de15[_0xdd99('0x4f')];_0xef7dcf['push'](get_open_tabs(_0xdd99('0x59'),_0x32de15[_0xdd99('0x4f')]));_0xef7dcf[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x50'),_0x32de15[_0xdd99('0x4f')]));_0xef7dcf['push'](get_open_tabs('openchannel',_0x32de15[_0xdd99('0x4f')]));_0xef7dcf[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x53'),_0x32de15['dataValues']));_0xef7dcf[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x51'),_0x32de15[_0xdd99('0x4f')]));_0xef7dcf[_0xdd99('0x4b')](get_open_tabs(_0xdd99('0x52'),_0x32de15[_0xdd99('0x4f')]));return Promise[_0xdd99('0x5b')](_0xef7dcf);})[_0xdd99('0x20')](function(_0x1a909f){if(_0x1a909f){var _0x9e92bf=_['map'](values[_0xdd99('0xbd')],function(_0x35989d){return{'channel':_0xdd99('0xbe'),'id':_0x35989d['id'],'createdAt':_0x35989d[_0xdd99('0xbf')]};});var _0x3d59dd=_['map'](values[_0xdd99('0xc0')],function(_0x2b4efd){return{'channel':'FAX','id':_0x2b4efd['id'],'createdAt':_0x2b4efd[_0xdd99('0xbf')]};});var _0x403695=_['map'](values[_0xdd99('0xc1')],function(_0x30921d){return{'channel':'OPENCHANNEL','id':_0x30921d['id'],'createdAt':_0x30921d[_0xdd99('0xbf')]};});var _0x498d57=_[_0xdd99('0x34')](values[_0xdd99('0xc2')],function(_0x2e83f3){return{'channel':'MAIL','id':_0x2e83f3['id'],'createdAt':_0x2e83f3['createdAt']};});var _0x9e5214=_[_0xdd99('0x34')](values['SmsOpenTabs'],function(_0x1e9486){return{'channel':_0xdd99('0xc3'),'id':_0x1e9486['id'],'createdAt':_0x1e9486['createdAt']};});var _0x27a15a=_[_0xdd99('0x34')](values[_0xdd99('0xc4')],function(_0x5a9412){return{'channel':_0xdd99('0xc5'),'id':_0x5a9412['id'],'createdAt':_0x5a9412['createdAt']};});var _0x14fe3f=_['concat'](_0x9e92bf,_0x3d59dd,_0x403695,_0x498d57,_0x9e5214,_0x27a15a);var _0x3eca4d={'count':_0x14fe3f['length'],'rows':_0x14fe3f};return _0x3eca4d;}else return null;})[_0xdd99('0x20')](respondWithResult(_0x43b062,null))[_0xdd99('0x28')](handleError(_0x43b062,null));};exports['getContacts']=function(_0x580f41,_0x5a02f8){var _0x232779={};return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x580f41[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](function(_0x2db4ad){if(!_0x2db4ad){throw new APINotFoundError(util[_0xdd99('0xac')]('User\x20with\x20id\x20%s\x20not\x20found',_0x580f41[_0xdd99('0x54')]['id']));}return contacts[_0xdd99('0x5d')]();})[_0xdd99('0x20')](function(_0x35d610){_0x580f41[_0xdd99('0x45')]['User']=_0x580f41[_0xdd99('0x54')]['id'];_0x232779=qs['getOptions'](_0x35d610,_0x580f41);if(_0x580f41[_0xdd99('0x45')][_0xdd99('0xc6')](_0xdd99('0x46'))){_0x232779[_0xdd99('0x49')]=[{'model':db[_0xdd99('0xc7')],'as':_0xdd99('0xc8'),'required':![]},{'model':db[_0xdd99('0xc9')],'as':_0xdd99('0xca'),'attributes':['id','name',_0xdd99('0xcb')],'where':_0x580f41[_0xdd99('0x45')][_0xdd99('0xcc')]?{'id':_0x580f41[_0xdd99('0x45')][_0xdd99('0xcc')]}:undefined,'required':_0x580f41[_0xdd99('0x45')]['tag']?!![]:![]}];}return contacts[_0xdd99('0x4c')](_0x580f41[_0xdd99('0x45')],_0x580f41[_0xdd99('0x2f')],_0x232779,_0x35d610);})[_0xdd99('0x20')](respondWithFilteredResult(_0x5a02f8,_0x232779))[_0xdd99('0x28')](APIHandleError(_0x5a02f8));};exports[_0xdd99('0xcd')]=function(_0x51663b,_0x4f3fde){var _0x1d0648;var _0x366986={};var _0x16fb94;return db[_0xdd99('0x3c')]['findOne']({'where':{'id':_0x51663b[_0xdd99('0x54')]['id']},'attributes':['id',_0xdd99('0x37'),_0xdd99('0x2a')]})[_0xdd99('0x20')](handleEntityNotFound(_0x4f3fde,null))[_0xdd99('0x20')](function(_0x2eb0a7){if(!utils[_0xdd99('0xa0')](_0x51663b[_0xdd99('0x45')][_0xdd99('0x9b')])){throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0xa1'));}_0x1d0648=_0x2eb0a7;var _0x421c7f={};_0x421c7f[_0xdd99('0xce')]=_[_0xdd99('0xcf')](db[_['capitalize'](_0x51663b['query'][_0xdd99('0x9b')])+_0xdd99('0xd0')][_0xdd99('0x3d')]);_0x421c7f[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x51663b[_0xdd99('0x45')]);_0x421c7f['filters']=_[_0xdd99('0xd1')](_0x421c7f[_0xdd99('0xce')],_0x421c7f[_0xdd99('0x45')]);_0x366986[_0xdd99('0x57')]=_[_0xdd99('0xd1')](_0x421c7f[_0xdd99('0xce')],qs['fields'](_0x51663b[_0xdd99('0x45')][_0xdd99('0xd2')]));_0x366986['attributes']=_0x366986[_0xdd99('0x57')][_0xdd99('0x6d')]?_0x366986[_0xdd99('0x57')]:_0x421c7f[_0xdd99('0xce')];_0x366986['order']=qs[_0xdd99('0xd3')](_0x51663b[_0xdd99('0x45')][_0xdd99('0xd3')]);_0x366986[_0xdd99('0x44')]=qs['filters'](_[_0xdd99('0xd4')](_0x51663b[_0xdd99('0x45')],_0x421c7f['filters']));if(_0x51663b[_0xdd99('0x45')][_0xdd99('0x33')]){_0x366986[_0xdd99('0x44')]=_[_0xdd99('0x55')](_0x366986['where'],{'$or':_[_0xdd99('0x34')](_0x366986[_0xdd99('0x57')],function(_0x289cf0){var _0x22d24d={};_0x22d24d[_0x289cf0]={'$like':'%'+_0x51663b[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x22d24d;})});}_0x366986=_[_0xdd99('0x55')]({},_0x366986,_0x51663b[_0xdd99('0x56')]);switch(_0x1d0648['role']){case _0xdd99('0x81'):return db[_[_0xdd99('0xa6')](_0x51663b['query']['channel'])+_0xdd99('0xd0')]['findAll'](_0x366986);case _0xdd99('0x2f'):case'agent':return _0x1d0648[_0xdd99('0xab')+_[_0xdd99('0xa6')](_0x51663b['query']['channel'])+_0xdd99('0xa4')](_0x366986);default:throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0xd5'));}})[_0xdd99('0x20')](function(_0x5d52a9){_0x16fb94=_0x5d52a9['length'];if(!_0x51663b[_0xdd99('0x45')]['hasOwnProperty'](_0xdd99('0xd6'))){_0x366986[_0xdd99('0x1c')]=qs[_0xdd99('0x1c')](_0x51663b['query']['limit']);_0x366986[_0xdd99('0x1b')]=qs[_0xdd99('0x1b')](_0x51663b[_0xdd99('0x45')][_0xdd99('0x1b')]);}switch(_0x1d0648[_0xdd99('0x2a')]){case _0xdd99('0x81'):return db[_[_0xdd99('0xa6')](_0x51663b[_0xdd99('0x45')][_0xdd99('0x9b')])+'Queue']['findAll'](_0x366986);case _0xdd99('0x2f'):case _0xdd99('0x2b'):return _0x1d0648['get'+_[_0xdd99('0xa6')](_0x51663b[_0xdd99('0x45')]['channel'])+_0xdd99('0xa4')](_0x366986);}})[_0xdd99('0x20')](function(_0x41fc04){return{'count':_0x16fb94,'rows':_0x41fc04};})[_0xdd99('0x20')](respondWithResult(_0x4f3fde,null))[_0xdd99('0x28')](handleError(_0x4f3fde,null));};exports[_0xdd99('0xd7')]=function(_0x3d7314,_0x19b232){var _0x553114={};var _0x24f86d={};var _0x545828;var _0x412955;return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x3d7314[_0xdd99('0x54')]['id']}})['then'](handleEntityNotFound(_0x19b232,null))[_0xdd99('0x20')](function(_0x1274ae){if(_0x1274ae){_0x545828=_0x1274ae;_0x24f86d[_0xdd99('0xce')]=_['keys'](db['UserVoiceQueueRt'][_0xdd99('0x3d')]);_0x24f86d['query']=_[_0xdd99('0xcf')](_0x3d7314[_0xdd99('0x45')]);_0x24f86d[_0xdd99('0xd8')]=_['intersection'](_0x24f86d[_0xdd99('0xce')],_0x24f86d[_0xdd99('0x45')]);_0x553114[_0xdd99('0x57')]=_['intersection'](_0x24f86d[_0xdd99('0xce')],qs[_0xdd99('0xd2')](_0x3d7314['query'][_0xdd99('0xd2')]));_0x553114[_0xdd99('0x57')]=_0x553114[_0xdd99('0x57')][_0xdd99('0x6d')]?_0x553114[_0xdd99('0x57')]:_0x24f86d[_0xdd99('0xce')];_0x553114[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x3d7314[_0xdd99('0x45')][_0xdd99('0xd3')]);_0x553114[_0xdd99('0x44')]=qs[_0xdd99('0xd8')](_[_0xdd99('0xd4')](_0x3d7314[_0xdd99('0x45')],_0x24f86d[_0xdd99('0xd8')]));if(_0x3d7314[_0xdd99('0x45')][_0xdd99('0x33')]){_0x553114['where']=_['merge'](_0x553114[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0x553114[_0xdd99('0x57')],function(_0xcb9610){var _0x17c571={};_0x17c571[_0xcb9610]={'$like':'%'+_0x3d7314['query'][_0xdd99('0x33')]+'%'};return _0x17c571;})});}_0x553114=_['merge']({},_0x553114,_0x3d7314[_0xdd99('0x56')]);return _0x545828[_0xdd99('0xd7')](_0x553114);}})['then'](function(_0x457090){if(_0x457090){_0x412955=_0x457090[_0xdd99('0x6d')];if(!_0x3d7314[_0xdd99('0x45')][_0xdd99('0xc6')]('nolimit')){_0x553114[_0xdd99('0x1c')]=qs['limit'](_0x3d7314['query'][_0xdd99('0x1c')]);_0x553114[_0xdd99('0x1b')]=qs[_0xdd99('0x1b')](_0x3d7314['query'][_0xdd99('0x1b')]);}return _0x545828[_0xdd99('0xd7')](_0x553114);}})['then'](function(_0x4185bf){if(_0x4185bf){return _0x4185bf?{'count':_0x412955,'rows':_0x4185bf}:null;}})[_0xdd99('0x20')](respondWithResult(_0x19b232,null))[_0xdd99('0x28')](handleError(_0x19b232,null));};exports['getGroups']=function(_0x137930,_0x42e35e){var _0x46c2fc={};var _0x453805={};var _0x325112;var _0x11ed21;return db[_0xdd99('0x3c')]['findOne']({'where':{'id':_0x137930[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x42e35e,null))[_0xdd99('0x20')](function(_0x19c6e4){if(_0x19c6e4){_0x325112=_0x19c6e4;_0x453805[_0xdd99('0xce')]=_['keys'](db[_0xdd99('0xda')][_0xdd99('0x3d')]);_0x453805[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x137930['query']);_0x453805[_0xdd99('0xd8')]=_['intersection'](_0x453805['model'],_0x453805[_0xdd99('0x45')]);_0x46c2fc[_0xdd99('0x57')]=_['intersection'](_0x453805[_0xdd99('0xce')],qs[_0xdd99('0xd2')](_0x137930[_0xdd99('0x45')]['fields']));_0x46c2fc[_0xdd99('0x57')]=_0x46c2fc['attributes'][_0xdd99('0x6d')]?_0x46c2fc[_0xdd99('0x57')]:_0x453805['model'];_0x46c2fc[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x137930['query'][_0xdd99('0xd3')]);_0x46c2fc[_0xdd99('0x44')]=qs['filters'](_[_0xdd99('0xd4')](_0x137930['query'],_0x453805[_0xdd99('0xd8')]));if(_0x137930[_0xdd99('0x45')][_0xdd99('0x33')]){_0x46c2fc[_0xdd99('0x44')]=_[_0xdd99('0x55')](_0x46c2fc['where'],{'$or':_[_0xdd99('0x34')](_0x46c2fc[_0xdd99('0x57')],function(_0x5adbb9){var _0x13b90c={};_0x13b90c[_0x5adbb9]={'$like':'%'+_0x137930[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x13b90c;})});}_0x46c2fc=_[_0xdd99('0x55')]({},_0x46c2fc,_0x137930[_0xdd99('0x56')]);return _0x325112[_0xdd99('0xdb')](_0x46c2fc);}})[_0xdd99('0x20')](function(_0x11d5a7){if(_0x11d5a7){_0x11ed21=_0x11d5a7[_0xdd99('0x6d')];if(!_0x137930[_0xdd99('0x45')][_0xdd99('0xc6')](_0xdd99('0xd6'))){_0x46c2fc[_0xdd99('0x1c')]=qs[_0xdd99('0x1c')](_0x137930[_0xdd99('0x45')][_0xdd99('0x1c')]);_0x46c2fc[_0xdd99('0x1b')]=qs['offset'](_0x137930['query'][_0xdd99('0x1b')]);}return _0x325112[_0xdd99('0xdb')](_0x46c2fc);}})[_0xdd99('0x20')](function(_0x109fff){if(_0x109fff){return _0x109fff?{'count':_0x11ed21,'rows':_0x109fff}:null;}})['then'](respondWithResult(_0x42e35e,null))['catch'](handleError(_0x42e35e,null));};exports[_0xdd99('0xdc')]=function(_0x1670fc,_0x36f3c2){var _0x7cb3e2={'raw':!![],'where':{}};var _0x57e2c2={};var _0x73d7fe={'count':0x0,'rows':[]};return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x1670fc[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x36f3c2,null))['then'](function(_0x11a5a1){if(_0x11a5a1){_0x57e2c2[_0xdd99('0xce')]=_[_0xdd99('0xcf')](db['VoiceRecording'][_0xdd99('0x3d')]);_0x57e2c2[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x1670fc[_0xdd99('0x45')]);_0x57e2c2['filters']=_[_0xdd99('0xd1')](_0x57e2c2[_0xdd99('0xce')],_0x57e2c2[_0xdd99('0x45')]);_0x7cb3e2[_0xdd99('0x57')]=_['intersection'](_0x57e2c2[_0xdd99('0xce')],qs['fields'](_0x1670fc[_0xdd99('0x45')][_0xdd99('0xd2')]));_0x7cb3e2['attributes']=_0x7cb3e2[_0xdd99('0x57')][_0xdd99('0x6d')]?_0x7cb3e2[_0xdd99('0x57')]:_0x57e2c2[_0xdd99('0xce')];if(!_0x1670fc[_0xdd99('0x45')][_0xdd99('0xc6')]('nolimit')){_0x7cb3e2[_0xdd99('0x1c')]=qs[_0xdd99('0x1c')](_0x1670fc['query'][_0xdd99('0x1c')]);_0x7cb3e2['offset']=qs[_0xdd99('0x1b')](_0x1670fc[_0xdd99('0x45')][_0xdd99('0x1b')]);}_0x7cb3e2[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x1670fc[_0xdd99('0x45')][_0xdd99('0xd3')]);_0x7cb3e2['where']=qs[_0xdd99('0xd8')](_[_0xdd99('0xd4')](_0x1670fc['query'],_0x57e2c2[_0xdd99('0xd8')]));_0x7cb3e2['where'][_0xdd99('0xdd')]=_0x11a5a1['id'];if(_0x1670fc[_0xdd99('0x45')][_0xdd99('0x33')]){_0x7cb3e2[_0xdd99('0x44')]=_[_0xdd99('0x55')](_0x7cb3e2[_0xdd99('0x44')],{'$or':_['map'](_0x7cb3e2[_0xdd99('0x57')],function(_0x102be6){var _0x248d74={};_0x248d74[_0x102be6]={'$like':'%'+_0x1670fc[_0xdd99('0x45')]['filter']+'%'};return _0x248d74;})});}_0x7cb3e2=_[_0xdd99('0x55')]({},_0x7cb3e2,_0x1670fc[_0xdd99('0x56')]);return db['VoiceRecording'][_0xdd99('0x1a')]({'where':_0x7cb3e2[_0xdd99('0x44')]})[_0xdd99('0x20')](function(_0x155e4a){_0x73d7fe[_0xdd99('0x1a')]=_0x155e4a;if(_0x1670fc['query']['includeAll']){_0x7cb3e2[_0xdd99('0x49')]=[{'all':!![]}];}return db[_0xdd99('0xde')]['findAll'](_0x7cb3e2);})[_0xdd99('0x20')](function(_0x2b76c9){_0x73d7fe[_0xdd99('0x4d')]=_0x2b76c9;return _0x73d7fe;});}})['then'](respondWithFilteredResult(_0x36f3c2,_0x7cb3e2))[_0xdd99('0x28')](handleError(_0x36f3c2,null));};exports[_0xdd99('0xdf')]=function(_0x2acee9,_0x4196d2){var _0x4e3dcd={'raw':!![],'where':{}};var _0x162102={};var _0x31ac55={'count':0x0,'rows':[]};return db[_0xdd99('0x3c')]['findOne']({'where':{'id':_0x2acee9[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x4196d2,null))[_0xdd99('0x20')](function(_0x13d7e4){if(_0x13d7e4){_0x162102[_0xdd99('0xce')]=_[_0xdd99('0xcf')](db['ScreenRecording'][_0xdd99('0x3d')]);_0x162102[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x2acee9['query']);_0x162102[_0xdd99('0xd8')]=_[_0xdd99('0xd1')](_0x162102[_0xdd99('0xce')],_0x162102[_0xdd99('0x45')]);_0x4e3dcd[_0xdd99('0x57')]=_[_0xdd99('0xd1')](_0x162102['model'],qs['fields'](_0x2acee9[_0xdd99('0x45')][_0xdd99('0xd2')]));_0x4e3dcd[_0xdd99('0x57')]=_0x4e3dcd[_0xdd99('0x57')]['length']?_0x4e3dcd[_0xdd99('0x57')]:_0x162102['model'];if(!_0x2acee9[_0xdd99('0x45')][_0xdd99('0xc6')]('nolimit')){_0x4e3dcd[_0xdd99('0x1c')]=qs[_0xdd99('0x1c')](_0x2acee9['query'][_0xdd99('0x1c')]);_0x4e3dcd['offset']=qs[_0xdd99('0x1b')](_0x2acee9[_0xdd99('0x45')][_0xdd99('0x1b')]);}_0x4e3dcd[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x2acee9['query'][_0xdd99('0xd3')]);_0x4e3dcd[_0xdd99('0x44')]=qs['filters'](_[_0xdd99('0xd4')](_0x2acee9[_0xdd99('0x45')],_0x162102['filters']));_0x4e3dcd['where']['UserId']=_0x13d7e4['id'];if(_0x2acee9[_0xdd99('0x45')][_0xdd99('0x33')]){_0x4e3dcd[_0xdd99('0x44')]=_[_0xdd99('0x55')](_0x4e3dcd[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0x4e3dcd['attributes'],function(_0x348cf8){var _0x4f7081={};_0x4f7081[_0x348cf8]={'$like':'%'+_0x2acee9[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x4f7081;})});}_0x4e3dcd=_[_0xdd99('0x55')]({},_0x4e3dcd,_0x2acee9[_0xdd99('0x56')]);return db[_0xdd99('0xe0')][_0xdd99('0x1a')]({'where':_0x4e3dcd[_0xdd99('0x44')]})[_0xdd99('0x20')](function(_0x4317ec){_0x31ac55[_0xdd99('0x1a')]=_0x4317ec;if(_0x2acee9[_0xdd99('0x45')]['includeAll']){_0x4e3dcd[_0xdd99('0x49')]=[{'all':!![]}];}return db[_0xdd99('0xe0')][_0xdd99('0x4c')](_0x4e3dcd);})['then'](function(_0x344980){_0x31ac55['rows']=_0x344980;return _0x31ac55;});}})[_0xdd99('0x20')](respondWithFilteredResult(_0x4196d2,_0x4e3dcd))[_0xdd99('0x28')](handleError(_0x4196d2,null));};exports[_0xdd99('0xe1')]=function(_0x4110e3,_0x31c4de){var _0x5f6515={};var _0x3dec6c={};var _0x425fdf;var _0x26bcb9;return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x4110e3['params']['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x31c4de,null))[_0xdd99('0x20')](function(_0x335996){if(_0x335996){_0x425fdf=_0x335996;_0x3dec6c['model']=_[_0xdd99('0xcf')](db[_0xdd99('0xe2')][_0xdd99('0x3d')]);_0x3dec6c[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x4110e3['query']);_0x3dec6c[_0xdd99('0xd8')]=_['intersection'](_0x3dec6c[_0xdd99('0xce')],_0x3dec6c[_0xdd99('0x45')]);_0x5f6515['attributes']=_[_0xdd99('0xd1')](_0x3dec6c['model'],qs['fields'](_0x4110e3[_0xdd99('0x45')]['fields']));_0x5f6515[_0xdd99('0x57')]=_0x5f6515[_0xdd99('0x57')][_0xdd99('0x6d')]?_0x5f6515[_0xdd99('0x57')]:_0x3dec6c[_0xdd99('0xce')];_0x5f6515[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x4110e3[_0xdd99('0x45')]['sort']);_0x5f6515[_0xdd99('0x44')]=qs['filters'](_[_0xdd99('0xd4')](_0x4110e3[_0xdd99('0x45')],_0x3dec6c[_0xdd99('0xd8')]));if(_0x4110e3[_0xdd99('0x45')][_0xdd99('0x33')]){_0x5f6515[_0xdd99('0x44')]=_['merge'](_0x5f6515[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0x5f6515['attributes'],function(_0x468074){var _0x647d2e={};_0x647d2e[_0x468074]={'$like':'%'+_0x4110e3[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x647d2e;})});}_0x5f6515=_[_0xdd99('0x55')]({},_0x5f6515,_0x4110e3[_0xdd99('0x56')]);return _0x425fdf['getChatInteractions'](_0x5f6515);}})[_0xdd99('0x20')](function(_0xd17d60){if(_0xd17d60){_0x26bcb9=_0xd17d60['length'];if(!_0x4110e3['query'][_0xdd99('0xc6')](_0xdd99('0xd6'))){_0x5f6515[_0xdd99('0x1c')]=qs['limit'](_0x4110e3[_0xdd99('0x45')][_0xdd99('0x1c')]);_0x5f6515['offset']=qs['offset'](_0x4110e3[_0xdd99('0x45')][_0xdd99('0x1b')]);}return _0x425fdf['getChatInteractions'](_0x5f6515);}})[_0xdd99('0x20')](function(_0x50a166){if(_0x50a166){return _0x50a166?{'count':_0x26bcb9,'rows':_0x50a166}:null;}})[_0xdd99('0x20')](respondWithResult(_0x31c4de,null))['catch'](handleError(_0x31c4de,null));};exports[_0xdd99('0xe3')]=function(_0x439573,_0x5103c3){var _0xca6c27={};var _0x45068f={};var _0x33a879;var _0x32b81e;return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x439573[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x5103c3,null))[_0xdd99('0x20')](function(_0x11c7dd){if(_0x11c7dd){_0x33a879=_0x11c7dd;_0x45068f[_0xdd99('0xce')]=_[_0xdd99('0xcf')](db[_0xdd99('0xe4')]['rawAttributes']);_0x45068f[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x439573[_0xdd99('0x45')]);_0x45068f[_0xdd99('0xd8')]=_[_0xdd99('0xd1')](_0x45068f[_0xdd99('0xce')],_0x45068f[_0xdd99('0x45')]);_0xca6c27[_0xdd99('0x57')]=_[_0xdd99('0xd1')](_0x45068f[_0xdd99('0xce')],qs[_0xdd99('0xd2')](_0x439573[_0xdd99('0x45')]['fields']));_0xca6c27['attributes']=_0xca6c27[_0xdd99('0x57')][_0xdd99('0x6d')]?_0xca6c27['attributes']:_0x45068f['model'];_0xca6c27['order']=qs[_0xdd99('0xd3')](_0x439573[_0xdd99('0x45')][_0xdd99('0xd3')]);_0xca6c27[_0xdd99('0x44')]=qs[_0xdd99('0xd8')](_[_0xdd99('0xd4')](_0x439573[_0xdd99('0x45')],_0x45068f[_0xdd99('0xd8')]));if(_0x439573[_0xdd99('0x45')][_0xdd99('0x33')]){_0xca6c27[_0xdd99('0x44')]=_[_0xdd99('0x55')](_0xca6c27[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0xca6c27[_0xdd99('0x57')],function(_0x35966a){var _0x18d7f0={};_0x18d7f0[_0x35966a]={'$like':'%'+_0x439573[_0xdd99('0x45')]['filter']+'%'};return _0x18d7f0;})});}_0xca6c27=_[_0xdd99('0x55')]({},_0xca6c27,_0x439573[_0xdd99('0x56')]);return _0x33a879[_0xdd99('0xe3')](_0xca6c27);}})[_0xdd99('0x20')](function(_0x2e8c66){if(_0x2e8c66){_0x32b81e=_0x2e8c66[_0xdd99('0x6d')];if(!_0x439573[_0xdd99('0x45')][_0xdd99('0xc6')](_0xdd99('0xd6'))){_0xca6c27[_0xdd99('0x1c')]=qs[_0xdd99('0x1c')](_0x439573[_0xdd99('0x45')][_0xdd99('0x1c')]);_0xca6c27[_0xdd99('0x1b')]=qs['offset'](_0x439573[_0xdd99('0x45')][_0xdd99('0x1b')]);}return _0x33a879[_0xdd99('0xe3')](_0xca6c27);}})[_0xdd99('0x20')](function(_0x30caf1){if(_0x30caf1){return _0x30caf1?{'count':_0x32b81e,'rows':_0x30caf1}:null;}})[_0xdd99('0x20')](respondWithResult(_0x5103c3,null))[_0xdd99('0x28')](handleError(_0x5103c3,null));};exports['getMailInteractions']=function(_0x22283f,_0xfb2b08){var _0x372270={'raw':!![],'where':{}};var _0x1ffa7a={};var _0x59a57a={'count':0x0,'rows':[]};return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x22283f[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0xfb2b08,null))[_0xdd99('0x20')](function(_0x55cbd3){if(_0x55cbd3){_0x1ffa7a['model']=_[_0xdd99('0xcf')](db['MailInteraction'][_0xdd99('0x3d')]);_0x1ffa7a[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x22283f[_0xdd99('0x45')]);_0x1ffa7a[_0xdd99('0xd8')]=_[_0xdd99('0xd1')](_0x1ffa7a['model'],_0x1ffa7a[_0xdd99('0x45')]);_0x372270[_0xdd99('0x57')]=_['intersection'](_0x1ffa7a[_0xdd99('0xce')],qs[_0xdd99('0xd2')](_0x22283f['query'][_0xdd99('0xd2')]));_0x372270[_0xdd99('0x57')]=_0x372270['attributes'][_0xdd99('0x6d')]?_0x372270[_0xdd99('0x57')]:_0x1ffa7a[_0xdd99('0xce')];if(!_0x22283f[_0xdd99('0x45')]['hasOwnProperty'](_0xdd99('0xd6'))){_0x372270['limit']=qs[_0xdd99('0x1c')](_0x22283f[_0xdd99('0x45')]['limit']);_0x372270[_0xdd99('0x1b')]=qs[_0xdd99('0x1b')](_0x22283f[_0xdd99('0x45')][_0xdd99('0x1b')]);}_0x372270[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x22283f[_0xdd99('0x45')][_0xdd99('0xd3')]);_0x372270[_0xdd99('0x44')]=qs[_0xdd99('0xd8')](_[_0xdd99('0xd4')](_0x22283f[_0xdd99('0x45')],_0x1ffa7a[_0xdd99('0xd8')]));_0x372270['where'][_0xdd99('0xdd')]=_0x55cbd3['id'];if(_0x22283f['query'][_0xdd99('0x33')]){_0x372270['where']=_[_0xdd99('0x55')](_0x372270[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0x372270[_0xdd99('0x57')],function(_0x3ca864){var _0x5ee187={};_0x5ee187[_0x3ca864]={'$like':'%'+_0x22283f[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x5ee187;})});}_0x372270=_['merge']({},_0x372270,_0x22283f[_0xdd99('0x56')]);return db[_0xdd99('0xe5')][_0xdd99('0x1a')]({'where':_0x372270[_0xdd99('0x44')]})[_0xdd99('0x20')](function(_0xf8db98){_0x59a57a['count']=_0xf8db98;if(_0x22283f[_0xdd99('0x45')][_0xdd99('0x46')]){_0x372270[_0xdd99('0x49')]=[{'all':!![]}];}return db[_0xdd99('0xe5')][_0xdd99('0x4c')](_0x372270);})[_0xdd99('0x20')](function(_0x26dde5){_0x59a57a['rows']=_0x26dde5;return _0x59a57a;});}})[_0xdd99('0x20')](respondWithFilteredResult(_0xfb2b08,_0x372270))['catch'](handleError(_0xfb2b08,null));};exports[_0xdd99('0xe6')]=function(_0x26a81e,_0x4ddeb4){var _0xaea53f={};var _0x36dca6={};var _0x2ddfb8;var _0x1dc7ee;return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x26a81e['params']['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x4ddeb4,null))['then'](function(_0xba6527){if(_0xba6527){_0x2ddfb8=_0xba6527;_0x36dca6['model']=_['keys'](db[_0xdd99('0xe7')]['rawAttributes']);_0x36dca6[_0xdd99('0x45')]=_['keys'](_0x26a81e[_0xdd99('0x45')]);_0x36dca6['filters']=_['intersection'](_0x36dca6['model'],_0x36dca6[_0xdd99('0x45')]);_0xaea53f['attributes']=_[_0xdd99('0xd1')](_0x36dca6[_0xdd99('0xce')],qs[_0xdd99('0xd2')](_0x26a81e[_0xdd99('0x45')]['fields']));_0xaea53f[_0xdd99('0x57')]=_0xaea53f['attributes'][_0xdd99('0x6d')]?_0xaea53f[_0xdd99('0x57')]:_0x36dca6[_0xdd99('0xce')];_0xaea53f[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x26a81e[_0xdd99('0x45')]['sort']);_0xaea53f[_0xdd99('0x44')]=qs[_0xdd99('0xd8')](_[_0xdd99('0xd4')](_0x26a81e['query'],_0x36dca6['filters']));if(_0x26a81e[_0xdd99('0x45')][_0xdd99('0x33')]){_0xaea53f[_0xdd99('0x44')]=_[_0xdd99('0x55')](_0xaea53f[_0xdd99('0x44')],{'$or':_['map'](_0xaea53f['attributes'],function(_0x3a084c){var _0x5489d0={};_0x5489d0[_0x3a084c]={'$like':'%'+_0x26a81e[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x5489d0;})});}_0xaea53f=_['merge']({},_0xaea53f,_0x26a81e[_0xdd99('0x56')]);return _0x2ddfb8[_0xdd99('0xe6')](_0xaea53f);}})['then'](function(_0xb76cd6){if(_0xb76cd6){_0x1dc7ee=_0xb76cd6['length'];if(!_0x26a81e[_0xdd99('0x45')]['hasOwnProperty'](_0xdd99('0xd6'))){_0xaea53f['limit']=qs[_0xdd99('0x1c')](_0x26a81e['query'][_0xdd99('0x1c')]);_0xaea53f['offset']=qs[_0xdd99('0x1b')](_0x26a81e['query'][_0xdd99('0x1b')]);}return _0x2ddfb8['getSmsInteractions'](_0xaea53f);}})['then'](function(_0x451e3){if(_0x451e3){return _0x451e3?{'count':_0x1dc7ee,'rows':_0x451e3}:null;}})['then'](respondWithResult(_0x4ddeb4,null))[_0xdd99('0x28')](handleError(_0x4ddeb4,null));};exports[_0xdd99('0xe8')]=function(_0xdf4222,_0x356cbc){var _0xd271c1={};var _0x3d263f={};var _0x41bd2a;var _0x53642e;return db['User'][_0xdd99('0x95')]({'where':{'id':_0xdf4222[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x356cbc,null))['then'](function(_0x494ebf){if(_0x494ebf){_0x41bd2a=_0x494ebf;_0x3d263f['model']=_[_0xdd99('0xcf')](db['FaxInteraction'][_0xdd99('0x3d')]);_0x3d263f[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0xdf4222['query']);_0x3d263f[_0xdd99('0xd8')]=_[_0xdd99('0xd1')](_0x3d263f[_0xdd99('0xce')],_0x3d263f['query']);_0xd271c1[_0xdd99('0x57')]=_[_0xdd99('0xd1')](_0x3d263f['model'],qs[_0xdd99('0xd2')](_0xdf4222[_0xdd99('0x45')][_0xdd99('0xd2')]));_0xd271c1[_0xdd99('0x57')]=_0xd271c1[_0xdd99('0x57')][_0xdd99('0x6d')]?_0xd271c1[_0xdd99('0x57')]:_0x3d263f[_0xdd99('0xce')];_0xd271c1[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0xdf4222[_0xdd99('0x45')][_0xdd99('0xd3')]);_0xd271c1[_0xdd99('0x44')]=qs[_0xdd99('0xd8')](_[_0xdd99('0xd4')](_0xdf4222[_0xdd99('0x45')],_0x3d263f[_0xdd99('0xd8')]));if(_0xdf4222[_0xdd99('0x45')]['filter']){_0xd271c1['where']=_[_0xdd99('0x55')](_0xd271c1[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0xd271c1[_0xdd99('0x57')],function(_0x406d1a){var _0x57b7b1={};_0x57b7b1[_0x406d1a]={'$like':'%'+_0xdf4222[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x57b7b1;})});}_0xd271c1=_[_0xdd99('0x55')]({},_0xd271c1,_0xdf4222[_0xdd99('0x56')]);return _0x41bd2a['getFaxInteractions'](_0xd271c1);}})[_0xdd99('0x20')](function(_0x9b53f5){if(_0x9b53f5){_0x53642e=_0x9b53f5[_0xdd99('0x6d')];if(!_0xdf4222['query'][_0xdd99('0xc6')](_0xdd99('0xd6'))){_0xd271c1[_0xdd99('0x1c')]=qs[_0xdd99('0x1c')](_0xdf4222[_0xdd99('0x45')][_0xdd99('0x1c')]);_0xd271c1[_0xdd99('0x1b')]=qs[_0xdd99('0x1b')](_0xdf4222[_0xdd99('0x45')][_0xdd99('0x1b')]);}return _0x41bd2a['getFaxInteractions'](_0xd271c1);}})[_0xdd99('0x20')](function(_0x2b5ead){if(_0x2b5ead){return _0x2b5ead?{'count':_0x53642e,'rows':_0x2b5ead}:null;}})[_0xdd99('0x20')](respondWithResult(_0x356cbc,null))['catch'](handleError(_0x356cbc,null));};exports[_0xdd99('0xe9')]=function(_0x4f0a96,_0x30c4ed){var _0x2fe2a6={};var _0x28179c={};var _0x2e63f8;var _0x424725;return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x4f0a96[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x30c4ed,null))[_0xdd99('0x20')](function(_0x20291f){if(_0x20291f){_0x2e63f8=_0x20291f;_0x28179c['model']=_['keys'](db[_0xdd99('0xea')][_0xdd99('0x3d')]);_0x28179c[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x4f0a96[_0xdd99('0x45')]);_0x28179c[_0xdd99('0xd8')]=_['intersection'](_0x28179c[_0xdd99('0xce')],_0x28179c[_0xdd99('0x45')]);_0x2fe2a6['attributes']=_[_0xdd99('0xd1')](_0x28179c[_0xdd99('0xce')],qs[_0xdd99('0xd2')](_0x4f0a96[_0xdd99('0x45')][_0xdd99('0xd2')]));_0x2fe2a6['attributes']=_0x2fe2a6[_0xdd99('0x57')][_0xdd99('0x6d')]?_0x2fe2a6[_0xdd99('0x57')]:_0x28179c[_0xdd99('0xce')];_0x2fe2a6[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x4f0a96[_0xdd99('0x45')][_0xdd99('0xd3')]);_0x2fe2a6['where']=qs[_0xdd99('0xd8')](_[_0xdd99('0xd4')](_0x4f0a96[_0xdd99('0x45')],_0x28179c[_0xdd99('0xd8')]));if(_0x4f0a96[_0xdd99('0x45')]['filter']){_0x2fe2a6['where']=_[_0xdd99('0x55')](_0x2fe2a6[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0x2fe2a6['attributes'],function(_0x4330c5){var _0x2ff2c6={};_0x2ff2c6[_0x4330c5]={'$like':'%'+_0x4f0a96[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x2ff2c6;})});}_0x2fe2a6=_[_0xdd99('0x55')]({},_0x2fe2a6,_0x4f0a96['options']);return _0x2e63f8['getWhatsappInteractions'](_0x2fe2a6);}})['then'](function(_0x409125){if(_0x409125){_0x424725=_0x409125['length'];if(!_0x4f0a96[_0xdd99('0x45')]['hasOwnProperty'](_0xdd99('0xd6'))){_0x2fe2a6['limit']=qs[_0xdd99('0x1c')](_0x4f0a96[_0xdd99('0x45')][_0xdd99('0x1c')]);_0x2fe2a6['offset']=qs['offset'](_0x4f0a96[_0xdd99('0x45')][_0xdd99('0x1b')]);}return _0x2e63f8[_0xdd99('0xe9')](_0x2fe2a6);}})[_0xdd99('0x20')](function(_0x28e3fe){if(_0x28e3fe){return _0x28e3fe?{'count':_0x424725,'rows':_0x28e3fe}:null;}})[_0xdd99('0x20')](respondWithResult(_0x30c4ed,null))['catch'](handleError(_0x30c4ed,null));};exports[_0xdd99('0xeb')]=function(_0x2f8ccd,_0x100b2f,_0x42ed10){var _0x1d3d4d;var _0x556885;var _0x4d80e3;var _0x5f4f73=!_[_0xdd99('0x67')](_0x2f8ccd[_0xdd99('0x54')]['id'])?_0x2f8ccd[_0xdd99('0x54')]['id']:!_['isNil'](_0x2f8ccd[_0xdd99('0x2f')]['id'])?_0x2f8ccd[_0xdd99('0x2f')]['id']:null;return db[_0xdd99('0x3c')]['find']({'where':{'id':_0x5f4f73,'role':{'$or':[_0xdd99('0x81'),_0xdd99('0x2f'),'agent']}},'attributes':['id',_0xdd99('0x37'),'phone','mobile','role','internal',_0xdd99('0x9d')]})[_0xdd99('0x20')](function(_0x4538d3){if(_0x4538d3){if(_0x4538d3[_0xdd99('0x2a')]===_0xdd99('0x2b')){_0x1d3d4d=_0x4538d3;if(_0x2f8ccd[_0xdd99('0x5c')]['interface']){_0x4d80e3=util['format'](_0xdd99('0xec'),_0x1d3d4d[_0x2f8ccd['body'][_0xdd99('0x9f')]]);}else if(_0x2f8ccd['body'][_0xdd99('0xed')]){_0x4d80e3=util[_0xdd99('0xac')](_0xdd99('0xad'),_0x2f8ccd['body'][_0xdd99('0xed')]);}else{_0x4d80e3=util[_0xdd99('0xac')](_0xdd99('0xad'),_0x1d3d4d[_0xdd99('0x37')]);}socket['to'](util['format']('user:%s',_0x1d3d4d[_0xdd99('0x37')]))[_0xdd99('0x2c')](_0xdd99('0xee'),{'user':{'id':_0x1d3d4d['id'],'name':_0x1d3d4d['name']},'ip':_0x2f8ccd[_0xdd99('0xef')][_0xdd99('0xf0')]||_0x2f8ccd[_0xdd99('0xf1')][_0xdd99('0xf2')]||_0x2f8ccd[_0xdd99('0xf3')][_0xdd99('0xf2')]||_0x2f8ccd[_0xdd99('0xf1')][_0xdd99('0xf3')][_0xdd99('0xf2')]});return new Promise(function(_0x438ea8,_0x518942){db[_0xdd99('0x69')][_0xdd99('0xf4')]()[_0xdd99('0x20')](_0x4be7a1=>{db[_0xdd99('0xae')][_0xdd99('0x39')]({'where':{'membername':_0x1d3d4d[_0xdd99('0x37')]},'individualHooks':!![]},{'transaction':_0x4be7a1})[_0xdd99('0x20')](function(){return _0x4be7a1['commit']();})[_0xdd99('0x20')](_0x438ea8)['catch'](_0x518942);});});}}else{throw new db[(_0xdd99('0x8e'))][(_0xdd99('0x8f'))](_0xdd99('0xf5'));}})['then'](function(){if(_0x1d3d4d){return _0x1d3d4d[_0xdd99('0xf6')]({'raw':!![]});}})[_0xdd99('0x20')](function(_0x55c69d){if(_0x1d3d4d){if(_0x55c69d){_0x556885=_0x55c69d;if(_0x556885[_0xdd99('0x6d')]){var _0x5f0588=_0x556885[_0xdd99('0x34')](function(_0x33a394){return{'membername':_0x1d3d4d[_0xdd99('0x37')],'UserId':_0x1d3d4d['id'],'queue_name':_0x33a394[_0xdd99('0x37')],'VoiceQueueId':_0x33a394['id'],'interface':_0x4d80e3,'paused':_0x1d3d4d[_0xdd99('0x9d')]||![],'penalty':_0x33a394[_0xdd99('0xf7')]||0x0};});return db[_0xdd99('0xae')]['bulkCreate'](_0x5f0588);}}}})[_0xdd99('0x20')](function(){if(_0x1d3d4d){return db[_0xdd99('0xf8')][_0xdd99('0x4c')]({'where':{'membername':_0x1d3d4d['name'],'exitAt':null}});}})['then'](function(_0x44e611){if(_0x1d3d4d){var _0x1d3812=[];_0x44e611[_0xdd99('0xf9')](function(_0x572512){_0x1d3812[_0xdd99('0x4b')](_0x572512[_0xdd99('0x29')]({'exitAt':moment()[_0xdd99('0xac')](_0xdd99('0xfa'))}));});return Promise['all'](_0x1d3812);}})[_0xdd99('0x20')](function(){if(_0x1d3d4d){var _0x4101f6=[];var _0x3c59ac=[];var _0x4e4961=utils[_0xdd99('0xfb')]();var _0x45073a={'membername':_0x1d3d4d[_0xdd99('0x37')],'interface':_0x4d80e3,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1d3d4d[_0xdd99('0x2a')],'internal':_0x1d3d4d[_0xdd99('0x61')]};_0x4e4961['forEach'](function(_0x143ed5){_0x4101f6['push'](_[_0xdd99('0x55')]({'channel':_0x143ed5,'type':_0xdd99('0xfc'),'data1':_0x2f8ccd[_0xdd99('0x5c')]['device'],'data2':_0x4d80e3},_0x45073a));if(_0x1d3d4d['loginInPause']){_0x3c59ac[_0xdd99('0x4b')](_[_0xdd99('0x55')]({'channel':_0x143ed5,'type':_0xdd99('0xfd'),'data1':_0xdd99('0xfe')},_0x45073a));}});return db['MemberReport'][_0xdd99('0x89')](_0x4101f6[_0xdd99('0xff')](_0x3c59ac),{'individualHooks':!![]});}})[_0xdd99('0x20')](function(){if(_0x1d3d4d){return _0x1d3d4d['update']({'online':!![],'lastLoginAt':moment()[_0xdd99('0xac')](_0xdd99('0xfa')),'voicePause':_0x1d3d4d[_0xdd99('0x9d')]||![],'mailPause':_0x1d3d4d[_0xdd99('0x9d')]||![],'chatPause':_0x1d3d4d[_0xdd99('0x9d')]||![],'faxPause':_0x1d3d4d['loginInPause']||![],'smsPause':_0x1d3d4d['loginInPause']||![],'openchannelPause':_0x1d3d4d[_0xdd99('0x9d')]||![],'whatsappPause':_0x1d3d4d['loginInPause']||![],'pauseType':_0x1d3d4d[_0xdd99('0x9d')]?_0xdd99('0xfe'):null,'interface':_0x4d80e3,'lastPauseAt':moment()[_0xdd99('0xac')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x33f2bf){if(_0x2f8ccd[_0xdd99('0x100')]){return _0x42ed10();}else{return Promise['resolve'](_0x33f2bf)[_0xdd99('0x20')](respondWithResult(_0x100b2f,null));}})['catch'](handleError(_0x100b2f,null));};exports['logout']=function(_0x5ed27b,_0x135512){var _0x4435b5;return db[_0xdd99('0x3c')]['find']({'where':{'id':_0x5ed27b[_0xdd99('0x54')]['id'],'role':_0xdd99('0x2b')},'attributes':['id',_0xdd99('0x37'),_0xdd99('0x2a')]})[_0xdd99('0x20')](handleEntityNotFound(_0x135512,null))['then'](function(_0x4cbcc5){if(_0x4cbcc5){_0x4435b5=_0x4cbcc5;return db[_0xdd99('0xae')][_0xdd99('0x39')]({'where':{'membername':_0x4435b5[_0xdd99('0x37')]},'individualHooks':!![]});}})[_0xdd99('0x20')](function(){return db[_0xdd99('0xf8')]['findAll']({'where':{'membername':_0x4435b5['name'],'exitAt':null}});})[_0xdd99('0x20')](function(_0x53aa47){var _0x446a25=[];_0x53aa47['forEach'](function(_0x10a409){_0x446a25[_0xdd99('0x4b')](_0x10a409[_0xdd99('0x29')]({'exitAt':moment()['format'](_0xdd99('0xfa'))}));});return Promise[_0xdd99('0x5b')](_0x446a25);})[_0xdd99('0x20')](function(){return _0x4435b5[_0xdd99('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xdd99('0x20')](respondWithResult(_0x135512,null))['catch'](handleError(_0x135512,null));};exports[_0xdd99('0x101')]=function(_0x618da6,_0x472b94){var _0x246879;return db[_0xdd99('0xae')]['update']({'paused':0x1},{'where':{'UserId':_0x618da6[_0xdd99('0x54')]['id']},'individualHooks':!![]})[_0xdd99('0x20')](function(){return db[_0xdd99('0x3c')]['find']({'where':{'id':_0x618da6['params']['id'],'role':'agent'},'attributes':['id',_0xdd99('0x37'),_0xdd99('0x2a'),_0xdd99('0x61'),_0xdd99('0x9f'),_0xdd99('0x9c')]});})[_0xdd99('0x20')](handleEntityNotFound(_0x472b94,null))['then'](function(_0x250eff){if(_0x250eff){_0x246879=_0x250eff;return respondWithRpcPromise(_0xdd99('0x102'),'pause',{'id':_0x246879['id'],'name':_0x246879[_0xdd99('0x37')],'pause':!![]});}})['then'](function(){if(_0x246879){return db[_0xdd99('0xf8')][_0xdd99('0x4c')]({'where':{'membername':_0x246879[_0xdd99('0x37')],'type':'PAUSE','exitAt':null}});}})[_0xdd99('0x20')](function(_0xc200cd){if(_0xc200cd[_0xdd99('0x6d')]){var _0xc40720=moment()['format'](_0xdd99('0xfa'));for(var _0x4c09ce=0x0,_0x19eea0=_0xc200cd[_0xdd99('0x6d')];_0x4c09ce<_0x19eea0;_0x4c09ce++){_0xc200cd[_0x4c09ce][_0xdd99('0x103')]({'exitAt':_0xc40720});}}})[_0xdd99('0x20')](function(){var _0x3dc6a3=[];var _0x46220c=utils[_0xdd99('0xfb')]();_0x46220c['forEach'](function(_0xf6580e){_0x3dc6a3['push']({'channel':_0xf6580e,'membername':_0x246879[_0xdd99('0x37')],'interface':_[_0xdd99('0x67')](_0x246879[_0xdd99('0x9f')])?util['format']('SIP/%s',_0x246879[_0xdd99('0x37')]):_0x246879[_0xdd99('0x9f')],'type':_0xdd99('0xfd'),'enterAt':moment()['format'](_0xdd99('0xfa')),'data1':_0x618da6[_0xdd99('0x5c')][_0xdd99('0x104')]||'DEFAULT\x20PAUSE','role':_0x246879['role'],'internal':_0x246879[_0xdd99('0x61')]});});return db['MemberReport']['bulkCreate'](_0x3dc6a3,{'individualHooks':!![]});})[_0xdd99('0x20')](function(){return _0x246879[_0xdd99('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x618da6['body']['type']||_0xdd99('0x105'),'lastPauseAt':moment()[_0xdd99('0xac')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x472b94,null))['catch'](handleError(_0x472b94,null));};exports[_0xdd99('0x106')]=function(_0x4da794,_0x34e5fb){if(_0x4da794[_0xdd99('0x5c')][_0xdd99('0x9b')]&&!utils[_0xdd99('0xa0')](_0x4da794[_0xdd99('0x5c')][_0xdd99('0x9b')])){throw new APIBadRequestError(util[_0xdd99('0xac')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x4da794[_0xdd99('0x5c')]['channel']));}return db[_0xdd99('0x3c')][_0xdd99('0x58')]({'where':{'id':_0x4da794['params']['id']},'attributes':['id',_0xdd99('0x37'),_0xdd99('0x2a'),_0xdd99('0x61'),'interface',_0xdd99('0x9c'),_0xdd99('0x9e'),_0xdd99('0x107'),_0xdd99('0x108'),'faxPause',_0xdd99('0x109'),_0xdd99('0x10a'),_0xdd99('0x10b'),_0xdd99('0x10c'),_0xdd99('0x10d')]})['then'](function(_0x1aab34){if(!_0x1aab34){throw new APINotFoundError(util['format'](_0xdd99('0x10e'),_0x4da794[_0xdd99('0x54')]['id']));}return _0x1aab34[_0xdd99('0x106')](_0x4da794['body'][_0xdd99('0x9b')]);})[_0xdd99('0x20')](respondWithResult(_0x34e5fb,null))[_0xdd99('0x28')](APIHandleError(_0x34e5fb));};exports[_0xdd99('0x10f')]=function(_0x1bf0d6,_0x4e1cbe){var _0xa2648a={};var _0x3a14c8={};var _0x41edff;var _0x26f538;return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x1bf0d6[_0xdd99('0x54')]['id']}})['then'](handleEntityNotFound(_0x4e1cbe,null))[_0xdd99('0x20')](function(_0x1ee11f){if(_0x1ee11f){_0x41edff=_0x1ee11f;_0x3a14c8['model']=_['keys'](db[_0xdd99('0x110')][_0xdd99('0x3d')]);_0x3a14c8['query']=_['keys'](_0x1bf0d6[_0xdd99('0x45')]);_0x3a14c8[_0xdd99('0xd8')]=_[_0xdd99('0xd1')](_0x3a14c8[_0xdd99('0xce')],_0x3a14c8[_0xdd99('0x45')]);_0xa2648a[_0xdd99('0x57')]=_[_0xdd99('0xd1')](_0x3a14c8[_0xdd99('0xce')],qs['fields'](_0x1bf0d6[_0xdd99('0x45')]['fields']));_0xa2648a[_0xdd99('0x57')]=_0xa2648a[_0xdd99('0x57')][_0xdd99('0x6d')]?_0xa2648a[_0xdd99('0x57')]:_0x3a14c8[_0xdd99('0xce')];_0xa2648a[_0xdd99('0xd9')]=qs[_0xdd99('0xd3')](_0x1bf0d6[_0xdd99('0x45')]['sort']);_0xa2648a[_0xdd99('0x44')]=qs[_0xdd99('0xd8')](_['pick'](_0x1bf0d6[_0xdd99('0x45')],_0x3a14c8['filters']));if(_0x1bf0d6['query'][_0xdd99('0x33')]){_0xa2648a[_0xdd99('0x44')]=_['merge'](_0xa2648a[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0xa2648a['attributes'],function(_0x4d7a61){var _0x4c41e3={};_0x4c41e3[_0x4d7a61]={'$like':'%'+_0x1bf0d6[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x4c41e3;})});}_0xa2648a=_[_0xdd99('0x55')]({},_0xa2648a,_0x1bf0d6[_0xdd99('0x56')]);return _0x41edff[_0xdd99('0x10f')](_0xa2648a);}})[_0xdd99('0x20')](function(_0xce52bf){if(_0xce52bf){_0x26f538=_0xce52bf[_0xdd99('0x6d')];if(!_0x1bf0d6[_0xdd99('0x45')][_0xdd99('0xc6')](_0xdd99('0xd6'))){_0xa2648a[_0xdd99('0x1c')]=qs[_0xdd99('0x1c')](_0x1bf0d6[_0xdd99('0x45')][_0xdd99('0x1c')]);_0xa2648a[_0xdd99('0x1b')]=qs[_0xdd99('0x1b')](_0x1bf0d6[_0xdd99('0x45')]['offset']);}return _0x41edff[_0xdd99('0x10f')](_0xa2648a);}})['then'](function(_0x493cc2){if(_0x493cc2){return _0x493cc2?{'count':_0x26f538,'rows':_0x493cc2}:null;}})['then'](respondWithResult(_0x4e1cbe,null))[_0xdd99('0x28')](handleError(_0x4e1cbe,null));};exports[_0xdd99('0x111')]=function(_0x8a145f,_0x3b014f){var _0x2b1b20=_0x8a145f['params']['id'];var _0x28de4f=_0x8a145f[_0xdd99('0x5c')]?_0x8a145f['body'][_0xdd99('0x5f')]:null;var _0x2bbceb=[];return Promise[_0xdd99('0x112')]()[_0xdd99('0x20')](function(){if(!_0x28de4f)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xdd99('0x20')](function(){return db[_0xdd99('0x3c')][_0xdd99('0x95')]({'where':{'id':_0x2b1b20}});})[_0xdd99('0x20')](function(_0x13e1b0){if(!_0x13e1b0)throw new APINotFoundError(util[_0xdd99('0xac')]('User\x20with\x20id\x20%s\x20not\x20found',_0x8a145f[_0xdd99('0x54')]['id']));return db[_0xdd99('0x69')]['transaction'](function(_0x5cff04){return _0x13e1b0['addTeams'](_0x28de4f,{'transaction':_0x5cff04})[_0xdd99('0x20')](function(){return db[_0xdd99('0x110')]['findAll']({'where':{'id':{'$in':_0x28de4f}}});})[_0xdd99('0x20')](function(_0x569214){var _0x4220d2=_[_0xdd99('0x34')](_0x569214,function(_0x342686){return _0x342686['getAssociatedQueues']();});return Promise['all'](_0x4220d2);})['then'](function(_0x10b6c1){_0x2bbceb=_[_0xdd99('0x113')](_0x10b6c1);var _0x1c6ced=_[_0xdd99('0x34')](_0x2bbceb,function(_0x455df2){return _0x455df2[_0xdd99('0x114')](_0x13e1b0['id'],{'transaction':_0x5cff04});});return Promise[_0xdd99('0x5b')](_0x1c6ced);})[_0xdd99('0x20')](function(){if(!_0x13e1b0[_0xdd99('0x9c')])return;var _0xf7839a=_[_0xdd99('0x33')](_0x2bbceb,function(_0x3a8515){return _0x3a8515[_0xdd99('0x115')](_0xdd99('0x9b'))===_0xdd99('0x116');});var _0x24ef18=_[_0xdd99('0x34')](_0xf7839a,function(_0x4c2041){return db[_0xdd99('0xae')][_0xdd99('0x117')]({'membername':_0x13e1b0[_0xdd99('0x37')],'UserId':_0x13e1b0['id'],'queue_name':_0x4c2041[_0xdd99('0x37')],'VoiceQueueId':_0x4c2041['id'],'interface':_[_0xdd99('0x67')](_0x13e1b0[_0xdd99('0x9f')])?util[_0xdd99('0xac')](_0xdd99('0xad'),_0x13e1b0[_0xdd99('0x37')]):_0x13e1b0[_0xdd99('0x9f')],'paused':_0x13e1b0[_0xdd99('0x9e')]||![],'penalty':_0x13e1b0[_0xdd99('0xa5')]},{'transaction':_0x5cff04});});return Promise['all'](_0x24ef18);})['then'](function(){return db[_0xdd99('0x118')][_0xdd99('0x4c')]({'where':{'teamId':{'$in':_0x28de4f}}});})[_0xdd99('0x20')](function(_0x45ac39){var _0x6c2ac2=_[_0xdd99('0x34')](_0x45ac39,function(_0xbfb7fd){return db[_0xdd99('0x119')][_0xdd99('0x7f')]({'UserId':_0x13e1b0['id'],'VoicePrefixId':_0xbfb7fd[_0xdd99('0x11a')]},{'transaction':_0x5cff04});});return Promise[_0xdd99('0x5b')](_0x6c2ac2);});});})[_0xdd99('0x20')](function(){for(var _0x385782=0x0;_0x385782<_0x2bbceb[_0xdd99('0x6d')];_0x385782++){var _0x96a1f9=_0x2bbceb[_0x385782][_0xdd99('0x115')]('channel');var _0x4c2099=_0x96a1f9+'QueueId';socket[_0xdd99('0x2c')]('user'+_0x96a1f9+_0xdd99('0xa8'),{'UserId':_0x2b1b20,['queueField']:_0x2bbceb[_0x385782]['id']});}})['then'](respondWithStatusCode(_0x3b014f,null))[_0xdd99('0x28')](APIHandleError(_0x3b014f));};exports['removeTeams']=function(_0x5214c5,_0x12fcd0){var _0x46159a=_0x5214c5[_0xdd99('0x54')]['id'];var _0x54b859=null;if(_0x5214c5[_0xdd99('0x45')][_0xdd99('0x5f')]){_0x54b859=_[_0xdd99('0x11b')](_0x5214c5['query'][_0xdd99('0x5f')])?_0x5214c5[_0xdd99('0x45')][_0xdd99('0x5f')]:[_0x5214c5[_0xdd99('0x45')][_0xdd99('0x5f')]];}var _0x1d8688=[];return Promise[_0xdd99('0x112')]()['then'](function(){if(!_0x54b859)throw new APIBadRequestError(_0xdd99('0x11c'));})['then'](function(){return db['User'][_0xdd99('0x95')]({'where':{'id':_0x46159a}});})[_0xdd99('0x20')](function(_0x5cd373){if(!_0x5cd373)throw new APINotFoundError(util[_0xdd99('0xac')](_0xdd99('0x10e'),_0x5214c5[_0xdd99('0x54')]['id']));return db[_0xdd99('0x69')][_0xdd99('0xf4')](function(_0x1a2c95){return _0x5cd373['removeTeams'](_0x54b859,{'transaction':_0x1a2c95})['then'](function(){return db[_0xdd99('0x110')]['findAll']({'where':{'id':{'$in':_0x54b859}}});})[_0xdd99('0x20')](function(_0x394476){var _0x28ab06=_[_0xdd99('0x34')](_0x394476,function(_0x30f177){return _0x30f177[_0xdd99('0x11d')]();});return Promise[_0xdd99('0x5b')](_0x28ab06);})[_0xdd99('0x20')](function(_0x1368f7){_0x1d8688=_[_0xdd99('0x113')](_0x1368f7);var _0x39cfbd=_[_0xdd99('0x34')](_0x1d8688,function(_0x19ef93){return _0x19ef93[_0xdd99('0x11e')](_0x5cd373['id'],{'transaction':_0x1a2c95});});return Promise['all'](_0x39cfbd);})[_0xdd99('0x20')](function(){if(!_0x5cd373['online'])return;var _0x5f1c58=_[_0xdd99('0x33')](_0x1d8688,function(_0x40e1ad){return _0x40e1ad[_0xdd99('0x115')](_0xdd99('0x9b'))===_0xdd99('0x116');});var _0x235912=_['map'](_0x5f1c58,function(_0x32f804){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x32f804['id'],'UserId':_0x5cd373['id']},'transaction':_0x1a2c95});});return Promise[_0xdd99('0x5b')](_0x235912);})[_0xdd99('0x20')](function(){return db[_0xdd99('0x118')][_0xdd99('0x4c')]({'where':{'teamId':{'$in':_0x54b859}}});})[_0xdd99('0x20')](function(_0x5f0298){var _0x2a0a03=_[_0xdd99('0x34')](_0x5f0298,function(_0xa4fe68){return db[_0xdd99('0x119')][_0xdd99('0x39')]({'where':{'UserId':_0x5cd373['id'],'VoicePrefixId':_0xa4fe68['VoicePrefixId']}},{'transaction':_0x1a2c95});});return Promise[_0xdd99('0x5b')](_0x2a0a03);});});})[_0xdd99('0x20')](function(){for(var _0x438ab5=0x0;_0x438ab5<_0x1d8688['length'];_0x438ab5++){var _0x64f5a=_0x1d8688[_0x438ab5]['getDataValue'](_0xdd99('0x9b'));var _0x5224c3=_0x64f5a+'QueueId';socket['emit'](_0xdd99('0x2f')+_0x64f5a+_0xdd99('0xb1'),{'UserId':_0x46159a,['queueField']:_0x1d8688[_0x438ab5]['id']});}})[_0xdd99('0x20')](respondWithStatusCode(_0x12fcd0,null))['catch'](APIHandleError(_0x12fcd0));};exports[_0xdd99('0x11f')]=function(_0x47d6f2,_0x5388ca){var _0x2dbd6d={};var _0x566a01={};var _0xdb9b4e;var _0x28d447;return db[_0xdd99('0x3c')]['findOne']({'where':{'id':_0x47d6f2[_0xdd99('0x54')]['id']}})['then'](handleEntityNotFound(_0x5388ca,null))[_0xdd99('0x20')](function(_0x3679c1){if(_0x3679c1){_0xdb9b4e=_0x3679c1;_0x566a01[_0xdd99('0xce')]=_[_0xdd99('0xcf')](db[_0xdd99('0xc7')][_0xdd99('0x3d')]);_0x566a01[_0xdd99('0x45')]=_['keys'](_0x47d6f2[_0xdd99('0x45')]);_0x566a01[_0xdd99('0xd8')]=_[_0xdd99('0xd1')](_0x566a01['model'],_0x566a01[_0xdd99('0x45')]);_0x2dbd6d[_0xdd99('0x57')]=_[_0xdd99('0xd1')](_0x566a01[_0xdd99('0xce')],qs['fields'](_0x47d6f2[_0xdd99('0x45')][_0xdd99('0xd2')]));_0x2dbd6d[_0xdd99('0x57')]=_0x2dbd6d[_0xdd99('0x57')][_0xdd99('0x6d')]?_0x2dbd6d[_0xdd99('0x57')]:_0x566a01[_0xdd99('0xce')];_0x2dbd6d[_0xdd99('0xd9')]=qs['sort'](_0x47d6f2[_0xdd99('0x45')][_0xdd99('0xd3')]);_0x2dbd6d[_0xdd99('0x44')]=qs['filters'](_[_0xdd99('0xd4')](_0x47d6f2[_0xdd99('0x45')],_0x566a01[_0xdd99('0xd8')]));if(_0x47d6f2['query']['filter']){_0x2dbd6d[_0xdd99('0x44')]=_['merge'](_0x2dbd6d[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0x2dbd6d[_0xdd99('0x57')],function(_0x1edd02){var _0x75e94a={};_0x75e94a[_0x1edd02]={'$like':'%'+_0x47d6f2[_0xdd99('0x45')][_0xdd99('0x33')]+'%'};return _0x75e94a;})});}_0x2dbd6d=_[_0xdd99('0x55')]({},_0x2dbd6d,_0x47d6f2[_0xdd99('0x56')]);return _0xdb9b4e[_0xdd99('0x11f')](_0x2dbd6d);}})[_0xdd99('0x20')](function(_0x5664ce){if(_0x5664ce){_0x28d447=_0x5664ce[_0xdd99('0x6d')];if(!_0x47d6f2[_0xdd99('0x45')][_0xdd99('0xc6')](_0xdd99('0xd6'))){_0x2dbd6d[_0xdd99('0x1c')]=qs['limit'](_0x47d6f2[_0xdd99('0x45')][_0xdd99('0x1c')]);_0x2dbd6d[_0xdd99('0x1b')]=qs[_0xdd99('0x1b')](_0x47d6f2[_0xdd99('0x45')][_0xdd99('0x1b')]);}return _0xdb9b4e[_0xdd99('0x11f')](_0x2dbd6d);}})[_0xdd99('0x20')](function(_0x482240){if(_0x482240){return _0x482240?{'count':_0x28d447,'rows':_0x482240}:null;}})[_0xdd99('0x20')](respondWithResult(_0x5388ca,null))['catch'](handleError(_0x5388ca,null));};exports[_0xdd99('0x120')]=function(_0x16600a,_0x1b4d20){var _0x2331fc={};var _0x1b92c6={};var _0x5819d2;return db['User']['findOne']({'where':{'id':_0x16600a[_0xdd99('0x54')]['id']}})[_0xdd99('0x20')](handleEntityNotFound(_0x1b4d20,null))['then'](function(_0x13a69a){if(_0x13a69a){_0x5819d2=_0x13a69a;_0x1b92c6[_0xdd99('0xce')]=_['keys'](db[_0xdd99('0x3c')][_0xdd99('0x3d')]);_0x1b92c6[_0xdd99('0x45')]=_[_0xdd99('0xcf')](_0x16600a[_0xdd99('0x45')]);_0x1b92c6['filters']=_[_0xdd99('0xd1')](_0x1b92c6[_0xdd99('0xce')],_0x1b92c6[_0xdd99('0x45')]);_0x2331fc[_0xdd99('0x57')]=_['intersection'](_0x1b92c6[_0xdd99('0xce')],qs[_0xdd99('0xd2')](_0x16600a['query']['fields']));_0x2331fc[_0xdd99('0x57')]=_0x2331fc['attributes']['length']?_0x2331fc[_0xdd99('0x57')]:_0x1b92c6[_0xdd99('0xce')];_0x2331fc[_0xdd99('0xd9')]=qs['sort'](_0x16600a[_0xdd99('0x45')][_0xdd99('0xd3')]);_0x2331fc[_0xdd99('0x44')]=qs['filters'](_[_0xdd99('0xd4')](_0x16600a[_0xdd99('0x45')],_0x1b92c6['filters']));if(_0x16600a['query'][_0xdd99('0x33')]){_0x2331fc[_0xdd99('0x44')]=_['merge'](_0x2331fc[_0xdd99('0x44')],{'$or':_[_0xdd99('0x34')](_0x2331fc[_0xdd99('0x57')],function(_0x167d01){var _0x502e72={};_0x502e72[_0x167d01]={'$like':'%'+_0x16600a['query'][_0xdd99('0x33')]+'%'};return _0x502e72;})});}_0x2331fc[_0xdd99('0xce')]=db['User'];_0x2331fc['as']=_0xdd99('0x30');_0x2331fc=_[_0xdd99('0x55')]({},_0x2331fc,_0x16600a[_0xdd99('0x56')]);return _0x5819d2[_0xdd99('0xf6')]({'include':[_0x2331fc]});}})[_0xdd99('0x20')](function(_0x353a37){if(_0x353a37){var _0x5412e8={},_0x282f04=[];for(var _0x32d1f0=0x0;_0x32d1f0<_0x353a37[_0xdd99('0x6d')];_0x32d1f0+=0x1){for(var _0x3789cf=0x0,_0xd45e72;_0x3789cf<_0x353a37[_0x32d1f0][_0xdd99('0x30')][_0xdd99('0x6d')];_0x3789cf+=0x1){_0xd45e72=_0x353a37[_0x32d1f0][_0xdd99('0x30')][_0x3789cf][_0xdd99('0xab')]({'plain':!![]});_0x5412e8[_0xd45e72['id']]=_0xd45e72;}}_0x5412e8=_['values'](_0x5412e8);for(var _0x58574f=qs[_0xdd99('0x1b')](_0x16600a['query'][_0xdd99('0x1b')]);_0x58574f<_0x5412e8[_0xdd99('0x6d')]&&_0x282f04['length']=_0x332789[_0x44c2('0x4e')]){throw new Error(_0x44c2('0x4f'));}})[_0x44c2('0x23')](function(){if(_0x3c1f15){return db['UserVoiceQueueRt'][_0x44c2('0x49')]({'where':{'membername':_0x3c1f15[_0x44c2('0x29')]},'individualHooks':!![]});}})['then'](function(){if(_0x3c1f15){return _0x3c1f15['getVoiceQueues']({'raw':!![]});}})[_0x44c2('0x23')](function(_0x952836){if(_0x3c1f15){if(_0x952836){var _0x3d6489=[];_0x5477ae=_0x952836;if(_0x5477ae[_0x44c2('0x2a')]){for(var _0x4993db=0x0;_0x4993db<_0x5477ae[_0x44c2('0x2a')];_0x4993db++){_0x3d6489[_0x44c2('0x2f')](db[_0x44c2('0x27')][_0x44c2('0x50')]({'membername':_0x3c1f15[_0x44c2('0x29')],'UserId':_0x3c1f15['id'],'queue_name':_0x5477ae[_0x4993db]['name'],'VoiceQueueId':_0x5477ae[_0x4993db]['id'],'interface':_0x526ad8,'paused':_0x3c1f15[_0x44c2('0x51')]||![],'penalty':_0x5477ae[_0x4993db][_0x44c2('0x52')]||0x0}));}return BPromise['all'](_0x3d6489);}}}})['then'](function(){if(_0x3c1f15){return db[_0x44c2('0x37')][_0x44c2('0xf')]({'where':{'membername':_0x3c1f15[_0x44c2('0x29')],'exitAt':null}});}})[_0x44c2('0x23')](function(_0x3c4e44){if(_0x3c1f15){if(_0x3c4e44&&_0x3c4e44[_0x44c2('0x2a')]){var _0x2d9138=[];_0x3c4e44[_0x44c2('0x2e')](function(_0x13f842){_0x2d9138['push'](_0x13f842[_0x44c2('0x28')]({'exitAt':moment()[_0x44c2('0x24')](_0x44c2('0x2b'))}));});return BPromise[_0x44c2('0x53')](_0x2d9138);}}})[_0x44c2('0x23')](function(){if(_0x3c1f15){var _0x4abc97=[];var _0x1e7e6f=[];var _0x4d76b2=utils[_0x44c2('0x2d')]();var _0x12b722={'membername':_0x3c1f15[_0x44c2('0x29')],'interface':_0x526ad8,'enterAt':moment()[_0x44c2('0x24')](_0x44c2('0x2b')),'role':_0x3c1f15[_0x44c2('0x22')],'internal':_0x3c1f15[_0x44c2('0x3f')]};_0x4d76b2[_0x44c2('0x2e')](function(_0x148294){_0x4abc97[_0x44c2('0x2f')](_[_0x44c2('0x54')]({'channel':_0x148294,'type':_0x44c2('0x55'),'data1':_0x44c2('0x56'),'data2':_0x526ad8},_0x12b722));if(_0x3c1f15['loginInPause']){_0x1e7e6f[_0x44c2('0x2f')](_[_0x44c2('0x54')]({'channel':_0x148294,'type':_0x44c2('0x33'),'data1':_0x44c2('0x57')},_0x12b722));}});return db[_0x44c2('0x37')][_0x44c2('0x38')](_0x4abc97['concat'](_0x1e7e6f),{'individualHooks':!![]});}})[_0x44c2('0x23')](function(){if(_0x3c1f15){return _0x3c1f15[_0x44c2('0x28')]({'online':!![],'lastLoginAt':moment()[_0x44c2('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3c1f15[_0x44c2('0x51')]||![],'mailPause':_0x3c1f15['loginInPause']||![],'chatPause':_0x3c1f15['loginInPause']||![],'faxPause':_0x3c1f15[_0x44c2('0x51')]||![],'smsPause':_0x3c1f15[_0x44c2('0x51')]||![],'openchannelPause':_0x3c1f15[_0x44c2('0x51')]||![],'pauseType':_0x3c1f15[_0x44c2('0x51')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x44c2('0x24')](_0x44c2('0x2b')),'interface':_0x526ad8});}})[_0x44c2('0x23')](function(_0x58a3e2){_0x8e2222(_0x58a3e2);})[_0x44c2('0x1c')](function(_0x36280e){_0x4ef3d0(_0x23e4c8[_0x44c2('0x1d')](0x1f4,_0x36280e[_0x44c2('0x1e')]));});});}; \ No newline at end of file +var _0xdcd7=['error','message','find','ShowUser','PauseUser','name','role','internal','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','MemberReport','PAUSE','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','isNil','SIP/%s','interface','type','body','uniqueid','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','channel','findOne','voicePause','chatPause','faxPause','smsPause','whatsappPause','pauseType','lastPauseAt','LogoutUser','destroy','findAll','forEach','push','update','all','LoginUser','mobile','phone','loginInPause','count','getLicense','agents','getVoiceQueues','upsert','UserVoiceQueue.penalty','getChannels','merge','LOGIN','callysquare','concat','LOGININPAUSE','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./user.socket','register','GetUser','User','options','raw','where','attributes','limit','map','include','model','then','info','debug','catch'];(function(_0x1b820e,_0x56508c){var _0x4184b7=function(_0x451a5b){while(--_0x451a5b){_0x1b820e['push'](_0x1b820e['shift']());}};_0x4184b7(++_0x56508c);}(_0xdcd7,0xea));var _0x7dcd=function(_0x1b7097,_0x55bf9d){_0x1b7097=_0x1b7097-0x0;var _0x11c757=_0xdcd7[_0x1b7097];return _0x11c757;};'use strict';var _=require(_0x7dcd('0x0'));var util=require(_0x7dcd('0x1'));var moment=require(_0x7dcd('0x2'));var BPromise=require(_0x7dcd('0x3'));var Redis=require(_0x7dcd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7dcd('0x5'));var logger=require(_0x7dcd('0x6'))('rpc');var config=require(_0x7dcd('0x7'));config[_0x7dcd('0x8')]=_[_0x7dcd('0x9')](config[_0x7dcd('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x7dcd('0xa'))(new Redis(config[_0x7dcd('0x8')]));require(_0x7dcd('0xb'))[_0x7dcd('0xc')](socket);exports[_0x7dcd('0xd')]=function(_0x389563){var _0x480e0c=this;return new Promise(function(_0x38b479,_0x3f7b22){return db[_0x7dcd('0xe')]['findAll']({'raw':_0x389563[_0x7dcd('0xf')]?_0x389563[_0x7dcd('0xf')][_0x7dcd('0x10')]===undefined?!![]:![]:!![],'where':_0x389563['options']?_0x389563[_0x7dcd('0xf')][_0x7dcd('0x11')]||null:null,'attributes':_0x389563[_0x7dcd('0xf')]?_0x389563['options'][_0x7dcd('0x12')]||null:null,'limit':_0x389563[_0x7dcd('0xf')]?_0x389563[_0x7dcd('0xf')][_0x7dcd('0x13')]||null:null,'include':_0x389563['options']?_0x389563['options']['include']?_[_0x7dcd('0x14')](_0x389563[_0x7dcd('0xf')][_0x7dcd('0x15')],function(_0x2082af){return{'model':db[_0x2082af[_0x7dcd('0x16')]],'as':_0x2082af['as'],'attributes':_0x2082af['attributes'],'include':_0x2082af[_0x7dcd('0x15')]?_['map'](_0x2082af['include'],function(_0x5be0fd){return{'model':db[_0x5be0fd[_0x7dcd('0x16')]],'as':_0x5be0fd['as'],'attributes':_0x5be0fd[_0x7dcd('0x12')],'include':_0x5be0fd['include']?_[_0x7dcd('0x14')](_0x5be0fd[_0x7dcd('0x15')],function(_0x3cac35){return{'model':db[_0x3cac35[_0x7dcd('0x16')]],'as':_0x3cac35['as'],'attributes':_0x3cac35[_0x7dcd('0x12')]};}):[]};}):[]};}):[]:[]})[_0x7dcd('0x17')](function(_0x4fcd62){logger[_0x7dcd('0x18')](_0x7dcd('0xd'),_0x389563);logger[_0x7dcd('0x19')](_0x7dcd('0xd'),_0x389563,JSON['stringify'](_0x4fcd62));_0x38b479(_0x4fcd62);})[_0x7dcd('0x1a')](function(_0x5938b0){logger[_0x7dcd('0x1b')](_0x7dcd('0xd'),_0x5938b0[_0x7dcd('0x1c')],_0x389563);_0x3f7b22(_0x480e0c[_0x7dcd('0x1b')](0x1f4,_0x5938b0[_0x7dcd('0x1c')]));});});};exports['ShowUser']=function(_0x3f80fb){var _0x2a3a9b=this;return new Promise(function(_0x1700ac,_0x712b8b){return db['User'][_0x7dcd('0x1d')]({'raw':_0x3f80fb['options']?_0x3f80fb['options'][_0x7dcd('0x10')]===undefined?!![]:![]:!![],'where':_0x3f80fb[_0x7dcd('0xf')]?_0x3f80fb[_0x7dcd('0xf')]['where']||null:null,'attributes':_0x3f80fb[_0x7dcd('0xf')]?_0x3f80fb[_0x7dcd('0xf')][_0x7dcd('0x12')]||null:null,'include':_0x3f80fb[_0x7dcd('0xf')]?_0x3f80fb['options']['include']?_[_0x7dcd('0x14')](_0x3f80fb['options'][_0x7dcd('0x15')],function(_0x4884b3){return{'model':db[_0x4884b3[_0x7dcd('0x16')]],'as':_0x4884b3['as'],'attributes':_0x4884b3[_0x7dcd('0x12')],'include':_0x4884b3[_0x7dcd('0x15')]?_[_0x7dcd('0x14')](_0x4884b3[_0x7dcd('0x15')],function(_0x1d31cc){return{'model':db[_0x1d31cc[_0x7dcd('0x16')]],'as':_0x1d31cc['as'],'attributes':_0x1d31cc['attributes'],'include':_0x1d31cc['include']?_[_0x7dcd('0x14')](_0x1d31cc['include'],function(_0x14a3fd){return{'model':db[_0x14a3fd['model']],'as':_0x14a3fd['as'],'attributes':_0x14a3fd[_0x7dcd('0x12')]};}):[]};}):[]};}):[]:[]})[_0x7dcd('0x17')](function(_0x4facb3){logger[_0x7dcd('0x18')](_0x7dcd('0x1e'),_0x3f80fb);logger[_0x7dcd('0x19')]('ShowUser',_0x3f80fb,JSON['stringify'](_0x4facb3));_0x1700ac(_0x4facb3);})[_0x7dcd('0x1a')](function(_0x2c9639){logger[_0x7dcd('0x1b')](_0x7dcd('0x1e'),_0x2c9639['message'],_0x3f80fb);_0x712b8b(_0x2a3a9b[_0x7dcd('0x1b')](0x1f4,_0x2c9639['message']));});});};exports[_0x7dcd('0x1f')]=function(_0x454417){var _0x5dd31a;return db['User'][_0x7dcd('0x1d')]({'where':_0x454417[_0x7dcd('0xf')][_0x7dcd('0x11')]||{},'attributes':['id',_0x7dcd('0x20'),_0x7dcd('0x21'),_0x7dcd('0x22'),'interface']})['then'](function(_0x3531bb){if(!_0x3531bb){throw new Error(util[_0x7dcd('0x23')](_0x7dcd('0x24'),_0x454417[_0x7dcd('0x25')]['id']));}_0x5dd31a=_0x3531bb;return db[_0x7dcd('0x26')]['update']({'paused':0x1},{'where':{'UserId':_0x5dd31a['id']},'individualHooks':!![]});})[_0x7dcd('0x17')](function(){return db[_0x7dcd('0x27')]['findAll']({'where':{'membername':_0x5dd31a[_0x7dcd('0x20')],'type':_0x7dcd('0x28'),'exitAt':null}});})[_0x7dcd('0x17')](function(_0x431086){if(_0x431086&&_0x431086['length']){var _0x41604f=moment()[_0x7dcd('0x23')](_0x7dcd('0x29'));for(var _0x5ca629=0x0,_0x409480=_0x431086[_0x7dcd('0x2a')];_0x5ca629<_0x409480;_0x5ca629++){_0x431086[_0x5ca629][_0x7dcd('0x2b')]({'exitAt':_0x41604f});}}})[_0x7dcd('0x17')](function(){var _0x34e173=[];var _0x5f0074=utils['getChannels']();_0x5f0074['forEach'](function(_0x568c73){_0x34e173['push']({'channel':_0x568c73,'membername':_0x5dd31a['name'],'interface':_[_0x7dcd('0x2c')](_0x5dd31a['interface'])?util[_0x7dcd('0x23')](_0x7dcd('0x2d'),_0x5dd31a['name']):_0x5dd31a[_0x7dcd('0x2e')],'type':'PAUSE','enterAt':moment()[_0x7dcd('0x23')](_0x7dcd('0x29')),'data1':_0x454417['body'][_0x7dcd('0x2f')]||'DEFAULT\x20PAUSE','role':_0x5dd31a[_0x7dcd('0x21')],'internal':_0x5dd31a['internal'],'uniqueid':_0x454417[_0x7dcd('0x30')][_0x7dcd('0x31')]||null});});return db['MemberReport'][_0x7dcd('0x32')](_0x34e173,{'individualHooks':!![]});})[_0x7dcd('0x17')](function(){return _0x5dd31a['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x454417[_0x7dcd('0x30')]['type']||_0x7dcd('0x33'),'lastPauseAt':moment()[_0x7dcd('0x23')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x7dcd('0x1a')](function(_0x3b7de3){throw _0x3b7de3;});};exports[_0x7dcd('0x34')]=function(_0x5a904e){return Promise['resolve']()['then'](function(){if(_0x5a904e[_0x7dcd('0x30')]['channel']&&!utils[_0x7dcd('0x35')](_0x5a904e[_0x7dcd('0x30')]['channel'])){throw new Error(util[_0x7dcd('0x23')](_0x7dcd('0x36'),_0x5a904e[_0x7dcd('0x30')][_0x7dcd('0x37')]));}return db['User'][_0x7dcd('0x38')]({'where':_0x5a904e['options'][_0x7dcd('0x11')]||{},'attributes':['id','name','role','internal',_0x7dcd('0x2e'),'online',_0x7dcd('0x39'),'mailPause',_0x7dcd('0x3a'),_0x7dcd('0x3b'),'openchannelPause',_0x7dcd('0x3c'),_0x7dcd('0x3d'),_0x7dcd('0x3e'),_0x7dcd('0x3f')]});})['then'](function(_0x47b1b7){if(!_0x47b1b7){throw new Error(util['format'](_0x7dcd('0x24'),_0x5a904e[_0x7dcd('0x25')]['id']));}return _0x47b1b7['unpause'](_0x5a904e[_0x7dcd('0x30')]['channel'],'system');})[_0x7dcd('0x1a')](function(_0x29afb0){throw _0x29afb0;});};exports[_0x7dcd('0x40')]=function(_0x1b92bf){var _0x224cde=this;return new Promise(function(_0x3b9386,_0x566985){var _0x231835;return db[_0x7dcd('0xe')][_0x7dcd('0x38')]({'where':_0x1b92bf[_0x7dcd('0xf')][_0x7dcd('0x11')]||{},'attributes':['id',_0x7dcd('0x20')]})['then'](function(_0x5bbb9c){if(_0x5bbb9c){_0x231835=_0x5bbb9c;return db[_0x7dcd('0x26')][_0x7dcd('0x41')]({'where':{'membername':_0x231835['name']},'individualHooks':!![]});}})[_0x7dcd('0x17')](function(){if(_0x231835){return db['MemberReport'][_0x7dcd('0x42')]({'where':{'membername':_0x231835['name'],'exitAt':null}});}})[_0x7dcd('0x17')](function(_0x33525c){if(_0x231835){if(_0x33525c&&_0x33525c[_0x7dcd('0x2a')]){var _0x5d74a3=[];_0x33525c[_0x7dcd('0x43')](function(_0x3bd58b){_0x5d74a3[_0x7dcd('0x44')](_0x3bd58b[_0x7dcd('0x45')]({'exitAt':moment()[_0x7dcd('0x23')](_0x7dcd('0x29'))}));});return BPromise[_0x7dcd('0x46')](_0x5d74a3);}}})['then'](function(){if(_0x231835){return _0x231835[_0x7dcd('0x45')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x7dcd('0x17')](function(_0x398e73){_0x3b9386(_0x398e73);})[_0x7dcd('0x1a')](function(_0x50ac72){_0x566985(_0x224cde[_0x7dcd('0x1b')](0x1f4,_0x50ac72[_0x7dcd('0x1c')]));});});};exports[_0x7dcd('0x47')]=function(_0x16a78f){var _0x3fb02a=this;return new Promise(function(_0x2590b0,_0x591eaa){var _0x4b43fd;var _0x4abdc2;var _0x4cf2d5;var _0x1fd5d3;return db['User'][_0x7dcd('0x38')]({'where':_0x16a78f[_0x7dcd('0xf')]['where']||{},'attributes':['id',_0x7dcd('0x20'),_0x7dcd('0x21'),_0x7dcd('0x48'),_0x7dcd('0x49'),_0x7dcd('0x22'),_0x7dcd('0x4a'),_0x7dcd('0x2e')]})[_0x7dcd('0x17')](function(_0x503b84){if(_0x503b84){_0x4b43fd=_0x503b84;_0x1fd5d3=_0x16a78f['body'][_0x7dcd('0x2e')]?_0x16a78f[_0x7dcd('0x30')][_0x7dcd('0x2e')]:util['format'](_0x7dcd('0x2d'),_0x4b43fd[_0x7dcd('0x20')]);return db[_0x7dcd('0xe')][_0x7dcd('0x4b')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x4b43fd['id']}}});}})[_0x7dcd('0x17')](function(_0x4bf75f){if(_0x4bf75f){_0x4cf2d5=_0x4bf75f;return require('../../config/license/util')[_0x7dcd('0x4c')]();}})['then'](function(_0x674bd8){if(_0x674bd8&&_0x674bd8[_0x7dcd('0x4d')]&&_0x4cf2d5>=_0x674bd8[_0x7dcd('0x4d')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x4b43fd){return db[_0x7dcd('0x26')][_0x7dcd('0x41')]({'where':{'membername':_0x4b43fd[_0x7dcd('0x20')]},'individualHooks':!![]});}})['then'](function(){if(_0x4b43fd){return _0x4b43fd[_0x7dcd('0x4e')]({'raw':!![]});}})[_0x7dcd('0x17')](function(_0x298049){if(_0x4b43fd){if(_0x298049){var _0x4d039d=[];_0x4abdc2=_0x298049;if(_0x4abdc2[_0x7dcd('0x2a')]){for(var _0x4fc6a0=0x0;_0x4fc6a0<_0x4abdc2['length'];_0x4fc6a0++){_0x4d039d[_0x7dcd('0x44')](db[_0x7dcd('0x26')][_0x7dcd('0x4f')]({'membername':_0x4b43fd[_0x7dcd('0x20')],'UserId':_0x4b43fd['id'],'queue_name':_0x4abdc2[_0x4fc6a0]['name'],'VoiceQueueId':_0x4abdc2[_0x4fc6a0]['id'],'interface':_0x1fd5d3,'paused':_0x4b43fd[_0x7dcd('0x4a')]||![],'penalty':_0x4abdc2[_0x4fc6a0][_0x7dcd('0x50')]||0x0}));}return BPromise['all'](_0x4d039d);}}}})[_0x7dcd('0x17')](function(){if(_0x4b43fd){return db[_0x7dcd('0x27')][_0x7dcd('0x42')]({'where':{'membername':_0x4b43fd[_0x7dcd('0x20')],'exitAt':null}});}})['then'](function(_0x49aecb){if(_0x4b43fd){if(_0x49aecb&&_0x49aecb[_0x7dcd('0x2a')]){var _0x3c630d=[];_0x49aecb['forEach'](function(_0x2d6984){_0x3c630d[_0x7dcd('0x44')](_0x2d6984['update']({'exitAt':moment()[_0x7dcd('0x23')](_0x7dcd('0x29'))}));});return BPromise['all'](_0x3c630d);}}})['then'](function(){if(_0x4b43fd){var _0x4f3774=[];var _0xa8023a=[];var _0x367755=utils[_0x7dcd('0x51')]();var _0x376d2e={'membername':_0x4b43fd[_0x7dcd('0x20')],'interface':_0x1fd5d3,'enterAt':moment()[_0x7dcd('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4b43fd[_0x7dcd('0x21')],'internal':_0x4b43fd[_0x7dcd('0x22')]};_0x367755[_0x7dcd('0x43')](function(_0x54b536){_0x4f3774['push'](_[_0x7dcd('0x52')]({'channel':_0x54b536,'type':_0x7dcd('0x53'),'data1':_0x7dcd('0x54'),'data2':_0x1fd5d3},_0x376d2e));if(_0x4b43fd['loginInPause']){_0xa8023a[_0x7dcd('0x44')](_[_0x7dcd('0x52')]({'channel':_0x54b536,'type':_0x7dcd('0x28'),'data1':'LOGININPAUSE'},_0x376d2e));}});return db['MemberReport'][_0x7dcd('0x32')](_0x4f3774[_0x7dcd('0x55')](_0xa8023a),{'individualHooks':!![]});}})[_0x7dcd('0x17')](function(){if(_0x4b43fd){return _0x4b43fd[_0x7dcd('0x45')]({'online':!![],'lastLoginAt':moment()[_0x7dcd('0x23')](_0x7dcd('0x29')),'voicePause':_0x4b43fd[_0x7dcd('0x4a')]||![],'mailPause':_0x4b43fd[_0x7dcd('0x4a')]||![],'chatPause':_0x4b43fd[_0x7dcd('0x4a')]||![],'faxPause':_0x4b43fd[_0x7dcd('0x4a')]||![],'smsPause':_0x4b43fd[_0x7dcd('0x4a')]||![],'openchannelPause':_0x4b43fd[_0x7dcd('0x4a')]||![],'pauseType':_0x4b43fd[_0x7dcd('0x4a')]?_0x7dcd('0x56'):null,'lastPauseAt':moment()['format'](_0x7dcd('0x29')),'interface':_0x1fd5d3});}})['then'](function(_0x1a225c){_0x2590b0(_0x1a225c);})[_0x7dcd('0x1a')](function(_0x24c359){_0x591eaa(_0x3fb02a[_0x7dcd('0x1b')](0x1f4,_0x24c359[_0x7dcd('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 77f9ad6..6d73404 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 _0x4062=['update','emit','removeListener','length','user:','./user.events','save','remove'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4062,0x85));var _0x2406=function(_0x4b3ede,_0x215db5){_0x4b3ede=_0x4b3ede-0x0;var _0x228baa=_0x4062[_0x4b3ede];return _0x228baa;};'use strict';var UserEvents=require(_0x2406('0x0'));var events=[_0x2406('0x1'),_0x2406('0x2'),_0x2406('0x3')];function createListener(_0x2f8501,_0x448a20){return function(_0x3569c2){_0x448a20[_0x2406('0x4')](_0x2f8501,_0x3569c2);};}function removeListener(_0x489a18,_0x1c89ef){return function(){UserEvents[_0x2406('0x5')](_0x489a18,_0x1c89ef);};}exports['register']=function(_0x3cab2f){for(var _0xa276d1=0x0,_0x5d26e4=events[_0x2406('0x6')];_0xa276d1<_0x5d26e4;_0xa276d1++){var _0x1425f5=events[_0xa276d1];var _0x242cf9=createListener(_0x2406('0x7')+_0x1425f5,_0x3cab2f);UserEvents['on'](_0x1425f5,_0x242cf9);}}; \ No newline at end of file +var _0x3aea=['update','emit','removeListener','length','user:','./user.events','remove'];(function(_0x1f5020,_0x4f9a74){var _0x220169=function(_0x93e63e){while(--_0x93e63e){_0x1f5020['push'](_0x1f5020['shift']());}};_0x220169(++_0x4f9a74);}(_0x3aea,0x67));var _0xa3ae=function(_0x58e9ce,_0x3ca3da){_0x58e9ce=_0x58e9ce-0x0;var _0x1c6105=_0x3aea[_0x58e9ce];return _0x1c6105;};'use strict';var UserEvents=require(_0xa3ae('0x0'));var events=['save',_0xa3ae('0x1'),_0xa3ae('0x2')];function createListener(_0x219d4d,_0x4d3a50){return function(_0x3c6285){_0x4d3a50[_0xa3ae('0x3')](_0x219d4d,_0x3c6285);};}function removeListener(_0x258de0,_0x200841){return function(){UserEvents[_0xa3ae('0x4')](_0x258de0,_0x200841);};}exports['register']=function(_0x7bccce){for(var _0x4a818d=0x0,_0x2cbc55=events[_0xa3ae('0x5')];_0x4a818d<_0x2cbc55;_0x4a818d++){var _0x236716=events[_0x4a818d];var _0x375eab=createListener(_0xa3ae('0x6')+_0x236716,_0x7bccce);UserEvents['on'](_0x236716,_0x375eab);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 7572d60..4b1fbb7 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xfdaaf6,_0x3b105a){var _0x80aca8=function(_0x117436){while(--_0x117436){_0xfdaaf6['push'](_0xfdaaf6['shift']());}};_0x80aca8(++_0x3b105a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4f1da5,_0x4ced17){_0x4f1da5=_0x4f1da5-0x0;var _0xe972a8=_0xcb91[_0x4f1da5];return _0xe972a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x39c152,_0x11d9e7){var _0x333916=function(_0x3bb012){while(--_0x3bb012){_0x39c152['push'](_0x39c152['shift']());}};_0x333916(++_0x11d9e7);}(_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 d69e3b8..ce89e59 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 _0x2933=['INTEGER','sequelize','exports'];(function(_0x5e4b35,_0x4d0efd){var _0x220bde=function(_0xa4f167){while(--_0xa4f167){_0x5e4b35['push'](_0x5e4b35['shift']());}};_0x220bde(++_0x4d0efd);}(_0x2933,0x1b4));var _0x3293=function(_0x345080,_0x413948){_0x345080=_0x345080-0x0;var _0x4db6f0=_0x2933[_0x345080];return _0x4db6f0;};'use strict';var Sequelize=require(_0x3293('0x0'));module[_0x3293('0x1')]={'penalty':{'type':Sequelize[_0x3293('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1b6a=['exports','INTEGER','sequelize'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0x1b6a,0xe3));var _0xa1b6=function(_0x4bab52,_0x299f01){_0x4bab52=_0x4bab52-0x0;var _0x4b6fff=_0x1b6a[_0x4bab52];return _0x4b6fff;};'use strict';var Sequelize=require(_0xa1b6('0x0'));module[_0xa1b6('0x1')]={'penalty':{'type':Sequelize[_0xa1b6('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 578bb05..a948652 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 _0xc3bd=['bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xc3bd,0x1a0));var _0xdc3b=function(_0x3bc64e,_0xfafda8){_0x3bc64e=_0x3bc64e-0x0;var _0x42241c=_0xc3bd[_0x3bc64e];return _0x42241c;};'use strict';var _=require(_0xdc3b('0x0'));var util=require(_0xdc3b('0x1'));var logger=require(_0xdc3b('0x2'))(_0xdc3b('0x3'));var moment=require('moment');var BPromise=require(_0xdc3b('0x4'));var rp=require(_0xdc3b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdc3b('0x6'));var config=require(_0xdc3b('0x7'));var attributes=require(_0xdc3b('0x8'));module['exports']=function(_0x3e42c0,_0x41cbe4){return _0x3e42c0[_0xdc3b('0x9')](_0xdc3b('0xa'),attributes,{'tableName':_0xdc3b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf857=['moment','request-promise','path','rimraf','../../config/environment','exports','define','UserChatQueue','lodash','util'];(function(_0x59a240,_0x4680d3){var _0x4eaec6=function(_0x409784){while(--_0x409784){_0x59a240['push'](_0x59a240['shift']());}};_0x4eaec6(++_0x4680d3);}(_0xf857,0x13e));var _0x7f85=function(_0x57afc1,_0x5051e6){_0x57afc1=_0x57afc1-0x0;var _0x7f1f47=_0xf857[_0x57afc1];return _0x7f1f47;};'use strict';var _=require(_0x7f85('0x0'));var util=require(_0x7f85('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7f85('0x2'));var BPromise=require('bluebird');var rp=require(_0x7f85('0x3'));var fs=require('fs');var path=require(_0x7f85('0x4'));var rimraf=require(_0x7f85('0x5'));var config=require(_0x7f85('0x6'));var attributes=require('./userChatQueue.attributes');module[_0x7f85('0x7')]=function(_0x2bde0f,_0x13c9a7){return _0x2bde0f[_0x7f85('0x8')](_0x7f85('0x9'),attributes,{'tableName':'user_has_chat_queues','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 0d9eb6b..f57bacc 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 _0xd864=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x57f6cf,_0x3d1a57){var _0x4e33e8=function(_0x5b2193){while(--_0x5b2193){_0x57f6cf['push'](_0x57f6cf['shift']());}};_0x4e33e8(++_0x3d1a57);}(_0xd864,0x148));var _0x4d86=function(_0x1e3a39,_0x35b96d){_0x1e3a39=_0x1e3a39-0x0;var _0x98a509=_0xd864[_0x1e3a39];return _0x98a509;};'use strict';var _=require(_0x4d86('0x0'));var util=require(_0x4d86('0x1'));var moment=require(_0x4d86('0x2'));var BPromise=require(_0x4d86('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d86('0x4'));var db=require(_0x4d86('0x5'))['db'];var utils=require(_0x4d86('0x6'));var logger=require(_0x4d86('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d86('0x8')][_0x4d86('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x986f21,_0x3107e3,_0x3ae0c6){return new BPromise(function(_0x10039a,_0xe8c6ce){return client[_0x4d86('0xa')](_0x986f21,_0x3ae0c6)[_0x4d86('0xb')](function(_0x88f063){logger[_0x4d86('0xc')](_0x4d86('0xd'),_0x3107e3,_0x4d86('0xe'));logger[_0x4d86('0xf')](_0x4d86('0x10'),_0x3107e3,_0x4d86('0xe'),JSON[_0x4d86('0x11')](_0x88f063));if(_0x88f063[_0x4d86('0x12')]){if(_0x88f063['error'][_0x4d86('0x13')]===0x1f4){logger[_0x4d86('0x12')](_0x4d86('0xd'),_0x3107e3,_0x88f063[_0x4d86('0x12')][_0x4d86('0x14')]);return _0xe8c6ce(_0x88f063[_0x4d86('0x12')][_0x4d86('0x14')]);}logger[_0x4d86('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x3107e3,_0x88f063[_0x4d86('0x12')][_0x4d86('0x14')]);return _0x10039a(_0x88f063[_0x4d86('0x12')]['message']);}else{logger[_0x4d86('0xc')](_0x4d86('0xd'),_0x3107e3,_0x4d86('0xe'));_0x10039a(_0x88f063[_0x4d86('0x15')][_0x4d86('0x14')]);}})['catch'](function(_0x12d74f){logger[_0x4d86('0x12')](_0x4d86('0xd'),_0x3107e3,_0x12d74f);_0xe8c6ce(_0x12d74f);});});} \ No newline at end of file +var _0xad84=['http','request','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xad84,0xf3));var _0x4ad8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xad84[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x4ad8('0x0'));var moment=require('moment');var BPromise=require(_0x4ad8('0x1'));var rs=require(_0x4ad8('0x2'));var fs=require('fs');var Redis=require(_0x4ad8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ad8('0x4'))(_0x4ad8('0x5'));var config=require(_0x4ad8('0x6'));var jayson=require(_0x4ad8('0x7'));var client=jayson[_0x4ad8('0x8')][_0x4ad8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11f817,_0x26a978,_0x5bb591){return new BPromise(function(_0x2e8abc,_0x2898e){return client[_0x4ad8('0xa')](_0x11f817,_0x5bb591)['then'](function(_0x42a1e1){logger[_0x4ad8('0xb')](_0x4ad8('0xc'),_0x26a978,'request\x20sent');logger[_0x4ad8('0xd')](_0x4ad8('0xe'),_0x26a978,_0x4ad8('0xf'),JSON['stringify'](_0x42a1e1));if(_0x42a1e1['error']){if(_0x42a1e1[_0x4ad8('0x10')][_0x4ad8('0x11')]===0x1f4){logger['error'](_0x4ad8('0xc'),_0x26a978,_0x42a1e1[_0x4ad8('0x10')][_0x4ad8('0x12')]);return _0x2898e(_0x42a1e1[_0x4ad8('0x10')][_0x4ad8('0x12')]);}logger['error'](_0x4ad8('0xc'),_0x26a978,_0x42a1e1[_0x4ad8('0x10')][_0x4ad8('0x12')]);return _0x2e8abc(_0x42a1e1[_0x4ad8('0x10')][_0x4ad8('0x12')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x26a978,_0x4ad8('0xf'));_0x2e8abc(_0x42a1e1[_0x4ad8('0x13')][_0x4ad8('0x12')]);}})[_0x4ad8('0x14')](function(_0x4fc99c){logger[_0x4ad8('0x10')](_0x4ad8('0xc'),_0x26a978,_0x4fc99c);_0x2898e(_0x4fc99c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index ee31e1f..2229cc0 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1e06f1,_0x59d7e1){var _0x34f77e=function(_0x4f9f26){while(--_0x4f9f26){_0x1e06f1['push'](_0x1e06f1['shift']());}};_0x34f77e(++_0x59d7e1);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3cb4c7,_0x515bc8){var _0x268a4d=function(_0x25d06d){while(--_0x25d06d){_0x3cb4c7['push'](_0x3cb4c7['shift']());}};_0x268a4d(++_0x515bc8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index a356d25..0095ab0 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 _0x95dd=['exports','INTEGER','STRING'];(function(_0x199260,_0x310b85){var _0x48323a=function(_0x3f4d7c){while(--_0x3f4d7c){_0x199260['push'](_0x199260['shift']());}};_0x48323a(++_0x310b85);}(_0x95dd,0x114));var _0xd95d=function(_0x3a66fd,_0x1935bd){_0x3a66fd=_0x3a66fd-0x0;var _0x11a62d=_0x95dd[_0x3a66fd];return _0x11a62d;};'use strict';var Sequelize=require('sequelize');module[_0xd95d('0x0')]={'penalty':{'type':Sequelize[_0xd95d('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd95d('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xd95d('0x2')]}}; \ No newline at end of file +var _0x6bac=['sequelize','exports','INTEGER','STRING'];(function(_0x2c3c79,_0x3f6a21){var _0xfdf9d=function(_0x5aa731){while(--_0x5aa731){_0x2c3c79['push'](_0x2c3c79['shift']());}};_0xfdf9d(++_0x3f6a21);}(_0x6bac,0xf4));var _0xc6ba=function(_0x4e787c,_0x1dd27f){_0x4e787c=_0x4e787c-0x0;var _0x5b864b=_0x6bac[_0x4e787c];return _0x5b864b;};'use strict';var Sequelize=require(_0xc6ba('0x0'));module[_0xc6ba('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc6ba('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc6ba('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index f5b6032..aff37ea 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 _0x53b2=['define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports'];(function(_0x764847,_0x366a5f){var _0x3a9ac2=function(_0x58c456){while(--_0x58c456){_0x764847['push'](_0x764847['shift']());}};_0x3a9ac2(++_0x366a5f);}(_0x53b2,0x1d7));var _0x253b=function(_0x37728e,_0x4cb4eb){_0x37728e=_0x37728e-0x0;var _0x73dcca=_0x53b2[_0x37728e];return _0x73dcca;};'use strict';var _=require(_0x253b('0x0'));var util=require(_0x253b('0x1'));var logger=require(_0x253b('0x2'))(_0x253b('0x3'));var moment=require('moment');var BPromise=require(_0x253b('0x4'));var rp=require(_0x253b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x253b('0x6'));var config=require(_0x253b('0x7'));var attributes=require(_0x253b('0x8'));module[_0x253b('0x9')]=function(_0x5e8924,_0x41deed){return _0x5e8924[_0x253b('0xa')](_0x253b('0xb'),attributes,{'tableName':_0x253b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29c0=['./userFaxQueue.attributes','exports','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x139816,_0x19878e){var _0x5868ab=function(_0x2265b1){while(--_0x2265b1){_0x139816['push'](_0x139816['shift']());}};_0x5868ab(++_0x19878e);}(_0x29c0,0x1f1));var _0x029c=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x29c0[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require(_0x029c('0x0'));var logger=require(_0x029c('0x1'))(_0x029c('0x2'));var moment=require(_0x029c('0x3'));var BPromise=require(_0x029c('0x4'));var rp=require(_0x029c('0x5'));var fs=require('fs');var path=require(_0x029c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x029c('0x7'));module[_0x029c('0x8')]=function(_0x37d707,_0x2bc4fa){return _0x37d707['define']('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 3e2ce32..fec9053 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 _0xa50e=['error','code','message','UserFaxQueue,\x20%s,\x20%s','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2fa834,_0x40ee78){var _0x32f69a=function(_0x56591e){while(--_0x56591e){_0x2fa834['push'](_0x2fa834['shift']());}};_0x32f69a(++_0x40ee78);}(_0xa50e,0x98));var _0xea50=function(_0x30fdfd,_0x559d8d){_0x30fdfd=_0x30fdfd-0x0;var _0x1ed820=_0xa50e[_0x30fdfd];return _0x1ed820;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xea50('0x0'));var BPromise=require(_0xea50('0x1'));var rs=require(_0xea50('0x2'));var fs=require('fs');var Redis=require(_0xea50('0x3'));var db=require(_0xea50('0x4'))['db'];var utils=require(_0xea50('0x5'));var logger=require(_0xea50('0x6'))(_0xea50('0x7'));var config=require(_0xea50('0x8'));var jayson=require(_0xea50('0x9'));var client=jayson[_0xea50('0xa')][_0xea50('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23b395,_0x3bbb66,_0x365917){return new BPromise(function(_0x42b3ba,_0x38f209){return client['request'](_0x23b395,_0x365917)['then'](function(_0x49478c){logger[_0xea50('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x3bbb66,_0xea50('0xd'));logger['debug'](_0xea50('0xe'),_0x3bbb66,_0xea50('0xd'),JSON[_0xea50('0xf')](_0x49478c));if(_0x49478c[_0xea50('0x10')]){if(_0x49478c[_0xea50('0x10')][_0xea50('0x11')]===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x3bbb66,_0x49478c[_0xea50('0x10')][_0xea50('0x12')]);return _0x38f209(_0x49478c[_0xea50('0x10')]['message']);}logger[_0xea50('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x3bbb66,_0x49478c['error']['message']);return _0x42b3ba(_0x49478c[_0xea50('0x10')][_0xea50('0x12')]);}else{logger[_0xea50('0xc')](_0xea50('0x13'),_0x3bbb66,_0xea50('0xd'));_0x42b3ba(_0x49478c['result'][_0xea50('0x12')]);}})[_0xea50('0x14')](function(_0x29ce34){logger[_0xea50('0x10')](_0xea50('0x13'),_0x3bbb66,_0x29ce34);_0x38f209(_0x29ce34);});});} \ No newline at end of file +var _0x81c7=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x4ff3a1,_0x56b335){var _0x455216=function(_0x16ac05){while(--_0x16ac05){_0x4ff3a1['push'](_0x4ff3a1['shift']());}};_0x455216(++_0x56b335);}(_0x81c7,0x145));var _0x781c=function(_0x10a6ab,_0x4a1b22){_0x10a6ab=_0x10a6ab-0x0;var _0x2cf1c2=_0x81c7[_0x10a6ab];return _0x2cf1c2;};'use strict';var _=require('lodash');var util=require(_0x781c('0x0'));var moment=require(_0x781c('0x1'));var BPromise=require(_0x781c('0x2'));var rs=require(_0x781c('0x3'));var fs=require('fs');var Redis=require(_0x781c('0x4'));var db=require(_0x781c('0x5'))['db'];var utils=require(_0x781c('0x6'));var logger=require('../../config/logger')(_0x781c('0x7'));var config=require(_0x781c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x781c('0x9')][_0x781c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4553f1,_0x28d723,_0x2afbab){return new BPromise(function(_0x5e10ee,_0x2ec9f5){return client[_0x781c('0xb')](_0x4553f1,_0x2afbab)[_0x781c('0xc')](function(_0x5ce746){logger[_0x781c('0xd')](_0x781c('0xe'),_0x28d723,_0x781c('0xf'));logger[_0x781c('0x10')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x28d723,_0x781c('0xf'),JSON[_0x781c('0x11')](_0x5ce746));if(_0x5ce746[_0x781c('0x12')]){if(_0x5ce746[_0x781c('0x12')]['code']===0x1f4){logger[_0x781c('0x12')](_0x781c('0xe'),_0x28d723,_0x5ce746['error'][_0x781c('0x13')]);return _0x2ec9f5(_0x5ce746[_0x781c('0x12')][_0x781c('0x13')]);}logger[_0x781c('0x12')](_0x781c('0xe'),_0x28d723,_0x5ce746['error'][_0x781c('0x13')]);return _0x5e10ee(_0x5ce746[_0x781c('0x12')][_0x781c('0x13')]);}else{logger[_0x781c('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x28d723,_0x781c('0xf'));_0x5e10ee(_0x5ce746[_0x781c('0x14')][_0x781c('0x13')]);}})[_0x781c('0x15')](function(_0x319dc3){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x28d723,_0x319dc3);_0x2ec9f5(_0x319dc3);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 233fbf1..368d4ea 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3d40bc,_0x396824){var _0x47b5c2=function(_0x128af8){while(--_0x128af8){_0x3d40bc['push'](_0x3d40bc['shift']());}};_0x47b5c2(++_0x396824);}(_0xe706,0xa3));var _0x6e70=function(_0x56989c,_0x6781f0){_0x56989c=_0x56989c-0x0;var _0x22ab27=_0xe706[_0x56989c];return _0x22ab27;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x470dad,_0x29f79d){var _0x1f9978=function(_0x2d8448){while(--_0x2d8448){_0x470dad['push'](_0x470dad['shift']());}};_0x1f9978(++_0x29f79d);}(_0xe706,0xa3));var _0x6e70=function(_0x2f8bc5,_0x12e3d1){_0x2f8bc5=_0x2f8bc5-0x0;var _0x2e4207=_0xe706[_0x2f8bc5];return _0x2e4207;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 9a6b504..ce4dd3c 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 _0x4645=['INTEGER','sequelize','exports'];(function(_0x481536,_0x5f3462){var _0x291481=function(_0x27f74c){while(--_0x27f74c){_0x481536['push'](_0x481536['shift']());}};_0x291481(++_0x5f3462);}(_0x4645,0x184));var _0x5464=function(_0x3f1974,_0x247f31){_0x3f1974=_0x3f1974-0x0;var _0x2bab01=_0x4645[_0x3f1974];return _0x2bab01;};'use strict';var Sequelize=require(_0x5464('0x0'));module[_0x5464('0x1')]={'penalty':{'type':Sequelize[_0x5464('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa6a9=['exports','INTEGER','sequelize'];(function(_0x49372d,_0x21e0bf){var _0x4cccf9=function(_0x2084c0){while(--_0x2084c0){_0x49372d['push'](_0x49372d['shift']());}};_0x4cccf9(++_0x21e0bf);}(_0xa6a9,0x6e));var _0x9a6a=function(_0x1f4b18,_0x4e777c){_0x1f4b18=_0x1f4b18-0x0;var _0xde3957=_0xa6a9[_0x1f4b18];return _0xde3957;};'use strict';var Sequelize=require(_0x9a6a('0x0'));module[_0x9a6a('0x1')]={'penalty':{'type':Sequelize[_0x9a6a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 4f37529..fd6926c 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 _0x47b6=['path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x4bc8e8,_0x4958fa){var _0x1f8200=function(_0x258f95){while(--_0x258f95){_0x4bc8e8['push'](_0x4bc8e8['shift']());}};_0x1f8200(++_0x4958fa);}(_0x47b6,0x133));var _0x647b=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x47b6[_0x511bd1];return _0x4c48ec;};'use strict';var _=require(_0x647b('0x0'));var util=require('util');var logger=require(_0x647b('0x1'))('api');var moment=require(_0x647b('0x2'));var BPromise=require(_0x647b('0x3'));var rp=require(_0x647b('0x4'));var fs=require('fs');var path=require(_0x647b('0x5'));var rimraf=require(_0x647b('0x6'));var config=require(_0x647b('0x7'));var attributes=require(_0x647b('0x8'));module[_0x647b('0x9')]=function(_0x4147c8,_0x5cef33){return _0x4147c8[_0x647b('0xa')](_0x647b('0xb'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cc6=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','lodash'];(function(_0x171a8a,_0x2c6407){var _0x178cbc=function(_0x17cec0){while(--_0x17cec0){_0x171a8a['push'](_0x171a8a['shift']());}};_0x178cbc(++_0x2c6407);}(_0x1cc6,0x16a));var _0x61cc=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0x1cc6[_0x26fc81];return _0x9feece;};'use strict';var _=require(_0x61cc('0x0'));var util=require(_0x61cc('0x1'));var logger=require(_0x61cc('0x2'))('api');var moment=require(_0x61cc('0x3'));var BPromise=require('bluebird');var rp=require(_0x61cc('0x4'));var fs=require('fs');var path=require(_0x61cc('0x5'));var rimraf=require(_0x61cc('0x6'));var config=require(_0x61cc('0x7'));var attributes=require(_0x61cc('0x8'));module[_0x61cc('0x9')]=function(_0x3263eb,_0x4d0009){return _0x3263eb[_0x61cc('0xa')]('UserMailQueue',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 442d599..ab757c4 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 _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2e12f3,_0x3cda78){var _0x47cfc6=function(_0x1fea15){while(--_0x1fea15){_0x2e12f3['push'](_0x2e12f3['shift']());}};_0x47cfc6(++_0x3cda78);}(_0x00bb,0x1d8));var _0xb00b=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x00bb[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x7217,0x19e));var _0x7721=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x7217[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 9f04339..ea2b282 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 _0x02c6=['../../config/environment','./userNotification.controller','post','util','path','express','Router','fs-extra'];(function(_0x10f0a7,_0x1b6225){var _0x36bfb8=function(_0x29e8c0){while(--_0x29e8c0){_0x10f0a7['push'](_0x10f0a7['shift']());}};_0x36bfb8(++_0x1b6225);}(_0x02c6,0x1ab));var _0x602c=function(_0x115edd,_0x505f03){_0x115edd=_0x115edd-0x0;var _0x255f84=_0x02c6[_0x115edd];return _0x255f84;};'use strict';var multer=require('multer');var util=require(_0x602c('0x0'));var path=require(_0x602c('0x1'));var timeout=require('connect-timeout');var express=require(_0x602c('0x2'));var router=express[_0x602c('0x3')]();var fs_extra=require(_0x602c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x602c('0x5'));var controller=require(_0x602c('0x6'));router[_0x602c('0x7')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file +var _0xeb68=['sendUserNotification','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userNotification.controller','isAuthenticated'];(function(_0x13480a,_0x223f00){var _0x547cc1=function(_0x304881){while(--_0x304881){_0x13480a['push'](_0x13480a['shift']());}};_0x547cc1(++_0x223f00);}(_0xeb68,0x12e));var _0x8eb6=function(_0x81f000,_0x15df85){_0x81f000=_0x81f000-0x0;var _0x337aa2=_0xeb68[_0x81f000];return _0x337aa2;};'use strict';var multer=require('multer');var util=require(_0x8eb6('0x0'));var path=require('path');var timeout=require(_0x8eb6('0x1'));var express=require(_0x8eb6('0x2'));var router=express[_0x8eb6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8eb6('0x4'));var interaction=require(_0x8eb6('0x5'));var config=require('../../config/environment');var controller=require(_0x8eb6('0x6'));router['post']('/',auth[_0x8eb6('0x7')](),controller[_0x8eb6('0x8')]);module[_0x8eb6('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index d4f1c7c..98f85b5 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 _0x8b1d=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x1f8fe3,_0x3ecd11){var _0x4d7e3a=function(_0x4e90c0){while(--_0x4e90c0){_0x1f8fe3['push'](_0x1f8fe3['shift']());}};_0x4d7e3a(++_0x3ecd11);}(_0x8b1d,0x1e4));var _0xd8b1=function(_0x3087cb,_0x62e979){_0x3087cb=_0x3087cb-0x0;var _0x30b9ba=_0x8b1d[_0x3087cb];return _0x30b9ba;};'use strict';var Sequelize=require(_0xd8b1('0x0'));module[_0xd8b1('0x1')]={'body':{'type':Sequelize[_0xd8b1('0x2')]},'senderName':{'type':Sequelize[_0xd8b1('0x3')]},'recipientsId':{'type':Sequelize[_0xd8b1('0x2')]},'recipientsDescription':{'type':Sequelize[_0xd8b1('0x3')]},'beep':{'type':Sequelize[_0xd8b1('0x4')]}}; \ No newline at end of file +var _0x8c4b=['sequelize','exports','STRING','TEXT','BOOLEAN'];(function(_0x428567,_0x4bb243){var _0x3841a2=function(_0x4e86d5){while(--_0x4e86d5){_0x428567['push'](_0x428567['shift']());}};_0x3841a2(++_0x4bb243);}(_0x8c4b,0xc8));var _0xb8c4=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0x8c4b[_0x305486];return _0xa04940;};'use strict';var Sequelize=require(_0xb8c4('0x0'));module[_0xb8c4('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xb8c4('0x2')]},'recipientsId':{'type':Sequelize[_0xb8c4('0x3')]},'recipientsDescription':{'type':Sequelize[_0xb8c4('0x2')]},'beep':{'type':Sequelize[_0xb8c4('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index da0684b..da41872 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 _0x94e7=['redis','defaults','socket.io-emitter','./userNotification.socket','register','end','json','offset','undefined','limit','count','Content-Range','reject','update','destroy','then','status','sendStatus','error','stack','send','sendUserNotification','body','text','hasOwnProperty','Sequelize','ValidationError','TemplateId','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','userNotification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','User','union','replace','queue','Queue','ids','push','all','flatten','findOne','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x94e7,0x1e1));var _0x794e=function(_0x28c83c,_0x5ce91a){_0x28c83c=_0x28c83c-0x0;var _0x551dda=_0x94e7[_0x28c83c];return _0x551dda;};'use strict';var emlformat=require(_0x794e('0x0'));var rimraf=require(_0x794e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x794e('0x2'));var moment=require(_0x794e('0x3'));var BPromise=require(_0x794e('0x4'));var Mustache=require(_0x794e('0x5'));var util=require('util');var path=require(_0x794e('0x6'));var sox=require('sox');var csv=require(_0x794e('0x7'));var ejs=require(_0x794e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x794e('0x9'));var squel=require(_0x794e('0xa'));var crypto=require(_0x794e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x794e('0xc'));var toCsv=require(_0x794e('0x7'));var querystring=require('querystring');var Papa=require(_0x794e('0xd'));var Redis=require(_0x794e('0xe'));var authService=require(_0x794e('0xf'));var qs=require(_0x794e('0x10'));var as=require(_0x794e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x794e('0x12'))(_0x794e('0x13'));var utils=require(_0x794e('0x14'));var config=require(_0x794e('0x15'));var licenseUtil=require(_0x794e('0x16'));var db=require(_0x794e('0x17'))['db'];config[_0x794e('0x18')]=_[_0x794e('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x794e('0x1a'))(new Redis(config[_0x794e('0x18')]));require(_0x794e('0x1b'))[_0x794e('0x1c')](socket);function respondWithStatusCode(_0x5847c7,_0x4aeca8){_0x4aeca8=_0x4aeca8||0xcc;return function(_0x459d5e){if(_0x459d5e){return _0x5847c7['sendStatus'](_0x4aeca8);}return _0x5847c7['status'](_0x4aeca8)[_0x794e('0x1d')]();};}function respondWithResult(_0x2b6502,_0x1ff382){_0x1ff382=_0x1ff382||0xc8;return function(_0xcd7788){if(_0xcd7788){return _0x2b6502['status'](_0x1ff382)[_0x794e('0x1e')](_0xcd7788);}};}function respondWithFilteredResult(_0x4aed12,_0x334d55){return function(_0xeafb04){if(_0xeafb04){var _0x3ca064=typeof _0x334d55[_0x794e('0x1f')]===_0x794e('0x20')&&typeof _0x334d55[_0x794e('0x21')]===_0x794e('0x20');var _0x596f22=_0xeafb04[_0x794e('0x22')];var _0x3e8890=_0x3ca064?0x0:_0x334d55[_0x794e('0x1f')];var _0x21c793=_0x3ca064?_0xeafb04[_0x794e('0x22')]:_0x334d55[_0x794e('0x1f')]+_0x334d55['limit'];var _0x5720b9;if(_0x21c793>=_0x596f22){_0x21c793=_0x596f22;_0x5720b9=0xc8;}else{_0x5720b9=0xce;}_0x4aed12['status'](_0x5720b9);return _0x4aed12['set'](_0x794e('0x23'),_0x3e8890+'-'+_0x21c793+'/'+_0x596f22)[_0x794e('0x1e')](_0xeafb04);}return null;};}function patchUpdates(_0x59b916){return function(_0x3e0685){try{jsonpatch['apply'](_0x3e0685,_0x59b916,!![]);}catch(_0x50ad03){return BPromise[_0x794e('0x24')](_0x50ad03);}return _0x3e0685['save']();};}function saveUpdates(_0x4043e3,_0x50da7b){return function(_0x26f755){if(_0x26f755){return _0x26f755[_0x794e('0x25')](_0x4043e3)['then'](function(_0x24e548){return _0x24e548;});}return null;};}function removeEntity(_0x9c6d52,_0x6d829b){return function(_0xe6838b){if(_0xe6838b){return _0xe6838b[_0x794e('0x26')]()[_0x794e('0x27')](function(){_0x9c6d52[_0x794e('0x28')](0xcc)[_0x794e('0x1d')]();});}};}function handleEntityNotFound(_0x1dc2e8,_0x45320f){return function(_0x589a24){if(!_0x589a24){_0x1dc2e8[_0x794e('0x29')](0x194);}return _0x589a24;};}function handleError(_0x283341,_0x1c14b9){_0x1c14b9=_0x1c14b9||0x1f4;return function(_0x264510){logger[_0x794e('0x2a')](_0x264510[_0x794e('0x2b')]);if(_0x264510['name']){delete _0x264510['name'];}_0x283341['status'](_0x1c14b9)[_0x794e('0x2c')](_0x264510);};}exports[_0x794e('0x2d')]=function(_0x4dcfb9,_0x7fd7d1,_0x1c9838){if(!_0x4dcfb9[_0x794e('0x2e')]['hasOwnProperty'](_0x794e('0x2f'))&&!_0x4dcfb9[_0x794e('0x2e')][_0x794e('0x30')]('TemplateId')){throw new db[(_0x794e('0x31'))][(_0x794e('0x32'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x4dcfb9[_0x794e('0x2e')][_0x794e('0x30')](_0x794e('0x33'))&&!_0x4dcfb9[_0x794e('0x2e')][_0x794e('0x30')]('view')){throw new db[(_0x794e('0x31'))][(_0x794e('0x32'))](_0x794e('0x34'));}if(!_0x4dcfb9[_0x794e('0x2e')][_0x794e('0x30')](_0x794e('0x35'))){throw new db[(_0x794e('0x31'))][(_0x794e('0x32'))](_0x794e('0x36'));}else{try{var _0x3801ca=JSON[_0x794e('0x37')](_0x4dcfb9[_0x794e('0x2e')][_0x794e('0x35')]);}catch(_0xf44c94){logger[_0x794e('0x2a')](_0xf44c94);throw new db[(_0x794e('0x31'))][(_0x794e('0x32'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x57185c=[_0x794e('0x38'),_0x794e('0x39'),_0x794e('0x3a'),_0x794e('0x3b'),_0x794e('0x3c'),_0x794e('0x3d'),'whatsappqueue',_0x794e('0x3e'),_0x794e('0x3f')];if(_[_0x794e('0x40')](_0x3801ca,function(_0x4d240d){return!_[_0x794e('0x41')](_0x57185c,_0x4d240d['model'][_0x794e('0x42')]());})){throw new db['Sequelize'][(_0x794e('0x32'))](_0x794e('0x43'));}}}var _0x57d965={};_0x57d965[_0x794e('0x44')]=_0x4dcfb9['body'][_0x794e('0x30')](_0x794e('0x44'))?_0x4dcfb9[_0x794e('0x2e')][_0x794e('0x44')]:_0x4dcfb9[_0x794e('0x3f')][_0x794e('0x45')];_0x57d965[_0x794e('0x46')]=_[_0x794e('0x47')](_0x4dcfb9[_0x794e('0x2e')]['recipientsDescription'])?null:_0x4dcfb9[_0x794e('0x2e')][_0x794e('0x46')];_0x57d965[_0x794e('0x48')]=_0x4dcfb9[_0x794e('0x2e')][_0x794e('0x48')]||![];_0x57d965[_0x794e('0x49')]=_0x4dcfb9[_0x794e('0x3f')]['id'];return getContent(_0x4dcfb9['body'])[_0x794e('0x27')](function(_0x5cc8e5){_0x57d965[_0x794e('0x2e')]=_0x5cc8e5;return getRecipients(_0x3801ca);})[_0x794e('0x27')](function(_0x5e02d7){_0x57d965[_0x794e('0x4a')]=_[_0x794e('0x4b')](_0x5e02d7)[_0x794e('0x4c')](',');return db[_0x794e('0x4d')][_0x794e('0x4e')](function(_0x482bb4){return db[_0x794e('0x4f')][_0x794e('0x50')](_0x57d965,{'raw':!![],'transaction':_0x482bb4})[_0x794e('0x27')](function(_0x22f2f0){var _0x5366bd={'sender':_0x57d965[_0x794e('0x44')],'description':_0x57d965[_0x794e('0x46')],'content':_0x57d965[_0x794e('0x2e')],'beep':_0x57d965['beep']};_0x5e02d7[_0x794e('0x51')](function(_0x248d02){_0x5366bd['recipient']=_0x248d02;socket['emit'](_0x794e('0x52'),_0x5366bd);});return _0x22f2f0;});});})[_0x794e('0x27')](respondWithResult(_0x7fd7d1,0xc9))[_0x794e('0x53')](handleError(_0x7fd7d1,null));};function getContent(_0x56d8cb){return new BPromise(function(_0x56ea8a,_0x4c846c){if(_0x56d8cb[_0x794e('0x2f')]){_0x56ea8a(_0x56d8cb['text']);return;}return db[_0x794e('0x54')]['findOne']({'attributes':[_0x794e('0x55')],'where':{'id':_0x56d8cb[_0x794e('0x33')]},'raw':!![]})[_0x794e('0x27')](function(_0x69b059){if(!_0x69b059)throw new db['Sequelize'][(_0x794e('0x32'))](_0x794e('0x56'));var _0x155296=Mustache[_0x794e('0x57')](_0x69b059[_0x794e('0x55')],_0x56d8cb[_0x794e('0x58')]);_0x56ea8a(_0x155296);})[_0x794e('0x53')](function(_0x100d4c){_0x4c846c(_0x100d4c);});});}function getRecipients(_0x3710ca){return new BPromise(function(_0x57e4bf,_0x2166db){var _0x2431f2=[];var _0x35ca6f=[];_0x3710ca[_0x794e('0x51')](function(_0xc6b62c){var _0x21e28f=_[_0x794e('0x59')](_0xc6b62c['model'][_0x794e('0x42')]());if(_0x21e28f===_0x794e('0x5a')){_0x2431f2=_[_0x794e('0x5b')](_0x2431f2,_0xc6b62c['ids']);}else{if(_['includes'](_0x21e28f,'queue'))_0x21e28f=_0x21e28f[_0x794e('0x5c')](_0x794e('0x5d'),_0x794e('0x5e'));_0xc6b62c[_0x794e('0x5f')][_0x794e('0x51')](function(_0x2414cb){_0x35ca6f[_0x794e('0x60')](getAgents(_0x21e28f,_0x2414cb));});}});return BPromise[_0x794e('0x61')](_0x35ca6f)[_0x794e('0x27')](function(_0x4e9c20){_0x2431f2=_[_0x794e('0x5b')](_0x2431f2,_[_0x794e('0x62')](_0x4e9c20));_0x57e4bf(_0x2431f2);})[_0x794e('0x53')](function(_0x3c0326){_0x2166db(_0x3c0326);});});}function getAgents(_0x5b30f1,_0x44dd2b){return new BPromise(function(_0x3d8cbe,_0x56d0e6){return db[_0x5b30f1][_0x794e('0x63')]({'where':{'id':_0x44dd2b}})[_0x794e('0x27')](function(_0x8aab99){return _0x8aab99[_0x794e('0x64')]({'attributes':['id'],'raw':!![]})[_0x794e('0x27')](function(_0x108c4a){var _0xfe5772=_['map'](_0x108c4a,'id');_0x3d8cbe(_0xfe5772);});})[_0x794e('0x53')](function(_0x49ed27){_0x56d0e6(_0x49ed27);});});} \ No newline at end of file +var _0x6b50=['error','stack','status','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','senderName','user','recipientsDescription','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','model','User','union','ids','includes','queue','replace','Queue','all','flatten','map','rimraf','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','undefined','limit','count','offset','Content-Range','json','apply','reject','update','then'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x6b50,0x195));var _0x06b5=function(_0x423aeb,_0x4a57a6){_0x423aeb=_0x423aeb-0x0;var _0xf4da60=_0x6b50[_0x423aeb];return _0xf4da60;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06b5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06b5('0x1'));var rp=require(_0x06b5('0x2'));var moment=require('moment');var BPromise=require(_0x06b5('0x3'));var Mustache=require(_0x06b5('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x06b5('0x5'));var ejs=require(_0x06b5('0x6'));var fs=require('fs');var fs_extra=require(_0x06b5('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x06b5('0x8'));var jsforce=require(_0x06b5('0x9'));var deskjs=require(_0x06b5('0xa'));var toCsv=require(_0x06b5('0x5'));var querystring=require(_0x06b5('0xb'));var Papa=require('papaparse');var Redis=require(_0x06b5('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x06b5('0xd'));var as=require(_0x06b5('0xe'));var hardwareService=require(_0x06b5('0xf'));var logger=require(_0x06b5('0x10'))(_0x06b5('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x06b5('0x12'));var db=require('../../mysqldb')['db'];config[_0x06b5('0x13')]=_['defaults'](config[_0x06b5('0x13')],{'host':_0x06b5('0x14'),'port':0x18eb});var socket=require(_0x06b5('0x15'))(new Redis(config['redis']));require(_0x06b5('0x16'))[_0x06b5('0x17')](socket);function respondWithStatusCode(_0x17ef10,_0x280d83){_0x280d83=_0x280d83||0xcc;return function(_0xf7235a){if(_0xf7235a){return _0x17ef10[_0x06b5('0x18')](_0x280d83);}return _0x17ef10['status'](_0x280d83)['end']();};}function respondWithResult(_0x3ef208,_0x51c33d){_0x51c33d=_0x51c33d||0xc8;return function(_0x295c84){if(_0x295c84){return _0x3ef208['status'](_0x51c33d)['json'](_0x295c84);}};}function respondWithFilteredResult(_0x1e7868,_0x206f69){return function(_0x2786e0){if(_0x2786e0){var _0x55f8ea=typeof _0x206f69['offset']===_0x06b5('0x19')&&typeof _0x206f69[_0x06b5('0x1a')]==='undefined';var _0x4422fa=_0x2786e0[_0x06b5('0x1b')];var _0x180b04=_0x55f8ea?0x0:_0x206f69[_0x06b5('0x1c')];var _0x2c698a=_0x55f8ea?_0x2786e0['count']:_0x206f69['offset']+_0x206f69[_0x06b5('0x1a')];var _0x1ebb8a;if(_0x2c698a>=_0x4422fa){_0x2c698a=_0x4422fa;_0x1ebb8a=0xc8;}else{_0x1ebb8a=0xce;}_0x1e7868['status'](_0x1ebb8a);return _0x1e7868['set'](_0x06b5('0x1d'),_0x180b04+'-'+_0x2c698a+'/'+_0x4422fa)[_0x06b5('0x1e')](_0x2786e0);}return null;};}function patchUpdates(_0x158f3b){return function(_0xde09da){try{jsonpatch[_0x06b5('0x1f')](_0xde09da,_0x158f3b,!![]);}catch(_0x3a4cfa){return BPromise[_0x06b5('0x20')](_0x3a4cfa);}return _0xde09da['save']();};}function saveUpdates(_0x8e8d77,_0x5dcdcf){return function(_0xe33370){if(_0xe33370){return _0xe33370[_0x06b5('0x21')](_0x8e8d77)[_0x06b5('0x22')](function(_0x52d50a){return _0x52d50a;});}return null;};}function removeEntity(_0x7d12d3,_0x58f4b4){return function(_0x3f0f47){if(_0x3f0f47){return _0x3f0f47['destroy']()[_0x06b5('0x22')](function(){_0x7d12d3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48d247,_0x56e9d9){return function(_0x38f3be){if(!_0x38f3be){_0x48d247['sendStatus'](0x194);}return _0x38f3be;};}function handleError(_0x1c72de,_0x4fa26d){_0x4fa26d=_0x4fa26d||0x1f4;return function(_0x297363){logger[_0x06b5('0x23')](_0x297363[_0x06b5('0x24')]);if(_0x297363['name']){delete _0x297363['name'];}_0x1c72de[_0x06b5('0x25')](_0x4fa26d)[_0x06b5('0x26')](_0x297363);};}exports[_0x06b5('0x27')]=function(_0x4fbe91,_0x4ac379,_0x13c267){if(!_0x4fbe91[_0x06b5('0x28')][_0x06b5('0x29')](_0x06b5('0x2a'))&&!_0x4fbe91[_0x06b5('0x28')][_0x06b5('0x29')](_0x06b5('0x2b'))){throw new db[(_0x06b5('0x2c'))][(_0x06b5('0x2d'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x4fbe91[_0x06b5('0x28')][_0x06b5('0x29')](_0x06b5('0x2b'))&&!_0x4fbe91[_0x06b5('0x28')]['hasOwnProperty'](_0x06b5('0x2e'))){throw new db['Sequelize'][(_0x06b5('0x2d'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x4fbe91[_0x06b5('0x28')][_0x06b5('0x29')](_0x06b5('0x2f'))){throw new db[(_0x06b5('0x2c'))]['ValidationError'](_0x06b5('0x30'));}else{try{var _0xec3ed3=JSON[_0x06b5('0x31')](_0x4fbe91[_0x06b5('0x28')][_0x06b5('0x2f')]);}catch(_0x16ba0f){logger[_0x06b5('0x23')](_0x16ba0f);throw new db['Sequelize'][(_0x06b5('0x2d'))](_0x06b5('0x32'));}var _0x41e224=[_0x06b5('0x33'),_0x06b5('0x34'),_0x06b5('0x35'),'openchannelqueue',_0x06b5('0x36'),_0x06b5('0x37'),_0x06b5('0x38'),_0x06b5('0x39'),'user'];if(_['some'](_0xec3ed3,function(_0x2fcd44){return!_['includes'](_0x41e224,_0x2fcd44['model']['toLowerCase']());})){throw new db['Sequelize']['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x41483c={};_0x41483c[_0x06b5('0x3a')]=_0x4fbe91[_0x06b5('0x28')]['hasOwnProperty'](_0x06b5('0x3a'))?_0x4fbe91[_0x06b5('0x28')][_0x06b5('0x3a')]:_0x4fbe91[_0x06b5('0x3b')]['fullname'];_0x41483c['recipientsDescription']=_['isEmpty'](_0x4fbe91['body'][_0x06b5('0x3c')])?null:_0x4fbe91[_0x06b5('0x28')][_0x06b5('0x3c')];_0x41483c[_0x06b5('0x3d')]=_0x4fbe91[_0x06b5('0x28')][_0x06b5('0x3d')]||![];_0x41483c[_0x06b5('0x3e')]=_0x4fbe91[_0x06b5('0x3b')]['id'];return getContent(_0x4fbe91[_0x06b5('0x28')])['then'](function(_0x3f5570){_0x41483c[_0x06b5('0x28')]=_0x3f5570;return getRecipients(_0xec3ed3);})[_0x06b5('0x22')](function(_0x43bb6e){_0x41483c['recipientsId']=_[_0x06b5('0x3f')](_0x43bb6e)[_0x06b5('0x40')](',');return db[_0x06b5('0x41')][_0x06b5('0x42')](function(_0x3bf954){return db[_0x06b5('0x43')][_0x06b5('0x44')](_0x41483c,{'raw':!![],'transaction':_0x3bf954})['then'](function(_0x509d86){var _0x5755e7={'sender':_0x41483c[_0x06b5('0x3a')],'description':_0x41483c[_0x06b5('0x3c')],'content':_0x41483c[_0x06b5('0x28')],'beep':_0x41483c[_0x06b5('0x3d')]};_0x43bb6e[_0x06b5('0x45')](function(_0x2b6e49){_0x5755e7[_0x06b5('0x46')]=_0x2b6e49;socket['emit']('userNotification:send',_0x5755e7);});return _0x509d86;});});})[_0x06b5('0x22')](respondWithResult(_0x4ac379,0xc9))[_0x06b5('0x47')](handleError(_0x4ac379,null));};function getContent(_0x51cee9){return new BPromise(function(_0x11e98a,_0x32ef2d){if(_0x51cee9[_0x06b5('0x2a')]){_0x11e98a(_0x51cee9[_0x06b5('0x2a')]);return;}return db[_0x06b5('0x48')][_0x06b5('0x49')]({'attributes':[_0x06b5('0x4a')],'where':{'id':_0x51cee9[_0x06b5('0x2b')]},'raw':!![]})[_0x06b5('0x22')](function(_0x24b97c){if(!_0x24b97c)throw new db[(_0x06b5('0x2c'))][(_0x06b5('0x2d'))](_0x06b5('0x4b'));var _0x527c41=Mustache['render'](_0x24b97c[_0x06b5('0x4a')],_0x51cee9[_0x06b5('0x2e')]);_0x11e98a(_0x527c41);})['catch'](function(_0x248957){_0x32ef2d(_0x248957);});});}function getRecipients(_0x102b9e){return new BPromise(function(_0x2f8652,_0x1c1c31){var _0x36d652=[];var _0xecbbc8=[];_0x102b9e[_0x06b5('0x45')](function(_0x19dae3){var _0x4f09e7=_[_0x06b5('0x4c')](_0x19dae3[_0x06b5('0x4d')]['toLowerCase']());if(_0x4f09e7===_0x06b5('0x4e')){_0x36d652=_[_0x06b5('0x4f')](_0x36d652,_0x19dae3[_0x06b5('0x50')]);}else{if(_[_0x06b5('0x51')](_0x4f09e7,_0x06b5('0x52')))_0x4f09e7=_0x4f09e7[_0x06b5('0x53')](_0x06b5('0x52'),_0x06b5('0x54'));_0x19dae3[_0x06b5('0x50')][_0x06b5('0x45')](function(_0x5a06c1){_0xecbbc8['push'](getAgents(_0x4f09e7,_0x5a06c1));});}});return BPromise[_0x06b5('0x55')](_0xecbbc8)[_0x06b5('0x22')](function(_0x39d318){_0x36d652=_[_0x06b5('0x4f')](_0x36d652,_[_0x06b5('0x56')](_0x39d318));_0x2f8652(_0x36d652);})[_0x06b5('0x47')](function(_0x5da4bc){_0x1c1c31(_0x5da4bc);});});}function getAgents(_0x2694c8,_0x3a9387){return new BPromise(function(_0x59bc39,_0x2f5beb){return db[_0x2694c8][_0x06b5('0x49')]({'where':{'id':_0x3a9387}})[_0x06b5('0x22')](function(_0x20acc3){return _0x20acc3['getAgents']({'attributes':['id'],'raw':!![]})[_0x06b5('0x22')](function(_0x42e180){var _0x5eb85a=_[_0x06b5('0x57')](_0x42e180,'id');_0x59bc39(_0x5eb85a);});})[_0x06b5('0x47')](function(_0x8b2407){_0x2f5beb(_0x8b2407);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 07ce5b9..2a0910e 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 _0x338e=['update','remove','hasOwnProperty','hook','exports','events','UserNotification','setMaxListeners','save'];(function(_0x37f21d,_0x50049a){var _0x5da49b=function(_0x3763f8){while(--_0x3763f8){_0x37f21d['push'](_0x37f21d['shift']());}};_0x5da49b(++_0x50049a);}(_0x338e,0x1e2));var _0xe338=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x338e[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xe338('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xe338('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xe338('0x2')](0x0);var events={'afterCreate':_0xe338('0x3'),'afterUpdate':_0xe338('0x4'),'afterDestroy':_0xe338('0x5')};function emitEvent(_0x14964b){return function(_0x282b3d,_0x4eab74,_0x4a07dc){UserNotificationEvents['emit'](_0x14964b+':'+_0x282b3d['id'],_0x282b3d);UserNotificationEvents['emit'](_0x14964b,_0x282b3d);_0x4a07dc(null);};}for(var e in events){if(events[_0xe338('0x6')](e)){var event=events[e];UserNotification[_0xe338('0x7')](e,emitEvent(event));}}module[_0xe338('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xbf11=['emit','hook','exports','events','save','update','remove'];(function(_0x35dd3e,_0x100fd0){var _0x13e059=function(_0x159cb5){while(--_0x159cb5){_0x35dd3e['push'](_0x35dd3e['shift']());}};_0x13e059(++_0x100fd0);}(_0xbf11,0x1bc));var _0x1bf1=function(_0x559b69,_0x5b98bd){_0x559b69=_0x559b69-0x0;var _0x2ff0eb=_0xbf11[_0x559b69];return _0x2ff0eb;};'use strict';var EventEmitter=require(_0x1bf1('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1bf1('0x1'),'afterUpdate':_0x1bf1('0x2'),'afterDestroy':_0x1bf1('0x3')};function emitEvent(_0x2a1d3f){return function(_0x30624e,_0x5d0bdc,_0x5e8c5d){UserNotificationEvents[_0x1bf1('0x4')](_0x2a1d3f+':'+_0x30624e['id'],_0x30624e);UserNotificationEvents[_0x1bf1('0x4')](_0x2a1d3f,_0x30624e);_0x5e8c5d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x1bf1('0x5')](e,emitEvent(event));}}module[_0x1bf1('0x6')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 935a00d..7433146 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 _0x53a4=['rimraf','../../config/environment','exports','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53a4,0x173));var _0x453a=function(_0x3dfa6f,_0x5c4c1b){_0x3dfa6f=_0x3dfa6f-0x0;var _0x2c543c=_0x53a4[_0x3dfa6f];return _0x2c543c;};'use strict';var _=require(_0x453a('0x0'));var util=require(_0x453a('0x1'));var logger=require(_0x453a('0x2'))('api');var moment=require(_0x453a('0x3'));var BPromise=require('bluebird');var rp=require(_0x453a('0x4'));var fs=require('fs');var path=require(_0x453a('0x5'));var rimraf=require(_0x453a('0x6'));var config=require(_0x453a('0x7'));var attributes=require('./userNotification.attributes');module[_0x453a('0x8')]=function(_0x1fc759,_0x5bba0d){return _0x1fc759[_0x453a('0x9')](_0x453a('0xa'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x453a('0xb'),'collate':_0x453a('0xc')});}; \ No newline at end of file +var _0x419d=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userNotification.attributes','define','UserNotification','userNotifications'];(function(_0xb9dda3,_0x4f52ca){var _0x1e61c9=function(_0x3d8e4b){while(--_0x3d8e4b){_0xb9dda3['push'](_0xb9dda3['shift']());}};_0x1e61c9(++_0x4f52ca);}(_0x419d,0x11f));var _0xd419=function(_0x3d961e,_0x291cc8){_0x3d961e=_0x3d961e-0x0;var _0x5da581=_0x419d[_0x3d961e];return _0x5da581;};'use strict';var _=require(_0xd419('0x0'));var util=require(_0xd419('0x1'));var logger=require(_0xd419('0x2'))(_0xd419('0x3'));var moment=require('moment');var BPromise=require(_0xd419('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd419('0x5'));var rimraf=require(_0xd419('0x6'));var config=require(_0xd419('0x7'));var attributes=require(_0xd419('0x8'));module['exports']=function(_0xd6071a,_0x271063){return _0xd6071a[_0xd419('0x9')](_0xd419('0xa'),attributes,{'tableName':_0xd419('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd419('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index f558ce8..8dcf165 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 _0x6da1=['rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','UserNotification,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x5b270d,_0x258612){var _0x529cae=function(_0x30da72){while(--_0x30da72){_0x5b270d['push'](_0x5b270d['shift']());}};_0x529cae(++_0x258612);}(_0x6da1,0x149));var _0x16da=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6da1[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x16da('0x0'));var moment=require(_0x16da('0x1'));var BPromise=require(_0x16da('0x2'));var rs=require(_0x16da('0x3'));var fs=require('fs');var Redis=require(_0x16da('0x4'));var db=require(_0x16da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x16da('0x6'))(_0x16da('0x7'));var config=require('../../config/environment');var jayson=require(_0x16da('0x8'));var client=jayson[_0x16da('0x9')][_0x16da('0xa')]({'port':0x232a});config[_0x16da('0xb')]=_[_0x16da('0xc')](config[_0x16da('0xb')],{'host':_0x16da('0xd'),'port':0x18eb});var socket=require(_0x16da('0xe'))(new Redis(config[_0x16da('0xb')]));require(_0x16da('0xf'))[_0x16da('0x10')](socket);function respondWithRpcPromise(_0x58d57f,_0x191e7e,_0x251e58){return new BPromise(function(_0x4ce1c7,_0x321aa4){return client[_0x16da('0x11')](_0x58d57f,_0x251e58)[_0x16da('0x12')](function(_0x2aba46){logger[_0x16da('0x13')]('UserNotification,\x20%s,\x20%s',_0x191e7e,_0x16da('0x14'));logger[_0x16da('0x15')](_0x16da('0x16'),_0x191e7e,_0x16da('0x14'),JSON[_0x16da('0x17')](_0x2aba46));if(_0x2aba46[_0x16da('0x18')]){if(_0x2aba46[_0x16da('0x18')]['code']===0x1f4){logger[_0x16da('0x18')](_0x16da('0x19'),_0x191e7e,_0x2aba46[_0x16da('0x18')][_0x16da('0x1a')]);return _0x321aa4(_0x2aba46[_0x16da('0x18')]['message']);}logger[_0x16da('0x18')](_0x16da('0x19'),_0x191e7e,_0x2aba46[_0x16da('0x18')][_0x16da('0x1a')]);return _0x4ce1c7(_0x2aba46[_0x16da('0x18')][_0x16da('0x1a')]);}else{logger[_0x16da('0x13')](_0x16da('0x19'),_0x191e7e,_0x16da('0x14'));_0x4ce1c7(_0x2aba46['result'][_0x16da('0x1a')]);}})[_0x16da('0x1b')](function(_0x39f206){logger['error']('UserNotification,\x20%s,\x20%s',_0x191e7e,_0x39f206);_0x321aa4(_0x39f206);});});} \ No newline at end of file +var _0x0545=['info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','request','UserNotification,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x5b5873,_0x8d227b){var _0x5b8b68=function(_0x5d2776){while(--_0x5d2776){_0x5b5873['push'](_0x5b5873['shift']());}};_0x5b8b68(++_0x8d227b);}(_0x0545,0x1ac));var _0x5054=function(_0x593add,_0x47069b){_0x593add=_0x593add-0x0;var _0x350ddd=_0x0545[_0x593add];return _0x350ddd;};'use strict';var _=require('lodash');var util=require(_0x5054('0x0'));var moment=require(_0x5054('0x1'));var BPromise=require(_0x5054('0x2'));var rs=require(_0x5054('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5054('0x4'))['db'];var utils=require(_0x5054('0x5'));var logger=require(_0x5054('0x6'))('rpc');var config=require(_0x5054('0x7'));var jayson=require(_0x5054('0x8'));var client=jayson['client'][_0x5054('0x9')]({'port':0x232a});config[_0x5054('0xa')]=_[_0x5054('0xb')](config[_0x5054('0xa')],{'host':_0x5054('0xc'),'port':0x18eb});var socket=require(_0x5054('0xd'))(new Redis(config['redis']));require(_0x5054('0xe'))['register'](socket);function respondWithRpcPromise(_0x5b9c35,_0x8acb36,_0x3d221c){return new BPromise(function(_0x30fe37,_0x578f1c){return client[_0x5054('0xf')](_0x5b9c35,_0x3d221c)['then'](function(_0x5cb5f8){logger['info'](_0x5054('0x10'),_0x8acb36,_0x5054('0x11'));logger[_0x5054('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x8acb36,_0x5054('0x11'),JSON['stringify'](_0x5cb5f8));if(_0x5cb5f8[_0x5054('0x13')]){if(_0x5cb5f8[_0x5054('0x13')][_0x5054('0x14')]===0x1f4){logger['error'](_0x5054('0x10'),_0x8acb36,_0x5cb5f8[_0x5054('0x13')][_0x5054('0x15')]);return _0x578f1c(_0x5cb5f8[_0x5054('0x13')]['message']);}logger[_0x5054('0x13')](_0x5054('0x10'),_0x8acb36,_0x5cb5f8[_0x5054('0x13')][_0x5054('0x15')]);return _0x30fe37(_0x5cb5f8['error']['message']);}else{logger[_0x5054('0x16')](_0x5054('0x10'),_0x8acb36,_0x5054('0x11'));_0x30fe37(_0x5cb5f8[_0x5054('0x17')][_0x5054('0x15')]);}})[_0x5054('0x18')](function(_0x359864){logger[_0x5054('0x13')](_0x5054('0x10'),_0x8acb36,_0x359864);_0x578f1c(_0x359864);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 47b6ad3..8dc9645 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 _0xa20d=['save','update','emit','removeListener','register','length','userNotification:','./userNotification.events'];(function(_0x22873f,_0x5a110e){var _0x5dff78=function(_0x13507f){while(--_0x13507f){_0x22873f['push'](_0x22873f['shift']());}};_0x5dff78(++_0x5a110e);}(_0xa20d,0x1b7));var _0xda20=function(_0x15c5a9,_0x52ab34){_0x15c5a9=_0x15c5a9-0x0;var _0xd05e77=_0xa20d[_0x15c5a9];return _0xd05e77;};'use strict';var UserNotificationEvents=require(_0xda20('0x0'));var events=[_0xda20('0x1'),'remove',_0xda20('0x2')];function createListener(_0x3148c4,_0x422995){return function(_0x512229){_0x422995[_0xda20('0x3')](_0x3148c4,_0x512229);};}function removeListener(_0x30432f,_0x32a619){return function(){UserNotificationEvents[_0xda20('0x4')](_0x30432f,_0x32a619);};}exports[_0xda20('0x5')]=function(_0x1dd51a){for(var _0x5a8a25=0x0,_0x1cf5d0=events[_0xda20('0x6')];_0x5a8a25<_0x1cf5d0;_0x5a8a25++){var _0x18bb4c=events[_0x5a8a25];var _0x547fd8=createListener(_0xda20('0x7')+_0x18bb4c,_0x1dd51a);UserNotificationEvents['on'](_0x18bb4c,_0x547fd8);}}; \ No newline at end of file +var _0xce0d=['userNotification:','save','remove','emit','removeListener','register'];(function(_0x2aec18,_0x2d5d36){var _0x1df35e=function(_0x5969ca){while(--_0x5969ca){_0x2aec18['push'](_0x2aec18['shift']());}};_0x1df35e(++_0x2d5d36);}(_0xce0d,0x9d));var _0xdce0=function(_0x2e2292,_0x1891b8){_0x2e2292=_0x2e2292-0x0;var _0x4f77ab=_0xce0d[_0x2e2292];return _0x4f77ab;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xdce0('0x0'),_0xdce0('0x1'),'update'];function createListener(_0x3bebdf,_0x1f55e0){return function(_0x49d913){_0x1f55e0[_0xdce0('0x2')](_0x3bebdf,_0x49d913);};}function removeListener(_0x2a3188,_0x18ca5d){return function(){UserNotificationEvents[_0xdce0('0x3')](_0x2a3188,_0x18ca5d);};}exports[_0xdce0('0x4')]=function(_0xe82fcb){for(var _0x5ba04a=0x0,_0x7ca86c=events['length'];_0x5ba04a<_0x7ca86c;_0x5ba04a++){var _0x580e9e=events[_0x5ba04a];var _0x1b5ce4=createListener(_0xdce0('0x5')+_0x580e9e,_0xe82fcb);UserNotificationEvents['on'](_0x580e9e,_0x1b5ce4);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 68ca1e6..81e8848 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xe3cdae,_0x152d75){var _0x427679=function(_0x58539b){while(--_0x58539b){_0xe3cdae['push'](_0xe3cdae['shift']());}};_0x427679(++_0x152d75);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3c4828,_0x546d02){var _0x5149c2=function(_0x2a827a){while(--_0x2a827a){_0x3c4828['push'](_0x3c4828['shift']());}};_0x5149c2(++_0x546d02);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index c3b3be8..fe66d68 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 _0x235a=['exports','sequelize'];(function(_0x4e07f0,_0x17eefc){var _0x5a8788=function(_0x4636ca){while(--_0x4636ca){_0x4e07f0['push'](_0x4e07f0['shift']());}};_0x5a8788(++_0x17eefc);}(_0x235a,0xc7));var _0xa235=function(_0x1fc9a4,_0x55e193){_0x1fc9a4=_0x1fc9a4-0x0;var _0x1a1c58=_0x235a[_0x1fc9a4];return _0x1a1c58;};'use strict';var Sequelize=require(_0xa235('0x0'));module[_0xa235('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4202=['sequelize','exports'];(function(_0x37e845,_0x219f9f){var _0x59e55b=function(_0x5dc6c8){while(--_0x5dc6c8){_0x37e845['push'](_0x37e845['shift']());}};_0x59e55b(++_0x219f9f);}(_0x4202,0x8c));var _0x2420=function(_0x1ad0b4,_0x3638f4){_0x1ad0b4=_0x1ad0b4-0x0;var _0x42f563=_0x4202[_0x1ad0b4];return _0x42f563;};'use strict';var Sequelize=require(_0x2420('0x0'));module[_0x2420('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 1d7606f..500826a 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 _0xcccc=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x190ff6,_0x515cfd){var _0x5356d2=function(_0x2cf77c){while(--_0x2cf77c){_0x190ff6['push'](_0x190ff6['shift']());}};_0x5356d2(++_0x515cfd);}(_0xcccc,0x138));var _0xcccc=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xcccc[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xcccc('0x0'));var util=require(_0xcccc('0x1'));var logger=require(_0xcccc('0x2'))(_0xcccc('0x3'));var moment=require(_0xcccc('0x4'));var BPromise=require(_0xcccc('0x5'));var rp=require(_0xcccc('0x6'));var fs=require('fs');var path=require(_0xcccc('0x7'));var rimraf=require(_0xcccc('0x8'));var config=require(_0xcccc('0x9'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xcccc('0xa')]=function(_0x46d4c9,_0x1b9d06){return _0x46d4c9[_0xcccc('0xb')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb568=['UserOpenchannelQueue','util','moment','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports'];(function(_0x511bfc,_0x5e9d4e){var _0x302fb0=function(_0x3fe4d2){while(--_0x3fe4d2){_0x511bfc['push'](_0x511bfc['shift']());}};_0x302fb0(++_0x5e9d4e);}(_0xb568,0x159));var _0x8b56=function(_0x5f0869,_0x2b643c){_0x5f0869=_0x5f0869-0x0;var _0x5c5ef2=_0xb568[_0x5f0869];return _0x5c5ef2;};'use strict';var _=require('lodash');var util=require(_0x8b56('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8b56('0x1'));var BPromise=require('bluebird');var rp=require(_0x8b56('0x2'));var fs=require('fs');var path=require(_0x8b56('0x3'));var rimraf=require(_0x8b56('0x4'));var config=require('../../config/environment');var attributes=require(_0x8b56('0x5'));module[_0x8b56('0x6')]=function(_0x16e289,_0x88494b){return _0x16e289['define'](_0x8b56('0x7'),attributes,{'tableName':'user_has_openchannel_queues','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 5d85eb3..6a0712c 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 _0xfe06=['then','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request'];(function(_0x103882,_0x185710){var _0x326fc7=function(_0x486a87){while(--_0x486a87){_0x103882['push'](_0x103882['shift']());}};_0x326fc7(++_0x185710);}(_0xfe06,0x15d));var _0x6fe0=function(_0x232072,_0x3c979e){_0x232072=_0x232072-0x0;var _0x230ac5=_0xfe06[_0x232072];return _0x230ac5;};'use strict';var _=require(_0x6fe0('0x0'));var util=require(_0x6fe0('0x1'));var moment=require(_0x6fe0('0x2'));var BPromise=require('bluebird');var rs=require(_0x6fe0('0x3'));var fs=require('fs');var Redis=require(_0x6fe0('0x4'));var db=require(_0x6fe0('0x5'))['db'];var utils=require(_0x6fe0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6fe0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6fe0('0x8')][_0x6fe0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47c54e,_0x511113,_0x2ec9c8){return new BPromise(function(_0x13bf86,_0x51bc93){return client[_0x6fe0('0xa')](_0x47c54e,_0x2ec9c8)[_0x6fe0('0xb')](function(_0xc60c52){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x511113,_0x6fe0('0xc'));logger[_0x6fe0('0xd')](_0x6fe0('0xe'),_0x511113,_0x6fe0('0xc'),JSON[_0x6fe0('0xf')](_0xc60c52));if(_0xc60c52[_0x6fe0('0x10')]){if(_0xc60c52['error']['code']===0x1f4){logger[_0x6fe0('0x10')](_0x6fe0('0x11'),_0x511113,_0xc60c52['error'][_0x6fe0('0x12')]);return _0x51bc93(_0xc60c52[_0x6fe0('0x10')]['message']);}logger[_0x6fe0('0x10')](_0x6fe0('0x11'),_0x511113,_0xc60c52[_0x6fe0('0x10')][_0x6fe0('0x12')]);return _0x13bf86(_0xc60c52[_0x6fe0('0x10')][_0x6fe0('0x12')]);}else{logger['info'](_0x6fe0('0x11'),_0x511113,_0x6fe0('0xc'));_0x13bf86(_0xc60c52['result'][_0x6fe0('0x12')]);}})[_0x6fe0('0x13')](function(_0xd0b529){logger[_0x6fe0('0x10')](_0x6fe0('0x11'),_0x511113,_0xd0b529);_0x51bc93(_0xd0b529);});});} \ No newline at end of file +var _0xac5e=['request','UserOpenchannelQueue,\x20%s,\x20%s','debug','code','error','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac5e,0xed));var _0xeac5=function(_0x48c789,_0x4f0a4a){_0x48c789=_0x48c789-0x0;var _0x377a9c=_0xac5e[_0x48c789];return _0x377a9c;};'use strict';var _=require(_0xeac5('0x0'));var util=require(_0xeac5('0x1'));var moment=require('moment');var BPromise=require(_0xeac5('0x2'));var rs=require(_0xeac5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeac5('0x4'))['db'];var utils=require(_0xeac5('0x5'));var logger=require('../../config/logger')(_0xeac5('0x6'));var config=require(_0xeac5('0x7'));var jayson=require(_0xeac5('0x8'));var client=jayson[_0xeac5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37899c,_0xa7346d,_0x5be97a){return new BPromise(function(_0x140e71,_0x4fb3c5){return client[_0xeac5('0xa')](_0x37899c,_0x5be97a)['then'](function(_0x482382){logger['info'](_0xeac5('0xb'),_0xa7346d,'request\x20sent');logger[_0xeac5('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xa7346d,'request\x20sent',JSON['stringify'](_0x482382));if(_0x482382['error']){if(_0x482382['error'][_0xeac5('0xd')]===0x1f4){logger[_0xeac5('0xe')](_0xeac5('0xb'),_0xa7346d,_0x482382['error'][_0xeac5('0xf')]);return _0x4fb3c5(_0x482382[_0xeac5('0xe')][_0xeac5('0xf')]);}logger[_0xeac5('0xe')](_0xeac5('0xb'),_0xa7346d,_0x482382[_0xeac5('0xe')]['message']);return _0x140e71(_0x482382[_0xeac5('0xe')][_0xeac5('0xf')]);}else{logger[_0xeac5('0x10')](_0xeac5('0xb'),_0xa7346d,'request\x20sent');_0x140e71(_0x482382[_0xeac5('0x11')][_0xeac5('0xf')]);}})[_0xeac5('0x12')](function(_0x158a8a){logger['error'](_0xeac5('0xb'),_0xa7346d,_0x158a8a);_0x4fb3c5(_0x158a8a);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e1edf6e..b9f8d38 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 _0xc9a8=['/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','addSections','put','update','delete','destroy','removeSections','removeResources','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x24bc70,_0x324cff){var _0x5e2b4f=function(_0x4e0d3d){while(--_0x4e0d3d){_0x24bc70['push'](_0x24bc70['shift']());}};_0x5e2b4f(++_0x324cff);}(_0xc9a8,0x143));var _0x8c9a=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0xc9a8[_0x2b55b5];return _0x103d28;};'use strict';var multer=require(_0x8c9a('0x0'));var util=require('util');var path=require(_0x8c9a('0x1'));var timeout=require(_0x8c9a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8c9a('0x3'));var auth=require(_0x8c9a('0x4'));var interaction=require(_0x8c9a('0x5'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x8c9a('0x6')]('/',auth['isAuthenticated'](),controller[_0x8c9a('0x7')]);router[_0x8c9a('0x6')](_0x8c9a('0x8'),auth[_0x8c9a('0x9')](),controller[_0x8c9a('0xa')]);router['get'](_0x8c9a('0xb'),auth['isAuthenticated'](),controller[_0x8c9a('0xc')]);router['get'](_0x8c9a('0xd'),auth[_0x8c9a('0x9')](),controller[_0x8c9a('0xe')]);router['get'](_0x8c9a('0xf'),auth[_0x8c9a('0x9')](),controller[_0x8c9a('0x10')]);router['post']('/',auth[_0x8c9a('0x9')](),controller[_0x8c9a('0x11')]);router[_0x8c9a('0x12')](_0x8c9a('0x13'),auth[_0x8c9a('0x9')](),controller[_0x8c9a('0x14')]);router[_0x8c9a('0x12')]('/:id/sections',auth[_0x8c9a('0x9')](),controller[_0x8c9a('0x15')]);router[_0x8c9a('0x12')](_0x8c9a('0xf'),auth[_0x8c9a('0x9')](),controller['addResources']);router[_0x8c9a('0x16')](_0x8c9a('0xb'),auth[_0x8c9a('0x9')](),controller[_0x8c9a('0x17')]);router[_0x8c9a('0x18')](_0x8c9a('0xb'),auth[_0x8c9a('0x9')](),controller[_0x8c9a('0x19')]);router[_0x8c9a('0x18')]('/:id/sections',auth[_0x8c9a('0x9')](),controller[_0x8c9a('0x1a')]);router[_0x8c9a('0x18')](_0x8c9a('0xf'),auth[_0x8c9a('0x9')](),controller[_0x8c9a('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xed8c=['describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','addSections','addResources','put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe'];(function(_0x2b28a5,_0x2f3803){var _0x11a639=function(_0x456a57){while(--_0x456a57){_0x2b28a5['push'](_0x2b28a5['shift']());}};_0x11a639(++_0x2f3803);}(_0xed8c,0x64));var _0xced8=function(_0x3184c6,_0x397182){_0x3184c6=_0x3184c6-0x0;var _0x470f5b=_0xed8c[_0x3184c6];return _0x470f5b;};'use strict';var multer=require('multer');var util=require(_0xced8('0x0'));var path=require(_0xced8('0x1'));var timeout=require('connect-timeout');var express=require(_0xced8('0x2'));var router=express[_0xced8('0x3')]();var fs_extra=require(_0xced8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xced8('0x5'));var config=require(_0xced8('0x6'));var controller=require(_0xced8('0x7'));router[_0xced8('0x8')]('/',auth[_0xced8('0x9')](),controller[_0xced8('0xa')]);router[_0xced8('0x8')](_0xced8('0xb'),auth[_0xced8('0x9')](),controller[_0xced8('0xc')]);router[_0xced8('0x8')](_0xced8('0xd'),auth['isAuthenticated'](),controller[_0xced8('0xe')]);router[_0xced8('0x8')](_0xced8('0xf'),auth['isAuthenticated'](),controller[_0xced8('0x10')]);router['get'](_0xced8('0x11'),auth[_0xced8('0x9')](),controller[_0xced8('0x12')]);router[_0xced8('0x13')]('/',auth['isAuthenticated'](),controller[_0xced8('0x14')]);router[_0xced8('0x13')](_0xced8('0x15'),auth[_0xced8('0x9')](),controller['clone']);router['post'](_0xced8('0xf'),auth[_0xced8('0x9')](),controller[_0xced8('0x16')]);router['post']('/:id/resources',auth[_0xced8('0x9')](),controller[_0xced8('0x17')]);router[_0xced8('0x18')](_0xced8('0xd'),auth['isAuthenticated'](),controller[_0xced8('0x19')]);router[_0xced8('0x1a')](_0xced8('0xd'),auth[_0xced8('0x9')](),controller[_0xced8('0x1b')]);router['delete']('/:id/sections',auth[_0xced8('0x9')](),controller['removeSections']);router[_0xced8('0x1a')](_0xced8('0x11'),auth[_0xced8('0x9')](),controller['removeResources']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index d166d0c..6982043 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 _0xd167=['join','getDataValue','crudPermissions','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd167,0xeb));var _0x7d16=function(_0xb17352,_0x34ab78){_0xb17352=_0xb17352-0x0;var _0x16c41f=_0xd167[_0xb17352];return _0x16c41f;};'use strict';var Sequelize=require(_0x7d16('0x0'));module[_0x7d16('0x1')]={'name':{'type':Sequelize[_0x7d16('0x2')],'allowNull':![],'unique':_0x7d16('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x5a94b4){this[_0x7d16('0x4')]('crudPermissions',_0x5a94b4?_0x5a94b4[_0x7d16('0x5')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x7d16('0x6')](_0x7d16('0x7'))[_0x7d16('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x7d16('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x7d16('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x7d16('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x7d16('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x7d16('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7d16('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x453a=['crudPermissions','getDataValue','STRING','BOOLEAN','name'];(function(_0x1b471a,_0x38826e){var _0x4fe776=function(_0x39b70d){while(--_0x39b70d){_0x1b471a['push'](_0x1b471a['shift']());}};_0x4fe776(++_0x38826e);}(_0x453a,0x126));var _0xa453=function(_0x45f42e,_0x417bb){_0x45f42e=_0x45f42e-0x0;var _0x5704b6=_0x453a[_0x45f42e];return _0x5704b6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa453('0x0')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1affa9){this['setDataValue'](_0xa453('0x1'),_0x1affa9?_0x1affa9['join'](''):[]);},'get':function(){return this[_0xa453('0x2')](_0xa453('0x1'))?this[_0xa453('0x2')](_0xa453('0x1'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa453('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xa453('0x4')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa453('0x4')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xa453('0x4')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa453('0x4')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa453('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index d4caae7..55f8ca1 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 _0xea30=['userProfileId','Resources','UserProfileSection','destroy','describe','addSections','transaction','each','get','removeSections','getSections','includes','enabled','subsections','push','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','name','send','map','UserProfile','rawAttributes','fieldName','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','merge','options','find','create','clone','omit','createdAt','updatedAt','body','sequelize','autoAssociation','UserProfileResource','sectionId'];(function(_0x4b470a,_0x38d229){var _0x52ba0d=function(_0x55caa5){while(--_0x55caa5){_0x4b470a['push'](_0x4b470a['shift']());}};_0x52ba0d(++_0x38d229);}(_0xea30,0x1c4));var _0x0ea3=function(_0x502b99,_0x376daf){_0x502b99=_0x502b99-0x0;var _0x45563e=_0xea30[_0x502b99];return _0x45563e;};'use strict';var emlformat=require(_0x0ea3('0x0'));var rimraf=require(_0x0ea3('0x1'));var zipdir=require(_0x0ea3('0x2'));var jsonpatch=require(_0x0ea3('0x3'));var rp=require(_0x0ea3('0x4'));var moment=require(_0x0ea3('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0ea3('0x6'));var path=require(_0x0ea3('0x7'));var sox=require('sox');var csv=require(_0x0ea3('0x8'));var ejs=require(_0x0ea3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0ea3('0xa'));var crypto=require(_0x0ea3('0xb'));var jsforce=require(_0x0ea3('0xc'));var deskjs=require(_0x0ea3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0ea3('0xe'));var Papa=require('papaparse');var Redis=require(_0x0ea3('0xf'));var authService=require(_0x0ea3('0x10'));var qs=require(_0x0ea3('0x11'));var as=require(_0x0ea3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ea3('0x13'))(_0x0ea3('0x14'));var utils=require(_0x0ea3('0x15'));var config=require(_0x0ea3('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ea3('0x17'))['db'];config['redis']=_[_0x0ea3('0x18')](config['redis'],{'host':_0x0ea3('0x19'),'port':0x18eb});var socket=require(_0x0ea3('0x1a'))(new Redis(config['redis']));require(_0x0ea3('0x1b'))['register'](socket);function respondWithStatusCode(_0x47e1eb,_0x38d74f){_0x38d74f=_0x38d74f||0xcc;return function(_0x36df14){if(_0x36df14){return _0x47e1eb[_0x0ea3('0x1c')](_0x38d74f);}return _0x47e1eb[_0x0ea3('0x1d')](_0x38d74f)[_0x0ea3('0x1e')]();};}function respondWithResult(_0x522342,_0x29f4cd){_0x29f4cd=_0x29f4cd||0xc8;return function(_0x486eeb){if(_0x486eeb){return _0x522342[_0x0ea3('0x1d')](_0x29f4cd)[_0x0ea3('0x1f')](_0x486eeb);}};}function respondWithFilteredResult(_0xdbb5ce,_0x3d301a){return function(_0x4647dd){if(_0x4647dd){var _0x2ec3c7=typeof _0x3d301a[_0x0ea3('0x20')]===_0x0ea3('0x21')&&typeof _0x3d301a[_0x0ea3('0x22')]===_0x0ea3('0x21');var _0x172154=_0x4647dd[_0x0ea3('0x23')];var _0x47fd26=_0x2ec3c7?0x0:_0x3d301a[_0x0ea3('0x20')];var _0x30e73d=_0x2ec3c7?_0x4647dd['count']:_0x3d301a['offset']+_0x3d301a['limit'];var _0x174796;if(_0x30e73d>=_0x172154){_0x30e73d=_0x172154;_0x174796=0xc8;}else{_0x174796=0xce;}_0xdbb5ce[_0x0ea3('0x1d')](_0x174796);return _0xdbb5ce[_0x0ea3('0x24')]('Content-Range',_0x47fd26+'-'+_0x30e73d+'/'+_0x172154)['json'](_0x4647dd);}return null;};}function patchUpdates(_0x2da113){return function(_0x19ac27){try{jsonpatch['apply'](_0x19ac27,_0x2da113,!![]);}catch(_0x5cd201){return BPromise[_0x0ea3('0x25')](_0x5cd201);}return _0x19ac27[_0x0ea3('0x26')]();};}function saveUpdates(_0x85b34c,_0x17707f){return function(_0xdc8254){if(_0xdc8254){return _0xdc8254[_0x0ea3('0x27')](_0x85b34c)['then'](function(_0x2c32b4){return _0x2c32b4;});}return null;};}function removeEntity(_0x58298e,_0x226817){return function(_0x3cf65e){if(_0x3cf65e){return _0x3cf65e['destroy']()[_0x0ea3('0x28')](function(){_0x58298e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59a0c6,_0x4f2eee){return function(_0x349f11){if(!_0x349f11){_0x59a0c6[_0x0ea3('0x1c')](0x194);}return _0x349f11;};}function handleError(_0xb4d8fb,_0x1ea474){_0x1ea474=_0x1ea474||0x1f4;return function(_0x14f10f){logger['error'](_0x14f10f['stack']);if(_0x14f10f[_0x0ea3('0x29')]){delete _0x14f10f[_0x0ea3('0x29')];}_0xb4d8fb[_0x0ea3('0x1d')](_0x1ea474)[_0x0ea3('0x2a')](_0x14f10f);};}exports['index']=function(_0x174d3e,_0xd247d1){var _0x40d359={},_0x440f9d={},_0x34e5c2={'count':0x0,'rows':[]};var _0x31d407=_[_0x0ea3('0x2b')](db[_0x0ea3('0x2c')][_0x0ea3('0x2d')],function(_0x1a4346){return{'name':_0x1a4346[_0x0ea3('0x2e')],'type':_0x1a4346['type']['key']};});_0x440f9d[_0x0ea3('0x2f')]=_[_0x0ea3('0x2b')](_0x31d407,_0x0ea3('0x29'));_0x440f9d['query']=_[_0x0ea3('0x30')](_0x174d3e['query']);_0x440f9d[_0x0ea3('0x31')]=_[_0x0ea3('0x32')](_0x440f9d[_0x0ea3('0x2f')],_0x440f9d[_0x0ea3('0x33')]);_0x40d359[_0x0ea3('0x34')]=_[_0x0ea3('0x32')](_0x440f9d[_0x0ea3('0x2f')],qs['fields'](_0x174d3e[_0x0ea3('0x33')][_0x0ea3('0x35')]));_0x40d359[_0x0ea3('0x34')]=_0x40d359[_0x0ea3('0x34')]['length']?_0x40d359[_0x0ea3('0x34')]:_0x440f9d['model'];if(!_0x174d3e[_0x0ea3('0x33')][_0x0ea3('0x36')](_0x0ea3('0x37'))){_0x40d359[_0x0ea3('0x22')]=qs[_0x0ea3('0x22')](_0x174d3e[_0x0ea3('0x33')]['limit']);_0x40d359[_0x0ea3('0x20')]=qs[_0x0ea3('0x20')](_0x174d3e[_0x0ea3('0x33')][_0x0ea3('0x20')]);}_0x40d359[_0x0ea3('0x38')]=qs[_0x0ea3('0x39')](_0x174d3e[_0x0ea3('0x33')][_0x0ea3('0x39')]);_0x40d359[_0x0ea3('0x3a')]=qs['filters'](_[_0x0ea3('0x3b')](_0x174d3e[_0x0ea3('0x33')],_0x440f9d[_0x0ea3('0x31')]),_0x31d407);if(_0x174d3e[_0x0ea3('0x33')][_0x0ea3('0x3c')]){_0x40d359[_0x0ea3('0x3a')]=_['merge'](_0x40d359['where'],{'$or':_[_0x0ea3('0x2b')](_0x31d407,function(_0x4bf3bf){if(_0x4bf3bf['type']!==_0x0ea3('0x3d')){var _0x3204b1={};_0x3204b1[_0x4bf3bf[_0x0ea3('0x29')]]={'$like':'%'+_0x174d3e[_0x0ea3('0x33')][_0x0ea3('0x3c')]+'%'};return _0x3204b1;}})});}_0x40d359=_['merge']({},_0x40d359,_0x174d3e['options']);var _0x5c9ea2={'where':_0x40d359[_0x0ea3('0x3a')]};return db[_0x0ea3('0x2c')][_0x0ea3('0x23')](_0x5c9ea2)[_0x0ea3('0x28')](function(_0xa7768e){_0x34e5c2[_0x0ea3('0x23')]=_0xa7768e;if(_0x174d3e[_0x0ea3('0x33')][_0x0ea3('0x3e')]){_0x40d359[_0x0ea3('0x3f')]=[{'all':!![]}];}return db[_0x0ea3('0x2c')][_0x0ea3('0x40')](_0x40d359);})[_0x0ea3('0x28')](function(_0x32de70){_0x34e5c2[_0x0ea3('0x41')]=_0x32de70;return _0x34e5c2;})[_0x0ea3('0x28')](respondWithFilteredResult(_0xd247d1,_0x40d359))[_0x0ea3('0x42')](handleError(_0xd247d1,null));};exports[_0x0ea3('0x43')]=function(_0x1d55d6,_0x5a4e12){var _0x59f3de={'raw':![],'where':{'id':_0x1d55d6[_0x0ea3('0x44')]['id']}},_0x3d0f58={};_0x3d0f58[_0x0ea3('0x2f')]=_[_0x0ea3('0x30')](db['UserProfile'][_0x0ea3('0x2d')]);_0x3d0f58['query']=_['keys'](_0x1d55d6[_0x0ea3('0x33')]);_0x3d0f58[_0x0ea3('0x31')]=_[_0x0ea3('0x32')](_0x3d0f58[_0x0ea3('0x2f')],_0x3d0f58['query']);_0x59f3de['attributes']=_[_0x0ea3('0x32')](_0x3d0f58[_0x0ea3('0x2f')],qs['fields'](_0x1d55d6[_0x0ea3('0x33')][_0x0ea3('0x35')]));_0x59f3de[_0x0ea3('0x34')]=_0x59f3de[_0x0ea3('0x34')][_0x0ea3('0x45')]?_0x59f3de[_0x0ea3('0x34')]:_0x3d0f58['model'];if(_0x1d55d6[_0x0ea3('0x33')][_0x0ea3('0x3e')]){_0x59f3de[_0x0ea3('0x3f')]=[{'all':!![]}];}_0x59f3de=_[_0x0ea3('0x46')]({},_0x59f3de,_0x1d55d6[_0x0ea3('0x47')]);return db['UserProfile'][_0x0ea3('0x48')](_0x59f3de)[_0x0ea3('0x28')](handleEntityNotFound(_0x5a4e12,null))[_0x0ea3('0x28')](respondWithResult(_0x5a4e12,null))[_0x0ea3('0x42')](handleError(_0x5a4e12,null));};exports[_0x0ea3('0x49')]=function(_0x3b7fd8,_0x3fe905){return db[_0x0ea3('0x2c')]['create'](_0x3b7fd8['body'],{})['then'](respondWithResult(_0x3fe905,0xc9))[_0x0ea3('0x42')](handleError(_0x3fe905,null));};exports[_0x0ea3('0x4a')]=function(_0x32d02a,_0x482a89){var _0x3d5569={'where':{'id':_0x32d02a[_0x0ea3('0x44')]['id']}},_0x5d0540={};_0x5d0540[_0x0ea3('0x2f')]=_[_0x0ea3('0x30')](db[_0x0ea3('0x2c')][_0x0ea3('0x2d')]);_0x3d5569['attributes']=_[_0x0ea3('0x32')](_0x5d0540['model'],qs['fields'](_0x32d02a[_0x0ea3('0x33')][_0x0ea3('0x35')]));_0x3d5569['attributes']=_0x3d5569['attributes'][_0x0ea3('0x45')]?_0x3d5569[_0x0ea3('0x34')]:_0x5d0540[_0x0ea3('0x2f')];if(_0x32d02a[_0x0ea3('0x33')][_0x0ea3('0x3e')]){_0x3d5569[_0x0ea3('0x3f')]=[{'all':!![]}];}_0x3d5569=_[_0x0ea3('0x46')]({},_0x3d5569,_0x32d02a['options']);return db[_0x0ea3('0x2c')][_0x0ea3('0x48')](_0x3d5569)[_0x0ea3('0x28')](handleEntityNotFound(_0x482a89,null))[_0x0ea3('0x28')](function(_0x2f2dc1){if(_0x2f2dc1){var _0x2de679=_0x2f2dc1['get']({'plain':!![]});_0x2de679=qs[_0x0ea3('0x4b')](_0x2de679,['id',_0x0ea3('0x4c'),_0x0ea3('0x4d'),'crudPermissions']);_0x32d02a[_0x0ea3('0x4e')]=_[_0x0ea3('0x4b')](_0x32d02a[_0x0ea3('0x4e')],['id',_0x0ea3('0x4c'),'updatedAt']);return db[_0x0ea3('0x4f')]['transaction'](function(_0x39fe9f){return db[_0x0ea3('0x2c')][_0x0ea3('0x49')](_[_0x0ea3('0x46')](_0x2de679,_0x32d02a[_0x0ea3('0x4e')]),{'include':_0x32d02a[_0x0ea3('0x33')][_0x0ea3('0x3e')]?[{'all':!![]}]:undefined,'transaction':_0x39fe9f})[_0x0ea3('0x28')](function(_0xa32e49){var _0x5d0064=_0xa32e49['get']({'plain':!![]});return db['UserProfileSection'][_0x0ea3('0x40')]({'where':{'userProfileId':_0x32d02a['params']['id']},'raw':!![]})[_0x0ea3('0x28')](function(_0x321691){if(_0x321691){return BPromise['each'](_0x321691,function(_0x396a97){return new BPromise(function(_0x38931c,_0x22139c){if(_0x396a97[_0x0ea3('0x50')]===null||_0x396a97[_0x0ea3('0x50')]===0x1)_0x38931c(null);return db[_0x0ea3('0x51')]['findAll']({'where':{'sectionId':_0x396a97['id']},'raw':!![]})[_0x0ea3('0x28')](function(_0x22c64d){var _0x431412=_[_0x0ea3('0x2b')](_0x22c64d,function(_0x422ff2){return qs[_0x0ea3('0x4b')](_0x422ff2,['id',_0x0ea3('0x4c'),_0x0ea3('0x4d'),_0x0ea3('0x52')]);});_0x38931c(_0x431412);})[_0x0ea3('0x42')](function(_0x52778e){_0x22139c(_0x52778e);});})[_0x0ea3('0x28')](function(_0x249525){var _0x1c5d36=qs[_0x0ea3('0x4b')](_0x396a97,['id','createdAt',_0x0ea3('0x4d')]);_0x1c5d36[_0x0ea3('0x53')]=_0x5d0064['id'];if(_0x249525)_0x1c5d36[_0x0ea3('0x54')]=_0x249525;return _0x1c5d36;})['then'](function(_0x9e413d){return db[_0x0ea3('0x55')]['create'](_0x9e413d,{'include':[{'model':db['UserProfileResource'],'as':_0x0ea3('0x54')}],'raw':!![],'transaction':_0x39fe9f});});})[_0x0ea3('0x28')](function(){return _0x5d0064;});}});});});}})['then'](respondWithResult(_0x482a89,0xc9))['catch'](handleError(_0x482a89,null));};exports[_0x0ea3('0x27')]=function(_0x128649,_0x30b30c){if(_0x128649[_0x0ea3('0x4e')]['id']){delete _0x128649['body']['id'];}return db[_0x0ea3('0x2c')]['find']({'where':{'id':_0x128649[_0x0ea3('0x44')]['id']}})[_0x0ea3('0x28')](handleEntityNotFound(_0x30b30c,null))['then'](saveUpdates(_0x128649[_0x0ea3('0x4e')],null))[_0x0ea3('0x28')](respondWithResult(_0x30b30c,null))[_0x0ea3('0x42')](handleError(_0x30b30c,null));};exports[_0x0ea3('0x56')]=function(_0x17abc9,_0x21977c){return db[_0x0ea3('0x2c')][_0x0ea3('0x48')]({'where':{'id':_0x17abc9[_0x0ea3('0x44')]['id']}})[_0x0ea3('0x28')](handleEntityNotFound(_0x21977c,null))[_0x0ea3('0x28')](removeEntity(_0x21977c,null))[_0x0ea3('0x42')](handleError(_0x21977c,null));};exports[_0x0ea3('0x57')]=function(_0x3efedb,_0x5e4b44){return db['UserProfile'][_0x0ea3('0x57')]()[_0x0ea3('0x28')](respondWithResult(_0x5e4b44,null))[_0x0ea3('0x42')](handleError(_0x5e4b44,null));};exports[_0x0ea3('0x58')]=function(_0x25556e,_0x2d1dc0){var _0x30e1c1=_0x25556e[_0x0ea3('0x4e')];return db[_0x0ea3('0x2c')][_0x0ea3('0x48')]({'where':{'id':_0x25556e['params']['id']}})[_0x0ea3('0x28')](handleEntityNotFound(_0x2d1dc0,null))[_0x0ea3('0x28')](function(_0x5b2e2a){if(_0x5b2e2a){return db[_0x0ea3('0x4f')][_0x0ea3('0x59')](function(_0x29c0c2){return db[_0x0ea3('0x55')][_0x0ea3('0x56')]({'where':{'userProfileId':_0x25556e['params']['id'],'sectionId':_[_0x0ea3('0x2b')](_0x30e1c1,function(_0x58d99e){return _0x58d99e[_0x0ea3('0x52')];})},'transaction':_0x29c0c2})[_0x0ea3('0x28')](function(){var _0x5680c9=_[_0x0ea3('0x2b')](_0x30e1c1,function(_0x2926fc){_0x2926fc['userProfileId']=_0x25556e[_0x0ea3('0x44')]['id'];return _0x2926fc;});var _0x192f2c=[];return BPromise[_0x0ea3('0x5a')](_0x5680c9,function(_0x3be6e5){return db[_0x0ea3('0x55')][_0x0ea3('0x49')](_0x3be6e5,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x29c0c2})['then'](function(_0x2c7b52){_0x192f2c['push'](_0x2c7b52[_0x0ea3('0x5b')]({'plain':!![]}));});})[_0x0ea3('0x28')](function(){return _0x192f2c;});});});}})[_0x0ea3('0x28')](function(_0x262bad){return _0x262bad;})[_0x0ea3('0x28')](respondWithResult(_0x2d1dc0,null))[_0x0ea3('0x42')](handleError(_0x2d1dc0,null));};exports[_0x0ea3('0x5c')]=function(_0x23143c,_0x555e6b){var _0x2a3620;return db['UserProfile']['find']({'where':{'id':_0x23143c[_0x0ea3('0x44')]['id']},'attributes':['id',_0x0ea3('0x29')]})['then'](handleEntityNotFound(_0x555e6b,null))[_0x0ea3('0x28')](function(_0x19fc81){if(_0x19fc81){_0x2a3620=_0x19fc81;return db['UserProfileSection'][_0x0ea3('0x56')]({'where':{'userProfileId':_0x23143c[_0x0ea3('0x44')]['id'],'sectionId':_0x23143c[_0x0ea3('0x33')]['ids']}});}})[_0x0ea3('0x28')](function(){return _0x2a3620;})[_0x0ea3('0x28')](respondWithStatusCode(_0x555e6b,null))['catch'](handleError(_0x555e6b,null));};exports[_0x0ea3('0x5d')]=function(_0x115738,_0x59ddc1){var _0x1b99ec=[];var _0x364da7=[];return db[_0x0ea3('0x55')][_0x0ea3('0x40')]({'where':{'userProfileId':_0x115738[_0x0ea3('0x44')]['id']},'raw':!![]})[_0x0ea3('0x28')](function(_0x1f3013){_0x1b99ec=_[_0x0ea3('0x3c')](_0x1f3013,function(_0x5b23f6){return _0x5b23f6['enabled']===0x1||_[_0x0ea3('0x5e')]([0x3eb,0x709],_0x5b23f6[_0x0ea3('0x52')]);});if(!_['isEmpty'](_0x1b99ec)){return _[_0x0ea3('0x2b')](_0x1b99ec,function(_0x448f34){return _0x448f34[_0x0ea3('0x52')];});}else{return;}})['then'](function(_0x8a33c9){if(_0x8a33c9)_0x364da7=_0x8a33c9;if(_[_0x0ea3('0x5e')](_0x364da7,0x64)){var _0x38f6ec=_[_0x0ea3('0x48')](_0x1b99ec,{'sectionId':0x64});return hasDefaultDashboard(_0x38f6ec)[_0x0ea3('0x28')](function(_0x10b443){return _['map'](_0x1b99ec,function(_0x5e7fdd){if(_0x5e7fdd['sectionId']===0x64){_0x5e7fdd['subsections']=_0x10b443;}return _0x5e7fdd;});});}else{return;}})['then'](function(_0x50c2e9){if(_0x50c2e9)_0x1b99ec=_0x50c2e9;if(_['includes'](_0x364da7,0x3eb)){var _0x14ec74=_[_0x0ea3('0x48')](_0x1b99ec,{'sectionId':0x3eb});return getCustomDashboards(_0x14ec74)[_0x0ea3('0x28')](function(_0xdc4133){return _[_0x0ea3('0x2b')](_0x1b99ec,function(_0x388791){if(_0x14ec74[_0x0ea3('0x5f')]){if(_0x388791['sectionId']===0x3eb){_0x388791[_0x0ea3('0x60')]=_0xdc4133;}}else{if(_0x388791[_0x0ea3('0x52')]===0x64){if(!_0x388791['subsections']){_0x388791[_0x0ea3('0x60')]=[];}_0x388791[_0x0ea3('0x60')]=_0x388791['subsections']['concat'](_0xdc4133);}}return _0x388791;});});}else{return;}})[_0x0ea3('0x28')](function(_0x5bb9d0){if(_0x5bb9d0)_0x1b99ec=_0x5bb9d0;if(_[_0x0ea3('0x5e')](_0x364da7,0x709)){var _0x56b819=_[_0x0ea3('0x48')](_0x1b99ec,{'sectionId':0x709});return getPlugins(_0x56b819)[_0x0ea3('0x28')](function(_0x1d487e){if(_0x56b819['enabled']){return _[_0x0ea3('0x2b')](_0x1b99ec,function(_0x1b943e){if(_0x1b943e[_0x0ea3('0x52')]===0x709){_0x1b943e[_0x0ea3('0x60')]=_0x1d487e;}return _0x1b943e;});}else{var _0x42a911={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1d487e};var _0x49d329=_[_0x0ea3('0x2b')](_0x1b99ec);_0x49d329[_0x0ea3('0x61')](_0x42a911);return _0x49d329;}});}else{return;}})[_0x0ea3('0x28')](function(_0x3566b1){if(_0x3566b1)_0x1b99ec=_0x3566b1;return _['filter'](_0x1b99ec,[_0x0ea3('0x5f'),0x1]);})[_0x0ea3('0x28')](respondWithResult(_0x59ddc1,null))['catch'](handleError(_0x59ddc1,null));};function hasDefaultDashboard(_0x34fe79){var _0x1b3ff9=[0x65];return new BPromise(function(_0x31e288,_0x2323b3){try{if(_0x34fe79[_0x0ea3('0x50')]){_0x31e288(_0x1b3ff9);}else{return db[_0x0ea3('0x51')]['findOne']({'where':{'sectionId':_0x34fe79['id']},'raw':!![]})['then'](function(_0xb1d5b2){_0xb1d5b2?_0x31e288(_0x1b3ff9):_0x31e288();});}}catch(_0x4bdadb){_0x2323b3(_0x4bdadb);}});}function getCustomDashboards(_0x37ad8a){var _0x28895e=[];return new BPromise(function(_0x5bc04b,_0x133408){try{if(_0x37ad8a[_0x0ea3('0x50')]){return db[_0x0ea3('0x62')][_0x0ea3('0x40')]({'raw':!![]})[_0x0ea3('0x28')](function(_0xcdb51b){_0xcdb51b[_0x0ea3('0x63')](function(_0x19a37b){_0x28895e[_0x0ea3('0x61')](_0x19a37b['id']+0x1869f);});_0x5bc04b(_0x28895e);});}else{return db[_0x0ea3('0x51')][_0x0ea3('0x40')]({'where':{'sectionId':_0x37ad8a['id']},'raw':!![]})[_0x0ea3('0x28')](function(_0x560de4){_0x560de4[_0x0ea3('0x63')](function(_0x3e2b4c){_0x28895e[_0x0ea3('0x61')](_0x3e2b4c[_0x0ea3('0x64')]+0x1869f);});_0x5bc04b(_0x28895e);});}}catch(_0x36da6f){_0x133408(_0x36da6f);}});}function getPlugins(_0x21a731){var _0x2bf711=[];return new BPromise(function(_0x4e4ca3,_0x133f99){try{if(_0x21a731['autoAssociation']){return db[_0x0ea3('0x65')][_0x0ea3('0x40')]({'raw':!![]})[_0x0ea3('0x28')](function(_0x517394){_0x517394['forEach'](function(_0x3ca080){_0x2bf711[_0x0ea3('0x61')](_0x3ca080['id']+0x15b38);});_0x4e4ca3(_0x2bf711);});}else{return db[_0x0ea3('0x51')][_0x0ea3('0x40')]({'where':{'sectionId':_0x21a731['id']},'raw':!![]})['then'](function(_0x3bb9ed){_0x3bb9ed['forEach'](function(_0x4c3478){_0x2bf711[_0x0ea3('0x61')](_0x4c3478[_0x0ea3('0x64')]+0x15b38);});_0x4e4ca3(_0x2bf711);});}}catch(_0x3292e0){_0x133f99(_0x3292e0);}});}exports[_0x0ea3('0x66')]=function(_0x4e8c05,_0x5d8385){return db['UserProfile'][_0x0ea3('0x48')]({'where':{'id':_0x4e8c05[_0x0ea3('0x44')]['id']}})[_0x0ea3('0x28')](handleEntityNotFound(_0x5d8385,null))[_0x0ea3('0x28')](function(_0x51ac4e){if(_0x51ac4e){return db[_0x0ea3('0x4f')][_0x0ea3('0x59')](function(_0x194315){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x4e8c05['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x134b70){if(_0x134b70){return db[_0x0ea3('0x55')][_0x0ea3('0x56')]({'where':{'userProfileId':_0x4e8c05[_0x0ea3('0x44')]['id'],'id':_[_0x0ea3('0x2b')](_0x134b70,function(_0x3324e2){return _0x3324e2['id'];})},'transaction':_0x194315});}})[_0x0ea3('0x28')](function(_0x3abb74){var _0x19486f=_['map'](_0x4e8c05[_0x0ea3('0x4e')],function(_0x430494){_0x430494[_0x0ea3('0x53')]=_0x4e8c05[_0x0ea3('0x44')]['id'];return _0x430494;});return db[_0x0ea3('0x55')][_0x0ea3('0x67')](_0x19486f,{'raw':!![],'transaction':_0x194315});})[_0x0ea3('0x28')](function(_0xecdf2d){var _0x1b996b=_[_0x0ea3('0x3c')](_[_0x0ea3('0x2b')](_0xecdf2d,function(_0x149496){return _0x149496[_0x0ea3('0x5b')]({'plain':!![]});}),{'includeAll':![]});if(_0x1b996b){return db['UserProfileSection'][_0x0ea3('0x40')]({'where':{'userProfileId':_0x4e8c05[_0x0ea3('0x44')]['id'],'sectionId':_['map'](_0x1b996b,function(_0x4eca37){return _0x4eca37[_0x0ea3('0x52')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x0ea3('0x28')](function(_0x225b4f){var _0x222895=_['map'](_0x4e8c05[_0x0ea3('0x4e')],function(_0x121c79){_0x121c79[_0x0ea3('0x53')]=_0x4e8c05['params']['id'];return _0x121c79;});return db[_0x0ea3('0x51')][_0x0ea3('0x67')](_0x222895,{'raw':!![],'transaction':_0x194315});});}})[_0x0ea3('0x42')](handleError(_0x5d8385,null));});}})[_0x0ea3('0x28')](function(_0x159869){var _0xcf7931=_['map'](_0x159869,function(_0x78a4f){return _0x78a4f[_0x0ea3('0x5b')]({'plain':!![]});});})[_0x0ea3('0x28')](respondWithResult(_0x5d8385,null))[_0x0ea3('0x42')](handleError(_0x5d8385,null));};exports['removeResources']=function(_0x2fd624,_0x29b4c3,_0x27a138){return db[_0x0ea3('0x2c')][_0x0ea3('0x48')]({'where':{'id':_0x2fd624[_0x0ea3('0x44')]['id']}})[_0x0ea3('0x28')](handleEntityNotFound(_0x29b4c3,null))[_0x0ea3('0x28')](function(_0x2c455b){if(_0x2c455b){return _0x2c455b[_0x0ea3('0x68')](_0x2fd624[_0x0ea3('0x33')]['ids']);}})[_0x0ea3('0x28')](respondWithStatusCode(_0x29b4c3,null))[_0x0ea3('0x42')](handleError(_0x29b4c3,null));};exports[_0x0ea3('0x69')]=function(_0x3c9bc0,_0xe2a35d){var _0x50a194={};if(!_0x3c9bc0[_0x0ea3('0x33')][_0x0ea3('0x6a')])throw new Error('Missing\x20section\x20parameter');if(!_0x3c9bc0[_0x0ea3('0x33')][_0x0ea3('0x36')](_0x0ea3('0x37'))){_0x50a194['limit']=qs[_0x0ea3('0x22')](_0x3c9bc0[_0x0ea3('0x33')]['limit']);_0x50a194[_0x0ea3('0x20')]=qs['offset'](_0x3c9bc0[_0x0ea3('0x33')][_0x0ea3('0x20')]);}return db[_0x0ea3('0x2c')]['find']({'where':{'id':_0x3c9bc0[_0x0ea3('0x44')]['id']}})[_0x0ea3('0x28')](function(_0x2eefd4){if(!_0x2eefd4)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x3c9bc0[_0x0ea3('0x44')]['id']);return db[_0x0ea3('0x2c')]['getResources'](_0x3c9bc0);})['then'](respondWithFilteredResult(_0xe2a35d,_0x50a194))[_0x0ea3('0x42')](handleError(_0xe2a35d,null));}; \ No newline at end of file +var _0xa466=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','UserProfile','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','clone','omit','createdAt','updatedAt','crudPermissions','body','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','sequelize','push','ids','getSections','enabled','includes','subsections','concat','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa466,0x140));var _0x6a46=function(_0x20c9a8,_0x8adf2f){_0x20c9a8=_0x20c9a8-0x0;var _0x56a8cf=_0xa466[_0x20c9a8];return _0x56a8cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a46('0x0'));var zipdir=require(_0x6a46('0x1'));var jsonpatch=require(_0x6a46('0x2'));var rp=require('request-promise');var moment=require(_0x6a46('0x3'));var BPromise=require(_0x6a46('0x4'));var Mustache=require(_0x6a46('0x5'));var util=require(_0x6a46('0x6'));var path=require(_0x6a46('0x7'));var sox=require(_0x6a46('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a46('0x9'));var _=require('lodash');var squel=require(_0x6a46('0xa'));var crypto=require(_0x6a46('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6a46('0xc'));var toCsv=require(_0x6a46('0xd'));var querystring=require(_0x6a46('0xe'));var Papa=require(_0x6a46('0xf'));var Redis=require(_0x6a46('0x10'));var authService=require(_0x6a46('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6a46('0x12'));var hardwareService=require(_0x6a46('0x13'));var logger=require(_0x6a46('0x14'))(_0x6a46('0x15'));var utils=require(_0x6a46('0x16'));var config=require(_0x6a46('0x17'));var licenseUtil=require(_0x6a46('0x18'));var db=require(_0x6a46('0x19'))['db'];config[_0x6a46('0x1a')]=_['defaults'](config[_0x6a46('0x1a')],{'host':_0x6a46('0x1b'),'port':0x18eb});var socket=require(_0x6a46('0x1c'))(new Redis(config[_0x6a46('0x1a')]));require(_0x6a46('0x1d'))['register'](socket);function respondWithStatusCode(_0x3bb091,_0x5717d6){_0x5717d6=_0x5717d6||0xcc;return function(_0x49f16f){if(_0x49f16f){return _0x3bb091[_0x6a46('0x1e')](_0x5717d6);}return _0x3bb091[_0x6a46('0x1f')](_0x5717d6)[_0x6a46('0x20')]();};}function respondWithResult(_0x3969bb,_0x3ffa20){_0x3ffa20=_0x3ffa20||0xc8;return function(_0x87f1e6){if(_0x87f1e6){return _0x3969bb[_0x6a46('0x1f')](_0x3ffa20)[_0x6a46('0x21')](_0x87f1e6);}};}function respondWithFilteredResult(_0x2d0cde,_0x52ce87){return function(_0x10c241){if(_0x10c241){var _0x1f75b8=typeof _0x52ce87[_0x6a46('0x22')]===_0x6a46('0x23')&&typeof _0x52ce87[_0x6a46('0x24')]===_0x6a46('0x23');var _0x2665c5=_0x10c241[_0x6a46('0x25')];var _0x41cd11=_0x1f75b8?0x0:_0x52ce87['offset'];var _0x5b9c77=_0x1f75b8?_0x10c241['count']:_0x52ce87[_0x6a46('0x22')]+_0x52ce87[_0x6a46('0x24')];var _0x3b7992;if(_0x5b9c77>=_0x2665c5){_0x5b9c77=_0x2665c5;_0x3b7992=0xc8;}else{_0x3b7992=0xce;}_0x2d0cde['status'](_0x3b7992);return _0x2d0cde[_0x6a46('0x26')](_0x6a46('0x27'),_0x41cd11+'-'+_0x5b9c77+'/'+_0x2665c5)[_0x6a46('0x21')](_0x10c241);}return null;};}function patchUpdates(_0xdd3476){return function(_0x111256){try{jsonpatch[_0x6a46('0x28')](_0x111256,_0xdd3476,!![]);}catch(_0x5c0265){return BPromise[_0x6a46('0x29')](_0x5c0265);}return _0x111256[_0x6a46('0x2a')]();};}function saveUpdates(_0x155b3d,_0x24cbf6){return function(_0x793fdb){if(_0x793fdb){return _0x793fdb['update'](_0x155b3d)[_0x6a46('0x2b')](function(_0x3c60a4){return _0x3c60a4;});}return null;};}function removeEntity(_0x2a2afb,_0x2e1d7b){return function(_0x54988b){if(_0x54988b){return _0x54988b[_0x6a46('0x2c')]()[_0x6a46('0x2b')](function(){_0x2a2afb[_0x6a46('0x1f')](0xcc)[_0x6a46('0x20')]();});}};}function handleEntityNotFound(_0x4dfab2,_0x1239aa){return function(_0x3005e2){if(!_0x3005e2){_0x4dfab2[_0x6a46('0x1e')](0x194);}return _0x3005e2;};}function handleError(_0x33d369,_0x167f72){_0x167f72=_0x167f72||0x1f4;return function(_0x1c2627){logger['error'](_0x1c2627[_0x6a46('0x2d')]);if(_0x1c2627['name']){delete _0x1c2627[_0x6a46('0x2e')];}_0x33d369[_0x6a46('0x1f')](_0x167f72)[_0x6a46('0x2f')](_0x1c2627);};}exports[_0x6a46('0x30')]=function(_0x15e56e,_0x3dbd7a){var _0x371899={},_0x20534c={},_0x202a8e={'count':0x0,'rows':[]};var _0x580850=_[_0x6a46('0x31')](db[_0x6a46('0x32')]['rawAttributes'],function(_0x3a2687){return{'name':_0x3a2687[_0x6a46('0x33')],'type':_0x3a2687[_0x6a46('0x34')]['key']};});_0x20534c[_0x6a46('0x35')]=_[_0x6a46('0x31')](_0x580850,_0x6a46('0x2e'));_0x20534c[_0x6a46('0x36')]=_[_0x6a46('0x37')](_0x15e56e[_0x6a46('0x36')]);_0x20534c[_0x6a46('0x38')]=_[_0x6a46('0x39')](_0x20534c[_0x6a46('0x35')],_0x20534c[_0x6a46('0x36')]);_0x371899[_0x6a46('0x3a')]=_[_0x6a46('0x39')](_0x20534c[_0x6a46('0x35')],qs[_0x6a46('0x3b')](_0x15e56e[_0x6a46('0x36')][_0x6a46('0x3b')]));_0x371899[_0x6a46('0x3a')]=_0x371899[_0x6a46('0x3a')][_0x6a46('0x3c')]?_0x371899[_0x6a46('0x3a')]:_0x20534c[_0x6a46('0x35')];if(!_0x15e56e[_0x6a46('0x36')][_0x6a46('0x3d')]('nolimit')){_0x371899['limit']=qs[_0x6a46('0x24')](_0x15e56e[_0x6a46('0x36')]['limit']);_0x371899[_0x6a46('0x22')]=qs[_0x6a46('0x22')](_0x15e56e[_0x6a46('0x36')][_0x6a46('0x22')]);}_0x371899[_0x6a46('0x3e')]=qs[_0x6a46('0x3f')](_0x15e56e['query'][_0x6a46('0x3f')]);_0x371899[_0x6a46('0x40')]=qs['filters'](_['pick'](_0x15e56e[_0x6a46('0x36')],_0x20534c[_0x6a46('0x38')]),_0x580850);if(_0x15e56e[_0x6a46('0x36')][_0x6a46('0x41')]){_0x371899[_0x6a46('0x40')]=_[_0x6a46('0x42')](_0x371899[_0x6a46('0x40')],{'$or':_['map'](_0x580850,function(_0x2fc497){if(_0x2fc497['type']!==_0x6a46('0x43')){var _0x11b63a={};_0x11b63a[_0x2fc497['name']]={'$like':'%'+_0x15e56e['query'][_0x6a46('0x41')]+'%'};return _0x11b63a;}})});}_0x371899=_[_0x6a46('0x42')]({},_0x371899,_0x15e56e[_0x6a46('0x44')]);var _0x342150={'where':_0x371899[_0x6a46('0x40')]};return db['UserProfile'][_0x6a46('0x25')](_0x342150)[_0x6a46('0x2b')](function(_0xf104f8){_0x202a8e[_0x6a46('0x25')]=_0xf104f8;if(_0x15e56e[_0x6a46('0x36')][_0x6a46('0x45')]){_0x371899['include']=[{'all':!![]}];}return db[_0x6a46('0x32')][_0x6a46('0x46')](_0x371899);})[_0x6a46('0x2b')](function(_0x139f3c){_0x202a8e[_0x6a46('0x47')]=_0x139f3c;return _0x202a8e;})[_0x6a46('0x2b')](respondWithFilteredResult(_0x3dbd7a,_0x371899))[_0x6a46('0x48')](handleError(_0x3dbd7a,null));};exports[_0x6a46('0x49')]=function(_0x1c8eea,_0x1ccec2){var _0x4772ff={'raw':![],'where':{'id':_0x1c8eea[_0x6a46('0x4a')]['id']}},_0x55b18b={};_0x55b18b[_0x6a46('0x35')]=_[_0x6a46('0x37')](db[_0x6a46('0x32')][_0x6a46('0x4b')]);_0x55b18b[_0x6a46('0x36')]=_[_0x6a46('0x37')](_0x1c8eea[_0x6a46('0x36')]);_0x55b18b[_0x6a46('0x38')]=_[_0x6a46('0x39')](_0x55b18b[_0x6a46('0x35')],_0x55b18b[_0x6a46('0x36')]);_0x4772ff[_0x6a46('0x3a')]=_['intersection'](_0x55b18b['model'],qs[_0x6a46('0x3b')](_0x1c8eea[_0x6a46('0x36')][_0x6a46('0x3b')]));_0x4772ff[_0x6a46('0x3a')]=_0x4772ff[_0x6a46('0x3a')][_0x6a46('0x3c')]?_0x4772ff[_0x6a46('0x3a')]:_0x55b18b['model'];if(_0x1c8eea[_0x6a46('0x36')][_0x6a46('0x45')]){_0x4772ff[_0x6a46('0x4c')]=[{'all':!![]}];}_0x4772ff=_[_0x6a46('0x42')]({},_0x4772ff,_0x1c8eea[_0x6a46('0x44')]);return db['UserProfile'][_0x6a46('0x4d')](_0x4772ff)[_0x6a46('0x2b')](handleEntityNotFound(_0x1ccec2,null))[_0x6a46('0x2b')](respondWithResult(_0x1ccec2,null))[_0x6a46('0x48')](handleError(_0x1ccec2,null));};exports[_0x6a46('0x4e')]=function(_0x2c8a11,_0x14c334){return db[_0x6a46('0x32')][_0x6a46('0x4e')](_0x2c8a11['body'],{})[_0x6a46('0x2b')](respondWithResult(_0x14c334,0xc9))[_0x6a46('0x48')](handleError(_0x14c334,null));};exports[_0x6a46('0x4f')]=function(_0x237fa8,_0x386aa3){var _0x4c0719={'where':{'id':_0x237fa8[_0x6a46('0x4a')]['id']}},_0x145b1f={};_0x145b1f[_0x6a46('0x35')]=_[_0x6a46('0x37')](db[_0x6a46('0x32')]['rawAttributes']);_0x4c0719[_0x6a46('0x3a')]=_[_0x6a46('0x39')](_0x145b1f[_0x6a46('0x35')],qs[_0x6a46('0x3b')](_0x237fa8[_0x6a46('0x36')]['fields']));_0x4c0719[_0x6a46('0x3a')]=_0x4c0719['attributes']['length']?_0x4c0719[_0x6a46('0x3a')]:_0x145b1f[_0x6a46('0x35')];if(_0x237fa8['query'][_0x6a46('0x45')]){_0x4c0719[_0x6a46('0x4c')]=[{'all':!![]}];}_0x4c0719=_[_0x6a46('0x42')]({},_0x4c0719,_0x237fa8[_0x6a46('0x44')]);return db[_0x6a46('0x32')][_0x6a46('0x4d')](_0x4c0719)['then'](handleEntityNotFound(_0x386aa3,null))['then'](function(_0x1a822c){if(_0x1a822c){var _0x4a925b=_0x1a822c['get']({'plain':!![]});_0x4a925b=qs[_0x6a46('0x50')](_0x4a925b,['id',_0x6a46('0x51'),_0x6a46('0x52'),_0x6a46('0x53')]);_0x237fa8[_0x6a46('0x54')]=_[_0x6a46('0x50')](_0x237fa8[_0x6a46('0x54')],['id','createdAt','updatedAt']);return db['sequelize'][_0x6a46('0x55')](function(_0xfd70b3){return db[_0x6a46('0x32')]['create'](_[_0x6a46('0x42')](_0x4a925b,_0x237fa8[_0x6a46('0x54')]),{'include':_0x237fa8[_0x6a46('0x36')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0xfd70b3})[_0x6a46('0x2b')](function(_0x42ab8b){var _0x3abd97=_0x42ab8b[_0x6a46('0x56')]({'plain':!![]});return db[_0x6a46('0x57')][_0x6a46('0x46')]({'where':{'userProfileId':_0x237fa8[_0x6a46('0x4a')]['id']},'raw':!![]})[_0x6a46('0x2b')](function(_0x3e331c){if(_0x3e331c){return BPromise[_0x6a46('0x58')](_0x3e331c,function(_0x20c35f){return new BPromise(function(_0x232169,_0xb78472){if(_0x20c35f[_0x6a46('0x59')]===null||_0x20c35f[_0x6a46('0x59')]===0x1)_0x232169(null);return db[_0x6a46('0x5a')][_0x6a46('0x46')]({'where':{'sectionId':_0x20c35f['id']},'raw':!![]})[_0x6a46('0x2b')](function(_0x205bbd){var _0x2682d2=_[_0x6a46('0x31')](_0x205bbd,function(_0x5aed2d){return qs[_0x6a46('0x50')](_0x5aed2d,['id',_0x6a46('0x51'),_0x6a46('0x52'),_0x6a46('0x5b')]);});_0x232169(_0x2682d2);})[_0x6a46('0x48')](function(_0xa93c39){_0xb78472(_0xa93c39);});})['then'](function(_0x453583){var _0x110ac3=qs[_0x6a46('0x50')](_0x20c35f,['id',_0x6a46('0x51'),_0x6a46('0x52')]);_0x110ac3[_0x6a46('0x5c')]=_0x3abd97['id'];if(_0x453583)_0x110ac3[_0x6a46('0x5d')]=_0x453583;return _0x110ac3;})[_0x6a46('0x2b')](function(_0x7f3819){return db['UserProfileSection']['create'](_0x7f3819,{'include':[{'model':db[_0x6a46('0x5a')],'as':_0x6a46('0x5d')}],'raw':!![],'transaction':_0xfd70b3});});})['then'](function(){return _0x3abd97;});}});});});}})[_0x6a46('0x2b')](respondWithResult(_0x386aa3,0xc9))[_0x6a46('0x48')](handleError(_0x386aa3,null));};exports['update']=function(_0x4be8a9,_0x494e35){if(_0x4be8a9['body']['id']){delete _0x4be8a9[_0x6a46('0x54')]['id'];}return db[_0x6a46('0x32')][_0x6a46('0x4d')]({'where':{'id':_0x4be8a9[_0x6a46('0x4a')]['id']}})[_0x6a46('0x2b')](handleEntityNotFound(_0x494e35,null))['then'](saveUpdates(_0x4be8a9[_0x6a46('0x54')],null))[_0x6a46('0x2b')](respondWithResult(_0x494e35,null))['catch'](handleError(_0x494e35,null));};exports['destroy']=function(_0x139f62,_0x29c6c3){return db[_0x6a46('0x32')][_0x6a46('0x4d')]({'where':{'id':_0x139f62['params']['id']}})[_0x6a46('0x2b')](handleEntityNotFound(_0x29c6c3,null))[_0x6a46('0x2b')](removeEntity(_0x29c6c3,null))[_0x6a46('0x48')](handleError(_0x29c6c3,null));};exports[_0x6a46('0x5e')]=function(_0x5b5b7f,_0x5590d8){return db[_0x6a46('0x32')]['describe']()[_0x6a46('0x2b')](respondWithResult(_0x5590d8,null))['catch'](handleError(_0x5590d8,null));};exports[_0x6a46('0x5f')]=function(_0xed66a7,_0xfb2235){var _0x567e28=_0xed66a7['body'];return db[_0x6a46('0x32')][_0x6a46('0x4d')]({'where':{'id':_0xed66a7[_0x6a46('0x4a')]['id']}})['then'](handleEntityNotFound(_0xfb2235,null))[_0x6a46('0x2b')](function(_0x265742){if(_0x265742){return db[_0x6a46('0x60')]['transaction'](function(_0x528198){return db[_0x6a46('0x57')]['destroy']({'where':{'userProfileId':_0xed66a7[_0x6a46('0x4a')]['id'],'sectionId':_[_0x6a46('0x31')](_0x567e28,function(_0x51c9d0){return _0x51c9d0[_0x6a46('0x5b')];})},'transaction':_0x528198})[_0x6a46('0x2b')](function(){var _0x182254=_['map'](_0x567e28,function(_0xa80a81){_0xa80a81[_0x6a46('0x5c')]=_0xed66a7[_0x6a46('0x4a')]['id'];return _0xa80a81;});var _0x1d182e=[];return BPromise[_0x6a46('0x58')](_0x182254,function(_0x5a26ab){return db['UserProfileSection'][_0x6a46('0x4e')](_0x5a26ab,{'include':[{'model':db[_0x6a46('0x5a')],'as':_0x6a46('0x5d')}],'raw':!![],'transaction':_0x528198})[_0x6a46('0x2b')](function(_0x37d24e){_0x1d182e[_0x6a46('0x61')](_0x37d24e['get']({'plain':!![]}));});})['then'](function(){return _0x1d182e;});});});}})['then'](function(_0x408fc6){return _0x408fc6;})['then'](respondWithResult(_0xfb2235,null))['catch'](handleError(_0xfb2235,null));};exports['removeSections']=function(_0x414a10,_0x33ed0b){var _0xfbbe79;return db['UserProfile']['find']({'where':{'id':_0x414a10['params']['id']},'attributes':['id',_0x6a46('0x2e')]})['then'](handleEntityNotFound(_0x33ed0b,null))[_0x6a46('0x2b')](function(_0x1de1e8){if(_0x1de1e8){_0xfbbe79=_0x1de1e8;return db[_0x6a46('0x57')][_0x6a46('0x2c')]({'where':{'userProfileId':_0x414a10['params']['id'],'sectionId':_0x414a10[_0x6a46('0x36')][_0x6a46('0x62')]}});}})[_0x6a46('0x2b')](function(){return _0xfbbe79;})['then'](respondWithStatusCode(_0x33ed0b,null))['catch'](handleError(_0x33ed0b,null));};exports[_0x6a46('0x63')]=function(_0x44dd4e,_0x3acc9d){var _0x238b44=[];var _0x271543=[];return db[_0x6a46('0x57')][_0x6a46('0x46')]({'where':{'userProfileId':_0x44dd4e[_0x6a46('0x4a')]['id']},'raw':!![]})['then'](function(_0x4c38f4){_0x238b44=_[_0x6a46('0x41')](_0x4c38f4,function(_0x555ad9){return _0x555ad9[_0x6a46('0x64')]===0x1||_[_0x6a46('0x65')]([0x3eb,0x709],_0x555ad9[_0x6a46('0x5b')]);});if(!_['isEmpty'](_0x238b44)){return _['map'](_0x238b44,function(_0x261688){return _0x261688['sectionId'];});}else{return;}})[_0x6a46('0x2b')](function(_0x3b2dd9){if(_0x3b2dd9)_0x271543=_0x3b2dd9;if(_[_0x6a46('0x65')](_0x271543,0x64)){var _0x5764ec=_[_0x6a46('0x4d')](_0x238b44,{'sectionId':0x64});return hasDefaultDashboard(_0x5764ec)[_0x6a46('0x2b')](function(_0xbe4047){return _[_0x6a46('0x31')](_0x238b44,function(_0x2d8a34){if(_0x2d8a34[_0x6a46('0x5b')]===0x64){_0x2d8a34['subsections']=_0xbe4047;}return _0x2d8a34;});});}else{return;}})[_0x6a46('0x2b')](function(_0x48057c){if(_0x48057c)_0x238b44=_0x48057c;if(_[_0x6a46('0x65')](_0x271543,0x3eb)){var _0x3cf407=_['find'](_0x238b44,{'sectionId':0x3eb});return getCustomDashboards(_0x3cf407)[_0x6a46('0x2b')](function(_0x25040e){return _[_0x6a46('0x31')](_0x238b44,function(_0x5c34e9){if(_0x3cf407[_0x6a46('0x64')]){if(_0x5c34e9[_0x6a46('0x5b')]===0x3eb){_0x5c34e9['subsections']=_0x25040e;}}else{if(_0x5c34e9[_0x6a46('0x5b')]===0x64){if(!_0x5c34e9[_0x6a46('0x66')]){_0x5c34e9[_0x6a46('0x66')]=[];}_0x5c34e9[_0x6a46('0x66')]=_0x5c34e9[_0x6a46('0x66')][_0x6a46('0x67')](_0x25040e);}}return _0x5c34e9;});});}else{return;}})[_0x6a46('0x2b')](function(_0x379b1f){if(_0x379b1f)_0x238b44=_0x379b1f;if(_['includes'](_0x271543,0x709)){var _0x2dda26=_['find'](_0x238b44,{'sectionId':0x709});return getPlugins(_0x2dda26)[_0x6a46('0x2b')](function(_0x47326c){if(_0x2dda26[_0x6a46('0x64')]){return _[_0x6a46('0x31')](_0x238b44,function(_0x5a529a){if(_0x5a529a[_0x6a46('0x5b')]===0x709){_0x5a529a['subsections']=_0x47326c;}return _0x5a529a;});}else{var _0x13f3a2={'sectionId':0x76c,'enabled':0x1,'subsections':_0x47326c};var _0x5beadf=_['map'](_0x238b44);_0x5beadf[_0x6a46('0x61')](_0x13f3a2);return _0x5beadf;}});}else{return;}})[_0x6a46('0x2b')](function(_0x387366){if(_0x387366)_0x238b44=_0x387366;return _[_0x6a46('0x41')](_0x238b44,[_0x6a46('0x64'),0x1]);})[_0x6a46('0x2b')](respondWithResult(_0x3acc9d,null))['catch'](handleError(_0x3acc9d,null));};function hasDefaultDashboard(_0x56ff8c){var _0xa812eb=[0x65];return new BPromise(function(_0x231b0f,_0x18295c){try{if(_0x56ff8c[_0x6a46('0x59')]){_0x231b0f(_0xa812eb);}else{return db[_0x6a46('0x5a')]['findOne']({'where':{'sectionId':_0x56ff8c['id']},'raw':!![]})[_0x6a46('0x2b')](function(_0x29e592){_0x29e592?_0x231b0f(_0xa812eb):_0x231b0f();});}}catch(_0x3b68cf){_0x18295c(_0x3b68cf);}});}function getCustomDashboards(_0x18a902){var _0x370b93=[];return new BPromise(function(_0x2cbdb8,_0x586a53){try{if(_0x18a902[_0x6a46('0x59')]){return db[_0x6a46('0x68')][_0x6a46('0x46')]({'raw':!![]})['then'](function(_0xaa7098){_0xaa7098[_0x6a46('0x69')](function(_0x5b6818){_0x370b93['push'](_0x5b6818['id']+0x1869f);});_0x2cbdb8(_0x370b93);});}else{return db[_0x6a46('0x5a')][_0x6a46('0x46')]({'where':{'sectionId':_0x18a902['id']},'raw':!![]})['then'](function(_0x152a8e){_0x152a8e[_0x6a46('0x69')](function(_0x2ae288){_0x370b93[_0x6a46('0x61')](_0x2ae288[_0x6a46('0x6a')]+0x1869f);});_0x2cbdb8(_0x370b93);});}}catch(_0x23e8d4){_0x586a53(_0x23e8d4);}});}function getPlugins(_0x49ba9d){var _0xede563=[];return new BPromise(function(_0x2f2304,_0x5e356c){try{if(_0x49ba9d[_0x6a46('0x59')]){return db[_0x6a46('0x6b')]['findAll']({'raw':!![]})[_0x6a46('0x2b')](function(_0x20dad4){_0x20dad4['forEach'](function(_0xfd5b38){_0xede563[_0x6a46('0x61')](_0xfd5b38['id']+0x15b38);});_0x2f2304(_0xede563);});}else{return db['UserProfileResource'][_0x6a46('0x46')]({'where':{'sectionId':_0x49ba9d['id']},'raw':!![]})[_0x6a46('0x2b')](function(_0x37c020){_0x37c020['forEach'](function(_0x3fe398){_0xede563[_0x6a46('0x61')](_0x3fe398['resourceId']+0x15b38);});_0x2f2304(_0xede563);});}}catch(_0x3db646){_0x5e356c(_0x3db646);}});}exports['addResources']=function(_0x53f6be,_0x14851a){return db['UserProfile'][_0x6a46('0x4d')]({'where':{'id':_0x53f6be[_0x6a46('0x4a')]['id']}})[_0x6a46('0x2b')](handleEntityNotFound(_0x14851a,null))[_0x6a46('0x2b')](function(_0x1836d3){if(_0x1836d3){return db[_0x6a46('0x60')][_0x6a46('0x55')](function(_0x29646a){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x53f6be[_0x6a46('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x6a46('0x2b')](function(_0x36b310){if(_0x36b310){return db[_0x6a46('0x57')][_0x6a46('0x2c')]({'where':{'userProfileId':_0x53f6be[_0x6a46('0x4a')]['id'],'id':_[_0x6a46('0x31')](_0x36b310,function(_0x11176a){return _0x11176a['id'];})},'transaction':_0x29646a});}})[_0x6a46('0x2b')](function(_0x1932b4){var _0x44485d=_[_0x6a46('0x31')](_0x53f6be['body'],function(_0x316a4d){_0x316a4d[_0x6a46('0x5c')]=_0x53f6be[_0x6a46('0x4a')]['id'];return _0x316a4d;});return db[_0x6a46('0x57')][_0x6a46('0x6c')](_0x44485d,{'raw':!![],'transaction':_0x29646a});})[_0x6a46('0x2b')](function(_0x5c0dc5){var _0x1ff6fa=_[_0x6a46('0x41')](_[_0x6a46('0x31')](_0x5c0dc5,function(_0x8049f4){return _0x8049f4[_0x6a46('0x56')]({'plain':!![]});}),{'includeAll':![]});if(_0x1ff6fa){return db[_0x6a46('0x57')][_0x6a46('0x46')]({'where':{'userProfileId':_0x53f6be[_0x6a46('0x4a')]['id'],'sectionId':_[_0x6a46('0x31')](_0x1ff6fa,function(_0x38636e){return _0x38636e['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0xef90b3){var _0x142a2b=_[_0x6a46('0x31')](_0x53f6be[_0x6a46('0x54')],function(_0x55c299){_0x55c299[_0x6a46('0x5c')]=_0x53f6be['params']['id'];return _0x55c299;});return db[_0x6a46('0x5a')][_0x6a46('0x6c')](_0x142a2b,{'raw':!![],'transaction':_0x29646a});});}})[_0x6a46('0x48')](handleError(_0x14851a,null));});}})[_0x6a46('0x2b')](function(_0x30e8e3){var _0x37ff63=_[_0x6a46('0x31')](_0x30e8e3,function(_0x5a6794){return _0x5a6794[_0x6a46('0x56')]({'plain':!![]});});})[_0x6a46('0x2b')](respondWithResult(_0x14851a,null))[_0x6a46('0x48')](handleError(_0x14851a,null));};exports[_0x6a46('0x6d')]=function(_0xbe4163,_0x38e716,_0x1b5fbc){return db[_0x6a46('0x32')][_0x6a46('0x4d')]({'where':{'id':_0xbe4163['params']['id']}})[_0x6a46('0x2b')](handleEntityNotFound(_0x38e716,null))['then'](function(_0x590498){if(_0x590498){return _0x590498[_0x6a46('0x6d')](_0xbe4163['query'][_0x6a46('0x62')]);}})[_0x6a46('0x2b')](respondWithStatusCode(_0x38e716,null))['catch'](handleError(_0x38e716,null));};exports['getResources']=function(_0x1a2066,_0x5cd91f){var _0x3fe764={};if(!_0x1a2066[_0x6a46('0x36')][_0x6a46('0x6e')])throw new Error(_0x6a46('0x6f'));if(!_0x1a2066['query'][_0x6a46('0x3d')](_0x6a46('0x70'))){_0x3fe764['limit']=qs[_0x6a46('0x24')](_0x1a2066[_0x6a46('0x36')][_0x6a46('0x24')]);_0x3fe764[_0x6a46('0x22')]=qs[_0x6a46('0x22')](_0x1a2066['query']['offset']);}return db[_0x6a46('0x32')][_0x6a46('0x4d')]({'where':{'id':_0x1a2066['params']['id']}})['then'](function(_0x4b06a6){if(!_0x4b06a6)throw new Error(_0x6a46('0x71')+_0x1a2066[_0x6a46('0x4a')]['id']);return db[_0x6a46('0x32')]['getResources'](_0x1a2066);})[_0x6a46('0x2b')](respondWithFilteredResult(_0x5cd91f,_0x3fe764))[_0x6a46('0x48')](handleError(_0x5cd91f,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 934c9b8..662295c 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 _0x1b9b=['exports','events','UserProfile','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x12f8c6,_0x54d2d8){var _0xe9ae4a=function(_0x2d5b63){while(--_0x2d5b63){_0x12f8c6['push'](_0x12f8c6['shift']());}};_0xe9ae4a(++_0x54d2d8);}(_0x1b9b,0x89));var _0xb1b9=function(_0x27820c,_0x551bd2){_0x27820c=_0x27820c-0x0;var _0x454e30=_0x1b9b[_0x27820c];return _0x454e30;};'use strict';var EventEmitter=require(_0xb1b9('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xb1b9('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb1b9('0x2')](0x0);var events={'afterCreate':_0xb1b9('0x3'),'afterUpdate':_0xb1b9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x38f77a){return function(_0x411464,_0x597f8f,_0x5c24be){UserProfileEvents['emit'](_0x38f77a+':'+_0x411464['id'],_0x411464);UserProfileEvents[_0xb1b9('0x5')](_0x38f77a,_0x411464);_0x5c24be(null);};}for(var e in events){if(events[_0xb1b9('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xb1b9('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x4bd3=['events','UserProfile','setMaxListeners','emit','hook','exports'];(function(_0x2d7605,_0x5ad4ca){var _0x2410f2=function(_0x1a6e8f){while(--_0x1a6e8f){_0x2d7605['push'](_0x2d7605['shift']());}};_0x2410f2(++_0x5ad4ca);}(_0x4bd3,0x174));var _0x34bd=function(_0x1b8e34,_0x427436){_0x1b8e34=_0x1b8e34-0x0;var _0xb2ded4=_0x4bd3[_0x1b8e34];return _0xb2ded4;};'use strict';var EventEmitter=require(_0x34bd('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x34bd('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x34bd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22b921){return function(_0x44854a,_0x1fc8eb,_0x5846f3){UserProfileEvents[_0x34bd('0x3')](_0x22b921+':'+_0x44854a['id'],_0x44854a);UserProfileEvents[_0x34bd('0x3')](_0x22b921,_0x44854a);_0x5846f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x34bd('0x4')](e,emitEvent(event));}}module[_0x34bd('0x5')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index e0ff6e6..fd863e1 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 _0x4ca4=['admin','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','reportId','metrics','toUpperCase','slice','QueryTypes','SELECT','select','ui.','ui.createdAt','from','_interactions','where','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','raw','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','params','all','ignore','union','length','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','autoAssociation','include','default','custom','ids','customSorting','extraQueryConditions','count','includeAll','CmContact','color','tag','ThroughTags','rows','openTabs','true','chat','dataValues','sms','fax','mail','whatsapp','./userProfile.attributes','exports','models','filter','field','value','then','associatedResources','map','catch','model','findAll','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','squareprojects','SquareProject','SquareOdbc','squarerecordings','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','contacts','childModel','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','ChatQueue','FaxQueue','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','Agents','User','role','agent','membername','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','smsqueues','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones'];(function(_0x5218c0,_0x2591df){var _0xc5dba=function(_0x54f32d){while(--_0x54f32d){_0x5218c0['push'](_0x5218c0['shift']());}};_0xc5dba(++_0x2591df);}(_0x4ca4,0x6c));var _0x44ca=function(_0x4c04b0,_0x173f9f){_0x4c04b0=_0x4c04b0-0x0;var _0x443938=_0x4ca4[_0x4c04b0];return _0x443938;};'use strict';var _=require('lodash');var attributes=require(_0x44ca('0x0'));var squel=require('squel');module[_0x44ca('0x1')]=function(_0x43cbaa){var _0x3737c5=_0x43cbaa[_0x44ca('0x2')];function _0x5e55bc(_0x755c3b,_0x46e6b7){return new Promise(function(_0x4bcec7,_0x378117){if(!_0x46e6b7)return _0x4bcec7(null);var _0x5eb7a8=_0x46e6b7[_0x44ca('0x3')]?{[_0x46e6b7[_0x44ca('0x3')][_0x44ca('0x4')]]:_0x46e6b7['filter'][_0x44ca('0x5')]}:undefined;return _0x3737c5[_0x755c3b]['findAll']({'where':_0x5eb7a8,'raw':!![]})[_0x44ca('0x6')](function(_0x1cc929){_0x46e6b7[_0x44ca('0x7')]=_[_0x44ca('0x8')](_0x1cc929,'id');_0x4bcec7(_0x46e6b7);})[_0x44ca('0x9')](function(_0x1a2a80){_0x378117(_0x1a2a80);});});}function _0x1cff24(_0x28fafd,_0x2923e1){return new Promise(function(_0x1c8e89,_0x3978bf){var _0x4a66d2=_0x28fafd['filter']?{[_0x28fafd[_0x44ca('0x3')]['field']]:_0x28fafd[_0x44ca('0x3')][_0x44ca('0x5')]}:undefined;return _0x3737c5[_0x28fafd[_0x44ca('0xa')]][_0x44ca('0xb')]({'where':_0x4a66d2,'raw':!![]})['then'](function(_0x1e5a66){_0x2923e1[_0x44ca('0x7')]=_[_0x44ca('0x8')](_0x1e5a66,function(_0x280909){return _0x280909['name'];});_0x1c8e89(_0x2923e1);})['catch'](function(_0x5123f5){_0x3978bf(_0x5123f5);});});}function _0x139947(_0x268138,_0x20ae4c,_0x36b735){if(!_0x20ae4c)return Promise[_0x44ca('0xc')](null);return new Promise(function(_0x5b33b3,_0x3cd9fc){return _0x3737c5[_0x44ca('0xd')][_0x44ca('0xb')]({'where':{'sectionId':_0x20ae4c['id']},'raw':!![]})[_0x44ca('0x6')](function(_0x4216b7){if(_0x268138['field']&&_0x268138['field']!=='id'){_0x20ae4c['associatedResources']=_['map'](_0x4216b7,function(_0x3b2161){return _0x3b2161[_0x268138[_0x44ca('0x4')]];});}else{if(_0x36b735===_0x44ca('0xe')){_0x20ae4c[_0x44ca('0x7')]=_[_0x44ca('0x8')](_0x4216b7,function(_0x21619d){return{'id':_0x21619d['resourceId'],'type':_0x21619d[_0x44ca('0xf')]};});}else{_0x20ae4c[_0x44ca('0x7')]=_['map'](_0x4216b7,function(_0x1d6544){return _0x1d6544[_0x44ca('0x10')];});}}_0x5b33b3(_0x20ae4c);})[_0x44ca('0x9')](function(_0x2ee2af){_0x3cd9fc(_0x2ee2af);});});}function _0x2118ef(_0x85c8ad,_0x1209ac){var _0x190060={'parentSections':[]};switch(_0x85c8ad['toLowerCase']()){case _0x44ca('0x11'):_0x190060['childModel']=_0x44ca('0x12');break;case'odbc':_0x190060['childModel']=_0x44ca('0x13');break;case _0x44ca('0x14'):_0x190060['childModel']='SquareRecording';_0x190060[_0x44ca('0x15')]=[{'name':_0x44ca('0x16'),'field':_0x44ca('0x17'),'foreignKey':_0x44ca('0x18')}];break;case _0x44ca('0x19'):_0x190060['childModel']=_0x44ca('0x1a');break;case _0x44ca('0x1b'):_0x190060[_0x44ca('0x1c')]='CmContact';_0x190060[_0x44ca('0x15')]=[{'name':_0x44ca('0x1d'),'field':'id','foreignKey':_0x44ca('0x1e')}];break;case _0x44ca('0x1f'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x20');break;case'companies':_0x190060['childModel']=_0x44ca('0x21');break;case _0x44ca('0x22'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x23');break;case'chatqueues':_0x190060[_0x44ca('0x1c')]=_0x44ca('0x24');break;case'chatwebsites':_0x190060[_0x44ca('0x1c')]='ChatWebsite';break;case'faxqueues':_0x190060[_0x44ca('0x1c')]=_0x44ca('0x25');break;case'faxaccounts':_0x190060['childModel']='FaxAccount';break;case'inboundroutes':case _0x44ca('0x26'):case _0x44ca('0x27'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x28');break;case _0x44ca('0x29'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x2a');break;case _0x44ca('0x2b'):_0x190060['childModel']='VoiceMail';break;case _0x44ca('0x2c'):_0x190060['childModel']='VoiceRecording';_0x190060[_0x44ca('0x15')]=[{'name':_0x44ca('0x2d'),'field':_0x44ca('0x17'),'foreignKey':'membername','model':_0x44ca('0x2e'),'filter':{'field':_0x44ca('0x2f'),'value':[_0x44ca('0x30')]}},{'name':'Telephones','field':_0x44ca('0x17'),'foreignKey':_0x44ca('0x31'),'model':_0x44ca('0x2e'),'filter':{'field':_0x44ca('0x2f'),'value':[_0x44ca('0x32')]}},{'name':'VoiceQueues','field':_0x44ca('0x17'),'foreignKey':_0x44ca('0x33'),'model':_0x44ca('0x34'),'filter':{'field':'type','value':[_0x44ca('0x35')]}},{'name':_0x44ca('0x36'),'field':_0x44ca('0x17'),'foreignKey':_0x44ca('0x33'),'model':_0x44ca('0x34'),'filter':{'field':_0x44ca('0xf'),'value':[_0x44ca('0x37')]}}];break;case'musiconholds':_0x190060[_0x44ca('0x1c')]=_0x44ca('0x38');break;case'chanspies':_0x190060[_0x44ca('0x1c')]=_0x44ca('0x39');break;case _0x44ca('0x3a'):_0x190060[_0x44ca('0x1c')]='VoicePrefix';break;case _0x44ca('0x3b'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x3c');break;case'mailqueues':_0x190060['childModel']=_0x44ca('0x3d');break;case _0x44ca('0x3e'):_0x190060['childModel']='MailAccount';break;case _0x44ca('0x3f'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x40');break;case _0x44ca('0x41'):_0x190060[_0x44ca('0x1c')]='OpenchannelQueue';break;case'openchannelaccounts':_0x190060['childModel']='OpenchannelAccount';break;case _0x44ca('0x42'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x43');break;case _0x44ca('0x44'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x45');break;case'whatsappqueues':_0x190060['childModel']=_0x44ca('0x46');break;case _0x44ca('0x47'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x48');break;case _0x44ca('0x49'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x4a');break;case _0x44ca('0x4b'):case _0x44ca('0x4c'):_0x190060['childModel']='VoiceQueue';if(_0x1209ac){_0x190060[_0x44ca('0x15')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x44ca('0x4d'):case _0x44ca('0x4e'):case _0x44ca('0x4f'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x2e');if(_0x1209ac){_0x190060[_0x44ca('0x15')]=[{'name':'Users','filter':{'field':'role','value':[_0x44ca('0x50'),'user']},'ignore':!![]},{'name':_0x44ca('0x2d')},{'name':_0x44ca('0x51')}];}break;case _0x44ca('0x52'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x53');break;case _0x44ca('0x54'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x55');break;case _0x44ca('0x56'):_0x190060['childModel']=_0x44ca('0x57');break;case _0x44ca('0x58'):_0x190060[_0x44ca('0x1c')]='SugarcrmAccount';break;case _0x44ca('0x59'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x5a');break;case'zohoaccounts':_0x190060[_0x44ca('0x1c')]=_0x44ca('0x5b');break;case _0x44ca('0x5c'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x2e');break;case _0x44ca('0x5d'):_0x190060['childModel']='CannedAnswer';break;case _0x44ca('0x5e'):_0x190060[_0x44ca('0x1c')]='Disposition';break;case _0x44ca('0x5f'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x60');break;case _0x44ca('0x61'):_0x190060['childModel']=_0x44ca('0x62');break;case _0x44ca('0x63'):_0x190060[_0x44ca('0x1c')]='Pause';break;case _0x44ca('0x64'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x65');break;case _0x44ca('0x66'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x67');break;case _0x44ca('0x68'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x69');break;case _0x44ca('0x6a'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x6b');break;case _0x44ca('0x6c'):_0x190060['childModel']='Trigger';break;case _0x44ca('0x6d'):_0x190060[_0x44ca('0x1c')]=_0x44ca('0x6e');break;case _0x44ca('0x6f'):_0x190060['childModel']=_0x44ca('0x70');break;case _0x44ca('0x71'):_0x190060[_0x44ca('0x1c')]='Plugin';break;case _0x44ca('0x72'):_0x190060['childModel']=_0x44ca('0xe');_0x190060[_0x44ca('0x15')]=[{'name':_0x44ca('0x73'),'field':'id','foreignKey':_0x44ca('0x74')}];break;case _0x44ca('0x75'):_0x190060[_0x44ca('0x1c')]='AnalyticMetric';break;}return _0x190060;}function _0x1b49db(_0xe529a6,_0x798eb){var _0xe08dc8=_0xe529a6['charAt'](0x0)[_0x44ca('0x76')]()+_0xe529a6[_0x44ca('0x77')](0x1);var _0xf1f0bc={'type':_0x3737c5['Sequelize'][_0x44ca('0x78')][_0x44ca('0x79')],'raw':!![]};return new Promise(function(_0x291720,_0x51d82f){var _0x556996=squel[_0x44ca('0x7a')]()[_0x44ca('0x4')](_0x44ca('0x7b')+_0xe08dc8+'InteractionId','id')[_0x44ca('0x4')](_0x44ca('0x7c'))[_0x44ca('0x7d')]('user_has_'+_0xe529a6+_0x44ca('0x7e'),'ui')[_0x44ca('0x7f')]('ui.UserId\x20=\x20?',_0x798eb['id']);return _0x3737c5[_0x44ca('0x80')]['query'](_0x556996[_0x44ca('0x81')](),_0xf1f0bc)[_0x44ca('0x6')](function(_0x432895){_0x798eb[_0xe08dc8+_0x44ca('0x82')]=_0x432895;_0x291720(_0x432895);})[_0x44ca('0x9')](function(_0xe51d15){_0x51d82f(_0xe51d15);});});}return _0x43cbaa[_0x44ca('0x83')](_0x44ca('0x84'),attributes,{'tableName':_0x44ca('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x174a1d){var _0xab2fc1=require('../../components/parsers/qs');var _0xac705={'raw':_0x174a1d['query'][_0x44ca('0x86')],'where':{}};var _0xf4b177={};var _0x1b4bf={'count':0x0,'rows':[]};var _0x3499e3=_0x174a1d[_0x44ca('0x87')][_0x44ca('0x88')];var _0x592628=_0x174a1d['query'][_0x44ca('0x89')]||![];var _0x59c7d3=_0x2118ef(_0x3499e3,_0x592628);if(!_0x59c7d3[_0x44ca('0x1c')])throw new Error(_0x44ca('0x8a')+_0x3499e3+'\x27');var _0x520f44=[{'name':_0x3499e3}];if(!_[_0x44ca('0x8b')](_0x59c7d3['parentSections']))_0x520f44=_0x59c7d3[_0x44ca('0x15')];var _0x5436e1=[];for(var _0x546bb7=0x0;_0x546bb7<_0x520f44['length'];_0x546bb7++){_0x5436e1[_0x44ca('0x8c')](_0x3737c5[_0x44ca('0x8d')][_0x44ca('0x8e')]({'where':{'userProfileId':_0x174a1d[_0x44ca('0x8f')]['id'],'name':_0x520f44[_0x546bb7][_0x44ca('0x17')]},'raw':!![]}));}return Promise[_0x44ca('0x90')](_0x5436e1)[_0x44ca('0x6')](function(_0xf4c885){var _0x31d618=_[_0x44ca('0x3')](_0xf4c885,function(_0x27a1f9){return _0x27a1f9?_0x27a1f9:undefined;});var _0x4eef4f=_[_0x44ca('0x3')](_0x520f44,[_0x44ca('0x91'),!![]]);var _0x51d7ff=_[_0x44ca('0x8b')](_0x31d618)&&_['isEmpty'](_0x4eef4f)?null:_[_0x44ca('0x92')](_0x4eef4f,_0x31d618);if(!_0x51d7ff)return null;var _0x4e5a8c=[];for(var _0x2a9b67=0x0;_0x2a9b67<_0x51d7ff[_0x44ca('0x93')];_0x2a9b67++){var _0x2f1f96=_[_0x44ca('0x8e')](_0x520f44,function(_0x2576f0){return _0x51d7ff[_0x2a9b67]?_0x2576f0[_0x44ca('0x17')]===_0x51d7ff[_0x2a9b67]['name']:null;});if(_0x2f1f96){if(_0x51d7ff[_0x2a9b67][_0x44ca('0x91')]){_0x4e5a8c[_0x44ca('0x8c')](_0x5e55bc(_0x59c7d3[_0x44ca('0x1c')],_0x51d7ff[_0x2a9b67]));}else{if(!_0x51d7ff[_0x2a9b67]['autoAssociation']){_0x4e5a8c[_0x44ca('0x8c')](_0x139947(_0x2f1f96,_0x51d7ff[_0x2a9b67],_0x59c7d3[_0x44ca('0x1c')]));}else{if(_0x2f1f96[_0x44ca('0xa')]){_0x4e5a8c[_0x44ca('0x8c')](_0x1cff24(_0x2f1f96,_0x51d7ff[_0x2a9b67]));}}}}}return Promise[_0x44ca('0x90')](_0x4e5a8c);})['then'](function(_0x2f0201){var _0x206af0=_0x2f0201;var _0x5c8b50=null;if(_0x206af0){_0x5c8b50=_0x206af0[_0x44ca('0x93')]===0x1?_0x206af0[0x0]:null;}if(!_0x5c8b50&&!_0x206af0)return _0x1b4bf;var _0x4d9d98=_0x3737c5[_0x59c7d3[_0x44ca('0x1c')]][_0x44ca('0x94')];_0xf4b177['model']=_[_0x44ca('0x95')](_0x4d9d98);_0xf4b177['query']=_[_0x44ca('0x95')](_0x174a1d[_0x44ca('0x87')]);_0xf4b177[_0x44ca('0x96')]=_[_0x44ca('0x97')](_0xf4b177[_0x44ca('0xa')],_0xf4b177[_0x44ca('0x87')]);_0xac705[_0x44ca('0x98')]=_['intersection'](_0xf4b177[_0x44ca('0xa')],_0xab2fc1['fields'](_0x174a1d[_0x44ca('0x87')][_0x44ca('0x99')]));_0xac705[_0x44ca('0x98')]=_0xac705['attributes'][_0x44ca('0x93')]?_0xac705[_0x44ca('0x98')]:_0xf4b177[_0x44ca('0xa')];if(!_0x174a1d[_0x44ca('0x87')]['hasOwnProperty'](_0x44ca('0x9a'))){_0xac705[_0x44ca('0x9b')]=_0xab2fc1[_0x44ca('0x9b')](_0x174a1d[_0x44ca('0x87')][_0x44ca('0x9b')]);_0xac705[_0x44ca('0x9c')]=_0xab2fc1[_0x44ca('0x9c')](_0x174a1d[_0x44ca('0x87')][_0x44ca('0x9c')]);}_0xac705[_0x44ca('0x9d')]=_0xab2fc1[_0x44ca('0x9e')](_0x174a1d[_0x44ca('0x87')][_0x44ca('0x9e')]);_0xac705[_0x44ca('0x7f')]=_0xab2fc1['filters'](_[_0x44ca('0x9f')](_0x174a1d['query'],_0xf4b177[_0x44ca('0x96')]));if(_0x174a1d['query'][_0x44ca('0x3')]){_0xac705['where']=_[_0x44ca('0xa0')](_0xac705[_0x44ca('0x7f')],{'$or':_['map'](_0x4d9d98,function(_0x14ea31){if(_0x14ea31[_0x44ca('0xf')][_0x44ca('0xa1')]!==_0x44ca('0xa2')){var _0x25ba10={};_0x25ba10[_0x14ea31[_0x44ca('0x4')]]={'$like':'%'+_0x174a1d[_0x44ca('0x87')]['filter']+'%'};return _0x25ba10;}})});}var _0x5ea42d=[];var _0x3e2d62=null;var _0x23f90d={};if(_0x5c8b50){_0x3e2d62=_[_0x44ca('0x8e')](_0x520f44,[_0x44ca('0x17'),_0x5c8b50[_0x44ca('0x17')]]);if(_0x3e2d62[_0x44ca('0x4')]){_0x23f90d={};if(_0x59c7d3[_0x44ca('0x1c')]==='AnalyticExtractedReport'){_0x23f90d[_0x3e2d62[_0x44ca('0xa3')]]=_[_0x44ca('0x8')](_0x5c8b50[_0x44ca('0x7')],'id');}else{_0x23f90d[_0x3e2d62[_0x44ca('0xa3')]]=_0x5c8b50[_0x44ca('0x7')];}_0x5ea42d['push'](_0x23f90d);}else{_0xac705[_0x44ca('0x7f')]['id']=_0x5c8b50[_0x44ca('0x7')];}}else{for(var _0x231c2d=0x0;_0x231c2d<_0x206af0[_0x44ca('0x93')];_0x231c2d++){_0x3e2d62=_[_0x44ca('0x8e')](_0x520f44,['name',_0x206af0[_0x231c2d][_0x44ca('0x17')]]);if(_0x3e2d62[_0x44ca('0x4')]){_0x23f90d={};_0x23f90d[_0x3e2d62[_0x44ca('0xa3')]]=_0x206af0[_0x231c2d][_0x44ca('0x7')];_0x5ea42d['push'](_0x23f90d);}else{if(!_0xac705[_0x44ca('0x7f')]['id'])_0xac705[_0x44ca('0x7f')]['id']=[];_0x206af0[_0x231c2d][_0x44ca('0x7')][_0x44ca('0xa4')](function(_0x3025f4){_0xac705[_0x44ca('0x7f')]['id']['push'](_0x3025f4);});}}}if(!_[_0x44ca('0x8b')](_0x5ea42d)){_0xac705[_0x44ca('0x7f')]=_[_0x44ca('0xa0')](_0xac705[_0x44ca('0x7f')],{'$and':{'$or':_0x5ea42d}});}_0xac705=_[_0x44ca('0xa0')]({},_0xac705,_0x174a1d[_0x44ca('0xa5')]);if(_0x5c8b50&&!_0x5c8b50[_0x44ca('0xa6')]&&_0x59c7d3['childModel']==='AnalyticExtractedReport'){if(_0x174a1d['query']['includeAll']){_0xac705[_0x44ca('0xa7')]=[{'all':!![]}];}return _0x3737c5[_0x59c7d3[_0x44ca('0x1c')]][_0x44ca('0xb')](_0xac705)[_0x44ca('0x6')](function(_0x14e3f7){var _0x55a2f6=[];_0x14e3f7[_0x44ca('0xa4')](function(_0x1efe3d){var _0x17be2f;switch(_0x1efe3d['reportType']){case _0x44ca('0xa8'):_0x17be2f=_[_0x44ca('0x8e')](_0x5c8b50[_0x44ca('0x7')],function(_0x5589d8){return _0x5589d8['id']===_0x1efe3d['reportId']&&_0x5589d8[_0x44ca('0xf')]==='DefaultReports';});break;case _0x44ca('0xa9'):_0x17be2f=_['find'](_0x5c8b50[_0x44ca('0x7')],function(_0x450a16){return _0x450a16['id']===_0x1efe3d['reportId']&&_0x450a16[_0x44ca('0xf')]==='CustomReports';});break;}if(_0x17be2f)_0x55a2f6[_0x44ca('0x8c')](_0x1efe3d);});_0x1b4bf['count']=_0x55a2f6[_0x44ca('0x93')];_0x1b4bf['rows']=_0x55a2f6;return _0x1b4bf;});}else{if(!_[_0x44ca('0x8b')](_0x174a1d['query'][_0x44ca('0xaa')])){_0xac705[_0x44ca('0x7f')]['id']=_0xac705['where']['id']?_['intersection'](_0xac705['where']['id'],_0x174a1d[_0x44ca('0x87')][_0x44ca('0xaa')]):_0x174a1d[_0x44ca('0x87')][_0x44ca('0xaa')];if(_0x174a1d[_0x44ca('0x87')][_0x44ca('0xab')]){_0xac705[_0x44ca('0x9d')]=_0x174a1d[_0x44ca('0x87')]['customSorting'];}}if(_0x174a1d['query']['extraQueryConditions']){_0xac705['where']=_[_0x44ca('0xa0')](_0xac705['where'],{'$and':_0x174a1d[_0x44ca('0x87')][_0x44ca('0xac')]});}return _0x3737c5[_0x59c7d3[_0x44ca('0x1c')]]['count']({'where':_0xac705['where']})[_0x44ca('0x6')](function(_0x187cb7){_0x1b4bf[_0x44ca('0xad')]=_0x187cb7;if(_0x174a1d[_0x44ca('0x87')][_0x44ca('0xae')]){if(_0x59c7d3[_0x44ca('0x1c')]===_0x44ca('0xaf')){_0xac705[_0x44ca('0xa7')]=[{'model':_0x3737c5[_0x44ca('0x69')],'as':'Tags','attributes':['id','name',_0x44ca('0xb0')],'required':_0x174a1d[_0x44ca('0x87')][_0x44ca('0xb1')]?!![]:![]},{'model':_0x3737c5[_0x44ca('0x69')],'as':_0x44ca('0xb2'),'attributes':['id',_0x44ca('0x17'),_0x44ca('0xb0')],'through':_0x174a1d[_0x44ca('0x87')][_0x44ca('0xb1')]?{'attributes':[],'where':{'TagId':_0x174a1d[_0x44ca('0x87')][_0x44ca('0xb1')]||undefined}}:{},'required':_0x174a1d[_0x44ca('0x87')][_0x44ca('0xb1')]?!![]:![]}];}else{_0xac705[_0x44ca('0xa7')]=[{'all':!![]}];}}return _0x3737c5[_0x59c7d3[_0x44ca('0x1c')]]['findAll'](_0xac705);})[_0x44ca('0x6')](function(_0x5b85d4){_0x1b4bf[_0x44ca('0xb3')]=_0x5b85d4;if(_0x3499e3===_0x44ca('0x2d')&&_0x174a1d[_0x44ca('0x87')][_0x44ca('0xb4')]===_0x44ca('0xb5')){var _0x610083=[];for(var _0x4801da=0x0;_0x4801da<_0x1b4bf['rows'][_0x44ca('0x93')];_0x4801da++){_0x610083['push'](_0x1b49db(_0x44ca('0xb6'),_0x1b4bf[_0x44ca('0xb3')][_0x4801da][_0x44ca('0xb7')]));_0x610083['push'](_0x1b49db(_0x44ca('0xb8'),_0x1b4bf[_0x44ca('0xb3')][_0x4801da]['dataValues']));_0x610083[_0x44ca('0x8c')](_0x1b49db(_0x44ca('0xb9'),_0x1b4bf['rows'][_0x4801da][_0x44ca('0xb7')]));_0x610083[_0x44ca('0x8c')](_0x1b49db(_0x44ca('0xba'),_0x1b4bf[_0x44ca('0xb3')][_0x4801da][_0x44ca('0xb7')]));_0x610083[_0x44ca('0x8c')](_0x1b49db('openchannel',_0x1b4bf[_0x44ca('0xb3')][_0x4801da]['dataValues']));_0x610083[_0x44ca('0x8c')](_0x1b49db(_0x44ca('0xbb'),_0x1b4bf[_0x44ca('0xb3')][_0x4801da][_0x44ca('0xb7')]));}return Promise[_0x44ca('0x90')](_0x610083)['then'](function(){return _0x1b4bf;});}return _0x1b4bf;});}});}}});}; \ No newline at end of file +var _0xc3af=['CmList','CmCompany','globalcustomfields','chatqueues','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','telephone','queue','VoiceQueue','inbound','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','mailaccounts','MailAccount','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','VoiceQueues','QueueCampaigns','users','agents','Users','user','Agents','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','trunks','variables','Variable','plugins','extractedreports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','user_profiles','../../components/parsers/qs','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','model','keys','filters','attributes','intersection','fields','nolimit','limit','offset','order','sort','pick','where','key','VIRTUAL','foreignKey','merge','options','includeAll','include','forEach','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','true','chat','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','models','filter','field','value','findAll','map','catch','then','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','childModel','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','contacts','CmContact','Lists','lists'];(function(_0x1f60c4,_0x1c58e5){var _0x4d3340=function(_0x335584){while(--_0x335584){_0x1f60c4['push'](_0x1f60c4['shift']());}};_0x4d3340(++_0x1c58e5);}(_0xc3af,0x15b));var _0xfc3a=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0xc3af[_0x21353c];return _0xa99120;};'use strict';var _=require(_0xfc3a('0x0'));var attributes=require(_0xfc3a('0x1'));var squel=require('squel');module['exports']=function(_0x12709e){var _0x309a4f=_0x12709e[_0xfc3a('0x2')];function _0x5265e0(_0x1804fb,_0x1b72d0){return new Promise(function(_0x225140,_0x249e0c){if(!_0x1b72d0)return _0x225140(null);var _0x4224b4=_0x1b72d0[_0xfc3a('0x3')]?{[_0x1b72d0[_0xfc3a('0x3')][_0xfc3a('0x4')]]:_0x1b72d0[_0xfc3a('0x3')][_0xfc3a('0x5')]}:undefined;return _0x309a4f[_0x1804fb][_0xfc3a('0x6')]({'where':_0x4224b4,'raw':!![]})['then'](function(_0x134586){_0x1b72d0['associatedResources']=_[_0xfc3a('0x7')](_0x134586,'id');_0x225140(_0x1b72d0);})[_0xfc3a('0x8')](function(_0x22e15b){_0x249e0c(_0x22e15b);});});}function _0x3f2c41(_0x2035e9,_0x34375b){return new Promise(function(_0x23ffb7,_0x584a6c){var _0x1c7d88=_0x2035e9[_0xfc3a('0x3')]?{[_0x2035e9[_0xfc3a('0x3')][_0xfc3a('0x4')]]:_0x2035e9[_0xfc3a('0x3')][_0xfc3a('0x5')]}:undefined;return _0x309a4f[_0x2035e9['model']][_0xfc3a('0x6')]({'where':_0x1c7d88,'raw':!![]})[_0xfc3a('0x9')](function(_0x16f23d){_0x34375b[_0xfc3a('0xa')]=_['map'](_0x16f23d,function(_0x506e03){return _0x506e03[_0xfc3a('0xb')];});_0x23ffb7(_0x34375b);})[_0xfc3a('0x8')](function(_0x125fb8){_0x584a6c(_0x125fb8);});});}function _0x559987(_0x10a3a0,_0x432299,_0x30b5e6){if(!_0x432299)return Promise[_0xfc3a('0xc')](null);return new Promise(function(_0x520105,_0x515a03){return _0x309a4f[_0xfc3a('0xd')][_0xfc3a('0x6')]({'where':{'sectionId':_0x432299['id']},'raw':!![]})[_0xfc3a('0x9')](function(_0x528c57){if(_0x10a3a0[_0xfc3a('0x4')]&&_0x10a3a0[_0xfc3a('0x4')]!=='id'){_0x432299[_0xfc3a('0xa')]=_['map'](_0x528c57,function(_0x3bd023){return _0x3bd023[_0x10a3a0[_0xfc3a('0x4')]];});}else{if(_0x30b5e6===_0xfc3a('0xe')){_0x432299['associatedResources']=_[_0xfc3a('0x7')](_0x528c57,function(_0x20aa17){return{'id':_0x20aa17[_0xfc3a('0xf')],'type':_0x20aa17[_0xfc3a('0x10')]};});}else{_0x432299[_0xfc3a('0xa')]=_[_0xfc3a('0x7')](_0x528c57,function(_0x486434){return _0x486434[_0xfc3a('0xf')];});}}_0x520105(_0x432299);})[_0xfc3a('0x8')](function(_0x43cf4a){_0x515a03(_0x43cf4a);});});}function _0x4dea7d(_0x44b270,_0xf898d5){var _0x54ee6a={'parentSections':[]};switch(_0x44b270[_0xfc3a('0x11')]()){case _0xfc3a('0x12'):_0x54ee6a['childModel']=_0xfc3a('0x13');break;case _0xfc3a('0x14'):_0x54ee6a['childModel']=_0xfc3a('0x15');break;case _0xfc3a('0x16'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x18');_0x54ee6a[_0xfc3a('0x19')]=[{'name':_0xfc3a('0x1a'),'field':_0xfc3a('0xb'),'foreignKey':'projectName'}];break;case _0xfc3a('0x1b'):_0x54ee6a['childModel']=_0xfc3a('0x1c');break;case _0xfc3a('0x1d'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x1e');_0x54ee6a[_0xfc3a('0x19')]=[{'name':_0xfc3a('0x1f'),'field':'id','foreignKey':'ListId'}];break;case _0xfc3a('0x20'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x21');break;case'companies':_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x22');break;case _0xfc3a('0x23'):_0x54ee6a['childModel']='CmCustomField';break;case _0xfc3a('0x24'):_0x54ee6a[_0xfc3a('0x17')]='ChatQueue';break;case _0xfc3a('0x25'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x26');break;case'faxqueues':_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x27');break;case _0xfc3a('0x28'):_0x54ee6a[_0xfc3a('0x17')]='FaxAccount';break;case _0xfc3a('0x29'):case _0xfc3a('0x2a'):case _0xfc3a('0x2b'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x2c');break;case _0xfc3a('0x2d'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x2e');break;case _0xfc3a('0x2f'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x30');break;case _0xfc3a('0x31'):_0x54ee6a['childModel']=_0xfc3a('0x32');_0x54ee6a[_0xfc3a('0x19')]=[{'name':'Agents','field':_0xfc3a('0xb'),'foreignKey':_0xfc3a('0x33'),'model':_0xfc3a('0x34'),'filter':{'field':_0xfc3a('0x35'),'value':[_0xfc3a('0x36')]}},{'name':_0xfc3a('0x37'),'field':_0xfc3a('0xb'),'foreignKey':_0xfc3a('0x33'),'model':_0xfc3a('0x34'),'filter':{'field':_0xfc3a('0x35'),'value':[_0xfc3a('0x38')]}},{'name':'VoiceQueues','field':_0xfc3a('0xb'),'foreignKey':_0xfc3a('0x39'),'model':_0xfc3a('0x3a'),'filter':{'field':_0xfc3a('0x10'),'value':[_0xfc3a('0x3b')]}},{'name':'QueueCampaigns','field':_0xfc3a('0xb'),'foreignKey':_0xfc3a('0x39'),'model':_0xfc3a('0x3a'),'filter':{'field':_0xfc3a('0x10'),'value':[_0xfc3a('0x3c')]}}];break;case'musiconholds':_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x3d');break;case _0xfc3a('0x3e'):_0x54ee6a['childModel']=_0xfc3a('0x3f');break;case _0xfc3a('0x40'):_0x54ee6a[_0xfc3a('0x17')]='VoicePrefix';break;case'ivrcampaigns':_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x41');break;case _0xfc3a('0x42'):_0x54ee6a[_0xfc3a('0x17')]='MailQueue';break;case _0xfc3a('0x43'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x44');break;case'mailsubstatuses':_0x54ee6a[_0xfc3a('0x17')]='MailSubstatus';break;case'openchannelqueues':_0x54ee6a['childModel']=_0xfc3a('0x45');break;case'openchannelaccounts':_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x46');break;case _0xfc3a('0x47'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x48');break;case _0xfc3a('0x49'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x4a');break;case _0xfc3a('0x4b'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x4c');break;case _0xfc3a('0x4d'):_0x54ee6a[_0xfc3a('0x17')]='WhatsappAccount';break;case _0xfc3a('0x4e'):_0x54ee6a[_0xfc3a('0x17')]='Team';break;case'voicequeues':case'queuecampaigns':_0x54ee6a[_0xfc3a('0x17')]='VoiceQueue';if(_0xf898d5){_0x54ee6a['parentSections']=[{'name':_0xfc3a('0x4f')},{'name':_0xfc3a('0x50')}];}break;case _0xfc3a('0x51'):case _0xfc3a('0x52'):case'telephones':_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x34');if(_0xf898d5){_0x54ee6a['parentSections']=[{'name':_0xfc3a('0x53'),'filter':{'field':_0xfc3a('0x35'),'value':['admin',_0xfc3a('0x54')]},'ignore':!![]},{'name':_0xfc3a('0x55')},{'name':_0xfc3a('0x37')}];}break;case _0xfc3a('0x56'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x57');break;case'salesforceaccounts':_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x58');break;case _0xfc3a('0x59'):_0x54ee6a['childModel']=_0xfc3a('0x5a');break;case _0xfc3a('0x5b'):_0x54ee6a[_0xfc3a('0x17')]='SugarcrmAccount';break;case _0xfc3a('0x5c'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x5d');break;case _0xfc3a('0x5e'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x5f');break;case _0xfc3a('0x60'):_0x54ee6a['childModel']=_0xfc3a('0x34');break;case _0xfc3a('0x61'):_0x54ee6a[_0xfc3a('0x17')]='CannedAnswer';break;case _0xfc3a('0x62'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x63');break;case _0xfc3a('0x64'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x65');break;case _0xfc3a('0x66'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x67');break;case _0xfc3a('0x68'):_0x54ee6a[_0xfc3a('0x17')]='Pause';break;case _0xfc3a('0x69'):_0x54ee6a['childModel']=_0xfc3a('0x6a');break;case _0xfc3a('0x6b'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x6c');break;case _0xfc3a('0x6d'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x6e');break;case _0xfc3a('0x6f'):_0x54ee6a['childModel']=_0xfc3a('0x70');break;case _0xfc3a('0x71'):_0x54ee6a['childModel']='Trigger';break;case _0xfc3a('0x72'):_0x54ee6a[_0xfc3a('0x17')]='Trunk';break;case _0xfc3a('0x73'):_0x54ee6a[_0xfc3a('0x17')]=_0xfc3a('0x74');break;case _0xfc3a('0x75'):_0x54ee6a[_0xfc3a('0x17')]='Plugin';break;case _0xfc3a('0x76'):_0x54ee6a['childModel']='AnalyticExtractedReport';_0x54ee6a['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0xfc3a('0x77')}];break;case _0xfc3a('0x78'):_0x54ee6a['childModel']=_0xfc3a('0x79');break;}return _0x54ee6a;}function _0x31457d(_0x5d0f4d,_0x5324d9){var _0xaa0879=_0x5d0f4d[_0xfc3a('0x7a')](0x0)[_0xfc3a('0x7b')]()+_0x5d0f4d[_0xfc3a('0x7c')](0x1);var _0x5a556c={'type':_0x309a4f['Sequelize'][_0xfc3a('0x7d')][_0xfc3a('0x7e')],'raw':!![]};return new Promise(function(_0x4a7dc7,_0x2a20e9){var _0x7a62f7=squel[_0xfc3a('0x7f')]()['field'](_0xfc3a('0x80')+_0xaa0879+_0xfc3a('0x81'),'id')[_0xfc3a('0x4')](_0xfc3a('0x82'))[_0xfc3a('0x83')]('user_has_'+_0x5d0f4d+'_interactions','ui')['where'](_0xfc3a('0x84'),_0x5324d9['id']);return _0x309a4f['sequelize'][_0xfc3a('0x85')](_0x7a62f7[_0xfc3a('0x86')](),_0x5a556c)[_0xfc3a('0x9')](function(_0x2feff8){_0x5324d9[_0xaa0879+_0xfc3a('0x87')]=_0x2feff8;_0x4a7dc7(_0x2feff8);})[_0xfc3a('0x8')](function(_0x2f6c1b){_0x2a20e9(_0x2f6c1b);});});}return _0x12709e[_0xfc3a('0x88')]('UserProfile',attributes,{'tableName':_0xfc3a('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x25bc63){var _0x195c36=require(_0xfc3a('0x8a'));var _0x3dad92={'raw':_0x25bc63['query']['raw'],'where':{}};var _0x567752={};var _0xd455a3={'count':0x0,'rows':[]};var _0x17d39f=_0x25bc63['query'][_0xfc3a('0x8b')];var _0x5c7e09=_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0x8c')]||![];var _0x359976=_0x4dea7d(_0x17d39f,_0x5c7e09);if(!_0x359976[_0xfc3a('0x17')])throw new Error(_0xfc3a('0x8d')+_0x17d39f+'\x27');var _0x6f9721=[{'name':_0x17d39f}];if(!_[_0xfc3a('0x8e')](_0x359976[_0xfc3a('0x19')]))_0x6f9721=_0x359976[_0xfc3a('0x19')];var _0x54c9fd=[];for(var _0xe0d09c=0x0;_0xe0d09c<_0x6f9721[_0xfc3a('0x8f')];_0xe0d09c++){_0x54c9fd[_0xfc3a('0x90')](_0x309a4f[_0xfc3a('0x91')][_0xfc3a('0x92')]({'where':{'userProfileId':_0x25bc63[_0xfc3a('0x93')]['id'],'name':_0x6f9721[_0xe0d09c]['name']},'raw':!![]}));}return Promise[_0xfc3a('0x94')](_0x54c9fd)['then'](function(_0x567e48){var _0x105949=_['filter'](_0x567e48,function(_0x365533){return _0x365533?_0x365533:undefined;});var _0x50382e=_[_0xfc3a('0x3')](_0x6f9721,[_0xfc3a('0x95'),!![]]);var _0x3b8010=_['isEmpty'](_0x105949)&&_[_0xfc3a('0x8e')](_0x50382e)?null:_[_0xfc3a('0x96')](_0x50382e,_0x105949);if(!_0x3b8010)return null;var _0x4cb9a9=[];for(var _0x1fdb09=0x0;_0x1fdb09<_0x3b8010[_0xfc3a('0x8f')];_0x1fdb09++){var _0x2d0220=_[_0xfc3a('0x92')](_0x6f9721,function(_0xb55d77){return _0x3b8010[_0x1fdb09]?_0xb55d77[_0xfc3a('0xb')]===_0x3b8010[_0x1fdb09]['name']:null;});if(_0x2d0220){if(_0x3b8010[_0x1fdb09][_0xfc3a('0x95')]){_0x4cb9a9[_0xfc3a('0x90')](_0x5265e0(_0x359976[_0xfc3a('0x17')],_0x3b8010[_0x1fdb09]));}else{if(!_0x3b8010[_0x1fdb09][_0xfc3a('0x97')]){_0x4cb9a9[_0xfc3a('0x90')](_0x559987(_0x2d0220,_0x3b8010[_0x1fdb09],_0x359976[_0xfc3a('0x17')]));}else{if(_0x2d0220[_0xfc3a('0x98')]){_0x4cb9a9[_0xfc3a('0x90')](_0x3f2c41(_0x2d0220,_0x3b8010[_0x1fdb09]));}}}}}return Promise['all'](_0x4cb9a9);})[_0xfc3a('0x9')](function(_0x3bb1a0){var _0x55400b=_0x3bb1a0;var _0x542c46=null;if(_0x55400b){_0x542c46=_0x55400b['length']===0x1?_0x55400b[0x0]:null;}if(!_0x542c46&&!_0x55400b)return _0xd455a3;var _0xdc36b3=_0x309a4f[_0x359976['childModel']]['rawAttributes'];_0x567752[_0xfc3a('0x98')]=_['keys'](_0xdc36b3);_0x567752['query']=_[_0xfc3a('0x99')](_0x25bc63[_0xfc3a('0x85')]);_0x567752[_0xfc3a('0x9a')]=_['intersection'](_0x567752[_0xfc3a('0x98')],_0x567752[_0xfc3a('0x85')]);_0x3dad92[_0xfc3a('0x9b')]=_[_0xfc3a('0x9c')](_0x567752[_0xfc3a('0x98')],_0x195c36[_0xfc3a('0x9d')](_0x25bc63['query'][_0xfc3a('0x9d')]));_0x3dad92['attributes']=_0x3dad92['attributes']['length']?_0x3dad92['attributes']:_0x567752['model'];if(!_0x25bc63[_0xfc3a('0x85')]['hasOwnProperty'](_0xfc3a('0x9e'))){_0x3dad92['limit']=_0x195c36[_0xfc3a('0x9f')](_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0x9f')]);_0x3dad92[_0xfc3a('0xa0')]=_0x195c36['offset'](_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0xa0')]);}_0x3dad92[_0xfc3a('0xa1')]=_0x195c36[_0xfc3a('0xa2')](_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0xa2')]);_0x3dad92['where']=_0x195c36[_0xfc3a('0x9a')](_[_0xfc3a('0xa3')](_0x25bc63[_0xfc3a('0x85')],_0x567752[_0xfc3a('0x9a')]));if(_0x25bc63[_0xfc3a('0x85')]['filter']){_0x3dad92[_0xfc3a('0xa4')]=_['merge'](_0x3dad92['where'],{'$or':_[_0xfc3a('0x7')](_0xdc36b3,function(_0x344c36){if(_0x344c36[_0xfc3a('0x10')][_0xfc3a('0xa5')]!==_0xfc3a('0xa6')){var _0x468514={};_0x468514[_0x344c36['field']]={'$like':'%'+_0x25bc63[_0xfc3a('0x85')]['filter']+'%'};return _0x468514;}})});}var _0x34d5ce=[];var _0x11ced7=null;var _0x1a1109={};if(_0x542c46){_0x11ced7=_[_0xfc3a('0x92')](_0x6f9721,[_0xfc3a('0xb'),_0x542c46[_0xfc3a('0xb')]]);if(_0x11ced7['field']){_0x1a1109={};if(_0x359976['childModel']===_0xfc3a('0xe')){_0x1a1109[_0x11ced7[_0xfc3a('0xa7')]]=_[_0xfc3a('0x7')](_0x542c46[_0xfc3a('0xa')],'id');}else{_0x1a1109[_0x11ced7['foreignKey']]=_0x542c46[_0xfc3a('0xa')];}_0x34d5ce['push'](_0x1a1109);}else{_0x3dad92[_0xfc3a('0xa4')]['id']=_0x542c46[_0xfc3a('0xa')];}}else{for(var _0x21e2d4=0x0;_0x21e2d4<_0x55400b['length'];_0x21e2d4++){_0x11ced7=_['find'](_0x6f9721,[_0xfc3a('0xb'),_0x55400b[_0x21e2d4][_0xfc3a('0xb')]]);if(_0x11ced7[_0xfc3a('0x4')]){_0x1a1109={};_0x1a1109[_0x11ced7[_0xfc3a('0xa7')]]=_0x55400b[_0x21e2d4][_0xfc3a('0xa')];_0x34d5ce[_0xfc3a('0x90')](_0x1a1109);}else{if(!_0x3dad92[_0xfc3a('0xa4')]['id'])_0x3dad92['where']['id']=[];_0x55400b[_0x21e2d4][_0xfc3a('0xa')]['forEach'](function(_0x8d4c2d){_0x3dad92[_0xfc3a('0xa4')]['id']['push'](_0x8d4c2d);});}}}if(!_[_0xfc3a('0x8e')](_0x34d5ce)){_0x3dad92[_0xfc3a('0xa4')]=_['merge'](_0x3dad92['where'],{'$and':{'$or':_0x34d5ce}});}_0x3dad92=_[_0xfc3a('0xa8')]({},_0x3dad92,_0x25bc63[_0xfc3a('0xa9')]);if(_0x542c46&&!_0x542c46[_0xfc3a('0x97')]&&_0x359976['childModel']===_0xfc3a('0xe')){if(_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0xaa')]){_0x3dad92[_0xfc3a('0xab')]=[{'all':!![]}];}return _0x309a4f[_0x359976[_0xfc3a('0x17')]][_0xfc3a('0x6')](_0x3dad92)['then'](function(_0x3f3adf){var _0x3ccad5=[];_0x3f3adf[_0xfc3a('0xac')](function(_0x396a96){var _0x503048;switch(_0x396a96['reportType']){case'default':_0x503048=_[_0xfc3a('0x92')](_0x542c46[_0xfc3a('0xa')],function(_0x14eb99){return _0x14eb99['id']===_0x396a96[_0xfc3a('0x77')]&&_0x14eb99[_0xfc3a('0x10')]==='DefaultReports';});break;case'custom':_0x503048=_[_0xfc3a('0x92')](_0x542c46[_0xfc3a('0xa')],function(_0x53ce33){return _0x53ce33['id']===_0x396a96[_0xfc3a('0x77')]&&_0x53ce33[_0xfc3a('0x10')]===_0xfc3a('0xad');});break;}if(_0x503048)_0x3ccad5[_0xfc3a('0x90')](_0x396a96);});_0xd455a3[_0xfc3a('0xae')]=_0x3ccad5[_0xfc3a('0x8f')];_0xd455a3[_0xfc3a('0xaf')]=_0x3ccad5;return _0xd455a3;});}else{if(!_[_0xfc3a('0x8e')](_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0xb0')])){_0x3dad92[_0xfc3a('0xa4')]['id']=_0x3dad92[_0xfc3a('0xa4')]['id']?_[_0xfc3a('0x9c')](_0x3dad92[_0xfc3a('0xa4')]['id'],_0x25bc63['query'][_0xfc3a('0xb0')]):_0x25bc63[_0xfc3a('0x85')]['ids'];if(_0x25bc63['query'][_0xfc3a('0xb1')]){_0x3dad92[_0xfc3a('0xa1')]=_0x25bc63['query'][_0xfc3a('0xb1')];}}if(_0x25bc63[_0xfc3a('0x85')]['extraQueryConditions']){_0x3dad92[_0xfc3a('0xa4')]=_[_0xfc3a('0xa8')](_0x3dad92[_0xfc3a('0xa4')],{'$and':_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0xb2')]});}return _0x309a4f[_0x359976[_0xfc3a('0x17')]][_0xfc3a('0xae')]({'where':_0x3dad92[_0xfc3a('0xa4')]})[_0xfc3a('0x9')](function(_0x46ef93){_0xd455a3[_0xfc3a('0xae')]=_0x46ef93;if(_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0xaa')]){if(_0x359976[_0xfc3a('0x17')]===_0xfc3a('0x1e')){_0x3dad92[_0xfc3a('0xab')]=[{'model':_0x309a4f[_0xfc3a('0x6e')],'as':_0xfc3a('0xb3'),'attributes':['id',_0xfc3a('0xb'),_0xfc3a('0xb4')],'required':_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0xb5')]?!![]:![]},{'model':_0x309a4f[_0xfc3a('0x6e')],'as':'ThroughTags','attributes':['id',_0xfc3a('0xb'),_0xfc3a('0xb4')],'through':_0x25bc63[_0xfc3a('0x85')][_0xfc3a('0xb5')]?{'attributes':[],'where':{'TagId':_0x25bc63[_0xfc3a('0x85')]['tag']||undefined}}:{},'required':_0x25bc63[_0xfc3a('0x85')]['tag']?!![]:![]}];}else{_0x3dad92[_0xfc3a('0xab')]=[{'all':!![]}];}}return _0x309a4f[_0x359976[_0xfc3a('0x17')]][_0xfc3a('0x6')](_0x3dad92);})[_0xfc3a('0x9')](function(_0x4821ba){_0xd455a3[_0xfc3a('0xaf')]=_0x4821ba;if(_0x17d39f===_0xfc3a('0x55')&&_0x25bc63[_0xfc3a('0x85')]['openTabs']===_0xfc3a('0xb6')){var _0xdb7de2=[];for(var _0x194900=0x0;_0x194900<_0xd455a3['rows']['length'];_0x194900++){_0xdb7de2[_0xfc3a('0x90')](_0x31457d(_0xfc3a('0xb7'),_0xd455a3['rows'][_0x194900]['dataValues']));_0xdb7de2[_0xfc3a('0x90')](_0x31457d(_0xfc3a('0xb8'),_0xd455a3[_0xfc3a('0xaf')][_0x194900][_0xfc3a('0xb9')]));_0xdb7de2[_0xfc3a('0x90')](_0x31457d(_0xfc3a('0xba'),_0xd455a3[_0xfc3a('0xaf')][_0x194900][_0xfc3a('0xb9')]));_0xdb7de2[_0xfc3a('0x90')](_0x31457d(_0xfc3a('0xbb'),_0xd455a3[_0xfc3a('0xaf')][_0x194900][_0xfc3a('0xb9')]));_0xdb7de2[_0xfc3a('0x90')](_0x31457d(_0xfc3a('0xbc'),_0xd455a3['rows'][_0x194900][_0xfc3a('0xb9')]));_0xdb7de2[_0xfc3a('0x90')](_0x31457d(_0xfc3a('0xbd'),_0xd455a3[_0xfc3a('0xaf')][_0x194900][_0xfc3a('0xb9')]));}return Promise[_0xfc3a('0x94')](_0xdb7de2)[_0xfc3a('0x9')](function(){return _0xd455a3;});}return _0xd455a3;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index f880ff0..7996934 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 _0xa3e8=['./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','localhost','socket.io-emitter'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa3e8,0x127));var _0x8a3e=function(_0x2334ff,_0x237868){_0x2334ff=_0x2334ff-0x0;var _0x4c2c73=_0xa3e8[_0x2334ff];return _0x4c2c73;};'use strict';var _=require(_0x8a3e('0x0'));var util=require(_0x8a3e('0x1'));var moment=require(_0x8a3e('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a3e('0x3'));var fs=require('fs');var Redis=require(_0x8a3e('0x4'));var db=require(_0x8a3e('0x5'))['db'];var utils=require(_0x8a3e('0x6'));var logger=require(_0x8a3e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8a3e('0x8')][_0x8a3e('0x9')]({'port':0x232a});config[_0x8a3e('0xa')]=_['defaults'](config[_0x8a3e('0xa')],{'host':_0x8a3e('0xb'),'port':0x18eb});var socket=require(_0x8a3e('0xc'))(new Redis(config[_0x8a3e('0xa')]));require(_0x8a3e('0xd'))[_0x8a3e('0xe')](socket);function respondWithRpcPromise(_0x350812,_0x1c8479,_0x23fd98){return new BPromise(function(_0x4e5699,_0x2a2eec){return client[_0x8a3e('0xf')](_0x350812,_0x23fd98)[_0x8a3e('0x10')](function(_0x4a9af4){logger[_0x8a3e('0x11')](_0x8a3e('0x12'),_0x1c8479,_0x8a3e('0x13'));logger[_0x8a3e('0x14')](_0x8a3e('0x15'),_0x1c8479,_0x8a3e('0x13'),JSON[_0x8a3e('0x16')](_0x4a9af4));if(_0x4a9af4[_0x8a3e('0x17')]){if(_0x4a9af4[_0x8a3e('0x17')][_0x8a3e('0x18')]===0x1f4){logger[_0x8a3e('0x17')](_0x8a3e('0x12'),_0x1c8479,_0x4a9af4[_0x8a3e('0x17')]['message']);return _0x2a2eec(_0x4a9af4[_0x8a3e('0x17')][_0x8a3e('0x19')]);}logger[_0x8a3e('0x17')](_0x8a3e('0x12'),_0x1c8479,_0x4a9af4[_0x8a3e('0x17')][_0x8a3e('0x19')]);return _0x4e5699(_0x4a9af4['error'][_0x8a3e('0x19')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x1c8479,_0x8a3e('0x13'));_0x4e5699(_0x4a9af4[_0x8a3e('0x1a')][_0x8a3e('0x19')]);}})[_0x8a3e('0x1b')](function(_0x24e88d){logger[_0x8a3e('0x17')](_0x8a3e('0x12'),_0x1c8479,_0x24e88d);_0x2a2eec(_0x24e88d);});});} \ No newline at end of file +var _0x8c8b=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x8c8b,0x106));var _0xb8c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8c8b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb8c8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb8c8('0x1'));var rs=require(_0xb8c8('0x2'));var fs=require('fs');var Redis=require(_0xb8c8('0x3'));var db=require(_0xb8c8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb8c8('0x5'));var config=require(_0xb8c8('0x6'));var jayson=require(_0xb8c8('0x7'));var client=jayson[_0xb8c8('0x8')][_0xb8c8('0x9')]({'port':0x232a});config[_0xb8c8('0xa')]=_[_0xb8c8('0xb')](config[_0xb8c8('0xa')],{'host':_0xb8c8('0xc'),'port':0x18eb});var socket=require(_0xb8c8('0xd'))(new Redis(config[_0xb8c8('0xa')]));require('./userProfile.socket')[_0xb8c8('0xe')](socket);function respondWithRpcPromise(_0x3e6f56,_0x406e1e,_0x1db0e7){return new BPromise(function(_0x3c74d5,_0x3414ec){return client[_0xb8c8('0xf')](_0x3e6f56,_0x1db0e7)[_0xb8c8('0x10')](function(_0x8814ad){logger[_0xb8c8('0x11')](_0xb8c8('0x12'),_0x406e1e,_0xb8c8('0x13'));logger['debug'](_0xb8c8('0x14'),_0x406e1e,'request\x20sent',JSON[_0xb8c8('0x15')](_0x8814ad));if(_0x8814ad[_0xb8c8('0x16')]){if(_0x8814ad['error'][_0xb8c8('0x17')]===0x1f4){logger[_0xb8c8('0x16')](_0xb8c8('0x12'),_0x406e1e,_0x8814ad['error'][_0xb8c8('0x18')]);return _0x3414ec(_0x8814ad[_0xb8c8('0x16')][_0xb8c8('0x18')]);}logger[_0xb8c8('0x16')]('UserProfile,\x20%s,\x20%s',_0x406e1e,_0x8814ad[_0xb8c8('0x16')][_0xb8c8('0x18')]);return _0x3c74d5(_0x8814ad[_0xb8c8('0x16')][_0xb8c8('0x18')]);}else{logger['info'](_0xb8c8('0x12'),_0x406e1e,_0xb8c8('0x13'));_0x3c74d5(_0x8814ad[_0xb8c8('0x19')][_0xb8c8('0x18')]);}})[_0xb8c8('0x1a')](function(_0x1cbded){logger[_0xb8c8('0x16')](_0xb8c8('0x12'),_0x406e1e,_0x1cbded);_0x3414ec(_0x1cbded);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index c5cbe20..70eec62 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 _0x9994=['./userProfile.events','remove','register','length'];(function(_0x45482b,_0x6af805){var _0x104fce=function(_0x5e60e5){while(--_0x5e60e5){_0x45482b['push'](_0x45482b['shift']());}};_0x104fce(++_0x6af805);}(_0x9994,0x1a0));var _0x4999=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x9994[_0x4c7935];return _0x30651d;};'use strict';var UserProfileEvents=require(_0x4999('0x0'));var events=['save',_0x4999('0x1'),'update'];function createListener(_0x552627,_0x32fa35){return function(_0x555238){_0x32fa35['emit'](_0x552627,_0x555238);};}function removeListener(_0x5e97e5,_0x25f092){return function(){UserProfileEvents['removeListener'](_0x5e97e5,_0x25f092);};}exports[_0x4999('0x2')]=function(_0x2b0c9f){for(var _0x5e2011=0x0,_0x259705=events[_0x4999('0x3')];_0x5e2011<_0x259705;_0x5e2011++){var _0x3f80d8=events[_0x5e2011];var _0x4e0760=createListener('userProfile:'+_0x3f80d8,_0x2b0c9f);UserProfileEvents['on'](_0x3f80d8,_0x4e0760);}}; \ No newline at end of file +var _0xb722=['length','./userProfile.events','remove','emit','register'];(function(_0x41af18,_0x3cfad4){var _0x2978fe=function(_0x48e2a3){while(--_0x48e2a3){_0x41af18['push'](_0x41af18['shift']());}};_0x2978fe(++_0x3cfad4);}(_0xb722,0x191));var _0x2b72=function(_0x52d43c,_0x30ef0b){_0x52d43c=_0x52d43c-0x0;var _0x4c7cbf=_0xb722[_0x52d43c];return _0x4c7cbf;};'use strict';var UserProfileEvents=require(_0x2b72('0x0'));var events=['save',_0x2b72('0x1'),'update'];function createListener(_0x38d37d,_0x28e9c3){return function(_0x3f3752){_0x28e9c3[_0x2b72('0x2')](_0x38d37d,_0x3f3752);};}function removeListener(_0x3c7b8a,_0x50a15c){return function(){UserProfileEvents['removeListener'](_0x3c7b8a,_0x50a15c);};}exports[_0x2b72('0x3')]=function(_0x367176){for(var _0x493c99=0x0,_0x2ff9e5=events[_0x2b72('0x4')];_0x493c99<_0x2ff9e5;_0x493c99++){var _0x1af313=events[_0x493c99];var _0x15b805=createListener('userProfile:'+_0x1af313,_0x367176);UserProfileEvents['on'](_0x1af313,_0x15b805);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 2bab527..4f53970 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 _0x304a=['create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','./userProfileResource.controller','get','index','/describe','isAuthenticated','show','post'];(function(_0x5508e8,_0x306bd6){var _0x39a844=function(_0x20f8d4){while(--_0x20f8d4){_0x5508e8['push'](_0x5508e8['shift']());}};_0x39a844(++_0x306bd6);}(_0x304a,0x96));var _0xa304=function(_0x4ccda5,_0x528887){_0x4ccda5=_0x4ccda5-0x0;var _0x5f38cd=_0x304a[_0x4ccda5];return _0x5f38cd;};'use strict';var multer=require(_0xa304('0x0'));var util=require(_0xa304('0x1'));var path=require('path');var timeout=require(_0xa304('0x2'));var express=require(_0xa304('0x3'));var router=express[_0xa304('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa304('0x5'));router[_0xa304('0x6')]('/',auth['isAuthenticated'](),controller[_0xa304('0x7')]);router[_0xa304('0x6')](_0xa304('0x8'),auth[_0xa304('0x9')](),controller['describe']);router[_0xa304('0x6')]('/:id',auth[_0xa304('0x9')](),controller[_0xa304('0xa')]);router[_0xa304('0xb')]('/',auth['isAuthenticated'](),controller[_0xa304('0xc')]);router[_0xa304('0xd')](_0xa304('0xe'),auth[_0xa304('0x9')](),controller[_0xa304('0xf')]);router[_0xa304('0x10')](_0xa304('0xe'),auth[_0xa304('0x9')](),controller[_0xa304('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf781=['path','express','Router','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','post','put','delete','/:id','destroy','multer','util'];(function(_0x25122f,_0x43d7d){var _0xba3d5c=function(_0x127f01){while(--_0x127f01){_0x25122f['push'](_0x25122f['shift']());}};_0xba3d5c(++_0x43d7d);}(_0xf781,0xc4));var _0x1f78=function(_0x5bef1d,_0x523f1c){_0x5bef1d=_0x5bef1d-0x0;var _0x2a9d3f=_0xf781[_0x5bef1d];return _0x2a9d3f;};'use strict';var multer=require(_0x1f78('0x0'));var util=require(_0x1f78('0x1'));var path=require(_0x1f78('0x2'));var timeout=require('connect-timeout');var express=require(_0x1f78('0x3'));var router=express[_0x1f78('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1f78('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1f78('0x6'));var controller=require(_0x1f78('0x7'));router[_0x1f78('0x8')]('/',auth[_0x1f78('0x9')](),controller[_0x1f78('0xa')]);router['get'](_0x1f78('0xb'),auth['isAuthenticated'](),controller[_0x1f78('0xc')]);router[_0x1f78('0x8')]('/:id',auth[_0x1f78('0x9')](),controller['show']);router[_0x1f78('0xd')]('/',auth[_0x1f78('0x9')](),controller['create']);router[_0x1f78('0xe')]('/:id',auth[_0x1f78('0x9')](),controller['update']);router[_0x1f78('0xf')](_0x1f78('0x10'),auth[_0x1f78('0x9')](),controller[_0x1f78('0x11')]);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 320c9fd..bbe00d6 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 _0x31eb=['STRING','INTEGER'];(function(_0x4c2fe5,_0x2a2ce8){var _0x264c03=function(_0x278897){while(--_0x278897){_0x4c2fe5['push'](_0x4c2fe5['shift']());}};_0x264c03(++_0x2a2ce8);}(_0x31eb,0x1e2));var _0xb31e=function(_0x4f90b8,_0x414a7e){_0x4f90b8=_0x4f90b8-0x0;var _0xd88765=_0x31eb[_0x4f90b8];return _0xd88765;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb31e('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb31e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb31e('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xbf36=['INTEGER','sequelize','exports','STRING'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0xbf36,0x159));var _0x6bf3=function(_0x278868,_0x406e08){_0x278868=_0x278868-0x0;var _0x54fb83=_0xbf36[_0x278868];return _0x54fb83;};'use strict';var Sequelize=require(_0x6bf3('0x0'));module[_0x6bf3('0x1')]={'name':{'type':Sequelize[_0x6bf3('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6bf3('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6bf3('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 12cea84..122648b 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 _0x2a07=['index','map','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','name','send'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2a07,0x74));var _0x72a0=function(_0x439662,_0x5defdb){_0x439662=_0x439662-0x0;var _0x251ec4=_0x2a07[_0x439662];return _0x251ec4;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['UserProfileResource'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['UserProfileResource']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));};exports[_0x72a0('0x4f')]=function(_0x50c8d7,_0xc0f323){return db[_0x72a0('0x2e')]['describe']()['then'](respondWithResult(_0xc0f323,null))[_0x72a0('0x46')](handleError(_0xc0f323,null));}; \ No newline at end of file +var _0x6343=['VIRTUAL','options','UserProfileResource','then','rows','catch','show','params','keys','includeAll','include','create','body','find','describe','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge'];(function(_0x198446,_0x119c8f){var _0x38d7b7=function(_0x293752){while(--_0x293752){_0x198446['push'](_0x198446['shift']());}};_0x38d7b7(++_0x119c8f);}(_0x6343,0x168));var _0x3634=function(_0x4874c4,_0x4e6c7f){_0x4874c4=_0x4874c4-0x0;var _0x5bc632=_0x6343[_0x4874c4];return _0x5bc632;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['UserProfileResource'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));};exports[_0x3634('0x44')]=function(_0x1943a5,_0x1834a3){return db['UserProfileResource'][_0x3634('0x44')]()[_0x3634('0x39')](respondWithResult(_0x1834a3,null))[_0x3634('0x3b')](handleError(_0x1834a3,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 3be974d..cddc9ed 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 _0xad74=['../../config/logger','api','moment','bluebird','../../config/environment','exports','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','util'];(function(_0x1b022d,_0x40a462){var _0x29f2f3=function(_0x53224f){while(--_0x53224f){_0x1b022d['push'](_0x1b022d['shift']());}};_0x29f2f3(++_0x40a462);}(_0xad74,0x172));var _0x4ad7=function(_0x18c66e,_0x3ea035){_0x18c66e=_0x18c66e-0x0;var _0x4d9841=_0xad74[_0x18c66e];return _0x4d9841;};'use strict';var _=require(_0x4ad7('0x0'));var util=require(_0x4ad7('0x1'));var logger=require(_0x4ad7('0x2'))(_0x4ad7('0x3'));var moment=require(_0x4ad7('0x4'));var BPromise=require(_0x4ad7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4ad7('0x6'));var attributes=require('./userProfileResource.attributes');module[_0x4ad7('0x7')]=function(_0x32fcdf,_0x10e134){return _0x32fcdf['define'](_0x4ad7('0x8'),attributes,{'tableName':_0x4ad7('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x4ad7('0xa'),_0x4ad7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c7a=['define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userProfileResource.attributes','exports'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x4c7a,0x11d));var _0xa4c7=function(_0x3c255f,_0x33c7e4){_0x3c255f=_0x3c255f-0x0;var _0x1467d0=_0x4c7a[_0x3c255f];return _0x1467d0;};'use strict';var _=require('lodash');var util=require(_0xa4c7('0x0'));var logger=require(_0xa4c7('0x1'))(_0xa4c7('0x2'));var moment=require(_0xa4c7('0x3'));var BPromise=require(_0xa4c7('0x4'));var rp=require(_0xa4c7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa4c7('0x6'));var attributes=require(_0xa4c7('0x7'));module[_0xa4c7('0x8')]=function(_0x234d6f,_0x473fd2){return _0x234d6f[_0xa4c7('0x9')](_0xa4c7('0xa'),attributes,{'tableName':_0xa4c7('0xb'),'paranoid':![],'indexes':[{'name':_0xa4c7('0xc'),'fields':['resourceId',_0xa4c7('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 9f7a038..08ab7d3 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 _0x3cc3=['UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x3c8c43,_0x58cd2c){var _0x3f65cf=function(_0xcabac){while(--_0xcabac){_0x3c8c43['push'](_0x3c8c43['shift']());}};_0x3f65cf(++_0x58cd2c);}(_0x3cc3,0x1ec));var _0x33cc=function(_0x42c5da,_0x1daaa7){_0x42c5da=_0x42c5da-0x0;var _0x128e2d=_0x3cc3[_0x42c5da];return _0x128e2d;};'use strict';var _=require(_0x33cc('0x0'));var util=require(_0x33cc('0x1'));var moment=require(_0x33cc('0x2'));var BPromise=require(_0x33cc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33cc('0x4'));var db=require(_0x33cc('0x5'))['db'];var utils=require(_0x33cc('0x6'));var logger=require(_0x33cc('0x7'))(_0x33cc('0x8'));var config=require(_0x33cc('0x9'));var jayson=require(_0x33cc('0xa'));var client=jayson[_0x33cc('0xb')][_0x33cc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x509ce6,_0x25c9a8,_0x2f41c8){return new BPromise(function(_0x56eff1,_0x564845){return client['request'](_0x509ce6,_0x2f41c8)['then'](function(_0x26d6a1){logger[_0x33cc('0xd')](_0x33cc('0xe'),_0x25c9a8,_0x33cc('0xf'));logger[_0x33cc('0x10')](_0x33cc('0x11'),_0x25c9a8,'request\x20sent',JSON[_0x33cc('0x12')](_0x26d6a1));if(_0x26d6a1['error']){if(_0x26d6a1[_0x33cc('0x13')][_0x33cc('0x14')]===0x1f4){logger[_0x33cc('0x13')](_0x33cc('0xe'),_0x25c9a8,_0x26d6a1['error'][_0x33cc('0x15')]);return _0x564845(_0x26d6a1['error'][_0x33cc('0x15')]);}logger[_0x33cc('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x25c9a8,_0x26d6a1[_0x33cc('0x13')]['message']);return _0x56eff1(_0x26d6a1['error'][_0x33cc('0x15')]);}else{logger[_0x33cc('0xd')](_0x33cc('0xe'),_0x25c9a8,_0x33cc('0xf'));_0x56eff1(_0x26d6a1['result']['message']);}})['catch'](function(_0x46969b){logger[_0x33cc('0x13')](_0x33cc('0xe'),_0x25c9a8,_0x46969b);_0x564845(_0x46969b);});});} \ No newline at end of file +var _0xbd97=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd97,0x1de));var _0x7bd9=function(_0x2d77fb,_0xd173e6){_0x2d77fb=_0x2d77fb-0x0;var _0xbde89c=_0xbd97[_0x2d77fb];return _0xbde89c;};'use strict';var _=require('lodash');var util=require(_0x7bd9('0x0'));var moment=require(_0x7bd9('0x1'));var BPromise=require(_0x7bd9('0x2'));var rs=require(_0x7bd9('0x3'));var fs=require('fs');var Redis=require(_0x7bd9('0x4'));var db=require(_0x7bd9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7bd9('0x6'));var config=require(_0x7bd9('0x7'));var jayson=require(_0x7bd9('0x8'));var client=jayson[_0x7bd9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e68b7,_0x4e3d31,_0x2df63b){return new BPromise(function(_0x3a9fd9,_0x34bb1d){return client[_0x7bd9('0xa')](_0x2e68b7,_0x2df63b)[_0x7bd9('0xb')](function(_0x399d95){logger[_0x7bd9('0xc')](_0x7bd9('0xd'),_0x4e3d31,'request\x20sent');logger['debug'](_0x7bd9('0xe'),_0x4e3d31,_0x7bd9('0xf'),JSON[_0x7bd9('0x10')](_0x399d95));if(_0x399d95[_0x7bd9('0x11')]){if(_0x399d95[_0x7bd9('0x11')][_0x7bd9('0x12')]===0x1f4){logger[_0x7bd9('0x11')](_0x7bd9('0xd'),_0x4e3d31,_0x399d95['error']['message']);return _0x34bb1d(_0x399d95[_0x7bd9('0x11')]['message']);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x4e3d31,_0x399d95[_0x7bd9('0x11')][_0x7bd9('0x13')]);return _0x3a9fd9(_0x399d95['error'][_0x7bd9('0x13')]);}else{logger[_0x7bd9('0xc')](_0x7bd9('0xd'),_0x4e3d31,_0x7bd9('0xf'));_0x3a9fd9(_0x399d95['result'][_0x7bd9('0x13')]);}})[_0x7bd9('0x14')](function(_0x4ba454){logger['error'](_0x7bd9('0xd'),_0x4e3d31,_0x4ba454);_0x34bb1d(_0x4ba454);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 8ea95d7..5f446f5 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 _0xab15=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab15,0xd0));var _0x5ab1=function(_0x293557,_0x18bfa6){_0x293557=_0x293557-0x0;var _0x4b0fd8=_0xab15[_0x293557];return _0x4b0fd8;};'use strict';var multer=require(_0x5ab1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5ab1('0x1'));var express=require(_0x5ab1('0x2'));var router=express[_0x5ab1('0x3')]();var fs_extra=require(_0x5ab1('0x4'));var auth=require(_0x5ab1('0x5'));var interaction=require(_0x5ab1('0x6'));var config=require(_0x5ab1('0x7'));var controller=require(_0x5ab1('0x8'));router[_0x5ab1('0x9')]('/',auth[_0x5ab1('0xa')](),controller[_0x5ab1('0xb')]);router['get']('/describe',auth[_0x5ab1('0xa')](),controller['describe']);router[_0x5ab1('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5ab1('0xc')]);router[_0x5ab1('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5ab1('0xe')](_0x5ab1('0xf'),auth[_0x5ab1('0xa')](),controller[_0x5ab1('0x10')]);router[_0x5ab1('0x11')](_0x5ab1('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x5ab1('0x12')]=router; \ No newline at end of file +var _0x743e=['/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','create','put'];(function(_0x524cfc,_0x965821){var _0x4950a7=function(_0x251c6b){while(--_0x251c6b){_0x524cfc['push'](_0x524cfc['shift']());}};_0x4950a7(++_0x965821);}(_0x743e,0x11d));var _0xe743=function(_0x147a09,_0x23c22a){_0x147a09=_0x147a09-0x0;var _0x3558a0=_0x743e[_0x147a09];return _0x3558a0;};'use strict';var multer=require(_0xe743('0x0'));var util=require(_0xe743('0x1'));var path=require('path');var timeout=require(_0xe743('0x2'));var express=require(_0xe743('0x3'));var router=express[_0xe743('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe743('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe743('0x6'));var controller=require('./userProfileSection.controller');router[_0xe743('0x7')]('/',auth[_0xe743('0x8')](),controller[_0xe743('0x9')]);router[_0xe743('0x7')](_0xe743('0xa'),auth[_0xe743('0x8')](),controller[_0xe743('0xb')]);router[_0xe743('0x7')]('/:id',auth[_0xe743('0x8')](),controller[_0xe743('0xc')]);router['post']('/',auth[_0xe743('0x8')](),controller[_0xe743('0xd')]);router[_0xe743('0xe')](_0xe743('0xf'),auth[_0xe743('0x8')](),controller[_0xe743('0x10')]);router[_0xe743('0x11')](_0xe743('0xf'),auth[_0xe743('0x8')](),controller[_0xe743('0x12')]);module[_0xe743('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index fcea5df..4522686 100644 --- a/server/api/userProfileSection/userProfileSection.attributes.js +++ b/server/api/userProfileSection/userProfileSection.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1775=['INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','exports','STRING'];(function(_0xf318fb,_0x3e4110){var _0x2ced4b=function(_0x113b98){while(--_0x113b98){_0xf318fb['push'](_0xf318fb['shift']());}};_0x2ced4b(++_0x3e4110);}(_0x1775,0x1db));var _0x5177=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1775[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x5177('0x0')]={'name':{'type':Sequelize[_0x5177('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x5177('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5177('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5177('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5177('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5177('0x1')],'set':function(_0x2027bf){this[_0x5177('0x4')](_0x5177('0x5'),_0x2027bf?_0x2027bf[_0x5177('0x6')](''):[]);},'get':function(){return this[_0x5177('0x7')](_0x5177('0x5'))?this[_0x5177('0x7')](_0x5177('0x5'))[_0x5177('0x8')](''):[];}}}; \ No newline at end of file +var _0xe605=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER'];(function(_0xe65dc5,_0x293bb4){var _0x5a5416=function(_0x4fbd38){while(--_0x4fbd38){_0xe65dc5['push'](_0xe65dc5['shift']());}};_0x5a5416(++_0x293bb4);}(_0xe605,0x92));var _0x5e60=function(_0x10b917,_0x1511bd){_0x10b917=_0x10b917-0x0;var _0x77003f=_0xe605[_0x10b917];return _0x77003f;};'use strict';var Sequelize=require(_0x5e60('0x0'));module[_0x5e60('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x5e60('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5e60('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5e60('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5e60('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5e60('0x2')],'set':function(_0xfe1f64){this[_0x5e60('0x5')](_0x5e60('0x6'),_0xfe1f64?_0xfe1f64[_0x5e60('0x7')](''):[]);},'get':function(){return this[_0x5e60('0x8')](_0x5e60('0x6'))?this[_0x5e60('0x8')]('crudPermissions')[_0x5e60('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index f9ca299..812a835 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 _0xf343=['describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','destroy','then','end','stack','send','index','map','rawAttributes','type','model','name','query','filters','intersection','attributes','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','options','UserProfileSection','includeAll','findAll','rows','catch','show','keys','fields','length','include','find','create','body','update','params'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf343,0x15f));var _0x3f34=function(_0x32088f,_0x538e0a){_0x32088f=_0x32088f-0x0;var _0x43abf1=_0xf343[_0x32088f];return _0x43abf1;};'use strict';var emlformat=require(_0x3f34('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f34('0x1'));var jsonpatch=require(_0x3f34('0x2'));var rp=require(_0x3f34('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3f34('0x4'));var util=require('util');var path=require(_0x3f34('0x5'));var sox=require('sox');var csv=require(_0x3f34('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f34('0x7'));var _=require(_0x3f34('0x8'));var squel=require(_0x3f34('0x9'));var crypto=require(_0x3f34('0xa'));var jsforce=require(_0x3f34('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3f34('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3f34('0xc'));var authService=require(_0x3f34('0xd'));var qs=require(_0x3f34('0xe'));var as=require(_0x3f34('0xf'));var hardwareService=require(_0x3f34('0x10'));var logger=require(_0x3f34('0x11'))('api');var utils=require(_0x3f34('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3f34('0x13'))['db'];function respondWithStatusCode(_0x249fbb,_0x2e6344){_0x2e6344=_0x2e6344||0xcc;return function(_0x1aac78){if(_0x1aac78){return _0x249fbb[_0x3f34('0x14')](_0x2e6344);}return _0x249fbb[_0x3f34('0x15')](_0x2e6344)['end']();};}function respondWithResult(_0x5ae252,_0x19f9c5){_0x19f9c5=_0x19f9c5||0xc8;return function(_0x4bc029){if(_0x4bc029){return _0x5ae252[_0x3f34('0x15')](_0x19f9c5)[_0x3f34('0x16')](_0x4bc029);}};}function respondWithFilteredResult(_0x7dbc34,_0x804cca){return function(_0x10a7a5){if(_0x10a7a5){var _0x147825=typeof _0x804cca['offset']==='undefined'&&typeof _0x804cca['limit']===_0x3f34('0x17');var _0x9a7839=_0x10a7a5[_0x3f34('0x18')];var _0x7040c4=_0x147825?0x0:_0x804cca[_0x3f34('0x19')];var _0x126694=_0x147825?_0x10a7a5[_0x3f34('0x18')]:_0x804cca[_0x3f34('0x19')]+_0x804cca[_0x3f34('0x1a')];var _0x56013e;if(_0x126694>=_0x9a7839){_0x126694=_0x9a7839;_0x56013e=0xc8;}else{_0x56013e=0xce;}_0x7dbc34[_0x3f34('0x15')](_0x56013e);return _0x7dbc34[_0x3f34('0x1b')](_0x3f34('0x1c'),_0x7040c4+'-'+_0x126694+'/'+_0x9a7839)[_0x3f34('0x16')](_0x10a7a5);}return null;};}function patchUpdates(_0x4a9aec){return function(_0x378c86){try{jsonpatch[_0x3f34('0x1d')](_0x378c86,_0x4a9aec,!![]);}catch(_0x51741b){return BPromise[_0x3f34('0x1e')](_0x51741b);}return _0x378c86['save']();};}function saveUpdates(_0xb6e5e4,_0x3f47a5){return function(_0x1913f9){if(_0x1913f9){return _0x1913f9['update'](_0xb6e5e4)['then'](function(_0x277fcf){return _0x277fcf;});}return null;};}function removeEntity(_0x40051c,_0x43caea){return function(_0x5a0a29){if(_0x5a0a29){return _0x5a0a29[_0x3f34('0x1f')]()[_0x3f34('0x20')](function(){_0x40051c['status'](0xcc)[_0x3f34('0x21')]();});}};}function handleEntityNotFound(_0x272601,_0x4a893c){return function(_0xe7a32f){if(!_0xe7a32f){_0x272601[_0x3f34('0x14')](0x194);}return _0xe7a32f;};}function handleError(_0x52569a,_0x281144){_0x281144=_0x281144||0x1f4;return function(_0xcb7189){logger['error'](_0xcb7189[_0x3f34('0x22')]);if(_0xcb7189['name']){delete _0xcb7189['name'];}_0x52569a[_0x3f34('0x15')](_0x281144)[_0x3f34('0x23')](_0xcb7189);};}exports[_0x3f34('0x24')]=function(_0x4beb72,_0x56f8ec){var _0x25b507={},_0x52d918={},_0x1391de={'count':0x0,'rows':[]};var _0x254e6a=_[_0x3f34('0x25')](db['UserProfileSection'][_0x3f34('0x26')],function(_0x30d300){return{'name':_0x30d300['fieldName'],'type':_0x30d300[_0x3f34('0x27')]['key']};});_0x52d918[_0x3f34('0x28')]=_[_0x3f34('0x25')](_0x254e6a,_0x3f34('0x29'));_0x52d918[_0x3f34('0x2a')]=_['keys'](_0x4beb72[_0x3f34('0x2a')]);_0x52d918[_0x3f34('0x2b')]=_[_0x3f34('0x2c')](_0x52d918[_0x3f34('0x28')],_0x52d918[_0x3f34('0x2a')]);_0x25b507[_0x3f34('0x2d')]=_['intersection'](_0x52d918[_0x3f34('0x28')],qs['fields'](_0x4beb72[_0x3f34('0x2a')]['fields']));_0x25b507['attributes']=_0x25b507['attributes']['length']?_0x25b507['attributes']:_0x52d918[_0x3f34('0x28')];if(!_0x4beb72[_0x3f34('0x2a')][_0x3f34('0x2e')]('nolimit')){_0x25b507[_0x3f34('0x1a')]=qs[_0x3f34('0x1a')](_0x4beb72[_0x3f34('0x2a')][_0x3f34('0x1a')]);_0x25b507[_0x3f34('0x19')]=qs[_0x3f34('0x19')](_0x4beb72['query'][_0x3f34('0x19')]);}_0x25b507['order']=qs[_0x3f34('0x2f')](_0x4beb72[_0x3f34('0x2a')][_0x3f34('0x2f')]);_0x25b507['where']=qs[_0x3f34('0x2b')](_[_0x3f34('0x30')](_0x4beb72[_0x3f34('0x2a')],_0x52d918[_0x3f34('0x2b')]),_0x254e6a);if(_0x4beb72[_0x3f34('0x2a')]['filter']){_0x25b507[_0x3f34('0x31')]=_[_0x3f34('0x32')](_0x25b507[_0x3f34('0x31')],{'$or':_[_0x3f34('0x25')](_0x254e6a,function(_0x1d81d8){if(_0x1d81d8['type']!==_0x3f34('0x33')){var _0x80907b={};_0x80907b[_0x1d81d8['name']]={'$like':'%'+_0x4beb72[_0x3f34('0x2a')][_0x3f34('0x34')]+'%'};return _0x80907b;}})});}_0x25b507=_['merge']({},_0x25b507,_0x4beb72[_0x3f34('0x35')]);var _0x962e5a={'where':_0x25b507[_0x3f34('0x31')]};return db[_0x3f34('0x36')][_0x3f34('0x18')](_0x962e5a)[_0x3f34('0x20')](function(_0x4cd8ce){_0x1391de[_0x3f34('0x18')]=_0x4cd8ce;if(_0x4beb72[_0x3f34('0x2a')][_0x3f34('0x37')]){_0x25b507['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x3f34('0x38')](_0x25b507);})[_0x3f34('0x20')](function(_0x56002f){_0x1391de[_0x3f34('0x39')]=_0x56002f;return _0x1391de;})[_0x3f34('0x20')](respondWithFilteredResult(_0x56f8ec,_0x25b507))[_0x3f34('0x3a')](handleError(_0x56f8ec,null));};exports[_0x3f34('0x3b')]=function(_0x17fcf3,_0x377e3c){var _0x225786={'raw':![],'where':{'id':_0x17fcf3['params']['id']}},_0x13dcd4={};_0x13dcd4[_0x3f34('0x28')]=_[_0x3f34('0x3c')](db[_0x3f34('0x36')][_0x3f34('0x26')]);_0x13dcd4[_0x3f34('0x2a')]=_[_0x3f34('0x3c')](_0x17fcf3[_0x3f34('0x2a')]);_0x13dcd4['filters']=_['intersection'](_0x13dcd4[_0x3f34('0x28')],_0x13dcd4[_0x3f34('0x2a')]);_0x225786[_0x3f34('0x2d')]=_[_0x3f34('0x2c')](_0x13dcd4[_0x3f34('0x28')],qs[_0x3f34('0x3d')](_0x17fcf3[_0x3f34('0x2a')][_0x3f34('0x3d')]));_0x225786['attributes']=_0x225786[_0x3f34('0x2d')][_0x3f34('0x3e')]?_0x225786[_0x3f34('0x2d')]:_0x13dcd4[_0x3f34('0x28')];if(_0x17fcf3[_0x3f34('0x2a')]['includeAll']){_0x225786[_0x3f34('0x3f')]=[{'all':!![]}];}_0x225786=_[_0x3f34('0x32')]({},_0x225786,_0x17fcf3[_0x3f34('0x35')]);return db[_0x3f34('0x36')][_0x3f34('0x40')](_0x225786)[_0x3f34('0x20')](handleEntityNotFound(_0x377e3c,null))[_0x3f34('0x20')](respondWithResult(_0x377e3c,null))[_0x3f34('0x3a')](handleError(_0x377e3c,null));};exports[_0x3f34('0x41')]=function(_0x84a4aa,_0x284930){return db[_0x3f34('0x36')][_0x3f34('0x41')](_0x84a4aa[_0x3f34('0x42')],{})[_0x3f34('0x20')](respondWithResult(_0x284930,0xc9))['catch'](handleError(_0x284930,null));};exports[_0x3f34('0x43')]=function(_0x267f1e,_0x46bc24){if(_0x267f1e['body']['id']){delete _0x267f1e[_0x3f34('0x42')]['id'];}return db[_0x3f34('0x36')][_0x3f34('0x40')]({'where':{'id':_0x267f1e[_0x3f34('0x44')]['id']}})[_0x3f34('0x20')](handleEntityNotFound(_0x46bc24,null))[_0x3f34('0x20')](saveUpdates(_0x267f1e[_0x3f34('0x42')],null))[_0x3f34('0x20')](respondWithResult(_0x46bc24,null))[_0x3f34('0x3a')](handleError(_0x46bc24,null));};exports['destroy']=function(_0x428f2e,_0x5d25ab){return db[_0x3f34('0x36')][_0x3f34('0x40')]({'where':{'id':_0x428f2e[_0x3f34('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d25ab,null))['then'](removeEntity(_0x5d25ab,null))[_0x3f34('0x3a')](handleError(_0x5d25ab,null));};exports[_0x3f34('0x45')]=function(_0x24b923,_0x4b47e6){return db['UserProfileSection'][_0x3f34('0x45')]()[_0x3f34('0x20')](respondWithResult(_0x4b47e6,null))[_0x3f34('0x3a')](handleError(_0x4b47e6,null));}; \ No newline at end of file +var _0x3370=['create','body','describe','eml-format','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','error','name','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','catch','params','include','find'];(function(_0x554be5,_0x177df1){var _0x2ec936=function(_0x5a2071){while(--_0x5a2071){_0x554be5['push'](_0x554be5['shift']());}};_0x2ec936(++_0x177df1);}(_0x3370,0x1f4));var _0x0337=function(_0x842cd8,_0x25c060){_0x842cd8=_0x842cd8-0x0;var _0x48515e=_0x3370[_0x842cd8];return _0x48515e;};'use strict';var emlformat=require(_0x0337('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0337('0x1'));var rp=require(_0x0337('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0337('0x3'));var util=require('util');var path=require(_0x0337('0x4'));var sox=require(_0x0337('0x5'));var csv=require(_0x0337('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0337('0x7'));var _=require('lodash');var squel=require(_0x0337('0x8'));var crypto=require(_0x0337('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0337('0xa'));var toCsv=require(_0x0337('0x6'));var querystring=require('querystring');var Papa=require(_0x0337('0xb'));var Redis=require('ioredis');var authService=require(_0x0337('0xc'));var qs=require(_0x0337('0xd'));var as=require(_0x0337('0xe'));var hardwareService=require(_0x0337('0xf'));var logger=require(_0x0337('0x10'))(_0x0337('0x11'));var utils=require(_0x0337('0x12'));var config=require(_0x0337('0x13'));var licenseUtil=require(_0x0337('0x14'));var db=require(_0x0337('0x15'))['db'];function respondWithStatusCode(_0x2788a7,_0x7b112d){_0x7b112d=_0x7b112d||0xcc;return function(_0x717f13){if(_0x717f13){return _0x2788a7[_0x0337('0x16')](_0x7b112d);}return _0x2788a7[_0x0337('0x17')](_0x7b112d)[_0x0337('0x18')]();};}function respondWithResult(_0x4ed95b,_0x28c308){_0x28c308=_0x28c308||0xc8;return function(_0x1f85bf){if(_0x1f85bf){return _0x4ed95b[_0x0337('0x17')](_0x28c308)['json'](_0x1f85bf);}};}function respondWithFilteredResult(_0x594543,_0x56d1a4){return function(_0x4e5353){if(_0x4e5353){var _0x2ba1e9=typeof _0x56d1a4['offset']===_0x0337('0x19')&&typeof _0x56d1a4[_0x0337('0x1a')]==='undefined';var _0x255270=_0x4e5353['count'];var _0x591a3a=_0x2ba1e9?0x0:_0x56d1a4[_0x0337('0x1b')];var _0x54e147=_0x2ba1e9?_0x4e5353[_0x0337('0x1c')]:_0x56d1a4[_0x0337('0x1b')]+_0x56d1a4[_0x0337('0x1a')];var _0x1280f1;if(_0x54e147>=_0x255270){_0x54e147=_0x255270;_0x1280f1=0xc8;}else{_0x1280f1=0xce;}_0x594543[_0x0337('0x17')](_0x1280f1);return _0x594543[_0x0337('0x1d')](_0x0337('0x1e'),_0x591a3a+'-'+_0x54e147+'/'+_0x255270)['json'](_0x4e5353);}return null;};}function patchUpdates(_0x578364){return function(_0x2672cf){try{jsonpatch[_0x0337('0x1f')](_0x2672cf,_0x578364,!![]);}catch(_0x2ce72d){return BPromise['reject'](_0x2ce72d);}return _0x2672cf[_0x0337('0x20')]();};}function saveUpdates(_0x429f2a,_0x38edcc){return function(_0x587465){if(_0x587465){return _0x587465[_0x0337('0x21')](_0x429f2a)[_0x0337('0x22')](function(_0x16c991){return _0x16c991;});}return null;};}function removeEntity(_0x1d5ef6,_0x6a1a31){return function(_0x558afc){if(_0x558afc){return _0x558afc[_0x0337('0x23')]()[_0x0337('0x22')](function(){_0x1d5ef6[_0x0337('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15e0eb,_0x4b1c73){return function(_0x5c5930){if(!_0x5c5930){_0x15e0eb['sendStatus'](0x194);}return _0x5c5930;};}function handleError(_0x56ea60,_0xe8e271){_0xe8e271=_0xe8e271||0x1f4;return function(_0x105e80){logger[_0x0337('0x24')](_0x105e80['stack']);if(_0x105e80['name']){delete _0x105e80[_0x0337('0x25')];}_0x56ea60[_0x0337('0x17')](_0xe8e271)['send'](_0x105e80);};}exports[_0x0337('0x26')]=function(_0x255c82,_0x326dc2){var _0xaf3ccf={},_0x2449cd={},_0x2c57f7={'count':0x0,'rows':[]};var _0x3f5a20=_[_0x0337('0x27')](db[_0x0337('0x28')][_0x0337('0x29')],function(_0xc47682){return{'name':_0xc47682[_0x0337('0x2a')],'type':_0xc47682[_0x0337('0x2b')][_0x0337('0x2c')]};});_0x2449cd[_0x0337('0x2d')]=_[_0x0337('0x27')](_0x3f5a20,_0x0337('0x25'));_0x2449cd[_0x0337('0x2e')]=_[_0x0337('0x2f')](_0x255c82[_0x0337('0x2e')]);_0x2449cd[_0x0337('0x30')]=_[_0x0337('0x31')](_0x2449cd['model'],_0x2449cd[_0x0337('0x2e')]);_0xaf3ccf[_0x0337('0x32')]=_[_0x0337('0x31')](_0x2449cd['model'],qs['fields'](_0x255c82[_0x0337('0x2e')][_0x0337('0x33')]));_0xaf3ccf[_0x0337('0x32')]=_0xaf3ccf[_0x0337('0x32')][_0x0337('0x34')]?_0xaf3ccf[_0x0337('0x32')]:_0x2449cd[_0x0337('0x2d')];if(!_0x255c82[_0x0337('0x2e')]['hasOwnProperty'](_0x0337('0x35'))){_0xaf3ccf['limit']=qs['limit'](_0x255c82[_0x0337('0x2e')][_0x0337('0x1a')]);_0xaf3ccf[_0x0337('0x1b')]=qs[_0x0337('0x1b')](_0x255c82[_0x0337('0x2e')]['offset']);}_0xaf3ccf[_0x0337('0x36')]=qs[_0x0337('0x37')](_0x255c82[_0x0337('0x2e')][_0x0337('0x37')]);_0xaf3ccf[_0x0337('0x38')]=qs[_0x0337('0x30')](_[_0x0337('0x39')](_0x255c82[_0x0337('0x2e')],_0x2449cd[_0x0337('0x30')]),_0x3f5a20);if(_0x255c82[_0x0337('0x2e')][_0x0337('0x3a')]){_0xaf3ccf[_0x0337('0x38')]=_['merge'](_0xaf3ccf[_0x0337('0x38')],{'$or':_[_0x0337('0x27')](_0x3f5a20,function(_0x24a637){if(_0x24a637['type']!==_0x0337('0x3b')){var _0x2f89df={};_0x2f89df[_0x24a637[_0x0337('0x25')]]={'$like':'%'+_0x255c82[_0x0337('0x2e')][_0x0337('0x3a')]+'%'};return _0x2f89df;}})});}_0xaf3ccf=_[_0x0337('0x3c')]({},_0xaf3ccf,_0x255c82[_0x0337('0x3d')]);var _0x13fc9a={'where':_0xaf3ccf[_0x0337('0x38')]};return db[_0x0337('0x28')]['count'](_0x13fc9a)[_0x0337('0x22')](function(_0x5565e4){_0x2c57f7[_0x0337('0x1c')]=_0x5565e4;if(_0x255c82['query'][_0x0337('0x3e')]){_0xaf3ccf['include']=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0xaf3ccf);})[_0x0337('0x22')](function(_0x3d3fd6){_0x2c57f7[_0x0337('0x3f')]=_0x3d3fd6;return _0x2c57f7;})[_0x0337('0x22')](respondWithFilteredResult(_0x326dc2,_0xaf3ccf))[_0x0337('0x40')](handleError(_0x326dc2,null));};exports['show']=function(_0x2ecd3c,_0x16ac7e){var _0x3f6c0c={'raw':![],'where':{'id':_0x2ecd3c[_0x0337('0x41')]['id']}},_0x277748={};_0x277748[_0x0337('0x2d')]=_['keys'](db[_0x0337('0x28')]['rawAttributes']);_0x277748[_0x0337('0x2e')]=_[_0x0337('0x2f')](_0x2ecd3c[_0x0337('0x2e')]);_0x277748['filters']=_[_0x0337('0x31')](_0x277748[_0x0337('0x2d')],_0x277748[_0x0337('0x2e')]);_0x3f6c0c[_0x0337('0x32')]=_[_0x0337('0x31')](_0x277748[_0x0337('0x2d')],qs['fields'](_0x2ecd3c['query'][_0x0337('0x33')]));_0x3f6c0c[_0x0337('0x32')]=_0x3f6c0c['attributes']['length']?_0x3f6c0c[_0x0337('0x32')]:_0x277748[_0x0337('0x2d')];if(_0x2ecd3c[_0x0337('0x2e')]['includeAll']){_0x3f6c0c[_0x0337('0x42')]=[{'all':!![]}];}_0x3f6c0c=_[_0x0337('0x3c')]({},_0x3f6c0c,_0x2ecd3c[_0x0337('0x3d')]);return db['UserProfileSection'][_0x0337('0x43')](_0x3f6c0c)[_0x0337('0x22')](handleEntityNotFound(_0x16ac7e,null))[_0x0337('0x22')](respondWithResult(_0x16ac7e,null))[_0x0337('0x40')](handleError(_0x16ac7e,null));};exports['create']=function(_0x2df0cd,_0x12ba92){return db[_0x0337('0x28')][_0x0337('0x44')](_0x2df0cd[_0x0337('0x45')],{})[_0x0337('0x22')](respondWithResult(_0x12ba92,0xc9))[_0x0337('0x40')](handleError(_0x12ba92,null));};exports[_0x0337('0x21')]=function(_0x2b676a,_0x5a86b1){if(_0x2b676a['body']['id']){delete _0x2b676a[_0x0337('0x45')]['id'];}return db[_0x0337('0x28')][_0x0337('0x43')]({'where':{'id':_0x2b676a['params']['id']}})[_0x0337('0x22')](handleEntityNotFound(_0x5a86b1,null))[_0x0337('0x22')](saveUpdates(_0x2b676a['body'],null))['then'](respondWithResult(_0x5a86b1,null))[_0x0337('0x40')](handleError(_0x5a86b1,null));};exports[_0x0337('0x23')]=function(_0x1f63e4,_0x1c5df6){return db['UserProfileSection'][_0x0337('0x43')]({'where':{'id':_0x1f63e4['params']['id']}})[_0x0337('0x22')](handleEntityNotFound(_0x1c5df6,null))[_0x0337('0x22')](removeEntity(_0x1c5df6,null))[_0x0337('0x40')](handleError(_0x1c5df6,null));};exports[_0x0337('0x46')]=function(_0x3b5b9b,_0x338fea){return db[_0x0337('0x28')]['describe']()[_0x0337('0x22')](respondWithResult(_0x338fea,null))[_0x0337('0x40')](handleError(_0x338fea,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 1ee2595..987a6f8 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 _0xf4e2=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util'];(function(_0x1c06f4,_0x2feba6){var _0x1a727e=function(_0x2e83af){while(--_0x2e83af){_0x1c06f4['push'](_0x1c06f4['shift']());}};_0x1a727e(++_0x2feba6);}(_0xf4e2,0xa3));var _0x2f4e=function(_0x1f1feb,_0x5782e1){_0x1f1feb=_0x1f1feb-0x0;var _0x43ca65=_0xf4e2[_0x1f1feb];return _0x43ca65;};'use strict';var _=require(_0x2f4e('0x0'));var util=require(_0x2f4e('0x1'));var logger=require('../../config/logger')(_0x2f4e('0x2'));var moment=require(_0x2f4e('0x3'));var BPromise=require(_0x2f4e('0x4'));var rp=require(_0x2f4e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2f4e('0x6'));var config=require(_0x2f4e('0x7'));var attributes=require(_0x2f4e('0x8'));module[_0x2f4e('0x9')]=function(_0x6c3abc,_0x45abb9){return _0x6c3abc[_0x2f4e('0xa')]('UserProfileSection',attributes,{'tableName':_0x2f4e('0xb'),'paranoid':![],'indexes':[{'name':_0x2f4e('0xc'),'fields':[_0x2f4e('0xd'),_0x2f4e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7911=['path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','lodash','util','../../config/logger','api'];(function(_0x729b6f,_0x369f24){var _0x218527=function(_0x18293c){while(--_0x18293c){_0x729b6f['push'](_0x729b6f['shift']());}};_0x218527(++_0x369f24);}(_0x7911,0x1dd));var _0x1791=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0x7911[_0x20cb20];return _0x2fcf4b;};'use strict';var _=require(_0x1791('0x0'));var util=require(_0x1791('0x1'));var logger=require(_0x1791('0x2'))(_0x1791('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1791('0x4'));var rimraf=require(_0x1791('0x5'));var config=require(_0x1791('0x6'));var attributes=require(_0x1791('0x7'));module[_0x1791('0x8')]=function(_0x2e4775,_0x7d2d07){return _0x2e4775[_0x1791('0x9')](_0x1791('0xa'),attributes,{'tableName':_0x1791('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x1791('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index e0baa25..5e4d011 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 _0xda3a=['UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent'];(function(_0x2ffa26,_0x111480){var _0x2fb17c=function(_0x35bfcf){while(--_0x35bfcf){_0x2ffa26['push'](_0x2ffa26['shift']());}};_0x2fb17c(++_0x111480);}(_0xda3a,0xba));var _0xada3=function(_0x3972da,_0x24e642){_0x3972da=_0x3972da-0x0;var _0x53cc59=_0xda3a[_0x3972da];return _0x53cc59;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xada3('0x0'));var db=require(_0xada3('0x1'))['db'];var utils=require(_0xada3('0x2'));var logger=require(_0xada3('0x3'))(_0xada3('0x4'));var config=require(_0xada3('0x5'));var jayson=require(_0xada3('0x6'));var client=jayson['client'][_0xada3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e4bca,_0x3ca198,_0x58f879){return new BPromise(function(_0x13978a,_0x522ed9){return client[_0xada3('0x8')](_0x4e4bca,_0x58f879)['then'](function(_0x266f09){logger[_0xada3('0x9')](_0xada3('0xa'),_0x3ca198,_0xada3('0xb'));logger['debug'](_0xada3('0xc'),_0x3ca198,_0xada3('0xb'),JSON[_0xada3('0xd')](_0x266f09));if(_0x266f09['error']){if(_0x266f09[_0xada3('0xe')][_0xada3('0xf')]===0x1f4){logger[_0xada3('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x3ca198,_0x266f09['error'][_0xada3('0x10')]);return _0x522ed9(_0x266f09[_0xada3('0xe')][_0xada3('0x10')]);}logger[_0xada3('0xe')](_0xada3('0xa'),_0x3ca198,_0x266f09[_0xada3('0xe')][_0xada3('0x10')]);return _0x13978a(_0x266f09[_0xada3('0xe')][_0xada3('0x10')]);}else{logger['info'](_0xada3('0xa'),_0x3ca198,_0xada3('0xb'));_0x13978a(_0x266f09[_0xada3('0x11')][_0xada3('0x10')]);}})['catch'](function(_0x1e6d6d){logger[_0xada3('0xe')](_0xada3('0xa'),_0x3ca198,_0x1e6d6d);_0x522ed9(_0x1e6d6d);});});} \ No newline at end of file +var _0x119d=['http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util','moment','../../config/utils','rpc','../../config/environment','client'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x119d,0x181));var _0xd119=function(_0x26550f,_0x4109c7){_0x26550f=_0x26550f-0x0;var _0x79e1d=_0x119d[_0x26550f];return _0x79e1d;};'use strict';var _=require('lodash');var util=require(_0xd119('0x0'));var moment=require(_0xd119('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd119('0x2'));var logger=require('../../config/logger')(_0xd119('0x3'));var config=require(_0xd119('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xd119('0x5')][_0xd119('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x72c210,_0x2fa420,_0x97ba2d){return new BPromise(function(_0x16e1d0,_0x3ea317){return client[_0xd119('0x7')](_0x72c210,_0x97ba2d)[_0xd119('0x8')](function(_0x2ec892){logger[_0xd119('0x9')](_0xd119('0xa'),_0x2fa420,_0xd119('0xb'));logger[_0xd119('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2fa420,_0xd119('0xb'),JSON[_0xd119('0xd')](_0x2ec892));if(_0x2ec892[_0xd119('0xe')]){if(_0x2ec892[_0xd119('0xe')]['code']===0x1f4){logger[_0xd119('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2fa420,_0x2ec892[_0xd119('0xe')][_0xd119('0xf')]);return _0x3ea317(_0x2ec892['error'][_0xd119('0xf')]);}logger[_0xd119('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2fa420,_0x2ec892[_0xd119('0xe')][_0xd119('0xf')]);return _0x16e1d0(_0x2ec892[_0xd119('0xe')][_0xd119('0xf')]);}else{logger[_0xd119('0x9')](_0xd119('0xa'),_0x2fa420,_0xd119('0xb'));_0x16e1d0(_0x2ec892['result'][_0xd119('0xf')]);}})[_0xd119('0x10')](function(_0x10028e){logger['error'](_0xd119('0xa'),_0x2fa420,_0x10028e);_0x3ea317(_0x10028e);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index d7b429a..7fed0da 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x257cee,_0x2c5988){var _0x5f5a8b=function(_0x41ad3b){while(--_0x41ad3b){_0x257cee['push'](_0x257cee['shift']());}};_0x5f5a8b(++_0x2c5988);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x23cbd5,_0x5be6f3){var _0x3a6a6e=function(_0x5bceeb){while(--_0x5bceeb){_0x23cbd5['push'](_0x23cbd5['shift']());}};_0x3a6a6e(++_0x5be6f3);}(_0x70e0,0x17b));var _0x070e=function(_0x165dac,_0x3d15c7){_0x165dac=_0x165dac-0x0;var _0x1b7011=_0x70e0[_0x165dac];return _0x1b7011;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 465c78e..82b3e37 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 _0x3fe1=['INTEGER','exports'];(function(_0x29874a,_0x134554){var _0x56ea85=function(_0x2cefd9){while(--_0x2cefd9){_0x29874a['push'](_0x29874a['shift']());}};_0x56ea85(++_0x134554);}(_0x3fe1,0x89));var _0x13fe=function(_0x46e072,_0x13e36f){_0x46e072=_0x46e072-0x0;var _0x15d7ea=_0x3fe1[_0x46e072];return _0x15d7ea;};'use strict';var Sequelize=require('sequelize');module[_0x13fe('0x0')]={'penalty':{'type':Sequelize[_0x13fe('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6a6b=['sequelize','exports','INTEGER'];(function(_0x562071,_0x57a342){var _0x45db81=function(_0x3be628){while(--_0x3be628){_0x562071['push'](_0x562071['shift']());}};_0x45db81(++_0x57a342);}(_0x6a6b,0x165));var _0xb6a6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6a6b[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xb6a6('0x0'));module[_0xb6a6('0x1')]={'penalty':{'type':Sequelize[_0xb6a6('0x2')],'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 d71f25d..3febb1a 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 _0xd8fb=['lodash','util','../../config/logger','api','path','rimraf','./userSmsQueue.attributes','exports','UserSmsQueue'];(function(_0x5e5b54,_0x1a52c1){var _0x12616c=function(_0x2d9400){while(--_0x2d9400){_0x5e5b54['push'](_0x5e5b54['shift']());}};_0x12616c(++_0x1a52c1);}(_0xd8fb,0x99));var _0xbd8f=function(_0xf04526,_0x1a053c){_0xf04526=_0xf04526-0x0;var _0x4f6c53=_0xd8fb[_0xf04526];return _0x4f6c53;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserSmsQueue','user_has_sms_queues','lodash','util'];(function(_0x4b895c,_0x118019){var _0x425934=function(_0x5af51f){while(--_0x5af51f){_0x4b895c['push'](_0x4b895c['shift']());}};_0x425934(++_0x118019);}(_0xdb28,0x106));var _0x8db2=function(_0x55a01a,_0xa68175){_0x55a01a=_0x55a01a-0x0;var _0x2fe3fc=_0xdb28[_0x55a01a];return _0x2fe3fc;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./userSmsQueue.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index f46d0b7..6c6ba1a 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 _0xe273=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xe273,0x1e1));var _0x3e27=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xe273[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x3e27('0x0'));var util=require('util');var moment=require(_0x3e27('0x1'));var BPromise=require(_0x3e27('0x2'));var rs=require(_0x3e27('0x3'));var fs=require('fs');var Redis=require(_0x3e27('0x4'));var db=require(_0x3e27('0x5'))['db'];var utils=require(_0x3e27('0x6'));var logger=require(_0x3e27('0x7'))(_0x3e27('0x8'));var config=require(_0x3e27('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26133,_0xd22943,_0x33022f){return new BPromise(function(_0x125ff7,_0x59a980){return client[_0x3e27('0xa')](_0x26133,_0x33022f)[_0x3e27('0xb')](function(_0x26483e){logger['info'](_0x3e27('0xc'),_0xd22943,_0x3e27('0xd'));logger['debug'](_0x3e27('0xe'),_0xd22943,_0x3e27('0xd'),JSON[_0x3e27('0xf')](_0x26483e));if(_0x26483e[_0x3e27('0x10')]){if(_0x26483e['error'][_0x3e27('0x11')]===0x1f4){logger[_0x3e27('0x10')](_0x3e27('0xc'),_0xd22943,_0x26483e[_0x3e27('0x10')][_0x3e27('0x12')]);return _0x59a980(_0x26483e[_0x3e27('0x10')][_0x3e27('0x12')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0xd22943,_0x26483e[_0x3e27('0x10')][_0x3e27('0x12')]);return _0x125ff7(_0x26483e[_0x3e27('0x10')][_0x3e27('0x12')]);}else{logger['info'](_0x3e27('0xc'),_0xd22943,_0x3e27('0xd'));_0x125ff7(_0x26483e['result'][_0x3e27('0x12')]);}})[_0x3e27('0x13')](function(_0x220ac4){logger[_0x3e27('0x10')](_0x3e27('0xc'),_0xd22943,_0x220ac4);_0x59a980(_0x220ac4);});});} \ No newline at end of file +var _0xab4a=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x12273a,_0x20b902){var _0x57f970=function(_0x4420a5){while(--_0x4420a5){_0x12273a['push'](_0x12273a['shift']());}};_0x57f970(++_0x20b902);}(_0xab4a,0x1a1));var _0xaab4=function(_0x556634,_0x520958){_0x556634=_0x556634-0x0;var _0x4429fd=_0xab4a[_0x556634];return _0x4429fd;};'use strict';var _=require(_0xaab4('0x0'));var util=require(_0xaab4('0x1'));var moment=require('moment');var BPromise=require(_0xaab4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaab4('0x3'));var db=require(_0xaab4('0x4'))['db'];var utils=require(_0xaab4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xaab4('0x6'));var jayson=require(_0xaab4('0x7'));var client=jayson['client'][_0xaab4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14abde,_0x4e7fd2,_0x1bcb09){return new BPromise(function(_0x5b6206,_0x3076e6){return client[_0xaab4('0x9')](_0x14abde,_0x1bcb09)[_0xaab4('0xa')](function(_0xdc40b7){logger[_0xaab4('0xb')](_0xaab4('0xc'),_0x4e7fd2,_0xaab4('0xd'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x4e7fd2,_0xaab4('0xd'),JSON[_0xaab4('0xe')](_0xdc40b7));if(_0xdc40b7[_0xaab4('0xf')]){if(_0xdc40b7[_0xaab4('0xf')][_0xaab4('0x10')]===0x1f4){logger[_0xaab4('0xf')](_0xaab4('0xc'),_0x4e7fd2,_0xdc40b7[_0xaab4('0xf')][_0xaab4('0x11')]);return _0x3076e6(_0xdc40b7[_0xaab4('0xf')][_0xaab4('0x11')]);}logger[_0xaab4('0xf')](_0xaab4('0xc'),_0x4e7fd2,_0xdc40b7[_0xaab4('0xf')][_0xaab4('0x11')]);return _0x5b6206(_0xdc40b7['error'][_0xaab4('0x11')]);}else{logger[_0xaab4('0xb')](_0xaab4('0xc'),_0x4e7fd2,_0xaab4('0xd'));_0x5b6206(_0xdc40b7[_0xaab4('0x12')]['message']);}})[_0xaab4('0x13')](function(_0x1ca019){logger[_0xaab4('0xf')](_0xaab4('0xc'),_0x4e7fd2,_0x1ca019);_0x3076e6(_0x1ca019);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 71c350f..e181aff 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 _0x056c=['INTEGER','sequelize'];(function(_0x2fc4a9,_0x5706b8){var _0x4e15eb=function(_0x46a1d2){while(--_0x46a1d2){_0x2fc4a9['push'](_0x2fc4a9['shift']());}};_0x4e15eb(++_0x5706b8);}(_0x056c,0x169));var _0xc056=function(_0x3e1c7f,_0x2d927b){_0x3e1c7f=_0x3e1c7f-0x0;var _0x5f3213=_0x056c[_0x3e1c7f];return _0x5f3213;};'use strict';var Sequelize=require(_0xc056('0x0'));module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xc056('0x1')]}}; \ No newline at end of file +var _0x7b33=['sequelize','INTEGER'];(function(_0x1b8370,_0x1ec064){var _0x185053=function(_0x3e2a87){while(--_0x3e2a87){_0x1b8370['push'](_0x1b8370['shift']());}};_0x185053(++_0x1ec064);}(_0x7b33,0x1e2));var _0x37b3=function(_0x2dfff7,_0x4e54ee){_0x2dfff7=_0x2dfff7-0x0;var _0x434244=_0x7b33[_0x2dfff7];return _0x434244;};'use strict';var Sequelize=require(_0x37b3('0x0'));module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x37b3('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index c4c9678..a494eb9 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(_0x367f88,_0xcadc25){var _0x3e7fdc=function(_0x4f83bd){while(--_0x4f83bd){_0x367f88['push'](_0x367f88['shift']());}};_0x3e7fdc(++_0xcadc25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x2e4400,_0x5e46ac){var _0x2afa6c=function(_0x55de8c){while(--_0x55de8c){_0x2e4400['push'](_0x2e4400['shift']());}};_0x2afa6c(++_0x5e46ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 f490388..34aef38 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1e80f2,_0x59e814){var _0x5ba950=function(_0x15c817){while(--_0x15c817){_0x1e80f2['push'](_0x1e80f2['shift']());}};_0x5ba950(++_0x59e814);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x11f857,_0x4c8e73){var _0x297db8=function(_0x4f8d31){while(--_0x4f8d31){_0x11f857['push'](_0x11f857['shift']());}};_0x297db8(++_0x4c8e73);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x404957,_0x5192a4){_0x404957=_0x404957-0x0;var _0x4e0365=_0xcb91[_0x404957];return _0x4e0365;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index aa852a8..9006424 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 _0x7ad9=['exports','sequelize'];(function(_0x1b1b38,_0x35d4f8){var _0x261714=function(_0x2ee482){while(--_0x2ee482){_0x1b1b38['push'](_0x1b1b38['shift']());}};_0x261714(++_0x35d4f8);}(_0x7ad9,0x16f));var _0x97ad=function(_0x19903b,_0x31d728){_0x19903b=_0x19903b-0x0;var _0x15e613=_0x7ad9[_0x19903b];return _0x15e613;};'use strict';var Sequelize=require(_0x97ad('0x0'));module[_0x97ad('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index d6bf762..e0d2d70 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 _0x5c8d=['moment','bluebird','exports','define','UserVoiceQueue','user_has_voice_queues','../../config/logger'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x5c8d,0x1d4));var _0xd5c8=function(_0x5eaeb2,_0x58d795){_0x5eaeb2=_0x5eaeb2-0x0;var _0x22f111=_0x5c8d[_0x5eaeb2];return _0x22f111;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd5c8('0x0'))('api');var moment=require(_0xd5c8('0x1'));var BPromise=require(_0xd5c8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0xd5c8('0x3')]=function(_0x3ebd9f,_0x101ed5){return _0x3ebd9f[_0xd5c8('0x4')](_0xd5c8('0x5'),attributes,{'tableName':_0xd5c8('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8373=['api','moment','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','../../config/logger'];(function(_0x2215d2,_0x563782){var _0x2bb13a=function(_0x1bb042){while(--_0x1bb042){_0x2215d2['push'](_0x2215d2['shift']());}};_0x2bb13a(++_0x563782);}(_0x8373,0x1e2));var _0x3837=function(_0x403490,_0x41d621){_0x403490=_0x403490-0x0;var _0x3ab7c9=_0x8373[_0x403490];return _0x3ab7c9;};'use strict';var _=require(_0x3837('0x0'));var util=require('util');var logger=require(_0x3837('0x1'))(_0x3837('0x2'));var moment=require(_0x3837('0x3'));var BPromise=require('bluebird');var rp=require(_0x3837('0x4'));var fs=require('fs');var path=require(_0x3837('0x5'));var rimraf=require('rimraf');var config=require(_0x3837('0x6'));var attributes=require(_0x3837('0x7'));module[_0x3837('0x8')]=function(_0x22b18a,_0x5846d6){return _0x22b18a[_0x3837('0x9')]('UserVoiceQueue',attributes,{'tableName':_0x3837('0xa'),'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 6a12601..a9d9bf5 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 _0x600b=['debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','result','message','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0xaf6afd,_0x1e3e72){var _0x281d5f=function(_0x1859a9){while(--_0x1859a9){_0xaf6afd['push'](_0xaf6afd['shift']());}};_0x281d5f(++_0x1e3e72);}(_0x600b,0x75));var _0xb600=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x600b[_0x256d6a];return _0x460058;};'use strict';var _=require(_0xb600('0x0'));var util=require(_0xb600('0x1'));var moment=require('moment');var BPromise=require(_0xb600('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb600('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb600('0x4'));var logger=require(_0xb600('0x5'))(_0xb600('0x6'));var config=require(_0xb600('0x7'));var jayson=require(_0xb600('0x8'));var client=jayson[_0xb600('0x9')][_0xb600('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33ec6c,_0x43d641,_0xe79365){return new BPromise(function(_0x2eb067,_0x41da22){return client[_0xb600('0xb')](_0x33ec6c,_0xe79365)['then'](function(_0x19efbe){logger[_0xb600('0xc')](_0xb600('0xd'),_0x43d641,_0xb600('0xe'));logger[_0xb600('0xf')](_0xb600('0x10'),_0x43d641,_0xb600('0xe'),JSON[_0xb600('0x11')](_0x19efbe));if(_0x19efbe[_0xb600('0x12')]){if(_0x19efbe['error'][_0xb600('0x13')]===0x1f4){logger['error'](_0xb600('0xd'),_0x43d641,_0x19efbe[_0xb600('0x12')]['message']);return _0x41da22(_0x19efbe['error']['message']);}logger[_0xb600('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x43d641,_0x19efbe[_0xb600('0x12')]['message']);return _0x2eb067(_0x19efbe['error']['message']);}else{logger[_0xb600('0xc')](_0xb600('0xd'),_0x43d641,_0xb600('0xe'));_0x2eb067(_0x19efbe[_0xb600('0x14')][_0xb600('0x15')]);}})['catch'](function(_0x7cc2cb){logger[_0xb600('0x12')](_0xb600('0xd'),_0x43d641,_0x7cc2cb);_0x41da22(_0x7cc2cb);});});} \ No newline at end of file +var _0x4539=['error','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x4539,0x1d1));var _0x9453=function(_0x2206f0,_0x489836){_0x2206f0=_0x2206f0-0x0;var _0xab8693=_0x4539[_0x2206f0];return _0xab8693;};'use strict';var _=require('lodash');var util=require(_0x9453('0x0'));var moment=require('moment');var BPromise=require(_0x9453('0x1'));var rs=require(_0x9453('0x2'));var fs=require('fs');var Redis=require(_0x9453('0x3'));var db=require(_0x9453('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9453('0x5'))(_0x9453('0x6'));var config=require(_0x9453('0x7'));var jayson=require(_0x9453('0x8'));var client=jayson[_0x9453('0x9')][_0x9453('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x164979,_0x4e2bca,_0xe7c6c1){return new BPromise(function(_0x1d68a3,_0x26d62d){return client[_0x9453('0xb')](_0x164979,_0xe7c6c1)[_0x9453('0xc')](function(_0x223246){logger[_0x9453('0xd')](_0x9453('0xe'),_0x4e2bca,_0x9453('0xf'));logger[_0x9453('0x10')](_0x9453('0x11'),_0x4e2bca,'request\x20sent',JSON[_0x9453('0x12')](_0x223246));if(_0x223246[_0x9453('0x13')]){if(_0x223246[_0x9453('0x13')]['code']===0x1f4){logger['error'](_0x9453('0xe'),_0x4e2bca,_0x223246['error'][_0x9453('0x14')]);return _0x26d62d(_0x223246[_0x9453('0x13')][_0x9453('0x14')]);}logger['error'](_0x9453('0xe'),_0x4e2bca,_0x223246[_0x9453('0x13')]['message']);return _0x1d68a3(_0x223246[_0x9453('0x13')][_0x9453('0x14')]);}else{logger[_0x9453('0xd')](_0x9453('0xe'),_0x4e2bca,'request\x20sent');_0x1d68a3(_0x223246['result'][_0x9453('0x14')]);}})[_0x9453('0x15')](function(_0x1b7d74){logger['error'](_0x9453('0xe'),_0x4e2bca,_0x1b7d74);_0x26d62d(_0x1b7d74);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index b8fd36c..8083ca3 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(_0x53c552,_0x129587){var _0x599000=function(_0x519b95){while(--_0x519b95){_0x53c552['push'](_0x53c552['shift']());}};_0x599000(++_0x129587);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'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(_0x56f935,_0xbb3e13){var _0x25ff2f=function(_0x3d0fad){while(--_0x3d0fad){_0x56f935['push'](_0x56f935['shift']());}};_0x25ff2f(++_0xbb3e13);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 9fbd70d..b6fb941 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 _0xd756=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','INTEGER'];(function(_0x3ae65b,_0x585ded){var _0x1a5ee5=function(_0x128dc7){while(--_0x128dc7){_0x3ae65b['push'](_0x3ae65b['shift']());}};_0x1a5ee5(++_0x585ded);}(_0xd756,0xa3));var _0x6d75=function(_0xc98e0a,_0x162114){_0xc98e0a=_0xc98e0a-0x0;var _0x49cc7b=_0xd756[_0xc98e0a];return _0x49cc7b;};'use strict';var Sequelize=require(_0x6d75('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6d75('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x6d75('0x2')},'membername':{'type':Sequelize[_0x6d75('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x6d75('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x6d75('0x3')],'allowNull':![],'unique':_0x6d75('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x6d75('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6d75('0x4'),'comment':_0x6d75('0x2')},'penalty':{'type':Sequelize[_0x6d75('0x1')](0xb),'defaultValue':0x0,'comment':_0x6d75('0x2')},'paused':{'type':Sequelize[_0x6d75('0x1')](0xb),'defaultValue':0x0,'comment':_0x6d75('0x2')}}; \ No newline at end of file +var _0x7003=['queue_interface','Required\x20by\x20Asterisk','STRING','INTEGER'];(function(_0x28226e,_0x1d53e4){var _0x472253=function(_0x49af92){while(--_0x49af92){_0x28226e['push'](_0x28226e['shift']());}};_0x472253(++_0x1d53e4);}(_0x7003,0x1ad));var _0x3700=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0x7003[_0x3f7598];return _0x51fb16;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3700('0x0')},'membername':{'type':Sequelize[_0x3700('0x1')],'allowNull':![],'comment':_0x3700('0x0')},'UserId':{'type':Sequelize[_0x3700('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3700('0x1')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x3700('0x1')],'allowNull':![],'unique':_0x3700('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x3700('0x2')](0xb),'defaultValue':0x0,'comment':_0x3700('0x0')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x3700('0x0')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index ec8c088..e1c36cb 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 _0x2a8c=['../../mysqldb','save','remove','hasOwnProperty','hook','exports','events'];(function(_0x3db02c,_0x3b24e1){var _0x4acdf5=function(_0x4a55f0){while(--_0x4a55f0){_0x3db02c['push'](_0x3db02c['shift']());}};_0x4acdf5(++_0x3b24e1);}(_0x2a8c,0x102));var _0xc2a8=function(_0x48452d,_0x558d15){_0x48452d=_0x48452d-0x0;var _0x49b469=_0x2a8c[_0x48452d];return _0x49b469;};'use strict';var EventEmitter=require(_0xc2a8('0x0'));var UserVoiceQueueRt=require(_0xc2a8('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc2a8('0x2'),'afterUpdate':'update','afterDestroy':_0xc2a8('0x3')};function emitEvent(_0x35634e){return function(_0x4a825f,_0x2c4d0c,_0xa1c9a8){UserVoiceQueueRtEvents['emit'](_0x35634e+':'+_0x4a825f['id'],_0x4a825f);UserVoiceQueueRtEvents['emit'](_0x35634e,_0x4a825f);_0xa1c9a8(null);};}for(var e in events){if(events[_0xc2a8('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0xc2a8('0x5')](e,emitEvent(event));}}module[_0xc2a8('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xadb5=['emit','hook','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xadb5,0x1d2));var _0x5adb=function(_0xdd31ef,_0x31f1fd){_0xdd31ef=_0xdd31ef-0x0;var _0x5295d3=_0xadb5[_0xdd31ef];return _0x5295d3;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':_0x5adb('0x3'),'afterUpdate':_0x5adb('0x4'),'afterDestroy':_0x5adb('0x5')};function emitEvent(_0x5c31d6){return function(_0x5d791f,_0x42c464,_0x425251){UserVoiceQueueRtEvents['emit'](_0x5c31d6+':'+_0x5d791f['id'],_0x5d791f);UserVoiceQueueRtEvents[_0x5adb('0x6')](_0x5c31d6,_0x5d791f);_0x425251(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x5adb('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 4887d37..8e1ad02 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 _0x20d4=['api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','util','../../config/logger'];(function(_0x4e7551,_0x398ee5){var _0x2c2ae8=function(_0x31f000){while(--_0x31f000){_0x4e7551['push'](_0x4e7551['shift']());}};_0x2c2ae8(++_0x398ee5);}(_0x20d4,0x1aa));var _0x420d=function(_0x28f8d5,_0x3f3529){_0x28f8d5=_0x28f8d5-0x0;var _0x4f61a9=_0x20d4[_0x28f8d5];return _0x4f61a9;};'use strict';var _=require(_0x420d('0x0'));var util=require(_0x420d('0x1'));var logger=require(_0x420d('0x2'))(_0x420d('0x3'));var moment=require(_0x420d('0x4'));var BPromise=require(_0x420d('0x5'));var rp=require(_0x420d('0x6'));var fs=require('fs');var path=require(_0x420d('0x7'));var rimraf=require(_0x420d('0x8'));var config=require('../../config/environment');var attributes=require(_0x420d('0x9'));module[_0x420d('0xa')]=function(_0x36ecdc,_0x2f3768){return _0x36ecdc[_0x420d('0xb')](_0x420d('0xc'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0ed=['./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1cf41d,_0x5f05b8){var _0x46cea5=function(_0x4da8d5){while(--_0x4da8d5){_0x1cf41d['push'](_0x1cf41d['shift']());}};_0x46cea5(++_0x5f05b8);}(_0xb0ed,0x1a4));var _0xdb0e=function(_0x38bd26,_0x58347e){_0x38bd26=_0x38bd26-0x0;var _0x411bcc=_0xb0ed[_0x38bd26];return _0x411bcc;};'use strict';var _=require(_0xdb0e('0x0'));var util=require(_0xdb0e('0x1'));var logger=require(_0xdb0e('0x2'))(_0xdb0e('0x3'));var moment=require('moment');var BPromise=require(_0xdb0e('0x4'));var rp=require(_0xdb0e('0x5'));var fs=require('fs');var path=require(_0xdb0e('0x6'));var rimraf=require(_0xdb0e('0x7'));var config=require(_0xdb0e('0x8'));var attributes=require(_0xdb0e('0x9'));module[_0xdb0e('0xa')]=function(_0xe9793c,_0x36ac29){return _0xe9793c[_0xdb0e('0xb')](_0xdb0e('0xc'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 7ed8d58..e8ab094 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 _0xb92a=['UserVoiceQueueRt,\x20%s,\x20%s','message','info','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','then','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x128bf8,_0x19b03b){var _0x1a28d3=function(_0x3ea3bf){while(--_0x3ea3bf){_0x128bf8['push'](_0x128bf8['shift']());}};_0x1a28d3(++_0x19b03b);}(_0xb92a,0x10a));var _0xab92=function(_0x2deb73,_0x1228f9){_0x2deb73=_0x2deb73-0x0;var _0x4e2da5=_0xb92a[_0x2deb73];return _0x4e2da5;};'use strict';var _=require(_0xab92('0x0'));var util=require(_0xab92('0x1'));var moment=require(_0xab92('0x2'));var BPromise=require(_0xab92('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab92('0x4'));var logger=require(_0xab92('0x5'))(_0xab92('0x6'));var config=require(_0xab92('0x7'));var jayson=require(_0xab92('0x8'));var client=jayson[_0xab92('0x9')][_0xab92('0xa')]({'port':0x232a});config[_0xab92('0xb')]=_[_0xab92('0xc')](config['redis'],{'host':_0xab92('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xab92('0xe'))[_0xab92('0xf')](socket);function respondWithRpcPromise(_0x507458,_0xd5043e,_0x70d1d8){return new BPromise(function(_0xe4105f,_0x1cd4ea){return client['request'](_0x507458,_0x70d1d8)[_0xab92('0x10')](function(_0x12a455){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0xd5043e,_0xab92('0x11'));logger[_0xab92('0x12')](_0xab92('0x13'),_0xd5043e,'request\x20sent',JSON[_0xab92('0x14')](_0x12a455));if(_0x12a455['error']){if(_0x12a455['error']['code']===0x1f4){logger[_0xab92('0x15')](_0xab92('0x16'),_0xd5043e,_0x12a455[_0xab92('0x15')][_0xab92('0x17')]);return _0x1cd4ea(_0x12a455[_0xab92('0x15')]['message']);}logger[_0xab92('0x15')](_0xab92('0x16'),_0xd5043e,_0x12a455[_0xab92('0x15')]['message']);return _0xe4105f(_0x12a455[_0xab92('0x15')]['message']);}else{logger[_0xab92('0x18')](_0xab92('0x16'),_0xd5043e,'request\x20sent');_0xe4105f(_0x12a455[_0xab92('0x19')]['message']);}})['catch'](function(_0x3d9cca){logger['error'](_0xab92('0x16'),_0xd5043e,_0x3d9cca);_0x1cd4ea(_0x3d9cca);});});}exports[_0xab92('0x1a')]=function(_0x3a9f11){var _0x2984e3=this;return new Promise(function(_0x522732,_0xdae58f){return db[_0xab92('0x1b')][_0xab92('0x1c')]({'raw':_0x3a9f11['options']?_0x3a9f11[_0xab92('0x1d')][_0xab92('0x1e')]===undefined?!![]:![]:!![],'where':_0x3a9f11[_0xab92('0x1d')]?_0x3a9f11[_0xab92('0x1d')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xab92('0x1f')]['fn']('IF',db[_0xab92('0x1f')][_0xab92('0x20')](_0xab92('0x21')))),_0xab92('0x22')]]})[_0xab92('0x10')](function(_0x5c151d){logger[_0xab92('0x18')](_0xab92('0x1a'),_0x3a9f11);logger[_0xab92('0x12')]('GetVoiceQueueRtPauses',_0x3a9f11,JSON[_0xab92('0x14')](_0x5c151d));_0x522732(_0x5c151d);})[_0xab92('0x23')](function(_0x3344e2){logger[_0xab92('0x15')]('GetVoiceQueueRtPauses',_0x3344e2[_0xab92('0x17')],_0x3a9f11);_0xdae58f(_0x2984e3['error'](0x1f4,_0x3344e2[_0xab92('0x17')]));});});}; \ No newline at end of file +var _0x4448=['raw','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','UserVoiceQueueRt','findAll','options'];(function(_0x2b2cc3,_0x264057){var _0x5920a4=function(_0x423107){while(--_0x423107){_0x2b2cc3['push'](_0x2b2cc3['shift']());}};_0x5920a4(++_0x264057);}(_0x4448,0x1b7));var _0x8444=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4448[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x8444('0x0'));var moment=require(_0x8444('0x1'));var BPromise=require('bluebird');var rs=require(_0x8444('0x2'));var fs=require('fs');var Redis=require(_0x8444('0x3'));var db=require(_0x8444('0x4'))['db'];var utils=require(_0x8444('0x5'));var logger=require(_0x8444('0x6'))(_0x8444('0x7'));var config=require(_0x8444('0x8'));var jayson=require(_0x8444('0x9'));var client=jayson[_0x8444('0xa')]['http']({'port':0x232a});config[_0x8444('0xb')]=_['defaults'](config[_0x8444('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8444('0xc'))(new Redis(config[_0x8444('0xb')]));require(_0x8444('0xd'))[_0x8444('0xe')](socket);function respondWithRpcPromise(_0xeb9e5c,_0x3e34e2,_0x4273db){return new BPromise(function(_0x200283,_0x2f89f7){return client['request'](_0xeb9e5c,_0x4273db)[_0x8444('0xf')](function(_0x142d1f){logger['info'](_0x8444('0x10'),_0x3e34e2,_0x8444('0x11'));logger[_0x8444('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x3e34e2,'request\x20sent',JSON[_0x8444('0x13')](_0x142d1f));if(_0x142d1f[_0x8444('0x14')]){if(_0x142d1f['error'][_0x8444('0x15')]===0x1f4){logger['error'](_0x8444('0x10'),_0x3e34e2,_0x142d1f[_0x8444('0x14')][_0x8444('0x16')]);return _0x2f89f7(_0x142d1f[_0x8444('0x14')][_0x8444('0x16')]);}logger[_0x8444('0x14')](_0x8444('0x10'),_0x3e34e2,_0x142d1f[_0x8444('0x14')][_0x8444('0x16')]);return _0x200283(_0x142d1f[_0x8444('0x14')][_0x8444('0x16')]);}else{logger[_0x8444('0x17')](_0x8444('0x10'),_0x3e34e2,_0x8444('0x11'));_0x200283(_0x142d1f[_0x8444('0x18')][_0x8444('0x16')]);}})[_0x8444('0x19')](function(_0x1da9dd){logger[_0x8444('0x14')](_0x8444('0x10'),_0x3e34e2,_0x1da9dd);_0x2f89f7(_0x1da9dd);});});}exports['GetVoiceQueueRtPauses']=function(_0xd4fbb){var _0x19b3c5=this;return new Promise(function(_0x13bfa2,_0x65f080){return db[_0x8444('0x1a')][_0x8444('0x1b')]({'raw':_0xd4fbb[_0x8444('0x1c')]?_0xd4fbb[_0x8444('0x1c')][_0x8444('0x1d')]===undefined?!![]:![]:!![],'where':_0xd4fbb[_0x8444('0x1c')]?_0xd4fbb['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x8444('0x1e'),db[_0x8444('0x1f')]['fn']('IF',db[_0x8444('0x1f')][_0x8444('0x20')](_0x8444('0x21')))),_0x8444('0x22')]]})[_0x8444('0xf')](function(_0x363f8f){logger['info']('GetVoiceQueueRtPauses',_0xd4fbb);logger[_0x8444('0x12')](_0x8444('0x23'),_0xd4fbb,JSON[_0x8444('0x13')](_0x363f8f));_0x13bfa2(_0x363f8f);})[_0x8444('0x19')](function(_0x1822be){logger[_0x8444('0x14')](_0x8444('0x23'),_0x1822be[_0x8444('0x16')],_0xd4fbb);_0x65f080(_0x19b3c5[_0x8444('0x14')](0x1f4,_0x1822be[_0x8444('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 2c29840..48cecec 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 _0xd7c3=['update','emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0x4638a0,_0x232ab6){var _0x26b1ed=function(_0x487376){while(--_0x487376){_0x4638a0['push'](_0x4638a0['shift']());}};_0x26b1ed(++_0x232ab6);}(_0xd7c3,0x1c5));var _0x3d7c=function(_0x1fafbb,_0xc5082f){_0x1fafbb=_0x1fafbb-0x0;var _0x4b5877=_0xd7c3[_0x1fafbb];return _0x4b5877;};'use strict';var UserVoiceQueueRtEvents=require(_0x3d7c('0x0'));var events=[_0x3d7c('0x1'),_0x3d7c('0x2'),_0x3d7c('0x3')];function createListener(_0x2ff255,_0x1d618e){return function(_0x4ad9fe){_0x1d618e[_0x3d7c('0x4')](_0x2ff255,_0x4ad9fe);};}function removeListener(_0x22396c,_0x538ca7){return function(){UserVoiceQueueRtEvents[_0x3d7c('0x5')](_0x22396c,_0x538ca7);};}exports['register']=function(_0x52b31c){for(var _0x504e04=0x0,_0xeccebe=events[_0x3d7c('0x6')];_0x504e04<_0xeccebe;_0x504e04++){var _0x3416dd=events[_0x504e04];var _0x2bd736=createListener(_0x3d7c('0x7')+_0x3416dd,_0x52b31c);UserVoiceQueueRtEvents['on'](_0x3416dd,_0x2bd736);}}; \ No newline at end of file +var _0xd991=['update','emit','removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0xbe1d92,_0x418279){var _0x470ca3=function(_0x154d06){while(--_0x154d06){_0xbe1d92['push'](_0xbe1d92['shift']());}};_0x470ca3(++_0x418279);}(_0xd991,0x115));var _0x1d99=function(_0x6b19b6,_0x11b664){_0x6b19b6=_0x6b19b6-0x0;var _0x503f75=_0xd991[_0x6b19b6];return _0x503f75;};'use strict';var UserVoiceQueueRtEvents=require(_0x1d99('0x0'));var events=[_0x1d99('0x1'),_0x1d99('0x2'),_0x1d99('0x3')];function createListener(_0x163bfb,_0x5e7e82){return function(_0x3676c1){_0x5e7e82[_0x1d99('0x4')](_0x163bfb,_0x3676c1);};}function removeListener(_0xf03459,_0x1f6da3){return function(){UserVoiceQueueRtEvents[_0x1d99('0x5')](_0xf03459,_0x1f6da3);};}exports[_0x1d99('0x6')]=function(_0x5f3a37){for(var _0x1adbca=0x0,_0x440bb4=events['length'];_0x1adbca<_0x440bb4;_0x1adbca++){var _0x21d746=events[_0x1adbca];var _0x2f4502=createListener(_0x1d99('0x7')+_0x21d746,_0x5f3a37);UserVoiceQueueRtEvents['on'](_0x21d746,_0x2f4502);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index a4528fb..8bf39ff 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x305011,_0x2c6fa0){var _0x345f64=function(_0x2d2946){while(--_0x2d2946){_0x305011['push'](_0x305011['shift']());}};_0x345f64(++_0x2c6fa0);}(_0xe706,0xa3));var _0x6e70=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe706[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2766b5,_0x4dd625){var _0x4b32d9=function(_0x588d05){while(--_0x588d05){_0x2766b5['push'](_0x2766b5['shift']());}};_0x4b32d9(++_0x4dd625);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 4c30db7..9444cc4 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 _0x3021=['sequelize','INTEGER'];(function(_0x53a8bf,_0x59b79f){var _0x1cee30=function(_0xbeb8e){while(--_0xbeb8e){_0x53a8bf['push'](_0x53a8bf['shift']());}};_0x1cee30(++_0x59b79f);}(_0x3021,0x1b0));var _0x1302=function(_0x3e3281,_0x56f2e9){_0x3e3281=_0x3e3281-0x0;var _0x37dd8f=_0x3021[_0x3e3281];return _0x37dd8f;};'use strict';var Sequelize=require(_0x1302('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x1302('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7d3e=['INTEGER','sequelize','exports'];(function(_0x4b9d37,_0x356052){var _0x30cf4e=function(_0x24f502){while(--_0x24f502){_0x4b9d37['push'](_0x4b9d37['shift']());}};_0x30cf4e(++_0x356052);}(_0x7d3e,0x178));var _0xe7d3=function(_0x9e55f6,_0x5df434){_0x9e55f6=_0x9e55f6-0x0;var _0x220e55=_0x7d3e[_0x9e55f6];return _0x220e55;};'use strict';var Sequelize=require(_0xe7d3('0x0'));module[_0xe7d3('0x1')]={'penalty':{'type':Sequelize[_0xe7d3('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 cd7a589..ae7f047 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 _0xc10f=['user_has_whatsapp_queues','util','bluebird','path','../../config/environment','./userWhatsappQueue.attributes','UserWhatsappQueue'];(function(_0x7c8c4e,_0x4c117c){var _0x13430e=function(_0x1e38cc){while(--_0x1e38cc){_0x7c8c4e['push'](_0x7c8c4e['shift']());}};_0x13430e(++_0x4c117c);}(_0xc10f,0x197));var _0xfc10=function(_0x38d6e8,_0x3fd366){_0x38d6e8=_0x38d6e8-0x0;var _0x1d3ff6=_0xc10f[_0x38d6e8];return _0x1d3ff6;};'use strict';var _=require('lodash');var util=require(_0xfc10('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfc10('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc10('0x2'));var rimraf=require('rimraf');var config=require(_0xfc10('0x3'));var attributes=require(_0xfc10('0x4'));module['exports']=function(_0x36fd60,_0x1db534){return _0x36fd60['define'](_0xfc10('0x5'),attributes,{'tableName':_0xfc10('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x035d=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue'];(function(_0x37283b,_0x2e3c63){var _0x2ad2ec=function(_0x1530e9){while(--_0x1530e9){_0x37283b['push'](_0x37283b['shift']());}};_0x2ad2ec(++_0x2e3c63);}(_0x035d,0x14a));var _0xd035=function(_0x2b72eb,_0x2c8f01){_0x2b72eb=_0x2b72eb-0x0;var _0x1a3a9b=_0x035d[_0x2b72eb];return _0x1a3a9b;};'use strict';var _=require('lodash');var util=require(_0xd035('0x0'));var logger=require(_0xd035('0x1'))(_0xd035('0x2'));var moment=require(_0xd035('0x3'));var BPromise=require(_0xd035('0x4'));var rp=require(_0xd035('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd035('0x6'));var config=require('../../config/environment');var attributes=require(_0xd035('0x7'));module[_0xd035('0x8')]=function(_0x52a523,_0x57958b){return _0x52a523[_0xd035('0x9')](_0xd035('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','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 622c1f2..9f46e37 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 _0x1d60=['UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x1d60,0x160));var _0x01d6=function(_0x106216,_0x3ea0fd){_0x106216=_0x106216-0x0;var _0xb37a3e=_0x1d60[_0x106216];return _0xb37a3e;};'use strict';var _=require(_0x01d6('0x0'));var util=require(_0x01d6('0x1'));var moment=require(_0x01d6('0x2'));var BPromise=require(_0x01d6('0x3'));var rs=require(_0x01d6('0x4'));var fs=require('fs');var Redis=require(_0x01d6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x01d6('0x6'));var logger=require(_0x01d6('0x7'))(_0x01d6('0x8'));var config=require(_0x01d6('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x01d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fa70f,_0x3b19c9,_0x2e0a0b){return new BPromise(function(_0x4b2267,_0x576e7d){return client['request'](_0x2fa70f,_0x2e0a0b)[_0x01d6('0xb')](function(_0x5c7782){logger[_0x01d6('0xc')](_0x01d6('0xd'),_0x3b19c9,_0x01d6('0xe'));logger[_0x01d6('0xf')](_0x01d6('0x10'),_0x3b19c9,_0x01d6('0xe'),JSON[_0x01d6('0x11')](_0x5c7782));if(_0x5c7782[_0x01d6('0x12')]){if(_0x5c7782['error'][_0x01d6('0x13')]===0x1f4){logger[_0x01d6('0x12')](_0x01d6('0xd'),_0x3b19c9,_0x5c7782[_0x01d6('0x12')][_0x01d6('0x14')]);return _0x576e7d(_0x5c7782[_0x01d6('0x12')][_0x01d6('0x14')]);}logger[_0x01d6('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3b19c9,_0x5c7782[_0x01d6('0x12')][_0x01d6('0x14')]);return _0x4b2267(_0x5c7782[_0x01d6('0x12')][_0x01d6('0x14')]);}else{logger[_0x01d6('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3b19c9,_0x01d6('0xe'));_0x4b2267(_0x5c7782[_0x01d6('0x15')][_0x01d6('0x14')]);}})[_0x01d6('0x16')](function(_0x5ad805){logger[_0x01d6('0x12')](_0x01d6('0xd'),_0x3b19c9,_0x5ad805);_0x576e7d(_0x5ad805);});});} \ No newline at end of file +var _0x266b=['http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','message','error','info','result','catch','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','client'];(function(_0x22d696,_0x359d98){var _0x4f583b=function(_0x2764b7){while(--_0x2764b7){_0x22d696['push'](_0x22d696['shift']());}};_0x4f583b(++_0x359d98);}(_0x266b,0x1c1));var _0xb266=function(_0x5442ab,_0x3e4b10){_0x5442ab=_0x5442ab-0x0;var _0x1be600=_0x266b[_0x5442ab];return _0x1be600;};'use strict';var _=require('lodash');var util=require(_0xb266('0x0'));var moment=require(_0xb266('0x1'));var BPromise=require('bluebird');var rs=require(_0xb266('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb266('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb266('0x4'));var config=require(_0xb266('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb266('0x6')][_0xb266('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x288615,_0x50922f,_0x128dd7){return new BPromise(function(_0x2e44ca,_0x21d6a7){return client[_0xb266('0x8')](_0x288615,_0x128dd7)[_0xb266('0x9')](function(_0x366195){logger['info'](_0xb266('0xa'),_0x50922f,_0xb266('0xb'));logger[_0xb266('0xc')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x50922f,_0xb266('0xb'),JSON[_0xb266('0xd')](_0x366195));if(_0x366195['error']){if(_0x366195['error']['code']===0x1f4){logger['error'](_0xb266('0xa'),_0x50922f,_0x366195['error'][_0xb266('0xe')]);return _0x21d6a7(_0x366195['error'][_0xb266('0xe')]);}logger['error'](_0xb266('0xa'),_0x50922f,_0x366195[_0xb266('0xf')][_0xb266('0xe')]);return _0x2e44ca(_0x366195['error']['message']);}else{logger[_0xb266('0x10')](_0xb266('0xa'),_0x50922f,_0xb266('0xb'));_0x2e44ca(_0x366195[_0xb266('0x11')][_0xb266('0xe')]);}})[_0xb266('0x12')](function(_0x516712){logger[_0xb266('0xf')](_0xb266('0xa'),_0x50922f,_0x516712);_0x21d6a7(_0x516712);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index d88c60d..7420c7b 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 _0x0506=['exports','multer','util','path','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy'];(function(_0x40ec8b,_0x447ec4){var _0x313650=function(_0x48e999){while(--_0x48e999){_0x40ec8b['push'](_0x40ec8b['shift']());}};_0x313650(++_0x447ec4);}(_0x0506,0x1d1));var _0x6050=function(_0x58ad78,_0x52cdca){_0x58ad78=_0x58ad78-0x0;var _0x39ce43=_0x0506[_0x58ad78];return _0x39ce43;};'use strict';var multer=require(_0x6050('0x0'));var util=require(_0x6050('0x1'));var path=require(_0x6050('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6050('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6050('0x4'));var controller=require('./variable.controller');router['get']('/',auth[_0x6050('0x5')](),controller[_0x6050('0x6')]);router[_0x6050('0x7')](_0x6050('0x8'),auth[_0x6050('0x5')](),controller[_0x6050('0x9')]);router[_0x6050('0xa')]('/',auth[_0x6050('0x5')](),controller['create']);router[_0x6050('0xb')]('/:id',auth[_0x6050('0x5')](),controller[_0x6050('0xc')]);router[_0x6050('0xd')](_0x6050('0x8'),auth[_0x6050('0x5')](),controller[_0x6050('0xe')]);module[_0x6050('0xf')]=router; \ No newline at end of file +var _0x2060=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./variable.controller','isAuthenticated','index','/:id','post','create'];(function(_0x9c937b,_0x4eb080){var _0x4af964=function(_0x183955){while(--_0x183955){_0x9c937b['push'](_0x9c937b['shift']());}};_0x4af964(++_0x4eb080);}(_0x2060,0x1be));var _0x0206=function(_0x359609,_0x16dff3){_0x359609=_0x359609-0x0;var _0x2b4fbc=_0x2060[_0x359609];return _0x2b4fbc;};'use strict';var multer=require(_0x0206('0x0'));var util=require('util');var path=require(_0x0206('0x1'));var timeout=require(_0x0206('0x2'));var express=require(_0x0206('0x3'));var router=express[_0x0206('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0206('0x5'));var interaction=require(_0x0206('0x6'));var config=require('../../config/environment');var controller=require(_0x0206('0x7'));router['get']('/',auth[_0x0206('0x8')](),controller[_0x0206('0x9')]);router['get'](_0x0206('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0206('0xb')]('/',auth[_0x0206('0x8')](),controller[_0x0206('0xc')]);router[_0x0206('0xd')](_0x0206('0xa'),auth[_0x0206('0x8')](),controller[_0x0206('0xe')]);router[_0x0206('0xf')](_0x0206('0xa'),auth[_0x0206('0x8')](),controller[_0x0206('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 66520e4..c7326d6 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 _0x0694=['exports','name','STRING','sequelize'];(function(_0x4b6507,_0x5518b5){var _0x2001ec=function(_0x330ddf){while(--_0x330ddf){_0x4b6507['push'](_0x4b6507['shift']());}};_0x2001ec(++_0x5518b5);}(_0x0694,0x183));var _0x4069=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x0694[_0x4bfac3];return _0x15f0f2;};'use strict';var Sequelize=require(_0x4069('0x0'));module[_0x4069('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4069('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4069('0x3')]}}; \ No newline at end of file +var _0xc631=['name','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc631,0x82));var _0x1c63=function(_0x482354,_0x3dc153){_0x482354=_0x482354-0x0;var _0xdbd261=_0xc631[_0x482354];return _0xdbd261;};'use strict';var Sequelize=require('sequelize');module[_0x1c63('0x0')]={'name':{'type':Sequelize[_0x1c63('0x1')],'unique':_0x1c63('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1c63('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 8fb9d52..3c3213b 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 _0x04eb=['create','body','user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','get','Variables','UserProfileResource','destroy','then','error','stack','name','send','index','map','Variable','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','length','includeAll','find'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x04eb,0x14f));var _0xb04e=function(_0x2aff23,_0xaeeb2d){_0x2aff23=_0x2aff23-0x0;var _0x42663c=_0x04eb[_0x2aff23];return _0x42663c;};'use strict';var emlformat=require(_0xb04e('0x0'));var rimraf=require(_0xb04e('0x1'));var zipdir=require(_0xb04e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb04e('0x3'));var moment=require(_0xb04e('0x4'));var BPromise=require(_0xb04e('0x5'));var Mustache=require(_0xb04e('0x6'));var util=require(_0xb04e('0x7'));var path=require(_0xb04e('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb04e('0x9'));var fs=require('fs');var fs_extra=require(_0xb04e('0xa'));var _=require(_0xb04e('0xb'));var squel=require('squel');var crypto=require(_0xb04e('0xc'));var jsforce=require(_0xb04e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb04e('0xe'));var querystring=require(_0xb04e('0xf'));var Papa=require(_0xb04e('0x10'));var Redis=require('ioredis');var authService=require(_0xb04e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb04e('0x12'));var hardwareService=require(_0xb04e('0x13'));var logger=require(_0xb04e('0x14'))('api');var utils=require(_0xb04e('0x15'));var config=require(_0xb04e('0x16'));var licenseUtil=require(_0xb04e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f96f6,_0x3f1b51){_0x3f1b51=_0x3f1b51||0xcc;return function(_0xa90e0e){if(_0xa90e0e){return _0x4f96f6['sendStatus'](_0x3f1b51);}return _0x4f96f6[_0xb04e('0x18')](_0x3f1b51)[_0xb04e('0x19')]();};}function respondWithResult(_0x42e120,_0x59df49){_0x59df49=_0x59df49||0xc8;return function(_0x4e0516){if(_0x4e0516){return _0x42e120['status'](_0x59df49)[_0xb04e('0x1a')](_0x4e0516);}};}function respondWithFilteredResult(_0x57b90f,_0x292529){return function(_0x14198d){if(_0x14198d){var _0x423831=typeof _0x292529[_0xb04e('0x1b')]===_0xb04e('0x1c')&&typeof _0x292529[_0xb04e('0x1d')]===_0xb04e('0x1c');var _0x1a50ea=_0x14198d[_0xb04e('0x1e')];var _0xeae156=_0x423831?0x0:_0x292529[_0xb04e('0x1b')];var _0x4b63b6=_0x423831?_0x14198d[_0xb04e('0x1e')]:_0x292529[_0xb04e('0x1b')]+_0x292529['limit'];var _0x44c17e;if(_0x4b63b6>=_0x1a50ea){_0x4b63b6=_0x1a50ea;_0x44c17e=0xc8;}else{_0x44c17e=0xce;}_0x57b90f[_0xb04e('0x18')](_0x44c17e);return _0x57b90f['set'](_0xb04e('0x1f'),_0xeae156+'-'+_0x4b63b6+'/'+_0x1a50ea)[_0xb04e('0x1a')](_0x14198d);}return null;};}function patchUpdates(_0x390bcb){return function(_0x50f334){try{jsonpatch[_0xb04e('0x20')](_0x50f334,_0x390bcb,!![]);}catch(_0x478ac2){return BPromise['reject'](_0x478ac2);}return _0x50f334[_0xb04e('0x21')]();};}function saveUpdates(_0x5d01d6,_0x368dfc){return function(_0x487710){if(_0x487710){return _0x487710[_0xb04e('0x22')](_0x5d01d6)['then'](function(_0x53a50e){return _0x53a50e;});}return null;};}function removeEntity(_0x55e826,_0x20ea96){return function(_0x3a7dd3){if(_0x3a7dd3){return _0x3a7dd3['destroy']()['then'](function(){var _0x76669a=_0x3a7dd3[_0xb04e('0x23')]({'plain':!![]});var _0x571b5e=_0xb04e('0x24');return db[_0xb04e('0x25')][_0xb04e('0x26')]({'where':{'type':_0x571b5e,'resourceId':_0x76669a['id']}})[_0xb04e('0x27')](function(){return _0x3a7dd3;});})[_0xb04e('0x27')](function(){_0x55e826[_0xb04e('0x18')](0xcc)[_0xb04e('0x19')]();});}};}function handleEntityNotFound(_0x427cd7,_0x12d5a3){return function(_0xa93a5a){if(!_0xa93a5a){_0x427cd7['sendStatus'](0x194);}return _0xa93a5a;};}function handleError(_0x1a58db,_0x49cd80){_0x49cd80=_0x49cd80||0x1f4;return function(_0x5ecacd){logger[_0xb04e('0x28')](_0x5ecacd[_0xb04e('0x29')]);if(_0x5ecacd[_0xb04e('0x2a')]){delete _0x5ecacd['name'];}_0x1a58db[_0xb04e('0x18')](_0x49cd80)[_0xb04e('0x2b')](_0x5ecacd);};}exports[_0xb04e('0x2c')]=function(_0x43e9cb,_0x7e78da){var _0xebb127={},_0x18f70a={},_0x48f028={'count':0x0,'rows':[]};var _0x146f85=_[_0xb04e('0x2d')](db[_0xb04e('0x2e')][_0xb04e('0x2f')],function(_0x4dc4f8){return{'name':_0x4dc4f8['fieldName'],'type':_0x4dc4f8[_0xb04e('0x30')][_0xb04e('0x31')]};});_0x18f70a[_0xb04e('0x32')]=_['map'](_0x146f85,'name');_0x18f70a['query']=_[_0xb04e('0x33')](_0x43e9cb[_0xb04e('0x34')]);_0x18f70a[_0xb04e('0x35')]=_[_0xb04e('0x36')](_0x18f70a[_0xb04e('0x32')],_0x18f70a[_0xb04e('0x34')]);_0xebb127[_0xb04e('0x37')]=_['intersection'](_0x18f70a[_0xb04e('0x32')],qs[_0xb04e('0x38')](_0x43e9cb[_0xb04e('0x34')][_0xb04e('0x38')]));_0xebb127[_0xb04e('0x37')]=_0xebb127[_0xb04e('0x37')]['length']?_0xebb127[_0xb04e('0x37')]:_0x18f70a['model'];if(!_0x43e9cb['query'][_0xb04e('0x39')](_0xb04e('0x3a'))){_0xebb127[_0xb04e('0x1d')]=qs['limit'](_0x43e9cb[_0xb04e('0x34')]['limit']);_0xebb127[_0xb04e('0x1b')]=qs[_0xb04e('0x1b')](_0x43e9cb['query']['offset']);}_0xebb127[_0xb04e('0x3b')]=qs[_0xb04e('0x3c')](_0x43e9cb[_0xb04e('0x34')][_0xb04e('0x3c')]);_0xebb127[_0xb04e('0x3d')]=qs[_0xb04e('0x35')](_[_0xb04e('0x3e')](_0x43e9cb[_0xb04e('0x34')],_0x18f70a[_0xb04e('0x35')]),_0x146f85);if(_0x43e9cb[_0xb04e('0x34')][_0xb04e('0x3f')]){_0xebb127[_0xb04e('0x3d')]=_['merge'](_0xebb127[_0xb04e('0x3d')],{'$or':_[_0xb04e('0x2d')](_0x146f85,function(_0x3119ec){if(_0x3119ec[_0xb04e('0x30')]!==_0xb04e('0x40')){var _0x30d2cd={};_0x30d2cd[_0x3119ec[_0xb04e('0x2a')]]={'$like':'%'+_0x43e9cb[_0xb04e('0x34')][_0xb04e('0x3f')]+'%'};return _0x30d2cd;}})});}_0xebb127=_[_0xb04e('0x41')]({},_0xebb127,_0x43e9cb[_0xb04e('0x42')]);var _0x51b799={'where':_0xebb127[_0xb04e('0x3d')]};return db[_0xb04e('0x2e')]['count'](_0x51b799)[_0xb04e('0x27')](function(_0x1acce8){_0x48f028[_0xb04e('0x1e')]=_0x1acce8;if(_0x43e9cb['query']['includeAll']){_0xebb127[_0xb04e('0x43')]=[{'all':!![]}];}return db[_0xb04e('0x2e')][_0xb04e('0x44')](_0xebb127);})[_0xb04e('0x27')](function(_0xd2e2ce){_0x48f028['rows']=_0xd2e2ce;return _0x48f028;})[_0xb04e('0x27')](respondWithFilteredResult(_0x7e78da,_0xebb127))[_0xb04e('0x45')](handleError(_0x7e78da,null));};exports[_0xb04e('0x46')]=function(_0xf12315,_0x4d27b1){var _0x1e33a0={'raw':!![],'where':{'id':_0xf12315[_0xb04e('0x47')]['id']}},_0x4ea970={};_0x4ea970[_0xb04e('0x32')]=_['keys'](db[_0xb04e('0x2e')][_0xb04e('0x2f')]);_0x4ea970[_0xb04e('0x34')]=_[_0xb04e('0x33')](_0xf12315['query']);_0x4ea970[_0xb04e('0x35')]=_[_0xb04e('0x36')](_0x4ea970[_0xb04e('0x32')],_0x4ea970[_0xb04e('0x34')]);_0x1e33a0[_0xb04e('0x37')]=_[_0xb04e('0x36')](_0x4ea970[_0xb04e('0x32')],qs[_0xb04e('0x38')](_0xf12315[_0xb04e('0x34')]['fields']));_0x1e33a0[_0xb04e('0x37')]=_0x1e33a0[_0xb04e('0x37')][_0xb04e('0x48')]?_0x1e33a0[_0xb04e('0x37')]:_0x4ea970['model'];if(_0xf12315[_0xb04e('0x34')][_0xb04e('0x49')]){_0x1e33a0[_0xb04e('0x43')]=[{'all':!![]}];}_0x1e33a0=_['merge']({},_0x1e33a0,_0xf12315[_0xb04e('0x42')]);return db[_0xb04e('0x2e')][_0xb04e('0x4a')](_0x1e33a0)[_0xb04e('0x27')](handleEntityNotFound(_0x4d27b1,null))[_0xb04e('0x27')](respondWithResult(_0x4d27b1,null))[_0xb04e('0x45')](handleError(_0x4d27b1,null));};exports['create']=function(_0x301d81,_0x155fc5){return db[_0xb04e('0x2e')][_0xb04e('0x4b')](_0x301d81[_0xb04e('0x4c')],{})[_0xb04e('0x27')](function(_0x32181d){var _0x498e52=_0x301d81[_0xb04e('0x4d')]['get']({'plain':!![]});if(!_0x498e52)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x498e52[_0xb04e('0x4e')]==='user'){var _0x49bea1=_0x32181d['get']({'plain':!![]});var _0x540ce8='Variables';return db[_0xb04e('0x4f')][_0xb04e('0x4a')]({'where':{'name':_0x540ce8,'userProfileId':_0x498e52[_0xb04e('0x50')]},'raw':!![]})[_0xb04e('0x27')](function(_0x4fd068){if(_0x4fd068&&_0x4fd068[_0xb04e('0x51')]===0x0){return db[_0xb04e('0x25')][_0xb04e('0x4b')]({'name':_0x49bea1[_0xb04e('0x2a')],'resourceId':_0x49bea1['id'],'type':_0x4fd068[_0xb04e('0x2a')],'sectionId':_0x4fd068['id']},{})[_0xb04e('0x27')](function(){return _0x32181d;});}else{return _0x32181d;}})['catch'](function(_0x525621){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x525621);throw _0x525621;});}return _0x32181d;})[_0xb04e('0x27')](respondWithResult(_0x155fc5,0xc9))[_0xb04e('0x45')](handleError(_0x155fc5,null));};exports[_0xb04e('0x22')]=function(_0x362445,_0xc44c90){if(_0x362445['body']['id']){delete _0x362445[_0xb04e('0x4c')]['id'];}return db[_0xb04e('0x2e')]['find']({'where':{'id':_0x362445[_0xb04e('0x47')]['id']}})[_0xb04e('0x27')](handleEntityNotFound(_0xc44c90,null))[_0xb04e('0x27')](saveUpdates(_0x362445[_0xb04e('0x4c')],null))[_0xb04e('0x27')](respondWithResult(_0xc44c90,null))[_0xb04e('0x45')](handleError(_0xc44c90,null));};exports['destroy']=function(_0x23f250,_0x2b6416){return db['Variable'][_0xb04e('0x4a')]({'where':{'id':_0x23f250[_0xb04e('0x47')]['id']}})[_0xb04e('0x27')](handleEntityNotFound(_0x2b6416,null))[_0xb04e('0x27')](removeEntity(_0x2b6416,null))[_0xb04e('0x45')](handleError(_0x2b6416,null));}; \ No newline at end of file +var _0x3d95=['then','error','name','send','index','map','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Variable','includeAll','catch','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','destroy','get','UserProfileResource'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d95,0x126));var _0x53d9=function(_0x426f39,_0x2054cd){_0x426f39=_0x426f39-0x0;var _0x221adb=_0x3d95[_0x426f39];return _0x221adb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x53d9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x53d9('0x1'));var rp=require(_0x53d9('0x2'));var moment=require(_0x53d9('0x3'));var BPromise=require(_0x53d9('0x4'));var Mustache=require(_0x53d9('0x5'));var util=require('util');var path=require(_0x53d9('0x6'));var sox=require(_0x53d9('0x7'));var csv=require(_0x53d9('0x8'));var ejs=require(_0x53d9('0x9'));var fs=require('fs');var fs_extra=require(_0x53d9('0xa'));var _=require(_0x53d9('0xb'));var squel=require(_0x53d9('0xc'));var crypto=require(_0x53d9('0xd'));var jsforce=require(_0x53d9('0xe'));var deskjs=require(_0x53d9('0xf'));var toCsv=require(_0x53d9('0x8'));var querystring=require(_0x53d9('0x10'));var Papa=require(_0x53d9('0x11'));var Redis=require(_0x53d9('0x12'));var authService=require(_0x53d9('0x13'));var qs=require(_0x53d9('0x14'));var as=require(_0x53d9('0x15'));var hardwareService=require(_0x53d9('0x16'));var logger=require(_0x53d9('0x17'))('api');var utils=require(_0x53d9('0x18'));var config=require(_0x53d9('0x19'));var licenseUtil=require(_0x53d9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42dc15,_0x3f1243){_0x3f1243=_0x3f1243||0xcc;return function(_0x461b2d){if(_0x461b2d){return _0x42dc15[_0x53d9('0x1b')](_0x3f1243);}return _0x42dc15[_0x53d9('0x1c')](_0x3f1243)[_0x53d9('0x1d')]();};}function respondWithResult(_0x29ea15,_0x46442f){_0x46442f=_0x46442f||0xc8;return function(_0x14304f){if(_0x14304f){return _0x29ea15[_0x53d9('0x1c')](_0x46442f)[_0x53d9('0x1e')](_0x14304f);}};}function respondWithFilteredResult(_0x5b0c8b,_0x23f77c){return function(_0x1a2712){if(_0x1a2712){var _0x3a1421=typeof _0x23f77c[_0x53d9('0x1f')]===_0x53d9('0x20')&&typeof _0x23f77c['limit']===_0x53d9('0x20');var _0x2cd45c=_0x1a2712['count'];var _0x2a03f2=_0x3a1421?0x0:_0x23f77c['offset'];var _0x5804da=_0x3a1421?_0x1a2712[_0x53d9('0x21')]:_0x23f77c[_0x53d9('0x1f')]+_0x23f77c[_0x53d9('0x22')];var _0x72d6fe;if(_0x5804da>=_0x2cd45c){_0x5804da=_0x2cd45c;_0x72d6fe=0xc8;}else{_0x72d6fe=0xce;}_0x5b0c8b[_0x53d9('0x1c')](_0x72d6fe);return _0x5b0c8b['set'](_0x53d9('0x23'),_0x2a03f2+'-'+_0x5804da+'/'+_0x2cd45c)[_0x53d9('0x1e')](_0x1a2712);}return null;};}function patchUpdates(_0x52ae97){return function(_0x27b732){try{jsonpatch['apply'](_0x27b732,_0x52ae97,!![]);}catch(_0x42aff9){return BPromise[_0x53d9('0x24')](_0x42aff9);}return _0x27b732[_0x53d9('0x25')]();};}function saveUpdates(_0x919781,_0x411f98){return function(_0x286472){if(_0x286472){return _0x286472[_0x53d9('0x26')](_0x919781)['then'](function(_0x45bf96){return _0x45bf96;});}return null;};}function removeEntity(_0x161858,_0x391fdf){return function(_0x4480c5){if(_0x4480c5){return _0x4480c5[_0x53d9('0x27')]()['then'](function(){var _0x4b2136=_0x4480c5[_0x53d9('0x28')]({'plain':!![]});var _0x4d6132='Variables';return db[_0x53d9('0x29')][_0x53d9('0x27')]({'where':{'type':_0x4d6132,'resourceId':_0x4b2136['id']}})[_0x53d9('0x2a')](function(){return _0x4480c5;});})[_0x53d9('0x2a')](function(){_0x161858[_0x53d9('0x1c')](0xcc)[_0x53d9('0x1d')]();});}};}function handleEntityNotFound(_0xf064f9,_0x1036db){return function(_0x15d4bb){if(!_0x15d4bb){_0xf064f9[_0x53d9('0x1b')](0x194);}return _0x15d4bb;};}function handleError(_0x5b6925,_0x1411f8){_0x1411f8=_0x1411f8||0x1f4;return function(_0x261803){logger[_0x53d9('0x2b')](_0x261803['stack']);if(_0x261803[_0x53d9('0x2c')]){delete _0x261803['name'];}_0x5b6925[_0x53d9('0x1c')](_0x1411f8)[_0x53d9('0x2d')](_0x261803);};}exports[_0x53d9('0x2e')]=function(_0x2a85f1,_0x2efa7c){var _0x2dea72={},_0x4eb24d={},_0x1a8129={'count':0x0,'rows':[]};var _0x3ca15e=_[_0x53d9('0x2f')](db['Variable']['rawAttributes'],function(_0x3646e7){return{'name':_0x3646e7['fieldName'],'type':_0x3646e7[_0x53d9('0x30')][_0x53d9('0x31')]};});_0x4eb24d[_0x53d9('0x32')]=_[_0x53d9('0x2f')](_0x3ca15e,_0x53d9('0x2c'));_0x4eb24d['query']=_[_0x53d9('0x33')](_0x2a85f1[_0x53d9('0x34')]);_0x4eb24d['filters']=_['intersection'](_0x4eb24d[_0x53d9('0x32')],_0x4eb24d[_0x53d9('0x34')]);_0x2dea72[_0x53d9('0x35')]=_[_0x53d9('0x36')](_0x4eb24d['model'],qs[_0x53d9('0x37')](_0x2a85f1[_0x53d9('0x34')][_0x53d9('0x37')]));_0x2dea72[_0x53d9('0x35')]=_0x2dea72['attributes'][_0x53d9('0x38')]?_0x2dea72['attributes']:_0x4eb24d[_0x53d9('0x32')];if(!_0x2a85f1[_0x53d9('0x34')][_0x53d9('0x39')](_0x53d9('0x3a'))){_0x2dea72[_0x53d9('0x22')]=qs['limit'](_0x2a85f1['query'][_0x53d9('0x22')]);_0x2dea72[_0x53d9('0x1f')]=qs['offset'](_0x2a85f1['query']['offset']);}_0x2dea72[_0x53d9('0x3b')]=qs[_0x53d9('0x3c')](_0x2a85f1['query'][_0x53d9('0x3c')]);_0x2dea72[_0x53d9('0x3d')]=qs[_0x53d9('0x3e')](_[_0x53d9('0x3f')](_0x2a85f1['query'],_0x4eb24d[_0x53d9('0x3e')]),_0x3ca15e);if(_0x2a85f1[_0x53d9('0x34')][_0x53d9('0x40')]){_0x2dea72[_0x53d9('0x3d')]=_[_0x53d9('0x41')](_0x2dea72[_0x53d9('0x3d')],{'$or':_[_0x53d9('0x2f')](_0x3ca15e,function(_0x58853f){if(_0x58853f[_0x53d9('0x30')]!==_0x53d9('0x42')){var _0x5b6729={};_0x5b6729[_0x58853f[_0x53d9('0x2c')]]={'$like':'%'+_0x2a85f1[_0x53d9('0x34')][_0x53d9('0x40')]+'%'};return _0x5b6729;}})});}_0x2dea72=_[_0x53d9('0x41')]({},_0x2dea72,_0x2a85f1[_0x53d9('0x43')]);var _0x11519c={'where':_0x2dea72[_0x53d9('0x3d')]};return db[_0x53d9('0x44')][_0x53d9('0x21')](_0x11519c)[_0x53d9('0x2a')](function(_0x1552b5){_0x1a8129[_0x53d9('0x21')]=_0x1552b5;if(_0x2a85f1[_0x53d9('0x34')][_0x53d9('0x45')]){_0x2dea72['include']=[{'all':!![]}];}return db[_0x53d9('0x44')]['findAll'](_0x2dea72);})[_0x53d9('0x2a')](function(_0x640142){_0x1a8129['rows']=_0x640142;return _0x1a8129;})[_0x53d9('0x2a')](respondWithFilteredResult(_0x2efa7c,_0x2dea72))[_0x53d9('0x46')](handleError(_0x2efa7c,null));};exports['show']=function(_0x14e475,_0x2e8fcc){var _0x5d6b02={'raw':!![],'where':{'id':_0x14e475[_0x53d9('0x47')]['id']}},_0x3b0a50={};_0x3b0a50[_0x53d9('0x32')]=_[_0x53d9('0x33')](db['Variable'][_0x53d9('0x48')]);_0x3b0a50[_0x53d9('0x34')]=_[_0x53d9('0x33')](_0x14e475[_0x53d9('0x34')]);_0x3b0a50[_0x53d9('0x3e')]=_[_0x53d9('0x36')](_0x3b0a50[_0x53d9('0x32')],_0x3b0a50[_0x53d9('0x34')]);_0x5d6b02[_0x53d9('0x35')]=_['intersection'](_0x3b0a50[_0x53d9('0x32')],qs[_0x53d9('0x37')](_0x14e475[_0x53d9('0x34')][_0x53d9('0x37')]));_0x5d6b02[_0x53d9('0x35')]=_0x5d6b02[_0x53d9('0x35')][_0x53d9('0x38')]?_0x5d6b02[_0x53d9('0x35')]:_0x3b0a50[_0x53d9('0x32')];if(_0x14e475[_0x53d9('0x34')][_0x53d9('0x45')]){_0x5d6b02[_0x53d9('0x49')]=[{'all':!![]}];}_0x5d6b02=_['merge']({},_0x5d6b02,_0x14e475[_0x53d9('0x43')]);return db[_0x53d9('0x44')][_0x53d9('0x4a')](_0x5d6b02)['then'](handleEntityNotFound(_0x2e8fcc,null))['then'](respondWithResult(_0x2e8fcc,null))[_0x53d9('0x46')](handleError(_0x2e8fcc,null));};exports[_0x53d9('0x4b')]=function(_0x418598,_0x3bbd2c){return db[_0x53d9('0x44')]['create'](_0x418598[_0x53d9('0x4c')],{})[_0x53d9('0x2a')](function(_0x534151){var _0x306f6b=_0x418598[_0x53d9('0x4d')]['get']({'plain':!![]});if(!_0x306f6b)throw new Error(_0x53d9('0x4e'));if(_0x306f6b[_0x53d9('0x4f')]==='user'){var _0x1e3298=_0x534151[_0x53d9('0x28')]({'plain':!![]});var _0x13730f=_0x53d9('0x50');return db[_0x53d9('0x51')][_0x53d9('0x4a')]({'where':{'name':_0x13730f,'userProfileId':_0x306f6b['userProfileId']},'raw':!![]})[_0x53d9('0x2a')](function(_0x48e69f){if(_0x48e69f&&_0x48e69f[_0x53d9('0x52')]===0x0){return db[_0x53d9('0x29')][_0x53d9('0x4b')]({'name':_0x1e3298[_0x53d9('0x2c')],'resourceId':_0x1e3298['id'],'type':_0x48e69f[_0x53d9('0x2c')],'sectionId':_0x48e69f['id']},{})['then'](function(){return _0x534151;});}else{return _0x534151;}})[_0x53d9('0x46')](function(_0x12b4ad){logger['error'](_0x53d9('0x53'),_0x12b4ad);throw _0x12b4ad;});}return _0x534151;})[_0x53d9('0x2a')](respondWithResult(_0x3bbd2c,0xc9))[_0x53d9('0x46')](handleError(_0x3bbd2c,null));};exports['update']=function(_0x2a829c,_0x508d52){if(_0x2a829c[_0x53d9('0x4c')]['id']){delete _0x2a829c[_0x53d9('0x4c')]['id'];}return db[_0x53d9('0x44')][_0x53d9('0x4a')]({'where':{'id':_0x2a829c[_0x53d9('0x47')]['id']}})[_0x53d9('0x2a')](handleEntityNotFound(_0x508d52,null))[_0x53d9('0x2a')](saveUpdates(_0x2a829c[_0x53d9('0x4c')],null))[_0x53d9('0x2a')](respondWithResult(_0x508d52,null))[_0x53d9('0x46')](handleError(_0x508d52,null));};exports['destroy']=function(_0x1c08b2,_0x180ee5){return db[_0x53d9('0x44')]['find']({'where':{'id':_0x1c08b2[_0x53d9('0x47')]['id']}})[_0x53d9('0x2a')](handleEntityNotFound(_0x180ee5,null))[_0x53d9('0x2a')](removeEntity(_0x180ee5,null))[_0x53d9('0x46')](handleError(_0x180ee5,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index cea3eed..475d6cc 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 _0xf7d8=['lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables'];(function(_0x2d5b8c,_0x1db93e){var _0x2f2a05=function(_0x558988){while(--_0x558988){_0x2d5b8c['push'](_0x2d5b8c['shift']());}};_0x2f2a05(++_0x1db93e);}(_0xf7d8,0x1b0));var _0x8f7d=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0xf7d8[_0x172948];return _0x4aeaa9;};'use strict';var _=require(_0x8f7d('0x0'));var util=require('util');var logger=require(_0x8f7d('0x1'))(_0x8f7d('0x2'));var moment=require(_0x8f7d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f7d('0x4'));var rimraf=require(_0x8f7d('0x5'));var config=require(_0x8f7d('0x6'));var attributes=require(_0x8f7d('0x7'));module[_0x8f7d('0x8')]=function(_0x3ee2a7,_0x2dc492){return _0x3ee2a7[_0x8f7d('0x9')](_0x8f7d('0xa'),attributes,{'tableName':_0x8f7d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad30=['lodash','util','../../config/logger','api','request-promise','path','rimraf','exports','define'];(function(_0x21c926,_0x563c30){var _0x2a46ed=function(_0x24aff8){while(--_0x24aff8){_0x21c926['push'](_0x21c926['shift']());}};_0x2a46ed(++_0x563c30);}(_0xad30,0xea));var _0x0ad3=function(_0x84fcd,_0x4b673b){_0x84fcd=_0x84fcd-0x0;var _0x398985=_0xad30[_0x84fcd];return _0x398985;};'use strict';var _=require(_0x0ad3('0x0'));var util=require(_0x0ad3('0x1'));var logger=require(_0x0ad3('0x2'))(_0x0ad3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0ad3('0x4'));var fs=require('fs');var path=require(_0x0ad3('0x5'));var rimraf=require(_0x0ad3('0x6'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0x0ad3('0x7')]=function(_0x22d02c,_0x1fa927){return _0x22d02c[_0x0ad3('0x8')]('Variable',attributes,{'tableName':'tools_variables','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 5e242a1..c4761be 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 _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0xfa5c95,_0x5298db){var _0x59ba06=function(_0x141f9b){while(--_0x141f9b){_0xfa5c95['push'](_0xfa5c95['shift']());}};_0x59ba06(++_0x5298db);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3b826d,_0x1d0b68){_0x3b826d=_0x3b826d-0x0;var _0x38e1b3=_0x7fbe[_0x3b826d];return _0x38e1b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file +var _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xa41a,0x6b));var _0xaa41=function(_0x505a3d,_0x118cc1){_0x505a3d=_0x505a3d-0x0;var _0x35b135=_0xa41a[_0x505a3d];return _0x35b135;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index f28d4a2..e6f1686 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 _0x132c=['/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','/migrations','migrations','exports','express','../../components/auth/service','get','index'];(function(_0x43d701,_0x4bb2e9){var _0x2ec4c6=function(_0x4d9765){while(--_0x4d9765){_0x43d701['push'](_0x43d701['shift']());}};_0x2ec4c6(++_0x4bb2e9);}(_0x132c,0x1ae));var _0xc132=function(_0x35404c,_0x277be0){_0x35404c=_0x35404c-0x0;var _0x171b27=_0x132c[_0x35404c];return _0x171b27;};'use strict';var express=require(_0xc132('0x0'));var router=express['Router']();var auth=require(_0xc132('0x1'));var controller=require('./version.controller');router[_0xc132('0x2')]('/',controller[_0xc132('0x3')]);router[_0xc132('0x2')](_0xc132('0x4'),auth[_0xc132('0x5')](),auth[_0xc132('0x6')](),controller[_0xc132('0x7')]);router[_0xc132('0x2')](_0xc132('0x8'),auth[_0xc132('0x5')](),auth[_0xc132('0x6')](),controller[_0xc132('0x9')]);router[_0xc132('0x2')](_0xc132('0xa'),auth[_0xc132('0x5')](),auth['canUpdate'](),controller['pull']);router['get']('/restart',auth[_0xc132('0x5')](),controller['restart']);router['get'](_0xc132('0xb'),controller[_0xc132('0xc')]);module[_0xc132('0xd')]=router; \ No newline at end of file +var _0x0b4f=['fetch','reset','pull','/restart','restart','migrations','exports','express','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate'];(function(_0xbf8d9e,_0x7b75df){var _0x37b563=function(_0x29b774){while(--_0x29b774){_0xbf8d9e['push'](_0xbf8d9e['shift']());}};_0x37b563(++_0x7b75df);}(_0x0b4f,0xd9));var _0xf0b4=function(_0x4aedbb,_0x4952e6){_0x4aedbb=_0x4aedbb-0x0;var _0x33c1d8=_0x0b4f[_0x4aedbb];return _0x33c1d8;};'use strict';var express=require(_0xf0b4('0x0'));var router=express['Router']();var auth=require(_0xf0b4('0x1'));var controller=require(_0xf0b4('0x2'));router[_0xf0b4('0x3')]('/',controller[_0xf0b4('0x4')]);router['get'](_0xf0b4('0x5'),auth[_0xf0b4('0x6')](),auth[_0xf0b4('0x7')](),controller[_0xf0b4('0x8')]);router[_0xf0b4('0x3')]('/reset',auth[_0xf0b4('0x6')](),auth[_0xf0b4('0x7')](),controller[_0xf0b4('0x9')]);router['get']('/pull',auth[_0xf0b4('0x6')](),auth[_0xf0b4('0x7')](),controller[_0xf0b4('0xa')]);router['get'](_0xf0b4('0xb'),auth[_0xf0b4('0x6')](),controller[_0xf0b4('0xc')]);router['get']('/migrations',controller[_0xf0b4('0xd')]);module[_0xf0b4('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index e3edde7..eb7bd7a 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 _0xe0d1=['../../config/environment','../../config/logger','update','simple-git','index','exports','query','latest','fetch','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','join','root','server','length','replace','.js','push','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb'];(function(_0x45391a,_0xad83fd){var _0x4651b0=function(_0x112be1){while(--_0x112be1){_0x45391a['push'](_0x45391a['shift']());}};_0x4651b0(++_0xad83fd);}(_0xe0d1,0x141));var _0x1e0d=function(_0x31abee,_0x11ff0c){_0x31abee=_0x31abee-0x0;var _0x3c1761=_0xe0d1[_0x31abee];return _0x3c1761;};'use strict';var Umzug=require(_0x1e0d('0x0'));var path=require(_0x1e0d('0x1'));var fs=require('fs');var _=require(_0x1e0d('0x2'));var pkginfo=require(_0x1e0d('0x3'))(module,_0x1e0d('0x4'));var compareVersions=require(_0x1e0d('0x5'));var exec=require(_0x1e0d('0x6'))[_0x1e0d('0x7')];var db=require(_0x1e0d('0x8'))['db'];var config=require(_0x1e0d('0x9'));var pm2=require('../../config/pm2');var logger=require(_0x1e0d('0xa'))(_0x1e0d('0xb'));var git=require(_0x1e0d('0xc'))(config['root']);exports[_0x1e0d('0xd')]=function(_0x245454,_0x1cc9cb){var _0x379bf8={'current':module[_0x1e0d('0xe')]['version'],'phonebar':0x2};if(_0x245454[_0x1e0d('0xf')]&&_0x245454['query'][_0x1e0d('0x10')]){return git[_0x1e0d('0x11')]()['tags'](function(_0x7e6cd0,_0x1fa1df){_0x379bf8[_0x1e0d('0x10')]=(_0x7e6cd0?module[_0x1e0d('0xe')]['version']:_0x1fa1df[_0x1e0d('0x10')])||_0x1e0d('0x12');return _0x1cc9cb[_0x1e0d('0x13')](0xc8)[_0x1e0d('0x14')](_0x379bf8);});}else{return _0x1cc9cb[_0x1e0d('0x13')](0xc8)[_0x1e0d('0x14')](_0x379bf8);}};exports[_0x1e0d('0x11')]=function(_0x36522e,_0x46245c){return git[_0x1e0d('0x11')]([_0x1e0d('0x15'),_0x1e0d('0x16')],function(_0x1ea6ec){if(_0x1ea6ec){logger[_0x1e0d('0x17')](_0x1ea6ec);return _0x46245c[_0x1e0d('0x13')](0x1f4)['json'](_0x1ea6ec);}logger[_0x1e0d('0x18')](_0x1e0d('0x19'));return _0x46245c['status'](0xc8)[_0x1e0d('0x14')]({'output':_0x1e0d('0x1a')});});};exports[_0x1e0d('0x1b')]=function(_0x18caa9,_0x1f917e){return git[_0x1e0d('0x1b')](['--hard',_0x1e0d('0x1c')],function(_0x30527f){if(_0x30527f){logger[_0x1e0d('0x17')](_0x30527f);return _0x1f917e['status'](0x1f4)[_0x1e0d('0x14')](_0x30527f);}logger[_0x1e0d('0x18')](_0x1e0d('0x1d'));return _0x1f917e[_0x1e0d('0x13')](0xc8)[_0x1e0d('0x14')]({'output':'git\x20reset\x20--hard'});});};exports[_0x1e0d('0x1e')]=function(_0xec7b52,_0x4ad6c3){exec(_0x1e0d('0x1f'),function(_0x59f116,_0x299305,_0xe24f0b){logger['info'](_0x299305);logger[_0x1e0d('0x18')](_0xe24f0b);if(_0x59f116){logger['error'](_0x59f116);return _0x4ad6c3[_0x1e0d('0x13')](0x1f4)['json'](_0x59f116);}return _0x4ad6c3['status'](0xc8)[_0x1e0d('0x14')]({'output':_0x299305});});};exports[_0x1e0d('0x20')]=function(_0x4d56e,_0x223a93){return pm2['restart']('motion2')[_0x1e0d('0x21')](function(_0x59c491){logger[_0x1e0d('0x18')](_0x1e0d('0x22'),_0x59c491);return _0x223a93[_0x1e0d('0x13')](0xc8)[_0x1e0d('0x14')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x1e0d('0x23')](function(_0x5b693c){logger['error'](_0x5b693c);return _0x223a93[_0x1e0d('0x13')](0x1f4)[_0x1e0d('0x14')](_0x5b693c);});};exports[_0x1e0d('0x24')]=function(_0x170ccf,_0xc624da){var _0x1d2350=fs['readdirSync'](path[_0x1e0d('0x25')](config[_0x1e0d('0x26')],_0x1e0d('0x27'),_0x1e0d('0x24')));var _0x3db4a0=[];for(var _0x378a65=0x0;_0x378a65<_0x1d2350[_0x1e0d('0x28')];_0x378a65++){var _0x288797=_0x1d2350[_0x378a65][_0x1e0d('0x29')](_0x1e0d('0x2a'),'');if(compareVersions(module['exports'][_0x1e0d('0x4')],_0x288797)===-0x1){_0x3db4a0[_0x1e0d('0x2b')](_0x288797);}}if(_0x3db4a0[_0x1e0d('0x28')]){var _0x26d542=_0x3db4a0['sort'](compareVersions);var _0x23446e=new Umzug({'storage':_0x1e0d('0x2c'),'storageOptions':{'model':db['Migration'],'modelName':_0x1e0d('0x2d'),'columnName':'version'},'migrations':{'params':[db[_0x1e0d('0x2c')][_0x1e0d('0x2e')](),db['sequelize'][_0x1e0d('0x2f')],function(){throw new Error(_0x1e0d('0x30'));}],'path':path[_0x1e0d('0x25')](config[_0x1e0d('0x26')],_0x1e0d('0x27'),_0x1e0d('0x24')),'pattern':/\.js$/}});_0x23446e['up']({'migrations':_[_0x1e0d('0x31')](_0x26d542,function(_0x42e00a){return _0x42e00a+_0x1e0d('0x2a');})})['then'](function(){return _0xc624da[_0x1e0d('0x13')](0xc8)['json']({'output':_0x1e0d('0x32')+module[_0x1e0d('0xe')][_0x1e0d('0x4')]+_0x1e0d('0x33')+_[_0x1e0d('0x34')](_0x26d542),'migrations':_[_0x1e0d('0x25')](_0x26d542)});})['catch'](function(_0x33c310){if(_0x33c310 instanceof db[_0x1e0d('0x2c')][_0x1e0d('0x35')]){return _0xc624da['status'](0xc8)[_0x1e0d('0x14')]({'output':_0x1e0d('0x36')});}else{return _0xc624da[_0x1e0d('0x13')](0x1f4)[_0x1e0d('0x14')](_0x33c310);}});}else{return _0xc624da[_0x1e0d('0x13')](0xc8)[_0x1e0d('0x14')]({'output':_0x1e0d('0x36')});}}; \ No newline at end of file +var _0xce88=['getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','query','fetch','tags','latest','2.0.0','status','origin','master','error','git\x20fetch','json','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','length','replace','.js','push','Migration','sequelize'];(function(_0x54fdf9,_0x2dd76c){var _0x408938=function(_0x2990d3){while(--_0x2990d3){_0x54fdf9['push'](_0x54fdf9['shift']());}};_0x408938(++_0x2dd76c);}(_0xce88,0x181));var _0x8ce8=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xce88[_0x13e741];return _0x3f8bb3;};'use strict';var Umzug=require(_0x8ce8('0x0'));var path=require(_0x8ce8('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x8ce8('0x2'))(module,_0x8ce8('0x3'));var compareVersions=require(_0x8ce8('0x4'));var exec=require(_0x8ce8('0x5'))[_0x8ce8('0x6')];var db=require('../../mysqldb')['db'];var config=require(_0x8ce8('0x7'));var pm2=require(_0x8ce8('0x8'));var logger=require('../../config/logger')(_0x8ce8('0x9'));var git=require(_0x8ce8('0xa'))(config[_0x8ce8('0xb')]);exports[_0x8ce8('0xc')]=function(_0x474ffe,_0x38d83d){var _0x196a85={'current':module[_0x8ce8('0xd')][_0x8ce8('0x3')],'phonebar':0x2};if(_0x474ffe[_0x8ce8('0xe')]&&_0x474ffe[_0x8ce8('0xe')]['latest']){return git[_0x8ce8('0xf')]()[_0x8ce8('0x10')](function(_0x111ced,_0x54366b){_0x196a85[_0x8ce8('0x11')]=(_0x111ced?module['exports'][_0x8ce8('0x3')]:_0x54366b[_0x8ce8('0x11')])||_0x8ce8('0x12');return _0x38d83d[_0x8ce8('0x13')](0xc8)['json'](_0x196a85);});}else{return _0x38d83d['status'](0xc8)['json'](_0x196a85);}};exports['fetch']=function(_0x9f9735,_0x446478){return git[_0x8ce8('0xf')]([_0x8ce8('0x14'),_0x8ce8('0x15')],function(_0x5834ee){if(_0x5834ee){logger[_0x8ce8('0x16')](_0x5834ee);return _0x446478[_0x8ce8('0x13')](0x1f4)['json'](_0x5834ee);}logger['info'](_0x8ce8('0x17'));return _0x446478[_0x8ce8('0x13')](0xc8)[_0x8ce8('0x18')]({'output':_0x8ce8('0x19')});});};exports[_0x8ce8('0x1a')]=function(_0x2cfd4e,_0x497495){return git[_0x8ce8('0x1a')](['--hard',_0x8ce8('0x1b')],function(_0x2f1c26){if(_0x2f1c26){logger['error'](_0x2f1c26);return _0x497495[_0x8ce8('0x13')](0x1f4)[_0x8ce8('0x18')](_0x2f1c26);}logger[_0x8ce8('0x1c')](_0x8ce8('0x1d'));return _0x497495['status'](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports[_0x8ce8('0x1e')]=function(_0x2af22a,_0x2b3b39){exec('npm\x20install\x20--production',function(_0x147d3d,_0x186cf4,_0x1eaf41){logger['info'](_0x186cf4);logger['info'](_0x1eaf41);if(_0x147d3d){logger[_0x8ce8('0x16')](_0x147d3d);return _0x2b3b39[_0x8ce8('0x13')](0x1f4)['json'](_0x147d3d);}return _0x2b3b39[_0x8ce8('0x13')](0xc8)[_0x8ce8('0x18')]({'output':_0x186cf4});});};exports[_0x8ce8('0x1f')]=function(_0x522824,_0x5a3aae){return pm2[_0x8ce8('0x1f')](_0x8ce8('0x20'))[_0x8ce8('0x21')](function(_0x5e9076){logger['info'](_0x8ce8('0x22'),_0x5e9076);return _0x5a3aae[_0x8ce8('0x13')](0xc8)['json']({'output':_0x8ce8('0x23')});})[_0x8ce8('0x24')](function(_0x1e4960){logger[_0x8ce8('0x16')](_0x1e4960);return _0x5a3aae[_0x8ce8('0x13')](0x1f4)['json'](_0x1e4960);});};exports['migrations']=function(_0x2e1005,_0x536035){var _0x5137d9=fs[_0x8ce8('0x25')](path[_0x8ce8('0x26')](config['root'],_0x8ce8('0x27'),_0x8ce8('0x28')));var _0x2c3bbd=[];for(var _0x1a6aa7=0x0;_0x1a6aa7<_0x5137d9[_0x8ce8('0x29')];_0x1a6aa7++){var _0x205028=_0x5137d9[_0x1a6aa7][_0x8ce8('0x2a')](_0x8ce8('0x2b'),'');if(compareVersions(module['exports'][_0x8ce8('0x3')],_0x205028)===-0x1){_0x2c3bbd[_0x8ce8('0x2c')](_0x205028);}}if(_0x2c3bbd[_0x8ce8('0x29')]){var _0x472177=_0x2c3bbd['sort'](compareVersions);var _0x170842=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x8ce8('0x2d'),'columnName':_0x8ce8('0x3')},'migrations':{'params':[db[_0x8ce8('0x2e')][_0x8ce8('0x2f')](),db[_0x8ce8('0x2e')][_0x8ce8('0x30')],function(){throw new Error(_0x8ce8('0x31'));}],'path':path[_0x8ce8('0x26')](config['root'],_0x8ce8('0x27'),_0x8ce8('0x28')),'pattern':/\.js$/}});_0x170842['up']({'migrations':_[_0x8ce8('0x32')](_0x472177,function(_0x4b166a){return _0x4b166a+_0x8ce8('0x2b');})})[_0x8ce8('0x21')](function(){return _0x536035[_0x8ce8('0x13')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x8ce8('0x3')]+_0x8ce8('0x33')+_['last'](_0x472177),'migrations':_[_0x8ce8('0x26')](_0x472177)});})['catch'](function(_0x1443ad){if(_0x1443ad instanceof db['sequelize'][_0x8ce8('0x34')]){return _0x536035[_0x8ce8('0x13')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x536035['status'](0x1f4)[_0x8ce8('0x18')](_0x1443ad);}});}else{return _0x536035[_0x8ce8('0x13')](0xc8)[_0x8ce8('0x18')]({'output':_0x8ce8('0x35')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 447e5b0..ca669f5 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 _0xf281=['./voiceAgentReport.controller','isAuthenticated','index','get','/describe','show','post','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xd1a252,_0x16396f){var _0x560ee1=function(_0x35dd90){while(--_0x35dd90){_0xd1a252['push'](_0xd1a252['shift']());}};_0x560ee1(++_0x16396f);}(_0xf281,0x7b));var _0x1f28=function(_0x107b58,_0x383d20){_0x107b58=_0x107b58-0x0;var _0x52c15e=_0xf281[_0x107b58];return _0x52c15e;};'use strict';var multer=require(_0x1f28('0x0'));var util=require(_0x1f28('0x1'));var path=require(_0x1f28('0x2'));var timeout=require(_0x1f28('0x3'));var express=require('express');var router=express[_0x1f28('0x4')]();var fs_extra=require(_0x1f28('0x5'));var auth=require(_0x1f28('0x6'));var interaction=require(_0x1f28('0x7'));var config=require(_0x1f28('0x8'));var controller=require(_0x1f28('0x9'));router['get']('/',auth[_0x1f28('0xa')](),controller[_0x1f28('0xb')]);router[_0x1f28('0xc')](_0x1f28('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x1f28('0xc')]('/:id',auth[_0x1f28('0xa')](),controller[_0x1f28('0xe')]);router[_0x1f28('0xf')]('/',auth[_0x1f28('0xa')](),controller[_0x1f28('0x10')]);router['put']('/:id',auth[_0x1f28('0xa')](),controller[_0x1f28('0x11')]);router[_0x1f28('0x12')](_0x1f28('0x13'),auth[_0x1f28('0xa')](),controller[_0x1f28('0x14')]);module[_0x1f28('0x15')]=router; \ No newline at end of file +var _0x0330=['get','isAuthenticated','/describe','/:id','post','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x0330,0x13a));var _0x0033=function(_0x45cf01,_0x321148){_0x45cf01=_0x45cf01-0x0;var _0x29242b=_0x0330[_0x45cf01];return _0x29242b;};'use strict';var multer=require(_0x0033('0x0'));var util=require(_0x0033('0x1'));var path=require(_0x0033('0x2'));var timeout=require(_0x0033('0x3'));var express=require(_0x0033('0x4'));var router=express[_0x0033('0x5')]();var fs_extra=require(_0x0033('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0033('0x7'));var config=require(_0x0033('0x8'));var controller=require('./voiceAgentReport.controller');router[_0x0033('0x9')]('/',auth[_0x0033('0xa')](),controller['index']);router['get'](_0x0033('0xb'),auth[_0x0033('0xa')](),controller['describe']);router[_0x0033('0x9')](_0x0033('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0033('0xd')]('/',auth[_0x0033('0xa')](),controller['create']);router[_0x0033('0xe')]('/:id',auth[_0x0033('0xa')](),controller[_0x0033('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0033('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 15d5432..37160f0 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.attributes.js +++ b/server/api/voiceAgentReport/voiceAgentReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97e6=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE'];(function(_0x458c98,_0x1f6e47){var _0x5c2898=function(_0x4441a3){while(--_0x4441a3){_0x458c98['push'](_0x458c98['shift']());}};_0x5c2898(++_0x1f6e47);}(_0x97e6,0x159));var _0x697e=function(_0x379799,_0x4ccf16){_0x379799=_0x379799-0x0;var _0x46e431=_0x97e6[_0x379799];return _0x46e431;};'use strict';var Sequelize=require(_0x697e('0x0'));module['exports']={'type':{'type':Sequelize[_0x697e('0x1')]},'uniqueid':{'type':Sequelize[_0x697e('0x1')]},'calleridnum':{'type':Sequelize[_0x697e('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x697e('0x1')]},'interface':{'type':Sequelize[_0x697e('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x697e('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x697e('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x697e('0x2')]},'agentdumpAt':{'type':Sequelize[_0x697e('0x2')]},'holdtime':{'type':Sequelize[_0x697e('0x3')]},'agentcomplete':{'type':Sequelize[_0x697e('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x697e('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x697e('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x697e('0x3')]},'reason':{'type':Sequelize[_0x697e('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x697e('0x1')]},'channelstate':{'type':Sequelize[_0x697e('0x3')]},'channelstatedesc':{'type':Sequelize[_0x697e('0x1')]},'connectedlinenum':{'type':Sequelize[_0x697e('0x1')]},'connectedlinename':{'type':Sequelize[_0x697e('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x697e('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x697e('0x1')]},'destchannel':{'type':Sequelize[_0x697e('0x1')]},'destchannelstate':{'type':Sequelize[_0x697e('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x697e('0x1')]},'destcalleridname':{'type':Sequelize[_0x697e('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x697e('0x1')]},'destaccountcode':{'type':Sequelize[_0x697e('0x1')]},'destcontext':{'type':Sequelize[_0x697e('0x1')]},'destexten':{'type':Sequelize[_0x697e('0x1')]},'destpriority':{'type':Sequelize[_0x697e('0x1')]},'destuniqueid':{'type':Sequelize[_0x697e('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x697e('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x697e('0x1')]},'transfer':{'type':Sequelize[_0x697e('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x697e('0x5')},'transferexten':{'type':Sequelize[_0x697e('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x697e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x37e9=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x39fc7e,_0x2b99d7){var _0x4dc7c3=function(_0x4a115c){while(--_0x4a115c){_0x39fc7e['push'](_0x39fc7e['shift']());}};_0x4dc7c3(++_0x2b99d7);}(_0x37e9,0x1e7));var _0x937e=function(_0x150b7e,_0x45a9d6){_0x150b7e=_0x150b7e-0x0;var _0x4262db=_0x37e9[_0x150b7e];return _0x4262db;};'use strict';var Sequelize=require(_0x937e('0x0'));module[_0x937e('0x1')]={'type':{'type':Sequelize[_0x937e('0x2')]},'uniqueid':{'type':Sequelize[_0x937e('0x2')]},'calleridnum':{'type':Sequelize[_0x937e('0x2')]},'calleridname':{'type':Sequelize[_0x937e('0x2')]},'queue':{'type':Sequelize[_0x937e('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x937e('0x2')]},'agentcalledAt':{'type':Sequelize[_0x937e('0x3')]},'agentconnectAt':{'type':Sequelize[_0x937e('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x937e('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x937e('0x3')]},'agentdumpAt':{'type':Sequelize[_0x937e('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x937e('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x937e('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x937e('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x937e('0x5')]},'agentacw':{'type':Sequelize[_0x937e('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x937e('0x5')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x937e('0x2')]},'channelstate':{'type':Sequelize[_0x937e('0x5')]},'channelstatedesc':{'type':Sequelize[_0x937e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x937e('0x2')]},'connectedlinename':{'type':Sequelize[_0x937e('0x2')]},'language':{'type':Sequelize[_0x937e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x937e('0x2')]},'destchannel':{'type':Sequelize[_0x937e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x937e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x937e('0x2')]},'destcalleridname':{'type':Sequelize[_0x937e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x937e('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x937e('0x2')]},'destaccountcode':{'type':Sequelize[_0x937e('0x2')]},'destcontext':{'type':Sequelize[_0x937e('0x2')]},'destexten':{'type':Sequelize[_0x937e('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x937e('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x937e('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x937e('0x2')]},'transfer':{'type':Sequelize[_0x937e('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x937e('0x2')],'comment':_0x937e('0x6')},'transferexten':{'type':Sequelize[_0x937e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x937e('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 2b0b4af..3dfc996 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(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 961826c..33c7e3a 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 _0x6b8f=['exports','define','VoiceAgentReport','report_agent','util','api','request-promise','path','../../config/environment','./voiceAgentReport.attributes'];(function(_0x342515,_0x6db444){var _0x5bdef4=function(_0x496867){while(--_0x496867){_0x342515['push'](_0x342515['shift']());}};_0x5bdef4(++_0x6db444);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x3c37e3,_0x1606e7){_0x3c37e3=_0x3c37e3-0x0;var _0x5a7625=_0x6b8f[_0x3c37e3];return _0x5a7625;};'use strict';var _=require('lodash');var util=require(_0xf6b8('0x0'));var logger=require('../../config/logger')(_0xf6b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6b8('0x2'));var fs=require('fs');var path=require(_0xf6b8('0x3'));var rimraf=require('rimraf');var config=require(_0xf6b8('0x4'));var attributes=require(_0xf6b8('0x5'));module[_0xf6b8('0x6')]=function(_0x549eac,_0x2d035e){return _0x549eac[_0xf6b8('0x7')](_0xf6b8('0x8'),attributes,{'tableName':_0xf6b8('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc03e=['bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','lodash','api'];(function(_0x46aaff,_0x45d5da){var _0x3a9587=function(_0x4e1e48){while(--_0x4e1e48){_0x46aaff['push'](_0x46aaff['shift']());}};_0x3a9587(++_0x45d5da);}(_0xc03e,0x15a));var _0xec03=function(_0x48ec91,_0x212edc){_0x48ec91=_0x48ec91-0x0;var _0x22766c=_0xc03e[_0x48ec91];return _0x22766c;};'use strict';var _=require(_0xec03('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xec03('0x1'));var moment=require('moment');var BPromise=require(_0xec03('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec03('0x3'));var rimraf=require(_0xec03('0x4'));var config=require(_0xec03('0x5'));var attributes=require(_0xec03('0x6'));module[_0xec03('0x7')]=function(_0x1ce78a,_0x31db21){return _0x1ce78a[_0xec03('0x8')](_0xec03('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xec03('0xa'),_0xec03('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 76b1f02..a7596d4 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 _0x33a4=['create','options','raw','UpdateVoiceAgentReport','update','attributes','limit','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x33a4,0xf7));var _0x433a=function(_0x2c935b,_0x5e4857){_0x2c935b=_0x2c935b-0x0;var _0x4829a6=_0x33a4[_0x2c935b];return _0x4829a6;};'use strict';var _=require('lodash');var util=require(_0x433a('0x0'));var moment=require(_0x433a('0x1'));var BPromise=require(_0x433a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x433a('0x3'))(_0x433a('0x4'));var config=require(_0x433a('0x5'));var jayson=require(_0x433a('0x6'));var client=jayson[_0x433a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ba5c7,_0x2b5396,_0x2c8d6c){return new BPromise(function(_0x256d94,_0x326321){return client[_0x433a('0x8')](_0x1ba5c7,_0x2c8d6c)[_0x433a('0x9')](function(_0x4d38e4){logger[_0x433a('0xa')](_0x433a('0xb'),_0x2b5396,_0x433a('0xc'));logger[_0x433a('0xd')](_0x433a('0xe'),_0x2b5396,_0x433a('0xc'),JSON[_0x433a('0xf')](_0x4d38e4));if(_0x4d38e4[_0x433a('0x10')]){if(_0x4d38e4['error'][_0x433a('0x11')]===0x1f4){logger[_0x433a('0x10')](_0x433a('0xb'),_0x2b5396,_0x4d38e4[_0x433a('0x10')][_0x433a('0x12')]);return _0x326321(_0x4d38e4[_0x433a('0x10')][_0x433a('0x12')]);}logger[_0x433a('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x2b5396,_0x4d38e4[_0x433a('0x10')][_0x433a('0x12')]);return _0x256d94(_0x4d38e4[_0x433a('0x10')]['message']);}else{logger[_0x433a('0xa')](_0x433a('0xb'),_0x2b5396,_0x433a('0xc'));_0x256d94(_0x4d38e4[_0x433a('0x13')][_0x433a('0x12')]);}})[_0x433a('0x14')](function(_0x3c39e9){logger[_0x433a('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x2b5396,_0x3c39e9);_0x326321(_0x3c39e9);});});}exports[_0x433a('0x15')]=function(_0xfad8fb){var _0x412600=this;return new Promise(function(_0x3a2dbd,_0x23db71){return db[_0x433a('0x16')][_0x433a('0x17')](_0xfad8fb['body'],{'raw':_0xfad8fb[_0x433a('0x18')]?_0xfad8fb[_0x433a('0x18')][_0x433a('0x19')]===undefined?!![]:![]:!![]})[_0x433a('0x9')](function(_0x15bc46){logger[_0x433a('0xa')]('CreateVoiceAgentReport',_0xfad8fb);logger[_0x433a('0xd')](_0x433a('0x15'),_0xfad8fb,JSON['stringify'](_0x15bc46));_0x3a2dbd(_0x15bc46);})[_0x433a('0x14')](function(_0x251cc1){logger[_0x433a('0x10')](_0x433a('0x15'),_0x251cc1[_0x433a('0x12')],_0xfad8fb);_0x23db71(_0x412600[_0x433a('0x10')](0x1f4,_0x251cc1[_0x433a('0x12')]));});});};exports[_0x433a('0x1a')]=function(_0x839594){var _0x1769c3=this;return new Promise(function(_0x2d74dc,_0x51c99d){return db[_0x433a('0x16')][_0x433a('0x1b')](_0x839594['body'],{'raw':_0x839594[_0x433a('0x18')]?_0x839594[_0x433a('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x839594['options']?_0x839594['options']['where']||null:null,'attributes':_0x839594['options']?_0x839594[_0x433a('0x18')][_0x433a('0x1c')]||null:null,'limit':_0x839594['options']?_0x839594[_0x433a('0x18')][_0x433a('0x1d')]||null:null})[_0x433a('0x9')](function(_0x45c15c){logger[_0x433a('0xa')](_0x433a('0x1a'),_0x839594);logger[_0x433a('0xd')](_0x433a('0x1a'),_0x839594,JSON['stringify'](_0x45c15c));_0x2d74dc(_0x45c15c);})[_0x433a('0x14')](function(_0x34b6a7){logger['error'](_0x433a('0x1a'),_0x34b6a7[_0x433a('0x12')],_0x839594);_0x51c99d(_0x1769c3[_0x433a('0x10')](0x1f4,_0x34b6a7[_0x433a('0x12')]));});});}; \ No newline at end of file +var _0x8d3a=['error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','catch','update','body','attributes','UpdateVoiceAgentReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x56fbf6,_0x14fa32){var _0x33722b=function(_0x3b34c3){while(--_0x3b34c3){_0x56fbf6['push'](_0x56fbf6['shift']());}};_0x33722b(++_0x14fa32);}(_0x8d3a,0x1df));var _0xa8d3=function(_0x368c75,_0x386385){_0x368c75=_0x368c75-0x0;var _0x2d7a2b=_0x8d3a[_0x368c75];return _0x2d7a2b;};'use strict';var _=require(_0xa8d3('0x0'));var util=require(_0xa8d3('0x1'));var moment=require('moment');var BPromise=require(_0xa8d3('0x2'));var rs=require(_0xa8d3('0x3'));var fs=require('fs');var Redis=require(_0xa8d3('0x4'));var db=require(_0xa8d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8d3('0x6'))('rpc');var config=require(_0xa8d3('0x7'));var jayson=require(_0xa8d3('0x8'));var client=jayson[_0xa8d3('0x9')][_0xa8d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49904a,_0x4e2fa8,_0x54e948){return new BPromise(function(_0xbb0371,_0x2eeed7){return client['request'](_0x49904a,_0x54e948)[_0xa8d3('0xb')](function(_0x16d924){logger[_0xa8d3('0xc')](_0xa8d3('0xd'),_0x4e2fa8,_0xa8d3('0xe'));logger[_0xa8d3('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x4e2fa8,_0xa8d3('0xe'),JSON[_0xa8d3('0x10')](_0x16d924));if(_0x16d924['error']){if(_0x16d924[_0xa8d3('0x11')][_0xa8d3('0x12')]===0x1f4){logger[_0xa8d3('0x11')](_0xa8d3('0xd'),_0x4e2fa8,_0x16d924['error'][_0xa8d3('0x13')]);return _0x2eeed7(_0x16d924[_0xa8d3('0x11')][_0xa8d3('0x13')]);}logger[_0xa8d3('0x11')](_0xa8d3('0xd'),_0x4e2fa8,_0x16d924[_0xa8d3('0x11')]['message']);return _0xbb0371(_0x16d924[_0xa8d3('0x11')]['message']);}else{logger['info'](_0xa8d3('0xd'),_0x4e2fa8,_0xa8d3('0xe'));_0xbb0371(_0x16d924[_0xa8d3('0x14')][_0xa8d3('0x13')]);}})['catch'](function(_0xa7b9a5){logger[_0xa8d3('0x11')](_0xa8d3('0xd'),_0x4e2fa8,_0xa7b9a5);_0x2eeed7(_0xa7b9a5);});});}exports[_0xa8d3('0x15')]=function(_0x20b500){var _0x1c4cae=this;return new Promise(function(_0x626b4c,_0xe951cf){return db[_0xa8d3('0x16')][_0xa8d3('0x17')](_0x20b500['body'],{'raw':_0x20b500[_0xa8d3('0x18')]?_0x20b500['options'][_0xa8d3('0x19')]===undefined?!![]:![]:!![]})[_0xa8d3('0xb')](function(_0x5c452c){logger[_0xa8d3('0xc')]('CreateVoiceAgentReport',_0x20b500);logger[_0xa8d3('0xf')](_0xa8d3('0x15'),_0x20b500,JSON[_0xa8d3('0x10')](_0x5c452c));_0x626b4c(_0x5c452c);})[_0xa8d3('0x1a')](function(_0x2a0bb5){logger[_0xa8d3('0x11')]('CreateVoiceAgentReport',_0x2a0bb5['message'],_0x20b500);_0xe951cf(_0x1c4cae[_0xa8d3('0x11')](0x1f4,_0x2a0bb5['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x353ff9){var _0x37a9a1=this;return new Promise(function(_0x2fc25c,_0x2c1b7f){return db[_0xa8d3('0x16')][_0xa8d3('0x1b')](_0x353ff9[_0xa8d3('0x1c')],{'raw':_0x353ff9[_0xa8d3('0x18')]?_0x353ff9[_0xa8d3('0x18')][_0xa8d3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x353ff9[_0xa8d3('0x18')]?_0x353ff9['options']['where']||null:null,'attributes':_0x353ff9[_0xa8d3('0x18')]?_0x353ff9[_0xa8d3('0x18')][_0xa8d3('0x1d')]||null:null,'limit':_0x353ff9[_0xa8d3('0x18')]?_0x353ff9[_0xa8d3('0x18')]['limit']||null:null})[_0xa8d3('0xb')](function(_0x2e09a1){logger[_0xa8d3('0xc')](_0xa8d3('0x1e'),_0x353ff9);logger[_0xa8d3('0xf')](_0xa8d3('0x1e'),_0x353ff9,JSON[_0xa8d3('0x10')](_0x2e09a1));_0x2fc25c(_0x2e09a1);})[_0xa8d3('0x1a')](function(_0x2725e1){logger['error'](_0xa8d3('0x1e'),_0x2725e1[_0xa8d3('0x13')],_0x353ff9);_0x2c1b7f(_0x37a9a1['error'](0x1f4,_0x2725e1[_0xa8d3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 112b473..48b3343 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 _0x4d83=['update','/with-retry/:id','updateWithRetry','delete','destroy','exports','express','Router','./voiceCallReport.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id'];(function(_0x4b0c8b,_0x5e4335){var _0x15fa28=function(_0x55f8a5){while(--_0x55f8a5){_0x4b0c8b['push'](_0x4b0c8b['shift']());}};_0x15fa28(++_0x5e4335);}(_0x4d83,0x102));var _0x34d8=function(_0x4faa06,_0x2cd369){_0x4faa06=_0x4faa06-0x0;var _0x5b808a=_0x4d83[_0x4faa06];return _0x5b808a;};'use strict';var express=require(_0x34d8('0x0'));var router=express[_0x34d8('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x34d8('0x2'));router[_0x34d8('0x3')]('/',auth[_0x34d8('0x4')](),controller[_0x34d8('0x5')]);router[_0x34d8('0x3')]('/describe',auth[_0x34d8('0x4')](),controller[_0x34d8('0x6')]);router[_0x34d8('0x3')]('/:id',auth[_0x34d8('0x4')](),controller[_0x34d8('0x7')]);router[_0x34d8('0x8')]('/',auth[_0x34d8('0x4')](),controller[_0x34d8('0x9')]);router[_0x34d8('0xa')](_0x34d8('0xb'),auth['isAuthenticated'](),controller[_0x34d8('0xc')]);router['put'](_0x34d8('0xd'),auth['isAuthenticated'](),controller[_0x34d8('0xe')]);router[_0x34d8('0xf')](_0x34d8('0xb'),auth[_0x34d8('0x4')](),controller[_0x34d8('0x10')]);module[_0x34d8('0x11')]=router; \ No newline at end of file +var _0xec6c=['post','create','put','update','/with-retry/:id','updateWithRetry','delete','destroy','exports','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x593c1b,_0x35c524){var _0x4e0c07=function(_0x8c0aab){while(--_0x8c0aab){_0x593c1b['push'](_0x593c1b['shift']());}};_0x4e0c07(++_0x35c524);}(_0xec6c,0x7b));var _0xcec6=function(_0x456c90,_0xf47acc){_0x456c90=_0x456c90-0x0;var _0x38b2fc=_0xec6c[_0x456c90];return _0x38b2fc;};'use strict';var express=require(_0xcec6('0x0'));var router=express[_0xcec6('0x1')]();var auth=require(_0xcec6('0x2'));var controller=require(_0xcec6('0x3'));router[_0xcec6('0x4')]('/',auth[_0xcec6('0x5')](),controller[_0xcec6('0x6')]);router['get'](_0xcec6('0x7'),auth[_0xcec6('0x5')](),controller['describe']);router[_0xcec6('0x4')](_0xcec6('0x8'),auth[_0xcec6('0x5')](),controller[_0xcec6('0x9')]);router[_0xcec6('0xa')]('/',auth[_0xcec6('0x5')](),controller[_0xcec6('0xb')]);router[_0xcec6('0xc')](_0xcec6('0x8'),auth[_0xcec6('0x5')](),controller[_0xcec6('0xd')]);router[_0xcec6('0xc')](_0xcec6('0xe'),auth[_0xcec6('0x5')](),controller[_0xcec6('0xf')]);router[_0xcec6('0x10')](_0xcec6('0x8'),auth[_0xcec6('0x5')](),controller[_0xcec6('0x11')]);module[_0xcec6('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 5a5dd45..e552d18 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 _0x215d=['outbound','inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal'];(function(_0x4f6c26,_0x5c2c54){var _0x4809a0=function(_0x1b30a9){while(--_0x1b30a9){_0x4f6c26['push'](_0x4f6c26['shift']());}};_0x4809a0(++_0x5c2c54);}(_0x215d,0x187));var _0xd215=function(_0x5ca7cb,_0x27ef93){_0x5ca7cb=_0x5ca7cb-0x0;var _0x58e633=_0x215d[_0x5ca7cb];return _0x58e633;};'use strict';var Sequelize=require(_0xd215('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xd215('0x1')]},'type':{'type':Sequelize[_0xd215('0x2')](_0xd215('0x3'),_0xd215('0x4'),_0xd215('0x5'),_0xd215('0x6'),'outbound-fax',_0xd215('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd215('0x1')]},'source':{'type':Sequelize[_0xd215('0x1')]},'destination':{'type':Sequelize[_0xd215('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd215('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xd215('0x1')]},'lastapplication':{'type':Sequelize[_0xd215('0x1')]},'lastdata':{'type':Sequelize[_0xd215('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xd215('0x9')]},'answertime':{'type':Sequelize[_0xd215('0x9')]},'endtime':{'type':Sequelize[_0xd215('0x9')]},'duration':{'type':Sequelize[_0xd215('0xa')]},'billableseconds':{'type':Sequelize[_0xd215('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd215('0x1')]},'amaflags':{'type':Sequelize[_0xd215('0x1')]},'userfield':{'type':Sequelize[_0xd215('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xd215('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xd215('0x1')]},'note':{'type':Sequelize[_0xd215('0x1')]},'prefix':{'type':Sequelize[_0xd215('0x1')]},'routeid':{'type':Sequelize[_0xd215('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4f31=['exports','ENUM','internal','outbound','inbound-fax','outbound-fax','STRING','DATE','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f31,0x13f));var _0x14f3=function(_0x32d860,_0x4ab403){_0x32d860=_0x32d860-0x0;var _0x535099=_0x4f31[_0x32d860];return _0x535099;};'use strict';var Sequelize=require(_0x14f3('0x0'));module[_0x14f3('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x14f3('0x2')]('inbound',_0x14f3('0x3'),_0x14f3('0x4'),_0x14f3('0x5'),_0x14f3('0x6'),'dialer')},'tag':{'type':Sequelize[_0x14f3('0x7')]},'accountcode':{'type':Sequelize[_0x14f3('0x7')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x14f3('0x7')]},'callerid':{'type':Sequelize[_0x14f3('0x7')]},'channel':{'type':Sequelize[_0x14f3('0x7')]},'destinationchannel':{'type':Sequelize[_0x14f3('0x7')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x14f3('0x8')]},'answertime':{'type':Sequelize[_0x14f3('0x8')]},'endtime':{'type':Sequelize[_0x14f3('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x14f3('0x9')]},'mohtime':{'type':Sequelize[_0x14f3('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x14f3('0x7')]},'amaflags':{'type':Sequelize[_0x14f3('0x7')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x14f3('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x14f3('0x7')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x14f3('0x7')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x14f3('0x7')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 5636b53..5563582 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 _0xbd8e=['then','end','sendStatus','error','stack','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','where','filter','merge','options','includeAll','include','fullname','User','findAll','rows','show','params','find','catch','destroy','describe','user','body','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../components/parsers/qs','../../mysqldb','status','json','offset','undefined','count','limit','set','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd8e,0x1b5));var _0xebd8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbd8e[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xebd8('0x0'));var qs=require(_0xebd8('0x1'));var logger=require('../../config/logger')('api');var db=require(_0xebd8('0x2'))['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x20cbfb,_0x377073){_0x377073=_0x377073||0xc8;return function(_0x4dbd60){if(_0x4dbd60){return _0x20cbfb[_0xebd8('0x3')](_0x377073)[_0xebd8('0x4')](_0x4dbd60);}};}function respondWithFilteredResult(_0x4c86ea,_0x225b6e){return function(_0x1ef9d9){if(_0x1ef9d9){var _0x3f2b2e=typeof _0x225b6e[_0xebd8('0x5')]===_0xebd8('0x6')&&typeof _0x225b6e['limit']===_0xebd8('0x6');var _0x3405f6=_0x1ef9d9[_0xebd8('0x7')];var _0x13afa5=_0x3f2b2e?0x0:_0x225b6e['offset'];var _0x5e4640=_0x3f2b2e?_0x1ef9d9['count']:_0x225b6e[_0xebd8('0x5')]+_0x225b6e[_0xebd8('0x8')];var _0x25976d;if(_0x5e4640>=_0x3405f6){_0x5e4640=_0x3405f6;_0x25976d=0xc8;}else{_0x25976d=0xce;}_0x4c86ea[_0xebd8('0x3')](_0x25976d);return _0x4c86ea[_0xebd8('0x9')]('Content-Range',_0x13afa5+'-'+_0x5e4640+'/'+_0x3405f6)[_0xebd8('0x4')](_0x1ef9d9);}return null;};}function saveUpdates(_0x549218){return function(_0x247d34){if(_0x247d34){return _0x247d34[_0xebd8('0xa')](_0x549218)['then'](function(_0x1f5e36){return _0x1f5e36;});}return null;};}function removeEntity(_0x29c7c3){return function(_0x296ee9){if(_0x296ee9){return _0x296ee9['destroy']()[_0xebd8('0xb')](function(){_0x29c7c3['status'](0xcc)[_0xebd8('0xc')]();});}};}function handleEntityNotFound(_0x5dd513){return function(_0x598f71){if(!_0x598f71){_0x5dd513[_0xebd8('0xd')](0x194);}return _0x598f71;};}function handleError(_0x10d4eb,_0x2162ad){_0x2162ad=_0x2162ad||0x1f4;return function(_0x358651){logger[_0xebd8('0xe')](_0x358651[_0xebd8('0xf')]);if(_0x358651[_0xebd8('0x10')]){delete _0x358651[_0xebd8('0x10')];}_0x10d4eb[_0xebd8('0x3')](_0x2162ad)[_0xebd8('0x11')](_0x358651);};}exports[_0xebd8('0x12')]=function(_0x46a956,_0x204593){var _0x474806={},_0x4e8ebc={},_0x158940={'count':0x0,'rows':[]};var _0x4577a9=_[_0xebd8('0x13')](db[_0xebd8('0x14')][_0xebd8('0x15')],function(_0x24be02){return{'name':_0x24be02[_0xebd8('0x16')],'type':_0x24be02[_0xebd8('0x17')][_0xebd8('0x18')]};});_0x4e8ebc['model']=_[_0xebd8('0x13')](_0x4577a9,_0xebd8('0x10'));_0x4e8ebc[_0xebd8('0x19')]=_[_0xebd8('0x1a')](_0x46a956[_0xebd8('0x19')]);_0x4e8ebc[_0xebd8('0x1b')]=_[_0xebd8('0x1c')](_0x4e8ebc[_0xebd8('0x1d')],_0x4e8ebc[_0xebd8('0x19')]);_0x474806[_0xebd8('0x1e')]=_[_0xebd8('0x1c')](_0x4e8ebc[_0xebd8('0x1d')],qs[_0xebd8('0x1f')](_0x46a956['query'][_0xebd8('0x1f')]));_0x474806['attributes']=_0x474806[_0xebd8('0x1e')][_0xebd8('0x20')]?_0x474806[_0xebd8('0x1e')]:_0x4e8ebc[_0xebd8('0x1d')];if(!_0x46a956['query']['hasOwnProperty'](_0xebd8('0x21'))){_0x474806[_0xebd8('0x8')]=qs[_0xebd8('0x8')](_0x46a956[_0xebd8('0x19')][_0xebd8('0x8')]);_0x474806[_0xebd8('0x5')]=qs[_0xebd8('0x5')](_0x46a956['query']['offset']);}_0x474806[_0xebd8('0x22')]=qs['sort'](_0x46a956[_0xebd8('0x19')]['sort']);_0x474806[_0xebd8('0x23')]=qs[_0xebd8('0x1b')](_['pick'](_0x46a956[_0xebd8('0x19')],_0x4e8ebc['filters']),_0x4577a9);if(_0x46a956[_0xebd8('0x19')][_0xebd8('0x24')]){_0x474806[_0xebd8('0x23')]=_['merge'](_0x474806['where'],{'$or':_[_0xebd8('0x13')](_0x4577a9,function(_0x2d6205){if(_0x2d6205[_0xebd8('0x17')]!=='VIRTUAL'){var _0x101e00={};_0x101e00[_0x2d6205[_0xebd8('0x10')]]={'$like':'%'+_0x46a956[_0xebd8('0x19')][_0xebd8('0x24')]+'%'};return _0x101e00;}})});}_0x474806=_[_0xebd8('0x25')]({},_0x474806,_0x46a956[_0xebd8('0x26')]);var _0x40a9ae={'where':_0x474806[_0xebd8('0x23')]};return db[_0xebd8('0x14')][_0xebd8('0x7')](_0x40a9ae)[_0xebd8('0xb')](function(_0x12e56b){_0x158940[_0xebd8('0x7')]=_0x12e56b;if(_0x46a956[_0xebd8('0x19')][_0xebd8('0x27')]){_0x474806[_0xebd8('0x28')]=[{'attributes':['id',_0xebd8('0x10'),_0xebd8('0x29'),'alias'],'model':db[_0xebd8('0x2a')],'as':_0xebd8('0x2a')}];}return db['VoiceCallReport'][_0xebd8('0x2b')](_0x474806);})[_0xebd8('0xb')](function(_0x2cd4a0){_0x158940[_0xebd8('0x2c')]=_0x2cd4a0;return _0x158940;})[_0xebd8('0xb')](respondWithFilteredResult(_0x204593,_0x474806))['catch'](handleError(_0x204593,null));};exports[_0xebd8('0x2d')]=function(_0x58af8d,_0x380812){var _0x2db571={'raw':!![],'where':{'id':_0x58af8d[_0xebd8('0x2e')]['id']}},_0x348bb7={};_0x348bb7[_0xebd8('0x1d')]=_[_0xebd8('0x1a')](db['VoiceCallReport'][_0xebd8('0x15')]);_0x348bb7[_0xebd8('0x19')]=_['keys'](_0x58af8d[_0xebd8('0x19')]);_0x348bb7['filters']=_[_0xebd8('0x1c')](_0x348bb7[_0xebd8('0x1d')],_0x348bb7[_0xebd8('0x19')]);_0x2db571[_0xebd8('0x1e')]=_['intersection'](_0x348bb7[_0xebd8('0x1d')],qs[_0xebd8('0x1f')](_0x58af8d[_0xebd8('0x19')]['fields']));_0x2db571[_0xebd8('0x1e')]=_0x2db571[_0xebd8('0x1e')][_0xebd8('0x20')]?_0x2db571[_0xebd8('0x1e')]:_0x348bb7[_0xebd8('0x1d')];if(_0x58af8d[_0xebd8('0x19')][_0xebd8('0x27')]){_0x2db571[_0xebd8('0x28')]=[{'all':!![]}];}_0x2db571=_[_0xebd8('0x25')]({},_0x2db571,_0x58af8d[_0xebd8('0x26')]);return db[_0xebd8('0x14')][_0xebd8('0x2f')](_0x2db571)['then'](handleEntityNotFound(_0x380812,null))[_0xebd8('0xb')](respondWithResult(_0x380812,null))[_0xebd8('0x30')](handleError(_0x380812,null));};exports['create']=function(_0x1ea255,_0x32b470){return db[_0xebd8('0x14')]['create'](_0x1ea255['body'],{})['then'](respondWithResult(_0x32b470,0xc9))[_0xebd8('0x30')](handleError(_0x32b470,null));};exports[_0xebd8('0x31')]=function(_0x3b205a,_0x2c6f08){return db['VoiceCallReport']['find']({'where':{'id':_0x3b205a[_0xebd8('0x2e')]['id']}})['then'](handleEntityNotFound(_0x2c6f08,null))['then'](removeEntity(_0x2c6f08,null))[_0xebd8('0x30')](handleError(_0x2c6f08,null));};exports[_0xebd8('0x32')]=function(_0x42de4e,_0x495280){return db[_0xebd8('0x14')][_0xebd8('0x32')]()[_0xebd8('0xb')](respondWithResult(_0x495280,null))[_0xebd8('0x30')](handleError(_0x495280,null));};function findForUpdate(_0x447937){return db['VoiceCallReport']['find']({'where':{'uniqueid':_0x447937['params']['id'],'UserId':{'$or':[null,_0x447937[_0xebd8('0x33')]['id']]}}});}exports[_0xebd8('0xa')]=function(_0x566dcd,_0x13bd63){if(_0x566dcd[_0xebd8('0x34')][_0xebd8('0x35')]){delete _0x566dcd[_0xebd8('0x34')]['uniqueid'];}return findForUpdate(_0x566dcd)[_0xebd8('0xb')](handleEntityNotFound(_0x13bd63,null))['then'](saveUpdates(_0x566dcd[_0xebd8('0x34')],null))[_0xebd8('0xb')](respondWithResult(_0x13bd63,null))[_0xebd8('0x30')](handleError(_0x13bd63,null));};exports[_0xebd8('0x36')]=function(_0x29f10f,_0x22a336,_0x123ed8){if(_0x29f10f['body'][_0xebd8('0x35')]){delete _0x29f10f[_0xebd8('0x34')][_0xebd8('0x35')];}promiseRetry(function(_0x25b10d){return findForUpdate(_0x29f10f)[_0xebd8('0xb')](function(_0x541a4e){if(_0x541a4e!==null){return _0x541a4e;}else{_0x25b10d(new Error(_0xebd8('0x37')));}});},{'retries':0x4,'minTimeout':0xfa})[_0xebd8('0xb')](function(_0x3713b7){if(!_0x3713b7){return new Promise(function(_0x3d6f60){_0x3d6f60(handleEntityNotFound(_0x22a336)());});}else{return _0x3713b7[_0xebd8('0xa')](_0x29f10f['body'])[_0xebd8('0xb')](function(_0x16d43a){return respondWithResult(_0x22a336)(_0x16d43a);});}},function(){handleEntityNotFound(_0x22a336)();});}; \ No newline at end of file +var _0x3914=['params','rawAttributes','keys','includeAll','find','create','body','describe','user','uniqueid','No\x20such\x20report','lodash','../../components/parsers/qs','api','../../mysqldb','json','offset','limit','undefined','status','Content-Range','update','then','destroy','end','error','stack','name','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','VoiceCallReport','count','include','fullname','alias','User','findAll','rows','catch','show'];(function(_0x12ac5b,_0x23aed9){var _0x47ec60=function(_0x5224a9){while(--_0x5224a9){_0x12ac5b['push'](_0x12ac5b['shift']());}};_0x47ec60(++_0x23aed9);}(_0x3914,0xeb));var _0x4391=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0x3914[_0x2074db];return _0x27324c;};'use strict';var _=require(_0x4391('0x0'));var qs=require(_0x4391('0x1'));var logger=require('../../config/logger')(_0x4391('0x2'));var db=require(_0x4391('0x3'))['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x1e8010,_0x343fb7){_0x343fb7=_0x343fb7||0xc8;return function(_0x175dbc){if(_0x175dbc){return _0x1e8010['status'](_0x343fb7)[_0x4391('0x4')](_0x175dbc);}};}function respondWithFilteredResult(_0x2b9b2b,_0x540b62){return function(_0x3717d5){if(_0x3717d5){var _0x49819d=typeof _0x540b62[_0x4391('0x5')]==='undefined'&&typeof _0x540b62[_0x4391('0x6')]===_0x4391('0x7');var _0x57c763=_0x3717d5['count'];var _0x3d6693=_0x49819d?0x0:_0x540b62[_0x4391('0x5')];var _0x3539e3=_0x49819d?_0x3717d5['count']:_0x540b62[_0x4391('0x5')]+_0x540b62[_0x4391('0x6')];var _0x3d485d;if(_0x3539e3>=_0x57c763){_0x3539e3=_0x57c763;_0x3d485d=0xc8;}else{_0x3d485d=0xce;}_0x2b9b2b[_0x4391('0x8')](_0x3d485d);return _0x2b9b2b['set'](_0x4391('0x9'),_0x3d6693+'-'+_0x3539e3+'/'+_0x57c763)[_0x4391('0x4')](_0x3717d5);}return null;};}function saveUpdates(_0x1577bc){return function(_0x137902){if(_0x137902){return _0x137902[_0x4391('0xa')](_0x1577bc)[_0x4391('0xb')](function(_0xca9ef5){return _0xca9ef5;});}return null;};}function removeEntity(_0x30a975){return function(_0x5bdd9e){if(_0x5bdd9e){return _0x5bdd9e[_0x4391('0xc')]()[_0x4391('0xb')](function(){_0x30a975[_0x4391('0x8')](0xcc)[_0x4391('0xd')]();});}};}function handleEntityNotFound(_0x536e5d){return function(_0x62c763){if(!_0x62c763){_0x536e5d['sendStatus'](0x194);}return _0x62c763;};}function handleError(_0x343203,_0x3a1b80){_0x3a1b80=_0x3a1b80||0x1f4;return function(_0x3e4585){logger[_0x4391('0xe')](_0x3e4585[_0x4391('0xf')]);if(_0x3e4585[_0x4391('0x10')]){delete _0x3e4585[_0x4391('0x10')];}_0x343203[_0x4391('0x8')](_0x3a1b80)['send'](_0x3e4585);};}exports['index']=function(_0x2ecb23,_0x4da0b0){var _0x42454e={},_0x13d63f={},_0xa9c97f={'count':0x0,'rows':[]};var _0x10271e=_[_0x4391('0x11')](db['VoiceCallReport']['rawAttributes'],function(_0x36c34c){return{'name':_0x36c34c[_0x4391('0x12')],'type':_0x36c34c[_0x4391('0x13')]['key']};});_0x13d63f[_0x4391('0x14')]=_[_0x4391('0x11')](_0x10271e,_0x4391('0x10'));_0x13d63f[_0x4391('0x15')]=_['keys'](_0x2ecb23[_0x4391('0x15')]);_0x13d63f[_0x4391('0x16')]=_[_0x4391('0x17')](_0x13d63f[_0x4391('0x14')],_0x13d63f[_0x4391('0x15')]);_0x42454e[_0x4391('0x18')]=_['intersection'](_0x13d63f[_0x4391('0x14')],qs[_0x4391('0x19')](_0x2ecb23[_0x4391('0x15')][_0x4391('0x19')]));_0x42454e['attributes']=_0x42454e['attributes'][_0x4391('0x1a')]?_0x42454e[_0x4391('0x18')]:_0x13d63f[_0x4391('0x14')];if(!_0x2ecb23[_0x4391('0x15')][_0x4391('0x1b')]('nolimit')){_0x42454e['limit']=qs['limit'](_0x2ecb23['query'][_0x4391('0x6')]);_0x42454e[_0x4391('0x5')]=qs[_0x4391('0x5')](_0x2ecb23[_0x4391('0x15')]['offset']);}_0x42454e[_0x4391('0x1c')]=qs[_0x4391('0x1d')](_0x2ecb23[_0x4391('0x15')][_0x4391('0x1d')]);_0x42454e[_0x4391('0x1e')]=qs['filters'](_[_0x4391('0x1f')](_0x2ecb23[_0x4391('0x15')],_0x13d63f[_0x4391('0x16')]),_0x10271e);if(_0x2ecb23[_0x4391('0x15')][_0x4391('0x20')]){_0x42454e[_0x4391('0x1e')]=_[_0x4391('0x21')](_0x42454e[_0x4391('0x1e')],{'$or':_[_0x4391('0x11')](_0x10271e,function(_0x8851cb){if(_0x8851cb[_0x4391('0x13')]!=='VIRTUAL'){var _0x46db4c={};_0x46db4c[_0x8851cb['name']]={'$like':'%'+_0x2ecb23[_0x4391('0x15')]['filter']+'%'};return _0x46db4c;}})});}_0x42454e=_['merge']({},_0x42454e,_0x2ecb23[_0x4391('0x22')]);var _0xf8313b={'where':_0x42454e[_0x4391('0x1e')]};return db[_0x4391('0x23')][_0x4391('0x24')](_0xf8313b)[_0x4391('0xb')](function(_0x205b8e){_0xa9c97f['count']=_0x205b8e;if(_0x2ecb23[_0x4391('0x15')]['includeAll']){_0x42454e[_0x4391('0x25')]=[{'attributes':['id','name',_0x4391('0x26'),_0x4391('0x27')],'model':db[_0x4391('0x28')],'as':_0x4391('0x28')}];}return db[_0x4391('0x23')][_0x4391('0x29')](_0x42454e);})[_0x4391('0xb')](function(_0x4235b3){_0xa9c97f[_0x4391('0x2a')]=_0x4235b3;return _0xa9c97f;})[_0x4391('0xb')](respondWithFilteredResult(_0x4da0b0,_0x42454e))[_0x4391('0x2b')](handleError(_0x4da0b0,null));};exports[_0x4391('0x2c')]=function(_0x477544,_0x110484){var _0x301865={'raw':!![],'where':{'id':_0x477544[_0x4391('0x2d')]['id']}},_0x459415={};_0x459415[_0x4391('0x14')]=_['keys'](db['VoiceCallReport'][_0x4391('0x2e')]);_0x459415[_0x4391('0x15')]=_[_0x4391('0x2f')](_0x477544[_0x4391('0x15')]);_0x459415[_0x4391('0x16')]=_[_0x4391('0x17')](_0x459415[_0x4391('0x14')],_0x459415[_0x4391('0x15')]);_0x301865['attributes']=_[_0x4391('0x17')](_0x459415['model'],qs['fields'](_0x477544['query']['fields']));_0x301865[_0x4391('0x18')]=_0x301865[_0x4391('0x18')][_0x4391('0x1a')]?_0x301865[_0x4391('0x18')]:_0x459415['model'];if(_0x477544['query'][_0x4391('0x30')]){_0x301865['include']=[{'all':!![]}];}_0x301865=_[_0x4391('0x21')]({},_0x301865,_0x477544[_0x4391('0x22')]);return db[_0x4391('0x23')][_0x4391('0x31')](_0x301865)[_0x4391('0xb')](handleEntityNotFound(_0x110484,null))[_0x4391('0xb')](respondWithResult(_0x110484,null))['catch'](handleError(_0x110484,null));};exports[_0x4391('0x32')]=function(_0x3da701,_0x361f44){return db[_0x4391('0x23')][_0x4391('0x32')](_0x3da701[_0x4391('0x33')],{})[_0x4391('0xb')](respondWithResult(_0x361f44,0xc9))['catch'](handleError(_0x361f44,null));};exports[_0x4391('0xc')]=function(_0x1ba3e3,_0x2991ac){return db[_0x4391('0x23')][_0x4391('0x31')]({'where':{'id':_0x1ba3e3[_0x4391('0x2d')]['id']}})[_0x4391('0xb')](handleEntityNotFound(_0x2991ac,null))['then'](removeEntity(_0x2991ac,null))[_0x4391('0x2b')](handleError(_0x2991ac,null));};exports['describe']=function(_0x308a49,_0x46a3c4){return db[_0x4391('0x23')][_0x4391('0x34')]()[_0x4391('0xb')](respondWithResult(_0x46a3c4,null))[_0x4391('0x2b')](handleError(_0x46a3c4,null));};function findForUpdate(_0x34272b){return db[_0x4391('0x23')][_0x4391('0x31')]({'where':{'uniqueid':_0x34272b[_0x4391('0x2d')]['id'],'UserId':{'$or':[null,_0x34272b[_0x4391('0x35')]['id']]}}});}exports[_0x4391('0xa')]=function(_0x125bd7,_0x566cf8){if(_0x125bd7['body'][_0x4391('0x36')]){delete _0x125bd7[_0x4391('0x33')][_0x4391('0x36')];}return findForUpdate(_0x125bd7)[_0x4391('0xb')](handleEntityNotFound(_0x566cf8,null))[_0x4391('0xb')](saveUpdates(_0x125bd7[_0x4391('0x33')],null))['then'](respondWithResult(_0x566cf8,null))[_0x4391('0x2b')](handleError(_0x566cf8,null));};exports['updateWithRetry']=function(_0x2c225e,_0x51afa5,_0x200a3b){if(_0x2c225e[_0x4391('0x33')][_0x4391('0x36')]){delete _0x2c225e[_0x4391('0x33')][_0x4391('0x36')];}promiseRetry(function(_0x3bdeb4){return findForUpdate(_0x2c225e)['then'](function(_0x64417b){if(_0x64417b!==null){return _0x64417b;}else{_0x3bdeb4(new Error(_0x4391('0x37')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x4391('0xb')](function(_0xf2c6e0){if(!_0xf2c6e0){return new Promise(function(_0x29470e){_0x29470e(handleEntityNotFound(_0x51afa5)());});}else{return _0xf2c6e0[_0x4391('0xa')](_0x2c225e[_0x4391('0x33')])[_0x4391('0xb')](function(_0x1ca698){return respondWithResult(_0x51afa5)(_0x1ca698);});}},function(){handleEntityNotFound(_0x51afa5)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 63b5182..b83d22f 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 _0x08ce=['define','report_call','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x08ce,0x86));var _0xe08c=function(_0x2d7daa,_0x3698e0){_0x2d7daa=_0x2d7daa-0x0;var _0x119a17=_0x08ce[_0x2d7daa];return _0x119a17;};'use strict';var _=require(_0xe08c('0x0'));var util=require(_0xe08c('0x1'));var logger=require(_0xe08c('0x2'))(_0xe08c('0x3'));var moment=require(_0xe08c('0x4'));var BPromise=require(_0xe08c('0x5'));var rp=require(_0xe08c('0x6'));var fs=require('fs');var path=require(_0xe08c('0x7'));var rimraf=require(_0xe08c('0x8'));var config=require('../../config/environment');var attributes=require(_0xe08c('0x9'));module['exports']=function(_0xaac72c,_0x44921b){return _0xaac72c[_0xe08c('0xa')]('VoiceCallReport',attributes,{'tableName':_0xe08c('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x96c3=['rimraf','../../config/environment','exports','VoiceCallReport','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x6a3450,_0x5edf9e){var _0x579dc4=function(_0x5a8172){while(--_0x5a8172){_0x6a3450['push'](_0x6a3450['shift']());}};_0x579dc4(++_0x5edf9e);}(_0x96c3,0xff));var _0x396c=function(_0x47271a,_0x2089d2){_0x47271a=_0x47271a-0x0;var _0x2bf54b=_0x96c3[_0x47271a];return _0x2bf54b;};'use strict';var _=require(_0x396c('0x0'));var util=require('util');var logger=require(_0x396c('0x1'))('api');var moment=require(_0x396c('0x2'));var BPromise=require(_0x396c('0x3'));var rp=require(_0x396c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x396c('0x5'));var config=require(_0x396c('0x6'));var attributes=require('./voiceCallReport.attributes');module[_0x396c('0x7')]=function(_0x37b8e1,_0x56a86e){return _0x37b8e1['define'](_0x396c('0x8'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x396c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 706b228..41d3350 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 _0x0496=['jayson/promise','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','attributes','limit','include','map','model','then','stringify','create','body','raw','CreateVoiceCallReport','UpdateVoiceCallReport','update','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0x0496,0x199));var _0x6049=function(_0x34c93b,_0x25ed94){_0x34c93b=_0x34c93b-0x0;var _0x1c0867=_0x0496[_0x34c93b];return _0x1c0867;};'use strict';var _=require(_0x6049('0x0'));var util=require('util');var moment=require(_0x6049('0x1'));var BPromise=require(_0x6049('0x2'));var rs=require(_0x6049('0x3'));var fs=require('fs');var Redis=require(_0x6049('0x4'));var db=require(_0x6049('0x5'))['db'];var utils=require(_0x6049('0x6'));var logger=require('../../config/logger')(_0x6049('0x7'));var config=require(_0x6049('0x8'));var jayson=require(_0x6049('0x9'));var client=jayson[_0x6049('0xa')][_0x6049('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x900e5c,_0x1ddfb0,_0x1f7828){return new BPromise(function(_0x251498,_0x5df90f){return client[_0x6049('0xc')](_0x900e5c,_0x1f7828)['then'](function(_0x53bebe){logger[_0x6049('0xd')](_0x6049('0xe'),_0x1ddfb0,'request\x20sent');logger[_0x6049('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x1ddfb0,_0x6049('0x10'),JSON['stringify'](_0x53bebe));if(_0x53bebe[_0x6049('0x11')]){if(_0x53bebe['error']['code']===0x1f4){logger[_0x6049('0x11')](_0x6049('0xe'),_0x1ddfb0,_0x53bebe[_0x6049('0x11')]['message']);return _0x5df90f(_0x53bebe[_0x6049('0x11')][_0x6049('0x12')]);}logger[_0x6049('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x1ddfb0,_0x53bebe[_0x6049('0x11')][_0x6049('0x12')]);return _0x251498(_0x53bebe[_0x6049('0x11')][_0x6049('0x12')]);}else{logger[_0x6049('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x1ddfb0,_0x6049('0x10'));_0x251498(_0x53bebe[_0x6049('0x13')][_0x6049('0x12')]);}})[_0x6049('0x14')](function(_0x588177){logger[_0x6049('0x11')](_0x6049('0xe'),_0x1ddfb0,_0x588177);_0x5df90f(_0x588177);});});}exports[_0x6049('0x15')]=function(_0x31c9ab){var _0x5653da=this;return new Promise(function(_0x22e004,_0x590382){return db[_0x6049('0x16')]['findAll']({'raw':_0x31c9ab[_0x6049('0x17')]?_0x31c9ab[_0x6049('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x31c9ab['options']?_0x31c9ab['options']['where']||null:null,'attributes':_0x31c9ab[_0x6049('0x17')]?_0x31c9ab['options'][_0x6049('0x18')]||null:null,'limit':_0x31c9ab['options']?_0x31c9ab['options'][_0x6049('0x19')]||null:null,'include':_0x31c9ab[_0x6049('0x17')]?_0x31c9ab['options'][_0x6049('0x1a')]?_[_0x6049('0x1b')](_0x31c9ab[_0x6049('0x17')][_0x6049('0x1a')],function(_0x3ab8b8){return{'model':db[_0x3ab8b8[_0x6049('0x1c')]],'as':_0x3ab8b8['as'],'attributes':_0x3ab8b8['attributes'],'include':_0x3ab8b8['include']?_[_0x6049('0x1b')](_0x3ab8b8[_0x6049('0x1a')],function(_0x3a3abd){return{'model':db[_0x3a3abd[_0x6049('0x1c')]],'as':_0x3a3abd['as'],'attributes':_0x3a3abd[_0x6049('0x18')],'include':_0x3a3abd[_0x6049('0x1a')]?_[_0x6049('0x1b')](_0x3a3abd[_0x6049('0x1a')],function(_0x2a58b6){return{'model':db[_0x2a58b6[_0x6049('0x1c')]],'as':_0x2a58b6['as'],'attributes':_0x2a58b6[_0x6049('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6049('0x1d')](function(_0x3ee919){logger['info']('GetVoiceCallReport',_0x31c9ab);logger[_0x6049('0xf')](_0x6049('0x15'),_0x31c9ab,JSON[_0x6049('0x1e')](_0x3ee919));_0x22e004(_0x3ee919);})[_0x6049('0x14')](function(_0x557367){logger[_0x6049('0x11')](_0x6049('0x15'),_0x557367[_0x6049('0x12')],_0x31c9ab);_0x590382(_0x5653da[_0x6049('0x11')](0x1f4,_0x557367['message']));});});};exports['CreateVoiceCallReport']=function(_0x4e68fc){var _0xe5efe5=this;return new Promise(function(_0x11df04,_0x57f0c8){return db[_0x6049('0x16')][_0x6049('0x1f')](_0x4e68fc[_0x6049('0x20')],{'raw':_0x4e68fc[_0x6049('0x17')]?_0x4e68fc['options'][_0x6049('0x21')]===undefined?!![]:![]:!![]})[_0x6049('0x1d')](function(_0x3dceaa){logger['info']('CreateVoiceCallReport',_0x4e68fc);logger['debug'](_0x6049('0x22'),_0x4e68fc,JSON[_0x6049('0x1e')](_0x3dceaa));_0x11df04(_0x3dceaa);})[_0x6049('0x14')](function(_0x339d18){logger[_0x6049('0x11')]('CreateVoiceCallReport',_0x339d18[_0x6049('0x12')],_0x4e68fc);_0x57f0c8(_0xe5efe5['error'](0x1f4,_0x339d18['message']));});});};exports[_0x6049('0x23')]=function(_0xee37e2){var _0x3c84b5=this;return new Promise(function(_0x1730d,_0x18172f){return db[_0x6049('0x16')][_0x6049('0x24')](_0xee37e2[_0x6049('0x20')],{'raw':_0xee37e2[_0x6049('0x17')]?_0xee37e2[_0x6049('0x17')][_0x6049('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xee37e2['options']?_0xee37e2[_0x6049('0x17')][_0x6049('0x25')]||null:null,'attributes':_0xee37e2[_0x6049('0x17')]?_0xee37e2[_0x6049('0x17')][_0x6049('0x18')]||null:null,'limit':_0xee37e2[_0x6049('0x17')]?_0xee37e2[_0x6049('0x17')][_0x6049('0x19')]||null:null})[_0x6049('0x1d')](function(_0x17b6a5){logger[_0x6049('0xd')](_0x6049('0x23'),_0xee37e2);logger['debug']('UpdateVoiceCallReport',_0xee37e2,JSON['stringify'](_0x17b6a5));_0x1730d(_0x17b6a5);})[_0x6049('0x14')](function(_0x3c993d){logger[_0x6049('0x11')](_0x6049('0x23'),_0x3c993d[_0x6049('0x12')],_0xee37e2);_0x18172f(_0x3c84b5[_0x6049('0x11')](0x1f4,_0x3c993d[_0x6049('0x12')]));});});}; \ No newline at end of file +var _0xf354=['stringify','error','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','include','model','map','catch','CreateVoiceCallReport','body','UpdateVoiceCallReport','update','limit','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf354,0x17c));var _0x4f35=function(_0x500c5b,_0xb87b75){_0x500c5b=_0x500c5b-0x0;var _0x91e220=_0xf354[_0x500c5b];return _0x91e220;};'use strict';var _=require(_0x4f35('0x0'));var util=require(_0x4f35('0x1'));var moment=require('moment');var BPromise=require(_0x4f35('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f35('0x3'));var db=require(_0x4f35('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f35('0x5'));var config=require(_0x4f35('0x6'));var jayson=require(_0x4f35('0x7'));var client=jayson[_0x4f35('0x8')][_0x4f35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3644d2,_0x37a5da,_0x1ea44b){return new BPromise(function(_0x3ac6f6,_0x4c8b77){return client[_0x4f35('0xa')](_0x3644d2,_0x1ea44b)[_0x4f35('0xb')](function(_0x2be5d0){logger[_0x4f35('0xc')](_0x4f35('0xd'),_0x37a5da,_0x4f35('0xe'));logger[_0x4f35('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x37a5da,_0x4f35('0xe'),JSON[_0x4f35('0x10')](_0x2be5d0));if(_0x2be5d0[_0x4f35('0x11')]){if(_0x2be5d0['error']['code']===0x1f4){logger[_0x4f35('0x11')](_0x4f35('0xd'),_0x37a5da,_0x2be5d0[_0x4f35('0x11')]['message']);return _0x4c8b77(_0x2be5d0[_0x4f35('0x11')]['message']);}logger[_0x4f35('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x37a5da,_0x2be5d0[_0x4f35('0x11')][_0x4f35('0x12')]);return _0x3ac6f6(_0x2be5d0[_0x4f35('0x11')][_0x4f35('0x12')]);}else{logger[_0x4f35('0xc')](_0x4f35('0xd'),_0x37a5da,_0x4f35('0xe'));_0x3ac6f6(_0x2be5d0[_0x4f35('0x13')]['message']);}})['catch'](function(_0x24ce4b){logger[_0x4f35('0x11')](_0x4f35('0xd'),_0x37a5da,_0x24ce4b);_0x4c8b77(_0x24ce4b);});});}exports[_0x4f35('0x14')]=function(_0x52c293){var _0x4c6572=this;return new Promise(function(_0x5eff30,_0x227f84){return db[_0x4f35('0x15')][_0x4f35('0x16')]({'raw':_0x52c293[_0x4f35('0x17')]?_0x52c293['options'][_0x4f35('0x18')]===undefined?!![]:![]:!![],'where':_0x52c293[_0x4f35('0x17')]?_0x52c293['options'][_0x4f35('0x19')]||null:null,'attributes':_0x52c293['options']?_0x52c293['options'][_0x4f35('0x1a')]||null:null,'limit':_0x52c293[_0x4f35('0x17')]?_0x52c293[_0x4f35('0x17')]['limit']||null:null,'include':_0x52c293['options']?_0x52c293[_0x4f35('0x17')][_0x4f35('0x1b')]?_['map'](_0x52c293[_0x4f35('0x17')]['include'],function(_0x407e18){return{'model':db[_0x407e18[_0x4f35('0x1c')]],'as':_0x407e18['as'],'attributes':_0x407e18[_0x4f35('0x1a')],'include':_0x407e18[_0x4f35('0x1b')]?_[_0x4f35('0x1d')](_0x407e18[_0x4f35('0x1b')],function(_0x54e8d9){return{'model':db[_0x54e8d9[_0x4f35('0x1c')]],'as':_0x54e8d9['as'],'attributes':_0x54e8d9['attributes'],'include':_0x54e8d9[_0x4f35('0x1b')]?_['map'](_0x54e8d9['include'],function(_0x3edff2){return{'model':db[_0x3edff2[_0x4f35('0x1c')]],'as':_0x3edff2['as'],'attributes':_0x3edff2[_0x4f35('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf01660){logger[_0x4f35('0xc')]('GetVoiceCallReport',_0x52c293);logger[_0x4f35('0xf')](_0x4f35('0x14'),_0x52c293,JSON['stringify'](_0xf01660));_0x5eff30(_0xf01660);})[_0x4f35('0x1e')](function(_0x559e7b){logger['error'](_0x4f35('0x14'),_0x559e7b[_0x4f35('0x12')],_0x52c293);_0x227f84(_0x4c6572[_0x4f35('0x11')](0x1f4,_0x559e7b[_0x4f35('0x12')]));});});};exports[_0x4f35('0x1f')]=function(_0x47e5c5){var _0x51202a=this;return new Promise(function(_0xda6e22,_0xe72df7){return db[_0x4f35('0x15')]['create'](_0x47e5c5[_0x4f35('0x20')],{'raw':_0x47e5c5['options']?_0x47e5c5[_0x4f35('0x17')][_0x4f35('0x18')]===undefined?!![]:![]:!![]})[_0x4f35('0xb')](function(_0x4b50f8){logger[_0x4f35('0xc')]('CreateVoiceCallReport',_0x47e5c5);logger[_0x4f35('0xf')]('CreateVoiceCallReport',_0x47e5c5,JSON[_0x4f35('0x10')](_0x4b50f8));_0xda6e22(_0x4b50f8);})[_0x4f35('0x1e')](function(_0x53a957){logger[_0x4f35('0x11')](_0x4f35('0x1f'),_0x53a957[_0x4f35('0x12')],_0x47e5c5);_0xe72df7(_0x51202a[_0x4f35('0x11')](0x1f4,_0x53a957['message']));});});};exports[_0x4f35('0x21')]=function(_0x3321f2){var _0x5aa01b=this;return new Promise(function(_0x58a76f,_0x223922){return db['VoiceCallReport'][_0x4f35('0x22')](_0x3321f2[_0x4f35('0x20')],{'raw':_0x3321f2['options']?_0x3321f2[_0x4f35('0x17')][_0x4f35('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3321f2[_0x4f35('0x17')]?_0x3321f2[_0x4f35('0x17')]['where']||null:null,'attributes':_0x3321f2[_0x4f35('0x17')]?_0x3321f2[_0x4f35('0x17')][_0x4f35('0x1a')]||null:null,'limit':_0x3321f2['options']?_0x3321f2[_0x4f35('0x17')][_0x4f35('0x23')]||null:null})[_0x4f35('0xb')](function(_0x1757f2){logger[_0x4f35('0xc')](_0x4f35('0x21'),_0x3321f2);logger['debug']('UpdateVoiceCallReport',_0x3321f2,JSON['stringify'](_0x1757f2));_0x58a76f(_0x1757f2);})[_0x4f35('0x1e')](function(_0x42729b){logger[_0x4f35('0x11')]('UpdateVoiceCallReport',_0x42729b[_0x4f35('0x12')],_0x3321f2);_0x223922(_0x5aa01b[_0x4f35('0x11')](0x1f4,_0x42729b[_0x4f35('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 482f3db..02183db 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 _0x7f83=['../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','update','delete','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x441f7a,_0x576321){var _0x4821da=function(_0x5c5b52){while(--_0x5c5b52){_0x441f7a['push'](_0x441f7a['shift']());}};_0x4821da(++_0x576321);}(_0x7f83,0x9b));var _0x37f8=function(_0x34279d,_0x4e186c){_0x34279d=_0x34279d-0x0;var _0x42c5f4=_0x7f83[_0x34279d];return _0x42c5f4;};'use strict';var multer=require(_0x37f8('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x37f8('0x1'));var router=express[_0x37f8('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x37f8('0x3'));var interaction=require(_0x37f8('0x4'));var config=require(_0x37f8('0x5'));var controller=require(_0x37f8('0x6'));router[_0x37f8('0x7')]('/',auth[_0x37f8('0x8')](),controller[_0x37f8('0x9')]);router[_0x37f8('0x7')](_0x37f8('0xa'),auth[_0x37f8('0x8')](),controller[_0x37f8('0xb')]);router[_0x37f8('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x37f8('0x8')](),controller[_0x37f8('0xd')]);router[_0x37f8('0xe')](_0x37f8('0xa'),auth[_0x37f8('0x8')](),controller['destroy']);module[_0x37f8('0xf')]=router; \ No newline at end of file +var _0x77bc=['/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','show','post','create','put'];(function(_0x467637,_0x3b0f30){var _0x1c77db=function(_0x4f114e){while(--_0x4f114e){_0x467637['push'](_0x467637['shift']());}};_0x1c77db(++_0x3b0f30);}(_0x77bc,0x108));var _0xc77b=function(_0x4a2324,_0x2c1e3c){_0x4a2324=_0x4a2324-0x0;var _0x159c1d=_0x77bc[_0x4a2324];return _0x159c1d;};'use strict';var multer=require(_0xc77b('0x0'));var util=require(_0xc77b('0x1'));var path=require(_0xc77b('0x2'));var timeout=require('connect-timeout');var express=require(_0xc77b('0x3'));var router=express[_0xc77b('0x4')]();var fs_extra=require(_0xc77b('0x5'));var auth=require(_0xc77b('0x6'));var interaction=require(_0xc77b('0x7'));var config=require(_0xc77b('0x8'));var controller=require(_0xc77b('0x9'));router[_0xc77b('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc77b('0xa')]('/:id',auth[_0xc77b('0xb')](),controller[_0xc77b('0xc')]);router[_0xc77b('0xd')]('/',auth[_0xc77b('0xb')](),controller[_0xc77b('0xe')]);router[_0xc77b('0xf')](_0xc77b('0x10'),auth[_0xc77b('0xb')](),controller['update']);router[_0xc77b('0x11')](_0xc77b('0x10'),auth[_0xc77b('0xb')](),controller[_0xc77b('0x12')]);module[_0xc77b('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 1c6e56a..a5ec6d7 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 _0x6851=['join','getDataValue','options','split','BOOLEAN','sequelize','exports','STRING','setDataValue'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x6851,0x9e));var _0x1685=function(_0x24201a,_0x3ed184){_0x24201a=_0x24201a-0x0;var _0x36a6b9=_0x6851[_0x24201a];return _0x36a6b9;};'use strict';var Sequelize=require(_0x1685('0x0'));module[_0x1685('0x1')]={'name':{'type':Sequelize[_0x1685('0x2')]},'prefix':{'type':Sequelize[_0x1685('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x304dea){this[_0x1685('0x3')]('options',_0x304dea?_0x304dea[_0x1685('0x4')](''):[]);},'get':function(){return this[_0x1685('0x5')](_0x1685('0x6'))?this[_0x1685('0x5')](_0x1685('0x6'))[_0x1685('0x7')](''):[];}},'auth':{'type':Sequelize[_0x1685('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x1685('0x2')]},'record':{'type':Sequelize[_0x1685('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1685('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3fb9=['name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x3fb9,0x183));var _0x93fb=function(_0x361472,_0x3beccc){_0x361472=_0x361472-0x0;var _0x3ce045=_0x3fb9[_0x361472];return _0x3ce045;};'use strict';var Sequelize=require(_0x93fb('0x0'));module[_0x93fb('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x93fb('0x2')],'unique':_0x93fb('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x93fb('0x2')],'set':function(_0xdf97da){this[_0x93fb('0x4')](_0x93fb('0x5'),_0xdf97da?_0xdf97da[_0x93fb('0x6')](''):[]);},'get':function(){return this[_0x93fb('0x7')](_0x93fb('0x5'))?this[_0x93fb('0x7')](_0x93fb('0x5'))[_0x93fb('0x8')](''):[];}},'auth':{'type':Sequelize[_0x93fb('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x93fb('0x2')]},'record':{'type':Sequelize[_0x93fb('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x93fb('0x2')]},'description':{'type':Sequelize[_0x93fb('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 603b6a4..32d050a 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 _0x2182=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','ChanSpies','destroy','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0x2182,0xea));var _0x2218=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2182[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x2218('0x0'));var rimraf=require(_0x2218('0x1'));var zipdir=require(_0x2218('0x2'));var jsonpatch=require(_0x2218('0x3'));var rp=require('request-promise');var moment=require(_0x2218('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2218('0x5'));var util=require(_0x2218('0x6'));var path=require(_0x2218('0x7'));var sox=require(_0x2218('0x8'));var csv=require(_0x2218('0x9'));var ejs=require(_0x2218('0xa'));var fs=require('fs');var fs_extra=require(_0x2218('0xb'));var _=require(_0x2218('0xc'));var squel=require(_0x2218('0xd'));var crypto=require(_0x2218('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2218('0xf'));var toCsv=require(_0x2218('0x9'));var querystring=require(_0x2218('0x10'));var Papa=require(_0x2218('0x11'));var Redis=require('ioredis');var authService=require(_0x2218('0x12'));var qs=require(_0x2218('0x13'));var as=require(_0x2218('0x14'));var hardwareService=require(_0x2218('0x15'));var logger=require('../../config/logger')(_0x2218('0x16'));var utils=require(_0x2218('0x17'));var config=require(_0x2218('0x18'));var licenseUtil=require(_0x2218('0x19'));var db=require(_0x2218('0x1a'))['db'];function respondWithStatusCode(_0x4b1169,_0x1505a3){_0x1505a3=_0x1505a3||0xcc;return function(_0x5d7d24){if(_0x5d7d24){return _0x4b1169[_0x2218('0x1b')](_0x1505a3);}return _0x4b1169[_0x2218('0x1c')](_0x1505a3)[_0x2218('0x1d')]();};}function respondWithResult(_0x2b953a,_0x24722d){_0x24722d=_0x24722d||0xc8;return function(_0x27fde4){if(_0x27fde4){return _0x2b953a[_0x2218('0x1c')](_0x24722d)[_0x2218('0x1e')](_0x27fde4);}};}function respondWithFilteredResult(_0x1556f3,_0x3b89d4){return function(_0x466d80){if(_0x466d80){var _0x17aead=typeof _0x3b89d4[_0x2218('0x1f')]===_0x2218('0x20')&&typeof _0x3b89d4[_0x2218('0x21')]===_0x2218('0x20');var _0xfbc4a1=_0x466d80[_0x2218('0x22')];var _0x1c83ea=_0x17aead?0x0:_0x3b89d4[_0x2218('0x1f')];var _0x5ff3c4=_0x17aead?_0x466d80['count']:_0x3b89d4[_0x2218('0x1f')]+_0x3b89d4[_0x2218('0x21')];var _0x2989f0;if(_0x5ff3c4>=_0xfbc4a1){_0x5ff3c4=_0xfbc4a1;_0x2989f0=0xc8;}else{_0x2989f0=0xce;}_0x1556f3[_0x2218('0x1c')](_0x2989f0);return _0x1556f3[_0x2218('0x23')](_0x2218('0x24'),_0x1c83ea+'-'+_0x5ff3c4+'/'+_0xfbc4a1)[_0x2218('0x1e')](_0x466d80);}return null;};}function patchUpdates(_0x4533c2){return function(_0x2601a8){try{jsonpatch[_0x2218('0x25')](_0x2601a8,_0x4533c2,!![]);}catch(_0x2cee53){return BPromise[_0x2218('0x26')](_0x2cee53);}return _0x2601a8[_0x2218('0x27')]();};}function saveUpdates(_0x439e5d,_0x11a2be){return function(_0x268217){if(_0x268217){return _0x268217[_0x2218('0x28')](_0x439e5d)[_0x2218('0x29')](function(_0x4947a3){return _0x4947a3;});}return null;};}function removeEntity(_0x14c7de,_0x18ecf8){return function(_0x980f15){if(_0x980f15){return _0x980f15['destroy']()['then'](function(){var _0x123996=_0x980f15[_0x2218('0x2a')]({'plain':!![]});var _0x556da6=_0x2218('0x2b');return db['UserProfileResource'][_0x2218('0x2c')]({'where':{'type':_0x556da6,'resourceId':_0x123996['id']}})[_0x2218('0x29')](function(){return _0x980f15;});})[_0x2218('0x29')](function(){_0x14c7de[_0x2218('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a5efa,_0x10f1ff){return function(_0x316651){if(!_0x316651){_0x4a5efa[_0x2218('0x1b')](0x194);}return _0x316651;};}function handleError(_0x193ecf,_0x5037b5){_0x5037b5=_0x5037b5||0x1f4;return function(_0x5acd05){logger['error'](_0x5acd05['stack']);if(_0x5acd05[_0x2218('0x2d')]){delete _0x5acd05[_0x2218('0x2d')];}_0x193ecf[_0x2218('0x1c')](_0x5037b5)[_0x2218('0x2e')](_0x5acd05);};}exports[_0x2218('0x2f')]=function(_0x45ba98,_0x2f3f1f){var _0x15e3fd={},_0xf61acf={},_0x7ffa54={'count':0x0,'rows':[]};var _0x2c1dfc=_[_0x2218('0x30')](db[_0x2218('0x31')][_0x2218('0x32')],function(_0x25921e){return{'name':_0x25921e[_0x2218('0x33')],'type':_0x25921e[_0x2218('0x34')][_0x2218('0x35')]};});_0xf61acf[_0x2218('0x36')]=_['map'](_0x2c1dfc,_0x2218('0x2d'));_0xf61acf[_0x2218('0x37')]=_[_0x2218('0x38')](_0x45ba98['query']);_0xf61acf[_0x2218('0x39')]=_[_0x2218('0x3a')](_0xf61acf[_0x2218('0x36')],_0xf61acf[_0x2218('0x37')]);_0x15e3fd[_0x2218('0x3b')]=_[_0x2218('0x3a')](_0xf61acf[_0x2218('0x36')],qs[_0x2218('0x3c')](_0x45ba98[_0x2218('0x37')]['fields']));_0x15e3fd[_0x2218('0x3b')]=_0x15e3fd[_0x2218('0x3b')][_0x2218('0x3d')]?_0x15e3fd['attributes']:_0xf61acf[_0x2218('0x36')];if(!_0x45ba98[_0x2218('0x37')][_0x2218('0x3e')](_0x2218('0x3f'))){_0x15e3fd[_0x2218('0x21')]=qs[_0x2218('0x21')](_0x45ba98[_0x2218('0x37')][_0x2218('0x21')]);_0x15e3fd[_0x2218('0x1f')]=qs['offset'](_0x45ba98[_0x2218('0x37')][_0x2218('0x1f')]);}_0x15e3fd['order']=qs[_0x2218('0x40')](_0x45ba98[_0x2218('0x37')][_0x2218('0x40')]);_0x15e3fd['where']=qs[_0x2218('0x39')](_['pick'](_0x45ba98['query'],_0xf61acf[_0x2218('0x39')]),_0x2c1dfc);if(_0x45ba98[_0x2218('0x37')][_0x2218('0x41')]){_0x15e3fd[_0x2218('0x42')]=_[_0x2218('0x43')](_0x15e3fd[_0x2218('0x42')],{'$or':_[_0x2218('0x30')](_0x2c1dfc,function(_0x5006b0){if(_0x5006b0[_0x2218('0x34')]!==_0x2218('0x44')){var _0x12435b={};_0x12435b[_0x5006b0[_0x2218('0x2d')]]={'$like':'%'+_0x45ba98['query'][_0x2218('0x41')]+'%'};return _0x12435b;}})});}_0x15e3fd=_[_0x2218('0x43')]({},_0x15e3fd,_0x45ba98[_0x2218('0x45')]);var _0x2978e3={'where':_0x15e3fd['where']};return db['VoiceChanSpy']['count'](_0x2978e3)['then'](function(_0x3a3b58){_0x7ffa54[_0x2218('0x22')]=_0x3a3b58;if(_0x45ba98[_0x2218('0x37')][_0x2218('0x46')]){_0x15e3fd[_0x2218('0x47')]=[{'all':!![]}];}return db[_0x2218('0x31')]['findAll'](_0x15e3fd);})[_0x2218('0x29')](function(_0x3e44e9){_0x7ffa54[_0x2218('0x48')]=_0x3e44e9;return _0x7ffa54;})[_0x2218('0x29')](respondWithFilteredResult(_0x2f3f1f,_0x15e3fd))['catch'](handleError(_0x2f3f1f,null));};exports[_0x2218('0x49')]=function(_0xdf22b2,_0x3c7bcd){var _0x34be4d={'raw':![],'where':{'id':_0xdf22b2[_0x2218('0x4a')]['id']}},_0xe60aa8={};_0xe60aa8[_0x2218('0x36')]=_['keys'](db[_0x2218('0x31')]['rawAttributes']);_0xe60aa8[_0x2218('0x37')]=_[_0x2218('0x38')](_0xdf22b2['query']);_0xe60aa8['filters']=_[_0x2218('0x3a')](_0xe60aa8[_0x2218('0x36')],_0xe60aa8[_0x2218('0x37')]);_0x34be4d['attributes']=_['intersection'](_0xe60aa8[_0x2218('0x36')],qs[_0x2218('0x3c')](_0xdf22b2[_0x2218('0x37')]['fields']));_0x34be4d[_0x2218('0x3b')]=_0x34be4d[_0x2218('0x3b')][_0x2218('0x3d')]?_0x34be4d[_0x2218('0x3b')]:_0xe60aa8[_0x2218('0x36')];if(_0xdf22b2[_0x2218('0x37')][_0x2218('0x46')]){_0x34be4d['include']=[{'all':!![]}];}_0x34be4d=_['merge']({},_0x34be4d,_0xdf22b2[_0x2218('0x45')]);return db[_0x2218('0x31')][_0x2218('0x4b')](_0x34be4d)[_0x2218('0x29')](handleEntityNotFound(_0x3c7bcd,null))[_0x2218('0x29')](respondWithResult(_0x3c7bcd,null))[_0x2218('0x4c')](handleError(_0x3c7bcd,null));};exports['create']=function(_0x3fbd76,_0x1a9b41){return db[_0x2218('0x31')]['create'](_0x3fbd76[_0x2218('0x4d')],{})[_0x2218('0x29')](function(_0x5db476){var _0x19d255=_0x3fbd76[_0x2218('0x4e')][_0x2218('0x2a')]({'plain':!![]});if(!_0x19d255)throw new Error(_0x2218('0x4f'));if(_0x19d255['role']==='user'){var _0x10b7fd=_0x5db476['get']({'plain':!![]});var _0x235a35=_0x2218('0x2b');return db['UserProfileSection'][_0x2218('0x4b')]({'where':{'name':_0x235a35,'userProfileId':_0x19d255['userProfileId']},'raw':!![]})['then'](function(_0x1e03a5){if(_0x1e03a5&&_0x1e03a5[_0x2218('0x50')]===0x0){return db[_0x2218('0x51')][_0x2218('0x52')]({'name':_0x10b7fd['name'],'resourceId':_0x10b7fd['id'],'type':_0x1e03a5[_0x2218('0x2d')],'sectionId':_0x1e03a5['id']},{})[_0x2218('0x29')](function(){return _0x5db476;});}else{return _0x5db476;}})['catch'](function(_0x110bf3){logger[_0x2218('0x53')](_0x2218('0x54'),_0x110bf3);throw _0x110bf3;});}return _0x5db476;})[_0x2218('0x29')](respondWithResult(_0x1a9b41,0xc9))['catch'](handleError(_0x1a9b41,null));};exports[_0x2218('0x28')]=function(_0x5d93e5,_0x3854c0){if(_0x5d93e5['body']['id']){delete _0x5d93e5[_0x2218('0x4d')]['id'];}return db[_0x2218('0x31')][_0x2218('0x4b')]({'where':{'id':_0x5d93e5['params']['id']}})[_0x2218('0x29')](handleEntityNotFound(_0x3854c0,null))['then'](saveUpdates(_0x5d93e5[_0x2218('0x4d')],null))['then'](respondWithResult(_0x3854c0,null))[_0x2218('0x4c')](handleError(_0x3854c0,null));};exports[_0x2218('0x2c')]=function(_0x248cee,_0x803f21){return db[_0x2218('0x31')][_0x2218('0x4b')]({'where':{'id':_0x248cee[_0x2218('0x4a')]['id']}})['then'](handleEntityNotFound(_0x803f21,null))[_0x2218('0x29')](removeEntity(_0x803f21,null))['catch'](handleError(_0x803f21,null));}; \ No newline at end of file +var _0xb821=['create','body','user','get','role','ChanSpies','find','catch','update','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','end','sendStatus','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','include','findAll','show','params','keys','includeAll','options'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb821,0xa7));var _0x1b82=function(_0x5353e4,_0x3fba02){_0x5353e4=_0x5353e4-0x0;var _0x5024b3=_0xb821[_0x5353e4];return _0x5024b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];function respondWithStatusCode(_0x241d11,_0x2391f5){_0x2391f5=_0x2391f5||0xcc;return function(_0x61b6eb){if(_0x61b6eb){return _0x241d11['sendStatus'](_0x2391f5);}return _0x241d11[_0x1b82('0x18')](_0x2391f5)['end']();};}function respondWithResult(_0x54915f,_0x1e553a){_0x1e553a=_0x1e553a||0xc8;return function(_0x4bf75b){if(_0x4bf75b){return _0x54915f[_0x1b82('0x18')](_0x1e553a)[_0x1b82('0x19')](_0x4bf75b);}};}function respondWithFilteredResult(_0x5d4cf1,_0x46c2cf){return function(_0x5dab7d){if(_0x5dab7d){var _0x563261=typeof _0x46c2cf[_0x1b82('0x1a')]==='undefined'&&typeof _0x46c2cf[_0x1b82('0x1b')]===_0x1b82('0x1c');var _0xf42818=_0x5dab7d['count'];var _0x514082=_0x563261?0x0:_0x46c2cf[_0x1b82('0x1a')];var _0x5d66c3=_0x563261?_0x5dab7d[_0x1b82('0x1d')]:_0x46c2cf[_0x1b82('0x1a')]+_0x46c2cf[_0x1b82('0x1b')];var _0x594a63;if(_0x5d66c3>=_0xf42818){_0x5d66c3=_0xf42818;_0x594a63=0xc8;}else{_0x594a63=0xce;}_0x5d4cf1[_0x1b82('0x18')](_0x594a63);return _0x5d4cf1[_0x1b82('0x1e')](_0x1b82('0x1f'),_0x514082+'-'+_0x5d66c3+'/'+_0xf42818)[_0x1b82('0x19')](_0x5dab7d);}return null;};}function patchUpdates(_0x10d45c){return function(_0x47e99b){try{jsonpatch[_0x1b82('0x20')](_0x47e99b,_0x10d45c,!![]);}catch(_0x1892b0){return BPromise[_0x1b82('0x21')](_0x1892b0);}return _0x47e99b[_0x1b82('0x22')]();};}function saveUpdates(_0x26e481,_0x31fd64){return function(_0x2d07f4){if(_0x2d07f4){return _0x2d07f4['update'](_0x26e481)[_0x1b82('0x23')](function(_0x233740){return _0x233740;});}return null;};}function removeEntity(_0x5b8d09,_0x561d78){return function(_0x225b81){if(_0x225b81){return _0x225b81[_0x1b82('0x24')]()['then'](function(){var _0x3a1226=_0x225b81['get']({'plain':!![]});var _0x5cd458='ChanSpies';return db[_0x1b82('0x25')][_0x1b82('0x24')]({'where':{'type':_0x5cd458,'resourceId':_0x3a1226['id']}})[_0x1b82('0x23')](function(){return _0x225b81;});})[_0x1b82('0x23')](function(){_0x5b8d09['status'](0xcc)[_0x1b82('0x26')]();});}};}function handleEntityNotFound(_0x165b45,_0x1b5260){return function(_0x7455e8){if(!_0x7455e8){_0x165b45[_0x1b82('0x27')](0x194);}return _0x7455e8;};}function handleError(_0x1b8b6f,_0x223b6a){_0x223b6a=_0x223b6a||0x1f4;return function(_0x21ea34){logger[_0x1b82('0x28')](_0x21ea34[_0x1b82('0x29')]);if(_0x21ea34[_0x1b82('0x2a')]){delete _0x21ea34[_0x1b82('0x2a')];}_0x1b8b6f[_0x1b82('0x18')](_0x223b6a)['send'](_0x21ea34);};}exports[_0x1b82('0x2b')]=function(_0x2931d0,_0x155a34){var _0x457dbb={},_0x18e4ff={},_0x115ce7={'count':0x0,'rows':[]};var _0xd3c4a=_[_0x1b82('0x2c')](db[_0x1b82('0x2d')][_0x1b82('0x2e')],function(_0x501ab0){return{'name':_0x501ab0[_0x1b82('0x2f')],'type':_0x501ab0[_0x1b82('0x30')][_0x1b82('0x31')]};});_0x18e4ff[_0x1b82('0x32')]=_['map'](_0xd3c4a,_0x1b82('0x2a'));_0x18e4ff[_0x1b82('0x33')]=_['keys'](_0x2931d0[_0x1b82('0x33')]);_0x18e4ff[_0x1b82('0x34')]=_[_0x1b82('0x35')](_0x18e4ff['model'],_0x18e4ff['query']);_0x457dbb[_0x1b82('0x36')]=_['intersection'](_0x18e4ff['model'],qs[_0x1b82('0x37')](_0x2931d0[_0x1b82('0x33')][_0x1b82('0x37')]));_0x457dbb['attributes']=_0x457dbb[_0x1b82('0x36')][_0x1b82('0x38')]?_0x457dbb[_0x1b82('0x36')]:_0x18e4ff[_0x1b82('0x32')];if(!_0x2931d0['query'][_0x1b82('0x39')](_0x1b82('0x3a'))){_0x457dbb[_0x1b82('0x1b')]=qs['limit'](_0x2931d0['query'][_0x1b82('0x1b')]);_0x457dbb['offset']=qs[_0x1b82('0x1a')](_0x2931d0[_0x1b82('0x33')][_0x1b82('0x1a')]);}_0x457dbb[_0x1b82('0x3b')]=qs[_0x1b82('0x3c')](_0x2931d0[_0x1b82('0x33')][_0x1b82('0x3c')]);_0x457dbb[_0x1b82('0x3d')]=qs['filters'](_['pick'](_0x2931d0[_0x1b82('0x33')],_0x18e4ff['filters']),_0xd3c4a);if(_0x2931d0[_0x1b82('0x33')]['filter']){_0x457dbb[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x457dbb[_0x1b82('0x3d')],{'$or':_[_0x1b82('0x2c')](_0xd3c4a,function(_0x2af0bd){if(_0x2af0bd[_0x1b82('0x30')]!=='VIRTUAL'){var _0x17d214={};_0x17d214[_0x2af0bd['name']]={'$like':'%'+_0x2931d0[_0x1b82('0x33')]['filter']+'%'};return _0x17d214;}})});}_0x457dbb=_[_0x1b82('0x3e')]({},_0x457dbb,_0x2931d0['options']);var _0x5aeac1={'where':_0x457dbb[_0x1b82('0x3d')]};return db[_0x1b82('0x2d')][_0x1b82('0x1d')](_0x5aeac1)[_0x1b82('0x23')](function(_0x3eb429){_0x115ce7['count']=_0x3eb429;if(_0x2931d0[_0x1b82('0x33')]['includeAll']){_0x457dbb[_0x1b82('0x3f')]=[{'all':!![]}];}return db[_0x1b82('0x2d')][_0x1b82('0x40')](_0x457dbb);})[_0x1b82('0x23')](function(_0x365ab4){_0x115ce7['rows']=_0x365ab4;return _0x115ce7;})[_0x1b82('0x23')](respondWithFilteredResult(_0x155a34,_0x457dbb))['catch'](handleError(_0x155a34,null));};exports[_0x1b82('0x41')]=function(_0x14b3ab,_0x5a50ba){var _0xa88eb2={'raw':![],'where':{'id':_0x14b3ab[_0x1b82('0x42')]['id']}},_0x225f6b={};_0x225f6b[_0x1b82('0x32')]=_[_0x1b82('0x43')](db[_0x1b82('0x2d')][_0x1b82('0x2e')]);_0x225f6b['query']=_[_0x1b82('0x43')](_0x14b3ab['query']);_0x225f6b[_0x1b82('0x34')]=_[_0x1b82('0x35')](_0x225f6b[_0x1b82('0x32')],_0x225f6b[_0x1b82('0x33')]);_0xa88eb2[_0x1b82('0x36')]=_[_0x1b82('0x35')](_0x225f6b[_0x1b82('0x32')],qs[_0x1b82('0x37')](_0x14b3ab[_0x1b82('0x33')][_0x1b82('0x37')]));_0xa88eb2[_0x1b82('0x36')]=_0xa88eb2[_0x1b82('0x36')][_0x1b82('0x38')]?_0xa88eb2[_0x1b82('0x36')]:_0x225f6b['model'];if(_0x14b3ab['query'][_0x1b82('0x44')]){_0xa88eb2['include']=[{'all':!![]}];}_0xa88eb2=_[_0x1b82('0x3e')]({},_0xa88eb2,_0x14b3ab[_0x1b82('0x45')]);return db[_0x1b82('0x2d')]['find'](_0xa88eb2)[_0x1b82('0x23')](handleEntityNotFound(_0x5a50ba,null))['then'](respondWithResult(_0x5a50ba,null))['catch'](handleError(_0x5a50ba,null));};exports[_0x1b82('0x46')]=function(_0x2aadf7,_0x242324){return db['VoiceChanSpy'][_0x1b82('0x46')](_0x2aadf7[_0x1b82('0x47')],{})['then'](function(_0x5ca898){var _0x106282=_0x2aadf7[_0x1b82('0x48')][_0x1b82('0x49')]({'plain':!![]});if(!_0x106282)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x106282[_0x1b82('0x4a')]===_0x1b82('0x48')){var _0x31fb5d=_0x5ca898[_0x1b82('0x49')]({'plain':!![]});var _0xbba448=_0x1b82('0x4b');return db['UserProfileSection'][_0x1b82('0x4c')]({'where':{'name':_0xbba448,'userProfileId':_0x106282['userProfileId']},'raw':!![]})[_0x1b82('0x23')](function(_0x247cb7){if(_0x247cb7&&_0x247cb7['autoAssociation']===0x0){return db[_0x1b82('0x25')]['create']({'name':_0x31fb5d[_0x1b82('0x2a')],'resourceId':_0x31fb5d['id'],'type':_0x247cb7[_0x1b82('0x2a')],'sectionId':_0x247cb7['id']},{})[_0x1b82('0x23')](function(){return _0x5ca898;});}else{return _0x5ca898;}})[_0x1b82('0x4d')](function(_0xd46842){logger[_0x1b82('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd46842);throw _0xd46842;});}return _0x5ca898;})['then'](respondWithResult(_0x242324,0xc9))[_0x1b82('0x4d')](handleError(_0x242324,null));};exports[_0x1b82('0x4e')]=function(_0x1b9e81,_0x26c1ec){if(_0x1b9e81[_0x1b82('0x47')]['id']){delete _0x1b9e81[_0x1b82('0x47')]['id'];}return db[_0x1b82('0x2d')][_0x1b82('0x4c')]({'where':{'id':_0x1b9e81['params']['id']}})['then'](handleEntityNotFound(_0x26c1ec,null))['then'](saveUpdates(_0x1b9e81[_0x1b82('0x47')],null))[_0x1b82('0x23')](respondWithResult(_0x26c1ec,null))[_0x1b82('0x4d')](handleError(_0x26c1ec,null));};exports[_0x1b82('0x24')]=function(_0x1eb4a4,_0x15b0d3){return db[_0x1b82('0x2d')]['find']({'where':{'id':_0x1eb4a4[_0x1b82('0x42')]['id']}})[_0x1b82('0x23')](handleEntityNotFound(_0x15b0d3,null))[_0x1b82('0x23')](removeEntity(_0x15b0d3,null))[_0x1b82('0x4d')](handleError(_0x15b0d3,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 07379e1..3268a79 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 _0x189a=['%s%s','prefix','system','Set','CDR(type)=%s','record','push','merge','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','User','then','catch','exports','voice_chanspy','length','VoiceExtension','destroy','bulkCreate','lodash','bluebird','./voiceChanSpy.attributes','from-sip','format'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0x189a,0x1b5));var _0xa189=function(_0x35a3a5,_0x51cd0d){_0x35a3a5=_0x35a3a5-0x0;var _0x117fae=_0x189a[_0x35a3a5];return _0x117fae;};'use strict';var _=require(_0xa189('0x0'));var util=require('util');var BPromise=require(_0xa189('0x1'));var attributes=require(_0xa189('0x2'));var getUserApplications=function(_0x251440,_0x14c0da,_0x56d1e4){var _0xe2dcef=0x1;var _0x136020=[];var _0x3908ba={'context':_0x14c0da['context']||_0xa189('0x3'),'exten':util[_0xa189('0x4')](_0xa189('0x5'),_0x251440[_0xa189('0x6')],_0x56d1e4),'type':_0xa189('0x7'),'isApp':![],'ChanSpyId':_0x251440['id'],'UserId':_0x14c0da['id']};_0x136020['push'](_['merge']({'app':_0xa189('0x8'),'appdata':util[_0xa189('0x4')](_0xa189('0x9'),'chanspy'),'priority':_0xe2dcef++},_0x3908ba));if(_0x251440[_0xa189('0xa')]){_0x136020[_0xa189('0xb')](_[_0xa189('0xc')]({'app':'MixMonitor','appdata':util[_0xa189('0x4')](_0xa189('0xd'),_0x251440[_0xa189('0xe')]),'priority':_0xe2dcef++},_0x3908ba));}if(_0x251440['auth']){_0x136020['push'](_[_0xa189('0xc')]({'app':_0xa189('0xf'),'appdata':_0x251440[_0xa189('0x10')],'priority':_0xe2dcef++},_0x3908ba));}_0x136020[_0xa189('0xb')](_[_0xa189('0xc')]({'app':_0xa189('0x11'),'appdata':util['format'](_0xa189('0x12'),_0x14c0da[_0xa189('0x13')],_0x251440[_0xa189('0x14')]?_0x251440[_0xa189('0x14')][_0xa189('0x15')](''):''),'priority':_0xe2dcef++},_0x3908ba));if(_0x251440[_0xa189('0xa')]){_0x136020['push'](_['merge']({'app':_0xa189('0x16'),'priority':_0xe2dcef++},_0x3908ba));}return _0x136020;};var getChanSpyApplications=function(_0x5ab2dc,_0x56e434){var _0x322868=[];for(var _0x130b8c=0x0,_0x2bcffa=0x1;_0x130b8c<_0x56e434['length'];_0x130b8c++,_0x2bcffa=0x1){_0x322868=_0x322868[_0xa189('0x17')](getUserApplications(_0x5ab2dc,_0x56e434[_0x130b8c],_0x56e434[_0x130b8c]['internal']));if(_0x56e434[_0x130b8c][_0xa189('0x18')]!=_0x56e434[_0x130b8c][_0xa189('0x13')]){_0x322868=_0x322868[_0xa189('0x17')](getUserApplications(_0x5ab2dc,_0x56e434[_0x130b8c],_0x56e434[_0x130b8c][_0xa189('0x13')]));}}return _0x322868;};var getChanSpyPromise=function(_0x2a42e1,_0x3ad14d){return new BPromise(function(_0x495979,_0x5191f6){return _0x2a42e1[_0xa189('0x19')]['findAll']({'attributes':['id',_0xa189('0x13'),_0xa189('0x18')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xa189('0x1a')](function(_0x582906){if(_0x582906){return _0x495979(getChanSpyApplications(_0x3ad14d,_0x582906));}return _0x495979([]);})[_0xa189('0x1b')](function(_0x563b72){_0x5191f6(_0x563b72);});});};module[_0xa189('0x1c')]=function(_0x53d95a,_0x393004){var _0x27d4d1=_0x53d95a['models'];return _0x53d95a['define']('VoiceChanSpy',attributes,{'tableName':_0xa189('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ac976,_0x7ae453,_0x4a6cb4){return getChanSpyPromise(_0x27d4d1,_0x4ac976)['then'](function(_0x1dae73){if(_0x1dae73&&_0x1dae73[_0xa189('0x1e')]){return _0x27d4d1['VoiceExtension']['bulkCreate'](_0x1dae73);}})[_0xa189('0x1a')](function(){_0x4a6cb4();})[_0xa189('0x1b')](function(_0x5e9416){_0x4a6cb4(_0x5e9416);});},'afterUpdate':function(_0x248e4b,_0x5742cd,_0xcf02cc){return _0x27d4d1[_0xa189('0x1f')][_0xa189('0x20')]({'where':{'ChanSpyId':_0x248e4b['id']}})[_0xa189('0x1a')](function(){return getChanSpyPromise(_0x27d4d1,_0x248e4b);})[_0xa189('0x1a')](function(_0x4d7c14){if(_0x4d7c14&&_0x4d7c14[_0xa189('0x1e')]){return _0x27d4d1['VoiceExtension'][_0xa189('0x21')](_0x4d7c14);}})[_0xa189('0x1a')](function(){_0xcf02cc();})[_0xa189('0x1b')](function(_0x34bb29){_0xcf02cc(_0x34bb29);});},'afterDestroy':function(_0x1bf4d0,_0x2f5259,_0x5bd2a6){return _0x27d4d1['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x1bf4d0['id']}})[_0xa189('0x1a')](function(){_0x5bd2a6();})[_0xa189('0x1b')](function(_0x12c14a){_0x5bd2a6(_0x12c14a);});}}});}; \ No newline at end of file +var _0x83ee=['VoiceExtension','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','push','Set','format','CDR(type)=%s','chanspy','merge','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','name','options','join','StopMixMonitor','length','concat','User','findAll','agent','catch','define','voice_chanspy','bulkCreate','then'];(function(_0x16aae9,_0x11031a){var _0x412d60=function(_0x78681){while(--_0x78681){_0x16aae9['push'](_0x16aae9['shift']());}};_0x412d60(++_0x11031a);}(_0x83ee,0xb6));var _0xe83e=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x83ee[_0xfcbcb8];return _0x1b1f97;};'use strict';var _=require('lodash');var util=require(_0xe83e('0x0'));var BPromise=require(_0xe83e('0x1'));var attributes=require(_0xe83e('0x2'));var getUserApplications=function(_0x1f83b0,_0xdb5b27,_0x2005e7){var _0x39d91a=0x1;var _0x451bb1=[];var _0x337d8e={'context':_0xdb5b27[_0xe83e('0x3')]||_0xe83e('0x4'),'exten':util['format'](_0xe83e('0x5'),_0x1f83b0[_0xe83e('0x6')],_0x2005e7),'type':_0xe83e('0x7'),'isApp':![],'ChanSpyId':_0x1f83b0['id'],'UserId':_0xdb5b27['id']};_0x451bb1[_0xe83e('0x8')](_['merge']({'app':_0xe83e('0x9'),'appdata':util[_0xe83e('0xa')](_0xe83e('0xb'),_0xe83e('0xc')),'priority':_0x39d91a++},_0x337d8e));if(_0x1f83b0['record']){_0x451bb1[_0xe83e('0x8')](_[_0xe83e('0xd')]({'app':'MixMonitor','appdata':util[_0xe83e('0xa')](_0xe83e('0xe'),_0x1f83b0[_0xe83e('0xf')]),'priority':_0x39d91a++},_0x337d8e));}if(_0x1f83b0[_0xe83e('0x10')]){_0x451bb1[_0xe83e('0x8')](_[_0xe83e('0xd')]({'app':_0xe83e('0x11'),'appdata':_0x1f83b0[_0xe83e('0x12')],'priority':_0x39d91a++},_0x337d8e));}_0x451bb1[_0xe83e('0x8')](_[_0xe83e('0xd')]({'app':_0xe83e('0x13'),'appdata':util[_0xe83e('0xa')]('SIP/%s,%s',_0xdb5b27[_0xe83e('0x14')],_0x1f83b0[_0xe83e('0x15')]?_0x1f83b0['options'][_0xe83e('0x16')](''):''),'priority':_0x39d91a++},_0x337d8e));if(_0x1f83b0['record']){_0x451bb1[_0xe83e('0x8')](_['merge']({'app':_0xe83e('0x17'),'priority':_0x39d91a++},_0x337d8e));}return _0x451bb1;};var getChanSpyApplications=function(_0x53814d,_0x374acf){var _0xa7899a=[];for(var _0x3561f6=0x0,_0x1b5cc0=0x1;_0x3561f6<_0x374acf[_0xe83e('0x18')];_0x3561f6++,_0x1b5cc0=0x1){_0xa7899a=_0xa7899a['concat'](getUserApplications(_0x53814d,_0x374acf[_0x3561f6],_0x374acf[_0x3561f6]['internal']));if(_0x374acf[_0x3561f6]['internal']!=_0x374acf[_0x3561f6]['name']){_0xa7899a=_0xa7899a[_0xe83e('0x19')](getUserApplications(_0x53814d,_0x374acf[_0x3561f6],_0x374acf[_0x3561f6]['name']));}}return _0xa7899a;};var getChanSpyPromise=function(_0x3a7cd3,_0x31c84f){return new BPromise(function(_0x389202,_0x3be8ae){return _0x3a7cd3[_0xe83e('0x1a')][_0xe83e('0x1b')]({'attributes':['id',_0xe83e('0x14'),'internal'],'where':{'role':_0xe83e('0x1c'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2b917a){if(_0x2b917a){return _0x389202(getChanSpyApplications(_0x31c84f,_0x2b917a));}return _0x389202([]);})[_0xe83e('0x1d')](function(_0x5b055b){_0x3be8ae(_0x5b055b);});});};module['exports']=function(_0x74a30a,_0x10c68c){var _0x14e8af=_0x74a30a['models'];return _0x74a30a[_0xe83e('0x1e')]('VoiceChanSpy',attributes,{'tableName':_0xe83e('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d3063,_0x11dfc8,_0x3baf63){return getChanSpyPromise(_0x14e8af,_0x3d3063)['then'](function(_0x340b1e){if(_0x340b1e&&_0x340b1e[_0xe83e('0x18')]){return _0x14e8af['VoiceExtension'][_0xe83e('0x20')](_0x340b1e);}})[_0xe83e('0x21')](function(){_0x3baf63();})[_0xe83e('0x1d')](function(_0x1ddefc){_0x3baf63(_0x1ddefc);});},'afterUpdate':function(_0x311a34,_0xb0d900,_0x5df910){return _0x14e8af[_0xe83e('0x22')][_0xe83e('0x23')]({'where':{'ChanSpyId':_0x311a34['id']}})[_0xe83e('0x21')](function(){return getChanSpyPromise(_0x14e8af,_0x311a34);})['then'](function(_0x2d4822){if(_0x2d4822&&_0x2d4822[_0xe83e('0x18')]){return _0x14e8af[_0xe83e('0x22')][_0xe83e('0x20')](_0x2d4822);}})[_0xe83e('0x21')](function(){_0x5df910();})[_0xe83e('0x1d')](function(_0x226dbf){_0x5df910(_0x226dbf);});},'afterDestroy':function(_0x10348d,_0x119001,_0x1d11ea){return _0x14e8af[_0xe83e('0x22')][_0xe83e('0x23')]({'where':{'ChanSpyId':_0x10348d['id']}})[_0xe83e('0x21')](function(){_0x1d11ea();})[_0xe83e('0x1d')](function(_0x5edf9f){_0x1d11ea(_0x5edf9f);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 19b9534..04fac4a 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 _0x1d2d=['lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3dd995,_0x3506f0){var _0x7314c0=function(_0xff440c){while(--_0xff440c){_0x3dd995['push'](_0x3dd995['shift']());}};_0x7314c0(++_0x3506f0);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x1b5907,_0x165f27){_0x1b5907=_0x1b5907-0x0;var _0x568673=_0x1d2d[_0x1b5907];return _0x568673;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var moment=require(_0xd1d2('0x2'));var BPromise=require(_0xd1d2('0x3'));var rs=require(_0xd1d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd1d2('0x6'));var config=require(_0xd1d2('0x7'));var jayson=require(_0xd1d2('0x8'));var client=jayson[_0xd1d2('0x9')][_0xd1d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x353dbd,_0x55be7a,_0x1eaf41){return new BPromise(function(_0x21bc28,_0x35735f){return client[_0xd1d2('0xb')](_0x353dbd,_0x1eaf41)[_0xd1d2('0xc')](function(_0x59e484){logger[_0xd1d2('0xd')](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));logger[_0xd1d2('0x10')](_0xd1d2('0x11'),_0x55be7a,_0xd1d2('0xf'),JSON[_0xd1d2('0x12')](_0x59e484));if(_0x59e484['error']){if(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x14')]===0x1f4){logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);return _0x35735f(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484['error'][_0xd1d2('0x15')]);return _0x21bc28(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}else{logger['info'](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));_0x21bc28(_0x59e484[_0xd1d2('0x16')][_0xd1d2('0x15')]);}})[_0xd1d2('0x17')](function(_0x2723b3){logger[_0xd1d2('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x55be7a,_0x2723b3);_0x35735f(_0x2723b3);});});} \ No newline at end of file +var _0x4ded=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0x4ded,0x116));var _0xd4de=function(_0x2823a4,_0x390cb9){_0x2823a4=_0x2823a4-0x0;var _0x15e91f=_0x4ded[_0x2823a4];return _0x15e91f;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var moment=require(_0xd4de('0x2'));var BPromise=require(_0xd4de('0x3'));var rs=require(_0xd4de('0x4'));var fs=require('fs');var Redis=require(_0xd4de('0x5'));var db=require(_0xd4de('0x6'))['db'];var utils=require(_0xd4de('0x7'));var logger=require(_0xd4de('0x8'))(_0xd4de('0x9'));var config=require(_0xd4de('0xa'));var jayson=require(_0xd4de('0xb'));var client=jayson['client'][_0xd4de('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2433b8,_0x15eb91,_0x2c56d5){return new BPromise(function(_0x4453c2,_0x1e8c35){return client['request'](_0x2433b8,_0x2c56d5)[_0xd4de('0xd')](function(_0x5ebcf3){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x15eb91,_0xd4de('0xe'));logger[_0xd4de('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x15eb91,'request\x20sent',JSON['stringify'](_0x5ebcf3));if(_0x5ebcf3[_0xd4de('0x10')]){if(_0x5ebcf3['error'][_0xd4de('0x11')]===0x1f4){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x1e8c35(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x4453c2(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}else{logger[_0xd4de('0x14')](_0xd4de('0x12'),_0x15eb91,_0xd4de('0xe'));_0x4453c2(_0x5ebcf3[_0xd4de('0x15')]['message']);}})['catch'](function(_0x3df820){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x3df820);_0x1e8c35(_0x3df820);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 8ff1d93..a2522e5 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 _0x149d=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','post','create','/:id','multer','util'];(function(_0x299ec8,_0x5482c7){var _0x1f291e=function(_0x38cccd){while(--_0x38cccd){_0x299ec8['push'](_0x299ec8['shift']());}};_0x1f291e(++_0x5482c7);}(_0x149d,0x85));var _0xd149=function(_0x7435ec,_0x1ae030){_0x7435ec=_0x7435ec-0x0;var _0x260d5e=_0x149d[_0x7435ec];return _0x260d5e;};'use strict';var multer=require(_0xd149('0x0'));var util=require(_0xd149('0x1'));var path=require(_0xd149('0x2'));var timeout=require('connect-timeout');var express=require(_0xd149('0x3'));var router=express[_0xd149('0x4')]();var fs_extra=require(_0xd149('0x5'));var auth=require(_0xd149('0x6'));var interaction=require(_0xd149('0x7'));var config=require(_0xd149('0x8'));var controller=require('./voiceContext.controller');router[_0xd149('0x9')]('/',auth['isAuthenticated'](),controller[_0xd149('0xa')]);router[_0xd149('0x9')]('/:id',auth[_0xd149('0xb')](),controller['show']);router[_0xd149('0xc')]('/',auth['isAuthenticated'](),controller[_0xd149('0xd')]);router['put'](_0xd149('0xe'),auth[_0xd149('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2442=['index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x2442,0x15f));var _0x2244=function(_0x2da1f9,_0x5e4269){_0x2da1f9=_0x2da1f9-0x0;var _0x22ef92=_0x2442[_0x2da1f9];return _0x22ef92;};'use strict';var multer=require(_0x2244('0x0'));var util=require(_0x2244('0x1'));var path=require(_0x2244('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2244('0x3')]();var fs_extra=require(_0x2244('0x4'));var auth=require(_0x2244('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2244('0x6'));var controller=require(_0x2244('0x7'));router[_0x2244('0x8')]('/',auth[_0x2244('0x9')](),controller[_0x2244('0xa')]);router[_0x2244('0x8')](_0x2244('0xb'),auth[_0x2244('0x9')](),controller[_0x2244('0xc')]);router['post']('/',auth[_0x2244('0x9')](),controller[_0x2244('0xd')]);router[_0x2244('0xe')](_0x2244('0xb'),auth[_0x2244('0x9')](),controller[_0x2244('0xf')]);router[_0x2244('0x10')](_0x2244('0xb'),auth[_0x2244('0x9')](),controller[_0x2244('0x11')]);module[_0x2244('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 27157fc..4360b33 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 _0xdf4b=['sequelize','exports','STRING','BOOLEAN'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0xdf4b,0x84));var _0xbdf4=function(_0x58a534,_0x8d58a9){_0x58a534=_0x58a534-0x0;var _0x23464e=_0xdf4b[_0x58a534];return _0x23464e;};'use strict';var Sequelize=require(_0xbdf4('0x0'));module[_0xbdf4('0x1')]={'name':{'type':Sequelize[_0xbdf4('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xbdf4('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbdf4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc632=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x45fd89,_0x388a7d){var _0x16787f=function(_0x3f515f){while(--_0x3f515f){_0x45fd89['push'](_0x45fd89['shift']());}};_0x16787f(++_0x388a7d);}(_0xc632,0xf0));var _0x2c63=function(_0x2cfb20,_0x53cb5){_0x2cfb20=_0x2cfb20-0x0;var _0x2c7af9=_0xc632[_0x2cfb20];return _0x2c7af9;};'use strict';var Sequelize=require(_0x2c63('0x0'));module[_0x2c63('0x1')]={'name':{'type':Sequelize[_0x2c63('0x2')],'unique':_0x2c63('0x3')},'description':{'type':Sequelize[_0x2c63('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x2c63('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 51f207a..ff00ae6 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 _0x5403=['sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','get','Contexts','UserProfileResource','end','stack','name','VoiceContext','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','find','create','body','readFileSync','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','join','writeFileSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','client','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5403,0xa4));var _0x3540=function(_0x5a0253,_0x32b2b6){_0x5a0253=_0x5a0253-0x0;var _0x3e07c9=_0x5403[_0x5a0253];return _0x3e07c9;};'use strict';var emlformat=require(_0x3540('0x0'));var rimraf=require(_0x3540('0x1'));var zipdir=require(_0x3540('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3540('0x3'));var moment=require(_0x3540('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3540('0x5'));var util=require(_0x3540('0x6'));var path=require(_0x3540('0x7'));var sox=require('sox');var csv=require(_0x3540('0x8'));var ejs=require(_0x3540('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3540('0xa'));var squel=require('squel');var crypto=require(_0x3540('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3540('0xc'));var toCsv=require(_0x3540('0x8'));var querystring=require(_0x3540('0xd'));var Papa=require(_0x3540('0xe'));var Redis=require(_0x3540('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3540('0x10'));var as=require(_0x3540('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3540('0x12'))(_0x3540('0x13'));var utils=require(_0x3540('0x14'));var config=require(_0x3540('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x3540('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e8394,_0x58be53,_0x3a3808,_0x29ed33){return new BPromise(function(_0x3a1e46,_0x478574){var _0x39bea1=_0x29ed33||client;return _0x39bea1[_0x3540('0x17')](_0x1e8394,_0x3a3808)[_0x3540('0x18')](function(_0x2dcb2a){logger['info'](_0x3540('0x19'),_0x58be53,_0x3540('0x1a'));logger['debug'](_0x3540('0x1b'),_0x58be53,_0x3540('0x1a'),JSON[_0x3540('0x1c')](_0x2dcb2a));if(_0x2dcb2a[_0x3540('0x1d')]){if(_0x2dcb2a['error'][_0x3540('0x1e')]===0x1f4){logger[_0x3540('0x1d')](_0x3540('0x19'),_0x58be53,_0x2dcb2a['error'][_0x3540('0x1f')]);return _0x478574(_0x2dcb2a[_0x3540('0x1d')][_0x3540('0x1f')]);}logger[_0x3540('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x58be53,_0x2dcb2a[_0x3540('0x1d')][_0x3540('0x1f')]);return _0x3a1e46(_0x2dcb2a[_0x3540('0x1d')][_0x3540('0x1f')]);}else{logger[_0x3540('0x20')]('VoiceContext,\x20%s,\x20%s',_0x58be53,'request\x20sent');_0x3a1e46(_0x2dcb2a['result']['message']);}})[_0x3540('0x21')](function(_0x1ffb43){logger[_0x3540('0x1d')](_0x3540('0x19'),_0x58be53,_0x1ffb43);_0x478574(_0x1ffb43);});});}function respondWithStatusCode(_0x1378f5,_0x326d06){_0x326d06=_0x326d06||0xcc;return function(_0x50b34b){if(_0x50b34b){return _0x1378f5[_0x3540('0x22')](_0x326d06);}return _0x1378f5[_0x3540('0x23')](_0x326d06)['end']();};}function respondWithResult(_0x11faf8,_0xcb69fe){_0xcb69fe=_0xcb69fe||0xc8;return function(_0x302efa){if(_0x302efa){return _0x11faf8['status'](_0xcb69fe)['json'](_0x302efa);}};}function respondWithFilteredResult(_0x591af5,_0x2860d4){return function(_0x410659){if(_0x410659){var _0x32f3c5=typeof _0x2860d4['offset']===_0x3540('0x24')&&typeof _0x2860d4['limit']==='undefined';var _0x18d424=_0x410659[_0x3540('0x25')];var _0x1d091b=_0x32f3c5?0x0:_0x2860d4[_0x3540('0x26')];var _0x3b5832=_0x32f3c5?_0x410659['count']:_0x2860d4[_0x3540('0x26')]+_0x2860d4[_0x3540('0x27')];var _0x4e67aa;if(_0x3b5832>=_0x18d424){_0x3b5832=_0x18d424;_0x4e67aa=0xc8;}else{_0x4e67aa=0xce;}_0x591af5[_0x3540('0x23')](_0x4e67aa);return _0x591af5[_0x3540('0x28')](_0x3540('0x29'),_0x1d091b+'-'+_0x3b5832+'/'+_0x18d424)[_0x3540('0x2a')](_0x410659);}return null;};}function patchUpdates(_0x6705cb){return function(_0x58680c){try{jsonpatch[_0x3540('0x2b')](_0x58680c,_0x6705cb,!![]);}catch(_0x535b19){return BPromise[_0x3540('0x2c')](_0x535b19);}return _0x58680c[_0x3540('0x2d')]();};}function saveUpdates(_0x26bfa4,_0x574eb0){return function(_0x385b1e){if(_0x385b1e){return _0x385b1e['update'](_0x26bfa4)['then'](function(_0x4b178e){return _0x4b178e;});}return null;};}function removeEntity(_0x188d68,_0x1902d5){return function(_0x333e00){if(_0x333e00){return _0x333e00[_0x3540('0x2e')]()[_0x3540('0x18')](function(){var _0x21ec20=_0x333e00[_0x3540('0x2f')]({'plain':!![]});var _0x45f1db=_0x3540('0x30');return db[_0x3540('0x31')][_0x3540('0x2e')]({'where':{'type':_0x45f1db,'resourceId':_0x21ec20['id']}})[_0x3540('0x18')](function(){return _0x333e00;});})[_0x3540('0x18')](function(){_0x188d68['status'](0xcc)[_0x3540('0x32')]();});}};}function handleEntityNotFound(_0x5af436,_0x4c45a5){return function(_0x9c3733){if(!_0x9c3733){_0x5af436[_0x3540('0x22')](0x194);}return _0x9c3733;};}function handleError(_0x18e49c,_0x2c7c02){_0x2c7c02=_0x2c7c02||0x1f4;return function(_0x3f4ac0){logger['error'](_0x3f4ac0[_0x3540('0x33')]);if(_0x3f4ac0[_0x3540('0x34')]){delete _0x3f4ac0[_0x3540('0x34')];}_0x18e49c[_0x3540('0x23')](_0x2c7c02)['send'](_0x3f4ac0);};}exports['index']=function(_0x580356,_0x53f639){var _0x43fd66={},_0x4f13d8={},_0x201180={'count':0x0,'rows':[]};var _0x383163=_['map'](db[_0x3540('0x35')]['rawAttributes'],function(_0x45788f){return{'name':_0x45788f[_0x3540('0x36')],'type':_0x45788f[_0x3540('0x37')]['key']};});_0x4f13d8[_0x3540('0x38')]=_[_0x3540('0x39')](_0x383163,_0x3540('0x34'));_0x4f13d8['query']=_[_0x3540('0x3a')](_0x580356[_0x3540('0x3b')]);_0x4f13d8[_0x3540('0x3c')]=_[_0x3540('0x3d')](_0x4f13d8[_0x3540('0x38')],_0x4f13d8[_0x3540('0x3b')]);_0x43fd66[_0x3540('0x3e')]=_[_0x3540('0x3d')](_0x4f13d8[_0x3540('0x38')],qs[_0x3540('0x3f')](_0x580356[_0x3540('0x3b')][_0x3540('0x3f')]));_0x43fd66[_0x3540('0x3e')]=_0x43fd66[_0x3540('0x3e')][_0x3540('0x40')]?_0x43fd66[_0x3540('0x3e')]:_0x4f13d8[_0x3540('0x38')];if(!_0x580356[_0x3540('0x3b')][_0x3540('0x41')](_0x3540('0x42'))){_0x43fd66['limit']=qs[_0x3540('0x27')](_0x580356[_0x3540('0x3b')][_0x3540('0x27')]);_0x43fd66[_0x3540('0x26')]=qs[_0x3540('0x26')](_0x580356['query'][_0x3540('0x26')]);}_0x43fd66['order']=qs[_0x3540('0x43')](_0x580356[_0x3540('0x3b')][_0x3540('0x43')]);_0x43fd66[_0x3540('0x44')]=qs['filters'](_[_0x3540('0x45')](_0x580356['query'],_0x4f13d8['filters']),_0x383163);if(_0x580356[_0x3540('0x3b')][_0x3540('0x46')]){_0x43fd66[_0x3540('0x44')]=_[_0x3540('0x47')](_0x43fd66[_0x3540('0x44')],{'$or':_[_0x3540('0x39')](_0x383163,function(_0x431f1c){if(_0x431f1c['type']!==_0x3540('0x48')){var _0x4d9692={};_0x4d9692[_0x431f1c[_0x3540('0x34')]]={'$like':'%'+_0x580356['query']['filter']+'%'};return _0x4d9692;}})});}_0x43fd66=_[_0x3540('0x47')]({},_0x43fd66,_0x580356[_0x3540('0x49')]);var _0x1b43ab={'where':_0x43fd66[_0x3540('0x44')]};return db[_0x3540('0x35')][_0x3540('0x25')](_0x1b43ab)[_0x3540('0x18')](function(_0x466a45){_0x201180[_0x3540('0x25')]=_0x466a45;if(_0x580356['query'][_0x3540('0x4a')]){_0x43fd66['include']=[{'all':!![]}];}return db[_0x3540('0x35')][_0x3540('0x4b')](_0x43fd66);})[_0x3540('0x18')](function(_0x4786f8){_0x201180[_0x3540('0x4c')]=_0x4786f8;return _0x201180;})['then'](respondWithFilteredResult(_0x53f639,_0x43fd66))[_0x3540('0x21')](handleError(_0x53f639,null));};exports[_0x3540('0x4d')]=function(_0x123b7e,_0x3a4cf9){var _0x2f00d9={'raw':![],'where':{'id':_0x123b7e[_0x3540('0x4e')]['id']}},_0x1101c9={};_0x1101c9[_0x3540('0x38')]=_[_0x3540('0x3a')](db['VoiceContext'][_0x3540('0x4f')]);_0x1101c9[_0x3540('0x3b')]=_['keys'](_0x123b7e[_0x3540('0x3b')]);_0x1101c9['filters']=_['intersection'](_0x1101c9[_0x3540('0x38')],_0x1101c9['query']);_0x2f00d9['attributes']=_[_0x3540('0x3d')](_0x1101c9[_0x3540('0x38')],qs[_0x3540('0x3f')](_0x123b7e[_0x3540('0x3b')][_0x3540('0x3f')]));_0x2f00d9[_0x3540('0x3e')]=_0x2f00d9[_0x3540('0x3e')][_0x3540('0x40')]?_0x2f00d9[_0x3540('0x3e')]:_0x1101c9['model'];if(_0x123b7e[_0x3540('0x3b')][_0x3540('0x4a')]){_0x2f00d9['include']=[{'all':!![]}];}_0x2f00d9=_['merge']({},_0x2f00d9,_0x123b7e[_0x3540('0x49')]);return db[_0x3540('0x35')][_0x3540('0x50')](_0x2f00d9)[_0x3540('0x18')](handleEntityNotFound(_0x3a4cf9,null))[_0x3540('0x18')](respondWithResult(_0x3a4cf9,null))['catch'](handleError(_0x3a4cf9,null));};exports[_0x3540('0x51')]=function(_0x4ae6ee,_0x1b60c7,_0x133517){var _0x465908;return db['VoiceContext'][_0x3540('0x51')](_0x4ae6ee[_0x3540('0x52')],{'raw':!![]})[_0x3540('0x18')](function(_0x18d0fc){_0x465908=_0x18d0fc;return db[_0x3540('0x35')][_0x3540('0x4b')]({'raw':!![]});})['then'](function(_0x209697){var _0x501480=fs[_0x3540('0x53')](path['join'](config[_0x3540('0x54')],_0x3540('0x55')),_0x3540('0x56'));var _0x3953c6=ejs[_0x3540('0x57')](_0x501480,{'contexts':_0x209697||[]});fs['writeFileSync'](_0x3540('0x58'),_0x3953c6);})['then'](function(){return respondWithRpcPromise(_0x3540('0x59'),_0x3540('0x51'),{'module':_0x3540('0x5a')});})['then'](function(){var _0x3ac810=_0x4ae6ee[_0x3540('0x5b')][_0x3540('0x2f')]({'plain':!![]});if(!_0x3ac810)throw new Error(_0x3540('0x5c'));if(_0x3ac810[_0x3540('0x5d')]===_0x3540('0x5b')){var _0x3d82c9=_0x465908[_0x3540('0x2f')]({'plain':!![]});return db['UserProfileSection'][_0x3540('0x50')]({'where':{'name':'Contexts','userProfileId':_0x3ac810['userProfileId']},'raw':!![]})[_0x3540('0x18')](function(_0x170358){if(_0x170358&&_0x170358[_0x3540('0x5e')]===0x0){return db[_0x3540('0x31')][_0x3540('0x51')]({'name':_0x3d82c9[_0x3540('0x34')],'resourceId':_0x3d82c9['id'],'type':_0x170358['name'],'sectionId':_0x170358['id']},{})['then'](function(){return _0x465908;});}else{return _0x465908;}})[_0x3540('0x21')](function(_0x22298d){logger[_0x3540('0x1d')](_0x3540('0x5f'),_0x22298d);throw _0x22298d;});}return _0x465908;})[_0x3540('0x18')](respondWithResult(_0x1b60c7,0xc9))[_0x3540('0x21')](handleError(_0x1b60c7,null));};exports[_0x3540('0x60')]=function(_0x1acea4,_0x5d1afb,_0x143cc4){var _0x459b3d;return db[_0x3540('0x35')]['find']({'where':{'id':_0x1acea4[_0x3540('0x4e')]['id']}})[_0x3540('0x18')](handleEntityNotFound(_0x5d1afb,null))[_0x3540('0x18')](saveUpdates(_0x1acea4[_0x3540('0x52')],null))[_0x3540('0x18')](function(_0x52d609){if(_0x52d609){_0x459b3d=_0x52d609;return db[_0x3540('0x35')][_0x3540('0x4b')]({'raw':!![]});}})[_0x3540('0x18')](function(_0x4b7ded){var _0x298394=fs[_0x3540('0x53')](path[_0x3540('0x61')](config[_0x3540('0x54')],_0x3540('0x55')),_0x3540('0x56'));var _0x546513=ejs[_0x3540('0x57')](_0x298394,{'contexts':_0x4b7ded||[]});fs[_0x3540('0x62')](_0x3540('0x58'),_0x546513);})['then'](function(){return respondWithRpcPromise(_0x3540('0x59'),'update',{'module':_0x3540('0x5a')});})[_0x3540('0x18')](function(){return _0x459b3d;})['then'](respondWithResult(_0x5d1afb,null))['catch'](handleError(_0x5d1afb,null));};exports['destroy']=function(_0x1480f3,_0x49b714,_0x2d3ef5){var _0x966ace;return db[_0x3540('0x35')][_0x3540('0x50')]({'where':{'id':_0x1480f3[_0x3540('0x4e')]['id']}})[_0x3540('0x18')](handleEntityNotFound(_0x49b714,null))[_0x3540('0x18')](removeEntity(_0x49b714,null))['then'](function(){return db[_0x3540('0x35')][_0x3540('0x4b')]({'raw':!![]});})[_0x3540('0x18')](function(_0x199fc9){var _0x253419=fs[_0x3540('0x53')](path[_0x3540('0x61')](config[_0x3540('0x54')],_0x3540('0x55')),'utf8');var _0x115b05=ejs['render'](_0x253419,{'contexts':_0x199fc9});fs[_0x3540('0x62')](_0x3540('0x58'),_0x115b05);return respondWithRpcPromise(_0x3540('0x59'),_0x3540('0x2e'),{'module':_0x3540('0x5a')});})[_0x3540('0x21')](handleError(_0x49b714,null));}; \ No newline at end of file +var _0x488a=['bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','VoiceContext','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3e81d9,_0x488e01){var _0x311823=function(_0x3785fd){while(--_0x3785fd){_0x3e81d9['push'](_0x3e81d9['shift']());}};_0x311823(++_0x488e01);}(_0x488a,0x64));var _0xa488=function(_0x18e640,_0x554827){_0x18e640=_0x18e640-0x0;var _0x3a8e5f=_0x488a[_0x18e640];return _0x3a8e5f;};'use strict';var emlformat=require(_0xa488('0x0'));var rimraf=require(_0xa488('0x1'));var zipdir=require(_0xa488('0x2'));var jsonpatch=require(_0xa488('0x3'));var rp=require(_0xa488('0x4'));var moment=require(_0xa488('0x5'));var BPromise=require(_0xa488('0x6'));var Mustache=require('mustache');var util=require(_0xa488('0x7'));var path=require(_0xa488('0x8'));var sox=require(_0xa488('0x9'));var csv=require(_0xa488('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa488('0xb'));var _=require('lodash');var squel=require(_0xa488('0xc'));var crypto=require(_0xa488('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa488('0xe'));var toCsv=require(_0xa488('0xa'));var querystring=require(_0xa488('0xf'));var Papa=require(_0xa488('0x10'));var Redis=require(_0xa488('0x11'));var authService=require(_0xa488('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa488('0x13'));var logger=require(_0xa488('0x14'))(_0xa488('0x15'));var utils=require(_0xa488('0x16'));var config=require(_0xa488('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa488('0x18'))['db'];var jayson=require(_0xa488('0x19'));var client=jayson[_0xa488('0x1a')][_0xa488('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5867a7,_0xe82e97,_0xac260a,_0x4b976b){return new BPromise(function(_0x469aba,_0x5f9b96){var _0x4dea76=_0x4b976b||client;return _0x4dea76[_0xa488('0x1c')](_0x5867a7,_0xac260a)[_0xa488('0x1d')](function(_0x3c5d35){logger['info'](_0xa488('0x1e'),_0xe82e97,_0xa488('0x1f'));logger[_0xa488('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0xe82e97,'request\x20sent',JSON['stringify'](_0x3c5d35));if(_0x3c5d35[_0xa488('0x21')]){if(_0x3c5d35['error']['code']===0x1f4){logger['error'](_0xa488('0x1e'),_0xe82e97,_0x3c5d35['error'][_0xa488('0x22')]);return _0x5f9b96(_0x3c5d35[_0xa488('0x21')][_0xa488('0x22')]);}logger[_0xa488('0x21')](_0xa488('0x1e'),_0xe82e97,_0x3c5d35[_0xa488('0x21')][_0xa488('0x22')]);return _0x469aba(_0x3c5d35[_0xa488('0x21')]['message']);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0xe82e97,_0xa488('0x1f'));_0x469aba(_0x3c5d35[_0xa488('0x23')][_0xa488('0x22')]);}})[_0xa488('0x24')](function(_0x1024d2){logger[_0xa488('0x21')]('VoiceContext,\x20%s,\x20%s',_0xe82e97,_0x1024d2);_0x5f9b96(_0x1024d2);});});}function respondWithStatusCode(_0x9c1019,_0xc9e248){_0xc9e248=_0xc9e248||0xcc;return function(_0x572091){if(_0x572091){return _0x9c1019[_0xa488('0x25')](_0xc9e248);}return _0x9c1019['status'](_0xc9e248)[_0xa488('0x26')]();};}function respondWithResult(_0x475d83,_0x11d9d0){_0x11d9d0=_0x11d9d0||0xc8;return function(_0x102e43){if(_0x102e43){return _0x475d83[_0xa488('0x27')](_0x11d9d0)[_0xa488('0x28')](_0x102e43);}};}function respondWithFilteredResult(_0xb6c6ea,_0x4e2e93){return function(_0x49a3b4){if(_0x49a3b4){var _0xd7ec75=typeof _0x4e2e93[_0xa488('0x29')]===_0xa488('0x2a')&&typeof _0x4e2e93[_0xa488('0x2b')]==='undefined';var _0x27aee7=_0x49a3b4[_0xa488('0x2c')];var _0x2791b8=_0xd7ec75?0x0:_0x4e2e93['offset'];var _0x8a356a=_0xd7ec75?_0x49a3b4[_0xa488('0x2c')]:_0x4e2e93[_0xa488('0x29')]+_0x4e2e93['limit'];var _0x3b086b;if(_0x8a356a>=_0x27aee7){_0x8a356a=_0x27aee7;_0x3b086b=0xc8;}else{_0x3b086b=0xce;}_0xb6c6ea[_0xa488('0x27')](_0x3b086b);return _0xb6c6ea[_0xa488('0x2d')](_0xa488('0x2e'),_0x2791b8+'-'+_0x8a356a+'/'+_0x27aee7)[_0xa488('0x28')](_0x49a3b4);}return null;};}function patchUpdates(_0x749f29){return function(_0x55548f){try{jsonpatch[_0xa488('0x2f')](_0x55548f,_0x749f29,!![]);}catch(_0x5c664f){return BPromise[_0xa488('0x30')](_0x5c664f);}return _0x55548f[_0xa488('0x31')]();};}function saveUpdates(_0x39b384,_0x2cfcb6){return function(_0x58a588){if(_0x58a588){return _0x58a588[_0xa488('0x32')](_0x39b384)['then'](function(_0x3d6641){return _0x3d6641;});}return null;};}function removeEntity(_0x42b5e0,_0x42995a){return function(_0x1701d2){if(_0x1701d2){return _0x1701d2[_0xa488('0x33')]()[_0xa488('0x1d')](function(){var _0x3c90e9=_0x1701d2[_0xa488('0x34')]({'plain':!![]});var _0x72b4f9=_0xa488('0x35');return db[_0xa488('0x36')][_0xa488('0x33')]({'where':{'type':_0x72b4f9,'resourceId':_0x3c90e9['id']}})[_0xa488('0x1d')](function(){return _0x1701d2;});})[_0xa488('0x1d')](function(){_0x42b5e0[_0xa488('0x27')](0xcc)[_0xa488('0x26')]();});}};}function handleEntityNotFound(_0x46a84e,_0x13f598){return function(_0x17f56f){if(!_0x17f56f){_0x46a84e[_0xa488('0x25')](0x194);}return _0x17f56f;};}function handleError(_0x8fd889,_0x2a2360){_0x2a2360=_0x2a2360||0x1f4;return function(_0x12daea){logger['error'](_0x12daea[_0xa488('0x37')]);if(_0x12daea[_0xa488('0x38')]){delete _0x12daea[_0xa488('0x38')];}_0x8fd889[_0xa488('0x27')](_0x2a2360)[_0xa488('0x39')](_0x12daea);};}exports[_0xa488('0x3a')]=function(_0x415758,_0x2d2bd5){var _0x556e79={},_0x1286db={},_0x2385f0={'count':0x0,'rows':[]};var _0x4cf120=_['map'](db[_0xa488('0x3b')][_0xa488('0x3c')],function(_0x4ea484){return{'name':_0x4ea484['fieldName'],'type':_0x4ea484[_0xa488('0x3d')]['key']};});_0x1286db[_0xa488('0x3e')]=_[_0xa488('0x3f')](_0x4cf120,_0xa488('0x38'));_0x1286db[_0xa488('0x40')]=_[_0xa488('0x41')](_0x415758['query']);_0x1286db[_0xa488('0x42')]=_[_0xa488('0x43')](_0x1286db[_0xa488('0x3e')],_0x1286db['query']);_0x556e79[_0xa488('0x44')]=_[_0xa488('0x43')](_0x1286db[_0xa488('0x3e')],qs[_0xa488('0x45')](_0x415758[_0xa488('0x40')]['fields']));_0x556e79[_0xa488('0x44')]=_0x556e79[_0xa488('0x44')][_0xa488('0x46')]?_0x556e79['attributes']:_0x1286db[_0xa488('0x3e')];if(!_0x415758[_0xa488('0x40')][_0xa488('0x47')](_0xa488('0x48'))){_0x556e79[_0xa488('0x2b')]=qs['limit'](_0x415758[_0xa488('0x40')][_0xa488('0x2b')]);_0x556e79[_0xa488('0x29')]=qs[_0xa488('0x29')](_0x415758[_0xa488('0x40')]['offset']);}_0x556e79[_0xa488('0x49')]=qs[_0xa488('0x4a')](_0x415758[_0xa488('0x40')][_0xa488('0x4a')]);_0x556e79[_0xa488('0x4b')]=qs[_0xa488('0x42')](_[_0xa488('0x4c')](_0x415758[_0xa488('0x40')],_0x1286db['filters']),_0x4cf120);if(_0x415758['query']['filter']){_0x556e79['where']=_[_0xa488('0x4d')](_0x556e79[_0xa488('0x4b')],{'$or':_[_0xa488('0x3f')](_0x4cf120,function(_0x3c8517){if(_0x3c8517[_0xa488('0x3d')]!==_0xa488('0x4e')){var _0x14490e={};_0x14490e[_0x3c8517[_0xa488('0x38')]]={'$like':'%'+_0x415758[_0xa488('0x40')]['filter']+'%'};return _0x14490e;}})});}_0x556e79=_[_0xa488('0x4d')]({},_0x556e79,_0x415758['options']);var _0x4afeca={'where':_0x556e79[_0xa488('0x4b')]};return db[_0xa488('0x3b')][_0xa488('0x2c')](_0x4afeca)[_0xa488('0x1d')](function(_0x733511){_0x2385f0[_0xa488('0x2c')]=_0x733511;if(_0x415758[_0xa488('0x40')][_0xa488('0x4f')]){_0x556e79[_0xa488('0x50')]=[{'all':!![]}];}return db[_0xa488('0x3b')][_0xa488('0x51')](_0x556e79);})['then'](function(_0x2df18c){_0x2385f0[_0xa488('0x52')]=_0x2df18c;return _0x2385f0;})['then'](respondWithFilteredResult(_0x2d2bd5,_0x556e79))[_0xa488('0x24')](handleError(_0x2d2bd5,null));};exports[_0xa488('0x53')]=function(_0x4c0e28,_0x4f40db){var _0x4b67c8={'raw':![],'where':{'id':_0x4c0e28[_0xa488('0x54')]['id']}},_0x4bb3fb={};_0x4bb3fb[_0xa488('0x3e')]=_[_0xa488('0x41')](db[_0xa488('0x3b')]['rawAttributes']);_0x4bb3fb['query']=_[_0xa488('0x41')](_0x4c0e28[_0xa488('0x40')]);_0x4bb3fb[_0xa488('0x42')]=_['intersection'](_0x4bb3fb[_0xa488('0x3e')],_0x4bb3fb['query']);_0x4b67c8['attributes']=_[_0xa488('0x43')](_0x4bb3fb['model'],qs['fields'](_0x4c0e28['query']['fields']));_0x4b67c8[_0xa488('0x44')]=_0x4b67c8['attributes'][_0xa488('0x46')]?_0x4b67c8[_0xa488('0x44')]:_0x4bb3fb[_0xa488('0x3e')];if(_0x4c0e28['query'][_0xa488('0x4f')]){_0x4b67c8['include']=[{'all':!![]}];}_0x4b67c8=_[_0xa488('0x4d')]({},_0x4b67c8,_0x4c0e28[_0xa488('0x55')]);return db[_0xa488('0x3b')][_0xa488('0x56')](_0x4b67c8)[_0xa488('0x1d')](handleEntityNotFound(_0x4f40db,null))[_0xa488('0x1d')](respondWithResult(_0x4f40db,null))[_0xa488('0x24')](handleError(_0x4f40db,null));};exports[_0xa488('0x57')]=function(_0x585ed7,_0x2383e1,_0x15a853){var _0x52a15d;return db[_0xa488('0x3b')][_0xa488('0x57')](_0x585ed7[_0xa488('0x58')],{'raw':!![]})[_0xa488('0x1d')](function(_0x27536f){_0x52a15d=_0x27536f;return db[_0xa488('0x3b')][_0xa488('0x51')]({'raw':!![]});})[_0xa488('0x1d')](function(_0x4e87ce){var _0x444e05=fs[_0xa488('0x59')](path[_0xa488('0x5a')](config[_0xa488('0x5b')],_0xa488('0x5c')),_0xa488('0x5d'));var _0x4fd6c5=ejs[_0xa488('0x5e')](_0x444e05,{'contexts':_0x4e87ce||[]});fs[_0xa488('0x5f')](_0xa488('0x60'),_0x4fd6c5);})[_0xa488('0x1d')](function(){return respondWithRpcPromise(_0xa488('0x61'),_0xa488('0x57'),{'module':'chan_sip.so'});})['then'](function(){var _0x382dba=_0x585ed7[_0xa488('0x62')]['get']({'plain':!![]});if(!_0x382dba)throw new Error(_0xa488('0x63'));if(_0x382dba[_0xa488('0x64')]===_0xa488('0x62')){var _0x578814=_0x52a15d[_0xa488('0x34')]({'plain':!![]});return db[_0xa488('0x65')][_0xa488('0x56')]({'where':{'name':_0xa488('0x35'),'userProfileId':_0x382dba[_0xa488('0x66')]},'raw':!![]})[_0xa488('0x1d')](function(_0x16cb0e){if(_0x16cb0e&&_0x16cb0e[_0xa488('0x67')]===0x0){return db['UserProfileResource'][_0xa488('0x57')]({'name':_0x578814[_0xa488('0x38')],'resourceId':_0x578814['id'],'type':_0x16cb0e[_0xa488('0x38')],'sectionId':_0x16cb0e['id']},{})[_0xa488('0x1d')](function(){return _0x52a15d;});}else{return _0x52a15d;}})[_0xa488('0x24')](function(_0x4c042e){logger[_0xa488('0x21')](_0xa488('0x68'),_0x4c042e);throw _0x4c042e;});}return _0x52a15d;})['then'](respondWithResult(_0x2383e1,0xc9))['catch'](handleError(_0x2383e1,null));};exports[_0xa488('0x32')]=function(_0x2db439,_0x5bf967,_0x344c31){var _0x74c69f;return db[_0xa488('0x3b')]['find']({'where':{'id':_0x2db439[_0xa488('0x54')]['id']}})[_0xa488('0x1d')](handleEntityNotFound(_0x5bf967,null))[_0xa488('0x1d')](saveUpdates(_0x2db439[_0xa488('0x58')],null))[_0xa488('0x1d')](function(_0x375c2f){if(_0x375c2f){_0x74c69f=_0x375c2f;return db['VoiceContext']['findAll']({'raw':!![]});}})['then'](function(_0x2b055d){var _0x4c77fc=fs[_0xa488('0x59')](path['join'](config[_0xa488('0x5b')],'server/files/templates/context.ejs'),'utf8');var _0x2614f0=ejs[_0xa488('0x5e')](_0x4c77fc,{'contexts':_0x2b055d||[]});fs[_0xa488('0x5f')](_0xa488('0x60'),_0x2614f0);})[_0xa488('0x1d')](function(){return respondWithRpcPromise(_0xa488('0x61'),_0xa488('0x32'),{'module':_0xa488('0x69')});})['then'](function(){return _0x74c69f;})[_0xa488('0x1d')](respondWithResult(_0x5bf967,null))[_0xa488('0x24')](handleError(_0x5bf967,null));};exports['destroy']=function(_0x5dbb4d,_0x5089b5,_0x4324b4){var _0x4a569c;return db['VoiceContext'][_0xa488('0x56')]({'where':{'id':_0x5dbb4d[_0xa488('0x54')]['id']}})['then'](handleEntityNotFound(_0x5089b5,null))[_0xa488('0x1d')](removeEntity(_0x5089b5,null))[_0xa488('0x1d')](function(){return db['VoiceContext'][_0xa488('0x51')]({'raw':!![]});})[_0xa488('0x1d')](function(_0x23119c){var _0x2c2335=fs[_0xa488('0x59')](path[_0xa488('0x5a')](config[_0xa488('0x5b')],_0xa488('0x5c')),_0xa488('0x5d'));var _0x1e76b3=ejs[_0xa488('0x5e')](_0x2c2335,{'contexts':_0x23119c});fs['writeFileSync'](_0xa488('0x60'),_0x1e76b3);return respondWithRpcPromise(_0xa488('0x61'),'destroy',{'module':'chan_sip.so'});})[_0xa488('0x24')](handleError(_0x5089b5,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 4a58555..000bc37 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 _0xce41=['moment','bluebird','path','rimraf','exports','define','VoiceContext','voice_contexts','lodash','../../config/logger'];(function(_0x194a6d,_0x5d63f4){var _0x4d0a9d=function(_0x111bfb){while(--_0x111bfb){_0x194a6d['push'](_0x194a6d['shift']());}};_0x4d0a9d(++_0x5d63f4);}(_0xce41,0x1c0));var _0x1ce4=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0xce41[_0x40be86];return _0xda3c3b;};'use strict';var _=require(_0x1ce4('0x0'));var util=require('util');var logger=require(_0x1ce4('0x1'))('api');var moment=require(_0x1ce4('0x2'));var BPromise=require(_0x1ce4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ce4('0x4'));var rimraf=require(_0x1ce4('0x5'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0x1ce4('0x6')]=function(_0x295f4f,_0x501fc6){return _0x295f4f[_0x1ce4('0x7')](_0x1ce4('0x8'),attributes,{'tableName':_0x1ce4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38d1=['path','rimraf','../../config/environment','./voiceContext.attributes','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x38d1,0x1b6));var _0x138d=function(_0x1c4ea9,_0x3f214b){_0x1c4ea9=_0x1c4ea9-0x0;var _0x3c8429=_0x38d1[_0x1c4ea9];return _0x3c8429;};'use strict';var _=require(_0x138d('0x0'));var util=require(_0x138d('0x1'));var logger=require(_0x138d('0x2'))(_0x138d('0x3'));var moment=require(_0x138d('0x4'));var BPromise=require(_0x138d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x138d('0x6'));var rimraf=require(_0x138d('0x7'));var config=require(_0x138d('0x8'));var attributes=require(_0x138d('0x9'));module['exports']=function(_0x1b6fc0,_0x3c299e){return _0x1b6fc0['define'](_0x138d('0xa'),attributes,{'tableName':_0x138d('0xb'),'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 2ac7f46..15bc586 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 _0x45d3=['rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1e6d9a,_0x548cf2){var _0x59b4da=function(_0x24a41d){while(--_0x24a41d){_0x1e6d9a['push'](_0x1e6d9a['shift']());}};_0x59b4da(++_0x548cf2);}(_0x45d3,0x148));var _0x345d=function(_0x588a56,_0x4adb69){_0x588a56=_0x588a56-0x0;var _0x5666ea=_0x45d3[_0x588a56];return _0x5666ea;};'use strict';var _=require('lodash');var util=require(_0x345d('0x0'));var moment=require(_0x345d('0x1'));var BPromise=require(_0x345d('0x2'));var rs=require(_0x345d('0x3'));var fs=require('fs');var Redis=require(_0x345d('0x4'));var db=require(_0x345d('0x5'))['db'];var utils=require(_0x345d('0x6'));var logger=require(_0x345d('0x7'))(_0x345d('0x8'));var config=require(_0x345d('0x9'));var jayson=require(_0x345d('0xa'));var client=jayson[_0x345d('0xb')][_0x345d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15dfe2,_0xf68d73,_0x5404a9){return new BPromise(function(_0x58a743,_0x241bf2){return client[_0x345d('0xd')](_0x15dfe2,_0x5404a9)['then'](function(_0x10421e){logger[_0x345d('0xe')](_0x345d('0xf'),_0xf68d73,'request\x20sent');logger[_0x345d('0x10')](_0x345d('0x11'),_0xf68d73,_0x345d('0x12'),JSON['stringify'](_0x10421e));if(_0x10421e['error']){if(_0x10421e[_0x345d('0x13')][_0x345d('0x14')]===0x1f4){logger[_0x345d('0x13')](_0x345d('0xf'),_0xf68d73,_0x10421e[_0x345d('0x13')]['message']);return _0x241bf2(_0x10421e[_0x345d('0x13')][_0x345d('0x15')]);}logger[_0x345d('0x13')](_0x345d('0xf'),_0xf68d73,_0x10421e[_0x345d('0x13')][_0x345d('0x15')]);return _0x58a743(_0x10421e[_0x345d('0x13')][_0x345d('0x15')]);}else{logger[_0x345d('0xe')](_0x345d('0xf'),_0xf68d73,_0x345d('0x12'));_0x58a743(_0x10421e[_0x345d('0x16')][_0x345d('0x15')]);}})[_0x345d('0x17')](function(_0x3b34ff){logger['error'](_0x345d('0xf'),_0xf68d73,_0x3b34ff);_0x241bf2(_0x3b34ff);});});} \ No newline at end of file +var _0x7916=['result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0xae4691,_0x58372c){var _0x537f7f=function(_0x4502de){while(--_0x4502de){_0xae4691['push'](_0xae4691['shift']());}};_0x537f7f(++_0x58372c);}(_0x7916,0x128));var _0x6791=function(_0x125703,_0x12dd6e){_0x125703=_0x125703-0x0;var _0x43cb71=_0x7916[_0x125703];return _0x43cb71;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var moment=require(_0x6791('0x1'));var BPromise=require(_0x6791('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6791('0x3'));var db=require(_0x6791('0x4'))['db'];var utils=require(_0x6791('0x5'));var logger=require(_0x6791('0x6'))('rpc');var config=require(_0x6791('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6791('0x8')][_0x6791('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ad8c0,_0x8b85ff,_0x5d2118){return new BPromise(function(_0x2b240c,_0x50c563){return client['request'](_0x5ad8c0,_0x5d2118)[_0x6791('0xa')](function(_0x198a64){logger['info'](_0x6791('0xb'),_0x8b85ff,_0x6791('0xc'));logger[_0x6791('0xd')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x8b85ff,_0x6791('0xc'),JSON[_0x6791('0xe')](_0x198a64));if(_0x198a64[_0x6791('0xf')]){if(_0x198a64[_0x6791('0xf')][_0x6791('0x10')]===0x1f4){logger[_0x6791('0xf')](_0x6791('0xb'),_0x8b85ff,_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);return _0x50c563(_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x8b85ff,_0x198a64[_0x6791('0xf')]['message']);return _0x2b240c(_0x198a64[_0x6791('0xf')]['message']);}else{logger[_0x6791('0x12')](_0x6791('0xb'),_0x8b85ff,'request\x20sent');_0x2b240c(_0x198a64[_0x6791('0x13')]['message']);}})[_0x6791('0x14')](function(_0x150d1f){logger['error'](_0x6791('0xb'),_0x8b85ff,_0x150d1f);_0x50c563(_0x150d1f);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 9206207..e1d92c7 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 _0x1301=['get','isAuthenticated','index','/describe','/:id','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../config/environment','./voiceDialReport.controller'];(function(_0x1d93b6,_0x153013){var _0x219a91=function(_0x20328c){while(--_0x20328c){_0x1d93b6['push'](_0x1d93b6['shift']());}};_0x219a91(++_0x153013);}(_0x1301,0x70));var _0x1130=function(_0x1f3cb5,_0x38c477){_0x1f3cb5=_0x1f3cb5-0x0;var _0x458183=_0x1301[_0x1f3cb5];return _0x458183;};'use strict';var multer=require(_0x1130('0x0'));var util=require(_0x1130('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1130('0x2'));var router=express[_0x1130('0x3')]();var fs_extra=require(_0x1130('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1130('0x5'));var controller=require(_0x1130('0x6'));router[_0x1130('0x7')]('/',auth[_0x1130('0x8')](),controller[_0x1130('0x9')]);router[_0x1130('0x7')](_0x1130('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x1130('0x7')](_0x1130('0xb'),auth[_0x1130('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1130('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x1130('0xd')]);router[_0x1130('0xe')](_0x1130('0xb'),auth[_0x1130('0x8')](),controller[_0x1130('0xf')]);module[_0x1130('0x10')]=router; \ No newline at end of file +var _0x9d2a=['index','/describe','isAuthenticated','describe','/:id','put','update','delete','multer','util','path','../../components/interaction/service','../../config/environment','get'];(function(_0x4dc7bb,_0xf1c679){var _0x3ff3ef=function(_0x258651){while(--_0x258651){_0x4dc7bb['push'](_0x4dc7bb['shift']());}};_0x3ff3ef(++_0xf1c679);}(_0x9d2a,0x1e4));var _0xa9d2=function(_0x49645a,_0x28f417){_0x49645a=_0x49645a-0x0;var _0x2b2c26=_0x9d2a[_0x49645a];return _0x2b2c26;};'use strict';var multer=require(_0xa9d2('0x0'));var util=require(_0xa9d2('0x1'));var path=require(_0xa9d2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa9d2('0x3'));var config=require(_0xa9d2('0x4'));var controller=require('./voiceDialReport.controller');router[_0xa9d2('0x5')]('/',auth['isAuthenticated'](),controller[_0xa9d2('0x6')]);router[_0xa9d2('0x5')](_0xa9d2('0x7'),auth[_0xa9d2('0x8')](),controller[_0xa9d2('0x9')]);router[_0xa9d2('0x5')](_0xa9d2('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa9d2('0xb')](_0xa9d2('0xa'),auth[_0xa9d2('0x8')](),controller[_0xa9d2('0xc')]);router[_0xa9d2('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 8f90112..0c5b62d 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 _0xe14d=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x4dd063,_0x386d0c){var _0x2b8747=function(_0x282e72){while(--_0x282e72){_0x4dd063['push'](_0x4dd063['shift']());}};_0x2b8747(++_0x386d0c);}(_0xe14d,0x1ee));var _0xde14=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xe14d[_0x411add];return _0x238242;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'privilege':{'type':Sequelize[_0xde14('0x2')]},'channel':{'type':Sequelize[_0xde14('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xde14('0x2')]},'calleridnum':{'type':Sequelize[_0xde14('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xde14('0x2')]},'connectedlinename':{'type':Sequelize[_0xde14('0x2')]},'language':{'type':Sequelize[_0xde14('0x2')]},'accountcode':{'type':Sequelize[_0xde14('0x2')]},'context':{'type':Sequelize[_0xde14('0x2')]},'exten':{'type':Sequelize[_0xde14('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xde14('0x2')]},'destchannel':{'type':Sequelize[_0xde14('0x2')]},'destchannelstate':{'type':Sequelize[_0xde14('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xde14('0x2')]},'destcalleridnum':{'type':Sequelize[_0xde14('0x2')]},'destcalleridname':{'type':Sequelize[_0xde14('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xde14('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xde14('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xde14('0x2')]},'destcontext':{'type':Sequelize[_0xde14('0x2')]},'destexten':{'type':Sequelize[_0xde14('0x2')]},'destpriority':{'type':Sequelize[_0xde14('0x3')]},'destuniqueid':{'type':Sequelize[_0xde14('0x2')]},'destlinkedid':{'type':Sequelize[_0xde14('0x2')]},'dialstring':{'type':Sequelize[_0xde14('0x2')]},'dialstatus':{'type':Sequelize[_0xde14('0x2')]},'starttime':{'type':Sequelize[_0xde14('0x4')]},'answertime':{'type':Sequelize[_0xde14('0x4')]},'endtime':{'type':Sequelize[_0xde14('0x4')]},'lastevent':{'type':Sequelize[_0xde14('0x2')],'comment':_0xde14('0x5')},'routeId':{'type':Sequelize[_0xde14('0x3')]},'duration':{'type':Sequelize[_0xde14('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x7c24d3,_0x4a7c69){var _0x5f2a71=function(_0x521a73){while(--_0x521a73){_0x7c24d3['push'](_0x7c24d3['shift']());}};_0x5f2a71(++_0x4a7c69);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x493cea,_0x144c6a){_0x493cea=_0x493cea-0x0;var _0x1c32ba=_0xf3cd[_0x493cea];return _0x1c32ba;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'privilege':{'type':Sequelize[_0xdf3c('0x2')]},'channel':{'type':Sequelize[_0xdf3c('0x2')]},'channelstate':{'type':Sequelize[_0xdf3c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdf3c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinename':{'type':Sequelize[_0xdf3c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdf3c('0x2')]},'context':{'type':Sequelize[_0xdf3c('0x2')]},'exten':{'type':Sequelize[_0xdf3c('0x2')]},'priority':{'type':Sequelize[_0xdf3c('0x3')]},'uniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'linkedid':{'type':Sequelize[_0xdf3c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdf3c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xdf3c('0x2')]},'destaccountcode':{'type':Sequelize[_0xdf3c('0x2')]},'destcontext':{'type':Sequelize[_0xdf3c('0x2')]},'destexten':{'type':Sequelize[_0xdf3c('0x2')]},'destpriority':{'type':Sequelize[_0xdf3c('0x3')]},'destuniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'destlinkedid':{'type':Sequelize[_0xdf3c('0x2')]},'dialstring':{'type':Sequelize[_0xdf3c('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdf3c('0x4')]},'answertime':{'type':Sequelize[_0xdf3c('0x4')]},'endtime':{'type':Sequelize[_0xdf3c('0x4')]},'lastevent':{'type':Sequelize[_0xdf3c('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xdf3c('0x3')]},'duration':{'type':Sequelize[_0xdf3c('0x3')]},'holdtime':{'type':Sequelize[_0xdf3c('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 006a75f..93c847a 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 _0x606e=['stack','name','send','index','map','VoiceDialReport','rawAttributes','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','include','findAll','rows','catch','show','length','includeAll','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error'];(function(_0x3f25b2,_0x412bd4){var _0xd8caeb=function(_0x52d252){while(--_0x52d252){_0x3f25b2['push'](_0x3f25b2['shift']());}};_0xd8caeb(++_0x412bd4);}(_0x606e,0xb4));var _0xe606=function(_0x48cb1f,_0x5ca68d){_0x48cb1f=_0x48cb1f-0x0;var _0x172c4d=_0x606e[_0x48cb1f];return _0x172c4d;};'use strict';var emlformat=require(_0xe606('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe606('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe606('0x2'));var moment=require(_0xe606('0x3'));var BPromise=require(_0xe606('0x4'));var Mustache=require(_0xe606('0x5'));var util=require('util');var path=require(_0xe606('0x6'));var sox=require(_0xe606('0x7'));var csv=require(_0xe606('0x8'));var ejs=require(_0xe606('0x9'));var fs=require('fs');var fs_extra=require(_0xe606('0xa'));var _=require('lodash');var squel=require(_0xe606('0xb'));var crypto=require(_0xe606('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe606('0xd'));var toCsv=require(_0xe606('0x8'));var querystring=require(_0xe606('0xe'));var Papa=require('papaparse');var Redis=require(_0xe606('0xf'));var authService=require(_0xe606('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe606('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe606('0x12'))(_0xe606('0x13'));var utils=require(_0xe606('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe606('0x15'));var db=require(_0xe606('0x16'))['db'];function respondWithStatusCode(_0x547c12,_0x456e52){_0x456e52=_0x456e52||0xcc;return function(_0x58a3a3){if(_0x58a3a3){return _0x547c12[_0xe606('0x17')](_0x456e52);}return _0x547c12['status'](_0x456e52)[_0xe606('0x18')]();};}function respondWithResult(_0x104722,_0x5edf13){_0x5edf13=_0x5edf13||0xc8;return function(_0x556665){if(_0x556665){return _0x104722[_0xe606('0x19')](_0x5edf13)['json'](_0x556665);}};}function respondWithFilteredResult(_0x2b358e,_0x209edd){return function(_0x2c8084){if(_0x2c8084){var _0x23fa24=typeof _0x209edd[_0xe606('0x1a')]===_0xe606('0x1b')&&typeof _0x209edd[_0xe606('0x1c')]==='undefined';var _0x2c07f9=_0x2c8084[_0xe606('0x1d')];var _0x5ef586=_0x23fa24?0x0:_0x209edd[_0xe606('0x1a')];var _0x35ac79=_0x23fa24?_0x2c8084[_0xe606('0x1d')]:_0x209edd['offset']+_0x209edd[_0xe606('0x1c')];var _0x1fb1b0;if(_0x35ac79>=_0x2c07f9){_0x35ac79=_0x2c07f9;_0x1fb1b0=0xc8;}else{_0x1fb1b0=0xce;}_0x2b358e['status'](_0x1fb1b0);return _0x2b358e[_0xe606('0x1e')](_0xe606('0x1f'),_0x5ef586+'-'+_0x35ac79+'/'+_0x2c07f9)[_0xe606('0x20')](_0x2c8084);}return null;};}function patchUpdates(_0x540d7e){return function(_0x5e3535){try{jsonpatch[_0xe606('0x21')](_0x5e3535,_0x540d7e,!![]);}catch(_0x4054b4){return BPromise[_0xe606('0x22')](_0x4054b4);}return _0x5e3535['save']();};}function saveUpdates(_0x28d062,_0x513d00){return function(_0x5b8a09){if(_0x5b8a09){return _0x5b8a09[_0xe606('0x23')](_0x28d062)[_0xe606('0x24')](function(_0x1b19c6){return _0x1b19c6;});}return null;};}function removeEntity(_0x53c81f,_0x451339){return function(_0x5720b1){if(_0x5720b1){return _0x5720b1[_0xe606('0x25')]()[_0xe606('0x24')](function(){_0x53c81f[_0xe606('0x19')](0xcc)[_0xe606('0x18')]();});}};}function handleEntityNotFound(_0x3c4490,_0x258e95){return function(_0x191fdf){if(!_0x191fdf){_0x3c4490[_0xe606('0x17')](0x194);}return _0x191fdf;};}function handleError(_0x5d08a5,_0xf7efb0){_0xf7efb0=_0xf7efb0||0x1f4;return function(_0x581fb8){logger[_0xe606('0x26')](_0x581fb8[_0xe606('0x27')]);if(_0x581fb8[_0xe606('0x28')]){delete _0x581fb8['name'];}_0x5d08a5[_0xe606('0x19')](_0xf7efb0)[_0xe606('0x29')](_0x581fb8);};}exports[_0xe606('0x2a')]=function(_0x41baba,_0x54c2b0){var _0x3b3856={},_0x2c7a19={},_0x1f859f={'count':0x0,'rows':[]};var _0x3211d3=_[_0xe606('0x2b')](db[_0xe606('0x2c')][_0xe606('0x2d')],function(_0x2865e0){return{'name':_0x2865e0['fieldName'],'type':_0x2865e0[_0xe606('0x2e')][_0xe606('0x2f')]};});_0x2c7a19[_0xe606('0x30')]=_['map'](_0x3211d3,'name');_0x2c7a19['query']=_[_0xe606('0x31')](_0x41baba['query']);_0x2c7a19['filters']=_[_0xe606('0x32')](_0x2c7a19['model'],_0x2c7a19[_0xe606('0x33')]);_0x3b3856[_0xe606('0x34')]=_['intersection'](_0x2c7a19['model'],qs[_0xe606('0x35')](_0x41baba[_0xe606('0x33')]['fields']));_0x3b3856['attributes']=_0x3b3856[_0xe606('0x34')]['length']?_0x3b3856[_0xe606('0x34')]:_0x2c7a19['model'];if(!_0x41baba[_0xe606('0x33')][_0xe606('0x36')](_0xe606('0x37'))){_0x3b3856[_0xe606('0x1c')]=qs['limit'](_0x41baba['query'][_0xe606('0x1c')]);_0x3b3856[_0xe606('0x1a')]=qs[_0xe606('0x1a')](_0x41baba[_0xe606('0x33')][_0xe606('0x1a')]);}_0x3b3856['order']=qs['sort'](_0x41baba[_0xe606('0x33')][_0xe606('0x38')]);_0x3b3856[_0xe606('0x39')]=qs[_0xe606('0x3a')](_[_0xe606('0x3b')](_0x41baba[_0xe606('0x33')],_0x2c7a19['filters']),_0x3211d3);if(_0x41baba[_0xe606('0x33')][_0xe606('0x3c')]){_0x3b3856[_0xe606('0x39')]=_[_0xe606('0x3d')](_0x3b3856[_0xe606('0x39')],{'$or':_['map'](_0x3211d3,function(_0x2f1bbe){if(_0x2f1bbe[_0xe606('0x2e')]!=='VIRTUAL'){var _0x5ce5fd={};_0x5ce5fd[_0x2f1bbe[_0xe606('0x28')]]={'$like':'%'+_0x41baba[_0xe606('0x33')][_0xe606('0x3c')]+'%'};return _0x5ce5fd;}})});}_0x3b3856=_['merge']({},_0x3b3856,_0x41baba['options']);var _0x564f2d={'where':_0x3b3856[_0xe606('0x39')]};return db[_0xe606('0x2c')]['count'](_0x564f2d)['then'](function(_0x5e1a4e){_0x1f859f[_0xe606('0x1d')]=_0x5e1a4e;if(_0x41baba['query']['includeAll']){_0x3b3856[_0xe606('0x3e')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xe606('0x3f')](_0x3b3856);})[_0xe606('0x24')](function(_0x4addda){_0x1f859f[_0xe606('0x40')]=_0x4addda;return _0x1f859f;})[_0xe606('0x24')](respondWithFilteredResult(_0x54c2b0,_0x3b3856))[_0xe606('0x41')](handleError(_0x54c2b0,null));};exports[_0xe606('0x42')]=function(_0x436634,_0x4a058a){var _0x20e80f={'raw':!![],'where':{'id':_0x436634['params']['id']}},_0x355709={};_0x355709['model']=_[_0xe606('0x31')](db[_0xe606('0x2c')][_0xe606('0x2d')]);_0x355709['query']=_[_0xe606('0x31')](_0x436634['query']);_0x355709[_0xe606('0x3a')]=_['intersection'](_0x355709['model'],_0x355709[_0xe606('0x33')]);_0x20e80f[_0xe606('0x34')]=_[_0xe606('0x32')](_0x355709[_0xe606('0x30')],qs['fields'](_0x436634[_0xe606('0x33')][_0xe606('0x35')]));_0x20e80f[_0xe606('0x34')]=_0x20e80f[_0xe606('0x34')][_0xe606('0x43')]?_0x20e80f[_0xe606('0x34')]:_0x355709[_0xe606('0x30')];if(_0x436634[_0xe606('0x33')][_0xe606('0x44')]){_0x20e80f[_0xe606('0x3e')]=[{'all':!![]}];}_0x20e80f=_[_0xe606('0x3d')]({},_0x20e80f,_0x436634['options']);return db[_0xe606('0x2c')][_0xe606('0x45')](_0x20e80f)[_0xe606('0x24')](handleEntityNotFound(_0x4a058a,null))['then'](respondWithResult(_0x4a058a,null))['catch'](handleError(_0x4a058a,null));};exports['create']=function(_0x4eeb4c,_0x24049e){return db['VoiceDialReport'][_0xe606('0x46')](_0x4eeb4c[_0xe606('0x47')],{})['then'](respondWithResult(_0x24049e,0xc9))['catch'](handleError(_0x24049e,null));};exports[_0xe606('0x23')]=function(_0x9f067a,_0x59ad07){if(_0x9f067a[_0xe606('0x47')]['id']){delete _0x9f067a[_0xe606('0x47')]['id'];}return db[_0xe606('0x2c')][_0xe606('0x45')]({'where':{'id':_0x9f067a[_0xe606('0x48')]['id']}})['then'](handleEntityNotFound(_0x59ad07,null))[_0xe606('0x24')](saveUpdates(_0x9f067a['body'],null))['then'](respondWithResult(_0x59ad07,null))[_0xe606('0x41')](handleError(_0x59ad07,null));};exports[_0xe606('0x25')]=function(_0x59f42b,_0x21387f){return db['VoiceDialReport']['find']({'where':{'id':_0x59f42b['params']['id']}})[_0xe606('0x24')](handleEntityNotFound(_0x21387f,null))[_0xe606('0x24')](removeEntity(_0x21387f,null))[_0xe606('0x41')](handleError(_0x21387f,null));};exports['describe']=function(_0x5dfa1a,_0x5751d1){return db[_0xe606('0x2c')]['describe']()[_0xe606('0x24')](respondWithResult(_0x5751d1,null))[_0xe606('0x41')](handleError(_0x5751d1,null));}; \ No newline at end of file +var _0x7f43=['hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','index','map','VoiceDialReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f43,0xf8));var _0x37f4=function(_0x538903,_0x568780){_0x538903=_0x538903-0x0;var _0x5e9b9d=_0x7f43[_0x538903];return _0x5e9b9d;};'use strict';var emlformat=require(_0x37f4('0x0'));var rimraf=require(_0x37f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x37f4('0x2'));var rp=require(_0x37f4('0x3'));var moment=require(_0x37f4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x37f4('0x5'));var util=require(_0x37f4('0x6'));var path=require(_0x37f4('0x7'));var sox=require(_0x37f4('0x8'));var csv=require(_0x37f4('0x9'));var ejs=require(_0x37f4('0xa'));var fs=require('fs');var fs_extra=require(_0x37f4('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x37f4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x37f4('0xd'));var toCsv=require(_0x37f4('0x9'));var querystring=require(_0x37f4('0xe'));var Papa=require(_0x37f4('0xf'));var Redis=require(_0x37f4('0x10'));var authService=require(_0x37f4('0x11'));var qs=require(_0x37f4('0x12'));var as=require(_0x37f4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x37f4('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x37f4('0x15'));var db=require(_0x37f4('0x16'))['db'];function respondWithStatusCode(_0x5eeb92,_0x270335){_0x270335=_0x270335||0xcc;return function(_0x126940){if(_0x126940){return _0x5eeb92['sendStatus'](_0x270335);}return _0x5eeb92[_0x37f4('0x17')](_0x270335)[_0x37f4('0x18')]();};}function respondWithResult(_0x216346,_0x3637ad){_0x3637ad=_0x3637ad||0xc8;return function(_0x13c2c6){if(_0x13c2c6){return _0x216346[_0x37f4('0x17')](_0x3637ad)[_0x37f4('0x19')](_0x13c2c6);}};}function respondWithFilteredResult(_0x42f128,_0x1311ad){return function(_0x554cc2){if(_0x554cc2){var _0x3f17de=typeof _0x1311ad['offset']===_0x37f4('0x1a')&&typeof _0x1311ad[_0x37f4('0x1b')]===_0x37f4('0x1a');var _0x51f388=_0x554cc2[_0x37f4('0x1c')];var _0x8b890d=_0x3f17de?0x0:_0x1311ad[_0x37f4('0x1d')];var _0x3a31e9=_0x3f17de?_0x554cc2[_0x37f4('0x1c')]:_0x1311ad[_0x37f4('0x1d')]+_0x1311ad[_0x37f4('0x1b')];var _0x1c7a8e;if(_0x3a31e9>=_0x51f388){_0x3a31e9=_0x51f388;_0x1c7a8e=0xc8;}else{_0x1c7a8e=0xce;}_0x42f128[_0x37f4('0x17')](_0x1c7a8e);return _0x42f128[_0x37f4('0x1e')](_0x37f4('0x1f'),_0x8b890d+'-'+_0x3a31e9+'/'+_0x51f388)[_0x37f4('0x19')](_0x554cc2);}return null;};}function patchUpdates(_0x5d1eac){return function(_0x3538f4){try{jsonpatch[_0x37f4('0x20')](_0x3538f4,_0x5d1eac,!![]);}catch(_0x3c569c){return BPromise[_0x37f4('0x21')](_0x3c569c);}return _0x3538f4[_0x37f4('0x22')]();};}function saveUpdates(_0x48c702,_0x592cb4){return function(_0x30fdd8){if(_0x30fdd8){return _0x30fdd8[_0x37f4('0x23')](_0x48c702)['then'](function(_0x5f0d27){return _0x5f0d27;});}return null;};}function removeEntity(_0x4a6e8b,_0x540cae){return function(_0x6fe66e){if(_0x6fe66e){return _0x6fe66e[_0x37f4('0x24')]()[_0x37f4('0x25')](function(){_0x4a6e8b['status'](0xcc)[_0x37f4('0x18')]();});}};}function handleEntityNotFound(_0x3f0486,_0x34d699){return function(_0x142cb5){if(!_0x142cb5){_0x3f0486[_0x37f4('0x26')](0x194);}return _0x142cb5;};}function handleError(_0x33784c,_0x4600dc){_0x4600dc=_0x4600dc||0x1f4;return function(_0x59e793){logger[_0x37f4('0x27')](_0x59e793[_0x37f4('0x28')]);if(_0x59e793[_0x37f4('0x29')]){delete _0x59e793['name'];}_0x33784c[_0x37f4('0x17')](_0x4600dc)['send'](_0x59e793);};}exports[_0x37f4('0x2a')]=function(_0x3ca0da,_0x584475){var _0x308ca8={},_0x4258db={},_0xf7f69d={'count':0x0,'rows':[]};var _0x20c634=_[_0x37f4('0x2b')](db[_0x37f4('0x2c')]['rawAttributes'],function(_0x29c1d0){return{'name':_0x29c1d0[_0x37f4('0x2d')],'type':_0x29c1d0[_0x37f4('0x2e')][_0x37f4('0x2f')]};});_0x4258db[_0x37f4('0x30')]=_[_0x37f4('0x2b')](_0x20c634,_0x37f4('0x29'));_0x4258db[_0x37f4('0x31')]=_[_0x37f4('0x32')](_0x3ca0da[_0x37f4('0x31')]);_0x4258db[_0x37f4('0x33')]=_[_0x37f4('0x34')](_0x4258db[_0x37f4('0x30')],_0x4258db[_0x37f4('0x31')]);_0x308ca8[_0x37f4('0x35')]=_[_0x37f4('0x34')](_0x4258db[_0x37f4('0x30')],qs[_0x37f4('0x36')](_0x3ca0da[_0x37f4('0x31')][_0x37f4('0x36')]));_0x308ca8[_0x37f4('0x35')]=_0x308ca8[_0x37f4('0x35')][_0x37f4('0x37')]?_0x308ca8[_0x37f4('0x35')]:_0x4258db[_0x37f4('0x30')];if(!_0x3ca0da['query'][_0x37f4('0x38')](_0x37f4('0x39'))){_0x308ca8['limit']=qs[_0x37f4('0x1b')](_0x3ca0da[_0x37f4('0x31')]['limit']);_0x308ca8[_0x37f4('0x1d')]=qs[_0x37f4('0x1d')](_0x3ca0da[_0x37f4('0x31')][_0x37f4('0x1d')]);}_0x308ca8['order']=qs[_0x37f4('0x3a')](_0x3ca0da[_0x37f4('0x31')][_0x37f4('0x3a')]);_0x308ca8['where']=qs[_0x37f4('0x33')](_[_0x37f4('0x3b')](_0x3ca0da[_0x37f4('0x31')],_0x4258db[_0x37f4('0x33')]),_0x20c634);if(_0x3ca0da[_0x37f4('0x31')][_0x37f4('0x3c')]){_0x308ca8[_0x37f4('0x3d')]=_[_0x37f4('0x3e')](_0x308ca8['where'],{'$or':_['map'](_0x20c634,function(_0x4ef48a){if(_0x4ef48a['type']!==_0x37f4('0x3f')){var _0x318ee5={};_0x318ee5[_0x4ef48a[_0x37f4('0x29')]]={'$like':'%'+_0x3ca0da[_0x37f4('0x31')]['filter']+'%'};return _0x318ee5;}})});}_0x308ca8=_[_0x37f4('0x3e')]({},_0x308ca8,_0x3ca0da[_0x37f4('0x40')]);var _0x58e4c5={'where':_0x308ca8[_0x37f4('0x3d')]};return db['VoiceDialReport'][_0x37f4('0x1c')](_0x58e4c5)['then'](function(_0xad538){_0xf7f69d[_0x37f4('0x1c')]=_0xad538;if(_0x3ca0da[_0x37f4('0x31')]['includeAll']){_0x308ca8[_0x37f4('0x41')]=[{'all':!![]}];}return db[_0x37f4('0x2c')][_0x37f4('0x42')](_0x308ca8);})[_0x37f4('0x25')](function(_0x4c5512){_0xf7f69d[_0x37f4('0x43')]=_0x4c5512;return _0xf7f69d;})['then'](respondWithFilteredResult(_0x584475,_0x308ca8))[_0x37f4('0x44')](handleError(_0x584475,null));};exports[_0x37f4('0x45')]=function(_0x3e4373,_0x1be965){var _0xf28fd8={'raw':!![],'where':{'id':_0x3e4373[_0x37f4('0x46')]['id']}},_0x337469={};_0x337469[_0x37f4('0x30')]=_['keys'](db['VoiceDialReport'][_0x37f4('0x47')]);_0x337469[_0x37f4('0x31')]=_[_0x37f4('0x32')](_0x3e4373[_0x37f4('0x31')]);_0x337469[_0x37f4('0x33')]=_[_0x37f4('0x34')](_0x337469[_0x37f4('0x30')],_0x337469[_0x37f4('0x31')]);_0xf28fd8['attributes']=_[_0x37f4('0x34')](_0x337469[_0x37f4('0x30')],qs[_0x37f4('0x36')](_0x3e4373[_0x37f4('0x31')]['fields']));_0xf28fd8[_0x37f4('0x35')]=_0xf28fd8[_0x37f4('0x35')]['length']?_0xf28fd8[_0x37f4('0x35')]:_0x337469[_0x37f4('0x30')];if(_0x3e4373[_0x37f4('0x31')]['includeAll']){_0xf28fd8[_0x37f4('0x41')]=[{'all':!![]}];}_0xf28fd8=_[_0x37f4('0x3e')]({},_0xf28fd8,_0x3e4373[_0x37f4('0x40')]);return db['VoiceDialReport']['find'](_0xf28fd8)['then'](handleEntityNotFound(_0x1be965,null))['then'](respondWithResult(_0x1be965,null))[_0x37f4('0x44')](handleError(_0x1be965,null));};exports[_0x37f4('0x48')]=function(_0x1f48fb,_0xbeea68){return db['VoiceDialReport'][_0x37f4('0x48')](_0x1f48fb['body'],{})[_0x37f4('0x25')](respondWithResult(_0xbeea68,0xc9))[_0x37f4('0x44')](handleError(_0xbeea68,null));};exports[_0x37f4('0x23')]=function(_0x403e79,_0x2ca1c5){if(_0x403e79[_0x37f4('0x49')]['id']){delete _0x403e79[_0x37f4('0x49')]['id'];}return db[_0x37f4('0x2c')]['find']({'where':{'id':_0x403e79[_0x37f4('0x46')]['id']}})[_0x37f4('0x25')](handleEntityNotFound(_0x2ca1c5,null))[_0x37f4('0x25')](saveUpdates(_0x403e79['body'],null))[_0x37f4('0x25')](respondWithResult(_0x2ca1c5,null))[_0x37f4('0x44')](handleError(_0x2ca1c5,null));};exports[_0x37f4('0x24')]=function(_0x1149f1,_0x21854d){return db[_0x37f4('0x2c')][_0x37f4('0x4a')]({'where':{'id':_0x1149f1[_0x37f4('0x46')]['id']}})[_0x37f4('0x25')](handleEntityNotFound(_0x21854d,null))['then'](removeEntity(_0x21854d,null))[_0x37f4('0x44')](handleError(_0x21854d,null));};exports[_0x37f4('0x4b')]=function(_0x159196,_0x403ada){return db[_0x37f4('0x2c')]['describe']()[_0x37f4('0x25')](respondWithResult(_0x403ada,null))[_0x37f4('0x44')](handleError(_0x403ada,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 3b1f773..fcb7920 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 _0xde5f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','uniqueid','lodash','util','../../config/logger'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xde5f,0x97));var _0xfde5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfde5('0x0'));var util=require(_0xfde5('0x1'));var logger=require(_0xfde5('0x2'))(_0xfde5('0x3'));var moment=require(_0xfde5('0x4'));var BPromise=require(_0xfde5('0x5'));var rp=require(_0xfde5('0x6'));var fs=require('fs');var path=require(_0xfde5('0x7'));var rimraf=require(_0xfde5('0x8'));var config=require(_0xfde5('0x9'));var attributes=require(_0xfde5('0xa'));module[_0xfde5('0xb')]=function(_0x41a682,_0x433e7b){return _0x41a682['define'](_0xfde5('0xc'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xfde5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6a2a=['../../config/logger','bluebird','rimraf','./voiceDialReport.attributes','exports','define','report_dial','uniqueid','util'];(function(_0xe0090f,_0x2dded1){var _0x5caf15=function(_0x4517ed){while(--_0x4517ed){_0xe0090f['push'](_0xe0090f['shift']());}};_0x5caf15(++_0x2dded1);}(_0x6a2a,0x1ee));var _0xa6a2=function(_0x2007e6,_0x43b204){_0x2007e6=_0x2007e6-0x0;var _0x31a410=_0x6a2a[_0x2007e6];return _0x31a410;};'use strict';var _=require('lodash');var util=require(_0xa6a2('0x0'));var logger=require(_0xa6a2('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa6a2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa6a2('0x3'));var config=require('../../config/environment');var attributes=require(_0xa6a2('0x4'));module[_0xa6a2('0x5')]=function(_0x414e1e,_0x3a104b){return _0x414e1e[_0xa6a2('0x6')]('VoiceDialReport',attributes,{'tableName':_0xa6a2('0x7'),'paranoid':![],'indexes':[{'fields':[_0xa6a2('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index ad50474..f2bee0d 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 _0xbeb4=['request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','lodash','util','bluebird','ioredis','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0xbeb4,0x1ee));var _0x4beb=function(_0x4aa009,_0x508c9a){_0x4aa009=_0x4aa009-0x0;var _0x1c67eb=_0xbeb4[_0x4aa009];return _0x1c67eb;};'use strict';var _=require(_0x4beb('0x0'));var util=require(_0x4beb('0x1'));var moment=require('moment');var BPromise=require(_0x4beb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4beb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4beb('0x4'));var client=jayson[_0x4beb('0x5')][_0x4beb('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x581d76,_0x23b479,_0x536390){return new BPromise(function(_0x5d91e3,_0x4941b6){return client['request'](_0x581d76,_0x536390)[_0x4beb('0x7')](function(_0x3f73fe){logger[_0x4beb('0x8')](_0x4beb('0x9'),_0x23b479,_0x4beb('0xa'));logger[_0x4beb('0xb')](_0x4beb('0xc'),_0x23b479,_0x4beb('0xa'),JSON[_0x4beb('0xd')](_0x3f73fe));if(_0x3f73fe[_0x4beb('0xe')]){if(_0x3f73fe[_0x4beb('0xe')][_0x4beb('0xf')]===0x1f4){logger[_0x4beb('0xe')](_0x4beb('0x9'),_0x23b479,_0x3f73fe[_0x4beb('0xe')][_0x4beb('0x10')]);return _0x4941b6(_0x3f73fe[_0x4beb('0xe')][_0x4beb('0x10')]);}logger[_0x4beb('0xe')](_0x4beb('0x9'),_0x23b479,_0x3f73fe[_0x4beb('0xe')]['message']);return _0x5d91e3(_0x3f73fe[_0x4beb('0xe')]['message']);}else{logger[_0x4beb('0x8')](_0x4beb('0x9'),_0x23b479,_0x4beb('0xa'));_0x5d91e3(_0x3f73fe[_0x4beb('0x11')][_0x4beb('0x10')]);}})[_0x4beb('0x12')](function(_0x57e177){logger[_0x4beb('0xe')](_0x4beb('0x9'),_0x23b479,_0x57e177);_0x4941b6(_0x57e177);});});}exports[_0x4beb('0x13')]=function(_0x2928f4){var _0x35911c=this;return new Promise(function(_0x330346,_0x10bb25){return db[_0x4beb('0x14')][_0x4beb('0x15')](_0x2928f4[_0x4beb('0x16')],{'raw':_0x2928f4['options']?_0x2928f4[_0x4beb('0x17')][_0x4beb('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4e120a){logger[_0x4beb('0x8')](_0x4beb('0x13'),_0x2928f4);logger[_0x4beb('0xb')](_0x4beb('0x13'),_0x2928f4,JSON['stringify'](_0x4e120a));_0x330346(_0x4e120a);})['catch'](function(_0x31d08e){logger[_0x4beb('0xe')](_0x4beb('0x13'),_0x31d08e[_0x4beb('0x10')],_0x2928f4);_0x10bb25(_0x35911c['error'](0x1f4,_0x31d08e[_0x4beb('0x10')]));});});};exports[_0x4beb('0x19')]=function(_0x56dae2){var _0xfd737=this;return new Promise(function(_0x135210,_0x1dca7f){return db[_0x4beb('0x14')][_0x4beb('0x1a')](_0x56dae2['body'],{'raw':_0x56dae2[_0x4beb('0x17')]?_0x56dae2[_0x4beb('0x17')][_0x4beb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56dae2[_0x4beb('0x17')]?_0x56dae2[_0x4beb('0x17')][_0x4beb('0x1b')]||null:null,'attributes':_0x56dae2[_0x4beb('0x17')]?_0x56dae2[_0x4beb('0x17')]['attributes']||null:null,'limit':_0x56dae2[_0x4beb('0x17')]?_0x56dae2[_0x4beb('0x17')]['limit']||null:null})[_0x4beb('0x7')](function(_0x1848fe){logger[_0x4beb('0x8')](_0x4beb('0x19'),_0x56dae2);logger['debug'](_0x4beb('0x19'),_0x56dae2,JSON[_0x4beb('0xd')](_0x1848fe));_0x135210(_0x1848fe);})['catch'](function(_0x34a7bd){logger[_0x4beb('0xe')](_0x4beb('0x19'),_0x34a7bd[_0x4beb('0x10')],_0x56dae2);_0x1dca7f(_0xfd737[_0x4beb('0xe')](0x1f4,_0x34a7bd[_0x4beb('0x10')]));});});}; \ No newline at end of file +var _0xba1e=['debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','info','CreateVoiceDialReport','VoiceDialReport','create','options','raw','stringify','catch','UpdateVoiceDialReport','body','where','attributes','limit','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent'];(function(_0x352096,_0x3b02b0){var _0x3de2f6=function(_0xa46902){while(--_0xa46902){_0x352096['push'](_0x352096['shift']());}};_0x3de2f6(++_0x3b02b0);}(_0xba1e,0x198));var _0xeba1=function(_0x1f707f,_0xb97d26){_0x1f707f=_0x1f707f-0x0;var _0x30368b=_0xba1e[_0x1f707f];return _0x30368b;};'use strict';var _=require('lodash');var util=require(_0xeba1('0x0'));var moment=require(_0xeba1('0x1'));var BPromise=require('bluebird');var rs=require(_0xeba1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeba1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xeba1('0x4'))('rpc');var config=require(_0xeba1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xeba1('0x6')][_0xeba1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4a99ad,_0x1acdfd,_0x48d98d){return new BPromise(function(_0x1c81aa,_0x5c7e47){return client[_0xeba1('0x8')](_0x4a99ad,_0x48d98d)[_0xeba1('0x9')](function(_0x17bd4f){logger['info'](_0xeba1('0xa'),_0x1acdfd,_0xeba1('0xb'));logger[_0xeba1('0xc')](_0xeba1('0xd'),_0x1acdfd,'request\x20sent',JSON['stringify'](_0x17bd4f));if(_0x17bd4f[_0xeba1('0xe')]){if(_0x17bd4f[_0xeba1('0xe')][_0xeba1('0xf')]===0x1f4){logger[_0xeba1('0xe')](_0xeba1('0xa'),_0x1acdfd,_0x17bd4f['error']['message']);return _0x5c7e47(_0x17bd4f[_0xeba1('0xe')][_0xeba1('0x10')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x1acdfd,_0x17bd4f[_0xeba1('0xe')][_0xeba1('0x10')]);return _0x1c81aa(_0x17bd4f[_0xeba1('0xe')][_0xeba1('0x10')]);}else{logger[_0xeba1('0x11')](_0xeba1('0xa'),_0x1acdfd,_0xeba1('0xb'));_0x1c81aa(_0x17bd4f['result'][_0xeba1('0x10')]);}})['catch'](function(_0x265e63){logger['error'](_0xeba1('0xa'),_0x1acdfd,_0x265e63);_0x5c7e47(_0x265e63);});});}exports[_0xeba1('0x12')]=function(_0x28222e){var _0x31b9bc=this;return new Promise(function(_0x2a6ff2,_0x125430){return db[_0xeba1('0x13')][_0xeba1('0x14')](_0x28222e['body'],{'raw':_0x28222e[_0xeba1('0x15')]?_0x28222e['options'][_0xeba1('0x16')]===undefined?!![]:![]:!![]})[_0xeba1('0x9')](function(_0x3b1982){logger[_0xeba1('0x11')](_0xeba1('0x12'),_0x28222e);logger['debug'](_0xeba1('0x12'),_0x28222e,JSON[_0xeba1('0x17')](_0x3b1982));_0x2a6ff2(_0x3b1982);})[_0xeba1('0x18')](function(_0x1a35c3){logger['error']('CreateVoiceDialReport',_0x1a35c3[_0xeba1('0x10')],_0x28222e);_0x125430(_0x31b9bc['error'](0x1f4,_0x1a35c3[_0xeba1('0x10')]));});});};exports[_0xeba1('0x19')]=function(_0x1333a3){var _0x3eb44e=this;return new Promise(function(_0x3a63bb,_0x439298){return db[_0xeba1('0x13')]['update'](_0x1333a3[_0xeba1('0x1a')],{'raw':_0x1333a3[_0xeba1('0x15')]?_0x1333a3[_0xeba1('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1333a3[_0xeba1('0x15')]?_0x1333a3['options'][_0xeba1('0x1b')]||null:null,'attributes':_0x1333a3[_0xeba1('0x15')]?_0x1333a3[_0xeba1('0x15')][_0xeba1('0x1c')]||null:null,'limit':_0x1333a3[_0xeba1('0x15')]?_0x1333a3[_0xeba1('0x15')][_0xeba1('0x1d')]||null:null})[_0xeba1('0x9')](function(_0x17edbd){logger[_0xeba1('0x11')]('UpdateVoiceDialReport',_0x1333a3);logger['debug'](_0xeba1('0x19'),_0x1333a3,JSON[_0xeba1('0x17')](_0x17edbd));_0x3a63bb(_0x17edbd);})[_0xeba1('0x18')](function(_0x4ccd54){logger[_0xeba1('0xe')](_0xeba1('0x19'),_0x4ccd54[_0xeba1('0x10')],_0x1333a3);_0x439298(_0x3eb44e['error'](0x1f4,_0x4ccd54[_0xeba1('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 46e3a08..a2f0eb3 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 _0x1be8=['Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','create','/:id/applications','addApplications','put','update','delete','destroy','multer','util','path','express'];(function(_0x1a27f3,_0x1c082d){var _0x3ce222=function(_0x3f93e1){while(--_0x3f93e1){_0x1a27f3['push'](_0x1a27f3['shift']());}};_0x3ce222(++_0x1c082d);}(_0x1be8,0x19e));var _0x81be=function(_0x16dd98,_0x11d346){_0x16dd98=_0x16dd98-0x0;var _0xfc7fb3=_0x1be8[_0x16dd98];return _0xfc7fb3;};'use strict';var multer=require(_0x81be('0x0'));var util=require(_0x81be('0x1'));var path=require(_0x81be('0x2'));var timeout=require('connect-timeout');var express=require(_0x81be('0x3'));var router=express[_0x81be('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x81be('0x5'));var interaction=require(_0x81be('0x6'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x81be('0x7')](),controller[_0x81be('0x8')]);router[_0x81be('0x9')](_0x81be('0xa'),auth[_0x81be('0x7')](),controller[_0x81be('0xb')]);router['post']('/',auth[_0x81be('0x7')](),controller[_0x81be('0xc')]);router['post'](_0x81be('0xd'),auth[_0x81be('0x7')](),controller[_0x81be('0xe')]);router[_0x81be('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x81be('0x10')]);router[_0x81be('0x11')](_0x81be('0xa'),auth[_0x81be('0x7')](),controller[_0x81be('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2462=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','/:id/applications','update','delete','destroy','exports','multer','util','express','Router'];(function(_0x28dce9,_0x39baf8){var _0x413a6a=function(_0x2931dd){while(--_0x2931dd){_0x28dce9['push'](_0x28dce9['shift']());}};_0x413a6a(++_0x39baf8);}(_0x2462,0x1c8));var _0x2246=function(_0x288e07,_0x390cdd){_0x288e07=_0x288e07-0x0;var _0xa08b86=_0x2462[_0x288e07];return _0xa08b86;};'use strict';var multer=require(_0x2246('0x0'));var util=require(_0x2246('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2246('0x2'));var router=express[_0x2246('0x3')]();var fs_extra=require(_0x2246('0x4'));var auth=require(_0x2246('0x5'));var interaction=require(_0x2246('0x6'));var config=require(_0x2246('0x7'));var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x2246('0x8')](),controller[_0x2246('0x9')]);router[_0x2246('0xa')](_0x2246('0xb'),auth[_0x2246('0x8')](),controller[_0x2246('0xc')]);router[_0x2246('0xd')]('/',auth['isAuthenticated'](),controller[_0x2246('0xe')]);router['post'](_0x2246('0xf'),auth[_0x2246('0x8')](),controller['addApplications']);router['put'](_0x2246('0xb'),auth[_0x2246('0x8')](),controller[_0x2246('0x10')]);router[_0x2246('0x11')]('/:id',auth[_0x2246('0x8')](),controller[_0x2246('0x12')]);module[_0x2246('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 7135c6e..ca354c5 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 _0x0713=['internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'priority':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':_0x3071('0x2')},'appdata':{'type':Sequelize[_0x3071('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3071('0x3')](_0x3071('0x4'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x3071('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3071('0xb')},'IntervalId':{'type':Sequelize[_0x3071('0xc')]},'isApp':{'type':Sequelize[_0x3071('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3071('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3071('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3071('0xc')]},'recordingFormat':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0xe')},'answer':{'type':Sequelize[_0x3071('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3071('0xf')],'get':function(){return this['getDataValue']('exten');}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x219e9b,_0x295d91){var _0x332e80=function(_0x567792){while(--_0x567792){_0x219e9b['push'](_0x219e9b['shift']());}};_0x332e80(++_0x295d91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index d5eed9f..a25f1e3 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 _0x1da3=['../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','undefined','count','offset','set','json','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','type','name','destroy','stack','send','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','limit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','fields','params','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','internal','find','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','context','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','../../components/parsers/qs','api','../../config/environment'];(function(_0x2517ce,_0xa3620){var _0x48240d=function(_0x4ccccb){while(--_0x4ccccb){_0x2517ce['push'](_0x2517ce['shift']());}};_0x48240d(++_0xa3620);}(_0x1da3,0xb4));var _0x31da=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1da3[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x31da('0x0'));var Redis=require('ioredis');var qs=require(_0x31da('0x1'));var logger=require('../../config/logger')(_0x31da('0x2'));var config=require(_0x31da('0x3'));var db=require(_0x31da('0x4'))['db'];config[_0x31da('0x5')]=_['defaults'](config[_0x31da('0x5')],{'host':_0x31da('0x6'),'port':0x18eb});var socket=require(_0x31da('0x7'))(new Redis(config[_0x31da('0x5')]));require('./voiceExtension.socket')[_0x31da('0x8')](socket);function respondWithStatusCode(_0x40bc3b,_0x47e171){_0x47e171=_0x47e171||0xcc;return function(_0xa2390e){if(_0xa2390e){return _0x40bc3b[_0x31da('0x9')](_0x47e171);}return _0x40bc3b[_0x31da('0xa')](_0x47e171)['end']();};}function respondWithResult(_0x5e5a05,_0x5290d8){_0x5290d8=_0x5290d8||0xc8;return function(_0x568558){if(_0x568558){return _0x5e5a05[_0x31da('0xa')](_0x5290d8)['json'](_0x568558);}};}function respondWithFilteredResult(_0x2ed308,_0x2f0b13){return function(_0x47fe69){if(_0x47fe69){var _0x4acfdc=typeof _0x2f0b13['offset']===_0x31da('0xb')&&typeof _0x2f0b13['limit']===_0x31da('0xb');var _0x3db3f1=_0x47fe69['count'];var _0x3b9ed8=_0x4acfdc?0x0:_0x2f0b13['offset'];var _0x2c6b45=_0x4acfdc?_0x47fe69[_0x31da('0xc')]:_0x2f0b13[_0x31da('0xd')]+_0x2f0b13['limit'];var _0x4ff6bd;if(_0x2c6b45>=_0x3db3f1){_0x2c6b45=_0x3db3f1;_0x4ff6bd=0xc8;}else{_0x4ff6bd=0xce;}_0x2ed308[_0x31da('0xa')](_0x4ff6bd);return _0x2ed308[_0x31da('0xe')]('Content-Range',_0x3b9ed8+'-'+_0x2c6b45+'/'+_0x3db3f1)[_0x31da('0xf')](_0x47fe69);}return null;};}function removeEntity(_0x42dc22){return function(_0x3c4412){if(_0x3c4412){return _0x3c4412['destroy']()[_0x31da('0x10')](function(){var _0x56fcee=_0x3c4412[_0x31da('0x11')]({'plain':!![]});var _0xbf5501=[{'name':_0x31da('0x12'),'value':_0x31da('0x13'),'ignore':![]},{'name':_0x31da('0x14'),'value':_0x31da('0x15'),'ignore':![]},{'name':_0x31da('0x16'),'value':'internal','ignore':![]}];var _0x212463=_(_0xbf5501)[_0x31da('0x17')](_0x31da('0x18'))[_0x31da('0x19')](_0x31da('0x1a'))[_0x31da('0x1a')]();if(_[_0x31da('0x1b')](_0x212463,_0x56fcee[_0x31da('0x1c')])){return;}var _0xf50035=_['find'](_0xbf5501,[_0x31da('0x1a'),_0x56fcee[_0x31da('0x1c')]])[_0x31da('0x1d')];return db['UserProfileResource'][_0x31da('0x1e')]({'where':{'type':_0xf50035,'resourceId':_0x56fcee['id']}})[_0x31da('0x10')](function(){return _0x3c4412;});})[_0x31da('0x10')](function(){_0x42dc22[_0x31da('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x218ad3){return function(_0x40753a){if(!_0x40753a){_0x218ad3[_0x31da('0x9')](0x194);}return _0x40753a;};}function handleError(_0x54e45f,_0x2ff1f7){_0x2ff1f7=_0x2ff1f7||0x1f4;return function(_0x9bd209){logger['error'](_0x9bd209[_0x31da('0x1f')]);if(_0x9bd209[_0x31da('0x1d')]){delete _0x9bd209['name'];}_0x54e45f[_0x31da('0xa')](_0x2ff1f7)[_0x31da('0x20')](_0x9bd209);};}exports['index']=function(_0x5798ba,_0x4577a7){var _0x1ba0f3={},_0x2ede95={},_0x559480={'count':0x0,'rows':[]};var _0x47caff=_[_0x31da('0x19')](db[_0x31da('0x21')][_0x31da('0x22')],function(_0x1db957){return{'name':_0x1db957[_0x31da('0x23')],'type':_0x1db957['type'][_0x31da('0x24')]};});_0x2ede95[_0x31da('0x25')]=_[_0x31da('0x19')](_0x47caff,_0x31da('0x1d'));_0x2ede95[_0x31da('0x26')]=_[_0x31da('0x27')](_0x5798ba['query']);_0x2ede95[_0x31da('0x28')]=_[_0x31da('0x29')](_0x2ede95[_0x31da('0x25')],_0x2ede95['query']);_0x1ba0f3[_0x31da('0x2a')]=_[_0x31da('0x29')](_0x2ede95[_0x31da('0x25')],qs['fields'](_0x5798ba['query']['fields']));_0x1ba0f3[_0x31da('0x2a')]=_0x1ba0f3[_0x31da('0x2a')][_0x31da('0x2b')]?_0x1ba0f3[_0x31da('0x2a')]:_0x2ede95[_0x31da('0x25')];if(!_0x5798ba[_0x31da('0x26')][_0x31da('0x2c')]('nolimit')){_0x1ba0f3[_0x31da('0x2d')]=qs[_0x31da('0x2d')](_0x5798ba[_0x31da('0x26')][_0x31da('0x2d')]);_0x1ba0f3['offset']=qs[_0x31da('0xd')](_0x5798ba[_0x31da('0x26')]['offset']);}_0x1ba0f3[_0x31da('0x2e')]=qs[_0x31da('0x2f')](_0x5798ba['query'][_0x31da('0x2f')]);_0x1ba0f3[_0x31da('0x30')]=qs['filters'](_[_0x31da('0x31')](_0x5798ba[_0x31da('0x26')],_0x2ede95[_0x31da('0x28')]),_0x47caff);if(_0x5798ba[_0x31da('0x26')][_0x31da('0x17')]){_0x1ba0f3['where']=_[_0x31da('0x32')](_0x1ba0f3[_0x31da('0x30')],{'$or':_[_0x31da('0x19')](_0x47caff,function(_0x1e94e2){if(_0x1e94e2[_0x31da('0x1c')]!=='VIRTUAL'){var _0x40dc69={};_0x40dc69[_0x1e94e2[_0x31da('0x1d')]]={'$like':'%'+_0x5798ba['query'][_0x31da('0x17')]+'%'};return _0x40dc69;}})});}_0x1ba0f3=_[_0x31da('0x32')]({},_0x1ba0f3,_0x5798ba[_0x31da('0x33')]);var _0x5654a1={'where':_0x1ba0f3[_0x31da('0x30')]};return db['VoiceExtension'][_0x31da('0xc')](_0x5654a1)[_0x31da('0x10')](function(_0x427f3d){_0x559480['count']=_0x427f3d;if(_0x5798ba[_0x31da('0x26')][_0x31da('0x34')]){_0x1ba0f3[_0x31da('0x35')]=[{'all':!![]}];}return db['VoiceExtension'][_0x31da('0x36')](_0x1ba0f3);})['then'](function(_0x2462b3){_0x559480[_0x31da('0x37')]=_0x2462b3;return _0x559480;})[_0x31da('0x10')](respondWithFilteredResult(_0x4577a7,_0x1ba0f3))[_0x31da('0x38')](handleError(_0x4577a7,null));};exports[_0x31da('0x39')]=function(_0x2fc815,_0x395064){var _0x4085b4={'raw':![],'where':{'id':_0x2fc815['params']['id']}},_0x47dba1={};_0x47dba1['model']=_[_0x31da('0x27')](db[_0x31da('0x21')][_0x31da('0x22')]);_0x47dba1['query']=_[_0x31da('0x27')](_0x2fc815[_0x31da('0x26')]);_0x47dba1[_0x31da('0x28')]=_[_0x31da('0x29')](_0x47dba1[_0x31da('0x25')],_0x47dba1['query']);_0x4085b4['attributes']=_['intersection'](_0x47dba1[_0x31da('0x25')],qs['fields'](_0x2fc815[_0x31da('0x26')][_0x31da('0x3a')]));_0x4085b4['attributes']=_0x4085b4[_0x31da('0x2a')]['length']?_0x4085b4[_0x31da('0x2a')]:_0x47dba1[_0x31da('0x25')];if(_0x2fc815[_0x31da('0x26')][_0x31da('0x34')]){_0x4085b4['include']=[{'all':!![]}];}_0x4085b4=_[_0x31da('0x32')]({},_0x4085b4,_0x2fc815[_0x31da('0x33')]);return db[_0x31da('0x21')]['find'](_0x4085b4)['then'](handleEntityNotFound(_0x395064,null))['then'](respondWithResult(_0x395064,null))['catch'](handleError(_0x395064,null));};exports['destroy']=function(_0x382428,_0x1a5ab1){return db[_0x31da('0x21')]['find']({'where':{'id':_0x382428[_0x31da('0x3b')]['id']}})[_0x31da('0x10')](handleEntityNotFound(_0x1a5ab1,null))[_0x31da('0x10')](removeEntity(_0x1a5ab1,null))[_0x31da('0x38')](handleError(_0x1a5ab1,null));};exports[_0x31da('0x3c')]=function(_0x332183,_0x447a23){if(_0x332183[_0x31da('0x3d')][_0x31da('0x1c')]==='outbound'&&!_[_0x31da('0x3e')](_0x332183[_0x31da('0x3d')][_0x31da('0x3f')],'_')){_0x332183[_0x31da('0x3d')]['exten']='_'[_0x31da('0x40')](_0x332183['body'][_0x31da('0x3f')]);}return db[_0x31da('0x21')][_0x31da('0x3c')](_0x332183[_0x31da('0x3d')],{'raw':![]})[_0x31da('0x10')](function(_0x101acf){var _0x396c78=_0x332183[_0x31da('0x41')][_0x31da('0x11')]({'plain':!![]});if(!_0x396c78)throw new Error(_0x31da('0x42'));if(_0x396c78[_0x31da('0x43')]==='user'){var _0x49ce85=_0x101acf[_0x31da('0x11')]({'plain':!![]});var _0x495a59=[{'name':'InboundRoutes','value':_0x31da('0x13')},{'name':'OutboundRoutes','value':_0x31da('0x15')},{'name':_0x31da('0x16'),'value':_0x31da('0x44')}];var _0x33ff17=_[_0x31da('0x45')](_0x495a59,['value',_0x49ce85[_0x31da('0x1c')]])[_0x31da('0x1d')];return db[_0x31da('0x46')][_0x31da('0x45')]({'where':{'name':_0x33ff17,'userProfileId':_0x396c78['userProfileId']},'raw':!![]})['then'](function(_0x5478e8){if(_0x5478e8&&_0x5478e8[_0x31da('0x47')]===0x0){return db[_0x31da('0x48')]['create']({'name':_0x49ce85[_0x31da('0x1d')],'resourceId':_0x49ce85['id'],'type':_0x5478e8[_0x31da('0x1d')],'sectionId':_0x5478e8['id']},{})[_0x31da('0x10')](function(){return _0x101acf;});}else{return _0x101acf;}})[_0x31da('0x38')](function(_0x702d5){logger[_0x31da('0x49')](_0x31da('0x4a'),_0x702d5);throw _0x702d5;});}return _0x101acf;})['then'](respondWithResult(_0x447a23,0xc9))['catch'](handleError(_0x447a23,null));};exports[_0x31da('0x4b')]=function(_0x52f25c,_0x3bdac3){if(_0x52f25c[_0x31da('0x3d')]['id']){delete _0x52f25c['body']['id'];}return db[_0x31da('0x21')]['find']({'where':{'id':_0x52f25c[_0x31da('0x3b')]['id']}})['then'](handleEntityNotFound(_0x3bdac3,null))[_0x31da('0x10')](function(_0x146459){if(_0x146459){return db[_0x31da('0x21')][_0x31da('0x4b')](_[_0x31da('0x31')](_0x52f25c[_0x31da('0x3d')],['exten','context',_0x31da('0x4c'),_0x31da('0x4d'),_0x31da('0x4e'),_0x31da('0x4f'),'alias']),{'where':{'context':_0x146459[_0x31da('0x50')],'exten':_0x146459[_0x31da('0x3f')]},'individualHooks':!![]})[_0x31da('0x10')](function(_0xe7778c){return _0xe7778c;});}return null;})['then'](respondWithStatusCode(_0x3bdac3,null))[_0x31da('0x38')](handleError(_0x3bdac3,null));};exports[_0x31da('0x51')]=function(_0x8716fb,_0x2fca04){var _0x2b156f=_0x8716fb[_0x31da('0x3b')]['id'];var _0x5d9915=_0x8716fb['body'];var _0x58bb0d=0xc8;var _0x420aea=null;return db[_0x31da('0x52')][_0x31da('0x53')]({'isolationLevel':db['sequelize'][_0x31da('0x54')][_0x31da('0x55')]['READ_COMMITTED']},function(_0x696942){return db[_0x31da('0x21')][_0x31da('0x56')]({'where':{'id':_0x2b156f},'transaction':_0x696942})[_0x31da('0x10')](function(_0x1173b9){if(_0x1173b9){return db[_0x31da('0x21')]['destroy']({'where':{'VoiceExtensionId':_0x2b156f},'transaction':_0x696942})[_0x31da('0x10')](function(){var _0x45b585=_['map'](_0x5d9915,function(_0x10d091){_0x10d091[_0x31da('0x57')]=_0x2b156f;_0x10d091[_0x31da('0x58')]=!![];return _0x10d091;});return _0x1173b9['createRouting'](_0x45b585);})[_0x31da('0x10')](function(_0x330435){return db['VoiceExtension'][_0x31da('0x59')](_0x330435,{'transaction':_0x696942});});}else{_0x58bb0d=0x194;_0x420aea=[];}});})[_0x31da('0x10')](function(){if(_0x58bb0d!==0x194){return db[_0x31da('0x21')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x2b156f},'order':_0x31da('0x5a')})[_0x31da('0x10')](function(_0x288784){_0x420aea=_0x288784;});}})[_0x31da('0x38')](function(_0x28c56b){_0x58bb0d=0x1f4;logger[_0x31da('0x49')](_0x28c56b[_0x31da('0x1f')]);if(_0x28c56b['name']){delete _0x28c56b[_0x31da('0x1d')];}_0x420aea=_0x28c56b;})[_0x31da('0x5b')](function(){if(_0x420aea===null){_0x2fca04[_0x31da('0x9')](_0x58bb0d);}else{if(_0x58bb0d===0x1f4){_0x2fca04[_0x31da('0xa')](_0x58bb0d)[_0x31da('0x20')](_0x420aea);}else{_0x2fca04[_0x31da('0xa')](_0x58bb0d)[_0x31da('0xf')](_0x420aea);}}});}; \ No newline at end of file +var _0x3154=['ignore','map','value','includes','UserProfileResource','error','stack','name','send','VoiceExtension','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','keys','options','find','params','create','body','outbound','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','destroy','then','get','InboundRoutes','OutboundRoutes','InternalRoutes','internal'];(function(_0x38b1fe,_0x53aedb){var _0x1b3f86=function(_0x2d4112){while(--_0x2d4112){_0x38b1fe['push'](_0x38b1fe['shift']());}};_0x1b3f86(++_0x53aedb);}(_0x3154,0xfe));var _0x4315=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x3154[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x4315('0x0'));var Redis=require(_0x4315('0x1'));var qs=require(_0x4315('0x2'));var logger=require(_0x4315('0x3'))(_0x4315('0x4'));var config=require(_0x4315('0x5'));var db=require(_0x4315('0x6'))['db'];config[_0x4315('0x7')]=_[_0x4315('0x8')](config[_0x4315('0x7')],{'host':_0x4315('0x9'),'port':0x18eb});var socket=require(_0x4315('0xa'))(new Redis(config[_0x4315('0x7')]));require('./voiceExtension.socket')[_0x4315('0xb')](socket);function respondWithStatusCode(_0x2e95d7,_0x23d381){_0x23d381=_0x23d381||0xcc;return function(_0x56274d){if(_0x56274d){return _0x2e95d7[_0x4315('0xc')](_0x23d381);}return _0x2e95d7[_0x4315('0xd')](_0x23d381)[_0x4315('0xe')]();};}function respondWithResult(_0x3bcf2b,_0x12c896){_0x12c896=_0x12c896||0xc8;return function(_0x5d2385){if(_0x5d2385){return _0x3bcf2b[_0x4315('0xd')](_0x12c896)[_0x4315('0xf')](_0x5d2385);}};}function respondWithFilteredResult(_0x3147fa,_0x551ce1){return function(_0x4b7f81){if(_0x4b7f81){var _0xf5e9f0=typeof _0x551ce1['offset']==='undefined'&&typeof _0x551ce1[_0x4315('0x10')]===_0x4315('0x11');var _0xc7e8bf=_0x4b7f81[_0x4315('0x12')];var _0x558cc7=_0xf5e9f0?0x0:_0x551ce1[_0x4315('0x13')];var _0x154def=_0xf5e9f0?_0x4b7f81['count']:_0x551ce1[_0x4315('0x13')]+_0x551ce1[_0x4315('0x10')];var _0x3f99f2;if(_0x154def>=_0xc7e8bf){_0x154def=_0xc7e8bf;_0x3f99f2=0xc8;}else{_0x3f99f2=0xce;}_0x3147fa[_0x4315('0xd')](_0x3f99f2);return _0x3147fa['set'](_0x4315('0x14'),_0x558cc7+'-'+_0x154def+'/'+_0xc7e8bf)[_0x4315('0xf')](_0x4b7f81);}return null;};}function removeEntity(_0x5a2bcf){return function(_0x3efff2){if(_0x3efff2){return _0x3efff2[_0x4315('0x15')]()[_0x4315('0x16')](function(){var _0x9f0a93=_0x3efff2[_0x4315('0x17')]({'plain':!![]});var _0x44b5b9=[{'name':_0x4315('0x18'),'value':'inbound','ignore':![]},{'name':_0x4315('0x19'),'value':'outbound','ignore':![]},{'name':_0x4315('0x1a'),'value':_0x4315('0x1b'),'ignore':![]}];var _0x323c2a=_(_0x44b5b9)['filter'](_0x4315('0x1c'))[_0x4315('0x1d')]('value')[_0x4315('0x1e')]();if(_[_0x4315('0x1f')](_0x323c2a,_0x9f0a93['type'])){return;}var _0x2cd595=_['find'](_0x44b5b9,[_0x4315('0x1e'),_0x9f0a93['type']])['name'];return db[_0x4315('0x20')][_0x4315('0x15')]({'where':{'type':_0x2cd595,'resourceId':_0x9f0a93['id']}})[_0x4315('0x16')](function(){return _0x3efff2;});})[_0x4315('0x16')](function(){_0x5a2bcf[_0x4315('0xd')](0xcc)[_0x4315('0xe')]();});}};}function handleEntityNotFound(_0x23df46){return function(_0x195dcb){if(!_0x195dcb){_0x23df46[_0x4315('0xc')](0x194);}return _0x195dcb;};}function handleError(_0x55d224,_0xdd3ec7){_0xdd3ec7=_0xdd3ec7||0x1f4;return function(_0x3bea9e){logger[_0x4315('0x21')](_0x3bea9e[_0x4315('0x22')]);if(_0x3bea9e[_0x4315('0x23')]){delete _0x3bea9e[_0x4315('0x23')];}_0x55d224[_0x4315('0xd')](_0xdd3ec7)[_0x4315('0x24')](_0x3bea9e);};}exports['index']=function(_0x2eef9e,_0x377efd){var _0xc0eb46={},_0x420b1b={},_0x19ccc9={'count':0x0,'rows':[]};var _0x44b7bc=_['map'](db[_0x4315('0x25')][_0x4315('0x26')],function(_0x28eac8){return{'name':_0x28eac8['fieldName'],'type':_0x28eac8[_0x4315('0x27')][_0x4315('0x28')]};});_0x420b1b[_0x4315('0x29')]=_[_0x4315('0x1d')](_0x44b7bc,_0x4315('0x23'));_0x420b1b[_0x4315('0x2a')]=_['keys'](_0x2eef9e['query']);_0x420b1b[_0x4315('0x2b')]=_[_0x4315('0x2c')](_0x420b1b[_0x4315('0x29')],_0x420b1b[_0x4315('0x2a')]);_0xc0eb46[_0x4315('0x2d')]=_[_0x4315('0x2c')](_0x420b1b['model'],qs[_0x4315('0x2e')](_0x2eef9e[_0x4315('0x2a')][_0x4315('0x2e')]));_0xc0eb46[_0x4315('0x2d')]=_0xc0eb46['attributes'][_0x4315('0x2f')]?_0xc0eb46['attributes']:_0x420b1b[_0x4315('0x29')];if(!_0x2eef9e[_0x4315('0x2a')]['hasOwnProperty'](_0x4315('0x30'))){_0xc0eb46[_0x4315('0x10')]=qs['limit'](_0x2eef9e['query'][_0x4315('0x10')]);_0xc0eb46[_0x4315('0x13')]=qs[_0x4315('0x13')](_0x2eef9e[_0x4315('0x2a')][_0x4315('0x13')]);}_0xc0eb46[_0x4315('0x31')]=qs[_0x4315('0x32')](_0x2eef9e[_0x4315('0x2a')][_0x4315('0x32')]);_0xc0eb46[_0x4315('0x33')]=qs[_0x4315('0x2b')](_[_0x4315('0x34')](_0x2eef9e['query'],_0x420b1b[_0x4315('0x2b')]),_0x44b7bc);if(_0x2eef9e[_0x4315('0x2a')][_0x4315('0x35')]){_0xc0eb46[_0x4315('0x33')]=_[_0x4315('0x36')](_0xc0eb46[_0x4315('0x33')],{'$or':_[_0x4315('0x1d')](_0x44b7bc,function(_0x1b2422){if(_0x1b2422[_0x4315('0x27')]!==_0x4315('0x37')){var _0x515634={};_0x515634[_0x1b2422[_0x4315('0x23')]]={'$like':'%'+_0x2eef9e[_0x4315('0x2a')][_0x4315('0x35')]+'%'};return _0x515634;}})});}_0xc0eb46=_['merge']({},_0xc0eb46,_0x2eef9e['options']);var _0x5050ea={'where':_0xc0eb46[_0x4315('0x33')]};return db['VoiceExtension'][_0x4315('0x12')](_0x5050ea)[_0x4315('0x16')](function(_0x3380a7){_0x19ccc9[_0x4315('0x12')]=_0x3380a7;if(_0x2eef9e[_0x4315('0x2a')][_0x4315('0x38')]){_0xc0eb46[_0x4315('0x39')]=[{'all':!![]}];}return db[_0x4315('0x25')][_0x4315('0x3a')](_0xc0eb46);})['then'](function(_0x1bd212){_0x19ccc9[_0x4315('0x3b')]=_0x1bd212;return _0x19ccc9;})[_0x4315('0x16')](respondWithFilteredResult(_0x377efd,_0xc0eb46))[_0x4315('0x3c')](handleError(_0x377efd,null));};exports['show']=function(_0x5138a6,_0x3edb1d){var _0x45a7d6={'raw':![],'where':{'id':_0x5138a6['params']['id']}},_0x12da19={};_0x12da19['model']=_[_0x4315('0x3d')](db[_0x4315('0x25')][_0x4315('0x26')]);_0x12da19[_0x4315('0x2a')]=_[_0x4315('0x3d')](_0x5138a6[_0x4315('0x2a')]);_0x12da19[_0x4315('0x2b')]=_[_0x4315('0x2c')](_0x12da19[_0x4315('0x29')],_0x12da19['query']);_0x45a7d6[_0x4315('0x2d')]=_['intersection'](_0x12da19[_0x4315('0x29')],qs[_0x4315('0x2e')](_0x5138a6['query'][_0x4315('0x2e')]));_0x45a7d6['attributes']=_0x45a7d6['attributes'][_0x4315('0x2f')]?_0x45a7d6[_0x4315('0x2d')]:_0x12da19[_0x4315('0x29')];if(_0x5138a6[_0x4315('0x2a')][_0x4315('0x38')]){_0x45a7d6[_0x4315('0x39')]=[{'all':!![]}];}_0x45a7d6=_[_0x4315('0x36')]({},_0x45a7d6,_0x5138a6[_0x4315('0x3e')]);return db[_0x4315('0x25')][_0x4315('0x3f')](_0x45a7d6)[_0x4315('0x16')](handleEntityNotFound(_0x3edb1d,null))[_0x4315('0x16')](respondWithResult(_0x3edb1d,null))[_0x4315('0x3c')](handleError(_0x3edb1d,null));};exports[_0x4315('0x15')]=function(_0x503ff9,_0x14a480){return db[_0x4315('0x25')]['find']({'where':{'id':_0x503ff9[_0x4315('0x40')]['id']}})[_0x4315('0x16')](handleEntityNotFound(_0x14a480,null))[_0x4315('0x16')](removeEntity(_0x14a480,null))[_0x4315('0x3c')](handleError(_0x14a480,null));};exports[_0x4315('0x41')]=function(_0x167eb5,_0x467bbb){if(_0x167eb5[_0x4315('0x42')][_0x4315('0x27')]===_0x4315('0x43')&&!_[_0x4315('0x44')](_0x167eb5[_0x4315('0x42')][_0x4315('0x45')],'_')){_0x167eb5['body'][_0x4315('0x45')]='_'[_0x4315('0x46')](_0x167eb5[_0x4315('0x42')]['exten']);}return db['VoiceExtension'][_0x4315('0x41')](_0x167eb5['body'],{'raw':![]})[_0x4315('0x16')](function(_0x3732ab){var _0x383c26=_0x167eb5[_0x4315('0x47')]['get']({'plain':!![]});if(!_0x383c26)throw new Error(_0x4315('0x48'));if(_0x383c26['role']===_0x4315('0x47')){var _0x2b8cb0=_0x3732ab[_0x4315('0x17')]({'plain':!![]});var _0x221210=[{'name':_0x4315('0x18'),'value':_0x4315('0x49')},{'name':_0x4315('0x19'),'value':_0x4315('0x43')},{'name':_0x4315('0x1a'),'value':_0x4315('0x1b')}];var _0x493e36=_[_0x4315('0x3f')](_0x221210,['value',_0x2b8cb0['type']])['name'];return db['UserProfileSection'][_0x4315('0x3f')]({'where':{'name':_0x493e36,'userProfileId':_0x383c26[_0x4315('0x4a')]},'raw':!![]})['then'](function(_0x4294b9){if(_0x4294b9&&_0x4294b9[_0x4315('0x4b')]===0x0){return db[_0x4315('0x20')][_0x4315('0x41')]({'name':_0x2b8cb0['name'],'resourceId':_0x2b8cb0['id'],'type':_0x4294b9['name'],'sectionId':_0x4294b9['id']},{})[_0x4315('0x16')](function(){return _0x3732ab;});}else{return _0x3732ab;}})['catch'](function(_0x415499){logger[_0x4315('0x21')](_0x4315('0x4c'),_0x415499);throw _0x415499;});}return _0x3732ab;})['then'](respondWithResult(_0x467bbb,0xc9))[_0x4315('0x3c')](handleError(_0x467bbb,null));};exports[_0x4315('0x4d')]=function(_0xe8983f,_0x30d101){if(_0xe8983f[_0x4315('0x42')]['id']){delete _0xe8983f[_0x4315('0x42')]['id'];}return db[_0x4315('0x25')]['find']({'where':{'id':_0xe8983f[_0x4315('0x40')]['id']}})[_0x4315('0x16')](handleEntityNotFound(_0x30d101,null))[_0x4315('0x16')](function(_0x51c273){if(_0x51c273){return db['VoiceExtension'][_0x4315('0x4d')](_[_0x4315('0x34')](_0xe8983f[_0x4315('0x42')],[_0x4315('0x45'),_0x4315('0x4e'),'description',_0x4315('0x4f'),_0x4315('0x50'),_0x4315('0x51'),_0x4315('0x52')]),{'where':{'context':_0x51c273['context'],'exten':_0x51c273[_0x4315('0x45')]},'individualHooks':!![]})[_0x4315('0x16')](function(_0x2d2757){return _0x2d2757;});}return null;})[_0x4315('0x16')](respondWithStatusCode(_0x30d101,null))[_0x4315('0x3c')](handleError(_0x30d101,null));};exports[_0x4315('0x53')]=function(_0x4629bd,_0x12c6c3){var _0x4fa3d1=_0x4629bd[_0x4315('0x40')]['id'];var _0x3be75e=_0x4629bd['body'];var _0x2c4ebd=0xc8;var _0x3ad4b1=null;return db[_0x4315('0x54')]['transaction']({'isolationLevel':db['sequelize'][_0x4315('0x55')][_0x4315('0x56')][_0x4315('0x57')]},function(_0x170809){return db['VoiceExtension'][_0x4315('0x58')]({'where':{'id':_0x4fa3d1},'transaction':_0x170809})[_0x4315('0x16')](function(_0x440f4e){if(_0x440f4e){return db[_0x4315('0x25')][_0x4315('0x15')]({'where':{'VoiceExtensionId':_0x4fa3d1},'transaction':_0x170809})[_0x4315('0x16')](function(){var _0x1c5f38=_[_0x4315('0x1d')](_0x3be75e,function(_0x78d0a5){_0x78d0a5[_0x4315('0x59')]=_0x4fa3d1;_0x78d0a5[_0x4315('0x5a')]=!![];return _0x78d0a5;});return _0x440f4e[_0x4315('0x5b')](_0x1c5f38);})[_0x4315('0x16')](function(_0x50d7cd){return db['VoiceExtension'][_0x4315('0x5c')](_0x50d7cd,{'transaction':_0x170809});});}else{_0x2c4ebd=0x194;_0x3ad4b1=[];}});})[_0x4315('0x16')](function(){if(_0x2c4ebd!==0x194){return db[_0x4315('0x25')][_0x4315('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4fa3d1},'order':'cast(priority\x20as\x20unsigned)'})[_0x4315('0x16')](function(_0x31ad9b){_0x3ad4b1=_0x31ad9b;});}})[_0x4315('0x3c')](function(_0x3b3737){_0x2c4ebd=0x1f4;logger[_0x4315('0x21')](_0x3b3737['stack']);if(_0x3b3737['name']){delete _0x3b3737['name'];}_0x3ad4b1=_0x3b3737;})['finally'](function(){if(_0x3ad4b1===null){_0x12c6c3['sendStatus'](_0x2c4ebd);}else{if(_0x2c4ebd===0x1f4){_0x12c6c3[_0x4315('0xd')](_0x2c4ebd)[_0x4315('0x24')](_0x3ad4b1);}else{_0x12c6c3[_0x4315('0xd')](_0x2c4ebd)['json'](_0x3ad4b1);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index a9102dc..e9fc1c3 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 _0xee9d=['setMaxListeners','save','remove','emit','../../mysqldb','VoiceExtension'];(function(_0x45faf7,_0x51be37){var _0x4ff9ed=function(_0x4b1298){while(--_0x4b1298){_0x45faf7['push'](_0x45faf7['shift']());}};_0x4ff9ed(++_0x51be37);}(_0xee9d,0x1b4));var _0xdee9=function(_0x4c692c,_0x4652f8){_0x4c692c=_0x4c692c-0x0;var _0x8cd61a=_0xee9d[_0x4c692c];return _0x8cd61a;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xdee9('0x0'))['db'][_0xdee9('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xdee9('0x2')](0x0);var events={'afterCreate':_0xdee9('0x3'),'afterUpdate':'update','afterDestroy':_0xdee9('0x4')};function emitEvent(_0x1e0e0b){return function(_0x4e949b,_0x303279,_0x350dec){VoiceExtensionEvents[_0xdee9('0x5')](_0x1e0e0b+':'+_0x4e949b['id'],_0x4e949b);VoiceExtensionEvents[_0xdee9('0x5')](_0x1e0e0b,_0x4e949b);_0x350dec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xc990=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','save','update','remove','emit'];(function(_0x386af8,_0x377b3e){var _0x16ca73=function(_0x5bddeb){while(--_0x5bddeb){_0x386af8['push'](_0x386af8['shift']());}};_0x16ca73(++_0x377b3e);}(_0xc990,0x1a7));var _0x0c99=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xc990[_0x279d37];return _0x530173;};'use strict';var EventEmitter=require(_0x0c99('0x0'));var VoiceExtension=require(_0x0c99('0x1'))['db'][_0x0c99('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0c99('0x3'),'afterUpdate':_0x0c99('0x4'),'afterDestroy':_0x0c99('0x5')};function emitEvent(_0x484e73){return function(_0x8c77d9,_0x1a776f,_0x5b18b8){VoiceExtensionEvents[_0x0c99('0x6')](_0x484e73+':'+_0x8c77d9['id'],_0x8c77d9);VoiceExtensionEvents['emit'](_0x484e73,_0x8c77d9);_0x5b18b8(null);};}for(var e in events){if(events[_0x0c99('0x7')](e)){var event=events[e];VoiceExtension[_0x0c99('0x8')](e,emitEvent(event));}}module[_0x0c99('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 fcb97dd..7ceeef1 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 _0xe117=['_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','timeout','options','url','split','length','name','trunk','param','phone','prefix','${EXTEN}','SIP','none','indexOf','U(xcally-mixmonitor-context)','replace','join','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','queue','playback','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','appType','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','CDR(type)=','type','context','exten','inbound','push','Set','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat'];(function(_0x3292ad,_0x193d81){var _0x28baa4=function(_0x2dd974){while(--_0x2dd974){_0x3292ad['push'](_0x3292ad['shift']());}};_0x28baa4(++_0x193d81);}(_0xe117,0x172));var _0x7e11=function(_0x4a5b98,_0x18ae0b){_0x4a5b98=_0x4a5b98-0x0;var _0x35d4e8=_0xe117[_0x4a5b98];return _0x35d4e8;};'use strict';var _=require(_0x7e11('0x0'));var attributes=require(_0x7e11('0x1'));module['exports']=function(_0xe33eeb){var _0x45ae1c=_0xe33eeb['models'];function _0x163fea(_0x132ea3){var _0x26593e=0x2;var _0x544be6=[{'type':_0x132ea3['type'],'app':'Set','appdata':_0x7e11('0x2')+_0x132ea3[_0x7e11('0x3')],'context':_0x132ea3[_0x7e11('0x4')],'exten':_0x132ea3[_0x7e11('0x5')],'priority':_0x26593e++,'VoiceExtensionId':_0x132ea3['id']}];if(_0x132ea3[_0x7e11('0x3')]===_0x7e11('0x6')){_0x544be6[_0x7e11('0x7')]({'type':_0x7e11('0x6'),'app':_0x7e11('0x8'),'appdata':_0x7e11('0x9')+_0x132ea3['id'],'context':_0x132ea3['context'],'exten':_0x132ea3[_0x7e11('0x5')],'priority':_0x26593e++,'VoiceExtensionId':_0x132ea3['id']});}_0x544be6['push']({'type':_0x132ea3['type'],'app':'Set','appdata':_0x7e11('0xa'),'context':_0x132ea3['context'],'exten':_0x132ea3[_0x7e11('0x5')],'priority':_0x26593e++,'VoiceExtensionId':_0x132ea3['id']},{'type':_0x132ea3['type'],'app':'Set','appdata':_0x7e11('0xb'),'context':_0x132ea3[_0x7e11('0x4')],'exten':_0x132ea3['exten'],'priority':_0x26593e++,'VoiceExtensionId':_0x132ea3['id']},{'type':_0x132ea3[_0x7e11('0x3')],'app':_0x7e11('0x8'),'appdata':_0x7e11('0xc'),'context':_0x132ea3[_0x7e11('0x4')],'exten':_0x132ea3[_0x7e11('0x5')],'priority':_0x26593e++,'VoiceExtensionId':_0x132ea3['id']});return _0x544be6;}function _0x50ae56(_0x1d0731){var _0x4ca4c3=0x2;var _0x4c015f=[{'type':_0x7e11('0xd'),'app':_0x7e11('0x8'),'appdata':_0x7e11('0xe'),'context':_0x1d0731[_0x7e11('0x4')],'exten':_0x1d0731[_0x7e11('0x5')],'priority':_0x4ca4c3++,'VoiceExtensionId':_0x1d0731['id']},{'type':_0x7e11('0xd'),'app':_0x7e11('0x8'),'appdata':_0x7e11('0xf')+(_0x1d0731[_0x7e11('0x10')]?_0x7e11('0x11')+_0x1d0731[_0x7e11('0x10')]+'}':'${EXTEN}'),'context':_0x1d0731['context'],'exten':_0x1d0731[_0x7e11('0x5')],'priority':_0x4ca4c3++,'VoiceExtensionId':_0x1d0731['id']},{'type':_0x7e11('0xd'),'app':_0x7e11('0x8'),'appdata':_0x7e11('0x9')+_0x1d0731['id'],'context':_0x1d0731[_0x7e11('0x4')],'exten':_0x1d0731['exten'],'priority':_0x4ca4c3++,'VoiceExtensionId':_0x1d0731['id']},{'type':_0x7e11('0xd'),'app':_0x7e11('0x12'),'appdata':_0x7e11('0x13')+(_0x4ca4c3+0x2)+_0x7e11('0x14')+(_0x4ca4c3+0x1)+')','context':_0x1d0731[_0x7e11('0x4')],'exten':_0x1d0731['exten'],'priority':_0x4ca4c3++,'VoiceExtensionId':_0x1d0731['id']},{'type':_0x7e11('0xd'),'app':_0x7e11('0x8'),'appdata':_0x1d0731[_0x7e11('0x10')]?_0x7e11('0x15')+_0x1d0731['cutdigits']+'}':_0x7e11('0x16'),'context':_0x1d0731['context'],'exten':_0x1d0731[_0x7e11('0x5')],'priority':_0x4ca4c3++,'VoiceExtensionId':_0x1d0731['id']},{'type':'outbound','app':_0x7e11('0x8'),'appdata':_0x7e11('0xa'),'context':_0x1d0731[_0x7e11('0x4')],'exten':_0x1d0731[_0x7e11('0x5')],'priority':_0x4ca4c3++,'VoiceExtensionId':_0x1d0731['id']},{'type':_0x7e11('0xd'),'app':'Set','appdata':_0x7e11('0xb'),'context':_0x1d0731[_0x7e11('0x4')],'exten':_0x1d0731[_0x7e11('0x5')],'priority':_0x4ca4c3++,'VoiceExtensionId':_0x1d0731['id']},{'type':'outbound','app':_0x7e11('0x8'),'appdata':_0x7e11('0xc'),'context':_0x1d0731[_0x7e11('0x4')],'exten':_0x1d0731['exten'],'priority':_0x4ca4c3++,'VoiceExtensionId':_0x1d0731['id']},{'type':_0x7e11('0xd'),'app':_0x7e11('0x8'),'appdata':_0x7e11('0x17')+_0x1d0731['id'],'context':_0x1d0731['context'],'exten':_0x1d0731[_0x7e11('0x5')],'priority':_0x4ca4c3++,'VoiceExtensionId':_0x1d0731['id']}];if(_0x1d0731['hasOwnProperty'](_0x7e11('0x18'))&&_0x1d0731['recordingFormat']!=='none'){_0x4c015f[_0x7e11('0x7')]({'type':_0x7e11('0xd'),'app':_0x7e11('0x8'),'appdata':_0x7e11('0x19'),'context':_0x1d0731['context'],'exten':_0x1d0731[_0x7e11('0x5')],'priority':_0x4ca4c3++,'VoiceExtensionId':_0x1d0731['id']},{'type':'outbound','app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x1d0731[_0x7e11('0x18')]||_0x7e11('0x1a'),'context':_0x1d0731[_0x7e11('0x4')],'exten':_0x1d0731[_0x7e11('0x5')],'priority':_0x4ca4c3++,'VoiceExtensionId':_0x1d0731['id']});}return _0x4c015f;}function _0x3354b0(_0x2abb4d,_0x5b6405){var _0x285c32=[{'name':'trunk','param':0x0},{'name':_0x7e11('0x1b'),'param':0x1},{'name':_0x7e11('0x1c'),'param':0x2},{'name':_0x7e11('0x1d'),'param':0x3}];var _0x20db03={};var _0x5c4488=_0x5b6405[_0x7e11('0x1e')](',');var _0x1de69f=[];for(var _0x468958=0x0;_0x468958<_0x285c32[_0x7e11('0x1f')];_0x468958++){switch(_0x285c32[_0x468958][_0x7e11('0x20')]){case _0x7e11('0x21'):_0x20db03[_0x7e11('0x21')]=_0x5c4488[_0x285c32[_0x468958][_0x7e11('0x22')]][_0x7e11('0x1e')]('/')[0x1];_0x20db03[_0x7e11('0x23')]=_0x5c4488[_0x285c32[_0x468958]['param']][_0x7e11('0x1e')]('/')[0x2];_0x20db03[_0x7e11('0x24')]=_0x20db03[_0x7e11('0x23')]?_0x20db03[_0x7e11('0x23')][_0x7e11('0x1e')]('$')[0x0]:undefined;_0x20db03[_0x7e11('0x23')]=_0x2abb4d['cutdigits']?(_0x20db03[_0x7e11('0x24')]||'')+_0x7e11('0x11')+_0x2abb4d[_0x7e11('0x10')]+'}':(_0x20db03[_0x7e11('0x24')]||'')+_0x7e11('0x25');_0x1de69f[_0x285c32[_0x468958][_0x7e11('0x22')]]=[_0x7e11('0x26'),_0x20db03[_0x7e11('0x21')],_0x20db03['phone']]['join']('/');break;case'options':_0x20db03[_0x7e11('0x1c')]=_0x5c4488[_0x285c32[_0x468958][_0x7e11('0x22')]];if(_0x2abb4d['recordingFormat']!==_0x7e11('0x27')){if(_0x20db03[_0x7e11('0x1c')][_0x7e11('0x28')](_0x7e11('0x29'))<0x0){_0x20db03[_0x7e11('0x1c')]+=_0x7e11('0x29');}}else{_0x20db03['options']=_0x20db03[_0x7e11('0x1c')][_0x7e11('0x2a')](_0x7e11('0x29'),'');}_0x1de69f[_0x285c32[_0x468958][_0x7e11('0x22')]]=_0x20db03['options'];break;default:_0x1de69f[_0x285c32[_0x468958]['param']]=_0x5c4488[_0x285c32[_0x468958][_0x7e11('0x22')]];}}return _0x1de69f[_0x7e11('0x2b')](',');}function _0x2406fa(_0xa8ea8,_0x7b2904,_0x4000b8){return new Promise(function(_0x5952e2,_0xee3c8b){var _0x5999f1=[];if(_['isEmpty'](_0x7b2904))return _0x5952e2(_0x5999f1);_0x45ae1c[_0x7e11('0x2c')][_0x7e11('0x2d')]({'attributes':['id',_0x7e11('0x2e'),_0x7e11('0x2f')],'raw':!![]})[_0x7e11('0x30')](function(_0x401617){for(var _0x364438=0x0,_0x422e03=0x0;_0x364438<_0x7b2904['length'];_0x364438++,_0x422e03=0x0){var _0xa9b717=_0x7b2904[_0x364438];var _0x52e95a=[];var _0x2bc1b8=[];delete _0xa9b717['id'];if(_0xa9b717['interval']!==_0x7e11('0x31')){_0xa9b717[_0x7e11('0x32')]=[_0xa9b717['interval']];}else{_0xa9b717[_0x7e11('0x32')]=_0xa9b717[_0x7e11('0x2f')]?_[_0x7e11('0x33')](_[_0x7e11('0x34')](_0x401617,{'IntervalId':_0xa9b717['IntervalId']}),'interval'):[];}_0xa9b717[_0x7e11('0x4')]=_0xa8ea8[_0x7e11('0x4')];_0xa9b717[_0x7e11('0x5')]=_0xa8ea8['exten'];if(_0xa9b717[_0x7e11('0x3')])_0xa9b717[_0x7e11('0x3')]=_0xa9b717[_0x7e11('0x3')][_0x7e11('0x35')]();if(_0xa8ea8[_0x7e11('0x3')]==='outbound'){if(_0xa9b717[_0x7e11('0x36')](_0x7e11('0x37'))&&_0xa9b717[_0x7e11('0x37')]&&_0xa9b717[_0x7e11('0x37')]!=='--'){_0x52e95a[_0x7e11('0x7')]({'type':_0xa9b717[_0x7e11('0x3')][_0x7e11('0x35')](),'app':'Set','appdata':_0x7e11('0x38')+_0xa9b717[_0x7e11('0x37')],'context':_0xa8ea8['context'],'exten':_0xa8ea8[_0x7e11('0x5')],'priority':_0xa9b717[_0x7e11('0x32')]['length']+_0x4000b8+_0x422e03++,'VoiceExtensionId':_0xa8ea8['id']});}_0x52e95a[_0x7e11('0x7')]({'type':_0xa9b717[_0x7e11('0x3')][_0x7e11('0x35')](),'app':'ExecIf','appdata':_0x7e11('0x39')+(_0xa9b717['callerID']?'Set(CALLERID(all)='+_0xa9b717[_0x7e11('0x3a')]+')':_0x7e11('0x3b')),'context':_0xa8ea8['context'],'exten':_0xa8ea8[_0x7e11('0x5')],'priority':_0xa9b717['intervals'][_0x7e11('0x1f')]+_0x4000b8+_0x422e03++,'VoiceExtensionId':_0xa8ea8['id']});}else{if(_0xa9b717['hasOwnProperty']('answer')){if([_0x7e11('0x3c'),_0x7e11('0x3d')]['includes'](_0xa9b717[_0x7e11('0x3e')][_0x7e11('0x35')]())&&_0xa9b717['appType']!=='custom'){if(_0xa9b717['answer']){_0x52e95a['push']({'type':_0xa9b717['type']['toLowerCase'](),'app':_0x7e11('0x12'),'appdata':_0x7e11('0x3f'),'context':_0xa8ea8[_0x7e11('0x4')],'exten':_0xa8ea8['exten'],'priority':_0xa9b717[_0x7e11('0x32')][_0x7e11('0x1f')]+_0x4000b8+_0x422e03++,'VoiceExtensionId':_0xa8ea8['id']});_0x52e95a[_0x7e11('0x7')]({'type':_0xa9b717[_0x7e11('0x3')][_0x7e11('0x35')](),'app':_0x7e11('0x8'),'appdata':_0x7e11('0x40'),'context':_0xa8ea8[_0x7e11('0x4')],'exten':_0xa8ea8[_0x7e11('0x5')],'priority':_0xa9b717['intervals']['length']+_0x4000b8+_0x422e03++,'VoiceExtensionId':_0xa8ea8['id']});}else{_0x52e95a[_0x7e11('0x7')]({'type':_0xa9b717[_0x7e11('0x3')][_0x7e11('0x35')](),'app':_0x7e11('0x12'),'appdata':_0x7e11('0x41'),'context':_0xa8ea8[_0x7e11('0x4')],'exten':_0xa8ea8[_0x7e11('0x5')],'priority':_0xa9b717[_0x7e11('0x32')]['length']+_0x4000b8+_0x422e03++,'VoiceExtensionId':_0xa8ea8['id']});_0x52e95a[_0x7e11('0x7')]({'type':_0xa9b717['type']['toLowerCase'](),'app':_0x7e11('0x8'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0xa8ea8[_0x7e11('0x4')],'exten':_0xa8ea8['exten'],'priority':_0xa9b717[_0x7e11('0x32')][_0x7e11('0x1f')]+_0x4000b8+_0x422e03++,'VoiceExtensionId':_0xa8ea8['id']});}}}}for(var _0x261e38=0x0;_0x261e38<_0xa9b717['intervals'][_0x7e11('0x1f')];_0x261e38++){var _0x36ee18=_0x4000b8+_0xa9b717[_0x7e11('0x32')][_0x7e11('0x1f')];var _0x4f242f=_0x261e38===_0xa9b717[_0x7e11('0x32')][_0x7e11('0x1f')]-0x1?_0x4000b8+_0x52e95a[_0x7e11('0x1f')]+_0x2bc1b8[_0x7e11('0x1f')]+0x2:_0x4000b8+_0x261e38+0x1;_0x52e95a[_0x7e11('0x42')](_0x261e38,0x0,{'type':_0xa8ea8[_0x7e11('0x3')],'app':'GotoIfTime','appdata':_0xa9b717['intervals'][_0x261e38]+'?'+_0xa8ea8[_0x7e11('0x4')]+',${EXTEN},'+_0x36ee18+':'+_0xa8ea8['context']+_0x7e11('0x43')+_0x4f242f,'exten':_0xa8ea8[_0x7e11('0x5')],'context':_0xa8ea8[_0x7e11('0x4')],'priority':_0x4000b8+_0x261e38,'VoiceExtensionId':_0xa8ea8['id']});}if(_0xa9b717[_0x7e11('0x44')]==='outboundDial'){_0xa9b717['appdata']=_0x3354b0(_0xa8ea8,_0xa9b717[_0x7e11('0x45')]);}if(_0xa9b717[_0x7e11('0x44')]===_0x7e11('0x46')){_0x52e95a[_0x7e11('0x7')]({'type':_0xa9b717[_0x7e11('0x3')][_0x7e11('0x35')](),'app':_0x7e11('0x8'),'appdata':_0x7e11('0x47'),'context':_0xa8ea8[_0x7e11('0x4')],'exten':_0xa8ea8[_0x7e11('0x5')],'priority':_0xa9b717[_0x7e11('0x32')]['length']+_0x4000b8+_0x422e03++,'VoiceExtensionId':_0xa8ea8['id']});}_0xa9b717[_0x7e11('0x48')]=_0x52e95a['length']?_[_0x7e11('0x49')](_0x52e95a)['priority']+0x1:_0x4000b8;_0x5999f1=_[_0x7e11('0x4a')](_0x5999f1,_0x52e95a,[_0xa9b717],_0x2bc1b8);_0x4000b8=_[_0x7e11('0x49')](_0x5999f1)['priority']+0x1;}return _0x5952e2(_0x5999f1);})['catch'](function(_0x12c667){_0xee3c8b(_0x12c667);});});}return _0xe33eeb['define'](_0x7e11('0x4b'),attributes,{'tableName':_0x7e11('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x212fa3){var _0x29558f=this[_0x7e11('0x4d')]({'plain':!![]});var _0x26bf3a=_0x29558f['type']===_0x7e11('0xd')?_0x50ae56(_0x29558f):_0x163fea(_0x29558f);return _0x2406fa(_0x29558f,_0x212fa3,_['last'](_0x26bf3a)['priority']+0x1)[_0x7e11('0x30')](function(_0x2943c8){var _0x5a4d3c=_[_0x7e11('0x4a')](_0x26bf3a,_0x2943c8);_0x5a4d3c[_0x7e11('0x7')]({'type':_0x29558f[_0x7e11('0x3')],'app':_0x7e11('0x4e'),'exten':_0x29558f[_0x7e11('0x5')],'context':_0x29558f[_0x7e11('0x4')],'priority':_[_0x7e11('0x49')](_0x5a4d3c)[_0x7e11('0x48')]+0x1,'VoiceExtensionId':_0x29558f['id']});return _0x5a4d3c;});}}});}; \ No newline at end of file +var _0xcbc2=['$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','url','split','name','param','prefix','phone','join','options','indexOf','U(xcally-mixmonitor-context)','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','filter','toLowerCase','tag','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','queue','playback','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','./voiceExtension.attributes','exports','models','CDR(type)=','type','context','exten','inbound','CDR(routeid)=','push','Set','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xcbc2,0x180));var _0x2cbc=function(_0x27250c,_0x3e6637){_0x27250c=_0x27250c-0x0;var _0x7e3095=_0xcbc2[_0x27250c];return _0x7e3095;};'use strict';var _=require('lodash');var attributes=require(_0x2cbc('0x0'));module[_0x2cbc('0x1')]=function(_0x15b07a){var _0x5b3115=_0x15b07a[_0x2cbc('0x2')];function _0x595fa6(_0x3f7bc3){var _0x2638ff=0x2;var _0x17d2a3=[{'type':_0x3f7bc3['type'],'app':'Set','appdata':_0x2cbc('0x3')+_0x3f7bc3[_0x2cbc('0x4')],'context':_0x3f7bc3[_0x2cbc('0x5')],'exten':_0x3f7bc3[_0x2cbc('0x6')],'priority':_0x2638ff++,'VoiceExtensionId':_0x3f7bc3['id']}];if(_0x3f7bc3[_0x2cbc('0x4')]==='inbound'){_0x17d2a3['push']({'type':_0x2cbc('0x7'),'app':'Set','appdata':_0x2cbc('0x8')+_0x3f7bc3['id'],'context':_0x3f7bc3[_0x2cbc('0x5')],'exten':_0x3f7bc3[_0x2cbc('0x6')],'priority':_0x2638ff++,'VoiceExtensionId':_0x3f7bc3['id']});}_0x17d2a3[_0x2cbc('0x9')]({'type':_0x3f7bc3['type'],'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0xb'),'context':_0x3f7bc3['context'],'exten':_0x3f7bc3[_0x2cbc('0x6')],'priority':_0x2638ff++,'VoiceExtensionId':_0x3f7bc3['id']},{'type':_0x3f7bc3[_0x2cbc('0x4')],'app':'Set','appdata':_0x2cbc('0xc'),'context':_0x3f7bc3[_0x2cbc('0x5')],'exten':_0x3f7bc3[_0x2cbc('0x6')],'priority':_0x2638ff++,'VoiceExtensionId':_0x3f7bc3['id']},{'type':_0x3f7bc3[_0x2cbc('0x4')],'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0xd'),'context':_0x3f7bc3[_0x2cbc('0x5')],'exten':_0x3f7bc3[_0x2cbc('0x6')],'priority':_0x2638ff++,'VoiceExtensionId':_0x3f7bc3['id']});return _0x17d2a3;}function _0x98dc6d(_0x260931){var _0xd966af=0x2;var _0x45a3d1=[{'type':_0x2cbc('0xe'),'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0xf'),'context':_0x260931[_0x2cbc('0x5')],'exten':_0x260931[_0x2cbc('0x6')],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':'Set','appdata':_0x2cbc('0x10')+(_0x260931['cutdigits']?_0x2cbc('0x11')+_0x260931[_0x2cbc('0x12')]+'}':_0x2cbc('0x13')),'context':_0x260931['context'],'exten':_0x260931[_0x2cbc('0x6')],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0x8')+_0x260931['id'],'context':_0x260931['context'],'exten':_0x260931[_0x2cbc('0x6')],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':_0x2cbc('0x14'),'appdata':_0x2cbc('0x15')+(_0xd966af+0x2)+_0x2cbc('0x16')+(_0xd966af+0x1)+')','context':_0x260931['context'],'exten':_0x260931[_0x2cbc('0x6')],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':'Set','appdata':_0x260931[_0x2cbc('0x12')]?_0x2cbc('0x17')+_0x260931['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x260931[_0x2cbc('0x5')],'exten':_0x260931[_0x2cbc('0x6')],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':'Set','appdata':_0x2cbc('0xb'),'context':_0x260931[_0x2cbc('0x5')],'exten':_0x260931['exten'],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':_0x2cbc('0xa'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x260931['context'],'exten':_0x260931['exten'],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0xd'),'context':_0x260931[_0x2cbc('0x5')],'exten':_0x260931[_0x2cbc('0x6')],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0x18')+_0x260931['id'],'context':_0x260931[_0x2cbc('0x5')],'exten':_0x260931[_0x2cbc('0x6')],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']}];if(_0x260931[_0x2cbc('0x19')](_0x2cbc('0x1a'))&&_0x260931['recordingFormat']!==_0x2cbc('0x1b')){_0x45a3d1[_0x2cbc('0x9')]({'type':_0x2cbc('0xe'),'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0x1c'),'context':_0x260931[_0x2cbc('0x5')],'exten':_0x260931[_0x2cbc('0x6')],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']},{'type':_0x2cbc('0xe'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x260931[_0x2cbc('0x1a')]||_0x2cbc('0x1d'),'context':_0x260931['context'],'exten':_0x260931['exten'],'priority':_0xd966af++,'VoiceExtensionId':_0x260931['id']});}return _0x45a3d1;}function _0x1c57c9(_0x58ec13,_0x795f86){var _0x1ae3f2=[{'name':_0x2cbc('0x1e'),'param':0x0},{'name':_0x2cbc('0x1f'),'param':0x1},{'name':'options','param':0x2},{'name':_0x2cbc('0x20'),'param':0x3}];var _0x2edf1f={};var _0x23a476=_0x795f86[_0x2cbc('0x21')](',');var _0x518abf=[];for(var _0x31dbf2=0x0;_0x31dbf2<_0x1ae3f2['length'];_0x31dbf2++){switch(_0x1ae3f2[_0x31dbf2][_0x2cbc('0x22')]){case'trunk':_0x2edf1f[_0x2cbc('0x1e')]=_0x23a476[_0x1ae3f2[_0x31dbf2][_0x2cbc('0x23')]]['split']('/')[0x1];_0x2edf1f['phone']=_0x23a476[_0x1ae3f2[_0x31dbf2]['param']][_0x2cbc('0x21')]('/')[0x2];_0x2edf1f[_0x2cbc('0x24')]=_0x2edf1f[_0x2cbc('0x25')]?_0x2edf1f[_0x2cbc('0x25')][_0x2cbc('0x21')]('$')[0x0]:undefined;_0x2edf1f[_0x2cbc('0x25')]=_0x58ec13['cutdigits']?(_0x2edf1f[_0x2cbc('0x24')]||'')+_0x2cbc('0x11')+_0x58ec13[_0x2cbc('0x12')]+'}':(_0x2edf1f[_0x2cbc('0x24')]||'')+_0x2cbc('0x13');_0x518abf[_0x1ae3f2[_0x31dbf2][_0x2cbc('0x23')]]=['SIP',_0x2edf1f[_0x2cbc('0x1e')],_0x2edf1f[_0x2cbc('0x25')]][_0x2cbc('0x26')]('/');break;case _0x2cbc('0x27'):_0x2edf1f['options']=_0x23a476[_0x1ae3f2[_0x31dbf2]['param']];if(_0x58ec13[_0x2cbc('0x1a')]!==_0x2cbc('0x1b')){if(_0x2edf1f[_0x2cbc('0x27')][_0x2cbc('0x28')]('U(xcally-mixmonitor-context)')<0x0){_0x2edf1f[_0x2cbc('0x27')]+=_0x2cbc('0x29');}}else{_0x2edf1f['options']=_0x2edf1f['options']['replace'](_0x2cbc('0x29'),'');}_0x518abf[_0x1ae3f2[_0x31dbf2][_0x2cbc('0x23')]]=_0x2edf1f['options'];break;default:_0x518abf[_0x1ae3f2[_0x31dbf2][_0x2cbc('0x23')]]=_0x23a476[_0x1ae3f2[_0x31dbf2][_0x2cbc('0x23')]];}}return _0x518abf[_0x2cbc('0x26')](',');}function _0x24cb59(_0x54ed5d,_0xeea3b1,_0x3f8228){return new Promise(function(_0x3a567f,_0x1d580e){var _0x2c6ff6=[];if(_['isEmpty'](_0xeea3b1))return _0x3a567f(_0x2c6ff6);_0x5b3115[_0x2cbc('0x2a')][_0x2cbc('0x2b')]({'attributes':['id',_0x2cbc('0x2c'),_0x2cbc('0x2d')],'raw':!![]})[_0x2cbc('0x2e')](function(_0x26bc8c){for(var _0x5f0471=0x0,_0xe99f84=0x0;_0x5f0471<_0xeea3b1[_0x2cbc('0x2f')];_0x5f0471++,_0xe99f84=0x0){var _0x3ab0cc=_0xeea3b1[_0x5f0471];var _0xead560=[];var _0x2b0d63=[];delete _0x3ab0cc['id'];if(_0x3ab0cc['interval']!==_0x2cbc('0x30')){_0x3ab0cc[_0x2cbc('0x31')]=[_0x3ab0cc['interval']];}else{_0x3ab0cc[_0x2cbc('0x31')]=_0x3ab0cc['IntervalId']?_[_0x2cbc('0x32')](_[_0x2cbc('0x33')](_0x26bc8c,{'IntervalId':_0x3ab0cc[_0x2cbc('0x2d')]}),'interval'):[];}_0x3ab0cc[_0x2cbc('0x5')]=_0x54ed5d[_0x2cbc('0x5')];_0x3ab0cc[_0x2cbc('0x6')]=_0x54ed5d[_0x2cbc('0x6')];if(_0x3ab0cc[_0x2cbc('0x4')])_0x3ab0cc[_0x2cbc('0x4')]=_0x3ab0cc['type'][_0x2cbc('0x34')]();if(_0x54ed5d['type']==='outbound'){if(_0x3ab0cc['hasOwnProperty'](_0x2cbc('0x35'))&&_0x3ab0cc[_0x2cbc('0x35')]&&_0x3ab0cc['tag']!=='--'){_0xead560[_0x2cbc('0x9')]({'type':_0x3ab0cc['type'][_0x2cbc('0x34')](),'app':'Set','appdata':'CDR(tag)='+_0x3ab0cc['tag'],'context':_0x54ed5d['context'],'exten':_0x54ed5d[_0x2cbc('0x6')],'priority':_0x3ab0cc[_0x2cbc('0x31')][_0x2cbc('0x2f')]+_0x3f8228+_0xe99f84++,'VoiceExtensionId':_0x54ed5d['id']});}_0xead560['push']({'type':_0x3ab0cc[_0x2cbc('0x4')][_0x2cbc('0x34')](),'app':_0x2cbc('0x14'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x3ab0cc['callerID']?_0x2cbc('0x36')+_0x3ab0cc[_0x2cbc('0x37')]+')':_0x2cbc('0x38')),'context':_0x54ed5d[_0x2cbc('0x5')],'exten':_0x54ed5d['exten'],'priority':_0x3ab0cc[_0x2cbc('0x31')]['length']+_0x3f8228+_0xe99f84++,'VoiceExtensionId':_0x54ed5d['id']});}else{if(_0x3ab0cc[_0x2cbc('0x19')]('answer')){if([_0x2cbc('0x39'),_0x2cbc('0x3a')][_0x2cbc('0x3b')](_0x3ab0cc[_0x2cbc('0x3c')]['toLowerCase']())&&_0x3ab0cc[_0x2cbc('0x3d')]!==_0x2cbc('0x3e')){if(_0x3ab0cc['answer']){_0xead560[_0x2cbc('0x9')]({'type':_0x3ab0cc[_0x2cbc('0x4')][_0x2cbc('0x34')](),'app':_0x2cbc('0x14'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x54ed5d[_0x2cbc('0x5')],'exten':_0x54ed5d[_0x2cbc('0x6')],'priority':_0x3ab0cc[_0x2cbc('0x31')][_0x2cbc('0x2f')]+_0x3f8228+_0xe99f84++,'VoiceExtensionId':_0x54ed5d['id']});_0xead560[_0x2cbc('0x9')]({'type':_0x3ab0cc[_0x2cbc('0x4')][_0x2cbc('0x34')](),'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0x3f'),'context':_0x54ed5d['context'],'exten':_0x54ed5d['exten'],'priority':_0x3ab0cc[_0x2cbc('0x31')][_0x2cbc('0x2f')]+_0x3f8228+_0xe99f84++,'VoiceExtensionId':_0x54ed5d['id']});}else{_0xead560[_0x2cbc('0x9')]({'type':_0x3ab0cc[_0x2cbc('0x4')][_0x2cbc('0x34')](),'app':_0x2cbc('0x14'),'appdata':_0x2cbc('0x40'),'context':_0x54ed5d['context'],'exten':_0x54ed5d[_0x2cbc('0x6')],'priority':_0x3ab0cc['intervals'][_0x2cbc('0x2f')]+_0x3f8228+_0xe99f84++,'VoiceExtensionId':_0x54ed5d['id']});_0xead560[_0x2cbc('0x9')]({'type':_0x3ab0cc[_0x2cbc('0x4')][_0x2cbc('0x34')](),'app':_0x2cbc('0xa'),'appdata':_0x2cbc('0x41'),'context':_0x54ed5d[_0x2cbc('0x5')],'exten':_0x54ed5d[_0x2cbc('0x6')],'priority':_0x3ab0cc[_0x2cbc('0x31')]['length']+_0x3f8228+_0xe99f84++,'VoiceExtensionId':_0x54ed5d['id']});}}}}for(var _0x283630=0x0;_0x283630<_0x3ab0cc[_0x2cbc('0x31')][_0x2cbc('0x2f')];_0x283630++){var _0x49d5a7=_0x3f8228+_0x3ab0cc[_0x2cbc('0x31')][_0x2cbc('0x2f')];var _0x544c66=_0x283630===_0x3ab0cc[_0x2cbc('0x31')][_0x2cbc('0x2f')]-0x1?_0x3f8228+_0xead560['length']+_0x2b0d63['length']+0x2:_0x3f8228+_0x283630+0x1;_0xead560[_0x2cbc('0x42')](_0x283630,0x0,{'type':_0x54ed5d[_0x2cbc('0x4')],'app':_0x2cbc('0x43'),'appdata':_0x3ab0cc['intervals'][_0x283630]+'?'+_0x54ed5d['context']+_0x2cbc('0x44')+_0x49d5a7+':'+_0x54ed5d['context']+',${EXTEN},'+_0x544c66,'exten':_0x54ed5d['exten'],'context':_0x54ed5d[_0x2cbc('0x5')],'priority':_0x3f8228+_0x283630,'VoiceExtensionId':_0x54ed5d['id']});}if(_0x3ab0cc['appType']===_0x2cbc('0x45')){_0x3ab0cc[_0x2cbc('0x46')]=_0x1c57c9(_0x54ed5d,_0x3ab0cc[_0x2cbc('0x46')]);}if(_0x3ab0cc[_0x2cbc('0x3d')]==='agi'){_0xead560[_0x2cbc('0x9')]({'type':_0x3ab0cc[_0x2cbc('0x4')][_0x2cbc('0x34')](),'app':'Set','appdata':_0x2cbc('0x47'),'context':_0x54ed5d[_0x2cbc('0x5')],'exten':_0x54ed5d[_0x2cbc('0x6')],'priority':_0x3ab0cc['intervals'][_0x2cbc('0x2f')]+_0x3f8228+_0xe99f84++,'VoiceExtensionId':_0x54ed5d['id']});}_0x3ab0cc[_0x2cbc('0x48')]=_0xead560[_0x2cbc('0x2f')]?_[_0x2cbc('0x49')](_0xead560)[_0x2cbc('0x48')]+0x1:_0x3f8228;_0x2c6ff6=_[_0x2cbc('0x4a')](_0x2c6ff6,_0xead560,[_0x3ab0cc],_0x2b0d63);_0x3f8228=_[_0x2cbc('0x49')](_0x2c6ff6)[_0x2cbc('0x48')]+0x1;}return _0x3a567f(_0x2c6ff6);})[_0x2cbc('0x4b')](function(_0x176e8c){_0x1d580e(_0x176e8c);});});}return _0x15b07a[_0x2cbc('0x4c')](_0x2cbc('0x4d'),attributes,{'tableName':_0x2cbc('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1560e6){var _0x40de64=this[_0x2cbc('0x4f')]({'plain':!![]});var _0x41797c=_0x40de64['type']==='outbound'?_0x98dc6d(_0x40de64):_0x595fa6(_0x40de64);return _0x24cb59(_0x40de64,_0x1560e6,_[_0x2cbc('0x49')](_0x41797c)['priority']+0x1)[_0x2cbc('0x2e')](function(_0x41716b){var _0x3befeb=_[_0x2cbc('0x4a')](_0x41797c,_0x41716b);_0x3befeb[_0x2cbc('0x9')]({'type':_0x40de64[_0x2cbc('0x4')],'app':_0x2cbc('0x50'),'exten':_0x40de64['exten'],'context':_0x40de64[_0x2cbc('0x5')],'priority':_['last'](_0x3befeb)[_0x2cbc('0x48')]+0x1,'VoiceExtensionId':_0x40de64['id']});return _0x3befeb;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 8c47dbb..f9b3692 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 _0x1bce=['map','model','GetVoiceExtension','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','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','code','error','message','result','catch','VoiceExtension','options','attributes','limit','include'];(function(_0xf0330b,_0x814253){var _0x538518=function(_0x9c7d43){while(--_0x9c7d43){_0xf0330b['push'](_0xf0330b['shift']());}};_0x538518(++_0x814253);}(_0x1bce,0x73));var _0xe1bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1bce[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe1bc('0x0'));var util=require(_0xe1bc('0x1'));var moment=require('moment');var BPromise=require(_0xe1bc('0x2'));var rs=require(_0xe1bc('0x3'));var fs=require('fs');var Redis=require(_0xe1bc('0x4'));var db=require(_0xe1bc('0x5'))['db'];var utils=require(_0xe1bc('0x6'));var logger=require(_0xe1bc('0x7'))(_0xe1bc('0x8'));var config=require(_0xe1bc('0x9'));var jayson=require(_0xe1bc('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xe1bc('0xb')]=_[_0xe1bc('0xc')](config[_0xe1bc('0xb')],{'host':_0xe1bc('0xd'),'port':0x18eb});var socket=require(_0xe1bc('0xe'))(new Redis(config[_0xe1bc('0xb')]));require('./voiceExtension.socket')[_0xe1bc('0xf')](socket);function respondWithRpcPromise(_0x5718a3,_0x191147,_0x355757){return new BPromise(function(_0x43e2b8,_0x55f429){return client[_0xe1bc('0x10')](_0x5718a3,_0x355757)[_0xe1bc('0x11')](function(_0x5239e0){logger[_0xe1bc('0x12')](_0xe1bc('0x13'),_0x191147,'request\x20sent');logger['debug'](_0xe1bc('0x14'),_0x191147,_0xe1bc('0x15'),JSON[_0xe1bc('0x16')](_0x5239e0));if(_0x5239e0['error']){if(_0x5239e0['error'][_0xe1bc('0x17')]===0x1f4){logger[_0xe1bc('0x18')](_0xe1bc('0x13'),_0x191147,_0x5239e0['error'][_0xe1bc('0x19')]);return _0x55f429(_0x5239e0[_0xe1bc('0x18')][_0xe1bc('0x19')]);}logger[_0xe1bc('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x191147,_0x5239e0[_0xe1bc('0x18')]['message']);return _0x43e2b8(_0x5239e0[_0xe1bc('0x18')][_0xe1bc('0x19')]);}else{logger['info'](_0xe1bc('0x13'),_0x191147,_0xe1bc('0x15'));_0x43e2b8(_0x5239e0[_0xe1bc('0x1a')][_0xe1bc('0x19')]);}})[_0xe1bc('0x1b')](function(_0x47620e){logger['error'](_0xe1bc('0x13'),_0x191147,_0x47620e);_0x55f429(_0x47620e);});});}exports['GetVoiceExtension']=function(_0x6fbd46){var _0x25c548=this;return new Promise(function(_0x417a37,_0x1d222c){return db[_0xe1bc('0x1c')]['findAll']({'raw':_0x6fbd46[_0xe1bc('0x1d')]?_0x6fbd46['options']['raw']===undefined?!![]:![]:!![],'where':_0x6fbd46[_0xe1bc('0x1d')]?_0x6fbd46[_0xe1bc('0x1d')]['where']||null:null,'attributes':_0x6fbd46['options']?_0x6fbd46[_0xe1bc('0x1d')][_0xe1bc('0x1e')]||null:null,'limit':_0x6fbd46[_0xe1bc('0x1d')]?_0x6fbd46[_0xe1bc('0x1d')][_0xe1bc('0x1f')]||null:null,'include':_0x6fbd46[_0xe1bc('0x1d')]?_0x6fbd46[_0xe1bc('0x1d')][_0xe1bc('0x20')]?_[_0xe1bc('0x21')](_0x6fbd46[_0xe1bc('0x1d')][_0xe1bc('0x20')],function(_0x3d1946){return{'model':db[_0x3d1946[_0xe1bc('0x22')]],'as':_0x3d1946['as'],'attributes':_0x3d1946['attributes'],'include':_0x3d1946['include']?_[_0xe1bc('0x21')](_0x3d1946['include'],function(_0x43527d){return{'model':db[_0x43527d['model']],'as':_0x43527d['as'],'attributes':_0x43527d[_0xe1bc('0x1e')],'include':_0x43527d['include']?_['map'](_0x43527d[_0xe1bc('0x20')],function(_0x3958a4){return{'model':db[_0x3958a4['model']],'as':_0x3958a4['as'],'attributes':_0x3958a4['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1bc('0x11')](function(_0x23caa1){logger[_0xe1bc('0x12')](_0xe1bc('0x23'),_0x6fbd46);logger[_0xe1bc('0x24')](_0xe1bc('0x23'),_0x6fbd46,JSON[_0xe1bc('0x16')](_0x23caa1));_0x417a37(_0x23caa1);})[_0xe1bc('0x1b')](function(_0x32bedb){logger['error'](_0xe1bc('0x23'),_0x32bedb[_0xe1bc('0x19')],_0x6fbd46);_0x1d222c(_0x25c548[_0xe1bc('0x18')](0x1f4,_0x32bedb['message']));});});}; \ No newline at end of file +var _0x0024=['error','code','message','info','GetVoiceExtension','findAll','options','raw','attributes','limit','include','model','then','util','bluebird','ioredis','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0024,0xa8));var _0x4002=function(_0x5c0746,_0x2d4e25){_0x5c0746=_0x5c0746-0x0;var _0x73e33a=_0x0024[_0x5c0746];return _0x73e33a;};'use strict';var _=require('lodash');var util=require(_0x4002('0x0'));var moment=require('moment');var BPromise=require(_0x4002('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4002('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4002('0x3'))(_0x4002('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4002('0x5')][_0x4002('0x6')]({'port':0x232a});config[_0x4002('0x7')]=_[_0x4002('0x8')](config['redis'],{'host':_0x4002('0x9'),'port':0x18eb});var socket=require(_0x4002('0xa'))(new Redis(config[_0x4002('0x7')]));require(_0x4002('0xb'))['register'](socket);function respondWithRpcPromise(_0x5f32c7,_0x21c971,_0x26fd5d){return new BPromise(function(_0x397864,_0x12c368){return client[_0x4002('0xc')](_0x5f32c7,_0x26fd5d)['then'](function(_0x53c0ef){logger['info'](_0x4002('0xd'),_0x21c971,_0x4002('0xe'));logger[_0x4002('0xf')](_0x4002('0x10'),_0x21c971,'request\x20sent',JSON[_0x4002('0x11')](_0x53c0ef));if(_0x53c0ef[_0x4002('0x12')]){if(_0x53c0ef[_0x4002('0x12')][_0x4002('0x13')]===0x1f4){logger[_0x4002('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x21c971,_0x53c0ef[_0x4002('0x12')]['message']);return _0x12c368(_0x53c0ef[_0x4002('0x12')][_0x4002('0x14')]);}logger[_0x4002('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x21c971,_0x53c0ef[_0x4002('0x12')]['message']);return _0x397864(_0x53c0ef['error'][_0x4002('0x14')]);}else{logger[_0x4002('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x21c971,_0x4002('0xe'));_0x397864(_0x53c0ef['result']['message']);}})['catch'](function(_0x22820f){logger[_0x4002('0x12')](_0x4002('0xd'),_0x21c971,_0x22820f);_0x12c368(_0x22820f);});});}exports[_0x4002('0x16')]=function(_0x514dfe){var _0x3bf83a=this;return new Promise(function(_0x1a5364,_0x172317){return db['VoiceExtension'][_0x4002('0x17')]({'raw':_0x514dfe['options']?_0x514dfe[_0x4002('0x18')][_0x4002('0x19')]===undefined?!![]:![]:!![],'where':_0x514dfe[_0x4002('0x18')]?_0x514dfe['options']['where']||null:null,'attributes':_0x514dfe[_0x4002('0x18')]?_0x514dfe[_0x4002('0x18')][_0x4002('0x1a')]||null:null,'limit':_0x514dfe['options']?_0x514dfe[_0x4002('0x18')][_0x4002('0x1b')]||null:null,'include':_0x514dfe[_0x4002('0x18')]?_0x514dfe[_0x4002('0x18')][_0x4002('0x1c')]?_['map'](_0x514dfe[_0x4002('0x18')][_0x4002('0x1c')],function(_0x385c35){return{'model':db[_0x385c35[_0x4002('0x1d')]],'as':_0x385c35['as'],'attributes':_0x385c35[_0x4002('0x1a')],'include':_0x385c35[_0x4002('0x1c')]?_['map'](_0x385c35[_0x4002('0x1c')],function(_0x2d148e){return{'model':db[_0x2d148e['model']],'as':_0x2d148e['as'],'attributes':_0x2d148e[_0x4002('0x1a')],'include':_0x2d148e[_0x4002('0x1c')]?_['map'](_0x2d148e[_0x4002('0x1c')],function(_0x278907){return{'model':db[_0x278907[_0x4002('0x1d')]],'as':_0x278907['as'],'attributes':_0x278907[_0x4002('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4002('0x1e')](function(_0x37ee79){logger[_0x4002('0x15')]('GetVoiceExtension',_0x514dfe);logger[_0x4002('0xf')](_0x4002('0x16'),_0x514dfe,JSON[_0x4002('0x11')](_0x37ee79));_0x1a5364(_0x37ee79);})['catch'](function(_0x52f488){logger[_0x4002('0x12')](_0x4002('0x16'),_0x52f488[_0x4002('0x14')],_0x514dfe);_0x172317(_0x3bf83a[_0x4002('0x12')](0x1f4,_0x52f488[_0x4002('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index e7d9ee6..7bc82ee 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0x4a6c6d,_0x31f68b){var _0xfc41c5=function(_0x3cf416){while(--_0x3cf416){_0x4a6c6d['push'](_0x4a6c6d['shift']());}};_0xfc41c5(++_0x31f68b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xc4aa[_0x2064e5];return _0x21a233;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x4c4066,_0x5f8ec3){var _0x5e56a5=function(_0x400348){while(--_0x400348){_0x4c4066['push'](_0x4c4066['shift']());}};_0x5e56a5(++_0x5f8ec3);}(_0x7a54,0x106));var _0x47a5=function(_0x549245,_0x416216){_0x549245=_0x549245-0x0;var _0x1a7ca8=_0x7a54[_0x549245];return _0x1a7ca8;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index bb1c8cd..71b0875 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 _0xcaf2=['create','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','/:id','show','/:id/messages','getMessages','post'];(function(_0x117713,_0x1b3f0c){var _0x310d68=function(_0x5c266a){while(--_0x5c266a){_0x117713['push'](_0x117713['shift']());}};_0x310d68(++_0x1b3f0c);}(_0xcaf2,0x8a));var _0x2caf=function(_0x48c998,_0x37d255){_0x48c998=_0x48c998-0x0;var _0x59c2a2=_0xcaf2[_0x48c998];return _0x59c2a2;};'use strict';var multer=require(_0x2caf('0x0'));var util=require('util');var path=require(_0x2caf('0x1'));var timeout=require(_0x2caf('0x2'));var express=require('express');var router=express[_0x2caf('0x3')]();var fs_extra=require(_0x2caf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2caf('0x5'));var config=require('../../config/environment');var controller=require(_0x2caf('0x6'));router[_0x2caf('0x7')]('/',auth[_0x2caf('0x8')](),controller['index']);router[_0x2caf('0x7')](_0x2caf('0x9'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xa')]);router['get'](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xc')]);router[_0x2caf('0xd')]('/',auth[_0x2caf('0x8')](),controller[_0x2caf('0xe')]);router[_0x2caf('0xf')](_0x2caf('0x9'),auth[_0x2caf('0x8')](),controller['update']);router[_0x2caf('0x10')](_0x2caf('0x9'),auth[_0x2caf('0x8')](),controller[_0x2caf('0x11')]);module[_0x2caf('0x12')]=router; \ No newline at end of file +var _0xb091=['getMessages','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','show','/:id/messages'];(function(_0x17a329,_0x5d2f43){var _0x761387=function(_0x2e1ad3){while(--_0x2e1ad3){_0x17a329['push'](_0x17a329['shift']());}};_0x761387(++_0x5d2f43);}(_0xb091,0x16e));var _0x1b09=function(_0x3b6826,_0x5a10c5){_0x3b6826=_0x3b6826-0x0;var _0x163763=_0xb091[_0x3b6826];return _0x163763;};'use strict';var multer=require('multer');var util=require(_0x1b09('0x0'));var path=require(_0x1b09('0x1'));var timeout=require(_0x1b09('0x2'));var express=require(_0x1b09('0x3'));var router=express['Router']();var fs_extra=require(_0x1b09('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b09('0x5'));var controller=require(_0x1b09('0x6'));router['get']('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x8')]);router[_0x1b09('0x9')]('/:id',auth[_0x1b09('0x7')](),controller[_0x1b09('0xa')]);router[_0x1b09('0x9')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xc')]);router[_0x1b09('0xd')]('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0xe')]);router[_0x1b09('0xf')](_0x1b09('0x10'),auth['isAuthenticated'](),controller[_0x1b09('0x11')]);router[_0x1b09('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1b09('0x13')]);module[_0x1b09('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 34661a2..9d7b6cf 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 _0x57e7=['ENUM','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','yes'];(function(_0x2f5100,_0x565cbe){var _0x40c4bc=function(_0x525168){while(--_0x525168){_0x2f5100['push'](_0x2f5100['shift']());}};_0x40c4bc(++_0x565cbe);}(_0x57e7,0x14a));var _0x757e=function(_0x161a7c,_0x16c07b){_0x161a7c=_0x161a7c-0x0;var _0x507eb9=_0x57e7[_0x161a7c];return _0x507eb9;};'use strict';var Sequelize=require(_0x757e('0x0'));module[_0x757e('0x1')]={'customer_id':{'type':Sequelize[_0x757e('0x2')]},'context':{'type':Sequelize[_0x757e('0x2')],'defaultValue':_0x757e('0x3'),'unique':_0x757e('0x4')},'mailbox':{'type':Sequelize[_0x757e('0x2')],'defaultValue':'','allowNull':![],'unique':_0x757e('0x4')},'password':{'type':Sequelize[_0x757e('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x29e94c){this[_0x757e('0x5')]('email',typeof _0x29e94c===_0x757e('0x6')&&_0x29e94c[_0x757e('0x7')]()?_0x29e94c['trim']():null);}},'pager':{'type':Sequelize[_0x757e('0x2')]},'tz':{'type':Sequelize[_0x757e('0x2')],'defaultValue':_0x757e('0x8')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x757e('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x757e('0x9'),'no'),'defaultValue':_0x757e('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x757e('0x2')]},'callback':{'type':Sequelize[_0x757e('0x2')]},'review':{'type':Sequelize[_0x757e('0xa')](_0x757e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x757e('0xa')](_0x757e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x757e('0xa')](_0x757e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x757e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x757e('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x757e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x757e('0xa')](_0x757e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x757e('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x757e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x757e('0xa')]('yes','no'),'defaultValue':_0x757e('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x757e('0x2')]},'emailbody':{'type':Sequelize[_0x757e('0x2')]},'maxsecs':{'type':Sequelize[_0x757e('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x757e('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x757e('0xd')],'get':function(){return this[_0x757e('0xe')](_0x757e('0xf'))+'\x20-\x20'+this[_0x757e('0xe')](_0x757e('0x10'));}}}; \ No newline at end of file +var _0x41c8=['ENUM','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','yes'];(function(_0x33b303,_0x4ae984){var _0x104ed3=function(_0x28f61a){while(--_0x28f61a){_0x33b303['push'](_0x33b303['shift']());}};_0x104ed3(++_0x4ae984);}(_0x41c8,0x139));var _0x841c=function(_0x248871,_0x86f568){_0x248871=_0x248871-0x0;var _0x1267a5=_0x41c8[_0x248871];return _0x1267a5;};'use strict';var Sequelize=require(_0x841c('0x0'));module[_0x841c('0x1')]={'customer_id':{'type':Sequelize[_0x841c('0x2')]},'context':{'type':Sequelize[_0x841c('0x2')],'defaultValue':_0x841c('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x841c('0x2')],'defaultValue':'','allowNull':![],'unique':_0x841c('0x4')},'password':{'type':Sequelize[_0x841c('0x2')]},'fullname':{'type':Sequelize[_0x841c('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x219fb1){this[_0x841c('0x5')]('email',typeof _0x219fb1===_0x841c('0x6')&&_0x219fb1[_0x841c('0x7')]()?_0x219fb1[_0x841c('0x7')]():null);}},'pager':{'type':Sequelize[_0x841c('0x2')]},'tz':{'type':Sequelize[_0x841c('0x2')],'defaultValue':_0x841c('0x8')},'attach':{'type':Sequelize['ENUM'](_0x841c('0x9'),'no'),'defaultValue':_0x841c('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x841c('0xa')](_0x841c('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x841c('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x841c('0xa')](_0x841c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x841c('0xa')](_0x841c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x841c('0xa')](_0x841c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x841c('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x841c('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x841c('0xa')](_0x841c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x841c('0xa')](_0x841c('0x9'),'no'),'defaultValue':_0x841c('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x841c('0xa')](_0x841c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x841c('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x841c('0xa')](_0x841c('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x841c('0xc')},'emailsubject':{'type':Sequelize[_0x841c('0x2')]},'emailbody':{'type':Sequelize[_0x841c('0x2')]},'maxsecs':{'type':Sequelize[_0x841c('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x841c('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x841c('0xe')](_0x841c('0xf'))+_0x841c('0x10')+this[_0x841c('0xe')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index c2eb4e3..98f03e1 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 _0x13f6=['destroy','Voicemails','error','send','index','map','VoiceMail','rawAttributes','fieldName','type','model','name','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','user','get','UserProfileSection','userProfileId','UserProfileResource','getMessages','findOne','VoiceMailMessage','pick','findAndCountAll','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then'];(function(_0x11e25b,_0x5525df){var _0x282bcf=function(_0x20723d){while(--_0x20723d){_0x11e25b['push'](_0x11e25b['shift']());}};_0x282bcf(++_0x5525df);}(_0x13f6,0x124));var _0x613f=function(_0x5b368d,_0x37003d){_0x5b368d=_0x5b368d-0x0;var _0x431ac1=_0x13f6[_0x5b368d];return _0x431ac1;};'use strict';var emlformat=require(_0x613f('0x0'));var rimraf=require(_0x613f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x613f('0x2'));var moment=require(_0x613f('0x3'));var BPromise=require(_0x613f('0x4'));var Mustache=require('mustache');var util=require(_0x613f('0x5'));var path=require(_0x613f('0x6'));var sox=require(_0x613f('0x7'));var csv=require('to-csv');var ejs=require(_0x613f('0x8'));var fs=require('fs');var fs_extra=require(_0x613f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0xb'));var querystring=require(_0x613f('0xc'));var Papa=require(_0x613f('0xd'));var Redis=require('ioredis');var authService=require(_0x613f('0xe'));var qs=require(_0x613f('0xf'));var as=require(_0x613f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x11'))(_0x613f('0x12'));var utils=require(_0x613f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x613f('0x14'));var db=require(_0x613f('0x15'))['db'];function respondWithStatusCode(_0x542230,_0x4c2a85){_0x4c2a85=_0x4c2a85||0xcc;return function(_0x517f57){if(_0x517f57){return _0x542230[_0x613f('0x16')](_0x4c2a85);}return _0x542230[_0x613f('0x17')](_0x4c2a85)[_0x613f('0x18')]();};}function respondWithResult(_0x375db1,_0x329fcf){_0x329fcf=_0x329fcf||0xc8;return function(_0x4a6fc){if(_0x4a6fc){return _0x375db1[_0x613f('0x17')](_0x329fcf)[_0x613f('0x19')](_0x4a6fc);}};}function respondWithFilteredResult(_0x2eee4d,_0x1d68fd){return function(_0x548218){if(_0x548218){var _0x3c9edf=typeof _0x1d68fd['offset']==='undefined'&&typeof _0x1d68fd[_0x613f('0x1a')]===_0x613f('0x1b');var _0x544eca=_0x548218[_0x613f('0x1c')];var _0x4f9dae=_0x3c9edf?0x0:_0x1d68fd[_0x613f('0x1d')];var _0x1e5a11=_0x3c9edf?_0x548218[_0x613f('0x1c')]:_0x1d68fd[_0x613f('0x1d')]+_0x1d68fd[_0x613f('0x1a')];var _0x1ba35f;if(_0x1e5a11>=_0x544eca){_0x1e5a11=_0x544eca;_0x1ba35f=0xc8;}else{_0x1ba35f=0xce;}_0x2eee4d['status'](_0x1ba35f);return _0x2eee4d['set'](_0x613f('0x1e'),_0x4f9dae+'-'+_0x1e5a11+'/'+_0x544eca)['json'](_0x548218);}return null;};}function patchUpdates(_0x48493c){return function(_0x3c9b58){try{jsonpatch[_0x613f('0x1f')](_0x3c9b58,_0x48493c,!![]);}catch(_0x4f5a5a){return BPromise[_0x613f('0x20')](_0x4f5a5a);}return _0x3c9b58[_0x613f('0x21')]();};}function saveUpdates(_0x2aa14b,_0x48b28a){return function(_0x5401c2){if(_0x5401c2){return _0x5401c2[_0x613f('0x22')](_0x2aa14b)[_0x613f('0x23')](function(_0x2acfcf){return _0x2acfcf;});}return null;};}function removeEntity(_0x51f376,_0x41104e){return function(_0x33e0c6){if(_0x33e0c6){return _0x33e0c6[_0x613f('0x24')]()[_0x613f('0x23')](function(){var _0x3013a1=_0x33e0c6['get']({'plain':!![]});var _0x30fb15=_0x613f('0x25');return db['UserProfileResource'][_0x613f('0x24')]({'where':{'type':_0x30fb15,'resourceId':_0x3013a1['id']}})[_0x613f('0x23')](function(){return _0x33e0c6;});})[_0x613f('0x23')](function(){_0x51f376['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a4a8b,_0x379920){return function(_0x594c28){if(!_0x594c28){_0x5a4a8b[_0x613f('0x16')](0x194);}return _0x594c28;};}function handleError(_0x1767db,_0x4ca372){_0x4ca372=_0x4ca372||0x1f4;return function(_0x121241){logger[_0x613f('0x26')](_0x121241['stack']);if(_0x121241['name']){delete _0x121241['name'];}_0x1767db[_0x613f('0x17')](_0x4ca372)[_0x613f('0x27')](_0x121241);};}exports[_0x613f('0x28')]=function(_0x47f4af,_0x23eda8){var _0x439478={},_0xd335a6={},_0x19bb8f={'count':0x0,'rows':[]};var _0x4f8500=_[_0x613f('0x29')](db[_0x613f('0x2a')][_0x613f('0x2b')],function(_0x728f45){return{'name':_0x728f45[_0x613f('0x2c')],'type':_0x728f45[_0x613f('0x2d')]['key']};});_0xd335a6[_0x613f('0x2e')]=_[_0x613f('0x29')](_0x4f8500,_0x613f('0x2f'));_0xd335a6['query']=_[_0x613f('0x30')](_0x47f4af['query']);_0xd335a6[_0x613f('0x31')]=_[_0x613f('0x32')](_0xd335a6[_0x613f('0x2e')],_0xd335a6[_0x613f('0x33')]);_0x439478[_0x613f('0x34')]=_[_0x613f('0x32')](_0xd335a6['model'],qs[_0x613f('0x35')](_0x47f4af[_0x613f('0x33')][_0x613f('0x35')]));_0x439478[_0x613f('0x34')]=_0x439478[_0x613f('0x34')]['length']?_0x439478['attributes']:_0xd335a6['model'];if(!_0x47f4af[_0x613f('0x33')][_0x613f('0x36')](_0x613f('0x37'))){_0x439478[_0x613f('0x1a')]=qs['limit'](_0x47f4af[_0x613f('0x33')][_0x613f('0x1a')]);_0x439478['offset']=qs[_0x613f('0x1d')](_0x47f4af['query'][_0x613f('0x1d')]);}_0x439478['order']=qs[_0x613f('0x38')](_0x47f4af['query'][_0x613f('0x38')]);_0x439478[_0x613f('0x39')]=qs[_0x613f('0x31')](_['pick'](_0x47f4af[_0x613f('0x33')],_0xd335a6[_0x613f('0x31')]),_0x4f8500);if(_0x47f4af[_0x613f('0x33')][_0x613f('0x3a')]){_0x439478[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x439478[_0x613f('0x39')],{'$or':_[_0x613f('0x29')](_0x4f8500,function(_0x1f71f3){if(_0x1f71f3[_0x613f('0x2d')]!=='VIRTUAL'){var _0x28b1bc={};_0x28b1bc[_0x1f71f3[_0x613f('0x2f')]]={'$like':'%'+_0x47f4af[_0x613f('0x33')][_0x613f('0x3a')]+'%'};return _0x28b1bc;}})});}_0x439478=_[_0x613f('0x3b')]({},_0x439478,_0x47f4af[_0x613f('0x3c')]);var _0xa76fff={'where':_0x439478['where']};return db[_0x613f('0x2a')][_0x613f('0x1c')](_0xa76fff)[_0x613f('0x23')](function(_0x3d2d7b){_0x19bb8f[_0x613f('0x1c')]=_0x3d2d7b;if(_0x47f4af[_0x613f('0x33')][_0x613f('0x3d')]){_0x439478['include']=[{'all':!![]}];}return db[_0x613f('0x2a')][_0x613f('0x3e')](_0x439478);})[_0x613f('0x23')](function(_0x2f584e){_0x19bb8f[_0x613f('0x3f')]=_0x2f584e;return _0x19bb8f;})[_0x613f('0x23')](respondWithFilteredResult(_0x23eda8,_0x439478))[_0x613f('0x40')](handleError(_0x23eda8,null));};exports[_0x613f('0x41')]=function(_0x403feb,_0x2d2574){var _0x12647a={'raw':!![],'where':{'id':_0x403feb[_0x613f('0x42')]['id']}},_0x258a71={};_0x258a71['model']=_[_0x613f('0x30')](db[_0x613f('0x2a')][_0x613f('0x2b')]);_0x258a71[_0x613f('0x33')]=_['keys'](_0x403feb[_0x613f('0x33')]);_0x258a71[_0x613f('0x31')]=_[_0x613f('0x32')](_0x258a71[_0x613f('0x2e')],_0x258a71[_0x613f('0x33')]);_0x12647a[_0x613f('0x34')]=_[_0x613f('0x32')](_0x258a71[_0x613f('0x2e')],qs[_0x613f('0x35')](_0x403feb[_0x613f('0x33')]['fields']));_0x12647a['attributes']=_0x12647a[_0x613f('0x34')][_0x613f('0x43')]?_0x12647a['attributes']:_0x258a71[_0x613f('0x2e')];if(_0x403feb[_0x613f('0x33')][_0x613f('0x3d')]){_0x12647a[_0x613f('0x44')]=[{'all':!![]}];}_0x12647a=_[_0x613f('0x3b')]({},_0x12647a,_0x403feb[_0x613f('0x3c')]);return db[_0x613f('0x2a')][_0x613f('0x45')](_0x12647a)[_0x613f('0x23')](handleEntityNotFound(_0x2d2574,null))[_0x613f('0x23')](respondWithResult(_0x2d2574,null))[_0x613f('0x40')](handleError(_0x2d2574,null));};exports[_0x613f('0x46')]=function(_0x174e22,_0x17f8e5){return db[_0x613f('0x2a')][_0x613f('0x46')](_0x174e22[_0x613f('0x47')],{})[_0x613f('0x23')](function(_0x5a4079){var _0x47c84b=_0x174e22[_0x613f('0x48')][_0x613f('0x49')]({'plain':!![]});if(!_0x47c84b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47c84b['role']===_0x613f('0x48')){var _0x51729a=_0x5a4079['get']({'plain':!![]});var _0x6e006b=_0x613f('0x25');return db[_0x613f('0x4a')]['find']({'where':{'name':_0x6e006b,'userProfileId':_0x47c84b[_0x613f('0x4b')]},'raw':!![]})[_0x613f('0x23')](function(_0x4f59b6){if(_0x4f59b6&&_0x4f59b6['autoAssociation']===0x0){return db[_0x613f('0x4c')][_0x613f('0x46')]({'name':_0x51729a[_0x613f('0x2f')],'resourceId':_0x51729a['id'],'type':_0x4f59b6[_0x613f('0x2f')],'sectionId':_0x4f59b6['id']},{})[_0x613f('0x23')](function(){return _0x5a4079;});}else{return _0x5a4079;}})[_0x613f('0x40')](function(_0x24d162){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24d162);throw _0x24d162;});}return _0x5a4079;})[_0x613f('0x23')](respondWithResult(_0x17f8e5,0xc9))['catch'](handleError(_0x17f8e5,null));};exports['update']=function(_0x387913,_0x52c2a6){if(_0x387913[_0x613f('0x47')]['id']){delete _0x387913['body']['id'];}return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0x387913[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x52c2a6,null))[_0x613f('0x23')](saveUpdates(_0x387913[_0x613f('0x47')],null))[_0x613f('0x23')](respondWithResult(_0x52c2a6,null))['catch'](handleError(_0x52c2a6,null));};exports[_0x613f('0x24')]=function(_0x4ff3ad,_0x3ce3dd){return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0x4ff3ad[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x3ce3dd,null))[_0x613f('0x23')](removeEntity(_0x3ce3dd,null))[_0x613f('0x40')](handleError(_0x3ce3dd,null));};exports[_0x613f('0x4d')]=function(_0x214d01,_0x49637d,_0x2ebce1){return db[_0x613f('0x2a')][_0x613f('0x4e')]({'where':{'id':_0x214d01['params']['id']}})['then'](handleEntityNotFound(_0x49637d,null))[_0x613f('0x23')](function(_0x4b6eb3){var _0xcb1c9d;var _0x3c3cd7={},_0x42a72b={};_0x42a72b[_0x613f('0x2e')]=_[_0x613f('0x30')](db[_0x613f('0x4f')][_0x613f('0x2b')]);_0x42a72b[_0x613f('0x33')]=_[_0x613f('0x30')](_0x214d01[_0x613f('0x33')]);_0x42a72b[_0x613f('0x31')]=_['intersection'](_0x42a72b[_0x613f('0x2e')],_0x42a72b[_0x613f('0x33')]);_0x3c3cd7[_0x613f('0x34')]=_[_0x613f('0x32')](_0x42a72b['model'],qs[_0x613f('0x35')](_0x214d01[_0x613f('0x33')]['fields']));_0x3c3cd7['attributes']=_0x3c3cd7[_0x613f('0x34')]['length']?_0x3c3cd7['attributes']:_0x42a72b['model'];if(!_0x214d01[_0x613f('0x33')]['hasOwnProperty']('nolimit')){_0x3c3cd7['limit']=qs[_0x613f('0x1a')](_0x214d01[_0x613f('0x33')]['limit']);_0x3c3cd7[_0x613f('0x1d')]=qs[_0x613f('0x1d')](_0x214d01[_0x613f('0x33')][_0x613f('0x1d')]);}_0x3c3cd7['order']=qs[_0x613f('0x38')](_0x214d01[_0x613f('0x33')]['sort']);_0x3c3cd7[_0x613f('0x39')]=qs[_0x613f('0x31')](_[_0x613f('0x50')](_0x214d01[_0x613f('0x33')],_0x42a72b[_0x613f('0x31')]));if(_0x214d01[_0x613f('0x33')][_0x613f('0x3a')]){_0x3c3cd7[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x3c3cd7[_0x613f('0x39')],{'$or':_[_0x613f('0x29')](_0x3c3cd7[_0x613f('0x34')],function(_0x50d7ca){var _0x1c4e48={};_0x1c4e48[_0x50d7ca]={'$like':'%'+_0x214d01[_0x613f('0x33')][_0x613f('0x3a')]+'%'};return _0x1c4e48;})});}_0x3c3cd7[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x3c3cd7[_0x613f('0x39')],{'mailboxuser':_0x4b6eb3['mailbox']});_0x3c3cd7=_[_0x613f('0x3b')]({},_0x3c3cd7,_0x214d01[_0x613f('0x3c')]);return db[_0x613f('0x4f')][_0x613f('0x51')](_0x3c3cd7)[_0x613f('0x23')](respondWithFilteredResult(_0x49637d,_0x3c3cd7));})[_0x613f('0x40')](handleError(_0x49637d,null));}; \ No newline at end of file +var _0xbfcc=['stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','nolimit','VoiceMailMessage','eml-format','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','offset','count','set','Content-Range','json','reject','then','destroy','get','Voicemails','UserProfileResource','error'];(function(_0x13f890,_0x1681d7){var _0x314a20=function(_0x61d631){while(--_0x61d631){_0x13f890['push'](_0x13f890['shift']());}};_0x314a20(++_0x1681d7);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0xbfcc[_0x2c1dcd];return _0x158ce5;};'use strict';var emlformat=require(_0xcbfc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcbfc('0x1'));var rp=require(_0xcbfc('0x2'));var moment=require(_0xcbfc('0x3'));var BPromise=require(_0xcbfc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcbfc('0x5'));var ejs=require(_0xcbfc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbfc('0x7'));var squel=require('squel');var crypto=require(_0xcbfc('0x8'));var jsforce=require(_0xcbfc('0x9'));var deskjs=require(_0xcbfc('0xa'));var toCsv=require(_0xcbfc('0x5'));var querystring=require('querystring');var Papa=require(_0xcbfc('0xb'));var Redis=require(_0xcbfc('0xc'));var authService=require(_0xcbfc('0xd'));var qs=require(_0xcbfc('0xe'));var as=require(_0xcbfc('0xf'));var hardwareService=require(_0xcbfc('0x10'));var logger=require('../../config/logger')(_0xcbfc('0x11'));var utils=require(_0xcbfc('0x12'));var config=require(_0xcbfc('0x13'));var licenseUtil=require(_0xcbfc('0x14'));var db=require(_0xcbfc('0x15'))['db'];function respondWithStatusCode(_0x4e8b34,_0x3bfd05){_0x3bfd05=_0x3bfd05||0xcc;return function(_0x86f67c){if(_0x86f67c){return _0x4e8b34[_0xcbfc('0x16')](_0x3bfd05);}return _0x4e8b34['status'](_0x3bfd05)[_0xcbfc('0x17')]();};}function respondWithResult(_0x3ec338,_0x2f2bdd){_0x2f2bdd=_0x2f2bdd||0xc8;return function(_0x45a5cc){if(_0x45a5cc){return _0x3ec338[_0xcbfc('0x18')](_0x2f2bdd)['json'](_0x45a5cc);}};}function respondWithFilteredResult(_0x3c69ed,_0x1963de){return function(_0x1ec8c4){if(_0x1ec8c4){var _0x4317e4=typeof _0x1963de['offset']==='undefined'&&typeof _0x1963de[_0xcbfc('0x19')]===_0xcbfc('0x1a');var _0xa65368=_0x1ec8c4['count'];var _0x5b078f=_0x4317e4?0x0:_0x1963de[_0xcbfc('0x1b')];var _0x99b59d=_0x4317e4?_0x1ec8c4[_0xcbfc('0x1c')]:_0x1963de['offset']+_0x1963de[_0xcbfc('0x19')];var _0x552777;if(_0x99b59d>=_0xa65368){_0x99b59d=_0xa65368;_0x552777=0xc8;}else{_0x552777=0xce;}_0x3c69ed[_0xcbfc('0x18')](_0x552777);return _0x3c69ed[_0xcbfc('0x1d')](_0xcbfc('0x1e'),_0x5b078f+'-'+_0x99b59d+'/'+_0xa65368)[_0xcbfc('0x1f')](_0x1ec8c4);}return null;};}function patchUpdates(_0x25c167){return function(_0x2653b1){try{jsonpatch['apply'](_0x2653b1,_0x25c167,!![]);}catch(_0x9c79da){return BPromise[_0xcbfc('0x20')](_0x9c79da);}return _0x2653b1['save']();};}function saveUpdates(_0x1da958,_0x5a449b){return function(_0x4cc8b3){if(_0x4cc8b3){return _0x4cc8b3['update'](_0x1da958)[_0xcbfc('0x21')](function(_0x4a0fcb){return _0x4a0fcb;});}return null;};}function removeEntity(_0x4a1915,_0x1b3e42){return function(_0x34cffa){if(_0x34cffa){return _0x34cffa[_0xcbfc('0x22')]()[_0xcbfc('0x21')](function(){var _0x49f5bf=_0x34cffa[_0xcbfc('0x23')]({'plain':!![]});var _0x51284a=_0xcbfc('0x24');return db[_0xcbfc('0x25')]['destroy']({'where':{'type':_0x51284a,'resourceId':_0x49f5bf['id']}})[_0xcbfc('0x21')](function(){return _0x34cffa;});})[_0xcbfc('0x21')](function(){_0x4a1915['status'](0xcc)[_0xcbfc('0x17')]();});}};}function handleEntityNotFound(_0x3c3afd,_0x2f7549){return function(_0x41f3b8){if(!_0x41f3b8){_0x3c3afd['sendStatus'](0x194);}return _0x41f3b8;};}function handleError(_0x29f896,_0x1ec530){_0x1ec530=_0x1ec530||0x1f4;return function(_0x4f632a){logger[_0xcbfc('0x26')](_0x4f632a[_0xcbfc('0x27')]);if(_0x4f632a[_0xcbfc('0x28')]){delete _0x4f632a[_0xcbfc('0x28')];}_0x29f896[_0xcbfc('0x18')](_0x1ec530)[_0xcbfc('0x29')](_0x4f632a);};}exports[_0xcbfc('0x2a')]=function(_0x5366cf,_0x41b68b){var _0x433300={},_0x3f9d20={},_0x20a378={'count':0x0,'rows':[]};var _0x500a0b=_[_0xcbfc('0x2b')](db[_0xcbfc('0x2c')][_0xcbfc('0x2d')],function(_0x245986){return{'name':_0x245986[_0xcbfc('0x2e')],'type':_0x245986[_0xcbfc('0x2f')][_0xcbfc('0x30')]};});_0x3f9d20['model']=_[_0xcbfc('0x2b')](_0x500a0b,_0xcbfc('0x28'));_0x3f9d20['query']=_[_0xcbfc('0x31')](_0x5366cf[_0xcbfc('0x32')]);_0x3f9d20[_0xcbfc('0x33')]=_['intersection'](_0x3f9d20['model'],_0x3f9d20['query']);_0x433300[_0xcbfc('0x34')]=_[_0xcbfc('0x35')](_0x3f9d20[_0xcbfc('0x36')],qs[_0xcbfc('0x37')](_0x5366cf[_0xcbfc('0x32')][_0xcbfc('0x37')]));_0x433300[_0xcbfc('0x34')]=_0x433300[_0xcbfc('0x34')]['length']?_0x433300[_0xcbfc('0x34')]:_0x3f9d20[_0xcbfc('0x36')];if(!_0x5366cf['query'][_0xcbfc('0x38')]('nolimit')){_0x433300[_0xcbfc('0x19')]=qs[_0xcbfc('0x19')](_0x5366cf[_0xcbfc('0x32')]['limit']);_0x433300[_0xcbfc('0x1b')]=qs['offset'](_0x5366cf['query'][_0xcbfc('0x1b')]);}_0x433300[_0xcbfc('0x39')]=qs[_0xcbfc('0x3a')](_0x5366cf[_0xcbfc('0x32')][_0xcbfc('0x3a')]);_0x433300[_0xcbfc('0x3b')]=qs[_0xcbfc('0x33')](_[_0xcbfc('0x3c')](_0x5366cf['query'],_0x3f9d20[_0xcbfc('0x33')]),_0x500a0b);if(_0x5366cf['query'][_0xcbfc('0x3d')]){_0x433300[_0xcbfc('0x3b')]=_[_0xcbfc('0x3e')](_0x433300[_0xcbfc('0x3b')],{'$or':_['map'](_0x500a0b,function(_0x5306e9){if(_0x5306e9[_0xcbfc('0x2f')]!==_0xcbfc('0x3f')){var _0x404f46={};_0x404f46[_0x5306e9[_0xcbfc('0x28')]]={'$like':'%'+_0x5366cf[_0xcbfc('0x32')]['filter']+'%'};return _0x404f46;}})});}_0x433300=_[_0xcbfc('0x3e')]({},_0x433300,_0x5366cf[_0xcbfc('0x40')]);var _0xf2da32={'where':_0x433300['where']};return db[_0xcbfc('0x2c')][_0xcbfc('0x1c')](_0xf2da32)[_0xcbfc('0x21')](function(_0x4ca55c){_0x20a378[_0xcbfc('0x1c')]=_0x4ca55c;if(_0x5366cf[_0xcbfc('0x32')][_0xcbfc('0x41')]){_0x433300[_0xcbfc('0x42')]=[{'all':!![]}];}return db[_0xcbfc('0x2c')][_0xcbfc('0x43')](_0x433300);})[_0xcbfc('0x21')](function(_0x561544){_0x20a378[_0xcbfc('0x44')]=_0x561544;return _0x20a378;})[_0xcbfc('0x21')](respondWithFilteredResult(_0x41b68b,_0x433300))['catch'](handleError(_0x41b68b,null));};exports[_0xcbfc('0x45')]=function(_0x50a01c,_0x17b87b){var _0xdc0521={'raw':!![],'where':{'id':_0x50a01c[_0xcbfc('0x46')]['id']}},_0xd609ec={};_0xd609ec[_0xcbfc('0x36')]=_[_0xcbfc('0x31')](db['VoiceMail'][_0xcbfc('0x2d')]);_0xd609ec[_0xcbfc('0x32')]=_[_0xcbfc('0x31')](_0x50a01c[_0xcbfc('0x32')]);_0xd609ec[_0xcbfc('0x33')]=_[_0xcbfc('0x35')](_0xd609ec[_0xcbfc('0x36')],_0xd609ec['query']);_0xdc0521[_0xcbfc('0x34')]=_[_0xcbfc('0x35')](_0xd609ec['model'],qs[_0xcbfc('0x37')](_0x50a01c[_0xcbfc('0x32')][_0xcbfc('0x37')]));_0xdc0521['attributes']=_0xdc0521[_0xcbfc('0x34')][_0xcbfc('0x47')]?_0xdc0521[_0xcbfc('0x34')]:_0xd609ec[_0xcbfc('0x36')];if(_0x50a01c[_0xcbfc('0x32')][_0xcbfc('0x41')]){_0xdc0521[_0xcbfc('0x42')]=[{'all':!![]}];}_0xdc0521=_['merge']({},_0xdc0521,_0x50a01c['options']);return db[_0xcbfc('0x2c')][_0xcbfc('0x48')](_0xdc0521)[_0xcbfc('0x21')](handleEntityNotFound(_0x17b87b,null))[_0xcbfc('0x21')](respondWithResult(_0x17b87b,null))['catch'](handleError(_0x17b87b,null));};exports['create']=function(_0x2e89bf,_0xe5c5ef){return db[_0xcbfc('0x2c')]['create'](_0x2e89bf[_0xcbfc('0x49')],{})[_0xcbfc('0x21')](function(_0x4446b7){var _0x4b3096=_0x2e89bf[_0xcbfc('0x4a')][_0xcbfc('0x23')]({'plain':!![]});if(!_0x4b3096)throw new Error(_0xcbfc('0x4b'));if(_0x4b3096[_0xcbfc('0x4c')]===_0xcbfc('0x4a')){var _0xd9976d=_0x4446b7[_0xcbfc('0x23')]({'plain':!![]});var _0x374998=_0xcbfc('0x24');return db[_0xcbfc('0x4d')]['find']({'where':{'name':_0x374998,'userProfileId':_0x4b3096[_0xcbfc('0x4e')]},'raw':!![]})[_0xcbfc('0x21')](function(_0x44cc11){if(_0x44cc11&&_0x44cc11['autoAssociation']===0x0){return db[_0xcbfc('0x25')][_0xcbfc('0x4f')]({'name':_0xd9976d['name'],'resourceId':_0xd9976d['id'],'type':_0x44cc11[_0xcbfc('0x28')],'sectionId':_0x44cc11['id']},{})[_0xcbfc('0x21')](function(){return _0x4446b7;});}else{return _0x4446b7;}})[_0xcbfc('0x50')](function(_0x25e48d){logger['error'](_0xcbfc('0x51'),_0x25e48d);throw _0x25e48d;});}return _0x4446b7;})[_0xcbfc('0x21')](respondWithResult(_0xe5c5ef,0xc9))['catch'](handleError(_0xe5c5ef,null));};exports[_0xcbfc('0x52')]=function(_0x34db13,_0x3ed9f0){if(_0x34db13[_0xcbfc('0x49')]['id']){delete _0x34db13[_0xcbfc('0x49')]['id'];}return db[_0xcbfc('0x2c')][_0xcbfc('0x48')]({'where':{'id':_0x34db13[_0xcbfc('0x46')]['id']}})[_0xcbfc('0x21')](handleEntityNotFound(_0x3ed9f0,null))[_0xcbfc('0x21')](saveUpdates(_0x34db13['body'],null))[_0xcbfc('0x21')](respondWithResult(_0x3ed9f0,null))['catch'](handleError(_0x3ed9f0,null));};exports['destroy']=function(_0x4a10e6,_0x4239da){return db[_0xcbfc('0x2c')][_0xcbfc('0x48')]({'where':{'id':_0x4a10e6[_0xcbfc('0x46')]['id']}})[_0xcbfc('0x21')](handleEntityNotFound(_0x4239da,null))[_0xcbfc('0x21')](removeEntity(_0x4239da,null))[_0xcbfc('0x50')](handleError(_0x4239da,null));};exports[_0xcbfc('0x53')]=function(_0x4d2df1,_0x9e0c38,_0xf5f5e1){return db[_0xcbfc('0x2c')]['findOne']({'where':{'id':_0x4d2df1[_0xcbfc('0x46')]['id']}})[_0xcbfc('0x21')](handleEntityNotFound(_0x9e0c38,null))[_0xcbfc('0x21')](function(_0x3b526f){var _0x1ed350;var _0x310b78={},_0x34ec1d={};_0x34ec1d['model']=_[_0xcbfc('0x31')](db['VoiceMailMessage'][_0xcbfc('0x2d')]);_0x34ec1d[_0xcbfc('0x32')]=_['keys'](_0x4d2df1[_0xcbfc('0x32')]);_0x34ec1d['filters']=_[_0xcbfc('0x35')](_0x34ec1d[_0xcbfc('0x36')],_0x34ec1d[_0xcbfc('0x32')]);_0x310b78[_0xcbfc('0x34')]=_[_0xcbfc('0x35')](_0x34ec1d[_0xcbfc('0x36')],qs['fields'](_0x4d2df1[_0xcbfc('0x32')][_0xcbfc('0x37')]));_0x310b78['attributes']=_0x310b78[_0xcbfc('0x34')][_0xcbfc('0x47')]?_0x310b78[_0xcbfc('0x34')]:_0x34ec1d[_0xcbfc('0x36')];if(!_0x4d2df1[_0xcbfc('0x32')][_0xcbfc('0x38')](_0xcbfc('0x54'))){_0x310b78[_0xcbfc('0x19')]=qs['limit'](_0x4d2df1[_0xcbfc('0x32')][_0xcbfc('0x19')]);_0x310b78[_0xcbfc('0x1b')]=qs[_0xcbfc('0x1b')](_0x4d2df1[_0xcbfc('0x32')][_0xcbfc('0x1b')]);}_0x310b78[_0xcbfc('0x39')]=qs[_0xcbfc('0x3a')](_0x4d2df1[_0xcbfc('0x32')][_0xcbfc('0x3a')]);_0x310b78['where']=qs[_0xcbfc('0x33')](_[_0xcbfc('0x3c')](_0x4d2df1['query'],_0x34ec1d[_0xcbfc('0x33')]));if(_0x4d2df1['query']['filter']){_0x310b78[_0xcbfc('0x3b')]=_[_0xcbfc('0x3e')](_0x310b78[_0xcbfc('0x3b')],{'$or':_[_0xcbfc('0x2b')](_0x310b78[_0xcbfc('0x34')],function(_0x4d8d2a){var _0x53babd={};_0x53babd[_0x4d8d2a]={'$like':'%'+_0x4d2df1[_0xcbfc('0x32')][_0xcbfc('0x3d')]+'%'};return _0x53babd;})});}_0x310b78[_0xcbfc('0x3b')]=_[_0xcbfc('0x3e')](_0x310b78[_0xcbfc('0x3b')],{'mailboxuser':_0x3b526f['mailbox']});_0x310b78=_[_0xcbfc('0x3e')]({},_0x310b78,_0x4d2df1[_0xcbfc('0x40')]);return db[_0xcbfc('0x55')]['findAndCountAll'](_0x310b78)['then'](respondWithFilteredResult(_0x9e0c38,_0x310b78));})['catch'](handleError(_0x9e0c38,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 5f8fba4..5be349d 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 _0xf774=['voice_voicemail','mailbox_context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0x495707,_0x2d72eb){var _0x269dc4=function(_0x594c0d){while(--_0x594c0d){_0x495707['push'](_0x495707['shift']());}};_0x269dc4(++_0x2d72eb);}(_0xf774,0xd4));var _0x4f77=function(_0x1a2a2f,_0x4c36d1){_0x1a2a2f=_0x1a2a2f-0x0;var _0x18692d=_0xf774[_0x1a2a2f];return _0x18692d;};'use strict';var _=require(_0x4f77('0x0'));var util=require(_0x4f77('0x1'));var logger=require(_0x4f77('0x2'))(_0x4f77('0x3'));var moment=require(_0x4f77('0x4'));var BPromise=require(_0x4f77('0x5'));var rp=require(_0x4f77('0x6'));var fs=require('fs');var path=require(_0x4f77('0x7'));var rimraf=require(_0x4f77('0x8'));var config=require(_0x4f77('0x9'));var attributes=require(_0x4f77('0xa'));module[_0x4f77('0xb')]=function(_0x3dd79d,_0x5113dc){return _0x3dd79d[_0x4f77('0xc')]('VoiceMail',attributes,{'tableName':_0x4f77('0xd'),'paranoid':![],'indexes':[{'name':_0x4f77('0xe'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3259=['./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x257e8f,_0xdc7fc9){var _0x2d8b1e=function(_0x24739a){while(--_0x24739a){_0x257e8f['push'](_0x257e8f['shift']());}};_0x2d8b1e(++_0xdc7fc9);}(_0x3259,0x1c1));var _0x9325=function(_0x952c0c,_0x386b5e){_0x952c0c=_0x952c0c-0x0;var _0x2dc8cf=_0x3259[_0x952c0c];return _0x2dc8cf;};'use strict';var _=require(_0x9325('0x0'));var util=require(_0x9325('0x1'));var logger=require(_0x9325('0x2'))(_0x9325('0x3'));var moment=require(_0x9325('0x4'));var BPromise=require(_0x9325('0x5'));var rp=require(_0x9325('0x6'));var fs=require('fs');var path=require(_0x9325('0x7'));var rimraf=require(_0x9325('0x8'));var config=require(_0x9325('0x9'));var attributes=require(_0x9325('0xa'));module[_0x9325('0xb')]=function(_0x4dfbac,_0x157625){return _0x4dfbac[_0x9325('0xc')](_0x9325('0xd'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x9325('0xe'),'fields':[_0x9325('0xf'),_0x9325('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 3675f04..eb320ae 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 _0xadd4=['message','info','catch','lodash','util','moment','randomstring','../../config/utils','../../config/environment','jayson/promise','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xadd4,0x102));var _0x4add=function(_0x56585b,_0x2f45cd){_0x56585b=_0x56585b-0x0;var _0xe7002f=_0xadd4[_0x56585b];return _0xe7002f;};'use strict';var _=require(_0x4add('0x0'));var util=require(_0x4add('0x1'));var moment=require(_0x4add('0x2'));var BPromise=require('bluebird');var rs=require(_0x4add('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4add('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4add('0x5'));var jayson=require(_0x4add('0x6'));var client=jayson['client'][_0x4add('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d40f8,_0x4d5b67,_0x81ecbe){return new BPromise(function(_0x1a070a,_0x5041df){return client[_0x4add('0x8')](_0x5d40f8,_0x81ecbe)[_0x4add('0x9')](function(_0x3f209b){logger['info'](_0x4add('0xa'),_0x4d5b67,_0x4add('0xb'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x4d5b67,_0x4add('0xb'),JSON[_0x4add('0xc')](_0x3f209b));if(_0x3f209b[_0x4add('0xd')]){if(_0x3f209b[_0x4add('0xd')]['code']===0x1f4){logger[_0x4add('0xd')](_0x4add('0xa'),_0x4d5b67,_0x3f209b[_0x4add('0xd')][_0x4add('0xe')]);return _0x5041df(_0x3f209b[_0x4add('0xd')][_0x4add('0xe')]);}logger[_0x4add('0xd')](_0x4add('0xa'),_0x4d5b67,_0x3f209b[_0x4add('0xd')]['message']);return _0x1a070a(_0x3f209b['error'][_0x4add('0xe')]);}else{logger[_0x4add('0xf')](_0x4add('0xa'),_0x4d5b67,_0x4add('0xb'));_0x1a070a(_0x3f209b['result'][_0x4add('0xe')]);}})[_0x4add('0x10')](function(_0x188d92){logger[_0x4add('0xd')]('VoiceMail,\x20%s,\x20%s',_0x4d5b67,_0x188d92);_0x5041df(_0x188d92);});});} \ No newline at end of file +var _0x7645=['http','request','then','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x4e3558,_0x53aa25){var _0x52324b=function(_0x4d79d9){while(--_0x4d79d9){_0x4e3558['push'](_0x4e3558['shift']());}};_0x52324b(++_0x53aa25);}(_0x7645,0x1d5));var _0x5764=function(_0x5b71b3,_0x4ad845){_0x5b71b3=_0x5b71b3-0x0;var _0x2bee43=_0x7645[_0x5b71b3];return _0x2bee43;};'use strict';var _=require(_0x5764('0x0'));var util=require(_0x5764('0x1'));var moment=require(_0x5764('0x2'));var BPromise=require(_0x5764('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5764('0x4'));var db=require(_0x5764('0x5'))['db'];var utils=require(_0x5764('0x6'));var logger=require(_0x5764('0x7'))(_0x5764('0x8'));var config=require('../../config/environment');var jayson=require(_0x5764('0x9'));var client=jayson[_0x5764('0xa')][_0x5764('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c5380,_0x1a6a19,_0x3447ab){return new BPromise(function(_0x7063d,_0x12b336){return client[_0x5764('0xc')](_0x4c5380,_0x3447ab)[_0x5764('0xd')](function(_0x24f0e6){logger['info'](_0x5764('0xe'),_0x1a6a19,'request\x20sent');logger[_0x5764('0xf')](_0x5764('0x10'),_0x1a6a19,'request\x20sent',JSON[_0x5764('0x11')](_0x24f0e6));if(_0x24f0e6['error']){if(_0x24f0e6['error'][_0x5764('0x12')]===0x1f4){logger[_0x5764('0x13')]('VoiceMail,\x20%s,\x20%s',_0x1a6a19,_0x24f0e6[_0x5764('0x13')]['message']);return _0x12b336(_0x24f0e6['error'][_0x5764('0x14')]);}logger[_0x5764('0x13')](_0x5764('0xe'),_0x1a6a19,_0x24f0e6[_0x5764('0x13')][_0x5764('0x14')]);return _0x7063d(_0x24f0e6[_0x5764('0x13')][_0x5764('0x14')]);}else{logger[_0x5764('0x15')](_0x5764('0xe'),_0x1a6a19,'request\x20sent');_0x7063d(_0x24f0e6[_0x5764('0x16')][_0x5764('0x14')]);}})[_0x5764('0x17')](function(_0x21f88d){logger['error'](_0x5764('0xe'),_0x1a6a19,_0x21f88d);_0x12b336(_0x21f88d);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index f5e08d8..7b3897b 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 _0xbc31=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','get','/:id','download','post','create'];(function(_0x147d44,_0x1c610){var _0x588aac=function(_0x128e16){while(--_0x128e16){_0x147d44['push'](_0x147d44['shift']());}};_0x588aac(++_0x1c610);}(_0xbc31,0x1bc));var _0x1bc3=function(_0x591440,_0x5d690c){_0x591440=_0x591440-0x0;var _0x4a47c8=_0xbc31[_0x591440];return _0x4a47c8;};'use strict';var multer=require(_0x1bc3('0x0'));var util=require(_0x1bc3('0x1'));var path=require(_0x1bc3('0x2'));var timeout=require(_0x1bc3('0x3'));var express=require(_0x1bc3('0x4'));var router=express[_0x1bc3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1bc3('0x6'));var interaction=require(_0x1bc3('0x7'));var config=require(_0x1bc3('0x8'));var controller=require(_0x1bc3('0x9'));router['get']('/',auth[_0x1bc3('0xa')](),controller['index']);router[_0x1bc3('0xb')](_0x1bc3('0xc'),auth[_0x1bc3('0xa')](),controller['show']);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x1bc3('0xd')]);router[_0x1bc3('0xe')]('/',auth['isAuthenticated'](),controller[_0x1bc3('0xf')]);router[_0x1bc3('0x10')]('/:id',auth[_0x1bc3('0xa')](),controller['update']);router[_0x1bc3('0x11')](_0x1bc3('0xc'),auth[_0x1bc3('0xa')](),controller[_0x1bc3('0x12')]);module[_0x1bc3('0x13')]=router; \ No newline at end of file +var _0xefc3=['destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','download','post','put','update','delete'];(function(_0x28a3a1,_0x488bd6){var _0x268719=function(_0x525071){while(--_0x525071){_0x28a3a1['push'](_0x28a3a1['shift']());}};_0x268719(++_0x488bd6);}(_0xefc3,0x1d5));var _0x3efc=function(_0x397e93,_0x24f3af){_0x397e93=_0x397e93-0x0;var _0x4c39ab=_0xefc3[_0x397e93];return _0x4c39ab;};'use strict';var multer=require(_0x3efc('0x0'));var util=require('util');var path=require(_0x3efc('0x1'));var timeout=require(_0x3efc('0x2'));var express=require(_0x3efc('0x3'));var router=express[_0x3efc('0x4')]();var fs_extra=require(_0x3efc('0x5'));var auth=require(_0x3efc('0x6'));var interaction=require(_0x3efc('0x7'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0x3efc('0x8')]('/',auth[_0x3efc('0x9')](),controller[_0x3efc('0xa')]);router[_0x3efc('0x8')](_0x3efc('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x3efc('0x8')]('/:id/download',auth[_0x3efc('0x9')](),controller[_0x3efc('0xc')]);router[_0x3efc('0xd')]('/',auth[_0x3efc('0x9')](),controller['create']);router[_0x3efc('0xe')](_0x3efc('0xb'),auth['isAuthenticated'](),controller[_0x3efc('0xf')]);router[_0x3efc('0x10')](_0x3efc('0xb'),auth['isAuthenticated'](),controller[_0x3efc('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 92bf9f2..9bf46d9 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 _0xddc2=['VIRTUAL','INTEGER','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x4b0328,_0x4d512b){var _0x237093=function(_0x36caa7){while(--_0x36caa7){_0x4b0328['push'](_0x4b0328['shift']());}};_0x237093(++_0x4d512b);}(_0xddc2,0x166));var _0x2ddc=function(_0x310116,_0x4ba767){_0x310116=_0x310116-0x0;var _0x4052c6=_0xddc2[_0x310116];return _0x4052c6;};'use strict';var Sequelize=require(_0x2ddc('0x0'));module[_0x2ddc('0x1')]={'name':{'type':Sequelize[_0x2ddc('0x2')],'get':function(_0x41a5f2){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x2ddc('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x2ddc('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x2ddc('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x2ddc('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x2ddc('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x2ddc('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x2ddc('0x5')](_0x2ddc('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x2ddc('0x7'),'defaultValue':Sequelize['literal'](_0x2ddc('0x8'))}}; \ No newline at end of file +var _0xc51e=['BLOB','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','STRING'];(function(_0x58b8db,_0x4e4c71){var _0x53aea6=function(_0x2c5d9b){while(--_0x2c5d9b){_0x58b8db['push'](_0x58b8db['shift']());}};_0x53aea6(++_0x4e4c71);}(_0xc51e,0x1b8));var _0xec51=function(_0x5cb7dd,_0x290cfb){_0x5cb7dd=_0x5cb7dd-0x0;var _0x5ee23e=_0xc51e[_0x5cb7dd];return _0x5ee23e;};'use strict';var Sequelize=require(_0xec51('0x0'));module[_0xec51('0x1')]={'name':{'type':Sequelize[_0xec51('0x2')],'get':function(_0x11c430){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xec51('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xec51('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0xec51('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index e02ee28..c70b2e0 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 _0xcdd1=['options','catch','show','keys','includeAll','include','find','create','body','destroy','params','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xcdd1,0xba));var _0x1cdd=function(_0x5837d1,_0x4661e0){_0x5837d1=_0x5837d1-0x0;var _0x43b3b7=_0xcdd1[_0x5837d1];return _0x43b3b7;};'use strict';var emlformat=require(_0x1cdd('0x0'));var rimraf=require(_0x1cdd('0x1'));var zipdir=require(_0x1cdd('0x2'));var jsonpatch=require(_0x1cdd('0x3'));var rp=require(_0x1cdd('0x4'));var moment=require(_0x1cdd('0x5'));var BPromise=require(_0x1cdd('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1cdd('0x7'));var csv=require(_0x1cdd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cdd('0x9'));var _=require(_0x1cdd('0xa'));var squel=require(_0x1cdd('0xb'));var crypto=require(_0x1cdd('0xc'));var jsforce=require(_0x1cdd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1cdd('0x8'));var querystring=require(_0x1cdd('0xe'));var Papa=require(_0x1cdd('0xf'));var Redis=require(_0x1cdd('0x10'));var authService=require(_0x1cdd('0x11'));var qs=require(_0x1cdd('0x12'));var as=require(_0x1cdd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1cdd('0x14'))(_0x1cdd('0x15'));var utils=require('../../config/utils');var config=require(_0x1cdd('0x16'));var licenseUtil=require(_0x1cdd('0x17'));var db=require(_0x1cdd('0x18'))['db'];function respondWithStatusCode(_0x448b46,_0x44ac98){_0x44ac98=_0x44ac98||0xcc;return function(_0x18e3b2){if(_0x18e3b2){return _0x448b46[_0x1cdd('0x19')](_0x44ac98);}return _0x448b46[_0x1cdd('0x1a')](_0x44ac98)[_0x1cdd('0x1b')]();};}function respondWithResult(_0x388a16,_0x21db7e){_0x21db7e=_0x21db7e||0xc8;return function(_0x228394){if(_0x228394){return _0x388a16[_0x1cdd('0x1a')](_0x21db7e)[_0x1cdd('0x1c')](_0x228394);}};}function respondWithFilteredResult(_0x232902,_0x1d4829){return function(_0x6c8803){if(_0x6c8803){var _0x1dfaa0=typeof _0x1d4829[_0x1cdd('0x1d')]===_0x1cdd('0x1e')&&typeof _0x1d4829['limit']==='undefined';var _0x518ca9=_0x6c8803['count'];var _0x58b74d=_0x1dfaa0?0x0:_0x1d4829['offset'];var _0x4a0d12=_0x1dfaa0?_0x6c8803[_0x1cdd('0x1f')]:_0x1d4829[_0x1cdd('0x1d')]+_0x1d4829[_0x1cdd('0x20')];var _0x4c7a25;if(_0x4a0d12>=_0x518ca9){_0x4a0d12=_0x518ca9;_0x4c7a25=0xc8;}else{_0x4c7a25=0xce;}_0x232902[_0x1cdd('0x1a')](_0x4c7a25);return _0x232902[_0x1cdd('0x21')](_0x1cdd('0x22'),_0x58b74d+'-'+_0x4a0d12+'/'+_0x518ca9)[_0x1cdd('0x1c')](_0x6c8803);}return null;};}function patchUpdates(_0xc2ea4c){return function(_0x1265b8){try{jsonpatch[_0x1cdd('0x23')](_0x1265b8,_0xc2ea4c,!![]);}catch(_0x4fe66f){return BPromise['reject'](_0x4fe66f);}return _0x1265b8['save']();};}function saveUpdates(_0x72afe2,_0x10ee46){return function(_0x1a8a48){if(_0x1a8a48){return _0x1a8a48[_0x1cdd('0x24')](_0x72afe2)[_0x1cdd('0x25')](function(_0x18bee9){return _0x18bee9;});}return null;};}function removeEntity(_0x3327eb,_0x38ba16){return function(_0x3fb5d0){if(_0x3fb5d0){return _0x3fb5d0['destroy']()[_0x1cdd('0x25')](function(){_0x3327eb['status'](0xcc)[_0x1cdd('0x1b')]();});}};}function handleEntityNotFound(_0xa66ad3,_0x2b78dd){return function(_0x538945){if(!_0x538945){_0xa66ad3['sendStatus'](0x194);}return _0x538945;};}function handleError(_0x5f2098,_0x2e0eb6){_0x2e0eb6=_0x2e0eb6||0x1f4;return function(_0xf7fa51){logger['error'](_0xf7fa51[_0x1cdd('0x26')]);if(_0xf7fa51[_0x1cdd('0x27')]){delete _0xf7fa51[_0x1cdd('0x27')];}_0x5f2098[_0x1cdd('0x1a')](_0x2e0eb6)[_0x1cdd('0x28')](_0xf7fa51);};}exports['index']=function(_0x3b64f5,_0x35c536){var _0x1485f9={},_0x1571c6={},_0x4f61e9={'count':0x0,'rows':[]};var _0x27fab4=_[_0x1cdd('0x29')](db[_0x1cdd('0x2a')][_0x1cdd('0x2b')],function(_0x3d445f){return{'name':_0x3d445f[_0x1cdd('0x2c')],'type':_0x3d445f[_0x1cdd('0x2d')][_0x1cdd('0x2e')]};});_0x1571c6[_0x1cdd('0x2f')]=_[_0x1cdd('0x30')](_[_0x1cdd('0x29')](_0x27fab4,_0x1cdd('0x27')),[_0x1cdd('0x27')]);_0x1571c6[_0x1cdd('0x31')]=_['keys'](_0x3b64f5[_0x1cdd('0x31')]);_0x1571c6[_0x1cdd('0x32')]=_[_0x1cdd('0x33')](_0x1571c6[_0x1cdd('0x2f')],_0x1571c6[_0x1cdd('0x31')]);_0x1485f9[_0x1cdd('0x34')]=_[_0x1cdd('0x33')](_0x1571c6[_0x1cdd('0x2f')],qs['fields'](_0x3b64f5[_0x1cdd('0x31')][_0x1cdd('0x35')]));_0x1485f9[_0x1cdd('0x34')]=_0x1485f9['attributes'][_0x1cdd('0x36')]?_0x1485f9[_0x1cdd('0x34')]:_0x1571c6[_0x1cdd('0x2f')];if(!_0x3b64f5[_0x1cdd('0x31')][_0x1cdd('0x37')](_0x1cdd('0x38'))){_0x1485f9[_0x1cdd('0x20')]=qs[_0x1cdd('0x20')](_0x3b64f5[_0x1cdd('0x31')][_0x1cdd('0x20')]);_0x1485f9[_0x1cdd('0x1d')]=qs[_0x1cdd('0x1d')](_0x3b64f5[_0x1cdd('0x31')][_0x1cdd('0x1d')]);}_0x1485f9[_0x1cdd('0x39')]=qs['sort'](_0x3b64f5['query'][_0x1cdd('0x3a')]);_0x1485f9[_0x1cdd('0x3b')]=qs[_0x1cdd('0x32')](_[_0x1cdd('0x3c')](_0x3b64f5[_0x1cdd('0x31')],_0x1571c6[_0x1cdd('0x32')]),_0x27fab4);if(_0x3b64f5['query']['filter']){_0x1485f9[_0x1cdd('0x3b')]=_['merge'](_0x1485f9['where'],{'$or':_[_0x1cdd('0x29')](_0x27fab4,function(_0x804cc5){if(_0x804cc5[_0x1cdd('0x2d')]!=='VIRTUAL'){var _0x4f16a6={};_0x4f16a6[_0x804cc5['name']]={'$like':'%'+_0x3b64f5[_0x1cdd('0x31')][_0x1cdd('0x3d')]+'%'};return _0x4f16a6;}})});}_0x1485f9=_[_0x1cdd('0x3e')]({},_0x1485f9,_0x3b64f5[_0x1cdd('0x3f')]);var _0x186890={'where':_0x1485f9[_0x1cdd('0x3b')]};return db[_0x1cdd('0x2a')][_0x1cdd('0x1f')](_0x186890)[_0x1cdd('0x25')](function(_0x41f4bd){_0x4f61e9[_0x1cdd('0x1f')]=_0x41f4bd;if(_0x3b64f5[_0x1cdd('0x31')]['includeAll']){_0x1485f9['include']=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x1485f9);})[_0x1cdd('0x25')](function(_0x5e25e8){_0x4f61e9['rows']=_0x5e25e8;return _0x4f61e9;})[_0x1cdd('0x25')](respondWithFilteredResult(_0x35c536,_0x1485f9))[_0x1cdd('0x40')](handleError(_0x35c536,null));};exports[_0x1cdd('0x41')]=function(_0x526b36,_0x5a8fb8){var _0x3a7c7f={'raw':!![],'where':{'id':_0x526b36['params']['id']}},_0x3a5954={};_0x3a5954[_0x1cdd('0x2f')]=_[_0x1cdd('0x42')](db[_0x1cdd('0x2a')][_0x1cdd('0x2b')]);_0x3a5954[_0x1cdd('0x31')]=_[_0x1cdd('0x42')](_0x526b36[_0x1cdd('0x31')]);_0x3a5954[_0x1cdd('0x32')]=_['intersection'](_0x3a5954[_0x1cdd('0x2f')],_0x3a5954[_0x1cdd('0x31')]);_0x3a7c7f[_0x1cdd('0x34')]=_[_0x1cdd('0x33')](_0x3a5954[_0x1cdd('0x2f')],qs[_0x1cdd('0x35')](_0x526b36[_0x1cdd('0x31')][_0x1cdd('0x35')]));_0x3a7c7f['attributes']=_0x3a7c7f[_0x1cdd('0x34')][_0x1cdd('0x36')]?_0x3a7c7f[_0x1cdd('0x34')]:_0x3a5954['model'];if(_0x526b36[_0x1cdd('0x31')][_0x1cdd('0x43')]){_0x3a7c7f[_0x1cdd('0x44')]=[{'all':!![]}];}_0x3a7c7f=_['merge']({},_0x3a7c7f,_0x526b36[_0x1cdd('0x3f')]);return db[_0x1cdd('0x2a')][_0x1cdd('0x45')](_0x3a7c7f)[_0x1cdd('0x25')](handleEntityNotFound(_0x5a8fb8,null))['then'](respondWithResult(_0x5a8fb8,null))[_0x1cdd('0x40')](handleError(_0x5a8fb8,null));};exports[_0x1cdd('0x46')]=function(_0x414be4,_0x1de8c0){return db[_0x1cdd('0x2a')][_0x1cdd('0x46')](_0x414be4['body'],{})[_0x1cdd('0x25')](respondWithResult(_0x1de8c0,0xc9))[_0x1cdd('0x40')](handleError(_0x1de8c0,null));};exports[_0x1cdd('0x24')]=function(_0x48add3,_0x4b7185){if(_0x48add3[_0x1cdd('0x47')]['id']){delete _0x48add3[_0x1cdd('0x47')]['id'];}return db[_0x1cdd('0x2a')]['find']({'where':{'id':_0x48add3['params']['id']}})[_0x1cdd('0x25')](handleEntityNotFound(_0x4b7185,null))['then'](saveUpdates(_0x48add3['body'],null))[_0x1cdd('0x25')](respondWithResult(_0x4b7185,null))[_0x1cdd('0x40')](handleError(_0x4b7185,null));};exports[_0x1cdd('0x48')]=function(_0x1bc2fc,_0x42af8d){return db['VoiceMailMessage'][_0x1cdd('0x45')]({'where':{'id':_0x1bc2fc['params']['id']}})['then'](handleEntityNotFound(_0x42af8d,null))[_0x1cdd('0x25')](removeEntity(_0x42af8d,null))[_0x1cdd('0x40')](handleError(_0x42af8d,null));};exports['download']=function(_0x12f97b,_0x136eae,_0x9fa91d){return db['VoiceMailMessage'][_0x1cdd('0x45')]({'where':{'id':_0x12f97b[_0x1cdd('0x49')]['id']},'attributes':['id',_0x1cdd('0x4a'),_0x1cdd('0x4b')]})[_0x1cdd('0x25')](handleEntityNotFound(_0x136eae,null))[_0x1cdd('0x25')](function(_0x3147c8){if(_0x3147c8){if(!_0x3147c8[_0x1cdd('0x4a')]){throw new db[(_0x1cdd('0x4c'))][(_0x1cdd('0x4d'))](_0x1cdd('0x4e'));}var _0x1a1096={'Content-Type':_0x1cdd('0x4f'),'Content-Disposition':_0x1cdd('0x50')};if(_0x3147c8['msg_id']){_0x1a1096[_0x1cdd('0x51')]=_0x1cdd('0x52')+_0x3147c8[_0x1cdd('0x4b')]+'.wav\x22';}_0x136eae[_0x1cdd('0x21')](_0x1a1096);return _0x136eae[_0x1cdd('0x28')](new Buffer(_0x3147c8[_0x1cdd('0x4a')]));}})[_0x1cdd('0x40')](handleError(_0x136eae,null));}; \ No newline at end of file +var _0xa448=['moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','end','sendStatus','error','name','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','VoiceMailMessage','includeAll','include','findAll','rows','params','find','catch','body','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','eml-format','zip-dir','fast-json-patch'];(function(_0xfd183f,_0x21bbde){var _0x40b42e=function(_0x5dfbf3){while(--_0x5dfbf3){_0xfd183f['push'](_0xfd183f['shift']());}};_0x40b42e(++_0x21bbde);}(_0xa448,0xe7));var _0x8a44=function(_0x2204c2,_0x21bb81){_0x2204c2=_0x2204c2-0x0;var _0x234f68=_0xa448[_0x2204c2];return _0x234f68;};'use strict';var emlformat=require(_0x8a44('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a44('0x1'));var jsonpatch=require(_0x8a44('0x2'));var rp=require('request-promise');var moment=require(_0x8a44('0x3'));var BPromise=require(_0x8a44('0x4'));var Mustache=require('mustache');var util=require(_0x8a44('0x5'));var path=require(_0x8a44('0x6'));var sox=require('sox');var csv=require(_0x8a44('0x7'));var ejs=require(_0x8a44('0x8'));var fs=require('fs');var fs_extra=require(_0x8a44('0x9'));var _=require(_0x8a44('0xa'));var squel=require('squel');var crypto=require(_0x8a44('0xb'));var jsforce=require(_0x8a44('0xc'));var deskjs=require(_0x8a44('0xd'));var toCsv=require(_0x8a44('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8a44('0xe'));var qs=require(_0x8a44('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a44('0x10'));var logger=require(_0x8a44('0x11'))(_0x8a44('0x12'));var utils=require(_0x8a44('0x13'));var config=require(_0x8a44('0x14'));var licenseUtil=require(_0x8a44('0x15'));var db=require(_0x8a44('0x16'))['db'];function respondWithStatusCode(_0x4d30ff,_0x107537){_0x107537=_0x107537||0xcc;return function(_0x5a843b){if(_0x5a843b){return _0x4d30ff['sendStatus'](_0x107537);}return _0x4d30ff[_0x8a44('0x17')](_0x107537)['end']();};}function respondWithResult(_0x4e97d6,_0x3f0a94){_0x3f0a94=_0x3f0a94||0xc8;return function(_0xdb3442){if(_0xdb3442){return _0x4e97d6[_0x8a44('0x17')](_0x3f0a94)['json'](_0xdb3442);}};}function respondWithFilteredResult(_0xcc0e83,_0xaab8d5){return function(_0x3f717b){if(_0x3f717b){var _0x5c278d=typeof _0xaab8d5[_0x8a44('0x18')]===_0x8a44('0x19')&&typeof _0xaab8d5[_0x8a44('0x1a')]==='undefined';var _0x15304f=_0x3f717b['count'];var _0x4e0a75=_0x5c278d?0x0:_0xaab8d5[_0x8a44('0x18')];var _0x4851cc=_0x5c278d?_0x3f717b[_0x8a44('0x1b')]:_0xaab8d5[_0x8a44('0x18')]+_0xaab8d5[_0x8a44('0x1a')];var _0x161337;if(_0x4851cc>=_0x15304f){_0x4851cc=_0x15304f;_0x161337=0xc8;}else{_0x161337=0xce;}_0xcc0e83[_0x8a44('0x17')](_0x161337);return _0xcc0e83[_0x8a44('0x1c')](_0x8a44('0x1d'),_0x4e0a75+'-'+_0x4851cc+'/'+_0x15304f)[_0x8a44('0x1e')](_0x3f717b);}return null;};}function patchUpdates(_0x5c40a4){return function(_0x1358b3){try{jsonpatch[_0x8a44('0x1f')](_0x1358b3,_0x5c40a4,!![]);}catch(_0x5c6c83){return BPromise['reject'](_0x5c6c83);}return _0x1358b3[_0x8a44('0x20')]();};}function saveUpdates(_0x327380,_0x15d576){return function(_0x1538c2){if(_0x1538c2){return _0x1538c2[_0x8a44('0x21')](_0x327380)[_0x8a44('0x22')](function(_0x1b526d){return _0x1b526d;});}return null;};}function removeEntity(_0x285f8b,_0x109e02){return function(_0x353327){if(_0x353327){return _0x353327['destroy']()[_0x8a44('0x22')](function(){_0x285f8b[_0x8a44('0x17')](0xcc)[_0x8a44('0x23')]();});}};}function handleEntityNotFound(_0x5b98f5,_0x4310f6){return function(_0xb8ec79){if(!_0xb8ec79){_0x5b98f5[_0x8a44('0x24')](0x194);}return _0xb8ec79;};}function handleError(_0x5777d4,_0x81bf9){_0x81bf9=_0x81bf9||0x1f4;return function(_0x59c6ff){logger[_0x8a44('0x25')](_0x59c6ff['stack']);if(_0x59c6ff[_0x8a44('0x26')]){delete _0x59c6ff[_0x8a44('0x26')];}_0x5777d4[_0x8a44('0x17')](_0x81bf9)['send'](_0x59c6ff);};}exports['index']=function(_0x270ecd,_0x1fa00f){var _0x5ce05f={},_0x24cde7={},_0x126117={'count':0x0,'rows':[]};var _0x52db04=_['map'](db['VoiceMailMessage'][_0x8a44('0x27')],function(_0x70bc6a){return{'name':_0x70bc6a[_0x8a44('0x28')],'type':_0x70bc6a[_0x8a44('0x29')]['key']};});_0x24cde7[_0x8a44('0x2a')]=_['differenceBy'](_[_0x8a44('0x2b')](_0x52db04,'name'),[_0x8a44('0x26')]);_0x24cde7[_0x8a44('0x2c')]=_[_0x8a44('0x2d')](_0x270ecd[_0x8a44('0x2c')]);_0x24cde7[_0x8a44('0x2e')]=_[_0x8a44('0x2f')](_0x24cde7[_0x8a44('0x2a')],_0x24cde7[_0x8a44('0x2c')]);_0x5ce05f[_0x8a44('0x30')]=_[_0x8a44('0x2f')](_0x24cde7[_0x8a44('0x2a')],qs[_0x8a44('0x31')](_0x270ecd[_0x8a44('0x2c')]['fields']));_0x5ce05f[_0x8a44('0x30')]=_0x5ce05f[_0x8a44('0x30')][_0x8a44('0x32')]?_0x5ce05f['attributes']:_0x24cde7['model'];if(!_0x270ecd['query']['hasOwnProperty']('nolimit')){_0x5ce05f[_0x8a44('0x1a')]=qs[_0x8a44('0x1a')](_0x270ecd[_0x8a44('0x2c')][_0x8a44('0x1a')]);_0x5ce05f['offset']=qs[_0x8a44('0x18')](_0x270ecd[_0x8a44('0x2c')][_0x8a44('0x18')]);}_0x5ce05f[_0x8a44('0x33')]=qs[_0x8a44('0x34')](_0x270ecd[_0x8a44('0x2c')]['sort']);_0x5ce05f['where']=qs[_0x8a44('0x2e')](_['pick'](_0x270ecd[_0x8a44('0x2c')],_0x24cde7[_0x8a44('0x2e')]),_0x52db04);if(_0x270ecd[_0x8a44('0x2c')][_0x8a44('0x35')]){_0x5ce05f[_0x8a44('0x36')]=_[_0x8a44('0x37')](_0x5ce05f[_0x8a44('0x36')],{'$or':_[_0x8a44('0x2b')](_0x52db04,function(_0x6b4071){if(_0x6b4071['type']!==_0x8a44('0x38')){var _0x581812={};_0x581812[_0x6b4071['name']]={'$like':'%'+_0x270ecd['query'][_0x8a44('0x35')]+'%'};return _0x581812;}})});}_0x5ce05f=_[_0x8a44('0x37')]({},_0x5ce05f,_0x270ecd[_0x8a44('0x39')]);var _0x2c7398={'where':_0x5ce05f['where']};return db[_0x8a44('0x3a')][_0x8a44('0x1b')](_0x2c7398)[_0x8a44('0x22')](function(_0x3fa1c1){_0x126117['count']=_0x3fa1c1;if(_0x270ecd['query'][_0x8a44('0x3b')]){_0x5ce05f[_0x8a44('0x3c')]=[{'all':!![]}];}return db[_0x8a44('0x3a')][_0x8a44('0x3d')](_0x5ce05f);})[_0x8a44('0x22')](function(_0x39fa0c){_0x126117[_0x8a44('0x3e')]=_0x39fa0c;return _0x126117;})[_0x8a44('0x22')](respondWithFilteredResult(_0x1fa00f,_0x5ce05f))['catch'](handleError(_0x1fa00f,null));};exports['show']=function(_0x33758c,_0x4f7f93){var _0xf35d80={'raw':!![],'where':{'id':_0x33758c[_0x8a44('0x3f')]['id']}},_0x55a70={};_0x55a70[_0x8a44('0x2a')]=_['keys'](db[_0x8a44('0x3a')][_0x8a44('0x27')]);_0x55a70[_0x8a44('0x2c')]=_[_0x8a44('0x2d')](_0x33758c['query']);_0x55a70[_0x8a44('0x2e')]=_[_0x8a44('0x2f')](_0x55a70[_0x8a44('0x2a')],_0x55a70[_0x8a44('0x2c')]);_0xf35d80['attributes']=_[_0x8a44('0x2f')](_0x55a70[_0x8a44('0x2a')],qs[_0x8a44('0x31')](_0x33758c[_0x8a44('0x2c')][_0x8a44('0x31')]));_0xf35d80['attributes']=_0xf35d80[_0x8a44('0x30')][_0x8a44('0x32')]?_0xf35d80[_0x8a44('0x30')]:_0x55a70['model'];if(_0x33758c['query']['includeAll']){_0xf35d80['include']=[{'all':!![]}];}_0xf35d80=_[_0x8a44('0x37')]({},_0xf35d80,_0x33758c[_0x8a44('0x39')]);return db[_0x8a44('0x3a')][_0x8a44('0x40')](_0xf35d80)[_0x8a44('0x22')](handleEntityNotFound(_0x4f7f93,null))['then'](respondWithResult(_0x4f7f93,null))[_0x8a44('0x41')](handleError(_0x4f7f93,null));};exports['create']=function(_0x393e52,_0x3e80f5){return db['VoiceMailMessage']['create'](_0x393e52[_0x8a44('0x42')],{})['then'](respondWithResult(_0x3e80f5,0xc9))[_0x8a44('0x41')](handleError(_0x3e80f5,null));};exports['update']=function(_0x1e6469,_0x282afa){if(_0x1e6469['body']['id']){delete _0x1e6469['body']['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x1e6469[_0x8a44('0x3f')]['id']}})[_0x8a44('0x22')](handleEntityNotFound(_0x282afa,null))[_0x8a44('0x22')](saveUpdates(_0x1e6469[_0x8a44('0x42')],null))['then'](respondWithResult(_0x282afa,null))[_0x8a44('0x41')](handleError(_0x282afa,null));};exports[_0x8a44('0x43')]=function(_0x171fa7,_0x59d779){return db[_0x8a44('0x3a')]['find']({'where':{'id':_0x171fa7[_0x8a44('0x3f')]['id']}})[_0x8a44('0x22')](handleEntityNotFound(_0x59d779,null))['then'](removeEntity(_0x59d779,null))[_0x8a44('0x41')](handleError(_0x59d779,null));};exports[_0x8a44('0x44')]=function(_0x25963f,_0xebf5ce,_0x49afc8){return db[_0x8a44('0x3a')][_0x8a44('0x40')]({'where':{'id':_0x25963f[_0x8a44('0x3f')]['id']},'attributes':['id',_0x8a44('0x45'),_0x8a44('0x46')]})[_0x8a44('0x22')](handleEntityNotFound(_0xebf5ce,null))[_0x8a44('0x22')](function(_0x3a97bc){if(_0x3a97bc){if(!_0x3a97bc[_0x8a44('0x45')]){throw new db[(_0x8a44('0x47'))][(_0x8a44('0x48'))](_0x8a44('0x49'));}var _0x50fbfa={'Content-Type':_0x8a44('0x4a'),'Content-Disposition':_0x8a44('0x4b')};if(_0x3a97bc[_0x8a44('0x46')]){_0x50fbfa[_0x8a44('0x4c')]='attachment;\x20filename=\x22'+_0x3a97bc[_0x8a44('0x46')]+_0x8a44('0x4d');}_0xebf5ce[_0x8a44('0x1c')](_0x50fbfa);return _0xebf5ce['send'](new Buffer(_0x3a97bc[_0x8a44('0x45')]));}})[_0x8a44('0x41')](handleError(_0xebf5ce,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index f6f82f0..b518bb5 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 _0x08d7=['moment','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash','util','../../config/logger'];(function(_0x467b77,_0x4d7b6a){var _0x39e193=function(_0x5f5224){while(--_0x5f5224){_0x467b77['push'](_0x467b77['shift']());}};_0x39e193(++_0x4d7b6a);}(_0x08d7,0x1d1));var _0x708d=function(_0x3c6c7c,_0x569b3e){_0x3c6c7c=_0x3c6c7c-0x0;var _0x56c812=_0x08d7[_0x3c6c7c];return _0x56c812;};'use strict';var _=require(_0x708d('0x0'));var util=require(_0x708d('0x1'));var logger=require(_0x708d('0x2'))('api');var moment=require(_0x708d('0x3'));var BPromise=require('bluebird');var rp=require(_0x708d('0x4'));var fs=require('fs');var path=require(_0x708d('0x5'));var rimraf=require(_0x708d('0x6'));var config=require(_0x708d('0x7'));var attributes=require(_0x708d('0x8'));module[_0x708d('0x9')]=function(_0x26efc8,_0x2c1b75){return _0x26efc8[_0x708d('0xa')]('VoiceMailMessage',attributes,{'tableName':_0x708d('0xb'),'paranoid':![],'indexes':[{'name':_0x708d('0xc'),'fields':[_0x708d('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x722c=['define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes'];(function(_0x50221f,_0x59ef1a){var _0x5ed563=function(_0x2464b2){while(--_0x2464b2){_0x50221f['push'](_0x50221f['shift']());}};_0x5ed563(++_0x59ef1a);}(_0x722c,0x122));var _0xc722=function(_0x241044,_0x41c81b){_0x241044=_0x241044-0x0;var _0x50b4b8=_0x722c[_0x241044];return _0x50b4b8;};'use strict';var _=require(_0xc722('0x0'));var util=require('util');var logger=require(_0xc722('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc722('0x2'));var rp=require(_0xc722('0x3'));var fs=require('fs');var path=require(_0xc722('0x4'));var rimraf=require(_0xc722('0x5'));var config=require('../../config/environment');var attributes=require(_0xc722('0x6'));module['exports']=function(_0x1bfdc9,_0x1de671){return _0x1bfdc9[_0xc722('0x7')](_0xc722('0x8'),attributes,{'tableName':_0xc722('0x9'),'paranoid':![],'indexes':[{'name':_0xc722('0xa'),'fields':[_0xc722('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 7f1f460..a6fb3d7 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 _0x322b=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message'];(function(_0x4c1176,_0xf999e9){var _0x2aca97=function(_0xb3cb82){while(--_0xb3cb82){_0x4c1176['push'](_0x4c1176['shift']());}};_0x2aca97(++_0xf999e9);}(_0x322b,0x85));var _0xb322=function(_0xbcc829,_0x321996){_0xbcc829=_0xbcc829-0x0;var _0x1884a1=_0x322b[_0xbcc829];return _0x1884a1;};'use strict';var _=require(_0xb322('0x0'));var util=require(_0xb322('0x1'));var moment=require(_0xb322('0x2'));var BPromise=require('bluebird');var rs=require(_0xb322('0x3'));var fs=require('fs');var Redis=require(_0xb322('0x4'));var db=require(_0xb322('0x5'))['db'];var utils=require(_0xb322('0x6'));var logger=require(_0xb322('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb322('0x8')][_0xb322('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34478d,_0x58c6a8,_0x4156e0){return new BPromise(function(_0x1d0dbd,_0x378f06){return client[_0xb322('0xa')](_0x34478d,_0x4156e0)[_0xb322('0xb')](function(_0x1be2bd){logger[_0xb322('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x58c6a8,_0xb322('0xd'));logger[_0xb322('0xe')](_0xb322('0xf'),_0x58c6a8,_0xb322('0xd'),JSON[_0xb322('0x10')](_0x1be2bd));if(_0x1be2bd['error']){if(_0x1be2bd[_0xb322('0x11')][_0xb322('0x12')]===0x1f4){logger[_0xb322('0x11')](_0xb322('0x13'),_0x58c6a8,_0x1be2bd['error'][_0xb322('0x14')]);return _0x378f06(_0x1be2bd[_0xb322('0x11')][_0xb322('0x14')]);}logger[_0xb322('0x11')](_0xb322('0x13'),_0x58c6a8,_0x1be2bd[_0xb322('0x11')][_0xb322('0x14')]);return _0x1d0dbd(_0x1be2bd[_0xb322('0x11')]['message']);}else{logger[_0xb322('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x58c6a8,_0xb322('0xd'));_0x1d0dbd(_0x1be2bd['result'][_0xb322('0x14')]);}})[_0xb322('0x15')](function(_0x182297){logger[_0xb322('0x11')](_0xb322('0x13'),_0x58c6a8,_0x182297);_0x378f06(_0x182297);});});} \ No newline at end of file +var _0x1900=['rpc','../../config/environment','client','http','request','then','info','error','code','VoiceMailMessage,\x20%s,\x20%s','message','request\x20sent','catch','util','randomstring','../../config/utils','../../config/logger'];(function(_0x4ba2da,_0x2a4ba1){var _0x19c3da=function(_0x48f968){while(--_0x48f968){_0x4ba2da['push'](_0x4ba2da['shift']());}};_0x19c3da(++_0x2a4ba1);}(_0x1900,0x95));var _0x0190=function(_0x305795,_0x260eb7){_0x305795=_0x305795-0x0;var _0x5ee0b9=_0x1900[_0x305795];return _0x5ee0b9;};'use strict';var _=require('lodash');var util=require(_0x0190('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0190('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0190('0x2'));var logger=require(_0x0190('0x3'))(_0x0190('0x4'));var config=require(_0x0190('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0190('0x6')][_0x0190('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x51d867,_0x6d5905,_0x476bdc){return new BPromise(function(_0x12d4f5,_0x2a129a){return client[_0x0190('0x8')](_0x51d867,_0x476bdc)[_0x0190('0x9')](function(_0x1ce15a){logger[_0x0190('0xa')]('VoiceMailMessage,\x20%s,\x20%s',_0x6d5905,'request\x20sent');logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x6d5905,'request\x20sent',JSON['stringify'](_0x1ce15a));if(_0x1ce15a[_0x0190('0xb')]){if(_0x1ce15a['error'][_0x0190('0xc')]===0x1f4){logger[_0x0190('0xb')](_0x0190('0xd'),_0x6d5905,_0x1ce15a['error'][_0x0190('0xe')]);return _0x2a129a(_0x1ce15a[_0x0190('0xb')][_0x0190('0xe')]);}logger[_0x0190('0xb')](_0x0190('0xd'),_0x6d5905,_0x1ce15a[_0x0190('0xb')][_0x0190('0xe')]);return _0x12d4f5(_0x1ce15a[_0x0190('0xb')][_0x0190('0xe')]);}else{logger['info'](_0x0190('0xd'),_0x6d5905,_0x0190('0xf'));_0x12d4f5(_0x1ce15a['result'][_0x0190('0xe')]);}})[_0x0190('0x10')](function(_0x3c4b31){logger['error'](_0x0190('0xd'),_0x6d5905,_0x3c4b31);_0x2a129a(_0x3c4b31);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 97dcba0..50517bc 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 _0x9eae=['isAuthenticated','/:id','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','removeSound','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get'];(function(_0x27c986,_0xf7afc8){var _0x7fbd82=function(_0x189f9a){while(--_0x189f9a){_0x27c986['push'](_0x27c986['shift']());}};_0x7fbd82(++_0xf7afc8);}(_0x9eae,0x1b0));var _0xe9ea=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9eae[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require(_0xe9ea('0x0'));var path=require('path');var timeout=require(_0xe9ea('0x1'));var express=require(_0xe9ea('0x2'));var router=express[_0xe9ea('0x3')]();var fs_extra=require(_0xe9ea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe9ea('0x5'));var config=require(_0xe9ea('0x6'));var controller=require(_0xe9ea('0x7'));router[_0xe9ea('0x8')]('/',auth[_0xe9ea('0x9')](),controller['index']);router[_0xe9ea('0x8')](_0xe9ea('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xe9ea('0x8')](_0xe9ea('0xb'),auth[_0xe9ea('0x9')](),controller[_0xe9ea('0xc')]);router[_0xe9ea('0xd')]('/',auth[_0xe9ea('0x9')](),controller[_0xe9ea('0xe')]);router[_0xe9ea('0xd')]('/:id/sounds',auth[_0xe9ea('0x9')](),controller[_0xe9ea('0xf')]);router[_0xe9ea('0x10')](_0xe9ea('0xa'),auth[_0xe9ea('0x9')](),controller[_0xe9ea('0x11')]);router[_0xe9ea('0x12')](_0xe9ea('0xa'),auth[_0xe9ea('0x9')](),controller[_0xe9ea('0x13')]);router[_0xe9ea('0x12')]('/:id/sounds/:id2',auth[_0xe9ea('0x9')](),controller[_0xe9ea('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe86d=['/:id','/:id/sounds','getSounds','post','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','util','connect-timeout','express','Router','fs-extra','./voiceMusicOnHold.controller','get','isAuthenticated','index'];(function(_0x2c2ced,_0x57af0a){var _0x2d4457=function(_0x46d2aa){while(--_0x46d2aa){_0x2c2ced['push'](_0x2c2ced['shift']());}};_0x2d4457(++_0x57af0a);}(_0xe86d,0x107));var _0xde86=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe86d[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xde86('0x0'));var util=require(_0xde86('0x1'));var path=require('path');var timeout=require(_0xde86('0x2'));var express=require(_0xde86('0x3'));var router=express[_0xde86('0x4')]();var fs_extra=require(_0xde86('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xde86('0x6'));router[_0xde86('0x7')]('/',auth[_0xde86('0x8')](),controller[_0xde86('0x9')]);router[_0xde86('0x7')](_0xde86('0xa'),auth[_0xde86('0x8')](),controller['show']);router['get'](_0xde86('0xb'),auth[_0xde86('0x8')](),controller[_0xde86('0xc')]);router[_0xde86('0xd')]('/',auth[_0xde86('0x8')](),controller['create']);router['post'](_0xde86('0xb'),auth[_0xde86('0x8')](),controller[_0xde86('0xe')]);router[_0xde86('0xf')](_0xde86('0xa'),auth[_0xde86('0x8')](),controller[_0xde86('0x10')]);router[_0xde86('0x11')](_0xde86('0xa'),auth['isAuthenticated'](),controller[_0xde86('0x12')]);router[_0xde86('0x11')](_0xde86('0x13'),auth[_0xde86('0x8')](),controller[_0xde86('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 73c7ffb..189092d 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 _0x2e76=['BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','mp3','alpha','TIMESTAMP'];(function(_0x56d1c9,_0x98c2c5){var _0x388006=function(_0x5796bc){while(--_0x5796bc){_0x56d1c9['push'](_0x56d1c9['shift']());}};_0x388006(++_0x98c2c5);}(_0x2e76,0x1d5));var _0x62e7=function(_0x4e8f49,_0x48057a){_0x4e8f49=_0x4e8f49-0x0;var _0x1d6194=_0x2e76[_0x4e8f49];return _0x1d6194;};'use strict';var Sequelize=require(_0x62e7('0x0'));module[_0x62e7('0x1')]={'name':{'type':Sequelize[_0x62e7('0x2')],'allowNull':![],'unique':_0x62e7('0x3')},'mode':{'type':Sequelize[_0x62e7('0x4')](_0x62e7('0x5'),_0x62e7('0x6'),_0x62e7('0x7'),'quietmp3nb','quietmp3',_0x62e7('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x62e7('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x62e7('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x62e7('0x2')],'allowNull':!![],'defaultValue':_0x62e7('0x9')},'format':{'type':Sequelize[_0x62e7('0x2')],'allowNull':!![]},'stamp':{'type':_0x62e7('0xa')},'defaultEntry':{'type':Sequelize[_0x62e7('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9931=['files','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','STRING','custom'];(function(_0x218ca4,_0x41cc40){var _0x1b3ff9=function(_0x5003cd){while(--_0x5003cd){_0x218ca4['push'](_0x218ca4['shift']());}};_0x1b3ff9(++_0x41cc40);}(_0x9931,0xcd));var _0x1993=function(_0x3bfb3c,_0x3c24c3){_0x3bfb3c=_0x3bfb3c-0x0;var _0x4a0919=_0x9931[_0x3bfb3c];return _0x4a0919;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1993('0x0')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0x1993('0x1'),_0x1993('0x2'),'mp3nb',_0x1993('0x3'),_0x1993('0x4'),_0x1993('0x5')),'allowNull':!![],'defaultValue':_0x1993('0x2')},'directory':{'type':Sequelize[_0x1993('0x0')],'allowNull':!![]},'application':{'type':Sequelize[_0x1993('0x0')],'allowNull':!![]},'digit':{'type':Sequelize[_0x1993('0x0')],'allowNull':!![]},'sort':{'type':Sequelize[_0x1993('0x0')],'allowNull':!![],'defaultValue':_0x1993('0x6')},'format':{'type':Sequelize[_0x1993('0x0')],'allowNull':!![]},'stamp':{'type':_0x1993('0x7')},'defaultEntry':{'type':Sequelize[_0x1993('0x8')],'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 6c44b50..3f42f2d 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 _0x7372=['mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','create','sequelize','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','readdirSync','forEach','Sequelize','ValidationError','addSound','transaction','save_name','converted_format','createdAt','server/files/sounds/converted','format','basename','extname','%s.%s','symlinkSync','findOne','removeSound','id2','Sound','unlinkSync','message','getSounds','pick','rimraf','fast-json-patch','request-promise','bluebird'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7372,0x72));var _0x2737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7372[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2737('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2737('0x1'));var rp=require(_0x2737('0x2'));var moment=require('moment');var BPromise=require(_0x2737('0x3'));var Mustache=require(_0x2737('0x4'));var util=require('util');var path=require(_0x2737('0x5'));var sox=require(_0x2737('0x6'));var csv=require(_0x2737('0x7'));var ejs=require(_0x2737('0x8'));var fs=require('fs');var fs_extra=require(_0x2737('0x9'));var _=require(_0x2737('0xa'));var squel=require(_0x2737('0xb'));var crypto=require('crypto');var jsforce=require(_0x2737('0xc'));var deskjs=require(_0x2737('0xd'));var toCsv=require(_0x2737('0x7'));var querystring=require('querystring');var Papa=require(_0x2737('0xe'));var Redis=require(_0x2737('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2737('0x10'));var as=require(_0x2737('0x11'));var hardwareService=require(_0x2737('0x12'));var logger=require(_0x2737('0x13'))('api');var utils=require(_0x2737('0x14'));var config=require(_0x2737('0x15'));var licenseUtil=require(_0x2737('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43338a,_0xb7183f){_0xb7183f=_0xb7183f||0xcc;return function(_0x14a03d){if(_0x14a03d){return _0x43338a[_0x2737('0x17')](_0xb7183f);}return _0x43338a[_0x2737('0x18')](_0xb7183f)[_0x2737('0x19')]();};}function respondWithResult(_0x33ad39,_0x1a8031){_0x1a8031=_0x1a8031||0xc8;return function(_0x1dd952){if(_0x1dd952){return _0x33ad39[_0x2737('0x18')](_0x1a8031)[_0x2737('0x1a')](_0x1dd952);}};}function respondWithFilteredResult(_0x1282af,_0x48706a){return function(_0x416562){if(_0x416562){var _0x5d7edf=typeof _0x48706a[_0x2737('0x1b')]===_0x2737('0x1c')&&typeof _0x48706a['limit']===_0x2737('0x1c');var _0x3a7cc5=_0x416562[_0x2737('0x1d')];var _0x5ae9f8=_0x5d7edf?0x0:_0x48706a['offset'];var _0x84afc=_0x5d7edf?_0x416562[_0x2737('0x1d')]:_0x48706a[_0x2737('0x1b')]+_0x48706a['limit'];var _0x52b90c;if(_0x84afc>=_0x3a7cc5){_0x84afc=_0x3a7cc5;_0x52b90c=0xc8;}else{_0x52b90c=0xce;}_0x1282af[_0x2737('0x18')](_0x52b90c);return _0x1282af[_0x2737('0x1e')](_0x2737('0x1f'),_0x5ae9f8+'-'+_0x84afc+'/'+_0x3a7cc5)[_0x2737('0x1a')](_0x416562);}return null;};}function patchUpdates(_0x5a1e95){return function(_0x332966){try{jsonpatch[_0x2737('0x20')](_0x332966,_0x5a1e95,!![]);}catch(_0xad8276){return BPromise[_0x2737('0x21')](_0xad8276);}return _0x332966[_0x2737('0x22')]();};}function saveUpdates(_0x1be561,_0x19c8a5){return function(_0x211fc3){if(_0x211fc3){return _0x211fc3[_0x2737('0x23')](_0x1be561)['then'](function(_0x37c862){return _0x37c862;});}return null;};}function removeEntity(_0x1a91e8,_0x3c0e8b){return function(_0x49f119){if(_0x49f119){return _0x49f119[_0x2737('0x24')]()[_0x2737('0x25')](function(){var _0x59fe99=_0x49f119[_0x2737('0x26')]({'plain':!![]});var _0x5be241='MusicOnHolds';return db[_0x2737('0x27')]['destroy']({'where':{'type':_0x5be241,'resourceId':_0x59fe99['id']}})['then'](function(){return _0x49f119;});})['then'](function(){_0x1a91e8['status'](0xcc)[_0x2737('0x19')]();});}};}function handleEntityNotFound(_0x423066,_0x15b45f){return function(_0x4152c4){if(!_0x4152c4){_0x423066[_0x2737('0x17')](0x194);}return _0x4152c4;};}function handleError(_0x81d13f,_0x47d319){_0x47d319=_0x47d319||0x1f4;return function(_0x324fb9){logger['error'](_0x324fb9[_0x2737('0x28')]);if(_0x324fb9[_0x2737('0x29')]){delete _0x324fb9[_0x2737('0x29')];}_0x81d13f[_0x2737('0x18')](_0x47d319)[_0x2737('0x2a')](_0x324fb9);};}exports[_0x2737('0x2b')]=function(_0x55437a,_0x39a71d){var _0x189b69={},_0x18e7de={},_0x104c7f={'count':0x0,'rows':[]};var _0x2bf4f8=_[_0x2737('0x2c')](db[_0x2737('0x2d')][_0x2737('0x2e')],function(_0x3e1fc8){return{'name':_0x3e1fc8[_0x2737('0x2f')],'type':_0x3e1fc8['type'][_0x2737('0x30')]};});_0x18e7de['model']=_['map'](_0x2bf4f8,'name');_0x18e7de[_0x2737('0x31')]=_[_0x2737('0x32')](_0x55437a[_0x2737('0x31')]);_0x18e7de['filters']=_[_0x2737('0x33')](_0x18e7de['model'],_0x18e7de[_0x2737('0x31')]);_0x189b69[_0x2737('0x34')]=_[_0x2737('0x33')](_0x18e7de[_0x2737('0x35')],qs[_0x2737('0x36')](_0x55437a[_0x2737('0x31')][_0x2737('0x36')]));_0x189b69[_0x2737('0x34')]=_0x189b69[_0x2737('0x34')][_0x2737('0x37')]?_0x189b69[_0x2737('0x34')]:_0x18e7de[_0x2737('0x35')];if(!_0x55437a[_0x2737('0x31')][_0x2737('0x38')](_0x2737('0x39'))){_0x189b69[_0x2737('0x3a')]=qs[_0x2737('0x3a')](_0x55437a[_0x2737('0x31')][_0x2737('0x3a')]);_0x189b69[_0x2737('0x1b')]=qs['offset'](_0x55437a[_0x2737('0x31')][_0x2737('0x1b')]);}_0x189b69[_0x2737('0x3b')]=qs[_0x2737('0x3c')](_0x55437a[_0x2737('0x31')][_0x2737('0x3c')]);delete _0x55437a['query'][_0x2737('0x3c')];_0x189b69[_0x2737('0x3d')]=qs[_0x2737('0x3e')](_['pick'](_0x55437a[_0x2737('0x31')],_0x18e7de['filters']),_0x2bf4f8);if(_0x55437a['query']['filter']){_0x189b69['where']=_[_0x2737('0x3f')](_0x189b69[_0x2737('0x3d')],{'$or':_[_0x2737('0x2c')](_0x2bf4f8,function(_0xeead16){if(_0xeead16[_0x2737('0x40')]!==_0x2737('0x41')){var _0x398f9c={};_0x398f9c[_0xeead16[_0x2737('0x29')]]={'$like':'%'+_0x55437a[_0x2737('0x31')][_0x2737('0x42')]+'%'};return _0x398f9c;}})});}_0x189b69=_['merge']({},_0x189b69,_0x55437a[_0x2737('0x43')]);var _0x4129bb={'where':_0x189b69[_0x2737('0x3d')]};return db[_0x2737('0x2d')][_0x2737('0x1d')](_0x4129bb)['then'](function(_0x2109e0){_0x104c7f['count']=_0x2109e0;if(_0x55437a[_0x2737('0x31')][_0x2737('0x44')]){_0x189b69[_0x2737('0x45')]=[{'all':!![]}];}return db[_0x2737('0x2d')][_0x2737('0x46')](_0x189b69);})['then'](function(_0x1c73f9){_0x104c7f[_0x2737('0x47')]=_0x1c73f9;return _0x104c7f;})[_0x2737('0x25')](respondWithFilteredResult(_0x39a71d,_0x189b69))[_0x2737('0x48')](handleError(_0x39a71d,null));};exports[_0x2737('0x49')]=function(_0x281f1c,_0x4ab118){var _0x48b029={'raw':![],'where':{'id':_0x281f1c['params']['id']}},_0xc8e6f8={};_0xc8e6f8[_0x2737('0x35')]=_[_0x2737('0x32')](db[_0x2737('0x2d')][_0x2737('0x2e')]);_0xc8e6f8[_0x2737('0x31')]=_[_0x2737('0x32')](_0x281f1c[_0x2737('0x31')]);_0xc8e6f8[_0x2737('0x3e')]=_[_0x2737('0x33')](_0xc8e6f8['model'],_0xc8e6f8[_0x2737('0x31')]);_0x48b029['attributes']=_[_0x2737('0x33')](_0xc8e6f8['model'],qs['fields'](_0x281f1c[_0x2737('0x31')][_0x2737('0x36')]));_0x48b029['attributes']=_0x48b029[_0x2737('0x34')]['length']?_0x48b029[_0x2737('0x34')]:_0xc8e6f8[_0x2737('0x35')];if(_0x281f1c['query'][_0x2737('0x44')]){_0x48b029[_0x2737('0x45')]=[{'all':!![]}];}_0x48b029=_[_0x2737('0x3f')]({},_0x48b029,_0x281f1c[_0x2737('0x43')]);return db[_0x2737('0x2d')][_0x2737('0x4a')](_0x48b029)['then'](handleEntityNotFound(_0x4ab118,null))[_0x2737('0x25')](respondWithResult(_0x4ab118,null))[_0x2737('0x48')](handleError(_0x4ab118,null));};exports[_0x2737('0x23')]=function(_0x28442e,_0x8410fd){if(_0x28442e[_0x2737('0x4b')]['id']){delete _0x28442e[_0x2737('0x4b')]['id'];}return db[_0x2737('0x2d')][_0x2737('0x4a')]({'where':{'id':_0x28442e['params']['id']}})[_0x2737('0x25')](handleEntityNotFound(_0x8410fd,null))[_0x2737('0x25')](saveUpdates(_0x28442e[_0x2737('0x4b')],null))[_0x2737('0x25')](respondWithResult(_0x8410fd,null))[_0x2737('0x48')](handleError(_0x8410fd,null));};exports[_0x2737('0x4c')]=function(_0x45be01,_0x54594f,_0x4e2d27){return db[_0x2737('0x4d')]['transaction'](function(_0x2c0ce7){if(_0x45be01[_0x2737('0x4b')][_0x2737('0x4e')]===_0x2737('0x4f')){_0x45be01[_0x2737('0x4b')][_0x2737('0x50')]=path[_0x2737('0x51')](config[_0x2737('0x52')],_0x2737('0x53'),_0x45be01[_0x2737('0x4b')][_0x2737('0x29')]);}return db[_0x2737('0x2d')][_0x2737('0x4c')](_0x45be01[_0x2737('0x4b')],{'transaction':_0x2c0ce7})[_0x2737('0x25')](function(_0x23e893){if(_0x45be01[_0x2737('0x4b')][_0x2737('0x4e')]==='files'){fs['mkdirSync'](_0x23e893[_0x2737('0x50')],parseInt(_0x2737('0x54'),0x8));}var _0x5c97c6=_0x45be01[_0x2737('0x55')][_0x2737('0x26')]({'plain':!![]});if(!_0x5c97c6)throw new Error(_0x2737('0x56'));if(_0x5c97c6[_0x2737('0x57')]===_0x2737('0x55')){var _0x3dc115=_0x23e893[_0x2737('0x26')]({'plain':!![]});return db[_0x2737('0x58')][_0x2737('0x4a')]({'where':{'name':_0x2737('0x59'),'userProfileId':_0x5c97c6[_0x2737('0x5a')]},'raw':!![]})[_0x2737('0x25')](function(_0x196b47){if(_0x196b47&&_0x196b47[_0x2737('0x5b')]===0x0){return db[_0x2737('0x27')][_0x2737('0x4c')]({'name':_0x3dc115[_0x2737('0x29')],'resourceId':_0x3dc115['id'],'type':_0x196b47[_0x2737('0x29')],'sectionId':_0x196b47['id']},{})[_0x2737('0x25')](function(){return _0x23e893;});}else{return _0x23e893;}})[_0x2737('0x48')](function(_0x4b7617){logger[_0x2737('0x5c')](_0x2737('0x5d'),_0x4b7617);});}return _0x23e893;});})[_0x2737('0x25')](respondWithResult(_0x54594f,0xc9))[_0x2737('0x48')](handleError(_0x54594f,null));};exports[_0x2737('0x24')]=function(_0x794a4c,_0x37b446,_0xa40785){var _0x4b27c7;return db[_0x2737('0x2d')][_0x2737('0x4a')]({'where':{'id':_0x794a4c[_0x2737('0x5e')]['id']}})[_0x2737('0x25')](function(_0x2d9719){if(_0x2d9719){return db['sequelize']['transaction'](function(_0x2c048c){return _0x2d9719[_0x2737('0x24')]({'transaction':_0x2c048c,'raw':!![]})[_0x2737('0x25')](function(_0x21bc17){if(_0x21bc17[_0x2737('0x50')]){fs[_0x2737('0x5f')](_0x21bc17[_0x2737('0x50')])[_0x2737('0x60')](function(_0x20db6d){fs['unlinkSync'](path[_0x2737('0x51')](_0x21bc17[_0x2737('0x50')],_0x20db6d));});fs['rmdirSync'](_0x21bc17[_0x2737('0x50')]);}return _0x21bc17;});})['catch'](function(_0x1bba56){throw new db[(_0x2737('0x61'))][(_0x2737('0x62'))](_0x1bba56['message']);});}})[_0x2737('0x25')](handleEntityNotFound(_0x37b446,null))[_0x2737('0x25')](removeEntity(_0x37b446,null))[_0x2737('0x48')](handleError(_0x37b446,null));};exports[_0x2737('0x63')]=function(_0x41921a,_0x1d67ba,_0x82ef19){return db[_0x2737('0x4d')][_0x2737('0x64')](function(_0x5956ae){var _0x240e34;return db[_0x2737('0x2d')][_0x2737('0x4a')]({'where':{'id':_0x41921a[_0x2737('0x5e')]['id']}})['then'](function(_0x267f0b){if(_0x267f0b){_0x240e34=_0x267f0b;return _0x267f0b['addSound'](_0x41921a['body']['id'],{'transaction':_0x5956ae});}})[_0x2737('0x25')](function(_0xb0af9d){if(_0xb0af9d){return db['Sound']['findOne']({'where':{'id':_0x41921a['body']['id']},'attributes':['id',_0x2737('0x29'),_0x2737('0x65'),_0x2737('0x66'),_0x2737('0x67')],'raw':!![]});}})[_0x2737('0x25')](function(_0x457162){if(_0x457162){var _0x46b8ca=path[_0x2737('0x51')](config[_0x2737('0x52')],_0x2737('0x68'),util[_0x2737('0x69')]('%s.%s',path[_0x2737('0x6a')](_0x457162[_0x2737('0x65')],path[_0x2737('0x6b')](_0x457162[_0x2737('0x65')])),_0x457162[_0x2737('0x66')]));var _0x49a737=path['join'](config[_0x2737('0x52')],_0x2737('0x53'),_0x240e34[_0x2737('0x29')],util[_0x2737('0x69')](_0x2737('0x6c'),_0x457162[_0x2737('0x29')],_0x457162[_0x2737('0x66')]));fs[_0x2737('0x6d')](_0x46b8ca,_0x49a737);return _0x457162;}})[_0x2737('0x48')](function(_0x3585de){throw new db[(_0x2737('0x61'))]['ValidationError'](_0x3585de['message']);});})[_0x2737('0x25')](handleEntityNotFound(_0x1d67ba,null))[_0x2737('0x25')](respondWithResult(_0x1d67ba,0xc9))[_0x2737('0x48')](handleError(_0x1d67ba,null));};exports['removeSound']=function(_0xb6ceb6,_0x452010,_0x1378c3){return db[_0x2737('0x4d')]['transaction'](function(_0xa39658){var _0x123cd5;return db['VoiceMusicOnHold'][_0x2737('0x6e')]({'where':{'id':_0xb6ceb6[_0x2737('0x5e')]['id']}})[_0x2737('0x25')](handleEntityNotFound(_0x452010,null))[_0x2737('0x25')](function(_0x290bd9){if(_0x290bd9){_0x123cd5=_0x290bd9;return _0x290bd9[_0x2737('0x6f')](_0xb6ceb6[_0x2737('0x5e')][_0x2737('0x70')]);}})['then'](function(_0x567f42){if(_0x567f42){return db[_0x2737('0x71')][_0x2737('0x6e')]({'where':{'id':_0xb6ceb6['params'][_0x2737('0x70')]},'attributes':['id',_0x2737('0x29'),_0x2737('0x65'),_0x2737('0x66'),_0x2737('0x67')],'raw':!![]});}})[_0x2737('0x25')](function(_0x4c260b){if(_0x4c260b){fs[_0x2737('0x72')](path['join'](_0x123cd5[_0x2737('0x50')],util[_0x2737('0x69')](_0x2737('0x6c'),_0x4c260b[_0x2737('0x29')],_0x4c260b[_0x2737('0x66')])));return _0x4c260b;}})[_0x2737('0x48')](function(_0x144273){throw new db[(_0x2737('0x61'))][(_0x2737('0x62'))](_0x144273[_0x2737('0x73')]);});})[_0x2737('0x25')](handleEntityNotFound(_0x452010,null))[_0x2737('0x25')](respondWithStatusCode(_0x452010,0xcc))['catch'](handleError(_0x452010,null));};exports[_0x2737('0x74')]=function(_0x2818c0,_0x435d12,_0x2ac59e){var _0x2104e4={};var _0x372e13={};var _0x3e1d51;var _0x4a03f4;return db['VoiceMusicOnHold'][_0x2737('0x6e')]({'where':{'id':_0x2818c0[_0x2737('0x5e')]['id']}})[_0x2737('0x25')](handleEntityNotFound(_0x435d12,null))[_0x2737('0x25')](function(_0x12ceb4){if(_0x12ceb4){_0x3e1d51=_0x12ceb4;_0x372e13['model']=_[_0x2737('0x32')](db[_0x2737('0x71')][_0x2737('0x2e')]);_0x372e13[_0x2737('0x31')]=_[_0x2737('0x32')](_0x2818c0['query']);_0x372e13[_0x2737('0x3e')]=_['intersection'](_0x372e13[_0x2737('0x35')],_0x372e13['query']);_0x2104e4[_0x2737('0x34')]=_[_0x2737('0x33')](_0x372e13[_0x2737('0x35')],qs[_0x2737('0x36')](_0x2818c0[_0x2737('0x31')][_0x2737('0x36')]));_0x2104e4[_0x2737('0x34')]=_0x2104e4[_0x2737('0x34')][_0x2737('0x37')]?_0x2104e4[_0x2737('0x34')]:_0x372e13[_0x2737('0x35')];_0x2104e4[_0x2737('0x3b')]=qs[_0x2737('0x3c')](_0x2818c0['query'][_0x2737('0x3c')]);_0x2104e4['where']=qs[_0x2737('0x3e')](_[_0x2737('0x75')](_0x2818c0['query'],_0x372e13[_0x2737('0x3e')]));if(_0x2818c0[_0x2737('0x31')][_0x2737('0x42')]){_0x2104e4[_0x2737('0x3d')]=_[_0x2737('0x3f')](_0x2104e4['where'],{'$or':_[_0x2737('0x2c')](_0x2104e4[_0x2737('0x34')],function(_0x5c1b8f){var _0x320f3f={};_0x320f3f[_0x5c1b8f]={'$like':'%'+_0x2818c0['query'][_0x2737('0x42')]+'%'};return _0x320f3f;})});}_0x2104e4=_[_0x2737('0x3f')]({},_0x2104e4,_0x2818c0[_0x2737('0x43')]);return _0x3e1d51[_0x2737('0x74')](_0x2104e4);}})['then'](function(_0x5eec06){if(_0x5eec06){_0x4a03f4=_0x5eec06[_0x2737('0x37')];if(!_0x2818c0[_0x2737('0x31')]['hasOwnProperty'](_0x2737('0x39'))){_0x2104e4['limit']=qs[_0x2737('0x3a')](_0x2818c0[_0x2737('0x31')]['limit']);_0x2104e4['offset']=qs[_0x2737('0x1b')](_0x2818c0['query']['offset']);}return _0x3e1d51[_0x2737('0x74')](_0x2104e4);}})[_0x2737('0x25')](function(_0x41c150){if(_0x41c150){return _0x41c150?{'count':_0x4a03f4,'rows':_0x41c150}:null;}})['then'](respondWithResult(_0x435d12,null))['catch'](handleError(_0x435d12,null));}; \ No newline at end of file +var _0x795f=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','then','get','MusicOnHolds','UserProfileResource','end','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','sort','where','filters','filter','merge','options','includeAll','include','rows','catch','show','length','find','body','params','sequelize','transaction','files','directory','join','root','server/files/moh','create','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','save_name','converted_format','server/files/sounds/converted','%s.%s','basename','extname','format','symlinkSync','removeSound','findOne','id2','Sound','createdAt','message','pick','getSounds','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x150eaf,_0xcc6e33){var _0x41c3dd=function(_0x56624b){while(--_0x56624b){_0x150eaf['push'](_0x150eaf['shift']());}};_0x41c3dd(++_0xcc6e33);}(_0x795f,0xcf));var _0xf795=function(_0x46b20b,_0x7c3ca7){_0x46b20b=_0x46b20b-0x0;var _0x3cd8bd=_0x795f[_0x46b20b];return _0x3cd8bd;};'use strict';var emlformat=require(_0xf795('0x0'));var rimraf=require(_0xf795('0x1'));var zipdir=require(_0xf795('0x2'));var jsonpatch=require(_0xf795('0x3'));var rp=require(_0xf795('0x4'));var moment=require(_0xf795('0x5'));var BPromise=require(_0xf795('0x6'));var Mustache=require('mustache');var util=require(_0xf795('0x7'));var path=require(_0xf795('0x8'));var sox=require(_0xf795('0x9'));var csv=require(_0xf795('0xa'));var ejs=require(_0xf795('0xb'));var fs=require('fs');var fs_extra=require(_0xf795('0xc'));var _=require('lodash');var squel=require(_0xf795('0xd'));var crypto=require(_0xf795('0xe'));var jsforce=require(_0xf795('0xf'));var deskjs=require(_0xf795('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf795('0x11'));var Redis=require('ioredis');var authService=require(_0xf795('0x12'));var qs=require(_0xf795('0x13'));var as=require(_0xf795('0x14'));var hardwareService=require(_0xf795('0x15'));var logger=require(_0xf795('0x16'))(_0xf795('0x17'));var utils=require(_0xf795('0x18'));var config=require(_0xf795('0x19'));var licenseUtil=require(_0xf795('0x1a'));var db=require(_0xf795('0x1b'))['db'];function respondWithStatusCode(_0x507bd1,_0x13d9f1){_0x13d9f1=_0x13d9f1||0xcc;return function(_0x2f39a8){if(_0x2f39a8){return _0x507bd1[_0xf795('0x1c')](_0x13d9f1);}return _0x507bd1['status'](_0x13d9f1)['end']();};}function respondWithResult(_0x379be9,_0x54fa25){_0x54fa25=_0x54fa25||0xc8;return function(_0x5748dc){if(_0x5748dc){return _0x379be9[_0xf795('0x1d')](_0x54fa25)[_0xf795('0x1e')](_0x5748dc);}};}function respondWithFilteredResult(_0x4f4476,_0x37a463){return function(_0x1ed363){if(_0x1ed363){var _0x2d42f1=typeof _0x37a463[_0xf795('0x1f')]==='undefined'&&typeof _0x37a463[_0xf795('0x20')]===_0xf795('0x21');var _0x4ba99b=_0x1ed363[_0xf795('0x22')];var _0x2605a=_0x2d42f1?0x0:_0x37a463[_0xf795('0x1f')];var _0x3f7136=_0x2d42f1?_0x1ed363[_0xf795('0x22')]:_0x37a463[_0xf795('0x1f')]+_0x37a463[_0xf795('0x20')];var _0x1bef29;if(_0x3f7136>=_0x4ba99b){_0x3f7136=_0x4ba99b;_0x1bef29=0xc8;}else{_0x1bef29=0xce;}_0x4f4476['status'](_0x1bef29);return _0x4f4476['set'](_0xf795('0x23'),_0x2605a+'-'+_0x3f7136+'/'+_0x4ba99b)['json'](_0x1ed363);}return null;};}function patchUpdates(_0x4a2869){return function(_0x24aecb){try{jsonpatch['apply'](_0x24aecb,_0x4a2869,!![]);}catch(_0x435bc3){return BPromise['reject'](_0x435bc3);}return _0x24aecb['save']();};}function saveUpdates(_0x4c97bd,_0x42d07b){return function(_0x196c45){if(_0x196c45){return _0x196c45['update'](_0x4c97bd)['then'](function(_0xcad389){return _0xcad389;});}return null;};}function removeEntity(_0x3c77c7,_0x17595a){return function(_0x3ea206){if(_0x3ea206){return _0x3ea206['destroy']()[_0xf795('0x24')](function(){var _0x3b4e3c=_0x3ea206[_0xf795('0x25')]({'plain':!![]});var _0x166d67=_0xf795('0x26');return db[_0xf795('0x27')]['destroy']({'where':{'type':_0x166d67,'resourceId':_0x3b4e3c['id']}})[_0xf795('0x24')](function(){return _0x3ea206;});})['then'](function(){_0x3c77c7[_0xf795('0x1d')](0xcc)[_0xf795('0x28')]();});}};}function handleEntityNotFound(_0x20eb97,_0x3b695c){return function(_0x197ed2){if(!_0x197ed2){_0x20eb97['sendStatus'](0x194);}return _0x197ed2;};}function handleError(_0x4123f1,_0x3a1a62){_0x3a1a62=_0x3a1a62||0x1f4;return function(_0x5795bc){logger[_0xf795('0x29')](_0x5795bc[_0xf795('0x2a')]);if(_0x5795bc['name']){delete _0x5795bc[_0xf795('0x2b')];}_0x4123f1[_0xf795('0x1d')](_0x3a1a62)[_0xf795('0x2c')](_0x5795bc);};}exports[_0xf795('0x2d')]=function(_0x4277dc,_0x50839d){var _0x5094e4={},_0x42e099={},_0x2cc931={'count':0x0,'rows':[]};var _0x47a3ee=_[_0xf795('0x2e')](db[_0xf795('0x2f')][_0xf795('0x30')],function(_0x332eef){return{'name':_0x332eef[_0xf795('0x31')],'type':_0x332eef[_0xf795('0x32')]['key']};});_0x42e099[_0xf795('0x33')]=_['map'](_0x47a3ee,'name');_0x42e099[_0xf795('0x34')]=_[_0xf795('0x35')](_0x4277dc[_0xf795('0x34')]);_0x42e099['filters']=_['intersection'](_0x42e099[_0xf795('0x33')],_0x42e099[_0xf795('0x34')]);_0x5094e4['attributes']=_[_0xf795('0x36')](_0x42e099[_0xf795('0x33')],qs[_0xf795('0x37')](_0x4277dc[_0xf795('0x34')][_0xf795('0x37')]));_0x5094e4[_0xf795('0x38')]=_0x5094e4[_0xf795('0x38')]['length']?_0x5094e4['attributes']:_0x42e099[_0xf795('0x33')];if(!_0x4277dc[_0xf795('0x34')]['hasOwnProperty']('nolimit')){_0x5094e4[_0xf795('0x20')]=qs[_0xf795('0x20')](_0x4277dc['query'][_0xf795('0x20')]);_0x5094e4[_0xf795('0x1f')]=qs['offset'](_0x4277dc[_0xf795('0x34')][_0xf795('0x1f')]);}_0x5094e4['order']=qs[_0xf795('0x39')](_0x4277dc[_0xf795('0x34')][_0xf795('0x39')]);delete _0x4277dc[_0xf795('0x34')][_0xf795('0x39')];_0x5094e4[_0xf795('0x3a')]=qs[_0xf795('0x3b')](_['pick'](_0x4277dc[_0xf795('0x34')],_0x42e099[_0xf795('0x3b')]),_0x47a3ee);if(_0x4277dc[_0xf795('0x34')][_0xf795('0x3c')]){_0x5094e4[_0xf795('0x3a')]=_[_0xf795('0x3d')](_0x5094e4[_0xf795('0x3a')],{'$or':_['map'](_0x47a3ee,function(_0x3ef237){if(_0x3ef237['type']!=='VIRTUAL'){var _0x3abee9={};_0x3abee9[_0x3ef237['name']]={'$like':'%'+_0x4277dc[_0xf795('0x34')][_0xf795('0x3c')]+'%'};return _0x3abee9;}})});}_0x5094e4=_[_0xf795('0x3d')]({},_0x5094e4,_0x4277dc[_0xf795('0x3e')]);var _0x5380e2={'where':_0x5094e4[_0xf795('0x3a')]};return db[_0xf795('0x2f')][_0xf795('0x22')](_0x5380e2)[_0xf795('0x24')](function(_0x1d10ac){_0x2cc931[_0xf795('0x22')]=_0x1d10ac;if(_0x4277dc[_0xf795('0x34')][_0xf795('0x3f')]){_0x5094e4[_0xf795('0x40')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x5094e4);})[_0xf795('0x24')](function(_0x1b9959){_0x2cc931[_0xf795('0x41')]=_0x1b9959;return _0x2cc931;})['then'](respondWithFilteredResult(_0x50839d,_0x5094e4))[_0xf795('0x42')](handleError(_0x50839d,null));};exports[_0xf795('0x43')]=function(_0x301d7f,_0x3ffa12){var _0x198cbc={'raw':![],'where':{'id':_0x301d7f['params']['id']}},_0x511701={};_0x511701[_0xf795('0x33')]=_[_0xf795('0x35')](db[_0xf795('0x2f')][_0xf795('0x30')]);_0x511701[_0xf795('0x34')]=_['keys'](_0x301d7f[_0xf795('0x34')]);_0x511701[_0xf795('0x3b')]=_[_0xf795('0x36')](_0x511701[_0xf795('0x33')],_0x511701[_0xf795('0x34')]);_0x198cbc['attributes']=_['intersection'](_0x511701[_0xf795('0x33')],qs[_0xf795('0x37')](_0x301d7f[_0xf795('0x34')]['fields']));_0x198cbc[_0xf795('0x38')]=_0x198cbc['attributes'][_0xf795('0x44')]?_0x198cbc[_0xf795('0x38')]:_0x511701[_0xf795('0x33')];if(_0x301d7f[_0xf795('0x34')][_0xf795('0x3f')]){_0x198cbc['include']=[{'all':!![]}];}_0x198cbc=_[_0xf795('0x3d')]({},_0x198cbc,_0x301d7f[_0xf795('0x3e')]);return db['VoiceMusicOnHold'][_0xf795('0x45')](_0x198cbc)['then'](handleEntityNotFound(_0x3ffa12,null))[_0xf795('0x24')](respondWithResult(_0x3ffa12,null))[_0xf795('0x42')](handleError(_0x3ffa12,null));};exports['update']=function(_0x7964e,_0x1ebfcb){if(_0x7964e['body']['id']){delete _0x7964e[_0xf795('0x46')]['id'];}return db[_0xf795('0x2f')][_0xf795('0x45')]({'where':{'id':_0x7964e[_0xf795('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ebfcb,null))['then'](saveUpdates(_0x7964e[_0xf795('0x46')],null))[_0xf795('0x24')](respondWithResult(_0x1ebfcb,null))[_0xf795('0x42')](handleError(_0x1ebfcb,null));};exports['create']=function(_0x5f201a,_0x1b7797,_0x36edb5){return db[_0xf795('0x48')][_0xf795('0x49')](function(_0x94a1c7){if(_0x5f201a['body']['mode']===_0xf795('0x4a')){_0x5f201a[_0xf795('0x46')][_0xf795('0x4b')]=path[_0xf795('0x4c')](config[_0xf795('0x4d')],_0xf795('0x4e'),_0x5f201a[_0xf795('0x46')][_0xf795('0x2b')]);}return db['VoiceMusicOnHold'][_0xf795('0x4f')](_0x5f201a[_0xf795('0x46')],{'transaction':_0x94a1c7})[_0xf795('0x24')](function(_0x51d476){if(_0x5f201a['body']['mode']===_0xf795('0x4a')){fs[_0xf795('0x50')](_0x51d476[_0xf795('0x4b')],parseInt(_0xf795('0x51'),0x8));}var _0x4499fa=_0x5f201a[_0xf795('0x52')][_0xf795('0x25')]({'plain':!![]});if(!_0x4499fa)throw new Error(_0xf795('0x53'));if(_0x4499fa['role']===_0xf795('0x52')){var _0x4f72c2=_0x51d476[_0xf795('0x25')]({'plain':!![]});return db[_0xf795('0x54')][_0xf795('0x45')]({'where':{'name':_0xf795('0x26'),'userProfileId':_0x4499fa['userProfileId']},'raw':!![]})[_0xf795('0x24')](function(_0x2a1db6){if(_0x2a1db6&&_0x2a1db6['autoAssociation']===0x0){return db[_0xf795('0x27')][_0xf795('0x4f')]({'name':_0x4f72c2['name'],'resourceId':_0x4f72c2['id'],'type':_0x2a1db6['name'],'sectionId':_0x2a1db6['id']},{})[_0xf795('0x24')](function(){return _0x51d476;});}else{return _0x51d476;}})[_0xf795('0x42')](function(_0x167416){logger[_0xf795('0x29')](_0xf795('0x55'),_0x167416);});}return _0x51d476;});})['then'](respondWithResult(_0x1b7797,0xc9))[_0xf795('0x42')](handleError(_0x1b7797,null));};exports['destroy']=function(_0x47dfe3,_0x154a9e,_0x242c14){var _0x1771e1;return db[_0xf795('0x2f')][_0xf795('0x45')]({'where':{'id':_0x47dfe3[_0xf795('0x47')]['id']}})[_0xf795('0x24')](function(_0x558d59){if(_0x558d59){return db['sequelize'][_0xf795('0x49')](function(_0x44baa1){return _0x558d59[_0xf795('0x56')]({'transaction':_0x44baa1,'raw':!![]})[_0xf795('0x24')](function(_0x412f81){if(_0x412f81['directory']){fs[_0xf795('0x57')](_0x412f81[_0xf795('0x4b')])[_0xf795('0x58')](function(_0x1f10f0){fs[_0xf795('0x59')](path[_0xf795('0x4c')](_0x412f81['directory'],_0x1f10f0));});fs[_0xf795('0x5a')](_0x412f81['directory']);}return _0x412f81;});})[_0xf795('0x42')](function(_0x4d1b33){throw new db[(_0xf795('0x5b'))][(_0xf795('0x5c'))](_0x4d1b33['message']);});}})[_0xf795('0x24')](handleEntityNotFound(_0x154a9e,null))[_0xf795('0x24')](removeEntity(_0x154a9e,null))[_0xf795('0x42')](handleError(_0x154a9e,null));};exports['addSound']=function(_0x14b312,_0x3e296b,_0x5af172){return db[_0xf795('0x48')][_0xf795('0x49')](function(_0x565e95){var _0x166861;return db[_0xf795('0x2f')][_0xf795('0x45')]({'where':{'id':_0x14b312[_0xf795('0x47')]['id']}})['then'](function(_0x55f977){if(_0x55f977){_0x166861=_0x55f977;return _0x55f977[_0xf795('0x5d')](_0x14b312[_0xf795('0x46')]['id'],{'transaction':_0x565e95});}})['then'](function(_0x414b6d){if(_0x414b6d){return db['Sound']['findOne']({'where':{'id':_0x14b312[_0xf795('0x46')]['id']},'attributes':['id','name',_0xf795('0x5e'),_0xf795('0x5f'),'createdAt'],'raw':!![]});}})[_0xf795('0x24')](function(_0x1cdd72){if(_0x1cdd72){var _0x4f2a30=path[_0xf795('0x4c')](config[_0xf795('0x4d')],_0xf795('0x60'),util['format'](_0xf795('0x61'),path[_0xf795('0x62')](_0x1cdd72['save_name'],path[_0xf795('0x63')](_0x1cdd72['save_name'])),_0x1cdd72['converted_format']));var _0x48a2d6=path[_0xf795('0x4c')](config[_0xf795('0x4d')],_0xf795('0x4e'),_0x166861[_0xf795('0x2b')],util[_0xf795('0x64')](_0xf795('0x61'),_0x1cdd72[_0xf795('0x2b')],_0x1cdd72[_0xf795('0x5f')]));fs[_0xf795('0x65')](_0x4f2a30,_0x48a2d6);return _0x1cdd72;}})[_0xf795('0x42')](function(_0x43c365){throw new db[(_0xf795('0x5b'))][(_0xf795('0x5c'))](_0x43c365['message']);});})['then'](handleEntityNotFound(_0x3e296b,null))[_0xf795('0x24')](respondWithResult(_0x3e296b,0xc9))[_0xf795('0x42')](handleError(_0x3e296b,null));};exports[_0xf795('0x66')]=function(_0x2c5d13,_0x2751cd,_0x84856c){return db[_0xf795('0x48')][_0xf795('0x49')](function(_0x51a1f0){var _0x1fab53;return db[_0xf795('0x2f')][_0xf795('0x67')]({'where':{'id':_0x2c5d13['params']['id']}})[_0xf795('0x24')](handleEntityNotFound(_0x2751cd,null))[_0xf795('0x24')](function(_0x3c7a71){if(_0x3c7a71){_0x1fab53=_0x3c7a71;return _0x3c7a71[_0xf795('0x66')](_0x2c5d13[_0xf795('0x47')][_0xf795('0x68')]);}})[_0xf795('0x24')](function(_0x2d8bef){if(_0x2d8bef){return db[_0xf795('0x69')][_0xf795('0x67')]({'where':{'id':_0x2c5d13[_0xf795('0x47')][_0xf795('0x68')]},'attributes':['id',_0xf795('0x2b'),'save_name','converted_format',_0xf795('0x6a')],'raw':!![]});}})[_0xf795('0x24')](function(_0x92d19c){if(_0x92d19c){fs[_0xf795('0x59')](path[_0xf795('0x4c')](_0x1fab53[_0xf795('0x4b')],util[_0xf795('0x64')]('%s.%s',_0x92d19c['name'],_0x92d19c[_0xf795('0x5f')])));return _0x92d19c;}})['catch'](function(_0x112661){throw new db[(_0xf795('0x5b'))][(_0xf795('0x5c'))](_0x112661[_0xf795('0x6b')]);});})[_0xf795('0x24')](handleEntityNotFound(_0x2751cd,null))[_0xf795('0x24')](respondWithStatusCode(_0x2751cd,0xcc))[_0xf795('0x42')](handleError(_0x2751cd,null));};exports['getSounds']=function(_0xc80038,_0xc41a7a,_0x4dae11){var _0xb1a628={};var _0x266789={};var _0xcadd74;var _0x4739d8;return db[_0xf795('0x2f')][_0xf795('0x67')]({'where':{'id':_0xc80038[_0xf795('0x47')]['id']}})[_0xf795('0x24')](handleEntityNotFound(_0xc41a7a,null))[_0xf795('0x24')](function(_0x50a2da){if(_0x50a2da){_0xcadd74=_0x50a2da;_0x266789[_0xf795('0x33')]=_['keys'](db[_0xf795('0x69')][_0xf795('0x30')]);_0x266789['query']=_[_0xf795('0x35')](_0xc80038[_0xf795('0x34')]);_0x266789[_0xf795('0x3b')]=_['intersection'](_0x266789[_0xf795('0x33')],_0x266789[_0xf795('0x34')]);_0xb1a628[_0xf795('0x38')]=_[_0xf795('0x36')](_0x266789[_0xf795('0x33')],qs[_0xf795('0x37')](_0xc80038[_0xf795('0x34')]['fields']));_0xb1a628[_0xf795('0x38')]=_0xb1a628['attributes'][_0xf795('0x44')]?_0xb1a628[_0xf795('0x38')]:_0x266789['model'];_0xb1a628['order']=qs[_0xf795('0x39')](_0xc80038[_0xf795('0x34')][_0xf795('0x39')]);_0xb1a628[_0xf795('0x3a')]=qs[_0xf795('0x3b')](_[_0xf795('0x6c')](_0xc80038['query'],_0x266789[_0xf795('0x3b')]));if(_0xc80038[_0xf795('0x34')]['filter']){_0xb1a628[_0xf795('0x3a')]=_['merge'](_0xb1a628[_0xf795('0x3a')],{'$or':_[_0xf795('0x2e')](_0xb1a628[_0xf795('0x38')],function(_0xef4825){var _0x768786={};_0x768786[_0xef4825]={'$like':'%'+_0xc80038[_0xf795('0x34')][_0xf795('0x3c')]+'%'};return _0x768786;})});}_0xb1a628=_[_0xf795('0x3d')]({},_0xb1a628,_0xc80038[_0xf795('0x3e')]);return _0xcadd74[_0xf795('0x6d')](_0xb1a628);}})['then'](function(_0x119bbe){if(_0x119bbe){_0x4739d8=_0x119bbe[_0xf795('0x44')];if(!_0xc80038[_0xf795('0x34')][_0xf795('0x6e')](_0xf795('0x6f'))){_0xb1a628[_0xf795('0x20')]=qs['limit'](_0xc80038[_0xf795('0x34')]['limit']);_0xb1a628[_0xf795('0x1f')]=qs[_0xf795('0x1f')](_0xc80038[_0xf795('0x34')]['offset']);}return _0xcadd74[_0xf795('0x6d')](_0xb1a628);}})[_0xf795('0x24')](function(_0x478160){if(_0x478160){return _0x478160?{'count':_0x4739d8,'rows':_0x478160}:null;}})['then'](respondWithResult(_0xc41a7a,null))[_0xf795('0x42')](handleError(_0xc41a7a,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 7e77ac5..2be2adc 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 _0x9859=['../../config/environment','./voiceMusicOnHold.attributes','exports','util','../../config/logger','bluebird','path'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x9859,0x13e));var _0x9985=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x9859[_0x42bdad];return _0x122626;};'use strict';var _=require('lodash');var util=require(_0x9985('0x0'));var logger=require(_0x9985('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9985('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9985('0x3'));var rimraf=require('rimraf');var config=require(_0x9985('0x4'));var attributes=require(_0x9985('0x5'));module[_0x9985('0x6')]=function(_0x74eda7,_0x2dc516){return _0x74eda7['define']('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4024=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x4024,0x1b0));var _0x4402=function(_0x41b683,_0x10e5ab){_0x41b683=_0x41b683-0x0;var _0x3e8d91=_0x4024[_0x41b683];return _0x3e8d91;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var logger=require('../../config/logger')(_0x4402('0x2'));var moment=require(_0x4402('0x3'));var BPromise=require(_0x4402('0x4'));var rp=require(_0x4402('0x5'));var fs=require('fs');var path=require(_0x4402('0x6'));var rimraf=require(_0x4402('0x7'));var config=require('../../config/environment');var attributes=require(_0x4402('0x8'));module[_0x4402('0x9')]=function(_0x5d1cb2,_0x1e05e4){return _0x5d1cb2[_0x4402('0xa')]('VoiceMusicOnHold',attributes,{'tableName':_0x4402('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 fbf7880..30d068a 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x365e97,_0x5c4f4c){var _0x175fe8=function(_0x97593f){while(--_0x97593f){_0x365e97['push'](_0x365e97['shift']());}};_0x175fe8(++_0x5c4f4c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0xcb91[_0x249e96];return _0x17444c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x38e37d,_0x85eaab){var _0x245c8a=function(_0x386469){while(--_0x386469){_0x38e37d['push'](_0x38e37d['shift']());}};_0x245c8a(++_0x85eaab);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ed7d1,_0x363741){_0x2ed7d1=_0x2ed7d1-0x0;var _0x38ae3c=_0xcb91[_0x2ed7d1];return _0x38ae3c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 6e287af..e9ecd76 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 _0x9f4b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','destroy','exports'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x9f4b,0xfc));var _0xb9f4=function(_0xf6a0f5,_0x588af1){_0xf6a0f5=_0xf6a0f5-0x0;var _0x529548=_0x9f4b[_0xf6a0f5];return _0x529548;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb9f4('0x0'));var timeout=require(_0xb9f4('0x1'));var express=require(_0xb9f4('0x2'));var router=express[_0xb9f4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb9f4('0x4'));var interaction=require(_0xb9f4('0x5'));var config=require(_0xb9f4('0x6'));var controller=require(_0xb9f4('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb9f4('0x8')]);router[_0xb9f4('0x9')](_0xb9f4('0xa'),auth[_0xb9f4('0xb')](),controller[_0xb9f4('0xc')]);router['get'](_0xb9f4('0xd'),auth['isAuthenticated'](),controller[_0xb9f4('0xe')]);router[_0xb9f4('0x9')](_0xb9f4('0xf'),auth[_0xb9f4('0xb')](),controller[_0xb9f4('0x10')]);router['get'](_0xb9f4('0x11'),auth[_0xb9f4('0xb')](),controller[_0xb9f4('0x12')]);router[_0xb9f4('0x13')]('/',auth['isAuthenticated'](),controller[_0xb9f4('0x14')]);router[_0xb9f4('0x13')](_0xb9f4('0xf'),auth['isAuthenticated'](),controller[_0xb9f4('0x15')]);router[_0xb9f4('0x13')](_0xb9f4('0x11'),auth['isAuthenticated'](),controller[_0xb9f4('0x16')]);router[_0xb9f4('0x17')]('/:id',auth[_0xb9f4('0xb')](),controller[_0xb9f4('0x18')]);router[_0xb9f4('0x19')](_0xb9f4('0xd'),auth[_0xb9f4('0xb')](),controller[_0xb9f4('0x1a')]);router['delete'](_0xb9f4('0xf'),auth[_0xb9f4('0xb')](),controller['removeAgents']);router[_0xb9f4('0x19')]('/:id/teams',auth[_0xb9f4('0xb')](),controller['removeTeams']);module[_0xb9f4('0x1b')]=router; \ No newline at end of file +var _0x0ef0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/users','getTeams','post','create','addAgents','/:id/teams','addTeams','update','delete','destroy','removeAgents','removeTeams','exports','multer','util'];(function(_0xec1138,_0x55d122){var _0xf09bdb=function(_0x4bf9ce){while(--_0x4bf9ce){_0xec1138['push'](_0xec1138['shift']());}};_0xf09bdb(++_0x55d122);}(_0x0ef0,0x80));var _0x00ef=function(_0x5c0dcb,_0x16cd83){_0x5c0dcb=_0x5c0dcb-0x0;var _0x183a0e=_0x0ef0[_0x5c0dcb];return _0x183a0e;};'use strict';var multer=require(_0x00ef('0x0'));var util=require(_0x00ef('0x1'));var path=require('path');var timeout=require(_0x00ef('0x2'));var express=require(_0x00ef('0x3'));var router=express[_0x00ef('0x4')]();var fs_extra=require(_0x00ef('0x5'));var auth=require(_0x00ef('0x6'));var interaction=require(_0x00ef('0x7'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x00ef('0x8')]('/',auth[_0x00ef('0x9')](),controller[_0x00ef('0xa')]);router[_0x00ef('0x8')]('/describe',auth[_0x00ef('0x9')](),controller[_0x00ef('0xb')]);router[_0x00ef('0x8')](_0x00ef('0xc'),auth[_0x00ef('0x9')](),controller['show']);router[_0x00ef('0x8')](_0x00ef('0xd'),auth[_0x00ef('0x9')](),controller['getAgents']);router[_0x00ef('0x8')]('/:id/teams',auth[_0x00ef('0x9')](),controller[_0x00ef('0xe')]);router[_0x00ef('0xf')]('/',auth[_0x00ef('0x9')](),controller[_0x00ef('0x10')]);router['post'](_0x00ef('0xd'),auth['isAuthenticated'](),controller[_0x00ef('0x11')]);router[_0x00ef('0xf')](_0x00ef('0x12'),auth['isAuthenticated'](),controller[_0x00ef('0x13')]);router['put']('/:id',auth[_0x00ef('0x9')](),controller[_0x00ef('0x14')]);router[_0x00ef('0x15')](_0x00ef('0xc'),auth['isAuthenticated'](),controller[_0x00ef('0x16')]);router['delete'](_0x00ef('0xd'),auth[_0x00ef('0x9')](),controller[_0x00ef('0x17')]);router['delete'](_0x00ef('0x12'),auth[_0x00ef('0x9')](),controller[_0x00ef('0x18')]);module[_0x00ef('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 0bb9b7a..114584a 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 _0x72e3=['getDataValue','name','STRING','INTEGER','sequelize','exports','VIRTUAL','system-'];(function(_0x121bbc,_0x2a76a4){var _0x17539f=function(_0xe7e733){while(--_0xe7e733){_0x121bbc['push'](_0x121bbc['shift']());}};_0x17539f(++_0x2a76a4);}(_0x72e3,0x144));var _0x372e=function(_0x53a1be,_0x42dff2){_0x53a1be=_0x53a1be-0x0;var _0x38ae84=_0x72e3[_0x53a1be];return _0x38ae84;};'use strict';var Sequelize=require(_0x372e('0x0'));module[_0x372e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x372e('0x2')],'get':function(_0x1b30ae){return _0x372e('0x3')+this[_0x372e('0x4')](_0x372e('0x5'))+'-';}},'description':{'type':Sequelize[_0x372e('0x6')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x372e('0x7')]}}; \ No newline at end of file +var _0xf709=['STRING','INTEGER','sequelize','exports','VIRTUAL','system-','getDataValue','name'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0xf709,0x1c2));var _0x9f70=function(_0x100668,_0x16bfe2){_0x100668=_0x100668-0x0;var _0x3a3c61=_0xf709[_0x100668];return _0x3a3c61;};'use strict';var Sequelize=require(_0x9f70('0x0'));module[_0x9f70('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x9f70('0x2')],'get':function(_0x3717c7){return _0x9f70('0x3')+this[_0x9f70('0x4')](_0x9f70('0x5'))+'-';}},'description':{'type':Sequelize[_0x9f70('0x6')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x9f70('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 955d0c5..ef81bbe 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 _0x0b0e=['length','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','params','find','describe','sequelize','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','create','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','prefix','push','Set','CDR(prefix)=','callerIdAll','goto','charAt','findById','addAgents','omit','ids','spread','emit','isArray','userVoicePrefix:remove','findOne','User','order','getAgents','nolimit','Team','getTeams','addTeams','Agents','online','voicePause','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','TeamId','includes','all','compact','value','isEmpty','removeAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','end','json','undefined','offset','limit','status','set','apply','save','update','destroy','get','VoicePrefixes','UserProfileResource','then','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x45722f,_0x31a685){var _0x227a46=function(_0x1cc7ee){while(--_0x1cc7ee){_0x45722f['push'](_0x45722f['shift']());}};_0x227a46(++_0x31a685);}(_0x0b0e,0x187));var _0xe0b0=function(_0xe36749,_0x2a45c8){_0xe36749=_0xe36749-0x0;var _0x5d86b7=_0x0b0e[_0xe36749];return _0x5d86b7;};'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'];config[_0xe0b0('0x18')]=_[_0xe0b0('0x19')](config[_0xe0b0('0x18')],{'host':_0xe0b0('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe0b0('0x18')]));require(_0xe0b0('0x1b'))[_0xe0b0('0x1c')](socket);function respondWithStatusCode(_0x24babd,_0x177c24){_0x177c24=_0x177c24||0xcc;return function(_0x55d884){if(_0x55d884){return _0x24babd[_0xe0b0('0x1d')](_0x177c24);}return _0x24babd['status'](_0x177c24)[_0xe0b0('0x1e')]();};}function respondWithResult(_0xadee6e,_0x519ae8){_0x519ae8=_0x519ae8||0xc8;return function(_0x11fdca){if(_0x11fdca){return _0xadee6e['status'](_0x519ae8)[_0xe0b0('0x1f')](_0x11fdca);}};}function respondWithFilteredResult(_0x100204,_0x56bcc7){return function(_0x54a3eb){if(_0x54a3eb){var _0x46bb44=typeof _0x56bcc7['offset']==='undefined'&&typeof _0x56bcc7['limit']===_0xe0b0('0x20');var _0x50fa4a=_0x54a3eb['count'];var _0x10cde1=_0x46bb44?0x0:_0x56bcc7['offset'];var _0x472286=_0x46bb44?_0x54a3eb['count']:_0x56bcc7[_0xe0b0('0x21')]+_0x56bcc7[_0xe0b0('0x22')];var _0x3e10b3;if(_0x472286>=_0x50fa4a){_0x472286=_0x50fa4a;_0x3e10b3=0xc8;}else{_0x3e10b3=0xce;}_0x100204[_0xe0b0('0x23')](_0x3e10b3);return _0x100204[_0xe0b0('0x24')]('Content-Range',_0x10cde1+'-'+_0x472286+'/'+_0x50fa4a)['json'](_0x54a3eb);}return null;};}function patchUpdates(_0x2fa820){return function(_0x5512bb){try{jsonpatch[_0xe0b0('0x25')](_0x5512bb,_0x2fa820,!![]);}catch(_0x31b5f8){return BPromise['reject'](_0x31b5f8);}return _0x5512bb[_0xe0b0('0x26')]();};}function saveUpdates(_0x503883,_0x2208d0){return function(_0x49a727){if(_0x49a727){return _0x49a727[_0xe0b0('0x27')](_0x503883)['then'](function(_0x3e5c88){return _0x3e5c88;});}return null;};}function removeEntity(_0x4de537,_0x4700cc){return function(_0x4aafbe){if(_0x4aafbe){return _0x4aafbe[_0xe0b0('0x28')]()['then'](function(){var _0x362aba=_0x4aafbe[_0xe0b0('0x29')]({'plain':!![]});var _0x1f1ebd=_0xe0b0('0x2a');return db[_0xe0b0('0x2b')][_0xe0b0('0x28')]({'where':{'type':_0x1f1ebd,'resourceId':_0x362aba['id']}})['then'](function(){return _0x4aafbe;});})[_0xe0b0('0x2c')](function(){_0x4de537[_0xe0b0('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15e13b,_0x419b1f){return function(_0x36d137){if(!_0x36d137){_0x15e13b[_0xe0b0('0x1d')](0x194);}return _0x36d137;};}function handleError(_0x3cdbd5,_0x254cad){_0x254cad=_0x254cad||0x1f4;return function(_0x136bd4){logger['error'](_0x136bd4[_0xe0b0('0x2d')]);if(_0x136bd4[_0xe0b0('0x2e')]){delete _0x136bd4['name'];}_0x3cdbd5['status'](_0x254cad)[_0xe0b0('0x2f')](_0x136bd4);};}exports[_0xe0b0('0x30')]=function(_0x422575,_0x3f81d5){var _0x2ab1b1={},_0x5866e5={},_0x32acfe={'count':0x0,'rows':[]};var _0x3231fc=_[_0xe0b0('0x31')](db[_0xe0b0('0x32')][_0xe0b0('0x33')],function(_0x4fe835){return{'name':_0x4fe835[_0xe0b0('0x34')],'type':_0x4fe835[_0xe0b0('0x35')][_0xe0b0('0x36')]};});_0x5866e5[_0xe0b0('0x37')]=_[_0xe0b0('0x31')](_0x3231fc,_0xe0b0('0x2e'));_0x5866e5[_0xe0b0('0x38')]=_[_0xe0b0('0x39')](_0x422575[_0xe0b0('0x38')]);_0x5866e5[_0xe0b0('0x3a')]=_[_0xe0b0('0x3b')](_0x5866e5[_0xe0b0('0x37')],_0x5866e5[_0xe0b0('0x38')]);_0x2ab1b1[_0xe0b0('0x3c')]=_[_0xe0b0('0x3b')](_0x5866e5['model'],qs[_0xe0b0('0x3d')](_0x422575[_0xe0b0('0x38')][_0xe0b0('0x3d')]));_0x2ab1b1[_0xe0b0('0x3c')]=_0x2ab1b1[_0xe0b0('0x3c')][_0xe0b0('0x3e')]?_0x2ab1b1[_0xe0b0('0x3c')]:_0x5866e5['model'];if(!_0x422575['query']['hasOwnProperty']('nolimit')){_0x2ab1b1[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x422575[_0xe0b0('0x38')]['limit']);_0x2ab1b1[_0xe0b0('0x21')]=qs[_0xe0b0('0x21')](_0x422575[_0xe0b0('0x38')][_0xe0b0('0x21')]);}_0x2ab1b1['order']=qs[_0xe0b0('0x3f')](_0x422575[_0xe0b0('0x38')][_0xe0b0('0x3f')]);_0x2ab1b1[_0xe0b0('0x40')]=qs[_0xe0b0('0x3a')](_[_0xe0b0('0x41')](_0x422575[_0xe0b0('0x38')],_0x5866e5[_0xe0b0('0x3a')]),_0x3231fc);if(_0x422575[_0xe0b0('0x38')]['filter']){_0x2ab1b1[_0xe0b0('0x40')]=_['merge'](_0x2ab1b1[_0xe0b0('0x40')],{'$or':_[_0xe0b0('0x31')](_0x3231fc,function(_0x46c4ea){if(_0x46c4ea[_0xe0b0('0x35')]!=='VIRTUAL'){var _0x3e1b6b={};_0x3e1b6b[_0x46c4ea[_0xe0b0('0x2e')]]={'$like':'%'+_0x422575[_0xe0b0('0x38')][_0xe0b0('0x42')]+'%'};return _0x3e1b6b;}})});}_0x2ab1b1=_[_0xe0b0('0x43')]({},_0x2ab1b1,_0x422575[_0xe0b0('0x44')]);var _0x3ad564={'where':_0x2ab1b1[_0xe0b0('0x40')]};return db['VoicePrefix'][_0xe0b0('0x45')](_0x3ad564)[_0xe0b0('0x2c')](function(_0x528818){_0x32acfe['count']=_0x528818;if(_0x422575[_0xe0b0('0x38')][_0xe0b0('0x46')]){_0x2ab1b1['include']=[{'all':!![]}];}return db[_0xe0b0('0x32')][_0xe0b0('0x47')](_0x2ab1b1);})[_0xe0b0('0x2c')](function(_0x1c869d){_0x32acfe[_0xe0b0('0x48')]=_0x1c869d;return _0x32acfe;})['then'](respondWithFilteredResult(_0x3f81d5,_0x2ab1b1))['catch'](handleError(_0x3f81d5,null));};exports['show']=function(_0xc3235b,_0x38e715){var _0x5c2f3b={'raw':![],'where':{'id':_0xc3235b[_0xe0b0('0x49')]['id']}},_0x9f7459={};_0x9f7459[_0xe0b0('0x37')]=_[_0xe0b0('0x39')](db[_0xe0b0('0x32')]['rawAttributes']);_0x9f7459['query']=_[_0xe0b0('0x39')](_0xc3235b[_0xe0b0('0x38')]);_0x9f7459[_0xe0b0('0x3a')]=_[_0xe0b0('0x3b')](_0x9f7459[_0xe0b0('0x37')],_0x9f7459['query']);_0x5c2f3b[_0xe0b0('0x3c')]=_[_0xe0b0('0x3b')](_0x9f7459['model'],qs['fields'](_0xc3235b['query'][_0xe0b0('0x3d')]));_0x5c2f3b[_0xe0b0('0x3c')]=_0x5c2f3b[_0xe0b0('0x3c')][_0xe0b0('0x3e')]?_0x5c2f3b['attributes']:_0x9f7459[_0xe0b0('0x37')];if(_0xc3235b[_0xe0b0('0x38')]['includeAll']){_0x5c2f3b['include']=[{'all':!![]}];}_0x5c2f3b=_[_0xe0b0('0x43')]({},_0x5c2f3b,_0xc3235b[_0xe0b0('0x44')]);return db['VoicePrefix'][_0xe0b0('0x4a')](_0x5c2f3b)[_0xe0b0('0x2c')](handleEntityNotFound(_0x38e715,null))['then'](respondWithResult(_0x38e715,null))['catch'](handleError(_0x38e715,null));};exports[_0xe0b0('0x28')]=function(_0x511679,_0x165dc8){return db[_0xe0b0('0x32')][_0xe0b0('0x4a')]({'where':{'id':_0x511679[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0x165dc8,null))[_0xe0b0('0x2c')](removeEntity(_0x165dc8,null))['catch'](handleError(_0x165dc8,null));};exports['describe']=function(_0x2ef908,_0x5d380a){return db['VoicePrefix'][_0xe0b0('0x4b')]()[_0xe0b0('0x2c')](respondWithResult(_0x5d380a,null))['catch'](handleError(_0x5d380a,null));};exports['create']=function(_0x13adfb,_0x10b5a6){var _0x17b09f;return db[_0xe0b0('0x4c')][_0xe0b0('0x4d')](function(_0x24115f){return db[_0xe0b0('0x32')]['create'](_0x13adfb[_0xe0b0('0x4e')],{'transaction':_0x24115f})['then'](function(_0x17b3d4){_0x17b09f=_0x17b3d4['get']({'plain':!![]});return db['VoiceExtension'][_0xe0b0('0x4a')]({'where':{'id':_0x17b09f[_0xe0b0('0x4f')]},'raw':!![]})[_0xe0b0('0x2c')](function(_0x2f1712){return createVoicePrefixExtensions(_0x17b09f,_0x2f1712,_0x24115f);});});})[_0xe0b0('0x2c')](function(){var _0x2a588d=_0x13adfb[_0xe0b0('0x50')][_0xe0b0('0x29')]({'plain':!![]});if(!_0x2a588d)throw new Error(_0xe0b0('0x51'));if(_0x2a588d['role']===_0xe0b0('0x50')){var _0x57ccc9=_0x17b09f;return db[_0xe0b0('0x52')][_0xe0b0('0x4a')]({'where':{'name':_0xe0b0('0x2a'),'userProfileId':_0x2a588d[_0xe0b0('0x53')]},'raw':!![]})[_0xe0b0('0x2c')](function(_0x3bdb25){if(_0x3bdb25&&_0x3bdb25['autoAssociation']===0x0){return db[_0xe0b0('0x2b')][_0xe0b0('0x54')]({'name':_0x57ccc9[_0xe0b0('0x2e')],'resourceId':_0x57ccc9['id'],'type':_0x3bdb25[_0xe0b0('0x2e')],'sectionId':_0x3bdb25['id']},{})[_0xe0b0('0x2c')](function(){return _0x17b09f;});}else{return _0x17b09f;}})[_0xe0b0('0x55')](function(_0x234cb7){logger[_0xe0b0('0x56')](_0xe0b0('0x57'),_0x234cb7);throw _0x234cb7;});}return _0x17b09f;})[_0xe0b0('0x2c')](respondWithResult(_0x10b5a6,null))[_0xe0b0('0x55')](handleError(_0x10b5a6,null));};function Extension(_0x18ab99,_0xc719d2,_0x10eb99,_0xcdf97){this[_0xe0b0('0x58')]=_0xe0b0('0x59');this[_0xe0b0('0x5a')]=_0x18ab99;this['app']=_0x10eb99;this[_0xe0b0('0x35')]=_0xe0b0('0x5b');this[_0xe0b0('0x5c')]=_0xe0b0('0x5d');this[_0xe0b0('0x5e')]=_0xc719d2;this[_0xe0b0('0x5f')]=_0xcdf97;}function createVoicePrefixExtensions(_0x2bdb59,_0x4f818b,_0x47dcc4){return new BPromise(function(_0x139014,_0x2a0415){var _0x157556=new Extension(formatPrefixName(_0x2bdb59['prefix']),0x1,_0xe0b0('0x60'),_0xe0b0('0x61'));_0x157556[_0xe0b0('0x62')]=_0x2bdb59['id'];return db[_0xe0b0('0x63')][_0xe0b0('0x54')](_0x157556,{'transaction':_0x47dcc4})['then'](function(_0x370f8c){var _0x242120=_0x370f8c[_0xe0b0('0x29')]({'plain':!![]});var _0x54b5d6=_[_0xe0b0('0x31')](addVoicePrefixExtensions(_0x2bdb59,_0x4f818b),function(_0x30b3ae){_0x30b3ae['VoiceExtensionId']=_0x242120['id'];_0x30b3ae[_0xe0b0('0x62')]=_0x2bdb59['id'];return _0x30b3ae;});return db['VoiceExtension']['bulkCreate'](_0x54b5d6,{'transaction':_0x47dcc4})[_0xe0b0('0x2c')](function(_0x57b51e){if(!_0x57b51e){return _0x2a0415('Extensions\x20creation\x20failed');}else{return _0x139014(_0x57b51e);}})[_0xe0b0('0x55')](function(_0xd750b4){return _0x2a0415(_0xd750b4);});});;});};function addVoicePrefixExtensions(_0x2d91f1,_0x1a4fad){var _0x5a7913=[];var _0x3679e0=formatPrefixName(_0x2d91f1[_0xe0b0('0x64')]);_0x5a7913[_0xe0b0('0x65')](new Extension(_0x3679e0,0x2,_0xe0b0('0x66'),_0xe0b0('0x67')+_0x2d91f1[_0xe0b0('0x2e')]));if(_0x2d91f1[_0xe0b0('0x68')]){_0x5a7913[_0xe0b0('0x65')](new Extension(_0x3679e0,0x3,'Set','PREFIX-CALLERIDALL='+_0x2d91f1[_0xe0b0('0x68')]));}else{_0x5a7913[_0xe0b0('0x65')](new Extension(_0x3679e0,0x3,_0xe0b0('0x60'),'No\x20callerid\x20available'));}_0x5a7913['push'](new Extension(_0x3679e0,0x4,_0xe0b0('0x69'),_0x1a4fad[_0xe0b0('0x58')]+','+'${EXTEN:'+(0x8+_0x2d91f1['name'][_0xe0b0('0x3e')])+'}'+','+0x1));return _0x5a7913;}function formatPrefixName(_0x42b2d3){var _0x38eb8e='_';for(var _0x29175a=0x0;_0x29175a<_0x42b2d3[_0xe0b0('0x3e')];_0x29175a++){if(_0x42b2d3[_0xe0b0('0x6a')](_0x29175a)=='-'){_0x38eb8e+=_0x42b2d3[_0xe0b0('0x6a')](_0x29175a);}else{_0x38eb8e+='['+_0x42b2d3[_0xe0b0('0x6a')](_0x29175a)+']';}}_0x38eb8e+='.';return _0x38eb8e;}exports['update']=function(_0x1daff7,_0x12e245,_0x1673bc){var _0x494420=_0x1daff7['body'];_0x494420['prefix']='system-'+_0x494420['name']+'-';return db['sequelize'][_0xe0b0('0x4d')](function(_0x51b492){return db['VoicePrefix'][_0xe0b0('0x27')](_0x494420,{'where':{'id':_0x494420['id']},'transaction':_0x51b492})[_0xe0b0('0x2c')](function(){return db[_0xe0b0('0x63')][_0xe0b0('0x28')]({'where':{'VoicePrefixId':_0x494420['id']},'transaction':_0x51b492})[_0xe0b0('0x2c')](function(){return db[_0xe0b0('0x63')][_0xe0b0('0x4a')]({'where':{'id':_0x494420[_0xe0b0('0x4f')]},'raw':!![]})['then'](function(_0x3097fb){return createVoicePrefixExtensions(_0x494420,_0x3097fb,_0x51b492);});});});})[_0xe0b0('0x2c')](function(){return db[_0xe0b0('0x32')][_0xe0b0('0x6b')](_0x494420['id']);})[_0xe0b0('0x2c')](respondWithResult(_0x12e245,null))[_0xe0b0('0x55')](handleError(_0x12e245,null));};exports[_0xe0b0('0x6c')]=function(_0x5e3e28,_0xaf2607,_0x5981a3){return db[_0xe0b0('0x32')][_0xe0b0('0x4a')]({'where':{'id':_0x5e3e28[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0xaf2607,null))['then'](function(_0x311f79){if(_0x311f79){return _0x311f79[_0xe0b0('0x6c')](_0x5e3e28['body']['ids'],_[_0xe0b0('0x6d')](_0x5e3e28[_0xe0b0('0x4e')],[_0xe0b0('0x6e'),'id'])||{})[_0xe0b0('0x6f')](function(_0x8b1390){for(var _0x31dd21=0x0;_0x31dd21<_0x5e3e28[_0xe0b0('0x4e')][_0xe0b0('0x6e')][_0xe0b0('0x3e')];_0x31dd21+=0x1){socket[_0xe0b0('0x70')]('userVoicePrefix:save',{'UserId':Number(_0x5e3e28['body'][_0xe0b0('0x6e')][_0x31dd21]),'VoicePrefixId':Number(_0x5e3e28['params']['id'])});}return _0x8b1390;});}})['then'](respondWithResult(_0xaf2607,null))['catch'](handleError(_0xaf2607,null));};exports['removeAgents']=function(_0x55f064,_0x584350,_0x654d2b){return db[_0xe0b0('0x32')][_0xe0b0('0x4a')]({'where':{'id':_0x55f064[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0x584350,null))[_0xe0b0('0x2c')](function(_0x948708){if(_0x948708){return _0x948708['removeAgents'](_0x55f064[_0xe0b0('0x38')][_0xe0b0('0x6e')])[_0xe0b0('0x2c')](function(){if(_[_0xe0b0('0x71')](_0x55f064[_0xe0b0('0x38')]['ids'])){for(var _0x55d3f8=0x0;_0x55d3f8<_0x55f064['query']['ids']['length'];_0x55d3f8+=0x1){socket[_0xe0b0('0x70')]('userVoicePrefix:remove',{'UserId':Number(_0x55f064[_0xe0b0('0x38')]['ids'][_0x55d3f8]),'VoicePrefixId':Number(_0x55f064[_0xe0b0('0x49')]['id'])});}}else{socket[_0xe0b0('0x70')](_0xe0b0('0x72'),{'UserId':Number(_0x55f064[_0xe0b0('0x38')][_0xe0b0('0x6e')]),'VoicePrefixId':Number(_0x55f064[_0xe0b0('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x584350,null))['catch'](handleError(_0x584350,null));};exports['getAgents']=function(_0x58e0e3,_0xc1919f,_0x261381){var _0x264363={};var _0x4377f7={};var _0x2c1149;var _0x534881;return db[_0xe0b0('0x32')][_0xe0b0('0x73')]({'where':{'id':_0x58e0e3[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0xc1919f,null))[_0xe0b0('0x2c')](function(_0x2a5082){if(_0x2a5082){_0x2c1149=_0x2a5082;_0x4377f7[_0xe0b0('0x37')]=_[_0xe0b0('0x39')](db[_0xe0b0('0x74')]['rawAttributes']);_0x4377f7['query']=_[_0xe0b0('0x39')](_0x58e0e3[_0xe0b0('0x38')]);_0x4377f7['filters']=_[_0xe0b0('0x3b')](_0x4377f7[_0xe0b0('0x37')],_0x4377f7[_0xe0b0('0x38')]);_0x264363[_0xe0b0('0x3c')]=_[_0xe0b0('0x3b')](_0x4377f7[_0xe0b0('0x37')],qs[_0xe0b0('0x3d')](_0x58e0e3[_0xe0b0('0x38')]['fields']));_0x264363['attributes']=_0x264363['attributes'][_0xe0b0('0x3e')]?_0x264363[_0xe0b0('0x3c')]:_0x4377f7['model'];_0x264363[_0xe0b0('0x75')]=qs[_0xe0b0('0x3f')](_0x58e0e3[_0xe0b0('0x38')][_0xe0b0('0x3f')]);_0x264363['where']=qs['filters'](_['pick'](_0x58e0e3[_0xe0b0('0x38')],_0x4377f7[_0xe0b0('0x3a')]));if(_0x58e0e3['query'][_0xe0b0('0x42')]){_0x264363[_0xe0b0('0x40')]=_['merge'](_0x264363['where'],{'$or':_[_0xe0b0('0x31')](_0x264363['attributes'],function(_0x251195){var _0x5f06c0={};_0x5f06c0[_0x251195]={'$like':'%'+_0x58e0e3[_0xe0b0('0x38')][_0xe0b0('0x42')]+'%'};return _0x5f06c0;})});}_0x264363=_[_0xe0b0('0x43')]({},_0x264363,_0x58e0e3[_0xe0b0('0x44')]);return _0x2c1149[_0xe0b0('0x76')](_0x264363);}})[_0xe0b0('0x2c')](function(_0x434dfa){if(_0x434dfa){_0x534881=_0x434dfa[_0xe0b0('0x3e')];if(!_0x58e0e3[_0xe0b0('0x38')]['hasOwnProperty'](_0xe0b0('0x77'))){_0x264363[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x58e0e3['query'][_0xe0b0('0x22')]);_0x264363['offset']=qs[_0xe0b0('0x21')](_0x58e0e3[_0xe0b0('0x38')]['offset']);}return _0x2c1149[_0xe0b0('0x76')](_0x264363);}})['then'](function(_0x528932){if(_0x528932){return _0x528932?{'count':_0x534881,'rows':_0x528932}:null;}})[_0xe0b0('0x2c')](respondWithResult(_0xc1919f,null))['catch'](handleError(_0xc1919f,null));};exports['getTeams']=function(_0x4f027c,_0x1e4bfb,_0x238979){var _0x9e8b9c={};var _0x42b591={};var _0x3da0ce;var _0x4e0429;return db[_0xe0b0('0x32')][_0xe0b0('0x73')]({'where':{'id':_0x4f027c[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0x1e4bfb,null))[_0xe0b0('0x2c')](function(_0x447641){if(_0x447641){_0x3da0ce=_0x447641;_0x42b591['model']=_['keys'](db[_0xe0b0('0x78')]['rawAttributes']);_0x42b591[_0xe0b0('0x38')]=_[_0xe0b0('0x39')](_0x4f027c[_0xe0b0('0x38')]);_0x42b591[_0xe0b0('0x3a')]=_[_0xe0b0('0x3b')](_0x42b591[_0xe0b0('0x37')],_0x42b591[_0xe0b0('0x38')]);_0x9e8b9c['attributes']=_[_0xe0b0('0x3b')](_0x42b591[_0xe0b0('0x37')],qs[_0xe0b0('0x3d')](_0x4f027c[_0xe0b0('0x38')][_0xe0b0('0x3d')]));_0x9e8b9c['attributes']=_0x9e8b9c['attributes'][_0xe0b0('0x3e')]?_0x9e8b9c[_0xe0b0('0x3c')]:_0x42b591[_0xe0b0('0x37')];_0x9e8b9c[_0xe0b0('0x75')]=qs[_0xe0b0('0x3f')](_0x4f027c[_0xe0b0('0x38')][_0xe0b0('0x3f')]);_0x9e8b9c[_0xe0b0('0x40')]=qs[_0xe0b0('0x3a')](_[_0xe0b0('0x41')](_0x4f027c['query'],_0x42b591[_0xe0b0('0x3a')]));if(_0x4f027c[_0xe0b0('0x38')][_0xe0b0('0x42')]){_0x9e8b9c[_0xe0b0('0x40')]=_['merge'](_0x9e8b9c[_0xe0b0('0x40')],{'$or':_[_0xe0b0('0x31')](_0x9e8b9c[_0xe0b0('0x3c')],function(_0x116c16){var _0x476763={};_0x476763[_0x116c16]={'$like':'%'+_0x4f027c['query'][_0xe0b0('0x42')]+'%'};return _0x476763;})});}_0x9e8b9c=_['merge']({},_0x9e8b9c,_0x4f027c[_0xe0b0('0x44')]);return _0x3da0ce[_0xe0b0('0x79')](_0x9e8b9c);}})[_0xe0b0('0x2c')](function(_0x23c448){if(_0x23c448){_0x4e0429=_0x23c448[_0xe0b0('0x3e')];if(!_0x4f027c['query']['hasOwnProperty'](_0xe0b0('0x77'))){_0x9e8b9c['limit']=qs[_0xe0b0('0x22')](_0x4f027c['query'][_0xe0b0('0x22')]);_0x9e8b9c[_0xe0b0('0x21')]=qs[_0xe0b0('0x21')](_0x4f027c[_0xe0b0('0x38')][_0xe0b0('0x21')]);}return _0x3da0ce[_0xe0b0('0x79')](_0x9e8b9c);}})[_0xe0b0('0x2c')](function(_0x5d7cee){if(_0x5d7cee){return _0x5d7cee?{'count':_0x4e0429,'rows':_0x5d7cee}:null;}})['then'](respondWithResult(_0x1e4bfb,null))[_0xe0b0('0x55')](handleError(_0x1e4bfb,null));};exports[_0xe0b0('0x7a')]=function(_0x184938,_0x20d6bd,_0xd83992){var _0x2b4d49=_0x184938[_0xe0b0('0x4e')][_0xe0b0('0x6e')];var _0x1bbb0d;return db[_0xe0b0('0x78')]['findAll']({'where':{'id':_0x2b4d49},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x7b'),'attributes':['id',_0xe0b0('0x2e'),_0xe0b0('0x7c'),_0xe0b0('0x7d'),_0xe0b0('0x7e')],'raw':!![]}]})[_0xe0b0('0x2c')](function(_0x33b67a){if(_0x33b67a){_0x1bbb0d=_0x33b67a;var _0x51995b=_['flatMap'](_0x33b67a,function(_0x302f9f){var _0x1ea4d5=_0x302f9f[_0xe0b0('0x29')]({'plain':!![]});return _0x1ea4d5[_0xe0b0('0x7b')];});return db[_0xe0b0('0x32')][_0xe0b0('0x4a')]({'where':{'id':_0x184938[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](function(_0x6ef3b2){return db[_0xe0b0('0x4c')]['transaction'](function(_0x46b247){return _0x6ef3b2[_0xe0b0('0x7a')](_0x2b4d49,{'transaction':_0x46b247})['then'](function(){return BPromise[_0xe0b0('0x7f')](_0x1bbb0d,function(_0x4250f4){return db[_0xe0b0('0x80')][_0xe0b0('0x81')]({'TeamId':_0x4250f4['id'],'VoicePrefixId':_0x184938[_0xe0b0('0x49')]['id']},{'transaction':_0x46b247});});})['then'](function(){return BPromise[_0xe0b0('0x7f')](_0x51995b,function(_0x38f9af){return db[_0xe0b0('0x82')][_0xe0b0('0x83')]({'where':{'UserId':_0x38f9af['id'],'VoicePrefixId':_0x184938[_0xe0b0('0x49')]['id']},'transaction':_0x46b247});});})['then'](function(){_0x51995b[_0xe0b0('0x84')](function(_0x58d61b){socket[_0xe0b0('0x70')](_0xe0b0('0x85'),{'UserId':_0x58d61b['id'],'VoicePrefixId':_0x6ef3b2['id']});});});});});}})[_0xe0b0('0x2c')](respondWithStatusCode(_0x20d6bd,null))['catch'](handleError(_0x20d6bd,null));};exports['removeTeams']=function(_0x45ae1a,_0x2349df,_0x619226){return db['Team']['findAll']({'where':{'id':_0x45ae1a['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe0b0('0x2c')](handleEntityNotFound(_0x2349df,null))[_0xe0b0('0x2c')](function(_0x5ac132){var _0x121257=_[_0xe0b0('0x31')](_0x5ac132,'id');var _0xfd746a=[];var _0xd73b8a=[];var _0x437588=squel['select']();_0x437588['field'](_0xe0b0('0x86'))[_0xe0b0('0x87')](_0xe0b0('0x88'),'tq')['join'](_0xe0b0('0x89'),'ut',_0xe0b0('0x8a'))[_0xe0b0('0x40')](_0xe0b0('0x8b'),_0x45ae1a[_0xe0b0('0x49')]['id']);for(var _0x1b8d4a=0x0;_0x1b8d4a<_0x5ac132['length'];_0x1b8d4a+=0x1){let _0x581848=_0x5ac132[_0x1b8d4a];for(var _0x495635=0x0;_0x495635<_0x581848[_0xe0b0('0x7b')][_0xe0b0('0x3e')];_0x495635+=0x1){let _0x9f9d8d=_0x581848[_0xe0b0('0x7b')][_0x495635];var _0x266cb5=_0x437588[_0xe0b0('0x8c')]();_0x266cb5[_0xe0b0('0x40')](_0xe0b0('0x8d'),_0x9f9d8d['id']);_0xd73b8a['push'](db['sequelize'][_0xe0b0('0x38')](_0x266cb5[_0xe0b0('0x8e')](),{'type':db[_0xe0b0('0x4c')]['QueryTypes'][_0xe0b0('0x8f')]})[_0xe0b0('0x2c')](function(_0x9f1fb){if(_0x9f1fb['length']===0x1){return _0x9f9d8d['id'];}else{var _0x36fa1f=_['every'](_[_0xe0b0('0x31')](_0x9f1fb,_0xe0b0('0x90')),function(_0x1e74a0){return _[_0xe0b0('0x91')](_0x121257,_0x1e74a0);});if(_0x36fa1f){return _0x9f9d8d['id'];}}}));}}return BPromise[_0xe0b0('0x92')](_0xd73b8a)[_0xe0b0('0x2c')](function(_0x12e46f){_0xfd746a=_(_0xfd746a)['union'](_0x12e46f)[_0xe0b0('0x93')]()[_0xe0b0('0x94')]();return db['VoicePrefix'][_0xe0b0('0x4a')]({'where':{'id':_0x45ae1a[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](function(_0x4dbb7b){return db[_0xe0b0('0x4c')][_0xe0b0('0x4d')](function(_0x221e96){return _0x4dbb7b['removeTeams'](_0x45ae1a[_0xe0b0('0x38')][_0xe0b0('0x6e')],{'transaction':_0x221e96})[_0xe0b0('0x2c')](function(){if(!_[_0xe0b0('0x95')](_0xfd746a)){return _0x4dbb7b[_0xe0b0('0x96')](_0xfd746a,{'transaction':_0x221e96});}})[_0xe0b0('0x2c')](function(){_0xfd746a['forEach'](function(_0x44da91){socket[_0xe0b0('0x70')](_0xe0b0('0x72'),{'UserId':_0x44da91,'VoicePrefixId':_0x4dbb7b['id']});});});});});});})[_0xe0b0('0x2c')](respondWithStatusCode(_0x2349df,null))[_0xe0b0('0x55')](handleError(_0x2349df,null));}; \ No newline at end of file +var _0x1c9a=['sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','VoicePrefixes','UserProfileResource','error','stack','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','find','params','describe','sequelize','create','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','VoiceExtension','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','${EXTEN:','charAt','body','system-','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','User','filter','getAgents','getTeams','findOne','addTeams','Team','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','union','compact','isEmpty','eml-format','zip-dir','request-promise','moment','bluebird','util','path'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x1c9a,0x98));var _0xa1c9=function(_0x31fb59,_0x11e371){_0x31fb59=_0x31fb59-0x0;var _0x21aea6=_0x1c9a[_0x31fb59];return _0x21aea6;};'use strict';var emlformat=require(_0xa1c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1c9('0x2'));var moment=require(_0xa1c9('0x3'));var BPromise=require(_0xa1c9('0x4'));var Mustache=require('mustache');var util=require(_0xa1c9('0x5'));var path=require(_0xa1c9('0x6'));var sox=require(_0xa1c9('0x7'));var csv=require(_0xa1c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1c9('0x9'));var _=require('lodash');var squel=require(_0xa1c9('0xa'));var crypto=require(_0xa1c9('0xb'));var jsforce=require(_0xa1c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa1c9('0x8'));var querystring=require(_0xa1c9('0xd'));var Papa=require(_0xa1c9('0xe'));var Redis=require(_0xa1c9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1c9('0x10'));var as=require(_0xa1c9('0x11'));var hardwareService=require(_0xa1c9('0x12'));var logger=require(_0xa1c9('0x13'))(_0xa1c9('0x14'));var utils=require(_0xa1c9('0x15'));var config=require(_0xa1c9('0x16'));var licenseUtil=require(_0xa1c9('0x17'));var db=require(_0xa1c9('0x18'))['db'];config[_0xa1c9('0x19')]=_['defaults'](config[_0xa1c9('0x19')],{'host':_0xa1c9('0x1a'),'port':0x18eb});var socket=require(_0xa1c9('0x1b'))(new Redis(config[_0xa1c9('0x19')]));require(_0xa1c9('0x1c'))['register'](socket);function respondWithStatusCode(_0x335dda,_0x4b2fa5){_0x4b2fa5=_0x4b2fa5||0xcc;return function(_0x2cba13){if(_0x2cba13){return _0x335dda[_0xa1c9('0x1d')](_0x4b2fa5);}return _0x335dda[_0xa1c9('0x1e')](_0x4b2fa5)[_0xa1c9('0x1f')]();};}function respondWithResult(_0x44ab5b,_0x3b51f5){_0x3b51f5=_0x3b51f5||0xc8;return function(_0x1f6d26){if(_0x1f6d26){return _0x44ab5b[_0xa1c9('0x1e')](_0x3b51f5)['json'](_0x1f6d26);}};}function respondWithFilteredResult(_0x11ca10,_0x1084d2){return function(_0x224ae4){if(_0x224ae4){var _0x50db9b=typeof _0x1084d2[_0xa1c9('0x20')]==='undefined'&&typeof _0x1084d2[_0xa1c9('0x21')]===_0xa1c9('0x22');var _0x204d54=_0x224ae4['count'];var _0x3a1110=_0x50db9b?0x0:_0x1084d2[_0xa1c9('0x20')];var _0x128732=_0x50db9b?_0x224ae4['count']:_0x1084d2[_0xa1c9('0x20')]+_0x1084d2[_0xa1c9('0x21')];var _0x4c6dbb;if(_0x128732>=_0x204d54){_0x128732=_0x204d54;_0x4c6dbb=0xc8;}else{_0x4c6dbb=0xce;}_0x11ca10[_0xa1c9('0x1e')](_0x4c6dbb);return _0x11ca10[_0xa1c9('0x23')](_0xa1c9('0x24'),_0x3a1110+'-'+_0x128732+'/'+_0x204d54)['json'](_0x224ae4);}return null;};}function patchUpdates(_0x29f1b1){return function(_0x3dcec5){try{jsonpatch[_0xa1c9('0x25')](_0x3dcec5,_0x29f1b1,!![]);}catch(_0x23a461){return BPromise[_0xa1c9('0x26')](_0x23a461);}return _0x3dcec5['save']();};}function saveUpdates(_0x50b16b,_0x200749){return function(_0x50b16d){if(_0x50b16d){return _0x50b16d[_0xa1c9('0x27')](_0x50b16b)[_0xa1c9('0x28')](function(_0x1c6f37){return _0x1c6f37;});}return null;};}function removeEntity(_0x3059eb,_0x339ed1){return function(_0x522dc0){if(_0x522dc0){return _0x522dc0[_0xa1c9('0x29')]()[_0xa1c9('0x28')](function(){var _0x20cbe1=_0x522dc0['get']({'plain':!![]});var _0x133f80=_0xa1c9('0x2a');return db[_0xa1c9('0x2b')]['destroy']({'where':{'type':_0x133f80,'resourceId':_0x20cbe1['id']}})[_0xa1c9('0x28')](function(){return _0x522dc0;});})[_0xa1c9('0x28')](function(){_0x3059eb['status'](0xcc)[_0xa1c9('0x1f')]();});}};}function handleEntityNotFound(_0x48ce34,_0xdf6d0c){return function(_0x2404c3){if(!_0x2404c3){_0x48ce34[_0xa1c9('0x1d')](0x194);}return _0x2404c3;};}function handleError(_0x254b13,_0x40b9d5){_0x40b9d5=_0x40b9d5||0x1f4;return function(_0xe8523b){logger[_0xa1c9('0x2c')](_0xe8523b[_0xa1c9('0x2d')]);if(_0xe8523b['name']){delete _0xe8523b['name'];}_0x254b13[_0xa1c9('0x1e')](_0x40b9d5)[_0xa1c9('0x2e')](_0xe8523b);};}exports[_0xa1c9('0x2f')]=function(_0xf419d0,_0x3161b0){var _0x5b67c3={},_0x53f325={},_0x5aecd7={'count':0x0,'rows':[]};var _0x259ac3=_[_0xa1c9('0x30')](db[_0xa1c9('0x31')][_0xa1c9('0x32')],function(_0x39cf81){return{'name':_0x39cf81[_0xa1c9('0x33')],'type':_0x39cf81[_0xa1c9('0x34')]['key']};});_0x53f325[_0xa1c9('0x35')]=_['map'](_0x259ac3,_0xa1c9('0x36'));_0x53f325['query']=_[_0xa1c9('0x37')](_0xf419d0[_0xa1c9('0x38')]);_0x53f325[_0xa1c9('0x39')]=_['intersection'](_0x53f325[_0xa1c9('0x35')],_0x53f325[_0xa1c9('0x38')]);_0x5b67c3[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x53f325['model'],qs['fields'](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x5b67c3[_0xa1c9('0x3a')]=_0x5b67c3[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x5b67c3[_0xa1c9('0x3a')]:_0x53f325[_0xa1c9('0x35')];if(!_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x5b67c3['limit']=qs[_0xa1c9('0x21')](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x5b67c3[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0xf419d0[_0xa1c9('0x38')]['offset']);}_0x5b67c3[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0xf419d0[_0xa1c9('0x38')]['sort']);_0x5b67c3[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0xf419d0[_0xa1c9('0x38')],_0x53f325[_0xa1c9('0x39')]),_0x259ac3);if(_0xf419d0['query']['filter']){_0x5b67c3[_0xa1c9('0x42')]=_[_0xa1c9('0x43')](_0x5b67c3[_0xa1c9('0x42')],{'$or':_[_0xa1c9('0x30')](_0x259ac3,function(_0xd9e67){if(_0xd9e67[_0xa1c9('0x34')]!==_0xa1c9('0x44')){var _0x146e47={};_0x146e47[_0xd9e67[_0xa1c9('0x36')]]={'$like':'%'+_0xf419d0[_0xa1c9('0x38')]['filter']+'%'};return _0x146e47;}})});}_0x5b67c3=_['merge']({},_0x5b67c3,_0xf419d0[_0xa1c9('0x45')]);var _0x46920c={'where':_0x5b67c3['where']};return db[_0xa1c9('0x31')][_0xa1c9('0x46')](_0x46920c)[_0xa1c9('0x28')](function(_0x36c846){_0x5aecd7[_0xa1c9('0x46')]=_0x36c846;if(_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x5b67c3[_0xa1c9('0x48')]=[{'all':!![]}];}return db[_0xa1c9('0x31')][_0xa1c9('0x49')](_0x5b67c3);})[_0xa1c9('0x28')](function(_0x50cc27){_0x5aecd7[_0xa1c9('0x4a')]=_0x50cc27;return _0x5aecd7;})['then'](respondWithFilteredResult(_0x3161b0,_0x5b67c3))[_0xa1c9('0x4b')](handleError(_0x3161b0,null));};exports['show']=function(_0x42be67,_0x4a9e02){var _0x43598b={'raw':![],'where':{'id':_0x42be67['params']['id']}},_0x18bb43={};_0x18bb43[_0xa1c9('0x35')]=_[_0xa1c9('0x37')](db['VoicePrefix'][_0xa1c9('0x32')]);_0x18bb43[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x42be67[_0xa1c9('0x38')]);_0x18bb43[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x18bb43['model'],_0x18bb43[_0xa1c9('0x38')]);_0x43598b[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x18bb43[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x42be67['query']['fields']));_0x43598b['attributes']=_0x43598b[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x43598b[_0xa1c9('0x3a')]:_0x18bb43['model'];if(_0x42be67[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x43598b['include']=[{'all':!![]}];}_0x43598b=_[_0xa1c9('0x43')]({},_0x43598b,_0x42be67['options']);return db['VoicePrefix'][_0xa1c9('0x4c')](_0x43598b)[_0xa1c9('0x28')](handleEntityNotFound(_0x4a9e02,null))[_0xa1c9('0x28')](respondWithResult(_0x4a9e02,null))[_0xa1c9('0x4b')](handleError(_0x4a9e02,null));};exports[_0xa1c9('0x29')]=function(_0x31fbb8,_0x18aa46){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x31fbb8[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x18aa46,null))[_0xa1c9('0x28')](removeEntity(_0x18aa46,null))[_0xa1c9('0x4b')](handleError(_0x18aa46,null));};exports[_0xa1c9('0x4e')]=function(_0x149450,_0x112f82){return db[_0xa1c9('0x31')][_0xa1c9('0x4e')]()[_0xa1c9('0x28')](respondWithResult(_0x112f82,null))['catch'](handleError(_0x112f82,null));};exports['create']=function(_0x12118e,_0x6160fc){var _0x66a5eb;return db[_0xa1c9('0x4f')]['transaction'](function(_0x449e85){return db[_0xa1c9('0x31')][_0xa1c9('0x50')](_0x12118e['body'],{'transaction':_0x449e85})[_0xa1c9('0x28')](function(_0x3f650a){_0x66a5eb=_0x3f650a['get']({'plain':!![]});return db['VoiceExtension'][_0xa1c9('0x4c')]({'where':{'id':_0x66a5eb['VoiceExtensionId']},'raw':!![]})[_0xa1c9('0x28')](function(_0x1bd5c7){return createVoicePrefixExtensions(_0x66a5eb,_0x1bd5c7,_0x449e85);});});})[_0xa1c9('0x28')](function(){var _0x4c1165=_0x12118e['user'][_0xa1c9('0x51')]({'plain':!![]});if(!_0x4c1165)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c1165[_0xa1c9('0x52')]==='user'){var _0x3334ad=_0x66a5eb;return db[_0xa1c9('0x53')][_0xa1c9('0x4c')]({'where':{'name':_0xa1c9('0x2a'),'userProfileId':_0x4c1165[_0xa1c9('0x54')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x3917ed){if(_0x3917ed&&_0x3917ed['autoAssociation']===0x0){return db[_0xa1c9('0x2b')][_0xa1c9('0x50')]({'name':_0x3334ad['name'],'resourceId':_0x3334ad['id'],'type':_0x3917ed['name'],'sectionId':_0x3917ed['id']},{})['then'](function(){return _0x66a5eb;});}else{return _0x66a5eb;}})[_0xa1c9('0x4b')](function(_0x55fe87){logger[_0xa1c9('0x2c')](_0xa1c9('0x55'),_0x55fe87);throw _0x55fe87;});}return _0x66a5eb;})[_0xa1c9('0x28')](respondWithResult(_0x6160fc,null))[_0xa1c9('0x4b')](handleError(_0x6160fc,null));};function Extension(_0x2f0c80,_0x5b81f4,_0x4bf711,_0x48950c){this['context']=_0xa1c9('0x56');this[_0xa1c9('0x57')]=_0x2f0c80;this[_0xa1c9('0x58')]=_0x4bf711;this[_0xa1c9('0x34')]=_0xa1c9('0x59');this[_0xa1c9('0x5a')]=_0xa1c9('0x5b');this[_0xa1c9('0x5c')]=_0x5b81f4;this[_0xa1c9('0x5d')]=_0x48950c;}function createVoicePrefixExtensions(_0x317799,_0x4639cf,_0xef5d24){return new BPromise(function(_0x288267,_0x29d833){var _0x51f675=new Extension(formatPrefixName(_0x317799[_0xa1c9('0x5e')]),0x1,_0xa1c9('0x5f'),_0xa1c9('0x60'));_0x51f675[_0xa1c9('0x61')]=_0x317799['id'];return db['VoiceExtension'][_0xa1c9('0x50')](_0x51f675,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x1b2cff){var _0x39ffed=_0x1b2cff['get']({'plain':!![]});var _0x4b9aa8=_[_0xa1c9('0x30')](addVoicePrefixExtensions(_0x317799,_0x4639cf),function(_0x2a89d2){_0x2a89d2[_0xa1c9('0x62')]=_0x39ffed['id'];_0x2a89d2[_0xa1c9('0x61')]=_0x317799['id'];return _0x2a89d2;});return db[_0xa1c9('0x63')]['bulkCreate'](_0x4b9aa8,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x21abdf){if(!_0x21abdf){return _0x29d833(_0xa1c9('0x64'));}else{return _0x288267(_0x21abdf);}})[_0xa1c9('0x4b')](function(_0x5ba7aa){return _0x29d833(_0x5ba7aa);});});;});};function addVoicePrefixExtensions(_0x37613f,_0x17d848){var _0xa18fa4=[];var _0x5a5c65=formatPrefixName(_0x37613f[_0xa1c9('0x5e')]);_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x2,'Set',_0xa1c9('0x66')+_0x37613f[_0xa1c9('0x36')]));if(_0x37613f[_0xa1c9('0x67')]){_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x68'),_0xa1c9('0x69')+_0x37613f[_0xa1c9('0x67')]));}else{_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x5f'),_0xa1c9('0x6a')));}_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x4,'goto',_0x17d848[_0xa1c9('0x6b')]+','+_0xa1c9('0x6c')+(0x8+_0x37613f[_0xa1c9('0x36')][_0xa1c9('0x3d')])+'}'+','+0x1));return _0xa18fa4;}function formatPrefixName(_0x5961aa){var _0x358481='_';for(var _0xdbc56a=0x0;_0xdbc56a<_0x5961aa[_0xa1c9('0x3d')];_0xdbc56a++){if(_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)=='-'){_0x358481+=_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a);}else{_0x358481+='['+_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)+']';}}_0x358481+='.';return _0x358481;}exports[_0xa1c9('0x27')]=function(_0x27048c,_0xb24e0b,_0x178e47){var _0x1fec82=_0x27048c[_0xa1c9('0x6e')];_0x1fec82[_0xa1c9('0x5e')]=_0xa1c9('0x6f')+_0x1fec82['name']+'-';return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x1f219d){return db[_0xa1c9('0x31')][_0xa1c9('0x27')](_0x1fec82,{'where':{'id':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['destroy']({'where':{'VoicePrefixId':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['find']({'where':{'id':_0x1fec82[_0xa1c9('0x62')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x150d76){return createVoicePrefixExtensions(_0x1fec82,_0x150d76,_0x1f219d);});});});})[_0xa1c9('0x28')](function(){return db['VoicePrefix'][_0xa1c9('0x71')](_0x1fec82['id']);})['then'](respondWithResult(_0xb24e0b,null))['catch'](handleError(_0xb24e0b,null));};exports[_0xa1c9('0x72')]=function(_0x134d3f,_0x40f420,_0x423c58){return db['VoicePrefix'][_0xa1c9('0x4c')]({'where':{'id':_0x134d3f[_0xa1c9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40f420,null))[_0xa1c9('0x28')](function(_0x464da9){if(_0x464da9){return _0x464da9[_0xa1c9('0x72')](_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')],_[_0xa1c9('0x74')](_0x134d3f['body'],['ids','id'])||{})[_0xa1c9('0x75')](function(_0x52e78b){for(var _0x3de2c7=0x0;_0x3de2c7<_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3de2c7+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':Number(_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0x3de2c7]),'VoicePrefixId':Number(_0x134d3f[_0xa1c9('0x4d')]['id'])});}return _0x52e78b;});}})['then'](respondWithResult(_0x40f420,null))[_0xa1c9('0x4b')](handleError(_0x40f420,null));};exports['removeAgents']=function(_0x4a8841,_0x8bc83d,_0x518811){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x4a8841[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x8bc83d,null))[_0xa1c9('0x28')](function(_0x2a17b7){if(_0x2a17b7){return _0x2a17b7[_0xa1c9('0x78')](_0x4a8841['query'][_0xa1c9('0x73')])[_0xa1c9('0x28')](function(){if(_[_0xa1c9('0x79')](_0x4a8841['query']['ids'])){for(var _0x3f4f76=0x0;_0x3f4f76<_0x4a8841['query'][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3f4f76+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841['query'][_0xa1c9('0x73')][_0x3f4f76]),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}}else{socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841[_0xa1c9('0x38')]['ids']),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x8bc83d,null))[_0xa1c9('0x4b')](handleError(_0x8bc83d,null));};exports['getAgents']=function(_0x3936cb,_0x175662,_0x134935){var _0x197721={};var _0x7281bd={};var _0x35a356;var _0x53ea3b;return db[_0xa1c9('0x31')]['findOne']({'where':{'id':_0x3936cb[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x175662,null))['then'](function(_0x28d323){if(_0x28d323){_0x35a356=_0x28d323;_0x7281bd['model']=_[_0xa1c9('0x37')](db[_0xa1c9('0x7b')][_0xa1c9('0x32')]);_0x7281bd[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x3936cb[_0xa1c9('0x38')]);_0x7281bd[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],_0x7281bd[_0xa1c9('0x38')]);_0x197721[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x197721['attributes']=_0x197721['attributes'][_0xa1c9('0x3d')]?_0x197721[_0xa1c9('0x3a')]:_0x7281bd[_0xa1c9('0x35')];_0x197721['order']=qs[_0xa1c9('0x41')](_0x3936cb['query']['sort']);_0x197721[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x3936cb[_0xa1c9('0x38')],_0x7281bd['filters']));if(_0x3936cb['query'][_0xa1c9('0x7c')]){_0x197721['where']=_[_0xa1c9('0x43')](_0x197721[_0xa1c9('0x42')],{'$or':_['map'](_0x197721[_0xa1c9('0x3a')],function(_0x1277eb){var _0x88cb2c={};_0x88cb2c[_0x1277eb]={'$like':'%'+_0x3936cb[_0xa1c9('0x38')]['filter']+'%'};return _0x88cb2c;})});}_0x197721=_[_0xa1c9('0x43')]({},_0x197721,_0x3936cb[_0xa1c9('0x45')]);return _0x35a356[_0xa1c9('0x7d')](_0x197721);}})[_0xa1c9('0x28')](function(_0x465162){if(_0x465162){_0x53ea3b=_0x465162[_0xa1c9('0x3d')];if(!_0x3936cb['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x197721['limit']=qs['limit'](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x197721[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x20')]);}return _0x35a356['getAgents'](_0x197721);}})[_0xa1c9('0x28')](function(_0x4deadc){if(_0x4deadc){return _0x4deadc?{'count':_0x53ea3b,'rows':_0x4deadc}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x175662,null))[_0xa1c9('0x4b')](handleError(_0x175662,null));};exports[_0xa1c9('0x7e')]=function(_0x59bc9f,_0x1c8a80,_0x2780b7){var _0x26f241={};var _0x537f48={};var _0x4e1e2f;var _0x46d8d1;return db['VoicePrefix'][_0xa1c9('0x7f')]({'where':{'id':_0x59bc9f['params']['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x1c8a80,null))[_0xa1c9('0x28')](function(_0x2d2374){if(_0x2d2374){_0x4e1e2f=_0x2d2374;_0x537f48['model']=_['keys'](db['Team'][_0xa1c9('0x32')]);_0x537f48[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x59bc9f[_0xa1c9('0x38')]);_0x537f48['filters']=_['intersection'](_0x537f48[_0xa1c9('0x35')],_0x537f48['query']);_0x26f241[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x537f48[_0xa1c9('0x35')],qs['fields'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x26f241[_0xa1c9('0x3a')]=_0x26f241[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x26f241[_0xa1c9('0x3a')]:_0x537f48[_0xa1c9('0x35')];_0x26f241[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0x59bc9f[_0xa1c9('0x38')]['sort']);_0x26f241[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x59bc9f[_0xa1c9('0x38')],_0x537f48[_0xa1c9('0x39')]));if(_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x7c')]){_0x26f241[_0xa1c9('0x42')]=_['merge'](_0x26f241[_0xa1c9('0x42')],{'$or':_['map'](_0x26f241[_0xa1c9('0x3a')],function(_0x2c04c5){var _0x137a58={};_0x137a58[_0x2c04c5]={'$like':'%'+_0x59bc9f['query'][_0xa1c9('0x7c')]+'%'};return _0x137a58;})});}_0x26f241=_[_0xa1c9('0x43')]({},_0x26f241,_0x59bc9f[_0xa1c9('0x45')]);return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x328fa7){if(_0x328fa7){_0x46d8d1=_0x328fa7[_0xa1c9('0x3d')];if(!_0x59bc9f['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x26f241[_0xa1c9('0x21')]=qs['limit'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x26f241['offset']=qs[_0xa1c9('0x20')](_0x59bc9f['query'][_0xa1c9('0x20')]);}return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x3e5016){if(_0x3e5016){return _0x3e5016?{'count':_0x46d8d1,'rows':_0x3e5016}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x1c8a80,null))['catch'](handleError(_0x1c8a80,null));};exports[_0xa1c9('0x80')]=function(_0xabacf1,_0x38a7fc,_0x2a3082){var _0x276c98=_0xabacf1[_0xa1c9('0x6e')][_0xa1c9('0x73')];var _0x48520d;return db[_0xa1c9('0x81')][_0xa1c9('0x49')]({'where':{'id':_0x276c98},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id','name',_0xa1c9('0x83'),_0xa1c9('0x84'),'interface'],'raw':!![]}]})[_0xa1c9('0x28')](function(_0x2a82fd){if(_0x2a82fd){_0x48520d=_0x2a82fd;var _0x419cf2=_[_0xa1c9('0x85')](_0x2a82fd,function(_0x51884d){var _0x52360b=_0x51884d[_0xa1c9('0x51')]({'plain':!![]});return _0x52360b['Agents'];});return db[_0xa1c9('0x31')]['find']({'where':{'id':_0xabacf1['params']['id']}})[_0xa1c9('0x28')](function(_0x507b2a){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x296607){return _0x507b2a[_0xa1c9('0x80')](_0x276c98,{'transaction':_0x296607})[_0xa1c9('0x28')](function(){return BPromise[_0xa1c9('0x86')](_0x48520d,function(_0x531c20){return db[_0xa1c9('0x87')]['upsert']({'TeamId':_0x531c20['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},{'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){return BPromise['each'](_0x419cf2,function(_0x110617){return db[_0xa1c9('0x88')][_0xa1c9('0x89')]({'where':{'UserId':_0x110617['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){_0x419cf2[_0xa1c9('0x8a')](function(_0x5640bb){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':_0x5640bb['id'],'VoicePrefixId':_0x507b2a['id']});});});});});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x38a7fc,null))['catch'](handleError(_0x38a7fc,null));};exports[_0xa1c9('0x8b')]=function(_0x4c8c5e,_0x3cb7d4,_0x5c504c){return db['Team'][_0xa1c9('0x49')]({'where':{'id':_0x4c8c5e['query'][_0xa1c9('0x73')]},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id'],'raw':!![]}]})[_0xa1c9('0x28')](handleEntityNotFound(_0x3cb7d4,null))['then'](function(_0x4423e8){var _0x2c75e6=_['map'](_0x4423e8,'id');var _0x163589=[];var _0x5f3e31=[];var _0x6e0efe=squel[_0xa1c9('0x8c')]();_0x6e0efe[_0xa1c9('0x8d')](_0xa1c9('0x8e'))[_0xa1c9('0x8f')](_0xa1c9('0x90'),'tq')[_0xa1c9('0x91')](_0xa1c9('0x92'),'ut',_0xa1c9('0x93'))[_0xa1c9('0x42')](_0xa1c9('0x94'),_0x4c8c5e[_0xa1c9('0x4d')]['id']);for(var _0x2953bd=0x0;_0x2953bd<_0x4423e8['length'];_0x2953bd+=0x1){let _0x28050b=_0x4423e8[_0x2953bd];for(var _0x3f998a=0x0;_0x3f998a<_0x28050b['Agents'][_0xa1c9('0x3d')];_0x3f998a+=0x1){let _0x12cdd5=_0x28050b[_0xa1c9('0x82')][_0x3f998a];var _0x1c5baa=_0x6e0efe[_0xa1c9('0x95')]();_0x1c5baa[_0xa1c9('0x42')](_0xa1c9('0x96'),_0x12cdd5['id']);_0x5f3e31[_0xa1c9('0x65')](db['sequelize']['query'](_0x1c5baa[_0xa1c9('0x97')](),{'type':db[_0xa1c9('0x4f')]['QueryTypes']['SELECT']})['then'](function(_0x5c9f06){if(_0x5c9f06['length']===0x1){return _0x12cdd5['id'];}else{var _0x4d6b40=_[_0xa1c9('0x98')](_[_0xa1c9('0x30')](_0x5c9f06,_0xa1c9('0x99')),function(_0x20c454){return _[_0xa1c9('0x9a')](_0x2c75e6,_0x20c454);});if(_0x4d6b40){return _0x12cdd5['id'];}}}));}}return BPromise[_0xa1c9('0x9b')](_0x5f3e31)['then'](function(_0x22fde9){_0x163589=_(_0x163589)[_0xa1c9('0x9c')](_0x22fde9)[_0xa1c9('0x9d')]()['value']();return db[_0xa1c9('0x31')]['find']({'where':{'id':_0x4c8c5e['params']['id']}})[_0xa1c9('0x28')](function(_0x3e67f4){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x52905a){return _0x3e67f4[_0xa1c9('0x8b')](_0x4c8c5e[_0xa1c9('0x38')][_0xa1c9('0x73')],{'transaction':_0x52905a})[_0xa1c9('0x28')](function(){if(!_[_0xa1c9('0x9e')](_0x163589)){return _0x3e67f4['removeAgents'](_0x163589,{'transaction':_0x52905a});}})[_0xa1c9('0x28')](function(){_0x163589['forEach'](function(_0x424be7){socket[_0xa1c9('0x76')]('userVoicePrefix:remove',{'UserId':_0x424be7,'VoicePrefixId':_0x3e67f4['id']});});});});});});})[_0xa1c9('0x28')](respondWithStatusCode(_0x3cb7d4,null))[_0xa1c9('0x4b')](handleError(_0x3cb7d4,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 6b01958..0b96f64 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 _0xed99=['VoicePrefix','save','update','remove','emit','events','../../mysqldb'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xed99,0x1e1));var _0x9ed9=function(_0x5a6a18,_0x2473f2){_0x5a6a18=_0x5a6a18-0x0;var _0x927d98=_0xed99[_0x5a6a18];return _0x927d98;};'use strict';var EventEmitter=require(_0x9ed9('0x0'));var VoicePrefix=require(_0x9ed9('0x1'))['db'][_0x9ed9('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9ed9('0x3'),'afterUpdate':_0x9ed9('0x4'),'afterDestroy':_0x9ed9('0x5')};function emitEvent(_0x2d26e8){return function(_0x5efff7,_0x116c1b,_0x4a35d7){VoicePrefixEvents[_0x9ed9('0x6')](_0x2d26e8+':'+_0x5efff7['id'],_0x5efff7);VoicePrefixEvents[_0x9ed9('0x6')](_0x2d26e8,_0x5efff7);_0x4a35d7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x30b3=['remove','emit','hasOwnProperty','hook','events','VoicePrefix','setMaxListeners','save','update'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x30b3,0x1e1));var _0x330b=function(_0xc2f54d,_0x242f6f){_0xc2f54d=_0xc2f54d-0x0;var _0x85900c=_0x30b3[_0xc2f54d];return _0x85900c;};'use strict';var EventEmitter=require(_0x330b('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x330b('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x330b('0x2')](0x0);var events={'afterCreate':_0x330b('0x3'),'afterUpdate':_0x330b('0x4'),'afterDestroy':_0x330b('0x5')};function emitEvent(_0x3bfafc){return function(_0xb95d38,_0x2d684c,_0x2a5d71){VoicePrefixEvents['emit'](_0x3bfafc+':'+_0xb95d38['id'],_0xb95d38);VoicePrefixEvents[_0x330b('0x6')](_0x3bfafc,_0xb95d38);_0x2a5d71(null);};}for(var e in events){if(events[_0x330b('0x7')](e)){var event=events[e];VoicePrefix[_0x330b('0x8')](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 66a3657..3cf17ee 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 _0xf550=['../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf550,0x19b));var _0x0f55=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0xf550[_0x12bcf7];return _0x2825a;};'use strict';var _=require(_0x0f55('0x0'));var util=require(_0x0f55('0x1'));var logger=require(_0x0f55('0x2'))(_0x0f55('0x3'));var moment=require(_0x0f55('0x4'));var BPromise=require(_0x0f55('0x5'));var rp=require(_0x0f55('0x6'));var fs=require('fs');var path=require(_0x0f55('0x7'));var rimraf=require(_0x0f55('0x8'));var config=require(_0x0f55('0x9'));var attributes=require(_0x0f55('0xa'));module[_0x0f55('0xb')]=function(_0xbd6f82,_0x3ed5e6){return _0xbd6f82[_0x0f55('0xc')]('VoicePrefix',attributes,{'tableName':_0x0f55('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91ea=['voice_prefixes','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define'];(function(_0x2d2888,_0x49f4c0){var _0x14d427=function(_0x198ab6){while(--_0x198ab6){_0x2d2888['push'](_0x2d2888['shift']());}};_0x14d427(++_0x49f4c0);}(_0x91ea,0x115));var _0xa91e=function(_0x2d60d5,_0x2e3fe5){_0x2d60d5=_0x2d60d5-0x0;var _0x4520f9=_0x91ea[_0x2d60d5];return _0x4520f9;};'use strict';var _=require('lodash');var util=require(_0xa91e('0x0'));var logger=require('../../config/logger')(_0xa91e('0x1'));var moment=require(_0xa91e('0x2'));var BPromise=require(_0xa91e('0x3'));var rp=require(_0xa91e('0x4'));var fs=require('fs');var path=require(_0xa91e('0x5'));var rimraf=require(_0xa91e('0x6'));var config=require(_0xa91e('0x7'));var attributes=require(_0xa91e('0x8'));module[_0xa91e('0x9')]=function(_0x203d6c,_0x43e8d2){return _0x203d6c[_0xa91e('0xa')]('VoicePrefix',attributes,{'tableName':_0xa91e('0xb'),'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 b55fb7e..92160d5 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 _0xac35=['request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket','register'];(function(_0x25ab80,_0x1fc7d4){var _0x4af8ae=function(_0x317f8c){while(--_0x317f8c){_0x25ab80['push'](_0x25ab80['shift']());}};_0x4af8ae(++_0x1fc7d4);}(_0xac35,0x141));var _0x5ac3=function(_0x3d5416,_0x28a599){_0x3d5416=_0x3d5416-0x0;var _0x17712c=_0xac35[_0x3d5416];return _0x17712c;};'use strict';var _=require(_0x5ac3('0x0'));var util=require(_0x5ac3('0x1'));var moment=require(_0x5ac3('0x2'));var BPromise=require(_0x5ac3('0x3'));var rs=require(_0x5ac3('0x4'));var fs=require('fs');var Redis=require(_0x5ac3('0x5'));var db=require(_0x5ac3('0x6'))['db'];var utils=require(_0x5ac3('0x7'));var logger=require(_0x5ac3('0x8'))(_0x5ac3('0x9'));var config=require(_0x5ac3('0xa'));var jayson=require(_0x5ac3('0xb'));var client=jayson[_0x5ac3('0xc')][_0x5ac3('0xd')]({'port':0x232a});config['redis']=_[_0x5ac3('0xe')](config['redis'],{'host':_0x5ac3('0xf'),'port':0x18eb});var socket=require(_0x5ac3('0x10'))(new Redis(config[_0x5ac3('0x11')]));require(_0x5ac3('0x12'))[_0x5ac3('0x13')](socket);function respondWithRpcPromise(_0x26e7fe,_0x4df25f,_0x139f05){return new BPromise(function(_0x5e3a51,_0x1d9420){return client[_0x5ac3('0x14')](_0x26e7fe,_0x139f05)[_0x5ac3('0x15')](function(_0x17c212){logger[_0x5ac3('0x16')](_0x5ac3('0x17'),_0x4df25f,_0x5ac3('0x18'));logger['debug'](_0x5ac3('0x19'),_0x4df25f,_0x5ac3('0x18'),JSON[_0x5ac3('0x1a')](_0x17c212));if(_0x17c212[_0x5ac3('0x1b')]){if(_0x17c212[_0x5ac3('0x1b')][_0x5ac3('0x1c')]===0x1f4){logger[_0x5ac3('0x1b')](_0x5ac3('0x17'),_0x4df25f,_0x17c212['error']['message']);return _0x1d9420(_0x17c212[_0x5ac3('0x1b')][_0x5ac3('0x1d')]);}logger['error'](_0x5ac3('0x17'),_0x4df25f,_0x17c212['error'][_0x5ac3('0x1d')]);return _0x5e3a51(_0x17c212[_0x5ac3('0x1b')][_0x5ac3('0x1d')]);}else{logger['info'](_0x5ac3('0x17'),_0x4df25f,_0x5ac3('0x18'));_0x5e3a51(_0x17c212[_0x5ac3('0x1e')][_0x5ac3('0x1d')]);}})['catch'](function(_0x22907d){logger[_0x5ac3('0x1b')](_0x5ac3('0x17'),_0x4df25f,_0x22907d);_0x1d9420(_0x22907d);});});} \ No newline at end of file +var _0xdcd5=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdcd5,0x110));var _0x5dcd=function(_0x1d0499,_0x23e22f){_0x1d0499=_0x1d0499-0x0;var _0x153fb3=_0xdcd5[_0x1d0499];return _0x153fb3;};'use strict';var _=require(_0x5dcd('0x0'));var util=require(_0x5dcd('0x1'));var moment=require(_0x5dcd('0x2'));var BPromise=require(_0x5dcd('0x3'));var rs=require(_0x5dcd('0x4'));var fs=require('fs');var Redis=require(_0x5dcd('0x5'));var db=require(_0x5dcd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5dcd('0x7'))(_0x5dcd('0x8'));var config=require(_0x5dcd('0x9'));var jayson=require(_0x5dcd('0xa'));var client=jayson[_0x5dcd('0xb')][_0x5dcd('0xc')]({'port':0x232a});config[_0x5dcd('0xd')]=_[_0x5dcd('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5dcd('0xf'))(new Redis(config[_0x5dcd('0xd')]));require(_0x5dcd('0x10'))['register'](socket);function respondWithRpcPromise(_0x1e1161,_0x29c3e1,_0xf0e115){return new BPromise(function(_0x1d46bc,_0x22680f){return client[_0x5dcd('0x11')](_0x1e1161,_0xf0e115)[_0x5dcd('0x12')](function(_0x57c64d){logger['info'](_0x5dcd('0x13'),_0x29c3e1,_0x5dcd('0x14'));logger['debug'](_0x5dcd('0x15'),_0x29c3e1,_0x5dcd('0x14'),JSON[_0x5dcd('0x16')](_0x57c64d));if(_0x57c64d[_0x5dcd('0x17')]){if(_0x57c64d[_0x5dcd('0x17')][_0x5dcd('0x18')]===0x1f4){logger[_0x5dcd('0x17')](_0x5dcd('0x13'),_0x29c3e1,_0x57c64d['error'][_0x5dcd('0x19')]);return _0x22680f(_0x57c64d[_0x5dcd('0x17')]['message']);}logger[_0x5dcd('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x29c3e1,_0x57c64d[_0x5dcd('0x17')][_0x5dcd('0x19')]);return _0x1d46bc(_0x57c64d[_0x5dcd('0x17')]['message']);}else{logger[_0x5dcd('0x1a')](_0x5dcd('0x13'),_0x29c3e1,_0x5dcd('0x14'));_0x1d46bc(_0x57c64d['result'][_0x5dcd('0x19')]);}})[_0x5dcd('0x1b')](function(_0x564b){logger['error'](_0x5dcd('0x13'),_0x29c3e1,_0x564b);_0x22680f(_0x564b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index b0c17ec..cb1296f 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 _0x9532=['emit','removeListener','./voicePrefix.events','save','remove','update'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x9532,0x8c));var _0x2953=function(_0x1e538b,_0x4fad05){_0x1e538b=_0x1e538b-0x0;var _0x3e50bb=_0x9532[_0x1e538b];return _0x3e50bb;};'use strict';var VoicePrefixEvents=require(_0x2953('0x0'));var events=[_0x2953('0x1'),_0x2953('0x2'),_0x2953('0x3')];function createListener(_0x3f89d9,_0xabd12e){return function(_0x51aa45){_0xabd12e[_0x2953('0x4')](_0x3f89d9,_0x51aa45);};}function removeListener(_0x3058d6,_0x5dceda){return function(){VoicePrefixEvents[_0x2953('0x5')](_0x3058d6,_0x5dceda);};}exports['register']=function(_0x12de4a){for(var _0x451c3c=0x0,_0x5b2aea=events['length'];_0x451c3c<_0x5b2aea;_0x451c3c++){var _0x21a76a=events[_0x451c3c];var _0x5cbdaa=createListener('voicePrefix:'+_0x21a76a,_0x12de4a);VoicePrefixEvents['on'](_0x21a76a,_0x5cbdaa);}}; \ No newline at end of file +var _0x682e=['register','length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x682e,0x1ce));var _0xe682=function(_0x57fa81,_0x4d79b7){_0x57fa81=_0x57fa81-0x0;var _0x276a2d=_0x682e[_0x57fa81];return _0x276a2d;};'use strict';var VoicePrefixEvents=require(_0xe682('0x0'));var events=[_0xe682('0x1'),_0xe682('0x2'),_0xe682('0x3')];function createListener(_0x1fc41a,_0x31f019){return function(_0x5cbf47){_0x31f019[_0xe682('0x4')](_0x1fc41a,_0x5cbf47);};}function removeListener(_0x10c8cd,_0x3705a2){return function(){VoicePrefixEvents[_0xe682('0x5')](_0x10c8cd,_0x3705a2);};}exports[_0xe682('0x6')]=function(_0x51e786){for(var _0x3b4c98=0x0,_0xd6995=events[_0xe682('0x7')];_0x3b4c98<_0xd6995;_0x3b4c98++){var _0x1ab428=events[_0x3b4c98];var _0x4e7e7d=createListener(_0xe682('0x8')+_0x1ab428,_0x51e786);VoicePrefixEvents['on'](_0x1ab428,_0x4e7e7d);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 0df505a..c697874 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x26bf51,_0x5e261a){var _0x503415=function(_0x92b028){while(--_0x92b028){_0x26bf51['push'](_0x26bf51['shift']());}};_0x503415(++_0x5e261a);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a550c,_0x4b1bc0){_0x5a550c=_0x5a550c-0x0;var _0x5f2417=_0xb10b[_0x5a550c];return _0x5f2417;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x26c488,_0xd793a){var _0x527b17=function(_0x4c6216){while(--_0x4c6216){_0x26c488['push'](_0x26c488['shift']());}};_0x527b17(++_0xd793a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 20edce5..f2405f8 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 _0x1a65=['Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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','STRING','inbound','outbound','ENUM','leastrecent','fewestcalls','rrmemory','wrandom','rrordered','setDataValue','getDataValue','type','dialMethod','preview','booked','includes','strategy','INTEGER','yes','all','periodic_announce','join','split','joinempty','leavewhenempty','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','predictive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT'];(function(_0x4e5447,_0xc66ae7){var _0xe664b2=function(_0x5dc92f){while(--_0x5dc92f){_0x4e5447['push'](_0x4e5447['shift']());}};_0xe664b2(++_0xc66ae7);}(_0x1a65,0x73));var _0x51a6=function(_0x53a318,_0x52fc08){_0x53a318=_0x53a318-0x0;var _0x536ac4=_0x1a65[_0x53a318];return _0x536ac4;};'use strict';var Sequelize=require(_0x51a6('0x0'));module['exports']={'name':{'type':Sequelize[_0x51a6('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x51a6('0x2'),_0x51a6('0x3')),'allowNull':![],'defaultValue':_0x51a6('0x2')},'musiconhold':{'type':Sequelize[_0x51a6('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x51a6('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x51a6('0x4')]('rr','ringall',_0x51a6('0x5'),_0x51a6('0x6'),'random',_0x51a6('0x7'),'linear',_0x51a6('0x8'),_0x51a6('0x9')),'allowNull':![],'defaultValue':'ringall','set':function(_0x47bb0e){this[_0x51a6('0xa')]('strategy',_0x47bb0e?_0x47bb0e:_0x51a6('0x7'));},'get':function(){var _0x2cb66e=this[_0x51a6('0xb')](_0x51a6('0xc'));var _0x37cce0=this[_0x51a6('0xb')](_0x51a6('0xd'));var _0x6b06ce=this[_0x51a6('0xb')]('strategy');if(_0x2cb66e===_0x51a6('0x3')){if(_0x37cce0===_0x51a6('0xe')){return null;}if(_0x37cce0===_0x51a6('0xf')&&![_0x51a6('0x7'),'roundrobin'][_0x51a6('0x10')](_0x6b06ce)){this['setDataValue'](_0x51a6('0x11'),_0x51a6('0x7'));}}return _0x6b06ce;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x51a6('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x51a6('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x51a6('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x51a6('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x51a6('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x51a6('0x4')](_0x51a6('0x13'),'no',_0x51a6('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x51a6('0x12')](0xb)},'autopausebusy':{'type':Sequelize[_0x51a6('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x51a6('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x51a6('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x51a6('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x51a6('0x4')](_0x51a6('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x51a6('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x51a6('0x4')](_0x51a6('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x51a6('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x51a6('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x51a6('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x51a6('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x51a6('0x4')](_0x51a6('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x51a6('0x4')](_0x51a6('0x13'),'no'),'defaultValue':_0x51a6('0x13')},'announce_holdtime':{'type':Sequelize[_0x51a6('0x4')](_0x51a6('0x13'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x51a6('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x51a6('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x51a6('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x51a6('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x51a6('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x51a6('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x51a6('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x51a6('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x51a6('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x51a6('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x51a6('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x51a6('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x51a6('0x1')]},'queue_quantity1':{'type':Sequelize[_0x51a6('0x1')]},'queue_quantity2':{'type':Sequelize[_0x51a6('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x51a6('0x1')]},'queue_less_than':{'type':Sequelize[_0x51a6('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x484050){this[_0x51a6('0xa')](_0x51a6('0x15'),_0x484050?_0x484050[_0x51a6('0x16')](','):[]);},'get':function(){return this[_0x51a6('0xb')](_0x51a6('0x15'))?this[_0x51a6('0xb')](_0x51a6('0x15'))[_0x51a6('0x17')](','):[];}},'joinempty':{'type':Sequelize[_0x51a6('0x1')],'defaultValue':_0x51a6('0x13'),'set':function(_0x4f72ea){this[_0x51a6('0xa')]('joinempty',_0x4f72ea?_0x4f72ea[_0x51a6('0x16')](','):undefined);},'get':function(){return this[_0x51a6('0xb')]('joinempty')?this[_0x51a6('0xb')](_0x51a6('0x18'))[_0x51a6('0x17')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x4f04d7){this[_0x51a6('0xa')](_0x51a6('0x19'),_0x4f04d7?_0x4f04d7[_0x51a6('0x16')](','):undefined);},'get':function(){return this[_0x51a6('0xb')](_0x51a6('0x19'))?this[_0x51a6('0xb')](_0x51a6('0x19'))[_0x51a6('0x17')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x51a6('0x4')](_0x51a6('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x51a6('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x51a6('0x4')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x51a6('0x1')]},'description':{'type':Sequelize[_0x51a6('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x3a4bac){this['setDataValue']('acw',_0x3a4bac);if(_0x3a4bac){if(this[_0x51a6('0xb')](_0x51a6('0x1a'))<0x2){this[_0x51a6('0xa')](_0x51a6('0x1a'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x51a6('0x1b')],'defaultValue':0x0,'comment':_0x51a6('0x1c')},'dialMethod':{'type':Sequelize[_0x51a6('0x4')](_0x51a6('0xe'),'progressive','power',_0x51a6('0x1d'),_0x51a6('0xf')),'defaultValue':'progressive','comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x51a6('0x12')](0x4)[_0x51a6('0x1e')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x51a6('0x1f')},'dialLimitQueue':{'type':Sequelize[_0x51a6('0x12')](0x4)[_0x51a6('0x1e')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x51a6('0x20')](0x2)[_0x51a6('0x1e')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x51a6('0x21')},'dialPredictiveOptimization':{'type':Sequelize[_0x51a6('0x4')](_0x51a6('0x22'),'dropRate'),'defaultValue':_0x51a6('0x23'),'comment':_0x51a6('0x24')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x51a6('0x20')](0x2)[_0x51a6('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x51a6('0x12')](0x3)[_0x51a6('0x1e')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x51a6('0x25')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x51a6('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x51a6('0x12')](0x3)[_0x51a6('0x1e')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x51a6('0x26')},'dialQueueOptions':{'type':Sequelize[_0x51a6('0x1')],'defaultValue':_0x51a6('0x27'),'comment':_0x51a6('0x28')},'dialQueueTimeout':{'type':Sequelize[_0x51a6('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x51a6('0x29')},'dialQueueProject':{'type':Sequelize[_0x51a6('0x1')],'comment':_0x51a6('0x2a')},'dialCongestionMaxRetry':{'type':Sequelize[_0x51a6('0x12')](0x3)[_0x51a6('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x51a6('0x2b')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x51a6('0x12')](0x5)[_0x51a6('0x1e')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x51a6('0x2c')},'dialBusyMaxRetry':{'type':Sequelize[_0x51a6('0x12')](0x3)[_0x51a6('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x51a6('0x2d')},'dialBusyRetryFrequency':{'type':Sequelize[_0x51a6('0x12')](0x5)[_0x51a6('0x1e')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x51a6('0x2e')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x51a6('0x12')](0x3)[_0x51a6('0x1e')],'defaultValue':0x3,'comment':_0x51a6('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x51a6('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x51a6('0x30')},'dialGlobalMaxRetry':{'type':Sequelize[_0x51a6('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x51a6('0x31')},'dialTimezone':{'type':Sequelize[_0x51a6('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x51a6('0x32')},'dialPrefix':{'type':Sequelize[_0x51a6('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x51a6('0x4')](_0x51a6('0x33'),'never',_0x51a6('0x34')),'defaultValue':_0x51a6('0x33')},'dialAMDActive':{'type':Sequelize[_0x51a6('0x1b')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x51a6('0x12')](0x9)[_0x51a6('0x1e')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x51a6('0x35')},'dialAMDGreeting':{'type':Sequelize[_0x51a6('0x12')](0x9)[_0x51a6('0x1e')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x51a6('0x36')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x51a6('0x1e')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x51a6('0x37')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x51a6('0x38')},'dialAMDMinWordLength':{'type':Sequelize[_0x51a6('0x12')](0x9)[_0x51a6('0x1e')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x51a6('0x39')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x51a6('0x12')](0x9)[_0x51a6('0x1e')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x51a6('0x12')](0x9)[_0x51a6('0x1e')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x51a6('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x51a6('0x12')](0x5)[_0x51a6('0x1e')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x51a6('0x1e')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x51a6('0x1e')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x51a6('0x3b')},'dialRecallInQueue':{'type':Sequelize[_0x51a6('0x1b')],'defaultValue':0x0,'comment':_0x51a6('0x3c')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x51a6('0x3d'),_0x51a6('0x3e')),'defaultValue':_0x51a6('0x3d')},'dialQueueProject2':{'type':Sequelize[_0x51a6('0x1')],'comment':_0x51a6('0x2a')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x51a6('0x1b')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x51a6('0x12')](0x3)[_0x51a6('0x1e')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x51a6('0x3f')},'dialCutDigit':{'type':Sequelize[_0x51a6('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x51a6('0x40')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x51a6('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x51a6('0x41')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x51a6('0x12')](0x5)[_0x51a6('0x1e')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x51a6('0x42')},'dialDropMaxRetry':{'type':Sequelize[_0x51a6('0x12')](0x3)[_0x51a6('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x51a6('0x12')](0x5)[_0x51a6('0x1e')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x51a6('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x51a6('0x12')](0x3)[_0x51a6('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x51a6('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x51a6('0x12')](0x5)[_0x51a6('0x1e')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x51a6('0x12')](0x3)[_0x51a6('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x51a6('0x45')},'dialMachineRetryFrequency':{'type':Sequelize[_0x51a6('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x51a6('0x12')](0x3)[_0x51a6('0x1e')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x51a6('0x46')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x51a6('0x1e')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x51a6('0x47')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x51a6('0x12')],'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(_0xe910a6){if(!_0xe910a6)this[_0x51a6('0xa')](_0x51a6('0x48'),null);this[_0x51a6('0xa')](_0x51a6('0x49'),_0xe910a6);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x51a6('0x12')](0x3)[_0x51a6('0x1e')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x51a6('0x12')](0x3)[_0x51a6('0x1e')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x51a6('0x1b')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x51a6('0x12')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x51a6('0x1b')],'defaultValue':![]}}; \ No newline at end of file +var _0x6361=['agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\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','STRING','name','inbound','default','ENUM','ringall','leastrecent','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','outbound','preview','booked','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','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).'];(function(_0x3e06dd,_0x55694f){var _0x4bbb8b=function(_0x3586fa){while(--_0x3586fa){_0x3e06dd['push'](_0x3e06dd['shift']());}};_0x4bbb8b(++_0x55694f);}(_0x6361,0xd2));var _0x1636=function(_0x116b78,_0x214acd){_0x116b78=_0x116b78-0x0;var _0x67780d=_0x6361[_0x116b78];return _0x67780d;};'use strict';var Sequelize=require(_0x1636('0x0'));module['exports']={'name':{'type':Sequelize[_0x1636('0x1')],'allowNull':![],'unique':_0x1636('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x1636('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x1636('0x3')},'musiconhold':{'type':Sequelize[_0x1636('0x1')],'defaultValue':_0x1636('0x4')},'announce':{'type':Sequelize[_0x1636('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x1636('0x5')]('rr',_0x1636('0x6'),_0x1636('0x7'),'fewestcalls',_0x1636('0x8'),_0x1636('0x9'),_0x1636('0xa'),_0x1636('0xb'),_0x1636('0xc')),'allowNull':![],'defaultValue':_0x1636('0x6'),'set':function(_0x57adbd){this[_0x1636('0xd')](_0x1636('0xe'),_0x57adbd?_0x57adbd:_0x1636('0x9'));},'get':function(){var _0x11fd7f=this[_0x1636('0xf')]('type');var _0x36e278=this[_0x1636('0xf')](_0x1636('0x10'));var _0x469603=this[_0x1636('0xf')](_0x1636('0xe'));if(_0x11fd7f===_0x1636('0x11')){if(_0x36e278===_0x1636('0x12')){return null;}if(_0x36e278===_0x1636('0x13')&&!['rrmemory','roundrobin']['includes'](_0x469603)){this[_0x1636('0xd')](_0x1636('0xe'),'rrmemory');}}return _0x469603;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x1636('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1636('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1636('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1636('0x1')]},'weight':{'type':Sequelize[_0x1636('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1636('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x15'),'no'),'defaultValue':_0x1636('0x15')},'autopause':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x15'),'no',_0x1636('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1636('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1636('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x1636('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1636('0x5')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x1636('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1636('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1636('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x1636('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x1636('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1636('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x15'),'no'),'defaultValue':_0x1636('0x15')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x1636('0x15'),'no',_0x1636('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x1636('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x1636('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x1636('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1636('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1636('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x1636('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1636('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x1636('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x1636('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x1636('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1636('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1636('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x1636('0x1')]},'queue_quantity1':{'type':Sequelize[_0x1636('0x1')]},'queue_quantity2':{'type':Sequelize[_0x1636('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x1636('0x1')]},'queue_less_than':{'type':Sequelize[_0x1636('0x1')]},'periodic_announce':{'type':Sequelize[_0x1636('0x18')],'set':function(_0x5290f1){this[_0x1636('0xd')]('periodic_announce',_0x5290f1?_0x5290f1[_0x1636('0x19')](','):[]);},'get':function(){return this[_0x1636('0xf')](_0x1636('0x1a'))?this['getDataValue'](_0x1636('0x1a'))[_0x1636('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x1636('0x1')],'defaultValue':_0x1636('0x15'),'set':function(_0x25dc46){this[_0x1636('0xd')](_0x1636('0x1c'),_0x25dc46?_0x25dc46['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x1636('0x1c'))?this[_0x1636('0xf')](_0x1636('0x1c'))[_0x1636('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x1636('0x1')],'defaultValue':'no','set':function(_0x5453b3){this[_0x1636('0xd')](_0x1636('0x1d'),_0x5453b3?_0x5453b3[_0x1636('0x19')](','):undefined);},'get':function(){return this[_0x1636('0xf')](_0x1636('0x1d'))?this[_0x1636('0xf')]('leavewhenempty')[_0x1636('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1636('0x5')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1636('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x1636('0x1')]},'description':{'type':Sequelize[_0x1636('0x1')]},'acw':{'type':Sequelize[_0x1636('0x1e')],'defaultValue':0x0,'set':function(_0x446dfc){this[_0x1636('0xd')](_0x1636('0x1f'),_0x446dfc);if(_0x446dfc){if(this[_0x1636('0xf')](_0x1636('0x20'))<0x2){this[_0x1636('0xd')](_0x1636('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x1636('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1636('0x1e')],'defaultValue':0x0,'comment':_0x1636('0x21')},'dialMethod':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x12'),_0x1636('0x22'),_0x1636('0x23'),'predictive',_0x1636('0x13')),'defaultValue':_0x1636('0x22'),'comment':_0x1636('0x24')},'dialLimitChannel':{'type':Sequelize[_0x1636('0x14')](0x4)[_0x1636('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1636('0x26')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x1636('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1636('0x27')},'dialPowerLevel':{'type':Sequelize[_0x1636('0x28')](0x2)[_0x1636('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1636('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x2a'),'dropRate'),'defaultValue':_0x1636('0x2b'),'comment':_0x1636('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x1636('0x28')](0x2)[_0x1636('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x1636('0x2d')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x1636('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1636('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1636('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x1636('0x14')](0x3)[_0x1636('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x1636('0x1')],'defaultValue':_0x1636('0x2f'),'comment':_0x1636('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1636('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x1636('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1636('0x14')](0x3)[_0x1636('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1636('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1636('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1636('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0x1636('0x14')](0x3)[_0x1636('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1636('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1636('0x14')](0x5)[_0x1636('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1636('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1636('0x25')],'defaultValue':0x3,'comment':_0x1636('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1636('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1636('0x37')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1636('0x14')](0x3)[_0x1636('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1636('0x38')},'dialTimezone':{'type':Sequelize[_0x1636('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x1636('0x39')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x1636('0x3a'),_0x1636('0x3b'),_0x1636('0x3c')),'defaultValue':_0x1636('0x3a')},'dialAMDActive':{'type':Sequelize[_0x1636('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1636('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1636('0x3d')},'dialAMDGreeting':{'type':Sequelize[_0x1636('0x14')](0x9)[_0x1636('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1636('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1636('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1636('0x3f')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1636('0x14')](0x9)[_0x1636('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1636('0x40')},'dialAMDMinWordLength':{'type':Sequelize[_0x1636('0x14')](0x9)[_0x1636('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1636('0x41')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1636('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1636('0x14')](0x5)[_0x1636('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1636('0x42')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1636('0x14')](0x9)[_0x1636('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1636('0x43')},'dialRecallMeTimeout':{'type':Sequelize[_0x1636('0x14')](0x5)[_0x1636('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x1636('0x44')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1636('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1636('0x5')](_0x1636('0x46'),'ASC'),'defaultValue':_0x1636('0x46')},'dialQueueProject2':{'type':Sequelize[_0x1636('0x1')],'comment':_0x1636('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x1636('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1636('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x1636('0x14')](0x3)[_0x1636('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1636('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1636('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1636('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1636('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1636('0x49')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1636('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1636('0x4a')},'dialDropRetryFrequency':{'type':Sequelize[_0x1636('0x14')](0x5)[_0x1636('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1636('0x14')](0x3)[_0x1636('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1636('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1636('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1636('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0x1636('0x14')](0x3)[_0x1636('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1636('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1636('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1636('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1636('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1636('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x1636('0x50')},'mandatoryDisposition':{'type':Sequelize[_0x1636('0x1e')],'defaultValue':![],'comment':_0x1636('0x51'),'set':function(_0x2f389a){if(!_0x2f389a)this['setDataValue'](_0x1636('0x52'),null);this[_0x1636('0xd')](_0x1636('0x53'),_0x2f389a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x1636('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1636('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1636('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x1636('0x14')](0x3)[_0x1636('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x1636('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 68e2ac5..0795ab4 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 _0xa41a=['createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','ids','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','inbound','QueueCampaigns','filter','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','index','rawAttributes','key','where','include','VoiceQueue','findAll','rows','catch','params','model','query','keys','attributes','intersection','fields','length','merge','options','create','body','user','role','VoiceQueues','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit'];(function(_0x5a3678,_0x1c4e10){var _0x220f52=function(_0x5ab2d4){while(--_0x5ab2d4){_0x5a3678['push'](_0x5a3678['shift']());}};_0x220f52(++_0x1c4e10);}(_0xa41a,0x6b));var _0xaa41=function(_0x3ab6cb,_0x591249){_0x3ab6cb=_0x3ab6cb-0x0;var _0x108ae5=_0xa41a[_0x3ab6cb];return _0x108ae5;};'use strict';var moment=require(_0xaa41('0x0'));var BPromise=require(_0xaa41('0x1'));var util=require('util');var _=require(_0xaa41('0x2'));var squel=require(_0xaa41('0x3'));var Redis=require(_0xaa41('0x4'));var qs=require(_0xaa41('0x5'));var logger=require(_0xaa41('0x6'))(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var db=require(_0xaa41('0x9'))['db'];config['redis']=_[_0xaa41('0xa')](config[_0xaa41('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xb')]));require(_0xaa41('0xc'))['register'](socket);function respondWithStatusCode(_0x31df43,_0x33f66b){_0x33f66b=_0x33f66b||0xcc;return function(_0x409dab){if(_0x409dab){return _0x31df43[_0xaa41('0xd')](_0x33f66b);}return _0x31df43[_0xaa41('0xe')](_0x33f66b)[_0xaa41('0xf')]();};}function respondWithResult(_0x806f08,_0x423a19){_0x423a19=_0x423a19||0xc8;return function(_0x1c291e){if(_0x1c291e){return _0x806f08['status'](_0x423a19)[_0xaa41('0x10')](_0x1c291e);}};}function respondWithFilteredResult(_0x10cda9,_0x524cab){return function(_0x54827c){if(_0x54827c){var _0x1d0a54=typeof _0x524cab['offset']===_0xaa41('0x11')&&typeof _0x524cab[_0xaa41('0x12')]===_0xaa41('0x11');var _0x889d44=_0x54827c[_0xaa41('0x13')];var _0x4eaf81=_0x1d0a54?0x0:_0x524cab[_0xaa41('0x14')];var _0x178170=_0x1d0a54?_0x54827c[_0xaa41('0x13')]:_0x524cab[_0xaa41('0x14')]+_0x524cab[_0xaa41('0x12')];var _0x2005ae;if(_0x178170>=_0x889d44){_0x178170=_0x889d44;_0x2005ae=0xc8;}else{_0x2005ae=0xce;}_0x10cda9[_0xaa41('0xe')](_0x2005ae);return _0x10cda9['set'](_0xaa41('0x15'),_0x4eaf81+'-'+_0x178170+'/'+_0x889d44)[_0xaa41('0x10')](_0x54827c);}return null;};}function saveUpdates(_0x4210fa){return function(_0x391b01){if(_0x391b01){return _0x391b01[_0xaa41('0x16')](_0x4210fa)[_0xaa41('0x17')](function(_0x29efe5){return _0x29efe5;});}return null;};}function removeEntity(_0x46e6d3){return function(_0x150ddf){if(_0x150ddf){return _0x150ddf['destroy']()['then'](function(){var _0x1f502a=_0x150ddf[_0xaa41('0x18')]({'plain':!![]});var _0x35c753=[{'name':'VoiceQueues','value':_0xaa41('0x19'),'ignore':![]},{'name':_0xaa41('0x1a'),'value':'outbound','ignore':![]}];var _0x513c61=_(_0x35c753)[_0xaa41('0x1b')]('ignore')[_0xaa41('0x1c')](_0xaa41('0x1d'))[_0xaa41('0x1d')]();if(_[_0xaa41('0x1e')](_0x513c61,_0x1f502a[_0xaa41('0x1f')])){return;}var _0x4eb01f=_[_0xaa41('0x20')](_0x35c753,[_0xaa41('0x1d'),_0x1f502a[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x22')][_0xaa41('0x23')]({'where':{'type':_0x4eb01f,'resourceId':_0x1f502a['id']}})['then'](function(){return _0x150ddf;});})['then'](function(){_0x46e6d3[_0xaa41('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x493a10){return function(_0x12e362){if(!_0x12e362){_0x493a10['sendStatus'](0x194);}return _0x12e362;};}function handleError(_0x536bed,_0x2d0ac0){_0x2d0ac0=_0x2d0ac0||0x1f4;return function(_0x9c8c21){logger[_0xaa41('0x24')](_0x9c8c21[_0xaa41('0x25')]);if(_0x9c8c21[_0xaa41('0x21')]){delete _0x9c8c21[_0xaa41('0x21')];}_0x536bed['status'](_0x2d0ac0)[_0xaa41('0x26')](_0x9c8c21);};}exports[_0xaa41('0x27')]=function(_0x63c18c,_0x9a16e3){var _0x1d8c2b={};var _0x4466a3={'count':0x0,'rows':[]};var _0x30f88e=_[_0xaa41('0x1c')](db['VoiceQueue'][_0xaa41('0x28')],function(_0x48b48b){return{'name':_0x48b48b['fieldName'],'type':_0x48b48b[_0xaa41('0x1f')][_0xaa41('0x29')]};});_0x1d8c2b=qs['getOptions'](_0x30f88e,_0x63c18c);var _0x392b5d={'where':_0x1d8c2b[_0xaa41('0x2a')]};return db['VoiceQueue']['count'](_0x392b5d)['then'](function(_0x1cf3da){_0x4466a3[_0xaa41('0x13')]=_0x1cf3da;_0x1d8c2b[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x63c18c['query']);return db[_0xaa41('0x2c')][_0xaa41('0x2d')](_0x1d8c2b);})[_0xaa41('0x17')](function(_0x4de770){_0x4466a3[_0xaa41('0x2e')]=_0x4de770;return _0x4466a3;})[_0xaa41('0x17')](respondWithFilteredResult(_0x9a16e3,_0x1d8c2b))[_0xaa41('0x2f')](handleError(_0x9a16e3,null));};exports['show']=function(_0x252c62,_0x374117){var _0x57fe1d={'raw':![],'where':{'id':_0x252c62[_0xaa41('0x30')]['id']}},_0x23eb50={};_0x23eb50[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x2c')]['rawAttributes']);_0x23eb50[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x252c62[_0xaa41('0x32')]);_0x23eb50['filters']=_['intersection'](_0x23eb50['model'],_0x23eb50[_0xaa41('0x32')]);_0x57fe1d[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x23eb50[_0xaa41('0x31')],qs['fields'](_0x252c62['query'][_0xaa41('0x36')]));_0x57fe1d[_0xaa41('0x34')]=_0x57fe1d[_0xaa41('0x34')][_0xaa41('0x37')]?_0x57fe1d[_0xaa41('0x34')]:_0x23eb50[_0xaa41('0x31')];if(_0x252c62[_0xaa41('0x32')]['includeAll']){_0x57fe1d[_0xaa41('0x2b')]=[{'all':!![]}];}_0x57fe1d=_[_0xaa41('0x38')]({},_0x57fe1d,_0x252c62[_0xaa41('0x39')]);return db[_0xaa41('0x2c')]['find'](_0x57fe1d)['then'](handleEntityNotFound(_0x374117,null))[_0xaa41('0x17')](respondWithResult(_0x374117,null))[_0xaa41('0x2f')](handleError(_0x374117,null));};exports['create']=function(_0x4101ab,_0x563687){return db[_0xaa41('0x2c')][_0xaa41('0x3a')](_0x4101ab[_0xaa41('0x3b')],{})[_0xaa41('0x17')](function(_0x3e6cac){var _0x12ba1a=_0x4101ab[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x12ba1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12ba1a[_0xaa41('0x3d')]===_0xaa41('0x3c')){var _0x35c685=_0x3e6cac[_0xaa41('0x18')]({'plain':!![]});var _0xc84fb8=[{'name':_0xaa41('0x3e'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0x4f9086=_[_0xaa41('0x20')](_0xc84fb8,[_0xaa41('0x1d'),_0x35c685[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x40')][_0xaa41('0x20')]({'where':{'name':_0x4f9086,'userProfileId':_0x12ba1a[_0xaa41('0x41')]},'raw':!![]})['then'](function(_0x124992){if(_0x124992&&_0x124992['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa41('0x3a')]({'name':_0x35c685['name'],'resourceId':_0x35c685['id'],'type':_0x124992['name'],'sectionId':_0x124992['id']},{})['then'](function(){return _0x3e6cac;});}else{return _0x3e6cac;}})[_0xaa41('0x2f')](function(_0x525b09){logger[_0xaa41('0x24')](_0xaa41('0x42'),_0x525b09);throw _0x525b09;});}return _0x3e6cac;})['then'](respondWithResult(_0x563687,0xc9))['catch'](handleError(_0x563687,null));};exports[_0xaa41('0x43')]=function(_0x1b7b97,_0x1bb973){var _0x2af8ba={'where':{'id':_0x1b7b97[_0xaa41('0x30')]['id']}},_0x3fe1a9={};_0x3fe1a9[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x2c')]['rawAttributes']);_0x2af8ba[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x3fe1a9[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x36')]));_0x2af8ba['attributes']=_0x2af8ba[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2af8ba[_0xaa41('0x34')]:_0x3fe1a9[_0xaa41('0x31')];if(_0x1b7b97['query'][_0xaa41('0x44')]){_0x2af8ba['include']=[{'all':!![]}];}_0x2af8ba=_['merge']({},_0x2af8ba,_0x1b7b97[_0xaa41('0x39')]);return db[_0xaa41('0x2c')][_0xaa41('0x20')](_0x2af8ba)['then'](handleEntityNotFound(_0x1bb973,null))[_0xaa41('0x17')](function(_0x3e1a73){if(_0x3e1a73){var _0x853ccb=_0x3e1a73['get']({'plain':!![]});_0x853ccb=qs[_0xaa41('0x45')](_0x853ccb,['id',_0xaa41('0x46'),_0xaa41('0x47')]);_0x1b7b97[_0xaa41('0x3b')]=_[_0xaa41('0x45')](_0x1b7b97[_0xaa41('0x3b')],['id',_0xaa41('0x46'),_0xaa41('0x47')]);return db['VoiceQueue'][_0xaa41('0x3a')](_['merge'](_0x853ccb,_0x1b7b97['body']),{'include':_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x44')]?[{'all':!![]}]:undefined})[_0xaa41('0x17')](function(_0x11f7d9){var _0x14aab0=_0x1b7b97[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x14aab0)throw new Error(_0xaa41('0x48'));if(_0x14aab0['role']===_0xaa41('0x3c')){var _0x14b0f0=_0x11f7d9[_0xaa41('0x18')]({'plain':!![]});var _0x4f9e92=[{'name':_0xaa41('0x3e'),'value':_0xaa41('0x19')},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0xd36d1a=_[_0xaa41('0x20')](_0x4f9e92,['value',_0x14b0f0[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0xd36d1a,'userProfileId':_0x14aab0[_0xaa41('0x41')]},'raw':!![]})[_0xaa41('0x17')](function(_0x3a29d2){if(_0x3a29d2&&_0x3a29d2['autoAssociation']===0x0){return db[_0xaa41('0x22')][_0xaa41('0x3a')]({'name':_0x14b0f0[_0xaa41('0x21')],'resourceId':_0x14b0f0['id'],'type':_0x3a29d2[_0xaa41('0x21')],'sectionId':_0x3a29d2['id']},{})[_0xaa41('0x17')](function(){return _0x11f7d9;});}else{return _0x11f7d9;}})['catch'](function(_0x2ae70c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ae70c);throw _0x2ae70c;});}return _0x11f7d9;});}})[_0xaa41('0x17')](respondWithResult(_0x1bb973,0xc9))['catch'](handleError(_0x1bb973,null));};exports[_0xaa41('0x16')]=function(_0xbbf261,_0x169ddf){if(_0xbbf261['body']['id']){delete _0xbbf261[_0xaa41('0x3b')]['id'];}return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0xbbf261[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x169ddf,null))[_0xaa41('0x17')](saveUpdates(_0xbbf261[_0xaa41('0x3b')],null))[_0xaa41('0x17')](respondWithResult(_0x169ddf,null))[_0xaa41('0x2f')](handleError(_0x169ddf,null));};exports['destroy']=function(_0x35a09e,_0x40cdfc){return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x35a09e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x40cdfc,null))[_0xaa41('0x17')](removeEntity(_0x40cdfc,null))[_0xaa41('0x2f')](handleError(_0x40cdfc,null));};exports[_0xaa41('0x49')]=function(_0xfbe748,_0x320ce7){var _0x5ea056={'raw':![],'where':{}};var _0x55a85c={};var _0x5cb34d={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xfbe748['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x320ce7,null))['then'](function(_0x576e6e){if(_0x576e6e){_0x55a85c[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x4a')][_0xaa41('0x28')]);_0x55a85c['query']=_[_0xaa41('0x33')](_0xfbe748[_0xaa41('0x32')]);_0x55a85c[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],_0x55a85c[_0xaa41('0x32')]);_0x5ea056[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],qs['fields'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5ea056['attributes']=_0x5ea056['attributes']['length']?_0x5ea056[_0xaa41('0x34')]:_0x55a85c['model'];if(!_0xfbe748[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x5ea056[_0xaa41('0x12')]=qs['limit'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5ea056[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xfbe748['query']['offset']);}_0x5ea056[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfbe748['query']['sort']);_0x5ea056[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfbe748[_0xaa41('0x32')],_0x55a85c[_0xaa41('0x4b')]));_0x5ea056['where'][_0xaa41('0x50')]=_0x576e6e['id'];if(_0xfbe748['query']['filter']){_0x5ea056['where']=_[_0xaa41('0x38')](_0x5ea056[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5ea056['attributes'],function(_0x229297){var _0x2adf93={};_0x2adf93[_0x229297]={'$like':'%'+_0xfbe748[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x2adf93;})});}_0x5ea056=_[_0xaa41('0x38')]({},_0x5ea056,_0xfbe748[_0xaa41('0x39')]);return db[_0xaa41('0x4a')]['count']({'where':_0x5ea056[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x40b47c){_0x5cb34d[_0xaa41('0x13')]=_0x40b47c;if(_0xfbe748['query'][_0xaa41('0x44')]){_0x5ea056['include']=[{'all':!![]}];}return db[_0xaa41('0x4a')][_0xaa41('0x2d')](_0x5ea056);})[_0xaa41('0x17')](function(_0x143ef0){_0x5cb34d['rows']=_0x143ef0;return _0x5cb34d;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x320ce7,_0x5ea056))[_0xaa41('0x2f')](handleError(_0x320ce7,null));};exports[_0xaa41('0x51')]=function(_0x304aad,_0x59052d){var _0x140d78={'raw':!![],'where':{}};var _0x50197b={};var _0x55d380={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x304aad[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x59052d,null))[_0xaa41('0x17')](function(_0x582d79){if(_0x582d79){_0x50197b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x52')][_0xaa41('0x28')]);_0x50197b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x304aad[_0xaa41('0x32')]);_0x50197b['filters']=_[_0xaa41('0x35')](_0x50197b[_0xaa41('0x31')],_0x50197b[_0xaa41('0x32')]);_0x140d78['attributes']=_['intersection'](_0x50197b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x304aad['query'][_0xaa41('0x36')]));_0x140d78[_0xaa41('0x34')]=_0x140d78['attributes'][_0xaa41('0x37')]?_0x140d78[_0xaa41('0x34')]:_0x50197b[_0xaa41('0x31')];if(!_0x304aad[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x140d78[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x304aad['query']['limit']);_0x140d78[_0xaa41('0x14')]=qs['offset'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x140d78[_0xaa41('0x4d')]=qs['sort'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x140d78[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x304aad[_0xaa41('0x32')],_0x50197b['filters']));_0x140d78[_0xaa41('0x2a')]['VoiceQueueId']=_0x582d79['id'];if(_0x304aad['query'][_0xaa41('0x1b')]){_0x140d78[_0xaa41('0x2a')]=_['merge'](_0x140d78['where'],{'$or':_[_0xaa41('0x1c')](_0x140d78[_0xaa41('0x34')],function(_0x3c189d){var _0x447183={};_0x447183[_0x3c189d]={'$like':'%'+_0x304aad['query'][_0xaa41('0x1b')]+'%'};return _0x447183;})});}_0x140d78=_[_0xaa41('0x38')]({},_0x140d78,_0x304aad[_0xaa41('0x39')]);return db['CmHopperHistory'][_0xaa41('0x13')]({'where':_0x140d78[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x5697b6){_0x55d380[_0xaa41('0x13')]=_0x5697b6;if(_0x304aad['query']['includeAll']){_0x140d78[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x52')]['findAll'](_0x140d78);})[_0xaa41('0x17')](function(_0x9e8ebb){_0x55d380[_0xaa41('0x2e')]=_0x9e8ebb;return _0x55d380;});}})['then'](respondWithFilteredResult(_0x59052d,_0x140d78))[_0xaa41('0x2f')](handleError(_0x59052d,null));};exports[_0xaa41('0x54')]=function(_0x1a2deb,_0x16dcac){var _0x38f5d0={'raw':!![],'where':{}};var _0x4e087d={};var _0x24eb2e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x1a2deb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x16dcac,null))[_0xaa41('0x17')](function(_0x33ec81){if(_0x33ec81){_0x4e087d[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x56')][_0xaa41('0x28')]);_0x4e087d[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x1a2deb['query']);_0x4e087d[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x4e087d['model'],_0x4e087d[_0xaa41('0x32')]);_0x38f5d0['attributes']=_[_0xaa41('0x35')](_0x4e087d[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x36')]));_0x38f5d0[_0xaa41('0x34')]=_0x38f5d0[_0xaa41('0x34')]['length']?_0x38f5d0[_0xaa41('0x34')]:_0x4e087d[_0xaa41('0x31')];if(!_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x38f5d0[_0xaa41('0x12')]=qs['limit'](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x12')]);_0x38f5d0[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x1a2deb[_0xaa41('0x32')]['offset']);}_0x38f5d0[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x1a2deb['query'][_0xaa41('0x4e')]);_0x38f5d0[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x1a2deb[_0xaa41('0x32')],_0x4e087d[_0xaa41('0x4b')]));_0x38f5d0[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x33ec81['id'];if(_0x1a2deb['query'][_0xaa41('0x1b')]){_0x38f5d0[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x38f5d0[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x38f5d0[_0xaa41('0x34')],function(_0x5489be){var _0x56f5ff={};_0x56f5ff[_0x5489be]={'$like':'%'+_0x1a2deb['query'][_0xaa41('0x1b')]+'%'};return _0x56f5ff;})});}_0x38f5d0=_[_0xaa41('0x38')]({},_0x38f5d0,_0x1a2deb['options']);return db[_0xaa41('0x56')][_0xaa41('0x13')]({'where':_0x38f5d0['where']})[_0xaa41('0x17')](function(_0x1da898){_0x24eb2e[_0xaa41('0x13')]=_0x1da898;if(_0x1a2deb[_0xaa41('0x32')]['includeAll']){_0x38f5d0[_0xaa41('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xaa41('0x2d')](_0x38f5d0);})[_0xaa41('0x17')](function(_0x374873){_0x24eb2e[_0xaa41('0x2e')]=_0x374873;return _0x24eb2e;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x16dcac,_0x38f5d0))[_0xaa41('0x2f')](handleError(_0x16dcac,null));};exports[_0xaa41('0x57')]=function(_0x27363e,_0x25cac8){var _0x5381d5={'raw':!![],'where':{}};var _0x276013={};var _0x3135c3={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x27363e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25cac8,null))[_0xaa41('0x17')](function(_0x408d95){if(_0x408d95){_0x276013[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x58')][_0xaa41('0x28')]);_0x276013[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x27363e[_0xaa41('0x32')]);_0x276013['filters']=_[_0xaa41('0x35')](_0x276013[_0xaa41('0x31')],_0x276013[_0xaa41('0x32')]);_0x5381d5[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x276013['model'],qs['fields'](_0x27363e[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5381d5['attributes']=_0x5381d5[_0xaa41('0x34')][_0xaa41('0x37')]?_0x5381d5['attributes']:_0x276013['model'];if(!_0x27363e['query'][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x5381d5[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5381d5[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x5381d5[_0xaa41('0x4d')]=qs['sort'](_0x27363e['query'][_0xaa41('0x4e')]);_0x5381d5[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x27363e['query'],_0x276013[_0xaa41('0x4b')]));_0x5381d5[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x408d95['id'];if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x5381d5[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x5381d5[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5381d5['attributes'],function(_0x56bd21){var _0x56661a={};_0x56661a[_0x56bd21]={'$like':'%'+_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x56661a;})});}_0x5381d5=_['merge']({},_0x5381d5,_0x27363e['options']);return db[_0xaa41('0x58')][_0xaa41('0x13')]({'where':_0x5381d5['where']})['then'](function(_0xf651b7){_0x3135c3['count']=_0xf651b7;if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x44')]){_0x5381d5[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x58')][_0xaa41('0x2d')](_0x5381d5);})[_0xaa41('0x17')](function(_0x211455){_0x3135c3[_0xaa41('0x2e')]=_0x211455;return _0x3135c3;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x25cac8,_0x5381d5))['catch'](handleError(_0x25cac8,null));};exports['getTeams']=function(_0x38884d,_0x25d938){var _0x337655={};var _0x415705={};var _0x3efb43;var _0xae746;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x38884d[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25d938,null))[_0xaa41('0x17')](function(_0x17442e){if(_0x17442e){_0x3efb43=_0x17442e;_0x415705[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x59')]['rawAttributes']);_0x415705[_0xaa41('0x32')]=_['keys'](_0x38884d[_0xaa41('0x32')]);_0x415705[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],_0x415705[_0xaa41('0x32')]);_0x337655[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],qs['fields'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x36')]));_0x337655[_0xaa41('0x34')]=_0x337655[_0xaa41('0x34')][_0xaa41('0x37')]?_0x337655[_0xaa41('0x34')]:_0x415705[_0xaa41('0x31')];_0x337655[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x38884d[_0xaa41('0x32')]['sort']);_0x337655['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x38884d[_0xaa41('0x32')],_0x415705[_0xaa41('0x4b')]));if(_0x38884d[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x337655[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x337655[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x337655['attributes'],function(_0x49b468){var _0x17018e={};_0x17018e[_0x49b468]={'$like':'%'+_0x38884d[_0xaa41('0x32')]['filter']+'%'};return _0x17018e;})});}_0x337655=_[_0xaa41('0x38')]({},_0x337655,_0x38884d['options']);return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x50e03d){if(_0x50e03d){_0xae746=_0x50e03d['length'];if(!_0x38884d[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x337655['limit']=qs['limit'](_0x38884d[_0xaa41('0x32')]['limit']);_0x337655[_0xaa41('0x14')]=qs['offset'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x182b0b){if(_0x182b0b){return _0x182b0b?{'count':_0xae746,'rows':_0x182b0b}:null;}})[_0xaa41('0x17')](respondWithResult(_0x25d938,null))[_0xaa41('0x2f')](handleError(_0x25d938,null));};exports['addTeams']=function(_0x4363b5,_0x1fa1f5){var _0x50883c=_0x4363b5[_0xaa41('0x3b')][_0xaa41('0x5b')];var _0x1c3d7f=_[_0xaa41('0x1c')](_0x50883c,'id');return db['Team'][_0xaa41('0x2d')]({'where':{'id':_0x1c3d7f},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]}]})[_0xaa41('0x17')](function(_0xe2574a){if(_0xe2574a){var _0x4d83ce=_['flatMap'](_0xe2574a,function(_0x214ebe){var _0x2df75c=_0x214ebe[_0xaa41('0x18')]({'plain':!![]});_0x2df75c[_0xaa41('0x5d')][_0xaa41('0x61')](function(_0x401586){_0x401586['penalty']=_[_0xaa41('0x20')](_0x50883c,{'id':_0x2df75c['id']})[_0xaa41('0x62')];});return _0x2df75c[_0xaa41('0x5d')];});return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x4363b5[_0xaa41('0x30')]['id']}})['then'](function(_0xe8076e){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4cf0c5){return _0xe8076e[_0xaa41('0x65')](_0x1c3d7f,{'transaction':_0x4cf0c5})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x50883c,function(_0x255e76){return db[_0xaa41('0x67')][_0xaa41('0x68')]({'TeamId':_0x255e76['id'],'VoiceQueueId':_0x4363b5[_0xaa41('0x30')]['id'],'penalty':_0x255e76[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x4d83ce,function(_0x19a42c){return db[_0xaa41('0x69')][_0xaa41('0x6a')]({'where':{'UserId':_0x19a42c['id'],'VoiceQueueId':_0x4363b5['params']['id']},'defaults':{'penalty':_0x19a42c['penalty']},'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_[_0xaa41('0x1b')](_0x4d83ce,{'online':!![]}),function(_0x2c4595){return db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x2c4595[_0xaa41('0x21')],'UserId':_0x2c4595['id'],'queue_name':_0xe8076e['name'],'VoiceQueueId':_0xe8076e['id'],'interface':_[_0xaa41('0x6c')](_0x2c4595[_0xaa41('0x60')])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x2c4595[_0xaa41('0x21')]):_0x2c4595[_0xaa41('0x60')],'paused':_0x2c4595[_0xaa41('0x5f')]||![],'penalty':_0x2c4595[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){_0x4d83ce[_0xaa41('0x61')](function(_0x3f2dbb){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':_0x3f2dbb['id'],'VoiceQueueId':_0xe8076e['id']});});});});});}})[_0xaa41('0x17')](respondWithStatusCode(_0x1fa1f5,null))[_0xaa41('0x2f')](handleError(_0x1fa1f5,null));};exports['removeTeams']=function(_0x33f008,_0x1489fe){return db[_0xaa41('0x59')][_0xaa41('0x2d')]({'where':{'id':_0x33f008['query'][_0xaa41('0x70')]},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xaa41('0x17')](handleEntityNotFound(_0x1489fe,null))[_0xaa41('0x17')](function(_0x4baae3){var _0xc59a12=_['map'](_0x4baae3,'id');var _0x50a526=[];var _0x3dd3fa=[];var _0x552493=squel['select']();_0x552493[_0xaa41('0x71')](_0xaa41('0x72'))[_0xaa41('0x73')]('team_has_voice_queues','tq')[_0xaa41('0x74')](_0xaa41('0x75'),'ut',_0xaa41('0x76'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x33f008[_0xaa41('0x30')]['id']);for(var _0x29d34a=0x0;_0x29d34a<_0x4baae3[_0xaa41('0x37')];_0x29d34a+=0x1){let _0x48e2cf=_0x4baae3[_0x29d34a];for(var _0x410d6e=0x0;_0x410d6e<_0x48e2cf[_0xaa41('0x5d')][_0xaa41('0x37')];_0x410d6e+=0x1){let _0x3361f5=_0x48e2cf[_0xaa41('0x5d')][_0x410d6e];var _0x4f1bcb=_0x552493['clone']();_0x4f1bcb[_0xaa41('0x2a')](_0xaa41('0x78'),_0x3361f5['id']);_0x3dd3fa[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x4f1bcb[_0xaa41('0x7a')](),{'type':db['sequelize'][_0xaa41('0x7b')][_0xaa41('0x7c')]})['then'](function(_0x40f4ce){if(_0x40f4ce[_0xaa41('0x37')]===0x1){return _0x3361f5['id'];}else{var _0x95300a=_[_0xaa41('0x7d')](_[_0xaa41('0x1c')](_0x40f4ce,_0xaa41('0x7e')),function(_0x1926bd){return _['includes'](_0xc59a12,_0x1926bd);});if(_0x95300a){return _0x3361f5['id'];}}}));}}return BPromise[_0xaa41('0x7f')](_0x3dd3fa)[_0xaa41('0x17')](function(_0x5404cd){_0x50a526=_(_0x50a526)[_0xaa41('0x80')](_0x5404cd)[_0xaa41('0x81')]()[_0xaa41('0x1d')]();return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x33f008[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(_0x339537){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4b84bc){return _0x339537[_0xaa41('0x82')](_0x33f008[_0xaa41('0x32')]['ids'],{'transaction':_0x4b84bc})['then'](function(){if(!_[_0xaa41('0x83')](_0x50a526)){return _0x339537[_0xaa41('0x84')](_0x50a526,{'transaction':_0x4b84bc})[_0xaa41('0x17')](function(){return db[_0xaa41('0x6b')][_0xaa41('0x23')]({'where':{'VoiceQueueId':_0x33f008[_0xaa41('0x30')]['id'],'UserId':_0x50a526},'transaction':_0x4b84bc});});}})['then'](function(){_0x50a526['forEach'](function(_0x395323){socket[_0xaa41('0x6f')]('userVoiceQueue:remove',{'UserId':_0x395323,'VoiceQueueId':_0x339537['id']});});});});});});})['then'](respondWithStatusCode(_0x1489fe,null))[_0xaa41('0x2f')](handleError(_0x1489fe,null));};exports[_0xaa41('0x85')]=function(_0x2fe50f,_0x520b50){var _0x50122d,_0x1d609e;return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2fe50f['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x520b50,null))[_0xaa41('0x17')](function(_0x5a0791){if(_0x5a0791){_0x1d609e=_0x5a0791;return _0x5a0791['addAgents'](_0x2fe50f[_0xaa41('0x3b')]['ids'],_[_0xaa41('0x45')](_0x2fe50f[_0xaa41('0x3b')],[_0xaa41('0x70'),'id'])||{})[_0xaa41('0x86')](function(_0x1d7c2e){for(var _0xdc0493=0x0;_0xdc0493<_0x2fe50f[_0xaa41('0x3b')]['ids'][_0xaa41('0x37')];_0xdc0493+=0x1){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':Number(_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')][_0xdc0493]),'VoiceQueueId':Number(_0x2fe50f[_0xaa41('0x30')]['id'])});}return _0x1d7c2e;});}})[_0xaa41('0x17')](function(_0x2af16e){_0x50122d=_0x2af16e||[];if(_0x1d609e){return db[_0xaa41('0x5c')]['findAll']({'where':{'id':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')]},'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]});}})[_0xaa41('0x17')](function(_0x5083ff){if(!_[_0xaa41('0x83')](_0x5083ff)){var _0x3c4e89=[];for(var _0x415acc=0x0;_0x415acc<_0x5083ff['length'];_0x415acc++){if(_0x5083ff[_0x415acc]['online']){_0x3c4e89['push'](db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x5083ff[_0x415acc][_0xaa41('0x21')],'UserId':_0x5083ff[_0x415acc]['id'],'queue_name':_0x1d609e[_0xaa41('0x21')],'VoiceQueueId':_0x1d609e['id'],'interface':_[_0xaa41('0x6c')](_0x5083ff[_0x415acc]['interface'])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x5083ff[_0x415acc][_0xaa41('0x21')]):_0x5083ff[_0x415acc][_0xaa41('0x60')],'paused':_0x5083ff[_0x415acc][_0xaa41('0x5f')]||![],'penalty':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x62')]||0x0}));}}return BPromise['all'](_0x3c4e89);}})[_0xaa41('0x17')](function(){return _0x50122d;})[_0xaa41('0x17')](respondWithResult(_0x520b50,null))[_0xaa41('0x2f')](handleError(_0x520b50,null));};exports['removeAgents']=function(_0x16a173,_0x53a519){return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x16a173['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x53a519,null))[_0xaa41('0x17')](function(_0x366705){if(_0x366705){return _0x366705[_0xaa41('0x84')](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])[_0xaa41('0x17')](function(){if(_['isArray'](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])){for(var _0x3ee9e3=0x0;_0x3ee9e3<_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0xaa41('0x37')];_0x3ee9e3+=0x1){socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0x3ee9e3]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}}else{socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}});}})['then'](function(_0x29b27e){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x16a173['params']['id'],'UserId':_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]}})['then'](function(){return _0x29b27e;});})[_0xaa41('0x17')](respondWithStatusCode(_0x53a519,null))[_0xaa41('0x2f')](handleError(_0x53a519,null));};exports[_0xaa41('0x88')]=function(_0x15bb60,_0x232732){var _0x34d857={};var _0x239f1b={};var _0x445925;var _0x1e8591;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x15bb60[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x232732,null))[_0xaa41('0x17')](function(_0x7bae82){if(_0x7bae82){_0x445925=_0x7bae82;_0x239f1b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['User'][_0xaa41('0x28')]);_0x239f1b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x15bb60[_0xaa41('0x32')]);_0x239f1b['filters']=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],_0x239f1b['query']);_0x34d857[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x36')]));_0x34d857[_0xaa41('0x34')]=_0x34d857[_0xaa41('0x34')][_0xaa41('0x37')]?_0x34d857[_0xaa41('0x34')]:_0x239f1b['model'];_0x34d857[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x34d857[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_['pick'](_0x15bb60[_0xaa41('0x32')],_0x239f1b['filters']));if(_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x34d857[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x34d857[_0xaa41('0x2a')],{'$or':_['map'](_0x34d857[_0xaa41('0x34')],function(_0x345002){var _0x5f39b4={};_0x5f39b4[_0x345002]={'$like':'%'+_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x5f39b4;})});}_0x34d857=_[_0xaa41('0x38')]({},_0x34d857,_0x15bb60[_0xaa41('0x39')]);return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0x38b3be){if(_0x38b3be){_0x1e8591=_0x38b3be[_0xaa41('0x37')];if(!_0x15bb60[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x34d857[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x15bb60[_0xaa41('0x32')]['limit']);_0x34d857['offset']=qs[_0xaa41('0x14')](_0x15bb60['query']['offset']);}return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0xa4dbd3){if(_0xa4dbd3){return _0xa4dbd3?{'count':_0x1e8591,'rows':_0xa4dbd3}:null;}})[_0xaa41('0x17')](respondWithResult(_0x232732,null))['catch'](handleError(_0x232732,null));};exports['getMembers']=function(_0xa63e60,_0xf4f13f){var _0xef0e44={};var _0x46d37f={};var _0x6a6081;var _0x5e3bb2;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0xa63e60['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0xf4f13f,null))[_0xaa41('0x17')](function(_0x4b4a4a){if(_0x4b4a4a){_0x6a6081=_0x4b4a4a;_0x46d37f[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['UserVoiceQueueRt'][_0xaa41('0x28')]);_0x46d37f[_0xaa41('0x32')]=_['keys'](_0xa63e60[_0xaa41('0x32')]);_0x46d37f['filters']=_['intersection'](_0x46d37f[_0xaa41('0x31')],_0x46d37f[_0xaa41('0x32')]);_0xef0e44[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x46d37f[_0xaa41('0x31')],qs['fields'](_0xa63e60[_0xaa41('0x32')]['fields']));_0xef0e44['attributes']=_0xef0e44[_0xaa41('0x34')][_0xaa41('0x37')]?_0xef0e44[_0xaa41('0x34')]:_0x46d37f[_0xaa41('0x31')];_0xef0e44[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xa63e60[_0xaa41('0x32')]['sort']);_0xef0e44[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xa63e60[_0xaa41('0x32')],_0x46d37f[_0xaa41('0x4b')]));if(_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0xef0e44[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0xef0e44[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0xef0e44[_0xaa41('0x34')],function(_0x5a2ba0){var _0x4fc7d6={};_0x4fc7d6[_0x5a2ba0]={'$like':'%'+_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x4fc7d6;})});}_0xef0e44=_[_0xaa41('0x38')]({},_0xef0e44,_0xa63e60['options']);return _0x6a6081[_0xaa41('0x89')](_0xef0e44);}})[_0xaa41('0x17')](function(_0x15bc15){if(_0x15bc15){_0x5e3bb2=_0x15bc15[_0xaa41('0x37')];if(!_0xa63e60[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0xef0e44[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x12')]);_0xef0e44[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x6a6081['getMembers'](_0xef0e44);}})[_0xaa41('0x17')](function(_0x28c109){return _0x28c109?{'count':_0x5e3bb2,'rows':_0x28c109}:null;})[_0xaa41('0x17')](respondWithResult(_0xf4f13f,null))['catch'](handleError(_0xf4f13f,null));};exports[_0xaa41('0x8a')]=function(_0xfc1e24,_0x35c48f){var _0x2b0bf9={};var _0x21c0c6={};var _0x1138d0;var _0x394987;return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0xfc1e24[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x35c48f,null))[_0xaa41('0x17')](function(_0x2fc4b1){if(_0x2fc4b1){_0x1138d0=_0x2fc4b1;_0x21c0c6[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x8b')]['rawAttributes']);_0x21c0c6[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0xfc1e24[_0xaa41('0x32')]);_0x21c0c6[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],_0x21c0c6[_0xaa41('0x32')]);_0x2b0bf9[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0xfc1e24[_0xaa41('0x32')]['fields']));_0x2b0bf9['attributes']=_0x2b0bf9[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2b0bf9[_0xaa41('0x34')]:_0x21c0c6[_0xaa41('0x31')];_0x2b0bf9[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfc1e24['query'][_0xaa41('0x4e')]);_0x2b0bf9['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfc1e24[_0xaa41('0x32')],_0x21c0c6[_0xaa41('0x4b')]));if(_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x2b0bf9['where']=_['merge'](_0x2b0bf9[_0xaa41('0x2a')],{'$or':_['map'](_0x2b0bf9[_0xaa41('0x34')],function(_0x3f8296){var _0x438fcf={};_0x438fcf[_0x3f8296]={'$like':'%'+_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x438fcf;})});}_0x2b0bf9=_[_0xaa41('0x38')]({},_0x2b0bf9,_0xfc1e24[_0xaa41('0x39')]);return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x2667bd){if(_0x2667bd){_0x394987=_0x2667bd[_0xaa41('0x37')];if(!_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x2b0bf9['limit']=qs[_0xaa41('0x12')](_0xfc1e24['query'][_0xaa41('0x12')]);_0x2b0bf9['offset']=qs[_0xaa41('0x14')](_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x3dafc6){if(_0x3dafc6){return _0x3dafc6?{'count':_0x394987,'rows':_0x3dafc6}:null;}})[_0xaa41('0x17')](respondWithResult(_0x35c48f,null))['catch'](handleError(_0x35c48f,null));};exports[_0xaa41('0x8c')]=function(_0x533f4b,_0x47ca9d){var _0xd1f9ba=moment()[_0xaa41('0x6d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2c4930,_0x1285ed;return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x533f4b[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x47ca9d,null))['then'](function(_0x3ecde6){if(_0x3ecde6){_0x1285ed=_0x3ecde6;return _0x3ecde6['addLists'](_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x533f4b[_0xaa41('0x3b')],['ids','id'])||{});}return null;})[_0xaa41('0x86')](function(_0x32a07e){var _0x2b8b73;_0x2c4930=_0x32a07e||[];var _0x49e4a5=[];if(_0x32a07e){for(var _0xda8e73=0x0;_0xda8e73<_0x32a07e[_0xaa41('0x37')];_0xda8e73+=0x1){var _0x25f5ba=_0x32a07e[_0xda8e73][_0xaa41('0x18')]({'plain':!![]});_0x1285ed[_0xaa41('0x8d')]=_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x8d')]?_0x533f4b[_0xaa41('0x3b')]['dialCheckDuplicateType']:_0x1285ed[_0xaa41('0x8d')];switch(_0x1285ed['dialCheckDuplicateType']){case _0xaa41('0x8e'):_0x2b8b73=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0x91'))[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),'ListId')[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')]['toString']())[_0xaa41('0x2a')](_0xaa41('0x9b'))['where'](_0xaa41('0x9c'),squel['select']()[_0xaa41('0x71')](_0xaa41('0x9d'))[_0xaa41('0x73')](_0xaa41('0x9e'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]()))[_0xaa41('0x2a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xaa41('0x71')](_0xaa41('0x9f'))['from'](_0xaa41('0x91'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x533f4b['params']['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;case _0xaa41('0xa0'):_0x2b8b73=squel['insert']()[_0xaa41('0x90')](_0xaa41('0x91'))['fromQuery'](['phone',_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),'createdAt',_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))['field']('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27','createdAt')[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')]('deletedAt\x20IS\x20NULL')[_0xaa41('0x2a')]('ListId\x20=\x20?',_0x25f5ba[_0xaa41('0x98')]['toString']())['where'](_0xaa41('0x9b'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xaa41('0x97')]()[_0xaa41('0x71')](_0xaa41('0x9f'))[_0xaa41('0x73')](_0xaa41('0x91'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;default:_0x2b8b73=squel['insert']()[_0xaa41('0x90')]('cm_hopper')[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),'ListId','VoiceQueueId',_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')]['toString'](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))['from'](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))[_0xaa41('0x7a')]();}_0x49e4a5[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x2b8b73));}return BPromise[_0xaa41('0x7f')](_0x49e4a5);}})['then'](function(){var _0x58f009=[];var _0x405eba=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')]('cm_hopper_additional_phones')[_0xaa41('0x92')]([_0xaa41('0xa2'),_0xaa41('0x93'),_0xaa41('0xa3'),_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()[_0xaa41('0x71')](_0xaa41('0xa4'))[_0xaa41('0x71')](_0xaa41('0xa5'))['field'](_0xaa41('0xa6'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27','updatedAt')[_0xaa41('0x73')](_0xaa41('0xa7'),'ci')[_0xaa41('0x74')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0xaa41('0x2a')](_0xaa41('0xa8'),_0xd1f9ba)[_0xaa41('0x2a')](_0xaa41('0xa9'),_0xaa41('0xaa')))[_0xaa41('0x7a')]();_0x58f009['push'](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x405eba));return BPromise[_0xaa41('0x7f')](_0x58f009);})[_0xaa41('0x17')](function(){return _0x2c4930;})[_0xaa41('0x17')](respondWithResult(_0x47ca9d,null))[_0xaa41('0x2f')](handleError(_0x47ca9d,null));};exports[_0xaa41('0xab')]=function(_0x718a84,_0x151c5f){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x718a84['params']['id']}})['then'](handleEntityNotFound(_0x151c5f,null))[_0xaa41('0x17')](function(_0x293a1d){if(_0x293a1d){return _0x293a1d['removeLists'](_0x718a84[_0xaa41('0x32')][_0xaa41('0x70')]);}})['then'](function(_0x490a6c){if(_0x490a6c){return db[_0xaa41('0x4a')][_0xaa41('0x23')]({'where':{'ListId':_0x718a84[_0xaa41('0x32')]['ids'],'VoiceQueueId':_0x718a84[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x490a6c;});}})['then'](respondWithStatusCode(_0x151c5f,null))[_0xaa41('0x2f')](handleError(_0x151c5f,null));};exports[_0xaa41('0xac')]=function(_0x536cdb,_0x431b75){var _0x18499f={};var _0x49cbd7={};var _0x515f91;var _0x4b5953;return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x536cdb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x431b75,null))[_0xaa41('0x17')](function(_0x4ca8f7){if(_0x4ca8f7){_0x515f91=_0x4ca8f7;_0x49cbd7['model']=_[_0xaa41('0x33')](db['CmList'][_0xaa41('0x28')]);_0x49cbd7[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x536cdb[_0xaa41('0x32')]);_0x49cbd7['filters']=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],_0x49cbd7[_0xaa41('0x32')]);_0x18499f[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x536cdb[_0xaa41('0x32')]['fields']));_0x18499f['attributes']=_0x18499f[_0xaa41('0x34')][_0xaa41('0x37')]?_0x18499f[_0xaa41('0x34')]:_0x49cbd7[_0xaa41('0x31')];_0x18499f[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x536cdb[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x18499f[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x536cdb[_0xaa41('0x32')],_0x49cbd7[_0xaa41('0x4b')]));if(_0x536cdb['query'][_0xaa41('0x1b')]){_0x18499f[_0xaa41('0x2a')]=_['merge'](_0x18499f[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x18499f[_0xaa41('0x34')],function(_0x5cd79d){var _0x558583={};_0x558583[_0x5cd79d]={'$like':'%'+_0x536cdb[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x558583;})});}_0x18499f=_['merge']({},_0x18499f,_0x536cdb['options']);return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x117841){if(_0x117841){_0x4b5953=_0x117841[_0xaa41('0x37')];if(!_0x536cdb[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x18499f[_0xaa41('0x12')]=qs['limit'](_0x536cdb['query'][_0xaa41('0x12')]);_0x18499f[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x536cdb[_0xaa41('0x32')]['offset']);}return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x1be3c1){if(_0x1be3c1){return _0x1be3c1?{'count':_0x4b5953,'rows':_0x1be3c1}:null;}})[_0xaa41('0x17')](respondWithResult(_0x431b75,null))[_0xaa41('0x2f')](handleError(_0x431b75,null));};exports[_0xaa41('0xad')]=function(_0x42ae0c,_0x4fa4ca){var _0x1e41b5;return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x42ae0c[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4fa4ca,null))[_0xaa41('0x17')](function(_0x135f31){if(_0x135f31){return _0x135f31[_0xaa41('0xad')](_0x42ae0c[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x42ae0c['body'],[_0xaa41('0x70'),'id'])||{});}return null;})['spread'](function(_0x5eac30){var _0x3e28b7;_0x1e41b5=_0x5eac30||[];var _0x1ac854=[];if(_0x5eac30){for(var _0x187bf9=0x0;_0x187bf9<_0x5eac30['length'];_0x187bf9+=0x1){var _0x50fa22=_0x5eac30[_0x187bf9][_0xaa41('0x18')]({'plain':!![]});_0x3e28b7=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0xae'))['fromQuery']([_0xaa41('0x93'),'ContactId',_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),'updatedAt'],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x50fa22['CmListId'][_0xaa41('0x7a')](),'ListId')['field'](_0x42ae0c['params']['id'][_0xaa41('0x7a')](),'VoiceQueueId')[_0xaa41('0x71')]('NOW()','createdAt')[_0xaa41('0x71')](_0xaa41('0xaf'),_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))[_0xaa41('0x2a')](_0xaa41('0x9a'),_0x50fa22['CmListId'][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))['toString']();_0x1ac854[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x3e28b7));}return BPromise['all'](_0x1ac854);}})[_0xaa41('0x17')](function(){return _0x1e41b5;})[_0xaa41('0x17')](respondWithResult(_0x4fa4ca,null))['catch'](handleError(_0x4fa4ca,null));};exports[_0xaa41('0xb0')]=function(_0x2edb93,_0x4e34c2){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4e34c2,null))[_0xaa41('0x17')](function(_0x17b359){if(_0x17b359){return _0x17b359['removeBlackLists'](_0x2edb93['query']['ids']);}})['then'](function(_0x5b820b){if(_0x5b820b){return db[_0xaa41('0x58')][_0xaa41('0x23')]({'where':{'ListId':_0x2edb93[_0xaa41('0x32')][_0xaa41('0x70')],'VoiceQueueId':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x5b820b;});}})[_0xaa41('0x17')](respondWithStatusCode(_0x4e34c2,null))[_0xaa41('0x2f')](handleError(_0x4e34c2,null));}; \ No newline at end of file +var _0x34e8=['body','role','user','QueueCampaigns','find','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','includeAll','merge','options','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','where','filter','CmHopper','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','interface','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','userVoiceQueue:remove','spread','push','isArray','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','cm_hopper','fromQuery','phone','scheduledAt','CmListId','ListId','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','ContactId','cm_contacts','ListId\x20=\x20?','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy','get','VoiceQueues','inbound','outbound','ignore','map','value','type','UserProfileResource','error','stack','name','VoiceQueue','rawAttributes','fieldName','key','getOptions','include','query','findAll','catch','show','keys','filters','model','attributes','intersection','fields','length','create'];(function(_0x43ee7e,_0x78e09b){var _0x22d326=function(_0x2261a4){while(--_0x2261a4){_0x43ee7e['push'](_0x43ee7e['shift']());}};_0x22d326(++_0x78e09b);}(_0x34e8,0x12c));var _0x834e=function(_0x238e6b,_0x2c5cf7){_0x238e6b=_0x238e6b-0x0;var _0x3d9365=_0x34e8[_0x238e6b];return _0x3d9365;};'use strict';var moment=require(_0x834e('0x0'));var BPromise=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));var squel=require('squel');var Redis=require(_0x834e('0x4'));var qs=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var config=require(_0x834e('0x8'));var db=require(_0x834e('0x9'))['db'];config[_0x834e('0xa')]=_['defaults'](config[_0x834e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x834e('0xb'))(new Redis(config[_0x834e('0xa')]));require(_0x834e('0xc'))[_0x834e('0xd')](socket);function respondWithStatusCode(_0x33ea05,_0x23501c){_0x23501c=_0x23501c||0xcc;return function(_0x363786){if(_0x363786){return _0x33ea05[_0x834e('0xe')](_0x23501c);}return _0x33ea05[_0x834e('0xf')](_0x23501c)[_0x834e('0x10')]();};}function respondWithResult(_0x1e41fe,_0x36e124){_0x36e124=_0x36e124||0xc8;return function(_0x14038b){if(_0x14038b){return _0x1e41fe[_0x834e('0xf')](_0x36e124)[_0x834e('0x11')](_0x14038b);}};}function respondWithFilteredResult(_0x1e00de,_0x2fd95c){return function(_0x538bb3){if(_0x538bb3){var _0x5e5b6d=typeof _0x2fd95c[_0x834e('0x12')]==='undefined'&&typeof _0x2fd95c[_0x834e('0x13')]===_0x834e('0x14');var _0x28e659=_0x538bb3[_0x834e('0x15')];var _0x50e860=_0x5e5b6d?0x0:_0x2fd95c[_0x834e('0x12')];var _0x302cbd=_0x5e5b6d?_0x538bb3['count']:_0x2fd95c[_0x834e('0x12')]+_0x2fd95c['limit'];var _0x38a8cd;if(_0x302cbd>=_0x28e659){_0x302cbd=_0x28e659;_0x38a8cd=0xc8;}else{_0x38a8cd=0xce;}_0x1e00de[_0x834e('0xf')](_0x38a8cd);return _0x1e00de['set'](_0x834e('0x16'),_0x50e860+'-'+_0x302cbd+'/'+_0x28e659)[_0x834e('0x11')](_0x538bb3);}return null;};}function saveUpdates(_0x370fb5){return function(_0x50b3f6){if(_0x50b3f6){return _0x50b3f6[_0x834e('0x17')](_0x370fb5)[_0x834e('0x18')](function(_0x34e41a){return _0x34e41a;});}return null;};}function removeEntity(_0xb993a1){return function(_0x237947){if(_0x237947){return _0x237947[_0x834e('0x19')]()[_0x834e('0x18')](function(){var _0x595515=_0x237947[_0x834e('0x1a')]({'plain':!![]});var _0x1fd2c6=[{'name':_0x834e('0x1b'),'value':_0x834e('0x1c'),'ignore':![]},{'name':'QueueCampaigns','value':_0x834e('0x1d'),'ignore':![]}];var _0x62f8f1=_(_0x1fd2c6)['filter'](_0x834e('0x1e'))[_0x834e('0x1f')](_0x834e('0x20'))['value']();if(_['includes'](_0x62f8f1,_0x595515[_0x834e('0x21')])){return;}var _0x34563b=_['find'](_0x1fd2c6,[_0x834e('0x20'),_0x595515[_0x834e('0x21')]])['name'];return db[_0x834e('0x22')][_0x834e('0x19')]({'where':{'type':_0x34563b,'resourceId':_0x595515['id']}})[_0x834e('0x18')](function(){return _0x237947;});})['then'](function(){_0xb993a1[_0x834e('0xf')](0xcc)[_0x834e('0x10')]();});}};}function handleEntityNotFound(_0x5e1cc5){return function(_0x5bef62){if(!_0x5bef62){_0x5e1cc5[_0x834e('0xe')](0x194);}return _0x5bef62;};}function handleError(_0x508a1d,_0x2826ec){_0x2826ec=_0x2826ec||0x1f4;return function(_0x3f1b0b){logger[_0x834e('0x23')](_0x3f1b0b[_0x834e('0x24')]);if(_0x3f1b0b[_0x834e('0x25')]){delete _0x3f1b0b[_0x834e('0x25')];}_0x508a1d['status'](_0x2826ec)['send'](_0x3f1b0b);};}exports['index']=function(_0x58c1d7,_0x2c7a8d){var _0x567cea={};var _0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x1f')](db[_0x834e('0x26')][_0x834e('0x27')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x28')],'type':_0x1e026a[_0x834e('0x21')][_0x834e('0x29')]};});_0x567cea=qs[_0x834e('0x2a')](_0x5dacc1,_0x58c1d7);var _0x278db3={'where':_0x567cea['where']};return db[_0x834e('0x26')]['count'](_0x278db3)[_0x834e('0x18')](function(_0x3787b0){_0x106d6a[_0x834e('0x15')]=_0x3787b0;_0x567cea[_0x834e('0x2b')]=qs[_0x834e('0x2b')](_0x58c1d7[_0x834e('0x2c')]);return db[_0x834e('0x26')][_0x834e('0x2d')](_0x567cea);})[_0x834e('0x18')](function(_0x12b2bc){_0x106d6a['rows']=_0x12b2bc;return _0x106d6a;})[_0x834e('0x18')](respondWithFilteredResult(_0x2c7a8d,_0x567cea))[_0x834e('0x2e')](handleError(_0x2c7a8d,null));};exports[_0x834e('0x2f')]=function(_0xaf01f4,_0x595cc0){var _0x3f88ad={'raw':![],'where':{'id':_0xaf01f4['params']['id']}},_0x379d60={};_0x379d60['model']=_['keys'](db[_0x834e('0x26')][_0x834e('0x27')]);_0x379d60[_0x834e('0x2c')]=_[_0x834e('0x30')](_0xaf01f4[_0x834e('0x2c')]);_0x379d60[_0x834e('0x31')]=_['intersection'](_0x379d60[_0x834e('0x32')],_0x379d60['query']);_0x3f88ad[_0x834e('0x33')]=_[_0x834e('0x34')](_0x379d60['model'],qs[_0x834e('0x35')](_0xaf01f4[_0x834e('0x2c')]['fields']));_0x3f88ad['attributes']=_0x3f88ad[_0x834e('0x33')][_0x834e('0x36')]?_0x3f88ad[_0x834e('0x33')]:_0x379d60[_0x834e('0x32')];if(_0xaf01f4[_0x834e('0x2c')]['includeAll']){_0x3f88ad[_0x834e('0x2b')]=[{'all':!![]}];}_0x3f88ad=_['merge']({},_0x3f88ad,_0xaf01f4['options']);return db[_0x834e('0x26')]['find'](_0x3f88ad)[_0x834e('0x18')](handleEntityNotFound(_0x595cc0,null))[_0x834e('0x18')](respondWithResult(_0x595cc0,null))[_0x834e('0x2e')](handleError(_0x595cc0,null));};exports[_0x834e('0x37')]=function(_0x2b7933,_0x574ea8){return db[_0x834e('0x26')][_0x834e('0x37')](_0x2b7933[_0x834e('0x38')],{})['then'](function(_0x35380e){var _0x16ac45=_0x2b7933['user'][_0x834e('0x1a')]({'plain':!![]});if(!_0x16ac45)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16ac45[_0x834e('0x39')]===_0x834e('0x3a')){var _0x4a18bb=_0x35380e['get']({'plain':!![]});var _0x22ea21=[{'name':_0x834e('0x1b'),'value':_0x834e('0x1c')},{'name':_0x834e('0x3b'),'value':_0x834e('0x1d')}];var _0x23feea=_[_0x834e('0x3c')](_0x22ea21,['value',_0x4a18bb[_0x834e('0x21')]])['name'];return db[_0x834e('0x3d')]['find']({'where':{'name':_0x23feea,'userProfileId':_0x16ac45[_0x834e('0x3e')]},'raw':!![]})['then'](function(_0x361f60){if(_0x361f60&&_0x361f60[_0x834e('0x3f')]===0x0){return db['UserProfileResource'][_0x834e('0x37')]({'name':_0x4a18bb[_0x834e('0x25')],'resourceId':_0x4a18bb['id'],'type':_0x361f60[_0x834e('0x25')],'sectionId':_0x361f60['id']},{})[_0x834e('0x18')](function(){return _0x35380e;});}else{return _0x35380e;}})[_0x834e('0x2e')](function(_0x1a7149){logger[_0x834e('0x23')](_0x834e('0x40'),_0x1a7149);throw _0x1a7149;});}return _0x35380e;})[_0x834e('0x18')](respondWithResult(_0x574ea8,0xc9))[_0x834e('0x2e')](handleError(_0x574ea8,null));};exports['clone']=function(_0x3124be,_0x6fff27){var _0x47a8a9={'where':{'id':_0x3124be[_0x834e('0x41')]['id']}},_0x112306={};_0x112306[_0x834e('0x32')]=_[_0x834e('0x30')](db[_0x834e('0x26')][_0x834e('0x27')]);_0x47a8a9['attributes']=_['intersection'](_0x112306[_0x834e('0x32')],qs[_0x834e('0x35')](_0x3124be[_0x834e('0x2c')][_0x834e('0x35')]));_0x47a8a9[_0x834e('0x33')]=_0x47a8a9[_0x834e('0x33')][_0x834e('0x36')]?_0x47a8a9[_0x834e('0x33')]:_0x112306[_0x834e('0x32')];if(_0x3124be[_0x834e('0x2c')][_0x834e('0x42')]){_0x47a8a9[_0x834e('0x2b')]=[{'all':!![]}];}_0x47a8a9=_[_0x834e('0x43')]({},_0x47a8a9,_0x3124be[_0x834e('0x44')]);return db[_0x834e('0x26')][_0x834e('0x3c')](_0x47a8a9)[_0x834e('0x18')](handleEntityNotFound(_0x6fff27,null))[_0x834e('0x18')](function(_0x420841){if(_0x420841){var _0x1adf86=_0x420841['get']({'plain':!![]});_0x1adf86=qs[_0x834e('0x45')](_0x1adf86,['id',_0x834e('0x46'),'updatedAt']);_0x3124be[_0x834e('0x38')]=_[_0x834e('0x45')](_0x3124be['body'],['id',_0x834e('0x46'),_0x834e('0x47')]);return db[_0x834e('0x26')][_0x834e('0x37')](_[_0x834e('0x43')](_0x1adf86,_0x3124be[_0x834e('0x38')]),{'include':_0x3124be[_0x834e('0x2c')]['includeAll']?[{'all':!![]}]:undefined})[_0x834e('0x18')](function(_0x8bc6c6){var _0x3e0550=_0x3124be[_0x834e('0x3a')][_0x834e('0x1a')]({'plain':!![]});if(!_0x3e0550)throw new Error(_0x834e('0x48'));if(_0x3e0550[_0x834e('0x39')]===_0x834e('0x3a')){var _0x5afa07=_0x8bc6c6[_0x834e('0x1a')]({'plain':!![]});var _0x4dc104=[{'name':_0x834e('0x1b'),'value':'inbound'},{'name':_0x834e('0x3b'),'value':'outbound'}];var _0x527eef=_[_0x834e('0x3c')](_0x4dc104,[_0x834e('0x20'),_0x5afa07['type']])['name'];return db[_0x834e('0x3d')][_0x834e('0x3c')]({'where':{'name':_0x527eef,'userProfileId':_0x3e0550[_0x834e('0x3e')]},'raw':!![]})[_0x834e('0x18')](function(_0x21c417){if(_0x21c417&&_0x21c417[_0x834e('0x3f')]===0x0){return db[_0x834e('0x22')][_0x834e('0x37')]({'name':_0x5afa07['name'],'resourceId':_0x5afa07['id'],'type':_0x21c417[_0x834e('0x25')],'sectionId':_0x21c417['id']},{})[_0x834e('0x18')](function(){return _0x8bc6c6;});}else{return _0x8bc6c6;}})['catch'](function(_0x281342){logger['error'](_0x834e('0x40'),_0x281342);throw _0x281342;});}return _0x8bc6c6;});}})[_0x834e('0x18')](respondWithResult(_0x6fff27,0xc9))['catch'](handleError(_0x6fff27,null));};exports[_0x834e('0x17')]=function(_0x37ee0e,_0x2de29a){if(_0x37ee0e[_0x834e('0x38')]['id']){delete _0x37ee0e['body']['id'];}return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x37ee0e[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x2de29a,null))[_0x834e('0x18')](saveUpdates(_0x37ee0e[_0x834e('0x38')],null))[_0x834e('0x18')](respondWithResult(_0x2de29a,null))[_0x834e('0x2e')](handleError(_0x2de29a,null));};exports[_0x834e('0x19')]=function(_0x125f37,_0x3a1426){return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x125f37[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x3a1426,null))[_0x834e('0x18')](removeEntity(_0x3a1426,null))[_0x834e('0x2e')](handleError(_0x3a1426,null));};exports[_0x834e('0x49')]=function(_0x460a7a,_0x17b8e3){var _0x297cce={'raw':![],'where':{}};var _0x14ed83={};var _0x193a15={'count':0x0,'rows':[]};return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x460a7a[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x17b8e3,null))[_0x834e('0x18')](function(_0x25d6f4){if(_0x25d6f4){_0x14ed83[_0x834e('0x32')]=_[_0x834e('0x30')](db['CmHopper'][_0x834e('0x27')]);_0x14ed83['query']=_['keys'](_0x460a7a[_0x834e('0x2c')]);_0x14ed83[_0x834e('0x31')]=_[_0x834e('0x34')](_0x14ed83[_0x834e('0x32')],_0x14ed83[_0x834e('0x2c')]);_0x297cce[_0x834e('0x33')]=_[_0x834e('0x34')](_0x14ed83[_0x834e('0x32')],qs['fields'](_0x460a7a[_0x834e('0x2c')]['fields']));_0x297cce[_0x834e('0x33')]=_0x297cce[_0x834e('0x33')]['length']?_0x297cce['attributes']:_0x14ed83[_0x834e('0x32')];if(!_0x460a7a[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x297cce[_0x834e('0x13')]=qs['limit'](_0x460a7a[_0x834e('0x2c')][_0x834e('0x13')]);_0x297cce[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x460a7a[_0x834e('0x2c')][_0x834e('0x12')]);}_0x297cce[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x460a7a[_0x834e('0x2c')][_0x834e('0x4e')]);_0x297cce['where']=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x460a7a[_0x834e('0x2c')],_0x14ed83[_0x834e('0x31')]));_0x297cce['where'][_0x834e('0x50')]=_0x25d6f4['id'];if(_0x460a7a['query']['filter']){_0x297cce['where']=_[_0x834e('0x43')](_0x297cce[_0x834e('0x51')],{'$or':_['map'](_0x297cce[_0x834e('0x33')],function(_0x1b200d){var _0x4d4477={};_0x4d4477[_0x1b200d]={'$like':'%'+_0x460a7a[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x4d4477;})});}_0x297cce=_['merge']({},_0x297cce,_0x460a7a['options']);return db[_0x834e('0x53')][_0x834e('0x15')]({'where':_0x297cce[_0x834e('0x51')]})[_0x834e('0x18')](function(_0x1d8e7){_0x193a15['count']=_0x1d8e7;if(_0x460a7a[_0x834e('0x2c')]['includeAll']){_0x297cce[_0x834e('0x2b')]=[{'all':!![]}];}return db[_0x834e('0x53')][_0x834e('0x2d')](_0x297cce);})['then'](function(_0x33a3cd){_0x193a15[_0x834e('0x54')]=_0x33a3cd;return _0x193a15;});}})['then'](respondWithFilteredResult(_0x17b8e3,_0x297cce))[_0x834e('0x2e')](handleError(_0x17b8e3,null));};exports[_0x834e('0x55')]=function(_0xb4e130,_0x50d0a3){var _0x214014={'raw':!![],'where':{}};var _0x1d4e66={};var _0x402692={'count':0x0,'rows':[]};return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0xb4e130[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x50d0a3,null))[_0x834e('0x18')](function(_0xd49002){if(_0xd49002){_0x1d4e66[_0x834e('0x32')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x1d4e66[_0x834e('0x2c')]=_[_0x834e('0x30')](_0xb4e130[_0x834e('0x2c')]);_0x1d4e66[_0x834e('0x31')]=_[_0x834e('0x34')](_0x1d4e66['model'],_0x1d4e66['query']);_0x214014[_0x834e('0x33')]=_[_0x834e('0x34')](_0x1d4e66[_0x834e('0x32')],qs[_0x834e('0x35')](_0xb4e130[_0x834e('0x2c')]['fields']));_0x214014[_0x834e('0x33')]=_0x214014[_0x834e('0x33')][_0x834e('0x36')]?_0x214014['attributes']:_0x1d4e66[_0x834e('0x32')];if(!_0xb4e130[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x214014[_0x834e('0x13')]=qs['limit'](_0xb4e130['query'][_0x834e('0x13')]);_0x214014[_0x834e('0x12')]=qs['offset'](_0xb4e130[_0x834e('0x2c')]['offset']);}_0x214014[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0xb4e130[_0x834e('0x2c')]['sort']);_0x214014[_0x834e('0x51')]=qs['filters'](_['pick'](_0xb4e130['query'],_0x1d4e66[_0x834e('0x31')]));_0x214014[_0x834e('0x51')][_0x834e('0x50')]=_0xd49002['id'];if(_0xb4e130[_0x834e('0x2c')][_0x834e('0x52')]){_0x214014[_0x834e('0x51')]=_[_0x834e('0x43')](_0x214014[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x214014['attributes'],function(_0x2f775a){var _0x54e70d={};_0x54e70d[_0x2f775a]={'$like':'%'+_0xb4e130[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x54e70d;})});}_0x214014=_[_0x834e('0x43')]({},_0x214014,_0xb4e130[_0x834e('0x44')]);return db[_0x834e('0x56')][_0x834e('0x15')]({'where':_0x214014['where']})['then'](function(_0xeb096d){_0x402692[_0x834e('0x15')]=_0xeb096d;if(_0xb4e130['query'][_0x834e('0x42')]){_0x214014[_0x834e('0x2b')]=[{'all':!![]}];}return db[_0x834e('0x56')][_0x834e('0x2d')](_0x214014);})[_0x834e('0x18')](function(_0x5a75e3){_0x402692[_0x834e('0x54')]=_0x5a75e3;return _0x402692;});}})[_0x834e('0x18')](respondWithFilteredResult(_0x50d0a3,_0x214014))['catch'](handleError(_0x50d0a3,null));};exports['getHopperFinals']=function(_0x5ede29,_0x1e5252){var _0x1f3e26={'raw':!![],'where':{}};var _0x4f716d={};var _0x23ce49={'count':0x0,'rows':[]};return db[_0x834e('0x26')]['findOne']({'where':{'id':_0x5ede29[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x1e5252,null))['then'](function(_0x41dfd9){if(_0x41dfd9){_0x4f716d[_0x834e('0x32')]=_[_0x834e('0x30')](db[_0x834e('0x57')]['rawAttributes']);_0x4f716d[_0x834e('0x2c')]=_[_0x834e('0x30')](_0x5ede29[_0x834e('0x2c')]);_0x4f716d[_0x834e('0x31')]=_[_0x834e('0x34')](_0x4f716d[_0x834e('0x32')],_0x4f716d[_0x834e('0x2c')]);_0x1f3e26[_0x834e('0x33')]=_[_0x834e('0x34')](_0x4f716d[_0x834e('0x32')],qs[_0x834e('0x35')](_0x5ede29[_0x834e('0x2c')][_0x834e('0x35')]));_0x1f3e26[_0x834e('0x33')]=_0x1f3e26[_0x834e('0x33')][_0x834e('0x36')]?_0x1f3e26[_0x834e('0x33')]:_0x4f716d[_0x834e('0x32')];if(!_0x5ede29[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x1f3e26[_0x834e('0x13')]=qs['limit'](_0x5ede29[_0x834e('0x2c')][_0x834e('0x13')]);_0x1f3e26[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x5ede29[_0x834e('0x2c')][_0x834e('0x12')]);}_0x1f3e26[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x5ede29[_0x834e('0x2c')]['sort']);_0x1f3e26['where']=qs['filters'](_[_0x834e('0x4f')](_0x5ede29['query'],_0x4f716d[_0x834e('0x31')]));_0x1f3e26[_0x834e('0x51')][_0x834e('0x50')]=_0x41dfd9['id'];if(_0x5ede29['query'][_0x834e('0x52')]){_0x1f3e26[_0x834e('0x51')]=_[_0x834e('0x43')](_0x1f3e26[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x1f3e26[_0x834e('0x33')],function(_0x528052){var _0x10dd7b={};_0x10dd7b[_0x528052]={'$like':'%'+_0x5ede29[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x10dd7b;})});}_0x1f3e26=_[_0x834e('0x43')]({},_0x1f3e26,_0x5ede29[_0x834e('0x44')]);return db['CmHopperFinal']['count']({'where':_0x1f3e26['where']})['then'](function(_0x1dfa2e){_0x23ce49[_0x834e('0x15')]=_0x1dfa2e;if(_0x5ede29['query'][_0x834e('0x42')]){_0x1f3e26[_0x834e('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x834e('0x2d')](_0x1f3e26);})[_0x834e('0x18')](function(_0xbf7693){_0x23ce49[_0x834e('0x54')]=_0xbf7693;return _0x23ce49;});}})[_0x834e('0x18')](respondWithFilteredResult(_0x1e5252,_0x1f3e26))[_0x834e('0x2e')](handleError(_0x1e5252,null));};exports['getHopperBlacks']=function(_0x5a49fc,_0x43b92f){var _0x30ab20={'raw':!![],'where':{}};var _0x1d2e12={};var _0x58bdd6={'count':0x0,'rows':[]};return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x5a49fc['params']['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x43b92f,null))[_0x834e('0x18')](function(_0x216d1f){if(_0x216d1f){_0x1d2e12[_0x834e('0x32')]=_['keys'](db[_0x834e('0x58')]['rawAttributes']);_0x1d2e12['query']=_[_0x834e('0x30')](_0x5a49fc[_0x834e('0x2c')]);_0x1d2e12[_0x834e('0x31')]=_[_0x834e('0x34')](_0x1d2e12[_0x834e('0x32')],_0x1d2e12[_0x834e('0x2c')]);_0x30ab20['attributes']=_['intersection'](_0x1d2e12[_0x834e('0x32')],qs[_0x834e('0x35')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x35')]));_0x30ab20[_0x834e('0x33')]=_0x30ab20[_0x834e('0x33')][_0x834e('0x36')]?_0x30ab20['attributes']:_0x1d2e12[_0x834e('0x32')];if(!_0x5a49fc[_0x834e('0x2c')]['hasOwnProperty'](_0x834e('0x4c'))){_0x30ab20[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x13')]);_0x30ab20[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x12')]);}_0x30ab20[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x4e')]);_0x30ab20[_0x834e('0x51')]=qs['filters'](_[_0x834e('0x4f')](_0x5a49fc[_0x834e('0x2c')],_0x1d2e12['filters']));_0x30ab20[_0x834e('0x51')]['VoiceQueueId']=_0x216d1f['id'];if(_0x5a49fc[_0x834e('0x2c')]['filter']){_0x30ab20[_0x834e('0x51')]=_['merge'](_0x30ab20[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x30ab20[_0x834e('0x33')],function(_0x1aac37){var _0x57ee25={};_0x57ee25[_0x1aac37]={'$like':'%'+_0x5a49fc[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x57ee25;})});}_0x30ab20=_[_0x834e('0x43')]({},_0x30ab20,_0x5a49fc[_0x834e('0x44')]);return db[_0x834e('0x58')][_0x834e('0x15')]({'where':_0x30ab20[_0x834e('0x51')]})[_0x834e('0x18')](function(_0x2aa430){_0x58bdd6[_0x834e('0x15')]=_0x2aa430;if(_0x5a49fc[_0x834e('0x2c')][_0x834e('0x42')]){_0x30ab20[_0x834e('0x2b')]=[{'all':!![]}];}return db[_0x834e('0x58')][_0x834e('0x2d')](_0x30ab20);})[_0x834e('0x18')](function(_0xe84914){_0x58bdd6['rows']=_0xe84914;return _0x58bdd6;});}})['then'](respondWithFilteredResult(_0x43b92f,_0x30ab20))[_0x834e('0x2e')](handleError(_0x43b92f,null));};exports[_0x834e('0x59')]=function(_0x3f52b9,_0x213303){var _0x3bf1b6={};var _0x31f336={};var _0x22f90d;var _0x40fd40;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x3f52b9[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x213303,null))['then'](function(_0x1bd254){if(_0x1bd254){_0x22f90d=_0x1bd254;_0x31f336['model']=_[_0x834e('0x30')](db[_0x834e('0x5a')][_0x834e('0x27')]);_0x31f336['query']=_[_0x834e('0x30')](_0x3f52b9[_0x834e('0x2c')]);_0x31f336['filters']=_['intersection'](_0x31f336[_0x834e('0x32')],_0x31f336[_0x834e('0x2c')]);_0x3bf1b6['attributes']=_[_0x834e('0x34')](_0x31f336[_0x834e('0x32')],qs[_0x834e('0x35')](_0x3f52b9[_0x834e('0x2c')][_0x834e('0x35')]));_0x3bf1b6['attributes']=_0x3bf1b6['attributes'][_0x834e('0x36')]?_0x3bf1b6['attributes']:_0x31f336['model'];_0x3bf1b6['order']=qs[_0x834e('0x4e')](_0x3f52b9[_0x834e('0x2c')]['sort']);_0x3bf1b6[_0x834e('0x51')]=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x3f52b9[_0x834e('0x2c')],_0x31f336['filters']));if(_0x3f52b9[_0x834e('0x2c')][_0x834e('0x52')]){_0x3bf1b6[_0x834e('0x51')]=_['merge'](_0x3bf1b6[_0x834e('0x51')],{'$or':_['map'](_0x3bf1b6[_0x834e('0x33')],function(_0x4af2a2){var _0x461420={};_0x461420[_0x4af2a2]={'$like':'%'+_0x3f52b9[_0x834e('0x2c')]['filter']+'%'};return _0x461420;})});}_0x3bf1b6=_[_0x834e('0x43')]({},_0x3bf1b6,_0x3f52b9[_0x834e('0x44')]);return _0x22f90d[_0x834e('0x59')](_0x3bf1b6);}})[_0x834e('0x18')](function(_0x410895){if(_0x410895){_0x40fd40=_0x410895[_0x834e('0x36')];if(!_0x3f52b9['query'][_0x834e('0x4b')](_0x834e('0x4c'))){_0x3bf1b6[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x3f52b9[_0x834e('0x2c')][_0x834e('0x13')]);_0x3bf1b6['offset']=qs[_0x834e('0x12')](_0x3f52b9['query']['offset']);}return _0x22f90d[_0x834e('0x59')](_0x3bf1b6);}})['then'](function(_0x4c5da4){if(_0x4c5da4){return _0x4c5da4?{'count':_0x40fd40,'rows':_0x4c5da4}:null;}})[_0x834e('0x18')](respondWithResult(_0x213303,null))[_0x834e('0x2e')](handleError(_0x213303,null));};exports[_0x834e('0x5b')]=function(_0x2e5886,_0x38fbc4){var _0x3e0ee6=_0x2e5886[_0x834e('0x38')][_0x834e('0x5c')];var _0x1d3ca9=_[_0x834e('0x1f')](_0x3e0ee6,'id');return db[_0x834e('0x5a')][_0x834e('0x2d')]({'where':{'id':_0x1d3ca9},'attributes':['id'],'include':[{'model':db[_0x834e('0x5d')],'as':_0x834e('0x5e'),'attributes':['id','name',_0x834e('0x5f'),'voicePause',_0x834e('0x60')],'raw':!![]}]})[_0x834e('0x18')](function(_0x284412){if(_0x284412){var _0x2cdbe0=_['flatMap'](_0x284412,function(_0x5f558a){var _0x37d8dd=_0x5f558a[_0x834e('0x1a')]({'plain':!![]});_0x37d8dd['Agents'][_0x834e('0x61')](function(_0xfa7b14){_0xfa7b14['penalty']=_[_0x834e('0x3c')](_0x3e0ee6,{'id':_0x37d8dd['id']})[_0x834e('0x62')];});return _0x37d8dd[_0x834e('0x5e')];});return db[_0x834e('0x26')]['find']({'where':{'id':_0x2e5886['params']['id']}})['then'](function(_0x48e14c){return db[_0x834e('0x63')][_0x834e('0x64')](function(_0x47891e){return _0x48e14c[_0x834e('0x5b')](_0x1d3ca9,{'transaction':_0x47891e})['then'](function(){return BPromise[_0x834e('0x65')](_0x3e0ee6,function(_0x13b39a){return db[_0x834e('0x66')][_0x834e('0x67')]({'TeamId':_0x13b39a['id'],'VoiceQueueId':_0x2e5886[_0x834e('0x41')]['id'],'penalty':_0x13b39a[_0x834e('0x62')]},{'transaction':_0x47891e});});})[_0x834e('0x18')](function(){return BPromise['each'](_0x2cdbe0,function(_0x12a0f3){return db[_0x834e('0x68')]['findOrCreate']({'where':{'UserId':_0x12a0f3['id'],'VoiceQueueId':_0x2e5886[_0x834e('0x41')]['id']},'defaults':{'penalty':_0x12a0f3[_0x834e('0x62')]},'transaction':_0x47891e});});})['then'](function(){return BPromise['each'](_['filter'](_0x2cdbe0,{'online':!![]}),function(_0x3edbbb){return db[_0x834e('0x69')][_0x834e('0x67')]({'membername':_0x3edbbb['name'],'UserId':_0x3edbbb['id'],'queue_name':_0x48e14c[_0x834e('0x25')],'VoiceQueueId':_0x48e14c['id'],'interface':_[_0x834e('0x6a')](_0x3edbbb[_0x834e('0x60')])?util[_0x834e('0x6b')](_0x834e('0x6c'),_0x3edbbb[_0x834e('0x25')]):_0x3edbbb[_0x834e('0x60')],'paused':_0x3edbbb[_0x834e('0x6d')]||![],'penalty':_0x3edbbb[_0x834e('0x62')]},{'transaction':_0x47891e});});})[_0x834e('0x18')](function(){_0x2cdbe0['forEach'](function(_0x5d6b66){socket[_0x834e('0x6e')](_0x834e('0x6f'),{'UserId':_0x5d6b66['id'],'VoiceQueueId':_0x48e14c['id']});});});});});}})[_0x834e('0x18')](respondWithStatusCode(_0x38fbc4,null))[_0x834e('0x2e')](handleError(_0x38fbc4,null));};exports[_0x834e('0x70')]=function(_0xd22e8f,_0x281922){return db[_0x834e('0x5a')][_0x834e('0x2d')]({'where':{'id':_0xd22e8f[_0x834e('0x2c')][_0x834e('0x71')]},'attributes':['id'],'include':[{'model':db[_0x834e('0x5d')],'as':_0x834e('0x5e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x281922,null))[_0x834e('0x18')](function(_0x3b13be){var _0x3f5b2e=_[_0x834e('0x1f')](_0x3b13be,'id');var _0x495697=[];var _0x5943a3=[];var _0x4e7c43=squel[_0x834e('0x72')]();_0x4e7c43[_0x834e('0x73')](_0x834e('0x74'))[_0x834e('0x75')](_0x834e('0x76'),'tq')[_0x834e('0x77')](_0x834e('0x78'),'ut',_0x834e('0x79'))['where']('VoiceQueueId\x20=\x20?',_0xd22e8f['params']['id']);for(var _0x5a5602=0x0;_0x5a5602<_0x3b13be[_0x834e('0x36')];_0x5a5602+=0x1){let _0xd108fa=_0x3b13be[_0x5a5602];for(var _0x37defd=0x0;_0x37defd<_0xd108fa[_0x834e('0x5e')][_0x834e('0x36')];_0x37defd+=0x1){let _0x386e10=_0xd108fa[_0x834e('0x5e')][_0x37defd];var _0x29ef2f=_0x4e7c43[_0x834e('0x7a')]();_0x29ef2f['where']('ut.UserId\x20=\x20?',_0x386e10['id']);_0x5943a3['push'](db['sequelize'][_0x834e('0x2c')](_0x29ef2f[_0x834e('0x7b')](),{'type':db[_0x834e('0x63')][_0x834e('0x7c')][_0x834e('0x7d')]})[_0x834e('0x18')](function(_0x416bea){if(_0x416bea[_0x834e('0x36')]===0x1){return _0x386e10['id'];}else{var _0x86d08c=_[_0x834e('0x7e')](_[_0x834e('0x1f')](_0x416bea,_0x834e('0x7f')),function(_0x1fd72b){return _[_0x834e('0x80')](_0x3f5b2e,_0x1fd72b);});if(_0x86d08c){return _0x386e10['id'];}}}));}}return BPromise[_0x834e('0x81')](_0x5943a3)[_0x834e('0x18')](function(_0x5022f2){_0x495697=_(_0x495697)[_0x834e('0x82')](_0x5022f2)['compact']()[_0x834e('0x20')]();return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0xd22e8f['params']['id']}})[_0x834e('0x18')](function(_0x3d9d85){return db['sequelize']['transaction'](function(_0x1c3b23){return _0x3d9d85[_0x834e('0x70')](_0xd22e8f[_0x834e('0x2c')][_0x834e('0x71')],{'transaction':_0x1c3b23})[_0x834e('0x18')](function(){if(!_[_0x834e('0x83')](_0x495697)){return _0x3d9d85[_0x834e('0x84')](_0x495697,{'transaction':_0x1c3b23})[_0x834e('0x18')](function(){return db['UserVoiceQueueRt'][_0x834e('0x19')]({'where':{'VoiceQueueId':_0xd22e8f[_0x834e('0x41')]['id'],'UserId':_0x495697},'transaction':_0x1c3b23});});}})[_0x834e('0x18')](function(){_0x495697[_0x834e('0x61')](function(_0x1912e6){socket[_0x834e('0x6e')](_0x834e('0x85'),{'UserId':_0x1912e6,'VoiceQueueId':_0x3d9d85['id']});});});});});});})['then'](respondWithStatusCode(_0x281922,null))[_0x834e('0x2e')](handleError(_0x281922,null));};exports['addAgents']=function(_0x586fa5,_0x1115b7){var _0x1e0bc9,_0x4b16fa;return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x586fa5['params']['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x1115b7,null))[_0x834e('0x18')](function(_0x5d994e){if(_0x5d994e){_0x4b16fa=_0x5d994e;return _0x5d994e['addAgents'](_0x586fa5[_0x834e('0x38')][_0x834e('0x71')],_['omit'](_0x586fa5['body'],[_0x834e('0x71'),'id'])||{})[_0x834e('0x86')](function(_0x5d6f5e){for(var _0x480290=0x0;_0x480290<_0x586fa5['body']['ids'][_0x834e('0x36')];_0x480290+=0x1){socket['emit'](_0x834e('0x6f'),{'UserId':Number(_0x586fa5['body'][_0x834e('0x71')][_0x480290]),'VoiceQueueId':Number(_0x586fa5[_0x834e('0x41')]['id'])});}return _0x5d6f5e;});}})[_0x834e('0x18')](function(_0x3d2569){_0x1e0bc9=_0x3d2569||[];if(_0x4b16fa){return db['User'][_0x834e('0x2d')]({'where':{'id':_0x586fa5[_0x834e('0x38')][_0x834e('0x71')]},'attributes':['id',_0x834e('0x25'),_0x834e('0x5f'),_0x834e('0x6d'),_0x834e('0x60')],'raw':!![]});}})[_0x834e('0x18')](function(_0x464ae6){if(!_[_0x834e('0x83')](_0x464ae6)){var _0x590e52=[];for(var _0x40e12e=0x0;_0x40e12e<_0x464ae6['length'];_0x40e12e++){if(_0x464ae6[_0x40e12e][_0x834e('0x5f')]){_0x590e52[_0x834e('0x87')](db[_0x834e('0x69')][_0x834e('0x67')]({'membername':_0x464ae6[_0x40e12e][_0x834e('0x25')],'UserId':_0x464ae6[_0x40e12e]['id'],'queue_name':_0x4b16fa['name'],'VoiceQueueId':_0x4b16fa['id'],'interface':_[_0x834e('0x6a')](_0x464ae6[_0x40e12e]['interface'])?util['format'](_0x834e('0x6c'),_0x464ae6[_0x40e12e][_0x834e('0x25')]):_0x464ae6[_0x40e12e][_0x834e('0x60')],'paused':_0x464ae6[_0x40e12e]['voicePause']||![],'penalty':_0x586fa5[_0x834e('0x38')][_0x834e('0x62')]||0x0}));}}return BPromise[_0x834e('0x81')](_0x590e52);}})[_0x834e('0x18')](function(){return _0x1e0bc9;})[_0x834e('0x18')](respondWithResult(_0x1115b7,null))[_0x834e('0x2e')](handleError(_0x1115b7,null));};exports[_0x834e('0x84')]=function(_0x687dab,_0x125787){return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x687dab['params']['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x125787,null))[_0x834e('0x18')](function(_0x121d4f){if(_0x121d4f){return _0x121d4f[_0x834e('0x84')](_0x687dab[_0x834e('0x2c')][_0x834e('0x71')])['then'](function(){if(_[_0x834e('0x88')](_0x687dab[_0x834e('0x2c')][_0x834e('0x71')])){for(var _0x37dea1=0x0;_0x37dea1<_0x687dab[_0x834e('0x2c')][_0x834e('0x71')][_0x834e('0x36')];_0x37dea1+=0x1){socket[_0x834e('0x6e')](_0x834e('0x85'),{'UserId':Number(_0x687dab[_0x834e('0x2c')]['ids'][_0x37dea1]),'VoiceQueueId':Number(_0x687dab['params']['id'])});}}else{socket[_0x834e('0x6e')]('userVoiceQueue:remove',{'UserId':Number(_0x687dab[_0x834e('0x2c')][_0x834e('0x71')]),'VoiceQueueId':Number(_0x687dab[_0x834e('0x41')]['id'])});}});}})[_0x834e('0x18')](function(_0x1daa58){return db[_0x834e('0x69')]['destroy']({'where':{'VoiceQueueId':_0x687dab[_0x834e('0x41')]['id'],'UserId':_0x687dab['query']['ids']}})['then'](function(){return _0x1daa58;});})[_0x834e('0x18')](respondWithStatusCode(_0x125787,null))[_0x834e('0x2e')](handleError(_0x125787,null));};exports['getAgents']=function(_0x5cb379,_0x494e08){var _0x2515f6={};var _0x45c8e6={};var _0x3512d8;var _0x5e0bfe;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x5cb379[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x494e08,null))[_0x834e('0x18')](function(_0x3c1a19){if(_0x3c1a19){_0x3512d8=_0x3c1a19;_0x45c8e6['model']=_['keys'](db['User']['rawAttributes']);_0x45c8e6[_0x834e('0x2c')]=_[_0x834e('0x30')](_0x5cb379[_0x834e('0x2c')]);_0x45c8e6[_0x834e('0x31')]=_[_0x834e('0x34')](_0x45c8e6[_0x834e('0x32')],_0x45c8e6[_0x834e('0x2c')]);_0x2515f6[_0x834e('0x33')]=_[_0x834e('0x34')](_0x45c8e6[_0x834e('0x32')],qs[_0x834e('0x35')](_0x5cb379[_0x834e('0x2c')][_0x834e('0x35')]));_0x2515f6[_0x834e('0x33')]=_0x2515f6[_0x834e('0x33')]['length']?_0x2515f6['attributes']:_0x45c8e6[_0x834e('0x32')];_0x2515f6[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x5cb379['query'][_0x834e('0x4e')]);_0x2515f6[_0x834e('0x51')]=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x5cb379[_0x834e('0x2c')],_0x45c8e6[_0x834e('0x31')]));if(_0x5cb379[_0x834e('0x2c')][_0x834e('0x52')]){_0x2515f6[_0x834e('0x51')]=_['merge'](_0x2515f6[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x2515f6[_0x834e('0x33')],function(_0x2f1de8){var _0x4b6834={};_0x4b6834[_0x2f1de8]={'$like':'%'+_0x5cb379[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x4b6834;})});}_0x2515f6=_[_0x834e('0x43')]({},_0x2515f6,_0x5cb379[_0x834e('0x44')]);return _0x3512d8[_0x834e('0x89')](_0x2515f6);}})[_0x834e('0x18')](function(_0x3f6ead){if(_0x3f6ead){_0x5e0bfe=_0x3f6ead[_0x834e('0x36')];if(!_0x5cb379[_0x834e('0x2c')]['hasOwnProperty'](_0x834e('0x4c'))){_0x2515f6['limit']=qs[_0x834e('0x13')](_0x5cb379['query'][_0x834e('0x13')]);_0x2515f6[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x5cb379[_0x834e('0x2c')][_0x834e('0x12')]);}return _0x3512d8['getAgents'](_0x2515f6);}})[_0x834e('0x18')](function(_0x29f970){if(_0x29f970){return _0x29f970?{'count':_0x5e0bfe,'rows':_0x29f970}:null;}})['then'](respondWithResult(_0x494e08,null))['catch'](handleError(_0x494e08,null));};exports[_0x834e('0x8a')]=function(_0x4db3c5,_0x4e6a75){var _0x57a989={};var _0x26cb93={};var _0x39bd0c;var _0xbd9400;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x4db3c5[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x4e6a75,null))['then'](function(_0x28825c){if(_0x28825c){_0x39bd0c=_0x28825c;_0x26cb93[_0x834e('0x32')]=_['keys'](db['UserVoiceQueueRt'][_0x834e('0x27')]);_0x26cb93[_0x834e('0x2c')]=_['keys'](_0x4db3c5['query']);_0x26cb93[_0x834e('0x31')]=_[_0x834e('0x34')](_0x26cb93[_0x834e('0x32')],_0x26cb93['query']);_0x57a989[_0x834e('0x33')]=_[_0x834e('0x34')](_0x26cb93[_0x834e('0x32')],qs['fields'](_0x4db3c5[_0x834e('0x2c')]['fields']));_0x57a989[_0x834e('0x33')]=_0x57a989[_0x834e('0x33')][_0x834e('0x36')]?_0x57a989[_0x834e('0x33')]:_0x26cb93[_0x834e('0x32')];_0x57a989['order']=qs[_0x834e('0x4e')](_0x4db3c5[_0x834e('0x2c')][_0x834e('0x4e')]);_0x57a989[_0x834e('0x51')]=qs[_0x834e('0x31')](_['pick'](_0x4db3c5['query'],_0x26cb93[_0x834e('0x31')]));if(_0x4db3c5[_0x834e('0x2c')][_0x834e('0x52')]){_0x57a989['where']=_[_0x834e('0x43')](_0x57a989[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x57a989[_0x834e('0x33')],function(_0x53faec){var _0x3cc563={};_0x3cc563[_0x53faec]={'$like':'%'+_0x4db3c5[_0x834e('0x2c')]['filter']+'%'};return _0x3cc563;})});}_0x57a989=_[_0x834e('0x43')]({},_0x57a989,_0x4db3c5[_0x834e('0x44')]);return _0x39bd0c[_0x834e('0x8a')](_0x57a989);}})[_0x834e('0x18')](function(_0x4b0246){if(_0x4b0246){_0xbd9400=_0x4b0246[_0x834e('0x36')];if(!_0x4db3c5['query'][_0x834e('0x4b')](_0x834e('0x4c'))){_0x57a989[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x4db3c5[_0x834e('0x2c')][_0x834e('0x13')]);_0x57a989['offset']=qs['offset'](_0x4db3c5[_0x834e('0x2c')][_0x834e('0x12')]);}return _0x39bd0c['getMembers'](_0x57a989);}})[_0x834e('0x18')](function(_0x4af796){return _0x4af796?{'count':_0xbd9400,'rows':_0x4af796}:null;})[_0x834e('0x18')](respondWithResult(_0x4e6a75,null))[_0x834e('0x2e')](handleError(_0x4e6a75,null));};exports[_0x834e('0x8b')]=function(_0x151b58,_0x2ec7b0){var _0x1ca24b={};var _0x36836f={};var _0x56ae60;var _0x122b03;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x151b58[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x2ec7b0,null))['then'](function(_0x167642){if(_0x167642){_0x56ae60=_0x167642;_0x36836f[_0x834e('0x32')]=_[_0x834e('0x30')](db['CmList']['rawAttributes']);_0x36836f['query']=_[_0x834e('0x30')](_0x151b58[_0x834e('0x2c')]);_0x36836f[_0x834e('0x31')]=_[_0x834e('0x34')](_0x36836f[_0x834e('0x32')],_0x36836f[_0x834e('0x2c')]);_0x1ca24b[_0x834e('0x33')]=_[_0x834e('0x34')](_0x36836f[_0x834e('0x32')],qs[_0x834e('0x35')](_0x151b58[_0x834e('0x2c')]['fields']));_0x1ca24b[_0x834e('0x33')]=_0x1ca24b[_0x834e('0x33')][_0x834e('0x36')]?_0x1ca24b[_0x834e('0x33')]:_0x36836f[_0x834e('0x32')];_0x1ca24b[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x151b58[_0x834e('0x2c')]['sort']);_0x1ca24b[_0x834e('0x51')]=qs[_0x834e('0x31')](_['pick'](_0x151b58[_0x834e('0x2c')],_0x36836f[_0x834e('0x31')]));if(_0x151b58[_0x834e('0x2c')][_0x834e('0x52')]){_0x1ca24b['where']=_['merge'](_0x1ca24b[_0x834e('0x51')],{'$or':_['map'](_0x1ca24b[_0x834e('0x33')],function(_0x433cb4){var _0x18638d={};_0x18638d[_0x433cb4]={'$like':'%'+_0x151b58[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x18638d;})});}_0x1ca24b=_['merge']({},_0x1ca24b,_0x151b58[_0x834e('0x44')]);return _0x56ae60['getLists'](_0x1ca24b);}})['then'](function(_0x3d8b08){if(_0x3d8b08){_0x122b03=_0x3d8b08[_0x834e('0x36')];if(!_0x151b58[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x1ca24b[_0x834e('0x13')]=qs['limit'](_0x151b58[_0x834e('0x2c')][_0x834e('0x13')]);_0x1ca24b['offset']=qs[_0x834e('0x12')](_0x151b58[_0x834e('0x2c')]['offset']);}return _0x56ae60[_0x834e('0x8b')](_0x1ca24b);}})[_0x834e('0x18')](function(_0x47a239){if(_0x47a239){return _0x47a239?{'count':_0x122b03,'rows':_0x47a239}:null;}})[_0x834e('0x18')](respondWithResult(_0x2ec7b0,null))[_0x834e('0x2e')](handleError(_0x2ec7b0,null));};exports[_0x834e('0x8c')]=function(_0x3b658a,_0x34a13d){var _0x29b8fd=moment()[_0x834e('0x6b')](_0x834e('0x8d'));var _0x208bbe,_0xe0b3;return db['VoiceQueue'][_0x834e('0x3c')]({'where':{'id':_0x3b658a[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x34a13d,null))[_0x834e('0x18')](function(_0x371767){if(_0x371767){_0xe0b3=_0x371767;return _0x371767[_0x834e('0x8c')](_0x3b658a[_0x834e('0x38')][_0x834e('0x71')],_[_0x834e('0x45')](_0x3b658a[_0x834e('0x38')],[_0x834e('0x71'),'id'])||{});}return null;})[_0x834e('0x86')](function(_0x5af6fc){var _0x2ddbc0;_0x208bbe=_0x5af6fc||[];var _0x1cd122=[];if(_0x5af6fc){for(var _0x49be08=0x0;_0x49be08<_0x5af6fc['length'];_0x49be08+=0x1){var _0x563f20=_0x5af6fc[_0x49be08][_0x834e('0x1a')]({'plain':!![]});_0xe0b3[_0x834e('0x8e')]=_0x3b658a[_0x834e('0x38')][_0x834e('0x8e')]?_0x3b658a[_0x834e('0x38')][_0x834e('0x8e')]:_0xe0b3[_0x834e('0x8e')];switch(_0xe0b3['dialCheckDuplicateType']){case'always':_0x2ddbc0=squel['insert']()['into'](_0x834e('0x8f'))[_0x834e('0x90')]([_0x834e('0x91'),'scheduledAt','ContactId','ListId',_0x834e('0x50'),'createdAt','updatedAt'],squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x91'),_0x834e('0x91'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x92'))[_0x834e('0x73')]('id','ContactId')[_0x834e('0x73')](_0x563f20[_0x834e('0x93')][_0x834e('0x7b')](),_0x834e('0x94'))[_0x834e('0x73')](_0x3b658a['params']['id'][_0x834e('0x7b')](),'VoiceQueueId')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x46'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27','updatedAt')['from']('cm_contacts')['where'](_0x834e('0x95'))[_0x834e('0x51')]('ListId\x20=\x20?',_0x563f20['CmListId'][_0x834e('0x7b')]())[_0x834e('0x51')](_0x834e('0x96'))['where'](_0x834e('0x97'),squel[_0x834e('0x72')]()[_0x834e('0x73')]('COALESCE(calleridnum,\x27\x27)')[_0x834e('0x75')](_0x834e('0x98'))[_0x834e('0x51')](_0x834e('0x99'),_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')]()))[_0x834e('0x51')]('phone\x20NOT\x20IN\x20(?)',squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x9a'))['from'](_0x834e('0x8f'))[_0x834e('0x51')](_0x834e('0x99'),_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')]())))[_0x834e('0x7b')]();break;case _0x834e('0x9b'):_0x2ddbc0=squel[_0x834e('0x9c')]()[_0x834e('0x9d')](_0x834e('0x8f'))[_0x834e('0x90')]([_0x834e('0x91'),'scheduledAt',_0x834e('0x9e'),'ListId',_0x834e('0x50'),'createdAt',_0x834e('0x47')],squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x91'),_0x834e('0x91'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x92'))[_0x834e('0x73')]('id','ContactId')['field'](_0x563f20['CmListId'][_0x834e('0x7b')](),_0x834e('0x94'))[_0x834e('0x73')](_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')](),_0x834e('0x50'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x46'))['field']('\x27'+_0x29b8fd+'\x27','updatedAt')[_0x834e('0x75')](_0x834e('0x9f'))[_0x834e('0x51')]('deletedAt\x20IS\x20NULL')['where'](_0x834e('0xa0'),_0x563f20['CmListId'][_0x834e('0x7b')]())[_0x834e('0x51')](_0x834e('0x96'))['where'](_0x834e('0x97'),squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x9a'))[_0x834e('0x75')](_0x834e('0x8f'))[_0x834e('0x51')]('VoiceQueueId\x20=\x20?',_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')]())))[_0x834e('0x7b')]();break;default:_0x2ddbc0=squel[_0x834e('0x9c')]()[_0x834e('0x9d')](_0x834e('0x8f'))[_0x834e('0x90')](['phone','scheduledAt',_0x834e('0x9e'),'ListId','VoiceQueueId',_0x834e('0x46'),_0x834e('0x47')],squel['select']()[_0x834e('0x73')]('phone','phone')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27','scheduledAt')[_0x834e('0x73')]('id',_0x834e('0x9e'))[_0x834e('0x73')](_0x563f20[_0x834e('0x93')][_0x834e('0x7b')](),_0x834e('0x94'))[_0x834e('0x73')](_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')](),'VoiceQueueId')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x46'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x47'))['from']('cm_contacts')[_0x834e('0x51')](_0x834e('0x95'))['where'](_0x834e('0xa0'),_0x563f20['CmListId'][_0x834e('0x7b')]())[_0x834e('0x51')](_0x834e('0x96')))[_0x834e('0x7b')]();}_0x1cd122[_0x834e('0x87')](db[_0x834e('0x63')]['query'](_0x2ddbc0));}return BPromise['all'](_0x1cd122);}})['then'](function(){var _0xbafedb=[];var _0x1d004f=squel[_0x834e('0x9c')]()['into']('cm_hopper_additional_phones')[_0x834e('0x90')]([_0x834e('0xa1'),_0x834e('0x91'),_0x834e('0xa2'),_0x834e('0x46'),_0x834e('0x47')],squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0xa3'))[_0x834e('0x73')](_0x834e('0xa4'))['field'](_0x834e('0xa5'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27','createdAt')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x47'))[_0x834e('0x75')](_0x834e('0xa6'),'ci')[_0x834e('0x77')](_0x834e('0x8f'),'h',_0x834e('0xa7'))[_0x834e('0x51')](_0x834e('0xa8'),_0x29b8fd)[_0x834e('0x51')](_0x834e('0xa9'),_0x834e('0xaa')))[_0x834e('0x7b')]();_0xbafedb[_0x834e('0x87')](db[_0x834e('0x63')][_0x834e('0x2c')](_0x1d004f));return BPromise[_0x834e('0x81')](_0xbafedb);})[_0x834e('0x18')](function(){return _0x208bbe;})[_0x834e('0x18')](respondWithResult(_0x34a13d,null))[_0x834e('0x2e')](handleError(_0x34a13d,null));};exports[_0x834e('0xab')]=function(_0x239efd,_0x2f7170){return db['VoiceQueue'][_0x834e('0x3c')]({'where':{'id':_0x239efd[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x2f7170,null))[_0x834e('0x18')](function(_0x3fd7a3){if(_0x3fd7a3){return _0x3fd7a3[_0x834e('0xab')](_0x239efd[_0x834e('0x2c')][_0x834e('0x71')]);}})[_0x834e('0x18')](function(_0x41d0a7){if(_0x41d0a7){return db[_0x834e('0x53')][_0x834e('0x19')]({'where':{'ListId':_0x239efd['query'][_0x834e('0x71')],'VoiceQueueId':_0x239efd[_0x834e('0x41')]['id']}})['then'](function(){return _0x41d0a7;});}})[_0x834e('0x18')](respondWithStatusCode(_0x2f7170,null))[_0x834e('0x2e')](handleError(_0x2f7170,null));};exports['getBlackLists']=function(_0x16a7a9,_0x18b8c7){var _0x576ece={};var _0x51c877={};var _0x54915f;var _0x32d06c;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x16a7a9[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x18b8c7,null))[_0x834e('0x18')](function(_0x132711){if(_0x132711){_0x54915f=_0x132711;_0x51c877[_0x834e('0x32')]=_['keys'](db[_0x834e('0xac')][_0x834e('0x27')]);_0x51c877[_0x834e('0x2c')]=_['keys'](_0x16a7a9[_0x834e('0x2c')]);_0x51c877[_0x834e('0x31')]=_['intersection'](_0x51c877[_0x834e('0x32')],_0x51c877[_0x834e('0x2c')]);_0x576ece['attributes']=_[_0x834e('0x34')](_0x51c877[_0x834e('0x32')],qs[_0x834e('0x35')](_0x16a7a9[_0x834e('0x2c')][_0x834e('0x35')]));_0x576ece['attributes']=_0x576ece['attributes'][_0x834e('0x36')]?_0x576ece[_0x834e('0x33')]:_0x51c877[_0x834e('0x32')];_0x576ece['order']=qs[_0x834e('0x4e')](_0x16a7a9[_0x834e('0x2c')][_0x834e('0x4e')]);_0x576ece[_0x834e('0x51')]=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x16a7a9['query'],_0x51c877[_0x834e('0x31')]));if(_0x16a7a9[_0x834e('0x2c')][_0x834e('0x52')]){_0x576ece[_0x834e('0x51')]=_[_0x834e('0x43')](_0x576ece['where'],{'$or':_['map'](_0x576ece[_0x834e('0x33')],function(_0x5eca84){var _0xcb4fe4={};_0xcb4fe4[_0x5eca84]={'$like':'%'+_0x16a7a9[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0xcb4fe4;})});}_0x576ece=_[_0x834e('0x43')]({},_0x576ece,_0x16a7a9[_0x834e('0x44')]);return _0x54915f[_0x834e('0xad')](_0x576ece);}})[_0x834e('0x18')](function(_0x5b4718){if(_0x5b4718){_0x32d06c=_0x5b4718[_0x834e('0x36')];if(!_0x16a7a9[_0x834e('0x2c')]['hasOwnProperty'](_0x834e('0x4c'))){_0x576ece[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x16a7a9['query'][_0x834e('0x13')]);_0x576ece['offset']=qs[_0x834e('0x12')](_0x16a7a9['query'][_0x834e('0x12')]);}return _0x54915f[_0x834e('0xad')](_0x576ece);}})['then'](function(_0x3757bf){if(_0x3757bf){return _0x3757bf?{'count':_0x32d06c,'rows':_0x3757bf}:null;}})['then'](respondWithResult(_0x18b8c7,null))[_0x834e('0x2e')](handleError(_0x18b8c7,null));};exports[_0x834e('0xae')]=function(_0x395b48,_0x5b4208){var _0x4c9b90;return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x395b48[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x5b4208,null))[_0x834e('0x18')](function(_0x414ff2){if(_0x414ff2){return _0x414ff2[_0x834e('0xae')](_0x395b48[_0x834e('0x38')][_0x834e('0x71')],_[_0x834e('0x45')](_0x395b48[_0x834e('0x38')],[_0x834e('0x71'),'id'])||{});}return null;})[_0x834e('0x86')](function(_0x3aeca7){var _0x1d9e00;_0x4c9b90=_0x3aeca7||[];var _0x11db76=[];if(_0x3aeca7){for(var _0x37f058=0x0;_0x37f058<_0x3aeca7[_0x834e('0x36')];_0x37f058+=0x1){var _0x354497=_0x3aeca7[_0x37f058]['get']({'plain':!![]});_0x1d9e00=squel[_0x834e('0x9c')]()['into'](_0x834e('0xaf'))[_0x834e('0x90')]([_0x834e('0x91'),_0x834e('0x9e'),_0x834e('0x94'),'VoiceQueueId',_0x834e('0x46'),_0x834e('0x47')],squel[_0x834e('0x72')]()[_0x834e('0x73')]('phone','phone')[_0x834e('0x73')]('id',_0x834e('0x9e'))[_0x834e('0x73')](_0x354497[_0x834e('0x93')]['toString'](),'ListId')['field'](_0x395b48['params']['id'][_0x834e('0x7b')](),'VoiceQueueId')[_0x834e('0x73')]('NOW()',_0x834e('0x46'))[_0x834e('0x73')](_0x834e('0xb0'),'updatedAt')[_0x834e('0x75')]('cm_contacts')[_0x834e('0x51')]('deletedAt\x20IS\x20NULL')[_0x834e('0x51')]('ListId\x20=\x20?',_0x354497[_0x834e('0x93')][_0x834e('0x7b')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x11db76['push'](db[_0x834e('0x63')][_0x834e('0x2c')](_0x1d9e00));}return BPromise['all'](_0x11db76);}})[_0x834e('0x18')](function(){return _0x4c9b90;})[_0x834e('0x18')](respondWithResult(_0x5b4208,null))[_0x834e('0x2e')](handleError(_0x5b4208,null));};exports['removeBlackLists']=function(_0x5cb260,_0x5b3fda){return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x5cb260[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x5b3fda,null))[_0x834e('0x18')](function(_0x1e5e2a){if(_0x1e5e2a){return _0x1e5e2a[_0x834e('0xb1')](_0x5cb260[_0x834e('0x2c')][_0x834e('0x71')]);}})[_0x834e('0x18')](function(_0x549c2f){if(_0x549c2f){return db['CmHopperBlack'][_0x834e('0x19')]({'where':{'ListId':_0x5cb260[_0x834e('0x2c')][_0x834e('0x71')],'VoiceQueueId':_0x5cb260[_0x834e('0x41')]['id']}})[_0x834e('0x18')](function(){return _0x549c2f;});}})[_0x834e('0x18')](respondWithStatusCode(_0x5b3fda,null))[_0x834e('0x2e')](handleError(_0x5b3fda,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1c8a78a..882e456 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 _0x79b5=['hook','exports','events','../../mysqldb','VoiceQueue','remove','emit','hasOwnProperty'];(function(_0x351ad8,_0x4e83cb){var _0x6726de=function(_0x5ea2a6){while(--_0x5ea2a6){_0x351ad8['push'](_0x351ad8['shift']());}};_0x6726de(++_0x4e83cb);}(_0x79b5,0x1d2));var _0x579b=function(_0x1fb28c,_0x306808){_0x1fb28c=_0x1fb28c-0x0;var _0x505e0b=_0x79b5[_0x1fb28c];return _0x505e0b;};'use strict';var EventEmitter=require(_0x579b('0x0'));var VoiceQueue=require(_0x579b('0x1'))['db'][_0x579b('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x579b('0x3')};function emitEvent(_0x39373e){return function(_0x4c2f80,_0x131e8b,_0x3ff52e){VoiceQueueEvents['emit'](_0x39373e+':'+_0x4c2f80['id'],_0x4c2f80);VoiceQueueEvents[_0x579b('0x4')](_0x39373e,_0x4c2f80);_0x3ff52e(null);};}for(var e in events){if(events[_0x579b('0x5')](e)){var event=events[e];VoiceQueue[_0x579b('0x6')](e,emitEvent(event));}}module[_0x579b('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x1441=['emit','hasOwnProperty','hook','exports','events','save','update'];(function(_0x594a5c,_0x357420){var _0x28fe3a=function(_0x1dd39b){while(--_0x1dd39b){_0x594a5c['push'](_0x594a5c['shift']());}};_0x28fe3a(++_0x357420);}(_0x1441,0x193));var _0x1144=function(_0x2389bc,_0x167cd2){_0x2389bc=_0x2389bc-0x0;var _0x170548=_0x1441[_0x2389bc];return _0x170548;};'use strict';var EventEmitter=require(_0x1144('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1144('0x1'),'afterUpdate':_0x1144('0x2'),'afterDestroy':'remove'};function emitEvent(_0xb43b28){return function(_0x177b47,_0x3f33bc,_0x259481){VoiceQueueEvents['emit'](_0xb43b28+':'+_0x177b47['id'],_0x177b47);VoiceQueueEvents[_0x1144('0x3')](_0xb43b28,_0x177b47);_0x259481(null);};}for(var e in events){if(events[_0x1144('0x4')](e)){var event=events[e];VoiceQueue[_0x1144('0x5')](e,emitEvent(event));}}module[_0x1144('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 72e5348..65ad7fd 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 _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4ab133,_0x2dcbd1){var _0x3942fe=function(_0x435b6c){while(--_0x435b6c){_0x4ab133['push'](_0x4ab133['shift']());}};_0x3942fe(++_0x2dcbd1);}(_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 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':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x26cd05,_0x1f7d74){var _0x3e13b9=function(_0x1af957){while(--_0x1af957){_0x26cd05['push'](_0x26cd05['shift']());}};_0x3e13b9(++_0x1f7d74);}(_0x008c,0x188));var _0xc008=function(_0x151ae3,_0x3a9195){_0x151ae3=_0x151ae3-0x0;var _0x564680=_0x008c[_0x151ae3];return _0x564680;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index b8488e0..3675063 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 _0xcf0b=['attributes','limit','map','include','model','GetVoiceQueue','stringify','ShowVoiceQueue','find','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','VoiceQueue','findAll','options','where'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xcf0b,0x128));var _0xbcf0=function(_0x448ae2,_0x1676f5){_0x448ae2=_0x448ae2-0x0;var _0x4fdd34=_0xcf0b[_0x448ae2];return _0x4fdd34;};'use strict';var _=require(_0xbcf0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbcf0('0x1'));var fs=require('fs');var Redis=require(_0xbcf0('0x2'));var db=require(_0xbcf0('0x3'))['db'];var utils=require(_0xbcf0('0x4'));var logger=require(_0xbcf0('0x5'))(_0xbcf0('0x6'));var config=require(_0xbcf0('0x7'));var jayson=require(_0xbcf0('0x8'));var client=jayson[_0xbcf0('0x9')][_0xbcf0('0xa')]({'port':0x232a});config[_0xbcf0('0xb')]=_[_0xbcf0('0xc')](config['redis'],{'host':_0xbcf0('0xd'),'port':0x18eb});var socket=require(_0xbcf0('0xe'))(new Redis(config['redis']));require(_0xbcf0('0xf'))[_0xbcf0('0x10')](socket);function respondWithRpcPromise(_0x5af75f,_0x58ca8a,_0x563be5){return new BPromise(function(_0x3cc6f0,_0x2cbf11){return client[_0xbcf0('0x11')](_0x5af75f,_0x563be5)[_0xbcf0('0x12')](function(_0x507551){logger[_0xbcf0('0x13')](_0xbcf0('0x14'),_0x58ca8a,_0xbcf0('0x15'));logger[_0xbcf0('0x16')](_0xbcf0('0x17'),_0x58ca8a,_0xbcf0('0x15'),JSON['stringify'](_0x507551));if(_0x507551[_0xbcf0('0x18')]){if(_0x507551[_0xbcf0('0x18')][_0xbcf0('0x19')]===0x1f4){logger[_0xbcf0('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x58ca8a,_0x507551[_0xbcf0('0x18')][_0xbcf0('0x1a')]);return _0x2cbf11(_0x507551[_0xbcf0('0x18')][_0xbcf0('0x1a')]);}logger[_0xbcf0('0x18')](_0xbcf0('0x14'),_0x58ca8a,_0x507551['error'][_0xbcf0('0x1a')]);return _0x3cc6f0(_0x507551[_0xbcf0('0x18')][_0xbcf0('0x1a')]);}else{logger[_0xbcf0('0x13')](_0xbcf0('0x14'),_0x58ca8a,'request\x20sent');_0x3cc6f0(_0x507551['result'][_0xbcf0('0x1a')]);}})[_0xbcf0('0x1b')](function(_0x565e21){logger['error'](_0xbcf0('0x14'),_0x58ca8a,_0x565e21);_0x2cbf11(_0x565e21);});});}exports['GetVoiceQueue']=function(_0x19f4e3){var _0x642214=this;return new Promise(function(_0x487bd7,_0x5905e8){return db[_0xbcf0('0x1c')][_0xbcf0('0x1d')]({'raw':_0x19f4e3['options']?_0x19f4e3[_0xbcf0('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x19f4e3[_0xbcf0('0x1e')]?_0x19f4e3[_0xbcf0('0x1e')][_0xbcf0('0x1f')]||null:null,'attributes':_0x19f4e3[_0xbcf0('0x1e')]?_0x19f4e3[_0xbcf0('0x1e')][_0xbcf0('0x20')]||null:null,'limit':_0x19f4e3['options']?_0x19f4e3[_0xbcf0('0x1e')][_0xbcf0('0x21')]||null:null,'include':_0x19f4e3['options']?_0x19f4e3[_0xbcf0('0x1e')]['include']?_[_0xbcf0('0x22')](_0x19f4e3[_0xbcf0('0x1e')][_0xbcf0('0x23')],function(_0x305382){return{'model':db[_0x305382[_0xbcf0('0x24')]],'as':_0x305382['as'],'attributes':_0x305382[_0xbcf0('0x20')],'include':_0x305382[_0xbcf0('0x23')]?_[_0xbcf0('0x22')](_0x305382[_0xbcf0('0x23')],function(_0x35653c){return{'model':db[_0x35653c[_0xbcf0('0x24')]],'as':_0x35653c['as'],'attributes':_0x35653c[_0xbcf0('0x20')],'include':_0x35653c[_0xbcf0('0x23')]?_[_0xbcf0('0x22')](_0x35653c[_0xbcf0('0x23')],function(_0x2192db){return{'model':db[_0x2192db['model']],'as':_0x2192db['as'],'attributes':_0x2192db[_0xbcf0('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbcf0('0x12')](function(_0xd698c7){logger[_0xbcf0('0x13')](_0xbcf0('0x25'),_0x19f4e3);logger[_0xbcf0('0x16')]('GetVoiceQueue',_0x19f4e3,JSON[_0xbcf0('0x26')](_0xd698c7));_0x487bd7(_0xd698c7);})['catch'](function(_0x563e6c){logger[_0xbcf0('0x18')]('GetVoiceQueue',_0x563e6c[_0xbcf0('0x1a')],_0x19f4e3);_0x5905e8(_0x642214[_0xbcf0('0x18')](0x1f4,_0x563e6c[_0xbcf0('0x1a')]));});});};exports[_0xbcf0('0x27')]=function(_0x5499b6){var _0x33713f=this;return new Promise(function(_0x489f14,_0x2fdfa7){return db[_0xbcf0('0x1c')][_0xbcf0('0x28')]({'raw':_0x5499b6[_0xbcf0('0x1e')]?_0x5499b6[_0xbcf0('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5499b6[_0xbcf0('0x1e')]?_0x5499b6[_0xbcf0('0x1e')][_0xbcf0('0x1f')]||null:null,'attributes':_0x5499b6[_0xbcf0('0x1e')]?_0x5499b6[_0xbcf0('0x1e')][_0xbcf0('0x20')]||null:null,'include':_0x5499b6[_0xbcf0('0x1e')]?_0x5499b6['options'][_0xbcf0('0x23')]?_['map'](_0x5499b6[_0xbcf0('0x1e')][_0xbcf0('0x23')],function(_0x185ed5){return{'model':db[_0x185ed5['model']],'as':_0x185ed5['as'],'attributes':_0x185ed5[_0xbcf0('0x20')],'include':_0x185ed5[_0xbcf0('0x23')]?_[_0xbcf0('0x22')](_0x185ed5[_0xbcf0('0x23')],function(_0x2a7ed8){return{'model':db[_0x2a7ed8[_0xbcf0('0x24')]],'as':_0x2a7ed8['as'],'attributes':_0x2a7ed8['attributes'],'include':_0x2a7ed8[_0xbcf0('0x23')]?_[_0xbcf0('0x22')](_0x2a7ed8[_0xbcf0('0x23')],function(_0x2a11c3){return{'model':db[_0x2a11c3[_0xbcf0('0x24')]],'as':_0x2a11c3['as'],'attributes':_0x2a11c3[_0xbcf0('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbcf0('0x12')](function(_0x5e7ee4){logger[_0xbcf0('0x13')]('ShowVoiceQueue',_0x5499b6);logger[_0xbcf0('0x16')](_0xbcf0('0x27'),_0x5499b6,JSON[_0xbcf0('0x26')](_0x5e7ee4));_0x489f14(_0x5e7ee4);})[_0xbcf0('0x1b')](function(_0x192e30){logger[_0xbcf0('0x18')](_0xbcf0('0x27'),_0x192e30['message'],_0x5499b6);_0x2fdfa7(_0x33713f[_0xbcf0('0x18')](0x1f4,_0x192e30['message']));});});}; \ No newline at end of file +var _0x10a5=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueue','options','raw','attributes','limit','include','map','model','debug','ShowVoiceQueue','find','where','util','bluebird'];(function(_0x3f6e26,_0x811a34){var _0x474345=function(_0x4a0cbe){while(--_0x4a0cbe){_0x3f6e26['push'](_0x3f6e26['shift']());}};_0x474345(++_0x811a34);}(_0x10a5,0x101));var _0x510a=function(_0x2cfb48,_0x24b83b){_0x2cfb48=_0x2cfb48-0x0;var _0xc4594f=_0x10a5[_0x2cfb48];return _0xc4594f;};'use strict';var _=require('lodash');var util=require(_0x510a('0x0'));var moment=require('moment');var BPromise=require(_0x510a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x510a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x510a('0x3'));var logger=require(_0x510a('0x4'))(_0x510a('0x5'));var config=require(_0x510a('0x6'));var jayson=require(_0x510a('0x7'));var client=jayson['client'][_0x510a('0x8')]({'port':0x232a});config[_0x510a('0x9')]=_[_0x510a('0xa')](config['redis'],{'host':_0x510a('0xb'),'port':0x18eb});var socket=require(_0x510a('0xc'))(new Redis(config[_0x510a('0x9')]));require(_0x510a('0xd'))['register'](socket);function respondWithRpcPromise(_0x489267,_0x501f64,_0x5d9c61){return new BPromise(function(_0x46b19d,_0x41a14e){return client[_0x510a('0xe')](_0x489267,_0x5d9c61)[_0x510a('0xf')](function(_0xda63d4){logger[_0x510a('0x10')](_0x510a('0x11'),_0x501f64,_0x510a('0x12'));logger['debug'](_0x510a('0x13'),_0x501f64,_0x510a('0x12'),JSON[_0x510a('0x14')](_0xda63d4));if(_0xda63d4['error']){if(_0xda63d4[_0x510a('0x15')]['code']===0x1f4){logger['error'](_0x510a('0x11'),_0x501f64,_0xda63d4[_0x510a('0x15')][_0x510a('0x16')]);return _0x41a14e(_0xda63d4[_0x510a('0x15')][_0x510a('0x16')]);}logger[_0x510a('0x15')](_0x510a('0x11'),_0x501f64,_0xda63d4[_0x510a('0x15')][_0x510a('0x16')]);return _0x46b19d(_0xda63d4[_0x510a('0x15')]['message']);}else{logger['info'](_0x510a('0x11'),_0x501f64,_0x510a('0x12'));_0x46b19d(_0xda63d4[_0x510a('0x17')][_0x510a('0x16')]);}})[_0x510a('0x18')](function(_0x47fa8e){logger[_0x510a('0x15')](_0x510a('0x11'),_0x501f64,_0x47fa8e);_0x41a14e(_0x47fa8e);});});}exports[_0x510a('0x19')]=function(_0x2a0f7b){var _0x34ee25=this;return new Promise(function(_0x59fb58,_0x52b105){return db['VoiceQueue']['findAll']({'raw':_0x2a0f7b['options']?_0x2a0f7b[_0x510a('0x1a')][_0x510a('0x1b')]===undefined?!![]:![]:!![],'where':_0x2a0f7b[_0x510a('0x1a')]?_0x2a0f7b[_0x510a('0x1a')]['where']||null:null,'attributes':_0x2a0f7b[_0x510a('0x1a')]?_0x2a0f7b[_0x510a('0x1a')][_0x510a('0x1c')]||null:null,'limit':_0x2a0f7b['options']?_0x2a0f7b['options'][_0x510a('0x1d')]||null:null,'include':_0x2a0f7b[_0x510a('0x1a')]?_0x2a0f7b[_0x510a('0x1a')][_0x510a('0x1e')]?_[_0x510a('0x1f')](_0x2a0f7b[_0x510a('0x1a')]['include'],function(_0x40a08f){return{'model':db[_0x40a08f[_0x510a('0x20')]],'as':_0x40a08f['as'],'attributes':_0x40a08f[_0x510a('0x1c')],'include':_0x40a08f[_0x510a('0x1e')]?_['map'](_0x40a08f[_0x510a('0x1e')],function(_0x20d04b){return{'model':db[_0x20d04b['model']],'as':_0x20d04b['as'],'attributes':_0x20d04b[_0x510a('0x1c')],'include':_0x20d04b[_0x510a('0x1e')]?_['map'](_0x20d04b[_0x510a('0x1e')],function(_0x5ba54e){return{'model':db[_0x5ba54e[_0x510a('0x20')]],'as':_0x5ba54e['as'],'attributes':_0x5ba54e[_0x510a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x510a('0xf')](function(_0x4af3be){logger[_0x510a('0x10')](_0x510a('0x19'),_0x2a0f7b);logger[_0x510a('0x21')]('GetVoiceQueue',_0x2a0f7b,JSON['stringify'](_0x4af3be));_0x59fb58(_0x4af3be);})[_0x510a('0x18')](function(_0x3e121c){logger['error'](_0x510a('0x19'),_0x3e121c[_0x510a('0x16')],_0x2a0f7b);_0x52b105(_0x34ee25[_0x510a('0x15')](0x1f4,_0x3e121c[_0x510a('0x16')]));});});};exports[_0x510a('0x22')]=function(_0x5d7392){var _0x5e0bde=this;return new Promise(function(_0x4c2920,_0x1bf602){return db['VoiceQueue'][_0x510a('0x23')]({'raw':_0x5d7392['options']?_0x5d7392['options'][_0x510a('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d7392[_0x510a('0x1a')]?_0x5d7392[_0x510a('0x1a')][_0x510a('0x24')]||null:null,'attributes':_0x5d7392[_0x510a('0x1a')]?_0x5d7392[_0x510a('0x1a')]['attributes']||null:null,'include':_0x5d7392[_0x510a('0x1a')]?_0x5d7392['options']['include']?_[_0x510a('0x1f')](_0x5d7392['options'][_0x510a('0x1e')],function(_0x45057a){return{'model':db[_0x45057a[_0x510a('0x20')]],'as':_0x45057a['as'],'attributes':_0x45057a[_0x510a('0x1c')],'include':_0x45057a[_0x510a('0x1e')]?_['map'](_0x45057a[_0x510a('0x1e')],function(_0x3a51ab){return{'model':db[_0x3a51ab[_0x510a('0x20')]],'as':_0x3a51ab['as'],'attributes':_0x3a51ab[_0x510a('0x1c')],'include':_0x3a51ab['include']?_[_0x510a('0x1f')](_0x3a51ab['include'],function(_0x19ba50){return{'model':db[_0x19ba50[_0x510a('0x20')]],'as':_0x19ba50['as'],'attributes':_0x19ba50[_0x510a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x510a('0xf')](function(_0x255e1d){logger[_0x510a('0x10')](_0x510a('0x22'),_0x5d7392);logger[_0x510a('0x21')](_0x510a('0x22'),_0x5d7392,JSON[_0x510a('0x14')](_0x255e1d));_0x4c2920(_0x255e1d);})['catch'](function(_0x1652d7){logger['error'](_0x510a('0x22'),_0x1652d7[_0x510a('0x16')],_0x5d7392);_0x1bf602(_0x5e0bde['error'](0x1f4,_0x1652d7[_0x510a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index e28ab88..463e151 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 _0x2248=['./voiceQueue.events','save','removeListener','register','voiceQueue:'];(function(_0x2200ce,_0x424cc8){var _0x18bf62=function(_0x588040){while(--_0x588040){_0x2200ce['push'](_0x2200ce['shift']());}};_0x18bf62(++_0x424cc8);}(_0x2248,0x96));var _0x8224=function(_0x28e6bc,_0xba9036){_0x28e6bc=_0x28e6bc-0x0;var _0x1eae11=_0x2248[_0x28e6bc];return _0x1eae11;};'use strict';var VoiceQueueEvents=require(_0x8224('0x0'));var events=[_0x8224('0x1'),'remove','update'];function createListener(_0x4e6544,_0x2a7120){return function(_0x3bbda2){_0x2a7120['emit'](_0x4e6544,_0x3bbda2);};}function removeListener(_0x4d4aed,_0x54e0ed){return function(){VoiceQueueEvents[_0x8224('0x2')](_0x4d4aed,_0x54e0ed);};}exports[_0x8224('0x3')]=function(_0x53d065){for(var _0x4d9f87=0x0,_0x4ec85c=events['length'];_0x4d9f87<_0x4ec85c;_0x4d9f87++){var _0x5bc183=events[_0x4d9f87];var _0x1adcdc=createListener(_0x8224('0x4')+_0x5bc183,_0x53d065);VoiceQueueEvents['on'](_0x5bc183,_0x1adcdc);}}; \ No newline at end of file +var _0xba24=['voiceQueue:','./voiceQueue.events','save','remove','emit','removeListener','length'];(function(_0x36da4a,_0x880fcc){var _0x550534=function(_0xfcf4ac){while(--_0xfcf4ac){_0x36da4a['push'](_0x36da4a['shift']());}};_0x550534(++_0x880fcc);}(_0xba24,0x17b));var _0x4ba2=function(_0x2b75e4,_0x34b47b){_0x2b75e4=_0x2b75e4-0x0;var _0x344627=_0xba24[_0x2b75e4];return _0x344627;};'use strict';var VoiceQueueEvents=require(_0x4ba2('0x0'));var events=[_0x4ba2('0x1'),_0x4ba2('0x2'),'update'];function createListener(_0x1bda6f,_0x550607){return function(_0x5edde6){_0x550607[_0x4ba2('0x3')](_0x1bda6f,_0x5edde6);};}function removeListener(_0x2ae1e9,_0x44ab6b){return function(){VoiceQueueEvents[_0x4ba2('0x4')](_0x2ae1e9,_0x44ab6b);};}exports['register']=function(_0x5ca804){for(var _0x5174eb=0x0,_0x2bee95=events[_0x4ba2('0x5')];_0x5174eb<_0x2bee95;_0x5174eb++){var _0x77a730=events[_0x5174eb];var _0x27c091=createListener(_0x4ba2('0x6')+_0x77a730,_0x5ca804);VoiceQueueEvents['on'](_0x77a730,_0x27c091);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index bb9ca0f..8584c42 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 _0x5533=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','isAuthenticated','describe','getVoiceQueuesReport','/:id','show','post','update','delete','destroy'];(function(_0x5b298,_0x4f81b8){var _0x2ff76d=function(_0x452dc2){while(--_0x452dc2){_0x5b298['push'](_0x5b298['shift']());}};_0x2ff76d(++_0x4f81b8);}(_0x5533,0x108));var _0x3553=function(_0x24a4cf,_0x34bd9e){_0x24a4cf=_0x24a4cf-0x0;var _0x2fbf1c=_0x5533[_0x24a4cf];return _0x2fbf1c;};'use strict';var multer=require(_0x3553('0x0'));var util=require(_0x3553('0x1'));var path=require(_0x3553('0x2'));var timeout=require(_0x3553('0x3'));var express=require(_0x3553('0x4'));var router=express['Router']();var fs_extra=require(_0x3553('0x5'));var auth=require(_0x3553('0x6'));var interaction=require(_0x3553('0x7'));var config=require(_0x3553('0x8'));var controller=require(_0x3553('0x9'));router[_0x3553('0xa')]('/',auth['isAuthenticated'](),controller[_0x3553('0xb')]);router[_0x3553('0xa')](_0x3553('0xc'),auth[_0x3553('0xd')](),controller[_0x3553('0xe')]);router[_0x3553('0xa')]('/index',auth['isAuthenticated'](),controller[_0x3553('0xf')]);router[_0x3553('0xa')](_0x3553('0x10'),auth[_0x3553('0xd')](),controller[_0x3553('0x11')]);router[_0x3553('0x12')]('/',auth[_0x3553('0xd')](),controller['create']);router['put'](_0x3553('0x10'),auth[_0x3553('0xd')](),controller[_0x3553('0x13')]);router[_0x3553('0x14')](_0x3553('0x10'),auth[_0x3553('0xd')](),controller[_0x3553('0x15')]);module['exports']=router; \ No newline at end of file +var _0x99fb=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','destroy','exports','util','path','express'];(function(_0x1b4213,_0x1f2388){var _0x3bc68d=function(_0x2338e5){while(--_0x2338e5){_0x1b4213['push'](_0x1b4213['shift']());}};_0x3bc68d(++_0x1f2388);}(_0x99fb,0xc5));var _0xb99f=function(_0x2830c8,_0x4c9f6f){_0x2830c8=_0x2830c8-0x0;var _0xc372dc=_0x99fb[_0x2830c8];return _0xc372dc;};'use strict';var multer=require('multer');var util=require(_0xb99f('0x0'));var path=require(_0xb99f('0x1'));var timeout=require('connect-timeout');var express=require(_0xb99f('0x2'));var router=express[_0xb99f('0x3')]();var fs_extra=require(_0xb99f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb99f('0x5'));var config=require(_0xb99f('0x6'));var controller=require('./voiceQueueReport.controller');router[_0xb99f('0x7')]('/',auth[_0xb99f('0x8')](),controller['index']);router['get']('/describe',auth[_0xb99f('0x8')](),controller[_0xb99f('0x9')]);router['get'](_0xb99f('0xa'),auth[_0xb99f('0x8')](),controller[_0xb99f('0xb')]);router[_0xb99f('0x7')](_0xb99f('0xc'),auth['isAuthenticated'](),controller[_0xb99f('0xd')]);router[_0xb99f('0xe')]('/',auth['isAuthenticated'](),controller[_0xb99f('0xf')]);router[_0xb99f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xb99f('0x11')]);router['delete'](_0xb99f('0xc'),auth[_0xb99f('0x8')](),controller[_0xb99f('0x12')]);module[_0xb99f('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index f50b18b..497ca40 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 _0x89b3=['setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds'];(function(_0x782c8a,_0x44ba28){var _0x4c60a9=function(_0x4fa7f5){while(--_0x4fa7f5){_0x782c8a['push'](_0x782c8a['shift']());}};_0x4c60a9(++_0x44ba28);}(_0x89b3,0x15b));var _0x389b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x89b3[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x389b('0x0'));var moment=require(_0x389b('0x1'));module['exports']={'type':{'type':Sequelize[_0x389b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x389b('0x2')]},'calleridname':{'type':Sequelize[_0x389b('0x2')]},'queue':{'type':Sequelize[_0x389b('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x389b('0x3')],'set':function(_0x5f019a){var _0x5b5676=moment(_0x5f019a);var _0x2a2b35=moment(this[_0x389b('0x4')](_0x389b('0x5')))[_0x389b('0x6')](_0x389b('0x7'));var _0xd0c065=_0x5b5676[_0x389b('0x8')](_0x2a2b35,_0x389b('0x9'));this[_0x389b('0xa')](_0x389b('0xb'),_0x5f019a);this[_0x389b('0xa')](_0x389b('0xc'),_0xd0c065||null);}},'position':{'type':Sequelize[_0x389b('0xd')]},'count':{'type':Sequelize[_0x389b('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x389b('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x389b('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x389b('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x389b('0x3')]},'queuecallerexit':{'type':Sequelize[_0x389b('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x389b('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x389b('0x2')],'comment':_0x389b('0xf')},'originalposition':{'type':Sequelize[_0x389b('0xd')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x389b('0x2')]},'connectedlinename':{'type':Sequelize[_0x389b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x389b('0x2')]},'priority':{'type':Sequelize[_0x389b('0x2')]},'holdtime':{'type':Sequelize[_0x389b('0xd')]},'mohtime':{'type':Sequelize[_0x389b('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x389b('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x389b('0x2')]},'transfer':{'type':Sequelize[_0x389b('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x389b('0x2')],'comment':_0x389b('0x10')},'transferexten':{'type':Sequelize[_0x389b('0x2')]},'transferuniqueid':{'type':Sequelize[_0x389b('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x389b('0x2')]},'thirdDisposition':{'type':Sequelize[_0x389b('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x389b('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0x389b('0x2')]}}; \ No newline at end of file +var _0x6e4b=['STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports'];(function(_0x15ac1b,_0x4a313e){var _0x158f91=function(_0x1e861e){while(--_0x1e861e){_0x15ac1b['push'](_0x15ac1b['shift']());}};_0x158f91(++_0x4a313e);}(_0x6e4b,0x195));var _0xb6e4=function(_0x5ae9fc,_0x18070c){_0x5ae9fc=_0x5ae9fc-0x0;var _0x292205=_0x6e4b[_0x5ae9fc];return _0x292205;};'use strict';var Sequelize=require(_0xb6e4('0x0'));var moment=require(_0xb6e4('0x1'));module[_0xb6e4('0x2')]={'type':{'type':Sequelize[_0xb6e4('0x3')]},'uniqueid':{'type':Sequelize[_0xb6e4('0x3')]},'calleridnum':{'type':Sequelize[_0xb6e4('0x3')]},'calleridname':{'type':Sequelize[_0xb6e4('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xb6e4('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0xff556f){var _0x351c9d=moment(_0xff556f);var _0x4027e6=moment(this[_0xb6e4('0x5')](_0xb6e4('0x6')))[_0xb6e4('0x7')](_0xb6e4('0x8'));var _0x3b45b7=_0x351c9d[_0xb6e4('0x9')](_0x4027e6,_0xb6e4('0xa'));this[_0xb6e4('0xb')]('queuecallerleaveAt',_0xff556f);this[_0xb6e4('0xb')](_0xb6e4('0xc'),_0x3b45b7||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xb6e4('0xd')]},'queuecallerabandon':{'type':Sequelize[_0xb6e4('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xb6e4('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xb6e4('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xb6e4('0x3')],'comment':_0xb6e4('0xf')},'originalposition':{'type':Sequelize[_0xb6e4('0xd')]},'channel':{'type':Sequelize[_0xb6e4('0x3')]},'connectedlinenum':{'type':Sequelize[_0xb6e4('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb6e4('0x3')]},'exten':{'type':Sequelize[_0xb6e4('0x3')]},'priority':{'type':Sequelize[_0xb6e4('0x3')]},'holdtime':{'type':Sequelize[_0xb6e4('0xd')]},'mohtime':{'type':Sequelize[_0xb6e4('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb6e4('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xb6e4('0x3')]},'transfer':{'type':Sequelize[_0xb6e4('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb6e4('0x3')],'comment':_0xb6e4('0x10')},'transferexten':{'type':Sequelize[_0xb6e4('0x3')]},'transferuniqueid':{'type':Sequelize[_0xb6e4('0x3')]},'disposition':{'type':Sequelize[_0xb6e4('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb6e4('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xb6e4('0xd')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 7652f58..a162b76 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 _0xf8d6=['json','undefined','limit','count','offset','Content-Range','apply','reject','then','destroy','sendStatus','stack','index','map','VoiceQueueReport','rawAttributes','type','key','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./voiceQueueReport.socket','register','status','end'];(function(_0x50b14a,_0x304296){var _0x2887f3=function(_0x146811){while(--_0x146811){_0x50b14a['push'](_0x50b14a['shift']());}};_0x2887f3(++_0x304296);}(_0xf8d6,0xcc));var _0x6f8d=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0xf8d6[_0x136619];return _0x38c4a5;};'use strict';var emlformat=require(_0x6f8d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6f8d('0x1'));var jsonpatch=require(_0x6f8d('0x2'));var rp=require(_0x6f8d('0x3'));var moment=require('moment');var BPromise=require(_0x6f8d('0x4'));var Mustache=require(_0x6f8d('0x5'));var util=require(_0x6f8d('0x6'));var path=require(_0x6f8d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6f8d('0x8'));var fs=require('fs');var fs_extra=require(_0x6f8d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6f8d('0xa'));var deskjs=require(_0x6f8d('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6f8d('0xc'));var Papa=require(_0x6f8d('0xd'));var Redis=require(_0x6f8d('0xe'));var authService=require(_0x6f8d('0xf'));var qs=require(_0x6f8d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f8d('0x11'));var logger=require(_0x6f8d('0x12'))(_0x6f8d('0x13'));var utils=require(_0x6f8d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6f8d('0x15'));var db=require(_0x6f8d('0x16'))['db'];config['redis']=_[_0x6f8d('0x17')](config[_0x6f8d('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x6f8d('0x19'))(new Redis(config[_0x6f8d('0x18')]));require(_0x6f8d('0x1a'))[_0x6f8d('0x1b')](socket);function respondWithStatusCode(_0x4cdfec,_0xf38585){_0xf38585=_0xf38585||0xcc;return function(_0x5d43c4){if(_0x5d43c4){return _0x4cdfec['sendStatus'](_0xf38585);}return _0x4cdfec[_0x6f8d('0x1c')](_0xf38585)[_0x6f8d('0x1d')]();};}function respondWithResult(_0x23ff7c,_0x3dfa5d){_0x3dfa5d=_0x3dfa5d||0xc8;return function(_0xfb8194){if(_0xfb8194){return _0x23ff7c[_0x6f8d('0x1c')](_0x3dfa5d)[_0x6f8d('0x1e')](_0xfb8194);}};}function respondWithFilteredResult(_0x58d430,_0x4b3f9b){return function(_0x5d2a5c){if(_0x5d2a5c){var _0x4348cb=typeof _0x4b3f9b['offset']===_0x6f8d('0x1f')&&typeof _0x4b3f9b[_0x6f8d('0x20')]===_0x6f8d('0x1f');var _0x5f3f30=_0x5d2a5c[_0x6f8d('0x21')];var _0x1fd64f=_0x4348cb?0x0:_0x4b3f9b[_0x6f8d('0x22')];var _0x2652ec=_0x4348cb?_0x5d2a5c[_0x6f8d('0x21')]:_0x4b3f9b[_0x6f8d('0x22')]+_0x4b3f9b[_0x6f8d('0x20')];var _0x3c2635;if(_0x2652ec>=_0x5f3f30){_0x2652ec=_0x5f3f30;_0x3c2635=0xc8;}else{_0x3c2635=0xce;}_0x58d430['status'](_0x3c2635);return _0x58d430['set'](_0x6f8d('0x23'),_0x1fd64f+'-'+_0x2652ec+'/'+_0x5f3f30)[_0x6f8d('0x1e')](_0x5d2a5c);}return null;};}function patchUpdates(_0x501fa2){return function(_0x509c1f){try{jsonpatch[_0x6f8d('0x24')](_0x509c1f,_0x501fa2,!![]);}catch(_0x33e336){return BPromise[_0x6f8d('0x25')](_0x33e336);}return _0x509c1f['save']();};}function saveUpdates(_0x5d45b2,_0x2da601){return function(_0x3da215){if(_0x3da215){return _0x3da215['update'](_0x5d45b2)[_0x6f8d('0x26')](function(_0x58b8b5){return _0x58b8b5;});}return null;};}function removeEntity(_0x5eb447,_0x451d02){return function(_0x4fa2ec){if(_0x4fa2ec){return _0x4fa2ec[_0x6f8d('0x27')]()[_0x6f8d('0x26')](function(){_0x5eb447[_0x6f8d('0x1c')](0xcc)[_0x6f8d('0x1d')]();});}};}function handleEntityNotFound(_0x4a0f0d,_0x5647d8){return function(_0x5a93f2){if(!_0x5a93f2){_0x4a0f0d[_0x6f8d('0x28')](0x194);}return _0x5a93f2;};}function handleError(_0x134d32,_0x15f13f){_0x15f13f=_0x15f13f||0x1f4;return function(_0x101d06){logger['error'](_0x101d06[_0x6f8d('0x29')]);if(_0x101d06['name']){delete _0x101d06['name'];}_0x134d32['status'](_0x15f13f)['send'](_0x101d06);};}exports[_0x6f8d('0x2a')]=function(_0x33ef44,_0x447df2){var _0x4a03ab={},_0x4f19ef={},_0x4a5466={'count':0x0,'rows':[]};var _0x269233=_[_0x6f8d('0x2b')](db[_0x6f8d('0x2c')][_0x6f8d('0x2d')],function(_0x3d4403){return{'name':_0x3d4403['fieldName'],'type':_0x3d4403[_0x6f8d('0x2e')][_0x6f8d('0x2f')]};});_0x4f19ef['model']=_[_0x6f8d('0x2b')](_0x269233,_0x6f8d('0x30'));_0x4f19ef[_0x6f8d('0x31')]=_[_0x6f8d('0x32')](_0x33ef44[_0x6f8d('0x31')]);_0x4f19ef['filters']=_[_0x6f8d('0x33')](_0x4f19ef[_0x6f8d('0x34')],_0x4f19ef['query']);_0x4a03ab[_0x6f8d('0x35')]=_[_0x6f8d('0x33')](_0x4f19ef['model'],qs['fields'](_0x33ef44[_0x6f8d('0x31')][_0x6f8d('0x36')]));_0x4a03ab[_0x6f8d('0x35')]=_0x4a03ab['attributes'][_0x6f8d('0x37')]?_0x4a03ab[_0x6f8d('0x35')]:_0x4f19ef[_0x6f8d('0x34')];if(!_0x33ef44[_0x6f8d('0x31')][_0x6f8d('0x38')](_0x6f8d('0x39'))){_0x4a03ab['limit']=qs[_0x6f8d('0x20')](_0x33ef44[_0x6f8d('0x31')][_0x6f8d('0x20')]);_0x4a03ab[_0x6f8d('0x22')]=qs[_0x6f8d('0x22')](_0x33ef44[_0x6f8d('0x31')][_0x6f8d('0x22')]);}_0x4a03ab[_0x6f8d('0x3a')]=qs[_0x6f8d('0x3b')](_0x33ef44[_0x6f8d('0x31')][_0x6f8d('0x3b')]);_0x4a03ab['where']=qs['filters'](_[_0x6f8d('0x3c')](_0x33ef44[_0x6f8d('0x31')],_0x4f19ef[_0x6f8d('0x3d')]),_0x269233);if(_0x33ef44[_0x6f8d('0x31')][_0x6f8d('0x3e')]){_0x4a03ab[_0x6f8d('0x3f')]=_[_0x6f8d('0x40')](_0x4a03ab[_0x6f8d('0x3f')],{'$or':_[_0x6f8d('0x2b')](_0x269233,function(_0x356058){if(_0x356058[_0x6f8d('0x2e')]!=='VIRTUAL'){var _0x5a7095={};_0x5a7095[_0x356058[_0x6f8d('0x30')]]={'$like':'%'+_0x33ef44[_0x6f8d('0x31')][_0x6f8d('0x3e')]+'%'};return _0x5a7095;}})});}_0x4a03ab=_['merge']({},_0x4a03ab,_0x33ef44['options']);var _0x536ed7={'where':_0x4a03ab[_0x6f8d('0x3f')]};return db[_0x6f8d('0x2c')][_0x6f8d('0x21')](_0x536ed7)[_0x6f8d('0x26')](function(_0x5e250f){_0x4a5466[_0x6f8d('0x21')]=_0x5e250f;if(_0x33ef44[_0x6f8d('0x31')][_0x6f8d('0x41')]){_0x4a03ab[_0x6f8d('0x42')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x6f8d('0x43')](_0x4a03ab);})[_0x6f8d('0x26')](function(_0x488001){_0x4a5466[_0x6f8d('0x44')]=_0x488001;return _0x4a5466;})[_0x6f8d('0x26')](respondWithFilteredResult(_0x447df2,_0x4a03ab))[_0x6f8d('0x45')](handleError(_0x447df2,null));};exports[_0x6f8d('0x46')]=function(_0x333cd2,_0x4227c1){var _0x4c5a6e={'raw':![],'where':{'id':_0x333cd2[_0x6f8d('0x47')]['id']}},_0x187a64={};_0x187a64['model']=_['keys'](db[_0x6f8d('0x2c')][_0x6f8d('0x2d')]);_0x187a64[_0x6f8d('0x31')]=_[_0x6f8d('0x32')](_0x333cd2[_0x6f8d('0x31')]);_0x187a64[_0x6f8d('0x3d')]=_[_0x6f8d('0x33')](_0x187a64[_0x6f8d('0x34')],_0x187a64[_0x6f8d('0x31')]);_0x4c5a6e[_0x6f8d('0x35')]=_['intersection'](_0x187a64[_0x6f8d('0x34')],qs[_0x6f8d('0x36')](_0x333cd2[_0x6f8d('0x31')][_0x6f8d('0x36')]));_0x4c5a6e[_0x6f8d('0x35')]=_0x4c5a6e[_0x6f8d('0x35')][_0x6f8d('0x37')]?_0x4c5a6e[_0x6f8d('0x35')]:_0x187a64[_0x6f8d('0x34')];if(_0x333cd2['query']['includeAll']){_0x4c5a6e[_0x6f8d('0x42')]=[{'all':!![]}];}_0x4c5a6e=_['merge']({},_0x4c5a6e,_0x333cd2[_0x6f8d('0x48')]);return db[_0x6f8d('0x2c')][_0x6f8d('0x49')](_0x4c5a6e)[_0x6f8d('0x26')](handleEntityNotFound(_0x4227c1,null))[_0x6f8d('0x26')](respondWithResult(_0x4227c1,null))['catch'](handleError(_0x4227c1,null));};exports[_0x6f8d('0x4a')]=function(_0x5c3502,_0x322da9){return db['VoiceQueueReport']['create'](_0x5c3502[_0x6f8d('0x4b')],{})[_0x6f8d('0x26')](respondWithResult(_0x322da9,0xc9))[_0x6f8d('0x45')](handleError(_0x322da9,null));};exports['update']=function(_0x2ea8ba,_0x5cdf42){if(_0x2ea8ba[_0x6f8d('0x4b')]['id']){delete _0x2ea8ba[_0x6f8d('0x4b')]['id'];}return db[_0x6f8d('0x2c')][_0x6f8d('0x49')]({'where':{'id':_0x2ea8ba[_0x6f8d('0x47')]['id']}})['then'](handleEntityNotFound(_0x5cdf42,null))[_0x6f8d('0x26')](saveUpdates(_0x2ea8ba[_0x6f8d('0x4b')],null))[_0x6f8d('0x26')](respondWithResult(_0x5cdf42,null))[_0x6f8d('0x45')](handleError(_0x5cdf42,null));};exports[_0x6f8d('0x27')]=function(_0x326d6d,_0x213004){return db[_0x6f8d('0x2c')][_0x6f8d('0x49')]({'where':{'id':_0x326d6d[_0x6f8d('0x47')]['id']}})[_0x6f8d('0x26')](handleEntityNotFound(_0x213004,null))[_0x6f8d('0x26')](removeEntity(_0x213004,null))[_0x6f8d('0x45')](handleError(_0x213004,null));};exports[_0x6f8d('0x4c')]=function(_0x474aeb,_0x525234){return db['VoiceQueueReport'][_0x6f8d('0x4c')]()[_0x6f8d('0x26')](respondWithResult(_0x525234,null))[_0x6f8d('0x45')](handleError(_0x525234,null));};exports[_0x6f8d('0x4d')]=function(_0x4b0254,_0x1a0d12){var _0x155804={},_0x4e30a3={},_0x3757e0={'count':0x0,'rows':[]};_0x4e30a3[_0x6f8d('0x34')]=_[_0x6f8d('0x32')](db[_0x6f8d('0x2c')][_0x6f8d('0x2d')]);_0x4e30a3['query']=_[_0x6f8d('0x32')](_0x4b0254['query']);_0x4e30a3[_0x6f8d('0x3d')]=_['intersection'](_0x4e30a3['model'],_0x4e30a3[_0x6f8d('0x31')]);_0x155804[_0x6f8d('0x35')]=_[_0x6f8d('0x33')](_0x4e30a3['model'],qs[_0x6f8d('0x36')](_0x4b0254[_0x6f8d('0x31')][_0x6f8d('0x36')]));_0x155804[_0x6f8d('0x35')]=_0x155804['attributes']['length']?_0x155804[_0x6f8d('0x35')]:_0x4e30a3[_0x6f8d('0x34')];if(!_0x4b0254[_0x6f8d('0x31')][_0x6f8d('0x38')](_0x6f8d('0x39'))){_0x155804[_0x6f8d('0x20')]=qs[_0x6f8d('0x20')](_0x4b0254[_0x6f8d('0x31')][_0x6f8d('0x20')]);_0x155804['offset']=qs['offset'](_0x4b0254[_0x6f8d('0x31')][_0x6f8d('0x22')]);}_0x155804[_0x6f8d('0x3a')]=qs['sort'](_0x4b0254[_0x6f8d('0x31')]['sort']);_0x155804['where']=qs[_0x6f8d('0x3d')](_[_0x6f8d('0x3c')](_0x4b0254['query'],_0x4e30a3['filters']));if(_0x4b0254['query'][_0x6f8d('0x3e')]){_0x155804[_0x6f8d('0x3f')]=_[_0x6f8d('0x40')](_0x155804[_0x6f8d('0x3f')],{'$or':_[_0x6f8d('0x2b')](_0x155804[_0x6f8d('0x35')],function(_0x882972){var _0x5ad844={};_0x5ad844[_0x882972]={'$like':'%'+_0x4b0254[_0x6f8d('0x31')][_0x6f8d('0x3e')]+'%'};return _0x5ad844;})});}_0x155804=_[_0x6f8d('0x40')]({},_0x155804,_0x4b0254[_0x6f8d('0x48')]);var _0x4cbb98={'where':_0x155804[_0x6f8d('0x3f')]};return db[_0x6f8d('0x2c')][_0x6f8d('0x21')](_0x4cbb98)[_0x6f8d('0x26')](function(_0x1c87e2){_0x3757e0[_0x6f8d('0x21')]=_0x1c87e2;if(_0x4b0254[_0x6f8d('0x31')]['includeAll']){_0x155804[_0x6f8d('0x42')]=[{'all':!![]}];}return db[_0x6f8d('0x2c')][_0x6f8d('0x43')](_0x155804);})['then'](function(_0x3d18c1){_0x3757e0[_0x6f8d('0x44')]=_0x3d18c1;return _0x3757e0;})['then'](respondWithFilteredResult(_0x1a0d12,_0x155804,_0x6f8d('0x4d')))['catch'](handleError(_0x1a0d12,null,_0x6f8d('0x4d')));}; \ No newline at end of file +var _0x13e0=['Content-Range','save','update','then','destroy','end','error','stack','name','send','index','VoiceQueueReport','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','length','options','find','catch','body','describe','getVoiceQueuesReport','hasOwnProperty','order','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x138144,_0x14a733){var _0x489bbd=function(_0x5324c1){while(--_0x5324c1){_0x138144['push'](_0x138144['shift']());}};_0x489bbd(++_0x14a733);}(_0x13e0,0x119));var _0x013e=function(_0x29b462,_0x1b741b){_0x29b462=_0x29b462-0x0;var _0x39b72f=_0x13e0[_0x29b462];return _0x39b72f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x013e('0x0'));var jsonpatch=require(_0x013e('0x1'));var rp=require(_0x013e('0x2'));var moment=require(_0x013e('0x3'));var BPromise=require(_0x013e('0x4'));var Mustache=require(_0x013e('0x5'));var util=require(_0x013e('0x6'));var path=require('path');var sox=require(_0x013e('0x7'));var csv=require(_0x013e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x013e('0x9'));var _=require(_0x013e('0xa'));var squel=require(_0x013e('0xb'));var crypto=require(_0x013e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x013e('0x8'));var querystring=require(_0x013e('0xd'));var Papa=require(_0x013e('0xe'));var Redis=require('ioredis');var authService=require(_0x013e('0xf'));var qs=require(_0x013e('0x10'));var as=require(_0x013e('0x11'));var hardwareService=require(_0x013e('0x12'));var logger=require('../../config/logger')(_0x013e('0x13'));var utils=require('../../config/utils');var config=require(_0x013e('0x14'));var licenseUtil=require(_0x013e('0x15'));var db=require(_0x013e('0x16'))['db'];config[_0x013e('0x17')]=_['defaults'](config['redis'],{'host':_0x013e('0x18'),'port':0x18eb});var socket=require(_0x013e('0x19'))(new Redis(config[_0x013e('0x17')]));require(_0x013e('0x1a'))[_0x013e('0x1b')](socket);function respondWithStatusCode(_0x50dc63,_0xb37706){_0xb37706=_0xb37706||0xcc;return function(_0x5da507){if(_0x5da507){return _0x50dc63[_0x013e('0x1c')](_0xb37706);}return _0x50dc63[_0x013e('0x1d')](_0xb37706)['end']();};}function respondWithResult(_0x5e74f0,_0x15dfef){_0x15dfef=_0x15dfef||0xc8;return function(_0x5b93f2){if(_0x5b93f2){return _0x5e74f0[_0x013e('0x1d')](_0x15dfef)[_0x013e('0x1e')](_0x5b93f2);}};}function respondWithFilteredResult(_0x32fcfc,_0x23a355){return function(_0x37ad73){if(_0x37ad73){var _0x4de73f=typeof _0x23a355[_0x013e('0x1f')]===_0x013e('0x20')&&typeof _0x23a355[_0x013e('0x21')]===_0x013e('0x20');var _0x18c4de=_0x37ad73[_0x013e('0x22')];var _0x40861c=_0x4de73f?0x0:_0x23a355['offset'];var _0x24a388=_0x4de73f?_0x37ad73[_0x013e('0x22')]:_0x23a355['offset']+_0x23a355[_0x013e('0x21')];var _0x48a677;if(_0x24a388>=_0x18c4de){_0x24a388=_0x18c4de;_0x48a677=0xc8;}else{_0x48a677=0xce;}_0x32fcfc[_0x013e('0x1d')](_0x48a677);return _0x32fcfc['set'](_0x013e('0x23'),_0x40861c+'-'+_0x24a388+'/'+_0x18c4de)[_0x013e('0x1e')](_0x37ad73);}return null;};}function patchUpdates(_0x106218){return function(_0x2f7889){try{jsonpatch['apply'](_0x2f7889,_0x106218,!![]);}catch(_0x55aba9){return BPromise['reject'](_0x55aba9);}return _0x2f7889[_0x013e('0x24')]();};}function saveUpdates(_0x4e69c2,_0x58b40d){return function(_0x4a1e32){if(_0x4a1e32){return _0x4a1e32[_0x013e('0x25')](_0x4e69c2)[_0x013e('0x26')](function(_0x7bb5da){return _0x7bb5da;});}return null;};}function removeEntity(_0x206885,_0x1689b3){return function(_0x3e89cb){if(_0x3e89cb){return _0x3e89cb[_0x013e('0x27')]()[_0x013e('0x26')](function(){_0x206885[_0x013e('0x1d')](0xcc)[_0x013e('0x28')]();});}};}function handleEntityNotFound(_0x5110ff,_0x593d22){return function(_0x590166){if(!_0x590166){_0x5110ff['sendStatus'](0x194);}return _0x590166;};}function handleError(_0xfbb811,_0x1357c3){_0x1357c3=_0x1357c3||0x1f4;return function(_0x5e869e){logger[_0x013e('0x29')](_0x5e869e[_0x013e('0x2a')]);if(_0x5e869e[_0x013e('0x2b')]){delete _0x5e869e[_0x013e('0x2b')];}_0xfbb811['status'](_0x1357c3)[_0x013e('0x2c')](_0x5e869e);};}exports[_0x013e('0x2d')]=function(_0x5cf110,_0x4a5de3){var _0x445454={},_0x37e74a={},_0x5ba59e={'count':0x0,'rows':[]};var _0x5a6903=_['map'](db[_0x013e('0x2e')][_0x013e('0x2f')],function(_0x3a1e83){return{'name':_0x3a1e83['fieldName'],'type':_0x3a1e83[_0x013e('0x30')][_0x013e('0x31')]};});_0x37e74a[_0x013e('0x32')]=_[_0x013e('0x33')](_0x5a6903,_0x013e('0x2b'));_0x37e74a['query']=_[_0x013e('0x34')](_0x5cf110[_0x013e('0x35')]);_0x37e74a[_0x013e('0x36')]=_[_0x013e('0x37')](_0x37e74a[_0x013e('0x32')],_0x37e74a[_0x013e('0x35')]);_0x445454[_0x013e('0x38')]=_[_0x013e('0x37')](_0x37e74a[_0x013e('0x32')],qs[_0x013e('0x39')](_0x5cf110[_0x013e('0x35')][_0x013e('0x39')]));_0x445454[_0x013e('0x38')]=_0x445454[_0x013e('0x38')]['length']?_0x445454['attributes']:_0x37e74a['model'];if(!_0x5cf110[_0x013e('0x35')]['hasOwnProperty'](_0x013e('0x3a'))){_0x445454['limit']=qs[_0x013e('0x21')](_0x5cf110['query'][_0x013e('0x21')]);_0x445454[_0x013e('0x1f')]=qs['offset'](_0x5cf110[_0x013e('0x35')][_0x013e('0x1f')]);}_0x445454['order']=qs[_0x013e('0x3b')](_0x5cf110[_0x013e('0x35')][_0x013e('0x3b')]);_0x445454[_0x013e('0x3c')]=qs['filters'](_['pick'](_0x5cf110['query'],_0x37e74a['filters']),_0x5a6903);if(_0x5cf110[_0x013e('0x35')]['filter']){_0x445454['where']=_[_0x013e('0x3d')](_0x445454[_0x013e('0x3c')],{'$or':_[_0x013e('0x33')](_0x5a6903,function(_0x17ebdb){if(_0x17ebdb['type']!==_0x013e('0x3e')){var _0x445d31={};_0x445d31[_0x17ebdb[_0x013e('0x2b')]]={'$like':'%'+_0x5cf110[_0x013e('0x35')][_0x013e('0x3f')]+'%'};return _0x445d31;}})});}_0x445454=_[_0x013e('0x3d')]({},_0x445454,_0x5cf110['options']);var _0x22e8dd={'where':_0x445454[_0x013e('0x3c')]};return db[_0x013e('0x2e')]['count'](_0x22e8dd)['then'](function(_0xfc0aed){_0x5ba59e[_0x013e('0x22')]=_0xfc0aed;if(_0x5cf110[_0x013e('0x35')][_0x013e('0x40')]){_0x445454[_0x013e('0x41')]=[{'all':!![]}];}return db[_0x013e('0x2e')][_0x013e('0x42')](_0x445454);})[_0x013e('0x26')](function(_0x251e03){_0x5ba59e[_0x013e('0x43')]=_0x251e03;return _0x5ba59e;})['then'](respondWithFilteredResult(_0x4a5de3,_0x445454))['catch'](handleError(_0x4a5de3,null));};exports[_0x013e('0x44')]=function(_0x5bf069,_0x310c63){var _0x55b7ed={'raw':![],'where':{'id':_0x5bf069[_0x013e('0x45')]['id']}},_0x1da086={};_0x1da086['model']=_[_0x013e('0x34')](db[_0x013e('0x2e')][_0x013e('0x2f')]);_0x1da086[_0x013e('0x35')]=_[_0x013e('0x34')](_0x5bf069['query']);_0x1da086[_0x013e('0x36')]=_[_0x013e('0x37')](_0x1da086[_0x013e('0x32')],_0x1da086[_0x013e('0x35')]);_0x55b7ed[_0x013e('0x38')]=_['intersection'](_0x1da086[_0x013e('0x32')],qs[_0x013e('0x39')](_0x5bf069[_0x013e('0x35')][_0x013e('0x39')]));_0x55b7ed[_0x013e('0x38')]=_0x55b7ed[_0x013e('0x38')][_0x013e('0x46')]?_0x55b7ed['attributes']:_0x1da086['model'];if(_0x5bf069[_0x013e('0x35')]['includeAll']){_0x55b7ed[_0x013e('0x41')]=[{'all':!![]}];}_0x55b7ed=_[_0x013e('0x3d')]({},_0x55b7ed,_0x5bf069[_0x013e('0x47')]);return db['VoiceQueueReport'][_0x013e('0x48')](_0x55b7ed)['then'](handleEntityNotFound(_0x310c63,null))['then'](respondWithResult(_0x310c63,null))[_0x013e('0x49')](handleError(_0x310c63,null));};exports['create']=function(_0x2b0385,_0x200c4a){return db[_0x013e('0x2e')]['create'](_0x2b0385['body'],{})[_0x013e('0x26')](respondWithResult(_0x200c4a,0xc9))[_0x013e('0x49')](handleError(_0x200c4a,null));};exports[_0x013e('0x25')]=function(_0x1eefdf,_0x24f4c5){if(_0x1eefdf[_0x013e('0x4a')]['id']){delete _0x1eefdf[_0x013e('0x4a')]['id'];}return db['VoiceQueueReport'][_0x013e('0x48')]({'where':{'id':_0x1eefdf['params']['id']}})[_0x013e('0x26')](handleEntityNotFound(_0x24f4c5,null))['then'](saveUpdates(_0x1eefdf[_0x013e('0x4a')],null))['then'](respondWithResult(_0x24f4c5,null))[_0x013e('0x49')](handleError(_0x24f4c5,null));};exports[_0x013e('0x27')]=function(_0x58579d,_0x23f062){return db['VoiceQueueReport'][_0x013e('0x48')]({'where':{'id':_0x58579d[_0x013e('0x45')]['id']}})['then'](handleEntityNotFound(_0x23f062,null))[_0x013e('0x26')](removeEntity(_0x23f062,null))[_0x013e('0x49')](handleError(_0x23f062,null));};exports['describe']=function(_0x2de74b,_0x2f3ab2){return db[_0x013e('0x2e')][_0x013e('0x4b')]()['then'](respondWithResult(_0x2f3ab2,null))[_0x013e('0x49')](handleError(_0x2f3ab2,null));};exports[_0x013e('0x4c')]=function(_0x3c1fe7,_0x408a7c){var _0x50cdb8={},_0xaf36dc={},_0x2d6a1b={'count':0x0,'rows':[]};_0xaf36dc[_0x013e('0x32')]=_[_0x013e('0x34')](db[_0x013e('0x2e')][_0x013e('0x2f')]);_0xaf36dc[_0x013e('0x35')]=_[_0x013e('0x34')](_0x3c1fe7[_0x013e('0x35')]);_0xaf36dc['filters']=_[_0x013e('0x37')](_0xaf36dc['model'],_0xaf36dc['query']);_0x50cdb8[_0x013e('0x38')]=_[_0x013e('0x37')](_0xaf36dc[_0x013e('0x32')],qs['fields'](_0x3c1fe7[_0x013e('0x35')][_0x013e('0x39')]));_0x50cdb8['attributes']=_0x50cdb8[_0x013e('0x38')][_0x013e('0x46')]?_0x50cdb8[_0x013e('0x38')]:_0xaf36dc['model'];if(!_0x3c1fe7[_0x013e('0x35')][_0x013e('0x4d')](_0x013e('0x3a'))){_0x50cdb8['limit']=qs[_0x013e('0x21')](_0x3c1fe7[_0x013e('0x35')][_0x013e('0x21')]);_0x50cdb8[_0x013e('0x1f')]=qs['offset'](_0x3c1fe7['query'][_0x013e('0x1f')]);}_0x50cdb8[_0x013e('0x4e')]=qs['sort'](_0x3c1fe7[_0x013e('0x35')]['sort']);_0x50cdb8['where']=qs[_0x013e('0x36')](_['pick'](_0x3c1fe7[_0x013e('0x35')],_0xaf36dc['filters']));if(_0x3c1fe7['query'][_0x013e('0x3f')]){_0x50cdb8['where']=_[_0x013e('0x3d')](_0x50cdb8['where'],{'$or':_[_0x013e('0x33')](_0x50cdb8['attributes'],function(_0x405ea7){var _0x1e9511={};_0x1e9511[_0x405ea7]={'$like':'%'+_0x3c1fe7[_0x013e('0x35')][_0x013e('0x3f')]+'%'};return _0x1e9511;})});}_0x50cdb8=_['merge']({},_0x50cdb8,_0x3c1fe7['options']);var _0x4b70d2={'where':_0x50cdb8[_0x013e('0x3c')]};return db[_0x013e('0x2e')][_0x013e('0x22')](_0x4b70d2)[_0x013e('0x26')](function(_0x112749){_0x2d6a1b[_0x013e('0x22')]=_0x112749;if(_0x3c1fe7[_0x013e('0x35')][_0x013e('0x40')]){_0x50cdb8[_0x013e('0x41')]=[{'all':!![]}];}return db[_0x013e('0x2e')][_0x013e('0x42')](_0x50cdb8);})[_0x013e('0x26')](function(_0xd916a2){_0x2d6a1b['rows']=_0xd916a2;return _0x2d6a1b;})['then'](respondWithFilteredResult(_0x408a7c,_0x50cdb8,'getVoiceQueuesReport'))[_0x013e('0x49')](handleError(_0x408a7c,null,_0x013e('0x4c')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index e5f8cda..55ed3fc 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 _0xd46a=['hasOwnProperty','exports','setMaxListeners','update','remove','emit'];(function(_0x47e7dd,_0x51b041){var _0x38501f=function(_0x5ba66d){while(--_0x5ba66d){_0x47e7dd['push'](_0x47e7dd['shift']());}};_0x38501f(++_0x51b041);}(_0xd46a,0x80));var _0xad46=function(_0xcde313,_0x2ed195){_0xcde313=_0xcde313-0x0;var _0x3effd0=_0xd46a[_0xcde313];return _0x3effd0;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xad46('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0xad46('0x1'),'afterDestroy':_0xad46('0x2')};function emitEvent(_0x14413c){return function(_0x4dafb3,_0x5b7ae8,_0xb8d4dd){VoiceQueueReportEvents[_0xad46('0x3')](_0x14413c+':'+_0x4dafb3['id'],_0x4dafb3);VoiceQueueReportEvents['emit'](_0x14413c,_0x4dafb3);_0xb8d4dd(null);};}for(var e in events){if(events[_0xad46('0x4')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xad46('0x5')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xf66e=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xf66e,0x15e));var _0xef66=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xf66e[_0x164eca];return _0x2ce562;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xef66('0x0'))['db'][_0xef66('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xef66('0x2')](0x0);var events={'afterCreate':_0xef66('0x3'),'afterUpdate':_0xef66('0x4'),'afterDestroy':_0xef66('0x5')};function emitEvent(_0x13159e){return function(_0x3a32b7,_0x53dc11,_0x27a87a){VoiceQueueReportEvents[_0xef66('0x6')](_0x13159e+':'+_0x3a32b7['id'],_0x3a32b7);VoiceQueueReportEvents[_0xef66('0x6')](_0x13159e,_0x3a32b7);_0x27a87a(null);};}for(var e in events){if(events[_0xef66('0x7')](e)){var event=events[e];VoiceQueueReport[_0xef66('0x8')](e,emitEvent(event));}}module[_0xef66('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 9263174..60bf56b 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 _0xb2a1=['calleridnum','util','api','moment','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid'];(function(_0x44fd5c,_0x4652a3){var _0x493db7=function(_0x224946){while(--_0x224946){_0x44fd5c['push'](_0x44fd5c['shift']());}};_0x493db7(++_0x4652a3);}(_0xb2a1,0x119));var _0x1b2a=function(_0x58e82f,_0xdec98a){_0x58e82f=_0x58e82f-0x0;var _0x510c7b=_0xb2a1[_0x58e82f];return _0x510c7b;};'use strict';var _=require('lodash');var util=require(_0x1b2a('0x0'));var logger=require('../../config/logger')(_0x1b2a('0x1'));var moment=require(_0x1b2a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b2a('0x3'));var attributes=require(_0x1b2a('0x4'));module[_0x1b2a('0x5')]=function(_0x59b6db,_0x3fe9f5){return _0x59b6db[_0x1b2a('0x6')](_0x1b2a('0x7'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x1b2a('0x8')]},{'fields':[_0x1b2a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe4b1=['../../config/logger','api','bluebird','path','rimraf','./voiceQueueReport.attributes','exports','VoiceQueueReport','uniqueid','calleridnum','lodash','util'];(function(_0x5e0e55,_0x5a00bf){var _0x33b682=function(_0x436d7d){while(--_0x436d7d){_0x5e0e55['push'](_0x5e0e55['shift']());}};_0x33b682(++_0x5a00bf);}(_0xe4b1,0x17e));var _0x1e4b=function(_0x578c1f,_0x5c52fc){_0x578c1f=_0x578c1f-0x0;var _0x39bef2=_0xe4b1[_0x578c1f];return _0x39bef2;};'use strict';var _=require(_0x1e4b('0x0'));var util=require(_0x1e4b('0x1'));var logger=require(_0x1e4b('0x2'))(_0x1e4b('0x3'));var moment=require('moment');var BPromise=require(_0x1e4b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e4b('0x5'));var rimraf=require(_0x1e4b('0x6'));var config=require('../../config/environment');var attributes=require(_0x1e4b('0x7'));module[_0x1e4b('0x8')]=function(_0x2f9aca,_0x55d6ca){return _0x2f9aca['define'](_0x1e4b('0x9'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x1e4b('0xa')]},{'fields':[_0x1e4b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 6e66890..c97d5b9 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 _0x4387=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','VoiceQueueReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueueReport','options','raw','where','attributes','limit','include','map','model','then','VoiceQueueReport','create','body','CreateVoiceQueueReport','update','UpdateVoiceQueueReport','lodash','util','moment','bluebird'];(function(_0x568784,_0x171a03){var _0x3c1fa5=function(_0x31e9bf){while(--_0x31e9bf){_0x568784['push'](_0x568784['shift']());}};_0x3c1fa5(++_0x171a03);}(_0x4387,0x1d2));var _0x7438=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4387[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7438('0x0'));var util=require(_0x7438('0x1'));var moment=require(_0x7438('0x2'));var BPromise=require(_0x7438('0x3'));var rs=require(_0x7438('0x4'));var fs=require('fs');var Redis=require(_0x7438('0x5'));var db=require(_0x7438('0x6'))['db'];var utils=require(_0x7438('0x7'));var logger=require(_0x7438('0x8'))(_0x7438('0x9'));var config=require(_0x7438('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7438('0xb')][_0x7438('0xc')]({'port':0x232a});config[_0x7438('0xd')]=_[_0x7438('0xe')](config[_0x7438('0xd')],{'host':_0x7438('0xf'),'port':0x18eb});var socket=require(_0x7438('0x10'))(new Redis(config[_0x7438('0xd')]));require(_0x7438('0x11'))[_0x7438('0x12')](socket);function respondWithRpcPromise(_0x1774ab,_0x33720c,_0x1937fe){return new BPromise(function(_0x4c876f,_0x12a84b){return client[_0x7438('0x13')](_0x1774ab,_0x1937fe)['then'](function(_0x2f26e5){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x33720c,_0x7438('0x14'));logger[_0x7438('0x15')](_0x7438('0x16'),_0x33720c,_0x7438('0x14'),JSON[_0x7438('0x17')](_0x2f26e5));if(_0x2f26e5['error']){if(_0x2f26e5['error'][_0x7438('0x18')]===0x1f4){logger[_0x7438('0x19')](_0x7438('0x1a'),_0x33720c,_0x2f26e5[_0x7438('0x19')]['message']);return _0x12a84b(_0x2f26e5['error'][_0x7438('0x1b')]);}logger[_0x7438('0x19')](_0x7438('0x1a'),_0x33720c,_0x2f26e5[_0x7438('0x19')][_0x7438('0x1b')]);return _0x4c876f(_0x2f26e5['error'][_0x7438('0x1b')]);}else{logger[_0x7438('0x1c')](_0x7438('0x1a'),_0x33720c,_0x7438('0x14'));_0x4c876f(_0x2f26e5[_0x7438('0x1d')][_0x7438('0x1b')]);}})[_0x7438('0x1e')](function(_0x8ec5cc){logger[_0x7438('0x19')](_0x7438('0x1a'),_0x33720c,_0x8ec5cc);_0x12a84b(_0x8ec5cc);});});}exports[_0x7438('0x1f')]=function(_0x209c33){var _0x3a0900=this;return new Promise(function(_0x249d40,_0x34393e){return db['VoiceQueueReport']['findAll']({'raw':_0x209c33[_0x7438('0x20')]?_0x209c33[_0x7438('0x20')][_0x7438('0x21')]===undefined?!![]:![]:!![],'where':_0x209c33[_0x7438('0x20')]?_0x209c33[_0x7438('0x20')][_0x7438('0x22')]||null:null,'attributes':_0x209c33['options']?_0x209c33['options'][_0x7438('0x23')]||null:null,'limit':_0x209c33[_0x7438('0x20')]?_0x209c33[_0x7438('0x20')][_0x7438('0x24')]||null:null,'include':_0x209c33[_0x7438('0x20')]?_0x209c33[_0x7438('0x20')][_0x7438('0x25')]?_[_0x7438('0x26')](_0x209c33[_0x7438('0x20')][_0x7438('0x25')],function(_0x2d87d4){return{'model':db[_0x2d87d4[_0x7438('0x27')]],'as':_0x2d87d4['as'],'attributes':_0x2d87d4[_0x7438('0x23')],'include':_0x2d87d4[_0x7438('0x25')]?_['map'](_0x2d87d4[_0x7438('0x25')],function(_0x728f45){return{'model':db[_0x728f45[_0x7438('0x27')]],'as':_0x728f45['as'],'attributes':_0x728f45[_0x7438('0x23')],'include':_0x728f45[_0x7438('0x25')]?_[_0x7438('0x26')](_0x728f45[_0x7438('0x25')],function(_0x157e25){return{'model':db[_0x157e25[_0x7438('0x27')]],'as':_0x157e25['as'],'attributes':_0x157e25[_0x7438('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7438('0x28')](function(_0x458856){logger[_0x7438('0x1c')](_0x7438('0x1f'),_0x209c33);logger[_0x7438('0x15')](_0x7438('0x1f'),_0x209c33,JSON[_0x7438('0x17')](_0x458856));_0x249d40(_0x458856);})[_0x7438('0x1e')](function(_0x4b935d){logger[_0x7438('0x19')](_0x7438('0x1f'),_0x4b935d[_0x7438('0x1b')],_0x209c33);_0x34393e(_0x3a0900[_0x7438('0x19')](0x1f4,_0x4b935d[_0x7438('0x1b')]));});});};exports['CreateVoiceQueueReport']=function(_0x3331e4){var _0x4463a1=this;return new Promise(function(_0x1f41a6,_0x134f2f){return db[_0x7438('0x29')][_0x7438('0x2a')](_0x3331e4[_0x7438('0x2b')],{'raw':_0x3331e4[_0x7438('0x20')]?_0x3331e4['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4d09b2){logger[_0x7438('0x1c')](_0x7438('0x2c'),_0x3331e4);logger['debug']('CreateVoiceQueueReport',_0x3331e4,JSON[_0x7438('0x17')](_0x4d09b2));_0x1f41a6(_0x4d09b2);})[_0x7438('0x1e')](function(_0x421103){logger[_0x7438('0x19')](_0x7438('0x2c'),_0x421103[_0x7438('0x1b')],_0x3331e4);_0x134f2f(_0x4463a1['error'](0x1f4,_0x421103[_0x7438('0x1b')]));});});};exports['UpdateVoiceQueueReport']=function(_0xf0977){var _0x338152=this;return new Promise(function(_0x22d3f8,_0xc609ea){return db[_0x7438('0x29')][_0x7438('0x2d')](_0xf0977['body'],{'raw':_0xf0977['options']?_0xf0977[_0x7438('0x20')][_0x7438('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf0977[_0x7438('0x20')]?_0xf0977[_0x7438('0x20')]['where']||null:null,'attributes':_0xf0977['options']?_0xf0977[_0x7438('0x20')]['attributes']||null:null,'limit':_0xf0977[_0x7438('0x20')]?_0xf0977['options'][_0x7438('0x24')]||null:null})['then'](function(_0x1dabe6){logger['info'](_0x7438('0x2e'),_0xf0977);logger[_0x7438('0x15')](_0x7438('0x2e'),_0xf0977,JSON[_0x7438('0x17')](_0x1dabe6));_0x22d3f8(_0x1dabe6);})['catch'](function(_0x51b9e5){logger[_0x7438('0x19')](_0x7438('0x2e'),_0x51b9e5[_0x7438('0x1b')],_0xf0977);_0xc609ea(_0x338152['error'](0x1f4,_0x51b9e5[_0x7438('0x1b')]));});});}; \ No newline at end of file +var _0xd7a6=['limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','VoiceQueueReport','findAll','options','raw','include','map','model','attributes','then','GetVoiceQueueReport','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where'];(function(_0x315d84,_0x3dacc3){var _0x560da1=function(_0x22ccb0){while(--_0x22ccb0){_0x315d84['push'](_0x315d84['shift']());}};_0x560da1(++_0x3dacc3);}(_0xd7a6,0xad));var _0x6d7a=function(_0x4a21fd,_0x557e5c){_0x4a21fd=_0x4a21fd-0x0;var _0x10afff=_0xd7a6[_0x4a21fd];return _0x10afff;};'use strict';var _=require(_0x6d7a('0x0'));var util=require(_0x6d7a('0x1'));var moment=require(_0x6d7a('0x2'));var BPromise=require(_0x6d7a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d7a('0x4'))['db'];var utils=require(_0x6d7a('0x5'));var logger=require(_0x6d7a('0x6'))(_0x6d7a('0x7'));var config=require(_0x6d7a('0x8'));var jayson=require(_0x6d7a('0x9'));var client=jayson['client'][_0x6d7a('0xa')]({'port':0x232a});config[_0x6d7a('0xb')]=_['defaults'](config[_0x6d7a('0xb')],{'host':_0x6d7a('0xc'),'port':0x18eb});var socket=require(_0x6d7a('0xd'))(new Redis(config[_0x6d7a('0xb')]));require(_0x6d7a('0xe'))['register'](socket);function respondWithRpcPromise(_0x22bab6,_0x21e21c,_0x3c5637){return new BPromise(function(_0x5ac99c,_0x1131ff){return client['request'](_0x22bab6,_0x3c5637)['then'](function(_0x2bc5f6){logger[_0x6d7a('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x21e21c,_0x6d7a('0x10'));logger[_0x6d7a('0x11')](_0x6d7a('0x12'),_0x21e21c,_0x6d7a('0x10'),JSON[_0x6d7a('0x13')](_0x2bc5f6));if(_0x2bc5f6[_0x6d7a('0x14')]){if(_0x2bc5f6[_0x6d7a('0x14')][_0x6d7a('0x15')]===0x1f4){logger[_0x6d7a('0x14')](_0x6d7a('0x16'),_0x21e21c,_0x2bc5f6['error'][_0x6d7a('0x17')]);return _0x1131ff(_0x2bc5f6[_0x6d7a('0x14')][_0x6d7a('0x17')]);}logger[_0x6d7a('0x14')](_0x6d7a('0x16'),_0x21e21c,_0x2bc5f6[_0x6d7a('0x14')][_0x6d7a('0x17')]);return _0x5ac99c(_0x2bc5f6[_0x6d7a('0x14')]['message']);}else{logger[_0x6d7a('0xf')](_0x6d7a('0x16'),_0x21e21c,_0x6d7a('0x10'));_0x5ac99c(_0x2bc5f6[_0x6d7a('0x18')][_0x6d7a('0x17')]);}})['catch'](function(_0x35ef17){logger[_0x6d7a('0x14')](_0x6d7a('0x16'),_0x21e21c,_0x35ef17);_0x1131ff(_0x35ef17);});});}exports['GetVoiceQueueReport']=function(_0x5adf18){var _0xa55478=this;return new Promise(function(_0x324489,_0x4ed191){return db[_0x6d7a('0x19')][_0x6d7a('0x1a')]({'raw':_0x5adf18[_0x6d7a('0x1b')]?_0x5adf18[_0x6d7a('0x1b')][_0x6d7a('0x1c')]===undefined?!![]:![]:!![],'where':_0x5adf18[_0x6d7a('0x1b')]?_0x5adf18['options']['where']||null:null,'attributes':_0x5adf18[_0x6d7a('0x1b')]?_0x5adf18[_0x6d7a('0x1b')]['attributes']||null:null,'limit':_0x5adf18[_0x6d7a('0x1b')]?_0x5adf18[_0x6d7a('0x1b')]['limit']||null:null,'include':_0x5adf18[_0x6d7a('0x1b')]?_0x5adf18[_0x6d7a('0x1b')][_0x6d7a('0x1d')]?_[_0x6d7a('0x1e')](_0x5adf18[_0x6d7a('0x1b')][_0x6d7a('0x1d')],function(_0x2b9860){return{'model':db[_0x2b9860[_0x6d7a('0x1f')]],'as':_0x2b9860['as'],'attributes':_0x2b9860[_0x6d7a('0x20')],'include':_0x2b9860[_0x6d7a('0x1d')]?_[_0x6d7a('0x1e')](_0x2b9860['include'],function(_0x46fa24){return{'model':db[_0x46fa24[_0x6d7a('0x1f')]],'as':_0x46fa24['as'],'attributes':_0x46fa24[_0x6d7a('0x20')],'include':_0x46fa24['include']?_[_0x6d7a('0x1e')](_0x46fa24[_0x6d7a('0x1d')],function(_0x3bb720){return{'model':db[_0x3bb720['model']],'as':_0x3bb720['as'],'attributes':_0x3bb720[_0x6d7a('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6d7a('0x21')](function(_0x16c61e){logger['info'](_0x6d7a('0x22'),_0x5adf18);logger[_0x6d7a('0x11')]('GetVoiceQueueReport',_0x5adf18,JSON[_0x6d7a('0x13')](_0x16c61e));_0x324489(_0x16c61e);})[_0x6d7a('0x23')](function(_0x260256){logger[_0x6d7a('0x14')](_0x6d7a('0x22'),_0x260256['message'],_0x5adf18);_0x4ed191(_0xa55478[_0x6d7a('0x14')](0x1f4,_0x260256['message']));});});};exports[_0x6d7a('0x24')]=function(_0x3e554a){var _0x2bfa62=this;return new Promise(function(_0x1ac8c9,_0x1aa2f3){return db[_0x6d7a('0x19')][_0x6d7a('0x25')](_0x3e554a[_0x6d7a('0x26')],{'raw':_0x3e554a[_0x6d7a('0x1b')]?_0x3e554a[_0x6d7a('0x1b')][_0x6d7a('0x1c')]===undefined?!![]:![]:!![]})[_0x6d7a('0x21')](function(_0x43a89e){logger[_0x6d7a('0xf')](_0x6d7a('0x24'),_0x3e554a);logger[_0x6d7a('0x11')](_0x6d7a('0x24'),_0x3e554a,JSON['stringify'](_0x43a89e));_0x1ac8c9(_0x43a89e);})[_0x6d7a('0x23')](function(_0xfe5a39){logger[_0x6d7a('0x14')](_0x6d7a('0x24'),_0xfe5a39[_0x6d7a('0x17')],_0x3e554a);_0x1aa2f3(_0x2bfa62['error'](0x1f4,_0xfe5a39[_0x6d7a('0x17')]));});});};exports[_0x6d7a('0x27')]=function(_0x54b6ff){var _0x8dea9a=this;return new Promise(function(_0xde7bcd,_0xea5b02){return db['VoiceQueueReport'][_0x6d7a('0x28')](_0x54b6ff[_0x6d7a('0x26')],{'raw':_0x54b6ff[_0x6d7a('0x1b')]?_0x54b6ff['options'][_0x6d7a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54b6ff[_0x6d7a('0x1b')]?_0x54b6ff['options'][_0x6d7a('0x29')]||null:null,'attributes':_0x54b6ff[_0x6d7a('0x1b')]?_0x54b6ff['options'][_0x6d7a('0x20')]||null:null,'limit':_0x54b6ff[_0x6d7a('0x1b')]?_0x54b6ff['options'][_0x6d7a('0x2a')]||null:null})['then'](function(_0x2819d0){logger[_0x6d7a('0xf')](_0x6d7a('0x27'),_0x54b6ff);logger[_0x6d7a('0x11')]('UpdateVoiceQueueReport',_0x54b6ff,JSON['stringify'](_0x2819d0));_0xde7bcd(_0x2819d0);})[_0x6d7a('0x23')](function(_0x1fcd3e){logger['error']('UpdateVoiceQueueReport',_0x1fcd3e[_0x6d7a('0x17')],_0x54b6ff);_0xea5b02(_0x8dea9a[_0x6d7a('0x14')](0x1f4,_0x1fcd3e[_0x6d7a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 9240acf..66dba2d 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 _0xfb82=['save','remove','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xfb82,0x17f));var _0x2fb8=function(_0x49d18c,_0x3ccc8c){_0x49d18c=_0x49d18c-0x0;var _0x2dba71=_0xfb82[_0x49d18c];return _0x2dba71;};'use strict';var VoiceQueueReportEvents=require(_0x2fb8('0x0'));var events=[_0x2fb8('0x1'),_0x2fb8('0x2'),'update'];function createListener(_0x316a4d,_0x1b6abc){return function(_0x50aa53){_0x1b6abc[_0x2fb8('0x3')](_0x316a4d,_0x50aa53);};}function removeListener(_0x8d8257,_0x34535f){return function(){VoiceQueueReportEvents[_0x2fb8('0x4')](_0x8d8257,_0x34535f);};}exports[_0x2fb8('0x5')]=function(_0xe9a5b5){for(var _0x3e6900=0x0,_0x8ede42=events[_0x2fb8('0x6')];_0x3e6900<_0x8ede42;_0x3e6900++){var _0x1f7575=events[_0x3e6900];var _0x5d58fa=createListener(_0x2fb8('0x7')+_0x1f7575,_0xe9a5b5);VoiceQueueReportEvents['on'](_0x1f7575,_0x5d58fa);}}; \ No newline at end of file +var _0x7b4c=['voiceQueueReport:','save','remove','emit','register'];(function(_0x155096,_0x1c63c3){var _0x266965=function(_0x6a070f){while(--_0x6a070f){_0x155096['push'](_0x155096['shift']());}};_0x266965(++_0x1c63c3);}(_0x7b4c,0x1dc));var _0xc7b4=function(_0x36071b,_0x32d0cc){_0x36071b=_0x36071b-0x0;var _0x3ae7eb=_0x7b4c[_0x36071b];return _0x3ae7eb;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xc7b4('0x0'),_0xc7b4('0x1'),'update'];function createListener(_0x41fed5,_0x1748aa){return function(_0x18f913){_0x1748aa[_0xc7b4('0x2')](_0x41fed5,_0x18f913);};}function removeListener(_0x2aecfb,_0x29799e){return function(){VoiceQueueReportEvents['removeListener'](_0x2aecfb,_0x29799e);};}exports[_0xc7b4('0x3')]=function(_0x2ba472){for(var _0x28daa6=0x0,_0x3283fd=events['length'];_0x28daa6<_0x3283fd;_0x28daa6++){var _0x22be2f=events[_0x28daa6];var _0x5b498c=createListener(_0xc7b4('0x4')+_0x22be2f,_0x2ba472);VoiceQueueReportEvents['on'](_0x22be2f,_0x5b498c);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 448011c..d6b0ed5 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 _0x48a9=['../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x48a9,0x8a));var _0x948a=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0x48a9[_0x2ef8f1];return _0x17498d;};'use strict';var multer=require('multer');var util=require(_0x948a('0x0'));var path=require(_0x948a('0x1'));var timeout=require(_0x948a('0x2'));var express=require(_0x948a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x948a('0x4'));var interaction=require(_0x948a('0x5'));var config=require(_0x948a('0x6'));var controller=require(_0x948a('0x7'));router[_0x948a('0x8')]('/',auth[_0x948a('0x9')](),controller['index']);router[_0x948a('0x8')](_0x948a('0xa'),auth['isAuthenticated'](),controller[_0x948a('0xb')]);router[_0x948a('0xc')]('/',auth[_0x948a('0x9')](),controller[_0x948a('0xd')]);router['put']('/:id',auth[_0x948a('0x9')](),controller[_0x948a('0xe')]);router[_0x948a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x948a('0x10')]);module[_0x948a('0x11')]=router; \ No newline at end of file +var _0x4bfd=['exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x509e2f,_0x40be7b){var _0x36a911=function(_0x564c0c){while(--_0x564c0c){_0x509e2f['push'](_0x509e2f['shift']());}};_0x36a911(++_0x40be7b);}(_0x4bfd,0x153));var _0xd4bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4bfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd4bf('0x0'));var util=require('util');var path=require(_0xd4bf('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd4bf('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd4bf('0x3'));var interaction=require(_0xd4bf('0x4'));var config=require('../../config/environment');var controller=require(_0xd4bf('0x5'));router[_0xd4bf('0x6')]('/',auth[_0xd4bf('0x7')](),controller[_0xd4bf('0x8')]);router[_0xd4bf('0x6')](_0xd4bf('0x9'),auth[_0xd4bf('0x7')](),controller['show']);router[_0xd4bf('0xa')]('/',auth[_0xd4bf('0x7')](),controller[_0xd4bf('0xb')]);router['put'](_0xd4bf('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd4bf('0x9'),auth[_0xd4bf('0x7')](),controller['destroy']);module[_0xd4bf('0xc')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index b48f0b4..2f3fe28 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 _0xc229=['exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment'];(function(_0x351f19,_0x444fee){var _0x3fd40e=function(_0x32a576){while(--_0x32a576){_0x351f19['push'](_0x351f19['shift']());}};_0x3fd40e(++_0x444fee);}(_0xc229,0x11d));var _0x9c22=function(_0x1ca5c4,_0x12f4b0){_0x1ca5c4=_0x1ca5c4-0x0;var _0x2524c3=_0xc229[_0x1ca5c4];return _0x2524c3;};'use strict';var Sequelize=require(_0x9c22('0x0'));var moment=require(_0x9c22('0x1'));module[_0x9c22('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x9c22('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x9c22('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x9c22('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x9c22('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x9c22('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x9c22('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x9c22('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x9c22('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x9c22('0x5')](_0x9c22('0x6'))}}; \ No newline at end of file +var _0x9d9a=['exports','STRING','DATE','sequelize','moment'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0x9d9a,0x1ca));var _0xa9d9=function(_0x161885,_0x383938){_0x161885=_0x161885-0x0;var _0x45107c=_0x9d9a[_0x161885];return _0x45107c;};'use strict';var Sequelize=require(_0xa9d9('0x0'));var moment=require(_0xa9d9('0x1'));module[_0xa9d9('0x2')]={'time':{'type':Sequelize[_0xa9d9('0x3')]},'callid':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa9d9('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa9d9('0x4')],'allowNull':![],'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index bbf6b6b..8780516 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 _0x3484=['desk.js','querystring','papaparse','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','length','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x118f08,_0x2983b8){var _0x5f0156=function(_0xc3709e){while(--_0xc3709e){_0x118f08['push'](_0x118f08['shift']());}};_0x5f0156(++_0x2983b8);}(_0x3484,0xd3));var _0x4348=function(_0x3470af,_0x24ef47){_0x3470af=_0x3470af-0x0;var _0x474378=_0x3484[_0x3470af];return _0x474378;};'use strict';var emlformat=require(_0x4348('0x0'));var rimraf=require(_0x4348('0x1'));var zipdir=require(_0x4348('0x2'));var jsonpatch=require(_0x4348('0x3'));var rp=require(_0x4348('0x4'));var moment=require(_0x4348('0x5'));var BPromise=require(_0x4348('0x6'));var Mustache=require(_0x4348('0x7'));var util=require(_0x4348('0x8'));var path=require('path');var sox=require(_0x4348('0x9'));var csv=require(_0x4348('0xa'));var ejs=require(_0x4348('0xb'));var fs=require('fs');var fs_extra=require(_0x4348('0xc'));var _=require(_0x4348('0xd'));var squel=require(_0x4348('0xe'));var crypto=require(_0x4348('0xf'));var jsforce=require(_0x4348('0x10'));var deskjs=require(_0x4348('0x11'));var toCsv=require(_0x4348('0xa'));var querystring=require(_0x4348('0x12'));var Papa=require(_0x4348('0x13'));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(_0x4348('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4348('0x15'));var config=require(_0x4348('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4348('0x17'))['db'];function respondWithStatusCode(_0x53725a,_0x12bb95){_0x12bb95=_0x12bb95||0xcc;return function(_0x11292e){if(_0x11292e){return _0x53725a[_0x4348('0x18')](_0x12bb95);}return _0x53725a[_0x4348('0x19')](_0x12bb95)[_0x4348('0x1a')]();};}function respondWithResult(_0x42cca1,_0xdf9fcf){_0xdf9fcf=_0xdf9fcf||0xc8;return function(_0x3d54aa){if(_0x3d54aa){return _0x42cca1[_0x4348('0x19')](_0xdf9fcf)[_0x4348('0x1b')](_0x3d54aa);}};}function respondWithFilteredResult(_0x331c07,_0x581730){return function(_0x27a560){if(_0x27a560){var _0x2df883=typeof _0x581730[_0x4348('0x1c')]===_0x4348('0x1d')&&typeof _0x581730[_0x4348('0x1e')]===_0x4348('0x1d');var _0x174593=_0x27a560[_0x4348('0x1f')];var _0x29e4fe=_0x2df883?0x0:_0x581730[_0x4348('0x1c')];var _0x463359=_0x2df883?_0x27a560[_0x4348('0x1f')]:_0x581730['offset']+_0x581730[_0x4348('0x1e')];var _0x558124;if(_0x463359>=_0x174593){_0x463359=_0x174593;_0x558124=0xc8;}else{_0x558124=0xce;}_0x331c07[_0x4348('0x19')](_0x558124);return _0x331c07['set'](_0x4348('0x20'),_0x29e4fe+'-'+_0x463359+'/'+_0x174593)['json'](_0x27a560);}return null;};}function patchUpdates(_0x54248b){return function(_0x1726ec){try{jsonpatch['apply'](_0x1726ec,_0x54248b,!![]);}catch(_0x222347){return BPromise[_0x4348('0x21')](_0x222347);}return _0x1726ec['save']();};}function saveUpdates(_0x2b41fd,_0x35f634){return function(_0x5bfc38){if(_0x5bfc38){return _0x5bfc38[_0x4348('0x22')](_0x2b41fd)['then'](function(_0x4d65a4){return _0x4d65a4;});}return null;};}function removeEntity(_0x1326c7,_0x41cf03){return function(_0x534c79){if(_0x534c79){return _0x534c79['destroy']()[_0x4348('0x23')](function(){_0x1326c7[_0x4348('0x19')](0xcc)[_0x4348('0x1a')]();});}};}function handleEntityNotFound(_0x1548a3,_0x22c78d){return function(_0x5e5b77){if(!_0x5e5b77){_0x1548a3[_0x4348('0x18')](0x194);}return _0x5e5b77;};}function handleError(_0x5bf968,_0x5dfa0a){_0x5dfa0a=_0x5dfa0a||0x1f4;return function(_0x2c2710){logger[_0x4348('0x24')](_0x2c2710[_0x4348('0x25')]);if(_0x2c2710[_0x4348('0x26')]){delete _0x2c2710[_0x4348('0x26')];}_0x5bf968['status'](_0x5dfa0a)[_0x4348('0x27')](_0x2c2710);};}exports[_0x4348('0x28')]=function(_0x352911,_0xede68b){var _0x16636a={},_0x48cc2b={},_0x2ea8e7={'count':0x0,'rows':[]};var _0x4b66a6=_[_0x4348('0x29')](db[_0x4348('0x2a')][_0x4348('0x2b')],function(_0x49c2e7){return{'name':_0x49c2e7[_0x4348('0x2c')],'type':_0x49c2e7[_0x4348('0x2d')][_0x4348('0x2e')]};});_0x48cc2b['model']=_[_0x4348('0x29')](_0x4b66a6,_0x4348('0x26'));_0x48cc2b['query']=_[_0x4348('0x2f')](_0x352911[_0x4348('0x30')]);_0x48cc2b['filters']=_[_0x4348('0x31')](_0x48cc2b[_0x4348('0x32')],_0x48cc2b[_0x4348('0x30')]);_0x16636a['attributes']=_[_0x4348('0x31')](_0x48cc2b[_0x4348('0x32')],qs[_0x4348('0x33')](_0x352911[_0x4348('0x30')][_0x4348('0x33')]));_0x16636a[_0x4348('0x34')]=_0x16636a[_0x4348('0x34')]['length']?_0x16636a[_0x4348('0x34')]:_0x48cc2b[_0x4348('0x32')];if(!_0x352911[_0x4348('0x30')][_0x4348('0x35')](_0x4348('0x36'))){_0x16636a[_0x4348('0x1e')]=qs[_0x4348('0x1e')](_0x352911[_0x4348('0x30')][_0x4348('0x1e')]);_0x16636a['offset']=qs[_0x4348('0x1c')](_0x352911[_0x4348('0x30')][_0x4348('0x1c')]);}_0x16636a[_0x4348('0x37')]=qs[_0x4348('0x38')](_0x352911[_0x4348('0x30')][_0x4348('0x38')]);_0x16636a['where']=qs['filters'](_[_0x4348('0x39')](_0x352911[_0x4348('0x30')],_0x48cc2b['filters']),_0x4b66a6);if(_0x352911[_0x4348('0x30')][_0x4348('0x3a')]){_0x16636a[_0x4348('0x3b')]=_[_0x4348('0x3c')](_0x16636a['where'],{'$or':_[_0x4348('0x29')](_0x4b66a6,function(_0x588270){if(_0x588270[_0x4348('0x2d')]!==_0x4348('0x3d')){var _0x4efc21={};_0x4efc21[_0x588270[_0x4348('0x26')]]={'$like':'%'+_0x352911['query']['filter']+'%'};return _0x4efc21;}})});}_0x16636a=_[_0x4348('0x3c')]({},_0x16636a,_0x352911[_0x4348('0x3e')]);var _0xa83f23={'where':_0x16636a[_0x4348('0x3b')]};return db['VoiceQueuesLog'][_0x4348('0x1f')](_0xa83f23)['then'](function(_0x1d6488){_0x2ea8e7[_0x4348('0x1f')]=_0x1d6488;if(_0x352911['query'][_0x4348('0x3f')]){_0x16636a[_0x4348('0x40')]=[{'all':!![]}];}return db[_0x4348('0x2a')][_0x4348('0x41')](_0x16636a);})[_0x4348('0x23')](function(_0x1464ee){_0x2ea8e7[_0x4348('0x42')]=_0x1464ee;return _0x2ea8e7;})[_0x4348('0x23')](respondWithFilteredResult(_0xede68b,_0x16636a))[_0x4348('0x43')](handleError(_0xede68b,null));};exports[_0x4348('0x44')]=function(_0x155cb1,_0x238fdd){var _0x2ae2c2={'raw':!![],'where':{'id':_0x155cb1[_0x4348('0x45')]['id']}},_0x2bf787={};_0x2bf787[_0x4348('0x32')]=_[_0x4348('0x2f')](db['VoiceQueuesLog']['rawAttributes']);_0x2bf787[_0x4348('0x30')]=_[_0x4348('0x2f')](_0x155cb1[_0x4348('0x30')]);_0x2bf787[_0x4348('0x46')]=_[_0x4348('0x31')](_0x2bf787[_0x4348('0x32')],_0x2bf787[_0x4348('0x30')]);_0x2ae2c2['attributes']=_[_0x4348('0x31')](_0x2bf787[_0x4348('0x32')],qs['fields'](_0x155cb1['query'][_0x4348('0x33')]));_0x2ae2c2[_0x4348('0x34')]=_0x2ae2c2[_0x4348('0x34')][_0x4348('0x47')]?_0x2ae2c2[_0x4348('0x34')]:_0x2bf787[_0x4348('0x32')];if(_0x155cb1['query'][_0x4348('0x3f')]){_0x2ae2c2[_0x4348('0x40')]=[{'all':!![]}];}_0x2ae2c2=_[_0x4348('0x3c')]({},_0x2ae2c2,_0x155cb1[_0x4348('0x3e')]);return db[_0x4348('0x2a')][_0x4348('0x48')](_0x2ae2c2)[_0x4348('0x23')](handleEntityNotFound(_0x238fdd,null))['then'](respondWithResult(_0x238fdd,null))['catch'](handleError(_0x238fdd,null));};exports[_0x4348('0x49')]=function(_0x544113,_0x1a6549){return db[_0x4348('0x2a')][_0x4348('0x49')](_0x544113[_0x4348('0x4a')],{})[_0x4348('0x23')](respondWithResult(_0x1a6549,0xc9))['catch'](handleError(_0x1a6549,null));};exports[_0x4348('0x22')]=function(_0xf64ae6,_0x48e7e9){if(_0xf64ae6[_0x4348('0x4a')]['id']){delete _0xf64ae6[_0x4348('0x4a')]['id'];}return db[_0x4348('0x2a')][_0x4348('0x48')]({'where':{'id':_0xf64ae6[_0x4348('0x45')]['id']}})['then'](handleEntityNotFound(_0x48e7e9,null))[_0x4348('0x23')](saveUpdates(_0xf64ae6[_0x4348('0x4a')],null))[_0x4348('0x23')](respondWithResult(_0x48e7e9,null))[_0x4348('0x43')](handleError(_0x48e7e9,null));};exports[_0x4348('0x4b')]=function(_0x2c7139,_0x181a4c){return db[_0x4348('0x2a')][_0x4348('0x48')]({'where':{'id':_0x2c7139[_0x4348('0x45')]['id']}})[_0x4348('0x23')](handleEntityNotFound(_0x181a4c,null))['then'](removeEntity(_0x181a4c,null))[_0x4348('0x43')](handleError(_0x181a4c,null));}; \ No newline at end of file +var _0x1371=['count','offset','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','body','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','limit'];(function(_0x164af7,_0x1109f6){var _0x56dd78=function(_0x6e4104){while(--_0x6e4104){_0x164af7['push'](_0x164af7['shift']());}};_0x56dd78(++_0x1109f6);}(_0x1371,0x79));var _0x1137=function(_0x1fcc75,_0x45ce35){_0x1fcc75=_0x1fcc75-0x0;var _0x41a818=_0x1371[_0x1fcc75];return _0x41a818;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1137('0x0'));var jsonpatch=require(_0x1137('0x1'));var rp=require(_0x1137('0x2'));var moment=require(_0x1137('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1137('0x4'));var util=require('util');var path=require(_0x1137('0x5'));var sox=require(_0x1137('0x6'));var csv=require(_0x1137('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1137('0x8'));var _=require(_0x1137('0x9'));var squel=require(_0x1137('0xa'));var crypto=require(_0x1137('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1137('0x7'));var querystring=require(_0x1137('0xc'));var Papa=require(_0x1137('0xd'));var Redis=require(_0x1137('0xe'));var authService=require(_0x1137('0xf'));var qs=require(_0x1137('0x10'));var as=require(_0x1137('0x11'));var hardwareService=require(_0x1137('0x12'));var logger=require(_0x1137('0x13'))(_0x1137('0x14'));var utils=require(_0x1137('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1137('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a19b1,_0x4b9563){_0x4b9563=_0x4b9563||0xcc;return function(_0x10eca8){if(_0x10eca8){return _0x5a19b1[_0x1137('0x17')](_0x4b9563);}return _0x5a19b1[_0x1137('0x18')](_0x4b9563)[_0x1137('0x19')]();};}function respondWithResult(_0x38cfd0,_0x44cceb){_0x44cceb=_0x44cceb||0xc8;return function(_0x875269){if(_0x875269){return _0x38cfd0[_0x1137('0x18')](_0x44cceb)['json'](_0x875269);}};}function respondWithFilteredResult(_0x236606,_0x9a2468){return function(_0x52ba8a){if(_0x52ba8a){var _0x5cf2a9=typeof _0x9a2468['offset']==='undefined'&&typeof _0x9a2468[_0x1137('0x1a')]==='undefined';var _0x122f99=_0x52ba8a[_0x1137('0x1b')];var _0x2603e3=_0x5cf2a9?0x0:_0x9a2468[_0x1137('0x1c')];var _0x4212c5=_0x5cf2a9?_0x52ba8a[_0x1137('0x1b')]:_0x9a2468[_0x1137('0x1c')]+_0x9a2468[_0x1137('0x1a')];var _0x10b503;if(_0x4212c5>=_0x122f99){_0x4212c5=_0x122f99;_0x10b503=0xc8;}else{_0x10b503=0xce;}_0x236606[_0x1137('0x18')](_0x10b503);return _0x236606['set'](_0x1137('0x1d'),_0x2603e3+'-'+_0x4212c5+'/'+_0x122f99)[_0x1137('0x1e')](_0x52ba8a);}return null;};}function patchUpdates(_0x215616){return function(_0x5902c7){try{jsonpatch[_0x1137('0x1f')](_0x5902c7,_0x215616,!![]);}catch(_0x5e2669){return BPromise[_0x1137('0x20')](_0x5e2669);}return _0x5902c7[_0x1137('0x21')]();};}function saveUpdates(_0x1d0a07,_0x1446e5){return function(_0x5d086f){if(_0x5d086f){return _0x5d086f[_0x1137('0x22')](_0x1d0a07)['then'](function(_0x15bcd3){return _0x15bcd3;});}return null;};}function removeEntity(_0x3f1867,_0x3c1aa8){return function(_0x35675c){if(_0x35675c){return _0x35675c[_0x1137('0x23')]()[_0x1137('0x24')](function(){_0x3f1867['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b0e76,_0x594b3e){return function(_0x2f25a7){if(!_0x2f25a7){_0x1b0e76['sendStatus'](0x194);}return _0x2f25a7;};}function handleError(_0x437903,_0xca67db){_0xca67db=_0xca67db||0x1f4;return function(_0x12bd20){logger[_0x1137('0x25')](_0x12bd20[_0x1137('0x26')]);if(_0x12bd20[_0x1137('0x27')]){delete _0x12bd20[_0x1137('0x27')];}_0x437903[_0x1137('0x18')](_0xca67db)[_0x1137('0x28')](_0x12bd20);};}exports[_0x1137('0x29')]=function(_0x15d7f4,_0x1b8073){var _0x59a8e4={},_0x22167f={},_0x4026d6={'count':0x0,'rows':[]};var _0x5b78bd=_[_0x1137('0x2a')](db[_0x1137('0x2b')][_0x1137('0x2c')],function(_0x265efd){return{'name':_0x265efd[_0x1137('0x2d')],'type':_0x265efd['type'][_0x1137('0x2e')]};});_0x22167f[_0x1137('0x2f')]=_[_0x1137('0x2a')](_0x5b78bd,_0x1137('0x27'));_0x22167f[_0x1137('0x30')]=_[_0x1137('0x31')](_0x15d7f4[_0x1137('0x30')]);_0x22167f[_0x1137('0x32')]=_['intersection'](_0x22167f['model'],_0x22167f[_0x1137('0x30')]);_0x59a8e4[_0x1137('0x33')]=_[_0x1137('0x34')](_0x22167f[_0x1137('0x2f')],qs[_0x1137('0x35')](_0x15d7f4['query'][_0x1137('0x35')]));_0x59a8e4[_0x1137('0x33')]=_0x59a8e4[_0x1137('0x33')]['length']?_0x59a8e4[_0x1137('0x33')]:_0x22167f[_0x1137('0x2f')];if(!_0x15d7f4[_0x1137('0x30')][_0x1137('0x36')]('nolimit')){_0x59a8e4[_0x1137('0x1a')]=qs[_0x1137('0x1a')](_0x15d7f4[_0x1137('0x30')][_0x1137('0x1a')]);_0x59a8e4[_0x1137('0x1c')]=qs[_0x1137('0x1c')](_0x15d7f4[_0x1137('0x30')][_0x1137('0x1c')]);}_0x59a8e4[_0x1137('0x37')]=qs[_0x1137('0x38')](_0x15d7f4[_0x1137('0x30')]['sort']);_0x59a8e4[_0x1137('0x39')]=qs[_0x1137('0x32')](_[_0x1137('0x3a')](_0x15d7f4[_0x1137('0x30')],_0x22167f[_0x1137('0x32')]),_0x5b78bd);if(_0x15d7f4[_0x1137('0x30')][_0x1137('0x3b')]){_0x59a8e4[_0x1137('0x39')]=_[_0x1137('0x3c')](_0x59a8e4['where'],{'$or':_[_0x1137('0x2a')](_0x5b78bd,function(_0xe823da){if(_0xe823da[_0x1137('0x3d')]!==_0x1137('0x3e')){var _0x470d13={};_0x470d13[_0xe823da[_0x1137('0x27')]]={'$like':'%'+_0x15d7f4['query'][_0x1137('0x3b')]+'%'};return _0x470d13;}})});}_0x59a8e4=_[_0x1137('0x3c')]({},_0x59a8e4,_0x15d7f4['options']);var _0x22636c={'where':_0x59a8e4[_0x1137('0x39')]};return db[_0x1137('0x2b')]['count'](_0x22636c)[_0x1137('0x24')](function(_0x2ae7ec){_0x4026d6[_0x1137('0x1b')]=_0x2ae7ec;if(_0x15d7f4[_0x1137('0x30')][_0x1137('0x3f')]){_0x59a8e4[_0x1137('0x40')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x1137('0x41')](_0x59a8e4);})['then'](function(_0x5b095f){_0x4026d6[_0x1137('0x42')]=_0x5b095f;return _0x4026d6;})[_0x1137('0x24')](respondWithFilteredResult(_0x1b8073,_0x59a8e4))[_0x1137('0x43')](handleError(_0x1b8073,null));};exports[_0x1137('0x44')]=function(_0xc7cf0e,_0x42d0dd){var _0x58b2bd={'raw':!![],'where':{'id':_0xc7cf0e[_0x1137('0x45')]['id']}},_0x208afa={};_0x208afa[_0x1137('0x2f')]=_[_0x1137('0x31')](db['VoiceQueuesLog'][_0x1137('0x2c')]);_0x208afa['query']=_[_0x1137('0x31')](_0xc7cf0e[_0x1137('0x30')]);_0x208afa[_0x1137('0x32')]=_[_0x1137('0x34')](_0x208afa[_0x1137('0x2f')],_0x208afa[_0x1137('0x30')]);_0x58b2bd[_0x1137('0x33')]=_[_0x1137('0x34')](_0x208afa['model'],qs[_0x1137('0x35')](_0xc7cf0e['query'][_0x1137('0x35')]));_0x58b2bd['attributes']=_0x58b2bd[_0x1137('0x33')][_0x1137('0x46')]?_0x58b2bd[_0x1137('0x33')]:_0x208afa[_0x1137('0x2f')];if(_0xc7cf0e['query']['includeAll']){_0x58b2bd[_0x1137('0x40')]=[{'all':!![]}];}_0x58b2bd=_[_0x1137('0x3c')]({},_0x58b2bd,_0xc7cf0e[_0x1137('0x47')]);return db[_0x1137('0x2b')][_0x1137('0x48')](_0x58b2bd)[_0x1137('0x24')](handleEntityNotFound(_0x42d0dd,null))[_0x1137('0x24')](respondWithResult(_0x42d0dd,null))['catch'](handleError(_0x42d0dd,null));};exports['create']=function(_0x2935cd,_0x4c0a82){return db['VoiceQueuesLog']['create'](_0x2935cd[_0x1137('0x49')],{})[_0x1137('0x24')](respondWithResult(_0x4c0a82,0xc9))[_0x1137('0x43')](handleError(_0x4c0a82,null));};exports[_0x1137('0x22')]=function(_0x1aeecb,_0x13512d){if(_0x1aeecb[_0x1137('0x49')]['id']){delete _0x1aeecb[_0x1137('0x49')]['id'];}return db[_0x1137('0x2b')][_0x1137('0x48')]({'where':{'id':_0x1aeecb[_0x1137('0x45')]['id']}})[_0x1137('0x24')](handleEntityNotFound(_0x13512d,null))[_0x1137('0x24')](saveUpdates(_0x1aeecb[_0x1137('0x49')],null))[_0x1137('0x24')](respondWithResult(_0x13512d,null))[_0x1137('0x43')](handleError(_0x13512d,null));};exports[_0x1137('0x23')]=function(_0x4aad32,_0x42c10a){return db[_0x1137('0x2b')]['find']({'where':{'id':_0x4aad32['params']['id']}})[_0x1137('0x24')](handleEntityNotFound(_0x42c10a,null))[_0x1137('0x24')](removeEntity(_0x42c10a,null))[_0x1137('0x43')](handleError(_0x42c10a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b76a8ea..ac14af5 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 _0x7113=['define','voice_queues_log','event_dtm','event','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7113,0xc4));var _0x3711=function(_0x326fca,_0x4b99b9){_0x326fca=_0x326fca-0x0;var _0x16be74=_0x7113[_0x326fca];return _0x16be74;};'use strict';var _=require(_0x3711('0x0'));var util=require(_0x3711('0x1'));var logger=require(_0x3711('0x2'))(_0x3711('0x3'));var moment=require(_0x3711('0x4'));var BPromise=require('bluebird');var rp=require(_0x3711('0x5'));var fs=require('fs');var path=require(_0x3711('0x6'));var rimraf=require(_0x3711('0x7'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x55972e,_0x529578){return _0x55972e[_0x3711('0x8')]('VoiceQueuesLog',attributes,{'tableName':_0x3711('0x9'),'paranoid':![],'indexes':[{'name':_0x3711('0xa'),'fields':[_0x3711('0xb'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xfcf0=['VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define'];(function(_0x4d59d7,_0x41ba47){var _0x454a5e=function(_0x52f8dc){while(--_0x52f8dc){_0x4d59d7['push'](_0x4d59d7['shift']());}};_0x454a5e(++_0x41ba47);}(_0xfcf0,0xc8));var _0x0fcf=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0xfcf0[_0x386c3e];return _0x4b8e13;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require(_0x0fcf('0x2'))(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x5'));var config=require(_0x0fcf('0x6'));var attributes=require(_0x0fcf('0x7'));module[_0x0fcf('0x8')]=function(_0x3e2d86,_0x1477f9){return _0x3e2d86[_0x0fcf('0x9')](_0x0fcf('0xa'),attributes,{'tableName':_0x0fcf('0xb'),'paranoid':![],'indexes':[{'name':_0x0fcf('0xc'),'fields':[_0x0fcf('0xd'),_0x0fcf('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 9c6138c..ecf8c92 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 _0x6bc9=['client','request','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueuesLog,\x20%s,\x20%s','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x588b18,_0x5c6b7d){var _0x315388=function(_0x2d05dd){while(--_0x2d05dd){_0x588b18['push'](_0x588b18['shift']());}};_0x315388(++_0x5c6b7d);}(_0x6bc9,0x1c2));var _0x96bc=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0x6bc9[_0x220afa];return _0x1b79d1;};'use strict';var _=require(_0x96bc('0x0'));var util=require(_0x96bc('0x1'));var moment=require('moment');var BPromise=require(_0x96bc('0x2'));var rs=require(_0x96bc('0x3'));var fs=require('fs');var Redis=require(_0x96bc('0x4'));var db=require(_0x96bc('0x5'))['db'];var utils=require(_0x96bc('0x6'));var logger=require(_0x96bc('0x7'))(_0x96bc('0x8'));var config=require(_0x96bc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x96bc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f5a48,_0x6ab158,_0x5059ec){return new BPromise(function(_0x330839,_0x3166fe){return client[_0x96bc('0xb')](_0x4f5a48,_0x5059ec)['then'](function(_0x2b27ff){logger[_0x96bc('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x6ab158,_0x96bc('0xd'));logger[_0x96bc('0xe')](_0x96bc('0xf'),_0x6ab158,_0x96bc('0xd'),JSON[_0x96bc('0x10')](_0x2b27ff));if(_0x2b27ff[_0x96bc('0x11')]){if(_0x2b27ff[_0x96bc('0x11')][_0x96bc('0x12')]===0x1f4){logger[_0x96bc('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x6ab158,_0x2b27ff[_0x96bc('0x11')]['message']);return _0x3166fe(_0x2b27ff[_0x96bc('0x11')][_0x96bc('0x13')]);}logger[_0x96bc('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x6ab158,_0x2b27ff[_0x96bc('0x11')]['message']);return _0x330839(_0x2b27ff[_0x96bc('0x11')][_0x96bc('0x13')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x6ab158,_0x96bc('0xd'));_0x330839(_0x2b27ff[_0x96bc('0x14')][_0x96bc('0x13')]);}})[_0x96bc('0x15')](function(_0x5d0b4b){logger[_0x96bc('0x11')](_0x96bc('0x16'),_0x6ab158,_0x5d0b4b);_0x3166fe(_0x5d0b4b);});});} \ No newline at end of file +var _0xc678=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x54c961,_0x85056d){var _0x112c6e=function(_0x308c82){while(--_0x308c82){_0x54c961['push'](_0x54c961['shift']());}};_0x112c6e(++_0x85056d);}(_0xc678,0x1b4));var _0x8c67=function(_0x9f80fb,_0x1e48c1){_0x9f80fb=_0x9f80fb-0x0;var _0x32002d=_0xc678[_0x9f80fb];return _0x32002d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8c67('0x0'));var BPromise=require(_0x8c67('0x1'));var rs=require(_0x8c67('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c67('0x3'))['db'];var utils=require(_0x8c67('0x4'));var logger=require(_0x8c67('0x5'))(_0x8c67('0x6'));var config=require('../../config/environment');var jayson=require(_0x8c67('0x7'));var client=jayson['client'][_0x8c67('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b4ceb,_0x4c2ffe,_0x207de1){return new BPromise(function(_0x22d7e4,_0x41ac88){return client[_0x8c67('0x9')](_0x1b4ceb,_0x207de1)[_0x8c67('0xa')](function(_0x5bac97){logger[_0x8c67('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4c2ffe,_0x8c67('0xc'));logger[_0x8c67('0xd')](_0x8c67('0xe'),_0x4c2ffe,'request\x20sent',JSON[_0x8c67('0xf')](_0x5bac97));if(_0x5bac97[_0x8c67('0x10')]){if(_0x5bac97[_0x8c67('0x10')][_0x8c67('0x11')]===0x1f4){logger['error'](_0x8c67('0x12'),_0x4c2ffe,_0x5bac97['error']['message']);return _0x41ac88(_0x5bac97['error']['message']);}logger[_0x8c67('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4c2ffe,_0x5bac97[_0x8c67('0x10')]['message']);return _0x22d7e4(_0x5bac97[_0x8c67('0x10')][_0x8c67('0x13')]);}else{logger[_0x8c67('0xb')](_0x8c67('0x12'),_0x4c2ffe,'request\x20sent');_0x22d7e4(_0x5bac97[_0x8c67('0x14')][_0x8c67('0x13')]);}})[_0x8c67('0x15')](function(_0x1bae2f){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x4c2ffe,_0x1bae2f);_0x41ac88(_0x1bae2f);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index e5ba199..19549a6 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 _0x49f5=['/:id/transcribe','downloadTranscribe','post','create','runTranscribe','update','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','/:id/downloads','downloads'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x49f5,0x157));var _0x549f=function(_0x2d1228,_0x2e5f69){_0x2d1228=_0x2d1228-0x0;var _0x460b5c=_0x49f5[_0x2d1228];return _0x460b5c;};'use strict';var multer=require(_0x549f('0x0'));var util=require(_0x549f('0x1'));var path=require(_0x549f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x549f('0x3'));var auth=require(_0x549f('0x4'));var interaction=require(_0x549f('0x5'));var config=require(_0x549f('0x6'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x549f('0x7')](),controller[_0x549f('0x8')]);router[_0x549f('0x9')](_0x549f('0xa'),auth[_0x549f('0x7')](),controller[_0x549f('0xb')]);router[_0x549f('0x9')](_0x549f('0xc'),auth[_0x549f('0x7')](),controller[_0x549f('0xd')]);router[_0x549f('0x9')](_0x549f('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x549f('0x9')](_0x549f('0xf'),controller[_0x549f('0x10')]);router[_0x549f('0x9')](_0x549f('0x11'),auth[_0x549f('0x7')](),controller[_0x549f('0x12')]);router[_0x549f('0x13')]('/',auth[_0x549f('0x7')](),controller[_0x549f('0x14')]);router['post'](_0x549f('0x11'),auth[_0x549f('0x7')](),controller[_0x549f('0x15')]);router['put'](_0x549f('0xc'),auth[_0x549f('0x7')](),controller[_0x549f('0x16')]);router['delete'](_0x549f('0xc'),auth[_0x549f('0x7')](),controller['destroy']);module[_0x549f('0x17')]=router; \ No newline at end of file +var _0x890e=['./voiceRecording.controller','get','isAuthenticated','index','describe','show','/:id/download','/:id/downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x890e,0xb4));var _0xe890=function(_0x1e1268,_0x3f7692){_0x1e1268=_0x1e1268-0x0;var _0x53c294=_0x890e[_0x1e1268];return _0x53c294;};'use strict';var multer=require(_0xe890('0x0'));var util=require(_0xe890('0x1'));var path=require(_0xe890('0x2'));var timeout=require(_0xe890('0x3'));var express=require(_0xe890('0x4'));var router=express[_0xe890('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe890('0x6'));var interaction=require(_0xe890('0x7'));var config=require(_0xe890('0x8'));var controller=require(_0xe890('0x9'));router[_0xe890('0xa')]('/',auth[_0xe890('0xb')](),controller[_0xe890('0xc')]);router[_0xe890('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xe890('0xd')]);router[_0xe890('0xa')]('/:id',auth[_0xe890('0xb')](),controller[_0xe890('0xe')]);router[_0xe890('0xa')](_0xe890('0xf'),auth[_0xe890('0xb')](),controller['download']);router[_0xe890('0xa')](_0xe890('0x10'),controller['downloads']);router['get'](_0xe890('0x11'),auth[_0xe890('0xb')](),controller[_0xe890('0x12')]);router['post']('/',auth[_0xe890('0xb')](),controller[_0xe890('0x13')]);router[_0xe890('0x14')]('/:id/transcribe',auth[_0xe890('0xb')](),controller[_0xe890('0x15')]);router[_0xe890('0x16')](_0xe890('0x17'),auth[_0xe890('0xb')](),controller[_0xe890('0x18')]);router[_0xe890('0x19')](_0xe890('0x17'),auth[_0xe890('0xb')](),controller['destroy']);module[_0xe890('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 6867e92..fadf798 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(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 4550056..af98d3c 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 _0xbd77=['transcribeAccountId','transcribeRegion','language','ValidationError','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.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','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','VoiceRecording','includeAll','findAll','catch','show','params','keys','include','create','body','find','describe','download','../../components/encryptor','uniqueid','format','%s.cypher','decryptFile','value','existsSync','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','push','secrets','recording','extname','Entity\x20not\x20found','info','isNil','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','upload','TranscribeService','startTranscriptionJob','readFileSync','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe'];(function(_0x4e1667,_0x520b84){var _0x484143=function(_0x5ceeeb){while(--_0x5ceeeb){_0x4e1667['push'](_0x4e1667['shift']());}};_0x484143(++_0x520b84);}(_0xbd77,0xb6));var _0x7bd7=function(_0xd76bb,_0x12c2e5){_0xd76bb=_0xd76bb-0x0;var _0x4fb237=_0xbd77[_0xd76bb];return _0x4fb237;};'use strict';var emlformat=require(_0x7bd7('0x0'));var rimraf=require(_0x7bd7('0x1'));var zipdir=require(_0x7bd7('0x2'));var jsonpatch=require(_0x7bd7('0x3'));var rp=require(_0x7bd7('0x4'));var moment=require(_0x7bd7('0x5'));var BPromise=require(_0x7bd7('0x6'));var Mustache=require(_0x7bd7('0x7'));var util=require(_0x7bd7('0x8'));var path=require(_0x7bd7('0x9'));var sox=require(_0x7bd7('0xa'));var csv=require(_0x7bd7('0xb'));var ejs=require(_0x7bd7('0xc'));var fs=require('fs');var fs_extra=require(_0x7bd7('0xd'));var _=require(_0x7bd7('0xe'));var squel=require(_0x7bd7('0xf'));var crypto=require(_0x7bd7('0x10'));var jsforce=require(_0x7bd7('0x11'));var deskjs=require(_0x7bd7('0x12'));var toCsv=require(_0x7bd7('0xb'));var querystring=require('querystring');var Papa=require(_0x7bd7('0x13'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require(_0x7bd7('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bd7('0x15'));var logger=require(_0x7bd7('0x16'))(_0x7bd7('0x17'));var utils=require(_0x7bd7('0x18'));var config=require(_0x7bd7('0x19'));var licenseUtil=require(_0x7bd7('0x1a'));var db=require(_0x7bd7('0x1b'))['db'];function respondWithStatusCode(_0x31fbda,_0x92a67e){_0x92a67e=_0x92a67e||0xcc;return function(_0x5c0a20){if(_0x5c0a20){return _0x31fbda[_0x7bd7('0x1c')](_0x92a67e);}return _0x31fbda[_0x7bd7('0x1d')](_0x92a67e)[_0x7bd7('0x1e')]();};}function respondWithResult(_0xc080c2,_0x2b8562){_0x2b8562=_0x2b8562||0xc8;return function(_0x5164d0){if(_0x5164d0){return _0xc080c2[_0x7bd7('0x1d')](_0x2b8562)[_0x7bd7('0x1f')](_0x5164d0);}};}function respondWithFilteredResult(_0x5dccc3,_0x191f4e){return function(_0x4d4264){if(_0x4d4264){var _0x47cab6=typeof _0x191f4e[_0x7bd7('0x20')]==='undefined'&&typeof _0x191f4e[_0x7bd7('0x21')]==='undefined';var _0x375176=_0x4d4264[_0x7bd7('0x22')];var _0x5e1a48=_0x47cab6?0x0:_0x191f4e['offset'];var _0x17a5f1=_0x47cab6?_0x4d4264[_0x7bd7('0x22')]:_0x191f4e[_0x7bd7('0x20')]+_0x191f4e[_0x7bd7('0x21')];var _0x559dc0;if(_0x17a5f1>=_0x375176){_0x17a5f1=_0x375176;_0x559dc0=0xc8;}else{_0x559dc0=0xce;}_0x5dccc3[_0x7bd7('0x1d')](_0x559dc0);return _0x5dccc3['set'](_0x7bd7('0x23'),_0x5e1a48+'-'+_0x17a5f1+'/'+_0x375176)[_0x7bd7('0x1f')](_0x4d4264);}return null;};}function patchUpdates(_0xf79764){return function(_0x26ff37){try{jsonpatch[_0x7bd7('0x24')](_0x26ff37,_0xf79764,!![]);}catch(_0x663908){return BPromise['reject'](_0x663908);}return _0x26ff37[_0x7bd7('0x25')]();};}function saveUpdates(_0x46abe3,_0x2d32fa){return function(_0x4fcb4a){if(_0x4fcb4a){return _0x4fcb4a[_0x7bd7('0x26')](_0x46abe3)[_0x7bd7('0x27')](function(_0x1bd33d){return _0x1bd33d;});}return null;};}function removeEntity(_0x3ac307,_0x4ff0c7){return function(_0x41f868){if(_0x41f868){return _0x41f868[_0x7bd7('0x28')]()[_0x7bd7('0x27')](function(){_0x3ac307[_0x7bd7('0x1d')](0xcc)[_0x7bd7('0x1e')]();});}};}function handleEntityNotFound(_0x205811,_0x12066b){return function(_0x11f5f1){if(!_0x11f5f1){_0x205811[_0x7bd7('0x1c')](0x194);}return _0x11f5f1;};}function handleError(_0x30a3c5,_0x4a14ae){_0x4a14ae=_0x4a14ae||0x1f4;return function(_0xeb4ad5){logger[_0x7bd7('0x29')](_0xeb4ad5[_0x7bd7('0x2a')]);if(_0xeb4ad5[_0x7bd7('0x2b')]){delete _0xeb4ad5[_0x7bd7('0x2b')];}_0x30a3c5[_0x7bd7('0x1d')](_0x4a14ae)[_0x7bd7('0x2c')](_0xeb4ad5);};}exports[_0x7bd7('0x2d')]=function(_0x43c40a,_0x181d5f){var _0x18fc3d={},_0x8ac469={},_0x1c0bbb={'count':0x0,'rows':[]};var _0x358c3d=_['map'](db['VoiceRecording'][_0x7bd7('0x2e')],function(_0x218129){return{'name':_0x218129[_0x7bd7('0x2f')],'type':_0x218129[_0x7bd7('0x30')]['key']};});_0x8ac469[_0x7bd7('0x31')]=_['differenceBy'](_['map'](_0x358c3d,_0x7bd7('0x2b')),['format']);_0x8ac469[_0x7bd7('0x32')]=_['keys'](_0x43c40a['query']);_0x8ac469[_0x7bd7('0x33')]=_[_0x7bd7('0x34')](_0x8ac469[_0x7bd7('0x31')],_0x8ac469[_0x7bd7('0x32')]);_0x18fc3d[_0x7bd7('0x35')]=_[_0x7bd7('0x34')](_0x8ac469['model'],qs[_0x7bd7('0x36')](_0x43c40a[_0x7bd7('0x32')][_0x7bd7('0x36')]));_0x18fc3d[_0x7bd7('0x35')]=_0x18fc3d[_0x7bd7('0x35')][_0x7bd7('0x37')]?_0x18fc3d[_0x7bd7('0x35')]:_0x8ac469[_0x7bd7('0x31')];if(!_0x43c40a['query'][_0x7bd7('0x38')](_0x7bd7('0x39'))){_0x18fc3d['limit']=qs[_0x7bd7('0x21')](_0x43c40a[_0x7bd7('0x32')][_0x7bd7('0x21')]);_0x18fc3d[_0x7bd7('0x20')]=qs[_0x7bd7('0x20')](_0x43c40a[_0x7bd7('0x32')][_0x7bd7('0x20')]);}_0x18fc3d[_0x7bd7('0x3a')]=qs[_0x7bd7('0x3b')](_0x43c40a[_0x7bd7('0x32')][_0x7bd7('0x3b')]);_0x18fc3d[_0x7bd7('0x3c')]=qs[_0x7bd7('0x33')](_['pick'](_0x43c40a[_0x7bd7('0x32')],_0x8ac469[_0x7bd7('0x33')]),_0x358c3d);if(_0x43c40a[_0x7bd7('0x32')][_0x7bd7('0x3d')]){_0x18fc3d[_0x7bd7('0x3c')]=_[_0x7bd7('0x3e')](_0x18fc3d[_0x7bd7('0x3c')],{'$or':_[_0x7bd7('0x3f')](_0x358c3d,function(_0x164fcc){if(_0x164fcc[_0x7bd7('0x30')]!==_0x7bd7('0x40')){var _0x2bfba1={};_0x2bfba1[_0x164fcc['name']]={'$like':'%'+_0x43c40a[_0x7bd7('0x32')][_0x7bd7('0x3d')]+'%'};return _0x2bfba1;}})});}_0x18fc3d=_[_0x7bd7('0x3e')]({},_0x18fc3d,_0x43c40a[_0x7bd7('0x41')]);var _0x2a06e4={'where':_0x18fc3d[_0x7bd7('0x3c')]};return db[_0x7bd7('0x42')]['count'](_0x2a06e4)[_0x7bd7('0x27')](function(_0x83a400){_0x1c0bbb[_0x7bd7('0x22')]=_0x83a400;if(_0x43c40a[_0x7bd7('0x32')][_0x7bd7('0x43')]){_0x18fc3d['include']=[{'all':!![]}];}return db[_0x7bd7('0x42')][_0x7bd7('0x44')](_0x18fc3d);})[_0x7bd7('0x27')](function(_0x418d1e){_0x1c0bbb['rows']=_0x418d1e;return _0x1c0bbb;})[_0x7bd7('0x27')](respondWithFilteredResult(_0x181d5f,_0x18fc3d))[_0x7bd7('0x45')](handleError(_0x181d5f,null));};exports[_0x7bd7('0x46')]=function(_0x34c936,_0x52510b){var _0x121418={'raw':![],'where':{'id':_0x34c936[_0x7bd7('0x47')]['id']}},_0x516da1={};_0x516da1[_0x7bd7('0x31')]=_['keys'](db[_0x7bd7('0x42')]['rawAttributes']);_0x516da1[_0x7bd7('0x32')]=_[_0x7bd7('0x48')](_0x34c936[_0x7bd7('0x32')]);_0x516da1['filters']=_[_0x7bd7('0x34')](_0x516da1[_0x7bd7('0x31')],_0x516da1['query']);_0x121418[_0x7bd7('0x35')]=_['intersection'](_0x516da1[_0x7bd7('0x31')],qs[_0x7bd7('0x36')](_0x34c936[_0x7bd7('0x32')][_0x7bd7('0x36')]));_0x121418[_0x7bd7('0x35')]=_0x121418[_0x7bd7('0x35')][_0x7bd7('0x37')]?_0x121418[_0x7bd7('0x35')]:_0x516da1[_0x7bd7('0x31')];if(_0x34c936[_0x7bd7('0x32')][_0x7bd7('0x43')]){_0x121418[_0x7bd7('0x49')]=[{'all':!![]}];}_0x121418=_['merge']({},_0x121418,_0x34c936[_0x7bd7('0x41')]);return db[_0x7bd7('0x42')]['find'](_0x121418)[_0x7bd7('0x27')](handleEntityNotFound(_0x52510b,null))[_0x7bd7('0x27')](respondWithResult(_0x52510b,null))[_0x7bd7('0x45')](handleError(_0x52510b,null));};exports[_0x7bd7('0x4a')]=function(_0x3b8cfa,_0x1fa449){return db[_0x7bd7('0x42')][_0x7bd7('0x4a')](_0x3b8cfa[_0x7bd7('0x4b')],{})['then'](respondWithResult(_0x1fa449,0xc9))['catch'](handleError(_0x1fa449,null));};exports['update']=function(_0x2c0e3e,_0x32bde6){if(_0x2c0e3e['body']['id']){delete _0x2c0e3e[_0x7bd7('0x4b')]['id'];}return db['VoiceRecording'][_0x7bd7('0x4c')]({'where':{'id':_0x2c0e3e[_0x7bd7('0x47')]['id']}})[_0x7bd7('0x27')](handleEntityNotFound(_0x32bde6,null))[_0x7bd7('0x27')](saveUpdates(_0x2c0e3e[_0x7bd7('0x4b')],null))[_0x7bd7('0x27')](respondWithResult(_0x32bde6,null))[_0x7bd7('0x45')](handleError(_0x32bde6,null));};exports[_0x7bd7('0x4d')]=function(_0x117806,_0x4c2363){return db[_0x7bd7('0x42')][_0x7bd7('0x4d')]()['then'](respondWithResult(_0x4c2363,null))[_0x7bd7('0x45')](handleError(_0x4c2363,null));};exports[_0x7bd7('0x4e')]=function(_0x1f5c96,_0x14b6b8,_0x49363a){var _0x1741ee=require(_0x7bd7('0x4f'));var _0x17ea85=![];var _0x53f6ef={};if(_0x1f5c96[_0x7bd7('0x32')][_0x7bd7('0x30')]&&_0x1f5c96[_0x7bd7('0x32')][_0x7bd7('0x30')]===_0x7bd7('0x50')){_0x53f6ef[_0x7bd7('0x50')]=_0x1f5c96['params']['id'];}else{_0x53f6ef['id']=_0x1f5c96[_0x7bd7('0x47')]['id'];}return db['VoiceRecording'][_0x7bd7('0x4c')]({'where':_0x53f6ef,'attributes':['id','value'],'raw':!![]})[_0x7bd7('0x27')](handleEntityNotFound(_0x14b6b8,null))[_0x7bd7('0x27')](function(_0x6e286f){if(_0x6e286f){var _0x2f0f45=_0x6e286f['value'];var _0x1c54f0=util[_0x7bd7('0x51')](_0x7bd7('0x52'),_0x2f0f45);if(fs['existsSync'](_0x1c54f0)){_0x17ea85=!![];return _0x1741ee[_0x7bd7('0x53')](_0x1c54f0,_0x2f0f45,config['secrets']['recording'])[_0x7bd7('0x27')](function(){return _0x6e286f;});}return _0x6e286f;}})[_0x7bd7('0x27')](function(_0x3faf52){if(_0x3faf52){var _0x3d1757=_0x3faf52[_0x7bd7('0x54')];if(!fs[_0x7bd7('0x55')](_0x3d1757)){throw new db[(_0x7bd7('0x56'))]['ValidationError'](_0x7bd7('0x57'));}if(_0x3faf52[_0x7bd7('0x58')]){return _0x14b6b8[_0x7bd7('0x4e')](_0x3d1757,_0x3faf52[_0x7bd7('0x58')]+path['extname'](_0x3d1757),function(){if(_0x17ea85){fs[_0x7bd7('0x59')](_0x3d1757);}});}else{return _0x14b6b8[_0x7bd7('0x4e')](_0x3d1757,function(_0x50abcb){if(_0x17ea85){fs['unlink'](_0x3d1757);}});}}})['catch'](function(_0x1a81e2){if(_0x1a81e2[_0x7bd7('0x5a')]===_0x7bd7('0x57')){_0x14b6b8['status'](0x194)[_0x7bd7('0x2c')](_0x7bd7('0x5b'));}else{return handleError(_0x14b6b8,null);}});};exports[_0x7bd7('0x5c')]=function(_0x2a30c2,_0x554d03,_0x43f8ba){var _0x214fdb=require(_0x7bd7('0x4f'));var _0x3256f6=![];var _0xb00de1={'$and':[db[_0x7bd7('0x5d')][_0x7bd7('0x3c')](db[_0x7bd7('0x5d')]['fn'](_0x7bd7('0x5e'),db[_0x7bd7('0x5d')][_0x7bd7('0x5f')](_0x7bd7('0x50'))),_0x2a30c2[_0x7bd7('0x32')][_0x7bd7('0x60')])]};if(_0x2a30c2[_0x7bd7('0x32')][_0x7bd7('0x30')]&&_0x2a30c2[_0x7bd7('0x32')][_0x7bd7('0x30')]===_0x7bd7('0x50')){_0xb00de1['$and'][_0x7bd7('0x61')]({'uniqueid':_0x2a30c2[_0x7bd7('0x47')]['id']});}else{_0xb00de1['$and'][_0x7bd7('0x61')]({'id':_0x2a30c2['params']['id']});}return db[_0x7bd7('0x42')][_0x7bd7('0x4c')]({'where':_0xb00de1,'attributes':['id',_0x7bd7('0x54')],'raw':!![]})[_0x7bd7('0x27')](handleEntityNotFound(_0x554d03,null))['then'](function(_0x3f2bff){if(_0x3f2bff){var _0x381595=util['format'](_0x7bd7('0x52'),_0x3f2bff[_0x7bd7('0x54')]);if(fs[_0x7bd7('0x55')](_0x381595)){_0x3256f6=!![];return _0x214fdb['decryptFile'](_0x381595,_0x3f2bff[_0x7bd7('0x54')],config[_0x7bd7('0x62')][_0x7bd7('0x63')])['then'](function(){return _0x3f2bff;});}return _0x3f2bff;}})['then'](function(_0xec091c){if(_0xec091c){if(!fs[_0x7bd7('0x55')](_0xec091c[_0x7bd7('0x54')])){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0xec091c[_0x7bd7('0x58')]){return _0x554d03[_0x7bd7('0x4e')](_0xec091c[_0x7bd7('0x54')],_0xec091c[_0x7bd7('0x58')]+path[_0x7bd7('0x64')](_0xec091c[_0x7bd7('0x54')]),function(){if(_0x3256f6){fs[_0x7bd7('0x59')](_0xec091c[_0x7bd7('0x54')]);}});}else{return _0x554d03[_0x7bd7('0x4e')](_0xec091c[_0x7bd7('0x54')],function(_0x597f23){if(_0x3256f6){fs['unlink'](_0xec091c[_0x7bd7('0x54')]);}});}}})[_0x7bd7('0x45')](handleError(_0x554d03,null));};exports[_0x7bd7('0x28')]=function(_0x4e8273,_0x3eab9d){return db['VoiceRecording']['find']({'where':{'id':_0x4e8273[_0x7bd7('0x47')]['id']}})[_0x7bd7('0x27')](function(_0x2ca453){if(_['isNil'](_0x2ca453)){throw new ReferenceError(_0x7bd7('0x65'));}return _0x2ca453;})[_0x7bd7('0x27')](function(_0x43379e){var _0x42b5f5=_0x43379e['value'];logger[_0x7bd7('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0x42b5f5);if(!_[_0x7bd7('0x67')](_0x43379e['value'])&&fs[_0x7bd7('0x55')](_0x42b5f5)){logger['info'](_0x7bd7('0x68')+_0x42b5f5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x42b5f5);}_0x42b5f5=_0x42b5f5+_0x7bd7('0x69');if(!_[_0x7bd7('0x67')](_0x43379e['value'])&&fs['existsSync'](_0x42b5f5)){logger[_0x7bd7('0x66')](_0x7bd7('0x68')+_0x42b5f5+_0x7bd7('0x6a'));fs[_0x7bd7('0x6b')](_0x42b5f5);}return _0x43379e;})[_0x7bd7('0x27')](function(_0x1faaf){if(!_0x1faaf)throw new InternalError();return _0x1faaf[_0x7bd7('0x28')]();})[_0x7bd7('0x27')](function(){_0x3eab9d[_0x7bd7('0x1d')](0xcc)[_0x7bd7('0x1e')]();})[_0x7bd7('0x45')](handleError(_0x3eab9d,null));};function getBucketslist(_0x16f27e,_0x4eeabe,_0x42abd5){return new Promise(function(_0x37190e,_0x545b96){var _0x52ce55=new AWS['S3']({'accessKeyId':_0x4eeabe,'secretAccessKey':_0x16f27e,'region':_0x42abd5});_0x52ce55[_0x7bd7('0x6c')]({},function(_0xbed94b,_0x579860){if(_0xbed94b){return _0x545b96(_0xbed94b);}else{return _0x37190e(_0x579860);}});});}function createBucket(_0x163e82,_0x3ab306,_0xb1d8d7,_0xa19c7d){return new Promise(function(_0x443f6b,_0x171df5){var _0x1c167f=new AWS['S3']({'accessKeyId':_0x3ab306,'secretAccessKey':_0x163e82,'region':_0xb1d8d7});_0x1c167f['createBucket']({'Bucket':_0xa19c7d},function(_0x5a13db,_0x2f8e32){if(_0x5a13db){return _0x171df5(_0x5a13db);}else{return _0x443f6b(_0x2f8e32);}});});}function uploadFile(_0xbd357a,_0x327a2d,_0x245050,_0x385e36,_0x3850d2,_0x2d9a5f){return new Promise(function(_0x173a86,_0x167541){var _0x241aa1=new AWS['S3']({'accessKeyId':_0x327a2d,'secretAccessKey':_0xbd357a,'region':_0x245050});_0x241aa1[_0x7bd7('0x6d')]({'Bucket':_0x385e36,'Key':_0x3850d2,'Body':_0x2d9a5f},function(_0x343f10,_0x3880b3){if(_0x343f10){return _0x167541(_0x343f10);}else{return _0x173a86(_0x3880b3);}});});}function startTranscribe(_0x4aa9f6,_0x31377f,_0x8796a7,_0x42ee7e,_0x4ac5dd,_0x4f48f3){return new Promise(function(_0x90ef91,_0x3c40be){var _0x41d068=new AWS[(_0x7bd7('0x6e'))]({'accessKeyId':_0x31377f,'secretAccessKey':_0x4aa9f6,'region':_0x8796a7});_0x41d068[_0x7bd7('0x6f')]({'TranscriptionJobName':_0x42ee7e,'LanguageCode':_0x4ac5dd,'Media':{'MediaFileUri':_0x4f48f3}},function(_0x27ed94,_0x36c3c9){if(_0x27ed94){return _0x3c40be(_0x27ed94);}else{return _0x90ef91(_0x36c3c9);}});});}function transcribe(_0x3d2c08,_0x4e3a3f,_0x1e118d,_0x5c804d,_0x2bcf57,_0x3f2e6f,_0x198bc8){return new Promise(function(_0x2347ca,_0x26b4b5){var _0x9c2925={};logger[_0x7bd7('0x66')](util[_0x7bd7('0x51')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x3d2c08,_0x2bcf57));return uploadFile(_0x4e3a3f,_0x1e118d,_0x5c804d,_0x2bcf57,path['basename'](_0x3f2e6f),fs[_0x7bd7('0x70')](_0x3f2e6f))[_0x7bd7('0x27')](function(_0x240494){logger['info'](util[_0x7bd7('0x51')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x3d2c08,_0x2bcf57,_0x240494[_0x7bd7('0x71')]));_0x9c2925[_0x7bd7('0x72')]=_0x240494[_0x7bd7('0x73')];_0x9c2925['location']=_0x240494[_0x7bd7('0x71')];logger[_0x7bd7('0x66')](util['format'](_0x7bd7('0x74'),_0x3d2c08));return startTranscribe(_0x4e3a3f,_0x1e118d,_0x5c804d,uuidv4(),_0x198bc8,_0x240494[_0x7bd7('0x71')]);})[_0x7bd7('0x27')](function(_0x1e157b){logger[_0x7bd7('0x66')](util['format'](_0x7bd7('0x75'),_0x3d2c08,_0x1e157b[_0x7bd7('0x76')][_0x7bd7('0x77')]));_0x9c2925[_0x7bd7('0x78')]=_0x1e157b['TranscriptionJob']['TranscriptionJobName'];_0x9c2925[_0x7bd7('0x79')]=_0x1e157b[_0x7bd7('0x76')]['TranscriptionJobStatus'];return _0x2347ca(_0x9c2925);})[_0x7bd7('0x45')](function(_0x33ce9b){return _0x26b4b5(_0x33ce9b);});});}exports['runTranscribe']=function(_0x38ef87,_0x3d26ed,_0x4db6e9){var _0x257e96;var _0x2cbd3e;var _0x47c7a7;var _0x249718=require(_0x7bd7('0x4f'));return db[_0x7bd7('0x42')][_0x7bd7('0x7a')]({'where':{'id':_0x38ef87[_0x7bd7('0x47')]['id']}})['then'](function(_0xb28a07){if(_0xb28a07){var _0x2b1ab6=util[_0x7bd7('0x51')](_0x7bd7('0x52'),_0xb28a07[_0x7bd7('0x54')]);if(fs[_0x7bd7('0x55')](_0x2b1ab6)){cypher=!![];return _0x249718[_0x7bd7('0x53')](_0x2b1ab6,_0xb28a07[_0x7bd7('0x54')],config['secrets']['recording'])['then'](function(){return _0xb28a07;});}return _0xb28a07;}})['then'](function(_0xc1a881){if(!_0xc1a881){throw new db[(_0x7bd7('0x56'))]['ValidationError'](_0x7bd7('0x7b'));}_0x2cbd3e=_0xc1a881;return db[_0x7bd7('0x7c')]['findOne']({'where':{'id':0x1}});})[_0x7bd7('0x27')](handleEntityNotFound(_0x3d26ed,null))[_0x7bd7('0x27')](function(_0x5d080c){if(_0x5d080c){_0x257e96=_0x5d080c;if(!_0x257e96[_0x7bd7('0x7d')]||!_0x257e96[_0x7bd7('0x7e')]||!_0x257e96[_0x7bd7('0x7f')]||!_0x257e96[_0x7bd7('0x80')]||!_0x257e96[_0x7bd7('0x72')]){throw new db['Sequelize'][(_0x7bd7('0x81'))](_0x7bd7('0x82'));}if(_0x38ef87[_0x7bd7('0x4b')][_0x7bd7('0x83')]&&(!_0x257e96[_0x7bd7('0x84')]||!_0x257e96[_0x7bd7('0x85')]||!_0x257e96[_0x7bd7('0x86')]||!_0x257e96[_0x7bd7('0x80')]||!_0x257e96[_0x7bd7('0x72')])){throw new db['Sequelize'][(_0x7bd7('0x81'))](_0x7bd7('0x87'));}return db[_0x7bd7('0x88')]['findOne']({'where':{'id':_0x257e96['transcribeAccountId']}});}})[_0x7bd7('0x27')](function(_0x28657d){if(!_0x28657d){throw new db['Sequelize'][(_0x7bd7('0x81'))](_0x7bd7('0x89'));}if(!_0x28657d['data1']||!_0x28657d[_0x7bd7('0x8a')]){throw new db[(_0x7bd7('0x56'))]['ValidationError'](_0x7bd7('0x8b'));}_0x47c7a7=_0x28657d;return getBucketslist(_0x47c7a7[_0x7bd7('0x8c')],_0x47c7a7[_0x7bd7('0x8a')],_0x257e96[_0x7bd7('0x7f')]);})[_0x7bd7('0x27')](function(_0x408787){if(_0x408787&&_0x408787[_0x7bd7('0x8d')]){var _0x227c1b=_[_0x7bd7('0x4c')](_0x408787[_0x7bd7('0x8d')],function(_0x55b28e){return _0x55b28e[_0x7bd7('0x8e')]===_0x257e96['bucket'];});if(!_0x227c1b){logger[_0x7bd7('0x66')](util[_0x7bd7('0x51')](_0x7bd7('0x8f'),_0x38ef87['params']['id'],_0x257e96[_0x7bd7('0x72')]));return createBucket(_0x47c7a7[_0x7bd7('0x8c')],_0x47c7a7['data2'],_0x257e96[_0x7bd7('0x7f')],_0x257e96[_0x7bd7('0x72')]);}logger['info'](util[_0x7bd7('0x51')](_0x7bd7('0x90'),_0x38ef87['params']['id'],_0x257e96[_0x7bd7('0x72')]));return;}})[_0x7bd7('0x27')](function(_0x3c2d85){if(_0x2cbd3e[_0x7bd7('0x79')]===_0x7bd7('0x91')){return transcribe(_0x38ef87[_0x7bd7('0x47')]['id'],_0x47c7a7[_0x7bd7('0x8c')],_0x47c7a7['data2'],_0x257e96[_0x7bd7('0x7f')],_0x257e96[_0x7bd7('0x72')],_0x2cbd3e['value'],_0x257e96[_0x7bd7('0x80')]);}else{logger[_0x7bd7('0x66')](util['format'](_0x7bd7('0x92'),_0x38ef87['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x7bd7('0x27')](function(_0x51d2f1){if(_0x51d2f1){_0x51d2f1[_0x7bd7('0x93')]=_0x38ef87[_0x7bd7('0x4b')]['runSentiment'];return _0x2cbd3e['updateAttributes'](_0x51d2f1);}})[_0x7bd7('0x27')](respondWithResult(_0x3d26ed,null))[_0x7bd7('0x45')](handleError(_0x3d26ed,null));};function writeFile(_0x2598b3,_0x2f97ee){return new Promise(function(_0x1eb1dc,_0x511fa6){fs[_0x7bd7('0x94')](_0x2f97ee,_0x2598b3,function(_0x2082de,_0x506d8e){if(_0x2082de){return _0x511fa6(_0x2082de);}else{return _0x1eb1dc(_0x506d8e);}});});}exports[_0x7bd7('0x95')]=function(_0x54cf98,_0x3a0cd8,_0x2efb7c){return db['VoiceRecording']['findOne']({'where':{'id':_0x54cf98[_0x7bd7('0x47')]['id']}})[_0x7bd7('0x27')](handleEntityNotFound(_0x3a0cd8))['then'](function(_0x224c35){if(_0x224c35&&_0x224c35[_0x7bd7('0x96')]){var _0x459b2c=_0x224c35[_0x7bd7('0x96')];var _0x4df010=config['root']+_0x7bd7('0x97')+_0x224c35['id']+_0x7bd7('0x98');if(fs[_0x7bd7('0x55')](_0x4df010)){return _0x4df010;}return writeFile(_0x459b2c,_0x4df010)[_0x7bd7('0x27')](function(){return _0x4df010;});}else{throw new db[(_0x7bd7('0x56'))]['ValidationError'](_0x7bd7('0x99'));}})[_0x7bd7('0x27')](function(_0x5c0e08){return _0x3a0cd8[_0x7bd7('0x4e')](_0x5c0e08);})['catch'](handleError(_0x3a0cd8));}; \ No newline at end of file +var _0x8c12=['aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','map','VoiceRecording','rawAttributes','type','model','differenceBy','name','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','describe','download','uniqueid','value','existsSync','secrets','recording','ValidationError','filename','extname','unlink','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','token','$and','push','%s.cypher','decryptFile','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','File:\x20\x22','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','Sequelize','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','request-promise','moment','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x35b07e,_0x4c5a33){var _0xcb745e=function(_0x30468b){while(--_0x30468b){_0x35b07e['push'](_0x35b07e['shift']());}};_0xcb745e(++_0x4c5a33);}(_0x8c12,0x82));var _0x28c1=function(_0x5a33ee,_0x126a2b){_0x5a33ee=_0x5a33ee-0x0;var _0xe51e3a=_0x8c12[_0x5a33ee];return _0xe51e3a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28c1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x28c1('0x1'));var moment=require(_0x28c1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x28c1('0x3'));var util=require('util');var path=require(_0x28c1('0x4'));var sox=require(_0x28c1('0x5'));var csv=require(_0x28c1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x28c1('0x7'));var crypto=require(_0x28c1('0x8'));var jsforce=require(_0x28c1('0x9'));var deskjs=require(_0x28c1('0xa'));var toCsv=require(_0x28c1('0x6'));var querystring=require(_0x28c1('0xb'));var Papa=require(_0x28c1('0xc'));var AWS=require(_0x28c1('0xd'));var uuidv4=require(_0x28c1('0xe'));var Redis=require(_0x28c1('0xf'));var authService=require(_0x28c1('0x10'));var qs=require(_0x28c1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28c1('0x12'));var logger=require(_0x28c1('0x13'))('api');var utils=require(_0x28c1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x28c1('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x82747,_0x2b3368){_0x2b3368=_0x2b3368||0xcc;return function(_0x45fdd2){if(_0x45fdd2){return _0x82747[_0x28c1('0x16')](_0x2b3368);}return _0x82747[_0x28c1('0x17')](_0x2b3368)[_0x28c1('0x18')]();};}function respondWithResult(_0x464f24,_0x184252){_0x184252=_0x184252||0xc8;return function(_0x3654fe){if(_0x3654fe){return _0x464f24[_0x28c1('0x17')](_0x184252)[_0x28c1('0x19')](_0x3654fe);}};}function respondWithFilteredResult(_0x5db1fc,_0x39b345){return function(_0x4b20c2){if(_0x4b20c2){var _0x3f6b01=typeof _0x39b345['offset']==='undefined'&&typeof _0x39b345[_0x28c1('0x1a')]===_0x28c1('0x1b');var _0xfb9a75=_0x4b20c2[_0x28c1('0x1c')];var _0xe0e763=_0x3f6b01?0x0:_0x39b345[_0x28c1('0x1d')];var _0x57e770=_0x3f6b01?_0x4b20c2[_0x28c1('0x1c')]:_0x39b345[_0x28c1('0x1d')]+_0x39b345['limit'];var _0x22a62f;if(_0x57e770>=_0xfb9a75){_0x57e770=_0xfb9a75;_0x22a62f=0xc8;}else{_0x22a62f=0xce;}_0x5db1fc[_0x28c1('0x17')](_0x22a62f);return _0x5db1fc['set'](_0x28c1('0x1e'),_0xe0e763+'-'+_0x57e770+'/'+_0xfb9a75)[_0x28c1('0x19')](_0x4b20c2);}return null;};}function patchUpdates(_0x18973a){return function(_0x32cd5b){try{jsonpatch[_0x28c1('0x1f')](_0x32cd5b,_0x18973a,!![]);}catch(_0x313d15){return BPromise[_0x28c1('0x20')](_0x313d15);}return _0x32cd5b[_0x28c1('0x21')]();};}function saveUpdates(_0x2f2532,_0x9381a6){return function(_0xdb7d5b){if(_0xdb7d5b){return _0xdb7d5b[_0x28c1('0x22')](_0x2f2532)[_0x28c1('0x23')](function(_0x61bb81){return _0x61bb81;});}return null;};}function removeEntity(_0x420ceb,_0x1e5772){return function(_0x3935ec){if(_0x3935ec){return _0x3935ec[_0x28c1('0x24')]()[_0x28c1('0x23')](function(){_0x420ceb[_0x28c1('0x17')](0xcc)[_0x28c1('0x18')]();});}};}function handleEntityNotFound(_0x318de6,_0x4b0560){return function(_0x576ee3){if(!_0x576ee3){_0x318de6['sendStatus'](0x194);}return _0x576ee3;};}function handleError(_0x4bb3b3,_0x214044){_0x214044=_0x214044||0x1f4;return function(_0x259e86){logger['error'](_0x259e86[_0x28c1('0x25')]);if(_0x259e86['name']){delete _0x259e86['name'];}_0x4bb3b3[_0x28c1('0x17')](_0x214044)['send'](_0x259e86);};}exports['index']=function(_0x27e707,_0x6b3fdd){var _0x1553fd={},_0x1dec3b={},_0x15ca82={'count':0x0,'rows':[]};var _0x2c3fc5=_[_0x28c1('0x26')](db[_0x28c1('0x27')][_0x28c1('0x28')],function(_0x5834ed){return{'name':_0x5834ed['fieldName'],'type':_0x5834ed[_0x28c1('0x29')]['key']};});_0x1dec3b[_0x28c1('0x2a')]=_[_0x28c1('0x2b')](_[_0x28c1('0x26')](_0x2c3fc5,_0x28c1('0x2c')),[_0x28c1('0x2d')]);_0x1dec3b[_0x28c1('0x2e')]=_[_0x28c1('0x2f')](_0x27e707[_0x28c1('0x2e')]);_0x1dec3b[_0x28c1('0x30')]=_[_0x28c1('0x31')](_0x1dec3b[_0x28c1('0x2a')],_0x1dec3b[_0x28c1('0x2e')]);_0x1553fd[_0x28c1('0x32')]=_['intersection'](_0x1dec3b[_0x28c1('0x2a')],qs[_0x28c1('0x33')](_0x27e707['query'][_0x28c1('0x33')]));_0x1553fd[_0x28c1('0x32')]=_0x1553fd[_0x28c1('0x32')][_0x28c1('0x34')]?_0x1553fd['attributes']:_0x1dec3b[_0x28c1('0x2a')];if(!_0x27e707['query'][_0x28c1('0x35')]('nolimit')){_0x1553fd[_0x28c1('0x1a')]=qs[_0x28c1('0x1a')](_0x27e707[_0x28c1('0x2e')][_0x28c1('0x1a')]);_0x1553fd[_0x28c1('0x1d')]=qs[_0x28c1('0x1d')](_0x27e707[_0x28c1('0x2e')]['offset']);}_0x1553fd[_0x28c1('0x36')]=qs[_0x28c1('0x37')](_0x27e707[_0x28c1('0x2e')][_0x28c1('0x37')]);_0x1553fd[_0x28c1('0x38')]=qs[_0x28c1('0x30')](_[_0x28c1('0x39')](_0x27e707['query'],_0x1dec3b[_0x28c1('0x30')]),_0x2c3fc5);if(_0x27e707[_0x28c1('0x2e')][_0x28c1('0x3a')]){_0x1553fd[_0x28c1('0x38')]=_['merge'](_0x1553fd['where'],{'$or':_['map'](_0x2c3fc5,function(_0x58b523){if(_0x58b523[_0x28c1('0x29')]!==_0x28c1('0x3b')){var _0x2d87c8={};_0x2d87c8[_0x58b523[_0x28c1('0x2c')]]={'$like':'%'+_0x27e707[_0x28c1('0x2e')][_0x28c1('0x3a')]+'%'};return _0x2d87c8;}})});}_0x1553fd=_['merge']({},_0x1553fd,_0x27e707[_0x28c1('0x3c')]);var _0x498c5d={'where':_0x1553fd[_0x28c1('0x38')]};return db[_0x28c1('0x27')][_0x28c1('0x1c')](_0x498c5d)[_0x28c1('0x23')](function(_0x2e0b96){_0x15ca82[_0x28c1('0x1c')]=_0x2e0b96;if(_0x27e707['query'][_0x28c1('0x3d')]){_0x1553fd[_0x28c1('0x3e')]=[{'all':!![]}];}return db[_0x28c1('0x27')][_0x28c1('0x3f')](_0x1553fd);})[_0x28c1('0x23')](function(_0x552d82){_0x15ca82[_0x28c1('0x40')]=_0x552d82;return _0x15ca82;})[_0x28c1('0x23')](respondWithFilteredResult(_0x6b3fdd,_0x1553fd))[_0x28c1('0x41')](handleError(_0x6b3fdd,null));};exports[_0x28c1('0x42')]=function(_0xc8cb1e,_0x3f345f){var _0x563762={'raw':![],'where':{'id':_0xc8cb1e[_0x28c1('0x43')]['id']}},_0x57a862={};_0x57a862[_0x28c1('0x2a')]=_[_0x28c1('0x2f')](db['VoiceRecording'][_0x28c1('0x28')]);_0x57a862[_0x28c1('0x2e')]=_[_0x28c1('0x2f')](_0xc8cb1e[_0x28c1('0x2e')]);_0x57a862[_0x28c1('0x30')]=_['intersection'](_0x57a862[_0x28c1('0x2a')],_0x57a862[_0x28c1('0x2e')]);_0x563762['attributes']=_[_0x28c1('0x31')](_0x57a862['model'],qs[_0x28c1('0x33')](_0xc8cb1e[_0x28c1('0x2e')][_0x28c1('0x33')]));_0x563762['attributes']=_0x563762[_0x28c1('0x32')][_0x28c1('0x34')]?_0x563762[_0x28c1('0x32')]:_0x57a862[_0x28c1('0x2a')];if(_0xc8cb1e[_0x28c1('0x2e')]['includeAll']){_0x563762[_0x28c1('0x3e')]=[{'all':!![]}];}_0x563762=_[_0x28c1('0x44')]({},_0x563762,_0xc8cb1e[_0x28c1('0x3c')]);return db['VoiceRecording']['find'](_0x563762)['then'](handleEntityNotFound(_0x3f345f,null))[_0x28c1('0x23')](respondWithResult(_0x3f345f,null))[_0x28c1('0x41')](handleError(_0x3f345f,null));};exports[_0x28c1('0x45')]=function(_0x4cd610,_0xfd1602){return db[_0x28c1('0x27')][_0x28c1('0x45')](_0x4cd610[_0x28c1('0x46')],{})[_0x28c1('0x23')](respondWithResult(_0xfd1602,0xc9))[_0x28c1('0x41')](handleError(_0xfd1602,null));};exports['update']=function(_0x1c94e0,_0x3a7f69){if(_0x1c94e0[_0x28c1('0x46')]['id']){delete _0x1c94e0[_0x28c1('0x46')]['id'];}return db[_0x28c1('0x27')][_0x28c1('0x47')]({'where':{'id':_0x1c94e0[_0x28c1('0x43')]['id']}})[_0x28c1('0x23')](handleEntityNotFound(_0x3a7f69,null))[_0x28c1('0x23')](saveUpdates(_0x1c94e0['body'],null))[_0x28c1('0x23')](respondWithResult(_0x3a7f69,null))[_0x28c1('0x41')](handleError(_0x3a7f69,null));};exports[_0x28c1('0x48')]=function(_0x5b1b94,_0x5a52e5){return db['VoiceRecording']['describe']()[_0x28c1('0x23')](respondWithResult(_0x5a52e5,null))['catch'](handleError(_0x5a52e5,null));};exports[_0x28c1('0x49')]=function(_0x52373b,_0x5d6408,_0x439c1b){var _0x5d659b=require('../../components/encryptor');var _0x5c256f=![];var _0x140ce2={};if(_0x52373b['query'][_0x28c1('0x29')]&&_0x52373b['query'][_0x28c1('0x29')]===_0x28c1('0x4a')){_0x140ce2[_0x28c1('0x4a')]=_0x52373b['params']['id'];}else{_0x140ce2['id']=_0x52373b['params']['id'];}return db[_0x28c1('0x27')][_0x28c1('0x47')]({'where':_0x140ce2,'attributes':['id',_0x28c1('0x4b')],'raw':!![]})[_0x28c1('0x23')](handleEntityNotFound(_0x5d6408,null))[_0x28c1('0x23')](function(_0x49456a){if(_0x49456a){var _0x3a3db2=_0x49456a[_0x28c1('0x4b')];var _0x529fcd=util[_0x28c1('0x2d')]('%s.cypher',_0x3a3db2);if(fs[_0x28c1('0x4c')](_0x529fcd)){_0x5c256f=!![];return _0x5d659b['decryptFile'](_0x529fcd,_0x3a3db2,config[_0x28c1('0x4d')][_0x28c1('0x4e')])['then'](function(){return _0x49456a;});}return _0x49456a;}})[_0x28c1('0x23')](function(_0x45133f){if(_0x45133f){var _0x503338=_0x45133f[_0x28c1('0x4b')];if(!fs['existsSync'](_0x503338)){throw new db['Sequelize'][(_0x28c1('0x4f'))]('VoiceRecording\x20not\x20found');}if(_0x45133f[_0x28c1('0x50')]){return _0x5d6408[_0x28c1('0x49')](_0x503338,_0x45133f[_0x28c1('0x50')]+path[_0x28c1('0x51')](_0x503338),function(){if(_0x5c256f){fs[_0x28c1('0x52')](_0x503338);}});}else{return _0x5d6408['download'](_0x503338,function(_0x547d27){if(_0x5c256f){fs[_0x28c1('0x52')](_0x503338);}});}}})[_0x28c1('0x41')](function(_0x451e37){if(_0x451e37['message']===_0x28c1('0x53')){_0x5d6408[_0x28c1('0x17')](0x194)[_0x28c1('0x54')](_0x28c1('0x55'));}else{return handleError(_0x5d6408,null);}});};exports[_0x28c1('0x56')]=function(_0x34f684,_0x527175,_0x4bb513){var _0x3e241b=require(_0x28c1('0x57'));var _0x12663=![];var _0x2e927a={'$and':[db['sequelize'][_0x28c1('0x38')](db[_0x28c1('0x58')]['fn'](_0x28c1('0x59'),db[_0x28c1('0x58')]['col'](_0x28c1('0x4a'))),_0x34f684[_0x28c1('0x2e')][_0x28c1('0x5a')])]};if(_0x34f684[_0x28c1('0x2e')][_0x28c1('0x29')]&&_0x34f684['query'][_0x28c1('0x29')]===_0x28c1('0x4a')){_0x2e927a[_0x28c1('0x5b')][_0x28c1('0x5c')]({'uniqueid':_0x34f684[_0x28c1('0x43')]['id']});}else{_0x2e927a[_0x28c1('0x5b')][_0x28c1('0x5c')]({'id':_0x34f684[_0x28c1('0x43')]['id']});}return db[_0x28c1('0x27')][_0x28c1('0x47')]({'where':_0x2e927a,'attributes':['id',_0x28c1('0x4b')],'raw':!![]})[_0x28c1('0x23')](handleEntityNotFound(_0x527175,null))[_0x28c1('0x23')](function(_0x5cd14f){if(_0x5cd14f){var _0x5b0dfa=util['format'](_0x28c1('0x5d'),_0x5cd14f[_0x28c1('0x4b')]);if(fs[_0x28c1('0x4c')](_0x5b0dfa)){_0x12663=!![];return _0x3e241b[_0x28c1('0x5e')](_0x5b0dfa,_0x5cd14f[_0x28c1('0x4b')],config['secrets'][_0x28c1('0x4e')])[_0x28c1('0x23')](function(){return _0x5cd14f;});}return _0x5cd14f;}})[_0x28c1('0x23')](function(_0x2cf1b3){if(_0x2cf1b3){if(!fs[_0x28c1('0x4c')](_0x2cf1b3[_0x28c1('0x4b')])){throw new db['Sequelize'][(_0x28c1('0x4f'))](_0x28c1('0x53'));}if(_0x2cf1b3[_0x28c1('0x50')]){return _0x527175[_0x28c1('0x49')](_0x2cf1b3[_0x28c1('0x4b')],_0x2cf1b3[_0x28c1('0x50')]+path[_0x28c1('0x51')](_0x2cf1b3['value']),function(){if(_0x12663){fs[_0x28c1('0x52')](_0x2cf1b3['value']);}});}else{return _0x527175[_0x28c1('0x49')](_0x2cf1b3[_0x28c1('0x4b')],function(_0x74d9b7){if(_0x12663){fs['unlink'](_0x2cf1b3['value']);}});}}})[_0x28c1('0x41')](handleError(_0x527175,null));};exports[_0x28c1('0x24')]=function(_0x4de485,_0x1e3f76){return db['VoiceRecording'][_0x28c1('0x47')]({'where':{'id':_0x4de485[_0x28c1('0x43')]['id']}})[_0x28c1('0x23')](function(_0x42bd19){if(_['isNil'](_0x42bd19)){throw new ReferenceError('Entity\x20not\x20found');}return _0x42bd19;})[_0x28c1('0x23')](function(_0x2fadfb){var _0x2ff051=_0x2fadfb[_0x28c1('0x4b')];logger[_0x28c1('0x5f')]('cancellazione\x20fisica\x20documento\x20%s',_0x2ff051);if(!_['isNil'](_0x2fadfb[_0x28c1('0x4b')])&&fs[_0x28c1('0x4c')](_0x2ff051)){logger['info']('File:\x20\x22'+_0x2ff051+_0x28c1('0x60'));fs[_0x28c1('0x61')](_0x2ff051);}_0x2ff051=_0x2ff051+'.cypher';if(!_[_0x28c1('0x62')](_0x2fadfb['value'])&&fs[_0x28c1('0x4c')](_0x2ff051)){logger['info'](_0x28c1('0x63')+_0x2ff051+_0x28c1('0x60'));fs[_0x28c1('0x61')](_0x2ff051);}return _0x2fadfb;})[_0x28c1('0x23')](function(_0x31f3fa){if(!_0x31f3fa)throw new InternalError();return _0x31f3fa[_0x28c1('0x24')]();})[_0x28c1('0x23')](function(){_0x1e3f76[_0x28c1('0x17')](0xcc)['end']();})[_0x28c1('0x41')](handleError(_0x1e3f76,null));};function getBucketslist(_0xd63d50,_0x1d9273,_0xf4d4b1){return new Promise(function(_0x1f0805,_0xbf390f){var _0x858ed7=new AWS['S3']({'accessKeyId':_0x1d9273,'secretAccessKey':_0xd63d50,'region':_0xf4d4b1});_0x858ed7[_0x28c1('0x64')]({},function(_0x59f84b,_0xfd809){if(_0x59f84b){return _0xbf390f(_0x59f84b);}else{return _0x1f0805(_0xfd809);}});});}function createBucket(_0x555c54,_0x1f83b5,_0x5cb00e,_0x5af07d){return new Promise(function(_0x25435d,_0x336610){var _0x2a9648=new AWS['S3']({'accessKeyId':_0x1f83b5,'secretAccessKey':_0x555c54,'region':_0x5cb00e});_0x2a9648[_0x28c1('0x65')]({'Bucket':_0x5af07d},function(_0x26d75c,_0x3a15ce){if(_0x26d75c){return _0x336610(_0x26d75c);}else{return _0x25435d(_0x3a15ce);}});});}function uploadFile(_0x1b8446,_0x19ea07,_0x3bba75,_0x589da7,_0xd352e8,_0x2030c9){return new Promise(function(_0x54932e,_0x267199){var _0x3cd705=new AWS['S3']({'accessKeyId':_0x19ea07,'secretAccessKey':_0x1b8446,'region':_0x3bba75});_0x3cd705[_0x28c1('0x66')]({'Bucket':_0x589da7,'Key':_0xd352e8,'Body':_0x2030c9},function(_0x2b122d,_0x27834b){if(_0x2b122d){return _0x267199(_0x2b122d);}else{return _0x54932e(_0x27834b);}});});}function startTranscribe(_0x5bbb52,_0x53af41,_0x2273de,_0x2032ad,_0x9825a,_0x27e6aa){return new Promise(function(_0x2d5666,_0x44778f){var _0x47c915=new AWS['TranscribeService']({'accessKeyId':_0x53af41,'secretAccessKey':_0x5bbb52,'region':_0x2273de});_0x47c915[_0x28c1('0x67')]({'TranscriptionJobName':_0x2032ad,'LanguageCode':_0x9825a,'Media':{'MediaFileUri':_0x27e6aa}},function(_0x4ab48d,_0x3bb0e0){if(_0x4ab48d){return _0x44778f(_0x4ab48d);}else{return _0x2d5666(_0x3bb0e0);}});});}function transcribe(_0x1f26b2,_0x247ae2,_0x53c0e1,_0x245c92,_0x43a2c0,_0x1fe62c,_0x3a715c){return new Promise(function(_0x20bf7e,_0x101d11){var _0x1c3a94={};logger[_0x28c1('0x5f')](util[_0x28c1('0x2d')](_0x28c1('0x68'),_0x1f26b2,_0x43a2c0));return uploadFile(_0x247ae2,_0x53c0e1,_0x245c92,_0x43a2c0,path['basename'](_0x1fe62c),fs[_0x28c1('0x69')](_0x1fe62c))[_0x28c1('0x23')](function(_0x449704){logger[_0x28c1('0x5f')](util[_0x28c1('0x2d')](_0x28c1('0x6a'),_0x1f26b2,_0x43a2c0,_0x449704[_0x28c1('0x6b')]));_0x1c3a94[_0x28c1('0x6c')]=_0x449704['Bucket'];_0x1c3a94[_0x28c1('0x6d')]=_0x449704[_0x28c1('0x6b')];logger[_0x28c1('0x5f')](util[_0x28c1('0x2d')](_0x28c1('0x6e'),_0x1f26b2));return startTranscribe(_0x247ae2,_0x53c0e1,_0x245c92,uuidv4(),_0x3a715c,_0x449704[_0x28c1('0x6b')]);})[_0x28c1('0x23')](function(_0x2cdf5c){logger[_0x28c1('0x5f')](util[_0x28c1('0x2d')](_0x28c1('0x6f'),_0x1f26b2,_0x2cdf5c[_0x28c1('0x70')][_0x28c1('0x71')]));_0x1c3a94[_0x28c1('0x72')]=_0x2cdf5c[_0x28c1('0x70')][_0x28c1('0x71')];_0x1c3a94['transcribeStatus']=_0x2cdf5c[_0x28c1('0x70')][_0x28c1('0x73')];return _0x20bf7e(_0x1c3a94);})['catch'](function(_0x428244){return _0x101d11(_0x428244);});});}exports['runTranscribe']=function(_0x6e58a9,_0x5549f9,_0x55ee4d){var _0x33ab67;var _0x2e7063;var _0x1b0b30;var _0x21afcf=require('../../components/encryptor');return db[_0x28c1('0x27')]['findOne']({'where':{'id':_0x6e58a9[_0x28c1('0x43')]['id']}})['then'](function(_0xed5a6d){if(_0xed5a6d){var _0x2fdf75=util[_0x28c1('0x2d')](_0x28c1('0x5d'),_0xed5a6d[_0x28c1('0x4b')]);if(fs[_0x28c1('0x4c')](_0x2fdf75)){cypher=!![];return _0x21afcf[_0x28c1('0x5e')](_0x2fdf75,_0xed5a6d['value'],config[_0x28c1('0x4d')][_0x28c1('0x4e')])[_0x28c1('0x23')](function(){return _0xed5a6d;});}return _0xed5a6d;}})[_0x28c1('0x23')](function(_0x9f3111){if(!_0x9f3111){throw new db[(_0x28c1('0x74'))][(_0x28c1('0x4f'))](_0x28c1('0x75'));}_0x2e7063=_0x9f3111;return db[_0x28c1('0x76')]['findOne']({'where':{'id':0x1}});})[_0x28c1('0x23')](handleEntityNotFound(_0x5549f9,null))[_0x28c1('0x23')](function(_0x573aa3){if(_0x573aa3){_0x33ab67=_0x573aa3;if(!_0x33ab67['transcribe']||!_0x33ab67[_0x28c1('0x77')]||!_0x33ab67['transcribeRegion']||!_0x33ab67['language']||!_0x33ab67[_0x28c1('0x6c')]){throw new db[(_0x28c1('0x74'))][(_0x28c1('0x4f'))]('Transcribe\x20not\x20configured');}if(_0x6e58a9['body'][_0x28c1('0x78')]&&(!_0x33ab67[_0x28c1('0x79')]||!_0x33ab67[_0x28c1('0x7a')]||!_0x33ab67[_0x28c1('0x7b')]||!_0x33ab67[_0x28c1('0x7c')]||!_0x33ab67[_0x28c1('0x6c')])){throw new db[(_0x28c1('0x74'))][(_0x28c1('0x4f'))](_0x28c1('0x7d'));}return db[_0x28c1('0x7e')][_0x28c1('0x7f')]({'where':{'id':_0x33ab67[_0x28c1('0x77')]}});}})['then'](function(_0x350df5){if(!_0x350df5){throw new db['Sequelize'][(_0x28c1('0x4f'))](_0x28c1('0x80'));}if(!_0x350df5[_0x28c1('0x81')]||!_0x350df5[_0x28c1('0x82')]){throw new db[(_0x28c1('0x74'))][(_0x28c1('0x4f'))](_0x28c1('0x83'));}_0x1b0b30=_0x350df5;return getBucketslist(_0x1b0b30[_0x28c1('0x81')],_0x1b0b30['data2'],_0x33ab67[_0x28c1('0x84')]);})['then'](function(_0x21585a){if(_0x21585a&&_0x21585a[_0x28c1('0x85')]){var _0x524f51=_[_0x28c1('0x47')](_0x21585a[_0x28c1('0x85')],function(_0x2dc4db){return _0x2dc4db['Name']===_0x33ab67['bucket'];});if(!_0x524f51){logger['info'](util['format'](_0x28c1('0x86'),_0x6e58a9[_0x28c1('0x43')]['id'],_0x33ab67[_0x28c1('0x6c')]));return createBucket(_0x1b0b30[_0x28c1('0x81')],_0x1b0b30[_0x28c1('0x82')],_0x33ab67[_0x28c1('0x84')],_0x33ab67[_0x28c1('0x6c')]);}logger[_0x28c1('0x5f')](util[_0x28c1('0x2d')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x6e58a9['params']['id'],_0x33ab67[_0x28c1('0x6c')]));return;}})[_0x28c1('0x23')](function(_0x403f50){if(_0x2e7063['transcribeStatus']==='NEW'){return transcribe(_0x6e58a9[_0x28c1('0x43')]['id'],_0x1b0b30[_0x28c1('0x81')],_0x1b0b30['data2'],_0x33ab67[_0x28c1('0x84')],_0x33ab67[_0x28c1('0x6c')],_0x2e7063['value'],_0x33ab67['language']);}else{logger[_0x28c1('0x5f')](util['format'](_0x28c1('0x87'),_0x6e58a9[_0x28c1('0x43')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x28c1('0x23')](function(_0x3dd6a0){if(_0x3dd6a0){_0x3dd6a0[_0x28c1('0x88')]=_0x6e58a9[_0x28c1('0x46')][_0x28c1('0x78')];return _0x2e7063[_0x28c1('0x89')](_0x3dd6a0);}})[_0x28c1('0x23')](respondWithResult(_0x5549f9,null))[_0x28c1('0x41')](handleError(_0x5549f9,null));};function writeFile(_0x4508a1,_0x76efc){return new Promise(function(_0x53ce83,_0x3a2b5c){fs[_0x28c1('0x8a')](_0x76efc,_0x4508a1,function(_0xbfaecf,_0x5d8121){if(_0xbfaecf){return _0x3a2b5c(_0xbfaecf);}else{return _0x53ce83(_0x5d8121);}});});}exports['downloadTranscribe']=function(_0xcc8f97,_0x351b4e,_0x1307fc){return db[_0x28c1('0x27')][_0x28c1('0x7f')]({'where':{'id':_0xcc8f97[_0x28c1('0x43')]['id']}})[_0x28c1('0x23')](handleEntityNotFound(_0x351b4e))['then'](function(_0xddb39e){if(_0xddb39e&&_0xddb39e[_0x28c1('0x8b')]){var _0x568045=_0xddb39e[_0x28c1('0x8b')];var _0x2a5c1c=config['root']+_0x28c1('0x8c')+_0xddb39e['id']+_0x28c1('0x8d');if(fs[_0x28c1('0x4c')](_0x2a5c1c)){return _0x2a5c1c;}return writeFile(_0x568045,_0x2a5c1c)[_0x28c1('0x23')](function(){return _0x2a5c1c;});}else{throw new db[(_0x28c1('0x74'))][(_0x28c1('0x4f'))](_0x28c1('0x8e'));}})['then'](function(_0x89ec54){return _0x351b4e['download'](_0x89ec54);})[_0x28c1('0x41')](handleError(_0x351b4e));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index c3e3da0..ad4a0e9 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 _0x8d53=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0x915426,_0x1a0a05){var _0x1ab376=function(_0x5821ce){while(--_0x5821ce){_0x915426['push'](_0x915426['shift']());}};_0x1ab376(++_0x1a0a05);}(_0x8d53,0x1c2));var _0x38d5=function(_0x20aec2,_0x3bde52){_0x20aec2=_0x20aec2-0x0;var _0x3cf3ee=_0x8d53[_0x20aec2];return _0x3cf3ee;};'use strict';var attributes=require(_0x38d5('0x0'));module[_0x38d5('0x1')]=function(_0x5e0848,_0x256e51){return _0x5e0848[_0x38d5('0x2')](_0x38d5('0x3'),attributes,{'tableName':_0x38d5('0x4'),'paranoid':![],'indexes':[{'name':_0x38d5('0x5'),'fields':[_0x38d5('0x5')]},{'name':_0x38d5('0x6'),'fields':[_0x38d5('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xca66=['define','VoiceRecording','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xca66,0x8b));var _0x6ca6=function(_0x206494,_0x3e8c0d){_0x206494=_0x206494-0x0;var _0x2376fd=_0xca66[_0x206494];return _0x2376fd;};'use strict';var attributes=require(_0x6ca6('0x0'));module['exports']=function(_0x5bad57,_0x43246d){return _0x5bad57[_0x6ca6('0x1')](_0x6ca6('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x6ca6('0x3'),'fields':['uniqueid']},{'name':_0x6ca6('0x4'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 773d8e8..68f1c76 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 _0x0adf=['attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','existsSync','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','VoiceRecording,\x20%s,\x20%s','message','result','catch','VoiceRecording','update','body','options','where'];(function(_0x4fb5ce,_0x3a79f9){var _0x3c07b5=function(_0x5aed51){while(--_0x5aed51){_0x4fb5ce['push'](_0x4fb5ce['shift']());}};_0x3c07b5(++_0x3a79f9);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x21c70c,_0x45e559){_0x21c70c=_0x21c70c-0x0;var _0x52210c=_0x0adf[_0x21c70c];return _0x52210c;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var moment=require(_0xf0ad('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0ad('0x3'));var fs=require('fs');var Redis=require(_0xf0ad('0x4'));var db=require(_0xf0ad('0x5'))['db'];var utils=require(_0xf0ad('0x6'));var logger=require(_0xf0ad('0x7'))(_0xf0ad('0x8'));var config=require(_0xf0ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eca0e,_0x44cf37,_0x170574){return new BPromise(function(_0x41c99d,_0xa9a315){return client[_0xf0ad('0xb')](_0x2eca0e,_0x170574)[_0xf0ad('0xc')](function(_0x5bdf69){logger[_0xf0ad('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x44cf37,_0xf0ad('0xe'));logger[_0xf0ad('0xf')](_0xf0ad('0x10'),_0x44cf37,_0xf0ad('0xe'),JSON[_0xf0ad('0x11')](_0x5bdf69));if(_0x5bdf69['error']){if(_0x5bdf69['error'][_0xf0ad('0x12')]===0x1f4){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x5bdf69[_0xf0ad('0x13')]['message']);return _0xa9a315(_0x5bdf69[_0xf0ad('0x13')][_0xf0ad('0x15')]);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x44cf37,_0x5bdf69['error'][_0xf0ad('0x15')]);return _0x41c99d(_0x5bdf69['error'][_0xf0ad('0x15')]);}else{logger[_0xf0ad('0xd')](_0xf0ad('0x14'),_0x44cf37,_0xf0ad('0xe'));_0x41c99d(_0x5bdf69[_0xf0ad('0x16')]['message']);}})[_0xf0ad('0x17')](function(_0x285ab0){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x285ab0);_0xa9a315(_0x285ab0);});});}exports['UpdateVoiceRecording']=function(_0x4e9970){var _0x2466e8=this;return new Promise(function(_0x46fb20,_0x49f2ec){return db[_0xf0ad('0x18')][_0xf0ad('0x19')](_0x4e9970[_0xf0ad('0x1a')],{'raw':_0x4e9970[_0xf0ad('0x1b')]?_0x4e9970['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e9970[_0xf0ad('0x1b')]?_0x4e9970[_0xf0ad('0x1b')][_0xf0ad('0x1c')]||null:null,'attributes':_0x4e9970[_0xf0ad('0x1b')]?_0x4e9970[_0xf0ad('0x1b')][_0xf0ad('0x1d')]||null:null,'limit':_0x4e9970['options']?_0x4e9970[_0xf0ad('0x1b')][_0xf0ad('0x1e')]||null:null})[_0xf0ad('0xc')](function(_0x3ece1e){logger[_0xf0ad('0xd')](_0xf0ad('0x1f'),_0x4e9970);logger[_0xf0ad('0xf')](_0xf0ad('0x1f'),_0x4e9970,JSON[_0xf0ad('0x11')](_0x3ece1e));_0x46fb20(_0x3ece1e);})[_0xf0ad('0x17')](function(_0x39b3e8){logger[_0xf0ad('0x13')](_0xf0ad('0x1f'),_0x39b3e8[_0xf0ad('0x15')],_0x4e9970);_0x49f2ec(_0x2466e8[_0xf0ad('0x13')](0x1f4,_0x39b3e8['message']));});});};exports[_0xf0ad('0x20')]=function(_0x1507a3){var _0x248794=this;return new Promise(function(_0x7377d7,_0x28c280){var _0x30f8ee=require('../../components/encryptor');var _0x2cbe00;return db[_0xf0ad('0x21')][_0xf0ad('0x22')]({'attributes':['id',_0xf0ad('0x23')],'where':{'id':0x1},'raw':!![]})[_0xf0ad('0xc')](function(_0x1ac25c){_0x2cbe00=_0x1ac25c;return db[_0xf0ad('0x18')][_0xf0ad('0x24')](_0x1507a3[_0xf0ad('0x1a')]);})[_0xf0ad('0xc')](function(_0x2d1b2f){if(_0x2cbe00['callRecordingEncryption']&&fs[_0xf0ad('0x25')](_0x2d1b2f['value'])){var _0x83f211=util['format'](_0xf0ad('0x26'),_0x2d1b2f[_0xf0ad('0x27')]);return _0x30f8ee[_0xf0ad('0x28')](_0x2d1b2f[_0xf0ad('0x27')],_0x83f211,config[_0xf0ad('0x29')][_0xf0ad('0x2a')])[_0xf0ad('0xc')](function(){fs[_0xf0ad('0x2b')](_0x2d1b2f['value']);logger['info'](_0xf0ad('0x2c'));return _0x2d1b2f;});}return _0x2d1b2f;})[_0xf0ad('0xc')](function(_0xd608bf){logger[_0xf0ad('0xd')]('CreateVoiceRecording',_0x1507a3);logger[_0xf0ad('0xf')]('CreateVoiceRecording',_0x1507a3,JSON[_0xf0ad('0x11')](_0xd608bf));_0x7377d7(_0xd608bf);})['catch'](function(_0x4136b9){logger['error'](_0xf0ad('0x20'),_0x4136b9[_0xf0ad('0x15')],_0x1507a3);_0x28c280(_0x248794[_0xf0ad('0x13')](0x1f4,_0x4136b9[_0xf0ad('0x15')]));});});}; \ No newline at end of file +var _0x6050=['existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','../../components/encryptor','Setting','findOne','callRecordingEncryption'];(function(_0x558d7c,_0x2bb3c2){var _0x4f720e=function(_0xf4f835){while(--_0xf4f835){_0x558d7c['push'](_0x558d7c['shift']());}};_0x4f720e(++_0x2bb3c2);}(_0x6050,0x196));var _0x0605=function(_0x39b802,_0x216248){_0x39b802=_0x39b802-0x0;var _0x25918d=_0x6050[_0x39b802];return _0x25918d;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var moment=require(_0x0605('0x2'));var BPromise=require(_0x0605('0x3'));var rs=require(_0x0605('0x4'));var fs=require('fs');var Redis=require(_0x0605('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0605('0x6'));var logger=require(_0x0605('0x7'))(_0x0605('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0605('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x578623,_0x58f7d2,_0x5660ad){return new BPromise(function(_0x1629bf,_0x11b8b5){return client[_0x0605('0xa')](_0x578623,_0x5660ad)[_0x0605('0xb')](function(_0x44fdd3){logger['info'](_0x0605('0xc'),_0x58f7d2,_0x0605('0xd'));logger[_0x0605('0xe')](_0x0605('0xf'),_0x58f7d2,_0x0605('0xd'),JSON[_0x0605('0x10')](_0x44fdd3));if(_0x44fdd3[_0x0605('0x11')]){if(_0x44fdd3[_0x0605('0x11')][_0x0605('0x12')]===0x1f4){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x11b8b5(_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);}logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x1629bf(_0x44fdd3['error'][_0x0605('0x13')]);}else{logger[_0x0605('0x14')](_0x0605('0xc'),_0x58f7d2,'request\x20sent');_0x1629bf(_0x44fdd3['result'][_0x0605('0x13')]);}})[_0x0605('0x15')](function(_0xa83443){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0xa83443);_0x11b8b5(_0xa83443);});});}exports[_0x0605('0x16')]=function(_0x2b7b5a){var _0x1d57ba=this;return new Promise(function(_0x193520,_0x40abb2){return db[_0x0605('0x17')][_0x0605('0x18')](_0x2b7b5a[_0x0605('0x19')],{'raw':_0x2b7b5a[_0x0605('0x1a')]?_0x2b7b5a['options'][_0x0605('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b7b5a[_0x0605('0x1a')]?_0x2b7b5a[_0x0605('0x1a')][_0x0605('0x1c')]||null:null,'attributes':_0x2b7b5a[_0x0605('0x1a')]?_0x2b7b5a[_0x0605('0x1a')][_0x0605('0x1d')]||null:null,'limit':_0x2b7b5a[_0x0605('0x1a')]?_0x2b7b5a[_0x0605('0x1a')]['limit']||null:null})[_0x0605('0xb')](function(_0x4fe293){logger[_0x0605('0x14')](_0x0605('0x16'),_0x2b7b5a);logger[_0x0605('0xe')](_0x0605('0x16'),_0x2b7b5a,JSON[_0x0605('0x10')](_0x4fe293));_0x193520(_0x4fe293);})[_0x0605('0x15')](function(_0x2ea61d){logger[_0x0605('0x11')](_0x0605('0x16'),_0x2ea61d[_0x0605('0x13')],_0x2b7b5a);_0x40abb2(_0x1d57ba[_0x0605('0x11')](0x1f4,_0x2ea61d[_0x0605('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x6bc204){var _0x3c8e36=this;return new Promise(function(_0x4b1e0c,_0x4d9a31){var _0x55ebd8=require(_0x0605('0x1e'));var _0x226825;return db[_0x0605('0x1f')][_0x0605('0x20')]({'attributes':['id',_0x0605('0x21')],'where':{'id':0x1},'raw':!![]})[_0x0605('0xb')](function(_0x4e32ef){_0x226825=_0x4e32ef;return db[_0x0605('0x17')]['create'](_0x6bc204[_0x0605('0x19')]);})[_0x0605('0xb')](function(_0x421c26){if(_0x226825[_0x0605('0x21')]&&fs[_0x0605('0x22')](_0x421c26[_0x0605('0x23')])){var _0x56dd1a=util[_0x0605('0x24')](_0x0605('0x25'),_0x421c26[_0x0605('0x23')]);return _0x55ebd8[_0x0605('0x26')](_0x421c26[_0x0605('0x23')],_0x56dd1a,config[_0x0605('0x27')][_0x0605('0x28')])[_0x0605('0xb')](function(){fs[_0x0605('0x29')](_0x421c26[_0x0605('0x23')]);logger[_0x0605('0x14')](_0x0605('0x2a'));return _0x421c26;});}return _0x421c26;})[_0x0605('0xb')](function(_0x992e4f){logger[_0x0605('0x14')](_0x0605('0x2b'),_0x6bc204);logger[_0x0605('0xe')](_0x0605('0x2b'),_0x6bc204,JSON[_0x0605('0x10')](_0x992e4f));_0x4b1e0c(_0x992e4f);})[_0x0605('0x15')](function(_0x3a1c75){logger[_0x0605('0x11')](_0x0605('0x2b'),_0x3a1c75[_0x0605('0x13')],_0x6bc204);_0x4d9a31(_0x3c8e36[_0x0605('0x11')](0x1f4,_0x3a1c75[_0x0605('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 996b67e..25ace42 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 _0xca70=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','/:id','show','post','put','update','delete','destroy'];(function(_0x3773c9,_0x27dec3){var _0x467016=function(_0x18166c){while(--_0x18166c){_0x3773c9['push'](_0x3773c9['shift']());}};_0x467016(++_0x27dec3);}(_0xca70,0xe8));var _0x0ca7=function(_0x37df88,_0x2601f9){_0x37df88=_0x37df88-0x0;var _0x2dc3db=_0xca70[_0x37df88];return _0x2dc3db;};'use strict';var multer=require(_0x0ca7('0x0'));var util=require(_0x0ca7('0x1'));var path=require(_0x0ca7('0x2'));var timeout=require(_0x0ca7('0x3'));var express=require(_0x0ca7('0x4'));var router=express[_0x0ca7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0ca7('0x6'));var interaction=require(_0x0ca7('0x7'));var config=require(_0x0ca7('0x8'));var controller=require(_0x0ca7('0x9'));router[_0x0ca7('0xa')]('/',auth[_0x0ca7('0xb')](),controller['index']);router[_0x0ca7('0xa')](_0x0ca7('0xc'),auth[_0x0ca7('0xb')](),controller['describe']);router[_0x0ca7('0xa')](_0x0ca7('0xd'),auth[_0x0ca7('0xb')](),controller[_0x0ca7('0xe')]);router[_0x0ca7('0xf')]('/',auth[_0x0ca7('0xb')](),controller['create']);router[_0x0ca7('0x10')](_0x0ca7('0xd'),auth[_0x0ca7('0xb')](),controller[_0x0ca7('0x11')]);router[_0x0ca7('0x12')](_0x0ca7('0xd'),auth[_0x0ca7('0xb')](),controller[_0x0ca7('0x13')]);module[_0x0ca7('0x14')]=router; \ No newline at end of file +var _0x2f2f=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','describe','/:id','isAuthenticated','post','create','destroy','exports','connect-timeout'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x2f2f,0x14f));var _0xf2f2=function(_0x91ca39,_0x402d37){_0x91ca39=_0x91ca39-0x0;var _0x24f214=_0x2f2f[_0x91ca39];return _0x24f214;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf2f2('0x0'));var express=require(_0xf2f2('0x1'));var router=express[_0xf2f2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf2f2('0x3'));var interaction=require(_0xf2f2('0x4'));var config=require(_0xf2f2('0x5'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf2f2('0x6')]);router[_0xf2f2('0x7')](_0xf2f2('0x8'),auth['isAuthenticated'](),controller[_0xf2f2('0x9')]);router[_0xf2f2('0x7')](_0xf2f2('0xa'),auth[_0xf2f2('0xb')](),controller['show']);router[_0xf2f2('0xc')]('/',auth[_0xf2f2('0xb')](),controller[_0xf2f2('0xd')]);router['put'](_0xf2f2('0xa'),auth[_0xf2f2('0xb')](),controller['update']);router['delete'](_0xf2f2('0xa'),auth[_0xf2f2('0xb')](),controller[_0xf2f2('0xe')]);module[_0xf2f2('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 2925124..f58cf0b 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 _0xa923=['attended','STRING','sequelize','moment','exports','blind'];(function(_0x27dc92,_0x3329fd){var _0x5c871e=function(_0x7604a5){while(--_0x7604a5){_0x27dc92['push'](_0x27dc92['shift']());}};_0x5c871e(++_0x3329fd);}(_0xa923,0xc8));var _0x3a92=function(_0x52799c,_0x5baaf7){_0x52799c=_0x52799c-0x0;var _0x49b741=_0xa923[_0x52799c];return _0x49b741;};'use strict';var Sequelize=require(_0x3a92('0x0'));var moment=require(_0x3a92('0x1'));module[_0x3a92('0x2')]={'type':{'type':Sequelize['ENUM'](_0x3a92('0x3'),_0x3a92('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x3a92('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x3a92('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x3a92('0x5')]},'transferercontext':{'type':Sequelize[_0x3a92('0x5')]},'transfererexten':{'type':Sequelize[_0x3a92('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x3a92('0x5')]},'transfereechannel':{'type':Sequelize[_0x3a92('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x3a92('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x3a92('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x3a92('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x3a92('0x5')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0x3a92('0x5')]},'extension':{'type':Sequelize[_0x3a92('0x5')]}}; \ No newline at end of file +var _0x8e2b=['STRING','Yes','sequelize','exports','ENUM','blind','attended'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8e2b,0x1a6));var _0xb8e2=function(_0x2c31f0,_0x1f57b4){_0x2c31f0=_0x2c31f0-0x0;var _0xe0d53d=_0x8e2b[_0x2c31f0];return _0xe0d53d;};'use strict';var Sequelize=require(_0xb8e2('0x0'));var moment=require('moment');module[_0xb8e2('0x1')]={'type':{'type':Sequelize[_0xb8e2('0x2')](_0xb8e2('0x3'),_0xb8e2('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xb8e2('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xb8e2('0x5')]},'transferercalleridname':{'type':Sequelize[_0xb8e2('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb8e2('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xb8e2('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xb8e2('0x5')]},'transferercontext':{'type':Sequelize[_0xb8e2('0x5')]},'transfererexten':{'type':Sequelize[_0xb8e2('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xb8e2('0x5')]},'transfereechannel':{'type':Sequelize[_0xb8e2('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xb8e2('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xb8e2('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xb8e2('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xb8e2('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xb8e2('0x5')]},'transfereecontext':{'type':Sequelize[_0xb8e2('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xb8e2('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0xb8e2('0x6'),'No')},'context':{'type':Sequelize[_0xb8e2('0x5')]},'extension':{'type':Sequelize[_0xb8e2('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 204d896..8572d6e 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 _0xfd99=['create','body','params','destroy','describe','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','stack','name','send','VoiceTransferReport','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','include','rows','catch','show','rawAttributes','includeAll','options','find'];(function(_0x231362,_0x1b3085){var _0x523090=function(_0x9973df){while(--_0x9973df){_0x231362['push'](_0x231362['shift']());}};_0x523090(++_0x1b3085);}(_0xfd99,0x16d));var _0x9fd9=function(_0x1d575,_0x2b09a3){_0x1d575=_0x1d575-0x0;var _0x484d54=_0xfd99[_0x1d575];return _0x484d54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9fd9('0x0'));var zipdir=require(_0x9fd9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9fd9('0x2'));var moment=require(_0x9fd9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9fd9('0x4'));var util=require('util');var path=require(_0x9fd9('0x5'));var sox=require(_0x9fd9('0x6'));var csv=require(_0x9fd9('0x7'));var ejs=require(_0x9fd9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9fd9('0x9'));var crypto=require(_0x9fd9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9fd9('0xb'));var toCsv=require(_0x9fd9('0x7'));var querystring=require(_0x9fd9('0xc'));var Papa=require(_0x9fd9('0xd'));var Redis=require(_0x9fd9('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fd9('0xf'))(_0x9fd9('0x10'));var utils=require(_0x9fd9('0x11'));var config=require(_0x9fd9('0x12'));var licenseUtil=require(_0x9fd9('0x13'));var db=require(_0x9fd9('0x14'))['db'];function respondWithStatusCode(_0x19e431,_0x240f01){_0x240f01=_0x240f01||0xcc;return function(_0x670057){if(_0x670057){return _0x19e431[_0x9fd9('0x15')](_0x240f01);}return _0x19e431[_0x9fd9('0x16')](_0x240f01)[_0x9fd9('0x17')]();};}function respondWithResult(_0x1f03a9,_0x35dd4c){_0x35dd4c=_0x35dd4c||0xc8;return function(_0x7d1ad5){if(_0x7d1ad5){return _0x1f03a9[_0x9fd9('0x16')](_0x35dd4c)[_0x9fd9('0x18')](_0x7d1ad5);}};}function respondWithFilteredResult(_0x7991ee,_0x53cd97){return function(_0x4cd4eb){if(_0x4cd4eb){var _0x3dc69c=typeof _0x53cd97['offset']===_0x9fd9('0x19')&&typeof _0x53cd97[_0x9fd9('0x1a')]===_0x9fd9('0x19');var _0x18691f=_0x4cd4eb[_0x9fd9('0x1b')];var _0x58d3a8=_0x3dc69c?0x0:_0x53cd97[_0x9fd9('0x1c')];var _0x1a65d4=_0x3dc69c?_0x4cd4eb[_0x9fd9('0x1b')]:_0x53cd97[_0x9fd9('0x1c')]+_0x53cd97['limit'];var _0xd9e4ca;if(_0x1a65d4>=_0x18691f){_0x1a65d4=_0x18691f;_0xd9e4ca=0xc8;}else{_0xd9e4ca=0xce;}_0x7991ee['status'](_0xd9e4ca);return _0x7991ee[_0x9fd9('0x1d')](_0x9fd9('0x1e'),_0x58d3a8+'-'+_0x1a65d4+'/'+_0x18691f)[_0x9fd9('0x18')](_0x4cd4eb);}return null;};}function patchUpdates(_0x2067bc){return function(_0x3b8d4b){try{jsonpatch['apply'](_0x3b8d4b,_0x2067bc,!![]);}catch(_0x9c8565){return BPromise[_0x9fd9('0x1f')](_0x9c8565);}return _0x3b8d4b[_0x9fd9('0x20')]();};}function saveUpdates(_0x538449,_0xf3f5c7){return function(_0x221e45){if(_0x221e45){return _0x221e45[_0x9fd9('0x21')](_0x538449)['then'](function(_0x1421ba){return _0x1421ba;});}return null;};}function removeEntity(_0x3a2441,_0x16e988){return function(_0xd87e84){if(_0xd87e84){return _0xd87e84['destroy']()[_0x9fd9('0x22')](function(){_0x3a2441[_0x9fd9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x449e34,_0x49ca9f){return function(_0x4c3409){if(!_0x4c3409){_0x449e34['sendStatus'](0x194);}return _0x4c3409;};}function handleError(_0x53b8b6,_0x24bdd0){_0x24bdd0=_0x24bdd0||0x1f4;return function(_0x1f1642){logger['error'](_0x1f1642[_0x9fd9('0x23')]);if(_0x1f1642[_0x9fd9('0x24')]){delete _0x1f1642[_0x9fd9('0x24')];}_0x53b8b6[_0x9fd9('0x16')](_0x24bdd0)[_0x9fd9('0x25')](_0x1f1642);};}exports['index']=function(_0x5e75b6,_0x23d7d8){var _0x40fcc0={},_0x41bff1={},_0x423c95={'count':0x0,'rows':[]};var _0x345117=_['map'](db[_0x9fd9('0x26')]['rawAttributes'],function(_0x3c08dc){return{'name':_0x3c08dc[_0x9fd9('0x27')],'type':_0x3c08dc[_0x9fd9('0x28')][_0x9fd9('0x29')]};});_0x41bff1['model']=_[_0x9fd9('0x2a')](_0x345117,_0x9fd9('0x24'));_0x41bff1[_0x9fd9('0x2b')]=_[_0x9fd9('0x2c')](_0x5e75b6['query']);_0x41bff1[_0x9fd9('0x2d')]=_[_0x9fd9('0x2e')](_0x41bff1[_0x9fd9('0x2f')],_0x41bff1[_0x9fd9('0x2b')]);_0x40fcc0['attributes']=_[_0x9fd9('0x2e')](_0x41bff1[_0x9fd9('0x2f')],qs['fields'](_0x5e75b6[_0x9fd9('0x2b')][_0x9fd9('0x30')]));_0x40fcc0[_0x9fd9('0x31')]=_0x40fcc0[_0x9fd9('0x31')][_0x9fd9('0x32')]?_0x40fcc0[_0x9fd9('0x31')]:_0x41bff1[_0x9fd9('0x2f')];if(!_0x5e75b6[_0x9fd9('0x2b')][_0x9fd9('0x33')]('nolimit')){_0x40fcc0[_0x9fd9('0x1a')]=qs['limit'](_0x5e75b6[_0x9fd9('0x2b')][_0x9fd9('0x1a')]);_0x40fcc0['offset']=qs[_0x9fd9('0x1c')](_0x5e75b6[_0x9fd9('0x2b')]['offset']);}_0x40fcc0[_0x9fd9('0x34')]=qs[_0x9fd9('0x35')](_0x5e75b6[_0x9fd9('0x2b')][_0x9fd9('0x35')]);_0x40fcc0[_0x9fd9('0x36')]=qs[_0x9fd9('0x2d')](_[_0x9fd9('0x37')](_0x5e75b6[_0x9fd9('0x2b')],_0x41bff1[_0x9fd9('0x2d')]),_0x345117);if(_0x5e75b6[_0x9fd9('0x2b')]['filter']){_0x40fcc0[_0x9fd9('0x36')]=_[_0x9fd9('0x38')](_0x40fcc0[_0x9fd9('0x36')],{'$or':_[_0x9fd9('0x2a')](_0x345117,function(_0x207f52){if(_0x207f52[_0x9fd9('0x28')]!==_0x9fd9('0x39')){var _0x506f50={};_0x506f50[_0x207f52[_0x9fd9('0x24')]]={'$like':'%'+_0x5e75b6[_0x9fd9('0x2b')][_0x9fd9('0x3a')]+'%'};return _0x506f50;}})});}_0x40fcc0=_['merge']({},_0x40fcc0,_0x5e75b6['options']);var _0x56f236={'where':_0x40fcc0['where']};return db[_0x9fd9('0x26')][_0x9fd9('0x1b')](_0x56f236)['then'](function(_0x5eb047){_0x423c95[_0x9fd9('0x1b')]=_0x5eb047;if(_0x5e75b6[_0x9fd9('0x2b')]['includeAll']){_0x40fcc0[_0x9fd9('0x3b')]=[{'all':!![]}];}return db[_0x9fd9('0x26')]['findAll'](_0x40fcc0);})[_0x9fd9('0x22')](function(_0xc30288){_0x423c95[_0x9fd9('0x3c')]=_0xc30288;return _0x423c95;})[_0x9fd9('0x22')](respondWithFilteredResult(_0x23d7d8,_0x40fcc0))[_0x9fd9('0x3d')](handleError(_0x23d7d8,null));};exports[_0x9fd9('0x3e')]=function(_0x5efaed,_0x2a085c){var _0x5e9c0d={'raw':!![],'where':{'id':_0x5efaed['params']['id']}},_0xfd7047={};_0xfd7047[_0x9fd9('0x2f')]=_[_0x9fd9('0x2c')](db['VoiceTransferReport'][_0x9fd9('0x3f')]);_0xfd7047[_0x9fd9('0x2b')]=_['keys'](_0x5efaed['query']);_0xfd7047[_0x9fd9('0x2d')]=_[_0x9fd9('0x2e')](_0xfd7047[_0x9fd9('0x2f')],_0xfd7047[_0x9fd9('0x2b')]);_0x5e9c0d[_0x9fd9('0x31')]=_[_0x9fd9('0x2e')](_0xfd7047['model'],qs['fields'](_0x5efaed['query'][_0x9fd9('0x30')]));_0x5e9c0d[_0x9fd9('0x31')]=_0x5e9c0d['attributes'][_0x9fd9('0x32')]?_0x5e9c0d[_0x9fd9('0x31')]:_0xfd7047[_0x9fd9('0x2f')];if(_0x5efaed[_0x9fd9('0x2b')][_0x9fd9('0x40')]){_0x5e9c0d[_0x9fd9('0x3b')]=[{'all':!![]}];}_0x5e9c0d=_[_0x9fd9('0x38')]({},_0x5e9c0d,_0x5efaed[_0x9fd9('0x41')]);return db[_0x9fd9('0x26')][_0x9fd9('0x42')](_0x5e9c0d)[_0x9fd9('0x22')](handleEntityNotFound(_0x2a085c,null))[_0x9fd9('0x22')](respondWithResult(_0x2a085c,null))[_0x9fd9('0x3d')](handleError(_0x2a085c,null));};exports[_0x9fd9('0x43')]=function(_0x224f4e,_0x3446ee){return db[_0x9fd9('0x26')][_0x9fd9('0x43')](_0x224f4e[_0x9fd9('0x44')],{})[_0x9fd9('0x22')](respondWithResult(_0x3446ee,0xc9))[_0x9fd9('0x3d')](handleError(_0x3446ee,null));};exports[_0x9fd9('0x21')]=function(_0x509201,_0x422c2e){if(_0x509201['body']['id']){delete _0x509201[_0x9fd9('0x44')]['id'];}return db['VoiceTransferReport'][_0x9fd9('0x42')]({'where':{'id':_0x509201[_0x9fd9('0x45')]['id']}})[_0x9fd9('0x22')](handleEntityNotFound(_0x422c2e,null))[_0x9fd9('0x22')](saveUpdates(_0x509201[_0x9fd9('0x44')],null))[_0x9fd9('0x22')](respondWithResult(_0x422c2e,null))[_0x9fd9('0x3d')](handleError(_0x422c2e,null));};exports[_0x9fd9('0x46')]=function(_0x2e45df,_0x2e394f){return db[_0x9fd9('0x26')][_0x9fd9('0x42')]({'where':{'id':_0x2e45df['params']['id']}})[_0x9fd9('0x22')](handleEntityNotFound(_0x2e394f,null))['then'](removeEntity(_0x2e394f,null))[_0x9fd9('0x3d')](handleError(_0x2e394f,null));};exports[_0x9fd9('0x47')]=function(_0x216429,_0x1dc93c){return db[_0x9fd9('0x26')]['describe']()['then'](respondWithResult(_0x1dc93c,null))[_0x9fd9('0x3d')](handleError(_0x1dc93c,null));}; \ No newline at end of file +var _0xd731=['../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','VoiceTransferReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','create','update','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0xd731,0xca));var _0x1d73=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd731[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x1d73('0x0'));var rimraf=require(_0x1d73('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1d73('0x2'));var moment=require(_0x1d73('0x3'));var BPromise=require(_0x1d73('0x4'));var Mustache=require(_0x1d73('0x5'));var util=require(_0x1d73('0x6'));var path=require(_0x1d73('0x7'));var sox=require(_0x1d73('0x8'));var csv=require(_0x1d73('0x9'));var ejs=require(_0x1d73('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d73('0xb'));var squel=require(_0x1d73('0xc'));var crypto=require(_0x1d73('0xd'));var jsforce=require(_0x1d73('0xe'));var deskjs=require(_0x1d73('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1d73('0x10'));var Redis=require(_0x1d73('0x11'));var authService=require(_0x1d73('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1d73('0x13'));var hardwareService=require(_0x1d73('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1d73('0x15'));var config=require(_0x1d73('0x16'));var licenseUtil=require(_0x1d73('0x17'));var db=require(_0x1d73('0x18'))['db'];function respondWithStatusCode(_0x2326da,_0x42b10d){_0x42b10d=_0x42b10d||0xcc;return function(_0x255150){if(_0x255150){return _0x2326da['sendStatus'](_0x42b10d);}return _0x2326da[_0x1d73('0x19')](_0x42b10d)[_0x1d73('0x1a')]();};}function respondWithResult(_0x33e919,_0x1f4ca5){_0x1f4ca5=_0x1f4ca5||0xc8;return function(_0x29f30b){if(_0x29f30b){return _0x33e919[_0x1d73('0x19')](_0x1f4ca5)[_0x1d73('0x1b')](_0x29f30b);}};}function respondWithFilteredResult(_0x3096ce,_0x4d6934){return function(_0x2eba9d){if(_0x2eba9d){var _0x39008f=typeof _0x4d6934[_0x1d73('0x1c')]===_0x1d73('0x1d')&&typeof _0x4d6934[_0x1d73('0x1e')]===_0x1d73('0x1d');var _0x4998fb=_0x2eba9d[_0x1d73('0x1f')];var _0x3242fe=_0x39008f?0x0:_0x4d6934[_0x1d73('0x1c')];var _0x1ff144=_0x39008f?_0x2eba9d[_0x1d73('0x1f')]:_0x4d6934['offset']+_0x4d6934[_0x1d73('0x1e')];var _0x32179c;if(_0x1ff144>=_0x4998fb){_0x1ff144=_0x4998fb;_0x32179c=0xc8;}else{_0x32179c=0xce;}_0x3096ce['status'](_0x32179c);return _0x3096ce[_0x1d73('0x20')](_0x1d73('0x21'),_0x3242fe+'-'+_0x1ff144+'/'+_0x4998fb)[_0x1d73('0x1b')](_0x2eba9d);}return null;};}function patchUpdates(_0x582c6d){return function(_0x1f40d3){try{jsonpatch[_0x1d73('0x22')](_0x1f40d3,_0x582c6d,!![]);}catch(_0x246d98){return BPromise[_0x1d73('0x23')](_0x246d98);}return _0x1f40d3[_0x1d73('0x24')]();};}function saveUpdates(_0x4a901a,_0x441269){return function(_0x2707c2){if(_0x2707c2){return _0x2707c2['update'](_0x4a901a)['then'](function(_0x2f13b5){return _0x2f13b5;});}return null;};}function removeEntity(_0x5e19e7,_0x547f8d){return function(_0xe73678){if(_0xe73678){return _0xe73678['destroy']()[_0x1d73('0x25')](function(){_0x5e19e7[_0x1d73('0x19')](0xcc)[_0x1d73('0x1a')]();});}};}function handleEntityNotFound(_0x503e85,_0x57e8e0){return function(_0x1ea1a4){if(!_0x1ea1a4){_0x503e85['sendStatus'](0x194);}return _0x1ea1a4;};}function handleError(_0x37e717,_0x3ced0b){_0x3ced0b=_0x3ced0b||0x1f4;return function(_0x4bbed9){logger[_0x1d73('0x26')](_0x4bbed9[_0x1d73('0x27')]);if(_0x4bbed9[_0x1d73('0x28')]){delete _0x4bbed9['name'];}_0x37e717[_0x1d73('0x19')](_0x3ced0b)[_0x1d73('0x29')](_0x4bbed9);};}exports['index']=function(_0x3d3f80,_0x3dbf2e){var _0x9373f3={},_0x2de5b9={},_0x57e2f0={'count':0x0,'rows':[]};var _0x1edfd1=_[_0x1d73('0x2a')](db[_0x1d73('0x2b')][_0x1d73('0x2c')],function(_0x2463b8){return{'name':_0x2463b8['fieldName'],'type':_0x2463b8['type']['key']};});_0x2de5b9[_0x1d73('0x2d')]=_['map'](_0x1edfd1,_0x1d73('0x28'));_0x2de5b9['query']=_[_0x1d73('0x2e')](_0x3d3f80[_0x1d73('0x2f')]);_0x2de5b9[_0x1d73('0x30')]=_[_0x1d73('0x31')](_0x2de5b9['model'],_0x2de5b9[_0x1d73('0x2f')]);_0x9373f3[_0x1d73('0x32')]=_[_0x1d73('0x31')](_0x2de5b9['model'],qs['fields'](_0x3d3f80['query'][_0x1d73('0x33')]));_0x9373f3[_0x1d73('0x32')]=_0x9373f3[_0x1d73('0x32')][_0x1d73('0x34')]?_0x9373f3['attributes']:_0x2de5b9[_0x1d73('0x2d')];if(!_0x3d3f80['query'][_0x1d73('0x35')](_0x1d73('0x36'))){_0x9373f3['limit']=qs['limit'](_0x3d3f80[_0x1d73('0x2f')]['limit']);_0x9373f3[_0x1d73('0x1c')]=qs[_0x1d73('0x1c')](_0x3d3f80[_0x1d73('0x2f')][_0x1d73('0x1c')]);}_0x9373f3['order']=qs['sort'](_0x3d3f80[_0x1d73('0x2f')][_0x1d73('0x37')]);_0x9373f3[_0x1d73('0x38')]=qs['filters'](_[_0x1d73('0x39')](_0x3d3f80[_0x1d73('0x2f')],_0x2de5b9[_0x1d73('0x30')]),_0x1edfd1);if(_0x3d3f80[_0x1d73('0x2f')][_0x1d73('0x3a')]){_0x9373f3[_0x1d73('0x38')]=_[_0x1d73('0x3b')](_0x9373f3['where'],{'$or':_[_0x1d73('0x2a')](_0x1edfd1,function(_0x3c8474){if(_0x3c8474[_0x1d73('0x3c')]!==_0x1d73('0x3d')){var _0x2780cc={};_0x2780cc[_0x3c8474[_0x1d73('0x28')]]={'$like':'%'+_0x3d3f80[_0x1d73('0x2f')][_0x1d73('0x3a')]+'%'};return _0x2780cc;}})});}_0x9373f3=_[_0x1d73('0x3b')]({},_0x9373f3,_0x3d3f80['options']);var _0xc23c01={'where':_0x9373f3[_0x1d73('0x38')]};return db['VoiceTransferReport'][_0x1d73('0x1f')](_0xc23c01)[_0x1d73('0x25')](function(_0x135e87){_0x57e2f0[_0x1d73('0x1f')]=_0x135e87;if(_0x3d3f80[_0x1d73('0x2f')]['includeAll']){_0x9373f3[_0x1d73('0x3e')]=[{'all':!![]}];}return db[_0x1d73('0x2b')]['findAll'](_0x9373f3);})[_0x1d73('0x25')](function(_0x22e76f){_0x57e2f0[_0x1d73('0x3f')]=_0x22e76f;return _0x57e2f0;})[_0x1d73('0x25')](respondWithFilteredResult(_0x3dbf2e,_0x9373f3))[_0x1d73('0x40')](handleError(_0x3dbf2e,null));};exports[_0x1d73('0x41')]=function(_0x1b20c1,_0x3f2952){var _0x18082d={'raw':!![],'where':{'id':_0x1b20c1[_0x1d73('0x42')]['id']}},_0x16b39a={};_0x16b39a[_0x1d73('0x2d')]=_['keys'](db[_0x1d73('0x2b')][_0x1d73('0x2c')]);_0x16b39a['query']=_[_0x1d73('0x2e')](_0x1b20c1['query']);_0x16b39a['filters']=_['intersection'](_0x16b39a[_0x1d73('0x2d')],_0x16b39a[_0x1d73('0x2f')]);_0x18082d[_0x1d73('0x32')]=_[_0x1d73('0x31')](_0x16b39a[_0x1d73('0x2d')],qs[_0x1d73('0x33')](_0x1b20c1[_0x1d73('0x2f')][_0x1d73('0x33')]));_0x18082d[_0x1d73('0x32')]=_0x18082d[_0x1d73('0x32')]['length']?_0x18082d['attributes']:_0x16b39a[_0x1d73('0x2d')];if(_0x1b20c1[_0x1d73('0x2f')][_0x1d73('0x43')]){_0x18082d[_0x1d73('0x3e')]=[{'all':!![]}];}_0x18082d=_['merge']({},_0x18082d,_0x1b20c1[_0x1d73('0x44')]);return db['VoiceTransferReport'][_0x1d73('0x45')](_0x18082d)[_0x1d73('0x25')](handleEntityNotFound(_0x3f2952,null))[_0x1d73('0x25')](respondWithResult(_0x3f2952,null))[_0x1d73('0x40')](handleError(_0x3f2952,null));};exports['create']=function(_0x24e11c,_0x5202fe){return db[_0x1d73('0x2b')][_0x1d73('0x46')](_0x24e11c['body'],{})[_0x1d73('0x25')](respondWithResult(_0x5202fe,0xc9))['catch'](handleError(_0x5202fe,null));};exports[_0x1d73('0x47')]=function(_0x128efd,_0x569b63){if(_0x128efd[_0x1d73('0x48')]['id']){delete _0x128efd[_0x1d73('0x48')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x128efd[_0x1d73('0x42')]['id']}})['then'](handleEntityNotFound(_0x569b63,null))['then'](saveUpdates(_0x128efd[_0x1d73('0x48')],null))[_0x1d73('0x25')](respondWithResult(_0x569b63,null))[_0x1d73('0x40')](handleError(_0x569b63,null));};exports['destroy']=function(_0x405e1c,_0x3f1456){return db[_0x1d73('0x2b')][_0x1d73('0x45')]({'where':{'id':_0x405e1c['params']['id']}})['then'](handleEntityNotFound(_0x3f1456,null))['then'](removeEntity(_0x3f1456,null))[_0x1d73('0x40')](handleError(_0x3f1456,null));};exports[_0x1d73('0x49')]=function(_0x5d1de6,_0x541c92){return db['VoiceTransferReport'][_0x1d73('0x49')]()[_0x1d73('0x25')](respondWithResult(_0x541c92,null))[_0x1d73('0x40')](handleError(_0x541c92,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 38dc658..51be6e4 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 _0xbc6c=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xbc6c,0x91));var _0xcbc6=function(_0x133d1d,_0x5187a3){_0x133d1d=_0x133d1d-0x0;var _0x19f805=_0xbc6c[_0x133d1d];return _0x19f805;};'use strict';var _=require(_0xcbc6('0x0'));var util=require(_0xcbc6('0x1'));var logger=require(_0xcbc6('0x2'))(_0xcbc6('0x3'));var moment=require(_0xcbc6('0x4'));var BPromise=require(_0xcbc6('0x5'));var rp=require(_0xcbc6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbc6('0x7'));var config=require(_0xcbc6('0x8'));var attributes=require(_0xcbc6('0x9'));module[_0xcbc6('0xa')]=function(_0x493fce,_0xe2c9b9){return _0x493fce[_0xcbc6('0xb')](_0xcbc6('0xc'),attributes,{'tableName':_0xcbc6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22fe=['request-promise','rimraf','../../config/environment','exports','VoiceTransferReport','util','../../config/logger','api','moment'];(function(_0x466e57,_0x21b819){var _0x34df42=function(_0x3e9758){while(--_0x3e9758){_0x466e57['push'](_0x466e57['shift']());}};_0x34df42(++_0x21b819);}(_0x22fe,0xdd));var _0xe22f=function(_0x492d45,_0x2ebf5d){_0x492d45=_0x492d45-0x0;var _0x2fc6ff=_0x22fe[_0x492d45];return _0x2fc6ff;};'use strict';var _=require('lodash');var util=require(_0xe22f('0x0'));var logger=require(_0xe22f('0x1'))(_0xe22f('0x2'));var moment=require(_0xe22f('0x3'));var BPromise=require('bluebird');var rp=require(_0xe22f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe22f('0x5'));var config=require(_0xe22f('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0xe22f('0x7')]=function(_0x49934e,_0x5ae4e0){return _0x49934e['define'](_0xe22f('0x8'),attributes,{'tableName':'report_call_transfer','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 18206e1..5b69ab3 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 _0x6b22=['body','options','CreateVoiceTransferReport','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','VoiceTransferReport'];(function(_0x1b79cd,_0x1e5671){var _0x5cd8b7=function(_0x134fc0){while(--_0x134fc0){_0x1b79cd['push'](_0x1b79cd['shift']());}};_0x5cd8b7(++_0x1e5671);}(_0x6b22,0x183));var _0x26b2=function(_0x1b7786,_0x4d76c2){_0x1b7786=_0x1b7786-0x0;var _0x487abd=_0x6b22[_0x1b7786];return _0x487abd;};'use strict';var _=require('lodash');var util=require(_0x26b2('0x0'));var moment=require(_0x26b2('0x1'));var BPromise=require(_0x26b2('0x2'));var rs=require(_0x26b2('0x3'));var fs=require('fs');var Redis=require(_0x26b2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x26b2('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x26b2('0x6'));var client=jayson[_0x26b2('0x7')][_0x26b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x494291,_0x2e4506,_0x18eacd){return new BPromise(function(_0xca55bf,_0x361127){return client[_0x26b2('0x9')](_0x494291,_0x18eacd)[_0x26b2('0xa')](function(_0x5981fa){logger[_0x26b2('0xb')](_0x26b2('0xc'),_0x2e4506,_0x26b2('0xd'));logger[_0x26b2('0xe')](_0x26b2('0xf'),_0x2e4506,'request\x20sent',JSON[_0x26b2('0x10')](_0x5981fa));if(_0x5981fa[_0x26b2('0x11')]){if(_0x5981fa['error']['code']===0x1f4){logger[_0x26b2('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x2e4506,_0x5981fa['error'][_0x26b2('0x12')]);return _0x361127(_0x5981fa[_0x26b2('0x11')][_0x26b2('0x12')]);}logger['error'](_0x26b2('0xc'),_0x2e4506,_0x5981fa[_0x26b2('0x11')][_0x26b2('0x12')]);return _0xca55bf(_0x5981fa[_0x26b2('0x11')][_0x26b2('0x12')]);}else{logger[_0x26b2('0xb')](_0x26b2('0xc'),_0x2e4506,_0x26b2('0xd'));_0xca55bf(_0x5981fa['result']['message']);}})[_0x26b2('0x13')](function(_0x1cc549){logger[_0x26b2('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x2e4506,_0x1cc549);_0x361127(_0x1cc549);});});}exports['CreateVoiceTransferReport']=function(_0x134c4c){var _0x306e9=this;return new Promise(function(_0x1eb88a,_0x3ab902){return db[_0x26b2('0x14')]['create'](_0x134c4c[_0x26b2('0x15')],{'raw':_0x134c4c[_0x26b2('0x16')]?_0x134c4c[_0x26b2('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x14dd25){logger[_0x26b2('0xb')](_0x26b2('0x17'),_0x134c4c);logger['debug'](_0x26b2('0x17'),_0x134c4c,JSON[_0x26b2('0x10')](_0x14dd25));_0x1eb88a(_0x14dd25);})[_0x26b2('0x13')](function(_0x57320c){logger[_0x26b2('0x11')](_0x26b2('0x17'),_0x57320c[_0x26b2('0x12')],_0x134c4c);_0x3ab902(_0x306e9[_0x26b2('0x11')](0x1f4,_0x57320c[_0x26b2('0x12')]));});});}; \ No newline at end of file +var _0x1220=['client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateVoiceTransferReport','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x33fac5,_0xdd796a){var _0x4e5d6a=function(_0x9fda77){while(--_0x9fda77){_0x33fac5['push'](_0x33fac5['shift']());}};_0x4e5d6a(++_0xdd796a);}(_0x1220,0x149));var _0x0122=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x1220[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x0122('0x0'));var util=require('util');var moment=require(_0x0122('0x1'));var BPromise=require(_0x0122('0x2'));var rs=require(_0x0122('0x3'));var fs=require('fs');var Redis=require(_0x0122('0x4'));var db=require(_0x0122('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0122('0x6'))(_0x0122('0x7'));var config=require('../../config/environment');var jayson=require(_0x0122('0x8'));var client=jayson[_0x0122('0x9')][_0x0122('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d5329,_0x575b6c,_0x404192){return new BPromise(function(_0x3b851b,_0x31085e){return client['request'](_0x4d5329,_0x404192)[_0x0122('0xb')](function(_0x3bef96){logger[_0x0122('0xc')](_0x0122('0xd'),_0x575b6c,_0x0122('0xe'));logger[_0x0122('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x575b6c,'request\x20sent',JSON[_0x0122('0x10')](_0x3bef96));if(_0x3bef96[_0x0122('0x11')]){if(_0x3bef96[_0x0122('0x11')][_0x0122('0x12')]===0x1f4){logger['error'](_0x0122('0xd'),_0x575b6c,_0x3bef96[_0x0122('0x11')][_0x0122('0x13')]);return _0x31085e(_0x3bef96[_0x0122('0x11')][_0x0122('0x13')]);}logger[_0x0122('0x11')](_0x0122('0xd'),_0x575b6c,_0x3bef96[_0x0122('0x11')][_0x0122('0x13')]);return _0x3b851b(_0x3bef96[_0x0122('0x11')]['message']);}else{logger['info'](_0x0122('0xd'),_0x575b6c,_0x0122('0xe'));_0x3b851b(_0x3bef96['result'][_0x0122('0x13')]);}})[_0x0122('0x14')](function(_0x4b7a9d){logger[_0x0122('0x11')](_0x0122('0xd'),_0x575b6c,_0x4b7a9d);_0x31085e(_0x4b7a9d);});});}exports[_0x0122('0x15')]=function(_0x3d9c51){var _0xb47aaa=this;return new Promise(function(_0xe38d5,_0x3e4e1f){return db['VoiceTransferReport'][_0x0122('0x16')](_0x3d9c51[_0x0122('0x17')],{'raw':_0x3d9c51['options']?_0x3d9c51[_0x0122('0x18')][_0x0122('0x19')]===undefined?!![]:![]:!![]})[_0x0122('0xb')](function(_0x3c4440){logger[_0x0122('0xc')](_0x0122('0x15'),_0x3d9c51);logger[_0x0122('0xf')](_0x0122('0x15'),_0x3d9c51,JSON[_0x0122('0x10')](_0x3c4440));_0xe38d5(_0x3c4440);})[_0x0122('0x14')](function(_0x3364a3){logger['error']('CreateVoiceTransferReport',_0x3364a3['message'],_0x3d9c51);_0x3e4e1f(_0xb47aaa[_0x0122('0x11')](0x1f4,_0x3364a3[_0x0122('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index e0e9647..0a035c6 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 _0xdace=['unhold','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','hangup','/answer','/hold','/unhold'];(function(_0x55005d,_0x3201a8){var _0x6643f6=function(_0x273989){while(--_0x273989){_0x55005d['push'](_0x55005d['shift']());}};_0x6643f6(++_0x3201a8);}(_0xdace,0xc5));var _0xedac=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0xdace[_0x2601b4];return _0x3e3661;};'use strict';var express=require(_0xedac('0x0'));var router=express['Router']();var auth=require(_0xedac('0x1'));var controller=require(_0xedac('0x2'));router[_0xedac('0x3')]('/originate',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x6')]);router[_0xedac('0x3')]('/hangup',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x7')]);router['post'](_0xedac('0x8'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller['answer']);router[_0xedac('0x3')](_0xedac('0x9'),auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0xedac('0x3')](_0xedac('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xedac('0xb')]);router[_0xedac('0x3')]('/calls',auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller[_0xedac('0xc')]);router[_0xedac('0x3')](_0xedac('0xd'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0xe')]);module[_0xedac('0xf')]=router; \ No newline at end of file +var _0xaa88=['/hold','/unhold','/calls','calls','transfer','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer'];(function(_0x59ccc6,_0x467c23){var _0x35a288=function(_0x3cb0a6){while(--_0x3cb0a6){_0x59ccc6['push'](_0x59ccc6['shift']());}};_0x35a288(++_0x467c23);}(_0xaa88,0x137));var _0x8aa8=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0xaa88[_0x2bc3f4];return _0x14ac53;};'use strict';var express=require(_0x8aa8('0x0'));var router=express[_0x8aa8('0x1')]();var auth=require(_0x8aa8('0x2'));var controller=require(_0x8aa8('0x3'));router['post'](_0x8aa8('0x4'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x7')]);router[_0x8aa8('0x8')](_0x8aa8('0x9'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x8aa8('0xa')]);router['post'](_0x8aa8('0xb'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0xc')]);router['post'](_0x8aa8('0xd'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller['hold']);router[_0x8aa8('0x8')](_0x8aa8('0xe'),auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller['unhold']);router[_0x8aa8('0x8')](_0x8aa8('0xf'),auth['isAuthenticated'](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x10')]);router[_0x8aa8('0x8')]('/transfer',auth[_0x8aa8('0x5')](),auth[_0x8aa8('0x6')](),controller[_0x8aa8('0x11')]);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 542fb04..02985b2 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 _0x6550=['agent','all','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','json','callNumber','callerId','entityFound:','format','user:%s','originate\x20executed!','hangup\x20fired:','userId','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','rows','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','lodash','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','ioredis','defaults','redis','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','stringify','emit','log','handleError:','error','name','status','NotFound','request','then','code','message','catch','findOne'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6550,0xb4));var _0x0655=function(_0x112d9c,_0x470634){_0x112d9c=_0x112d9c-0x0;var _0x3a7a63=_0x6550[_0x112d9c];return _0x3a7a63;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x0655('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x0655('0x1'));var util=require(_0x0655('0x2'));var BPromise=require(_0x0655('0x3'));var jayson=require(_0x0655('0x4'));var amiClient=jayson['client'][_0x0655('0x5')]({'port':0x232a});var logger=require(_0x0655('0x6'))('webbarapi');var Redis=require(_0x0655('0x7'));config['redis']=_[_0x0655('0x8')](config[_0x0655('0x9')],{'host':_0x0655('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0655('0x9')]));var Schema=require(_0x0655('0xb'));var originateValidation=new Schema({'userId':{'type':_0x0655('0xc'),'required':[!![],_0x0655('0xd')]},'callNumber':{'type':_0x0655('0xe'),'required':[!![],_0x0655('0xf')]},'callerId':{'type':_0x0655('0xe')},'callbackUrl':{'type':_0x0655('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x0655('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0655('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0655('0xc'),'required':[!![],_0x0655('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0655('0xc'),'required':[!![],_0x0655('0xd')]},'sessionId':{'type':_0x0655('0xe'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x0655('0xe'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x0655('0xc'),'required':[!![],_0x0655('0xd')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0655('0xc'),'required':[!![],_0x0655('0xd')]},'sessionId':{'type':_0x0655('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0655('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x0655('0xc'),'required':[!![],_0x0655('0xd')]}});function emit(_0xc88f69,_0x45832d,_0x29e64e){logger['info'](_0xc88f69,_0x45832d,JSON[_0x0655('0x10')](_0x29e64e));io['to'](_0xc88f69)[_0x0655('0x11')](_0x45832d,_0x29e64e);}function handleError(_0x25e9f9){return function(_0x3f9cb8){console[_0x0655('0x12')](_0x0655('0x13'),_0x3f9cb8,_0x3f9cb8 instanceof RangeError);logger[_0x0655('0x14')](_0x3f9cb8['stack']);if(_0x3f9cb8 instanceof RangeError){if(_0x3f9cb8[_0x0655('0x15')]){delete _0x3f9cb8[_0x0655('0x15')];}_0x25e9f9[_0x0655('0x16')](0x194)['send'](_0x3f9cb8);}else{if(_0x3f9cb8[_0x0655('0x15')]){delete _0x3f9cb8[_0x0655('0x15')];}_0x25e9f9[_0x0655('0x16')](0x1f4)['send'](_0x3f9cb8);}};}function checkError(){return function(_0x3177b0){if(!_0x3177b0){throw new RangeError(_0x0655('0x17'));}return _0x3177b0;};}function respondWithRpcPromise(_0x18e21f,_0xde8dff){return new BPromise(function(_0x57925e,_0x54a85c){var _0x5c1b20=amiClient;return _0x5c1b20[_0x0655('0x18')](_0x18e21f,_0xde8dff)[_0x0655('0x19')](function(_0x1bce27){if(_0x1bce27[_0x0655('0x14')]){if(_0x1bce27[_0x0655('0x14')][_0x0655('0x1a')]===0x1f4){return _0x54a85c(_0x1bce27['error'][_0x0655('0x1b')]);}return _0x57925e(_0x1bce27[_0x0655('0x14')]['message']);}else{_0x57925e(_0x1bce27['result']);}})[_0x0655('0x1c')](function(_0x4ba931){_0x54a85c(_0x4ba931);});});}function getAgent(_0x187e6c){return db['User'][_0x0655('0x1d')]({'where':{'id':_0x187e6c,'role':_0x0655('0x1e')}})['then'](checkError());}function getAgentCheckSession(_0x3bac55,_0x4d22b6){return new BPromise(function(_0x2def5c,_0x26c58f){var _0x4a7212=respondWithRpcPromise('VoiceChannels');var _0x2907de=getAgent(_0x3bac55);Promise[_0x0655('0x1f')]([_0x4a7212,_0x2907de])[_0x0655('0x19')](function(_0x48bf5e){var _0x204db8=_0x48bf5e[0x0];var _0x5c9eff=_0x48bf5e[0x1];var _0x5d0400=_[_0x0655('0x20')](_0x204db8['rows'],function(_0x307f0c){return _0x307f0c[_0x0655('0x21')]==_0x5c9eff['id']&&_0x307f0c[_0x0655('0x22')]==_0x4d22b6;});if(_0x5d0400[_0x0655('0x23')]==0x1){_0x2def5c(_0x5c9eff);}else{_0x26c58f(new RangeError(_0x0655('0x24')+_0x4d22b6+_0x0655('0x25')));}});});}exports['originate']=function(_0x3dcbed,_0x16a987){logger[_0x0655('0x26')](_0x0655('0x27'),_0x3dcbed[_0x0655('0x28')]);var _0x4148c7=originateValidation[_0x0655('0xb')](_0x3dcbed['body']);if(_0x4148c7[_0x0655('0x23')]>0x0){return _0x16a987['status'](0x190)[_0x0655('0x29')](_0x4148c7);}var _0x2da329=_0x3dcbed['body']['userId'];var _0x491250=_0x3dcbed[_0x0655('0x28')][_0x0655('0x2a')];var _0x39839f=_0x3dcbed['body'][_0x0655('0x2b')];var _0xb75def=_0x3dcbed['body']['callbackUrl'];return getAgent(_0x2da329)[_0x0655('0x19')](function(_0x580831){logger['info'](_0x0655('0x2c'),_0x580831[_0x0655('0x15')]);emit(util[_0x0655('0x2d')](_0x0655('0x2e'),_0x580831[_0x0655('0x15')]),'webbar:originate',{'callNumber':_0x491250,'callerId':_0x39839f,'callbackUrl':_0xb75def});return _0x16a987[_0x0655('0x16')](0xc8)['json']({'error':![],'message':_0x0655('0x2f')});})[_0x0655('0x1c')](handleError(_0x16a987));};exports['hangup']=function(_0x547936,_0x267622){logger[_0x0655('0x26')](_0x0655('0x30'),_0x547936[_0x0655('0x28')]);var _0x440d1b=hangupValidation['validate'](_0x547936['body']);if(_0x440d1b['length']>0x0){return _0x267622[_0x0655('0x16')](0x190)[_0x0655('0x29')](_0x440d1b);}var _0x528486=_0x547936[_0x0655('0x28')][_0x0655('0x31')];var _0x258c95=_0x547936[_0x0655('0x28')][_0x0655('0x22')];return getAgent(_0x528486)[_0x0655('0x19')](function(_0x7cccda){logger['info'](_0x0655('0x2c'),_0x7cccda[_0x0655('0x15')]);emit(util[_0x0655('0x2d')]('user:%s',_0x7cccda[_0x0655('0x15')]),'webbar:hangup',{'sessionId':_0x258c95});return _0x267622[_0x0655('0x16')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0x0655('0x1c')](handleError(_0x267622));};exports[_0x0655('0x32')]=function(_0x54b344,_0x336dfd){logger[_0x0655('0x26')](_0x0655('0x33'),_0x54b344[_0x0655('0x28')]);var _0x2e37af=answerValidation['validate'](_0x54b344[_0x0655('0x28')]);if(_0x2e37af['length']>0x0){return _0x336dfd[_0x0655('0x16')](0x190)[_0x0655('0x29')](_0x2e37af);}var _0x5efb38=_0x54b344[_0x0655('0x28')][_0x0655('0x31')];var _0x5c9054=_0x54b344['body'][_0x0655('0x22')];return getAgent(_0x5efb38)[_0x0655('0x19')](function(_0x2d0586){logger[_0x0655('0x26')](_0x0655('0x2c'),_0x2d0586[_0x0655('0x15')]);emit(util[_0x0655('0x2d')](_0x0655('0x2e'),_0x2d0586[_0x0655('0x15')]),_0x0655('0x34'),{'sessionId':_0x5c9054});return _0x336dfd[_0x0655('0x16')](0xc8)[_0x0655('0x29')]({'error':![],'message':_0x0655('0x35')});})[_0x0655('0x1c')](handleError(_0x336dfd));};exports[_0x0655('0x36')]=function(_0x3465e9,_0x214e25){logger[_0x0655('0x26')]('hold\x20fired:',_0x3465e9[_0x0655('0x28')]);var _0x1d163a=holdValidation[_0x0655('0xb')](_0x3465e9[_0x0655('0x28')]);if(_0x1d163a['length']>0x0){return _0x214e25[_0x0655('0x16')](0x190)[_0x0655('0x29')](_0x1d163a);}var _0xf33127=_0x3465e9[_0x0655('0x28')][_0x0655('0x31')];var _0x80c036=_0x3465e9[_0x0655('0x28')][_0x0655('0x22')];return getAgent(_0xf33127)[_0x0655('0x19')](function(_0x90b458){logger[_0x0655('0x26')](_0x0655('0x2c'),_0x90b458[_0x0655('0x15')]);emit(util[_0x0655('0x2d')](_0x0655('0x2e'),_0x90b458[_0x0655('0x15')]),_0x0655('0x37'),{'sessionId':_0x80c036});return _0x214e25[_0x0655('0x16')](0xc8)[_0x0655('0x29')]({'error':![],'message':_0x0655('0x38')});})[_0x0655('0x1c')](handleError(_0x214e25));};exports[_0x0655('0x39')]=function(_0x759a51,_0x36434a){logger[_0x0655('0x26')]('unhold\x20fired:',_0x759a51[_0x0655('0x28')]);var _0x4fbb22=unholdValidation[_0x0655('0xb')](_0x759a51['body']);if(_0x4fbb22[_0x0655('0x23')]>0x0){return _0x36434a[_0x0655('0x16')](0x190)[_0x0655('0x29')](_0x4fbb22);}var _0x8f8f19=_0x759a51[_0x0655('0x28')]['userId'];var _0x368be0=_0x759a51[_0x0655('0x28')]['sessionId'];return getAgent(_0x8f8f19)[_0x0655('0x19')](function(_0x27de7b){logger[_0x0655('0x26')]('entityFound:',_0x27de7b[_0x0655('0x15')]);emit(util[_0x0655('0x2d')]('user:%s',_0x27de7b['name']),_0x0655('0x3a'),{'sessionId':_0x368be0});return _0x36434a[_0x0655('0x16')](0xc8)[_0x0655('0x29')]({'error':![],'message':_0x0655('0x3b')});})[_0x0655('0x1c')](handleError(_0x36434a));};exports['calls']=function(_0xf018d6,_0x530276){logger[_0x0655('0x26')](_0x0655('0x3c'),_0x530276[_0x0655('0x28')]);var _0x589fc3=callsValidation[_0x0655('0xb')](_0xf018d6[_0x0655('0x28')]);if(_0x589fc3[_0x0655('0x23')]>0x0){return _0x530276['status'](0x190)[_0x0655('0x29')](_0x589fc3);}var _0x58f7e7=_0xf018d6[_0x0655('0x28')][_0x0655('0x31')];var _0x2416e0=respondWithRpcPromise(_0x0655('0x3d'));var _0x51422a=getAgent(_0x58f7e7);return Promise[_0x0655('0x1f')]([_0x2416e0,_0x51422a])[_0x0655('0x19')](function(_0x36cb69){var _0x3be09d=_0x36cb69[0x0];var _0x343c81=_0x36cb69[0x1];var _0x5c4014=_[_0x0655('0x20')](_0x3be09d[_0x0655('0x3e')],function(_0x8a7db8){return _0x8a7db8[_0x0655('0x21')]==_0x343c81['id'];});return _0x530276[_0x0655('0x16')](0xc8)[_0x0655('0x29')]({'count':_0x5c4014[_0x0655('0x23')],'rows':_0x5c4014});})[_0x0655('0x1c')](handleError(_0x530276));};exports[_0x0655('0x3f')]=function(_0x2abedc,_0x5f3dda){logger[_0x0655('0x26')]('conference\x20fired:',_0x2abedc[_0x0655('0x28')]);var _0x23f666=conferenceValidation[_0x0655('0xb')](_0x2abedc[_0x0655('0x28')]);if(_0x23f666[_0x0655('0x23')]>0x0){return _0x5f3dda[_0x0655('0x16')](0x190)['json'](_0x23f666);}var _0x480a02=_0x2abedc['body']['userId'];return getAgent(_0x480a02)[_0x0655('0x19')](function(_0x487198){logger[_0x0655('0x26')](_0x0655('0x2c'),_0x487198['name']);emit(util[_0x0655('0x2d')](_0x0655('0x2e'),_0x487198['name']),_0x0655('0x40'));return _0x5f3dda['status'](0xc8)[_0x0655('0x29')]({'error':![],'message':_0x0655('0x41')});})[_0x0655('0x1c')](handleError(_0x5f3dda));};exports[_0x0655('0x42')]=function(_0x2f5100,_0x35a1f4){logger[_0x0655('0x26')](_0x0655('0x43'),_0x2f5100['body']);var _0x3865d2=transferValidation[_0x0655('0xb')](_0x2f5100[_0x0655('0x28')]);if(_0x3865d2[_0x0655('0x23')]>0x0){return _0x35a1f4[_0x0655('0x16')](0x190)[_0x0655('0x29')](_0x3865d2);}var _0x16c558=_0x2f5100[_0x0655('0x28')][_0x0655('0x31')];var _0x4b7dc8=_0x2f5100[_0x0655('0x28')][_0x0655('0x22')];var _0x1f280a=_0x2f5100[_0x0655('0x28')][_0x0655('0x44')];return getAgent(_0x16c558)['then'](function(_0x5960d5){logger['info']('entityFound:',_0x5960d5[_0x0655('0x15')]);emit(util[_0x0655('0x2d')](_0x0655('0x2e'),_0x5960d5[_0x0655('0x15')]),'webbar:transfer',{'sessionId':_0x4b7dc8,'transferNumber':_0x1f280a});return _0x35a1f4[_0x0655('0x16')](0xc8)[_0x0655('0x29')]({'error':![],'message':_0x0655('0x45')});})['catch'](handleError(_0x35a1f4));}; \ No newline at end of file +var _0x24b3=['../../mysqldb','util','http','../../config/logger','ioredis','localhost','socket.io-emitter','redis','string','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','then','message','catch','User','findOne','agent','VoiceChannels','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','length','json','userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','conference\x20fired:','webbar:conference','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash'];(function(_0x29eaaf,_0x18cc33){var _0xd350fc=function(_0x3c6474){while(--_0x3c6474){_0x29eaaf['push'](_0x29eaaf['shift']());}};_0xd350fc(++_0x18cc33);}(_0x24b3,0xd3));var _0x324b=function(_0x28ac11,_0x57ba78){_0x28ac11=_0x28ac11-0x0;var _0x14e3bf=_0x24b3[_0x28ac11];return _0x14e3bf;};'use strict';var path=require(_0x324b('0x0'));var fs=require('fs');var _=require(_0x324b('0x1'));var db=require(_0x324b('0x2'))['db'];var config=require('../../config/environment');var util=require(_0x324b('0x3'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x324b('0x4')]({'port':0x232a});var logger=require(_0x324b('0x5'))('webbarapi');var Redis=require(_0x324b('0x6'));config['redis']=_['defaults'](config['redis'],{'host':_0x324b('0x7'),'port':0x18eb});var io=require(_0x324b('0x8'))(new Redis(config[_0x324b('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x324b('0xa'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x324b('0xa')},'callbackUrl':{'type':_0x324b('0xa')}});var hangupValidation=new Schema({'userId':{'type':_0x324b('0xb'),'required':[!![],_0x324b('0xc')]},'sessionId':{'type':_0x324b('0xa'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x324b('0xb'),'required':[!![],_0x324b('0xc')]},'sessionId':{'type':_0x324b('0xa'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x324b('0xb'),'required':[!![],_0x324b('0xc')]},'sessionId':{'type':'string','required':[!![],_0x324b('0xd')]},'transferNumber':{'type':_0x324b('0xa'),'required':[!![],_0x324b('0xe')]}});var holdValidation=new Schema({'userId':{'type':_0x324b('0xb'),'required':[!![],_0x324b('0xc')]},'sessionId':{'type':_0x324b('0xa'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x324b('0xb'),'required':[!![],_0x324b('0xc')]},'sessionId':{'type':_0x324b('0xa'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x324b('0xb'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x324b('0xb'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x2d65ae,_0x30e7c4,_0x5ebed0){logger[_0x324b('0xf')](_0x2d65ae,_0x30e7c4,JSON[_0x324b('0x10')](_0x5ebed0));io['to'](_0x2d65ae)[_0x324b('0x11')](_0x30e7c4,_0x5ebed0);}function handleError(_0x1f797c){return function(_0x209104){console[_0x324b('0x12')](_0x324b('0x13'),_0x209104,_0x209104 instanceof RangeError);logger[_0x324b('0x14')](_0x209104[_0x324b('0x15')]);if(_0x209104 instanceof RangeError){if(_0x209104[_0x324b('0x16')]){delete _0x209104[_0x324b('0x16')];}_0x1f797c[_0x324b('0x17')](0x194)[_0x324b('0x18')](_0x209104);}else{if(_0x209104['name']){delete _0x209104['name'];}_0x1f797c[_0x324b('0x17')](0x1f4)['send'](_0x209104);}};}function checkError(){return function(_0xb34f7){if(!_0xb34f7){throw new RangeError('NotFound');}return _0xb34f7;};}function respondWithRpcPromise(_0x1fb9ed,_0x49c3f5){return new BPromise(function(_0x1df4b5,_0x397cd3){var _0x30091d=amiClient;return _0x30091d['request'](_0x1fb9ed,_0x49c3f5)[_0x324b('0x19')](function(_0xdc74d2){if(_0xdc74d2[_0x324b('0x14')]){if(_0xdc74d2['error']['code']===0x1f4){return _0x397cd3(_0xdc74d2[_0x324b('0x14')]['message']);}return _0x1df4b5(_0xdc74d2[_0x324b('0x14')][_0x324b('0x1a')]);}else{_0x1df4b5(_0xdc74d2['result']);}})[_0x324b('0x1b')](function(_0x51c3ad){_0x397cd3(_0x51c3ad);});});}function getAgent(_0x38996d){return db[_0x324b('0x1c')][_0x324b('0x1d')]({'where':{'id':_0x38996d,'role':_0x324b('0x1e')}})[_0x324b('0x19')](checkError());}function getAgentCheckSession(_0x12815b,_0x46f79a){return new BPromise(function(_0x48bb79,_0x1b7587){var _0x19241a=respondWithRpcPromise(_0x324b('0x1f'));var _0x3656d0=getAgent(_0x12815b);Promise['all']([_0x19241a,_0x3656d0])[_0x324b('0x19')](function(_0x10fb26){var _0x4cc6b4=_0x10fb26[0x0];var _0x33d541=_0x10fb26[0x1];var _0x573dc1=_['filter'](_0x4cc6b4[_0x324b('0x20')],function(_0xfbe94d){return _0xfbe94d[_0x324b('0x21')]==_0x33d541['id']&&_0xfbe94d[_0x324b('0x22')]==_0x46f79a;});if(_0x573dc1['length']==0x1){_0x48bb79(_0x33d541);}else{_0x1b7587(new RangeError(_0x324b('0x23')+_0x46f79a+_0x324b('0x24')));}});});}exports[_0x324b('0x25')]=function(_0xcf1dc8,_0x2b124c){logger[_0x324b('0xf')](_0x324b('0x26'),_0xcf1dc8[_0x324b('0x27')]);var _0x4b8084=originateValidation[_0x324b('0x28')](_0xcf1dc8['body']);if(_0x4b8084[_0x324b('0x29')]>0x0){return _0x2b124c[_0x324b('0x17')](0x190)[_0x324b('0x2a')](_0x4b8084);}var _0x2c4ca5=_0xcf1dc8[_0x324b('0x27')][_0x324b('0x2b')];var _0x5c2ab7=_0xcf1dc8['body'][_0x324b('0x2c')];var _0x2cb875=_0xcf1dc8[_0x324b('0x27')][_0x324b('0x2d')];var _0x154d16=_0xcf1dc8[_0x324b('0x27')]['callbackUrl'];return getAgent(_0x2c4ca5)[_0x324b('0x19')](function(_0x1e6729){logger[_0x324b('0xf')](_0x324b('0x2e'),_0x1e6729[_0x324b('0x16')]);emit(util[_0x324b('0x2f')](_0x324b('0x30'),_0x1e6729[_0x324b('0x16')]),_0x324b('0x31'),{'callNumber':_0x5c2ab7,'callerId':_0x2cb875,'callbackUrl':_0x154d16});return _0x2b124c[_0x324b('0x17')](0xc8)[_0x324b('0x2a')]({'error':![],'message':_0x324b('0x32')});})['catch'](handleError(_0x2b124c));};exports[_0x324b('0x33')]=function(_0x5eeb18,_0x300c96){logger[_0x324b('0xf')]('hangup\x20fired:',_0x5eeb18[_0x324b('0x27')]);var _0x4b560d=hangupValidation[_0x324b('0x28')](_0x5eeb18['body']);if(_0x4b560d[_0x324b('0x29')]>0x0){return _0x300c96[_0x324b('0x17')](0x190)['json'](_0x4b560d);}var _0x2216d2=_0x5eeb18[_0x324b('0x27')]['userId'];var _0x4e5f5d=_0x5eeb18['body'][_0x324b('0x22')];return getAgent(_0x2216d2)['then'](function(_0x37554d){logger[_0x324b('0xf')](_0x324b('0x2e'),_0x37554d[_0x324b('0x16')]);emit(util[_0x324b('0x2f')]('user:%s',_0x37554d[_0x324b('0x16')]),_0x324b('0x34'),{'sessionId':_0x4e5f5d});return _0x300c96[_0x324b('0x17')](0xc8)['json']({'error':![],'message':_0x324b('0x35')});})[_0x324b('0x1b')](handleError(_0x300c96));};exports[_0x324b('0x36')]=function(_0x228c4f,_0x1a9473){logger[_0x324b('0xf')](_0x324b('0x37'),_0x228c4f[_0x324b('0x27')]);var _0x512ef3=answerValidation[_0x324b('0x28')](_0x228c4f[_0x324b('0x27')]);if(_0x512ef3['length']>0x0){return _0x1a9473[_0x324b('0x17')](0x190)[_0x324b('0x2a')](_0x512ef3);}var _0x484d65=_0x228c4f[_0x324b('0x27')]['userId'];var _0x1f797a=_0x228c4f[_0x324b('0x27')][_0x324b('0x22')];return getAgent(_0x484d65)[_0x324b('0x19')](function(_0x2b517c){logger[_0x324b('0xf')](_0x324b('0x2e'),_0x2b517c[_0x324b('0x16')]);emit(util['format'](_0x324b('0x30'),_0x2b517c['name']),_0x324b('0x38'),{'sessionId':_0x1f797a});return _0x1a9473['status'](0xc8)[_0x324b('0x2a')]({'error':![],'message':_0x324b('0x39')});})['catch'](handleError(_0x1a9473));};exports[_0x324b('0x3a')]=function(_0x5afd22,_0x4a98ed){logger[_0x324b('0xf')](_0x324b('0x3b'),_0x5afd22[_0x324b('0x27')]);var _0x3b123d=holdValidation[_0x324b('0x28')](_0x5afd22[_0x324b('0x27')]);if(_0x3b123d[_0x324b('0x29')]>0x0){return _0x4a98ed[_0x324b('0x17')](0x190)[_0x324b('0x2a')](_0x3b123d);}var _0x453f79=_0x5afd22[_0x324b('0x27')][_0x324b('0x2b')];var _0x43e620=_0x5afd22['body'][_0x324b('0x22')];return getAgent(_0x453f79)['then'](function(_0x2dd2a7){logger[_0x324b('0xf')]('entityFound:',_0x2dd2a7[_0x324b('0x16')]);emit(util['format']('user:%s',_0x2dd2a7['name']),_0x324b('0x3c'),{'sessionId':_0x43e620});return _0x4a98ed[_0x324b('0x17')](0xc8)['json']({'error':![],'message':_0x324b('0x3d')});})[_0x324b('0x1b')](handleError(_0x4a98ed));};exports[_0x324b('0x3e')]=function(_0x11d75e,_0x17023b){logger[_0x324b('0xf')](_0x324b('0x3f'),_0x11d75e[_0x324b('0x27')]);var _0xe196e1=unholdValidation[_0x324b('0x28')](_0x11d75e['body']);if(_0xe196e1[_0x324b('0x29')]>0x0){return _0x17023b[_0x324b('0x17')](0x190)[_0x324b('0x2a')](_0xe196e1);}var _0x1b6b74=_0x11d75e[_0x324b('0x27')]['userId'];var _0x5e9b5e=_0x11d75e[_0x324b('0x27')][_0x324b('0x22')];return getAgent(_0x1b6b74)[_0x324b('0x19')](function(_0x1edfb3){logger[_0x324b('0xf')]('entityFound:',_0x1edfb3[_0x324b('0x16')]);emit(util[_0x324b('0x2f')](_0x324b('0x30'),_0x1edfb3[_0x324b('0x16')]),_0x324b('0x40'),{'sessionId':_0x5e9b5e});return _0x17023b['status'](0xc8)[_0x324b('0x2a')]({'error':![],'message':_0x324b('0x41')});})[_0x324b('0x1b')](handleError(_0x17023b));};exports['calls']=function(_0x259c22,_0x28baea){logger['info']('calls\x20fired:',_0x28baea['body']);var _0x41f286=callsValidation[_0x324b('0x28')](_0x259c22[_0x324b('0x27')]);if(_0x41f286[_0x324b('0x29')]>0x0){return _0x28baea['status'](0x190)['json'](_0x41f286);}var _0x5918e6=_0x259c22[_0x324b('0x27')][_0x324b('0x2b')];var _0x5c5a2a=respondWithRpcPromise(_0x324b('0x1f'));var _0x5be4ee=getAgent(_0x5918e6);return Promise['all']([_0x5c5a2a,_0x5be4ee])[_0x324b('0x19')](function(_0x1d96db){var _0x5223cd=_0x1d96db[0x0];var _0x365ebc=_0x1d96db[0x1];var _0x543ed1=_['filter'](_0x5223cd['rows'],function(_0x1a86a7){return _0x1a86a7[_0x324b('0x21')]==_0x365ebc['id'];});return _0x28baea[_0x324b('0x17')](0xc8)[_0x324b('0x2a')]({'count':_0x543ed1[_0x324b('0x29')],'rows':_0x543ed1});})[_0x324b('0x1b')](handleError(_0x28baea));};exports['conference']=function(_0x59affe,_0x2c10b1){logger[_0x324b('0xf')](_0x324b('0x42'),_0x59affe['body']);var _0x4b6cff=conferenceValidation['validate'](_0x59affe[_0x324b('0x27')]);if(_0x4b6cff[_0x324b('0x29')]>0x0){return _0x2c10b1[_0x324b('0x17')](0x190)['json'](_0x4b6cff);}var _0x1d87bd=_0x59affe[_0x324b('0x27')][_0x324b('0x2b')];return getAgent(_0x1d87bd)[_0x324b('0x19')](function(_0x4f0b04){logger['info'](_0x324b('0x2e'),_0x4f0b04['name']);emit(util[_0x324b('0x2f')](_0x324b('0x30'),_0x4f0b04[_0x324b('0x16')]),_0x324b('0x43'));return _0x2c10b1[_0x324b('0x17')](0xc8)[_0x324b('0x2a')]({'error':![],'message':'conference\x20executed!'});})[_0x324b('0x1b')](handleError(_0x2c10b1));};exports['transfer']=function(_0x4c84ee,_0xb0cd27){logger[_0x324b('0xf')]('transfer\x20fired:',_0x4c84ee[_0x324b('0x27')]);var _0x2cef0c=transferValidation[_0x324b('0x28')](_0x4c84ee[_0x324b('0x27')]);if(_0x2cef0c[_0x324b('0x29')]>0x0){return _0xb0cd27[_0x324b('0x17')](0x190)['json'](_0x2cef0c);}var _0x135151=_0x4c84ee[_0x324b('0x27')][_0x324b('0x2b')];var _0x46869b=_0x4c84ee[_0x324b('0x27')][_0x324b('0x22')];var _0x5198f5=_0x4c84ee[_0x324b('0x27')][_0x324b('0x44')];return getAgent(_0x135151)[_0x324b('0x19')](function(_0x13d571){logger[_0x324b('0xf')](_0x324b('0x2e'),_0x13d571[_0x324b('0x16')]);emit(util[_0x324b('0x2f')](_0x324b('0x30'),_0x13d571[_0x324b('0x16')]),_0x324b('0x45'),{'sessionId':_0x46869b,'transferNumber':_0x5198f5});return _0xb0cd27[_0x324b('0x17')](0xc8)[_0x324b('0x2a')]({'error':![],'message':_0x324b('0x46')});})[_0x324b('0x1b')](handleError(_0xb0cd27));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index d40e3c9..d2f949e 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 _0x4bc6=['isAuthenticated','/describe','describe','/:id','/:id/dispositions','/:id/applications','post','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get'];(function(_0x450b86,_0x5e85ce){var _0x2f2b45=function(_0x203667){while(--_0x203667){_0x450b86['push'](_0x450b86['shift']());}};_0x2f2b45(++_0x5e85ce);}(_0x4bc6,0x157));var _0x64bc=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x4bc6[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require(_0x64bc('0x0'));var util=require(_0x64bc('0x1'));var path=require('path');var timeout=require(_0x64bc('0x2'));var express=require(_0x64bc('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x64bc('0x4'));var interaction=require(_0x64bc('0x5'));var config=require(_0x64bc('0x6'));var controller=require(_0x64bc('0x7'));router[_0x64bc('0x8')]('/',auth[_0x64bc('0x9')](),controller['index']);router[_0x64bc('0x8')](_0x64bc('0xa'),auth['isAuthenticated'](),controller[_0x64bc('0xb')]);router[_0x64bc('0x8')](_0x64bc('0xc'),auth[_0x64bc('0x9')](),controller['show']);router[_0x64bc('0x8')](_0x64bc('0xd'),auth[_0x64bc('0x9')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x64bc('0x9')](),controller['getAnswers']);router[_0x64bc('0x8')]('/:id/users',auth[_0x64bc('0x9')](),controller['getAgents']);router[_0x64bc('0x8')](_0x64bc('0xe'),auth[_0x64bc('0x9')](),controller['getApplications']);router[_0x64bc('0xf')]('/',auth[_0x64bc('0x9')](),controller['create']);router[_0x64bc('0xf')](_0x64bc('0xd'),auth[_0x64bc('0x9')](),controller['addDisposition']);router[_0x64bc('0xf')]('/:id/canned_answers',auth[_0x64bc('0x9')](),controller[_0x64bc('0x10')]);router['post'](_0x64bc('0x11'),auth[_0x64bc('0x9')](),controller[_0x64bc('0x12')]);router[_0x64bc('0xf')](_0x64bc('0xe'),auth[_0x64bc('0x9')](),controller[_0x64bc('0x13')]);router['post'](_0x64bc('0x14'),controller[_0x64bc('0x15')]);router[_0x64bc('0xf')](_0x64bc('0x16'),auth[_0x64bc('0x9')](),controller[_0x64bc('0x17')]);router[_0x64bc('0x18')](_0x64bc('0xc'),auth[_0x64bc('0x9')](),controller['update']);router[_0x64bc('0x19')](_0x64bc('0xc'),auth[_0x64bc('0x9')](),controller[_0x64bc('0x1a')]);router['delete'](_0x64bc('0xd'),auth[_0x64bc('0x9')](),controller[_0x64bc('0x1b')]);router[_0x64bc('0x19')](_0x64bc('0x1c'),auth[_0x64bc('0x9')](),controller[_0x64bc('0x1d')]);router[_0x64bc('0x19')](_0x64bc('0x11'),auth[_0x64bc('0x9')](),controller[_0x64bc('0x1e')]);module[_0x64bc('0x1f')]=router; \ No newline at end of file +var _0xd2bd=['addAnswer','addAgents','/:id/applications','addApplications','/:id/notify','notify','send','put','update','destroy','delete','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','/describe','isAuthenticated','describe','/:id','get','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications','post','create'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd2bd,0xc1));var _0xdd2b=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0xd2bd[_0x2dd390];return _0x3afe47;};'use strict';var multer=require(_0xdd2b('0x0'));var util=require(_0xdd2b('0x1'));var path=require(_0xdd2b('0x2'));var timeout=require(_0xdd2b('0x3'));var express=require(_0xdd2b('0x4'));var router=express[_0xdd2b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdd2b('0x6'));var config=require(_0xdd2b('0x7'));var controller=require(_0xdd2b('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xdd2b('0x9'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0xb')]);router['get'](_0xdd2b('0xc'),auth[_0xdd2b('0xa')](),controller['show']);router[_0xdd2b('0xd')](_0xdd2b('0xe'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0xf')]);router[_0xdd2b('0xd')](_0xdd2b('0x10'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x11')]);router['get'](_0xdd2b('0x12'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x13')]);router['get']('/:id/applications',auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x14')]);router[_0xdd2b('0x15')]('/',auth['isAuthenticated'](),controller[_0xdd2b('0x16')]);router[_0xdd2b('0x15')](_0xdd2b('0xe'),auth[_0xdd2b('0xa')](),controller['addDisposition']);router[_0xdd2b('0x15')](_0xdd2b('0x10'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x17')]);router[_0xdd2b('0x15')]('/:id/users',auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x18')]);router['post'](_0xdd2b('0x19'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x1a')]);router[_0xdd2b('0x15')](_0xdd2b('0x1b'),controller[_0xdd2b('0x1c')]);router['post']('/:id/send',auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x1d')]);router[_0xdd2b('0x1e')](_0xdd2b('0xc'),auth['isAuthenticated'](),controller[_0xdd2b('0x1f')]);router['delete'](_0xdd2b('0xc'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x20')]);router[_0xdd2b('0x21')](_0xdd2b('0xe'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x22')]);router[_0xdd2b('0x21')](_0xdd2b('0x10'),auth[_0xdd2b('0xa')](),controller[_0xdd2b('0x23')]);router[_0xdd2b('0x21')](_0xdd2b('0x12'),auth[_0xdd2b('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 487685e..6a7a578 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 _0x755c=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING'];(function(_0x2df832,_0x240a8c){var _0x575133=function(_0x3e8606){while(--_0x3e8606){_0x2df832['push'](_0x2df832['shift']());}};_0x575133(++_0x240a8c);}(_0x755c,0x1a2));var _0xc755=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x755c[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xc755('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xc755('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xc755('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xc755('0x1')]},'type':{'type':Sequelize['ENUM']('twilio','sinch')},'accountSid':{'type':Sequelize[_0xc755('0x1')]},'baseUrl':{'type':Sequelize[_0xc755('0x1')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xc755('0x2')],'defaultValue':function(){return _0xc755('0x3');}},'notificationSound':{'type':Sequelize[_0xc755('0x4')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xc755('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc755('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc755('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc755('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc755('0x5')],'comment':_0xc755('0x6')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x42c7ef){if(!_0x42c7ef){this[_0xc755('0x7')](_0xc755('0x8'),null);}this['setDataValue'](_0xc755('0x9'),_0x42c7ef);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8f3=['sequelize','randomstring','exports','STRING','name','generate','ENUM','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition'];(function(_0x2654ec,_0x30d1ba){var _0x4c3b5=function(_0x464e80){while(--_0x464e80){_0x2654ec['push'](_0x2654ec['shift']());}};_0x4c3b5(++_0x30d1ba);}(_0xd8f3,0xc4));var _0x3d8f=function(_0x38de8f,_0x355e35){_0x38de8f=_0x38de8f-0x0;var _0x59cadf=_0xd8f3[_0x38de8f];return _0x59cadf;};'use strict';var Sequelize=require(_0x3d8f('0x0'));var rs=require(_0x3d8f('0x1'));module[_0x3d8f('0x2')]={'name':{'type':Sequelize[_0x3d8f('0x3')],'unique':_0x3d8f('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x3d8f('0x3')],'defaultValue':function(){return rs[_0x3d8f('0x5')]();}},'phone':{'type':Sequelize[_0x3d8f('0x3')]},'type':{'type':Sequelize[_0x3d8f('0x6')]('twilio',_0x3d8f('0x7'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x3d8f('0x3')]},'authToken':{'type':Sequelize[_0x3d8f('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3d8f('0x8')],'defaultValue':function(){return _0x3d8f('0x9');}},'notificationSound':{'type':Sequelize[_0x3d8f('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3d8f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3d8f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3d8f('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3d8f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3d8f('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3d8f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3d8f('0xb')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3d8f('0xa')],'defaultValue':![],'comment':_0x3d8f('0xc'),'set':function(_0x4ad3c8){if(!_0x4ad3c8){this['setDataValue']('mandatoryDispositionPauseId',null);}this['setDataValue'](_0x3d8f('0xd'),_0x4ad3c8);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index ed996c6..c9b03e4 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 _0xd7da=['messageId','message_id','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','WhatsappInteraction','interaction','created','autoclose','close','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','queueId','WhatsappQueue','waitForTheAssignedQueue','Start','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','push','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','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','limit','count','set','Content-Range','apply','reject','destroy','get','WhatsappAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','map','VIRTUAL','options','includeAll','include','WhatsappAccount','findAll','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','describe','WhatsappAccountId','Disposition','getDispositions','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','WhatsappMessage','update','applications','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','twilio','From','whatsapp:','MessageSid','from','notifications'];(function(_0xa3c06b,_0x490f99){var _0x33aa1d=function(_0x23a88e){while(--_0x23a88e){_0xa3c06b['push'](_0xa3c06b['shift']());}};_0x33aa1d(++_0x490f99);}(_0xd7da,0xec));var _0xad7d=function(_0x35f7c8,_0x4808eb){_0x35f7c8=_0x35f7c8-0x0;var _0x30bda5=_0xd7da[_0x35f7c8];return _0x30bda5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xad7d('0x0'));var jsonpatch=require(_0xad7d('0x1'));var rp=require(_0xad7d('0x2'));var moment=require(_0xad7d('0x3'));var BPromise=require(_0xad7d('0x4'));var Mustache=require(_0xad7d('0x5'));var util=require(_0xad7d('0x6'));var path=require(_0xad7d('0x7'));var sox=require('sox');var csv=require(_0xad7d('0x8'));var ejs=require(_0xad7d('0x9'));var fs=require('fs');var fs_extra=require(_0xad7d('0xa'));var _=require(_0xad7d('0xb'));var squel=require('squel');var crypto=require(_0xad7d('0xc'));var jsforce=require(_0xad7d('0xd'));var deskjs=require(_0xad7d('0xe'));var toCsv=require(_0xad7d('0x8'));var querystring=require('querystring');var Papa=require(_0xad7d('0xf'));var Redis=require(_0xad7d('0x10'));var authService=require(_0xad7d('0x11'));var qs=require(_0xad7d('0x12'));var as=require(_0xad7d('0x13'));var hardwareService=require(_0xad7d('0x14'));var logger=require(_0xad7d('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xad7d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xad7d('0x17'))['db'];config[_0xad7d('0x18')]=_[_0xad7d('0x19')](config[_0xad7d('0x18')],{'host':_0xad7d('0x1a'),'port':0x18eb});var socket=require(_0xad7d('0x1b'))(new Redis(config[_0xad7d('0x18')]));require(_0xad7d('0x1c'))[_0xad7d('0x1d')](socket);var jayson=require(_0xad7d('0x1e'));var client=jayson[_0xad7d('0x1f')][_0xad7d('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x4884a9,_0x2ca2cf,_0x432aa4,_0x12e295){return new BPromise(function(_0xafc809,_0xd92cac){var _0x783ca3=_0x12e295||client;return _0x783ca3[_0xad7d('0x21')](_0x4884a9,_0x432aa4)[_0xad7d('0x22')](function(_0x2fc087){logger[_0xad7d('0x23')](_0xad7d('0x24'),_0x2ca2cf,_0xad7d('0x25'));logger[_0xad7d('0x26')](_0xad7d('0x27'),_0x2ca2cf,'request\x20sent',JSON[_0xad7d('0x28')](_0x2fc087));if(_0x2fc087[_0xad7d('0x29')]){if(_0x2fc087[_0xad7d('0x29')][_0xad7d('0x2a')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x2ca2cf,_0x2fc087['error']['message']);return _0xd92cac(_0x2fc087[_0xad7d('0x29')][_0xad7d('0x2b')]);}logger[_0xad7d('0x29')](_0xad7d('0x24'),_0x2ca2cf,_0x2fc087[_0xad7d('0x29')][_0xad7d('0x2b')]);return _0xafc809(_0x2fc087['error'][_0xad7d('0x2b')]);}else{logger['info'](_0xad7d('0x24'),_0x2ca2cf,'request\x20sent');_0xafc809(_0x2fc087[_0xad7d('0x2c')][_0xad7d('0x2b')]);}})[_0xad7d('0x2d')](function(_0x34706f){logger['error'](_0xad7d('0x24'),_0x2ca2cf,_0x34706f);_0xd92cac(_0x34706f);});});}function respondWithStatusCode(_0x5c6c77,_0x5bdae8){_0x5bdae8=_0x5bdae8||0xcc;return function(_0x19a048){if(_0x19a048){return _0x5c6c77[_0xad7d('0x2e')](_0x5bdae8);}return _0x5c6c77[_0xad7d('0x2f')](_0x5bdae8)[_0xad7d('0x30')]();};}function respondWithResult(_0x4c070a,_0x44b24f){_0x44b24f=_0x44b24f||0xc8;return function(_0x59bcec){if(_0x59bcec){return _0x4c070a[_0xad7d('0x2f')](_0x44b24f)[_0xad7d('0x31')](_0x59bcec);}};}function respondWithFilteredResult(_0x483640,_0x4da608){return function(_0x5df38e){if(_0x5df38e){var _0x4a88e4=typeof _0x4da608[_0xad7d('0x32')]==='undefined'&&typeof _0x4da608[_0xad7d('0x33')]==='undefined';var _0x5586ef=_0x5df38e[_0xad7d('0x34')];var _0x4686dc=_0x4a88e4?0x0:_0x4da608[_0xad7d('0x32')];var _0x49ec2b=_0x4a88e4?_0x5df38e[_0xad7d('0x34')]:_0x4da608[_0xad7d('0x32')]+_0x4da608[_0xad7d('0x33')];var _0x2b60d8;if(_0x49ec2b>=_0x5586ef){_0x49ec2b=_0x5586ef;_0x2b60d8=0xc8;}else{_0x2b60d8=0xce;}_0x483640[_0xad7d('0x2f')](_0x2b60d8);return _0x483640[_0xad7d('0x35')](_0xad7d('0x36'),_0x4686dc+'-'+_0x49ec2b+'/'+_0x5586ef)['json'](_0x5df38e);}return null;};}function patchUpdates(_0x29c9ff){return function(_0xd1d438){try{jsonpatch[_0xad7d('0x37')](_0xd1d438,_0x29c9ff,!![]);}catch(_0x178832){return BPromise[_0xad7d('0x38')](_0x178832);}return _0xd1d438['save']();};}function saveUpdates(_0x115dd7,_0x310f3d){return function(_0x2fdee7){if(_0x2fdee7){return _0x2fdee7['update'](_0x115dd7)[_0xad7d('0x22')](function(_0x28de40){return _0x28de40;});}return null;};}function removeEntity(_0x1e3669,_0x22c104){return function(_0x3649fa){if(_0x3649fa){return _0x3649fa[_0xad7d('0x39')]()['then'](function(){var _0x20cd69=_0x3649fa[_0xad7d('0x3a')]({'plain':!![]});var _0x5e7d7b=_0xad7d('0x3b');return db[_0xad7d('0x3c')][_0xad7d('0x39')]({'where':{'type':_0x5e7d7b,'resourceId':_0x20cd69['id']}})['then'](function(){return _0x3649fa;});})['then'](function(){_0x1e3669['status'](0xcc)[_0xad7d('0x30')]();});}};}function handleEntityNotFound(_0x2e85c4,_0x4fcdc2){return function(_0x378ecb){if(!_0x378ecb){_0x2e85c4[_0xad7d('0x2e')](0x194);}return _0x378ecb;};}function handleError(_0x59db3d,_0x3db0ef){_0x3db0ef=_0x3db0ef||0x1f4;return function(_0x38a324){logger['error'](_0x38a324['stack']);if(_0x38a324[_0xad7d('0x3d')]){delete _0x38a324[_0xad7d('0x3d')];}_0x59db3d[_0xad7d('0x2f')](_0x3db0ef)[_0xad7d('0x3e')](_0x38a324);};}exports[_0xad7d('0x3f')]=function(_0x42a4d1,_0x4d997f){var _0x3abfcd={'include':[{'model':db['Pause'],'as':_0xad7d('0x40')}]},_0x2e7e51={},_0x7a7418={'count':0x0,'rows':[]};var _0x4d2330=_['map'](db['WhatsappAccount'][_0xad7d('0x41')],function(_0x998fb){return{'name':_0x998fb[_0xad7d('0x42')],'type':_0x998fb[_0xad7d('0x43')][_0xad7d('0x44')]};});_0x2e7e51[_0xad7d('0x45')]=_['map'](_0x4d2330,_0xad7d('0x3d'));_0x2e7e51[_0xad7d('0x46')]=_[_0xad7d('0x47')](_0x42a4d1[_0xad7d('0x46')]);_0x2e7e51[_0xad7d('0x48')]=_[_0xad7d('0x49')](_0x2e7e51[_0xad7d('0x45')],_0x2e7e51['query']);_0x3abfcd[_0xad7d('0x4a')]=_[_0xad7d('0x49')](_0x2e7e51[_0xad7d('0x45')],qs[_0xad7d('0x4b')](_0x42a4d1[_0xad7d('0x46')][_0xad7d('0x4b')]));_0x3abfcd[_0xad7d('0x4a')]=_0x3abfcd[_0xad7d('0x4a')]['length']?_0x3abfcd['attributes']:_0x2e7e51['model'];if(!_0x42a4d1[_0xad7d('0x46')][_0xad7d('0x4c')](_0xad7d('0x4d'))){_0x3abfcd[_0xad7d('0x33')]=qs[_0xad7d('0x33')](_0x42a4d1[_0xad7d('0x46')][_0xad7d('0x33')]);_0x3abfcd[_0xad7d('0x32')]=qs[_0xad7d('0x32')](_0x42a4d1[_0xad7d('0x46')][_0xad7d('0x32')]);}_0x3abfcd[_0xad7d('0x4e')]=qs[_0xad7d('0x4f')](_0x42a4d1[_0xad7d('0x46')][_0xad7d('0x4f')]);_0x3abfcd['where']=qs[_0xad7d('0x48')](_['pick'](_0x42a4d1[_0xad7d('0x46')],_0x2e7e51[_0xad7d('0x48')]),_0x4d2330);if(_0x42a4d1[_0xad7d('0x46')][_0xad7d('0x50')]){_0x3abfcd['where']=_[_0xad7d('0x51')](_0x3abfcd[_0xad7d('0x52')],{'$or':_[_0xad7d('0x53')](_0x4d2330,function(_0x3d0d29){if(_0x3d0d29[_0xad7d('0x43')]!==_0xad7d('0x54')){var _0xf3b0d5={};_0xf3b0d5[_0x3d0d29['name']]={'$like':'%'+_0x42a4d1[_0xad7d('0x46')]['filter']+'%'};return _0xf3b0d5;}})});}_0x3abfcd=_[_0xad7d('0x51')]({},_0x3abfcd,_0x42a4d1[_0xad7d('0x55')]);var _0x51a544={'where':_0x3abfcd['where']};return db['WhatsappAccount'][_0xad7d('0x34')](_0x51a544)[_0xad7d('0x22')](function(_0x50fb97){_0x7a7418[_0xad7d('0x34')]=_0x50fb97;if(_0x42a4d1[_0xad7d('0x46')][_0xad7d('0x56')]){_0x3abfcd[_0xad7d('0x57')]=[{'all':!![]}];}return db[_0xad7d('0x58')][_0xad7d('0x59')](_0x3abfcd);})[_0xad7d('0x22')](function(_0x292d5){_0x7a7418['rows']=_0x292d5;return _0x7a7418;})[_0xad7d('0x22')](respondWithFilteredResult(_0x4d997f,_0x3abfcd))[_0xad7d('0x2d')](handleError(_0x4d997f,null));};exports['show']=function(_0x485583,_0x4b1c7d){var _0x236c11={'raw':![],'where':{'id':_0x485583[_0xad7d('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0xad7d('0x40')}]},_0x1efdbd={};_0x1efdbd[_0xad7d('0x45')]=_[_0xad7d('0x47')](db[_0xad7d('0x58')][_0xad7d('0x41')]);_0x1efdbd[_0xad7d('0x46')]=_[_0xad7d('0x47')](_0x485583['query']);_0x1efdbd['filters']=_['intersection'](_0x1efdbd['model'],_0x1efdbd['query']);_0x236c11['attributes']=_[_0xad7d('0x49')](_0x1efdbd[_0xad7d('0x45')],qs[_0xad7d('0x4b')](_0x485583[_0xad7d('0x46')]['fields']));_0x236c11[_0xad7d('0x4a')]=_0x236c11[_0xad7d('0x4a')][_0xad7d('0x5b')]?_0x236c11['attributes']:_0x1efdbd[_0xad7d('0x45')];if(_0x485583[_0xad7d('0x46')]['includeAll']){_0x236c11['include']=[{'all':!![]}];}_0x236c11=_[_0xad7d('0x51')]({},_0x236c11,_0x485583['options']);return db[_0xad7d('0x58')][_0xad7d('0x5c')](_0x236c11)['then'](handleEntityNotFound(_0x4b1c7d,null))[_0xad7d('0x22')](respondWithResult(_0x4b1c7d,null))[_0xad7d('0x2d')](handleError(_0x4b1c7d,null));};exports['create']=function(_0x19f05c,_0x2315c8){return db[_0xad7d('0x58')][_0xad7d('0x5d')](_0x19f05c['body'],{})[_0xad7d('0x22')](function(_0x470197){var _0x1aca5f=_0x19f05c[_0xad7d('0x5e')][_0xad7d('0x3a')]({'plain':!![]});if(!_0x1aca5f)throw new Error(_0xad7d('0x5f'));if(_0x1aca5f['role']===_0xad7d('0x5e')){var _0x5e5ecf=_0x470197[_0xad7d('0x3a')]({'plain':!![]});var _0x583ee2=_0xad7d('0x3b');return db[_0xad7d('0x60')]['find']({'where':{'name':_0x583ee2,'userProfileId':_0x1aca5f[_0xad7d('0x61')]},'raw':!![]})[_0xad7d('0x22')](function(_0x5dcc35){if(_0x5dcc35&&_0x5dcc35[_0xad7d('0x62')]===0x0){return db[_0xad7d('0x3c')]['create']({'name':_0x5e5ecf['name'],'resourceId':_0x5e5ecf['id'],'type':_0x5dcc35[_0xad7d('0x3d')],'sectionId':_0x5dcc35['id']},{})[_0xad7d('0x22')](function(){return _0x470197;});}else{return _0x470197;}})[_0xad7d('0x2d')](function(_0x3b6364){logger['error'](_0xad7d('0x63'),_0x3b6364);throw _0x3b6364;});}return _0x470197;})[_0xad7d('0x22')](respondWithResult(_0x2315c8,0xc9))[_0xad7d('0x2d')](handleError(_0x2315c8,null));};exports['update']=function(_0x4a169d,_0x271e0a){if(_0x4a169d[_0xad7d('0x64')]['id']){delete _0x4a169d['body']['id'];}return db[_0xad7d('0x58')][_0xad7d('0x5c')]({'where':{'id':_0x4a169d[_0xad7d('0x5a')]['id']},'include':[{'model':db[_0xad7d('0x65')],'as':_0xad7d('0x40')}]})['then'](handleEntityNotFound(_0x271e0a,null))[_0xad7d('0x22')](saveUpdates(_0x4a169d[_0xad7d('0x64')],null))['then'](respondWithResult(_0x271e0a,null))[_0xad7d('0x2d')](handleError(_0x271e0a,null));};exports[_0xad7d('0x39')]=function(_0x37d4ba,_0x150ebb){return db[_0xad7d('0x58')][_0xad7d('0x5c')]({'where':{'id':_0x37d4ba[_0xad7d('0x5a')]['id']}})[_0xad7d('0x22')](handleEntityNotFound(_0x150ebb,null))[_0xad7d('0x22')](removeEntity(_0x150ebb,null))[_0xad7d('0x2d')](handleError(_0x150ebb,null));};exports[_0xad7d('0x66')]=function(_0x1c4d59,_0x291115){return db[_0xad7d('0x58')][_0xad7d('0x66')]()['then'](respondWithResult(_0x291115,null))[_0xad7d('0x2d')](handleError(_0x291115,null));};exports['addDisposition']=function(_0x549a67,_0x10248c,_0x4bbc9e){if(_0x549a67[_0xad7d('0x64')]['id']){delete _0x549a67['body']['id'];}return db[_0xad7d('0x58')]['find']({'where':{'id':_0x549a67[_0xad7d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x10248c,null))['then'](function(_0x53c10e){if(_0x53c10e){_0x549a67[_0xad7d('0x64')][_0xad7d('0x67')]=_0x53c10e['id'];return db[_0xad7d('0x68')][_0xad7d('0x5d')](_0x549a67[_0xad7d('0x64')]);}})[_0xad7d('0x22')](respondWithResult(_0x10248c,null))[_0xad7d('0x2d')](handleError(_0x10248c,null));};exports[_0xad7d('0x69')]=function(_0x6879f8,_0x461ba3,_0x236c5f){var _0xf87b0c={'raw':![],'where':{}};var _0x56dab8={};var _0x1110a1={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x6879f8['params']['id']}})[_0xad7d('0x22')](handleEntityNotFound(_0x461ba3,null))['then'](function(_0x3bdf98){if(_0x3bdf98){_0x56dab8[_0xad7d('0x45')]=_[_0xad7d('0x47')](db[_0xad7d('0x68')]['rawAttributes']);_0x56dab8[_0xad7d('0x46')]=_[_0xad7d('0x47')](_0x6879f8['query']);_0x56dab8[_0xad7d('0x48')]=_[_0xad7d('0x49')](_0x56dab8['model'],_0x56dab8['query']);_0xf87b0c[_0xad7d('0x4a')]=_[_0xad7d('0x49')](_0x56dab8[_0xad7d('0x45')],qs[_0xad7d('0x4b')](_0x6879f8[_0xad7d('0x46')][_0xad7d('0x4b')]));_0xf87b0c[_0xad7d('0x4a')]=_0xf87b0c[_0xad7d('0x4a')][_0xad7d('0x5b')]?_0xf87b0c[_0xad7d('0x4a')]:_0x56dab8[_0xad7d('0x45')];if(!_0x6879f8[_0xad7d('0x46')][_0xad7d('0x4c')](_0xad7d('0x4d'))){_0xf87b0c[_0xad7d('0x33')]=qs[_0xad7d('0x33')](_0x6879f8[_0xad7d('0x46')][_0xad7d('0x33')]);_0xf87b0c[_0xad7d('0x32')]=qs[_0xad7d('0x32')](_0x6879f8['query'][_0xad7d('0x32')]);}_0xf87b0c['order']=qs[_0xad7d('0x4f')](_0x6879f8[_0xad7d('0x46')][_0xad7d('0x4f')]);_0xf87b0c[_0xad7d('0x52')]=qs['filters'](_[_0xad7d('0x6a')](_0x6879f8[_0xad7d('0x46')],_0x56dab8[_0xad7d('0x48')]));_0xf87b0c[_0xad7d('0x52')]['WhatsappAccountId']=_0x3bdf98['id'];if(_0x6879f8[_0xad7d('0x46')][_0xad7d('0x50')]){_0xf87b0c[_0xad7d('0x52')]=_['merge'](_0xf87b0c[_0xad7d('0x52')],{'$or':_[_0xad7d('0x53')](_0xf87b0c[_0xad7d('0x4a')],function(_0x3736a3){var _0x5e539a={};_0x5e539a[_0x3736a3]={'$like':'%'+_0x6879f8[_0xad7d('0x46')][_0xad7d('0x50')]+'%'};return _0x5e539a;})});}_0xf87b0c=_[_0xad7d('0x51')]({},_0xf87b0c,_0x6879f8[_0xad7d('0x55')]);return db[_0xad7d('0x68')][_0xad7d('0x34')]({'where':_0xf87b0c[_0xad7d('0x52')]})[_0xad7d('0x22')](function(_0x1b15ef){_0x1110a1[_0xad7d('0x34')]=_0x1b15ef;if(_0x6879f8[_0xad7d('0x46')]['includeAll']){_0xf87b0c[_0xad7d('0x57')]=[{'all':!![]}];}return db[_0xad7d('0x68')][_0xad7d('0x59')](_0xf87b0c);})[_0xad7d('0x22')](function(_0x59e0d5){_0x1110a1[_0xad7d('0x6b')]=_0x59e0d5;return _0x1110a1;});}})[_0xad7d('0x22')](respondWithFilteredResult(_0x461ba3,_0xf87b0c))[_0xad7d('0x2d')](handleError(_0x461ba3,null));};exports[_0xad7d('0x6c')]=function(_0x443790,_0x4e3814,_0x4eae5c){return db[_0xad7d('0x58')][_0xad7d('0x5c')]({'where':{'id':_0x443790[_0xad7d('0x5a')]['id']}})[_0xad7d('0x22')](handleEntityNotFound(_0x4e3814,null))[_0xad7d('0x22')](function(_0xd5c422){if(_0xd5c422){return _0xd5c422['removeDispositions'](_0x443790[_0xad7d('0x46')][_0xad7d('0x6d')]);}})[_0xad7d('0x22')](respondWithStatusCode(_0x4e3814,null))[_0xad7d('0x2d')](handleError(_0x4e3814,null));};exports[_0xad7d('0x6e')]=function(_0x235854,_0x3cfbcc,_0x443a07){if(_0x235854['body']['id']){delete _0x235854[_0xad7d('0x64')]['id'];}return db[_0xad7d('0x58')][_0xad7d('0x5c')]({'where':{'id':_0x235854[_0xad7d('0x5a')]['id']}})[_0xad7d('0x22')](handleEntityNotFound(_0x3cfbcc,null))[_0xad7d('0x22')](function(_0x21749a){if(_0x21749a){_0x235854['body'][_0xad7d('0x67')]=_0x21749a['id'];return db[_0xad7d('0x6f')][_0xad7d('0x5d')](_0x235854[_0xad7d('0x64')]);}})[_0xad7d('0x22')](respondWithResult(_0x3cfbcc,null))[_0xad7d('0x2d')](handleError(_0x3cfbcc,null));};exports[_0xad7d('0x70')]=function(_0x30ef52,_0x1ae94e,_0x4d0d60){var _0x8e1f90={'raw':![],'where':{}};var _0x43781e={};var _0x29617c={'count':0x0,'rows':[]};return db[_0xad7d('0x58')][_0xad7d('0x71')]({'where':{'id':_0x30ef52[_0xad7d('0x5a')]['id']}})[_0xad7d('0x22')](handleEntityNotFound(_0x1ae94e,null))['then'](function(_0x153450){if(_0x153450){_0x43781e[_0xad7d('0x45')]=_[_0xad7d('0x47')](db[_0xad7d('0x6f')][_0xad7d('0x41')]);_0x43781e[_0xad7d('0x46')]=_[_0xad7d('0x47')](_0x30ef52['query']);_0x43781e[_0xad7d('0x48')]=_[_0xad7d('0x49')](_0x43781e[_0xad7d('0x45')],_0x43781e[_0xad7d('0x46')]);_0x8e1f90['attributes']=_['intersection'](_0x43781e[_0xad7d('0x45')],qs['fields'](_0x30ef52['query'][_0xad7d('0x4b')]));_0x8e1f90[_0xad7d('0x4a')]=_0x8e1f90[_0xad7d('0x4a')][_0xad7d('0x5b')]?_0x8e1f90['attributes']:_0x43781e[_0xad7d('0x45')];if(!_0x30ef52['query'][_0xad7d('0x4c')](_0xad7d('0x4d'))){_0x8e1f90[_0xad7d('0x33')]=qs[_0xad7d('0x33')](_0x30ef52[_0xad7d('0x46')]['limit']);_0x8e1f90[_0xad7d('0x32')]=qs[_0xad7d('0x32')](_0x30ef52['query'][_0xad7d('0x32')]);}_0x8e1f90[_0xad7d('0x4e')]=qs[_0xad7d('0x4f')](_0x30ef52[_0xad7d('0x46')][_0xad7d('0x4f')]);_0x8e1f90['where']=qs[_0xad7d('0x48')](_[_0xad7d('0x6a')](_0x30ef52[_0xad7d('0x46')],_0x43781e[_0xad7d('0x48')]));_0x8e1f90['where']['WhatsappAccountId']=_0x153450['id'];if(_0x30ef52[_0xad7d('0x46')]['filter']){_0x8e1f90[_0xad7d('0x52')]=_[_0xad7d('0x51')](_0x8e1f90['where'],{'$or':_[_0xad7d('0x53')](_0x8e1f90[_0xad7d('0x4a')],function(_0x2ed725){var _0x3491d5={};_0x3491d5[_0x2ed725]={'$like':'%'+_0x30ef52[_0xad7d('0x46')][_0xad7d('0x50')]+'%'};return _0x3491d5;})});}_0x8e1f90=_[_0xad7d('0x51')]({},_0x8e1f90,_0x30ef52['options']);return db[_0xad7d('0x6f')]['count']({'where':_0x8e1f90[_0xad7d('0x52')]})[_0xad7d('0x22')](function(_0x1374b7){_0x29617c[_0xad7d('0x34')]=_0x1374b7;if(_0x30ef52[_0xad7d('0x46')][_0xad7d('0x56')]){_0x8e1f90[_0xad7d('0x57')]=[{'all':!![]}];}return db[_0xad7d('0x6f')][_0xad7d('0x59')](_0x8e1f90);})['then'](function(_0x2ad3dc){_0x29617c[_0xad7d('0x6b')]=_0x2ad3dc;return _0x29617c;});}})[_0xad7d('0x22')](respondWithFilteredResult(_0x1ae94e,_0x8e1f90))[_0xad7d('0x2d')](handleError(_0x1ae94e,null));};exports[_0xad7d('0x72')]=function(_0x1b995f,_0x327dbf,_0x231aac){return db[_0xad7d('0x58')][_0xad7d('0x5c')]({'where':{'id':_0x1b995f[_0xad7d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x327dbf,null))[_0xad7d('0x22')](function(_0x3ef1d5){if(_0x3ef1d5){return _0x3ef1d5[_0xad7d('0x72')](_0x1b995f[_0xad7d('0x46')]['ids']);}})[_0xad7d('0x22')](respondWithStatusCode(_0x327dbf,null))[_0xad7d('0x2d')](handleError(_0x327dbf,null));};exports[_0xad7d('0x73')]=function(_0x48ddbf,_0x2061bd,_0x570cf2){return db[_0xad7d('0x58')]['find']({'where':{'id':_0x48ddbf[_0xad7d('0x5a')]['id']}})[_0xad7d('0x22')](handleEntityNotFound(_0x2061bd,null))[_0xad7d('0x22')](function(_0x19496a){if(_0x19496a){return _0x19496a[_0xad7d('0x73')](_0x48ddbf[_0xad7d('0x64')][_0xad7d('0x6d')],_[_0xad7d('0x74')](_0x48ddbf['body'],[_0xad7d('0x6d'),'id'])||{})[_0xad7d('0x75')](function(_0x2bc680){for(var _0x483567=0x0;_0x483567<_0x48ddbf[_0xad7d('0x64')]['ids']['length'];_0x483567+=0x1){socket['emit'](_0xad7d('0x76'),{'UserId':Number(_0x48ddbf[_0xad7d('0x64')]['ids'][_0x483567]),'WhatsappAccountId':Number(_0x48ddbf[_0xad7d('0x5a')]['id'])});}return _0x2bc680;});}})[_0xad7d('0x22')](respondWithResult(_0x2061bd,null))[_0xad7d('0x2d')](handleError(_0x2061bd,null));};exports['removeAgents']=function(_0x4fbaff,_0x256c91,_0x3608b5){return db['WhatsappAccount'][_0xad7d('0x5c')]({'where':{'id':_0x4fbaff['params']['id']}})[_0xad7d('0x22')](handleEntityNotFound(_0x256c91,null))[_0xad7d('0x22')](function(_0x4bb079){if(_0x4bb079){return _0x4bb079['removeAgents'](_0x4fbaff[_0xad7d('0x46')][_0xad7d('0x6d')])[_0xad7d('0x22')](function(){if(_[_0xad7d('0x77')](_0x4fbaff['query'][_0xad7d('0x6d')])){for(var _0x4bbc65=0x0;_0x4bbc65<_0x4fbaff['query'][_0xad7d('0x6d')][_0xad7d('0x5b')];_0x4bbc65+=0x1){socket[_0xad7d('0x78')](_0xad7d('0x79'),{'UserId':Number(_0x4fbaff['query'][_0xad7d('0x6d')][_0x4bbc65]),'WhatsappAccountId':Number(_0x4fbaff['params']['id'])});}}else{socket[_0xad7d('0x78')](_0xad7d('0x79'),{'UserId':Number(_0x4fbaff[_0xad7d('0x46')][_0xad7d('0x6d')]),'WhatsappAccountId':Number(_0x4fbaff[_0xad7d('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x256c91,null))[_0xad7d('0x2d')](handleError(_0x256c91,null));};exports[_0xad7d('0x7a')]=function(_0x4441d6,_0x218893,_0xc87f4f){var _0x42f142={};var _0xa63aaa={};var _0x10202e;var _0x19002d;return db[_0xad7d('0x58')][_0xad7d('0x71')]({'where':{'id':_0x4441d6['params']['id']}})['then'](handleEntityNotFound(_0x218893,null))[_0xad7d('0x22')](function(_0x497806){if(_0x497806){_0x10202e=_0x497806;_0xa63aaa['model']=_[_0xad7d('0x47')](db[_0xad7d('0x7b')][_0xad7d('0x41')]);_0xa63aaa[_0xad7d('0x46')]=_[_0xad7d('0x47')](_0x4441d6[_0xad7d('0x46')]);_0xa63aaa[_0xad7d('0x48')]=_[_0xad7d('0x49')](_0xa63aaa[_0xad7d('0x45')],_0xa63aaa['query']);_0x42f142[_0xad7d('0x4a')]=_[_0xad7d('0x49')](_0xa63aaa[_0xad7d('0x45')],qs[_0xad7d('0x4b')](_0x4441d6['query'][_0xad7d('0x4b')]));_0x42f142[_0xad7d('0x4a')]=_0x42f142[_0xad7d('0x4a')][_0xad7d('0x5b')]?_0x42f142[_0xad7d('0x4a')]:_0xa63aaa['model'];_0x42f142['order']=qs[_0xad7d('0x4f')](_0x4441d6[_0xad7d('0x46')][_0xad7d('0x4f')]);_0x42f142[_0xad7d('0x52')]=qs[_0xad7d('0x48')](_[_0xad7d('0x6a')](_0x4441d6[_0xad7d('0x46')],_0xa63aaa['filters']));if(_0x4441d6[_0xad7d('0x46')][_0xad7d('0x50')]){_0x42f142[_0xad7d('0x52')]=_[_0xad7d('0x51')](_0x42f142[_0xad7d('0x52')],{'$or':_[_0xad7d('0x53')](_0x42f142[_0xad7d('0x4a')],function(_0x53e999){var _0x5f1c89={};_0x5f1c89[_0x53e999]={'$like':'%'+_0x4441d6['query'][_0xad7d('0x50')]+'%'};return _0x5f1c89;})});}_0x42f142=_[_0xad7d('0x51')]({},_0x42f142,_0x4441d6['options']);return _0x10202e[_0xad7d('0x7a')](_0x42f142);}})[_0xad7d('0x22')](function(_0x2f38f9){if(_0x2f38f9){_0x19002d=_0x2f38f9[_0xad7d('0x5b')];if(!_0x4441d6[_0xad7d('0x46')][_0xad7d('0x4c')](_0xad7d('0x4d'))){_0x42f142[_0xad7d('0x33')]=qs['limit'](_0x4441d6[_0xad7d('0x46')][_0xad7d('0x33')]);_0x42f142[_0xad7d('0x32')]=qs['offset'](_0x4441d6['query'][_0xad7d('0x32')]);}return _0x10202e[_0xad7d('0x7a')](_0x42f142);}})[_0xad7d('0x22')](function(_0x750db2){if(_0x750db2){return _0x750db2?{'count':_0x19002d,'rows':_0x750db2}:null;}})[_0xad7d('0x22')](respondWithResult(_0x218893,null))[_0xad7d('0x2d')](handleError(_0x218893,null));};exports[_0xad7d('0x7c')]=function(_0x4bd0e2,_0x2a46a0){var _0x5eef4c=_0x4bd0e2[_0xad7d('0x5a')]['id'];var _0x19c2f1=_0x4bd0e2['body'];var _0x47228a=0xc8;var _0x33f424=null;return db[_0xad7d('0x7d')][_0xad7d('0x7e')]({'isolationLevel':db[_0xad7d('0x7d')][_0xad7d('0x7f')][_0xad7d('0x80')][_0xad7d('0x81')]},function(_0x279681){return db[_0xad7d('0x58')][_0xad7d('0x71')]({'where':{'id':_0x5eef4c},'transaction':_0x279681})[_0xad7d('0x22')](function(_0x14f0a6){if(_0x14f0a6){return db['WhatsappApplication'][_0xad7d('0x39')]({'where':{'WhatsappAccountId':_0x5eef4c},'transaction':_0x279681})[_0xad7d('0x22')](function(){var _0x3a477f=_[_0xad7d('0x53')](_0x19c2f1,function(_0x40cd29){_0x40cd29[_0xad7d('0x67')]=_0x5eef4c;return _0x40cd29;});return db[_0xad7d('0x82')][_0xad7d('0x83')](_0x3a477f,{'transaction':_0x279681});});}else{_0x47228a=0x194;_0x33f424=[];}});})[_0xad7d('0x22')](function(){if(_0x47228a!==0x194){return db[_0xad7d('0x82')][_0xad7d('0x84')]({'where':{'WhatsappAccountId':_0x5eef4c},'order':_0xad7d('0x85')})[_0xad7d('0x22')](function(_0x18eb64){_0x33f424=_0x18eb64;});}})[_0xad7d('0x2d')](function(_0x27960f){_0x47228a=0x1f4;logger[_0xad7d('0x29')](_0x27960f['stack']);if(_0x27960f[_0xad7d('0x3d')]){delete _0x27960f['name'];}_0x33f424=_0x27960f;})[_0xad7d('0x86')](function(){if(_0x33f424===null){_0x2a46a0[_0xad7d('0x2e')](_0x47228a);}else{if(_0x47228a===0x1f4){_0x2a46a0[_0xad7d('0x2f')](_0x47228a)[_0xad7d('0x3e')](_0x33f424);}else{_0x2a46a0[_0xad7d('0x2f')](_0x47228a)[_0xad7d('0x31')](_0x33f424);}}});};exports[_0xad7d('0x87')]=function(_0x5383ac,_0x3d3d3f,_0x1ca00c){var _0x54e4f4={};var _0x1a7a3f={};var _0x36ce70;var _0x2de8bc;return db[_0xad7d('0x58')][_0xad7d('0x71')]({'where':{'id':_0x5383ac['params']['id']}})[_0xad7d('0x22')](handleEntityNotFound(_0x3d3d3f,null))[_0xad7d('0x22')](function(_0x2446b4){if(_0x2446b4){_0x36ce70=_0x2446b4;_0x1a7a3f[_0xad7d('0x45')]=_[_0xad7d('0x47')](db[_0xad7d('0x82')]['rawAttributes']);_0x1a7a3f[_0xad7d('0x46')]=_[_0xad7d('0x47')](_0x5383ac[_0xad7d('0x46')]);_0x1a7a3f[_0xad7d('0x48')]=_[_0xad7d('0x49')](_0x1a7a3f[_0xad7d('0x45')],_0x1a7a3f[_0xad7d('0x46')]);_0x54e4f4[_0xad7d('0x4a')]=_['intersection'](_0x1a7a3f[_0xad7d('0x45')],qs['fields'](_0x5383ac['query']['fields']));_0x54e4f4['attributes']=_0x54e4f4['attributes']['length']?_0x54e4f4[_0xad7d('0x4a')]:_0x1a7a3f[_0xad7d('0x45')];_0x54e4f4['order']=qs[_0xad7d('0x4f')](_0x5383ac['query'][_0xad7d('0x4f')]);_0x54e4f4[_0xad7d('0x52')]=qs[_0xad7d('0x48')](_[_0xad7d('0x6a')](_0x5383ac[_0xad7d('0x46')],_0x1a7a3f[_0xad7d('0x48')]));if(_0x5383ac['query'][_0xad7d('0x50')]){_0x54e4f4['where']=_['merge'](_0x54e4f4[_0xad7d('0x52')],{'$or':_['map'](_0x54e4f4['attributes'],function(_0x2aa672){var _0x57bef0={};_0x57bef0[_0x2aa672]={'$like':'%'+_0x5383ac[_0xad7d('0x46')][_0xad7d('0x50')]+'%'};return _0x57bef0;})});}_0x54e4f4=_[_0xad7d('0x51')]({},_0x54e4f4,_0x5383ac['options']);return _0x36ce70[_0xad7d('0x87')](_0x54e4f4);}})[_0xad7d('0x22')](function(_0x361284){if(_0x361284){_0x2de8bc=_0x361284['length'];if(!_0x5383ac[_0xad7d('0x46')][_0xad7d('0x4c')](_0xad7d('0x4d'))){_0x54e4f4[_0xad7d('0x33')]=qs['limit'](_0x5383ac[_0xad7d('0x46')][_0xad7d('0x33')]);_0x54e4f4[_0xad7d('0x32')]=qs[_0xad7d('0x32')](_0x5383ac['query']['offset']);}return _0x36ce70[_0xad7d('0x87')](_0x54e4f4);}})['then'](function(_0x399401){if(_0x399401){return _0x399401?{'count':_0x2de8bc,'rows':_0x399401}:null;}})[_0xad7d('0x22')](respondWithResult(_0x3d3d3f,null))[_0xad7d('0x2d')](handleError(_0x3d3d3f,null));};exports[_0xad7d('0x88')]=function(_0x381b5b,_0x213365,_0x15a74d){var _0x1e8dda={'channel':_0xad7d('0x89')};var _0x5f421e=[];var _0x14a26d=[];var _0x5a2073={};return db[_0xad7d('0x58')][_0xad7d('0x5c')]({'where':{'id':_0x381b5b[_0xad7d('0x5a')]['id']},'include':[{'model':db[_0xad7d('0x82')],'as':_0xad7d('0x8a')}]})[_0xad7d('0x22')](handleEntityNotFound(_0x213365,null))[_0xad7d('0x22')](function(_0x4718cc){_0x1e8dda[_0xad7d('0x8b')]=_0x4718cc;if(_0x1e8dda['account']&&_0x1e8dda['account'][_0xad7d('0x43')]===_0xad7d('0x8c')&&_0x381b5b[_0xad7d('0x64')][_0xad7d('0x8d')]){if(_0x381b5b[_0xad7d('0x64')][_0xad7d('0x8d')][_0xad7d('0x5b')]===0x0)return;if(_0x381b5b['body'][_0xad7d('0x8d')][0x0][_0xad7d('0x8e')]!=='read')return;return db[_0xad7d('0x8f')][_0xad7d('0x90')]({'read':!![],'readAt':_0x381b5b[_0xad7d('0x64')][_0xad7d('0x8d')][0x0]['timestamp']},{'where':{'messageId':_0x381b5b[_0xad7d('0x64')][_0xad7d('0x8d')][0x0]['message_id']},'individualHooks':!![]})[_0xad7d('0x22')](function(_0x2b3237){return _0x213365[_0xad7d('0x2f')](0xc8)[_0xad7d('0x31')](_0x2b3237);});}_0x1e8dda[_0xad7d('0x91')]=_[_0xad7d('0x92')](_0x4718cc['Applications'],[_0xad7d('0x85')],[_0xad7d('0x93')]);if(_0x1e8dda[_0xad7d('0x8b')]['Applications']){delete _0x1e8dda['account'][_0xad7d('0x8a')];}return db[_0xad7d('0x94')][_0xad7d('0x66')]()[_0xad7d('0x22')](function(_0x18395c){if(!_0x18395c){throw new db['Sequelize'][(_0xad7d('0x95'))](_0xad7d('0x96'));}_0x5f421e=_[_0xad7d('0x97')](_['keys'](_0x18395c),[_0xad7d('0x98'),_0xad7d('0x99')]);_0x14a26d=_['difference'](_['keys'](_0x18395c),[_0xad7d('0x98'),_0xad7d('0x99'),'CompanyId','ListId']);_0x1e8dda[_0xad7d('0x64')]={'mapKey':'mobile'};if(_0x1e8dda[_0xad7d('0x8b')]&&_0x1e8dda[_0xad7d('0x8b')][_0xad7d('0x43')]===_0xad7d('0x9a')){_0x1e8dda[_0xad7d('0x64')]['from']=_0x381b5b['body'][_0xad7d('0x9b')]['replace'](_0xad7d('0x9c'),'');_0x1e8dda[_0xad7d('0x64')][_0xad7d('0x64')]=_0x381b5b[_0xad7d('0x64')]['Body'];_0x1e8dda[_0xad7d('0x64')]['messageId']=_0x381b5b['body'][_0xad7d('0x9d')];}if(_0x1e8dda[_0xad7d('0x8b')]&&_0x1e8dda[_0xad7d('0x8b')]['type']==='sinch'){_0x1e8dda[_0xad7d('0x64')][_0xad7d('0x9e')]=_0x381b5b['body'][_0xad7d('0x9f')][0x0][_0xad7d('0x9e')];_0x1e8dda[_0xad7d('0x64')][_0xad7d('0x64')]=_0x381b5b[_0xad7d('0x64')][_0xad7d('0x9f')][0x0]['message']['body'];_0x1e8dda[_0xad7d('0x64')][_0xad7d('0xa0')]=_0x381b5b['body'][_0xad7d('0x9f')][0x0][_0xad7d('0xa1')];}if(_0x1e8dda[_0xad7d('0x64')]['id']){delete _0x1e8dda[_0xad7d('0x64')]['id'];}if(_['isNil'](_0x1e8dda[_0xad7d('0x64')][_0xad7d('0x9e')])){throw new db[(_0xad7d('0xa2'))][(_0xad7d('0x95'))](_0xad7d('0xa3'));}if(_[_0xad7d('0xa4')](_0x1e8dda[_0xad7d('0x64')]['body'])||_0x1e8dda[_0xad7d('0x64')][_0xad7d('0x64')]===''){throw new db[(_0xad7d('0xa2'))][(_0xad7d('0x95'))](_0xad7d('0xa5'));}if(_[_0xad7d('0xa4')](_0x1e8dda[_0xad7d('0x64')][_0xad7d('0xa6')])){throw new db[(_0xad7d('0xa2'))][(_0xad7d('0x95'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x14a26d);}if(!_[_0xad7d('0xa7')](_0x14a26d,_0x1e8dda[_0xad7d('0x64')][_0xad7d('0xa6')])){throw new db[(_0xad7d('0xa2'))][(_0xad7d('0x95'))](_0xad7d('0xa8')+_0x14a26d);}_0x5a2073[_0x1e8dda['body'][_0xad7d('0xa6')]]=_0x1e8dda['body'][_0xad7d('0x9e')];return db[_0xad7d('0xa9')][_0xad7d('0x5c')]({'where':{'id':_0x1e8dda[_0xad7d('0x8b')][_0xad7d('0xaa')]},'include':[{'model':db[_0xad7d('0x94')],'as':_0xad7d('0xab'),'where':_0x5a2073,'limit':0x1,'order':[[_0xad7d('0x99'),_0xad7d('0xac')]]}]});})[_0xad7d('0x22')](handleEntityNotFound(_0x213365,null))[_0xad7d('0x22')](function(_0x4657c5){if(_0x4657c5){_0x1e8dda[_0xad7d('0xad')]=_[_0xad7d('0x74')](_0x4657c5,[_0xad7d('0xab')]);if(_0x4657c5[_0xad7d('0xab')]['length']){return _0x4657c5[_0xad7d('0xab')][0x0];}var _0x2f9418=_['defaults'](_0x1e8dda[_0xad7d('0x64')],{'firstName':_0x1e8dda['body'][_0xad7d('0x9e')],'ListId':_0x4657c5['id']});_0x2f9418[_0x1e8dda[_0xad7d('0x64')][_0xad7d('0xa6')]]=_0x1e8dda[_0xad7d('0x64')][_0xad7d('0x9e')];return db['CmContact'][_0xad7d('0x5d')](_0x2f9418,{'fields':_0x5f421e,'raw':!![]});}})[_0xad7d('0x22')](handleEntityNotFound(_0x213365,null))['then'](function(_0xb4ee0b){if(_0xb4ee0b){_0x1e8dda['contact']=_0xb4ee0b;var _0x4f72ab={'ContactId':_0xb4ee0b['id'],'phone':_0x1e8dda['body'][_0xad7d('0x9e')],'WhatsappAccountId':_0x381b5b[_0xad7d('0x5a')]['id']};var _0x1ac32a={'ContactId':_0xb4ee0b['id'],'WhatsappAccountId':_0x381b5b[_0xad7d('0x5a')]['id'],'closed':![]};return db[_0xad7d('0xae')][_0xad7d('0x5c')]({'where':_0x1ac32a})[_0xad7d('0x22')](function(_0x584ce9){if(_0x584ce9){return[_0x584ce9,![]];}return db[_0xad7d('0xae')][_0xad7d('0x5d')](_0x4f72ab)['then'](function(_0x2f4c46){return[_0x2f4c46,!![]];});});}})['spread'](function(_0x162dfc,_0x3cc951){_0x1e8dda[_0xad7d('0xaf')]=_0x162dfc['get']({'plain':!![]});_0x1e8dda[_0xad7d('0xaf')][_0xad7d('0xb0')]=![];if(_0x3cc951){if(_0x1e8dda[_0xad7d('0x8b')][_0xad7d('0xb1')]){_0x1e8dda[_0xad7d('0x91')]['push']({'id':0x0,'priority':_0x1e8dda[_0xad7d('0x91')][_0xad7d('0x5b')]+0x1,'app':_0xad7d('0xb2'),'appdata':'unmanaged','interval':_0xad7d('0xb3')});}_0x1e8dda[_0xad7d('0xaf')][_0xad7d('0xb0')]=!![];}return db[_0xad7d('0x8f')][_0xad7d('0x5d')]({'phone':_0x1e8dda['body'][_0xad7d('0x9e')],'messageId':_0x1e8dda[_0xad7d('0x64')][_0xad7d('0xa0')],'body':_0x1e8dda[_0xad7d('0x64')][_0xad7d('0x64')],'WhatsappAccountId':_0x381b5b[_0xad7d('0x5a')]['id'],'WhatsappInteractionId':_0x162dfc['id'],'direction':'in','ContactId':_0x162dfc[_0xad7d('0xb4')],'AttachmentId':_0x1e8dda[_0xad7d('0x64')][_0xad7d('0xb5')]});})['then'](function(_0x52acb8){_0x1e8dda[_0xad7d('0x2b')]=_0x52acb8;if(!_0x1e8dda[_0xad7d('0xaf')][_0xad7d('0xb6')])return;return db['User']['find']({'attributes':['id',_0xad7d('0x3d')],'where':{'id':_0x1e8dda[_0xad7d('0xaf')][_0xad7d('0xb6')]}});})[_0xad7d('0x22')](function(_0x42b9b5){if(_0x42b9b5){_0x1e8dda[_0xad7d('0x91')][_0xad7d('0xb7')]({'id':0x0,'priority':0x0,'app':_0xad7d('0xb8'),'appdata':_0x42b9b5[_0xad7d('0x3d')]+','+(_0x1e8dda['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x1e8dda[_0xad7d('0xaf')][_0xad7d('0xb9')])return;return db[_0xad7d('0xba')][_0xad7d('0x5c')]({'attributes':['id',_0xad7d('0x3d')],'where':{'id':_0x1e8dda[_0xad7d('0xaf')]['queueId']}});})[_0xad7d('0x22')](function(_0x41b94e){if(_0x41b94e){_0x1e8dda[_0xad7d('0x91')][_0xad7d('0xb7')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x41b94e[_0xad7d('0x3d')]+','+(_0x1e8dda['account'][_0xad7d('0xbb')]||0x12c),'interval':_0xad7d('0xb3')});}return respondWithRpcPromise(_0xad7d('0xbc'),'startRouting',_0x1e8dda);})['then'](function(_0x3935ec){if(_0x3935ec){var _0xa4e951=0xc8;var _0x66eb82='receiveMessage';logger[_0xad7d('0x23')](_0xad7d('0x27'),_0x66eb82,_0xa4e951,'entity\x20found');logger[_0xad7d('0x26')](_0xad7d('0xbd'),_0x66eb82,_0xa4e951,'entity\x20found',JSON[_0xad7d('0x28')](_0x3935ec));if(_0x1e8dda[_0xad7d('0x8b')][_0xad7d('0x43')]===_0xad7d('0x9a')){return _0x213365[_0xad7d('0x2f')](_0xa4e951)[_0xad7d('0x35')](_0xad7d('0xbe'),'text/xml')['send'](_0xad7d('0xbf'));}else{return _0x213365['status'](_0xa4e951)[_0xad7d('0x31')](_0x3935ec);}}});})[_0xad7d('0x2d')](handleError(_0x213365,null));};exports[_0xad7d('0x3e')]=function(_0xe50cdc,_0x58cd31,_0x28dfc8){var _0x1922f1,_0x5c0391,_0x497984;if(_[_0xad7d('0xa4')](_0xe50cdc[_0xad7d('0x64')][_0xad7d('0x64')])||_0xe50cdc['body'][_0xad7d('0x64')]===''){throw new db[(_0xad7d('0xa2'))][(_0xad7d('0x95'))](_0xad7d('0xa5'));}if(_['isNil'](_0xe50cdc['body']['to'])){throw new db['Sequelize']['ValidationError'](_0xad7d('0xc0'));}_0x1922f1=_0xe50cdc['body']['to'];return db[_0xad7d('0x58')][_0xad7d('0x5c')]({'where':{'id':_0xe50cdc[_0xad7d('0x5a')]['id']},'include':[{'model':db[_0xad7d('0xa9')],'as':_0xad7d('0xc1'),'include':[{'model':db[_0xad7d('0x94')],'as':_0xad7d('0xab'),'where':{'mobile':_0x1922f1},'limit':0x1,'order':[[_0xad7d('0x99'),_0xad7d('0xac')]]}]}]})['then'](handleEntityNotFound(_0x58cd31,null))[_0xad7d('0x22')](function(_0x512da6){if(_0x512da6&&_0x512da6[_0xad7d('0xc1')]){_0x5c0391=_0x512da6[_0xad7d('0x3a')]({'plain':!![]});if(_0x5c0391['List']&&_0x5c0391[_0xad7d('0xc1')]['Contacts'][_0xad7d('0x5b')]){return _0x5c0391[_0xad7d('0xc1')][_0xad7d('0xab')][0x0];}return db['CmContact']['create'](_[_0xad7d('0x19')](_0xe50cdc[_0xad7d('0x64')],{'firstName':_0x1922f1,'mobile':_0x1922f1,'phone':_0x1922f1,'ListId':_0x5c0391[_0xad7d('0xaa')]}));}})['then'](handleEntityNotFound(_0x58cd31,null))[_0xad7d('0x22')](function(_0xe79736){if(_0xe79736){_0x497984=_0xe79736;return db[_0xad7d('0xae')][_0xad7d('0x5c')]({'where':{'ContactId':_0x497984['id'],'closed':![],'WhatsappAccountId':_0x5c0391['id']}})['then'](function(_0x333126){if(_0x333126){return[_0x333126,![]];}return db[_0xad7d('0xae')]['create']({'UserId':_0xe50cdc[_0xad7d('0x5e')]['id'],'ContactId':_0x497984['id'],'WhatsappAccountId':_0x5c0391['id'],'phone':_0x1922f1,'firstMsgDirection':_0xad7d('0xc2'),'Messages':[_[_0xad7d('0x51')](_0xe50cdc[_0xad7d('0x64')],{'read':![],'body':_0xe50cdc[_0xad7d('0x64')]['body'],'phone':_0x1922f1,'WhatsappAccountId':_0x5c0391['id'],'UserId':_0xe50cdc[_0xad7d('0x5e')]['id'],'ContactId':_0x497984['id']})]},{'include':[{'model':db[_0xad7d('0x8f')],'as':_0xad7d('0xc3')}]})[_0xad7d('0x22')](function(_0x3585f7){return[_0x3585f7,!![]];});});}})[_0xad7d('0x75')](function(_0xb74860,_0x105d9b){if(_0x105d9b){return _0xb74860;}return db['WhatsappMessage'][_0xad7d('0x5d')](_['merge'](_0xe50cdc[_0xad7d('0x64')],{'read':![],'body':_0xe50cdc[_0xad7d('0x64')][_0xad7d('0x64')],'phone':_0x1922f1,'WhatsappAccountId':_0x5c0391['id'],'WhatsappInteractionId':_0xb74860['id'],'UserId':_0xe50cdc['user']['id'],'ContactId':_0x497984['id']}))[_0xad7d('0x22')](function(_0x4c360c){_0xb74860[_0xad7d('0xc4')][_0xad7d('0xc3')]=[];_0xb74860[_0xad7d('0xc4')][_0xad7d('0xc3')][_0xad7d('0xc5')](_0x4c360c[_0xad7d('0xc4')]);return _0xb74860;});})[_0xad7d('0x22')](respondWithResult(_0x58cd31,null))[_0xad7d('0x2d')](handleError(_0x58cd31,null));}; \ No newline at end of file +var _0xd89b=['CmContact','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','show','params','mandatoryDispositionPause','keys','find','create','body','role','user','userProfileId','autoAssociation','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','sendStatus','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','asc','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','MessageSid','sinch','from','notifications','messageId','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','send','\x0a','to\x20is\x20mandatory','List'];(function(_0x4a5577,_0x449d77){var _0x4fd4e3=function(_0x373996){while(--_0x373996){_0x4a5577['push'](_0x4a5577['shift']());}};_0x4fd4e3(++_0x449d77);}(_0xd89b,0xca));var _0xbd89=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xd89b[_0xdea41a];return _0x15d0d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd89('0x0'));var zipdir=require(_0xbd89('0x1'));var jsonpatch=require(_0xbd89('0x2'));var rp=require(_0xbd89('0x3'));var moment=require(_0xbd89('0x4'));var BPromise=require(_0xbd89('0x5'));var Mustache=require(_0xbd89('0x6'));var util=require(_0xbd89('0x7'));var path=require(_0xbd89('0x8'));var sox=require('sox');var csv=require(_0xbd89('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbd89('0xa'));var crypto=require(_0xbd89('0xb'));var jsforce=require(_0xbd89('0xc'));var deskjs=require(_0xbd89('0xd'));var toCsv=require(_0xbd89('0x9'));var querystring=require(_0xbd89('0xe'));var Papa=require(_0xbd89('0xf'));var Redis=require(_0xbd89('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbd89('0x11'));var as=require(_0xbd89('0x12'));var hardwareService=require(_0xbd89('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xbd89('0x14'));var config=require(_0xbd89('0x15'));var licenseUtil=require(_0xbd89('0x16'));var db=require(_0xbd89('0x17'))['db'];config[_0xbd89('0x18')]=_['defaults'](config[_0xbd89('0x18')],{'host':_0xbd89('0x19'),'port':0x18eb});var socket=require(_0xbd89('0x1a'))(new Redis(config[_0xbd89('0x18')]));require(_0xbd89('0x1b'))['register'](socket);var jayson=require(_0xbd89('0x1c'));var client=jayson['client'][_0xbd89('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x12fc65,_0x1ba0f5,_0x1a6b59,_0x1e516c){return new BPromise(function(_0x5a659c,_0x1f857e){var _0x3f2ed2=_0x1e516c||client;return _0x3f2ed2[_0xbd89('0x1e')](_0x12fc65,_0x1a6b59)[_0xbd89('0x1f')](function(_0xa31b1d){logger[_0xbd89('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x1ba0f5,_0xbd89('0x21'));logger[_0xbd89('0x22')](_0xbd89('0x23'),_0x1ba0f5,'request\x20sent',JSON['stringify'](_0xa31b1d));if(_0xa31b1d[_0xbd89('0x24')]){if(_0xa31b1d['error'][_0xbd89('0x25')]===0x1f4){logger[_0xbd89('0x24')](_0xbd89('0x26'),_0x1ba0f5,_0xa31b1d['error'][_0xbd89('0x27')]);return _0x1f857e(_0xa31b1d['error'][_0xbd89('0x27')]);}logger[_0xbd89('0x24')](_0xbd89('0x26'),_0x1ba0f5,_0xa31b1d[_0xbd89('0x24')]['message']);return _0x5a659c(_0xa31b1d[_0xbd89('0x24')]['message']);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x1ba0f5,_0xbd89('0x21'));_0x5a659c(_0xa31b1d[_0xbd89('0x28')]['message']);}})[_0xbd89('0x29')](function(_0x1ccebf){logger['error'](_0xbd89('0x26'),_0x1ba0f5,_0x1ccebf);_0x1f857e(_0x1ccebf);});});}function respondWithStatusCode(_0x5a5847,_0xdd08d9){_0xdd08d9=_0xdd08d9||0xcc;return function(_0x162eca){if(_0x162eca){return _0x5a5847['sendStatus'](_0xdd08d9);}return _0x5a5847['status'](_0xdd08d9)[_0xbd89('0x2a')]();};}function respondWithResult(_0x2d7552,_0x186e3c){_0x186e3c=_0x186e3c||0xc8;return function(_0x129f07){if(_0x129f07){return _0x2d7552[_0xbd89('0x2b')](_0x186e3c)[_0xbd89('0x2c')](_0x129f07);}};}function respondWithFilteredResult(_0x195f94,_0x5e6c11){return function(_0x360b54){if(_0x360b54){var _0x5afaeb=typeof _0x5e6c11[_0xbd89('0x2d')]===_0xbd89('0x2e')&&typeof _0x5e6c11[_0xbd89('0x2f')]===_0xbd89('0x2e');var _0xad238a=_0x360b54['count'];var _0xc44f28=_0x5afaeb?0x0:_0x5e6c11[_0xbd89('0x2d')];var _0x3affcd=_0x5afaeb?_0x360b54['count']:_0x5e6c11[_0xbd89('0x2d')]+_0x5e6c11[_0xbd89('0x2f')];var _0x2fcd7a;if(_0x3affcd>=_0xad238a){_0x3affcd=_0xad238a;_0x2fcd7a=0xc8;}else{_0x2fcd7a=0xce;}_0x195f94[_0xbd89('0x2b')](_0x2fcd7a);return _0x195f94['set'](_0xbd89('0x30'),_0xc44f28+'-'+_0x3affcd+'/'+_0xad238a)['json'](_0x360b54);}return null;};}function patchUpdates(_0x2fdaed){return function(_0x3aec27){try{jsonpatch[_0xbd89('0x31')](_0x3aec27,_0x2fdaed,!![]);}catch(_0x2dd753){return BPromise[_0xbd89('0x32')](_0x2dd753);}return _0x3aec27[_0xbd89('0x33')]();};}function saveUpdates(_0x3dbdca,_0x20de25){return function(_0x48865b){if(_0x48865b){return _0x48865b[_0xbd89('0x34')](_0x3dbdca)[_0xbd89('0x1f')](function(_0xc3ee2b){return _0xc3ee2b;});}return null;};}function removeEntity(_0x1d7f0b,_0x7719d){return function(_0x1546d){if(_0x1546d){return _0x1546d[_0xbd89('0x35')]()[_0xbd89('0x1f')](function(){var _0x4a582c=_0x1546d[_0xbd89('0x36')]({'plain':!![]});var _0x19942b=_0xbd89('0x37');return db[_0xbd89('0x38')][_0xbd89('0x35')]({'where':{'type':_0x19942b,'resourceId':_0x4a582c['id']}})['then'](function(){return _0x1546d;});})[_0xbd89('0x1f')](function(){_0x1d7f0b['status'](0xcc)[_0xbd89('0x2a')]();});}};}function handleEntityNotFound(_0x655878,_0x2714f7){return function(_0x1517d4){if(!_0x1517d4){_0x655878['sendStatus'](0x194);}return _0x1517d4;};}function handleError(_0x549135,_0x44212c){_0x44212c=_0x44212c||0x1f4;return function(_0x550cb4){logger['error'](_0x550cb4[_0xbd89('0x39')]);if(_0x550cb4[_0xbd89('0x3a')]){delete _0x550cb4['name'];}_0x549135['status'](_0x44212c)['send'](_0x550cb4);};}exports[_0xbd89('0x3b')]=function(_0x47b490,_0x6256ca){var _0x84a472={'include':[{'model':db[_0xbd89('0x3c')],'as':'mandatoryDispositionPause'}]},_0x12d2dd={},_0x163a8c={'count':0x0,'rows':[]};var _0x567a54=_[_0xbd89('0x3d')](db[_0xbd89('0x3e')][_0xbd89('0x3f')],function(_0x48ced3){return{'name':_0x48ced3[_0xbd89('0x40')],'type':_0x48ced3[_0xbd89('0x41')][_0xbd89('0x42')]};});_0x12d2dd[_0xbd89('0x43')]=_[_0xbd89('0x3d')](_0x567a54,_0xbd89('0x3a'));_0x12d2dd[_0xbd89('0x44')]=_['keys'](_0x47b490[_0xbd89('0x44')]);_0x12d2dd[_0xbd89('0x45')]=_[_0xbd89('0x46')](_0x12d2dd[_0xbd89('0x43')],_0x12d2dd[_0xbd89('0x44')]);_0x84a472['attributes']=_[_0xbd89('0x46')](_0x12d2dd[_0xbd89('0x43')],qs[_0xbd89('0x47')](_0x47b490[_0xbd89('0x44')][_0xbd89('0x47')]));_0x84a472['attributes']=_0x84a472[_0xbd89('0x48')][_0xbd89('0x49')]?_0x84a472['attributes']:_0x12d2dd[_0xbd89('0x43')];if(!_0x47b490[_0xbd89('0x44')][_0xbd89('0x4a')](_0xbd89('0x4b'))){_0x84a472[_0xbd89('0x2f')]=qs[_0xbd89('0x2f')](_0x47b490[_0xbd89('0x44')][_0xbd89('0x2f')]);_0x84a472[_0xbd89('0x2d')]=qs['offset'](_0x47b490[_0xbd89('0x44')]['offset']);}_0x84a472[_0xbd89('0x4c')]=qs[_0xbd89('0x4d')](_0x47b490[_0xbd89('0x44')][_0xbd89('0x4d')]);_0x84a472[_0xbd89('0x4e')]=qs['filters'](_[_0xbd89('0x4f')](_0x47b490[_0xbd89('0x44')],_0x12d2dd[_0xbd89('0x45')]),_0x567a54);if(_0x47b490['query'][_0xbd89('0x50')]){_0x84a472['where']=_[_0xbd89('0x51')](_0x84a472['where'],{'$or':_[_0xbd89('0x3d')](_0x567a54,function(_0x38d3d1){if(_0x38d3d1[_0xbd89('0x41')]!==_0xbd89('0x52')){var _0x4abff6={};_0x4abff6[_0x38d3d1['name']]={'$like':'%'+_0x47b490[_0xbd89('0x44')][_0xbd89('0x50')]+'%'};return _0x4abff6;}})});}_0x84a472=_[_0xbd89('0x51')]({},_0x84a472,_0x47b490[_0xbd89('0x53')]);var _0x115607={'where':_0x84a472[_0xbd89('0x4e')]};return db[_0xbd89('0x3e')][_0xbd89('0x54')](_0x115607)[_0xbd89('0x1f')](function(_0x20b199){_0x163a8c['count']=_0x20b199;if(_0x47b490[_0xbd89('0x44')][_0xbd89('0x55')]){_0x84a472[_0xbd89('0x56')]=[{'all':!![]}];}return db[_0xbd89('0x3e')]['findAll'](_0x84a472);})[_0xbd89('0x1f')](function(_0x23c6d3){_0x163a8c['rows']=_0x23c6d3;return _0x163a8c;})[_0xbd89('0x1f')](respondWithFilteredResult(_0x6256ca,_0x84a472))[_0xbd89('0x29')](handleError(_0x6256ca,null));};exports[_0xbd89('0x57')]=function(_0x237e39,_0x332938){var _0x50a48b={'raw':![],'where':{'id':_0x237e39[_0xbd89('0x58')]['id']},'include':[{'model':db[_0xbd89('0x3c')],'as':_0xbd89('0x59')}]},_0x5a0a2b={};_0x5a0a2b[_0xbd89('0x43')]=_[_0xbd89('0x5a')](db[_0xbd89('0x3e')]['rawAttributes']);_0x5a0a2b[_0xbd89('0x44')]=_[_0xbd89('0x5a')](_0x237e39[_0xbd89('0x44')]);_0x5a0a2b[_0xbd89('0x45')]=_[_0xbd89('0x46')](_0x5a0a2b['model'],_0x5a0a2b['query']);_0x50a48b[_0xbd89('0x48')]=_[_0xbd89('0x46')](_0x5a0a2b['model'],qs['fields'](_0x237e39['query'][_0xbd89('0x47')]));_0x50a48b[_0xbd89('0x48')]=_0x50a48b[_0xbd89('0x48')][_0xbd89('0x49')]?_0x50a48b['attributes']:_0x5a0a2b[_0xbd89('0x43')];if(_0x237e39[_0xbd89('0x44')][_0xbd89('0x55')]){_0x50a48b[_0xbd89('0x56')]=[{'all':!![]}];}_0x50a48b=_[_0xbd89('0x51')]({},_0x50a48b,_0x237e39[_0xbd89('0x53')]);return db[_0xbd89('0x3e')][_0xbd89('0x5b')](_0x50a48b)[_0xbd89('0x1f')](handleEntityNotFound(_0x332938,null))[_0xbd89('0x1f')](respondWithResult(_0x332938,null))[_0xbd89('0x29')](handleError(_0x332938,null));};exports[_0xbd89('0x5c')]=function(_0x26520b,_0x17245f){return db[_0xbd89('0x3e')][_0xbd89('0x5c')](_0x26520b[_0xbd89('0x5d')],{})[_0xbd89('0x1f')](function(_0x4e0821){var _0xc107c9=_0x26520b['user'][_0xbd89('0x36')]({'plain':!![]});if(!_0xc107c9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc107c9[_0xbd89('0x5e')]===_0xbd89('0x5f')){var _0x5975d9=_0x4e0821[_0xbd89('0x36')]({'plain':!![]});var _0x3597b0=_0xbd89('0x37');return db['UserProfileSection'][_0xbd89('0x5b')]({'where':{'name':_0x3597b0,'userProfileId':_0xc107c9[_0xbd89('0x60')]},'raw':!![]})['then'](function(_0x47012f){if(_0x47012f&&_0x47012f[_0xbd89('0x61')]===0x0){return db[_0xbd89('0x38')][_0xbd89('0x5c')]({'name':_0x5975d9['name'],'resourceId':_0x5975d9['id'],'type':_0x47012f[_0xbd89('0x3a')],'sectionId':_0x47012f['id']},{})[_0xbd89('0x1f')](function(){return _0x4e0821;});}else{return _0x4e0821;}})[_0xbd89('0x29')](function(_0x5906bd){logger[_0xbd89('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5906bd);throw _0x5906bd;});}return _0x4e0821;})[_0xbd89('0x1f')](respondWithResult(_0x17245f,0xc9))[_0xbd89('0x29')](handleError(_0x17245f,null));};exports[_0xbd89('0x34')]=function(_0x584eaf,_0x2e97ed){if(_0x584eaf[_0xbd89('0x5d')]['id']){delete _0x584eaf[_0xbd89('0x5d')]['id'];}return db[_0xbd89('0x3e')][_0xbd89('0x5b')]({'where':{'id':_0x584eaf[_0xbd89('0x58')]['id']},'include':[{'model':db[_0xbd89('0x3c')],'as':'mandatoryDispositionPause'}]})[_0xbd89('0x1f')](handleEntityNotFound(_0x2e97ed,null))[_0xbd89('0x1f')](saveUpdates(_0x584eaf[_0xbd89('0x5d')],null))['then'](respondWithResult(_0x2e97ed,null))['catch'](handleError(_0x2e97ed,null));};exports[_0xbd89('0x35')]=function(_0x31a573,_0x368f0b){return db[_0xbd89('0x3e')]['find']({'where':{'id':_0x31a573[_0xbd89('0x58')]['id']}})['then'](handleEntityNotFound(_0x368f0b,null))['then'](removeEntity(_0x368f0b,null))['catch'](handleError(_0x368f0b,null));};exports[_0xbd89('0x62')]=function(_0x4be061,_0x2a58d2){return db[_0xbd89('0x3e')][_0xbd89('0x62')]()[_0xbd89('0x1f')](respondWithResult(_0x2a58d2,null))[_0xbd89('0x29')](handleError(_0x2a58d2,null));};exports[_0xbd89('0x63')]=function(_0x4d7a19,_0x36269d,_0x5fb844){if(_0x4d7a19[_0xbd89('0x5d')]['id']){delete _0x4d7a19['body']['id'];}return db[_0xbd89('0x3e')]['find']({'where':{'id':_0x4d7a19[_0xbd89('0x58')]['id']}})['then'](handleEntityNotFound(_0x36269d,null))[_0xbd89('0x1f')](function(_0x1d7e1a){if(_0x1d7e1a){_0x4d7a19['body'][_0xbd89('0x64')]=_0x1d7e1a['id'];return db[_0xbd89('0x65')][_0xbd89('0x5c')](_0x4d7a19[_0xbd89('0x5d')]);}})['then'](respondWithResult(_0x36269d,null))[_0xbd89('0x29')](handleError(_0x36269d,null));};exports[_0xbd89('0x66')]=function(_0x2df7e5,_0x34cfe4,_0x408000){var _0x4ed2ab={'raw':![],'where':{}};var _0x104d24={};var _0x5d5dad={'count':0x0,'rows':[]};return db[_0xbd89('0x3e')][_0xbd89('0x67')]({'where':{'id':_0x2df7e5['params']['id']}})['then'](handleEntityNotFound(_0x34cfe4,null))['then'](function(_0x304763){if(_0x304763){_0x104d24[_0xbd89('0x43')]=_[_0xbd89('0x5a')](db[_0xbd89('0x65')][_0xbd89('0x3f')]);_0x104d24['query']=_[_0xbd89('0x5a')](_0x2df7e5['query']);_0x104d24[_0xbd89('0x45')]=_['intersection'](_0x104d24['model'],_0x104d24['query']);_0x4ed2ab[_0xbd89('0x48')]=_['intersection'](_0x104d24[_0xbd89('0x43')],qs[_0xbd89('0x47')](_0x2df7e5[_0xbd89('0x44')][_0xbd89('0x47')]));_0x4ed2ab[_0xbd89('0x48')]=_0x4ed2ab[_0xbd89('0x48')][_0xbd89('0x49')]?_0x4ed2ab[_0xbd89('0x48')]:_0x104d24[_0xbd89('0x43')];if(!_0x2df7e5[_0xbd89('0x44')][_0xbd89('0x4a')](_0xbd89('0x4b'))){_0x4ed2ab[_0xbd89('0x2f')]=qs[_0xbd89('0x2f')](_0x2df7e5[_0xbd89('0x44')][_0xbd89('0x2f')]);_0x4ed2ab[_0xbd89('0x2d')]=qs[_0xbd89('0x2d')](_0x2df7e5[_0xbd89('0x44')][_0xbd89('0x2d')]);}_0x4ed2ab[_0xbd89('0x4c')]=qs[_0xbd89('0x4d')](_0x2df7e5['query']['sort']);_0x4ed2ab[_0xbd89('0x4e')]=qs[_0xbd89('0x45')](_[_0xbd89('0x4f')](_0x2df7e5[_0xbd89('0x44')],_0x104d24[_0xbd89('0x45')]));_0x4ed2ab['where'][_0xbd89('0x64')]=_0x304763['id'];if(_0x2df7e5['query'][_0xbd89('0x50')]){_0x4ed2ab[_0xbd89('0x4e')]=_['merge'](_0x4ed2ab[_0xbd89('0x4e')],{'$or':_['map'](_0x4ed2ab[_0xbd89('0x48')],function(_0x2f6f4d){var _0x583530={};_0x583530[_0x2f6f4d]={'$like':'%'+_0x2df7e5[_0xbd89('0x44')][_0xbd89('0x50')]+'%'};return _0x583530;})});}_0x4ed2ab=_[_0xbd89('0x51')]({},_0x4ed2ab,_0x2df7e5[_0xbd89('0x53')]);return db[_0xbd89('0x65')][_0xbd89('0x54')]({'where':_0x4ed2ab['where']})[_0xbd89('0x1f')](function(_0x3af97a){_0x5d5dad[_0xbd89('0x54')]=_0x3af97a;if(_0x2df7e5[_0xbd89('0x44')][_0xbd89('0x55')]){_0x4ed2ab[_0xbd89('0x56')]=[{'all':!![]}];}return db[_0xbd89('0x65')][_0xbd89('0x68')](_0x4ed2ab);})[_0xbd89('0x1f')](function(_0x27e59f){_0x5d5dad[_0xbd89('0x69')]=_0x27e59f;return _0x5d5dad;});}})['then'](respondWithFilteredResult(_0x34cfe4,_0x4ed2ab))['catch'](handleError(_0x34cfe4,null));};exports['removeDispositions']=function(_0x4bea5f,_0x224ee0,_0x51635d){return db[_0xbd89('0x3e')][_0xbd89('0x5b')]({'where':{'id':_0x4bea5f['params']['id']}})[_0xbd89('0x1f')](handleEntityNotFound(_0x224ee0,null))['then'](function(_0x5322f0){if(_0x5322f0){return _0x5322f0[_0xbd89('0x6a')](_0x4bea5f[_0xbd89('0x44')][_0xbd89('0x6b')]);}})['then'](respondWithStatusCode(_0x224ee0,null))[_0xbd89('0x29')](handleError(_0x224ee0,null));};exports[_0xbd89('0x6c')]=function(_0x2603bb,_0x2e788c,_0x544ad4){if(_0x2603bb['body']['id']){delete _0x2603bb[_0xbd89('0x5d')]['id'];}return db[_0xbd89('0x3e')][_0xbd89('0x5b')]({'where':{'id':_0x2603bb[_0xbd89('0x58')]['id']}})[_0xbd89('0x1f')](handleEntityNotFound(_0x2e788c,null))[_0xbd89('0x1f')](function(_0x4b3346){if(_0x4b3346){_0x2603bb[_0xbd89('0x5d')]['WhatsappAccountId']=_0x4b3346['id'];return db[_0xbd89('0x6d')][_0xbd89('0x5c')](_0x2603bb['body']);}})[_0xbd89('0x1f')](respondWithResult(_0x2e788c,null))[_0xbd89('0x29')](handleError(_0x2e788c,null));};exports['getAnswers']=function(_0x265afe,_0x5e5ae7,_0x14c86b){var _0x593bf7={'raw':![],'where':{}};var _0x2532e9={};var _0x691a31={'count':0x0,'rows':[]};return db[_0xbd89('0x3e')][_0xbd89('0x67')]({'where':{'id':_0x265afe[_0xbd89('0x58')]['id']}})['then'](handleEntityNotFound(_0x5e5ae7,null))['then'](function(_0x3d25b8){if(_0x3d25b8){_0x2532e9[_0xbd89('0x43')]=_[_0xbd89('0x5a')](db[_0xbd89('0x6d')][_0xbd89('0x3f')]);_0x2532e9[_0xbd89('0x44')]=_[_0xbd89('0x5a')](_0x265afe[_0xbd89('0x44')]);_0x2532e9[_0xbd89('0x45')]=_[_0xbd89('0x46')](_0x2532e9['model'],_0x2532e9[_0xbd89('0x44')]);_0x593bf7['attributes']=_[_0xbd89('0x46')](_0x2532e9[_0xbd89('0x43')],qs[_0xbd89('0x47')](_0x265afe[_0xbd89('0x44')][_0xbd89('0x47')]));_0x593bf7[_0xbd89('0x48')]=_0x593bf7[_0xbd89('0x48')][_0xbd89('0x49')]?_0x593bf7[_0xbd89('0x48')]:_0x2532e9[_0xbd89('0x43')];if(!_0x265afe[_0xbd89('0x44')]['hasOwnProperty'](_0xbd89('0x4b'))){_0x593bf7[_0xbd89('0x2f')]=qs[_0xbd89('0x2f')](_0x265afe[_0xbd89('0x44')][_0xbd89('0x2f')]);_0x593bf7[_0xbd89('0x2d')]=qs[_0xbd89('0x2d')](_0x265afe['query'][_0xbd89('0x2d')]);}_0x593bf7[_0xbd89('0x4c')]=qs[_0xbd89('0x4d')](_0x265afe[_0xbd89('0x44')][_0xbd89('0x4d')]);_0x593bf7['where']=qs[_0xbd89('0x45')](_[_0xbd89('0x4f')](_0x265afe[_0xbd89('0x44')],_0x2532e9[_0xbd89('0x45')]));_0x593bf7[_0xbd89('0x4e')][_0xbd89('0x64')]=_0x3d25b8['id'];if(_0x265afe[_0xbd89('0x44')]['filter']){_0x593bf7[_0xbd89('0x4e')]=_[_0xbd89('0x51')](_0x593bf7['where'],{'$or':_[_0xbd89('0x3d')](_0x593bf7[_0xbd89('0x48')],function(_0x619b56){var _0x593a60={};_0x593a60[_0x619b56]={'$like':'%'+_0x265afe[_0xbd89('0x44')]['filter']+'%'};return _0x593a60;})});}_0x593bf7=_['merge']({},_0x593bf7,_0x265afe[_0xbd89('0x53')]);return db[_0xbd89('0x6d')]['count']({'where':_0x593bf7[_0xbd89('0x4e')]})[_0xbd89('0x1f')](function(_0x2fd14c){_0x691a31[_0xbd89('0x54')]=_0x2fd14c;if(_0x265afe[_0xbd89('0x44')][_0xbd89('0x55')]){_0x593bf7[_0xbd89('0x56')]=[{'all':!![]}];}return db[_0xbd89('0x6d')][_0xbd89('0x68')](_0x593bf7);})[_0xbd89('0x1f')](function(_0x70104e){_0x691a31[_0xbd89('0x69')]=_0x70104e;return _0x691a31;});}})[_0xbd89('0x1f')](respondWithFilteredResult(_0x5e5ae7,_0x593bf7))['catch'](handleError(_0x5e5ae7,null));};exports['removeAnswers']=function(_0xad4be6,_0x23319f,_0x5e89dc){return db[_0xbd89('0x3e')][_0xbd89('0x5b')]({'where':{'id':_0xad4be6[_0xbd89('0x58')]['id']}})[_0xbd89('0x1f')](handleEntityNotFound(_0x23319f,null))[_0xbd89('0x1f')](function(_0x131a87){if(_0x131a87){return _0x131a87[_0xbd89('0x6e')](_0xad4be6[_0xbd89('0x44')][_0xbd89('0x6b')]);}})['then'](respondWithStatusCode(_0x23319f,null))[_0xbd89('0x29')](handleError(_0x23319f,null));};exports[_0xbd89('0x6f')]=function(_0x46bf40,_0x12e44e,_0xfda6c1){return db['WhatsappAccount'][_0xbd89('0x5b')]({'where':{'id':_0x46bf40[_0xbd89('0x58')]['id']}})['then'](handleEntityNotFound(_0x12e44e,null))[_0xbd89('0x1f')](function(_0x50b8da){if(_0x50b8da){return _0x50b8da['addAgents'](_0x46bf40['body'][_0xbd89('0x6b')],_[_0xbd89('0x70')](_0x46bf40['body'],['ids','id'])||{})[_0xbd89('0x71')](function(_0x1b7cba){for(var _0x1ec779=0x0;_0x1ec779<_0x46bf40[_0xbd89('0x5d')][_0xbd89('0x6b')][_0xbd89('0x49')];_0x1ec779+=0x1){socket[_0xbd89('0x72')]('userWhatsappAccount:save',{'UserId':Number(_0x46bf40[_0xbd89('0x5d')]['ids'][_0x1ec779]),'WhatsappAccountId':Number(_0x46bf40['params']['id'])});}return _0x1b7cba;});}})[_0xbd89('0x1f')](respondWithResult(_0x12e44e,null))[_0xbd89('0x29')](handleError(_0x12e44e,null));};exports[_0xbd89('0x73')]=function(_0x2cc6ee,_0x3c0d53,_0x1a2b74){return db['WhatsappAccount'][_0xbd89('0x5b')]({'where':{'id':_0x2cc6ee['params']['id']}})[_0xbd89('0x1f')](handleEntityNotFound(_0x3c0d53,null))[_0xbd89('0x1f')](function(_0x47073a){if(_0x47073a){return _0x47073a['removeAgents'](_0x2cc6ee['query']['ids'])[_0xbd89('0x1f')](function(){if(_[_0xbd89('0x74')](_0x2cc6ee[_0xbd89('0x44')][_0xbd89('0x6b')])){for(var _0x574124=0x0;_0x574124<_0x2cc6ee[_0xbd89('0x44')][_0xbd89('0x6b')][_0xbd89('0x49')];_0x574124+=0x1){socket['emit'](_0xbd89('0x75'),{'UserId':Number(_0x2cc6ee['query'][_0xbd89('0x6b')][_0x574124]),'WhatsappAccountId':Number(_0x2cc6ee[_0xbd89('0x58')]['id'])});}}else{socket[_0xbd89('0x72')](_0xbd89('0x75'),{'UserId':Number(_0x2cc6ee[_0xbd89('0x44')][_0xbd89('0x6b')]),'WhatsappAccountId':Number(_0x2cc6ee[_0xbd89('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x3c0d53,null))[_0xbd89('0x29')](handleError(_0x3c0d53,null));};exports[_0xbd89('0x76')]=function(_0x50c8e0,_0xbf80c2,_0xb8b265){var _0x3eca14={};var _0x33872e={};var _0x459c49;var _0x26bc3f;return db[_0xbd89('0x3e')][_0xbd89('0x67')]({'where':{'id':_0x50c8e0[_0xbd89('0x58')]['id']}})['then'](handleEntityNotFound(_0xbf80c2,null))['then'](function(_0x105b63){if(_0x105b63){_0x459c49=_0x105b63;_0x33872e['model']=_['keys'](db[_0xbd89('0x77')][_0xbd89('0x3f')]);_0x33872e[_0xbd89('0x44')]=_[_0xbd89('0x5a')](_0x50c8e0['query']);_0x33872e[_0xbd89('0x45')]=_[_0xbd89('0x46')](_0x33872e['model'],_0x33872e[_0xbd89('0x44')]);_0x3eca14[_0xbd89('0x48')]=_['intersection'](_0x33872e[_0xbd89('0x43')],qs[_0xbd89('0x47')](_0x50c8e0['query'][_0xbd89('0x47')]));_0x3eca14['attributes']=_0x3eca14['attributes'][_0xbd89('0x49')]?_0x3eca14['attributes']:_0x33872e['model'];_0x3eca14['order']=qs['sort'](_0x50c8e0['query'][_0xbd89('0x4d')]);_0x3eca14[_0xbd89('0x4e')]=qs[_0xbd89('0x45')](_[_0xbd89('0x4f')](_0x50c8e0['query'],_0x33872e[_0xbd89('0x45')]));if(_0x50c8e0['query'][_0xbd89('0x50')]){_0x3eca14[_0xbd89('0x4e')]=_[_0xbd89('0x51')](_0x3eca14[_0xbd89('0x4e')],{'$or':_['map'](_0x3eca14[_0xbd89('0x48')],function(_0x47f520){var _0x234d33={};_0x234d33[_0x47f520]={'$like':'%'+_0x50c8e0['query']['filter']+'%'};return _0x234d33;})});}_0x3eca14=_[_0xbd89('0x51')]({},_0x3eca14,_0x50c8e0[_0xbd89('0x53')]);return _0x459c49[_0xbd89('0x76')](_0x3eca14);}})[_0xbd89('0x1f')](function(_0x575816){if(_0x575816){_0x26bc3f=_0x575816['length'];if(!_0x50c8e0[_0xbd89('0x44')]['hasOwnProperty'](_0xbd89('0x4b'))){_0x3eca14[_0xbd89('0x2f')]=qs[_0xbd89('0x2f')](_0x50c8e0['query'][_0xbd89('0x2f')]);_0x3eca14[_0xbd89('0x2d')]=qs[_0xbd89('0x2d')](_0x50c8e0[_0xbd89('0x44')][_0xbd89('0x2d')]);}return _0x459c49['getAgents'](_0x3eca14);}})[_0xbd89('0x1f')](function(_0x3455a9){if(_0x3455a9){return _0x3455a9?{'count':_0x26bc3f,'rows':_0x3455a9}:null;}})['then'](respondWithResult(_0xbf80c2,null))[_0xbd89('0x29')](handleError(_0xbf80c2,null));};exports[_0xbd89('0x78')]=function(_0x673da3,_0x4c0314){var _0x194df1=_0x673da3[_0xbd89('0x58')]['id'];var _0x51430a=_0x673da3[_0xbd89('0x5d')];var _0x2f2cb7=0xc8;var _0x4d5354=null;return db[_0xbd89('0x79')]['transaction']({'isolationLevel':db[_0xbd89('0x79')][_0xbd89('0x7a')][_0xbd89('0x7b')][_0xbd89('0x7c')]},function(_0x517b8a){return db[_0xbd89('0x3e')][_0xbd89('0x67')]({'where':{'id':_0x194df1},'transaction':_0x517b8a})[_0xbd89('0x1f')](function(_0x3c3601){if(_0x3c3601){return db['WhatsappApplication'][_0xbd89('0x35')]({'where':{'WhatsappAccountId':_0x194df1},'transaction':_0x517b8a})['then'](function(){var _0x47b772=_[_0xbd89('0x3d')](_0x51430a,function(_0x271190){_0x271190[_0xbd89('0x64')]=_0x194df1;return _0x271190;});return db[_0xbd89('0x7d')]['bulkCreate'](_0x47b772,{'transaction':_0x517b8a});});}else{_0x2f2cb7=0x194;_0x4d5354=[];}});})['then'](function(){if(_0x2f2cb7!==0x194){return db[_0xbd89('0x7d')][_0xbd89('0x7e')]({'where':{'WhatsappAccountId':_0x194df1},'order':_0xbd89('0x7f')})[_0xbd89('0x1f')](function(_0xdadaea){_0x4d5354=_0xdadaea;});}})[_0xbd89('0x29')](function(_0x431620){_0x2f2cb7=0x1f4;logger[_0xbd89('0x24')](_0x431620[_0xbd89('0x39')]);if(_0x431620[_0xbd89('0x3a')]){delete _0x431620[_0xbd89('0x3a')];}_0x4d5354=_0x431620;})['finally'](function(){if(_0x4d5354===null){_0x4c0314[_0xbd89('0x80')](_0x2f2cb7);}else{if(_0x2f2cb7===0x1f4){_0x4c0314[_0xbd89('0x2b')](_0x2f2cb7)['send'](_0x4d5354);}else{_0x4c0314['status'](_0x2f2cb7)[_0xbd89('0x2c')](_0x4d5354);}}});};exports[_0xbd89('0x81')]=function(_0x248fe2,_0x229e17,_0x31ec19){var _0x15cf48={};var _0x59b190={};var _0x3a7c7a;var _0x104f2b;return db[_0xbd89('0x3e')][_0xbd89('0x67')]({'where':{'id':_0x248fe2[_0xbd89('0x58')]['id']}})[_0xbd89('0x1f')](handleEntityNotFound(_0x229e17,null))[_0xbd89('0x1f')](function(_0x278d67){if(_0x278d67){_0x3a7c7a=_0x278d67;_0x59b190[_0xbd89('0x43')]=_['keys'](db[_0xbd89('0x7d')]['rawAttributes']);_0x59b190[_0xbd89('0x44')]=_[_0xbd89('0x5a')](_0x248fe2['query']);_0x59b190[_0xbd89('0x45')]=_[_0xbd89('0x46')](_0x59b190[_0xbd89('0x43')],_0x59b190[_0xbd89('0x44')]);_0x15cf48['attributes']=_[_0xbd89('0x46')](_0x59b190[_0xbd89('0x43')],qs['fields'](_0x248fe2[_0xbd89('0x44')][_0xbd89('0x47')]));_0x15cf48[_0xbd89('0x48')]=_0x15cf48[_0xbd89('0x48')][_0xbd89('0x49')]?_0x15cf48[_0xbd89('0x48')]:_0x59b190[_0xbd89('0x43')];_0x15cf48['order']=qs[_0xbd89('0x4d')](_0x248fe2['query'][_0xbd89('0x4d')]);_0x15cf48[_0xbd89('0x4e')]=qs[_0xbd89('0x45')](_[_0xbd89('0x4f')](_0x248fe2[_0xbd89('0x44')],_0x59b190[_0xbd89('0x45')]));if(_0x248fe2[_0xbd89('0x44')]['filter']){_0x15cf48[_0xbd89('0x4e')]=_[_0xbd89('0x51')](_0x15cf48[_0xbd89('0x4e')],{'$or':_[_0xbd89('0x3d')](_0x15cf48[_0xbd89('0x48')],function(_0x2f8235){var _0x1ec76d={};_0x1ec76d[_0x2f8235]={'$like':'%'+_0x248fe2[_0xbd89('0x44')][_0xbd89('0x50')]+'%'};return _0x1ec76d;})});}_0x15cf48=_[_0xbd89('0x51')]({},_0x15cf48,_0x248fe2[_0xbd89('0x53')]);return _0x3a7c7a[_0xbd89('0x81')](_0x15cf48);}})[_0xbd89('0x1f')](function(_0x26dfea){if(_0x26dfea){_0x104f2b=_0x26dfea['length'];if(!_0x248fe2['query'][_0xbd89('0x4a')](_0xbd89('0x4b'))){_0x15cf48['limit']=qs['limit'](_0x248fe2[_0xbd89('0x44')]['limit']);_0x15cf48[_0xbd89('0x2d')]=qs[_0xbd89('0x2d')](_0x248fe2[_0xbd89('0x44')][_0xbd89('0x2d')]);}return _0x3a7c7a[_0xbd89('0x81')](_0x15cf48);}})[_0xbd89('0x1f')](function(_0x35477d){if(_0x35477d){return _0x35477d?{'count':_0x104f2b,'rows':_0x35477d}:null;}})['then'](respondWithResult(_0x229e17,null))[_0xbd89('0x29')](handleError(_0x229e17,null));};exports[_0xbd89('0x82')]=function(_0x581192,_0x91e596,_0x41dfc7){var _0x3183a9={'channel':_0xbd89('0x83')};var _0x508896=[];var _0x250244=[];var _0x5ca58f={};return db[_0xbd89('0x3e')][_0xbd89('0x5b')]({'where':{'id':_0x581192['params']['id']},'include':[{'model':db[_0xbd89('0x7d')],'as':_0xbd89('0x84')}]})[_0xbd89('0x1f')](handleEntityNotFound(_0x91e596,null))[_0xbd89('0x1f')](function(_0x3f7d05){_0x3183a9[_0xbd89('0x85')]=_0x3f7d05;if(_0x3183a9[_0xbd89('0x85')]&&_0x3183a9[_0xbd89('0x85')][_0xbd89('0x41')]==='sinch'&&_0x581192[_0xbd89('0x5d')]['statuses']){if(_0x581192['body'][_0xbd89('0x86')][_0xbd89('0x49')]===0x0)return;if(_0x581192['body'][_0xbd89('0x86')][0x0][_0xbd89('0x87')]!==_0xbd89('0x88'))return;return db[_0xbd89('0x89')]['update']({'read':!![],'readAt':_0x581192[_0xbd89('0x5d')][_0xbd89('0x86')][0x0][_0xbd89('0x8a')]},{'where':{'messageId':_0x581192[_0xbd89('0x5d')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0xbd89('0x1f')](function(_0x155f4c){return _0x91e596[_0xbd89('0x2b')](0xc8)['json'](_0x155f4c);});}_0x3183a9[_0xbd89('0x8b')]=_[_0xbd89('0x8c')](_0x3f7d05[_0xbd89('0x84')],[_0xbd89('0x7f')],[_0xbd89('0x8d')]);if(_0x3183a9[_0xbd89('0x85')][_0xbd89('0x84')]){delete _0x3183a9['account'][_0xbd89('0x84')];}return db['CmContact'][_0xbd89('0x62')]()[_0xbd89('0x1f')](function(_0x474250){if(!_0x474250){throw new db[(_0xbd89('0x8e'))]['ValidationError']('no\x20available\x20attributes');}_0x508896=_[_0xbd89('0x8f')](_[_0xbd89('0x5a')](_0x474250),[_0xbd89('0x90'),_0xbd89('0x91')]);_0x250244=_[_0xbd89('0x8f')](_[_0xbd89('0x5a')](_0x474250),[_0xbd89('0x90'),'updatedAt',_0xbd89('0x92'),_0xbd89('0x93')]);_0x3183a9[_0xbd89('0x5d')]={'mapKey':_0xbd89('0x94')};if(_0x3183a9[_0xbd89('0x85')]&&_0x3183a9[_0xbd89('0x85')][_0xbd89('0x41')]===_0xbd89('0x95')){_0x3183a9[_0xbd89('0x5d')]['from']=_0x581192[_0xbd89('0x5d')][_0xbd89('0x96')][_0xbd89('0x97')](_0xbd89('0x98'),'');_0x3183a9['body'][_0xbd89('0x5d')]=_0x581192[_0xbd89('0x5d')]['Body'];_0x3183a9[_0xbd89('0x5d')]['messageId']=_0x581192[_0xbd89('0x5d')][_0xbd89('0x99')];}if(_0x3183a9[_0xbd89('0x85')]&&_0x3183a9[_0xbd89('0x85')]['type']===_0xbd89('0x9a')){_0x3183a9['body'][_0xbd89('0x9b')]=_0x581192[_0xbd89('0x5d')][_0xbd89('0x9c')][0x0][_0xbd89('0x9b')];_0x3183a9[_0xbd89('0x5d')][_0xbd89('0x5d')]=_0x581192[_0xbd89('0x5d')][_0xbd89('0x9c')][0x0]['message'][_0xbd89('0x5d')];_0x3183a9[_0xbd89('0x5d')][_0xbd89('0x9d')]=_0x581192[_0xbd89('0x5d')]['notifications'][0x0]['message_id'];}if(_0x3183a9[_0xbd89('0x5d')]['id']){delete _0x3183a9[_0xbd89('0x5d')]['id'];}if(_[_0xbd89('0x9e')](_0x3183a9[_0xbd89('0x5d')]['from'])){throw new db[(_0xbd89('0x8e'))][(_0xbd89('0x9f'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x3183a9[_0xbd89('0x5d')][_0xbd89('0x5d')])||_0x3183a9[_0xbd89('0x5d')][_0xbd89('0x5d')]===''){throw new db['Sequelize'][(_0xbd89('0x9f'))](_0xbd89('0xa0'));}if(_['isNil'](_0x3183a9[_0xbd89('0x5d')][_0xbd89('0xa1')])){throw new db[(_0xbd89('0x8e'))][(_0xbd89('0x9f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x250244);}if(!_['includes'](_0x250244,_0x3183a9[_0xbd89('0x5d')][_0xbd89('0xa1')])){throw new db[(_0xbd89('0x8e'))][(_0xbd89('0x9f'))](_0xbd89('0xa2')+_0x250244);}_0x5ca58f[_0x3183a9[_0xbd89('0x5d')]['mapKey']]=_0x3183a9['body'][_0xbd89('0x9b')];return db[_0xbd89('0xa3')][_0xbd89('0x5b')]({'where':{'id':_0x3183a9[_0xbd89('0x85')][_0xbd89('0x93')]},'include':[{'model':db['CmContact'],'as':_0xbd89('0xa4'),'where':_0x5ca58f,'limit':0x1,'order':[[_0xbd89('0x91'),_0xbd89('0xa5')]]}]});})[_0xbd89('0x1f')](handleEntityNotFound(_0x91e596,null))[_0xbd89('0x1f')](function(_0x56ba0c){if(_0x56ba0c){_0x3183a9[_0xbd89('0xa6')]=_[_0xbd89('0x70')](_0x56ba0c,[_0xbd89('0xa4')]);if(_0x56ba0c[_0xbd89('0xa4')]['length']){return _0x56ba0c[_0xbd89('0xa4')][0x0];}var _0xb8c72b=_['defaults'](_0x3183a9[_0xbd89('0x5d')],{'firstName':_0x3183a9[_0xbd89('0x5d')]['from'],'ListId':_0x56ba0c['id']});_0xb8c72b[_0x3183a9[_0xbd89('0x5d')][_0xbd89('0xa1')]]=_0x3183a9['body'][_0xbd89('0x9b')];return db['CmContact'][_0xbd89('0x5c')](_0xb8c72b,{'fields':_0x508896,'raw':!![]});}})[_0xbd89('0x1f')](handleEntityNotFound(_0x91e596,null))[_0xbd89('0x1f')](function(_0x401317){if(_0x401317){_0x3183a9[_0xbd89('0xa7')]=_0x401317;var _0x5f2692={'ContactId':_0x401317['id'],'phone':_0x3183a9[_0xbd89('0x5d')][_0xbd89('0x9b')],'WhatsappAccountId':_0x581192[_0xbd89('0x58')]['id']};var _0x479848={'ContactId':_0x401317['id'],'WhatsappAccountId':_0x581192[_0xbd89('0x58')]['id'],'closed':![]};return db[_0xbd89('0xa8')][_0xbd89('0x5b')]({'where':_0x479848})[_0xbd89('0x1f')](function(_0x3dabd8){if(_0x3dabd8){return[_0x3dabd8,![]];}return db[_0xbd89('0xa8')][_0xbd89('0x5c')](_0x5f2692)['then'](function(_0x62d892){return[_0x62d892,!![]];});});}})[_0xbd89('0x71')](function(_0x15309c,_0x49ec11){_0x3183a9[_0xbd89('0xa9')]=_0x15309c['get']({'plain':!![]});_0x3183a9[_0xbd89('0xa9')][_0xbd89('0xaa')]=![];if(_0x49ec11){if(_0x3183a9['account'][_0xbd89('0xab')]){_0x3183a9['applications'][_0xbd89('0xac')]({'id':0x0,'priority':_0x3183a9['applications'][_0xbd89('0x49')]+0x1,'app':'close','appdata':_0xbd89('0xad'),'interval':_0xbd89('0xae')});}_0x3183a9[_0xbd89('0xa9')]['created']=!![];}return db[_0xbd89('0x89')][_0xbd89('0x5c')]({'phone':_0x3183a9[_0xbd89('0x5d')][_0xbd89('0x9b')],'messageId':_0x3183a9[_0xbd89('0x5d')]['messageId'],'body':_0x3183a9[_0xbd89('0x5d')][_0xbd89('0x5d')],'WhatsappAccountId':_0x581192[_0xbd89('0x58')]['id'],'WhatsappInteractionId':_0x15309c['id'],'direction':'in','ContactId':_0x15309c['ContactId'],'AttachmentId':_0x3183a9['body']['AttachmentId']});})[_0xbd89('0x1f')](function(_0x160742){_0x3183a9[_0xbd89('0x27')]=_0x160742;if(!_0x3183a9['interaction'][_0xbd89('0xaf')])return;return db[_0xbd89('0x77')][_0xbd89('0x5b')]({'attributes':['id',_0xbd89('0x3a')],'where':{'id':_0x3183a9[_0xbd89('0xa9')][_0xbd89('0xaf')]}});})[_0xbd89('0x1f')](function(_0x16af34){if(_0x16af34){_0x3183a9['applications'][_0xbd89('0xb0')]({'id':0x0,'priority':0x0,'app':_0xbd89('0xb1'),'appdata':_0x16af34[_0xbd89('0x3a')]+','+(_0x3183a9[_0xbd89('0x85')][_0xbd89('0xb2')]||0xa),'interval':_0xbd89('0xae')});}if(!_0x3183a9['interaction'][_0xbd89('0xb3')])return;return db[_0xbd89('0xb4')][_0xbd89('0x5b')]({'attributes':['id','name'],'where':{'id':_0x3183a9[_0xbd89('0xa9')][_0xbd89('0xb3')]}});})['then'](function(_0x14f11e){if(_0x14f11e){_0x3183a9[_0xbd89('0x8b')]['unshift']({'id':0x0,'priority':0x1,'app':_0xbd89('0xb5'),'appdata':_0x14f11e[_0xbd89('0x3a')]+','+(_0x3183a9[_0xbd89('0x85')][_0xbd89('0xb6')]||0x12c),'interval':_0xbd89('0xae')});}return respondWithRpcPromise(_0xbd89('0xb7'),_0xbd89('0xb8'),_0x3183a9);})[_0xbd89('0x1f')](function(_0xfb9c1d){if(_0xfb9c1d){var _0x590302=0xc8;var _0x2586a5=_0xbd89('0xb9');logger[_0xbd89('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2586a5,_0x590302,_0xbd89('0xba'));logger[_0xbd89('0x22')](_0xbd89('0xbb'),_0x2586a5,_0x590302,_0xbd89('0xba'),JSON[_0xbd89('0xbc')](_0xfb9c1d));if(_0x3183a9[_0xbd89('0x85')][_0xbd89('0x41')]===_0xbd89('0x95')){return _0x91e596[_0xbd89('0x2b')](_0x590302)[_0xbd89('0xbd')]('Content-Type','text/xml')[_0xbd89('0xbe')](_0xbd89('0xbf'));}else{return _0x91e596[_0xbd89('0x2b')](_0x590302)[_0xbd89('0x2c')](_0xfb9c1d);}}});})[_0xbd89('0x29')](handleError(_0x91e596,null));};exports[_0xbd89('0xbe')]=function(_0x3e95b3,_0x474d1c,_0x3844a4){var _0x59484f,_0x11b417,_0x6cc93b;if(_[_0xbd89('0x9e')](_0x3e95b3['body'][_0xbd89('0x5d')])||_0x3e95b3[_0xbd89('0x5d')][_0xbd89('0x5d')]===''){throw new db[(_0xbd89('0x8e'))][(_0xbd89('0x9f'))](_0xbd89('0xa0'));}if(_['isNil'](_0x3e95b3[_0xbd89('0x5d')]['to'])){throw new db[(_0xbd89('0x8e'))][(_0xbd89('0x9f'))](_0xbd89('0xc0'));}_0x59484f=_0x3e95b3['body']['to'];return db[_0xbd89('0x3e')][_0xbd89('0x5b')]({'where':{'id':_0x3e95b3[_0xbd89('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0xbd89('0xc1'),'include':[{'model':db['CmContact'],'as':_0xbd89('0xa4'),'where':{'mobile':_0x59484f},'limit':0x1,'order':[[_0xbd89('0x91'),_0xbd89('0xa5')]]}]}]})['then'](handleEntityNotFound(_0x474d1c,null))['then'](function(_0x409dcc){if(_0x409dcc&&_0x409dcc[_0xbd89('0xc1')]){_0x11b417=_0x409dcc[_0xbd89('0x36')]({'plain':!![]});if(_0x11b417[_0xbd89('0xc1')]&&_0x11b417[_0xbd89('0xc1')][_0xbd89('0xa4')][_0xbd89('0x49')]){return _0x11b417[_0xbd89('0xc1')]['Contacts'][0x0];}return db[_0xbd89('0xc2')][_0xbd89('0x5c')](_['defaults'](_0x3e95b3['body'],{'firstName':_0x59484f,'mobile':_0x59484f,'phone':_0x59484f,'ListId':_0x11b417['ListId']}));}})['then'](handleEntityNotFound(_0x474d1c,null))[_0xbd89('0x1f')](function(_0x4221b1){if(_0x4221b1){_0x6cc93b=_0x4221b1;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x6cc93b['id'],'closed':![],'WhatsappAccountId':_0x11b417['id']}})['then'](function(_0x3d765d){if(_0x3d765d){return[_0x3d765d,![]];}return db[_0xbd89('0xa8')][_0xbd89('0x5c')]({'UserId':_0x3e95b3[_0xbd89('0x5f')]['id'],'ContactId':_0x6cc93b['id'],'WhatsappAccountId':_0x11b417['id'],'phone':_0x59484f,'firstMsgDirection':_0xbd89('0xc3'),'Messages':[_[_0xbd89('0x51')](_0x3e95b3[_0xbd89('0x5d')],{'read':![],'body':_0x3e95b3[_0xbd89('0x5d')]['body'],'phone':_0x59484f,'WhatsappAccountId':_0x11b417['id'],'UserId':_0x3e95b3['user']['id'],'ContactId':_0x6cc93b['id']})]},{'include':[{'model':db[_0xbd89('0x89')],'as':'Messages'}]})['then'](function(_0x3a886c){return[_0x3a886c,!![]];});});}})[_0xbd89('0x71')](function(_0x196923,_0x3cf8af){if(_0x3cf8af){return _0x196923;}return db[_0xbd89('0x89')][_0xbd89('0x5c')](_[_0xbd89('0x51')](_0x3e95b3[_0xbd89('0x5d')],{'read':![],'body':_0x3e95b3[_0xbd89('0x5d')][_0xbd89('0x5d')],'phone':_0x59484f,'WhatsappAccountId':_0x11b417['id'],'WhatsappInteractionId':_0x196923['id'],'UserId':_0x3e95b3[_0xbd89('0x5f')]['id'],'ContactId':_0x6cc93b['id']}))['then'](function(_0x245458){_0x196923['dataValues'][_0xbd89('0xc4')]=[];_0x196923[_0xbd89('0xc5')]['Messages'][_0xbd89('0xac')](_0x245458[_0xbd89('0xc5')]);return _0x196923;});})[_0xbd89('0x1f')](respondWithResult(_0x474d1c,null))[_0xbd89('0x29')](handleError(_0x474d1c,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 388a397..03e1961 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 _0x9832=['emit','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0x19502e,_0x2b33a4){var _0x596a4a=function(_0x56ee5c){while(--_0x56ee5c){_0x19502e['push'](_0x19502e['shift']());}};_0x596a4a(++_0x2b33a4);}(_0x9832,0xb7));var _0x2983=function(_0x4b672d,_0x9d00cf){_0x4b672d=_0x4b672d-0x0;var _0x35e14c=_0x9832[_0x4b672d];return _0x35e14c;};'use strict';var EventEmitter=require(_0x2983('0x0'));var WhatsappAccount=require(_0x2983('0x1'))['db'][_0x2983('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x2983('0x3')](0x0);var events={'afterCreate':_0x2983('0x4'),'afterUpdate':_0x2983('0x5'),'afterDestroy':_0x2983('0x6')};function emitEvent(_0x58c7ff){return function(_0x103cd3,_0x3e0100,_0x36ea61){WhatsappAccountEvents[_0x2983('0x7')](_0x58c7ff+':'+_0x103cd3['id'],_0x103cd3);WhatsappAccountEvents[_0x2983('0x7')](_0x58c7ff,_0x103cd3);_0x36ea61(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x2983('0x8')](e,emitEvent(event));}}module[_0x2983('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x5458=['remove','emit','hasOwnProperty','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update'];(function(_0xc38cb0,_0x53d0dd){var _0x55bb59=function(_0x2e2cd4){while(--_0x2e2cd4){_0xc38cb0['push'](_0xc38cb0['shift']());}};_0x55bb59(++_0x53d0dd);}(_0x5458,0x1e0));var _0x8545=function(_0x2e80f2,_0x4a8364){_0x2e80f2=_0x2e80f2-0x0;var _0x12ef3c=_0x5458[_0x2e80f2];return _0x12ef3c;};'use strict';var EventEmitter=require(_0x8545('0x0'));var WhatsappAccount=require(_0x8545('0x1'))['db'][_0x8545('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x8545('0x3')](0x0);var events={'afterCreate':_0x8545('0x4'),'afterUpdate':_0x8545('0x5'),'afterDestroy':_0x8545('0x6')};function emitEvent(_0x84992){return function(_0x38de41,_0x26c34b,_0x18bbb7){WhatsappAccountEvents[_0x8545('0x7')](_0x84992+':'+_0x38de41['id'],_0x38de41);WhatsappAccountEvents[_0x8545('0x7')](_0x84992,_0x38de41);_0x18bbb7(null);};}for(var e in events){if(events[_0x8545('0x8')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index b765917..c39e83c 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 _0x6853=['api','moment','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','util','../../config/logger'];(function(_0x3564af,_0x56463a){var _0x49e397=function(_0x3ae378){while(--_0x3ae378){_0x3564af['push'](_0x3564af['shift']());}};_0x49e397(++_0x56463a);}(_0x6853,0x98));var _0x3685=function(_0x125f8b,_0x192ef7){_0x125f8b=_0x125f8b-0x0;var _0x54372d=_0x6853[_0x125f8b];return _0x54372d;};'use strict';var _=require('lodash');var util=require(_0x3685('0x0'));var logger=require(_0x3685('0x1'))(_0x3685('0x2'));var moment=require(_0x3685('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3685('0x4'));var rimraf=require(_0x3685('0x5'));var config=require(_0x3685('0x6'));var attributes=require(_0x3685('0x7'));module[_0x3685('0x8')]=function(_0x6521ed,_0x33c585){return _0x6521ed['define'](_0x3685('0x9'),attributes,{'tableName':_0x3685('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ede=['whatsapp_accounts','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappAccount'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0x6ede,0x1e5));var _0xe6ed=function(_0x24697b,_0x2eb072){_0x24697b=_0x24697b-0x0;var _0x585b99=_0x6ede[_0x24697b];return _0x585b99;};'use strict';var _=require(_0xe6ed('0x0'));var util=require(_0xe6ed('0x1'));var logger=require('../../config/logger')(_0xe6ed('0x2'));var moment=require('moment');var BPromise=require(_0xe6ed('0x3'));var rp=require(_0xe6ed('0x4'));var fs=require('fs');var path=require(_0xe6ed('0x5'));var rimraf=require(_0xe6ed('0x6'));var config=require(_0xe6ed('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0xe6ed('0x8')]=function(_0x85c7c8,_0x21e780){return _0x85c7c8['define'](_0xe6ed('0x9'),attributes,{'tableName':_0xe6ed('0xa'),'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 be7c014..feeff0e 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 _0x05d0=['model','attributes','info','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowWhatsappAccount','WhatsappAccount','find','options','map','include'];(function(_0x220fde,_0xc52bba){var _0x14c2b5=function(_0x5e73d1){while(--_0x5e73d1){_0x220fde['push'](_0x220fde['shift']());}};_0x14c2b5(++_0xc52bba);}(_0x05d0,0x101));var _0x005d=function(_0x4eaecc,_0x4956c4){_0x4eaecc=_0x4eaecc-0x0;var _0x239f4c=_0x05d0[_0x4eaecc];return _0x239f4c;};'use strict';var _=require(_0x005d('0x0'));var util=require(_0x005d('0x1'));var moment=require(_0x005d('0x2'));var BPromise=require(_0x005d('0x3'));var rs=require(_0x005d('0x4'));var fs=require('fs');var Redis=require(_0x005d('0x5'));var db=require(_0x005d('0x6'))['db'];var utils=require(_0x005d('0x7'));var logger=require(_0x005d('0x8'))('rpc');var config=require(_0x005d('0x9'));var jayson=require(_0x005d('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x005d('0xb')]=_[_0x005d('0xc')](config['redis'],{'host':_0x005d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x005d('0xe'))[_0x005d('0xf')](socket);function respondWithRpcPromise(_0x5d1ba1,_0x477aac,_0xabea31){return new BPromise(function(_0x1e7963,_0x24d216){return client[_0x005d('0x10')](_0x5d1ba1,_0xabea31)[_0x005d('0x11')](function(_0x5d742e){logger['info'](_0x005d('0x12'),_0x477aac,_0x005d('0x13'));logger['debug'](_0x005d('0x14'),_0x477aac,_0x005d('0x13'),JSON[_0x005d('0x15')](_0x5d742e));if(_0x5d742e['error']){if(_0x5d742e[_0x005d('0x16')][_0x005d('0x17')]===0x1f4){logger[_0x005d('0x16')](_0x005d('0x12'),_0x477aac,_0x5d742e[_0x005d('0x16')]['message']);return _0x24d216(_0x5d742e[_0x005d('0x16')]['message']);}logger[_0x005d('0x16')](_0x005d('0x12'),_0x477aac,_0x5d742e[_0x005d('0x16')][_0x005d('0x18')]);return _0x1e7963(_0x5d742e[_0x005d('0x16')][_0x005d('0x18')]);}else{logger['info'](_0x005d('0x12'),_0x477aac,_0x005d('0x13'));_0x1e7963(_0x5d742e['result'][_0x005d('0x18')]);}})['catch'](function(_0x1c2c54){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x477aac,_0x1c2c54);_0x24d216(_0x1c2c54);});});}exports[_0x005d('0x19')]=function(_0x42ecdd){var _0x39d769=this;return new Promise(function(_0x323682,_0x458537){return db[_0x005d('0x1a')][_0x005d('0x1b')]({'raw':_0x42ecdd[_0x005d('0x1c')]?_0x42ecdd[_0x005d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x42ecdd[_0x005d('0x1c')]?_0x42ecdd['options']['where']||null:null,'attributes':_0x42ecdd[_0x005d('0x1c')]?_0x42ecdd[_0x005d('0x1c')]['attributes']||null:null,'include':_0x42ecdd['options']?_0x42ecdd['options']['include']?_[_0x005d('0x1d')](_0x42ecdd[_0x005d('0x1c')][_0x005d('0x1e')],function(_0x432cca){return{'model':db[_0x432cca[_0x005d('0x1f')]],'as':_0x432cca['as'],'attributes':_0x432cca[_0x005d('0x20')],'include':_0x432cca[_0x005d('0x1e')]?_[_0x005d('0x1d')](_0x432cca[_0x005d('0x1e')],function(_0xd3b0b4){return{'model':db[_0xd3b0b4[_0x005d('0x1f')]],'as':_0xd3b0b4['as'],'attributes':_0xd3b0b4[_0x005d('0x20')],'include':_0xd3b0b4[_0x005d('0x1e')]?_[_0x005d('0x1d')](_0xd3b0b4['include'],function(_0x135477){return{'model':db[_0x135477[_0x005d('0x1f')]],'as':_0x135477['as'],'attributes':_0x135477['attributes']};}):[]};}):[]};}):[]:[]})[_0x005d('0x11')](function(_0x2389df){logger[_0x005d('0x21')](_0x005d('0x19'),_0x42ecdd);logger[_0x005d('0x22')]('ShowWhatsappAccount',_0x42ecdd,JSON[_0x005d('0x15')](_0x2389df));_0x323682(_0x2389df);})[_0x005d('0x23')](function(_0x118d82){logger[_0x005d('0x16')](_0x005d('0x19'),_0x118d82[_0x005d('0x18')],_0x42ecdd);_0x458537(_0x39d769[_0x005d('0x16')](0x1f4,_0x118d82['message']));});});}; \ No newline at end of file +var _0x3859=['http','redis','localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','model','map','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1441de,_0x408ed9){var _0x26567d=function(_0x354208){while(--_0x354208){_0x1441de['push'](_0x1441de['shift']());}};_0x26567d(++_0x408ed9);}(_0x3859,0xf2));var _0x9385=function(_0x2101a8,_0x4fdf0d){_0x2101a8=_0x2101a8-0x0;var _0x1f112d=_0x3859[_0x2101a8];return _0x1f112d;};'use strict';var _=require(_0x9385('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9385('0x1'));var rs=require(_0x9385('0x2'));var fs=require('fs');var Redis=require(_0x9385('0x3'));var db=require(_0x9385('0x4'))['db'];var utils=require(_0x9385('0x5'));var logger=require(_0x9385('0x6'))(_0x9385('0x7'));var config=require(_0x9385('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9385('0x9')][_0x9385('0xa')]({'port':0x232a});config[_0x9385('0xb')]=_['defaults'](config[_0x9385('0xb')],{'host':_0x9385('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9385('0xd'))[_0x9385('0xe')](socket);function respondWithRpcPromise(_0x4c6d3f,_0x161adf,_0x459f3c){return new BPromise(function(_0x2ee876,_0x564ea7){return client[_0x9385('0xf')](_0x4c6d3f,_0x459f3c)[_0x9385('0x10')](function(_0x1e0218){logger[_0x9385('0x11')](_0x9385('0x12'),_0x161adf,_0x9385('0x13'));logger['debug'](_0x9385('0x14'),_0x161adf,'request\x20sent',JSON['stringify'](_0x1e0218));if(_0x1e0218['error']){if(_0x1e0218[_0x9385('0x15')]['code']===0x1f4){logger[_0x9385('0x15')](_0x9385('0x12'),_0x161adf,_0x1e0218[_0x9385('0x15')][_0x9385('0x16')]);return _0x564ea7(_0x1e0218['error'][_0x9385('0x16')]);}logger[_0x9385('0x15')](_0x9385('0x12'),_0x161adf,_0x1e0218[_0x9385('0x15')][_0x9385('0x16')]);return _0x2ee876(_0x1e0218[_0x9385('0x15')]['message']);}else{logger['info'](_0x9385('0x12'),_0x161adf,_0x9385('0x13'));_0x2ee876(_0x1e0218[_0x9385('0x17')]['message']);}})[_0x9385('0x18')](function(_0x2cc5ae){logger[_0x9385('0x15')](_0x9385('0x12'),_0x161adf,_0x2cc5ae);_0x564ea7(_0x2cc5ae);});});}exports[_0x9385('0x19')]=function(_0x3a5d93){var _0x9761ad=this;return new Promise(function(_0xd6c9d0,_0x583888){return db[_0x9385('0x1a')][_0x9385('0x1b')]({'raw':_0x3a5d93[_0x9385('0x1c')]?_0x3a5d93[_0x9385('0x1c')][_0x9385('0x1d')]===undefined?!![]:![]:!![],'where':_0x3a5d93[_0x9385('0x1c')]?_0x3a5d93[_0x9385('0x1c')][_0x9385('0x1e')]||null:null,'attributes':_0x3a5d93['options']?_0x3a5d93[_0x9385('0x1c')][_0x9385('0x1f')]||null:null,'include':_0x3a5d93[_0x9385('0x1c')]?_0x3a5d93[_0x9385('0x1c')][_0x9385('0x20')]?_['map'](_0x3a5d93[_0x9385('0x1c')][_0x9385('0x20')],function(_0x411b2f){return{'model':db[_0x411b2f[_0x9385('0x21')]],'as':_0x411b2f['as'],'attributes':_0x411b2f[_0x9385('0x1f')],'include':_0x411b2f['include']?_[_0x9385('0x22')](_0x411b2f[_0x9385('0x20')],function(_0x69128){return{'model':db[_0x69128[_0x9385('0x21')]],'as':_0x69128['as'],'attributes':_0x69128[_0x9385('0x1f')],'include':_0x69128[_0x9385('0x20')]?_[_0x9385('0x22')](_0x69128['include'],function(_0x9b9b2a){return{'model':db[_0x9b9b2a[_0x9385('0x21')]],'as':_0x9b9b2a['as'],'attributes':_0x9b9b2a[_0x9385('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e152c){logger[_0x9385('0x11')](_0x9385('0x19'),_0x3a5d93);logger[_0x9385('0x23')](_0x9385('0x19'),_0x3a5d93,JSON['stringify'](_0x2e152c));_0xd6c9d0(_0x2e152c);})['catch'](function(_0x434787){logger[_0x9385('0x15')]('ShowWhatsappAccount',_0x434787['message'],_0x3a5d93);_0x583888(_0x9761ad['error'](0x1f4,_0x434787[_0x9385('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index eaf9be4..99f0816 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 _0x3c1c=['save','remove','update','emit','removeListener','whatsappAccount:'];(function(_0x6b4e41,_0x3ed208){var _0x346877=function(_0x5b5d0e){while(--_0x5b5d0e){_0x6b4e41['push'](_0x6b4e41['shift']());}};_0x346877(++_0x3ed208);}(_0x3c1c,0x78));var _0xc3c1=function(_0x2067e9,_0x5e6a97){_0x2067e9=_0x2067e9-0x0;var _0x280ce4=_0x3c1c[_0x2067e9];return _0x280ce4;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xc3c1('0x0'),_0xc3c1('0x1'),_0xc3c1('0x2')];function createListener(_0x549198,_0x1dc232){return function(_0x2026d9){_0x1dc232[_0xc3c1('0x3')](_0x549198,_0x2026d9);};}function removeListener(_0x38493c,_0x40838e){return function(){WhatsappAccountEvents[_0xc3c1('0x4')](_0x38493c,_0x40838e);};}exports['register']=function(_0x52845d){for(var _0x407229=0x0,_0x2d8dae=events['length'];_0x407229<_0x2d8dae;_0x407229++){var _0x517dfd=events[_0x407229];var _0x277a0b=createListener(_0xc3c1('0x5')+_0x517dfd,_0x52845d);WhatsappAccountEvents['on'](_0x517dfd,_0x277a0b);}}; \ No newline at end of file +var _0x10c6=['emit','register','length','./whatsappAccount.events','save'];(function(_0x5cfe9a,_0x48b31a){var _0x2210ba=function(_0x1a2757){while(--_0x1a2757){_0x5cfe9a['push'](_0x5cfe9a['shift']());}};_0x2210ba(++_0x48b31a);}(_0x10c6,0x8f));var _0x610c=function(_0x22e228,_0x233f85){_0x22e228=_0x22e228-0x0;var _0x58af1d=_0x10c6[_0x22e228];return _0x58af1d;};'use strict';var WhatsappAccountEvents=require(_0x610c('0x0'));var events=[_0x610c('0x1'),'remove','update'];function createListener(_0x473747,_0x4c4034){return function(_0x38cffa){_0x4c4034[_0x610c('0x2')](_0x473747,_0x38cffa);};}function removeListener(_0x3452fc,_0x4a11bc){return function(){WhatsappAccountEvents['removeListener'](_0x3452fc,_0x4a11bc);};}exports[_0x610c('0x3')]=function(_0x573124){for(var _0x23353e=0x0,_0x53b6c5=events[_0x610c('0x4')];_0x23353e<_0x53b6c5;_0x23353e++){var _0x4ac7ce=events[_0x23353e];var _0x39f6ef=createListener('whatsappAccount:'+_0x4ac7ce,_0x573124);WhatsappAccountEvents['on'](_0x4ac7ce,_0x39f6ef);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 87599ce..0785c2b 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 _0x56d3=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x56d3,0x155));var _0x356d=function(_0x244e30,_0x17d5fc){_0x244e30=_0x244e30-0x0;var _0x339106=_0x56d3[_0x244e30];return _0x339106;};'use strict';var multer=require(_0x356d('0x0'));var util=require('util');var path=require(_0x356d('0x1'));var timeout=require(_0x356d('0x2'));var express=require(_0x356d('0x3'));var router=express['Router']();var fs_extra=require(_0x356d('0x4'));var auth=require(_0x356d('0x5'));var interaction=require(_0x356d('0x6'));var config=require(_0x356d('0x7'));var controller=require('./whatsappApplication.controller');router[_0x356d('0x8')]('/',auth[_0x356d('0x9')](),controller[_0x356d('0xa')]);router[_0x356d('0x8')](_0x356d('0xb'),auth[_0x356d('0x9')](),controller[_0x356d('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x356d('0xd')]);router[_0x356d('0xe')](_0x356d('0xb'),auth[_0x356d('0x9')](),controller[_0x356d('0xf')]);router[_0x356d('0x10')](_0x356d('0xb'),auth[_0x356d('0x9')](),controller['destroy']);module[_0x356d('0x11')]=router; \ No newline at end of file +var _0x37c6=['isAuthenticated','show','create','put','update','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id'];(function(_0xb9cb84,_0x32e936){var _0x272e1c=function(_0xadddcb){while(--_0xadddcb){_0xb9cb84['push'](_0xb9cb84['shift']());}};_0x272e1c(++_0x32e936);}(_0x37c6,0xba));var _0x637c=function(_0x2cc887,_0x21e1d1){_0x2cc887=_0x2cc887-0x0;var _0xaa2a2c=_0x37c6[_0x2cc887];return _0xaa2a2c;};'use strict';var multer=require(_0x637c('0x0'));var util=require('util');var path=require(_0x637c('0x1'));var timeout=require(_0x637c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x637c('0x3'));var config=require(_0x637c('0x4'));var controller=require(_0x637c('0x5'));router[_0x637c('0x6')]('/',auth['isAuthenticated'](),controller[_0x637c('0x7')]);router[_0x637c('0x6')](_0x637c('0x8'),auth[_0x637c('0x9')](),controller[_0x637c('0xa')]);router['post']('/',auth[_0x637c('0x9')](),controller[_0x637c('0xb')]);router[_0x637c('0xc')](_0x637c('0x8'),auth[_0x637c('0x9')](),controller[_0x637c('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x637c('0xe')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 994d97c..26fbc60 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 _0x7279=['STRING','noop','TEXT','sequelize','INTEGER'];(function(_0x4f14cb,_0x3e514b){var _0x1766a5=function(_0x1557c0){while(--_0x1557c0){_0x4f14cb['push'](_0x4f14cb['shift']());}};_0x1766a5(++_0x3e514b);}(_0x7279,0x166));var _0x9727=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7279[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x9727('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9727('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9727('0x2')],'allowNull':![],'defaultValue':_0x9727('0x3')},'appdata':{'type':Sequelize[_0x9727('0x4')]()},'description':{'type':Sequelize[_0x9727('0x2')]},'interval':{'type':Sequelize[_0x9727('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0d28=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x5012e0,_0x47a186){var _0x72706d=function(_0x13d02e){while(--_0x13d02e){_0x5012e0['push'](_0x5012e0['shift']());}};_0x72706d(++_0x47a186);}(_0x0d28,0xf1));var _0x80d2=function(_0x1d6a12,_0x49b3d3){_0x1d6a12=_0x1d6a12-0x0;var _0x3a79ca=_0x0d28[_0x1d6a12];return _0x3a79ca;};'use strict';var Sequelize=require(_0x80d2('0x0'));module[_0x80d2('0x1')]={'priority':{'type':Sequelize[_0x80d2('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x80d2('0x3')},'appdata':{'type':Sequelize[_0x80d2('0x4')]()},'description':{'type':Sequelize[_0x80d2('0x5')]},'interval':{'type':Sequelize[_0x80d2('0x5')],'defaultValue':_0x80d2('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 8b9ab51..6233f1e 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 _0x4cb5=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','where','filters','filter','VIRTUAL','merge','options','includeAll','findAll','params','include','find','catch','create','body','eml-format','rimraf','zip-dir'];(function(_0x2baa81,_0x2c18db){var _0x3c4eee=function(_0x3afa9b){while(--_0x3afa9b){_0x2baa81['push'](_0x2baa81['shift']());}};_0x3c4eee(++_0x2c18db);}(_0x4cb5,0x8f));var _0x54cb=function(_0x53aada,_0x4153ae){_0x53aada=_0x53aada-0x0;var _0x48dc4e=_0x4cb5[_0x53aada];return _0x48dc4e;};'use strict';var emlformat=require(_0x54cb('0x0'));var rimraf=require(_0x54cb('0x1'));var zipdir=require(_0x54cb('0x2'));var jsonpatch=require(_0x54cb('0x3'));var rp=require('request-promise');var moment=require(_0x54cb('0x4'));var BPromise=require(_0x54cb('0x5'));var Mustache=require(_0x54cb('0x6'));var util=require(_0x54cb('0x7'));var path=require(_0x54cb('0x8'));var sox=require(_0x54cb('0x9'));var csv=require(_0x54cb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x54cb('0xb'));var _=require(_0x54cb('0xc'));var squel=require('squel');var crypto=require(_0x54cb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x54cb('0xe'));var toCsv=require(_0x54cb('0xa'));var querystring=require(_0x54cb('0xf'));var Papa=require(_0x54cb('0x10'));var Redis=require(_0x54cb('0x11'));var authService=require(_0x54cb('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x54cb('0x13'));var logger=require(_0x54cb('0x14'))('api');var utils=require(_0x54cb('0x15'));var config=require(_0x54cb('0x16'));var licenseUtil=require(_0x54cb('0x17'));var db=require(_0x54cb('0x18'))['db'];function respondWithStatusCode(_0x3c836d,_0x23df44){_0x23df44=_0x23df44||0xcc;return function(_0x5f0986){if(_0x5f0986){return _0x3c836d[_0x54cb('0x19')](_0x23df44);}return _0x3c836d[_0x54cb('0x1a')](_0x23df44)[_0x54cb('0x1b')]();};}function respondWithResult(_0x35f25a,_0x203b6b){_0x203b6b=_0x203b6b||0xc8;return function(_0x2c2ac7){if(_0x2c2ac7){return _0x35f25a['status'](_0x203b6b)[_0x54cb('0x1c')](_0x2c2ac7);}};}function respondWithFilteredResult(_0x2a7e1b,_0x2a3d51){return function(_0x4e012){if(_0x4e012){var _0xcf951d=typeof _0x2a3d51['offset']===_0x54cb('0x1d')&&typeof _0x2a3d51[_0x54cb('0x1e')]===_0x54cb('0x1d');var _0x1af1db=_0x4e012[_0x54cb('0x1f')];var _0x4b4bef=_0xcf951d?0x0:_0x2a3d51['offset'];var _0x238364=_0xcf951d?_0x4e012[_0x54cb('0x1f')]:_0x2a3d51[_0x54cb('0x20')]+_0x2a3d51[_0x54cb('0x1e')];var _0xe30fab;if(_0x238364>=_0x1af1db){_0x238364=_0x1af1db;_0xe30fab=0xc8;}else{_0xe30fab=0xce;}_0x2a7e1b[_0x54cb('0x1a')](_0xe30fab);return _0x2a7e1b[_0x54cb('0x21')](_0x54cb('0x22'),_0x4b4bef+'-'+_0x238364+'/'+_0x1af1db)['json'](_0x4e012);}return null;};}function patchUpdates(_0x4d3c9a){return function(_0x1e5441){try{jsonpatch[_0x54cb('0x23')](_0x1e5441,_0x4d3c9a,!![]);}catch(_0x5d8f6d){return BPromise[_0x54cb('0x24')](_0x5d8f6d);}return _0x1e5441[_0x54cb('0x25')]();};}function saveUpdates(_0x725204,_0x1c4145){return function(_0x204137){if(_0x204137){return _0x204137[_0x54cb('0x26')](_0x725204)[_0x54cb('0x27')](function(_0x5e012d){return _0x5e012d;});}return null;};}function removeEntity(_0x58b9ca,_0x725a5){return function(_0x2ccd2b){if(_0x2ccd2b){return _0x2ccd2b[_0x54cb('0x28')]()[_0x54cb('0x27')](function(){_0x58b9ca['status'](0xcc)[_0x54cb('0x1b')]();});}};}function handleEntityNotFound(_0x397f5f,_0x272af7){return function(_0x1d9b28){if(!_0x1d9b28){_0x397f5f[_0x54cb('0x19')](0x194);}return _0x1d9b28;};}function handleError(_0x2a93f8,_0x5f3cf1){_0x5f3cf1=_0x5f3cf1||0x1f4;return function(_0x4d6746){logger['error'](_0x4d6746[_0x54cb('0x29')]);if(_0x4d6746[_0x54cb('0x2a')]){delete _0x4d6746[_0x54cb('0x2a')];}_0x2a93f8[_0x54cb('0x1a')](_0x5f3cf1)['send'](_0x4d6746);};}exports[_0x54cb('0x2b')]=function(_0x2df471,_0x490fb0){var _0x28dfef={},_0x3cd390={},_0x244d1a={'count':0x0,'rows':[]};var _0x121f38=_[_0x54cb('0x2c')](db[_0x54cb('0x2d')][_0x54cb('0x2e')],function(_0x489599){return{'name':_0x489599[_0x54cb('0x2f')],'type':_0x489599[_0x54cb('0x30')][_0x54cb('0x31')]};});_0x3cd390['model']=_[_0x54cb('0x2c')](_0x121f38,_0x54cb('0x2a'));_0x3cd390[_0x54cb('0x32')]=_[_0x54cb('0x33')](_0x2df471['query']);_0x3cd390['filters']=_[_0x54cb('0x34')](_0x3cd390[_0x54cb('0x35')],_0x3cd390['query']);_0x28dfef['attributes']=_[_0x54cb('0x34')](_0x3cd390[_0x54cb('0x35')],qs[_0x54cb('0x36')](_0x2df471['query'][_0x54cb('0x36')]));_0x28dfef['attributes']=_0x28dfef[_0x54cb('0x37')][_0x54cb('0x38')]?_0x28dfef[_0x54cb('0x37')]:_0x3cd390[_0x54cb('0x35')];if(!_0x2df471[_0x54cb('0x32')][_0x54cb('0x39')]('nolimit')){_0x28dfef['limit']=qs[_0x54cb('0x1e')](_0x2df471[_0x54cb('0x32')][_0x54cb('0x1e')]);_0x28dfef[_0x54cb('0x20')]=qs[_0x54cb('0x20')](_0x2df471[_0x54cb('0x32')]['offset']);}_0x28dfef[_0x54cb('0x3a')]=qs['sort'](_0x2df471[_0x54cb('0x32')]['sort']);_0x28dfef[_0x54cb('0x3b')]=qs[_0x54cb('0x3c')](_['pick'](_0x2df471[_0x54cb('0x32')],_0x3cd390[_0x54cb('0x3c')]),_0x121f38);if(_0x2df471['query'][_0x54cb('0x3d')]){_0x28dfef['where']=_['merge'](_0x28dfef[_0x54cb('0x3b')],{'$or':_['map'](_0x121f38,function(_0x569732){if(_0x569732[_0x54cb('0x30')]!==_0x54cb('0x3e')){var _0x1066b7={};_0x1066b7[_0x569732[_0x54cb('0x2a')]]={'$like':'%'+_0x2df471[_0x54cb('0x32')][_0x54cb('0x3d')]+'%'};return _0x1066b7;}})});}_0x28dfef=_[_0x54cb('0x3f')]({},_0x28dfef,_0x2df471[_0x54cb('0x40')]);var _0x213f57={'where':_0x28dfef[_0x54cb('0x3b')]};return db[_0x54cb('0x2d')][_0x54cb('0x1f')](_0x213f57)[_0x54cb('0x27')](function(_0x2177e2){_0x244d1a[_0x54cb('0x1f')]=_0x2177e2;if(_0x2df471['query'][_0x54cb('0x41')]){_0x28dfef['include']=[{'all':!![]}];}return db[_0x54cb('0x2d')][_0x54cb('0x42')](_0x28dfef);})[_0x54cb('0x27')](function(_0x18a121){_0x244d1a['rows']=_0x18a121;return _0x244d1a;})[_0x54cb('0x27')](respondWithFilteredResult(_0x490fb0,_0x28dfef))['catch'](handleError(_0x490fb0,null));};exports['show']=function(_0x1b554e,_0x1cfd40){var _0x7192e4={'raw':!![],'where':{'id':_0x1b554e[_0x54cb('0x43')]['id']}},_0x58f6c7={};_0x58f6c7[_0x54cb('0x35')]=_[_0x54cb('0x33')](db['WhatsappApplication'][_0x54cb('0x2e')]);_0x58f6c7[_0x54cb('0x32')]=_[_0x54cb('0x33')](_0x1b554e['query']);_0x58f6c7[_0x54cb('0x3c')]=_[_0x54cb('0x34')](_0x58f6c7[_0x54cb('0x35')],_0x58f6c7[_0x54cb('0x32')]);_0x7192e4[_0x54cb('0x37')]=_[_0x54cb('0x34')](_0x58f6c7[_0x54cb('0x35')],qs[_0x54cb('0x36')](_0x1b554e[_0x54cb('0x32')][_0x54cb('0x36')]));_0x7192e4[_0x54cb('0x37')]=_0x7192e4['attributes'][_0x54cb('0x38')]?_0x7192e4['attributes']:_0x58f6c7[_0x54cb('0x35')];if(_0x1b554e[_0x54cb('0x32')][_0x54cb('0x41')]){_0x7192e4[_0x54cb('0x44')]=[{'all':!![]}];}_0x7192e4=_[_0x54cb('0x3f')]({},_0x7192e4,_0x1b554e['options']);return db[_0x54cb('0x2d')][_0x54cb('0x45')](_0x7192e4)[_0x54cb('0x27')](handleEntityNotFound(_0x1cfd40,null))[_0x54cb('0x27')](respondWithResult(_0x1cfd40,null))[_0x54cb('0x46')](handleError(_0x1cfd40,null));};exports[_0x54cb('0x47')]=function(_0x28dba9,_0x181af0){return db['WhatsappApplication'][_0x54cb('0x47')](_0x28dba9['body'],{})[_0x54cb('0x27')](respondWithResult(_0x181af0,0xc9))[_0x54cb('0x46')](handleError(_0x181af0,null));};exports[_0x54cb('0x26')]=function(_0x54d332,_0x2868cd){if(_0x54d332[_0x54cb('0x48')]['id']){delete _0x54d332['body']['id'];}return db[_0x54cb('0x2d')][_0x54cb('0x45')]({'where':{'id':_0x54d332[_0x54cb('0x43')]['id']}})[_0x54cb('0x27')](handleEntityNotFound(_0x2868cd,null))[_0x54cb('0x27')](saveUpdates(_0x54d332[_0x54cb('0x48')],null))[_0x54cb('0x27')](respondWithResult(_0x2868cd,null))[_0x54cb('0x46')](handleError(_0x2868cd,null));};exports[_0x54cb('0x28')]=function(_0x30e0b4,_0x5cfb47){return db['WhatsappApplication'][_0x54cb('0x45')]({'where':{'id':_0x30e0b4[_0x54cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x5cfb47,null))[_0x54cb('0x27')](removeEntity(_0x5cfb47,null))[_0x54cb('0x46')](handleError(_0x5cfb47,null));}; \ No newline at end of file +var _0x583c=['body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','map','WhatsappApplication','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','find','create'];(function(_0x3fbdf4,_0x43428a){var _0x248e6e=function(_0xbee9f5){while(--_0xbee9f5){_0x3fbdf4['push'](_0x3fbdf4['shift']());}};_0x248e6e(++_0x43428a);}(_0x583c,0x12b));var _0xc583=function(_0x25c988,_0xce8221){_0x25c988=_0x25c988-0x0;var _0x45fcc2=_0x583c[_0x25c988];return _0x45fcc2;};'use strict';var emlformat=require(_0xc583('0x0'));var rimraf=require(_0xc583('0x1'));var zipdir=require(_0xc583('0x2'));var jsonpatch=require(_0xc583('0x3'));var rp=require('request-promise');var moment=require(_0xc583('0x4'));var BPromise=require(_0xc583('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc583('0x6'));var sox=require(_0xc583('0x7'));var csv=require('to-csv');var ejs=require(_0xc583('0x8'));var fs=require('fs');var fs_extra=require(_0xc583('0x9'));var _=require(_0xc583('0xa'));var squel=require(_0xc583('0xb'));var crypto=require('crypto');var jsforce=require(_0xc583('0xc'));var deskjs=require(_0xc583('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc583('0xe'));var Papa=require(_0xc583('0xf'));var Redis=require(_0xc583('0x10'));var authService=require(_0xc583('0x11'));var qs=require(_0xc583('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc583('0x13'));var logger=require(_0xc583('0x14'))('api');var utils=require(_0xc583('0x15'));var config=require(_0xc583('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc583('0x17'))['db'];function respondWithStatusCode(_0x87632d,_0x24343b){_0x24343b=_0x24343b||0xcc;return function(_0x267da0){if(_0x267da0){return _0x87632d[_0xc583('0x18')](_0x24343b);}return _0x87632d[_0xc583('0x19')](_0x24343b)[_0xc583('0x1a')]();};}function respondWithResult(_0xf81809,_0x1c6b79){_0x1c6b79=_0x1c6b79||0xc8;return function(_0x5403a3){if(_0x5403a3){return _0xf81809[_0xc583('0x19')](_0x1c6b79)['json'](_0x5403a3);}};}function respondWithFilteredResult(_0x19f46a,_0x299fa1){return function(_0x510090){if(_0x510090){var _0x263552=typeof _0x299fa1[_0xc583('0x1b')]==='undefined'&&typeof _0x299fa1[_0xc583('0x1c')]===_0xc583('0x1d');var _0x5127fa=_0x510090[_0xc583('0x1e')];var _0x8a2d84=_0x263552?0x0:_0x299fa1[_0xc583('0x1b')];var _0x36e0fd=_0x263552?_0x510090['count']:_0x299fa1[_0xc583('0x1b')]+_0x299fa1['limit'];var _0x227ec2;if(_0x36e0fd>=_0x5127fa){_0x36e0fd=_0x5127fa;_0x227ec2=0xc8;}else{_0x227ec2=0xce;}_0x19f46a[_0xc583('0x19')](_0x227ec2);return _0x19f46a[_0xc583('0x1f')](_0xc583('0x20'),_0x8a2d84+'-'+_0x36e0fd+'/'+_0x5127fa)[_0xc583('0x21')](_0x510090);}return null;};}function patchUpdates(_0x12b910){return function(_0x3ce81b){try{jsonpatch[_0xc583('0x22')](_0x3ce81b,_0x12b910,!![]);}catch(_0x37fcd4){return BPromise[_0xc583('0x23')](_0x37fcd4);}return _0x3ce81b[_0xc583('0x24')]();};}function saveUpdates(_0x3b31bc,_0x21466f){return function(_0x478ee1){if(_0x478ee1){return _0x478ee1['update'](_0x3b31bc)[_0xc583('0x25')](function(_0x3e075c){return _0x3e075c;});}return null;};}function removeEntity(_0x8443dc,_0x5ceef1){return function(_0x1521e2){if(_0x1521e2){return _0x1521e2[_0xc583('0x26')]()[_0xc583('0x25')](function(){_0x8443dc[_0xc583('0x19')](0xcc)[_0xc583('0x1a')]();});}};}function handleEntityNotFound(_0x48c95e,_0x4cad36){return function(_0x45871c){if(!_0x45871c){_0x48c95e['sendStatus'](0x194);}return _0x45871c;};}function handleError(_0x45ef74,_0xcbe9b2){_0xcbe9b2=_0xcbe9b2||0x1f4;return function(_0xbabf24){logger[_0xc583('0x27')](_0xbabf24[_0xc583('0x28')]);if(_0xbabf24['name']){delete _0xbabf24[_0xc583('0x29')];}_0x45ef74[_0xc583('0x19')](_0xcbe9b2)['send'](_0xbabf24);};}exports[_0xc583('0x2a')]=function(_0x483357,_0x2c9088){var _0x8d4ecb={},_0x1c80b1={},_0x3ed083={'count':0x0,'rows':[]};var _0x1b2b49=_[_0xc583('0x2b')](db[_0xc583('0x2c')]['rawAttributes'],function(_0x529dbe){return{'name':_0x529dbe[_0xc583('0x2d')],'type':_0x529dbe[_0xc583('0x2e')][_0xc583('0x2f')]};});_0x1c80b1[_0xc583('0x30')]=_[_0xc583('0x2b')](_0x1b2b49,'name');_0x1c80b1[_0xc583('0x31')]=_['keys'](_0x483357['query']);_0x1c80b1[_0xc583('0x32')]=_[_0xc583('0x33')](_0x1c80b1[_0xc583('0x30')],_0x1c80b1[_0xc583('0x31')]);_0x8d4ecb[_0xc583('0x34')]=_['intersection'](_0x1c80b1[_0xc583('0x30')],qs[_0xc583('0x35')](_0x483357[_0xc583('0x31')]['fields']));_0x8d4ecb[_0xc583('0x34')]=_0x8d4ecb['attributes'][_0xc583('0x36')]?_0x8d4ecb[_0xc583('0x34')]:_0x1c80b1[_0xc583('0x30')];if(!_0x483357[_0xc583('0x31')][_0xc583('0x37')]('nolimit')){_0x8d4ecb[_0xc583('0x1c')]=qs['limit'](_0x483357[_0xc583('0x31')]['limit']);_0x8d4ecb[_0xc583('0x1b')]=qs[_0xc583('0x1b')](_0x483357[_0xc583('0x31')][_0xc583('0x1b')]);}_0x8d4ecb[_0xc583('0x38')]=qs[_0xc583('0x39')](_0x483357['query']['sort']);_0x8d4ecb[_0xc583('0x3a')]=qs[_0xc583('0x32')](_['pick'](_0x483357[_0xc583('0x31')],_0x1c80b1[_0xc583('0x32')]),_0x1b2b49);if(_0x483357[_0xc583('0x31')][_0xc583('0x3b')]){_0x8d4ecb[_0xc583('0x3a')]=_[_0xc583('0x3c')](_0x8d4ecb['where'],{'$or':_[_0xc583('0x2b')](_0x1b2b49,function(_0x595351){if(_0x595351[_0xc583('0x2e')]!==_0xc583('0x3d')){var _0x39bed4={};_0x39bed4[_0x595351['name']]={'$like':'%'+_0x483357['query']['filter']+'%'};return _0x39bed4;}})});}_0x8d4ecb=_[_0xc583('0x3c')]({},_0x8d4ecb,_0x483357[_0xc583('0x3e')]);var _0x2b957d={'where':_0x8d4ecb[_0xc583('0x3a')]};return db['WhatsappApplication'][_0xc583('0x1e')](_0x2b957d)[_0xc583('0x25')](function(_0x594a0b){_0x3ed083['count']=_0x594a0b;if(_0x483357[_0xc583('0x31')]['includeAll']){_0x8d4ecb[_0xc583('0x3f')]=[{'all':!![]}];}return db[_0xc583('0x2c')][_0xc583('0x40')](_0x8d4ecb);})[_0xc583('0x25')](function(_0x58553e){_0x3ed083[_0xc583('0x41')]=_0x58553e;return _0x3ed083;})[_0xc583('0x25')](respondWithFilteredResult(_0x2c9088,_0x8d4ecb))[_0xc583('0x42')](handleError(_0x2c9088,null));};exports[_0xc583('0x43')]=function(_0x2c1c22,_0x5e6e7e){var _0x3ffeb7={'raw':!![],'where':{'id':_0x2c1c22['params']['id']}},_0x5f5a97={};_0x5f5a97[_0xc583('0x30')]=_[_0xc583('0x44')](db['WhatsappApplication']['rawAttributes']);_0x5f5a97[_0xc583('0x31')]=_[_0xc583('0x44')](_0x2c1c22[_0xc583('0x31')]);_0x5f5a97[_0xc583('0x32')]=_['intersection'](_0x5f5a97[_0xc583('0x30')],_0x5f5a97['query']);_0x3ffeb7[_0xc583('0x34')]=_['intersection'](_0x5f5a97[_0xc583('0x30')],qs[_0xc583('0x35')](_0x2c1c22[_0xc583('0x31')][_0xc583('0x35')]));_0x3ffeb7[_0xc583('0x34')]=_0x3ffeb7['attributes'][_0xc583('0x36')]?_0x3ffeb7[_0xc583('0x34')]:_0x5f5a97[_0xc583('0x30')];if(_0x2c1c22['query']['includeAll']){_0x3ffeb7['include']=[{'all':!![]}];}_0x3ffeb7=_[_0xc583('0x3c')]({},_0x3ffeb7,_0x2c1c22['options']);return db[_0xc583('0x2c')][_0xc583('0x45')](_0x3ffeb7)[_0xc583('0x25')](handleEntityNotFound(_0x5e6e7e,null))[_0xc583('0x25')](respondWithResult(_0x5e6e7e,null))[_0xc583('0x42')](handleError(_0x5e6e7e,null));};exports[_0xc583('0x46')]=function(_0x302038,_0x32cfbf){return db[_0xc583('0x2c')][_0xc583('0x46')](_0x302038[_0xc583('0x47')],{})['then'](respondWithResult(_0x32cfbf,0xc9))[_0xc583('0x42')](handleError(_0x32cfbf,null));};exports[_0xc583('0x48')]=function(_0x453df7,_0x230a45){if(_0x453df7['body']['id']){delete _0x453df7[_0xc583('0x47')]['id'];}return db[_0xc583('0x2c')][_0xc583('0x45')]({'where':{'id':_0x453df7[_0xc583('0x49')]['id']}})[_0xc583('0x25')](handleEntityNotFound(_0x230a45,null))[_0xc583('0x25')](saveUpdates(_0x453df7[_0xc583('0x47')],null))[_0xc583('0x25')](respondWithResult(_0x230a45,null))[_0xc583('0x42')](handleError(_0x230a45,null));};exports['destroy']=function(_0x1f4901,_0x1919fa){return db[_0xc583('0x2c')][_0xc583('0x45')]({'where':{'id':_0x1f4901[_0xc583('0x49')]['id']}})[_0xc583('0x25')](handleEntityNotFound(_0x1919fa,null))[_0xc583('0x25')](removeEntity(_0x1919fa,null))[_0xc583('0x42')](handleError(_0x1919fa,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 683af93..7844c59 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 _0x9649=['util','../../config/logger','api','bluebird','request-promise','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash'];(function(_0x375eab,_0x425848){var _0x4cc299=function(_0x334575){while(--_0x334575){_0x375eab['push'](_0x375eab['shift']());}};_0x4cc299(++_0x425848);}(_0x9649,0x19f));var _0x9964=function(_0x722346,_0x4d7546){_0x722346=_0x722346-0x0;var _0x1356e8=_0x9649[_0x722346];return _0x1356e8;};'use strict';var _=require(_0x9964('0x0'));var util=require(_0x9964('0x1'));var logger=require(_0x9964('0x2'))(_0x9964('0x3'));var moment=require('moment');var BPromise=require(_0x9964('0x4'));var rp=require(_0x9964('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9964('0x6'));var config=require('../../config/environment');var attributes=require(_0x9964('0x7'));module[_0x9964('0x8')]=function(_0x12dd14,_0x74bec9){return _0x12dd14[_0x9964('0x9')](_0x9964('0xa'),attributes,{'tableName':_0x9964('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9964('0xc')});}; \ No newline at end of file +var _0x2e8a=['utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','path','define','whatsapp_applications','utf8mb4'];(function(_0x308dcc,_0x2d1178){var _0x361717=function(_0x618aae){while(--_0x618aae){_0x308dcc['push'](_0x308dcc['shift']());}};_0x361717(++_0x2d1178);}(_0x2e8a,0xc7));var _0xa2e8=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0x2e8a[_0xce93c];return _0x230720;};'use strict';var _=require('lodash');var util=require(_0xa2e8('0x0'));var logger=require(_0xa2e8('0x1'))('api');var moment=require(_0xa2e8('0x2'));var BPromise=require(_0xa2e8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2e8('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x4593d2,_0x32fb35){return _0x4593d2[_0xa2e8('0x5')]('WhatsappApplication',attributes,{'tableName':_0xa2e8('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa2e8('0x7'),'collate':_0xa2e8('0x8')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index f19015c..1fe4728 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 _0x4ea3=['WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x4ea3,0x70));var _0x34ea=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4ea3[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40434e,_0x18b461,_0x22b09e){return new BPromise(function(_0x5bec7c,_0x341727){return client[_0x34ea('0xa')](_0x40434e,_0x22b09e)[_0x34ea('0xb')](function(_0x5132c4){logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,'request\x20sent');logger['debug'](_0x34ea('0xe'),_0x18b461,_0x34ea('0xf'),JSON[_0x34ea('0x10')](_0x5132c4));if(_0x5132c4['error']){if(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x12')]===0x1f4){logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);return _0x341727(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')]['message']);return _0x5bec7c(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}else{logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,_0x34ea('0xf'));_0x5bec7c(_0x5132c4['result'][_0x34ea('0x13')]);}})[_0x34ea('0x14')](function(_0x3fa3b0){logger[_0x34ea('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x18b461,_0x3fa3b0);_0x341727(_0x3fa3b0);});});} \ No newline at end of file +var _0x7bae=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7bae,0x13b));var _0xe7ba=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x7bae[_0x55f8b4];return _0x2475f9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5e59,_0x10b307,_0x34fb18){return new BPromise(function(_0x160565,_0x27b1d5){return client[_0xe7ba('0xa')](_0x3c5e59,_0x34fb18)[_0xe7ba('0xb')](function(_0x588f08){logger[_0xe7ba('0xc')](_0xe7ba('0xd'),_0x10b307,_0xe7ba('0xe'));logger[_0xe7ba('0xf')](_0xe7ba('0x10'),_0x10b307,_0xe7ba('0xe'),JSON[_0xe7ba('0x11')](_0x588f08));if(_0x588f08[_0xe7ba('0x12')]){if(_0x588f08[_0xe7ba('0x12')]['code']===0x1f4){logger[_0xe7ba('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x10b307,_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);return _0x27b1d5(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}logger[_0xe7ba('0x12')](_0xe7ba('0xd'),_0x10b307,_0x588f08['error']['message']);return _0x160565(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}else{logger[_0xe7ba('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x10b307,_0xe7ba('0xe'));_0x160565(_0x588f08['result']['message']);}})['catch'](function(_0x393f75){logger['error'](_0xe7ba('0xd'),_0x10b307,_0x393f75);_0x27b1d5(_0x393f75);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 6ebef1e..c173056 100644 --- a/server/api/whatsappInteraction/index.js +++ b/server/api/whatsappInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0ae=['update','delete','destroy','/:id/tags','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','index','get','/describe','isAuthenticated','show','/:id/messages','getMessages','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','/:id','whatsappinteraction:update'];(function(_0x4da034,_0x38249c){var _0x6238bf=function(_0x290feb){while(--_0x290feb){_0x4da034['push'](_0x4da034['shift']());}};_0x6238bf(++_0x38249c);}(_0xe0ae,0xa1));var _0xee0a=function(_0x5d31f3,_0x4239b0){_0x5d31f3=_0x5d31f3-0x0;var _0x1cc88c=_0xe0ae[_0x5d31f3];return _0x1cc88c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee0a('0x0'));var timeout=require(_0xee0a('0x1'));var express=require('express');var router=express[_0xee0a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xee0a('0x3'));var interaction=require(_0xee0a('0x4'));var config=require('../../config/environment');var controller=require(_0xee0a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xee0a('0x6')]);router[_0xee0a('0x7')](_0xee0a('0x8'),auth[_0xee0a('0x9')](),controller['describe']);router[_0xee0a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xee0a('0xa')]);router[_0xee0a('0x7')](_0xee0a('0xb'),auth['isAuthenticated'](),controller[_0xee0a('0xc')]);router[_0xee0a('0x7')]('/:id/download',auth[_0xee0a('0x9')](),controller['download']);router[_0xee0a('0xd')]('/',auth[_0xee0a('0x9')](),controller['create']);router[_0xee0a('0xd')]('/:id/messages',auth[_0xee0a('0x9')](),controller[_0xee0a('0xe')]);router['post']('/:id/tags',auth[_0xee0a('0x9')](),interaction[_0xee0a('0xf')](_0xee0a('0x10'),_0xee0a('0x11')),controller[_0xee0a('0x12')]);router['put'](_0xee0a('0x13'),auth[_0xee0a('0x9')](),interaction['tracked'](_0xee0a('0x10'),_0xee0a('0x14')),controller[_0xee0a('0x15')]);router[_0xee0a('0x16')]('/:id',auth[_0xee0a('0x9')](),interaction[_0xee0a('0xf')](_0xee0a('0x10'),'whatsappinteraction:destroy'),controller[_0xee0a('0x17')]);router[_0xee0a('0x16')](_0xee0a('0x18'),auth[_0xee0a('0x9')](),controller['removeTags']);module[_0xee0a('0x19')]=router; \ No newline at end of file +var _0xaa37=['describe','show','/:id/messages','getMessages','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','/:id','update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','isAuthenticated'];(function(_0x54fa11,_0x246e0a){var _0x11cd53=function(_0x1ea8a2){while(--_0x1ea8a2){_0x54fa11['push'](_0x54fa11['shift']());}};_0x11cd53(++_0x246e0a);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xaa37[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require(_0x7aa3('0x0'));var util=require(_0x7aa3('0x1'));var path=require(_0x7aa3('0x2'));var timeout=require(_0x7aa3('0x3'));var express=require('express');var router=express[_0x7aa3('0x4')]();var fs_extra=require(_0x7aa3('0x5'));var auth=require(_0x7aa3('0x6'));var interaction=require(_0x7aa3('0x7'));var config=require(_0x7aa3('0x8'));var controller=require(_0x7aa3('0x9'));router[_0x7aa3('0xa')]('/',auth['isAuthenticated'](),controller[_0x7aa3('0xb')]);router[_0x7aa3('0xa')]('/describe',auth[_0x7aa3('0xc')](),controller[_0x7aa3('0xd')]);router[_0x7aa3('0xa')]('/:id',auth[_0x7aa3('0xc')](),controller[_0x7aa3('0xe')]);router[_0x7aa3('0xa')](_0x7aa3('0xf'),auth[_0x7aa3('0xc')](),controller[_0x7aa3('0x10')]);router['get']('/:id/download',auth[_0x7aa3('0xc')](),controller['download']);router[_0x7aa3('0x11')]('/',auth[_0x7aa3('0xc')](),controller['create']);router[_0x7aa3('0x11')](_0x7aa3('0xf'),auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x7aa3('0x12'),auth[_0x7aa3('0xc')](),interaction[_0x7aa3('0x13')](_0x7aa3('0x14'),_0x7aa3('0x15')),controller['addTags']);router[_0x7aa3('0x16')](_0x7aa3('0x17'),auth[_0x7aa3('0xc')](),interaction[_0x7aa3('0x13')]('whatsapp','whatsappinteraction:update'),controller[_0x7aa3('0x18')]);router['delete'](_0x7aa3('0x17'),auth[_0x7aa3('0xc')](),interaction['tracked'](_0x7aa3('0x14'),_0x7aa3('0x19')),controller[_0x7aa3('0x1a')]);router[_0x7aa3('0x1b')](_0x7aa3('0x12'),auth['isAuthenticated'](),controller[_0x7aa3('0x1c')]);module[_0x7aa3('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index f0629b2..6372ce1 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 _0x2dd8=['INTEGER','sequelize','moment','DATE','STRING','out','ENUM'];(function(_0xf0847f,_0x64ca03){var _0x53c80c=function(_0x18adbb){while(--_0x18adbb){_0xf0847f['push'](_0xf0847f['shift']());}};_0x53c80c(++_0x64ca03);}(_0x2dd8,0x143));var _0x82dd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2dd8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x82dd('0x0'));var moment=require(_0x82dd('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x82dd('0x2')]},'disposition':{'type':Sequelize[_0x82dd('0x3')]},'secondDisposition':{'type':Sequelize[_0x82dd('0x3')]},'thirdDisposition':{'type':Sequelize[_0x82dd('0x3')]},'note':{'type':Sequelize[_0x82dd('0x3')]},'phone':{'type':Sequelize[_0x82dd('0x3')]},'read1stAt':{'type':Sequelize[_0x82dd('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x82dd('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x82dd('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x82dd('0x5')]('in',_0x82dd('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x82dd('0x6')]}}; \ No newline at end of file +var _0xd914=['moment','BOOLEAN','DATE','STRING','out','ENUM','INTEGER','sequelize'];(function(_0x11e210,_0x6ddd11){var _0x18f889=function(_0x321a8c){while(--_0x321a8c){_0x11e210['push'](_0x11e210['shift']());}};_0x18f889(++_0x6ddd11);}(_0xd914,0x17f));var _0x4d91=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0xd914[_0x134827];return _0x366671;};'use strict';var Sequelize=require(_0x4d91('0x0'));var moment=require(_0x4d91('0x1'));module['exports']={'closed':{'type':Sequelize[_0x4d91('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4d91('0x3')]},'disposition':{'type':Sequelize[_0x4d91('0x4')]},'secondDisposition':{'type':Sequelize[_0x4d91('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4d91('0x4')]},'note':{'type':Sequelize[_0x4d91('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x4d91('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4d91('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4d91('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4d91('0x6')]('in',_0x4d91('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4d91('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4d91('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 06ac3e3..83b55ef 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 _0xe69c=['N.A.','createdAt','closed','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','firstName','value','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','map','WhatsappInteraction','rawAttributes','fieldName','type','key','findAll','whatsapp','query','user','catch','show','params','model','keys','filters','intersection','fields','attributes','length','options','find','create','body','describe','addMessage','WhatsappMessage','ids','getMessages','nolimit','order','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','merge','includeAll','rows','setTags','spread','Tag','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','User','CmContact','Contact','lastName','Attachment','secret','read','Account','fullname','get','mkdirSync','Whatsapp','Owner'];(function(_0x5c0305,_0x394013){var _0x24ee16=function(_0x4669ac){while(--_0x4669ac){_0x5c0305['push'](_0x5c0305['shift']());}};_0x24ee16(++_0x394013);}(_0xe69c,0x18e));var _0xce69=function(_0x4de452,_0x53a80f){_0x4de452=_0x4de452-0x0;var _0x2a80ee=_0xe69c[_0x4de452];return _0x2a80ee;};'use strict';var rimraf=require(_0xce69('0x0'));var zipdir=require(_0xce69('0x1'));var moment=require(_0xce69('0x2'));var BPromise=require(_0xce69('0x3'));var util=require(_0xce69('0x4'));var path=require(_0xce69('0x5'));var ejs=require(_0xce69('0x6'));var fs=require('fs');var _=require(_0xce69('0x7'));var Redis=require(_0xce69('0x8'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')('api');var config=require(_0xce69('0x9'));var db=require(_0xce69('0xa'))['db'];config[_0xce69('0xb')]=_[_0xce69('0xc')](config[_0xce69('0xb')],{'host':_0xce69('0xd'),'port':0x18eb});var socket=require(_0xce69('0xe'))(new Redis(config[_0xce69('0xb')]));require('./whatsappInteraction.socket')[_0xce69('0xf')](socket);function respondWithStatusCode(_0x54ebab,_0x5c5668){_0x5c5668=_0x5c5668||0xcc;return function(_0x57cd55){if(_0x57cd55){return _0x54ebab[_0xce69('0x10')](_0x5c5668);}return _0x54ebab[_0xce69('0x11')](_0x5c5668)[_0xce69('0x12')]();};}function respondWithResult(_0x1baea8,_0x4e9bd3){_0x4e9bd3=_0x4e9bd3||0xc8;return function(_0x257215){if(_0x257215){return _0x1baea8[_0xce69('0x11')](_0x4e9bd3)[_0xce69('0x13')](_0x257215);}};}function respondWithFilteredResult(_0x13b90f,_0x3ab651){return function(_0x5b7c62){if(_0x5b7c62){var _0xa4eb22=typeof _0x3ab651['offset']===_0xce69('0x14')&&typeof _0x3ab651[_0xce69('0x15')]===_0xce69('0x14');var _0x287125=_0x5b7c62[_0xce69('0x16')];var _0x13b80d=_0xa4eb22?0x0:_0x3ab651[_0xce69('0x17')];var _0x27dcca=_0xa4eb22?_0x5b7c62[_0xce69('0x16')]:_0x3ab651[_0xce69('0x17')]+_0x3ab651[_0xce69('0x15')];var _0xece258;if(_0x27dcca>=_0x287125){_0x27dcca=_0x287125;_0xece258=0xc8;}else{_0xece258=0xce;}_0x13b90f[_0xce69('0x11')](_0xece258);return _0x13b90f[_0xce69('0x18')](_0xce69('0x19'),_0x13b80d+'-'+_0x27dcca+'/'+_0x287125)[_0xce69('0x13')](_0x5b7c62);}return null;};}function saveUpdates(_0x160ef9){return function(_0x580176){if(_0x580176){return _0x580176[_0xce69('0x1a')](_0x160ef9)[_0xce69('0x1b')](function(_0x43ea1b){return _0x43ea1b;});}return null;};}function removeEntity(_0x134eac){return function(_0x282bf6){if(_0x282bf6){return _0x282bf6[_0xce69('0x1c')]()['then'](function(){_0x134eac[_0xce69('0x11')](0xcc)[_0xce69('0x12')]();});}};}function handleEntityNotFound(_0x4734ad){return function(_0x4080a3){if(!_0x4080a3){_0x4734ad[_0xce69('0x10')](0x194);}return _0x4080a3;};}function handleError(_0x55eee5,_0x4c717b){_0x4c717b=_0x4c717b||0x1f4;return function(_0x4335a7){logger[_0xce69('0x1d')](_0x4335a7[_0xce69('0x1e')]);if(_0x4335a7[_0xce69('0x1f')]){delete _0x4335a7[_0xce69('0x1f')];}_0x55eee5['status'](_0x4c717b)['send'](_0x4335a7);};}exports['index']=function(_0x34a4ec,_0x974668){var _0x385b61={};var _0x347ec4=_[_0xce69('0x20')](db[_0xce69('0x21')][_0xce69('0x22')],function(_0x558ad9){return{'name':_0x558ad9[_0xce69('0x23')],'type':_0x558ad9[_0xce69('0x24')][_0xce69('0x25')]};});_0x385b61=qs['getOptions'](_0x347ec4,_0x34a4ec);return interaction[_0xce69('0x26')](_0xce69('0x27'),_0x34a4ec[_0xce69('0x28')],_0x34a4ec[_0xce69('0x29')],_0x385b61,_0x347ec4)['then'](respondWithFilteredResult(_0x974668,_0x385b61))[_0xce69('0x2a')](handleError(_0x974668,null));};exports[_0xce69('0x2b')]=function(_0x164154,_0x13cecc){var _0x453c46={'raw':![],'where':{'id':_0x164154[_0xce69('0x2c')]['id']}},_0x19bb1a={};_0x19bb1a[_0xce69('0x2d')]=_[_0xce69('0x2e')](db[_0xce69('0x21')][_0xce69('0x22')]);_0x19bb1a['query']=_[_0xce69('0x2e')](_0x164154[_0xce69('0x28')]);_0x19bb1a[_0xce69('0x2f')]=_[_0xce69('0x30')](_0x19bb1a[_0xce69('0x2d')],_0x19bb1a[_0xce69('0x28')]);_0x453c46['attributes']=_['intersection'](_0x19bb1a[_0xce69('0x2d')],qs[_0xce69('0x31')](_0x164154['query']['fields']));_0x453c46[_0xce69('0x32')]=_0x453c46['attributes'][_0xce69('0x33')]?_0x453c46[_0xce69('0x32')]:_0x19bb1a['model'];if(_0x164154[_0xce69('0x28')]['includeAll']){_0x453c46['include']=[{'all':!![]}];}_0x453c46=_['merge']({},_0x453c46,_0x164154[_0xce69('0x34')]);return db['WhatsappInteraction'][_0xce69('0x35')](_0x453c46)[_0xce69('0x1b')](handleEntityNotFound(_0x13cecc,null))['then'](respondWithResult(_0x13cecc,null))[_0xce69('0x2a')](handleError(_0x13cecc,null));};exports[_0xce69('0x36')]=function(_0x1f7b0e,_0x2cccc6){return db[_0xce69('0x21')][_0xce69('0x36')](_0x1f7b0e['body'],{})[_0xce69('0x1b')](respondWithResult(_0x2cccc6,0xc9))[_0xce69('0x2a')](handleError(_0x2cccc6,null));};exports[_0xce69('0x1a')]=function(_0xd5f98f,_0x36b65a){if(_0xd5f98f[_0xce69('0x37')]['id']){delete _0xd5f98f[_0xce69('0x37')]['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0xd5f98f[_0xce69('0x2c')]['id']}})[_0xce69('0x1b')](handleEntityNotFound(_0x36b65a,null))[_0xce69('0x1b')](saveUpdates(_0xd5f98f[_0xce69('0x37')],null))[_0xce69('0x1b')](respondWithResult(_0x36b65a,null))[_0xce69('0x2a')](handleError(_0x36b65a,null));};exports[_0xce69('0x1c')]=function(_0x1c1385,_0x2e3c8d){return db[_0xce69('0x21')][_0xce69('0x35')]({'where':{'id':_0x1c1385[_0xce69('0x2c')]['id']}})[_0xce69('0x1b')](handleEntityNotFound(_0x2e3c8d,null))['then'](removeEntity(_0x2e3c8d,null))['catch'](handleError(_0x2e3c8d,null));};exports['describe']=function(_0x16ae0d,_0x4cc964){return db[_0xce69('0x21')][_0xce69('0x38')]()['then'](respondWithResult(_0x4cc964,null))[_0xce69('0x2a')](handleError(_0x4cc964,null));};exports[_0xce69('0x39')]=function(_0x408542,_0x39da3b){return db[_0xce69('0x3a')][_0xce69('0x35')]({'where':{'id':_0x408542[_0xce69('0x2c')]['id']}})[_0xce69('0x1b')](handleEntityNotFound(_0x39da3b,null))[_0xce69('0x1b')](function(_0x2ef8b8){if(_0x2ef8b8){return _0x2ef8b8[_0xce69('0x39')](_0x408542[_0xce69('0x37')][_0xce69('0x3b')],_['omit'](_0x408542[_0xce69('0x37')],['ids','id'])||{});}})[_0xce69('0x1b')](respondWithResult(_0x39da3b,null))['catch'](handleError(_0x39da3b,null));};exports[_0xce69('0x3c')]=function(_0x1980d4,_0x1ae3c1){var _0x1bcf07={'raw':![],'where':{}};var _0x52f8f9={};var _0x5bc07f={'count':0x0,'rows':[]};return db[_0xce69('0x21')]['findOne']({'where':{'id':_0x1980d4[_0xce69('0x2c')]['id']}})[_0xce69('0x1b')](handleEntityNotFound(_0x1ae3c1,null))[_0xce69('0x1b')](function(_0xafe0e0){if(_0xafe0e0){_0x52f8f9[_0xce69('0x2d')]=_[_0xce69('0x2e')](db[_0xce69('0x3a')][_0xce69('0x22')]);_0x52f8f9['query']=_[_0xce69('0x2e')](_0x1980d4[_0xce69('0x28')]);_0x52f8f9['filters']=_['intersection'](_0x52f8f9['model'],_0x52f8f9[_0xce69('0x28')]);_0x1bcf07['attributes']=_[_0xce69('0x30')](_0x52f8f9['model'],qs[_0xce69('0x31')](_0x1980d4['query']['fields']));_0x1bcf07[_0xce69('0x32')]=_0x1bcf07['attributes'][_0xce69('0x33')]?_0x1bcf07['attributes']:_0x52f8f9['model'];if(!_0x1980d4['query']['hasOwnProperty'](_0xce69('0x3d'))){_0x1bcf07[_0xce69('0x15')]=qs[_0xce69('0x15')](_0x1980d4['query'][_0xce69('0x15')]);_0x1bcf07[_0xce69('0x17')]=qs[_0xce69('0x17')](_0x1980d4[_0xce69('0x28')][_0xce69('0x17')]);}_0x1bcf07[_0xce69('0x3e')]=qs['sort'](_0x1980d4['query']['sort']);_0x1bcf07[_0xce69('0x3f')]=qs[_0xce69('0x2f')](_[_0xce69('0x40')](_0x1980d4[_0xce69('0x28')],_0x52f8f9[_0xce69('0x2f')]));_0x1bcf07[_0xce69('0x3f')]['WhatsappInteractionId']=_0xafe0e0['id'];if(_0x1980d4[_0xce69('0x28')][_0xce69('0x41')]){_0x1bcf07[_0xce69('0x3f')]=_['merge'](_0x1bcf07['where'],{'$or':_[_0xce69('0x20')](_0x1bcf07['attributes'],function(_0x3ec5ad){var _0xb45b48={};_0xb45b48[_0x3ec5ad]={'$like':'%'+_0x1980d4[_0xce69('0x28')][_0xce69('0x41')]+'%'};return _0xb45b48;})});}if(_0x1980d4['query']['$gte']){var _0x4bd463=_0x1980d4[_0xce69('0x28')][_0xce69('0x42')][_0xce69('0x43')](',');var _0x5379af={};_0x5379af[_0x4bd463[0x0]]={'$gte':moment(_0x4bd463[0x1])['format'](_0xce69('0x44'))};_0x1bcf07[_0xce69('0x3f')]=_[_0xce69('0x45')](_0x1bcf07[_0xce69('0x3f')],_0x5379af);}_0x1bcf07=_['merge']({},_0x1bcf07,_0x1980d4[_0xce69('0x34')]);return db[_0xce69('0x3a')]['count']({'where':_0x1bcf07[_0xce69('0x3f')]})[_0xce69('0x1b')](function(_0x282634){_0x5bc07f['count']=_0x282634;if(_0x1980d4['query'][_0xce69('0x46')]){_0x1bcf07['include']=[{'all':!![]}];}return db[_0xce69('0x3a')][_0xce69('0x26')](_0x1bcf07);})[_0xce69('0x1b')](function(_0x2fb1c7){_0x5bc07f[_0xce69('0x47')]=_0x2fb1c7;return _0x5bc07f;});}})[_0xce69('0x1b')](respondWithFilteredResult(_0x1ae3c1,_0x1bcf07))['catch'](handleError(_0x1ae3c1,null));};exports['addTags']=function(_0x27a3f9,_0x331106){return db['WhatsappInteraction'][_0xce69('0x35')]({'where':{'id':_0x27a3f9['params']['id']}})[_0xce69('0x1b')](handleEntityNotFound(_0x331106,null))[_0xce69('0x1b')](function(_0xda00e4){if(_0xda00e4){return _0xda00e4[_0xce69('0x48')](_0x27a3f9[_0xce69('0x37')][_0xce69('0x3b')],_['omit'](_0x27a3f9[_0xce69('0x37')],['ids','id'])||{})[_0xce69('0x49')](function(){return db[_0xce69('0x4a')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x27a3f9[_0xce69('0x37')][_0xce69('0x3b')]}});})['then'](function(_0x472064){socket['emit'](_0xce69('0x4b'),{'id':Number(_0x27a3f9[_0xce69('0x2c')]['id']),'tags':_0x472064||[]});return{'id':Number(_0x27a3f9[_0xce69('0x2c')]['id']),'tags':_0x472064||[]};});}})[_0xce69('0x1b')](respondWithResult(_0x331106,null))['catch'](handleError(_0x331106,null));};exports['removeTags']=function(_0x599671,_0x160eb7){return db[_0xce69('0x21')][_0xce69('0x35')]({'where':{'id':_0x599671[_0xce69('0x2c')]['id']}})[_0xce69('0x1b')](handleEntityNotFound(_0x160eb7,null))[_0xce69('0x1b')](function(_0x35ecb4){if(_0x35ecb4){return _0x35ecb4[_0xce69('0x4c')](_0x599671[_0xce69('0x28')][_0xce69('0x3b')]);}})[_0xce69('0x1b')](respondWithStatusCode(_0x160eb7,null))[_0xce69('0x2a')](handleError(_0x160eb7,null));};exports[_0xce69('0x4d')]=function(_0x405c2a,_0x338fe0){var _0x327043=moment()[_0xce69('0x4e')]()[_0xce69('0x4f')]();var _0x20f2e1=path[_0xce69('0x50')](config[_0xce69('0x51')],_0xce69('0x52'),_0xce69('0x53'),_0xce69('0x54'));var _0x34a552=path[_0xce69('0x50')](config['root'],'server','files',_0xce69('0x55'));var _0x430f41=path[_0xce69('0x50')](_0x20f2e1,_0x327043);var _0x524c71=util[_0xce69('0x56')](_0xce69('0x57'),_0x405c2a[_0xce69('0x2c')]['id'],_0x327043);var _0x4b341e=path[_0xce69('0x50')](_0x20f2e1,_0x524c71);var _0x44e241=[];_0x44e241[_0xce69('0x58')]({'model':db[_0xce69('0x59')],'as':_0xce69('0x59'),'attributes':['id','fullname'],'raw':!![]});_0x44e241[_0xce69('0x58')]({'model':db[_0xce69('0x5a')],'as':_0xce69('0x5b'),'attributes':['id','firstName',_0xce69('0x5c')],'raw':!![]});if(_0x405c2a[_0xce69('0x28')]['attachments']){_0x44e241['push']({'model':db['Attachment'],'as':_0xce69('0x5d'),'raw':!![]});}var _0x23607d=[{'model':db[_0xce69('0x3a')],'as':'Messages','attributes':['id',_0xce69('0x37'),'createdAt','direction',_0xce69('0x5e'),_0xce69('0x5f')],'include':_0x44e241}];_0x23607d[_0xce69('0x58')]({'model':db['WhatsappAccount'],'as':_0xce69('0x60'),'attributes':['id',_0xce69('0x1f')]});_0x23607d[_0xce69('0x58')]({'model':db[_0xce69('0x59')],'as':'Owner','attributes':['id',_0xce69('0x61')]});return db[_0xce69('0x21')]['find']({'where':{'id':_0x405c2a[_0xce69('0x2c')]['id']},'include':_0x23607d})[_0xce69('0x1b')](handleEntityNotFound(_0x338fe0,null))[_0xce69('0x1b')](function(_0x2ee97d){if(_0x2ee97d){var _0x48490d=_0x2ee97d[_0xce69('0x62')]({'plain':!![]});fs[_0xce69('0x63')](_0x430f41);var _0x53c0cc={'channel':_0xce69('0x64'),'account':_0x48490d[_0xce69('0x60')]['name'],'agent':_0x48490d[_0xce69('0x65')]?_0x48490d[_0xce69('0x65')][_0xce69('0x61')]:_0xce69('0x66'),'createdAt':moment(_0x48490d[_0xce69('0x67')])[_0xce69('0x56')]('YYYY-MM-DD\x20HH:mm:ss')[_0xce69('0x4f')](),'closedAt':_0x48490d[_0xce69('0x68')]?moment(_0x48490d[_0xce69('0x69')])['format'](_0xce69('0x44'))[_0xce69('0x4f')]():'','disposition':_0x48490d[_0xce69('0x6a')],'messages':_(_0x48490d[_0xce69('0x6b')])[_0xce69('0x41')]({'secret':![]})['map'](function(_0x2c22f9){if(_0x2c22f9['Attachment']){var _0x5b60a7=path[_0xce69('0x50')](_0x34a552,_0x2c22f9[_0xce69('0x5d')][_0xce69('0x6c')]);if(fs[_0xce69('0x6d')](_0x5b60a7)){fs[_0xce69('0x6e')](_0x5b60a7)[_0xce69('0x6f')](fs[_0xce69('0x70')](path[_0xce69('0x50')](_0x430f41,_0x2c22f9[_0xce69('0x5d')][_0xce69('0x6c')])));}}return{'date':moment(_0x2c22f9['createdAt'])['format'](_0xce69('0x44'))['toString'](),'sender':_0x2c22f9[_0xce69('0x71')]===_0xce69('0x72')?_0x2c22f9[_0xce69('0x59')]?_0x2c22f9[_0xce69('0x59')][_0xce69('0x61')]:_0xce69('0x73'):_0x2c22f9[_0xce69('0x5b')][_0xce69('0x74')]+(_0x2c22f9[_0xce69('0x5b')]['lastName']?'\x20'+_0x2c22f9[_0xce69('0x5b')][_0xce69('0x5c')]:''),'body':_0x2c22f9[_0xce69('0x5d')]?_0x2c22f9[_0xce69('0x5d')][_0xce69('0x6c')]:_0x2c22f9[_0xce69('0x37')],'direction':_0x2c22f9[_0xce69('0x71')]===_0xce69('0x72')?'A':'C','secret':_0x2c22f9[_0xce69('0x5e')],'read':_0x2c22f9[_0xce69('0x5f')],'attachment':_0x2c22f9[_0xce69('0x5d')]};})[_0xce69('0x75')]()};return ejs['renderFile'](path['join'](config['root'],'server','views',_0xce69('0x76')),{'interaction':_0x53c0cc})[_0xce69('0x1b')](function(_0x25b042){var _0x14dd5d=path[_0xce69('0x50')](_0x430f41,_0xce69('0x77')+_0x48490d['id']+'-'+_0x327043+_0xce69('0x78'));var _0xf162af={'path':_0x14dd5d,'channel':_0xce69('0x64'),'interactionId':_0x48490d['id']};return pdf[_0xce69('0x79')](_0x25b042,_0xf162af);})[_0xce69('0x1b')](function(){return new BPromise(function(_0x230633,_0x2d18f8){zipdir(_0x430f41,{'saveTo':_0x4b341e},function(_0x3b5556,_0x4ee59d){if(_0x3b5556)return _0x2d18f8(_0x3b5556);return _0x230633(_0x4ee59d);});})[_0xce69('0x1b')](function(){return new BPromise(function(_0x5c33ba,_0x4e8707){rimraf(_0x430f41,function(_0x3aeab7){if(_0x3aeab7)_0x4e8707(_0x3aeab7);return _0x5c33ba();});});})[_0xce69('0x1b')](function(){return _0x338fe0['download'](_0x4b341e,_0x524c71,function(_0xc27f60){if(_0xc27f60){console[_0xce69('0x7a')](_0xce69('0x7b'),_0xc27f60);}else{fs[_0xce69('0x7c')](_0x4b341e);}});});});}else{return _0x338fe0[_0xce69('0x10')](0xc8);}})[_0xce69('0x2a')](handleError(_0x338fe0,null));}; \ No newline at end of file +var _0x5b4e=['renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','name','send','index','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','query','catch','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','options','find','create','body','describe','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','merge','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','findAll','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','root','server','files','join','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','secret','read','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','Account','closed','closedAt','disposition','basename','createReadStream','pipe','direction','out','System','Contact','value'];(function(_0x15af84,_0x7a5b4d){var _0x5ac0a4=function(_0x97cb67){while(--_0x97cb67){_0x15af84['push'](_0x15af84['shift']());}};_0x5ac0a4(++_0x7a5b4d);}(_0x5b4e,0x10a));var _0xe5b4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5b4e[_0x321bb2];return _0x9c12ed;};'use strict';var rimraf=require(_0xe5b4('0x0'));var zipdir=require('zip-dir');var moment=require(_0xe5b4('0x1'));var BPromise=require(_0xe5b4('0x2'));var util=require(_0xe5b4('0x3'));var path=require(_0xe5b4('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe5b4('0x5'));var Redis=require(_0xe5b4('0x6'));var interaction=require(_0xe5b4('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0xe5b4('0x8'));var logger=require(_0xe5b4('0x9'))(_0xe5b4('0xa'));var config=require('../../config/environment');var db=require(_0xe5b4('0xb'))['db'];config[_0xe5b4('0xc')]=_[_0xe5b4('0xd')](config[_0xe5b4('0xc')],{'host':_0xe5b4('0xe'),'port':0x18eb});var socket=require(_0xe5b4('0xf'))(new Redis(config[_0xe5b4('0xc')]));require('./whatsappInteraction.socket')[_0xe5b4('0x10')](socket);function respondWithStatusCode(_0x5a1fea,_0x44a2a6){_0x44a2a6=_0x44a2a6||0xcc;return function(_0x154d6e){if(_0x154d6e){return _0x5a1fea[_0xe5b4('0x11')](_0x44a2a6);}return _0x5a1fea[_0xe5b4('0x12')](_0x44a2a6)['end']();};}function respondWithResult(_0x195371,_0x269598){_0x269598=_0x269598||0xc8;return function(_0x2c969f){if(_0x2c969f){return _0x195371[_0xe5b4('0x12')](_0x269598)[_0xe5b4('0x13')](_0x2c969f);}};}function respondWithFilteredResult(_0x11ad53,_0xbcd514){return function(_0x57e873){if(_0x57e873){var _0x412993=typeof _0xbcd514[_0xe5b4('0x14')]===_0xe5b4('0x15')&&typeof _0xbcd514[_0xe5b4('0x16')]==='undefined';var _0x382e6b=_0x57e873['count'];var _0x50d329=_0x412993?0x0:_0xbcd514['offset'];var _0x439917=_0x412993?_0x57e873[_0xe5b4('0x17')]:_0xbcd514[_0xe5b4('0x14')]+_0xbcd514[_0xe5b4('0x16')];var _0x372a89;if(_0x439917>=_0x382e6b){_0x439917=_0x382e6b;_0x372a89=0xc8;}else{_0x372a89=0xce;}_0x11ad53['status'](_0x372a89);return _0x11ad53[_0xe5b4('0x18')](_0xe5b4('0x19'),_0x50d329+'-'+_0x439917+'/'+_0x382e6b)[_0xe5b4('0x13')](_0x57e873);}return null;};}function saveUpdates(_0x17f312){return function(_0x1dbf7f){if(_0x1dbf7f){return _0x1dbf7f[_0xe5b4('0x1a')](_0x17f312)[_0xe5b4('0x1b')](function(_0x54deb4){return _0x54deb4;});}return null;};}function removeEntity(_0xdf49bc){return function(_0x154340){if(_0x154340){return _0x154340[_0xe5b4('0x1c')]()[_0xe5b4('0x1b')](function(){_0xdf49bc['status'](0xcc)[_0xe5b4('0x1d')]();});}};}function handleEntityNotFound(_0x20ede9){return function(_0x40d043){if(!_0x40d043){_0x20ede9[_0xe5b4('0x11')](0x194);}return _0x40d043;};}function handleError(_0x37c940,_0x1cc19e){_0x1cc19e=_0x1cc19e||0x1f4;return function(_0x1a38c1){logger[_0xe5b4('0x1e')](_0x1a38c1['stack']);if(_0x1a38c1['name']){delete _0x1a38c1[_0xe5b4('0x1f')];}_0x37c940[_0xe5b4('0x12')](_0x1cc19e)[_0xe5b4('0x20')](_0x1a38c1);};}exports[_0xe5b4('0x21')]=function(_0x465cb1,_0x2e5a1a){var _0x7eac54={};var _0x7abd47=_['map'](db[_0xe5b4('0x22')][_0xe5b4('0x23')],function(_0x4bf8e4){return{'name':_0x4bf8e4[_0xe5b4('0x24')],'type':_0x4bf8e4[_0xe5b4('0x25')][_0xe5b4('0x26')]};});_0x7eac54=qs[_0xe5b4('0x27')](_0x7abd47,_0x465cb1);return interaction['findAll']('whatsapp',_0x465cb1[_0xe5b4('0x28')],_0x465cb1['user'],_0x7eac54,_0x7abd47)[_0xe5b4('0x1b')](respondWithFilteredResult(_0x2e5a1a,_0x7eac54))[_0xe5b4('0x29')](handleError(_0x2e5a1a,null));};exports['show']=function(_0xcf3dae,_0x4447b0){var _0x5573f9={'raw':![],'where':{'id':_0xcf3dae[_0xe5b4('0x2a')]['id']}},_0x2e0f52={};_0x2e0f52[_0xe5b4('0x2b')]=_[_0xe5b4('0x2c')](db[_0xe5b4('0x22')]['rawAttributes']);_0x2e0f52[_0xe5b4('0x28')]=_['keys'](_0xcf3dae[_0xe5b4('0x28')]);_0x2e0f52[_0xe5b4('0x2d')]=_[_0xe5b4('0x2e')](_0x2e0f52['model'],_0x2e0f52['query']);_0x5573f9['attributes']=_[_0xe5b4('0x2e')](_0x2e0f52[_0xe5b4('0x2b')],qs[_0xe5b4('0x2f')](_0xcf3dae['query'][_0xe5b4('0x2f')]));_0x5573f9[_0xe5b4('0x30')]=_0x5573f9[_0xe5b4('0x30')][_0xe5b4('0x31')]?_0x5573f9[_0xe5b4('0x30')]:_0x2e0f52['model'];if(_0xcf3dae[_0xe5b4('0x28')][_0xe5b4('0x32')]){_0x5573f9[_0xe5b4('0x33')]=[{'all':!![]}];}_0x5573f9=_['merge']({},_0x5573f9,_0xcf3dae[_0xe5b4('0x34')]);return db[_0xe5b4('0x22')][_0xe5b4('0x35')](_0x5573f9)[_0xe5b4('0x1b')](handleEntityNotFound(_0x4447b0,null))['then'](respondWithResult(_0x4447b0,null))['catch'](handleError(_0x4447b0,null));};exports['create']=function(_0x177802,_0x54d54b){return db[_0xe5b4('0x22')][_0xe5b4('0x36')](_0x177802[_0xe5b4('0x37')],{})['then'](respondWithResult(_0x54d54b,0xc9))[_0xe5b4('0x29')](handleError(_0x54d54b,null));};exports['update']=function(_0x2972ed,_0x55f346){if(_0x2972ed[_0xe5b4('0x37')]['id']){delete _0x2972ed[_0xe5b4('0x37')]['id'];}return db[_0xe5b4('0x22')][_0xe5b4('0x35')]({'where':{'id':_0x2972ed[_0xe5b4('0x2a')]['id']}})['then'](handleEntityNotFound(_0x55f346,null))[_0xe5b4('0x1b')](saveUpdates(_0x2972ed[_0xe5b4('0x37')],null))[_0xe5b4('0x1b')](respondWithResult(_0x55f346,null))['catch'](handleError(_0x55f346,null));};exports[_0xe5b4('0x1c')]=function(_0x327898,_0x4d1e21){return db[_0xe5b4('0x22')][_0xe5b4('0x35')]({'where':{'id':_0x327898[_0xe5b4('0x2a')]['id']}})[_0xe5b4('0x1b')](handleEntityNotFound(_0x4d1e21,null))[_0xe5b4('0x1b')](removeEntity(_0x4d1e21,null))[_0xe5b4('0x29')](handleError(_0x4d1e21,null));};exports['describe']=function(_0x33ee94,_0x354e65){return db[_0xe5b4('0x22')][_0xe5b4('0x38')]()['then'](respondWithResult(_0x354e65,null))[_0xe5b4('0x29')](handleError(_0x354e65,null));};exports[_0xe5b4('0x39')]=function(_0x1b6c4f,_0x4176d0){return db[_0xe5b4('0x3a')][_0xe5b4('0x35')]({'where':{'id':_0x1b6c4f[_0xe5b4('0x2a')]['id']}})[_0xe5b4('0x1b')](handleEntityNotFound(_0x4176d0,null))[_0xe5b4('0x1b')](function(_0xb2408c){if(_0xb2408c){return _0xb2408c[_0xe5b4('0x39')](_0x1b6c4f['body']['ids'],_[_0xe5b4('0x3b')](_0x1b6c4f[_0xe5b4('0x37')],[_0xe5b4('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x4176d0,null))[_0xe5b4('0x29')](handleError(_0x4176d0,null));};exports[_0xe5b4('0x3d')]=function(_0x16b3ae,_0x55cb66){var _0x24ab36={'raw':![],'where':{}};var _0x56eb32={};var _0x22f565={'count':0x0,'rows':[]};return db[_0xe5b4('0x22')][_0xe5b4('0x3e')]({'where':{'id':_0x16b3ae['params']['id']}})[_0xe5b4('0x1b')](handleEntityNotFound(_0x55cb66,null))[_0xe5b4('0x1b')](function(_0x165e61){if(_0x165e61){_0x56eb32['model']=_[_0xe5b4('0x2c')](db[_0xe5b4('0x3a')][_0xe5b4('0x23')]);_0x56eb32[_0xe5b4('0x28')]=_[_0xe5b4('0x2c')](_0x16b3ae[_0xe5b4('0x28')]);_0x56eb32[_0xe5b4('0x2d')]=_[_0xe5b4('0x2e')](_0x56eb32[_0xe5b4('0x2b')],_0x56eb32['query']);_0x24ab36[_0xe5b4('0x30')]=_[_0xe5b4('0x2e')](_0x56eb32[_0xe5b4('0x2b')],qs[_0xe5b4('0x2f')](_0x16b3ae[_0xe5b4('0x28')][_0xe5b4('0x2f')]));_0x24ab36[_0xe5b4('0x30')]=_0x24ab36['attributes'][_0xe5b4('0x31')]?_0x24ab36[_0xe5b4('0x30')]:_0x56eb32['model'];if(!_0x16b3ae[_0xe5b4('0x28')]['hasOwnProperty'](_0xe5b4('0x3f'))){_0x24ab36[_0xe5b4('0x16')]=qs[_0xe5b4('0x16')](_0x16b3ae[_0xe5b4('0x28')][_0xe5b4('0x16')]);_0x24ab36[_0xe5b4('0x14')]=qs[_0xe5b4('0x14')](_0x16b3ae['query'][_0xe5b4('0x14')]);}_0x24ab36[_0xe5b4('0x40')]=qs[_0xe5b4('0x41')](_0x16b3ae['query'][_0xe5b4('0x41')]);_0x24ab36[_0xe5b4('0x42')]=qs[_0xe5b4('0x2d')](_[_0xe5b4('0x43')](_0x16b3ae['query'],_0x56eb32[_0xe5b4('0x2d')]));_0x24ab36['where'][_0xe5b4('0x44')]=_0x165e61['id'];if(_0x16b3ae[_0xe5b4('0x28')][_0xe5b4('0x45')]){_0x24ab36[_0xe5b4('0x42')]=_[_0xe5b4('0x46')](_0x24ab36[_0xe5b4('0x42')],{'$or':_[_0xe5b4('0x47')](_0x24ab36[_0xe5b4('0x30')],function(_0x157e5d){var _0x52f831={};_0x52f831[_0x157e5d]={'$like':'%'+_0x16b3ae[_0xe5b4('0x28')]['filter']+'%'};return _0x52f831;})});}if(_0x16b3ae['query'][_0xe5b4('0x48')]){var _0x36d039=_0x16b3ae['query']['$gte']['split'](',');var _0x4cd0c5={};_0x4cd0c5[_0x36d039[0x0]]={'$gte':moment(_0x36d039[0x1])[_0xe5b4('0x49')](_0xe5b4('0x4a'))};_0x24ab36['where']=_[_0xe5b4('0x46')](_0x24ab36['where'],_0x4cd0c5);}_0x24ab36=_[_0xe5b4('0x46')]({},_0x24ab36,_0x16b3ae[_0xe5b4('0x34')]);return db[_0xe5b4('0x3a')][_0xe5b4('0x17')]({'where':_0x24ab36[_0xe5b4('0x42')]})['then'](function(_0xcb2686){_0x22f565['count']=_0xcb2686;if(_0x16b3ae[_0xe5b4('0x28')]['includeAll']){_0x24ab36[_0xe5b4('0x33')]=[{'all':!![]}];}return db[_0xe5b4('0x3a')]['findAll'](_0x24ab36);})['then'](function(_0x403d11){_0x22f565['rows']=_0x403d11;return _0x22f565;});}})[_0xe5b4('0x1b')](respondWithFilteredResult(_0x55cb66,_0x24ab36))[_0xe5b4('0x29')](handleError(_0x55cb66,null));};exports[_0xe5b4('0x4b')]=function(_0x2cce33,_0x4f9535){return db[_0xe5b4('0x22')]['find']({'where':{'id':_0x2cce33[_0xe5b4('0x2a')]['id']}})[_0xe5b4('0x1b')](handleEntityNotFound(_0x4f9535,null))[_0xe5b4('0x1b')](function(_0x36463b){if(_0x36463b){return _0x36463b[_0xe5b4('0x4c')](_0x2cce33[_0xe5b4('0x37')]['ids'],_['omit'](_0x2cce33[_0xe5b4('0x37')],['ids','id'])||{})[_0xe5b4('0x4d')](function(){return db[_0xe5b4('0x4e')][_0xe5b4('0x4f')]({'attributes':['id',_0xe5b4('0x1f'),_0xe5b4('0x50')],'where':{'id':_0x2cce33['body'][_0xe5b4('0x3c')]}});})[_0xe5b4('0x1b')](function(_0x433061){socket[_0xe5b4('0x51')](_0xe5b4('0x52'),{'id':Number(_0x2cce33[_0xe5b4('0x2a')]['id']),'tags':_0x433061||[]});return{'id':Number(_0x2cce33[_0xe5b4('0x2a')]['id']),'tags':_0x433061||[]};});}})[_0xe5b4('0x1b')](respondWithResult(_0x4f9535,null))[_0xe5b4('0x29')](handleError(_0x4f9535,null));};exports[_0xe5b4('0x53')]=function(_0x28e4ff,_0x190446){return db[_0xe5b4('0x22')][_0xe5b4('0x35')]({'where':{'id':_0x28e4ff[_0xe5b4('0x2a')]['id']}})[_0xe5b4('0x1b')](handleEntityNotFound(_0x190446,null))[_0xe5b4('0x1b')](function(_0x356e69){if(_0x356e69){return _0x356e69[_0xe5b4('0x53')](_0x28e4ff[_0xe5b4('0x28')]['ids']);}})[_0xe5b4('0x1b')](respondWithStatusCode(_0x190446,null))[_0xe5b4('0x29')](handleError(_0x190446,null));};exports[_0xe5b4('0x54')]=function(_0x329c51,_0x48429d){var _0x52a19c=moment()[_0xe5b4('0x55')]()[_0xe5b4('0x56')]();var _0x21af6a=path['join'](config[_0xe5b4('0x57')],_0xe5b4('0x58'),_0xe5b4('0x59'),'tmp');var _0x3935ef=path[_0xe5b4('0x5a')](config[_0xe5b4('0x57')],_0xe5b4('0x58'),_0xe5b4('0x59'),_0xe5b4('0x5b'));var _0x249391=path['join'](_0x21af6a,_0x52a19c);var _0x5be73a=util[_0xe5b4('0x49')](_0xe5b4('0x5c'),_0x329c51[_0xe5b4('0x2a')]['id'],_0x52a19c);var _0x951853=path[_0xe5b4('0x5a')](_0x21af6a,_0x5be73a);var _0x5298b4=[];_0x5298b4[_0xe5b4('0x5d')]({'model':db[_0xe5b4('0x5e')],'as':'User','attributes':['id',_0xe5b4('0x5f')],'raw':!![]});_0x5298b4[_0xe5b4('0x5d')]({'model':db[_0xe5b4('0x60')],'as':'Contact','attributes':['id',_0xe5b4('0x61'),_0xe5b4('0x62')],'raw':!![]});if(_0x329c51[_0xe5b4('0x28')][_0xe5b4('0x5b')]){_0x5298b4[_0xe5b4('0x5d')]({'model':db[_0xe5b4('0x63')],'as':_0xe5b4('0x63'),'raw':!![]});}var _0x502c7e=[{'model':db[_0xe5b4('0x3a')],'as':_0xe5b4('0x64'),'attributes':['id','body',_0xe5b4('0x65'),'direction',_0xe5b4('0x66'),_0xe5b4('0x67')],'include':_0x5298b4}];_0x502c7e[_0xe5b4('0x5d')]({'model':db[_0xe5b4('0x68')],'as':'Account','attributes':['id',_0xe5b4('0x1f')]});_0x502c7e[_0xe5b4('0x5d')]({'model':db[_0xe5b4('0x5e')],'as':_0xe5b4('0x69'),'attributes':['id',_0xe5b4('0x5f')]});return db[_0xe5b4('0x22')]['find']({'where':{'id':_0x329c51[_0xe5b4('0x2a')]['id']},'include':_0x502c7e})[_0xe5b4('0x1b')](handleEntityNotFound(_0x48429d,null))[_0xe5b4('0x1b')](function(_0x37ace2){if(_0x37ace2){var _0x508b70=_0x37ace2[_0xe5b4('0x6a')]({'plain':!![]});fs[_0xe5b4('0x6b')](_0x249391);var _0x2ab09a={'channel':_0xe5b4('0x6c'),'account':_0x508b70[_0xe5b4('0x6d')][_0xe5b4('0x1f')],'agent':_0x508b70[_0xe5b4('0x69')]?_0x508b70[_0xe5b4('0x69')][_0xe5b4('0x5f')]:'N.A.','createdAt':moment(_0x508b70['createdAt'])[_0xe5b4('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe5b4('0x56')](),'closedAt':_0x508b70[_0xe5b4('0x6e')]?moment(_0x508b70[_0xe5b4('0x6f')])[_0xe5b4('0x49')](_0xe5b4('0x4a'))['toString']():'','disposition':_0x508b70[_0xe5b4('0x70')],'messages':_(_0x508b70['Messages'])[_0xe5b4('0x45')]({'secret':![]})[_0xe5b4('0x47')](function(_0x514347){if(_0x514347['Attachment']){var _0x459b6a=path[_0xe5b4('0x5a')](_0x3935ef,_0x514347[_0xe5b4('0x63')][_0xe5b4('0x71')]);if(fs['existsSync'](_0x459b6a)){fs[_0xe5b4('0x72')](_0x459b6a)[_0xe5b4('0x73')](fs['createWriteStream'](path[_0xe5b4('0x5a')](_0x249391,_0x514347[_0xe5b4('0x63')]['basename'])));}}return{'date':moment(_0x514347[_0xe5b4('0x65')])[_0xe5b4('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe5b4('0x56')](),'sender':_0x514347[_0xe5b4('0x74')]===_0xe5b4('0x75')?_0x514347[_0xe5b4('0x5e')]?_0x514347['User'][_0xe5b4('0x5f')]:_0xe5b4('0x76'):_0x514347[_0xe5b4('0x77')][_0xe5b4('0x61')]+(_0x514347[_0xe5b4('0x77')][_0xe5b4('0x62')]?'\x20'+_0x514347[_0xe5b4('0x77')][_0xe5b4('0x62')]:''),'body':_0x514347['Attachment']?_0x514347[_0xe5b4('0x63')][_0xe5b4('0x71')]:_0x514347[_0xe5b4('0x37')],'direction':_0x514347['direction']==='out'?'A':'C','secret':_0x514347[_0xe5b4('0x66')],'read':_0x514347['read'],'attachment':_0x514347[_0xe5b4('0x63')]};})[_0xe5b4('0x78')]()};return ejs[_0xe5b4('0x79')](path[_0xe5b4('0x5a')](config['root'],_0xe5b4('0x58'),_0xe5b4('0x7a'),_0xe5b4('0x7b')),{'interaction':_0x2ab09a})[_0xe5b4('0x1b')](function(_0x1865af){var _0x43749d=path[_0xe5b4('0x5a')](_0x249391,_0xe5b4('0x7c')+_0x508b70['id']+'-'+_0x52a19c+_0xe5b4('0x7d'));var _0x2b8ce4={'path':_0x43749d,'channel':_0xe5b4('0x6c'),'interactionId':_0x508b70['id']};return pdf[_0xe5b4('0x7e')](_0x1865af,_0x2b8ce4);})['then'](function(){return new BPromise(function(_0x340812,_0x3d2639){zipdir(_0x249391,{'saveTo':_0x951853},function(_0x1f2e9c,_0x405f0f){if(_0x1f2e9c)return _0x3d2639(_0x1f2e9c);return _0x340812(_0x405f0f);});})['then'](function(){return new BPromise(function(_0x48c4d3,_0x574800){rimraf(_0x249391,function(_0x5b7e45){if(_0x5b7e45)_0x574800(_0x5b7e45);return _0x48c4d3();});});})['then'](function(){return _0x48429d[_0xe5b4('0x54')](_0x951853,_0x5be73a,function(_0x107d84){if(_0x107d84){console[_0xe5b4('0x7f')](_0xe5b4('0x80'),_0x107d84);}else{fs['unlinkSync'](_0x951853);}});});});}else{return _0x48429d[_0xe5b4('0x11')](0xc8);}})[_0xe5b4('0x29')](handleError(_0x48429d,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 19584ac..c8eed7f 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 _0xc961=['events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x5e09f8,_0x23958f){var _0x1dac5d=function(_0x1ec104){while(--_0x1ec104){_0x5e09f8['push'](_0x5e09f8['shift']());}};_0x1dac5d(++_0x23958f);}(_0xc961,0x17a));var _0x1c96=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0xc961[_0x26d386];return _0x4ef9a8;};'use strict';var EventEmitter=require(_0x1c96('0x0'));var WhatsappInteraction=require(_0x1c96('0x1'))['db'][_0x1c96('0x2')];var WhatsappMessage=require(_0x1c96('0x1'))['db'][_0x1c96('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1c96('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x30d2e0){return function(_0x494d92,_0x180969,_0x5594ee){_0x494d92[_0x1c96('0x5')]({'attributes':['id'],'raw':!![]})[_0x1c96('0x6')](function(_0x1f09ff){_0x494d92[_0x1c96('0x7')](_0x1c96('0x8'),_0x1f09ff[_0x1c96('0x9')](function(_0x5523de){return{'id':_0x5523de['id']};}));return WhatsappMessage[_0x1c96('0xa')]({'where':{'WhatsappInteractionId':_0x494d92['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1c96('0x6')](function(_0x691a95){_0x494d92[_0x1c96('0x7')](_0x1c96('0xb'),_0x691a95[_0x1c96('0xc')]);WhatsappInteractionEvents[_0x1c96('0xd')](_0x30d2e0+':'+_0x494d92['id'],_0x494d92);WhatsappInteractionEvents[_0x1c96('0xd')](_0x30d2e0,_0x494d92);_0x5594ee(null);})[_0x1c96('0xe')](_0x5594ee(null));};}for(var e in events){if(events[_0x1c96('0xf')](e)){var event=events[e];WhatsappInteraction[_0x1c96('0x10')](e,emitEvent(event));}}module[_0x1c96('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x2083=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages'];(function(_0x34a587,_0x38314d){var _0x31485f=function(_0x128af2){while(--_0x128af2){_0x34a587['push'](_0x34a587['shift']());}};_0x31485f(++_0x38314d);}(_0x2083,0x137));var _0x3208=function(_0x15491c,_0xcb4e47){_0x15491c=_0x15491c-0x0;var _0x23c024=_0x2083[_0x15491c];return _0x23c024;};'use strict';var EventEmitter=require(_0x3208('0x0'));var WhatsappInteraction=require(_0x3208('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x3208('0x1'))['db'][_0x3208('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x3208('0x3')](0x0);var events={'afterCreate':_0x3208('0x4'),'afterUpdate':_0x3208('0x5'),'afterDestroy':_0x3208('0x6')};function emitEvent(_0x1535fb){return function(_0x574345,_0x52318e,_0x5c8d7f){_0x574345[_0x3208('0x7')]({'attributes':['id'],'raw':!![]})[_0x3208('0x8')](function(_0x3d4b9d){_0x574345[_0x3208('0x9')]('Users',_0x3d4b9d[_0x3208('0xa')](function(_0x441a64){return{'id':_0x441a64['id']};}));return WhatsappMessage[_0x3208('0xb')]({'where':{'WhatsappInteractionId':_0x574345['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4e3bf7){_0x574345[_0x3208('0x9')](_0x3208('0xc'),_0x4e3bf7[_0x3208('0xd')]);WhatsappInteractionEvents[_0x3208('0xe')](_0x1535fb+':'+_0x574345['id'],_0x574345);WhatsappInteractionEvents['emit'](_0x1535fb,_0x574345);_0x5c8d7f(null);})['catch'](_0x5c8d7f(null));};}for(var e in events){if(events[_0x3208('0xf')](e)){var event=events[e];WhatsappInteraction[_0x3208('0x10')](e,emitEvent(event));}}module[_0x3208('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index f141f98..b3536d4 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 _0xdc96=['whatsapp_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','request-promise','rimraf','./whatsappInteraction.attributes','define','WhatsappInteraction'];(function(_0x40e7e6,_0x3911b8){var _0x361981=function(_0xe1e631){while(--_0xe1e631){_0x40e7e6['push'](_0x40e7e6['shift']());}};_0x361981(++_0x3911b8);}(_0xdc96,0xe8));var _0x6dc9=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xdc96[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x6dc9('0x0'));var util=require('util');var logger=require(_0x6dc9('0x1'))(_0x6dc9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6dc9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6dc9('0x4'));var config=require('../../config/environment');var attributes=require(_0x6dc9('0x5'));module['exports']=function(_0x3f8ebf,_0x3a42eb){return _0x3f8ebf[_0x6dc9('0x6')](_0x6dc9('0x7'),attributes,{'tableName':_0x6dc9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x24b95c,_0x13c826,_0x2c3ba3){if(_0x24b95c['changed']('closed')){_0x24b95c[_0x6dc9('0x9')]=moment()[_0x6dc9('0xa')](_0x6dc9('0xb'));}_0x2c3ba3(null,_0x24b95c);}}});}; \ No newline at end of file +var _0x659c=['exports','define','WhatsappInteraction','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','request-promise','path','./whatsappInteraction.attributes'];(function(_0x557f5f,_0x31d8e7){var _0x196eba=function(_0x433d89){while(--_0x433d89){_0x557f5f['push'](_0x557f5f['shift']());}};_0x196eba(++_0x31d8e7);}(_0x659c,0x1aa));var _0xc659=function(_0x2b012b,_0x463e28){_0x2b012b=_0x2b012b-0x0;var _0x32c4cf=_0x659c[_0x2b012b];return _0x32c4cf;};'use strict';var _=require(_0xc659('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc659('0x1'));var moment=require(_0xc659('0x2'));var BPromise=require('bluebird');var rp=require(_0xc659('0x3'));var fs=require('fs');var path=require(_0xc659('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc659('0x5'));module[_0xc659('0x6')]=function(_0x369dc0,_0x312440){return _0x369dc0[_0xc659('0x7')](_0xc659('0x8'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51b67f,_0x2cc93d,_0x56885a){if(_0x51b67f['changed']('closed')){_0x51b67f[_0xc659('0x9')]=moment()[_0xc659('0xa')](_0xc659('0xb'));}_0x56885a(null,_0x51b67f);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 0c45069..34cf927 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 _0x4506=['lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','request','then','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','WhatsappInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','attributes','debug','stringify','AddTagsToWhatsappInteraction','find','where','addTags','body','omit','ids','spread','AddTags'];(function(_0x5ebc04,_0x14a363){var _0x17845c=function(_0x360850){while(--_0x360850){_0x5ebc04['push'](_0x5ebc04['shift']());}};_0x17845c(++_0x14a363);}(_0x4506,0x140));var _0x6450=function(_0x2566ab,_0x1ab24c){_0x2566ab=_0x2566ab-0x0;var _0x11d31a=_0x4506[_0x2566ab];return _0x11d31a;};'use strict';var _=require(_0x6450('0x0'));var util=require(_0x6450('0x1'));var moment=require(_0x6450('0x2'));var BPromise=require('bluebird');var rs=require(_0x6450('0x3'));var fs=require('fs');var Redis=require(_0x6450('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6450('0x5'));var logger=require(_0x6450('0x6'))(_0x6450('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6450('0x8')]({'port':0x232a});config[_0x6450('0x9')]=_[_0x6450('0xa')](config[_0x6450('0x9')],{'host':_0x6450('0xb'),'port':0x18eb});var socket=require(_0x6450('0xc'))(new Redis(config[_0x6450('0x9')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x1b79be,_0xb12f06,_0x1e57d5){return new BPromise(function(_0x583e57,_0x1f31da){return client[_0x6450('0xd')](_0x1b79be,_0x1e57d5)[_0x6450('0xe')](function(_0x1a08f9){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0xb12f06,_0x6450('0xf'));logger['debug'](_0x6450('0x10'),_0xb12f06,'request\x20sent',JSON['stringify'](_0x1a08f9));if(_0x1a08f9['error']){if(_0x1a08f9[_0x6450('0x11')]['code']===0x1f4){logger[_0x6450('0x11')](_0x6450('0x12'),_0xb12f06,_0x1a08f9['error'][_0x6450('0x13')]);return _0x1f31da(_0x1a08f9[_0x6450('0x11')]['message']);}logger['error'](_0x6450('0x12'),_0xb12f06,_0x1a08f9[_0x6450('0x11')]['message']);return _0x583e57(_0x1a08f9[_0x6450('0x11')][_0x6450('0x13')]);}else{logger[_0x6450('0x14')](_0x6450('0x12'),_0xb12f06,_0x6450('0xf'));_0x583e57(_0x1a08f9[_0x6450('0x15')]['message']);}})[_0x6450('0x16')](function(_0x2cf646){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0xb12f06,_0x2cf646);_0x1f31da(_0x2cf646);});});}exports[_0x6450('0x17')]=function(_0x45948d){var _0x33fcfc=this;return new Promise(function(_0x2c641d,_0x12d425){return db[_0x6450('0x18')][_0x6450('0x19')](_0x45948d['body'],{'raw':_0x45948d[_0x6450('0x1a')]?_0x45948d[_0x6450('0x1a')][_0x6450('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45948d[_0x6450('0x1a')]?_0x45948d[_0x6450('0x1a')]['where']||null:null,'attributes':_0x45948d[_0x6450('0x1a')]?_0x45948d['options'][_0x6450('0x1c')]||null:null,'limit':_0x45948d['options']?_0x45948d[_0x6450('0x1a')]['limit']||null:null})[_0x6450('0xe')](function(_0x3259da){logger[_0x6450('0x14')]('UpdateWhatsappInteraction',_0x45948d);logger[_0x6450('0x1d')](_0x6450('0x17'),_0x45948d,JSON[_0x6450('0x1e')](_0x3259da));_0x2c641d(_0x3259da);})[_0x6450('0x16')](function(_0x48c30e){logger[_0x6450('0x11')](_0x6450('0x17'),_0x48c30e['message'],_0x45948d);_0x12d425(_0x33fcfc[_0x6450('0x11')](0x1f4,_0x48c30e[_0x6450('0x13')]));});});};exports[_0x6450('0x1f')]=function(_0x2b24eb){return new Promise(function(_0x498ab2,_0xb5c77f){return db[_0x6450('0x18')][_0x6450('0x20')]({'where':_0x2b24eb[_0x6450('0x1a')]?_0x2b24eb['options'][_0x6450('0x21')]||null:null})[_0x6450('0xe')](function(_0x31ddfb){if(_0x31ddfb){return _0x31ddfb[_0x6450('0x22')](_0x2b24eb[_0x6450('0x23')]['ids'],_[_0x6450('0x24')](_0x2b24eb[_0x6450('0x23')],[_0x6450('0x25'),'id'])||{});}})[_0x6450('0x26')](function(_0x4c7b1e){logger[_0x6450('0x14')](_0x6450('0x27'),_0x2b24eb);logger[_0x6450('0x1d')]('AddTags',_0x2b24eb,JSON[_0x6450('0x1e')](_0x4c7b1e));_0x498ab2(_0x4c7b1e);})['catch'](function(_0x26b558){logger[_0x6450('0x11')](_0x6450('0x27'),_0x26b558[_0x6450('0x13')],_0x2b24eb);_0xb5c77f(_this[_0x6450('0x11')](0x1f4,_0x26b558[_0x6450('0x13')]));});});}; \ No newline at end of file +var _0xca7a=['attributes','limit','AddTagsToWhatsappInteraction','find','addTags','body','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xca7a,0xe1));var _0xaca7=function(_0x53084c,_0x4a10a7){_0x53084c=_0x53084c-0x0;var _0x3725c5=_0xca7a[_0x53084c];return _0x3725c5;};'use strict';var _=require(_0xaca7('0x0'));var util=require(_0xaca7('0x1'));var moment=require(_0xaca7('0x2'));var BPromise=require(_0xaca7('0x3'));var rs=require(_0xaca7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaca7('0x5'))['db'];var utils=require(_0xaca7('0x6'));var logger=require(_0xaca7('0x7'))(_0xaca7('0x8'));var config=require('../../config/environment');var jayson=require(_0xaca7('0x9'));var client=jayson['client'][_0xaca7('0xa')]({'port':0x232a});config['redis']=_[_0xaca7('0xb')](config[_0xaca7('0xc')],{'host':_0xaca7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xaca7('0xe')](socket);function respondWithRpcPromise(_0x414d3d,_0x558037,_0x588cc2){return new BPromise(function(_0x42bdd1,_0x20077a){return client[_0xaca7('0xf')](_0x414d3d,_0x588cc2)[_0xaca7('0x10')](function(_0x22cad8){logger['info'](_0xaca7('0x11'),_0x558037,_0xaca7('0x12'));logger[_0xaca7('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x558037,_0xaca7('0x12'),JSON[_0xaca7('0x14')](_0x22cad8));if(_0x22cad8['error']){if(_0x22cad8[_0xaca7('0x15')][_0xaca7('0x16')]===0x1f4){logger['error'](_0xaca7('0x11'),_0x558037,_0x22cad8['error'][_0xaca7('0x17')]);return _0x20077a(_0x22cad8['error'][_0xaca7('0x17')]);}logger[_0xaca7('0x15')](_0xaca7('0x11'),_0x558037,_0x22cad8[_0xaca7('0x15')][_0xaca7('0x17')]);return _0x42bdd1(_0x22cad8[_0xaca7('0x15')][_0xaca7('0x17')]);}else{logger[_0xaca7('0x18')](_0xaca7('0x11'),_0x558037,'request\x20sent');_0x42bdd1(_0x22cad8[_0xaca7('0x19')][_0xaca7('0x17')]);}})[_0xaca7('0x1a')](function(_0x366ed6){logger[_0xaca7('0x15')](_0xaca7('0x11'),_0x558037,_0x366ed6);_0x20077a(_0x366ed6);});});}exports[_0xaca7('0x1b')]=function(_0x4475ca){var _0x264303=this;return new Promise(function(_0x1f0468,_0x4354b8){return db[_0xaca7('0x1c')][_0xaca7('0x1d')](_0x4475ca['body'],{'raw':_0x4475ca['options']?_0x4475ca[_0xaca7('0x1e')][_0xaca7('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4475ca[_0xaca7('0x1e')]?_0x4475ca[_0xaca7('0x1e')][_0xaca7('0x20')]||null:null,'attributes':_0x4475ca[_0xaca7('0x1e')]?_0x4475ca['options'][_0xaca7('0x21')]||null:null,'limit':_0x4475ca[_0xaca7('0x1e')]?_0x4475ca[_0xaca7('0x1e')][_0xaca7('0x22')]||null:null})[_0xaca7('0x10')](function(_0x1d76f5){logger[_0xaca7('0x18')]('UpdateWhatsappInteraction',_0x4475ca);logger[_0xaca7('0x13')](_0xaca7('0x1b'),_0x4475ca,JSON[_0xaca7('0x14')](_0x1d76f5));_0x1f0468(_0x1d76f5);})[_0xaca7('0x1a')](function(_0x4fe95f){logger[_0xaca7('0x15')](_0xaca7('0x1b'),_0x4fe95f[_0xaca7('0x17')],_0x4475ca);_0x4354b8(_0x264303[_0xaca7('0x15')](0x1f4,_0x4fe95f[_0xaca7('0x17')]));});});};exports[_0xaca7('0x23')]=function(_0x22ce74){return new Promise(function(_0x488a01,_0x5197b7){return db[_0xaca7('0x1c')][_0xaca7('0x24')]({'where':_0x22ce74[_0xaca7('0x1e')]?_0x22ce74[_0xaca7('0x1e')][_0xaca7('0x20')]||null:null})[_0xaca7('0x10')](function(_0x1d4252){if(_0x1d4252){return _0x1d4252[_0xaca7('0x25')](_0x22ce74[_0xaca7('0x26')]['ids'],_[_0xaca7('0x27')](_0x22ce74[_0xaca7('0x26')],[_0xaca7('0x28'),'id'])||{});}})[_0xaca7('0x29')](function(_0x9275ef){logger[_0xaca7('0x18')](_0xaca7('0x2a'),_0x22ce74);logger[_0xaca7('0x13')](_0xaca7('0x2a'),_0x22ce74,JSON[_0xaca7('0x14')](_0x9275ef));_0x488a01(_0x9275ef);})['catch'](function(_0x16656d){logger[_0xaca7('0x15')]('AddTags',_0x16656d['message'],_0x22ce74);_0x5197b7(_this[_0xaca7('0x15')](0x1f4,_0x16656d[_0xaca7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index bc3caa5..ca90fff 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 _0x9bb9=['update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x5d99ad,_0x15d2b5){var _0x453124=function(_0x57c8cf){while(--_0x57c8cf){_0x5d99ad['push'](_0x5d99ad['shift']());}};_0x453124(++_0x15d2b5);}(_0x9bb9,0xf0));var _0x99bb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9bb9[_0x20a584];return _0x4b41a8;};'use strict';var WhatsappInteractionEvents=require(_0x99bb('0x0'));var events=[_0x99bb('0x1'),_0x99bb('0x2'),_0x99bb('0x3')];function createListener(_0x3bc897,_0x563f31){return function(_0x4b1bd8){_0x563f31[_0x99bb('0x4')](_0x3bc897,_0x4b1bd8);};}function removeListener(_0x59a046,_0x1d43bf){return function(){WhatsappInteractionEvents[_0x99bb('0x5')](_0x59a046,_0x1d43bf);};}exports[_0x99bb('0x6')]=function(_0x4eb8b5){for(var _0x496264=0x0,_0x562fe1=events[_0x99bb('0x7')];_0x496264<_0x562fe1;_0x496264++){var _0x791d6f=events[_0x496264];var _0x455c3a=createListener(_0x99bb('0x8')+_0x791d6f,_0x4eb8b5);WhatsappInteractionEvents['on'](_0x791d6f,_0x455c3a);}}; \ No newline at end of file +var _0x4aa5=['length','whatsappInteraction:','remove','emit','removeListener','register'];(function(_0x5a8729,_0x5823e7){var _0x22a4cf=function(_0x573df2){while(--_0x573df2){_0x5a8729['push'](_0x5a8729['shift']());}};_0x22a4cf(++_0x5823e7);}(_0x4aa5,0x122));var _0x54aa=function(_0x4d35e9,_0x495e08){_0x4d35e9=_0x4d35e9-0x0;var _0x241a08=_0x4aa5[_0x4d35e9];return _0x241a08;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x54aa('0x0'),'update'];function createListener(_0x65c54f,_0x59fcd6){return function(_0xa45ae2){_0x59fcd6[_0x54aa('0x1')](_0x65c54f,_0xa45ae2);};}function removeListener(_0x2202ed,_0x4718fe){return function(){WhatsappInteractionEvents[_0x54aa('0x2')](_0x2202ed,_0x4718fe);};}exports[_0x54aa('0x3')]=function(_0x531d38){for(var _0x13dd41=0x0,_0x285b1d=events[_0x54aa('0x4')];_0x13dd41<_0x285b1d;_0x13dd41++){var _0x29d4cd=events[_0x13dd41];var _0x1b5236=createListener(_0x54aa('0x5')+_0x29d4cd,_0x531d38);WhatsappInteractionEvents['on'](_0x29d4cd,_0x1b5236);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index ab19361..77798fa 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 _0x0b6a=['update','/:id/accept','accept','/:id/reject','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','tracked','whatsapp','whatsappmessage:create','post','/:id/status','put'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x0b6a,0x1e1));var _0xa0b6=function(_0x5e939d,_0xe7599f){_0x5e939d=_0x5e939d-0x0;var _0x23643f=_0x0b6a[_0x5e939d];return _0x23643f;};'use strict';var multer=require(_0xa0b6('0x0'));var util=require('util');var path=require(_0xa0b6('0x1'));var timeout=require('connect-timeout');var express=require(_0xa0b6('0x2'));var router=express[_0xa0b6('0x3')]();var fs_extra=require(_0xa0b6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0b6('0x5'));var config=require(_0xa0b6('0x6'));var controller=require('./whatsappMessage.controller');router[_0xa0b6('0x7')]('/',auth[_0xa0b6('0x8')](),controller[_0xa0b6('0x9')]);router['get'](_0xa0b6('0xa'),auth['isAuthenticated'](),controller[_0xa0b6('0xb')]);router[_0xa0b6('0x7')](_0xa0b6('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa0b6('0x8')](),interaction[_0xa0b6('0xd')](_0xa0b6('0xe'),_0xa0b6('0xf')),controller['create']);router[_0xa0b6('0x10')](_0xa0b6('0x11'),controller['status']);router[_0xa0b6('0x12')](_0xa0b6('0xc'),auth[_0xa0b6('0x8')](),controller[_0xa0b6('0x13')]);router[_0xa0b6('0x12')](_0xa0b6('0x14'),auth[_0xa0b6('0x8')](),controller[_0xa0b6('0x15')]);router[_0xa0b6('0x12')](_0xa0b6('0x16'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0xa0b6('0xc'),auth[_0xa0b6('0x8')](),controller[_0xa0b6('0x17')]);module[_0xa0b6('0x18')]=router; \ No newline at end of file +var _0x267e=['../../config/environment','./whatsappMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','tracked','whatsapp','create','/:id/status','status','put','update','accept','/:id/reject','destroy','exports','util','path','fs-extra'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x267e,0x8d));var _0xe267=function(_0x89dcf5,_0x3f10ad){_0x89dcf5=_0x89dcf5-0x0;var _0xcaaa63=_0x267e[_0x89dcf5];return _0xcaaa63;};'use strict';var multer=require('multer');var util=require(_0xe267('0x0'));var path=require(_0xe267('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe267('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe267('0x3'));var controller=require(_0xe267('0x4'));router[_0xe267('0x5')]('/',auth['isAuthenticated'](),controller[_0xe267('0x6')]);router['get'](_0xe267('0x7'),auth['isAuthenticated'](),controller[_0xe267('0x8')]);router[_0xe267('0x5')](_0xe267('0x9'),auth[_0xe267('0xa')](),controller[_0xe267('0xb')]);router[_0xe267('0xc')]('/',auth[_0xe267('0xa')](),interaction[_0xe267('0xd')](_0xe267('0xe'),'whatsappmessage:create'),controller[_0xe267('0xf')]);router[_0xe267('0xc')](_0xe267('0x10'),controller[_0xe267('0x11')]);router[_0xe267('0x12')]('/:id',auth[_0xe267('0xa')](),controller[_0xe267('0x13')]);router[_0xe267('0x12')]('/:id/accept',auth[_0xe267('0xa')](),controller[_0xe267('0x14')]);router[_0xe267('0x12')](_0xe267('0x15'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0xe267('0x9'),auth[_0xe267('0xa')](),controller[_0xe267('0x16')]);module[_0xe267('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 00a6822..9500a4c 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 _0x2303=['out','STRING','DATE','BOOLEAN','TEXT','sequelize','exports'];(function(_0x325654,_0x4e6fe1){var _0x994fc7=function(_0x3a0d47){while(--_0x3a0d47){_0x325654['push'](_0x325654['shift']());}};_0x994fc7(++_0x4e6fe1);}(_0x2303,0x75));var _0x3230=function(_0x2ad502,_0x2b6085){_0x2ad502=_0x2ad502-0x0;var _0x24fdfc=_0x2303[_0x2ad502];return _0x24fdfc;};'use strict';var Sequelize=require(_0x3230('0x0'));module[_0x3230('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3230('0x2')),'defaultValue':_0x3230('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3230('0x3')](0xbe)},'phone':{'type':Sequelize[_0x3230('0x3')]},'readAt':{'type':Sequelize[_0x3230('0x4')]},'secret':{'type':Sequelize[_0x3230('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3230('0x3')]},'providerResponse':{'type':Sequelize[_0x3230('0x6')]}}; \ No newline at end of file +var _0x5d95=['ENUM','out','STRING','sequelize','exports','medium','BOOLEAN'];(function(_0x43c206,_0x56b5a9){var _0x57319f=function(_0x2b7239){while(--_0x2b7239){_0x43c206['push'](_0x43c206['shift']());}};_0x57319f(++_0x56b5a9);}(_0x5d95,0x161));var _0x55d9=function(_0x2e9bea,_0x5c1f2b){_0x2e9bea=_0x2e9bea-0x0;var _0x1882eb=_0x5d95[_0x2e9bea];return _0x1882eb;};'use strict';var Sequelize=require(_0x55d9('0x0'));module[_0x55d9('0x1')]={'body':{'type':Sequelize['TEXT'](_0x55d9('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x55d9('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x55d9('0x4')]('in',_0x55d9('0x5')),'defaultValue':_0x55d9('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x55d9('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x55d9('0x6')]},'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 bee6165..1b43b30 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 _0x2c55=['messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','util','lodash','ioredis','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','whatsapp-interactions','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','offset','undefined','limit','Content-Range','json','update','end','stack','name','send','index','WhatsappMessage','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','options','count','includeAll','include','findAll','params','length','find','create','body','destroy','describe','accept','acceptMessage','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','interaction','role','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','reject','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0x2c55,0x72));var _0x52c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c55[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x52c5('0x0'));var _=require(_0x52c5('0x1'));var Redis=require(_0x52c5('0x2'));var interactionService=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0x52c5('0x3'))(_0x52c5('0x4'));var config=require('../../config/environment');var db=require(_0x52c5('0x5'))['db'];config['redis']=_[_0x52c5('0x6')](config[_0x52c5('0x7')],{'host':_0x52c5('0x8'),'port':0x18eb});var socket=require(_0x52c5('0x9'))(new Redis(config[_0x52c5('0x7')]));require(_0x52c5('0xa'))[_0x52c5('0xb')](socket);var jayson=require(_0x52c5('0xc'));var client=jayson[_0x52c5('0xd')][_0x52c5('0xe')]({'port':0x232c});var client9002=jayson['client'][_0x52c5('0xe')]({'port':0x232a});var interaction_log=require(_0x52c5('0x3'))(_0x52c5('0xf'));function respondWithRpcPromise(_0x3dc0a0,_0x98471c,_0xbbd7c9,_0xf86310){return new Promise(function(_0x2106f4,_0x1feb89){var _0x38399d=_0xf86310||client;return _0x38399d['request'](_0x3dc0a0,_0xbbd7c9)[_0x52c5('0x10')](function(_0x12a2ca){logger['info'](_0x52c5('0x11'),_0x98471c,_0x52c5('0x12'));logger[_0x52c5('0x13')](_0x52c5('0x14'),_0x98471c,_0x52c5('0x12'),JSON[_0x52c5('0x15')](_0x12a2ca));if(_0x12a2ca['error']){if(_0x12a2ca[_0x52c5('0x16')][_0x52c5('0x17')]===0x1f4){logger[_0x52c5('0x16')](_0x52c5('0x11'),_0x98471c,_0x12a2ca[_0x52c5('0x16')][_0x52c5('0x18')]);return _0x1feb89(_0x12a2ca[_0x52c5('0x16')][_0x52c5('0x18')]);}logger['error'](_0x52c5('0x11'),_0x98471c,_0x12a2ca[_0x52c5('0x16')][_0x52c5('0x18')]);return _0x2106f4(_0x12a2ca[_0x52c5('0x16')][_0x52c5('0x18')]);}else{logger[_0x52c5('0x19')](_0x52c5('0x11'),_0x98471c,'request\x20sent');_0x2106f4(_0x12a2ca[_0x52c5('0x1a')][_0x52c5('0x18')]);}})[_0x52c5('0x1b')](function(_0xe4cf54){logger[_0x52c5('0x16')](_0x52c5('0x11'),_0x98471c,_0xe4cf54);_0x1feb89(_0xe4cf54);});});}function respondWithResult(_0x1956b3,_0x5bbfec){_0x5bbfec=_0x5bbfec||0xc8;return function(_0xce5ffc){if(_0xce5ffc){return _0x1956b3[_0x52c5('0x1c')](_0x5bbfec)['json'](_0xce5ffc);}};}function respondWithFilteredResult(_0x240666,_0x448604){return function(_0x1f9b2b){if(_0x1f9b2b){var _0x471404=typeof _0x448604[_0x52c5('0x1d')]===_0x52c5('0x1e')&&typeof _0x448604[_0x52c5('0x1f')]===_0x52c5('0x1e');var _0x5a3b35=_0x1f9b2b['count'];var _0x3ccacc=_0x471404?0x0:_0x448604[_0x52c5('0x1d')];var _0x41d314=_0x471404?_0x1f9b2b['count']:_0x448604[_0x52c5('0x1d')]+_0x448604[_0x52c5('0x1f')];var _0x2711a8;if(_0x41d314>=_0x5a3b35){_0x41d314=_0x5a3b35;_0x2711a8=0xc8;}else{_0x2711a8=0xce;}_0x240666[_0x52c5('0x1c')](_0x2711a8);return _0x240666['set'](_0x52c5('0x20'),_0x3ccacc+'-'+_0x41d314+'/'+_0x5a3b35)[_0x52c5('0x21')](_0x1f9b2b);}return null;};}function saveUpdates(_0x27a622){return function(_0x25551e){if(_0x25551e){return _0x25551e[_0x52c5('0x22')](_0x27a622)[_0x52c5('0x10')](function(_0x2b2f41){return _0x2b2f41;});}return null;};}function removeEntity(_0x115f00){return function(_0x4b1794){if(_0x4b1794){return _0x4b1794['destroy']()[_0x52c5('0x10')](function(){_0x115f00[_0x52c5('0x1c')](0xcc)[_0x52c5('0x23')]();});}};}function handleEntityNotFound(_0x34b74d){return function(_0x5932c3){if(!_0x5932c3){_0x34b74d['sendStatus'](0x194);}return _0x5932c3;};}function handleError(_0x24916b,_0x43d905){_0x43d905=_0x43d905||0x1f4;return function(_0x1bb612){logger[_0x52c5('0x16')](_0x1bb612[_0x52c5('0x24')]);if(_0x1bb612[_0x52c5('0x25')]){delete _0x1bb612[_0x52c5('0x25')];}_0x24916b['status'](_0x43d905)[_0x52c5('0x26')](_0x1bb612);};}exports[_0x52c5('0x27')]=function(_0x392c47,_0x1aaad1){var _0x31eb99={},_0x2340cd={},_0x264d14={'count':0x0,'rows':[]};var _0xb2276d=_['map'](db[_0x52c5('0x28')]['rawAttributes'],function(_0xc53eb4){return{'name':_0xc53eb4[_0x52c5('0x29')],'type':_0xc53eb4[_0x52c5('0x2a')][_0x52c5('0x2b')]};});_0x2340cd[_0x52c5('0x2c')]=_[_0x52c5('0x2d')](_0xb2276d,_0x52c5('0x25'));_0x2340cd[_0x52c5('0x2e')]=_[_0x52c5('0x2f')](_0x392c47[_0x52c5('0x2e')]);_0x2340cd[_0x52c5('0x30')]=_[_0x52c5('0x31')](_0x2340cd[_0x52c5('0x2c')],_0x2340cd[_0x52c5('0x2e')]);_0x31eb99[_0x52c5('0x32')]=_['intersection'](_0x2340cd[_0x52c5('0x2c')],qs[_0x52c5('0x33')](_0x392c47[_0x52c5('0x2e')]['fields']));_0x31eb99[_0x52c5('0x32')]=_0x31eb99['attributes']['length']?_0x31eb99['attributes']:_0x2340cd[_0x52c5('0x2c')];if(!_0x392c47['query'][_0x52c5('0x34')](_0x52c5('0x35'))){_0x31eb99[_0x52c5('0x1f')]=qs[_0x52c5('0x1f')](_0x392c47['query'][_0x52c5('0x1f')]);_0x31eb99[_0x52c5('0x1d')]=qs['offset'](_0x392c47[_0x52c5('0x2e')]['offset']);}_0x31eb99['order']=qs[_0x52c5('0x36')](_0x392c47[_0x52c5('0x2e')]['sort']);_0x31eb99[_0x52c5('0x37')]=qs['filters'](_[_0x52c5('0x38')](_0x392c47[_0x52c5('0x2e')],_0x2340cd['filters']),_0xb2276d);if(_0x392c47[_0x52c5('0x2e')]['filter']){_0x31eb99[_0x52c5('0x37')]=_['merge'](_0x31eb99[_0x52c5('0x37')],{'$or':_['map'](_0xb2276d,function(_0x403b22){if(_0x403b22[_0x52c5('0x2a')]!==_0x52c5('0x39')){var _0x1688d2={};_0x1688d2[_0x403b22['name']]={'$like':'%'+_0x392c47[_0x52c5('0x2e')]['filter']+'%'};return _0x1688d2;}})});}_0x31eb99=_[_0x52c5('0x3a')]({},_0x31eb99,_0x392c47[_0x52c5('0x3b')]);var _0x36484b={'where':_0x31eb99[_0x52c5('0x37')]};return db[_0x52c5('0x28')][_0x52c5('0x3c')](_0x36484b)[_0x52c5('0x10')](function(_0xb16f85){_0x264d14['count']=_0xb16f85;if(_0x392c47[_0x52c5('0x2e')][_0x52c5('0x3d')]){_0x31eb99[_0x52c5('0x3e')]=[{'all':!![]}];}return db[_0x52c5('0x28')][_0x52c5('0x3f')](_0x31eb99);})[_0x52c5('0x10')](function(_0x541334){_0x264d14['rows']=_0x541334;return _0x264d14;})['then'](respondWithFilteredResult(_0x1aaad1,_0x31eb99))[_0x52c5('0x1b')](handleError(_0x1aaad1,null));};exports['show']=function(_0x225bee,_0x56b329){var _0x376d51={'raw':!![],'where':{'id':_0x225bee[_0x52c5('0x40')]['id']}},_0x46b503={};_0x46b503[_0x52c5('0x2c')]=_[_0x52c5('0x2f')](db[_0x52c5('0x28')]['rawAttributes']);_0x46b503[_0x52c5('0x2e')]=_[_0x52c5('0x2f')](_0x225bee[_0x52c5('0x2e')]);_0x46b503[_0x52c5('0x30')]=_[_0x52c5('0x31')](_0x46b503[_0x52c5('0x2c')],_0x46b503[_0x52c5('0x2e')]);_0x376d51[_0x52c5('0x32')]=_[_0x52c5('0x31')](_0x46b503['model'],qs[_0x52c5('0x33')](_0x225bee['query'][_0x52c5('0x33')]));_0x376d51[_0x52c5('0x32')]=_0x376d51[_0x52c5('0x32')][_0x52c5('0x41')]?_0x376d51[_0x52c5('0x32')]:_0x46b503[_0x52c5('0x2c')];if(_0x225bee[_0x52c5('0x2e')]['includeAll']){_0x376d51[_0x52c5('0x3e')]=[{'all':!![]}];}_0x376d51=_[_0x52c5('0x3a')]({},_0x376d51,_0x225bee[_0x52c5('0x3b')]);return db[_0x52c5('0x28')][_0x52c5('0x42')](_0x376d51)[_0x52c5('0x10')](handleEntityNotFound(_0x56b329,null))[_0x52c5('0x10')](respondWithResult(_0x56b329,null))[_0x52c5('0x1b')](handleError(_0x56b329,null));};exports['create']=function(_0x433681,_0x4e2b1f){return db['WhatsappMessage'][_0x52c5('0x43')](_0x433681[_0x52c5('0x44')],{})['then'](respondWithResult(_0x4e2b1f,0xc9))[_0x52c5('0x1b')](handleError(_0x4e2b1f,null));};exports[_0x52c5('0x22')]=function(_0x15d53f,_0x21375d){if(_0x15d53f[_0x52c5('0x44')]['id']){delete _0x15d53f[_0x52c5('0x44')]['id'];}return db[_0x52c5('0x28')][_0x52c5('0x42')]({'where':{'id':_0x15d53f[_0x52c5('0x40')]['id']}})[_0x52c5('0x10')](handleEntityNotFound(_0x21375d,null))[_0x52c5('0x10')](saveUpdates(_0x15d53f[_0x52c5('0x44')],null))[_0x52c5('0x10')](respondWithResult(_0x21375d,null))[_0x52c5('0x1b')](handleError(_0x21375d,null));};exports[_0x52c5('0x45')]=function(_0x161c63,_0x348f13){return db['WhatsappMessage'][_0x52c5('0x42')]({'where':{'id':_0x161c63[_0x52c5('0x40')]['id']}})['then'](handleEntityNotFound(_0x348f13,null))[_0x52c5('0x10')](removeEntity(_0x348f13,null))[_0x52c5('0x1b')](handleError(_0x348f13,null));};exports['describe']=function(_0x945502,_0x4801c3){return db[_0x52c5('0x28')][_0x52c5('0x46')]()['then'](respondWithResult(_0x4801c3,null))['catch'](handleError(_0x4801c3,null));};exports[_0x52c5('0x47')]=function(_0x21fc88,_0x1df444){var _0x46f6cf='whatsapp';return interactionService[_0x52c5('0x48')](_0x21fc88,_0x46f6cf)['then'](respondWithResult(_0x1df444,null))[_0x52c5('0x1b')](handleError(_0x1df444,null));};exports['reject']=function(_0x5116a2,_0xb0a56c){var _0x299b88={'agent':{},'channel':'whatsapp'};if(_0x5116a2[_0x52c5('0x44')]['id']){delete _0x5116a2[_0x52c5('0x44')]['id'];}_0x5116a2[_0x52c5('0x44')][_0x52c5('0x49')]=_0x5116a2['body'][_0x52c5('0x49')]||_0x5116a2[_0x52c5('0x4a')]['id'];_0x299b88[_0x52c5('0x4b')]['id']=_0x5116a2[_0x52c5('0x44')]['UserId'];return db[_0x52c5('0x28')][_0x52c5('0x42')]({'where':{'id':_0x5116a2[_0x52c5('0x40')]['id'],'UserId':null}})[_0x52c5('0x10')](handleEntityNotFound(_0xb0a56c,null))[_0x52c5('0x10')](function(_0x377bbc){if(_0x377bbc){_0x299b88['message']=_0x377bbc[_0x52c5('0x4c')]({'plain':!![]});return db[_0x52c5('0x4d')][_0x52c5('0x42')]({'where':{'id':_0x377bbc[_0x52c5('0x4e')]}});}return null;})[_0x52c5('0x10')](handleEntityNotFound(_0xb0a56c,null))['then'](function(_0x57c477){if(_0x57c477){_0x299b88[_0x52c5('0x4f')]=_0x57c477[_0x52c5('0x4c')]({'plain':!![]});interaction_log[_0x52c5('0x19')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5116a2[_0x52c5('0x4a')]['id'],_0x5116a2[_0x52c5('0x4a')]['name'],_0x5116a2[_0x52c5('0x4a')][_0x52c5('0x50')],_0x299b88[_0x52c5('0x4f')]['id'],_0x5116a2['body']?JSON[_0x52c5('0x15')](_0x5116a2[_0x52c5('0x44')]):_0x52c5('0x51'));return respondWithRpcPromise('RejectMessage',_0x52c5('0x52'),_0x299b88);}return null;})[_0x52c5('0x10')](function(_0x5c3d92){var _0x15e1ed=_0x52c5('0x53')+_0x5c3d92[_0x52c5('0x18')]['ContactId'];return db['sequelize']['query'](_0x15e1ed,{'type':db[_0x52c5('0x54')][_0x52c5('0x55')][_0x52c5('0x56')],'raw':!![]})[_0x52c5('0x10')](function(_0x509fb1){return _0x509fb1;});})[_0x52c5('0x10')](function(_0x192dc9){if(_0x192dc9){_0x299b88[_0x52c5('0x18')][_0x52c5('0x57')]=_0x192dc9[0x0];if(!_0x5116a2[_0x52c5('0x44')][_0x52c5('0x49')])return;return db[_0x52c5('0x58')][_0x52c5('0x42')]({'where':{'id':_0x5116a2[_0x52c5('0x44')][_0x52c5('0x49')],'role':'agent'},'attributes':['id',_0x52c5('0x25'),_0x52c5('0x59'),_0x52c5('0x5a'),_0x52c5('0x5b')],'raw':!![]});}return null;})[_0x52c5('0x10')](function(_0x1dfa55){if(!_0x1dfa55)return null;_0x299b88[_0x52c5('0x18')][_0x52c5('0x4b')]=_0x1dfa55;return _0x299b88;})['then'](function(_0x5c7d92){if(_0x5c7d92){_0x5c7d92[_0x52c5('0x18')][_0x52c5('0x5c')]=util[_0x52c5('0x5d')](_0x52c5('0x5e'),_0x5116a2['user']['name']);_0x5c7d92['message'][_0x52c5('0x5f')]=_0x299b88[_0x52c5('0x5f')];_0x5c7d92['message'][_0x52c5('0x60')]=_0x299b88[_0x52c5('0x5f')];_0x5c7d92[_0x52c5('0x18')]['event']=_0x52c5('0x61');respondWithRpcPromise('EventManager','EventManager',{'event':_0x52c5('0x62'),'message':_0x5c7d92[_0x52c5('0x18')]},client9002);return _0x299b88;}return null;})[_0x52c5('0x10')](respondWithResult(_0xb0a56c,null))['catch'](handleError(_0xb0a56c,null));};exports['status']=function(_0x2435f1,_0x230b66){if(_0x2435f1['body']['id']){delete _0x2435f1[_0x52c5('0x44')]['id'];}var _0x891a37;return db[_0x52c5('0x28')][_0x52c5('0x42')]({'where':{'id':_0x2435f1[_0x52c5('0x40')]['id']}})[_0x52c5('0x10')](handleEntityNotFound(_0x230b66,null))[_0x52c5('0x10')](function(_0x12e942){if(_0x12e942){_0x891a37=_0x12e942;return db[_0x52c5('0x63')][_0x52c5('0x42')]({'where':{'id':_0x12e942[_0x52c5('0x64')]}});}})[_0x52c5('0x10')](handleEntityNotFound(_0x230b66,null))[_0x52c5('0x10')](function(_0x15a73c){if(_0x15a73c){logger['debug'](_0x52c5('0x65'),_0x52c5('0x1c'),_0x52c5('0x66'),_0x15a73c['type'],util[_0x52c5('0x67')](_0x2435f1[_0x52c5('0x44')],{'showHidden':![],'depth':null}));switch(_0x15a73c[_0x52c5('0x2a')]){case _0x52c5('0x68'):if(_0x2435f1['body']['MessageSid']&&_0x2435f1[_0x52c5('0x44')][_0x52c5('0x69')]===_0x891a37[_0x52c5('0x6a')]&&_0x2435f1[_0x52c5('0x44')][_0x52c5('0x6b')]&&_0x2435f1['body'][_0x52c5('0x6b')]===_0x52c5('0x6c')){return _0x891a37[_0x52c5('0x22')]({'read':!![]});}else{logger['error'](_0x52c5('0x6d'),_0x52c5('0x1c'),_0x52c5('0x68'),util[_0x52c5('0x67')](_0x2435f1['body'],{'showHidden':![],'depth':null}));}break;}return _0x891a37;}})[_0x52c5('0x10')](respondWithResult(_0x230b66,null))[_0x52c5('0x1b')](handleError(_0x230b66,null));}; \ No newline at end of file +var _0xdb24=['fullname','internal','format','channel','motionChannel','event','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./whatsappMessage.socket','register','client','http','whatsapp-interactions','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','WhatsappMessage','rawAttributes','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','order','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','describe','accept','whatsapp','acceptMessage','reject','UserId','agent','get','WhatsappInteractionId','interaction','user','role','stringify','null','ContactId','Sequelize','QueryTypes','SELECT','contact','User'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0xdb24,0x153));var _0x4db2=function(_0x131f37,_0x1fdb32){_0x131f37=_0x131f37-0x0;var _0x272809=_0xdb24[_0x131f37];return _0x272809;};'use strict';var util=require('util');var _=require(_0x4db2('0x0'));var Redis=require(_0x4db2('0x1'));var interactionService=require(_0x4db2('0x2'));var qs=require(_0x4db2('0x3'));var logger=require(_0x4db2('0x4'))(_0x4db2('0x5'));var config=require(_0x4db2('0x6'));var db=require(_0x4db2('0x7'))['db'];config['redis']=_['defaults'](config[_0x4db2('0x8')],{'host':_0x4db2('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4db2('0x8')]));require(_0x4db2('0xa'))[_0x4db2('0xb')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4db2('0xc')][_0x4db2('0xd')]({'port':0x232c});var client9002=jayson[_0x4db2('0xc')][_0x4db2('0xd')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0x4db2('0xe'));function respondWithRpcPromise(_0xc7e35d,_0x3971e9,_0x3a9c0c,_0xd71079){return new Promise(function(_0x2558d5,_0x4c0e11){var _0x378d7c=_0xd71079||client;return _0x378d7c[_0x4db2('0xf')](_0xc7e35d,_0x3a9c0c)[_0x4db2('0x10')](function(_0x746ac1){logger['info'](_0x4db2('0x11'),_0x3971e9,_0x4db2('0x12'));logger[_0x4db2('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3971e9,_0x4db2('0x12'),JSON['stringify'](_0x746ac1));if(_0x746ac1[_0x4db2('0x14')]){if(_0x746ac1[_0x4db2('0x14')]['code']===0x1f4){logger[_0x4db2('0x14')](_0x4db2('0x11'),_0x3971e9,_0x746ac1['error'][_0x4db2('0x15')]);return _0x4c0e11(_0x746ac1[_0x4db2('0x14')][_0x4db2('0x15')]);}logger[_0x4db2('0x14')](_0x4db2('0x11'),_0x3971e9,_0x746ac1[_0x4db2('0x14')][_0x4db2('0x15')]);return _0x2558d5(_0x746ac1[_0x4db2('0x14')][_0x4db2('0x15')]);}else{logger[_0x4db2('0x16')](_0x4db2('0x11'),_0x3971e9,'request\x20sent');_0x2558d5(_0x746ac1[_0x4db2('0x17')]['message']);}})[_0x4db2('0x18')](function(_0x179e61){logger[_0x4db2('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x3971e9,_0x179e61);_0x4c0e11(_0x179e61);});});}function respondWithResult(_0x223724,_0x5cafe6){_0x5cafe6=_0x5cafe6||0xc8;return function(_0x4f0b93){if(_0x4f0b93){return _0x223724[_0x4db2('0x19')](_0x5cafe6)[_0x4db2('0x1a')](_0x4f0b93);}};}function respondWithFilteredResult(_0x343906,_0x485077){return function(_0xc404fc){if(_0xc404fc){var _0x377b2e=typeof _0x485077[_0x4db2('0x1b')]===_0x4db2('0x1c')&&typeof _0x485077[_0x4db2('0x1d')]===_0x4db2('0x1c');var _0xd44214=_0xc404fc[_0x4db2('0x1e')];var _0x552e34=_0x377b2e?0x0:_0x485077[_0x4db2('0x1b')];var _0x133e82=_0x377b2e?_0xc404fc[_0x4db2('0x1e')]:_0x485077[_0x4db2('0x1b')]+_0x485077[_0x4db2('0x1d')];var _0x58793c;if(_0x133e82>=_0xd44214){_0x133e82=_0xd44214;_0x58793c=0xc8;}else{_0x58793c=0xce;}_0x343906['status'](_0x58793c);return _0x343906[_0x4db2('0x1f')](_0x4db2('0x20'),_0x552e34+'-'+_0x133e82+'/'+_0xd44214)[_0x4db2('0x1a')](_0xc404fc);}return null;};}function saveUpdates(_0x44588f){return function(_0x2fb512){if(_0x2fb512){return _0x2fb512[_0x4db2('0x21')](_0x44588f)[_0x4db2('0x10')](function(_0x2023cf){return _0x2023cf;});}return null;};}function removeEntity(_0x576c7c){return function(_0x130de7){if(_0x130de7){return _0x130de7[_0x4db2('0x22')]()['then'](function(){_0x576c7c[_0x4db2('0x19')](0xcc)[_0x4db2('0x23')]();});}};}function handleEntityNotFound(_0x53fffe){return function(_0x5aea14){if(!_0x5aea14){_0x53fffe[_0x4db2('0x24')](0x194);}return _0x5aea14;};}function handleError(_0x15e114,_0x4e05c1){_0x4e05c1=_0x4e05c1||0x1f4;return function(_0x5d49b1){logger['error'](_0x5d49b1[_0x4db2('0x25')]);if(_0x5d49b1['name']){delete _0x5d49b1[_0x4db2('0x26')];}_0x15e114[_0x4db2('0x19')](_0x4e05c1)[_0x4db2('0x27')](_0x5d49b1);};}exports['index']=function(_0x45d731,_0x3d6be5){var _0xef2edc={},_0x4997a2={},_0x316b67={'count':0x0,'rows':[]};var _0x168db8=_['map'](db[_0x4db2('0x28')][_0x4db2('0x29')],function(_0x4c8b75){return{'name':_0x4c8b75['fieldName'],'type':_0x4c8b75[_0x4db2('0x2a')][_0x4db2('0x2b')]};});_0x4997a2[_0x4db2('0x2c')]=_[_0x4db2('0x2d')](_0x168db8,_0x4db2('0x26'));_0x4997a2['query']=_['keys'](_0x45d731[_0x4db2('0x2e')]);_0x4997a2['filters']=_[_0x4db2('0x2f')](_0x4997a2['model'],_0x4997a2[_0x4db2('0x2e')]);_0xef2edc[_0x4db2('0x30')]=_[_0x4db2('0x2f')](_0x4997a2[_0x4db2('0x2c')],qs[_0x4db2('0x31')](_0x45d731[_0x4db2('0x2e')]['fields']));_0xef2edc['attributes']=_0xef2edc[_0x4db2('0x30')]['length']?_0xef2edc[_0x4db2('0x30')]:_0x4997a2[_0x4db2('0x2c')];if(!_0x45d731[_0x4db2('0x2e')][_0x4db2('0x32')]('nolimit')){_0xef2edc[_0x4db2('0x1d')]=qs[_0x4db2('0x1d')](_0x45d731['query'][_0x4db2('0x1d')]);_0xef2edc[_0x4db2('0x1b')]=qs['offset'](_0x45d731[_0x4db2('0x2e')][_0x4db2('0x1b')]);}_0xef2edc[_0x4db2('0x33')]=qs['sort'](_0x45d731[_0x4db2('0x2e')]['sort']);_0xef2edc['where']=qs[_0x4db2('0x34')](_[_0x4db2('0x35')](_0x45d731[_0x4db2('0x2e')],_0x4997a2[_0x4db2('0x34')]),_0x168db8);if(_0x45d731['query'][_0x4db2('0x36')]){_0xef2edc[_0x4db2('0x37')]=_[_0x4db2('0x38')](_0xef2edc['where'],{'$or':_[_0x4db2('0x2d')](_0x168db8,function(_0x301a28){if(_0x301a28[_0x4db2('0x2a')]!==_0x4db2('0x39')){var _0x251daa={};_0x251daa[_0x301a28[_0x4db2('0x26')]]={'$like':'%'+_0x45d731[_0x4db2('0x2e')][_0x4db2('0x36')]+'%'};return _0x251daa;}})});}_0xef2edc=_[_0x4db2('0x38')]({},_0xef2edc,_0x45d731[_0x4db2('0x3a')]);var _0x3aba82={'where':_0xef2edc['where']};return db[_0x4db2('0x28')][_0x4db2('0x1e')](_0x3aba82)[_0x4db2('0x10')](function(_0x106302){_0x316b67['count']=_0x106302;if(_0x45d731[_0x4db2('0x2e')][_0x4db2('0x3b')]){_0xef2edc[_0x4db2('0x3c')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x4db2('0x3d')](_0xef2edc);})[_0x4db2('0x10')](function(_0x246bc8){_0x316b67[_0x4db2('0x3e')]=_0x246bc8;return _0x316b67;})[_0x4db2('0x10')](respondWithFilteredResult(_0x3d6be5,_0xef2edc))['catch'](handleError(_0x3d6be5,null));};exports[_0x4db2('0x3f')]=function(_0x55bc6a,_0xa5dfb5){var _0x768a13={'raw':!![],'where':{'id':_0x55bc6a[_0x4db2('0x40')]['id']}},_0x425bb2={};_0x425bb2[_0x4db2('0x2c')]=_[_0x4db2('0x41')](db[_0x4db2('0x28')][_0x4db2('0x29')]);_0x425bb2[_0x4db2('0x2e')]=_[_0x4db2('0x41')](_0x55bc6a[_0x4db2('0x2e')]);_0x425bb2[_0x4db2('0x34')]=_[_0x4db2('0x2f')](_0x425bb2['model'],_0x425bb2[_0x4db2('0x2e')]);_0x768a13[_0x4db2('0x30')]=_['intersection'](_0x425bb2[_0x4db2('0x2c')],qs['fields'](_0x55bc6a[_0x4db2('0x2e')][_0x4db2('0x31')]));_0x768a13['attributes']=_0x768a13['attributes']['length']?_0x768a13[_0x4db2('0x30')]:_0x425bb2[_0x4db2('0x2c')];if(_0x55bc6a['query'][_0x4db2('0x3b')]){_0x768a13[_0x4db2('0x3c')]=[{'all':!![]}];}_0x768a13=_[_0x4db2('0x38')]({},_0x768a13,_0x55bc6a[_0x4db2('0x3a')]);return db[_0x4db2('0x28')][_0x4db2('0x42')](_0x768a13)[_0x4db2('0x10')](handleEntityNotFound(_0xa5dfb5,null))['then'](respondWithResult(_0xa5dfb5,null))[_0x4db2('0x18')](handleError(_0xa5dfb5,null));};exports[_0x4db2('0x43')]=function(_0x4ae9e0,_0x5dd573){return db[_0x4db2('0x28')][_0x4db2('0x43')](_0x4ae9e0[_0x4db2('0x44')],{})['then'](respondWithResult(_0x5dd573,0xc9))[_0x4db2('0x18')](handleError(_0x5dd573,null));};exports['update']=function(_0x3fc5b4,_0x4b6f3d){if(_0x3fc5b4[_0x4db2('0x44')]['id']){delete _0x3fc5b4['body']['id'];}return db[_0x4db2('0x28')][_0x4db2('0x42')]({'where':{'id':_0x3fc5b4[_0x4db2('0x40')]['id']}})[_0x4db2('0x10')](handleEntityNotFound(_0x4b6f3d,null))[_0x4db2('0x10')](saveUpdates(_0x3fc5b4['body'],null))[_0x4db2('0x10')](respondWithResult(_0x4b6f3d,null))[_0x4db2('0x18')](handleError(_0x4b6f3d,null));};exports['destroy']=function(_0x2da132,_0x2dc990){return db[_0x4db2('0x28')][_0x4db2('0x42')]({'where':{'id':_0x2da132['params']['id']}})[_0x4db2('0x10')](handleEntityNotFound(_0x2dc990,null))['then'](removeEntity(_0x2dc990,null))[_0x4db2('0x18')](handleError(_0x2dc990,null));};exports[_0x4db2('0x45')]=function(_0x37358f,_0x138c8d){return db[_0x4db2('0x28')][_0x4db2('0x45')]()[_0x4db2('0x10')](respondWithResult(_0x138c8d,null))[_0x4db2('0x18')](handleError(_0x138c8d,null));};exports[_0x4db2('0x46')]=function(_0x1f29ee,_0x54ba1e){var _0x1d88ae=_0x4db2('0x47');return interactionService[_0x4db2('0x48')](_0x1f29ee,_0x1d88ae)[_0x4db2('0x10')](respondWithResult(_0x54ba1e,null))[_0x4db2('0x18')](handleError(_0x54ba1e,null));};exports[_0x4db2('0x49')]=function(_0x1981b9,_0x5913bb){var _0x4fd0b3={'agent':{},'channel':_0x4db2('0x47')};if(_0x1981b9[_0x4db2('0x44')]['id']){delete _0x1981b9['body']['id'];}_0x1981b9['body']['UserId']=_0x1981b9[_0x4db2('0x44')][_0x4db2('0x4a')]||_0x1981b9['user']['id'];_0x4fd0b3[_0x4db2('0x4b')]['id']=_0x1981b9[_0x4db2('0x44')][_0x4db2('0x4a')];return db[_0x4db2('0x28')]['find']({'where':{'id':_0x1981b9[_0x4db2('0x40')]['id'],'UserId':null}})[_0x4db2('0x10')](handleEntityNotFound(_0x5913bb,null))[_0x4db2('0x10')](function(_0x374bde){if(_0x374bde){_0x4fd0b3[_0x4db2('0x15')]=_0x374bde[_0x4db2('0x4c')]({'plain':!![]});return db['WhatsappInteraction'][_0x4db2('0x42')]({'where':{'id':_0x374bde[_0x4db2('0x4d')]}});}return null;})[_0x4db2('0x10')](handleEntityNotFound(_0x5913bb,null))['then'](function(_0x3e1328){if(_0x3e1328){_0x4fd0b3[_0x4db2('0x4e')]=_0x3e1328[_0x4db2('0x4c')]({'plain':!![]});interaction_log[_0x4db2('0x16')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1981b9[_0x4db2('0x4f')]['id'],_0x1981b9[_0x4db2('0x4f')]['name'],_0x1981b9[_0x4db2('0x4f')][_0x4db2('0x50')],_0x4fd0b3[_0x4db2('0x4e')]['id'],_0x1981b9[_0x4db2('0x44')]?JSON[_0x4db2('0x51')](_0x1981b9['body']):_0x4db2('0x52'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x4fd0b3);}return null;})['then'](function(_0x27287c){var _0x2ad2e4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x27287c[_0x4db2('0x15')][_0x4db2('0x53')];return db['sequelize'][_0x4db2('0x2e')](_0x2ad2e4,{'type':db[_0x4db2('0x54')][_0x4db2('0x55')][_0x4db2('0x56')],'raw':!![]})[_0x4db2('0x10')](function(_0xc8b14b){return _0xc8b14b;});})[_0x4db2('0x10')](function(_0x224dbf){if(_0x224dbf){_0x4fd0b3[_0x4db2('0x15')][_0x4db2('0x57')]=_0x224dbf[0x0];if(!_0x1981b9[_0x4db2('0x44')]['UserId'])return;return db[_0x4db2('0x58')]['find']({'where':{'id':_0x1981b9[_0x4db2('0x44')][_0x4db2('0x4a')],'role':'agent'},'attributes':['id','name',_0x4db2('0x59'),'email',_0x4db2('0x5a')],'raw':!![]});}return null;})['then'](function(_0x267594){if(!_0x267594)return null;_0x4fd0b3[_0x4db2('0x15')][_0x4db2('0x4b')]=_0x267594;return _0x4fd0b3;})['then'](function(_0x2fa3de){if(_0x2fa3de){_0x2fa3de[_0x4db2('0x15')]['interface']=util[_0x4db2('0x5b')]('SIP/%s',_0x1981b9[_0x4db2('0x4f')][_0x4db2('0x26')]);_0x2fa3de[_0x4db2('0x15')][_0x4db2('0x5c')]=_0x4fd0b3[_0x4db2('0x5c')];_0x2fa3de[_0x4db2('0x15')][_0x4db2('0x5d')]=_0x4fd0b3[_0x4db2('0x5c')];_0x2fa3de[_0x4db2('0x15')][_0x4db2('0x5e')]=_0x4db2('0x49');respondWithRpcPromise(_0x4db2('0x5f'),_0x4db2('0x5f'),{'event':_0x4db2('0x60'),'message':_0x2fa3de[_0x4db2('0x15')]},client9002);return _0x4fd0b3;}return null;})[_0x4db2('0x10')](respondWithResult(_0x5913bb,null))[_0x4db2('0x18')](handleError(_0x5913bb,null));};exports[_0x4db2('0x19')]=function(_0x12d844,_0x5dce0f){if(_0x12d844['body']['id']){delete _0x12d844[_0x4db2('0x44')]['id'];}var _0x3aa5cd;return db[_0x4db2('0x28')][_0x4db2('0x42')]({'where':{'id':_0x12d844['params']['id']}})[_0x4db2('0x10')](handleEntityNotFound(_0x5dce0f,null))['then'](function(_0x340a12){if(_0x340a12){_0x3aa5cd=_0x340a12;return db[_0x4db2('0x61')]['find']({'where':{'id':_0x340a12[_0x4db2('0x62')]}});}})[_0x4db2('0x10')](handleEntityNotFound(_0x5dce0f,null))[_0x4db2('0x10')](function(_0x353de2){if(_0x353de2){logger[_0x4db2('0x13')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x4db2('0x19'),_0x4db2('0x63'),_0x353de2[_0x4db2('0x2a')],util['inspect'](_0x12d844[_0x4db2('0x44')],{'showHidden':![],'depth':null}));switch(_0x353de2[_0x4db2('0x2a')]){case'twilio':if(_0x12d844[_0x4db2('0x44')][_0x4db2('0x64')]&&_0x12d844[_0x4db2('0x44')]['MessageSid']===_0x3aa5cd[_0x4db2('0x65')]&&_0x12d844['body'][_0x4db2('0x66')]&&_0x12d844[_0x4db2('0x44')][_0x4db2('0x66')]===_0x4db2('0x67')){return _0x3aa5cd[_0x4db2('0x21')]({'read':!![]});}else{logger[_0x4db2('0x14')](_0x4db2('0x68'),_0x4db2('0x19'),_0x4db2('0x69'),util[_0x4db2('0x6a')](_0x12d844['body'],{'showHidden':![],'depth':null}));}break;}return _0x3aa5cd;}})[_0x4db2('0x10')](respondWithResult(_0x5dce0f,null))['catch'](handleError(_0x5dce0f,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index ad278ee..c7c5ebb 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 _0xd52d=['WhatsappMessage','save','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xd52d,0x1c7));var _0xdd52=function(_0x691c54,_0x91689a){_0x691c54=_0x691c54-0x0;var _0x1498b6=_0xd52d[_0x691c54];return _0x1498b6;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xdd52('0x0'))['db'][_0xdd52('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdd52('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1dfed5){return function(_0x211062,_0x30fb04,_0x29a95e){WhatsappMessageEvents[_0xdd52('0x3')](_0x1dfed5+':'+_0x211062['id'],_0x211062);WhatsappMessageEvents[_0xdd52('0x3')](_0x1dfed5,_0x211062);_0x29a95e(null);};}for(var e in events){if(events[_0xdd52('0x4')](e)){var event=events[e];WhatsappMessage[_0xdd52('0x5')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x8caf=['remove','emit','hasOwnProperty','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x4912ca,_0x1345b0){_0x4912ca=_0x4912ca-0x0;var _0x1b8006=_0x8caf[_0x4912ca];return _0x1b8006;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xf8ca('0x0'))['db'][_0xf8ca('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf8ca('0x2')](0x0);var events={'afterCreate':_0xf8ca('0x3'),'afterUpdate':_0xf8ca('0x4'),'afterDestroy':_0xf8ca('0x5')};function emitEvent(_0x4e6684){return function(_0x129ca9,_0x23939c,_0x2a9691){WhatsappMessageEvents[_0xf8ca('0x6')](_0x4e6684+':'+_0x129ca9['id'],_0x129ca9);WhatsappMessageEvents[_0xf8ca('0x6')](_0x4e6684,_0x129ca9);_0x2a9691(null);};}for(var e in events){if(events[_0xf8ca('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xf8ca('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 483de1a..940758e 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 _0xb7fc=['WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','toLowerCase','direction','out','secret','UserId','WhatsappInteractionId','then','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','phone','authToken','body','whatsapp:','remote','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','accountSid','baseUrl','/messages/','text','POST','application/json','statuses','message_id','update'];(function(_0x5da7fb,_0x79a363){var _0x5c4d09=function(_0x37a707){while(--_0x37a707){_0x5da7fb['push'](_0x5da7fb['shift']());}};_0x5c4d09(++_0x79a363);}(_0xb7fc,0x193));var _0xcb7f=function(_0x426de2,_0x24acaf){_0x426de2=_0x426de2-0x0;var _0x1dbafc=_0xb7fc[_0x426de2];return _0x1dbafc;};'use strict';var _=require(_0xcb7f('0x0'));var util=require('util');var logger=require(_0xcb7f('0x1'))(_0xcb7f('0x2'));var moment=require(_0xcb7f('0x3'));var BPromise=require('bluebird');var rp=require(_0xcb7f('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xcb7f('0x5'));var rimraf=require(_0xcb7f('0x6'));var config=require(_0xcb7f('0x7'));var attributes=require(_0xcb7f('0x8'));module['exports']=function(_0x2eab51,_0x2fb562){return _0x2eab51['define'](_0xcb7f('0x9'),attributes,{'tableName':_0xcb7f('0xa'),'paranoid':![],'indexes':[{'name':_0xcb7f('0xb'),'fields':[_0xcb7f('0xb')]},{'name':_0xcb7f('0xc'),'fields':['body'],'type':_0xcb7f('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2abbae,_0x599aa0,_0x3845e7){var _0x29eba9=_0x2eab51[_0xcb7f('0xe')];var _0x469e57=_0x2abbae[_0xcb7f('0xf')]({'plain':!![]});if(_0x469e57['direction'][_0xcb7f('0x10')]()==='in'||_0x469e57[_0xcb7f('0x11')][_0xcb7f('0x10')]()===_0xcb7f('0x12')&&!_0x469e57[_0xcb7f('0x13')]&&!_['isNil'](_0x469e57[_0xcb7f('0x14')])){_0x29eba9['WhatsappInteraction']['findOne']({'where':{'id':_0x469e57[_0xcb7f('0x15')]}})[_0xcb7f('0x16')](function(_0x1cb0cf){if(_0x1cb0cf){_0x1cb0cf['update']({'lastMsgAt':_0x469e57[_0xcb7f('0x17')],'lastMsgDirection':_0x469e57['direction'][_0xcb7f('0x10')]()});}})[_0xcb7f('0x18')](function(_0x202a3a){console[_0xcb7f('0x19')](_0x202a3a);});}if(_0x469e57['direction']===_0xcb7f('0x12')&&!_0x469e57[_0xcb7f('0x13')]){var _0x5d4b49;_0x29eba9[_0xcb7f('0x1a')][_0xcb7f('0x1b')]({'where':{'id':_0x469e57[_0xcb7f('0x1c')]},'raw':!![]})[_0xcb7f('0x16')](function(_0x54bc13){_0x5d4b49=_0x54bc13;if(_0x5d4b49&&_0x5d4b49[_0xcb7f('0x1d')]){switch(_0x5d4b49['type']){case _0xcb7f('0x1e'):var _0x43c339=require('twilio');if(_0x5d4b49['accountSid']&&_0x5d4b49['authToken']&&_0x5d4b49[_0xcb7f('0x1f')]){var _0x273de2=new _0x43c339(_0x5d4b49['accountSid'],_0x5d4b49[_0xcb7f('0x20')]);_0x273de2['messages']['create']({'body':_0x469e57[_0xcb7f('0x21')],'to':_0xcb7f('0x22')+_0x469e57['phone'],'from':_0xcb7f('0x22')+_0x5d4b49['phone'],'statusCallback':_0x5d4b49[_0xcb7f('0x23')]+_0xcb7f('0x24')+_0x469e57['id']+'/status?token='+_0x5d4b49[_0xcb7f('0x25')]})[_0xcb7f('0x16')](function(_0x801502){if(_0x801502[_0xcb7f('0x26')]){return _0x2abbae['update']({'messageId':_0x801502[_0xcb7f('0x26')]});}})[_0xcb7f('0x18')](function(_0x45c27a){logger['error'](_0xcb7f('0x27'),_0xcb7f('0x28'),_0xcb7f('0x1e'),util[_0xcb7f('0x29')](_0x45c27a,{'showHidden':![],'depth':null}));});}else{logger[_0xcb7f('0x19')](_0xcb7f('0x27'),'afterCreate',_0xcb7f('0x1e'),_0xcb7f('0x2a'));}break;case _0xcb7f('0x2b'):var _0x28b517=_0x5d4b49[_0xcb7f('0x2c')];var _0x5a228d=_0x5d4b49[_0xcb7f('0x20')];var _0x1a920e=_0x5d4b49[_0xcb7f('0x2d')]+'/whatsapp/v1/'+_0x28b517+_0xcb7f('0x2e');var _0x2e162f={'to':[_0x469e57[_0xcb7f('0x1f')]],'message':{'type':_0xcb7f('0x2f'),'text':_0x469e57[_0xcb7f('0x21')]}};var _0x2529d7={'method':_0xcb7f('0x30'),'uri':_0x1a920e,'headers':{'Authorization':'Bearer\x20'+_0x5a228d,'Content-Type':_0xcb7f('0x31')},'body':_0x2e162f,'json':!![]};rp(_0x2529d7)[_0xcb7f('0x16')](function(_0x7c6126){if(_0x7c6126[_0xcb7f('0x32')][0x0][_0xcb7f('0x33')]){return _0x2abbae[_0xcb7f('0x34')]({'messageId':_0x7c6126[_0xcb7f('0x32')][0x0][_0xcb7f('0x33')]});}})[_0xcb7f('0x18')](function(_0x529cc7){logger['err'](_0xcb7f('0x35'),_0x529cc7);});break;}}})[_0xcb7f('0x36')](function(){_0x3845e7();});}else{_0x3845e7();}}},'charset':_0xcb7f('0x37'),'collate':_0xcb7f('0x38')});}; \ No newline at end of file +var _0xf2cc=['out','secret','isNil','UserId','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','message_id','statuses','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','direction','toLowerCase'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xf2cc,0x1a8));var _0xcf2c=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xf2cc[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xcf2c('0x0'));var util=require('util');var logger=require(_0xcf2c('0x1'))(_0xcf2c('0x2'));var moment=require(_0xcf2c('0x3'));var BPromise=require('bluebird');var rp=require(_0xcf2c('0x4'));var fetch=require(_0xcf2c('0x5'));var fs=require('fs');var path=require(_0xcf2c('0x6'));var rimraf=require(_0xcf2c('0x7'));var config=require('../../config/environment');var attributes=require(_0xcf2c('0x8'));module['exports']=function(_0x9f1849,_0x213bef){return _0x9f1849['define'](_0xcf2c('0x9'),attributes,{'tableName':_0xcf2c('0xa'),'paranoid':![],'indexes':[{'name':_0xcf2c('0xb'),'fields':[_0xcf2c('0xb')]},{'name':_0xcf2c('0xc'),'fields':[_0xcf2c('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x185ccc,_0xc6aab2,_0x21bc44){var _0x4523b0=_0x9f1849['models'];var _0xad20ff=_0x185ccc['get']({'plain':!![]});if(_0xad20ff[_0xcf2c('0xe')][_0xcf2c('0xf')]()==='in'||_0xad20ff[_0xcf2c('0xe')][_0xcf2c('0xf')]()===_0xcf2c('0x10')&&!_0xad20ff[_0xcf2c('0x11')]&&!_[_0xcf2c('0x12')](_0xad20ff[_0xcf2c('0x13')])){_0x4523b0['WhatsappInteraction'][_0xcf2c('0x14')]({'where':{'id':_0xad20ff[_0xcf2c('0x15')]}})[_0xcf2c('0x16')](function(_0x4e0652){if(_0x4e0652){_0x4e0652[_0xcf2c('0x17')]({'lastMsgAt':_0xad20ff[_0xcf2c('0x18')],'lastMsgDirection':_0xad20ff[_0xcf2c('0xe')]['toLowerCase']()});}})[_0xcf2c('0x19')](function(_0x17944d){console[_0xcf2c('0x1a')](_0x17944d);});}if(_0xad20ff[_0xcf2c('0xe')]===_0xcf2c('0x10')&&!_0xad20ff[_0xcf2c('0x11')]){var _0x22ebb7;_0x4523b0[_0xcf2c('0x1b')][_0xcf2c('0x1c')]({'where':{'id':_0xad20ff[_0xcf2c('0x1d')]},'raw':!![]})[_0xcf2c('0x16')](function(_0x12872a){_0x22ebb7=_0x12872a;if(_0x22ebb7&&_0x22ebb7[_0xcf2c('0x1e')]){switch(_0x22ebb7[_0xcf2c('0x1e')]){case _0xcf2c('0x1f'):var _0x195c71=require(_0xcf2c('0x1f'));if(_0x22ebb7[_0xcf2c('0x20')]&&_0x22ebb7[_0xcf2c('0x21')]&&_0x22ebb7[_0xcf2c('0x22')]){var _0x4738a4=new _0x195c71(_0x22ebb7['accountSid'],_0x22ebb7[_0xcf2c('0x21')]);_0x4738a4[_0xcf2c('0x23')][_0xcf2c('0x24')]({'body':_0xad20ff[_0xcf2c('0xd')],'to':_0xcf2c('0x25')+_0xad20ff[_0xcf2c('0x22')],'from':_0xcf2c('0x25')+_0x22ebb7['phone'],'statusCallback':_0x22ebb7[_0xcf2c('0x26')]+_0xcf2c('0x27')+_0xad20ff['id']+'/status?token='+_0x22ebb7['token']})[_0xcf2c('0x16')](function(_0x10c1fc){if(_0x10c1fc[_0xcf2c('0x28')]){return _0x185ccc['update']({'messageId':_0x10c1fc[_0xcf2c('0x28')]});}})[_0xcf2c('0x19')](function(_0x2ec06d){logger[_0xcf2c('0x1a')](_0xcf2c('0x29'),_0xcf2c('0x2a'),'twilio',util['inspect'](_0x2ec06d,{'showHidden':![],'depth':null}));});}else{logger[_0xcf2c('0x1a')](_0xcf2c('0x29'),_0xcf2c('0x2a'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xcf2c('0x2b'):var _0x4f9cb8=_0x22ebb7[_0xcf2c('0x20')];var _0x936704=_0x22ebb7[_0xcf2c('0x21')];var _0x1d4ae8=_0x22ebb7[_0xcf2c('0x2c')]+_0xcf2c('0x2d')+_0x4f9cb8+_0xcf2c('0x2e');var _0x22978f={'to':[_0xad20ff[_0xcf2c('0x22')]],'message':{'type':'text','text':_0xad20ff[_0xcf2c('0xd')]}};var _0x371b8b={'method':_0xcf2c('0x2f'),'uri':_0x1d4ae8,'headers':{'Authorization':_0xcf2c('0x30')+_0x936704,'Content-Type':'application/json'},'body':_0x22978f,'json':!![]};rp(_0x371b8b)['then'](function(_0x113df0){if(_0x113df0['statuses'][0x0][_0xcf2c('0x31')]){return _0x185ccc[_0xcf2c('0x17')]({'messageId':_0x113df0[_0xcf2c('0x32')][0x0][_0xcf2c('0x31')]});}})[_0xcf2c('0x19')](function(_0x158d94){logger[_0xcf2c('0x33')]('WhatsappMessage,\x20%s',_0x158d94);});break;}}})[_0xcf2c('0x34')](function(){_0x21bc44();});}else{_0x21bc44();}}},'charset':_0xcf2c('0x35'),'collate':_0xcf2c('0x36')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 47d964d..f65604d 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 _0x7458=['register','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','util','moment','randomstring','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost','./whatsappMessage.socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7458,0x149));var _0x8745=function(_0x254d20,_0x47176e){_0x254d20=_0x254d20-0x0;var _0x219511=_0x7458[_0x254d20];return _0x219511;};'use strict';var _=require('lodash');var util=require(_0x8745('0x0'));var moment=require(_0x8745('0x1'));var BPromise=require('bluebird');var rs=require(_0x8745('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8745('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8745('0x4'));var config=require('../../config/environment');var jayson=require(_0x8745('0x5'));var client=jayson[_0x8745('0x6')][_0x8745('0x7')]({'port':0x232a});config[_0x8745('0x8')]=_[_0x8745('0x9')](config[_0x8745('0x8')],{'host':_0x8745('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8745('0x8')]));require(_0x8745('0xb'))[_0x8745('0xc')](socket);function respondWithRpcPromise(_0x2644e9,_0x5f0c10,_0x5ccc9a){return new BPromise(function(_0x12e99d,_0x213872){return client['request'](_0x2644e9,_0x5ccc9a)[_0x8745('0xd')](function(_0x57b998){logger[_0x8745('0xe')]('WhatsappMessage,\x20%s,\x20%s',_0x5f0c10,_0x8745('0xf'));logger[_0x8745('0x10')](_0x8745('0x11'),_0x5f0c10,_0x8745('0xf'),JSON[_0x8745('0x12')](_0x57b998));if(_0x57b998['error']){if(_0x57b998[_0x8745('0x13')][_0x8745('0x14')]===0x1f4){logger[_0x8745('0x13')](_0x8745('0x15'),_0x5f0c10,_0x57b998[_0x8745('0x13')][_0x8745('0x16')]);return _0x213872(_0x57b998[_0x8745('0x13')]['message']);}logger[_0x8745('0x13')](_0x8745('0x15'),_0x5f0c10,_0x57b998[_0x8745('0x13')][_0x8745('0x16')]);return _0x12e99d(_0x57b998['error'][_0x8745('0x16')]);}else{logger[_0x8745('0xe')](_0x8745('0x15'),_0x5f0c10,'request\x20sent');_0x12e99d(_0x57b998[_0x8745('0x17')]['message']);}})[_0x8745('0x18')](function(_0x2c68fb){logger['error'](_0x8745('0x15'),_0x5f0c10,_0x2c68fb);_0x213872(_0x2c68fb);});});}exports[_0x8745('0x19')]=function(_0x31b165){var _0x42792f=this;return new Promise(function(_0x1237a3,_0xff4a1d){return db[_0x8745('0x1a')][_0x8745('0x1b')](_0x31b165[_0x8745('0x1c')],{'raw':_0x31b165[_0x8745('0x1d')]?_0x31b165['options'][_0x8745('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x43773d){logger['info'](_0x8745('0x19'),_0x31b165);logger[_0x8745('0x10')](_0x8745('0x19'),_0x31b165,JSON['stringify'](_0x43773d));_0x1237a3(_0x43773d);})[_0x8745('0x18')](function(_0x561270){logger['error'](_0x8745('0x19'),_0x561270[_0x8745('0x16')],_0x31b165);_0xff4a1d(_0x42792f[_0x8745('0x13')](0x1f4,_0x561270[_0x8745('0x16')]));});});}; \ No newline at end of file +var _0x7778=['ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','WhatsappMessage','create','options','CreateWhatsappMessage','lodash','moment'];(function(_0x4ee949,_0x439a41){var _0x37d68f=function(_0x474369){while(--_0x474369){_0x4ee949['push'](_0x4ee949['shift']());}};_0x37d68f(++_0x439a41);}(_0x7778,0x150));var _0x8777=function(_0x5c224d,_0x17172b){_0x5c224d=_0x5c224d-0x0;var _0x41eea2=_0x7778[_0x5c224d];return _0x41eea2;};'use strict';var _=require(_0x8777('0x0'));var util=require('util');var moment=require(_0x8777('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8777('0x2'));var db=require(_0x8777('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8777('0x4'));var config=require(_0x8777('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8777('0x6')][_0x8777('0x7')]({'port':0x232a});config[_0x8777('0x8')]=_[_0x8777('0x9')](config[_0x8777('0x8')],{'host':_0x8777('0xa'),'port':0x18eb});var socket=require(_0x8777('0xb'))(new Redis(config[_0x8777('0x8')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2bc1ff,_0x5efcae,_0x5daddc){return new BPromise(function(_0x340f1b,_0x46eeeb){return client['request'](_0x2bc1ff,_0x5daddc)[_0x8777('0xc')](function(_0x195ff3){logger[_0x8777('0xd')](_0x8777('0xe'),_0x5efcae,_0x8777('0xf'));logger[_0x8777('0x10')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5efcae,'request\x20sent',JSON[_0x8777('0x11')](_0x195ff3));if(_0x195ff3[_0x8777('0x12')]){if(_0x195ff3[_0x8777('0x12')][_0x8777('0x13')]===0x1f4){logger['error'](_0x8777('0xe'),_0x5efcae,_0x195ff3[_0x8777('0x12')][_0x8777('0x14')]);return _0x46eeeb(_0x195ff3[_0x8777('0x12')][_0x8777('0x14')]);}logger[_0x8777('0x12')](_0x8777('0xe'),_0x5efcae,_0x195ff3[_0x8777('0x12')][_0x8777('0x14')]);return _0x340f1b(_0x195ff3[_0x8777('0x12')][_0x8777('0x14')]);}else{logger[_0x8777('0xd')]('WhatsappMessage,\x20%s,\x20%s',_0x5efcae,_0x8777('0xf'));_0x340f1b(_0x195ff3['result'][_0x8777('0x14')]);}})[_0x8777('0x15')](function(_0x5157a3){logger[_0x8777('0x12')](_0x8777('0xe'),_0x5efcae,_0x5157a3);_0x46eeeb(_0x5157a3);});});}exports['CreateWhatsappMessage']=function(_0x158f48){var _0x3e56ed=this;return new Promise(function(_0x5c91d7,_0x4601b7){return db[_0x8777('0x16')][_0x8777('0x17')](_0x158f48['body'],{'raw':_0x158f48[_0x8777('0x18')]?_0x158f48['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x479386){logger[_0x8777('0xd')](_0x8777('0x19'),_0x158f48);logger[_0x8777('0x10')]('CreateWhatsappMessage',_0x158f48,JSON[_0x8777('0x11')](_0x479386));_0x5c91d7(_0x479386);})['catch'](function(_0x14ca7b){logger[_0x8777('0x12')]('CreateWhatsappMessage',_0x14ca7b[_0x8777('0x14')],_0x158f48);_0x4601b7(_0x3e56ed[_0x8777('0x12')](0x1f4,_0x14ca7b[_0x8777('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 6728d96..e486a03 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 _0x6f43=['whatsappMessage:','./whatsappMessage.events','update','emit','register','length'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x6f43,0xaf));var _0x36f4=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x6f43[_0x15ea09];return _0x3e9c78;};'use strict';var WhatsappMessageEvents=require(_0x36f4('0x0'));var events=['save','remove',_0x36f4('0x1')];function createListener(_0x352340,_0x48eae3){return function(_0x279e81){_0x48eae3[_0x36f4('0x2')](_0x352340,_0x279e81);};}function removeListener(_0x1689e4,_0x33b1fa){return function(){WhatsappMessageEvents['removeListener'](_0x1689e4,_0x33b1fa);};}exports[_0x36f4('0x3')]=function(_0xf20687){for(var _0x23f4c1=0x0,_0x13939e=events[_0x36f4('0x4')];_0x23f4c1<_0x13939e;_0x23f4c1++){var _0x72627=events[_0x23f4c1];var _0x1a53ac=createListener(_0x36f4('0x5')+_0x72627,_0xf20687);WhatsappMessageEvents['on'](_0x72627,_0x1a53ac);}}; \ No newline at end of file +var _0xe032=['./whatsappMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x420513,_0x30eae3){var _0x1b44ec=function(_0x644f88){while(--_0x644f88){_0x420513['push'](_0x420513['shift']());}};_0x1b44ec(++_0x30eae3);}(_0xe032,0x103));var _0x2e03=function(_0x235563,_0x260ece){_0x235563=_0x235563-0x0;var _0x219be0=_0xe032[_0x235563];return _0x219be0;};'use strict';var WhatsappMessageEvents=require(_0x2e03('0x0'));var events=[_0x2e03('0x1'),_0x2e03('0x2'),_0x2e03('0x3')];function createListener(_0x109010,_0x595585){return function(_0x17e1ad){_0x595585[_0x2e03('0x4')](_0x109010,_0x17e1ad);};}function removeListener(_0xe39d37,_0xdc282d){return function(){WhatsappMessageEvents[_0x2e03('0x5')](_0xe39d37,_0xdc282d);};}exports[_0x2e03('0x6')]=function(_0x2ce5ed){for(var _0x47031d=0x0,_0x16c217=events['length'];_0x47031d<_0x16c217;_0x47031d++){var _0x43ca1f=events[_0x47031d];var _0x4c454e=createListener('whatsappMessage:'+_0x43ca1f,_0x2ce5ed);WhatsappMessageEvents['on'](_0x43ca1f,_0x4c454e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 06312f3..e01c0cc 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 _0x43c4=['getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','/:id/members'];(function(_0x203df2,_0x21087c){var _0x1e1777=function(_0x29f669){while(--_0x29f669){_0x203df2['push'](_0x203df2['shift']());}};_0x1e1777(++_0x21087c);}(_0x43c4,0xf7));var _0x443c=function(_0x3585ae,_0x5491d6){_0x3585ae=_0x3585ae-0x0;var _0x4d7d9e=_0x43c4[_0x3585ae];return _0x4d7d9e;};'use strict';var multer=require('multer');var util=require(_0x443c('0x0'));var path=require(_0x443c('0x1'));var timeout=require(_0x443c('0x2'));var express=require(_0x443c('0x3'));var router=express[_0x443c('0x4')]();var fs_extra=require(_0x443c('0x5'));var auth=require(_0x443c('0x6'));var interaction=require(_0x443c('0x7'));var config=require(_0x443c('0x8'));var controller=require('./whatsappQueue.controller');router[_0x443c('0x9')]('/',auth[_0x443c('0xa')](),controller['index']);router[_0x443c('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x443c('0xb')]);router[_0x443c('0x9')](_0x443c('0xc'),auth[_0x443c('0xa')](),controller['show']);router[_0x443c('0x9')](_0x443c('0xd'),auth['isAuthenticated'](),controller[_0x443c('0xe')]);router[_0x443c('0x9')](_0x443c('0xf'),auth[_0x443c('0xa')](),controller[_0x443c('0x10')]);router[_0x443c('0x9')](_0x443c('0x11'),auth[_0x443c('0xa')](),controller['getAgents']);router[_0x443c('0x12')]('/',auth['isAuthenticated'](),controller[_0x443c('0x13')]);router[_0x443c('0x12')](_0x443c('0xf'),auth[_0x443c('0xa')](),controller[_0x443c('0x14')]);router[_0x443c('0x12')]('/:id/users',auth[_0x443c('0xa')](),controller[_0x443c('0x15')]);router[_0x443c('0x16')](_0x443c('0xc'),auth[_0x443c('0xa')](),controller[_0x443c('0x17')]);router[_0x443c('0x18')](_0x443c('0xc'),auth[_0x443c('0xa')](),controller[_0x443c('0x19')]);router[_0x443c('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0x443c('0x1a')]);router['delete'](_0x443c('0x11'),auth[_0x443c('0xa')](),controller[_0x443c('0x1b')]);module[_0x443c('0x1c')]=router; \ No newline at end of file +var _0x1d63=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id/members','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','/:id','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x1d63,0xa4));var _0x31d6=function(_0x516a26,_0x51ce24){_0x516a26=_0x516a26-0x0;var _0x3fbde8=_0x1d63[_0x516a26];return _0x3fbde8;};'use strict';var multer=require(_0x31d6('0x0'));var util=require(_0x31d6('0x1'));var path=require(_0x31d6('0x2'));var timeout=require(_0x31d6('0x3'));var express=require(_0x31d6('0x4'));var router=express['Router']();var fs_extra=require(_0x31d6('0x5'));var auth=require(_0x31d6('0x6'));var interaction=require(_0x31d6('0x7'));var config=require(_0x31d6('0x8'));var controller=require(_0x31d6('0x9'));router[_0x31d6('0xa')]('/',auth[_0x31d6('0xb')](),controller['index']);router[_0x31d6('0xa')](_0x31d6('0xc'),auth['isAuthenticated'](),controller[_0x31d6('0xd')]);router[_0x31d6('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x31d6('0xa')](_0x31d6('0xe'),auth[_0x31d6('0xb')](),controller['getMembers']);router[_0x31d6('0xa')](_0x31d6('0xf'),auth[_0x31d6('0xb')](),controller[_0x31d6('0x10')]);router[_0x31d6('0xa')]('/:id/users',auth[_0x31d6('0xb')](),controller[_0x31d6('0x11')]);router[_0x31d6('0x12')]('/',auth[_0x31d6('0xb')](),controller[_0x31d6('0x13')]);router[_0x31d6('0x12')]('/:id/teams',auth[_0x31d6('0xb')](),controller[_0x31d6('0x14')]);router[_0x31d6('0x12')](_0x31d6('0x15'),auth['isAuthenticated'](),controller[_0x31d6('0x16')]);router['put'](_0x31d6('0x17'),auth[_0x31d6('0xb')](),controller[_0x31d6('0x18')]);router[_0x31d6('0x19')](_0x31d6('0x17'),auth[_0x31d6('0xb')](),controller['destroy']);router[_0x31d6('0x19')](_0x31d6('0xf'),auth[_0x31d6('0xb')](),controller[_0x31d6('0x1a')]);router[_0x31d6('0x19')](_0x31d6('0x15'),auth['isAuthenticated'](),controller[_0x31d6('0x1b')]);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 1b8a955..d0b6c9b 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 _0x2750=['rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x1dce60,_0xd7eb0b){var _0x2d627b=function(_0x3a9d28){while(--_0x3a9d28){_0x1dce60['push'](_0x1dce60['shift']());}};_0x2d627b(++_0xd7eb0b);}(_0x2750,0x13b));var _0x0275=function(_0x4052eb,_0x208497){_0x4052eb=_0x4052eb-0x0;var _0x2724bf=_0x2750[_0x4052eb];return _0x2724bf;};'use strict';var Sequelize=require(_0x0275('0x0'));module['exports']={'name':{'type':Sequelize[_0x0275('0x1')],'unique':_0x0275('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x0275('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0275('0x4')](_0x0275('0x5'),_0x0275('0x6'),_0x0275('0x7'))},'description':{'type':Sequelize[_0x0275('0x1')]}}; \ No newline at end of file +var _0xaf1d=['STRING','name','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x2cc4cc,_0x365c54){var _0x59b023=function(_0x54e18f){while(--_0x54e18f){_0x2cc4cc['push'](_0x2cc4cc['shift']());}};_0x59b023(++_0x365c54);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x45686b,_0x26d1c9){_0x45686b=_0x45686b-0x0;var _0x35cc00=_0xaf1d[_0x45686b];return _0x35cc00;};'use strict';var Sequelize=require(_0xdaf1('0x0'));module[_0xdaf1('0x1')]={'name':{'type':Sequelize[_0xdaf1('0x2')],'unique':_0xdaf1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdaf1('0x4')](_0xdaf1('0x5'),'beepall',_0xdaf1('0x6'))},'description':{'type':Sequelize[_0xdaf1('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index bffc12e..97ee1af 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 _0xcc35=['query','rows','catch','show','params','model','keys','filters','intersection','fields','attributes','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','Team','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','addTeams','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','emit','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','get','WhatsappQueues','then','end','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include'];(function(_0x15f42d,_0x4ea581){var _0x10f9d6=function(_0x5ed021){while(--_0x5ed021){_0x15f42d['push'](_0x15f42d['shift']());}};_0x10f9d6(++_0x4ea581);}(_0xcc35,0xce));var _0x5cc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc35[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x5cc3('0x0'));var util=require(_0x5cc3('0x1'));var _=require(_0x5cc3('0x2'));var squel=require(_0x5cc3('0x3'));var Redis=require(_0x5cc3('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x5cc3('0x5'))(_0x5cc3('0x6'));var config=require(_0x5cc3('0x7'));var db=require(_0x5cc3('0x8'))['db'];config[_0x5cc3('0x9')]=_[_0x5cc3('0xa')](config[_0x5cc3('0x9')],{'host':_0x5cc3('0xb'),'port':0x18eb});var socket=require(_0x5cc3('0xc'))(new Redis(config[_0x5cc3('0x9')]));require(_0x5cc3('0xd'))[_0x5cc3('0xe')](socket);function respondWithStatusCode(_0x345991,_0x99e296){_0x99e296=_0x99e296||0xcc;return function(_0x34e106){if(_0x34e106){return _0x345991['sendStatus'](_0x99e296);}return _0x345991[_0x5cc3('0xf')](_0x99e296)['end']();};}function respondWithResult(_0x24163a,_0x2ffb76){_0x2ffb76=_0x2ffb76||0xc8;return function(_0x37f7ee){if(_0x37f7ee){return _0x24163a[_0x5cc3('0xf')](_0x2ffb76)[_0x5cc3('0x10')](_0x37f7ee);}};}function respondWithFilteredResult(_0x2b5fc2,_0x14813a){return function(_0x48f1a3){if(_0x48f1a3){var _0x24e97d=typeof _0x14813a[_0x5cc3('0x11')]===_0x5cc3('0x12')&&typeof _0x14813a['limit']===_0x5cc3('0x12');var _0x349b61=_0x48f1a3[_0x5cc3('0x13')];var _0x387b9e=_0x24e97d?0x0:_0x14813a[_0x5cc3('0x11')];var _0x370346=_0x24e97d?_0x48f1a3['count']:_0x14813a[_0x5cc3('0x11')]+_0x14813a[_0x5cc3('0x14')];var _0xf43e71;if(_0x370346>=_0x349b61){_0x370346=_0x349b61;_0xf43e71=0xc8;}else{_0xf43e71=0xce;}_0x2b5fc2[_0x5cc3('0xf')](_0xf43e71);return _0x2b5fc2[_0x5cc3('0x15')](_0x5cc3('0x16'),_0x387b9e+'-'+_0x370346+'/'+_0x349b61)['json'](_0x48f1a3);}return null;};}function saveUpdates(_0x3b6315){return function(_0x36abe5){if(_0x36abe5){return _0x36abe5[_0x5cc3('0x17')](_0x3b6315)['then'](function(_0x4b3ad1){return _0x4b3ad1;});}return null;};}function removeEntity(_0x3959eb){return function(_0x26e869){if(_0x26e869){return _0x26e869[_0x5cc3('0x18')]()['then'](function(){var _0x5b08f3=_0x26e869[_0x5cc3('0x19')]({'plain':!![]});var _0x1433db=_0x5cc3('0x1a');return db['UserProfileResource'][_0x5cc3('0x18')]({'where':{'type':_0x1433db,'resourceId':_0x5b08f3['id']}})[_0x5cc3('0x1b')](function(){return _0x26e869;});})[_0x5cc3('0x1b')](function(){_0x3959eb[_0x5cc3('0xf')](0xcc)[_0x5cc3('0x1c')]();});}};}function handleEntityNotFound(_0x543bf5){return function(_0x3b4576){if(!_0x3b4576){_0x543bf5['sendStatus'](0x194);}return _0x3b4576;};}function handleError(_0x4a4eab,_0x1403ec){_0x1403ec=_0x1403ec||0x1f4;return function(_0x3c4d6f){logger[_0x5cc3('0x1d')](_0x3c4d6f['stack']);if(_0x3c4d6f[_0x5cc3('0x1e')]){delete _0x3c4d6f[_0x5cc3('0x1e')];}_0x4a4eab['status'](_0x1403ec)[_0x5cc3('0x1f')](_0x3c4d6f);};}exports[_0x5cc3('0x20')]=function(_0x3f6940,_0x4b19d1){var _0x54d70e={};var _0x472e83={'count':0x0,'rows':[]};var _0x22572e=_[_0x5cc3('0x21')](db[_0x5cc3('0x22')][_0x5cc3('0x23')],function(_0x588d97){return{'name':_0x588d97[_0x5cc3('0x24')],'type':_0x588d97[_0x5cc3('0x25')][_0x5cc3('0x26')]};});_0x54d70e=qs[_0x5cc3('0x27')](_0x22572e,_0x3f6940);var _0x21b997={'where':_0x54d70e[_0x5cc3('0x28')]};return db['WhatsappQueue']['count'](_0x21b997)[_0x5cc3('0x1b')](function(_0x954864){_0x472e83[_0x5cc3('0x13')]=_0x954864;_0x54d70e[_0x5cc3('0x29')]=qs[_0x5cc3('0x29')](_0x3f6940[_0x5cc3('0x2a')]);return db[_0x5cc3('0x22')]['findAll'](_0x54d70e);})[_0x5cc3('0x1b')](function(_0x3bdf98){_0x472e83[_0x5cc3('0x2b')]=_0x3bdf98;return _0x472e83;})['then'](respondWithFilteredResult(_0x4b19d1,_0x54d70e))[_0x5cc3('0x2c')](handleError(_0x4b19d1,null));};exports[_0x5cc3('0x2d')]=function(_0x9ebb7d,_0x5ea655){var _0x22207d={'raw':!![],'where':{'id':_0x9ebb7d[_0x5cc3('0x2e')]['id']}},_0x1bf6b2={};_0x1bf6b2[_0x5cc3('0x2f')]=_[_0x5cc3('0x30')](db[_0x5cc3('0x22')][_0x5cc3('0x23')]);_0x1bf6b2[_0x5cc3('0x2a')]=_[_0x5cc3('0x30')](_0x9ebb7d[_0x5cc3('0x2a')]);_0x1bf6b2[_0x5cc3('0x31')]=_['intersection'](_0x1bf6b2['model'],_0x1bf6b2[_0x5cc3('0x2a')]);_0x22207d['attributes']=_[_0x5cc3('0x32')](_0x1bf6b2[_0x5cc3('0x2f')],qs['fields'](_0x9ebb7d['query'][_0x5cc3('0x33')]));_0x22207d[_0x5cc3('0x34')]=_0x22207d[_0x5cc3('0x34')]['length']?_0x22207d['attributes']:_0x1bf6b2[_0x5cc3('0x2f')];if(_0x9ebb7d[_0x5cc3('0x2a')]['includeAll']){_0x22207d[_0x5cc3('0x29')]=[{'all':!![]}];}_0x22207d=_[_0x5cc3('0x35')]({},_0x22207d,_0x9ebb7d[_0x5cc3('0x36')]);return db['WhatsappQueue']['find'](_0x22207d)[_0x5cc3('0x1b')](handleEntityNotFound(_0x5ea655,null))[_0x5cc3('0x1b')](respondWithResult(_0x5ea655,null))['catch'](handleError(_0x5ea655,null));};exports[_0x5cc3('0x37')]=function(_0x26ba75,_0x3e9434){return db['WhatsappQueue'][_0x5cc3('0x37')](_0x26ba75[_0x5cc3('0x38')],{})['then'](function(_0x41c9d6){var _0x3b66ae=_0x26ba75[_0x5cc3('0x39')]['get']({'plain':!![]});if(!_0x3b66ae)throw new Error(_0x5cc3('0x3a'));if(_0x3b66ae[_0x5cc3('0x3b')]==='user'){var _0x39736d=_0x41c9d6[_0x5cc3('0x19')]({'plain':!![]});var _0x57c2d3=_0x5cc3('0x1a');return db['UserProfileSection'][_0x5cc3('0x3c')]({'where':{'name':_0x57c2d3,'userProfileId':_0x3b66ae['userProfileId']},'raw':!![]})['then'](function(_0x13f319){if(_0x13f319&&_0x13f319[_0x5cc3('0x3d')]===0x0){return db[_0x5cc3('0x3e')][_0x5cc3('0x37')]({'name':_0x39736d[_0x5cc3('0x1e')],'resourceId':_0x39736d['id'],'type':_0x13f319[_0x5cc3('0x1e')],'sectionId':_0x13f319['id']},{})['then'](function(){return _0x41c9d6;});}else{return _0x41c9d6;}})['catch'](function(_0x1dc7b7){logger['error'](_0x5cc3('0x3f'),_0x1dc7b7);throw _0x1dc7b7;});}return _0x41c9d6;})['then'](respondWithResult(_0x3e9434,0xc9))[_0x5cc3('0x2c')](handleError(_0x3e9434,null));};exports[_0x5cc3('0x17')]=function(_0x33a8dd,_0x212544){if(_0x33a8dd[_0x5cc3('0x38')]['id']){delete _0x33a8dd['body']['id'];}return db[_0x5cc3('0x22')][_0x5cc3('0x3c')]({'where':{'id':_0x33a8dd[_0x5cc3('0x2e')]['id']}})[_0x5cc3('0x1b')](handleEntityNotFound(_0x212544,null))[_0x5cc3('0x1b')](saveUpdates(_0x33a8dd[_0x5cc3('0x38')],null))[_0x5cc3('0x1b')](respondWithResult(_0x212544,null))['catch'](handleError(_0x212544,null));};exports[_0x5cc3('0x18')]=function(_0x307f76,_0xc009eb){return db['WhatsappQueue']['find']({'where':{'id':_0x307f76[_0x5cc3('0x2e')]['id']}})[_0x5cc3('0x1b')](handleEntityNotFound(_0xc009eb,null))[_0x5cc3('0x1b')](removeEntity(_0xc009eb,null))['catch'](handleError(_0xc009eb,null));};exports[_0x5cc3('0x40')]=function(_0x320178,_0x6381be){return db[_0x5cc3('0x22')]['describe']()['then'](respondWithResult(_0x6381be,null))[_0x5cc3('0x2c')](handleError(_0x6381be,null));};exports[_0x5cc3('0x41')]=function(_0x3e7734,_0x1353c2){var _0x4e49ff={'raw':!![],'where':{}},_0x2c5feb={},_0x46ce53;return db[_0x5cc3('0x22')][_0x5cc3('0x42')]({'where':{'id':_0x3e7734['params']['id']}})[_0x5cc3('0x1b')](handleEntityNotFound(_0x1353c2,null))[_0x5cc3('0x1b')](function(_0xa73efe){if(_0xa73efe){_0x46ce53=_0xa73efe[_0x5cc3('0x19')]({'plain':!![]});_0x2c5feb[_0x5cc3('0x2f')]=_[_0x5cc3('0x30')](db[_0x5cc3('0x43')]['rawAttributes']);_0x2c5feb['query']=_['keys'](_0x3e7734[_0x5cc3('0x2a')]);_0x2c5feb['filters']=_[_0x5cc3('0x32')](_0x2c5feb['model'],_0x2c5feb[_0x5cc3('0x2a')]);_0x4e49ff[_0x5cc3('0x34')]=_['intersection'](_0x2c5feb[_0x5cc3('0x2f')],qs['fields'](_0x3e7734[_0x5cc3('0x2a')][_0x5cc3('0x33')]));_0x4e49ff[_0x5cc3('0x34')]=_0x4e49ff[_0x5cc3('0x34')][_0x5cc3('0x44')]?_0x4e49ff['attributes']:_0x2c5feb['model'];if(!_0x3e7734['query'][_0x5cc3('0x45')](_0x5cc3('0x46'))){_0x4e49ff[_0x5cc3('0x14')]=qs[_0x5cc3('0x14')](_0x3e7734['query']['limit']);_0x4e49ff[_0x5cc3('0x11')]=qs[_0x5cc3('0x11')](_0x3e7734[_0x5cc3('0x2a')][_0x5cc3('0x11')]);}_0x4e49ff[_0x5cc3('0x47')]=qs[_0x5cc3('0x48')](_0x3e7734[_0x5cc3('0x2a')]['sort']);_0x4e49ff[_0x5cc3('0x28')]=qs['filters'](_[_0x5cc3('0x49')](_0x3e7734[_0x5cc3('0x2a')],_0x2c5feb[_0x5cc3('0x31')]));_0x4e49ff[_0x5cc3('0x28')]['WhatsappQueueId']=_0xa73efe['id'];if(_0x3e7734[_0x5cc3('0x2a')][_0x5cc3('0x4a')]){_0x4e49ff[_0x5cc3('0x28')]=_[_0x5cc3('0x35')](_0x4e49ff[_0x5cc3('0x28')],{'$or':_[_0x5cc3('0x21')](_0x4e49ff['attributes'],function(_0x281c14){var _0x13704c={};_0x13704c[_0x281c14]={'$like':'%'+_0x3e7734['query'][_0x5cc3('0x4a')]+'%'};return _0x13704c;})});}_0x4e49ff=_[_0x5cc3('0x35')]({},_0x4e49ff,_0x3e7734[_0x5cc3('0x36')]);return db[_0x5cc3('0x43')]['findAll'](_0x4e49ff);}})[_0x5cc3('0x1b')](function(_0x42b49e){if(_0x42b49e){return db[_0x5cc3('0x4b')][_0x5cc3('0x4c')]({'where':{'id':_['map'](_0x42b49e,_0x5cc3('0x4d')),'role':'agent'},'attributes':['id',_0x5cc3('0x1e'),_0x5cc3('0x4e'),_0x5cc3('0x4f'),_0x5cc3('0x50')]});}})['then'](function(_0xdc8466){if(_0xdc8466){return{'count':_0xdc8466[_0x5cc3('0x13')],'rows':_[_0x5cc3('0x21')](_0xdc8466[_0x5cc3('0x2b')],function(_0x22991f){return{'membername':_0x22991f[_0x5cc3('0x1e')],'UserId':_0x22991f['id'],'queue_name':_0x46ce53['name'],'WhatsappQueueId':_0x46ce53['id'],'interface':util[_0x5cc3('0x51')]('%s/%s',_0x5cc3('0x52'),_0x22991f[_0x5cc3('0x1e')]),'penalty':0x0,'paused':_0x22991f[_0x5cc3('0x4e')],'createdAt':_0x22991f[_0x5cc3('0x50')],'updatedAt':_0x22991f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5cc3('0x1b')](respondWithFilteredResult(_0x1353c2,_0x4e49ff))[_0x5cc3('0x2c')](handleError(_0x1353c2,null));};exports[_0x5cc3('0x53')]=function(_0x1395b3,_0x5c9368){var _0x5dcf54={};var _0x5023bb={};var _0x3a4532;var _0x194dbb;return db[_0x5cc3('0x22')][_0x5cc3('0x42')]({'where':{'id':_0x1395b3[_0x5cc3('0x2e')]['id']}})[_0x5cc3('0x1b')](handleEntityNotFound(_0x5c9368,null))[_0x5cc3('0x1b')](function(_0x4b9373){if(_0x4b9373){_0x3a4532=_0x4b9373;_0x5023bb[_0x5cc3('0x2f')]=_[_0x5cc3('0x30')](db[_0x5cc3('0x54')]['rawAttributes']);_0x5023bb[_0x5cc3('0x2a')]=_[_0x5cc3('0x30')](_0x1395b3[_0x5cc3('0x2a')]);_0x5023bb[_0x5cc3('0x31')]=_['intersection'](_0x5023bb['model'],_0x5023bb[_0x5cc3('0x2a')]);_0x5dcf54[_0x5cc3('0x34')]=_['intersection'](_0x5023bb['model'],qs['fields'](_0x1395b3[_0x5cc3('0x2a')][_0x5cc3('0x33')]));_0x5dcf54[_0x5cc3('0x34')]=_0x5dcf54[_0x5cc3('0x34')][_0x5cc3('0x44')]?_0x5dcf54[_0x5cc3('0x34')]:_0x5023bb[_0x5cc3('0x2f')];_0x5dcf54[_0x5cc3('0x47')]=qs['sort'](_0x1395b3[_0x5cc3('0x2a')][_0x5cc3('0x48')]);_0x5dcf54[_0x5cc3('0x28')]=qs[_0x5cc3('0x31')](_['pick'](_0x1395b3[_0x5cc3('0x2a')],_0x5023bb[_0x5cc3('0x31')]));if(_0x1395b3[_0x5cc3('0x2a')]['filter']){_0x5dcf54[_0x5cc3('0x28')]=_['merge'](_0x5dcf54[_0x5cc3('0x28')],{'$or':_[_0x5cc3('0x21')](_0x5dcf54[_0x5cc3('0x34')],function(_0x5198e4){var _0x24b72b={};_0x24b72b[_0x5198e4]={'$like':'%'+_0x1395b3[_0x5cc3('0x2a')][_0x5cc3('0x4a')]+'%'};return _0x24b72b;})});}_0x5dcf54=_[_0x5cc3('0x35')]({},_0x5dcf54,_0x1395b3[_0x5cc3('0x36')]);return _0x3a4532[_0x5cc3('0x53')](_0x5dcf54);}})['then'](function(_0x3ad88b){if(_0x3ad88b){_0x194dbb=_0x3ad88b['length'];if(!_0x1395b3['query'][_0x5cc3('0x45')]('nolimit')){_0x5dcf54[_0x5cc3('0x14')]=qs['limit'](_0x1395b3['query'][_0x5cc3('0x14')]);_0x5dcf54[_0x5cc3('0x11')]=qs[_0x5cc3('0x11')](_0x1395b3[_0x5cc3('0x2a')][_0x5cc3('0x11')]);}return _0x3a4532['getTeams'](_0x5dcf54);}})['then'](function(_0x13ee08){if(_0x13ee08){return _0x13ee08?{'count':_0x194dbb,'rows':_0x13ee08}:null;}})[_0x5cc3('0x1b')](respondWithResult(_0x5c9368,null))[_0x5cc3('0x2c')](handleError(_0x5c9368,null));};exports['addTeams']=function(_0x29be7e,_0x24989b){var _0x2610df=_0x29be7e[_0x5cc3('0x38')][_0x5cc3('0x55')];return db[_0x5cc3('0x54')]['findAll']({'where':{'id':_0x2610df},'attributes':['id'],'include':[{'model':db[_0x5cc3('0x4b')],'as':'Agents','attributes':['id',_0x5cc3('0x1e'),'online',_0x5cc3('0x56'),_0x5cc3('0x57')],'raw':!![]}]})[_0x5cc3('0x1b')](function(_0x4d3907){if(_0x4d3907){var _0x24e530=_[_0x5cc3('0x58')](_0x4d3907,function(_0x2b08cb){var _0xaf2314=_0x2b08cb[_0x5cc3('0x19')]({'plain':!![]});return _0xaf2314[_0x5cc3('0x59')];});return db[_0x5cc3('0x22')][_0x5cc3('0x3c')]({'where':{'id':_0x29be7e[_0x5cc3('0x2e')]['id']}})[_0x5cc3('0x1b')](function(_0x56b787){return db[_0x5cc3('0x5a')][_0x5cc3('0x5b')](function(_0x4de662){return _0x56b787[_0x5cc3('0x5c')](_0x2610df,{'transaction':_0x4de662})[_0x5cc3('0x1b')](function(){return BPromise[_0x5cc3('0x5d')](_0x24e530,function(_0x5e6225){return db[_0x5cc3('0x43')][_0x5cc3('0x5e')]({'where':{'UserId':_0x5e6225['id'],'WhatsappQueueId':_0x29be7e[_0x5cc3('0x2e')]['id']},'transaction':_0x4de662});});})[_0x5cc3('0x1b')](function(){_0x24e530[_0x5cc3('0x5f')](function(_0x175213){socket['emit'](_0x5cc3('0x60'),{'UserId':_0x175213['id'],'WhatsappQueueId':_0x56b787['id']});});});});});}})[_0x5cc3('0x1b')](respondWithStatusCode(_0x24989b,null))['catch'](handleError(_0x24989b,null));};exports[_0x5cc3('0x61')]=function(_0x5d596a,_0x5e364d){return db[_0x5cc3('0x54')]['findAll']({'where':{'id':_0x5d596a[_0x5cc3('0x2a')][_0x5cc3('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5cc3('0x59'),'attributes':['id'],'raw':!![]}]})[_0x5cc3('0x1b')](handleEntityNotFound(_0x5e364d,null))[_0x5cc3('0x1b')](function(_0x2f1444){var _0x2f8035=_['map'](_0x2f1444,'id');var _0x505524=[];var _0x2dc621=[];var _0x1a1f23=squel[_0x5cc3('0x62')]();_0x1a1f23[_0x5cc3('0x63')](_0x5cc3('0x64'))[_0x5cc3('0x65')](_0x5cc3('0x66'),'tq')[_0x5cc3('0x67')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x5cc3('0x28')](_0x5cc3('0x68'),_0x5d596a[_0x5cc3('0x2e')]['id']);for(var _0x30dd20=0x0;_0x30dd20<_0x2f1444[_0x5cc3('0x44')];_0x30dd20+=0x1){let _0x3c9e65=_0x2f1444[_0x30dd20];for(var _0x3010bb=0x0;_0x3010bb<_0x3c9e65[_0x5cc3('0x59')][_0x5cc3('0x44')];_0x3010bb+=0x1){let _0xcbba0d=_0x3c9e65['Agents'][_0x3010bb];var _0x53e84c=_0x1a1f23[_0x5cc3('0x69')]();_0x53e84c[_0x5cc3('0x28')](_0x5cc3('0x6a'),_0xcbba0d['id']);_0x2dc621[_0x5cc3('0x6b')](db[_0x5cc3('0x5a')][_0x5cc3('0x2a')](_0x53e84c['toString'](),{'type':db['sequelize'][_0x5cc3('0x6c')][_0x5cc3('0x6d')]})['then'](function(_0x554b5a){if(_0x554b5a['length']===0x1){return _0xcbba0d['id'];}else{var _0xa13c92=_[_0x5cc3('0x6e')](_[_0x5cc3('0x21')](_0x554b5a,_0x5cc3('0x6f')),function(_0x3e59db){return _[_0x5cc3('0x70')](_0x2f8035,_0x3e59db);});if(_0xa13c92){return _0xcbba0d['id'];}}}));}}return BPromise[_0x5cc3('0x71')](_0x2dc621)['then'](function(_0x250038){_0x505524=_(_0x505524)[_0x5cc3('0x72')](_0x250038)['compact']()[_0x5cc3('0x73')]();return db[_0x5cc3('0x22')][_0x5cc3('0x3c')]({'where':{'id':_0x5d596a['params']['id']}})[_0x5cc3('0x1b')](function(_0x1586b6){return db[_0x5cc3('0x5a')][_0x5cc3('0x5b')](function(_0xfd43c1){return _0x1586b6[_0x5cc3('0x61')](_0x5d596a[_0x5cc3('0x2a')][_0x5cc3('0x55')],{'transaction':_0xfd43c1})['then'](function(){if(!_[_0x5cc3('0x74')](_0x505524)){return _0x1586b6['removeAgents'](_0x505524,{'transaction':_0xfd43c1});}})['then'](function(){_0x505524[_0x5cc3('0x5f')](function(_0x4be25b){socket[_0x5cc3('0x75')](_0x5cc3('0x76'),{'UserId':_0x4be25b,'WhatsappQueueId':_0x1586b6['id']});});});});});});})[_0x5cc3('0x1b')](respondWithStatusCode(_0x5e364d,null))[_0x5cc3('0x2c')](handleError(_0x5e364d,null));};exports['addAgents']=function(_0x35c09c,_0x75df83){return db[_0x5cc3('0x22')][_0x5cc3('0x3c')]({'where':{'id':_0x35c09c[_0x5cc3('0x2e')]['id']}})['then'](handleEntityNotFound(_0x75df83,null))['then'](function(_0x3ca4a8){if(_0x3ca4a8){return _0x3ca4a8[_0x5cc3('0x77')](_0x35c09c['body']['ids'],_[_0x5cc3('0x78')](_0x35c09c[_0x5cc3('0x38')],[_0x5cc3('0x55'),'id'])||{})[_0x5cc3('0x79')](function(_0x31dc86){for(var _0x2447de=0x0;_0x2447de<_0x35c09c['body'][_0x5cc3('0x55')][_0x5cc3('0x44')];_0x2447de+=0x1){socket[_0x5cc3('0x75')]('userWhatsappQueue:save',{'UserId':Number(_0x35c09c[_0x5cc3('0x38')][_0x5cc3('0x55')][_0x2447de]),'WhatsappQueueId':Number(_0x35c09c[_0x5cc3('0x2e')]['id'])});}return _0x31dc86;});}})[_0x5cc3('0x1b')](respondWithResult(_0x75df83,null))[_0x5cc3('0x2c')](handleError(_0x75df83,null));};exports[_0x5cc3('0x7a')]=function(_0x727c17,_0x3144d4){return db[_0x5cc3('0x22')][_0x5cc3('0x3c')]({'where':{'id':_0x727c17[_0x5cc3('0x2e')]['id']}})[_0x5cc3('0x1b')](handleEntityNotFound(_0x3144d4,null))[_0x5cc3('0x1b')](function(_0x435fb1){if(_0x435fb1){return _0x435fb1['removeAgents'](_0x727c17[_0x5cc3('0x2a')][_0x5cc3('0x55')])[_0x5cc3('0x1b')](function(){if(_['isArray'](_0x727c17[_0x5cc3('0x2a')][_0x5cc3('0x55')])){for(var _0xf3e691=0x0;_0xf3e691<_0x727c17[_0x5cc3('0x2a')][_0x5cc3('0x55')][_0x5cc3('0x44')];_0xf3e691+=0x1){socket['emit'](_0x5cc3('0x76'),{'UserId':Number(_0x727c17[_0x5cc3('0x2a')][_0x5cc3('0x55')][_0xf3e691]),'WhatsappQueueId':Number(_0x727c17[_0x5cc3('0x2e')]['id'])});}}else{socket[_0x5cc3('0x75')](_0x5cc3('0x76'),{'UserId':Number(_0x727c17[_0x5cc3('0x2a')]['ids']),'WhatsappQueueId':Number(_0x727c17['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3144d4,null))[_0x5cc3('0x2c')](handleError(_0x3144d4,null));};exports[_0x5cc3('0x7b')]=function(_0x17479a,_0x16c661){var _0x466034={};var _0x4d15a6={};var _0x47841d;var _0x15306e;return db[_0x5cc3('0x22')][_0x5cc3('0x42')]({'where':{'id':_0x17479a[_0x5cc3('0x2e')]['id']}})[_0x5cc3('0x1b')](handleEntityNotFound(_0x16c661,null))[_0x5cc3('0x1b')](function(_0x2a2004){if(_0x2a2004){_0x47841d=_0x2a2004;_0x4d15a6[_0x5cc3('0x2f')]=_['keys'](db['User'][_0x5cc3('0x23')]);_0x4d15a6[_0x5cc3('0x2a')]=_['keys'](_0x17479a[_0x5cc3('0x2a')]);_0x4d15a6[_0x5cc3('0x31')]=_[_0x5cc3('0x32')](_0x4d15a6[_0x5cc3('0x2f')],_0x4d15a6[_0x5cc3('0x2a')]);_0x466034['attributes']=_[_0x5cc3('0x32')](_0x4d15a6[_0x5cc3('0x2f')],qs[_0x5cc3('0x33')](_0x17479a[_0x5cc3('0x2a')][_0x5cc3('0x33')]));_0x466034[_0x5cc3('0x34')]=_0x466034[_0x5cc3('0x34')]['length']?_0x466034['attributes']:_0x4d15a6[_0x5cc3('0x2f')];_0x466034[_0x5cc3('0x47')]=qs[_0x5cc3('0x48')](_0x17479a[_0x5cc3('0x2a')][_0x5cc3('0x48')]);_0x466034[_0x5cc3('0x28')]=qs[_0x5cc3('0x31')](_[_0x5cc3('0x49')](_0x17479a[_0x5cc3('0x2a')],_0x4d15a6[_0x5cc3('0x31')]));if(_0x17479a[_0x5cc3('0x2a')][_0x5cc3('0x4a')]){_0x466034['where']=_[_0x5cc3('0x35')](_0x466034[_0x5cc3('0x28')],{'$or':_['map'](_0x466034[_0x5cc3('0x34')],function(_0x42b618){var _0x34811b={};_0x34811b[_0x42b618]={'$like':'%'+_0x17479a[_0x5cc3('0x2a')]['filter']+'%'};return _0x34811b;})});}_0x466034=_[_0x5cc3('0x35')]({},_0x466034,_0x17479a['options']);return _0x47841d[_0x5cc3('0x7b')](_0x466034);}})[_0x5cc3('0x1b')](function(_0x3ba055){if(_0x3ba055){_0x15306e=_0x3ba055['length'];if(!_0x17479a[_0x5cc3('0x2a')][_0x5cc3('0x45')](_0x5cc3('0x46'))){_0x466034[_0x5cc3('0x14')]=qs[_0x5cc3('0x14')](_0x17479a[_0x5cc3('0x2a')][_0x5cc3('0x14')]);_0x466034['offset']=qs[_0x5cc3('0x11')](_0x17479a[_0x5cc3('0x2a')]['offset']);}return _0x47841d[_0x5cc3('0x7b')](_0x466034);}})[_0x5cc3('0x1b')](function(_0x555cea){if(_0x555cea){return _0x555cea?{'count':_0x15306e,'rows':_0x555cea}:null;}})[_0x5cc3('0x1b')](respondWithResult(_0x16c661,null))[_0x5cc3('0x2c')](handleError(_0x16c661,null));}; \ No newline at end of file +var _0x8571=['../../config/logger','api','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','update','destroy','then','get','WhatsappQueues','UserProfileResource','end','error','stack','name','send','index','map','type','key','getOptions','where','WhatsappQueue','include','rows','catch','show','params','model','keys','rawAttributes','intersection','query','attributes','fields','length','includeAll','merge','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','filters','hasOwnProperty','sort','pick','WhatsappQueueId','filter','findAll','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','nolimit','addTeams','ids','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','userWhatsappQueue:save','isArray','getAgents','bluebird','lodash','squel','../../components/parsers/qs'];(function(_0x415093,_0x51ef7f){var _0x2857a5=function(_0x5ce372){while(--_0x5ce372){_0x415093['push'](_0x415093['shift']());}};_0x2857a5(++_0x51ef7f);}(_0x8571,0x1e8));var _0x1857=function(_0x23ab06,_0x4b9354){_0x23ab06=_0x23ab06-0x0;var _0x5b6c74=_0x8571[_0x23ab06];return _0x5b6c74;};'use strict';var BPromise=require(_0x1857('0x0'));var util=require('util');var _=require(_0x1857('0x1'));var squel=require(_0x1857('0x2'));var Redis=require('ioredis');var qs=require(_0x1857('0x3'));var logger=require(_0x1857('0x4'))(_0x1857('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x1857('0x6')]=_['defaults'](config[_0x1857('0x6')],{'host':_0x1857('0x7'),'port':0x18eb});var socket=require(_0x1857('0x8'))(new Redis(config[_0x1857('0x6')]));require(_0x1857('0x9'))['register'](socket);function respondWithStatusCode(_0x44dd2d,_0x288da0){_0x288da0=_0x288da0||0xcc;return function(_0x108d82){if(_0x108d82){return _0x44dd2d[_0x1857('0xa')](_0x288da0);}return _0x44dd2d[_0x1857('0xb')](_0x288da0)['end']();};}function respondWithResult(_0x627e3a,_0x22331a){_0x22331a=_0x22331a||0xc8;return function(_0x39d51e){if(_0x39d51e){return _0x627e3a['status'](_0x22331a)[_0x1857('0xc')](_0x39d51e);}};}function respondWithFilteredResult(_0x3d04b6,_0x35748a){return function(_0x54bbf5){if(_0x54bbf5){var _0x169af4=typeof _0x35748a['offset']==='undefined'&&typeof _0x35748a[_0x1857('0xd')]===_0x1857('0xe');var _0x486205=_0x54bbf5['count'];var _0xcbbc5d=_0x169af4?0x0:_0x35748a[_0x1857('0xf')];var _0xe71970=_0x169af4?_0x54bbf5[_0x1857('0x10')]:_0x35748a[_0x1857('0xf')]+_0x35748a[_0x1857('0xd')];var _0x5d5123;if(_0xe71970>=_0x486205){_0xe71970=_0x486205;_0x5d5123=0xc8;}else{_0x5d5123=0xce;}_0x3d04b6[_0x1857('0xb')](_0x5d5123);return _0x3d04b6[_0x1857('0x11')](_0x1857('0x12'),_0xcbbc5d+'-'+_0xe71970+'/'+_0x486205)['json'](_0x54bbf5);}return null;};}function saveUpdates(_0xf1e778){return function(_0x555f7f){if(_0x555f7f){return _0x555f7f[_0x1857('0x13')](_0xf1e778)['then'](function(_0x14d50d){return _0x14d50d;});}return null;};}function removeEntity(_0xfec58a){return function(_0x2a56bd){if(_0x2a56bd){return _0x2a56bd[_0x1857('0x14')]()[_0x1857('0x15')](function(){var _0x7952c5=_0x2a56bd[_0x1857('0x16')]({'plain':!![]});var _0x4af836=_0x1857('0x17');return db[_0x1857('0x18')][_0x1857('0x14')]({'where':{'type':_0x4af836,'resourceId':_0x7952c5['id']}})[_0x1857('0x15')](function(){return _0x2a56bd;});})[_0x1857('0x15')](function(){_0xfec58a[_0x1857('0xb')](0xcc)[_0x1857('0x19')]();});}};}function handleEntityNotFound(_0x189c86){return function(_0x2ff933){if(!_0x2ff933){_0x189c86[_0x1857('0xa')](0x194);}return _0x2ff933;};}function handleError(_0x40a2dc,_0x421f78){_0x421f78=_0x421f78||0x1f4;return function(_0x57e769){logger[_0x1857('0x1a')](_0x57e769[_0x1857('0x1b')]);if(_0x57e769[_0x1857('0x1c')]){delete _0x57e769[_0x1857('0x1c')];}_0x40a2dc[_0x1857('0xb')](_0x421f78)[_0x1857('0x1d')](_0x57e769);};}exports[_0x1857('0x1e')]=function(_0x12115d,_0x40bd28){var _0x5f2010={};var _0x233f60={'count':0x0,'rows':[]};var _0x375cca=_[_0x1857('0x1f')](db['WhatsappQueue']['rawAttributes'],function(_0x54ac4e){return{'name':_0x54ac4e['fieldName'],'type':_0x54ac4e[_0x1857('0x20')][_0x1857('0x21')]};});_0x5f2010=qs[_0x1857('0x22')](_0x375cca,_0x12115d);var _0xc2e6dc={'where':_0x5f2010[_0x1857('0x23')]};return db[_0x1857('0x24')][_0x1857('0x10')](_0xc2e6dc)['then'](function(_0x42e31e){_0x233f60[_0x1857('0x10')]=_0x42e31e;_0x5f2010[_0x1857('0x25')]=qs[_0x1857('0x25')](_0x12115d['query']);return db[_0x1857('0x24')]['findAll'](_0x5f2010);})[_0x1857('0x15')](function(_0x1658a5){_0x233f60[_0x1857('0x26')]=_0x1658a5;return _0x233f60;})['then'](respondWithFilteredResult(_0x40bd28,_0x5f2010))[_0x1857('0x27')](handleError(_0x40bd28,null));};exports[_0x1857('0x28')]=function(_0xfacb93,_0x4f8130){var _0x4080e7={'raw':!![],'where':{'id':_0xfacb93[_0x1857('0x29')]['id']}},_0x15f5f4={};_0x15f5f4[_0x1857('0x2a')]=_[_0x1857('0x2b')](db['WhatsappQueue'][_0x1857('0x2c')]);_0x15f5f4['query']=_[_0x1857('0x2b')](_0xfacb93['query']);_0x15f5f4['filters']=_[_0x1857('0x2d')](_0x15f5f4[_0x1857('0x2a')],_0x15f5f4[_0x1857('0x2e')]);_0x4080e7[_0x1857('0x2f')]=_[_0x1857('0x2d')](_0x15f5f4['model'],qs['fields'](_0xfacb93['query'][_0x1857('0x30')]));_0x4080e7[_0x1857('0x2f')]=_0x4080e7['attributes'][_0x1857('0x31')]?_0x4080e7[_0x1857('0x2f')]:_0x15f5f4[_0x1857('0x2a')];if(_0xfacb93[_0x1857('0x2e')][_0x1857('0x32')]){_0x4080e7[_0x1857('0x25')]=[{'all':!![]}];}_0x4080e7=_[_0x1857('0x33')]({},_0x4080e7,_0xfacb93[_0x1857('0x34')]);return db['WhatsappQueue'][_0x1857('0x35')](_0x4080e7)[_0x1857('0x15')](handleEntityNotFound(_0x4f8130,null))['then'](respondWithResult(_0x4f8130,null))['catch'](handleError(_0x4f8130,null));};exports['create']=function(_0x1f3b7a,_0x580353){return db[_0x1857('0x24')]['create'](_0x1f3b7a[_0x1857('0x36')],{})[_0x1857('0x15')](function(_0x2fc8e3){var _0x57f346=_0x1f3b7a[_0x1857('0x37')][_0x1857('0x16')]({'plain':!![]});if(!_0x57f346)throw new Error(_0x1857('0x38'));if(_0x57f346[_0x1857('0x39')]===_0x1857('0x37')){var _0x58b6c5=_0x2fc8e3[_0x1857('0x16')]({'plain':!![]});var _0x1e75b5=_0x1857('0x17');return db[_0x1857('0x3a')]['find']({'where':{'name':_0x1e75b5,'userProfileId':_0x57f346[_0x1857('0x3b')]},'raw':!![]})[_0x1857('0x15')](function(_0x122c99){if(_0x122c99&&_0x122c99[_0x1857('0x3c')]===0x0){return db[_0x1857('0x18')][_0x1857('0x3d')]({'name':_0x58b6c5[_0x1857('0x1c')],'resourceId':_0x58b6c5['id'],'type':_0x122c99['name'],'sectionId':_0x122c99['id']},{})[_0x1857('0x15')](function(){return _0x2fc8e3;});}else{return _0x2fc8e3;}})[_0x1857('0x27')](function(_0x1b079c){logger[_0x1857('0x1a')](_0x1857('0x3e'),_0x1b079c);throw _0x1b079c;});}return _0x2fc8e3;})[_0x1857('0x15')](respondWithResult(_0x580353,0xc9))[_0x1857('0x27')](handleError(_0x580353,null));};exports[_0x1857('0x13')]=function(_0x2695d3,_0x2ba64c){if(_0x2695d3[_0x1857('0x36')]['id']){delete _0x2695d3['body']['id'];}return db[_0x1857('0x24')]['find']({'where':{'id':_0x2695d3[_0x1857('0x29')]['id']}})[_0x1857('0x15')](handleEntityNotFound(_0x2ba64c,null))[_0x1857('0x15')](saveUpdates(_0x2695d3[_0x1857('0x36')],null))[_0x1857('0x15')](respondWithResult(_0x2ba64c,null))[_0x1857('0x27')](handleError(_0x2ba64c,null));};exports[_0x1857('0x14')]=function(_0x48b884,_0x16695d){return db['WhatsappQueue'][_0x1857('0x35')]({'where':{'id':_0x48b884[_0x1857('0x29')]['id']}})[_0x1857('0x15')](handleEntityNotFound(_0x16695d,null))['then'](removeEntity(_0x16695d,null))[_0x1857('0x27')](handleError(_0x16695d,null));};exports['describe']=function(_0x596fad,_0x25edf9){return db[_0x1857('0x24')][_0x1857('0x3f')]()[_0x1857('0x15')](respondWithResult(_0x25edf9,null))[_0x1857('0x27')](handleError(_0x25edf9,null));};exports['getMembers']=function(_0x263022,_0xf7e33){var _0x355d87={'raw':!![],'where':{}},_0x65bccc={},_0x4a7fcc;return db[_0x1857('0x24')][_0x1857('0x40')]({'where':{'id':_0x263022[_0x1857('0x29')]['id']}})[_0x1857('0x15')](handleEntityNotFound(_0xf7e33,null))[_0x1857('0x15')](function(_0x177265){if(_0x177265){_0x4a7fcc=_0x177265[_0x1857('0x16')]({'plain':!![]});_0x65bccc[_0x1857('0x2a')]=_[_0x1857('0x2b')](db['UserWhatsappQueue'][_0x1857('0x2c')]);_0x65bccc[_0x1857('0x2e')]=_['keys'](_0x263022[_0x1857('0x2e')]);_0x65bccc[_0x1857('0x41')]=_[_0x1857('0x2d')](_0x65bccc['model'],_0x65bccc[_0x1857('0x2e')]);_0x355d87[_0x1857('0x2f')]=_[_0x1857('0x2d')](_0x65bccc[_0x1857('0x2a')],qs[_0x1857('0x30')](_0x263022[_0x1857('0x2e')][_0x1857('0x30')]));_0x355d87[_0x1857('0x2f')]=_0x355d87[_0x1857('0x2f')]['length']?_0x355d87[_0x1857('0x2f')]:_0x65bccc[_0x1857('0x2a')];if(!_0x263022['query'][_0x1857('0x42')]('nolimit')){_0x355d87[_0x1857('0xd')]=qs[_0x1857('0xd')](_0x263022['query'][_0x1857('0xd')]);_0x355d87['offset']=qs[_0x1857('0xf')](_0x263022[_0x1857('0x2e')]['offset']);}_0x355d87['order']=qs['sort'](_0x263022[_0x1857('0x2e')][_0x1857('0x43')]);_0x355d87['where']=qs['filters'](_[_0x1857('0x44')](_0x263022[_0x1857('0x2e')],_0x65bccc['filters']));_0x355d87[_0x1857('0x23')][_0x1857('0x45')]=_0x177265['id'];if(_0x263022[_0x1857('0x2e')][_0x1857('0x46')]){_0x355d87[_0x1857('0x23')]=_['merge'](_0x355d87[_0x1857('0x23')],{'$or':_['map'](_0x355d87[_0x1857('0x2f')],function(_0x1fead7){var _0x142da9={};_0x142da9[_0x1fead7]={'$like':'%'+_0x263022[_0x1857('0x2e')][_0x1857('0x46')]+'%'};return _0x142da9;})});}_0x355d87=_[_0x1857('0x33')]({},_0x355d87,_0x263022[_0x1857('0x34')]);return db['UserWhatsappQueue'][_0x1857('0x47')](_0x355d87);}})[_0x1857('0x15')](function(_0xe66fe5){if(_0xe66fe5){return db[_0x1857('0x48')][_0x1857('0x49')]({'where':{'id':_[_0x1857('0x1f')](_0xe66fe5,'UserId'),'role':_0x1857('0x4a')},'attributes':['id',_0x1857('0x1c'),_0x1857('0x4b'),_0x1857('0x4c'),_0x1857('0x4d')]});}})[_0x1857('0x15')](function(_0x4b26d5){if(_0x4b26d5){return{'count':_0x4b26d5[_0x1857('0x10')],'rows':_[_0x1857('0x1f')](_0x4b26d5['rows'],function(_0x30e3a0){return{'membername':_0x30e3a0[_0x1857('0x1c')],'UserId':_0x30e3a0['id'],'queue_name':_0x4a7fcc[_0x1857('0x1c')],'WhatsappQueueId':_0x4a7fcc['id'],'interface':util[_0x1857('0x4e')](_0x1857('0x4f'),_0x1857('0x50'),_0x30e3a0[_0x1857('0x1c')]),'penalty':0x0,'paused':_0x30e3a0[_0x1857('0x4b')],'createdAt':_0x30e3a0[_0x1857('0x4d')],'updatedAt':_0x30e3a0[_0x1857('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1857('0x15')](respondWithFilteredResult(_0xf7e33,_0x355d87))[_0x1857('0x27')](handleError(_0xf7e33,null));};exports[_0x1857('0x51')]=function(_0x5f23e6,_0x3ea124){var _0x51036e={};var _0x265030={};var _0x12e39b;var _0x307421;return db[_0x1857('0x24')][_0x1857('0x40')]({'where':{'id':_0x5f23e6[_0x1857('0x29')]['id']}})[_0x1857('0x15')](handleEntityNotFound(_0x3ea124,null))[_0x1857('0x15')](function(_0xee3cc2){if(_0xee3cc2){_0x12e39b=_0xee3cc2;_0x265030['model']=_['keys'](db[_0x1857('0x52')][_0x1857('0x2c')]);_0x265030[_0x1857('0x2e')]=_['keys'](_0x5f23e6[_0x1857('0x2e')]);_0x265030[_0x1857('0x41')]=_[_0x1857('0x2d')](_0x265030['model'],_0x265030['query']);_0x51036e[_0x1857('0x2f')]=_[_0x1857('0x2d')](_0x265030[_0x1857('0x2a')],qs['fields'](_0x5f23e6['query'][_0x1857('0x30')]));_0x51036e[_0x1857('0x2f')]=_0x51036e[_0x1857('0x2f')]['length']?_0x51036e[_0x1857('0x2f')]:_0x265030['model'];_0x51036e[_0x1857('0x53')]=qs[_0x1857('0x43')](_0x5f23e6[_0x1857('0x2e')][_0x1857('0x43')]);_0x51036e[_0x1857('0x23')]=qs[_0x1857('0x41')](_['pick'](_0x5f23e6[_0x1857('0x2e')],_0x265030[_0x1857('0x41')]));if(_0x5f23e6[_0x1857('0x2e')][_0x1857('0x46')]){_0x51036e[_0x1857('0x23')]=_[_0x1857('0x33')](_0x51036e[_0x1857('0x23')],{'$or':_['map'](_0x51036e[_0x1857('0x2f')],function(_0x1dc990){var _0x49db03={};_0x49db03[_0x1dc990]={'$like':'%'+_0x5f23e6[_0x1857('0x2e')]['filter']+'%'};return _0x49db03;})});}_0x51036e=_[_0x1857('0x33')]({},_0x51036e,_0x5f23e6[_0x1857('0x34')]);return _0x12e39b[_0x1857('0x51')](_0x51036e);}})[_0x1857('0x15')](function(_0x43df9b){if(_0x43df9b){_0x307421=_0x43df9b['length'];if(!_0x5f23e6[_0x1857('0x2e')][_0x1857('0x42')](_0x1857('0x54'))){_0x51036e[_0x1857('0xd')]=qs[_0x1857('0xd')](_0x5f23e6[_0x1857('0x2e')][_0x1857('0xd')]);_0x51036e['offset']=qs[_0x1857('0xf')](_0x5f23e6[_0x1857('0x2e')][_0x1857('0xf')]);}return _0x12e39b[_0x1857('0x51')](_0x51036e);}})['then'](function(_0x108ddd){if(_0x108ddd){return _0x108ddd?{'count':_0x307421,'rows':_0x108ddd}:null;}})[_0x1857('0x15')](respondWithResult(_0x3ea124,null))['catch'](handleError(_0x3ea124,null));};exports[_0x1857('0x55')]=function(_0x22b488,_0x3bd08f){var _0x2a5044=_0x22b488[_0x1857('0x36')][_0x1857('0x56')];return db['Team'][_0x1857('0x47')]({'where':{'id':_0x2a5044},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1857('0x57'),'attributes':['id','name',_0x1857('0x58'),_0x1857('0x59'),'interface'],'raw':!![]}]})[_0x1857('0x15')](function(_0x46397d){if(_0x46397d){var _0x45e24a=_[_0x1857('0x5a')](_0x46397d,function(_0x4508df){var _0x2c6641=_0x4508df[_0x1857('0x16')]({'plain':!![]});return _0x2c6641[_0x1857('0x57')];});return db[_0x1857('0x24')][_0x1857('0x35')]({'where':{'id':_0x22b488[_0x1857('0x29')]['id']}})[_0x1857('0x15')](function(_0x4e3bf9){return db['sequelize'][_0x1857('0x5b')](function(_0x4e05d5){return _0x4e3bf9['addTeams'](_0x2a5044,{'transaction':_0x4e05d5})[_0x1857('0x15')](function(){return BPromise[_0x1857('0x5c')](_0x45e24a,function(_0x8b03c5){return db['UserWhatsappQueue'][_0x1857('0x5d')]({'where':{'UserId':_0x8b03c5['id'],'WhatsappQueueId':_0x22b488[_0x1857('0x29')]['id']},'transaction':_0x4e05d5});});})[_0x1857('0x15')](function(){_0x45e24a[_0x1857('0x5e')](function(_0x4d035a){socket[_0x1857('0x5f')]('userWhatsappQueue:save',{'UserId':_0x4d035a['id'],'WhatsappQueueId':_0x4e3bf9['id']});});});});});}})['then'](respondWithStatusCode(_0x3bd08f,null))[_0x1857('0x27')](handleError(_0x3bd08f,null));};exports[_0x1857('0x60')]=function(_0x4cef53,_0x135c7b){return db[_0x1857('0x52')][_0x1857('0x47')]({'where':{'id':_0x4cef53[_0x1857('0x2e')][_0x1857('0x56')]},'attributes':['id'],'include':[{'model':db[_0x1857('0x48')],'as':_0x1857('0x57'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x135c7b,null))[_0x1857('0x15')](function(_0x4cab5a){var _0x19afff=_['map'](_0x4cab5a,'id');var _0x7a541b=[];var _0x3ddb55=[];var _0x5935ae=squel[_0x1857('0x61')]();_0x5935ae[_0x1857('0x62')]('tq.TeamId')['from'](_0x1857('0x63'),'tq')[_0x1857('0x64')]('user_has_teams','ut',_0x1857('0x65'))['where'](_0x1857('0x66'),_0x4cef53['params']['id']);for(var _0x539ca0=0x0;_0x539ca0<_0x4cab5a[_0x1857('0x31')];_0x539ca0+=0x1){let _0x2705ed=_0x4cab5a[_0x539ca0];for(var _0x2a35d4=0x0;_0x2a35d4<_0x2705ed['Agents'][_0x1857('0x31')];_0x2a35d4+=0x1){let _0x47c514=_0x2705ed[_0x1857('0x57')][_0x2a35d4];var _0x254a95=_0x5935ae[_0x1857('0x67')]();_0x254a95[_0x1857('0x23')](_0x1857('0x68'),_0x47c514['id']);_0x3ddb55['push'](db[_0x1857('0x69')]['query'](_0x254a95[_0x1857('0x6a')](),{'type':db['sequelize'][_0x1857('0x6b')][_0x1857('0x6c')]})[_0x1857('0x15')](function(_0x24fb6e){if(_0x24fb6e[_0x1857('0x31')]===0x1){return _0x47c514['id'];}else{var _0x57406b=_[_0x1857('0x6d')](_[_0x1857('0x1f')](_0x24fb6e,'TeamId'),function(_0x934ab){return _[_0x1857('0x6e')](_0x19afff,_0x934ab);});if(_0x57406b){return _0x47c514['id'];}}}));}}return BPromise[_0x1857('0x6f')](_0x3ddb55)[_0x1857('0x15')](function(_0x24d3e8){_0x7a541b=_(_0x7a541b)[_0x1857('0x70')](_0x24d3e8)[_0x1857('0x71')]()[_0x1857('0x72')]();return db[_0x1857('0x24')][_0x1857('0x35')]({'where':{'id':_0x4cef53[_0x1857('0x29')]['id']}})[_0x1857('0x15')](function(_0x27bbc9){return db[_0x1857('0x69')][_0x1857('0x5b')](function(_0x571d3e){return _0x27bbc9['removeTeams'](_0x4cef53[_0x1857('0x2e')][_0x1857('0x56')],{'transaction':_0x571d3e})[_0x1857('0x15')](function(){if(!_[_0x1857('0x73')](_0x7a541b)){return _0x27bbc9[_0x1857('0x74')](_0x7a541b,{'transaction':_0x571d3e});}})[_0x1857('0x15')](function(){_0x7a541b[_0x1857('0x5e')](function(_0x4fd53f){socket[_0x1857('0x5f')](_0x1857('0x75'),{'UserId':_0x4fd53f,'WhatsappQueueId':_0x27bbc9['id']});});});});});});})['then'](respondWithStatusCode(_0x135c7b,null))['catch'](handleError(_0x135c7b,null));};exports[_0x1857('0x76')]=function(_0x20240e,_0x5b9b00){return db[_0x1857('0x24')][_0x1857('0x35')]({'where':{'id':_0x20240e[_0x1857('0x29')]['id']}})[_0x1857('0x15')](handleEntityNotFound(_0x5b9b00,null))['then'](function(_0x3c0caf){if(_0x3c0caf){return _0x3c0caf[_0x1857('0x76')](_0x20240e['body'][_0x1857('0x56')],_[_0x1857('0x77')](_0x20240e[_0x1857('0x36')],[_0x1857('0x56'),'id'])||{})['spread'](function(_0x1a062f){for(var _0xa2b139=0x0;_0xa2b139<_0x20240e[_0x1857('0x36')][_0x1857('0x56')][_0x1857('0x31')];_0xa2b139+=0x1){socket[_0x1857('0x5f')](_0x1857('0x78'),{'UserId':Number(_0x20240e[_0x1857('0x36')][_0x1857('0x56')][_0xa2b139]),'WhatsappQueueId':Number(_0x20240e['params']['id'])});}return _0x1a062f;});}})[_0x1857('0x15')](respondWithResult(_0x5b9b00,null))['catch'](handleError(_0x5b9b00,null));};exports[_0x1857('0x74')]=function(_0xb69888,_0x3d5cd4){return db[_0x1857('0x24')][_0x1857('0x35')]({'where':{'id':_0xb69888['params']['id']}})[_0x1857('0x15')](handleEntityNotFound(_0x3d5cd4,null))[_0x1857('0x15')](function(_0x3e30da){if(_0x3e30da){return _0x3e30da['removeAgents'](_0xb69888[_0x1857('0x2e')][_0x1857('0x56')])[_0x1857('0x15')](function(){if(_[_0x1857('0x79')](_0xb69888['query'][_0x1857('0x56')])){for(var _0x442bc7=0x0;_0x442bc7<_0xb69888[_0x1857('0x2e')][_0x1857('0x56')]['length'];_0x442bc7+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0xb69888[_0x1857('0x2e')][_0x1857('0x56')][_0x442bc7]),'WhatsappQueueId':Number(_0xb69888[_0x1857('0x29')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0xb69888['query']['ids']),'WhatsappQueueId':Number(_0xb69888['params']['id'])});}});}})[_0x1857('0x15')](respondWithStatusCode(_0x3d5cd4,null))[_0x1857('0x27')](handleError(_0x3d5cd4,null));};exports['getAgents']=function(_0xc8a3e7,_0x4b93dd){var _0xa18035={};var _0x4de7a7={};var _0x109d27;var _0x49c848;return db[_0x1857('0x24')]['findOne']({'where':{'id':_0xc8a3e7[_0x1857('0x29')]['id']}})[_0x1857('0x15')](handleEntityNotFound(_0x4b93dd,null))[_0x1857('0x15')](function(_0xd503e3){if(_0xd503e3){_0x109d27=_0xd503e3;_0x4de7a7[_0x1857('0x2a')]=_[_0x1857('0x2b')](db[_0x1857('0x48')][_0x1857('0x2c')]);_0x4de7a7[_0x1857('0x2e')]=_[_0x1857('0x2b')](_0xc8a3e7[_0x1857('0x2e')]);_0x4de7a7['filters']=_[_0x1857('0x2d')](_0x4de7a7[_0x1857('0x2a')],_0x4de7a7[_0x1857('0x2e')]);_0xa18035[_0x1857('0x2f')]=_[_0x1857('0x2d')](_0x4de7a7[_0x1857('0x2a')],qs[_0x1857('0x30')](_0xc8a3e7['query']['fields']));_0xa18035['attributes']=_0xa18035[_0x1857('0x2f')][_0x1857('0x31')]?_0xa18035[_0x1857('0x2f')]:_0x4de7a7[_0x1857('0x2a')];_0xa18035[_0x1857('0x53')]=qs[_0x1857('0x43')](_0xc8a3e7['query'][_0x1857('0x43')]);_0xa18035['where']=qs[_0x1857('0x41')](_[_0x1857('0x44')](_0xc8a3e7[_0x1857('0x2e')],_0x4de7a7[_0x1857('0x41')]));if(_0xc8a3e7[_0x1857('0x2e')]['filter']){_0xa18035['where']=_[_0x1857('0x33')](_0xa18035[_0x1857('0x23')],{'$or':_[_0x1857('0x1f')](_0xa18035[_0x1857('0x2f')],function(_0x9da7a9){var _0x41e2be={};_0x41e2be[_0x9da7a9]={'$like':'%'+_0xc8a3e7[_0x1857('0x2e')][_0x1857('0x46')]+'%'};return _0x41e2be;})});}_0xa18035=_[_0x1857('0x33')]({},_0xa18035,_0xc8a3e7['options']);return _0x109d27[_0x1857('0x7a')](_0xa18035);}})[_0x1857('0x15')](function(_0x5d2a31){if(_0x5d2a31){_0x49c848=_0x5d2a31[_0x1857('0x31')];if(!_0xc8a3e7['query'][_0x1857('0x42')](_0x1857('0x54'))){_0xa18035[_0x1857('0xd')]=qs[_0x1857('0xd')](_0xc8a3e7['query'][_0x1857('0xd')]);_0xa18035['offset']=qs[_0x1857('0xf')](_0xc8a3e7[_0x1857('0x2e')][_0x1857('0xf')]);}return _0x109d27[_0x1857('0x7a')](_0xa18035);}})['then'](function(_0x2114fe){if(_0x2114fe){return _0x2114fe?{'count':_0x49c848,'rows':_0x2114fe}:null;}})[_0x1857('0x15')](respondWithResult(_0x4b93dd,null))[_0x1857('0x27')](handleError(_0x4b93dd,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 0feb7a5..ac8a8cc 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 _0xa357=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa357,0x1cd));var _0x7a35=function(_0xab9f3d,_0xb336fa){_0xab9f3d=_0xab9f3d-0x0;var _0x5283bf=_0xa357[_0xab9f3d];return _0x5283bf;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x7a35('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7a35('0x1')](0x0);var events={'afterCreate':_0x7a35('0x2'),'afterUpdate':_0x7a35('0x3'),'afterDestroy':'remove'};function emitEvent(_0x41155c){return function(_0xb0145,_0x2862a6,_0x524262){WhatsappQueueEvents[_0x7a35('0x4')](_0x41155c+':'+_0xb0145['id'],_0xb0145);WhatsappQueueEvents[_0x7a35('0x4')](_0x41155c,_0xb0145);_0x524262(null);};}for(var e in events){if(events[_0x7a35('0x5')](e)){var event=events[e];WhatsappQueue[_0x7a35('0x6')](e,emitEvent(event));}}module[_0x7a35('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xa44a=['hasOwnProperty','hook','exports','events','save','remove','emit'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa44a,0x8f));var _0xaa44=function(_0x2b17f9,_0x23f737){_0x2b17f9=_0x2b17f9-0x0;var _0x2f13c9=_0xa44a[_0x2b17f9];return _0x2f13c9;};'use strict';var EventEmitter=require(_0xaa44('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaa44('0x1'),'afterUpdate':'update','afterDestroy':_0xaa44('0x2')};function emitEvent(_0x11d656){return function(_0x387b93,_0x4912f4,_0x908366){WhatsappQueueEvents['emit'](_0x11d656+':'+_0x387b93['id'],_0x387b93);WhatsappQueueEvents[_0xaa44('0x3')](_0x11d656,_0x387b93);_0x908366(null);};}for(var e in events){if(events[_0xaa44('0x4')](e)){var event=events[e];WhatsappQueue[_0xaa44('0x5')](e,emitEvent(event));}}module[_0xaa44('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 0fa3772..fb0403f 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 _0x90f2=['../../config/environment','./whatsappQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x1b5aea,_0x1afe6f){var _0x51cae9=function(_0x1494a6){while(--_0x1494a6){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x51cae9(++_0x1afe6f);}(_0x90f2,0x12d));var _0x290f=function(_0x5ecb51,_0x4cac28){_0x5ecb51=_0x5ecb51-0x0;var _0x2e952a=_0x90f2[_0x5ecb51];return _0x2e952a;};'use strict';var _=require(_0x290f('0x0'));var util=require(_0x290f('0x1'));var logger=require(_0x290f('0x2'))(_0x290f('0x3'));var moment=require(_0x290f('0x4'));var BPromise=require(_0x290f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x290f('0x6'));var config=require(_0x290f('0x7'));var attributes=require(_0x290f('0x8'));module[_0x290f('0x9')]=function(_0x31233d,_0x1d4b77){return _0x31233d[_0x290f('0xa')]('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd099=['util','../../config/logger','api','moment','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x2eac8e,_0x33320b){var _0x3c8d50=function(_0x57f5c3){while(--_0x57f5c3){_0x2eac8e['push'](_0x2eac8e['shift']());}};_0x3c8d50(++_0x33320b);}(_0xd099,0x137));var _0x9d09=function(_0x571714,_0x30d2b3){_0x571714=_0x571714-0x0;var _0x599a14=_0xd099[_0x571714];return _0x599a14;};'use strict';var _=require(_0x9d09('0x0'));var util=require(_0x9d09('0x1'));var logger=require(_0x9d09('0x2'))(_0x9d09('0x3'));var moment=require(_0x9d09('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d09('0x5'));var rimraf=require(_0x9d09('0x6'));var config=require('../../config/environment');var attributes=require(_0x9d09('0x7'));module[_0x9d09('0x8')]=function(_0x5afc58,_0x3ddcbe){return _0x5afc58[_0x9d09('0x9')](_0x9d09('0xa'),attributes,{'tableName':_0x9d09('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 3608866..d1d2e69 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 _0x5cd2=['findAll','options','where','attributes','limit','include','model','map','then','debug','ShowWhatsappQueue','find','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetWhatsappQueue','WhatsappQueue'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x5cd2,0x103));var _0x25cd=function(_0x364e62,_0x4c899e){_0x364e62=_0x364e62-0x0;var _0x120331=_0x5cd2[_0x364e62];return _0x120331;};'use strict';var _=require(_0x25cd('0x0'));var util=require('util');var moment=require(_0x25cd('0x1'));var BPromise=require('bluebird');var rs=require(_0x25cd('0x2'));var fs=require('fs');var Redis=require(_0x25cd('0x3'));var db=require(_0x25cd('0x4'))['db'];var utils=require(_0x25cd('0x5'));var logger=require(_0x25cd('0x6'))(_0x25cd('0x7'));var config=require(_0x25cd('0x8'));var jayson=require(_0x25cd('0x9'));var client=jayson[_0x25cd('0xa')][_0x25cd('0xb')]({'port':0x232a});config[_0x25cd('0xc')]=_[_0x25cd('0xd')](config[_0x25cd('0xc')],{'host':_0x25cd('0xe'),'port':0x18eb});var socket=require(_0x25cd('0xf'))(new Redis(config[_0x25cd('0xc')]));require(_0x25cd('0x10'))[_0x25cd('0x11')](socket);function respondWithRpcPromise(_0x2bd868,_0x41bf9,_0x5f14a6){return new BPromise(function(_0x4836f5,_0xb4aa84){return client['request'](_0x2bd868,_0x5f14a6)['then'](function(_0x105a44){logger[_0x25cd('0x12')](_0x25cd('0x13'),_0x41bf9,_0x25cd('0x14'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x41bf9,_0x25cd('0x14'),JSON[_0x25cd('0x15')](_0x105a44));if(_0x105a44[_0x25cd('0x16')]){if(_0x105a44[_0x25cd('0x16')]['code']===0x1f4){logger[_0x25cd('0x16')](_0x25cd('0x13'),_0x41bf9,_0x105a44['error'][_0x25cd('0x17')]);return _0xb4aa84(_0x105a44[_0x25cd('0x16')][_0x25cd('0x17')]);}logger[_0x25cd('0x16')](_0x25cd('0x13'),_0x41bf9,_0x105a44[_0x25cd('0x16')]['message']);return _0x4836f5(_0x105a44[_0x25cd('0x16')][_0x25cd('0x17')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x41bf9,_0x25cd('0x14'));_0x4836f5(_0x105a44[_0x25cd('0x18')]['message']);}})[_0x25cd('0x19')](function(_0xd500fb){logger[_0x25cd('0x16')](_0x25cd('0x13'),_0x41bf9,_0xd500fb);_0xb4aa84(_0xd500fb);});});}exports[_0x25cd('0x1a')]=function(_0x385545){var _0x53cfe5=this;return new Promise(function(_0x439b8e,_0x344e63){return db[_0x25cd('0x1b')][_0x25cd('0x1c')]({'raw':_0x385545[_0x25cd('0x1d')]?_0x385545[_0x25cd('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x385545[_0x25cd('0x1d')]?_0x385545[_0x25cd('0x1d')][_0x25cd('0x1e')]||null:null,'attributes':_0x385545['options']?_0x385545[_0x25cd('0x1d')][_0x25cd('0x1f')]||null:null,'limit':_0x385545[_0x25cd('0x1d')]?_0x385545[_0x25cd('0x1d')][_0x25cd('0x20')]||null:null,'include':_0x385545[_0x25cd('0x1d')]?_0x385545[_0x25cd('0x1d')][_0x25cd('0x21')]?_['map'](_0x385545[_0x25cd('0x1d')][_0x25cd('0x21')],function(_0xf76949){return{'model':db[_0xf76949[_0x25cd('0x22')]],'as':_0xf76949['as'],'attributes':_0xf76949[_0x25cd('0x1f')],'include':_0xf76949[_0x25cd('0x21')]?_['map'](_0xf76949[_0x25cd('0x21')],function(_0x488887){return{'model':db[_0x488887[_0x25cd('0x22')]],'as':_0x488887['as'],'attributes':_0x488887[_0x25cd('0x1f')],'include':_0x488887[_0x25cd('0x21')]?_[_0x25cd('0x23')](_0x488887['include'],function(_0x3b5c14){return{'model':db[_0x3b5c14[_0x25cd('0x22')]],'as':_0x3b5c14['as'],'attributes':_0x3b5c14[_0x25cd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x25cd('0x24')](function(_0x3047c9){logger[_0x25cd('0x12')](_0x25cd('0x1a'),_0x385545);logger[_0x25cd('0x25')](_0x25cd('0x1a'),_0x385545,JSON[_0x25cd('0x15')](_0x3047c9));_0x439b8e(_0x3047c9);})[_0x25cd('0x19')](function(_0x3a62dd){logger['error']('GetWhatsappQueue',_0x3a62dd['message'],_0x385545);_0x344e63(_0x53cfe5[_0x25cd('0x16')](0x1f4,_0x3a62dd[_0x25cd('0x17')]));});});};exports[_0x25cd('0x26')]=function(_0x541227){var _0x1aeaf8=this;return new Promise(function(_0x3acdc3,_0x642129){return db[_0x25cd('0x1b')][_0x25cd('0x27')]({'raw':_0x541227['options']?_0x541227[_0x25cd('0x1d')][_0x25cd('0x28')]===undefined?!![]:![]:!![],'where':_0x541227[_0x25cd('0x1d')]?_0x541227[_0x25cd('0x1d')]['where']||null:null,'attributes':_0x541227['options']?_0x541227['options'][_0x25cd('0x1f')]||null:null,'include':_0x541227[_0x25cd('0x1d')]?_0x541227[_0x25cd('0x1d')]['include']?_[_0x25cd('0x23')](_0x541227['options']['include'],function(_0x588d56){return{'model':db[_0x588d56['model']],'as':_0x588d56['as'],'attributes':_0x588d56[_0x25cd('0x1f')],'include':_0x588d56[_0x25cd('0x21')]?_[_0x25cd('0x23')](_0x588d56[_0x25cd('0x21')],function(_0x38e90a){return{'model':db[_0x38e90a[_0x25cd('0x22')]],'as':_0x38e90a['as'],'attributes':_0x38e90a[_0x25cd('0x1f')],'include':_0x38e90a[_0x25cd('0x21')]?_[_0x25cd('0x23')](_0x38e90a['include'],function(_0x257da7){return{'model':db[_0x257da7[_0x25cd('0x22')]],'as':_0x257da7['as'],'attributes':_0x257da7['attributes']};}):[]};}):[]};}):[]:[]})[_0x25cd('0x24')](function(_0x5a8ac8){logger[_0x25cd('0x12')](_0x25cd('0x26'),_0x541227);logger['debug'](_0x25cd('0x26'),_0x541227,JSON[_0x25cd('0x15')](_0x5a8ac8));_0x3acdc3(_0x5a8ac8);})['catch'](function(_0x452723){logger[_0x25cd('0x16')](_0x25cd('0x26'),_0x452723[_0x25cd('0x17')],_0x541227);_0x642129(_0x1aeaf8[_0x25cd('0x16')](0x1f4,_0x452723[_0x25cd('0x17')]));});});}; \ No newline at end of file +var _0x5c03=['message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','map','include','model','debug','ShowWhatsappQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0x5c03,0x119));var _0x35c0=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x5c03[_0x263a74];return _0x2aa86c;};'use strict';var _=require('lodash');var util=require(_0x35c0('0x0'));var moment=require(_0x35c0('0x1'));var BPromise=require(_0x35c0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35c0('0x3'));var db=require(_0x35c0('0x4'))['db'];var utils=require(_0x35c0('0x5'));var logger=require(_0x35c0('0x6'))(_0x35c0('0x7'));var config=require(_0x35c0('0x8'));var jayson=require(_0x35c0('0x9'));var client=jayson[_0x35c0('0xa')]['http']({'port':0x232a});config['redis']=_[_0x35c0('0xb')](config[_0x35c0('0xc')],{'host':_0x35c0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35c0('0xc')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x337d85,_0x4fa4db,_0x30934){return new BPromise(function(_0x2e2422,_0x5cb2aa){return client[_0x35c0('0xe')](_0x337d85,_0x30934)[_0x35c0('0xf')](function(_0x5b1396){logger[_0x35c0('0x10')](_0x35c0('0x11'),_0x4fa4db,_0x35c0('0x12'));logger['debug'](_0x35c0('0x13'),_0x4fa4db,'request\x20sent',JSON[_0x35c0('0x14')](_0x5b1396));if(_0x5b1396[_0x35c0('0x15')]){if(_0x5b1396[_0x35c0('0x15')][_0x35c0('0x16')]===0x1f4){logger['error'](_0x35c0('0x11'),_0x4fa4db,_0x5b1396[_0x35c0('0x15')][_0x35c0('0x17')]);return _0x5cb2aa(_0x5b1396[_0x35c0('0x15')]['message']);}logger[_0x35c0('0x15')](_0x35c0('0x11'),_0x4fa4db,_0x5b1396['error'][_0x35c0('0x17')]);return _0x2e2422(_0x5b1396['error'][_0x35c0('0x17')]);}else{logger[_0x35c0('0x10')](_0x35c0('0x11'),_0x4fa4db,'request\x20sent');_0x2e2422(_0x5b1396[_0x35c0('0x18')][_0x35c0('0x17')]);}})['catch'](function(_0x4917bb){logger[_0x35c0('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x4fa4db,_0x4917bb);_0x5cb2aa(_0x4917bb);});});}exports[_0x35c0('0x19')]=function(_0x5b2351){var _0x236750=this;return new Promise(function(_0x4bef87,_0x5e82ad){return db[_0x35c0('0x1a')][_0x35c0('0x1b')]({'raw':_0x5b2351[_0x35c0('0x1c')]?_0x5b2351[_0x35c0('0x1c')][_0x35c0('0x1d')]===undefined?!![]:![]:!![],'where':_0x5b2351[_0x35c0('0x1c')]?_0x5b2351[_0x35c0('0x1c')][_0x35c0('0x1e')]||null:null,'attributes':_0x5b2351['options']?_0x5b2351[_0x35c0('0x1c')][_0x35c0('0x1f')]||null:null,'limit':_0x5b2351[_0x35c0('0x1c')]?_0x5b2351[_0x35c0('0x1c')][_0x35c0('0x20')]||null:null,'include':_0x5b2351[_0x35c0('0x1c')]?_0x5b2351[_0x35c0('0x1c')]['include']?_[_0x35c0('0x21')](_0x5b2351[_0x35c0('0x1c')][_0x35c0('0x22')],function(_0x4b3734){return{'model':db[_0x4b3734[_0x35c0('0x23')]],'as':_0x4b3734['as'],'attributes':_0x4b3734[_0x35c0('0x1f')],'include':_0x4b3734['include']?_['map'](_0x4b3734['include'],function(_0x127950){return{'model':db[_0x127950[_0x35c0('0x23')]],'as':_0x127950['as'],'attributes':_0x127950[_0x35c0('0x1f')],'include':_0x127950[_0x35c0('0x22')]?_[_0x35c0('0x21')](_0x127950[_0x35c0('0x22')],function(_0x2aee3e){return{'model':db[_0x2aee3e['model']],'as':_0x2aee3e['as'],'attributes':_0x2aee3e[_0x35c0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x35c0('0xf')](function(_0x295f41){logger['info'](_0x35c0('0x19'),_0x5b2351);logger[_0x35c0('0x24')](_0x35c0('0x19'),_0x5b2351,JSON[_0x35c0('0x14')](_0x295f41));_0x4bef87(_0x295f41);})['catch'](function(_0x4dad12){logger[_0x35c0('0x15')](_0x35c0('0x19'),_0x4dad12[_0x35c0('0x17')],_0x5b2351);_0x5e82ad(_0x236750[_0x35c0('0x15')](0x1f4,_0x4dad12['message']));});});};exports[_0x35c0('0x25')]=function(_0x5d9f23){var _0x4dd2c3=this;return new Promise(function(_0x3c952f,_0x1c20fc){return db[_0x35c0('0x1a')]['find']({'raw':_0x5d9f23[_0x35c0('0x1c')]?_0x5d9f23['options'][_0x35c0('0x1d')]===undefined?!![]:![]:!![],'where':_0x5d9f23[_0x35c0('0x1c')]?_0x5d9f23['options'][_0x35c0('0x1e')]||null:null,'attributes':_0x5d9f23[_0x35c0('0x1c')]?_0x5d9f23['options'][_0x35c0('0x1f')]||null:null,'include':_0x5d9f23[_0x35c0('0x1c')]?_0x5d9f23[_0x35c0('0x1c')][_0x35c0('0x22')]?_[_0x35c0('0x21')](_0x5d9f23[_0x35c0('0x1c')][_0x35c0('0x22')],function(_0x158640){return{'model':db[_0x158640[_0x35c0('0x23')]],'as':_0x158640['as'],'attributes':_0x158640[_0x35c0('0x1f')],'include':_0x158640[_0x35c0('0x22')]?_[_0x35c0('0x21')](_0x158640[_0x35c0('0x22')],function(_0x5e85fb){return{'model':db[_0x5e85fb['model']],'as':_0x5e85fb['as'],'attributes':_0x5e85fb[_0x35c0('0x1f')],'include':_0x5e85fb[_0x35c0('0x22')]?_[_0x35c0('0x21')](_0x5e85fb[_0x35c0('0x22')],function(_0x5d9a46){return{'model':db[_0x5d9a46['model']],'as':_0x5d9a46['as'],'attributes':_0x5d9a46[_0x35c0('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26dc4d){logger[_0x35c0('0x10')](_0x35c0('0x25'),_0x5d9f23);logger[_0x35c0('0x24')]('ShowWhatsappQueue',_0x5d9f23,JSON['stringify'](_0x26dc4d));_0x3c952f(_0x26dc4d);})['catch'](function(_0x3e6f11){logger[_0x35c0('0x15')](_0x35c0('0x25'),_0x3e6f11[_0x35c0('0x17')],_0x5d9f23);_0x1c20fc(_0x4dd2c3[_0x35c0('0x15')](0x1f4,_0x3e6f11['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 48c1287..581803d 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 _0x4bb9=['save','remove','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x1eb5da,_0x1974ec){var _0x579a2f=function(_0x502c14){while(--_0x502c14){_0x1eb5da['push'](_0x1eb5da['shift']());}};_0x579a2f(++_0x1974ec);}(_0x4bb9,0x1df));var _0x94bb=function(_0x26013a,_0x47e64c){_0x26013a=_0x26013a-0x0;var _0x25c273=_0x4bb9[_0x26013a];return _0x25c273;};'use strict';var WhatsappQueueEvents=require(_0x94bb('0x0'));var events=[_0x94bb('0x1'),_0x94bb('0x2'),'update'];function createListener(_0x421b7a,_0x3efd12){return function(_0x3e9cb1){_0x3efd12[_0x94bb('0x3')](_0x421b7a,_0x3e9cb1);};}function removeListener(_0x10ba50,_0x4e6ee4){return function(){WhatsappQueueEvents[_0x94bb('0x4')](_0x10ba50,_0x4e6ee4);};}exports[_0x94bb('0x5')]=function(_0x5e3cba){for(var _0x2d530e=0x0,_0xf201b5=events[_0x94bb('0x6')];_0x2d530e<_0xf201b5;_0x2d530e++){var _0x4d89bc=events[_0x2d530e];var _0x3d08e2=createListener(_0x94bb('0x7')+_0x4d89bc,_0x5e3cba);WhatsappQueueEvents['on'](_0x4d89bc,_0x3d08e2);}}; \ No newline at end of file +var _0x1ee0=['remove','update','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x94e205,_0x580c07){var _0x3b5e5f=function(_0x31f169){while(--_0x31f169){_0x94e205['push'](_0x94e205['shift']());}};_0x3b5e5f(++_0x580c07);}(_0x1ee0,0x1a9));var _0x01ee=function(_0x4f75c8,_0x4ef999){_0x4f75c8=_0x4f75c8-0x0;var _0x3e75ff=_0x1ee0[_0x4f75c8];return _0x3e75ff;};'use strict';var WhatsappQueueEvents=require(_0x01ee('0x0'));var events=[_0x01ee('0x1'),_0x01ee('0x2'),_0x01ee('0x3')];function createListener(_0x57d997,_0x382f3e){return function(_0xccf986){_0x382f3e['emit'](_0x57d997,_0xccf986);};}function removeListener(_0x249bbc,_0x50876f){return function(){WhatsappQueueEvents['removeListener'](_0x249bbc,_0x50876f);};}exports[_0x01ee('0x4')]=function(_0x3da84d){for(var _0x22d1f7=0x0,_0x479bab=events[_0x01ee('0x5')];_0x22d1f7<_0x479bab;_0x22d1f7++){var _0x2f9d0f=events[_0x22d1f7];var _0x18ec3e=createListener(_0x01ee('0x6')+_0x2f9d0f,_0x3da84d);WhatsappQueueEvents['on'](_0x2f9d0f,_0x18ec3e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index bd395d2..13b6b7e 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 _0x9355=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated'];(function(_0xbc0574,_0x2d9351){var _0x46d311=function(_0x4a2974){while(--_0x4a2974){_0xbc0574['push'](_0xbc0574['shift']());}};_0x46d311(++_0x2d9351);}(_0x9355,0x73));var _0x5935=function(_0x2a1bb9,_0x1de09b){_0x2a1bb9=_0x2a1bb9-0x0;var _0x55f38b=_0x9355[_0x2a1bb9];return _0x55f38b;};'use strict';var multer=require(_0x5935('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5935('0x1'));var express=require(_0x5935('0x2'));var router=express[_0x5935('0x3')]();var fs_extra=require(_0x5935('0x4'));var auth=require(_0x5935('0x5'));var interaction=require(_0x5935('0x6'));var config=require(_0x5935('0x7'));var controller=require(_0x5935('0x8'));router[_0x5935('0x9')]('/',auth[_0x5935('0xa')](),controller['index']);router[_0x5935('0x9')](_0x5935('0xb'),auth[_0x5935('0xa')](),controller[_0x5935('0xc')]);router[_0x5935('0x9')](_0x5935('0xd'),auth[_0x5935('0xa')](),controller[_0x5935('0xe')]);router['post']('/',auth[_0x5935('0xa')](),controller[_0x5935('0xf')]);router[_0x5935('0x10')](_0x5935('0xd'),auth[_0x5935('0xa')](),controller[_0x5935('0x11')]);router[_0x5935('0x12')]('/:id',auth[_0x5935('0xa')](),controller[_0x5935('0x13')]);module[_0x5935('0x14')]=router; \ No newline at end of file +var _0x6c93=['isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x3e10a2,_0x29262f){var _0x2bba1d=function(_0x4e11f4){while(--_0x4e11f4){_0x3e10a2['push'](_0x3e10a2['shift']());}};_0x2bba1d(++_0x29262f);}(_0x6c93,0x160));var _0x36c9=function(_0x7629e,_0x40c972){_0x7629e=_0x7629e-0x0;var _0x19569b=_0x6c93[_0x7629e];return _0x19569b;};'use strict';var multer=require(_0x36c9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x36c9('0x1'));var express=require(_0x36c9('0x2'));var router=express[_0x36c9('0x3')]();var fs_extra=require(_0x36c9('0x4'));var auth=require(_0x36c9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x36c9('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0x36c9('0x7')]('/',auth[_0x36c9('0x8')](),controller[_0x36c9('0x9')]);router[_0x36c9('0x7')](_0x36c9('0xa'),auth[_0x36c9('0x8')](),controller[_0x36c9('0xb')]);router[_0x36c9('0x7')](_0x36c9('0xc'),auth[_0x36c9('0x8')](),controller[_0x36c9('0xd')]);router[_0x36c9('0xe')]('/',auth['isAuthenticated'](),controller[_0x36c9('0xf')]);router['put'](_0x36c9('0xc'),auth[_0x36c9('0x8')](),controller[_0x36c9('0x10')]);router[_0x36c9('0x11')](_0x36c9('0xc'),auth[_0x36c9('0x8')](),controller[_0x36c9('0x12')]);module[_0x36c9('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 3bf7553..cdb54d6 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 _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x1e9591,_0x1d6fb7){var _0x4089e3=function(_0x733c18){while(--_0x733c18){_0x1e9591['push'](_0x1e9591['shift']());}};_0x4089e3(++_0x1d6fb7);}(_0x7a54,0x106));var _0x47a5=function(_0x846960,_0x4cc715){_0x846960=_0x846960-0x0;var _0x16aade=_0x7a54[_0x846960];return _0x16aade;};'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 +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x2711c0,_0x48c848){var _0x2bd9f6=function(_0x41cc5e){while(--_0x41cc5e){_0x2711c0['push'](_0x2711c0['shift']());}};_0x2bd9f6(++_0x48c848);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 6e6362a..0c4fb72 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 _0x7af2=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','params','keys','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x43a5cd,_0x1bf484){var _0x10d186=function(_0x5b0f08){while(--_0x5b0f08){_0x43a5cd['push'](_0x43a5cd['shift']());}};_0x10d186(++_0x1bf484);}(_0x7af2,0x119));var _0x27af=function(_0x2c7322,_0x1e438f){_0x2c7322=_0x2c7322-0x0;var _0x320dc6=_0x7af2[_0x2c7322];return _0x320dc6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27af('0x0'));var zipdir=require(_0x27af('0x1'));var jsonpatch=require(_0x27af('0x2'));var rp=require(_0x27af('0x3'));var moment=require('moment');var BPromise=require(_0x27af('0x4'));var Mustache=require(_0x27af('0x5'));var util=require(_0x27af('0x6'));var path=require(_0x27af('0x7'));var sox=require(_0x27af('0x8'));var csv=require(_0x27af('0x9'));var ejs=require(_0x27af('0xa'));var fs=require('fs');var fs_extra=require(_0x27af('0xb'));var _=require(_0x27af('0xc'));var squel=require('squel');var crypto=require(_0x27af('0xd'));var jsforce=require(_0x27af('0xe'));var deskjs=require(_0x27af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27af('0x10'));var Papa=require(_0x27af('0x11'));var Redis=require(_0x27af('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x27af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x27af('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x27af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27af('0x16'))['db'];function respondWithStatusCode(_0x49a883,_0x406340){_0x406340=_0x406340||0xcc;return function(_0x203501){if(_0x203501){return _0x49a883[_0x27af('0x17')](_0x406340);}return _0x49a883[_0x27af('0x18')](_0x406340)[_0x27af('0x19')]();};}function respondWithResult(_0x1edb50,_0x234825){_0x234825=_0x234825||0xc8;return function(_0x3da435){if(_0x3da435){return _0x1edb50[_0x27af('0x18')](_0x234825)[_0x27af('0x1a')](_0x3da435);}};}function respondWithFilteredResult(_0x30f675,_0x9c2d4b){return function(_0x2d7800){if(_0x2d7800){var _0x3102c4=typeof _0x9c2d4b[_0x27af('0x1b')]===_0x27af('0x1c')&&typeof _0x9c2d4b[_0x27af('0x1d')]===_0x27af('0x1c');var _0x58583a=_0x2d7800[_0x27af('0x1e')];var _0x31d702=_0x3102c4?0x0:_0x9c2d4b['offset'];var _0x4e6e2f=_0x3102c4?_0x2d7800[_0x27af('0x1e')]:_0x9c2d4b[_0x27af('0x1b')]+_0x9c2d4b[_0x27af('0x1d')];var _0x31573a;if(_0x4e6e2f>=_0x58583a){_0x4e6e2f=_0x58583a;_0x31573a=0xc8;}else{_0x31573a=0xce;}_0x30f675[_0x27af('0x18')](_0x31573a);return _0x30f675['set'](_0x27af('0x1f'),_0x31d702+'-'+_0x4e6e2f+'/'+_0x58583a)[_0x27af('0x1a')](_0x2d7800);}return null;};}function patchUpdates(_0xcb4b90){return function(_0x5e7c19){try{jsonpatch[_0x27af('0x20')](_0x5e7c19,_0xcb4b90,!![]);}catch(_0x2eec5f){return BPromise[_0x27af('0x21')](_0x2eec5f);}return _0x5e7c19['save']();};}function saveUpdates(_0x2dce2b,_0x2460f4){return function(_0x30720b){if(_0x30720b){return _0x30720b[_0x27af('0x22')](_0x2dce2b)[_0x27af('0x23')](function(_0x396156){return _0x396156;});}return null;};}function removeEntity(_0x43dd9e,_0x35b36d){return function(_0x2e1bb0){if(_0x2e1bb0){return _0x2e1bb0['destroy']()['then'](function(){_0x43dd9e['status'](0xcc)[_0x27af('0x19')]();});}};}function handleEntityNotFound(_0x4feaf1,_0x12625c){return function(_0x396326){if(!_0x396326){_0x4feaf1['sendStatus'](0x194);}return _0x396326;};}function handleError(_0x393190,_0x1d9341){_0x1d9341=_0x1d9341||0x1f4;return function(_0x463e36){logger[_0x27af('0x24')](_0x463e36[_0x27af('0x25')]);if(_0x463e36[_0x27af('0x26')]){delete _0x463e36[_0x27af('0x26')];}_0x393190['status'](_0x1d9341)[_0x27af('0x27')](_0x463e36);};}exports[_0x27af('0x28')]=function(_0xadd38e,_0xe009a){var _0x25d65a={},_0xa08dd9={},_0x42a5b7={'count':0x0,'rows':[]};var _0x2b26ac=_[_0x27af('0x29')](db[_0x27af('0x2a')][_0x27af('0x2b')],function(_0x4f4955){return{'name':_0x4f4955[_0x27af('0x2c')],'type':_0x4f4955[_0x27af('0x2d')][_0x27af('0x2e')]};});_0xa08dd9[_0x27af('0x2f')]=_[_0x27af('0x29')](_0x2b26ac,_0x27af('0x26'));_0xa08dd9['query']=_['keys'](_0xadd38e[_0x27af('0x30')]);_0xa08dd9[_0x27af('0x31')]=_['intersection'](_0xa08dd9[_0x27af('0x2f')],_0xa08dd9[_0x27af('0x30')]);_0x25d65a[_0x27af('0x32')]=_[_0x27af('0x33')](_0xa08dd9[_0x27af('0x2f')],qs[_0x27af('0x34')](_0xadd38e[_0x27af('0x30')][_0x27af('0x34')]));_0x25d65a[_0x27af('0x32')]=_0x25d65a[_0x27af('0x32')][_0x27af('0x35')]?_0x25d65a['attributes']:_0xa08dd9['model'];if(!_0xadd38e[_0x27af('0x30')][_0x27af('0x36')]('nolimit')){_0x25d65a[_0x27af('0x1d')]=qs[_0x27af('0x1d')](_0xadd38e['query'][_0x27af('0x1d')]);_0x25d65a[_0x27af('0x1b')]=qs[_0x27af('0x1b')](_0xadd38e[_0x27af('0x30')][_0x27af('0x1b')]);}_0x25d65a['order']=qs[_0x27af('0x37')](_0xadd38e[_0x27af('0x30')]['sort']);_0x25d65a['where']=qs[_0x27af('0x31')](_[_0x27af('0x38')](_0xadd38e[_0x27af('0x30')],_0xa08dd9[_0x27af('0x31')]),_0x2b26ac);if(_0xadd38e[_0x27af('0x30')][_0x27af('0x39')]){_0x25d65a['where']=_[_0x27af('0x3a')](_0x25d65a['where'],{'$or':_[_0x27af('0x29')](_0x2b26ac,function(_0x38a532){if(_0x38a532[_0x27af('0x2d')]!==_0x27af('0x3b')){var _0x1c6a4d={};_0x1c6a4d[_0x38a532['name']]={'$like':'%'+_0xadd38e[_0x27af('0x30')][_0x27af('0x39')]+'%'};return _0x1c6a4d;}})});}_0x25d65a=_[_0x27af('0x3a')]({},_0x25d65a,_0xadd38e[_0x27af('0x3c')]);var _0x10c1be={'where':_0x25d65a[_0x27af('0x3d')]};return db[_0x27af('0x2a')][_0x27af('0x1e')](_0x10c1be)[_0x27af('0x23')](function(_0x18f11b){_0x42a5b7[_0x27af('0x1e')]=_0x18f11b;if(_0xadd38e[_0x27af('0x30')][_0x27af('0x3e')]){_0x25d65a[_0x27af('0x3f')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x27af('0x40')](_0x25d65a);})[_0x27af('0x23')](function(_0x44534b){_0x42a5b7[_0x27af('0x41')]=_0x44534b;return _0x42a5b7;})['then'](respondWithFilteredResult(_0xe009a,_0x25d65a))[_0x27af('0x42')](handleError(_0xe009a,null));};exports['show']=function(_0x516651,_0x2425dd){var _0x3c9c81={'raw':!![],'where':{'id':_0x516651[_0x27af('0x43')]['id']}},_0x279f99={};_0x279f99[_0x27af('0x2f')]=_[_0x27af('0x44')](db[_0x27af('0x2a')][_0x27af('0x2b')]);_0x279f99[_0x27af('0x30')]=_[_0x27af('0x44')](_0x516651[_0x27af('0x30')]);_0x279f99[_0x27af('0x31')]=_['intersection'](_0x279f99[_0x27af('0x2f')],_0x279f99[_0x27af('0x30')]);_0x3c9c81['attributes']=_['intersection'](_0x279f99[_0x27af('0x2f')],qs[_0x27af('0x34')](_0x516651[_0x27af('0x30')][_0x27af('0x34')]));_0x3c9c81[_0x27af('0x32')]=_0x3c9c81['attributes'][_0x27af('0x35')]?_0x3c9c81['attributes']:_0x279f99[_0x27af('0x2f')];if(_0x516651[_0x27af('0x30')][_0x27af('0x3e')]){_0x3c9c81[_0x27af('0x3f')]=[{'all':!![]}];}_0x3c9c81=_[_0x27af('0x3a')]({},_0x3c9c81,_0x516651[_0x27af('0x3c')]);return db[_0x27af('0x2a')]['find'](_0x3c9c81)['then'](handleEntityNotFound(_0x2425dd,null))[_0x27af('0x23')](respondWithResult(_0x2425dd,null))['catch'](handleError(_0x2425dd,null));};exports[_0x27af('0x45')]=function(_0x1b43e2,_0x226025){return db[_0x27af('0x2a')][_0x27af('0x45')](_0x1b43e2[_0x27af('0x46')],{})[_0x27af('0x23')](respondWithResult(_0x226025,0xc9))['catch'](handleError(_0x226025,null));};exports[_0x27af('0x22')]=function(_0xc7e2a8,_0x20e180){if(_0xc7e2a8[_0x27af('0x46')]['id']){delete _0xc7e2a8[_0x27af('0x46')]['id'];}return db['WhatsappQueueReport'][_0x27af('0x47')]({'where':{'id':_0xc7e2a8[_0x27af('0x43')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x20e180,null))['then'](saveUpdates(_0xc7e2a8['body'],null))[_0x27af('0x23')](respondWithResult(_0x20e180,null))[_0x27af('0x42')](handleError(_0x20e180,null));};exports[_0x27af('0x48')]=function(_0x5be44f,_0x495794){return db[_0x27af('0x2a')]['find']({'where':{'id':_0x5be44f[_0x27af('0x43')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x495794,null))[_0x27af('0x23')](removeEntity(_0x495794,null))[_0x27af('0x42')](handleError(_0x495794,null));};exports[_0x27af('0x49')]=function(_0xb9e23,_0x123533){return db[_0x27af('0x2a')][_0x27af('0x49')]()[_0x27af('0x23')](respondWithResult(_0x123533,null))[_0x27af('0x42')](handleError(_0x123533,null));}; \ No newline at end of file +var _0x7d25=['mustache','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','merge','includeAll','include','rows','params','rawAttributes','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0xcf155d,_0x1e15c7){var _0x8473ef=function(_0x264429){while(--_0x264429){_0xcf155d['push'](_0xcf155d['shift']());}};_0x8473ef(++_0x1e15c7);}(_0x7d25,0x8a));var _0x57d2=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x7d25[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57d2('0x0'));var zipdir=require(_0x57d2('0x1'));var jsonpatch=require(_0x57d2('0x2'));var rp=require(_0x57d2('0x3'));var moment=require(_0x57d2('0x4'));var BPromise=require(_0x57d2('0x5'));var Mustache=require(_0x57d2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57d2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57d2('0x8'));var squel=require(_0x57d2('0x9'));var crypto=require(_0x57d2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x57d2('0xb'));var querystring=require('querystring');var Papa=require(_0x57d2('0xc'));var Redis=require(_0x57d2('0xd'));var authService=require(_0x57d2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x57d2('0xf'));var hardwareService=require(_0x57d2('0x10'));var logger=require(_0x57d2('0x11'))(_0x57d2('0x12'));var utils=require(_0x57d2('0x13'));var config=require(_0x57d2('0x14'));var licenseUtil=require(_0x57d2('0x15'));var db=require(_0x57d2('0x16'))['db'];function respondWithStatusCode(_0x43d7fb,_0x32c33a){_0x32c33a=_0x32c33a||0xcc;return function(_0x28428b){if(_0x28428b){return _0x43d7fb[_0x57d2('0x17')](_0x32c33a);}return _0x43d7fb[_0x57d2('0x18')](_0x32c33a)[_0x57d2('0x19')]();};}function respondWithResult(_0x1ba57e,_0x4086f3){_0x4086f3=_0x4086f3||0xc8;return function(_0x5382d9){if(_0x5382d9){return _0x1ba57e['status'](_0x4086f3)[_0x57d2('0x1a')](_0x5382d9);}};}function respondWithFilteredResult(_0x148ef3,_0x4ec4b1){return function(_0x8cf637){if(_0x8cf637){var _0x319489=typeof _0x4ec4b1['offset']===_0x57d2('0x1b')&&typeof _0x4ec4b1['limit']===_0x57d2('0x1b');var _0x4b4fe0=_0x8cf637[_0x57d2('0x1c')];var _0x7d4cf1=_0x319489?0x0:_0x4ec4b1[_0x57d2('0x1d')];var _0x4a94e3=_0x319489?_0x8cf637['count']:_0x4ec4b1[_0x57d2('0x1d')]+_0x4ec4b1[_0x57d2('0x1e')];var _0x2662cd;if(_0x4a94e3>=_0x4b4fe0){_0x4a94e3=_0x4b4fe0;_0x2662cd=0xc8;}else{_0x2662cd=0xce;}_0x148ef3[_0x57d2('0x18')](_0x2662cd);return _0x148ef3['set'](_0x57d2('0x1f'),_0x7d4cf1+'-'+_0x4a94e3+'/'+_0x4b4fe0)[_0x57d2('0x1a')](_0x8cf637);}return null;};}function patchUpdates(_0x55191e){return function(_0x5f3fd5){try{jsonpatch[_0x57d2('0x20')](_0x5f3fd5,_0x55191e,!![]);}catch(_0x326d49){return BPromise[_0x57d2('0x21')](_0x326d49);}return _0x5f3fd5[_0x57d2('0x22')]();};}function saveUpdates(_0x386196,_0x803c25){return function(_0x32c7c8){if(_0x32c7c8){return _0x32c7c8[_0x57d2('0x23')](_0x386196)[_0x57d2('0x24')](function(_0x26718e){return _0x26718e;});}return null;};}function removeEntity(_0x46a4d1,_0x456fe1){return function(_0x12ff19){if(_0x12ff19){return _0x12ff19[_0x57d2('0x25')]()['then'](function(){_0x46a4d1[_0x57d2('0x18')](0xcc)[_0x57d2('0x19')]();});}};}function handleEntityNotFound(_0x3c7de8,_0x452d5e){return function(_0x4363b3){if(!_0x4363b3){_0x3c7de8['sendStatus'](0x194);}return _0x4363b3;};}function handleError(_0x1d203c,_0x608b10){_0x608b10=_0x608b10||0x1f4;return function(_0x995928){logger[_0x57d2('0x26')](_0x995928[_0x57d2('0x27')]);if(_0x995928[_0x57d2('0x28')]){delete _0x995928[_0x57d2('0x28')];}_0x1d203c['status'](_0x608b10)[_0x57d2('0x29')](_0x995928);};}exports[_0x57d2('0x2a')]=function(_0x277426,_0x1fe383){var _0x1957a6={},_0x7c33f3={},_0x1dd6cb={'count':0x0,'rows':[]};var _0x1d3a3a=_[_0x57d2('0x2b')](db[_0x57d2('0x2c')]['rawAttributes'],function(_0x4e9178){return{'name':_0x4e9178[_0x57d2('0x2d')],'type':_0x4e9178[_0x57d2('0x2e')][_0x57d2('0x2f')]};});_0x7c33f3['model']=_[_0x57d2('0x2b')](_0x1d3a3a,_0x57d2('0x28'));_0x7c33f3[_0x57d2('0x30')]=_[_0x57d2('0x31')](_0x277426[_0x57d2('0x30')]);_0x7c33f3[_0x57d2('0x32')]=_[_0x57d2('0x33')](_0x7c33f3[_0x57d2('0x34')],_0x7c33f3[_0x57d2('0x30')]);_0x1957a6['attributes']=_[_0x57d2('0x33')](_0x7c33f3[_0x57d2('0x34')],qs['fields'](_0x277426[_0x57d2('0x30')][_0x57d2('0x35')]));_0x1957a6['attributes']=_0x1957a6[_0x57d2('0x36')][_0x57d2('0x37')]?_0x1957a6[_0x57d2('0x36')]:_0x7c33f3[_0x57d2('0x34')];if(!_0x277426[_0x57d2('0x30')]['hasOwnProperty']('nolimit')){_0x1957a6['limit']=qs['limit'](_0x277426[_0x57d2('0x30')][_0x57d2('0x1e')]);_0x1957a6[_0x57d2('0x1d')]=qs[_0x57d2('0x1d')](_0x277426[_0x57d2('0x30')]['offset']);}_0x1957a6[_0x57d2('0x38')]=qs['sort'](_0x277426[_0x57d2('0x30')][_0x57d2('0x39')]);_0x1957a6[_0x57d2('0x3a')]=qs['filters'](_[_0x57d2('0x3b')](_0x277426[_0x57d2('0x30')],_0x7c33f3['filters']),_0x1d3a3a);if(_0x277426[_0x57d2('0x30')][_0x57d2('0x3c')]){_0x1957a6[_0x57d2('0x3a')]=_[_0x57d2('0x3d')](_0x1957a6[_0x57d2('0x3a')],{'$or':_[_0x57d2('0x2b')](_0x1d3a3a,function(_0x47f379){if(_0x47f379[_0x57d2('0x2e')]!=='VIRTUAL'){var _0x1d3303={};_0x1d3303[_0x47f379[_0x57d2('0x28')]]={'$like':'%'+_0x277426[_0x57d2('0x30')][_0x57d2('0x3c')]+'%'};return _0x1d3303;}})});}_0x1957a6=_[_0x57d2('0x3d')]({},_0x1957a6,_0x277426['options']);var _0x282e6e={'where':_0x1957a6[_0x57d2('0x3a')]};return db['WhatsappQueueReport'][_0x57d2('0x1c')](_0x282e6e)[_0x57d2('0x24')](function(_0x1713bc){_0x1dd6cb['count']=_0x1713bc;if(_0x277426[_0x57d2('0x30')][_0x57d2('0x3e')]){_0x1957a6[_0x57d2('0x3f')]=[{'all':!![]}];}return db[_0x57d2('0x2c')]['findAll'](_0x1957a6);})['then'](function(_0x11a2ec){_0x1dd6cb[_0x57d2('0x40')]=_0x11a2ec;return _0x1dd6cb;})[_0x57d2('0x24')](respondWithFilteredResult(_0x1fe383,_0x1957a6))['catch'](handleError(_0x1fe383,null));};exports['show']=function(_0xebeac5,_0x5116b5){var _0xe42c98={'raw':!![],'where':{'id':_0xebeac5[_0x57d2('0x41')]['id']}},_0x1bb8ad={};_0x1bb8ad[_0x57d2('0x34')]=_[_0x57d2('0x31')](db['WhatsappQueueReport'][_0x57d2('0x42')]);_0x1bb8ad[_0x57d2('0x30')]=_['keys'](_0xebeac5[_0x57d2('0x30')]);_0x1bb8ad['filters']=_[_0x57d2('0x33')](_0x1bb8ad[_0x57d2('0x34')],_0x1bb8ad[_0x57d2('0x30')]);_0xe42c98[_0x57d2('0x36')]=_['intersection'](_0x1bb8ad['model'],qs[_0x57d2('0x35')](_0xebeac5['query']['fields']));_0xe42c98[_0x57d2('0x36')]=_0xe42c98['attributes']['length']?_0xe42c98[_0x57d2('0x36')]:_0x1bb8ad['model'];if(_0xebeac5[_0x57d2('0x30')]['includeAll']){_0xe42c98[_0x57d2('0x3f')]=[{'all':!![]}];}_0xe42c98=_['merge']({},_0xe42c98,_0xebeac5['options']);return db[_0x57d2('0x2c')][_0x57d2('0x43')](_0xe42c98)[_0x57d2('0x24')](handleEntityNotFound(_0x5116b5,null))[_0x57d2('0x24')](respondWithResult(_0x5116b5,null))[_0x57d2('0x44')](handleError(_0x5116b5,null));};exports[_0x57d2('0x45')]=function(_0x4c88dd,_0x4541b2){return db[_0x57d2('0x2c')][_0x57d2('0x45')](_0x4c88dd[_0x57d2('0x46')],{})[_0x57d2('0x24')](respondWithResult(_0x4541b2,0xc9))[_0x57d2('0x44')](handleError(_0x4541b2,null));};exports[_0x57d2('0x23')]=function(_0x406375,_0x51f172){if(_0x406375[_0x57d2('0x46')]['id']){delete _0x406375[_0x57d2('0x46')]['id'];}return db['WhatsappQueueReport'][_0x57d2('0x43')]({'where':{'id':_0x406375['params']['id']}})['then'](handleEntityNotFound(_0x51f172,null))[_0x57d2('0x24')](saveUpdates(_0x406375[_0x57d2('0x46')],null))[_0x57d2('0x24')](respondWithResult(_0x51f172,null))[_0x57d2('0x44')](handleError(_0x51f172,null));};exports['destroy']=function(_0x265d24,_0x176e24){return db['WhatsappQueueReport']['find']({'where':{'id':_0x265d24[_0x57d2('0x41')]['id']}})[_0x57d2('0x24')](handleEntityNotFound(_0x176e24,null))[_0x57d2('0x24')](removeEntity(_0x176e24,null))[_0x57d2('0x44')](handleError(_0x176e24,null));};exports[_0x57d2('0x47')]=function(_0x396220,_0x5a3e86){return db['WhatsappQueueReport']['describe']()[_0x57d2('0x24')](respondWithResult(_0x5a3e86,null))['catch'](handleError(_0x5a3e86,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index a84fe1a..ed66bef 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 _0x8378=['report_whatsapp_queue','uniqueid','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8378,0x1a4));var _0x8837=function(_0x134d3e,_0x4a78f5){_0x134d3e=_0x134d3e-0x0;var _0x2ac026=_0x8378[_0x134d3e];return _0x2ac026;};'use strict';var _=require('lodash');var util=require(_0x8837('0x0'));var logger=require(_0x8837('0x1'))(_0x8837('0x2'));var moment=require(_0x8837('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8837('0x4'));var rimraf=require(_0x8837('0x5'));var config=require(_0x8837('0x6'));var attributes=require(_0x8837('0x7'));module['exports']=function(_0x48a3e1,_0x4ea966){return _0x48a3e1[_0x8837('0x8')]('WhatsappQueueReport',attributes,{'tableName':_0x8837('0x9'),'paranoid':![],'indexes':[{'name':_0x8837('0xa'),'fields':[_0x8837('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7622=['../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7622,0x11e));var _0x2762=function(_0x4edf34,_0x481dd2){_0x4edf34=_0x4edf34-0x0;var _0x2304f7=_0x7622[_0x4edf34];return _0x2304f7;};'use strict';var _=require(_0x2762('0x0'));var util=require(_0x2762('0x1'));var logger=require(_0x2762('0x2'))(_0x2762('0x3'));var moment=require(_0x2762('0x4'));var BPromise=require('bluebird');var rp=require(_0x2762('0x5'));var fs=require('fs');var path=require(_0x2762('0x6'));var rimraf=require(_0x2762('0x7'));var config=require(_0x2762('0x8'));var attributes=require(_0x2762('0x9'));module['exports']=function(_0x4c8d33,_0x22098c){return _0x4c8d33[_0x2762('0xa')](_0x2762('0xb'),attributes,{'tableName':_0x2762('0xc'),'paranoid':![],'indexes':[{'name':_0x2762('0xd'),'fields':[_0x2762('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index ad2f756..ec8f6e4 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 _0x8c63=['error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','debug','UpdateWhatsappQueueReport','update','where','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3815e1,_0x21c0e9){var _0x52aa7e=function(_0x45fdfb){while(--_0x45fdfb){_0x3815e1['push'](_0x3815e1['shift']());}};_0x52aa7e(++_0x21c0e9);}(_0x8c63,0xb9));var _0x38c6=function(_0x14204e,_0x111bca){_0x14204e=_0x14204e-0x0;var _0x20c40a=_0x8c63[_0x14204e];return _0x20c40a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x38c6('0x0'));var BPromise=require(_0x38c6('0x1'));var rs=require(_0x38c6('0x2'));var fs=require('fs');var Redis=require(_0x38c6('0x3'));var db=require(_0x38c6('0x4'))['db'];var utils=require(_0x38c6('0x5'));var logger=require(_0x38c6('0x6'))(_0x38c6('0x7'));var config=require(_0x38c6('0x8'));var jayson=require(_0x38c6('0x9'));var client=jayson[_0x38c6('0xa')][_0x38c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2374a8,_0x5e41e9,_0x31dd1b){return new BPromise(function(_0x5ce733,_0x26ada8){return client[_0x38c6('0xc')](_0x2374a8,_0x31dd1b)[_0x38c6('0xd')](function(_0x2c8987){logger[_0x38c6('0xe')](_0x38c6('0xf'),_0x5e41e9,_0x38c6('0x10'));logger['debug'](_0x38c6('0x11'),_0x5e41e9,_0x38c6('0x10'),JSON[_0x38c6('0x12')](_0x2c8987));if(_0x2c8987[_0x38c6('0x13')]){if(_0x2c8987[_0x38c6('0x13')][_0x38c6('0x14')]===0x1f4){logger['error'](_0x38c6('0xf'),_0x5e41e9,_0x2c8987[_0x38c6('0x13')][_0x38c6('0x15')]);return _0x26ada8(_0x2c8987[_0x38c6('0x13')][_0x38c6('0x15')]);}logger[_0x38c6('0x13')](_0x38c6('0xf'),_0x5e41e9,_0x2c8987[_0x38c6('0x13')][_0x38c6('0x15')]);return _0x5ce733(_0x2c8987[_0x38c6('0x13')][_0x38c6('0x15')]);}else{logger[_0x38c6('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5e41e9,_0x38c6('0x10'));_0x5ce733(_0x2c8987['result'][_0x38c6('0x15')]);}})[_0x38c6('0x16')](function(_0x515beb){logger[_0x38c6('0x13')](_0x38c6('0xf'),_0x5e41e9,_0x515beb);_0x26ada8(_0x515beb);});});}exports[_0x38c6('0x17')]=function(_0x48091f){var _0x165433=this;return new Promise(function(_0x97a4e7,_0x592894){return db[_0x38c6('0x18')][_0x38c6('0x19')](_0x48091f[_0x38c6('0x1a')],{'raw':_0x48091f['options']?_0x48091f[_0x38c6('0x1b')][_0x38c6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x99eb0b){logger['info'](_0x38c6('0x17'),_0x48091f);logger[_0x38c6('0x1d')](_0x38c6('0x17'),_0x48091f,JSON[_0x38c6('0x12')](_0x99eb0b));_0x97a4e7(_0x99eb0b);})[_0x38c6('0x16')](function(_0x357945){logger[_0x38c6('0x13')]('CreateWhatsappQueueReport',_0x357945[_0x38c6('0x15')],_0x48091f);_0x592894(_0x165433[_0x38c6('0x13')](0x1f4,_0x357945[_0x38c6('0x15')]));});});};exports[_0x38c6('0x1e')]=function(_0x3ab52d){var _0x18ed6f=this;return new Promise(function(_0x2913c5,_0x5a6495){return db['WhatsappQueueReport'][_0x38c6('0x1f')](_0x3ab52d[_0x38c6('0x1a')],{'raw':_0x3ab52d['options']?_0x3ab52d[_0x38c6('0x1b')][_0x38c6('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ab52d[_0x38c6('0x1b')]?_0x3ab52d['options'][_0x38c6('0x20')]||null:null,'attributes':_0x3ab52d[_0x38c6('0x1b')]?_0x3ab52d['options']['attributes']||null:null,'limit':_0x3ab52d[_0x38c6('0x1b')]?_0x3ab52d['options'][_0x38c6('0x21')]||null:null})[_0x38c6('0xd')](function(_0x22af98){logger[_0x38c6('0xe')](_0x38c6('0x1e'),_0x3ab52d);logger[_0x38c6('0x1d')]('UpdateWhatsappQueueReport',_0x3ab52d,JSON[_0x38c6('0x12')](_0x22af98));_0x2913c5(_0x22af98);})[_0x38c6('0x16')](function(_0x5daff2){logger[_0x38c6('0x13')](_0x38c6('0x1e'),_0x5daff2[_0x38c6('0x15')],_0x3ab52d);_0x5a6495(_0x18ed6f[_0x38c6('0x13')](0x1f4,_0x5daff2[_0x38c6('0x15')]));});});}; \ No newline at end of file +var _0xef0d=['CreateWhatsappQueueReport','catch','UpdateWhatsappQueueReport','update','body','options','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','WhatsappQueueReport','raw'];(function(_0x49f40a,_0x2497c3){var _0x1d6dcc=function(_0x3a3dec){while(--_0x3a3dec){_0x49f40a['push'](_0x49f40a['shift']());}};_0x1d6dcc(++_0x2497c3);}(_0xef0d,0x6a));var _0xdef0=function(_0x1284de,_0x57e407){_0x1284de=_0x1284de-0x0;var _0xb1fe8c=_0xef0d[_0x1284de];return _0xb1fe8c;};'use strict';var _=require(_0xdef0('0x0'));var util=require(_0xdef0('0x1'));var moment=require('moment');var BPromise=require(_0xdef0('0x2'));var rs=require(_0xdef0('0x3'));var fs=require('fs');var Redis=require(_0xdef0('0x4'));var db=require(_0xdef0('0x5'))['db'];var utils=require(_0xdef0('0x6'));var logger=require(_0xdef0('0x7'))(_0xdef0('0x8'));var config=require(_0xdef0('0x9'));var jayson=require(_0xdef0('0xa'));var client=jayson[_0xdef0('0xb')][_0xdef0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a96f7,_0x442ae5,_0x4d549c){return new BPromise(function(_0x425d8b,_0x10eace){return client['request'](_0x4a96f7,_0x4d549c)[_0xdef0('0xd')](function(_0x22ff44){logger[_0xdef0('0xe')](_0xdef0('0xf'),_0x442ae5,_0xdef0('0x10'));logger[_0xdef0('0x11')](_0xdef0('0x12'),_0x442ae5,_0xdef0('0x10'),JSON[_0xdef0('0x13')](_0x22ff44));if(_0x22ff44['error']){if(_0x22ff44[_0xdef0('0x14')][_0xdef0('0x15')]===0x1f4){logger[_0xdef0('0x14')](_0xdef0('0xf'),_0x442ae5,_0x22ff44[_0xdef0('0x14')][_0xdef0('0x16')]);return _0x10eace(_0x22ff44['error'][_0xdef0('0x16')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x442ae5,_0x22ff44[_0xdef0('0x14')][_0xdef0('0x16')]);return _0x425d8b(_0x22ff44[_0xdef0('0x14')][_0xdef0('0x16')]);}else{logger[_0xdef0('0xe')](_0xdef0('0xf'),_0x442ae5,'request\x20sent');_0x425d8b(_0x22ff44[_0xdef0('0x17')][_0xdef0('0x16')]);}})['catch'](function(_0x5b502d){logger[_0xdef0('0x14')](_0xdef0('0xf'),_0x442ae5,_0x5b502d);_0x10eace(_0x5b502d);});});}exports['CreateWhatsappQueueReport']=function(_0x2f6d82){var _0x2d8e13=this;return new Promise(function(_0x237509,_0x2e64f0){return db[_0xdef0('0x18')]['create'](_0x2f6d82['body'],{'raw':_0x2f6d82['options']?_0x2f6d82['options'][_0xdef0('0x19')]===undefined?!![]:![]:!![]})[_0xdef0('0xd')](function(_0x309011){logger[_0xdef0('0xe')](_0xdef0('0x1a'),_0x2f6d82);logger[_0xdef0('0x11')](_0xdef0('0x1a'),_0x2f6d82,JSON[_0xdef0('0x13')](_0x309011));_0x237509(_0x309011);})[_0xdef0('0x1b')](function(_0x190be2){logger[_0xdef0('0x14')](_0xdef0('0x1a'),_0x190be2[_0xdef0('0x16')],_0x2f6d82);_0x2e64f0(_0x2d8e13[_0xdef0('0x14')](0x1f4,_0x190be2[_0xdef0('0x16')]));});});};exports[_0xdef0('0x1c')]=function(_0x4ca1e7){var _0x3d8e1c=this;return new Promise(function(_0x15acc7,_0x143075){return db[_0xdef0('0x18')][_0xdef0('0x1d')](_0x4ca1e7[_0xdef0('0x1e')],{'raw':_0x4ca1e7[_0xdef0('0x1f')]?_0x4ca1e7[_0xdef0('0x1f')][_0xdef0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ca1e7[_0xdef0('0x1f')]?_0x4ca1e7[_0xdef0('0x1f')]['where']||null:null,'attributes':_0x4ca1e7[_0xdef0('0x1f')]?_0x4ca1e7[_0xdef0('0x1f')]['attributes']||null:null,'limit':_0x4ca1e7['options']?_0x4ca1e7['options'][_0xdef0('0x20')]||null:null})[_0xdef0('0xd')](function(_0x150ac1){logger['info'](_0xdef0('0x1c'),_0x4ca1e7);logger['debug']('UpdateWhatsappQueueReport',_0x4ca1e7,JSON[_0xdef0('0x13')](_0x150ac1));_0x15acc7(_0x150ac1);})[_0xdef0('0x1b')](function(_0x4ab230){logger['error'](_0xdef0('0x1c'),_0x4ab230[_0xdef0('0x16')],_0x4ca1e7);_0x143075(_0x3d8e1c['error'](0x1f4,_0x4ab230[_0xdef0('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 65b9aa6..55c647e 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 _0xf346=['isAuthenticated','index','get','/describe','describe','/:id','show','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf346,0xbf));var _0x6f34=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xf346[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require(_0x6f34('0x0'));var util=require(_0x6f34('0x1'));var path=require('path');var timeout=require(_0x6f34('0x2'));var express=require(_0x6f34('0x3'));var router=express[_0x6f34('0x4')]();var fs_extra=require(_0x6f34('0x5'));var auth=require(_0x6f34('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6f34('0x7'));var controller=require(_0x6f34('0x8'));router['get']('/',auth[_0x6f34('0x9')](),controller[_0x6f34('0xa')]);router[_0x6f34('0xb')](_0x6f34('0xc'),auth[_0x6f34('0x9')](),controller[_0x6f34('0xd')]);router[_0x6f34('0xb')](_0x6f34('0xe'),auth['isAuthenticated'](),controller[_0x6f34('0xf')]);router['post']('/',auth[_0x6f34('0x9')](),controller['create']);router['put'](_0x6f34('0xe'),auth[_0x6f34('0x9')](),controller[_0x6f34('0x10')]);router[_0x6f34('0x11')](_0x6f34('0xe'),auth['isAuthenticated'](),controller[_0x6f34('0x12')]);module[_0x6f34('0x13')]=router; \ No newline at end of file +var _0xa968=['describe','/:id','show','post','create','put','delete','exports','multer','path','express','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','get'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xa968,0x88));var _0x8a96=function(_0xc9504b,_0xe2f814){_0xc9504b=_0xc9504b-0x0;var _0x5e6894=_0xa968[_0xc9504b];return _0x5e6894;};'use strict';var multer=require(_0x8a96('0x0'));var util=require('util');var path=require(_0x8a96('0x1'));var timeout=require('connect-timeout');var express=require(_0x8a96('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8a96('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8a96('0x4'));var controller=require(_0x8a96('0x5'));router['get']('/',auth[_0x8a96('0x6')](),controller['index']);router[_0x8a96('0x7')]('/describe',auth[_0x8a96('0x6')](),controller[_0x8a96('0x8')]);router[_0x8a96('0x7')](_0x8a96('0x9'),auth[_0x8a96('0x6')](),controller[_0x8a96('0xa')]);router[_0x8a96('0xb')]('/',auth[_0x8a96('0x6')](),controller[_0x8a96('0xc')]);router[_0x8a96('0xd')](_0x8a96('0x9'),auth[_0x8a96('0x6')](),controller['update']);router[_0x8a96('0xe')](_0x8a96('0x9'),auth[_0x8a96('0x6')](),controller['destroy']);module[_0x8a96('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 707c9e3..b594c97 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 _0x5242=['exports','STRING','ENUM','account','queue','DATE','sequelize'];(function(_0x123cd1,_0x48cb5a){var _0x4c13ee=function(_0x1204cb){while(--_0x1204cb){_0x123cd1['push'](_0x123cd1['shift']());}};_0x4c13ee(++_0x48cb5a);}(_0x5242,0x148));var _0x2524=function(_0xd988c,_0xb3d978){_0xd988c=_0xd988c-0x0;var _0x1da62c=_0x5242[_0xd988c];return _0x1da62c;};'use strict';var Sequelize=require(_0x2524('0x0'));module[_0x2524('0x1')]={'uniqueid':{'type':Sequelize[_0x2524('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2524('0x3')](_0x2524('0x4'),'agent',_0x2524('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x2524('0x6')]}}; \ No newline at end of file +var _0xf08c=['exports','STRING','account','agent','queue','DATE','sequelize'];(function(_0xa99637,_0x3dbb51){var _0x59a591=function(_0x5d6325){while(--_0x5d6325){_0xa99637['push'](_0xa99637['shift']());}};_0x59a591(++_0x3dbb51);}(_0xf08c,0xb5));var _0xcf08=function(_0x18c512,_0x115f65){_0x18c512=_0x18c512-0x0;var _0x58fb36=_0xf08c[_0x18c512];return _0x58fb36;};'use strict';var Sequelize=require(_0xcf08('0x0'));module[_0xcf08('0x1')]={'uniqueid':{'type':Sequelize[_0xcf08('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xcf08('0x3'),_0xcf08('0x4'),_0xcf08('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xcf08('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 9e7941f..68bdaf3 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 _0x235d=['describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','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','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','then','end','error','stack','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','merge','find','create','body'];(function(_0x4fb110,_0x56f6b4){var _0x14b66a=function(_0x42b013){while(--_0x42b013){_0x4fb110['push'](_0x4fb110['shift']());}};_0x14b66a(++_0x56f6b4);}(_0x235d,0x9d));var _0xd235=function(_0x396101,_0x2d5b6c){_0x396101=_0x396101-0x0;var _0x4006c0=_0x235d[_0x396101];return _0x4006c0;};'use strict';var emlformat=require(_0xd235('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd235('0x1'));var jsonpatch=require(_0xd235('0x2'));var rp=require(_0xd235('0x3'));var moment=require(_0xd235('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd235('0x5'));var util=require(_0xd235('0x6'));var path=require(_0xd235('0x7'));var sox=require('sox');var csv=require(_0xd235('0x8'));var ejs=require(_0xd235('0x9'));var fs=require('fs');var fs_extra=require(_0xd235('0xa'));var _=require(_0xd235('0xb'));var squel=require('squel');var crypto=require(_0xd235('0xc'));var jsforce=require(_0xd235('0xd'));var deskjs=require(_0xd235('0xe'));var toCsv=require(_0xd235('0x8'));var querystring=require(_0xd235('0xf'));var Papa=require('papaparse');var Redis=require(_0xd235('0x10'));var authService=require(_0xd235('0x11'));var qs=require(_0xd235('0x12'));var as=require(_0xd235('0x13'));var hardwareService=require(_0xd235('0x14'));var logger=require(_0xd235('0x15'))(_0xd235('0x16'));var utils=require(_0xd235('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd235('0x18'));var db=require(_0xd235('0x19'))['db'];function respondWithStatusCode(_0x5c6abc,_0x5c3a7e){_0x5c3a7e=_0x5c3a7e||0xcc;return function(_0xa72649){if(_0xa72649){return _0x5c6abc[_0xd235('0x1a')](_0x5c3a7e);}return _0x5c6abc[_0xd235('0x1b')](_0x5c3a7e)['end']();};}function respondWithResult(_0x48b50f,_0xc5fd5a){_0xc5fd5a=_0xc5fd5a||0xc8;return function(_0x5f26e5){if(_0x5f26e5){return _0x48b50f['status'](_0xc5fd5a)[_0xd235('0x1c')](_0x5f26e5);}};}function respondWithFilteredResult(_0x27930a,_0x44414e){return function(_0x5c8baa){if(_0x5c8baa){var _0xaf33df=typeof _0x44414e[_0xd235('0x1d')]==='undefined'&&typeof _0x44414e[_0xd235('0x1e')]===_0xd235('0x1f');var _0x4f9fd5=_0x5c8baa[_0xd235('0x20')];var _0x1a45a7=_0xaf33df?0x0:_0x44414e[_0xd235('0x1d')];var _0x4622b8=_0xaf33df?_0x5c8baa[_0xd235('0x20')]:_0x44414e[_0xd235('0x1d')]+_0x44414e['limit'];var _0x5a570d;if(_0x4622b8>=_0x4f9fd5){_0x4622b8=_0x4f9fd5;_0x5a570d=0xc8;}else{_0x5a570d=0xce;}_0x27930a[_0xd235('0x1b')](_0x5a570d);return _0x27930a[_0xd235('0x21')](_0xd235('0x22'),_0x1a45a7+'-'+_0x4622b8+'/'+_0x4f9fd5)['json'](_0x5c8baa);}return null;};}function patchUpdates(_0x3eaade){return function(_0x1f6d88){try{jsonpatch['apply'](_0x1f6d88,_0x3eaade,!![]);}catch(_0x1cddde){return BPromise[_0xd235('0x23')](_0x1cddde);}return _0x1f6d88['save']();};}function saveUpdates(_0x7811d6,_0x346660){return function(_0x54544c){if(_0x54544c){return _0x54544c[_0xd235('0x24')](_0x7811d6)['then'](function(_0x52369f){return _0x52369f;});}return null;};}function removeEntity(_0x1a1960,_0x2d8540){return function(_0x19677f){if(_0x19677f){return _0x19677f[_0xd235('0x25')]()[_0xd235('0x26')](function(){_0x1a1960['status'](0xcc)[_0xd235('0x27')]();});}};}function handleEntityNotFound(_0x3578f6,_0x1034bd){return function(_0x5ae32a){if(!_0x5ae32a){_0x3578f6[_0xd235('0x1a')](0x194);}return _0x5ae32a;};}function handleError(_0x463dc4,_0x2d0f3c){_0x2d0f3c=_0x2d0f3c||0x1f4;return function(_0x5a3193){logger[_0xd235('0x28')](_0x5a3193[_0xd235('0x29')]);if(_0x5a3193[_0xd235('0x2a')]){delete _0x5a3193[_0xd235('0x2a')];}_0x463dc4[_0xd235('0x1b')](_0x2d0f3c)[_0xd235('0x2b')](_0x5a3193);};}exports[_0xd235('0x2c')]=function(_0x44b6f8,_0x41f24a){var _0x3dc051={},_0x50c336={},_0x31754a={'count':0x0,'rows':[]};var _0x24fba2=_['map'](db[_0xd235('0x2d')][_0xd235('0x2e')],function(_0x154311){return{'name':_0x154311[_0xd235('0x2f')],'type':_0x154311[_0xd235('0x30')][_0xd235('0x31')]};});_0x50c336['model']=_[_0xd235('0x32')](_0x24fba2,_0xd235('0x2a'));_0x50c336[_0xd235('0x33')]=_['keys'](_0x44b6f8[_0xd235('0x33')]);_0x50c336[_0xd235('0x34')]=_['intersection'](_0x50c336[_0xd235('0x35')],_0x50c336[_0xd235('0x33')]);_0x3dc051[_0xd235('0x36')]=_['intersection'](_0x50c336[_0xd235('0x35')],qs[_0xd235('0x37')](_0x44b6f8['query']['fields']));_0x3dc051[_0xd235('0x36')]=_0x3dc051[_0xd235('0x36')][_0xd235('0x38')]?_0x3dc051['attributes']:_0x50c336[_0xd235('0x35')];if(!_0x44b6f8[_0xd235('0x33')][_0xd235('0x39')](_0xd235('0x3a'))){_0x3dc051[_0xd235('0x1e')]=qs['limit'](_0x44b6f8['query'][_0xd235('0x1e')]);_0x3dc051[_0xd235('0x1d')]=qs['offset'](_0x44b6f8['query'][_0xd235('0x1d')]);}_0x3dc051['order']=qs[_0xd235('0x3b')](_0x44b6f8[_0xd235('0x33')][_0xd235('0x3b')]);_0x3dc051['where']=qs[_0xd235('0x34')](_[_0xd235('0x3c')](_0x44b6f8[_0xd235('0x33')],_0x50c336[_0xd235('0x34')]),_0x24fba2);if(_0x44b6f8['query']['filter']){_0x3dc051[_0xd235('0x3d')]=_['merge'](_0x3dc051['where'],{'$or':_[_0xd235('0x32')](_0x24fba2,function(_0x238658){if(_0x238658['type']!==_0xd235('0x3e')){var _0x3b88e4={};_0x3b88e4[_0x238658['name']]={'$like':'%'+_0x44b6f8[_0xd235('0x33')]['filter']+'%'};return _0x3b88e4;}})});}_0x3dc051=_['merge']({},_0x3dc051,_0x44b6f8[_0xd235('0x3f')]);var _0xa860d4={'where':_0x3dc051[_0xd235('0x3d')]};return db[_0xd235('0x2d')][_0xd235('0x20')](_0xa860d4)[_0xd235('0x26')](function(_0x497bd2){_0x31754a[_0xd235('0x20')]=_0x497bd2;if(_0x44b6f8[_0xd235('0x33')][_0xd235('0x40')]){_0x3dc051[_0xd235('0x41')]=[{'all':!![]}];}return db[_0xd235('0x2d')][_0xd235('0x42')](_0x3dc051);})['then'](function(_0x31e064){_0x31754a[_0xd235('0x43')]=_0x31e064;return _0x31754a;})['then'](respondWithFilteredResult(_0x41f24a,_0x3dc051))[_0xd235('0x44')](handleError(_0x41f24a,null));};exports[_0xd235('0x45')]=function(_0x2e6c54,_0x48861e){var _0x6e1141={'raw':!![],'where':{'id':_0x2e6c54[_0xd235('0x46')]['id']}},_0x6def0={};_0x6def0[_0xd235('0x35')]=_[_0xd235('0x47')](db['WhatsappTransferReport'][_0xd235('0x2e')]);_0x6def0[_0xd235('0x33')]=_[_0xd235('0x47')](_0x2e6c54[_0xd235('0x33')]);_0x6def0[_0xd235('0x34')]=_[_0xd235('0x48')](_0x6def0['model'],_0x6def0[_0xd235('0x33')]);_0x6e1141['attributes']=_[_0xd235('0x48')](_0x6def0[_0xd235('0x35')],qs[_0xd235('0x37')](_0x2e6c54['query'][_0xd235('0x37')]));_0x6e1141[_0xd235('0x36')]=_0x6e1141['attributes'][_0xd235('0x38')]?_0x6e1141[_0xd235('0x36')]:_0x6def0[_0xd235('0x35')];if(_0x2e6c54[_0xd235('0x33')][_0xd235('0x40')]){_0x6e1141[_0xd235('0x41')]=[{'all':!![]}];}_0x6e1141=_[_0xd235('0x49')]({},_0x6e1141,_0x2e6c54['options']);return db[_0xd235('0x2d')][_0xd235('0x4a')](_0x6e1141)['then'](handleEntityNotFound(_0x48861e,null))[_0xd235('0x26')](respondWithResult(_0x48861e,null))[_0xd235('0x44')](handleError(_0x48861e,null));};exports[_0xd235('0x4b')]=function(_0x588d55,_0x37eccf){return db[_0xd235('0x2d')][_0xd235('0x4b')](_0x588d55[_0xd235('0x4c')],{})['then'](respondWithResult(_0x37eccf,0xc9))['catch'](handleError(_0x37eccf,null));};exports[_0xd235('0x24')]=function(_0x2adcda,_0x98dcd2){if(_0x2adcda[_0xd235('0x4c')]['id']){delete _0x2adcda['body']['id'];}return db['WhatsappTransferReport'][_0xd235('0x4a')]({'where':{'id':_0x2adcda[_0xd235('0x46')]['id']}})[_0xd235('0x26')](handleEntityNotFound(_0x98dcd2,null))[_0xd235('0x26')](saveUpdates(_0x2adcda[_0xd235('0x4c')],null))[_0xd235('0x26')](respondWithResult(_0x98dcd2,null))[_0xd235('0x44')](handleError(_0x98dcd2,null));};exports[_0xd235('0x25')]=function(_0x2262dc,_0x19a55d){return db[_0xd235('0x2d')][_0xd235('0x4a')]({'where':{'id':_0x2262dc[_0xd235('0x46')]['id']}})['then'](handleEntityNotFound(_0x19a55d,null))[_0xd235('0x26')](removeEntity(_0x19a55d,null))[_0xd235('0x44')](handleError(_0x19a55d,null));};exports[_0xd235('0x4d')]=function(_0x3105e1,_0x163ac5){return db['WhatsappTransferReport'][_0xd235('0x4d')]()[_0xd235('0x26')](respondWithResult(_0x163ac5,null))['catch'](handleError(_0x163ac5,null));}; \ No newline at end of file +var _0x2dcf=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','squel','jsforce','desk.js'];(function(_0x4aef35,_0x280312){var _0x5880ce=function(_0x2ca253){while(--_0x2ca253){_0x4aef35['push'](_0x4aef35['shift']());}};_0x5880ce(++_0x280312);}(_0x2dcf,0x1b0));var _0xf2dc=function(_0x34c3ba,_0x4d1f3c){_0x34c3ba=_0x34c3ba-0x0;var _0x1c0a76=_0x2dcf[_0x34c3ba];return _0x1c0a76;};'use strict';var emlformat=require(_0xf2dc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf2dc('0x1'));var jsonpatch=require(_0xf2dc('0x2'));var rp=require('request-promise');var moment=require(_0xf2dc('0x3'));var BPromise=require(_0xf2dc('0x4'));var Mustache=require('mustache');var util=require(_0xf2dc('0x5'));var path=require(_0xf2dc('0x6'));var sox=require('sox');var csv=require(_0xf2dc('0x7'));var ejs=require(_0xf2dc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf2dc('0x9'));var crypto=require('crypto');var jsforce=require(_0xf2dc('0xa'));var deskjs=require(_0xf2dc('0xb'));var toCsv=require(_0xf2dc('0x7'));var querystring=require(_0xf2dc('0xc'));var Papa=require('papaparse');var Redis=require(_0xf2dc('0xd'));var authService=require(_0xf2dc('0xe'));var qs=require(_0xf2dc('0xf'));var as=require(_0xf2dc('0x10'));var hardwareService=require(_0xf2dc('0x11'));var logger=require(_0xf2dc('0x12'))(_0xf2dc('0x13'));var utils=require(_0xf2dc('0x14'));var config=require(_0xf2dc('0x15'));var licenseUtil=require(_0xf2dc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15bd5f,_0x18eac3){_0x18eac3=_0x18eac3||0xcc;return function(_0x1d6137){if(_0x1d6137){return _0x15bd5f[_0xf2dc('0x17')](_0x18eac3);}return _0x15bd5f[_0xf2dc('0x18')](_0x18eac3)['end']();};}function respondWithResult(_0x587062,_0x486538){_0x486538=_0x486538||0xc8;return function(_0x4f337b){if(_0x4f337b){return _0x587062[_0xf2dc('0x18')](_0x486538)[_0xf2dc('0x19')](_0x4f337b);}};}function respondWithFilteredResult(_0x1d28bd,_0x214922){return function(_0x55defa){if(_0x55defa){var _0x4e3d2a=typeof _0x214922[_0xf2dc('0x1a')]==='undefined'&&typeof _0x214922[_0xf2dc('0x1b')]==='undefined';var _0x15858d=_0x55defa[_0xf2dc('0x1c')];var _0x8436f9=_0x4e3d2a?0x0:_0x214922[_0xf2dc('0x1a')];var _0x4c9ab1=_0x4e3d2a?_0x55defa['count']:_0x214922[_0xf2dc('0x1a')]+_0x214922[_0xf2dc('0x1b')];var _0x36228c;if(_0x4c9ab1>=_0x15858d){_0x4c9ab1=_0x15858d;_0x36228c=0xc8;}else{_0x36228c=0xce;}_0x1d28bd[_0xf2dc('0x18')](_0x36228c);return _0x1d28bd[_0xf2dc('0x1d')]('Content-Range',_0x8436f9+'-'+_0x4c9ab1+'/'+_0x15858d)[_0xf2dc('0x19')](_0x55defa);}return null;};}function patchUpdates(_0x197b13){return function(_0x4ea49d){try{jsonpatch[_0xf2dc('0x1e')](_0x4ea49d,_0x197b13,!![]);}catch(_0x1602ac){return BPromise[_0xf2dc('0x1f')](_0x1602ac);}return _0x4ea49d[_0xf2dc('0x20')]();};}function saveUpdates(_0x4ce3e3,_0x33e050){return function(_0x51119e){if(_0x51119e){return _0x51119e[_0xf2dc('0x21')](_0x4ce3e3)[_0xf2dc('0x22')](function(_0x524651){return _0x524651;});}return null;};}function removeEntity(_0xea6038,_0x499139){return function(_0x36c8a3){if(_0x36c8a3){return _0x36c8a3[_0xf2dc('0x23')]()[_0xf2dc('0x22')](function(){_0xea6038[_0xf2dc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ef4d1,_0x3a973c){return function(_0x2e2f2c){if(!_0x2e2f2c){_0x3ef4d1['sendStatus'](0x194);}return _0x2e2f2c;};}function handleError(_0x505041,_0x116f09){_0x116f09=_0x116f09||0x1f4;return function(_0x59302d){logger[_0xf2dc('0x24')](_0x59302d['stack']);if(_0x59302d['name']){delete _0x59302d[_0xf2dc('0x25')];}_0x505041[_0xf2dc('0x18')](_0x116f09)[_0xf2dc('0x26')](_0x59302d);};}exports[_0xf2dc('0x27')]=function(_0x3cba46,_0x182752){var _0x2d62ae={},_0x471185={},_0x49052f={'count':0x0,'rows':[]};var _0x528f4f=_[_0xf2dc('0x28')](db[_0xf2dc('0x29')][_0xf2dc('0x2a')],function(_0x3428fc){return{'name':_0x3428fc[_0xf2dc('0x2b')],'type':_0x3428fc[_0xf2dc('0x2c')][_0xf2dc('0x2d')]};});_0x471185['model']=_[_0xf2dc('0x28')](_0x528f4f,'name');_0x471185['query']=_['keys'](_0x3cba46[_0xf2dc('0x2e')]);_0x471185[_0xf2dc('0x2f')]=_[_0xf2dc('0x30')](_0x471185[_0xf2dc('0x31')],_0x471185['query']);_0x2d62ae[_0xf2dc('0x32')]=_[_0xf2dc('0x30')](_0x471185[_0xf2dc('0x31')],qs[_0xf2dc('0x33')](_0x3cba46[_0xf2dc('0x2e')][_0xf2dc('0x33')]));_0x2d62ae['attributes']=_0x2d62ae[_0xf2dc('0x32')][_0xf2dc('0x34')]?_0x2d62ae[_0xf2dc('0x32')]:_0x471185[_0xf2dc('0x31')];if(!_0x3cba46[_0xf2dc('0x2e')][_0xf2dc('0x35')](_0xf2dc('0x36'))){_0x2d62ae[_0xf2dc('0x1b')]=qs[_0xf2dc('0x1b')](_0x3cba46['query']['limit']);_0x2d62ae['offset']=qs[_0xf2dc('0x1a')](_0x3cba46[_0xf2dc('0x2e')][_0xf2dc('0x1a')]);}_0x2d62ae[_0xf2dc('0x37')]=qs[_0xf2dc('0x38')](_0x3cba46[_0xf2dc('0x2e')][_0xf2dc('0x38')]);_0x2d62ae[_0xf2dc('0x39')]=qs[_0xf2dc('0x2f')](_[_0xf2dc('0x3a')](_0x3cba46[_0xf2dc('0x2e')],_0x471185[_0xf2dc('0x2f')]),_0x528f4f);if(_0x3cba46[_0xf2dc('0x2e')][_0xf2dc('0x3b')]){_0x2d62ae['where']=_[_0xf2dc('0x3c')](_0x2d62ae[_0xf2dc('0x39')],{'$or':_[_0xf2dc('0x28')](_0x528f4f,function(_0xafc5f9){if(_0xafc5f9['type']!==_0xf2dc('0x3d')){var _0x3280b0={};_0x3280b0[_0xafc5f9[_0xf2dc('0x25')]]={'$like':'%'+_0x3cba46[_0xf2dc('0x2e')][_0xf2dc('0x3b')]+'%'};return _0x3280b0;}})});}_0x2d62ae=_[_0xf2dc('0x3c')]({},_0x2d62ae,_0x3cba46[_0xf2dc('0x3e')]);var _0x1e6576={'where':_0x2d62ae[_0xf2dc('0x39')]};return db[_0xf2dc('0x29')][_0xf2dc('0x1c')](_0x1e6576)[_0xf2dc('0x22')](function(_0x382b5d){_0x49052f[_0xf2dc('0x1c')]=_0x382b5d;if(_0x3cba46[_0xf2dc('0x2e')][_0xf2dc('0x3f')]){_0x2d62ae[_0xf2dc('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xf2dc('0x41')](_0x2d62ae);})[_0xf2dc('0x22')](function(_0x8ac447){_0x49052f['rows']=_0x8ac447;return _0x49052f;})[_0xf2dc('0x22')](respondWithFilteredResult(_0x182752,_0x2d62ae))[_0xf2dc('0x42')](handleError(_0x182752,null));};exports[_0xf2dc('0x43')]=function(_0x47d1db,_0x3506a8){var _0x4edfc1={'raw':!![],'where':{'id':_0x47d1db['params']['id']}},_0x108cbe={};_0x108cbe[_0xf2dc('0x31')]=_[_0xf2dc('0x44')](db[_0xf2dc('0x29')]['rawAttributes']);_0x108cbe[_0xf2dc('0x2e')]=_[_0xf2dc('0x44')](_0x47d1db[_0xf2dc('0x2e')]);_0x108cbe[_0xf2dc('0x2f')]=_[_0xf2dc('0x30')](_0x108cbe[_0xf2dc('0x31')],_0x108cbe[_0xf2dc('0x2e')]);_0x4edfc1[_0xf2dc('0x32')]=_[_0xf2dc('0x30')](_0x108cbe['model'],qs[_0xf2dc('0x33')](_0x47d1db[_0xf2dc('0x2e')]['fields']));_0x4edfc1[_0xf2dc('0x32')]=_0x4edfc1['attributes'][_0xf2dc('0x34')]?_0x4edfc1[_0xf2dc('0x32')]:_0x108cbe[_0xf2dc('0x31')];if(_0x47d1db[_0xf2dc('0x2e')][_0xf2dc('0x3f')]){_0x4edfc1[_0xf2dc('0x40')]=[{'all':!![]}];}_0x4edfc1=_[_0xf2dc('0x3c')]({},_0x4edfc1,_0x47d1db[_0xf2dc('0x3e')]);return db['WhatsappTransferReport'][_0xf2dc('0x45')](_0x4edfc1)[_0xf2dc('0x22')](handleEntityNotFound(_0x3506a8,null))['then'](respondWithResult(_0x3506a8,null))['catch'](handleError(_0x3506a8,null));};exports[_0xf2dc('0x46')]=function(_0x21a7be,_0x2e05fb){return db['WhatsappTransferReport'][_0xf2dc('0x46')](_0x21a7be[_0xf2dc('0x47')],{})[_0xf2dc('0x22')](respondWithResult(_0x2e05fb,0xc9))['catch'](handleError(_0x2e05fb,null));};exports['update']=function(_0x51f3e6,_0x51d23a){if(_0x51f3e6['body']['id']){delete _0x51f3e6[_0xf2dc('0x47')]['id'];}return db[_0xf2dc('0x29')]['find']({'where':{'id':_0x51f3e6['params']['id']}})[_0xf2dc('0x22')](handleEntityNotFound(_0x51d23a,null))[_0xf2dc('0x22')](saveUpdates(_0x51f3e6[_0xf2dc('0x47')],null))[_0xf2dc('0x22')](respondWithResult(_0x51d23a,null))[_0xf2dc('0x42')](handleError(_0x51d23a,null));};exports[_0xf2dc('0x23')]=function(_0x448bb2,_0x2d719e){return db['WhatsappTransferReport'][_0xf2dc('0x45')]({'where':{'id':_0x448bb2[_0xf2dc('0x48')]['id']}})[_0xf2dc('0x22')](handleEntityNotFound(_0x2d719e,null))['then'](removeEntity(_0x2d719e,null))[_0xf2dc('0x42')](handleError(_0x2d719e,null));};exports[_0xf2dc('0x49')]=function(_0x33f6c9,_0x1baf94){return db[_0xf2dc('0x29')][_0xf2dc('0x49')]()['then'](respondWithResult(_0x1baf94,null))[_0xf2dc('0x42')](handleError(_0x1baf94,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index aef93af..dba0369 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 _0x9b8a=['./whatsappTransferReport.attributes','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x43282c,_0xa3b93b){var _0x4b15ec=function(_0x55e067){while(--_0x55e067){_0x43282c['push'](_0x43282c['shift']());}};_0x4b15ec(++_0xa3b93b);}(_0x9b8a,0xdc));var _0xa9b8=function(_0x5a3a81,_0x5e862f){_0x5a3a81=_0x5a3a81-0x0;var _0x59f7fa=_0x9b8a[_0x5a3a81];return _0x59f7fa;};'use strict';var _=require(_0xa9b8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa9b8('0x1'));var moment=require(_0xa9b8('0x2'));var BPromise=require(_0xa9b8('0x3'));var rp=require(_0xa9b8('0x4'));var fs=require('fs');var path=require(_0xa9b8('0x5'));var rimraf=require(_0xa9b8('0x6'));var config=require(_0xa9b8('0x7'));var attributes=require(_0xa9b8('0x8'));module['exports']=function(_0x4d9ed5,_0x14a910){return _0x4d9ed5['define'](_0xa9b8('0x9'),attributes,{'tableName':_0xa9b8('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa9b8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x26b0=['bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x4c3ac3,_0x7177d8){var _0xd7ff02=function(_0x5b9ac8){while(--_0x5b9ac8){_0x4c3ac3['push'](_0x4c3ac3['shift']());}};_0xd7ff02(++_0x7177d8);}(_0x26b0,0x14e));var _0x026b=function(_0x2e23f7,_0x35f041){_0x2e23f7=_0x2e23f7-0x0;var _0x436114=_0x26b0[_0x2e23f7];return _0x436114;};'use strict';var _=require(_0x026b('0x0'));var util=require(_0x026b('0x1'));var logger=require(_0x026b('0x2'))('api');var moment=require(_0x026b('0x3'));var BPromise=require(_0x026b('0x4'));var rp=require(_0x026b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x026b('0x6'));var config=require(_0x026b('0x7'));var attributes=require(_0x026b('0x8'));module[_0x026b('0x9')]=function(_0x3436be,_0x38a6ff){return _0x3436be[_0x026b('0xa')](_0x026b('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x026b('0xc'),'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 26f8951..83db10f 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 _0x9cec=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis'];(function(_0x6aaf7a,_0x2ddf35){var _0x522e20=function(_0x5b6e19){while(--_0x5b6e19){_0x6aaf7a['push'](_0x6aaf7a['shift']());}};_0x522e20(++_0x2ddf35);}(_0x9cec,0x178));var _0xc9ce=function(_0x313df3,_0x4fca45){_0x313df3=_0x313df3-0x0;var _0x241d59=_0x9cec[_0x313df3];return _0x241d59;};'use strict';var _=require(_0xc9ce('0x0'));var util=require(_0xc9ce('0x1'));var moment=require(_0xc9ce('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9ce('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9ce('0x4'));var logger=require(_0xc9ce('0x5'))('rpc');var config=require(_0xc9ce('0x6'));var jayson=require(_0xc9ce('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3892ec,_0x56099c,_0x113749){return new BPromise(function(_0x4477ec,_0x201650){return client[_0xc9ce('0x8')](_0x3892ec,_0x113749)['then'](function(_0x2677a1){logger[_0xc9ce('0x9')](_0xc9ce('0xa'),_0x56099c,_0xc9ce('0xb'));logger[_0xc9ce('0xc')](_0xc9ce('0xd'),_0x56099c,_0xc9ce('0xb'),JSON[_0xc9ce('0xe')](_0x2677a1));if(_0x2677a1[_0xc9ce('0xf')]){if(_0x2677a1['error'][_0xc9ce('0x10')]===0x1f4){logger['error'](_0xc9ce('0xa'),_0x56099c,_0x2677a1[_0xc9ce('0xf')]['message']);return _0x201650(_0x2677a1[_0xc9ce('0xf')][_0xc9ce('0x11')]);}logger[_0xc9ce('0xf')](_0xc9ce('0xa'),_0x56099c,_0x2677a1[_0xc9ce('0xf')][_0xc9ce('0x11')]);return _0x4477ec(_0x2677a1['error']['message']);}else{logger[_0xc9ce('0x9')](_0xc9ce('0xa'),_0x56099c,_0xc9ce('0xb'));_0x4477ec(_0x2677a1[_0xc9ce('0x12')]['message']);}})[_0xc9ce('0x13')](function(_0xe5c035){logger[_0xc9ce('0xf')](_0xc9ce('0xa'),_0x56099c,_0xe5c035);_0x201650(_0xe5c035);});});} \ No newline at end of file +var _0x5d65=['../../config/logger','rpc','../../config/environment','jayson/promise','http','info','WhatsappTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2a3847,_0x1b512c){var _0xeb305=function(_0x108523){while(--_0x108523){_0x2a3847['push'](_0x2a3847['shift']());}};_0xeb305(++_0x1b512c);}(_0x5d65,0x1f2));var _0x55d6=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x5d65[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require(_0x55d6('0x0'));var util=require(_0x55d6('0x1'));var moment=require(_0x55d6('0x2'));var BPromise=require(_0x55d6('0x3'));var rs=require(_0x55d6('0x4'));var fs=require('fs');var Redis=require(_0x55d6('0x5'));var db=require(_0x55d6('0x6'))['db'];var utils=require(_0x55d6('0x7'));var logger=require(_0x55d6('0x8'))(_0x55d6('0x9'));var config=require(_0x55d6('0xa'));var jayson=require(_0x55d6('0xb'));var client=jayson['client'][_0x55d6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5dc5b9,_0x269ba2,_0x2069f2){return new BPromise(function(_0x2f4b3d,_0x9a19f9){return client['request'](_0x5dc5b9,_0x2069f2)['then'](function(_0x1438ef){logger[_0x55d6('0xd')](_0x55d6('0xe'),_0x269ba2,'request\x20sent');logger[_0x55d6('0xf')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x269ba2,_0x55d6('0x10'),JSON[_0x55d6('0x11')](_0x1438ef));if(_0x1438ef[_0x55d6('0x12')]){if(_0x1438ef[_0x55d6('0x12')][_0x55d6('0x13')]===0x1f4){logger[_0x55d6('0x12')](_0x55d6('0xe'),_0x269ba2,_0x1438ef['error']['message']);return _0x9a19f9(_0x1438ef['error'][_0x55d6('0x14')]);}logger[_0x55d6('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x269ba2,_0x1438ef[_0x55d6('0x12')]['message']);return _0x2f4b3d(_0x1438ef['error'][_0x55d6('0x14')]);}else{logger[_0x55d6('0xd')](_0x55d6('0xe'),_0x269ba2,_0x55d6('0x10'));_0x2f4b3d(_0x1438ef[_0x55d6('0x15')][_0x55d6('0x14')]);}})[_0x55d6('0x16')](function(_0xd829f5){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x269ba2,_0xd829f5);_0x9a19f9(_0xd829f5);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 045dcbc..e8fd64b 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a2d=['start','filter','exitCode','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','Offline\x20apps:','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info'];(function(_0x4703b9,_0x546f25){var _0x207040=function(_0x2676e7){while(--_0x2676e7){_0x4703b9['push'](_0x4703b9['shift']());}};_0x207040(++_0x546f25);}(_0x7a2d,0x142));var _0xd7a2=function(_0x482df4,_0x4afe04){_0x482df4=_0x482df4-0x0;var _0x45ef02=_0x7a2d[_0x482df4];return _0x45ef02;};'use strict';var _=require(_0xd7a2('0x0'));var db=require(_0xd7a2('0x1'))['db'];var seedDb=require(_0xd7a2('0x2'));var checkLicense=require(_0xd7a2('0x3'));var rpc=require(_0xd7a2('0x4'));var config=require(_0xd7a2('0x5'));var logger=require(_0xd7a2('0x6'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0xd7a2('0x7'));var schedule=require(_0xd7a2('0x8'));var chat=require(_0xd7a2('0x9'));var whatsapp=require(_0xd7a2('0xa'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xd7a2('0xb'));function main(){return db[_0xd7a2('0xc')][_0xd7a2('0xd')]()[_0xd7a2('0xe')](function(){if(config[_0xd7a2('0xf')]){return seedDb[_0xd7a2('0x10')]();}})[_0xd7a2('0xe')](function(){return checkLicense[_0xd7a2('0x10')]();})[_0xd7a2('0xe')](function(){return rpc['listen']();})[_0xd7a2('0xe')](function(_0x319795){logger[_0xd7a2('0x11')](_0x319795);return chat[_0xd7a2('0x12')]();})[_0xd7a2('0xe')](function(){return whatsapp[_0xd7a2('0x12')]();})[_0xd7a2('0xe')](function(){return schedule['start']();})['then'](function(){return transcribe[_0xd7a2('0x12')]();})['then'](function(){return provider[_0xd7a2('0x12')]();})[_0xd7a2('0xe')](function(_0xfac7c9){logger[_0xd7a2('0x11')](_0xfac7c9);return pm2[_0xd7a2('0x12')](pm2Config);})[_0xd7a2('0xe')](function(_0x42a6c5){var _0x1e0ab5=_0x42a6c5[_0xd7a2('0x13')](function(_0x16e2d6){return typeof _0x16e2d6[_0xd7a2('0x14')]==='number'&&_0x16e2d6[_0xd7a2('0x14')]>=0x0;});if(_0x1e0ab5['length']>0x0){throw new Error(_0x1e0ab5['length']+_0xd7a2('0x15')+_[_0xd7a2('0x16')](_0x1e0ab5,function(_0x2e8c80){return'\x22'+_0x2e8c80[_0xd7a2('0x17')][_0xd7a2('0x18')]+'\x22';}));}logger[_0xd7a2('0x11')]('Online\x20apps:',_['map'](_[_0xd7a2('0x13')](_0x42a6c5,{'status':_0xd7a2('0x19')}),_0xd7a2('0x18'))['join']());logger['info'](_0xd7a2('0x1a'),_['map'](_['filter'](_0x42a6c5,function(_0x217c19){return _0x217c19['status']!=='online';}),_0xd7a2('0x18'))['join']()||'None');console['log'](_0xd7a2('0x1b'));})[_0xd7a2('0x1c')](function(_0x4458d5){console[_0xd7a2('0x1d')](_0xd7a2('0x1e'),_0x4458d5);logger[_0xd7a2('0x1f')](_0xd7a2('0x20'),_0x4458d5);process[_0xd7a2('0x21')](0x1);});}main(); \ No newline at end of file +var _0x0738=['./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','Offline\x20apps:','status','join','None','App\x20Ready!','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule'];(function(_0x3e5ee7,_0x148db7){var _0x3fe720=function(_0x5952ba){while(--_0x5952ba){_0x3e5ee7['push'](_0x3e5ee7['shift']());}};_0x3fe720(++_0x148db7);}(_0x0738,0x6e));var _0x8073=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x0738[_0x1b70e3];return _0x1452ab;};'use strict';var _=require(_0x8073('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x8073('0x1'));var checkLicense=require(_0x8073('0x2'));var rpc=require(_0x8073('0x3'));var config=require(_0x8073('0x4'));var logger=require(_0x8073('0x5'))(_0x8073('0x6'));var pm2=require(_0x8073('0x7'));var pm2Config=require(_0x8073('0x8'));var schedule=require(_0x8073('0x9'));var chat=require(_0x8073('0xa'));var whatsapp=require(_0x8073('0xb'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x8073('0xc'));function main(){return db[_0x8073('0xd')][_0x8073('0xe')]()[_0x8073('0xf')](function(){if(config[_0x8073('0x10')]){return seedDb[_0x8073('0x11')]();}})[_0x8073('0xf')](function(){return checkLicense[_0x8073('0x11')]();})[_0x8073('0xf')](function(){return rpc['listen']();})['then'](function(_0x28e17b){logger[_0x8073('0x12')](_0x28e17b);return chat[_0x8073('0x13')]();})[_0x8073('0xf')](function(){return whatsapp['start']();})[_0x8073('0xf')](function(){return schedule[_0x8073('0x13')]();})['then'](function(){return transcribe[_0x8073('0x13')]();})['then'](function(){return provider[_0x8073('0x13')]();})[_0x8073('0xf')](function(_0x10c69a){logger[_0x8073('0x12')](_0x10c69a);return pm2['start'](pm2Config);})[_0x8073('0xf')](function(_0x459644){var _0x116aa=_0x459644[_0x8073('0x14')](function(_0x2ec7af){return typeof _0x2ec7af[_0x8073('0x15')]===_0x8073('0x16')&&_0x2ec7af['exitCode']>=0x0;});if(_0x116aa[_0x8073('0x17')]>0x0){throw new Error(_0x116aa['length']+_0x8073('0x18')+_[_0x8073('0x19')](_0x116aa,function(_0x1d1541){return'\x22'+_0x1d1541[_0x8073('0x1a')][_0x8073('0x1b')]+'\x22';}));}logger[_0x8073('0x12')](_0x8073('0x1c'),_[_0x8073('0x19')](_[_0x8073('0x14')](_0x459644,{'status':_0x8073('0x1d')}),'name')['join']());logger[_0x8073('0x12')](_0x8073('0x1e'),_['map'](_[_0x8073('0x14')](_0x459644,function(_0x3e4395){return _0x3e4395[_0x8073('0x1f')]!==_0x8073('0x1d');}),_0x8073('0x1b'))[_0x8073('0x20')]()||_0x8073('0x21'));console['log'](_0x8073('0x22'));})['catch'](function(_0x24b515){console[_0x8073('0x23')](_0x8073('0x24'),_0x24b515);logger[_0x8073('0x25')](_0x8073('0x26'),_0x24b515);process[_0x8073('0x27')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 332dbcb..fcb400e 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 _0xc7cd=['hex','floor','now','HS512','../../mysqldb','../../config/environment','../encryptor','lodash','express-jwt','basic-auth','crypto','bluebird','util','moment','secrets','session','role','name','email','userpic','permissions','voicePause','chatPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','disposition','closed','query','forceDownload','status','json','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','find','sub','then','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','use','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','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.','ValidationError','updatePasswordsHistory','splice','unshift','encryptString','promisify','sign','secret','verify','randomBytes','toString'];(function(_0x4bdee5,_0x5c1038){var _0x3a5033=function(_0x849355){while(--_0x849355){_0x4bdee5['push'](_0x4bdee5['shift']());}};_0x3a5033(++_0x5c1038);}(_0xc7cd,0x1b4));var _0xdc7c=function(_0x3f9508,_0x4e24b4){_0x3f9508=_0x3f9508-0x0;var _0x4e8c7f=_0xc7cd[_0x3f9508];return _0x4e8c7f;};'use strict';var db=require(_0xdc7c('0x0'))['db'];var config=require(_0xdc7c('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0xdc7c('0x2'));var _=require(_0xdc7c('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xdc7c('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0xdc7c('0x5'));var crypto=require(_0xdc7c('0x6'));var BPromise=require(_0xdc7c('0x7'));var util=require(_0xdc7c('0x8'));var moment=require(_0xdc7c('0x9'));var validateJwt=expressJwt({'secret':config[_0xdc7c('0xa')][_0xdc7c('0xb')]});var userAttributes=['id',_0xdc7c('0xc'),'fullname',_0xdc7c('0xd'),'internal',_0xdc7c('0xe'),_0xdc7c('0xf'),_0xdc7c('0x10'),'md5secret',_0xdc7c('0x11'),_0xdc7c('0x12'),'mailPause','faxPause','smsPause','openchannelPause',_0xdc7c('0x13'),_0xdc7c('0x14'),_0xdc7c('0x15'),_0xdc7c('0x16'),_0xdc7c('0x17'),_0xdc7c('0x18'),_0xdc7c('0x19'),_0xdc7c('0x1a'),_0xdc7c('0x1b'),'phoneBarAutoAnswerDelay',_0xdc7c('0x1c'),'phoneBarEnableRecording',_0xdc7c('0x1d'),'phoneBarEnableSettings',_0xdc7c('0x1e'),_0xdc7c('0x1f'),_0xdc7c('0x20'),_0xdc7c('0x21'),_0xdc7c('0x22'),_0xdc7c('0x23'),_0xdc7c('0x24'),_0xdc7c('0x25'),_0xdc7c('0x26'),_0xdc7c('0x27'),_0xdc7c('0x28'),_0xdc7c('0x29'),_0xdc7c('0x2a'),_0xdc7c('0x2b'),'selectRecallMeCampaign',_0xdc7c('0x2c'),_0xdc7c('0x2d'),_0xdc7c('0x2e'),_0xdc7c('0x2f'),_0xdc7c('0x30'),'smsAutoanswerDelay','openchannelAutoanswer',_0xdc7c('0x31'),_0xdc7c('0x32'),_0xdc7c('0x33'),_0xdc7c('0x34'),_0xdc7c('0x35'),_0xdc7c('0x36')];exports[_0xdc7c('0x37')]=function(){return this[_0xdc7c('0x38')](!![])['use'](function(_0x3338a1,_0xc92e2c,_0x1a371b){if(_0x3338a1[_0xdc7c('0x39')]){_0x1a371b();}else{return db[_0xdc7c('0x3a')][_0xdc7c('0x3b')]({'where':{'id':_0x3338a1[_0xdc7c('0x3c')]['id']},'attributes':['id','closed',_0xdc7c('0x3d')],'raw':!![]})['then'](function(_0x2833e7){if(_0x2833e7&&_0x2833e7[_0xdc7c('0x3e')]&&!_0x3338a1[_0xdc7c('0x3f')][_0xdc7c('0x40')]){return _0xc92e2c[_0xdc7c('0x41')](_0x2833e7[_0xdc7c('0x3d')]==='unmanaged'?0x195:0x193)[_0xdc7c('0x42')]({'message':_0x2833e7[_0xdc7c('0x3d')]===_0xdc7c('0x43')?_0xdc7c('0x44'):_0xdc7c('0x45')});}else{_0x1a371b();}})[_0xdc7c('0x46')](function(_0x510c3c){_0x1a371b(_0x510c3c);});}});};exports['isAuthenticated']=function isAuthenticated(_0x4dbeb7){return compose()['use'](function(_0x313499,_0x3100f0,_0x4bc0b9){var _0xf4265f;if(_0x313499[_0xdc7c('0x47')][_0xdc7c('0x48')]){if(_[_0xdc7c('0x49')](_0x313499[_0xdc7c('0x47')]['authorization'],_0xdc7c('0x4a'))){var _0x5350a7=basicAuth(_0x313499);db[_0xdc7c('0x4b')]['find']({'where':{'name':_0x5350a7[_0xdc7c('0xd')]}})['then'](function(_0x5aaaf1){if(!_0x5aaaf1||!_0x5aaaf1[_0xdc7c('0x4c')](_0x5350a7[_0xdc7c('0x4d')])){return _0x3100f0[_0xdc7c('0x41')](0x191)['json']({'message':_0xdc7c('0x4e')});}_0x313499[_0xdc7c('0x39')]={'id':_0x5aaaf1['id']};_0x4bc0b9();})[_0xdc7c('0x46')](function(_0x31d511){_0x4bc0b9(_0x31d511);});}else if(_[_0xdc7c('0x49')](_0x313499[_0xdc7c('0x47')]['authorization'],_0xdc7c('0x4f'))){validateJwt(_0x313499,_0x3100f0,_0x4bc0b9);}else{if(_0x4dbeb7){_0x4bc0b9();}else{return _0x3100f0[_0xdc7c('0x41')](0x193)['json']({'message':_0xdc7c('0x50')});}}}else if(_0x313499['query'][_0xdc7c('0x51')]){try{var _0xe66aa1={'audience':hardwareConf[_0xdc7c('0x52')](),'issuer':hardwareConf[_0xdc7c('0x52')]()};verifyJwt(_0x313499[_0xdc7c('0x3f')][_0xdc7c('0x51')],_0xe66aa1)['then'](function(_0x5d7c0d){return db[_0xdc7c('0x4b')][_0xdc7c('0x53')]({'where':{'id':_0x5d7c0d[_0xdc7c('0x54')]}})[_0xdc7c('0x55')](function(_0x4f135f){_0xf4265f=_0x4f135f;return db['Setting'][_0xdc7c('0x3b')]({'where':{'id':0x1},'attributes':[_0xdc7c('0x56'),_0xdc7c('0x57')],'raw':!![]});})['then'](function(_0x210b7b){if(!_0xf4265f||!_[_0xdc7c('0x58')](_0xf4265f[_0xdc7c('0x59')],_0x5d7c0d[_0xdc7c('0x5a')])){return _0x3100f0[_0xdc7c('0x41')](0x191)[_0xdc7c('0x42')]({'message':_0xdc7c('0x5b')});}if(_0xf4265f[_0xdc7c('0x5c')]){return _0x3100f0[_0xdc7c('0x41')](0x191)[_0xdc7c('0x42')]({'message':_0xdc7c('0x5d')});}if(_0xf4265f[_0xdc7c('0x5e')]){if(_0x210b7b[_0xdc7c('0x57')]>0x0){if(moment(_0xf4265f[_0xdc7c('0x5f')])[_0xdc7c('0x60')](_0x210b7b[_0xdc7c('0x57')],_0xdc7c('0x61'))>moment()){return _0x3100f0[_0xdc7c('0x41')](0x191)[_0xdc7c('0x42')]({'message':_0xdc7c('0x5d')});}}else{return _0x3100f0[_0xdc7c('0x41')](0x191)['json']({'message':_0xdc7c('0x5d')});}}_0x313499[_0xdc7c('0x39')]={'id':_0xf4265f['id']};_0x4bc0b9();});})[_0xdc7c('0x46')](function(){return _0x3100f0['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1d9629){_0x4bc0b9(_0x1d9629);}}else if(_0x4dbeb7){_0x4bc0b9();}else{return _0x3100f0[_0xdc7c('0x41')](0x193)['json']({'message':_0xdc7c('0x50')});}})['use'](function(_0x398ae4,_0x228d09,_0x2ad7ff){if(_0x398ae4[_0xdc7c('0x39')]){db['User'][_0xdc7c('0x53')]({'where':{'id':_0x398ae4[_0xdc7c('0x39')]['id']},'attributes':userAttributes})[_0xdc7c('0x55')](function(_0x5df647){if(!_0x5df647){return _0x228d09[_0xdc7c('0x41')](0x194)['json']({'message':_0xdc7c('0x62')});}_0x398ae4[_0xdc7c('0x39')]=_0x5df647;_0x2ad7ff();})[_0xdc7c('0x46')](function(_0x453f20){_0x2ad7ff(_0x453f20);});}else if(_0x4dbeb7){_0x2ad7ff();}else{return _0x228d09[_0xdc7c('0x41')](0x194)['json']({'message':_0xdc7c('0x63')});}});};exports[_0xdc7c('0x64')]=function canUpdate(){return compose()['use'](function(_0x4ebcad,_0x40725b,_0x336608){return licenseUtil[_0xdc7c('0x65')]()['then'](function(_0x5e1fa4){if(_0x5e1fa4['update']){_0x336608();}else{return _0x40725b['status'](0x193)['json']({'message':_0xdc7c('0x66')});}})[_0xdc7c('0x46')](function(_0x400b03){_0x336608(_0x400b03);});});};exports[_0xdc7c('0x67')]=function isWebrtcLicence(){return compose()[_0xdc7c('0x68')](function(_0x13e91b,_0xec0753,_0x459c1){return licenseUtil[_0xdc7c('0x65')]()[_0xdc7c('0x55')](function(_0x38323b){if(_0x38323b[_0xdc7c('0x69')]){_0x459c1();}else{return _0xec0753['status'](0x193)[_0xdc7c('0x42')]({'message':'Forbidden'});}})['catch'](function(_0x34848){_0x459c1(_0x34848);});});};exports[_0xdc7c('0x6a')]=function(_0x5143e5,_0x4dbd39,_0x12d032){_0x5143e5[_0xdc7c('0x6a')]=!![];return _0x12d032();};exports[_0xdc7c('0x6b')]=function signToken(_0x1ea6e0){return signJwt(_0x1ea6e0);};exports['setTokenCookie']=function(_0x2cb10e,_0x55e2c4){if(!_0x2cb10e[_0xdc7c('0x39')]){return _0x55e2c4['status'](0x194)[_0xdc7c('0x42')]({'message':_0xdc7c('0x6c')});}var _0xf67d7={'payload':{'id':_0x2cb10e[_0xdc7c('0x39')]['id'],'role':_0x2cb10e[_0xdc7c('0x39')][_0xdc7c('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0xf67d7)[_0xdc7c('0x55')](function(_0x59c617){_0x55e2c4[_0xdc7c('0x6d')](_0xdc7c('0x6e'),_0x59c617);_0x55e2c4[_0xdc7c('0x6f')](_0xdc7c('0x70'));})[_0xdc7c('0x46')](function(_0x4dac34){return _0x55e2c4['status'](0x1f4)[_0xdc7c('0x71')](_0x4dac34);});};exports[_0xdc7c('0x72')]=function(_0x1197d0){if(_['isNil'](_0x1197d0[_0xdc7c('0x59')])||_['isNil'](_0x1197d0[_0xdc7c('0x73')])){return null;}else{return createJwt(_0x1197d0);}};exports[_0xdc7c('0x74')]=function(_0x52fc4b){_0x52fc4b[_0xdc7c('0x59')]=generateNonce();_0x52fc4b[_0xdc7c('0x73')]=generateIssuedAt();return createJwt(_0x52fc4b);};exports['regenerateApiKey']=function(_0x3321e6,_0x54048a){var _0x11f07b=_0x3321e6['query'][_0xdc7c('0x51')];if(_0x11f07b){var _0x4b284b={'nonce':_0x54048a[_0xdc7c('0x59')],'iat':_0x54048a['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdc7c('0x52')]()};return verifyJwt(_0x11f07b,_0x4b284b)['then'](function(){return generateApiKey(_0x54048a);});}else{throw{'message':_0xdc7c('0x75')};}};exports[_0xdc7c('0x76')]=function(_0x14810a){var _0x110ef2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x110ef2[_0xdc7c('0x77')](_0x14810a))throw new db[(_0xdc7c('0x78'))]['ValidationError'](_0xdc7c('0x79'));return;};exports[_0xdc7c('0x7a')]=function(_0x11da68,_0x4a33fb,_0x25f422){var _0x43e836=encryptor[_0xdc7c('0x7b')](_0x4a33fb)[_0xdc7c('0x7c')](',');for(var _0x25247a=0x0;_0x25247a<_0x25f422;_0x25247a++){if(!_0x43e836[_0x25247a])break;if(_0x11da68[_0xdc7c('0x7d')]()===_0x43e836[_0x25247a][_0xdc7c('0x7d')]()){var _0x9fc452=util[_0xdc7c('0x7e')](_0xdc7c('0x7f'),_0x25f422);if(_0x25f422===0x1){_0x9fc452=_0xdc7c('0x80');}throw new db[(_0xdc7c('0x78'))][(_0xdc7c('0x81'))](_0x9fc452);}}return;};exports[_0xdc7c('0x82')]=function(_0x4a6ae5,_0x59ec93){var _0x50c7c0=_0x59ec93?encryptor['decryptString'](_0x59ec93)['split'](','):[];if(_0x50c7c0['length']===0x5){_0x50c7c0[_0xdc7c('0x83')](-0x1,0x1);}_0x50c7c0[_0xdc7c('0x84')](_0x4a6ae5);return encryptor[_0xdc7c('0x85')](_0x50c7c0['join'](','));};function signJwt(_0x50ac64){var _0x3f2292=BPromise[_0xdc7c('0x86')](jwt[_0xdc7c('0x87')],{'context':jwt});var _0x57e9bf=_0x50ac64[_0xdc7c('0x88')]||config[_0xdc7c('0xa')]['session'];return new BPromise(function(_0x5387f9,_0x170665){_0x3f2292(_0x50ac64['payload'],_0x57e9bf,_0x50ac64['options'])[_0xdc7c('0x55')](function(_0x13d3b4){_0x5387f9(_0x13d3b4);})[_0xdc7c('0x46')](function(_0x4984ef){_0x170665(_0x4984ef);});});}function verifyJwt(_0x54f25d,_0x3187bf,_0x4cb10e){var _0x39f82a=BPromise[_0xdc7c('0x86')](jwt[_0xdc7c('0x89')],{'context':jwt});var _0x3aaf0b=_0x4cb10e||config[_0xdc7c('0xa')]['session'];return new BPromise(function(_0xe10250,_0x3a3602){_0x39f82a(_0x54f25d,_0x3aaf0b,_0x3187bf)[_0xdc7c('0x55')](function(_0xaf6b56){_0xe10250(_0xaf6b56);})[_0xdc7c('0x46')](function(_0x4bf2ef){_0x3a3602(_0x4bf2ef);});});}function generateNonce(){return crypto[_0xdc7c('0x8a')](0x10)[_0xdc7c('0x8b')](_0xdc7c('0x8c'));}function generateIssuedAt(){return Math[_0xdc7c('0x8d')](Date[_0xdc7c('0x8e')]()/0x3e8)['toString']();}function createJwt(_0x478293){var _0x1b6d3c={'payload':{'iat':_0x478293[_0xdc7c('0x73')],'nonce':_0x478293[_0xdc7c('0x59')]},'options':{'algorithm':_0xdc7c('0x8f'),'subject':_0x478293['id'][_0xdc7c('0x8b')](),'issuer':hardwareConf[_0xdc7c('0x52')](),'audience':hardwareConf[_0xdc7c('0x52')]()}};return signJwt(_0x1b6d3c)['then'](function(_0x4588c1){return{'iat':_0x478293['apiKeyIat'],'nonce':_0x478293[_0xdc7c('0x59')],'token':_0x4588c1};});} \ No newline at end of file +var _0x9d36=['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.','length','splice','unshift','encryptString','promisify','sign','secret','payload','options','session','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','util','moment','secrets','role','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','chatAutoanswer','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','use','ChatInteraction','findOne','params','closed','then','query','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','authenticate','pass','Wrong\x20credentials.','user','Unknown\x20authorization\x20format','apikey','getUuid','find','sub','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','cookie','redirect','/dashboards/general','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split'];(function(_0x576771,_0x2db682){var _0x3b64af=function(_0x3b997c){while(--_0x3b997c){_0x576771['push'](_0x576771['shift']());}};_0x3b64af(++_0x2db682);}(_0x9d36,0x9b));var _0x69d3=function(_0x61e66c,_0x54a018){_0x61e66c=_0x61e66c-0x0;var _0xa491e7=_0x9d36[_0x61e66c];return _0xa491e7;};'use strict';var db=require(_0x69d3('0x0'))['db'];var config=require(_0x69d3('0x1'));var hardwareConf=require(_0x69d3('0x2'));var licenseUtil=require(_0x69d3('0x3'));var encryptor=require(_0x69d3('0x4'));var _=require('lodash');var jwt=require(_0x69d3('0x5'));var expressJwt=require(_0x69d3('0x6'));var compose=require(_0x69d3('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x69d3('0x8'));var BPromise=require(_0x69d3('0x9'));var util=require(_0x69d3('0xa'));var moment=require(_0x69d3('0xb'));var validateJwt=expressJwt({'secret':config[_0x69d3('0xc')]['session']});var userAttributes=['id',_0x69d3('0xd'),'fullname',_0x69d3('0xe'),_0x69d3('0xf'),_0x69d3('0x10'),_0x69d3('0x11'),_0x69d3('0x12'),_0x69d3('0x13'),_0x69d3('0x14'),_0x69d3('0x15'),_0x69d3('0x16'),_0x69d3('0x17'),_0x69d3('0x18'),_0x69d3('0x19'),'pauseType',_0x69d3('0x1a'),_0x69d3('0x1b'),_0x69d3('0x1c'),_0x69d3('0x1d'),_0x69d3('0x1e'),_0x69d3('0x1f'),'alias','phoneBarAutoAnswer',_0x69d3('0x20'),_0x69d3('0x21'),_0x69d3('0x22'),_0x69d3('0x23'),_0x69d3('0x24'),_0x69d3('0x25'),'phoneBarPrefixRequired','phoneBarRemoteControl',_0x69d3('0x26'),'hotdesk',_0x69d3('0x27'),_0x69d3('0x28'),_0x69d3('0x29'),'settingsEnabled',_0x69d3('0x2a'),'downloadVoiceRecordings',_0x69d3('0x2b'),'downloadAttachments',_0x69d3('0x2c'),'selectRecallMeCampaign',_0x69d3('0x2d'),_0x69d3('0x2e'),'emailAutoanswer',_0x69d3('0x2f'),'smsAutoanswer',_0x69d3('0x30'),_0x69d3('0x31'),_0x69d3('0x32'),'faxAutoanswer',_0x69d3('0x33'),_0x69d3('0x34'),_0x69d3('0x35'),_0x69d3('0x36')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x69d3('0x37')](function(_0x138952,_0x314432,_0x5d84a0){if(_0x138952['user']){_0x5d84a0();}else{return db[_0x69d3('0x38')][_0x69d3('0x39')]({'where':{'id':_0x138952[_0x69d3('0x3a')]['id']},'attributes':['id',_0x69d3('0x3b'),'disposition'],'raw':!![]})[_0x69d3('0x3c')](function(_0x115e16){if(_0x115e16&&_0x115e16[_0x69d3('0x3b')]&&!_0x138952[_0x69d3('0x3d')]['forceDownload']){return _0x314432[_0x69d3('0x3e')](_0x115e16[_0x69d3('0x3f')]===_0x69d3('0x40')?0x195:0x193)[_0x69d3('0x41')]({'message':_0x115e16[_0x69d3('0x3f')]===_0x69d3('0x40')?_0x69d3('0x42'):_0x69d3('0x43')});}else{_0x5d84a0();}})[_0x69d3('0x44')](function(_0x4a7b71){_0x5d84a0(_0x4a7b71);});}});};exports['isAuthenticated']=function isAuthenticated(_0x5e1ffb){return compose()['use'](function(_0x2aa92d,_0x4af6c4,_0x362ef0){var _0x4f1f09;if(_0x2aa92d[_0x69d3('0x45')][_0x69d3('0x46')]){if(_[_0x69d3('0x47')](_0x2aa92d[_0x69d3('0x45')][_0x69d3('0x46')],_0x69d3('0x48'))){var _0x57efbf=basicAuth(_0x2aa92d);db[_0x69d3('0x49')]['find']({'where':{'name':_0x57efbf[_0x69d3('0xe')]}})[_0x69d3('0x3c')](function(_0x57bbbb){if(!_0x57bbbb||!_0x57bbbb[_0x69d3('0x4a')](_0x57efbf[_0x69d3('0x4b')])){return _0x4af6c4['status'](0x191)[_0x69d3('0x41')]({'message':_0x69d3('0x4c')});}_0x2aa92d[_0x69d3('0x4d')]={'id':_0x57bbbb['id']};_0x362ef0();})[_0x69d3('0x44')](function(_0x585650){_0x362ef0(_0x585650);});}else if(_[_0x69d3('0x47')](_0x2aa92d[_0x69d3('0x45')][_0x69d3('0x46')],'Bearer')){validateJwt(_0x2aa92d,_0x4af6c4,_0x362ef0);}else{if(_0x5e1ffb){_0x362ef0();}else{return _0x4af6c4[_0x69d3('0x3e')](0x193)[_0x69d3('0x41')]({'message':_0x69d3('0x4e')});}}}else if(_0x2aa92d[_0x69d3('0x3d')][_0x69d3('0x4f')]){try{var _0x395fd1={'audience':hardwareConf[_0x69d3('0x50')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x2aa92d['query']['apikey'],_0x395fd1)['then'](function(_0x495d0a){return db['User'][_0x69d3('0x51')]({'where':{'id':_0x495d0a[_0x69d3('0x52')]}})['then'](function(_0x4c9324){_0x4f1f09=_0x4c9324;return db['Setting'][_0x69d3('0x39')]({'where':{'id':0x1},'attributes':[_0x69d3('0x53'),_0x69d3('0x54')],'raw':!![]});})['then'](function(_0x1e0e80){if(!_0x4f1f09||!_['isEqual'](_0x4f1f09[_0x69d3('0x55')],_0x495d0a[_0x69d3('0x56')])){return _0x4af6c4[_0x69d3('0x3e')](0x191)[_0x69d3('0x41')]({'message':_0x69d3('0x57')});}if(_0x4f1f09[_0x69d3('0x58')]){return _0x4af6c4[_0x69d3('0x3e')](0x191)[_0x69d3('0x41')]({'message':_0x69d3('0x59')});}if(_0x4f1f09[_0x69d3('0x5a')]){if(_0x1e0e80[_0x69d3('0x54')]>0x0){if(moment(_0x4f1f09['blockedAt'])[_0x69d3('0x5b')](_0x1e0e80[_0x69d3('0x54')],_0x69d3('0x5c'))>moment()){return _0x4af6c4['status'](0x191)[_0x69d3('0x41')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x4af6c4[_0x69d3('0x3e')](0x191)[_0x69d3('0x41')]({'message':_0x69d3('0x59')});}}_0x2aa92d[_0x69d3('0x4d')]={'id':_0x4f1f09['id']};_0x362ef0();});})[_0x69d3('0x44')](function(){return _0x4af6c4[_0x69d3('0x3e')](0x191)[_0x69d3('0x41')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x801daa){_0x362ef0(_0x801daa);}}else if(_0x5e1ffb){_0x362ef0();}else{return _0x4af6c4[_0x69d3('0x3e')](0x193)[_0x69d3('0x41')]({'message':_0x69d3('0x4e')});}})['use'](function(_0x1efdd5,_0x51c8e7,_0x443b4d){if(_0x1efdd5[_0x69d3('0x4d')]){db[_0x69d3('0x49')]['find']({'where':{'id':_0x1efdd5[_0x69d3('0x4d')]['id']},'attributes':userAttributes})[_0x69d3('0x3c')](function(_0x53e759){if(!_0x53e759){return _0x51c8e7['status'](0x194)[_0x69d3('0x41')]({'message':'User\x20not\x20found.'});}_0x1efdd5[_0x69d3('0x4d')]=_0x53e759;_0x443b4d();})[_0x69d3('0x44')](function(_0x5dd6aa){_0x443b4d(_0x5dd6aa);});}else if(_0x5e1ffb){_0x443b4d();}else{return _0x51c8e7[_0x69d3('0x3e')](0x194)[_0x69d3('0x41')]({'message':_0x69d3('0x5d')});}});};exports[_0x69d3('0x5e')]=function canUpdate(){return compose()['use'](function(_0x1984e2,_0x210634,_0x53a32d){return licenseUtil[_0x69d3('0x5f')]()['then'](function(_0x171655){if(_0x171655[_0x69d3('0x60')]){_0x53a32d();}else{return _0x210634[_0x69d3('0x3e')](0x193)[_0x69d3('0x41')]({'message':_0x69d3('0x61')});}})[_0x69d3('0x44')](function(_0x406b6b){_0x53a32d(_0x406b6b);});});};exports[_0x69d3('0x62')]=function isWebrtcLicence(){return compose()[_0x69d3('0x37')](function(_0x186427,_0x223f27,_0x4d26c1){return licenseUtil['getLicense']()[_0x69d3('0x3c')](function(_0x1ead26){if(_0x1ead26[_0x69d3('0x63')]){_0x4d26c1();}else{return _0x223f27[_0x69d3('0x3e')](0x193)['json']({'message':_0x69d3('0x61')});}})[_0x69d3('0x44')](function(_0x41de0a){_0x4d26c1(_0x41de0a);});});};exports[_0x69d3('0x64')]=function(_0x149d44,_0x4c141e,_0x113df3){_0x149d44['isMiddleware']=!![];return _0x113df3();};exports[_0x69d3('0x65')]=function signToken(_0x2e10ad){return signJwt(_0x2e10ad);};exports[_0x69d3('0x66')]=function(_0x777188,_0x3ec0d9){if(!_0x777188['user']){return _0x3ec0d9[_0x69d3('0x3e')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x3dc51d={'payload':{'id':_0x777188['user']['id'],'role':_0x777188['user'][_0x69d3('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3dc51d)[_0x69d3('0x3c')](function(_0xbd560e){_0x3ec0d9[_0x69d3('0x67')]('motion.token',_0xbd560e);_0x3ec0d9[_0x69d3('0x68')](_0x69d3('0x69'));})[_0x69d3('0x44')](function(_0x358961){return _0x3ec0d9[_0x69d3('0x3e')](0x1f4)['send'](_0x358961);});};exports['retrieveApiKey']=function(_0x5b9b97){if(_['isNil'](_0x5b9b97[_0x69d3('0x55')])||_[_0x69d3('0x6a')](_0x5b9b97[_0x69d3('0x6b')])){return null;}else{return createJwt(_0x5b9b97);}};exports['generateApiKey']=function(_0x261a91){_0x261a91[_0x69d3('0x55')]=generateNonce();_0x261a91[_0x69d3('0x6b')]=generateIssuedAt();return createJwt(_0x261a91);};exports[_0x69d3('0x6c')]=function(_0x2c259a,_0x49f057){var _0x220c05=_0x2c259a['query'][_0x69d3('0x4f')];if(_0x220c05){var _0x1dd23b={'nonce':_0x49f057['apiKeyNonce'],'iat':_0x49f057['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x69d3('0x50')]()};return verifyJwt(_0x220c05,_0x1dd23b)[_0x69d3('0x3c')](function(){return generateApiKey(_0x49f057);});}else{throw{'message':_0x69d3('0x6d')};}};exports[_0x69d3('0x6e')]=function(_0x4ebdf1){var _0x73e5d8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x73e5d8[_0x69d3('0x6f')](_0x4ebdf1))throw new db['Sequelize']['ValidationError'](_0x69d3('0x70'));return;};exports[_0x69d3('0x71')]=function(_0x1c719e,_0x43ad41,_0x364405){var _0x419334=encryptor['decryptString'](_0x43ad41)[_0x69d3('0x72')](',');for(var _0x12adbc=0x0;_0x12adbc<_0x364405;_0x12adbc++){if(!_0x419334[_0x12adbc])break;if(_0x1c719e[_0x69d3('0x73')]()===_0x419334[_0x12adbc][_0x69d3('0x73')]()){var _0x1f6652=util[_0x69d3('0x74')](_0x69d3('0x75'),_0x364405);if(_0x364405===0x1){_0x1f6652=_0x69d3('0x76');}throw new db['Sequelize']['ValidationError'](_0x1f6652);}}return;};exports['updatePasswordsHistory']=function(_0x5b50b8,_0x410db5){var _0x302054=_0x410db5?encryptor['decryptString'](_0x410db5)['split'](','):[];if(_0x302054[_0x69d3('0x77')]===0x5){_0x302054[_0x69d3('0x78')](-0x1,0x1);}_0x302054[_0x69d3('0x79')](_0x5b50b8);return encryptor[_0x69d3('0x7a')](_0x302054['join'](','));};function signJwt(_0xbf0b94){var _0x3dcfff=BPromise[_0x69d3('0x7b')](jwt[_0x69d3('0x7c')],{'context':jwt});var _0x142393=_0xbf0b94[_0x69d3('0x7d')]||config['secrets']['session'];return new BPromise(function(_0x39b480,_0x3b56de){_0x3dcfff(_0xbf0b94[_0x69d3('0x7e')],_0x142393,_0xbf0b94[_0x69d3('0x7f')])[_0x69d3('0x3c')](function(_0x595b51){_0x39b480(_0x595b51);})[_0x69d3('0x44')](function(_0x282740){_0x3b56de(_0x282740);});});}function verifyJwt(_0x530b82,_0x3dacd6,_0x2c61f4){var _0x421990=BPromise[_0x69d3('0x7b')](jwt['verify'],{'context':jwt});var _0x284bdd=_0x2c61f4||config[_0x69d3('0xc')][_0x69d3('0x80')];return new BPromise(function(_0x487a96,_0x471845){_0x421990(_0x530b82,_0x284bdd,_0x3dacd6)[_0x69d3('0x3c')](function(_0x3531bb){_0x487a96(_0x3531bb);})[_0x69d3('0x44')](function(_0x27d586){_0x471845(_0x27d586);});});}function generateNonce(){return crypto[_0x69d3('0x81')](0x10)[_0x69d3('0x82')](_0x69d3('0x83'));}function generateIssuedAt(){return Math[_0x69d3('0x84')](Date[_0x69d3('0x85')]()/0x3e8)[_0x69d3('0x82')]();}function createJwt(_0x5a8e00){var _0x1ae4af={'payload':{'iat':_0x5a8e00[_0x69d3('0x6b')],'nonce':_0x5a8e00[_0x69d3('0x55')]},'options':{'algorithm':_0x69d3('0x86'),'subject':_0x5a8e00['id'][_0x69d3('0x82')](),'issuer':hardwareConf[_0x69d3('0x50')](),'audience':hardwareConf[_0x69d3('0x50')]()}};return signJwt(_0x1ae4af)[_0x69d3('0x3c')](function(_0x25e817){return{'iat':_0x5a8e00[_0x69d3('0x6b')],'nonce':_0x5a8e00[_0x69d3('0x55')],'token':_0x25e817};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 1442240..b9a70e4 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c25=['clause','tags','skip','checkListsRestrictions','ids','tag','count','User','buildContactsQuery','fields','getFilteredContacts','catch','describe','keys','startsWith','cf_','map','CmCustomField','findOne','all','length','fieldType','type','lodash','./sql-utils','../../mysqldb','skipContactsQuery','getContactsSubquery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','filter','user'];(function(_0x5e86af,_0x4f5f60){var _0x11b894=function(_0x38d906){while(--_0x38d906){_0x5e86af['push'](_0x5e86af['shift']());}};_0x11b894(++_0x4f5f60);}(_0x4c25,0xf5));var _0x54c2=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x4c25[_0x2f9467];return _0x39894c;};'use strict';var _=require(_0x54c2('0x0'));var sqlUtils=require(_0x54c2('0x1'));var db=require(_0x54c2('0x2'))['db'];exports['findAll']=function(_0x4c8474,_0x2f0f79,_0xf80382,_0x1cf2f6){var _0x1e8250={'count':0x0,'rows':[]};var _0x5662af=sqlUtils[_0x54c2('0x3')](_0x2f0f79,_0x4c8474);if(_0x5662af){return Promise['resolve'](_0x1e8250);}var _0x58a7e1=sqlUtils[_0x54c2('0x4')]();var _0x48c5db={};var _0x12e0b5=![];var _0x1b28c4=![];return Promise[_0x54c2('0x5')]()[_0x54c2('0x6')](function(){if(_0x4c8474[_0x54c2('0x7')]){return sqlUtils[_0x54c2('0x8')](_0x4c8474[_0x54c2('0x7')],_0x1cf2f6);}else{return sqlUtils[_0x54c2('0x9')](_0x4c8474,_0x1cf2f6);}})[_0x54c2('0x6')](function(_0x5dc004){_0x58a7e1['where'](_0x5dc004[_0x54c2('0xa')]);_0x58a7e1['where'](_0x5dc004['fields']);_0x58a7e1[_0x54c2('0xb')](_0x5dc004[_0x54c2('0xc')]);_0x58a7e1[_0x54c2('0xb')](_0x5dc004[_0x54c2('0xd')][_0x54c2('0xe')]);_0x48c5db=_0x5dc004[_0x54c2('0xf')];_0x1b28c4=_0x5dc004['user'][_0x54c2('0x10')];return sqlUtils[_0x54c2('0x11')](_0x2f0f79,_0x4c8474,_0x1b28c4);})[_0x54c2('0x6')](function(_0x3a43e0){_0x58a7e1['where'](_0x3a43e0);var _0x4f9cee=_0x4c8474[_0x54c2('0x7')]?_0x48c5db[_0x54c2('0x12')]:_0x4c8474[_0x54c2('0x13')];_0x12e0b5=_0x4f9cee?!![]:![];return sqlUtils['countFilteredContacts'](_0x58a7e1,_0x4f9cee);})[_0x54c2('0x6')](function(_0x1b1d28){_0x1e8250[_0x54c2('0x14')]=_0x1b1d28;if(_0x1e8250['count']===0x0){return;}if(_0x4c8474[_0x54c2('0x15')]){_0x1b28c4=!![];}return sqlUtils[_0x54c2('0x16')](_0x58a7e1,_0x4c8474[_0x54c2('0x17')],_0xf80382,_0x12e0b5,_0x48c5db[_0x54c2('0xe')],_0x1b28c4);})[_0x54c2('0x6')](function(_0x2516b){if(!_0x2516b){return[];}return sqlUtils[_0x54c2('0x18')](_0x2516b,_0x4c8474,_0xf80382);})[_0x54c2('0x6')](function(_0x431f05){_0x1e8250['rows']=_0x431f05;return _0x1e8250;})[_0x54c2('0x19')](function(_0x36059f){throw _0x36059f;});};exports['describe']=function(){var _0x1715dc={};var _0x2ae901=[];return db['CmContact'][_0x54c2('0x1a')]()[_0x54c2('0x6')](function(_0x3b7433){_0x1715dc=_0x3b7433;var _0x107bb1=Object[_0x54c2('0x1b')](_0x1715dc)[_0x54c2('0xc')](function(_0x4d76b5){return _[_0x54c2('0x1c')](_0x4d76b5,_0x54c2('0x1d'))?_0x4d76b5:undefined;});var _0x5239cd=_0x107bb1[_0x54c2('0x1e')](function(_0x15e903){return db[_0x54c2('0x1f')][_0x54c2('0x20')]({'where':{'id':_0x15e903['slice'](0x3)},'raw':!![]});});return Promise[_0x54c2('0x21')](_0x5239cd);})[_0x54c2('0x6')](function(_0x5cb3b3){for(var _0x929cf7=0x0;_0x929cf7<_0x5cb3b3[_0x54c2('0x22')];_0x929cf7++){if(_0x5cb3b3[_0x929cf7]){var _0x526488=_0x54c2('0x1d')+_0x5cb3b3[_0x929cf7]['id'];_0x1715dc[_0x526488][_0x54c2('0x23')]=_0x5cb3b3[_0x929cf7]['type'];}}_0x2ae901=_[_0x54c2('0x1e')](Object[_0x54c2('0x1b')](_0x1715dc),function(_0x49096b){return{'name':_0x49096b,'type':_0x1715dc[_0x49096b][_0x54c2('0x24')]};});return _0x2ae901;})[_0x54c2('0x19')](function(_0x57a682){throw _0x57a682;});}; \ No newline at end of file +var _0x2d01=['getFilteredContacts','catch','describe','CmContact','keys','startsWith','map','CmCustomField','slice','all','length','cf_','fieldType','type','lodash','./sql-utils','../../mysqldb','skipContactsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','fields','filter','user','clause','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2d01,0x7a));var _0x12d0=function(_0x5dca82,_0x136a46){_0x5dca82=_0x5dca82-0x0;var _0x403d5e=_0x2d01[_0x5dca82];return _0x403d5e;};'use strict';var _=require(_0x12d0('0x0'));var sqlUtils=require(_0x12d0('0x1'));var db=require(_0x12d0('0x2'))['db'];exports['findAll']=function(_0x3c80c2,_0x5f2c66,_0x14f8f6,_0x1a1beb){var _0x2de5e0={'count':0x0,'rows':[]};var _0x451b0b=sqlUtils[_0x12d0('0x3')](_0x5f2c66,_0x3c80c2);if(_0x451b0b){return Promise[_0x12d0('0x4')](_0x2de5e0);}var _0x15f659=sqlUtils['getContactsSubquery']();var _0x4267fc={};var _0x5947ac=![];var _0x1ba6eb=![];return Promise[_0x12d0('0x4')]()[_0x12d0('0x5')](function(){if(_0x3c80c2[_0x12d0('0x6')]){return sqlUtils[_0x12d0('0x7')](_0x3c80c2[_0x12d0('0x6')],_0x1a1beb);}else{return sqlUtils[_0x12d0('0x8')](_0x3c80c2,_0x1a1beb);}})[_0x12d0('0x5')](function(_0x44fa9f){_0x15f659[_0x12d0('0x9')](_0x44fa9f['default']);_0x15f659[_0x12d0('0x9')](_0x44fa9f[_0x12d0('0xa')]);_0x15f659['where'](_0x44fa9f[_0x12d0('0xb')]);_0x15f659[_0x12d0('0x9')](_0x44fa9f[_0x12d0('0xc')][_0x12d0('0xd')]);_0x4267fc=_0x44fa9f[_0x12d0('0xe')];_0x1ba6eb=_0x44fa9f[_0x12d0('0xc')][_0x12d0('0xf')];return sqlUtils[_0x12d0('0x10')](_0x5f2c66,_0x3c80c2,_0x1ba6eb);})['then'](function(_0x189771){_0x15f659['where'](_0x189771);var _0x366de1=_0x3c80c2[_0x12d0('0x6')]?_0x4267fc[_0x12d0('0x11')]:_0x3c80c2[_0x12d0('0x12')];_0x5947ac=_0x366de1?!![]:![];return sqlUtils[_0x12d0('0x13')](_0x15f659,_0x366de1);})[_0x12d0('0x5')](function(_0x41217b){_0x2de5e0[_0x12d0('0x14')]=_0x41217b;if(_0x2de5e0[_0x12d0('0x14')]===0x0){return;}if(_0x3c80c2['User']){_0x1ba6eb=!![];}return sqlUtils[_0x12d0('0x15')](_0x15f659,_0x3c80c2['fields'],_0x14f8f6,_0x5947ac,_0x4267fc[_0x12d0('0xd')],_0x1ba6eb);})[_0x12d0('0x5')](function(_0xbb90f5){if(!_0xbb90f5){return[];}return sqlUtils[_0x12d0('0x16')](_0xbb90f5,_0x3c80c2,_0x14f8f6);})[_0x12d0('0x5')](function(_0x979a0d){_0x2de5e0['rows']=_0x979a0d;return _0x2de5e0;})[_0x12d0('0x17')](function(_0x21a765){throw _0x21a765;});};exports[_0x12d0('0x18')]=function(){var _0x581258={};var _0x290809=[];return db[_0x12d0('0x19')][_0x12d0('0x18')]()['then'](function(_0x36707b){_0x581258=_0x36707b;var _0x1f6ecd=Object[_0x12d0('0x1a')](_0x581258)['filter'](function(_0x4ca386){return _[_0x12d0('0x1b')](_0x4ca386,'cf_')?_0x4ca386:undefined;});var _0x314485=_0x1f6ecd[_0x12d0('0x1c')](function(_0xc64ac){return db[_0x12d0('0x1d')]['findOne']({'where':{'id':_0xc64ac[_0x12d0('0x1e')](0x3)},'raw':!![]});});return Promise[_0x12d0('0x1f')](_0x314485);})[_0x12d0('0x5')](function(_0x16f74e){for(var _0x33dd5f=0x0;_0x33dd5f<_0x16f74e[_0x12d0('0x20')];_0x33dd5f++){if(_0x16f74e[_0x33dd5f]){var _0x16d084=_0x12d0('0x21')+_0x16f74e[_0x33dd5f]['id'];_0x581258[_0x16d084][_0x12d0('0x22')]=_0x16f74e[_0x33dd5f]['type'];}}_0x290809=_[_0x12d0('0x1c')](Object[_0x12d0('0x1a')](_0x581258),function(_0x1b4652){return{'name':_0x1b4652,'type':_0x581258[_0x1b4652][_0x12d0('0x23')]};});return _0x290809;})[_0x12d0('0x17')](function(_0x331857){throw _0x331857;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 872d9f7..23e0d0c 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1275=['limit','offset','having','order','DESC','subqry','findAll','color','Sequelize','QueryTypes','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','getSelectedTags','isEmpty','SELECT','exports','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','role','agent','autocomplete','true','select','from','cm_contacts','where','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','firstName','mobile','fax','email','ListId','CompanyId','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','sqlOperator','conditions','length','name','castTo','DATE','buildExpression','type','text','value','end','Tag','map','clause','and','tags','user','uc.UserId\x20=\x20?','skip','keys','compact','Contact','User','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','fields','tag','filter','search','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id'];(function(_0x3a73bc,_0x550aef){var _0x32891b=function(_0x20b4cb){while(--_0x20b4cb){_0x3a73bc['push'](_0x3a73bc['shift']());}};_0x32891b(++_0x550aef);}(_0x1275,0xe3));var _0x5127=function(_0x283646,_0x3130bb){_0x283646=_0x283646-0x0;var _0x25b72d=_0x1275[_0x283646];return _0x25b72d;};'use strict';var _=require('lodash');var squel=require(_0x5127('0x0'));var as=require(_0x5127('0x1'));var qs=require(_0x5127('0x2'));var utils=require('../interaction/utils');var db=require(_0x5127('0x3'))['db'];function skipContactsQuery(_0x2fb869,_0x58bbfc){var _0x6027f1=![];if(_0x2fb869[_0x5127('0x4')]===_0x5127('0x5')&&!_0x58bbfc['search']&&!_0x58bbfc['ListId']&&_0x58bbfc[_0x5127('0x6')]!==_0x5127('0x7')){_0x6027f1=!![];}return _0x6027f1;}function getContactsSubquery(){return squel[_0x5127('0x8')]()[_0x5127('0x9')](_0x5127('0xa'),'c')[_0x5127('0xb')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x26d089,_0x1e0e07){var _0x4a53bb=_0x1e0e07?'c':'subqry';_0x26d089[_0x5127('0xc')](_0x5127('0xd'),'uc',_0x5127('0xe')+_0x4a53bb+_0x5127('0xf'))[_0x5127('0xc')](_0x5127('0x10'),'ct',_0x5127('0x11')+_0x4a53bb+'.id')[_0x5127('0xc')]('tools_tags','t',_0x5127('0x12'));return _0x26d089;}function addFieldsToQuery(_0x1cb8bc,_0x524c77,_0x59626d,_0x4b969f,_0x7ec3d6){var _0x1ad146=_0x7ec3d6?'c':'subqry';if(!_0x524c77){_0x524c77=['id',_0x5127('0x13'),'lastName','phone',_0x5127('0x14'),_0x5127('0x15'),_0x5127('0x16'),_0x5127('0x17'),_0x5127('0x18'),'createdAt',_0x5127('0x19'),_0x5127('0x1a'),_0x5127('0x1b')];}else if(!_0x524c77[_0x5127('0x1c')]('id')){_0x524c77[_0x5127('0x1d')]('id');}var _0x4f7c5e=_0x59626d&&_0x7ec3d6||!_0x59626d&&!_0x7ec3d6;if(_0x4b969f){_0x4f7c5e=_0x4b969f&&_0x7ec3d6||!_0x4b969f&&!_0x7ec3d6;}_0x524c77[_0x5127('0x1e')](function(_0x35b77f){if(_0x35b77f===_0x5127('0x1b')){if(_0x4f7c5e){_0x1cb8bc[_0x5127('0x1f')](_0x5127('0x20'),_0x35b77f);}else if(_0x59626d||_0x4b969f){_0x1cb8bc[_0x5127('0x1f')](_0x1ad146+'.'+_0x35b77f);}}else{_0x1cb8bc[_0x5127('0x1f')](_0x1ad146+'.'+_0x35b77f);}});return _0x1cb8bc;}function getSqlClauses(){var _0x308a4a={'default':squel[_0x5127('0x21')](),'fields':squel[_0x5127('0x21')](),'filter':squel['expr'](),'tags':{'clause':squel[_0x5127('0x21')](),'ids':null},'user':{'clause':squel[_0x5127('0x21')](),'skip':![]}};return _0x308a4a;}function parseTagParameter(_0x3967af){var _0x2cfaca=squel[_0x5127('0x21')]();if(_0x3967af){var _0x464f58=utils['getSelectedTags'](_0x3967af);_0x464f58['forEach'](function(_0x290e70){_0x2cfaca['or'](_0x5127('0x22'),'%,'+_0x290e70+',%');});}return _0x2cfaca;}function parseSearchFilter(_0x47db17){var _0x3d91a6=squel['expr']();if(_0x47db17){var _0x15b1b2=_0x47db17[_0x5127('0x23')]('\x5c','\x5c\x5c')[_0x5127('0x23')](/'/g,'\x27\x27');var _0x34191f=qs[_0x5127('0x24')](_0x15b1b2);if(_0x15b1b2[_0x5127('0x25')]('\x20')['length']>0x1){_0x3d91a6['or'](_0x5127('0x26'),qs['getFullTextValue'](_0x15b1b2,!![]),null);}else{if(qs[_0x5127('0x27')](_0x15b1b2)){_0x3d91a6['or'](_0x5127('0x28'),_0x34191f+'%');_0x3d91a6['or'](_0x5127('0x29'),_0x34191f+'%');_0x3d91a6['or'](_0x5127('0x2a'),_0x34191f+'%');_0x3d91a6['or'](_0x5127('0x2b'),_0x34191f+'%');}else if(qs[_0x5127('0x2c')](_0x15b1b2)){_0x3d91a6['or']('c.email\x20LIKE\x20?',_0x34191f+'%');}else{_0x3d91a6['or']('c.firstName\x20LIKE\x20?','%'+_0x34191f+'%');_0x3d91a6['or']('c.lastName\x20LIKE\x20?','%'+_0x34191f+'%');_0x3d91a6['or']('c.email\x20LIKE\x20?','%'+_0x34191f+'%');}}}return _0x3d91a6;}function parseAdvancedSearchFilter(_0x35c589,_0x242dcc){var _0x2f7747=getSqlClauses();var _0x69ba0f=as['parseSearch'](_0x35c589);var _0x3e23b7=_0x69ba0f[_0x5127('0x2d')];for(var _0x3273f9=0x0;_0x3273f9<_0x69ba0f[_0x5127('0x2e')][_0x5127('0x2f')];_0x3273f9++){var _0x585497=_0x69ba0f[_0x5127('0x2e')][_0x3273f9];var _0x2a6d82='c';var _0x4595b2=_['find'](_0x242dcc,[_0x5127('0x30'),_0x585497[_0x5127('0x1f')]]);if(_0x4595b2){if(_0x585497[_0x5127('0x1f')]==='dateOfBirth'||_0x4595b2['fieldType']==='datetime'){_0x585497[_0x5127('0x31')]=_0x5127('0x32');}var _0x3147e1=as[_0x5127('0x33')](_0x2a6d82,_0x4595b2[_0x5127('0x34')],_0x585497);_0x2f7747['default'][_0x3e23b7](_0x3147e1[_0x5127('0x35')],_0x3147e1['value']['start'],_0x3147e1[_0x5127('0x36')][_0x5127('0x37')]);}else{if(_0x585497[_0x5127('0x1f')]===_0x5127('0x38')){var _0x155c8f=_0x585497[_0x5127('0x36')][_0x5127('0x25')](',')[_0x5127('0x39')](function(_0x41128f){return Number(_0x41128f);});var _0xf1ea45=parseTagParameter(_0x155c8f);_0x2f7747['tags'][_0x5127('0x3a')][_0x5127('0x3b')](_0xf1ea45);_0x2f7747[_0x5127('0x3c')]['ids']=_0x155c8f;}else if(_0x585497[_0x5127('0x1f')]==='User'){_0x2f7747[_0x5127('0x3d')][_0x5127('0x3a')][_0x5127('0x3b')](_0x5127('0x3e'),_0x585497[_0x5127('0x36')]);_0x2f7747['user'][_0x5127('0x3f')]=!![];}}}return _0x2f7747;}function parseModelFields(_0x29d998,_0x59d2d1){var _0x4c2ad2=squel[_0x5127('0x21')]();var _0x27eb80=_(_0x29d998)[_0x5127('0x40')]()[_0x5127('0x39')](function(_0x1b9739){return _['some'](_0x59d2d1,[_0x5127('0x30'),_0x1b9739])?_0x1b9739:undefined;})[_0x5127('0x41')]()[_0x5127('0x36')]();if(_0x29d998[_0x5127('0x42')]){_0x27eb80['push'](_0x5127('0x42'));}if(_0x29d998[_0x5127('0x43')]){_0x27eb80[_0x5127('0x1d')](_0x5127('0x43'));}if(_0x27eb80[_0x5127('0x2f')]>0x0){_0x27eb80[_0x5127('0x1e')](function(_0xf5010d){if(_0xf5010d==='ListId'){_0x4c2ad2['and'](_0x5127('0x44'),[][_0x5127('0x45')](_0x29d998[_0xf5010d]));}else if(_0xf5010d===_0x5127('0x42')){var _0x305104='%'+_0x29d998[_0xf5010d]+'%';_0x4c2ad2[_0x5127('0x3b')](_0x5127('0x46'),_0x305104);}else if(_0xf5010d===_0x5127('0x43')){_0x4c2ad2['and'](_0x5127('0x3e'),_0x29d998[_0xf5010d]);}else{_0x4c2ad2[_0x5127('0x3b')]('c.'+_0xf5010d+_0x5127('0x47'),_0x29d998[_0xf5010d]);}});}return _0x4c2ad2;}function parseQueryParameters(_0x1f8278,_0x5d101e){var _0x5acc2e=getSqlClauses();return Promise['resolve']()[_0x5127('0x48')](function(){return parseModelFields(_0x1f8278,_0x5d101e);})['then'](function(_0x55b555){_0x5acc2e[_0x5127('0x49')][_0x5127('0x3b')](_0x55b555);return parseTagParameter(_0x1f8278[_0x5127('0x4a')]);})['then'](function(_0x4a7955){_0x5acc2e[_0x5127('0x3c')][_0x5127('0x3a')][_0x5127('0x3b')](_0x4a7955);return parseSearchFilter(_0x1f8278[_0x5127('0x4b')]);})[_0x5127('0x48')](function(_0x3d2dff){_0x5acc2e[_0x5127('0x4b')]=_0x3d2dff;return _0x5acc2e;});}function checkListsRestrictions(_0x538284,_0xb3a1b9,_0x394003){var _0x11ee64=squel[_0x5127('0x21')]();return Promise['resolve']()[_0x5127('0x48')](function(){if(_0xb3a1b9[_0x5127('0x4c')]&&_0x538284[_0x5127('0x4')]===_0x5127('0x5')&&!_0x394003){return _0x538284[_0x5127('0x4d')]({'attributes':['id'],'raw':!![]});}})[_0x5127('0x48')](function(_0x209ba5){if(_0x209ba5){if(_0x209ba5['length']===0x0){_0x11ee64[_0x5127('0x3b')](_0x5127('0x4e'));}else{_0x11ee64[_0x5127('0x3b')](_0x5127('0x44'),_[_0x5127('0x39')](_0x209ba5,'id'));}}})[_0x5127('0x48')](function(){return _0x11ee64;});}function buildContactsQuery(_0x348991,_0x2d8ced,_0xa3588a,_0x3da0b1,_0x5de2c0,_0x2fbd25){if(_0x2d8ced){_0x2d8ced=_0xa3588a[_0x5127('0x4f')];}_0x348991=addFieldsToQuery(_0x348991,_0x2d8ced,_0x3da0b1,_0x2fbd25,!![]);var _0x1c5654=squel[_0x5127('0x8')]();_0x1c5654=addFieldsToQuery(_0x1c5654,_0x2d8ced,_0x3da0b1,_0x2fbd25,![]);if(_0x3da0b1||_0x2fbd25){_0x348991=applyJoinClauses(_0x348991,!![]);_0x348991[_0x5127('0x50')](_0x5127('0x51'));if(_0xa3588a[_0x5127('0x52')]){_0x1c5654[_0x5127('0x52')](_0xa3588a[_0x5127('0x52')]);}if(_0xa3588a[_0x5127('0x53')]){_0x1c5654[_0x5127('0x53')](_0xa3588a['offset']);}}else{_0x1c5654=applyJoinClauses(_0x1c5654,![]);_0x1c5654['group']('subqry.id');if(_0xa3588a[_0x5127('0x52')]){_0x348991['limit'](_0xa3588a[_0x5127('0x52')]);}if(_0xa3588a['offset']){_0x348991['offset'](_0xa3588a[_0x5127('0x53')]);}}_0x1c5654[_0x5127('0x54')](_0x5de2c0);if(_0xa3588a[_0x5127('0x55')]){_0xa3588a['order']['forEach'](function(_0x584063){_0x348991[_0x5127('0x55')]('c.'+_0x584063[0x0],_0x584063[0x1]===_0x5127('0x56')?![]:!![]);_0x1c5654['order']('subqry.'+_0x584063[0x0],_0x584063[0x1]==='DESC'?![]:!![]);});}_0x1c5654[_0x5127('0x9')](_0x348991,_0x5127('0x57'));return _0x1c5654;}function getFilteredContacts(_0x4b2597){var _0x3ab969=[];return db['Tag'][_0x5127('0x58')]({'attributes':['id',_0x5127('0x30'),_0x5127('0x59')],'raw':!![]})[_0x5127('0x48')](function(_0x2f0ccb){_0x3ab969=_['keyBy'](_0x2f0ccb,'id');var _0x3ca1fd={'type':db[_0x5127('0x5a')][_0x5127('0x5b')]['SELECT'],'model':db[_0x5127('0x5c')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x5127('0x5d')][_0x5127('0x5e')](_0x4b2597[_0x5127('0x5f')](),_0x3ca1fd);})['then'](function(_0x193a4b){_0x193a4b[_0x5127('0x1e')](function(_0x3cc38a){if(_0x3cc38a[_0x5127('0x1b')]){_0x3cc38a['Tags']=[];_0x3cc38a['TagIds'][_0x5127('0x25')](',')['forEach'](function(_0x3fe6fb){_0x3cc38a[_0x5127('0x60')]['push'](_0x3ab969[_0x3fe6fb]);});}delete _0x3cc38a[_0x5127('0x1b')];});return _0x193a4b;});}function countFilteredContacts(_0x5a4646,_0x2ce94f){var _0x27abd1=_0x5a4646[_0x5127('0x61')]();_0x27abd1[_0x5127('0x1f')](_0x5127('0x62'));_0x27abd1=applyJoinClauses(_0x27abd1,!![]);_0x5a4646[_0x5127('0x50')]('c.id');var _0x55d677=utils[_0x5127('0x63')](_0x2ce94f);if(!_[_0x5127('0x64')](_0x55d677)){_0x27abd1[_0x5127('0xb')]('t.id\x20IN\x20?',_0x55d677);}var _0x28deea={'type':db[_0x5127('0x5a')][_0x5127('0x5b')][_0x5127('0x65')],'raw':!![]};return db[_0x5127('0x5d')][_0x5127('0x5e')](_0x27abd1[_0x5127('0x5f')](),_0x28deea)['then'](function(_0x4c79c3){return _0x4c79c3[0x0]['COUNT(*)'];});}module[_0x5127('0x66')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x7312=['select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','email','CompanyId','createdAt','updatedAt','deletedAt','includes','push','TagIds','field','expr','replace','escapeLIKESpecialChars','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','type','value','start','end','Tag','map','tags','clause','ids','user','and','uc.UserId\x20=\x20?','skip','some','Contact','forEach','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','User','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','offset','subqry.id','limit','having','order','subqry.','DESC','color','keyBy','Sequelize','SELECT','CmContact','query','toString','Tags','split','clone','COUNT(*)','c.id','getSelectedTags','isEmpty','t.id\x20IN\x20?','QueryTypes','sequelize','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true'];(function(_0x512a22,_0x59d3ad){var _0x504680=function(_0x2705e5){while(--_0x2705e5){_0x512a22['push'](_0x512a22['shift']());}};_0x504680(++_0x59d3ad);}(_0x7312,0x14b));var _0x2731=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x7312[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0x2731('0x0'));var squel=require(_0x2731('0x1'));var as=require(_0x2731('0x2'));var qs=require('../parsers/qs');var utils=require(_0x2731('0x3'));var db=require(_0x2731('0x4'))['db'];function skipContactsQuery(_0x566640,_0x2a80e2){var _0x3729ad=![];if(_0x566640[_0x2731('0x5')]===_0x2731('0x6')&&!_0x2a80e2[_0x2731('0x7')]&&!_0x2a80e2[_0x2731('0x8')]&&_0x2a80e2[_0x2731('0x9')]!==_0x2731('0xa')){_0x3729ad=!![];}return _0x3729ad;}function getContactsSubquery(){return squel[_0x2731('0xb')]()[_0x2731('0xc')](_0x2731('0xd'),'c')[_0x2731('0xe')](_0x2731('0xf'));}function applyJoinClauses(_0x4fe091,_0x5d66bd){var _0x29a862=_0x5d66bd?'c':_0x2731('0x10');_0x4fe091['left_join'](_0x2731('0x11'),'uc',_0x2731('0x12')+_0x29a862+_0x2731('0x13'))[_0x2731('0x14')](_0x2731('0x15'),'ct','ct.CmContactId\x20=\x20'+_0x29a862+_0x2731('0x13'))[_0x2731('0x14')]('tools_tags','t',_0x2731('0x16'));return _0x4fe091;}function addFieldsToQuery(_0x52e3fb,_0x1f05b2,_0x23cde0,_0x3c2694,_0x227e91){var _0x47c843=_0x227e91?'c':'subqry';if(!_0x1f05b2){_0x1f05b2=['id',_0x2731('0x17'),_0x2731('0x18'),_0x2731('0x19'),_0x2731('0x1a'),'fax',_0x2731('0x1b'),_0x2731('0x8'),_0x2731('0x1c'),_0x2731('0x1d'),_0x2731('0x1e'),_0x2731('0x1f'),'TagIds'];}else if(!_0x1f05b2[_0x2731('0x20')]('id')){_0x1f05b2[_0x2731('0x21')]('id');}var _0x403ecb=_0x23cde0&&_0x227e91||!_0x23cde0&&!_0x227e91;if(_0x3c2694){_0x403ecb=_0x3c2694&&_0x227e91||!_0x3c2694&&!_0x227e91;}_0x1f05b2['forEach'](function(_0x2f4ffc){if(_0x2f4ffc===_0x2731('0x22')){if(_0x403ecb){_0x52e3fb[_0x2731('0x23')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2f4ffc);}else if(_0x23cde0||_0x3c2694){_0x52e3fb[_0x2731('0x23')](_0x47c843+'.'+_0x2f4ffc);}}else{_0x52e3fb['field'](_0x47c843+'.'+_0x2f4ffc);}});return _0x52e3fb;}function getSqlClauses(){var _0x2301ff={'default':squel['expr'](),'fields':squel[_0x2731('0x24')](),'filter':squel[_0x2731('0x24')](),'tags':{'clause':squel[_0x2731('0x24')](),'ids':null},'user':{'clause':squel[_0x2731('0x24')](),'skip':![]}};return _0x2301ff;}function parseTagParameter(_0x587850){var _0x2a9f68=squel['expr']();if(_0x587850){var _0x28fec1=utils['getSelectedTags'](_0x587850);_0x28fec1['forEach'](function(_0x50e358){_0x2a9f68['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x50e358+',%');});}return _0x2a9f68;}function parseSearchFilter(_0x2103fb){var _0x34eecd=squel['expr']();if(_0x2103fb){var _0x2ff7ac=_0x2103fb[_0x2731('0x25')]('\x5c','\x5c\x5c')[_0x2731('0x25')](/'/g,'\x27\x27');var _0x54c961=qs[_0x2731('0x26')](_0x2ff7ac);if(_0x2ff7ac['split']('\x20')[_0x2731('0x27')]>0x1){_0x34eecd['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2731('0x28')](_0x2ff7ac,!![]),null);}else{if(qs[_0x2731('0x29')](_0x2ff7ac)){_0x34eecd['or'](_0x2731('0x2a'),_0x54c961+'%');_0x34eecd['or'](_0x2731('0x2b'),_0x54c961+'%');_0x34eecd['or'](_0x2731('0x2c'),_0x54c961+'%');_0x34eecd['or'](_0x2731('0x2d'),_0x54c961+'%');}else if(qs[_0x2731('0x2e')](_0x2ff7ac)){_0x34eecd['or'](_0x2731('0x2f'),_0x54c961+'%');}else{_0x34eecd['or'](_0x2731('0x30'),'%'+_0x54c961+'%');_0x34eecd['or'](_0x2731('0x31'),'%'+_0x54c961+'%');_0x34eecd['or'](_0x2731('0x2f'),'%'+_0x54c961+'%');}}}return _0x34eecd;}function parseAdvancedSearchFilter(_0x4c6eac,_0x4dc54a){var _0x37e5ce=getSqlClauses();var _0x3900f7=as['parseSearch'](_0x4c6eac);var _0x15473a=_0x3900f7[_0x2731('0x32')];for(var _0x3a51f4=0x0;_0x3a51f4<_0x3900f7[_0x2731('0x33')][_0x2731('0x27')];_0x3a51f4++){var _0x13e202=_0x3900f7[_0x2731('0x33')][_0x3a51f4];var _0x1a58bc='c';var _0x2d20b1=_[_0x2731('0x34')](_0x4dc54a,[_0x2731('0x35'),_0x13e202[_0x2731('0x23')]]);if(_0x2d20b1){if(_0x13e202['field']===_0x2731('0x36')||_0x2d20b1[_0x2731('0x37')]===_0x2731('0x38')){_0x13e202[_0x2731('0x39')]=_0x2731('0x3a');}var _0x5c2ef1=as['buildExpression'](_0x1a58bc,_0x2d20b1[_0x2731('0x3b')],_0x13e202);_0x37e5ce['default'][_0x15473a](_0x5c2ef1['text'],_0x5c2ef1[_0x2731('0x3c')][_0x2731('0x3d')],_0x5c2ef1[_0x2731('0x3c')][_0x2731('0x3e')]);}else{if(_0x13e202[_0x2731('0x23')]===_0x2731('0x3f')){var _0x248363=_0x13e202[_0x2731('0x3c')]['split'](',')[_0x2731('0x40')](function(_0x5910ec){return Number(_0x5910ec);});var _0x1906e0=parseTagParameter(_0x248363);_0x37e5ce[_0x2731('0x41')][_0x2731('0x42')]['and'](_0x1906e0);_0x37e5ce[_0x2731('0x41')][_0x2731('0x43')]=_0x248363;}else if(_0x13e202[_0x2731('0x23')]==='User'){_0x37e5ce[_0x2731('0x44')][_0x2731('0x42')][_0x2731('0x45')](_0x2731('0x46'),_0x13e202[_0x2731('0x3c')]);_0x37e5ce[_0x2731('0x44')][_0x2731('0x47')]=!![];}}}return _0x37e5ce;}function parseModelFields(_0xfa8203,_0xa7571b){var _0xba1645=squel[_0x2731('0x24')]();var _0x3554ba=_(_0xfa8203)['keys']()[_0x2731('0x40')](function(_0x222690){return _[_0x2731('0x48')](_0xa7571b,[_0x2731('0x35'),_0x222690])?_0x222690:undefined;})['compact']()[_0x2731('0x3c')]();if(_0xfa8203[_0x2731('0x49')]){_0x3554ba[_0x2731('0x21')]('Contact');}if(_0xfa8203['User']){_0x3554ba[_0x2731('0x21')]('User');}if(_0x3554ba[_0x2731('0x27')]>0x0){_0x3554ba[_0x2731('0x4a')](function(_0x2e0119){if(_0x2e0119===_0x2731('0x8')){_0xba1645['and'](_0x2731('0x4b'),[][_0x2731('0x4c')](_0xfa8203[_0x2e0119]));}else if(_0x2e0119==='Contact'){var _0x338c7d='%'+_0xfa8203[_0x2e0119]+'%';_0xba1645[_0x2731('0x45')](_0x2731('0x4d'),_0x338c7d);}else if(_0x2e0119===_0x2731('0x4e')){_0xba1645[_0x2731('0x45')]('uc.UserId\x20=\x20?',_0xfa8203[_0x2e0119]);}else{_0xba1645[_0x2731('0x45')]('c.'+_0x2e0119+_0x2731('0x4f'),_0xfa8203[_0x2e0119]);}});}return _0xba1645;}function parseQueryParameters(_0x55f3b3,_0x3b8537){var _0x3cab9b=getSqlClauses();return Promise[_0x2731('0x50')]()[_0x2731('0x51')](function(){return parseModelFields(_0x55f3b3,_0x3b8537);})[_0x2731('0x51')](function(_0xf5a641){_0x3cab9b[_0x2731('0x52')]['and'](_0xf5a641);return parseTagParameter(_0x55f3b3[_0x2731('0x53')]);})[_0x2731('0x51')](function(_0x232e16){_0x3cab9b[_0x2731('0x41')][_0x2731('0x42')]['and'](_0x232e16);return parseSearchFilter(_0x55f3b3['filter']);})[_0x2731('0x51')](function(_0x29de52){_0x3cab9b[_0x2731('0x54')]=_0x29de52;return _0x3cab9b;});}function checkListsRestrictions(_0x5ae939,_0x168219,_0x145b35){var _0x434e5d=squel[_0x2731('0x24')]();return Promise[_0x2731('0x50')]()[_0x2731('0x51')](function(){if(_0x168219['search']&&_0x5ae939[_0x2731('0x5')]==='agent'&&!_0x145b35){return _0x5ae939[_0x2731('0x55')]({'attributes':['id'],'raw':!![]});}})[_0x2731('0x51')](function(_0x58f43f){if(_0x58f43f){if(_0x58f43f[_0x2731('0x27')]===0x0){_0x434e5d[_0x2731('0x45')](_0x2731('0x56'));}else{_0x434e5d['and'](_0x2731('0x4b'),_['map'](_0x58f43f,'id'));}}})[_0x2731('0x51')](function(){return _0x434e5d;});}function buildContactsQuery(_0x4348e5,_0x100851,_0x4576cd,_0x4841d6,_0x5911bd,_0x2ac3d1){if(_0x100851){_0x100851=_0x4576cd[_0x2731('0x57')];}_0x4348e5=addFieldsToQuery(_0x4348e5,_0x100851,_0x4841d6,_0x2ac3d1,!![]);var _0x468886=squel[_0x2731('0xb')]();_0x468886=addFieldsToQuery(_0x468886,_0x100851,_0x4841d6,_0x2ac3d1,![]);if(_0x4841d6||_0x2ac3d1){_0x4348e5=applyJoinClauses(_0x4348e5,!![]);_0x4348e5[_0x2731('0x58')]('c.id');if(_0x4576cd['limit']){_0x468886['limit'](_0x4576cd['limit']);}if(_0x4576cd[_0x2731('0x59')]){_0x468886[_0x2731('0x59')](_0x4576cd[_0x2731('0x59')]);}}else{_0x468886=applyJoinClauses(_0x468886,![]);_0x468886[_0x2731('0x58')](_0x2731('0x5a'));if(_0x4576cd['limit']){_0x4348e5['limit'](_0x4576cd[_0x2731('0x5b')]);}if(_0x4576cd[_0x2731('0x59')]){_0x4348e5['offset'](_0x4576cd['offset']);}}_0x468886[_0x2731('0x5c')](_0x5911bd);if(_0x4576cd[_0x2731('0x5d')]){_0x4576cd[_0x2731('0x5d')][_0x2731('0x4a')](function(_0x282172){_0x4348e5[_0x2731('0x5d')]('c.'+_0x282172[0x0],_0x282172[0x1]==='DESC'?![]:!![]);_0x468886[_0x2731('0x5d')](_0x2731('0x5e')+_0x282172[0x0],_0x282172[0x1]===_0x2731('0x5f')?![]:!![]);});}_0x468886[_0x2731('0xc')](_0x4348e5,_0x2731('0x10'));return _0x468886;}function getFilteredContacts(_0x37edb3){var _0x47bbfe=[];return db['Tag']['findAll']({'attributes':['id',_0x2731('0x35'),_0x2731('0x60')],'raw':!![]})[_0x2731('0x51')](function(_0xd4cd40){_0x47bbfe=_[_0x2731('0x61')](_0xd4cd40,'id');var _0x168280={'type':db[_0x2731('0x62')]['QueryTypes'][_0x2731('0x63')],'model':db[_0x2731('0x64')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x2731('0x65')](_0x37edb3[_0x2731('0x66')](),_0x168280);})['then'](function(_0x5b2265){_0x5b2265[_0x2731('0x4a')](function(_0x3e29f7){if(_0x3e29f7[_0x2731('0x22')]){_0x3e29f7[_0x2731('0x67')]=[];_0x3e29f7['TagIds'][_0x2731('0x68')](',')[_0x2731('0x4a')](function(_0x5809ff){_0x3e29f7['Tags']['push'](_0x47bbfe[_0x5809ff]);});}delete _0x3e29f7['TagIds'];});return _0x5b2265;});}function countFilteredContacts(_0x3260fb,_0x2d5ca2){var _0xbda441=_0x3260fb[_0x2731('0x69')]();_0xbda441[_0x2731('0x23')](_0x2731('0x6a'));_0xbda441=applyJoinClauses(_0xbda441,!![]);_0x3260fb[_0x2731('0x58')](_0x2731('0x6b'));var _0x2a6071=utils[_0x2731('0x6c')](_0x2d5ca2);if(!_[_0x2731('0x6d')](_0x2a6071)){_0xbda441[_0x2731('0xe')](_0x2731('0x6e'),_0x2a6071);}var _0x4e92e9={'type':db[_0x2731('0x62')][_0x2731('0x6f')][_0x2731('0x63')],'raw':!![]};return db[_0x2731('0x70')][_0x2731('0x65')](_0xbda441[_0x2731('0x66')](),_0x4e92e9)[_0x2731('0x51')](function(_0x14c119){return _0x14c119[0x0]['COUNT(*)'];});}module[_0x2731('0x71')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 3dd4b28..2fa0892 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 _0x4cc4=['crypto','bluebird','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','update','write','end','final','binary','close','unlink','decryptFile','createDecipher','data','encryptString','base64','secret','utf8'];(function(_0x2afc98,_0x50a6b7){var _0x4a4aba=function(_0x173731){while(--_0x173731){_0x2afc98['push'](_0x2afc98['shift']());}};_0x4a4aba(++_0x50a6b7);}(_0x4cc4,0xee));var _0x44cc=function(_0x543dda,_0x2d46e1){_0x543dda=_0x543dda-0x0;var _0x280833=_0x4cc4[_0x543dda];return _0x280833;};'use strict';var crypto=require(_0x44cc('0x0'));var fs=require('fs');var BPromise=require(_0x44cc('0x1'));var _=require('lodash');var config=require(_0x44cc('0x2'));var logger=require('../../config/logger')(_0x44cc('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x44cc('0x4')][_0x44cc('0x5')],'algorithm':_0x44cc('0x6')};const fileOptions={'algorithm':_0x44cc('0x7')};if(config[_0x44cc('0x8')]&&config[_0x44cc('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x44cc('0x8')][_0x44cc('0x9')]);if(isSupported){fileOptions[_0x44cc('0x9')]=config[_0x44cc('0x8')][_0x44cc('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x44cc('0xa')](config[_0x44cc('0x8')][_0x44cc('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x1542dd){return AES_SUPPORTED_RX[_0x44cc('0xb')](_0x1542dd);}function getSupportedCiphers(){return crypto[_0x44cc('0xc')]()[_0x44cc('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0xaa748f){return getSupportedCiphers()[_0x44cc('0xe')](_0xaa748f)>-0x1;}function combineOptions(_0x5b0701){var _0x283bcb={};for(var _0x6d8431 in fileOptions){if(fileOptions[_0x44cc('0xf')](_0x6d8431)){_0x283bcb[_0x6d8431]=fileOptions[_0x6d8431];}}if(_0x5b0701){for(var _0x306181 in _0x5b0701){if(_0x5b0701[_0x44cc('0xf')](_0x306181)){_0x283bcb[_0x306181]=_0x5b0701[_0x306181];}}}return _0x283bcb;}exports[_0x44cc('0x10')]=function(_0x1f075d,_0x2faf85,_0x1098ef,_0x5a33d0){return new BPromise(function(_0x8790ec,_0x74cdf3){_0x5a33d0=combineOptions(_0x5a33d0);var _0x3c1de3=new Buffer(_0x1098ef);var _0x5e7234=fs[_0x44cc('0x11')](_0x1f075d);var _0x2beeb2=fs[_0x44cc('0x12')](_0x2faf85);var _0x46986c=crypto[_0x44cc('0x13')](_0x5a33d0[_0x44cc('0x9')],_0x3c1de3);_0x5e7234['on']('data',function(_0x515cc0){var _0x50af=new Buffer(_0x46986c[_0x44cc('0x14')](_0x515cc0),'binary');_0x2beeb2[_0x44cc('0x15')](_0x50af);});_0x5e7234['on'](_0x44cc('0x16'),function(){try{var _0x1fc851=new Buffer(_0x46986c[_0x44cc('0x17')](_0x44cc('0x18')),'binary');_0x2beeb2['write'](_0x1fc851);_0x2beeb2[_0x44cc('0x16')]();_0x2beeb2['on'](_0x44cc('0x19'),function(){return _0x8790ec(_0x2faf85);});}catch(_0x337207){fs[_0x44cc('0x1a')](_0x2faf85);return _0x74cdf3(_0x337207);}});});};exports[_0x44cc('0x1b')]=function(_0xf20f4c,_0x3a590d,_0x38027d,_0x18d6b2){return new BPromise(function(_0xe84497,_0x196b58){_0x18d6b2=combineOptions(_0x18d6b2);var _0x2caacb=new Buffer(_0x38027d);var _0x3e04f8=fs[_0x44cc('0x11')](_0xf20f4c);var _0x212442=fs[_0x44cc('0x12')](_0x3a590d);var _0x569fb8=crypto[_0x44cc('0x1c')](_0x18d6b2['algorithm'],_0x2caacb);_0x3e04f8['on'](_0x44cc('0x1d'),function(_0x3e3dd0){var _0x3f41fb=new Buffer(_0x569fb8[_0x44cc('0x14')](_0x3e3dd0),_0x44cc('0x18'));_0x212442[_0x44cc('0x15')](_0x3f41fb);});_0x3e04f8['on'](_0x44cc('0x16'),function(){try{var _0x5e5ca9=new Buffer(_0x569fb8[_0x44cc('0x17')](_0x44cc('0x18')),_0x44cc('0x18'));_0x212442[_0x44cc('0x15')](_0x5e5ca9);_0x212442[_0x44cc('0x16')]();_0x212442['on'](_0x44cc('0x19'),function(){return _0xe84497(_0x3a590d);});}catch(_0x1d0a90){fs['unlink'](_0x3a590d);return _0x196b58(_0x1d0a90);}});});};exports[_0x44cc('0x1e')]=function(_0x44dac5,_0x1f5a15,_0x4433da){var _0x8f35e1=_0x4433da||stringOptions[_0x44cc('0x9')];var _0x56b577=_0x1f5a15||stringOptions['secret'];var _0x5b2c84=crypto['createCipher'](_0x8f35e1,_0x56b577);var _0x59907a=_0x5b2c84[_0x44cc('0x14')](_0x44dac5,'utf8','base64');_0x59907a+=_0x5b2c84[_0x44cc('0x17')](_0x44cc('0x1f'));return _0x59907a;};exports['decryptString']=function(_0x450cf2,_0x385f18,_0x4f2e92){var _0xfe5b89=_0x4f2e92||stringOptions[_0x44cc('0x9')];var _0x467893=_0x385f18||stringOptions[_0x44cc('0x20')];var _0x38734e=crypto['createDecipher'](_0xfe5b89,_0x467893);var _0x1ebd45=_0x38734e[_0x44cc('0x14')](_0x450cf2,_0x44cc('0x1f'),_0x44cc('0x21'));_0x1ebd45+=_0x38734e[_0x44cc('0x17')](_0x44cc('0x21'));return _0x1ebd45;}; \ No newline at end of file +var _0x45f2=['filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','update','final','binary','write','end','close','unlink','decryptFile','createWriteStream','createDecipher','data','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','test','getCiphers'];(function(_0x5f0501,_0x19196e){var _0x3c2c45=function(_0x107fe6){while(--_0x107fe6){_0x5f0501['push'](_0x5f0501['shift']());}};_0x3c2c45(++_0x19196e);}(_0x45f2,0xa2));var _0x245f=function(_0x474e2b,_0x18ca18){_0x474e2b=_0x474e2b-0x0;var _0xc24922=_0x45f2[_0x474e2b];return _0xc24922;};'use strict';var crypto=require(_0x245f('0x0'));var fs=require('fs');var BPromise=require(_0x245f('0x1'));var _=require('lodash');var config=require(_0x245f('0x2'));var logger=require('../../config/logger')(_0x245f('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x245f('0x4')][_0x245f('0x5')],'algorithm':_0x245f('0x6')};const fileOptions={'algorithm':_0x245f('0x7')};if(config[_0x245f('0x8')]&&config[_0x245f('0x8')][_0x245f('0x9')]){var isSupported=isAlgorithmSupported(config[_0x245f('0x8')][_0x245f('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x245f('0x8')][_0x245f('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x245f('0xa')](config[_0x245f('0x8')][_0x245f('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x19d95b){return AES_SUPPORTED_RX[_0x245f('0xb')](_0x19d95b);}function getSupportedCiphers(){return crypto[_0x245f('0xc')]()[_0x245f('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x4bf1e5){return getSupportedCiphers()[_0x245f('0xe')](_0x4bf1e5)>-0x1;}function combineOptions(_0x5011fb){var _0x40fca6={};for(var _0x440dfc in fileOptions){if(fileOptions[_0x245f('0xf')](_0x440dfc)){_0x40fca6[_0x440dfc]=fileOptions[_0x440dfc];}}if(_0x5011fb){for(var _0x1ef6e0 in _0x5011fb){if(_0x5011fb['hasOwnProperty'](_0x1ef6e0)){_0x40fca6[_0x1ef6e0]=_0x5011fb[_0x1ef6e0];}}}return _0x40fca6;}exports[_0x245f('0x10')]=function(_0x5ee978,_0x35b37c,_0x31a911,_0x794ac2){return new BPromise(function(_0x216ab1,_0x18ad0e){_0x794ac2=combineOptions(_0x794ac2);var _0xbae015=new Buffer(_0x31a911);var _0x52ff3c=fs[_0x245f('0x11')](_0x5ee978);var _0x4ea4ba=fs['createWriteStream'](_0x35b37c);var _0x2b8cd3=crypto[_0x245f('0x12')](_0x794ac2['algorithm'],_0xbae015);_0x52ff3c['on']('data',function(_0x4b9420){var _0x2580f6=new Buffer(_0x2b8cd3[_0x245f('0x13')](_0x4b9420),'binary');_0x4ea4ba['write'](_0x2580f6);});_0x52ff3c['on']('end',function(){try{var _0x56e699=new Buffer(_0x2b8cd3[_0x245f('0x14')]('binary'),_0x245f('0x15'));_0x4ea4ba[_0x245f('0x16')](_0x56e699);_0x4ea4ba[_0x245f('0x17')]();_0x4ea4ba['on'](_0x245f('0x18'),function(){return _0x216ab1(_0x35b37c);});}catch(_0x1bc676){fs[_0x245f('0x19')](_0x35b37c);return _0x18ad0e(_0x1bc676);}});});};exports[_0x245f('0x1a')]=function(_0xaeddee,_0x1acde3,_0x2123d9,_0x14f3e6){return new BPromise(function(_0x3e2767,_0x4a0b0f){_0x14f3e6=combineOptions(_0x14f3e6);var _0x51cb50=new Buffer(_0x2123d9);var _0x1bd995=fs[_0x245f('0x11')](_0xaeddee);var _0x34696c=fs[_0x245f('0x1b')](_0x1acde3);var _0x84d5db=crypto[_0x245f('0x1c')](_0x14f3e6[_0x245f('0x9')],_0x51cb50);_0x1bd995['on'](_0x245f('0x1d'),function(_0x46fb52){var _0x220771=new Buffer(_0x84d5db[_0x245f('0x13')](_0x46fb52),_0x245f('0x15'));_0x34696c['write'](_0x220771);});_0x1bd995['on'](_0x245f('0x17'),function(){try{var _0x4271c0=new Buffer(_0x84d5db[_0x245f('0x14')](_0x245f('0x15')),_0x245f('0x15'));_0x34696c[_0x245f('0x16')](_0x4271c0);_0x34696c[_0x245f('0x17')]();_0x34696c['on']('close',function(){return _0x3e2767(_0x1acde3);});}catch(_0x417804){fs['unlink'](_0x1acde3);return _0x4a0b0f(_0x417804);}});});};exports[_0x245f('0x1e')]=function(_0x5850f5,_0x1cb2ca,_0x4700df){var _0x4c8b93=_0x4700df||stringOptions['algorithm'];var _0x2eb5ca=_0x1cb2ca||stringOptions[_0x245f('0x1f')];var _0x1649a0=crypto[_0x245f('0x12')](_0x4c8b93,_0x2eb5ca);var _0x52aa66=_0x1649a0[_0x245f('0x13')](_0x5850f5,_0x245f('0x20'),'base64');_0x52aa66+=_0x1649a0[_0x245f('0x14')](_0x245f('0x21'));return _0x52aa66;};exports[_0x245f('0x22')]=function(_0x340453,_0x170edc,_0x208b41){var _0x452f8e=_0x208b41||stringOptions[_0x245f('0x9')];var _0xa2f41a=_0x170edc||stringOptions[_0x245f('0x1f')];var _0x26543a=crypto[_0x245f('0x1c')](_0x452f8e,_0xa2f41a);var _0x4b5b43=_0x26543a['update'](_0x340453,_0x245f('0x21'),_0x245f('0x20'));_0x4b5b43+=_0x26543a[_0x245f('0x14')](_0x245f('0x20'));return _0x4b5b43;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 29037a3..01342f9 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 _0xc956=['format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','split','splitSizeCsv','sequelize','query','QueryTypes','SELECT','then','num','Empty','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.csv','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','analytics','argv','savename','update','info'];(function(_0x34eeed,_0x177d17){var _0x55cf0d=function(_0x26823d){while(--_0x26823d){_0x34eeed['push'](_0x34eeed['shift']());}};_0x55cf0d(++_0x177d17);}(_0xc956,0x1e7));var _0x6c95=function(_0x4e3d5c,_0x1bbb94){_0x4e3d5c=_0x4e3d5c-0x0;var _0x54bbb4=_0xc956[_0x4e3d5c];return _0x54bbb4;};'use strict';var util=require(_0x6c95('0x0'));var path=require(_0x6c95('0x1'));var _=require(_0x6c95('0x2'));var csv=require(_0x6c95('0x3'));var fs=require('fs');var BPromise=require(_0x6c95('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x6c95('0x5'));var db=require(_0x6c95('0x6'))['db'];var dbH=require('../../mysqldb')[_0x6c95('0x7')];var logger=require('../../config/logger')(_0x6c95('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x6c95('0x9')][0x2]);var QUERY=process[_0x6c95('0x9')][0x3];var PATH=process[_0x6c95('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x263b07,_0x52d796){var _0x2c94d2={'status':_0x263b07};var _0x4263e0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x52d796){_0x2c94d2[_0x6c95('0xa')]=_0x52d796;}return db['AnalyticExtractedReport'][_0x6c95('0xb')](_0x2c94d2,_0x4263e0);}function main(){var _0x2e176d=0x1388;var _0x940241;logger[_0x6c95('0xc')](util[_0x6c95('0xd')](_0x6c95('0xe'),EXTRACTED_REPORT_ID,_0x6c95('0xf')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6c95('0x10'),_0x6c95('0x11')]})['then'](function(_0x1a60ef){if(_0x1a60ef){_0x940241=_0x1a60ef;_0x2e176d=_0x940241[_0x6c95('0x11')]||0x1388;}})['then'](function(){return dbH[_0x6c95('0x12')][_0x6c95('0x13')](util[_0x6c95('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x6c95('0x12')][_0x6c95('0x14')][_0x6c95('0x15')]});})[_0x6c95('0x16')](function(_0x13d4bb){if(!_0x13d4bb[0x0][_0x6c95('0x17')]){return analyticExtractedReport(_0x6c95('0x18'));}var _0x50fe63=[];var _0x19131d=0x0;if(_0x940241['split']){if(_0x13d4bb&&_0x13d4bb[_0x6c95('0x19')]){var _0x31c1c4=_[_0x6c95('0x1a')](_0x13d4bb[0x0][_0x6c95('0x17')]/_0x2e176d);var _0x3f58d6=Number[_0x6c95('0x1b')](_0x13d4bb[0x0][_0x6c95('0x17')]/_0x2e176d)?_0x13d4bb[0x0]['num']%_0x2e176d:0x0;_0x31c1c4[_0x6c95('0x1c')](function(_0x2b5a8c){if(_0x2b5a8c>0x0){_0x19131d+=_0x2e176d;}_0x50fe63['push'](dbH[_0x6c95('0x12')][_0x6c95('0x13')](util[_0x6c95('0xd')](_0x6c95('0x1d'),QUERY,_0x2e176d,_0x19131d),{'type':dbH[_0x6c95('0x12')][_0x6c95('0x14')]['SELECT']}));});if(_0x3f58d6>0x0){_0x19131d+=_0x2e176d;_0x50fe63[_0x6c95('0x1e')](dbH[_0x6c95('0x12')]['query'](util[_0x6c95('0xd')](_0x6c95('0x1d'),QUERY,_0x3f58d6,_0x19131d),{'type':dbH['sequelize'][_0x6c95('0x14')]['SELECT']}));}}}else{_0x50fe63[_0x6c95('0x1e')](dbH[_0x6c95('0x12')][_0x6c95('0x13')](QUERY,{'type':dbH[_0x6c95('0x12')][_0x6c95('0x14')]['SELECT']}));}var _0x2b942e=path[_0x6c95('0x1f')](PATH);var _0x478e92=path[_0x6c95('0x20')](PATH,_0x6c95('0x21'));var _0x5375cb=_0x940241[_0x6c95('0x10')]&&_0x50fe63[_0x6c95('0x19')]>0x1;var _0x35ac13=[];if(!fs['existsSync'](path[_0x6c95('0x22')](_0x2b942e,_0x478e92))&&_0x5375cb){fs[_0x6c95('0x23')](path['join'](_0x2b942e,_0x478e92));}return BPromise[_0x6c95('0x24')](_0x50fe63,function(_0x28158b){_0x35ac13[_0x6c95('0x1e')](_0x28158b);})[_0x6c95('0x16')](function(){for(var _0x46cb8d=0x0;_0x46cb8d<_0x35ac13['length'];_0x46cb8d+=0x1){var _0x4aa58e;var _0xdda759=_0x35ac13[_0x46cb8d];if(_0x5375cb){_0x4aa58e=path[_0x6c95('0x22')](_0x2b942e,_0x478e92,util[_0x6c95('0xd')](_0x6c95('0x25'),_0x478e92,_0x46cb8d,_0x6c95('0x26')));}else{_0x4aa58e=path[_0x6c95('0x22')](_0x2b942e,util['format'](_0x6c95('0x27'),_0x478e92,_0x6c95('0x26')));}fs[_0x6c95('0x28')](_0x4aa58e,csv(_0xdda759));}})['then'](function(){if(_0x5375cb){return new Promise(function(_0xbde78){zipdir(path[_0x6c95('0x22')](_0x2b942e,_0x478e92),{'saveTo':path[_0x6c95('0x22')](_0x2b942e,util[_0x6c95('0xd')]('%s.%s',_0x478e92,_0x6c95('0x29')))},function(_0x2f78e1,_0x22208c){rimraf(path[_0x6c95('0x22')](_0x2b942e,_0x478e92),function(){});_0xbde78(_0x6c95('0x2a'));});});}})['then'](function(){logger[_0x6c95('0xc')](util['format'](_0x6c95('0x2b'),EXTRACTED_REPORT_ID,_0x6c95('0xf')));return analyticExtractedReport(_0x6c95('0x2c'),_0x5375cb?util['format'](_0x6c95('0x27'),_0x478e92,_0x5375cb?_0x6c95('0x29'):'csv'):null);});})[_0x6c95('0x2d')](function(_0x30c820){logger[_0x6c95('0xc')](util[_0x6c95('0xd')](_0x6c95('0x2e'),EXTRACTED_REPORT_ID,_0x6c95('0xf')),util['inspect'](_0x30c820,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6c95('0x2f'));})[_0x6c95('0x30')](function(){process[_0x6c95('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xc286=['Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range','isInteger','forEach','push','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x119c94,_0x580a55){var _0x55ebee=function(_0x5195ec){while(--_0x5195ec){_0x119c94['push'](_0x119c94['shift']());}};_0x55ebee(++_0x580a55);}(_0xc286,0xda));var _0x6c28=function(_0x22e4d8,_0x3d4684){_0x22e4d8=_0x22e4d8-0x0;var _0x2b54ad=_0xc286[_0x22e4d8];return _0x2b54ad;};'use strict';var util=require('util');var path=require(_0x6c28('0x0'));var _=require('lodash');var csv=require(_0x6c28('0x1'));var fs=require('fs');var BPromise=require(_0x6c28('0x2'));var zipdir=require(_0x6c28('0x3'));var rimraf=require(_0x6c28('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x6c28('0x5'))[_0x6c28('0x6')];var logger=require(_0x6c28('0x7'))(_0x6c28('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x6c28('0x9')][0x3];var PATH=process[_0x6c28('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x201a4e,_0xa9cb7d){var _0x5bb311={'status':_0x201a4e};var _0x527e74={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa9cb7d){_0x5bb311['savename']=_0xa9cb7d;}return db[_0x6c28('0xa')][_0x6c28('0xb')](_0x5bb311,_0x527e74);}function main(){var _0x153270=0x1388;var _0x5e5efd;logger[_0x6c28('0xc')](util[_0x6c28('0xd')](_0x6c28('0xe'),EXTRACTED_REPORT_ID,_0x6c28('0xf')));return db[_0x6c28('0x10')][_0x6c28('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6c28('0x12'),_0x6c28('0x13')]})[_0x6c28('0x14')](function(_0xc17f18){if(_0xc17f18){_0x5e5efd=_0xc17f18;_0x153270=_0x5e5efd[_0x6c28('0x13')]||0x1388;}})[_0x6c28('0x14')](function(){return dbH[_0x6c28('0x15')][_0x6c28('0x16')](util[_0x6c28('0xd')](_0x6c28('0x17'),QUERY),{'type':dbH[_0x6c28('0x15')][_0x6c28('0x18')]['SELECT']});})[_0x6c28('0x14')](function(_0x5a65b2){if(!_0x5a65b2[0x0][_0x6c28('0x19')]){return analyticExtractedReport(_0x6c28('0x1a'));}var _0x184da6=[];var _0x332b59=0x0;if(_0x5e5efd[_0x6c28('0x12')]){if(_0x5a65b2&&_0x5a65b2[_0x6c28('0x1b')]){var _0xe741cc=_[_0x6c28('0x1c')](_0x5a65b2[0x0]['num']/_0x153270);var _0x3a8e7e=Number[_0x6c28('0x1d')](_0x5a65b2[0x0][_0x6c28('0x19')]/_0x153270)?_0x5a65b2[0x0][_0x6c28('0x19')]%_0x153270:0x0;_0xe741cc[_0x6c28('0x1e')](function(_0x1d6294){if(_0x1d6294>0x0){_0x332b59+=_0x153270;}_0x184da6[_0x6c28('0x1f')](dbH[_0x6c28('0x15')][_0x6c28('0x16')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x153270,_0x332b59),{'type':dbH[_0x6c28('0x15')][_0x6c28('0x18')][_0x6c28('0x20')]}));});if(_0x3a8e7e>0x0){_0x332b59+=_0x153270;_0x184da6[_0x6c28('0x1f')](dbH['sequelize'][_0x6c28('0x16')](util[_0x6c28('0xd')](_0x6c28('0x21'),QUERY,_0x3a8e7e,_0x332b59),{'type':dbH[_0x6c28('0x15')]['QueryTypes']['SELECT']}));}}}else{_0x184da6[_0x6c28('0x1f')](dbH[_0x6c28('0x15')][_0x6c28('0x16')](QUERY,{'type':dbH[_0x6c28('0x15')][_0x6c28('0x18')][_0x6c28('0x20')]}));}var _0x11d650=path[_0x6c28('0x22')](PATH);var _0x13b775=path[_0x6c28('0x23')](PATH,'.csv');var _0x249f1c=_0x5e5efd[_0x6c28('0x12')]&&_0x184da6[_0x6c28('0x1b')]>0x1;var _0x15c953=[];if(!fs[_0x6c28('0x24')](path[_0x6c28('0x25')](_0x11d650,_0x13b775))&&_0x249f1c){fs[_0x6c28('0x26')](path[_0x6c28('0x25')](_0x11d650,_0x13b775));}return BPromise[_0x6c28('0x27')](_0x184da6,function(_0x3ddedf){_0x15c953[_0x6c28('0x1f')](_0x3ddedf);})[_0x6c28('0x14')](function(){for(var _0x1c446e=0x0;_0x1c446e<_0x15c953['length'];_0x1c446e+=0x1){var _0x181c0c;var _0x2c9b50=_0x15c953[_0x1c446e];if(_0x249f1c){_0x181c0c=path[_0x6c28('0x25')](_0x11d650,_0x13b775,util[_0x6c28('0xd')](_0x6c28('0x28'),_0x13b775,_0x1c446e,_0x6c28('0x29')));}else{_0x181c0c=path[_0x6c28('0x25')](_0x11d650,util[_0x6c28('0xd')]('%s.%s',_0x13b775,_0x6c28('0x29')));}fs[_0x6c28('0x2a')](_0x181c0c,csv(_0x2c9b50));}})[_0x6c28('0x14')](function(){if(_0x249f1c){return new Promise(function(_0x4f3b4e){zipdir(path[_0x6c28('0x25')](_0x11d650,_0x13b775),{'saveTo':path[_0x6c28('0x25')](_0x11d650,util[_0x6c28('0xd')](_0x6c28('0x2b'),_0x13b775,_0x6c28('0x2c')))},function(_0x51e372,_0x3e82cd){rimraf(path[_0x6c28('0x25')](_0x11d650,_0x13b775),function(){});_0x4f3b4e(_0x6c28('0x2d'));});});}})['then'](function(){logger[_0x6c28('0xc')](util[_0x6c28('0xd')](_0x6c28('0x2e'),EXTRACTED_REPORT_ID,_0x6c28('0xf')));return analyticExtractedReport(_0x6c28('0x2f'),_0x249f1c?util['format'](_0x6c28('0x2b'),_0x13b775,_0x249f1c?'zip':_0x6c28('0x29')):null);});})[_0x6c28('0x30')](function(_0x1b5477){logger[_0x6c28('0xc')](util[_0x6c28('0xd')](_0x6c28('0x31'),EXTRACTED_REPORT_ID,_0x6c28('0xf')),util[_0x6c28('0x32')](_0x1b5477,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6c28('0x33'));})[_0x6c28('0x34')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 69fd43b..56c0c95 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 _0x4c96=['createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','../../mysqldb','dbH','analytics','argv','savename','update','map','tableHeader','pick','toString','value','length','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','pageBreak','before','landscape','\x20/\x20','footer','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.pdf','mkdirSync','join','flatten','%s%d.%s','pdf','all','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-italic.ttf','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end'];(function(_0x51fb2b,_0x26f63a){var _0x2f36ea=function(_0x35032c){while(--_0x35032c){_0x51fb2b['push'](_0x51fb2b['shift']());}};_0x2f36ea(++_0x26f63a);}(_0x4c96,0x166));var _0x64c9=function(_0x444a7b,_0x2d8625){_0x444a7b=_0x444a7b-0x0;var _0x1368b4=_0x4c96[_0x444a7b];return _0x1368b4;};'use strict';var _=require(_0x64c9('0x0'));var fs=require('fs');var util=require(_0x64c9('0x1'));var path=require(_0x64c9('0x2'));var moment=require(_0x64c9('0x3'));var htmlToPdfmake=require(_0x64c9('0x4'));var PdfPrinter=require(_0x64c9('0x5'));var zipdir=require(_0x64c9('0x6'));var rimraf=require(_0x64c9('0x7'));var JSDOM=require(_0x64c9('0x8'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require(_0x64c9('0x9'))['db'];var dbH=require(_0x64c9('0x9'))[_0x64c9('0xa')];var logger=require('../../config/logger')(_0x64c9('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x64c9('0xc')][0x2]);var QUERY=process[_0x64c9('0xc')][0x3];var PATH=process[_0x64c9('0xc')][0x4];var NAME=process[_0x64c9('0xc')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5afa88,_0x2e4fbe){var _0x1788c2={'status':_0x5afa88};var _0x2b4869={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2e4fbe){_0x1788c2[_0x64c9('0xd')]=_0x2e4fbe;}return db['AnalyticExtractedReport'][_0x64c9('0xe')](_0x1788c2,_0x2b4869);}function getHeaders(_0x5c6470){return _[_0x64c9('0xf')](_0x5c6470,function(_0xae7a96){return{'text':_0xae7a96,'style':_0x64c9('0x10')};});}function getRows(_0x167d36,_0x242ca5){return _[_0x64c9('0xf')](_0x242ca5,function(_0x1ff373){return _(_0x1ff373)[_0x64c9('0x11')](_0x167d36)[_0x64c9('0xf')](function(_0x51a336){return _0x51a336?_[_0x64c9('0x12')](_0x51a336):'';})[_0x64c9('0x13')]();});}function createTable(_0x29d677,_0x20a743){var _0x5d82ca={'widths':_['fill'](Array(_0x29d677[_0x64c9('0x14')]),0x91),'heights':function(_0x4043df){return _0x4043df===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x18cce8=getHeaders(_0x29d677);_0x5d82ca[_0x64c9('0x15')][_0x64c9('0x16')](_0x18cce8);var _0x20a6ed=getRows(_0x29d677,_0x20a743);_0x5d82ca['body']=_0x5d82ca[_0x64c9('0x15')][_0x64c9('0x17')](_0x20a6ed);return _0x5d82ca;}function createTables(_0x3445e5){var _0x37b73a=[];var _0xce6839=_[_0x64c9('0x18')](Object[_0x64c9('0x19')](_0x3445e5[0x0]),0x5);_0xce6839[_0x64c9('0x1a')](function(_0x5d6017){_0x37b73a['push'](createTable(_0x5d6017,_0x3445e5));});return _0x37b73a;}function getPDFDocDefinition(_0x1043d5){var _0x3efc1c=util[_0x64c9('0x1b')](_0x64c9('0x1c'),NAME,EXTRACTED_REPORT[_0x64c9('0x1d')],moment(EXTRACTED_REPORT['startDate'])[_0x64c9('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x64c9('0x1e')])[_0x64c9('0x1b')](FORMAT));var _0x3f6e11=[];for(var _0x54bfd6=0x0;_0x54bfd6<_0x1043d5[_0x64c9('0x14')];_0x54bfd6++){var _0x742d7f=[];if(_0x54bfd6===0x0){_0x742d7f['push']({'text':_0x3efc1c,'style':_0x64c9('0x1f')});}var _0x363663={'table':_0x1043d5[_0x54bfd6]};if(_0x54bfd6>0x0){_0x363663[_0x64c9('0x20')]=_0x64c9('0x21');_0x363663['margin']=[0x0,0x46,0x0,0x0];}_0x742d7f[_0x64c9('0x16')](_0x363663);_0x3f6e11[_0x64c9('0x16')](_0x742d7f);}return{'pageSize':'A4','pageOrientation':_0x64c9('0x22'),'content':_0x3f6e11,'footer':function(_0x4fda5b,_0x45a9ed){return{'text':_0x4fda5b[_0x64c9('0x12')]()+_0x64c9('0x23')+_0x45a9ed,'style':_0x64c9('0x24')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x64c9('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x19d2e1){var _0x3d0721=0x1388;var _0x2e128f;if(!_0x19d2e1[0x0][_0x64c9('0x26')]){return analyticExtractedReport(_0x64c9('0x27'));}return db[_0x64c9('0x28')][_0x64c9('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x64c9('0x2a'),_0x64c9('0x2b')]})[_0x64c9('0x2c')](function(_0x1c13da){if(_0x1c13da){_0x2e128f=_0x1c13da;_0x3d0721=_0x2e128f[_0x64c9('0x2b')]||0x3e8;}})[_0x64c9('0x2c')](function(){var _0x1f1b59=[];var _0x4870b9=0x0;if(_0x2e128f[_0x64c9('0x2a')]){if(_0x19d2e1&&_0x19d2e1['length']){var _0x1a2d36=_[_0x64c9('0x2d')](_0x19d2e1[0x0][_0x64c9('0x26')]/_0x3d0721);var _0x1df879=Number[_0x64c9('0x2e')](_0x19d2e1[0x0][_0x64c9('0x26')]/_0x3d0721)?_0x19d2e1[0x0][_0x64c9('0x26')]%_0x3d0721:0x0;_0x1a2d36[_0x64c9('0x1a')](function(_0x2616db){if(_0x2616db>0x0){_0x4870b9+=_0x3d0721;}_0x1f1b59['push'](dbH[_0x64c9('0x2f')][_0x64c9('0x30')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3d0721,_0x4870b9),{'type':dbH['sequelize'][_0x64c9('0x31')][_0x64c9('0x32')]}));});if(_0x1df879>0x0){_0x4870b9+=_0x3d0721;_0x1f1b59[_0x64c9('0x16')](dbH[_0x64c9('0x2f')]['query'](util[_0x64c9('0x1b')](_0x64c9('0x33'),QUERY,_0x1df879,_0x4870b9),{'type':dbH['sequelize'][_0x64c9('0x31')][_0x64c9('0x32')]}));}}}else{_0x1f1b59[_0x64c9('0x16')](dbH[_0x64c9('0x2f')][_0x64c9('0x30')](QUERY,{'type':dbH[_0x64c9('0x2f')][_0x64c9('0x31')][_0x64c9('0x32')]}));}var _0x513035=path['dirname'](PATH);var _0x6d8f25=path[_0x64c9('0x34')](PATH,_0x64c9('0x35'));var _0x8d4b7e=_0x2e128f['split']&&_0x1f1b59[_0x64c9('0x14')]>0x1;var _0x19a7fc=[];if(!fs['existsSync'](path['join'](_0x513035,_0x6d8f25))&&_0x8d4b7e){fs[_0x64c9('0x36')](path[_0x64c9('0x37')](_0x513035,_0x6d8f25));}return BPromise['each'](_0x1f1b59,function(_0x1c4a70){_0x19a7fc[_0x64c9('0x16')](_0x1c4a70);})['then'](function(){var _0x2a8b50=[];for(var _0x2559ac=0x0;_0x2559ac<_0x19a7fc[_0x64c9('0x14')];_0x2559ac+=0x1){var _0x27dd60=_0x19a7fc[_0x2559ac];var _0x141ee5=createTables(_[_0x64c9('0x38')](_0x27dd60));var _0x17c980;var _0x5a2f64=getPDFDocDefinition(_0x141ee5);var _0x735962=getPDFPrinter();var _0x530898=_0x735962['createPdfKitDocument'](_0x5a2f64);if(_0x8d4b7e){_0x17c980=path[_0x64c9('0x37')](_0x513035,_0x6d8f25,util['format'](_0x64c9('0x39'),_0x6d8f25,_0x2559ac,_0x64c9('0x3a')));}else{_0x17c980=path[_0x64c9('0x37')](_0x513035,util[_0x64c9('0x1b')]('%s.%s',_0x6d8f25,'pdf'));}_0x2a8b50[_0x64c9('0x16')](writePDFDocument(_0x530898,_0x17c980));}return Promise[_0x64c9('0x3b')](_0x2a8b50);})['then'](function(){if(_0x8d4b7e){return new Promise(function(_0x14063a){zipdir(path['join'](_0x513035,_0x6d8f25),{'saveTo':path[_0x64c9('0x37')](_0x513035,util['format'](_0x64c9('0x3c'),_0x6d8f25,_0x64c9('0x3d')))},function(){rimraf(path['join'](_0x513035,_0x6d8f25),function(){});_0x14063a('zip\x20finished');});});}})[_0x64c9('0x2c')](function(){if(!_0x8d4b7e)return;rimraf(path[_0x64c9('0x37')](_0x513035,_0x6d8f25),function(){});})[_0x64c9('0x2c')](function(){logger[_0x64c9('0x3e')](util[_0x64c9('0x1b')](_0x64c9('0x3f'),EXTRACTED_REPORT_ID,_0x64c9('0x40')));return analyticExtractedReport(_0x64c9('0x41'),_0x8d4b7e?util['format']('%s.%s',_0x6d8f25,_0x8d4b7e?_0x64c9('0x3d'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x64c9('0x3e')](util[_0x64c9('0x1b')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x64c9('0x40')));return db[_0x64c9('0x42')][_0x64c9('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x64c9('0x2c')](function(_0x1f9a83){EXTRACTED_REPORT=_0x1f9a83;return dbH[_0x64c9('0x2f')][_0x64c9('0x30')](util[_0x64c9('0x1b')](_0x64c9('0x44'),QUERY),{'type':dbH[_0x64c9('0x2f')][_0x64c9('0x31')]['SELECT']});})['then'](extractReport)[_0x64c9('0x45')](function(_0x5bebbd){logger['info'](util['format'](_0x64c9('0x46'),EXTRACTED_REPORT_ID,_0x64c9('0x40')),util[_0x64c9('0x47')](_0x5bebbd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x64c9('0x48'));})[_0x64c9('0x49')](function(){process[_0x64c9('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2745fd=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x64c9('0x4b'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x2745fd;}function getPDFDocDefinitionFromHTML(_0x2f4aad,_0x13e7f8){var _0xf536e5=util[_0x64c9('0x1b')]('%s\x20#%d',_0x13e7f8[_0x64c9('0x4c')],_0x13e7f8[_0x64c9('0x4d')]);var _0x2f462a=moment()[_0x64c9('0x1b')](_0x64c9('0x4e'))['toString']();var _0x434365=htmlToPdfmake(_0x2f4aad,{'window':window,'tableAutoSize':!![]});return{'content':[_0x434365],'defaultStyle':{'font':_0x64c9('0x4f')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x64c9('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x64c9('0x50')}},'header':function(){return[{'text':_0x64c9('0x51'),'style':'header'}];},'footer':function(_0xd58469,_0x2b4b58){return[{'text':util[_0x64c9('0x1b')](_0x64c9('0x52'),_0xf536e5,_0xd58469,_0x2b4b58,_0x2f462a),'style':_0x64c9('0x24')}];}};}function writePDFDocument(_0x51a2df,_0x4aab69){return new Promise(function(_0x38f329,_0x4c1a3f){var _0x202018=_0x51a2df['pipe'](fs[_0x64c9('0x53')](_0x4aab69));_0x202018['on'](_0x64c9('0x54'),function(){_0x38f329('finish');});_0x202018['on'](_0x64c9('0x55'),function(_0x39ff2c){_0x4c1a3f(_0x39ff2c);});_0x51a2df[_0x64c9('0x56')]();});}exports[_0x64c9('0x57')]=function(_0xe38a90,_0x42647e){var _0x23c07b=getPDFPrinter();var _0x2bfdb7=getPDFDocDefinitionFromHTML(_0xe38a90,_0x42647e);var _0x242521=_0x23c07b[_0x64c9('0x58')](_0x2bfdb7);return writePDFDocument(_0x242521,_0x42647e['path'])['catch'](function(_0x2a742c){throw _0x2a742c;});}; \ No newline at end of file +var _0x4db4=['then','range','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','query','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','createPdfFromHTML','lodash','path','moment','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','map','pick','value','length','body','push','concat','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','pageBreak','margin','landscape','toString','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x4db4,0x195));var _0x44db=function(_0x1938d7,_0x52cf17){_0x1938d7=_0x1938d7-0x0;var _0x36f41d=_0x4db4[_0x1938d7];return _0x36f41d;};'use strict';var _=require(_0x44db('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x44db('0x1'));var moment=require(_0x44db('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x44db('0x3'));var zipdir=require(_0x44db('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0x44db('0x5'))[_0x44db('0x6')];var window=new JSDOM('')[_0x44db('0x7')];var BPromise=require(_0x44db('0x8'));var db=require('../../mysqldb')['db'];var dbH=require(_0x44db('0x9'))[_0x44db('0xa')];var logger=require(_0x44db('0xb'))(_0x44db('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x44db('0xd')][0x3];var PATH=process[_0x44db('0xd')][0x4];var NAME=process[_0x44db('0xd')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2c0edc,_0x3ab6f6){var _0x17d7df={'status':_0x2c0edc};var _0x2a4ddd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3ab6f6){_0x17d7df[_0x44db('0xe')]=_0x3ab6f6;}return db[_0x44db('0xf')]['update'](_0x17d7df,_0x2a4ddd);}function getHeaders(_0x13549f){return _[_0x44db('0x10')](_0x13549f,function(_0xcefde1){return{'text':_0xcefde1,'style':'tableHeader'};});}function getRows(_0x23f0a7,_0x583ba5){return _[_0x44db('0x10')](_0x583ba5,function(_0x3f3097){return _(_0x3f3097)[_0x44db('0x11')](_0x23f0a7)[_0x44db('0x10')](function(_0x205739){return _0x205739?_['toString'](_0x205739):'';})[_0x44db('0x12')]();});}function createTable(_0x521b8d,_0xbfe817){var _0xc2d8b0={'widths':_['fill'](Array(_0x521b8d[_0x44db('0x13')]),0x91),'heights':function(_0x517736){return _0x517736===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xba4c11=getHeaders(_0x521b8d);_0xc2d8b0[_0x44db('0x14')][_0x44db('0x15')](_0xba4c11);var _0x5511f9=getRows(_0x521b8d,_0xbfe817);_0xc2d8b0[_0x44db('0x14')]=_0xc2d8b0[_0x44db('0x14')][_0x44db('0x16')](_0x5511f9);return _0xc2d8b0;}function createTables(_0x44a220){var _0x1f2279=[];var _0x443684=_[_0x44db('0x17')](Object[_0x44db('0x18')](_0x44a220[0x0]),0x5);_0x443684['forEach'](function(_0x11b8f3){_0x1f2279['push'](createTable(_0x11b8f3,_0x44a220));});return _0x1f2279;}function getPDFDocDefinition(_0x52d4bb){var _0x27dc19=util[_0x44db('0x19')](_0x44db('0x1a'),NAME,EXTRACTED_REPORT[_0x44db('0x1b')],moment(EXTRACTED_REPORT[_0x44db('0x1c')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x44db('0x19')](FORMAT));var _0x179021=[];for(var _0x34d81b=0x0;_0x34d81b<_0x52d4bb['length'];_0x34d81b++){var _0x3a5ea0=[];if(_0x34d81b===0x0){_0x3a5ea0[_0x44db('0x15')]({'text':_0x27dc19,'style':_0x44db('0x1d')});}var _0x2fb8d6={'table':_0x52d4bb[_0x34d81b]};if(_0x34d81b>0x0){_0x2fb8d6[_0x44db('0x1e')]='before';_0x2fb8d6[_0x44db('0x1f')]=[0x0,0x46,0x0,0x0];}_0x3a5ea0[_0x44db('0x15')](_0x2fb8d6);_0x179021[_0x44db('0x15')](_0x3a5ea0);}return{'pageSize':'A4','pageOrientation':_0x44db('0x20'),'content':_0x179021,'footer':function(_0x5c9a7b,_0x1a1194){return{'text':_0x5c9a7b[_0x44db('0x21')]()+_0x44db('0x22')+_0x1a1194,'style':_0x44db('0x23')};},'defaultStyle':{'font':_0x44db('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x44db('0x25')},'footer':{'alignment':_0x44db('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x22e39b){var _0x4baa29=0x1388;var _0x202509;if(!_0x22e39b[0x0][_0x44db('0x27')]){return analyticExtractedReport(_0x44db('0x28'));}return db[_0x44db('0x29')][_0x44db('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x44db('0x2b'),_0x44db('0x2c')]})[_0x44db('0x2d')](function(_0x40c95c){if(_0x40c95c){_0x202509=_0x40c95c;_0x4baa29=_0x202509[_0x44db('0x2c')]||0x3e8;}})['then'](function(){var _0x209bad=[];var _0x3daa66=0x0;if(_0x202509[_0x44db('0x2b')]){if(_0x22e39b&&_0x22e39b[_0x44db('0x13')]){var _0x5797cf=_[_0x44db('0x2e')](_0x22e39b[0x0]['num']/_0x4baa29);var _0x42818a=Number['isInteger'](_0x22e39b[0x0]['num']/_0x4baa29)?_0x22e39b[0x0][_0x44db('0x27')]%_0x4baa29:0x0;_0x5797cf[_0x44db('0x2f')](function(_0x2511d6){if(_0x2511d6>0x0){_0x3daa66+=_0x4baa29;}_0x209bad[_0x44db('0x15')](dbH['sequelize']['query'](util[_0x44db('0x19')](_0x44db('0x30'),QUERY,_0x4baa29,_0x3daa66),{'type':dbH[_0x44db('0x31')][_0x44db('0x32')][_0x44db('0x33')]}));});if(_0x42818a>0x0){_0x3daa66+=_0x4baa29;_0x209bad[_0x44db('0x15')](dbH[_0x44db('0x31')]['query'](util[_0x44db('0x19')](_0x44db('0x30'),QUERY,_0x42818a,_0x3daa66),{'type':dbH[_0x44db('0x31')][_0x44db('0x32')][_0x44db('0x33')]}));}}}else{_0x209bad[_0x44db('0x15')](dbH[_0x44db('0x31')][_0x44db('0x34')](QUERY,{'type':dbH['sequelize'][_0x44db('0x32')][_0x44db('0x33')]}));}var _0x4dc2ef=path['dirname'](PATH);var _0x3b4e41=path[_0x44db('0x35')](PATH,_0x44db('0x36'));var _0x4add37=_0x202509[_0x44db('0x2b')]&&_0x209bad['length']>0x1;var _0x53bb50=[];if(!fs[_0x44db('0x37')](path[_0x44db('0x38')](_0x4dc2ef,_0x3b4e41))&&_0x4add37){fs[_0x44db('0x39')](path['join'](_0x4dc2ef,_0x3b4e41));}return BPromise[_0x44db('0x3a')](_0x209bad,function(_0x3bb549){_0x53bb50['push'](_0x3bb549);})[_0x44db('0x2d')](function(){var _0x25e372=[];for(var _0x4f5d73=0x0;_0x4f5d73<_0x53bb50[_0x44db('0x13')];_0x4f5d73+=0x1){var _0x59c05f=_0x53bb50[_0x4f5d73];var _0x2d6dd0=createTables(_[_0x44db('0x3b')](_0x59c05f));var _0x4db22e;var _0x297f68=getPDFDocDefinition(_0x2d6dd0);var _0x180307=getPDFPrinter();var _0x38b246=_0x180307[_0x44db('0x3c')](_0x297f68);if(_0x4add37){_0x4db22e=path[_0x44db('0x38')](_0x4dc2ef,_0x3b4e41,util[_0x44db('0x19')](_0x44db('0x3d'),_0x3b4e41,_0x4f5d73,_0x44db('0x3e')));}else{_0x4db22e=path['join'](_0x4dc2ef,util[_0x44db('0x19')](_0x44db('0x3f'),_0x3b4e41,_0x44db('0x3e')));}_0x25e372['push'](writePDFDocument(_0x38b246,_0x4db22e));}return Promise[_0x44db('0x40')](_0x25e372);})[_0x44db('0x2d')](function(){if(_0x4add37){return new Promise(function(_0x578eb9){zipdir(path['join'](_0x4dc2ef,_0x3b4e41),{'saveTo':path[_0x44db('0x38')](_0x4dc2ef,util[_0x44db('0x19')](_0x44db('0x3f'),_0x3b4e41,_0x44db('0x41')))},function(){rimraf(path[_0x44db('0x38')](_0x4dc2ef,_0x3b4e41),function(){});_0x578eb9(_0x44db('0x42'));});});}})[_0x44db('0x2d')](function(){if(!_0x4add37)return;rimraf(path[_0x44db('0x38')](_0x4dc2ef,_0x3b4e41),function(){});})[_0x44db('0x2d')](function(){logger['info'](util[_0x44db('0x19')](_0x44db('0x43'),EXTRACTED_REPORT_ID,_0x44db('0x44')));return analyticExtractedReport('Completed',_0x4add37?util['format'](_0x44db('0x3f'),_0x3b4e41,_0x4add37?'zip':'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x44db('0x45')](util['format'](_0x44db('0x46'),EXTRACTED_REPORT_ID,_0x44db('0x44')));return db['AnalyticExtractedReport'][_0x44db('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x29c8df){EXTRACTED_REPORT=_0x29c8df;return dbH[_0x44db('0x31')][_0x44db('0x34')](util[_0x44db('0x19')](_0x44db('0x48'),QUERY),{'type':dbH[_0x44db('0x31')]['QueryTypes'][_0x44db('0x33')]});})['then'](extractReport)['catch'](function(_0x362708){logger[_0x44db('0x45')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x44db('0x44')),util[_0x44db('0x49')](_0x362708,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x44db('0x4a'));})[_0x44db('0x4b')](function(){process[_0x44db('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x7e89c8=new PdfPrinter({'Arial':{'normal':__dirname+_0x44db('0x4d'),'bold':__dirname+_0x44db('0x4e'),'italics':__dirname+_0x44db('0x4f'),'bolditalics':__dirname+_0x44db('0x50')}});return _0x7e89c8;}function getPDFDocDefinitionFromHTML(_0x33e1a3,_0x410fe5){var _0x5d9ebd=util[_0x44db('0x19')](_0x44db('0x51'),_0x410fe5['channel'],_0x410fe5[_0x44db('0x52')]);var _0x52400a=moment()[_0x44db('0x19')](_0x44db('0x53'))[_0x44db('0x21')]();var _0x2c0d3e=htmlToPdfmake(_0x33e1a3,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2c0d3e],'defaultStyle':{'font':_0x44db('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x44db('0x1d')}];},'footer':function(_0x13e7d1,_0x45b5aa){return[{'text':util['format'](_0x44db('0x54'),_0x5d9ebd,_0x13e7d1,_0x45b5aa,_0x52400a),'style':_0x44db('0x23')}];}};}function writePDFDocument(_0x588cb2,_0x31d1e5){return new Promise(function(_0x38f2df,_0x521215){var _0x4bbe2b=_0x588cb2[_0x44db('0x55')](fs[_0x44db('0x56')](_0x31d1e5));_0x4bbe2b['on'](_0x44db('0x57'),function(){_0x38f2df('finish');});_0x4bbe2b['on'](_0x44db('0x58'),function(_0x30cb6b){_0x521215(_0x30cb6b);});_0x588cb2['end']();});}exports[_0x44db('0x59')]=function(_0x2a6e45,_0x3164f9){var _0x357b37=getPDFPrinter();var _0x395996=getPDFDocDefinitionFromHTML(_0x2a6e45,_0x3164f9);var _0x47e4e4=_0x357b37[_0x44db('0x3c')](_0x395996);return writePDFDocument(_0x47e4e4,_0x3164f9[_0x44db('0x1')])['catch'](function(_0x180f05){throw _0x180f05;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index abcee53..65c7fca 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 _0x0abf=['num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','%s%d.%s','xlsx','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','%s.%s','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','lodash','json2xls','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT'];(function(_0x35ec77,_0xe2fc88){var _0x51a679=function(_0x129da5){while(--_0x129da5){_0x35ec77['push'](_0x35ec77['shift']());}};_0x51a679(++_0xe2fc88);}(_0x0abf,0xe8));var _0xf0ab=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0abf[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0xf0ab('0x0'));var path=require('path');var _=require(_0xf0ab('0x1'));var fs=require('fs');var json2xls=require(_0xf0ab('0x2'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0xf0ab('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf0ab('0x4'))[_0xf0ab('0x5')];var logger=require(_0xf0ab('0x6'))(_0xf0ab('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xf0ab('0x8')][0x2]);var QUERY=process[_0xf0ab('0x8')][0x3];var PATH=process[_0xf0ab('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x57ff3b,_0x2c4628){var _0x3f7e2b={'status':_0x57ff3b};var _0x3ca099={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2c4628){_0x3f7e2b[_0xf0ab('0x9')]=_0x2c4628;}return db['AnalyticExtractedReport'][_0xf0ab('0xa')](_0x3f7e2b,_0x3ca099);}function main(){var _0x4688d8=0x1388;var _0x1e7887;logger['info'](util['format'](_0xf0ab('0xb'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xf0ab('0xc')][_0xf0ab('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf0ab('0xe'),_0xf0ab('0xf')]})[_0xf0ab('0x10')](function(_0x38ca67){if(_0x38ca67){_0x1e7887=_0x38ca67;_0x4688d8=_0x1e7887[_0xf0ab('0xf')]||0x1388;}})['then'](function(){return dbH[_0xf0ab('0x11')][_0xf0ab('0x12')](util[_0xf0ab('0x13')](_0xf0ab('0x14'),QUERY),{'type':dbH[_0xf0ab('0x11')][_0xf0ab('0x15')][_0xf0ab('0x16')]});})[_0xf0ab('0x10')](function(_0x180d0b){if(!_0x180d0b[0x0][_0xf0ab('0x17')]){return analyticExtractedReport(_0xf0ab('0x18'));}var _0x221bac=[];var _0x200cf5=0x0;if(_0x1e7887[_0xf0ab('0xe')]){if(_0x180d0b&&_0x180d0b[_0xf0ab('0x19')]){var _0x54b0ce=_[_0xf0ab('0x1a')](_0x180d0b[0x0][_0xf0ab('0x17')]/_0x4688d8);var _0x1803f0=Number[_0xf0ab('0x1b')](_0x180d0b[0x0][_0xf0ab('0x17')]/_0x4688d8)?_0x180d0b[0x0][_0xf0ab('0x17')]%_0x4688d8:0x0;_0x54b0ce[_0xf0ab('0x1c')](function(_0x263e2b){if(_0x263e2b>0x0){_0x200cf5+=_0x4688d8;}_0x221bac[_0xf0ab('0x1d')](dbH[_0xf0ab('0x11')][_0xf0ab('0x12')](util[_0xf0ab('0x13')](_0xf0ab('0x1e'),QUERY,_0x4688d8,_0x200cf5),{'type':dbH[_0xf0ab('0x11')][_0xf0ab('0x15')][_0xf0ab('0x16')]}));});if(_0x1803f0>0x0){_0x200cf5+=_0x4688d8;_0x221bac['push'](dbH[_0xf0ab('0x11')][_0xf0ab('0x12')](util[_0xf0ab('0x13')](_0xf0ab('0x1e'),QUERY,_0x1803f0,_0x200cf5),{'type':dbH[_0xf0ab('0x11')][_0xf0ab('0x15')][_0xf0ab('0x16')]}));}}}else{_0x221bac[_0xf0ab('0x1d')](dbH[_0xf0ab('0x11')][_0xf0ab('0x12')](QUERY,{'type':dbH[_0xf0ab('0x11')]['QueryTypes']['SELECT']}));}var _0x4eee21=path[_0xf0ab('0x1f')](PATH);var _0x4f0caf=path[_0xf0ab('0x20')](PATH,_0xf0ab('0x21'));var _0x51ac90=_0x1e7887[_0xf0ab('0xe')]&&_0x221bac[_0xf0ab('0x19')]>0x1;var _0x10bf5f=[];if(!fs[_0xf0ab('0x22')](path[_0xf0ab('0x23')](_0x4eee21,_0x4f0caf))&&_0x51ac90){fs['mkdirSync'](path[_0xf0ab('0x23')](_0x4eee21,_0x4f0caf));}return BPromise['each'](_0x221bac,function(_0x55d799){_0x10bf5f[_0xf0ab('0x1d')](_0x55d799);})[_0xf0ab('0x10')](function(){for(var _0x1b223d=0x0;_0x1b223d<_0x10bf5f[_0xf0ab('0x19')];_0x1b223d+=0x1){var _0x43476c;var _0x174052=_0x10bf5f[_0x1b223d];if(_0x51ac90){_0x43476c=path[_0xf0ab('0x23')](_0x4eee21,_0x4f0caf,util[_0xf0ab('0x13')](_0xf0ab('0x24'),_0x4f0caf,_0x1b223d,_0xf0ab('0x25')));}else{_0x43476c=path[_0xf0ab('0x23')](_0x4eee21,util[_0xf0ab('0x13')]('%s.%s',_0x4f0caf,_0xf0ab('0x25')));}fs[_0xf0ab('0x26')](_0x43476c,json2xls(_0x174052),'binary');}})['then'](function(){if(_0x51ac90){return new Promise(function(_0x1eff91){zipdir(path[_0xf0ab('0x23')](_0x4eee21,_0x4f0caf),{'saveTo':path[_0xf0ab('0x23')](_0x4eee21,util['format']('%s.%s',_0x4f0caf,_0xf0ab('0x27')))},function(_0x58fa03,_0x1cfd52){rimraf(path['join'](_0x4eee21,_0x4f0caf),function(){});_0x1eff91(_0xf0ab('0x28'));});});}})[_0xf0ab('0x10')](function(){logger['info'](util['format'](_0xf0ab('0x29'),EXTRACTED_REPORT_ID,_0xf0ab('0x2a')));return analyticExtractedReport(_0xf0ab('0x2b'),_0x51ac90?util[_0xf0ab('0x13')](_0xf0ab('0x2c'),_0x4f0caf,_0x51ac90?_0xf0ab('0x27'):_0xf0ab('0x25')):null);});})[_0xf0ab('0x2d')](function(_0x2a2f5d){logger[_0xf0ab('0x2e')](util[_0xf0ab('0x13')](_0xf0ab('0x2f'),EXTRACTED_REPORT_ID,_0xf0ab('0x2a')),util[_0xf0ab('0x30')](_0x2a2f5d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xf0ab('0x31')](function(){process[_0xf0ab('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xefad=['%s.%s','xlsx','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Failed','finally','exit','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s'];(function(_0x62040,_0x49cb23){var _0x8c8a9=function(_0x3b72ac){while(--_0x3b72ac){_0x62040['push'](_0x62040['shift']());}};_0x8c8a9(++_0x49cb23);}(_0xefad,0x1d6));var _0xdefa=function(_0x53bd6f,_0x15828a){_0x53bd6f=_0x53bd6f-0x0;var _0x5f4e08=_0xefad[_0x53bd6f];return _0x5f4e08;};'use strict';var util=require(_0xdefa('0x0'));var path=require('path');var _=require(_0xdefa('0x1'));var fs=require('fs');var json2xls=require(_0xdefa('0x2'));var BPromise=require(_0xdefa('0x3'));var zipdir=require(_0xdefa('0x4'));var rimraf=require(_0xdefa('0x5'));var db=require(_0xdefa('0x6'))['db'];var dbH=require(_0xdefa('0x6'))[_0xdefa('0x7')];var logger=require(_0xdefa('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xdefa('0x9')][0x2]);var QUERY=process[_0xdefa('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x7cbdb1,_0xfe80f7){var _0x31382d={'status':_0x7cbdb1};var _0x5a8897={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xfe80f7){_0x31382d['savename']=_0xfe80f7;}return db['AnalyticExtractedReport'][_0xdefa('0xa')](_0x31382d,_0x5a8897);}function main(){var _0xeb3171=0x1388;var _0x1c57cc;logger[_0xdefa('0xb')](util[_0xdefa('0xc')](_0xdefa('0xd'),EXTRACTED_REPORT_ID,_0xdefa('0xe')));return db[_0xdefa('0xf')][_0xdefa('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdefa('0x11'),_0xdefa('0x12')]})[_0xdefa('0x13')](function(_0x3c2e8a){if(_0x3c2e8a){_0x1c57cc=_0x3c2e8a;_0xeb3171=_0x1c57cc['splitSizeXlsx']||0x1388;}})[_0xdefa('0x13')](function(){return dbH[_0xdefa('0x14')][_0xdefa('0x15')](util[_0xdefa('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xdefa('0x14')][_0xdefa('0x16')][_0xdefa('0x17')]});})['then'](function(_0x3cf842){if(!_0x3cf842[0x0][_0xdefa('0x18')]){return analyticExtractedReport(_0xdefa('0x19'));}var _0x9e2c18=[];var _0x174441=0x0;if(_0x1c57cc['split']){if(_0x3cf842&&_0x3cf842[_0xdefa('0x1a')]){var _0x4138b2=_[_0xdefa('0x1b')](_0x3cf842[0x0][_0xdefa('0x18')]/_0xeb3171);var _0x3f3b86=Number[_0xdefa('0x1c')](_0x3cf842[0x0][_0xdefa('0x18')]/_0xeb3171)?_0x3cf842[0x0][_0xdefa('0x18')]%_0xeb3171:0x0;_0x4138b2[_0xdefa('0x1d')](function(_0x2ba495){if(_0x2ba495>0x0){_0x174441+=_0xeb3171;}_0x9e2c18['push'](dbH[_0xdefa('0x14')][_0xdefa('0x15')](util['format'](_0xdefa('0x1e'),QUERY,_0xeb3171,_0x174441),{'type':dbH[_0xdefa('0x14')][_0xdefa('0x16')]['SELECT']}));});if(_0x3f3b86>0x0){_0x174441+=_0xeb3171;_0x9e2c18['push'](dbH[_0xdefa('0x14')]['query'](util[_0xdefa('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3f3b86,_0x174441),{'type':dbH[_0xdefa('0x14')]['QueryTypes'][_0xdefa('0x17')]}));}}}else{_0x9e2c18[_0xdefa('0x1f')](dbH[_0xdefa('0x14')][_0xdefa('0x15')](QUERY,{'type':dbH['sequelize'][_0xdefa('0x16')][_0xdefa('0x17')]}));}var _0x34c1d7=path[_0xdefa('0x20')](PATH);var _0x573257=path[_0xdefa('0x21')](PATH,_0xdefa('0x22'));var _0x4434b7=_0x1c57cc['split']&&_0x9e2c18[_0xdefa('0x1a')]>0x1;var _0x2501b6=[];if(!fs[_0xdefa('0x23')](path['join'](_0x34c1d7,_0x573257))&&_0x4434b7){fs[_0xdefa('0x24')](path[_0xdefa('0x25')](_0x34c1d7,_0x573257));}return BPromise[_0xdefa('0x26')](_0x9e2c18,function(_0x522e89){_0x2501b6[_0xdefa('0x1f')](_0x522e89);})[_0xdefa('0x13')](function(){for(var _0x4c87ea=0x0;_0x4c87ea<_0x2501b6[_0xdefa('0x1a')];_0x4c87ea+=0x1){var _0x2bf770;var _0x376b39=_0x2501b6[_0x4c87ea];if(_0x4434b7){_0x2bf770=path[_0xdefa('0x25')](_0x34c1d7,_0x573257,util[_0xdefa('0xc')](_0xdefa('0x27'),_0x573257,_0x4c87ea,'xlsx'));}else{_0x2bf770=path['join'](_0x34c1d7,util[_0xdefa('0xc')](_0xdefa('0x28'),_0x573257,_0xdefa('0x29')));}fs[_0xdefa('0x2a')](_0x2bf770,json2xls(_0x376b39),'binary');}})['then'](function(){if(_0x4434b7){return new Promise(function(_0x4c2b65){zipdir(path['join'](_0x34c1d7,_0x573257),{'saveTo':path['join'](_0x34c1d7,util[_0xdefa('0xc')](_0xdefa('0x28'),_0x573257,_0xdefa('0x2b')))},function(_0x407ffe,_0x6ddbe4){rimraf(path[_0xdefa('0x25')](_0x34c1d7,_0x573257),function(){});_0x4c2b65(_0xdefa('0x2c'));});});}})[_0xdefa('0x13')](function(){logger[_0xdefa('0xb')](util['format'](_0xdefa('0x2d'),EXTRACTED_REPORT_ID,_0xdefa('0xe')));return analyticExtractedReport(_0xdefa('0x2e'),_0x4434b7?util['format'](_0xdefa('0x28'),_0x573257,_0x4434b7?'zip':_0xdefa('0x29')):null);});})[_0xdefa('0x2f')](function(_0x391362){logger['info'](util[_0xdefa('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xdefa('0xe')),util['inspect'](_0x391362,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdefa('0x30'));})[_0xdefa('0x31')](function(){process[_0xdefa('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index a9deb78..2e5717d 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 _0x76ac=['lodash','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','filter','exten','queue','playback','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','VoiceExtensionId','CDR(routeid)=','context','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','tag','CDR(tag)=','hasOwnProperty','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','rewrite'];(function(_0x30c8e7,_0x4bf263){var _0x5554a2=function(_0x4eb7e8){while(--_0x4eb7e8){_0x30c8e7['push'](_0x30c8e7['shift']());}};_0x5554a2(++_0x4bf263);}(_0x76ac,0x145));var _0xc76a=function(_0x49115e,_0x55881f){_0x49115e=_0x49115e-0x0;var _0x1ab2b3=_0x76ac[_0x49115e];return _0x1ab2b3;};'use strict';var _=require(_0xc76a('0x0'));var util=require('util');function rewrite(_0x21d709,_0x517d21){var _0x59f243=this;return _0x21d709[_0xc76a('0x1')][_0xc76a('0x2')][_0xc76a('0x3')]({'raw':!![]})[_0xc76a('0x4')](function(_0x160e7f){_0x59f243[_0xc76a('0x5')]=_0x160e7f;return _0x21d709[_0xc76a('0x1')][_0xc76a('0x6')][_0xc76a('0x3')]({'where':{'IntervalId':_0x517d21[_0xc76a('0x7')]},'raw':!![]});})[_0xc76a('0x4')](function(_0x14b575){return _0x21d709[_0xc76a('0x1')][_0xc76a('0x6')]['findAll']({'where':{'exten':{'$in':_['uniq'](_['map'](_0x14b575,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x50c1a0){var _0x56cf69=_['filter'](_0x50c1a0,{'priority':'1'});var _0x5eb2ff=_[_0xc76a('0x8')](_0x50c1a0,{'isApp':0x1});var _0x13355b=_['groupBy'](_0x5eb2ff,_0xc76a('0x9'));var _0x190a30=[_0xc76a('0xa'),_0xc76a('0xb')];var _0x5b6e28=[];var _0x65d671=[];for(var _0x9cd199 in _0x13355b){if(_0x13355b['hasOwnProperty'](_0x9cd199)){_0x59f243[_0xc76a('0xc')]=0x2;_0x59f243[_0xc76a('0xd')]=[];_0x59f243[_0xc76a('0xe')]=_[_0xc76a('0xf')](_0x56cf69,{'exten':_0x13355b[_0x9cd199][0x0]['exten']});_0x59f243[_0xc76a('0xd')][_0xc76a('0x10')]({'type':_0x13355b[_0x9cd199][0x0][_0xc76a('0x11')],'app':_0xc76a('0x12'),'appdata':util[_0xc76a('0x13')](_0xc76a('0x14'),_0x13355b[_0x9cd199][0x0]['type']),'context':_0x13355b[_0x9cd199][0x0]['context'],'exten':_0x13355b[_0x9cd199][0x0][_0xc76a('0x9')],'priority':_0x59f243[_0xc76a('0xc')]++,'VoiceExtensionId':_0x13355b[_0x9cd199][0x0][_0xc76a('0x15')]});if(_0x13355b[_0x9cd199][0x0][_0xc76a('0x11')]==='inbound'){_0x59f243[_0xc76a('0xd')]['push']({'type':_0x13355b[_0x9cd199][0x0]['type'],'app':_0xc76a('0x12'),'appdata':_0xc76a('0x16')+_0x13355b[_0x9cd199][0x0][_0xc76a('0x15')],'context':_0x13355b[_0x9cd199][0x0][_0xc76a('0x17')],'exten':_0x13355b[_0x9cd199][0x0][_0xc76a('0x9')],'priority':_0x59f243[_0xc76a('0xc')]++,'VoiceExtensionId':_0x13355b[_0x9cd199][0x0][_0xc76a('0x15')]});}else if(_0x13355b[_0x9cd199][0x0][_0xc76a('0x11')]===_0xc76a('0x18')){if(_0x59f243[_0xc76a('0xe')]){_0x59f243[_0xc76a('0xd')][_0xc76a('0x10')]({'type':_0x13355b[_0x9cd199][0x0][_0xc76a('0x11')],'app':_0xc76a('0x12'),'appdata':_0xc76a('0x19')+(_0x59f243['extension'][_0xc76a('0x1a')]?_0xc76a('0x1b')+_0x59f243[_0xc76a('0xe')][_0xc76a('0x1a')]+'}':'${EXTEN}'),'context':_0x13355b[_0x9cd199][0x0][_0xc76a('0x17')],'exten':_0x13355b[_0x9cd199][0x0][_0xc76a('0x9')],'priority':_0x59f243[_0xc76a('0xc')]++,'VoiceExtensionId':_0x13355b[_0x9cd199][0x0][_0xc76a('0x15')]});}_0x59f243['extensions'][_0xc76a('0x10')]({'type':_0x13355b[_0x9cd199][0x0][_0xc76a('0x11')],'app':_0xc76a('0x12'),'appdata':_0xc76a('0x16')+_0x13355b[_0x9cd199][0x0][_0xc76a('0x15')],'context':_0x13355b[_0x9cd199][0x0][_0xc76a('0x17')],'exten':_0x13355b[_0x9cd199][0x0][_0xc76a('0x9')],'priority':_0x59f243[_0xc76a('0xc')]++,'VoiceExtensionId':_0x13355b[_0x9cd199][0x0][_0xc76a('0x15')]});var _0xee1445=_0x59f243[_0xc76a('0xc')]++;_0x59f243['extensions'][_0xc76a('0x10')]({'type':_0x13355b[_0x9cd199][0x0]['type'],'app':_0xc76a('0x1c'),'appdata':_0xc76a('0x1d')+(_0xee1445+0x2)+'):Goto('+(_0xee1445+0x1)+')','context':_0x13355b[_0x9cd199][0x0][_0xc76a('0x17')],'exten':_0x13355b[_0x9cd199][0x0]['exten'],'priority':_0xee1445,'VoiceExtensionId':_0x13355b[_0x9cd199][0x0]['VoiceExtensionId']});if(_0x59f243[_0xc76a('0xe')]){_0x59f243[_0xc76a('0xd')][_0xc76a('0x10')]({'type':_0x13355b[_0x9cd199][0x0][_0xc76a('0x11')],'app':_0xc76a('0x12'),'appdata':_0x59f243[_0xc76a('0xe')][_0xc76a('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0x59f243[_0xc76a('0xe')][_0xc76a('0x1a')]+'}':_0xc76a('0x1e'),'context':_0x13355b[_0x9cd199][0x0][_0xc76a('0x17')],'exten':_0x13355b[_0x9cd199][0x0][_0xc76a('0x9')],'priority':_0x59f243[_0xc76a('0xc')]++,'VoiceExtensionId':_0x13355b[_0x9cd199][0x0][_0xc76a('0x15')]});}_0x59f243[_0xc76a('0xd')]['push']({'type':_0x13355b[_0x9cd199][0x0]['type'],'app':_0xc76a('0x12'),'appdata':_0xc76a('0x1f')+_0x13355b[_0x9cd199][0x0][_0xc76a('0x15')],'context':_0x13355b[_0x9cd199][0x0][_0xc76a('0x17')],'exten':_0x13355b[_0x9cd199][0x0]['exten'],'priority':_0x59f243[_0xc76a('0xc')]++,'VoiceExtensionId':_0x13355b[_0x9cd199][0x0]['VoiceExtensionId']});if(_0x59f243[_0xc76a('0xe')]&&_0x59f243[_0xc76a('0xe')]['hasOwnProperty'](_0xc76a('0x20'))&&_0x59f243['extension'][_0xc76a('0x20')]!==_0xc76a('0x21')){_0x59f243[_0xc76a('0xd')][_0xc76a('0x10')]({'type':_0x13355b[_0x9cd199][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x13355b[_0x9cd199][0x0][_0xc76a('0x17')],'exten':_0x13355b[_0x9cd199][0x0][_0xc76a('0x9')],'priority':_0x59f243['priority']++,'VoiceExtensionId':_0x13355b[_0x9cd199][0x0]['VoiceExtensionId']});_0x59f243['extensions'][_0xc76a('0x10')]({'type':_0x13355b[_0x9cd199][0x0][_0xc76a('0x11')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x59f243['extension'][_0xc76a('0x20')]||_0xc76a('0x22'),'context':_0x13355b[_0x9cd199][0x0][_0xc76a('0x17')],'exten':_0x13355b[_0x9cd199][0x0]['exten'],'priority':_0x59f243[_0xc76a('0xc')]++,'VoiceExtensionId':_0x13355b[_0x9cd199][0x0]['VoiceExtensionId']});}}_0x59f243[_0xc76a('0xd')]['push']({'type':_0x13355b[_0x9cd199][0x0][_0xc76a('0x11')],'app':'Set','appdata':_0xc76a('0x23'),'context':_0x13355b[_0x9cd199][0x0][_0xc76a('0x17')],'exten':_0x13355b[_0x9cd199][0x0][_0xc76a('0x9')],'priority':_0x59f243[_0xc76a('0xc')]++,'VoiceExtensionId':_0x13355b[_0x9cd199][0x0][_0xc76a('0x15')]});_0x59f243[_0xc76a('0xd')][_0xc76a('0x10')]({'type':_0x13355b[_0x9cd199][0x0][_0xc76a('0x11')],'app':_0xc76a('0x12'),'appdata':_0xc76a('0x24'),'context':_0x13355b[_0x9cd199][0x0][_0xc76a('0x17')],'exten':_0x13355b[_0x9cd199][0x0][_0xc76a('0x9')],'priority':_0x59f243[_0xc76a('0xc')]++,'VoiceExtensionId':_0x13355b[_0x9cd199][0x0][_0xc76a('0x15')]});_0x59f243['extensions'][_0xc76a('0x10')]({'type':_0x13355b[_0x9cd199][0x0][_0xc76a('0x11')],'app':_0xc76a('0x12'),'appdata':_0xc76a('0x25'),'context':_0x13355b[_0x9cd199][0x0][_0xc76a('0x17')],'exten':_0x13355b[_0x9cd199][0x0]['exten'],'priority':_0x59f243[_0xc76a('0xc')]++,'VoiceExtensionId':_0x13355b[_0x9cd199][0x0][_0xc76a('0x15')]});for(var _0x366350=0x0,_0x51ff08=0x0;_0x366350<_0x13355b[_0x9cd199][_0xc76a('0x26')];_0x366350+=0x1,_0x51ff08=0x0){var _0x75e149=_0x13355b[_0x9cd199][_0x366350];if(_0x75e149['type']){_0x75e149[_0xc76a('0x11')]=_0x75e149[_0xc76a('0x11')][_0xc76a('0x27')]();}var _0x139da1=[];var _0x4ce8a2=[];delete _0x75e149['id'];delete _0x75e149[_0xc76a('0x28')];delete _0x75e149[_0xc76a('0x29')];var _0xef7ea1=_0x75e149[_0xc76a('0x2a')]!=='*,*,*,*'?[_0x75e149['interval']]:_0x75e149[_0xc76a('0x7')]?_['map'](_[_0xc76a('0x8')](_0x59f243[_0xc76a('0x5')],{'IntervalId':_0x75e149[_0xc76a('0x7')]}),_0xc76a('0x2a')):[];if(_0x75e149['hasOwnProperty']('tag')){if(_0x75e149['tag']&&_0x75e149[_0xc76a('0x2b')]!=='--'){_0x139da1['push']({'type':_0x75e149[_0xc76a('0x11')],'app':_0xc76a('0x12'),'appdata':_0xc76a('0x2c')+_0x75e149['tag'],'context':_0x75e149[_0xc76a('0x17')],'exten':_0x75e149['exten'],'priority':_0xef7ea1[_0xc76a('0x26')]+_0x59f243[_0xc76a('0xc')]+_0x51ff08++,'VoiceExtensionId':_0x75e149['VoiceExtensionId']});}}if(_0x75e149[_0xc76a('0x11')]==='outbound'&&_0x75e149[_0xc76a('0x2d')]('callerID')){if(_0x75e149[_0xc76a('0x2e')]){_0x139da1[_0xc76a('0x10')]({'type':_0x75e149['type'],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x75e149['callerID']+')','context':_0x75e149[_0xc76a('0x17')],'exten':_0x75e149['exten'],'priority':_0xef7ea1[_0xc76a('0x26')]+_0x59f243[_0xc76a('0xc')]+_0x51ff08++,'VoiceExtensionId':_0x75e149[_0xc76a('0x15')]});}else{_0x139da1[_0xc76a('0x10')]({'type':_0x75e149['type'],'app':_0xc76a('0x1c'),'appdata':_0xc76a('0x2f'),'context':_0x75e149[_0xc76a('0x17')],'exten':_0x75e149[_0xc76a('0x9')],'priority':_0xef7ea1[_0xc76a('0x26')]+_0x59f243[_0xc76a('0xc')]+_0x51ff08++,'VoiceExtensionId':_0x75e149[_0xc76a('0x15')]});}}if(_0x75e149['hasOwnProperty'](_0xc76a('0x30'))){if(_0x190a30[_0xc76a('0x31')](_0x75e149[_0xc76a('0x32')][_0xc76a('0x27')]())>=0x0&&_0x75e149[_0xc76a('0x33')]!==_0xc76a('0x34')){if(_0x75e149[_0xc76a('0x30')]){_0x139da1[_0xc76a('0x10')]({'type':_0x75e149['type'],'app':_0xc76a('0x1c'),'appdata':_0xc76a('0x35'),'context':_0x75e149[_0xc76a('0x17')],'exten':_0x75e149['exten'],'priority':_0xef7ea1[_0xc76a('0x26')]+_0x59f243['priority']+_0x51ff08++,'VoiceExtensionId':_0x75e149[_0xc76a('0x15')]});_0x139da1[_0xc76a('0x10')]({'type':_0x75e149['type'],'app':_0xc76a('0x12'),'appdata':_0xc76a('0x36'),'context':_0x75e149[_0xc76a('0x17')],'exten':_0x75e149[_0xc76a('0x9')],'priority':_0xef7ea1[_0xc76a('0x26')]+_0x59f243[_0xc76a('0xc')]+_0x51ff08++,'VoiceExtensionId':_0x75e149[_0xc76a('0x15')]});}else{_0x139da1['push']({'type':_0x75e149[_0xc76a('0x11')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x75e149[_0xc76a('0x17')],'exten':_0x75e149[_0xc76a('0x9')],'priority':_0xef7ea1['length']+_0x59f243[_0xc76a('0xc')]+_0x51ff08++,'VoiceExtensionId':_0x75e149[_0xc76a('0x15')]});_0x139da1[_0xc76a('0x10')]({'type':_0x75e149['type'],'app':_0xc76a('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x75e149['context'],'exten':_0x75e149[_0xc76a('0x9')],'priority':_0xef7ea1['length']+_0x59f243[_0xc76a('0xc')]+_0x51ff08++,'VoiceExtensionId':_0x75e149[_0xc76a('0x15')]});}}}for(var _0x1991d8=0x0;_0x1991d8<_0xef7ea1[_0xc76a('0x26')];_0x1991d8+=0x1){var _0xab761d=_0x59f243[_0xc76a('0xc')]+_0xef7ea1['length'];var _0x3ad28f=_0x1991d8===_0xef7ea1[_0xc76a('0x26')]-0x1?_0x59f243['priority']+_0x139da1[_0xc76a('0x26')]+_0x4ce8a2['length']+0x2:_0x59f243[_0xc76a('0xc')]+_0x1991d8+0x1;_0x139da1[_0xc76a('0x37')](_0x1991d8,0x0,{'type':_0x75e149['type'],'app':_0xc76a('0x38'),'appdata':_0xef7ea1[_0x1991d8]+'?'+_0x75e149[_0xc76a('0x17')]+',${EXTEN},'+_0xab761d+':'+_0x75e149[_0xc76a('0x17')]+_0xc76a('0x39')+_0x3ad28f,'exten':_0x75e149['exten'],'context':_0x75e149['context'],'priority':_0x59f243[_0xc76a('0xc')]+_0x1991d8,'VoiceExtensionId':_0x13355b[_0x9cd199][0x0]['VoiceExtensionId']});}_0x75e149[_0xc76a('0xc')]=_0x139da1[_0xc76a('0x26')]?_[_0xc76a('0x3a')](_0x139da1)[_0xc76a('0xc')]+0x1:_0x59f243[_0xc76a('0xc')];_0x59f243[_0xc76a('0xc')]=(_0x4ce8a2[_0xc76a('0x26')]?_['last'](_0x4ce8a2)[_0xc76a('0xc')]:_0x75e149[_0xc76a('0xc')])+0x1;_0x59f243[_0xc76a('0xd')]=_[_0xc76a('0x3b')](_0x59f243[_0xc76a('0xd')],_0x139da1,[_0x75e149],_0x4ce8a2);}_0x59f243[_0xc76a('0xd')][_0xc76a('0x10')]({'type':_0x13355b[_0x9cd199][0x0][_0xc76a('0x11')],'app':_0xc76a('0x3c'),'exten':_0x13355b[_0x9cd199][0x0][_0xc76a('0x9')],'context':_0x13355b[_0x9cd199][0x0][_0xc76a('0x17')],'priority':_0x59f243[_0xc76a('0xc')],'VoiceExtensionId':_0x13355b[_0x9cd199][0x0]['VoiceExtensionId']});_0x5b6e28['push'](_0x13355b[_0x9cd199][0x0][_0xc76a('0x15')]);_0x65d671=_[_0xc76a('0x3b')](_0x65d671,_0x59f243[_0xc76a('0xd')]);}}return _0x21d709[_0xc76a('0x3d')](function(_0x85d574){return _0x21d709[_0xc76a('0x1')]['VoiceExtension'][_0xc76a('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x5b6e28}},'transaction':_0x85d574})[_0xc76a('0x4')](function(_0x2c9366){return _0x21d709[_0xc76a('0x1')][_0xc76a('0x6')][_0xc76a('0x3f')](_['sortBy'](_0x65d671,_0xc76a('0xc')),{'transaction':_0x85d574});});});})['catch'](function(_0x1e2687){console['error'](_0x1e2687);});}exports[_0xc76a('0x40')]=rewrite; \ No newline at end of file +var _0xb64b=['push','type','format','CDR(type)=%s','context','priority','inbound','Set','VoiceExtensionId','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','interval','*,*,*,*','tag','CDR(tag)=','length','outbound','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','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','models','Interval','intervals','findAll','IntervalId','then','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','extension','find','extensions'];(function(_0x298ad8,_0x351904){var _0xb68f4c=function(_0xcd3d3){while(--_0xcd3d3){_0x298ad8['push'](_0x298ad8['shift']());}};_0xb68f4c(++_0x351904);}(_0xb64b,0x76));var _0xbb64=function(_0x1b5bc2,_0x453d84){_0x1b5bc2=_0x1b5bc2-0x0;var _0x1a5382=_0xb64b[_0x1b5bc2];return _0x1a5382;};'use strict';var _=require(_0xbb64('0x0'));var util=require('util');function rewrite(_0x300dd1,_0x25a31c){var _0x16b655=this;return _0x300dd1[_0xbb64('0x1')][_0xbb64('0x2')]['findAll']({'raw':!![]})['then'](function(_0x2b6a7e){_0x16b655[_0xbb64('0x3')]=_0x2b6a7e;return _0x300dd1[_0xbb64('0x1')]['VoiceExtension'][_0xbb64('0x4')]({'where':{'IntervalId':_0x25a31c[_0xbb64('0x5')]},'raw':!![]});})[_0xbb64('0x6')](function(_0x48d378){return _0x300dd1['models'][_0xbb64('0x7')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0xbb64('0x8')](_0x48d378,_0xbb64('0x9')))}},'order':[{'raw':_0xbb64('0xa')}],'raw':!![]});})['then'](function(_0x342b88){var _0x265739=_[_0xbb64('0xb')](_0x342b88,{'priority':'1'});var _0x66d19=_[_0xbb64('0xb')](_0x342b88,{'isApp':0x1});var _0x4513ed=_[_0xbb64('0xc')](_0x66d19,_0xbb64('0x9'));var _0x421dd7=['queue',_0xbb64('0xd')];var _0xdcf9eb=[];var _0x5e59fa=[];for(var _0x30d2fa in _0x4513ed){if(_0x4513ed[_0xbb64('0xe')](_0x30d2fa)){_0x16b655['priority']=0x2;_0x16b655['extensions']=[];_0x16b655[_0xbb64('0xf')]=_[_0xbb64('0x10')](_0x265739,{'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')]});_0x16b655[_0xbb64('0x11')][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')],'app':'Set','appdata':util[_0xbb64('0x14')](_0xbb64('0x15'),_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')]),'context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')],'priority':_0x16b655[_0xbb64('0x17')]++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0]['VoiceExtensionId']});if(_0x4513ed[_0x30d2fa][0x0]['type']===_0xbb64('0x18')){_0x16b655[_0xbb64('0x11')][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0]['type'],'app':_0xbb64('0x19'),'appdata':'CDR(routeid)='+_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')],'context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0]['exten'],'priority':_0x16b655[_0xbb64('0x17')]++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});}else if(_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')]==='outbound'){if(_0x16b655[_0xbb64('0xf')]){_0x16b655[_0xbb64('0x11')]['push']({'type':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')],'app':'Set','appdata':_0xbb64('0x1b')+(_0x16b655['extension'][_0xbb64('0x1c')]?'${EXTEN:'+_0x16b655['extension']['cutdigits']+'}':_0xbb64('0x1d')),'context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')],'priority':_0x16b655[_0xbb64('0x17')]++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});}_0x16b655['extensions']['push']({'type':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')],'app':_0xbb64('0x19'),'appdata':_0xbb64('0x1e')+_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')],'context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')],'priority':_0x16b655['priority']++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});var _0x5ddee2=_0x16b655[_0xbb64('0x17')]++;_0x16b655[_0xbb64('0x11')][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0]['type'],'app':_0xbb64('0x1f'),'appdata':_0xbb64('0x20')+(_0x5ddee2+0x2)+'):Goto('+(_0x5ddee2+0x1)+')','context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0]['exten'],'priority':_0x5ddee2,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});if(_0x16b655['extension']){_0x16b655[_0xbb64('0x11')][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')],'app':'Set','appdata':_0x16b655['extension'][_0xbb64('0x1c')]?_0xbb64('0x21')+_0x16b655['extension']['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x4513ed[_0x30d2fa][0x0]['context'],'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')],'priority':_0x16b655['priority']++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});}_0x16b655[_0xbb64('0x11')][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0]['type'],'app':'Set','appdata':_0xbb64('0x22')+_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')],'context':_0x4513ed[_0x30d2fa][0x0]['context'],'exten':_0x4513ed[_0x30d2fa][0x0]['exten'],'priority':_0x16b655['priority']++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});if(_0x16b655[_0xbb64('0xf')]&&_0x16b655[_0xbb64('0xf')][_0xbb64('0xe')]('recordingFormat')&&_0x16b655[_0xbb64('0xf')][_0xbb64('0x23')]!=='none'){_0x16b655[_0xbb64('0x11')][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0]['type'],'app':_0xbb64('0x19'),'appdata':_0xbb64('0x24'),'context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0]['exten'],'priority':_0x16b655['priority']++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});_0x16b655[_0xbb64('0x11')][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0]['type'],'app':_0xbb64('0x19'),'appdata':_0xbb64('0x25')+_0x16b655[_0xbb64('0xf')]['recordingFormat']||'wav','context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')],'priority':_0x16b655['priority']++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});}}_0x16b655['extensions'][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')],'app':'Set','appdata':_0xbb64('0x26'),'context':_0x4513ed[_0x30d2fa][0x0]['context'],'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')],'priority':_0x16b655['priority']++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});_0x16b655[_0xbb64('0x11')]['push']({'type':_0x4513ed[_0x30d2fa][0x0]['type'],'app':_0xbb64('0x19'),'appdata':_0xbb64('0x27'),'context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')],'priority':_0x16b655['priority']++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});_0x16b655[_0xbb64('0x11')][_0xbb64('0x12')]({'type':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')],'app':'Set','appdata':_0xbb64('0x28'),'context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'exten':_0x4513ed[_0x30d2fa][0x0]['exten'],'priority':_0x16b655[_0xbb64('0x17')]++,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});for(var _0x551bc2=0x0,_0x24fb7f=0x0;_0x551bc2<_0x4513ed[_0x30d2fa]['length'];_0x551bc2+=0x1,_0x24fb7f=0x0){var _0x420501=_0x4513ed[_0x30d2fa][_0x551bc2];if(_0x420501[_0xbb64('0x13')]){_0x420501[_0xbb64('0x13')]=_0x420501[_0xbb64('0x13')]['toLowerCase']();}var _0xe415a2=[];var _0x38daa3=[];delete _0x420501['id'];delete _0x420501['createdAt'];delete _0x420501['updatedAt'];var _0x2d9384=_0x420501[_0xbb64('0x29')]!==_0xbb64('0x2a')?[_0x420501[_0xbb64('0x29')]]:_0x420501[_0xbb64('0x5')]?_['map'](_[_0xbb64('0xb')](_0x16b655[_0xbb64('0x3')],{'IntervalId':_0x420501[_0xbb64('0x5')]}),_0xbb64('0x29')):[];if(_0x420501[_0xbb64('0xe')](_0xbb64('0x2b'))){if(_0x420501[_0xbb64('0x2b')]&&_0x420501['tag']!=='--'){_0xe415a2['push']({'type':_0x420501[_0xbb64('0x13')],'app':_0xbb64('0x19'),'appdata':_0xbb64('0x2c')+_0x420501[_0xbb64('0x2b')],'context':_0x420501[_0xbb64('0x16')],'exten':_0x420501['exten'],'priority':_0x2d9384[_0xbb64('0x2d')]+_0x16b655[_0xbb64('0x17')]+_0x24fb7f++,'VoiceExtensionId':_0x420501[_0xbb64('0x1a')]});}}if(_0x420501[_0xbb64('0x13')]===_0xbb64('0x2e')&&_0x420501['hasOwnProperty'](_0xbb64('0x2f'))){if(_0x420501[_0xbb64('0x2f')]){_0xe415a2[_0xbb64('0x12')]({'type':_0x420501[_0xbb64('0x13')],'app':_0xbb64('0x1f'),'appdata':_0xbb64('0x30')+_0x420501[_0xbb64('0x2f')]+')','context':_0x420501['context'],'exten':_0x420501['exten'],'priority':_0x2d9384['length']+_0x16b655[_0xbb64('0x17')]+_0x24fb7f++,'VoiceExtensionId':_0x420501[_0xbb64('0x1a')]});}else{_0xe415a2[_0xbb64('0x12')]({'type':_0x420501['type'],'app':_0xbb64('0x1f'),'appdata':_0xbb64('0x31'),'context':_0x420501[_0xbb64('0x16')],'exten':_0x420501[_0xbb64('0x9')],'priority':_0x2d9384[_0xbb64('0x2d')]+_0x16b655[_0xbb64('0x17')]+_0x24fb7f++,'VoiceExtensionId':_0x420501[_0xbb64('0x1a')]});}}if(_0x420501['hasOwnProperty'](_0xbb64('0x32'))){if(_0x421dd7['indexOf'](_0x420501[_0xbb64('0x33')]['toLowerCase']())>=0x0&&_0x420501[_0xbb64('0x34')]!==_0xbb64('0x35')){if(_0x420501[_0xbb64('0x32')]){_0xe415a2['push']({'type':_0x420501[_0xbb64('0x13')],'app':_0xbb64('0x1f'),'appdata':_0xbb64('0x36'),'context':_0x420501['context'],'exten':_0x420501[_0xbb64('0x9')],'priority':_0x2d9384[_0xbb64('0x2d')]+_0x16b655['priority']+_0x24fb7f++,'VoiceExtensionId':_0x420501[_0xbb64('0x1a')]});_0xe415a2['push']({'type':_0x420501['type'],'app':'Set','appdata':_0xbb64('0x37'),'context':_0x420501[_0xbb64('0x16')],'exten':_0x420501['exten'],'priority':_0x2d9384['length']+_0x16b655[_0xbb64('0x17')]+_0x24fb7f++,'VoiceExtensionId':_0x420501[_0xbb64('0x1a')]});}else{_0xe415a2[_0xbb64('0x12')]({'type':_0x420501[_0xbb64('0x13')],'app':_0xbb64('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x420501[_0xbb64('0x16')],'exten':_0x420501[_0xbb64('0x9')],'priority':_0x2d9384[_0xbb64('0x2d')]+_0x16b655[_0xbb64('0x17')]+_0x24fb7f++,'VoiceExtensionId':_0x420501['VoiceExtensionId']});_0xe415a2[_0xbb64('0x12')]({'type':_0x420501[_0xbb64('0x13')],'app':_0xbb64('0x19'),'appdata':_0xbb64('0x38'),'context':_0x420501[_0xbb64('0x16')],'exten':_0x420501[_0xbb64('0x9')],'priority':_0x2d9384[_0xbb64('0x2d')]+_0x16b655[_0xbb64('0x17')]+_0x24fb7f++,'VoiceExtensionId':_0x420501[_0xbb64('0x1a')]});}}}for(var _0x18115e=0x0;_0x18115e<_0x2d9384[_0xbb64('0x2d')];_0x18115e+=0x1){var _0x182b44=_0x16b655['priority']+_0x2d9384[_0xbb64('0x2d')];var _0x2666a3=_0x18115e===_0x2d9384[_0xbb64('0x2d')]-0x1?_0x16b655[_0xbb64('0x17')]+_0xe415a2['length']+_0x38daa3[_0xbb64('0x2d')]+0x2:_0x16b655['priority']+_0x18115e+0x1;_0xe415a2[_0xbb64('0x39')](_0x18115e,0x0,{'type':_0x420501[_0xbb64('0x13')],'app':_0xbb64('0x3a'),'appdata':_0x2d9384[_0x18115e]+'?'+_0x420501[_0xbb64('0x16')]+',${EXTEN},'+_0x182b44+':'+_0x420501[_0xbb64('0x16')]+',${EXTEN},'+_0x2666a3,'exten':_0x420501[_0xbb64('0x9')],'context':_0x420501[_0xbb64('0x16')],'priority':_0x16b655[_0xbb64('0x17')]+_0x18115e,'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});}_0x420501['priority']=_0xe415a2['length']?_[_0xbb64('0x3b')](_0xe415a2)[_0xbb64('0x17')]+0x1:_0x16b655[_0xbb64('0x17')];_0x16b655[_0xbb64('0x17')]=(_0x38daa3[_0xbb64('0x2d')]?_[_0xbb64('0x3b')](_0x38daa3)[_0xbb64('0x17')]:_0x420501[_0xbb64('0x17')])+0x1;_0x16b655[_0xbb64('0x11')]=_[_0xbb64('0x3c')](_0x16b655[_0xbb64('0x11')],_0xe415a2,[_0x420501],_0x38daa3);}_0x16b655['extensions']['push']({'type':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x13')],'app':_0xbb64('0x3d'),'exten':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x9')],'context':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x16')],'priority':_0x16b655[_0xbb64('0x17')],'VoiceExtensionId':_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]});_0xdcf9eb['push'](_0x4513ed[_0x30d2fa][0x0][_0xbb64('0x1a')]);_0x5e59fa=_[_0xbb64('0x3c')](_0x5e59fa,_0x16b655[_0xbb64('0x11')]);}}return _0x300dd1[_0xbb64('0x3e')](function(_0x48bd0d){return _0x300dd1['models']['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0xdcf9eb}},'transaction':_0x48bd0d})['then'](function(_0xb91c32){return _0x300dd1['models'][_0xbb64('0x7')][_0xbb64('0x3f')](_[_0xbb64('0x40')](_0x5e59fa,_0xbb64('0x17')),{'transaction':_0x48bd0d});});});})[_0xbb64('0x41')](function(_0x45c71d){console[_0xbb64('0x42')](_0x45c71d);});}exports[_0xbb64('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index d6eb9a5..a5e94e7 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 _0xf96d=['inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','Lists','get','always','sequelize','query','VoiceQueueId','catch','findAll','CmList','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','contact:csv_','resume','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','resolve','CmContact','createReadStream','duplicate','pause','info','CSV\x20parsed\x20correctly!','bluebird','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','defaults','redis','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','map','message','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','Duplicate\x20Contact','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper'];(function(_0x34109c,_0x40e4b8){var _0x540d2d=function(_0x1e4d34){while(--_0x1e4d34){_0x34109c['push'](_0x34109c['shift']());}};_0x540d2d(++_0x40e4b8);}(_0xf96d,0xa2));var _0xdf96=function(_0x31ff5a,_0x4542a4){_0x31ff5a=_0x31ff5a-0x0;var _0x5aca18=_0xf96d[_0x31ff5a];return _0x5aca18;};'use strict';var BPromise=require(_0xdf96('0x0'));var util=require(_0xdf96('0x1'));var _=require(_0xdf96('0x2'));var fs=require('fs');var squel=require(_0xdf96('0x3'));var Papa=require(_0xdf96('0x4'));var Redis=require(_0xdf96('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xdf96('0x6'));var logger=require(_0xdf96('0x7'))(_0xdf96('0x8'));config['redis']=_[_0xdf96('0x9')](config[_0xdf96('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdf96('0xb'))['register'](socket);try{if(!process[_0xdf96('0xc')][0x2]||process['argv'][0x2]===_0xdf96('0xd')||process[_0xdf96('0xc')][0x2]===_0xdf96('0xe')){throw new Error(_0xdf96('0xf'));}var FILEPATH=process[_0xdf96('0xc')][0x2];if(!process[_0xdf96('0xc')][0x3]||process[_0xdf96('0xc')][0x3]===_0xdf96('0xd')||process['argv'][0x3]===_0xdf96('0xe')||!process[_0xdf96('0xc')][0x4]||process[_0xdf96('0xc')][0x4]===_0xdf96('0xd')||process[_0xdf96('0xc')][0x4]===_0xdf96('0xe')){throw new Error(_0xdf96('0x10'));}var FIELDS=_[_0xdf96('0x11')](process[_0xdf96('0xc')][0x3][_0xdf96('0x12')](','),process[_0xdf96('0xc')][0x4]['split'](','));if(!process[_0xdf96('0xc')][0x5]||process[_0xdf96('0xc')][0x5]===_0xdf96('0xd')||process[_0xdf96('0xc')][0x5]===_0xdf96('0xe')){throw new Error(_0xdf96('0x13'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xdf96('0xc')][0x6]&&process['argv'][0x6]!==_0xdf96('0xd')&&process[_0xdf96('0xc')][0x6]!==_0xdf96('0xe')?process[_0xdf96('0xc')][0x6]:null;var DUPLICATES=process[_0xdf96('0xc')][0x7]&&process[_0xdf96('0xc')][0x7]!==_0xdf96('0xd')&&process['argv'][0x7]!=='null'?process[_0xdf96('0xc')][0x7]:null;if(!process['argv'][0x8]||process[_0xdf96('0xc')][0x8]==='undefined'||process[_0xdf96('0xc')][0x8]===_0xdf96('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xdf96('0xc')][0x8];}catch(_0x280b6c){logger[_0xdf96('0x14')](_0x280b6c);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(_0x8cea3e,_0x3f0f57,_0x8f4e4f,_0x59481b){var _0x4d813e={'message':_0x3f0f57};_0x4d813e[_0x8cea3e]=!![];if(_0x8f4e4f){_0x4d813e['contact']=_0x8f4e4f;}if(_0x59481b){_0x4d813e[_0xdf96('0x15')]=_0x59481b;}return _0x4d813e;}function isEmail(_0x31301c){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'](_0x31301c);}function checkRow(_0x48d2bf,_0x58ef79,_0x3e7c4a){return new BPromise(function(_0x4a3f78,_0x5ca837){if(_[_0xdf96('0x16')](_0x48d2bf)){return _0x5ca837(handleCheckRowError('error',_0xdf96('0x17'),null,_0x3e7c4a));}if(_0x48d2bf['errors']&&_0x48d2bf['errors'][_0xdf96('0x18')]){var _0x4687b6=_[_0xdf96('0x19')](_0x48d2bf['errors'],_0xdf96('0x1a'))['join'](';');return _0x5ca837(handleCheckRowError(_0xdf96('0x14'),_0x4687b6,null,_0x3e7c4a));}var _0x5dcc0c={};for(var _0x567331 in FIELDS){if(FIELDS[_0xdf96('0x1b')](_0x567331)&&FIELDS[_0x567331]){_0x5dcc0c[_0x567331]=_0x48d2bf[_0xdf96('0x1c')][0x0][FIELDS[_0x567331]]||_0x48d2bf[_0xdf96('0x1c')][0x0]['\ufeff'+FIELDS[_0x567331]];}}if(!_0x5dcc0c[_0xdf96('0x1d')]){return _0x5ca837(handleCheckRowError(_0xdf96('0x14'),'firstName\x20not\x20specified!',null,_0x3e7c4a));}if(!_0x5dcc0c[_0xdf96('0x1e')]){return _0x5ca837(handleCheckRowError(_0xdf96('0x14'),_0xdf96('0x1f'),null,_0x3e7c4a));}if(_0x5dcc0c[_0xdf96('0x20')]){var _0x553ce=moment(_0x5dcc0c['birthDate'],'YYYY-MM-DD');if(!_0x553ce['isValid']()){return _0x5ca837(handleCheckRowError(_0xdf96('0x14'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x3e7c4a));}}if(_0x5dcc0c[_0xdf96('0x21')]){if(!isEmail(_0x5dcc0c['email'])){return _0x5ca837(handleCheckRowError(_0xdf96('0x14'),_0xdf96('0x22'),null,_0x3e7c4a));}}_0x5dcc0c[_0xdf96('0x23')]=LISTID;_0x5dcc0c[_0xdf96('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xdf96('0x18')]&&_0x58ef79){var _0x248cbf={};for(var _0x58252e=0x0,_0x2aed93=DUPLICATES['length'];_0x58252e<_0x2aed93;_0x58252e+=0x1){_0x248cbf[DUPLICATES[_0x58252e]]=_0x5dcc0c[DUPLICATES[_0x58252e]];}var _0x5bef88=_['find'](_0x58ef79,_0x248cbf);if(_0x5bef88){return _0x5ca837(handleCheckRowError('duplicate',_0xdf96('0x25'),_0x5bef88,_0x3e7c4a));}}return db['CmContact']['create'](_0x5dcc0c,{'raw':!![],'hooks':![],'fields':_['keys'](_0x5dcc0c)})[_0xdf96('0x26')](function(_0xfb652){if(DUPLICATES&&DUPLICATES['length']&&_0x58ef79){_0x58ef79[_0xdf96('0x27')](_[_0xdf96('0x28')](_0x5dcc0c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xfb652['id'];return _0x4a3f78();})['catch'](function(_0x36a28c){return _0x5ca837(handleCheckRowError(_0xdf96('0x14'),_0xdf96('0x29')+(_0x36a28c[_0xdf96('0x1a')]||JSON[_0xdf96('0x2a')](_0x36a28c)),null,_0x3e7c4a));});});}function checkHopper(){function _0x2a10eb(){return function(_0x369ff5){logger[_0xdf96('0x14')]('cmContact',_0xdf96('0x2b'),util[_0xdf96('0x2c')](_0x369ff5,{'showHidden':![],'depth':null}));};}var _0x31064a=function(_0x43d668,_0x21e6b8){var _0x42c87c=squel[_0xdf96('0x2d')]()[_0xdf96('0x2e')](_0xdf96('0x2f'))[_0xdf96('0x30')]([_0xdf96('0x1e'),_0xdf96('0x31'),_0xdf96('0x32'),_0xdf96('0x23'),_0x21e6b8,_0xdf96('0x33'),_0xdf96('0x34')],squel[_0xdf96('0x35')]()[_0xdf96('0x36')](_0xdf96('0x1e'),_0xdf96('0x1e'))[_0xdf96('0x36')](_0xdf96('0x37'),'scheduledAt')['field']('id',_0xdf96('0x32'))['field'](LISTID[_0xdf96('0x38')](),'ListId')[_0xdf96('0x36')](_0x43d668['id'][_0xdf96('0x38')](),_0x21e6b8)['field'](_0xdf96('0x37'),_0xdf96('0x33'))[_0xdf96('0x36')](_0xdf96('0x37'),'updatedAt')[_0xdf96('0x39')](_0xdf96('0x3a'))[_0xdf96('0x3b')](_0xdf96('0x3c'))[_0xdf96('0x3b')](_0xdf96('0x3d'),LISTID[_0xdf96('0x38')]())[_0xdf96('0x3b')](_0xdf96('0x3e'))['where'](_0xdf96('0x3f'),squel[_0xdf96('0x35')]()['field'](_0xdf96('0x1e'))[_0xdf96('0x39')]('cm_hopper')[_0xdf96('0x3b')](_0x21e6b8+'\x20=\x20?',_0x43d668['id']['toString']())))[_0xdf96('0x38')]();return _0x42c87c;};var _0x3fe35f=function(_0x13abc1,_0x4e650c){var _0x53c947=squel['insert']()['into'](_0xdf96('0x2f'))[_0xdf96('0x30')]([_0xdf96('0x1e'),_0xdf96('0x31'),'ContactId',_0xdf96('0x23'),_0x4e650c,_0xdf96('0x33'),_0xdf96('0x34')],squel[_0xdf96('0x35')]()[_0xdf96('0x36')]('phone',_0xdf96('0x1e'))[_0xdf96('0x36')](_0xdf96('0x37'),_0xdf96('0x31'))[_0xdf96('0x36')]('id',_0xdf96('0x32'))['field'](LISTID['toString'](),_0xdf96('0x23'))[_0xdf96('0x36')](_0x13abc1['id'][_0xdf96('0x38')](),_0x4e650c)[_0xdf96('0x36')](_0xdf96('0x37'),_0xdf96('0x33'))[_0xdf96('0x36')](_0xdf96('0x37'),_0xdf96('0x34'))[_0xdf96('0x39')](_0xdf96('0x3a'))[_0xdf96('0x3b')](_0xdf96('0x3c'))[_0xdf96('0x3b')](_0xdf96('0x3d'),LISTID[_0xdf96('0x38')]())[_0xdf96('0x3b')](_0xdf96('0x40'),squel[_0xdf96('0x41')](hopperContacts))[_0xdf96('0x3b')](_0xdf96('0x3e'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xdf96('0x35')]()[_0xdf96('0x36')](_0xdf96('0x42'))['from'](_0xdf96('0x43'))[_0xdf96('0x3b')](_0x4e650c+'\x20=\x20?',_0x13abc1['id'][_0xdf96('0x38')]()))[_0xdf96('0x3b')](_0xdf96('0x3f'),squel['select']()['field'](_0xdf96('0x1e'))[_0xdf96('0x39')](_0xdf96('0x2f'))[_0xdf96('0x3b')](_0x4e650c+'\x20=\x20?',_0x13abc1['id'][_0xdf96('0x38')]())))[_0xdf96('0x38')]();return _0x53c947;};function _0x4836df(_0x3525c6,_0x257bcb){var _0x3fa233=squel[_0xdf96('0x2d')]()[_0xdf96('0x2e')](_0xdf96('0x2f'))[_0xdf96('0x30')]([_0xdf96('0x1e'),_0xdf96('0x31'),_0xdf96('0x32'),_0xdf96('0x23'),_0x257bcb,_0xdf96('0x33'),_0xdf96('0x34')],squel['select']()[_0xdf96('0x36')]('phone',_0xdf96('0x1e'))[_0xdf96('0x36')](_0xdf96('0x37'),_0xdf96('0x31'))[_0xdf96('0x36')]('id',_0xdf96('0x32'))['field'](LISTID[_0xdf96('0x38')](),_0xdf96('0x23'))[_0xdf96('0x36')](_0x3525c6['id'][_0xdf96('0x38')](),_0x257bcb)[_0xdf96('0x36')](_0xdf96('0x37'),_0xdf96('0x33'))[_0xdf96('0x36')](_0xdf96('0x37'),'updatedAt')[_0xdf96('0x39')](_0xdf96('0x3a'))[_0xdf96('0x3b')](_0xdf96('0x3c'))['where'](_0xdf96('0x3d'),LISTID['toString']())[_0xdf96('0x3b')]('id\x20IN\x20?',squel[_0xdf96('0x41')](hopperContacts))[_0xdf96('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0xdf96('0x38')]();return _0x3fa233;}function _0x375e4a(_0x1806e6,_0x51b990){var _0x36850b=squel[_0xdf96('0x2d')]()[_0xdf96('0x2e')](_0xdf96('0x44'))[_0xdf96('0x30')]([_0xdf96('0x1e'),_0xdf96('0x32'),_0xdf96('0x23'),_0x51b990,'createdAt',_0xdf96('0x34')],squel[_0xdf96('0x35')]()[_0xdf96('0x36')](_0xdf96('0x1e'),_0xdf96('0x1e'))[_0xdf96('0x36')]('id',_0xdf96('0x32'))['field'](LISTID['toString'](),_0xdf96('0x23'))[_0xdf96('0x36')](_0x1806e6['id'][_0xdf96('0x38')](),_0x51b990)[_0xdf96('0x36')](_0xdf96('0x37'),_0xdf96('0x33'))[_0xdf96('0x36')](_0xdf96('0x37'),_0xdf96('0x34'))['from']('cm_contacts')[_0xdf96('0x3b')](_0xdf96('0x3c'))[_0xdf96('0x3b')](_0xdf96('0x3d'),LISTID['toString']())[_0xdf96('0x3b')](_0xdf96('0x40'),squel[_0xdf96('0x41')](hopperContacts))[_0xdf96('0x3b')](_0xdf96('0x3e')))['toString']();return _0x36850b;}return db[_0xdf96('0x45')]['findAll']({'where':{'type':_0xdf96('0x46')},'attributes':['id',_0xdf96('0x47')],'include':[{'model':db['CmList'],'as':_0xdf96('0x48'),'where':{'id':LISTID}}]})[_0xdf96('0x26')](function(_0x369422){var _0x5444a0=[];if(_0x369422){var _0x161943;for(var _0x4a3a0e=0x0,_0x37491d;_0x4a3a0e<_0x369422[_0xdf96('0x18')];_0x4a3a0e+=0x1){_0x37491d=_0x369422[_0x4a3a0e][_0xdf96('0x49')]({'plain':!![]});switch(_0x37491d[_0xdf96('0x47')]){case _0xdf96('0x4a'):_0x5444a0[_0xdf96('0x27')](db[_0xdf96('0x4b')][_0xdf96('0x4c')](_0x3fe35f(_0x37491d,_0xdf96('0x4d')))['then'](function(){})[_0xdf96('0x4e')](_0x2a10eb()));break;case'onlyIfOpen':_0x5444a0['push'](db[_0xdf96('0x4b')][_0xdf96('0x4c')](_0x31064a(_0x37491d,_0xdf96('0x4d')))[_0xdf96('0x26')](function(){})[_0xdf96('0x4e')](_0x2a10eb()));break;default:_0x5444a0[_0xdf96('0x27')](db['sequelize'][_0xdf96('0x4c')](_0x4836df(_0x37491d,_0xdf96('0x4d')))[_0xdf96('0x26')](function(){})[_0xdf96('0x4e')](_0x2a10eb()));}}}return _0x5444a0;})['all']()['then'](function(){return db[_0xdf96('0x45')][_0xdf96('0x4f')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xdf96('0x50')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xdf96('0x26')](function(_0x3cdac8){var _0x3cdebe=[];if(_0x3cdac8){var _0x2d860b;for(var _0x3fbce8=0x0,_0x2c5d3c;_0x3fbce8<_0x3cdac8['length'];_0x3fbce8+=0x1){_0x2c5d3c=_0x3cdac8[_0x3fbce8][_0xdf96('0x49')]({'plain':!![]});_0x3cdebe[_0xdf96('0x27')](db[_0xdf96('0x4b')][_0xdf96('0x4c')](_0x375e4a(_0x2c5d3c,'VoiceQueueId'))['then'](function(){})['catch'](_0x2a10eb()));}}return _0x3cdebe;})[_0xdf96('0x51')]();})[_0xdf96('0x26')](function(){return db[_0xdf96('0x52')]['findAll']({'attributes':['id',_0xdf96('0x47')],'include':[{'model':db[_0xdf96('0x50')],'as':'Lists','where':{'id':LISTID}}]})[_0xdf96('0x26')](function(_0x3b7579){var _0x10c8ce=[];if(_0x3b7579){for(var _0x318ad7=0x0,_0x555e61;_0x318ad7<_0x3b7579[_0xdf96('0x18')];_0x318ad7+=0x1){_0x555e61=_0x3b7579[_0x318ad7]['get']({'plain':!![]});switch(_0x555e61[_0xdf96('0x47')]){case _0xdf96('0x4a'):_0x10c8ce[_0xdf96('0x27')](db['sequelize'][_0xdf96('0x4c')](_0x3fe35f(_0x555e61,_0xdf96('0x53')))[_0xdf96('0x26')](function(){})['catch'](_0x2a10eb()));break;case'onlyIfOpen':_0x10c8ce[_0xdf96('0x27')](db[_0xdf96('0x4b')]['query'](_0x31064a(_0x555e61,_0xdf96('0x53')))[_0xdf96('0x26')](function(){})['catch'](_0x2a10eb()));break;default:_0x10c8ce['push'](db[_0xdf96('0x4b')][_0xdf96('0x4c')](_0x4836df(_0x555e61,'CampaignId'))['then'](function(){})['catch'](_0x2a10eb()));}}}return _0x10c8ce;})[_0xdf96('0x51')]();})[_0xdf96('0x26')](function(){return db[_0xdf96('0x52')][_0xdf96('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xdf96('0x54'),'where':{'id':LISTID}}]})[_0xdf96('0x26')](function(_0x2bcb39){var _0x428946=[];if(_0x2bcb39){for(var _0xe50403=0x0,_0x5ff4e4;_0xe50403<_0x2bcb39[_0xdf96('0x18')];_0xe50403+=0x1){_0x5ff4e4=_0x2bcb39[_0xe50403][_0xdf96('0x49')]({'plain':!![]});_0x428946[_0xdf96('0x27')](db[_0xdf96('0x4b')][_0xdf96('0x4c')](_0x375e4a(_0x5ff4e4,_0xdf96('0x53')))[_0xdf96('0x26')](function(){})['catch'](_0x2a10eb()));}}return _0x428946;})[_0xdf96('0x51')]();})[_0xdf96('0x4e')](function(_0x541738){logger[_0xdf96('0x14')](_0xdf96('0x55'),_0xdf96('0x56'),_0x541738[_0xdf96('0x1a')]);});}var processPromises=function(_0x49e3b4){return BPromise[_0xdf96('0x51')](promises)[_0xdf96('0x26')](function(_0x3b60d7){})[_0xdf96('0x4e')](function(_0x5067d5){logger[_0xdf96('0x14')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x5067d5));})[_0xdf96('0x57')](function(){socket['emit'](_0xdf96('0x58')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x49e3b4){return _0x49e3b4[_0xdf96('0x59')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xdf96('0x26')](function(){socket[_0xdf96('0x5a')](_0xdf96('0x58')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xdf96('0x5b')](FILEPATH);}catch(_0x3dbf41){logger['error'](_0xdf96('0x5c'),JSON['stringify'](_0x3dbf41));}finally{process[_0xdf96('0x5d')](0x0);}});};process['on'](_0xdf96('0x5e'),function(){logger['info'](_0xdf96('0x5f'));endCsv();});function main(){return BPromise[_0xdf96('0x60')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xdf96('0x12')](',');return db[_0xdf96('0x61')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xdf96('0x26')](function(_0x26447a){var _0x426506=fs[_0xdf96('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x426506,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1b8a94,_0x46c70f){total+=0x1;var _0x4ef968=total;promises[_0xdf96('0x27')](checkRow(_0x1b8a94,_0x26447a,_0x4ef968)['then'](function(){success+=0x1;})['catch'](function(_0x36cfd1){if(_0x36cfd1['error']){errors+=0x1;delete _0x36cfd1[_0xdf96('0x14')];}else if(_0x36cfd1[_0xdf96('0x63')]){duplicates+=0x1;delete _0x36cfd1[_0xdf96('0x63')];}rows['push'](_0x36cfd1);}));if(total%0xc8===0x0){_0x46c70f[_0xdf96('0x64')]();return processPromises(_0x46c70f);}},'complete':function(){return processPromises()[_0xdf96('0x26')](function(){logger[_0xdf96('0x65')](_0xdf96('0x66'));endCsv();});},'error':function(_0x5c7974,_0x294ef9){logger[_0xdf96('0x65')]('CSV\x20parse\x20error',JSON[_0xdf96('0x2a')](_0x5c7974));endCsv();}});})[_0xdf96('0x4e')](function(_0x477518){logger[_0xdf96('0x14')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xdf96('0x2a')](_0x477518));});}main(); \ No newline at end of file +var _0x4637=['cm_hopper','fromQuery','phone','scheduledAt','ContactId','updatedAt','field','NOW()','toString','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','from','\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','createdAt','cm_hopper_black','VoiceQueue','findAll','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','query','all','outbound','CmList','BlackLists','Campaign','Lists','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resume','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','split','createReadStream','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','ListId','CompanyId','find','duplicate','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','into'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4637,0xaa));var _0x7463=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4637[_0xbca1b1];return _0x4e1686;};'use strict';var BPromise=require(_0x7463('0x0'));var util=require(_0x7463('0x1'));var _=require(_0x7463('0x2'));var fs=require('fs');var squel=require(_0x7463('0x3'));var Papa=require(_0x7463('0x4'));var Redis=require('ioredis');var db=require(_0x7463('0x5'))['db'];var config=require(_0x7463('0x6'));var logger=require(_0x7463('0x7'))(_0x7463('0x8'));config[_0x7463('0x9')]=_['defaults'](config[_0x7463('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7463('0xa'))(new Redis(config['redis']));require(_0x7463('0xb'))[_0x7463('0xc')](socket);try{if(!process['argv'][0x2]||process[_0x7463('0xd')][0x2]===_0x7463('0xe')||process[_0x7463('0xd')][0x2]===_0x7463('0xf')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x7463('0xd')][0x2];if(!process[_0x7463('0xd')][0x3]||process[_0x7463('0xd')][0x3]===_0x7463('0xe')||process[_0x7463('0xd')][0x3]==='null'||!process[_0x7463('0xd')][0x4]||process[_0x7463('0xd')][0x4]===_0x7463('0xe')||process[_0x7463('0xd')][0x4]===_0x7463('0xf')){throw new Error(_0x7463('0x10'));}var FIELDS=_[_0x7463('0x11')](process[_0x7463('0xd')][0x3]['split'](','),process[_0x7463('0xd')][0x4]['split'](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0x7463('0xe')||process[_0x7463('0xd')][0x5]===_0x7463('0xf')){throw new Error(_0x7463('0x12'));}var LISTID=process[_0x7463('0xd')][0x5];var COMPANYID=process[_0x7463('0xd')][0x6]&&process[_0x7463('0xd')][0x6]!=='undefined'&&process['argv'][0x6]!=='null'?process[_0x7463('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x7463('0xd')][0x7]!==_0x7463('0xe')&&process['argv'][0x7]!=='null'?process['argv'][0x7]:null;if(!process[_0x7463('0xd')][0x8]||process['argv'][0x8]===_0x7463('0xe')||process[_0x7463('0xd')][0x8]===_0x7463('0xf')){throw new Error(_0x7463('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x3975c1){logger[_0x7463('0x14')](_0x3975c1);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(_0x27d50a,_0x49a412,_0x40c68e,_0x5eb076){var _0x31ab07={'message':_0x49a412};_0x31ab07[_0x27d50a]=!![];if(_0x40c68e){_0x31ab07[_0x7463('0x15')]=_0x40c68e;}if(_0x5eb076){_0x31ab07['index']=_0x5eb076;}return _0x31ab07;}function isEmail(_0x1927c5){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))*$/[_0x7463('0x16')](_0x1927c5);}function checkRow(_0x1031f0,_0x2a7989,_0x4bea9c){return new BPromise(function(_0x22528b,_0x55adce){if(_[_0x7463('0x17')](_0x1031f0)){return _0x55adce(handleCheckRowError(_0x7463('0x14'),_0x7463('0x18'),null,_0x4bea9c));}if(_0x1031f0[_0x7463('0x19')]&&_0x1031f0['errors'][_0x7463('0x1a')]){var _0x4cbad2=_[_0x7463('0x1b')](_0x1031f0['errors'],_0x7463('0x1c'))[_0x7463('0x1d')](';');return _0x55adce(handleCheckRowError(_0x7463('0x14'),_0x4cbad2,null,_0x4bea9c));}var _0x4d63d8={};for(var _0x3642e4 in FIELDS){if(FIELDS['hasOwnProperty'](_0x3642e4)&&FIELDS[_0x3642e4]){_0x4d63d8[_0x3642e4]=_0x1031f0[_0x7463('0x1e')][0x0][FIELDS[_0x3642e4]]||_0x1031f0['data'][0x0]['\ufeff'+FIELDS[_0x3642e4]];}}if(!_0x4d63d8[_0x7463('0x1f')]){return _0x55adce(handleCheckRowError('error',_0x7463('0x20'),null,_0x4bea9c));}if(!_0x4d63d8['phone']){return _0x55adce(handleCheckRowError('error',_0x7463('0x21'),null,_0x4bea9c));}if(_0x4d63d8[_0x7463('0x22')]){var _0x2c6219=moment(_0x4d63d8[_0x7463('0x22')],_0x7463('0x23'));if(!_0x2c6219[_0x7463('0x24')]()){return _0x55adce(handleCheckRowError(_0x7463('0x14'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4bea9c));}}if(_0x4d63d8[_0x7463('0x25')]){if(!isEmail(_0x4d63d8['email'])){return _0x55adce(handleCheckRowError(_0x7463('0x14'),'email\x20format\x20is\x20not\x20valid!',null,_0x4bea9c));}}_0x4d63d8[_0x7463('0x26')]=LISTID;_0x4d63d8[_0x7463('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7463('0x1a')]&&_0x2a7989){var _0x5aff6f={};for(var _0x742b6f=0x0,_0x4a142f=DUPLICATES[_0x7463('0x1a')];_0x742b6f<_0x4a142f;_0x742b6f+=0x1){_0x5aff6f[DUPLICATES[_0x742b6f]]=_0x4d63d8[DUPLICATES[_0x742b6f]];}var _0xd5c940=_[_0x7463('0x28')](_0x2a7989,_0x5aff6f);if(_0xd5c940){return _0x55adce(handleCheckRowError(_0x7463('0x29'),'Duplicate\x20Contact',_0xd5c940,_0x4bea9c));}}return db[_0x7463('0x2a')][_0x7463('0x2b')](_0x4d63d8,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4d63d8)})[_0x7463('0x2c')](function(_0x5bed91){if(DUPLICATES&&DUPLICATES[_0x7463('0x1a')]&&_0x2a7989){_0x2a7989[_0x7463('0x2d')](_[_0x7463('0x2e')](_0x4d63d8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5bed91['id'];return _0x22528b();})[_0x7463('0x2f')](function(_0x1627fa){return _0x55adce(handleCheckRowError(_0x7463('0x14'),_0x7463('0x30')+(_0x1627fa[_0x7463('0x1c')]||JSON[_0x7463('0x31')](_0x1627fa)),null,_0x4bea9c));});});}function checkHopper(){function _0x5cfd0a(){return function(_0x1417b0){logger[_0x7463('0x14')](_0x7463('0x32'),'checkHopper',util[_0x7463('0x33')](_0x1417b0,{'showHidden':![],'depth':null}));};}var _0x45c5af=function(_0x50f17a,_0x4888a4){var _0x59e206=squel[_0x7463('0x34')]()[_0x7463('0x35')](_0x7463('0x36'))[_0x7463('0x37')]([_0x7463('0x38'),_0x7463('0x39'),_0x7463('0x3a'),_0x7463('0x26'),_0x4888a4,'createdAt',_0x7463('0x3b')],squel['select']()[_0x7463('0x3c')](_0x7463('0x38'),_0x7463('0x38'))[_0x7463('0x3c')](_0x7463('0x3d'),'scheduledAt')[_0x7463('0x3c')]('id',_0x7463('0x3a'))['field'](LISTID[_0x7463('0x3e')](),_0x7463('0x26'))['field'](_0x50f17a['id'][_0x7463('0x3e')](),_0x4888a4)[_0x7463('0x3c')](_0x7463('0x3d'),'createdAt')['field']('NOW()',_0x7463('0x3b'))['from'](_0x7463('0x3f'))[_0x7463('0x40')]('deletedAt\x20IS\x20NULL')[_0x7463('0x40')](_0x7463('0x41'),LISTID[_0x7463('0x3e')]())['where'](_0x7463('0x42'))[_0x7463('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7463('0x43')]()[_0x7463('0x3c')](_0x7463('0x38'))[_0x7463('0x44')]('cm_hopper')[_0x7463('0x40')](_0x4888a4+_0x7463('0x45'),_0x50f17a['id']['toString']())))[_0x7463('0x3e')]();return _0x59e206;};var _0x30525c=function(_0x1b4755,_0x429da5){var _0x567d30=squel['insert']()[_0x7463('0x35')](_0x7463('0x36'))[_0x7463('0x37')]([_0x7463('0x38'),_0x7463('0x39'),_0x7463('0x3a'),_0x7463('0x26'),_0x429da5,'createdAt','updatedAt'],squel[_0x7463('0x43')]()[_0x7463('0x3c')](_0x7463('0x38'),_0x7463('0x38'))[_0x7463('0x3c')](_0x7463('0x3d'),_0x7463('0x39'))[_0x7463('0x3c')]('id',_0x7463('0x3a'))['field'](LISTID['toString'](),_0x7463('0x26'))[_0x7463('0x3c')](_0x1b4755['id'][_0x7463('0x3e')](),_0x429da5)[_0x7463('0x3c')](_0x7463('0x3d'),'createdAt')[_0x7463('0x3c')](_0x7463('0x3d'),_0x7463('0x3b'))[_0x7463('0x44')](_0x7463('0x3f'))[_0x7463('0x40')](_0x7463('0x46'))[_0x7463('0x40')](_0x7463('0x41'),LISTID[_0x7463('0x3e')]())[_0x7463('0x40')](_0x7463('0x47'),squel[_0x7463('0x48')](hopperContacts))[_0x7463('0x40')](_0x7463('0x42'))[_0x7463('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7463('0x43')]()[_0x7463('0x3c')](_0x7463('0x49'))[_0x7463('0x44')](_0x7463('0x4a'))[_0x7463('0x40')](_0x429da5+_0x7463('0x45'),_0x1b4755['id']['toString']()))[_0x7463('0x40')](_0x7463('0x4b'),squel[_0x7463('0x43')]()[_0x7463('0x3c')]('phone')[_0x7463('0x44')](_0x7463('0x36'))[_0x7463('0x40')](_0x429da5+'\x20=\x20?',_0x1b4755['id'][_0x7463('0x3e')]())))['toString']();return _0x567d30;};function _0x44dfc9(_0x5f0354,_0x350c8b){var _0x12d22b=squel['insert']()[_0x7463('0x35')](_0x7463('0x36'))['fromQuery']([_0x7463('0x38'),_0x7463('0x39'),_0x7463('0x3a'),_0x7463('0x26'),_0x350c8b,_0x7463('0x4c'),_0x7463('0x3b')],squel[_0x7463('0x43')]()['field'](_0x7463('0x38'),_0x7463('0x38'))['field'](_0x7463('0x3d'),_0x7463('0x39'))[_0x7463('0x3c')]('id',_0x7463('0x3a'))[_0x7463('0x3c')](LISTID[_0x7463('0x3e')](),'ListId')['field'](_0x5f0354['id'][_0x7463('0x3e')](),_0x350c8b)[_0x7463('0x3c')](_0x7463('0x3d'),_0x7463('0x4c'))[_0x7463('0x3c')](_0x7463('0x3d'),_0x7463('0x3b'))[_0x7463('0x44')](_0x7463('0x3f'))['where'](_0x7463('0x46'))['where'](_0x7463('0x41'),LISTID['toString']())[_0x7463('0x40')](_0x7463('0x47'),squel[_0x7463('0x48')](hopperContacts))[_0x7463('0x40')](_0x7463('0x42')))[_0x7463('0x3e')]();return _0x12d22b;}function _0x58e41d(_0x2dcc86,_0x3f5be0){var _0x4f4a9e=squel[_0x7463('0x34')]()[_0x7463('0x35')](_0x7463('0x4d'))['fromQuery']([_0x7463('0x38'),'ContactId',_0x7463('0x26'),_0x3f5be0,_0x7463('0x4c'),'updatedAt'],squel[_0x7463('0x43')]()[_0x7463('0x3c')](_0x7463('0x38'),_0x7463('0x38'))[_0x7463('0x3c')]('id',_0x7463('0x3a'))['field'](LISTID[_0x7463('0x3e')](),_0x7463('0x26'))[_0x7463('0x3c')](_0x2dcc86['id']['toString'](),_0x3f5be0)[_0x7463('0x3c')]('NOW()',_0x7463('0x4c'))['field'](_0x7463('0x3d'),_0x7463('0x3b'))[_0x7463('0x44')](_0x7463('0x3f'))[_0x7463('0x40')](_0x7463('0x46'))[_0x7463('0x40')](_0x7463('0x41'),LISTID['toString']())['where'](_0x7463('0x47'),squel[_0x7463('0x48')](hopperContacts))['where'](_0x7463('0x42')))[_0x7463('0x3e')]();return _0x4f4a9e;}return db[_0x7463('0x4e')][_0x7463('0x4f')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x7463('0x2c')](function(_0x297fd3){var _0x1cea4b=[];if(_0x297fd3){var _0x5a286b;for(var _0x3cde8b=0x0,_0xb3b3b7;_0x3cde8b<_0x297fd3[_0x7463('0x1a')];_0x3cde8b+=0x1){_0xb3b3b7=_0x297fd3[_0x3cde8b][_0x7463('0x50')]({'plain':!![]});switch(_0xb3b3b7[_0x7463('0x51')]){case _0x7463('0x52'):_0x1cea4b[_0x7463('0x2d')](db[_0x7463('0x53')]['query'](_0x30525c(_0xb3b3b7,_0x7463('0x54')))[_0x7463('0x2c')](function(){})[_0x7463('0x2f')](_0x5cfd0a()));break;case'onlyIfOpen':_0x1cea4b['push'](db[_0x7463('0x53')][_0x7463('0x55')](_0x45c5af(_0xb3b3b7,_0x7463('0x54')))['then'](function(){})['catch'](_0x5cfd0a()));break;default:_0x1cea4b['push'](db[_0x7463('0x53')][_0x7463('0x55')](_0x44dfc9(_0xb3b3b7,'VoiceQueueId'))[_0x7463('0x2c')](function(){})['catch'](_0x5cfd0a()));}}}return _0x1cea4b;})[_0x7463('0x56')]()[_0x7463('0x2c')](function(){return db[_0x7463('0x4e')][_0x7463('0x4f')]({'where':{'type':_0x7463('0x57')},'attributes':['id'],'include':[{'model':db[_0x7463('0x58')],'as':_0x7463('0x59'),'where':{'id':LISTID}}]})[_0x7463('0x2c')](function(_0x37e1b8){var _0x164f7c=[];if(_0x37e1b8){var _0x56ba11;for(var _0xb3ff41=0x0,_0x35d52c;_0xb3ff41<_0x37e1b8[_0x7463('0x1a')];_0xb3ff41+=0x1){_0x35d52c=_0x37e1b8[_0xb3ff41]['get']({'plain':!![]});_0x164f7c['push'](db[_0x7463('0x53')][_0x7463('0x55')](_0x58e41d(_0x35d52c,_0x7463('0x54')))['then'](function(){})[_0x7463('0x2f')](_0x5cfd0a()));}}return _0x164f7c;})[_0x7463('0x56')]();})['then'](function(){return db[_0x7463('0x5a')][_0x7463('0x4f')]({'attributes':['id',_0x7463('0x51')],'include':[{'model':db[_0x7463('0x58')],'as':_0x7463('0x5b'),'where':{'id':LISTID}}]})[_0x7463('0x2c')](function(_0x5bb91d){var _0x3341bc=[];if(_0x5bb91d){for(var _0x4480cb=0x0,_0x55dd82;_0x4480cb<_0x5bb91d[_0x7463('0x1a')];_0x4480cb+=0x1){_0x55dd82=_0x5bb91d[_0x4480cb][_0x7463('0x50')]({'plain':!![]});switch(_0x55dd82[_0x7463('0x51')]){case _0x7463('0x52'):_0x3341bc[_0x7463('0x2d')](db[_0x7463('0x53')]['query'](_0x30525c(_0x55dd82,_0x7463('0x5c')))[_0x7463('0x2c')](function(){})[_0x7463('0x2f')](_0x5cfd0a()));break;case _0x7463('0x5d'):_0x3341bc['push'](db[_0x7463('0x53')][_0x7463('0x55')](_0x45c5af(_0x55dd82,_0x7463('0x5c')))['then'](function(){})['catch'](_0x5cfd0a()));break;default:_0x3341bc['push'](db[_0x7463('0x53')][_0x7463('0x55')](_0x44dfc9(_0x55dd82,_0x7463('0x5c')))[_0x7463('0x2c')](function(){})[_0x7463('0x2f')](_0x5cfd0a()));}}}return _0x3341bc;})[_0x7463('0x56')]();})[_0x7463('0x2c')](function(){return db['Campaign'][_0x7463('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x7463('0x58')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x5d2ca9){var _0x42745d=[];if(_0x5d2ca9){for(var _0x49a60e=0x0,_0x31f72e;_0x49a60e<_0x5d2ca9[_0x7463('0x1a')];_0x49a60e+=0x1){_0x31f72e=_0x5d2ca9[_0x49a60e][_0x7463('0x50')]({'plain':!![]});_0x42745d[_0x7463('0x2d')](db[_0x7463('0x53')][_0x7463('0x55')](_0x58e41d(_0x31f72e,_0x7463('0x5c')))[_0x7463('0x2c')](function(){})['catch'](_0x5cfd0a()));}}return _0x42745d;})[_0x7463('0x56')]();})['catch'](function(_0x41309c){logger[_0x7463('0x14')](_0x7463('0x5e'),_0x7463('0x5f'),_0x41309c[_0x7463('0x1c')]);});}var processPromises=function(_0x5e5acd){return BPromise['all'](promises)['then'](function(_0x17a3c1){})[_0x7463('0x2f')](function(_0x15c735){logger[_0x7463('0x14')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x15c735));})[_0x7463('0x60')](function(){socket[_0x7463('0x61')](_0x7463('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5e5acd){return _0x5e5acd[_0x7463('0x63')]();}});};var endCsv=function(){return BPromise[_0x7463('0x64')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7463('0x2c')](function(){socket[_0x7463('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7463('0x65')](FILEPATH);}catch(_0x364c6c){logger[_0x7463('0x14')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x7463('0x31')](_0x364c6c));}finally{process[_0x7463('0x66')](0x0);}});};process['on'](_0x7463('0x67'),function(){logger[_0x7463('0x68')](_0x7463('0x69'));endCsv();});function main(){return BPromise[_0x7463('0x64')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7463('0x6a')](',');return db['CmContact'][_0x7463('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xdcf0dd){var _0x2fb5eb=fs[_0x7463('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7463('0x6c')](_0x2fb5eb,{'header':!![],'skipEmptyLines':!![],'step':function(_0x28aa41,_0x135937){total+=0x1;var _0x43f221=total;promises[_0x7463('0x2d')](checkRow(_0x28aa41,_0xdcf0dd,_0x43f221)['then'](function(){success+=0x1;})[_0x7463('0x2f')](function(_0x4fa8a4){if(_0x4fa8a4[_0x7463('0x14')]){errors+=0x1;delete _0x4fa8a4['error'];}else if(_0x4fa8a4[_0x7463('0x29')]){duplicates+=0x1;delete _0x4fa8a4[_0x7463('0x29')];}rows['push'](_0x4fa8a4);}));if(total%0xc8===0x0){_0x135937['pause']();return processPromises(_0x135937);}},'complete':function(){return processPromises()[_0x7463('0x2c')](function(){logger[_0x7463('0x68')](_0x7463('0x6d'));endCsv();});},'error':function(_0xe4331,_0x36e119){logger[_0x7463('0x68')](_0x7463('0x6e'),JSON[_0x7463('0x31')](_0xe4331));endCsv();}});})[_0x7463('0x2f')](function(_0x4be32c){logger[_0x7463('0x14')](_0x7463('0x6f'),JSON[_0x7463('0x31')](_0x4be32c));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index d0a2cc2..566abef 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 _0x9714=['from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','then','all','AdditionalPhones','split','length','push','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','errors','code','sequelize','spread','catch','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','query','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','utcOffset','set','offset','dialTimezone','main','stringify','binding','clone','socket_timestamp','root','keys','header','name','_description','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','itemTypeId','description','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','replace','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','orderBy','voice_queues_has_cm_blacklists','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','exit','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','papaparse','moment','../../../mysqldb','../../../config/environment','../../../config/environment/shared','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone'];(function(_0x4a841b,_0xb0800e){var _0x2ad78a=function(_0x2c2a1a){while(--_0x2c2a1a){_0x4a841b['push'](_0x4a841b['shift']());}};_0x2ad78a(++_0xb0800e);}(_0x9714,0xa8));var _0x4971=function(_0x5bf2b3,_0xfcd364){_0x5bf2b3=_0x5bf2b3-0x0;var _0x5e8a9b=_0x9714[_0x5bf2b3];return _0x5e8a9b;};'use strict';var fs=require('fs');var path=require(_0x4971('0x0'));var _=require('lodash');var Papa=require(_0x4971('0x1'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0x4971('0x2'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0x4971('0x3'))['db'];var config=require(_0x4971('0x4'));var shared=require(_0x4971('0x5'));var logger=require('../../../config/logger')(_0x4971('0x6'));config[_0x4971('0x7')]=_[_0x4971('0x8')](config['redis'],{'host':_0x4971('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4971('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x4971('0xa')](_0x4971('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x4971('0xa')](_0x4971('0xb'));function isEmail(_0x55854c){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))*$/[_0x4971('0xc')](_0x55854c);}function selectNotIn(_0x9d9247,_0x5b89bd,_0xda62f9,_0x4eb5d6,_0x539b48){return squel[_0x4971('0xd')]()[_0x4971('0xe')](_0x4971('0xf'))[_0x4971('0x10')](_0x4eb5d6)[_0x4971('0x11')](_0x5b89bd,null,_0x5b89bd+_0x4971('0x12')+_0x4eb5d6+'.'+_0xda62f9)['where'](_0x4eb5d6+'.'+_0xda62f9+_0x4971('0x13')+_0x9d9247+'.'+_0xda62f9)[_0x4971('0x14')](_0x5b89bd+_0x4971('0x15')+_0x539b48['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x169dac,_0x4e9bf6){promisesAdditionalPhones=[];return db[_0x4971('0x16')][_0x4971('0x17')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x4971('0x18')](function(_0x48e35e){if(_0x48e35e!==null){var _0x3bb94c=[];for(var _0x4eec64=0x0;_0x4eec64<_0x48e35e['length'];_0x4eec64++){var _0x8ec28f=_0x48e35e[_0x4eec64];_0x3bb94c['push'](insertAdditionalPhones(_0x8ec28f));}}Promise[_0x4971('0x19')](_0x3bb94c)[_0x4971('0x18')](function(){_0x169dac({'val':0x1});});});});}function insertAdditionalPhones(_0x2ee2b2){return new Promise(function(_0x4676fd,_0x27c4dd){var _0x5e67fd=_0x2ee2b2[_0x4971('0x1a')];var _0x4e0103=_0x5e67fd[_0x4971('0x1b')](';');var _0x380c60=[];orderBy=0x0;for(var _0x1f82f9=0x0;_0x1f82f9<_0x4e0103[_0x4971('0x1c')];_0x1f82f9++){_0x380c60[_0x4971('0x1d')](splitAdditionalPhone(_0x2ee2b2['id'],_0x4e0103[_0x1f82f9]));}Promise[_0x4971('0x19')](_0x380c60)[_0x4971('0x18')](function(){_0x4676fd({'val':_0x4e0103[_0x4971('0x1c')]});});});}function splitAdditionalPhone(_0xe282f1,_0x34231f){return new Promise(function(_0x4d0490,_0x36bb51){var _0x1f37de=_0x34231f[_0x4971('0x1b')](':');var _0x2ef319=_0x1f37de[0x0];var _0x5cdff0=_0x1f37de[0x1];if(!_[_0x4971('0x1e')](_0x5cdff0)){var _0x490ce6=_0x5cdff0[_0x4971('0x1b')]('|');var _0x2fa910=[];for(var _0x45c01d=0x0;_0x45c01d<_0x490ce6[_0x4971('0x1c')];_0x45c01d++){if(_0x490ce6[_0x45c01d]!==''){var _0x494243=_[_0x4971('0x1f')](promisesAdditionalPhones,{'contactId':_0xe282f1,'phone':_0x490ce6[_0x45c01d]});if(_0x494243[_0x4971('0x1c')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0xe282f1,'contactTypeId':_0x2ef319,'phone':_0x490ce6[_0x45c01d],'orderBy':orderBy});}}}_0x4d0490({'ok':0x1});}else _0x4d0490({'res':0x0});});}function createAdditionalPhone(_0x575866,_0xbfb52b,_0x30dd33,_0xcf105e){var _0x23e431='';var _0x19d4f2='';var _0x3790fd=_0x30dd33[_0x4971('0x1b')]('§');_0x23e431=_0x3790fd[0x0];if(_0x3790fd[_0x4971('0x1c')]==0x2)_0x19d4f2=_0x3790fd[0x1];return new Promise(function(_0x5f1037,_0x1893d1){return db[_0x4971('0x20')][_0x4971('0x21')]({'where':{'CmContactId':_0x575866,'item':_0x23e431}})['then'](function(_0x2b697c){if(_0x2b697c){return db[_0x4971('0x20')][_0x4971('0x22')]({'ItemTypeId':_0xbfb52b,'description':_0x19d4f2,'OrderBy':_0xcf105e},{'where':{'CmContactId':_0x575866,'item':_0x23e431}})[_0x4971('0x18')](function(_0x58ab9a){_0x5f1037({'res':_0x4971('0x23')});});}else{return db[_0x4971('0x20')][_0x4971('0x24')]({'CmContactId':_0x575866,'item':_0x23e431,'description':_0x19d4f2,'ItemTypeId':_0xbfb52b,'OrderBy':_0xcf105e,'ItemClass':_0x4971('0x25')})[_0x4971('0x18')](function(_0x45a92c){_0x5f1037({'res':_0x4971('0x26')});});}});});}function insertCmHopper(_0x26b504,_0x3b22ba,_0x216005,_0x5493b9,_0x4c6ef2){var _0x5f3553=[_0x4971('0x27'),'cm_contacts.scheduledat',_0x4971('0x28'),_0x4971('0x29'),_0x3b22ba+'.'+_0x5493b9,_0x4971('0x2a'),_0x4971('0x2b'),_0x4971('0x2c'),_0x4971('0x2d'),'\x22'+_0x4c6ef2+'\x22'];return squel[_0x4971('0x2e')]()[_0x4971('0x2f')](_0x4971('0x30'))[_0x4971('0x31')](['phone',_0x4971('0x32'),_0x4971('0x33'),_0x4971('0x34'),_0x5493b9,_0x4971('0x35'),_0x4971('0x36'),_0x4971('0x37'),_0x4971('0x38'),_0x4971('0x39')],squel['select']()[_0x4971('0x3a')](_0x5f3553)[_0x4971('0x10')](_0x3b22ba)['join']('cm_contacts',null,_0x4971('0x3b')+_0x3b22ba+'.CmListId')[_0x4971('0x11')](_0x216005,null,_0x216005+_0x4971('0x12')+_0x3b22ba+'.'+_0x5493b9)['where'](_0x3b22ba+'.CmListId\x20=\x20?',_0x26b504)['where'](_0x4971('0x3c'),NOW)[_0x4971('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3b22ba,_0x216005,_0x5493b9,_0x4971('0x30'),[_0x4971('0x3d'),_0x4971('0x3e')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3b22ba,_0x216005,_0x5493b9,_0x4971('0x30'),[_0x4971('0x3d')])))[_0x4971('0x3f')]();}function insertCmHopperBlack(_0x28ebe9,_0xc6c4ee,_0x49370a,_0x344264){var _0x17033c=[_0x4971('0x27'),_0x4971('0x28'),_0x4971('0x29'),_0xc6c4ee+'.'+_0x344264,_0x4971('0x2a'),_0x4971('0x2b')];return squel[_0x4971('0x2e')]()['into'](_0x4971('0x40'))[_0x4971('0x31')]([_0x4971('0xf'),_0x4971('0x33'),'ListId',_0x344264,_0x4971('0x35'),_0x4971('0x36')],squel[_0x4971('0xd')]()[_0x4971('0x3a')](_0x17033c)[_0x4971('0x10')](_0xc6c4ee)[_0x4971('0x11')](_0x4971('0x41'),null,'cm_contacts.ListId\x20=\x20'+_0xc6c4ee+_0x4971('0x42'))['join'](_0x49370a,null,_0x49370a+_0x4971('0x12')+_0xc6c4ee+'.'+_0x344264)['where'](_0xc6c4ee+_0x4971('0x43'),_0x28ebe9)['where'](_0x4971('0x3c'),NOW)[_0x4971('0x14')](_0x4971('0x44'),squel[_0x4971('0xd')]()[_0x4971('0xe')]('phone')['from'](_0x4971('0x40'))[_0x4971('0x14')]('ListId\x20=\x20?',_0x28ebe9)['where'](_0x344264+_0x4971('0x13')+_0xc6c4ee+'.'+_0x344264)))[_0x4971('0x3f')]();}function insertTzCmHopper(_0x1cc70a,_0x54fa95,_0x4357e8,_0x4c52ae,_0x5428dc,_0x2bc705){var _0x501628=[_0x4971('0x27'),_0x4971('0x45')+_0x2bc705+_0x4971('0x46'),_0x4971('0x28'),_0x4971('0x29'),_0x54fa95+'.'+_0x4c52ae,_0x4971('0x2a'),_0x4971('0x2b'),_0x4971('0x2c'),'cm_contacts.UserId','\x22'+_0x5428dc+'\x22'];var _0x26d6d2=squel['insert']()[_0x4971('0x2f')](_0x4971('0x30'))[_0x4971('0x31')]([_0x4971('0xf'),_0x4971('0x32'),'ContactId',_0x4971('0x34'),_0x4c52ae,_0x4971('0x35'),_0x4971('0x36'),'priority',_0x4971('0x38'),_0x4971('0x39')],squel[_0x4971('0xd')]()[_0x4971('0x3a')](_0x501628)[_0x4971('0x10')](_0x54fa95)[_0x4971('0x11')](_0x4971('0x41'),null,'cm_contacts.ListId\x20=\x20'+_0x54fa95+_0x4971('0x42'))[_0x4971('0x11')](_0x4357e8,null,_0x4357e8+'.id\x20=\x20'+_0x54fa95+'.'+_0x4c52ae)[_0x4971('0x11')](_0x2bc705,null,_0x2bc705+_0x4971('0x12')+_0x54fa95+'.'+_0x4c52ae)['where'](_0x54fa95+_0x4971('0x43'),_0x1cc70a)[_0x4971('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x4971('0x14')](_0x4971('0x44'),selectNotIn(_0x54fa95,_0x4357e8,_0x4c52ae,'cm_hopper',[_0x4971('0x3d'),_0x4971('0x3e')]))[_0x4971('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x54fa95,_0x4357e8,_0x4c52ae,_0x4971('0x30'),[_0x4971('0x3d')])))[_0x4971('0x3f')]();return _0x26d6d2;}function insertTzCmHopperBlack(_0x4d4fc6,_0x1c3b92,_0x133380,_0x4f8d26){var _0x4d5015=['cm_contacts.phone',_0x4971('0x28'),'cm_contacts.ListId',_0x1c3b92+'.'+_0x4f8d26,_0x4971('0x2a'),_0x4971('0x2b')];return squel[_0x4971('0x2e')]()[_0x4971('0x2f')](_0x4971('0x40'))[_0x4971('0x31')]([_0x4971('0xf'),_0x4971('0x33'),_0x4971('0x34'),_0x4f8d26,_0x4971('0x35'),_0x4971('0x36')],squel[_0x4971('0xd')]()[_0x4971('0x3a')](_0x4d5015)['from'](_0x1c3b92)[_0x4971('0x11')]('cm_contacts',null,_0x4971('0x3b')+_0x1c3b92+_0x4971('0x42'))['join'](_0x133380,null,_0x133380+'.id\x20=\x20'+_0x1c3b92+'.'+_0x4f8d26)[_0x4971('0x14')](_0x1c3b92+_0x4971('0x43'),_0x4d4fc6)[_0x4971('0x14')](_0x4971('0x3c'),NOW)[_0x4971('0x14')](_0x4971('0x44'),squel[_0x4971('0xd')]()['field'](_0x4971('0xf'))[_0x4971('0x10')]('cm_hopper_black')[_0x4971('0x14')](_0x4971('0x47'),_0x4d4fc6)[_0x4971('0x14')](_0x4f8d26+_0x4971('0x13')+_0x1c3b92+'.'+_0x4f8d26)))[_0x4971('0x3f')]();}function insertCmHopperAdditionalPhones(_0x53684f){var _0x42ede1=[_0x4971('0x48'),'cm_contact_has_items.item',_0x4971('0x49'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x4971('0x2e')]()['into'](_0x4971('0x4a'))[_0x4971('0x31')]([_0x4971('0x4b'),_0x4971('0xf'),_0x4971('0x4c'),_0x4971('0x35'),_0x4971('0x36')],squel[_0x4971('0xd')]()[_0x4971('0x3a')](_0x42ede1)[_0x4971('0x10')](_0x4971('0x30'))[_0x4971('0x11')](_0x4971('0x41'),null,_0x4971('0x4d'))[_0x4971('0x11')](_0x4971('0x4e'),null,_0x4971('0x4f'))[_0x4971('0x14')]('cm_hopper.ListId\x20=\x20?',_0x53684f)[_0x4971('0x14')](_0x4971('0x3c'),NOW))[_0x4971('0x3f')]();}function insertCmContact(_0x17db57,_0x475f37,_0x3496d8,_0x4ccaa6){var _0x4d4020=_['concat'](_['keys'](_0x4ccaa6),['ListId','CompanyId','createdAt',_0x4971('0x36'),_0x4971('0x50')]);return squel[_0x4971('0x2e')]()[_0x4971('0x2f')](_0x4971('0x41'))['fromQuery'](_0x4d4020,squel['select']()['fields'](_0x4d4020)[_0x4971('0x10')](_0x475f37)[_0x4971('0x14')]('('+_0x3496d8[_0x4971('0x11')](',')+_0x4971('0x51'),squel['select']()[_0x4971('0x3a')](_0x3496d8)[_0x4971('0x10')](_0x4971('0x41'))['where'](_0x4971('0x47'),_0x17db57)[_0x4971('0x14')](_0x4971('0x52')))['where'](_0x4971('0x53'),squel[_0x4971('0xd')]()[_0x4971('0xe')](_0x4971('0x54'),_0x4971('0x55'))[_0x4971('0x10')](_0x475f37)[_0x4971('0x56')](_0x3496d8['join'](','))))[_0x4971('0x3f')]();}function handleStop(){logger[_0x4971('0x57')](_0x4971('0x58'));stopped=!![];}function handleUncaughtException(_0xba84b8){logger[_0x4971('0x59')](_0xba84b8[_0x4971('0x5a')]);process['exit'](0x1);}function handleError(_0x313b76,_0x5ad2b6){stats[_0x4971('0x5b')][_0x4971('0x1d')]({'name':_0x5ad2b6[_0x4971('0x5c')],'message':_0x5ad2b6['message'],'row':_0x313b76});}function handleQuery(_0x24a20c){logger[_0x4971('0x57')](_0x24a20c);return db[_0x4971('0x5d')]['query'](_0x24a20c)[_0x4971('0x5e')](function(_0x181b83){results[_0x4971('0x1d')](_0x181b83);})[_0x4971('0x5f')](function(_0x3d75d0){logger['error'](_0x3d75d0[_0x4971('0x5a')]);});}function updateTzCampaigns(_0x41cfcc){return new Promise(function(_0x3e1c1d,_0xfcbd5c){var _0x4ea07c=squel[_0x4971('0xd')]()[_0x4971('0x3a')](['campaigns.id','campaigns.dialTimezone'])[_0x4971('0x10')](_0x4971('0x60'))['join'](_0x4971('0x61'),null,_0x4971('0x62'))[_0x4971('0x14')](_0x4971('0x63')+_0x41cfcc);db[_0x4971('0x5d')][_0x4971('0x64')](_0x4ea07c[_0x4971('0x3f')]())[_0x4971('0x5e')](function(_0x57ba34){var _0x151f7c=[];for(var _0x30a48f=0x0;_0x30a48f<_0x57ba34['length'];_0x30a48f++){_0x151f7c[_0x4971('0x1d')](getTimezoneData(_0x57ba34[_0x30a48f],tmp_campaigns));}BPromise['all'](_0x151f7c)[_0x4971('0x18')](function(){_0x3e1c1d({'val':0x1});});})['catch'](function(_0x128953){logger[_0x4971('0x59')](_0x128953['message']);_0x3e1c1d({'val':0x0});});});}function updateTzVoiceQueues(_0x5983a5){return new Promise(function(_0x11c6b4,_0x4552ce){var _0x8e01bc=squel[_0x4971('0xd')]()[_0x4971('0x3a')]([_0x4971('0x65'),_0x4971('0x66')])[_0x4971('0x10')](_0x4971('0x67'))[_0x4971('0x11')](_0x4971('0x68'),null,_0x4971('0x69'))[_0x4971('0x14')](_0x4971('0x6a')+_0x5983a5);db[_0x4971('0x5d')][_0x4971('0x64')](_0x8e01bc[_0x4971('0x3f')]())['spread'](function(_0x28f71f){var _0x42b215=[];for(var _0x3d3837=0x0;_0x3d3837<_0x28f71f['length'];_0x3d3837++){_0x42b215[_0x4971('0x1d')](getTimezoneData(_0x28f71f[_0x3d3837],tmp_voice_queues));}BPromise['all'](_0x42b215)['then'](function(){_0x11c6b4({'val':0x1});});})[_0x4971('0x5f')](function(_0xd2646b){logger[_0x4971('0x59')](_0xd2646b[_0x4971('0x5a')]);_0x11c6b4({'val':0x0});});});}function getTimezoneData(_0x1a25a2,_0x3a47b8){return new Promise(function(_0x3b0386,_0x4e92da){var _0xb8c63e=shared[_0x4971('0x6b')];var _0x3dbeda=_0xb8c63e[_0x1a25a2['dialTimezone']];if(_[_0x4971('0x1e')](_0x3dbeda)){_0x3b0386({'ret':0x1});}else{var _0x143e72=_0x3dbeda[_0x4971('0x6c')];var _0x4a40cf=squel[_0x4971('0x2e')]()['into'](_0x3a47b8)[_0x4971('0x6d')]('id',_0x1a25a2['id'])[_0x4971('0x6d')](_0x4971('0x6e'),_0x143e72)[_0x4971('0x6d')]('dialTimezone',_0x1a25a2[_0x4971('0x6f')])[_0x4971('0x3f')]();return db[_0x4971('0x5d')][_0x4971('0x64')](_0x4a40cf)[_0x4971('0x5e')](function(_0x4100f5){_0x3b0386({'ret':0x1});})[_0x4971('0x5f')](function(_0x574b39){logger['error'](_0x574b39[_0x4971('0x5a')]);_0x4e92da({'ret':0x1});});}});}function handleTZQuery(_0xfd1603){logger['info'](_0xfd1603);return db[_0x4971('0x5d')][_0x4971('0x64')](_0xfd1603)[_0x4971('0x5e')](function(_0x35e762){})[_0x4971('0x5f')](function(_0x139f7d){logger[_0x4971('0x59')](_0x139f7d[_0x4971('0x5a')]);});}function main(_0x422c73,_0x581388,_0x2fd2fe,_0x417998){logger['info'](_0x4971('0x70'),_0x422c73,JSON[_0x4971('0x71')](_0x581388));process['send']('start');var _0x5b011e=_0x581388[_0x4971('0x72')];var _0xd69b20=_[_0x4971('0x73')](_0x5b011e);var _0x31b00b=_0x581388[_0x4971('0x74')];var _0x4a94df=path[_0x4971('0x11')](config[_0x4971('0x75')],'server/files/tmp',_0x31b00b+'.csv');hasTZ=_['keys'](_0x5b011e)['includes'](_0x4971('0x6f'));var _0x4d5531=_[_0x4971('0x76')](_0x5b011e)[_0x4971('0x11')]();logger['info'](_0x4971('0x77'),_0x4d5531);db['ContactItemType'][_0x4971('0x17')]({'raw':!![],'attributes':['id',_0x4971('0x78')]})[_0x4971('0x18')](function(_0x29a831){for(var _0x51d961=0x0;_0x51d961<_0x29a831[_0x4971('0x1c')];_0x51d961++){if(_0x29a831[_0x51d961]['name']in _0x5b011e){contactItemTypes[_0x4971('0x1d')](_0x29a831[_0x51d961]);delete _0xd69b20[_0x29a831[_0x51d961][_0x4971('0x78')]];hasAdditionalPhones=!![];}for(var _0x5e944c in _0x5b011e){if(_0x29a831[_0x51d961][_0x4971('0x78')]+_0x4971('0x79')===_0x5e944c){phoneDescriptions[_0x4971('0x1d')]({'itemTypeId':_0x29a831[_0x51d961]['id'],'description':_0x5e944c});delete _0xd69b20[_0x5e944c];}}}if(hasAdditionalPhones)_0xd69b20['AdditionalPhones']='';var _0x4aadbb=_[_0x4971('0x76')](_0xd69b20)[_0x4971('0x11')]();logger[_0x4971('0x57')]('header',_0x4aadbb);fs[_0x4971('0x7a')](_0x4a94df,_0x4aadbb+'\x0a');Papa[_0x4971('0x7b')](fs[_0x4971('0x7c')](_0x422c73),{'header':!![],'skipEmptyLines':!![],'step':function(_0x12604d,_0x11e652){try{for(var _0x129f3f=0x0,_0x34eeba=[];_0x129f3f<_0x12604d[_0x4971('0x7d')][_0x4971('0x1c')];_0x129f3f++){stats[_0x4971('0x7e')]+=0x1;if(_0x12604d[_0x4971('0x5b')][_0x129f3f]){handleError(_0x12604d[_0x4971('0x7d')][_0x129f3f],_0x12604d[_0x4971('0x5b')][_0x129f3f]);}else{var _0x22ec30=[];var _0x453290=[];var _0x172e0a={};for(var _0x438189 in _0x5b011e){let _0x40cfa7=contactItemTypes[_0x4971('0x7f')](_0x158332=>_0x158332[_0x4971('0x78')]===_0x438189);let _0x22b8fa=contactItemTypes[_0x4971('0x7f')](_0x57802c=>_0x57802c[_0x4971('0x78')]+_0x4971('0x79')===_0x438189);if(_['isNil'](_0x40cfa7)&&_['isNil'](_0x22b8fa)){if(_0x5b011e[_0x4971('0x80')](_0x438189)){if(_0x12604d[_0x4971('0x7d')][_0x129f3f][_0x5b011e[_0x438189]]){var _0x4102b0=_[_0x4971('0x81')](_0x12604d[_0x4971('0x7d')][_0x129f3f][_0x5b011e[_0x438189]]['replace'](/"/g,'\x27'));switch(_0x438189){case _0x4971('0x32'):var _0x486149=moment(_0x4102b0,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x486149[_0x4971('0x82')]()){_0x34eeba[_0x4971('0x1d')]('\x22'+_0x4102b0+'\x22');}else{_0x22ec30[_0x4971('0x1d')](_0x4971('0x83'));}break;case _0x4971('0x37'):var _0x54a290=parseInt(_0x4102b0);_0x4102b0=_['isNaN'](_0x54a290)||_0x54a290<0x0||_0x54a290>0x4?_0x417998?0x3:0x2:_0x54a290;_0x34eeba['push']('\x22'+_0x4102b0+'\x22');break;case _0x4971('0x38'):var _0x3fbbfa=parseInt(_0x4102b0);if(_[_0x4971('0x84')](_0x3fbbfa)&&_[_0x4971('0x85')](_0x2fd2fe,_0x3fbbfa)){_0x34eeba[_0x4971('0x1d')]('\x22'+_0x3fbbfa+'\x22');}else{_0x22ec30['push']('agent\x20not\x20exists');}break;case _0x4971('0x86'):if(isEmail(_0x4102b0)){_0x34eeba[_0x4971('0x1d')]('\x22'+_0x4102b0+'\x22');}else{_0x22ec30[_0x4971('0x1d')]('email\x20wrong\x20format');}break;case _0x4971('0x87'):var _0x90393e=moment(_0x4102b0,_0x4971('0x88'),!![]);if(_0x90393e[_0x4971('0x82')]()){_0x34eeba[_0x4971('0x1d')]('\x22'+_0x4102b0+'\x22');}else{_0x22ec30['push'](_0x4971('0x89'));}break;case _0x4971('0x6f'):var _0x35f35e=shared[_0x4971('0x6b')];var _0x317e67=_0x35f35e[_0x4102b0];if(!_[_0x4971('0x1e')](_0x317e67)){var _0x15f6c2=_0x317e67[_0x4971('0x6c')];_0x34eeba[_0x4971('0x1d')]('\x22'+_0x4102b0+'\x22');_0x34eeba[_0x4971('0x1d')]('\x22'+_0x15f6c2+'\x22');}break;default:_0x34eeba[_0x4971('0x1d')]('\x22'+_0x4102b0+'\x22');}}else{switch(_0x438189){case _0x4971('0x8a'):case _0x4971('0xf'):_0x22ec30[_0x4971('0x1d')](_0x438189+'\x20not\x20specified');break;default:_0x34eeba[_0x4971('0x1d')]('\x22\x22');}}}}else{var _0x18dc2a='';if(!_[_0x4971('0x1e')](_0x40cfa7)){if(!_0x172e0a[_0x4971('0x80')](_0x40cfa7['id'])){if(!_['isNil'](_0x12604d['data'][_0x129f3f][_0x5b011e[_0x438189]])){var _0x4102b0=_[_0x4971('0x81')](_0x12604d[_0x4971('0x7d')][_0x129f3f][_0x5b011e[_0x438189]]['replace'](/"/g,'\x27'));var _0xf0b281=phoneDescriptions['find'](_0x180da0=>_0x180da0[_0x4971('0x8b')]===_0x40cfa7['id']);if(!_[_0x4971('0x1e')](_0xf0b281)){var _0x5b9c78=_[_0x4971('0x81')](_0x12604d['data'][_0x129f3f][_0x5b011e[_0xf0b281[_0x4971('0x8c')]]]['replace'](/"/g,'\x27'));if(!_[_0x4971('0x1e')](_0x5b9c78))_0x4102b0=_0x4102b0+'§'+_0x5b9c78;}if(_0x18dc2a=='')_0x18dc2a=_0x4102b0;else _0x18dc2a+='|'+_0x4102b0;}_0x453290[_0x4971('0x1d')](_0x40cfa7['id']+':'+_0x18dc2a);_0x172e0a[_0x40cfa7['id']]=0x1;}}}}if(hasAdditionalPhones){_0x34eeba['push']('\x22'+_0x453290[_0x4971('0x11')](';')+'\x22');}if(_0x22ec30['length']){handleError(_0x12604d[_0x4971('0x7d')][_0x129f3f],{'code':'SystemRow','message':_0x22ec30[_0x4971('0x11')]()});}else{fs[_0x4971('0x8d')](_0x4a94df,_0x34eeba[_0x4971('0x11')]()+'\x0a');}_0x34eeba=[];}if(!(stats[_0x4971('0x7e')]%0xc8)){socket[_0x4971('0x8e')](_0x4971('0x8f')+_0x31b00b,stats);stats[_0x4971('0x5b')]=[];}}if(stopped){logger[_0x4971('0x57')](_0x4971('0x90'));_0x11e652[_0x4971('0x91')]();}}catch(_0x475919){handleError(_0x12604d[_0x4971('0x7d')][_0x129f3f],{'code':_0x4971('0x92'),'message':_0x475919[_0x4971('0x5a')]});logger[_0x4971('0x59')](_0x4971('0x93'),_0x475919[_0x4971('0x5a')]);}},'complete':function(){try{var _0x21d127=[];var _0x3290f0=[];var _0x34b5e9=_0x4971('0x41');if(_0x581388[_0x4971('0x94')]&&_0x581388[_0x4971('0x94')][_0x4971('0x1c')]){_0x34b5e9=_0x4971('0x95')+_0x31b00b;_0x21d127['push'](_0x4971('0x96')+_0x34b5e9+_0x4971('0x97'));}tmp_campaigns=_0x4971('0x98')+_0x31b00b;tmp_voice_queues=_0x4971('0x99')+_0x31b00b;_0x3290f0[_0x4971('0x1d')](_0x4971('0x96')+tmp_campaigns+_0x4971('0x9a'));_0x3290f0[_0x4971('0x1d')](_0x4971('0x96')+tmp_voice_queues+_0x4971('0x9a'));BPromise[_0x4971('0x9b')](_0x3290f0,handleTZQuery)[_0x4971('0x18')](function(_0x19fa45){updateTzCampaigns(_0x581388[_0x4971('0x34')])[_0x4971('0x18')](function(_0x4cf77e){updateTzVoiceQueues(_0x581388['ListId'])[_0x4971('0x18')](function(_0x4792ff){if(hasTZ)_0x4aadbb=_0x4aadbb[_0x4971('0x9c')]('dialTimezone',_0x4971('0x9d'));var _0x2d63a8=util[_0x4971('0xa')](_0x4971('0x9e'),_0x4a94df,_0x34b5e9,_0x4aadbb,_0x581388[_0x4971('0x34')],_0x581388[_0x4971('0x9f')]||null,NOW,NOW);if(_[_0x4971('0x1e')](_0x5b011e['scheduledat'])){_0x2d63a8+=_0x4971('0xa0');}_0x21d127[_0x4971('0x1d')](_0x2d63a8);if(_0x581388[_0x4971('0x94')]&&_0x581388['duplicates'][_0x4971('0x1c')]){_0x21d127[_0x4971('0x1d')](insertCmContact(_0x581388[_0x4971('0x34')],_0x34b5e9,_0x581388[_0x4971('0x94')],_0x5b011e));_0x21d127['push'](_0x4971('0xa1')+_0x34b5e9+';');}BPromise[_0x4971('0x9b')](_0x21d127,handleQuery)['then'](function(_0x2b914c){BPromise[_0x4971('0x19')]([handleAdditionalPhones()])[_0x4971('0x18')](function(){_0x21d127=[];for(var _0x439f6e=0x0;_0x439f6e_0x52aebc['name']===_0x103179);let _0x180217=contactItemTypes[_0x7646('0x81')](_0x5c5b29=>_0x5c5b29[_0x7646('0x7a')]+_0x7646('0x7b')===_0x103179);if(_[_0x7646('0x20')](_0xeac64e)&&_[_0x7646('0x20')](_0x180217)){if(_0x1887dc[_0x7646('0x82')](_0x103179)){if(_0x3facbe[_0x7646('0x7f')][_0x335dbf][_0x1887dc[_0x103179]]){var _0x25e1cd=_[_0x7646('0x83')](_0x3facbe[_0x7646('0x7f')][_0x335dbf][_0x1887dc[_0x103179]]['replace'](/"/g,'\x27'));switch(_0x103179){case _0x7646('0x31'):var _0x5626e2=moment(_0x25e1cd,_0x7646('0x84'),!![]);if(_0x5626e2[_0x7646('0x85')]()){_0x131e2e[_0x7646('0x1c')]('\x22'+_0x25e1cd+'\x22');}else{_0x50f51b[_0x7646('0x1c')](_0x7646('0x86'));}break;case _0x7646('0x35'):var _0x18c422=parseInt(_0x25e1cd);_0x25e1cd=_[_0x7646('0x87')](_0x18c422)||_0x18c422<0x0||_0x18c422>0x4?_0x376537?0x3:0x2:_0x18c422;_0x131e2e['push']('\x22'+_0x25e1cd+'\x22');break;case _0x7646('0x36'):var _0x244610=parseInt(_0x25e1cd);if(_[_0x7646('0x88')](_0x244610)&&_['includes'](_0x524a40,_0x244610)){_0x131e2e[_0x7646('0x1c')]('\x22'+_0x244610+'\x22');}else{_0x50f51b['push'](_0x7646('0x89'));}break;case _0x7646('0x8a'):if(isEmail(_0x25e1cd)){_0x131e2e['push']('\x22'+_0x25e1cd+'\x22');}else{_0x50f51b[_0x7646('0x1c')](_0x7646('0x8b'));}break;case _0x7646('0x8c'):var _0x432c52=moment(_0x25e1cd,'YYYY-MM-DD',!![]);if(_0x432c52[_0x7646('0x85')]()){_0x131e2e[_0x7646('0x1c')]('\x22'+_0x25e1cd+'\x22');}else{_0x50f51b[_0x7646('0x1c')](_0x7646('0x8d'));}break;case'dialTimezone':var _0x3036c3=shared['timezones'];var _0x54573f=_0x3036c3[_0x25e1cd];if(!_[_0x7646('0x20')](_0x54573f)){var _0x198d19=_0x54573f[_0x7646('0x8e')];_0x131e2e[_0x7646('0x1c')]('\x22'+_0x25e1cd+'\x22');_0x131e2e['push']('\x22'+_0x198d19+'\x22');}break;default:_0x131e2e[_0x7646('0x1c')]('\x22'+_0x25e1cd+'\x22');}}else{switch(_0x103179){case _0x7646('0x8f'):case'phone':_0x50f51b[_0x7646('0x1c')](_0x103179+'\x20not\x20specified');break;default:_0x131e2e['push']('\x22\x22');}}}}else{var _0x160673='';if(!_[_0x7646('0x20')](_0xeac64e)){if(!_0x48a13d[_0x7646('0x82')](_0xeac64e['id'])){if(!_[_0x7646('0x20')](_0x3facbe['data'][_0x335dbf][_0x1887dc[_0x103179]])){var _0x25e1cd=_[_0x7646('0x83')](_0x3facbe[_0x7646('0x7f')][_0x335dbf][_0x1887dc[_0x103179]]['replace'](/"/g,'\x27'));var _0x1c8f0b=phoneDescriptions['find'](_0x52c0ca=>_0x52c0ca['itemTypeId']===_0xeac64e['id']);if(!_[_0x7646('0x20')](_0x1c8f0b)){var _0x1eb8c5=_[_0x7646('0x83')](_0x3facbe[_0x7646('0x7f')][_0x335dbf][_0x1887dc[_0x1c8f0b[_0x7646('0x90')]]][_0x7646('0x91')](/"/g,'\x27'));if(!_['isNil'](_0x1eb8c5))_0x25e1cd=_0x25e1cd+'§'+_0x1eb8c5;}if(_0x160673=='')_0x160673=_0x25e1cd;else _0x160673+='|'+_0x25e1cd;}_0x299705[_0x7646('0x1c')](_0xeac64e['id']+':'+_0x160673);_0x48a13d[_0xeac64e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x131e2e[_0x7646('0x1c')]('\x22'+_0x299705['join'](';')+'\x22');}if(_0x50f51b[_0x7646('0x1f')]){handleError(_0x3facbe[_0x7646('0x7f')][_0x335dbf],{'code':'SystemRow','message':_0x50f51b[_0x7646('0x13')]()});}else{fs[_0x7646('0x92')](_0xf1f9c5,_0x131e2e[_0x7646('0x13')]()+'\x0a');}_0x131e2e=[];}if(!(stats[_0x7646('0x80')]%0xc8)){socket['emit'](_0x7646('0x93')+_0x249335,stats);stats[_0x7646('0x5d')]=[];}}if(stopped){logger[_0x7646('0x5b')](_0x7646('0x94'));_0xfc6f74[_0x7646('0x95')]();}}catch(_0x1cbeaa){handleError(_0x3facbe[_0x7646('0x7f')][_0x335dbf],{'code':_0x7646('0x96'),'message':_0x1cbeaa[_0x7646('0x5f')]});logger[_0x7646('0x5c')](_0x7646('0x97'),_0x1cbeaa[_0x7646('0x5f')]);}},'complete':function(){try{var _0x4e43da=[];var _0x54400e=[];var _0x406f6f=_0x7646('0x39');if(_0x18484e[_0x7646('0x98')]&&_0x18484e['duplicates'][_0x7646('0x1f')]){_0x406f6f=_0x7646('0x99')+_0x249335;_0x4e43da[_0x7646('0x1c')](_0x7646('0x9a')+_0x406f6f+_0x7646('0x9b'));}tmp_campaigns=_0x7646('0x9c')+_0x249335;tmp_voice_queues=_0x7646('0x9d')+_0x249335;_0x54400e[_0x7646('0x1c')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7646('0x9e'));_0x54400e[_0x7646('0x1c')](_0x7646('0x9a')+tmp_voice_queues+_0x7646('0x9e'));BPromise[_0x7646('0x9f')](_0x54400e,handleTZQuery)[_0x7646('0x1b')](function(_0x47512d){updateTzCampaigns(_0x18484e[_0x7646('0x49')])['then'](function(_0xe97a6c){updateTzVoiceQueues(_0x18484e[_0x7646('0x49')])['then'](function(_0x5a8826){if(hasTZ)_0x121730=_0x121730[_0x7646('0x91')](_0x7646('0x6c'),'dialTimezone,utcOffset');var _0xb953bc=util[_0x7646('0xa0')](_0x7646('0xa1'),_0xf1f9c5,_0x406f6f,_0x121730,_0x18484e['ListId'],_0x18484e[_0x7646('0xa2')]||null,NOW,NOW);if(_[_0x7646('0x20')](_0x1887dc[_0x7646('0x31')])){_0xb953bc+=',\x20scheduledAt\x20=\x20NOW()';}_0x4e43da['push'](_0xb953bc);if(_0x18484e[_0x7646('0x98')]&&_0x18484e[_0x7646('0x98')]['length']){_0x4e43da[_0x7646('0x1c')](insertCmContact(_0x18484e['ListId'],_0x406f6f,_0x18484e[_0x7646('0x98')],_0x1887dc));_0x4e43da[_0x7646('0x1c')](_0x7646('0xa3')+_0x406f6f+';');}BPromise[_0x7646('0x9f')](_0x4e43da,handleQuery)[_0x7646('0x1b')](function(_0x30708d){BPromise[_0x7646('0x1d')]([handleAdditionalPhones()])['then'](function(){_0x4e43da=[];for(var _0x5c3d86=0x0;_0x5c3d86\x20\x20');}var _0x9f3bc2=path[_0x7646('0x13')](config['root'],_0x7646('0x75'),process[_0x7646('0xb0')][0x2]);if(!fs[_0x7646('0xb1')](_0x9f3bc2)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x33daf5={};try{_0x33daf5=JSON['parse'](process[_0x7646('0xb0')][0x3]);if(!_0x33daf5[_0x7646('0xb2')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x33daf5['binding'][_0x7646('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x33daf5['binding']['firstName']){throw new Error(_0x7646('0xb3'));}var _0x499050=0x0;if(_0x33daf5[_0x7646('0xb2')][_0x7646('0x36')]){_0x499050=0x1;}if(!_0x33daf5[_0x7646('0x49')]){throw new Error(_0x7646('0xb4'));}}catch(_0x5b1e91){throw new Error(_0x7646('0xb5'));}var _0x2b7d9e=[];try{_0x2b7d9e=_[_0x7646('0xb6')](JSON[_0x7646('0x7d')](process[_0x7646('0xb0')][0x4]),'id');}catch(_0x14b319){logger[_0x7646('0x5b')](_0x7646('0xb7'));}main(_0x9f3bc2,_0x33daf5,_0x2b7d9e,_0x499050);}validate();process['on'](_0x7646('0xb8'),handleStop);process['on'](_0x7646('0xb9'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 18cc448..03a6592 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2106=['No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','test','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','spread','length','isNil','AdditionalPhones','push','all','then','error','message','split','filter','CmContactHasItem','findOne','update','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','select','fields','cm_contacts','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.id','cm_contacts.updatedAt','insert','cm_contacts.ListId\x20=\x20','cm_hopper_black','\x20=\x20?','cm_hopper.id','cm_contact_has_items.updatedAt','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','info','Received\x20SIGINT','exit','errors','code','catch','main','stringify','send','start','binding','clone','root','body','ContactItemType','findAll','name','_description','writeFileSync','createReadStream','data','rows','find','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','hasOwnProperty','description','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','each','finish','affectedRows','contact:import:','unlink','argv','arguments\x20\x20\x20','server/files/tmp','file\x20doesn\x27t\x20exists','parse','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map'];(function(_0x382f18,_0x18161c){var _0x2d08da=function(_0x1ed348){while(--_0x1ed348){_0x382f18['push'](_0x382f18['shift']());}};_0x2d08da(++_0x18161c);}(_0x2106,0x133));var _0x6210=function(_0xa1eeae,_0x447d5e){_0xa1eeae=_0xa1eeae-0x0;var _0x417be6=_0x2106[_0xa1eeae];return _0x417be6;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x6210('0x0'));var Papa=require(_0x6210('0x1'));var util=require(_0x6210('0x2'));var BPromise=require(_0x6210('0x3'));var moment=require(_0x6210('0x4'));var squel=require(_0x6210('0x5'));var Redis=require(_0x6210('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x6210('0x7'));var logger=require(_0x6210('0x8'))('import');config[_0x6210('0x9')]=_[_0x6210('0xa')](config[_0x6210('0x9')],{'host':_0x6210('0xb'),'port':0x18eb});var socket=require(_0x6210('0xc'))(new Redis(config[_0x6210('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x6210('0xd')](_0x6210('0xe'));var tempTableName=_0x6210('0xf')+moment()['format']('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xe4b9e6){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))*$/[_0x6210('0x10')](_0xe4b9e6);}function selectNotIn(_0x4941cf,_0x4896a0,_0x42fbe8,_0x131d83,_0x3310aa){return squel['select']()[_0x6210('0x11')](_0x6210('0x12'))[_0x6210('0x13')](_0x131d83)[_0x6210('0x14')](_0x4896a0,null,_0x4896a0+_0x6210('0x15')+_0x131d83+'.'+_0x42fbe8)[_0x6210('0x16')](_0x131d83+'.'+_0x42fbe8+_0x6210('0x17')+_0x4941cf+'.'+_0x42fbe8)[_0x6210('0x16')](_0x4896a0+_0x6210('0x18')+_0x3310aa['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2dd886,_0x363888){promisesAdditionalPhones=[];promisesContact=[];return db[_0x6210('0x19')][_0x6210('0x1a')]('select\x20*\x20from\x20'+tempTableName)[_0x6210('0x1b')](function(_0x329fae){if(_0x329fae!==null){var _0x3af4ee=[];for(var _0xfe3fc0=0x0;_0xfe3fc0<_0x329fae[_0x6210('0x1c')];_0xfe3fc0++){var _0x2c7757=_0x329fae[_0xfe3fc0];if(!_[_0x6210('0x1d')](_0x2c7757[_0x6210('0x12')])){if(!_[_0x6210('0x1d')](_0x2c7757[_0x6210('0x1e')]))_0x3af4ee['push'](insertAdditionalPhones(_0x2c7757));promisesContact[_0x6210('0x1f')]({'contact':_0x2c7757});}}}Promise[_0x6210('0x20')](_0x3af4ee)[_0x6210('0x21')](function(){_0x2dd886({'val':0x1});});})['catch'](function(_0x12cc1b){logger[_0x6210('0x22')](_0x12cc1b[_0x6210('0x23')]);});});}function insertAdditionalPhones(_0x443d6c){return new Promise(function(_0x257645,_0x37b0ce){var _0x34d2c0=_0x443d6c[_0x6210('0x1e')];if(_['isNil'](_0x34d2c0))_0x37b0ce({'val':0x0});else{var _0x5eda55=_0x34d2c0[_0x6210('0x24')](';');var _0x2177c0=[];orderBy=0x0;for(var _0x287599=0x0;_0x287599<_0x5eda55[_0x6210('0x1c')];_0x287599++){_0x2177c0[_0x6210('0x1f')](splitAdditionalPhone(_0x443d6c['id'],_0x5eda55[_0x287599]));}Promise[_0x6210('0x20')](_0x2177c0)[_0x6210('0x21')](function(){_0x257645({'val':_0x5eda55[_0x6210('0x1c')]});});}});}function splitAdditionalPhone(_0x30ca85,_0x1805e3){return new Promise(function(_0x281d77,_0xd6b63e){var _0x20992a=_0x1805e3[_0x6210('0x24')](':');var _0x475aa5=_0x20992a[0x0];var _0x39492e=_0x20992a[0x1];if(_0x39492e!==''){var _0x16a077=_0x39492e[_0x6210('0x24')]('|');var _0x171bf4=[];for(var _0x38fe09=0x0;_0x38fe09<_0x16a077[_0x6210('0x1c')];_0x38fe09++){if(_0x16a077[_0x38fe09]!==''){var _0x1ea1cb=_[_0x6210('0x25')](promisesAdditionalPhones,{'contactId':_0x30ca85,'phone':_0x16a077[_0x38fe09]});if(_0x1ea1cb[_0x6210('0x1c')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x30ca85,'contactTypeId':_0x475aa5,'phone':_0x16a077[_0x38fe09],'orderBy':orderBy});}}}_0x281d77({'ok':0x1});}else _0x281d77({'res':0x0});});}function createAdditionalPhone(_0x42c485,_0x35b4e2,_0x508173,_0x2b5932){var _0x2c255e='';var _0x4224ff='';var _0x600286=_0x508173[_0x6210('0x24')]('§');_0x2c255e=_0x600286[0x0];if(_0x600286[_0x6210('0x1c')]==0x2)_0x4224ff=_0x600286[0x1];return new Promise(function(_0x3175ce,_0x33937d){return db[_0x6210('0x26')][_0x6210('0x27')]({'where':{'CmContactId':_0x42c485,'item':_0x2c255e}})[_0x6210('0x21')](function(_0x1ae97d){if(_0x1ae97d){return db['CmContactHasItem'][_0x6210('0x28')]({'ItemTypeId':_0x35b4e2,'description':_0x4224ff,'OrderBy':_0x2b5932},{'where':{'CmContactId':_0x42c485,'item':_0x2c255e}})[_0x6210('0x21')](function(_0xe8651d){_0x3175ce({'res':'updated'});});}else{return db[_0x6210('0x26')][_0x6210('0x29')]({'CmContactId':_0x42c485,'item':_0x2c255e,'ItemTypeId':_0x35b4e2,'description':_0x4224ff,'OrderBy':_0x2b5932,'ItemClass':_0x6210('0x2a')})['then'](function(_0x450e07){_0x3175ce({'res':_0x6210('0x2b')});});}});});}function updateContact(_0x5135d0){return new Promise(function(_0x19e69b,_0x339abe){var _0x5c24ef=_0x5135d0['id'];delete _0x5135d0['id'];return db[_0x6210('0x2c')][_0x6210('0x28')](_0x5135d0,{'where':{'id':_0x5c24ef}})[_0x6210('0x21')](function(_0x34f29b){updatedRows+=0x1;return db[_0x6210('0x2d')][_0x6210('0x28')]({'phone':_0x5135d0[_0x6210('0x12')]},{'where':{'ContactId':_0x5c24ef}})[_0x6210('0x21')](function(_0x500434){_0x19e69b({'ret':'OK'});});});});}function insertCmHopper(_0x3e5dd5,_0x4f652b,_0x4c824f,_0xc28b72,_0x399758){var _0x48a5ab=[_0x6210('0x2e'),_0x6210('0x2f'),'cm_contacts.id',_0x6210('0x30'),_0x4f652b+'.'+_0xc28b72,_0x6210('0x31'),'cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','\x22'+_0x399758+'\x22'];return squel['insert']()[_0x6210('0x32')](_0x6210('0x33'))[_0x6210('0x34')]([_0x6210('0x12'),_0x6210('0x35'),_0x6210('0x36'),_0x6210('0x37'),_0xc28b72,_0x6210('0x38'),_0x6210('0x39'),'priority',_0x6210('0x3a'),_0x6210('0x3b')],squel[_0x6210('0x3c')]()[_0x6210('0x3d')](_0x48a5ab)[_0x6210('0x13')](_0x4f652b)[_0x6210('0x14')](_0x6210('0x3e'),null,'cm_contacts.ListId\x20=\x20'+_0x4f652b+'.CmListId')[_0x6210('0x14')](_0x4c824f,null,_0x4c824f+_0x6210('0x15')+_0x4f652b+'.'+_0xc28b72)[_0x6210('0x16')](_0x4f652b+'.CmListId\x20=\x20?',_0x3e5dd5)[_0x6210('0x16')](_0x6210('0x3f'),NOW)[_0x6210('0x16')](_0x6210('0x40'),selectNotIn(_0x4f652b,_0x4c824f,_0xc28b72,_0x6210('0x33'),[_0x6210('0x41'),'\x22onlyIfOpen\x22']))['where'](_0x6210('0x40'),selectNotIn(_0x4f652b,_0x4c824f,_0xc28b72,_0x6210('0x33'),[_0x6210('0x41')])))[_0x6210('0x42')]();}function insertCmHopperBlack(_0x263ae3,_0x56a70c,_0x53c7a5,_0x253b4f){var _0x5554fe=[_0x6210('0x2e'),_0x6210('0x43'),_0x6210('0x30'),_0x56a70c+'.'+_0x253b4f,_0x6210('0x31'),_0x6210('0x44')];return squel[_0x6210('0x45')]()['into']('cm_hopper_black')[_0x6210('0x34')]([_0x6210('0x12'),'ContactId',_0x6210('0x37'),_0x253b4f,_0x6210('0x38'),'updatedAt'],squel[_0x6210('0x3c')]()[_0x6210('0x3d')](_0x5554fe)['from'](_0x56a70c)[_0x6210('0x14')](_0x6210('0x3e'),null,_0x6210('0x46')+_0x56a70c+'.CmListId')[_0x6210('0x14')](_0x53c7a5,null,_0x53c7a5+_0x6210('0x15')+_0x56a70c+'.'+_0x253b4f)[_0x6210('0x16')](_0x56a70c+'.CmListId\x20=\x20?',_0x263ae3)[_0x6210('0x16')](_0x6210('0x3f'),NOW)[_0x6210('0x16')](_0x6210('0x40'),squel[_0x6210('0x3c')]()[_0x6210('0x11')](_0x6210('0x12'))[_0x6210('0x13')](_0x6210('0x47'))[_0x6210('0x16')]('ListId\x20=\x20?',_0x263ae3)[_0x6210('0x16')](_0x253b4f+_0x6210('0x48'),_0x56a70c+'.'+_0x253b4f)))[_0x6210('0x42')]();}function insertCmHopperAdditionalPhones(_0x47ff53){var _0x3fe3c0=[_0x6210('0x49'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0x6210('0x4a')];return squel[_0x6210('0x45')]()[_0x6210('0x32')]('cm_hopper_additional_phones')[_0x6210('0x34')](['CmHopperId','phone',_0x6210('0x4b'),'createdAt',_0x6210('0x39')],squel[_0x6210('0x3c')]()[_0x6210('0x3d')](_0x3fe3c0)[_0x6210('0x13')](_0x6210('0x33'))[_0x6210('0x14')](_0x6210('0x3e'),null,_0x6210('0x4c'))[_0x6210('0x14')](_0x6210('0x4d'),null,_0x6210('0x4e'))[_0x6210('0x16')](_0x6210('0x4f'),_0x47ff53)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x6210('0x42')]();}function insertCmContact(_0x5727b6,_0x4c2bcf,_0x45466f,_0x3f9e59){var _0x12f3af=_[_0x6210('0x50')](_[_0x6210('0x51')](_0x3f9e59),[_0x6210('0x37'),_0x6210('0x52'),_0x6210('0x38'),_0x6210('0x39')]);return squel[_0x6210('0x45')]()[_0x6210('0x32')](_0x6210('0x3e'))[_0x6210('0x34')](_0x12f3af,squel[_0x6210('0x3c')]()[_0x6210('0x3d')](_0x12f3af)[_0x6210('0x13')](_0x4c2bcf)[_0x6210('0x16')]('('+_0x45466f[_0x6210('0x14')](',')+_0x6210('0x53'),squel[_0x6210('0x3c')]()[_0x6210('0x3d')](_0x45466f)['from'](_0x6210('0x3e'))[_0x6210('0x16')](_0x6210('0x54'),_0x5727b6))['where'](_0x6210('0x55'),squel[_0x6210('0x3c')]()[_0x6210('0x11')]('MIN(id)','min_id')['from'](_0x4c2bcf)['group'](_0x45466f[_0x6210('0x14')](','))))[_0x6210('0x42')]();}function handleStop(){logger[_0x6210('0x56')](_0x6210('0x57'));stopped=!![];}function handleUncaughtException(_0x2581e1){logger['error'](_0x2581e1[_0x6210('0x23')]);process[_0x6210('0x58')](0x1);}function handleError(_0xa54be,_0x58073c){stats[_0x6210('0x59')]['push']({'name':_0x58073c[_0x6210('0x5a')],'message':_0x58073c[_0x6210('0x23')],'row':_0xa54be});}function handleQuery(_0x501818){logger[_0x6210('0x56')](_0x501818);return db[_0x6210('0x19')][_0x6210('0x1a')](_0x501818)[_0x6210('0x1b')](function(_0x446ab5){results[_0x6210('0x1f')](_0x446ab5);})[_0x6210('0x5b')](function(_0x9415f6){logger[_0x6210('0x22')](_0x9415f6[_0x6210('0x23')]);});}function main(_0x1219bd,_0x59efc7,_0x31bf0b,_0x359a91){logger[_0x6210('0x56')](_0x6210('0x5c'),_0x1219bd,JSON[_0x6210('0x5d')](_0x59efc7));process[_0x6210('0x5e')](_0x6210('0x5f'));var _0xc9924d=_0x59efc7[_0x6210('0x60')];var _0xe13afb=_[_0x6210('0x61')](_0xc9924d);var _0x5218ff=_0x59efc7['socket_timestamp'];var _0xf4a508=path[_0x6210('0x14')](config[_0x6210('0x62')],'server/files/tmp',_0x5218ff+'.csv');logger[_0x6210('0x56')](_0x6210('0x63'),_0x59efc7);db[_0x6210('0x64')][_0x6210('0x65')]({'raw':!![],'attributes':['id',_0x6210('0x66')]})[_0x6210('0x21')](function(_0x18d734){for(var _0x22c236=0x0;_0x22c236<_0x18d734[_0x6210('0x1c')];_0x22c236++){if(_0x18d734[_0x22c236]['name']in _0xc9924d){contactItemTypes[_0x6210('0x1f')](_0x18d734[_0x22c236]);delete _0xe13afb[_0x18d734[_0x22c236]['name']];hasAdditionalPhones=!![];}for(var _0x5a591e in _0xc9924d){if(_0x18d734[_0x22c236][_0x6210('0x66')]+_0x6210('0x67')===_0x5a591e){phoneDescriptions[_0x6210('0x1f')]({'itemTypeId':_0x18d734[_0x22c236]['id'],'description':_0x5a591e});delete _0xe13afb[_0x5a591e];}}}if(hasAdditionalPhones)_0xe13afb[_0x6210('0x1e')]='';var _0x29e806=_[_0x6210('0x51')](_0xe13afb)[_0x6210('0x14')]();logger[_0x6210('0x56')]('header',_0x29e806);fs[_0x6210('0x68')](_0xf4a508,_0x29e806+'\x0a');Papa['parse'](fs[_0x6210('0x69')](_0x1219bd),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3007d5,_0x202c75){try{for(var _0x2f320b=0x0,_0x9123b6=[];_0x2f320b<_0x3007d5[_0x6210('0x6a')]['length'];_0x2f320b++){stats[_0x6210('0x6b')]+=0x1;if(_0x3007d5['errors'][_0x2f320b]){handleError(_0x3007d5['data'][_0x2f320b],_0x3007d5[_0x6210('0x59')][_0x2f320b]);}else{var _0x4cc96b=[];var _0x3bbd8b=[];var _0x4483ea={};for(var _0x493eae in _0xc9924d){let _0x5bbe57=contactItemTypes[_0x6210('0x6c')](_0xd45efc=>_0xd45efc['name']===_0x493eae);let _0x4b5e92=contactItemTypes[_0x6210('0x6c')](_0x583f35=>_0x583f35[_0x6210('0x66')]+_0x6210('0x67')===_0x493eae);if(_[_0x6210('0x1d')](_0x5bbe57)&&_['isNil'](_0x4b5e92)){if(_0xc9924d['hasOwnProperty'](_0x493eae)){if(_0x3007d5[_0x6210('0x6a')][_0x2f320b][_0xc9924d[_0x493eae]]){var _0x479d1c=_[_0x6210('0x6d')](_0x3007d5[_0x6210('0x6a')][_0x2f320b][_0xc9924d[_0x493eae]][_0x6210('0x6e')](/"/g,'\x27'));switch(_0x493eae){case _0x6210('0x35'):var _0x1f63a4=moment(_0x479d1c,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x1f63a4[_0x6210('0x6f')]()){_0x9123b6[_0x6210('0x1f')]('\x22'+_0x479d1c+'\x22');}else{_0x4cc96b['push'](_0x6210('0x70'));}break;case _0x6210('0x71'):var _0x306a32=parseInt(_0x479d1c);_0x479d1c=_['isNaN'](_0x306a32)||_0x306a32<0x0||_0x306a32>0x4?_0x359a91?0x3:0x2:_0x306a32;_0x9123b6[_0x6210('0x1f')]('\x22'+_0x479d1c+'\x22');break;case _0x6210('0x3a'):var _0x489a90=parseInt(_0x479d1c);if(_['isNumber'](_0x489a90)&&_['includes'](_0x31bf0b,_0x489a90)){_0x9123b6['push']('\x22'+_0x489a90+'\x22');}else{_0x4cc96b[_0x6210('0x1f')]('agent\x20not\x20exists');}break;case _0x6210('0x72'):if(isEmail(_0x479d1c)){_0x9123b6[_0x6210('0x1f')]('\x22'+_0x479d1c+'\x22');}else{_0x4cc96b[_0x6210('0x1f')](_0x6210('0x73'));}break;case _0x6210('0x74'):var _0x327e95=moment(_0x479d1c,'YYYY-MM-DD',!![]);if(_0x327e95['isValid']()){_0x9123b6[_0x6210('0x1f')]('\x22'+_0x479d1c+'\x22');}else{_0x4cc96b[_0x6210('0x1f')](_0x6210('0x75'));}break;default:_0x9123b6['push']('\x22'+_0x479d1c+'\x22');}}else{switch(_0x493eae){case _0x6210('0x76'):case _0x6210('0x12'):_0x4cc96b[_0x6210('0x1f')](_0x493eae+'\x20not\x20specified');break;default:_0x9123b6[_0x6210('0x1f')]('\x22\x22');}}}}else{var _0x3d2659='';if(!_['isNil'](_0x5bbe57)){if(!_0x4483ea[_0x6210('0x77')](_0x5bbe57['id'])){for(var _0x106358=0x0;_0x106358<_0xc9924d[_0x493eae]['length'];_0x106358++){var _0x479d1c=_[_0x6210('0x6d')](_0x3007d5['data'][_0x2f320b][_0xc9924d[_0x493eae][_0x106358]][_0x6210('0x6e')](/"/g,'\x27'));var _0x5de479=phoneDescriptions[_0x6210('0x6c')](_0x4f8098=>_0x4f8098['itemTypeId']===_0x5bbe57['id']);if(!_[_0x6210('0x1d')](_0x5de479)){var _0x36bf6d=_[_0x6210('0x6d')](_0x3007d5[_0x6210('0x6a')][_0x2f320b][_0xc9924d[_0x5de479[_0x6210('0x78')]][0x0]][_0x6210('0x6e')](/"/g,'\x27'));if(!_['isNil'](_0x36bf6d))_0x479d1c=_0x479d1c+'§'+_0x36bf6d;}if(_0x3d2659=='')_0x3d2659=_0x479d1c;else _0x3d2659+='|'+_0x479d1c;}_0x3bbd8b[_0x6210('0x1f')](_0x5bbe57['id']+':'+_0x3d2659);_0x4483ea[_0x5bbe57['id']]=0x1;}}}}if(hasAdditionalPhones){_0x9123b6[_0x6210('0x1f')]('\x22'+_0x3bbd8b[_0x6210('0x14')](';')+'\x22');}if(_0x4cc96b['length']){handleError(_0x3007d5[_0x6210('0x6a')][_0x2f320b],{'code':'SystemRow','message':_0x4cc96b[_0x6210('0x14')]()});}else{fs[_0x6210('0x79')](_0xf4a508,_0x9123b6['join']()+'\x0a');}_0x9123b6=[];}if(!(stats[_0x6210('0x6b')]%0xc8)){socket[_0x6210('0x7a')]('contact:import:'+_0x5218ff,stats);stats[_0x6210('0x59')]=[];}}if(stopped){logger[_0x6210('0x56')](_0x6210('0x7b'));_0x202c75[_0x6210('0x7c')]();}}catch(_0x503700){handleError(_0x3007d5[_0x6210('0x6a')][_0x2f320b],{'code':_0x6210('0x7d'),'message':_0x503700['message']});logger[_0x6210('0x22')](_0x6210('0x7e'),_0x503700[_0x6210('0x23')]);}},'complete':function(){try{var _0x863613=[];var _0x40db7b=tempTableName;_0x863613[_0x6210('0x1f')]('CREATE\x20TABLE\x20'+_0x40db7b+_0x6210('0x7f'));logger['info'](_0x6210('0x80'),contactItemTypes[_0x6210('0x1c')]);var _0x367d22=util[_0x6210('0xd')](_0x6210('0x81'),_0xf4a508,_0x40db7b,_0x29e806,_0x59efc7[_0x6210('0x37')],_0x59efc7[_0x6210('0x52')]||null,NOW,NOW);if(_[_0x6210('0x1d')](_0xc9924d[_0x6210('0x35')])){_0x367d22+=_0x6210('0x82');}_0x863613[_0x6210('0x1f')](_0x367d22);BPromise['each'](_0x863613,handleQuery)['then'](function(_0x5195dc){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x863613=[];for(var _0x561a0b=0x0;_0x561a0b\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','redis','localhost','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','spread','length','isNil','push','all','catch','error','AdditionalPhones','split','filter','CmContactHasItem','then','update','inserted','CmContact','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6f75,0x71));var _0x56f7=function(_0x483a3b,_0x5fd1bf){_0x483a3b=_0x483a3b-0x0;var _0x16fe1c=_0x6f75[_0x483a3b];return _0x16fe1c;};'use strict';var fs=require('fs');var path=require(_0x56f7('0x0'));var _=require(_0x56f7('0x1'));var Papa=require(_0x56f7('0x2'));var util=require(_0x56f7('0x3'));var BPromise=require(_0x56f7('0x4'));var moment=require(_0x56f7('0x5'));var squel=require(_0x56f7('0x6'));var Redis=require('ioredis');var db=require(_0x56f7('0x7'))['db'];var config=require(_0x56f7('0x8'));var logger=require(_0x56f7('0x9'))('import');config['redis']=_['defaults'](config[_0x56f7('0xa')],{'host':_0x56f7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x56f7('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x56f7('0xc')+moment()[_0x56f7('0xd')](_0x56f7('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x3887c2){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))*$/[_0x56f7('0xf')](_0x3887c2);}function selectNotIn(_0x1ae37d,_0x2f6386,_0x28d9fe,_0x394a5a,_0x11dedc){return squel[_0x56f7('0x10')]()[_0x56f7('0x11')](_0x56f7('0x12'))[_0x56f7('0x13')](_0x394a5a)['join'](_0x2f6386,null,_0x2f6386+_0x56f7('0x14')+_0x394a5a+'.'+_0x28d9fe)[_0x56f7('0x15')](_0x394a5a+'.'+_0x28d9fe+_0x56f7('0x16')+_0x1ae37d+'.'+_0x28d9fe)[_0x56f7('0x15')](_0x2f6386+_0x56f7('0x17')+_0x11dedc[_0x56f7('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1616d9,_0xdac70a){promisesAdditionalPhones=[];promisesContact=[];return db[_0x56f7('0x19')]['query']('select\x20*\x20from\x20'+tempTableName)[_0x56f7('0x1a')](function(_0x26c83a){if(_0x26c83a!==null){var _0x436a07=[];for(var _0x2a3713=0x0;_0x2a3713<_0x26c83a[_0x56f7('0x1b')];_0x2a3713++){var _0x156136=_0x26c83a[_0x2a3713];if(!_['isNil'](_0x156136[_0x56f7('0x12')])){if(!_[_0x56f7('0x1c')](_0x156136['AdditionalPhones']))_0x436a07['push'](insertAdditionalPhones(_0x156136));promisesContact[_0x56f7('0x1d')]({'contact':_0x156136});}}}Promise[_0x56f7('0x1e')](_0x436a07)['then'](function(){_0x1616d9({'val':0x1});});})[_0x56f7('0x1f')](function(_0x18fc2a){logger[_0x56f7('0x20')](_0x18fc2a['message']);});});}function insertAdditionalPhones(_0x5a944d){return new Promise(function(_0x5cf936,_0x17ec96){var _0x3602ee=_0x5a944d[_0x56f7('0x21')];if(_[_0x56f7('0x1c')](_0x3602ee))_0x17ec96({'val':0x0});else{var _0x476dd8=_0x3602ee[_0x56f7('0x22')](';');var _0x4ea835=[];orderBy=0x0;for(var _0x4a9fed=0x0;_0x4a9fed<_0x476dd8[_0x56f7('0x1b')];_0x4a9fed++){_0x4ea835[_0x56f7('0x1d')](splitAdditionalPhone(_0x5a944d['id'],_0x476dd8[_0x4a9fed]));}Promise[_0x56f7('0x1e')](_0x4ea835)['then'](function(){_0x5cf936({'val':_0x476dd8[_0x56f7('0x1b')]});});}});}function splitAdditionalPhone(_0x675b5a,_0x21e322){return new Promise(function(_0x101836,_0x3e06b4){var _0x443db4=_0x21e322[_0x56f7('0x22')](':');var _0x30cc36=_0x443db4[0x0];var _0x243611=_0x443db4[0x1];if(_0x243611!==''){var _0x3db61f=_0x243611[_0x56f7('0x22')]('|');var _0x4d6db4=[];for(var _0x1b5267=0x0;_0x1b5267<_0x3db61f[_0x56f7('0x1b')];_0x1b5267++){if(_0x3db61f[_0x1b5267]!==''){var _0x584590=_[_0x56f7('0x23')](promisesAdditionalPhones,{'contactId':_0x675b5a,'phone':_0x3db61f[_0x1b5267]});if(_0x584590[_0x56f7('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x56f7('0x1d')]({'contactId':_0x675b5a,'contactTypeId':_0x30cc36,'phone':_0x3db61f[_0x1b5267],'orderBy':orderBy});}}}_0x101836({'ok':0x1});}else _0x101836({'res':0x0});});}function createAdditionalPhone(_0x3b12c3,_0x345684,_0x1712fb,_0x72fbcb){var _0x1657de='';var _0x4c59a0='';var _0x306d8b=_0x1712fb[_0x56f7('0x22')]('§');_0x1657de=_0x306d8b[0x0];if(_0x306d8b['length']==0x2)_0x4c59a0=_0x306d8b[0x1];return new Promise(function(_0x481805,_0x47699e){return db[_0x56f7('0x24')]['findOne']({'where':{'CmContactId':_0x3b12c3,'item':_0x1657de}})[_0x56f7('0x25')](function(_0x1bd0c2){if(_0x1bd0c2){return db[_0x56f7('0x24')][_0x56f7('0x26')]({'ItemTypeId':_0x345684,'description':_0x4c59a0,'OrderBy':_0x72fbcb},{'where':{'CmContactId':_0x3b12c3,'item':_0x1657de}})['then'](function(_0x4a2be0){_0x481805({'res':'updated'});});}else{return db[_0x56f7('0x24')]['create']({'CmContactId':_0x3b12c3,'item':_0x1657de,'ItemTypeId':_0x345684,'description':_0x4c59a0,'OrderBy':_0x72fbcb,'ItemClass':'PHONE'})['then'](function(_0x18d2f7){_0x481805({'res':_0x56f7('0x27')});});}});});}function updateContact(_0x3c4efa){return new Promise(function(_0x3a2759,_0x5e051c){var _0x2b021c=_0x3c4efa['id'];delete _0x3c4efa['id'];return db[_0x56f7('0x28')][_0x56f7('0x26')](_0x3c4efa,{'where':{'id':_0x2b021c}})[_0x56f7('0x25')](function(_0x407a79){updatedRows+=0x1;return db['CmHopper'][_0x56f7('0x26')]({'phone':_0x3c4efa['phone']},{'where':{'ContactId':_0x2b021c}})[_0x56f7('0x25')](function(_0x4cb06b){_0x3a2759({'ret':'OK'});});});});}function insertCmHopper(_0x48ff44,_0x2a62a2,_0x4148f4,_0x275176,_0x1a254e){var _0x903324=[_0x56f7('0x29'),'cm_contacts.scheduledat',_0x56f7('0x2a'),_0x56f7('0x2b'),_0x2a62a2+'.'+_0x275176,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x56f7('0x2c'),_0x56f7('0x2d'),'\x22'+_0x1a254e+'\x22'];return squel[_0x56f7('0x2e')]()['into'](_0x56f7('0x2f'))[_0x56f7('0x30')]([_0x56f7('0x12'),_0x56f7('0x31'),'ContactId',_0x56f7('0x32'),_0x275176,_0x56f7('0x33'),_0x56f7('0x34'),_0x56f7('0x35'),_0x56f7('0x36'),_0x56f7('0x37')],squel['select']()[_0x56f7('0x38')](_0x903324)[_0x56f7('0x13')](_0x2a62a2)[_0x56f7('0x18')](_0x56f7('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x2a62a2+_0x56f7('0x3a'))[_0x56f7('0x18')](_0x4148f4,null,_0x4148f4+_0x56f7('0x14')+_0x2a62a2+'.'+_0x275176)['where'](_0x2a62a2+'.CmListId\x20=\x20?',_0x48ff44)['where'](_0x56f7('0x3b'),NOW)[_0x56f7('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2a62a2,_0x4148f4,_0x275176,'cm_hopper',[_0x56f7('0x3c'),_0x56f7('0x3d')]))[_0x56f7('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2a62a2,_0x4148f4,_0x275176,'cm_hopper',[_0x56f7('0x3c')])))['toString']();}function insertCmHopperBlack(_0x16bc96,_0x5bc667,_0x1f0d1d,_0x4e8e56){var _0xbb2154=[_0x56f7('0x29'),_0x56f7('0x2a'),_0x56f7('0x2b'),_0x5bc667+'.'+_0x4e8e56,_0x56f7('0x3e'),_0x56f7('0x3f')];return squel['insert']()[_0x56f7('0x40')](_0x56f7('0x41'))[_0x56f7('0x30')](['phone',_0x56f7('0x42'),'ListId',_0x4e8e56,_0x56f7('0x33'),_0x56f7('0x34')],squel['select']()[_0x56f7('0x38')](_0xbb2154)[_0x56f7('0x13')](_0x5bc667)[_0x56f7('0x18')](_0x56f7('0x39'),null,_0x56f7('0x43')+_0x5bc667+'.CmListId')[_0x56f7('0x18')](_0x1f0d1d,null,_0x1f0d1d+'.id\x20=\x20'+_0x5bc667+'.'+_0x4e8e56)[_0x56f7('0x15')](_0x5bc667+'.CmListId\x20=\x20?',_0x16bc96)[_0x56f7('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x56f7('0x15')](_0x56f7('0x44'),squel[_0x56f7('0x10')]()['field']('phone')[_0x56f7('0x13')](_0x56f7('0x41'))['where'](_0x56f7('0x45'),_0x16bc96)['where'](_0x4e8e56+_0x56f7('0x46'),_0x5bc667+'.'+_0x4e8e56)))['toString']();}function insertCmHopperAdditionalPhones(_0x5bc884){var _0x9bbdd0=[_0x56f7('0x47'),'cm_contact_has_items.item',_0x56f7('0x48'),_0x56f7('0x49'),'cm_contact_has_items.updatedAt'];return squel[_0x56f7('0x2e')]()['into'](_0x56f7('0x4a'))[_0x56f7('0x30')]([_0x56f7('0x4b'),_0x56f7('0x12'),_0x56f7('0x4c'),'createdAt',_0x56f7('0x34')],squel[_0x56f7('0x10')]()[_0x56f7('0x38')](_0x9bbdd0)['from'](_0x56f7('0x2f'))[_0x56f7('0x18')]('cm_contacts',null,_0x56f7('0x4d'))[_0x56f7('0x18')](_0x56f7('0x4e'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x56f7('0x15')](_0x56f7('0x4f'),_0x5bc884)[_0x56f7('0x15')](_0x56f7('0x3b'),NOW))['toString']();}function insertCmContact(_0x4a8a65,_0x166f9c,_0x5929cf,_0x4df870){var _0x2d44d8=_[_0x56f7('0x50')](_['keys'](_0x4df870),['ListId',_0x56f7('0x51'),_0x56f7('0x33'),_0x56f7('0x34')]);return squel[_0x56f7('0x2e')]()[_0x56f7('0x40')](_0x56f7('0x39'))['fromQuery'](_0x2d44d8,squel['select']()[_0x56f7('0x38')](_0x2d44d8)[_0x56f7('0x13')](_0x166f9c)[_0x56f7('0x15')]('('+_0x5929cf[_0x56f7('0x18')](',')+_0x56f7('0x52'),squel[_0x56f7('0x10')]()[_0x56f7('0x38')](_0x5929cf)['from'](_0x56f7('0x39'))[_0x56f7('0x15')](_0x56f7('0x45'),_0x4a8a65))[_0x56f7('0x15')](_0x56f7('0x53'),squel[_0x56f7('0x10')]()['field']('MIN(id)',_0x56f7('0x54'))[_0x56f7('0x13')](_0x166f9c)['group'](_0x5929cf[_0x56f7('0x18')](','))))[_0x56f7('0x55')]();}function handleStop(){logger['info'](_0x56f7('0x56'));stopped=!![];}function handleUncaughtException(_0x19df90){logger[_0x56f7('0x20')](_0x19df90[_0x56f7('0x57')]);process[_0x56f7('0x58')](0x1);}function handleError(_0x1a5e91,_0x2a2e08){stats[_0x56f7('0x59')]['push']({'name':_0x2a2e08[_0x56f7('0x5a')],'message':_0x2a2e08[_0x56f7('0x57')],'row':_0x1a5e91});}function handleQuery(_0x20c0b8){logger['info'](_0x20c0b8);return db[_0x56f7('0x19')]['query'](_0x20c0b8)[_0x56f7('0x1a')](function(_0x478e08){results[_0x56f7('0x1d')](_0x478e08);})[_0x56f7('0x1f')](function(_0x3818d6){logger[_0x56f7('0x20')](_0x3818d6['message']);});}function main(_0x3c7139,_0xdb8bce,_0x37da8b,_0x5aaa25){logger[_0x56f7('0x5b')](_0x56f7('0x5c'),_0x3c7139,JSON[_0x56f7('0x5d')](_0xdb8bce));process[_0x56f7('0x5e')]('start');var _0x23db44=_0xdb8bce[_0x56f7('0x5f')];var _0x45372a=_[_0x56f7('0x60')](_0x23db44);var _0x121c31=_0xdb8bce[_0x56f7('0x61')];var _0x24dcbc=path['join'](config[_0x56f7('0x62')],_0x56f7('0x63'),_0x121c31+_0x56f7('0x64'));logger['info'](_0x56f7('0x65'),_0xdb8bce);db[_0x56f7('0x66')][_0x56f7('0x67')]({'raw':!![],'attributes':['id',_0x56f7('0x68')]})[_0x56f7('0x25')](function(_0x139c4e){for(var _0x2dd6c3=0x0;_0x2dd6c3<_0x139c4e[_0x56f7('0x1b')];_0x2dd6c3++){if(_0x139c4e[_0x2dd6c3][_0x56f7('0x68')]in _0x23db44){contactItemTypes[_0x56f7('0x1d')](_0x139c4e[_0x2dd6c3]);delete _0x45372a[_0x139c4e[_0x2dd6c3]['name']];hasAdditionalPhones=!![];}for(var _0x2788d7 in _0x23db44){if(_0x139c4e[_0x2dd6c3][_0x56f7('0x68')]+_0x56f7('0x69')===_0x2788d7){phoneDescriptions[_0x56f7('0x1d')]({'itemTypeId':_0x139c4e[_0x2dd6c3]['id'],'description':_0x2788d7});delete _0x45372a[_0x2788d7];}}}if(hasAdditionalPhones)_0x45372a['AdditionalPhones']='';var _0xf269ed=_[_0x56f7('0x6a')](_0x45372a)[_0x56f7('0x18')]();logger[_0x56f7('0x5b')](_0x56f7('0x6b'),_0xf269ed);fs['writeFileSync'](_0x24dcbc,_0xf269ed+'\x0a');Papa[_0x56f7('0x6c')](fs[_0x56f7('0x6d')](_0x3c7139),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5b0abf,_0x330973){try{for(var _0x3d6e23=0x0,_0x223a1b=[];_0x3d6e23<_0x5b0abf[_0x56f7('0x6e')]['length'];_0x3d6e23++){stats[_0x56f7('0x6f')]+=0x1;if(_0x5b0abf[_0x56f7('0x59')][_0x3d6e23]){handleError(_0x5b0abf[_0x56f7('0x6e')][_0x3d6e23],_0x5b0abf['errors'][_0x3d6e23]);}else{var _0x525041=[];var _0x95e360=[];var _0x2ec701={};for(var _0x4b07ff in _0x23db44){let _0x1e71d3=contactItemTypes[_0x56f7('0x70')](_0x27a98f=>_0x27a98f[_0x56f7('0x68')]===_0x4b07ff);let _0x2ff2f2=contactItemTypes[_0x56f7('0x70')](_0x2f0f2e=>_0x2f0f2e[_0x56f7('0x68')]+'_description'===_0x4b07ff);if(_[_0x56f7('0x1c')](_0x1e71d3)&&_[_0x56f7('0x1c')](_0x2ff2f2)){if(_0x23db44['hasOwnProperty'](_0x4b07ff)){if(_0x5b0abf['data'][_0x3d6e23][_0x23db44[_0x4b07ff]]){var _0x33631a=_[_0x56f7('0x71')](_0x5b0abf[_0x56f7('0x6e')][_0x3d6e23][_0x23db44[_0x4b07ff]]['replace'](/"/g,'\x27'));switch(_0x4b07ff){case'scheduledat':var _0x47b62b=moment(_0x33631a,_0x56f7('0x72'),!![]);if(_0x47b62b['isValid']()){_0x223a1b['push']('\x22'+_0x33631a+'\x22');}else{_0x525041['push'](_0x56f7('0x73'));}break;case _0x56f7('0x35'):var _0x26b935=parseInt(_0x33631a);_0x33631a=_[_0x56f7('0x74')](_0x26b935)||_0x26b935<0x0||_0x26b935>0x4?_0x5aaa25?0x3:0x2:_0x26b935;_0x223a1b['push']('\x22'+_0x33631a+'\x22');break;case _0x56f7('0x36'):var _0x44c8c4=parseInt(_0x33631a);if(_[_0x56f7('0x75')](_0x44c8c4)&&_['includes'](_0x37da8b,_0x44c8c4)){_0x223a1b[_0x56f7('0x1d')]('\x22'+_0x44c8c4+'\x22');}else{_0x525041[_0x56f7('0x1d')](_0x56f7('0x76'));}break;case _0x56f7('0x77'):if(isEmail(_0x33631a)){_0x223a1b[_0x56f7('0x1d')]('\x22'+_0x33631a+'\x22');}else{_0x525041[_0x56f7('0x1d')](_0x56f7('0x78'));}break;case _0x56f7('0x79'):var _0x106302=moment(_0x33631a,'YYYY-MM-DD',!![]);if(_0x106302[_0x56f7('0x7a')]()){_0x223a1b[_0x56f7('0x1d')]('\x22'+_0x33631a+'\x22');}else{_0x525041['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x223a1b[_0x56f7('0x1d')]('\x22'+_0x33631a+'\x22');}}else{switch(_0x4b07ff){case'firstName':case _0x56f7('0x12'):_0x525041[_0x56f7('0x1d')](_0x4b07ff+_0x56f7('0x7b'));break;default:_0x223a1b['push']('\x22\x22');}}}}else{var _0x14bd22='';if(!_[_0x56f7('0x1c')](_0x1e71d3)){if(!_0x2ec701[_0x56f7('0x7c')](_0x1e71d3['id'])){for(var _0x59bbbf=0x0;_0x59bbbf<_0x23db44[_0x4b07ff][_0x56f7('0x1b')];_0x59bbbf++){var _0x33631a=_['trim'](_0x5b0abf[_0x56f7('0x6e')][_0x3d6e23][_0x23db44[_0x4b07ff][_0x59bbbf]]['replace'](/"/g,'\x27'));var _0x5df16d=phoneDescriptions[_0x56f7('0x70')](_0x287ba1=>_0x287ba1[_0x56f7('0x7d')]===_0x1e71d3['id']);if(!_[_0x56f7('0x1c')](_0x5df16d)){var _0x2dd3c6=_['trim'](_0x5b0abf[_0x56f7('0x6e')][_0x3d6e23][_0x23db44[_0x5df16d[_0x56f7('0x7e')]][0x0]][_0x56f7('0x7f')](/"/g,'\x27'));if(!_[_0x56f7('0x1c')](_0x2dd3c6))_0x33631a=_0x33631a+'§'+_0x2dd3c6;}if(_0x14bd22=='')_0x14bd22=_0x33631a;else _0x14bd22+='|'+_0x33631a;}_0x95e360['push'](_0x1e71d3['id']+':'+_0x14bd22);_0x2ec701[_0x1e71d3['id']]=0x1;}}}}if(hasAdditionalPhones){_0x223a1b['push']('\x22'+_0x95e360[_0x56f7('0x18')](';')+'\x22');}if(_0x525041[_0x56f7('0x1b')]){handleError(_0x5b0abf['data'][_0x3d6e23],{'code':_0x56f7('0x80'),'message':_0x525041[_0x56f7('0x18')]()});}else{fs[_0x56f7('0x81')](_0x24dcbc,_0x223a1b[_0x56f7('0x18')]()+'\x0a');}_0x223a1b=[];}if(!(stats[_0x56f7('0x6f')]%0xc8)){socket[_0x56f7('0x82')]('contact:import:'+_0x121c31,stats);stats[_0x56f7('0x59')]=[];}}if(stopped){logger['info'](_0x56f7('0x83'));_0x330973[_0x56f7('0x84')]();}}catch(_0x2d97cd){handleError(_0x5b0abf[_0x56f7('0x6e')][_0x3d6e23],{'code':_0x56f7('0x85'),'message':_0x2d97cd['message']});logger[_0x56f7('0x20')](_0x56f7('0x86'),_0x2d97cd[_0x56f7('0x57')]);}},'complete':function(){try{var _0x2e1e6b=[];var _0x15ef5e=tempTableName;_0x2e1e6b[_0x56f7('0x1d')](_0x56f7('0x87')+_0x15ef5e+_0x56f7('0x88'));logger['info'](_0x56f7('0x89'),contactItemTypes['length']);var _0x340dc6=util['format'](_0x56f7('0x8a'),_0x24dcbc,_0x15ef5e,_0xf269ed,_0xdb8bce[_0x56f7('0x32')],_0xdb8bce[_0x56f7('0x51')]||null,NOW,NOW);if(_[_0x56f7('0x1c')](_0x23db44[_0x56f7('0x31')])){_0x340dc6+=',\x20scheduledAt\x20=\x20NOW()';}_0x2e1e6b[_0x56f7('0x1d')](_0x340dc6);BPromise[_0x56f7('0x8b')](_0x2e1e6b,handleQuery)[_0x56f7('0x25')](function(_0x3b2b12){BPromise['all']([handleAdditionalPhones()])[_0x56f7('0x25')](function(){_0x2e1e6b=[];for(var _0x380bf6=0x0;_0x380bf6\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','groupBy','Setting','enableEmailPreview','all','clone','COUNT(*)','getSelectedTags','isEmpty','t.id\x20IN\x20?','Sequelize','lodash','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','../../mysqldb','role','agent','select','field','name','from','user_has_','_interactions','u.id','ui.','left_join'];(function(_0xa2c5be,_0x1db9a9){var _0x2de6ea=function(_0x22df13){while(--_0x22df13){_0xa2c5be['push'](_0xa2c5be['shift']());}};_0x2de6ea(++_0x1db9a9);}(_0x419c,0x1de));var _0xc419=function(_0xa7fb1f,_0x1c49bc){_0xa7fb1f=_0xa7fb1f-0x0;var _0x32e057=_0x419c[_0xa7fb1f];return _0x32e057;};'use strict';var _=require(_0xc419('0x0'));var squel=require(_0xc419('0x1'));var as=require(_0xc419('0x2'));var qs=require(_0xc419('0x3'));var updateInteraction=require('./update-interaction')[_0xc419('0x4')];var utils=require('./utils');var db=require(_0xc419('0x5'))['db'];function skipInteractionsQuery(_0x125ff0,_0x5a08e4,_0x32e47e){var _0x45adaa=![];var _0x2799ea=utils['getAccountFK'](_0x125ff0);if(_0x5a08e4[_0xc419('0x6')]===_0xc419('0x7')&&!_0x32e47e['search']&&!_0x32e47e[_0x2799ea]){_0x45adaa=!![];}return _0x45adaa;}function getTagsQuery(){return squel[_0xc419('0x8')]()[_0xc419('0x9')]('id')['field'](_0xc419('0xa'))[_0xc419('0x9')]('color')[_0xc419('0xb')]('tools_tags');}function getUsersQuery(_0x16219b,_0x250115){var _0x262dab=utils['getInteractionFK'](_0x16219b);var _0x21f0e7=_0xc419('0xc')+_0x16219b+_0xc419('0xd');var _0x26c3de=squel[_0xc419('0x8')]()['field'](_0xc419('0xe'))[_0xc419('0x9')]('u.fullname')[_0xc419('0x9')](_0xc419('0xf')+_0x262dab)[_0xc419('0xb')](_0x21f0e7,'ui')[_0xc419('0x10')]('users','u','u.id\x20=\x20ui.UserId');if(_0x250115[_0xc419('0x11')]>0x0){_0x26c3de[_0xc419('0x12')](_0xc419('0xf')+_0x262dab+_0xc419('0x13'),_[_0xc419('0x14')](_0x250115,'id'));}return _0x26c3de;}function getInteractionsQuery(_0x3f9617){var _0x544868=utils[_0xc419('0x15')](_0x3f9617);var _0x5be2a7=utils['getAccountFK'](_0x3f9617);var _0xbfadd4=utils[_0xc419('0x16')](_0x3f9617);return squel['select']()[_0xc419('0xb')](_0x544868[_0xc419('0x17')],'i')[_0xc419('0x10')](_0xc419('0x18'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc419('0x10')](_0xc419('0x19'),'o',_0xc419('0x1a'))[_0xc419('0x10')](_0x544868[_0xc419('0x1b')],'a',_0xc419('0x1c')+_0x5be2a7)[_0xc419('0x10')](_0x544868[_0xc419('0x1d')],'me',_0xc419('0x1e')+_0xbfadd4+'\x20=\x20i.id')[_0xc419('0x10')](_0x544868[_0xc419('0x1f')],'it','it.'+_0xbfadd4+_0xc419('0x20'))[_0xc419('0x10')](_0xc419('0x21'),'t',_0xc419('0x22'));}function getSqlClauses(){var _0x4ced7a={'body':squel['expr'](),'contact':squel['expr'](),'default':squel[_0xc419('0x23')](),'fields':squel[_0xc419('0x23')](),'filter':squel[_0xc419('0x23')](),'read':squel['expr'](),'tags':{'clause':squel[_0xc419('0x23')](),'ids':null},'user':squel[_0xc419('0x23')]()};return _0x4ced7a;}function parseTagParameter(_0x15db3e){var _0x4beeba=squel[_0xc419('0x23')]();if(_0x15db3e){var _0xc34607=utils['getSelectedTags'](_0x15db3e);_0xc34607[_0xc419('0x24')](function(_0x28a91e){_0x4beeba['or'](_0xc419('0x25'),'%,'+_0x28a91e+',%');});}return _0x4beeba;}function parseReadParameter(_0x2849e8){var _0x1e2097='';if(_0x2849e8){_0x1e2097=_0xc419('0x26');if(_0x2849e8==='1'){_0x1e2097=_0x1e2097[_0xc419('0x27')](_0xc419('0x28'),'=');}else{_0x1e2097=_0x1e2097[_0xc419('0x27')]('{OPERATOR}','>');}}return _0x1e2097;}function parseSearchFilter(_0x40a272,_0x5cfeca){var _0x162262=squel[_0xc419('0x23')]();if(_0x5cfeca){var _0x29517e=_0x5cfeca[_0xc419('0x27')]('\x5c','\x5c\x5c')[_0xc419('0x27')](/'/g,'\x27\x27');var _0x525f1a=qs[_0xc419('0x29')](_0x29517e);if(qs[_0xc419('0x2a')](_0x29517e)){_0x162262['or'](_0xc419('0x2b'),_0x525f1a+'%');if([_0xc419('0x2c'),'whatsapp']['includes'](_0x40a272)){_0x162262['or'](_0xc419('0x2d'),_0x525f1a+'%');}else if(_0x40a272===_0xc419('0x2e')){_0x162262['or'](_0xc419('0x2f'),_0x525f1a+'%');}else if(_0x40a272===_0xc419('0x30')){_0x162262['or'](_0xc419('0x31'),_0x525f1a+'%');}}else if(_0x40a272==='mail'&&qs[_0xc419('0x32')](_0x29517e)){_0x162262['or'](_0xc419('0x33'),_0x525f1a+'%');}else{if(_0x40a272===_0xc419('0x34')){_0x162262['or'](_0xc419('0x35'),qs[_0xc419('0x36')](_0x29517e,!![]))['or'](_0xc419('0x37'),qs[_0xc419('0x36')](_0x29517e));}else if(_0x40a272!==_0xc419('0x2e')){_0x162262['or'](_0xc419('0x38'),qs[_0xc419('0x36')](_0x29517e));}_0x162262['or'](_0xc419('0x39'),qs[_0xc419('0x36')](_0x29517e,!![]),null);}}return _0x162262;}function parseAdvancedSearchFilter(_0x5840e9,_0x19148f){var _0xc48204=getSqlClauses();var _0x17f36f=as[_0xc419('0x3a')](_0x5840e9);var _0x490dc1=_0x17f36f[_0xc419('0x3b')];for(var _0x1ed3fe=0x0;_0x1ed3fe<_0x17f36f['conditions'][_0xc419('0x11')];_0x1ed3fe++){var _0x2f72d7=_0x17f36f[_0xc419('0x3c')][_0x1ed3fe];var _0x200bd1='i';var _0x2f0d1c=_[_0xc419('0x3d')](_0x19148f,[_0xc419('0xa'),_0x2f72d7[_0xc419('0x9')]]);if(_0x2f0d1c){var _0x14d47a=as[_0xc419('0x3e')](_0x200bd1,_0x2f0d1c['type'],_0x2f72d7);_0xc48204[_0xc419('0x3f')][_0x490dc1](_0x14d47a['text'],_0x14d47a['value'][_0xc419('0x40')],_0x14d47a[_0xc419('0x41')][_0xc419('0x42')]);}else{switch(_0x2f72d7[_0xc419('0x9')]){case _0xc419('0x43'):var _0x39d333=parseReadParameter(_0x2f72d7[_0xc419('0x41')]);_0xc48204[_0xc419('0x44')][_0xc419('0x45')](_0x39d333);break;case _0xc419('0x46'):if(_0x2f72d7[_0xc419('0x47')]===_0xc419('0x48')){if(_0x2f72d7['value']['split']('\x20')[_0xc419('0x11')]>0x1){_0xc48204[_0xc419('0x49')][_0x490dc1](_0xc419('0x39'),qs['getFullTextValue'](_0x2f72d7[_0xc419('0x41')],!![]),null);}else{var _0xf49f2='%'+_0x2f72d7[_0xc419('0x41')]+'%';_0xc48204[_0xc419('0x49')][_0x490dc1](_0xc419('0x4a'),_0xf49f2,_0xf49f2,_0xf49f2);}}else{_0x2f0d1c=_['find'](_0x19148f,[_0xc419('0xa'),'ContactId']);_0x2f72d7[_0xc419('0x9')]=_0xc419('0x4b');_0x14d47a=as[_0xc419('0x3e')](_0x200bd1,_0x2f0d1c[_0xc419('0x4c')],_0x2f72d7);_0xc48204[_0xc419('0x49')][_0x490dc1](_0x14d47a[_0xc419('0x4d')],_0x14d47a[_0xc419('0x41')]['start'],_0x14d47a['value'][_0xc419('0x42')]);}break;case _0xc419('0x4e'):var _0x3540ac=_0x2f72d7['value'][_0xc419('0x4f')](',')[_0xc419('0x14')](function(_0x383c41){return Number(_0x383c41);});var _0x57196e=parseTagParameter(_0x3540ac);_0xc48204[_0xc419('0x50')][_0xc419('0x51')][_0xc419('0x45')](_0x57196e);_0xc48204[_0xc419('0x50')][_0xc419('0x52')]=_0x3540ac;break;case'User':if(_0x2f72d7[_0xc419('0x47')]===_0xc419('0x48')){_0xc48204[_0xc419('0x53')][_0x490dc1](_0xc419('0x54'),'%'+_0x2f72d7[_0xc419('0x41')]+'%',null);}else{_0x2f0d1c=_[_0xc419('0x3d')](_0x19148f,[_0xc419('0xa'),_0xc419('0x55')]);_0x2f72d7[_0xc419('0x9')]=_0xc419('0x55');_0x14d47a=as[_0xc419('0x3e')](_0x200bd1,_0x2f0d1c[_0xc419('0x4c')],_0x2f72d7);_0xc48204['user'][_0x490dc1](_0x14d47a[_0xc419('0x4d')],_0x14d47a['value'][_0xc419('0x40')],_0x14d47a[_0xc419('0x41')][_0xc419('0x42')]);}break;case'body':case _0xc419('0x56'):_0x14d47a=as[_0xc419('0x3e')]('me',null,_0x2f72d7);_0xc48204[_0xc419('0x57')][_0x490dc1](_0x14d47a[_0xc419('0x4d')],_0x14d47a[_0xc419('0x41')][_0xc419('0x40')],_0x14d47a[_0xc419('0x41')]['end']);break;}}}return _0xc48204;}function parseModelFields(_0x14dd43,_0xfeeb61,_0xdbe180){var _0x18d4c9=utils[_0xc419('0x58')](_0x14dd43);var _0x34a027=squel[_0xc419('0x23')]();var _0x35e868=_(_0xfeeb61)[_0xc419('0x59')]()[_0xc419('0x14')](function(_0x7506a7){return _[_0xc419('0x5a')](_0xdbe180,[_0xc419('0xa'),_0x7506a7])?_0x7506a7:undefined;})['compact']()[_0xc419('0x41')]();if(_0x35e868[_0xc419('0x11')]>0x0){_0x35e868['forEach'](function(_0x2dac7d){if(_0x2dac7d===_0x18d4c9){_0x34a027[_0xc419('0x45')]('i.'+_0x18d4c9+_0xc419('0x13'),[][_0xc419('0x5b')](_0xfeeb61[_0x2dac7d]));}else if(_0x2dac7d===_0xc419('0x5c')){var _0x131cb6=JSON[_0xc419('0x5d')](_0xfeeb61[_0x2dac7d])[_0xc419('0x5e')];var _0x287015=JSON[_0xc419('0x5d')](_0xfeeb61[_0x2dac7d])[_0xc419('0x5f')];_0x34a027['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x131cb6,_0x287015);}else{if(_0xfeeb61[_0x2dac7d]==='null'){_0x34a027[_0xc419('0x45')]('i.'+_0x2dac7d+_0xc419('0x60'));}else{_0x34a027['and']('i.'+_0x2dac7d+_0xc419('0x61'),_0xfeeb61[_0x2dac7d]);}}});}return _0x34a027;}function parseQueryParameters(_0x3bde67,_0x43d26d,_0x1bbcf0){var _0x46d365=getSqlClauses();return Promise['resolve']()[_0xc419('0x62')](function(){return parseModelFields(_0x3bde67,_0x43d26d,_0x1bbcf0);})[_0xc419('0x62')](function(_0x52fea0){_0x46d365['fields'][_0xc419('0x45')](_0x52fea0);return parseReadParameter(_0x43d26d[_0xc419('0x44')]);})[_0xc419('0x62')](function(_0x42b4d8){_0x46d365['read']['and'](_0x42b4d8);return parseTagParameter(_0x43d26d[_0xc419('0x63')]);})[_0xc419('0x62')](function(_0x39b377){_0x46d365[_0xc419('0x50')][_0xc419('0x51')][_0xc419('0x45')](_0x39b377);return parseSearchFilter(_0x3bde67,_0x43d26d[_0xc419('0x64')]);})['then'](function(_0x1230e6){_0x46d365[_0xc419('0x64')]=_0x1230e6;return _0x46d365;});}function checkAccountsRestrictions(_0xf904ca,_0x17ffd7,_0x1cebb5){var _0x4dd254=utils[_0xc419('0x58')](_0xf904ca);var _0x518481=_0xc419('0x65')+_[_0xc419('0x66')](_0xf904ca)+(_0xf904ca==='chat'?'Websites':'Accounts');var _0x568874=squel[_0xc419('0x23')]();return Promise['resolve']()[_0xc419('0x62')](function(){if(_0x1cebb5[_0xc419('0x67')]&&_0x17ffd7[_0xc419('0x6')]===_0xc419('0x7')){return _0x17ffd7[_0x518481]({'attributes':['id'],'raw':!![]});}})[_0xc419('0x62')](function(_0x5c5bbb){if(_0x5c5bbb){if(_0x5c5bbb[_0xc419('0x11')]===0x0){_0x568874['and']('i.'+_0x4dd254+'\x20IS\x20NULL');}else{_0x568874[_0xc419('0x45')]('i.'+_0x4dd254+_0xc419('0x13'),_[_0xc419('0x14')](_0x5c5bbb,'id'));}}else if(!_0x1cebb5[_0x4dd254]){_0x568874[_0xc419('0x45')]('i.'+_0x4dd254+_0xc419('0x68'));}})[_0xc419('0x62')](function(){return _0x568874;});}function getClosedOrderClause(_0x582545,_0x5a8c51){var _0x5a749a='';var _0x3aa737=['i.thirdDisposition',_0xc419('0x69'),_0xc419('0x6a')];if(_0x582545===_0xc419('0x34')){_0x3aa737['unshift']('i.substatus');}if(_0x5a8c51[_0xc419('0x6b')]==='0'&&_0x582545===_0xc419('0x34')){_0x5a749a='i.substatus';}else{if(_0x5a8c51['closed']==='1'){_0x3aa737['shift']();}_0x5a749a=_0xc419('0x6c')+_0x3aa737[_0xc419('0x6d')](',\x20')+')';}return _0x5a749a;}function getFilteredInteractions(_0x2c69ab,_0x2bb0b8,_0x178a76,_0x1d7744){var _0x2c4385=utils['getInteractionFK'](_0x2c69ab);var _0x187292=_[_0xc419('0x66')](_0x2c69ab)+_0xc419('0x6e');var _0x40c264=[];var _0x1fcda5=getTagsQuery();var _0x275a49={'type':db['Sequelize'][_0xc419('0x6f')][_0xc419('0x70')],'raw':!![]};var _0x1e0efb=[];var _0x17a7e1=[];return db[_0xc419('0x71')]['query'](_0x1fcda5[_0xc419('0x72')](),_0x275a49)[_0xc419('0x62')](function(_0x2eb225){_0x40c264=_['keyBy'](_0x2eb225,'id');_0x275a49=_[_0xc419('0x73')](_0x275a49,{'model':db[_0x187292],'mapToModel':!![],'nest':!![]});if(_0x178a76['fields']){_0x1d7744[_0xc419('0x74')]['forEach'](function(_0x4a1064){_0x2bb0b8[_0xc419('0x9')]('i.'+_0x4a1064);});}else{_0x2bb0b8[_0xc419('0x9')](_0xc419('0x75'),_0xc419('0x43'));_0x2bb0b8[_0xc419('0x9')](_0xc419('0x76'),_0xc419('0x77'));_0x2bb0b8[_0xc419('0x9')](_0xc419('0x78'),_0xc419('0x79'));if(_0x2c69ab===_0xc419('0x34')){_0x2bb0b8[_0xc419('0x9')](_0xc419('0x7a'),'Account.email');_0x2bb0b8[_0xc419('0x9')](_0xc419('0x7b'),_0xc419('0x7c'));_0x2bb0b8[_0xc419('0x9')]('i.id');_0x2bb0b8[_0xc419('0x9')]('i.createdAt');_0x2bb0b8['field'](_0xc419('0x7d'));_0x2bb0b8['field'](_0xc419('0x7e'));_0x2bb0b8[_0xc419('0x9')]('i.closedAt');_0x2bb0b8[_0xc419('0x9')](_0xc419('0x7f'));_0x2bb0b8[_0xc419('0x9')](_0xc419('0x80'));_0x2bb0b8[_0xc419('0x9')](_0xc419('0x81'));_0x2bb0b8['field']('i.subject');_0x2bb0b8[_0xc419('0x9')](_0xc419('0x6a'));_0x2bb0b8['field'](_0xc419('0x69'));_0x2bb0b8[_0xc419('0x9')](_0xc419('0x82'));_0x2bb0b8['field'](_0xc419('0x83'));_0x2bb0b8[_0xc419('0x9')](_0xc419('0x84'));_0x2bb0b8[_0xc419('0x9')](_0xc419('0x85'));_0x2bb0b8[_0xc419('0x9')](_0xc419('0x86'));_0x2bb0b8['field'](_0xc419('0x87'));}else if(_0x2c69ab===_0xc419('0x30')){_0x2bb0b8[_0xc419('0x9')](_0xc419('0x88'),_0xc419('0x7c'));}else{_0x2bb0b8[_0xc419('0x9')](_0xc419('0x89'),_0xc419('0x7c'));}if(_0x2c69ab!=='mail'){_0x2bb0b8['field']('i.*');}_0x2bb0b8[_0xc419('0x9')](_0xc419('0x8a'),_0xc419('0x8b'));_0x2bb0b8[_0xc419('0x9')](_0xc419('0x8c'),'Contact.lastName');_0x2bb0b8[_0xc419('0x9')](_0xc419('0x8d'),_0xc419('0x8e'));_0x2bb0b8[_0xc419('0x9')](_0xc419('0x8f'),'Contact.phone');_0x2bb0b8[_0xc419('0x9')]('c.mobile',_0xc419('0x90'));_0x2bb0b8['field'](_0xc419('0x91'),'Contact.fax');_0x2bb0b8[_0xc419('0x9')](_0xc419('0x92'),_0xc419('0x93'));_0x2bb0b8[_0xc419('0x9')](_0xc419('0x94'),_0xc419('0x95'));_0x2bb0b8[_0xc419('0x9')](_0xc419('0x96'),_0xc419('0x97'));}if(_0x1d7744[_0xc419('0x98')]){_0x2bb0b8[_0xc419('0x98')](_0x1d7744['limit']);}if(_0x1d7744['offset']){_0x2bb0b8[_0xc419('0x99')](_0x1d7744[_0xc419('0x99')]);}return db[_0xc419('0x71')][_0xc419('0x9a')](_0x2bb0b8[_0xc419('0x72')](),_0x275a49);})[_0xc419('0x62')](function(_0x1809f0){_0x1e0efb=_0x1809f0;var _0x3f2690=getUsersQuery(_0x2c69ab,_0x1e0efb);return db[_0xc419('0x71')][_0xc419('0x9a')](_0x3f2690['toString'](),_0x275a49);})[_0xc419('0x62')](function(_0x14400e){_0x17a7e1=_[_0xc419('0x9b')](_0x14400e,_0x2c4385);if(_0x2c69ab===_0xc419('0x34')){return db[_0xc419('0x9c')]['findOne']({'attributes':['enableEmailPreview'],'raw':!![]});}})['then'](function(_0x3c6b7d){var _0x2357b3=_0x3c6b7d?_0x3c6b7d[_0xc419('0x9d')]:undefined;var _0x311bc0=_0x1e0efb[_0xc419('0x14')](function(_0xc681aa){return updateInteraction(_0xc681aa,_0x40c264,_0x17a7e1,_0x2357b3);});return Promise[_0xc419('0x9e')](_0x311bc0);});}function countFilteredInteractions(_0x34506f,_0x36a77f){var _0xce052c=_0x34506f[_0xc419('0x9f')]();_0xce052c[_0xc419('0x9')](_0xc419('0xa0'));_0xce052c[_0xc419('0x9')](_0xc419('0x75'),_0xc419('0x43'));var _0x12dce0=utils[_0xc419('0xa1')](_0x36a77f);if(!_[_0xc419('0xa2')](_0x12dce0)){_0xce052c[_0xc419('0x12')](_0xc419('0xa3'),_0x12dce0);}var _0x30624a={'type':db[_0xc419('0xa4')][_0xc419('0x6f')]['SELECT'],'raw':!![]};return db[_0xc419('0x71')][_0xc419('0x9a')](_0xce052c[_0xc419('0x72')](),_0x30624a);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xfad9=['i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.to','i.ContactId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','enableEmailPreview','all','clone','COUNT(*)','isEmpty','exports','lodash','../parsers/advancedSearch','updateInteraction','./utils','getAccountFK','role','select','field','name','from','tools_tags','_interactions','u.id','u.fullname','ui.','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','getInteractionFK','interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','me.','interactionsTags','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','type','default','text','value','end','unreadMessages','read','and','Contact','operator','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','clause','tags','ids','User','$substring','user','UserId','body','plainBody','keys','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','resolve','then','fields','tag','filter','get','capitalize','chat','Websites','Accounts','agent','i.thirdDisposition','i.secondDisposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.closed'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfad9,0x174));var _0x9fad=function(_0x2d2258,_0x2ce510){_0x2d2258=_0x2d2258-0x0;var _0x18e155=_0xfad9[_0x2d2258];return _0x18e155;};'use strict';var _=require(_0x9fad('0x0'));var squel=require('squel');var as=require(_0x9fad('0x1'));var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')[_0x9fad('0x2')];var utils=require(_0x9fad('0x3'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x4eb718,_0x3fe8ff,_0x133043){var _0x320bcb=![];var _0x50f082=utils[_0x9fad('0x4')](_0x4eb718);if(_0x3fe8ff[_0x9fad('0x5')]==='agent'&&!_0x133043['search']&&!_0x133043[_0x50f082]){_0x320bcb=!![];}return _0x320bcb;}function getTagsQuery(){return squel[_0x9fad('0x6')]()[_0x9fad('0x7')]('id')[_0x9fad('0x7')](_0x9fad('0x8'))[_0x9fad('0x7')]('color')[_0x9fad('0x9')](_0x9fad('0xa'));}function getUsersQuery(_0x59d2ca,_0x39cd51){var _0x4f7dea=utils['getInteractionFK'](_0x59d2ca);var _0x5c8e33='user_has_'+_0x59d2ca+_0x9fad('0xb');var _0x1a974a=squel[_0x9fad('0x6')]()[_0x9fad('0x7')](_0x9fad('0xc'))['field'](_0x9fad('0xd'))[_0x9fad('0x7')](_0x9fad('0xe')+_0x4f7dea)[_0x9fad('0x9')](_0x5c8e33,'ui')['left_join'](_0x9fad('0xf'),'u',_0x9fad('0x10'));if(_0x39cd51[_0x9fad('0x11')]>0x0){_0x1a974a[_0x9fad('0x12')]('ui.'+_0x4f7dea+_0x9fad('0x13'),_[_0x9fad('0x14')](_0x39cd51,'id'));}return _0x1a974a;}function getInteractionsQuery(_0x4ad15d){var _0x43f1a1=utils[_0x9fad('0x15')](_0x4ad15d);var _0x4989fb=utils[_0x9fad('0x4')](_0x4ad15d);var _0x3f707f=utils[_0x9fad('0x16')](_0x4ad15d);return squel[_0x9fad('0x6')]()[_0x9fad('0x9')](_0x43f1a1[_0x9fad('0x17')],'i')[_0x9fad('0x18')](_0x9fad('0x19'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x9fad('0x18')](_0x9fad('0xf'),'o',_0x9fad('0x1a'))['left_join'](_0x43f1a1['accounts'],'a',_0x9fad('0x1b')+_0x4989fb)[_0x9fad('0x18')](_0x43f1a1[_0x9fad('0x1c')],'me',_0x9fad('0x1d')+_0x3f707f+'\x20=\x20i.id')[_0x9fad('0x18')](_0x43f1a1[_0x9fad('0x1e')],'it','it.'+_0x3f707f+_0x9fad('0x1f'))[_0x9fad('0x18')](_0x9fad('0xa'),'t',_0x9fad('0x20'));}function getSqlClauses(){var _0x340dd9={'body':squel['expr'](),'contact':squel[_0x9fad('0x21')](),'default':squel[_0x9fad('0x21')](),'fields':squel['expr'](),'filter':squel[_0x9fad('0x21')](),'read':squel[_0x9fad('0x21')](),'tags':{'clause':squel[_0x9fad('0x21')](),'ids':null},'user':squel['expr']()};return _0x340dd9;}function parseTagParameter(_0x1f2781){var _0x28c5c1=squel[_0x9fad('0x21')]();if(_0x1f2781){var _0x287687=utils[_0x9fad('0x22')](_0x1f2781);_0x287687[_0x9fad('0x23')](function(_0x270d76){_0x28c5c1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x270d76+',%');});}return _0x28c5c1;}function parseReadParameter(_0x62385a){var _0x2333b1='';if(_0x62385a){_0x2333b1='unreadMessages\x20{OPERATOR}\x200';if(_0x62385a==='1'){_0x2333b1=_0x2333b1[_0x9fad('0x24')](_0x9fad('0x25'),'=');}else{_0x2333b1=_0x2333b1[_0x9fad('0x24')]('{OPERATOR}','>');}}return _0x2333b1;}function parseSearchFilter(_0x5f0fd0,_0xacf40c){var _0x415c58=squel['expr']();if(_0xacf40c){var _0x16a41b=_0xacf40c[_0x9fad('0x24')]('\x5c','\x5c\x5c')[_0x9fad('0x24')](/'/g,'\x27\x27');var _0x20cb28=qs[_0x9fad('0x26')](_0x16a41b);if(qs[_0x9fad('0x27')](_0x16a41b)){_0x415c58['or'](_0x9fad('0x28'),_0x20cb28+'%');if(['sms','whatsapp'][_0x9fad('0x29')](_0x5f0fd0)){_0x415c58['or'](_0x9fad('0x2a'),_0x20cb28+'%');}else if(_0x5f0fd0===_0x9fad('0x2b')){_0x415c58['or'](_0x9fad('0x2c'),_0x20cb28+'%');}else if(_0x5f0fd0===_0x9fad('0x2d')){_0x415c58['or'](_0x9fad('0x2e'),_0x20cb28+'%');}}else if(_0x5f0fd0===_0x9fad('0x2f')&&qs[_0x9fad('0x30')](_0x16a41b)){_0x415c58['or'](_0x9fad('0x31'),_0x20cb28+'%');}else{if(_0x5f0fd0===_0x9fad('0x2f')){_0x415c58['or'](_0x9fad('0x32'),qs[_0x9fad('0x33')](_0x16a41b,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x16a41b));}else if(_0x5f0fd0!==_0x9fad('0x2b')){_0x415c58['or'](_0x9fad('0x34'),qs[_0x9fad('0x33')](_0x16a41b));}_0x415c58['or'](_0x9fad('0x35'),qs['getFullTextValue'](_0x16a41b,!![]),null);}}return _0x415c58;}function parseAdvancedSearchFilter(_0x4c991d,_0x5902f8){var _0x55469a=getSqlClauses();var _0x569fb9=as[_0x9fad('0x36')](_0x4c991d);var _0x192c3d=_0x569fb9[_0x9fad('0x37')];for(var _0xb8cf9=0x0;_0xb8cf9<_0x569fb9[_0x9fad('0x38')][_0x9fad('0x11')];_0xb8cf9++){var _0x45716b=_0x569fb9[_0x9fad('0x38')][_0xb8cf9];var _0x11a64b='i';var _0x27a89f=_[_0x9fad('0x39')](_0x5902f8,[_0x9fad('0x8'),_0x45716b[_0x9fad('0x7')]]);if(_0x27a89f){var _0x8bfda5=as[_0x9fad('0x3a')](_0x11a64b,_0x27a89f[_0x9fad('0x3b')],_0x45716b);_0x55469a[_0x9fad('0x3c')][_0x192c3d](_0x8bfda5[_0x9fad('0x3d')],_0x8bfda5[_0x9fad('0x3e')]['start'],_0x8bfda5[_0x9fad('0x3e')][_0x9fad('0x3f')]);}else{switch(_0x45716b[_0x9fad('0x7')]){case _0x9fad('0x40'):var _0x14a2ff=parseReadParameter(_0x45716b[_0x9fad('0x3e')]);_0x55469a[_0x9fad('0x41')][_0x9fad('0x42')](_0x14a2ff);break;case _0x9fad('0x43'):if(_0x45716b[_0x9fad('0x44')]==='$substring'){if(_0x45716b[_0x9fad('0x3e')]['split']('\x20')[_0x9fad('0x11')]>0x1){_0x55469a[_0x9fad('0x45')][_0x192c3d](_0x9fad('0x35'),qs[_0x9fad('0x33')](_0x45716b[_0x9fad('0x3e')],!![]),null);}else{var _0xe52356='%'+_0x45716b[_0x9fad('0x3e')]+'%';_0x55469a['contact'][_0x192c3d](_0x9fad('0x46'),_0xe52356,_0xe52356,_0xe52356);}}else{_0x27a89f=_[_0x9fad('0x39')](_0x5902f8,[_0x9fad('0x8'),_0x9fad('0x47')]);_0x45716b[_0x9fad('0x7')]='ContactId';_0x8bfda5=as['buildExpression'](_0x11a64b,_0x27a89f['type'],_0x45716b);_0x55469a['contact'][_0x192c3d](_0x8bfda5[_0x9fad('0x3d')],_0x8bfda5[_0x9fad('0x3e')][_0x9fad('0x48')],_0x8bfda5[_0x9fad('0x3e')]['end']);}break;case'Tag':var _0x1bc4ab=_0x45716b[_0x9fad('0x3e')]['split'](',')[_0x9fad('0x14')](function(_0x52745e){return Number(_0x52745e);});var _0x2dc545=parseTagParameter(_0x1bc4ab);_0x55469a['tags'][_0x9fad('0x49')]['and'](_0x2dc545);_0x55469a[_0x9fad('0x4a')][_0x9fad('0x4b')]=_0x1bc4ab;break;case _0x9fad('0x4c'):if(_0x45716b[_0x9fad('0x44')]===_0x9fad('0x4d')){_0x55469a[_0x9fad('0x4e')][_0x192c3d]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','%'+_0x45716b[_0x9fad('0x3e')]+'%',null);}else{_0x27a89f=_[_0x9fad('0x39')](_0x5902f8,[_0x9fad('0x8'),_0x9fad('0x4f')]);_0x45716b[_0x9fad('0x7')]=_0x9fad('0x4f');_0x8bfda5=as['buildExpression'](_0x11a64b,_0x27a89f['type'],_0x45716b);_0x55469a['user'][_0x192c3d](_0x8bfda5['text'],_0x8bfda5[_0x9fad('0x3e')][_0x9fad('0x48')],_0x8bfda5[_0x9fad('0x3e')]['end']);}break;case _0x9fad('0x50'):case _0x9fad('0x51'):_0x8bfda5=as[_0x9fad('0x3a')]('me',null,_0x45716b);_0x55469a[_0x9fad('0x50')][_0x192c3d](_0x8bfda5['text'],_0x8bfda5[_0x9fad('0x3e')]['start'],_0x8bfda5[_0x9fad('0x3e')][_0x9fad('0x3f')]);break;}}}return _0x55469a;}function parseModelFields(_0x462df9,_0x2e024a,_0x1949cd){var _0x428c8f=utils[_0x9fad('0x4')](_0x462df9);var _0x5948c3=squel[_0x9fad('0x21')]();var _0x3ba0fb=_(_0x2e024a)[_0x9fad('0x52')]()['map'](function(_0x5d8316){return _['some'](_0x1949cd,[_0x9fad('0x8'),_0x5d8316])?_0x5d8316:undefined;})[_0x9fad('0x53')]()[_0x9fad('0x3e')]();if(_0x3ba0fb['length']>0x0){_0x3ba0fb['forEach'](function(_0x18674f){if(_0x18674f===_0x428c8f){_0x5948c3[_0x9fad('0x42')]('i.'+_0x428c8f+_0x9fad('0x13'),[][_0x9fad('0x54')](_0x2e024a[_0x18674f]));}else if(_0x18674f===_0x9fad('0x55')){var _0x27b481=JSON[_0x9fad('0x56')](_0x2e024a[_0x18674f])[_0x9fad('0x57')];var _0x46230d=JSON[_0x9fad('0x56')](_0x2e024a[_0x18674f])[_0x9fad('0x58')];_0x5948c3[_0x9fad('0x42')](_0x9fad('0x59'),_0x27b481,_0x46230d);}else{if(_0x2e024a[_0x18674f]===_0x9fad('0x5a')){_0x5948c3[_0x9fad('0x42')]('i.'+_0x18674f+'\x20IS\x20NULL');}else{_0x5948c3[_0x9fad('0x42')]('i.'+_0x18674f+_0x9fad('0x5b'),_0x2e024a[_0x18674f]);}}});}return _0x5948c3;}function parseQueryParameters(_0x30694e,_0x7d69f0,_0x4add14){var _0x480db2=getSqlClauses();return Promise[_0x9fad('0x5c')]()[_0x9fad('0x5d')](function(){return parseModelFields(_0x30694e,_0x7d69f0,_0x4add14);})[_0x9fad('0x5d')](function(_0xec5a60){_0x480db2[_0x9fad('0x5e')]['and'](_0xec5a60);return parseReadParameter(_0x7d69f0[_0x9fad('0x41')]);})[_0x9fad('0x5d')](function(_0x1b7e33){_0x480db2['read'][_0x9fad('0x42')](_0x1b7e33);return parseTagParameter(_0x7d69f0[_0x9fad('0x5f')]);})[_0x9fad('0x5d')](function(_0x568e23){_0x480db2['tags'][_0x9fad('0x49')][_0x9fad('0x42')](_0x568e23);return parseSearchFilter(_0x30694e,_0x7d69f0[_0x9fad('0x60')]);})[_0x9fad('0x5d')](function(_0x3a5567){_0x480db2[_0x9fad('0x60')]=_0x3a5567;return _0x480db2;});}function checkAccountsRestrictions(_0x376349,_0x4e0805,_0x384bb0){var _0x2e4c1d=utils[_0x9fad('0x4')](_0x376349);var _0x2e84b7=_0x9fad('0x61')+_[_0x9fad('0x62')](_0x376349)+(_0x376349===_0x9fad('0x63')?_0x9fad('0x64'):_0x9fad('0x65'));var _0xafa8b1=squel['expr']();return Promise[_0x9fad('0x5c')]()[_0x9fad('0x5d')](function(){if(_0x384bb0['search']&&_0x4e0805[_0x9fad('0x5')]===_0x9fad('0x66')){return _0x4e0805[_0x2e84b7]({'attributes':['id'],'raw':!![]});}})[_0x9fad('0x5d')](function(_0x4c8f84){if(_0x4c8f84){if(_0x4c8f84[_0x9fad('0x11')]===0x0){_0xafa8b1[_0x9fad('0x42')]('i.'+_0x2e4c1d+'\x20IS\x20NULL');}else{_0xafa8b1['and']('i.'+_0x2e4c1d+_0x9fad('0x13'),_[_0x9fad('0x14')](_0x4c8f84,'id'));}}else if(!_0x384bb0[_0x2e4c1d]){_0xafa8b1[_0x9fad('0x42')]('i.'+_0x2e4c1d+'\x20IS\x20NOT\x20NULL');}})[_0x9fad('0x5d')](function(){return _0xafa8b1;});}function getClosedOrderClause(_0xf085b,_0x57bb00){var _0x128428='';var _0x51f4b9=[_0x9fad('0x67'),_0x9fad('0x68'),'i.disposition'];if(_0xf085b===_0x9fad('0x2f')){_0x51f4b9[_0x9fad('0x69')](_0x9fad('0x6a'));}if(_0x57bb00[_0x9fad('0x6b')]==='0'&&_0xf085b==='mail'){_0x128428='i.substatus';}else{if(_0x57bb00['closed']==='1'){_0x51f4b9[_0x9fad('0x6c')]();}_0x128428=_0x9fad('0x6d')+_0x51f4b9['join'](',\x20')+')';}return _0x128428;}function getFilteredInteractions(_0x24611b,_0x2d8e2c,_0x5b1f3e,_0x3cd70a){var _0x2027af=utils[_0x9fad('0x16')](_0x24611b);var _0x49ebc7=_[_0x9fad('0x62')](_0x24611b)+_0x9fad('0x6e');var _0x319457=[];var _0x45b969=getTagsQuery();var _0x6acb8={'type':db[_0x9fad('0x6f')][_0x9fad('0x70')][_0x9fad('0x71')],'raw':!![]};var _0x2dcea6=[];var _0x40e1e2=[];return db[_0x9fad('0x72')][_0x9fad('0x73')](_0x45b969[_0x9fad('0x74')](),_0x6acb8)[_0x9fad('0x5d')](function(_0x5c4905){_0x319457=_[_0x9fad('0x75')](_0x5c4905,'id');_0x6acb8=_[_0x9fad('0x76')](_0x6acb8,{'model':db[_0x49ebc7],'mapToModel':!![],'nest':!![]});if(_0x5b1f3e[_0x9fad('0x5e')]){_0x3cd70a[_0x9fad('0x77')][_0x9fad('0x23')](function(_0x3c5d3e){_0x2d8e2c['field']('i.'+_0x3c5d3e);});}else{_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x78'),_0x9fad('0x40'));_0x2d8e2c[_0x9fad('0x7')]('a.key',_0x9fad('0x79'));_0x2d8e2c['field'](_0x9fad('0x7a'),_0x9fad('0x7b'));if(_0x24611b===_0x9fad('0x2f')){_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x7c'),_0x9fad('0x7d'));_0x2d8e2c['field'](_0x9fad('0x7e'),'contactName');_0x2d8e2c[_0x9fad('0x7')]('i.id');_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x7f'));_0x2d8e2c[_0x9fad('0x7')]('i.updatedAt');_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x80'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x81'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x82'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x83'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x84'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x85'));_0x2d8e2c['field'](_0x9fad('0x86'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x68'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x67'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x6a'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x87'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x88'));_0x2d8e2c[_0x9fad('0x7')]('i.MailAccountId');_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x89'));}else if(_0x24611b===_0x9fad('0x2d')){_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x8a'),_0x9fad('0x8b'));}else{_0x2d8e2c['field'](_0x9fad('0x8c'),_0x9fad('0x8b'));}if(_0x24611b!=='mail'){_0x2d8e2c[_0x9fad('0x7')]('i.*');}_0x2d8e2c['field'](_0x9fad('0x8d'),_0x9fad('0x8e'));_0x2d8e2c['field'](_0x9fad('0x8f'),_0x9fad('0x90'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x91'),_0x9fad('0x92'));_0x2d8e2c[_0x9fad('0x7')]('c.phone',_0x9fad('0x93'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x94'),'Contact.mobile');_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x95'),_0x9fad('0x96'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x97'),_0x9fad('0x98'));_0x2d8e2c[_0x9fad('0x7')](_0x9fad('0x99'),_0x9fad('0x9a'));_0x2d8e2c['field'](_0x9fad('0x9b'),_0x9fad('0x9c'));}if(_0x3cd70a[_0x9fad('0x9d')]){_0x2d8e2c[_0x9fad('0x9d')](_0x3cd70a['limit']);}if(_0x3cd70a[_0x9fad('0x9e')]){_0x2d8e2c[_0x9fad('0x9e')](_0x3cd70a[_0x9fad('0x9e')]);}return db[_0x9fad('0x72')][_0x9fad('0x73')](_0x2d8e2c[_0x9fad('0x74')](),_0x6acb8);})[_0x9fad('0x5d')](function(_0x103ed9){_0x2dcea6=_0x103ed9;var _0x1afc83=getUsersQuery(_0x24611b,_0x2dcea6);return db['sequelize']['query'](_0x1afc83[_0x9fad('0x74')](),_0x6acb8);})[_0x9fad('0x5d')](function(_0x1c76fa){_0x40e1e2=_[_0x9fad('0x9f')](_0x1c76fa,_0x2027af);if(_0x24611b===_0x9fad('0x2f')){return db[_0x9fad('0xa0')]['findOne']({'attributes':[_0x9fad('0xa1')],'raw':!![]});}})['then'](function(_0x34d334){var _0x4f5911=_0x34d334?_0x34d334[_0x9fad('0xa1')]:undefined;var _0x257edf=_0x2dcea6[_0x9fad('0x14')](function(_0x1748db){return updateInteraction(_0x1748db,_0x319457,_0x40e1e2,_0x4f5911);});return Promise[_0x9fad('0xa2')](_0x257edf);});}function countFilteredInteractions(_0x319c12,_0x48e5fd){var _0x39a0e2=_0x319c12[_0x9fad('0xa3')]();_0x39a0e2['field'](_0x9fad('0xa4'));_0x39a0e2[_0x9fad('0x7')](_0x9fad('0x78'),_0x9fad('0x40'));var _0x599499=utils[_0x9fad('0x22')](_0x48e5fd);if(!_[_0x9fad('0xa5')](_0x599499)){_0x39a0e2[_0x9fad('0x12')]('t.id\x20IN\x20?',_0x599499);}var _0x25d607={'type':db[_0x9fad('0x6f')][_0x9fad('0x70')][_0x9fad('0x71')],'raw':!![]};return db[_0x9fad('0x72')]['query'](_0x39a0e2[_0x9fad('0x74')](),_0x25d607);}module[_0x9fad('0xa6')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 0b7b543..7fe072c 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6136=['lastMsgText','trimStart','updateInteraction','then','Users','TagIds','Tags','catch','lodash','../../mysqldb','map','fullname','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','disposition','UserId','MailMessage','findOne','out','plainBody'];(function(_0x548904,_0x41112c){var _0x3f599d=function(_0x57d89b){while(--_0x57d89b){_0x548904['push'](_0x548904['shift']());}};_0x3f599d(++_0x41112c);}(_0x6136,0x14c));var _0x6613=function(_0x52033d,_0x441b98){_0x52033d=_0x52033d-0x0;var _0x452599=_0x6136[_0x52033d];return _0x452599;};'use strict';var _=require(_0x6613('0x0'));var db=require(_0x6613('0x1'))['db'];function getInteractionUsers(_0xd5784f,_0x465be7){return new Promise(function(_0x13bc8f,_0x160211){try{var _0x17000f=[];if(_0x465be7[_0xd5784f]){_0x17000f=_0x465be7[_0xd5784f][_0x6613('0x2')](function(_0x144414){return{'id':_0x144414['id'],'fullname':_0x144414[_0x6613('0x3')]};});}return _0x13bc8f(_0x17000f);}catch(_0x2c3823){_0x160211(_0x2c3823);}});}function getInteractionTags(_0xa48cde,_0x1a4205){var _0x26ad07=[];if(_0xa48cde){_0xa48cde[_0x6613('0x4')](',')[_0x6613('0x5')](function(_0x220f6d){_0x26ad07[_0x6613('0x6')](_0x1a4205[_0x220f6d]);});}return _0x26ad07;}function updateWaitingCounter(_0xb2af85){if(_0xb2af85[_0x6613('0x7')]){_0xb2af85[_0x6613('0x7')]-=0x1;}}function updateInteractionCounters(_0x4d2625){_0x4d2625[_0x6613('0x7')]=0x0;_0x4d2625[_0x6613('0x8')]=0x0;_0x4d2625[_0x6613('0x9')]=0x0;_0x4d2625[_0x6613('0xa')]=0x0;_0x4d2625[_0x6613('0xb')]=0x0;_0x4d2625[_0x6613('0xc')]=0x0;if(_0x4d2625['closed']){if(_0x4d2625[_0x6613('0xd')]===_0x6613('0xb')){_0x4d2625[_0x6613('0xb')]+=0x1;updateWaitingCounter(_0x4d2625);}if(_0x4d2625[_0x6613('0xe')]){_0x4d2625[_0x6613('0x9')]+=0x1;if(_0x4d2625[_0x6613('0x8')]){_0x4d2625[_0x6613('0x8')]-=0x1;}}else{if(_0x4d2625[_0x6613('0xd')]){_0x4d2625['unmanaged']+=0x1;updateWaitingCounter(_0x4d2625);}}}else{if(!_0x4d2625[_0x6613('0xe')]){_0x4d2625[_0x6613('0x7')]+=0x1;}if(_0x4d2625[_0x6613('0xe')]){_0x4d2625['talking']+=0x1;updateWaitingCounter(_0x4d2625);}}_0x4d2625['total']+=0x1;return _0x4d2625;}function getLastMessageText(_0x553f8f){return db[_0x6613('0xf')][_0x6613('0x10')]({'where':{'$and':[{'MailInteractionId':_0x553f8f['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x6613('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})['then'](function(_0x2075bb){if(_0x2075bb&&_0x2075bb[_0x6613('0x12')]){_0x553f8f[_0x6613('0x13')]=_[_0x6613('0x14')](_0x2075bb[_0x6613('0x12')]);}return _0x553f8f;})['catch'](function(_0x215c4a){throw _0x215c4a;});}exports[_0x6613('0x15')]=function(_0xad1927,_0x349513,_0x19349f,_0x5cf897){return new Promise(function(_0x247176,_0x37b719){return getInteractionUsers(_0xad1927['id'],_0x19349f)[_0x6613('0x16')](function(_0x58357c){_0xad1927[_0x6613('0x17')]=_0x58357c;return getInteractionTags(_0xad1927[_0x6613('0x18')],_0x349513);})[_0x6613('0x16')](function(_0x523fe5){_0xad1927[_0x6613('0x19')]=_0x523fe5;delete _0xad1927[_0x6613('0x18')];return updateInteractionCounters(_0xad1927);})['then'](function(_0x20b2b8){if(_0x5cf897){return getLastMessageText(_0x20b2b8);}else{return _0x20b2b8;}})[_0x6613('0x16')](function(_0x3c7a53){_0x247176(_0x3c7a53);})[_0x6613('0x1a')](function(_0x1e35fd){_0x37b719(_0x1e35fd);});});}; \ No newline at end of file +var _0x221e=['UserId','talking','MailMessage','findOne','out','plainBody','-id','then','trimStart','catch','Users','TagIds','lodash','../../mysqldb','map','split','forEach','push','waiting','answered','unmanaged','total','closed','disposition','abandoned'];(function(_0x16806a,_0x1b2325){var _0x3b6d5c=function(_0x194525){while(--_0x194525){_0x16806a['push'](_0x16806a['shift']());}};_0x3b6d5c(++_0x1b2325);}(_0x221e,0x89));var _0xe221=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x221e[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xe221('0x0'));var db=require(_0xe221('0x1'))['db'];function getInteractionUsers(_0x4355ce,_0x2be4a1){return new Promise(function(_0x419c8e,_0x2d852e){try{var _0x31224f=[];if(_0x2be4a1[_0x4355ce]){_0x31224f=_0x2be4a1[_0x4355ce][_0xe221('0x2')](function(_0x11f753){return{'id':_0x11f753['id'],'fullname':_0x11f753['fullname']};});}return _0x419c8e(_0x31224f);}catch(_0x25c961){_0x2d852e(_0x25c961);}});}function getInteractionTags(_0x1f38d5,_0x1bf887){var _0x565b2c=[];if(_0x1f38d5){_0x1f38d5[_0xe221('0x3')](',')[_0xe221('0x4')](function(_0x1577c9){_0x565b2c[_0xe221('0x5')](_0x1bf887[_0x1577c9]);});}return _0x565b2c;}function updateWaitingCounter(_0x5cb030){if(_0x5cb030[_0xe221('0x6')]){_0x5cb030[_0xe221('0x6')]-=0x1;}}function updateInteractionCounters(_0x1f0870){_0x1f0870[_0xe221('0x6')]=0x0;_0x1f0870['talking']=0x0;_0x1f0870[_0xe221('0x7')]=0x0;_0x1f0870[_0xe221('0x8')]=0x0;_0x1f0870['abandoned']=0x0;_0x1f0870[_0xe221('0x9')]=0x0;if(_0x1f0870[_0xe221('0xa')]){if(_0x1f0870[_0xe221('0xb')]===_0xe221('0xc')){_0x1f0870[_0xe221('0xc')]+=0x1;updateWaitingCounter(_0x1f0870);}if(_0x1f0870[_0xe221('0xd')]){_0x1f0870[_0xe221('0x7')]+=0x1;if(_0x1f0870['talking']){_0x1f0870[_0xe221('0xe')]-=0x1;}}else{if(_0x1f0870[_0xe221('0xb')]){_0x1f0870[_0xe221('0x8')]+=0x1;updateWaitingCounter(_0x1f0870);}}}else{if(!_0x1f0870['UserId']){_0x1f0870[_0xe221('0x6')]+=0x1;}if(_0x1f0870[_0xe221('0xd')]){_0x1f0870[_0xe221('0xe')]+=0x1;updateWaitingCounter(_0x1f0870);}}_0x1f0870[_0xe221('0x9')]+=0x1;return _0x1f0870;}function getLastMessageText(_0x3f9104){return db[_0xe221('0xf')][_0xe221('0x10')]({'where':{'$and':[{'MailInteractionId':_0x3f9104['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xe221('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xe221('0x12')],'order':_0xe221('0x13'),'raw':!![]})[_0xe221('0x14')](function(_0x7f2ea){if(_0x7f2ea&&_0x7f2ea[_0xe221('0x12')]){_0x3f9104['lastMsgText']=_[_0xe221('0x15')](_0x7f2ea['plainBody']);}return _0x3f9104;})[_0xe221('0x16')](function(_0x55889f){throw _0x55889f;});}exports['updateInteraction']=function(_0x28a454,_0x42edb7,_0x4620a4,_0x912ea0){return new Promise(function(_0x194dfa,_0x20f24a){return getInteractionUsers(_0x28a454['id'],_0x4620a4)[_0xe221('0x14')](function(_0x1a645f){_0x28a454[_0xe221('0x17')]=_0x1a645f;return getInteractionTags(_0x28a454['TagIds'],_0x42edb7);})[_0xe221('0x14')](function(_0x21cb1e){_0x28a454['Tags']=_0x21cb1e;delete _0x28a454[_0xe221('0x18')];return updateInteractionCounters(_0x28a454);})[_0xe221('0x14')](function(_0xe9be5b){if(_0x912ea0){return getLastMessageText(_0xe9be5b);}else{return _0xe9be5b;}})[_0xe221('0x14')](function(_0x1bf2da){_0x194dfa(_0x1bf2da);})[_0xe221('0x16')](function(_0x588ab0){_0x20f24a(_0x588ab0);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index c368227..fa35212 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb69d=['InteractionId','upperFirst','unknown','chat','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','Interaction','then','update','info','catch','stringify','MESSAGE:ACCEPT]\x20id=','\x20role=','\x20body=','exports','lodash','../../mysqldb','../../config/logger','mail-interactions','sms-interactions','whatsapp-interactions','capitalize','Website','Account'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb69d,0xcf));var _0xdb69=function(_0x12699e,_0x22c8c4){_0x12699e=_0x12699e-0x0;var _0x43f75e=_0xb69d[_0x12699e];return _0x43f75e;};'use strict';var _=require(_0xdb69('0x0'));var db=require(_0xdb69('0x1'))['db'];var loggers={'openchannel':require(_0xdb69('0x2'))('openchannel-interactions'),'mail':require(_0xdb69('0x2'))(_0xdb69('0x3')),'fax':require(_0xdb69('0x2'))('fax-interactions'),'sms':require('../../config/logger')(_0xdb69('0x4')),'chat':require(_0xdb69('0x2'))('chat-interactions'),'whatsapp':require(_0xdb69('0x2'))(_0xdb69('0x5'))};function getAccountFK(_0x5a5aec){return _[_0xdb69('0x6')](_0x5a5aec)+(_0x5a5aec==='chat'?_0xdb69('0x7'):_0xdb69('0x8'))+'Id';}function getInteractionFK(_0x2415d7){return _[_0xdb69('0x6')](_0x2415d7)+_0xdb69('0x9');}function getInteractionId(_0x4b63ea,_0x45744d,_0x2035b8){if(_0x4b63ea&&_0x4b63ea[_[_0xdb69('0xa')](_0x2035b8)+'InteractionId']){return _0x4b63ea[_['upperFirst'](_0x2035b8)+_0xdb69('0x9')];}else if(_0x4b63ea&&_0x4b63ea['id']){return _0x4b63ea['id'];}else if(_0x45744d&&_0x45744d['id']){return _0x45744d['id'];}else{return _0xdb69('0xb');}}function getInteractionsTables(_0x6a75e3){return{'accounts':_0x6a75e3+'_'+(_0x6a75e3===_0xdb69('0xc')?_0xdb69('0xd'):_0xdb69('0xe')),'interactions':_0x6a75e3+_0xdb69('0xf'),'interactionsTags':_0x6a75e3+_0xdb69('0x10'),'messages':_0x6a75e3+_0xdb69('0x11'),'userInteractions':_0xdb69('0x12')+_0x6a75e3+_0xdb69('0xf')};}function getSelectedTags(_0x59dd14){var _0x4b2356=[];if(_0x59dd14){_0x4b2356=Array[_0xdb69('0x13')](_0x59dd14)?_0x59dd14:[_0x59dd14];}return _0x4b2356;}function log(_0xac5214,_0x547b6e,_0x13055b,_0x2ab733,_0x3d3370,_0x462baf){loggers[_0x3d3370[_0xdb69('0x14')]()][_0xac5214](_0xdb69('0x15'),_0x462baf[_0xdb69('0x16')](),_0x547b6e?_0x547b6e['id']:null,_0x547b6e?_0x547b6e[_0xdb69('0x17')]:null,_0x547b6e?_0x547b6e[_0xdb69('0x18')]:null,getInteractionId(_0x13055b,_0x2ab733,_0x3d3370),_0x13055b?JSON['stringify'](_0x13055b):_0xdb69('0x19'));}function updateUser(_0x4951f2,_0x4ddc41,_0x170a9f,_0x52f487,_0x23b285){db[_[_0xdb69('0xa')](_0x52f487)+_0xdb69('0x1a')]['findOne']({'where':{'id':getInteractionId(_0x4ddc41,_0x170a9f,_0x52f487)}})[_0xdb69('0x1b')](function(_0x34c86a){if(_0x34c86a){return _0x34c86a[_0xdb69('0x1c')]({'UserId':_0x4951f2?_0x4951f2['id']:null});}})['then'](function(_0x33d93e){if(_0x33d93e){log(_0xdb69('0x1d'),_0x4951f2,_0x4ddc41,_0x170a9f,_0x52f487,_0x23b285);}})[_0xdb69('0x1e')](function(){log('error',_0x4951f2,_0x4ddc41,_0x170a9f,_0x52f487,_0x23b285);});}function logAcceptMessage(_0x324fa2,_0x454340,_0x5b1cc0,_0x95109f){var _0x180301=loggers[_0x324fa2[_0xdb69('0x14')]()];var _0x248507=_0x454340['id'];var _0x4dc1f1=_0x454340['name'];var _0x43fa5c=_0x454340[_0xdb69('0x18')];var _0x2722c5=JSON[_0xdb69('0x1f')](_0x95109f||null);_0x180301['info']('['+_0x324fa2[_0xdb69('0x16')]()+_0xdb69('0x20')+_0x248507+'\x20name='+_0x4dc1f1+_0xdb69('0x21')+_0x43fa5c+'\x20interaction='+_0x5b1cc0+_0xdb69('0x22')+_0x2722c5);}module[_0xdb69('0x23')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file +var _0x7acb=['role','null','Interaction','then','update','info','catch','error','toLowerCase','stringify','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20body=','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','whatsapp-interactions','capitalize','chat','Website','Account','upperFirst','InteractionId','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name'];(function(_0x2d3abc,_0x2a0d9e){var _0xc16f0=function(_0x27733){while(--_0x27733){_0x2d3abc['push'](_0x2d3abc['shift']());}};_0xc16f0(++_0x2a0d9e);}(_0x7acb,0x95));var _0xb7ac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7acb[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var db=require(_0xb7ac('0x0'))['db'];var loggers={'openchannel':require(_0xb7ac('0x1'))('openchannel-interactions'),'mail':require(_0xb7ac('0x1'))(_0xb7ac('0x2')),'fax':require(_0xb7ac('0x1'))(_0xb7ac('0x3')),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0xb7ac('0x1'))('chat-interactions'),'whatsapp':require(_0xb7ac('0x1'))(_0xb7ac('0x4'))};function getAccountFK(_0x381523){return _[_0xb7ac('0x5')](_0x381523)+(_0x381523===_0xb7ac('0x6')?_0xb7ac('0x7'):_0xb7ac('0x8'))+'Id';}function getInteractionFK(_0x1f2768){return _[_0xb7ac('0x5')](_0x1f2768)+'InteractionId';}function getInteractionId(_0x1e0482,_0x1202c0,_0x4a11e5){if(_0x1e0482&&_0x1e0482[_[_0xb7ac('0x9')](_0x4a11e5)+_0xb7ac('0xa')]){return _0x1e0482[_['upperFirst'](_0x4a11e5)+_0xb7ac('0xa')];}else if(_0x1e0482&&_0x1e0482['id']){return _0x1e0482['id'];}else if(_0x1202c0&&_0x1202c0['id']){return _0x1202c0['id'];}else{return'unknown';}}function getInteractionsTables(_0x2731c5){return{'accounts':_0x2731c5+'_'+(_0x2731c5===_0xb7ac('0x6')?_0xb7ac('0xb'):_0xb7ac('0xc')),'interactions':_0x2731c5+_0xb7ac('0xd'),'interactionsTags':_0x2731c5+_0xb7ac('0xe'),'messages':_0x2731c5+_0xb7ac('0xf'),'userInteractions':_0xb7ac('0x10')+_0x2731c5+_0xb7ac('0xd')};}function getSelectedTags(_0x1c09bc){var _0x8500da=[];if(_0x1c09bc){_0x8500da=Array[_0xb7ac('0x11')](_0x1c09bc)?_0x1c09bc:[_0x1c09bc];}return _0x8500da;}function log(_0x5a9352,_0x3c42e1,_0xa1b390,_0x2824c2,_0x1df927,_0x20179d){loggers[_0x1df927['toLowerCase']()][_0x5a9352](_0xb7ac('0x12'),_0x20179d[_0xb7ac('0x13')](),_0x3c42e1?_0x3c42e1['id']:null,_0x3c42e1?_0x3c42e1[_0xb7ac('0x14')]:null,_0x3c42e1?_0x3c42e1[_0xb7ac('0x15')]:null,getInteractionId(_0xa1b390,_0x2824c2,_0x1df927),_0xa1b390?JSON['stringify'](_0xa1b390):_0xb7ac('0x16'));}function updateUser(_0x15841a,_0x305ba2,_0xf2d3cf,_0x2859a8,_0xcd1cf4){db[_[_0xb7ac('0x9')](_0x2859a8)+_0xb7ac('0x17')]['findOne']({'where':{'id':getInteractionId(_0x305ba2,_0xf2d3cf,_0x2859a8)}})[_0xb7ac('0x18')](function(_0x2edf89){if(_0x2edf89){return _0x2edf89[_0xb7ac('0x19')]({'UserId':_0x15841a?_0x15841a['id']:null});}})[_0xb7ac('0x18')](function(_0x4c3ce2){if(_0x4c3ce2){log(_0xb7ac('0x1a'),_0x15841a,_0x305ba2,_0xf2d3cf,_0x2859a8,_0xcd1cf4);}})[_0xb7ac('0x1b')](function(){log(_0xb7ac('0x1c'),_0x15841a,_0x305ba2,_0xf2d3cf,_0x2859a8,_0xcd1cf4);});}function logAcceptMessage(_0x2e4c42,_0x18f91e,_0x39b607,_0x2cac8c){var _0x2d04c8=loggers[_0x2e4c42[_0xb7ac('0x1d')]()];var _0xac3310=_0x18f91e['id'];var _0x25d4a3=_0x18f91e['name'];var _0x3b43f6=_0x18f91e['role'];var _0x269762=JSON[_0xb7ac('0x1e')](_0x2cac8c||null);_0x2d04c8['info']('['+_0x2e4c42['toUpperCase']()+_0xb7ac('0x1f')+_0xac3310+_0xb7ac('0x20')+_0x25d4a3+'\x20role='+_0x3b43f6+'\x20interaction='+_0x39b607+_0xb7ac('0x21')+_0x269762);}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 8a660a6..bb29d5d 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 _0x0ae5=['findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','update','base64','utf8','final','parse','use','License'];(function(_0x54af6d,_0x4e7706){var _0x417c20=function(_0x111ca1){while(--_0x111ca1){_0x54af6d['push'](_0x54af6d['shift']());}};_0x417c20(++_0x4e7706);}(_0x0ae5,0x1f0));var _0x50ae=function(_0x3fcc9b,_0x102a6a){_0x3fcc9b=_0x3fcc9b-0x0;var _0x1749b6=_0x0ae5[_0x3fcc9b];return _0x1749b6;};'use strict';var crypto=require('crypto');var util=require(_0x50ae('0x0'));var compose=require(_0x50ae('0x1'));var db=require(_0x50ae('0x2'))['db'];var config=require(_0x50ae('0x3'));function getValueFromLicense(_0x16e8df,_0x2315d4){if(_0x16e8df&&_0x2315d4){if(_0x2315d4[_0x50ae('0x4')]&&_0x2315d4['license']){var _0x2fcb6b=_0x2315d4[_0x50ae('0x4')];var _0x1308f0=_0x2315d4[_0x50ae('0x5')];var _0x183fde=_0x2fcb6b[_0x50ae('0x6')]('-')[0x4];var _0x12a1e2=_0x2fcb6b['split']('-')[0x0];var _0x2b71ce=crypto[_0x50ae('0x7')](_0x50ae('0x8'),util[_0x50ae('0x9')]('%s:%s:%s',_0x183fde,_0x2fcb6b,_0x12a1e2));var _0x3d2c79=_0x2b71ce[_0x50ae('0xa')](_0x1308f0,_0x50ae('0xb'),_0x50ae('0xc'));_0x3d2c79+=_0x2b71ce[_0x50ae('0xd')]('utf8');var _0x22cd12=JSON[_0x50ae('0xe')](_0x3d2c79);return _0x22cd12['hasOwnProperty'](_0x16e8df)?_0x22cd12[_0x16e8df]:null;}}return null;}function isLimit(_0x52efe2,_0x44c479,_0x231dd1,_0x373512){var _0x5cf1ce=_0x44c479;return compose()[_0x50ae('0xf')](function(_0x1d7bc9,_0x598d9e,_0x1ef383){return db[_0x50ae('0x10')][_0x50ae('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x1f0223){var _0x3b6d8c=getValueFromLicense(_0x52efe2,_0x1f0223);return _0x3b6d8c?_0x3b6d8c:_0x5cf1ce;})['then'](function(_0x243b49){_0x5cf1ce=_0x243b49;return _0x231dd1['count'](_0x373512);})[_0x50ae('0x12')](function(_0x564642){if(_0x564642>=_0x5cf1ce){return _0x598d9e[_0x50ae('0x13')](0x193)[_0x50ae('0x14')]({'message':util['format'](_0x50ae('0x15'),_0x52efe2)});}_0x1ef383();})[_0x50ae('0x16')](function(_0x479423){_0x1ef383(_0x479423);});});}function isUserLimit(){return isLimit(_0x50ae('0x17'),0x1,db[_0x50ae('0x18')],{'where':{'$or':[{'role':'admin'},{'role':_0x50ae('0x19')}]}});}exports[_0x50ae('0x1a')]=isUserLimit; \ No newline at end of file +var _0xd6a2=['admin','isUserLimit','crypto','util','../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','update','base64','utf8','final','hasOwnProperty','License','findOne','then','count','status','json','format','users','User'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd6a2,0x115));var _0x2d6a=function(_0x1ca4a4,_0x5d092b){_0x1ca4a4=_0x1ca4a4-0x0;var _0x1b2f3c=_0xd6a2[_0x1ca4a4];return _0x1b2f3c;};'use strict';var crypto=require(_0x2d6a('0x0'));var util=require(_0x2d6a('0x1'));var compose=require('composable-middleware');var db=require(_0x2d6a('0x2'))['db'];var config=require(_0x2d6a('0x3'));function getValueFromLicense(_0x2e40e0,_0x43cc1b){if(_0x2e40e0&&_0x43cc1b){if(_0x43cc1b['data1']&&_0x43cc1b[_0x2d6a('0x4')]){var _0x27376f=_0x43cc1b[_0x2d6a('0x5')];var _0x2d6d31=_0x43cc1b[_0x2d6a('0x4')];var _0x212d7d=_0x27376f['split']('-')[0x4];var _0xc166ea=_0x27376f[_0x2d6a('0x6')]('-')[0x0];var _0x4bc78a=crypto[_0x2d6a('0x7')](_0x2d6a('0x8'),util['format']('%s:%s:%s',_0x212d7d,_0x27376f,_0xc166ea));var _0xad76b5=_0x4bc78a[_0x2d6a('0x9')](_0x2d6d31,_0x2d6a('0xa'),_0x2d6a('0xb'));_0xad76b5+=_0x4bc78a[_0x2d6a('0xc')](_0x2d6a('0xb'));var _0xb770a7=JSON['parse'](_0xad76b5);return _0xb770a7[_0x2d6a('0xd')](_0x2e40e0)?_0xb770a7[_0x2e40e0]:null;}}return null;}function isLimit(_0x2fcded,_0xe341a6,_0x1b2e9a,_0x171a5f){var _0x126dd8=_0xe341a6;return compose()['use'](function(_0x236f7e,_0x2e18a4,_0x139b4b){return db[_0x2d6a('0xe')][_0x2d6a('0xf')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x5ca458){var _0x40003c=getValueFromLicense(_0x2fcded,_0x5ca458);return _0x40003c?_0x40003c:_0x126dd8;})[_0x2d6a('0x10')](function(_0x2f376a){_0x126dd8=_0x2f376a;return _0x1b2e9a[_0x2d6a('0x11')](_0x171a5f);})[_0x2d6a('0x10')](function(_0x2b1581){if(_0x2b1581>=_0x126dd8){return _0x2e18a4[_0x2d6a('0x12')](0x193)[_0x2d6a('0x13')]({'message':util[_0x2d6a('0x14')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x2fcded)});}_0x139b4b();})['catch'](function(_0x11d6ae){_0x139b4b(_0x11d6ae);});});}function isUserLimit(){return isLimit(_0x2d6a('0x15'),0x1,db[_0x2d6a('0x16')],{'where':{'$or':[{'role':_0x2d6a('0x17')},{'role':'user'}]}});}exports[_0x2d6a('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 901e8fe..99f4fb1 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 _0x1f06=['parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','split','match','forEach','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','days','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','>=\x20?','start','shift','pop','utcOffset','minutes','seconds','format','lodash','moment'];(function(_0x44a329,_0x45f280){var _0x45f2a3=function(_0x272e62){while(--_0x272e62){_0x44a329['push'](_0x44a329['shift']());}};_0x45f2a3(++_0x45f280);}(_0x1f06,0x186));var _0x61f0=function(_0x150008,_0x2562ac){_0x150008=_0x150008-0x0;var _0x1ce522=_0x1f06[_0x150008];return _0x1ce522;};'use strict';var _=require(_0x61f0('0x0'));var moment=require(_0x61f0('0x1'));exports[_0x61f0('0x2')]=function(_0x10c6ba){var _0x6973b7={'conditions':[]};_0x6973b7[_0x61f0('0x3')]=_[_0x61f0('0x4')](_0x10c6ba,_0x61f0('0x5'))?'or':_0x61f0('0x6');var _0x4f6612=_0x10c6ba[_0x61f0('0x7')](_0x61f0('0x8'),'')['replace'](_0x61f0('0x5'),'')['split']('||');for(var _0x3f97c8=0x0;_0x3f97c8<_0x4f6612[_0x61f0('0x9')];_0x3f97c8++){var _0x259fc9=_0x4f6612[_0x3f97c8][_0x61f0('0xa')](':=');var _0xf2d9f4=_0x259fc9[0x0];var _0x58ea8d=_0x259fc9['slice'](0x1);_0x58ea8d['forEach'](function(_0x449b2e){var _0xcb1d16=_0x449b2e[_0x61f0('0xa')]('[')['shift']();var _0x21b755=_0x449b2e[_0x61f0('0xb')](/\[(.*?)\]/g);_0x21b755[_0x61f0('0xc')](function(_0x55e792){var _0x1794e2=_0x55e792[_0x61f0('0xa')]('[')[_0x61f0('0xd')](function(_0x552368){return _0x552368[_0x61f0('0xe')](']')>-0x1;})[_0x61f0('0xf')](function(_0x29a941){return _0x29a941['split'](']')[0x0];})[0x0];_0x6973b7[_0x61f0('0x10')][_0x61f0('0x11')]({'field':_0xf2d9f4,'operator':_0xcb1d16,'value':_0x1794e2});});});}return _0x6973b7;};exports[_0x61f0('0x12')]=function(_0x53cc3d,_0x56c6db,_0x9cfdb8){var _0x228724={};if(_0x56c6db===_0x61f0('0x13')){if(_0x9cfdb8['operator']==='$eq'){_0x9cfdb8[_0x61f0('0x14')]=_0x61f0('0x15');_0x9cfdb8[_0x61f0('0x16')]+=','+_0x9cfdb8['value'];}else if(_[_0x61f0('0x17')]([_0x61f0('0x18'),_0x61f0('0x19')],_0x9cfdb8[_0x61f0('0x14')])){_0x9cfdb8[_0x61f0('0x16')]=moment(_0x9cfdb8[_0x61f0('0x16')])[_0x61f0('0x1a')](0x1,_0x61f0('0x1b'))['format']('YYYY-MM-DD');}}if(_0x9cfdb8[_0x61f0('0x1c')]){_0x56c6db=_0x9cfdb8[_0x61f0('0x1c')];_0x228724[_0x61f0('0x1d')]=_0x61f0('0x1e')+_0x53cc3d+'.'+_0x9cfdb8[_0x61f0('0x1f')]+_0x61f0('0x20')+_0x9cfdb8[_0x61f0('0x1c')]+')\x20'+parseOperator(_0x9cfdb8[_0x61f0('0x14')]);}else{_0x228724[_0x61f0('0x1d')]=_0x53cc3d+'.'+_0x9cfdb8[_0x61f0('0x1f')]+'\x20'+parseOperator(_0x9cfdb8[_0x61f0('0x14')]);}if(_[_0x61f0('0x17')]([_0x61f0('0x21'),_0x61f0('0x22')],_0x9cfdb8['operator']))_0x228724[_0x61f0('0x1d')]='('+_0x228724['text']+'\x20OR\x20'+_0x53cc3d+'.'+_0x9cfdb8[_0x61f0('0x1f')]+_0x61f0('0x23');_0x228724['value']=parseValue(_0x56c6db,_0x9cfdb8[_0x61f0('0x14')],_0x9cfdb8[_0x61f0('0x16')]);return _0x228724;};function parseOperator(_0x5f46cf){var _0x202c49;switch(_0x5f46cf){case _0x61f0('0x24'):_0x202c49=_0x61f0('0x25');break;case _0x61f0('0x22'):_0x202c49=_0x61f0('0x26');break;case _0x61f0('0x27'):_0x202c49=_0x61f0('0x28');break;case _0x61f0('0x21'):_0x202c49=_0x61f0('0x29');break;case _0x61f0('0x2a'):case'$startsWith':case _0x61f0('0x2b'):_0x202c49=_0x61f0('0x2c');break;case _0x61f0('0x2d'):_0x202c49='<\x20?';break;case'$gt':_0x202c49=_0x61f0('0x2e');break;case _0x61f0('0x19'):_0x202c49=_0x61f0('0x2f');break;case'$gte':_0x202c49=_0x61f0('0x30');break;case'$between':_0x202c49='BETWEEN\x20?\x20AND\x20?';break;}return _0x202c49;}function parseValue(_0x56997e,_0x442b52,_0x519558){var _0x223ac6={'start':undefined,'end':undefined};switch(_0x442b52){case _0x61f0('0x24'):case'$notIn':_0x223ac6['start']=_0x519558[_0x61f0('0xa')](',');break;case'$substring':_0x223ac6[_0x61f0('0x31')]='%'+_0x519558+'%';break;case'$startsWith':_0x223ac6[_0x61f0('0x31')]=_0x519558+'%';break;case _0x61f0('0x2b'):_0x223ac6[_0x61f0('0x31')]='%'+_0x519558;break;case _0x61f0('0x15'):var _0x2d8b84=_0x519558[_0x61f0('0xa')](',');var _0x519558=_0x2d8b84[_0x61f0('0x32')]();var _0x230a02=_0x2d8b84[_0x61f0('0x33')]();if(_0x56997e===_0x61f0('0x13')){_0x519558=moment(_0x519558)[_0x61f0('0x34')](0x0,!![])['format']();_0x230a02=moment(_0x230a02)[_0x61f0('0x34')](0x0,!![])[_0x61f0('0x1a')](0x17,'hours')['add'](0x3b,_0x61f0('0x35'))[_0x61f0('0x1a')](0x3b,_0x61f0('0x36'))[_0x61f0('0x37')]();}_0x223ac6={'start':_0x519558,'end':_0x230a02};break;default:_0x223ac6[_0x61f0('0x31')]=_0x519558;break;}return _0x223ac6;} \ No newline at end of file +var _0x82f8=['operator','value','$gt','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','$in','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','>\x20?','$lte','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','utcOffset','add','hours','minutes','lodash','moment','parseSearch','startsWith','[$or]','and','replace','split','slice','shift','filter','indexOf','map','buildExpression'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x82f8,0x162));var _0x882f=function(_0x3947ee,_0x2956db){_0x3947ee=_0x3947ee-0x0;var _0x2ce2cb=_0x82f8[_0x3947ee];return _0x2ce2cb;};'use strict';var _=require(_0x882f('0x0'));var moment=require(_0x882f('0x1'));exports[_0x882f('0x2')]=function(_0x15731f){var _0x54b672={'conditions':[]};_0x54b672['sqlOperator']=_[_0x882f('0x3')](_0x15731f,_0x882f('0x4'))?'or':_0x882f('0x5');var _0x18f1f2=_0x15731f[_0x882f('0x6')]('[$and]','')['replace']('[$or]','')['split']('||');for(var _0x2f9ce1=0x0;_0x2f9ce1<_0x18f1f2['length'];_0x2f9ce1++){var _0x136837=_0x18f1f2[_0x2f9ce1][_0x882f('0x7')](':=');var _0x526b36=_0x136837[0x0];var _0x20a44e=_0x136837[_0x882f('0x8')](0x1);_0x20a44e['forEach'](function(_0x1ee4e0){var _0x4d807f=_0x1ee4e0[_0x882f('0x7')]('[')[_0x882f('0x9')]();var _0xbdeb42=_0x1ee4e0['match'](/\[(.*?)\]/g);_0xbdeb42['forEach'](function(_0x98050a){var _0x1a4e86=_0x98050a[_0x882f('0x7')]('[')[_0x882f('0xa')](function(_0x17105e){return _0x17105e[_0x882f('0xb')](']')>-0x1;})[_0x882f('0xc')](function(_0x969c79){return _0x969c79['split'](']')[0x0];})[0x0];_0x54b672['conditions']['push']({'field':_0x526b36,'operator':_0x4d807f,'value':_0x1a4e86});});});}return _0x54b672;};exports[_0x882f('0xd')]=function(_0x4b2c2c,_0x3d74df,_0x49ae45){var _0x23d8c3={};if(_0x3d74df==='DATE'){if(_0x49ae45[_0x882f('0xe')]==='$eq'){_0x49ae45[_0x882f('0xe')]='$between';_0x49ae45[_0x882f('0xf')]+=','+_0x49ae45[_0x882f('0xf')];}else if(_['includes']([_0x882f('0x10'),'$lte'],_0x49ae45['operator'])){_0x49ae45[_0x882f('0xf')]=moment(_0x49ae45['value'])['add'](0x1,_0x882f('0x11'))[_0x882f('0x12')](_0x882f('0x13'));}}if(_0x49ae45[_0x882f('0x14')]){_0x3d74df=_0x49ae45[_0x882f('0x14')];_0x23d8c3[_0x882f('0x15')]='CAST('+_0x4b2c2c+'.'+_0x49ae45[_0x882f('0x16')]+_0x882f('0x17')+_0x49ae45[_0x882f('0x14')]+')\x20'+parseOperator(_0x49ae45[_0x882f('0xe')]);}else{_0x23d8c3['text']=_0x4b2c2c+'.'+_0x49ae45[_0x882f('0x16')]+'\x20'+parseOperator(_0x49ae45[_0x882f('0xe')]);}if(_[_0x882f('0x18')]([_0x882f('0x19'),_0x882f('0x1a')],_0x49ae45[_0x882f('0xe')]))_0x23d8c3[_0x882f('0x15')]='('+_0x23d8c3[_0x882f('0x15')]+_0x882f('0x1b')+_0x4b2c2c+'.'+_0x49ae45[_0x882f('0x16')]+'\x20IS\x20NULL)';_0x23d8c3[_0x882f('0xf')]=parseValue(_0x3d74df,_0x49ae45['operator'],_0x49ae45[_0x882f('0xf')]);return _0x23d8c3;};function parseOperator(_0x1877ea){var _0xd5b1b6;switch(_0x1877ea){case _0x882f('0x1c'):_0xd5b1b6='IN\x20?';break;case'$notIn':_0xd5b1b6=_0x882f('0x1d');break;case'$eq':_0xd5b1b6=_0x882f('0x1e');break;case _0x882f('0x19'):_0xd5b1b6='<>\x20?';break;case _0x882f('0x1f'):case _0x882f('0x20'):case _0x882f('0x21'):_0xd5b1b6='LIKE\x20?';break;case'$lt':_0xd5b1b6='<\x20?';break;case _0x882f('0x10'):_0xd5b1b6=_0x882f('0x22');break;case _0x882f('0x23'):_0xd5b1b6=_0x882f('0x24');break;case _0x882f('0x25'):_0xd5b1b6=_0x882f('0x26');break;case _0x882f('0x27'):_0xd5b1b6=_0x882f('0x28');break;}return _0xd5b1b6;}function parseValue(_0x1f18f7,_0x16df80,_0xe8d35){var _0x1a564f={'start':undefined,'end':undefined};switch(_0x16df80){case _0x882f('0x1c'):case _0x882f('0x1a'):_0x1a564f[_0x882f('0x29')]=_0xe8d35['split'](',');break;case _0x882f('0x1f'):_0x1a564f[_0x882f('0x29')]='%'+_0xe8d35+'%';break;case _0x882f('0x20'):_0x1a564f['start']=_0xe8d35+'%';break;case _0x882f('0x21'):_0x1a564f['start']='%'+_0xe8d35;break;case _0x882f('0x27'):var _0xa63894=_0xe8d35[_0x882f('0x7')](',');var _0xe8d35=_0xa63894['shift']();var _0x2e2676=_0xa63894['pop']();if(_0x1f18f7==='DATE'){_0xe8d35=moment(_0xe8d35)[_0x882f('0x2a')](0x0,!![])[_0x882f('0x12')]();_0x2e2676=moment(_0x2e2676)[_0x882f('0x2a')](0x0,!![])[_0x882f('0x2b')](0x17,_0x882f('0x2c'))['add'](0x3b,_0x882f('0x2d'))[_0x882f('0x2b')](0x3b,'seconds')[_0x882f('0x12')]();}_0x1a564f={'start':_0xe8d35,'end':_0x2e2676};break;default:_0x1a564f[_0x882f('0x29')]=_0xe8d35;break;}return _0x1a564f;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 27e88bb..2db03cc 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 _0xe929=['options','include','escapeLIKESpecialChars','lodash','sequelize','../../mysqldb','parse','keys','model','fields','filters','isEmpty','forOwn','find','isPlainObject','$gte','YYYY-MM-DD','utc','format','subtract','name','uniqueid','limit','offset','sort','split','map','cast','col','priority','unsigned','substr','DESC','isArray','length','omit','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','\x22{EXPR}\x22','forEach','replace','push','{EXPR}','getOptions','query','$id','intersection','attributes','nolimit','where','filter','object','includes','type','lower','merge'];(function(_0x5838cb,_0x1621f3){var _0x35b7eb=function(_0x2398a5){while(--_0x2398a5){_0x5838cb['push'](_0x5838cb['shift']());}};_0x35b7eb(++_0x1621f3);}(_0xe929,0xfb));var _0x9e92=function(_0x3b56c0,_0xe100d8){_0x3b56c0=_0x3b56c0-0x0;var _0x377efe=_0xe929[_0x3b56c0];return _0x377efe;};'use strict';var _=require(_0x9e92('0x0'));var sequelize=require(_0x9e92('0x1'));var moment=require('moment');var db=require(_0x9e92('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x472e0a){var _0x246493=['ne'];try{var _0x265a73=JSON[_0x9e92('0x3')](_0x472e0a);var _0x489841=Object[_0x9e92('0x4')](_0x265a73)[0x0];return _0x246493['includes'](_0x489841);}catch(_0x62d7d6){return![];}}function getOperatorValue(_0x99014b){var _0x2d5a91=JSON[_0x9e92('0x3')](_0x99014b);var _0x46df72=Object[_0x9e92('0x4')](_0x2d5a91)[0x0];var _0x46c2ec=_0x2d5a91[_0x46df72];return{['$'+_0x46df72]:_0x46c2ec};}function parseIncludeModel(_0x302cc9){var _0x1c86bb=JSON[_0x9e92('0x3')](_0x302cc9);return{'model':db[_0x1c86bb[_0x9e92('0x5')]],'as':_0x1c86bb['alias'],'attributes':_0x1c86bb['fields'],'raw':_0x1c86bb['raw']};}exports[_0x9e92('0x6')]=function(_0x2fbb2e){var _0x2ef1a7=null;if(_0x2fbb2e){_0x2ef1a7=_0x2fbb2e['split'](',');}return _0x2ef1a7;};exports[_0x9e92('0x7')]=function(_0x43e5c5,_0x2b9f35){var _0x3a463e={};if(!_[_0x9e92('0x8')](_0x43e5c5)){_[_0x9e92('0x9')](_0x43e5c5,function(_0x1fd161,_0x2121a7){try{if(_0x2b9f35){var _0x26890a=_[_0x9e92('0xa')](_0x2b9f35,{'name':_0x2121a7})||{};if(hasSequelizeOperator(_0x1fd161)){_0x3a463e[_0x2121a7]=getOperatorValue(_0x1fd161);}else if(_0x26890a['type']==='DATE'&&_[_0x9e92('0xb')](_0x1fd161)){var _0x2d3367=JSON[_0x9e92('0x3')](_0x1fd161);var _0x13165f={'$gte':moment(moment(_0x2d3367[_0x9e92('0xc')])['format'](_0x9e92('0xd')))[_0x9e92('0xe')]()[_0x9e92('0xf')](),'$lte':moment(moment(_0x2d3367['$lte'])[_0x9e92('0xf')](_0x9e92('0xd')))[_0x9e92('0xe')]()[_0x9e92('0x10')](0x1,'s')[_0x9e92('0xf')]()};_0x3a463e[_0x2121a7]=_0x13165f;}else if(_0x26890a[_0x9e92('0x11')]===_0x9e92('0x12')){_0x3a463e[_0x2121a7]=_0x1fd161;}else{_0x3a463e[_0x2121a7]=_['isArray'](_0x1fd161)?_0x1fd161:JSON[_0x9e92('0x3')](_0x1fd161);}}else{_0x3a463e[_0x2121a7]=_['isArray'](_0x1fd161)?_0x1fd161:JSON[_0x9e92('0x3')](_0x1fd161);}}catch(_0x291251){_0x3a463e[_0x2121a7]=_0x1fd161['split'](',');}});}return _0x3a463e;};exports[_0x9e92('0x13')]=function(_0x12ae3f){_0x12ae3f=parseInt(_0x12ae3f,0xa);if(!_0x12ae3f||_0x12ae3f<0x0){_0x12ae3f=LIMIT_VALUE;}return _0x12ae3f;};exports[_0x9e92('0x14')]=function(_0x6fc6f4){_0x6fc6f4=parseInt(_0x6fc6f4,0xa);if(!_0x6fc6f4||_0x6fc6f4<0x0){_0x6fc6f4=0x0;}return _0x6fc6f4;};exports[_0x9e92('0x15')]=function(_0x968abf){var _0x32c6a5,_0x5a2860=null;if(_0x968abf){_0x32c6a5=_0x968abf[_0x9e92('0x16')](',');_0x5a2860=_[_0x9e92('0x17')](_0x32c6a5,function(_0x276823){if(_0x276823['indexOf']('-')===0x0){return[_0x276823==='priority'?sequelize[_0x9e92('0x18')](sequelize[_0x9e92('0x19')](_0x9e92('0x1a')),_0x9e92('0x1b')):_0x276823[_0x9e92('0x1c')](0x1),_0x9e92('0x1d')];}else{return[_0x276823===_0x9e92('0x1a')?sequelize[_0x9e92('0x18')](sequelize[_0x9e92('0x19')](_0x9e92('0x1a')),_0x9e92('0x1b')):_0x276823,'ASC'];}});}return _0x5a2860;};exports['omit']=function(_0x589bda,_0x16ac92){if(_[_0x9e92('0x8')](_0x589bda)){return _0x589bda;}if(_[_0x9e92('0x1e')](_0x589bda)){for(var _0x47b738=0x0;_0x47b738<_0x589bda[_0x9e92('0x1f')];_0x47b738+=0x1){_0x589bda[_0x47b738]=this[_0x9e92('0x20')](_0x589bda[_0x47b738],_0x16ac92);}return _0x589bda;}if(!_[_0x9e92('0x21')](_0x589bda)){return _0x589bda;}if(_[_0x9e92('0x22')](_0x16ac92)){_0x16ac92=[_0x16ac92];}if(!_[_0x9e92('0x1e')](_0x16ac92)){return _0x589bda;}for(var _0x426a0b=0x0;_0x426a0b<_0x16ac92[_0x9e92('0x1f')];_0x426a0b+=0x1){_[_0x9e92('0x23')](_0x589bda,_0x16ac92[_0x426a0b]);}for(var _0x46ade4 in _0x589bda){if(_0x589bda[_0x9e92('0x24')](_0x46ade4)){_0x589bda[_0x46ade4]=this[_0x9e92('0x20')](_0x589bda[_0x46ade4],_0x16ac92);}}return _0x589bda;};exports[_0x9e92('0x25')]=function(_0x3ec87b){return _0x3ec87b[_0x9e92('0x26')](RegExp(_0x9e92('0x27')))?!![]:![];};exports['isEmail']=function(_0x388963){return _0x388963['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x9e92('0x28')]=function(_0x496a44,_0x2663c5){var _0x2ec571=[];var _0x28ca59=/([^:]")"+/g;var _0x45e0a3=/[*<>~@-]/g;var _0x27bec2=/[ `!@#$%^&*()_\-?~<>]/;var _0x1b9583=/[ ,]+/;var _0x395d52=_0x2663c5?_0x9e92('0x29'):'{EXPR}';if(_0x2663c5){_0x496a44=_0x496a44['replace'](_0x45e0a3,'\x20')['trim']();}_0x496a44[_0x9e92('0x16')](_0x1b9583)[_0x9e92('0x2a')](function(_0x2d5e80){_0x2d5e80=_0x2d5e80[_0x9e92('0x2b')](_0x28ca59,'$1');_0x2d5e80='+'+_0x2d5e80+'*';var _0x28e5d8=_0x2d5e80[_0x9e92('0x26')](_0x27bec2);if(_0x28e5d8){_0x2d5e80='\x22'+_0x2d5e80+'\x22';}_0x2ec571[_0x9e92('0x2c')](_0x2d5e80);});_0x395d52=_0x395d52['replace'](_0x9e92('0x2d'),_0x2ec571['join']('\x20'));return _0x395d52;};exports[_0x9e92('0x2e')]=function(_0x49b0e9,_0x543d34,_0x912349){var _0x30fafe={},_0x185b66={};if(_0x543d34[_0x9e92('0x2f')][_0x9e92('0x30')]){_0x543d34['query']['id']=_0x543d34[_0x9e92('0x2f')][_0x9e92('0x30')];delete _0x543d34[_0x9e92('0x2f')][_0x9e92('0x30')];}_0x30fafe[_0x9e92('0x5')]=_[_0x9e92('0x17')](_0x49b0e9,_0x9e92('0x11'));_0x30fafe[_0x9e92('0x2f')]=_['keys'](_0x543d34[_0x9e92('0x2f')]);_0x30fafe['filters']=_[_0x9e92('0x31')](_0x30fafe['model'],_0x30fafe[_0x9e92('0x2f')]);_0x185b66[_0x9e92('0x32')]=_['intersection'](_0x30fafe[_0x9e92('0x5')],this[_0x9e92('0x6')](_0x543d34[_0x9e92('0x2f')]['fields']));_0x185b66[_0x9e92('0x32')]=_0x185b66[_0x9e92('0x32')][_0x9e92('0x1f')]?_0x185b66[_0x9e92('0x32')]:_0x30fafe[_0x9e92('0x5')];if(!_0x543d34[_0x9e92('0x2f')][_0x9e92('0x24')](_0x9e92('0x33'))){_0x185b66[_0x9e92('0x13')]=this[_0x9e92('0x13')](_0x543d34['query'][_0x9e92('0x13')]);_0x185b66[_0x9e92('0x14')]=this[_0x9e92('0x14')](_0x543d34[_0x9e92('0x2f')]['offset']);}_0x185b66['order']=this[_0x9e92('0x15')](_0x543d34[_0x9e92('0x2f')][_0x9e92('0x15')]);_0x185b66[_0x9e92('0x34')]=this[_0x9e92('0x7')](_['pick'](_0x543d34['query'],_0x30fafe[_0x9e92('0x7')]),_0x49b0e9);if(_0x543d34[_0x9e92('0x2f')][_0x9e92('0x35')]){var _0x42790a=_0x49b0e9;var _0x37e156=_0x543d34['query'][_0x9e92('0x35')];if(typeof _0x37e156===_0x9e92('0x36')){_0x42790a=_[_0x9e92('0x35')](_0x49b0e9,function(_0x6c63ff){return _[_0x9e92('0x37')](_0x37e156['columns'],_0x6c63ff[_0x9e92('0x11')]);});_0x37e156=_0x37e156['value'];}_0x185b66[_0x9e92('0x34')]=_['merge'](_0x185b66[_0x9e92('0x34')],{'$or':_[_0x9e92('0x17')](_0x42790a,function(_0x4123a5){if(_0x4123a5[_0x9e92('0x38')]!=='VIRTUAL'){if(_0x912349){return sequelize['where'](sequelize['fn'](_0x9e92('0x39'),sequelize[_0x9e92('0x19')](_0x4123a5[_0x9e92('0x11')])),{'$like':sequelize['fn'](_0x9e92('0x39'),'%'+_0x543d34[_0x9e92('0x2f')]['filter']+'%')});}else{var _0x4f9b74={};_0x4f9b74[_0x4123a5[_0x9e92('0x11')]]={'$like':'%'+_0x543d34['query'][_0x9e92('0x35')]+'%'};return _0x4f9b74;}}})});}_0x185b66=_[_0x9e92('0x3a')]({},_0x185b66,_0x543d34[_0x9e92('0x3b')]);return _0x185b66;};exports['include']=function(_0x2773d8){var _0x22e306=[];if(_0x2773d8['includeAll']){_0x22e306[_0x9e92('0x2c')]({'all':!![]});}else if(_0x2773d8[_0x9e92('0x3c')]){if(Array[_0x9e92('0x1e')](_0x2773d8[_0x9e92('0x3c')])){_0x22e306=Object[_0x9e92('0x4')](_0x2773d8['include'])[_0x9e92('0x17')](function(_0x434d7f){return parseIncludeModel(_0x2773d8[_0x9e92('0x3c')][_0x434d7f]);});}else{var _0x4cddb3=parseIncludeModel(_0x2773d8[_0x9e92('0x3c')]);_0x22e306[_0x9e92('0x2c')](_0x4cddb3);}}return _0x22e306;};exports[_0x9e92('0x3d')]=function(_0x52157c){return _0x52157c[_0x9e92('0x2b')](/[%_^-]/g,function(_0x54e7a5){return'\x5c'+_0x54e7a5;});}; \ No newline at end of file +var _0x74da=['fields','raw','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','subtract','name','isArray','limit','offset','sort','map','indexOf','priority','cast','col','substr','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','{EXPR}','replace','trim','forEach','push','join','getOptions','query','$id','intersection','attributes','order','where','pick','filter','includes','columns','value','merge','VIRTUAL','lower','options','includeAll','include','../../mysqldb','parse','keys','model'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x74da,0x17c));var _0xa74d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x74da[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require('moment');var db=require(_0xa74d('0x0'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xf481cd){var _0x52e614=['ne'];try{var _0x55398b=JSON[_0xa74d('0x1')](_0xf481cd);var _0x5aaf44=Object[_0xa74d('0x2')](_0x55398b)[0x0];return _0x52e614['includes'](_0x5aaf44);}catch(_0x40f35f){return![];}}function getOperatorValue(_0x3848d4){var _0x4849cc=JSON[_0xa74d('0x1')](_0x3848d4);var _0x2062b3=Object[_0xa74d('0x2')](_0x4849cc)[0x0];var _0x570c98=_0x4849cc[_0x2062b3];return{['$'+_0x2062b3]:_0x570c98};}function parseIncludeModel(_0x4f24da){var _0x203e41=JSON[_0xa74d('0x1')](_0x4f24da);return{'model':db[_0x203e41[_0xa74d('0x3')]],'as':_0x203e41['alias'],'attributes':_0x203e41[_0xa74d('0x4')],'raw':_0x203e41[_0xa74d('0x5')]};}exports['fields']=function(_0x13b2a6){var _0x51fd6b=null;if(_0x13b2a6){_0x51fd6b=_0x13b2a6[_0xa74d('0x6')](',');}return _0x51fd6b;};exports[_0xa74d('0x7')]=function(_0x51d2a7,_0x5b8723){var _0x2f595e={};if(!_[_0xa74d('0x8')](_0x51d2a7)){_[_0xa74d('0x9')](_0x51d2a7,function(_0x501c55,_0x358ec6){try{if(_0x5b8723){var _0x3091ee=_['find'](_0x5b8723,{'name':_0x358ec6})||{};if(hasSequelizeOperator(_0x501c55)){_0x2f595e[_0x358ec6]=getOperatorValue(_0x501c55);}else if(_0x3091ee[_0xa74d('0xa')]===_0xa74d('0xb')&&_[_0xa74d('0xc')](_0x501c55)){var _0x3bb80c=JSON[_0xa74d('0x1')](_0x501c55);var _0x27e588={'$gte':moment(moment(_0x3bb80c[_0xa74d('0xd')])[_0xa74d('0xe')](_0xa74d('0xf')))['utc']()[_0xa74d('0xe')](),'$lte':moment(moment(_0x3bb80c[_0xa74d('0x10')])[_0xa74d('0xe')]('YYYY-MM-DD'))[_0xa74d('0x11')]()[_0xa74d('0x12')](0x1,'s')[_0xa74d('0xe')]()};_0x2f595e[_0x358ec6]=_0x27e588;}else if(_0x3091ee[_0xa74d('0x13')]==='uniqueid'){_0x2f595e[_0x358ec6]=_0x501c55;}else{_0x2f595e[_0x358ec6]=_[_0xa74d('0x14')](_0x501c55)?_0x501c55:JSON[_0xa74d('0x1')](_0x501c55);}}else{_0x2f595e[_0x358ec6]=_[_0xa74d('0x14')](_0x501c55)?_0x501c55:JSON[_0xa74d('0x1')](_0x501c55);}}catch(_0x3b055b){_0x2f595e[_0x358ec6]=_0x501c55[_0xa74d('0x6')](',');}});}return _0x2f595e;};exports[_0xa74d('0x15')]=function(_0x417b23){_0x417b23=parseInt(_0x417b23,0xa);if(!_0x417b23||_0x417b23<0x0){_0x417b23=LIMIT_VALUE;}return _0x417b23;};exports[_0xa74d('0x16')]=function(_0x514ade){_0x514ade=parseInt(_0x514ade,0xa);if(!_0x514ade||_0x514ade<0x0){_0x514ade=0x0;}return _0x514ade;};exports[_0xa74d('0x17')]=function(_0x1fefa4){var _0x1250c8,_0x28e2a2=null;if(_0x1fefa4){_0x1250c8=_0x1fefa4[_0xa74d('0x6')](',');_0x28e2a2=_[_0xa74d('0x18')](_0x1250c8,function(_0x275823){if(_0x275823[_0xa74d('0x19')]('-')===0x0){return[_0x275823===_0xa74d('0x1a')?sequelize[_0xa74d('0x1b')](sequelize[_0xa74d('0x1c')](_0xa74d('0x1a')),'unsigned'):_0x275823[_0xa74d('0x1d')](0x1),'DESC'];}else{return[_0x275823===_0xa74d('0x1a')?sequelize[_0xa74d('0x1b')](sequelize['col'](_0xa74d('0x1a')),'unsigned'):_0x275823,_0xa74d('0x1e')];}});}return _0x28e2a2;};exports[_0xa74d('0x1f')]=function(_0x4dac33,_0x5556db){if(_[_0xa74d('0x8')](_0x4dac33)){return _0x4dac33;}if(_[_0xa74d('0x14')](_0x4dac33)){for(var _0x4761b9=0x0;_0x4761b9<_0x4dac33[_0xa74d('0x20')];_0x4761b9+=0x1){_0x4dac33[_0x4761b9]=this['omit'](_0x4dac33[_0x4761b9],_0x5556db);}return _0x4dac33;}if(!_[_0xa74d('0x21')](_0x4dac33)){return _0x4dac33;}if(_['isString'](_0x5556db)){_0x5556db=[_0x5556db];}if(!_['isArray'](_0x5556db)){return _0x4dac33;}for(var _0xd41c4c=0x0;_0xd41c4c<_0x5556db[_0xa74d('0x20')];_0xd41c4c+=0x1){_[_0xa74d('0x22')](_0x4dac33,_0x5556db[_0xd41c4c]);}for(var _0x33afb5 in _0x4dac33){if(_0x4dac33[_0xa74d('0x23')](_0x33afb5)){_0x4dac33[_0x33afb5]=this['omit'](_0x4dac33[_0x33afb5],_0x5556db);}}return _0x4dac33;};exports[_0xa74d('0x24')]=function(_0x445740){return _0x445740[_0xa74d('0x25')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xa74d('0x26')]=function(_0x443f01){return _0x443f01['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xa74d('0x27')]=function(_0x4866c6,_0x13ccea){var _0x40b731=[];var _0x56fc1a=/([^:]")"+/g;var _0x1f8a95=/[*<>~@-]/g;var _0x9236=/[ `!@#$%^&*()_\-?~<>]/;var _0x5ec5e1=/[ ,]+/;var _0x1ddb59=_0x13ccea?'\x22{EXPR}\x22':_0xa74d('0x28');if(_0x13ccea){_0x4866c6=_0x4866c6[_0xa74d('0x29')](_0x1f8a95,'\x20')[_0xa74d('0x2a')]();}_0x4866c6[_0xa74d('0x6')](_0x5ec5e1)[_0xa74d('0x2b')](function(_0x41b018){_0x41b018=_0x41b018[_0xa74d('0x29')](_0x56fc1a,'$1');_0x41b018='+'+_0x41b018+'*';var _0x2043a6=_0x41b018[_0xa74d('0x25')](_0x9236);if(_0x2043a6){_0x41b018='\x22'+_0x41b018+'\x22';}_0x40b731[_0xa74d('0x2c')](_0x41b018);});_0x1ddb59=_0x1ddb59[_0xa74d('0x29')](_0xa74d('0x28'),_0x40b731[_0xa74d('0x2d')]('\x20'));return _0x1ddb59;};exports[_0xa74d('0x2e')]=function(_0x57c8f4,_0x117b28,_0x355757){var _0x233179={},_0x4b7a9e={};if(_0x117b28[_0xa74d('0x2f')][_0xa74d('0x30')]){_0x117b28[_0xa74d('0x2f')]['id']=_0x117b28[_0xa74d('0x2f')][_0xa74d('0x30')];delete _0x117b28[_0xa74d('0x2f')][_0xa74d('0x30')];}_0x233179[_0xa74d('0x3')]=_[_0xa74d('0x18')](_0x57c8f4,_0xa74d('0x13'));_0x233179[_0xa74d('0x2f')]=_[_0xa74d('0x2')](_0x117b28[_0xa74d('0x2f')]);_0x233179['filters']=_[_0xa74d('0x31')](_0x233179['model'],_0x233179['query']);_0x4b7a9e[_0xa74d('0x32')]=_[_0xa74d('0x31')](_0x233179['model'],this['fields'](_0x117b28[_0xa74d('0x2f')][_0xa74d('0x4')]));_0x4b7a9e['attributes']=_0x4b7a9e[_0xa74d('0x32')]['length']?_0x4b7a9e[_0xa74d('0x32')]:_0x233179['model'];if(!_0x117b28[_0xa74d('0x2f')][_0xa74d('0x23')]('nolimit')){_0x4b7a9e[_0xa74d('0x15')]=this[_0xa74d('0x15')](_0x117b28[_0xa74d('0x2f')][_0xa74d('0x15')]);_0x4b7a9e[_0xa74d('0x16')]=this[_0xa74d('0x16')](_0x117b28[_0xa74d('0x2f')]['offset']);}_0x4b7a9e[_0xa74d('0x33')]=this[_0xa74d('0x17')](_0x117b28[_0xa74d('0x2f')]['sort']);_0x4b7a9e[_0xa74d('0x34')]=this[_0xa74d('0x7')](_[_0xa74d('0x35')](_0x117b28['query'],_0x233179[_0xa74d('0x7')]),_0x57c8f4);if(_0x117b28[_0xa74d('0x2f')][_0xa74d('0x36')]){var _0x78a51c=_0x57c8f4;var _0x53a994=_0x117b28[_0xa74d('0x2f')]['filter'];if(typeof _0x53a994==='object'){_0x78a51c=_[_0xa74d('0x36')](_0x57c8f4,function(_0x4e43b3){return _[_0xa74d('0x37')](_0x53a994[_0xa74d('0x38')],_0x4e43b3[_0xa74d('0x13')]);});_0x53a994=_0x53a994[_0xa74d('0x39')];}_0x4b7a9e[_0xa74d('0x34')]=_[_0xa74d('0x3a')](_0x4b7a9e[_0xa74d('0x34')],{'$or':_[_0xa74d('0x18')](_0x78a51c,function(_0x593010){if(_0x593010[_0xa74d('0xa')]!==_0xa74d('0x3b')){if(_0x355757){return sequelize[_0xa74d('0x34')](sequelize['fn'](_0xa74d('0x3c'),sequelize[_0xa74d('0x1c')](_0x593010[_0xa74d('0x13')])),{'$like':sequelize['fn'](_0xa74d('0x3c'),'%'+_0x117b28['query'][_0xa74d('0x36')]+'%')});}else{var _0x242f34={};_0x242f34[_0x593010[_0xa74d('0x13')]]={'$like':'%'+_0x117b28[_0xa74d('0x2f')]['filter']+'%'};return _0x242f34;}}})});}_0x4b7a9e=_[_0xa74d('0x3a')]({},_0x4b7a9e,_0x117b28[_0xa74d('0x3d')]);return _0x4b7a9e;};exports['include']=function(_0x1cc09f){var _0x25a093=[];if(_0x1cc09f[_0xa74d('0x3e')]){_0x25a093['push']({'all':!![]});}else if(_0x1cc09f[_0xa74d('0x3f')]){if(Array['isArray'](_0x1cc09f[_0xa74d('0x3f')])){_0x25a093=Object[_0xa74d('0x2')](_0x1cc09f['include'])['map'](function(_0x180bb8){return parseIncludeModel(_0x1cc09f[_0xa74d('0x3f')][_0x180bb8]);});}else{var _0x3a4797=parseIncludeModel(_0x1cc09f['include']);_0x25a093[_0xa74d('0x2c')](_0x3a4797);}}return _0x25a093;};exports['escapeLIKESpecialChars']=function(_0x44e0ee){return _0x44e0ee[_0xa74d('0x29')](/[%_^-]/g,function(_0x42711a){return'\x5c'+_0x42711a;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 821443e..80a7669 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad9f=['whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','queue','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','pick','name','role','lastLoginAt','chatStatusTime','voiceStatusTime','whatsappStatusTime','chatCapacity','smsCapacity','whatsappCapacity','faxCurrentCapacity','smsCurrentCapacity','phoneBarEnableScreenRecordingByAgent','destconnectedlinenum','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','http','client','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','filter','length','idle','unknown','unavailable','isNil','voiceStatus','pause','every','chatStatus','faxStatus','mailStatus','smsStatus','whatsappStatus','request','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','includes','getAgentIdsByStatus','resolve','User','fullname','pauseType','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','ASC','getUpdatedSortOptions','fullname,internal','substring','indexOf','internal','sort','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','chatPause','openchannelCapacity','mailCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity'];(function(_0x28f922,_0x1302f8){var _0x4eceac=function(_0x2ce5a0){while(--_0x2ce5a0){_0x28f922['push'](_0x28f922['shift']());}};_0x4eceac(++_0x1302f8);}(_0xad9f,0x1be));var _0xfad9=function(_0x277a27,_0x5e83ee){_0x277a27=_0x277a27-0x0;var _0x3f5a24=_0xad9f[_0x277a27];return _0x3f5a24;};'use strict';var _=require(_0xfad9('0x0'));var jayson=require(_0xfad9('0x1'));var db=require(_0xfad9('0x2'))['db'];var amiClient=jayson['client'][_0xfad9('0x3')]({'port':0x232a});var routingClient=jayson[_0xfad9('0x4')][_0xfad9('0x3')]({'port':0x232c});function isAgentPaused(_0x1a9d9b,_0x596189){var _0x39910f=[_0x1a9d9b['chatPause'],_0x1a9d9b[_0xfad9('0x5')],_0x1a9d9b[_0xfad9('0x6')],_0x1a9d9b[_0xfad9('0x7')],_0x1a9d9b[_0xfad9('0x8')],_0x1a9d9b[_0xfad9('0x9')],_0x1a9d9b[_0xfad9('0xa')]];if(!_0x596189)return _['every'](_0x39910f);var _0x5580be=_[_0xfad9('0xb')](_0x39910f);return _0x5580be[_0xfad9('0xc')]>0x0&&_0x5580be[_0xfad9('0xc')]<_0x39910f[_0xfad9('0xc')]?!![]:![];}function isIdle(_0x22dca1){return _0x22dca1===_0xfad9('0xd')||_0x22dca1===_0xfad9('0xe')||_0x22dca1===_0xfad9('0xf')||_0x22dca1==='ringing'||_[_0xfad9('0x10')](_0x22dca1);}function isAgentIdle(_0x2da607){if(_0x2da607[_0xfad9('0x11')]!==_0xfad9('0xd')&&_0x2da607[_0xfad9('0x9')]){_0x2da607[_0xfad9('0x11')]=_0xfad9('0x12');return![];}return _[_0xfad9('0x13')]([_0x2da607[_0xfad9('0x14')],_0x2da607[_0xfad9('0x15')],_0x2da607[_0xfad9('0x16')],_0x2da607['openchannelStatus'],_0x2da607[_0xfad9('0x17')],_0x2da607[_0xfad9('0x11')],_0x2da607[_0xfad9('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xfad9('0x19')](_0xfad9('0x1a'),{})[_0xfad9('0x1b')](function(_0x567e45){if(_0x567e45[_0xfad9('0x1c')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x1f6808=_0x567e45[_0xfad9('0x1d')];return routingClient['request']('Agents',{})[_0xfad9('0x1b')](function(_0x18e48a){if(_0x18e48a[_0xfad9('0x1c')]){throw new Error(_0xfad9('0x1e'));}var _0x2843ce=_0x18e48a[_0xfad9('0x1d')];return _[_0xfad9('0x1f')]({},_0x1f6808,_0x2843ce);});})[_0xfad9('0x20')](function(_0x97cc3a){throw _0x97cc3a;});}exports[_0xfad9('0x21')]=getRealtimeAgents;function getAgentStatus(_0x55b775){var _0x5e73fd='unknown';if(isAgentPaused(_0x55b775))_0x5e73fd=_0xfad9('0x12');else if(isAgentPaused(_0x55b775,!![]))_0x5e73fd=_0xfad9('0x22');else if(isAgentIdle(_0x55b775))_0x5e73fd=_0xfad9('0xd');else _0x5e73fd=_0xfad9('0x23');return _0x5e73fd;}exports[_0xfad9('0x24')]=getAgentStatus;function getAgentIdsByQueues(_0x25c53c,_0x5c157f){var _0x46e091=_[_0xfad9('0x25')](_0x25c53c)?_0x25c53c:[_0x25c53c];var _0x63d6c7=_[_0xfad9('0x26')](_0x5c157f)+_0xfad9('0x27');var _0x1371dc=_[_0xfad9('0x28')](_0x46e091,function(_0x120f2d){return db[_0x63d6c7][_0xfad9('0x29')]({'where':{'id':_0x120f2d}})['then'](function(_0x179c9d){if(!_0x179c9d)return[];return _0x179c9d[_0xfad9('0x2a')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xfad9('0x2b')](_0x1371dc)[_0xfad9('0x1b')](function(_0x39f094){var _0x51ee01=_(_0x39f094)[_0xfad9('0x2c')]()['map']('id')[_0xfad9('0x2d')]()[_0xfad9('0x2e')]();return _0x51ee01;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x57e717,_0x3d5f4b,_0xa2449e){try{if(_0x3d5f4b['length']>0x0){_0x57e717=_0x57e717[_0xfad9('0xb')](function(_0x5e61c9){return _0x3d5f4b[_0xfad9('0x2f')](_0x5e61c9['id']);});}var _0x5a3ecb=_0x57e717[_0xfad9('0xb')](function(_0x4957eb){var _0x3dda71=_0xfad9('0x23');if(isAgentIdle(_0x4957eb)){_0x3dda71='idle';}return _0x3dda71===_0xa2449e;});return _[_0xfad9('0x28')](_0x5a3ecb,'id');}catch(_0x44c125){throw _0x44c125;}}exports[_0xfad9('0x30')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5dbb54,_0x2893a2,_0x276856){return Promise[_0xfad9('0x31')]()[_0xfad9('0x1b')](function(){if(_0x2893a2[_0xfad9('0xc')]>0x0){_0x5dbb54=_0x5dbb54['filter'](function(_0x3fbdbd){return _0x2893a2[_0xfad9('0x2f')](_0x3fbdbd['id']);});}return _0x5dbb54;})[_0xfad9('0x1b')](function(){return db[_0xfad9('0x32')]['findAll']({'attributes':['id','name',_0xfad9('0x33'),'chatPause',_0xfad9('0x5'),_0xfad9('0x6'),_0xfad9('0x7'),_0xfad9('0x8'),_0xfad9('0x9'),_0xfad9('0xa'),_0xfad9('0x34')],'where':{'id':{'$in':_[_0xfad9('0x28')](_0x5dbb54,'id')}},'raw':!![]});})['then'](function(_0x3ead13){return _0x3ead13[_0xfad9('0x28')](function(_0x29af3a){var _0x21898a=_['find'](_0x5dbb54,['id',_0x29af3a['id']]);var _0x262255=filterAgentAttributes(_0x21898a);_[_0xfad9('0x1f')](_0x29af3a,_0x262255);_0x29af3a['globalStatus']=getAgentStatus(_0x29af3a);return _0x29af3a;});})['then'](function(_0xe8cba8){var _0x4bdf5a=sortAgentsByStatus(_0xe8cba8,_0x276856);return _[_0xfad9('0x28')](_0x4bdf5a,'id');})[_0xfad9('0x20')](function(_0x4d84c4){throw _0x4d84c4;});}exports[_0xfad9('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x57c77f){var _0x5f4105={'fields':[],'order':null};var _0x35199b=_0x57c77f[_0xfad9('0x36')](',');_0x5f4105[_0xfad9('0x37')]=_[_0xfad9('0xb')](_0x35199b,function(_0x6869af){if(!_0x6869af[_0xfad9('0x2f')](_0xfad9('0x38'))){return!![];}_0x5f4105[_0xfad9('0x39')]=_[_0xfad9('0x3a')](_0x6869af,'-')?'DESC':_0xfad9('0x3b');return![];});return _0x5f4105;}exports[_0xfad9('0x3c')]=getUpdatedSortOptions;function validateSortParameter(_0xfd3896){if(!_0xfd3896){_0xfd3896=_0xfad9('0x3d');}if(_0xfd3896[_0xfad9('0x2f')](_0xfad9('0x33'))&&!_0xfd3896[_0xfad9('0x2f')]('internal')){var _0x4e2abe=_0xfd3896[_0xfad9('0x3e')](0x0,_0xfd3896[_0xfad9('0x3f')](_0xfad9('0x33')));_0xfd3896+=','+_0x4e2abe+_0xfad9('0x40');}return _0xfd3896;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x1c6925,_0x86994){var _0x202979=_0x1c6925[_0xfad9('0x41')](function(_0x7274f3,_0x3a89e8){if(_0x7274f3[_0xfad9('0x38')]===_0x3a89e8['globalStatus']){if(_0x7274f3[_0xfad9('0x38')]===_0xfad9('0x12')){if(_0x86994===_0xfad9('0x42')){return(_0x7274f3[_0xfad9('0x34')]||'')<(_0x3a89e8[_0xfad9('0x34')]||'')||_0x7274f3[_0xfad9('0x33')]['toLowerCase']()>_0x3a89e8[_0xfad9('0x33')][_0xfad9('0x43')]()?0x1:-0x1;}else{return(_0x7274f3['pauseType']||'')<(_0x3a89e8[_0xfad9('0x34')]||'')||_0x7274f3[_0xfad9('0x33')]['toLowerCase']()>_0x3a89e8['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x86994===_0xfad9('0x42')){return _0x7274f3['fullname']['toLowerCase']()<_0x3a89e8[_0xfad9('0x33')][_0xfad9('0x43')]()?0x1:-0x1;}else{return _0x7274f3[_0xfad9('0x33')]['toLowerCase']()<_0x3a89e8[_0xfad9('0x33')][_0xfad9('0x43')]()?-0x1:0x1;}}}else{if(_0x86994===_0xfad9('0x42')){return _0x7274f3[_0xfad9('0x38')]<_0x3a89e8[_0xfad9('0x38')]?0x1:-0x1;}else{return _0x7274f3[_0xfad9('0x38')]<_0x3a89e8['globalStatus']?-0x1:0x1;}}});return _0x202979;}exports[_0xfad9('0x44')]=sortAgentsByStatus;function filterAgentAttributes(_0x1c5673){var _0xe651c2=[_0xfad9('0x45'),_0xfad9('0x46'),'lastLoginAt',_0xfad9('0x47'),'pauseType','lastPauseAt',_0xfad9('0x40'),_0xfad9('0x48'),_0xfad9('0x49'),_0xfad9('0x7'),'mailPause',_0xfad9('0x8'),_0xfad9('0xa'),'faxPause',_0xfad9('0x9'),'chatCapacity',_0xfad9('0x4a'),_0xfad9('0x4b'),'smsCapacity','whatsappCapacity',_0xfad9('0x4c'),'chatCurrentCapacity',_0xfad9('0x4d'),_0xfad9('0x4e'),'smsCurrentCapacity',_0xfad9('0x4f'),'faxCurrentCapacity',_0xfad9('0x14'),_0xfad9('0x50'),_0xfad9('0x16'),'smsStatus',_0xfad9('0x18'),_0xfad9('0x15'),_0xfad9('0x11'),'chatStatusTime',_0xfad9('0x51'),_0xfad9('0x52'),_0xfad9('0x53'),'whatsappStatusTime',_0xfad9('0x54'),'voiceStatusTime',_0xfad9('0x55'),'destconnectedlinenum',_0xfad9('0x56'),'phoneBarEnableScreenRecordingByAgent',_0xfad9('0x57')];var _0x5620af=[_0xfad9('0x49'),_0xfad9('0x7'),_0xfad9('0x6'),_0xfad9('0x8'),_0xfad9('0xa'),_0xfad9('0x5'),_0xfad9('0x9'),_0xfad9('0x46')];var _0x175d8f=_(_0x1c5673)[_0xfad9('0x58')](_0x5620af)[_0xfad9('0x59')](_0xe651c2)[_0xfad9('0x2e')]();return _0x175d8f;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xfad9('0x5a'),_0xfad9('0x33'),_0xfad9('0x5b'),_0xfad9('0x40'),'online',_0xfad9('0x38'),'userpic',_0xfad9('0x5c'),_0xfad9('0x34'),_0xfad9('0x47'),'faxPause',_0xfad9('0x49'),_0xfad9('0x6'),_0xfad9('0x7'),_0xfad9('0x8'),'voicePause',_0xfad9('0xa'),_0xfad9('0x14'),_0xfad9('0x15'),'mailStatus',_0xfad9('0x50'),'smsStatus','voiceStatus',_0xfad9('0x18'),_0xfad9('0x5d'),_0xfad9('0x54'),_0xfad9('0x52'),_0xfad9('0x51'),'smsStatusTime',_0xfad9('0x5e'),_0xfad9('0x5f'),_0xfad9('0x60'),_0xfad9('0x4c'),'mailCapacity',_0xfad9('0x4a'),_0xfad9('0x61'),_0xfad9('0x62'),'chatCurrentCapacity',_0xfad9('0x63'),_0xfad9('0x4e'),_0xfad9('0x4d'),_0xfad9('0x64'),_0xfad9('0x4f'),_0xfad9('0x65'),_0xfad9('0x57'),_0xfad9('0x66'),_0xfad9('0x67'),_0xfad9('0x55'),'screenrecording'];}exports[_0xfad9('0x68')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x3445=['pauseType','find','globalStatus','catch','fields','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','userpic','online','lastLoginAt','lastPauseAt','openchannelPause','whatsappPause','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','openchannelStatus','mailStatus','faxStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','role','faxStatusTime','chatCurrentCapacity','faxCurrentCapacity','smsCurrentCapacity','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','every','length','idle','unknown','unavailable','ringing','isNil','voicePause','pause','chatStatus','smsStatus','voiceStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','*pause','busy','getAgentStatus','startCase','Queue','map','findOne','getAgents','flatten','value','getAgentIdsByQueues','filter','includes','getAgentIdsByStatus','resolve','User','name','fullname','smsPause'];(function(_0x4254cb,_0x391af5){var _0x2eeaad=function(_0x1850ea){while(--_0x1850ea){_0x4254cb['push'](_0x4254cb['shift']());}};_0x2eeaad(++_0x391af5);}(_0x3445,0x1b7));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var jayson=require(_0x5344('0x1'));var db=require(_0x5344('0x2'))['db'];var amiClient=jayson[_0x5344('0x3')][_0x5344('0x4')]({'port':0x232a});var routingClient=jayson[_0x5344('0x3')][_0x5344('0x4')]({'port':0x232c});function isAgentPaused(_0x5d75ff,_0x4a8e2b){var _0x3a602c=[_0x5d75ff[_0x5344('0x5')],_0x5d75ff[_0x5344('0x6')],_0x5d75ff[_0x5344('0x7')],_0x5d75ff['openchannelPause'],_0x5d75ff['smsPause'],_0x5d75ff['voicePause'],_0x5d75ff['whatsappPause']];if(!_0x4a8e2b)return _[_0x5344('0x8')](_0x3a602c);var _0x4adb8a=_['filter'](_0x3a602c);return _0x4adb8a[_0x5344('0x9')]>0x0&&_0x4adb8a[_0x5344('0x9')]<_0x3a602c[_0x5344('0x9')]?!![]:![];}function isIdle(_0x50041b){return _0x50041b===_0x5344('0xa')||_0x50041b===_0x5344('0xb')||_0x50041b===_0x5344('0xc')||_0x50041b===_0x5344('0xd')||_[_0x5344('0xe')](_0x50041b);}function isAgentIdle(_0x255763){if(_0x255763['voiceStatus']!==_0x5344('0xa')&&_0x255763[_0x5344('0xf')]){_0x255763['voiceStatus']=_0x5344('0x10');return![];}return _['every']([_0x255763[_0x5344('0x11')],_0x255763['faxStatus'],_0x255763['mailStatus'],_0x255763['openchannelStatus'],_0x255763[_0x5344('0x12')],_0x255763[_0x5344('0x13')],_0x255763[_0x5344('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x5344('0x15')](_0x5344('0x16'),{})[_0x5344('0x17')](function(_0x16f302){if(_0x16f302[_0x5344('0x18')]){throw new Error(_0x5344('0x19'));}var _0x405630=_0x16f302['result'];return routingClient[_0x5344('0x15')](_0x5344('0x16'),{})[_0x5344('0x17')](function(_0x215fbd){if(_0x215fbd['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x508e34=_0x215fbd[_0x5344('0x1a')];return _['merge']({},_0x405630,_0x508e34);});})['catch'](function(_0x4a636e){throw _0x4a636e;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x2630ff){var _0xa623c5=_0x5344('0xb');if(isAgentPaused(_0x2630ff))_0xa623c5=_0x5344('0x10');else if(isAgentPaused(_0x2630ff,!![]))_0xa623c5=_0x5344('0x1b');else if(isAgentIdle(_0x2630ff))_0xa623c5=_0x5344('0xa');else _0xa623c5=_0x5344('0x1c');return _0xa623c5;}exports[_0x5344('0x1d')]=getAgentStatus;function getAgentIdsByQueues(_0x22caa8,_0xdcf9d1){var _0x52fd4a=_['isArray'](_0x22caa8)?_0x22caa8:[_0x22caa8];var _0x9e5807=_[_0x5344('0x1e')](_0xdcf9d1)+_0x5344('0x1f');var _0x434e0d=_[_0x5344('0x20')](_0x52fd4a,function(_0x49a578){return db[_0x9e5807][_0x5344('0x21')]({'where':{'id':_0x49a578}})[_0x5344('0x17')](function(_0xe1c211){if(!_0xe1c211)return[];return _0xe1c211[_0x5344('0x22')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x434e0d)[_0x5344('0x17')](function(_0x2fbe7a){var _0x437162=_(_0x2fbe7a)[_0x5344('0x23')]()['map']('id')['uniq']()[_0x5344('0x24')]();return _0x437162;});}exports[_0x5344('0x25')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3471a9,_0x28b50b,_0x494997){try{if(_0x28b50b[_0x5344('0x9')]>0x0){_0x3471a9=_0x3471a9[_0x5344('0x26')](function(_0xf4eafd){return _0x28b50b[_0x5344('0x27')](_0xf4eafd['id']);});}var _0x1867d6=_0x3471a9[_0x5344('0x26')](function(_0x40a526){var _0x4d87bc=_0x5344('0x1c');if(isAgentIdle(_0x40a526)){_0x4d87bc='idle';}return _0x4d87bc===_0x494997;});return _[_0x5344('0x20')](_0x1867d6,'id');}catch(_0x2ad28e){throw _0x2ad28e;}}exports[_0x5344('0x28')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xdaa060,_0x43a1e2,_0x175892){return Promise[_0x5344('0x29')]()[_0x5344('0x17')](function(){if(_0x43a1e2[_0x5344('0x9')]>0x0){_0xdaa060=_0xdaa060['filter'](function(_0x477639){return _0x43a1e2[_0x5344('0x27')](_0x477639['id']);});}return _0xdaa060;})[_0x5344('0x17')](function(){return db[_0x5344('0x2a')]['findAll']({'attributes':['id',_0x5344('0x2b'),_0x5344('0x2c'),'chatPause',_0x5344('0x6'),_0x5344('0x7'),'openchannelPause',_0x5344('0x2d'),_0x5344('0xf'),'whatsappPause',_0x5344('0x2e')],'where':{'id':{'$in':_[_0x5344('0x20')](_0xdaa060,'id')}},'raw':!![]});})['then'](function(_0x4655fa){return _0x4655fa[_0x5344('0x20')](function(_0x32220c){var _0x311198=_[_0x5344('0x2f')](_0xdaa060,['id',_0x32220c['id']]);var _0x593598=filterAgentAttributes(_0x311198);_['merge'](_0x32220c,_0x593598);_0x32220c[_0x5344('0x30')]=getAgentStatus(_0x32220c);return _0x32220c;});})['then'](function(_0x51a9aa){var _0x57a969=sortAgentsByStatus(_0x51a9aa,_0x175892);return _[_0x5344('0x20')](_0x57a969,'id');})[_0x5344('0x31')](function(_0x5e60e3){throw _0x5e60e3;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x25b6cb){var _0x51ca57={'fields':[],'order':null};var _0x5c2d1a=_0x25b6cb['split'](',');_0x51ca57[_0x5344('0x32')]=_[_0x5344('0x26')](_0x5c2d1a,function(_0x363622){if(!_0x363622[_0x5344('0x27')](_0x5344('0x30'))){return!![];}_0x51ca57['order']=_[_0x5344('0x33')](_0x363622,'-')?_0x5344('0x34'):_0x5344('0x35');return![];});return _0x51ca57;}exports[_0x5344('0x36')]=getUpdatedSortOptions;function validateSortParameter(_0x525088){if(!_0x525088){_0x525088=_0x5344('0x37');}if(_0x525088[_0x5344('0x27')](_0x5344('0x2c'))&&!_0x525088[_0x5344('0x27')](_0x5344('0x38'))){var _0x40fe19=_0x525088[_0x5344('0x39')](0x0,_0x525088[_0x5344('0x3a')]('fullname'));_0x525088+=','+_0x40fe19+_0x5344('0x38');}return _0x525088;}exports[_0x5344('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x3f3ce4,_0x1a209e){var _0x5655ce=_0x3f3ce4[_0x5344('0x3c')](function(_0x3b7fd6,_0x51720d){if(_0x3b7fd6[_0x5344('0x30')]===_0x51720d[_0x5344('0x30')]){if(_0x3b7fd6['globalStatus']===_0x5344('0x10')){if(_0x1a209e===_0x5344('0x34')){return(_0x3b7fd6['pauseType']||'')<(_0x51720d[_0x5344('0x2e')]||'')||_0x3b7fd6[_0x5344('0x2c')][_0x5344('0x3d')]()>_0x51720d[_0x5344('0x2c')][_0x5344('0x3d')]()?0x1:-0x1;}else{return(_0x3b7fd6[_0x5344('0x2e')]||'')<(_0x51720d[_0x5344('0x2e')]||'')||_0x3b7fd6[_0x5344('0x2c')]['toLowerCase']()>_0x51720d[_0x5344('0x2c')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x1a209e===_0x5344('0x34')){return _0x3b7fd6['fullname']['toLowerCase']()<_0x51720d[_0x5344('0x2c')]['toLowerCase']()?0x1:-0x1;}else{return _0x3b7fd6['fullname'][_0x5344('0x3d')]()<_0x51720d[_0x5344('0x2c')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x1a209e==='DESC'){return _0x3b7fd6[_0x5344('0x30')]<_0x51720d[_0x5344('0x30')]?0x1:-0x1;}else{return _0x3b7fd6[_0x5344('0x30')]<_0x51720d[_0x5344('0x30')]?-0x1:0x1;}}});return _0x5655ce;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x76e380){var _0x497413=[_0x5344('0x3e'),_0x5344('0x3f'),_0x5344('0x40'),_0x5344('0x41'),_0x5344('0x2e'),'lastPauseAt',_0x5344('0x38'),'address',_0x5344('0x5'),_0x5344('0x42'),'mailPause',_0x5344('0x2d'),_0x5344('0x43'),_0x5344('0x6'),_0x5344('0xf'),'chatCapacity',_0x5344('0x44'),_0x5344('0x45'),_0x5344('0x46'),_0x5344('0x47'),_0x5344('0x48'),'chatCurrentCapacity',_0x5344('0x49'),_0x5344('0x4a'),'smsCurrentCapacity',_0x5344('0x4b'),'faxCurrentCapacity',_0x5344('0x11'),_0x5344('0x4c'),_0x5344('0x4d'),_0x5344('0x12'),_0x5344('0x14'),_0x5344('0x4e'),_0x5344('0x13'),'chatStatusTime',_0x5344('0x4f'),_0x5344('0x50'),_0x5344('0x51'),_0x5344('0x52'),'faxStatusTime',_0x5344('0x53'),_0x5344('0x54'),_0x5344('0x55'),'screenrecording',_0x5344('0x56'),_0x5344('0x57')];var _0x678db5=['chatPause','openchannelPause',_0x5344('0x7'),_0x5344('0x2d'),_0x5344('0x43'),'faxPause',_0x5344('0xf'),_0x5344('0x3f')];var _0x30dc2f=_(_0x76e380)[_0x5344('0x58')](_0x678db5)[_0x5344('0x59')](_0x497413)[_0x5344('0x24')]();return _0x30dc2f;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x5344('0x2b'),_0x5344('0x2c'),_0x5344('0x5a'),_0x5344('0x38'),_0x5344('0x3f'),_0x5344('0x30'),_0x5344('0x3e'),_0x5344('0x40'),'pauseType','lastPauseAt',_0x5344('0x6'),_0x5344('0x5'),_0x5344('0x7'),'openchannelPause',_0x5344('0x2d'),_0x5344('0xf'),'whatsappPause',_0x5344('0x11'),_0x5344('0x4e'),_0x5344('0x4d'),'openchannelStatus','smsStatus',_0x5344('0x13'),'whatsappStatus','chatStatusTime',_0x5344('0x5b'),_0x5344('0x50'),_0x5344('0x4f'),_0x5344('0x51'),_0x5344('0x53'),_0x5344('0x52'),'chatCapacity',_0x5344('0x48'),_0x5344('0x45'),'openchannelCapacity',_0x5344('0x46'),_0x5344('0x47'),_0x5344('0x5c'),_0x5344('0x5d'),_0x5344('0x4a'),'openchannelCurrentCapacity',_0x5344('0x5e'),_0x5344('0x4b'),_0x5344('0x56'),_0x5344('0x57'),_0x5344('0x55'),_0x5344('0x5f'),_0x5344('0x54'),'screenrecording'];}exports[_0x5344('0x60')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 6f41b88..7e5c67d 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x92d4=['startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','getRealtimeQueues','inbound','concat','outbound','map','get','waiting','voice','find','merge','pick','lodash','jayson/promise','http','client','available','loggedIn','paused','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','talking','unavailable','unknown','originated','message','statusMessage','dialActive','Trunk'];(function(_0x410be8,_0x1b4d64){var _0x39a7af=function(_0x5d0153){while(--_0x5d0153){_0x410be8['push'](_0x410be8['shift']());}};_0x39a7af(++_0x1b4d64);}(_0x92d4,0x1d5));var _0x492d=function(_0x41fddf,_0x515090){_0x41fddf=_0x41fddf-0x0;var _0x362dad=_0x92d4[_0x41fddf];return _0x362dad;};'use strict';var _=require(_0x492d('0x0'));var jayson=require(_0x492d('0x1'));var util=require('util');var amiClient=jayson['client'][_0x492d('0x2')]({'port':0x232a});var routingClient=jayson[_0x492d('0x3')][_0x492d('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x492d('0x4'),_0x492d('0x5'),_0x492d('0x6'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x492d('0x7'),_0x492d('0x8'),_0x492d('0x9'),'notInUse',_0x492d('0xa'),_0x492d('0xb'),_0x492d('0xc'),_0x492d('0xd'),_0x492d('0xe'),_0x492d('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x492d('0x10'),_0x492d('0x11'),_0x492d('0x12'),_0x492d('0x13'),'dialMethod',_0x492d('0x14'),_0x492d('0x15'),_0x492d('0x16'),_0x492d('0x17'),_0x492d('0x18'),_0x492d('0x19'),_0x492d('0x1a'),_0x492d('0x1b'),_0x492d('0x1c'),_0x492d('0x1d'),'predictiveIntervalAvailable',_0x492d('0x1e'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x492d('0x1f'),'predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0xdf1c72,_0x552926){var _0x52860d=_0x552926==='voice'?amiClient:routingClient;return _0x52860d['request'](_[_0x492d('0x20')](_0x552926)+_0x492d('0x21'),_0xdf1c72)[_0x492d('0x22')](function(_0x32f2e5){if(_0x32f2e5[_0x492d('0x23')])throw new Error(util[_0x492d('0x24')](_0x492d('0x25'),_0x552926));return _0x32f2e5['result'];})['catch'](function(_0x13dc7e){throw _0x13dc7e;});}exports[_0x492d('0x26')]=getRealtimeQueues;function initializeQueues(_0x451f56,_0x20872f,_0x4f035c,_0x5eb9fe){var _0x39f5e2=DEFAULT_QUEUE_ATTRIBUTES;if(_0x4f035c==='voice'){if(_0x5eb9fe===_0x492d('0x27')){_0x39f5e2=_0x39f5e2[_0x492d('0x28')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x5eb9fe===_0x492d('0x29')){_0x39f5e2=_0x39f5e2[_0x492d('0x28')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x451f56[_0x492d('0x2a')](function(_0x3305c9){var _0x589dbc=_0x3305c9[_0x492d('0x2b')]({'plain':!![]});_0x589dbc['paused']=0x0;_0x589dbc[_0x492d('0x9')]=0x0;_0x589dbc['loggedIn']=0x0;_0x589dbc[_0x492d('0x4')]=0x0;_0x589dbc[_0x492d('0x2c')]=0x0;if(_0x4f035c===_0x492d('0x2d')){_0x589dbc[_0x492d('0xd')]=0x0;_0x589dbc['busy']=0x0;if(_0x5eb9fe===_0x492d('0x29')){_0x589dbc['pTalking']=0x0;_0x589dbc[_0x492d('0x10')]=0x0;}}var _0x133aec=_[_0x492d('0x2e')](_0x20872f,['id',_0x589dbc['id']]);if(_0x133aec){_[_0x492d('0x2f')](_0x589dbc,_[_0x492d('0x30')](_0x133aec,_0x39f5e2));}return _0x589dbc;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0xd6df=['error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','get','originated','find','merge','initializeQueues','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringInUse','talking','unavailable','unknown','pTalking','message','statusMessage','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then'];(function(_0x48686a,_0x4bbd26){var _0x45824b=function(_0x4b6ab8){while(--_0x4b6ab8){_0x48686a['push'](_0x48686a['shift']());}};_0x45824b(++_0x4bbd26);}(_0xd6df,0x181));var _0xfd6d=function(_0x5856c0,_0x4d2167){_0x5856c0=_0x5856c0-0x0;var _0x3a4627=_0xd6df[_0x5856c0];return _0x3a4627;};'use strict';var _=require('lodash');var jayson=require(_0xfd6d('0x0'));var util=require(_0xfd6d('0x1'));var amiClient=jayson[_0xfd6d('0x2')][_0xfd6d('0x3')]({'port':0x232a});var routingClient=jayson[_0xfd6d('0x2')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xfd6d('0x4'),_0xfd6d('0x5'),_0xfd6d('0x6'),_0xfd6d('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xfd6d('0x8'),_0xfd6d('0x9'),_0xfd6d('0xa'),_0xfd6d('0xb'),_0xfd6d('0xc'),_0xfd6d('0xd'),'ringing',_0xfd6d('0xe'),_0xfd6d('0xf'),_0xfd6d('0x10'),_0xfd6d('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xfd6d('0x12'),'originated',_0xfd6d('0x13'),_0xfd6d('0x14'),'dialActive','dialMethod',_0xfd6d('0x15'),_0xfd6d('0x16'),_0xfd6d('0x17'),_0xfd6d('0x18'),_0xfd6d('0x19'),_0xfd6d('0x1a'),_0xfd6d('0x1b'),_0xfd6d('0x1c'),_0xfd6d('0x1d'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0xfd6d('0x1e'),'predictiveIntervalAnsweredCalls',_0xfd6d('0x1f'),'predictiveIntervalDroppedCallsCallersExit',_0xfd6d('0x20'),_0xfd6d('0x21')];function getRealtimeQueues(_0x114582,_0x2b398b){var _0x35762f=_0x2b398b===_0xfd6d('0x22')?amiClient:routingClient;return _0x35762f[_0xfd6d('0x23')](_[_0xfd6d('0x24')](_0x2b398b)+_0xfd6d('0x25'),_0x114582)[_0xfd6d('0x26')](function(_0x313016){if(_0x313016[_0xfd6d('0x27')])throw new Error(util[_0xfd6d('0x28')](_0xfd6d('0x29'),_0x2b398b));return _0x313016[_0xfd6d('0x2a')];})[_0xfd6d('0x2b')](function(_0x2afcab){throw _0x2afcab;});}exports[_0xfd6d('0x2c')]=getRealtimeQueues;function initializeQueues(_0x446b75,_0x17f4a5,_0x1e37bd,_0x402f42){var _0x4738cb=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1e37bd===_0xfd6d('0x22')){if(_0x402f42===_0xfd6d('0x2d')){_0x4738cb=_0x4738cb[_0xfd6d('0x2e')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x402f42===_0xfd6d('0x2f')){_0x4738cb=_0x4738cb[_0xfd6d('0x2e')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x446b75['map'](function(_0x3cdb90){var _0xb2a9c8=_0x3cdb90[_0xfd6d('0x30')]({'plain':!![]});_0xb2a9c8[_0xfd6d('0x6')]=0x0;_0xb2a9c8[_0xfd6d('0xb')]=0x0;_0xb2a9c8[_0xfd6d('0x5')]=0x0;_0xb2a9c8[_0xfd6d('0x4')]=0x0;_0xb2a9c8['waiting']=0x0;if(_0x1e37bd===_0xfd6d('0x22')){_0xb2a9c8['talking']=0x0;_0xb2a9c8['busy']=0x0;if(_0x402f42===_0xfd6d('0x2f')){_0xb2a9c8['pTalking']=0x0;_0xb2a9c8[_0xfd6d('0x31')]=0x0;}}var _0x47fff2=_[_0xfd6d('0x32')](_0x17f4a5,['id',_0xb2a9c8['id']]);if(_0x47fff2){_[_0xfd6d('0x33')](_0xb2a9c8,_['pick'](_0x47fff2,_0x4738cb));}return _0xb2a9c8;});}exports[_0xfd6d('0x34')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 5d654ff..7d0b657 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x1a1ebc,_0x142e7e){var _0x1932fc=function(_0x2b3228){while(--_0x2b3228){_0x1a1ebc['push'](_0x1a1ebc['shift']());}};_0x1932fc(++_0x142e7e);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x1ae417,_0x1b11dc){var _0x5ae66c=function(_0x58a91f){while(--_0x58a91f){_0x1ae417['push'](_0x1ae417['shift']());}};_0x5ae66c(++_0x1b11dc);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 09ba0a3..d847912 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 _0xc4ea=['substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','filter','family','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','createHash','update','hex','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','md5','digest'];(function(_0x29b90f,_0x1f6cb5){var _0x5672d1=function(_0x1d1dea){while(--_0x1d1dea){_0x29b90f['push'](_0x29b90f['shift']());}};_0x5672d1(++_0x1f6cb5);}(_0xc4ea,0xdf));var _0xac4e=function(_0x35bd45,_0x16b749){_0x35bd45=_0x35bd45-0x0;var _0x403334=_0xc4ea[_0x35bd45];return _0x403334;};'use strict';var _=require(_0xac4e('0x0'));var os=require('os');var crypto=require(_0xac4e('0x1'));var machine=require(_0xac4e('0x2'));var exec=require(_0xac4e('0x3'))[_0xac4e('0x4')];var config=require(_0xac4e('0x5'));function getInterfaces(){var _0x52bca1=[];var _0x3d975c=os[_0xac4e('0x6')]();var _0x2884ee=_[_0xac4e('0x7')](_['keys'](_0x3d975c));for(var _0xb9afcf=0x0;_0xb9afcf<_0x2884ee[_0xac4e('0x8')];_0xb9afcf++){var _0xcfe73b=_0x3d975c[_0x2884ee[_0xb9afcf]][_0xac4e('0x9')](function(_0x62b59b){return _0x62b59b[_0xac4e('0xa')]==='IPv4'&&_0x62b59b['internal']===![];});_0x52bca1=_0x52bca1[_0xac4e('0xb')](_0xcfe73b);}return _0x52bca1;}function getFirstInterface(){var _0x2b6c48=_[_0xac4e('0xc')](getInterfaces());return{'macAddress':_0x2b6c48&&_0x2b6c48[_0xac4e('0xd')]?_0x2b6c48[_0xac4e('0xd')]:_0xac4e('0xe'),'ipAddress':_0x2b6c48&&_0x2b6c48[_0xac4e('0xf')]?_0x2b6c48[_0xac4e('0xf')]:_0xac4e('0x10')};}exports[_0xac4e('0x11')]=getFirstInterface;function getCPUhash(){var _0x33aff7=_[_0xac4e('0x7')](os[_0xac4e('0x12')]()['map'](function(_0x20571d){return _0x20571d[_0xac4e('0x13')];}))['join'](':');return crypto[_0xac4e('0x14')]('md5')[_0xac4e('0x15')](_0x33aff7)['digest'](_0xac4e('0x16'));}exports[_0xac4e('0x17')]=function(){var _0x2bbdf8=os[_0xac4e('0x18')]();var _0x58f6a0=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x58f6a0[_0xac4e('0x19')](config['licenseToken'])){return config[_0xac4e('0x1a')];}else if(_0x2bbdf8===_0xac4e('0x1b')){return exec(_0xac4e('0x1c'),{'encoding':_0xac4e('0x1d')})[_0xac4e('0x1e')]('\x0d\x0a','');}else{var _0xeca23e=getFirstInterface();var _0x4dc05e=getCPUhash();var _0x4f5bfc=_0x4dc05e+'|'+os[_0xac4e('0x1f')]()+'|'+_0xeca23e[_0xac4e('0x20')]+'|'+_0xeca23e[_0xac4e('0x21')];var _0xa10ccc=crypto[_0xac4e('0x14')](_0xac4e('0x22'))['update'](_0x4f5bfc)[_0xac4e('0x23')](_0xac4e('0x16'));return _0xa10ccc[_0xac4e('0x24')](0x0,0x8)+'-'+_0xa10ccc[_0xac4e('0x24')](0x8,0xc)+'-'+_0xa10ccc[_0xac4e('0x24')](0xc,0x10)+'-'+_0xa10ccc[_0xac4e('0x24')](0x10,0x14)+'-'+_0xa10ccc[_0xac4e('0x24')](0x14);}}; \ No newline at end of file +var _0xcf28=['utf8','replace','hostname','ipAddress','md5','update','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','digest','hex','getUuid','test','licenseToken','dmidecode\x20--string\x20system-uuid'];(function(_0x370eb5,_0x568fa3){var _0x28852f=function(_0x4e32f0){while(--_0x4e32f0){_0x370eb5['push'](_0x370eb5['shift']());}};_0x28852f(++_0x568fa3);}(_0xcf28,0x1b7));var _0x8cf2=function(_0x108a63,_0x350742){_0x108a63=_0x108a63-0x0;var _0x4d4254=_0xcf28[_0x108a63];return _0x4d4254;};'use strict';var _=require(_0x8cf2('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x8cf2('0x1'));var exec=require(_0x8cf2('0x2'))[_0x8cf2('0x3')];var config=require(_0x8cf2('0x4'));function getInterfaces(){var _0xc3ceca=[];var _0x424678=os[_0x8cf2('0x5')]();var _0x4c794a=_[_0x8cf2('0x6')](_[_0x8cf2('0x7')](_0x424678));for(var _0x12bd46=0x0;_0x12bd46<_0x4c794a[_0x8cf2('0x8')];_0x12bd46++){var _0x4de964=_0x424678[_0x4c794a[_0x12bd46]][_0x8cf2('0x9')](function(_0xff63c7){return _0xff63c7[_0x8cf2('0xa')]===_0x8cf2('0xb')&&_0xff63c7['internal']===![];});_0xc3ceca=_0xc3ceca[_0x8cf2('0xc')](_0x4de964);}return _0xc3ceca;}function getFirstInterface(){var _0x5d4d44=_[_0x8cf2('0xd')](getInterfaces());return{'macAddress':_0x5d4d44&&_0x5d4d44[_0x8cf2('0xe')]?_0x5d4d44['mac']:_0x8cf2('0xf'),'ipAddress':_0x5d4d44&&_0x5d4d44['address']?_0x5d4d44['address']:_0x8cf2('0x10')};}exports[_0x8cf2('0x11')]=getFirstInterface;function getCPUhash(){var _0x59e0a3=_[_0x8cf2('0x6')](os[_0x8cf2('0x12')]()[_0x8cf2('0x13')](function(_0xa04ad2){return _0xa04ad2[_0x8cf2('0x14')];}))[_0x8cf2('0x15')](':');return crypto[_0x8cf2('0x16')]('md5')['update'](_0x59e0a3)[_0x8cf2('0x17')](_0x8cf2('0x18'));}exports[_0x8cf2('0x19')]=function(){var _0xa4b4fc=os['platform']();var _0x8d34f4=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x8d34f4[_0x8cf2('0x1a')](config[_0x8cf2('0x1b')])){return config[_0x8cf2('0x1b')];}else if(_0xa4b4fc==='win32'){return exec(_0x8cf2('0x1c'),{'encoding':_0x8cf2('0x1d')})[_0x8cf2('0x1e')]('\x0d\x0a','');}else{var _0x176d0b=getFirstInterface();var _0x3cd607=getCPUhash();var _0x4ba85e=_0x3cd607+'|'+os[_0x8cf2('0x1f')]()+'|'+_0x176d0b['macAddress']+'|'+_0x176d0b[_0x8cf2('0x20')];var _0x2f8ae6=crypto[_0x8cf2('0x16')](_0x8cf2('0x21'))[_0x8cf2('0x22')](_0x4ba85e)[_0x8cf2('0x17')]('hex');return _0x2f8ae6[_0x8cf2('0x23')](0x0,0x8)+'-'+_0x2f8ae6[_0x8cf2('0x23')](0x8,0xc)+'-'+_0x2f8ae6[_0x8cf2('0x23')](0xc,0x10)+'-'+_0x2f8ae6[_0x8cf2('0x23')](0x10,0x14)+'-'+_0x2f8ae6[_0x8cf2('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 52060d7..0657a14 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 _0x7798=['message','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','version','../../mysqldb','./hardware','license','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','data2','data1','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','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','encryptString','YYYY-MM-DD\x20HH:mm','decryptString','days','DEMO\x20START\x20AT\x20%s','error'];(function(_0x2badd4,_0x5586ef){var _0x44bf8e=function(_0x50986e){while(--_0x50986e){_0x2badd4['push'](_0x2badd4['shift']());}};_0x44bf8e(++_0x5586ef);}(_0x7798,0x163));var _0x8779=function(_0x20029c,_0x42e8e2){_0x20029c=_0x20029c-0x0;var _0x1f602e=_0x7798[_0x20029c];return _0x1f602e;};'use strict';var util=require(_0x8779('0x0'));var moment=require(_0x8779('0x1'));var rp=require(_0x8779('0x2'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x8779('0x3'));var db=require(_0x8779('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x8779('0x5'));var logger=require('../logger')(_0x8779('0x6'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x36ab1f){return new BPromise(function(_0x4a5f7c,_0x79a863){var _0x501531=util[_0x8779('0x7')](_0x8779('0x8'),HOST,_0x36ab1f,module[_0x8779('0x9')][_0x8779('0x3')]);if(oldToken){_0x501531=util[_0x8779('0x7')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x36ab1f,module[_0x8779('0x9')][_0x8779('0x3')],oldToken);}var _0x217bdb={'uri':_0x501531,'method':_0x8779('0xa'),'timeout':0xea60,'json':!![]};return rp(_0x217bdb)[_0x8779('0xb')](function(_0x55b5d5){_0x4a5f7c(_0x55b5d5);})[_0x8779('0xc')](function(_0x3eb5d5){_0x79a863(_0x3eb5d5);});});}function manageLicense(_0x204516,_0x3cafb9){var _0x35cf9e=_0x3cafb9['get']({'plain':!![]});if(!isOldTokenSent&&_0x35cf9e['data1']!==_0x204516&&!_0x35cf9e[_0x8779('0xd')]){oldToken=_0x35cf9e[_0x8779('0xe')];}httpRequest(_0x204516)[_0x8779('0xb')](function(_0x5abf51){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5abf51['active']){isOldTokenSent=![];if(!_0x35cf9e[_0x8779('0x6')]&&_0x35cf9e[_0x8779('0x6')]!=_0x5abf51[_0x8779('0x6')]||_0x35cf9e[_0x8779('0x6')]&&_0x35cf9e[_0x8779('0xd')]){logger[_0x8779('0xf')](_0x8779('0x10'));}if(_0x35cf9e[_0x8779('0x6')]&&!_0x35cf9e[_0x8779('0xd')]&&_0x35cf9e['license']!=_0x5abf51[_0x8779('0x6')]){logger[_0x8779('0xf')](_0x8779('0x11'));}if(_0x35cf9e['license']&&!_0x35cf9e[_0x8779('0xd')]&&_0x35cf9e[_0x8779('0x6')]==_0x5abf51[_0x8779('0x6')]){return _0x3cafb9;}return _0x3cafb9[_0x8779('0x12')]({'data1':_0x204516,'data2':null,'license':_0x5abf51[_0x8779('0x6')]});}else{if(_0x5abf51[_0x8779('0x6')]||_0x35cf9e[_0x8779('0x6')]){if(!_0x35cf9e['data2']){if(_0x35cf9e[_0x8779('0xe')]==_0x204516){GRAY_PERIOD_REASON=_0x8779('0x13');logger[_0x8779('0xf')](_0x8779('0x14'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x8779('0xf')](_0x8779('0x15'),_0x35cf9e[_0x8779('0xe')],_0x204516);}logger[_0x8779('0xf')](_0x8779('0x16'),GRAY_PERIOD_REASON[_0x8779('0x17')](),moment()[_0x8779('0x7')]('YYYY-MM-DD\x20HH:mm'));return _0x3cafb9['update']({'data2':encryptor[_0x8779('0x18')](moment()['format'](_0x8779('0x19')))});}else{if(moment()['diff'](encryptor[_0x8779('0x1a')](_0x35cf9e[_0x8779('0xd')]),_0x8779('0x1b'))>DAYS){logger[_0x8779('0xf')](_0x8779('0x1c'),moment()[_0x8779('0x7')](_0x8779('0x19')));isOldTokenSent=![];return _0x3cafb9[_0x8779('0x12')]({'data1':_0x204516,'data2':null,'license':null});}}}else{if(_0x35cf9e[_0x8779('0xe')]!=_0x204516){logger[_0x8779('0xf')](_0x8779('0x15'),_0x35cf9e[_0x8779('0xe')],_0x204516);return _0x3cafb9[_0x8779('0x12')]({'data1':_0x204516,'data2':null,'license':null});}}}return _0x3cafb9;})[_0x8779('0xb')](function(_0x5b2516){_0x3cafb9=_0x5b2516;})[_0x8779('0xc')](function(_0x177fd1){logger[_0x8779('0x1d')](_0x177fd1[_0x8779('0x1e')]);})[_0x8779('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0x8779('0x20')](),_0x3cafb9);},TIME);});}function defaultLicense(){var _0x36f7a4=hardware[_0x8779('0x20')]();if(_0x36f7a4){return db['License'][_0x8779('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x36f7a4}})['spread'](function(_0x95d447,_0xe4e4c3){logger[_0x8779('0xf')](_0x8779('0x22'),_0x36f7a4);manageLicense(_0x36f7a4,_0x95d447);})[_0x8779('0xc')](function(_0x4cf554){logger[_0x8779('0x1d')](_0x4cf554[_0x8779('0x1e')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x087d=['default','util','moment','request-promise','bluebird','pkginfo','version','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data2','data1','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','finally','getUuid','spread','message'];(function(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0x087d,0xa5));var _0xd087=function(_0x233f44,_0x148a02){_0x233f44=_0x233f44-0x0;var _0x32349c=_0x087d[_0x233f44];return _0x32349c;};'use strict';var util=require(_0xd087('0x0'));var moment=require(_0xd087('0x1'));var rp=require(_0xd087('0x2'));var BPromise=require(_0xd087('0x3'));var pkginfo=require(_0xd087('0x4'))(module,_0xd087('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xd087('0x6'));var logger=require(_0xd087('0x7'))(_0xd087('0x8'));var HOST=_0xd087('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x55bb85){return new BPromise(function(_0x6e321d,_0x515a0d){var _0x48880d=util[_0xd087('0xa')](_0xd087('0xb'),HOST,_0x55bb85,module[_0xd087('0xc')][_0xd087('0x5')]);if(oldToken){_0x48880d=util[_0xd087('0xa')](_0xd087('0xd'),HOST,_0x55bb85,module['exports']['version'],oldToken);}var _0x465796={'uri':_0x48880d,'method':_0xd087('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x465796)[_0xd087('0xf')](function(_0x30a41e){_0x6e321d(_0x30a41e);})['catch'](function(_0x52a959){_0x515a0d(_0x52a959);});});}function manageLicense(_0x5f125d,_0xfcbc70){var _0x53f211=_0xfcbc70[_0xd087('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x53f211['data1']!==_0x5f125d&&!_0x53f211[_0xd087('0x11')]){oldToken=_0x53f211[_0xd087('0x12')];}httpRequest(_0x5f125d)[_0xd087('0xf')](function(_0x112ead){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x112ead[_0xd087('0x13')]){isOldTokenSent=![];if(!_0x53f211[_0xd087('0x8')]&&_0x53f211[_0xd087('0x8')]!=_0x112ead['license']||_0x53f211[_0xd087('0x8')]&&_0x53f211[_0xd087('0x11')]){logger['info'](_0xd087('0x14'));}if(_0x53f211[_0xd087('0x8')]&&!_0x53f211[_0xd087('0x11')]&&_0x53f211[_0xd087('0x8')]!=_0x112ead['license']){logger[_0xd087('0x15')](_0xd087('0x16'));}if(_0x53f211[_0xd087('0x8')]&&!_0x53f211[_0xd087('0x11')]&&_0x53f211[_0xd087('0x8')]==_0x112ead['license']){return _0xfcbc70;}return _0xfcbc70['update']({'data1':_0x5f125d,'data2':null,'license':_0x112ead['license']});}else{if(_0x112ead[_0xd087('0x8')]||_0x53f211[_0xd087('0x8')]){if(!_0x53f211[_0xd087('0x11')]){if(_0x53f211[_0xd087('0x12')]==_0x5f125d){GRAY_PERIOD_REASON=_0xd087('0x17');logger[_0xd087('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xd087('0x18');logger[_0xd087('0x15')](_0xd087('0x19'),_0x53f211[_0xd087('0x12')],_0x5f125d);}logger[_0xd087('0x15')](_0xd087('0x1a'),GRAY_PERIOD_REASON[_0xd087('0x1b')](),moment()[_0xd087('0xa')](_0xd087('0x1c')));return _0xfcbc70[_0xd087('0x1d')]({'data2':encryptor['encryptString'](moment()['format'](_0xd087('0x1c')))});}else{if(moment()[_0xd087('0x1e')](encryptor[_0xd087('0x1f')](_0x53f211[_0xd087('0x11')]),_0xd087('0x20'))>DAYS){logger['info'](_0xd087('0x21'),moment()[_0xd087('0xa')](_0xd087('0x1c')));isOldTokenSent=![];return _0xfcbc70[_0xd087('0x1d')]({'data1':_0x5f125d,'data2':null,'license':null});}}}else{if(_0x53f211[_0xd087('0x12')]!=_0x5f125d){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x53f211[_0xd087('0x12')],_0x5f125d);return _0xfcbc70['update']({'data1':_0x5f125d,'data2':null,'license':null});}}}return _0xfcbc70;})[_0xd087('0xf')](function(_0x243734){_0xfcbc70=_0x243734;})[_0xd087('0x22')](function(_0x2a51b4){logger[_0xd087('0x23')](_0x2a51b4['message']);})[_0xd087('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0xd087('0x25')](),_0xfcbc70);},TIME);});}function defaultLicense(){var _0x2a687a=hardware[_0xd087('0x25')]();if(_0x2a687a){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x2a687a}})[_0xd087('0x26')](function(_0x234a8a,_0x4a7a92){logger[_0xd087('0x15')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x2a687a);manageLicense(_0x2a687a,_0x234a8a);})[_0xd087('0x22')](function(_0x148e3d){logger['error'](_0x148e3d[_0xd087('0x27')]);});}}exports[_0xd087('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 07fc4db..6b91a58 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 _0x14e4=['../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','%s:%s:%s','demo','machineUuid','decryptString','deadline','add','days','grayReason','changed','message','User','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','moment','bluebird'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x14e4,0xe3));var _0x414e=function(_0x55ab01,_0x4c2047){_0x55ab01=_0x55ab01-0x0;var _0xb2d23c=_0x14e4[_0x55ab01];return _0xb2d23c;};'use strict';var util=require(_0x414e('0x0'));var _=require('lodash');var moment=require(_0x414e('0x1'));var BPromise=require(_0x414e('0x2'));var hardware=require('./hardware');var encryptor=require(_0x414e('0x3'));var db=require(_0x414e('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x414e('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x414e('0x6'),'machineUuid':hardware[_0x414e('0x7')](),'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':_0x414e('0x8'),'machineUuid':hardware[_0x414e('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xc33421){return new BPromise(function(_0x51ae31,_0x2384d6){return db[_0x414e('0x9')][_0x414e('0xa')](_['defaults'](_0xc33421,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x30b9f3){return checkLicense(_0x30b9f3,null);})[_0x414e('0xb')](function(_0x39bfe6){_0x51ae31(_0x39bfe6);return;})['catch'](function(_0x370351){_0x2384d6(_0x370351);});});}function checkLicense(_0x51767b,_0x9c7f23){if(!_0x51767b){demoLicense[_0x414e('0xc')]=_0x51767b[_0x414e('0xd')];return demoLicense;}try{var _0xf5bca8=_0x9c7f23||_0x51767b[_0x414e('0xe')];if(_[_0x414e('0xf')](_0xf5bca8)){throw new Error(_0x414e('0x10'));}var _0x197078=_0x51767b['data1'];var _0x9758da=_0x51767b[_0x414e('0x11')];var _0x3fa88c=_0x197078['split']('-')[0x4];var _0x55576d=_0x197078[_0x414e('0x12')]('-')[0x0];var _0x42c9d2=encryptor['decryptString'](_0xf5bca8,util['format'](_0x414e('0x13'),_0x3fa88c,_0x197078,_0x55576d));var _0x2f195e=JSON['parse'](_0x42c9d2);_0x2f195e[_0x414e('0x14')]=![];_0x2f195e[_0x414e('0xc')]=_0x197078;_0x2f195e[_0x414e('0x15')]=hardware['getUuid']();if(_0x9758da){var _0x15eb35=encryptor[_0x414e('0x16')](_0x9758da);_0x2f195e['gray']=_0x15eb35;_0x2f195e[_0x414e('0x17')]=moment(_0x15eb35)[_0x414e('0x18')](0x7,_0x414e('0x19'))['format']();_0x2f195e[_0x414e('0x1a')]=_0x2f195e[_0x414e('0xc')]!=_0x2f195e[_0x414e('0x15')]?_0x414e('0x1b'):'disabled';}return _0x2f195e;}catch(_0x5d1903){breakingLicense[_0x414e('0xc')]=_0x51767b[_0x414e('0xd')];breakingLicense[_0x414e('0x1c')]=_0x5d1903[_0x414e('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x106773,_0x3bdb1c){getLicense()[_0x414e('0xb')](function(_0x50ed1c){return db[_0x414e('0x1d')]['findAll']({'attributes':[_0x414e('0x1e'),[db[_0x414e('0x1f')]['fn'](_0x414e('0x20'),db[_0x414e('0x1f')][_0x414e('0x21')]('role')),_0x414e('0x22')]],'group':'role','where':{'role':{'$or':[_0x414e('0x23'),_0x414e('0x24'),_0x414e('0x25')]}},'raw':!![]})[_0x414e('0xb')](function(_0x3733eb){var _0x2dc7f6={'user':_0x50ed1c[_0x414e('0x26')]||0x0,'telephone':_0x50ed1c[_0x414e('0x27')]||0x0};_0x3733eb[_0x414e('0x28')](function(_0x1ecf42){var _0x5bc717=_0x1ecf42[_0x414e('0x1e')]===_0x414e('0x23')?_0x414e('0x24'):_0x1ecf42[_0x414e('0x1e')];_0x2dc7f6[_0x5bc717]-=_0x1ecf42['count'];if(_0x2dc7f6[_0x5bc717]<0x0)_0x2dc7f6[_0x5bc717]=0x0;});_0x106773(_0x2dc7f6);return;});})[_0x414e('0x29')](function(_0x1ec904){_0x3bdb1c(_0x1ec904);});});}function checkUserLimits(_0x575b08){return new BPromise(function(_0x1afaa3,_0x553034){getLimits()[_0x414e('0xb')](function(_0x27d1c7){var _0x2b5e4f=_[_0x414e('0x2a')](_[_0x414e('0x2b')](_0x575b08,_0x414e('0x1e')),[_0x414e('0x23'),'user',_0x414e('0x25')]);var _0x3d5824=(_0x2b5e4f[_0x414e('0x23')]||0x0)+(_0x2b5e4f['user']||0x0);var _0x52452b=_0x2b5e4f[_0x414e('0x25')]||0x0;if(_0x3d5824>_0x27d1c7[_0x414e('0x24')])return _0x553034(_0x414e('0x2c'));if(_0x52452b>_0x27d1c7[_0x414e('0x25')])return _0x553034('License\x20limit\x20reached\x20for\x20telephones');return _0x1afaa3();})['catch'](function(_0x496b0a){_0x553034(_0x496b0a);});});}module[_0x414e('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x28d0=['col','admin','telephone','users','telephones','forEach','user','count','catch','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','parse','uuid','machineUuid','decryptString','deadline','add','days','grayReason','disabled','message','User','findAll','role','COUNT','sequelize'];(function(_0x48884c,_0x32cca4){var _0x3a2b8e=function(_0x52788e){while(--_0x52788e){_0x48884c['push'](_0x48884c['shift']());}};_0x3a2b8e(++_0x32cca4);}(_0x28d0,0x16b));var _0x028d=function(_0x156a6e,_0x4078ea){_0x156a6e=_0x156a6e-0x0;var _0x1bab0a=_0x28d0[_0x156a6e];return _0x1bab0a;};'use strict';var util=require('util');var _=require(_0x028d('0x0'));var moment=require(_0x028d('0x1'));var BPromise=require(_0x028d('0x2'));var hardware=require(_0x028d('0x3'));var encryptor=require(_0x028d('0x4'));var db=require(_0x028d('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x028d('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x028d('0x7'),'machineUuid':hardware[_0x028d('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x028d('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x028d('0x9'),'machineUuid':hardware[_0x028d('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4c2554){return new BPromise(function(_0x32c4df,_0x302dde){return db[_0x028d('0xa')][_0x028d('0xb')](_[_0x028d('0xc')](_0x4c2554,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x269b83){return checkLicense(_0x269b83,null);})[_0x028d('0xd')](function(_0x36fd2f){_0x32c4df(_0x36fd2f);return;})['catch'](function(_0x21750b){_0x302dde(_0x21750b);});});}function checkLicense(_0x3c6138,_0x373b52){if(!_0x3c6138){demoLicense['uuid']=_0x3c6138[_0x028d('0xe')];return demoLicense;}try{var _0x49a25b=_0x373b52||_0x3c6138[_0x028d('0xf')];if(_[_0x028d('0x10')](_0x49a25b)){throw new Error(_0x028d('0x11'));}var _0x9d2cd7=_0x3c6138[_0x028d('0xe')];var _0x2d1be0=_0x3c6138[_0x028d('0x12')];var _0x5a602b=_0x9d2cd7['split']('-')[0x4];var _0x7e4537=_0x9d2cd7[_0x028d('0x13')]('-')[0x0];var _0xf7809=encryptor['decryptString'](_0x49a25b,util[_0x028d('0x14')](_0x028d('0x15'),_0x5a602b,_0x9d2cd7,_0x7e4537));var _0x49044b=JSON[_0x028d('0x16')](_0xf7809);_0x49044b['demo']=![];_0x49044b[_0x028d('0x17')]=_0x9d2cd7;_0x49044b[_0x028d('0x18')]=hardware[_0x028d('0x8')]();if(_0x2d1be0){var _0x56c1ec=encryptor[_0x028d('0x19')](_0x2d1be0);_0x49044b['gray']=_0x56c1ec;_0x49044b[_0x028d('0x1a')]=moment(_0x56c1ec)[_0x028d('0x1b')](0x7,_0x028d('0x1c'))[_0x028d('0x14')]();_0x49044b[_0x028d('0x1d')]=_0x49044b['uuid']!=_0x49044b[_0x028d('0x18')]?'changed':_0x028d('0x1e');}return _0x49044b;}catch(_0x1ea453){breakingLicense[_0x028d('0x17')]=_0x3c6138[_0x028d('0xe')];breakingLicense[_0x028d('0x1f')]=_0x1ea453[_0x028d('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xfc51e3,_0x21f3f7){getLicense()['then'](function(_0x19099f){return db[_0x028d('0x20')][_0x028d('0x21')]({'attributes':[_0x028d('0x22'),[db['sequelize']['fn'](_0x028d('0x23'),db[_0x028d('0x24')][_0x028d('0x25')](_0x028d('0x22'))),'count']],'group':_0x028d('0x22'),'where':{'role':{'$or':[_0x028d('0x26'),'user',_0x028d('0x27')]}},'raw':!![]})[_0x028d('0xd')](function(_0x45ffc8){var _0xb50f8b={'user':_0x19099f[_0x028d('0x28')]||0x0,'telephone':_0x19099f[_0x028d('0x29')]||0x0};_0x45ffc8[_0x028d('0x2a')](function(_0x45f9cf){var _0x35e2bd=_0x45f9cf[_0x028d('0x22')]===_0x028d('0x26')?_0x028d('0x2b'):_0x45f9cf[_0x028d('0x22')];_0xb50f8b[_0x35e2bd]-=_0x45f9cf[_0x028d('0x2c')];if(_0xb50f8b[_0x35e2bd]<0x0)_0xb50f8b[_0x35e2bd]=0x0;});_0xfc51e3(_0xb50f8b);return;});})[_0x028d('0x2d')](function(_0x31a576){_0x21f3f7(_0x31a576);});});}function checkUserLimits(_0x13d5e1){return new BPromise(function(_0x48df86,_0x51c36b){getLimits()['then'](function(_0x30fe83){var _0x23450c=_[_0x028d('0x2e')](_['countBy'](_0x13d5e1,_0x028d('0x22')),[_0x028d('0x26'),_0x028d('0x2b'),_0x028d('0x27')]);var _0x2c9182=(_0x23450c['admin']||0x0)+(_0x23450c[_0x028d('0x2b')]||0x0);var _0x4c98c1=_0x23450c[_0x028d('0x27')]||0x0;if(_0x2c9182>_0x30fe83[_0x028d('0x2b')])return _0x51c36b(_0x028d('0x2f'));if(_0x4c98c1>_0x30fe83['telephone'])return _0x51c36b(_0x028d('0x30'));return _0x48df86();})[_0x028d('0x2d')](function(_0x3d7ed0){_0x51c36b(_0x3d7ed0);});});}module[_0x028d('0x31')]={'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 93924b3..dd1875a 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 _0x757a=['http://localhost:9000','myappanuglar-secret'];(function(_0x5d5656,_0x1b3b4d){var _0x18fc5a=function(_0x16346d){while(--_0x16346d){_0x5d5656['push'](_0x5d5656['shift']());}};_0x18fc5a(++_0x1b3b4d);}(_0x757a,0xde));var _0xa757=function(_0x48d050,_0x4cfc97){_0x48d050=_0x48d050-0x0;var _0x295352=_0x757a[_0x48d050];return _0x295352;};'use strict';module['exports']={'DOMAIN':_0xa757('0x0'),'SESSION_SECRET':_0xa757('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0xfb11=['exports','myappanuglar-secret','app-id'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xfb11[_0x8de54f];return _0x14cba4;};'use strict';module[_0x1fb1('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x1fb1('0x1'),'GOOGLE_ID':_0x1fb1('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 3024e77..5abdb06 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e16=['fileLogger','exports'];(function(_0x373dbc,_0x4d99c4){var _0x43de6f=function(_0x48cddc){while(--_0x48cddc){_0x373dbc['push'](_0x373dbc['shift']());}};_0x43de6f(++_0x4d99c4);}(_0x9e16,0x108));var _0x69e1=function(_0x233b58,_0x2ec725){_0x233b58=_0x233b58-0x0;var _0x378722=_0x9e16[_0x233b58];return _0x378722;};'use strict';var fileLogger=require('../utils/loggers')[_0x69e1('0x0')];module[_0x69e1('0x1')]=fileLogger; \ No newline at end of file +var _0x63bd=['../utils/loggers','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x63bd,0xf6));var _0xd63b=function(_0x2358ef,_0x1d1e30){_0x2358ef=_0x2358ef-0x0;var _0x1ee6ab=_0x63bd[_0x2358ef];return _0x1ee6ab;};'use strict';var fileLogger=require(_0xd63b('0x0'))['fileLogger'];module[_0xd63b('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 627a495..42a9ff5 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 _0xcc7b=['path','resolve','join','root','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','xdr','exports'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xcc7b,0x10a));var _0xbcc7=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcc7b[_0xfae23b];return _0x200640;};'use strict';var path=require(_0xbcc7('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0xbcc7('0x1')](path[_0xbcc7('0x2')](cfg[_0xbcc7('0x3')],'legacy-libs'))};var pm2config={'apps':[{'name':'express','script':path['join'](__dirname,_0xbcc7('0x4')),'env':env},{'name':_0xbcc7('0x5'),'script':path[_0xbcc7('0x2')](__dirname,_0xbcc7('0x6')),'env':env},{'name':_0xbcc7('0x7'),'script':path[_0xbcc7('0x2')](__dirname,_0xbcc7('0x8')),'env':env},{'name':_0xbcc7('0x9'),'script':path['join'](__dirname,_0xbcc7('0xa')),'env':env},{'name':_0xbcc7('0xb'),'script':path[_0xbcc7('0x2')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0xbcc7('0xc'),'script':path[_0xbcc7('0x2')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0xbcc7('0xd')]=pm2config; \ No newline at end of file +var _0x3044=['../../services/agi/index.js','email','../../services/email/index.js','xdr','../../services/xdr/index.js','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js'];(function(_0x5cdacf,_0x7c82b1){var _0xa68a8b=function(_0x4b3818){while(--_0x4b3818){_0x5cdacf['push'](_0x5cdacf['shift']());}};_0xa68a8b(++_0x7c82b1);}(_0x3044,0x130));var _0x4304=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x3044[_0x2283dc];return _0x16db90;};'use strict';var path=require('path');var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x4304('0x0')](path[_0x4304('0x1')](cfg[_0x4304('0x2')],_0x4304('0x3')))};var pm2config={'apps':[{'name':_0x4304('0x4'),'script':path[_0x4304('0x1')](__dirname,_0x4304('0x5')),'env':env},{'name':_0x4304('0x6'),'script':path[_0x4304('0x1')](__dirname,_0x4304('0x7')),'env':env},{'name':'agi','script':path[_0x4304('0x1')](__dirname,_0x4304('0x8')),'env':env},{'name':_0x4304('0x9'),'script':path['join'](__dirname,_0x4304('0xa')),'env':env},{'name':'routing','script':path['join'](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x4304('0xb'),'script':path[_0x4304('0x1')](__dirname,_0x4304('0xc')),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 9c13d10..3e1041f 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 _0xc431=['stop','restart','list','describe','delete','dump','saved','pm2','./config','connected','start','then','disconnect'];(function(_0xaf0b2d,_0x36647d){var _0xe30078=function(_0x417867){while(--_0x417867){_0xaf0b2d['push'](_0xaf0b2d['shift']());}};_0xe30078(++_0x36647d);}(_0xc431,0x89));var _0x1c43=function(_0x20d46d,_0x3c5c72){_0x20d46d=_0x20d46d-0x0;var _0x208abd=_0xc431[_0x20d46d];return _0x208abd;};'use strict';var pm2=require(_0x1c43('0x0'));var BPromise=require('bluebird');var config=require(_0x1c43('0x1'));function connect(){return new BPromise(function(_0x5d1988,_0x250bab){return pm2['connect'](function(_0x35508e){if(_0x35508e){return _0x250bab(_0x35508e);}return _0x5d1988(_0x1c43('0x2'));});});};exports[_0x1c43('0x3')]=function(_0x5a25ad){return connect()[_0x1c43('0x4')](function(){return new BPromise(function(_0x30ffd4,_0x1c3dfd){return pm2[_0x1c43('0x3')](_0x5a25ad,function(_0x14ae14,_0x5f090a){if(_0x14ae14){return _0x1c3dfd(_0x14ae14);}pm2[_0x1c43('0x5')]();return _0x30ffd4(_0x5f090a);});});});};exports[_0x1c43('0x6')]=function(_0x2e0261){return connect()[_0x1c43('0x4')](function(){return new BPromise(function(_0x4124b8,_0x380e37){return pm2[_0x1c43('0x6')](_0x2e0261,function(_0x487e13,_0x21bdbe){if(_0x487e13){return _0x380e37(_0x487e13);}pm2[_0x1c43('0x5')]();return _0x4124b8(_0x21bdbe);});});});};exports[_0x1c43('0x7')]=function(_0x1e76b4){return connect()[_0x1c43('0x4')](function(){return new BPromise(function(_0x226f3c,_0x20286c){return pm2[_0x1c43('0x7')](_0x1e76b4,function(_0x43a096,_0x578280){if(_0x43a096){return _0x20286c(_0x43a096);}pm2['disconnect']();return _0x226f3c(_0x578280);});});});};exports[_0x1c43('0x8')]=function(){return connect()[_0x1c43('0x4')](function(){return new BPromise(function(_0xfcfabf,_0x5429c3){return pm2['list'](function(_0x112630,_0x5df88e){if(_0x112630){return _0x5429c3(_0x112630);}pm2[_0x1c43('0x5')]();return _0xfcfabf(_0x5df88e);});});});};exports[_0x1c43('0x9')]=function(_0x23cf1b){return connect()[_0x1c43('0x4')](function(){return new BPromise(function(_0x45d0ca,_0x16294b){return pm2[_0x1c43('0x9')](_0x23cf1b,function(_0x45825a,_0x558643){if(_0x45825a){return _0x16294b(_0x45825a);}pm2[_0x1c43('0x5')]();return _0x45d0ca(_0x558643);});});});};exports[_0x1c43('0xa')]=function(_0x10254d){return connect()['then'](function(){return new BPromise(function(_0x4a95e7,_0x297411){return pm2[_0x1c43('0xa')](_0x10254d,function(_0x49d08c,_0x5e59d6){if(_0x49d08c){return _0x297411(_0x49d08c);}pm2[_0x1c43('0x5')]();return _0x4a95e7(_0x5e59d6);});});});};exports[_0x1c43('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x20258e,_0x3ba399){return pm2['dump'](function(_0x51fedb){if(_0x51fedb){return _0x3ba399(_0x51fedb);}return _0x20258e(_0x1c43('0xc'));});});});}; \ No newline at end of file +var _0xbd9d=['bluebird','connected','then','start','disconnect','stop','restart','list','describe','delete','dump','saved','pm2'];(function(_0x5746aa,_0x471995){var _0x2b7e3a=function(_0x51813c){while(--_0x51813c){_0x5746aa['push'](_0x5746aa['shift']());}};_0x2b7e3a(++_0x471995);}(_0xbd9d,0x151));var _0xdbd9=function(_0x22a715,_0x4b3c23){_0x22a715=_0x22a715-0x0;var _0x403051=_0xbd9d[_0x22a715];return _0x403051;};'use strict';var pm2=require(_0xdbd9('0x0'));var BPromise=require(_0xdbd9('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x7c2194,_0x51f914){return pm2['connect'](function(_0x7d8635){if(_0x7d8635){return _0x51f914(_0x7d8635);}return _0x7c2194(_0xdbd9('0x2'));});});};exports['start']=function(_0x4fd9be){return connect()[_0xdbd9('0x3')](function(){return new BPromise(function(_0x50a970,_0xc13210){return pm2[_0xdbd9('0x4')](_0x4fd9be,function(_0x2c3240,_0x13625d){if(_0x2c3240){return _0xc13210(_0x2c3240);}pm2[_0xdbd9('0x5')]();return _0x50a970(_0x13625d);});});});};exports[_0xdbd9('0x6')]=function(_0x20e36a){return connect()[_0xdbd9('0x3')](function(){return new BPromise(function(_0x21abb1,_0x3168d7){return pm2['stop'](_0x20e36a,function(_0x4fe73e,_0x1f9ab4){if(_0x4fe73e){return _0x3168d7(_0x4fe73e);}pm2[_0xdbd9('0x5')]();return _0x21abb1(_0x1f9ab4);});});});};exports['restart']=function(_0x28159c){return connect()[_0xdbd9('0x3')](function(){return new BPromise(function(_0x32cff8,_0x4da0e2){return pm2[_0xdbd9('0x7')](_0x28159c,function(_0x5adaa1,_0x32ae8b){if(_0x5adaa1){return _0x4da0e2(_0x5adaa1);}pm2[_0xdbd9('0x5')]();return _0x32cff8(_0x32ae8b);});});});};exports[_0xdbd9('0x8')]=function(){return connect()[_0xdbd9('0x3')](function(){return new BPromise(function(_0x5312a3,_0x339490){return pm2[_0xdbd9('0x8')](function(_0x454ed8,_0x439769){if(_0x454ed8){return _0x339490(_0x454ed8);}pm2[_0xdbd9('0x5')]();return _0x5312a3(_0x439769);});});});};exports[_0xdbd9('0x9')]=function(_0x3855a2){return connect()['then'](function(){return new BPromise(function(_0x2340a9,_0x7d38bc){return pm2['describe'](_0x3855a2,function(_0x3749a1,_0xa26ce8){if(_0x3749a1){return _0x7d38bc(_0x3749a1);}pm2['disconnect']();return _0x2340a9(_0xa26ce8);});});});};exports['delete']=function(_0xa7d73b){return connect()['then'](function(){return new BPromise(function(_0x660be5,_0x139d81){return pm2[_0xdbd9('0xa')](_0xa7d73b,function(_0x2357fb,_0x293bab){if(_0x2357fb){return _0x139d81(_0x2357fb);}pm2[_0xdbd9('0x5')]();return _0x660be5(_0x293bab);});});});};exports[_0xdbd9('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x21acdd,_0x2dd4d4){return pm2[_0xdbd9('0xb')](function(_0x361ad9){if(_0x361ad9){return _0x2dd4d4(_0x361ad9);}return _0x21acdd(_0xdbd9('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 5013ff2..03ce088 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 _0xe10f=['catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','util','../../mysqldb','redis','localhost','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit'];(function(_0xec2706,_0x2f3055){var _0x473e17=function(_0x50f1cc){while(--_0x50f1cc){_0xec2706['push'](_0xec2706['shift']());}};_0x473e17(++_0x2f3055);}(_0xe10f,0xa7));var _0xfe10=function(_0x450290,_0xddc1d4){_0x450290=_0x450290-0x0;var _0x600846=_0xe10f[_0x450290];return _0x600846;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require('ioredis');var util=require(_0xfe10('0x0'));var config=require('../../config/environment');var db=require(_0xfe10('0x1'))['db'];var logger=require('../logger')('schedule');config[_0xfe10('0x2')]=_['defaults'](config['redis'],{'host':_0xfe10('0x3'),'port':0x18eb});var io=require(_0xfe10('0x4'))(new Redis(config[_0xfe10('0x2')]));function closeInteractions(){var _0x284661=0x0;var _0x15a039=[];return db[_0xfe10('0x5')]['find']({'raw':!![],'attributes':['id',_0xfe10('0x6')],'where':{'id':0x1}})[_0xfe10('0x7')](function(_0xdcdc80){_0x284661=_0xdcdc80[_0xfe10('0x6')];if(_0x284661){return db[_0xfe10('0x8')]['findAll']({'raw':!![],'attributes':['id',_0xfe10('0x9')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xfe10('0xa')](_0xdcdc80[_0xfe10('0x6')],_0xfe10('0xb'))}}});}else{return[];}})['then'](function(_0x59e5c0){if(_0x59e5c0&&_0x59e5c0[_0xfe10('0xc')]){_0x15a039=_[_0xfe10('0xd')](_0x59e5c0||[],'id');logger[_0xfe10('0xe')](_0xfe10('0xf'),_0x15a039['join']());return db[_0xfe10('0x8')]['update']({'closeReason':_0xfe10('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xfe10('0x11')](_0xfe10('0x12'))},{'where':{'id':_0x15a039}});}})['then'](function(){if(_0x15a039&&_0x15a039['length']){logger[_0xfe10('0xe')](_0xfe10('0x13'),_0x15a039[_0xfe10('0x14')]());for(var _0x4212ed=0x0;_0x4212ed<_0x15a039[_0xfe10('0xc')];_0x4212ed++){io[_0xfe10('0x15')]('chatInteraction:update',{'id':_0x15a039[_0x4212ed],'closed':!![]});}}})[_0xfe10('0x16')](function(_0x4d8fed){logger[_0xfe10('0x17')](_0xfe10('0x18'),_0x4d8fed?util[_0xfe10('0x19')](_0x4d8fed,{'showHidden':![],'depth':null}):'');});}exports[_0xfe10('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5084=['emit','catch','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','then','ChatInteraction','findAll','subtract','chatTimeout','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x42f163,_0x22deb7){var _0xdc3131=function(_0x41fe93){while(--_0x41fe93){_0x42f163['push'](_0x42f163['shift']());}};_0xdc3131(++_0x22deb7);}(_0x5084,0x1d2));var _0x4508=function(_0x56b5d1,_0x19156e){_0x56b5d1=_0x56b5d1-0x0;var _0x2ee00d=_0x5084[_0x56b5d1];return _0x2ee00d;};'use strict';var _=require(_0x4508('0x0'));var moment=require('moment');var Redis=require(_0x4508('0x1'));var util=require(_0x4508('0x2'));var config=require(_0x4508('0x3'));var db=require(_0x4508('0x4'))['db'];var logger=require(_0x4508('0x5'))(_0x4508('0x6'));config[_0x4508('0x7')]=_['defaults'](config[_0x4508('0x7')],{'host':_0x4508('0x8'),'port':0x18eb});var io=require(_0x4508('0x9'))(new Redis(config[_0x4508('0x7')]));function closeInteractions(){var _0x3c1e9a=0x0;var _0x201764=[];return db[_0x4508('0xa')][_0x4508('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x4508('0xc')](function(_0x1edf60){_0x3c1e9a=_0x1edf60['chatTimeout'];if(_0x3c1e9a){return db[_0x4508('0xd')][_0x4508('0xe')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4508('0xf')](_0x1edf60[_0x4508('0x10')],_0x4508('0x11'))}}});}else{return[];}})[_0x4508('0xc')](function(_0x5b1cc0){if(_0x5b1cc0&&_0x5b1cc0[_0x4508('0x12')]){_0x201764=_[_0x4508('0x13')](_0x5b1cc0||[],'id');logger[_0x4508('0x14')](_0x4508('0x15'),_0x201764[_0x4508('0x16')]());return db['ChatInteraction'][_0x4508('0x17')]({'closeReason':_0x4508('0x18'),'disposition':_0x4508('0x19'),'closed':!![],'closedAt':moment()[_0x4508('0x1a')](_0x4508('0x1b'))},{'where':{'id':_0x201764}});}})[_0x4508('0xc')](function(){if(_0x201764&&_0x201764['length']){logger[_0x4508('0x14')](_0x4508('0x1c'),_0x201764['join']());for(var _0x2f7c80=0x0;_0x2f7c80<_0x201764[_0x4508('0x12')];_0x2f7c80++){io[_0x4508('0x1d')]('chatInteraction:update',{'id':_0x201764[_0x2f7c80],'closed':!![]});}}})[_0x4508('0x1e')](function(_0x553105){logger['error'](_0x4508('0x1f'),_0x553105?util['inspect'](_0x553105,{'showHidden':![],'depth':null}):'');});}exports[_0x4508('0x20')]=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 19198bc..8114c2f 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 _0x9a25=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x9a25,0x1d8));var _0x59a2=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9a25[_0x3947c9];return _0x2e7871;};'use strict';function start(){var _0x189e1f=require(_0x59a2('0x0'));return _0x189e1f['startAllRefreshIntervals']();}module[_0x59a2('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x6ae7=['startAllRefreshIntervals','exports'];(function(_0x1cc1c4,_0x2d38f7){var _0x2d2a2d=function(_0x147c8f){while(--_0x147c8f){_0x1cc1c4['push'](_0x1cc1c4['shift']());}};_0x2d2a2d(++_0x2d38f7);}(_0x6ae7,0x134));var _0x76ae=function(_0x9bdbe7,_0x16ea08){_0x9bdbe7=_0x9bdbe7-0x0;var _0x13748f=_0x6ae7[_0x9bdbe7];return _0x13748f;};'use strict';function start(){var _0x3303ae=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x3303ae[_0x76ae('0x0')]();}module[_0x76ae('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 0bc5176..894a993 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 _0x5cfd=['Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','stringify','currentAttempt','retries','job','data','operation','stop','still\x20loading','case\x20completed','case\x20empty','case\x20failed','Unrecognized\x20status:','entity','dataValues','attempt','Job\x20ID\x20','report\x20status:','sendMail','isNil','email','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','catch','Schedule','findAll','MailServerOut','CloudProvider','keys','map','toString','keyBy','difference','intersection','exists','deleteJob','toRun','length','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','update','update\x20cron','stop\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','findOne','then','error','info','MailAccount','format','Smtp','user','bcc','name','subtractNumber','subtractUnit','join','savename','%s.%s','zip','existsSync','Sent','message','attachments','text','status','Empty','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading'];(function(_0x569824,_0x5ef34c){var _0x48544d=function(_0x534262){while(--_0x534262){_0x569824['push'](_0x569824['shift']());}};_0x48544d(++_0x5ef34c);}(_0x5cfd,0x170));var _0xd5cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5cfd[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xd5cf('0x0'));var _=require(_0xd5cf('0x1'));var moment=require(_0xd5cf('0x2'));var CronJobManager=require(_0xd5cf('0x3'));var jayson=require(_0xd5cf('0x4'));var BPromise=require(_0xd5cf('0x5'));var logger=require(_0xd5cf('0x6'))(_0xd5cf('0x7'));var db=require('../../mysqldb')['db'];const retry=require(_0xd5cf('0x8'));var analyticCustomReportController=require(_0xd5cf('0x9'));var analyticDefaultReportController=require(_0xd5cf('0xa'));var client=jayson[_0xd5cf('0xb')][_0xd5cf('0xc')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x432a86){const _0x384f8c={};if(typeof _0x432a86===_0xd5cf('0xd')){_0x384f8c['id']=_0x432a86;}return db['AnalyticExtractedReport'][_0xd5cf('0xe')]({'where':_0x384f8c})[_0xd5cf('0xf')](function(_0x171411){return _0x171411;})['catch'](function(_0x4b060f){logger[_0xd5cf('0x10')](_0x4b060f);});}function handleSendEmail(_0x36ec76,_0x42f846){logger[_0xd5cf('0x11')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x36ec76['email']);var _0x3d9e7a=!![];var _0x4bc887=_0x36ec76[_0xd5cf('0x12')]['getSmtpOptions']();var _0x3e351d={'account':_0x4bc887,'message':{'from':util[_0xd5cf('0x13')]('\x22%s\x22\x20<%s>',_0x36ec76[_0xd5cf('0x12')]['name'],_0x36ec76[_0xd5cf('0x12')]['email']||_0x36ec76[_0xd5cf('0x12')][_0xd5cf('0x14')][_0xd5cf('0x15')]),'to':_0x36ec76['email'],'cc':_0x36ec76['cc'],'bcc':_0x36ec76[_0xd5cf('0x16')],'subject':util[_0xd5cf('0x13')]('Report\x20%s\x20last\x20%s\x20%s',_0x42f846[_0xd5cf('0x17')],_0x36ec76[_0xd5cf('0x18')],_0x36ec76[_0xd5cf('0x19')])}};var _0x1c88c0=path[_0xd5cf('0x1a')](__dirname,'../../files/reports');var _0x3ce447=_0x42f846[_0xd5cf('0x1b')];var _0x92f09e=util['format'](_0xd5cf('0x1c'),path['basename'](_0x42f846[_0xd5cf('0x1b')],path['extname'](_0x42f846[_0xd5cf('0x1b')])),_0xd5cf('0x1d'));var _0x35be05=path[_0xd5cf('0x1a')](_0x1c88c0,_0x3ce447);var _0x3936c6=path['join'](_0x1c88c0,_0x92f09e);if(fs[_0xd5cf('0x1e')](_0x35be05)){_0x42f846['status']=_0xd5cf('0x1f');_0x3e351d[_0xd5cf('0x20')][_0xd5cf('0x21')]=[{'filename':_0x3ce447,'path':_0x35be05}];_0x3e351d['message'][_0xd5cf('0x22')]=util[_0xd5cf('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['stringify'](_0x42f846,null,0x2));}else if(fs[_0xd5cf('0x1e')](_0x3936c6)){_0x42f846['status']=_0xd5cf('0x1f');_0x3e351d[_0xd5cf('0x20')][_0xd5cf('0x21')]=[{'filename':_0x92f09e,'path':_0x3936c6}];}else{if(_0x42f846[_0xd5cf('0x23')]===_0xd5cf('0x24')){_0x3e351d[_0xd5cf('0x20')][_0xd5cf('0x22')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x36ec76[_0xd5cf('0x25')]){_0x3d9e7a=![];logger[_0xd5cf('0x11')](_0xd5cf('0x26'));}}else if(_0x42f846[_0xd5cf('0x23')]===_0xd5cf('0x27')){_0x3e351d[_0xd5cf('0x20')][_0xd5cf('0x22')]='Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x42f846[_0xd5cf('0x23')]===_0xd5cf('0x28')){_0x3e351d['message']['text']=_0xd5cf('0x29');}else if(_0x42f846[_0xd5cf('0x23')]==='Failed'){_0x3e351d[_0xd5cf('0x20')][_0xd5cf('0x22')]='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger['error'](_0xd5cf('0x2a'),_0x42f846[_0xd5cf('0x23')]);}}if(_0x3d9e7a){return client[_0xd5cf('0x2b')](_0xd5cf('0x2c'),_0x3e351d)['then'](function(_0x4e34b7){if(_0x4e34b7[_0xd5cf('0x10')]){return logger['error']('error\x20mail',JSON['stringify'](_0x4e34b7));}return logger[_0xd5cf('0x11')]('email\x20sent');})['catch'](function(_0x45545d){return logger[_0xd5cf('0x10')]('error\x20mail',JSON[_0xd5cf('0x2d')](_0x45545d));});}}function handleError(){return function(_0x3179bb){return logger[_0xd5cf('0x10')](JSON['stringify'](_0x3179bb));};}function loading(_0xb409b3){logger[_0xd5cf('0x11')]('case\x20loading');if(_0xb409b3[_0xd5cf('0x2e')]===_0xb409b3['retryOptions'][_0xd5cf('0x2f')]){handleSendEmail(_0xb409b3[_0xd5cf('0x30')],_0xb409b3[_0xd5cf('0x31')]);_0xb409b3[_0xd5cf('0x32')][_0xd5cf('0x33')]();}else{_0xb409b3['operation'][_0xd5cf('0x8')](_0xd5cf('0x34'));}}function completed(_0x46f9e0){logger[_0xd5cf('0x11')](_0xd5cf('0x35'));handleSendEmail(_0x46f9e0[_0xd5cf('0x30')],_0x46f9e0[_0xd5cf('0x31')]);_0x46f9e0[_0xd5cf('0x32')][_0xd5cf('0x33')]();}function empty(_0x3a1dc8){logger[_0xd5cf('0x11')](_0xd5cf('0x36'));handleSendEmail(_0x3a1dc8['job'],_0x3a1dc8[_0xd5cf('0x31')]);_0x3a1dc8[_0xd5cf('0x32')][_0xd5cf('0x33')]();}function failed(_0xcffd5e){logger[_0xd5cf('0x11')](_0xd5cf('0x37'));handleSendEmail(_0xcffd5e[_0xd5cf('0x30')],_0xcffd5e[_0xd5cf('0x31')]);_0xcffd5e['operation'][_0xd5cf('0x33')]();}function urecognized(_0x38ce6c){logger['error'](_0xd5cf('0x38'),_0x38ce6c[_0xd5cf('0x39')][_0xd5cf('0x3a')][_0xd5cf('0x23')]);_0x38ce6c[_0xd5cf('0x32')]['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x66b7fe,_0x35122f){const _0x5deebf={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x148dc5=retry[_0xd5cf('0x32')](_0x5deebf);_0x148dc5[_0xd5cf('0x3b')](_0x3ff150=>{logger[_0xd5cf('0x11')](_0xd5cf('0x3c')+_0x66b7fe['id']+'\x20Attempt\x20#:'+_0x3ff150);try{getReportData(_0x35122f['id'])[_0xd5cf('0xf')](function(_0x2c9601){_0x35122f=_0x2c9601;logger[_0xd5cf('0x11')](_0xd5cf('0x3d'),_0x2c9601[_0xd5cf('0x3a')][_0xd5cf('0x23')]);if(!reportStatusStrategies[_0x2c9601[_0xd5cf('0x3a')]['status']]){logger[_0xd5cf('0x10')](_0xd5cf('0x3d'),_0x2c9601[_0xd5cf('0x3a')]['status']);_0x148dc5['retry']();}reportStatusStrategies[_0x2c9601['dataValues'][_0xd5cf('0x23')]]({'operation':_0x148dc5,'currentAttempt':_0x3ff150,'retryOptions':_0x5deebf,'job':_0x66b7fe,'data':_0x35122f,'entity':_0x2c9601});});}catch(_0x283737){_0x148dc5['retry'](_0x283737);}});}function handleResult(_0x5c20e5){return function(_0x56d9e3){if(_0x5c20e5[_0xd5cf('0x3e')]&&_0x5c20e5[_0xd5cf('0x12')]&&_0x5c20e5[_0xd5cf('0x12')][_0xd5cf('0x14')]&&!_[_0xd5cf('0x3f')](_0x5c20e5[_0xd5cf('0x40')])){retryer(_0x5c20e5,_0x56d9e3);}};}function handleJob(_0x5d4c57){return function(){try{if(_['isNil'](_0x5d4c57[_0xd5cf('0x18')])){return logger[_0xd5cf('0x11')](_0xd5cf('0x41'));}if(_[_0xd5cf('0x3f')](_0x5d4c57['subtractUnit'])){return logger[_0xd5cf('0x11')](_0xd5cf('0x42'));}var _0x148fe0={'startDate':moment()['subtract'](_0x5d4c57[_0xd5cf('0x18')],_0x5d4c57[_0xd5cf('0x19')])[_0xd5cf('0x13')](_0xd5cf('0x43')),'endDate':moment()[_0xd5cf('0x13')](_0xd5cf('0x43')),'type':_0xd5cf('0x44'),'output':_0x5d4c57['output'],'name':_0x5d4c57[_0xd5cf('0x17')]};if(!_['isNil'](_0x5d4c57['DefaultReportId'])){logger[_0xd5cf('0x11')](_0xd5cf('0x45'),_0x5d4c57['DefaultReportId']);return analyticDefaultReportController[_0xd5cf('0x46')]({'id':_0x5d4c57[_0xd5cf('0x47')]},_0x148fe0)['then'](handleResult(_0x5d4c57))['catch'](handleError());}if(!_['isNil'](_0x5d4c57[_0xd5cf('0x48')])){logger[_0xd5cf('0x11')](_0xd5cf('0x49'),_0x5d4c57[_0xd5cf('0x48')]);return analyticCustomReportController['runReport']({'id':_0x5d4c57[_0xd5cf('0x48')]},_0x148fe0)[_0xd5cf('0xf')](handleResult(_0x5d4c57))[_0xd5cf('0x4a')](handleError());}}catch(_0x30c052){logger[_0xd5cf('0x10')](JSON[_0xd5cf('0x2d')](_0x30c052));}return logger[_0xd5cf('0x11')]('no\x20report\x20id');};}function getJobs(_0x336373){var _0x99d43={};if(_0x336373){_0x99d43['id']=_0x336373;}return db[_0xd5cf('0x4b')][_0xd5cf('0x4c')]({'where':_0x99d43,'include':[{'model':db[_0xd5cf('0x12')],'attributes':['id',_0xd5cf('0x17'),_0xd5cf('0x40')],'include':[{'model':db[_0xd5cf('0x4d')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xd5cf('0x4e')}]}]}]})[_0xd5cf('0xf')](function(_0x515719){var _0x4ec6ef=_[_0xd5cf('0x4f')](manager['jobs']);var _0x333a40=_[_0xd5cf('0x50')](_0x515719,function(_0x529195){return _0x529195['id'][_0xd5cf('0x51')]();});var _0x8b17c9=_[_0xd5cf('0x52')](_0x515719,function(_0x25b34c){return _0x25b34c['id']['toString']();});var _0x5d501b=_0x336373?_0x333a40:_[_0xd5cf('0x53')](_0x333a40,_0x4ec6ef);var _0x885e5d=_[_0xd5cf('0x54')](_0x333a40,_0x4ec6ef);var _0x591465=_[_0xd5cf('0x53')](_0x4ec6ef,_0x333a40);var _0x49f672;var _0x12719f;for(_0x49f672=0x0;_0x49f672<_0x591465['length']&&!_0x336373;_0x49f672+=0x1){_0x12719f=_0x591465[_0x49f672][_0xd5cf('0x51')]();if(manager[_0xd5cf('0x55')](_0x12719f)){manager['stop'](_0x12719f);manager[_0xd5cf('0x56')](_0x12719f);logger[_0xd5cf('0x11')]('delete\x20cron',_0x12719f);}}logger[_0xd5cf('0x11')](_0xd5cf('0x57'),JSON[_0xd5cf('0x2d')](_0x5d501b));for(_0x49f672=0x0;_0x49f672<_0x5d501b[_0xd5cf('0x58')];_0x49f672+=0x1){_0x12719f=_0x5d501b[_0x49f672]['toString']();if(_0x336373){logger[_0xd5cf('0x11')](JSON[_0xd5cf('0x2d')](_0x8b17c9[_0x12719f]));BPromise['resolve']()[_0xd5cf('0xf')](handleJob(_0x8b17c9[_0x12719f]));logger[_0xd5cf('0x11')](_0xd5cf('0x59'),_0x8b17c9[_0x12719f][_0xd5cf('0x17')],_0x8b17c9[_0x12719f][_0xd5cf('0x5a')]);}else if(_0x8b17c9[_0x12719f][_0xd5cf('0x5a')]&&_0x8b17c9[_0x12719f][_0xd5cf('0x5b')]&&moment()[_0xd5cf('0x5c')](_0x8b17c9[_0x12719f][_0xd5cf('0x5d')],_0x8b17c9[_0x12719f][_0xd5cf('0x5e')])){manager[_0xd5cf('0x5f')](_0x12719f,_0x8b17c9[_0x12719f][_0xd5cf('0x5a')],handleJob(_0x8b17c9[_0x12719f]));manager[_0xd5cf('0x60')](_0x12719f);logger[_0xd5cf('0x11')](_0xd5cf('0x61'),_0x8b17c9[_0x12719f][_0xd5cf('0x17')],_0x8b17c9[_0x12719f][_0xd5cf('0x5a')]);}else if(manager[_0xd5cf('0x55')](_0x12719f)){manager[_0xd5cf('0x33')](_0x12719f);manager['deleteJob'](_0x12719f);logger[_0xd5cf('0x11')]('stop\x20cron',_0x8b17c9[_0x12719f][_0xd5cf('0x17')],_0x8b17c9[_0x12719f][_0xd5cf('0x5a')]);}}for(_0x49f672=0x0,_0x12719f;_0x49f672<_0x885e5d[_0xd5cf('0x58')]&&!_0x336373;_0x49f672+=0x1){_0x12719f=_0x885e5d[_0x49f672]['toString']();if(manager['exists'](_0x12719f)){if(_0x8b17c9[_0x12719f]['cron']&&_0x8b17c9[_0x12719f][_0xd5cf('0x5b')]&&moment()[_0xd5cf('0x5c')](_0x8b17c9[_0x12719f][_0xd5cf('0x5d')],_0x8b17c9[_0x12719f]['endAt'])){manager[_0xd5cf('0x62')](_0x12719f,_0x8b17c9[_0x12719f][_0xd5cf('0x5a')],handleJob(_0x8b17c9[_0x12719f]));logger[_0xd5cf('0x11')](_0xd5cf('0x63'),_0x8b17c9[_0x12719f][_0xd5cf('0x17')],_0x8b17c9[_0x12719f]['cron']);}else{manager[_0xd5cf('0x33')](_0x12719f);manager[_0xd5cf('0x56')](_0x12719f);logger[_0xd5cf('0x11')](_0xd5cf('0x64'),_0x8b17c9[_0x12719f][_0xd5cf('0x17')],_0x8b17c9[_0x12719f][_0xd5cf('0x5a')]);}}}})[_0xd5cf('0x4a')](function(_0x1a25b9){logger[_0xd5cf('0x10')](JSON[_0xd5cf('0x2d')](_0x1a25b9));});}exports[_0xd5cf('0x65')]=function(_0x4bdcff){return getJobs(_0x4bdcff);};exports[_0xd5cf('0x60')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x3421=['subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','intersection','length','exists','deleteJob','delete\x20cron','toRun','run\x20job','cron','active','startAt','add','add\x20cron','stop\x20cron','isBetween','endAt','update','update\x20cron','run','start','util','path','moment','cron-job-manager','bluebird','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','AnalyticExtractedReport','findOne','then','catch','info','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','../../files/reports','savename','basename','zip','existsSync','status','message','attachments','stringify','Sent','Empty','text','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','error','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','email\x20sent','case\x20loading','currentAttempt','retryOptions','retries','job','operation','stop','still\x20loading','case\x20completed','case\x20empty','data','case\x20failed','Unrecognized\x20status:','entity','dataValues','attempt','Job\x20ID\x20','\x20Attempt\x20#:','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x3421,0x100));var _0x1342=function(_0x2ce098,_0x228fa8){_0x2ce098=_0x2ce098-0x0;var _0x54ad56=_0x3421[_0x2ce098];return _0x54ad56;};'use strict';var fs=require('fs');var util=require(_0x1342('0x0'));var path=require(_0x1342('0x1'));var _=require('lodash');var moment=require(_0x1342('0x2'));var CronJobManager=require(_0x1342('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x1342('0x4'));var logger=require('../logger')('schedule');var db=require(_0x1342('0x5'))['db'];const retry=require(_0x1342('0x6'));var analyticCustomReportController=require(_0x1342('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x1342('0x8')][_0x1342('0x9')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x80eb2b){const _0x42f890={};if(typeof _0x80eb2b==='number'){_0x42f890['id']=_0x80eb2b;}return db[_0x1342('0xa')][_0x1342('0xb')]({'where':_0x42f890})[_0x1342('0xc')](function(_0x22b3e8){return _0x22b3e8;})[_0x1342('0xd')](function(_0x18d728){logger['error'](_0x18d728);});}function handleSendEmail(_0x590ff3,_0x12a0d3){logger[_0x1342('0xe')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x590ff3[_0x1342('0xf')]);var _0x5aa9de=!![];var _0x48b103=_0x590ff3[_0x1342('0x10')][_0x1342('0x11')]();var _0x54751e={'account':_0x48b103,'message':{'from':util[_0x1342('0x12')](_0x1342('0x13'),_0x590ff3[_0x1342('0x10')]['name'],_0x590ff3['MailAccount']['email']||_0x590ff3[_0x1342('0x10')][_0x1342('0x14')][_0x1342('0x15')]),'to':_0x590ff3[_0x1342('0xf')],'cc':_0x590ff3['cc'],'bcc':_0x590ff3[_0x1342('0x16')],'subject':util[_0x1342('0x12')](_0x1342('0x17'),_0x12a0d3[_0x1342('0x18')],_0x590ff3[_0x1342('0x19')],_0x590ff3['subtractUnit'])}};var _0x32eb19=path[_0x1342('0x1a')](__dirname,_0x1342('0x1b'));var _0x4cb7f7=_0x12a0d3[_0x1342('0x1c')];var _0x26170d=util['format']('%s.%s',path[_0x1342('0x1d')](_0x12a0d3['savename'],path['extname'](_0x12a0d3['savename'])),_0x1342('0x1e'));var _0x12b980=path[_0x1342('0x1a')](_0x32eb19,_0x4cb7f7);var _0x4a819d=path[_0x1342('0x1a')](_0x32eb19,_0x26170d);if(fs[_0x1342('0x1f')](_0x12b980)){_0x12a0d3[_0x1342('0x20')]='Sent';_0x54751e[_0x1342('0x21')][_0x1342('0x22')]=[{'filename':_0x4cb7f7,'path':_0x12b980}];_0x54751e[_0x1342('0x21')]['text']=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x1342('0x23')](_0x12a0d3,null,0x2));}else if(fs['existsSync'](_0x4a819d)){_0x12a0d3[_0x1342('0x20')]=_0x1342('0x24');_0x54751e['message'][_0x1342('0x22')]=[{'filename':_0x26170d,'path':_0x4a819d}];}else{if(_0x12a0d3[_0x1342('0x20')]===_0x1342('0x25')){_0x54751e['message'][_0x1342('0x26')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x590ff3[_0x1342('0x27')]){_0x5aa9de=![];logger['info'](_0x1342('0x28'));}}else if(_0x12a0d3['status']===_0x1342('0x29')){_0x54751e[_0x1342('0x21')][_0x1342('0x26')]=_0x1342('0x2a');}else if(_0x12a0d3['status']===_0x1342('0x2b')){_0x54751e[_0x1342('0x21')][_0x1342('0x26')]=_0x1342('0x2c');}else if(_0x12a0d3['status']===_0x1342('0x2d')){_0x54751e[_0x1342('0x21')][_0x1342('0x26')]=_0x1342('0x2e');}else{logger[_0x1342('0x2f')](_0x1342('0x30'),_0x12a0d3[_0x1342('0x20')]);}}if(_0x5aa9de){return client[_0x1342('0x31')](_0x1342('0x32'),_0x54751e)[_0x1342('0xc')](function(_0x4ab223){if(_0x4ab223[_0x1342('0x2f')]){return logger[_0x1342('0x2f')](_0x1342('0x33'),JSON[_0x1342('0x23')](_0x4ab223));}return logger['info'](_0x1342('0x34'));})['catch'](function(_0x44477a){return logger['error']('error\x20mail',JSON[_0x1342('0x23')](_0x44477a));});}}function handleError(){return function(_0x231cf8){return logger['error'](JSON[_0x1342('0x23')](_0x231cf8));};}function loading(_0x1558b7){logger[_0x1342('0xe')](_0x1342('0x35'));if(_0x1558b7[_0x1342('0x36')]===_0x1558b7[_0x1342('0x37')][_0x1342('0x38')]){handleSendEmail(_0x1558b7[_0x1342('0x39')],_0x1558b7['data']);_0x1558b7[_0x1342('0x3a')][_0x1342('0x3b')]();}else{_0x1558b7[_0x1342('0x3a')][_0x1342('0x6')](_0x1342('0x3c'));}}function completed(_0x94be){logger[_0x1342('0xe')](_0x1342('0x3d'));handleSendEmail(_0x94be['job'],_0x94be['data']);_0x94be[_0x1342('0x3a')][_0x1342('0x3b')]();}function empty(_0x344055){logger[_0x1342('0xe')](_0x1342('0x3e'));handleSendEmail(_0x344055[_0x1342('0x39')],_0x344055[_0x1342('0x3f')]);_0x344055[_0x1342('0x3a')][_0x1342('0x3b')]();}function failed(_0x44566f){logger[_0x1342('0xe')](_0x1342('0x40'));handleSendEmail(_0x44566f[_0x1342('0x39')],_0x44566f['data']);_0x44566f[_0x1342('0x3a')]['stop']();}function urecognized(_0x4e6bc3){logger[_0x1342('0x2f')](_0x1342('0x41'),_0x4e6bc3[_0x1342('0x42')][_0x1342('0x43')][_0x1342('0x20')]);_0x4e6bc3['operation'][_0x1342('0x3b')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x3e16d7,_0xc8a9ce){const _0x299f43={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0xcb0d0d=retry[_0x1342('0x3a')](_0x299f43);_0xcb0d0d[_0x1342('0x44')](_0x33b036=>{logger[_0x1342('0xe')](_0x1342('0x45')+_0x3e16d7['id']+_0x1342('0x46')+_0x33b036);try{getReportData(_0xc8a9ce['id'])[_0x1342('0xc')](function(_0x22d121){_0xc8a9ce=_0x22d121;logger[_0x1342('0xe')]('report\x20status:',_0x22d121[_0x1342('0x43')]['status']);if(!reportStatusStrategies[_0x22d121[_0x1342('0x43')]['status']]){logger[_0x1342('0x2f')]('report\x20status:',_0x22d121['dataValues'][_0x1342('0x20')]);_0xcb0d0d[_0x1342('0x6')]();}reportStatusStrategies[_0x22d121[_0x1342('0x43')]['status']]({'operation':_0xcb0d0d,'currentAttempt':_0x33b036,'retryOptions':_0x299f43,'job':_0x3e16d7,'data':_0xc8a9ce,'entity':_0x22d121});});}catch(_0x15adf1){_0xcb0d0d[_0x1342('0x6')](_0x15adf1);}});}function handleResult(_0x5ba94e){return function(_0x602cd){if(_0x5ba94e['sendMail']&&_0x5ba94e[_0x1342('0x10')]&&_0x5ba94e[_0x1342('0x10')][_0x1342('0x14')]&&!_[_0x1342('0x47')](_0x5ba94e['email'])){retryer(_0x5ba94e,_0x602cd);}};}function handleJob(_0x34a1a1){return function(){try{if(_[_0x1342('0x47')](_0x34a1a1[_0x1342('0x19')])){return logger[_0x1342('0xe')](_0x1342('0x48'));}if(_[_0x1342('0x47')](_0x34a1a1[_0x1342('0x49')])){return logger[_0x1342('0xe')](_0x1342('0x4a'));}var _0x13114a={'startDate':moment()[_0x1342('0x4b')](_0x34a1a1[_0x1342('0x19')],_0x34a1a1[_0x1342('0x49')])[_0x1342('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x1342('0x12')](_0x1342('0x4c')),'type':'scheduled','output':_0x34a1a1['output'],'name':_0x34a1a1[_0x1342('0x18')]};if(!_[_0x1342('0x47')](_0x34a1a1[_0x1342('0x4d')])){logger[_0x1342('0xe')](_0x1342('0x4e'),_0x34a1a1[_0x1342('0x4d')]);return analyticDefaultReportController[_0x1342('0x4f')]({'id':_0x34a1a1['DefaultReportId']},_0x13114a)[_0x1342('0xc')](handleResult(_0x34a1a1))['catch'](handleError());}if(!_[_0x1342('0x47')](_0x34a1a1['CustomReportId'])){logger['info'](_0x1342('0x50'),_0x34a1a1[_0x1342('0x51')]);return analyticCustomReportController[_0x1342('0x4f')]({'id':_0x34a1a1['CustomReportId']},_0x13114a)[_0x1342('0xc')](handleResult(_0x34a1a1))[_0x1342('0xd')](handleError());}}catch(_0xe8c31e){logger[_0x1342('0x2f')](JSON[_0x1342('0x23')](_0xe8c31e));}return logger[_0x1342('0xe')]('no\x20report\x20id');};}function getJobs(_0x27552b){var _0x4b017c={};if(_0x27552b){_0x4b017c['id']=_0x27552b;}return db[_0x1342('0x52')][_0x1342('0x53')]({'where':_0x4b017c,'include':[{'model':db[_0x1342('0x10')],'attributes':['id',_0x1342('0x18'),'email'],'include':[{'model':db[_0x1342('0x54')],'as':_0x1342('0x14'),'include':[{'model':db['CloudProvider'],'as':_0x1342('0x55')}]}]}]})[_0x1342('0xc')](function(_0x210d28){var _0x469ed8=_[_0x1342('0x56')](manager[_0x1342('0x57')]);var _0x357baf=_[_0x1342('0x58')](_0x210d28,function(_0xd705b5){return _0xd705b5['id'][_0x1342('0x59')]();});var _0x2c591d=_[_0x1342('0x5a')](_0x210d28,function(_0x44af48){return _0x44af48['id'][_0x1342('0x59')]();});var _0x3abfae=_0x27552b?_0x357baf:_['difference'](_0x357baf,_0x469ed8);var _0x535caf=_[_0x1342('0x5b')](_0x357baf,_0x469ed8);var _0x2cec99=_['difference'](_0x469ed8,_0x357baf);var _0x4fdcc7;var _0x4471a6;for(_0x4fdcc7=0x0;_0x4fdcc7<_0x2cec99[_0x1342('0x5c')]&&!_0x27552b;_0x4fdcc7+=0x1){_0x4471a6=_0x2cec99[_0x4fdcc7][_0x1342('0x59')]();if(manager[_0x1342('0x5d')](_0x4471a6)){manager[_0x1342('0x3b')](_0x4471a6);manager[_0x1342('0x5e')](_0x4471a6);logger[_0x1342('0xe')](_0x1342('0x5f'),_0x4471a6);}}logger[_0x1342('0xe')](_0x1342('0x60'),JSON['stringify'](_0x3abfae));for(_0x4fdcc7=0x0;_0x4fdcc7<_0x3abfae[_0x1342('0x5c')];_0x4fdcc7+=0x1){_0x4471a6=_0x3abfae[_0x4fdcc7][_0x1342('0x59')]();if(_0x27552b){logger[_0x1342('0xe')](JSON[_0x1342('0x23')](_0x2c591d[_0x4471a6]));BPromise['resolve']()['then'](handleJob(_0x2c591d[_0x4471a6]));logger[_0x1342('0xe')](_0x1342('0x61'),_0x2c591d[_0x4471a6][_0x1342('0x18')],_0x2c591d[_0x4471a6][_0x1342('0x62')]);}else if(_0x2c591d[_0x4471a6][_0x1342('0x62')]&&_0x2c591d[_0x4471a6][_0x1342('0x63')]&&moment()['isBetween'](_0x2c591d[_0x4471a6][_0x1342('0x64')],_0x2c591d[_0x4471a6]['endAt'])){manager[_0x1342('0x65')](_0x4471a6,_0x2c591d[_0x4471a6][_0x1342('0x62')],handleJob(_0x2c591d[_0x4471a6]));manager['start'](_0x4471a6);logger[_0x1342('0xe')](_0x1342('0x66'),_0x2c591d[_0x4471a6][_0x1342('0x18')],_0x2c591d[_0x4471a6][_0x1342('0x62')]);}else if(manager[_0x1342('0x5d')](_0x4471a6)){manager[_0x1342('0x3b')](_0x4471a6);manager[_0x1342('0x5e')](_0x4471a6);logger[_0x1342('0xe')](_0x1342('0x67'),_0x2c591d[_0x4471a6]['name'],_0x2c591d[_0x4471a6]['cron']);}}for(_0x4fdcc7=0x0,_0x4471a6;_0x4fdcc7<_0x535caf[_0x1342('0x5c')]&&!_0x27552b;_0x4fdcc7+=0x1){_0x4471a6=_0x535caf[_0x4fdcc7][_0x1342('0x59')]();if(manager[_0x1342('0x5d')](_0x4471a6)){if(_0x2c591d[_0x4471a6][_0x1342('0x62')]&&_0x2c591d[_0x4471a6][_0x1342('0x63')]&&moment()[_0x1342('0x68')](_0x2c591d[_0x4471a6][_0x1342('0x64')],_0x2c591d[_0x4471a6][_0x1342('0x69')])){manager[_0x1342('0x6a')](_0x4471a6,_0x2c591d[_0x4471a6]['cron'],handleJob(_0x2c591d[_0x4471a6]));logger[_0x1342('0xe')](_0x1342('0x6b'),_0x2c591d[_0x4471a6]['name'],_0x2c591d[_0x4471a6][_0x1342('0x62')]);}else{manager[_0x1342('0x3b')](_0x4471a6);manager[_0x1342('0x5e')](_0x4471a6);logger[_0x1342('0xe')](_0x1342('0x67'),_0x2c591d[_0x4471a6][_0x1342('0x18')],_0x2c591d[_0x4471a6][_0x1342('0x62')]);}}}})[_0x1342('0xd')](function(_0x451cd2){logger[_0x1342('0x2f')](JSON['stringify'](_0x451cd2));});}exports[_0x1342('0x6c')]=function(_0x7f0b0c){return getJobs(_0x7f0b0c);};exports[_0x1342('0x6d')]=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 fd7f42c..f331652 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 _0xb077=['transcribeName','data2','transcribeRegion','then','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','transcripts','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20configured','findOne','catch','name','SequelizeValidationError','error','inspect','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','start','lodash','util','../../mysqldb','../../config/logger','transcribe','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)'];(function(_0x9fb10d,_0xa7970e){var _0x54f389=function(_0x344a38){while(--_0x344a38){_0x9fb10d['push'](_0x9fb10d['shift']());}};_0x54f389(++_0xa7970e);}(_0xb077,0x7a));var _0x7b07=function(_0x331cf8,_0x29c108){_0x331cf8=_0x331cf8-0x0;var _0x5b0bc6=_0xb077[_0x331cf8];return _0x5b0bc6;};var _=require(_0x7b07('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0x7b07('0x1'));var BPromise=require('bluebird');var db=require(_0x7b07('0x2'))['db'];var logger=require(_0x7b07('0x3'))(_0x7b07('0x4'));function getTranscriptionJob(_0x2b0c6c,_0x423957,_0x5df1bf,_0x5722bb){return new Promise(function(_0xdc333,_0x325d95){var _0x110ee5=new AWS['TranscribeService']({'accessKeyId':_0x423957,'secretAccessKey':_0x2b0c6c,'region':_0x5df1bf});_0x110ee5['getTranscriptionJob']({'TranscriptionJobName':_0x5722bb},function(_0x3a82e8,_0x4b6f20){if(_0x3a82e8){return _0x325d95(_0x3a82e8);}else{return _0xdc333(_0x4b6f20);}});});}function sentiment(_0x3dd0ad,_0x292db1,_0x2d3741,_0x214052,_0x1e8092){return new Promise(function(_0x23522e,_0x2f7009){var _0x33a461=new AWS[(_0x7b07('0x5'))]({'accessKeyId':_0x292db1,'secretAccessKey':_0x3dd0ad,'region':_0x2d3741});_0x33a461['detectSentiment']({'Text':_0x214052,'LanguageCode':_0x1e8092[_0x7b07('0x6')](0x0,0x2)},function(_0x282fe2,_0x1ffc7c){if(_0x282fe2){return _0x2f7009(_0x282fe2);}else{return _0x23522e(_0x1ffc7c);}});});}function checkTranscribeJob(_0x5684db,_0xe825c4,_0x3d73c6){var _0x9f3404;return new BPromise(function(_0x7930f1,_0x530d1d){logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x9'),_0x5684db['id'],_0x5684db[_0x7b07('0xa')]));return getTranscriptionJob(_0x3d73c6['data1'],_0x3d73c6[_0x7b07('0xb')],_0xe825c4[_0x7b07('0xc')],_0x5684db[_0x7b07('0xa')])[_0x7b07('0xd')](function(_0x4b7d85){logger['info'](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5684db['id'],_0x5684db[_0x7b07('0xa')],_0x4b7d85[_0x7b07('0xe')][_0x7b07('0xf')]));if(!_0x5684db[_0x7b07('0x10')]){switch(_0x4b7d85[_0x7b07('0xe')][_0x7b07('0xf')]){case _0x7b07('0x11'):var _0x5141d7={'transcribeStatus':_0x4b7d85[_0x7b07('0xe')][_0x7b07('0xf')],'fileUri':_0x4b7d85['TranscriptionJob']['Transcript']['TranscriptFileUri']};logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x12'),_0x5684db['id']));return rp({'uri':_0x4b7d85[_0x7b07('0xe')][_0x7b07('0x13')][_0x7b07('0x14')],'json':!![]})[_0x7b07('0xd')](function(_0x481812){logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x15'),_0x5684db['id']));if(_0x481812&&_0x481812['results']&&_0x481812[_0x7b07('0x16')]['transcripts']&&_0x481812[_0x7b07('0x16')]['transcripts'][_0x7b07('0x17')]){_0x5141d7[_0x7b07('0x10')]='';for(var _0x23f830=0x0;_0x23f830<_0x481812[_0x7b07('0x16')]['transcripts'][_0x7b07('0x17')];_0x23f830++){_0x5141d7['fileText']+=_0x481812[_0x7b07('0x16')][_0x7b07('0x18')][_0x23f830]['transcript']+'';}}return _0x5684db[_0x7b07('0x19')](_0x5141d7);})[_0x7b07('0xd')](function(){logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x1a'),_0x5684db['id']));if(!_0x5684db[_0x7b07('0x1b')]){throw new db[(_0x7b07('0x1c'))][(_0x7b07('0x1d'))](_0x7b07('0x1e'));}if(!_0xe825c4[_0x7b07('0x1f')]||!_0xe825c4[_0x7b07('0x20')]||!_0xe825c4[_0x7b07('0x21')]||!_0xe825c4[_0x7b07('0x22')]||!_0xe825c4[_0x7b07('0x23')]){throw new db[(_0x7b07('0x1c'))][(_0x7b07('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x5141d7['fileText']){throw new Error(_0x7b07('0x24'));}if(_0xe825c4[_0x7b07('0x20')]===_0x3d73c6['id']){return _0x3d73c6;}else{return db[_0x7b07('0x25')]['findOne']({'where':{'id':_settings[_0x7b07('0x20')]}});}})[_0x7b07('0xd')](function(_0x15713b){if(!_0x15713b){throw new db[(_0x7b07('0x1c'))]['ValidationError'](_0x7b07('0x26'));}if(!_0x15713b['data1']||!_0x15713b[_0x7b07('0xb')]){throw new db['Sequelize'][(_0x7b07('0x1d'))](_0x7b07('0x27'));}_0x9f3404=_0x15713b;logger['info'](util['format'](_0x7b07('0x28'),_0x5684db['id']));return sentiment(_0x9f3404['data1'],_0x9f3404[_0x7b07('0xb')],_0xe825c4[_0x7b07('0x21')],_0x5141d7['fileText'],_0xe825c4[_0x7b07('0x22')]);})['then'](function(_0x661e89){logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x29'),_0x5684db['id']));return _0x5684db[_0x7b07('0x19')]({'sentiment':_0x661e89[_0x7b07('0x2a')],'sPositive':_0x661e89[_0x7b07('0x2b')][_0x7b07('0x2c')],'sNegative':_0x661e89[_0x7b07('0x2b')][_0x7b07('0x2d')],'sMixed':_0x661e89[_0x7b07('0x2b')][_0x7b07('0x2e')],'sNeutral':_0x661e89[_0x7b07('0x2b')][_0x7b07('0x2f')]});})[_0x7b07('0xd')](function(){logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x1a'),_0x5684db['id']));_0x7930f1();});case _0x7b07('0x30'):return _0x5684db[_0x7b07('0x19')]({'transcribeStatus':'FAILED','failureReason':_0x4b7d85[_0x7b07('0xe')][_0x7b07('0x31')]})[_0x7b07('0xd')](function(){logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x1a'),_0x5684db['id']));_0x7930f1();});default:logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x32'),_0x5684db['id']));break;}}else{return BPromise['resolve']()[_0x7b07('0xd')](function(){if(!_0x5684db[_0x7b07('0x1b')]){throw new db['Sequelize'][(_0x7b07('0x1d'))](_0x7b07('0x1e'));}if(!_0xe825c4['sentiment']||!_0xe825c4[_0x7b07('0x20')]||!_0xe825c4[_0x7b07('0x21')]||!_0xe825c4[_0x7b07('0x22')]||!_0xe825c4[_0x7b07('0x23')]){throw new db[(_0x7b07('0x1c'))]['ValidationError'](_0x7b07('0x33'));}if(!_0x5684db[_0x7b07('0x10')]){throw new Error(_0x7b07('0x24'));}if(_0xe825c4[_0x7b07('0x20')]===_0x3d73c6['id']){return _0x3d73c6;}else{return db[_0x7b07('0x25')][_0x7b07('0x34')]({'where':{'id':_settings[_0x7b07('0x20')]}});}})[_0x7b07('0xd')](function(_0x523355){if(!_0x523355){throw new db[(_0x7b07('0x1c'))][(_0x7b07('0x1d'))](_0x7b07('0x26'));}if(!_0x523355['data1']||!_0x523355[_0x7b07('0xb')]){throw new db[(_0x7b07('0x1c'))][(_0x7b07('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x9f3404=_0x523355;logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x28'),_0x5684db['id']));return sentiment(_0x9f3404['data1'],_0x9f3404[_0x7b07('0xb')],_0xe825c4['sentimentRegion'],_0x5684db[_0x7b07('0x10')],_0xe825c4[_0x7b07('0x22')]);})[_0x7b07('0xd')](function(_0x55a96d){logger[_0x7b07('0x7')](util[_0x7b07('0x8')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5684db['id']));return _0x5684db['update']({'sentiment':_0x55a96d[_0x7b07('0x2a')],'sPositive':_0x55a96d['SentimentScore'][_0x7b07('0x2c')],'sNegative':_0x55a96d[_0x7b07('0x2b')]['Negative'],'sMixed':_0x55a96d['SentimentScore'][_0x7b07('0x2e')],'sNeutral':_0x55a96d[_0x7b07('0x2b')]['Neutral'],'transcribeStatus':_0x7b07('0x11')});})[_0x7b07('0xd')](function(){logger[_0x7b07('0x7')](util[_0x7b07('0x8')](_0x7b07('0x1a'),_0x5684db['id']));_0x7930f1();});}})[_0x7b07('0x35')](function(_0xddd3b7){if(_0xddd3b7){if(!_0xddd3b7[_0x7b07('0x36')]||_0xddd3b7[_0x7b07('0x36')]!==_0x7b07('0x37')){logger[_0x7b07('0x38')](util[_0x7b07('0x8')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x5684db['id']),util[_0x7b07('0x39')](_0xddd3b7,{'showHidden':![],'depth':null}));}}_0x7930f1();});});}function checkTranscribe(){var _0x30ec1b;var _0x3e5593;var _0x4fc266;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x7b07('0xd')](function(_0x2ed908){if(!_0x2ed908||!_0x2ed908[_0x7b07('0x17')]){throw new db[(_0x7b07('0x1c'))][(_0x7b07('0x1d'))](_0x7b07('0x3a'));}_0x30ec1b=_0x2ed908;return db[_0x7b07('0x3b')][_0x7b07('0x34')]({'where':{'id':0x1}});})['then'](function(_0x2c2605){if(!_0x2c2605){throw new db[(_0x7b07('0x1c'))][(_0x7b07('0x1d'))](_0x7b07('0x3c'));}_0x3e5593=_0x2c2605;if(!_0x3e5593[_0x7b07('0x4')]||!_0x3e5593['transcribeAccountId']||!_0x3e5593[_0x7b07('0xc')]||!_0x3e5593[_0x7b07('0x22')]||!_0x3e5593[_0x7b07('0x23')]){throw new db[(_0x7b07('0x1c'))][(_0x7b07('0x1d'))]('Transcribe\x20not\x20configured');}return db[_0x7b07('0x25')][_0x7b07('0x34')]({'where':{'id':_0x3e5593[_0x7b07('0x3d')]}});})['then'](function(_0x53777d){if(!_0x53777d){throw new db['Sequelize'][(_0x7b07('0x1d'))](_0x7b07('0x26'));}if(!_0x53777d['data1']||!_0x53777d[_0x7b07('0xb')]){throw new db[(_0x7b07('0x1c'))]['ValidationError'](_0x7b07('0x27'));}_0x4fc266=_0x53777d;var _0x92e583=[];_0x30ec1b[_0x7b07('0x3e')](function(_0x516676){_0x92e583[_0x7b07('0x3f')](checkTranscribeJob(_0x516676,_0x3e5593,_0x4fc266));});return BPromise[_0x7b07('0x40')](_0x92e583);})[_0x7b07('0x35')](function(_0x188590){if(_0x188590){if(!_0x188590[_0x7b07('0x36')]||_0x188590['name']!==_0x7b07('0x37')){logger[_0x7b07('0x38')](util[_0x7b07('0x39')](_0x188590,{'showHidden':![],'depth':null}));}}});}exports[_0x7b07('0x41')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xa20a=['transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','language','bucket','Transcript\x20not\x20available','CloudProvider','findOne','sentimentAccountId','ValidationError','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Sentiment\x20Analysis\x20not\x20configured','Neutral','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','start','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length'];(function(_0x1ead8f,_0x325f7d){var _0x87e090=function(_0x2a42d1){while(--_0x2a42d1){_0x1ead8f['push'](_0x1ead8f['shift']());}};_0x87e090(++_0x325f7d);}(_0xa20a,0x74));var _0xaa20=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa20a[_0x40a045];return _0x1a687c;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0xaa20('0x0'));var util=require(_0xaa20('0x1'));var BPromise=require(_0xaa20('0x2'));var db=require(_0xaa20('0x3'))['db'];var logger=require('../../config/logger')(_0xaa20('0x4'));function getTranscriptionJob(_0x20a8ad,_0x1497a0,_0x40cb4c,_0x46ae89){return new Promise(function(_0x5ac74e,_0x54ecbc){var _0x413b88=new AWS[(_0xaa20('0x5'))]({'accessKeyId':_0x1497a0,'secretAccessKey':_0x20a8ad,'region':_0x40cb4c});_0x413b88[_0xaa20('0x6')]({'TranscriptionJobName':_0x46ae89},function(_0x181df0,_0x271ed1){if(_0x181df0){return _0x54ecbc(_0x181df0);}else{return _0x5ac74e(_0x271ed1);}});});}function sentiment(_0x1983e8,_0x1e0186,_0x12d403,_0x17692f,_0x1f1d3a){return new Promise(function(_0x3b71a4,_0x590395){var _0xcc3d59=new AWS[(_0xaa20('0x7'))]({'accessKeyId':_0x1e0186,'secretAccessKey':_0x1983e8,'region':_0x12d403});_0xcc3d59['detectSentiment']({'Text':_0x17692f,'LanguageCode':_0x1f1d3a[_0xaa20('0x8')](0x0,0x2)},function(_0x249f4a,_0x2d527a){if(_0x249f4a){return _0x590395(_0x249f4a);}else{return _0x3b71a4(_0x2d527a);}});});}function checkTranscribeJob(_0x1e18cc,_0x36f915,_0x2fdd4f){var _0x48848f;return new BPromise(function(_0x2ef6e3,_0x163677){logger[_0xaa20('0x9')](util[_0xaa20('0xa')](_0xaa20('0xb'),_0x1e18cc['id'],_0x1e18cc[_0xaa20('0xc')]));return getTranscriptionJob(_0x2fdd4f[_0xaa20('0xd')],_0x2fdd4f[_0xaa20('0xe')],_0x36f915[_0xaa20('0xf')],_0x1e18cc[_0xaa20('0xc')])[_0xaa20('0x10')](function(_0x30f531){logger[_0xaa20('0x9')](util[_0xaa20('0xa')](_0xaa20('0x11'),_0x1e18cc['id'],_0x1e18cc[_0xaa20('0xc')],_0x30f531[_0xaa20('0x12')]['TranscriptionJobStatus']));if(!_0x1e18cc[_0xaa20('0x13')]){switch(_0x30f531['TranscriptionJob'][_0xaa20('0x14')]){case _0xaa20('0x15'):var _0x4c0bdb={'transcribeStatus':_0x30f531[_0xaa20('0x12')][_0xaa20('0x14')],'fileUri':_0x30f531[_0xaa20('0x12')][_0xaa20('0x16')][_0xaa20('0x17')]};logger['info'](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x1e18cc['id']));return rp({'uri':_0x30f531['TranscriptionJob']['Transcript'][_0xaa20('0x17')],'json':!![]})[_0xaa20('0x10')](function(_0x10c96e){logger[_0xaa20('0x9')](util[_0xaa20('0xa')](_0xaa20('0x18'),_0x1e18cc['id']));if(_0x10c96e&&_0x10c96e[_0xaa20('0x19')]&&_0x10c96e[_0xaa20('0x19')][_0xaa20('0x1a')]&&_0x10c96e['results']['transcripts'][_0xaa20('0x1b')]){_0x4c0bdb[_0xaa20('0x13')]='';for(var _0x55ac29=0x0;_0x55ac29<_0x10c96e[_0xaa20('0x19')][_0xaa20('0x1a')]['length'];_0x55ac29++){_0x4c0bdb[_0xaa20('0x13')]+=_0x10c96e[_0xaa20('0x19')]['transcripts'][_0x55ac29][_0xaa20('0x1c')]+'';}}return _0x1e18cc['update'](_0x4c0bdb);})[_0xaa20('0x10')](function(){logger[_0xaa20('0x9')](util[_0xaa20('0xa')](_0xaa20('0x1d'),_0x1e18cc['id']));if(!_0x1e18cc[_0xaa20('0x1e')]){throw new db[(_0xaa20('0x1f'))]['ValidationError'](_0xaa20('0x20'));}if(!_0x36f915['sentiment']||!_0x36f915['sentimentAccountId']||!_0x36f915[_0xaa20('0x21')]||!_0x36f915[_0xaa20('0x22')]||!_0x36f915[_0xaa20('0x23')]){throw new db[(_0xaa20('0x1f'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4c0bdb[_0xaa20('0x13')]){throw new Error(_0xaa20('0x24'));}if(_0x36f915['sentimentAccountId']===_0x2fdd4f['id']){return _0x2fdd4f;}else{return db[_0xaa20('0x25')][_0xaa20('0x26')]({'where':{'id':_settings[_0xaa20('0x27')]}});}})[_0xaa20('0x10')](function(_0x27b988){if(!_0x27b988){throw new db[(_0xaa20('0x1f'))][(_0xaa20('0x28'))](_0xaa20('0x29'));}if(!_0x27b988[_0xaa20('0xd')]||!_0x27b988[_0xaa20('0xe')]){throw new db['Sequelize'][(_0xaa20('0x28'))](_0xaa20('0x2a'));}_0x48848f=_0x27b988;logger[_0xaa20('0x9')](util[_0xaa20('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1e18cc['id']));return sentiment(_0x48848f['data1'],_0x48848f[_0xaa20('0xe')],_0x36f915[_0xaa20('0x21')],_0x4c0bdb[_0xaa20('0x13')],_0x36f915['language']);})[_0xaa20('0x10')](function(_0x2cf8a0){logger[_0xaa20('0x9')](util['format'](_0xaa20('0x2b'),_0x1e18cc['id']));return _0x1e18cc[_0xaa20('0x2c')]({'sentiment':_0x2cf8a0[_0xaa20('0x2d')],'sPositive':_0x2cf8a0[_0xaa20('0x2e')][_0xaa20('0x2f')],'sNegative':_0x2cf8a0[_0xaa20('0x2e')][_0xaa20('0x30')],'sMixed':_0x2cf8a0['SentimentScore'][_0xaa20('0x31')],'sNeutral':_0x2cf8a0['SentimentScore']['Neutral']});})[_0xaa20('0x10')](function(){logger[_0xaa20('0x9')](util['format'](_0xaa20('0x1d'),_0x1e18cc['id']));_0x2ef6e3();});case _0xaa20('0x32'):return _0x1e18cc[_0xaa20('0x2c')]({'transcribeStatus':_0xaa20('0x32'),'failureReason':_0x30f531[_0xaa20('0x12')][_0xaa20('0x33')]})[_0xaa20('0x10')](function(){logger[_0xaa20('0x9')](util[_0xaa20('0xa')](_0xaa20('0x1d'),_0x1e18cc['id']));_0x2ef6e3();});default:logger[_0xaa20('0x9')](util[_0xaa20('0xa')](_0xaa20('0x34'),_0x1e18cc['id']));break;}}else{return BPromise[_0xaa20('0x35')]()['then'](function(){if(!_0x1e18cc[_0xaa20('0x1e')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x36f915[_0xaa20('0x36')]||!_0x36f915['sentimentAccountId']||!_0x36f915[_0xaa20('0x21')]||!_0x36f915['language']||!_0x36f915[_0xaa20('0x23')]){throw new db['Sequelize'][(_0xaa20('0x28'))](_0xaa20('0x37'));}if(!_0x1e18cc[_0xaa20('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x36f915[_0xaa20('0x27')]===_0x2fdd4f['id']){return _0x2fdd4f;}else{return db[_0xaa20('0x25')][_0xaa20('0x26')]({'where':{'id':_settings[_0xaa20('0x27')]}});}})[_0xaa20('0x10')](function(_0x1481c3){if(!_0x1481c3){throw new db[(_0xaa20('0x1f'))][(_0xaa20('0x28'))](_0xaa20('0x29'));}if(!_0x1481c3['data1']||!_0x1481c3[_0xaa20('0xe')]){throw new db[(_0xaa20('0x1f'))][(_0xaa20('0x28'))](_0xaa20('0x2a'));}_0x48848f=_0x1481c3;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1e18cc['id']));return sentiment(_0x48848f['data1'],_0x48848f['data2'],_0x36f915[_0xaa20('0x21')],_0x1e18cc[_0xaa20('0x13')],_0x36f915['language']);})[_0xaa20('0x10')](function(_0x34da3c){logger[_0xaa20('0x9')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1e18cc['id']));return _0x1e18cc['update']({'sentiment':_0x34da3c[_0xaa20('0x2d')],'sPositive':_0x34da3c['SentimentScore'][_0xaa20('0x2f')],'sNegative':_0x34da3c['SentimentScore'][_0xaa20('0x30')],'sMixed':_0x34da3c[_0xaa20('0x2e')][_0xaa20('0x31')],'sNeutral':_0x34da3c[_0xaa20('0x2e')][_0xaa20('0x38')],'transcribeStatus':_0xaa20('0x15')});})[_0xaa20('0x10')](function(){logger['info'](util[_0xaa20('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1e18cc['id']));_0x2ef6e3();});}})['catch'](function(_0x19df3b){if(_0x19df3b){if(!_0x19df3b[_0xaa20('0x39')]||_0x19df3b[_0xaa20('0x39')]!==_0xaa20('0x3a')){logger[_0xaa20('0x3b')](util[_0xaa20('0xa')](_0xaa20('0x3c'),_0x1e18cc['id']),util[_0xaa20('0x3d')](_0x19df3b,{'showHidden':![],'depth':null}));}}_0x2ef6e3();});});}function checkTranscribe(){var _0x21cdbd;var _0x597d12;var _0x14de4a;return db['VoiceRecording'][_0xaa20('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xaa20('0x10')](function(_0x209a48){if(!_0x209a48||!_0x209a48['length']){throw new db[(_0xaa20('0x1f'))][(_0xaa20('0x28'))](_0xaa20('0x3f'));}_0x21cdbd=_0x209a48;return db[_0xaa20('0x40')][_0xaa20('0x26')]({'where':{'id':0x1}});})['then'](function(_0x3a9b1a){if(!_0x3a9b1a){throw new db[(_0xaa20('0x1f'))][(_0xaa20('0x28'))](_0xaa20('0x41'));}_0x597d12=_0x3a9b1a;if(!_0x597d12[_0xaa20('0x4')]||!_0x597d12[_0xaa20('0x42')]||!_0x597d12[_0xaa20('0xf')]||!_0x597d12[_0xaa20('0x22')]||!_0x597d12[_0xaa20('0x23')]){throw new db['Sequelize'][(_0xaa20('0x28'))](_0xaa20('0x43'));}return db['CloudProvider'][_0xaa20('0x26')]({'where':{'id':_0x597d12['transcribeAccountId']}});})[_0xaa20('0x10')](function(_0x23174e){if(!_0x23174e){throw new db[(_0xaa20('0x1f'))][(_0xaa20('0x28'))](_0xaa20('0x29'));}if(!_0x23174e[_0xaa20('0xd')]||!_0x23174e[_0xaa20('0xe')]){throw new db[(_0xaa20('0x1f'))][(_0xaa20('0x28'))]('Cloud\x20Provider\x20not\x20configured');}_0x14de4a=_0x23174e;var _0xdb599f=[];_0x21cdbd[_0xaa20('0x44')](function(_0x5e6bfa){_0xdb599f[_0xaa20('0x45')](checkTranscribeJob(_0x5e6bfa,_0x597d12,_0x14de4a));});return BPromise[_0xaa20('0x46')](_0xdb599f);})['catch'](function(_0x15f764){if(_0x15f764){if(!_0x15f764['name']||_0x15f764[_0xaa20('0x39')]!==_0xaa20('0x3a')){logger[_0xaa20('0x3b')](util[_0xaa20('0x3d')](_0x15f764,{'showHidden':![],'depth':null}));}}});}exports[_0xaa20('0x47')]=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 321961f..5160428 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 _0x464d=['lastMsgAt','subtract','length','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','WhatsappInteraction','findAll'];(function(_0x4677f4,_0x13d375){var _0x53dd06=function(_0x22bb77){while(--_0x22bb77){_0x4677f4['push'](_0x4677f4['shift']());}};_0x53dd06(++_0x13d375);}(_0x464d,0x70));var _0xd464=function(_0x25edc4,_0xa2ea8){_0x25edc4=_0x25edc4-0x0;var _0x515094=_0x464d[_0x25edc4];return _0x515094;};'use strict';var _=require('lodash');var moment=require(_0xd464('0x0'));var Redis=require(_0xd464('0x1'));var util=require(_0xd464('0x2'));var config=require(_0xd464('0x3'));var db=require(_0xd464('0x4'))['db'];var logger=require(_0xd464('0x5'))(_0xd464('0x6'));config[_0xd464('0x7')]=_[_0xd464('0x8')](config[_0xd464('0x7')],{'host':_0xd464('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd464('0x7')]));function closeInteractions(){var _0x4010b8=[];return db[_0xd464('0xa')][_0xd464('0xb')]({'raw':!![],'attributes':['id',_0xd464('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd464('0xd')](0x18,'hours')}}})['then'](function(_0x5466d8){if(_0x5466d8&&_0x5466d8[_0xd464('0xe')]){_0x4010b8=_[_0xd464('0xf')](_0x5466d8||[],'id');logger[_0xd464('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4010b8[_0xd464('0x11')]());return db[_0xd464('0xa')][_0xd464('0x12')]({'closeReason':_0xd464('0x13'),'disposition':_0xd464('0x14'),'closed':!![],'closedAt':moment()[_0xd464('0x15')](_0xd464('0x16'))},{'where':{'id':_0x4010b8}});}})[_0xd464('0x17')](function(){if(_0x4010b8&&_0x4010b8[_0xd464('0xe')]){logger[_0xd464('0x10')](_0xd464('0x18'),_0x4010b8[_0xd464('0x11')]());for(var _0x546da6=0x0;_0x546da6<_0x4010b8[_0xd464('0xe')];_0x546da6++){io[_0xd464('0x19')](_0xd464('0x1a'),{'id':_0x4010b8[_0x546da6],'closed':!![]});}}})[_0xd464('0x1b')](function(_0x2e6d80){logger[_0xd464('0x1c')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x2e6d80?util[_0xd464('0x1d')](_0x2e6d80,{'showHidden':![],'depth':null}):'');});}exports[_0xd464('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa414=['format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','moment','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','WhatsappInteraction','update','system'];(function(_0x34fa8e,_0x2d8a80){var _0x3865c6=function(_0x16a284){while(--_0x16a284){_0x34fa8e['push'](_0x34fa8e['shift']());}};_0x3865c6(++_0x2d8a80);}(_0xa414,0xc3));var _0x4a41=function(_0x368ca2,_0x4d00b4){_0x368ca2=_0x368ca2-0x0;var _0x2c3fd2=_0xa414[_0x368ca2];return _0x2c3fd2;};'use strict';var _=require('lodash');var moment=require(_0x4a41('0x0'));var Redis=require(_0x4a41('0x1'));var util=require(_0x4a41('0x2'));var config=require(_0x4a41('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x4a41('0x4'))(_0x4a41('0x5'));config[_0x4a41('0x6')]=_[_0x4a41('0x7')](config[_0x4a41('0x6')],{'host':_0x4a41('0x8'),'port':0x18eb});var io=require(_0x4a41('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x59ece6=[];return db['WhatsappInteraction'][_0x4a41('0xa')]({'raw':!![],'attributes':['id',_0x4a41('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4a41('0xc')](0x18,_0x4a41('0xd'))}}})[_0x4a41('0xe')](function(_0x341e50){if(_0x341e50&&_0x341e50[_0x4a41('0xf')]){_0x59ece6=_[_0x4a41('0x10')](_0x341e50||[],'id');logger[_0x4a41('0x11')](_0x4a41('0x12'),_0x59ece6['join']());return db[_0x4a41('0x13')][_0x4a41('0x14')]({'closeReason':_0x4a41('0x15'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x4a41('0x16')](_0x4a41('0x17'))},{'where':{'id':_0x59ece6}});}})[_0x4a41('0xe')](function(){if(_0x59ece6&&_0x59ece6[_0x4a41('0xf')]){logger[_0x4a41('0x11')](_0x4a41('0x18'),_0x59ece6[_0x4a41('0x19')]());for(var _0x2af4ab=0x0;_0x2af4ab<_0x59ece6['length'];_0x2af4ab++){io['emit'](_0x4a41('0x1a'),{'id':_0x59ece6[_0x2af4ab],'closed':!![]});}}})[_0x4a41('0x1b')](function(_0x5d31ee){logger[_0x4a41('0x1c')](_0x4a41('0x1d'),_0x5d31ee?util['inspect'](_0x5d31ee,{'showHidden':![],'depth':null}):'');});}exports[_0x4a41('0x1e')]=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 5a5b469..b38c1c4 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1799=['hopper2','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','then','log','finished\x20populating','contacts1','CmHopper','destroy','hopper1','bulkCreate'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x1799,0x11f));var _0x9179=function(_0x5f5927,_0x33d4d4){_0x5f5927=_0x5f5927-0x0;var _0x20463e=_0x1799[_0x5f5927];return _0x20463e;};'use strict';var util=require(_0x9179('0x0'));var db=require(_0x9179('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x9179('0x2')]({'id':i,'firstName':_0x9179('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x9179('0x4')+i+_0x9179('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x9179('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x9179('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9179('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x9179('0x2')]({'id':i,'firstName':_0x9179('0x3')+i,'lastName':_0x9179('0x7')+i,'phone':0xf879fb460+i,'email':_0x9179('0x4')+i+_0x9179('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x9179('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x9179('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9179('0x6')](),'updatedAt':Date[_0x9179('0x6')]()});}db[_0x9179('0x8')]['destroy']({'where':{}})[_0x9179('0x9')](function(){return db[_0x9179('0x8')]['bulkCreate'](contacts);})['then'](function(){console[_0x9179('0xa')](_0x9179('0xb'),_0x9179('0xc'));return db[_0x9179('0xd')][_0x9179('0xe')]({'where':{}});})['then'](function(){return db[_0x9179('0xd')]['bulkCreate'](hopper);})[_0x9179('0x9')](function(){console['log']('finished\x20populating',_0x9179('0xf'));return db[_0x9179('0x8')]['bulkCreate'](contacts2);})[_0x9179('0x9')](function(){console['log'](_0x9179('0xb'),'contacts2');return db[_0x9179('0xd')][_0x9179('0x10')](hopper2);})['then'](function(){console[_0x9179('0xa')]('finished\x20populating',_0x9179('0x11'));})[_0x9179('0x12')](function(_0x3f5d9e){console[_0x9179('0xa')](_0x3f5d9e);}); \ No newline at end of file +var _0x7a41=['now','CmContact','log','contacts1','then','CmHopper','bulkCreate','hopper1','contacts2','finished\x20populating','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com'];(function(_0x52d8cc,_0x2760ed){var _0x4eb02a=function(_0x4c8905){while(--_0x4c8905){_0x52d8cc['push'](_0x52d8cc['shift']());}};_0x4eb02a(++_0x2760ed);}(_0x7a41,0xb7));var _0x17a4=function(_0x456838,_0x2c723d){_0x456838=_0x456838-0x0;var _0x31e31c=_0x7a41[_0x456838];return _0x31e31c;};'use strict';var util=require(_0x17a4('0x0'));var db=require(_0x17a4('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x17a4('0x2')]({'id':i,'firstName':_0x17a4('0x3')+i,'lastName':_0x17a4('0x4')+i,'phone':0xf879fb460+i,'email':_0x17a4('0x5')+i+_0x17a4('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[_0x17a4('0x7')](),'updatedAt':Date[_0x17a4('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x17a4('0x3')+i,'lastName':_0x17a4('0x4')+i,'phone':0xf879fb460+i,'email':_0x17a4('0x5')+i+_0x17a4('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x17a4('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x17a4('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x17a4('0x7')](),'updatedAt':Date['now']()});}db[_0x17a4('0x8')]['destroy']({'where':{}})['then'](function(){return db[_0x17a4('0x8')]['bulkCreate'](contacts);})['then'](function(){console[_0x17a4('0x9')]('finished\x20populating',_0x17a4('0xa'));return db['CmHopper']['destroy']({'where':{}});})[_0x17a4('0xb')](function(){return db[_0x17a4('0xc')][_0x17a4('0xd')](hopper);})['then'](function(){console['log']('finished\x20populating',_0x17a4('0xe'));return db[_0x17a4('0x8')]['bulkCreate'](contacts2);})[_0x17a4('0xb')](function(){console[_0x17a4('0x9')]('finished\x20populating',_0x17a4('0xf'));return db[_0x17a4('0xc')][_0x17a4('0xd')](hopper2);})[_0x17a4('0xb')](function(){console[_0x17a4('0x9')](_0x17a4('0x10'),_0x17a4('0x11'));})[_0x17a4('0x12')](function(_0x3a3c91){console['log'](_0x3a3c91);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 73fd095..e3f03da 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd32=['password','friend','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','User','bulkCreate','then','log','add\x20user','util','format','%s%s','agent','%s%s@xcally.com'];(function(_0x1f69bc,_0xaffd71){var _0x1ac3c5=function(_0x3cd005){while(--_0x3cd005){_0x1f69bc['push'](_0x1f69bc['shift']());}};_0x1ac3c5(++_0xaffd71);}(_0xfd32,0x14b));var _0x2fd3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd32[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x2fd3('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x2fd3('0x1')](_0x2fd3('0x2'),'agent',i),'fullname':util[_0x2fd3('0x1')](_0x2fd3('0x2'),_0x2fd3('0x3'),i),'email':util[_0x2fd3('0x1')](_0x2fd3('0x4'),_0x2fd3('0x3'),i),'role':'agent','password':_0x2fd3('0x5'),'internal':0xfa0+i,'type':_0x2fd3('0x6'),'transport':['udp','ws','wss'],'disallow':[_0x2fd3('0x7')],'allow':['ulaw'],'defaultuser':util[_0x2fd3('0x1')](_0x2fd3('0x2'),_0x2fd3('0x3'),i),'encryption':_0x2fd3('0x8'),'avpf':_0x2fd3('0x8'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0x2fd3('0x8'),'dtlsverify':'no','dtlscertfile':_0x2fd3('0x9'),'dtlsprivatekey':_0x2fd3('0xa'),'dtlssetup':'actpass','callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x2fd3('0x1')](_0x2fd3('0x2'),_0x2fd3('0x3'),i),0xfa0+i)});}db[_0x2fd3('0xb')][_0x2fd3('0xc')](users)[_0x2fd3('0xd')](function(){console[_0x2fd3('0xe')](_0x2fd3('0xf'));})['catch'](function(_0x2aa513){console[_0x2fd3('0xe')](_0x2aa513);}); \ No newline at end of file +var _0x3129=['push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','log','add\x20user','catch','../mysqldb'];(function(_0x433d30,_0x5e44e1){var _0x3959ae=function(_0x564d6f){while(--_0x564d6f){_0x433d30['push'](_0x433d30['shift']());}};_0x3959ae(++_0x5e44e1);}(_0x3129,0x18e));var _0x9312=function(_0x4c4662,_0x54f08c){_0x4c4662=_0x4c4662-0x0;var _0x35fc3=_0x3129[_0x4c4662];return _0x35fc3;};'use strict';var util=require('util');var db=require(_0x9312('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x9312('0x1')]({'name':util[_0x9312('0x2')](_0x9312('0x3'),_0x9312('0x4'),i),'fullname':util[_0x9312('0x2')](_0x9312('0x3'),_0x9312('0x4'),i),'email':util[_0x9312('0x2')](_0x9312('0x5'),_0x9312('0x4'),i),'role':_0x9312('0x4'),'password':_0x9312('0x6'),'internal':0xfa0+i,'type':_0x9312('0x7'),'transport':[_0x9312('0x8'),'ws',_0x9312('0x9')],'disallow':[_0x9312('0xa')],'allow':[_0x9312('0xb')],'defaultuser':util[_0x9312('0x2')](_0x9312('0x3'),_0x9312('0x4'),i),'encryption':'yes','avpf':_0x9312('0xc'),'force_avp':_0x9312('0xc'),'icesupport':_0x9312('0xc'),'dtlsenable':_0x9312('0xc'),'dtlsverify':'no','dtlscertfile':_0x9312('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x9312('0x2')](_0x9312('0xe'),util[_0x9312('0x2')](_0x9312('0x3'),_0x9312('0x4'),i),0xfa0+i)});}db[_0x9312('0xf')]['bulkCreate'](users)['then'](function(){console[_0x9312('0x10')](_0x9312('0x11'));})[_0x9312('0x12')](function(_0x1c9630){console[_0x9312('0x10')](_0x1c9630);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 37b84b1..133302f 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e9c=['UserProfileSection','findOne','then','autoAssociation','FaxQueues','SmsQueues','WhatsappQueues','findAll','IvrCampaigns','UserProfileResource','map','where','role','telephone','Campaign','type','format','%s:queue:%s','Agents','length','user:%s','query','find','userProfileId','handshake','ChatInteractions','MailInteractions','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','include','push','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','Trunk','user','voice:outbound','VoiceQueues','VoiceQueue','MailQueues','OpenchannelQueues','WhatsappQueue','Telephones','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','chat','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','leave','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','request','connection','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','name','User','agent','ivr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e9c,0x17c));var _0xc5e9=function(_0xfda70e,_0x34a343){_0xfda70e=_0xfda70e-0x0;var _0x2aa4a8=_0x5e9c[_0xfda70e];return _0x2aa4a8;};'use strict';var _=require(_0xc5e9('0x0'));var util=require(_0xc5e9('0x1'));var BPromise=require(_0xc5e9('0x2'));var db=require(_0xc5e9('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xc5e9('0x4')],'include':[{'as':'Agents','model':db[_0xc5e9('0x5')],'attributes':['id',_0xc5e9('0x4'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xc5e9('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xc5e9('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xc5e9('0x4')],'where':{'role':_0xc5e9('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xc5e9('0x4'),'type'],'where':{'type':_0xc5e9('0x7')}};function getAssociatedResources(_0x4760b6,_0x2c0bbc,_0x5248b1){return db[_0xc5e9('0x8')][_0xc5e9('0x9')]({'where':{'name':_0x4760b6,'userProfileId':_0x2c0bbc},'raw':!![]})[_0xc5e9('0xa')](function(_0x41cde1){if(_0x41cde1){if(_0x41cde1[_0xc5e9('0xb')]){switch(_0x4760b6){case'VoiceQueues':case'ChatQueues':case _0xc5e9('0xc'):case _0xc5e9('0xd'):case'MailQueues':case'OpenchannelQueues':case _0xc5e9('0xe'):return db[_0x5248b1][_0xc5e9('0xf')](queryQueues);case'Telephones':return db[_0x5248b1]['findAll'](queryTelephones);case'Trunks':return db[_0x5248b1]['findAll'](queryTrunks);case _0xc5e9('0x10'):return db[_0x5248b1]['findAll'](queryCampaigns);}}else{return db[_0xc5e9('0x11')][_0xc5e9('0xf')]({'attributes':['resourceId'],'where':{'sectionId':_0x41cde1['id']},'raw':!![]})[_0xc5e9('0xa')](function(_0x3586c1){if(_0x3586c1){var _0x51c3e2={'where':{'id':_[_0xc5e9('0x12')](_0x3586c1,'resourceId')},'raw':!![]};switch(_0x5248b1){case'User':_0x51c3e2[_0xc5e9('0x13')][_0xc5e9('0x14')]=_0xc5e9('0x15');break;case _0xc5e9('0x16'):_0x51c3e2[_0xc5e9('0x13')][_0xc5e9('0x17')]=_0xc5e9('0x7');break;}return db[_0x5248b1][_0xc5e9('0xf')](_0x51c3e2);}else{return[];}});}}else{return[];}})[_0xc5e9('0xa')](function(_0x47605f){return _0x47605f;});}function joinOrLeaveQueues(_0x29fa04,_0x4cb252,_0x44cd57,_0x410e18){_0x29fa04[_0x4cb252](util[_0xc5e9('0x18')](_0xc5e9('0x19'),_0x44cd57,_0x410e18[_0xc5e9('0x4')]));if(_0x410e18[_0xc5e9('0x1a')]){for(var _0x3ee8cd=0x0;_0x3ee8cd<_0x410e18[_0xc5e9('0x1a')][_0xc5e9('0x1b')];_0x3ee8cd+=0x1){_0x29fa04[_0x4cb252](util[_0xc5e9('0x18')](_0xc5e9('0x1c'),_0x410e18[_0xc5e9('0x1a')][_0x3ee8cd]['name']));}}}function joinOrLeave(_0x242f14,_0x1a0274,_0x16f2ba){var _0x30882f;if(_0x242f14['handshake'][_0xc5e9('0x1d')]['id']){db['User'][_0xc5e9('0x1e')]({'attributes':['id',_0xc5e9('0x4'),_0xc5e9('0x14'),_0xc5e9('0x1f')],'where':{'id':_0x242f14[_0xc5e9('0x20')][_0xc5e9('0x1d')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xc5e9('0x21'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xc5e9('0x22'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xc5e9('0x23'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xc5e9('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xc5e9('0x25')],'as':_0xc5e9('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xc5e9('0x27')],'as':_0xc5e9('0x28'),'attributes':['id'],'raw':!![]}]})[_0xc5e9('0xa')](function(_0x12b677){if(_0x12b677){_0x30882f=_0x12b677;_0x242f14[_0x1a0274](util[_0xc5e9('0x18')]('user:%s',_0x12b677[_0xc5e9('0x4')]));var _0x59de69=[];switch(_0x12b677['role']){case _0xc5e9('0x29'):_0x242f14[_0x1a0274](_0xc5e9('0x2a'));_0x242f14[_0x1a0274]('voice:outbound');if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0xc5e9('0x2b')];}_0x59de69['push'](db['VoiceQueue'][_0xc5e9('0xf')](queryQueues));_0x59de69[_0xc5e9('0x2c')](db[_0xc5e9('0x2d')]['findAll'](queryQueues));_0x59de69[_0xc5e9('0x2c')](db[_0xc5e9('0x2e')][_0xc5e9('0xf')](queryQueues));_0x59de69[_0xc5e9('0x2c')](db['SmsQueue']['findAll'](queryQueues));_0x59de69[_0xc5e9('0x2c')](db[_0xc5e9('0x2f')][_0xc5e9('0xf')](queryQueues));_0x59de69[_0xc5e9('0x2c')](db[_0xc5e9('0x30')][_0xc5e9('0xf')](queryQueues));_0x59de69[_0xc5e9('0x2c')](db['WhatsappQueue'][_0xc5e9('0xf')](queryQueues));_0x59de69[_0xc5e9('0x2c')](db[_0xc5e9('0x5')]['findAll'](queryTelephones));_0x59de69[_0xc5e9('0x2c')](db[_0xc5e9('0x31')][_0xc5e9('0xf')](queryTrunks));_0x59de69[_0xc5e9('0x2c')](db[_0xc5e9('0x16')][_0xc5e9('0xf')](queryCampaigns));_0x59de69[_0xc5e9('0x2c')](db[_0xc5e9('0x5')]['findAll'](queryAgents));break;case _0xc5e9('0x32'):_0x242f14[_0x1a0274](_0xc5e9('0x2a'));_0x242f14[_0x1a0274](_0xc5e9('0x33'));_0x59de69[_0xc5e9('0x2c')](getAssociatedResources(_0xc5e9('0x34'),_0x12b677[_0xc5e9('0x1f')],_0xc5e9('0x35')));_0x59de69[_0xc5e9('0x2c')](getAssociatedResources('ChatQueues',_0x12b677[_0xc5e9('0x1f')],_0xc5e9('0x2d')));_0x59de69[_0xc5e9('0x2c')](getAssociatedResources(_0xc5e9('0xc'),_0x12b677['userProfileId'],_0xc5e9('0x2e')));_0x59de69['push'](getAssociatedResources('SmsQueues',_0x12b677['userProfileId'],'SmsQueue'));_0x59de69['push'](getAssociatedResources(_0xc5e9('0x36'),_0x12b677[_0xc5e9('0x1f')],_0xc5e9('0x2f')));_0x59de69['push'](getAssociatedResources(_0xc5e9('0x37'),_0x12b677[_0xc5e9('0x1f')],_0xc5e9('0x30')));_0x59de69['push'](getAssociatedResources(_0xc5e9('0xe'),_0x12b677['userProfileId'],_0xc5e9('0x38')));_0x59de69[_0xc5e9('0x2c')](getAssociatedResources(_0xc5e9('0x39'),_0x12b677[_0xc5e9('0x1f')],_0xc5e9('0x5')));_0x59de69[_0xc5e9('0x2c')](getAssociatedResources(_0xc5e9('0x3a'),_0x12b677[_0xc5e9('0x1f')],_0xc5e9('0x31')));_0x59de69['push'](getAssociatedResources(_0xc5e9('0x10'),_0x12b677[_0xc5e9('0x1f')],_0xc5e9('0x16')));_0x59de69['push'](db['User'][_0xc5e9('0xf')](queryAgents));break;case _0xc5e9('0x6'):_0x242f14[_0x1a0274](_0xc5e9('0x2a'));_0x242f14[_0x1a0274](_0xc5e9('0x33'));_0x59de69[_0xc5e9('0x2c')](_0x12b677[_0xc5e9('0x3b')]({'attributes':['id','name']}));_0x59de69[_0xc5e9('0x2c')](_0x12b677[_0xc5e9('0x3c')]({'attributes':['id',_0xc5e9('0x4')]}));_0x59de69['push'](_0x12b677[_0xc5e9('0x3d')]({'attributes':['id',_0xc5e9('0x4')]}));_0x59de69['push'](_0x12b677[_0xc5e9('0x3e')]({'attributes':['id',_0xc5e9('0x4')]}));_0x59de69[_0xc5e9('0x2c')](_0x12b677[_0xc5e9('0x3f')]({'attributes':['id',_0xc5e9('0x4')]}));_0x59de69[_0xc5e9('0x2c')](_0x12b677[_0xc5e9('0x40')]({'attributes':['id','name']}));_0x59de69[_0xc5e9('0x2c')](_0x12b677['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0xc5e9('0x41')](_0x59de69);}})[_0xc5e9('0xa')](function(_0x21801e){if(_0x21801e&&_0x21801e['length']){for(var _0x16ee29=0x0;_0x16ee29<_0x21801e[_0xc5e9('0x1b')];_0x16ee29+=0x1){for(var _0x146303=0x0;_0x146303<_0x21801e[_0x16ee29][_0xc5e9('0x1b')];_0x146303+=0x1){switch(_0x16ee29){case 0x0:joinOrLeaveQueues(_0x242f14,_0x1a0274,'voice',_0x21801e[_0x16ee29][_0x146303]);break;case 0x1:joinOrLeaveQueues(_0x242f14,_0x1a0274,_0xc5e9('0x42'),_0x21801e[_0x16ee29][_0x146303]);break;case 0x2:joinOrLeaveQueues(_0x242f14,_0x1a0274,'fax',_0x21801e[_0x16ee29][_0x146303]);break;case 0x3:joinOrLeaveQueues(_0x242f14,_0x1a0274,_0xc5e9('0x43'),_0x21801e[_0x16ee29][_0x146303]);break;case 0x4:joinOrLeaveQueues(_0x242f14,_0x1a0274,_0xc5e9('0x44'),_0x21801e[_0x16ee29][_0x146303]);break;case 0x5:joinOrLeaveQueues(_0x242f14,_0x1a0274,_0xc5e9('0x45'),_0x21801e[_0x16ee29][_0x146303]);break;case 0x6:joinOrLeaveQueues(_0x242f14,_0x1a0274,_0xc5e9('0x46'),_0x21801e[_0x16ee29][_0x146303]);break;case 0x7:if(_0x30882f[_0xc5e9('0x14')]!=='agent')_0x242f14[_0x1a0274](util[_0xc5e9('0x18')](_0xc5e9('0x47'),_0x21801e[_0x16ee29][_0x146303][_0xc5e9('0x4')]));break;case 0x8:if(_0x30882f['role']!==_0xc5e9('0x6'))_0x242f14[_0x1a0274](util[_0xc5e9('0x18')](_0xc5e9('0x48'),_0x21801e[_0x16ee29][_0x146303]['name']));break;case 0x9:if(_0x30882f[_0xc5e9('0x14')]!==_0xc5e9('0x6'))_0x242f14[_0x1a0274](util['format']('campaign:%s:%s',_0x21801e[_0x16ee29][_0x146303][_0xc5e9('0x17')],_0x21801e[_0x16ee29][_0x146303][_0xc5e9('0x4')]));break;case 0xa:_0x242f14[_0x1a0274](util['format'](_0xc5e9('0x1c'),_0x21801e[_0x16ee29][_0x146303][_0xc5e9('0x4')]));break;}}}}})[_0xc5e9('0xa')](function(){if(_0x1a0274==='leave'){var _0x3b61b1=_[_0xc5e9('0x12')](_0x30882f[_0xc5e9('0x21')],'id');return _0x30882f['removeChatInteractions'](_0x3b61b1)[_0xc5e9('0xa')](function(){for(var _0x5c3324=0x0;_0x5c3324<_0x3b61b1[_0xc5e9('0x1b')];_0x5c3324+=0x1){_0x16f2ba[_0xc5e9('0x49')](_0xc5e9('0x4a'),{'ChatInteractionId':Number(_0x3b61b1[_0x5c3324]),'UserId':Number(_0x30882f['id'])});}});}})['then'](function(){if(_0x1a0274==='leave'){var _0x26a31f=_[_0xc5e9('0x12')](_0x30882f['MailInteractions'],'id');return _0x30882f[_0xc5e9('0x4b')](_0x26a31f)[_0xc5e9('0xa')](function(){for(var _0x2382f7=0x0;_0x2382f7<_0x26a31f[_0xc5e9('0x1b')];_0x2382f7+=0x1){_0x16f2ba['emit'](_0xc5e9('0x4c'),{'MailInteractionId':Number(_0x26a31f[_0x2382f7]),'UserId':Number(_0x30882f['id'])});}});}})['then'](function(){if(_0x1a0274===_0xc5e9('0x4d')){var _0x5ba228=_['map'](_0x30882f[_0xc5e9('0x23')],'id');return _0x30882f[_0xc5e9('0x4e')](_0x5ba228)[_0xc5e9('0xa')](function(){for(var _0x172b2e=0x0;_0x172b2e<_0x5ba228[_0xc5e9('0x1b')];_0x172b2e+=0x1){_0x16f2ba[_0xc5e9('0x49')](_0xc5e9('0x4f'),{'FaxInteractionId':Number(_0x5ba228[_0x172b2e]),'UserId':Number(_0x30882f['id'])});}});}})[_0xc5e9('0xa')](function(){if(_0x1a0274==='leave'){var _0x384cb4=_['map'](_0x30882f[_0xc5e9('0x24')],'id');return _0x30882f[_0xc5e9('0x50')](_0x384cb4)['then'](function(){for(var _0x2e3fba=0x0;_0x2e3fba<_0x384cb4[_0xc5e9('0x1b')];_0x2e3fba+=0x1){_0x16f2ba[_0xc5e9('0x49')](_0xc5e9('0x51'),{'SmsInteractionId':Number(_0x384cb4[_0x2e3fba]),'UserId':Number(_0x30882f['id'])});}});}})[_0xc5e9('0xa')](function(){if(_0x1a0274===_0xc5e9('0x4d')){var _0xd1ac47=_['map'](_0x30882f[_0xc5e9('0x26')],'id');return _0x30882f[_0xc5e9('0x52')](_0xd1ac47)[_0xc5e9('0xa')](function(){for(var _0x1f537c=0x0;_0x1f537c<_0xd1ac47[_0xc5e9('0x1b')];_0x1f537c+=0x1){_0x16f2ba[_0xc5e9('0x49')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0xd1ac47[_0x1f537c]),'UserId':Number(_0x30882f['id'])});}});}})[_0xc5e9('0xa')](function(){if(_0x1a0274===_0xc5e9('0x4d')){var _0x1635f4=_[_0xc5e9('0x12')](_0x30882f[_0xc5e9('0x28')],'id');return _0x30882f['removeWhatsappInteractions'](_0x1635f4)['then'](function(){for(var _0x41e890=0x0;_0x41e890<_0x1635f4[_0xc5e9('0x1b')];_0x41e890+=0x1){_0x16f2ba[_0xc5e9('0x49')](_0xc5e9('0x53'),{'WhatsappInteractionId':Number(_0x1635f4[_0x41e890]),'UserId':Number(_0x30882f['id'])});}});}})[_0xc5e9('0x54')](function(_0x6ddeee){_0x242f14[_0xc5e9('0x55')](_0x6ddeee);});}}function onDisconnect(_0x373722,_0x1c6ed8){joinOrLeave(_0x373722,_0xc5e9('0x4d'),_0x1c6ed8);}function onConnect(_0x4508b4){joinOrLeave(_0x4508b4,_0xc5e9('0x56'));}exports[_0xc5e9('0x57')]=function(_0x5e1894){_0x5e1894['on']('connection',function(_0x47b261){_0x47b261[_0xc5e9('0x58')](0x0);_0x47b261[_0xc5e9('0x59')]=_0x47b261[_0xc5e9('0x5a')][_0xc5e9('0x5b')]['remoteAddress']+':'+_0x47b261[_0xc5e9('0x5a')]['connection'][_0xc5e9('0x5c')];_0x47b261['connectedAt']=new Date();_0x47b261[_0xc5e9('0x55')]=function(_0x1e4a89){console[_0xc5e9('0x55')](_0xc5e9('0x5d')+_0x47b261[_0xc5e9('0x5e')][_0xc5e9('0x4')]+'['+_0x47b261['address']+']',_0x1e4a89);};_0x47b261['on'](_0xc5e9('0x5f'),function(){onDisconnect(_0x47b261,_0x5e1894);_0x47b261[_0xc5e9('0x55')](_0xc5e9('0x60'));});onConnect(_0x47b261);_0x47b261[_0xc5e9('0x55')]('CONNECTED');});}; \ No newline at end of file +var _0xcc6d=['user:%s','voice:inbound','hasOwnProperty','include','push','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','userProfileId','ChatQueue','FaxQueues','getChatQueues','getFaxQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','join','default','connection','request','remoteAddress','remotePort','connectedAt','log','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','role','name','agent','type','ivr','findOne','ChatQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','where','telephone','Campaign','then','format','length','query','User','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','WhatsappInteraction','WhatsappInteractions'];(function(_0xb81593,_0x53ffad){var _0x57bfae=function(_0x2f67d5){while(--_0x2f67d5){_0xb81593['push'](_0xb81593['shift']());}};_0x57bfae(++_0x53ffad);}(_0xcc6d,0x1a9));var _0xdcc6=function(_0x3520ce,_0x4e0252){_0x3520ce=_0x3520ce-0x0;var _0x19e5e7=_0xcc6d[_0x3520ce];return _0x19e5e7;};'use strict';var _=require(_0xdcc6('0x0'));var util=require(_0xdcc6('0x1'));var BPromise=require(_0xdcc6('0x2'));var db=require(_0xdcc6('0x3'))['db'];var config=require(_0xdcc6('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xdcc6('0x5'),'model':db['User'],'attributes':['id','name',_0xdcc6('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xdcc6('0x7')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xdcc6('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xdcc6('0x9')],'where':{'type':_0xdcc6('0xa')}};function getAssociatedResources(_0x195e2a,_0x911d24,_0x45fa41){return db['UserProfileSection'][_0xdcc6('0xb')]({'where':{'name':_0x195e2a,'userProfileId':_0x911d24},'raw':!![]})['then'](function(_0x5e1249){if(_0x5e1249){if(_0x5e1249['autoAssociation']){switch(_0x195e2a){case'VoiceQueues':case _0xdcc6('0xc'):case'FaxQueues':case'SmsQueues':case _0xdcc6('0xd'):case _0xdcc6('0xe'):case _0xdcc6('0xf'):return db[_0x45fa41][_0xdcc6('0x10')](queryQueues);case _0xdcc6('0x11'):return db[_0x45fa41][_0xdcc6('0x10')](queryTelephones);case _0xdcc6('0x12'):return db[_0x45fa41][_0xdcc6('0x10')](queryTrunks);case _0xdcc6('0x13'):return db[_0x45fa41][_0xdcc6('0x10')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0xdcc6('0x14')],'where':{'sectionId':_0x5e1249['id']},'raw':!![]})['then'](function(_0x1936e1){if(_0x1936e1){var _0x472308={'where':{'id':_[_0xdcc6('0x15')](_0x1936e1,_0xdcc6('0x14'))},'raw':!![]};switch(_0x45fa41){case'User':_0x472308[_0xdcc6('0x16')][_0xdcc6('0x6')]=_0xdcc6('0x17');break;case _0xdcc6('0x18'):_0x472308[_0xdcc6('0x16')]['type']=_0xdcc6('0xa');break;}return db[_0x45fa41][_0xdcc6('0x10')](_0x472308);}else{return[];}});}}else{return[];}})[_0xdcc6('0x19')](function(_0x3c801d){return _0x3c801d;});}function joinOrLeaveQueues(_0xb20c60,_0x52be46,_0x51ef83,_0x29995b){_0xb20c60[_0x52be46](util[_0xdcc6('0x1a')]('%s:queue:%s',_0x51ef83,_0x29995b['name']));if(_0x29995b['Agents']){for(var _0x27f067=0x0;_0x27f067<_0x29995b[_0xdcc6('0x5')][_0xdcc6('0x1b')];_0x27f067+=0x1){_0xb20c60[_0x52be46](util[_0xdcc6('0x1a')]('user:%s',_0x29995b[_0xdcc6('0x5')][_0x27f067][_0xdcc6('0x7')]));}}}function joinOrLeave(_0x384c77,_0x4115fd,_0x4d44e2){var _0x51a96d;if(_0x384c77['handshake'][_0xdcc6('0x1c')]['id']){db[_0xdcc6('0x1d')]['find']({'attributes':['id',_0xdcc6('0x7'),_0xdcc6('0x6'),'userProfileId'],'where':{'id':_0x384c77['handshake'][_0xdcc6('0x1c')]['id']},'include':[{'model':db[_0xdcc6('0x1e')],'as':_0xdcc6('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0xdcc6('0x20')],'as':_0xdcc6('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xdcc6('0x22')],'as':_0xdcc6('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xdcc6('0x24')],'as':_0xdcc6('0x25'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xdcc6('0x26')],'as':_0xdcc6('0x27'),'attributes':['id'],'raw':!![]}]})[_0xdcc6('0x19')](function(_0xfd50e1){if(_0xfd50e1){_0x51a96d=_0xfd50e1;_0x384c77[_0x4115fd](util[_0xdcc6('0x1a')](_0xdcc6('0x28'),_0xfd50e1[_0xdcc6('0x7')]));var _0x29019d=[];switch(_0xfd50e1[_0xdcc6('0x6')]){case'admin':_0x384c77[_0x4115fd](_0xdcc6('0x29'));_0x384c77[_0x4115fd]('voice:outbound');if(queryQueues[_0xdcc6('0x2a')]('include')){delete queryQueues[_0xdcc6('0x2b')];}_0x29019d[_0xdcc6('0x2c')](db['VoiceQueue'][_0xdcc6('0x10')](queryQueues));_0x29019d['push'](db['ChatQueue'][_0xdcc6('0x10')](queryQueues));_0x29019d[_0xdcc6('0x2c')](db['FaxQueue'][_0xdcc6('0x10')](queryQueues));_0x29019d[_0xdcc6('0x2c')](db[_0xdcc6('0x2d')][_0xdcc6('0x10')](queryQueues));_0x29019d[_0xdcc6('0x2c')](db[_0xdcc6('0x2e')][_0xdcc6('0x10')](queryQueues));_0x29019d[_0xdcc6('0x2c')](db[_0xdcc6('0x2f')]['findAll'](queryQueues));_0x29019d[_0xdcc6('0x2c')](db[_0xdcc6('0x30')][_0xdcc6('0x10')](queryQueues));_0x29019d[_0xdcc6('0x2c')](db['User']['findAll'](queryTelephones));_0x29019d[_0xdcc6('0x2c')](db[_0xdcc6('0x31')][_0xdcc6('0x10')](queryTrunks));_0x29019d['push'](db[_0xdcc6('0x18')][_0xdcc6('0x10')](queryCampaigns));_0x29019d[_0xdcc6('0x2c')](db['User'][_0xdcc6('0x10')](queryAgents));break;case _0xdcc6('0x32'):_0x384c77[_0x4115fd]('voice:inbound');_0x384c77[_0x4115fd](_0xdcc6('0x33'));_0x29019d['push'](getAssociatedResources('VoiceQueues',_0xfd50e1[_0xdcc6('0x34')],'VoiceQueue'));_0x29019d[_0xdcc6('0x2c')](getAssociatedResources('ChatQueues',_0xfd50e1[_0xdcc6('0x34')],_0xdcc6('0x35')));_0x29019d[_0xdcc6('0x2c')](getAssociatedResources(_0xdcc6('0x36'),_0xfd50e1[_0xdcc6('0x34')],'FaxQueue'));_0x29019d[_0xdcc6('0x2c')](getAssociatedResources('SmsQueues',_0xfd50e1[_0xdcc6('0x34')],_0xdcc6('0x2d')));_0x29019d['push'](getAssociatedResources(_0xdcc6('0xd'),_0xfd50e1[_0xdcc6('0x34')],_0xdcc6('0x2e')));_0x29019d['push'](getAssociatedResources(_0xdcc6('0xe'),_0xfd50e1[_0xdcc6('0x34')],_0xdcc6('0x2f')));_0x29019d[_0xdcc6('0x2c')](getAssociatedResources(_0xdcc6('0xf'),_0xfd50e1[_0xdcc6('0x34')],_0xdcc6('0x30')));_0x29019d['push'](getAssociatedResources(_0xdcc6('0x11'),_0xfd50e1['userProfileId'],_0xdcc6('0x1d')));_0x29019d['push'](getAssociatedResources('Trunks',_0xfd50e1[_0xdcc6('0x34')],'Trunk'));_0x29019d['push'](getAssociatedResources('IvrCampaigns',_0xfd50e1[_0xdcc6('0x34')],_0xdcc6('0x18')));_0x29019d[_0xdcc6('0x2c')](db[_0xdcc6('0x1d')]['findAll'](queryAgents));break;case _0xdcc6('0x8'):_0x384c77[_0x4115fd](_0xdcc6('0x29'));_0x384c77[_0x4115fd](_0xdcc6('0x33'));_0x29019d[_0xdcc6('0x2c')](_0xfd50e1['getVoiceQueues']({'attributes':['id',_0xdcc6('0x7')]}));_0x29019d[_0xdcc6('0x2c')](_0xfd50e1[_0xdcc6('0x37')]({'attributes':['id',_0xdcc6('0x7')]}));_0x29019d[_0xdcc6('0x2c')](_0xfd50e1[_0xdcc6('0x38')]({'attributes':['id',_0xdcc6('0x7')]}));_0x29019d[_0xdcc6('0x2c')](_0xfd50e1['getSmsQueues']({'attributes':['id',_0xdcc6('0x7')]}));_0x29019d[_0xdcc6('0x2c')](_0xfd50e1['getMailQueues']({'attributes':['id',_0xdcc6('0x7')]}));_0x29019d[_0xdcc6('0x2c')](_0xfd50e1[_0xdcc6('0x39')]({'attributes':['id',_0xdcc6('0x7')]}));_0x29019d[_0xdcc6('0x2c')](_0xfd50e1[_0xdcc6('0x3a')]({'attributes':['id',_0xdcc6('0x7')]}));break;}return BPromise[_0xdcc6('0x3b')](_0x29019d);}})[_0xdcc6('0x19')](function(_0x1cf772){if(_0x1cf772&&_0x1cf772[_0xdcc6('0x1b')]){for(var _0x5c990d=0x0;_0x5c990d<_0x1cf772[_0xdcc6('0x1b')];_0x5c990d+=0x1){for(var _0x24ee42=0x0;_0x24ee42<_0x1cf772[_0x5c990d][_0xdcc6('0x1b')];_0x24ee42+=0x1){switch(_0x5c990d){case 0x0:joinOrLeaveQueues(_0x384c77,_0x4115fd,_0xdcc6('0x3c'),_0x1cf772[_0x5c990d][_0x24ee42]);break;case 0x1:joinOrLeaveQueues(_0x384c77,_0x4115fd,'chat',_0x1cf772[_0x5c990d][_0x24ee42]);break;case 0x2:joinOrLeaveQueues(_0x384c77,_0x4115fd,_0xdcc6('0x3d'),_0x1cf772[_0x5c990d][_0x24ee42]);break;case 0x3:joinOrLeaveQueues(_0x384c77,_0x4115fd,_0xdcc6('0x3e'),_0x1cf772[_0x5c990d][_0x24ee42]);break;case 0x4:joinOrLeaveQueues(_0x384c77,_0x4115fd,_0xdcc6('0x3f'),_0x1cf772[_0x5c990d][_0x24ee42]);break;case 0x5:joinOrLeaveQueues(_0x384c77,_0x4115fd,'openchannel',_0x1cf772[_0x5c990d][_0x24ee42]);break;case 0x6:joinOrLeaveQueues(_0x384c77,_0x4115fd,_0xdcc6('0x40'),_0x1cf772[_0x5c990d][_0x24ee42]);break;case 0x7:if(_0x51a96d[_0xdcc6('0x6')]!=='agent')_0x384c77[_0x4115fd](util['format'](_0xdcc6('0x41'),_0x1cf772[_0x5c990d][_0x24ee42][_0xdcc6('0x7')]));break;case 0x8:if(_0x51a96d[_0xdcc6('0x6')]!==_0xdcc6('0x8'))_0x384c77[_0x4115fd](util['format'](_0xdcc6('0x42'),_0x1cf772[_0x5c990d][_0x24ee42][_0xdcc6('0x7')]));break;case 0x9:if(_0x51a96d[_0xdcc6('0x6')]!==_0xdcc6('0x8'))_0x384c77[_0x4115fd](util[_0xdcc6('0x1a')](_0xdcc6('0x43'),_0x1cf772[_0x5c990d][_0x24ee42]['type'],_0x1cf772[_0x5c990d][_0x24ee42][_0xdcc6('0x7')]));break;case 0xa:_0x384c77[_0x4115fd](util['format'](_0xdcc6('0x28'),_0x1cf772[_0x5c990d][_0x24ee42][_0xdcc6('0x7')]));break;}}}}})[_0xdcc6('0x19')](function(){if(_0x4115fd===_0xdcc6('0x44')){var _0x384fc6=_['map'](_0x51a96d[_0xdcc6('0x1f')],'id');return _0x51a96d[_0xdcc6('0x45')](_0x384fc6)[_0xdcc6('0x19')](function(){for(var _0x3d2c48=0x0;_0x3d2c48<_0x384fc6[_0xdcc6('0x1b')];_0x3d2c48+=0x1){_0x4d44e2[_0xdcc6('0x46')](_0xdcc6('0x47'),{'ChatInteractionId':Number(_0x384fc6[_0x3d2c48]),'UserId':Number(_0x51a96d['id'])});}});}})['then'](function(){if(_0x4115fd===_0xdcc6('0x44')){var _0x23f2be=_[_0xdcc6('0x15')](_0x51a96d['MailInteractions'],'id');return _0x51a96d[_0xdcc6('0x48')](_0x23f2be)[_0xdcc6('0x19')](function(){for(var _0x53d162=0x0;_0x53d162<_0x23f2be[_0xdcc6('0x1b')];_0x53d162+=0x1){_0x4d44e2[_0xdcc6('0x46')](_0xdcc6('0x49'),{'MailInteractionId':Number(_0x23f2be[_0x53d162]),'UserId':Number(_0x51a96d['id'])});}});}})[_0xdcc6('0x19')](function(){if(_0x4115fd===_0xdcc6('0x44')){var _0x127bc0=_[_0xdcc6('0x15')](_0x51a96d[_0xdcc6('0x23')],'id');return _0x51a96d['removeFaxInteractions'](_0x127bc0)[_0xdcc6('0x19')](function(){for(var _0x2114b9=0x0;_0x2114b9<_0x127bc0[_0xdcc6('0x1b')];_0x2114b9+=0x1){_0x4d44e2[_0xdcc6('0x46')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x127bc0[_0x2114b9]),'UserId':Number(_0x51a96d['id'])});}});}})['then'](function(){if(_0x4115fd===_0xdcc6('0x44')){var _0x2c7db7=_[_0xdcc6('0x15')](_0x51a96d[_0xdcc6('0x25')],'id');return _0x51a96d[_0xdcc6('0x4a')](_0x2c7db7)[_0xdcc6('0x19')](function(){for(var _0x48a945=0x0;_0x48a945<_0x2c7db7[_0xdcc6('0x1b')];_0x48a945+=0x1){_0x4d44e2[_0xdcc6('0x46')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x2c7db7[_0x48a945]),'UserId':Number(_0x51a96d['id'])});}});}})[_0xdcc6('0x19')](function(){if(_0x4115fd===_0xdcc6('0x44')){var _0x247fff=_['map'](_0x51a96d[_0xdcc6('0x4b')],'id');return _0x51a96d[_0xdcc6('0x4c')](_0x247fff)[_0xdcc6('0x19')](function(){for(var _0x106e14=0x0;_0x106e14<_0x247fff[_0xdcc6('0x1b')];_0x106e14+=0x1){_0x4d44e2[_0xdcc6('0x46')](_0xdcc6('0x4d'),{'OpenchannelInteractionId':Number(_0x247fff[_0x106e14]),'UserId':Number(_0x51a96d['id'])});}});}})['then'](function(){if(_0x4115fd==='leave'){var _0x2d4657=_[_0xdcc6('0x15')](_0x51a96d[_0xdcc6('0x27')],'id');return _0x51a96d['removeWhatsappInteractions'](_0x2d4657)[_0xdcc6('0x19')](function(){for(var _0x10a9e3=0x0;_0x10a9e3<_0x2d4657['length'];_0x10a9e3+=0x1){_0x4d44e2[_0xdcc6('0x46')](_0xdcc6('0x4e'),{'WhatsappInteractionId':Number(_0x2d4657[_0x10a9e3]),'UserId':Number(_0x51a96d['id'])});}});}})[_0xdcc6('0x4f')](function(_0x3a4e4e){_0x384c77['log'](_0x3a4e4e);});}}function onDisconnect(_0x41cf6e,_0x2b5f65){joinOrLeave(_0x41cf6e,_0xdcc6('0x44'),_0x2b5f65);}function onConnect(_0x4fb7a7){joinOrLeave(_0x4fb7a7,_0xdcc6('0x50'));}exports[_0xdcc6('0x51')]=function(_0x31f43c){_0x31f43c['on'](_0xdcc6('0x52'),function(_0x16fdc2){_0x16fdc2['setMaxListeners'](0x0);_0x16fdc2['address']=_0x16fdc2[_0xdcc6('0x53')][_0xdcc6('0x52')][_0xdcc6('0x54')]+':'+_0x16fdc2[_0xdcc6('0x53')]['connection'][_0xdcc6('0x55')];_0x16fdc2[_0xdcc6('0x56')]=new Date();_0x16fdc2[_0xdcc6('0x57')]=function(_0x28736f){console[_0xdcc6('0x57')]('SocketIO\x20'+_0x16fdc2[_0xdcc6('0x58')]['name']+'['+_0x16fdc2[_0xdcc6('0x59')]+']',_0x28736f);};_0x16fdc2['on'](_0xdcc6('0x5a'),function(){onDisconnect(_0x16fdc2,_0x31f43c);_0x16fdc2[_0xdcc6('0x57')](_0xdcc6('0x5b'));});onConnect(_0x16fdc2);_0x16fdc2['log'](_0xdcc6('0x5c'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 9dde1db..81cbacb 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 _0xfb9f=['OpenchannelInteraction','closedinteraction','OpenchannelMessage','request','EventManager','error','Trigger,\x20%s','catch','motionChannel','event','direction','resolve','then','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s','agent','channel','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','get','opened','sequelize','name','closed','changed','substatus','AfterUpdate','User','find','fullname','email','internal','default','length','hook','callback','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','afterUpdate','SmsMessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel'];(function(_0x15c8da,_0x28c29f){var _0x394166=function(_0x16f05d){while(--_0x16f05d){_0x15c8da['push'](_0x15c8da['shift']());}};_0x394166(++_0x28c29f);}(_0xfb9f,0x1ed));var _0xffb9=function(_0x5d417d,_0x16c60c){_0x5d417d=_0x5d417d-0x0;var _0x145e9d=_0xfb9f[_0x5d417d];return _0x145e9d;};'use strict';var util=require(_0xffb9('0x0'));var db=require(_0xffb9('0x1'))['db'];var jayson=require(_0xffb9('0x2'));var logger=require(_0xffb9('0x3'))(_0xffb9('0x4'));var client=jayson[_0xffb9('0x5')][_0xffb9('0x6')]({'port':0x232a});var triggers=[{'channel':_0xffb9('0x7'),'model':_0xffb9('0x8'),'event':_0xffb9('0x9'),'condition':_0xffb9('0xa'),'callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xffb9('0x7'),'model':_0xffb9('0xb'),'event':_0xffb9('0x9'),'condition':_0xffb9('0xc'),'callback':afterCreateMessage},{'channel':'Chat','model':_0xffb9('0xd'),'event':_0xffb9('0x9'),'condition':_0xffb9('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0xffb9('0xe'),'model':'SmsInteraction','event':'afterCreate','condition':_0xffb9('0xa'),'callback':afterCreate},{'channel':_0xffb9('0xe'),'model':'SmsInteraction','event':_0xffb9('0xf'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xffb9('0xe'),'model':_0xffb9('0x10'),'event':_0xffb9('0x9'),'condition':_0xffb9('0xc'),'callback':afterCreateMessage},{'channel':_0xffb9('0x11'),'model':_0xffb9('0x12'),'event':'afterCreate','condition':_0xffb9('0xa'),'callback':afterCreate},{'channel':'Whatsapp','model':_0xffb9('0x12'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xffb9('0x11'),'model':'WhatsappMessage','event':_0xffb9('0x9'),'condition':_0xffb9('0xc'),'callback':afterCreateMessage},{'channel':_0xffb9('0x13'),'model':_0xffb9('0x14'),'event':_0xffb9('0x9'),'condition':_0xffb9('0xa'),'callback':afterCreate},{'channel':'Fax','model':_0xffb9('0x14'),'event':_0xffb9('0xf'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xffb9('0x13'),'model':_0xffb9('0x15'),'event':_0xffb9('0x9'),'condition':_0xffb9('0xc'),'callback':afterCreateMessage},{'channel':_0xffb9('0x16'),'model':_0xffb9('0x17'),'event':_0xffb9('0x9'),'condition':_0xffb9('0xa'),'callback':afterCreate},{'channel':_0xffb9('0x16'),'model':_0xffb9('0x17'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xffb9('0x16'),'model':'MailMessage','event':_0xffb9('0x9'),'condition':_0xffb9('0xc'),'callback':afterCreateMessage},{'channel':_0xffb9('0x18'),'model':_0xffb9('0x19'),'event':_0xffb9('0x9'),'condition':_0xffb9('0xa'),'callback':afterCreate},{'channel':_0xffb9('0x18'),'model':_0xffb9('0x19'),'event':_0xffb9('0xf'),'condition':_0xffb9('0x1a'),'callback':afterUpdate},{'channel':_0xffb9('0x18'),'model':_0xffb9('0x1b'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage}];function request(_0x47ebe2){return client[_0xffb9('0x1c')]('EventManager',_0x47ebe2)['then'](function(_0x3d69a5){logger['info']('Trigger,\x20%s',_0xffb9('0x1d'),_0x3d69a5);if(_0x3d69a5[_0xffb9('0x1e')]){if(_0x3d69a5[_0xffb9('0x1e')]['code']===0x1f4){logger[_0xffb9('0x1e')](_0xffb9('0x1f'),_0xffb9('0x1d'),_0x3d69a5[_0xffb9('0x1e')]);}}})[_0xffb9('0x20')](function(_0x52fa95){logger[_0xffb9('0x1e')](_0xffb9('0x1f'),'EventManager',_0x52fa95);});}function afterCreateMessage(_0x1e2c1b){return function(_0x1f09cd){_0x1f09cd=_0x1f09cd['get']({'plain':!![]});_0x1f09cd['channel']=_0x1e2c1b;_0x1f09cd[_0xffb9('0x21')]=_0x1e2c1b;_0x1f09cd[_0xffb9('0x22')]=_0x1f09cd[_0xffb9('0x23')];Promise[_0xffb9('0x24')]()[_0xffb9('0x25')](function(){if(typeof _0x1f09cd['ContactId']===_0xffb9('0x26'))return null;var _0x116212=_0xffb9('0x27')+_0x1f09cd[_0xffb9('0x28')];return db['sequelize'][_0xffb9('0x29')](_0x116212,{'type':db[_0xffb9('0x2a')][_0xffb9('0x2b')][_0xffb9('0x2c')],'raw':!![]});})[_0xffb9('0x25')](function(_0xa4ac7a){if(_0xa4ac7a){_0x1f09cd[_0xffb9('0x2d')]=_0xa4ac7a[0x0];}if(typeof _0x1f09cd[_0xffb9('0x2e')]===_0xffb9('0x26'))return;return getAgent(_0x1f09cd[_0xffb9('0x2e')]);})[_0xffb9('0x25')](function(_0x14412c){if(_0x14412c){_0x1f09cd[_0xffb9('0x2f')]=util[_0xffb9('0x30')](_0xffb9('0x31'),_0x14412c['name']);_0x1f09cd[_0xffb9('0x32')]=_0x14412c;_0x1f09cd[_0xffb9('0x33')]=_0x1e2c1b;return request({'event':_0xffb9('0x34'),'message':_0x1f09cd});}else{return request({'event':_0xffb9('0x35'),'message':_0x1f09cd});}})[_0xffb9('0x20')](function(_0x2ec624){logger[_0xffb9('0x1e')]('Trigger,\x20%s',_0xffb9('0x36'),_0x2ec624);});};}function afterCreateOfflineMessage(_0x3b1785){return function(_0x5ae3c1){_0x5ae3c1=_0x5ae3c1['get']({'plain':!![]});_0x5ae3c1[_0xffb9('0x33')]=_0x3b1785;_0x5ae3c1[_0xffb9('0x21')]=_0x3b1785;_0x5ae3c1['event']=_0xffb9('0x37');return request({'event':_0x5ae3c1[_0xffb9('0x22')],'message':_0x5ae3c1});};}function afterCreate(_0x3af1aa,_0x57fe78){return function(_0x4b81fd){var _0x50a3e0=_0x4b81fd[_0xffb9('0x38')]({'plain':!![]});_0x50a3e0[_0xffb9('0x33')]=_0x3af1aa;_0x50a3e0[_0xffb9('0x21')]=_0x3af1aa;_0x50a3e0[_0xffb9('0x22')]=_0xffb9('0x39');Promise[_0xffb9('0x24')]()[_0xffb9('0x25')](function(){var _0x28b9c3=_0xffb9('0x27')+_0x50a3e0[_0xffb9('0x28')];return db[_0xffb9('0x3a')][_0xffb9('0x29')](_0x28b9c3,{'type':db[_0xffb9('0x2a')][_0xffb9('0x2b')]['SELECT'],'raw':!![]});})[_0xffb9('0x25')](function(_0x4518c7){if(_0x4518c7){_0x50a3e0[_0xffb9('0x2d')]=_0x4518c7[0x0];}if(_0x50a3e0['UserId']){return getAgent(_0x50a3e0[_0xffb9('0x2e')]);}return;})[_0xffb9('0x25')](function(_0x1027ab){if(_0x1027ab){_0x50a3e0['interface']=util['format'](_0xffb9('0x31'),_0x1027ab[_0xffb9('0x3b')]);_0x50a3e0['agent']=_0x1027ab;}return request({'event':_0x57fe78,'message':_0x50a3e0});})[_0xffb9('0x20')](function(_0xdf472){logger[_0xffb9('0x1e')]('Trigger,\x20%s','AfterCreate',_0xdf472);});};}function afterUpdate(_0x2d9237){return function(_0x1a2066){var _0x3fbc47=_0x1a2066['changed'](_0xffb9('0x3c'))&&_0x1a2066[_0xffb9('0x3c')];var _0xcc0e1d=_0x1a2066[_0xffb9('0x3d')](_0xffb9('0x3e'));if(_0x3fbc47||_0xcc0e1d){var _0x54bdfc=_0x3fbc47?_0xffb9('0x1a'):_0xffb9('0x3e');var _0x304c23=_0x1a2066['get']({'plain':!![]});_0x304c23[_0xffb9('0x33')]=_0x2d9237;_0x304c23['motionChannel']=_0x2d9237;_0x304c23['event']=_0x3fbc47?_0xffb9('0x3c'):_0xffb9('0x3e');var _0x4fedee=_0xffb9('0x27')+_0x304c23[_0xffb9('0x28')];return db[_0xffb9('0x3a')]['query'](_0x4fedee,{'type':db['Sequelize'][_0xffb9('0x2b')][_0xffb9('0x2c')],'raw':!![]})[_0xffb9('0x25')](function(_0x31538a){if(_0x31538a){_0x304c23[_0xffb9('0x2d')]=_0x31538a[0x0];}if(typeof _0x304c23[_0xffb9('0x2e')]===_0xffb9('0x26'))return;return getAgent(_0x304c23[_0xffb9('0x2e')]);})[_0xffb9('0x25')](function(_0x1093f4){if(_0x1093f4){_0x304c23['interface']=util[_0xffb9('0x30')](_0xffb9('0x31'),_0x1093f4['name']);_0x304c23[_0xffb9('0x32')]=_0x1093f4;}return request({'event':_0x54bdfc,'message':_0x304c23});})[_0xffb9('0x20')](function(_0x1573ae){logger['error']('Trigger,\x20%s',_0xffb9('0x3f'),_0x1573ae);});}};}function getAgent(_0x29096a){return db[_0xffb9('0x40')][_0xffb9('0x41')]({'where':{'id':_0x29096a},'attributes':['id','name',_0xffb9('0x42'),_0xffb9('0x43'),_0xffb9('0x44')],'raw':!![]})[_0xffb9('0x25')](function(_0x116fbd){return _0x116fbd;});}exports[_0xffb9('0x45')]=function(){for(var _0x5b890d=0x0;_0x5b890d=_0x21223e[_0x136e('0x13')]){throw Error(_0x136e('0x14'));}_0x103e17(_0x49df48);})['catch'](function(_0x1b7148){_0x2e20e2(_0x1b7148);});});}; \ No newline at end of file +var _0x5e0c=['then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','mail','chat','fax','sms','whatsapp','openchannel','isValidChannel','includes','blockedAt','getLicense','role','agent','User','count'];(function(_0xfdca,_0x179a1c){var _0x4ebbf0=function(_0x325d05){while(--_0x325d05){_0xfdca['push'](_0xfdca['shift']());}};_0x4ebbf0(++_0x179a1c);}(_0x5e0c,0x1d0));var _0xc5e0=function(_0x91d498,_0x482a89){_0x91d498=_0x91d498-0x0;var _0x1e0294=_0x5e0c[_0x91d498];return _0x1e0294;};'use strict';var _=require(_0xc5e0('0x0'));var BPromise=require(_0xc5e0('0x1'));var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=['voice',_0xc5e0('0x2'),_0xc5e0('0x3'),_0xc5e0('0x4'),_0xc5e0('0x5'),_0xc5e0('0x6'),_0xc5e0('0x7')];exports['getChannels']=function(){return channels;};exports[_0xc5e0('0x8')]=function(_0x1c06c5){_0x1c06c5=_0x1c06c5['toLowerCase']();return _[_0xc5e0('0x9')](channels,_0x1c06c5);};exports['clearBlockUser']=function(_0x5afafe,_0x50dd0e,_0x19618c,_0x213dc9){var _0x3f8873={'loginAttempts':_0x50dd0e,'blocked':_0x19618c};if(!_['isUndefined'](_0x213dc9)){_0x3f8873[_0xc5e0('0xa')]=_0x213dc9;}return _0x5afafe['updateAttributes'](_0x3f8873);};exports[_0xc5e0('0xb')]=function(_0x3421bf){return new BPromise(function(_0x3e9b0d,_0x39e95c){var _0xcf02cf=0x0;if(_0x3421bf[_0xc5e0('0xc')]!==_0xc5e0('0xd')){_0x3e9b0d(_0x3421bf);}db[_0xc5e0('0xe')][_0xc5e0('0xf')]({'where':{'role':_0xc5e0('0xd'),'online':!![],'id':{'$ne':_0x3421bf['id']}}})[_0xc5e0('0x10')](function(_0x6e2179){_0xcf02cf=_0x6e2179;return util['getLicense']();})[_0xc5e0('0x10')](function(_0x26fabe){if(_0x26fabe&&_0x26fabe[_0xc5e0('0x11')]&&_0xcf02cf>=_0x26fabe[_0xc5e0('0x11')]){throw Error(_0xc5e0('0x12'));}_0x3e9b0d(_0x3421bf);})[_0xc5e0('0x13')](function(_0x2c049e){_0x39e95c(_0x2c049e);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 7ebbbc6..0b3ef2b 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0668=['inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Out\x20Of\x20Interval','code','details','OutOfInterval','Conflict','error','stack','statusMessage','status','send','util','../config/logger','api','message','Internal\x20Server\x20Error','name'];(function(_0x226fbe,_0x5a5169){var _0x51be1c=function(_0x3aa7a3){while(--_0x3aa7a3){_0x226fbe['push'](_0x226fbe['shift']());}};_0x51be1c(++_0x5a5169);}(_0x0668,0x1dd));var _0x8066=function(_0x33e706,_0x13cbcc){_0x33e706=_0x33e706-0x0;var _0x5a8382=_0x0668[_0x33e706];return _0x5a8382;};'use strict';var util=require(_0x8066('0x0'));var logger=require(_0x8066('0x1'))(_0x8066('0x2'));var APIError=function(_0x8ccc53,_0x1e791e){this[_0x8066('0x3')]=_0x8ccc53||_0x8066('0x4');this[_0x8066('0x5')]=_0x1e791e||'Error';util[_0x8066('0x6')](APIError,Error);};var APIBadRequestError=function(_0x20772e){this['message']=_0x20772e||_0x8066('0x7');this[_0x8066('0x5')]=_0x8066('0x7');util[_0x8066('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0xaa5b1d){this[_0x8066('0x3')]=_0xaa5b1d||'Forbidden';this[_0x8066('0x5')]=_0x8066('0x8');util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x2ae3ca){this[_0x8066('0x3')]=_0x2ae3ca||_0x8066('0x9');this[_0x8066('0x5')]=_0x8066('0xa');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x22c73b){this[_0x8066('0x3')]=_0x22c73b||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x8066('0x5')]=_0x8066('0xb');this[_0x8066('0xc')]=0x193;this[_0x8066('0xd')]={'type':_0x8066('0xe')};util[_0x8066('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x4949c6){this[_0x8066('0x3')]=_0x4949c6||'Resource\x20Conflict';this['name']=_0x8066('0xf');util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0x5f23f3){switch(_0x5f23f3){case _0x8066('0x7'):return 0x190;case _0x8066('0x8'),_0x8066('0xb'):return 0x193;case _0x8066('0xa'):return 0x194;case _0x8066('0xf'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x39190a){if(_0x39190a==='Out\x20Of\x20Interval')return _0x39190a;return null;}function handleError(_0x517171){return function(_0x300907){logger[_0x8066('0x10')](_0x300907[_0x8066('0x11')]);var _0x2aaae3=getStatusCode(_0x300907['name']);var _0x523f6d=getCustomStatusMessage(_0x300907[_0x8066('0x5')]);if(_0x300907['name']){delete _0x300907[_0x8066('0x5')];}if(_0x523f6d){_0x517171[_0x8066('0x12')]=_0x523f6d;}return _0x517171[_0x8066('0x13')](_0x2aaae3)[_0x8066('0x14')](_0x300907);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xac00=['statusMessage','status','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','inherits','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Resource\x20Conflict','Conflict','Bad\x20Request','Forbidden','error','stack'];(function(_0x5be0e7,_0x50b5f3){var _0x5f4cce=function(_0x163e64){while(--_0x163e64){_0x5be0e7['push'](_0x5be0e7['shift']());}};_0x5f4cce(++_0x50b5f3);}(_0xac00,0x10c));var _0x0ac0=function(_0x5e9689,_0x48e034){_0x5e9689=_0x5e9689-0x0;var _0x2fac94=_0xac00[_0x5e9689];return _0x2fac94;};'use strict';var util=require(_0x0ac0('0x0'));var logger=require(_0x0ac0('0x1'))(_0x0ac0('0x2'));var APIError=function(_0x55fad7,_0x2ba2f3){this[_0x0ac0('0x3')]=_0x55fad7||_0x0ac0('0x4');this[_0x0ac0('0x5')]=_0x2ba2f3||'Error';util[_0x0ac0('0x6')](APIError,Error);};var APIBadRequestError=function(_0x3caaf6){this[_0x0ac0('0x3')]=_0x3caaf6||'Bad\x20Request';this[_0x0ac0('0x5')]='Bad\x20Request';util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x5ca7d3){this[_0x0ac0('0x3')]=_0x5ca7d3||'Forbidden';this[_0x0ac0('0x5')]='Forbidden';util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x34c475){this['message']=_0x34c475||_0x0ac0('0x7');this['name']=_0x0ac0('0x8');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2131f6){this[_0x0ac0('0x3')]=_0x2131f6||_0x0ac0('0x9');this[_0x0ac0('0x5')]=_0x0ac0('0xa');this[_0x0ac0('0xb')]=0x193;this[_0x0ac0('0xc')]={'type':_0x0ac0('0xd')};util[_0x0ac0('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x5bb6ad){this[_0x0ac0('0x3')]=_0x5bb6ad||_0x0ac0('0xe');this[_0x0ac0('0x5')]=_0x0ac0('0xf');util[_0x0ac0('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x147e17){switch(_0x147e17){case _0x0ac0('0x10'):return 0x190;case _0x0ac0('0x11'),_0x0ac0('0xa'):return 0x193;case _0x0ac0('0x8'):return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x2638c6){if(_0x2638c6==='Out\x20Of\x20Interval')return _0x2638c6;return null;}function handleError(_0x2691a3){return function(_0x5cc921){logger[_0x0ac0('0x12')](_0x5cc921[_0x0ac0('0x13')]);var _0x419f0e=getStatusCode(_0x5cc921[_0x0ac0('0x5')]);var _0x2a61a3=getCustomStatusMessage(_0x5cc921[_0x0ac0('0x5')]);if(_0x5cc921[_0x0ac0('0x5')]){delete _0x5cc921[_0x0ac0('0x5')];}if(_0x2a61a3){_0x2691a3[_0x0ac0('0x14')]=_0x2a61a3;}return _0x2691a3[_0x0ac0('0x15')](_0x419f0e)[_0x0ac0('0x16')](_0x5cc921);};}module[_0x0ac0('0x17')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 81fcde7..4187d93 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6057=['exports','404','status','render','json','send'];(function(_0x1df803,_0x25192d){var _0x20ef12=function(_0xfc0101){while(--_0xfc0101){_0x1df803['push'](_0x1df803['shift']());}};_0x20ef12(++_0x25192d);}(_0x6057,0x12c));var _0x7605=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0x6057[_0x5a5395];return _0x4da43d;};'use strict';module[_0x7605('0x0')][0x194]=function pageNotFound(_0x4f8278,_0x170d27){var _0x54e9a9=_0x7605('0x1');var _0xa3fbd=0x194;var _0x201416={'status':_0xa3fbd};_0x170d27[_0x7605('0x2')](_0x201416[_0x7605('0x2')]);_0x170d27[_0x7605('0x3')](_0x54e9a9,{},function(_0x3a8d91,_0x22bb54){if(_0x3a8d91){return _0x170d27['status'](_0x201416[_0x7605('0x2')])[_0x7605('0x4')](_0x201416);}_0x170d27[_0x7605('0x5')](_0x22bb54);});}; \ No newline at end of file +var _0x4d30=['json','send','exports','status'];(function(_0x41875e,_0x347ba6){var _0x4c0a5c=function(_0x58beb7){while(--_0x58beb7){_0x41875e['push'](_0x41875e['shift']());}};_0x4c0a5c(++_0x347ba6);}(_0x4d30,0x1da));var _0x04d3=function(_0x1d4561,_0x566c1e){_0x1d4561=_0x1d4561-0x0;var _0x22e89f=_0x4d30[_0x1d4561];return _0x22e89f;};'use strict';module[_0x04d3('0x0')][0x194]=function pageNotFound(_0x2b2fdf,_0x358ef5){var _0x2dbb93='404';var _0x386e88=0x194;var _0x2f77a0={'status':_0x386e88};_0x358ef5[_0x04d3('0x1')](_0x2f77a0[_0x04d3('0x1')]);_0x358ef5['render'](_0x2dbb93,{},function(_0x44b2f5,_0x2e3fd8){if(_0x44b2f5){return _0x358ef5['status'](_0x2f77a0[_0x04d3('0x1')])[_0x04d3('0x2')](_0x2f77a0);}_0x358ef5[_0x04d3('0x3')](_0x2e3fd8);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index e06b1a8..84cf899 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e54=['../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','userSetting','hasMany','VoiceQueuesRt','Extensions','CmHopperFinal','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteractions','SenderId','Hoppers','SET\x20NULL','belongsTo','UserProfile','userProfileId','belongsToMany','Groups','chat_group_has_users','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteraction','VoiceQueues','MailQueue','FaxQueues','SmsQueue','SmsQueues','UserSmsQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccount','user_has_whatsapp_accounts','VoiceExtension','ChanSpyId','Sounds','Members','VoiceQueueId','HopperHistories','CmHopperBlack','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceQueueReport','QueueCalls','AgentReports','uniqueid','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Interactions','Applications','List','Template','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Tag','ThroughTags','Attachments','Interaction','ChatOfflineMessageId','TagId','ListId','DashboardItem','Items','Dispositions','FaxAccountId','Answers','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsMessage','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','ChatWebsiteId','ProactiveActions','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','Contacts','CompanyId','Company','cm_user_has_contacts','cm_contact_has_tags','AdditionalPhones','CmHopperId','Agent','Campaign','CampaignId','OwnerId','Queue','All','OneAll','AutomationAllId','Condition','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmContactId','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','CustomReportId','AnalyticMetric','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','Description','SugarcrmAccount','SugarcrmConfiguration','Subject','SubjectId','Field','VariableId','ZohoField','ZohoAccount','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','Dynamics365Account','FreshsalesAccount','FreshsalesConfiguration','FreshsalesField','ChatInternalMessage','ToId','SessionId','JscriptyProject','ProjectId','MailQueues','team_has_chat_queues','ChatQueues','team_has_openchannel_queues','OpenchannelQueues','team_has_whatsapp_queues','VoicePrefixes','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','voice_queues_has_cm_lists','UserProfileSections','Resources','sectionId','WhatsappAccount','WhatsappAccountId','WhatsappApplication','WhatsappQueue','WhatsappInteractionId','user_has_whatsapp_interactions','ToWhatsappAccountId','WhatsappQueueId','user','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','password','username','options','User','../api/user/user.model','VoiceChanSpy','VoiceContext','import','../api/voiceContext/voiceContext.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../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/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','ChatGroup','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','Action','../api/action/action.model','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','../api/cdr/cdr.model','VoiceQueuesLog','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Variable','../api/variable/variable.model','Integration','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskConfiguration','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/whatsappAccount/whatsappAccount.model'];(function(_0x2c9c68,_0x49ad48){var _0x53576f=function(_0x2210ce){while(--_0x2210ce){_0x2c9c68['push'](_0x2c9c68['shift']());}};_0x53576f(++_0x49ad48);}(_0x8e54,0x108));var _0x48e5=function(_0x3bb03e,_0xbf6224){_0x3bb03e=_0x3bb03e-0x0;var _0x166baa=_0x8e54[_0x3bb03e];return _0x166baa;};'use strict';var config=require(_0x48e5('0x0'));var Sequelize=require(_0x48e5('0x1'));var _=require(_0x48e5('0x2'));var jstz=require(_0x48e5('0x3'));var timezone=jstz[_0x48e5('0x4')]();config[_0x48e5('0x1')]=_[_0x48e5('0x5')](config[_0x48e5('0x1')],{'database':'motion2','username':_0x48e5('0x6'),'password':_0x48e5('0x7'),'options':{'host':_0x48e5('0x8'),'port':0xcea,'dialect':_0x48e5('0x9'),'dialectOptions':{'charset':_0x48e5('0xa')},'logging':![],'timezone':timezone[_0x48e5('0xb')](),'define':{'charset':_0x48e5('0xc'),'collate':_0x48e5('0xd')}}});config['sequelizeHistory']=_[_0x48e5('0x5')](config[_0x48e5('0xe')],{'database':'motion2','username':'xcall','password':'xC@LL1234','options':{'host':_0x48e5('0x8'),'port':0xcea,'dialect':_0x48e5('0x9'),'dialectOptions':{'charset':_0x48e5('0xa')},'logging':![],'timezone':timezone[_0x48e5('0xb')](),'define':{'charset':_0x48e5('0xc'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x48e5('0x1')][_0x48e5('0xf')],config['sequelize']['username'],config[_0x48e5('0x1')][_0x48e5('0x10')],config[_0x48e5('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x48e5('0xe')][_0x48e5('0xf')],config[_0x48e5('0xe')][_0x48e5('0x11')],config[_0x48e5('0xe')][_0x48e5('0x10')],config[_0x48e5('0xe')][_0x48e5('0x12')])};db[_0x48e5('0x13')]=db[_0x48e5('0x1')]['import'](_0x48e5('0x14'));db[_0x48e5('0x15')]=db[_0x48e5('0x1')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db[_0x48e5('0x16')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x18'));db['VoiceExtension']=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/voiceExtension/voiceExtension.model');db[_0x48e5('0x19')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x1a'));db[_0x48e5('0x1b')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x1c'));db[_0x48e5('0x1d')]=db['sequelize'][_0x48e5('0x17')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/screenRecording/screenRecording.model');db[_0x48e5('0x1e')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x1f'));db[_0x48e5('0x20')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x21'));db[_0x48e5('0x22')]=db['sequelize']['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x48e5('0x23')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x24'));db[_0x48e5('0x25')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0x26'));db['VoiceQueueReport']=db[_0x48e5('0x1')]['import'](_0x48e5('0x27'));db[_0x48e5('0x28')]=db[_0x48e5('0x1')]['import'](_0x48e5('0x29'));db[_0x48e5('0x2a')]=db[_0x48e5('0x1')]['import']('../api/trunk/trunk.model');db['VoiceTransferReport']=db['sequelize'][_0x48e5('0x17')](_0x48e5('0x2b'));db[_0x48e5('0x2c')]=db['sequelize']['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x48e5('0x2d')]=db['sequelize']['import'](_0x48e5('0x2e'));db[_0x48e5('0x2f')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x30'));db[_0x48e5('0x31')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0x32'));db[_0x48e5('0x33')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x34'));db['UserSmsQueue']=db['sequelize']['import'](_0x48e5('0x35'));db[_0x48e5('0x36')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0x37'));db[_0x48e5('0x38')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x39'));db[_0x48e5('0x3a')]=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/mailServerIn/mailServerIn.model');db[_0x48e5('0x3b')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0x3c'));db[_0x48e5('0x3d')]=db[_0x48e5('0x1')]['import']('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/mailQueue/mailQueue.model');db[_0x48e5('0x3e')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x3f'));db[_0x48e5('0x40')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0x41'));db[_0x48e5('0x42')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x43'));db[_0x48e5('0x44')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x45'));db[_0x48e5('0x46')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0x47'));db[_0x48e5('0x48')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x49'));db['DashboardItem']=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x4a'));db[_0x48e5('0x4b')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x4c'));db[_0x48e5('0x4d')]=db[_0x48e5('0x1')]['import'](_0x48e5('0x4e'));db[_0x48e5('0x4f')]=db['sequelize']['import'](_0x48e5('0x50'));db['FaxMessage']=db[_0x48e5('0x1')]['import']('../api/faxMessage/faxMessage.model');db[_0x48e5('0x51')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x52'));db['FaxQueueReport']=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x53'));db['SmsAccount']=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x54'));db[_0x48e5('0x55')]=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/smsApplication/smsApplication.model');db[_0x48e5('0x56')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x57'));db['SmsMessage']=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/smsMessage/smsMessage.model');db['SmsQueue']=db['sequelize'][_0x48e5('0x17')](_0x48e5('0x58'));db[_0x48e5('0x59')]=db[_0x48e5('0x1')]['import'](_0x48e5('0x5a'));db[_0x48e5('0x5b')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x5c'));db[_0x48e5('0x5d')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x5e'));db['OpenchannelMessage']=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x5f'));db[_0x48e5('0x60')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x61'));db[_0x48e5('0x62')]=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/chatWebsite/chatWebsite.model');db[_0x48e5('0x63')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x64'));db[_0x48e5('0x65')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x66'));db[_0x48e5('0x67')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x68'));db[_0x48e5('0x69')]=db[_0x48e5('0x1')]['import'](_0x48e5('0x6a'));db[_0x48e5('0x6b')]=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x48e5('0x6c')]=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/chatQueue/chatQueue.model');db[_0x48e5('0x6d')]=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/chatGroup/chatGroup.model');db[_0x48e5('0x6e')]=db['sequelize']['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0x48e5('0x6f')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0x70'));db[_0x48e5('0x71')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x72'));db[_0x48e5('0x73')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x74'));db['CmHopperBlack']=db['sequelize'][_0x48e5('0x17')](_0x48e5('0x75'));db['CmHopperFinal']=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x76'));db[_0x48e5('0x77')]=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x48e5('0x78')]=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/cmCustomField/cmCustomField.model');db[_0x48e5('0x79')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x7a'));db[_0x48e5('0x7b')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x7c'));db[_0x48e5('0x7d')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x7e'));db[_0x48e5('0x7f')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x80'));db['Condition']=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x81'));db[_0x48e5('0x82')]=db['sequelize'][_0x48e5('0x17')]('../api/interval/interval.model');db[_0x48e5('0x83')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x84'));db[_0x48e5('0x85')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x86'));db[_0x48e5('0x87')]=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db['sequelize']['import'](_0x48e5('0x88'));db[_0x48e5('0x89')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x8a'));db['Tag']=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x8b'));db[_0x48e5('0x8c')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x8d'));db[_0x48e5('0x8e')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x8f'));db[_0x48e5('0x90')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x91'));db['Template']=db[_0x48e5('0x1')]['import'](_0x48e5('0x92'));db['Trigger']=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/trigger/trigger.model');db[_0x48e5('0x93')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x94'));db[_0x48e5('0x95')]=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/integration/integration.model');db['IntegrationReport']=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x96'));db[_0x48e5('0x97')]=db['sequelize']['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0x48e5('0x98')]=db['sequelize']['import'](_0x48e5('0x99'));db['AnalyticExtractedReport']=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x9a'));db[_0x48e5('0x9b')]=db[_0x48e5('0x1')]['import'](_0x48e5('0x9c'));db[_0x48e5('0x9d')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x9e'));db[_0x48e5('0x9f')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0xa0'));db[_0x48e5('0xa1')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0xa2'));db[_0x48e5('0xa3')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xa4'));db['SugarcrmAccount']=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xa5'));db[_0x48e5('0xa6')]=db['sequelize']['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0x48e5('0xa7')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0xa8'));db[_0x48e5('0xa9')]=db[_0x48e5('0x1')]['import'](_0x48e5('0xaa'));db[_0x48e5('0xab')]=db[_0x48e5('0x1')]['import']('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db['sequelize']['import'](_0x48e5('0xac'));db[_0x48e5('0xad')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0xae'));db['ZohoField']=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xaf'));db[_0x48e5('0xb0')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xb1'));db[_0x48e5('0xb2')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xb3'));db['ZendeskField']=db[_0x48e5('0x1')]['import']('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x48e5('0xb4')]=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x48e5('0xb5')]=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x48e5('0xb6')]=db[_0x48e5('0x1')]['import'](_0x48e5('0xb7'));db[_0x48e5('0xb8')]=db['sequelize'][_0x48e5('0x17')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x48e5('0xb9')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xba'));db[_0x48e5('0xbb')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xbc'));db[_0x48e5('0xbd')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xbe'));db[_0x48e5('0xbf')]=db['sequelize']['import'](_0x48e5('0xc0'));db['Dynamics365Account']=db['sequelize'][_0x48e5('0x17')](_0x48e5('0xc1'));db[_0x48e5('0xc2')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xc3'));db[_0x48e5('0xc4')]=db[_0x48e5('0x1')]['import'](_0x48e5('0xc5'));db['FreshsalesAccount']=db['sequelize']['import'](_0x48e5('0xc6'));db['FreshsalesConfiguration']=db[_0x48e5('0x1')]['import'](_0x48e5('0xc7'));db['FreshsalesField']=db[_0x48e5('0x1')]['import'](_0x48e5('0xc8'));db[_0x48e5('0x95')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0xc9'));db[_0x48e5('0xca')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xcb'));db[_0x48e5('0xcc')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0xcd'));db['ChatInternalMessage']=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xce'));db['JscriptyAnswerReport']=db['sequelize'][_0x48e5('0x17')](_0x48e5('0xcf'));db[_0x48e5('0xd0')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xd1'));db[_0x48e5('0xd2')]=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x48e5('0xd3')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0xd4'));db[_0x48e5('0xd5')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xd6'));db[_0x48e5('0xd7')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xd8'));db['JscriptyProject']=db[_0x48e5('0x1')]['import']('../api/jscriptyProject/jscriptyProject.model');db[_0x48e5('0xd9')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xda'));db[_0x48e5('0xdb')]=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/squareOdbc/squareOdbc.model');db[_0x48e5('0xdc')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0xdd'));db[_0x48e5('0xde')]=db['sequelize']['import']('../api/squareRecording/squareRecording.model');db[_0x48e5('0xdf')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xe0'));db[_0x48e5('0xe1')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xe2'));db['License']=db['sequelize'][_0x48e5('0x17')]('../api/license/license.model');db['Campaign']=db[_0x48e5('0x1')]['import'](_0x48e5('0xe3'));db[_0x48e5('0xe4')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0xe5'));db[_0x48e5('0xe6')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0xe7'));db[_0x48e5('0xe8')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xe9'));db[_0x48e5('0xea')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0xeb'));db[_0x48e5('0xec')]=db[_0x48e5('0x1')]['import'](_0x48e5('0xed'));db[_0x48e5('0xee')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0xef'));db['OpenchannelTransferReport']=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xf0'));db[_0x48e5('0xf1')]=db['sequelize']['import'](_0x48e5('0xf2'));db[_0x48e5('0xf3')]=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/cmList/cmList.model');db[_0x48e5('0xf4')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xf5'));db['UserProfile']=db[_0x48e5('0x1')]['import'](_0x48e5('0xf6'));db['UserProfileSection']=db['sequelize']['import'](_0x48e5('0xf7'));db[_0x48e5('0xf8')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0xf9'));db[_0x48e5('0xfa')]=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0x48e5('0x1')]['import'](_0x48e5('0xfb'));db['WhatsappApplication']=db[_0x48e5('0x1')]['import'](_0x48e5('0xfc'));db['WhatsappInteraction']=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0xfd'));db[_0x48e5('0xfe')]=db[_0x48e5('0x1')]['import'](_0x48e5('0xff'));db[_0x48e5('0x100')]=db[_0x48e5('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x48e5('0x101')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x102'));db['WhatsappQueue']=db['sequelize'][_0x48e5('0x17')](_0x48e5('0x103'));db[_0x48e5('0x104')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x105'));db[_0x48e5('0x106')]=db[_0x48e5('0x1')][_0x48e5('0x17')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x48e5('0x107')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x108'));db[_0x48e5('0x109')]=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x10a'));db[_0x48e5('0x10b')]=db['sequelize'][_0x48e5('0x17')](_0x48e5('0x10c'));db['MailInteractionHasTag']=db[_0x48e5('0x1')][_0x48e5('0x17')](_0x48e5('0x10d'));db[_0x48e5('0x13')][_0x48e5('0x10e')](db[_0x48e5('0x1e')],{'as':_0x48e5('0x1e'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x110')});db[_0x48e5('0x13')][_0x48e5('0x10e')](db[_0x48e5('0x10b')],{'as':_0x48e5('0x111'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x110')});db['User'][_0x48e5('0x112')](db[_0x48e5('0x1d')],{'as':'Recordings','foreignKey':_0x48e5('0x110')});db[_0x48e5('0x13')][_0x48e5('0x112')](db[_0x48e5('0x2c')],{'as':_0x48e5('0x113'),'foreignKey':_0x48e5('0x110')});db[_0x48e5('0x13')][_0x48e5('0x112')](db['VoiceExtension'],{'as':_0x48e5('0x114'),'onDelete':_0x48e5('0x10f'),'hooks':!![]});db['User'][_0x48e5('0x112')](db[_0x48e5('0x115')],{'as':_0x48e5('0x116'),'foreignKey':_0x48e5('0x110')});db['User'][_0x48e5('0x112')](db[_0x48e5('0x77')],{'as':_0x48e5('0x117'),'foreignKey':_0x48e5('0x110')});db[_0x48e5('0x13')]['hasMany'](db[_0x48e5('0x78')],{'as':_0x48e5('0x78'),'foreignKey':'UserId'});db['User'][_0x48e5('0x112')](db[_0x48e5('0x5d')],{'as':_0x48e5('0x118'),'foreignKey':'UserId'});db[_0x48e5('0x13')][_0x48e5('0x112')](db[_0x48e5('0x67')],{'as':_0x48e5('0x119'),'foreignKey':'UserId'});db[_0x48e5('0x13')][_0x48e5('0x112')](db[_0x48e5('0x56')],{'as':_0x48e5('0x11a'),'foreignKey':_0x48e5('0x110')});db[_0x48e5('0x13')][_0x48e5('0x112')](db[_0x48e5('0x4f')],{'as':_0x48e5('0x11b'),'foreignKey':_0x48e5('0x110')});db[_0x48e5('0x13')][_0x48e5('0x112')](db[_0x48e5('0x40')],{'as':'MailInteractions','foreignKey':_0x48e5('0x110')});db[_0x48e5('0x13')][_0x48e5('0x112')](db['WhatsappInteraction'],{'as':_0x48e5('0x11c'),'foreignKey':'UserId'});db[_0x48e5('0x13')][_0x48e5('0x112')](db[_0x48e5('0xfa')],{'as':'UserNotifications','foreignKey':_0x48e5('0x11d')});db[_0x48e5('0x13')]['hasMany'](db[_0x48e5('0x73')],{'as':_0x48e5('0x11e'),'foreignKey':_0x48e5('0x110'),'onDelete':_0x48e5('0x11f')});db[_0x48e5('0x13')][_0x48e5('0x120')](db[_0x48e5('0x121')],{'as':'UserProfile','foreignKey':_0x48e5('0x122')});db[_0x48e5('0x13')][_0x48e5('0x123')](db[_0x48e5('0x6d')],{'as':_0x48e5('0x124'),'through':_0x48e5('0x125')});db[_0x48e5('0x13')][_0x48e5('0x123')](db[_0x48e5('0x71')],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x48e5('0x13')][_0x48e5('0x123')](db[_0x48e5('0xf3')],{'as':_0x48e5('0x126'),'through':_0x48e5('0x127')});db['User'][_0x48e5('0x123')](db[_0x48e5('0xe1')],{'through':_0x48e5('0x128')});db[_0x48e5('0x13')][_0x48e5('0x123')](db[_0x48e5('0x40')],{'as':_0x48e5('0x129'),'through':_0x48e5('0x12a')});db[_0x48e5('0x13')][_0x48e5('0x123')](db[_0x48e5('0x67')],{'as':'ChatInteractions','through':_0x48e5('0x12b')});db[_0x48e5('0x13')][_0x48e5('0x123')](db[_0x48e5('0x4f')],{'as':'FaxInteractions','through':_0x48e5('0x12c')});db[_0x48e5('0x13')][_0x48e5('0x123')](db[_0x48e5('0x56')],{'as':_0x48e5('0x11a'),'through':_0x48e5('0x12d')});db[_0x48e5('0x13')][_0x48e5('0x123')](db[_0x48e5('0x5d')],{'as':_0x48e5('0x118'),'through':_0x48e5('0x12e')});db[_0x48e5('0x13')][_0x48e5('0x123')](db[_0x48e5('0x12f')],{'as':_0x48e5('0x11c'),'through':'user_has_whatsapp_interactions'});db[_0x48e5('0x13')][_0x48e5('0x123')](db[_0x48e5('0x1b')],{'as':_0x48e5('0x130'),'through':_0x48e5('0x2d'),'required':![]});db[_0x48e5('0x13')]['belongsToMany'](db['VoicePrefix'],{'as':'VoicePrefixes','through':_0x48e5('0x109'),'required':![]});db[_0x48e5('0x13')][_0x48e5('0x123')](db[_0x48e5('0x131')],{'as':'MailQueues','through':_0x48e5('0x31'),'required':![]});db[_0x48e5('0x13')][_0x48e5('0x123')](db[_0x48e5('0x6c')],{'as':'ChatQueues','through':_0x48e5('0x2f'),'required':![],'hooks':!![]});db[_0x48e5('0x13')]['belongsToMany'](db[_0x48e5('0x51')],{'as':_0x48e5('0x132'),'through':_0x48e5('0x33'),'required':![]});db['User'][_0x48e5('0x123')](db[_0x48e5('0x133')],{'as':_0x48e5('0x134'),'through':_0x48e5('0x135'),'required':![]});db[_0x48e5('0x13')][_0x48e5('0x123')](db[_0x48e5('0x60')],{'as':'OpenchannelQueues','through':_0x48e5('0x36'),'required':![]});db[_0x48e5('0x13')][_0x48e5('0x123')](db['WhatsappQueue'],{'as':_0x48e5('0x136'),'through':_0x48e5('0x38'),'required':![]});db['User']['belongsToMany'](db[_0x48e5('0xf3')],{'through':_0x48e5('0x127')});db[_0x48e5('0x13')][_0x48e5('0x123')](db[_0x48e5('0x62')],{'as':_0x48e5('0x137'),'through':_0x48e5('0x138')});db[_0x48e5('0x13')][_0x48e5('0x123')](db[_0x48e5('0x4b')],{'as':_0x48e5('0x139'),'through':_0x48e5('0x13a')});db[_0x48e5('0x13')][_0x48e5('0x123')](db[_0x48e5('0x3d')],{'as':_0x48e5('0x13b'),'through':_0x48e5('0x13c')});db[_0x48e5('0x13')]['belongsToMany'](db[_0x48e5('0x59')],{'as':_0x48e5('0x13d'),'through':'user_has_openchannel_accounts'});db[_0x48e5('0x13')][_0x48e5('0x123')](db[_0x48e5('0x13e')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0x48e5('0x13')][_0x48e5('0x123')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0x48e5('0x13f')});db[_0x48e5('0x15')][_0x48e5('0x112')](db[_0x48e5('0x140')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0x48e5('0x141')});db[_0x48e5('0x16')][_0x48e5('0x112')](db[_0x48e5('0x140')],{'onDelete':_0x48e5('0x10f')});db[_0x48e5('0x140')]['hasMany'](db[_0x48e5('0x140')],{'as':'Applications','onDelete':_0x48e5('0x10f')});db[_0x48e5('0x19')]['belongsToMany'](db[_0x48e5('0x89')],{'as':_0x48e5('0x142'),'through':'moh_has_sounds'});db['VoiceQueue']['hasMany'](db[_0x48e5('0x2c')],{'as':_0x48e5('0x143'),'foreignKey':'VoiceQueueId'});db[_0x48e5('0x1b')][_0x48e5('0x112')](db[_0x48e5('0x73')],{'as':_0x48e5('0x11e'),'foreignKey':_0x48e5('0x144')});db['VoiceQueue'][_0x48e5('0x112')](db[_0x48e5('0x115')],{'as':_0x48e5('0x116'),'foreignKey':_0x48e5('0x144')});db[_0x48e5('0x1b')]['hasMany'](db[_0x48e5('0x77')],{'as':_0x48e5('0x145'),'foreignKey':_0x48e5('0x144')});db[_0x48e5('0x1b')]['hasMany'](db[_0x48e5('0x78')],{'as':'ReportAgentPreview','foreignKey':_0x48e5('0x144')});db[_0x48e5('0x1b')][_0x48e5('0x112')](db[_0x48e5('0x146')],{'as':'HopperBlacks','foreignKey':_0x48e5('0x144')});db['VoiceQueue']['hasMany'](db['JscriptySessionReport'],{'as':_0x48e5('0x147'),'foreignKey':_0x48e5('0x144')});db[_0x48e5('0x1b')][_0x48e5('0x120')](db[_0x48e5('0x2a')],{'as':_0x48e5('0x2a'),'foreignKey':_0x48e5('0x148')});db[_0x48e5('0x1b')]['belongsTo'](db[_0x48e5('0x2a')],{'as':_0x48e5('0x149'),'foreignKey':_0x48e5('0x14a')});db[_0x48e5('0x1b')][_0x48e5('0x120')](db[_0x48e5('0x82')],{'as':_0x48e5('0x82'),'foreignKey':_0x48e5('0x14b')});db[_0x48e5('0x1b')][_0x48e5('0x120')](db['Pause'],{'as':_0x48e5('0x14c'),'foreignKey':_0x48e5('0x14d')});db[_0x48e5('0x1b')][_0x48e5('0x123')](db[_0x48e5('0xf3')],{'as':_0x48e5('0x126'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0x48e5('0x123')](db[_0x48e5('0x13')],{'as':_0x48e5('0x14e'),'through':_0x48e5('0x2d')});db[_0x48e5('0x1b')][_0x48e5('0x123')](db[_0x48e5('0xe1')],{'as':_0x48e5('0x14f'),'through':_0x48e5('0x106')});db[_0x48e5('0x1b')][_0x48e5('0x123')](db[_0x48e5('0xf3')],{'as':_0x48e5('0x150'),'through':_0x48e5('0x151')});db['VoiceRecording']['belongsTo'](db[_0x48e5('0x13')],{'as':_0x48e5('0x13'),'foreignKey':_0x48e5('0x110')});db['ScreenRecording']['belongsTo'](db[_0x48e5('0x13')],{'as':_0x48e5('0x13'),'foreignKey':_0x48e5('0x110')});db[_0x48e5('0x1e')][_0x48e5('0x112')](db[_0x48e5('0x20')],{'as':_0x48e5('0x152'),'onDelete':_0x48e5('0x10f'),'foreignKey':'mailboxuser','sourceKey':_0x48e5('0x153')});db[_0x48e5('0x20')][_0x48e5('0x120')](db[_0x48e5('0x1e')],{'foreignKey':_0x48e5('0x154'),'targetKey':_0x48e5('0x153')});db[_0x48e5('0x22')]['hasMany'](db[_0x48e5('0x155')],{'as':_0x48e5('0x156'),'foreignKey':'uniqueid','constraints':![]});db[_0x48e5('0x22')]['hasMany'](db[_0x48e5('0x25')],{'as':_0x48e5('0x157'),'foreignKey':_0x48e5('0x158'),'constraints':![]});db[_0x48e5('0x22')][_0x48e5('0x120')](db[_0x48e5('0x13')],{'as':_0x48e5('0x13'),'foreignKey':'UserId'});db[_0x48e5('0x22')]['belongsTo'](db[_0x48e5('0x71')],{'as':_0x48e5('0x159'),'foreignKey':_0x48e5('0x15a')});db[_0x48e5('0x3a')][_0x48e5('0x120')](db[_0x48e5('0x3d')],{'as':_0x48e5('0x3d'),'foreignKey':_0x48e5('0x15b')});db[_0x48e5('0x3a')][_0x48e5('0x120')](db['CloudProvider'],{'as':_0x48e5('0x104'),'foreignKey':_0x48e5('0x15c'),'onDelete':'restrict'});db[_0x48e5('0x3b')][_0x48e5('0x120')](db['MailAccount'],{'as':_0x48e5('0x3d'),'foreignKey':_0x48e5('0x15b')});db['MailServerOut']['belongsTo'](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x48e5('0x15c'),'onDelete':_0x48e5('0x15d')});db['MailAccount']['hasOne'](db[_0x48e5('0x3a')],{'as':_0x48e5('0x15e'),'onDelete':_0x48e5('0x10f')});db[_0x48e5('0x3d')][_0x48e5('0x10e')](db[_0x48e5('0x3b')],{'as':_0x48e5('0x15f'),'onDelete':'cascade'});db['MailAccount']['hasMany'](db[_0x48e5('0x7f')],{'as':'Dispositions','foreignKey':_0x48e5('0x15b'),'onDelete':_0x48e5('0x10f')});db[_0x48e5('0x3d')][_0x48e5('0x112')](db[_0x48e5('0x7d')],{'as':'Answers','foreignKey':_0x48e5('0x15b')});db[_0x48e5('0x3d')][_0x48e5('0x112')](db[_0x48e5('0x42')],{'as':'Messages','foreignKey':_0x48e5('0x15b')});db['MailAccount'][_0x48e5('0x112')](db[_0x48e5('0x40')],{'as':_0x48e5('0x160')});db[_0x48e5('0x3d')][_0x48e5('0x112')](db['MailApplication'],{'as':_0x48e5('0x161'),'foreignKey':_0x48e5('0x15b'),'onDelete':_0x48e5('0x10f')});db[_0x48e5('0x3d')]['belongsTo'](db[_0x48e5('0xf3')],{'as':_0x48e5('0x162'),'foreignKey':'ListId'});db[_0x48e5('0x3d')][_0x48e5('0x120')](db[_0x48e5('0x163')],{'as':_0x48e5('0x163'),'foreignKey':_0x48e5('0x164')});db[_0x48e5('0x3d')]['belongsTo'](db['Pause'],{'as':_0x48e5('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x48e5('0x3d')][_0x48e5('0x123')](db[_0x48e5('0x13')],{'as':'Agents','through':_0x48e5('0x13c')});db['MailQueue'][_0x48e5('0x123')](db[_0x48e5('0x13')],{'as':_0x48e5('0x14e'),'through':_0x48e5('0x31')});db[_0x48e5('0x131')][_0x48e5('0x123')](db[_0x48e5('0xe1')],{'through':_0x48e5('0x165'),'as':_0x48e5('0x14f')});db['MailInteraction']['hasMany'](db[_0x48e5('0x42')],{'as':_0x48e5('0x152'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x166')});db[_0x48e5('0x40')]['belongsTo'](db[_0x48e5('0x3d')],{'as':_0x48e5('0x167'),'foreignKey':_0x48e5('0x15b')});db[_0x48e5('0x40')][_0x48e5('0x120')](db[_0x48e5('0x71')],{'as':'Contact','foreignKey':_0x48e5('0x15a')});db[_0x48e5('0x40')][_0x48e5('0x120')](db[_0x48e5('0x13')],{'as':_0x48e5('0x168'),'foreignKey':_0x48e5('0x110')});db[_0x48e5('0x40')][_0x48e5('0x123')](db['Tag'],{'through':_0x48e5('0x169'),'as':_0x48e5('0x16a')});db[_0x48e5('0x40')]['belongsToMany'](db[_0x48e5('0x16b')],{'through':_0x48e5('0x169'),'as':_0x48e5('0x16c')});db[_0x48e5('0x40')][_0x48e5('0x123')](db['User'],{'as':'Users','through':_0x48e5('0x12a'),'foreignKey':_0x48e5('0x166')});db[_0x48e5('0x42')][_0x48e5('0x112')](db['Attachment'],{'as':_0x48e5('0x16d'),'onDelete':_0x48e5('0x10f')});db['MailMessage'][_0x48e5('0x120')](db['User'],{'as':_0x48e5('0x13')});db[_0x48e5('0x42')][_0x48e5('0x120')](db[_0x48e5('0x71')],{'onDelete':_0x48e5('0x10f'),'as':_0x48e5('0x159')});db[_0x48e5('0x42')][_0x48e5('0x120')](db[_0x48e5('0x40')],{'as':_0x48e5('0x16e'),'foreignKey':_0x48e5('0x166')});db['MailMessage'][_0x48e5('0x120')](db[_0x48e5('0x3d')],{'as':_0x48e5('0x167'),'foreignKey':'MailAccountId'});db[_0x48e5('0x42')][_0x48e5('0x120')](db[_0x48e5('0x62')],{'as':_0x48e5('0x62'),'foreignKey':'ChatWebsiteId'});db['MailMessage'][_0x48e5('0x120')](db[_0x48e5('0x6b')],{'as':_0x48e5('0x6b'),'foreignKey':_0x48e5('0x16f')});db[_0x48e5('0x44')]['belongsTo'](db[_0x48e5('0x13')],{'onDelete':_0x48e5('0x15d')});db['MailApplication'][_0x48e5('0x120')](db['MailQueue'],{'onDelete':_0x48e5('0x15d')});db[_0x48e5('0x44')][_0x48e5('0x120')](db[_0x48e5('0x3d')],{'onDelete':_0x48e5('0x15d')});db[_0x48e5('0x44')][_0x48e5('0x120')](db[_0x48e5('0x82')],{'onDelete':_0x48e5('0x15d'),'foreignKey':_0x48e5('0x14b')});db['MailApplication'][_0x48e5('0x120')](db[_0x48e5('0x16b')],{'onDelete':_0x48e5('0x15d'),'foreignKey':_0x48e5('0x170')});db[_0x48e5('0x46')][_0x48e5('0x120')](db['MailAccount'],{});db[_0x48e5('0x46')]['belongsTo'](db[_0x48e5('0xf3')],{'as':_0x48e5('0x162'),'foreignKey':_0x48e5('0x171')});db[_0x48e5('0x46')]['belongsTo'](db[_0x48e5('0x71')],{'as':'Contact','foreignKey':_0x48e5('0x15a')});db[_0x48e5('0x46')][_0x48e5('0x120')](db[_0x48e5('0x40')],{});db[_0x48e5('0x46')][_0x48e5('0x120')](db[_0x48e5('0x42')],{});db[_0x48e5('0x46')]['belongsTo'](db['User'],{});db[_0x48e5('0x46')]['belongsTo'](db[_0x48e5('0x131')],{});db[_0x48e5('0x48')][_0x48e5('0x112')](db[_0x48e5('0x172')],{'as':_0x48e5('0x173'),'onDelete':_0x48e5('0x10f')});db['FaxAccount'][_0x48e5('0x112')](db[_0x48e5('0x7f')],{'as':_0x48e5('0x174'),'foreignKey':_0x48e5('0x175'),'onDelete':_0x48e5('0x10f')});db[_0x48e5('0x4b')][_0x48e5('0x112')](db[_0x48e5('0x7d')],{'as':_0x48e5('0x176'),'foreignKey':'FaxAccountId'});db['FaxAccount']['hasMany'](db[_0x48e5('0x4f')],{'as':_0x48e5('0x160')});db['FaxAccount'][_0x48e5('0x112')](db[_0x48e5('0x4d')],{'as':_0x48e5('0x161'),'foreignKey':_0x48e5('0x175'),'onDelete':_0x48e5('0x10f')});db['FaxAccount'][_0x48e5('0x112')](db[_0x48e5('0x140')],{'as':_0x48e5('0x177'),'onDelete':'cascade'});db[_0x48e5('0x4b')]['hasMany'](db[_0x48e5('0x178')],{'as':'Messages'});db[_0x48e5('0x4b')][_0x48e5('0x120')](db['Trunk'],{'as':'Trunk'});db[_0x48e5('0x4b')][_0x48e5('0x120')](db[_0x48e5('0xf3')],{'as':_0x48e5('0x162'),'foreignKey':'ListId'});db[_0x48e5('0x4b')][_0x48e5('0x120')](db[_0x48e5('0x83')],{'as':_0x48e5('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x48e5('0x4b')]['belongsToMany'](db[_0x48e5('0x13')],{'as':_0x48e5('0x14e'),'through':_0x48e5('0x13a')});db[_0x48e5('0x4d')]['belongsTo'](db[_0x48e5('0x13')],{'onDelete':_0x48e5('0x15d')});db['FaxApplication'][_0x48e5('0x120')](db[_0x48e5('0x51')],{'onDelete':_0x48e5('0x15d')});db['FaxApplication'][_0x48e5('0x120')](db[_0x48e5('0x4b')],{'onDelete':_0x48e5('0x15d')});db[_0x48e5('0x4d')][_0x48e5('0x120')](db[_0x48e5('0x16b')],{'onDelete':_0x48e5('0x15d'),'foreignKey':_0x48e5('0x170')});db[_0x48e5('0x4f')][_0x48e5('0x112')](db[_0x48e5('0x178')],{'as':_0x48e5('0x152'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x179')});db['FaxInteraction'][_0x48e5('0x120')](db[_0x48e5('0x4b')],{'as':_0x48e5('0x167'),'foreignKey':_0x48e5('0x175')});db[_0x48e5('0x4f')]['belongsTo'](db['CmContact'],{'as':_0x48e5('0x159'),'foreignKey':'ContactId'});db[_0x48e5('0x4f')]['belongsTo'](db['User'],{'as':_0x48e5('0x168'),'foreignKey':_0x48e5('0x110')});db[_0x48e5('0x4f')][_0x48e5('0x123')](db[_0x48e5('0x16b')],{'through':_0x48e5('0x17a'),'as':_0x48e5('0x16a')});db[_0x48e5('0x4f')][_0x48e5('0x123')](db[_0x48e5('0x16b')],{'through':_0x48e5('0x17a'),'as':'ThroughTags'});db[_0x48e5('0x4f')][_0x48e5('0x123')](db[_0x48e5('0x13')],{'as':_0x48e5('0x17b'),'through':_0x48e5('0x12c'),'foreignKey':_0x48e5('0x179')});db['FaxMessage'][_0x48e5('0x120')](db['User'],{'onDelete':_0x48e5('0x10f'),'as':_0x48e5('0x13')});db[_0x48e5('0x178')]['belongsTo'](db[_0x48e5('0x4f')],{'as':_0x48e5('0x16e'),'foreignKey':_0x48e5('0x179')});db[_0x48e5('0x178')][_0x48e5('0x120')](db['CmContact'],{'onDelete':_0x48e5('0x10f'),'as':_0x48e5('0x159')});db[_0x48e5('0x178')][_0x48e5('0x120')](db[_0x48e5('0xe6')],{'as':_0x48e5('0xe6'),'foreignKey':_0x48e5('0x17c')});db['FaxMessage'][_0x48e5('0x120')](db[_0x48e5('0x4b')],{'as':_0x48e5('0x167'),'foreignKey':_0x48e5('0x175')});db['FaxQueue'][_0x48e5('0x123')](db[_0x48e5('0x13')],{'as':_0x48e5('0x14e'),'through':_0x48e5('0x33')});db[_0x48e5('0x51')][_0x48e5('0x123')](db[_0x48e5('0xe1')],{'through':_0x48e5('0x17d'),'as':_0x48e5('0x14f')});db[_0x48e5('0x17e')][_0x48e5('0x120')](db[_0x48e5('0x4b')],{});db[_0x48e5('0x17e')]['belongsTo'](db[_0x48e5('0xf3')],{'as':_0x48e5('0x162'),'foreignKey':_0x48e5('0x171')});db['FaxQueueReport'][_0x48e5('0x120')](db[_0x48e5('0x71')],{'as':_0x48e5('0x159'),'foreignKey':_0x48e5('0x15a')});db['FaxQueueReport'][_0x48e5('0x120')](db[_0x48e5('0x4f')],{});db['FaxQueueReport'][_0x48e5('0x120')](db[_0x48e5('0x178')],{});db['FaxQueueReport'][_0x48e5('0x120')](db['User'],{});db[_0x48e5('0x17e')][_0x48e5('0x120')](db[_0x48e5('0x51')],{});db[_0x48e5('0x13e')][_0x48e5('0x112')](db[_0x48e5('0x7f')],{'as':_0x48e5('0x174'),'foreignKey':_0x48e5('0x17f'),'onDelete':_0x48e5('0x10f')});db[_0x48e5('0x13e')][_0x48e5('0x112')](db[_0x48e5('0x7d')],{'as':_0x48e5('0x176'),'foreignKey':_0x48e5('0x17f')});db[_0x48e5('0x13e')]['hasMany'](db[_0x48e5('0x180')],{'as':_0x48e5('0x152'),'foreignKey':'SmsAccountId'});db[_0x48e5('0x13e')]['hasMany'](db[_0x48e5('0x56')],{'as':_0x48e5('0x160')});db[_0x48e5('0x13e')][_0x48e5('0x112')](db[_0x48e5('0x55')],{'as':_0x48e5('0x161'),'foreignKey':_0x48e5('0x17f'),'onDelete':_0x48e5('0x10f')});db['SmsAccount'][_0x48e5('0x120')](db[_0x48e5('0xf3')],{'as':_0x48e5('0x162'),'foreignKey':_0x48e5('0x171')});db['SmsAccount'][_0x48e5('0x120')](db[_0x48e5('0x83')],{'as':_0x48e5('0x14c'),'foreignKey':_0x48e5('0x14d')});db[_0x48e5('0x13e')]['belongsToMany'](db[_0x48e5('0x13')],{'as':_0x48e5('0x14e'),'through':_0x48e5('0x181')});db[_0x48e5('0x55')][_0x48e5('0x120')](db[_0x48e5('0x13')],{'onDelete':_0x48e5('0x15d')});db[_0x48e5('0x55')][_0x48e5('0x120')](db[_0x48e5('0x133')],{'onDelete':_0x48e5('0x15d')});db[_0x48e5('0x55')][_0x48e5('0x120')](db['SmsAccount'],{'onDelete':_0x48e5('0x15d')});db[_0x48e5('0x55')][_0x48e5('0x120')](db[_0x48e5('0x82')],{'onDelete':_0x48e5('0x15d'),'foreignKey':_0x48e5('0x14b')});db[_0x48e5('0x55')][_0x48e5('0x120')](db[_0x48e5('0x16b')],{'onDelete':_0x48e5('0x15d'),'foreignKey':_0x48e5('0x170')});db['SmsInteraction'][_0x48e5('0x112')](db['SmsMessage'],{'as':_0x48e5('0x152'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x182')});db[_0x48e5('0x56')][_0x48e5('0x120')](db['SmsAccount'],{'as':_0x48e5('0x167'),'foreignKey':_0x48e5('0x17f')});db['SmsInteraction'][_0x48e5('0x120')](db[_0x48e5('0x71')],{'as':_0x48e5('0x159'),'foreignKey':_0x48e5('0x15a')});db[_0x48e5('0x56')]['belongsTo'](db[_0x48e5('0x13')],{'as':_0x48e5('0x168'),'foreignKey':_0x48e5('0x110')});db[_0x48e5('0x56')]['belongsToMany'](db['Tag'],{'through':_0x48e5('0x183'),'as':_0x48e5('0x16a')});db[_0x48e5('0x56')][_0x48e5('0x123')](db['Tag'],{'through':_0x48e5('0x183'),'as':'ThroughTags'});db[_0x48e5('0x56')][_0x48e5('0x123')](db[_0x48e5('0x13')],{'as':_0x48e5('0x17b'),'through':_0x48e5('0x12d'),'foreignKey':_0x48e5('0x182')});db[_0x48e5('0x180')][_0x48e5('0x120')](db['User'],{'as':_0x48e5('0x13')});db[_0x48e5('0x180')]['belongsTo'](db[_0x48e5('0x71')],{'onDelete':_0x48e5('0x10f'),'as':_0x48e5('0x159')});db[_0x48e5('0x180')][_0x48e5('0x120')](db['SmsInteraction'],{'onDelete':_0x48e5('0x10f'),'as':_0x48e5('0x16e'),'foreignKey':_0x48e5('0x182')});db[_0x48e5('0x180')]['belongsTo'](db[_0x48e5('0x13e')],{'as':_0x48e5('0x167'),'foreignKey':_0x48e5('0x17f')});db[_0x48e5('0x133')][_0x48e5('0x123')](db[_0x48e5('0x13')],{'as':_0x48e5('0x14e'),'through':_0x48e5('0x135'),'foreignKey':'SmsQueueId'});db[_0x48e5('0x133')][_0x48e5('0x123')](db['Team'],{'through':_0x48e5('0x184'),'as':_0x48e5('0x14f')});db[_0x48e5('0x59')][_0x48e5('0x112')](db[_0x48e5('0x7f')],{'as':_0x48e5('0x174'),'foreignKey':'OpenchannelAccountId','onDelete':_0x48e5('0x10f')});db['OpenchannelAccount'][_0x48e5('0x112')](db[_0x48e5('0x7d')],{'as':_0x48e5('0x176'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x48e5('0x112')](db[_0x48e5('0x5d')],{'as':_0x48e5('0x160'),'foreignKey':_0x48e5('0x185')});db['OpenchannelAccount'][_0x48e5('0x112')](db[_0x48e5('0x186')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x48e5('0x112')](db['OpenchannelApplication'],{'as':_0x48e5('0x161'),'foreignKey':'OpenchannelAccountId','onDelete':'cascade'});db[_0x48e5('0x59')][_0x48e5('0x120')](db['CmList'],{'as':_0x48e5('0x162'),'foreignKey':_0x48e5('0x171')});db['OpenchannelAccount'][_0x48e5('0x120')](db[_0x48e5('0x83')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x48e5('0x59')][_0x48e5('0x123')](db[_0x48e5('0x13')],{'as':_0x48e5('0x14e'),'through':'user_has_openchannel_accounts'});db[_0x48e5('0x5b')][_0x48e5('0x120')](db[_0x48e5('0x13')],{'onDelete':_0x48e5('0x15d')});db['OpenchannelApplication'][_0x48e5('0x120')](db[_0x48e5('0x60')],{'onDelete':_0x48e5('0x15d'),'foreignKey':_0x48e5('0x187')});db[_0x48e5('0x5b')][_0x48e5('0x120')](db[_0x48e5('0x59')],{'onDelete':_0x48e5('0x15d'),'foreignKey':_0x48e5('0x185')});db['OpenchannelApplication'][_0x48e5('0x120')](db[_0x48e5('0x82')],{'onDelete':_0x48e5('0x15d'),'foreignKey':_0x48e5('0x14b')});db[_0x48e5('0x5b')][_0x48e5('0x120')](db[_0x48e5('0x16b')],{'onDelete':'restrict','foreignKey':_0x48e5('0x170')});db[_0x48e5('0x5d')][_0x48e5('0x112')](db[_0x48e5('0x186')],{'as':_0x48e5('0x152'),'onDelete':_0x48e5('0x10f'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction'][_0x48e5('0x120')](db['OpenchannelAccount'],{'as':_0x48e5('0x167'),'foreignKey':_0x48e5('0x185')});db[_0x48e5('0x5d')][_0x48e5('0x120')](db[_0x48e5('0x71')],{'as':_0x48e5('0x159'),'foreignKey':_0x48e5('0x15a')});db['OpenchannelInteraction']['belongsTo'](db[_0x48e5('0x13')],{'as':'Owner','foreignKey':_0x48e5('0x110')});db[_0x48e5('0x5d')][_0x48e5('0x123')](db[_0x48e5('0x16b')],{'through':_0x48e5('0x188'),'as':'Tags'});db['OpenchannelInteraction']['belongsToMany'](db[_0x48e5('0x16b')],{'through':'openchannel_interaction_has_tags','as':_0x48e5('0x16c')});db[_0x48e5('0x5d')]['belongsToMany'](db[_0x48e5('0x13')],{'as':_0x48e5('0x17b'),'through':_0x48e5('0x12e'),'foreignKey':_0x48e5('0x189')});db['OpenchannelMessage'][_0x48e5('0x120')](db[_0x48e5('0x13')],{'onDelete':_0x48e5('0x10f'),'as':_0x48e5('0x13')});db['OpenchannelMessage'][_0x48e5('0x120')](db[_0x48e5('0x71')],{'onDelete':_0x48e5('0x10f'),'as':_0x48e5('0x159')});db[_0x48e5('0x186')][_0x48e5('0x120')](db[_0x48e5('0x5d')],{'onDelete':_0x48e5('0x10f'),'as':_0x48e5('0x16e'),'foreignKey':'OpenchannelInteractionId'});db[_0x48e5('0x186')][_0x48e5('0x120')](db[_0x48e5('0xe6')],{'as':_0x48e5('0xe6'),'foreignKey':'AttachmentId'});db['OpenchannelMessage']['belongsTo'](db[_0x48e5('0x59')],{'as':_0x48e5('0x167'),'foreignKey':_0x48e5('0x185')});db[_0x48e5('0x60')][_0x48e5('0x123')](db[_0x48e5('0x13')],{'as':_0x48e5('0x14e'),'through':'UserOpenchannelQueue','foreignKey':_0x48e5('0x187')});db[_0x48e5('0x60')]['belongsToMany'](db[_0x48e5('0xe1')],{'through':'team_has_openchannel_queues','as':_0x48e5('0x14f')});db['ChatWebsite']['hasMany'](db[_0x48e5('0x7f')],{'as':_0x48e5('0x174'),'foreignKey':'ChatWebsiteId','onDelete':_0x48e5('0x10f')});db['ChatWebsite'][_0x48e5('0x112')](db[_0x48e5('0x7d')],{'as':'Answers','foreignKey':_0x48e5('0x18a')});db[_0x48e5('0x62')][_0x48e5('0x112')](db[_0x48e5('0x6e')],{'as':_0x48e5('0x18b')});db['ChatWebsite'][_0x48e5('0x112')](db['ChatInteraction'],{'as':'Interactions'});db[_0x48e5('0x62')][_0x48e5('0x112')](db[_0x48e5('0x65')],{'as':_0x48e5('0x161'),'foreignKey':_0x48e5('0x18a'),'onDelete':_0x48e5('0x10f')});db[_0x48e5('0x62')][_0x48e5('0x112')](db[_0x48e5('0x69')],{'as':_0x48e5('0x152')});db['ChatWebsite']['belongsTo'](db[_0x48e5('0xf3')],{'as':_0x48e5('0x162'),'foreignKey':_0x48e5('0x171')});db[_0x48e5('0x62')][_0x48e5('0x120')](db[_0x48e5('0x82')],{'as':_0x48e5('0x82'),'foreignKey':_0x48e5('0x14b')});db['ChatWebsite'][_0x48e5('0x120')](db['MailAccount'],{'as':_0x48e5('0x3d'),'foreignKey':_0x48e5('0x15b')});db['ChatWebsite'][_0x48e5('0x120')](db[_0x48e5('0x83')],{'as':_0x48e5('0x14c'),'foreignKey':_0x48e5('0x14d')});db[_0x48e5('0x62')][_0x48e5('0x123')](db[_0x48e5('0x13')],{'as':_0x48e5('0x14e'),'through':_0x48e5('0x138')});db[_0x48e5('0x63')][_0x48e5('0x120')](db[_0x48e5('0x59')],{});db[_0x48e5('0x63')][_0x48e5('0x120')](db[_0x48e5('0xf3')],{'as':_0x48e5('0x162'),'foreignKey':_0x48e5('0x171')});db[_0x48e5('0x63')][_0x48e5('0x120')](db['CmContact'],{'as':_0x48e5('0x159'),'foreignKey':_0x48e5('0x15a')});db[_0x48e5('0x63')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x48e5('0x63')][_0x48e5('0x120')](db['OpenchannelMessage'],{});db[_0x48e5('0x63')]['belongsTo'](db[_0x48e5('0x13')],{});db[_0x48e5('0x63')]['belongsTo'](db[_0x48e5('0x60')],{});db[_0x48e5('0x65')][_0x48e5('0x120')](db[_0x48e5('0x13')],{'as':'Agent','foreignKey':'UserId','onDelete':_0x48e5('0x15d')});db[_0x48e5('0x65')][_0x48e5('0x120')](db[_0x48e5('0x6c')],{'as':'Queue','foreignKey':_0x48e5('0x18c'),'onDelete':_0x48e5('0x15d')});db['ChatApplication'][_0x48e5('0x120')](db[_0x48e5('0x62')],{'as':'Website','foreignKey':_0x48e5('0x18a'),'onDelete':_0x48e5('0x15d')});db['ChatApplication']['belongsTo'](db['Tag'],{'onDelete':_0x48e5('0x15d'),'foreignKey':_0x48e5('0x170')});db[_0x48e5('0x67')][_0x48e5('0x112')](db[_0x48e5('0x69')],{'as':_0x48e5('0x152'),'onDelete':'cascade','foreignKey':_0x48e5('0x18d')});db[_0x48e5('0x67')][_0x48e5('0x120')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x48e5('0x18a')});db[_0x48e5('0x67')][_0x48e5('0x120')](db['CmContact'],{'as':_0x48e5('0x159'),'foreignKey':_0x48e5('0x15a')});db[_0x48e5('0x67')][_0x48e5('0x120')](db['User'],{'as':_0x48e5('0x168'),'foreignKey':_0x48e5('0x110')});db[_0x48e5('0x67')][_0x48e5('0x123')](db[_0x48e5('0x16b')],{'through':'chat_interaction_has_tags','as':'Tags'});db[_0x48e5('0x67')][_0x48e5('0x123')](db['Tag'],{'through':_0x48e5('0x18e'),'as':_0x48e5('0x16c')});db[_0x48e5('0x67')]['belongsToMany'](db[_0x48e5('0x13')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':_0x48e5('0x18d')});db['ChatMessage']['belongsTo'](db[_0x48e5('0x13')],{'onDelete':_0x48e5('0x10f'),'as':'User'});db[_0x48e5('0x69')][_0x48e5('0x120')](db[_0x48e5('0x71')],{'onDelete':'cascade','as':_0x48e5('0x159'),'foreignKey':'ContactId'});db[_0x48e5('0x69')][_0x48e5('0x120')](db[_0x48e5('0x67')],{'onDelete':_0x48e5('0x10f'),'as':_0x48e5('0x16e'),'foreignKey':_0x48e5('0x18d')});db[_0x48e5('0x69')][_0x48e5('0x120')](db[_0x48e5('0xe6')],{'as':_0x48e5('0xe6'),'foreignKey':'AttachmentId'});db[_0x48e5('0x69')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0x48e5('0x18a')});db[_0x48e5('0x6b')][_0x48e5('0x112')](db[_0x48e5('0xe6')],{'as':_0x48e5('0x16d'),'foreignKey':_0x48e5('0x16f'),'onDelete':_0x48e5('0x10f'),'hooks':!![]});db[_0x48e5('0x6b')][_0x48e5('0x120')](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':_0x48e5('0x15a')});db['ChatOfflineMessage'][_0x48e5('0x120')](db['ChatWebsite'],{'as':_0x48e5('0x167'),'foreignKey':'ChatWebsiteId'});db[_0x48e5('0x6c')][_0x48e5('0x123')](db[_0x48e5('0x13')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0x48e5('0x6c')][_0x48e5('0x123')](db[_0x48e5('0xe1')],{'through':'team_has_chat_queues','as':'Teams'});db[_0x48e5('0x6d')][_0x48e5('0x112')](db['ChatInternalMessage'],{'as':'Messages','foreignKey':_0x48e5('0x18f'),'onDelete':'cascade'});db[_0x48e5('0x6d')]['belongsToMany'](db[_0x48e5('0x13')],{'as':_0x48e5('0x143'),'through':'chat_group_has_users'});db[_0x48e5('0x6e')][_0x48e5('0x120')](db[_0x48e5('0x62')],{'as':'Website','foreignKey':_0x48e5('0x18a')});db['CmCompany'][_0x48e5('0x112')](db[_0x48e5('0x71')],{'as':_0x48e5('0x190'),'foreignKey':_0x48e5('0x191')});db['CmContact'][_0x48e5('0x112')](db[_0x48e5('0x8e')],{'as':'Phones','foreignKey':'CmContactId'});db[_0x48e5('0x71')][_0x48e5('0x112')](db[_0x48e5('0x73')],{'as':_0x48e5('0x11e'),'foreignKey':_0x48e5('0x15a')});db[_0x48e5('0x71')]['hasMany'](db[_0x48e5('0x115')],{'as':'HopperFinals','foreignKey':_0x48e5('0x15a')});db[_0x48e5('0x71')][_0x48e5('0x112')](db[_0x48e5('0x77')],{'as':_0x48e5('0x145'),'foreignKey':_0x48e5('0x15a')});db['CmContact'][_0x48e5('0x112')](db[_0x48e5('0x78')],{'as':_0x48e5('0x78'),'foreignKey':_0x48e5('0x15a')});db[_0x48e5('0x71')][_0x48e5('0x112')](db[_0x48e5('0xd2')],{'as':'JscriptySessions','foreignKey':'ContactId'});db['CmContact'][_0x48e5('0x112')](db[_0x48e5('0x5d')],{'as':_0x48e5('0x118'),'foreignKey':'ContactId','onDelete':_0x48e5('0x15d')});db['CmContact']['hasMany'](db[_0x48e5('0x67')],{'as':_0x48e5('0x119'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x48e5('0x71')][_0x48e5('0x112')](db['SmsInteraction'],{'as':_0x48e5('0x11a'),'foreignKey':_0x48e5('0x15a'),'onDelete':'restrict'});db[_0x48e5('0x71')][_0x48e5('0x112')](db[_0x48e5('0x4f')],{'as':_0x48e5('0x11b'),'foreignKey':'ContactId','onDelete':_0x48e5('0x15d')});db['CmContact']['hasMany'](db[_0x48e5('0x40')],{'as':_0x48e5('0x129'),'foreignKey':'ContactId','onDelete':_0x48e5('0x15d')});db['CmContact'][_0x48e5('0x120')](db[_0x48e5('0x6f')],{'as':_0x48e5('0x192'),'foreignKey':_0x48e5('0x191')});db[_0x48e5('0x71')][_0x48e5('0x120')](db[_0x48e5('0xf3')],{'as':_0x48e5('0x162'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x48e5('0x71')][_0x48e5('0x123')](db[_0x48e5('0x13')],{'as':'Users','through':_0x48e5('0x193')});db[_0x48e5('0x71')][_0x48e5('0x123')](db[_0x48e5('0x16b')],{'as':'Tags','through':_0x48e5('0x194')});db[_0x48e5('0x71')][_0x48e5('0x123')](db['Tag'],{'through':_0x48e5('0x194'),'as':_0x48e5('0x16c')});db[_0x48e5('0x73')][_0x48e5('0x112')](db[_0x48e5('0x90')],{'as':_0x48e5('0x195'),'foreignKey':_0x48e5('0x196')});db[_0x48e5('0x73')][_0x48e5('0x120')](db[_0x48e5('0x71')],{'as':_0x48e5('0x159'),'foreignKey':_0x48e5('0x15a'),'onDelete':'cascade'});db[_0x48e5('0x73')][_0x48e5('0x120')](db[_0x48e5('0xf3')],{'as':_0x48e5('0x162'),'foreignKey':_0x48e5('0x171'),'onDelete':_0x48e5('0x10f')});db['CmHopper'][_0x48e5('0x120')](db['User'],{'as':_0x48e5('0x197'),'foreignKey':_0x48e5('0x110')});db[_0x48e5('0x73')]['belongsTo'](db[_0x48e5('0x1b')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x48e5('0x10f')});db[_0x48e5('0x73')][_0x48e5('0x120')](db[_0x48e5('0x198')],{'as':'Campaign','foreignKey':_0x48e5('0x199'),'onDelete':_0x48e5('0x10f')});db[_0x48e5('0x73')]['belongsTo'](db[_0x48e5('0x13')],{'as':'Owner','foreignKey':_0x48e5('0x19a')});db[_0x48e5('0x146')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x48e5('0x15a'),'onDelete':_0x48e5('0x10f')});db[_0x48e5('0x146')][_0x48e5('0x120')](db[_0x48e5('0xf3')],{'as':_0x48e5('0x162'),'foreignKey':_0x48e5('0x171'),'onDelete':_0x48e5('0x10f')});db[_0x48e5('0x146')]['belongsTo'](db[_0x48e5('0x1b')],{'as':_0x48e5('0x19b'),'foreignKey':'VoiceQueueId','onDelete':_0x48e5('0x10f')});db[_0x48e5('0x146')][_0x48e5('0x120')](db[_0x48e5('0x198')],{'as':_0x48e5('0x198'),'foreignKey':_0x48e5('0x199'),'onDelete':'cascade'});db[_0x48e5('0x7b')]['hasMany'](db['Condition'],{'as':{'plural':_0x48e5('0x19c'),'singular':_0x48e5('0x19d')},'foreignKey':_0x48e5('0x19e'),'onDelete':'cascade','hooks':!![]});db[_0x48e5('0x7b')][_0x48e5('0x112')](db[_0x48e5('0x19f')],{'as':{'plural':'Any','singular':_0x48e5('0x1a0')},'foreignKey':_0x48e5('0x1a1'),'onDelete':_0x48e5('0x10f'),'hooks':!![]});db[_0x48e5('0x7b')]['hasMany'](db[_0x48e5('0x79')],{'as':_0x48e5('0x1a2'),'foreignKey':_0x48e5('0x1a3'),'onDelete':_0x48e5('0x10f'),'hooks':!![]});db[_0x48e5('0x7f')][_0x48e5('0x112')](db['Disposition'],{'as':_0x48e5('0x174'),'foreignKey':_0x48e5('0x1a4'),'onDelete':'cascade'});db[_0x48e5('0x82')][_0x48e5('0x112')](db['Interval'],{'as':_0x48e5('0x1a5'),'foreignKey':'IntervalId','onDelete':_0x48e5('0x10f'),'hooks':!![],'required':![]});db[_0x48e5('0x82')]['hasMany'](db['VoiceExtension'],{'as':_0x48e5('0x114'),'foreignKey':'IntervalId','onDelete':'restrict'});db[_0x48e5('0x82')][_0x48e5('0x112')](db[_0x48e5('0x44')],{'as':_0x48e5('0x1a6'),'foreignKey':_0x48e5('0x14b')});db[_0x48e5('0x82')][_0x48e5('0x112')](db[_0x48e5('0x65')],{'as':_0x48e5('0x1a7'),'foreignKey':_0x48e5('0x14b')});db[_0x48e5('0x82')]['hasMany'](db[_0x48e5('0x4d')],{'as':_0x48e5('0x1a8'),'foreignKey':_0x48e5('0x14b')});db[_0x48e5('0x82')][_0x48e5('0x112')](db['SmsApplication'],{'as':_0x48e5('0x1a9'),'foreignKey':_0x48e5('0x14b')});db[_0x48e5('0x1aa')]['belongsTo'](db[_0x48e5('0x3d')],{});db[_0x48e5('0x1aa')][_0x48e5('0x120')](db[_0x48e5('0x98')],{'foreignKey':_0x48e5('0x1ab')});db[_0x48e5('0x1aa')]['belongsTo'](db[_0x48e5('0x97')],{'foreignKey':'CustomReportId'});db['Sound'][_0x48e5('0x123')](db[_0x48e5('0x19')],{'as':_0x48e5('0x1ac'),'through':'moh_has_sounds','onDelete':'restrict'});db['Tag'][_0x48e5('0x123')](db[_0x48e5('0x71')],{'through':_0x48e5('0x194')});db[_0x48e5('0x16b')][_0x48e5('0x123')](db[_0x48e5('0x67')],{'through':_0x48e5('0x18e')});db[_0x48e5('0x16b')][_0x48e5('0x123')](db[_0x48e5('0x40')],{'through':_0x48e5('0x169')});db[_0x48e5('0x16b')][_0x48e5('0x123')](db[_0x48e5('0x56')],{'through':_0x48e5('0x183')});db['Tag'][_0x48e5('0x123')](db[_0x48e5('0x4f')],{'through':_0x48e5('0x17a')});db['Tag'][_0x48e5('0x123')](db[_0x48e5('0x5d')],{'through':_0x48e5('0x188')});db[_0x48e5('0x16b')]['belongsToMany'](db[_0x48e5('0x12f')],{'through':_0x48e5('0x1ad')});db[_0x48e5('0x8e')][_0x48e5('0x120')](db['ContactItemType'],{'as':_0x48e5('0x1ae'),'foreignKey':_0x48e5('0x1af')});db[_0x48e5('0x90')][_0x48e5('0x120')](db[_0x48e5('0x73')],{'as':_0x48e5('0x1b0'),'foreignKey':_0x48e5('0x196')});db[_0x48e5('0x8e')][_0x48e5('0x120')](db[_0x48e5('0x71')],{'as':_0x48e5('0x159'),'foreignKey':_0x48e5('0x1b1')});db[_0x48e5('0x1b2')][_0x48e5('0x112')](db[_0x48e5('0x19f')],{'as':{'plural':_0x48e5('0x1b3'),'singular':_0x48e5('0x1b4')},'foreignKey':_0x48e5('0x1b5'),'onDelete':'cascade','hooks':!![]});db[_0x48e5('0x1b2')]['hasMany'](db[_0x48e5('0x19f')],{'as':{'plural':_0x48e5('0x1b6'),'singular':_0x48e5('0x1b7')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0x48e5('0x1b2')][_0x48e5('0x112')](db[_0x48e5('0x79')],{'as':_0x48e5('0x1a2'),'foreignKey':_0x48e5('0x1b8'),'onDelete':_0x48e5('0x10f'),'hooks':!![]});db[_0x48e5('0x97')][_0x48e5('0x112')](db[_0x48e5('0x9b')],{'as':_0x48e5('0x1b9'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1ba'),'hooks':!![]});db[_0x48e5('0x98')][_0x48e5('0x112')](db['AnalyticFieldReport'],{'as':_0x48e5('0x1b9'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1ab')});db[_0x48e5('0x1bb')][_0x48e5('0x112')](db[_0x48e5('0x9b')],{'as':_0x48e5('0x1b9'),'onDelete':_0x48e5('0x10f'),'foreignKey':'MetricId'});db[_0x48e5('0x9b')][_0x48e5('0x120')](db[_0x48e5('0x1bb')],{'foreignKey':'MetricId'});db[_0x48e5('0x9f')]['hasMany'](db['SalesforceConfiguration'],{'as':_0x48e5('0x1bc'),'onDelete':'cascade','foreignKey':_0x48e5('0x1bd')});db[_0x48e5('0xa1')][_0x48e5('0x112')](db[_0x48e5('0xa3')],{'as':_0x48e5('0x1be'),'onDelete':_0x48e5('0x10f'),'foreignKey':'SubjectId'});db[_0x48e5('0xa1')][_0x48e5('0x112')](db['SalesforceField'],{'as':_0x48e5('0x1bf'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1c0')});db['SalesforceConfiguration'][_0x48e5('0x112')](db[_0x48e5('0xa3')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x48e5('0x1c1')});db[_0x48e5('0xa1')]['belongsTo'](db['SalesforceAccount'],{'as':_0x48e5('0x167'),'foreignKey':_0x48e5('0x1bd')});db[_0x48e5('0xa3')][_0x48e5('0x112')](db[_0x48e5('0xa3')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x48e5('0xa3')][_0x48e5('0x112')](db[_0x48e5('0xa3')],{'as':_0x48e5('0x1c2'),'foreignKey':'DescriptionId'});db[_0x48e5('0xa3')]['hasMany'](db[_0x48e5('0xa3')],{'as':'Field','foreignKey':'FieldId'});db[_0x48e5('0xa3')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x48e5('0x1c3')]['hasMany'](db[_0x48e5('0x1c4')],{'as':_0x48e5('0x1bc'),'onDelete':'cascade','foreignKey':_0x48e5('0x1bd')});db[_0x48e5('0x1c4')]['hasMany'](db['SugarcrmField'],{'as':_0x48e5('0x1be'),'onDelete':_0x48e5('0x10f'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration'][_0x48e5('0x112')](db[_0x48e5('0xa6')],{'as':_0x48e5('0x1bf'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1c0')});db['SugarcrmConfiguration']['hasMany'](db[_0x48e5('0xa6')],{'as':_0x48e5('0x1b9'),'onDelete':_0x48e5('0x10f'),'foreignKey':'FieldId'});db['SugarcrmConfiguration']['belongsTo'](db[_0x48e5('0x1c3')],{'as':_0x48e5('0x167'),'foreignKey':_0x48e5('0x1bd')});db[_0x48e5('0xa6')]['hasMany'](db[_0x48e5('0xa6')],{'as':_0x48e5('0x1c5'),'foreignKey':_0x48e5('0x1c6')});db[_0x48e5('0xa6')][_0x48e5('0x112')](db[_0x48e5('0xa6')],{'as':_0x48e5('0x1c2'),'foreignKey':_0x48e5('0x1c0')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x48e5('0x1c7'),'foreignKey':_0x48e5('0x1c1')});db[_0x48e5('0xa6')]['belongsTo'](db[_0x48e5('0x93')],{'as':_0x48e5('0x93'),'foreignKey':_0x48e5('0x1c8')});db[_0x48e5('0xa7')]['hasMany'](db['DeskConfiguration'],{'as':_0x48e5('0x1bc'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1bd')});db[_0x48e5('0xa9')][_0x48e5('0x112')](db[_0x48e5('0xab')],{'as':_0x48e5('0x1be'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1c6')});db[_0x48e5('0xa9')]['hasMany'](db[_0x48e5('0xab')],{'as':_0x48e5('0x1bf'),'onDelete':'cascade','foreignKey':_0x48e5('0x1c0')});db[_0x48e5('0xa9')]['hasMany'](db[_0x48e5('0xab')],{'as':_0x48e5('0x1b9'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1c1')});db['DeskConfiguration'][_0x48e5('0x120')](db[_0x48e5('0xa7')],{'as':_0x48e5('0x167'),'foreignKey':'AccountId'});db[_0x48e5('0xa9')]['belongsToMany'](db[_0x48e5('0x16b')],{'through':'int_desk_configuration_has_tags'});db[_0x48e5('0xab')][_0x48e5('0x112')](db[_0x48e5('0xab')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x48e5('0xab')][_0x48e5('0x112')](db[_0x48e5('0xab')],{'as':_0x48e5('0x1c2'),'foreignKey':_0x48e5('0x1c0')});db[_0x48e5('0xab')][_0x48e5('0x112')](db[_0x48e5('0xab')],{'as':'Field','foreignKey':_0x48e5('0x1c1')});db[_0x48e5('0xab')][_0x48e5('0x120')](db['Variable'],{'as':_0x48e5('0x93'),'foreignKey':_0x48e5('0x1c8')});db['ZohoAccount'][_0x48e5('0x112')](db[_0x48e5('0xad')],{'as':'Configurations','onDelete':_0x48e5('0x10f'),'foreignKey':'AccountId'});db['ZohoConfiguration']['hasMany'](db[_0x48e5('0x1c9')],{'as':_0x48e5('0x1be'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1c6')});db['ZohoConfiguration'][_0x48e5('0x112')](db['ZohoField'],{'as':_0x48e5('0x1bf'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1c0')});db[_0x48e5('0xad')]['hasMany'](db['ZohoField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x48e5('0x1c1')});db[_0x48e5('0xad')][_0x48e5('0x120')](db[_0x48e5('0x1ca')],{'as':_0x48e5('0x167'),'foreignKey':_0x48e5('0x1bd')});db['ZohoField'][_0x48e5('0x112')](db[_0x48e5('0x1c9')],{'as':_0x48e5('0x1c5'),'foreignKey':_0x48e5('0x1c6')});db[_0x48e5('0x1c9')][_0x48e5('0x112')](db[_0x48e5('0x1c9')],{'as':_0x48e5('0x1c2'),'foreignKey':'DescriptionId'});db['ZohoField'][_0x48e5('0x112')](db[_0x48e5('0x1c9')],{'as':_0x48e5('0x1c7'),'foreignKey':_0x48e5('0x1c1')});db[_0x48e5('0x1c9')][_0x48e5('0x120')](db[_0x48e5('0x93')],{'as':_0x48e5('0x93'),'foreignKey':_0x48e5('0x1c8')});db[_0x48e5('0xb0')][_0x48e5('0x112')](db[_0x48e5('0xb2')],{'as':_0x48e5('0x1bc'),'onDelete':_0x48e5('0x10f'),'foreignKey':'AccountId'});db[_0x48e5('0xb2')][_0x48e5('0x112')](db['ZendeskField'],{'as':_0x48e5('0x1be'),'foreignKey':_0x48e5('0x1c6')});db[_0x48e5('0xb2')][_0x48e5('0x112')](db[_0x48e5('0x1cb')],{'as':_0x48e5('0x1bf'),'foreignKey':'DescriptionId'});db[_0x48e5('0xb2')][_0x48e5('0x112')](db[_0x48e5('0x1cb')],{'as':_0x48e5('0x1b9'),'foreignKey':_0x48e5('0x1c1')});db[_0x48e5('0xb2')][_0x48e5('0x120')](db[_0x48e5('0xb0')],{'as':_0x48e5('0x167'),'foreignKey':'AccountId'});db[_0x48e5('0xb2')][_0x48e5('0x123')](db['Tag'],{'through':_0x48e5('0x1cc')});db[_0x48e5('0x1cb')][_0x48e5('0x112')](db[_0x48e5('0x1cb')],{'as':_0x48e5('0x1c5'),'foreignKey':_0x48e5('0x1c6')});db[_0x48e5('0x1cb')][_0x48e5('0x112')](db[_0x48e5('0x1cb')],{'as':'Description','foreignKey':'DescriptionId'});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':_0x48e5('0x1c7'),'foreignKey':'FieldId'});db[_0x48e5('0x1cb')][_0x48e5('0x120')](db[_0x48e5('0x93')],{'as':_0x48e5('0x93'),'foreignKey':'VariableId'});db[_0x48e5('0x1cd')][_0x48e5('0x112')](db[_0x48e5('0xb4')],{'as':_0x48e5('0x1bc'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1bd')});db[_0x48e5('0xb4')][_0x48e5('0x112')](db[_0x48e5('0xb5')],{'as':_0x48e5('0x1be'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1c6')});db[_0x48e5('0xb4')][_0x48e5('0x112')](db[_0x48e5('0xb5')],{'as':'Descriptions','onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1c0')});db[_0x48e5('0xb4')][_0x48e5('0x112')](db[_0x48e5('0xb5')],{'as':_0x48e5('0x1b9'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1c1')});db[_0x48e5('0xb4')][_0x48e5('0x120')](db[_0x48e5('0x1cd')],{'as':'Account','foreignKey':_0x48e5('0x1bd')});db['FreshdeskConfiguration'][_0x48e5('0x123')](db[_0x48e5('0x16b')],{'through':_0x48e5('0x1ce')});db[_0x48e5('0xb5')]['hasMany'](db[_0x48e5('0xb5')],{'as':_0x48e5('0x1c5'),'foreignKey':_0x48e5('0x1c6')});db['FreshdeskField']['hasMany'](db[_0x48e5('0xb5')],{'as':_0x48e5('0x1c2'),'foreignKey':_0x48e5('0x1c0')});db['FreshdeskField'][_0x48e5('0x112')](db[_0x48e5('0xb5')],{'as':_0x48e5('0x1c7'),'foreignKey':_0x48e5('0x1c1')});db['FreshdeskField'][_0x48e5('0x120')](db[_0x48e5('0x93')],{'as':_0x48e5('0x93'),'foreignKey':_0x48e5('0x1c8')});db[_0x48e5('0xb6')][_0x48e5('0x112')](db[_0x48e5('0xb8')],{'as':_0x48e5('0x1bc'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1bd')});db[_0x48e5('0xb8')][_0x48e5('0x112')](db[_0x48e5('0xb9')],{'as':'Subjects','foreignKey':_0x48e5('0x1c6')});db[_0x48e5('0xb8')]['hasMany'](db[_0x48e5('0xb9')],{'as':_0x48e5('0x1bf'),'foreignKey':_0x48e5('0x1c0')});db['VtigerConfiguration'][_0x48e5('0x112')](db['VtigerField'],{'as':_0x48e5('0x1b9'),'foreignKey':_0x48e5('0x1c1')});db[_0x48e5('0xb8')][_0x48e5('0x120')](db[_0x48e5('0xb6')],{'as':_0x48e5('0x167'),'foreignKey':_0x48e5('0x1bd')});db[_0x48e5('0xb9')][_0x48e5('0x112')](db['VtigerField'],{'as':_0x48e5('0x1c5'),'foreignKey':_0x48e5('0x1c6')});db[_0x48e5('0xb9')]['hasMany'](db[_0x48e5('0xb9')],{'as':_0x48e5('0x1c2'),'foreignKey':_0x48e5('0x1c0')});db['VtigerField'][_0x48e5('0x112')](db['VtigerField'],{'as':_0x48e5('0x1c7'),'foreignKey':_0x48e5('0x1c1')});db[_0x48e5('0xb9')]['belongsTo'](db[_0x48e5('0x93')],{'as':_0x48e5('0x93'),'foreignKey':_0x48e5('0x1c8')});db[_0x48e5('0xbb')]['hasMany'](db[_0x48e5('0xbd')],{'as':'Configurations','onDelete':_0x48e5('0x10f'),'foreignKey':'AccountId'});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0x48e5('0x1be'),'foreignKey':_0x48e5('0x1c6')});db[_0x48e5('0xbd')][_0x48e5('0x112')](db[_0x48e5('0xbf')],{'as':_0x48e5('0x1bf'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0x48e5('0x112')](db['ServicenowField'],{'as':_0x48e5('0x1b9'),'foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x48e5('0x120')](db[_0x48e5('0xbb')],{'as':'Account','foreignKey':'AccountId'});db[_0x48e5('0xbf')][_0x48e5('0x112')](db[_0x48e5('0xbf')],{'as':_0x48e5('0x1c5'),'foreignKey':'SubjectId'});db[_0x48e5('0xbf')][_0x48e5('0x112')](db[_0x48e5('0xbf')],{'as':_0x48e5('0x1c2'),'foreignKey':_0x48e5('0x1c0')});db[_0x48e5('0xbf')][_0x48e5('0x112')](db[_0x48e5('0xbf')],{'as':_0x48e5('0x1c7'),'foreignKey':_0x48e5('0x1c1')});db['ServicenowField'][_0x48e5('0x120')](db['Variable'],{'as':'Variable','foreignKey':_0x48e5('0x1c8')});db[_0x48e5('0x1cf')][_0x48e5('0x112')](db[_0x48e5('0xc2')],{'as':'Configurations','onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1bd')});db[_0x48e5('0x1cf')][_0x48e5('0x120')](db[_0x48e5('0x104')],{'as':'CloudProvider','foreignKey':'CloudProviderId'});db[_0x48e5('0xc2')][_0x48e5('0x112')](db[_0x48e5('0xc4')],{'as':_0x48e5('0x1be'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1c6')});db[_0x48e5('0xc2')]['hasMany'](db[_0x48e5('0xc4')],{'as':_0x48e5('0x1bf'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1c0')});db['Dynamics365Configuration'][_0x48e5('0x112')](db['Dynamics365Field'],{'as':_0x48e5('0x1b9'),'onDelete':'cascade','foreignKey':_0x48e5('0x1c1')});db[_0x48e5('0xc2')]['belongsTo'](db[_0x48e5('0x1cf')],{'as':_0x48e5('0x167'),'foreignKey':_0x48e5('0x1bd')});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x48e5('0x1c6')});db[_0x48e5('0xc4')][_0x48e5('0x112')](db['Dynamics365Field'],{'as':_0x48e5('0x1c2'),'foreignKey':_0x48e5('0x1c0')});db[_0x48e5('0xc4')][_0x48e5('0x112')](db[_0x48e5('0xc4')],{'as':'Field','foreignKey':_0x48e5('0x1c1')});db[_0x48e5('0xc4')][_0x48e5('0x120')](db['Variable'],{'as':_0x48e5('0x93'),'foreignKey':_0x48e5('0x1c8')});db[_0x48e5('0x1d0')]['hasMany'](db[_0x48e5('0x1d1')],{'as':_0x48e5('0x1bc'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1bd')});db['FreshsalesConfiguration'][_0x48e5('0x112')](db[_0x48e5('0x1d2')],{'as':_0x48e5('0x1be'),'foreignKey':'SubjectId'});db[_0x48e5('0x1d1')][_0x48e5('0x112')](db[_0x48e5('0x1d2')],{'as':_0x48e5('0x1bf'),'foreignKey':_0x48e5('0x1c0')});db[_0x48e5('0x1d1')]['hasMany'](db['FreshsalesField'],{'as':_0x48e5('0x1b9'),'foreignKey':_0x48e5('0x1c1')});db[_0x48e5('0x1d1')][_0x48e5('0x120')](db[_0x48e5('0x1d0')],{'as':_0x48e5('0x167'),'foreignKey':_0x48e5('0x1bd')});db[_0x48e5('0x1d2')]['hasMany'](db['FreshsalesField'],{'as':'Subject','foreignKey':_0x48e5('0x1c6')});db[_0x48e5('0x1d2')][_0x48e5('0x112')](db[_0x48e5('0x1d2')],{'as':_0x48e5('0x1c2'),'foreignKey':_0x48e5('0x1c0')});db[_0x48e5('0x1d2')][_0x48e5('0x112')](db['FreshsalesField'],{'as':'Field','foreignKey':_0x48e5('0x1c1')});db[_0x48e5('0x1d2')][_0x48e5('0x120')](db[_0x48e5('0x93')],{'as':_0x48e5('0x93'),'foreignKey':'VariableId'});db[_0x48e5('0xcc')][_0x48e5('0x120')](db[_0x48e5('0x62')],{});db['ChatQueueReport'][_0x48e5('0x120')](db['CmList'],{'as':_0x48e5('0x162'),'foreignKey':_0x48e5('0x171')});db[_0x48e5('0xcc')][_0x48e5('0x120')](db[_0x48e5('0x71')],{'as':_0x48e5('0x159'),'foreignKey':_0x48e5('0x15a')});db['ChatQueueReport'][_0x48e5('0x120')](db[_0x48e5('0x67')],{});db[_0x48e5('0xcc')]['belongsTo'](db[_0x48e5('0x69')],{});db[_0x48e5('0xcc')][_0x48e5('0x120')](db['User'],{});db[_0x48e5('0xcc')][_0x48e5('0x120')](db[_0x48e5('0x6c')],{});db[_0x48e5('0x1d3')][_0x48e5('0x120')](db[_0x48e5('0x13')],{'onDelete':'cascade','foreignKey':'FromId'});db['ChatInternalMessage'][_0x48e5('0x120')](db[_0x48e5('0x13')],{'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1d4')});db[_0x48e5('0xd2')][_0x48e5('0x112')](db[_0x48e5('0xd0')],{'foreignKey':_0x48e5('0x1d5'),'onDelete':_0x48e5('0x10f')});db[_0x48e5('0xd2')][_0x48e5('0x112')](db['JscriptyAnswerReport'],{'foreignKey':_0x48e5('0x1d5'),'onDelete':_0x48e5('0x10f')});db[_0x48e5('0xd3')]['belongsTo'](db[_0x48e5('0x13e')],{});db[_0x48e5('0xd3')][_0x48e5('0x120')](db[_0x48e5('0xf3')],{'as':_0x48e5('0x162'),'foreignKey':_0x48e5('0x171')});db['SmsQueueReport'][_0x48e5('0x120')](db[_0x48e5('0x71')],{'as':_0x48e5('0x159'),'foreignKey':'ContactId'});db['SmsQueueReport']['belongsTo'](db[_0x48e5('0x56')],{});db[_0x48e5('0xd3')][_0x48e5('0x120')](db[_0x48e5('0x180')],{});db[_0x48e5('0xd3')]['belongsTo'](db[_0x48e5('0x13')],{});db[_0x48e5('0xd3')]['belongsTo'](db[_0x48e5('0x133')],{});db[_0x48e5('0x1d6')][_0x48e5('0x112')](db[_0x48e5('0xd2')],{'foreignKey':_0x48e5('0x1d7')});db[_0x48e5('0x1d6')][_0x48e5('0x112')](db[_0x48e5('0xd0')],{'foreignKey':_0x48e5('0x1d7')});db[_0x48e5('0x1d6')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x48e5('0x1d7')});db[_0x48e5('0xe1')]['belongsToMany'](db[_0x48e5('0x13')],{'as':'Agents','through':_0x48e5('0x128')});db['Team'][_0x48e5('0x123')](db[_0x48e5('0x1b')],{'through':_0x48e5('0x106'),'as':_0x48e5('0x130')});db['Team'][_0x48e5('0x123')](db['MailQueue'],{'through':'team_has_mail_queues','as':_0x48e5('0x1d8')});db[_0x48e5('0xe1')]['belongsToMany'](db[_0x48e5('0x6c')],{'through':_0x48e5('0x1d9'),'as':_0x48e5('0x1da')});db[_0x48e5('0xe1')]['belongsToMany'](db['FaxQueue'],{'through':_0x48e5('0x17d'),'as':'FaxQueues'});db[_0x48e5('0xe1')][_0x48e5('0x123')](db[_0x48e5('0x133')],{'through':_0x48e5('0x184'),'as':_0x48e5('0x134')});db[_0x48e5('0xe1')][_0x48e5('0x123')](db[_0x48e5('0x60')],{'through':_0x48e5('0x1db'),'as':_0x48e5('0x1dc')});db[_0x48e5('0xe1')][_0x48e5('0x123')](db['WhatsappQueue'],{'through':_0x48e5('0x1dd'),'as':'WhatsappQueues'});db[_0x48e5('0xe1')][_0x48e5('0x123')](db['VoicePrefix'],{'through':_0x48e5('0x107'),'as':_0x48e5('0x1de')});db[_0x48e5('0x198')]['hasMany'](db[_0x48e5('0x73')],{'as':_0x48e5('0x11e'),'foreignKey':_0x48e5('0x199')});db[_0x48e5('0x198')][_0x48e5('0x112')](db[_0x48e5('0x115')],{'as':_0x48e5('0x116'),'foreignKey':_0x48e5('0x199')});db[_0x48e5('0x198')]['hasMany'](db['CmHopperHistory'],{'as':_0x48e5('0x145'),'foreignKey':_0x48e5('0x199')});db[_0x48e5('0x198')][_0x48e5('0x112')](db[_0x48e5('0x146')],{'as':_0x48e5('0x1df'),'foreignKey':_0x48e5('0x199')});db[_0x48e5('0x198')]['belongsTo'](db[_0x48e5('0x2a')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x48e5('0x198')][_0x48e5('0x120')](db[_0x48e5('0x2a')],{'as':_0x48e5('0x149'),'foreignKey':_0x48e5('0x14a')});db[_0x48e5('0x198')][_0x48e5('0x120')](db[_0x48e5('0x82')],{'as':_0x48e5('0x82'),'foreignKey':_0x48e5('0x14b')});db[_0x48e5('0x198')][_0x48e5('0x120')](db[_0x48e5('0xdc')],{'as':_0x48e5('0xdc'),'foreignKey':_0x48e5('0x1e0')});db[_0x48e5('0x198')][_0x48e5('0x123')](db[_0x48e5('0xf3')],{'as':_0x48e5('0x126'),'through':_0x48e5('0x1e1')});db['Campaign']['belongsToMany'](db[_0x48e5('0xf3')],{'as':_0x48e5('0x150'),'through':'campaigns_has_cm_blacklists'});db[_0x48e5('0xe6')][_0x48e5('0x120')](db[_0x48e5('0x6b')],{'as':'ChatOfflineMessage','foreignKey':_0x48e5('0x16f')});db[_0x48e5('0xea')]['belongsTo'](db[_0x48e5('0x42')],{});db[_0x48e5('0xea')][_0x48e5('0x120')](db['MailInteraction'],{});db[_0x48e5('0xea')][_0x48e5('0x120')](db[_0x48e5('0x3d')],{'foreignKey':_0x48e5('0x1e2'),'as':_0x48e5('0x1e3')});db[_0x48e5('0xea')][_0x48e5('0x120')](db[_0x48e5('0x13')],{'foreignKey':'FromUserId','as':_0x48e5('0x1e4')});db['MailTransferReport'][_0x48e5('0x120')](db[_0x48e5('0x13')],{'foreignKey':_0x48e5('0x1e5'),'as':_0x48e5('0x1e6')});db[_0x48e5('0xea')]['belongsTo'](db[_0x48e5('0x131')],{'foreignKey':_0x48e5('0x1e7'),'as':_0x48e5('0x1e8')});db[_0x48e5('0xea')][_0x48e5('0x120')](db[_0x48e5('0x3d')],{'foreignKey':_0x48e5('0x1e9'),'as':_0x48e5('0x1ea')});db[_0x48e5('0xec')][_0x48e5('0x120')](db[_0x48e5('0x69')],{});db[_0x48e5('0xec')]['belongsTo'](db[_0x48e5('0x67')],{});db[_0x48e5('0xec')][_0x48e5('0x120')](db['ChatWebsite'],{'foreignKey':_0x48e5('0x1eb'),'as':_0x48e5('0x1e3')});db[_0x48e5('0xec')][_0x48e5('0x120')](db[_0x48e5('0x13')],{'foreignKey':_0x48e5('0x1ec'),'as':'FromAgent'});db['ChatTransferReport'][_0x48e5('0x120')](db[_0x48e5('0x13')],{'foreignKey':'ToUserId','as':_0x48e5('0x1e6')});db[_0x48e5('0xec')][_0x48e5('0x120')](db[_0x48e5('0x6c')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0x48e5('0xec')][_0x48e5('0x120')](db[_0x48e5('0x62')],{'foreignKey':_0x48e5('0x1ed'),'as':_0x48e5('0x1ea')});db[_0x48e5('0xee')][_0x48e5('0x120')](db[_0x48e5('0x178')],{});db[_0x48e5('0xee')][_0x48e5('0x120')](db[_0x48e5('0x4f')],{});db['FaxTransferReport']['belongsTo'](db[_0x48e5('0x4b')],{'foreignKey':_0x48e5('0x1ee'),'as':_0x48e5('0x1e3')});db['FaxTransferReport'][_0x48e5('0x120')](db[_0x48e5('0x13')],{'foreignKey':_0x48e5('0x1ec'),'as':_0x48e5('0x1e4')});db[_0x48e5('0xee')][_0x48e5('0x120')](db[_0x48e5('0x13')],{'foreignKey':_0x48e5('0x1e5'),'as':_0x48e5('0x1e6')});db[_0x48e5('0xee')][_0x48e5('0x120')](db[_0x48e5('0x51')],{'foreignKey':'ToFaxQueueId','as':_0x48e5('0x1e8')});db[_0x48e5('0xee')][_0x48e5('0x120')](db[_0x48e5('0x4b')],{'foreignKey':_0x48e5('0x1ef'),'as':_0x48e5('0x1ea')});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelMessage'],{});db[_0x48e5('0x1f0')][_0x48e5('0x120')](db[_0x48e5('0x5d')],{});db[_0x48e5('0x1f0')][_0x48e5('0x120')](db['OpenchannelAccount'],{'foreignKey':_0x48e5('0x1f1'),'as':_0x48e5('0x1e3')});db[_0x48e5('0x1f0')][_0x48e5('0x120')](db[_0x48e5('0x13')],{'foreignKey':_0x48e5('0x1ec'),'as':_0x48e5('0x1e4')});db[_0x48e5('0x1f0')]['belongsTo'](db[_0x48e5('0x13')],{'foreignKey':'ToUserId','as':_0x48e5('0x1e6')});db[_0x48e5('0x1f0')]['belongsTo'](db[_0x48e5('0x60')],{'foreignKey':_0x48e5('0x1f2'),'as':'ToQueue'});db[_0x48e5('0x1f0')][_0x48e5('0x120')](db[_0x48e5('0x59')],{'foreignKey':_0x48e5('0x1f3'),'as':_0x48e5('0x1ea')});db[_0x48e5('0xf1')][_0x48e5('0x120')](db[_0x48e5('0x180')],{});db['SmsTransferReport'][_0x48e5('0x120')](db[_0x48e5('0x56')],{});db[_0x48e5('0xf1')][_0x48e5('0x120')](db[_0x48e5('0x13e')],{'foreignKey':_0x48e5('0x1f4'),'as':_0x48e5('0x1e3')});db[_0x48e5('0xf1')][_0x48e5('0x120')](db[_0x48e5('0x13')],{'foreignKey':_0x48e5('0x1ec'),'as':_0x48e5('0x1e4')});db[_0x48e5('0xf1')][_0x48e5('0x120')](db[_0x48e5('0x13')],{'foreignKey':_0x48e5('0x1e5'),'as':'ToAgent'});db[_0x48e5('0xf1')][_0x48e5('0x120')](db[_0x48e5('0x133')],{'foreignKey':_0x48e5('0x1f5'),'as':_0x48e5('0x1e8')});db[_0x48e5('0xf1')][_0x48e5('0x120')](db[_0x48e5('0x13e')],{'foreignKey':_0x48e5('0x1f6'),'as':'ToAccount'});db[_0x48e5('0xf3')]['hasMany'](db[_0x48e5('0x7f')],{'as':_0x48e5('0x174'),'foreignKey':'ListId','onDelete':_0x48e5('0x10f')});db[_0x48e5('0xf3')][_0x48e5('0x112')](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0x48e5('0x171')});db[_0x48e5('0xf3')][_0x48e5('0x112')](db['CmContact'],{'as':_0x48e5('0x190'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x171')});db['CmList'][_0x48e5('0x112')](db['CmHopperFinal'],{'as':_0x48e5('0x116'),'foreignKey':'ListId'});db[_0x48e5('0xf3')][_0x48e5('0x112')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x48e5('0x171')});db['CmList'][_0x48e5('0x112')](db[_0x48e5('0x78')],{'as':_0x48e5('0x78'),'foreignKey':_0x48e5('0x171')});db[_0x48e5('0xf3')]['belongsToMany'](db[_0x48e5('0x1b')],{'as':'Queues','through':_0x48e5('0x1f7')});db[_0x48e5('0xf3')][_0x48e5('0x123')](db['User'],{'as':_0x48e5('0x14e'),'through':_0x48e5('0x127')});db[_0x48e5('0xf4')][_0x48e5('0x112')](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade'});db['VoicePrefix'][_0x48e5('0x123')](db[_0x48e5('0x13')],{'as':_0x48e5('0x14e'),'through':_0x48e5('0x109')});db[_0x48e5('0xf4')][_0x48e5('0x123')](db[_0x48e5('0xe1')],{'through':'TeamVoicePrefix','as':_0x48e5('0x14f')});db[_0x48e5('0x121')][_0x48e5('0x112')](db['User'],{'as':_0x48e5('0x17b'),'foreignKey':_0x48e5('0x122')});db['UserProfile']['hasMany'](db['UserProfileSection'],{'as':_0x48e5('0x1f8'),'foreignKey':'userProfileId','onDelete':_0x48e5('0x10f')});db['UserProfileSection'][_0x48e5('0x112')](db['UserProfileResource'],{'as':_0x48e5('0x1f9'),'foreignKey':_0x48e5('0x1fa'),'onDelete':_0x48e5('0x10f')});db[_0x48e5('0x1fb')][_0x48e5('0x112')](db[_0x48e5('0x7f')],{'as':_0x48e5('0x174'),'foreignKey':_0x48e5('0x1fc'),'onDelete':_0x48e5('0x10f')});db[_0x48e5('0x1fb')][_0x48e5('0x112')](db['CannedAnswer'],{'as':_0x48e5('0x176'),'foreignKey':_0x48e5('0x1fc')});db['WhatsappAccount']['hasMany'](db[_0x48e5('0xfe')],{'as':'Messages','foreignKey':_0x48e5('0x1fc')});db[_0x48e5('0x1fb')]['hasMany'](db[_0x48e5('0x12f')],{'as':_0x48e5('0x160')});db[_0x48e5('0x1fb')][_0x48e5('0x112')](db['WhatsappApplication'],{'as':_0x48e5('0x161'),'foreignKey':_0x48e5('0x1fc'),'onDelete':_0x48e5('0x10f')});db[_0x48e5('0x1fb')]['belongsTo'](db[_0x48e5('0xf3')],{'as':_0x48e5('0x162'),'foreignKey':'ListId'});db[_0x48e5('0x1fb')][_0x48e5('0x120')](db[_0x48e5('0x83')],{'as':_0x48e5('0x14c'),'foreignKey':_0x48e5('0x14d')});db['WhatsappAccount'][_0x48e5('0x123')](db[_0x48e5('0x13')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db['WhatsappApplication']['belongsTo'](db[_0x48e5('0x13')],{'onDelete':'restrict'});db[_0x48e5('0x1fd')][_0x48e5('0x120')](db[_0x48e5('0x1fe')],{'onDelete':_0x48e5('0x15d')});db[_0x48e5('0x1fd')]['belongsTo'](db['WhatsappAccount'],{'onDelete':_0x48e5('0x15d')});db[_0x48e5('0x1fd')][_0x48e5('0x120')](db[_0x48e5('0x82')],{'onDelete':_0x48e5('0x15d'),'foreignKey':_0x48e5('0x14b')});db[_0x48e5('0x1fd')][_0x48e5('0x120')](db[_0x48e5('0x16b')],{'onDelete':_0x48e5('0x15d'),'foreignKey':_0x48e5('0x170')});db['WhatsappInteraction'][_0x48e5('0x112')](db[_0x48e5('0xfe')],{'as':_0x48e5('0x152'),'onDelete':_0x48e5('0x10f'),'foreignKey':_0x48e5('0x1ff')});db[_0x48e5('0x12f')]['belongsTo'](db[_0x48e5('0x1fb')],{'as':_0x48e5('0x167'),'foreignKey':_0x48e5('0x1fc')});db[_0x48e5('0x12f')]['belongsTo'](db[_0x48e5('0x71')],{'as':_0x48e5('0x159'),'foreignKey':'ContactId'});db[_0x48e5('0x12f')][_0x48e5('0x120')](db[_0x48e5('0x13')],{'as':_0x48e5('0x168'),'foreignKey':_0x48e5('0x110')});db['WhatsappInteraction'][_0x48e5('0x123')](db['Tag'],{'through':_0x48e5('0x1ad'),'as':_0x48e5('0x16a')});db['WhatsappInteraction'][_0x48e5('0x123')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0x48e5('0x12f')][_0x48e5('0x123')](db['User'],{'as':_0x48e5('0x17b'),'through':_0x48e5('0x200'),'foreignKey':_0x48e5('0x1ff')});db[_0x48e5('0xfe')][_0x48e5('0x120')](db['User'],{'as':_0x48e5('0x13')});db[_0x48e5('0xfe')]['belongsTo'](db[_0x48e5('0x71')],{'onDelete':_0x48e5('0x10f'),'as':_0x48e5('0x159')});db[_0x48e5('0xfe')][_0x48e5('0x120')](db['WhatsappInteraction'],{'onDelete':_0x48e5('0x10f'),'as':_0x48e5('0x16e'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x48e5('0x120')](db[_0x48e5('0x1fb')],{'as':_0x48e5('0x167'),'foreignKey':'WhatsappAccountId'});db[_0x48e5('0x100')][_0x48e5('0x120')](db[_0x48e5('0x1fb')],{});db[_0x48e5('0x100')]['belongsTo'](db[_0x48e5('0xf3')],{'as':'List','foreignKey':'ListId'});db[_0x48e5('0x100')][_0x48e5('0x120')](db[_0x48e5('0x71')],{'as':_0x48e5('0x159'),'foreignKey':_0x48e5('0x15a')});db[_0x48e5('0x100')][_0x48e5('0x120')](db[_0x48e5('0x12f')],{});db[_0x48e5('0x100')][_0x48e5('0x120')](db['WhatsappQueue'],{});db[_0x48e5('0x100')][_0x48e5('0x120')](db[_0x48e5('0xfe')],{});db[_0x48e5('0x100')]['belongsTo'](db[_0x48e5('0x13')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x48e5('0xfe')],{});db[_0x48e5('0x101')][_0x48e5('0x120')](db[_0x48e5('0x12f')],{});db[_0x48e5('0x101')][_0x48e5('0x120')](db[_0x48e5('0x1fb')],{'foreignKey':'FromWhatsappAccountId','as':_0x48e5('0x1e3')});db[_0x48e5('0x101')]['belongsTo'](db[_0x48e5('0x1fb')],{'foreignKey':_0x48e5('0x201'),'as':_0x48e5('0x1ea')});db['WhatsappTransferReport'][_0x48e5('0x120')](db[_0x48e5('0x1fe')],{'foreignKey':'ToQueueId','as':_0x48e5('0x1e8')});db[_0x48e5('0x101')][_0x48e5('0x120')](db['User'],{'foreignKey':_0x48e5('0x1ec'),'as':_0x48e5('0x1e4')});db[_0x48e5('0x101')][_0x48e5('0x120')](db[_0x48e5('0x13')],{'foreignKey':'ToUserId','as':_0x48e5('0x1e6')});db[_0x48e5('0x1fe')]['belongsToMany'](db[_0x48e5('0x13')],{'as':'Agents','through':_0x48e5('0x38'),'foreignKey':_0x48e5('0x202')});db[_0x48e5('0x1fe')][_0x48e5('0x123')](db[_0x48e5('0xe1')],{'through':'team_has_whatsapp_queues','as':_0x48e5('0x14f')});db['UserSetting'][_0x48e5('0x120')](db[_0x48e5('0x13')],{'as':_0x48e5('0x203'),'foreignKey':_0x48e5('0x110'),'onDelete':_0x48e5('0x10f'),'hooks':!![]});db[_0x48e5('0x104')][_0x48e5('0x10e')](db[_0x48e5('0x1cf')],{'as':_0x48e5('0x1cf'),'onDelete':_0x48e5('0x15d')});db['CloudProvider'][_0x48e5('0x10e')](db[_0x48e5('0x3a')],{'as':'Imap','onDelete':_0x48e5('0x15d')});db[_0x48e5('0x104')]['hasOne'](db['MailServerOut'],{'as':_0x48e5('0x15f'),'onDelete':'restrict'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xf117=['../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','UserProfile','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','UserSetting','userSetting','hasMany','VoiceRecording','VoiceQueuesRt','Extensions','CmHopperFinal','HopperFinals','HopperHistory','OpenchannelInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','UserNotifications','SenderId','Hoppers','SET\x20NULL','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','CmList','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','WhatsappInteractions','VoiceQueues','VoicePrefixes','MailQueue','MailQueues','ChatQueues','UserChatQueue','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','ChanSpyId','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Answers','Interactions','List','ListId','team_has_mail_queues','Teams','Messages','MailInteractionId','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachment','Interaction','ChatWebsiteId','MailApplication','TagId','MailQueueReport','Items','Dispositions','Tags','FaxInteractionId','Account','team_has_fax_queues','FaxQueueReport','SmsAccountId','Applications','IntervalId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','AttachmentId','team_has_openchannel_queues','ProactiveActions','mandatoryDispositionPauseId','user_has_chat_websites','OpenchannelQueueReport','Agent','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','Attachments','ChatOfflineMessageId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','CompanyId','Phones','Company','cm_user_has_contacts','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Queue','OwnerId','CampaignId','Condition','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','fax_interaction_has_tags','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmContactId','AllConditions','AllCondition','AnyConditions','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','VariableId','SugarcrmAccount','Subjects','Description','DeskAccount','ZohoField','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerField','FreshsalesField','SessionId','JscriptyAnswerReport','ProjectId','team_has_sms_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToQueue','ToMailAccountId','FromAccount','ToAgent','ToChatQueueId','ToChatWebsiteId','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Interval','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','Integration','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x1aa9ac,_0x4c4c7d){var _0x705dfb=function(_0x187d9e){while(--_0x187d9e){_0x1aa9ac['push'](_0x1aa9ac['shift']());}};_0x705dfb(++_0x4c4c7d);}(_0xf117,0x122));var _0x7f11=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xf117[_0x26462c];return _0x509a42;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x7f11('0x0'));var _=require(_0x7f11('0x1'));var jstz=require(_0x7f11('0x2'));var timezone=jstz['determine']();config['sequelize']=_[_0x7f11('0x3')](config[_0x7f11('0x0')],{'database':_0x7f11('0x4'),'username':_0x7f11('0x5'),'password':_0x7f11('0x6'),'options':{'host':_0x7f11('0x7'),'port':0xcea,'dialect':_0x7f11('0x8'),'dialectOptions':{'charset':_0x7f11('0x9')},'logging':![],'timezone':timezone[_0x7f11('0xa')](),'define':{'charset':_0x7f11('0xb'),'collate':_0x7f11('0xc')}}});config[_0x7f11('0xd')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x7f11('0x4'),'username':_0x7f11('0x5'),'password':_0x7f11('0x6'),'options':{'host':_0x7f11('0x7'),'port':0xcea,'dialect':_0x7f11('0x8'),'dialectOptions':{'charset':_0x7f11('0x9')},'logging':![],'timezone':timezone[_0x7f11('0xa')](),'define':{'charset':_0x7f11('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7f11('0x0')][_0x7f11('0xe')],config[_0x7f11('0x0')][_0x7f11('0xf')],config[_0x7f11('0x0')][_0x7f11('0x10')],config[_0x7f11('0x0')][_0x7f11('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0x7f11('0xd')][_0x7f11('0xf')],config['sequelizeHistory']['password'],config[_0x7f11('0xd')][_0x7f11('0x11')])};db[_0x7f11('0x12')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x14'));db[_0x7f11('0x15')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x16'));db[_0x7f11('0x17')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x18'));db[_0x7f11('0x19')]=db['sequelize']['import']('../api/voiceExtension/voiceExtension.model');db[_0x7f11('0x1a')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x1b'));db[_0x7f11('0x1c')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x1d'));db['VoiceRecording']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x1e'));db[_0x7f11('0x1f')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x20'));db[_0x7f11('0x21')]=db['sequelize']['import'](_0x7f11('0x22'));db[_0x7f11('0x23')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x24'));db[_0x7f11('0x25')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x26'));db['VoiceDialReport']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x27'));db[_0x7f11('0x28')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x29'));db[_0x7f11('0x2a')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x2b'));db['MemberReport']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x2c'));db[_0x7f11('0x2d')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x2e'));db['VoiceTransferReport']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x2f'));db[_0x7f11('0x30')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x31'));db[_0x7f11('0x32')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x33'));db['UserChatQueue']=db[_0x7f11('0x0')]['import']('../api/userChatQueue/userChatQueue.model');db[_0x7f11('0x34')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x35'));db[_0x7f11('0x36')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x37'));db[_0x7f11('0x38')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x39'));db['UserOpenchannelQueue']=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x3a'));db[_0x7f11('0x3b')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x3c'));db[_0x7f11('0x3d')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x3e'));db[_0x7f11('0x3f')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x40'));db[_0x7f11('0x41')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x42'));db['MailQueue']=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x43'));db[_0x7f11('0x44')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x45'));db['MailInteraction']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x46'));db[_0x7f11('0x47')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x48'));db['MailApplication']=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x49'));db[_0x7f11('0x4a')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x4b'));db[_0x7f11('0x4c')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0x7f11('0x4d')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x4e'));db[_0x7f11('0x4f')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x50'));db[_0x7f11('0x51')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0x7f11('0x52')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x53'));db['FaxQueue']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x54'));db['FaxQueueReport']=db['sequelize'][_0x7f11('0x13')]('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x55'));db[_0x7f11('0x56')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x57'));db[_0x7f11('0x58')]=db['sequelize']['import'](_0x7f11('0x59'));db[_0x7f11('0x5a')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x5b'));db[_0x7f11('0x5c')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x5d'));db[_0x7f11('0x5e')]=db[_0x7f11('0x0')]['import']('../api/openchannelAccount/openchannelAccount.model');db[_0x7f11('0x5f')]=db['sequelize']['import']('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x60'));db[_0x7f11('0x61')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x62'));db['OpenchannelQueue']=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x63'));db[_0x7f11('0x64')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x65'));db['OpenchannelQueueReport']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x66'));db[_0x7f11('0x67')]=db['sequelize']['import'](_0x7f11('0x68'));db[_0x7f11('0x69')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x6a'));db[_0x7f11('0x6b')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x6c'));db[_0x7f11('0x6d')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x6e'));db[_0x7f11('0x6f')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x70'));db[_0x7f11('0x71')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x72'));db[_0x7f11('0x73')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x74'));db[_0x7f11('0x75')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/cmCompany/cmCompany.model');db[_0x7f11('0x76')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x77'));db[_0x7f11('0x78')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x79'));db[_0x7f11('0x7a')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x7b'));db['CmHopperFinal']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x7c'));db[_0x7f11('0x7d')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x7f11('0x7e')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x7f'));db['CmCustomField']=db['sequelize']['import'](_0x7f11('0x80'));db[_0x7f11('0x81')]=db['sequelize'][_0x7f11('0x13')]('../api/action/action.model');db[_0x7f11('0x82')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x83'));db[_0x7f11('0x84')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x85'));db[_0x7f11('0x86')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x87'));db['Condition']=db['sequelize'][_0x7f11('0x13')]('../api/condition/condition.model');db[_0x7f11('0x88')]=db['sequelize']['import']('../api/interval/interval.model');db[_0x7f11('0x89')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/pause/pause.model');db[_0x7f11('0x8a')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x8b'));db[_0x7f11('0x8c')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x8d'));db['Schedule']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x8e'));db['Sound']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x8f'));db[_0x7f11('0x90')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x91'));db[_0x7f11('0x92')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x93'));db[_0x7f11('0x94')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x95'));db['CmHopperAdditionalPhone']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x96'));db[_0x7f11('0x97')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x98'));db[_0x7f11('0x99')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x9a'));db[_0x7f11('0x9b')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x9c'));db['Integration']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x9d'));db[_0x7f11('0x9e')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/integrationReport/integrationReport.model');db[_0x7f11('0x9f')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xa0'));db[_0x7f11('0xa1')]=db['sequelize'][_0x7f11('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xa2'));db['AnalyticMetric']=db['sequelize']['import'](_0x7f11('0xa3'));db[_0x7f11('0xa4')]=db[_0x7f11('0x0')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db['sequelize'][_0x7f11('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x7f11('0xa5')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x7f11('0xa6')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xa7'));db[_0x7f11('0xa8')]=db[_0x7f11('0x0')]['import']('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x7f11('0x0')]['import'](_0x7f11('0xa9'));db[_0x7f11('0xaa')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xab'));db[_0x7f11('0xac')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xad'));db['DeskAccount']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xae'));db[_0x7f11('0xaf')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xb0'));db[_0x7f11('0xb1')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xb2'));db[_0x7f11('0xb3')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xb4'));db[_0x7f11('0xb5')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0x7f11('0x0')]['import'](_0x7f11('0xb6'));db[_0x7f11('0xb7')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xb8'));db[_0x7f11('0xb9')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xba'));db['ZendeskField']=db['sequelize']['import']('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xbb'));db[_0x7f11('0xbc')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xbd'));db[_0x7f11('0xbe')]=db[_0x7f11('0x0')]['import']('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x7f11('0x0')]['import'](_0x7f11('0xbf'));db[_0x7f11('0xc0')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xc1'));db['VtigerField']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xc2'));db[_0x7f11('0xc3')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xc4'));db[_0x7f11('0xc5')]=db[_0x7f11('0x0')]['import'](_0x7f11('0xc6'));db[_0x7f11('0xc7')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xc8'));db[_0x7f11('0xc9')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xca'));db[_0x7f11('0xcb')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xcc'));db[_0x7f11('0xcd')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xce'));db[_0x7f11('0xcf')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xd0'));db[_0x7f11('0xd1')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xd2'));db['FreshsalesField']=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x7f11('0xd3')]=db['sequelize'][_0x7f11('0x13')]('../api/integration/integration.model');db['Network']=db[_0x7f11('0x0')]['import'](_0x7f11('0xd4'));db[_0x7f11('0xd5')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xd6'));db['ChatInternalMessage']=db['sequelize'][_0x7f11('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xd7'));db[_0x7f11('0xd8')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xd9'));db[_0x7f11('0xda')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xdb'));db[_0x7f11('0xdc')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xdd'));db['SquareReport']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xde'));db[_0x7f11('0xdf')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xe0'));db[_0x7f11('0xe1')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xe2'));db[_0x7f11('0xe3')]=db[_0x7f11('0x0')]['import'](_0x7f11('0xe4'));db[_0x7f11('0xe5')]=db[_0x7f11('0x0')]['import'](_0x7f11('0xe6'));db[_0x7f11('0xe7')]=db['sequelize']['import'](_0x7f11('0xe8'));db[_0x7f11('0xe9')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xea'));db[_0x7f11('0xeb')]=db[_0x7f11('0x0')]['import'](_0x7f11('0xec'));db[_0x7f11('0xed')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xee'));db[_0x7f11('0xef')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xf0'));db[_0x7f11('0xf1')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xf2'));db[_0x7f11('0xf3')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xf4'));db['Attachment']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xf5'));db[_0x7f11('0xf6')]=db['sequelize']['import'](_0x7f11('0xf7'));db[_0x7f11('0xf8')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0x7f11('0xf9')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db['sequelize'][_0x7f11('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0x7f11('0xfa')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0xfb'));db[_0x7f11('0xfc')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0xfd'));db['CmList']=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/cmList/cmList.model');db[_0x7f11('0xfe')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/voicePrefix/voicePrefix.model');db[_0x7f11('0xff')]=db['sequelize'][_0x7f11('0x13')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x100'));db[_0x7f11('0x101')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x102'));db[_0x7f11('0x103')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x104'));db[_0x7f11('0x105')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x106'));db[_0x7f11('0x107')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x108'));db[_0x7f11('0x109')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x10a'));db[_0x7f11('0x10b')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x10c'));db[_0x7f11('0x10d')]=db['sequelize']['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x10e'));db[_0x7f11('0x10f')]=db[_0x7f11('0x0')]['import'](_0x7f11('0x110'));db[_0x7f11('0x111')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/cloudProvider/cloudProvider.model');db[_0x7f11('0x112')]=db['sequelize'][_0x7f11('0x13')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x7f11('0x113')]=db[_0x7f11('0x0')][_0x7f11('0x13')](_0x7f11('0x114'));db[_0x7f11('0x115')]=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db['UserSetting']=db[_0x7f11('0x0')][_0x7f11('0x13')]('../api/user-setting/user-setting.model');db[_0x7f11('0x116')]=db['sequelize'][_0x7f11('0x13')](_0x7f11('0x117'));db[_0x7f11('0x12')][_0x7f11('0x118')](db['VoiceMail'],{'as':_0x7f11('0x21'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')]['hasOne'](db[_0x7f11('0x11b')],{'as':_0x7f11('0x11c'),'onDelete':'cascade','foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')][_0x7f11('0x11d')](db[_0x7f11('0x11e')],{'as':'Recordings','foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')][_0x7f11('0x11d')](db[_0x7f11('0x30')],{'as':_0x7f11('0x11f'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')][_0x7f11('0x11d')](db[_0x7f11('0x19')],{'as':_0x7f11('0x120'),'onDelete':_0x7f11('0x119'),'hooks':!![]});db['User'][_0x7f11('0x11d')](db[_0x7f11('0x121')],{'as':_0x7f11('0x122'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')][_0x7f11('0x11d')](db[_0x7f11('0x7d')],{'as':_0x7f11('0x123'),'foreignKey':_0x7f11('0x11a')});db['User'][_0x7f11('0x11d')](db[_0x7f11('0x7e')],{'as':_0x7f11('0x7e'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')][_0x7f11('0x11d')](db[_0x7f11('0x124')],{'as':'OpenchannelInteractions','foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')]['hasMany'](db[_0x7f11('0x69')],{'as':_0x7f11('0x125'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')][_0x7f11('0x11d')](db[_0x7f11('0x58')],{'as':_0x7f11('0x126'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x12')][_0x7f11('0x11d')](db[_0x7f11('0x51')],{'as':_0x7f11('0x127'),'foreignKey':'UserId'});db[_0x7f11('0x12')]['hasMany'](db[_0x7f11('0x128')],{'as':_0x7f11('0x129'),'foreignKey':'UserId'});db[_0x7f11('0x12')][_0x7f11('0x11d')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x7f11('0x12')]['hasMany'](db[_0x7f11('0x103')],{'as':_0x7f11('0x12a'),'foreignKey':_0x7f11('0x12b')});db['User'][_0x7f11('0x11d')](db[_0x7f11('0x78')],{'as':_0x7f11('0x12c'),'foreignKey':_0x7f11('0x11a'),'onDelete':_0x7f11('0x12d')});db[_0x7f11('0x12')][_0x7f11('0x12e')](db[_0x7f11('0xff')],{'as':_0x7f11('0xff'),'foreignKey':_0x7f11('0x12f')});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x71')],{'as':_0x7f11('0x131'),'through':_0x7f11('0x132')});db['User'][_0x7f11('0x130')](db[_0x7f11('0x76')],{'as':_0x7f11('0x133'),'through':'cm_user_has_contacts'});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x134')],{'as':_0x7f11('0x135'),'through':_0x7f11('0x136')});db[_0x7f11('0x12')][_0x7f11('0x130')](db['Team'],{'through':_0x7f11('0x137')});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x128')],{'as':_0x7f11('0x129'),'through':_0x7f11('0x138')});db[_0x7f11('0x12')]['belongsToMany'](db[_0x7f11('0x69')],{'as':_0x7f11('0x125'),'through':'user_has_chat_interactions'});db[_0x7f11('0x12')]['belongsToMany'](db[_0x7f11('0x51')],{'as':'FaxInteractions','through':_0x7f11('0x139')});db['User'][_0x7f11('0x130')](db[_0x7f11('0x58')],{'as':_0x7f11('0x126'),'through':_0x7f11('0x13a')});db['User'][_0x7f11('0x130')](db[_0x7f11('0x124')],{'as':_0x7f11('0x13b'),'through':_0x7f11('0x13c')});db['User'][_0x7f11('0x130')](db[_0x7f11('0x109')],{'as':_0x7f11('0x13d'),'through':'user_has_whatsapp_interactions'});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x1c')],{'as':_0x7f11('0x13e'),'through':'UserVoiceQueue','required':![]});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0xfe')],{'as':_0x7f11('0x13f'),'through':_0x7f11('0x115'),'required':![]});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x140')],{'as':_0x7f11('0x141'),'through':'UserMailQueue','required':![]});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x6f')],{'as':_0x7f11('0x142'),'through':_0x7f11('0x143'),'required':![],'hooks':!![]});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x144')],{'as':_0x7f11('0x145'),'through':_0x7f11('0x36'),'required':![]});db[_0x7f11('0x12')][_0x7f11('0x130')](db['SmsQueue'],{'as':_0x7f11('0x146'),'through':_0x7f11('0x38'),'required':![]});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x147')],{'as':_0x7f11('0x148'),'through':'UserOpenchannelQueue','required':![]});db['User']['belongsToMany'](db[_0x7f11('0x10f')],{'as':_0x7f11('0x149'),'through':_0x7f11('0x3b'),'required':![]});db['User'][_0x7f11('0x130')](db[_0x7f11('0x134')],{'through':'cm_user_has_lists'});db[_0x7f11('0x12')]['belongsToMany'](db['ChatWebsite'],{'as':_0x7f11('0x14a'),'through':'user_has_chat_websites'});db['User']['belongsToMany'](db[_0x7f11('0x4d')],{'as':_0x7f11('0x14b'),'through':_0x7f11('0x14c')});db[_0x7f11('0x12')][_0x7f11('0x130')](db[_0x7f11('0x41')],{'as':'MailAccounts','through':_0x7f11('0x14d')});db['User'][_0x7f11('0x130')](db[_0x7f11('0x5e')],{'as':_0x7f11('0x14e'),'through':_0x7f11('0x14f')});db[_0x7f11('0x12')]['belongsToMany'](db[_0x7f11('0x150')],{'as':'SmsAccounts','through':_0x7f11('0x151')});db[_0x7f11('0x12')][_0x7f11('0x130')](db['WhatsappAccount'],{'as':_0x7f11('0x152'),'through':'user_has_whatsapp_accounts'});db[_0x7f11('0x15')]['hasMany'](db['VoiceExtension'],{'as':_0x7f11('0x153'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x154')});db[_0x7f11('0x17')][_0x7f11('0x11d')](db['VoiceExtension'],{'onDelete':_0x7f11('0x119')});db[_0x7f11('0x19')][_0x7f11('0x11d')](db[_0x7f11('0x19')],{'as':'Applications','onDelete':_0x7f11('0x119')});db['VoiceMusicOnHold'][_0x7f11('0x130')](db[_0x7f11('0x155')],{'as':_0x7f11('0x156'),'through':_0x7f11('0x157')});db[_0x7f11('0x1c')][_0x7f11('0x11d')](db[_0x7f11('0x30')],{'as':_0x7f11('0x158'),'foreignKey':_0x7f11('0x159')});db[_0x7f11('0x1c')][_0x7f11('0x11d')](db['CmHopper'],{'as':_0x7f11('0x12c'),'foreignKey':_0x7f11('0x159')});db['VoiceQueue']['hasMany'](db[_0x7f11('0x121')],{'as':_0x7f11('0x122'),'foreignKey':_0x7f11('0x159')});db[_0x7f11('0x1c')][_0x7f11('0x11d')](db[_0x7f11('0x7d')],{'as':'HopperHistories','foreignKey':_0x7f11('0x159')});db['VoiceQueue'][_0x7f11('0x11d')](db[_0x7f11('0x7e')],{'as':_0x7f11('0x7e'),'foreignKey':_0x7f11('0x159')});db[_0x7f11('0x1c')][_0x7f11('0x11d')](db[_0x7f11('0x7a')],{'as':_0x7f11('0x15a'),'foreignKey':_0x7f11('0x159')});db['VoiceQueue'][_0x7f11('0x11d')](db[_0x7f11('0xda')],{'as':_0x7f11('0x15b'),'foreignKey':_0x7f11('0x159')});db[_0x7f11('0x1c')]['belongsTo'](db[_0x7f11('0x2d')],{'as':_0x7f11('0x2d'),'foreignKey':_0x7f11('0x15c')});db[_0x7f11('0x1c')][_0x7f11('0x12e')](db[_0x7f11('0x2d')],{'as':_0x7f11('0x15d'),'foreignKey':_0x7f11('0x15e')});db['VoiceQueue']['belongsTo'](db['Interval'],{'as':_0x7f11('0x88'),'foreignKey':'IntervalId'});db[_0x7f11('0x1c')]['belongsTo'](db[_0x7f11('0x89')],{'as':_0x7f11('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7f11('0x1c')][_0x7f11('0x130')](db[_0x7f11('0x134')],{'as':'Lists','through':_0x7f11('0x160')});db[_0x7f11('0x1c')][_0x7f11('0x130')](db['User'],{'as':_0x7f11('0x161'),'through':_0x7f11('0x32')});db[_0x7f11('0x1c')][_0x7f11('0x130')](db[_0x7f11('0xed')],{'as':'Teams','through':_0x7f11('0x112')});db[_0x7f11('0x1c')][_0x7f11('0x130')](db[_0x7f11('0x134')],{'as':_0x7f11('0x162'),'through':_0x7f11('0x163')});db[_0x7f11('0x11e')][_0x7f11('0x12e')](db['User'],{'as':_0x7f11('0x12'),'foreignKey':_0x7f11('0x11a')});db['ScreenRecording'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':'User','foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x21')][_0x7f11('0x11d')](db[_0x7f11('0x23')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x7f11('0x164'),'sourceKey':_0x7f11('0x165')});db[_0x7f11('0x23')][_0x7f11('0x12e')](db[_0x7f11('0x21')],{'foreignKey':_0x7f11('0x164'),'targetKey':_0x7f11('0x165')});db['VoiceCallReport'][_0x7f11('0x11d')](db[_0x7f11('0x2a')],{'as':_0x7f11('0x166'),'foreignKey':_0x7f11('0x167'),'constraints':![]});db[_0x7f11('0x25')][_0x7f11('0x11d')](db[_0x7f11('0x28')],{'as':_0x7f11('0x168'),'foreignKey':_0x7f11('0x167'),'constraints':![]});db[_0x7f11('0x25')]['belongsTo'](db[_0x7f11('0x12')],{'as':'User','foreignKey':_0x7f11('0x11a')});db['VoiceCallReport'][_0x7f11('0x12e')](db['CmContact'],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db['MailServerIn'][_0x7f11('0x12e')](db[_0x7f11('0x41')],{'as':'MailAccount','foreignKey':_0x7f11('0x16b')});db['MailServerIn']['belongsTo'](db[_0x7f11('0x111')],{'as':_0x7f11('0x111'),'foreignKey':_0x7f11('0x16c'),'onDelete':'restrict'});db[_0x7f11('0x3f')]['belongsTo'](db[_0x7f11('0x41')],{'as':_0x7f11('0x41'),'foreignKey':_0x7f11('0x16b')});db['MailServerOut'][_0x7f11('0x12e')](db[_0x7f11('0x111')],{'as':_0x7f11('0x111'),'foreignKey':'CloudProviderId','onDelete':_0x7f11('0x16d')});db[_0x7f11('0x41')][_0x7f11('0x118')](db[_0x7f11('0x3d')],{'as':_0x7f11('0x16e'),'onDelete':_0x7f11('0x119')});db['MailAccount'][_0x7f11('0x118')](db[_0x7f11('0x3f')],{'as':_0x7f11('0x16f'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0x41')][_0x7f11('0x11d')](db[_0x7f11('0x86')],{'as':'Dispositions','foreignKey':_0x7f11('0x16b'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0x41')]['hasMany'](db[_0x7f11('0x84')],{'as':_0x7f11('0x170'),'foreignKey':'MailAccountId'});db[_0x7f11('0x41')][_0x7f11('0x11d')](db[_0x7f11('0x47')],{'as':'Messages','foreignKey':_0x7f11('0x16b')});db[_0x7f11('0x41')][_0x7f11('0x11d')](db[_0x7f11('0x128')],{'as':_0x7f11('0x171')});db[_0x7f11('0x41')][_0x7f11('0x11d')](db['MailApplication'],{'as':'Applications','foreignKey':_0x7f11('0x16b'),'onDelete':'cascade'});db[_0x7f11('0x41')]['belongsTo'](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db['MailAccount'][_0x7f11('0x12e')](db[_0x7f11('0x97')],{'as':_0x7f11('0x97'),'foreignKey':'TemplateId'});db[_0x7f11('0x41')][_0x7f11('0x12e')](db[_0x7f11('0x89')],{'as':_0x7f11('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7f11('0x41')][_0x7f11('0x130')](db['User'],{'as':_0x7f11('0x161'),'through':'user_has_mail_accounts'});db[_0x7f11('0x140')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x161'),'through':'UserMailQueue'});db[_0x7f11('0x140')][_0x7f11('0x130')](db[_0x7f11('0xed')],{'through':_0x7f11('0x174'),'as':_0x7f11('0x175')});db[_0x7f11('0x128')][_0x7f11('0x11d')](db[_0x7f11('0x47')],{'as':_0x7f11('0x176'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x177')});db[_0x7f11('0x128')]['belongsTo'](db[_0x7f11('0x41')],{'as':'Account','foreignKey':_0x7f11('0x16b')});db[_0x7f11('0x128')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db['MailInteraction'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x178'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x128')]['belongsToMany'](db[_0x7f11('0x90')],{'through':_0x7f11('0x179'),'as':'Tags'});db[_0x7f11('0x128')]['belongsToMany'](db[_0x7f11('0x90')],{'through':'mail_interaction_has_tags','as':_0x7f11('0x17a')});db[_0x7f11('0x128')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x17b'),'through':_0x7f11('0x138'),'foreignKey':_0x7f11('0x177')});db[_0x7f11('0x47')][_0x7f11('0x11d')](db[_0x7f11('0x17c')],{'as':'Attachments','onDelete':_0x7f11('0x119')});db[_0x7f11('0x47')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x12')});db['MailMessage'][_0x7f11('0x12e')](db['CmContact'],{'onDelete':'cascade','as':_0x7f11('0x169')});db['MailMessage']['belongsTo'](db['MailInteraction'],{'as':_0x7f11('0x17d'),'foreignKey':_0x7f11('0x177')});db[_0x7f11('0x47')][_0x7f11('0x12e')](db[_0x7f11('0x41')],{'as':'Account','foreignKey':_0x7f11('0x16b')});db[_0x7f11('0x47')]['belongsTo'](db[_0x7f11('0x64')],{'as':_0x7f11('0x64'),'foreignKey':_0x7f11('0x17e')});db['MailMessage'][_0x7f11('0x12e')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x17f')][_0x7f11('0x12e')](db[_0x7f11('0x140')],{'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x17f')][_0x7f11('0x12e')](db[_0x7f11('0x41')],{'onDelete':'restrict'});db[_0x7f11('0x17f')]['belongsTo'](db[_0x7f11('0x88')],{'onDelete':_0x7f11('0x16d'),'foreignKey':'IntervalId'});db['MailApplication'][_0x7f11('0x12e')](db[_0x7f11('0x90')],{'onDelete':'restrict','foreignKey':_0x7f11('0x180')});db['MailQueueReport']['belongsTo'](db[_0x7f11('0x41')],{});db[_0x7f11('0x181')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0x181')][_0x7f11('0x12e')](db['CmContact'],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db[_0x7f11('0x181')][_0x7f11('0x12e')](db[_0x7f11('0x128')],{});db[_0x7f11('0x181')][_0x7f11('0x12e')](db['MailMessage'],{});db[_0x7f11('0x181')]['belongsTo'](db[_0x7f11('0x12')],{});db[_0x7f11('0x181')][_0x7f11('0x12e')](db['MailQueue'],{});db[_0x7f11('0x4a')]['hasMany'](db[_0x7f11('0x4c')],{'as':_0x7f11('0x182'),'onDelete':'cascade'});db[_0x7f11('0x4d')][_0x7f11('0x11d')](db[_0x7f11('0x86')],{'as':_0x7f11('0x183'),'foreignKey':'FaxAccountId','onDelete':_0x7f11('0x119')});db[_0x7f11('0x4d')][_0x7f11('0x11d')](db[_0x7f11('0x84')],{'as':_0x7f11('0x170'),'foreignKey':'FaxAccountId'});db[_0x7f11('0x4d')]['hasMany'](db[_0x7f11('0x51')],{'as':_0x7f11('0x171')});db[_0x7f11('0x4d')][_0x7f11('0x11d')](db[_0x7f11('0x4f')],{'as':'Applications','foreignKey':'FaxAccountId','onDelete':_0x7f11('0x119')});db[_0x7f11('0x4d')][_0x7f11('0x11d')](db[_0x7f11('0x19')],{'as':'Exntensions','onDelete':_0x7f11('0x119')});db['FaxAccount']['hasMany'](db[_0x7f11('0x52')],{'as':_0x7f11('0x176')});db['FaxAccount'][_0x7f11('0x12e')](db[_0x7f11('0x2d')],{'as':_0x7f11('0x2d')});db[_0x7f11('0x4d')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0x4d')][_0x7f11('0x12e')](db['Pause'],{'as':_0x7f11('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7f11('0x4d')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x161'),'through':_0x7f11('0x14c')});db[_0x7f11('0x4f')]['belongsTo'](db[_0x7f11('0x12')],{'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x4f')][_0x7f11('0x12e')](db['FaxQueue'],{'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x4f')][_0x7f11('0x12e')](db[_0x7f11('0x4d')],{'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x4f')][_0x7f11('0x12e')](db[_0x7f11('0x90')],{'onDelete':_0x7f11('0x16d'),'foreignKey':'TagId'});db[_0x7f11('0x51')][_0x7f11('0x11d')](db['FaxMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':'FaxInteractionId'});db[_0x7f11('0x51')][_0x7f11('0x12e')](db[_0x7f11('0x4d')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x7f11('0x51')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db[_0x7f11('0x51')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x178'),'foreignKey':'UserId'});db['FaxInteraction']['belongsToMany'](db[_0x7f11('0x90')],{'through':'fax_interaction_has_tags','as':_0x7f11('0x184')});db['FaxInteraction']['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db['FaxInteraction'][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':'Users','through':_0x7f11('0x139'),'foreignKey':_0x7f11('0x185')});db[_0x7f11('0x52')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'onDelete':'cascade','as':_0x7f11('0x12')});db[_0x7f11('0x52')][_0x7f11('0x12e')](db[_0x7f11('0x51')],{'as':_0x7f11('0x17d'),'foreignKey':'FaxInteractionId'});db['FaxMessage']['belongsTo'](db[_0x7f11('0x76')],{'onDelete':_0x7f11('0x119'),'as':_0x7f11('0x169')});db['FaxMessage']['belongsTo'](db[_0x7f11('0x17c')],{'as':_0x7f11('0x17c'),'foreignKey':'AttachmentId'});db[_0x7f11('0x52')][_0x7f11('0x12e')](db['FaxAccount'],{'as':_0x7f11('0x186'),'foreignKey':'FaxAccountId'});db[_0x7f11('0x144')]['belongsToMany'](db[_0x7f11('0x12')],{'as':'Agents','through':_0x7f11('0x36')});db['FaxQueue'][_0x7f11('0x130')](db[_0x7f11('0xed')],{'through':_0x7f11('0x187'),'as':_0x7f11('0x175')});db[_0x7f11('0x188')][_0x7f11('0x12e')](db[_0x7f11('0x4d')],{});db[_0x7f11('0x188')][_0x7f11('0x12e')](db['CmList'],{'as':'List','foreignKey':_0x7f11('0x173')});db[_0x7f11('0x188')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db[_0x7f11('0x188')][_0x7f11('0x12e')](db[_0x7f11('0x51')],{});db['FaxQueueReport'][_0x7f11('0x12e')](db[_0x7f11('0x52')],{});db[_0x7f11('0x188')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{});db['FaxQueueReport']['belongsTo'](db['FaxQueue'],{});db[_0x7f11('0x150')][_0x7f11('0x11d')](db[_0x7f11('0x86')],{'as':_0x7f11('0x183'),'foreignKey':_0x7f11('0x189'),'onDelete':'cascade'});db[_0x7f11('0x150')][_0x7f11('0x11d')](db['CannedAnswer'],{'as':_0x7f11('0x170'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x7f11('0x11d')](db[_0x7f11('0x5a')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x7f11('0x150')]['hasMany'](db[_0x7f11('0x58')],{'as':_0x7f11('0x171')});db['SmsAccount'][_0x7f11('0x11d')](db[_0x7f11('0x56')],{'as':_0x7f11('0x18a'),'foreignKey':_0x7f11('0x189'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0x150')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0x150')]['belongsTo'](db['Pause'],{'as':_0x7f11('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7f11('0x150')][_0x7f11('0x130')](db['User'],{'as':'Agents','through':'user_has_sms_accounts'});db[_0x7f11('0x56')]['belongsTo'](db[_0x7f11('0x12')],{'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x56')]['belongsTo'](db[_0x7f11('0x5c')],{'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x56')]['belongsTo'](db[_0x7f11('0x150')],{'onDelete':'restrict'});db[_0x7f11('0x56')][_0x7f11('0x12e')](db[_0x7f11('0x88')],{'onDelete':_0x7f11('0x16d'),'foreignKey':_0x7f11('0x18b')});db['SmsApplication'][_0x7f11('0x12e')](db[_0x7f11('0x90')],{'onDelete':_0x7f11('0x16d'),'foreignKey':_0x7f11('0x180')});db[_0x7f11('0x58')]['hasMany'](db[_0x7f11('0x5a')],{'as':_0x7f11('0x176'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x18c')});db[_0x7f11('0x58')][_0x7f11('0x12e')](db[_0x7f11('0x150')],{'as':'Account','foreignKey':_0x7f11('0x189')});db[_0x7f11('0x58')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db[_0x7f11('0x58')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x178'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x58')]['belongsToMany'](db[_0x7f11('0x90')],{'through':_0x7f11('0x18d'),'as':'Tags'});db[_0x7f11('0x58')]['belongsToMany'](db[_0x7f11('0x90')],{'through':_0x7f11('0x18d'),'as':_0x7f11('0x17a')});db[_0x7f11('0x58')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x17b'),'through':_0x7f11('0x13a'),'foreignKey':_0x7f11('0x18c')});db[_0x7f11('0x5a')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x12')});db[_0x7f11('0x5a')][_0x7f11('0x12e')](db['CmContact'],{'onDelete':_0x7f11('0x119'),'as':'Contact'});db[_0x7f11('0x5a')]['belongsTo'](db[_0x7f11('0x58')],{'onDelete':'cascade','as':_0x7f11('0x17d'),'foreignKey':_0x7f11('0x18c')});db[_0x7f11('0x5a')][_0x7f11('0x12e')](db[_0x7f11('0x150')],{'as':_0x7f11('0x186'),'foreignKey':_0x7f11('0x189')});db['SmsQueue'][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x161'),'through':'UserSmsQueue','foreignKey':_0x7f11('0x18e')});db[_0x7f11('0x5c')][_0x7f11('0x130')](db['Team'],{'through':'team_has_sms_queues','as':'Teams'});db[_0x7f11('0x5e')][_0x7f11('0x11d')](db[_0x7f11('0x86')],{'as':_0x7f11('0x183'),'foreignKey':_0x7f11('0x18f'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0x5e')][_0x7f11('0x11d')](db[_0x7f11('0x84')],{'as':_0x7f11('0x170'),'foreignKey':'OpenchannelAccountId'});db[_0x7f11('0x5e')][_0x7f11('0x11d')](db[_0x7f11('0x124')],{'as':_0x7f11('0x171'),'foreignKey':_0x7f11('0x18f')});db[_0x7f11('0x5e')][_0x7f11('0x11d')](db[_0x7f11('0x61')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x7f11('0x5e')][_0x7f11('0x11d')](db['OpenchannelApplication'],{'as':_0x7f11('0x18a'),'foreignKey':_0x7f11('0x18f'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0x5e')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0x5e')][_0x7f11('0x12e')](db[_0x7f11('0x89')],{'as':_0x7f11('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7f11('0x5e')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x161'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x7f11('0x12e')](db['User'],{'onDelete':_0x7f11('0x16d')});db['OpenchannelApplication'][_0x7f11('0x12e')](db[_0x7f11('0x147')],{'onDelete':_0x7f11('0x16d'),'foreignKey':_0x7f11('0x190')});db['OpenchannelApplication']['belongsTo'](db[_0x7f11('0x5e')],{'onDelete':_0x7f11('0x16d'),'foreignKey':_0x7f11('0x18f')});db[_0x7f11('0x5f')][_0x7f11('0x12e')](db[_0x7f11('0x88')],{'onDelete':_0x7f11('0x16d'),'foreignKey':_0x7f11('0x18b')});db[_0x7f11('0x5f')][_0x7f11('0x12e')](db[_0x7f11('0x90')],{'onDelete':'restrict','foreignKey':_0x7f11('0x180')});db[_0x7f11('0x124')][_0x7f11('0x11d')](db[_0x7f11('0x61')],{'as':_0x7f11('0x176'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x191')});db[_0x7f11('0x124')]['belongsTo'](db[_0x7f11('0x5e')],{'as':_0x7f11('0x186'),'foreignKey':_0x7f11('0x18f')});db[_0x7f11('0x124')]['belongsTo'](db[_0x7f11('0x76')],{'as':'Contact','foreignKey':_0x7f11('0x16a')});db[_0x7f11('0x124')]['belongsTo'](db[_0x7f11('0x12')],{'as':_0x7f11('0x178'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x124')][_0x7f11('0x130')](db[_0x7f11('0x90')],{'through':'openchannel_interaction_has_tags','as':_0x7f11('0x184')});db[_0x7f11('0x124')][_0x7f11('0x130')](db[_0x7f11('0x90')],{'through':'openchannel_interaction_has_tags','as':_0x7f11('0x17a')});db[_0x7f11('0x124')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x17b'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x7f11('0x61')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'onDelete':'cascade','as':'User'});db[_0x7f11('0x61')]['belongsTo'](db[_0x7f11('0x76')],{'onDelete':_0x7f11('0x119'),'as':_0x7f11('0x169')});db[_0x7f11('0x61')][_0x7f11('0x12e')](db[_0x7f11('0x124')],{'onDelete':'cascade','as':_0x7f11('0x17d'),'foreignKey':'OpenchannelInteractionId'});db[_0x7f11('0x61')][_0x7f11('0x12e')](db[_0x7f11('0x17c')],{'as':_0x7f11('0x17c'),'foreignKey':_0x7f11('0x192')});db[_0x7f11('0x61')][_0x7f11('0x12e')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x7f11('0x18f')});db['OpenchannelQueue'][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0x7f11('0x190')});db['OpenchannelQueue']['belongsToMany'](db[_0x7f11('0xed')],{'through':_0x7f11('0x193'),'as':_0x7f11('0x175')});db[_0x7f11('0x64')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x7f11('0x17e'),'onDelete':_0x7f11('0x119')});db['ChatWebsite'][_0x7f11('0x11d')](db[_0x7f11('0x84')],{'as':_0x7f11('0x170'),'foreignKey':_0x7f11('0x17e')});db[_0x7f11('0x64')][_0x7f11('0x11d')](db[_0x7f11('0x73')],{'as':_0x7f11('0x194')});db[_0x7f11('0x64')][_0x7f11('0x11d')](db[_0x7f11('0x69')],{'as':_0x7f11('0x171')});db[_0x7f11('0x64')]['hasMany'](db[_0x7f11('0x67')],{'as':_0x7f11('0x18a'),'foreignKey':_0x7f11('0x17e'),'onDelete':'cascade'});db['ChatWebsite'][_0x7f11('0x11d')](db['ChatMessage'],{'as':_0x7f11('0x176')});db[_0x7f11('0x64')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0x64')][_0x7f11('0x12e')](db[_0x7f11('0x88')],{'as':_0x7f11('0x88'),'foreignKey':_0x7f11('0x18b')});db[_0x7f11('0x64')]['belongsTo'](db['MailAccount'],{'as':_0x7f11('0x41'),'foreignKey':_0x7f11('0x16b')});db[_0x7f11('0x64')][_0x7f11('0x12e')](db[_0x7f11('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0x7f11('0x195')});db[_0x7f11('0x64')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x161'),'through':_0x7f11('0x196')});db[_0x7f11('0x197')]['belongsTo'](db['OpenchannelAccount'],{});db[_0x7f11('0x197')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':'List','foreignKey':'ListId'});db[_0x7f11('0x197')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':'Contact','foreignKey':_0x7f11('0x16a')});db[_0x7f11('0x197')][_0x7f11('0x12e')](db[_0x7f11('0x124')],{});db[_0x7f11('0x197')][_0x7f11('0x12e')](db[_0x7f11('0x61')],{});db[_0x7f11('0x197')][_0x7f11('0x12e')](db['User'],{});db[_0x7f11('0x197')][_0x7f11('0x12e')](db['OpenchannelQueue'],{});db['ChatApplication'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x198'),'foreignKey':_0x7f11('0x11a'),'onDelete':'restrict'});db[_0x7f11('0x67')][_0x7f11('0x12e')](db[_0x7f11('0x6f')],{'as':'Queue','foreignKey':_0x7f11('0x199'),'onDelete':'restrict'});db[_0x7f11('0x67')][_0x7f11('0x12e')](db['ChatWebsite'],{'as':'Website','foreignKey':_0x7f11('0x17e'),'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x67')][_0x7f11('0x12e')](db[_0x7f11('0x90')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x7f11('0x69')][_0x7f11('0x11d')](db[_0x7f11('0x6b')],{'as':_0x7f11('0x176'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x19a')});db[_0x7f11('0x69')][_0x7f11('0x12e')](db[_0x7f11('0x64')],{'as':_0x7f11('0x186'),'foreignKey':_0x7f11('0x17e')});db['ChatInteraction'][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':'ContactId'});db['ChatInteraction'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x178'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x69')][_0x7f11('0x130')](db[_0x7f11('0x90')],{'through':'chat_interaction_has_tags','as':_0x7f11('0x184')});db[_0x7f11('0x69')][_0x7f11('0x130')](db[_0x7f11('0x90')],{'through':_0x7f11('0x19b'),'as':'ThroughTags'});db[_0x7f11('0x69')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x17b'),'through':_0x7f11('0x19c'),'foreignKey':_0x7f11('0x19a')});db['ChatMessage'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'onDelete':_0x7f11('0x119'),'as':_0x7f11('0x12')});db[_0x7f11('0x6b')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'onDelete':_0x7f11('0x119'),'as':_0x7f11('0x169'),'foreignKey':'ContactId'});db[_0x7f11('0x6b')][_0x7f11('0x12e')](db['ChatInteraction'],{'onDelete':_0x7f11('0x119'),'as':_0x7f11('0x17d'),'foreignKey':'ChatInteractionId'});db[_0x7f11('0x6b')][_0x7f11('0x12e')](db[_0x7f11('0x17c')],{'as':_0x7f11('0x17c'),'foreignKey':_0x7f11('0x192')});db[_0x7f11('0x6b')][_0x7f11('0x12e')](db[_0x7f11('0x64')],{'as':_0x7f11('0x186'),'foreignKey':_0x7f11('0x17e')});db['ChatOfflineMessage'][_0x7f11('0x11d')](db[_0x7f11('0x17c')],{'as':_0x7f11('0x19d'),'foreignKey':_0x7f11('0x19e'),'onDelete':'cascade','hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db[_0x7f11('0x76')],{'onDelete':'cascade','as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db['ChatOfflineMessage']['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0x7f11('0x17e')});db[_0x7f11('0x6f')]['belongsToMany'](db[_0x7f11('0x12')],{'as':_0x7f11('0x161'),'through':_0x7f11('0x143'),'hooks':!![]});db[_0x7f11('0x6f')][_0x7f11('0x130')](db[_0x7f11('0xed')],{'through':_0x7f11('0x19f'),'as':'Teams'});db[_0x7f11('0x71')][_0x7f11('0x11d')](db[_0x7f11('0x1a0')],{'as':_0x7f11('0x176'),'foreignKey':_0x7f11('0x1a1'),'onDelete':_0x7f11('0x119')});db['ChatGroup'][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':'Members','through':'chat_group_has_users'});db['ChatProactiveAction']['belongsTo'](db[_0x7f11('0x64')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0x7f11('0x75')][_0x7f11('0x11d')](db['CmContact'],{'as':'Contacts','foreignKey':_0x7f11('0x1a2')});db[_0x7f11('0x76')][_0x7f11('0x11d')](db['CmContactHasItem'],{'as':_0x7f11('0x1a3'),'foreignKey':'CmContactId'});db['CmContact']['hasMany'](db['CmHopper'],{'as':_0x7f11('0x12c'),'foreignKey':'ContactId'});db[_0x7f11('0x76')][_0x7f11('0x11d')](db[_0x7f11('0x121')],{'as':'HopperFinals','foreignKey':_0x7f11('0x16a')});db[_0x7f11('0x76')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'ContactId'});db['CmContact'][_0x7f11('0x11d')](db[_0x7f11('0x7e')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0x7f11('0x76')][_0x7f11('0x11d')](db[_0x7f11('0xda')],{'as':'JscriptySessions','foreignKey':'ContactId'});db['CmContact'][_0x7f11('0x11d')](db[_0x7f11('0x124')],{'as':_0x7f11('0x13b'),'foreignKey':'ContactId','onDelete':_0x7f11('0x16d')});db['CmContact'][_0x7f11('0x11d')](db[_0x7f11('0x69')],{'as':_0x7f11('0x125'),'foreignKey':_0x7f11('0x16a'),'onDelete':_0x7f11('0x16d')});db['CmContact'][_0x7f11('0x11d')](db[_0x7f11('0x58')],{'as':_0x7f11('0x126'),'foreignKey':_0x7f11('0x16a'),'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x76')]['hasMany'](db['FaxInteraction'],{'as':_0x7f11('0x127'),'foreignKey':_0x7f11('0x16a'),'onDelete':_0x7f11('0x16d')});db['CmContact']['hasMany'](db[_0x7f11('0x128')],{'as':_0x7f11('0x129'),'foreignKey':_0x7f11('0x16a'),'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x76')][_0x7f11('0x12e')](db[_0x7f11('0x75')],{'as':_0x7f11('0x1a4'),'foreignKey':_0x7f11('0x1a2')});db['CmContact'][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':'List','foreignKey':_0x7f11('0x173'),'onDelete':_0x7f11('0x119')});db['CmContact'][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x17b'),'through':_0x7f11('0x1a5')});db[_0x7f11('0x76')][_0x7f11('0x130')](db[_0x7f11('0x90')],{'as':_0x7f11('0x184'),'through':_0x7f11('0x1a6')});db[_0x7f11('0x76')][_0x7f11('0x130')](db[_0x7f11('0x90')],{'through':'cm_contact_has_tags','as':_0x7f11('0x17a')});db[_0x7f11('0x78')][_0x7f11('0x11d')](db[_0x7f11('0x1a7')],{'as':_0x7f11('0x1a8'),'foreignKey':_0x7f11('0x1a9')});db['CmHopper']['belongsTo'](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a'),'onDelete':_0x7f11('0x119')});db['CmHopper'][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0x78')][_0x7f11('0x12e')](db['User'],{'as':_0x7f11('0x198'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x78')][_0x7f11('0x12e')](db[_0x7f11('0x1c')],{'as':_0x7f11('0x1aa'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x7f11('0x78')][_0x7f11('0x12e')](db['Campaign'],{'as':_0x7f11('0xf1'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0x7f11('0x78')]['belongsTo'](db[_0x7f11('0x12')],{'as':_0x7f11('0x178'),'foreignKey':_0x7f11('0x1ab')});db['CmHopperBlack'][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':'ContactId','onDelete':_0x7f11('0x119')});db[_0x7f11('0x7a')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':'List','foreignKey':_0x7f11('0x173'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0x7a')][_0x7f11('0x12e')](db[_0x7f11('0x1c')],{'as':_0x7f11('0x1aa'),'foreignKey':'VoiceQueueId','onDelete':_0x7f11('0x119')});db[_0x7f11('0x7a')]['belongsTo'](db[_0x7f11('0xf1')],{'as':_0x7f11('0xf1'),'foreignKey':_0x7f11('0x1ac'),'onDelete':_0x7f11('0x119')});db['Automation'][_0x7f11('0x11d')](db[_0x7f11('0x1ad')],{'as':{'plural':_0x7f11('0x1ae'),'singular':_0x7f11('0x1af')},'foreignKey':_0x7f11('0x1b0'),'onDelete':_0x7f11('0x119'),'hooks':!![]});db[_0x7f11('0x82')][_0x7f11('0x11d')](db[_0x7f11('0x1ad')],{'as':{'plural':_0x7f11('0x1b1'),'singular':_0x7f11('0x1b2')},'foreignKey':_0x7f11('0x1b3'),'onDelete':_0x7f11('0x119'),'hooks':!![]});db['Automation'][_0x7f11('0x11d')](db[_0x7f11('0x81')],{'as':_0x7f11('0x1b4'),'foreignKey':_0x7f11('0x1b5'),'onDelete':_0x7f11('0x119'),'hooks':!![]});db[_0x7f11('0x86')][_0x7f11('0x11d')](db[_0x7f11('0x86')],{'as':_0x7f11('0x183'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0x7f11('0x88')]['hasMany'](db['Interval'],{'as':_0x7f11('0x1b6'),'foreignKey':'IntervalId','onDelete':_0x7f11('0x119'),'hooks':!![],'required':![]});db['Interval'][_0x7f11('0x11d')](db['VoiceExtension'],{'as':_0x7f11('0x120'),'foreignKey':_0x7f11('0x18b'),'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x88')][_0x7f11('0x11d')](db[_0x7f11('0x17f')],{'as':_0x7f11('0x1b7'),'foreignKey':_0x7f11('0x18b')});db[_0x7f11('0x88')]['hasMany'](db[_0x7f11('0x67')],{'as':'ChatApplications','foreignKey':_0x7f11('0x18b')});db[_0x7f11('0x88')][_0x7f11('0x11d')](db[_0x7f11('0x4f')],{'as':'FaxApplications','foreignKey':_0x7f11('0x18b')});db['Interval'][_0x7f11('0x11d')](db[_0x7f11('0x56')],{'as':_0x7f11('0x1b8'),'foreignKey':_0x7f11('0x18b')});db[_0x7f11('0x1b9')]['belongsTo'](db[_0x7f11('0x41')],{});db[_0x7f11('0x1b9')][_0x7f11('0x12e')](db[_0x7f11('0xa1')],{'foreignKey':_0x7f11('0x1ba')});db[_0x7f11('0x1b9')][_0x7f11('0x12e')](db[_0x7f11('0x9f')],{'foreignKey':_0x7f11('0x1bb')});db['Sound']['belongsToMany'](db[_0x7f11('0x1a')],{'as':_0x7f11('0x1bc'),'through':_0x7f11('0x157'),'onDelete':_0x7f11('0x16d')});db['Tag'][_0x7f11('0x130')](db[_0x7f11('0x76')],{'through':_0x7f11('0x1a6')});db[_0x7f11('0x90')][_0x7f11('0x130')](db[_0x7f11('0x69')],{'through':_0x7f11('0x19b')});db['Tag']['belongsToMany'](db[_0x7f11('0x128')],{'through':'mail_interaction_has_tags'});db[_0x7f11('0x90')][_0x7f11('0x130')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db['Tag']['belongsToMany'](db['FaxInteraction'],{'through':_0x7f11('0x1bd')});db[_0x7f11('0x90')][_0x7f11('0x130')](db[_0x7f11('0x124')],{'through':_0x7f11('0x1be')});db[_0x7f11('0x90')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0x7f11('0x1bf')});db['CmContactHasItem'][_0x7f11('0x12e')](db[_0x7f11('0x92')],{'as':_0x7f11('0x1c0'),'foreignKey':_0x7f11('0x1c1')});db[_0x7f11('0x1a7')]['belongsTo'](db['CmHopper'],{'as':'Hopper','foreignKey':_0x7f11('0x1a9')});db[_0x7f11('0x94')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x1c2')});db['Trigger']['hasMany'](db[_0x7f11('0x1ad')],{'as':{'plural':_0x7f11('0x1c3'),'singular':_0x7f11('0x1c4')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db[_0x7f11('0x99')][_0x7f11('0x11d')](db[_0x7f11('0x1ad')],{'as':{'plural':_0x7f11('0x1c5'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':_0x7f11('0x119'),'hooks':!![]});db['Trigger'][_0x7f11('0x11d')](db[_0x7f11('0x81')],{'as':_0x7f11('0x1b4'),'foreignKey':_0x7f11('0x1c6'),'onDelete':_0x7f11('0x119'),'hooks':!![]});db['AnalyticCustomReport'][_0x7f11('0x11d')](db[_0x7f11('0xa4')],{'as':'Fields','onDelete':_0x7f11('0x119'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x7f11('0xa1')]['hasMany'](db[_0x7f11('0xa4')],{'as':_0x7f11('0x1c7'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1ba')});db[_0x7f11('0x1c8')][_0x7f11('0x11d')](db[_0x7f11('0xa4')],{'as':'Fields','onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1c9')});db['AnalyticFieldReport'][_0x7f11('0x12e')](db[_0x7f11('0x1c8')],{'foreignKey':'MetricId'});db[_0x7f11('0xa5')][_0x7f11('0x11d')](db[_0x7f11('0xa6')],{'as':_0x7f11('0x1ca'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xa6')]['hasMany'](db[_0x7f11('0xa8')],{'as':'Subjects','onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cc')});db['SalesforceConfiguration'][_0x7f11('0x11d')](db[_0x7f11('0xa8')],{'as':_0x7f11('0x1cd'),'onDelete':'cascade','foreignKey':_0x7f11('0x1ce')});db['SalesforceConfiguration'][_0x7f11('0x11d')](db[_0x7f11('0xa8')],{'as':_0x7f11('0x1c7'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xa6')][_0x7f11('0x12e')](db['SalesforceAccount'],{'as':_0x7f11('0x186'),'foreignKey':'AccountId'});db[_0x7f11('0xa8')][_0x7f11('0x11d')](db['SalesforceField'],{'as':_0x7f11('0x1d0'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xa8')]['hasMany'](db[_0x7f11('0xa8')],{'as':'Description','foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xa8')]['hasMany'](db[_0x7f11('0xa8')],{'as':_0x7f11('0x1d1'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xa8')][_0x7f11('0x12e')](db[_0x7f11('0x9b')],{'as':_0x7f11('0x9b'),'foreignKey':_0x7f11('0x1d2')});db[_0x7f11('0x1d3')][_0x7f11('0x11d')](db[_0x7f11('0xaa')],{'as':_0x7f11('0x1ca'),'onDelete':_0x7f11('0x119'),'foreignKey':'AccountId'});db[_0x7f11('0xaa')][_0x7f11('0x11d')](db[_0x7f11('0xac')],{'as':_0x7f11('0x1d4'),'onDelete':_0x7f11('0x119'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration'][_0x7f11('0x11d')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xaa')][_0x7f11('0x11d')](db['SugarcrmField'],{'as':'Fields','onDelete':_0x7f11('0x119'),'foreignKey':'FieldId'});db[_0x7f11('0xaa')][_0x7f11('0x12e')](db[_0x7f11('0x1d3')],{'as':_0x7f11('0x186'),'foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xac')][_0x7f11('0x11d')](db[_0x7f11('0xac')],{'as':_0x7f11('0x1d0'),'foreignKey':'SubjectId'});db[_0x7f11('0xac')][_0x7f11('0x11d')](db[_0x7f11('0xac')],{'as':_0x7f11('0x1d5'),'foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xac')][_0x7f11('0x11d')](db['SugarcrmField'],{'as':_0x7f11('0x1d1'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xac')][_0x7f11('0x12e')](db[_0x7f11('0x9b')],{'as':_0x7f11('0x9b'),'foreignKey':_0x7f11('0x1d2')});db[_0x7f11('0x1d6')][_0x7f11('0x11d')](db['DeskConfiguration'],{'as':_0x7f11('0x1ca'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xaf')]['hasMany'](db[_0x7f11('0xb1')],{'as':_0x7f11('0x1d4'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xaf')][_0x7f11('0x11d')](db['DeskField'],{'as':_0x7f11('0x1cd'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1ce')});db['DeskConfiguration']['hasMany'](db[_0x7f11('0xb1')],{'as':_0x7f11('0x1c7'),'onDelete':_0x7f11('0x119'),'foreignKey':'FieldId'});db[_0x7f11('0xaf')][_0x7f11('0x12e')](db[_0x7f11('0x1d6')],{'as':'Account','foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xaf')][_0x7f11('0x130')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0x7f11('0xb1')][_0x7f11('0x11d')](db[_0x7f11('0xb1')],{'as':_0x7f11('0x1d0'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xb1')][_0x7f11('0x11d')](db[_0x7f11('0xb1')],{'as':_0x7f11('0x1d5'),'foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xb1')]['hasMany'](db[_0x7f11('0xb1')],{'as':'Field','foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xb1')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['ZohoAccount'][_0x7f11('0x11d')](db[_0x7f11('0xb5')],{'as':_0x7f11('0x1ca'),'onDelete':_0x7f11('0x119'),'foreignKey':'AccountId'});db['ZohoConfiguration']['hasMany'](db[_0x7f11('0x1d7')],{'as':_0x7f11('0x1d4'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xb5')][_0x7f11('0x11d')](db[_0x7f11('0x1d7')],{'as':_0x7f11('0x1cd'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xb5')][_0x7f11('0x11d')](db[_0x7f11('0x1d7')],{'as':_0x7f11('0x1c7'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xb5')]['belongsTo'](db[_0x7f11('0xb3')],{'as':'Account','foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0x1d7')][_0x7f11('0x11d')](db[_0x7f11('0x1d7')],{'as':_0x7f11('0x1d0'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0x1d7')][_0x7f11('0x11d')](db[_0x7f11('0x1d7')],{'as':_0x7f11('0x1d5'),'foreignKey':'DescriptionId'});db['ZohoField'][_0x7f11('0x11d')](db[_0x7f11('0x1d7')],{'as':'Field','foreignKey':'FieldId'});db[_0x7f11('0x1d7')]['belongsTo'](db['Variable'],{'as':_0x7f11('0x9b'),'foreignKey':_0x7f11('0x1d2')});db[_0x7f11('0xb7')][_0x7f11('0x11d')](db[_0x7f11('0xb9')],{'as':_0x7f11('0x1ca'),'onDelete':'cascade','foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xb9')][_0x7f11('0x11d')](db[_0x7f11('0x1d8')],{'as':_0x7f11('0x1d4'),'foreignKey':'SubjectId'});db[_0x7f11('0xb9')][_0x7f11('0x11d')](db['ZendeskField'],{'as':_0x7f11('0x1cd'),'foreignKey':'DescriptionId'});db[_0x7f11('0xb9')][_0x7f11('0x11d')](db['ZendeskField'],{'as':_0x7f11('0x1c7'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xb9')]['belongsTo'](db[_0x7f11('0xb7')],{'as':_0x7f11('0x186'),'foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xb9')]['belongsToMany'](db[_0x7f11('0x90')],{'through':_0x7f11('0x1d9')});db['ZendeskField']['hasMany'](db[_0x7f11('0x1d8')],{'as':_0x7f11('0x1d0'),'foreignKey':_0x7f11('0x1cc')});db['ZendeskField']['hasMany'](db[_0x7f11('0x1d8')],{'as':_0x7f11('0x1d5'),'foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0x1d8')]['hasMany'](db['ZendeskField'],{'as':_0x7f11('0x1d1'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0x1d8')][_0x7f11('0x12e')](db[_0x7f11('0x9b')],{'as':_0x7f11('0x9b'),'foreignKey':_0x7f11('0x1d2')});db[_0x7f11('0x1da')][_0x7f11('0x11d')](db[_0x7f11('0xbc')],{'as':_0x7f11('0x1ca'),'onDelete':'cascade','foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xbc')][_0x7f11('0x11d')](db[_0x7f11('0xbe')],{'as':'Subjects','onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cc')});db['FreshdeskConfiguration']['hasMany'](db[_0x7f11('0xbe')],{'as':_0x7f11('0x1cd'),'onDelete':'cascade','foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xbc')][_0x7f11('0x11d')](db[_0x7f11('0xbe')],{'as':_0x7f11('0x1c7'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xbc')]['belongsTo'](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xbc')][_0x7f11('0x130')](db[_0x7f11('0x90')],{'through':_0x7f11('0x1db')});db[_0x7f11('0xbe')][_0x7f11('0x11d')](db[_0x7f11('0xbe')],{'as':_0x7f11('0x1d0'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xbe')]['hasMany'](db['FreshdeskField'],{'as':_0x7f11('0x1d5'),'foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xbe')][_0x7f11('0x11d')](db[_0x7f11('0xbe')],{'as':_0x7f11('0x1d1'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xbe')][_0x7f11('0x12e')](db['Variable'],{'as':_0x7f11('0x9b'),'foreignKey':_0x7f11('0x1d2')});db[_0x7f11('0x1dc')][_0x7f11('0x11d')](db[_0x7f11('0xc0')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db['VtigerConfiguration'][_0x7f11('0x11d')](db['VtigerField'],{'as':_0x7f11('0x1d4'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xc0')]['hasMany'](db[_0x7f11('0x1dd')],{'as':_0x7f11('0x1cd'),'foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xc0')][_0x7f11('0x11d')](db[_0x7f11('0x1dd')],{'as':_0x7f11('0x1c7'),'foreignKey':_0x7f11('0x1cf')});db['VtigerConfiguration']['belongsTo'](db[_0x7f11('0x1dc')],{'as':'Account','foreignKey':'AccountId'});db[_0x7f11('0x1dd')][_0x7f11('0x11d')](db[_0x7f11('0x1dd')],{'as':_0x7f11('0x1d0'),'foreignKey':'SubjectId'});db[_0x7f11('0x1dd')][_0x7f11('0x11d')](db[_0x7f11('0x1dd')],{'as':'Description','foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0x1dd')][_0x7f11('0x11d')](db[_0x7f11('0x1dd')],{'as':'Field','foreignKey':'FieldId'});db[_0x7f11('0x1dd')]['belongsTo'](db[_0x7f11('0x9b')],{'as':_0x7f11('0x9b'),'foreignKey':_0x7f11('0x1d2')});db[_0x7f11('0xc3')]['hasMany'](db[_0x7f11('0xc5')],{'as':_0x7f11('0x1ca'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cb')});db['ServicenowConfiguration'][_0x7f11('0x11d')](db['ServicenowField'],{'as':_0x7f11('0x1d4'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xc5')]['hasMany'](db[_0x7f11('0xc7')],{'as':_0x7f11('0x1cd'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0x7f11('0x11d')](db[_0x7f11('0xc7')],{'as':_0x7f11('0x1c7'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xc5')]['belongsTo'](db[_0x7f11('0xc3')],{'as':'Account','foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0xc7')][_0x7f11('0x11d')](db[_0x7f11('0xc7')],{'as':_0x7f11('0x1d0'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xc7')][_0x7f11('0x11d')](db[_0x7f11('0xc7')],{'as':_0x7f11('0x1d5'),'foreignKey':_0x7f11('0x1ce')});db['ServicenowField'][_0x7f11('0x11d')](db[_0x7f11('0xc7')],{'as':_0x7f11('0x1d1'),'foreignKey':'FieldId'});db[_0x7f11('0xc7')][_0x7f11('0x12e')](db[_0x7f11('0x9b')],{'as':'Variable','foreignKey':_0x7f11('0x1d2')});db[_0x7f11('0xc9')][_0x7f11('0x11d')](db[_0x7f11('0xcb')],{'as':_0x7f11('0x1ca'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x7f11('0xc9')][_0x7f11('0x12e')](db['CloudProvider'],{'as':_0x7f11('0x111'),'foreignKey':_0x7f11('0x16c')});db['Dynamics365Configuration']['hasMany'](db[_0x7f11('0xcd')],{'as':'Subjects','onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xcb')][_0x7f11('0x11d')](db[_0x7f11('0xcd')],{'as':_0x7f11('0x1cd'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x7f11('0xcb')][_0x7f11('0x11d')](db[_0x7f11('0xcd')],{'as':_0x7f11('0x1c7'),'onDelete':_0x7f11('0x119'),'foreignKey':'FieldId'});db[_0x7f11('0xcb')][_0x7f11('0x12e')](db[_0x7f11('0xc9')],{'as':_0x7f11('0x186'),'foreignKey':'AccountId'});db[_0x7f11('0xcd')]['hasMany'](db['Dynamics365Field'],{'as':_0x7f11('0x1d0'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xcd')]['hasMany'](db['Dynamics365Field'],{'as':_0x7f11('0x1d5'),'foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xcd')][_0x7f11('0x11d')](db[_0x7f11('0xcd')],{'as':_0x7f11('0x1d1'),'foreignKey':_0x7f11('0x1cf')});db['Dynamics365Field']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x7f11('0x1d2')});db['FreshsalesAccount'][_0x7f11('0x11d')](db[_0x7f11('0xd1')],{'as':_0x7f11('0x1ca'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x1cb')});db['FreshsalesConfiguration'][_0x7f11('0x11d')](db[_0x7f11('0x1de')],{'as':_0x7f11('0x1d4'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0xd1')][_0x7f11('0x11d')](db[_0x7f11('0x1de')],{'as':'Descriptions','foreignKey':_0x7f11('0x1ce')});db[_0x7f11('0xd1')]['hasMany'](db[_0x7f11('0x1de')],{'as':_0x7f11('0x1c7'),'foreignKey':_0x7f11('0x1cf')});db[_0x7f11('0xd1')][_0x7f11('0x12e')](db[_0x7f11('0xcf')],{'as':_0x7f11('0x186'),'foreignKey':_0x7f11('0x1cb')});db[_0x7f11('0x1de')][_0x7f11('0x11d')](db[_0x7f11('0x1de')],{'as':_0x7f11('0x1d0'),'foreignKey':_0x7f11('0x1cc')});db[_0x7f11('0x1de')]['hasMany'](db[_0x7f11('0x1de')],{'as':_0x7f11('0x1d5'),'foreignKey':'DescriptionId'});db['FreshsalesField'][_0x7f11('0x11d')](db[_0x7f11('0x1de')],{'as':'Field','foreignKey':_0x7f11('0x1cf')});db['FreshsalesField'][_0x7f11('0x12e')](db[_0x7f11('0x9b')],{'as':_0x7f11('0x9b'),'foreignKey':'VariableId'});db['ChatQueueReport'][_0x7f11('0x12e')](db[_0x7f11('0x64')],{});db[_0x7f11('0xd5')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0xd5')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':'ContactId'});db['ChatQueueReport']['belongsTo'](db[_0x7f11('0x69')],{});db['ChatQueueReport'][_0x7f11('0x12e')](db['ChatMessage'],{});db[_0x7f11('0xd5')]['belongsTo'](db[_0x7f11('0x12')],{});db[_0x7f11('0xd5')][_0x7f11('0x12e')](db[_0x7f11('0x6f')],{});db[_0x7f11('0x1a0')][_0x7f11('0x12e')](db['User'],{'onDelete':_0x7f11('0x119'),'foreignKey':'FromId'});db[_0x7f11('0x1a0')]['belongsTo'](db[_0x7f11('0x12')],{'onDelete':'cascade','foreignKey':'ToId'});db['JscriptySessionReport'][_0x7f11('0x11d')](db[_0x7f11('0xd8')],{'foreignKey':_0x7f11('0x1df'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0xda')]['hasMany'](db[_0x7f11('0x1e0')],{'foreignKey':_0x7f11('0x1df'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0xdc')][_0x7f11('0x12e')](db['SmsAccount'],{});db[_0x7f11('0xdc')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0xdc')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db['SmsQueueReport'][_0x7f11('0x12e')](db[_0x7f11('0x58')],{});db['SmsQueueReport'][_0x7f11('0x12e')](db[_0x7f11('0x5a')],{});db[_0x7f11('0xdc')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{});db[_0x7f11('0xdc')][_0x7f11('0x12e')](db[_0x7f11('0x5c')],{});db['JscriptyProject']['hasMany'](db[_0x7f11('0xda')],{'foreignKey':'ProjectId'});db[_0x7f11('0xe1')]['hasMany'](db[_0x7f11('0xd8')],{'foreignKey':_0x7f11('0x1e1')});db[_0x7f11('0xe1')]['hasMany'](db[_0x7f11('0x1e0')],{'foreignKey':_0x7f11('0x1e1')});db[_0x7f11('0xed')]['belongsToMany'](db[_0x7f11('0x12')],{'as':'Agents','through':_0x7f11('0x137')});db[_0x7f11('0xed')][_0x7f11('0x130')](db[_0x7f11('0x1c')],{'through':_0x7f11('0x112'),'as':_0x7f11('0x13e')});db[_0x7f11('0xed')]['belongsToMany'](db[_0x7f11('0x140')],{'through':_0x7f11('0x174'),'as':_0x7f11('0x141')});db[_0x7f11('0xed')][_0x7f11('0x130')](db[_0x7f11('0x6f')],{'through':_0x7f11('0x19f'),'as':_0x7f11('0x142')});db[_0x7f11('0xed')]['belongsToMany'](db[_0x7f11('0x144')],{'through':_0x7f11('0x187'),'as':_0x7f11('0x145')});db[_0x7f11('0xed')]['belongsToMany'](db[_0x7f11('0x5c')],{'through':_0x7f11('0x1e2'),'as':_0x7f11('0x146')});db['Team'][_0x7f11('0x130')](db[_0x7f11('0x147')],{'through':_0x7f11('0x193'),'as':_0x7f11('0x148')});db['Team'][_0x7f11('0x130')](db[_0x7f11('0x10f')],{'through':_0x7f11('0x1e3'),'as':_0x7f11('0x149')});db[_0x7f11('0xed')][_0x7f11('0x130')](db[_0x7f11('0xfe')],{'through':'TeamVoicePrefix','as':_0x7f11('0x13f')});db[_0x7f11('0xf1')][_0x7f11('0x11d')](db['CmHopper'],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0x7f11('0xf1')][_0x7f11('0x11d')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'CampaignId'});db['Campaign'][_0x7f11('0x11d')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0x7f11('0xf1')][_0x7f11('0x11d')](db[_0x7f11('0x7a')],{'as':_0x7f11('0x15a'),'foreignKey':'CampaignId'});db[_0x7f11('0xf1')][_0x7f11('0x12e')](db[_0x7f11('0x2d')],{'as':_0x7f11('0x2d'),'foreignKey':_0x7f11('0x15c')});db['Campaign'][_0x7f11('0x12e')](db[_0x7f11('0x2d')],{'as':_0x7f11('0x15d'),'foreignKey':_0x7f11('0x15e')});db[_0x7f11('0xf1')][_0x7f11('0x12e')](db['Interval'],{'as':_0x7f11('0x88'),'foreignKey':_0x7f11('0x18b')});db['Campaign'][_0x7f11('0x12e')](db[_0x7f11('0xe7')],{'as':_0x7f11('0xe7'),'foreignKey':_0x7f11('0x1e4')});db['Campaign'][_0x7f11('0x130')](db[_0x7f11('0x134')],{'as':'Lists','through':_0x7f11('0x1e5')});db[_0x7f11('0xf1')][_0x7f11('0x130')](db[_0x7f11('0x134')],{'as':_0x7f11('0x162'),'through':_0x7f11('0x1e6')});db[_0x7f11('0x17c')][_0x7f11('0x12e')](db[_0x7f11('0x6d')],{'as':_0x7f11('0x6d'),'foreignKey':_0x7f11('0x19e')});db[_0x7f11('0xf8')]['belongsTo'](db[_0x7f11('0x47')],{});db[_0x7f11('0xf8')][_0x7f11('0x12e')](db[_0x7f11('0x128')],{});db[_0x7f11('0xf8')][_0x7f11('0x12e')](db[_0x7f11('0x41')],{'foreignKey':_0x7f11('0x1e7'),'as':'FromAccount'});db[_0x7f11('0xf8')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'foreignKey':_0x7f11('0x1e8'),'as':_0x7f11('0x1e9')});db[_0x7f11('0xf8')][_0x7f11('0x12e')](db['User'],{'foreignKey':_0x7f11('0x1ea'),'as':'ToAgent'});db[_0x7f11('0xf8')]['belongsTo'](db[_0x7f11('0x140')],{'foreignKey':'ToMailQueueId','as':_0x7f11('0x1eb')});db[_0x7f11('0xf8')]['belongsTo'](db[_0x7f11('0x41')],{'foreignKey':_0x7f11('0x1ec'),'as':'ToAccount'});db[_0x7f11('0xf9')][_0x7f11('0x12e')](db['ChatMessage'],{});db[_0x7f11('0xf9')][_0x7f11('0x12e')](db['ChatInteraction'],{});db[_0x7f11('0xf9')][_0x7f11('0x12e')](db[_0x7f11('0x64')],{'foreignKey':'FromChatWebsiteId','as':_0x7f11('0x1ed')});db[_0x7f11('0xf9')]['belongsTo'](db[_0x7f11('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x7f11('0xf9')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'foreignKey':'ToUserId','as':_0x7f11('0x1ee')});db[_0x7f11('0xf9')][_0x7f11('0x12e')](db[_0x7f11('0x6f')],{'foreignKey':_0x7f11('0x1ef'),'as':_0x7f11('0x1eb')});db[_0x7f11('0xf9')]['belongsTo'](db[_0x7f11('0x64')],{'foreignKey':_0x7f11('0x1f0'),'as':_0x7f11('0x1f1')});db[_0x7f11('0x1f2')][_0x7f11('0x12e')](db['FaxMessage'],{});db['FaxTransferReport']['belongsTo'](db['FaxInteraction'],{});db['FaxTransferReport']['belongsTo'](db[_0x7f11('0x4d')],{'foreignKey':_0x7f11('0x1f3'),'as':_0x7f11('0x1ed')});db[_0x7f11('0x1f2')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'foreignKey':_0x7f11('0x1e8'),'as':'FromAgent'});db[_0x7f11('0x1f2')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'foreignKey':'ToUserId','as':_0x7f11('0x1ee')});db['FaxTransferReport'][_0x7f11('0x12e')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0x7f11('0x1eb')});db[_0x7f11('0x1f2')][_0x7f11('0x12e')](db[_0x7f11('0x4d')],{'foreignKey':_0x7f11('0x1f4'),'as':'ToAccount'});db[_0x7f11('0xfa')][_0x7f11('0x12e')](db[_0x7f11('0x61')],{});db[_0x7f11('0xfa')][_0x7f11('0x12e')](db[_0x7f11('0x124')],{});db[_0x7f11('0xfa')]['belongsTo'](db[_0x7f11('0x5e')],{'foreignKey':_0x7f11('0x1f5'),'as':'FromAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0x7f11('0x12')],{'foreignKey':_0x7f11('0x1e8'),'as':'FromAgent'});db['OpenchannelTransferReport'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'foreignKey':_0x7f11('0x1ea'),'as':_0x7f11('0x1ee')});db[_0x7f11('0xfa')][_0x7f11('0x12e')](db[_0x7f11('0x147')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x7f11('0xfa')][_0x7f11('0x12e')](db[_0x7f11('0x5e')],{'foreignKey':_0x7f11('0x1f6'),'as':_0x7f11('0x1f1')});db[_0x7f11('0xfc')]['belongsTo'](db[_0x7f11('0x5a')],{});db[_0x7f11('0xfc')][_0x7f11('0x12e')](db[_0x7f11('0x58')],{});db[_0x7f11('0xfc')][_0x7f11('0x12e')](db['SmsAccount'],{'foreignKey':_0x7f11('0x1f7'),'as':_0x7f11('0x1ed')});db[_0x7f11('0xfc')][_0x7f11('0x12e')](db['User'],{'foreignKey':_0x7f11('0x1e8'),'as':_0x7f11('0x1e9')});db[_0x7f11('0xfc')]['belongsTo'](db[_0x7f11('0x12')],{'foreignKey':_0x7f11('0x1ea'),'as':_0x7f11('0x1ee')});db[_0x7f11('0xfc')]['belongsTo'](db['SmsQueue'],{'foreignKey':_0x7f11('0x1f8'),'as':'ToQueue'});db[_0x7f11('0xfc')][_0x7f11('0x12e')](db[_0x7f11('0x150')],{'foreignKey':_0x7f11('0x1f9'),'as':'ToAccount'});db[_0x7f11('0x134')][_0x7f11('0x11d')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x7f11('0x173'),'onDelete':_0x7f11('0x119')});db['CmList'][_0x7f11('0x11d')](db[_0x7f11('0x1fa')],{'as':'CustomFields','foreignKey':_0x7f11('0x173')});db['CmList']['hasMany'](db[_0x7f11('0x76')],{'as':_0x7f11('0x133'),'onDelete':'cascade','foreignKey':_0x7f11('0x173')});db[_0x7f11('0x134')][_0x7f11('0x11d')](db[_0x7f11('0x121')],{'as':_0x7f11('0x122'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0x134')][_0x7f11('0x11d')](db[_0x7f11('0x7d')],{'as':_0x7f11('0x123'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0x134')][_0x7f11('0x11d')](db[_0x7f11('0x7e')],{'as':'ReportAgentPreview','foreignKey':_0x7f11('0x173')});db[_0x7f11('0x134')][_0x7f11('0x130')](db[_0x7f11('0x1c')],{'as':'Queues','through':_0x7f11('0x160')});db[_0x7f11('0x134')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':'Agents','through':_0x7f11('0x136')});db[_0x7f11('0xfe')][_0x7f11('0x11d')](db[_0x7f11('0x19')],{'as':_0x7f11('0x120'),'onDelete':_0x7f11('0x119')});db['VoicePrefix'][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x161'),'through':_0x7f11('0x115')});db[_0x7f11('0xfe')][_0x7f11('0x130')](db[_0x7f11('0xed')],{'through':_0x7f11('0x113'),'as':'Teams'});db['UserProfile']['hasMany'](db[_0x7f11('0x12')],{'as':_0x7f11('0x17b'),'foreignKey':_0x7f11('0x12f')});db[_0x7f11('0xff')][_0x7f11('0x11d')](db[_0x7f11('0x1fb')],{'as':_0x7f11('0x1fc'),'foreignKey':'userProfileId','onDelete':_0x7f11('0x119')});db[_0x7f11('0x1fb')][_0x7f11('0x11d')](db['UserProfileResource'],{'as':_0x7f11('0x1fd'),'foreignKey':_0x7f11('0x1fe'),'onDelete':_0x7f11('0x119')});db[_0x7f11('0x105')]['hasMany'](db['Disposition'],{'as':_0x7f11('0x183'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0x7f11('0x105')][_0x7f11('0x11d')](db['CannedAnswer'],{'as':_0x7f11('0x170'),'foreignKey':_0x7f11('0x1ff')});db['WhatsappAccount'][_0x7f11('0x11d')](db['WhatsappMessage'],{'as':_0x7f11('0x176'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x7f11('0x11d')](db[_0x7f11('0x109')],{'as':_0x7f11('0x171')});db[_0x7f11('0x105')][_0x7f11('0x11d')](db['WhatsappApplication'],{'as':_0x7f11('0x18a'),'foreignKey':'WhatsappAccountId','onDelete':_0x7f11('0x119')});db[_0x7f11('0x105')]['belongsTo'](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':'ListId'});db[_0x7f11('0x105')][_0x7f11('0x12e')](db[_0x7f11('0x89')],{'as':_0x7f11('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7f11('0x105')][_0x7f11('0x130')](db['User'],{'as':_0x7f11('0x161'),'through':_0x7f11('0x200')});db[_0x7f11('0x107')]['belongsTo'](db[_0x7f11('0x12')],{'onDelete':_0x7f11('0x16d')});db['WhatsappApplication']['belongsTo'](db[_0x7f11('0x10f')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x7f11('0x12e')](db['WhatsappAccount'],{'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x107')]['belongsTo'](db[_0x7f11('0x88')],{'onDelete':_0x7f11('0x16d'),'foreignKey':_0x7f11('0x18b')});db[_0x7f11('0x107')][_0x7f11('0x12e')](db['Tag'],{'onDelete':_0x7f11('0x16d'),'foreignKey':_0x7f11('0x180')});db[_0x7f11('0x109')][_0x7f11('0x11d')](db['WhatsappMessage'],{'as':_0x7f11('0x176'),'onDelete':_0x7f11('0x119'),'foreignKey':_0x7f11('0x201')});db[_0x7f11('0x109')][_0x7f11('0x12e')](db[_0x7f11('0x105')],{'as':'Account','foreignKey':_0x7f11('0x1ff')});db['WhatsappInteraction'][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':'ContactId'});db[_0x7f11('0x109')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x178'),'foreignKey':_0x7f11('0x11a')});db[_0x7f11('0x109')][_0x7f11('0x130')](db['Tag'],{'through':_0x7f11('0x1bf'),'as':'Tags'});db[_0x7f11('0x109')][_0x7f11('0x130')](db[_0x7f11('0x90')],{'through':_0x7f11('0x1bf'),'as':'ThroughTags'});db[_0x7f11('0x109')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':'Users','through':_0x7f11('0x202'),'foreignKey':_0x7f11('0x201')});db[_0x7f11('0x10b')]['belongsTo'](db[_0x7f11('0x12')],{'as':_0x7f11('0x12')});db[_0x7f11('0x10b')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'onDelete':'cascade','as':'Contact'});db[_0x7f11('0x10b')][_0x7f11('0x12e')](db[_0x7f11('0x109')],{'onDelete':_0x7f11('0x119'),'as':_0x7f11('0x17d'),'foreignKey':_0x7f11('0x201')});db[_0x7f11('0x10b')][_0x7f11('0x12e')](db[_0x7f11('0x105')],{'as':_0x7f11('0x186'),'foreignKey':_0x7f11('0x1ff')});db['WhatsappQueueReport'][_0x7f11('0x12e')](db[_0x7f11('0x105')],{});db[_0x7f11('0x10d')][_0x7f11('0x12e')](db[_0x7f11('0x134')],{'as':_0x7f11('0x172'),'foreignKey':_0x7f11('0x173')});db[_0x7f11('0x10d')][_0x7f11('0x12e')](db[_0x7f11('0x76')],{'as':_0x7f11('0x169'),'foreignKey':_0x7f11('0x16a')});db['WhatsappQueueReport'][_0x7f11('0x12e')](db[_0x7f11('0x109')],{});db[_0x7f11('0x10d')][_0x7f11('0x12e')](db['WhatsappQueue'],{});db[_0x7f11('0x10d')]['belongsTo'](db[_0x7f11('0x10b')],{});db[_0x7f11('0x10d')]['belongsTo'](db[_0x7f11('0x12')],{});db[_0x7f11('0x203')][_0x7f11('0x12e')](db['WhatsappMessage'],{});db[_0x7f11('0x203')][_0x7f11('0x12e')](db[_0x7f11('0x109')],{});db['WhatsappTransferReport'][_0x7f11('0x12e')](db[_0x7f11('0x105')],{'foreignKey':_0x7f11('0x204'),'as':_0x7f11('0x1ed')});db[_0x7f11('0x203')][_0x7f11('0x12e')](db[_0x7f11('0x105')],{'foreignKey':_0x7f11('0x205'),'as':_0x7f11('0x1f1')});db['WhatsappTransferReport']['belongsTo'](db[_0x7f11('0x10f')],{'foreignKey':_0x7f11('0x206'),'as':_0x7f11('0x1eb')});db['WhatsappTransferReport'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'foreignKey':'FromUserId','as':_0x7f11('0x1e9')});db['WhatsappTransferReport'][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'foreignKey':_0x7f11('0x1ea'),'as':_0x7f11('0x1ee')});db[_0x7f11('0x10f')][_0x7f11('0x130')](db[_0x7f11('0x12')],{'as':_0x7f11('0x161'),'through':_0x7f11('0x3b'),'foreignKey':_0x7f11('0x207')});db[_0x7f11('0x10f')][_0x7f11('0x130')](db[_0x7f11('0xed')],{'through':_0x7f11('0x1e3'),'as':_0x7f11('0x175')});db[_0x7f11('0x11b')][_0x7f11('0x12e')](db[_0x7f11('0x12')],{'as':_0x7f11('0x208'),'foreignKey':_0x7f11('0x11a'),'onDelete':_0x7f11('0x119'),'hooks':!![]});db[_0x7f11('0x111')][_0x7f11('0x118')](db[_0x7f11('0xc9')],{'as':_0x7f11('0xc9'),'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x111')][_0x7f11('0x118')](db[_0x7f11('0x3d')],{'as':_0x7f11('0x16e'),'onDelete':_0x7f11('0x16d')});db[_0x7f11('0x111')][_0x7f11('0x118')](db[_0x7f11('0x3f')],{'as':_0x7f11('0x16f'),'onDelete':_0x7f11('0x16d')});module[_0x7f11('0x209')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 0d1181a..732e320 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd943=['./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','./api/pm2','./api/webbar','/api/logs','/apidoc','join','root','/www','static','/demo','/snippet','snippet','3.13.0','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','/index.html','path','express','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','then','./api/user','use','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxQueue','/api/fax/reports/queue','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsMessage','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','/api/analytics/field_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd943,0x15d));var _0x3d94=function(_0x2334be,_0xdd48cf){_0x2334be=_0x2334be-0x0;var _0x5db7cb=_0xd943[_0x2334be];return _0x5db7cb;};'use strict';var path=require(_0x3d94('0x0'));var express=require(_0x3d94('0x1'));var errors=require(_0x3d94('0x2'));var config=require(_0x3d94('0x3'));var setupLoggers=require('./utils/client-side-logger')[_0x3d94('0x4')];var clientSideLogs=require(_0x3d94('0x5'));exports[_0x3d94('0x6')]=function(_0xc13b61){return setupLoggers(_0xc13b61)[_0x3d94('0x7')](function(){_0xc13b61['use']('/api/users',require(_0x3d94('0x8')));_0xc13b61['use']('/api/voice/chanspy',require('./api/voiceChanSpy'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xa'),require('./api/voiceContext'));_0xc13b61['use'](_0x3d94('0xb'),require(_0x3d94('0xc')));_0xc13b61[_0x3d94('0x9')]('/api/voice/mohs',require(_0x3d94('0xd')));_0xc13b61['use'](_0x3d94('0xe'),require(_0x3d94('0xf')));_0xc13b61['use'](_0x3d94('0x10'),require(_0x3d94('0x11')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x12'),require(_0x3d94('0x13')));_0xc13b61['use'](_0x3d94('0x14'),require(_0x3d94('0x15')));_0xc13b61[_0x3d94('0x9')]('/api/voice/mails/messages',require(_0x3d94('0x16')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x17'),require('./api/voiceCallReport'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x18'),require(_0x3d94('0x19')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x1a'),require(_0x3d94('0x1b')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x1c'),require('./api/voiceQueueReport'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x1d'),require(_0x3d94('0x1e')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x1f'),require(_0x3d94('0x20')));_0xc13b61[_0x3d94('0x9')]('/api/voice/transfers/reports',require(_0x3d94('0x21')));_0xc13b61['use'](_0x3d94('0x22'),require(_0x3d94('0x23')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x24'),require(_0x3d94('0x25')));_0xc13b61['use']('/api/mail/queues',require(_0x3d94('0x26')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x27'),require('./api/mailSubstatus'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x28'),require(_0x3d94('0x29')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x2a'),require(_0x3d94('0x2b')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x2c'),require(_0x3d94('0x2d')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x2e'),require(_0x3d94('0x2f')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x30'),require(_0x3d94('0x31')));_0xc13b61['use'](_0x3d94('0x32'),require('./api/dashboardItem'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x33'),require(_0x3d94('0x34')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x35'),require(_0x3d94('0x36')));_0xc13b61[_0x3d94('0x9')]('/api/fax/interactions',require('./api/faxInteraction'));_0xc13b61[_0x3d94('0x9')]('/api/fax/messages',require('./api/faxMessage'));_0xc13b61[_0x3d94('0x9')]('/api/fax/queues',require(_0x3d94('0x37')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x38'),require('./api/faxQueueReport'));_0xc13b61[_0x3d94('0x9')]('/api/sms/accounts',require(_0x3d94('0x39')));_0xc13b61['use'](_0x3d94('0x3a'),require(_0x3d94('0x3b')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x3c'),require('./api/smsInteraction'));_0xc13b61[_0x3d94('0x9')]('/api/sms/messages',require(_0x3d94('0x3d')));_0xc13b61[_0x3d94('0x9')]('/api/sms/queues',require('./api/smsQueue'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x3e'),require(_0x3d94('0x3f')));_0xc13b61['use'](_0x3d94('0x40'),require(_0x3d94('0x41')));_0xc13b61['use'](_0x3d94('0x42'),require(_0x3d94('0x43')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x44'),require(_0x3d94('0x45')));_0xc13b61['use'](_0x3d94('0x46'),require(_0x3d94('0x47')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x48'),require(_0x3d94('0x49')));_0xc13b61[_0x3d94('0x9')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x4a'),require(_0x3d94('0x4b')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x4c'),require(_0x3d94('0x4d')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x4e'),require(_0x3d94('0x4f')));_0xc13b61[_0x3d94('0x9')]('/api/chat/offline_messages',require(_0x3d94('0x50')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x51'),require(_0x3d94('0x52')));_0xc13b61['use'](_0x3d94('0x53'),require(_0x3d94('0x54')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x55'),require(_0x3d94('0x56')));_0xc13b61['use'](_0x3d94('0x57'),require(_0x3d94('0x58')));_0xc13b61[_0x3d94('0x9')]('/api/cm/contacts',require('./api/cmContact'));_0xc13b61['use']('/api/cm/hopper',require(_0x3d94('0x59')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x5a'),require(_0x3d94('0x5b')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x5c'),require(_0x3d94('0x5d')));_0xc13b61['use']('/api/cm/hopper_history',require(_0x3d94('0x5e')));_0xc13b61[_0x3d94('0x9')]('/api/cm/custom_fields',require(_0x3d94('0x5f')));_0xc13b61['use'](_0x3d94('0x60'),require(_0x3d94('0x61')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x62'),require(_0x3d94('0x63')));_0xc13b61['use'](_0x3d94('0x64'),require(_0x3d94('0x65')));_0xc13b61[_0x3d94('0x9')]('/api/dispositions',require(_0x3d94('0x66')));_0xc13b61['use']('/api/conditions',require(_0x3d94('0x67')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x68'),require(_0x3d94('0x69')));_0xc13b61['use'](_0x3d94('0x6a'),require('./api/pause'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x6b'),require(_0x3d94('0x6c')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x6d'),require(_0x3d94('0x6e')));_0xc13b61[_0x3d94('0x9')]('/api/schedules',require(_0x3d94('0x6f')));_0xc13b61[_0x3d94('0x9')]('/api/sounds',require('./api/sound'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x70'),require('./api/tag'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x71'),require(_0x3d94('0x72')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x73'),require(_0x3d94('0x74')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x75'),require(_0x3d94('0x76')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x77'),require(_0x3d94('0x78')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x79'),require(_0x3d94('0x7a')));_0xc13b61['use'](_0x3d94('0x7b'),require(_0x3d94('0x7c')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x7d'),require(_0x3d94('0x7e')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x7f'),require(_0x3d94('0x80')));_0xc13b61[_0x3d94('0x9')]('/api/analytics/custom_reports',require(_0x3d94('0x81')));_0xc13b61['use'](_0x3d94('0x82'),require(_0x3d94('0x83')));_0xc13b61['use'](_0x3d94('0x84'),require('./api/analyticExtractedReport'));_0xc13b61['use'](_0x3d94('0x85'),require('./api/analyticMetric'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x86'),require('./api/analyticFieldReport'));_0xc13b61[_0x3d94('0x9')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x87'),require(_0x3d94('0x88')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x89'),require(_0x3d94('0x8a')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x8b'),require(_0x3d94('0x8c')));_0xc13b61['use'](_0x3d94('0x8d'),require(_0x3d94('0x8e')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x8f'),require(_0x3d94('0x90')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x91'),require(_0x3d94('0x92')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x93'),require(_0x3d94('0x94')));_0xc13b61['use'](_0x3d94('0x95'),require('./api/intDeskConfiguration'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x96'),require(_0x3d94('0x97')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x98'),require(_0x3d94('0x99')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x9a'),require(_0x3d94('0x9b')));_0xc13b61['use']('/api/integrations/zoho/fields',require(_0x3d94('0x9c')));_0xc13b61['use'](_0x3d94('0x9d'),require(_0x3d94('0x9e')));_0xc13b61['use'](_0x3d94('0x9f'),require(_0x3d94('0xa0')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xa1'),require(_0x3d94('0xa2')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xa3'),require('./api/intFreshdeskAccount'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xa4'),require(_0x3d94('0xa5')));_0xc13b61['use'](_0x3d94('0xa6'),require(_0x3d94('0xa7')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xa8'),require('./api/intVtigerAccount'));_0xc13b61['use'](_0x3d94('0xa9'),require(_0x3d94('0xaa')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xab'),require('./api/intVtigerField'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xac'),require('./api/intServicenowAccount'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xad'),require(_0x3d94('0xae')));_0xc13b61['use'](_0x3d94('0xaf'),require(_0x3d94('0xb0')));_0xc13b61[_0x3d94('0x9')]('/api/integrations/dynamics365/accounts',require(_0x3d94('0xb1')));_0xc13b61[_0x3d94('0x9')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0xc13b61['use'](_0x3d94('0xb2'),require(_0x3d94('0xb3')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xb4'),require(_0x3d94('0xb5')));_0xc13b61['use'](_0x3d94('0xb6'),require(_0x3d94('0xb7')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xb8'),require(_0x3d94('0xb9')));_0xc13b61[_0x3d94('0x9')]('/api/networks',require(_0x3d94('0xba')));_0xc13b61['use'](_0x3d94('0xbb'),require(_0x3d94('0xbc')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xbd'),require(_0x3d94('0xbe')));_0xc13b61[_0x3d94('0x9')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0xc13b61[_0x3d94('0x9')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0xc13b61['use'](_0x3d94('0xbf'),require(_0x3d94('0xc0')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xc1'),require(_0x3d94('0xc2')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xc3'),require(_0x3d94('0xc4')));_0xc13b61['use'](_0x3d94('0xc5'),require('./api/squareReportDetail'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xc6'),require(_0x3d94('0xc7')));_0xc13b61['use']('/api/settings',require('./api/setting'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xc8'),require(_0x3d94('0xc9')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xca'),require('./api/squareProject'));_0xc13b61['use'](_0x3d94('0xcb'),require(_0x3d94('0xcc')));_0xc13b61[_0x3d94('0x9')]('/api/square/messages',require(_0x3d94('0xcd')));_0xc13b61['use'](_0x3d94('0xce'),require(_0x3d94('0xcf')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xd0'),require(_0x3d94('0xd1')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xd2'),require(_0x3d94('0xd3')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xd4'),require(_0x3d94('0xd5')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xd6'),require('./api/attachment'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xd7'),require(_0x3d94('0xd8')));_0xc13b61[_0x3d94('0x9')]('/api/mail/reports/transfer',require(_0x3d94('0xd9')));_0xc13b61['use']('/api/chat/reports/transfer',require(_0x3d94('0xda')));_0xc13b61['use'](_0x3d94('0xdb'),require(_0x3d94('0xdc')));_0xc13b61['use'](_0x3d94('0xdd'),require('./api/openchannelTransferReport'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xde'),require('./api/smsTransferReport'));_0xc13b61['use']('/api/cm/lists',require(_0x3d94('0xdf')));_0xc13b61['use']('/api/voice/prefixes',require(_0x3d94('0xe0')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xe1'),require(_0x3d94('0xe2')));_0xc13b61['use'](_0x3d94('0xe3'),require(_0x3d94('0xe4')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xe5'),require(_0x3d94('0xe6')));_0xc13b61[_0x3d94('0x9')]('/api/userNotifications',require(_0x3d94('0xe7')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xe8'),require(_0x3d94('0xe9')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xea'),require(_0x3d94('0xeb')));_0xc13b61[_0x3d94('0x9')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xec'),require(_0x3d94('0xed')));_0xc13b61['use'](_0x3d94('0xee'),require(_0x3d94('0xef')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xf0'),require(_0x3d94('0xf1')));_0xc13b61['use']('/api/whatsapp/queues',require(_0x3d94('0xf2')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xf3'),require(_0x3d94('0xf4')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xf5'),require(_0x3d94('0xf6')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xf7'),require(_0x3d94('0xf8')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xf9'),require(_0x3d94('0xfa')));_0xc13b61['use'](_0x3d94('0xfb'),require(_0x3d94('0xfc')));_0xc13b61['use']('/api/auth/google',require(_0x3d94('0xfd')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0xfe'),require(_0x3d94('0xff')));_0xc13b61['use']('/api/jira',require(_0x3d94('0x100')));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x101'),require(_0x3d94('0x102')));_0xc13b61[_0x3d94('0x9')]('/api/version',require(_0x3d94('0x103')));_0xc13b61['use'](_0x3d94('0x104'),require(_0x3d94('0x105')));_0xc13b61[_0x3d94('0x9')]('/api/pm2',require(_0x3d94('0x106')));_0xc13b61[_0x3d94('0x9')]('/api/webbar',require(_0x3d94('0x107')));_0xc13b61['use'](_0x3d94('0x108'),clientSideLogs);_0xc13b61[_0x3d94('0x9')](_0x3d94('0x109'),express['static'](path[_0x3d94('0x10a')](config[_0x3d94('0x10b')],_0x3d94('0x109'))));_0xc13b61['use'](_0x3d94('0x10c'),express[_0x3d94('0x10d')](path[_0x3d94('0x10a')](config[_0x3d94('0x10b')],_0x3d94('0x10c'))));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x10e'),express[_0x3d94('0x10d')](path['join'](config[_0x3d94('0x10b')],_0x3d94('0x10e'))));_0xc13b61[_0x3d94('0x9')](_0x3d94('0x10f'),express[_0x3d94('0x10d')](path[_0x3d94('0x10a')](config['root'],_0x3d94('0x110'),_0x3d94('0x111'))));_0xc13b61[_0x3d94('0x9')]('/plugins',express[_0x3d94('0x10d')](path['join'](config[_0x3d94('0x10b')],_0x3d94('0x112'))));_0xc13b61['route'](_0x3d94('0x113'))[_0x3d94('0x114')](errors[0x194]);_0xc13b61['route']('/*')['get'](function(_0x10613f,_0x36e87c){_0x36e87c['sendFile'](path['resolve'](_0xc13b61['get'](_0x3d94('0x115'))+_0x3d94('0x116')));});return _0xc13b61;});}; \ No newline at end of file +var _0x90b1=['./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','/api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','./api/openchannelTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/mail_interaction_has_tags','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/snippet','snippet','3.13.0','/plugins','/server/files/plugins','route','get','sendFile','appPath','path','express','./errors','setupLoggers','./api/client-side-logs','default','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboardItem','./api/faxAccount','./api/faxApplication','/api/fax/interactions','/api/fax/messages','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/cmCompany','./api/cmContact','/api/cm/hopper','/api/cm/hopper_final'];(function(_0x15a5c1,_0x177ad3){var _0x19cb2e=function(_0xacdb01){while(--_0xacdb01){_0x15a5c1['push'](_0x15a5c1['shift']());}};_0x19cb2e(++_0x177ad3);}(_0x90b1,0x1bb));var _0x190b=function(_0x4ff681,_0x30ba0f){_0x4ff681=_0x4ff681-0x0;var _0x2465d0=_0x90b1[_0x4ff681];return _0x2465d0;};'use strict';var path=require(_0x190b('0x0'));var express=require(_0x190b('0x1'));var errors=require(_0x190b('0x2'));var config=require('./config/environment');var setupLoggers=require('./utils/client-side-logger')[_0x190b('0x3')];var clientSideLogs=require(_0x190b('0x4'));exports[_0x190b('0x5')]=function(_0x120ddc){return setupLoggers(_0x120ddc)['then'](function(){_0x120ddc['use']('/api/users',require('./api/user'));_0x120ddc[_0x190b('0x6')](_0x190b('0x7'),require(_0x190b('0x8')));_0x120ddc[_0x190b('0x6')](_0x190b('0x9'),require(_0x190b('0xa')));_0x120ddc[_0x190b('0x6')]('/api/voice/extensions',require(_0x190b('0xb')));_0x120ddc[_0x190b('0x6')](_0x190b('0xc'),require(_0x190b('0xd')));_0x120ddc[_0x190b('0x6')](_0x190b('0xe'),require(_0x190b('0xf')));_0x120ddc[_0x190b('0x6')]('/api/voice/recordings',require(_0x190b('0x10')));_0x120ddc[_0x190b('0x6')]('/api/screen/recordings',require(_0x190b('0x11')));_0x120ddc[_0x190b('0x6')](_0x190b('0x12'),require(_0x190b('0x13')));_0x120ddc[_0x190b('0x6')](_0x190b('0x14'),require(_0x190b('0x15')));_0x120ddc[_0x190b('0x6')](_0x190b('0x16'),require(_0x190b('0x17')));_0x120ddc[_0x190b('0x6')](_0x190b('0x18'),require(_0x190b('0x19')));_0x120ddc[_0x190b('0x6')](_0x190b('0x1a'),require(_0x190b('0x1b')));_0x120ddc[_0x190b('0x6')]('/api/voice/queues/reports',require(_0x190b('0x1c')));_0x120ddc['use'](_0x190b('0x1d'),require(_0x190b('0x1e')));_0x120ddc[_0x190b('0x6')](_0x190b('0x1f'),require('./api/trunk'));_0x120ddc[_0x190b('0x6')](_0x190b('0x20'),require(_0x190b('0x21')));_0x120ddc[_0x190b('0x6')](_0x190b('0x22'),require(_0x190b('0x23')));_0x120ddc['use'](_0x190b('0x24'),require(_0x190b('0x25')));_0x120ddc['use'](_0x190b('0x26'),require('./api/mailQueue'));_0x120ddc['use'](_0x190b('0x27'),require(_0x190b('0x28')));_0x120ddc[_0x190b('0x6')]('/api/mail/interactions',require(_0x190b('0x29')));_0x120ddc[_0x190b('0x6')](_0x190b('0x2a'),require(_0x190b('0x2b')));_0x120ddc[_0x190b('0x6')](_0x190b('0x2c'),require(_0x190b('0x2d')));_0x120ddc['use']('/api/mail/reports/queue',require(_0x190b('0x2e')));_0x120ddc[_0x190b('0x6')]('/api/dashboards',require('./api/dashboard'));_0x120ddc[_0x190b('0x6')]('/api/dashboards/items',require(_0x190b('0x2f')));_0x120ddc[_0x190b('0x6')]('/api/fax/accounts',require(_0x190b('0x30')));_0x120ddc[_0x190b('0x6')]('/api/fax/applications',require(_0x190b('0x31')));_0x120ddc[_0x190b('0x6')](_0x190b('0x32'),require('./api/faxInteraction'));_0x120ddc['use'](_0x190b('0x33'),require('./api/faxMessage'));_0x120ddc[_0x190b('0x6')](_0x190b('0x34'),require('./api/faxQueue'));_0x120ddc[_0x190b('0x6')]('/api/fax/reports/queue',require(_0x190b('0x35')));_0x120ddc['use'](_0x190b('0x36'),require('./api/smsAccount'));_0x120ddc[_0x190b('0x6')](_0x190b('0x37'),require('./api/smsApplication'));_0x120ddc[_0x190b('0x6')](_0x190b('0x38'),require(_0x190b('0x39')));_0x120ddc[_0x190b('0x6')](_0x190b('0x3a'),require(_0x190b('0x3b')));_0x120ddc[_0x190b('0x6')](_0x190b('0x3c'),require('./api/smsQueue'));_0x120ddc['use'](_0x190b('0x3d'),require(_0x190b('0x3e')));_0x120ddc['use'](_0x190b('0x3f'),require(_0x190b('0x40')));_0x120ddc[_0x190b('0x6')](_0x190b('0x41'),require(_0x190b('0x42')));_0x120ddc[_0x190b('0x6')](_0x190b('0x43'),require('./api/openchannelMessage'));_0x120ddc['use'](_0x190b('0x44'),require(_0x190b('0x45')));_0x120ddc[_0x190b('0x6')]('/api/chat/websites',require(_0x190b('0x46')));_0x120ddc[_0x190b('0x6')](_0x190b('0x47'),require('./api/openchannelQueueReport'));_0x120ddc[_0x190b('0x6')]('/api/chat/applications',require('./api/chatApplication'));_0x120ddc[_0x190b('0x6')](_0x190b('0x48'),require('./api/chatInteraction'));_0x120ddc[_0x190b('0x6')](_0x190b('0x49'),require(_0x190b('0x4a')));_0x120ddc['use'](_0x190b('0x4b'),require(_0x190b('0x4c')));_0x120ddc['use']('/api/chat/queues',require(_0x190b('0x4d')));_0x120ddc['use'](_0x190b('0x4e'),require(_0x190b('0x4f')));_0x120ddc[_0x190b('0x6')](_0x190b('0x50'),require('./api/chatProactiveAction'));_0x120ddc[_0x190b('0x6')]('/api/cm/companies',require(_0x190b('0x51')));_0x120ddc[_0x190b('0x6')]('/api/cm/contacts',require(_0x190b('0x52')));_0x120ddc[_0x190b('0x6')](_0x190b('0x53'),require('./api/cmHopper'));_0x120ddc[_0x190b('0x6')]('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x120ddc['use'](_0x190b('0x54'),require(_0x190b('0x55')));_0x120ddc[_0x190b('0x6')](_0x190b('0x56'),require('./api/cmHopperHistory'));_0x120ddc['use'](_0x190b('0x57'),require('./api/cmCustomField'));_0x120ddc[_0x190b('0x6')](_0x190b('0x58'),require('./api/action'));_0x120ddc[_0x190b('0x6')](_0x190b('0x59'),require(_0x190b('0x5a')));_0x120ddc['use'](_0x190b('0x5b'),require(_0x190b('0x5c')));_0x120ddc['use'](_0x190b('0x5d'),require('./api/disposition'));_0x120ddc[_0x190b('0x6')](_0x190b('0x5e'),require(_0x190b('0x5f')));_0x120ddc['use'](_0x190b('0x60'),require('./api/interval'));_0x120ddc[_0x190b('0x6')](_0x190b('0x61'),require(_0x190b('0x62')));_0x120ddc[_0x190b('0x6')](_0x190b('0x63'),require(_0x190b('0x64')));_0x120ddc[_0x190b('0x6')]('/api/voiceQueuesLog',require(_0x190b('0x65')));_0x120ddc[_0x190b('0x6')](_0x190b('0x66'),require('./api/schedule'));_0x120ddc[_0x190b('0x6')](_0x190b('0x67'),require(_0x190b('0x68')));_0x120ddc[_0x190b('0x6')](_0x190b('0x69'),require('./api/tag'));_0x120ddc[_0x190b('0x6')](_0x190b('0x6a'),require(_0x190b('0x6b')));_0x120ddc['use'](_0x190b('0x6c'),require(_0x190b('0x6d')));_0x120ddc[_0x190b('0x6')]('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x120ddc[_0x190b('0x6')](_0x190b('0x6e'),require(_0x190b('0x6f')));_0x120ddc[_0x190b('0x6')](_0x190b('0x70'),require(_0x190b('0x71')));_0x120ddc['use'](_0x190b('0x72'),require(_0x190b('0x73')));_0x120ddc[_0x190b('0x6')]('/api/integrations',require(_0x190b('0x74')));_0x120ddc[_0x190b('0x6')](_0x190b('0x75'),require('./api/integrationReport'));_0x120ddc[_0x190b('0x6')](_0x190b('0x76'),require(_0x190b('0x77')));_0x120ddc[_0x190b('0x6')](_0x190b('0x78'),require(_0x190b('0x79')));_0x120ddc[_0x190b('0x6')](_0x190b('0x7a'),require(_0x190b('0x7b')));_0x120ddc[_0x190b('0x6')](_0x190b('0x7c'),require('./api/analyticMetric'));_0x120ddc[_0x190b('0x6')]('/api/analytics/field_reports',require(_0x190b('0x7d')));_0x120ddc[_0x190b('0x6')]('/api/analytics/tree_reports',require(_0x190b('0x7e')));_0x120ddc[_0x190b('0x6')](_0x190b('0x7f'),require(_0x190b('0x80')));_0x120ddc[_0x190b('0x6')](_0x190b('0x81'),require(_0x190b('0x82')));_0x120ddc[_0x190b('0x6')]('/api/integrations/salesforce/fields',require(_0x190b('0x83')));_0x120ddc[_0x190b('0x6')](_0x190b('0x84'),require('./api/intSugarcrmAccount'));_0x120ddc[_0x190b('0x6')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x120ddc[_0x190b('0x6')](_0x190b('0x85'),require(_0x190b('0x86')));_0x120ddc[_0x190b('0x6')](_0x190b('0x87'),require(_0x190b('0x88')));_0x120ddc[_0x190b('0x6')](_0x190b('0x89'),require(_0x190b('0x8a')));_0x120ddc[_0x190b('0x6')](_0x190b('0x8b'),require(_0x190b('0x8c')));_0x120ddc[_0x190b('0x6')](_0x190b('0x8d'),require('./api/intZohoAccount'));_0x120ddc[_0x190b('0x6')](_0x190b('0x8e'),require(_0x190b('0x8f')));_0x120ddc[_0x190b('0x6')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x120ddc[_0x190b('0x6')](_0x190b('0x90'),require('./api/intZendeskAccount'));_0x120ddc[_0x190b('0x6')]('/api/integrations/zendesk/configurations',require(_0x190b('0x91')));_0x120ddc[_0x190b('0x6')](_0x190b('0x92'),require('./api/intZendeskField'));_0x120ddc[_0x190b('0x6')](_0x190b('0x93'),require(_0x190b('0x94')));_0x120ddc[_0x190b('0x6')](_0x190b('0x95'),require(_0x190b('0x96')));_0x120ddc[_0x190b('0x6')](_0x190b('0x97'),require(_0x190b('0x98')));_0x120ddc['use']('/api/integrations/vtiger/accounts',require(_0x190b('0x99')));_0x120ddc[_0x190b('0x6')](_0x190b('0x9a'),require(_0x190b('0x9b')));_0x120ddc['use'](_0x190b('0x9c'),require(_0x190b('0x9d')));_0x120ddc['use'](_0x190b('0x9e'),require(_0x190b('0x9f')));_0x120ddc[_0x190b('0x6')](_0x190b('0xa0'),require(_0x190b('0xa1')));_0x120ddc[_0x190b('0x6')](_0x190b('0xa2'),require(_0x190b('0xa3')));_0x120ddc['use'](_0x190b('0xa4'),require('./api/intDynamics365Account'));_0x120ddc['use'](_0x190b('0xa5'),require(_0x190b('0xa6')));_0x120ddc[_0x190b('0x6')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x120ddc[_0x190b('0x6')](_0x190b('0xa7'),require(_0x190b('0xa8')));_0x120ddc[_0x190b('0x6')](_0x190b('0xa9'),require(_0x190b('0xaa')));_0x120ddc[_0x190b('0x6')](_0x190b('0xab'),require('./api/intFreshsalesField'));_0x120ddc[_0x190b('0x6')](_0x190b('0xac'),require(_0x190b('0xad')));_0x120ddc[_0x190b('0x6')](_0x190b('0xae'),require('./api/chatQueueReport'));_0x120ddc[_0x190b('0x6')](_0x190b('0xaf'),require(_0x190b('0xb0')));_0x120ddc['use'](_0x190b('0xb1'),require(_0x190b('0xb2')));_0x120ddc[_0x190b('0x6')](_0x190b('0xb3'),require('./api/jscriptyQuestionReport'));_0x120ddc[_0x190b('0x6')](_0x190b('0xb4'),require(_0x190b('0xb5')));_0x120ddc[_0x190b('0x6')]('/api/sms/reports/queue',require(_0x190b('0xb6')));_0x120ddc['use'](_0x190b('0xb7'),require(_0x190b('0xb8')));_0x120ddc[_0x190b('0x6')](_0x190b('0xb9'),require('./api/squareReportDetail'));_0x120ddc[_0x190b('0x6')]('/api/jscripty/projects',require(_0x190b('0xba')));_0x120ddc['use']('/api/settings',require(_0x190b('0xbb')));_0x120ddc['use'](_0x190b('0xbc'),require(_0x190b('0xbd')));_0x120ddc[_0x190b('0x6')](_0x190b('0xbe'),require(_0x190b('0xbf')));_0x120ddc['use'](_0x190b('0xc0'),require(_0x190b('0xc1')));_0x120ddc[_0x190b('0x6')]('/api/square/messages',require(_0x190b('0xc2')));_0x120ddc[_0x190b('0x6')]('/api/teams',require(_0x190b('0xc3')));_0x120ddc[_0x190b('0x6')](_0x190b('0xc4'),require('./api/license'));_0x120ddc[_0x190b('0x6')](_0x190b('0xc5'),require(_0x190b('0xc6')));_0x120ddc[_0x190b('0x6')]('/api/migrations',require(_0x190b('0xc7')));_0x120ddc[_0x190b('0x6')](_0x190b('0xc8'),require('./api/attachment'));_0x120ddc[_0x190b('0x6')](_0x190b('0xc9'),require(_0x190b('0xca')));_0x120ddc['use'](_0x190b('0xcb'),require(_0x190b('0xcc')));_0x120ddc[_0x190b('0x6')](_0x190b('0xcd'),require(_0x190b('0xce')));_0x120ddc['use']('/api/fax/reports/transfer',require(_0x190b('0xcf')));_0x120ddc[_0x190b('0x6')]('/api/openchannel/reports/transfer',require(_0x190b('0xd0')));_0x120ddc[_0x190b('0x6')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x120ddc[_0x190b('0x6')](_0x190b('0xd1'),require('./api/cmList'));_0x120ddc['use'](_0x190b('0xd2'),require(_0x190b('0xd3')));_0x120ddc[_0x190b('0x6')](_0x190b('0xd4'),require(_0x190b('0xd5')));_0x120ddc['use']('/api/userProfile/sections',require(_0x190b('0xd6')));_0x120ddc['use'](_0x190b('0xd7'),require(_0x190b('0xd8')));_0x120ddc[_0x190b('0x6')](_0x190b('0xd9'),require(_0x190b('0xda')));_0x120ddc[_0x190b('0x6')](_0x190b('0xdb'),require(_0x190b('0xdc')));_0x120ddc[_0x190b('0x6')](_0x190b('0xdd'),require(_0x190b('0xde')));_0x120ddc['use'](_0x190b('0xdf'),require(_0x190b('0xe0')));_0x120ddc[_0x190b('0x6')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x120ddc[_0x190b('0x6')](_0x190b('0xe1'),require('./api/whatsappQueueReport'));_0x120ddc[_0x190b('0x6')](_0x190b('0xe2'),require(_0x190b('0xe3')));_0x120ddc['use'](_0x190b('0xe4'),require(_0x190b('0xe5')));_0x120ddc['use'](_0x190b('0xe6'),require(_0x190b('0xe7')));_0x120ddc['use'](_0x190b('0xe8'),require('./api/realtime'));_0x120ddc['use']('/api/user-settings',require('./api/user-setting'));_0x120ddc[_0x190b('0x6')](_0x190b('0xe9'),require('./api/mailInteractionHasTag'));_0x120ddc[_0x190b('0x6')](_0x190b('0xea'),require('./api/authLocal'));_0x120ddc[_0x190b('0x6')](_0x190b('0xeb'),require(_0x190b('0xec')));_0x120ddc[_0x190b('0x6')](_0x190b('0xed'),require(_0x190b('0xee')));_0x120ddc[_0x190b('0x6')](_0x190b('0xef'),require(_0x190b('0xf0')));_0x120ddc['use'](_0x190b('0xf1'),require('./api/rpc'));_0x120ddc['use'](_0x190b('0xf2'),require(_0x190b('0xf3')));_0x120ddc[_0x190b('0x6')](_0x190b('0xf4'),require(_0x190b('0xf5')));_0x120ddc[_0x190b('0x6')](_0x190b('0xf6'),require(_0x190b('0xf7')));_0x120ddc[_0x190b('0x6')](_0x190b('0xf8'),require(_0x190b('0xf9')));_0x120ddc[_0x190b('0x6')]('/api/logs',clientSideLogs);_0x120ddc[_0x190b('0x6')](_0x190b('0xfa'),express[_0x190b('0xfb')](path[_0x190b('0xfc')](config[_0x190b('0xfd')],_0x190b('0xfa'))));_0x120ddc[_0x190b('0x6')](_0x190b('0xfe'),express[_0x190b('0xfb')](path['join'](config[_0x190b('0xfd')],_0x190b('0xfe'))));_0x120ddc[_0x190b('0x6')]('/demo',express[_0x190b('0xfb')](path[_0x190b('0xfc')](config['root'],'/demo')));_0x120ddc[_0x190b('0x6')](_0x190b('0xff'),express[_0x190b('0xfb')](path[_0x190b('0xfc')](config[_0x190b('0xfd')],_0x190b('0x100'),_0x190b('0x101'))));_0x120ddc[_0x190b('0x6')](_0x190b('0x102'),express[_0x190b('0xfb')](path['join'](config[_0x190b('0xfd')],_0x190b('0x103'))));_0x120ddc[_0x190b('0x104')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x190b('0x105')](errors[0x194]);_0x120ddc[_0x190b('0x104')]('/*')[_0x190b('0x105')](function(_0x3ac90d,_0x1c5cf3){_0x1c5cf3[_0x190b('0x106')](path['resolve'](_0x120ddc[_0x190b('0x105')](_0x190b('0x107'))+'/index.html'));});return _0x120ddc;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 0b7e215..c28cfa8 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe45e=['../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','port','localhost','error','jayson/promise','lodash','../config/environment','listen','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc'];(function(_0x22b39b,_0x2b7d63){var _0x280e1d=function(_0xc74635){while(--_0xc74635){_0x22b39b['push'](_0x22b39b['shift']());}};_0x280e1d(++_0x2b7d63);}(_0xe45e,0x1c0));var _0xee45=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0xe45e[_0x1ccbcc];return _0x1e873f;};'use strict';var jayson=require(_0xee45('0x0'));var _=require(_0xee45('0x1'));var config=require(_0xee45('0x2'));exports[_0xee45('0x3')]=function(){return new Promise(function(_0x528bd3,_0x8b6223){var _0x2bf99b={};_0x2bf99b=_['merge'](_0x2bf99b,require('../api/user/user.rpc'));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require('../api/voiceExtension/voiceExtension.rpc'));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require('../api/voiceQueue/voiceQueue.rpc'));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x5')));_0x2bf99b=_['merge'](_0x2bf99b,require(_0xee45('0x6')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x2bf99b=_['merge'](_0x2bf99b,require(_0xee45('0x7')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x8')));_0x2bf99b=_['merge'](_0x2bf99b,require(_0xee45('0x9')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0xa')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x2bf99b=_['merge'](_0x2bf99b,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0xb')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0xc')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require('../api/mailQueue/mailQueue.rpc'));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0xd')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0xe')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0xf')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x2bf99b=_['merge'](_0x2bf99b,require('../api/faxAccount/faxAccount.rpc'));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x10')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x11')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require('../api/faxMessage/faxMessage.rpc'));_0x2bf99b=_['merge'](_0x2bf99b,require(_0xee45('0x12')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x13')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x14')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x15')));_0x2bf99b=_['merge'](_0x2bf99b,require(_0xee45('0x16')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x17')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x18')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x19')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x1a')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x1b')));_0x2bf99b=_['merge'](_0x2bf99b,require(_0xee45('0x1c')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x1d')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x1e')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require('../api/chatQueue/chatQueue.rpc'));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x1f')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x20')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x21')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x2bf99b=_['merge'](_0x2bf99b,require(_0xee45('0x22')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x23')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x24')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x25')));_0x2bf99b=_['merge'](_0x2bf99b,require(_0xee45('0x26')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x27')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x28')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x29')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x2a')));_0x2bf99b=_['merge'](_0x2bf99b,require(_0xee45('0x2b')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x2c')));_0x2bf99b=_['merge'](_0x2bf99b,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x2bf99b=_['merge'](_0x2bf99b,require(_0xee45('0x2d')));_0x2bf99b=_['merge'](_0x2bf99b,require(_0xee45('0x2e')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x2f')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x30')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x31')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x32')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x33')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x34')));_0x2bf99b=_['merge'](_0x2bf99b,require(_0xee45('0x35')));_0x2bf99b=_['merge'](_0x2bf99b,require(_0xee45('0x36')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x37')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require('../api/squareRecording/squareRecording.rpc'));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x38')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require('../api/campaign/campaign.rpc'));_0x2bf99b=_['merge'](_0x2bf99b,require(_0xee45('0x39')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x3a')));_0x2bf99b=_['merge'](_0x2bf99b,require(_0xee45('0x3b')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x2bf99b=_['merge'](_0x2bf99b,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x3c')));_0x2bf99b=_[_0xee45('0x4')](_0x2bf99b,require(_0xee45('0x3d')));var _0x38be7e=jayson[_0xee45('0x3e')](_0x2bf99b)['http']();var _0x14cbca=config['rpc'][_0xee45('0x3f')]||config[_0xee45('0x3f')]+0x1;var _0x106ca6=config['rpc']['ip']||_0xee45('0x40');_0x38be7e['on'](_0xee45('0x41'),function(_0x527688){return _0x8b6223(_0x527688);});_0x38be7e['listen'](_0x14cbca,_0x106ca6,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x106ca6,_0x14cbca);require('../config/triggers')['default']();return _0x528bd3('RPC\x20listening\x20on\x20'+_0x106ca6+':'+_0x14cbca);});});}; \ No newline at end of file +var _0xb9a7=['../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../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/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/user/user.rpc'];(function(_0x497fd3,_0xf9207e){var _0x1558a0=function(_0x2c2ed0){while(--_0x2c2ed0){_0x497fd3['push'](_0x497fd3['shift']());}};_0x1558a0(++_0xf9207e);}(_0xb9a7,0x172));var _0x7b9a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xb9a7[_0x36c5b0];return _0xf19333;};'use strict';var jayson=require(_0x7b9a('0x0'));var _=require('lodash');var config=require(_0x7b9a('0x1'));exports[_0x7b9a('0x2')]=function(){return new Promise(function(_0x17d7b5,_0x24662f){var _0x11e127={};_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x4')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x5')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x6')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x7')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x8')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x9')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0xa')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0xb')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0xc')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0xd')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0xe')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0xf')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x10')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/mailMessage/mailMessage.rpc'));_0x11e127=_['merge'](_0x11e127,require('../api/mailApplication/mailApplication.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x11')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x12')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x13')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x14')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x15')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x16')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x17')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x18')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/smsInteraction/smsInteraction.rpc'));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x19')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x1a')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x1b')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x1c')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x1d')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x1e')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x1f')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/chatInteraction/chatInteraction.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/chatMessage/chatMessage.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x20')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x21')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x22')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x23')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x24')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x25')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x26')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x27')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x28')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/sound/sound.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x29')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x2a')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/trigger/trigger.rpc'));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x2b')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x2c')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x2d')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x2e')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x2f')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x30')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x31')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x32')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x33')));_0x11e127=_['merge'](_0x11e127,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x34')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x35')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x36')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/squareReport/squareReport.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x37')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x38')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/squareOdbc/squareOdbc.rpc'));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x39')));_0x11e127=_['merge'](_0x11e127,require(_0x7b9a('0x3a')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x3b')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x3c')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x3d')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x3e')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x3f')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x40')));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require(_0x7b9a('0x41')));_0x11e127=_['merge'](_0x11e127,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x11e127=_[_0x7b9a('0x3')](_0x11e127,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x333b76=jayson[_0x7b9a('0x42')](_0x11e127)['http']();var _0x41be80=config[_0x7b9a('0x43')][_0x7b9a('0x44')]||config[_0x7b9a('0x44')]+0x1;var _0x16476a=config[_0x7b9a('0x43')]['ip']||'localhost';_0x333b76['on'](_0x7b9a('0x45'),function(_0x917668){return _0x24662f(_0x917668);});_0x333b76[_0x7b9a('0x2')](_0x41be80,_0x16476a,function(){console[_0x7b9a('0x46')](_0x7b9a('0x47'),_0x16476a,_0x41be80);require(_0x7b9a('0x48'))[_0x7b9a('0x49')]();return _0x17d7b5(_0x7b9a('0x4a')+_0x16476a+':'+_0x41be80);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index e06a626..8595384 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 _0xf6ea=['setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','exec','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','./reply','./error','setEncoding','utf8','setTimeout','line','toLowerCase','hangup','emit','substring','search','520\x20End\x20of\x20proper','function','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xf6ea,0x14c));var _0xaf6e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf6ea[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require(_0xaf6e('0x0'));var _=require(_0xaf6e('0x1'));var EventEmitter=require(_0xaf6e('0x2'))['EventEmitter'];var AGIReply=require(_0xaf6e('0x3'));var AGIError=require(_0xaf6e('0x4'));function AGIChannel(_0x371bf2){var _0x2e0558=this,_0x4678e2=new AGIReply(),_0x450ffa=![],_0x4f7f27={};EventEmitter['call'](_0x2e0558);_0x371bf2[_0xaf6e('0x5')](_0xaf6e('0x6'));_0x371bf2[_0xaf6e('0x7')](0x8*0x3c*0x3c*0x3e8);_0x4678e2[_0xaf6e('0x5')](_0xaf6e('0x6'));_0x4678e2['on']('headers',function(_0x14b46f){for(var _0x5d5435 in _0x14b46f){_0x2e0558[_0x5d5435]=_0x14b46f[_0x5d5435];}_0x2e0558['emit']('ready');});_0x4678e2['on'](_0xaf6e('0x8'),function(_0xb2d965){if(_0xb2d965[_0xaf6e('0x9')]()==_0xaf6e('0xa')){_0x2e0558[_0xaf6e('0xb')]('hangup');return;}if(_0xb2d965[_0xaf6e('0xc')](0x0,0xb)=='520-Invalid'){_0x450ffa=!![];}if(_0x450ffa){_0x4f7f27['rx']+=_0xb2d965+'\x0a';if(_0xb2d965[_0xaf6e('0xd')](_0xaf6e('0xe'))!=-0x1){_0x450ffa=![];}}else{_0x4f7f27['rx']=_0xb2d965;}if(_0x450ffa){return;}if(typeof _0x4f7f27['cb']==_0xaf6e('0xf')){var _0x4af99c=_0x4f7f27['rx'][_0xaf6e('0xc')](0x0,0x3),_0x8abae0=null,_0x4d1bcf=null;_0x4af99c=parseInt(_0x4af99c);if(isNaN(_0x4af99c)){_0x4f7f27['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x4af99c!=0xc8){_0x4f7f27['cb'](null,{'code':_0x4af99c,'result':-0x1,'extra':'KO'});return;}_0x8abae0=_0x4f7f27['rx'][_0xaf6e('0xc')](0x4)['replace']('result=','');if(_0x8abae0[_0xaf6e('0x10')]('\x20')!=-0x1){_0x8abae0=_0x8abae0['substr'](0x0,_0x8abae0['indexOf']('\x20'));}if(_[_0xaf6e('0x11')](_0x8abae0,'-1')){_0x8abae0=parseInt(_0x8abae0);}_0x4d1bcf=_0x4f7f27['rx'][_0xaf6e('0x12')]('\x20');if(_0x4d1bcf['length']==0x3){_0x4d1bcf=_0x4d1bcf[0x2][_0xaf6e('0xc')](0x1,_0x4d1bcf[0x2][_0xaf6e('0x13')]-0x1);}else if(_0x4d1bcf[_0xaf6e('0x13')]>0x3){var _0x344b4a=/\((.+)\)/;var _0x1207cb=_0x4f7f27['rx'][_0xaf6e('0x14')](_0x344b4a);if(_0x1207cb){_0x4d1bcf=_0x1207cb[0x1];}else{_0x4d1bcf=null;}}else{_0x4d1bcf=null;}_0x4f7f27['cb'](null,{'code':_0x4af99c,'result':_0x8abae0,'extra':_0x4d1bcf});}});_0x371bf2['on'](_0xaf6e('0x15'),function(_0x5bc4c4){_0x2e0558[_0xaf6e('0xb')]('error',new AGIError(_0xaf6e('0x16'),_0x5bc4c4[_0xaf6e('0x17')]));});_0x371bf2['on']('close',function(){_0x2e0558[_0xaf6e('0xb')](_0xaf6e('0x18'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x371bf2['on'](_0xaf6e('0x19'),function(){_0x2e0558[_0xaf6e('0xb')]('timeout',new AGIError(_0xaf6e('0x1a')));_0x371bf2[_0xaf6e('0x1b')]();});_0x371bf2[_0xaf6e('0x1c')](_0x4678e2);this[_0xaf6e('0x1d')]=function(_0x4f03f7,_0x3fba44){var _0x4f03f7=_0x4f03f7||'',_0x3fba44=typeof _0x3fba44==_0xaf6e('0xf')?_0x3fba44:new Function();_0x4f7f27={'tx':_0x4f03f7,'rx':'','cb':_0x3fba44};_0x371bf2['write'](_0x4f03f7+'\x0a');},this[_0xaf6e('0x18')]=function(){_0x371bf2[_0xaf6e('0x1b')]();};}util[_0xaf6e('0x1e')](AGIChannel,EventEmitter);AGIChannel[_0xaf6e('0x1f')][_0xaf6e('0x20')]=function(_0x4fea68){return this[_0xaf6e('0x1d')][_0xaf6e('0x21')](this,_0x4fea68);};AGIChannel[_0xaf6e('0x1f')][_0xaf6e('0x22')]=function(){return this['sendRequest'](_0xaf6e('0x23'));};AGIChannel[_0xaf6e('0x1f')][_0xaf6e('0x24')]=function(_0x39553b,_0x1c6792,_0x4b1ed){_0x39553b=_0x39553b===undefined?_0xaf6e('0x25'):_0x39553b;_0x1c6792=_0x1c6792===undefined?'5':_0x1c6792;_0x4b1ed=_0x4b1ed===undefined?'1':_0x4b1ed;return this['sendRequest'](util['format']('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x39553b,_0x1c6792*0x3e8,_0x4b1ed));};AGIChannel[_0xaf6e('0x1f')][_0xaf6e('0x26')]=function(_0x53039b){_0x53039b=_0x53039b||_0xaf6e('0x27');return this[_0xaf6e('0x20')](util[_0xaf6e('0x28')](_0xaf6e('0x29'),_0x53039b));};AGIChannel['prototype']['exec']=function(_0xfa3084,_0x21248b){if(_[_0xaf6e('0x2a')](_0x21248b)){return this['sendRequest'](util['format'](_0xaf6e('0x2b'),_0xfa3084,_0x21248b[_0xaf6e('0x2c')](',')));}return this[_0xaf6e('0x20')](util['format'](_0xaf6e('0x2b'),_0xfa3084,_0x21248b));};AGIChannel['prototype'][_0xaf6e('0x2d')]=function(_0xa794ad){return this['sendRequest'](util[_0xaf6e('0x28')]('SET\x20CONTEXT\x20%s',_0xa794ad));};AGIChannel[_0xaf6e('0x1f')][_0xaf6e('0x2e')]=function(_0x50fe3c){return this['sendRequest'](util['format'](_0xaf6e('0x2f'),_0x50fe3c));};AGIChannel[_0xaf6e('0x1f')][_0xaf6e('0x30')]=function(_0x5af3e5){return this[_0xaf6e('0x20')](util[_0xaf6e('0x28')](_0xaf6e('0x31'),_0x5af3e5));};AGIChannel[_0xaf6e('0x1f')][_0xaf6e('0xa')]=function(){return this[_0xaf6e('0x20')]('HANGUP');};AGIChannel[_0xaf6e('0x1f')][_0xaf6e('0x32')]=function(_0x30e31b,_0x352dc9){var _0xb8e1e2=_[_0xaf6e('0x33')](_0x352dc9)||_[_0xaf6e('0x34')](_0x352dc9)?_0x352dc9[_0xaf6e('0x35')]():_0x352dc9;return this[_0xaf6e('0x20')](util['format'](_0xaf6e('0x36'),_0x30e31b,_0xb8e1e2?_0xb8e1e2[_0xaf6e('0x35')]()[_0xaf6e('0x37')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xaf6e('0x1f')]['sayNumber']=function(_0x26fab6,_0x46c69e){return this[_0xaf6e('0x20')](util[_0xaf6e('0x28')](_0xaf6e('0x38'),_0x26fab6,_0x46c69e));};AGIChannel[_0xaf6e('0x1f')][_0xaf6e('0x39')]=function(_0x1ddbc4,_0x3abc1e){return this['sendRequest'](util[_0xaf6e('0x28')](_0xaf6e('0x3a'),_0x1ddbc4,_0x3abc1e));};AGIChannel[_0xaf6e('0x1f')][_0xaf6e('0x3b')]=function(_0x104171,_0x202e8b){return this['sendRequest'](util[_0xaf6e('0x28')](_0xaf6e('0x3c'),_0x104171,_0x202e8b));};AGIChannel[_0xaf6e('0x1f')]['continueAt']=function(_0x2f0f87,_0x3c9a6c,_0x571fce){_0x3c9a6c=_0x3c9a6c||this[_0xaf6e('0x3d')];_0x571fce=_0x571fce||0x1;this[_0xaf6e('0x2d')](_0x2f0f87);this[_0xaf6e('0x2e')](_0x3c9a6c);this[_0xaf6e('0x30')](_0x571fce);return this[_0xaf6e('0x26')](util[_0xaf6e('0x28')]('GOTO\x20%s\x20%s\x20%s',_0x2f0f87,_0x3c9a6c,_0x571fce));};AGIChannel['prototype'][_0xaf6e('0x3e')]=function(_0x5bed48){return this[_0xaf6e('0x20')](util[_0xaf6e('0x28')](_0xaf6e('0x3f'),_0x5bed48));};AGIChannel[_0xaf6e('0x1f')][_0xaf6e('0x40')]=function(_0x348f10,_0x53b098,_0x218fee,_0xe79fcc,_0x10373f,_0x186632){_0x53b098=_0x53b098||_0xaf6e('0x41');_0x218fee=_0x218fee||'';_0xe79fcc=_0xe79fcc===undefined?-0x1:_0xe79fcc==='-1'?-0x1:_0xe79fcc*0x3e8;_0x10373f=_0x10373f===undefined?'':'s='+_0x10373f;_0x186632=_0x186632?_0xaf6e('0x42'):'';return this[_0xaf6e('0x20')](util[_0xaf6e('0x28')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x348f10,_0x53b098,_0x218fee,_0xe79fcc,_0x186632,_0x10373f));};AGIChannel['prototype'][_0xaf6e('0x43')]=function(_0x3faf22,_0x4cbe6e){_0x4cbe6e=_0x4cbe6e||'';return this[_0xaf6e('0x20')](util[_0xaf6e('0x28')](_0xaf6e('0x44'),_0x3faf22,_0x4cbe6e));};AGIChannel[_0xaf6e('0x1f')][_0xaf6e('0x45')]=function(_0x4a320c){return this['exec'](_0xaf6e('0x46'),_0x4a320c);};AGIChannel['prototype'][_0xaf6e('0x47')]=function(_0xd038a0){return this[_0xaf6e('0x48')](_0xaf6e('0x49'),_0xd038a0);};AGIChannel[_0xaf6e('0x1f')][_0xaf6e('0x15')]=function(_0x2c8689,_0x3c2a46){this[_0xaf6e('0x26')](util[_0xaf6e('0x28')](_0xaf6e('0x4a'),_0x2c8689['id'],_0x2c8689[_0xaf6e('0x4b')],_0x3c2a46));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x36d4=['GET\x20VARIABLE\x20\x22%s\x22','recordFile','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','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','emit','ready','hangup','search','function','substring','no\x20code','replace','result=','indexOf','startsWith','length','match','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','write','inherits','prototype','sendRequest','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable'];(function(_0x2ebc49,_0x233068){var _0x2acd77=function(_0x18ba79){while(--_0x18ba79){_0x2ebc49['push'](_0x2ebc49['shift']());}};_0x2acd77(++_0x233068);}(_0x36d4,0x17d));var _0x436d=function(_0x2f023d,_0x29dfe5){_0x2f023d=_0x2f023d-0x0;var _0x4ef240=_0x36d4[_0x2f023d];return _0x4ef240;};'use strict';var util=require(_0x436d('0x0'));var _=require(_0x436d('0x1'));var EventEmitter=require(_0x436d('0x2'))[_0x436d('0x3')];var AGIReply=require(_0x436d('0x4'));var AGIError=require(_0x436d('0x5'));function AGIChannel(_0x47c5e3){var _0x296d0a=this,_0x29af36=new AGIReply(),_0x201144=![],_0x8250e6={};EventEmitter[_0x436d('0x6')](_0x296d0a);_0x47c5e3['setEncoding'](_0x436d('0x7'));_0x47c5e3[_0x436d('0x8')](0x8*0x3c*0x3c*0x3e8);_0x29af36[_0x436d('0x9')](_0x436d('0x7'));_0x29af36['on'](_0x436d('0xa'),function(_0x29603a){for(var _0x13d8f6 in _0x29603a){_0x296d0a[_0x13d8f6]=_0x29603a[_0x13d8f6];}_0x296d0a[_0x436d('0xb')](_0x436d('0xc'));});_0x29af36['on']('line',function(_0x1e7813){if(_0x1e7813['toLowerCase']()==_0x436d('0xd')){_0x296d0a[_0x436d('0xb')](_0x436d('0xd'));return;}if(_0x1e7813['substring'](0x0,0xb)=='520-Invalid'){_0x201144=!![];}if(_0x201144){_0x8250e6['rx']+=_0x1e7813+'\x0a';if(_0x1e7813[_0x436d('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x201144=![];}}else{_0x8250e6['rx']=_0x1e7813;}if(_0x201144){return;}if(typeof _0x8250e6['cb']==_0x436d('0xf')){var _0x118d4b=_0x8250e6['rx'][_0x436d('0x10')](0x0,0x3),_0x1fd9cd=null,_0x13965f=null;_0x118d4b=parseInt(_0x118d4b);if(isNaN(_0x118d4b)){_0x8250e6['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x436d('0x11')});return;}if(_0x118d4b!=0xc8){_0x8250e6['cb'](null,{'code':_0x118d4b,'result':-0x1,'extra':'KO'});return;}_0x1fd9cd=_0x8250e6['rx'][_0x436d('0x10')](0x4)[_0x436d('0x12')](_0x436d('0x13'),'');if(_0x1fd9cd['indexOf']('\x20')!=-0x1){_0x1fd9cd=_0x1fd9cd['substr'](0x0,_0x1fd9cd[_0x436d('0x14')]('\x20'));}if(_[_0x436d('0x15')](_0x1fd9cd,'-1')){_0x1fd9cd=parseInt(_0x1fd9cd);}_0x13965f=_0x8250e6['rx']['split']('\x20');if(_0x13965f[_0x436d('0x16')]==0x3){_0x13965f=_0x13965f[0x2][_0x436d('0x10')](0x1,_0x13965f[0x2][_0x436d('0x16')]-0x1);}else if(_0x13965f[_0x436d('0x16')]>0x3){var _0x1a1fc4=/\((.+)\)/;var _0x28f073=_0x8250e6['rx'][_0x436d('0x17')](_0x1a1fc4);if(_0x28f073){_0x13965f=_0x28f073[0x1];}else{_0x13965f=null;}}else{_0x13965f=null;}_0x8250e6['cb'](null,{'code':_0x118d4b,'result':_0x1fd9cd,'extra':_0x13965f});}});_0x47c5e3['on'](_0x436d('0x18'),function(_0x3c0056){_0x296d0a[_0x436d('0xb')](_0x436d('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x3c0056['code']));});_0x47c5e3['on'](_0x436d('0x19'),function(){_0x296d0a[_0x436d('0xb')](_0x436d('0x19'),new AGIError(_0x436d('0x1a')));});_0x47c5e3['on'](_0x436d('0x1b'),function(){_0x296d0a[_0x436d('0xb')]('timeout',new AGIError(_0x436d('0x1c')));_0x47c5e3['destroy']();});_0x47c5e3[_0x436d('0x1d')](_0x29af36);this['command']=function(_0x3a2019,_0x128f23){var _0x3a2019=_0x3a2019||'',_0x128f23=typeof _0x128f23==_0x436d('0xf')?_0x128f23:new Function();_0x8250e6={'tx':_0x3a2019,'rx':'','cb':_0x128f23};_0x47c5e3[_0x436d('0x1e')](_0x3a2019+'\x0a');},this[_0x436d('0x19')]=function(){_0x47c5e3['destroy']();};}util[_0x436d('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x436d('0x20')][_0x436d('0x21')]=function(_0x5a5ebd){return this['command']['sync'](this,_0x5a5ebd);};AGIChannel['prototype'][_0x436d('0x22')]=function(){return this['sendRequest'](_0x436d('0x23'));};AGIChannel[_0x436d('0x20')]['getData']=function(_0x42b7af,_0x4f4320,_0x545ca5){_0x42b7af=_0x42b7af===undefined?_0x436d('0x24'):_0x42b7af;_0x4f4320=_0x4f4320===undefined?'5':_0x4f4320;_0x545ca5=_0x545ca5===undefined?'1':_0x545ca5;return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x26'),_0x42b7af,_0x4f4320*0x3e8,_0x545ca5));};AGIChannel[_0x436d('0x20')][_0x436d('0x27')]=function(_0x289ef5){_0x289ef5=_0x289ef5||'NO\x20MESSAGE';return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x28'),_0x289ef5));};AGIChannel[_0x436d('0x20')][_0x436d('0x29')]=function(_0x46d447,_0x2002bd){if(_[_0x436d('0x2a')](_0x2002bd)){return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x2b'),_0x46d447,_0x2002bd['join'](',')));}return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x2b'),_0x46d447,_0x2002bd));};AGIChannel[_0x436d('0x20')][_0x436d('0x2c')]=function(_0x44ca84){return this[_0x436d('0x21')](util[_0x436d('0x25')]('SET\x20CONTEXT\x20%s',_0x44ca84));};AGIChannel['prototype']['setExtension']=function(_0x494c4e){return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x2d'),_0x494c4e));};AGIChannel[_0x436d('0x20')][_0x436d('0x2e')]=function(_0x3eef7d){return this['sendRequest'](util[_0x436d('0x25')](_0x436d('0x2f'),_0x3eef7d));};AGIChannel[_0x436d('0x20')][_0x436d('0xd')]=function(){return this['sendRequest'](_0x436d('0x30'));};AGIChannel['prototype']['setVariable']=function(_0x586289,_0x2be28){var _0x25f486=_[_0x436d('0x31')](_0x2be28)||_[_0x436d('0x32')](_0x2be28)?_0x2be28[_0x436d('0x33')]():_0x2be28;return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x34'),_0x586289,_0x25f486?_0x25f486[_0x436d('0x33')]()[_0x436d('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x436d('0x20')][_0x436d('0x35')]=function(_0x453164,_0x5b9ab4){return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x36'),_0x453164,_0x5b9ab4));};AGIChannel[_0x436d('0x20')][_0x436d('0x37')]=function(_0x1027a9,_0x5385f4){return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x38'),_0x1027a9,_0x5385f4));};AGIChannel[_0x436d('0x20')][_0x436d('0x39')]=function(_0x1f1245,_0x36a557){return this['sendRequest'](util['format'](_0x436d('0x3a'),_0x1f1245,_0x36a557));};AGIChannel[_0x436d('0x20')]['continueAt']=function(_0x2e519f,_0x279461,_0x895037){_0x279461=_0x279461||this[_0x436d('0x3b')];_0x895037=_0x895037||0x1;this[_0x436d('0x2c')](_0x2e519f);this[_0x436d('0x3c')](_0x279461);this[_0x436d('0x2e')](_0x895037);return this[_0x436d('0x27')](util[_0x436d('0x25')](_0x436d('0x3d'),_0x2e519f,_0x279461,_0x895037));};AGIChannel[_0x436d('0x20')][_0x436d('0x3e')]=function(_0x78e781){return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x3f'),_0x78e781));};AGIChannel['prototype'][_0x436d('0x40')]=function(_0x4129e6,_0x257be1,_0x3f0c3d,_0x2bc227,_0x1bb171,_0x200baf){_0x257be1=_0x257be1||'wav';_0x3f0c3d=_0x3f0c3d||'';_0x2bc227=_0x2bc227===undefined?-0x1:_0x2bc227==='-1'?-0x1:_0x2bc227*0x3e8;_0x1bb171=_0x1bb171===undefined?'':'s='+_0x1bb171;_0x200baf=_0x200baf?'BEEP':'';return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x41'),_0x4129e6,_0x257be1,_0x3f0c3d,_0x2bc227,_0x200baf,_0x1bb171));};AGIChannel[_0x436d('0x20')][_0x436d('0x42')]=function(_0x36fc4b,_0x3e773a){_0x3e773a=_0x3e773a||'';return this[_0x436d('0x21')](util[_0x436d('0x25')](_0x436d('0x43'),_0x36fc4b,_0x3e773a));};AGIChannel[_0x436d('0x20')]['agi']=function(_0x32fc69){return this['exec'](_0x436d('0x44'),_0x32fc69);};AGIChannel[_0x436d('0x20')][_0x436d('0x45')]=function(_0x1bf8c4){return this[_0x436d('0x29')](_0x436d('0x46'),_0x1bf8c4);};AGIChannel[_0x436d('0x20')][_0x436d('0x18')]=function(_0x1236ca,_0x2e367f){this[_0x436d('0x27')](util[_0x436d('0x25')](_0x436d('0x47'),_0x1236ca['id'],_0x1236ca[_0x436d('0x48')],_0x2e367f));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x436d('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 7026a43..d8134a9 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 _0xbba6=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x5900bb,_0x25ca70){var _0x2e4aeb=function(_0x29a656){while(--_0x29a656){_0x5900bb['push'](_0x5900bb['shift']());}};_0x2e4aeb(++_0x25ca70);}(_0xbba6,0xfc));var _0x6bba=function(_0x21b71f,_0x100202){_0x21b71f=_0x21b71f-0x0;var _0x307cfe=_0xbba6[_0x21b71f];return _0x307cfe;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x6bba('0x0'),'E_AGI_SERVER_ERROR':_0x6bba('0x1'),'E_AGI_SERVER_CLOSE':_0x6bba('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x6bba('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x6bba('0x4'),'E_AGI_SOCKET_ERROR':_0x6bba('0x5'),'E_AGI_SOCKET_CLOSE':_0x6bba('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x6bba('0x7'),'E_AGI_COMMAND_EMPTY':_0x6bba('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x6bba('0x9'),'E_AGI_IVR_ENTRY':_0x6bba('0xa')};function AGIError(_0x256509){var _0x256509=_0x256509||null,_0x4cc303=_0x4cc303||[],_0x14d09e=0x1,_0x505b49='';if(!error[_0x256509]){_0x256509=_0x6bba('0xb');}_0x4cc303[_0x6bba('0xc')](error[_0x256509]);while(arguments[_0x14d09e]){_0x4cc303['push'](arguments[_0x14d09e]);_0x14d09e++;}_0x505b49=util[_0x6bba('0xd')]['apply'](util,_0x4cc303);this[_0x6bba('0xe')]=_0x505b49;this['name']=_0x256509;}module[_0x6bba('0xf')]=AGIError; \ No newline at end of file +var _0x15b7=['Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name'];(function(_0x952e5f,_0x3f3088){var _0x1e005f=function(_0x5b1a4c){while(--_0x5b1a4c){_0x952e5f['push'](_0x952e5f['shift']());}};_0x1e005f(++_0x3f3088);}(_0x15b7,0x142));var _0x715b=function(_0x1cc588,_0x3fe81d){_0x1cc588=_0x1cc588-0x0;var _0x528307=_0x15b7[_0x1cc588];return _0x528307;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x715b('0x0'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x715b('0x1'),'E_AGI_SERVER_CLOSE':_0x715b('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x715b('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x715b('0x4'),'E_AGI_SOCKET_ERROR':_0x715b('0x5'),'E_AGI_SOCKET_CLOSE':_0x715b('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x715b('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x715b('0x8')};function AGIError(_0x1f2742){var _0x1f2742=_0x1f2742||null,_0x3af951=_0x3af951||[],_0x40d46c=0x1,_0x19d35f='';if(!error[_0x1f2742]){_0x1f2742='E_AGI_UNDEFINED';}_0x3af951[_0x715b('0x9')](error[_0x1f2742]);while(arguments[_0x40d46c]){_0x3af951[_0x715b('0x9')](arguments[_0x40d46c]);_0x40d46c++;}_0x19d35f=util[_0x715b('0xa')][_0x715b('0xb')](util,_0x3af951);this[_0x715b('0xc')]=_0x19d35f;this[_0x715b('0xd')]=_0x1f2742;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 35df7e7..d013729 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7128=['subscribe','emit','error','message','E_AGI_SERVER_ERROR','exports','events','ioredis','./error','../../config/environment','redis','defaults'];(function(_0x3950d9,_0x46980c){var _0x52171b=function(_0x576f38){while(--_0x576f38){_0x3950d9['push'](_0x3950d9['shift']());}};_0x52171b(++_0x46980c);}(_0x7128,0xea));var _0x8712=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x7128[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var EventEmitter=require(_0x8712('0x0'))['EventEmitter'];var Redis=require(_0x8712('0x1'));var AGIError=require(_0x8712('0x2'));var config=require(_0x8712('0x3'));config[_0x8712('0x4')]=_[_0x8712('0x5')](config[_0x8712('0x4')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x8712('0x6')]('agi',function(_0x95fc9a){if(_0x95fc9a)return eventEmitter[_0x8712('0x7')](_0x8712('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x95fc9a));});sub['on'](_0x8712('0x9'),function(_0xc1ec,_0x3c1766){if(_0xc1ec!=='agi')return;try{var _0x576519=JSON['parse'](_0x3c1766);eventEmitter[_0x8712('0x7')]('projectUpdate',_0x576519);}catch(_0x29e922){eventEmitter['emit'](_0x8712('0x8'),new AGIError(_0x8712('0xa'),_0x29e922));}});module[_0x8712('0xb')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x7bd6=['emit','error','message','agi','E_AGI_SERVER_ERROR','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7bd6,0x1a9));var _0x67bd=function(_0x3fa631,_0x24392c){_0x3fa631=_0x3fa631-0x0;var _0x5c9dec=_0x7bd6[_0x3fa631];return _0x5c9dec;};'use strict';var _=require(_0x67bd('0x0'));var EventEmitter=require(_0x67bd('0x1'))[_0x67bd('0x2')];var Redis=require(_0x67bd('0x3'));var AGIError=require(_0x67bd('0x4'));var config=require(_0x67bd('0x5'));config[_0x67bd('0x6')]=_[_0x67bd('0x7')](config[_0x67bd('0x6')],{'host':_0x67bd('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x67bd('0x6')]);sub[_0x67bd('0x9')]('agi',function(_0x140552){if(_0x140552)return eventEmitter[_0x67bd('0xa')](_0x67bd('0xb'),new AGIError('E_AGI_SERVER_ERROR',_0x140552));});sub['on'](_0x67bd('0xc'),function(_0x57ec98,_0x48b14c){if(_0x57ec98!==_0x67bd('0xd'))return;try{var _0x70c322=JSON['parse'](_0x48b14c);eventEmitter[_0x67bd('0xa')]('projectUpdate',_0x70c322);}catch(_0x3f0d82){eventEmitter['emit'](_0x67bd('0xb'),new AGIError(_0x67bd('0xe'),_0x3f0d82));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 6144875..643dbaf 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 _0x0f37=['edges','addEdge','push','size','getVertex','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','vswitch','target','default','agicommand','invalid','traverseBFS','condition\x20not\x20found','exports','agi','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','addVertex'];(function(_0x521d82,_0x7a6e68){var _0xd24f2c=function(_0x19db8a){while(--_0x19db8a){_0x521d82['push'](_0x521d82['shift']());}};_0xd24f2c(++_0x7a6e68);}(_0x0f37,0xbc));var _0x70f3=function(_0xdd83e4,_0x356cca){_0xdd83e4=_0xdd83e4-0x0;var _0x5c9bfc=_0x0f37[_0xdd83e4];return _0x5c9bfc;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0x70f3('0x0'));var verticesWithRetry=[_0x70f3('0x1'),_0x70f3('0x2'),_0x70f3('0x3')];var Graph=function(){this[_0x70f3('0x4')]={};this['edges']={};this[_0x70f3('0x5')]=0x0;};Graph[_0x70f3('0x6')][_0x70f3('0x7')]=function(_0x277555){this[_0x70f3('0x4')][_0x277555['id']]=_0x277555;this[_0x70f3('0x8')][_0x277555['id']]=[];};Graph['prototype'][_0x70f3('0x9')]=function(_0x41db87,_0xc9cc3,_0x4b22eb){this[_0x70f3('0x8')][_0x41db87][_0x70f3('0xa')]({'target':_0xc9cc3,'condition':_0x4b22eb});this[_0x70f3('0x5')]+=0x1;};Graph[_0x70f3('0x6')][_0x70f3('0xb')]=function(){return _['size'](this[_0x70f3('0x4')]);};Graph[_0x70f3('0x6')]['relations']=function(){return this[_0x70f3('0x5')];};Graph[_0x70f3('0x6')][_0x70f3('0xc')]=function(_0x5692c7){return this[_0x70f3('0x4')][_0x5692c7];};Graph['prototype']['traverseBFS']=function(_0x12da5c,_0x539d47){if(!this[_0x70f3('0x4')][_0x12da5c]){return logger['info'](_0x70f3('0xd'));}var _0x13baa6=_0x539d47(this[_0x70f3('0x4')][_0x12da5c]);if(!_0x13baa6){return logger[_0x70f3('0xe')](_0x70f3('0xf'));}if(this[_0x70f3('0x8')][_0x12da5c][_0x70f3('0x10')]===0x0){return logger[_0x70f3('0xe')](_0x70f3('0x11'));}for(var _0x2c47e4=0x0,_0x51b283=[],_0x4c6afb=![];_0x2c47e4\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./project','./events','EventEmitter','defaults'];(function(_0x496e59,_0x462efe){var _0x5704b8=function(_0x3ba5a1){while(--_0x3ba5a1){_0x496e59['push'](_0x496e59['shift']());}};_0x5704b8(++_0x462efe);}(_0xbbe1,0xed));var _0x1bbe=function(_0xdf25b2,_0xcb05d0){_0xdf25b2=_0xdf25b2-0x0;var _0x226517=_0xbbe1[_0xdf25b2];return _0x226517;};'use strict';var _=require(_0x1bbe('0x0'));var syncho=require(_0x1bbe('0x1'));var util=require(_0x1bbe('0x2'));var config=require(_0x1bbe('0x3'));var logger=require(_0x1bbe('0x4'))(_0x1bbe('0x5'));var utilLicense=require(_0x1bbe('0x6'));var rpc=require('./rpc');var Project=require(_0x1bbe('0x7'));var AGIEmitter=require(_0x1bbe('0x8'))[_0x1bbe('0x9')];var projects=[];config['agi']=_[_0x1bbe('0xa')](config['agi'],{'ip':_0x1bbe('0xb'),'port':0x11dd});AGIEmitter['on'](_0x1bbe('0xc'),projectUpdateHandler);function connectionHandler(_0x1f17ce){process[_0x1bbe('0xd')](function(){syncho(function(){try{setChannelVariables(_0x1f17ce);agiHandler(_0x1f17ce);}catch(_0x2c5153){logger[_0x1bbe('0xe')](_0x2c5153['stack']);}});});}function projectUpdateHandler(_0x1d571e){try{var _0x36cf62=_[_0x1bbe('0xf')](projects,['id',_0x1d571e['id']]);if(_0x36cf62>-0x1){if(_0x1d571e['deleted']===!![]){projects[_0x1bbe('0x10')](_0x36cf62,0x1);}else{projects[_0x36cf62]=_0x1d571e;}}else{projects[_0x1bbe('0x11')](_0x1d571e);}}catch(_0x57bd7c){logger['error'](_0x57bd7c['stack']);}}function listeningHandler(){var _0x4c20a9=config['env']==='production'||![];console[_0x1bbe('0x12')](_0x1bbe('0x13'),config[_0x1bbe('0x5')][_0x1bbe('0x14')]);logger['info'](util['format'](_0x1bbe('0x15'),_0x4c20a9?config[_0x1bbe('0x5')]['ip']:_0x1bbe('0x16'),config['agi'][_0x1bbe('0x14')]));}function errorHandler(_0x12aef0){if(_0x12aef0&&_0x12aef0['name']&&_0x12aef0[_0x1bbe('0x17')]){logger[_0x1bbe('0xe')](util[_0x1bbe('0x18')]('[%s]\x20%s',_0x12aef0[_0x1bbe('0x19')],_0x12aef0[_0x1bbe('0x17')]));}else{logger['error'](util[_0x1bbe('0x18')]('[ERROR]\x20%s',_0x12aef0[_0x1bbe('0x1a')]));}}function closeHandler(){logger['info'](util[_0x1bbe('0x18')](_0x1bbe('0x1b'),this[_0x1bbe('0x1c')],this[_0x1bbe('0x1d')],this[_0x1bbe('0x1e')],this[_0x1bbe('0x1f')],this[_0x1bbe('0x20')]));try{createSquareReport(this);}catch(_0x19b61c){logger['error'](_0x19b61c['stack']);}}function timeoutHandler(){logger[_0x1bbe('0x21')](util[_0x1bbe('0x18')](_0x1bbe('0x22'),this[_0x1bbe('0x1c')],this['calleridname'],this['callerid'],this[_0x1bbe('0x1f')],this[_0x1bbe('0x20')]));}function hangupHandler(){logger['info'](util[_0x1bbe('0x18')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1bbe('0x1c')],this[_0x1bbe('0x1d')],this[_0x1bbe('0x1e')],this['dnid'],this[_0x1bbe('0x20')]));this[_0x1bbe('0x23')]=!![];}function createSquareReport(_0x19ad66,_0x3b7a89){rpc[_0x1bbe('0x24')](_0x19ad66)[_0x1bbe('0x25')](function(_0xe5a607){if(_0x3b7a89){_0x3b7a89(null,_0xe5a607);}})[_0x1bbe('0x26')](function(_0x4d29f8){if(_0x3b7a89){_0x3b7a89(null,_0x4d29f8);}});}function setChannelVariables(_0x8d02e9){for(var _0x1b793d in _0x8d02e9){if(_0x8d02e9[_0x1bbe('0x27')](_0x1b793d)){if(_0x1b793d[_0x1bbe('0x28')](_0x1bbe('0x29'))===0x0){_0x8d02e9[_0x1b793d[_0x1bbe('0x2a')](0x4)]=_0x8d02e9[_0x1b793d];delete _0x8d02e9[_0x1b793d];}}}}function agiHandler(_0x171530){logger[_0x1bbe('0x2b')]('variables',JSON[_0x1bbe('0x2c')](_0x171530,null,0x2));logger[_0x1bbe('0x21')](util[_0x1bbe('0x18')](_0x1bbe('0x2d'),_0x171530[_0x1bbe('0x1c')],_0x171530['calleridname'],_0x171530[_0x1bbe('0x1e')],_0x171530[_0x1bbe('0x1f')],_0x171530[_0x1bbe('0x20')]));_0x171530['on'](_0x1bbe('0xe'),errorHandler);_0x171530['on'](_0x1bbe('0x2e'),closeHandler);_0x171530['on'](_0x1bbe('0x2f'),timeoutHandler);_0x171530[_0x1bbe('0x23')]=![];_0x171530['on'](_0x1bbe('0x30'),hangupHandler);var _0x5e31bd=_['find'](projects,[_0x1bbe('0x19'),_0x171530['arg_1']]);if(!_0x5e31bd)return Project['handleNotFound'](_0x171530);if(!_0x5e31bd[_0x1bbe('0x31')])return Project['handleUnpublished'](_0x171530);return Project[_0x1bbe('0x32')](_0x5e31bd,_0x171530);}function main(){var _0x4a3d0f;return utilLicense[_0x1bbe('0x33')]()[_0x1bbe('0x25')](function(_0x18d600){if(!_0x18d600)return;if(_0x18d600[_0x1bbe('0x34')]){if(_0x18d600[_0x1bbe('0x35')]&&_0x18d600[_0x1bbe('0x35')]>0x0){logger[_0x1bbe('0x21')](util[_0x1bbe('0x18')](_0x1bbe('0x36'),_0x18d600['callysquare']));_0x4a3d0f=_0x18d600[_0x1bbe('0x35')];}else{logger[_0x1bbe('0x21')](_0x1bbe('0x37'));}}else{logger[_0x1bbe('0x21')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x4a3d0f=-0x1;}})['then'](function(){return Project[_0x1bbe('0x38')]();})[_0x1bbe('0x25')](function(_0x4aca53){projects=_0x4aca53;return;})['catch'](function(_0x10c457){logger[_0x1bbe('0xe')](_0x1bbe('0x39'),_0x10c457[_0x1bbe('0x1a')]);})[_0x1bbe('0x3a')](function(){var _0x44cdec=require(_0x1bbe('0x3b'))(config[_0x1bbe('0x5')][_0x1bbe('0x14')],config[_0x1bbe('0x5')]['ip'],_0x4a3d0f);_0x44cdec['on'](_0x1bbe('0xe'),errorHandler);_0x44cdec['on'](_0x1bbe('0x3c'),listeningHandler);_0x44cdec['on'](_0x1bbe('0x3d'),connectionHandler);_0x44cdec['on'](_0x1bbe('0x2e'),closeHandler);});}main(); \ No newline at end of file +var _0x7c5d=['variables','close','hangup','handleNotFound','production','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','connection','lodash','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./rpc','./project','EventEmitter','agi','defaults','127.0.0.1','error','stack','findIndex','deleted','splice','push','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','name','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','evtHangup','createSquareReport','then','indexOf','agi_','substring','debug'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x7c5d,0xe6));var _0xd7c5=function(_0x2566c6,_0x5ef6e2){_0x2566c6=_0x2566c6-0x0;var _0x23dac4=_0x7c5d[_0x2566c6];return _0x23dac4;};'use strict';var _=require(_0xd7c5('0x0'));var syncho=require(_0xd7c5('0x1'));var util=require(_0xd7c5('0x2'));var config=require(_0xd7c5('0x3'));var logger=require(_0xd7c5('0x4'))('agi');var utilLicense=require(_0xd7c5('0x5'));var rpc=require(_0xd7c5('0x6'));var Project=require(_0xd7c5('0x7'));var AGIEmitter=require('./events')[_0xd7c5('0x8')];var projects=[];config[_0xd7c5('0x9')]=_[_0xd7c5('0xa')](config[_0xd7c5('0x9')],{'ip':_0xd7c5('0xb'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x40c66b){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x40c66b);agiHandler(_0x40c66b);}catch(_0x2ca4f7){logger[_0xd7c5('0xc')](_0x2ca4f7[_0xd7c5('0xd')]);}});});}function projectUpdateHandler(_0x2e6c53){try{var _0x241cb2=_[_0xd7c5('0xe')](projects,['id',_0x2e6c53['id']]);if(_0x241cb2>-0x1){if(_0x2e6c53[_0xd7c5('0xf')]===!![]){projects[_0xd7c5('0x10')](_0x241cb2,0x1);}else{projects[_0x241cb2]=_0x2e6c53;}}else{projects[_0xd7c5('0x11')](_0x2e6c53);}}catch(_0x49b210){logger[_0xd7c5('0xc')](_0x49b210[_0xd7c5('0xd')]);}}function listeningHandler(){var _0x59639f=config['env']==='production'||![];console[_0xd7c5('0x12')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xd7c5('0x9')][_0xd7c5('0x13')]);logger[_0xd7c5('0x14')](util[_0xd7c5('0x15')](_0xd7c5('0x16'),_0x59639f?config[_0xd7c5('0x9')]['ip']:'host.docker.internal',config[_0xd7c5('0x9')][_0xd7c5('0x13')]));}function errorHandler(_0x212bb){if(_0x212bb&&_0x212bb['name']&&_0x212bb[_0xd7c5('0x17')]){logger[_0xd7c5('0xc')](util['format']('[%s]\x20%s',_0x212bb[_0xd7c5('0x18')],_0x212bb[_0xd7c5('0x17')]));}else{logger[_0xd7c5('0xc')](util['format'](_0xd7c5('0x19'),_0x212bb[_0xd7c5('0xd')]));}}function closeHandler(){logger[_0xd7c5('0x14')](util[_0xd7c5('0x15')](_0xd7c5('0x1a'),this[_0xd7c5('0x1b')],this[_0xd7c5('0x1c')],this['callerid'],this['dnid'],this[_0xd7c5('0x1d')]));try{createSquareReport(this);}catch(_0x535a5a){logger[_0xd7c5('0xc')](_0x535a5a[_0xd7c5('0xd')]);}}function timeoutHandler(){logger['info'](util[_0xd7c5('0x15')](_0xd7c5('0x1e'),this['arg_1'],this[_0xd7c5('0x1c')],this[_0xd7c5('0x1f')],this[_0xd7c5('0x20')],this[_0xd7c5('0x1d')]));}function hangupHandler(){logger[_0xd7c5('0x14')](util[_0xd7c5('0x15')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd7c5('0x1b')],this[_0xd7c5('0x1c')],this[_0xd7c5('0x1f')],this['dnid'],this['uniqueid']));this[_0xd7c5('0x21')]=!![];}function createSquareReport(_0x32c746,_0x246eff){rpc[_0xd7c5('0x22')](_0x32c746)[_0xd7c5('0x23')](function(_0x355043){if(_0x246eff){_0x246eff(null,_0x355043);}})['catch'](function(_0x4592cf){if(_0x246eff){_0x246eff(null,_0x4592cf);}});}function setChannelVariables(_0x803fe9){for(var _0x353153 in _0x803fe9){if(_0x803fe9['hasOwnProperty'](_0x353153)){if(_0x353153[_0xd7c5('0x24')](_0xd7c5('0x25'))===0x0){_0x803fe9[_0x353153[_0xd7c5('0x26')](0x4)]=_0x803fe9[_0x353153];delete _0x803fe9[_0x353153];}}}}function agiHandler(_0x250ee5){logger[_0xd7c5('0x27')](_0xd7c5('0x28'),JSON['stringify'](_0x250ee5,null,0x2));logger[_0xd7c5('0x14')](util[_0xd7c5('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x250ee5['arg_1'],_0x250ee5['calleridname'],_0x250ee5['callerid'],_0x250ee5[_0xd7c5('0x20')],_0x250ee5[_0xd7c5('0x1d')]));_0x250ee5['on'](_0xd7c5('0xc'),errorHandler);_0x250ee5['on'](_0xd7c5('0x29'),closeHandler);_0x250ee5['on']('timeout',timeoutHandler);_0x250ee5[_0xd7c5('0x21')]=![];_0x250ee5['on'](_0xd7c5('0x2a'),hangupHandler);var _0x1f14f4=_['find'](projects,[_0xd7c5('0x18'),_0x250ee5[_0xd7c5('0x1b')]]);if(!_0x1f14f4)return Project[_0xd7c5('0x2b')](_0x250ee5);if(!_0x1f14f4[_0xd7c5('0x2c')])return Project['handleUnpublished'](_0x250ee5);return Project[_0xd7c5('0x2d')](_0x1f14f4,_0x250ee5);}function main(){var _0x52f41a;return utilLicense['getLicense']()[_0xd7c5('0x23')](function(_0x41a399){if(!_0x41a399)return;if(_0x41a399[_0xd7c5('0x2e')]){if(_0x41a399['callysquare']&&_0x41a399[_0xd7c5('0x2f')]>0x0){logger[_0xd7c5('0x14')](util[_0xd7c5('0x15')](_0xd7c5('0x30'),_0x41a399[_0xd7c5('0x2f')]));_0x52f41a=_0x41a399[_0xd7c5('0x2f')];}else{logger[_0xd7c5('0x14')](_0xd7c5('0x31'));}}else{logger[_0xd7c5('0x14')](_0xd7c5('0x32'));_0x52f41a=-0x1;}})[_0xd7c5('0x23')](function(){return Project['getAll']();})[_0xd7c5('0x23')](function(_0x1910c9){projects=_0x1910c9;return;})['catch'](function(_0x63fb2d){logger[_0xd7c5('0xc')](_0xd7c5('0x33'),_0x63fb2d[_0xd7c5('0xd')]);})[_0xd7c5('0x34')](function(){var _0x10a2d8=require('./server')(config[_0xd7c5('0x9')][_0xd7c5('0x13')],config[_0xd7c5('0x9')]['ip'],_0x52f41a);_0x10a2d8['on'](_0xd7c5('0xc'),errorHandler);_0x10a2d8['on']('listening',listeningHandler);_0x10a2d8['on'](_0xd7c5('0x35'),connectionHandler);_0x10a2d8['on'](_0xd7c5('0x29'),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 87bc7e6..c7e46b0 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 _0x2dd1=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x4a0590,_0x12c19d){var _0x511f87=function(_0x1cd8e0){while(--_0x1cd8e0){_0x4a0590['push'](_0x4a0590['shift']());}};_0x511f87(++_0x12c19d);}(_0x2dd1,0x1f0));var _0x12dd=function(_0x352051,_0x40073f){_0x352051=_0x352051-0x0;var _0x2b6179=_0x2dd1[_0x352051];return _0x2b6179;};'use strict';var BPromise=require(_0x12dd('0x0'));var jayson=require(_0x12dd('0x1'));var client=jayson[_0x12dd('0x2')][_0x12dd('0x3')]({'port':0x232b});function request(_0x529908,_0x14bf08){return new BPromise(function(_0x56e471,_0x41d8f4){return client[_0x12dd('0x4')](_0x529908,_0x14bf08)[_0x12dd('0x5')](function(_0x77c0a){if(_0x77c0a[_0x12dd('0x6')]){return _0x41d8f4(_0x77c0a[_0x12dd('0x6')][_0x12dd('0x7')]);}else{return _0x56e471(_0x77c0a[_0x12dd('0x8')]);}})[_0x12dd('0x9')](function(_0x1e553b){return _0x41d8f4(_0x1e553b);});});}exports[_0x12dd('0xa')]=function(_0x2eb51a,_0x7d172c){return request(_0x12dd('0xb'),{'account':_0x2eb51a,'message':_0x7d172c});}; \ No newline at end of file +var _0x516b=['bluebird','jayson/promise','http','request','then','error','result','sendMailMessage','SendMail'];(function(_0x30c1e5,_0x5727fd){var _0x507f46=function(_0x2e85e0){while(--_0x2e85e0){_0x30c1e5['push'](_0x30c1e5['shift']());}};_0x507f46(++_0x5727fd);}(_0x516b,0x195));var _0xb516=function(_0x481b2c,_0x293b7a){_0x481b2c=_0x481b2c-0x0;var _0x676fa5=_0x516b[_0x481b2c];return _0x676fa5;};'use strict';var BPromise=require(_0xb516('0x0'));var jayson=require(_0xb516('0x1'));var client=jayson['client'][_0xb516('0x2')]({'port':0x232b});function request(_0x10a9ee,_0x2dd3b9){return new BPromise(function(_0x2726f0,_0x44f073){return client[_0xb516('0x3')](_0x10a9ee,_0x2dd3b9)[_0xb516('0x4')](function(_0x4056b9){if(_0x4056b9['error']){return _0x44f073(_0x4056b9[_0xb516('0x5')]['message']);}else{return _0x2726f0(_0x4056b9[_0xb516('0x6')]);}})['catch'](function(_0x443992){return _0x44f073(_0x443992);});});}exports[_0xb516('0x7')]=function(_0x2e28c7,_0x3667d3){return request(_0xb516('0x8'),{'account':_0x2e28c7,'message':_0x3667d3});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 869e105..32ef5e7 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b0c=['[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','value','toJson','mxGraphModel','inspect','production','start','debug','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','arg_1','callerid','dnid','uniqueid','traverseBFS','stringify','context','extension','priority','response','code','result','evtHangup','isUndefined','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','vertex'];(function(_0x1a36e0,_0x646221){var _0x33c254=function(_0x11fda9){while(--_0x11fda9){_0x1a36e0['push'](_0x1a36e0['shift']());}};_0x33c254(++_0x646221);}(_0x8b0c,0x80));var _0xc8b0=function(_0x4baa80,_0x43e743){_0x4baa80=_0x4baa80-0x0;var _0x2a123a=_0x8b0c[_0x4baa80];return _0x2a123a;};'use strict';var _=require(_0xc8b0('0x0'));var moment=require(_0xc8b0('0x1'));var parser=require(_0xc8b0('0x2'));var util=require(_0xc8b0('0x3'));var logger=require(_0xc8b0('0x4'))(_0xc8b0('0x5'));var rpc=require(_0xc8b0('0x6'));var mailRpc=require(_0xc8b0('0x7'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xc8b0('0x8')]()['catch'](function(_0x1e8c23){logger[_0xc8b0('0x9')](_0xc8b0('0xa'),_0x1e8c23[_0xc8b0('0xb')]);return[];});}function addVertex(_0x212d37,_0xbc7957,_0x47372b){_0xbc7957[_0xc8b0('0xc')]=_0x47372b;if(_0xbc7957[_0xc8b0('0xd')](_0xc8b0('0xe'))){_0xbc7957[_0xc8b0('0xf')]=parseInt(_0xbc7957[_0xc8b0('0xe')],0xa);}_0x212d37[_0xc8b0('0x10')](_[_0xc8b0('0x11')](_0xbc7957,_0xc8b0('0x12')));}function initGraph(_0x2651ac,_0xf26f2b){var _0x26699a=new Graph();for(var _0x299c7c in _0x2651ac){if(_0x2651ac['hasOwnProperty'](_0x299c7c)){if(_[_0xc8b0('0x13')](_0x2651ac[_0x299c7c])){for(var _0x340584=0x0;_0x340584<_0x2651ac[_0x299c7c][_0xc8b0('0x14')];_0x340584+=0x1){addVertex(_0x26699a,_0x2651ac[_0x299c7c][_0x340584],_0x299c7c);}}else{addVertex(_0x26699a,_0x2651ac[_0x299c7c],_0x299c7c);}}}for(var _0x50c9cd=0x0;_0x50c9cd<_0xf26f2b['length'];_0x50c9cd+=0x1){if(_0xf26f2b[_0x50c9cd]['source']&&_0xf26f2b[_0x50c9cd][_0xc8b0('0x15')]){_0x26699a[_0xc8b0('0x16')](_0xf26f2b[_0x50c9cd][_0xc8b0('0x17')],_0xf26f2b[_0x50c9cd][_0xc8b0('0x15')],_0xf26f2b[_0x50c9cd][_0xc8b0('0x18')]);}}return _0x26699a;}function getRoot(_0x5b4ba1){return parser[_0xc8b0('0x19')](_0x5b4ba1,{'object':!![]})[_0xc8b0('0x1a')]['root'];}function inspect(_0x1bb785){return util[_0xc8b0('0x1b')](_0x1bb785,{'showHidden':![],'depth':null});}function initialize(_0x32e5d9,_0x750584){var _0x5c090d=getRoot(_0x32e5d9[_0xc8b0('0x1c')]);if(!_0x5c090d||!_0x5c090d[_0xc8b0('0x1d')])return;var _0x34a3b3,_0x2cc869,_0x1b0059;logger[_0xc8b0('0x1e')](_0xc8b0('0x1f'),JSON['stringify'](_0x5c090d,null,0x2));_0x750584[_0xc8b0('0x20')]=moment()['format'](_0xc8b0('0x21'));_0x34a3b3=initGraph(_['omit'](_0x5c090d,_0xc8b0('0x12')),_0x5c090d[_0xc8b0('0x12')]);_0x2cc869=new Vertices(_0x750584,rpc,mailRpc);logger[_0xc8b0('0x22')](util[_0xc8b0('0x23')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x750584[_0xc8b0('0x24')],_0x750584['calleridname'],_0x750584[_0xc8b0('0x25')],_0x750584[_0xc8b0('0x26')],_0x750584[_0xc8b0('0x27')]));_0x34a3b3[_0xc8b0('0x28')](_0x5c090d[_0xc8b0('0x1d')]['id'],function(_0x4976a6){try{_0x4976a6=_0x2cc869['clear'](_0x4976a6);logger['debug']('vertex',JSON[_0xc8b0('0x29')](_0x4976a6,null,0x2));if(_0x4976a6[_0xc8b0('0xc')]==='gotoc'){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x750584[_0xc8b0('0x2a')]=_0x4976a6[_0xc8b0('0x2a')]||_0x750584[_0xc8b0('0x2a')];_0x750584[_0xc8b0('0x2b')]=_0x4976a6[_0xc8b0('0x2b')];_0x750584[_0xc8b0('0x2c')]=_0x4976a6[_0xc8b0('0x2c')]?_0x4976a6[_0xc8b0('0x2c')]-0x1:0x1;return null;}else if(_0x4976a6&&_0x2cc869[_0x4976a6[_0xc8b0('0xc')]]){_0x1b0059=_0x2cc869[_0x4976a6['agicommand']](_0x4976a6);logger['info'](_0xc8b0('0x2d'),JSON[_0xc8b0('0x29')](_0x1b0059,null,0x2));if(_0x1b0059&&_0x1b0059[_0xc8b0('0x2e')]===AGI_CODE_SUCCESS&&_0x1b0059[_0xc8b0('0x2f')]!==AGI_RESULT_ERROR&&!_0x750584[_0xc8b0('0x30')]){logger['debug'](_0xc8b0('0x2d'),inspect(_0x1b0059));return _[_0xc8b0('0x31')](_0x1b0059[_0xc8b0('0x2f')])?null:_0x1b0059['result'][_0xc8b0('0x32')]();}else{logger[_0xc8b0('0x9')](_0xc8b0('0x2d'),inspect(_0x1b0059));return null;}}else{logger['error'](_0xc8b0('0x33'));return null;}}catch(_0x1b8b7f){logger[_0xc8b0('0x9')](_0x1b8b7f[_0xc8b0('0xb')]);return null;}});if(_0x5c090d[_0xc8b0('0x34')]){logger[_0xc8b0('0x22')](util[_0xc8b0('0x23')](_0xc8b0('0x35'),_0x750584[_0xc8b0('0x24')],_0x750584['calleridname'],_0x750584[_0xc8b0('0x25')],_0x750584[_0xc8b0('0x26')],_0x750584[_0xc8b0('0x27')]));_0x34a3b3[_0xc8b0('0x28')](_0x5c090d[_0xc8b0('0x34')]['id'],function(_0x194f5a){try{_0x194f5a=_0x2cc869['clear'](_0x194f5a);logger['debug'](_0xc8b0('0x36'),JSON[_0xc8b0('0x29')](_0x194f5a,null,0x2));if(_0x194f5a&&_0x2cc869[_0x194f5a[_0xc8b0('0xc')]]){_0x1b0059=_0x2cc869[_0x194f5a[_0xc8b0('0xc')]](_0x194f5a);if(_0x1b0059){logger[_0xc8b0('0x1e')](_0xc8b0('0x2d'),inspect(_0x1b0059));return _[_0xc8b0('0x31')](_0x1b0059['result'])?null:_0x1b0059[_0xc8b0('0x2f')][_0xc8b0('0x32')]();}else{logger['error'](_0xc8b0('0x2d'),inspect(_0x1b0059));return null;}}else{logger[_0xc8b0('0x9')](_0xc8b0('0x33'));return null;}}catch(_0x5b4ded){logger[_0xc8b0('0x9')](_0x5b4ded[_0xc8b0('0xb')]);return null;}});}logger['info'](util[_0xc8b0('0x23')](_0xc8b0('0x37'),_0x750584[_0xc8b0('0x24')],_0x750584['calleridname'],_0x750584[_0xc8b0('0x25')],_0x750584[_0xc8b0('0x26')],_0x750584['uniqueid']));logger[_0xc8b0('0x22')](util[_0xc8b0('0x23')](_0xc8b0('0x38'),_0x750584[_0xc8b0('0x2a')],_0x750584[_0xc8b0('0x2b')],parseInt(_0x750584['priority'],0xa)+0x1));_0x750584[_0xc8b0('0x39')](_0x750584[_0xc8b0('0x2a')],_0x750584[_0xc8b0('0x2b')],parseInt(_0x750584['priority'],0xa)+0x1);_0x750584[_0xc8b0('0x3a')]();}function handleNotFound(_0x39dd2c){logger[_0xc8b0('0x9')](util[_0xc8b0('0x23')](_0xc8b0('0x3b'),_0x39dd2c[_0xc8b0('0x24')]));_0x39dd2c[_0xc8b0('0x39')](_0x39dd2c['context'],_0x39dd2c[_0xc8b0('0x2b')],parseInt(_0x39dd2c[_0xc8b0('0x2c')],0xa)+0x1);_0x39dd2c[_0xc8b0('0x3a')]();}function handleUnpublished(_0x4c78e4){logger['error'](util[_0xc8b0('0x23')]('Project\x20%s\x20not\x20published',_0x4c78e4['arg_1']));_0x4c78e4[_0xc8b0('0x39')](_0x4c78e4[_0xc8b0('0x2a')],_0x4c78e4[_0xc8b0('0x2b')],parseInt(_0x4c78e4[_0xc8b0('0x2c')],0xa)+0x1);_0x4c78e4[_0xc8b0('0x3a')]();}module[_0xc8b0('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xef68=['format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','context','extension','priority','code','result','evtHangup','response','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[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\x20found','close','Project\x20%s\x20not\x20published','exports','lodash','xml2json','../../config/logger','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','addEdge','target','toJson','mxGraphModel','root','production','start','debug','stringify','joinAt'];(function(_0x878bbc,_0x548a12){var _0x12cd2a=function(_0x4bb213){while(--_0x4bb213){_0x878bbc['push'](_0x878bbc['shift']());}};_0x12cd2a(++_0x548a12);}(_0xef68,0x194));var _0x8ef6=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xef68[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0x8ef6('0x0'));var moment=require('moment');var parser=require(_0x8ef6('0x1'));var util=require('util');var logger=require(_0x8ef6('0x2'))('agi');var rpc=require(_0x8ef6('0x3'));var mailRpc=require(_0x8ef6('0x4'));var Graph=require(_0x8ef6('0x5'));var Vertices=require(_0x8ef6('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x8ef6('0x7')]()[_0x8ef6('0x8')](function(_0x194b29){logger[_0x8ef6('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x194b29[_0x8ef6('0xa')]);return[];});}function addVertex(_0x483d31,_0x417129,_0x381955){_0x417129[_0x8ef6('0xb')]=_0x381955;if(_0x417129[_0x8ef6('0xc')](_0x8ef6('0xd'))){_0x417129[_0x8ef6('0xe')]=parseInt(_0x417129[_0x8ef6('0xd')],0xa);}_0x483d31[_0x8ef6('0xf')](_[_0x8ef6('0x10')](_0x417129,'mxCell'));}function initGraph(_0xf7353e,_0x35370f){var _0x382857=new Graph();for(var _0xac54fb in _0xf7353e){if(_0xf7353e[_0x8ef6('0xc')](_0xac54fb)){if(_[_0x8ef6('0x11')](_0xf7353e[_0xac54fb])){for(var _0xd2805=0x0;_0xd2805<_0xf7353e[_0xac54fb][_0x8ef6('0x12')];_0xd2805+=0x1){addVertex(_0x382857,_0xf7353e[_0xac54fb][_0xd2805],_0xac54fb);}}else{addVertex(_0x382857,_0xf7353e[_0xac54fb],_0xac54fb);}}}for(var _0xde56c2=0x0;_0xde56c2<_0x35370f[_0x8ef6('0x12')];_0xde56c2+=0x1){if(_0x35370f[_0xde56c2][_0x8ef6('0x13')]&&_0x35370f[_0xde56c2]['target']){_0x382857[_0x8ef6('0x14')](_0x35370f[_0xde56c2][_0x8ef6('0x13')],_0x35370f[_0xde56c2][_0x8ef6('0x15')],_0x35370f[_0xde56c2]['value']);}}return _0x382857;}function getRoot(_0x3161e2){return parser[_0x8ef6('0x16')](_0x3161e2,{'object':!![]})[_0x8ef6('0x17')][_0x8ef6('0x18')];}function inspect(_0x19642f){return util['inspect'](_0x19642f,{'showHidden':![],'depth':null});}function initialize(_0x20041e,_0x3c38b3){var _0x47e661=getRoot(_0x20041e[_0x8ef6('0x19')]);if(!_0x47e661||!_0x47e661[_0x8ef6('0x1a')])return;var _0x2a3d0b,_0x2df3ac,_0x3008de;logger[_0x8ef6('0x1b')]('root',JSON[_0x8ef6('0x1c')](_0x47e661,null,0x2));_0x3c38b3[_0x8ef6('0x1d')]=moment()[_0x8ef6('0x1e')](_0x8ef6('0x1f'));_0x2a3d0b=initGraph(_[_0x8ef6('0x10')](_0x47e661,_0x8ef6('0x20')),_0x47e661[_0x8ef6('0x20')]);_0x2df3ac=new Vertices(_0x3c38b3,rpc,mailRpc);logger[_0x8ef6('0x21')](util[_0x8ef6('0x1e')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3c38b3[_0x8ef6('0x22')],_0x3c38b3[_0x8ef6('0x23')],_0x3c38b3[_0x8ef6('0x24')],_0x3c38b3[_0x8ef6('0x25')],_0x3c38b3[_0x8ef6('0x26')]));_0x2a3d0b[_0x8ef6('0x27')](_0x47e661[_0x8ef6('0x1a')]['id'],function(_0xa098d){try{_0xa098d=_0x2df3ac[_0x8ef6('0x28')](_0xa098d);logger[_0x8ef6('0x1b')](_0x8ef6('0x29'),JSON[_0x8ef6('0x1c')](_0xa098d,null,0x2));if(_0xa098d[_0x8ef6('0xb')]===_0x8ef6('0x2a')){logger[_0x8ef6('0x21')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x3c38b3[_0x8ef6('0x2b')]=_0xa098d['context']||_0x3c38b3['context'];_0x3c38b3[_0x8ef6('0x2c')]=_0xa098d[_0x8ef6('0x2c')];_0x3c38b3[_0x8ef6('0x2d')]=_0xa098d[_0x8ef6('0x2d')]?_0xa098d[_0x8ef6('0x2d')]-0x1:0x1;return null;}else if(_0xa098d&&_0x2df3ac[_0xa098d['agicommand']]){_0x3008de=_0x2df3ac[_0xa098d[_0x8ef6('0xb')]](_0xa098d);logger[_0x8ef6('0x21')]('response',JSON[_0x8ef6('0x1c')](_0x3008de,null,0x2));if(_0x3008de&&_0x3008de[_0x8ef6('0x2e')]===AGI_CODE_SUCCESS&&_0x3008de[_0x8ef6('0x2f')]!==AGI_RESULT_ERROR&&!_0x3c38b3[_0x8ef6('0x30')]){logger['debug'](_0x8ef6('0x31'),inspect(_0x3008de));return _[_0x8ef6('0x32')](_0x3008de[_0x8ef6('0x2f')])?null:_0x3008de[_0x8ef6('0x2f')][_0x8ef6('0x33')]();}else{logger['error']('response',inspect(_0x3008de));return null;}}else{logger[_0x8ef6('0x9')](_0x8ef6('0x34'));return null;}}catch(_0x21c5f9){logger['error'](_0x21c5f9[_0x8ef6('0xa')]);return null;}});if(_0x47e661['finally']){logger['info'](util[_0x8ef6('0x1e')](_0x8ef6('0x35'),_0x3c38b3[_0x8ef6('0x22')],_0x3c38b3[_0x8ef6('0x23')],_0x3c38b3[_0x8ef6('0x24')],_0x3c38b3[_0x8ef6('0x25')],_0x3c38b3[_0x8ef6('0x26')]));_0x2a3d0b[_0x8ef6('0x27')](_0x47e661[_0x8ef6('0x36')]['id'],function(_0xc28b35){try{_0xc28b35=_0x2df3ac[_0x8ef6('0x28')](_0xc28b35);logger[_0x8ef6('0x1b')](_0x8ef6('0x29'),JSON[_0x8ef6('0x1c')](_0xc28b35,null,0x2));if(_0xc28b35&&_0x2df3ac[_0xc28b35[_0x8ef6('0xb')]]){_0x3008de=_0x2df3ac[_0xc28b35[_0x8ef6('0xb')]](_0xc28b35);if(_0x3008de){logger[_0x8ef6('0x1b')]('response',inspect(_0x3008de));return _[_0x8ef6('0x32')](_0x3008de[_0x8ef6('0x2f')])?null:_0x3008de[_0x8ef6('0x2f')][_0x8ef6('0x33')]();}else{logger[_0x8ef6('0x9')](_0x8ef6('0x31'),inspect(_0x3008de));return null;}}else{logger[_0x8ef6('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x30ad3a){logger[_0x8ef6('0x9')](_0x30ad3a[_0x8ef6('0xa')]);return null;}});}logger[_0x8ef6('0x21')](util['format'](_0x8ef6('0x37'),_0x3c38b3[_0x8ef6('0x22')],_0x3c38b3[_0x8ef6('0x23')],_0x3c38b3[_0x8ef6('0x24')],_0x3c38b3[_0x8ef6('0x25')],_0x3c38b3['uniqueid']));logger[_0x8ef6('0x21')](util['format'](_0x8ef6('0x38'),_0x3c38b3[_0x8ef6('0x2b')],_0x3c38b3[_0x8ef6('0x2c')],parseInt(_0x3c38b3[_0x8ef6('0x2d')],0xa)+0x1));_0x3c38b3[_0x8ef6('0x39')](_0x3c38b3[_0x8ef6('0x2b')],_0x3c38b3['extension'],parseInt(_0x3c38b3[_0x8ef6('0x2d')],0xa)+0x1);_0x3c38b3['close']();}function handleNotFound(_0x59236d){logger[_0x8ef6('0x9')](util[_0x8ef6('0x1e')](_0x8ef6('0x3a'),_0x59236d['arg_1']));_0x59236d[_0x8ef6('0x39')](_0x59236d[_0x8ef6('0x2b')],_0x59236d['extension'],parseInt(_0x59236d[_0x8ef6('0x2d')],0xa)+0x1);_0x59236d[_0x8ef6('0x3b')]();}function handleUnpublished(_0xb6e73a){logger[_0x8ef6('0x9')](util[_0x8ef6('0x1e')](_0x8ef6('0x3c'),_0xb6e73a['arg_1']));_0xb6e73a['continueAt'](_0xb6e73a['context'],_0xb6e73a[_0x8ef6('0x2c')],parseInt(_0xb6e73a['priority'],0xa)+0x1);_0xb6e73a[_0x8ef6('0x3b')]();}module[_0x8ef6('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 6340a5b..a0c2872 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 _0xfb00=['headers','exports','util','Transform','call','_localBuffer','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','split','trim','slice','length','emit'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0xfb00,0x167));var _0x0fb0=function(_0x29c3ff,_0x20cdb0){_0x29c3ff=_0x29c3ff-0x0;var _0x372b5c=_0xfb00[_0x29c3ff];return _0x372b5c;};'use strict';var util=require(_0x0fb0('0x0'));var Transform=require('stream')[_0x0fb0('0x1')];function AGIReply(_0x2d5275){Transform[_0x0fb0('0x2')](this,_0x2d5275);this[_0x0fb0('0x3')]='';this[_0x0fb0('0x4')]=![];}util[_0x0fb0('0x5')](AGIReply,Transform);AGIReply['prototype'][_0x0fb0('0x6')]=function(_0x67d397,_0x54906a,_0x36b595){var _0x3123eb='\x0a',_0x5e20ce=['\x0a\x0a',_0x0fb0('0x7')],_0x482061=-0x1,_0x593507=-0x1,_0x4ebadb='',_0x124b7b=0x0,_0x28b5de='',_0x4e131e='';this[_0x0fb0('0x3')]+=_0x67d397['toString']();_0x28b5de=this['_localBuffer'];if(!this[_0x0fb0('0x4')]){_0x124b7b=0x0;while(_0x5e20ce[_0x124b7b]){while((_0x593507=_0x28b5de[_0x0fb0('0x8')](_0x5e20ce[_0x124b7b]))!=-0x1){_0x4ebadb=_0x5e20ce[_0x124b7b];_0x4e131e=_0x28b5de[_0x0fb0('0x9')](0x0,_0x593507);_0x28b5de=_0x28b5de[_0x0fb0('0x9')](_0x593507+_0x4ebadb['length']);var _0x5eeb68=_0x4e131e[_0x0fb0('0xa')](_0x3123eb),_0x534534=0x0,_0x53aa3e={},_0x317bbe='',_0xe400ba='',_0x1dc6ca=-0x1;while(_0x5eeb68[_0x534534]){_0x1dc6ca=_0x5eeb68[_0x534534][_0x0fb0('0x8')](':');if(_0x1dc6ca!=-0x1){_0x317bbe=_0x5eeb68[_0x534534]['slice'](0x0,_0x1dc6ca)[_0x0fb0('0xb')]();_0xe400ba=_0x5eeb68[_0x534534][_0x0fb0('0xc')](_0x1dc6ca+0x1)[_0x0fb0('0xb')]();if(_0x317bbe[_0x0fb0('0xd')]>0x0){_0x53aa3e[_0x317bbe]=_0xe400ba;}}else{}_0x534534++;}this[_0x0fb0('0xe')](_0x0fb0('0xf'),_0x53aa3e);this[_0x0fb0('0x4')]=!![];}_0x124b7b++;}this[_0x0fb0('0x3')]=_0x28b5de;}else{while((_0x482061=_0x28b5de[_0x0fb0('0x8')](_0x3123eb))!=-0x1){_0x4e131e=_0x28b5de[_0x0fb0('0x9')](0x0,_0x482061);this[_0x0fb0('0xe')]('line',_0x4e131e);_0x28b5de=_0x28b5de[_0x0fb0('0x9')](_0x482061+_0x3123eb[_0x0fb0('0xd')]);}this[_0x0fb0('0x3')]=_0x28b5de;}_0x36b595();};module[_0x0fb0('0x10')]=AGIReply; \ No newline at end of file +var _0xb2a9=['slice','trim','length','headers','emit','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','toString','substring','indexOf'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb2a9,0x84));var _0x9b2a=function(_0x1b44be,_0x1cdbfb){_0x1b44be=_0x1b44be-0x0;var _0x2593db=_0xb2a9[_0x1b44be];return _0x2593db;};'use strict';var util=require(_0x9b2a('0x0'));var Transform=require(_0x9b2a('0x1'))[_0x9b2a('0x2')];function AGIReply(_0x64a9a3){Transform[_0x9b2a('0x3')](this,_0x64a9a3);this[_0x9b2a('0x4')]='';this[_0x9b2a('0x5')]=![];}util[_0x9b2a('0x6')](AGIReply,Transform);AGIReply['prototype'][_0x9b2a('0x7')]=function(_0x5d5a96,_0x38fa64,_0x2eafb0){var _0x31a9a3='\x0a',_0x442bf9=['\x0a\x0a',_0x9b2a('0x8')],_0x1946ce=-0x1,_0x45714d=-0x1,_0x37ed7c='',_0x5a5c6c=0x0,_0x3bfd74='',_0x508b0d='';this['_localBuffer']+=_0x5d5a96[_0x9b2a('0x9')]();_0x3bfd74=this[_0x9b2a('0x4')];if(!this[_0x9b2a('0x5')]){_0x5a5c6c=0x0;while(_0x442bf9[_0x5a5c6c]){while((_0x45714d=_0x3bfd74['indexOf'](_0x442bf9[_0x5a5c6c]))!=-0x1){_0x37ed7c=_0x442bf9[_0x5a5c6c];_0x508b0d=_0x3bfd74['substring'](0x0,_0x45714d);_0x3bfd74=_0x3bfd74[_0x9b2a('0xa')](_0x45714d+_0x37ed7c['length']);var _0x3429e5=_0x508b0d['split'](_0x31a9a3),_0xc9d298=0x0,_0x282719={},_0x1b7d6a='',_0xd952e1='',_0x349c01=-0x1;while(_0x3429e5[_0xc9d298]){_0x349c01=_0x3429e5[_0xc9d298][_0x9b2a('0xb')](':');if(_0x349c01!=-0x1){_0x1b7d6a=_0x3429e5[_0xc9d298]['slice'](0x0,_0x349c01)['trim']();_0xd952e1=_0x3429e5[_0xc9d298][_0x9b2a('0xc')](_0x349c01+0x1)[_0x9b2a('0xd')]();if(_0x1b7d6a[_0x9b2a('0xe')]>0x0){_0x282719[_0x1b7d6a]=_0xd952e1;}}else{}_0xc9d298++;}this['emit'](_0x9b2a('0xf'),_0x282719);this[_0x9b2a('0x5')]=!![];}_0x5a5c6c++;}this[_0x9b2a('0x4')]=_0x3bfd74;}else{while((_0x1946ce=_0x3bfd74[_0x9b2a('0xb')](_0x31a9a3))!=-0x1){_0x508b0d=_0x3bfd74[_0x9b2a('0xa')](0x0,_0x1946ce);this[_0x9b2a('0x10')]('line',_0x508b0d);_0x3bfd74=_0x3bfd74[_0x9b2a('0xa')](_0x1946ce+_0x31a9a3[_0x9b2a('0xe')]);}this[_0x9b2a('0x4')]=_0x3bfd74;}_0x2eafb0();};module[_0x9b2a('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index fdd42da..395df1b 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 _0xe5b3=['catch','getSquareProjects','GetSquareProjects','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','name','email','getSquareProjectById','getVariableById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','client','http','request','then','error','message'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe5b3,0x133));var _0x3e5b=function(_0x389a17,_0x5db1a8){_0x389a17=_0x389a17-0x0;var _0x5e9f17=_0xe5b3[_0x389a17];return _0x5e9f17;};'use strict';var _=require('lodash');var moment=require(_0x3e5b('0x0'));var jayson=require(_0x3e5b('0x1'));var client=jayson[_0x3e5b('0x2')][_0x3e5b('0x3')]({'port':0x2329});function request(_0x2a71ef,_0x3171c5){return new Promise(function(_0x7f1cc0,_0x1e58ed){return client[_0x3e5b('0x4')](_0x2a71ef,_0x3171c5)[_0x3e5b('0x5')](function(_0x36e319){if(_0x36e319['error']){return _0x1e58ed(_0x36e319[_0x3e5b('0x6')][_0x3e5b('0x7')]);}else{return _0x7f1cc0(_0x36e319['result']);}})[_0x3e5b('0x8')](function(_0x3901c2){return _0x1e58ed(_0x3901c2);});});}exports[_0x3e5b('0x9')]=function(){return request(_0x3e5b('0xa'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x3e5b('0xb')]=function(_0x3d3b6e){return request(_0x3e5b('0xc'),{'options':{'raw':![],'where':{'name':_0x3d3b6e},'attributes':[_0x3e5b('0xd')]}});};exports[_0x3e5b('0xe')]=function(_0x522e9e){return request(_0x3e5b('0xf'),{'options':{'raw':![],'where':{'id':_0x522e9e},'include':[{'model':'MailServerOut','as':_0x3e5b('0x10'),'include':[{'model':_0x3e5b('0x11'),'as':_0x3e5b('0x11')}]}],'attributes':['id',_0x3e5b('0x12'),_0x3e5b('0x13')],'smtp':!![]}});};exports[_0x3e5b('0x14')]=function(_0x405e70){return request('ShowSquareProject',{'options':{'where':{'id':_0x405e70},'attributes':[_0x3e5b('0x12')]}});};exports['getVoiceQueueById']=function(_0x51a188){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x51a188},'attributes':[_0x3e5b('0x12')]}});};exports[_0x3e5b('0x15')]=function(_0x17aaa3){return request('ShowVariable',{'options':{'where':{'id':_0x17aaa3},'attributes':[_0x3e5b('0x12')]}});};exports['getSquareOdbcById']=function(_0x56a453){return request(_0x3e5b('0x16'),{'options':{'where':{'id':_0x56a453},'attributes':[_0x3e5b('0x17')]}});};exports['getUserById']=function(_0x3d58a4){return request(_0x3e5b('0x18'),{'options':{'where':{'id':_0x3d58a4},'attributes':['name']}});};exports[_0x3e5b('0x19')]=function(_0x3365dd){return request('GetContactByPhone',{'options':{'where':{'phone':_0x3365dd['phone']},'attributes':['id']}});};exports[_0x3e5b('0x1a')]=function(_0x20806a){return request(_0x3e5b('0x1b'),{'options':{'where':{'id':_0x20806a},'attributes':[_0x3e5b('0x12')]}});};exports[_0x3e5b('0x1c')]=function(_0x1564b5){return request(_0x3e5b('0x1d'),{'options':{'where':{'id':_0x1564b5},'attributes':[_0x3e5b('0x1e')]}});};exports[_0x3e5b('0x1f')]=function(_0x3d95f3){return request(_0x3e5b('0x20'),{'options':{'raw':![],'where':{'id':_0x3d95f3},'include':[{'model':_0x3e5b('0x21'),'as':_0x3e5b('0x22')}]}});};exports[_0x3e5b('0x23')]=function(_0x5b46d4){return request(_0x3e5b('0x24'),{'options':{'where':{'id':_0x5b46d4},'attributes':['id',_0x3e5b('0x12')]}});};exports[_0x3e5b('0x25')]=function(_0x150674){return request('CreateSmsMessage',{'body':_0x150674});};exports[_0x3e5b('0x26')]=function(_0x5b33bb){return request(_0x3e5b('0x27'),{'body':_0x5b33bb});};exports[_0x3e5b('0x28')]=function(_0x4d5e61){return request(_0x3e5b('0x29'),{'body':_[_0x3e5b('0x2a')](_0x4d5e61,{'project_name':_0x4d5e61[_0x3e5b('0x2b')],'prev_project_name':_0x4d5e61[_0x3e5b('0x2c')]||'','is_subproject':_0x4d5e61[_0x3e5b('0x2c')]?!![]:![],'leaveAt':moment()[_0x3e5b('0x2d')](_0x3e5b('0x2e'))})});};exports[_0x3e5b('0x2f')]=function(_0x4c4b89){return request(_0x3e5b('0x30'),{'body':_0x4c4b89});};exports['createSquareMessage']=function(_0xb70ab4){return request('CreateSquareMessage',{'body':_0xb70ab4});};exports[_0x3e5b('0x31')]=function(_0x1f6473){return request(_0x3e5b('0x32'),{'options':{'raw':![],'where':{'phone':_0x1f6473[_0x3e5b('0x33')],'ListId':_0x1f6473[_0x3e5b('0x34')]}}})[_0x3e5b('0x5')](function(_0x307091){if(_0x307091){return _0x307091;}return request(_0x3e5b('0x35'),{'body':_0x1f6473});});};exports[_0x3e5b('0x36')]=function(_0x112dc0){return request(_0x3e5b('0x37'),{'options':{'where':{'id':_0x112dc0},'attributes':['name']}});};exports[_0x3e5b('0x38')]=function(_0x1882aa,_0xa8760b){return request(_0x3e5b('0x39'),{'body':{'interface':_0xa8760b},'options':{'where':_0x1882aa}});};exports[_0x3e5b('0x3a')]=function(_0x31e9f9,_0x345927,_0x4c4e01){return request(_0x3e5b('0x3b'),{'body':{'type':_0x345927,'uniqueid':_0x4c4e01},'options':{'where':_0x31e9f9}});};exports['agentUnpause']=function(_0x5b9ba3){return request(_0x3e5b('0x3c'),{'body':{},'options':{'where':_0x5b9ba3}});};exports[_0x3e5b('0x3d')]=function(_0x51ea0d){return request(_0x3e5b('0x3e'),{'body':{},'options':{'where':_0x51ea0d}});}; \ No newline at end of file +var _0x861a=['CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','lodash','jayson/promise','client','http','request','then','error','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','getContactByPhone','GetContactByPhone','phone','ShowTrunk','getSoundById','save_name','getIntervalById','Interval','Intervals','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording'];(function(_0x51038f,_0x67063e){var _0x583bbf=function(_0x354915){while(--_0x354915){_0x51038f['push'](_0x51038f['shift']());}};_0x583bbf(++_0x67063e);}(_0x861a,0x194));var _0xa861=function(_0x22d719,_0x18a6ea){_0x22d719=_0x22d719-0x0;var _0xf7578d=_0x861a[_0x22d719];return _0xf7578d;};'use strict';var _=require(_0xa861('0x0'));var moment=require('moment');var jayson=require(_0xa861('0x1'));var client=jayson[_0xa861('0x2')][_0xa861('0x3')]({'port':0x2329});function request(_0x2cc98d,_0x161246){return new Promise(function(_0x1da0cb,_0x5d3ee2){return client[_0xa861('0x4')](_0x2cc98d,_0x161246)[_0xa861('0x5')](function(_0x51fc4f){if(_0x51fc4f[_0xa861('0x6')]){return _0x5d3ee2(_0x51fc4f[_0xa861('0x6')]['message']);}else{return _0x1da0cb(_0x51fc4f[_0xa861('0x7')]);}})[_0xa861('0x8')](function(_0x46e2ce){return _0x5d3ee2(_0x46e2ce);});});}exports[_0xa861('0x9')]=function(){return request(_0xa861('0xa'),{'options':{'raw':![],'attributes':['id',_0xa861('0xb'),_0xa861('0xc')]}});};exports[_0xa861('0xd')]=function(_0x5cf603){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x5cf603},'attributes':[_0xa861('0xc')]}});};exports['getMailAccountById']=function(_0x4e6885){return request(_0xa861('0xe'),{'options':{'raw':![],'where':{'id':_0x4e6885},'include':[{'model':_0xa861('0xf'),'as':_0xa861('0x10'),'include':[{'model':'CloudProvider','as':_0xa861('0x11')}]}],'attributes':['id',_0xa861('0xb'),_0xa861('0x12')],'smtp':!![]}});};exports[_0xa861('0x13')]=function(_0x41af33){return request('ShowSquareProject',{'options':{'where':{'id':_0x41af33},'attributes':['name']}});};exports[_0xa861('0x14')]=function(_0x4df9aa){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x4df9aa},'attributes':[_0xa861('0xb')]}});};exports[_0xa861('0x15')]=function(_0x405e23){return request(_0xa861('0x16'),{'options':{'where':{'id':_0x405e23},'attributes':['name']}});};exports[_0xa861('0x17')]=function(_0x56500f){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x56500f},'attributes':[_0xa861('0x18')]}});};exports[_0xa861('0x19')]=function(_0x18c897){return request('ShowUser',{'options':{'where':{'id':_0x18c897},'attributes':[_0xa861('0xb')]}});};exports[_0xa861('0x1a')]=function(_0x2cbdae){return request(_0xa861('0x1b'),{'options':{'where':{'phone':_0x2cbdae[_0xa861('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x20e465){return request(_0xa861('0x1d'),{'options':{'where':{'id':_0x20e465},'attributes':[_0xa861('0xb')]}});};exports[_0xa861('0x1e')]=function(_0x39e726){return request('ShowSound',{'options':{'where':{'id':_0x39e726},'attributes':[_0xa861('0x1f')]}});};exports[_0xa861('0x20')]=function(_0x2437ad){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x2437ad},'include':[{'model':_0xa861('0x21'),'as':_0xa861('0x22')}]}});};exports['getSmsAccountById']=function(_0x24e305){return request(_0xa861('0x23'),{'options':{'where':{'id':_0x24e305},'attributes':['id',_0xa861('0xb')]}});};exports['createSmsMessage']=function(_0x3fd022){return request(_0xa861('0x24'),{'body':_0x3fd022});};exports['createSquareDetailsReport']=function(_0x1b06f8){return request(_0xa861('0x25'),{'body':_0x1b06f8});};exports['createSquareReport']=function(_0x286749){return request(_0xa861('0x26'),{'body':_[_0xa861('0x27')](_0x286749,{'project_name':_0x286749['arg_1'],'prev_project_name':_0x286749[_0xa861('0x28')]||'','is_subproject':_0x286749[_0xa861('0x28')]?!![]:![],'leaveAt':moment()[_0xa861('0x29')](_0xa861('0x2a'))})});};exports[_0xa861('0x2b')]=function(_0x1353c4){return request(_0xa861('0x2c'),{'body':_0x1353c4});};exports['createSquareMessage']=function(_0x25eed9){return request(_0xa861('0x2d'),{'body':_0x25eed9});};exports[_0xa861('0x2e')]=function(_0x58a58c){return request(_0xa861('0x2f'),{'options':{'raw':![],'where':{'phone':_0x58a58c[_0xa861('0x1c')],'ListId':_0x58a58c[_0xa861('0x30')]}}})[_0xa861('0x5')](function(_0x34875d){if(_0x34875d){return _0x34875d;}return request(_0xa861('0x31'),{'body':_0x58a58c});});};exports['getPauseById']=function(_0x519c21){return request('ShowPause',{'options':{'where':{'id':_0x519c21},'attributes':[_0xa861('0xb')]}});};exports['agentLogin']=function(_0x14aba2,_0x31481a){return request(_0xa861('0x32'),{'body':{'interface':_0x31481a},'options':{'where':_0x14aba2}});};exports[_0xa861('0x33')]=function(_0x5a26c2,_0x91e494,_0x931bd1){return request(_0xa861('0x34'),{'body':{'type':_0x91e494,'uniqueid':_0x931bd1},'options':{'where':_0x5a26c2}});};exports[_0xa861('0x35')]=function(_0x5dd3b7){return request(_0xa861('0x36'),{'body':{},'options':{'where':_0x5dd3b7}});};exports['agentLogout']=function(_0xe37c63){return request(_0xa861('0x37'),{'body':{},'options':{'where':_0xe37c63}});}; \ 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 ed2bef9..f197a66 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 _0x7676=['exports','./polly','./lex'];(function(_0x23be51,_0xc02a1b){var _0x47a26d=function(_0xa92395){while(--_0xa92395){_0x23be51['push'](_0x23be51['shift']());}};_0x47a26d(++_0xc02a1b);}(_0x7676,0xb8));var _0x6767=function(_0x3d2bcf,_0x1497f7){_0x3d2bcf=_0x3d2bcf-0x0;var _0x18dd79=_0x7676[_0x3d2bcf];return _0x18dd79;};var polly=require(_0x6767('0x0'));var lex=require(_0x6767('0x1'));module[_0x6767('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x36b2=['./lex','exports','./polly'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x36b2,0x6b));var _0x236b=function(_0x33595e,_0x560193){_0x33595e=_0x33595e-0x0;var _0x1c5398=_0x36b2[_0x33595e];return _0x1c5398;};var polly=require(_0x236b('0x0'));var lex=require(_0x236b('0x1'));module[_0x236b('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 0a2cdd1..9505dd0 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 _0x13f6=['./lib/api','exports'];(function(_0x56cd04,_0x1a0905){var _0x41fe3b=function(_0x4cade8){while(--_0x4cade8){_0x56cd04['push'](_0x56cd04['shift']());}};_0x41fe3b(++_0x1a0905);}(_0x13f6,0x124));var _0x613f=function(_0x5ba4cd,_0x323aec){_0x5ba4cd=_0x5ba4cd-0x0;var _0x2ef879=_0x13f6[_0x5ba4cd];return _0x2ef879;};'use strict';var lex=require(_0x613f('0x0'));module[_0x613f('0x1')]=function(_0x5f1b3e,_0x563492,_0xd04cfd,_0x13b50a,_0x12dc5a,_0x5414ff){return lex(_0x5f1b3e,_0x563492,_0xd04cfd,_0x13b50a,_0x12dc5a,_0x5414ff);}; \ No newline at end of file +var _0x2dae=['./lib/api'];(function(_0x19b6d7,_0x41130d){var _0x5ee0d5=function(_0x77f9af){while(--_0x77f9af){_0x19b6d7['push'](_0x19b6d7['shift']());}};_0x5ee0d5(++_0x41130d);}(_0x2dae,0xc3));var _0xe2da=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x2dae[_0x4ae625];return _0x31accf;};'use strict';var lex=require(_0xe2da('0x0'));module['exports']=function(_0x11ec30,_0x31359d,_0xcd0055,_0x167432,_0x99b46f,_0x481d97){return lex(_0x11ec30,_0x31359d,_0xcd0055,_0x167432,_0x99b46f,_0x481d97);}; \ 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 47878a2..f0c4164 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(_0x207bdf,_0x5b3c13){var _0x1f93f3=function(_0x55dd20){while(--_0x55dd20){_0x207bdf['push'](_0x207bdf['shift']());}};_0x1f93f3(++_0x5b3c13);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x2d3206,_0x434cf5){var _0x18702d=function(_0x4e0735){while(--_0x4e0735){_0x2d3206['push'](_0x2d3206['shift']());}};_0x18702d(++_0x434cf5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 f29c738..3deaa39 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 _0x0151=['./lib/api'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x0151,0x13e));var _0x1015=function(_0x28269a,_0x525597){_0x28269a=_0x28269a-0x0;var _0x33a242=_0x0151[_0x28269a];return _0x33a242;};'use strict';var polly=require(_0x1015('0x0'));module['exports']=function(_0xc2567d,_0x477518,_0x3baf58,_0x338dc9,_0x60e138,_0x558184,_0x336682){return polly(_0xc2567d,_0x477518,_0x3baf58,_0x338dc9,_0x60e138,_0x558184,_0x336682);}; \ No newline at end of file +var _0x0cd0=['exports','./lib/api'];(function(_0x3352ca,_0x5ab426){var _0x5ad969=function(_0x26118a){while(--_0x26118a){_0x3352ca['push'](_0x3352ca['shift']());}};_0x5ad969(++_0x5ab426);}(_0x0cd0,0x83));var _0x00cd=function(_0xac939f,_0x59237e){_0xac939f=_0xac939f-0x0;var _0x2a7030=_0x0cd0[_0xac939f];return _0x2a7030;};'use strict';var polly=require(_0x00cd('0x0'));module[_0x00cd('0x1')]=function(_0x571a63,_0x1c0075,_0x2a0bab,_0x4482e4,_0x128ca5,_0x464ee2,_0x59d5c8){return polly(_0x571a63,_0x1c0075,_0x2a0bab,_0x4482e4,_0x128ca5,_0x464ee2,_0x59d5c8);}; \ 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 74694d2..c377b7d 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 _0x7d98=['exports','text','mp3','path','bluebird','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x41f55e,_0x264009){var _0x922b33=function(_0x510189){while(--_0x510189){_0x41f55e['push'](_0x41f55e['shift']());}};_0x922b33(++_0x264009);}(_0x7d98,0x16b));var _0x87d9=function(_0x5a19fc,_0x58f9f4){_0x5a19fc=_0x5a19fc-0x0;var _0x34b413=_0x7d98[_0x5a19fc];return _0x34b413;};'use strict';var fs=require('fs');var path=require(_0x87d9('0x0'));var BPromise=require(_0x87d9('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x395ee0,_0x1af610,_0x573837){return new BPromise(function(_0x701707,_0xe05a67){_0x395ee0[_0x87d9('0x2')](_0x1af610,function(_0x5c538c,_0x394044){if(_0x5c538c){_0xe05a67(_0x5c538c);}else if(_0x394044){if(_0x394044[_0x87d9('0x3')]instanceof Buffer){fs[_0x87d9('0x4')](_0x573837,_0x394044[_0x87d9('0x3')],function(_0x46f174){if(_0x46f174){_0xe05a67(_0x46f174);}else{_0x701707();}});}else{_0xe05a67(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0xe05a67(new Error(_0x87d9('0x5')));}});});}module[_0x87d9('0x6')]=function(_0x4cc359,_0x3649ca,_0x34029c,_0x4c5029,_0x2e0030,_0x95c638,_0xdebd49){var _0x220326=new AWS['Polly']({'accessKeyId':_0x4cc359,'secretAccessKey':_0x3649ca,'region':_0x34029c});var _0x39636c={'Text':_0x2e0030,'TextType':_0x95c638||_0x87d9('0x7'),'OutputFormat':_0x87d9('0x8'),'VoiceId':_0x4c5029};return pollyResult(_0x220326,_0x39636c,_0xdebd49);}; \ No newline at end of file +var _0xf2a5=['AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','bluebird','aws-sdk','synthesizeSpeech','writeFile'];(function(_0x521632,_0x531850){var _0x5c1402=function(_0xcfc57b){while(--_0xcfc57b){_0x521632['push'](_0x521632['shift']());}};_0x5c1402(++_0x531850);}(_0xf2a5,0x6a));var _0x5f2a=function(_0x109b77,_0x335d81){_0x109b77=_0x109b77-0x0;var _0x29c9a8=_0xf2a5[_0x109b77];return _0x29c9a8;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x5f2a('0x0'));var rs=require('randomstring');var AWS=require(_0x5f2a('0x1'));function pollyResult(_0x4deb2b,_0x2af604,_0x27ccf1){return new BPromise(function(_0x346bdc,_0x206e33){_0x4deb2b[_0x5f2a('0x2')](_0x2af604,function(_0x592d3b,_0x3c57d5){if(_0x592d3b){_0x206e33(_0x592d3b);}else if(_0x3c57d5){if(_0x3c57d5['AudioStream']instanceof Buffer){fs[_0x5f2a('0x3')](_0x27ccf1,_0x3c57d5[_0x5f2a('0x4')],function(_0x5a729c){if(_0x5a729c){_0x206e33(_0x5a729c);}else{_0x346bdc();}});}else{_0x206e33(new Error(_0x5f2a('0x5')));}}else{_0x206e33(new Error(_0x5f2a('0x6')));}});});}module[_0x5f2a('0x7')]=function(_0x3baba6,_0x2acea0,_0x4780ba,_0x53ead8,_0x130dd1,_0x3dc537,_0x561ee9){var _0x570393=new AWS['Polly']({'accessKeyId':_0x3baba6,'secretAccessKey':_0x2acea0,'region':_0x4780ba});var _0x2156ae={'Text':_0x130dd1,'TextType':_0x3dc537||_0x5f2a('0x8'),'OutputFormat':_0x5f2a('0x9'),'VoiceId':_0x53ead8};return pollyResult(_0x570393,_0x2156ae,_0x561ee9);}; \ 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 12353d7..12cf77e 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 _0x434c=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x434c,0x96));var _0xc434=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x434c[_0x432682];return _0x463d05;};'use strict';var asr=require('./lib/api');module[_0xc434('0x0')]=function(_0x2733de,_0x5ae8ff,_0x413cbc,_0x419d73){return asr(_0x2733de,_0x5ae8ff,_0x413cbc);}; \ No newline at end of file +var _0x054e=['./lib/api','exports'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x054e,0x66));var _0xe054=function(_0x1e8b1e,_0x407bbd){_0x1e8b1e=_0x1e8b1e-0x0;var _0x4a0fde=_0x054e[_0x1e8b1e];return _0x4a0fde;};'use strict';var asr=require(_0xe054('0x0'));module[_0xe054('0x1')]=function(_0x1c1e6f,_0x5612fd,_0xd96430,_0x29d1fd){return asr(_0x1c1e6f,_0x5612fd,_0xd96430);}; \ 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 741e083..e328831 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 _0x37f8=['bluebird','https://speech.googleapis.com','exports','filepath\x20should\x20be\x20a\x20string','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x37f8,0xd2));var _0x837f=function(_0x3c5cb2,_0x5dc542){_0x3c5cb2=_0x3c5cb2-0x0;var _0x2957f6=_0x37f8[_0x3c5cb2];return _0x2957f6;};'use strict';var url=require('url');var BPromise=require(_0x837f('0x0'));var fs=require('fs');var host=_0x837f('0x1');module[_0x837f('0x2')]=function(_0x2b4e2c,_0x4b8b19,_0x16bb5c){return new BPromise(function(_0x5184ad,_0x5f2d01){var _0x5a04e7;if(typeof _0x2b4e2c!=='string'||_0x2b4e2c['length']===0x0){return _0x5f2d01(_0x837f('0x3'));}if(typeof _0x4b8b19!==_0x837f('0x4')||_0x4b8b19[_0x837f('0x5')]===0x0){return _0x5f2d01(_0x837f('0x6'));}if(typeof _0x16bb5c!==_0x837f('0x7')&&(typeof _0x16bb5c!==_0x837f('0x4')||_0x16bb5c[_0x837f('0x5')]===0x0)){return _0x5f2d01(_0x837f('0x8'));}try{_0x5a04e7=fs[_0x837f('0x9')](_0x2b4e2c)[_0x837f('0xa')](_0x837f('0xb'));}catch(_0x1aea1e){return _0x5f2d01(_0x1aea1e);}return _0x5184ad({'method':_0x837f('0xc'),'uri':host+_0x837f('0xd')+_0x4b8b19,'body':{'config':{'encoding':_0x837f('0xe'),'sampleRateHertz':'8000','languageCode':_0x16bb5c},'audio':{'content':_0x5a04e7}},'json':!![]});});}; \ No newline at end of file +var _0x720c=['/v1/speech:recognize?key=','8000','url','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','base64','POST'];(function(_0x5f30b9,_0x196dad){var _0x3e8ee9=function(_0x353912){while(--_0x353912){_0x5f30b9['push'](_0x5f30b9['shift']());}};_0x3e8ee9(++_0x196dad);}(_0x720c,0x154));var _0xc720=function(_0x2d9887,_0x1481f0){_0x2d9887=_0x2d9887-0x0;var _0x24fced=_0x720c[_0x2d9887];return _0x24fced;};'use strict';var url=require(_0xc720('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xc720('0x1');module[_0xc720('0x2')]=function(_0x304440,_0x127edb,_0x5e0261){return new BPromise(function(_0x3863fa,_0x2336e6){var _0x3e4155;if(typeof _0x304440!==_0xc720('0x3')||_0x304440[_0xc720('0x4')]===0x0){return _0x2336e6(_0xc720('0x5'));}if(typeof _0x127edb!==_0xc720('0x3')||_0x127edb['length']===0x0){return _0x2336e6(_0xc720('0x6'));}if(typeof _0x5e0261!==_0xc720('0x7')&&(typeof _0x5e0261!==_0xc720('0x3')||_0x5e0261[_0xc720('0x4')]===0x0)){return _0x2336e6(_0xc720('0x8'));}try{_0x3e4155=fs['readFileSync'](_0x304440)['toString'](_0xc720('0x9'));}catch(_0x4bea5d){return _0x2336e6(_0x4bea5d);}return _0x3863fa({'method':_0xc720('0xa'),'uri':host+_0xc720('0xb')+_0x127edb,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xc720('0xc'),'languageCode':_0x5e0261},'audio':{'content':_0x3e4155}},'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 33fe69c..91eb4f6 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 _0x4cd2=['exports','./asr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4cd2,0x135));var _0x24cd=function(_0x4501a5,_0x452eb6){_0x4501a5=_0x4501a5-0x0;var _0x2df7f3=_0x4cd2[_0x4501a5];return _0x2df7f3;};var asr=require(_0x24cd('0x0'));module[_0x24cd('0x1')]={'asr':asr}; \ No newline at end of file +var _0xafa6=['exports','./asr'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xafa6,0x14d));var _0x6afa=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xafa6[_0x4a747d];return _0x3a5b5c;};var asr=require(_0x6afa('0x0'));module[_0x6afa('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 bdb1ff4..697902f 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 _0x126d=['querystring','request-promise','randomstring','sox','url','parse','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','split','readFileSync','?key=','ssml','input','audioConfig','MP3','text:synthesize','POST','audioContent','writeFile','chmodSync','777','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','.mp3','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','freeform=3','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','dirName','bluebird','http','https','path'];(function(_0x581c2c,_0x51783d){var _0x110224=function(_0x11bb54){while(--_0x11bb54){_0x581c2c['push'](_0x581c2c['shift']());}};_0x110224(++_0x51783d);}(_0x126d,0x10c));var _0xd126=function(_0x5e72dc,_0x1ed53a){_0x5e72dc=_0x5e72dc-0x0;var _0x4a00e2=_0x126d[_0x5e72dc];return _0x4a00e2;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xd126('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xd126('0x1'));var https=require(_0xd126('0x2'));var md5=require('md5');var path=require(_0xd126('0x3'));var querystring=require(_0xd126('0x4'));var rp=require(_0xd126('0x5'));var rs=require(_0xd126('0x6'));var sox=require(_0xd126('0x7'));var tts=require('google-tts-api');var urlParse=require(_0xd126('0x8'))[_0xd126('0x9')];var util=require('util');var aws=require('./aws');var google=require(_0xd126('0xa'));var sestek=require('./sestek');var tilde=require(_0xd126('0xb'));var logger=require(_0xd126('0xc'))(_0xd126('0xd'));var ISPEECH_API=_0xd126('0xe');function downloadFile(_0x3124d5,_0xceac8c){return new BPromise(function(_0x1fbf11,_0x55f944){var _0x492522=urlParse(_0x3124d5);var _0x6eb42d=_0x492522[_0xd126('0xf')]===_0xd126('0x10')?https:http;var _0xba2a39={'host':_0x492522[_0xd126('0x11')],'path':_0x492522[_0xd126('0x3')],'headers':{'user-agent':_0xd126('0x12')}};_0x6eb42d[_0xd126('0x13')](_0xba2a39,function(_0x577c1b){if(_0x577c1b[_0xd126('0x14')]!==0xc8){logger[_0xd126('0x15')](_0xd126('0x16')+_0x3124d5+_0xd126('0x17')+_0x577c1b['statusCode']+'\x20('+_0x577c1b[_0xd126('0x18')]+')');_0x55f944(new Error(_0xd126('0x16')+_0x3124d5+_0xd126('0x17')+_0x577c1b[_0xd126('0x14')]+'\x20('+_0x577c1b[_0xd126('0x18')]+')'));return;}var _0x198efc=fs[_0xd126('0x19')](_0xceac8c);_0x198efc['on'](_0xd126('0x1a'),function(){logger['info'](_0xd126('0x1b'));_0x198efc[_0xd126('0x1c')](_0x1fbf11);});_0x198efc['on'](_0xd126('0x15'),function(_0x110d3c){fs[_0xd126('0x1d')](_0xceac8c);logger[_0xd126('0x15')](_0xd126('0x1e'),_0x110d3c);_0x55f944(_0x110d3c);});_0x577c1b[_0xd126('0x1f')](_0x198efc);})['on'](_0xd126('0x15'),function(_0x4ec045){logger[_0xd126('0x15')](_0x4ec045);_0x55f944(_0x4ec045);})[_0xd126('0x20')]();});}function uploadFile(_0x33d5c2){return new BPromise(function(_0x94dfd5,_0x580188){var _0x10c233=urlParse(_0x33d5c2);var _0x475736=_0x10c233[_0xd126('0xf')]===_0xd126('0x10')?https:http;var _0x37298e={'host':_0x10c233['host'],'path':_0x10c233[_0xd126('0x3')],'headers':{'user-agent':_0xd126('0x12')}};_0x475736[_0xd126('0x13')](_0x37298e,function(_0x54a9a7){if(_0x54a9a7[_0xd126('0x14')]!==0xc8){_0x580188(new Error('request\x20to\x20'+_0x33d5c2+'\x20failed,\x20status\x20code\x20=\x20'+_0x54a9a7['statusCode']+'\x20('+_0x54a9a7[_0xd126('0x18')]+')'));return;}var _0x769a5='';_0x54a9a7['on'](_0xd126('0x21'),function(_0x478778){_0x769a5+=_0x478778;});_0x54a9a7['on'](_0xd126('0x20'),function(){_0x94dfd5(_0x769a5);});})['on']('error',function(_0x129773){_0x580188(_0x129773);})[_0xd126('0x20')]();});}function convertFile(_0x2ed8ba,_0x5f4f17){return new BPromise(function(_0x33dc9d,_0x592278){var _0x34076a=sox[_0xd126('0x22')](_0x2ed8ba,_0x5f4f17,{'sampleRate':0x1f40,'format':_0xd126('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x34076a['on'](_0xd126('0x15'),function(_0xf5d727){logger[_0xd126('0x15')](_0xd126('0x24'),_0xf5d727);_0x592278(_0xf5d727);});_0x34076a['on'](_0xd126('0x20'),function(){logger[_0xd126('0x25')](_0xd126('0x26'));_0x33dc9d();});_0x34076a[_0xd126('0x27')]();});}function base64Decode(_0x2f7042,_0x4a607a){var _0x17dde8=path[_0xd126('0x28')](__dirname,_0xd126('0x29'),rs[_0xd126('0x2a')](0x4)+_0xd126('0x2b'));fs[_0xd126('0x2c')](_0x17dde8,_0x2f7042,_0xd126('0x2d'));return convertFile(_0x17dde8,_0x4a607a)[_0xd126('0x2e')](function(){try{fs[_0xd126('0x1d')](_0x17dde8);fs['chmodSync'](_0x4a607a,'777');}catch(_0x51fafe){logger['error'](_0x51fafe);}return _0x4a607a[_0xd126('0x2f')]('.')[0x0];});}function base64Encode(_0x5bce07){var _0x345ed0=fs[_0xd126('0x30')](_0x5bce07);return new Buffer(_0x345ed0)['toString'](_0xd126('0x2d'));}exports['googleCloudTTS']=function(_0x3774d0,_0x402e9b,_0x220dfe,_0x4abde9,_0x571d58,_0x339b05){var _0x31a7e8,_0x1d3f6e;var _0x5c8bcf='https://texttospeech.googleapis.com/v1/';var _0x4f7ffc=_0xd126('0x31')+_0x3774d0;var _0xf16a35={};if(_0x402e9b===_0xd126('0x32')){_0xf16a35[_0xd126('0x33')]={'ssml':_0x220dfe};}else{_0xf16a35[_0xd126('0x33')]={'text':_0x220dfe};};_0xf16a35['voice']={'languageCode':_0x4abde9,'ssmlGender':_0x571d58};_0xf16a35[_0xd126('0x34')]={'audioEncoding':_0xd126('0x35'),'sampleRateHertz':0x1f40};var _0x392e98={'url':_0x5c8bcf+_0xd126('0x36')+_0x4f7ffc,'method':_0xd126('0x37'),'json':!![],'body':_0xf16a35};return rp(_0x392e98)[_0xd126('0x2e')](function(_0x291418){return new BPromise(function(_0x17c840,_0x3fa8a6){_0x31a7e8=path[_0xd126('0x28')](__dirname,_0xd126('0x29'),rs[_0xd126('0x2a')](0x4)+'.mp3');var _0xb3e80f=Buffer['from'](_0x291418[_0xd126('0x38')],_0xd126('0x2d'));return fs[_0xd126('0x39')](_0x31a7e8,_0xb3e80f,function(_0x3a422c){_0x3fa8a6(_0x3a422c);},function(_0xdb2abd){fs[_0xd126('0x3a')](_0x31a7e8,_0xd126('0x3b'));_0x17c840(_0xdb2abd);});});})['then'](function(_0x886f04){_0x1d3f6e=path[_0xd126('0x28')](__dirname,_0xd126('0x29'),rs['generate'](0x4)+_0xd126('0x2b'));return convertFile(_0x31a7e8,_0x1d3f6e);})[_0xd126('0x2e')](function(){try{fs[_0xd126('0x1d')](_0x31a7e8);fs[_0xd126('0x3a')](_0x1d3f6e,'777');}catch(_0xd54697){logger[_0xd126('0x15')](_0xd54697);}logger['info'](_0xd126('0x3c'),_0x1d3f6e[_0xd126('0x2f')]('.')[0x0]);return _0x1d3f6e[_0xd126('0x2f')]('.')[0x0];});};exports['googleTTS']=function(_0x232bb0,_0x34879d){var _0x5c87e4=_0xd126('0x3d');var _0x1acc8a,_0x28c8a0;var _0x4efe46;var _0x474a64={'encoding':_0xd126('0x3e'),'method':_0xd126('0x37'),'timeout':0x2710,'url':_0x5c87e4,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0xd126('0x3f')]([[[_0xd126('0x40'),JSON[_0xd126('0x3f')]([_0x232bb0,_0x34879d||'en',![],_0xd126('0x41')]),null,_0xd126('0x42')]]]))};return rp(_0x474a64)[_0xd126('0x2e')](function(_0x945119){try{_0x4efe46=eval(_0x945119[_0xd126('0x43')](0x5))[0x0][0x2];}catch(_0x140aa6){throw new Error(_0xd126('0x44')+_0x945119[_0xd126('0x21')]);}if(!_0x4efe46){if(_0x232bb0[_0xd126('0x45')]>0xc8){throw new Error(_0xd126('0x46'));}else{throw new Error(_0xd126('0x47')+_0x34879d+'\x22\x20might\x20not\x20exist');}}try{_0x4efe46=eval(_0x4efe46)[0x0];}catch(_0x3a630c){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xd126('0x21')]);}const _0x1a1bf1=_0x4efe46;_0x1acc8a=path[_0xd126('0x28')](__dirname,_0xd126('0x29'),rs[_0xd126('0x2a')](0x4)+_0xd126('0x48'));fs['writeFileSync'](_0x1acc8a,_0x4efe46,{'encoding':_0xd126('0x2d')});_0x28c8a0=path[_0xd126('0x28')](__dirname,_0xd126('0x29'),rs[_0xd126('0x2a')](0x4)+_0xd126('0x2b'));return convertFile(_0x1acc8a,_0x28c8a0);})[_0xd126('0x2e')](function(){try{fs[_0xd126('0x1d')](_0x1acc8a);fs[_0xd126('0x3a')](_0x28c8a0,_0xd126('0x3b'));}catch(_0x434453){logger[_0xd126('0x15')](_0x434453);}logger['info'](_0xd126('0x49'),_0x28c8a0[_0xd126('0x2f')]('.')[0x0]);return _0x28c8a0[_0xd126('0x2f')]('.')[0x0];});};exports[_0xd126('0x4a')]=function(_0x255be6,_0xc08d24,_0x1e346d){return google[_0xd126('0x4b')](_0x255be6,_0xc08d24,_0x1e346d)[_0xd126('0x2e')](function(_0x3346e0){logger[_0xd126('0x25')](_0x3346e0['uri']);return rp(_0x3346e0);})[_0xd126('0x2e')](function(_0x10d8d8){var _0x3c44c4='';var _0x31b2df=0x0;try{fs[_0xd126('0x1d')](_0x255be6);}catch(_0x3e7a9a){logger['error'](_0x3e7a9a);}if(_0x10d8d8&&_0x10d8d8[_0xd126('0x4c')]){_0x3c44c4=_0x10d8d8[_0xd126('0x4c')][_0xd126('0x4d')](function(_0x347a83){return _0x347a83&&_0x347a83[_0xd126('0x4e')][0x0]&&_0x347a83[_0xd126('0x4e')][0x0][_0xd126('0x4f')]?_0x347a83['alternatives'][0x0][_0xd126('0x4f')]:'';})[_0xd126('0x50')]('\x0a');_0x31b2df=_0x10d8d8[_0xd126('0x4c')][_0xd126('0x4d')](function(_0xc94aed){return _0xc94aed&&_0xc94aed[_0xd126('0x4e')][0x0]&&_0xc94aed[_0xd126('0x4e')][0x0]['confidence']?_0xc94aed[_0xd126('0x4e')][0x0]['confidence']:0x0;})[_0xd126('0x50')]('\x0a');}logger[_0xd126('0x25')](_0xd126('0x51'),_0x3c44c4);logger['info'](_0xd126('0x52'),_0x31b2df);return{'transcript':_0x3c44c4,'confidence':_0x31b2df};})[_0xd126('0x53')](function(_0x7119c8){logger[_0xd126('0x15')](_0xd126('0x54'),_0x7119c8[_0xd126('0x14')],_0x7119c8['name'],_0x7119c8[_0xd126('0x55')]);});};exports[_0xd126('0x56')]=function(_0x3df70c,_0x3be110,_0x5a3ae2,_0x2c39b2){var _0x2cc1f3=apiai(_0x3be110,{'language':_0x2c39b2||'en'});return _0x2cc1f3[_0xd126('0x57')](_0x5a3ae2,{'sessionId':md5(_0x3df70c)})['then'](function(_0x486f67){logger[_0xd126('0x25')](JSON[_0xd126('0x3f')](_0x486f67));return{'source':_0x486f67[_0xd126('0x58')][_0xd126('0x59')],'resolvedQuery':_0x486f67[_0xd126('0x58')]['resolvedQuery'],'action':_0x486f67[_0xd126('0x58')][_0xd126('0x5a')],'actionIncomplete':_0x486f67[_0xd126('0x58')][_0xd126('0x5b')],'speech':_0x486f67['result'][_0xd126('0x5c')][_0xd126('0x5d')],'score':_0x486f67[_0xd126('0x58')][_0xd126('0x5e')],'statusCode':_0x486f67[_0xd126('0x5f')][_0xd126('0x60')],'endConversation':_0x486f67['result'][_0xd126('0x61')][_0xd126('0x62')]||![],'isFallbackIntent':_0x486f67[_0xd126('0x58')]['metadata'][_0xd126('0x63')]};});};exports['googleDialogflowV2']=function(_0x3c77af,_0x3f2341,_0x36430c,_0x49873f,_0x329cb1,_0x307b36){var _0x15577c=_0x49873f[_0xd126('0x64')](/\\n/g,'\x0a');var _0x1769e7={'credentials':{'private_key':_0x15577c,'client_email':_0x36430c}};var _0x6e4510=new dialogflow[(_0xd126('0x65'))](_0x1769e7);var _0x448243=_0x6e4510[_0xd126('0x66')](_0x3f2341,md5(_0x3c77af));var _0x91aeec={'session':_0x448243,'queryInput':{'text':{'text':_0x329cb1,'languageCode':_0x307b36}}};return _0x6e4510[_0xd126('0x67')](_0x91aeec)['then'](function(_0x2f6004){if(_0x2f6004&&_0x2f6004['length']){logger['info'](_0xd126('0x68'),JSON[_0xd126('0x3f')](_0x2f6004));var _0x5911cc=_0x2f6004[0x0];if(_0x5911cc){var _0x593bb3={'action':_0x5911cc[_0xd126('0x69')][_0xd126('0x5a')],'allRequiredParamsPresent':_0x5911cc[_0xd126('0x69')][_0xd126('0x6a')],'endConversation':_0x5911cc['queryResult'][_0xd126('0x6b')]&&_0x5911cc['queryResult'][_0xd126('0x6b')][_0xd126('0x6c')]?_0x5911cc[_0xd126('0x69')]['diagnosticInfo'][_0xd126('0x6c')][_0xd126('0x6d')][_0xd126('0x6e')]:![],'fulfillmentText':_0x5911cc[_0xd126('0x69')][_0xd126('0x6f')],'intentName':_0x5911cc[_0xd126('0x69')][_0xd126('0x70')]['name'],'intentDisplayName':_0x5911cc[_0xd126('0x69')][_0xd126('0x70')][_0xd126('0x71')],'isFallbackIntent':_0x5911cc[_0xd126('0x69')]['intent'][_0xd126('0x72')],'languageCode':_0x5911cc[_0xd126('0x69')]['languageCode'],'queryText':_0x5911cc[_0xd126('0x69')]['queryText'],'responseId':_0x5911cc[_0xd126('0x73')],'score':_0x5911cc[_0xd126('0x69')][_0xd126('0x74')],'speech':_0x5911cc[_0xd126('0x69')][_0xd126('0x6f')],'providerResponse':JSON[_0xd126('0x3f')](_0x2f6004)};return _0x593bb3;}}});};exports[_0xd126('0x75')]=function(_0x7f9b47,_0x4b519e,_0x3206b7,_0x3753aa){return tilde[_0xd126('0x4b')](_0x7f9b47,_0x4b519e,_0x3206b7,_0x3753aa)[_0xd126('0x2e')](function(_0x21e9ff){try{fs[_0xd126('0x1d')](_0x7f9b47);}catch(_0xc68f42){logger[_0xd126('0x15')](_0xc68f42);}logger['info'](_0xd126('0x76'),_0x21e9ff[_0xd126('0x4f')]);logger[_0xd126('0x25')](_0xd126('0x77'),_0x21e9ff[_0xd126('0x78')]);return _0x21e9ff;});};exports[_0xd126('0x79')]=function(_0x3b72ec,_0xd6ed73,_0x1fe453,_0x28d2de,_0x5b5721,_0x41b126){var _0x10ea30=path[_0xd126('0x28')](__dirname,_0xd126('0x29'),rs[_0xd126('0x2a')](0x4)+_0xd126('0x48'));var _0x209104;return aws[_0xd126('0x7a')](_0x3b72ec,_0xd6ed73,_0x1fe453,_0x28d2de,_0x5b5721,_0x41b126,_0x10ea30)[_0xd126('0x2e')](function(){_0x209104=path[_0xd126('0x28')](__dirname,_0xd126('0x29'),rs[_0xd126('0x2a')](0x4)+'.wav');return convertFile(_0x10ea30,_0x209104);})['then'](function(){try{fs[_0xd126('0x1d')](_0x10ea30);fs['chmodSync'](_0x209104,'777');}catch(_0x4a8aba){logger[_0xd126('0x15')](_0x4a8aba);}return _0x209104[_0xd126('0x2f')]('.')[0x0];});};exports[_0xd126('0x7b')]=function(_0x375567,_0x520f8d,_0x1687b7,_0x53f144,_0x10cb84,_0x2522d7){return aws[_0xd126('0x7c')](_0x375567,_0x520f8d,_0x1687b7,_0x53f144,_0x10cb84,_0x2522d7)['then'](function(_0xe30545){logger[_0xd126('0x25')](JSON[_0xd126('0x3f')](_0xe30545));return _0xe30545;});};exports[_0xd126('0x7d')]=function(_0x24e1b6,_0x1da739,_0x58184f,_0xf11571){var _0x33c0a9=util[_0xd126('0x7e')](_0xd126('0x7f'),ISPEECH_API,_0x24e1b6,encodeURIComponent(_0x1da739),_0x58184f,_0xf11571);var _0x25ab71=path[_0xd126('0x28')](__dirname,'tmp',rs[_0xd126('0x2a')](0x4)+'.mp3');var _0x4daf61;return downloadFile(_0x33c0a9,_0x25ab71)[_0xd126('0x2e')](function(){_0x4daf61=path[_0xd126('0x28')](__dirname,'tmp',rs[_0xd126('0x2a')](0x4)+_0xd126('0x2b'));return convertFile(_0x25ab71,_0x4daf61);})[_0xd126('0x2e')](function(){try{fs[_0xd126('0x1d')](_0x25ab71);fs['chmodSync'](_0x4daf61,'777');}catch(_0x2f7367){logger[_0xd126('0x15')](_0x2f7367);}return _0x4daf61[_0xd126('0x2f')]('.')[0x0];});};exports['ispeechASR']=function(_0x22e2ab,_0x1b4658,_0x1044ba,_0x5e7c87){var _0x52ed45=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1b4658,_0x1044ba,base64Encode(_0x22e2ab),_0x5e7c87?util[_0xd126('0x7e')]('model=%s',encodeURIComponent(_0x5e7c87)):_0xd126('0x80'));return uploadFile(_0x52ed45)[_0xd126('0x2e')](function(_0xb26cb0){return querystring[_0xd126('0x9')](_0xb26cb0);});};exports[_0xd126('0x81')]=function(_0x20ff24,_0x4667fd){return sestek['nda'](_0x20ff24,_0x4667fd)['then'](function(_0x50270c){logger[_0xd126('0x25')](JSON[_0xd126('0x3f')](_0x50270c));var _0x5b9585={'speech':_0x50270c[_0xd126('0x82')],'action':_0x50270c[_0xd126('0x83')]?_0x50270c[_0xd126('0x83')][_0xd126('0x84')]:undefined,'actiondata':_0x50270c[_0xd126('0x83')]?_0x50270c[_0xd126('0x83')][_0xd126('0x85')]:undefined};if(_0x50270c[_0xd126('0x83')]&&_0x50270c[_0xd126('0x83')][_0xd126('0x86')]){return base64Decode(_0x50270c[_0xd126('0x83')]['AudioFromTts']['Data'],path[_0xd126('0x28')](__dirname,_0xd126('0x29'),rs[_0xd126('0x2a')](0x4)+_0xd126('0x2b')))[_0xd126('0x2e')](function(_0x5e1283){_0x5b9585['audiofile']=_0x5e1283;return _0x5b9585;});}return _0x5b9585;});};exports[_0xd126('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0x53c5=['displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','format','model=%s','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./tilde','../../../config/logger','protocol','https:','host','WHAT_EVER','statusCode','error','statusMessage','request\x20to\x20','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','get','end','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','tmp','.wav','writeFileSync','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','?key=','ssml','input','voice','MP3','resolve','generate','from','writeFile','then','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','asr','uri','map','alternatives','transcript','results','confidence','join','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','result','action','actionIncomplete','fulfillment','speech','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent'];(function(_0x1f23bf,_0x4a2a8a){var _0x366964=function(_0x7bbde8){while(--_0x7bbde8){_0x1f23bf['push'](_0x1f23bf['shift']());}};_0x366964(++_0x4a2a8a);}(_0x53c5,0x122));var _0x553c=function(_0xe60ab5,_0x667760){_0xe60ab5=_0xe60ab5-0x0;var _0x20850e=_0x53c5[_0xe60ab5];return _0x20850e;};'use strict';var apiai=require(_0x553c('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x553c('0x1'));var fs=require('fs');var http=require(_0x553c('0x2'));var https=require(_0x553c('0x3'));var md5=require(_0x553c('0x4'));var path=require(_0x553c('0x5'));var querystring=require(_0x553c('0x6'));var rp=require('request-promise');var rs=require(_0x553c('0x7'));var sox=require(_0x553c('0x8'));var tts=require(_0x553c('0x9'));var urlParse=require(_0x553c('0xa'))[_0x553c('0xb')];var util=require(_0x553c('0xc'));var aws=require(_0x553c('0xd'));var google=require(_0x553c('0xe'));var sestek=require('./sestek');var tilde=require(_0x553c('0xf'));var logger=require(_0x553c('0x10'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0xf27ce2,_0x2419f8){return new BPromise(function(_0x6b8c86,_0x271d3a){var _0x242623=urlParse(_0xf27ce2);var _0x2f2aac=_0x242623[_0x553c('0x11')]===_0x553c('0x12')?https:http;var _0x5dbfce={'host':_0x242623[_0x553c('0x13')],'path':_0x242623['path'],'headers':{'user-agent':_0x553c('0x14')}};_0x2f2aac['get'](_0x5dbfce,function(_0x1c4593){if(_0x1c4593[_0x553c('0x15')]!==0xc8){logger[_0x553c('0x16')]('request\x20to\x20'+_0xf27ce2+'\x20failed,\x20status\x20code\x20=\x20'+_0x1c4593['statusCode']+'\x20('+_0x1c4593[_0x553c('0x17')]+')');_0x271d3a(new Error(_0x553c('0x18')+_0xf27ce2+'\x20failed,\x20status\x20code\x20=\x20'+_0x1c4593[_0x553c('0x15')]+'\x20('+_0x1c4593[_0x553c('0x17')]+')'));return;}var _0x4fc169=fs[_0x553c('0x19')](_0x2419f8);_0x4fc169['on'](_0x553c('0x1a'),function(){logger['info'](_0x553c('0x1b'));_0x4fc169[_0x553c('0x1c')](_0x6b8c86);});_0x4fc169['on']('error',function(_0x5dc06d){fs[_0x553c('0x1d')](_0x2419f8);logger[_0x553c('0x16')](_0x553c('0x1e'),_0x5dc06d);_0x271d3a(_0x5dc06d);});_0x1c4593[_0x553c('0x1f')](_0x4fc169);})['on'](_0x553c('0x16'),function(_0x47d2de){logger[_0x553c('0x16')](_0x47d2de);_0x271d3a(_0x47d2de);})['end']();});}function uploadFile(_0x3690f0){return new BPromise(function(_0x57383b,_0x37010d){var _0xc404ab=urlParse(_0x3690f0);var _0x3600ea=_0xc404ab[_0x553c('0x11')]===_0x553c('0x12')?https:http;var _0x17a41c={'host':_0xc404ab[_0x553c('0x13')],'path':_0xc404ab[_0x553c('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x3600ea[_0x553c('0x20')](_0x17a41c,function(_0x1690d9){if(_0x1690d9[_0x553c('0x15')]!==0xc8){_0x37010d(new Error(_0x553c('0x18')+_0x3690f0+'\x20failed,\x20status\x20code\x20=\x20'+_0x1690d9[_0x553c('0x15')]+'\x20('+_0x1690d9['statusMessage']+')'));return;}var _0x5376ee='';_0x1690d9['on']('data',function(_0x2b07e2){_0x5376ee+=_0x2b07e2;});_0x1690d9['on'](_0x553c('0x21'),function(){_0x57383b(_0x5376ee);});})['on']('error',function(_0x5dec87){_0x37010d(_0x5dec87);})[_0x553c('0x21')]();});}function convertFile(_0x49c536,_0x34ebdd){return new BPromise(function(_0x12922e,_0x2e71b){var _0x258b87=sox[_0x553c('0x22')](_0x49c536,_0x34ebdd,{'sampleRate':0x1f40,'format':_0x553c('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x258b87['on'](_0x553c('0x16'),function(_0x2feb9f){logger[_0x553c('0x16')](_0x553c('0x24'),_0x2feb9f);_0x2e71b(_0x2feb9f);});_0x258b87['on']('end',function(){logger[_0x553c('0x25')](_0x553c('0x26'));_0x12922e();});_0x258b87[_0x553c('0x27')]();});}function base64Decode(_0x43d35b,_0x3e6f39){var _0x533924=path['resolve'](__dirname,_0x553c('0x28'),rs['generate'](0x4)+_0x553c('0x29'));fs[_0x553c('0x2a')](_0x533924,_0x43d35b,'base64');return convertFile(_0x533924,_0x3e6f39)['then'](function(){try{fs[_0x553c('0x1d')](_0x533924);fs[_0x553c('0x2b')](_0x3e6f39,_0x553c('0x2c'));}catch(_0x3fc389){logger['error'](_0x3fc389);}return _0x3e6f39[_0x553c('0x2d')]('.')[0x0];});}function base64Encode(_0x2d16da){var _0x235990=fs[_0x553c('0x2e')](_0x2d16da);return new Buffer(_0x235990)[_0x553c('0x2f')](_0x553c('0x30'));}exports[_0x553c('0x31')]=function(_0xf6275a,_0x2b3299,_0x56b6af,_0x5f01f8,_0x5964fd,_0x10a313){var _0x3b3f79,_0x2c0202;var _0x5950f9='https://texttospeech.googleapis.com/v1/';var _0x4dae4c=_0x553c('0x32')+_0xf6275a;var _0x52450a={};if(_0x2b3299===_0x553c('0x33')){_0x52450a[_0x553c('0x34')]={'ssml':_0x56b6af};}else{_0x52450a[_0x553c('0x34')]={'text':_0x56b6af};};_0x52450a[_0x553c('0x35')]={'languageCode':_0x5f01f8,'ssmlGender':_0x5964fd};_0x52450a['audioConfig']={'audioEncoding':_0x553c('0x36'),'sampleRateHertz':0x1f40};var _0x3a5414={'url':_0x5950f9+'text:synthesize'+_0x4dae4c,'method':'POST','json':!![],'body':_0x52450a};return rp(_0x3a5414)['then'](function(_0x405836){return new BPromise(function(_0x35bf0e,_0x1df6d8){_0x3b3f79=path[_0x553c('0x37')](__dirname,'tmp',rs[_0x553c('0x38')](0x4)+'.mp3');var _0x288735=Buffer[_0x553c('0x39')](_0x405836['audioContent'],_0x553c('0x30'));return fs[_0x553c('0x3a')](_0x3b3f79,_0x288735,function(_0x355a6e){_0x1df6d8(_0x355a6e);},function(_0x588566){fs[_0x553c('0x2b')](_0x3b3f79,_0x553c('0x2c'));_0x35bf0e(_0x588566);});});})[_0x553c('0x3b')](function(_0x3b7417){_0x2c0202=path[_0x553c('0x37')](__dirname,_0x553c('0x28'),rs['generate'](0x4)+'.wav');return convertFile(_0x3b3f79,_0x2c0202);})['then'](function(){try{fs[_0x553c('0x1d')](_0x3b3f79);fs[_0x553c('0x2b')](_0x2c0202,_0x553c('0x2c'));}catch(_0x4ded39){logger['error'](_0x4ded39);}logger['info'](_0x553c('0x3c'),_0x2c0202[_0x553c('0x2d')]('.')[0x0]);return _0x2c0202[_0x553c('0x2d')]('.')[0x0];});};exports['googleTTS']=function(_0x200cec,_0x17ce67){var _0x535bc0=_0x553c('0x3d');var _0x249ae9,_0x15f490;var _0xf693b3;var _0xba2d7b={'encoding':_0x553c('0x3e'),'method':'POST','timeout':0x2710,'url':_0x535bc0,'headers':{'Content-Type':_0x553c('0x3f')},'body':_0x553c('0x40')+encodeURIComponent(JSON[_0x553c('0x41')]([[[_0x553c('0x42'),JSON['stringify']([_0x200cec,_0x17ce67||'en',![],'null']),null,'generic']]]))};return rp(_0xba2d7b)['then'](function(_0x20924a){try{_0xf693b3=eval(_0x20924a[_0x553c('0x43')](0x5))[0x0][0x2];}catch(_0x3a8b17){throw new Error(_0x553c('0x44')+_0x20924a[_0x553c('0x45')]);}if(!_0xf693b3){if(_0x200cec[_0x553c('0x46')]>0xc8){throw new Error(_0x553c('0x47'));}else{throw new Error(_0x553c('0x48')+_0x17ce67+_0x553c('0x49'));}}try{_0xf693b3=eval(_0xf693b3)[0x0];}catch(_0x84385f){throw new Error(_0x553c('0x44')+res[_0x553c('0x45')]);}const _0xbb517b=_0xf693b3;_0x249ae9=path['resolve'](__dirname,_0x553c('0x28'),rs[_0x553c('0x38')](0x4)+_0x553c('0x4a'));fs[_0x553c('0x2a')](_0x249ae9,_0xf693b3,{'encoding':_0x553c('0x30')});_0x15f490=path[_0x553c('0x37')](__dirname,_0x553c('0x28'),rs['generate'](0x4)+_0x553c('0x29'));return convertFile(_0x249ae9,_0x15f490);})[_0x553c('0x3b')](function(){try{fs[_0x553c('0x1d')](_0x249ae9);fs['chmodSync'](_0x15f490,'777');}catch(_0x1f9322){logger['error'](_0x1f9322);}logger[_0x553c('0x25')](_0x553c('0x4b'),_0x15f490['split']('.')[0x0]);return _0x15f490[_0x553c('0x2d')]('.')[0x0];});};exports[_0x553c('0x4c')]=function(_0x5865e2,_0x2fecb9,_0x4b6b32){return google[_0x553c('0x4d')](_0x5865e2,_0x2fecb9,_0x4b6b32)[_0x553c('0x3b')](function(_0xc25f50){logger[_0x553c('0x25')](_0xc25f50[_0x553c('0x4e')]);return rp(_0xc25f50);})[_0x553c('0x3b')](function(_0x263652){var _0x27a4ee='';var _0x4a8dfd=0x0;try{fs['unlink'](_0x5865e2);}catch(_0x80611b){logger[_0x553c('0x16')](_0x80611b);}if(_0x263652&&_0x263652['results']){_0x27a4ee=_0x263652['results'][_0x553c('0x4f')](function(_0xd56c36){return _0xd56c36&&_0xd56c36['alternatives'][0x0]&&_0xd56c36[_0x553c('0x50')][0x0][_0x553c('0x51')]?_0xd56c36[_0x553c('0x50')][0x0]['transcript']:'';})['join']('\x0a');_0x4a8dfd=_0x263652[_0x553c('0x52')][_0x553c('0x4f')](function(_0x4669a3){return _0x4669a3&&_0x4669a3[_0x553c('0x50')][0x0]&&_0x4669a3[_0x553c('0x50')][0x0][_0x553c('0x53')]?_0x4669a3[_0x553c('0x50')][0x0][_0x553c('0x53')]:0x0;})[_0x553c('0x54')]('\x0a');}logger[_0x553c('0x25')]('googleASR\x20transcription',_0x27a4ee);logger[_0x553c('0x25')](_0x553c('0x55'),_0x4a8dfd);return{'transcript':_0x27a4ee,'confidence':_0x4a8dfd};})[_0x553c('0x56')](function(_0x470b5e){logger['error'](_0x553c('0x57'),_0x470b5e['statusCode'],_0x470b5e[_0x553c('0x58')],_0x470b5e[_0x553c('0x59')]);});};exports['googleDialogflow']=function(_0x441104,_0x264d8b,_0x18aa72,_0x4be4d5){var _0x4932df=apiai(_0x264d8b,{'language':_0x4be4d5||'en'});return _0x4932df['textRequest'](_0x18aa72,{'sessionId':md5(_0x441104)})[_0x553c('0x3b')](function(_0x30d0de){logger[_0x553c('0x25')](JSON['stringify'](_0x30d0de));return{'source':_0x30d0de[_0x553c('0x5a')]['source'],'resolvedQuery':_0x30d0de[_0x553c('0x5a')]['resolvedQuery'],'action':_0x30d0de[_0x553c('0x5a')][_0x553c('0x5b')],'actionIncomplete':_0x30d0de[_0x553c('0x5a')][_0x553c('0x5c')],'speech':_0x30d0de['result'][_0x553c('0x5d')][_0x553c('0x5e')],'score':_0x30d0de['result'][_0x553c('0x5f')],'statusCode':_0x30d0de[_0x553c('0x60')]['code'],'endConversation':_0x30d0de['result'][_0x553c('0x61')][_0x553c('0x62')]||![],'isFallbackIntent':_0x30d0de['result'][_0x553c('0x61')][_0x553c('0x63')]};});};exports[_0x553c('0x64')]=function(_0x563b2c,_0x4c1f72,_0x1b8ece,_0x1fc969,_0x38f9c9,_0x20186e){var _0x8615a0=_0x1fc969[_0x553c('0x65')](/\\n/g,'\x0a');var _0x20857f={'credentials':{'private_key':_0x8615a0,'client_email':_0x1b8ece}};var _0x4fa5fc=new dialogflow[(_0x553c('0x66'))](_0x20857f);var _0x40566a=_0x4fa5fc[_0x553c('0x67')](_0x4c1f72,md5(_0x563b2c));var _0x40660a={'session':_0x40566a,'queryInput':{'text':{'text':_0x38f9c9,'languageCode':_0x20186e}}};return _0x4fa5fc['detectIntent'](_0x40660a)[_0x553c('0x3b')](function(_0x20be11){if(_0x20be11&&_0x20be11[_0x553c('0x46')]){logger[_0x553c('0x25')](_0x553c('0x68'),JSON['stringify'](_0x20be11));var _0x4db435=_0x20be11[0x0];if(_0x4db435){var _0x4395bf={'action':_0x4db435[_0x553c('0x69')][_0x553c('0x5b')],'allRequiredParamsPresent':_0x4db435[_0x553c('0x69')]['allRequiredParamsPresent'],'endConversation':_0x4db435[_0x553c('0x69')][_0x553c('0x6a')]&&_0x4db435[_0x553c('0x69')][_0x553c('0x6a')][_0x553c('0x6b')]?_0x4db435[_0x553c('0x69')][_0x553c('0x6a')][_0x553c('0x6b')][_0x553c('0x6c')][_0x553c('0x6d')]:![],'fulfillmentText':_0x4db435[_0x553c('0x69')][_0x553c('0x6e')],'intentName':_0x4db435[_0x553c('0x69')][_0x553c('0x6f')]['name'],'intentDisplayName':_0x4db435[_0x553c('0x69')]['intent'][_0x553c('0x70')],'isFallbackIntent':_0x4db435[_0x553c('0x69')][_0x553c('0x6f')][_0x553c('0x71')],'languageCode':_0x4db435[_0x553c('0x69')][_0x553c('0x72')],'queryText':_0x4db435[_0x553c('0x69')][_0x553c('0x73')],'responseId':_0x4db435[_0x553c('0x74')],'score':_0x4db435[_0x553c('0x69')][_0x553c('0x75')],'speech':_0x4db435[_0x553c('0x69')][_0x553c('0x6e')],'providerResponse':JSON['stringify'](_0x20be11)};return _0x4395bf;}}});};exports['tildeASR']=function(_0x4514ac,_0x3e342a,_0x578e2f,_0x5dde12){return tilde[_0x553c('0x4d')](_0x4514ac,_0x3e342a,_0x578e2f,_0x5dde12)[_0x553c('0x3b')](function(_0x278d4c){try{fs[_0x553c('0x1d')](_0x4514ac);}catch(_0x5666ec){logger[_0x553c('0x16')](_0x5666ec);}logger[_0x553c('0x25')]('Tilde\x20ASR\x20transcription',_0x278d4c[_0x553c('0x51')]);logger[_0x553c('0x25')](_0x553c('0x76'),_0x278d4c['confidence']);return _0x278d4c;});};exports[_0x553c('0x77')]=function(_0x1b0482,_0x2d92db,_0x2feddc,_0x1ceaf5,_0x4edec6,_0x51a7e8){var _0x231174=path[_0x553c('0x37')](__dirname,_0x553c('0x28'),rs[_0x553c('0x38')](0x4)+_0x553c('0x4a'));var _0x5abd0f;return aws[_0x553c('0x78')](_0x1b0482,_0x2d92db,_0x2feddc,_0x1ceaf5,_0x4edec6,_0x51a7e8,_0x231174)[_0x553c('0x3b')](function(){_0x5abd0f=path[_0x553c('0x37')](__dirname,'tmp',rs[_0x553c('0x38')](0x4)+_0x553c('0x29'));return convertFile(_0x231174,_0x5abd0f);})['then'](function(){try{fs['unlink'](_0x231174);fs['chmodSync'](_0x5abd0f,_0x553c('0x2c'));}catch(_0x458cde){logger[_0x553c('0x16')](_0x458cde);}return _0x5abd0f[_0x553c('0x2d')]('.')[0x0];});};exports[_0x553c('0x79')]=function(_0x5e5526,_0x3453a1,_0x367ca2,_0x1f044a,_0x9b6f67,_0x5e3d50){return aws['lex'](_0x5e5526,_0x3453a1,_0x367ca2,_0x1f044a,_0x9b6f67,_0x5e3d50)[_0x553c('0x3b')](function(_0x1696ce){logger[_0x553c('0x25')](JSON[_0x553c('0x41')](_0x1696ce));return _0x1696ce;});};exports[_0x553c('0x7a')]=function(_0x20cab9,_0x498758,_0x65c537,_0x452e39){var _0x57acdc=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x20cab9,encodeURIComponent(_0x498758),_0x65c537,_0x452e39);var _0x2155b1=path[_0x553c('0x37')](__dirname,_0x553c('0x28'),rs[_0x553c('0x38')](0x4)+_0x553c('0x4a'));var _0x954e20;return downloadFile(_0x57acdc,_0x2155b1)[_0x553c('0x3b')](function(){_0x954e20=path[_0x553c('0x37')](__dirname,_0x553c('0x28'),rs[_0x553c('0x38')](0x4)+_0x553c('0x29'));return convertFile(_0x2155b1,_0x954e20);})[_0x553c('0x3b')](function(){try{fs['unlink'](_0x2155b1);fs[_0x553c('0x2b')](_0x954e20,_0x553c('0x2c'));}catch(_0x91d181){logger[_0x553c('0x16')](_0x91d181);}return _0x954e20[_0x553c('0x2d')]('.')[0x0];});};exports[_0x553c('0x7b')]=function(_0x4a4490,_0x12f45e,_0xf1a05c,_0x25b882){var _0x2e6da4=util['format'](_0x553c('0x7c'),ISPEECH_API,_0x12f45e,_0xf1a05c,base64Encode(_0x4a4490),_0x25b882?util[_0x553c('0x7d')](_0x553c('0x7e'),encodeURIComponent(_0x25b882)):'freeform=3');return uploadFile(_0x2e6da4)[_0x553c('0x3b')](function(_0x47edb6){return querystring['parse'](_0x47edb6);});};exports['sestekNDA']=function(_0x2fe313,_0x13b42a){return sestek['nda'](_0x2fe313,_0x13b42a)['then'](function(_0xcdf1ba){logger[_0x553c('0x25')](JSON[_0x553c('0x41')](_0xcdf1ba));var _0x564eac={'speech':_0xcdf1ba['text'],'action':_0xcdf1ba['channelData']?_0xcdf1ba[_0x553c('0x7f')][_0x553c('0x80')]:undefined,'actiondata':_0xcdf1ba[_0x553c('0x7f')]?_0xcdf1ba[_0x553c('0x7f')][_0x553c('0x81')]:undefined};if(_0xcdf1ba[_0x553c('0x7f')]&&_0xcdf1ba['channelData'][_0x553c('0x82')]){return base64Decode(_0xcdf1ba[_0x553c('0x7f')][_0x553c('0x82')][_0x553c('0x83')],path[_0x553c('0x37')](__dirname,'tmp',rs[_0x553c('0x38')](0x4)+_0x553c('0x29')))['then'](function(_0x291146){_0x564eac[_0x553c('0x84')]=_0x291146;return _0x564eac;});}return _0x564eac;});};exports[_0x553c('0x85')]=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 ee0ce4c..1ddb095 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 _0x4321=['exports','./nda'];(function(_0x512d6b,_0x578dc7){var _0x5689c5=function(_0x3ffc0d){while(--_0x3ffc0d){_0x512d6b['push'](_0x512d6b['shift']());}};_0x5689c5(++_0x578dc7);}(_0x4321,0x6b));var _0x1432=function(_0x348b3c,_0x417baf){_0x348b3c=_0x348b3c-0x0;var _0x45c22d=_0x4321[_0x348b3c];return _0x45c22d;};var nda=require(_0x1432('0x0'));module[_0x1432('0x1')]={'nda':nda}; \ No newline at end of file +var _0x8e48=['exports'];(function(_0x587b43,_0x59b7cf){var _0x1771bc=function(_0x5339f1){while(--_0x5339f1){_0x587b43['push'](_0x587b43['shift']());}};_0x1771bc(++_0x59b7cf);}(_0x8e48,0xf8));var _0x88e4=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x8e48[_0x618414];return _0x21c19a;};var nda=require('./nda');module[_0x88e4('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index bd86265..199c438 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 _0x6075=['access_token','body','channelData','project','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','agi','exports','ndauth_url','password','POST','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','text','Bearer\x20'];(function(_0x213ed5,_0x26712a){var _0x191514=function(_0x2d9305){while(--_0x2d9305){_0x213ed5['push'](_0x213ed5['shift']());}};_0x191514(++_0x26712a);}(_0x6075,0x142));var _0x5607=function(_0x274b75,_0x2b87ea){_0x274b75=_0x274b75-0x0;var _0x1440d6=_0x6075[_0x274b75];return _0x1440d6;};'use strict';var rp=require(_0x5607('0x0'));var url=require(_0x5607('0x1'));var logger=require('../../../../../config/logger')(_0x5607('0x2'));module[_0x5607('0x3')]=function(_0x5ab30d,_0x48cde9){var _0x1a5179={'method':'POST','uri':url['resolve'](_0x48cde9[_0x5607('0x4')],'/token'),'form':{'grant_type':_0x5607('0x5'),'username':_0x48cde9['username'],'password':_0x48cde9[_0x5607('0x5')]},'json':!![]};return rp(_0x1a5179)['then'](function(_0x415836){var _0x5f92ad={'method':_0x5607('0x6'),'uri':url[_0x5607('0x7')](_0x48cde9[_0x5607('0x8')],_0x5607('0x9')),'body':{'type':_0x48cde9[_0x5607('0xa')]||_0x5607('0xb'),'channelId':_0x5607('0xc'),'conversation':{'id':_0x5ab30d[_0x5607('0xd')]},'from':{'id':_0x5ab30d[_0x5607('0xe')],'name':_0x5ab30d[_0x5607('0xf')]},'recipient':{'id':_0x5ab30d[_0x5607('0x10')],'name':_0x5ab30d['extension']},'text':_0x48cde9[_0x5607('0x11')],'channelData':{}},'headers':{'Authorization':_0x5607('0x12')+_0x415836[_0x5607('0x13')]},'json':!![]};if(_0x48cde9['project']){_0x5f92ad[_0x5607('0x14')][_0x5607('0x15')]['ProjectName']=_0x48cde9[_0x5607('0x16')];}if(_0x48cde9[_0x5607('0x17')]=='1'){_0x5f92ad['body'][_0x5607('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x5607('0x18')};}if(_0x48cde9[_0x5607('0x19')]){_0x5f92ad[_0x5607('0x14')][_0x5607('0x15')][_0x5607('0x1a')]=_0x48cde9[_0x5607('0x19')];if(_0x48cde9[_0x5607('0x1b')]){_0x5f92ad[_0x5607('0x14')][_0x5607('0x15')][_0x5607('0x1c')]=_0x48cde9[_0x5607('0x1b')];}}logger[_0x5607('0x1d')](JSON[_0x5607('0x1e')](_0x5f92ad));return rp(_0x5f92ad);});}; \ No newline at end of file +var _0x3189=['CustomAction','custom_action_data','body','CustomActionData','info','stringify','request-promise','url','agi','exports','ndauth_url','/token','username','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','callerid','dnid','extension','text','access_token','channelData','project','ndagenerate_audio','AudioOutputSettings','audio/wav'];(function(_0x37f415,_0x550675){var _0x2f644f=function(_0x13f015){while(--_0x13f015){_0x37f415['push'](_0x37f415['shift']());}};_0x2f644f(++_0x550675);}(_0x3189,0xae));var _0x9318=function(_0x3d30d3,_0x279633){_0x3d30d3=_0x3d30d3-0x0;var _0x4eb58c=_0x3189[_0x3d30d3];return _0x4eb58c;};'use strict';var rp=require(_0x9318('0x0'));var url=require(_0x9318('0x1'));var logger=require('../../../../../config/logger')(_0x9318('0x2'));module[_0x9318('0x3')]=function(_0x1e5359,_0x4eb59a){var _0x3dbe6b={'method':'POST','uri':url['resolve'](_0x4eb59a[_0x9318('0x4')],_0x9318('0x5')),'form':{'grant_type':'password','username':_0x4eb59a[_0x9318('0x6')],'password':_0x4eb59a['password']},'json':!![]};return rp(_0x3dbe6b)['then'](function(_0x2f6831){var _0x324307={'method':_0x9318('0x7'),'uri':url['resolve'](_0x4eb59a[_0x9318('0x8')],_0x9318('0x9')),'body':{'type':_0x4eb59a[_0x9318('0xa')]||_0x9318('0xb'),'channelId':'Nda','conversation':{'id':_0x1e5359['uniqueid']},'from':{'id':_0x1e5359[_0x9318('0xc')],'name':_0x1e5359['calleridname']},'recipient':{'id':_0x1e5359[_0x9318('0xd')],'name':_0x1e5359[_0x9318('0xe')]},'text':_0x4eb59a[_0x9318('0xf')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x2f6831[_0x9318('0x10')]},'json':!![]};if(_0x4eb59a['project']){_0x324307['body'][_0x9318('0x11')]['ProjectName']=_0x4eb59a[_0x9318('0x12')];}if(_0x4eb59a[_0x9318('0x13')]=='1'){_0x324307['body'][_0x9318('0x11')][_0x9318('0x14')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x9318('0x15')};}if(_0x4eb59a['custom_action']){_0x324307['body'][_0x9318('0x11')][_0x9318('0x16')]=_0x4eb59a['custom_action'];if(_0x4eb59a[_0x9318('0x17')]){_0x324307[_0x9318('0x18')]['channelData'][_0x9318('0x19')]=_0x4eb59a[_0x9318('0x17')];}}logger[_0x9318('0x1a')](JSON[_0x9318('0x1b')](_0x324307));return rp(_0x324307);});}; \ 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 2bb3857..519da2d 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 _0x9a50=['./lib/api'];(function(_0x4f6e7d,_0x6b3cf4){var _0x126987=function(_0x5bb04e){while(--_0x5bb04e){_0x4f6e7d['push'](_0x4f6e7d['shift']());}};_0x126987(++_0x6b3cf4);}(_0x9a50,0xa0));var _0x09a5=function(_0x41a6b1,_0x33302b){_0x41a6b1=_0x41a6b1-0x0;var _0x26a187=_0x9a50[_0x41a6b1];return _0x26a187;};'use strict';var asr=require(_0x09a5('0x0'));module['exports']=function(_0xc22fd2,_0x55b31a,_0x18c8e7,_0x31e64f){return asr(_0xc22fd2,_0x55b31a,_0x18c8e7,_0x31e64f);}; \ No newline at end of file +var _0x387a=['./lib/api','exports'];(function(_0x1b5d79,_0x3c6183){var _0xd74300=function(_0x3d66d1){while(--_0x3d66d1){_0x1b5d79['push'](_0x1b5d79['shift']());}};_0xd74300(++_0x3c6183);}(_0x387a,0x11a));var _0xa387=function(_0x249898,_0x3f4d52){_0x249898=_0x249898-0x0;var _0x19e3fa=_0x387a[_0x249898];return _0x19e3fa;};'use strict';var asr=require(_0xa387('0x0'));module[_0xa387('0x1')]=function(_0x3c1c09,_0x2fe755,_0x5d92d8,_0x13ed71){return asr(_0x3c1c09,_0x2fe755,_0x5d92d8,_0x13ed71);}; \ 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 b414597..cd30f34 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 _0x6d3c=['Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','close','lodash','moment','crypto','../../../../../../config/logger','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','data','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error'];(function(_0xc3e66a,_0x25acc9){var _0x55986a=function(_0x33466c){while(--_0x33466c){_0xc3e66a['push'](_0xc3e66a['shift']());}};_0x55986a(++_0x25acc9);}(_0x6d3c,0xa6));var _0xc6d3=function(_0x52c74c,_0xb501ba){_0x52c74c=_0x52c74c-0x0;var _0x2390f1=_0x6d3c[_0x52c74c];return _0x2390f1;};'use strict';var BPromise=require('bluebird');var _=require(_0xc6d3('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xc6d3('0x1'));var crypto=require(_0xc6d3('0x2'));var logger=require(_0xc6d3('0x3'))('agi');module[_0xc6d3('0x4')]=function(_0x36d8ec,_0x4b030c,_0x4ea725,_0x5b73bb){return new BPromise(function(_0x3e2993,_0x292999){logger[_0xc6d3('0x5')]('Tilde\x20URI',_0x5b73bb||_0xc6d3('0x6'));var _0x435e03=new WebSocket(_0x5b73bb||_0xc6d3('0x6'),{'perMessageDeflate':![]});var _0x45c983='';var _0x4c7b6e='0';var _0x3aa7d9='1';var _0x429445=_0xc6d3('0x7');function _0x136c10(_0x27a32c){var _0x1e939e=crypto[_0xc6d3('0x8')](_0xc6d3('0x9'));_0x1e939e[_0xc6d3('0xa')](_0x27a32c);return _0x1e939e['digest'](_0xc6d3('0xb'));}function _0x1dc8f0(){try{logger[_0xc6d3('0x5')](_0xc6d3('0xc'));var _0x3a45c8=moment()['unix']();var _0x9a3b4=_0x136c10(_0x3a45c8+_0x4b030c+_0x4ea725);_0x435e03[_0xc6d3('0xd')](JSON[_0xc6d3('0xe')]({'appID':_0x4b030c,'timestamp':_0x3a45c8,'appKey':_0x9a3b4}));var _0x473ea3=fs['createReadStream'](_0x36d8ec);_0x473ea3['on'](_0xc6d3('0xf'),function(_0xb368ce){_0x435e03['send'](_0xb368ce);});_0x473ea3['on']('close',function(){_0x435e03[_0xc6d3('0xd')](_0xc6d3('0x10'));});}catch(_0x1dbcde){logger[_0xc6d3('0x11')](_0xc6d3('0x12'),JSON[_0xc6d3('0xe')](_0x1dbcde));_0x435e03[_0xc6d3('0x13')]();}}function _0x592fc2(_0x1c6aa2){try{if(_0x1c6aa2){var _0x2fd1b8=JSON[_0xc6d3('0x14')](_0x1c6aa2);switch(_0x2fd1b8[_0xc6d3('0x15')]){case 0x0:if(_0x2fd1b8['result']){if(_0x2fd1b8[_0xc6d3('0x16')][_0xc6d3('0x17')]){logger[_0xc6d3('0x5')](_0xc6d3('0x18'),JSON['stringify'](_0x2fd1b8['result'][_0xc6d3('0x19')]));_0x45c983=_0x2fd1b8[_0xc6d3('0x16')][_0xc6d3('0x19')][0x0][_0xc6d3('0x1a')];_0x4c7b6e=_0x2fd1b8[_0xc6d3('0x16')][_0xc6d3('0x19')][0x0][_0xc6d3('0x1b')];_0x3aa7d9='0';_0x429445=_0xc6d3('0x1c');_0x435e03[_0xc6d3('0x13')]();}}break;case 0x1:logger[_0xc6d3('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x3aa7d9='1';_0x429445='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xc6d3('0x5')](_0xc6d3('0x1d'));_0x3aa7d9='2';_0x429445='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xc6d3('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3aa7d9='9';_0x429445=_0xc6d3('0x1e');break;case 0xa:logger['info'](_0xc6d3('0x1f'));_0x3aa7d9='10';_0x429445=_0xc6d3('0x1f');break;case 0xb:logger[_0xc6d3('0x5')](_0xc6d3('0x20'));_0x3aa7d9='11';_0x429445=_0xc6d3('0x20');}}}catch(_0x2d5044){logger[_0xc6d3('0x11')](_0xc6d3('0x21'),JSON[_0xc6d3('0xe')](_0x2d5044));_0x435e03[_0xc6d3('0x13')]();}}function _0x43560d(){logger[_0xc6d3('0x5')](_0xc6d3('0x22'));_0x3e2993({'transcript':_0x45c983,'confidence':_0x4c7b6e,'status':_0x3aa7d9,'status_message':_0x429445});}function _0x5a2de5(_0x1fbdc3){logger[_0xc6d3('0x11')](_0xc6d3('0x23'));if(!_['isNil'](_0x1fbdc3)){logger[_0xc6d3('0x11')](_[_0xc6d3('0x24')](_0x1fbdc3)?JSON[_0xc6d3('0xe')](_0x1fbdc3):_0x1fbdc3);}}_0x435e03['on'](_0xc6d3('0x25'),_0x1dc8f0);_0x435e03['on'](_0xc6d3('0x26'),_0x592fc2);_0x435e03['on'](_0xc6d3('0x27'),_0x43560d);_0x435e03['on'](_0xc6d3('0x11'),_0x5a2de5);});}; \ No newline at end of file +var _0x327e=['No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','data','send','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','stringify','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','error','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x327e,0x1b5));var _0xe327=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x327e[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xe327('0x0'));var crypto=require(_0xe327('0x1'));var logger=require(_0xe327('0x2'))(_0xe327('0x3'));module[_0xe327('0x4')]=function(_0x40e95c,_0x13d3af,_0x1b2c78,_0x25adb7){return new BPromise(function(_0x1269f9,_0x3ea6a9){logger[_0xe327('0x5')]('Tilde\x20URI',_0x25adb7||_0xe327('0x6'));var _0x4a0478=new WebSocket(_0x25adb7||_0xe327('0x6'),{'perMessageDeflate':![]});var _0x3a9b41='';var _0x2edb08='0';var _0x3bd1ad='1';var _0x4f3239=_0xe327('0x7');function _0x1ffb9f(_0x27e497){var _0x17f07b=crypto[_0xe327('0x8')](_0xe327('0x9'));_0x17f07b[_0xe327('0xa')](_0x27e497);return _0x17f07b['digest'](_0xe327('0xb'));}function _0x1e56cd(){try{logger[_0xe327('0x5')](_0xe327('0xc'));var _0x21e92a=moment()['unix']();var _0x207897=_0x1ffb9f(_0x21e92a+_0x13d3af+_0x1b2c78);_0x4a0478['send'](JSON['stringify']({'appID':_0x13d3af,'timestamp':_0x21e92a,'appKey':_0x207897}));var _0x4858a7=fs['createReadStream'](_0x40e95c);_0x4858a7['on'](_0xe327('0xd'),function(_0x1378b3){_0x4a0478[_0xe327('0xe')](_0x1378b3);});_0x4858a7['on']('close',function(){_0x4a0478['send'](_0xe327('0xf'));});}catch(_0x43c3c5){logger['error'](_0xe327('0x10'),JSON['stringify'](_0x43c3c5));_0x4a0478[_0xe327('0x11')]();}}function _0x42a274(_0x828d4b){try{if(_0x828d4b){var _0x129522=JSON[_0xe327('0x12')](_0x828d4b);switch(_0x129522[_0xe327('0x13')]){case 0x0:if(_0x129522[_0xe327('0x14')]){if(_0x129522['result'][_0xe327('0x15')]){logger[_0xe327('0x5')](_0xe327('0x16'),JSON[_0xe327('0x17')](_0x129522['result'][_0xe327('0x18')]));_0x3a9b41=_0x129522[_0xe327('0x14')][_0xe327('0x18')][0x0]['transcript'];_0x2edb08=_0x129522[_0xe327('0x14')][_0xe327('0x18')][0x0]['likelihood'];_0x3bd1ad='0';_0x4f3239=_0xe327('0x19');_0x4a0478['terminate']();}}break;case 0x1:logger['info'](_0xe327('0x7'));_0x3bd1ad='1';_0x4f3239=_0xe327('0x7');break;case 0x2:logger[_0xe327('0x5')](_0xe327('0x1a'));_0x3bd1ad='2';_0x4f3239=_0xe327('0x1a');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3bd1ad='9';_0x4f3239=_0xe327('0x1b');break;case 0xa:logger['info'](_0xe327('0x1c'));_0x3bd1ad='10';_0x4f3239=_0xe327('0x1c');break;case 0xb:logger['info'](_0xe327('0x1d'));_0x3bd1ad='11';_0x4f3239=_0xe327('0x1d');}}}catch(_0x216c54){logger['error'](_0xe327('0x1e'),JSON[_0xe327('0x17')](_0x216c54));_0x4a0478['terminate']();}}function _0x4642bd(){logger['info'](_0xe327('0x1f'));_0x1269f9({'transcript':_0x3a9b41,'confidence':_0x2edb08,'status':_0x3bd1ad,'status_message':_0x4f3239});}function _0x19937b(_0x3ccaad){logger[_0xe327('0x20')](_0xe327('0x21'));if(!_[_0xe327('0x22')](_0x3ccaad)){logger[_0xe327('0x20')](_['isObject'](_0x3ccaad)?JSON[_0xe327('0x17')](_0x3ccaad):_0x3ccaad);}}_0x4a0478['on'](_0xe327('0x23'),_0x1e56cd);_0x4a0478['on'](_0xe327('0x24'),_0x42a274);_0x4a0478['on']('close',_0x4642bd);_0x4a0478['on'](_0xe327('0x20'),_0x19937b);});}; \ 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 da98d85..22285f6 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 _0x115d=['./asr','exports'];(function(_0x2a60da,_0x13835d){var _0x124121=function(_0xc0acd7){while(--_0xc0acd7){_0x2a60da['push'](_0x2a60da['shift']());}};_0x124121(++_0x13835d);}(_0x115d,0xf6));var _0xd115=function(_0x32de16,_0x22c224){_0x32de16=_0x32de16-0x0;var _0x543281=_0x115d[_0x32de16];return _0x543281;};var asr=require(_0xd115('0x0'));module[_0xd115('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7680=['./asr'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0x7680,0x13f));var _0x0768=function(_0x5f41de,_0x1d3e30){_0x5f41de=_0x5f41de-0x0;var _0x12cbf7=_0x7680[_0x5f41de];return _0x12cbf7;};var asr=require(_0x0768('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 8d44eaa..e119ec8 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x59dd83,_0x573f1b){var _0x5dd0de=function(_0x1c805d){while(--_0x1c805d){_0x59dd83['push'](_0x59dd83['shift']());}};_0x5dd0de(++_0x573f1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index b68fa1e..2fa7b8f 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 _0xae24=['scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','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','speed','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','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','replaceAllVariables','%s.%s','saveRestApiResult','length','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20query\x20configured','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','out','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20username\x20configured','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','response','maxdigit','test','extra','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','getdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','no\x20find\x20by\x20configured','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','getSound','getData','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','failure','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','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','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','shelljs','randomstring','moment','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','channel','rpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','name','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervalById','IntervalId','interval','map','getSoundPath','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone'];(function(_0x27c068,_0x342981){var _0xe5a67f=function(_0x20658a){while(--_0x20658a){_0x27c068['push'](_0x27c068['shift']());}};_0xe5a67f(++_0x342981);}(_0xae24,0x182));var _0x4ae2=function(_0x4fa88f,_0x540865){_0x4fa88f=_0x4fa88f-0x0;var _0x94ea74=_0xae24[_0x4fa88f];return _0x94ea74;};'use strict';var fs=require('fs');var util=require(_0x4ae2('0x0'));var _=require('lodash');var sh=require(_0x4ae2('0x1'));var odbc=require('odbc')();var rs=require(_0x4ae2('0x2'));var moment=require(_0x4ae2('0x3'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x4ae2('0x4'))('agi');var config=require(_0x4ae2('0x5'));var scripts=require(_0x4ae2('0x6'));var FILES_PATH=_0x4ae2('0x7');var recursiveMapAttributes=[_0x4ae2('0x8'),_0x4ae2('0x9')];var verticesWithRetry=[_0x4ae2('0xa'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x41cdf1,_0x4d3d8a,_0x564ef9){this[_0x4ae2('0xb')]=_0x41cdf1;this[_0x4ae2('0xc')]=_0x4d3d8a;this['mailRpc']=_0x564ef9;};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xe')]=function(_0x171449,_0xb70265){this['rpc'][_0x4ae2('0xf')](_0x171449)[_0x4ae2('0x10')](function(_0x4163ce){_0xb70265(null,_0x4163ce?_0x4163ce['name']:![]);})[_0x4ae2('0x11')](function(_0x22ac1e){_0xb70265(_0x22ac1e);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x12')]=function(_0x24de98,_0x40954f){this[_0x4ae2('0xc')][_0x4ae2('0x13')](_0x24de98)[_0x4ae2('0x10')](function(_0x5e2bfd){_0x40954f(null,_0x5e2bfd?_0x5e2bfd['name']:![]);})['catch'](function(_0x2f3936){_0x40954f(_0x2f3936);});};AGIVertices[_0x4ae2('0xd')]['getSquareProject']=function(_0x463765,_0x9fb8db){this[_0x4ae2('0xc')][_0x4ae2('0x14')](_0x463765)[_0x4ae2('0x10')](function(_0x3b207c){_0x9fb8db(null,_0x3b207c?_0x3b207c[_0x4ae2('0x15')]:![]);})[_0x4ae2('0x11')](function(_0x41b672){_0x9fb8db(_0x41b672);});};AGIVertices[_0x4ae2('0xd')]['getSquareOdbc']=function(_0x4a97af,_0x44a2d3){this[_0x4ae2('0xc')]['getSquareOdbcById'](_0x4a97af)[_0x4ae2('0x10')](function(_0x343db1){_0x44a2d3(null,_0x343db1?_0x343db1[_0x4ae2('0x16')]:![]);})[_0x4ae2('0x11')](function(_0x8732bb){_0x44a2d3(_0x8732bb);});};AGIVertices['prototype'][_0x4ae2('0x17')]=function(_0x53c686,_0x522165){this[_0x4ae2('0xc')][_0x4ae2('0x18')](_0x53c686)[_0x4ae2('0x10')](function(_0x17041e){_0x522165(null,_0x17041e?_0x17041e[_0x4ae2('0x15')]:![]);})['catch'](function(_0x1005e0){_0x522165(_0x1005e0);});};AGIVertices['prototype'][_0x4ae2('0x19')]=function(_0x12b5d2,_0x130239){this['rpc'][_0x4ae2('0x1a')](_0x12b5d2)[_0x4ae2('0x10')](function(_0x2454b3){_0x130239(null,_0x2454b3?_0x2454b3[_0x4ae2('0x15')]:![]);})[_0x4ae2('0x11')](function(_0x255772){_0x130239(_0x255772);});};AGIVertices['prototype']['getSound']=function(_0x9508d7,_0x3030f8){var _0x3fa514=this;this[_0x4ae2('0xc')][_0x4ae2('0x1b')](_0x9508d7)[_0x4ae2('0x10')](function(_0x57a377){_0x3030f8(null,_0x57a377?_0x3fa514['getSoundPath'](_0x57a377[_0x4ae2('0x1c')]):![]);})['catch'](function(_0x554cff){_0x3030f8(_0x554cff);});};AGIVertices['prototype'][_0x4ae2('0x1d')]=function(_0x28bedd,_0x55fafd){this[_0x4ae2('0xc')][_0x4ae2('0x1e')](_0x28bedd)[_0x4ae2('0x10')](function(_0x146bc2){_0x55fafd(null,_0x146bc2?_0x146bc2:![]);})[_0x4ae2('0x11')](function(_0x23f954){_0x55fafd(_0x23f954);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x1f')]=function(_0x2904f1,_0x3542df,_0x386687){this[_0x4ae2('0x20')][_0x4ae2('0x1f')](_0x2904f1,_0x3542df)[_0x4ae2('0x10')](function(){_0x386687(null);})[_0x4ae2('0x11')](function(_0x31017c){_0x386687(_0x31017c);});};AGIVertices[_0x4ae2('0xd')]['getIntervals']=function(_0xdcd11e,_0x516e8c){this[_0x4ae2('0xc')][_0x4ae2('0x21')](_0xdcd11e)['then'](function(_0x1516b8){if(_0x1516b8){if(_0x1516b8[_0x4ae2('0x22')]){_0x516e8c(null,[_0x1516b8[_0x4ae2('0x23')]]);}else{_0x516e8c(null,_[_0x4ae2('0x24')](_0x1516b8['Intervals'],_0x4ae2('0x23')));}}else{_0x516e8c(null,![]);}})[_0x4ae2('0x11')](function(_0x29458e){_0x516e8c(_0x29458e);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x25')]=function(_0x142ce7){return util[_0x4ae2('0x26')](_0x4ae2('0x27'),FILES_PATH,_0x142ce7);};AGIVertices[_0x4ae2('0xd')]['getQueryOdbc']=function(_0x4275d5,_0x47ee5d,_0xe34b4c){odbc[_0x4ae2('0x28')](_0x4275d5,function(_0x2f566a){if(_0x2f566a){logger[_0x4ae2('0x29')](_0x4ae2('0x2a'),_0x2f566a);_0xe34b4c(_0x2f566a);}else{logger[_0x4ae2('0x2b')]('ODBC\x20connection\x20successfully');odbc[_0x4ae2('0x2c')](_0x47ee5d,function(_0x700f27,_0x20d755){if(_0x700f27){logger[_0x4ae2('0x2b')]('Error\x20executing\x20query\x20%s',_0x47ee5d);_0xe34b4c(_0x700f27);}else{logger[_0x4ae2('0x2b')](_0x4ae2('0x2d'),_0x47ee5d);odbc[_0x4ae2('0x2e')](function(_0x2a2dba){if(_0x2a2dba){logger[_0x4ae2('0x29')](_0x4ae2('0x2f'),_0x2a2dba);}_0xe34b4c(null,_0x20d755);});}});}});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x30')]=function(_0x1d5888,_0x1f4020){this[_0x4ae2('0xc')]['getSmsAccountById'](_0x1d5888)[_0x4ae2('0x10')](function(_0x3f0b3f){_0x1f4020(null,_0x3f0b3f?_0x3f0b3f:![]);})[_0x4ae2('0x11')](function(_0x1473e6){_0x1f4020(_0x1473e6);});};AGIVertices['prototype']['createSmsMessage']=function(_0xd46eed,_0x45527a){this[_0x4ae2('0xc')][_0x4ae2('0x31')](_0xd46eed)['then'](function(_0x3c0a56){_0x45527a(null,_0x3c0a56);})[_0x4ae2('0x11')](function(_0x5ca188){_0x45527a(_0x5ca188);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x32')]=function(_0x11a5d9,_0x5a9126,_0x2f6431){this[_0x4ae2('0xc')][_0x4ae2('0x32')]({'uniqueid':this[_0x4ae2('0xb')][_0x4ae2('0x33')],'node':_0x11a5d9[_0x4ae2('0x34')],'application':_0x11a5d9[_0x4ae2('0x35')],'data':_0x5a9126||null,'project_name':this[_0x4ae2('0xb')]['arg_1'],'callerid':this[_0x4ae2('0xb')][_0x4ae2('0x36')]})['then'](function(_0x3d5015){if(_0x2f6431){_0x2f6431(null,_0x3d5015);}})[_0x4ae2('0x11')](function(_0x578b0e){if(_0x2f6431){_0x2f6431(_0x578b0e);}});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x37')]=function(_0x4e30ab,_0x21baf4,_0x2ab00f,_0x6ed809){this['rpc']['createSquareRecording']({'uniqueid':this[_0x4ae2('0xb')][_0x4ae2('0x33')],'callerid':this[_0x4ae2('0xb')][_0x4ae2('0x36')],'calleridname':this['channel'][_0x4ae2('0x38')],'context':this[_0x4ae2('0xb')][_0x4ae2('0x39')],'extension':this['channel'][_0x4ae2('0x3a')],'priority':this[_0x4ae2('0xb')][_0x4ae2('0x3b')],'accountcode':this['channel'][_0x4ae2('0x3c')],'dnid':this[_0x4ae2('0xb')][_0x4ae2('0x3d')],'projectName':this[_0x4ae2('0xb')][_0x4ae2('0x3e')],'saveName':_0x21baf4,'filename':_0x4e30ab[_0x4ae2('0x3f')]||_0x21baf4,'savePath':_0x2ab00f})[_0x4ae2('0x10')](function(_0x2fe532){_0x6ed809(null,_0x2fe532);})[_0x4ae2('0x11')](function(_0xf6d12a){_0x6ed809(_0xf6d12a);});};AGIVertices['prototype'][_0x4ae2('0x40')]=function(_0x4a70c6,_0x10db30,_0x1c0898,_0x2292ec,_0x11a808){this[_0x4ae2('0xc')][_0x4ae2('0x40')]({'uniqueid':this['channel'][_0x4ae2('0x33')],'body':_0x4a70c6,'direction':_0x10db30,'providerName':_0x1c0898,'providerResponse':_0x2292ec})[_0x4ae2('0x10')](function(_0x57c9f4){if(_0x11a808){_0x11a808(null,_0x57c9f4);}})[_0x4ae2('0x11')](function(_0x3c5f8d){if(_0x11a808){_0x11a808(_0x3c5f8d);}});};AGIVertices['prototype'][_0x4ae2('0x41')]=function(_0x4d6560,_0x426d29){this['rpc'][_0x4ae2('0x41')]({'firstName':_[_0x4ae2('0x42')](_0x4d6560[_0x4ae2('0x15')])||_[_0x4ae2('0x43')](_0x4d6560[_0x4ae2('0x15')])?_0x4ae2('0x44')+Math[_0x4ae2('0x45')]():_0x4d6560[_0x4ae2('0x15')],'lastName':_[_0x4ae2('0x42')](_0x4d6560['lastName'])||_[_0x4ae2('0x43')](_0x4d6560[_0x4ae2('0x46')])?null:_0x4d6560[_0x4ae2('0x46')],'phone':_0x4d6560[_0x4ae2('0x47')],'ListId':_0x4d6560['list_id'],'scheduledat':_0x4d6560[_0x4ae2('0x48')],'callbackUniqueid':this[_0x4ae2('0xb')][_0x4ae2('0x33')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x4d6560[_0x4ae2('0x48')][_0x4ae2('0x49')](),'priority':_0x4d6560[_0x4ae2('0x4a')]})[_0x4ae2('0x10')](function(_0x3cab08){_0x426d29(null,_0x3cab08);})[_0x4ae2('0x11')](function(_0x18a8e6){_0x426d29(_0x18a8e6);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x4b')]=function(_0x53e815,_0x28d5bd){this['rpc'][_0x4ae2('0x4c')](_0x53e815)[_0x4ae2('0x10')](function(_0x28e7a8){_0x28d5bd(null,_0x28e7a8?_0x28e7a8[_0x4ae2('0x15')]:![]);})[_0x4ae2('0x11')](function(_0x3d5b37){_0x28d5bd(_0x3d5b37);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x4d')]=function(_0x479156,_0x496f98,_0x33fb77){var _0x3ed1d5={'role':_0x4ae2('0x4e')};_0x3ed1d5[_0x479156]=this['channel']['callerid'];this[_0x4ae2('0xc')][_0x4ae2('0x4d')](_0x3ed1d5,_0x496f98,this[_0x4ae2('0xb')][_0x4ae2('0x33')])[_0x4ae2('0x10')](function(_0x4edaf3){_0x33fb77(null,_['isNil'](_0x4edaf3)?![]:!![]);})['catch'](function(_0x22501c){logger['error'](_0x22501c);_0x33fb77(null,![]);});};AGIVertices['prototype'][_0x4ae2('0x4f')]=function(_0x4e677f,_0x3efbaf){var _0x57df20={'role':_0x4ae2('0x4e')};_0x57df20[_0x4e677f]=this['channel'][_0x4ae2('0x36')];this['rpc'][_0x4ae2('0x4f')](_0x57df20)[_0x4ae2('0x10')](function(_0x3f46f3){_0x3efbaf(null,_[_0x4ae2('0x43')](_0x3f46f3)?![]:!![]);})[_0x4ae2('0x11')](function(_0x517494){logger['error'](_0x517494);_0x3efbaf(null,![]);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x50')]=function(_0x5103ef,_0x2ce4e0){var _0x29183d={'role':'agent'};_0x29183d[_0x5103ef]=this[_0x4ae2('0xb')][_0x4ae2('0x36')];this['rpc']['agentLogout'](_0x29183d)[_0x4ae2('0x10')](function(_0x42d994){_0x2ce4e0(null,_['isNil'](_0x42d994)?![]:!![]);})[_0x4ae2('0x11')](function(_0x449d5a){logger[_0x4ae2('0x29')](_0x449d5a);_0x2ce4e0(null,![]);});};AGIVertices[_0x4ae2('0xd')]['agentLogin']=function(_0xce7da,_0x2e4742){var _0x4c8b83={'role':_0x4ae2('0x4e')};_0x4c8b83[_0xce7da]=this[_0x4ae2('0xb')][_0x4ae2('0x36')];var _0x525cc5=_0xce7da!='internal'?util[_0x4ae2('0x26')]('%s/%s@from-sip/n',_0x4ae2('0x51'),this['channel'][_0x4ae2('0x36')]):undefined;this['rpc'][_0x4ae2('0x52')](_0x4c8b83,_0x525cc5)['then'](function(_0x17ab2f){_0x2e4742(null,_['isNil'](_0x17ab2f)?![]:!![]);})['catch'](function(_0x41873a){logger[_0x4ae2('0x29')](_0x41873a);_0x2e4742(null,![]);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x53')]=function(_0x44a298,_0x240a7a){sh[_0x4ae2('0x54')](_[_0x4ae2('0x55')](_0x44a298),function(_0x2d2acc,_0x977a24){var _0x38e296=_0x977a24[_0x4ae2('0x56')](/(\r\n|\n|\r)/gm,'');_0x240a7a(null,_0x38e296);});};AGIVertices['prototype'][_0x4ae2('0x57')]=function(_0x25a3d8,_0x2542b1){scripts[_0x4ae2('0x57')](_0x25a3d8['apiKey'],_0x25a3d8[_0x4ae2('0x58')]||'text',_0x25a3d8[_0x4ae2('0x59')],_0x25a3d8[_0x4ae2('0x5a')]||_0x4ae2('0x5b'),_0x25a3d8[_0x4ae2('0x5c')]||_0x4ae2('0x5d'),_0x25a3d8[_0x4ae2('0x5e')]||'MP3')[_0x4ae2('0x10')](function(_0x32194d){_0x2542b1(null,_0x32194d);})[_0x4ae2('0x11')](function(_0x59d612){_0x2542b1(_0x59d612);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x5f')]=function(_0x4082d4,_0x55c151){scripts[_0x4ae2('0x5f')](_0x4082d4[_0x4ae2('0x59')],_0x4082d4[_0x4ae2('0x60')]||'en',0x1)['then'](function(_0x2bb165){_0x55c151(null,_0x2bb165);})[_0x4ae2('0x11')](function(_0x662054){_0x55c151(_0x662054);});};AGIVertices[_0x4ae2('0xd')]['restAPI']=function(_0x390c71,_0x102cb8){var _0x411e0f={'uri':_0x390c71[_0x4ae2('0x61')],'method':_0x390c71[_0x4ae2('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x390c71[_0x4ae2('0x63')])===_0x4ae2('0x64')&&parseInt(_0x390c71['timeout'])>=0x1?parseInt(_0x390c71['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x4ae2('0x65')]([_0x4ae2('0x66'),_0x4ae2('0x67')],_0x411e0f[_0x4ae2('0x62')][_0x4ae2('0x68')]())){try{_0x411e0f[_0x4ae2('0x69')]=_0x390c71['rawBody']?JSON[_0x4ae2('0x6a')](_0x390c71[_0x4ae2('0x9')]):{};}catch(_0x306c21){logger[_0x4ae2('0x29')](_0x4ae2('0x6b'),_0x306c21);}}try{_0x411e0f[_0x4ae2('0x6c')]=_0x390c71['rawHeaders']?JSON[_0x4ae2('0x6a')](_0x390c71[_0x4ae2('0x8')]):{};}catch(_0x2fa2d6){logger[_0x4ae2('0x29')](_0x4ae2('0x6d'),_0x2fa2d6);}if(_0x390c71[_0x4ae2('0x6e')]){try{var _0x5efbe9=require(_0x390c71['computedVariables'])[_0x4ae2('0x6f')](this,_0x411e0f);_0x411e0f[_0x4ae2('0x70')]=Mustache['render'](_0x390c71[_0x4ae2('0x61')],_0x5efbe9,{},['$$','$$']);if(_0x411e0f[_0x4ae2('0x6c')]){_0x411e0f[_0x4ae2('0x6c')]=JSON[_0x4ae2('0x6a')](Mustache[_0x4ae2('0x71')](JSON[_0x4ae2('0x72')](_0x411e0f[_0x4ae2('0x6c')]),_0x5efbe9,{},['$$','$$']));}if(_0x411e0f['body']){_0x411e0f[_0x4ae2('0x69')]=JSON[_0x4ae2('0x6a')](Mustache[_0x4ae2('0x71')](JSON[_0x4ae2('0x72')](_0x411e0f[_0x4ae2('0x69')]),_0x5efbe9,{},['$$','$$']));}}catch(_0x29b0d0){logger['error'](_0x4ae2('0x73'),_0x29b0d0);}}rp(_0x411e0f)[_0x4ae2('0x10')](function(_0x17f398){var _0x58474e={'statusCode':_0x17f398[_0x4ae2('0x74')]||0xc8,'statusMessage':_0x17f398['statusMessage']||'OK','headers':_0x17f398[_0x4ae2('0x6c')]||{},'body':_0x17f398[_0x4ae2('0x69')]||{}};_0x102cb8(null,_0x58474e);})[_0x4ae2('0x11')](function(_0x21fb2a){var _0x2b2577={'statusCode':_0x21fb2a['statusCode']||0x1f4,'statusMessage':_0x21fb2a[_0x4ae2('0x75')]||_0x4ae2('0x76'),'headers':_0x21fb2a[_0x4ae2('0x77')][_0x4ae2('0x6c')]||{},'body':_0x21fb2a['options'][_0x4ae2('0x69')]||{}};_0x102cb8(null,_0x2b2577);});};AGIVertices['prototype'][_0x4ae2('0x78')]=function(_0x356fd8,_0x4b7baf){scripts[_0x4ae2('0x78')](this[_0x4ae2('0xb')][_0x4ae2('0x33')],_0x356fd8[_0x4ae2('0x79')],_0x356fd8[_0x4ae2('0x59')],_0x356fd8[_0x4ae2('0x7a')]||'en')['then'](function(_0x2f97d7){_0x4b7baf(null,_0x2f97d7);})['catch'](function(_0x4a8d2c){_0x4b7baf(_0x4a8d2c);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x7b')]=function(_0x34855a,_0x1dd43c){scripts[_0x4ae2('0x7b')](this['channel']['uniqueid'],_0x34855a[_0x4ae2('0x7c')],_0x34855a[_0x4ae2('0x7d')],_0x34855a[_0x4ae2('0x7e')],_0x34855a[_0x4ae2('0x59')],_0x34855a[_0x4ae2('0x7f')]||'en')[_0x4ae2('0x10')](function(_0xa21d87){_0x1dd43c(null,_0xa21d87);})[_0x4ae2('0x11')](function(_0x5504d6){_0x1dd43c(_0x5504d6);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x80')]=function(_0x1358e9,_0x45cf3f){scripts[_0x4ae2('0x80')](this[_0x4ae2('0xb')],_0x1358e9)[_0x4ae2('0x10')](function(_0x1deb7d){_0x45cf3f(null,_0x1deb7d);})[_0x4ae2('0x11')](function(_0x2d135b){_0x45cf3f(_0x2d135b);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x81')]=function(_0x2f9c83,_0x310f93){scripts[_0x4ae2('0x81')](_0x2f9c83[_0x4ae2('0x79')],_0x2f9c83[_0x4ae2('0x59')],_0x2f9c83['ispeech_tts_language']||_0x4ae2('0x5b'),_0x2f9c83[_0x4ae2('0x82')])[_0x4ae2('0x10')](function(_0x5d096e){_0x310f93(null,_0x5d096e);})['catch'](function(_0x381538){_0x310f93(_0x381538);});};AGIVertices[_0x4ae2('0xd')]['ispeechASR']=function(_0xf6f39c,_0x21c4ec,_0x5aa3f4){scripts[_0x4ae2('0x83')](_0x21c4ec,_0xf6f39c['key'],_0xf6f39c['ispeech_asr_language']||'en-US',this[_0x4ae2('0x84')](_0xf6f39c['model'])?_0xf6f39c[_0x4ae2('0x85')]:undefined)[_0x4ae2('0x10')](function(_0x616c8f){_0x5aa3f4(null,_0x616c8f);})[_0x4ae2('0x11')](function(_0x77ebb6){_0x5aa3f4(_0x77ebb6);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x86')]=function(_0x26b5b6,_0x386c80){scripts['awsPolly'](_0x26b5b6[_0x4ae2('0x87')],_0x26b5b6[_0x4ae2('0x88')],_0x26b5b6[_0x4ae2('0x89')],_0x26b5b6[_0x4ae2('0x8a')]||'Amy',_0x26b5b6[_0x4ae2('0x59')],_0x26b5b6[_0x4ae2('0x8b')]||_0x4ae2('0x59'))['then'](function(_0x345792){_0x386c80(null,_0x345792);})[_0x4ae2('0x11')](function(_0x267ef5){_0x386c80(_0x267ef5);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x8c')]=function(_0x1a6d81,_0x1d8c55){scripts['awsLex'](this[_0x4ae2('0xb')][_0x4ae2('0x33')],_0x1a6d81[_0x4ae2('0x87')],_0x1a6d81[_0x4ae2('0x88')],_0x1a6d81[_0x4ae2('0x8d')],_0x1a6d81['text'],_0x1a6d81[_0x4ae2('0x8e')])[_0x4ae2('0x10')](function(_0x1ed168){_0x1d8c55(null,_0x1ed168);})['catch'](function(_0x3fc31b){_0x1d8c55(_0x3fc31b);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x8f')]=function(_0x40b840,_0x52521f,_0x3923e){scripts[_0x4ae2('0x8f')](_0x52521f,_0x40b840['key'],_0x40b840[_0x4ae2('0x90')]||_0x4ae2('0x5b'))['then'](function(_0x543524){_0x3923e(null,_0x543524);})[_0x4ae2('0x11')](function(_0x49d34e){_0x3923e(_0x49d34e);});};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x91')]=function(_0x3dae41,_0x30c767,_0xa0be2c){scripts[_0x4ae2('0x91')](_0x30c767,_0x3dae41[_0x4ae2('0x92')],_0x3dae41['appsecret'],_0x3dae41['uri'])['then'](function(_0x114223){_0xa0be2c(null,_0x114223);})[_0x4ae2('0x11')](function(_0x5e74ef){_0xa0be2c(_0x5e74ef);});};AGIVertices['prototype'][_0x4ae2('0x93')]=function(_0x17e184){var _0x38b41b=_[_0x4ae2('0x65')](verticesWithRetry,_0x17e184[_0x4ae2('0x35')])?_0x17e184:_[_0x4ae2('0x94')](_0x17e184);for(var _0x5662e3 in _0x38b41b){if(_0x38b41b[_0x4ae2('0x95')](_0x5662e3)){if(_0x38b41b[_0x5662e3]&&_[_0x4ae2('0x96')](_0x38b41b[_0x5662e3])){if(_['includes'](recursiveMapAttributes,_0x5662e3)){_0x38b41b[_0x5662e3]=this[_0x4ae2('0x97')](_0x38b41b[_0x5662e3]);}else{_0x38b41b[_0x5662e3]=this['replaceAllVariables'](_0x38b41b[_0x5662e3]);}}}}return _0x38b41b;};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x98')]=function(_0x300c2b){for(var _0x5590f5 in _0x300c2b){if(_0x300c2b[_0x4ae2('0x95')](_0x5590f5)){if(_[_0x4ae2('0x99')](_0x300c2b[_0x5590f5])){this[_0x4ae2('0x98')](_0x300c2b[_0x5590f5]);}else if(_[_0x4ae2('0x9a')](_0x300c2b[_0x5590f5])){for(var _0x44f785=0x0;_0x44f785<_0x300c2b[_0x5590f5]['length'];_0x44f785++){this[_0x4ae2('0x98')](_0x300c2b[_0x5590f5][_0x44f785]);}}else if(_[_0x4ae2('0x96')](_0x300c2b[_0x5590f5])){_0x300c2b[_0x5590f5]=this[_0x4ae2('0x9b')](_0x300c2b[_0x5590f5]);}}}};AGIVertices[_0x4ae2('0xd')]['saveRestApiResult']=function(_0x256ff6,_0x2a9530){for(var _0x33c27d in _0x256ff6){if(_0x256ff6[_0x4ae2('0x95')](_0x33c27d)){if(_['isPlainObject'](_0x256ff6[_0x33c27d])){if(!_[_0x4ae2('0x42')](_0x256ff6[_0x33c27d])){this['saveRestApiResult'](_0x256ff6[_0x33c27d],util[_0x4ae2('0x26')](_0x4ae2('0x9c'),_0x2a9530,_0x33c27d));}}else if(_[_0x4ae2('0x9a')](_0x256ff6[_0x33c27d])){for(var _0xfe8aa8=0x0;_0xfe8aa8<_0x256ff6[_0x33c27d]['length'];_0xfe8aa8++){this[_0x4ae2('0x9d')](_0x256ff6[_0x33c27d][_0xfe8aa8],util[_0x4ae2('0x26')](_0x4ae2('0x9c'),_0x2a9530,_0x33c27d+'['+_0xfe8aa8+']'));}}else{if(!_[_0x4ae2('0x43')](_0x256ff6[_0x33c27d])){this['channel']['setVariable'](util['format'](_0x4ae2('0x9c'),_0x2a9530,_0x33c27d),_0x256ff6[_0x33c27d]);}}}}};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x97')]=function(_0x1c9088){try{var _0x20ddd7=JSON['parse'](_0x1c9088);this[_0x4ae2('0x98')](_0x20ddd7);return JSON[_0x4ae2('0x72')](_0x20ddd7);}catch(_0x3b0bef){return this[_0x4ae2('0x9b')](_0x1c9088);}};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x9b')]=function(_0x47e2f4){var _0xb79ba0=_0x47e2f4['split']('{');for(var _0x4d90e9=0x1;_0x4d90e9<_0xb79ba0[_0x4ae2('0x9e')];_0x4d90e9+=0x1){var _0xbe815b=_0xb79ba0[_0x4d90e9][_0x4ae2('0x9f')]('}');if(_0xbe815b[_0x4ae2('0x9e')]>0x1){_0x47e2f4=_0x47e2f4[_0x4ae2('0xa0')]('{'+_0xbe815b[0x0]+'}',this[_0x4ae2('0xb')][_0x4ae2('0xe')](_0xbe815b[0x0])['extra']||_0xbe815b[0x0]);}}if(_0xb79ba0[_0x4ae2('0x9e')]===0x1){return _0x47e2f4[_0x4ae2('0x49')]();}return this[_0x4ae2('0x9b')](_0x47e2f4);};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xa1')]=function(_0x431bc3,_0xc0fa01){var _0x495a82=this[_0x4ae2('0xb')][_0x4ae2('0xe')](_0x431bc3);if(_0x495a82[_0x4ae2('0xa2')]===-0x1){return _0x495a82;}logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0xa3'),_0xc0fa01,_0x495a82['extra']));return this[_0x4ae2('0xb')][_0x4ae2('0xa4')](_0xc0fa01,_0x495a82['extra']);};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x84')]=function(_0x32355b){return _0x32355b&&_0x32355b!=='0'&&_0x32355b!=='-1'&&_0x32355b!=='';};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xa5')]=function(_0x2547ee){this[_0x4ae2('0x32')]['sync'](this,_0x2547ee,'-');_0x2547ee[_0x4ae2('0xa6')]=_0x2547ee[_0x4ae2('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xa7')]=function(_0x49bc8c){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0xa8'),_0x49bc8c[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x49bc8c[_0x4ae2('0x59')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xaa'));}var _0x523624='\x22'+_0x49bc8c[_0x4ae2('0x59')]+'\x22';if(this[_0x4ae2('0x84')](_0x49bc8c[_0x4ae2('0x77')])){_0x523624+=','+_0x49bc8c[_0x4ae2('0x77')];}var _0x4938b6=this['channel']['exec'](_0x4ae2('0xab'),_0x523624);if(_0x4938b6[_0x4ae2('0xa2')]===-0x1){return _0x4938b6;}return this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0xac'),_0x523624));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xad')]=function(_0x31e955){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xae'),_0x31e955[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x31e955['grammar'])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xaf'));}var _0x585471=_0x31e955[_0x4ae2('0xb0')];if(this[_0x4ae2('0x84')](_0x31e955[_0x4ae2('0x77')])){_0x585471+=','+_0x31e955['options'];}var _0x546573=this[_0x4ae2('0xb')]['exec'](_0x4ae2('0xb1'),_0x585471);if(_0x546573[_0x4ae2('0xa2')]===-0x1){return _0x546573;}var _0x120cbd=this[_0x4ae2('0xa1')]('RECOG_CONFIDENCE()',_0x4ae2('0xb2'));if(_0x120cbd[_0x4ae2('0xa2')]===-0x1){return _0x120cbd;}var _0x11396b=this[_0x4ae2('0xa1')](_0x4ae2('0xb3'),_0x4ae2('0xb4'));if(_0x11396b['result']===-0x1){return _0x11396b;}var _0x5a177d=this['getAndSetVariable'](_0x4ae2('0xb5'),_0x4ae2('0xb6'));if(_0x5a177d[_0x4ae2('0xa2')]===-0x1){return _0x5a177d;}return this[_0x4ae2('0xb')]['noop'](util[_0x4ae2('0x26')](_0x4ae2('0xb7'),_0x585471));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xb8')]=function(_0x2cd6da){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xb9'),_0x2cd6da[_0x4ae2('0x34')]));return this['channel'][_0x4ae2('0xb8')]([_0x2cd6da[_0x4ae2('0xba')],_0x2cd6da['args']]);};AGIVertices['prototype'][_0x4ae2('0xbb')]=function(_0x451a76){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xbc'),_0x451a76[_0x4ae2('0x34')]));if(this['isConfigured'](_0x451a76['timeout'])){logger[_0x4ae2('0x2b')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x451a76[_0x4ae2('0x63')]));var _0x2329c6=this['channel'][_0x4ae2('0xbd')](_0x451a76['timeout']);if(_0x2329c6['result']===-0x1){return _0x2329c6;}}return this[_0x4ae2('0xb')][_0x4ae2('0xbb')]();};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xbe')]=function(_0x154b1c){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0xbf'),_0x154b1c['label']));if(!this[_0x4ae2('0x84')](_0x154b1c[_0x4ae2('0xc0')])){return this['channel'][_0x4ae2('0x29')](_0x154b1c,_0x4ae2('0xc1'));}_0x154b1c['scheduledAt']=moment();if(this['isConfigured'](_0x154b1c[_0x4ae2('0xc2')])){_0x154b1c[_0x4ae2('0x48')]=moment()['add'](_0x154b1c['delay'],'minutes');}if(!this[_0x4ae2('0x84')](_0x154b1c['callback_priority'])){_0x154b1c[_0x4ae2('0x4a')]=0x2;}this[_0x4ae2('0x41')][_0x4ae2('0x6f')](this,_0x154b1c);return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0xc3'),_0x154b1c[_0x4ae2('0x47')],_0x154b1c['list_id'],_0x154b1c[_0x4ae2('0x48')]));};AGIVertices['prototype'][_0x4ae2('0xc4')]=function(_0x1afc50){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xc5'),_0x1afc50['label']));var _0x31ddd4=this[_0x4ae2('0xb')][_0x4ae2('0x54')](_0x1afc50[_0x4ae2('0xc6')],_0x1afc50[_0x4ae2('0x77')]);if(_0x31ddd4[_0x4ae2('0xa2')]===-0x1){return _0x31ddd4;}return this[_0x4ae2('0xb')]['noop'](util[_0x4ae2('0x26')](_0x4ae2('0xc7'),_0x1afc50[_0x4ae2('0xc6')],_0x1afc50[_0x4ae2('0x77')]));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xc8')]=function(_0xb86bf){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0xb86bf['label']));if(!this[_0x4ae2('0x84')](_0xb86bf['text'])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xaa'));}var _0x39091a='\x22'+_0xb86bf[_0x4ae2('0x59')]+'\x22';if(this[_0x4ae2('0x84')](_0xb86bf['options'])){_0x39091a+=','+_0xb86bf[_0x4ae2('0x77')];}var _0x4be965=this[_0x4ae2('0xb')][_0x4ae2('0x54')]('MRCPSynth',_0x39091a);if(_0x4be965['result']===-0x1){return _0x4be965;}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')]('Executed\x20command\x20MRCPSynth\x20%s',_0x39091a));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xc9')]=function(_0x46cde2){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xca'),_0x46cde2[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x46cde2[_0x4ae2('0x59')])){return this[_0x4ae2('0xb')]['noop'](_0x4ae2('0xaa'));}var _0x4d5b69='\x22'+_0x46cde2[_0x4ae2('0x59')]+'\x22';if(this[_0x4ae2('0x84')](_0x46cde2['options'])){_0x4d5b69+=','+_0x46cde2[_0x4ae2('0x77')];}var _0xa5dfdd=this[_0x4ae2('0xb')][_0x4ae2('0x54')](_0x4ae2('0xab'),_0x4d5b69);if(_0xa5dfdd[_0x4ae2('0xa2')]===-0x1){return _0xa5dfdd;}return this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0xac'),_0x4d5b69));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xcb')]=function(_0x1fa114){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xcc'),_0x1fa114[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x1fa114['grammar'])){return this['channel'][_0x4ae2('0xa9')](_0x4ae2('0xaf'));}var _0x184c1c=_0x1fa114[_0x4ae2('0xb0')];if(this[_0x4ae2('0x84')](_0x1fa114['options'])){_0x184c1c+=','+_0x1fa114[_0x4ae2('0x77')];}var _0x1689eb=this[_0x4ae2('0xb')][_0x4ae2('0x54')](_0x4ae2('0xb1'),_0x184c1c);if(_0x1689eb['result']===-0x1){return _0x1689eb;}var _0x42b50a=this[_0x4ae2('0xa1')](_0x4ae2('0xcd'),'LUMENVOX_ASR_CONFIDENCE');if(_0x42b50a[_0x4ae2('0xa2')]===-0x1){return _0x42b50a;}var _0x15bd95=this['getAndSetVariable']('RECOG_INPUT()',_0x4ae2('0xce'));if(_0x15bd95[_0x4ae2('0xa2')]===-0x1){return _0x15bd95;}var _0x35047a=this['getAndSetVariable']('RECOG_INSTANCE()',_0x4ae2('0xcf'));if(_0x35047a[_0x4ae2('0xa2')]===-0x1){return _0x35047a;}return this[_0x4ae2('0xb')]['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x184c1c));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xd0')]=function(_0xeea824){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xd1'),_0xeea824[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0xeea824[_0x4ae2('0xb0')])){return this['channel'][_0x4ae2('0xa9')](_0x4ae2('0xaf'));}var _0x4fab5e=_0xeea824[_0x4ae2('0xb0')];if(this[_0x4ae2('0x84')](_0xeea824['options'])){_0x4fab5e+=','+_0xeea824[_0x4ae2('0x77')];}var _0x29e5fa=this[_0x4ae2('0xb')][_0x4ae2('0x54')]('MRCPRecog',_0x4fab5e);if(_0x29e5fa[_0x4ae2('0xa2')]===-0x1){return _0x29e5fa;}var _0x1b934c=this['getAndSetVariable'](_0x4ae2('0xcd'),_0x4ae2('0xd2'));if(_0x1b934c[_0x4ae2('0xa2')]===-0x1){return _0x1b934c;}var _0x55a36e=this[_0x4ae2('0xa1')](_0x4ae2('0xb3'),_0x4ae2('0xd3'));if(_0x55a36e[_0x4ae2('0xa2')]===-0x1){return _0x55a36e;}var _0x302dfd=this[_0x4ae2('0xa1')](_0x4ae2('0xb5'),'SESTEK_ASR_INSTANCE');if(_0x302dfd[_0x4ae2('0xa2')]===-0x1){return _0x302dfd;}return this[_0x4ae2('0xb')]['noop'](util[_0x4ae2('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4fab5e));};AGIVertices[_0x4ae2('0xd')]['database']=function(_0x53bc7b){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xd4'),_0x53bc7b[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x53bc7b[_0x4ae2('0xd5')])){return this[_0x4ae2('0xb')]['error'](_0x53bc7b,_0x4ae2('0xd6'));}var _0x9d1169=this[_0x4ae2('0xd7')][_0x4ae2('0x6f')](this,_0x53bc7b[_0x4ae2('0xd5')]);if(!_0x9d1169){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x53bc7b,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x53bc7b[_0x4ae2('0x2c')])){return this[_0x4ae2('0xb')]['error'](_0x53bc7b,_0x4ae2('0xd8'));}var _0x1f4735=_0x53bc7b['query'][_0x4ae2('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')]('query:\x20%s',_0x1f4735));var _0x5008dd=this[_0x4ae2('0xd9')]['sync'](this,_0x9d1169,_0x1f4735);this[_0x4ae2('0x32')]['sync'](this,_0x53bc7b,_0x1f4735);if(!this[_0x4ae2('0x84')](_0x53bc7b[_0x4ae2('0xda')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xdb'));}var _0x2d2217=this['getVariable']['sync'](this,_0x53bc7b[_0x4ae2('0xda')]);if(!_0x2d2217){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x53bc7b,_0x4ae2('0xdc'));}var _0x417a4d=this;_0x5008dd[_0x4ae2('0xdd')](function(_0x299add,_0x245e81){Object['keys'](_0x299add)[_0x4ae2('0xdd')](function(_0x119a3c){_0x417a4d[_0x4ae2('0xb')][_0x4ae2('0xa4')](util[_0x4ae2('0x26')](_0x4ae2('0xde'),_0x2d2217,_0x245e81,_0x119a3c),_0x299add[_0x119a3c]);});});this['channel'][_0x4ae2('0xa4')](util['format'](_0x4ae2('0xdf'),_0x2d2217),_0x5008dd['length']);return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0xe0'),_0x2d2217));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xe1')]=function(_0x156da3){logger[_0x4ae2('0xe2')](util[_0x4ae2('0x26')](_0x4ae2('0xe3'),_0x156da3[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x156da3['sip_id'])){return this[_0x4ae2('0xb')]['error'](_0x156da3,_0x4ae2('0xe4'));}var _0x47f805=this[_0x4ae2('0x17')][_0x4ae2('0x6f')](this,_0x156da3[_0x4ae2('0xe5')]);if(!_0x47f805){return this['channel'][_0x4ae2('0x29')](_0x156da3,_0x4ae2('0xe6'));}var _0x588fb4=this[_0x4ae2('0xb')][_0x4ae2('0x54')](_0x4ae2('0xe7'),[util['format'](_0x4ae2('0xe8'),_0x47f805),_0x156da3[_0x4ae2('0x63')],_0x156da3[_0x4ae2('0xe9')],_0x156da3[_0x4ae2('0x61')]]);if(_0x588fb4[_0x4ae2('0xa2')]===-0x1){return _0x588fb4;}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util['format'](_0x4ae2('0xea'),'DIAL'));};AGIVertices['prototype'][_0x4ae2('0xeb')]=function(_0x6cbfc7){logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0xec'),_0x6cbfc7['label']));if(!this['isConfigured'](_0x6cbfc7[_0x4ae2('0x79')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xed'));}if(!this['isConfigured'](_0x6cbfc7[_0x4ae2('0x59')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xaa'));}this['channel'][_0x4ae2('0xee')]=!![];this[_0x4ae2('0x32')](_0x6cbfc7);this['createSquareMessage'](_0x6cbfc7[_0x4ae2('0x59')],'in','','');this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0xef'),_0x6cbfc7['text']));var _0x2078ac=this[_0x4ae2('0x78')]['sync'](this,_0x6cbfc7);if(_0x2078ac){for(var _0x53eca8 in _0x2078ac){if(_0x2078ac[_0x4ae2('0x95')](_0x53eca8)){this['channel'][_0x4ae2('0xa4')](util['format']('DIALOGFLOW_%s',_0x53eca8[_0x4ae2('0x68')]()),_0x2078ac[_0x53eca8]);}}this['createSquareMessage'](_0x2078ac['speech'],_0x4ae2('0xf0'),_0x4ae2('0xeb'),'');return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')]('Dialogflow\x20Result\x20%s',_0x2078ac[_0x4ae2('0xf1')]));}return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x6cbfc7,_0x4ae2('0xf2'));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xf3')]=function(_0x16b1f0){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0xf4'),_0x16b1f0[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x16b1f0[_0x4ae2('0x7c')])){return this['channel'][_0x4ae2('0xa9')](_0x4ae2('0xf5'));}if(!this[_0x4ae2('0x84')](_0x16b1f0[_0x4ae2('0x7d')])){return this[_0x4ae2('0xb')]['noop'](_0x4ae2('0xf6'));}if(!this[_0x4ae2('0x84')](_0x16b1f0[_0x4ae2('0x7e')])){return this[_0x4ae2('0xb')]['noop']('no\x20private_key\x20configured');}if(!this[_0x4ae2('0x84')](_0x16b1f0[_0x4ae2('0x7f')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xf7'));}if(!this[_0x4ae2('0x84')](_0x16b1f0[_0x4ae2('0x59')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')]('no\x20text\x20configured');}this[_0x4ae2('0xb')][_0x4ae2('0xee')]=!![];this[_0x4ae2('0x32')](_0x16b1f0);this[_0x4ae2('0x40')](_0x16b1f0['text'],'in','','');this['channel']['noop'](util[_0x4ae2('0x26')]('Trying\x20DialogflowV2:\x20%s',_0x16b1f0['text']));var _0x52254f=this[_0x4ae2('0x7b')][_0x4ae2('0x6f')](this,_0x16b1f0);if(_0x52254f){for(var _0x41a737 in _0x52254f){if(_0x52254f['hasOwnProperty'](_0x41a737)){if(_0x41a737!==_0x4ae2('0xf8')){this[_0x4ae2('0xb')]['setVariable'](util[_0x4ae2('0x26')](_0x4ae2('0xf9'),_0x41a737[_0x4ae2('0x68')]()),_0x52254f[_0x41a737]);}}}this[_0x4ae2('0x40')](_0x52254f[_0x4ae2('0xf1')],_0x4ae2('0xf0'),_0x4ae2('0xf3'),_0x52254f['providerResponse']);return this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0xfa'),_0x52254f[_0x4ae2('0xf1')]));}return this['channel']['error'](_0x16b1f0,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype']['sesteknda']=function(_0x263345){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0xfb'),_0x263345[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x263345['ndauth_url'])){return this['channel'][_0x4ae2('0xa9')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x4ae2('0x84')](_0x263345['username'])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xfc'));}if(!this[_0x4ae2('0x84')](_0x263345['password'])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')]('no\x20password\x20configured');}if(!this[_0x4ae2('0x84')](_0x263345['ndassistant_url'])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xaa'));}this[_0x4ae2('0xb')][_0x4ae2('0xee')]=!![];this['createSquareDetailsReport'](_0x263345);this[_0x4ae2('0x40')](_0x263345[_0x4ae2('0x59')],'in','','');this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')]('Trying\x20SestekNDA:\x20%s',_0x263345[_0x4ae2('0x59')]));var _0x2f5760=this[_0x4ae2('0x80')]['sync'](this,_0x263345);if(_0x2f5760){for(var _0x470b66 in _0x2f5760){if(_0x2f5760[_0x4ae2('0x95')](_0x470b66)){this[_0x4ae2('0xb')][_0x4ae2('0xa4')](util[_0x4ae2('0x26')](_0x4ae2('0xfd'),_0x470b66['toUpperCase']()),_0x2f5760[_0x470b66]);}}this['createSquareMessage'](_0x2f5760[_0x4ae2('0xf1')],_0x4ae2('0xf0'),_0x4ae2('0xfe'),'');if(_0x2f5760[_0x4ae2('0xff')]){this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x100'),_0x2f5760[_0x4ae2('0xff')]));var _0x2a2bbb=this[_0x4ae2('0xb')]['streamFile'](_0x2f5760['audiofile']);try{fs[_0x4ae2('0x101')](_0x2f5760[_0x4ae2('0xff')]+_0x4ae2('0x102'));}catch(_0x3acfc3){logger[_0x4ae2('0x29')](_0x3acfc3);}return _0x2a2bbb;}else{return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x103'),_0x2f5760[_0x4ae2('0xf1')]));}}return this[_0x4ae2('0xb')]['error'](_0x263345,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x104')]=function(_0x5072b9){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x105'),_0x5072b9[_0x4ae2('0x34')]));return this['channel'][_0x4ae2('0xa9')]('end');};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x106')]=function(_0x4c7a2b){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x4c7a2b['label']));var _0x46b6c0='';if(_0x4c7a2b['trunk_id']){if(!this[_0x4ae2('0x84')](_0x4c7a2b['trunk_id'])){return this['channel'][_0x4ae2('0x29')](_0x4c7a2b,_0x4ae2('0x107'));}else{var _0x14682e=parseInt(_0x4c7a2b[_0x4ae2('0x108')],0xa);if(isNaN(_0x14682e)){_0x46b6c0=_0x4c7a2b[_0x4ae2('0x108')];}else{_0x46b6c0=this['getTrunk'][_0x4ae2('0x6f')](this,_0x4c7a2b['trunk_id']);if(!_0x46b6c0){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x4c7a2b,_0x4ae2('0x109'));}}}}else if(_0x4c7a2b['trunk_name']){_0x46b6c0=_0x4c7a2b[_0x4ae2('0x10a')];}else{return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x4c7a2b,'no\x20trunk\x20selected');}var _0x3501a1=this[_0x4ae2('0xb')][_0x4ae2('0x54')](_0x4ae2('0xe7'),[util[_0x4ae2('0x26')](_0x4ae2('0x10b'),_0x46b6c0,_0x4c7a2b[_0x4ae2('0x47')]),_0x4c7a2b[_0x4ae2('0x63')],_0x4c7a2b[_0x4ae2('0xe9')],_0x4c7a2b[_0x4ae2('0x61')]]);if(_0x3501a1['result']===-0x1){return _0x3501a1;}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util['format'](_0x4ae2('0xea'),_0x4ae2('0xe7')));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x10c')]=function(_0xee20b2){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x10d'),_0xee20b2[_0x4ae2('0x34')]));return this['channel']['noop'](_0x4ae2('0x10c'));};AGIVertices[_0x4ae2('0xd')]['getdigits']=function(_0x439add){logger['info'](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x439add[_0x4ae2('0x34')]));if(_0x439add[_0x4ae2('0xa6')]===0x0){return this[_0x4ae2('0xa5')](_0x439add);}_0x439add[_0x4ae2('0xa6')]-=0x1;if(!this[_0x4ae2('0x84')](_0x439add['file_id'])){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x439add,_0x4ae2('0x10e'));}var _0x29a6de=this['getSound'][_0x4ae2('0x6f')](this,_0x439add[_0x4ae2('0x10f')]);if(!_0x29a6de){return this['channel']['error'](_0x439add,_0x4ae2('0x110'));}if(!this[_0x4ae2('0x84')](_0x439add['variable_id'])){return this['channel'][_0x4ae2('0x29')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2da93d=this[_0x4ae2('0xb')]['getData'](_0x29a6de,_0x439add[_0x4ae2('0x111')],_0x439add[_0x4ae2('0x112')]);var _0xf76740=_0x2da93d['result']?_0x2da93d[_0x4ae2('0xa2')]['toString']():'';logger[_0x4ae2('0x2b')](_0x4ae2('0x113'),JSON[_0x4ae2('0x72')](_0x2da93d));if(_0x2da93d[_0x4ae2('0xa2')]===-0x1){this[_0x4ae2('0x32')]['sync'](this,_0x439add,_0xf76740);return _0x2da93d;}else if(_0x2da93d[_0x4ae2('0x114')]==='timeout'){_0x2da93d[_0x4ae2('0xa2')]=_0xf76740[_0x4ae2('0x9e')]>=parseInt(_0x439add[_0x4ae2('0x115')])?'x':'i';}else{_0x2da93d[_0x4ae2('0xa2')]=_0xf76740['length']>=parseInt(_0x439add[_0x4ae2('0x115')])&&_0xf76740[_0x4ae2('0x9e')]<=parseInt(_0x439add[_0x4ae2('0x112')])?'x':'i';}var _0x550ccc=this[_0x4ae2('0xe')][_0x4ae2('0x6f')](this,_0x439add['variable_id']);if(!_0x550ccc){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x439add,_0x4ae2('0xdc'));}this[_0x4ae2('0xb')]['setVariable'](_0x550ccc,_0xf76740);if(this[_0x4ae2('0x84')](_0x439add[_0x4ae2('0x116')])){var _0x1496f2=parseInt(_0x439add['hiddendigitsnum'],0xa);var _0x5a09ad=rs[_0x4ae2('0x117')]({'charset':'*','length':_0x1496f2});var _0x4836f9=_0xf76740[_0x4ae2('0x9e')];if(_0x4836f9>0x0){if(_0x4836f9>_0x1496f2){this[_0x4ae2('0x32')]['sync'](this,_0x439add,_0x439add[_0x4ae2('0x118')]===_0x4ae2('0x119')?_0x5a09ad+_0xf76740[_0x4ae2('0x11a')](_0x1496f2):_0xf76740[_0x4ae2('0x11a')](0x0,_0x4836f9-_0x1496f2)+_0x5a09ad);}else{this[_0x4ae2('0x32')][_0x4ae2('0x6f')](this,_0x439add,rs[_0x4ae2('0x117')]({'charset':'*','length':_0x4836f9}));}}else{this[_0x4ae2('0x32')][_0x4ae2('0x6f')](this,_0x439add,'');}}else{this[_0x4ae2('0x32')][_0x4ae2('0x6f')](this,_0x439add,_0xf76740);}return _0x2da93d;};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x11b')]=function(_0x570fba){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x11c'),_0x570fba[_0x4ae2('0x34')]));return this[_0x4ae2('0x11d')](_0x570fba);};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x11e')]=function(_0x10137f){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x11f'),_0x10137f[_0x4ae2('0x34')]));this[_0x4ae2('0x32')][_0x4ae2('0x6f')](this,_0x10137f,_0x10137f[_0x4ae2('0x120')]);return this['channel'][_0x4ae2('0xa9')](util['format'](_0x4ae2('0x121'),_0x10137f[_0x4ae2('0x120')]));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x122')]=function(_0x536d02){logger['info'](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x536d02['label']));if(!this[_0x4ae2('0x84')](_0x536d02[_0x4ae2('0x87')])||!this[_0x4ae2('0x84')](_0x536d02[_0x4ae2('0x88')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0x123'));}if(!this['isConfigured'](_0x536d02[_0x4ae2('0x59')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xaa'));}this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util['format'](_0x4ae2('0x124'),_0x536d02[_0x4ae2('0x59')]));var _0xa80adc=this[_0x4ae2('0x86')]['sync'](this,_0x536d02);if(_0xa80adc){this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x125'),_0xa80adc));var _0xa7fd76=this[_0x4ae2('0xb')][_0x4ae2('0x126')](_0xa80adc);try{fs['unlink'](_0xa80adc+_0x4ae2('0x102'));}catch(_0x588c32){logger[_0x4ae2('0x29')](_0x588c32);}return _0xa7fd76;}return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x536d02,_0x4ae2('0x127'));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x128')]=function(_0xda8e3c){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0xda8e3c[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0xda8e3c[_0x4ae2('0x87')])||!this[_0x4ae2('0x84')](_0xda8e3c[_0x4ae2('0x88')])){return this[_0x4ae2('0xb')]['noop'](_0x4ae2('0x123'));}if(!this[_0x4ae2('0x84')](_0xda8e3c[_0x4ae2('0x8e')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0x129'));}if(!this[_0x4ae2('0x84')](_0xda8e3c[_0x4ae2('0x59')])){return this['channel'][_0x4ae2('0xa9')](_0x4ae2('0xaa'));}this[_0x4ae2('0xb')][_0x4ae2('0xee')]=!![];this[_0x4ae2('0x32')](_0xda8e3c);this[_0x4ae2('0x40')](_0xda8e3c[_0x4ae2('0x59')],'in','','');this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x12a'),_0xda8e3c[_0x4ae2('0x59')]));var _0x44dceb=this['awsLex'][_0x4ae2('0x6f')](this,_0xda8e3c);if(_0x44dceb){for(var _0x3b68c9 in _0x44dceb){if(_0x44dceb[_0x4ae2('0x95')](_0x3b68c9)&&_[_0x4ae2('0x96')](_0x44dceb[_0x3b68c9])){this[_0x4ae2('0xb')][_0x4ae2('0xa4')](util[_0x4ae2('0x26')](_0x4ae2('0x12b'),_0x3b68c9['toUpperCase']()),_0x44dceb[_0x3b68c9]);}}if(_[_0x4ae2('0x43')](_0x44dceb['message'])){return this['channel'][_0x4ae2('0xa9')](_0x4ae2('0x12c'));}else{this[_0x4ae2('0x40')](_0x44dceb[_0x4ae2('0x75')],_0x4ae2('0xf0'),'amazonlex','');return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x12d'),_0x44dceb[_0x4ae2('0x75')]));}}return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0xda8e3c,_0x4ae2('0x12e'));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x12f')]=function(_0x382cd4){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x130'),_0x382cd4[_0x4ae2('0x34')],_0x382cd4[_0x4ae2('0x63')]));if(!this['isConfigured'](_0x382cd4['key'])){return this[_0x4ae2('0xb')]['noop'](_0x4ae2('0xed'));}var _0x1e0828=_0x4ae2('0x131');var _0x421645=util[_0x4ae2('0x26')](_0x4ae2('0x132'),FILES_PATH,rs[_0x4ae2('0x117')](0x4));var _0x467e67=util['format']('%s.%s',_0x421645,_0x1e0828);var _0x579a2b=!![];if(_0x382cd4[_0x4ae2('0x133')]===_0x4ae2('0x134')){_0x579a2b=![];}var _0x184123=this[_0x4ae2('0xb')][_0x4ae2('0x135')](_0x421645,_0x1e0828,_0x382cd4[_0x4ae2('0x136')],_0x382cd4[_0x4ae2('0x63')],undefined,_0x579a2b);if(_0x184123[_0x4ae2('0xa2')]!==-0x1){this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')]('google\x20%s\x20file\x20created',_0x467e67));var _0x558c24=this[_0x4ae2('0x8f')]['sync'](this,_0x382cd4,_0x467e67);if(_0x558c24){for(var _0x1302ee in _0x558c24){if(_0x558c24[_0x4ae2('0x95')](_0x1302ee)){this[_0x4ae2('0xb')][_0x4ae2('0xa4')](util[_0x4ae2('0x26')]('GOOGLE_ASR_%s',_0x1302ee[_0x4ae2('0x68')]()),_0x558c24[_0x1302ee]);}}return this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x137'),JSON['stringify'](_0x558c24)));}}return _0x184123;};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x138')]=function(_0x49d320){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x139'),_0x49d320[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x49d320[_0x4ae2('0x92')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0x13a'));}if(!this[_0x4ae2('0x84')](_0x49d320['appsecret'])){return this['channel'][_0x4ae2('0xa9')](_0x4ae2('0x13b'));}var _0x4a9920=_0x4ae2('0x131');var _0x1faa75=util[_0x4ae2('0x26')]('%s/recordings/%s',FILES_PATH,rs[_0x4ae2('0x117')](0x4));var _0x47a654=util['format'](_0x4ae2('0x9c'),_0x1faa75,_0x4a9920);var _0x4f839c=!![];if(_0x49d320[_0x4ae2('0x133')]===_0x4ae2('0x134')){_0x4f839c=![];}var _0x1d30e1=this['channel'][_0x4ae2('0x135')](_0x1faa75,_0x4a9920,_0x49d320[_0x4ae2('0x136')],_0x49d320['timeout'],undefined,_0x4f839c);if(_0x1d30e1['result']!==-0x1){this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util['format'](_0x4ae2('0x13c'),_0x47a654));var _0x1474ed=this[_0x4ae2('0x91')][_0x4ae2('0x6f')](this,_0x49d320,_0x47a654);if(_0x1474ed){for(var _0x5308f0 in _0x1474ed){if(_0x1474ed['hasOwnProperty'](_0x5308f0)){this[_0x4ae2('0xb')][_0x4ae2('0xa4')](util[_0x4ae2('0x26')](_0x4ae2('0x13d'),_0x5308f0[_0x4ae2('0x68')]()),_0x1474ed[_0x5308f0]);}}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x13e'),JSON[_0x4ae2('0x72')](_0x1474ed)));}}return _0x1d30e1;};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x13f')]=function(_0x4263db){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4263db['label']));return this['channel'][_0x4ae2('0x140')](_0x4263db[_0x4ae2('0x39')],_0x4263db[_0x4ae2('0x3a')],_0x4263db['priority']);};AGIVertices[_0x4ae2('0xd')]['gotoif']=function(_0x13f45d){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x141'),_0x13f45d['label']));if(!this[_0x4ae2('0x84')](_0x13f45d[_0x4ae2('0x142')])){return this[_0x4ae2('0xb')]['error'](_0x13f45d,_0x4ae2('0x143'));}try{var _0x5664b2=eval(_0x13f45d[_0x4ae2('0x142')])?'true':_0x4ae2('0x144');this['channel']['noop'](util[_0x4ae2('0x26')](_0x4ae2('0x145'),_0x13f45d[_0x4ae2('0x142')],_0x5664b2));return{'code':0xc8,'result':_0x5664b2};}catch(_0x8bc4b2){return{'code':0xc8,'result':_0x4ae2('0x144')};}};AGIVertices[_0x4ae2('0xd')]['gotoiftime']=function(_0x18cd8f){logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0x146'),_0x18cd8f[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x18cd8f[_0x4ae2('0x147')])){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x18cd8f,'no\x20interval\x20configured');}var _0x2e89bd=this['getIntervals'][_0x4ae2('0x6f')](this,_0x18cd8f[_0x4ae2('0x147')]);if(!_0x2e89bd){return this['channel'][_0x4ae2('0x29')](_0x18cd8f,_0x4ae2('0x148'));}for(var _0x4787db=0x0;_0x4787db<_0x2e89bd[_0x4ae2('0x9e')];_0x4787db+=0x1){var _0x261a34=this['channel']['getVariable'](util['format'](_0x4ae2('0x149'),_0x2e89bd[_0x4787db]));if(_0x261a34[_0x4ae2('0xa2')]===-0x1){return _0x261a34;}logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x14a'),_0x2e89bd[_0x4787db],_0x261a34['extra']));if(_0x261a34[_0x4ae2('0x114')]==='true'){logger['info'](util[_0x4ae2('0x26')]('IFTIME\x20%s\x20%s',_0x2e89bd[_0x4787db],_0x4ae2('0x14b')));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x14a'),_0x2e89bd[_0x4787db],_0x4ae2('0x14b')));return{'code':0xc8,'result':_0x4ae2('0x14b')};}else{logger['info'](util['format'](_0x4ae2('0x14a'),_0x2e89bd[_0x4787db],_0x4ae2('0x144')));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x14a'),_0x2e89bd[_0x4787db],'false'));}}return{'code':0xc8,'result':_0x4ae2('0x144')};};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x14c')]=function(_0x2d0a8a){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x2d0a8a['label']));return this[_0x4ae2('0xb')][_0x4ae2('0x14c')]();};AGIVertices[_0x4ae2('0xd')]['ispeechasr']=function(_0x46fef6){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0x14d'),_0x46fef6[_0x4ae2('0x34')]));if(!this['isConfigured'](_0x46fef6['key'])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0xed'));}var _0x36dbed=_0x4ae2('0x131');var _0x3754fa=util[_0x4ae2('0x26')](_0x4ae2('0x132'),FILES_PATH,rs[_0x4ae2('0x117')](0x4));var _0x2bf7c2=util[_0x4ae2('0x26')](_0x4ae2('0x9c'),_0x3754fa,_0x36dbed);var _0x276a51=!![];if(_0x46fef6[_0x4ae2('0x133')]===_0x4ae2('0x134')){_0x276a51=![];}var _0x135819=this[_0x4ae2('0xb')]['recordFile'](_0x3754fa,_0x36dbed,_0x46fef6[_0x4ae2('0x136')],_0x46fef6[_0x4ae2('0x63')],undefined,_0x276a51);if(_0x135819['result']!==-0x1){this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x14e'),_0x2bf7c2));var _0x472755=this[_0x4ae2('0x83')]['sync'](this,_0x46fef6,_0x2bf7c2);if(_0x472755){for(var _0x5bc63d in _0x472755){if(_0x472755['hasOwnProperty'](_0x5bc63d)){this[_0x4ae2('0xb')]['setVariable'](util[_0x4ae2('0x26')]('ISPEECH_ASR_%s',_0x5bc63d[_0x4ae2('0x68')]()),_0x472755[_0x5bc63d]);}}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x14f'),JSON['stringify'](_0x472755)));}}return _0x135819;};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x150')]=function(_0x53a2eb){logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0x151'),_0x53a2eb[_0x4ae2('0x34')]));if(!this['isConfigured'](_0x53a2eb['key'])){return this[_0x4ae2('0xb')]['noop'](_0x4ae2('0xed'));}if(!this['isConfigured'](_0x53a2eb[_0x4ae2('0x59')])){return this['channel'][_0x4ae2('0xa9')](_0x4ae2('0xaa'));}this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x152'),_0x53a2eb[_0x4ae2('0x59')]));var _0x5e7e96=this[_0x4ae2('0x81')][_0x4ae2('0x6f')](this,_0x53a2eb);if(_0x5e7e96){this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x14e'),_0x5e7e96));var _0x58de7a=this['channel'][_0x4ae2('0x126')](_0x5e7e96,_0x53a2eb[_0x4ae2('0x136')]);try{fs[_0x4ae2('0x101')](_0x5e7e96+_0x4ae2('0x102'));}catch(_0x35057a){logger[_0x4ae2('0x29')](_0x35057a);}return _0x58de7a;}return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x53a2eb,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x4ae2('0x153')]=function(_0x4d852c){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0x154'),_0x4d852c[_0x4ae2('0x34')]));if(!this['isConfigured'](_0x4d852c[_0x4ae2('0x155')])){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x4d852c,'no\x20find\x20by\x20configured');}logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0x156'),this['channel'][_0x4ae2('0x36')],_0x4d852c['findBy']));var _0x529d38=this[_0x4ae2('0x52')]['sync'](this,_0x4d852c[_0x4ae2('0x155')]);if(_0x529d38){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0x157'),this[_0x4ae2('0xb')]['callerid'],_0x4d852c['findBy']));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x157'),this['channel'][_0x4ae2('0x36')],_0x4d852c[_0x4ae2('0x155')]));return{'code':0xc8,'result':_0x4ae2('0x158')};}else{logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x159'),this['channel'][_0x4ae2('0x36')],_0x4d852c['findBy']));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x159'),this['channel']['callerid'],_0x4d852c[_0x4ae2('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x4ae2('0x15a')]=function(_0x20473e){logger['info'](util[_0x4ae2('0x26')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x20473e[_0x4ae2('0x34')]));if(!this['isConfigured'](_0x20473e[_0x4ae2('0x155')])){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x20473e,_0x4ae2('0x15b'));}logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x156'),this['channel'][_0x4ae2('0x36')],_0x20473e[_0x4ae2('0x155')]));var _0x317c1b=this[_0x4ae2('0x50')][_0x4ae2('0x6f')](this,_0x20473e[_0x4ae2('0x155')]);if(_0x317c1b){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x4ae2('0xb')][_0x4ae2('0x36')],_0x20473e['findBy']));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x157'),this[_0x4ae2('0xb')][_0x4ae2('0x36')],_0x20473e[_0x4ae2('0x155')]));return{'code':0xc8,'result':_0x4ae2('0x158')};}else{logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x159'),this[_0x4ae2('0xb')][_0x4ae2('0x36')],_0x20473e[_0x4ae2('0x155')]));this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x159'),this[_0x4ae2('0xb')][_0x4ae2('0x36')],_0x20473e['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['math']=function(_0x19e861){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x19e861[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x19e861[_0x4ae2('0x15c')])){return this['channel'][_0x4ae2('0x29')](_0x19e861,_0x4ae2('0x15d'));}this['channel'][_0x4ae2('0xa9')](util['format'](_0x4ae2('0x15e'),_0x19e861['operation']));var _0x2b185a=eval(_0x19e861[_0x4ae2('0x15c')]);if(!this[_0x4ae2('0x84')](_0x19e861[_0x4ae2('0xda')])){return this['channel'][_0x4ae2('0xa9')](_0x4ae2('0xdb'));}var _0x38a200=this[_0x4ae2('0xe')][_0x4ae2('0x6f')](this,_0x19e861[_0x4ae2('0xda')]);if(!_0x38a200){return this[_0x4ae2('0xb')]['error'](_0x19e861,_0x4ae2('0xdc'));}if(_['isArray'](_0x2b185a)){var _0x125036=this;_0x2b185a[_0x4ae2('0xdd')](function(_0x43eaee,_0x1ff72b){_0x125036[_0x4ae2('0xb')][_0x4ae2('0xa4')](util[_0x4ae2('0x26')](_0x4ae2('0x15f'),_0x38a200,_0x1ff72b),_0x43eaee);});return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')]('variable\x20%s[key]\x20set',_0x38a200));}else{return this[_0x4ae2('0xb')][_0x4ae2('0xa4')](_0x38a200,_0x2b185a);}};AGIVertices[_0x4ae2('0xd')]['menu']=function(_0x4944c0){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x160'),_0x4944c0['label']));if(_0x4944c0[_0x4ae2('0xa6')]===0x0){return this[_0x4ae2('0xa5')](_0x4944c0);}_0x4944c0[_0x4ae2('0xa6')]-=0x1;if(!this[_0x4ae2('0x84')](_0x4944c0[_0x4ae2('0x10f')])){return this[_0x4ae2('0xb')]['error'](_0x4944c0,_0x4ae2('0x10e'));}var _0x1b61e=this[_0x4ae2('0x161')][_0x4ae2('0x6f')](this,_0x4944c0[_0x4ae2('0x10f')]);if(!_0x1b61e){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x4944c0,'no\x20file\x20audio\x20found');}var _0x33245a=this[_0x4ae2('0xb')][_0x4ae2('0x162')](_0x1b61e,_0x4944c0[_0x4ae2('0x111')],_0x4944c0[_0x4ae2('0x163')]);var _0x1376d9=_0x33245a['result'];if(_0x33245a[_0x4ae2('0xa2')]===-0x1){this[_0x4ae2('0x32')][_0x4ae2('0x6f')](this,_0x4944c0,'-1');return _0x33245a;}else if(_0x33245a['extra']==='timeout'){_0x33245a['result']=_0x33245a['result']['length']>0x0?_0x33245a[_0x4ae2('0xa2')]:'t';}else if(_[_0x4ae2('0x42')](_0x33245a[_0x4ae2('0xa2')])){_0x33245a[_0x4ae2('0xa2')]='#';_0x1376d9='#';}if(!this[_0x4ae2('0x84')](_0x4944c0[_0x4ae2('0xda')])){this[_0x4ae2('0xb')][_0x4ae2('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x52d413=this[_0x4ae2('0xe')][_0x4ae2('0x6f')](this,_0x4944c0[_0x4ae2('0xda')]);if(!_0x52d413){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x4944c0,_0x4ae2('0xdc'));}this[_0x4ae2('0xb')][_0x4ae2('0xa4')](_0x52d413,_0x1376d9);}this['createSquareDetailsReport'][_0x4ae2('0x6f')](this,_0x4944c0,_0x1376d9);return _0x33245a;};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0xa9')]=function(_0x259dfb){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x259dfb[_0x4ae2('0x34')]));return this[_0x4ae2('0xb')]['noop'](_0x259dfb[_0x4ae2('0x164')]||_0x259dfb[_0x4ae2('0x34')]);};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x165')]=function(_0x322deb){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0x166'),_0x322deb[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x322deb[_0x4ae2('0x155')])){return this[_0x4ae2('0xb')]['error'](_0x322deb,_0x4ae2('0x15b'));}logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0x156'),this['channel'][_0x4ae2('0x36')],_0x322deb['findBy']));var _0x5442a1=this[_0x4ae2('0x4b')][_0x4ae2('0x6f')](this,_0x322deb[_0x4ae2('0x167')]);var _0x13fdd9=this[_0x4ae2('0x4d')][_0x4ae2('0x6f')](this,_0x322deb[_0x4ae2('0x155')],_0x5442a1);if(_0x13fdd9){logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0x157'),this[_0x4ae2('0xb')]['callerid'],_0x322deb[_0x4ae2('0x155')]));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util['format'](_0x4ae2('0x157'),this['channel'][_0x4ae2('0x36')],_0x322deb[_0x4ae2('0x155')]));return{'code':0xc8,'result':_0x4ae2('0x158')};}else{logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x159'),this[_0x4ae2('0xb')][_0x4ae2('0x36')],_0x322deb[_0x4ae2('0x155')]));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x157'),this[_0x4ae2('0xb')][_0x4ae2('0x36')],_0x322deb[_0x4ae2('0x155')]));return{'code':0xc8,'result':_0x4ae2('0x168')};}};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x169')]=function(_0x561dfc){logger[_0x4ae2('0x2b')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x561dfc['label']));if(!this[_0x4ae2('0x84')](_0x561dfc[_0x4ae2('0x10f')])){return this[_0x4ae2('0xb')]['error'](_0x561dfc,_0x4ae2('0x10e'));}var _0x9c6b89=this[_0x4ae2('0x161')][_0x4ae2('0x6f')](this,_0x561dfc[_0x4ae2('0x10f')]);if(!_0x9c6b89){return this[_0x4ae2('0xb')]['error'](_0x561dfc,'no\x20file\x20audio\x20found');}var _0x248fcd=this[_0x4ae2('0xb')][_0x4ae2('0x54')](_0x4ae2('0x16a'),[_0x9c6b89,_0x561dfc[_0x4ae2('0xe9')]]);if(_0x248fcd[_0x4ae2('0xa2')]===-0x1){return _0x248fcd;}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util['format'](_0x4ae2('0xc7'),_0x4ae2('0x16a'),_0x9c6b89));};AGIVertices['prototype'][_0x4ae2('0x16b')]=function(_0x4803b9){logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0x16c'),_0x4803b9[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x4803b9['queue_id'])){return this['channel'][_0x4ae2('0x29')](_0x4803b9,_0x4ae2('0x16d'));}var _0x3cc8d6='';var _0x508895=parseInt(_0x4803b9['queue_id'],0xa);if(isNaN(_0x508895)){_0x3cc8d6=_0x4803b9['queue_id'];}else{_0x3cc8d6=this[_0x4ae2('0x12')]['sync'](this,_0x4803b9['queue_id']);if(!_0x3cc8d6){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x4803b9,_0x4ae2('0x16e'));}}var _0x5a6572='';if(this[_0x4ae2('0x84')](_0x4803b9[_0x4ae2('0x10f')])){var _0x311058=this[_0x4ae2('0x161')]['sync'](this,_0x4803b9[_0x4ae2('0x10f')]);if(_0x311058){_0x5a6572=_0x311058;}}this[_0x4ae2('0x32')][_0x4ae2('0x6f')](this,_0x4803b9,_0x3cc8d6);if(_0x4803b9['opts']['indexOf']('x')<0x0){_0x4803b9[_0x4ae2('0xe9')]+='x';}if(_0x4803b9[_0x4ae2('0xe9')]['indexOf']('X')<0x0){_0x4803b9[_0x4ae2('0xe9')]+='X';}this[_0x4ae2('0xb')]['setVariable'](_0x4ae2('0x16f'),_0x3cc8d6?_0x3cc8d6[_0x4ae2('0x170')]():'');var _0x1dc8bf=this[_0x4ae2('0xb')][_0x4ae2('0x54')](_0x4ae2('0x171'),[_0x3cc8d6,_0x4803b9[_0x4ae2('0xe9')],_0x4803b9[_0x4ae2('0x61')],_0x5a6572,_0x4803b9[_0x4ae2('0x63')],_0x4803b9[_0x4ae2('0xb8')],_0x4803b9['macro'],_0x4803b9[_0x4ae2('0x172')],'',_0x4803b9[_0x4ae2('0x173')]]);if(_0x1dc8bf['result']===-0x1){return _0x1dc8bf;}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util['format'](_0x4ae2('0xc7'),_0x4ae2('0x171'),_0x3cc8d6));};AGIVertices['prototype'][_0x4ae2('0x174')]=function(_0x80bf5e){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x175'),_0x80bf5e[_0x4ae2('0x34')]));var _0x58d2a9=_0x80bf5e['recordingFormat']||_0x4ae2('0x131');var _0x54198e=util[_0x4ae2('0x26')]('%s_%s',this[_0x4ae2('0xb')][_0x4ae2('0x33')],rs[_0x4ae2('0x117')](0x5));var _0x1e4861=util[_0x4ae2('0x26')](_0x4ae2('0x176'),FILES_PATH,_0x54198e,_0x58d2a9);var _0x104d26=util['format'](_0x4ae2('0x132'),FILES_PATH,_0x54198e);this['createSquareRecording'][_0x4ae2('0x6f')](this,_0x80bf5e,_0x54198e,_0x1e4861);this[_0x4ae2('0xb')][_0x4ae2('0xa4')](_0x4ae2('0x177'),_0x54198e);logger[_0x4ae2('0x2b')](_0x4ae2('0x178'),_0x104d26,_0x58d2a9,_0x80bf5e[_0x4ae2('0x179')],_0x80bf5e[_0x4ae2('0x63')]);return this[_0x4ae2('0xb')][_0x4ae2('0x135')](_0x104d26,_0x58d2a9,_0x80bf5e[_0x4ae2('0x179')],_0x80bf5e[_0x4ae2('0x63')],undefined,!![]);};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x17a')]=function(_0x21f044){logger['info'](util['format'](_0x4ae2('0x17b'),_0x21f044['label']));if(!this[_0x4ae2('0x84')](_0x21f044['url'])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0x17c'));}var _0x1094e8=this[_0x4ae2('0x17d')]['sync'](this,_0x21f044);logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')]('Response:',util['inspect'](_0x1094e8,{'showHidden':![],'depth':null})));if(!this[_0x4ae2('0x84')](_0x21f044[_0x4ae2('0xda')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0x17e'));}var _0x38b1f5=this['getVariable'][_0x4ae2('0x6f')](this,_0x21f044[_0x4ae2('0xda')]);if(!_0x38b1f5){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x21f044,_0x4ae2('0xdc'));}this[_0x4ae2('0xb')][_0x4ae2('0xa4')](util[_0x4ae2('0x26')](_0x4ae2('0x17f'),_0x38b1f5),_0x1094e8[_0x4ae2('0x74')]?_0x1094e8[_0x4ae2('0x74')]:_0x4ae2('0x180'));this[_0x4ae2('0xb')][_0x4ae2('0xa4')](util[_0x4ae2('0x26')](_0x4ae2('0x181'),_0x38b1f5),_0x1094e8[_0x4ae2('0x182')]?_0x1094e8['statusMessage']:'OK');if(_0x1094e8[_0x4ae2('0x69')]){try{this['saveRestApiResult'](_0x1094e8[_0x4ae2('0x69')],_0x38b1f5);}catch(_0x5a0f10){logger[_0x4ae2('0x29')](util[_0x4ae2('0x26')](_0x4ae2('0x183'),_0x38b1f5));}}return this[_0x4ae2('0xb')]['noop'](util[_0x4ae2('0x26')]('variable\x20%s\x20set',_0x38b1f5));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x184')]=function(_0x4458fc){logger['info'](util['format'](_0x4ae2('0x185'),_0x4458fc['label']));return this[_0x4ae2('0xb')][_0x4ae2('0x186')](_0x4458fc[_0x4ae2('0x187')][_0x4ae2('0x56')](/\s+/g,''),_0x4458fc['escape_digits']);};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x188')]=function(_0x435836){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x189'),_0x435836[_0x4ae2('0x34')]));return this[_0x4ae2('0xb')][_0x4ae2('0x18a')](_0x435836[_0x4ae2('0x64')][_0x4ae2('0x56')](/\s+/g,''),_0x435836[_0x4ae2('0x179')]);};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x18b')]=function(_0x388f7b){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x18c'),_0x388f7b[_0x4ae2('0x34')]));return this[_0x4ae2('0xb')][_0x4ae2('0x18d')](_0x388f7b['text'],_0x388f7b[_0x4ae2('0x179')]);};AGIVertices['prototype'][_0x4ae2('0x18e')]=function(_0x469fe8){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x18f'),_0x469fe8['label']));if(!this[_0x4ae2('0x84')](_0x469fe8[_0x4ae2('0x190')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')]('no\x20mail\x20account\x20configured');}var _0x2c7551=this['getMailAccount'][_0x4ae2('0x6f')](this,_0x469fe8[_0x4ae2('0x190')]);if(!_0x2c7551||!_0x2c7551['Smtp']){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x469fe8,'no\x20mail\x20account\x20found');}var _0x1bee4f={'from':util['format'](_0x4ae2('0x191'),_0x2c7551['name'],_0x2c7551[_0x4ae2('0x192')]||_0x2c7551[_0x4ae2('0x193')][_0x4ae2('0x194')]),'to':_0x469fe8['to']||'','cc':_0x469fe8['cc']||'','bcc':_0x469fe8[_0x4ae2('0x195')]||'','subject':_0x469fe8[_0x4ae2('0x196')],'html':_0x469fe8[_0x4ae2('0x59')],'text':_0x469fe8['text']};if(this[_0x4ae2('0x84')](_0x469fe8['template_id'])){}logger[_0x4ae2('0xe2')](_0x4ae2('0x197'),JSON[_0x4ae2('0x72')](_0x1bee4f));this['createSquareDetailsReport'][_0x4ae2('0x6f')](this,_0x469fe8,_0x469fe8[_0x4ae2('0x190')]);this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x198'),_0x2c7551[_0x4ae2('0x15')]));this[_0x4ae2('0x1f')][_0x4ae2('0x6f')](this,_0x2c7551[_0x4ae2('0x199')],_0x1bee4f);return this[_0x4ae2('0xb')]['noop'](_0x4ae2('0x19a'));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x19b')]=function(_0x334188){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0x19c'),_0x334188[_0x4ae2('0x34')]));return this['channel'][_0x4ae2('0xa9')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x19d')]=function(_0x5d2a55){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x19e'),_0x5d2a55[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x5d2a55[_0x4ae2('0x19f')])){return this['channel'][_0x4ae2('0xa9')]('no\x20sms\x20account\x20configured');}var _0x386ba1=this['getSmsAccount'][_0x4ae2('0x6f')](this,_0x5d2a55[_0x4ae2('0x19f')]);if(!_0x386ba1){return this[_0x4ae2('0xb')]['error'](_0x5d2a55,_0x4ae2('0x1a0'));}var _0x5ded5d={'body':_0x5d2a55[_0x4ae2('0x1a1')],'phone':_0x5d2a55['to']||'','SmsAccountId':_0x386ba1['id']};logger[_0x4ae2('0xe2')](_0x4ae2('0x1a2'),JSON['stringify'](_0x5ded5d));this['createSquareDetailsReport'][_0x4ae2('0x6f')](this,_0x5d2a55,_0x5d2a55[_0x4ae2('0x19f')]);this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x1a3'),_0x386ba1['name']));this[_0x4ae2('0x31')][_0x4ae2('0x6f')](this,_0x5ded5d);return this[_0x4ae2('0xb')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x1a4')]=function(_0x4deeb9){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x4deeb9['label']));if(!this[_0x4ae2('0x84')](_0x4deeb9[_0x4ae2('0xda')])){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x4deeb9,_0x4ae2('0x1a5'));}var _0x5150be=this['getVariable'][_0x4ae2('0x6f')](this,_0x4deeb9[_0x4ae2('0xda')]);if(!_0x5150be){return this['channel']['error'](_0x4deeb9,_0x4ae2('0xdc'));}return this[_0x4ae2('0xb')][_0x4ae2('0xa4')](_0x5150be,_0x4deeb9[_0x4ae2('0x1a6')]);};AGIVertices['prototype']['start']=function(_0x23aece){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x1a7'),_0x23aece['label']));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0x1a8'));var _0x3f70ee=this[_0x4ae2('0xb')]['getVariable'](_0x4ae2('0x1a9'));if(!_[_0x4ae2('0x42')](_0x3f70ee[_0x4ae2('0x114')])){this['channel'][_0x4ae2('0x33')]=_0x3f70ee['extra'];}if(_0x23aece[_0x4ae2('0xbb')]===_0x4ae2('0x1aa')){this['channel']['noop']('Answer');return this[_0x4ae2('0xb')][_0x4ae2('0xbb')]();}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')]('Skipped\x20Answer');};AGIVertices['prototype'][_0x4ae2('0x1ab')]=function(_0xcf8b3d){logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0x1ac'),_0xcf8b3d[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0xcf8b3d[_0x4ae2('0x1ad')])){return this[_0x4ae2('0xb')]['error'](_0xcf8b3d,_0x4ae2('0x1ae'));}var _0x4f05bf=this[_0x4ae2('0x1af')]['sync'](this,_0xcf8b3d[_0x4ae2('0x1ad')]);if(!this[_0x4ae2('0x84')](_0x4f05bf)){return this[_0x4ae2('0xb')]['error'](_0xcf8b3d,util[_0x4ae2('0x26')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0xcf8b3d[_0x4ae2('0x1ad')]));}if(_0x4f05bf===this[_0x4ae2('0xb')][_0x4ae2('0x3e')]){return this['channel'][_0x4ae2('0x29')](_0xcf8b3d,_0x4ae2('0x1b0'));}this['createSquareDetailsReport'][_0x4ae2('0x6f')](this,_0xcf8b3d,_0x4f05bf);var _0x467954=this['channel'][_0x4ae2('0x54')](_0x4ae2('0x1b1'),util[_0x4ae2('0x26')](_0x4ae2('0x1b2'),config['agi'][_0x4ae2('0x1b3')]||_0x4ae2('0x1b4'),_0x4f05bf,this[_0x4ae2('0xb')][_0x4ae2('0x3e')]));if(_0x467954['result']===-0x1){return _0x467954;}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')]('Executed\x20command\x20%s\x20%s','AGI',_0x4f05bf));};AGIVertices['prototype']['system']=function(_0x9fb5c1){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x1b5'),_0x9fb5c1[_0x4ae2('0x34')]));var _0x5dee4e=this['shellCommand'][_0x4ae2('0x6f')](this,_0x9fb5c1[_0x4ae2('0xba')]);this[_0x4ae2('0x32')]['sync'](this,_0x9fb5c1,_0x9fb5c1['command']);if(this['isConfigured'](_0x9fb5c1[_0x4ae2('0xda')])){var _0x29f26f=this['getVariable'][_0x4ae2('0x6f')](this,_0x9fb5c1[_0x4ae2('0xda')]);if(_0x29f26f){this['channel'][_0x4ae2('0xa4')](_0x29f26f,_0x5dee4e);return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x1b6'),_0x9fb5c1[_0x4ae2('0xba')],_0x29f26f));}}return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x1b7'),_0x9fb5c1[_0x4ae2('0xba')]));};AGIVertices[_0x4ae2('0xd')]['google_cloud_tts']=function(_0x3ed83f){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x1b8'),_0x3ed83f[_0x4ae2('0x34')]));_0x3ed83f[_0x4ae2('0x59')]=_0x3ed83f[_0x4ae2('0x59')][_0x4ae2('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4ae2('0x84')](_0x3ed83f['apiKey'])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')](_0x4ae2('0x1b9'));}if(!this['isConfigured'](_0x3ed83f[_0x4ae2('0x59')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')]('no\x20text\x20configured');}this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x1ba'),_0x3ed83f[_0x4ae2('0x59')]));var _0x2c5df2=this[_0x4ae2('0x57')][_0x4ae2('0x6f')](this,_0x3ed83f);if(_0x2c5df2){this[_0x4ae2('0xb')]['noop'](util[_0x4ae2('0x26')](_0x4ae2('0x1bb'),_0x2c5df2));var _0x18c6c2=this['channel'][_0x4ae2('0x126')](_0x2c5df2);try{fs[_0x4ae2('0x101')](_0x2c5df2+_0x4ae2('0x102'));}catch(_0x2e5cc1){logger[_0x4ae2('0x29')](_0x2e5cc1);}return _0x18c6c2;}return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x3ed83f,_0x4ae2('0x1bc'));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x1bd')]=function(_0x9f0cbb){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x1be'),_0x9f0cbb[_0x4ae2('0x34')]));_0x9f0cbb[_0x4ae2('0x59')]=_0x9f0cbb[_0x4ae2('0x59')][_0x4ae2('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x9f0cbb[_0x4ae2('0x59')])){return this[_0x4ae2('0xb')][_0x4ae2('0xa9')]('no\x20text\x20configured');}this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x1bf'),_0x9f0cbb['text']));var _0x2e30af=this[_0x4ae2('0x5f')][_0x4ae2('0x6f')](this,_0x9f0cbb);if(_0x2e30af){this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x1c0'),_0x2e30af));var _0x12da42=this[_0x4ae2('0xb')]['streamFile'](_0x2e30af);try{fs[_0x4ae2('0x101')](_0x2e30af+'.wav');}catch(_0x3d1652){logger[_0x4ae2('0x29')](_0x3d1652);}return _0x12da42;}return this[_0x4ae2('0xb')]['error'](_0x9f0cbb,_0x4ae2('0x1c1'));};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x1c2')]=function(_0x33e86c){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x1c3'),_0x33e86c[_0x4ae2('0x34')]));if(!this[_0x4ae2('0x84')](_0x33e86c[_0x4ae2('0x155')])){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x33e86c,_0x4ae2('0x15b'));}logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0x156'),this[_0x4ae2('0xb')][_0x4ae2('0x36')],_0x33e86c[_0x4ae2('0x155')]));var _0x18e2ce=this[_0x4ae2('0x4f')][_0x4ae2('0x6f')](this,_0x33e86c['findBy']);if(_0x18e2ce){logger[_0x4ae2('0x2b')](util['format'](_0x4ae2('0x157'),this[_0x4ae2('0xb')][_0x4ae2('0x36')],_0x33e86c[_0x4ae2('0x155')]));this['channel'][_0x4ae2('0xa9')](util['format'](_0x4ae2('0x157'),this['channel'][_0x4ae2('0x36')],_0x33e86c[_0x4ae2('0x155')]));return{'code':0xc8,'result':_0x4ae2('0x158')};}else{logger['info'](util[_0x4ae2('0x26')](_0x4ae2('0x159'),this[_0x4ae2('0xb')]['callerid'],_0x33e86c[_0x4ae2('0x155')]));this[_0x4ae2('0xb')][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0x159'),this['channel']['callerid'],_0x33e86c[_0x4ae2('0x155')]));return{'code':0xc8,'result':_0x4ae2('0x168')};}};AGIVertices[_0x4ae2('0xd')][_0x4ae2('0x1c4')]=function(_0x5b524c){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x1c5'),_0x5b524c[_0x4ae2('0x34')]));var _0x922fa7=this[_0x4ae2('0xb')]['exec'](_0x4ae2('0x1c6'),[_0x5b524c[_0x4ae2('0x1c7')],_0x5b524c[_0x4ae2('0x77')]]);if(_0x922fa7[_0x4ae2('0xa2')]===-0x1){return _0x922fa7;}return this['channel'][_0x4ae2('0xa9')](util[_0x4ae2('0x26')](_0x4ae2('0xc7'),_0x4ae2('0x1c6'),_0x5b524c[_0x4ae2('0x1c7')]));};AGIVertices[_0x4ae2('0xd')]['vswitch']=function(_0x20191a){logger[_0x4ae2('0x2b')](util[_0x4ae2('0x26')](_0x4ae2('0x1c8'),_0x20191a[_0x4ae2('0x34')]));if(!this['isConfigured'](_0x20191a['variable_id'])){return this['channel'][_0x4ae2('0x29')](_0x20191a,_0x4ae2('0x1a5'));}var _0x4053b0=this[_0x4ae2('0xe')][_0x4ae2('0x6f')](this,_0x20191a[_0x4ae2('0xda')]);if(!_0x4053b0){return this[_0x4ae2('0xb')][_0x4ae2('0x29')](_0x20191a,'no\x20variable\x20found');}var _0x36a91d=this[_0x4ae2('0xb')][_0x4ae2('0xe')](_0x4053b0);return{'code':0xc8,'result':_0x36a91d[_0x4ae2('0x114')]?_0x36a91d[_0x4ae2('0x114')]:'-'};};String[_0x4ae2('0xd')][_0x4ae2('0xa0')]=function(_0x190c04,_0x50d868){return this[_0x4ae2('0x9f')](_0x190c04)['join'](_0x50d868);};module[_0x4ae2('0x1c9')]=AGIVertices; \ No newline at end of file +var _0xc818=['no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','start','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','menu','getdigits','channel','rpc','mailRpc','prototype','getVariableById','name','catch','getVoiceQueue','getSquareProject','getSquareProjectById','then','dsn','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','googleCloudTTS','apiKey','text','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','method','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','stringify','split','replaceAll','getVariable','getAndSetVariable','result','extra','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','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','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','MRCPSynth','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','getSquareOdbc','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','file_id','response','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','NOBEEP','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','getData','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','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','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured'];(function(_0x28aa92,_0x43b202){var _0x79644d=function(_0xcb8292){while(--_0xcb8292){_0x28aa92['push'](_0x28aa92['shift']());}};_0x79644d(++_0x43b202);}(_0xc818,0x1e3));var _0x8c81=function(_0x198a6a,_0x2fe488){_0x198a6a=_0x198a6a-0x0;var _0x35ab4e=_0xc818[_0x198a6a];return _0x35ab4e;};'use strict';var fs=require('fs');var util=require(_0x8c81('0x0'));var _=require(_0x8c81('0x1'));var sh=require(_0x8c81('0x2'));var odbc=require(_0x8c81('0x3'))();var rs=require('randomstring');var moment=require(_0x8c81('0x4'));var Mustache=require(_0x8c81('0x5'));var rp=require(_0x8c81('0x6'));var logger=require(_0x8c81('0x7'))(_0x8c81('0x8'));var config=require(_0x8c81('0x9'));var scripts=require(_0x8c81('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x8c81('0xb'),_0x8c81('0xc')];var verticesWithRetry=[_0x8c81('0xd'),_0x8c81('0xe'),'getsecretdigits'];var AGIVertices=function(_0x1173cf,_0x448af6,_0x186783){this[_0x8c81('0xf')]=_0x1173cf;this[_0x8c81('0x10')]=_0x448af6;this[_0x8c81('0x11')]=_0x186783;};AGIVertices[_0x8c81('0x12')]['getVariable']=function(_0x3de91f,_0x37dbb4){this[_0x8c81('0x10')][_0x8c81('0x13')](_0x3de91f)['then'](function(_0x5a2d9e){_0x37dbb4(null,_0x5a2d9e?_0x5a2d9e[_0x8c81('0x14')]:![]);})[_0x8c81('0x15')](function(_0x31ff3f){_0x37dbb4(_0x31ff3f);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x16')]=function(_0x1b7b1b,_0xd04a1){this[_0x8c81('0x10')]['getVoiceQueueById'](_0x1b7b1b)['then'](function(_0x1db769){_0xd04a1(null,_0x1db769?_0x1db769[_0x8c81('0x14')]:![]);})[_0x8c81('0x15')](function(_0x4fa5){_0xd04a1(_0x4fa5);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x17')]=function(_0x4f7180,_0x3683f0){this[_0x8c81('0x10')][_0x8c81('0x18')](_0x4f7180)[_0x8c81('0x19')](function(_0x17564e){_0x3683f0(null,_0x17564e?_0x17564e['name']:![]);})[_0x8c81('0x15')](function(_0x4d0b75){_0x3683f0(_0x4d0b75);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x216d29,_0x13e312){this[_0x8c81('0x10')]['getSquareOdbcById'](_0x216d29)[_0x8c81('0x19')](function(_0x2312d5){_0x13e312(null,_0x2312d5?_0x2312d5[_0x8c81('0x1a')]:![]);})['catch'](function(_0x261832){_0x13e312(_0x261832);});};AGIVertices[_0x8c81('0x12')]['getUser']=function(_0x35d61a,_0x31c4a2){this['rpc']['getUserById'](_0x35d61a)[_0x8c81('0x19')](function(_0x4f58ff){_0x31c4a2(null,_0x4f58ff?_0x4f58ff[_0x8c81('0x14')]:![]);})['catch'](function(_0x8c399c){_0x31c4a2(_0x8c399c);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1b')]=function(_0xa0f0f7,_0x703dba){this[_0x8c81('0x10')][_0x8c81('0x1c')](_0xa0f0f7)[_0x8c81('0x19')](function(_0x4bfa48){_0x703dba(null,_0x4bfa48?_0x4bfa48['name']:![]);})[_0x8c81('0x15')](function(_0x1ee94c){_0x703dba(_0x1ee94c);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1d')]=function(_0x3e5ed1,_0x1f9608){var _0x2e7ba2=this;this[_0x8c81('0x10')][_0x8c81('0x1e')](_0x3e5ed1)[_0x8c81('0x19')](function(_0x477a9e){_0x1f9608(null,_0x477a9e?_0x2e7ba2[_0x8c81('0x1f')](_0x477a9e[_0x8c81('0x20')]):![]);})['catch'](function(_0x1d73ac){_0x1f9608(_0x1d73ac);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x21')]=function(_0x29a52c,_0x428aba){this[_0x8c81('0x10')][_0x8c81('0x22')](_0x29a52c)[_0x8c81('0x19')](function(_0x2f419f){_0x428aba(null,_0x2f419f?_0x2f419f:![]);})['catch'](function(_0x2358be){_0x428aba(_0x2358be);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x23')]=function(_0x25654d,_0x1d931f,_0x551f0b){this[_0x8c81('0x11')][_0x8c81('0x23')](_0x25654d,_0x1d931f)[_0x8c81('0x19')](function(){_0x551f0b(null);})[_0x8c81('0x15')](function(_0x267c01){_0x551f0b(_0x267c01);});};AGIVertices['prototype']['getIntervals']=function(_0x1da1f1,_0x45e7fc){this[_0x8c81('0x10')]['getIntervalById'](_0x1da1f1)[_0x8c81('0x19')](function(_0x30b2a1){if(_0x30b2a1){if(_0x30b2a1[_0x8c81('0x24')]){_0x45e7fc(null,[_0x30b2a1[_0x8c81('0x25')]]);}else{_0x45e7fc(null,_['map'](_0x30b2a1[_0x8c81('0x26')],_0x8c81('0x25')));}}else{_0x45e7fc(null,![]);}})['catch'](function(_0x199478){_0x45e7fc(_0x199478);});};AGIVertices['prototype']['getSoundPath']=function(_0x3fc1c0){return util[_0x8c81('0x27')](_0x8c81('0x28'),FILES_PATH,_0x3fc1c0);};AGIVertices[_0x8c81('0x12')]['getQueryOdbc']=function(_0x30fa19,_0x252172,_0x3f14db){odbc['open'](_0x30fa19,function(_0x4c46dd){if(_0x4c46dd){logger[_0x8c81('0x29')](_0x8c81('0x2a'),_0x4c46dd);_0x3f14db(_0x4c46dd);}else{logger[_0x8c81('0x2b')]('ODBC\x20connection\x20successfully');odbc[_0x8c81('0x2c')](_0x252172,function(_0x5a30fa,_0x4ccca3){if(_0x5a30fa){logger['info'](_0x8c81('0x2d'),_0x252172);_0x3f14db(_0x5a30fa);}else{logger['info'](_0x8c81('0x2e'),_0x252172);odbc['close'](function(_0x4b2729){if(_0x4b2729){logger[_0x8c81('0x29')](_0x8c81('0x2f'),_0x4b2729);}_0x3f14db(null,_0x4ccca3);});}});}});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x30')]=function(_0x1e070d,_0x232ba7){this[_0x8c81('0x10')]['getSmsAccountById'](_0x1e070d)[_0x8c81('0x19')](function(_0x15e499){_0x232ba7(null,_0x15e499?_0x15e499:![]);})[_0x8c81('0x15')](function(_0x41f9d2){_0x232ba7(_0x41f9d2);});};AGIVertices[_0x8c81('0x12')]['createSmsMessage']=function(_0xc9dd61,_0x202f78){this[_0x8c81('0x10')][_0x8c81('0x31')](_0xc9dd61)[_0x8c81('0x19')](function(_0x2a2b97){_0x202f78(null,_0x2a2b97);})[_0x8c81('0x15')](function(_0x2c9085){_0x202f78(_0x2c9085);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x32')]=function(_0xae952a,_0xc7871,_0x5176d3){this['rpc'][_0x8c81('0x32')]({'uniqueid':this[_0x8c81('0xf')][_0x8c81('0x33')],'node':_0xae952a[_0x8c81('0x34')],'application':_0xae952a[_0x8c81('0x35')],'data':_0xc7871||null,'project_name':this[_0x8c81('0xf')][_0x8c81('0x36')],'callerid':this['channel']['callerid']})[_0x8c81('0x19')](function(_0x2a8c67){if(_0x5176d3){_0x5176d3(null,_0x2a8c67);}})[_0x8c81('0x15')](function(_0x21891f){if(_0x5176d3){_0x5176d3(_0x21891f);}});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x37')]=function(_0x349a87,_0x55fe22,_0x41996c,_0xe20dad){this[_0x8c81('0x10')][_0x8c81('0x37')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0x8c81('0xf')][_0x8c81('0x38')],'calleridname':this[_0x8c81('0xf')][_0x8c81('0x39')],'context':this[_0x8c81('0xf')][_0x8c81('0x3a')],'extension':this[_0x8c81('0xf')][_0x8c81('0x3b')],'priority':this[_0x8c81('0xf')][_0x8c81('0x3c')],'accountcode':this[_0x8c81('0xf')][_0x8c81('0x3d')],'dnid':this[_0x8c81('0xf')][_0x8c81('0x3e')],'projectName':this[_0x8c81('0xf')][_0x8c81('0x36')],'saveName':_0x55fe22,'filename':_0x349a87[_0x8c81('0x3f')]||_0x55fe22,'savePath':_0x41996c})[_0x8c81('0x19')](function(_0x39dbc8){_0xe20dad(null,_0x39dbc8);})[_0x8c81('0x15')](function(_0x16e822){_0xe20dad(_0x16e822);});};AGIVertices['prototype'][_0x8c81('0x40')]=function(_0x221f4f,_0x5c21f0,_0x18eb31,_0x1b928f,_0x38bb79){this['rpc'][_0x8c81('0x40')]({'uniqueid':this[_0x8c81('0xf')][_0x8c81('0x33')],'body':_0x221f4f,'direction':_0x5c21f0,'providerName':_0x18eb31,'providerResponse':_0x1b928f})['then'](function(_0x51280e){if(_0x38bb79){_0x38bb79(null,_0x51280e);}})[_0x8c81('0x15')](function(_0x3f1d4c){if(_0x38bb79){_0x38bb79(_0x3f1d4c);}});};AGIVertices[_0x8c81('0x12')]['createCmContact']=function(_0x3c4f19,_0xc4fa7e){this[_0x8c81('0x10')][_0x8c81('0x41')]({'firstName':_[_0x8c81('0x42')](_0x3c4f19[_0x8c81('0x14')])||_[_0x8c81('0x43')](_0x3c4f19[_0x8c81('0x14')])?'callback_'+Math['random']():_0x3c4f19[_0x8c81('0x14')],'lastName':_[_0x8c81('0x42')](_0x3c4f19[_0x8c81('0x44')])||_[_0x8c81('0x43')](_0x3c4f19['lastName'])?null:_0x3c4f19[_0x8c81('0x44')],'phone':_0x3c4f19[_0x8c81('0x45')],'ListId':_0x3c4f19[_0x8c81('0x46')],'scheduledat':_0x3c4f19[_0x8c81('0x47')],'callbackUniqueid':this[_0x8c81('0xf')][_0x8c81('0x33')],'tags':'callback','description':_0x8c81('0x48')+_0x3c4f19['scheduledAt'][_0x8c81('0x49')](),'priority':_0x3c4f19[_0x8c81('0x4a')]})[_0x8c81('0x19')](function(_0x5f39ff){_0xc4fa7e(null,_0x5f39ff);})['catch'](function(_0x30b694){_0xc4fa7e(_0x30b694);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x4b')]=function(_0x19d9bb,_0x3357ee){this[_0x8c81('0x10')][_0x8c81('0x4c')](_0x19d9bb)[_0x8c81('0x19')](function(_0x12ed28){_0x3357ee(null,_0x12ed28?_0x12ed28[_0x8c81('0x14')]:![]);})[_0x8c81('0x15')](function(_0x30d6df){_0x3357ee(_0x30d6df);});};AGIVertices[_0x8c81('0x12')]['agentPause']=function(_0x11ef7a,_0x418977,_0x2a11d3){var _0x2bc8ab={'role':_0x8c81('0x4d')};_0x2bc8ab[_0x11ef7a]=this['channel'][_0x8c81('0x38')];this[_0x8c81('0x10')][_0x8c81('0x4e')](_0x2bc8ab,_0x418977,this[_0x8c81('0xf')][_0x8c81('0x33')])[_0x8c81('0x19')](function(_0x45f92e){_0x2a11d3(null,_[_0x8c81('0x43')](_0x45f92e)?![]:!![]);})['catch'](function(_0x28da6c){logger[_0x8c81('0x29')](_0x28da6c);_0x2a11d3(null,![]);});};AGIVertices[_0x8c81('0x12')]['agentUnpause']=function(_0x5b53f3,_0x4e7bb6){var _0x3d2d0e={'role':_0x8c81('0x4d')};_0x3d2d0e[_0x5b53f3]=this['channel'][_0x8c81('0x38')];this[_0x8c81('0x10')][_0x8c81('0x4f')](_0x3d2d0e)['then'](function(_0x59eaf1){_0x4e7bb6(null,_[_0x8c81('0x43')](_0x59eaf1)?![]:!![]);})[_0x8c81('0x15')](function(_0x111816){logger[_0x8c81('0x29')](_0x111816);_0x4e7bb6(null,![]);});};AGIVertices['prototype'][_0x8c81('0x50')]=function(_0x47ad6f,_0x3589d0){var _0x3deb72={'role':_0x8c81('0x4d')};_0x3deb72[_0x47ad6f]=this[_0x8c81('0xf')]['callerid'];this[_0x8c81('0x10')][_0x8c81('0x50')](_0x3deb72)[_0x8c81('0x19')](function(_0x306a66){_0x3589d0(null,_[_0x8c81('0x43')](_0x306a66)?![]:!![]);})[_0x8c81('0x15')](function(_0x2658e8){logger['error'](_0x2658e8);_0x3589d0(null,![]);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x51')]=function(_0x39c244,_0x36942e){var _0xa91282={'role':_0x8c81('0x4d')};_0xa91282[_0x39c244]=this[_0x8c81('0xf')]['callerid'];var _0x4e6168=_0x39c244!=_0x8c81('0x52')?util[_0x8c81('0x27')](_0x8c81('0x53'),'LOCAL',this[_0x8c81('0xf')][_0x8c81('0x38')]):undefined;this[_0x8c81('0x10')][_0x8c81('0x51')](_0xa91282,_0x4e6168)[_0x8c81('0x19')](function(_0x1a68e8){_0x36942e(null,_[_0x8c81('0x43')](_0x1a68e8)?![]:!![]);})['catch'](function(_0x2a6347){logger[_0x8c81('0x29')](_0x2a6347);_0x36942e(null,![]);});};AGIVertices['prototype'][_0x8c81('0x54')]=function(_0x4f5850,_0x40e5b5){sh[_0x8c81('0x55')](_['trim'](_0x4f5850),function(_0x2d3fa2,_0x40f800){var _0x1b435a=_0x40f800['replace'](/(\r\n|\n|\r)/gm,'');_0x40e5b5(null,_0x1b435a);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x56')]=function(_0x15e71a,_0x19426a){scripts[_0x8c81('0x56')](_0x15e71a[_0x8c81('0x57')],_0x15e71a['google_cloud_tts_text_type']||'text',_0x15e71a[_0x8c81('0x58')],_0x15e71a['languageCode']||'en-US',_0x15e71a[_0x8c81('0x59')]||_0x8c81('0x5a'),_0x15e71a[_0x8c81('0x5b')]||_0x8c81('0x5c'))[_0x8c81('0x19')](function(_0x3984a4){_0x19426a(null,_0x3984a4);})[_0x8c81('0x15')](function(_0x575764){_0x19426a(_0x575764);});};AGIVertices['prototype'][_0x8c81('0x5d')]=function(_0x512e3a,_0x5762db){scripts[_0x8c81('0x5d')](_0x512e3a[_0x8c81('0x58')],_0x512e3a[_0x8c81('0x5e')]||'en',0x1)[_0x8c81('0x19')](function(_0x9728e4){_0x5762db(null,_0x9728e4);})['catch'](function(_0x374795){_0x5762db(_0x374795);});};AGIVertices['prototype'][_0x8c81('0x5f')]=function(_0x22a4aa,_0x198c48){var _0x2e1962={'uri':_0x22a4aa[_0x8c81('0x60')],'method':_0x22a4aa['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x22a4aa[_0x8c81('0x61')])===_0x8c81('0x62')&&parseInt(_0x22a4aa[_0x8c81('0x61')])>=0x1?parseInt(_0x22a4aa[_0x8c81('0x61')])*0x3e8:0x5*0x3e8};if(_[_0x8c81('0x63')]([_0x8c81('0x64'),'PUT'],_0x2e1962[_0x8c81('0x65')][_0x8c81('0x66')]())){try{_0x2e1962[_0x8c81('0x67')]=_0x22a4aa[_0x8c81('0xc')]?JSON[_0x8c81('0x68')](_0x22a4aa[_0x8c81('0xc')]):{};}catch(_0x866adb){logger[_0x8c81('0x29')](_0x8c81('0x69'),_0x866adb);}}try{_0x2e1962[_0x8c81('0x6a')]=_0x22a4aa[_0x8c81('0xb')]?JSON[_0x8c81('0x68')](_0x22a4aa[_0x8c81('0xb')]):{};}catch(_0x23b9f6){logger[_0x8c81('0x29')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x23b9f6);}if(_0x22a4aa[_0x8c81('0x6b')]){try{var _0x417163=require(_0x22a4aa[_0x8c81('0x6b')])[_0x8c81('0x6c')](this,_0x2e1962);_0x2e1962[_0x8c81('0x6d')]=Mustache[_0x8c81('0x6e')](_0x22a4aa['url'],_0x417163,{},['$$','$$']);if(_0x2e1962[_0x8c81('0x6a')]){_0x2e1962[_0x8c81('0x6a')]=JSON['parse'](Mustache[_0x8c81('0x6e')](JSON['stringify'](_0x2e1962[_0x8c81('0x6a')]),_0x417163,{},['$$','$$']));}if(_0x2e1962[_0x8c81('0x67')]){_0x2e1962['body']=JSON[_0x8c81('0x68')](Mustache[_0x8c81('0x6e')](JSON['stringify'](_0x2e1962['body']),_0x417163,{},['$$','$$']));}}catch(_0x9ba52e){logger['error'](_0x8c81('0x6f'),_0x9ba52e);}}rp(_0x2e1962)[_0x8c81('0x19')](function(_0x20df01){var _0x2374a2={'statusCode':_0x20df01[_0x8c81('0x70')]||0xc8,'statusMessage':_0x20df01['statusMessage']||'OK','headers':_0x20df01['headers']||{},'body':_0x20df01[_0x8c81('0x67')]||{}};_0x198c48(null,_0x2374a2);})[_0x8c81('0x15')](function(_0x4aeafe){var _0x58de6a={'statusCode':_0x4aeafe[_0x8c81('0x70')]||0x1f4,'statusMessage':_0x4aeafe['message']||_0x8c81('0x71'),'headers':_0x4aeafe[_0x8c81('0x72')][_0x8c81('0x6a')]||{},'body':_0x4aeafe[_0x8c81('0x72')]['body']||{}};_0x198c48(null,_0x58de6a);});};AGIVertices['prototype']['googleDialogflow']=function(_0xd39626,_0xc2828f){scripts[_0x8c81('0x73')](this[_0x8c81('0xf')][_0x8c81('0x33')],_0xd39626[_0x8c81('0x74')],_0xd39626[_0x8c81('0x58')],_0xd39626['dialogflow_language']||'en')[_0x8c81('0x19')](function(_0x5e3d40){_0xc2828f(null,_0x5e3d40);})['catch'](function(_0x31a3aa){_0xc2828f(_0x31a3aa);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x75')]=function(_0xa0c66e,_0x102d54){scripts['googleDialogflowV2'](this['channel'][_0x8c81('0x33')],_0xa0c66e[_0x8c81('0x76')],_0xa0c66e[_0x8c81('0x77')],_0xa0c66e[_0x8c81('0x78')],_0xa0c66e['text'],_0xa0c66e[_0x8c81('0x79')]||'en')[_0x8c81('0x19')](function(_0x2df0fa){_0x102d54(null,_0x2df0fa);})[_0x8c81('0x15')](function(_0x1d8e1c){_0x102d54(_0x1d8e1c);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x7a')]=function(_0x1fa933,_0x1936df){scripts[_0x8c81('0x7a')](this[_0x8c81('0xf')],_0x1fa933)[_0x8c81('0x19')](function(_0x3f1dab){_0x1936df(null,_0x3f1dab);})['catch'](function(_0x39a84f){_0x1936df(_0x39a84f);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x7b')]=function(_0x27b542,_0x2a4815){scripts[_0x8c81('0x7b')](_0x27b542[_0x8c81('0x74')],_0x27b542[_0x8c81('0x58')],_0x27b542[_0x8c81('0x7c')]||'en-US',_0x27b542[_0x8c81('0x7d')])[_0x8c81('0x19')](function(_0x376b7d){_0x2a4815(null,_0x376b7d);})[_0x8c81('0x15')](function(_0x18ad13){_0x2a4815(_0x18ad13);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x7e')]=function(_0x3183e6,_0x151a69,_0x457e00){scripts[_0x8c81('0x7e')](_0x151a69,_0x3183e6[_0x8c81('0x74')],_0x3183e6[_0x8c81('0x7f')]||_0x8c81('0x80'),this[_0x8c81('0x81')](_0x3183e6[_0x8c81('0x82')])?_0x3183e6[_0x8c81('0x82')]:undefined)[_0x8c81('0x19')](function(_0x2b1832){_0x457e00(null,_0x2b1832);})[_0x8c81('0x15')](function(_0x1db93c){_0x457e00(_0x1db93c);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x83')]=function(_0x1108e6,_0x184a0b){scripts[_0x8c81('0x83')](_0x1108e6['aws_access_key_id'],_0x1108e6[_0x8c81('0x84')],_0x1108e6[_0x8c81('0x85')],_0x1108e6[_0x8c81('0x86')]||_0x8c81('0x87'),_0x1108e6[_0x8c81('0x58')],_0x1108e6[_0x8c81('0x88')]||_0x8c81('0x58'))[_0x8c81('0x19')](function(_0x12d591){_0x184a0b(null,_0x12d591);})[_0x8c81('0x15')](function(_0x3ad4d5){_0x184a0b(_0x3ad4d5);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x89')]=function(_0x23b7c4,_0x37220e){scripts[_0x8c81('0x89')](this[_0x8c81('0xf')][_0x8c81('0x33')],_0x23b7c4[_0x8c81('0x8a')],_0x23b7c4[_0x8c81('0x84')],_0x23b7c4[_0x8c81('0x8b')],_0x23b7c4[_0x8c81('0x58')],_0x23b7c4[_0x8c81('0x8c')])[_0x8c81('0x19')](function(_0x4e1e9d){_0x37220e(null,_0x4e1e9d);})[_0x8c81('0x15')](function(_0x4f9318){_0x37220e(_0x4f9318);});};AGIVertices[_0x8c81('0x12')]['googleASR']=function(_0x47da0c,_0x58a9e7,_0x148ac4){scripts[_0x8c81('0x8d')](_0x58a9e7,_0x47da0c[_0x8c81('0x74')],_0x47da0c[_0x8c81('0x8e')]||_0x8c81('0x80'))[_0x8c81('0x19')](function(_0x288981){_0x148ac4(null,_0x288981);})[_0x8c81('0x15')](function(_0x221988){_0x148ac4(_0x221988);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x8f')]=function(_0x20fdaf,_0x33f9a9,_0x4a19c4){scripts[_0x8c81('0x8f')](_0x33f9a9,_0x20fdaf[_0x8c81('0x90')],_0x20fdaf['appsecret'],_0x20fdaf[_0x8c81('0x6d')])[_0x8c81('0x19')](function(_0x353606){_0x4a19c4(null,_0x353606);})[_0x8c81('0x15')](function(_0x1224af){_0x4a19c4(_0x1224af);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x91')]=function(_0x4afc4b){var _0x2b8b52=_['includes'](verticesWithRetry,_0x4afc4b['agicommand'])?_0x4afc4b:_[_0x8c81('0x92')](_0x4afc4b);for(var _0x23ea3e in _0x2b8b52){if(_0x2b8b52[_0x8c81('0x93')](_0x23ea3e)){if(_0x2b8b52[_0x23ea3e]&&_['isString'](_0x2b8b52[_0x23ea3e])){if(_[_0x8c81('0x63')](recursiveMapAttributes,_0x23ea3e)){_0x2b8b52[_0x23ea3e]=this[_0x8c81('0x94')](_0x2b8b52[_0x23ea3e]);}else{_0x2b8b52[_0x23ea3e]=this[_0x8c81('0x95')](_0x2b8b52[_0x23ea3e]);}}}}return _0x2b8b52;};AGIVertices[_0x8c81('0x12')][_0x8c81('0x96')]=function(_0xfdc1a2){for(var _0x319fd8 in _0xfdc1a2){if(_0xfdc1a2['hasOwnProperty'](_0x319fd8)){if(_[_0x8c81('0x97')](_0xfdc1a2[_0x319fd8])){this[_0x8c81('0x96')](_0xfdc1a2[_0x319fd8]);}else if(_[_0x8c81('0x98')](_0xfdc1a2[_0x319fd8])){for(var _0x16a5c4=0x0;_0x16a5c4<_0xfdc1a2[_0x319fd8][_0x8c81('0x99')];_0x16a5c4++){this[_0x8c81('0x96')](_0xfdc1a2[_0x319fd8][_0x16a5c4]);}}else if(_['isString'](_0xfdc1a2[_0x319fd8])){_0xfdc1a2[_0x319fd8]=this[_0x8c81('0x95')](_0xfdc1a2[_0x319fd8]);}}}};AGIVertices['prototype'][_0x8c81('0x9a')]=function(_0x19324a,_0x13b30d){for(var _0x22c0fe in _0x19324a){if(_0x19324a[_0x8c81('0x93')](_0x22c0fe)){if(_[_0x8c81('0x97')](_0x19324a[_0x22c0fe])){if(!_[_0x8c81('0x42')](_0x19324a[_0x22c0fe])){this[_0x8c81('0x9a')](_0x19324a[_0x22c0fe],util[_0x8c81('0x27')]('%s.%s',_0x13b30d,_0x22c0fe));}}else if(_[_0x8c81('0x98')](_0x19324a[_0x22c0fe])){for(var _0x47851a=0x0;_0x47851a<_0x19324a[_0x22c0fe]['length'];_0x47851a++){this['saveRestApiResult'](_0x19324a[_0x22c0fe][_0x47851a],util[_0x8c81('0x27')](_0x8c81('0x9b'),_0x13b30d,_0x22c0fe+'['+_0x47851a+']'));}}else{if(!_['isNil'](_0x19324a[_0x22c0fe])){this[_0x8c81('0xf')][_0x8c81('0x9c')](util['format'](_0x8c81('0x9b'),_0x13b30d,_0x22c0fe),_0x19324a[_0x22c0fe]);}}}}};AGIVertices[_0x8c81('0x12')][_0x8c81('0x94')]=function(_0x23dcc3){try{var _0x43c3eb=JSON['parse'](_0x23dcc3);this[_0x8c81('0x96')](_0x43c3eb);return JSON[_0x8c81('0x9d')](_0x43c3eb);}catch(_0x2cc3ba){return this['replaceAllVariables'](_0x23dcc3);}};AGIVertices[_0x8c81('0x12')]['replaceAllVariables']=function(_0x24e269){var _0x20230b=_0x24e269[_0x8c81('0x9e')]('{');for(var _0x3f154f=0x1;_0x3f154f<_0x20230b[_0x8c81('0x99')];_0x3f154f+=0x1){var _0x231516=_0x20230b[_0x3f154f][_0x8c81('0x9e')]('}');if(_0x231516[_0x8c81('0x99')]>0x1){_0x24e269=_0x24e269[_0x8c81('0x9f')]('{'+_0x231516[0x0]+'}',this['channel'][_0x8c81('0xa0')](_0x231516[0x0])['extra']||_0x231516[0x0]);}}if(_0x20230b['length']===0x1){return _0x24e269['toString']();}return this[_0x8c81('0x95')](_0x24e269);};AGIVertices['prototype'][_0x8c81('0xa1')]=function(_0x3c7302,_0x2cb331){var _0x534965=this[_0x8c81('0xf')]['getVariable'](_0x3c7302);if(_0x534965[_0x8c81('0xa2')]===-0x1){return _0x534965;}logger[_0x8c81('0x2b')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x2cb331,_0x534965[_0x8c81('0xa3')]));return this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x2cb331,_0x534965[_0x8c81('0xa3')]);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x81')]=function(_0x28aa15){return _0x28aa15&&_0x28aa15!=='0'&&_0x28aa15!=='-1'&&_0x28aa15!=='';};AGIVertices[_0x8c81('0x12')][_0x8c81('0xa4')]=function(_0x4f0f00){this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x4f0f00,'-');_0x4f0f00['retry']=_0x4f0f00[_0x8c81('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x4291f8){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xa5'),_0x4291f8[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x4291f8[_0x8c81('0x58')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xa7'));}var _0x4adeb1='\x22'+_0x4291f8['text']+'\x22';if(this['isConfigured'](_0x4291f8[_0x8c81('0x72')])){_0x4adeb1+=','+_0x4291f8[_0x8c81('0x72')];}var _0x5d0e21=this[_0x8c81('0xf')][_0x8c81('0x55')]('MRCPSynth',_0x4adeb1);if(_0x5d0e21[_0x8c81('0xa2')]===-0x1){return _0x5d0e21;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xa8'),_0x4adeb1));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xa9')]=function(_0x7c5c5){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xaa'),_0x7c5c5[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x7c5c5[_0x8c81('0xab')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20grammar\x20configured');}var _0x1b51f8=_0x7c5c5[_0x8c81('0xab')];if(this[_0x8c81('0x81')](_0x7c5c5[_0x8c81('0x72')])){_0x1b51f8+=','+_0x7c5c5[_0x8c81('0x72')];}var _0xecf47b=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0xac'),_0x1b51f8);if(_0xecf47b[_0x8c81('0xa2')]===-0x1){return _0xecf47b;}var _0x5aa1bb=this[_0x8c81('0xa1')](_0x8c81('0xad'),_0x8c81('0xae'));if(_0x5aa1bb[_0x8c81('0xa2')]===-0x1){return _0x5aa1bb;}var _0x4b35f3=this[_0x8c81('0xa1')](_0x8c81('0xaf'),_0x8c81('0xb0'));if(_0x4b35f3[_0x8c81('0xa2')]===-0x1){return _0x4b35f3;}var _0x3de2c6=this[_0x8c81('0xa1')](_0x8c81('0xb1'),'MRCP_RECOG_INSTANCE');if(_0x3de2c6[_0x8c81('0xa2')]===-0x1){return _0x3de2c6;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0xb2'),_0x1b51f8));};AGIVertices['prototype'][_0x8c81('0x8')]=function(_0x57f14c){logger['info'](util['format'](_0x8c81('0xb3'),_0x57f14c['label']));return this[_0x8c81('0xf')][_0x8c81('0x8')]([_0x57f14c[_0x8c81('0xb4')],_0x57f14c[_0x8c81('0xb5')]]);};AGIVertices[_0x8c81('0x12')][_0x8c81('0xb6')]=function(_0x581a09){logger['info'](util[_0x8c81('0x27')](_0x8c81('0xb7'),_0x581a09['label']));if(this[_0x8c81('0x81')](_0x581a09[_0x8c81('0x61')])){logger['info'](util[_0x8c81('0x27')](_0x8c81('0xb8'),_0x581a09[_0x8c81('0x61')]));var _0x4a1ea1=this[_0x8c81('0xf')]['wait'](_0x581a09[_0x8c81('0x61')]);if(_0x4a1ea1[_0x8c81('0xa2')]===-0x1){return _0x4a1ea1;}}return this[_0x8c81('0xf')][_0x8c81('0xb6')]();};AGIVertices['prototype']['callback']=function(_0x544990){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xb9'),_0x544990[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x544990[_0x8c81('0x46')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x544990,_0x8c81('0xba'));}_0x544990['scheduledAt']=moment();if(this[_0x8c81('0x81')](_0x544990[_0x8c81('0xbb')])){_0x544990['scheduledAt']=moment()[_0x8c81('0xbc')](_0x544990['delay'],_0x8c81('0xbd'));}if(!this[_0x8c81('0x81')](_0x544990[_0x8c81('0x4a')])){_0x544990[_0x8c81('0x4a')]=0x2;}this['createCmContact']['sync'](this,_0x544990);return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x544990[_0x8c81('0x45')],_0x544990[_0x8c81('0x46')],_0x544990[_0x8c81('0x47')]));};AGIVertices[_0x8c81('0x12')]['custom_app']=function(_0x19f29e){logger['info'](util[_0x8c81('0x27')](_0x8c81('0xbe'),_0x19f29e[_0x8c81('0x34')]));var _0x24b481=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x19f29e[_0x8c81('0xbf')],_0x19f29e[_0x8c81('0x72')]);if(_0x24b481[_0x8c81('0xa2')]===-0x1){return _0x24b481;}return this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x19f29e['application'],_0x19f29e[_0x8c81('0x72')]));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xc1')]=function(_0x1bcb85){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1bcb85[_0x8c81('0x34')]));if(!this['isConfigured'](_0x1bcb85[_0x8c81('0x58')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xa7'));}var _0x38e4a1='\x22'+_0x1bcb85[_0x8c81('0x58')]+'\x22';if(this[_0x8c81('0x81')](_0x1bcb85[_0x8c81('0x72')])){_0x38e4a1+=','+_0x1bcb85[_0x8c81('0x72')];}var _0x25728b=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0xc2'),_0x38e4a1);if(_0x25728b['result']===-0x1){return _0x25728b;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0xa8'),_0x38e4a1));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xc3')]=function(_0x321819){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x321819[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x321819['text'])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0xa7'));}var _0x4f1880='\x22'+_0x321819['text']+'\x22';if(this[_0x8c81('0x81')](_0x321819[_0x8c81('0x72')])){_0x4f1880+=','+_0x321819['options'];}var _0x7eec41=this[_0x8c81('0xf')]['exec'](_0x8c81('0xc2'),_0x4f1880);if(_0x7eec41['result']===-0x1){return _0x7eec41;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4f1880));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xc4')]=function(_0x65e0fa){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0xc5'),_0x65e0fa[_0x8c81('0x34')]));if(!this['isConfigured'](_0x65e0fa['grammar'])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0xc6'));}var _0xd80cc0=_0x65e0fa[_0x8c81('0xab')];if(this[_0x8c81('0x81')](_0x65e0fa[_0x8c81('0x72')])){_0xd80cc0+=','+_0x65e0fa[_0x8c81('0x72')];}var _0x30ce49=this['channel'][_0x8c81('0x55')](_0x8c81('0xac'),_0xd80cc0);if(_0x30ce49[_0x8c81('0xa2')]===-0x1){return _0x30ce49;}var _0x1f43ca=this[_0x8c81('0xa1')](_0x8c81('0xad'),'LUMENVOX_ASR_CONFIDENCE');if(_0x1f43ca[_0x8c81('0xa2')]===-0x1){return _0x1f43ca;}var _0x5a8c91=this[_0x8c81('0xa1')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x5a8c91[_0x8c81('0xa2')]===-0x1){return _0x5a8c91;}var _0xb2544=this[_0x8c81('0xa1')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0xb2544[_0x8c81('0xa2')]===-0x1){return _0xb2544;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0xd80cc0));};AGIVertices['prototype'][_0x8c81('0xc7')]=function(_0x5bce2b){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x5bce2b['label']));if(!this[_0x8c81('0x81')](_0x5bce2b[_0x8c81('0xab')])){return this[_0x8c81('0xf')]['noop']('no\x20grammar\x20configured');}var _0x539443=_0x5bce2b[_0x8c81('0xab')];if(this[_0x8c81('0x81')](_0x5bce2b[_0x8c81('0x72')])){_0x539443+=','+_0x5bce2b[_0x8c81('0x72')];}var _0x24f82e=this['channel'][_0x8c81('0x55')](_0x8c81('0xac'),_0x539443);if(_0x24f82e[_0x8c81('0xa2')]===-0x1){return _0x24f82e;}var _0x1eca51=this[_0x8c81('0xa1')]('RECOG_CONFIDENCE()',_0x8c81('0xc8'));if(_0x1eca51[_0x8c81('0xa2')]===-0x1){return _0x1eca51;}var _0x21ca21=this[_0x8c81('0xa1')](_0x8c81('0xaf'),_0x8c81('0xc9'));if(_0x21ca21[_0x8c81('0xa2')]===-0x1){return _0x21ca21;}var _0x29b7b8=this[_0x8c81('0xa1')](_0x8c81('0xb1'),_0x8c81('0xca'));if(_0x29b7b8[_0x8c81('0xa2')]===-0x1){return _0x29b7b8;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xb2'),_0x539443));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xcb')]=function(_0x45cb0a){logger['info'](util[_0x8c81('0x27')](_0x8c81('0xcc'),_0x45cb0a[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x45cb0a['odbc_id'])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x45cb0a,_0x8c81('0xcd'));}var _0x1278f8=this[_0x8c81('0xce')][_0x8c81('0x6c')](this,_0x45cb0a[_0x8c81('0xcf')]);if(!_0x1278f8){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x45cb0a,_0x8c81('0xd0'));}if(!this['isConfigured'](_0x45cb0a[_0x8c81('0x2c')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x45cb0a,_0x8c81('0xd1'));}var _0x4f962b=_0x45cb0a[_0x8c81('0x2c')][_0x8c81('0xd2')](/(\r\n|\n|\r)/gm,'\x20');this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')]('query:\x20%s',_0x4f962b));var _0x973fbd=this[_0x8c81('0xd3')]['sync'](this,_0x1278f8,_0x4f962b);this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x45cb0a,_0x4f962b);if(!this['isConfigured'](_0x45cb0a[_0x8c81('0xd4')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0xd5'));}var _0x4e7221=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x45cb0a['variable_id']);if(!_0x4e7221){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x45cb0a,_0x8c81('0xd6'));}var _0x31c1f9=this;_0x973fbd[_0x8c81('0xd7')](function(_0x5185b2,_0x3f4d52){Object[_0x8c81('0xd8')](_0x5185b2)[_0x8c81('0xd7')](function(_0x4d6c68){_0x31c1f9[_0x8c81('0xf')]['setVariable'](util[_0x8c81('0x27')]('%s[%s][%s]',_0x4e7221,_0x3f4d52,_0x4d6c68),_0x5185b2[_0x4d6c68]);});});this[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0xd9'),_0x4e7221),_0x973fbd[_0x8c81('0x99')]);return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xda'),_0x4e7221));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xdb')]=function(_0x1cdd2d){logger[_0x8c81('0xdc')](util[_0x8c81('0x27')](_0x8c81('0xdd'),_0x1cdd2d[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x1cdd2d[_0x8c81('0xde')])){return this['channel'][_0x8c81('0x29')](_0x1cdd2d,_0x8c81('0xdf'));}var _0x58543d=this[_0x8c81('0xe0')][_0x8c81('0x6c')](this,_0x1cdd2d[_0x8c81('0xde')]);if(!_0x58543d){return this['channel'][_0x8c81('0x29')](_0x1cdd2d,_0x8c81('0xe1'));}var _0x5e589b=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0xe2'),[util[_0x8c81('0x27')](_0x8c81('0xe3'),_0x58543d),_0x1cdd2d[_0x8c81('0x61')],_0x1cdd2d[_0x8c81('0xe4')],_0x1cdd2d[_0x8c81('0x60')]]);if(_0x5e589b[_0x8c81('0xa2')]===-0x1){return _0x5e589b;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xe5'),'DIAL'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xe6')]=function(_0x1d5121){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0xe7'),_0x1d5121['label']));if(!this['isConfigured'](_0x1d5121[_0x8c81('0x74')])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0xe8'));}if(!this[_0x8c81('0x81')](_0x1d5121[_0x8c81('0x58')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20text\x20configured');}this[_0x8c81('0xf')][_0x8c81('0xe9')]=!![];this[_0x8c81('0x32')](_0x1d5121);this[_0x8c81('0x40')](_0x1d5121[_0x8c81('0x58')],'in','','');this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0xea'),_0x1d5121[_0x8c81('0x58')]));var _0x24166d=this[_0x8c81('0x73')][_0x8c81('0x6c')](this,_0x1d5121);if(_0x24166d){for(var _0x1ef06c in _0x24166d){if(_0x24166d[_0x8c81('0x93')](_0x1ef06c)){this['channel'][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0xeb'),_0x1ef06c[_0x8c81('0x66')]()),_0x24166d[_0x1ef06c]);}}this[_0x8c81('0x40')](_0x24166d[_0x8c81('0xec')],_0x8c81('0xed'),_0x8c81('0xe6'),'');return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0xee'),_0x24166d[_0x8c81('0xec')]));}return this['channel'][_0x8c81('0x29')](_0x1d5121,_0x8c81('0xef'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xf0')]=function(_0x52b2be){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xf1'),_0x52b2be[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x76')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xf2'));}if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x77')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xf3'));}if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x78')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0xf4'));}if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x79')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xf5'));}if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x58')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20text\x20configured');}this['channel'][_0x8c81('0xe9')]=!![];this[_0x8c81('0x32')](_0x52b2be);this[_0x8c81('0x40')](_0x52b2be[_0x8c81('0x58')],'in','','');this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xf6'),_0x52b2be[_0x8c81('0x58')]));var _0x3243fe=this['googleDialogflowV2'][_0x8c81('0x6c')](this,_0x52b2be);if(_0x3243fe){for(var _0x3fabfa in _0x3243fe){if(_0x3243fe[_0x8c81('0x93')](_0x3fabfa)){if(_0x3fabfa!=='providerResponse'){this[_0x8c81('0xf')]['setVariable'](util[_0x8c81('0x27')](_0x8c81('0xeb'),_0x3fabfa[_0x8c81('0x66')]()),_0x3243fe[_0x3fabfa]);}}}this['createSquareMessage'](_0x3243fe[_0x8c81('0xec')],_0x8c81('0xed'),_0x8c81('0xf0'),_0x3243fe[_0x8c81('0xf7')]);return this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xf8'),_0x3243fe['speech']));}return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x52b2be,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x8c81('0x12')][_0x8c81('0xf9')]=function(_0x262d55){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xfa'),_0x262d55['label']));if(!this[_0x8c81('0x81')](_0x262d55[_0x8c81('0xfb')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x8c81('0x81')](_0x262d55['username'])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xfc'));}if(!this[_0x8c81('0x81')](_0x262d55[_0x8c81('0xfd')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xfe'));}if(!this[_0x8c81('0x81')](_0x262d55[_0x8c81('0xff')])){return this['channel'][_0x8c81('0xa6')]('no\x20text\x20configured');}this[_0x8c81('0xf')][_0x8c81('0xe9')]=!![];this[_0x8c81('0x32')](_0x262d55);this[_0x8c81('0x40')](_0x262d55[_0x8c81('0x58')],'in','','');this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x100'),_0x262d55['text']));var _0xd5c5e6=this[_0x8c81('0x7a')]['sync'](this,_0x262d55);if(_0xd5c5e6){for(var _0x4af755 in _0xd5c5e6){if(_0xd5c5e6[_0x8c81('0x93')](_0x4af755)){this[_0x8c81('0xf')]['setVariable'](util[_0x8c81('0x27')](_0x8c81('0x101'),_0x4af755[_0x8c81('0x66')]()),_0xd5c5e6[_0x4af755]);}}this['createSquareMessage'](_0xd5c5e6[_0x8c81('0xec')],'out',_0x8c81('0xf9'),'');if(_0xd5c5e6[_0x8c81('0x102')]){this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0xd5c5e6[_0x8c81('0x102')]));var _0x407995=this[_0x8c81('0xf')][_0x8c81('0x103')](_0xd5c5e6[_0x8c81('0x102')]);try{fs[_0x8c81('0x104')](_0xd5c5e6[_0x8c81('0x102')]+'.wav');}catch(_0x4be698){logger['error'](_0x4be698);}return _0x407995;}else{return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x105'),_0xd5c5e6[_0x8c81('0xec')]));}}return this[_0x8c81('0xf')]['error'](_0x262d55,_0x8c81('0x106'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x107')]=function(_0x4af7d8){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x108'),_0x4af7d8[_0x8c81('0x34')]));return this[_0x8c81('0xf')]['noop'](_0x8c81('0x107'));};AGIVertices[_0x8c81('0x12')]['ext_dial']=function(_0x41ba3c){logger['info'](util['format'](_0x8c81('0x109'),_0x41ba3c[_0x8c81('0x34')]));var _0xe364d1='';if(_0x41ba3c[_0x8c81('0x10a')]){if(!this[_0x8c81('0x81')](_0x41ba3c[_0x8c81('0x10a')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x41ba3c,_0x8c81('0x10b'));}else{var _0x28d85c=parseInt(_0x41ba3c[_0x8c81('0x10a')],0xa);if(isNaN(_0x28d85c)){_0xe364d1=_0x41ba3c[_0x8c81('0x10a')];}else{_0xe364d1=this['getTrunk']['sync'](this,_0x41ba3c[_0x8c81('0x10a')]);if(!_0xe364d1){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x41ba3c,_0x8c81('0x10c'));}}}}else if(_0x41ba3c[_0x8c81('0x10d')]){_0xe364d1=_0x41ba3c['trunk_name'];}else{return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x41ba3c,_0x8c81('0x10b'));}var _0x3636ce=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0xe2'),[util[_0x8c81('0x27')](_0x8c81('0x10e'),_0xe364d1,_0x41ba3c['phone']),_0x41ba3c[_0x8c81('0x61')],_0x41ba3c[_0x8c81('0xe4')],_0x41ba3c[_0x8c81('0x60')]]);if(_0x3636ce[_0x8c81('0xa2')]===-0x1){return _0x3636ce;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('Executed\x20command\x20%s',_0x8c81('0xe2')));};AGIVertices['prototype']['finally']=function(_0x53a6f6){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x53a6f6[_0x8c81('0x34')]));return this[_0x8c81('0xf')][_0x8c81('0xa6')]('finally');};AGIVertices[_0x8c81('0x12')][_0x8c81('0xe')]=function(_0x3459a1){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x10f'),_0x3459a1[_0x8c81('0x34')]));if(_0x3459a1['retry']===0x0){return this['maxRetry'](_0x3459a1);}_0x3459a1[_0x8c81('0x110')]-=0x1;if(!this[_0x8c81('0x81')](_0x3459a1['file_id'])){return this['channel'][_0x8c81('0x29')](_0x3459a1,_0x8c81('0x111'));}var _0x33f865=this['getSound']['sync'](this,_0x3459a1[_0x8c81('0x112')]);if(!_0x33f865){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x3459a1,'no\x20file\x20audio\x20found');}if(!this[_0x8c81('0x81')](_0x3459a1[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x8c81('0xd5'));}var _0x1fa6a3=this[_0x8c81('0xf')]['getData'](_0x33f865,_0x3459a1[_0x8c81('0x113')],_0x3459a1['maxdigit']);var _0x263bfb=_0x1fa6a3['result']?_0x1fa6a3[_0x8c81('0xa2')][_0x8c81('0x49')]():'';logger[_0x8c81('0x2b')](_0x8c81('0x114'),JSON[_0x8c81('0x9d')](_0x1fa6a3));if(_0x1fa6a3[_0x8c81('0xa2')]===-0x1){this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x3459a1,_0x263bfb);return _0x1fa6a3;}else if(_0x1fa6a3[_0x8c81('0xa3')]===_0x8c81('0x61')){_0x1fa6a3[_0x8c81('0xa2')]=_0x263bfb[_0x8c81('0x99')]>=parseInt(_0x3459a1['mindigit'])?'x':'i';}else{_0x1fa6a3[_0x8c81('0xa2')]=_0x263bfb[_0x8c81('0x99')]>=parseInt(_0x3459a1[_0x8c81('0x115')])&&_0x263bfb[_0x8c81('0x99')]<=parseInt(_0x3459a1['maxdigit'])?'x':'i';}var _0x5587df=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x3459a1[_0x8c81('0xd4')]);if(!_0x5587df){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x3459a1,_0x8c81('0xd6'));}this[_0x8c81('0xf')]['setVariable'](_0x5587df,_0x263bfb);if(this[_0x8c81('0x81')](_0x3459a1['hiddendigitsnum'])){var _0xd71cc4=parseInt(_0x3459a1[_0x8c81('0x116')],0xa);var _0x2a7a39=rs[_0x8c81('0x117')]({'charset':'*','length':_0xd71cc4});var _0x27b0e6=_0x263bfb['length'];if(_0x27b0e6>0x0){if(_0x27b0e6>_0xd71cc4){this['createSquareDetailsReport'][_0x8c81('0x6c')](this,_0x3459a1,_0x3459a1[_0x8c81('0x118')]==='first'?_0x2a7a39+_0x263bfb[_0x8c81('0x119')](_0xd71cc4):_0x263bfb[_0x8c81('0x119')](0x0,_0x27b0e6-_0xd71cc4)+_0x2a7a39);}else{this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x3459a1,rs[_0x8c81('0x117')]({'charset':'*','length':_0x27b0e6}));}}else{this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x3459a1,'');}}else{this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x3459a1,_0x263bfb);}return _0x1fa6a3;};AGIVertices[_0x8c81('0x12')][_0x8c81('0x11a')]=function(_0x46ae88){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x11b'),_0x46ae88[_0x8c81('0x34')]));return this[_0x8c81('0xe')](_0x46ae88);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x11c')]=function(_0xbbeb50){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x11d'),_0xbbeb50[_0x8c81('0x34')]));this[_0x8c81('0x32')]['sync'](this,_0xbbeb50,_0xbbeb50['goalname']);return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x11e'),_0xbbeb50[_0x8c81('0x11f')]));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x120')]=function(_0x46b98c){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x121'),_0x46b98c[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x46b98c[_0x8c81('0x8a')])||!this[_0x8c81('0x81')](_0x46b98c[_0x8c81('0x84')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x122'));}if(!this[_0x8c81('0x81')](_0x46b98c[_0x8c81('0x58')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x123'),_0x46b98c['text']));var _0x120fea=this['awsPolly'][_0x8c81('0x6c')](this,_0x46b98c);if(_0x120fea){this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x124'),_0x120fea));var _0x236bb5=this[_0x8c81('0xf')][_0x8c81('0x103')](_0x120fea);try{fs[_0x8c81('0x104')](_0x120fea+_0x8c81('0x125'));}catch(_0x3a4f36){logger[_0x8c81('0x29')](_0x3a4f36);}return _0x236bb5;}return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x46b98c,_0x8c81('0x126'));};AGIVertices[_0x8c81('0x12')]['awslex']=function(_0x2f1b04){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x127'),_0x2f1b04[_0x8c81('0x34')]));if(!this['isConfigured'](_0x2f1b04['aws_access_key_id'])||!this[_0x8c81('0x81')](_0x2f1b04[_0x8c81('0x84')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x8c81('0x81')](_0x2f1b04[_0x8c81('0x8c')])){return this['channel']['noop'](_0x8c81('0x128'));}if(!this[_0x8c81('0x81')](_0x2f1b04[_0x8c81('0x58')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0xa7'));}this[_0x8c81('0xf')][_0x8c81('0xe9')]=!![];this['createSquareDetailsReport'](_0x2f1b04);this['createSquareMessage'](_0x2f1b04[_0x8c81('0x58')],'in','','');this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')]('Trying\x20Amazon\x20Lex:\x20%s',_0x2f1b04['text']));var _0x449395=this[_0x8c81('0x89')][_0x8c81('0x6c')](this,_0x2f1b04);if(_0x449395){for(var _0x58daa6 in _0x449395){if(_0x449395['hasOwnProperty'](_0x58daa6)&&_['isString'](_0x449395[_0x58daa6])){this['channel'][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0x129'),_0x58daa6[_0x8c81('0x66')]()),_0x449395[_0x58daa6]);}}if(_[_0x8c81('0x43')](_0x449395[_0x8c81('0x12a')])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0x12b'));}else{this['createSquareMessage'](_0x449395[_0x8c81('0x12a')],_0x8c81('0xed'),_0x8c81('0x12c'),'');return this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x12d'),_0x449395['message']));}}return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x2f1b04,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x8c81('0x12')]['googleasr']=function(_0x6598f0){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x12e'),_0x6598f0[_0x8c81('0x34')],_0x6598f0[_0x8c81('0x61')]));if(!this['isConfigured'](_0x6598f0[_0x8c81('0x74')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xe8'));}var _0x280d0d=_0x8c81('0x12f');var _0x1c1896=util['format'](_0x8c81('0x130'),FILES_PATH,rs[_0x8c81('0x117')](0x4));var _0x360545=util['format'](_0x8c81('0x9b'),_0x1c1896,_0x280d0d);var _0xfb0b44=!![];if(_0x6598f0[_0x8c81('0x131')]==='NOBEEP'){_0xfb0b44=![];}var _0x4b9e5d=this[_0x8c81('0xf')][_0x8c81('0x132')](_0x1c1896,_0x280d0d,_0x6598f0[_0x8c81('0x133')],_0x6598f0[_0x8c81('0x61')],undefined,_0xfb0b44);if(_0x4b9e5d[_0x8c81('0xa2')]!==-0x1){this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x134'),_0x360545));var _0x4bf5c6=this[_0x8c81('0x8d')][_0x8c81('0x6c')](this,_0x6598f0,_0x360545);if(_0x4bf5c6){for(var _0x1a7d63 in _0x4bf5c6){if(_0x4bf5c6[_0x8c81('0x93')](_0x1a7d63)){this['channel'][_0x8c81('0x9c')](util['format'](_0x8c81('0x135'),_0x1a7d63[_0x8c81('0x66')]()),_0x4bf5c6[_0x1a7d63]);}}return this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x136'),JSON[_0x8c81('0x9d')](_0x4bf5c6)));}}return _0x4b9e5d;};AGIVertices['prototype'][_0x8c81('0x137')]=function(_0x20779f){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x138'),_0x20779f[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x20779f[_0x8c81('0x90')])){return this[_0x8c81('0xf')]['noop']('no\x20appid\x20configured');}if(!this[_0x8c81('0x81')](_0x20779f[_0x8c81('0x139')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20appsecret\x20configured');}var _0x598d66='wav';var _0x1b621c=util[_0x8c81('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x8c81('0x117')](0x4));var _0x5a3734=util[_0x8c81('0x27')](_0x8c81('0x9b'),_0x1b621c,_0x598d66);var _0x40c6fa=!![];if(_0x20779f[_0x8c81('0x131')]===_0x8c81('0x13a')){_0x40c6fa=![];}var _0x52dbac=this[_0x8c81('0xf')][_0x8c81('0x132')](_0x1b621c,_0x598d66,_0x20779f[_0x8c81('0x133')],_0x20779f[_0x8c81('0x61')],undefined,_0x40c6fa);if(_0x52dbac[_0x8c81('0xa2')]!==-0x1){this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x13b'),_0x5a3734));var _0x3bbea0=this[_0x8c81('0x8f')][_0x8c81('0x6c')](this,_0x20779f,_0x5a3734);if(_0x3bbea0){for(var _0x474dbb in _0x3bbea0){if(_0x3bbea0[_0x8c81('0x93')](_0x474dbb)){this[_0x8c81('0xf')][_0x8c81('0x9c')](util['format']('TILDE_ASR_%s',_0x474dbb[_0x8c81('0x66')]()),_0x3bbea0[_0x474dbb]);}}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x13c'),JSON[_0x8c81('0x9d')](_0x3bbea0)));}}return _0x52dbac;};AGIVertices['prototype'][_0x8c81('0x13d')]=function(_0x22ce14){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x13e'),_0x22ce14[_0x8c81('0x34')]));return this['channel']['continueAt'](_0x22ce14[_0x8c81('0x3a')],_0x22ce14['extension'],_0x22ce14[_0x8c81('0x3c')]);};AGIVertices['prototype'][_0x8c81('0x13f')]=function(_0x50afad){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x140'),_0x50afad[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x50afad['condition'])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x50afad,_0x8c81('0x141'));}try{var _0x5b79b9=eval(_0x50afad[_0x8c81('0x142')])?_0x8c81('0x143'):_0x8c81('0x144');this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x145'),_0x50afad[_0x8c81('0x142')],_0x5b79b9));return{'code':0xc8,'result':_0x5b79b9};}catch(_0x568d66){return{'code':0xc8,'result':_0x8c81('0x144')};}};AGIVertices[_0x8c81('0x12')][_0x8c81('0x146')]=function(_0x2b85fc){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x147'),_0x2b85fc[_0x8c81('0x34')]));if(!this['isConfigured'](_0x2b85fc[_0x8c81('0x148')])){return this['channel'][_0x8c81('0x29')](_0x2b85fc,_0x8c81('0x149'));}var _0x1d8f2c=this[_0x8c81('0x14a')][_0x8c81('0x6c')](this,_0x2b85fc[_0x8c81('0x148')]);if(!_0x1d8f2c){return this['channel']['error'](_0x2b85fc,'no\x20intervals\x20found');}for(var _0x53d4d7=0x0;_0x53d4d7<_0x1d8f2c[_0x8c81('0x99')];_0x53d4d7+=0x1){var _0x343b31=this[_0x8c81('0xf')]['getVariable'](util['format']('IFTIME(%s?true:false)',_0x1d8f2c[_0x53d4d7]));if(_0x343b31['result']===-0x1){return _0x343b31;}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x14b'),_0x1d8f2c[_0x53d4d7],_0x343b31[_0x8c81('0xa3')]));if(_0x343b31[_0x8c81('0xa3')]===_0x8c81('0x143')){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x14b'),_0x1d8f2c[_0x53d4d7],_0x8c81('0x143')));this[_0x8c81('0xf')]['noop'](util['format'](_0x8c81('0x14b'),_0x1d8f2c[_0x53d4d7],_0x8c81('0x143')));return{'code':0xc8,'result':_0x8c81('0x143')};}else{logger['info'](util[_0x8c81('0x27')]('IFTIME\x20%s\x20%s',_0x1d8f2c[_0x53d4d7],_0x8c81('0x144')));this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x14b'),_0x1d8f2c[_0x53d4d7],'false'));}}return{'code':0xc8,'result':_0x8c81('0x144')};};AGIVertices[_0x8c81('0x12')][_0x8c81('0x14c')]=function(_0x135af4){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x14d'),_0x135af4[_0x8c81('0x34')]));return this[_0x8c81('0xf')][_0x8c81('0x14c')]();};AGIVertices[_0x8c81('0x12')][_0x8c81('0x14e')]=function(_0x49df03){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x14f'),_0x49df03[_0x8c81('0x34')]));if(!this['isConfigured'](_0x49df03['key'])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0xe8'));}var _0x5f380b=_0x8c81('0x12f');var _0x43dd88=util['format'](_0x8c81('0x130'),FILES_PATH,rs[_0x8c81('0x117')](0x4));var _0x3dd6ed=util['format']('%s.%s',_0x43dd88,_0x5f380b);var _0x1df8af=!![];if(_0x49df03[_0x8c81('0x131')]===_0x8c81('0x13a')){_0x1df8af=![];}var _0x29148d=this['channel'][_0x8c81('0x132')](_0x43dd88,_0x5f380b,_0x49df03[_0x8c81('0x133')],_0x49df03['timeout'],undefined,_0x1df8af);if(_0x29148d[_0x8c81('0xa2')]!==-0x1){this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x150'),_0x3dd6ed));var _0x2f91e7=this[_0x8c81('0x7e')][_0x8c81('0x6c')](this,_0x49df03,_0x3dd6ed);if(_0x2f91e7){for(var _0x8eb411 in _0x2f91e7){if(_0x2f91e7[_0x8c81('0x93')](_0x8eb411)){this[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0x151'),_0x8eb411[_0x8c81('0x66')]()),_0x2f91e7[_0x8eb411]);}}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x152'),JSON['stringify'](_0x2f91e7)));}}return _0x29148d;};AGIVertices['prototype'][_0x8c81('0x153')]=function(_0xe87c0b){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x154'),_0xe87c0b[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0xe87c0b[_0x8c81('0x74')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xe8'));}if(!this[_0x8c81('0x81')](_0xe87c0b['text'])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xa7'));}this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x155'),_0xe87c0b['text']));var _0xcc4bb1=this[_0x8c81('0x7b')][_0x8c81('0x6c')](this,_0xe87c0b);if(_0xcc4bb1){this['channel']['noop'](util[_0x8c81('0x27')](_0x8c81('0x150'),_0xcc4bb1));var _0x5955e3=this[_0x8c81('0xf')][_0x8c81('0x103')](_0xcc4bb1,_0xe87c0b[_0x8c81('0x133')]);try{fs['unlink'](_0xcc4bb1+_0x8c81('0x125'));}catch(_0x26d53d){logger[_0x8c81('0x29')](_0x26d53d);}return _0x5955e3;}return this['channel']['error'](_0xe87c0b,_0x8c81('0x156'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x157')]=function(_0x1cbe58){logger['info'](util[_0x8c81('0x27')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x1cbe58['label']));if(!this['isConfigured'](_0x1cbe58[_0x8c81('0x158')])){return this['channel'][_0x8c81('0x29')](_0x1cbe58,_0x8c81('0x159'));}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15a'),this[_0x8c81('0xf')]['callerid'],_0x1cbe58[_0x8c81('0x158')]));var _0x1460c0=this[_0x8c81('0x51')]['sync'](this,_0x1cbe58[_0x8c81('0x158')]);if(_0x1460c0){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')]['callerid'],_0x1cbe58['findBy']));this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1cbe58[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x15c')};}else{logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1cbe58['findBy']));this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x8c81('0x38')],_0x1cbe58['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x8c81('0x15d')]=function(_0x549874){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x15e'),_0x549874['label']));if(!this[_0x8c81('0x81')](_0x549874['findBy'])){return this[_0x8c81('0xf')]['error'](_0x549874,_0x8c81('0x159'));}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15a'),this[_0x8c81('0xf')]['callerid'],_0x549874['findBy']));var _0x5a046a=this[_0x8c81('0x50')][_0x8c81('0x6c')](this,_0x549874[_0x8c81('0x158')]);if(_0x5a046a){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0x549874[_0x8c81('0x158')]));this['channel'][_0x8c81('0xa6')](util['format'](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0x549874[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x15c')};}else{logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15f'),this[_0x8c81('0xf')]['callerid'],_0x549874[_0x8c81('0x158')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8c81('0xf')][_0x8c81('0x38')],_0x549874[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x160')};}};AGIVertices[_0x8c81('0x12')]['math']=function(_0x18f4ff){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x161'),_0x18f4ff[_0x8c81('0x34')]));if(!this['isConfigured'](_0x18f4ff[_0x8c81('0x162')])){return this['channel'][_0x8c81('0x29')](_0x18f4ff,_0x8c81('0x163'));}this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')]('math\x20%s',_0x18f4ff[_0x8c81('0x162')]));var _0x42fa37=eval(_0x18f4ff['operation']);if(!this[_0x8c81('0x81')](_0x18f4ff[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xd5'));}var _0x3e86af=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x18f4ff[_0x8c81('0xd4')]);if(!_0x3e86af){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x18f4ff,_0x8c81('0xd6'));}if(_[_0x8c81('0x98')](_0x42fa37)){var _0x3468ec=this;_0x42fa37[_0x8c81('0xd7')](function(_0x45f996,_0x36f4dc){_0x3468ec[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')]('%s[%s]',_0x3e86af,_0x36f4dc),_0x45f996);});return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x164'),_0x3e86af));}else{return this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x3e86af,_0x42fa37);}};AGIVertices[_0x8c81('0x12')][_0x8c81('0xd')]=function(_0x4516f1){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x165'),_0x4516f1[_0x8c81('0x34')]));if(_0x4516f1['retry']===0x0){return this[_0x8c81('0xa4')](_0x4516f1);}_0x4516f1['retry']-=0x1;if(!this['isConfigured'](_0x4516f1['file_id'])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x4516f1,_0x8c81('0x111'));}var _0x417cea=this[_0x8c81('0x1d')][_0x8c81('0x6c')](this,_0x4516f1[_0x8c81('0x112')]);if(!_0x417cea){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x4516f1,_0x8c81('0x166'));}var _0x1292c2=this[_0x8c81('0xf')][_0x8c81('0x167')](_0x417cea,_0x4516f1[_0x8c81('0x113')],_0x4516f1['digit']);var _0x26624f=_0x1292c2[_0x8c81('0xa2')];if(_0x1292c2[_0x8c81('0xa2')]===-0x1){this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x4516f1,'-1');return _0x1292c2;}else if(_0x1292c2[_0x8c81('0xa3')]===_0x8c81('0x61')){_0x1292c2[_0x8c81('0xa2')]=_0x1292c2[_0x8c81('0xa2')][_0x8c81('0x99')]>0x0?_0x1292c2[_0x8c81('0xa2')]:'t';}else if(_['isEmpty'](_0x1292c2[_0x8c81('0xa2')])){_0x1292c2[_0x8c81('0xa2')]='#';_0x26624f='#';}if(!this['isConfigured'](_0x4516f1[_0x8c81('0xd4')])){this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x464a9c=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x4516f1[_0x8c81('0xd4')]);if(!_0x464a9c){return this['channel']['error'](_0x4516f1,'no\x20variable\x20found');}this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x464a9c,_0x26624f);}this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x4516f1,_0x26624f);return _0x1292c2;};AGIVertices[_0x8c81('0x12')][_0x8c81('0xa6')]=function(_0x5a6894){logger[_0x8c81('0x2b')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x5a6894[_0x8c81('0x34')]));return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x5a6894[_0x8c81('0x168')]||_0x5a6894[_0x8c81('0x34')]);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x169')]=function(_0x1d4394){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x16a'),_0x1d4394[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x1d4394[_0x8c81('0x158')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x1d4394,_0x8c81('0x159'));}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1d4394[_0x8c81('0x158')]));var _0x5ac59a=this[_0x8c81('0x4b')]['sync'](this,_0x1d4394[_0x8c81('0x16b')]);var _0xd2e897=this[_0x8c81('0x4e')][_0x8c81('0x6c')](this,_0x1d4394['findBy'],_0x5ac59a);if(_0xd2e897){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')]['callerid'],_0x1d4394[_0x8c81('0x158')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1d4394[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x15c')};}else{logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x15f'),this[_0x8c81('0xf')]['callerid'],_0x1d4394['findBy']));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1d4394['findBy']));return{'code':0xc8,'result':_0x8c81('0x160')};}};AGIVertices[_0x8c81('0x12')][_0x8c81('0x16c')]=function(_0x357694){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x16d'),_0x357694[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x357694[_0x8c81('0x112')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x357694,_0x8c81('0x111'));}var _0x180bd2=this[_0x8c81('0x1d')][_0x8c81('0x6c')](this,_0x357694[_0x8c81('0x112')]);if(!_0x180bd2){return this['channel'][_0x8c81('0x29')](_0x357694,_0x8c81('0x166'));}var _0x197368=this[_0x8c81('0xf')][_0x8c81('0x55')]('PLAYBACK',[_0x180bd2,_0x357694['opts']]);if(_0x197368[_0x8c81('0xa2')]===-0x1){return _0x197368;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x8c81('0x16e'),_0x180bd2));};AGIVertices[_0x8c81('0x12')]['queue']=function(_0xa22de4){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x16f'),_0xa22de4[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0xa22de4[_0x8c81('0x170')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0xa22de4,_0x8c81('0x171'));}var _0x45ee0d='';var _0x463de7=parseInt(_0xa22de4[_0x8c81('0x170')],0xa);if(isNaN(_0x463de7)){_0x45ee0d=_0xa22de4[_0x8c81('0x170')];}else{_0x45ee0d=this['getVoiceQueue'][_0x8c81('0x6c')](this,_0xa22de4[_0x8c81('0x170')]);if(!_0x45ee0d){return this[_0x8c81('0xf')]['error'](_0xa22de4,_0x8c81('0x172'));}}var _0xb2c1df='';if(this[_0x8c81('0x81')](_0xa22de4[_0x8c81('0x112')])){var _0x3c6825=this[_0x8c81('0x1d')][_0x8c81('0x6c')](this,_0xa22de4[_0x8c81('0x112')]);if(_0x3c6825){_0xb2c1df=_0x3c6825;}}this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0xa22de4,_0x45ee0d);if(_0xa22de4[_0x8c81('0xe4')][_0x8c81('0x173')]('x')<0x0){_0xa22de4['opts']+='x';}if(_0xa22de4['opts'][_0x8c81('0x173')]('X')<0x0){_0xa22de4[_0x8c81('0xe4')]+='X';}this[_0x8c81('0xf')]['setVariable'](_0x8c81('0x174'),_0x45ee0d?_0x45ee0d[_0x8c81('0x175')]():'');var _0x215959=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0x176'),[_0x45ee0d,_0xa22de4[_0x8c81('0xe4')],_0xa22de4[_0x8c81('0x60')],_0xb2c1df,_0xa22de4[_0x8c81('0x61')],_0xa22de4[_0x8c81('0x8')],_0xa22de4[_0x8c81('0x177')],_0xa22de4[_0x8c81('0x178')],'',_0xa22de4[_0x8c81('0x179')]]);if(_0x215959['result']===-0x1){return _0x215959;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x8c81('0x176'),_0x45ee0d));};AGIVertices[_0x8c81('0x12')]['record']=function(_0x4b3df1){logger['info'](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x4b3df1['label']));var _0x47a016=_0x4b3df1[_0x8c81('0x17a')]||_0x8c81('0x12f');var _0x1dac99=util['format'](_0x8c81('0x17b'),this[_0x8c81('0xf')][_0x8c81('0x33')],rs['generate'](0x5));var _0x5c5521=util['format'](_0x8c81('0x17c'),FILES_PATH,_0x1dac99,_0x47a016);var _0x5c56a0=util[_0x8c81('0x27')]('%s/recordings/%s',FILES_PATH,_0x1dac99);this[_0x8c81('0x37')][_0x8c81('0x6c')](this,_0x4b3df1,_0x1dac99,_0x5c5521);this['channel'][_0x8c81('0x9c')](_0x8c81('0x17d'),_0x1dac99);logger[_0x8c81('0x2b')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x5c56a0,_0x47a016,_0x4b3df1['escape_digits'],_0x4b3df1[_0x8c81('0x61')]);return this[_0x8c81('0xf')][_0x8c81('0x132')](_0x5c56a0,_0x47a016,_0x4b3df1[_0x8c81('0x17e')],_0x4b3df1[_0x8c81('0x61')],undefined,!![]);};AGIVertices[_0x8c81('0x12')]['restapi']=function(_0x4d04b2){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x17f'),_0x4d04b2[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x4d04b2[_0x8c81('0x60')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0x180'));}var _0x1fba2c=this['restAPI']['sync'](this,_0x4d04b2);logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x181'),util['inspect'](_0x1fba2c,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x4d04b2[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x182'));}var _0x21e98b=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x4d04b2[_0x8c81('0xd4')]);if(!_0x21e98b){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x4d04b2,_0x8c81('0xd6'));}this[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0x183'),_0x21e98b),_0x1fba2c[_0x8c81('0x70')]?_0x1fba2c[_0x8c81('0x70')]:_0x8c81('0x184'));this[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0x185'),_0x21e98b),_0x1fba2c[_0x8c81('0x186')]?_0x1fba2c[_0x8c81('0x186')]:'OK');if(_0x1fba2c[_0x8c81('0x67')]){try{this['saveRestApiResult'](_0x1fba2c[_0x8c81('0x67')],_0x21e98b);}catch(_0x457953){logger[_0x8c81('0x29')](util[_0x8c81('0x27')](_0x8c81('0x187'),_0x21e98b));}}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xda'),_0x21e98b));};AGIVertices['prototype'][_0x8c81('0x188')]=function(_0x593817){logger['info'](util['format'](_0x8c81('0x189'),_0x593817[_0x8c81('0x34')]));return this['channel']['sayDigits'](_0x593817['digits'][_0x8c81('0xd2')](/\s+/g,''),_0x593817['escape_digits']);};AGIVertices[_0x8c81('0x12')]['saynumber']=function(_0x17f6fd){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x18a'),_0x17f6fd[_0x8c81('0x34')]));return this['channel'][_0x8c81('0x18b')](_0x17f6fd[_0x8c81('0x62')][_0x8c81('0xd2')](/\s+/g,''),_0x17f6fd[_0x8c81('0x17e')]);};AGIVertices['prototype']['sayphonetic']=function(_0x278a40){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x18c'),_0x278a40[_0x8c81('0x34')]));return this[_0x8c81('0xf')][_0x8c81('0x18d')](_0x278a40[_0x8c81('0x58')],_0x278a40[_0x8c81('0x17e')]);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x18e')]=function(_0xfd717b){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x18f'),_0xfd717b['label']));if(!this['isConfigured'](_0xfd717b[_0x8c81('0x190')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x191'));}var _0xb67548=this[_0x8c81('0x21')][_0x8c81('0x6c')](this,_0xfd717b[_0x8c81('0x190')]);if(!_0xb67548||!_0xb67548['Smtp']){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0xfd717b,'no\x20mail\x20account\x20found');}var _0x3fd9ef={'from':util[_0x8c81('0x27')](_0x8c81('0x192'),_0xb67548['name'],_0xb67548[_0x8c81('0x193')]||_0xb67548[_0x8c81('0x194')][_0x8c81('0x195')]),'to':_0xfd717b['to']||'','cc':_0xfd717b['cc']||'','bcc':_0xfd717b[_0x8c81('0x196')]||'','subject':_0xfd717b[_0x8c81('0x197')],'html':_0xfd717b[_0x8c81('0x58')],'text':_0xfd717b[_0x8c81('0x58')]};if(this['isConfigured'](_0xfd717b[_0x8c81('0x198')])){}logger['debug'](_0x8c81('0x199'),JSON[_0x8c81('0x9d')](_0x3fd9ef));this[_0x8c81('0x32')]['sync'](this,_0xfd717b,_0xfd717b[_0x8c81('0x190')]);this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x19a'),_0xb67548['name']));this['sendMailMessage']['sync'](this,_0xb67548[_0x8c81('0x19b')],_0x3fd9ef);return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x19c'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x19d')]=function(_0x1224ad){logger['info'](util[_0x8c81('0x27')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x1224ad['label']));return this['channel']['noop'](_0x8c81('0x19e'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x19f')]=function(_0x17c22c){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x1a0'),_0x17c22c[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x17c22c[_0x8c81('0x1a1')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0x1a2'));}var _0x102a31=this[_0x8c81('0x30')][_0x8c81('0x6c')](this,_0x17c22c[_0x8c81('0x1a1')]);if(!_0x102a31){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x17c22c,_0x8c81('0x1a3'));}var _0x59dc3b={'body':_0x17c22c[_0x8c81('0x1a4')],'phone':_0x17c22c['to']||'','SmsAccountId':_0x102a31['id']};logger[_0x8c81('0xdc')](_0x8c81('0x1a5'),JSON['stringify'](_0x59dc3b));this['createSquareDetailsReport']['sync'](this,_0x17c22c,_0x17c22c[_0x8c81('0x1a1')]);this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x1a6'),_0x102a31[_0x8c81('0x14')]));this[_0x8c81('0x31')][_0x8c81('0x6c')](this,_0x59dc3b);return this[_0x8c81('0xf')][_0x8c81('0xa6')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1a7')]=function(_0x2027a6){logger[_0x8c81('0x2b')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x2027a6[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x2027a6[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x2027a6,'no\x20variable\x20selected');}var _0x14050b=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x2027a6[_0x8c81('0xd4')]);if(!_0x14050b){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x2027a6,_0x8c81('0xd6'));}return this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x14050b,_0x2027a6['variable_value']);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1a8')]=function(_0x315899){logger[_0x8c81('0x2b')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x315899[_0x8c81('0x34')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x1a9'));var _0x1e0c67=this[_0x8c81('0xf')][_0x8c81('0xa0')](_0x8c81('0x1aa'));if(!_[_0x8c81('0x42')](_0x1e0c67[_0x8c81('0xa3')])){this[_0x8c81('0xf')][_0x8c81('0x33')]=_0x1e0c67[_0x8c81('0xa3')];}if(_0x315899[_0x8c81('0xb6')]==='yes'){this[_0x8c81('0xf')][_0x8c81('0xa6')]('Answer');return this['channel'][_0x8c81('0xb6')]();}return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x1ab'));};AGIVertices['prototype']['subproject']=function(_0x283abb){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x1ac'),_0x283abb[_0x8c81('0x34')]));if(!this['isConfigured'](_0x283abb[_0x8c81('0x1ad')])){return this['channel'][_0x8c81('0x29')](_0x283abb,_0x8c81('0x1ae'));}var _0x1a3915=this[_0x8c81('0x17')][_0x8c81('0x6c')](this,_0x283abb[_0x8c81('0x1ad')]);if(!this['isConfigured'](_0x1a3915)){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x283abb,util['format'](_0x8c81('0x1af'),_0x283abb[_0x8c81('0x1ad')]));}if(_0x1a3915===this['channel']['arg_1']){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x283abb,_0x8c81('0x1b0'));}this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x283abb,_0x1a3915);var _0x57cfa5=this[_0x8c81('0xf')]['exec'](_0x8c81('0x1b1'),util[_0x8c81('0x27')](_0x8c81('0x1b2'),config['agi']['host']||'127.0.0.1',_0x1a3915,this[_0x8c81('0xf')][_0x8c81('0x36')]));if(_0x57cfa5['result']===-0x1){return _0x57cfa5;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x8c81('0x1b1'),_0x1a3915));};AGIVertices['prototype']['system']=function(_0x284d34){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x1b3'),_0x284d34['label']));var _0x334861=this[_0x8c81('0x54')][_0x8c81('0x6c')](this,_0x284d34[_0x8c81('0xb4')]);this[_0x8c81('0x32')]['sync'](this,_0x284d34,_0x284d34[_0x8c81('0xb4')]);if(this[_0x8c81('0x81')](_0x284d34[_0x8c81('0xd4')])){var _0x4fa1ee=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x284d34['variable_id']);if(_0x4fa1ee){this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x4fa1ee,_0x334861);return this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x284d34['command'],_0x4fa1ee));}}return this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x1b4'),_0x284d34[_0x8c81('0xb4')]));};AGIVertices['prototype'][_0x8c81('0x1b5')]=function(_0x1d0429){logger['info'](util[_0x8c81('0x27')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x1d0429[_0x8c81('0x34')]));_0x1d0429[_0x8c81('0x58')]=_0x1d0429['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8c81('0x81')](_0x1d0429[_0x8c81('0x57')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x1b6'));}if(!this['isConfigured'](_0x1d0429[_0x8c81('0x58')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0xa7'));}this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x1d0429[_0x8c81('0x58')]));var _0x489edc=this[_0x8c81('0x56')][_0x8c81('0x6c')](this,_0x1d0429);if(_0x489edc){this[_0x8c81('0xf')]['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x489edc));var _0xe20d46=this[_0x8c81('0xf')][_0x8c81('0x103')](_0x489edc);try{fs['unlink'](_0x489edc+_0x8c81('0x125'));}catch(_0x41a3d8){logger[_0x8c81('0x29')](_0x41a3d8);}return _0xe20d46;}return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x1d0429,_0x8c81('0x1b7'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1b8')]=function(_0x1b2897){logger['info'](util['format'](_0x8c81('0x1b9'),_0x1b2897['label']));_0x1b2897[_0x8c81('0x58')]=_0x1b2897[_0x8c81('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8c81('0x81')](_0x1b2897[_0x8c81('0x58')])){return this[_0x8c81('0xf')]['noop']('no\x20text\x20configured');}this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x1ba'),_0x1b2897['text']));var _0x6c2163=this[_0x8c81('0x5d')][_0x8c81('0x6c')](this,_0x1b2897);if(_0x6c2163){this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x1bb'),_0x6c2163));var _0x2654ea=this['channel'][_0x8c81('0x103')](_0x6c2163);try{fs['unlink'](_0x6c2163+_0x8c81('0x125'));}catch(_0x2ef1bf){logger[_0x8c81('0x29')](_0x2ef1bf);}return _0x2654ea;}return this['channel'][_0x8c81('0x29')](_0x1b2897,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1bc')]=function(_0xf1ee3f){logger['info'](util['format'](_0x8c81('0x1bd'),_0xf1ee3f[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0xf1ee3f[_0x8c81('0x158')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0xf1ee3f,_0x8c81('0x159'));}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15a'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0xf1ee3f[_0x8c81('0x158')]));var _0x38e220=this[_0x8c81('0x4f')][_0x8c81('0x6c')](this,_0xf1ee3f['findBy']);if(_0x38e220){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0xf1ee3f[_0x8c81('0x158')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0xf1ee3f[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x15c')};}else{logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8c81('0xf')][_0x8c81('0x38')],_0xf1ee3f[_0x8c81('0x158')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x15f'),this[_0x8c81('0xf')]['callerid'],_0xf1ee3f[_0x8c81('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1be')]=function(_0x383114){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x1bf'),_0x383114['label']));var _0xe2fb19=this['channel'][_0x8c81('0x55')](_0x8c81('0x1c0'),[_0x383114[_0x8c81('0x1c1')],_0x383114[_0x8c81('0x72')]]);if(_0xe2fb19[_0x8c81('0xa2')]===-0x1){return _0xe2fb19;}return this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x8c81('0x1c0'),_0x383114['mailbox']));};AGIVertices['prototype']['vswitch']=function(_0x886c43){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x1c2'),_0x886c43[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x886c43[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x886c43,'no\x20variable\x20selected');}var _0x17c9b3=this[_0x8c81('0xa0')]['sync'](this,_0x886c43[_0x8c81('0xd4')]);if(!_0x17c9b3){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x886c43,'no\x20variable\x20found');}var _0x1792fd=this['channel'][_0x8c81('0xa0')](_0x17c9b3);return{'code':0xc8,'result':_0x1792fd[_0x8c81('0xa3')]?_0x1792fd['extra']:'-'};};String[_0x8c81('0x12')][_0x8c81('0x9f')]=function(_0x5557c9,_0x456b58){return this[_0x8c81('0x9e')](_0x5557c9)['join'](_0x456b58);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 3318a47..af46693 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 _0x415a=['all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','info','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','channels','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','agents','getAgent','then','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','YYYY-MM-DD\x20HH:mm:ss','uniqueid','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','[%s][HANGUP:LINKEDID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','syncAgentRingNoAnswer','autopause'];(function(_0x3fdb9f,_0x5d986e){var _0x198ea4=function(_0x3e99cf){while(--_0x3e99cf){_0x3fdb9f['push'](_0x3fdb9f['shift']());}};_0x198ea4(++_0x5d986e);}(_0x415a,0xb2));var _0xa415=function(_0x3d7d28,_0x24c791){_0x3d7d28=_0x3d7d28-0x0;var _0x40d440=_0x415a[_0x3d7d28];return _0x40d440;};'use strict';var _=require(_0xa415('0x0'));var moment=require(_0xa415('0x1'));var ami=require(_0xa415('0x2'));var logger=require(_0xa415('0x3'))(_0xa415('0x4'));var RpcUser=require(_0xa415('0x5'));var RpcVoiceAgentReport=require(_0xa415('0x6'));function Acw(_0x5bb8b4){this[_0xa415('0x7')]=_0x5bb8b4[_0xa415('0x7')];this['agents']=_0x5bb8b4['agents'];this[_0xa415('0x8')]=_0x5bb8b4[_0xa415('0x8')];this['channels']={};ami['on'](_0xa415('0x9'),this[_0xa415('0xa')][_0xa415('0xb')](this));ami['on'](_0xa415('0xc'),this[_0xa415('0xd')][_0xa415('0xb')](this));ami['on'](_0xa415('0xe'),this['syncHangup']['bind'](this));ami['on'](_0xa415('0xf'),this['syncAgentRingNoAnswer'][_0xa415('0xb')](this));ami['on']('attendedtransfer',this[_0xa415('0x10')][_0xa415('0xb')](this));ami['on'](_0xa415('0x11'),this[_0xa415('0x12')][_0xa415('0xb')](this));ami['on'](_0xa415('0x13'),this[_0xa415('0x14')][_0xa415('0xb')](this));}function getDiff(_0x313326){var _0x4313b8=moment()[_0xa415('0x15')](0x0);var _0x15c764=moment(_0x313326)['milliseconds'](0x0);return _0x4313b8[_0xa415('0x16')](_0x15c764,_0xa415('0x17'));}Acw[_0xa415('0x18')][_0xa415('0x19')]=function(_0x47b2bf,_0x31a128){var _0x4d2283=this;var _0x2a8f63=getDiff(_0x4d2283[_0xa415('0x8')][_0x47b2bf][_0xa415('0x1a')]);clearTimeout(_0x4d2283[_0xa415('0x8')][_0x47b2bf][_0xa415('0x1b')]);_0x4d2283['timers'][_0x47b2bf][_0xa415('0x1b')]=![];return RpcVoiceAgentReport[_0xa415('0x1c')]({'acwtime':_0x2a8f63},_0x4d2283[_0xa415('0x8')][_0x47b2bf]['uniqueid'],_0x47b2bf)['then'](function(_0x1b47df){logger[_0xa415('0x1d')]('[%s][UPDATE][ACWTIME:%s]',_0x31a128,_0x2a8f63,_0x1b47df);})[_0xa415('0x1e')](function(_0x3cdd87){logger[_0xa415('0x1f')](_0xa415('0x20'),_0x31a128,_0x3cdd87);})[_0xa415('0x21')](function(){delete _0x4d2283[_0xa415('0x8')][_0x47b2bf];});};Acw[_0xa415('0x18')][_0xa415('0x22')]=function(_0x40a047){try{var _0x5dadcc=this;var _0x1073d3=this[_0xa415('0x23')][_0x40a047][_0xa415('0x24')];var _0x275811=this[_0xa415('0x23')][_0x40a047][_0xa415('0x25')];var _0x4f473d=this[_0xa415('0x7')][_0x275811];var _0x1e8763=![];var _0x5eed51='ACW';if(_0x4f473d[_0xa415('0x26')]&&_0x4f473d[_0xa415('0x27')][_0xa415('0x28')]){_0x1e8763=!![];_0x5eed51=_0x4f473d[_0xa415('0x27')][_0xa415('0x28')];}return ami[_0xa415('0x29')]({'action':_0xa415('0x2a'),'interface':_0x1073d3,'paused':!![],'reason':_0x5eed51})['then'](function(){if(_0x5dadcc[_0xa415('0x2b')][_0x1073d3]){return RpcUser[_0xa415('0x2c')](_0x5dadcc[_0xa415('0x2b')][_0x1073d3]['id'])[_0xa415('0x2d')](function(_0x46f6b1){if(!_0x46f6b1||_0x46f6b1[_0xa415('0x2e')]){logger['info'](_0xa415('0x2f'),_0x40a047,_0x1073d3,_0x275811);return;}logger[_0xa415('0x1d')](_0xa415('0x30'),_0x40a047,_0x1073d3,_0x275811);var _0x5c2e33=_0x5dadcc['channels'][_0x40a047][_0xa415('0x31')]&&_0x5dadcc['channels'][_0x40a047][_0xa415('0x32')]?_0x5dadcc[_0xa415('0x23')][_0x40a047][_0xa415('0x32')]:_0x40a047;return RpcUser[_0xa415('0x33')](_0x5dadcc[_0xa415('0x2b')][_0x1073d3],_0x5eed51,_0x5c2e33)[_0xa415('0x2d')](function(_0x3a1283){_0x5dadcc[_0xa415('0x7')][_0x275811][_0xa415('0x34')]-=0x1;_0x5dadcc[_0xa415('0x7')][_0x275811][_0xa415('0x35')]+=0x1;return _0x3a1283;});})[_0xa415('0x2d')](function(_0x46fea6){if(_0x1e8763||!_0x46fea6){return;}_0x5dadcc[_0xa415('0x8')][_0x1073d3]={};logger['info'](_0xa415('0x36'),_0x40a047,_0x5dadcc[_0xa415('0x7')][_0x275811][_0xa415('0x37')],_0x1073d3,_0x275811);_0x5dadcc[_0xa415('0x8')][_0x1073d3][_0xa415('0x1b')]=setTimeout(_0x5dadcc['stopAcw']['bind'](_0x5dadcc,_0x1073d3),_0x5dadcc[_0xa415('0x7')][_0x275811][_0xa415('0x37')]*0x3e8);_0x5dadcc[_0xa415('0x8')][_0x1073d3][_0xa415('0x1a')]=moment()['format'](_0xa415('0x38'));_0x5dadcc[_0xa415('0x8')][_0x1073d3][_0xa415('0x39')]=_0x40a047;_0x5dadcc[_0xa415('0x8')][_0x1073d3][_0xa415('0x25')]=_0x275811;_0x5dadcc['timers'][_0x1073d3][_0xa415('0x19')]=_0x5dadcc[_0xa415('0x19')][_0xa415('0xb')](_0x5dadcc,_0x1073d3,_0x40a047);});}})[_0xa415('0x1e')](function(){logger[_0xa415('0x1f')](_0xa415('0x36'),_0x40a047,_0x5dadcc['voiceQueues'][_0x275811][_0xa415('0x37')],_0x1073d3,_0x275811);})['finally'](function(){delete _0x5dadcc[_0xa415('0x23')][_0x40a047];});}catch(_0x361cef){logger[_0xa415('0x1f')](_0xa415('0x3a'),_0x361cef[_0xa415('0x3b')]);}};Acw[_0xa415('0x18')]['stopAcw']=function(_0x15f874){try{var _0x5e719d=this;if(_0x5e719d[_0xa415('0x8')][_0x15f874]){_0x5e719d[_0xa415('0x8')][_0x15f874][_0xa415('0x1b')]=![];var _0x1d5ed7=_0x5e719d[_0xa415('0x8')][_0x15f874][_0xa415('0x39')];var _0x54b8ca=_0x5e719d[_0xa415('0x8')][_0x15f874][_0xa415('0x25')];var _0x308c7e=_0x5e719d[_0xa415('0x7')][_0x54b8ca]['acwTimeout'];logger[_0xa415('0x1d')](_0xa415('0x3c'),_0x1d5ed7,_0x15f874);RpcUser[_0xa415('0x2c')](this[_0xa415('0x2b')][_0x15f874]['id'])['then'](function(_0x467c7a){if(_0x467c7a['pauseType']==='ACW'){return RpcUser[_0xa415('0x3d')](_0x5e719d[_0xa415('0x2b')][_0x15f874]);}});RpcVoiceAgentReport[_0xa415('0x1c')]({'acwtime':_0x308c7e,'agentacw':!![]},_0x1d5ed7,_0x15f874)['then'](function(_0x4321be){logger[_0xa415('0x1d')]('[%s][UPDATE][ACWTIME:%s]',_0x1d5ed7,_0x308c7e,_0x4321be);})[_0xa415('0x1e')](function(_0x4eef30){logger[_0xa415('0x1f')](_0xa415('0x20'),_0x1d5ed7,_0x4eef30);});}else{logger[_0xa415('0x1f')](_0xa415('0x3e'),_0x15f874);if(_0x5e719d[_0xa415('0x8')]){logger[_0xa415('0x1d')]('[ACW][TIMERS]',JSON[_0xa415('0x3f')](_0x5e719d['timers']));}}}catch(_0x19cca5){logger[_0xa415('0x1f')](_0xa415('0x40'),_0x19cca5[_0xa415('0x3b')]);}};Acw[_0xa415('0x18')][_0xa415('0xa')]=function(_0x2360e6){try{if(this['voiceQueues'][_0x2360e6[_0xa415('0x25')]]&&(this['voiceQueues'][_0x2360e6[_0xa415('0x25')]]['acw']||this[_0xa415('0x7')][_0x2360e6[_0xa415('0x25')]][_0xa415('0x26')])){if(this[_0xa415('0x2b')][_0x2360e6[_0xa415('0x24')]]){this['channels'][_0x2360e6[_0xa415('0x39')]]={'queue':_0x2360e6[_0xa415('0x25')],'interface':_0x2360e6[_0xa415('0x24')],'destlinkedid':_0x2360e6[_0xa415('0x32')]};}}}catch(_0x108a68){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x108a68[_0xa415('0x3b')]);}};Acw[_0xa415('0x18')][_0xa415('0x14')]=function(_0x51aebb){try{if(this[_0xa415('0x7')][_0x51aebb[_0xa415('0x25')]]&&(this['voiceQueues'][_0x51aebb[_0xa415('0x25')]][_0xa415('0x4')]||this[_0xa415('0x7')][_0x51aebb[_0xa415('0x25')]][_0xa415('0x26')])){if(this[_0xa415('0x2b')][_0x51aebb[_0xa415('0x24')]]){this[_0xa415('0x23')][_0x51aebb[_0xa415('0x39')]]={'queue':_0x51aebb[_0xa415('0x25')],'interface':_0x51aebb[_0xa415('0x24')]};}}}catch(_0x2a2c71){logger[_0xa415('0x1f')](_0xa415('0x41'),_0x2a2c71['message']);}};Acw['prototype'][_0xa415('0xd')]=function(_0x2007a5){try{if(this['channels'][_0x2007a5['uniqueid']]&&_[_0xa415('0x42')](this[_0xa415('0x23')][_0x2007a5[_0xa415('0x39')]][_0xa415('0x31')])){logger[_0xa415('0x1d')](_0xa415('0x43'),_0x2007a5['uniqueid']);this[_0xa415('0x22')](_0x2007a5[_0xa415('0x39')]);}else if(this['channels'][_0x2007a5['linkedid']]&&_[_0xa415('0x42')](this[_0xa415('0x23')][_0x2007a5['linkedid']][_0xa415('0x31')])){logger[_0xa415('0x1d')](_0xa415('0x44'),_0x2007a5['linkedid']);this[_0xa415('0x22')](_0x2007a5[_0xa415('0x45')]);}}catch(_0x51dbd4){logger[_0xa415('0x1f')](_0xa415('0x46'),_0x51dbd4[_0xa415('0x3b')]);}};Acw[_0xa415('0x18')]['syncHangup']=function(_0x367dff){try{if(this['channels'][_0x367dff[_0xa415('0x39')]]&&this[_0xa415('0x23')][_0x367dff[_0xa415('0x39')]][_0xa415('0x31')]){logger[_0xa415('0x1d')](_0xa415('0x47'),_0x367dff[_0xa415('0x39')]);this['startAcw'](_0x367dff[_0xa415('0x39')]);}else if(this[_0xa415('0x23')][_0x367dff[_0xa415('0x45')]]&&this[_0xa415('0x23')][_0x367dff['linkedid']][_0xa415('0x31')]){logger[_0xa415('0x1d')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x367dff[_0xa415('0x45')]);this[_0xa415('0x22')](_0x367dff[_0xa415('0x45')]);}}catch(_0x4e604a){logger[_0xa415('0x1f')]('[ACW][syncHangup]\x20%s',_0x4e604a['message']);}};Acw[_0xa415('0x18')][_0xa415('0x10')]=function(_0x59f427){try{if(!_[_0xa415('0x48')](this[_0xa415('0x23')][_0x59f427[_0xa415('0x49')]])){this[_0xa415('0x22')](_0x59f427[_0xa415('0x49')]);if(this['channels'][_0x59f427[_0xa415('0x4a')]]){this['channels'][_0x59f427[_0xa415('0x4a')]]['attended']=!![];this[_0xa415('0x23')][_0x59f427[_0xa415('0x4b')]]=this[_0xa415('0x23')][_0x59f427[_0xa415('0x4a')]];this[_0xa415('0x4c')](_0x59f427[_0xa415('0x4a')]);}}else if(!_[_0xa415('0x48')](this[_0xa415('0x23')][_0x59f427[_0xa415('0x4b')]])){this['startAcw'](_0x59f427['transfertargetuniqueid']);if(this[_0xa415('0x23')][_0x59f427['origtransfereruniqueid']]){this[_0xa415('0x23')][_0x59f427[_0xa415('0x4d')]][_0xa415('0x31')]=!![];this[_0xa415('0x23')][_0x59f427[_0xa415('0x49')]]=this[_0xa415('0x23')][_0x59f427[_0xa415('0x4d')]];this[_0xa415('0x4c')](_0x59f427['origtransfereruniqueid']);}}}catch(_0x2b9c49){logger[_0xa415('0x1f')](_0xa415('0x4e'),_0x2b9c49[_0xa415('0x3b')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x558143){try{if(this[_0xa415('0x23')][_0x558143['transfereruniqueid']]){logger[_0xa415('0x1d')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x558143[_0xa415('0x4f')]));this[_0xa415('0x22')](_0x558143[_0xa415('0x4f')]);}else if(this[_0xa415('0x23')][_0x558143[_0xa415('0x50')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xa415('0x3f')](_0x558143[_0xa415('0x50')]));this[_0xa415('0x22')](_0x558143[_0xa415('0x50')]);}}catch(_0x5797fb){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x5797fb[_0xa415('0x3b')]);}};Acw[_0xa415('0x18')][_0xa415('0x51')]=function(_0x4609f7){try{if(this[_0xa415('0x7')][_0x4609f7['queue']]&&this['voiceQueues'][_0x4609f7[_0xa415('0x25')]][_0xa415('0x52')]===_0xa415('0x53')){if(this[_0xa415('0x2b')][_0x4609f7[_0xa415('0x24')]]){logger['info'](_0xa415('0x54'),_0x4609f7['uniqueid'],_0x4609f7[_0xa415('0x24')],_0x4609f7[_0xa415('0x25')]);return RpcUser[_0xa415('0x33')](this['agents'][_0x4609f7[_0xa415('0x24')]],'Auto-Pause',_0x4609f7[_0xa415('0x39')]);}}}catch(_0x2054df){logger[_0xa415('0x1f')](_0xa415('0x55'),_0x2054df[_0xa415('0x3b')]);}};Acw['prototype'][_0xa415('0x4c')]=function(_0xacf0c9,_0x13ccdb=0x2710){if(this[_0xa415('0x23')][_0xacf0c9]){setTimeout(()=>{delete this[_0xa415('0x23')][_0xacf0c9];},_0x13ccdb);}};module[_0xa415('0x56')]=Acw; \ No newline at end of file +var _0x32df=['paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','YYYY-MM-DD\x20HH:mm:ss','updateAcw','finally','message','pauseType','saveUnpause','[ACW][TIMERS]','stringify','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','acw','interface','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','../rpc/user','voiceQueues','agents','timers','channels','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','prototype','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','available'];(function(_0x26604b,_0x56d4cc){var _0x16276c=function(_0x34ae98){while(--_0x34ae98){_0x26604b['push'](_0x26604b['shift']());}};_0x16276c(++_0x56d4cc);}(_0x32df,0x7d));var _0xf32d=function(_0x397e8d,_0x532637){_0x397e8d=_0x397e8d-0x0;var _0x173a32=_0x32df[_0x397e8d];return _0x173a32;};'use strict';var _=require(_0xf32d('0x0'));var moment=require(_0xf32d('0x1'));var ami=require(_0xf32d('0x2'));var logger=require(_0xf32d('0x3'))('acw');var RpcUser=require(_0xf32d('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x25997f){this[_0xf32d('0x5')]=_0x25997f[_0xf32d('0x5')];this[_0xf32d('0x6')]=_0x25997f[_0xf32d('0x6')];this[_0xf32d('0x7')]=_0x25997f['timers'];this[_0xf32d('0x8')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xf32d('0x9')](this));ami['on'](_0xf32d('0xa'),this[_0xf32d('0xb')][_0xf32d('0x9')](this));ami['on'](_0xf32d('0xc'),this[_0xf32d('0xd')][_0xf32d('0x9')](this));ami['on'](_0xf32d('0xe'),this[_0xf32d('0xf')][_0xf32d('0x9')](this));ami['on'](_0xf32d('0x10'),this[_0xf32d('0x11')][_0xf32d('0x9')](this));ami['on'](_0xf32d('0x12'),this[_0xf32d('0x13')][_0xf32d('0x9')](this));ami['on']('custom:agentConnectPreview',this[_0xf32d('0x14')][_0xf32d('0x9')](this));}function getDiff(_0x2a9dac){var _0x5552ec=moment()[_0xf32d('0x15')](0x0);var _0x145380=moment(_0x2a9dac)[_0xf32d('0x15')](0x0);return _0x5552ec[_0xf32d('0x16')](_0x145380,'seconds');}Acw[_0xf32d('0x17')]['updateAcw']=function(_0x5b82f4,_0x1f56b3){var _0x238ceb=this;var _0x290fd3=getDiff(_0x238ceb[_0xf32d('0x7')][_0x5b82f4][_0xf32d('0x18')]);clearTimeout(_0x238ceb[_0xf32d('0x7')][_0x5b82f4][_0xf32d('0x19')]);_0x238ceb[_0xf32d('0x7')][_0x5b82f4][_0xf32d('0x19')]=![];return RpcVoiceAgentReport[_0xf32d('0x1a')]({'acwtime':_0x290fd3},_0x238ceb['timers'][_0x5b82f4][_0xf32d('0x1b')],_0x5b82f4)[_0xf32d('0x1c')](function(_0x440418){logger[_0xf32d('0x1d')](_0xf32d('0x1e'),_0x1f56b3,_0x290fd3,_0x440418);})[_0xf32d('0x1f')](function(_0x2bf764){logger[_0xf32d('0x20')](_0xf32d('0x21'),_0x1f56b3,_0x2bf764);})['finally'](function(){delete _0x238ceb[_0xf32d('0x7')][_0x5b82f4];});};Acw[_0xf32d('0x17')][_0xf32d('0x22')]=function(_0x28d12d){try{var _0x311b5a=this;var _0x2a11b3=this[_0xf32d('0x8')][_0x28d12d]['interface'];var _0x16dee5=this['channels'][_0x28d12d][_0xf32d('0x23')];var _0x3e9aab=this['voiceQueues'][_0x16dee5];var _0x149968=![];var _0x5690ce=_0xf32d('0x24');if(_0x3e9aab[_0xf32d('0x25')]&&_0x3e9aab[_0xf32d('0x26')][_0xf32d('0x27')]){_0x149968=!![];_0x5690ce=_0x3e9aab[_0xf32d('0x26')][_0xf32d('0x27')];}return ami['Action']({'action':_0xf32d('0x28'),'interface':_0x2a11b3,'paused':!![],'reason':_0x5690ce})['then'](function(){if(_0x311b5a[_0xf32d('0x6')][_0x2a11b3]){return RpcUser[_0xf32d('0x29')](_0x311b5a[_0xf32d('0x6')][_0x2a11b3]['id'])[_0xf32d('0x1c')](function(_0x402635){if(!_0x402635||_0x402635[_0xf32d('0x2a')]){logger[_0xf32d('0x1d')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x28d12d,_0x2a11b3,_0x16dee5);return;}logger['info'](_0xf32d('0x2b'),_0x28d12d,_0x2a11b3,_0x16dee5);var _0x26d8e1=_0x311b5a[_0xf32d('0x8')][_0x28d12d][_0xf32d('0x2c')]&&_0x311b5a['channels'][_0x28d12d][_0xf32d('0x2d')]?_0x311b5a[_0xf32d('0x8')][_0x28d12d]['destlinkedid']:_0x28d12d;return RpcUser['savePause'](_0x311b5a[_0xf32d('0x6')][_0x2a11b3],_0x5690ce,_0x26d8e1)[_0xf32d('0x1c')](function(_0xccbfcd){_0x311b5a[_0xf32d('0x5')][_0x16dee5][_0xf32d('0x2e')]-=0x1;_0x311b5a[_0xf32d('0x5')][_0x16dee5][_0xf32d('0x2f')]+=0x1;return _0xccbfcd;});})[_0xf32d('0x1c')](function(_0x298b6c){if(_0x149968||!_0x298b6c){return;}_0x311b5a[_0xf32d('0x7')][_0x2a11b3]={};logger['info'](_0xf32d('0x30'),_0x28d12d,_0x311b5a[_0xf32d('0x5')][_0x16dee5]['acwTimeout'],_0x2a11b3,_0x16dee5);_0x311b5a['timers'][_0x2a11b3][_0xf32d('0x19')]=setTimeout(_0x311b5a[_0xf32d('0x31')][_0xf32d('0x9')](_0x311b5a,_0x2a11b3),_0x311b5a[_0xf32d('0x5')][_0x16dee5][_0xf32d('0x32')]*0x3e8);_0x311b5a[_0xf32d('0x7')][_0x2a11b3][_0xf32d('0x18')]=moment()['format'](_0xf32d('0x33'));_0x311b5a[_0xf32d('0x7')][_0x2a11b3]['uniqueid']=_0x28d12d;_0x311b5a[_0xf32d('0x7')][_0x2a11b3][_0xf32d('0x23')]=_0x16dee5;_0x311b5a[_0xf32d('0x7')][_0x2a11b3][_0xf32d('0x34')]=_0x311b5a[_0xf32d('0x34')][_0xf32d('0x9')](_0x311b5a,_0x2a11b3,_0x28d12d);});}})[_0xf32d('0x1f')](function(){logger[_0xf32d('0x20')](_0xf32d('0x30'),_0x28d12d,_0x311b5a[_0xf32d('0x5')][_0x16dee5]['acwTimeout'],_0x2a11b3,_0x16dee5);})[_0xf32d('0x35')](function(){delete _0x311b5a[_0xf32d('0x8')][_0x28d12d];});}catch(_0xb7528c){logger['error']('[ACW][START]\x20%s',_0xb7528c[_0xf32d('0x36')]);}};Acw[_0xf32d('0x17')][_0xf32d('0x31')]=function(_0x23ce7f){try{var _0x97bc21=this;if(_0x97bc21[_0xf32d('0x7')][_0x23ce7f]){_0x97bc21[_0xf32d('0x7')][_0x23ce7f][_0xf32d('0x19')]=![];var _0x180a81=_0x97bc21[_0xf32d('0x7')][_0x23ce7f]['uniqueid'];var _0x4f3fa9=_0x97bc21[_0xf32d('0x7')][_0x23ce7f]['queue'];var _0x17ebb0=_0x97bc21['voiceQueues'][_0x4f3fa9][_0xf32d('0x32')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x180a81,_0x23ce7f);RpcUser[_0xf32d('0x29')](this[_0xf32d('0x6')][_0x23ce7f]['id'])[_0xf32d('0x1c')](function(_0x49e40a){if(_0x49e40a[_0xf32d('0x37')]==='ACW'){return RpcUser[_0xf32d('0x38')](_0x97bc21['agents'][_0x23ce7f]);}});RpcVoiceAgentReport[_0xf32d('0x1a')]({'acwtime':_0x17ebb0,'agentacw':!![]},_0x180a81,_0x23ce7f)[_0xf32d('0x1c')](function(_0x4d9bfd){logger[_0xf32d('0x1d')](_0xf32d('0x1e'),_0x180a81,_0x17ebb0,_0x4d9bfd);})[_0xf32d('0x1f')](function(_0x1fa995){logger[_0xf32d('0x20')](_0xf32d('0x21'),_0x180a81,_0x1fa995);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x23ce7f);if(_0x97bc21[_0xf32d('0x7')]){logger[_0xf32d('0x1d')](_0xf32d('0x39'),JSON[_0xf32d('0x3a')](_0x97bc21[_0xf32d('0x7')]));}}}catch(_0x223b7a){logger['error']('[ACW][STOP]\x20%s',_0x223b7a['message']);}};Acw[_0xf32d('0x17')][_0xf32d('0x3b')]=function(_0x6b52fb){try{if(this[_0xf32d('0x5')][_0x6b52fb['queue']]&&(this[_0xf32d('0x5')][_0x6b52fb[_0xf32d('0x23')]]['acw']||this[_0xf32d('0x5')][_0x6b52fb[_0xf32d('0x23')]][_0xf32d('0x25')])){if(this['agents'][_0x6b52fb['interface']]){this['channels'][_0x6b52fb[_0xf32d('0x1b')]]={'queue':_0x6b52fb[_0xf32d('0x23')],'interface':_0x6b52fb['interface'],'destlinkedid':_0x6b52fb[_0xf32d('0x2d')]};}}}catch(_0x2c1bf6){logger[_0xf32d('0x20')](_0xf32d('0x3c'),_0x2c1bf6[_0xf32d('0x36')]);}};Acw[_0xf32d('0x17')][_0xf32d('0x14')]=function(_0x5c9ff){try{if(this['voiceQueues'][_0x5c9ff[_0xf32d('0x23')]]&&(this[_0xf32d('0x5')][_0x5c9ff[_0xf32d('0x23')]][_0xf32d('0x3d')]||this['voiceQueues'][_0x5c9ff[_0xf32d('0x23')]][_0xf32d('0x25')])){if(this[_0xf32d('0x6')][_0x5c9ff['interface']]){this[_0xf32d('0x8')][_0x5c9ff['uniqueid']]={'queue':_0x5c9ff[_0xf32d('0x23')],'interface':_0x5c9ff[_0xf32d('0x3e')]};}}}catch(_0x403b00){logger[_0xf32d('0x20')]('[ACW][syncAgentConnectPreview]\x20%s',_0x403b00[_0xf32d('0x36')]);}};Acw[_0xf32d('0x17')][_0xf32d('0xb')]=function(_0x5aa1c6){try{if(this['channels'][_0x5aa1c6[_0xf32d('0x1b')]]&&_['isUndefined'](this[_0xf32d('0x8')][_0x5aa1c6[_0xf32d('0x1b')]]['attended'])){logger[_0xf32d('0x1d')](_0xf32d('0x3f'),_0x5aa1c6[_0xf32d('0x1b')]);this[_0xf32d('0x22')](_0x5aa1c6[_0xf32d('0x1b')]);}else if(this[_0xf32d('0x8')][_0x5aa1c6[_0xf32d('0x40')]]&&_[_0xf32d('0x41')](this[_0xf32d('0x8')][_0x5aa1c6[_0xf32d('0x40')]][_0xf32d('0x2c')])){logger[_0xf32d('0x1d')](_0xf32d('0x42'),_0x5aa1c6[_0xf32d('0x40')]);this[_0xf32d('0x22')](_0x5aa1c6['linkedid']);}}catch(_0x2c76cb){logger[_0xf32d('0x20')]('[ACW][syncHangupRequest]\x20%s',_0x2c76cb[_0xf32d('0x36')]);}};Acw[_0xf32d('0x17')][_0xf32d('0xd')]=function(_0x26e2d8){try{if(this[_0xf32d('0x8')][_0x26e2d8['uniqueid']]&&this[_0xf32d('0x8')][_0x26e2d8[_0xf32d('0x1b')]][_0xf32d('0x2c')]){logger[_0xf32d('0x1d')](_0xf32d('0x43'),_0x26e2d8['uniqueid']);this[_0xf32d('0x22')](_0x26e2d8[_0xf32d('0x1b')]);}else if(this[_0xf32d('0x8')][_0x26e2d8[_0xf32d('0x40')]]&&this['channels'][_0x26e2d8[_0xf32d('0x40')]]['attended']){logger[_0xf32d('0x1d')](_0xf32d('0x44'),_0x26e2d8['linkedid']);this[_0xf32d('0x22')](_0x26e2d8['linkedid']);}}catch(_0x29f0c3){logger['error'](_0xf32d('0x45'),_0x29f0c3[_0xf32d('0x36')]);}};Acw[_0xf32d('0x17')]['syncAttendedTransfer']=function(_0xbc646a){try{if(!_['isNil'](this[_0xf32d('0x8')][_0xbc646a['transfereeuniqueid']])){this['startAcw'](_0xbc646a[_0xf32d('0x46')]);if(this['channels'][_0xbc646a[_0xf32d('0x47')]]){this[_0xf32d('0x8')][_0xbc646a['secondtransfereruniqueid']][_0xf32d('0x2c')]=!![];this[_0xf32d('0x8')][_0xbc646a[_0xf32d('0x48')]]=this[_0xf32d('0x8')][_0xbc646a['secondtransfereruniqueid']];this[_0xf32d('0x49')](_0xbc646a[_0xf32d('0x47')]);}}else if(!_[_0xf32d('0x4a')](this[_0xf32d('0x8')][_0xbc646a[_0xf32d('0x48')]])){this[_0xf32d('0x22')](_0xbc646a[_0xf32d('0x48')]);if(this[_0xf32d('0x8')][_0xbc646a[_0xf32d('0x4b')]]){this[_0xf32d('0x8')][_0xbc646a[_0xf32d('0x4b')]][_0xf32d('0x2c')]=!![];this[_0xf32d('0x8')][_0xbc646a['transfereeuniqueid']]=this[_0xf32d('0x8')][_0xbc646a[_0xf32d('0x4b')]];this[_0xf32d('0x49')](_0xbc646a[_0xf32d('0x4b')]);}}}catch(_0xc08d0d){logger['error'](_0xf32d('0x4c'),_0xc08d0d[_0xf32d('0x36')]);}};Acw[_0xf32d('0x17')][_0xf32d('0x13')]=function(_0x233f79){try{if(this[_0xf32d('0x8')][_0x233f79['transfereruniqueid']]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xf32d('0x3a')](_0x233f79['transfereruniqueid']));this[_0xf32d('0x22')](_0x233f79[_0xf32d('0x4d')]);}else if(this[_0xf32d('0x8')][_0x233f79[_0xf32d('0x4e')]]){logger[_0xf32d('0x1d')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xf32d('0x3a')](_0x233f79[_0xf32d('0x4e')]));this[_0xf32d('0x22')](_0x233f79[_0xf32d('0x4e')]);}}catch(_0x5b1bce){logger[_0xf32d('0x20')](_0xf32d('0x4f'),_0x5b1bce[_0xf32d('0x36')]);}};Acw[_0xf32d('0x17')]['syncAgentRingNoAnswer']=function(_0xb64208){try{if(this[_0xf32d('0x5')][_0xb64208[_0xf32d('0x23')]]&&this[_0xf32d('0x5')][_0xb64208[_0xf32d('0x23')]][_0xf32d('0x50')]===_0xf32d('0x51')){if(this[_0xf32d('0x6')][_0xb64208[_0xf32d('0x3e')]]){logger[_0xf32d('0x1d')](_0xf32d('0x52'),_0xb64208[_0xf32d('0x1b')],_0xb64208[_0xf32d('0x3e')],_0xb64208['queue']);return RpcUser[_0xf32d('0x53')](this[_0xf32d('0x6')][_0xb64208[_0xf32d('0x3e')]],'Auto-Pause',_0xb64208['uniqueid']);}}}catch(_0x1b1159){logger[_0xf32d('0x20')](_0xf32d('0x54'),_0x1b1159['message']);}};Acw[_0xf32d('0x17')][_0xf32d('0x49')]=function(_0x3b7ebd,_0x1be09a=0x2710){if(this[_0xf32d('0x8')][_0x3b7ebd]){setTimeout(()=>{delete this[_0xf32d('0x8')][_0x3b7ebd];},_0x1be09a);}};module[_0xf32d('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 17b5074..5a6bc3a 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 _0x7e73=['close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','[ami.js][fullybooted]','exports','asterisk-manager','util','ami','../../config/environment','port','asterisk','username','password','keepConnected','Action','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','actionDeviceStateList','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once'];(function(_0x54ab02,_0x362f8e){var _0x1d5f24=function(_0x216b4f){while(--_0x216b4f){_0x54ab02['push'](_0x54ab02['shift']());}};_0x1d5f24(++_0x362f8e);}(_0x7e73,0x1a2));var _0x37e7=function(_0x30a89a,_0x5d4e8f){_0x30a89a=_0x30a89a-0x0;var _0x995bc9=_0x7e73[_0x30a89a];return _0x995bc9;};'use strict';var Manager=require(_0x37e7('0x0'));var BPromise=require('bluebird');var util=require(_0x37e7('0x1'));var logger=require('../../config/logger')(_0x37e7('0x2'));var config=require(_0x37e7('0x3'));var ami=new Manager(config['asterisk'][_0x37e7('0x4')],config[_0x37e7('0x5')]['ip'],config[_0x37e7('0x5')][_0x37e7('0x6')],config[_0x37e7('0x5')][_0x37e7('0x7')],!![]);ami[_0x37e7('0x8')]();ami[_0x37e7('0x9')]=BPromise['promisify'](ami['action']);function error(_0x3c25dc){logger[_0x37e7('0xa')](util[_0x37e7('0xb')](_0x37e7('0xc'),config['asterisk']['username'],config[_0x37e7('0x5')]['ip'],config[_0x37e7('0x5')][_0x37e7('0x4')],util[_0x37e7('0xd')](_0x3c25dc,![],null)));}function close(){logger[_0x37e7('0xa')](util[_0x37e7('0xb')](_0x37e7('0xe'),config['asterisk'][_0x37e7('0x6')],config[_0x37e7('0x5')]['ip'],config[_0x37e7('0x5')][_0x37e7('0x4')]));}ami[_0x37e7('0xf')]=function(){return function(){return ami[_0x37e7('0x9')]({'action':'sipshowregistry'});};};ami[_0x37e7('0x10')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x37e7('0x11')]=function(){return function(){return ami[_0x37e7('0x9')]({'action':'sippeerstatus'});};};ami[_0x37e7('0x12')]=function(){return function(){return ami[_0x37e7('0x9')]({'action':_0x37e7('0x13')});};};ami[_0x37e7('0x14')]=function(){return function(){return ami[_0x37e7('0x9')]({'action':_0x37e7('0x15')});};};function connect(){logger[_0x37e7('0x16')](util[_0x37e7('0xb')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x37e7('0x5')][_0x37e7('0x6')],config[_0x37e7('0x5')]['ip'],config['asterisk'][_0x37e7('0x4')]));ami['once'](_0x37e7('0xa'),error);ami[_0x37e7('0x17')](_0x37e7('0x18'),close);}ami['on'](_0x37e7('0x19'),connect);ami['on'](_0x37e7('0x1a'),function(_0xc40719){logger[_0x37e7('0x16')](util[_0x37e7('0xb')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x37e7('0x5')]['username'],config[_0x37e7('0x5')]['ip'],config[_0x37e7('0x5')][_0x37e7('0x4')],util[_0x37e7('0xd')](_0xc40719,![],null)));});ami['on'](_0x37e7('0x1b'),function(){logger['info'](util[_0x37e7('0xb')](_0x37e7('0x1c'),config[_0x37e7('0x5')][_0x37e7('0x6')],config[_0x37e7('0x5')]['ip'],config[_0x37e7('0x5')]['port']));return Promise[_0x37e7('0x1d')]()[_0x37e7('0x1e')](ami[_0x37e7('0xf')]())['then'](ami[_0x37e7('0x10')]())[_0x37e7('0x1e')](ami[_0x37e7('0x11')]())['then'](ami[_0x37e7('0x12')]())[_0x37e7('0x1e')](ami['actionCoreShowChannels']())[_0x37e7('0x1f')](function(_0x26bc82){logger[_0x37e7('0xa')](_0x37e7('0x20'),util[_0x37e7('0xd')](_0x26bc82,{'showHidden':![],'depth':null}));});});ami[_0x37e7('0x17')](_0x37e7('0xa'),error);ami[_0x37e7('0x17')](_0x37e7('0x18'),close);module[_0x37e7('0x21')]=ami; \ No newline at end of file +var _0x6456=['format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','close','connect','shutdown','then','asterisk-manager','bluebird','util','ami','../../config/environment','asterisk','port','password','keepConnected','Action','promisify','action'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0x6456,0x13e));var _0x6645=function(_0x251208,_0x2ff516){_0x251208=_0x251208-0x0;var _0x284965=_0x6456[_0x251208];return _0x284965;};'use strict';var Manager=require(_0x6645('0x0'));var BPromise=require(_0x6645('0x1'));var util=require(_0x6645('0x2'));var logger=require('../../config/logger')(_0x6645('0x3'));var config=require(_0x6645('0x4'));var ami=new Manager(config[_0x6645('0x5')][_0x6645('0x6')],config[_0x6645('0x5')]['ip'],config['asterisk']['username'],config[_0x6645('0x5')][_0x6645('0x7')],!![]);ami[_0x6645('0x8')]();ami[_0x6645('0x9')]=BPromise[_0x6645('0xa')](ami[_0x6645('0xb')]);function error(_0xfcf7e9){logger['error'](util[_0x6645('0xc')](_0x6645('0xd'),config[_0x6645('0x5')][_0x6645('0xe')],config[_0x6645('0x5')]['ip'],config[_0x6645('0x5')][_0x6645('0x6')],util[_0x6645('0xf')](_0xfcf7e9,![],null)));}function close(){logger[_0x6645('0x10')](util[_0x6645('0xc')](_0x6645('0x11'),config[_0x6645('0x5')][_0x6645('0xe')],config[_0x6645('0x5')]['ip'],config[_0x6645('0x5')]['port']));}ami[_0x6645('0x12')]=function(){return function(){return ami[_0x6645('0x9')]({'action':_0x6645('0x13')});};};ami[_0x6645('0x14')]=function(){return function(){return ami[_0x6645('0x9')]({'action':_0x6645('0x15')});};};ami[_0x6645('0x16')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0x6645('0x17')]=function(){return function(){return ami[_0x6645('0x9')]({'action':_0x6645('0x18')});};};ami[_0x6645('0x19')]=function(){return function(){return ami[_0x6645('0x9')]({'action':_0x6645('0x1a')});};};function connect(){logger[_0x6645('0x1b')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x6645('0x5')][_0x6645('0xe')],config[_0x6645('0x5')]['ip'],config[_0x6645('0x5')][_0x6645('0x6')]));ami['once']('error',error);ami[_0x6645('0x1c')](_0x6645('0x1d'),close);}ami['on'](_0x6645('0x1e'),connect);ami['on'](_0x6645('0x1f'),function(_0x4682db){logger[_0x6645('0x1b')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x6645('0xe')],config[_0x6645('0x5')]['ip'],config[_0x6645('0x5')][_0x6645('0x6')],util[_0x6645('0xf')](_0x4682db,![],null)));});ami['on']('fullybooted',function(){logger[_0x6645('0x1b')](util[_0x6645('0xc')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x6645('0x5')]['username'],config['asterisk']['ip'],config[_0x6645('0x5')][_0x6645('0x6')]));return Promise['resolve']()[_0x6645('0x20')](ami['actionSipShowRegistry']())['then'](ami['actionDeviceStateList']())[_0x6645('0x20')](ami[_0x6645('0x16')]())['then'](ami[_0x6645('0x17')]())['then'](ami[_0x6645('0x19')]())['catch'](function(_0x3dc1ff){logger['error']('[ami.js][fullybooted]',util[_0x6645('0xf')](_0x3dc1ff,{'showHidden':![],'depth':null}));});});ami[_0x6645('0x1c')](_0x6645('0x10'),error);ami[_0x6645('0x1c')](_0x6645('0x1d'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index a6517bf..5dbd952 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 _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xda3f,0xec));var _0xfda3=function(_0x3c84f6,_0x2d70a5){_0x3c84f6=_0x3c84f6-0x0;var _0x469b25=_0xda3f[_0x3c84f6];return _0x469b25;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file +var _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x4a8395,_0x5033fc){var _0x4ddc60=function(_0x2d1cb1){while(--_0x2d1cb1){_0x4a8395['push'](_0x4a8395['shift']());}};_0x4ddc60(++_0x5033fc);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index fc5cdc2..96ac1dc 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 _0x55d2=['getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','outboundCongestionCallsDay','Congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','dialAgentRejectRetryFrequency','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','agentBusyFactor','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','abandonmentRate','[CatchErlangB]','predictiveIntervalPauses','[getDataPredictive]','erlangCallToSecond','milliseconds','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[checkContactBlack]','voicePause','outboundReCallsDay','dialRecallInQueue','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','temp','getContactDialerIvr','[getContactCampaign2][Empty]','RUNNING','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','undefined','not_inuse','getContactDialer','checkContactEmpty','countReScheduled','[countReScheduled]\x20','[handlePower]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','checkIsBlackList','[actionOriginatePredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','erlangb','busyFactor','----\x20Agent\x20Busy\x20Factor\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]','m\x20=\x20','Umin\x20=\x20','exports','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','outbound','inspect','format','voice:queue:%s','name','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','predictiveIntervalTotalCalls','Dropped\x20Timeout:\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','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','debug','handlePredictive','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','campaign:save','sendMessageOneNotActive','originated','INACTIVE','DISACTIVED','is\x20deactivated','[ifTime][Action]','stringify','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','timezones','UNKNOWN_TIMEZONE','isArray','length','push','Action','iftime\x20%s,%s','content','indexOf','command','true','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','resolve','checkIfTime','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','dialMethod','predictive','progressive','power','handlePower','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','\x20Interval\x20is\x20overtime:\x20','isGlobal','AMI\x20IfTime','Error','queue','uniqueid','type','ivr','decrementOriginate','[syncAgentConnect]','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','droptime','getSeconds','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','state','statedesc','Drop','dropreason','countglobal','verifyAdditionalPhones','voiceQueue','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','countdropretry','add','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','starttime','endtime','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','additional','countabandonedretry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','locked','paused','stateinterface','isNil','queueBooked','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','[syncOriginateResponse]','callProgressDetecting','[callProgressDetecting]\x20','variable','exten','dialAMDActive','value','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','AMD','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','membername','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','[rescheduleContact][Machine]','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr]','[syncHangup]','AnswerAGI','AGI','[syncHangupIvr]','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','throttle','filter','reachable','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[clearZombieChannels]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','notFound','[emptyContact]','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','setXMDContactVariables','Contact','Trunk','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','callerid'];(function(_0x24e45e,_0x400442){var _0x124cca=function(_0x15fc95){while(--_0x15fc95){_0x24e45e['push'](_0x24e45e['shift']());}};_0x124cca(++_0x400442);}(_0x55d2,0x9f));var _0x255d=function(_0x3909fb,_0x441482){_0x3909fb=_0x3909fb-0x0;var _0x202835=_0x55d2[_0x3909fb];return _0x202835;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0x255d('0x0'));var moment=require(_0x255d('0x1'));var rr=require('rr');var Redis=require(_0x255d('0x2'));var utils=require(_0x255d('0x3'));var hopperUtils=require(_0x255d('0x4'));var ut=require(_0x255d('0x5'));var config=require('../../../config/environment/');var logger=require(_0x255d('0x6'))(_0x255d('0x7'));var loggerBooked=require(_0x255d('0x6'))(_0x255d('0x8'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0x255d('0x6'))(_0x255d('0x9'));var loggerSyncQueueSummary=require(_0x255d('0x6'))(_0x255d('0xa'));var ami=require(_0x255d('0xb'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x255d('0xc'))(new Redis(config['redis']));var cmHopper=require(_0x255d('0xd'));var voiceQueueRt=require(_0x255d('0xe'));var RpcSetting=require(_0x255d('0xf'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require(_0x255d('0x10'));var Final=require(_0x255d('0x11'));var AgentComplete=require(_0x255d('0x12'));var QueueCallerAbandon=require(_0x255d('0x13'));var Hangup=require(_0x255d('0x14'));var ipAgi=process[_0x255d('0x15')][_0x255d('0x16')]||_0x255d('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x255d('0x18')][_0x255d('0x19')]=function(_0xbb7a35){this[_0x255d('0x1a')]=this[_0x255d('0x1a')]?this['tail'][_0x255d('0x1b')](_0xbb7a35):_0xbb7a35();};function Dialer(_0x1be65e,_0x58f0fa){this[_0x255d('0x1c')]=new Sequence();this[_0x255d('0x1d')]=_0x58f0fa;this[_0x255d('0x1e')]=_0x1be65e[_0x255d('0x1e')];this[_0x255d('0x1f')]=_0x1be65e[_0x255d('0x1f')];this[_0x255d('0x20')]=_0x1be65e[_0x255d('0x20')];this[_0x255d('0x21')]=_0x1be65e[_0x255d('0x21')];this['maxNumberOriginate']=config[_0x255d('0x22')]||0x2;this[_0x255d('0x23')]={};this[_0x255d('0x24')]={};this[_0x255d('0x25')]={};this[_0x255d('0x26')]={};this[_0x255d('0x27')]={};this[_0x255d('0x28')]={};this[_0x255d('0x29')]={};this[_0x255d('0x2a')]={};this['queueBooked']={};this[_0x255d('0x2b')]={};this[_0x255d('0x2c')]={};ami['on'](_0x255d('0x2d'),this[_0x255d('0x2e')][_0x255d('0x2f')](this));ami['on'](_0x255d('0x30'),this[_0x255d('0x31')][_0x255d('0x2f')](this));ami['on'](_0x255d('0x32'),this[_0x255d('0x33')][_0x255d('0x2f')](this));ami['on'](_0x255d('0x34'),this[_0x255d('0x35')][_0x255d('0x2f')](this));ami['on'](_0x255d('0x36'),this[_0x255d('0xa')][_0x255d('0x2f')](this));ami['on'](_0x255d('0x37'),this[_0x255d('0x38')]['bind'](this));ami['on'](_0x255d('0x39'),this[_0x255d('0x3a')][_0x255d('0x2f')](this));ami['on'](_0x255d('0x3b'),this[_0x255d('0x3c')][_0x255d('0x2f')](this));ami['on'](_0x255d('0x3d'),this[_0x255d('0x3e')]['bind'](this));ami['on'](_0x255d('0x3f'),this[_0x255d('0x40')][_0x255d('0x2f')](this));ami['on']('queuestatuscomplete',this[_0x255d('0x41')][_0x255d('0x2f')](this));this[_0x255d('0x42')]();this[_0x255d('0x43')]();RpcSetting[_0x255d('0x44')]()[_0x255d('0x45')](function(_0x576fb4){previewRecallmeReminderInterval=_0x576fb4[_0x255d('0x46')];});}function isNotNull(_0x529680){return _0x529680!==null&&!_['isUndefined'](_0x529680);}function msgResponse(_0x21e8dc,_0x289fbb,_0x2a9402){return{'action':_0x21e8dc,'response':_0x289fbb,'message':_0x2a9402,'stack':_0x2a9402};}function emit(_0x3bc0a0,_0x5d28bd,_0x3d3de7){io['to'](_0x3bc0a0)[_0x255d('0x47')](_0x5d28bd,_0x3d3de7);}function emitOutboundVoiceQueueSummary(_0x50983){if(_0x50983['type']===_0x255d('0x48')){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x255d('0x49')](_0x50983,{'showHidden':![],'depth':null}));emit(util[_0x255d('0x4a')](_0x255d('0x4b'),_0x50983[_0x255d('0x4c')]),_0x255d('0x4d'),_0x50983);}}function checkGetDataPredictive(_0x4e44f7){if(isNotNull(_0x4e44f7)&&!_[_0x255d('0x4e')](_0x4e44f7)){loggerPredictive['info'](_0x255d('0x4f'));loggerPredictive[_0x255d('0x50')](_0x255d('0x51'),_0x4e44f7[_0x255d('0x52')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e44f7['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x255d('0x53'),_0x4e44f7['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x255d('0x50')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e44f7[_0x255d('0x54')]);loggerPredictive[_0x255d('0x50')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e44f7[_0x255d('0x55')]);loggerPredictive[_0x255d('0x50')](_0x255d('0x56'),_0x4e44f7[_0x255d('0x57')]);loggerPredictive[_0x255d('0x50')](_0x255d('0x58'));if(_0x4e44f7[_0x255d('0x52')]>0x0){if(!_[_0x255d('0x59')](_0x4e44f7['predictiveIntervalAvgTalktime'])&&_0x4e44f7[_0x255d('0x57')]>0x0){return!![];}loggerPredictive[_0x255d('0x50')](_0x255d('0x5a'));if(!_['isUndefined'](_0x4e44f7[_0x255d('0x55')])&&_0x4e44f7[_0x255d('0x55')]>0x0){return!![];}loggerPredictive[_0x255d('0x50')](_0x255d('0x5b'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x255d('0x5c'));}return![];}function mergeDataErlangB(_0x1046f2){return function(_0x5016b3){loggerPredictive[_0x255d('0x50')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x255d('0x50')](_0x255d('0x5d'),_0x5016b3[_0x255d('0x5e')]);loggerPredictive[_0x255d('0x50')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5016b3['erlangCallToSecond']);loggerPredictive[_0x255d('0x50')](_0x255d('0x5f'),_0x5016b3[_0x255d('0x60')]);loggerPredictive['info'](_0x255d('0x61'),_0x5016b3[_0x255d('0x62')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5016b3['erlangAbandonmentRate']);loggerPredictive[_0x255d('0x50')](_0x255d('0x58'));_[_0x255d('0x63')](_0x1046f2,_0x5016b3);};}function ifInterval(_0x2d96d8,_0xde4ef4){if(_[_0x255d('0x59')](_0xde4ef4)){return![];}return utils['getSeconds'](undefined,_0xde4ef4)<_0x2d96d8*0x3c;}function clearPredictiveAttributes(_0x5f367b){if(_0x5f367b[_0x255d('0x29')]){_0x5f367b[_0x255d('0x29')]=undefined;loggerPredictive[_0x255d('0x64')](_0x5f367b[_0x255d('0x4c')],'startProgressive\x20value\x20cleared');}if(_0x5f367b[_0x255d('0x28')]){_0x5f367b[_0x255d('0x28')]=undefined;loggerPredictive[_0x255d('0x64')](_0x5f367b[_0x255d('0x4c')],'startPredictive\x20value\x20cleared');}if(_0x5f367b['handlePredictive']){clearInterval(_0x5f367b[_0x255d('0x65')]);_0x5f367b[_0x255d('0x65')]=undefined;loggerPredictive[_0x255d('0x64')](_0x5f367b[_0x255d('0x4c')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x1aa08a,_0x43662f){return function(_0x2f4e68){loggerPredictive[_0x255d('0x66')](_0x43662f[_0x255d('0x4c')],_0x1aa08a);loggerPredictive[_0x255d('0x66')](_0x2f4e68[_0x255d('0x67')]);clearPredictiveAttributes(_0x43662f);};}function loggerCatch(_0x8aa736){return function(_0x3618f7){logger[_0x255d('0x66')](_0x8aa736,util[_0x255d('0x49')](_0x3618f7,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x445f8c){return function(_0x4c3d4c){if(isNotNull(_0x4c3d4c)&&isNotNull(_0x4c3d4c[0x0])){if(_0x4c3d4c[0x0][_0x255d('0x68')]>0x0){_0x445f8c[_0x255d('0x69')]=utils[_0x255d('0x6a')][_0x255d('0x6b')];logger[_0x255d('0x50')](_0x255d('0x6c')+_0x445f8c['name'],_0x4c3d4c[0x0]['contactsRescheduled'],_0x255d('0x6d'));}else{_0x445f8c[_0x255d('0x69')]=utils[_0x255d('0x6a')][_0x255d('0x6e')];logger['info']('[getContactDialer2][Empty]'+_0x445f8c['name']);}}};}function createObjHistory(_0x51b306,_0x58f6dc,_0xfb1b81,_0x389430,_0x187857){_0x51b306['message']=_0xfb1b81;var _0x23834b=new Action(_0x51b306,_0x58f6dc);var _0x1f761b=new History(_0x23834b);_0x1f761b['state']=_0x389430;_0x1f761b['statedesc']=_0x187857;_0x1f761b['endtime']=_0x23834b['starttime'];return _0x1f761b;}function unlockQueueStatus(_0x4da302,_0x5a74f4){setTimeout(function(){if(_[_0x255d('0x59')](_0x4da302[_0x255d('0x6f')])){loggerBooked[_0x255d('0x66')](_0x255d('0x70'),_0x5a74f4);}_0x4da302[_0x255d('0x6f')]=!![];loggerBooked['info'](_0x255d('0x71'),_0x5a74f4,JSON['stringify'](_[_0x255d('0x72')](_0x4da302,[_0x255d('0x4c'),_0x255d('0x6f')])));},0x1f3);}function checkInterval(_0x3e3ed9){return function(){if(!isNotNull(_0x3e3ed9['Interval'])){_0x3e3ed9['message']=utils[_0x255d('0x6a')][_0x255d('0x73')];throw _0x3e3ed9[_0x255d('0x4c')]+_0x255d('0x74');}if(!isNotNull(_0x3e3ed9[_0x255d('0x75')][_0x255d('0x76')])){_0x3e3ed9[_0x255d('0x69')]=utils[_0x255d('0x6a')][_0x255d('0x73')];throw _0x3e3ed9['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x255d('0x4e')](_0x3e3ed9[_0x255d('0x75')][_0x255d('0x76')]))){_0x3e3ed9[_0x255d('0x69')]=utils[_0x255d('0x6a')]['NULL_INTERVAL'];throw _0x3e3ed9[_0x255d('0x4c')]+_0x255d('0x74');}};}function checkIsIVRCampaignActive(_0x4f2973){return function(){if(!utils[_0x255d('0x77')](_0x4f2973)){_0x4f2973[_0x255d('0x69')]=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0x4f2973[_0x255d('0x4c')]+_0x255d('0x78');}};}function emitCampaignSummary(_0x83f922){if(utils[_0x255d('0x79')](_0x83f922)){emit(util['format']('campaign:ivr:%s',_0x83f922[_0x255d('0x4c')]),_0x255d('0x7a'),_0x83f922);}}function loggerCatchQueueSummary(_0x3936ef,_0x43ab10){return function(_0x28b858){clearPredictiveAttributes(_0x43ab10);emitCampaignSummary(_0x43ab10);loggerSyncQueueSummary[_0x255d('0x64')](_0x3936ef,util[_0x255d('0x49')](_0x28b858,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x76ae58){if(_0x76ae58[_0x255d('0x7b')]){if(_0x76ae58[_0x255d('0x7c')]===0x0){_0x76ae58['sendMessageOneNotActive']=![];_0x76ae58[_0x255d('0x69')]=utils['CAMPAIGN_STATUS'][_0x255d('0x7d')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x76ae58[_0x255d('0x4c')],'is\x20not\x20active');}else{_0x76ae58[_0x255d('0x69')]=utils['CAMPAIGN_STATUS'][_0x255d('0x7e')];loggerSyncQueueSummary[_0x255d('0x64')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x76ae58[_0x255d('0x4c')],_0x255d('0x7f'));}emitCampaignSummary(_0x76ae58);}}function myreject(_0x4b254d){return function(_0x2d0779){return _0x4b254d(msgResponse(_0x255d('0x80'),'Error',JSON[_0x255d('0x81')](_0x2d0779)));};}Dialer[_0x255d('0x18')]['isTrunkReachable']=function(_0x5a3101){return!_[_0x255d('0x59')](_0x5a3101)&&_0x5a3101&&!_['isUndefined'](_0x5a3101['name'])&&!_[_0x255d('0x59')](_0x5a3101[_0x255d('0x82')])&&_0x5a3101[_0x255d('0x82')]&&(this[_0x255d('0x21')][util['format'](_0x255d('0x83'),_0x5a3101['name'])]['status']==='reachable'||this[_0x255d('0x21')][util[_0x255d('0x4a')]('SIP/%s',_0x5a3101['name'])][_0x255d('0x84')]===_0x255d('0x85'));};Dialer[_0x255d('0x18')][_0x255d('0x86')]=function(_0x4827cf){var _0x409868=this;return function(){if(!_0x409868['isTrunkReachable'](_0x4827cf['Trunk'])){if(!_0x409868[_0x255d('0x87')](_0x4827cf[_0x255d('0x88')])){_0x4827cf[_0x255d('0x69')]=utils[_0x255d('0x6a')][_0x255d('0x89')];throw _0x4827cf[_0x255d('0x4c')]+_0x255d('0x8a');}}};};Dialer[_0x255d('0x18')]['checkIfTime']=function(_0x21ed5c,_0x4d792d,_0x850c18,_0x243e09){var _0x4b79eb=this;return function(){var _0x255c79=!![];return _0x4b79eb[_0x255d('0x8b')](_0x21ed5c,_0x4d792d,_0x850c18,_0x243e09,_0x255c79);};};Dialer[_0x255d('0x18')][_0x255d('0x8c')]=function(_0x237846,_0x54c9e3,_0x545adb,_0x5c4a71){var _0x1b99c7=this;return function(){var _0x15e49d=![];return _0x1b99c7[_0x255d('0x8b')](_0x237846[_0x255d('0x76')],_0x54c9e3,_0x545adb,_0x5c4a71,_0x15e49d);};};Dialer['prototype'][_0x255d('0x8b')]=function(_0x49a6cc,_0x5ad262,_0x2ed26e,_0x3b2c40,_0x212be1){var _0x3a72f8=[];return new Promise(function(_0x48ae9f,_0x2f3ea7){if(!isNotNull(_0x49a6cc)){_0x3b2c40[_0x255d('0x69')]=utils[_0x255d('0x6a')][_0x255d('0x73')];return _0x2f3ea7(msgResponse(_0x255d('0x8d'),_0x255d('0x8e'),_0x2ed26e+_0x255d('0x8f')));}if(_[_0x255d('0x4e')](_0x49a6cc)){_0x3b2c40[_0x255d('0x69')]=utils[_0x255d('0x6a')]['EMPTY_INTERVAL'];return _0x2f3ea7(msgResponse(_0x255d('0x8d'),_0x255d('0x8e'),_0x2ed26e+'\x20Intervals\x20is\x20empty\x20'));}if(_0x5ad262&&_[_0x255d('0x59')](config[_0x255d('0x90')][_0x5ad262])){_0x3b2c40['message']=utils[_0x255d('0x6a')][_0x255d('0x91')];return _0x2f3ea7(msgResponse('ifTime',_0x255d('0x8e'),_0x2ed26e+'\x20Timezone\x20unknow\x20'+_0x5ad262));}if(_[_0x255d('0x92')](_0x49a6cc)){for(var _0x372f8e=0x0;_0x372f8e<_0x49a6cc[_0x255d('0x93')];_0x372f8e+=0x1){_0x3a72f8[_0x255d('0x94')](ami[_0x255d('0x95')]({'action':'command','command':util[_0x255d('0x4a')](_0x255d('0x96'),_0x49a6cc[_0x372f8e]['interval'],!_['isUndefined'](config[_0x255d('0x90')][_0x5ad262])?_0x5ad262:'')})[_0x255d('0x45')](function(_0xc383bf){return _0xc383bf[_0x255d('0x97')][_0x255d('0x98')]('true')>=0x0;})['catch'](myreject(_0x2f3ea7)));}}else{_0x3a72f8['push'](ami[_0x255d('0x95')]({'action':_0x255d('0x99'),'command':util[_0x255d('0x4a')](_0x255d('0x96'),_0x49a6cc,!_['isUndefined'](config[_0x255d('0x90')][_0x5ad262])?_0x5ad262:'')})[_0x255d('0x45')](function(_0x4bd2fb){return _0x4bd2fb[_0x255d('0x97')][_0x255d('0x98')](_0x255d('0x9a'))>=0x0;})[_0x255d('0x9b')](myreject(_0x2f3ea7)));}Promise[_0x255d('0x9c')](_0x3a72f8)[_0x255d('0x45')](function(_0x523ba6){var _0xb4ad35=_[_0x255d('0x9d')](_0x523ba6);if(_0xb4ad35){return _0x48ae9f(_0xb4ad35);}else{_0x3b2c40[_0x255d('0x69')]=_0x212be1?utils['CAMPAIGN_STATUS'][_0x255d('0x9e')]:utils[_0x255d('0x6a')][_0x255d('0x9f')];return _0x2f3ea7(msgResponse(_0x255d('0xa0'),'Failure',_0x255d('0xa1')+_0x212be1+'\x20'+_0x2ed26e+'\x20Interval\x20is\x20overtime:\x20'+util[_0x255d('0x49')](_0x49a6cc,{'showHidden':![],'depth':null})+_0x255d('0xa2')+_0x5ad262));}})[_0x255d('0x9b')](function(_0x66d099){return _0x2f3ea7(msgResponse(_0x255d('0x8d'),_0x255d('0x8e'),JSON['stringify'](_0x66d099)));});});};Dialer[_0x255d('0x18')]['loopCampaigns']=function(){var _0x89de86=this;return cmHopper[_0x255d('0xa3')]({'active':![]},{'where':{'active':!![]}})[_0x255d('0x45')](function(){setInterval(function(){_0x89de86[_0x255d('0xa4')]();},0x3e8);});};Dialer[_0x255d('0x18')][_0x255d('0xa4')]=function(){var _0x38e9c6=this;var _0x151836;for(var _0x70e412 in this[_0x255d('0x1f')]){if(typeof this[_0x255d('0x1f')][_0x70e412]!=='undefined'){_0x151836=this['campaigns'][_0x70e412];if(utils[_0x255d('0x79')](_0x151836)&&utils['isIVRCampaignActive'](_0x151836)){_0x151836['sendMessageOneNotActive']=!![];Promise[_0x255d('0xa5')]()['then'](checkIsIVRCampaignActive(_0x151836))[_0x255d('0x45')](checkInterval(_0x151836))[_0x255d('0x45')](_0x38e9c6['checkIsTrunkReachable'](_0x151836))['then'](_0x38e9c6[_0x255d('0xa6')](_0x151836[_0x255d('0xa7')],_0x151836[_0x255d('0xa8')],_0x151836[_0x255d('0x4c')],_0x151836))['then'](_0x38e9c6['checkIfTimeIntervals'](_0x151836[_0x255d('0x75')],_0x151836[_0x255d('0xa8')],_0x151836[_0x255d('0x4c')],_0x151836))[_0x255d('0x45')](_0x38e9c6[_0x255d('0xa9')](_0x151836))[_0x255d('0x9b')](loggerCatchQueueSummary(_0x255d('0xaa'),_0x151836));}else{notSendMessagesCampaign(_0x151836);}}}};Dialer[_0x255d('0x18')]['checkDialMethod']=function(_0x59f683){if(_0x59f683[_0x255d('0xab')]!==_0x255d('0xac')){clearPredictiveAttributes(_0x59f683);}switch(_0x59f683[_0x255d('0xab')]){case _0x255d('0xad'):this['handlePower'](_0x59f683,0x1);break;case _0x255d('0xae'):this['handlePower'](_0x59f683,_0x59f683['dialPowerLevel']);break;case _0x255d('0xac'):this['predictive'](_0x59f683);break;case _0x255d('0x8'):this[_0x255d('0xaf')](_0x59f683,0x1);break;default:logger[_0x255d('0x66')]('Queue',_0x59f683[_0x255d('0x4c')],'method\x20not\x20recognized');}};Dialer[_0x255d('0x18')][_0x255d('0x8d')]=function(_0xebd409,_0x51fef3){var _0x269877=_0xebd409[_0x255d('0xa8')];var _0x3fe223=_0x51fef3?_0xebd409[_0x255d('0xa7')]:_0xebd409[_0x255d('0x75')]['Intervals'];logger[_0x255d('0xb0')](_0x255d('0xb1'),_0x3fe223,_0x269877,_0xebd409[_0x255d('0x4c')],util[_0x255d('0x4a')](_0x255d('0xb2'),_0xebd409[_0x255d('0x4c')],_0xebd409['id']));var _0x219041=null;return Interval[_0x255d('0xb3')](_0x3fe223,_0x269877)[_0x255d('0x45')](function(_0x1e2399){if(_0x1e2399===!![]){return _0x1e2399;}else{_0xebd409[_0x255d('0x69')]=_0x51fef3?utils[_0x255d('0x6a')][_0x255d('0x9e')]:utils['CAMPAIGN_STATUS'][_0x255d('0x9f')];_0x219041=msgResponse('[ifTime][promiseAll]',_0x255d('0x8e'),_0x255d('0xa1')+_0x51fef3+'\x20'+_0xebd409[_0x255d('0x4c')]+_0x255d('0xb4')+util[_0x255d('0x49')](_0x3fe223,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x269877);}if(_0x219041!==null){logger[_0x255d('0xb0')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x219041);_0x219041[_0x255d('0xb5')]=_0x51fef3;throw _0x219041;}})['catch'](function(_0x5885d6){logger[_0x255d('0x66')](_0x255d('0xb6'),_0x5885d6);throw msgResponse(_0x255d('0x80'),_0x255d('0xb7'),util[_0x255d('0x49')](_0x5885d6,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x255d('0x2e')]=function(_0x29db88){if(this[_0x255d('0x1e')][_0x29db88[_0x255d('0xb8')]]){if(this['uniqueId'][_0x29db88[_0x255d('0xb9')]]&&this[_0x255d('0x26')][_0x29db88['uniqueid']][_0x255d('0xba')]!==_0x255d('0xbb')){utils[_0x255d('0xbc')](this[_0x255d('0x1e')][_0x29db88['queue']],_0x255d('0xbd'));this[_0x255d('0x26')][_0x29db88[_0x255d('0xb9')]][_0x255d('0xbe')]=moment()[_0x255d('0x4a')](_0x255d('0xbf'));}}};Dialer[_0x255d('0x18')][_0x255d('0x35')]=function(_0x1afaa7){var _0x15af11=this[_0x255d('0x26')][_0x1afaa7['uniqueid']];if(this['voiceQueues'][_0x1afaa7[_0x255d('0xb8')]]){if(_0x15af11&&_0x15af11[_0x255d('0xba')]!==_0x255d('0xbb')){delete this[_0x255d('0x26')][_0x1afaa7['uniqueid']];this['voiceQueues'][_0x1afaa7['queue']][_0x255d('0xc0')]+=0x1;var _0x2c3d5a=new AgentComplete(_0x15af11,_0x1afaa7);if(_0x1afaa7[_0x255d('0xc1')]===_0x255d('0xc2')){_0x2c3d5a[_0x255d('0xc3')]=this[_0x255d('0x1e')][_0x1afaa7[_0x255d('0xb8')]][_0x255d('0xc4')]&&this[_0x255d('0x1e')][_0x1afaa7[_0x255d('0xb8')]][_0x255d('0xc5')]?moment()[_0x255d('0x4a')](_0x255d('0xbf')):undefined;}hopperUtils['createHistory'](_0x2c3d5a)[_0x255d('0x9b')](loggerCatch(_0x255d('0xc6')));hopperUtils[_0x255d('0xc7')](_0x2c3d5a)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x255d('0x18')][_0x255d('0x31')]=function(_0x445b0b){var _0x2340ce=this[_0x255d('0x26')][_0x445b0b[_0x255d('0xb9')]];var _0x35bcff=this;var _0x3f458e=![];var _0x3a65ed;var _0x5c811d;if(this['voiceQueues'][_0x445b0b['queue']]){if(_0x2340ce&&_0x2340ce[_0x255d('0xba')]!==_0x255d('0xbb')){delete this['uniqueId'][_0x445b0b['uniqueid']];utils[_0x255d('0xbc')](this[_0x255d('0x1e')][_0x445b0b[_0x255d('0xb8')]],'[syncQueueCallerAbandon]');_0x2340ce[_0x255d('0xc8')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x2950b=new QueueCallerAbandon(_0x2340ce,_0x445b0b);if(utils[_0x255d('0xc9')](_0x2340ce[_0x255d('0xc8')],_0x2340ce[_0x255d('0xca')])>=_0x2340ce[_0x255d('0xcb')]){this['voiceQueues'][_0x445b0b[_0x255d('0xb8')]][_0x255d('0xcc')]+=0x1;this[_0x255d('0x1e')][_0x445b0b[_0x255d('0xb8')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x255d('0x1e')][_0x445b0b[_0x255d('0xb8')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x2950b[_0x255d('0xcd')]=0xa;_0x2950b[_0x255d('0xce')]=_0x255d('0xcf');_0x2950b[_0x255d('0xd0')]='TIMEOUT';_0x2950b[_0x255d('0xc3')]=this['voiceQueues'][_0x445b0b[_0x255d('0xb8')]]['dialQueueProject2']?moment()[_0x255d('0x4a')](_0x255d('0xbf')):undefined;_0x2950b['countdropretry']+=0x1;_0x2950b[_0x255d('0xd1')]+=0x1;_0x3a65ed=this[_0x255d('0x1e')][_0x445b0b[_0x255d('0xb8')]]['dialDropRetryFrequency'];_0x5c811d=this['voiceQueues'][_0x445b0b['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0x255d('0xd2')](_0x2950b,_0x2950b[_0x255d('0xcd')],_0x2340ce[_0x255d('0xd3')])[_0x255d('0x45')](function(_0x21edd6){_0x3f458e=_0x21edd6['additional']==0x1;if(_0x2950b['countdropretry']>=_0x35bcff['voiceQueues'][_0x445b0b[_0x255d('0xb8')]][_0x255d('0xd4')]){_0x35bcff[_0x255d('0xd5')](_0x2950b,_0x21edd6['additional']);}else{hopperUtils[_0x255d('0xd6')]({'active':![],'countdropretry':_0x2950b[_0x255d('0xd7')],'scheduledat':moment()[_0x255d('0xd8')](_0x35bcff['voiceQueues'][_0x445b0b[_0x255d('0xb8')]][_0x255d('0xd9')],_0x255d('0xda'))[_0x255d('0x4a')](_0x255d('0xbf')),'ContactId':_0x2340ce[_0x255d('0xdb')],'ListId':_0x2340ce[_0x255d('0xdc')],'VoiceQueueId':_0x2340ce[_0x255d('0xdd')]||undefined,'CampaignId':_0x2340ce[_0x255d('0xde')]||undefined})[_0x255d('0x9b')](loggerCatch(_0x255d('0xdf')));var _0x5e7eb9=new History(_0x2950b);_0x5e7eb9['state']=0xa;_0x5e7eb9[_0x255d('0xce')]='Drop';_0x5e7eb9[_0x255d('0xe0')]=moment()[_0x255d('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e7eb9[_0x255d('0xe1')]=_0x5e7eb9[_0x255d('0xe0')];_0x5e7eb9[_0x255d('0xe2')]=_0x2950b[_0x255d('0xe2')];_0x5e7eb9['calleridnum']=_0x2950b[_0x255d('0xe3')];hopperUtils[_0x255d('0xe4')](_0x5e7eb9)['catch'](loggerCatch(_0x255d('0xe5')));}})[_0x255d('0x45')](function(){if(_0x3f458e)hopperUtils[_0x255d('0xe6')](_0x2950b,_0x3a65ed,_0x5c811d)[_0x255d('0x45')](function(){return 0x1;});});}else{this[_0x255d('0x1e')][_0x445b0b[_0x255d('0xb8')]][_0x255d('0x54')]+=0x1;this[_0x255d('0x1e')][_0x445b0b[_0x255d('0xb8')]]['outboundDropCallsDayCallersExit']+=0x1;_0x2950b[_0x255d('0xcd')]=0xb;_0x2950b[_0x255d('0xce')]=_0x255d('0xe7');_0x2950b['dropreason']=_0x255d('0xe8');_0x2950b['countabandonedretry']+=0x1;_0x2950b['countglobal']+=0x1;_0x3a65ed=this[_0x255d('0x1e')][_0x445b0b[_0x255d('0xb8')]][_0x255d('0xe9')];_0x5c811d=this[_0x255d('0x1e')][_0x445b0b['queue']][_0x255d('0xea')];hopperUtils['verifyAdditionalPhones'](_0x2950b,_0x2950b[_0x255d('0xcd')],_0x2340ce[_0x255d('0xd3')])[_0x255d('0x45')](function(_0x250abb){if(_0x2950b['countabandonedretry']>=_0x35bcff[_0x255d('0x1e')][_0x445b0b['queue']]['dialAbandonedMaxRetry']){_0x35bcff['queueCallerAbandonCreateState'](_0x2950b,_0x250abb[_0x255d('0xeb')]);}else{hopperUtils[_0x255d('0xd6')]({'active':![],'countabandonedretry':_0x2950b[_0x255d('0xec')],'scheduledat':moment()[_0x255d('0xd8')](_0x35bcff[_0x255d('0x1e')][_0x445b0b['queue']]['dialAbandonedRetryFrequency'],_0x255d('0xda'))[_0x255d('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2340ce[_0x255d('0xdb')],'ListId':_0x2340ce['ListId'],'VoiceQueueId':_0x2340ce[_0x255d('0xdd')]||undefined,'CampaignId':_0x2340ce['CampaignId']||undefined})[_0x255d('0x9b')](loggerCatch(_0x255d('0xed')));var _0x26f701=new History(_0x2950b);_0x26f701['state']=0xb;_0x26f701[_0x255d('0xce')]='Abandoned';_0x26f701[_0x255d('0xe0')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x26f701[_0x255d('0xe1')]=_0x26f701[_0x255d('0xe0')];_0x26f701[_0x255d('0xe2')]=_0x2950b['calleridname'];_0x26f701[_0x255d('0xe3')]=_0x2950b['calleridnum'];hopperUtils[_0x255d('0xe4')](_0x26f701)[_0x255d('0x9b')](loggerCatch(_0x255d('0xee')));}})[_0x255d('0x45')](function(){if(_0x3f458e)hopperUtils['swapAdditionalPhones'](_0x2950b,_0x3a65ed,_0x5c811d)[_0x255d('0x45')](function(){return 0x1;});});}}}};Dialer[_0x255d('0x18')][_0x255d('0x3c')]=function(_0x1bbe0b){if(this[_0x255d('0x24')][_0x1bbe0b['uniqueid']]){this['actions'][_0x1bbe0b['uniqueid']][_0x255d('0xef')]=_0x1bbe0b[_0x255d('0xef')];}if(this['uniqueId'][_0x1bbe0b[_0x255d('0xb9')]]){this[_0x255d('0x26')][_0x1bbe0b[_0x255d('0xb9')]][_0x255d('0xef')]=_0x1bbe0b[_0x255d('0xef')];}};Dialer['prototype'][_0x255d('0x40')]=function(_0x17f9d3){if(!this['actions'][_0x17f9d3[_0x255d('0xf0')]]){return;}var _0x9675e=this[_0x255d('0x1e')][this['actions'][_0x17f9d3[_0x255d('0xf0')]][_0x255d('0xb8')]][_0x255d('0xf1')]||_0x255d('0xf2');if(_0x9675e===_0x255d('0xf3')){if(this[_0x255d('0x24')][_0x17f9d3[_0x255d('0xf0')]]&&_['isNil'](this[_0x255d('0x24')][_0x17f9d3[_0x255d('0xf0')]][_0x255d('0xf4')])&&_0x17f9d3['status']==='1'&&_0x17f9d3[_0x255d('0xf5')]==='0'){if(this[_0x255d('0x20')][_0x17f9d3[_0x255d('0xf6')]]){if(!this[_0x255d('0x20')][_0x17f9d3[_0x255d('0xf6')]][_0x255d('0xf4')]){this[_0x255d('0x20')][_0x17f9d3[_0x255d('0xf6')]][_0x255d('0xf4')]=!![];this[_0x255d('0x24')][_0x17f9d3[_0x255d('0xf0')]][_0x255d('0xf4')]=!![];this[_0x255d('0x24')][_0x17f9d3[_0x255d('0xf0')]]['stateinterface']=_0x17f9d3[_0x255d('0xf6')];}}}}else if(_0x9675e===_0x255d('0xf2')){if(this[_0x255d('0x24')][_0x17f9d3[_0x255d('0xf0')]]){if(this[_0x255d('0x20')][_0x17f9d3['stateinterface']]){this[_0x255d('0x24')][_0x17f9d3[_0x255d('0xf0')]]['stateinterface']=_0x17f9d3['stateinterface'];if(_[_0x255d('0xf7')](this['queueBooked'][this[_0x255d('0x24')][_0x17f9d3[_0x255d('0xf0')]][_0x255d('0xb8')]])){this[_0x255d('0xf8')][this[_0x255d('0x24')][_0x17f9d3[_0x255d('0xf0')]]['queue']]=[];}this[_0x255d('0xf8')][this[_0x255d('0x24')][_0x17f9d3['actionid']][_0x255d('0xb8')]][_0x255d('0x94')](_[_0x255d('0x63')](_[_0x255d('0x72')](this['actions'][_0x17f9d3['actionid']],[_0x255d('0xf9'),_0x255d('0xf6')]),{'status':_0x17f9d3[_0x255d('0x84')],'paused':_0x17f9d3[_0x255d('0xf5')]}));}}}};Dialer[_0x255d('0x18')][_0x255d('0x41')]=function(_0x2a89c9){if(!this[_0x255d('0x24')][_0x2a89c9[_0x255d('0xf0')]]){return;}var _0x3f739d=this;var _0x5f3b7e=this[_0x255d('0x1e')][this[_0x255d('0x24')][_0x2a89c9[_0x255d('0xf0')]][_0x255d('0xb8')]];var _0x52ebfc=_0x5f3b7e['strategy']||_0x255d('0xf2');if(_0x52ebfc===_0x255d('0xf3')){if(this['actions'][_0x2a89c9[_0x255d('0xf0')]]&&this[_0x255d('0x24')][_0x2a89c9['actionid']][_0x255d('0xf6')]){this[_0x255d('0x1d')][_0x255d('0xfa')](this[_0x255d('0x24')][_0x2a89c9[_0x255d('0xf0')]][_0x255d('0xf9')],this[_0x255d('0x24')][_0x2a89c9[_0x255d('0xf0')]][_0x255d('0xf6')])[_0x255d('0x9b')](function(_0x2ea410){logger[_0x255d('0x66')](_0x255d('0xfb'),util[_0x255d('0x49')](_0x2ea410,{'showHidden':![],'depth':null}));})['finally'](function(){utils[_0x255d('0xbc')](_0x3f739d['voiceQueues'][_0x3f739d[_0x255d('0x24')][_0x2a89c9[_0x255d('0xf0')]][_0x255d('0xb8')]],_0x255d('0xfc'));_0x3f739d[_0x255d('0x20')][_0x3f739d[_0x255d('0x24')][_0x2a89c9['actionid']]['stateinterface']][_0x255d('0xf4')]=![];delete _0x3f739d[_0x255d('0x24')][_0x2a89c9[_0x255d('0xf0')]];unlockQueueStatus(_0x5f3b7e);});}else{utils[_0x255d('0xbc')](this[_0x255d('0x1e')][this['actions'][_0x2a89c9[_0x255d('0xf0')]][_0x255d('0xb8')]],_0x255d('0xfc'));hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x2a89c9[_0x255d('0xf0')]]['ContactId'],'ListId':this[_0x255d('0x24')][_0x2a89c9[_0x255d('0xf0')]]['ListId'],'VoiceQueueId':this['actions'][_0x2a89c9[_0x255d('0xf0')]][_0x255d('0xdd')]||undefined,'CampaignId':this['actions'][_0x2a89c9['actionid']]['CampaignId']||undefined})[_0x255d('0x9b')](loggerCatch(_0x255d('0xfd')));delete this[_0x255d('0x24')][_0x2a89c9[_0x255d('0xf0')]];unlockQueueStatus(_0x5f3b7e);}}else if(_0x52ebfc===_0x255d('0xf2')){var _0x391e1b;if(this[_0x255d('0x24')][_0x2a89c9[_0x255d('0xf0')]]&&!_[_0x255d('0x4e')](this[_0x255d('0xf8')][this[_0x255d('0x24')][_0x2a89c9[_0x255d('0xf0')]][_0x255d('0xb8')]])){if(this[_0x255d('0x2b')][_0x3f739d[_0x255d('0x24')][_0x2a89c9['actionid']][_0x255d('0xb8')]]){this[_0x255d('0x2b')][_0x3f739d[_0x255d('0x24')][_0x2a89c9[_0x255d('0xf0')]][_0x255d('0xb8')]]=this[_0x255d('0x2b')][this[_0x255d('0x24')][_0x2a89c9['actionid']][_0x255d('0xb8')]]?this[_0x255d('0x2b')][this[_0x255d('0x24')][_0x2a89c9[_0x255d('0xf0')]][_0x255d('0xb8')]]:this[_0x255d('0xf8')][this[_0x255d('0x24')][_0x2a89c9[_0x255d('0xf0')]]['queue']]?this[_0x255d('0xf8')][this[_0x255d('0x24')][_0x2a89c9['actionid']][_0x255d('0xb8')]][_0x255d('0xfe')]||0x0:0x0;}this[_0x255d('0xf8')][this[_0x255d('0x24')][_0x2a89c9[_0x255d('0xf0')]]['queue']][_0x255d('0xfe')]=this[_0x255d('0x2b')][this[_0x255d('0x24')][_0x2a89c9['actionid']]['queue']];for(var _0x4d8ab5=0x0;_0x4d8ab5=_0x2d2731['dialGlobalMaxRetry']){_0x2fda9b[_0x255d('0x122')](_0x3c52f9,_0x203ac3,_0x3be2c8,_0x255d('0x123'));}else{if(_0x3c52f9[_0x255d('0x11d')]>=_0x2d2731[_0x255d('0x124')]){_0x2fda9b[_0x255d('0x125')](_0x3c52f9,_0x203ac3,_0x3be2c8,_0x255d('0x126'));}else{hopperUtils[_0x255d('0xd6')]({'active':![],'countmachineretry':_0x3c52f9[_0x255d('0x11d')],'scheduledat':moment()['add'](_0x2d2731[_0x255d('0x127')],_0x255d('0xda'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3c52f9[_0x255d('0xdb')],'ListId':_0x3c52f9['ListId'],'VoiceQueueId':_0x3c52f9[_0x255d('0xdd')]||undefined,'CampaignId':_0x3c52f9[_0x255d('0xde')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x203ac3({'reschedule':0x1});}}});}if(_0x3a4c31[_0x255d('0xba')]==='ivr'&&this[_0x255d('0x1f')][_0x3a4c31[_0x255d('0xb8')]][_0x255d('0x110')]&&_0x93add9[_0x255d('0x111')]===_0x255d('0x128')){delete this[_0x255d('0x26')][_0x93add9[_0x255d('0xb9')]];utils[_0x255d('0xbc')](this[_0x255d('0x1f')][_0x3a4c31[_0x255d('0xb8')]],_0x255d('0x112'));_0x4adeef=new Hangup(_0x3a4c31,_0x93add9);_0x4adeef['state']=0x12;_0x4adeef[_0x255d('0xce')]='HangupInAMD';_0x4adeef['membername']=_0x255d('0x115');ami[_0x255d('0x47')](_0x255d('0x116'),ut[_0x255d('0x117')](_0x4adeef,_0x255d('0x11e')));this['saveInDb'](_0x4adeef,_0x255d('0x129'),_0x255d('0x12a'));}if(_0x3a4c31[_0x255d('0xba')]==='ivr'&&this[_0x255d('0x1f')][_0x3a4c31['queue']][_0x255d('0x110')]&&_0x93add9[_0x255d('0x111')]===_0x255d('0x12b')){return new Promise(function(_0x1dfbff,_0x30c325){delete _0x2fda9b[_0x255d('0x26')][_0x93add9[_0x255d('0xb9')]];utils[_0x255d('0xbc')](_0x2fda9b[_0x255d('0x1f')][_0x3a4c31[_0x255d('0xb8')]],_0x255d('0x112'));_0x2fda9b[_0x255d('0x1f')][_0x3a4c31[_0x255d('0xb8')]][_0x255d('0xc0')]+=0x1;_0x2fda9b[_0x255d('0x1f')][_0x3a4c31[_0x255d('0xb8')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x57270b=_0x2fda9b[_0x255d('0x1f')][_0x3a4c31[_0x255d('0xb8')]];var _0x24f0e2=new Hangup(_0x3a4c31,_0x93add9);_0x24f0e2['state']=0x13;_0x24f0e2[_0x255d('0xce')]=_0x255d('0x11b');_0x24f0e2[_0x255d('0x11c')]=_0x255d('0x115');_0x24f0e2[_0x255d('0x11d')]+=0x1;_0x24f0e2[_0x255d('0xd1')]+=0x1;_0x24f0e2['amd']=!![];ami[_0x255d('0x47')](_0x255d('0x116'),ut[_0x255d('0x117')](_0x24f0e2,_0x255d('0x11e')));hopperUtils[_0x255d('0xe4')](_0x24f0e2)[_0x255d('0x9b')](loggerCatch(_0x255d('0x11f')));if(_0x24f0e2[_0x255d('0x120')]+_0x24f0e2[_0x255d('0x121')]+_0x24f0e2['countnoanswerretry']+_0x24f0e2[_0x255d('0x12c')]+_0x24f0e2[_0x255d('0xd7')]+_0x24f0e2[_0x255d('0xec')]+_0x24f0e2[_0x255d('0x11d')]+_0x24f0e2[_0x255d('0x12d')]>=_0x57270b[_0x255d('0x12e')]){_0x2fda9b[_0x255d('0x122')](_0x24f0e2,_0x1dfbff,_0x30c325,_0x255d('0x123'));}else{if(_0x24f0e2[_0x255d('0x11d')]>=_0x57270b['dialMachineMaxRetry']){_0x2fda9b[_0x255d('0x125')](_0x24f0e2,_0x1dfbff,_0x30c325,_0x255d('0x126'));}else{hopperUtils[_0x255d('0xd6')]({'active':![],'countmachineretry':_0x24f0e2[_0x255d('0x11d')],'scheduledat':moment()[_0x255d('0xd8')](_0x57270b[_0x255d('0x127')],_0x255d('0xda'))['format'](_0x255d('0xbf')),'ContactId':_0x24f0e2[_0x255d('0xdb')],'ListId':_0x24f0e2[_0x255d('0xdc')],'VoiceQueueId':_0x24f0e2[_0x255d('0xdd')]||undefined,'CampaignId':_0x24f0e2[_0x255d('0xde')]||undefined})['catch'](loggerCatch(_0x255d('0x12f')));_0x1dfbff({'reschedule':0x1});}}});}}};Dialer[_0x255d('0x18')]['syncHangup']=function(_0x76c9de){var _0x18862b=this[_0x255d('0x26')][_0x76c9de[_0x255d('0xb9')]];var _0x236618;if(!_0x18862b){return;}if(_0x18862b[_0x255d('0xba')]===_0x255d('0xbb')){delete this['uniqueId'][_0x76c9de[_0x255d('0xb9')]];utils[_0x255d('0xbc')](this[_0x255d('0x1f')][_0x18862b['queue']],'[syncHangup]');this[_0x255d('0x1f')][_0x18862b[_0x255d('0xb8')]][_0x255d('0x130')]+=0x1;if(_0x76c9de[_0x255d('0x131')]===_0x255d('0x132')){const _0x369177=new AgentComplete(_0x18862b,_0x76c9de);_0x369177[_0x255d('0xde')]=this[_0x255d('0x1f')][_0x18862b[_0x255d('0xb8')]]['id'];hopperUtils[_0x255d('0xe4')](_0x369177)[_0x255d('0x9b')](loggerCatch('[syncAgentCompleteIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x369177)[_0x255d('0x9b')](loggerCatch(_0x255d('0x133')));}else{_0x236618=new Hangup(_0x18862b,_0x76c9de);hopperUtils['createHistory'](_0x236618)[_0x255d('0x9b')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x255d('0xc7')](_0x236618)[_0x255d('0x9b')](loggerCatch('[syncHangupIvr]'));}}else{if(isNotNull(this[_0x255d('0x1e')][_0x18862b[_0x255d('0xb8')]]['dialQueueProject'])){delete this[_0x255d('0x26')][_0x76c9de[_0x255d('0xb9')]];utils[_0x255d('0xbc')](this[_0x255d('0x1e')][_0x18862b[_0x255d('0xb8')]],_0x255d('0x134'));this['voiceQueues'][_0x18862b['queue']][_0x255d('0xc0')]+=0x1;this[_0x255d('0x1e')][_0x18862b[_0x255d('0xb8')]][_0x255d('0x113')]+=0x1;_0x236618=new Hangup(_0x18862b,_0x76c9de);_0x236618[_0x255d('0xcd')]=0x10;_0x236618['statedesc']=_0x255d('0x135');_0x236618[_0x255d('0x11c')]=_0x255d('0x136');hopperUtils[_0x255d('0xe4')](_0x236618)[_0x255d('0x9b')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x255d('0xc7')](_0x236618)['catch'](loggerCatch(_0x255d('0x137')));}else{delete this['uniqueId'][_0x76c9de[_0x255d('0xb9')]];utils[_0x255d('0xbc')](this[_0x255d('0x1e')][_0x18862b['queue']],'[syncHangup2]');if(_0x76c9de[_0x255d('0x131')]===_0x255d('0x132')){this[_0x255d('0x1e')][_0x18862b[_0x255d('0xb8')]][_0x255d('0xc0')]+=0x1;const _0x24f22a=new AgentComplete(_0x18862b,_0x76c9de);_0x24f22a[_0x255d('0xdd')]=this[_0x255d('0x1e')][_0x18862b['queue']]['id'];hopperUtils['createHistory'](_0x24f22a)[_0x255d('0x9b')](loggerCatch(_0x255d('0xc6')));hopperUtils[_0x255d('0xc7')](_0x24f22a)[_0x255d('0x9b')](loggerCatch('[syncAgentComplete]'));}else{this[_0x255d('0x1e')][_0x18862b['queue']][_0x255d('0x138')]+=0x1;_0x236618=new Hangup(_0x18862b,_0x76c9de);_0x236618[_0x255d('0xcd')]=0xc;_0x236618[_0x255d('0xce')]=_0x76c9de['cause-txt'];_0x236618[_0x255d('0x11c')]=_0x255d('0x139');hopperUtils[_0x255d('0xe4')](_0x236618)['catch'](loggerCatch(_0x255d('0x13a')));hopperUtils['moveContactManagedDialer'](_0x236618)[_0x255d('0x9b')](loggerCatch(_0x255d('0x134')));}}}};Dialer[_0x255d('0x18')][_0x255d('0xa')]=function(_0x44f227){var _0x5702fa=this;if(!_0x5702fa[_0x255d('0x2c')][_0x44f227[_0x255d('0x4c')]]){_0x5702fa[_0x255d('0x2c')][_0x44f227[_0x255d('0x4c')]]={'running':![]};}else if(_0x5702fa[_0x255d('0x2c')][_0x44f227[_0x255d('0x4c')]][_0x255d('0x13b')]===!![]){return;}else if(_0x5702fa[_0x255d('0x2c')][_0x44f227[_0x255d('0x4c')]]['running']===![]){_0x5702fa[_0x255d('0x2c')][_0x44f227[_0x255d('0x4c')]][_0x255d('0x13b')]=!![];}var _0x4e4a1e=_0x5702fa[_0x255d('0x1e')][_0x44f227['name']];var _0x1ab835=_0x4e4a1e['message']!==utils[_0x255d('0x6a')][_0x255d('0x7d')];var _0x529039=utils[_0x255d('0x13c')](_0x4e4a1e);_0x4e4a1e['statusMessage']=utils[_0x255d('0x13d')](_0x4e4a1e,_0x5702fa['trunks']);Promise[_0x255d('0xa5')]()[_0x255d('0x45')](function(){if(_0x4e4a1e[_0x255d('0x13e')]===utils[_0x255d('0x6a')][_0x255d('0x7d')]){if(_0x1ab835){clearPredictiveAttributes(_0x4e4a1e);_0x44f227['startPredictive']=undefined;_0x44f227[_0x255d('0x29')]=undefined;}if(_0x4e4a1e['statusMessage']===utils[_0x255d('0x6a')]['INACTIVE']){_0x44f227[_0x255d('0x13f')]=0x0;_0x44f227[_0x255d('0xf5')]=0x0;_0x44f227[_0x255d('0x140')]=0x0;_0x44f227[_0x255d('0x141')]=0x0;_0x44f227[_0x255d('0x142')]=0x0;}}else if(_0x4e4a1e[_0x255d('0x13e')]===utils['CAMPAIGN_STATUS'][_0x255d('0x143')]&&!_0x529039){return _0x5702fa[_0x255d('0x8d')](_0x4e4a1e,!![])[_0x255d('0x45')](function(){return _0x5702fa['ifTime'](_0x4e4a1e,![]);})[_0x255d('0x45')](function(){return _0x5702fa['checkDialMethod'](_0x4e4a1e);})[_0x255d('0x9b')](function(_0x79164d){loggerSyncQueueSummary[_0x255d('0x64')](_0x255d('0x144'),util['inspect'](_0x79164d,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4e4a1e);});}else{clearPredictiveAttributes(_0x4e4a1e);}})[_0x255d('0x45')](function(){var _0x17e433=_0x44f227[_0x255d('0x145')](_0x4e4a1e);if(_0x17e433||_0x4e4a1e['queueSummaryCountersUpdated']){_0x4e4a1e[_0x255d('0x146')]=![];_0x44f227['updateReportFromOutboundQueue'](_0x4e4a1e);Object[_0x255d('0x147')](_0x4e4a1e,_0x44f227);emitOutboundVoiceQueueSummary(_0x44f227);}_0x5702fa['queuesSummary'][_0x4e4a1e[_0x255d('0x4c')]][_0x255d('0x13b')]=![];})[_0x255d('0x9b')](function(_0x52eaeb){logger[_0x255d('0x66')](_0x255d('0x144'),util['inspect'](_0x52eaeb,{'showHidden':![],'depth':null}));_0x5702fa[_0x255d('0x2c')][_0x4e4a1e['name']][_0x255d('0x13b')]=![];});};Dialer[_0x255d('0x18')][_0x255d('0x38')]=_[_0x255d('0x148')](function(){var _0x475b73=_[_0x255d('0x149')](this[_0x255d('0x1e')],function(_0x12cafc){return _0x12cafc['dialPreviewRecallmeReminder'];});var _0x17f942=_[_0x255d('0x149')](this[_0x255d('0x20')],function(_0xd62c84){return _0xd62c84['online']&&_0xd62c84[_0x255d('0x84')]===_0x255d('0x14a');});if(_0x475b73['length']>0x0&&_0x17f942[_0x255d('0x93')]>0x0){return Promise['resolve']()[_0x255d('0x45')](cmHopper['handlePreviewRecallNotifications'](_[_0x255d('0x14b')](_0x475b73,'id'),previewRecallmeReminderInterval,_[_0x255d('0x14b')](_0x17f942,'id')))[_0x255d('0x45')](function(_0x4e6f3a){for(var _0x1caa87=0x0;_0x1caa87<_0x4e6f3a['length'];_0x1caa87++){var _0x41c0d9=_0x4e6f3a[_0x1caa87][_0x255d('0x14c')][_0x255d('0x4c')];if(_0x41c0d9)io['to'](util[_0x255d('0x4a')](_0x255d('0x14d'),_0x41c0d9))[_0x255d('0x47')](_0x255d('0x14e'),{'hopper':_0x4e6f3a[_0x1caa87]});}})[_0x255d('0x9b')](function(_0x622203){logger[_0x255d('0x66')](_0x255d('0x14f'),_0x622203);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x255d('0x43')]=function(){var _0x51f56a=this;setInterval(function(){_0x51f56a['clearZombieChannels'](_0x51f56a[_0x255d('0x26')],'[uniqueid]');_0x51f56a[_0x255d('0x150')](_0x51f56a[_0x255d('0x24')],_0x255d('0x151'));},0x32c8);};Dialer[_0x255d('0x18')][_0x255d('0x150')]=function(_0x27295f,_0x237ac9){var _0x4ab867=this;for(var _0x482522 in _0x27295f){if(typeof _0x27295f[_0x482522]!=='undefined'){this[_0x255d('0x1c')][_0x255d('0x19')](function(){if(!_['isNil'](_0x27295f[_0x482522])){return ami[_0x255d('0x95')]({'action':_0x255d('0x84'),'channel':_0x27295f[_0x482522][_0x255d('0xef')]})[_0x255d('0x9b')](function(_0x16fe22){if(_0x16fe22[_0x255d('0x69')]===_0x255d('0x152')){setTimeout(function(){if(_0x27295f[_0x482522]&&_0x27295f[_0x482522][_0x255d('0xba')]!==_0x255d('0xbb')){utils[_0x255d('0xbc')](_0x4ab867[_0x255d('0x1e')][_0x27295f[_0x482522][_0x255d('0xb8')]],'[clearZombieChannels]');logger['error'](_0x255d('0x153'),_0x237ac9,_0x482522,_0x27295f[_0x482522][_0x255d('0xb8')]);delete _0x27295f[_0x482522];}if(_0x27295f[_0x482522]&&_0x27295f[_0x482522][_0x255d('0xba')]==='ivr'){utils['decrementOriginate'](_0x4ab867[_0x255d('0x1f')][_0x27295f[_0x482522]['queue']],_0x255d('0x154'));logger[_0x255d('0x66')](_0x255d('0x155'),_0x237ac9,_0x482522,_0x27295f[_0x482522][_0x255d('0xb8')]);delete _0x27295f[_0x482522];}},0x2328);}});}});}}};Dialer[_0x255d('0x18')][_0x255d('0x156')]=function(_0xfea421){return Promise['resolve']()['then'](voiceQueueRt[_0x255d('0x156')](_0xfea421))[_0x255d('0x9b')](loggerCatch(_0x255d('0x157')));};Dialer[_0x255d('0x18')]['emptyContact']=function(_0x1b9cdb,_0x1728a1,_0x1b2f7f){var _0x81516b={'state':0x19,'statedesc':_0x255d('0x158')};utils[_0x255d('0xbc')](_0x1728a1,_0x255d('0x159')+_0x1b9cdb);this[_0x255d('0x118')](_['merge'](_0x81516b,_[_0x255d('0x72')](_0x1b2f7f,['ContactId',_0x255d('0xdc'),'UserId',_0x255d('0xdd'),_0x255d('0xde')])),_0x255d('0x15a'),_0x255d('0x159'));logger['error'](_0x1b9cdb);};Dialer[_0x255d('0x18')][_0x255d('0x118')]=function(_0x1ffc53,_0x5e415d,_0xfa1ae2){hopperUtils['createHistory'](_0x1ffc53)[_0x255d('0x9b')](loggerCatch(_0x5e415d));hopperUtils[_0x255d('0xc7')](_0x1ffc53)[_0x255d('0x9b')](loggerCatch(_0xfa1ae2));};Dialer['prototype'][_0x255d('0xd5')]=function(_0x16dfb8,_0x5e7c54){hopperUtils['createHistory'](_0x16dfb8)[_0x255d('0x9b')](loggerCatch(_0x255d('0xc6')));if(_0x5e7c54==0x0){hopperUtils[_0x255d('0xc7')](_0x16dfb8)['catch'](loggerCatch(_0x255d('0x15b')));}};Dialer[_0x255d('0x18')][_0x255d('0x14f')]=function(_0xda6757){return Promise[_0x255d('0xa5')]()[_0x255d('0x45')](cmHopper['handlePreviewRecallNotifications'](_0xda6757['id'],previewRecallmeReminderInterval))[_0x255d('0x45')](function(_0x30b256){for(var _0xfb0607=0x0;_0xfb0607<_0x30b256['length'];_0xfb0607++){var _0x16f353=_0x30b256[_0xfb0607][_0x255d('0x14c')][_0x255d('0x4c')];if(_0x16f353)io['to'](util[_0x255d('0x4a')]('user:%s',_0x16f353))[_0x255d('0x47')](_0x255d('0x14e'),{'hopper':_0x30b256[_0xfb0607]});}})[_0x255d('0x9b')](function(){});};Dialer[_0x255d('0x18')][_0x255d('0xa9')]=function(_0xbc656f){var _0x22bad4=this;return function(){_0x22bad4[_0x255d('0x15c')](_0xbc656f);};};Dialer[_0x255d('0x18')][_0x255d('0x15d')]=function(_0x382831,_0x53593d){var _0xbb41aa=this;var _0xfa90b0=uuid['v4']();this[_0x255d('0x24')][_0xfa90b0]=new Action(_0x382831,_0x53593d,_0xfa90b0);return new Promise(function(_0x2e2786,_0x4e3bae){if(_[_0x255d('0x59')](_0x382831)&&typeof _0x382831!==_0x255d('0x15e')){return _0x4e3bae(msgResponse(_0x255d('0x15f'),_0x255d('0x8e'),_0x255d('0x160')));}if(_[_0x255d('0x59')](_0x53593d['phone'])||_0x53593d[_0x255d('0x161')]===null){return _0x4e3bae(msgResponse(_0x255d('0x15f'),_0x255d('0x8e'),_0x255d('0x162')));}var _0xdaee5e={'XMD-CALLERID':_0xbb41aa['actions'][_0xfa90b0][_0x255d('0x163')](),'XMD-AGI':_0x382831[_0x255d('0x164')]?util[_0x255d('0x4a')](_0x255d('0x165'),ipAgi,_0x382831[_0x255d('0x164')]):'NONE','XMD-AGIAFTER':_0x382831['dialQueueProject2']?util[_0x255d('0x4a')](_0x255d('0x165'),ipAgi,_0x382831[_0x255d('0xc4')]):_0x255d('0x166'),'XMD-QUEUE':utils[_0x255d('0x167')](_0x382831)?util[_0x255d('0x4a')](_0x255d('0x168'),_0x382831[_0x255d('0x4c')],_0x382831[_0x255d('0x169')]||'',_0x382831['dialAgiAfterHangupAgent']?'c':'',_0x382831[_0x255d('0xcb')]||0x3):_0x255d('0x166'),'XMD-CONTACTID':_0x53593d[_0x255d('0xdb')],'XMD-CDRTYPE':_0x255d('0x7'),'CALLERID(all)':_0xbb41aa[_0x255d('0x24')][_0xfa90b0]['getCaller'](),'XMD-AMD':_0x382831[_0x255d('0x110')]?_0x255d('0x143'):_0x255d('0x166'),'XMD-DESTINATION':_0x255d('0x16a')};if(_0x382831[_0x255d('0x110')]){_0xdaee5e['XMD-AMDINITIALSILENCE']=_0x382831[_0x255d('0x16b')]||0x9c4;_0xdaee5e['XMD-AMDGREETING']=_0x382831['dialAMDGreeting']||0x5dc;_0xdaee5e['XMD-AMDAFTERGREETINGSILENCE']=_0x382831['dialAMDAfterGreetingSilence']||0x320;_0xdaee5e['XMD-AMDTOTALANALYSISTIME']=_0x382831['dialAMDTotalAnalysisTime']||0x1388;_0xdaee5e[_0x255d('0x16c')]=_0x382831[_0x255d('0x16d')]||0x64;_0xdaee5e[_0x255d('0x16e')]=_0x382831['dialAMDBetweenWordsSilence']||0x32;_0xdaee5e[_0x255d('0x16f')]=_0x382831[_0x255d('0x170')]||0x3;_0xdaee5e[_0x255d('0x171')]=_0x382831['dialAMDSilenceThreshold']||0x100;_0xdaee5e[_0x255d('0x172')]=_0x382831[_0x255d('0x173')]||0x1388;}if(utils[_0x255d('0x167')](_0x382831)){_0xdaee5e['XMD-VOICEQUEUEID']=_0x53593d[_0x255d('0xdd')];}else{_0xdaee5e[_0x255d('0x174')]=_0x53593d[_0x255d('0xde')];}var _0x2d7129=utils[_0x255d('0x175')](_0x53593d[_0x255d('0x176')]);Object[_0x255d('0x147')](_0xdaee5e,_0x2d7129);var _0x1957ef=_0xbb41aa[_0x255d('0x87')](_0x382831[_0x255d('0x177')])?utils[_0x255d('0x178')](_0x382831[_0x255d('0x177')]['callerid'],_0x382831[_0x255d('0x179')],_0x382831[_0x255d('0x17a')]>0x0?utils['getCallerIdRandom'](_0x382831[_0x255d('0x17b')],_0x382831[_0x255d('0x17a')]):_0x382831[_0x255d('0x17b')]):utils[_0x255d('0x178')](_[_0x255d('0xf7')](_0x382831['TrunkBackup'])?_0x382831['Trunk']['callerid']:_0x382831['TrunkBackup'][_0x255d('0x17c')],_0x382831[_0x255d('0x179')],_0x382831[_0x255d('0x17a')]>0x0?utils[_0x255d('0x17d')](_0x382831[_0x255d('0x17b')],_0x382831[_0x255d('0x17a')]):_0x382831[_0x255d('0x17b')]);if(_0x1957ef){_0xdaee5e[_0x255d('0x17e')]=_0xbb41aa[_0x255d('0x24')][_0xfa90b0][_0x255d('0x17f')]=utils['extractCalleridName'](_0x1957ef);_0xdaee5e['XMD-ORIGINATECALLERIDNUM']=_0x53593d['phone'];}_0x382831[_0x255d('0x180')]=_0xdaee5e;return ami['Action']({'actionid':_0xfa90b0,'action':_0x255d('0x15f'),'channel':_0xbb41aa[_0x255d('0x87')](_0x382831[_0x255d('0x177')])?util[_0x255d('0x4a')](_0x255d('0x181'),_0x382831[_0x255d('0x177')][_0x255d('0x4c')],isNotNull(_0x382831[_0x255d('0x182')])?_0x382831['dialPrefix'][_0x255d('0x183')]()||'':'',_0x382831[_0x255d('0x184')]>0x0?_0x53593d[_0x255d('0x161')][_0x255d('0x185')](_0x382831[_0x255d('0x184')]):_0x53593d['phone']):util[_0x255d('0x4a')]('SIP/%s/%s%s',_[_0x255d('0xf7')](_0x382831[_0x255d('0x88')])?_0x382831[_0x255d('0x177')][_0x255d('0x4c')]:_0x382831[_0x255d('0x88')]['name'],isNotNull(_0x382831[_0x255d('0x182')])?_0x382831['dialPrefix'][_0x255d('0x183')]()||'':'',_0x382831[_0x255d('0x184')]>0x0?_0x53593d[_0x255d('0x161')][_0x255d('0x185')](_0x382831[_0x255d('0x184')]):_0x53593d[_0x255d('0x161')]),'callerid':_0x1957ef,'Exten':_0x255d('0x16a'),'Context':_0x255d('0x186'),'Priority':'1','variable':_0xdaee5e,'timeout':(_0x382831[_0x255d('0x187')]||0x1e)*0x3e8,'async':!![],'channelid':_0xfa90b0})['then'](function(_0x57515b){return _0x2e2786(_0x57515b);})[_0x255d('0x9b')](function(_0xca1ef){_0x382831['outboundOriginateFailureCallsDay']+=0x1;var _0x37f57f=new History(_0xbb41aa[_0x255d('0x24')][_0xfa90b0]);logger['error'](util[_0x255d('0x4a')](_0x255d('0x188'),JSON[_0x255d('0x81')](_0xca1ef)));_0x37f57f[_0x255d('0xcd')]=0xe;_0x37f57f[_0x255d('0xce')]=_0x255d('0x189');_0x37f57f[_0x255d('0xe0')]=moment()['format'](_0x255d('0xbf'));_0x37f57f[_0x255d('0xe1')]=_0x37f57f[_0x255d('0xe0')];hopperUtils['createHistory'](_0x37f57f)[_0x255d('0x9b')](loggerCatch('[originate][error]'));_0xbb41aa[_0x255d('0xc7')](_0x37f57f)[_0x255d('0x9b')](loggerCatch(_0x255d('0x18a')))[_0x255d('0x1b')](function(){delete _0xbb41aa[_0x255d('0x24')][_0xfa90b0];return _0x4e3bae(msgResponse(_0x255d('0x15f'),_0x255d('0xb7'),_0x255d('0x18b')));});});});};Dialer[_0x255d('0x18')]['checkRetriveMax']=function(_0x1d813c,_0x4e3c3b,_0x29311e){var _0x5a6412=new History(_0x4e3c3b);if(_0x5a6412[_0x255d('0x120')]+_0x5a6412[_0x255d('0x121')]+_0x5a6412['countnoanswerretry']+_0x5a6412[_0x255d('0x12c')]+_0x5a6412[_0x255d('0xd7')]+_0x5a6412[_0x255d('0xec')]+_0x5a6412[_0x255d('0x11d')]+_0x5a6412[_0x255d('0x12d')]>=_0x29311e['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x1d813c){case 0x3:if(_0x5a6412[_0x255d('0x18c')]>=_0x29311e[_0x255d('0x18d')]-0x1){return!![];}hopperUtils[_0x255d('0xd6')]({'active':![],'countnoanswerretry':_0x5a6412['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x255d('0xd8')](_0x29311e[_0x255d('0x18e')],_0x255d('0xda'))[_0x255d('0x4a')](_0x255d('0xbf')),'ContactId':_0x5a6412[_0x255d('0xdb')],'ListId':_0x5a6412[_0x255d('0xdc')],'VoiceQueueId':_0x5a6412[_0x255d('0xdd')]||undefined,'CampaignId':_0x5a6412[_0x255d('0xde')]||undefined})[_0x255d('0x9b')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x5a6412[_0x255d('0x120')]>=_0x29311e[_0x255d('0x18f')]-0x1){return!![];}hopperUtils[_0x255d('0xd6')]({'active':![],'countbusyretry':_0x5a6412[_0x255d('0x120')]+=0x1,'scheduledat':moment()[_0x255d('0xd8')](_0x29311e['dialBusyRetryFrequency'],_0x255d('0xda'))['format'](_0x255d('0xbf')),'ContactId':_0x5a6412[_0x255d('0xdb')],'ListId':_0x5a6412[_0x255d('0xdc')],'VoiceQueueId':_0x5a6412[_0x255d('0xdd')]||undefined,'CampaignId':_0x5a6412['CampaignId']||undefined})[_0x255d('0x9b')](loggerCatch(_0x255d('0x190')));break;case 0x8:if(_0x5a6412[_0x255d('0x121')]>=_0x29311e[_0x255d('0x191')]-0x1){return!![];}hopperUtils[_0x255d('0xd6')]({'active':![],'countcongestionretry':_0x5a6412[_0x255d('0x121')]+=0x1,'scheduledat':moment()['add'](_0x29311e[_0x255d('0x192')],'minutes')[_0x255d('0x4a')](_0x255d('0xbf')),'ContactId':_0x5a6412[_0x255d('0xdb')],'ListId':_0x5a6412[_0x255d('0xdc')],'VoiceQueueId':_0x5a6412[_0x255d('0xdd')]||undefined,'CampaignId':_0x5a6412[_0x255d('0xde')]||undefined})[_0x255d('0x9b')](loggerCatch(_0x255d('0x193')));break;case 0x0:if(_0x5a6412[_0x255d('0x12c')]>=_0x29311e[_0x255d('0x194')]-0x1){return!![];}else{hopperUtils[_0x255d('0xd6')]({'active':![],'countnosuchnumberretry':_0x5a6412[_0x255d('0x12c')]+=0x1,'scheduledat':moment()['add'](_0x29311e[_0x255d('0x195')],_0x255d('0xda'))[_0x255d('0x4a')](_0x255d('0xbf')),'ContactId':_0x5a6412[_0x255d('0xdb')],'ListId':_0x5a6412[_0x255d('0xdc')],'VoiceQueueId':_0x5a6412[_0x255d('0xdd')]||undefined,'CampaignId':_0x5a6412[_0x255d('0xde')]||undefined})[_0x255d('0x9b')](loggerCatch(_0x255d('0x196')));}break;case 0xa:if(_0x5a6412[_0x255d('0xd7')]>=_0x29311e[_0x255d('0xd4')]-0x1){return!![];}hopperUtils[_0x255d('0xd6')]({'active':![],'countdropretry':_0x5a6412[_0x255d('0xd7')]+=0x1,'scheduledat':moment()['add'](_0x29311e[_0x255d('0xd9')],'minutes')[_0x255d('0x4a')](_0x255d('0xbf')),'ContactId':_0x5a6412[_0x255d('0xdb')],'ListId':_0x5a6412['ListId'],'VoiceQueueId':_0x5a6412[_0x255d('0xdd')]||undefined,'CampaignId':_0x5a6412[_0x255d('0xde')]||undefined})[_0x255d('0x9b')](loggerCatch(_0x255d('0xdf')));break;case 0xb:if(_0x5a6412[_0x255d('0xec')]>=_0x29311e[_0x255d('0x197')]-0x1){return!![];}hopperUtils[_0x255d('0xd6')]({'active':![],'countabandonedretry':_0x5a6412['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x29311e[_0x255d('0xe9')],'minutes')[_0x255d('0x4a')](_0x255d('0xbf')),'ContactId':_0x5a6412[_0x255d('0xdb')],'ListId':_0x5a6412[_0x255d('0xdc')],'VoiceQueueId':_0x5a6412[_0x255d('0xdd')]||undefined,'CampaignId':_0x5a6412[_0x255d('0xde')]||undefined})['catch'](loggerCatch(_0x255d('0xed')));break;case 0x13:if(_0x5a6412['countmachineretry']>=_0x29311e['dialMachineMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x5a6412[_0x255d('0x11d')]+=0x1,'scheduledat':moment()[_0x255d('0xd8')](_0x29311e[_0x255d('0x127')],_0x255d('0xda'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5a6412[_0x255d('0xdb')],'ListId':_0x5a6412[_0x255d('0xdc')],'VoiceQueueId':_0x5a6412[_0x255d('0xdd')]||undefined,'CampaignId':_0x5a6412[_0x255d('0xde')]||undefined})['catch'](loggerCatch(_0x255d('0x12f')));break;case 0x14:if(_0x5a6412['countagentrejectretry']>=_0x29311e[_0x255d('0x198')]-0x1){return!![];}hopperUtils[_0x255d('0xd6')]({'active':![],'countagentrejectretry':_0x5a6412[_0x255d('0x12d')]+=0x1,'scheduledat':moment()[_0x255d('0xd8')](_0x29311e['dialAgentRejectRetryFrequency'],_0x255d('0xda'))[_0x255d('0x4a')](_0x255d('0xbf')),'ContactId':_0x5a6412[_0x255d('0xdb')],'ListId':_0x5a6412[_0x255d('0xdc')],'VoiceQueueId':_0x5a6412['VoiceQueueId']||undefined,'CampaignId':_0x5a6412[_0x255d('0xde')]||undefined})[_0x255d('0x9b')](loggerCatch(_0x255d('0x199')));break;default:return!![];}};Dialer[_0x255d('0x18')][_0x255d('0x10c')]=function(_0x58749d,_0x26e18f,_0x33c945){var _0x2dd89c=this;var _0x2352ad=new History(_0x58749d);var _0x1279a3=![];var _0x17e4a5;var _0x22a9af;return new Promise(function(_0x77e54c,_0xbf44f7){if(_[_0x255d('0x59')](_0x26e18f)&&typeof _0x26e18f!==_0x255d('0x15e')){return _0xbf44f7(msgResponse(_0x255d('0x19a'),_0x255d('0x8e'),_0x255d('0x19b')));}if(_['isUndefined'](_0x33c945)&&typeof _0x33c945!==_0x255d('0x15e')){return _0xbf44f7(msgResponse('[callProgressDetecting]',_0x255d('0x8e'),_0x255d('0x19c')));}hopperUtils[_0x255d('0xd2')](_0x2352ad,_0x33c945['reason'],_0x26e18f)[_0x255d('0x45')](function(_0x53fa15){if(_0x53fa15[_0x255d('0xeb')]==0x1)_0x1279a3=!![];switch(_0x33c945[_0x255d('0xc1')]){case'0':_0x26e18f[_0x255d('0x19d')]+=0x1;_0x2352ad['state']=0x0;_0x2352ad[_0x255d('0xce')]=_0x255d('0x19e');_0x2352ad[_0x255d('0x12c')]+=0x1;_0x2352ad['countglobal']+=0x1;ami[_0x255d('0x47')](_0x255d('0x19f'),ut[_0x255d('0x117')](_0x58749d,_0x255d('0x1a0')));_0x17e4a5=_0x26e18f[_0x255d('0x195')];_0x22a9af=_0x26e18f[_0x255d('0xea')];hopperUtils[_0x255d('0xe4')](_0x2352ad)[_0x255d('0x9b')](loggerCatch(_0x255d('0x11f')));if(_0x2dd89c['checkRetriveMax'](0x0,_0x58749d,_0x26e18f)&&!_0x1279a3){if(_0x2352ad[_0x255d('0x12c')]>=_0x26e18f[_0x255d('0x194')]){_0x2dd89c[_0x255d('0x125')](_0x2352ad,_0x77e54c,_0xbf44f7,_0x255d('0x1a1'));}else{_0x2dd89c[_0x255d('0x122')](_0x2352ad,_0x77e54c,_0xbf44f7,_0x255d('0x1a1'));}}break;case'3':_0x26e18f[_0x255d('0x1a2')]+=0x1;_0x2352ad[_0x255d('0xcd')]=0x3;_0x2352ad[_0x255d('0xce')]=_0x255d('0x1a3');_0x2352ad[_0x255d('0x18c')]+=0x1;_0x2352ad[_0x255d('0xd1')]+=0x1;var _0x154932=ut[_0x255d('0x1a4')](_0x58749d,_0x26e18f);ami[_0x255d('0x47')](_0x255d('0x1a5'),_0x154932);_0x17e4a5=_0x26e18f['dialNoAnswerRetryFrequency'];_0x22a9af=_0x26e18f[_0x255d('0xea')];hopperUtils['createHistory'](_0x2352ad)['catch'](loggerCatch(_0x255d('0x1a6')));if(_0x2dd89c[_0x255d('0x1a7')](0x3,_0x58749d,_0x26e18f)&&!_0x1279a3){if(_0x2352ad['countnoanswerretry']>=_0x26e18f[_0x255d('0x18d')]){_0x2dd89c['createStateFinal'](_0x2352ad,_0x77e54c,_0xbf44f7,_0x255d('0x1a8'));}else{_0x2dd89c[_0x255d('0x122')](_0x2352ad,_0x77e54c,_0xbf44f7,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x26e18f['outboundBusyCallsDay']+=0x1;_0x2352ad['state']=0x5;_0x2352ad[_0x255d('0xce')]=_0x255d('0x1a9');_0x2352ad[_0x255d('0x120')]+=0x1;_0x2352ad[_0x255d('0xd1')]+=0x1;ami['emit'](_0x255d('0x1aa'),ut['buildObj'](_0x58749d,'busy'));_0x17e4a5=_0x26e18f['dialBusyRetryFrequency'];_0x22a9af=_0x26e18f[_0x255d('0xea')];hopperUtils[_0x255d('0xe4')](_0x2352ad)['catch'](loggerCatch(_0x255d('0x1ab')));if(_0x2dd89c['checkRetriveMax'](0x5,_0x58749d,_0x26e18f)&&!_0x1279a3){if(_0x2352ad[_0x255d('0x120')]>=_0x26e18f['dialBusyMaxRetry']){_0x2dd89c[_0x255d('0x125')](_0x2352ad,_0x77e54c,_0xbf44f7,'reason\x205\x20busy');}else{_0x2dd89c[_0x255d('0x122')](_0x2352ad,_0x77e54c,_0xbf44f7,'reason\x205\x20busy');}}break;case'8':_0x26e18f[_0x255d('0x1ac')]+=0x1;_0x2352ad[_0x255d('0xcd')]=0x8;_0x2352ad[_0x255d('0xce')]=_0x255d('0x1ad');_0x2352ad[_0x255d('0x121')]+=0x1;_0x2352ad[_0x255d('0xd1')]+=0x1;_0x17e4a5=_0x26e18f[_0x255d('0x192')];_0x22a9af=_0x26e18f[_0x255d('0xea')];ami[_0x255d('0x47')]('custom:agentcongestion',ut[_0x255d('0x117')](_0x58749d,'congestion'));hopperUtils[_0x255d('0xe4')](_0x2352ad)[_0x255d('0x9b')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x2dd89c[_0x255d('0x1a7')](0x8,_0x58749d,_0x26e18f)&&!_0x1279a3){if(_0x2352ad[_0x255d('0x121')]>=_0x26e18f[_0x255d('0x191')]){_0x2dd89c[_0x255d('0x125')](_0x2352ad,_0x77e54c,_0xbf44f7,_0x255d('0x1ae'));}else{_0x2dd89c[_0x255d('0x122')](_0x2352ad,_0x77e54c,_0xbf44f7,_0x255d('0x1ae'));}}break;case'11':_0x26e18f['outboundAbandonedCallsDay']+=0x1;_0x2352ad[_0x255d('0xcd')]=0xb;_0x2352ad[_0x255d('0xce')]=_0x255d('0xe7');_0x2352ad[_0x255d('0xec')]+=0x1;_0x2352ad['countglobal']+=0x1;_0x17e4a5=_0x26e18f[_0x255d('0xe9')];_0x22a9af=_0x26e18f[_0x255d('0xea')];hopperUtils[_0x255d('0xe4')](_0x2352ad)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x2dd89c[_0x255d('0x1a7')](0xb,_0x58749d,_0x26e18f)&&!_0x1279a3){if(_0x2352ad[_0x255d('0xec')]>=_0x26e18f[_0x255d('0x197')]){_0x2dd89c[_0x255d('0x125')](_0x2352ad,_0x77e54c,_0xbf44f7,_0x255d('0x1af'));}else{_0x2dd89c[_0x255d('0x122')](_0x2352ad,_0x77e54c,_0xbf44f7,'reason\x2011\x20abandoned');}}break;case'20':_0x26e18f[_0x255d('0x1b0')]+=0x1;_0x2352ad[_0x255d('0xcd')]=0x14;_0x2352ad[_0x255d('0xce')]='AgentReject';_0x2352ad[_0x255d('0x12d')]+=0x1;_0x2352ad['countglobal']+=0x1;_0x17e4a5=_0x26e18f['dialAgentRejectRetryFrequency'];_0x22a9af=_0x26e18f[_0x255d('0xea')];ami[_0x255d('0x47')](_0x255d('0x1b1'),ut[_0x255d('0x117')](_0x58749d,_0x255d('0x1b2')));hopperUtils[_0x255d('0xe4')](_0x2352ad)[_0x255d('0x9b')](loggerCatch(_0x255d('0x1b3')));if(_0x2dd89c['checkRetriveMax'](0x14,_0x58749d,_0x26e18f)&&!_0x1279a3){if(_0x2352ad[_0x255d('0x12d')]>=_0x26e18f['dialAgentRejectMaxRetry']){_0x2dd89c['createStateFinal'](_0x2352ad,_0x77e54c,_0xbf44f7,'reason\x2020\x20agentreject');}else{_0x2dd89c[_0x255d('0x122')](_0x2352ad,_0x77e54c,_0xbf44f7,_0x255d('0x1b4'));}}break;default:_0x26e18f[_0x255d('0x138')]+=0x1;_0x2352ad[_0x255d('0xcd')]=0xc;_0x2352ad[_0x255d('0xce')]=_0x33c945['reason'];_0x17e4a5=_0x26e18f[_0x255d('0x1b5')];_0x22a9af=_0x26e18f[_0x255d('0xea')];hopperUtils[_0x255d('0xe4')](_0x2352ad)[_0x255d('0x9b')](loggerCatch(_0x255d('0x1b6')));if(_0x2dd89c[_0x255d('0x1a7')](_0x33c945[_0x255d('0xc1')],_0x58749d,_0x26e18f)&&!_0x1279a3){if(_0x2352ad['countbusyretry']+_0x2352ad[_0x255d('0x121')]+_0x2352ad[_0x255d('0x18c')]+_0x2352ad[_0x255d('0x12c')]+_0x2352ad[_0x255d('0xd7')]+_0x2352ad[_0x255d('0xec')]+_0x2352ad[_0x255d('0x11d')]+_0x2352ad[_0x255d('0x12d')]>=_0x26e18f[_0x255d('0x12e')]){_0x2dd89c[_0x255d('0x122')](_0x2352ad,_0x77e54c,_0xbf44f7,_0x33c945[_0x255d('0xc1')]);}else{_0x2dd89c[_0x255d('0x125')](_0x2352ad,_0x77e54c,_0xbf44f7,_0x33c945[_0x255d('0xc1')]);}}}})[_0x255d('0x45')](function(){if(_0x1279a3){hopperUtils[_0x255d('0xe6')](_0x2352ad,_0x17e4a5,_0x22a9af)[_0x255d('0x45')](function(){return _0x77e54c(0x1);});}});});};Dialer[_0x255d('0x18')]['stateGlobal']=function(_0x5229b2,_0x1ef24d,_0x32b39b,_0x4f05bd){var _0x3df1b9=new Final(_0x5229b2);_0x3df1b9['state']=0xf;_0x3df1b9[_0x255d('0xce')]=_0x255d('0x1b7');this['createStateFinal'](_0x3df1b9,_0x1ef24d,_0x32b39b,_0x4f05bd);};Dialer[_0x255d('0x18')][_0x255d('0x125')]=function(_0x22aea9,_0x28bb61,_0x4aa54d,_0x2b395e){hopperUtils[_0x255d('0xc7')](_0x22aea9)[_0x255d('0x45')](function(){return _0x28bb61(msgResponse(_0x255d('0x19a'),_0x255d('0x10a'),_0x2b395e));})[_0x255d('0x9b')](function(){return _0x4aa54d(msgResponse(_0x255d('0x1b8'),_0x255d('0x8e'),'contact\x20not\x20moved'));});};Dialer['prototype']['predictive']=function(_0x27d888){var _0x1b3fe5=_0x27d888[_0x255d('0x1b9')]/0x64;var _0x29c819=_0x27d888['outboundDropCallsDayTimeout']/(_0x27d888[_0x255d('0x1ba')]+_0x27d888[_0x255d('0xc0')]);var _0x10c1e9=Math['round'](_0x27d888[_0x255d('0x1bb')]*(_0x27d888[_0x255d('0x1bc')]/0x64));var _0x5e1847=Math[_0x255d('0x1bd')](_0x27d888[_0x255d('0x1bb')]*(_0x27d888[_0x255d('0x1be')]/0x64));var _0x4290ab=_0x27d888['available']+_0x27d888[_0x255d('0x141')];var _0x590f50=Math[_0x255d('0x1bf')](_0x27d888[_0x255d('0x5e')]*_0x27d888[_0x255d('0x60')]*_0x27d888[_0x255d('0x1c0')]*_0x27d888[_0x255d('0x1c1')]);if(_[_0x255d('0x59')](_0x27d888[_0x255d('0x29')])){if(!_[_0x255d('0x59')](_0x27d888[_0x255d('0x28')])){_0x27d888[_0x255d('0x28')]=undefined;loggerPredictive[_0x255d('0x66')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x255d('0x59')](_0x27d888[_0x255d('0x65')])){loggerPredictive[_0x255d('0x66')](_0x255d('0x1c2'),_0x255d('0x1c3'));clearInterval(_0x27d888[_0x255d('0x65')]);_0x27d888[_0x255d('0x65')]=undefined;}_0x27d888['startProgressive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x255d('0x50')](_0x27d888['name'],_0x255d('0x1c4'),_0x27d888[_0x255d('0x29')]);this[_0x255d('0xaf')](_0x27d888,0x1);}else if(ifInterval(_0x27d888[_0x255d('0x1c5')],_0x27d888['startProgressive'])){this[_0x255d('0xaf')](_0x27d888,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x27d888[_0x255d('0x29')],_0x27d888['name']);_0x27d888[_0x255d('0x5e')]=0x0;_0x27d888[_0x255d('0x1c6')]=0x0;}else if(_0x1b3fe5<_0x29c819&&_0x27d888[_0x255d('0x1c7')]===_0x255d('0x1c8')){clearPredictiveAttributes(_0x27d888);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x255d('0x1c9'),_0x29c819,_0x255d('0x29'),_0x27d888[_0x255d('0x4c')]);}else if(_0x590f50<_0x27d888[_0x255d('0x1c6')]&&_0x27d888[_0x255d('0x1c7')]==='dropRate'){clearPredictiveAttributes(_0x27d888);loggerPredictive[_0x255d('0x50')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x255d('0x1ca'),_0x590f50,_0x255d('0x1cb'),_0x27d888[_0x255d('0x1c6')],_0x255d('0x29'),_0x27d888[_0x255d('0x4c')]);}else if(!ifInterval(_0x27d888[_0x255d('0x1c5')],_0x27d888[_0x255d('0x29')])&&_['isUndefined'](_0x27d888[_0x255d('0x28')])&&!_[_0x255d('0x59')](_0x27d888[_0x255d('0x29')])){_0x27d888[_0x255d('0x28')]=moment()['format'](_0x255d('0xbf'));loggerPredictive[_0x255d('0x50')](_0x27d888['name'],_0x255d('0x1cc'),_0x27d888['startPredictive']);hopperUtils['avgHandleTime'](_0x27d888['dialPredictiveInterval'])[_0x255d('0x45')](this[_0x255d('0x1cd')](_0x27d888))[_0x255d('0x45')](mergeDataErlangB(_0x27d888))[_0x255d('0x45')](this[_0x255d('0x1ce')](_0x27d888))[_0x255d('0x9b')](loggerCatchPredictive(_0x255d('0x1cf'),_0x27d888));}else if(!ifInterval(_0x27d888[_0x255d('0x1c5')],_0x27d888[_0x255d('0x28')])){_0x27d888[_0x255d('0x1c6')]=0x0;_0x27d888[_0x255d('0x28')]=moment()[_0x255d('0x4a')](_0x255d('0xbf'));loggerPredictive['info'](_0x27d888['name'],'recalculate\x20predictive\x20at',_0x27d888[_0x255d('0x28')]);clearInterval(_0x27d888[_0x255d('0x65')]);_0x27d888[_0x255d('0x65')]=undefined;hopperUtils['avgHandleTime'](_0x27d888[_0x255d('0x1c5')])[_0x255d('0x45')](this[_0x255d('0x1cd')](_0x27d888))[_0x255d('0x45')](mergeDataErlangB(_0x27d888))[_0x255d('0x45')](this[_0x255d('0x1ce')](_0x27d888))[_0x255d('0x9b')](loggerCatchPredictive(_0x255d('0x1d0'),_0x27d888));}else if(_0x27d888[_0x255d('0x1bb')]&&_0x4290ab<_0x27d888[_0x255d('0x1bb')]-_0x5e1847){clearPredictiveAttributes(_0x27d888);loggerPredictive[_0x255d('0x50')](_0x27d888['name'],_0x255d('0x1d1'),_0x4290ab,_0x255d('0x1d2'),_0x27d888['predictiveIntervalAvailable'],'-',_0x5e1847,'=',_0x27d888[_0x255d('0x1bb')]-_0x5e1847,')');}else if(_0x27d888[_0x255d('0x1bb')]&&_0x4290ab>_0x27d888[_0x255d('0x1bb')]+_0x10c1e9){clearPredictiveAttributes(_0x27d888);loggerPredictive[_0x255d('0x50')](_0x27d888[_0x255d('0x4c')],_0x255d('0x1d1'),_0x4290ab,_0x255d('0x1d3'),_0x27d888[_0x255d('0x1bb')],'+',_0x10c1e9,'=',_0x27d888[_0x255d('0x1bb')]+_0x10c1e9,')');}};Dialer[_0x255d('0x18')]['getDataPredictive']=function(_0xa988ac){var _0x1f980a=this;return function(_0x57b4bc){return new Promise(function(_0x28edf4,_0x1e6e2d){_[_0x255d('0x63')](_0xa988ac,_0x57b4bc[0x0]);if(checkGetDataPredictive(_0x57b4bc[0x0])){var _0x3ef384=_0xa988ac[_0x255d('0x1bb')]=_0xa988ac[_0x255d('0x141')]+_0xa988ac[_0x255d('0x13f')];var _0x1f1469=_0xa988ac[_0x255d('0x1c5')]*0x3c;var _0xb293ff=_0x57b4bc[0x0]['predictiveIntervalAvgTalktime']+_0x57b4bc[0x0][_0x255d('0x55')];var _0x3c9375=(_0x57b4bc[0x0][_0x255d('0x1d4')]+_0x57b4bc[0x0][_0x255d('0xcc')]+_0x57b4bc[0x0][_0x255d('0x54')])/_0x57b4bc[0x0]['predictiveIntervalTotalCalls'];_0xa988ac['predictiveIntervalHitRate']=_0x3c9375>0x0?_0x3c9375:0x1;switch(_0xa988ac['dialPredictiveOptimization']){case _0x255d('0x1c8'):var _0x1a51cd=_0xa988ac[_0x255d('0x1b9')]/0x64;return _0x1f980a['abandonmentRate'](_0x3ef384,_0x1f1469,_0xb293ff,_0x3c9375,_0x1a51cd)[_0x255d('0x45')](function(_0x1557bd){return _0x28edf4(_0x1557bd);});case _0x255d('0x1d5'):var _0xe16df2=_0xa988ac[_0x255d('0x1b9')]/0x64;return _0x1f980a['busyFactor'](_0x3ef384,_0x1f1469,_0xb293ff,_0x3c9375,_0xe16df2)[_0x255d('0x45')](function(_0x36f0f2){return _0x28edf4(_0x36f0f2);});default:return _0x1e6e2d(msgResponse('[getDataPredictive]','Failure',_0x255d('0x1d6')));}}else{return _0x1e6e2d(msgResponse('[getDataPredictive]',_0x255d('0x8e'),_0x255d('0x1d7')));}});};};Dialer[_0x255d('0x18')][_0x255d('0x1d8')]=function(_0x16c198){var _0x4a7a79=this;return function(_0x5cedfa){return new Promise(function(_0x6908c0,_0x2139ba){_[_0x255d('0x63')](_0x16c198,_0x5cedfa[0x0]);if(checkGetDataPredictive(_0x5cedfa[0x0])){loggerPredictive['info'](JSON[_0x255d('0x81')](_0x5cedfa[0x0]));if(_0x16c198['dialPredictiveOptimization']===_0x255d('0x1c8')){return _0x4a7a79['getVoiceQueueRtPauses'](_0x16c198['id'])[_0x255d('0x45')](function(_0x493528){var _0x1210d2=_0x16c198[_0x255d('0x1d9')]-_0x493528[0x0][_0x255d('0x1da')];var _0x4277dc=_0x16c198[_0x255d('0x1c5')]*0x3c;var _0x486aef=_0x5cedfa[0x0][_0x255d('0x57')]+_0x5cedfa[0x0][_0x255d('0x55')];var _0x2fd886=(_0x5cedfa[0x0]['predictiveIntervalAnsweredCalls']+_0x5cedfa[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5cedfa[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5cedfa[0x0]['predictiveIntervalTotalCalls'];var _0x37f16b=_0x16c198[_0x255d('0x1b9')]/0x64;_0x16c198['predictiveIntervalPauses']=_0x493528[0x0][_0x255d('0x1da')]||0x0;_0x16c198[_0x255d('0x1c0')]=_0x2fd886>0x0?_0x2fd886:0x1;return _0x4a7a79[_0x255d('0x1db')](_0x1210d2,_0x4277dc,_0x486aef,_0x2fd886,_0x37f16b);})[_0x255d('0x45')](function(_0xfb464d){return _0x6908c0(_0xfb464d);})['catch'](function(_0x2cbda9){return _0x2139ba(msgResponse(_0x255d('0x1dc'),'Failure',JSON[_0x255d('0x81')](_0x2cbda9)));});}if(_0x16c198[_0x255d('0x1c7')]===_0x255d('0x1d5')){return _0x4a7a79[_0x255d('0x156')](_0x16c198['id'])[_0x255d('0x45')](function(_0x1580f9){var _0xf6a82d=_0x16c198['loggedIn']-_0x1580f9[0x0][_0x255d('0x1da')];var _0x828f80=_0x16c198[_0x255d('0x1c5')]*0x3c;var _0x2b7f94=_0x5cedfa[0x0][_0x255d('0x57')]+_0x5cedfa[0x0][_0x255d('0x55')];var _0x36c4c5=(_0x5cedfa[0x0][_0x255d('0x1d4')]+_0x5cedfa[0x0][_0x255d('0xcc')]+_0x5cedfa[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5cedfa[0x0][_0x255d('0x52')];var _0xfcf4d3=_0x16c198[_0x255d('0x1b9')]/0x64;_0x16c198[_0x255d('0x1dd')]=_0x1580f9[0x0]['outboundQueuePauses']||0x0;_0x16c198[_0x255d('0x1c0')]=_0x36c4c5>0x0?_0x36c4c5:0x1;return _0x4a7a79['busyFactor'](_0xf6a82d,_0x828f80,_0x2b7f94,_0x36c4c5,_0xfcf4d3);})[_0x255d('0x45')](function(_0x5ef258){return _0x6908c0(_0x5ef258);})[_0x255d('0x9b')](function(_0x9d5709){return _0x2139ba(msgResponse(_0x255d('0x1dc'),_0x255d('0x8e'),JSON['stringify'](_0x9d5709)));});}}else{return _0x2139ba(msgResponse(_0x255d('0x1de'),_0x255d('0x8e'),_0x255d('0x1d7')));}});};};Dialer['prototype'][_0x255d('0x1ce')]=function(_0x21cb2e){var _0x18d6cd=this;return function(){var _0x13ba6f=0x0;var _0x56aff1=Math['floor'](_0x21cb2e[_0x255d('0x1df')]*0x3e8);if(_0x56aff1>0x0){_0x56aff1=_0x56aff1<0x64?0x64:_0x56aff1;loggerPredictive[_0x255d('0x50')](_0x21cb2e['name'],'one\x20call\x20every:',_0x56aff1,_0x255d('0x1e0'));_0x21cb2e['handlePredictive']=setInterval(function(){_0x18d6cd[_0x255d('0x65')](_0x21cb2e);loggerPredictiveCalls[_0x255d('0x50')]('[handlePredictive]',_0x13ba6f+=0x1);},_0x56aff1);}else{loggerPredictive[_0x255d('0x50')](_0x21cb2e[_0x255d('0x4c')],_0x255d('0x1e1'));}};};Dialer[_0x255d('0x18')]['checkContactBlack']=function(_0x4086bc,_0x1892ff){var _0x3e4c60=this;return function(_0x3bba9b){if(_['isEmpty'](_0x3bba9b)){if(_[_0x255d('0xf7')](_0x1892ff['UserId'])||!_0x1892ff[_0x255d('0x1e2')]){if(_0x4086bc[_0x255d('0xab')]===_0x255d('0x8')){_0x4086bc[_0x255d('0x6f')]=_['isUndefined'](_0x4086bc[_0x255d('0x6f')])?!![]:_0x4086bc[_0x255d('0x6f')];var _0x22342b=uuid['v4']();_0x3e4c60[_0x255d('0x24')][_0x22342b]=new Action(_0x4086bc,_0x1892ff,_0x22342b);loggerBooked[_0x255d('0x50')](_0x255d('0x1e3'),_0x22342b,_0x255d('0x1e4'),JSON[_0x255d('0x81')](_0x4086bc['queueStatusComplete']),_0x255d('0x1e5'),_0x4086bc[_0x255d('0x4c')]);if(_0x4086bc[_0x255d('0x6f')]){_0x4086bc['queueStatusComplete']=![];_0x3e4c60[_0x255d('0xf8')][_0x3e4c60[_0x255d('0x24')][_0x22342b]['queue']]=[];ami[_0x255d('0x95')]({'actionid':_0x22342b,'action':'queuestatus','queue':_0x4086bc[_0x255d('0x4c')]})[_0x255d('0x9b')](function(){utils[_0x255d('0xbc')](_0x4086bc,_0x255d('0x1e6'));hopperUtils[_0x255d('0xd6')]({'active':![],'ContactId':_0x3e4c60[_0x255d('0x24')][_0x22342b][_0x255d('0xdb')],'ListId':_0x3e4c60[_0x255d('0x24')][_0x22342b][_0x255d('0xdc')],'VoiceQueueId':_0x3e4c60[_0x255d('0x24')][_0x22342b][_0x255d('0xdd')]||undefined,'CampaignId':_0x3e4c60[_0x255d('0x24')][_0x22342b][_0x255d('0xde')]||undefined})[_0x255d('0x9b')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x3e4c60[_0x255d('0x24')][_0x22342b];});}else{loggerBooked[_0x255d('0x50')]('[booked][checkContactBlack][else]',JSON[_0x255d('0x81')](_0x4086bc[_0x255d('0x6f')]),_0x255d('0x1e5'),_0x4086bc[_0x255d('0x4c')]);utils['decrementOriginate'](_0x4086bc,_0x255d('0x1e6'));hopperUtils[_0x255d('0xd6')]({'active':![],'ContactId':_0x3e4c60[_0x255d('0x24')][_0x22342b][_0x255d('0xdb')],'ListId':_0x3e4c60['actions'][_0x22342b]['ListId'],'VoiceQueueId':_0x3e4c60['actions'][_0x22342b]['VoiceQueueId']||undefined,'CampaignId':_0x3e4c60[_0x255d('0x24')][_0x22342b]['CampaignId']||undefined})[_0x255d('0x9b')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x3e4c60['actions'][_0x22342b];}}else{return _0x3e4c60['actionOriginate'](_0x4086bc,_0x1892ff);}}else{if(utils[_0x255d('0xc9')](undefined,_0x1892ff['scheduledat'])<_0x4086bc['dialRecallMeTimeout']*0x3c){if(_0x1892ff[_0x255d('0x14c')]&&!_0x1892ff['Agent'][_0x255d('0x1e7')]){_0x3e4c60[_0x255d('0x1d')]['run'](_0x1892ff['id'])['finally'](function(){utils[_0x255d('0xbc')](_0x4086bc,_0x255d('0x1e6'));});}else{hopperUtils['unlockContact']({'active':![]},_0x1892ff['id'],0x1)['finally'](function(){utils[_0x255d('0xbc')](_0x4086bc,'[checkContactBlack]');});}}else{_0x4086bc[_0x255d('0x1e8')]+=0x1;utils[_0x255d('0xbc')](_0x4086bc,_0x255d('0x1e6'));if(_0x4086bc[_0x255d('0x1e9')]){hopperUtils[_0x255d('0xd6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1892ff[_0x255d('0xdb')],'ListId':_0x1892ff[_0x255d('0xdc')],'VoiceQueueId':_0x1892ff['VoiceQueueId']||undefined,'CampaignId':_0x1892ff[_0x255d('0xde')]||undefined})[_0x255d('0x9b')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x255d('0xe4')](createObjHistory(_0x4086bc,_0x1892ff,utils[_0x255d('0x6a')][_0x255d('0x1ea')],0x17,'RecallInQueue'))['catch'](loggerCatch(_0x255d('0x1eb')));}else{_0x3e4c60[_0x255d('0x118')](createObjHistory(_0x4086bc,_0x1892ff,utils[_0x255d('0x6a')][_0x255d('0x1ec')],0x16,'RecallFailedTimeout'),_0x255d('0x1ed'),'[Originate][HistoryRecallClose]');}}}}else{_0x4086bc['outboundBlacklistCallsDay']+=0x1;_0x3e4c60[_0x255d('0x118')](createObjHistory(_0x4086bc,_0x1892ff,utils[_0x255d('0x6a')][_0x255d('0x1ee')],0xd,_0x255d('0x1ef')),_0x255d('0x1f0'),_0x255d('0x1f1'));throw _0x255d('0x1f2');}};};Dialer[_0x255d('0x18')]['handleIvr']=function(_0x1fffdc){var _0x89a6f0=this;var _0x53033c=_0x1fffdc['limitCalls']-_0x1fffdc['originated'];emitCampaignSummary(_0x1fffdc);if(_0x53033c>0x0&&_0x1fffdc[_0x255d('0x1f3')]==0x0){if(_0x53033c>this[_0x255d('0x22')]){_0x53033c=this[_0x255d('0x22')];}_0x1fffdc[_0x255d('0x1f3')]=0x1;hopperUtils[_0x255d('0x1f4')](_0x1fffdc,_0x53033c)[_0x255d('0x45')](function(_0x7845b1){_0x1fffdc[_0x255d('0x1f3')]=0x0;if(_0x7845b1){if(!utils['checkContactEmpty'](_0x7845b1)){_0x1fffdc['message']=utils['CAMPAIGN_STATUS'][_0x255d('0x6e')];logger[_0x255d('0x50')](_0x255d('0x1f5')+_0x1fffdc[_0x255d('0x4c')]);}else{_0x1fffdc[_0x255d('0x7c')]+=_0x7845b1['length'];_0x1fffdc[_0x255d('0x69')]=utils[_0x255d('0x6a')][_0x255d('0x1f6')];for(var _0x1ef350=0x0;_0x1ef350<_0x7845b1[_0x255d('0x93')];_0x1ef350+=0x1){_0x1fffdc['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x7845b1[_0x1ef350])||_[_0x255d('0xf7')](_0x7845b1[_0x1ef350]['Contact'])||_[_0x255d('0xf7')](_0x7845b1[_0x1ef350][_0x255d('0x161')])){_0x89a6f0[_0x255d('0x1f7')](_0x255d('0x1f8'),_0x1fffdc,_0x7845b1[_0x1ef350]);}else{hopperUtils[_0x255d('0x1f9')](_[_0x255d('0x72')](_0x7845b1[_0x1ef350],[_0x255d('0xde'),'phone']))[_0x255d('0x45')](_0x89a6f0[_0x255d('0x1fa')](_0x1fffdc,_0x7845b1[_0x1ef350]))[_0x255d('0x9b')](function(_0x3c314f){logger[_0x255d('0x66')](_0x255d('0x1fb'),_0x3c314f);utils[_0x255d('0xbc')](_0x1fffdc,_0x255d('0x1fc'));});}}}}})[_0x255d('0x9b')](function(_0x5069a3){_0x1fffdc[_0x255d('0x1f3')]=0x0;logger[_0x255d('0x66')](_0x255d('0x1fd'),_0x5069a3);});}};Dialer[_0x255d('0x18')][_0x255d('0xaf')]=function(_0x58b53f,_0x430ff2){var _0x59b21a=this;var _0x5c7335=[];if(_0x430ff2<0x1||_0x58b53f[_0x255d('0xab')]===_0x255d('0x8')){_0x430ff2=0x1;}var _0x42e0d8=Math[_0x255d('0x1bf')](_0x58b53f['available']*_0x430ff2)-_0x58b53f[_0x255d('0x7c')];if(_0x58b53f[_0x255d('0x1fe')]>0x0){var _0x30402e=_0x58b53f[_0x255d('0x1fe')]-_0x58b53f['originated']-_0x58b53f['talking']-_0x58b53f[_0x255d('0x142')];if(_0x42e0d8>_0x30402e){_0x42e0d8=_0x30402e;}}if(_0x42e0d8>0x0&&_0x58b53f[_0x255d('0x1f3')]==0x0){if(_0x58b53f[_0x255d('0xab')]===_0x255d('0x8')){_0x42e0d8=0x1;}if(_0x42e0d8>this[_0x255d('0x22')]){_0x42e0d8=this[_0x255d('0x22')];}for(var _0xc2e2 in this[_0x255d('0x20')]){if(typeof this['agents'][_0xc2e2]!==_0x255d('0x1ff')){if(this['agents'][_0xc2e2][_0x255d('0xcd')]===_0x255d('0x200')&&this[_0x255d('0x20')][_0xc2e2][_0x255d('0x84')]==='reachable'){_0x5c7335[_0x255d('0x94')](this[_0x255d('0x20')][_0xc2e2]['id']);}}}_0x58b53f[_0x255d('0x1f3')]=0x1;hopperUtils[_0x255d('0x201')](_0x58b53f,_0x5c7335,_0x42e0d8)[_0x255d('0x45')](function(_0x50635d){_0x58b53f[_0x255d('0x1f3')]=0x0;if(_0x50635d){if(!utils[_0x255d('0x202')](_0x50635d)){hopperUtils[_0x255d('0x203')](_0x58b53f)[_0x255d('0x45')](sendMessageReschedule(_0x58b53f))[_0x255d('0x9b')](loggerCatch(_0x255d('0x204')));}else{_0x58b53f[_0x255d('0x7c')]+=_0x50635d[_0x255d('0x93')];_0x58b53f['message']=_0x58b53f[_0x255d('0xab')]===_0x255d('0x8')?utils[_0x255d('0x6a')][_0x255d('0x143')]:utils['CAMPAIGN_STATUS'][_0x255d('0x1f6')];for(var _0x5b4265=0x0;_0x5b4265<_0x50635d[_0x255d('0x93')];_0x5b4265+=0x1){if(_[_0x255d('0xf7')](_0x50635d[_0x5b4265])||_['isNil'](_0x50635d[_0x5b4265]['Contact'])||_[_0x255d('0xf7')](_0x50635d[_0x5b4265][_0x255d('0x161')])){_0x59b21a[_0x255d('0x1f7')](_0x255d('0x1f8'),_0x58b53f,_0x50635d[_0x5b4265]);}else{hopperUtils['checkIsBlackList'](_[_0x255d('0x72')](_0x50635d[_0x5b4265],[_0x255d('0xdd'),_0x255d('0x161')]))[_0x255d('0x45')](_0x59b21a['checkContactBlack'](_0x58b53f,_0x50635d[_0x5b4265]))['catch'](function(_0x50f0d5){logger['error']('[actionOriginate]',_0x50f0d5);utils[_0x255d('0xbc')](_0x58b53f,_0x255d('0x205'));});}}}}})[_0x255d('0x9b')](function(_0x4e43d8){_0x58b53f['temp']=0x0;logger['error'](_0x255d('0x1fd'),_0x4e43d8);});}};Dialer[_0x255d('0x18')]['handlePredictive']=function(_0xc4f04d){if(_0xc4f04d[_0x255d('0x1fe')]>0x0){var _0x3c2d5c=_0xc4f04d[_0x255d('0x1fe')]-_0xc4f04d[_0x255d('0x7c')]-_0xc4f04d[_0x255d('0x141')];if(_0x3c2d5c>0x0&&_0xc4f04d[_0x255d('0x1f3')]==0x0){this[_0x255d('0x206')](_0xc4f04d);}else{loggerPredictiveCalls[_0x255d('0x50')](_0x255d('0x207'));}}else{this[_0x255d('0x206')](_0xc4f04d);}};Dialer[_0x255d('0x18')][_0x255d('0x206')]=function(_0x2bec3b){var _0x15c9d0=this;var _0x6c22a9=[];_0x2bec3b[_0x255d('0x7c')]+=0x1;for(var _0x3281ea in this[_0x255d('0x20')]){if(typeof this[_0x255d('0x20')][_0x3281ea]!==_0x255d('0x1ff')){if(this[_0x255d('0x20')][_0x3281ea]['state']==='not_inuse'&&this[_0x255d('0x20')][_0x3281ea]['status']===_0x255d('0x14a')){_0x6c22a9[_0x255d('0x94')](this['agents'][_0x3281ea]['id']);}}}_0x2bec3b[_0x255d('0x1f3')]=0x1;return this[_0x255d('0x201')](_0x2bec3b['id'],_0x6c22a9,0x1,_0x2bec3b[_0x255d('0x208')],_0x2bec3b)[_0x255d('0x45')](function(_0x34524b){_0x2bec3b[_0x255d('0x1f3')]=0x1;if(_0x34524b){if(!utils[_0x255d('0x202')](_0x34524b)){utils['checkContactLowerLimitOriginate'](_0x2bec3b,0x1,0x0);return hopperUtils['countReScheduled'](_0x2bec3b)[_0x255d('0x45')](sendMessageReschedule(_0x2bec3b))[_0x255d('0x9b')](loggerCatch(_0x255d('0x204')));}else{_0x2bec3b[_0x255d('0x69')]=utils[_0x255d('0x6a')][_0x255d('0x1f6')];if(_[_0x255d('0xf7')](_0x34524b[0x0])||_[_0x255d('0xf7')](_0x34524b[0x0][_0x255d('0x176')])||_[_0x255d('0xf7')](_0x34524b[0x0][_0x255d('0x161')])){_0x15c9d0[_0x255d('0x1f7')](_0x255d('0x1f8'),_0x2bec3b,_0x34524b[0x0]);}else{return hopperUtils[_0x255d('0x209')](_['pick'](_0x34524b[0x0],[_0x255d('0xdd'),_0x255d('0x161')]))[_0x255d('0x45')](_0x15c9d0[_0x255d('0x1fa')](_0x2bec3b,_0x34524b[0x0]))['catch'](function(_0x2d7b2d){logger[_0x255d('0x66')]('[actionOriginatePredictive]',_0x2d7b2d);utils[_0x255d('0xbc')](_0x2bec3b,_0x255d('0x20a'));});}}}})[_0x255d('0x9b')](function(_0x571136){_0x2bec3b['temp']=0x0;logger[_0x255d('0x66')]('[getContactCampaign2]',_0x571136);});};Dialer['prototype'][_0x255d('0x1db')]=function(_0x485c92,_0x5b349a,_0x46682b,_0x50e8f0,_0x56d45f,_0x541c49){loggerPredictive['info'](_0x255d('0x20b'));loggerPredictive[_0x255d('0x50')](_0x255d('0x20c'),_0x485c92);loggerPredictive[_0x255d('0x50')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5b349a);loggerPredictive['info'](_0x255d('0x20d'),_0x46682b);loggerPredictive[_0x255d('0x50')](_0x255d('0x20e'),_0x50e8f0);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x56d45f);loggerPredictive[_0x255d('0x50')](_0x255d('0x58'));return new Promise(function(_0x13a08a,_0x4815c2){if(_0x485c92<=0x0||isNaN(_0x485c92)){return _0x4815c2(msgResponse(_0x255d('0x20f'),_0x255d('0xb7'),'m\x20=\x20'+_0x485c92));}if(_0x46682b<=0x0||isNaN(_0x46682b)){return _0x4815c2(msgResponse(_0x255d('0x20f'),_0x255d('0xb7'),_0x255d('0x210')+_0x46682b));}if(_0x50e8f0<=0x0||isNaN(_0x50e8f0)){return _0x4815c2(msgResponse(_0x255d('0x20f'),_0x255d('0xb7'),_0x255d('0x211')+_0x50e8f0));}if(_0x5b349a<=0x0||isNaN(_0x5b349a)){return _0x4815c2(msgResponse(_0x255d('0x20f'),_0x255d('0xb7'),_0x255d('0x212')+_0x5b349a));}if(_0x56d45f<=0x0||isNaN(_0x56d45f)){return _0x4815c2(msgResponse(_0x255d('0x20f'),_0x255d('0xb7'),'Amax\x20=\x20'+_0x56d45f));}_0x541c49=_0x541c49||0x0;var _0x314179=0x1/_0x46682b;var _0x5bcdc2=0x0;var _0x22906c=0x0;var _0x12d65f=0x0;var _0x2b5729=0x0;for(var _0x49c100=0x0;_0x12d65f<_0x56d45f;_0x49c100+=0x1){_0x22906c=_0x49c100/_0x5b349a;_0x5bcdc2=(_0x50e8f0*_0x22906c+_0x541c49)/_0x314179;_0x12d65f=utils[_0x255d('0x213')](_0x5bcdc2,_0x485c92);_0x2b5729=_0x5bcdc2/_0x485c92*(0x1-utils['erlangb'](_0x5bcdc2,_0x485c92));}return _0x13a08a({'erlangCalls':_0x49c100,'erlangCallToSecond':_0x5b349a/_0x49c100,'erlangAbandonmentRate':_0x12d65f,'erlangBusyFactor':_0x2b5729});});};Dialer[_0x255d('0x18')][_0x255d('0x214')]=function(_0x3f29de,_0x3050b6,_0x10d524,_0x1a1f1d,_0x214ef1,_0x16e498){loggerPredictive[_0x255d('0x50')](_0x255d('0x215'));loggerPredictive[_0x255d('0x50')](_0x255d('0x20c'),_0x3f29de);loggerPredictive['info'](_0x255d('0x216'),_0x3050b6);loggerPredictive['info'](_0x255d('0x20d'),_0x10d524);loggerPredictive[_0x255d('0x50')]('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',_0x1a1f1d);loggerPredictive['info'](_0x255d('0x217'),_0x214ef1);loggerPredictive[_0x255d('0x50')](_0x255d('0x58'));return new Promise(function(_0x2a4922,_0x241aa2){if(_0x3f29de<=0x0||isNaN(_0x3f29de)){return _0x241aa2(msgResponse(_0x255d('0x218'),_0x255d('0xb7'),_0x255d('0x219')+_0x3f29de));}if(_0x10d524<=0x0||isNaN(_0x10d524)){return _0x241aa2(msgResponse(_0x255d('0x218'),'Error',_0x255d('0x210')+_0x10d524));}if(_0x1a1f1d<=0x0||isNaN(_0x1a1f1d)){return _0x241aa2(msgResponse('[busyFactor]','Error',_0x255d('0x211')+_0x1a1f1d));}if(_0x3050b6<=0x0||isNaN(_0x3050b6)){return _0x241aa2(msgResponse(_0x255d('0x218'),_0x255d('0xb7'),'interval\x20=\x20'+_0x3050b6));}if(_0x214ef1<=0x0||isNaN(_0x214ef1)){return _0x241aa2(msgResponse(_0x255d('0x218'),_0x255d('0xb7'),_0x255d('0x21a')+_0x214ef1));}_0x16e498=_0x16e498||0x0;var _0x2e0ecc=0x1/_0x10d524;var _0x5a056a=0x0;var _0x1db942=0x0;var _0x491582=0x0;var _0x1d2382=0x0;for(var _0x2e82cb=0x0;_0x1d2382<_0x214ef1;_0x2e82cb+=0x1){_0x1db942=_0x2e82cb/_0x3050b6;_0x5a056a=(_0x1a1f1d*_0x1db942+_0x16e498)/_0x2e0ecc;_0x491582=utils[_0x255d('0x213')](_0x5a056a,_0x3f29de);_0x1d2382=_0x5a056a/_0x3f29de*(0x1-utils['erlangb'](_0x5a056a,_0x3f29de));}return _0x2a4922({'erlangCalls':_0x2e82cb,'erlangCallToSecond':_0x3050b6/_0x2e82cb,'erlangAbandonmentRate':_0x491582,'erlangBusyFactor':_0x1d2382});});};module[_0x255d('0x21b')]=Dialer; \ No newline at end of file +var _0x9ac2=['syncCampaigns','isIVRCampaign','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','[ifTime][Action]','queue','uniqueId','uniqueid','decrementOriginate','[syncAgentConnect]','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','ivr','droptime','getSeconds','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','agiafterat','dialQueueProject2','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','minutes','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','syncNewExten','channel','actionid','strategy','rrmemory','roundrobin','isNil','agents','stateinterface','locked','queueBooked','idHopper','paused','run','[Catch][Preview][syncQueueStatusComplete]','finally','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','Success','[syncOriginateResponse]','callProgressDetecting','[callProgressDetecting]\x20','variable','xcally-motion-dialer','dialAMDActive','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','emit','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','value','countcongestionretry','countnosuchnumberretry','dialGlobalMaxRetry','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','[syncHangup]','AnswerAGI','AGI','[syncHangup2]','[syncAgentComplete]','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','queuesSummary','running','isPreviewCampaign','statusMessage','ACTIVE','checkDialMethod','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','[syncQueueSummary]','dialPreviewRecallmeReminder','filter','online','reachable','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','clearZombieChannels','[actions]','undefined','No\x20such\x20channel','[clearZombieChannels]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-CAMPAIGNID','setXMDContactVariables','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','substring','dialCutDigit','trim','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','talking','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','erlangCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','available','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','[checkContactBlack]','scheduledat','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','originated','temp','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','[actionOriginate]\x20','[actionOriginate]','[handlePower]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','checkContactLowerLimitOriginate','Contact','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','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','erlangb','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','ioredis','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/interval','./models/action','./models/history','./models/agentComplete','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','optionPredictive','startProgressive','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','merge','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','CAMPAIGN_STATUS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','\x20INTERVAL_IS_NULL','Interval','Intervals','NULL_INTERVAL','INACTIVE','\x20NOT\x20Active','inspect','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20deactivated','Error','isTrunkReachable','active','SIP/%s','status','unmonitored','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','then','content','true','catch','iftime\x20%s,%s','indexOf','all','some','OVERTIME_GLOBAL_INTERVAL','Global:\x20','Timezone:\x20','resetActiveCalls'];(function(_0x588370,_0x4563b9){var _0x1b0dc1=function(_0x2a1689){while(--_0x2a1689){_0x588370['push'](_0x588370['shift']());}};_0x1b0dc1(++_0x4563b9);}(_0x9ac2,0x18b));var _0x29ac=function(_0x5679e5,_0x4e45c9){_0x5679e5=_0x5679e5-0x0;var _0x34a94=_0x9ac2[_0x5679e5];return _0x34a94;};'use strict';var util=require(_0x29ac('0x0'));var _=require(_0x29ac('0x1'));var uuid=require(_0x29ac('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x29ac('0x3'));var utils=require(_0x29ac('0x4'));var hopperUtils=require('./utils/hopper');var ut=require(_0x29ac('0x5'));var config=require(_0x29ac('0x6'));var logger=require(_0x29ac('0x7'))(_0x29ac('0x8'));var loggerBooked=require('../../../config/logger')(_0x29ac('0x9'));var loggerPredictive=require(_0x29ac('0x7'))(_0x29ac('0xa'));var loggerPredictiveCalls=require(_0x29ac('0x7'))(_0x29ac('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x29ac('0xc'));var ami=require(_0x29ac('0xd'));config[_0x29ac('0xe')]=_[_0x29ac('0xf')](config['redis'],{'host':_0x29ac('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0x29ac('0x11'));var voiceQueueRt=require(_0x29ac('0x12'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x29ac('0x13'));var Action=require(_0x29ac('0x14'));var History=require(_0x29ac('0x15'));var Final=require('./models/final');var AgentComplete=require(_0x29ac('0x16'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x29ac('0x17'));var ipAgi=process[_0x29ac('0x18')][_0x29ac('0x19')]||_0x29ac('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x29ac('0x1b')][_0x29ac('0x1c')]=function(_0x4a7df2){this['tail']=this[_0x29ac('0x1d')]?this[_0x29ac('0x1d')]['finally'](_0x4a7df2):_0x4a7df2();};function Dialer(_0x12bd8c,_0xd6575a){this[_0x29ac('0x1e')]=new Sequence();this[_0x29ac('0x1f')]=_0xd6575a;this['voiceQueues']=_0x12bd8c[_0x29ac('0x20')];this[_0x29ac('0x21')]=_0x12bd8c['campaigns'];this['agents']=_0x12bd8c['agents'];this[_0x29ac('0x22')]=_0x12bd8c[_0x29ac('0x22')];this[_0x29ac('0x23')]=config[_0x29ac('0x23')]||0x2;this[_0x29ac('0x24')]={};this[_0x29ac('0x25')]={};this['contactsId']={};this['uniqueId']={};this[_0x29ac('0x26')]={};this['startPredictive']={};this[_0x29ac('0x27')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0x29ac('0x28')]={};this['queuesSummary']={};ami['on']('agentconnect',this[_0x29ac('0x29')][_0x29ac('0x2a')](this));ami['on'](_0x29ac('0x2b'),this[_0x29ac('0x2c')]['bind'](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x29ac('0x2a')](this));ami['on']('agentcomplete',this[_0x29ac('0x2d')][_0x29ac('0x2a')](this));ami['on'](_0x29ac('0x2e'),this[_0x29ac('0xc')][_0x29ac('0x2a')](this));ami['on']('custom:queuesummarycomplete',this[_0x29ac('0x2f')]['bind'](this));ami['on']('hangup',this[_0x29ac('0x30')][_0x29ac('0x2a')](this));ami['on'](_0x29ac('0x31'),this['syncNewExten'][_0x29ac('0x2a')](this));ami['on'](_0x29ac('0x32'),this[_0x29ac('0x33')][_0x29ac('0x2a')](this));ami['on'](_0x29ac('0x34'),this[_0x29ac('0x35')][_0x29ac('0x2a')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0x29ac('0x2a')](this));this[_0x29ac('0x36')]();this[_0x29ac('0x37')]();RpcSetting[_0x29ac('0x38')]()['then'](function(_0x4a990b){previewRecallmeReminderInterval=_0x4a990b[_0x29ac('0x39')];});}function isNotNull(_0x39230e){return _0x39230e!==null&&!_[_0x29ac('0x3a')](_0x39230e);}function msgResponse(_0x20d618,_0x1ea514,_0x44640c){return{'action':_0x20d618,'response':_0x1ea514,'message':_0x44640c,'stack':_0x44640c};}function emit(_0x5eb861,_0x223052,_0x302303){io['to'](_0x5eb861)['emit'](_0x223052,_0x302303);}function emitOutboundVoiceQueueSummary(_0x19db18){if(_0x19db18[_0x29ac('0x3b')]===_0x29ac('0x3c')){logger[_0x29ac('0x3d')](_0x29ac('0x3e'),util['inspect'](_0x19db18,{'showHidden':![],'depth':null}));emit(util[_0x29ac('0x3f')](_0x29ac('0x40'),_0x19db18[_0x29ac('0x41')]),_0x29ac('0x42'),_0x19db18);}}function checkGetDataPredictive(_0x13655e){if(isNotNull(_0x13655e)&&!_[_0x29ac('0x43')](_0x13655e)){loggerPredictive[_0x29ac('0x44')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x29ac('0x44')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x13655e[_0x29ac('0x45')]);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x46'),_0x13655e[_0x29ac('0x47')]);loggerPredictive['info'](_0x29ac('0x48'),_0x13655e[_0x29ac('0x49')]);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x4a'),_0x13655e[_0x29ac('0x4b')]);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x4c'),_0x13655e[_0x29ac('0x4d')]);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x4e'),_0x13655e[_0x29ac('0x4f')]);loggerPredictive['info'](_0x29ac('0x50'));if(_0x13655e['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x13655e[_0x29ac('0x4f')])&&_0x13655e['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x29ac('0x44')](_0x29ac('0x51'));if(!_['isUndefined'](_0x13655e[_0x29ac('0x4d')])&&_0x13655e[_0x29ac('0x4d')]>0x0){return!![];}loggerPredictive[_0x29ac('0x44')](_0x29ac('0x52'));}else{loggerPredictive[_0x29ac('0x44')](_0x29ac('0x53'));}}else{loggerPredictive[_0x29ac('0x44')](_0x29ac('0x54'));}return![];}function mergeDataErlangB(_0x151375){return function(_0xbfc0c7){loggerPredictive['info'](_0x29ac('0x55'));loggerPredictive[_0x29ac('0x44')](_0x29ac('0x56'),_0xbfc0c7['erlangCalls']);loggerPredictive[_0x29ac('0x44')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xbfc0c7[_0x29ac('0x57')]);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x58'),_0xbfc0c7['erlangAbandonmentRate']);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xbfc0c7['erlangBusyFactor']);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x58'),_0xbfc0c7[_0x29ac('0x59')]);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x50'));_[_0x29ac('0x5a')](_0x151375,_0xbfc0c7);};}function ifInterval(_0x5bfe7f,_0x255eb0){if(_['isUndefined'](_0x255eb0)){return![];}return utils['getSeconds'](undefined,_0x255eb0)<_0x5bfe7f*0x3c;}function clearPredictiveAttributes(_0x5676f8){if(_0x5676f8[_0x29ac('0x27')]){_0x5676f8[_0x29ac('0x27')]=undefined;loggerPredictive['debug'](_0x5676f8['name'],'startProgressive\x20value\x20cleared');}if(_0x5676f8[_0x29ac('0x5b')]){_0x5676f8[_0x29ac('0x5b')]=undefined;loggerPredictive[_0x29ac('0x3d')](_0x5676f8['name'],_0x29ac('0x5c'));}if(_0x5676f8[_0x29ac('0x5d')]){clearInterval(_0x5676f8[_0x29ac('0x5d')]);_0x5676f8[_0x29ac('0x5d')]=undefined;loggerPredictive['debug'](_0x5676f8['name'],_0x29ac('0x5e'));}}function loggerCatchPredictive(_0x514b20,_0x3e00a7){return function(_0x229341){loggerPredictive[_0x29ac('0x5f')](_0x3e00a7[_0x29ac('0x41')],_0x514b20);loggerPredictive[_0x29ac('0x5f')](_0x229341[_0x29ac('0x60')]);clearPredictiveAttributes(_0x3e00a7);};}function loggerCatch(_0x11c790){return function(_0x3b6557){logger['error'](_0x11c790,util['inspect'](_0x3b6557,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x183ce3){return function(_0x3125ac){if(isNotNull(_0x3125ac)&&isNotNull(_0x3125ac[0x0])){if(_0x3125ac[0x0][_0x29ac('0x61')]>0x0){_0x183ce3['message']=utils['CAMPAIGN_STATUS'][_0x29ac('0x62')];logger[_0x29ac('0x44')](_0x29ac('0x63')+_0x183ce3['name'],_0x3125ac[0x0]['contactsRescheduled'],_0x29ac('0x64'));}else{_0x183ce3[_0x29ac('0x65')]=utils[_0x29ac('0x66')]['NO_AVAILABLE_CONTACTS'];logger[_0x29ac('0x44')](_0x29ac('0x67')+_0x183ce3[_0x29ac('0x41')]);}}};}function createObjHistory(_0x43d128,_0x59778b,_0x2ab1a4,_0x27271f,_0x552105){_0x43d128[_0x29ac('0x65')]=_0x2ab1a4;var _0x17ad91=new Action(_0x43d128,_0x59778b);var _0x56fff1=new History(_0x17ad91);_0x56fff1[_0x29ac('0x68')]=_0x27271f;_0x56fff1[_0x29ac('0x69')]=_0x552105;_0x56fff1[_0x29ac('0x6a')]=_0x17ad91[_0x29ac('0x6b')];return _0x56fff1;}function unlockQueueStatus(_0x49868e,_0xea2ef2){setTimeout(function(){if(_[_0x29ac('0x3a')](_0x49868e[_0x29ac('0x6c')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0xea2ef2);}_0x49868e[_0x29ac('0x6c')]=!![];loggerBooked['info'](_0x29ac('0x6d'),_0xea2ef2,JSON[_0x29ac('0x6e')](_[_0x29ac('0x6f')](_0x49868e,[_0x29ac('0x41'),_0x29ac('0x6c')])));},0x1f3);}function checkInterval(_0x204815){return function(){if(!isNotNull(_0x204815['Interval'])){_0x204815['message']=utils[_0x29ac('0x66')]['NULL_INTERVAL'];throw _0x204815[_0x29ac('0x41')]+_0x29ac('0x70');}if(!isNotNull(_0x204815[_0x29ac('0x71')][_0x29ac('0x72')])){_0x204815[_0x29ac('0x65')]=utils[_0x29ac('0x66')][_0x29ac('0x73')];throw _0x204815[_0x29ac('0x41')]+_0x29ac('0x70');}if(!isNotNull(_[_0x29ac('0x43')](_0x204815[_0x29ac('0x71')][_0x29ac('0x72')]))){_0x204815[_0x29ac('0x65')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x204815[_0x29ac('0x41')]+_0x29ac('0x70');}};}function checkIsIVRCampaignActive(_0xfffbf9){return function(){if(!utils['isIVRCampaignActive'](_0xfffbf9)){_0xfffbf9[_0x29ac('0x65')]=utils[_0x29ac('0x66')][_0x29ac('0x74')];throw _0xfffbf9['name']+_0x29ac('0x75');}};}function emitCampaignSummary(_0x155701){if(utils['isIVRCampaign'](_0x155701)){emit(util[_0x29ac('0x3f')]('campaign:ivr:%s',_0x155701['name']),'campaign:save',_0x155701);}}function loggerCatchQueueSummary(_0x2a0576,_0x53dda7){return function(_0x588352){clearPredictiveAttributes(_0x53dda7);emitCampaignSummary(_0x53dda7);loggerSyncQueueSummary[_0x29ac('0x3d')](_0x2a0576,util[_0x29ac('0x76')](_0x588352,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x877783){if(_0x877783['sendMessageOneNotActive']){if(_0x877783['originated']===0x0){_0x877783[_0x29ac('0x77')]=![];_0x877783['message']=utils['CAMPAIGN_STATUS'][_0x29ac('0x74')];loggerSyncQueueSummary['debug'](_0x29ac('0x78'),_0x877783['name'],'is\x20not\x20active');}else{_0x877783[_0x29ac('0x65')]=utils[_0x29ac('0x66')]['DISACTIVED'];loggerSyncQueueSummary[_0x29ac('0x3d')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x877783[_0x29ac('0x41')],_0x29ac('0x79'));}emitCampaignSummary(_0x877783);}}function myreject(_0x505119){return function(_0x5f12da){return _0x505119(msgResponse('[ifTime][Action]',_0x29ac('0x7a'),JSON[_0x29ac('0x6e')](_0x5f12da)));};}Dialer[_0x29ac('0x1b')][_0x29ac('0x7b')]=function(_0x32e3d6){return!_[_0x29ac('0x3a')](_0x32e3d6)&&_0x32e3d6&&!_[_0x29ac('0x3a')](_0x32e3d6[_0x29ac('0x41')])&&!_['isUndefined'](_0x32e3d6[_0x29ac('0x7c')])&&_0x32e3d6['active']&&(this[_0x29ac('0x22')][util[_0x29ac('0x3f')](_0x29ac('0x7d'),_0x32e3d6[_0x29ac('0x41')])][_0x29ac('0x7e')]==='reachable'||this[_0x29ac('0x22')][util[_0x29ac('0x3f')](_0x29ac('0x7d'),_0x32e3d6[_0x29ac('0x41')])]['status']===_0x29ac('0x7f'));};Dialer[_0x29ac('0x1b')]['checkIsTrunkReachable']=function(_0x4ed09a){var _0x59ce1b=this;return function(){if(!_0x59ce1b[_0x29ac('0x7b')](_0x4ed09a[_0x29ac('0x80')])){if(!_0x59ce1b['isTrunkReachable'](_0x4ed09a[_0x29ac('0x81')])){_0x4ed09a[_0x29ac('0x65')]=utils[_0x29ac('0x66')][_0x29ac('0x82')];throw _0x4ed09a[_0x29ac('0x41')]+_0x29ac('0x83');}}};};Dialer[_0x29ac('0x1b')][_0x29ac('0x84')]=function(_0x1f9d52,_0x18e004,_0x18e00b,_0x857352){var _0xb4c957=this;return function(){var _0xd99a0c=!![];return _0xb4c957['ifTimeIvr'](_0x1f9d52,_0x18e004,_0x18e00b,_0x857352,_0xd99a0c);};};Dialer['prototype'][_0x29ac('0x85')]=function(_0x335990,_0x15a577,_0x346124,_0x2942d1){var _0x293eb0=this;return function(){var _0x1feee6=![];return _0x293eb0[_0x29ac('0x86')](_0x335990[_0x29ac('0x72')],_0x15a577,_0x346124,_0x2942d1,_0x1feee6);};};Dialer['prototype'][_0x29ac('0x86')]=function(_0x1c046e,_0xc78ad2,_0x24f28e,_0x440ea6,_0x41ab5a){var _0x551883=[];return new Promise(function(_0xea043b,_0x5e9910){if(!isNotNull(_0x1c046e)){_0x440ea6['message']=utils[_0x29ac('0x66')][_0x29ac('0x73')];return _0x5e9910(msgResponse(_0x29ac('0x87'),_0x29ac('0x88'),_0x24f28e+_0x29ac('0x89')));}if(_[_0x29ac('0x43')](_0x1c046e)){_0x440ea6[_0x29ac('0x65')]=utils[_0x29ac('0x66')][_0x29ac('0x8a')];return _0x5e9910(msgResponse(_0x29ac('0x87'),'Failure',_0x24f28e+'\x20Intervals\x20is\x20empty\x20'));}if(_0xc78ad2&&_['isUndefined'](config[_0x29ac('0x8b')][_0xc78ad2])){_0x440ea6[_0x29ac('0x65')]=utils[_0x29ac('0x66')][_0x29ac('0x8c')];return _0x5e9910(msgResponse(_0x29ac('0x87'),_0x29ac('0x88'),_0x24f28e+_0x29ac('0x8d')+_0xc78ad2));}if(_[_0x29ac('0x8e')](_0x1c046e)){for(var _0x44ead7=0x0;_0x44ead7<_0x1c046e[_0x29ac('0x8f')];_0x44ead7+=0x1){_0x551883[_0x29ac('0x90')](ami[_0x29ac('0x91')]({'action':_0x29ac('0x92'),'command':util[_0x29ac('0x3f')]('iftime\x20%s,%s',_0x1c046e[_0x44ead7]['interval'],!_[_0x29ac('0x3a')](config[_0x29ac('0x8b')][_0xc78ad2])?_0xc78ad2:'')})[_0x29ac('0x93')](function(_0x170022){return _0x170022[_0x29ac('0x94')]['indexOf'](_0x29ac('0x95'))>=0x0;})[_0x29ac('0x96')](myreject(_0x5e9910)));}}else{_0x551883['push'](ami[_0x29ac('0x91')]({'action':_0x29ac('0x92'),'command':util['format'](_0x29ac('0x97'),_0x1c046e,!_[_0x29ac('0x3a')](config[_0x29ac('0x8b')][_0xc78ad2])?_0xc78ad2:'')})[_0x29ac('0x93')](function(_0x5e17e0){return _0x5e17e0[_0x29ac('0x94')][_0x29ac('0x98')](_0x29ac('0x95'))>=0x0;})[_0x29ac('0x96')](myreject(_0x5e9910)));}Promise[_0x29ac('0x99')](_0x551883)['then'](function(_0x3f8b90){var _0x108246=_[_0x29ac('0x9a')](_0x3f8b90);if(_0x108246){return _0xea043b(_0x108246);}else{_0x440ea6[_0x29ac('0x65')]=_0x41ab5a?utils['CAMPAIGN_STATUS'][_0x29ac('0x9b')]:utils[_0x29ac('0x66')]['OVERTIME_INTERVAL'];return _0x5e9910(msgResponse('[ifTime][promiseAll]',_0x29ac('0x88'),_0x29ac('0x9c')+_0x41ab5a+'\x20'+_0x24f28e+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x1c046e,{'showHidden':![],'depth':null})+_0x29ac('0x9d')+_0xc78ad2));}})[_0x29ac('0x96')](function(_0x524d6f){return _0x5e9910(msgResponse(_0x29ac('0x87'),_0x29ac('0x88'),JSON[_0x29ac('0x6e')](_0x524d6f)));});});};Dialer[_0x29ac('0x1b')]['loopCampaigns']=function(){var _0x35a4e2=this;return cmHopper[_0x29ac('0x9e')]({'active':![]},{'where':{'active':!![]}})[_0x29ac('0x93')](function(){setInterval(function(){_0x35a4e2[_0x29ac('0x9f')]();},0x3e8);});};Dialer[_0x29ac('0x1b')][_0x29ac('0x9f')]=function(){var _0x1eea20=this;var _0x1f994d;for(var _0x42f4d7 in this[_0x29ac('0x21')]){if(typeof this[_0x29ac('0x21')][_0x42f4d7]!=='undefined'){_0x1f994d=this[_0x29ac('0x21')][_0x42f4d7];if(utils[_0x29ac('0xa0')](_0x1f994d)&&utils[_0x29ac('0xa1')](_0x1f994d)){_0x1f994d[_0x29ac('0x77')]=!![];Promise[_0x29ac('0xa2')]()['then'](checkIsIVRCampaignActive(_0x1f994d))[_0x29ac('0x93')](checkInterval(_0x1f994d))['then'](_0x1eea20['checkIsTrunkReachable'](_0x1f994d))[_0x29ac('0x93')](_0x1eea20['checkIfTime'](_0x1f994d[_0x29ac('0xa3')],_0x1f994d['dialTimezone'],_0x1f994d[_0x29ac('0x41')],_0x1f994d))['then'](_0x1eea20['checkIfTimeIntervals'](_0x1f994d['Interval'],_0x1f994d[_0x29ac('0xa4')],_0x1f994d['name'],_0x1f994d))[_0x29ac('0x93')](_0x1eea20[_0x29ac('0xa5')](_0x1f994d))[_0x29ac('0x96')](loggerCatchQueueSummary(_0x29ac('0xa6'),_0x1f994d));}else{notSendMessagesCampaign(_0x1f994d);}}}};Dialer[_0x29ac('0x1b')]['checkDialMethod']=function(_0x49b876){if(_0x49b876[_0x29ac('0xa7')]!=='predictive'){clearPredictiveAttributes(_0x49b876);}switch(_0x49b876['dialMethod']){case _0x29ac('0xa8'):this[_0x29ac('0xa9')](_0x49b876,0x1);break;case _0x29ac('0xaa'):this[_0x29ac('0xa9')](_0x49b876,_0x49b876[_0x29ac('0xab')]);break;case _0x29ac('0xa'):this['predictive'](_0x49b876);break;case _0x29ac('0x9'):this['handlePower'](_0x49b876,0x1);break;default:logger[_0x29ac('0x5f')](_0x29ac('0xac'),_0x49b876[_0x29ac('0x41')],_0x29ac('0xad'));}};Dialer[_0x29ac('0x1b')][_0x29ac('0x87')]=function(_0x15024e,_0x2a509c){var _0x3a152d=_0x15024e[_0x29ac('0xa4')];var _0x4173d6=_0x2a509c?_0x15024e[_0x29ac('0xa3')]:_0x15024e[_0x29ac('0x71')][_0x29ac('0x72')];logger['silly']('Dialer::ifTime()',_0x4173d6,_0x3a152d,_0x15024e[_0x29ac('0x41')],util['format'](_0x29ac('0xae'),_0x15024e['name'],_0x15024e['id']));var _0x7a4385=null;return Interval[_0x29ac('0xaf')](_0x4173d6,_0x3a152d)[_0x29ac('0x93')](function(_0xaa51e6){if(_0xaa51e6===!![]){return _0xaa51e6;}else{_0x15024e[_0x29ac('0x65')]=_0x2a509c?utils[_0x29ac('0x66')][_0x29ac('0x9b')]:utils[_0x29ac('0x66')][_0x29ac('0xb0')];_0x7a4385=msgResponse(_0x29ac('0xb1'),_0x29ac('0x88'),'Global:\x20'+_0x2a509c+'\x20'+_0x15024e[_0x29ac('0x41')]+_0x29ac('0xb2')+util[_0x29ac('0x76')](_0x4173d6,{'showHidden':![],'depth':null})+_0x29ac('0x9d')+_0x3a152d);}if(_0x7a4385!==null){logger[_0x29ac('0xb3')](_0x29ac('0xb4'),_0x7a4385);_0x7a4385[_0x29ac('0xb5')]=_0x2a509c;throw _0x7a4385;}})[_0x29ac('0x96')](function(_0x48f033){logger[_0x29ac('0x5f')]('AMI\x20IfTime',_0x48f033);throw msgResponse(_0x29ac('0xb6'),_0x29ac('0x7a'),util[_0x29ac('0x76')](_0x48f033,{'showHidden':![],'depth':null}));});};Dialer[_0x29ac('0x1b')][_0x29ac('0x29')]=function(_0x3a7f94){if(this[_0x29ac('0x20')][_0x3a7f94[_0x29ac('0xb7')]]){if(this[_0x29ac('0xb8')][_0x3a7f94[_0x29ac('0xb9')]]&&this[_0x29ac('0xb8')][_0x3a7f94['uniqueid']][_0x29ac('0x3b')]!=='ivr'){utils[_0x29ac('0xba')](this[_0x29ac('0x20')][_0x3a7f94[_0x29ac('0xb7')]],_0x29ac('0xbb'));this[_0x29ac('0xb8')][_0x3a7f94[_0x29ac('0xb9')]]['answertime']=moment()[_0x29ac('0x3f')](_0x29ac('0xbc'));}}};Dialer[_0x29ac('0x1b')][_0x29ac('0x2d')]=function(_0x2e4186){var _0x2f4b2f=this[_0x29ac('0xb8')][_0x2e4186[_0x29ac('0xb9')]];if(this[_0x29ac('0x20')][_0x2e4186[_0x29ac('0xb7')]]){if(_0x2f4b2f&&_0x2f4b2f['type']!=='ivr'){delete this[_0x29ac('0xb8')][_0x2e4186['uniqueid']];this[_0x29ac('0x20')][_0x2e4186[_0x29ac('0xb7')]][_0x29ac('0xbd')]+=0x1;var _0x465b68=new AgentComplete(_0x2f4b2f,_0x2e4186);if(_0x2e4186[_0x29ac('0xbe')]===_0x29ac('0xbf')){_0x465b68['agiafterat']=this[_0x29ac('0x20')][_0x2e4186[_0x29ac('0xb7')]]['dialQueueProject2']&&this['voiceQueues'][_0x2e4186[_0x29ac('0xb7')]][_0x29ac('0xc0')]?moment()[_0x29ac('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils['createHistory'](_0x465b68)[_0x29ac('0x96')](loggerCatch(_0x29ac('0xc1')));hopperUtils[_0x29ac('0xc2')](_0x465b68)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x29ac('0x1b')][_0x29ac('0x2c')]=function(_0x571117){var _0x44743e=this[_0x29ac('0xb8')][_0x571117[_0x29ac('0xb9')]];var _0x170710=this;var _0x3aac6d=![];var _0x44a01f;var _0x2411e3;if(this[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]]){if(_0x44743e&&_0x44743e[_0x29ac('0x3b')]!==_0x29ac('0xc3')){delete this[_0x29ac('0xb8')][_0x571117['uniqueid']];utils[_0x29ac('0xba')](this[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]],'[syncQueueCallerAbandon]');_0x44743e[_0x29ac('0xc4')]=moment()[_0x29ac('0x3f')](_0x29ac('0xbc'));var _0xac78f3=new QueueCallerAbandon(_0x44743e,_0x571117);if(utils[_0x29ac('0xc5')](_0x44743e[_0x29ac('0xc4')],_0x44743e[_0x29ac('0xc6')])>=_0x44743e[_0x29ac('0xc7')]){this[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]][_0x29ac('0x49')]+=0x1;this[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x571117[_0x29ac('0xb7')]][_0x29ac('0xc8')]+=0x1;_0xac78f3[_0x29ac('0x68')]=0xa;_0xac78f3[_0x29ac('0x69')]='Drop';_0xac78f3[_0x29ac('0xc9')]=_0x29ac('0xca');_0xac78f3[_0x29ac('0xcb')]=this['voiceQueues'][_0x571117[_0x29ac('0xb7')]][_0x29ac('0xcc')]?moment()[_0x29ac('0x3f')](_0x29ac('0xbc')):undefined;_0xac78f3[_0x29ac('0xcd')]+=0x1;_0xac78f3[_0x29ac('0xce')]+=0x1;_0x44a01f=this['voiceQueues'][_0x571117[_0x29ac('0xb7')]][_0x29ac('0xcf')];_0x2411e3=this[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]][_0x29ac('0xd0')];hopperUtils[_0x29ac('0xd1')](_0xac78f3,_0xac78f3[_0x29ac('0x68')],_0x44743e[_0x29ac('0xd2')])[_0x29ac('0x93')](function(_0x4810e0){_0x3aac6d=_0x4810e0[_0x29ac('0xd3')]==0x1;if(_0xac78f3[_0x29ac('0xcd')]>=_0x170710[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]][_0x29ac('0xd4')]){_0x170710[_0x29ac('0xd5')](_0xac78f3,_0x4810e0[_0x29ac('0xd3')]);}else{hopperUtils[_0x29ac('0xd6')]({'active':![],'countdropretry':_0xac78f3[_0x29ac('0xcd')],'scheduledat':moment()[_0x29ac('0xd7')](_0x170710[_0x29ac('0x20')][_0x571117['queue']][_0x29ac('0xcf')],'minutes')[_0x29ac('0x3f')](_0x29ac('0xbc')),'ContactId':_0x44743e[_0x29ac('0xd8')],'ListId':_0x44743e[_0x29ac('0xd9')],'VoiceQueueId':_0x44743e[_0x29ac('0xda')]||undefined,'CampaignId':_0x44743e[_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0xdc')));var _0x4c0e81=new History(_0xac78f3);_0x4c0e81['state']=0xa;_0x4c0e81[_0x29ac('0x69')]='Drop';_0x4c0e81[_0x29ac('0x6b')]=moment()['format'](_0x29ac('0xbc'));_0x4c0e81[_0x29ac('0x6a')]=_0x4c0e81[_0x29ac('0x6b')];_0x4c0e81[_0x29ac('0xdd')]=_0xac78f3[_0x29ac('0xdd')];_0x4c0e81[_0x29ac('0xde')]=_0xac78f3[_0x29ac('0xde')];hopperUtils[_0x29ac('0xdf')](_0x4c0e81)[_0x29ac('0x96')](loggerCatch(_0x29ac('0xe0')));}})[_0x29ac('0x93')](function(){if(_0x3aac6d)hopperUtils['swapAdditionalPhones'](_0xac78f3,_0x44a01f,_0x2411e3)['then'](function(){return 0x1;});});}else{this[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x29ac('0x20')][_0x571117['queue']][_0x29ac('0xe1')]+=0x1;_0xac78f3[_0x29ac('0x68')]=0xb;_0xac78f3[_0x29ac('0x69')]=_0x29ac('0xe2');_0xac78f3[_0x29ac('0xc9')]=_0x29ac('0xe3');_0xac78f3[_0x29ac('0xe4')]+=0x1;_0xac78f3[_0x29ac('0xce')]+=0x1;_0x44a01f=this[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]][_0x29ac('0xe5')];_0x2411e3=this['voiceQueues'][_0x571117[_0x29ac('0xb7')]][_0x29ac('0xd0')];hopperUtils[_0x29ac('0xd1')](_0xac78f3,_0xac78f3[_0x29ac('0x68')],_0x44743e[_0x29ac('0xd2')])[_0x29ac('0x93')](function(_0x3129fa){if(_0xac78f3[_0x29ac('0xe4')]>=_0x170710[_0x29ac('0x20')][_0x571117[_0x29ac('0xb7')]][_0x29ac('0xe6')]){_0x170710['queueCallerAbandonCreateState'](_0xac78f3,_0x3129fa[_0x29ac('0xd3')]);}else{hopperUtils[_0x29ac('0xd6')]({'active':![],'countabandonedretry':_0xac78f3['countabandonedretry'],'scheduledat':moment()[_0x29ac('0xd7')](_0x170710['voiceQueues'][_0x571117[_0x29ac('0xb7')]]['dialAbandonedRetryFrequency'],_0x29ac('0xe7'))['format'](_0x29ac('0xbc')),'ContactId':_0x44743e['ContactId'],'ListId':_0x44743e[_0x29ac('0xd9')],'VoiceQueueId':_0x44743e[_0x29ac('0xda')]||undefined,'CampaignId':_0x44743e[_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0xe8')));var _0xc021cf=new History(_0xac78f3);_0xc021cf['state']=0xb;_0xc021cf[_0x29ac('0x69')]=_0x29ac('0xe2');_0xc021cf[_0x29ac('0x6b')]=moment()[_0x29ac('0x3f')](_0x29ac('0xbc'));_0xc021cf[_0x29ac('0x6a')]=_0xc021cf[_0x29ac('0x6b')];_0xc021cf[_0x29ac('0xdd')]=_0xac78f3[_0x29ac('0xdd')];_0xc021cf[_0x29ac('0xde')]=_0xac78f3[_0x29ac('0xde')];hopperUtils['createHistory'](_0xc021cf)[_0x29ac('0x96')](loggerCatch(_0x29ac('0xe9')));}})['then'](function(){if(_0x3aac6d)hopperUtils[_0x29ac('0xea')](_0xac78f3,_0x44a01f,_0x2411e3)[_0x29ac('0x93')](function(){return 0x1;});});}}}};Dialer[_0x29ac('0x1b')][_0x29ac('0xeb')]=function(_0x110da6){if(this['actions'][_0x110da6[_0x29ac('0xb9')]]){this[_0x29ac('0x25')][_0x110da6['uniqueid']]['channel']=_0x110da6[_0x29ac('0xec')];}if(this['uniqueId'][_0x110da6[_0x29ac('0xb9')]]){this[_0x29ac('0xb8')][_0x110da6['uniqueid']][_0x29ac('0xec')]=_0x110da6[_0x29ac('0xec')];}};Dialer['prototype'][_0x29ac('0x35')]=function(_0xcbbdf6){if(!this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]]){return;}var _0x1de35f=this[_0x29ac('0x20')][this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]]['queue']][_0x29ac('0xee')]||_0x29ac('0xef');if(_0x1de35f===_0x29ac('0xf0')){if(this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]]&&_[_0x29ac('0xf1')](this[_0x29ac('0x25')][_0xcbbdf6['actionid']]['locked'])&&_0xcbbdf6[_0x29ac('0x7e')]==='1'&&_0xcbbdf6['paused']==='0'){if(this[_0x29ac('0xf2')][_0xcbbdf6['stateinterface']]){if(!this['agents'][_0xcbbdf6[_0x29ac('0xf3')]]['locked']){this[_0x29ac('0xf2')][_0xcbbdf6[_0x29ac('0xf3')]][_0x29ac('0xf4')]=!![];this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]][_0x29ac('0xf4')]=!![];this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]][_0x29ac('0xf3')]=_0xcbbdf6[_0x29ac('0xf3')];}}}}else if(_0x1de35f===_0x29ac('0xef')){if(this[_0x29ac('0x25')][_0xcbbdf6['actionid']]){if(this[_0x29ac('0xf2')][_0xcbbdf6[_0x29ac('0xf3')]]){this[_0x29ac('0x25')][_0xcbbdf6['actionid']][_0x29ac('0xf3')]=_0xcbbdf6[_0x29ac('0xf3')];if(_[_0x29ac('0xf1')](this[_0x29ac('0xf5')][this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]][_0x29ac('0xb7')]])){this[_0x29ac('0xf5')][this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]][_0x29ac('0xb7')]]=[];}this[_0x29ac('0xf5')][this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]][_0x29ac('0xb7')]][_0x29ac('0x90')](_[_0x29ac('0x5a')](_[_0x29ac('0x6f')](this[_0x29ac('0x25')][_0xcbbdf6[_0x29ac('0xed')]],[_0x29ac('0xf6'),'stateinterface']),{'status':_0xcbbdf6[_0x29ac('0x7e')],'paused':_0xcbbdf6[_0x29ac('0xf7')]}));}}}};Dialer[_0x29ac('0x1b')]['syncQueueStatusComplete']=function(_0x4286c9){if(!this[_0x29ac('0x25')][_0x4286c9['actionid']]){return;}var _0x5d224a=this;var _0x514fcd=this['voiceQueues'][this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]]['queue']];var _0x75034a=_0x514fcd[_0x29ac('0xee')]||_0x29ac('0xef');if(_0x75034a===_0x29ac('0xf0')){if(this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]]&&this[_0x29ac('0x25')][_0x4286c9['actionid']][_0x29ac('0xf3')]){this[_0x29ac('0x1f')][_0x29ac('0xf8')](this['actions'][_0x4286c9['actionid']][_0x29ac('0xf6')],this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]]['stateinterface'])[_0x29ac('0x96')](function(_0x2855e5){logger[_0x29ac('0x5f')](_0x29ac('0xf9'),util[_0x29ac('0x76')](_0x2855e5,{'showHidden':![],'depth':null}));})[_0x29ac('0xfa')](function(){utils['decrementOriginate'](_0x5d224a[_0x29ac('0x20')][_0x5d224a[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xb7')]],_0x29ac('0xfb'));_0x5d224a[_0x29ac('0xf2')][_0x5d224a['actions'][_0x4286c9[_0x29ac('0xed')]]['stateinterface']][_0x29ac('0xf4')]=![];delete _0x5d224a['actions'][_0x4286c9['actionid']];unlockQueueStatus(_0x514fcd);});}else{utils['decrementOriginate'](this['voiceQueues'][this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xb7')]],_0x29ac('0xfb'));hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x4286c9['actionid']][_0x29ac('0xd8')],'ListId':this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xd9')],'VoiceQueueId':this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xda')]||undefined,'CampaignId':this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0xfc')));delete this['actions'][_0x4286c9[_0x29ac('0xed')]];unlockQueueStatus(_0x514fcd);}}else if(_0x75034a===_0x29ac('0xef')){var _0xac5544;if(this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]]&&!_[_0x29ac('0x43')](this[_0x29ac('0xf5')][this[_0x29ac('0x25')][_0x4286c9['actionid']][_0x29ac('0xb7')]])){if(this[_0x29ac('0x28')][_0x5d224a[_0x29ac('0x25')][_0x4286c9['actionid']][_0x29ac('0xb7')]]){this['queueBookedRR'][_0x5d224a['actions'][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xb7')]]=this[_0x29ac('0x28')][this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]]['queue']]?this[_0x29ac('0x28')][this[_0x29ac('0x25')][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xb7')]]:this['queueBooked'][this[_0x29ac('0x25')][_0x4286c9['actionid']][_0x29ac('0xb7')]]?this['queueBooked'][this['actions'][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xb7')]][_0x29ac('0xfd')]||0x0:0x0;}this[_0x29ac('0xf5')][this['actions'][_0x4286c9[_0x29ac('0xed')]][_0x29ac('0xb7')]][_0x29ac('0xfd')]=this[_0x29ac('0x28')][this['actions'][_0x4286c9['actionid']][_0x29ac('0xb7')]];for(var _0x4b1f76=0x0;_0x4b1f76=_0xd3654e['dialGlobalMaxRetry']){_0x680985[_0x29ac('0x122')](_0x4a1d75,_0x40234f,_0x178651,_0x29ac('0x123'));}else{if(_0x4a1d75['countmachineretry']>=_0xd3654e[_0x29ac('0x124')]){_0x680985[_0x29ac('0x125')](_0x4a1d75,_0x40234f,_0x178651,_0x29ac('0x126'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x4a1d75[_0x29ac('0x11e')],'scheduledat':moment()[_0x29ac('0xd7')](_0xd3654e[_0x29ac('0x127')],_0x29ac('0xe7'))[_0x29ac('0x3f')](_0x29ac('0xbc')),'ContactId':_0x4a1d75[_0x29ac('0xd8')],'ListId':_0x4a1d75[_0x29ac('0xd9')],'VoiceQueueId':_0x4a1d75['VoiceQueueId']||undefined,'CampaignId':_0x4a1d75[_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x128')));_0x40234f({'reschedule':0x1});}}});}if(_0x30b8b2['type']===_0x29ac('0xc3')&&this[_0x29ac('0x21')][_0x30b8b2[_0x29ac('0xb7')]][_0x29ac('0x110')]&&_0xf085cc['value']===_0x29ac('0x111')){delete this['uniqueId'][_0xf085cc[_0x29ac('0xb9')]];utils[_0x29ac('0xba')](this[_0x29ac('0x21')][_0x30b8b2[_0x29ac('0xb7')]],_0x29ac('0x112'));_0x3692a1=new Hangup(_0x30b8b2,_0xf085cc);_0x3692a1[_0x29ac('0x68')]=0x12;_0x3692a1[_0x29ac('0x69')]=_0x29ac('0x114');_0x3692a1[_0x29ac('0x115')]=_0x29ac('0x116');ami[_0x29ac('0x129')](_0x29ac('0x117'),ut['buildObj'](_0x3692a1,'amd'));this['saveInDb'](_0x3692a1,_0x29ac('0x12a'),_0x29ac('0x12b'));}if(_0x30b8b2[_0x29ac('0x3b')]==='ivr'&&this['campaigns'][_0x30b8b2[_0x29ac('0xb7')]][_0x29ac('0x110')]&&_0xf085cc[_0x29ac('0x12c')]===_0x29ac('0x11c')){return new Promise(function(_0x42320a,_0x433ae8){delete _0x680985[_0x29ac('0xb8')][_0xf085cc[_0x29ac('0xb9')]];utils[_0x29ac('0xba')](_0x680985[_0x29ac('0x21')][_0x30b8b2[_0x29ac('0xb7')]],_0x29ac('0x112'));_0x680985[_0x29ac('0x21')][_0x30b8b2[_0x29ac('0xb7')]][_0x29ac('0xbd')]+=0x1;_0x680985[_0x29ac('0x21')][_0x30b8b2[_0x29ac('0xb7')]][_0x29ac('0x113')]+=0x1;var _0x42d4fe=_0x680985[_0x29ac('0x21')][_0x30b8b2[_0x29ac('0xb7')]];var _0x523bb7=new Hangup(_0x30b8b2,_0xf085cc);_0x523bb7[_0x29ac('0x68')]=0x13;_0x523bb7['statedesc']=_0x29ac('0x11d');_0x523bb7[_0x29ac('0x115')]=_0x29ac('0x116');_0x523bb7[_0x29ac('0x11e')]+=0x1;_0x523bb7[_0x29ac('0xce')]+=0x1;_0x523bb7[_0x29ac('0x119')]=!![];ami[_0x29ac('0x129')](_0x29ac('0x117'),ut['buildObj'](_0x523bb7,_0x29ac('0x119')));hopperUtils[_0x29ac('0xdf')](_0x523bb7)['catch'](loggerCatch(_0x29ac('0x11f')));if(_0x523bb7['countbusyretry']+_0x523bb7[_0x29ac('0x12d')]+_0x523bb7['countnoanswerretry']+_0x523bb7[_0x29ac('0x12e')]+_0x523bb7['countdropretry']+_0x523bb7[_0x29ac('0xe4')]+_0x523bb7['countmachineretry']+_0x523bb7['countagentrejectretry']>=_0x42d4fe[_0x29ac('0x12f')]){_0x680985[_0x29ac('0x122')](_0x523bb7,_0x42320a,_0x433ae8,'reason19\x20machine....');}else{if(_0x523bb7[_0x29ac('0x11e')]>=_0x42d4fe[_0x29ac('0x124')]){_0x680985['createStateFinal'](_0x523bb7,_0x42320a,_0x433ae8,_0x29ac('0x126'));}else{hopperUtils[_0x29ac('0xd6')]({'active':![],'countmachineretry':_0x523bb7[_0x29ac('0x11e')],'scheduledat':moment()[_0x29ac('0xd7')](_0x42d4fe['dialMachineRetryFrequency'],_0x29ac('0xe7'))[_0x29ac('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x523bb7['ContactId'],'ListId':_0x523bb7[_0x29ac('0xd9')],'VoiceQueueId':_0x523bb7[_0x29ac('0xda')]||undefined,'CampaignId':_0x523bb7['CampaignId']||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x128')));_0x42320a({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x3f60a1){var _0x4dafb3=this[_0x29ac('0xb8')][_0x3f60a1[_0x29ac('0xb9')]];var _0x1c8552;if(!_0x4dafb3){return;}if(_0x4dafb3[_0x29ac('0x3b')]===_0x29ac('0xc3')){delete this[_0x29ac('0xb8')][_0x3f60a1['uniqueid']];utils[_0x29ac('0xba')](this[_0x29ac('0x21')][_0x4dafb3[_0x29ac('0xb7')]],'[syncHangup]');this['campaigns'][_0x4dafb3[_0x29ac('0xb7')]][_0x29ac('0x130')]+=0x1;if(_0x3f60a1[_0x29ac('0x131')]===_0x29ac('0x132')){const _0x2e0b54=new AgentComplete(_0x4dafb3,_0x3f60a1);_0x2e0b54[_0x29ac('0xdb')]=this[_0x29ac('0x21')][_0x4dafb3['queue']]['id'];hopperUtils[_0x29ac('0xdf')](_0x2e0b54)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x133')));hopperUtils[_0x29ac('0xc2')](_0x2e0b54)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x134')));}else{_0x1c8552=new Hangup(_0x4dafb3,_0x3f60a1);hopperUtils[_0x29ac('0xdf')](_0x1c8552)['catch'](loggerCatch(_0x29ac('0x135')));hopperUtils[_0x29ac('0xc2')](_0x1c8552)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x136')));}}else{if(isNotNull(this[_0x29ac('0x20')][_0x4dafb3['queue']][_0x29ac('0x137')])){delete this[_0x29ac('0xb8')][_0x3f60a1[_0x29ac('0xb9')]];utils[_0x29ac('0xba')](this[_0x29ac('0x20')][_0x4dafb3[_0x29ac('0xb7')]],_0x29ac('0x138'));this[_0x29ac('0x20')][_0x4dafb3[_0x29ac('0xb7')]]['outboundAnswerCallsDay']+=0x1;this[_0x29ac('0x20')][_0x4dafb3[_0x29ac('0xb7')]][_0x29ac('0x113')]+=0x1;_0x1c8552=new Hangup(_0x4dafb3,_0x3f60a1);_0x1c8552[_0x29ac('0x68')]=0x10;_0x1c8552[_0x29ac('0x69')]=_0x29ac('0x139');_0x1c8552['membername']=_0x29ac('0x13a');hopperUtils[_0x29ac('0xdf')](_0x1c8552)[_0x29ac('0x96')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x29ac('0xc2')](_0x1c8552)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x136')));}else{delete this[_0x29ac('0xb8')][_0x3f60a1[_0x29ac('0xb9')]];utils[_0x29ac('0xba')](this[_0x29ac('0x20')][_0x4dafb3[_0x29ac('0xb7')]],_0x29ac('0x13b'));if(_0x3f60a1[_0x29ac('0x131')]===_0x29ac('0x132')){this['voiceQueues'][_0x4dafb3[_0x29ac('0xb7')]][_0x29ac('0xbd')]+=0x1;const _0x35cca1=new AgentComplete(_0x4dafb3,_0x3f60a1);_0x35cca1[_0x29ac('0xda')]=this[_0x29ac('0x20')][_0x4dafb3[_0x29ac('0xb7')]]['id'];hopperUtils['createHistory'](_0x35cca1)[_0x29ac('0x96')](loggerCatch(_0x29ac('0xc1')));hopperUtils[_0x29ac('0xc2')](_0x35cca1)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x13c')));}else{this[_0x29ac('0x20')][_0x4dafb3['queue']][_0x29ac('0x13d')]+=0x1;_0x1c8552=new Hangup(_0x4dafb3,_0x3f60a1);_0x1c8552[_0x29ac('0x68')]=0xc;_0x1c8552[_0x29ac('0x69')]=_0x3f60a1[_0x29ac('0x131')];_0x1c8552[_0x29ac('0x115')]=_0x29ac('0x13e');hopperUtils[_0x29ac('0xdf')](_0x1c8552)['catch'](loggerCatch(_0x29ac('0x13f')));hopperUtils[_0x29ac('0xc2')](_0x1c8552)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x138')));}}}};Dialer['prototype']['syncQueueSummary']=function(_0x5c2255){var _0x112570=this;if(!_0x112570[_0x29ac('0x140')][_0x5c2255[_0x29ac('0x41')]]){_0x112570['queuesSummary'][_0x5c2255[_0x29ac('0x41')]]={'running':![]};}else if(_0x112570[_0x29ac('0x140')][_0x5c2255[_0x29ac('0x41')]][_0x29ac('0x141')]===!![]){return;}else if(_0x112570[_0x29ac('0x140')][_0x5c2255['name']][_0x29ac('0x141')]===![]){_0x112570[_0x29ac('0x140')][_0x5c2255['name']][_0x29ac('0x141')]=!![];}var _0x1592bd=_0x112570[_0x29ac('0x20')][_0x5c2255[_0x29ac('0x41')]];var _0x47efee=_0x1592bd[_0x29ac('0x65')]!==utils[_0x29ac('0x66')][_0x29ac('0x74')];var _0xc7f2c3=utils[_0x29ac('0x142')](_0x1592bd);_0x1592bd[_0x29ac('0x143')]=utils['getQueueCampaignStatusMessage'](_0x1592bd,_0x112570['trunks']);Promise[_0x29ac('0xa2')]()[_0x29ac('0x93')](function(){if(_0x1592bd[_0x29ac('0x143')]===utils[_0x29ac('0x66')]['INACTIVE']){if(_0x47efee){clearPredictiveAttributes(_0x1592bd);_0x5c2255[_0x29ac('0x5b')]=undefined;_0x5c2255['startProgressive']=undefined;}if(_0x1592bd[_0x29ac('0x143')]===utils[_0x29ac('0x66')][_0x29ac('0x74')]){_0x5c2255['available']=0x0;_0x5c2255[_0x29ac('0xf7')]=0x0;_0x5c2255['inUse']=0x0;_0x5c2255['talking']=0x0;_0x5c2255['pTalking']=0x0;}}else if(_0x1592bd[_0x29ac('0x143')]===utils[_0x29ac('0x66')][_0x29ac('0x144')]&&!_0xc7f2c3){return _0x112570[_0x29ac('0x87')](_0x1592bd,!![])[_0x29ac('0x93')](function(){return _0x112570[_0x29ac('0x87')](_0x1592bd,![]);})[_0x29ac('0x93')](function(){return _0x112570[_0x29ac('0x145')](_0x1592bd);})[_0x29ac('0x96')](function(_0x3e0be3){loggerSyncQueueSummary[_0x29ac('0x3d')]('[syncQueueSummary]',util[_0x29ac('0x76')](_0x3e0be3,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1592bd);});}else{clearPredictiveAttributes(_0x1592bd);}})[_0x29ac('0x93')](function(){var _0x49d605=_0x5c2255[_0x29ac('0x146')](_0x1592bd);if(_0x49d605||_0x1592bd[_0x29ac('0x147')]){_0x1592bd[_0x29ac('0x147')]=![];_0x5c2255[_0x29ac('0x148')](_0x1592bd);Object['assign'](_0x1592bd,_0x5c2255);emitOutboundVoiceQueueSummary(_0x5c2255);}_0x112570[_0x29ac('0x140')][_0x1592bd[_0x29ac('0x41')]][_0x29ac('0x141')]=![];})[_0x29ac('0x96')](function(_0x3d244b){logger[_0x29ac('0x5f')](_0x29ac('0x149'),util[_0x29ac('0x76')](_0x3d244b,{'showHidden':![],'depth':null}));_0x112570[_0x29ac('0x140')][_0x1592bd[_0x29ac('0x41')]]['running']=![];});};Dialer['prototype']['syncQueueSummaryComplete']=_['throttle'](function(){var _0x5e74c9=_['filter'](this[_0x29ac('0x20')],function(_0xb4b40c){return _0xb4b40c[_0x29ac('0x14a')];});var _0x107ac8=_[_0x29ac('0x14b')](this['agents'],function(_0x211eef){return _0x211eef[_0x29ac('0x14c')]&&_0x211eef['status']===_0x29ac('0x14d');});if(_0x5e74c9[_0x29ac('0x8f')]>0x0&&_0x107ac8[_0x29ac('0x8f')]>0x0){return Promise[_0x29ac('0xa2')]()[_0x29ac('0x93')](cmHopper['handlePreviewRecallNotifications'](_[_0x29ac('0x14e')](_0x5e74c9,'id'),previewRecallmeReminderInterval,_['map'](_0x107ac8,'id')))['then'](function(_0x45e731){for(var _0xfb3a3c=0x0;_0xfb3a3c<_0x45e731[_0x29ac('0x8f')];_0xfb3a3c++){var _0x45631b=_0x45e731[_0xfb3a3c]['Agent'][_0x29ac('0x41')];if(_0x45631b)io['to'](util[_0x29ac('0x3f')](_0x29ac('0x14f'),_0x45631b))[_0x29ac('0x129')](_0x29ac('0x150'),{'hopper':_0x45e731[_0xfb3a3c]});}})[_0x29ac('0x96')](function(_0x50198d){logger['error'](_0x29ac('0x151'),_0x50198d);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x29ac('0x1b')][_0x29ac('0x37')]=function(){var _0x38eefd=this;setInterval(function(){_0x38eefd['clearZombieChannels'](_0x38eefd[_0x29ac('0xb8')],_0x29ac('0x152'));_0x38eefd[_0x29ac('0x153')](_0x38eefd[_0x29ac('0x25')],_0x29ac('0x154'));},0x32c8);};Dialer[_0x29ac('0x1b')][_0x29ac('0x153')]=function(_0x3b89ab,_0x126bdb){var _0x54bc55=this;for(var _0x2813a5 in _0x3b89ab){if(typeof _0x3b89ab[_0x2813a5]!==_0x29ac('0x155')){this[_0x29ac('0x1e')][_0x29ac('0x1c')](function(){if(!_[_0x29ac('0xf1')](_0x3b89ab[_0x2813a5])){return ami[_0x29ac('0x91')]({'action':'status','channel':_0x3b89ab[_0x2813a5][_0x29ac('0xec')]})['catch'](function(_0x14c808){if(_0x14c808[_0x29ac('0x65')]===_0x29ac('0x156')){setTimeout(function(){if(_0x3b89ab[_0x2813a5]&&_0x3b89ab[_0x2813a5][_0x29ac('0x3b')]!==_0x29ac('0xc3')){utils[_0x29ac('0xba')](_0x54bc55['voiceQueues'][_0x3b89ab[_0x2813a5][_0x29ac('0xb7')]],'[clearZombieChannels]');logger[_0x29ac('0x5f')]('[Dialer][checkChannel]',_0x126bdb,_0x2813a5,_0x3b89ab[_0x2813a5][_0x29ac('0xb7')]);delete _0x3b89ab[_0x2813a5];}if(_0x3b89ab[_0x2813a5]&&_0x3b89ab[_0x2813a5][_0x29ac('0x3b')]===_0x29ac('0xc3')){utils['decrementOriginate'](_0x54bc55['campaigns'][_0x3b89ab[_0x2813a5]['queue']],_0x29ac('0x157'));logger[_0x29ac('0x5f')]('[Dialer][checkChannel][ivr]',_0x126bdb,_0x2813a5,_0x3b89ab[_0x2813a5][_0x29ac('0xb7')]);delete _0x3b89ab[_0x2813a5];}},0x2328);}});}});}}};Dialer[_0x29ac('0x1b')][_0x29ac('0x158')]=function(_0x5cb639){return Promise[_0x29ac('0xa2')]()[_0x29ac('0x93')](voiceQueueRt['getVoiceQueueRtPauses'](_0x5cb639))[_0x29ac('0x96')](loggerCatch(_0x29ac('0x159')));};Dialer[_0x29ac('0x1b')][_0x29ac('0x15a')]=function(_0x45713e,_0x451243,_0x12434d){var _0x314e00={'state':0x19,'statedesc':_0x29ac('0x15b')};utils[_0x29ac('0xba')](_0x451243,_0x29ac('0x15c')+_0x45713e);this[_0x29ac('0x11a')](_[_0x29ac('0x5a')](_0x314e00,_[_0x29ac('0x6f')](_0x12434d,[_0x29ac('0xd8'),_0x29ac('0xd9'),_0x29ac('0x15d'),_0x29ac('0xda'),_0x29ac('0xdb')])),_0x29ac('0x15e'),'[emptyContact]');logger['error'](_0x45713e);};Dialer[_0x29ac('0x1b')][_0x29ac('0x11a')]=function(_0x53dabb,_0x2dcaac,_0x535fde){hopperUtils[_0x29ac('0xdf')](_0x53dabb)[_0x29ac('0x96')](loggerCatch(_0x2dcaac));hopperUtils[_0x29ac('0xc2')](_0x53dabb)[_0x29ac('0x96')](loggerCatch(_0x535fde));};Dialer[_0x29ac('0x1b')][_0x29ac('0xd5')]=function(_0x1d260c,_0x529b4e){hopperUtils['createHistory'](_0x1d260c)['catch'](loggerCatch(_0x29ac('0xc1')));if(_0x529b4e==0x0){hopperUtils[_0x29ac('0xc2')](_0x1d260c)['catch'](loggerCatch(_0x29ac('0x15f')));}};Dialer[_0x29ac('0x1b')][_0x29ac('0x151')]=function(_0x4a1e34){return Promise[_0x29ac('0xa2')]()[_0x29ac('0x93')](cmHopper[_0x29ac('0x160')](_0x4a1e34['id'],previewRecallmeReminderInterval))[_0x29ac('0x93')](function(_0x530284){for(var _0x1a43b6=0x0;_0x1a43b6<_0x530284[_0x29ac('0x8f')];_0x1a43b6++){var _0xd5ad23=_0x530284[_0x1a43b6]['Agent']['name'];if(_0xd5ad23)io['to'](util[_0x29ac('0x3f')](_0x29ac('0x14f'),_0xd5ad23))[_0x29ac('0x129')](_0x29ac('0x150'),{'hopper':_0x530284[_0x1a43b6]});}})['catch'](function(){});};Dialer[_0x29ac('0x1b')][_0x29ac('0xa5')]=function(_0x185623){var _0x1a162f=this;return function(){_0x1a162f['handleIvr'](_0x185623);};};Dialer[_0x29ac('0x1b')][_0x29ac('0x161')]=function(_0x529b76,_0x5aeb17){var _0x45fff5=this;var _0x26aa3f=uuid['v4']();this['actions'][_0x26aa3f]=new Action(_0x529b76,_0x5aeb17,_0x26aa3f);return new Promise(function(_0x1f844b,_0x39e2a4){if(_['isUndefined'](_0x529b76)&&typeof _0x529b76!==_0x29ac('0x162')){return _0x39e2a4(msgResponse(_0x29ac('0x163'),_0x29ac('0x88'),_0x29ac('0x164')));}if(_[_0x29ac('0x3a')](_0x5aeb17[_0x29ac('0x165')])||_0x5aeb17[_0x29ac('0x165')]===null){return _0x39e2a4(msgResponse(_0x29ac('0x163'),_0x29ac('0x88'),_0x29ac('0x166')));}var _0x6b2bb1={'XMD-CALLERID':_0x45fff5['actions'][_0x26aa3f][_0x29ac('0x167')](),'XMD-AGI':_0x529b76['dialQueueProject']?util['format'](_0x29ac('0x168'),ipAgi,_0x529b76[_0x29ac('0x137')]):_0x29ac('0x169'),'XMD-AGIAFTER':_0x529b76['dialQueueProject2']?util[_0x29ac('0x3f')]('\x22agi://%s/square,%s\x22',ipAgi,_0x529b76[_0x29ac('0xcc')]):'NONE','XMD-QUEUE':utils[_0x29ac('0x16a')](_0x529b76)?util[_0x29ac('0x3f')](_0x29ac('0x16b'),_0x529b76[_0x29ac('0x41')],_0x529b76['dialQueueOptions']||'',_0x529b76[_0x29ac('0xc0')]?'c':'',_0x529b76[_0x29ac('0xc7')]||0x3):_0x29ac('0x169'),'XMD-CONTACTID':_0x5aeb17[_0x29ac('0xd8')],'XMD-CDRTYPE':_0x29ac('0x8'),'CALLERID(all)':_0x45fff5[_0x29ac('0x25')][_0x26aa3f][_0x29ac('0x167')](),'XMD-AMD':_0x529b76['dialAMDActive']?_0x29ac('0x144'):_0x29ac('0x169'),'XMD-DESTINATION':_0x29ac('0x10f')};if(_0x529b76[_0x29ac('0x110')]){_0x6b2bb1[_0x29ac('0x16c')]=_0x529b76[_0x29ac('0x16d')]||0x9c4;_0x6b2bb1[_0x29ac('0x16e')]=_0x529b76['dialAMDGreeting']||0x5dc;_0x6b2bb1[_0x29ac('0x16f')]=_0x529b76[_0x29ac('0x170')]||0x320;_0x6b2bb1['XMD-AMDTOTALANALYSISTIME']=_0x529b76[_0x29ac('0x171')]||0x1388;_0x6b2bb1[_0x29ac('0x172')]=_0x529b76[_0x29ac('0x173')]||0x64;_0x6b2bb1['XMD-AMDBETWEENWORDSSILENCE']=_0x529b76[_0x29ac('0x174')]||0x32;_0x6b2bb1[_0x29ac('0x175')]=_0x529b76['dialAMDMaximumNumberOfWords']||0x3;_0x6b2bb1['XMD-AMDSILENCETHRESHOLD']=_0x529b76[_0x29ac('0x176')]||0x100;_0x6b2bb1['XMD-AMDMAXIMUMWORDLENGTH']=_0x529b76[_0x29ac('0x177')]||0x1388;}if(utils['isOutboundQueue'](_0x529b76)){_0x6b2bb1['XMD-VOICEQUEUEID']=_0x5aeb17['VoiceQueueId'];}else{_0x6b2bb1[_0x29ac('0x178')]=_0x5aeb17[_0x29ac('0xdb')];}var _0xd3cc17=utils[_0x29ac('0x179')](_0x5aeb17['Contact']);Object['assign'](_0x6b2bb1,_0xd3cc17);var _0x188b06=_0x45fff5['isTrunkReachable'](_0x529b76['Trunk'])?utils['getCallerId'](_0x529b76[_0x29ac('0x80')]['callerid'],_0x529b76[_0x29ac('0x17a')],_0x529b76['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x29ac('0x17b')](_0x529b76[_0x29ac('0x17c')],_0x529b76['dialRandomLastDigitCallerIdNumber']):_0x529b76[_0x29ac('0x17c')]):utils[_0x29ac('0x17d')](_[_0x29ac('0xf1')](_0x529b76[_0x29ac('0x81')])?_0x529b76[_0x29ac('0x80')][_0x29ac('0x17e')]:_0x529b76[_0x29ac('0x81')][_0x29ac('0x17e')],_0x529b76[_0x29ac('0x17a')],_0x529b76[_0x29ac('0x17f')]>0x0?utils['getCallerIdRandom'](_0x529b76[_0x29ac('0x17c')],_0x529b76[_0x29ac('0x17f')]):_0x529b76['dialOriginateCallerIdNumber']);if(_0x188b06){_0x6b2bb1['XMD-ORIGINATECALLERIDNAME']=_0x45fff5[_0x29ac('0x25')][_0x26aa3f][_0x29ac('0x180')]=utils[_0x29ac('0x181')](_0x188b06);_0x6b2bb1[_0x29ac('0x182')]=_0x5aeb17[_0x29ac('0x165')];}_0x529b76[_0x29ac('0x183')]=_0x6b2bb1;return ami['Action']({'actionid':_0x26aa3f,'action':_0x29ac('0x163'),'channel':_0x45fff5['isTrunkReachable'](_0x529b76[_0x29ac('0x80')])?util[_0x29ac('0x3f')](_0x29ac('0x184'),_0x529b76['Trunk'][_0x29ac('0x41')],isNotNull(_0x529b76[_0x29ac('0x185')])?_0x529b76[_0x29ac('0x185')]['trim']()||'':'',_0x529b76['dialCutDigit']>0x0?_0x5aeb17['phone'][_0x29ac('0x186')](_0x529b76[_0x29ac('0x187')]):_0x5aeb17[_0x29ac('0x165')]):util['format']('SIP/%s/%s%s',_[_0x29ac('0xf1')](_0x529b76[_0x29ac('0x81')])?_0x529b76[_0x29ac('0x80')][_0x29ac('0x41')]:_0x529b76['TrunkBackup'][_0x29ac('0x41')],isNotNull(_0x529b76[_0x29ac('0x185')])?_0x529b76[_0x29ac('0x185')][_0x29ac('0x188')]()||'':'',_0x529b76[_0x29ac('0x187')]>0x0?_0x5aeb17[_0x29ac('0x165')]['substring'](_0x529b76[_0x29ac('0x187')]):_0x5aeb17[_0x29ac('0x165')]),'callerid':_0x188b06,'Exten':_0x29ac('0x10f'),'Context':_0x29ac('0x189'),'Priority':'1','variable':_0x6b2bb1,'timeout':(_0x529b76[_0x29ac('0x18a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x26aa3f})['then'](function(_0x411d82){return _0x1f844b(_0x411d82);})[_0x29ac('0x96')](function(_0x1744fb){_0x529b76[_0x29ac('0x18b')]+=0x1;var _0x236716=new History(_0x45fff5[_0x29ac('0x25')][_0x26aa3f]);logger[_0x29ac('0x5f')](util['format'](_0x29ac('0x18c'),JSON[_0x29ac('0x6e')](_0x1744fb)));_0x236716[_0x29ac('0x68')]=0xe;_0x236716[_0x29ac('0x69')]=_0x29ac('0x18d');_0x236716[_0x29ac('0x6b')]=moment()[_0x29ac('0x3f')](_0x29ac('0xbc'));_0x236716[_0x29ac('0x6a')]=_0x236716[_0x29ac('0x6b')];hopperUtils[_0x29ac('0xdf')](_0x236716)['catch'](loggerCatch(_0x29ac('0x18e')));_0x45fff5[_0x29ac('0xc2')](_0x236716)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x18e')))['finally'](function(){delete _0x45fff5[_0x29ac('0x25')][_0x26aa3f];return _0x39e2a4(msgResponse(_0x29ac('0x163'),_0x29ac('0x7a'),_0x29ac('0x18f')));});});});};Dialer[_0x29ac('0x1b')][_0x29ac('0x190')]=function(_0x32b9a2,_0x40597e,_0x1d940e){var _0x5186c8=new History(_0x40597e);if(_0x5186c8[_0x29ac('0x120')]+_0x5186c8[_0x29ac('0x12d')]+_0x5186c8['countnoanswerretry']+_0x5186c8[_0x29ac('0x12e')]+_0x5186c8[_0x29ac('0xcd')]+_0x5186c8['countabandonedretry']+_0x5186c8[_0x29ac('0x11e')]+_0x5186c8[_0x29ac('0x121')]>=_0x1d940e[_0x29ac('0x12f')]-0x1){return!![];}switch(_0x32b9a2){case 0x3:if(_0x5186c8[_0x29ac('0x191')]>=_0x1d940e[_0x29ac('0x192')]-0x1){return!![];}hopperUtils[_0x29ac('0xd6')]({'active':![],'countnoanswerretry':_0x5186c8[_0x29ac('0x191')]+=0x1,'scheduledat':moment()['add'](_0x1d940e[_0x29ac('0x193')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5186c8['ContactId'],'ListId':_0x5186c8[_0x29ac('0xd9')],'VoiceQueueId':_0x5186c8[_0x29ac('0xda')]||undefined,'CampaignId':_0x5186c8[_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x194')));break;case 0x5:if(_0x5186c8[_0x29ac('0x120')]>=_0x1d940e[_0x29ac('0x195')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x5186c8['countbusyretry']+=0x1,'scheduledat':moment()[_0x29ac('0xd7')](_0x1d940e[_0x29ac('0x196')],'minutes')[_0x29ac('0x3f')](_0x29ac('0xbc')),'ContactId':_0x5186c8[_0x29ac('0xd8')],'ListId':_0x5186c8[_0x29ac('0xd9')],'VoiceQueueId':_0x5186c8[_0x29ac('0xda')]||undefined,'CampaignId':_0x5186c8[_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x197')));break;case 0x8:if(_0x5186c8[_0x29ac('0x12d')]>=_0x1d940e[_0x29ac('0x198')]-0x1){return!![];}hopperUtils[_0x29ac('0xd6')]({'active':![],'countcongestionretry':_0x5186c8[_0x29ac('0x12d')]+=0x1,'scheduledat':moment()[_0x29ac('0xd7')](_0x1d940e[_0x29ac('0x199')],_0x29ac('0xe7'))[_0x29ac('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5186c8[_0x29ac('0xd8')],'ListId':_0x5186c8[_0x29ac('0xd9')],'VoiceQueueId':_0x5186c8[_0x29ac('0xda')]||undefined,'CampaignId':_0x5186c8[_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x19a')));break;case 0x0:if(_0x5186c8[_0x29ac('0x12e')]>=_0x1d940e['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x29ac('0xd6')]({'active':![],'countnosuchnumberretry':_0x5186c8[_0x29ac('0x12e')]+=0x1,'scheduledat':moment()[_0x29ac('0xd7')](_0x1d940e[_0x29ac('0x19b')],_0x29ac('0xe7'))[_0x29ac('0x3f')](_0x29ac('0xbc')),'ContactId':_0x5186c8[_0x29ac('0xd8')],'ListId':_0x5186c8[_0x29ac('0xd9')],'VoiceQueueId':_0x5186c8['VoiceQueueId']||undefined,'CampaignId':_0x5186c8['CampaignId']||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x19c')));}break;case 0xa:if(_0x5186c8[_0x29ac('0xcd')]>=_0x1d940e[_0x29ac('0xd4')]-0x1){return!![];}hopperUtils[_0x29ac('0xd6')]({'active':![],'countdropretry':_0x5186c8[_0x29ac('0xcd')]+=0x1,'scheduledat':moment()['add'](_0x1d940e['dialDropRetryFrequency'],_0x29ac('0xe7'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5186c8[_0x29ac('0xd8')],'ListId':_0x5186c8[_0x29ac('0xd9')],'VoiceQueueId':_0x5186c8[_0x29ac('0xda')]||undefined,'CampaignId':_0x5186c8['CampaignId']||undefined})['catch'](loggerCatch(_0x29ac('0xdc')));break;case 0xb:if(_0x5186c8[_0x29ac('0xe4')]>=_0x1d940e['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x5186c8['countabandonedretry']+=0x1,'scheduledat':moment()[_0x29ac('0xd7')](_0x1d940e[_0x29ac('0xe5')],_0x29ac('0xe7'))[_0x29ac('0x3f')](_0x29ac('0xbc')),'ContactId':_0x5186c8[_0x29ac('0xd8')],'ListId':_0x5186c8[_0x29ac('0xd9')],'VoiceQueueId':_0x5186c8['VoiceQueueId']||undefined,'CampaignId':_0x5186c8[_0x29ac('0xdb')]||undefined})['catch'](loggerCatch(_0x29ac('0xe8')));break;case 0x13:if(_0x5186c8[_0x29ac('0x11e')]>=_0x1d940e[_0x29ac('0x124')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x5186c8[_0x29ac('0x11e')]+=0x1,'scheduledat':moment()[_0x29ac('0xd7')](_0x1d940e['dialMachineRetryFrequency'],'minutes')[_0x29ac('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5186c8[_0x29ac('0xd8')],'ListId':_0x5186c8[_0x29ac('0xd9')],'VoiceQueueId':_0x5186c8[_0x29ac('0xda')]||undefined,'CampaignId':_0x5186c8[_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x128')));break;case 0x14:if(_0x5186c8[_0x29ac('0x121')]>=_0x1d940e[_0x29ac('0x19d')]-0x1){return!![];}hopperUtils[_0x29ac('0xd6')]({'active':![],'countagentrejectretry':_0x5186c8[_0x29ac('0x121')]+=0x1,'scheduledat':moment()['add'](_0x1d940e[_0x29ac('0x19e')],_0x29ac('0xe7'))[_0x29ac('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5186c8['ContactId'],'ListId':_0x5186c8['ListId'],'VoiceQueueId':_0x5186c8[_0x29ac('0xda')]||undefined,'CampaignId':_0x5186c8[_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x19f')));break;default:return!![];}};Dialer[_0x29ac('0x1b')][_0x29ac('0x10c')]=function(_0x170f45,_0x27aa5c,_0x1c2b2f){var _0x297ec6=this;var _0x15560b=new History(_0x170f45);var _0x5e1487=![];var _0xd909a3;var _0x286a6a;return new Promise(function(_0x3426d7,_0x70ce51){if(_[_0x29ac('0x3a')](_0x27aa5c)&&typeof _0x27aa5c!==_0x29ac('0x162')){return _0x70ce51(msgResponse(_0x29ac('0x1a0'),_0x29ac('0x88'),'entity\x20is\x20undefine'));}if(_[_0x29ac('0x3a')](_0x1c2b2f)&&typeof _0x1c2b2f!==_0x29ac('0x162')){return _0x70ce51(msgResponse(_0x29ac('0x1a0'),_0x29ac('0x88'),_0x29ac('0x1a1')));}hopperUtils[_0x29ac('0xd1')](_0x15560b,_0x1c2b2f[_0x29ac('0xbe')],_0x27aa5c)[_0x29ac('0x93')](function(_0x206f8){if(_0x206f8['additional']==0x1)_0x5e1487=!![];switch(_0x1c2b2f['reason']){case'0':_0x27aa5c[_0x29ac('0x1a2')]+=0x1;_0x15560b['state']=0x0;_0x15560b['statedesc']=_0x29ac('0x1a3');_0x15560b[_0x29ac('0x12e')]+=0x1;_0x15560b['countglobal']+=0x1;ami[_0x29ac('0x129')]('custom:agentnosuchnumber',ut[_0x29ac('0x118')](_0x170f45,'nosuchnumber'));_0xd909a3=_0x27aa5c[_0x29ac('0x19b')];_0x286a6a=_0x27aa5c[_0x29ac('0xd0')];hopperUtils[_0x29ac('0xdf')](_0x15560b)[_0x29ac('0x96')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x297ec6[_0x29ac('0x190')](0x0,_0x170f45,_0x27aa5c)&&!_0x5e1487){if(_0x15560b[_0x29ac('0x12e')]>=_0x27aa5c[_0x29ac('0x1a4')]){_0x297ec6[_0x29ac('0x125')](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1a5'));}else{_0x297ec6[_0x29ac('0x122')](_0x15560b,_0x3426d7,_0x70ce51,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x27aa5c['outboundNoAnswerCallsDay']+=0x1;_0x15560b[_0x29ac('0x68')]=0x3;_0x15560b['statedesc']=_0x29ac('0x1a6');_0x15560b[_0x29ac('0x191')]+=0x1;_0x15560b[_0x29ac('0xce')]+=0x1;var _0x27d605=ut['buildNoAnswerEventPayload'](_0x170f45,_0x27aa5c);ami[_0x29ac('0x129')](_0x29ac('0x1a7'),_0x27d605);_0xd909a3=_0x27aa5c['dialNoAnswerRetryFrequency'];_0x286a6a=_0x27aa5c[_0x29ac('0xd0')];hopperUtils['createHistory'](_0x15560b)[_0x29ac('0x96')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x297ec6['checkRetriveMax'](0x3,_0x170f45,_0x27aa5c)&&!_0x5e1487){if(_0x15560b[_0x29ac('0x191')]>=_0x27aa5c[_0x29ac('0x192')]){_0x297ec6[_0x29ac('0x125')](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1a8'));}else{_0x297ec6['stateGlobal'](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1a8'));}}break;case'5':_0x27aa5c[_0x29ac('0x1a9')]+=0x1;_0x15560b[_0x29ac('0x68')]=0x5;_0x15560b[_0x29ac('0x69')]=_0x29ac('0x1aa');_0x15560b[_0x29ac('0x120')]+=0x1;_0x15560b[_0x29ac('0xce')]+=0x1;ami[_0x29ac('0x129')](_0x29ac('0x1ab'),ut['buildObj'](_0x170f45,'busy'));_0xd909a3=_0x27aa5c[_0x29ac('0x196')];_0x286a6a=_0x27aa5c[_0x29ac('0xd0')];hopperUtils[_0x29ac('0xdf')](_0x15560b)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x1ac')));if(_0x297ec6[_0x29ac('0x190')](0x5,_0x170f45,_0x27aa5c)&&!_0x5e1487){if(_0x15560b[_0x29ac('0x120')]>=_0x27aa5c['dialBusyMaxRetry']){_0x297ec6[_0x29ac('0x125')](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1ad'));}else{_0x297ec6[_0x29ac('0x122')](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1ad'));}}break;case'8':_0x27aa5c[_0x29ac('0x1ae')]+=0x1;_0x15560b['state']=0x8;_0x15560b[_0x29ac('0x69')]='Congestion';_0x15560b[_0x29ac('0x12d')]+=0x1;_0x15560b['countglobal']+=0x1;_0xd909a3=_0x27aa5c[_0x29ac('0x199')];_0x286a6a=_0x27aa5c['callAdditionalPhoneAfterMin'];ami['emit'](_0x29ac('0x1af'),ut['buildObj'](_0x170f45,_0x29ac('0x1b0')));hopperUtils[_0x29ac('0xdf')](_0x15560b)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x1b1')));if(_0x297ec6['checkRetriveMax'](0x8,_0x170f45,_0x27aa5c)&&!_0x5e1487){if(_0x15560b[_0x29ac('0x12d')]>=_0x27aa5c[_0x29ac('0x198')]){_0x297ec6[_0x29ac('0x125')](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1b2'));}else{_0x297ec6[_0x29ac('0x122')](_0x15560b,_0x3426d7,_0x70ce51,'reason\x208\x20congestion');}}break;case'11':_0x27aa5c[_0x29ac('0x1b3')]+=0x1;_0x15560b[_0x29ac('0x68')]=0xb;_0x15560b['statedesc']=_0x29ac('0xe2');_0x15560b[_0x29ac('0xe4')]+=0x1;_0x15560b[_0x29ac('0xce')]+=0x1;_0xd909a3=_0x27aa5c[_0x29ac('0xe5')];_0x286a6a=_0x27aa5c[_0x29ac('0xd0')];hopperUtils[_0x29ac('0xdf')](_0x15560b)['catch'](loggerCatch(_0x29ac('0xe9')));if(_0x297ec6['checkRetriveMax'](0xb,_0x170f45,_0x27aa5c)&&!_0x5e1487){if(_0x15560b[_0x29ac('0xe4')]>=_0x27aa5c['dialAbandonedMaxRetry']){_0x297ec6[_0x29ac('0x125')](_0x15560b,_0x3426d7,_0x70ce51,'reason\x2011\x20abandoned');}else{_0x297ec6[_0x29ac('0x122')](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1b4'));}}break;case'20':_0x27aa5c['outboundRejectCallsDay']+=0x1;_0x15560b[_0x29ac('0x68')]=0x14;_0x15560b['statedesc']=_0x29ac('0x1b5');_0x15560b[_0x29ac('0x121')]+=0x1;_0x15560b[_0x29ac('0xce')]+=0x1;_0xd909a3=_0x27aa5c['dialAgentRejectRetryFrequency'];_0x286a6a=_0x27aa5c[_0x29ac('0xd0')];ami[_0x29ac('0x129')](_0x29ac('0x1b6'),ut[_0x29ac('0x118')](_0x170f45,'agentreject'));hopperUtils['createHistory'](_0x15560b)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x1b7')));if(_0x297ec6[_0x29ac('0x190')](0x14,_0x170f45,_0x27aa5c)&&!_0x5e1487){if(_0x15560b['countagentrejectretry']>=_0x27aa5c[_0x29ac('0x19d')]){_0x297ec6[_0x29ac('0x125')](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1b8'));}else{_0x297ec6[_0x29ac('0x122')](_0x15560b,_0x3426d7,_0x70ce51,_0x29ac('0x1b8'));}}break;default:_0x27aa5c['outboundUnknownCallsDay']+=0x1;_0x15560b[_0x29ac('0x68')]=0xc;_0x15560b[_0x29ac('0x69')]=_0x1c2b2f[_0x29ac('0xbe')];_0xd909a3=_0x27aa5c[_0x29ac('0x19e')];_0x286a6a=_0x27aa5c[_0x29ac('0xd0')];hopperUtils[_0x29ac('0xdf')](_0x15560b)[_0x29ac('0x96')](loggerCatch(_0x29ac('0x1b9')));if(_0x297ec6['checkRetriveMax'](_0x1c2b2f[_0x29ac('0xbe')],_0x170f45,_0x27aa5c)&&!_0x5e1487){if(_0x15560b[_0x29ac('0x120')]+_0x15560b[_0x29ac('0x12d')]+_0x15560b['countnoanswerretry']+_0x15560b[_0x29ac('0x12e')]+_0x15560b['countdropretry']+_0x15560b[_0x29ac('0xe4')]+_0x15560b['countmachineretry']+_0x15560b[_0x29ac('0x121')]>=_0x27aa5c[_0x29ac('0x12f')]){_0x297ec6[_0x29ac('0x122')](_0x15560b,_0x3426d7,_0x70ce51,_0x1c2b2f[_0x29ac('0xbe')]);}else{_0x297ec6[_0x29ac('0x125')](_0x15560b,_0x3426d7,_0x70ce51,_0x1c2b2f[_0x29ac('0xbe')]);}}}})[_0x29ac('0x93')](function(){if(_0x5e1487){hopperUtils[_0x29ac('0xea')](_0x15560b,_0xd909a3,_0x286a6a)[_0x29ac('0x93')](function(){return _0x3426d7(0x1);});}});});};Dialer[_0x29ac('0x1b')][_0x29ac('0x122')]=function(_0x29ca3c,_0x13b0be,_0xdcf762,_0x4b1081){var _0x1ede7f=new Final(_0x29ca3c);_0x1ede7f[_0x29ac('0x68')]=0xf;_0x1ede7f['statedesc']=_0x29ac('0x1ba');this[_0x29ac('0x125')](_0x1ede7f,_0x13b0be,_0xdcf762,_0x4b1081);};Dialer['prototype']['createStateFinal']=function(_0x598626,_0x54bc23,_0x111add,_0x3155c0){hopperUtils[_0x29ac('0xc2')](_0x598626)['then'](function(){return _0x54bc23(msgResponse(_0x29ac('0x1a0'),_0x29ac('0x10a'),_0x3155c0));})[_0x29ac('0x96')](function(){return _0x111add(msgResponse(_0x29ac('0x1bb'),_0x29ac('0x88'),_0x29ac('0x1bc')));});};Dialer[_0x29ac('0x1b')][_0x29ac('0xa')]=function(_0xf2816d){var _0x493bec=_0xf2816d['dialPredictiveOptimizationPercentage']/0x64;var _0xa0020c=_0xf2816d[_0x29ac('0x1bd')]/(_0xf2816d[_0x29ac('0x1bd')]+_0xf2816d[_0x29ac('0xbd')]);var _0x375fc9=Math[_0x29ac('0x1be')](_0xf2816d[_0x29ac('0x1bf')]*(_0xf2816d[_0x29ac('0x1c0')]/0x64));var _0x1e5536=Math['round'](_0xf2816d[_0x29ac('0x1bf')]*(_0xf2816d['predictiveIntervalMinThreshold']/0x64));var _0x54f8c1=_0xf2816d['available']+_0xf2816d[_0x29ac('0x1c1')];var _0x21e691=Math[_0x29ac('0x1c2')](_0xf2816d['erlangCalls']*_0xf2816d[_0x29ac('0x59')]*_0xf2816d[_0x29ac('0x1c3')]*_0xf2816d['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0xf2816d[_0x29ac('0x27')])){if(!_[_0x29ac('0x3a')](_0xf2816d[_0x29ac('0x5b')])){_0xf2816d[_0x29ac('0x5b')]=undefined;loggerPredictive[_0x29ac('0x5f')](_0x29ac('0x1c4'),_0x29ac('0x1c5'));}if(!_['isUndefined'](_0xf2816d[_0x29ac('0x5d')])){loggerPredictive[_0x29ac('0x5f')]('[startMethodPredictive][StartProgressive]',_0x29ac('0x1c6'));clearInterval(_0xf2816d[_0x29ac('0x5d')]);_0xf2816d[_0x29ac('0x5d')]=undefined;}_0xf2816d['startProgressive']=moment()[_0x29ac('0x3f')](_0x29ac('0xbc'));loggerPredictive[_0x29ac('0x44')](_0xf2816d[_0x29ac('0x41')],_0x29ac('0x1c7'),_0xf2816d[_0x29ac('0x27')]);this[_0x29ac('0xa9')](_0xf2816d,0x1);}else if(ifInterval(_0xf2816d[_0x29ac('0x1c8')],_0xf2816d[_0x29ac('0x27')])){this[_0x29ac('0xa9')](_0xf2816d,0x1);loggerPredictiveCalls[_0x29ac('0x44')]('[startMethodPredictive][StartProgressive][Loop]',_0xf2816d[_0x29ac('0x27')],_0xf2816d[_0x29ac('0x41')]);_0xf2816d[_0x29ac('0x1c9')]=0x0;_0xf2816d[_0x29ac('0xc8')]=0x0;}else if(_0x493bec<_0xa0020c&&_0xf2816d[_0x29ac('0x1ca')]===_0x29ac('0x1cb')){clearPredictiveAttributes(_0xf2816d);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x1cc'),_0x29ac('0x1cd'),_0xa0020c,_0x29ac('0x27'),_0xf2816d[_0x29ac('0x41')]);}else if(_0x21e691<_0xf2816d[_0x29ac('0xc8')]&&_0xf2816d[_0x29ac('0x1ca')]===_0x29ac('0x1cb')){clearPredictiveAttributes(_0xf2816d);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x1ce'),_0x29ac('0x1cf'),_0x21e691,'Drop\x20in\x20this\x20interval',_0xf2816d['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0xf2816d[_0x29ac('0x41')]);}else if(!ifInterval(_0xf2816d[_0x29ac('0x1c8')],_0xf2816d[_0x29ac('0x27')])&&_['isUndefined'](_0xf2816d[_0x29ac('0x5b')])&&!_['isUndefined'](_0xf2816d[_0x29ac('0x27')])){_0xf2816d[_0x29ac('0x5b')]=moment()[_0x29ac('0x3f')](_0x29ac('0xbc'));loggerPredictive['info'](_0xf2816d[_0x29ac('0x41')],_0x29ac('0x1d0'),_0xf2816d['startPredictive']);hopperUtils[_0x29ac('0x1d1')](_0xf2816d[_0x29ac('0x1c8')])[_0x29ac('0x93')](this[_0x29ac('0x1d2')](_0xf2816d))['then'](mergeDataErlangB(_0xf2816d))[_0x29ac('0x93')](this[_0x29ac('0x1d3')](_0xf2816d))[_0x29ac('0x96')](loggerCatchPredictive(_0x29ac('0x1d4'),_0xf2816d));}else if(!ifInterval(_0xf2816d[_0x29ac('0x1c8')],_0xf2816d[_0x29ac('0x5b')])){_0xf2816d[_0x29ac('0xc8')]=0x0;_0xf2816d[_0x29ac('0x5b')]=moment()['format'](_0x29ac('0xbc'));loggerPredictive[_0x29ac('0x44')](_0xf2816d['name'],_0x29ac('0x1d5'),_0xf2816d[_0x29ac('0x5b')]);clearInterval(_0xf2816d[_0x29ac('0x5d')]);_0xf2816d['handlePredictive']=undefined;hopperUtils[_0x29ac('0x1d1')](_0xf2816d[_0x29ac('0x1c8')])['then'](this['getDataPredictive'](_0xf2816d))['then'](mergeDataErlangB(_0xf2816d))[_0x29ac('0x93')](this['startMethodPredictive'](_0xf2816d))['catch'](loggerCatchPredictive(_0x29ac('0x1d6'),_0xf2816d));}else if(_0xf2816d[_0x29ac('0x1bf')]&&_0x54f8c1<_0xf2816d['predictiveIntervalAvailable']-_0x1e5536){clearPredictiveAttributes(_0xf2816d);loggerPredictive[_0x29ac('0x44')](_0xf2816d[_0x29ac('0x41')],_0x29ac('0x1d7'),_0x54f8c1,')\x20are\x20less\x20than\x20threshold\x20(',_0xf2816d[_0x29ac('0x1bf')],'-',_0x1e5536,'=',_0xf2816d[_0x29ac('0x1bf')]-_0x1e5536,')');}else if(_0xf2816d[_0x29ac('0x1bf')]&&_0x54f8c1>_0xf2816d[_0x29ac('0x1bf')]+_0x375fc9){clearPredictiveAttributes(_0xf2816d);loggerPredictive[_0x29ac('0x44')](_0xf2816d[_0x29ac('0x41')],_0x29ac('0x1d7'),_0x54f8c1,_0x29ac('0x1d8'),_0xf2816d[_0x29ac('0x1bf')],'+',_0x375fc9,'=',_0xf2816d[_0x29ac('0x1bf')]+_0x375fc9,')');}};Dialer[_0x29ac('0x1b')][_0x29ac('0x1d2')]=function(_0x50457f){var _0x562527=this;return function(_0x37be80){return new Promise(function(_0x1148ca,_0x5e8edf){_['merge'](_0x50457f,_0x37be80[0x0]);if(checkGetDataPredictive(_0x37be80[0x0])){var _0x193e8e=_0x50457f[_0x29ac('0x1bf')]=_0x50457f['talking']+_0x50457f[_0x29ac('0x1d9')];var _0x4dc799=_0x50457f[_0x29ac('0x1c8')]*0x3c;var _0x15568b=_0x37be80[0x0][_0x29ac('0x4f')]+_0x37be80[0x0][_0x29ac('0x4d')];var _0x5343d2=(_0x37be80[0x0][_0x29ac('0x47')]+_0x37be80[0x0][_0x29ac('0x49')]+_0x37be80[0x0][_0x29ac('0x4b')])/_0x37be80[0x0][_0x29ac('0x45')];_0x50457f['predictiveIntervalHitRate']=_0x5343d2>0x0?_0x5343d2:0x1;switch(_0x50457f['dialPredictiveOptimization']){case _0x29ac('0x1cb'):var _0xbc3b54=_0x50457f[_0x29ac('0x1da')]/0x64;return _0x562527[_0x29ac('0x1db')](_0x193e8e,_0x4dc799,_0x15568b,_0x5343d2,_0xbc3b54)[_0x29ac('0x93')](function(_0x54a92a){return _0x1148ca(_0x54a92a);});case _0x29ac('0x1dc'):var _0x16c0f7=_0x50457f['dialPredictiveOptimizationPercentage']/0x64;return _0x562527[_0x29ac('0x1dd')](_0x193e8e,_0x4dc799,_0x15568b,_0x5343d2,_0x16c0f7)['then'](function(_0x954f43){return _0x1148ca(_0x954f43);});default:return _0x5e8edf(msgResponse(_0x29ac('0x1de'),_0x29ac('0x88'),_0x29ac('0x1df')));}}else{return _0x5e8edf(msgResponse('[getDataPredictive]',_0x29ac('0x88'),_0x29ac('0x1e0')));}});};};Dialer[_0x29ac('0x1b')][_0x29ac('0x1e1')]=function(_0x223dd8){var _0x58451d=this;return function(_0x55bb34){return new Promise(function(_0x27a2f5,_0x341108){_[_0x29ac('0x5a')](_0x223dd8,_0x55bb34[0x0]);if(checkGetDataPredictive(_0x55bb34[0x0])){loggerPredictive[_0x29ac('0x44')](JSON[_0x29ac('0x6e')](_0x55bb34[0x0]));if(_0x223dd8[_0x29ac('0x1ca')]==='dropRate'){return _0x58451d['getVoiceQueueRtPauses'](_0x223dd8['id'])[_0x29ac('0x93')](function(_0x262d26){var _0x41703a=_0x223dd8[_0x29ac('0x1e2')]-_0x262d26[0x0][_0x29ac('0x1e3')];var _0x581f2d=_0x223dd8[_0x29ac('0x1c8')]*0x3c;var _0x33fbfb=_0x55bb34[0x0][_0x29ac('0x4f')]+_0x55bb34[0x0]['predictiveIntervalAvgHoldtime'];var _0x4b6185=(_0x55bb34[0x0][_0x29ac('0x47')]+_0x55bb34[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x55bb34[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x55bb34[0x0][_0x29ac('0x45')];var _0x399d1b=_0x223dd8[_0x29ac('0x1da')]/0x64;_0x223dd8[_0x29ac('0x1e4')]=_0x262d26[0x0][_0x29ac('0x1e3')]||0x0;_0x223dd8[_0x29ac('0x1c3')]=_0x4b6185>0x0?_0x4b6185:0x1;return _0x58451d['abandonmentRate'](_0x41703a,_0x581f2d,_0x33fbfb,_0x4b6185,_0x399d1b);})[_0x29ac('0x93')](function(_0x1492c7){return _0x27a2f5(_0x1492c7);})[_0x29ac('0x96')](function(_0x2413ee){return _0x341108(msgResponse(_0x29ac('0x1e5'),'Failure',JSON[_0x29ac('0x6e')](_0x2413ee)));});}if(_0x223dd8['dialPredictiveOptimization']===_0x29ac('0x1dc')){return _0x58451d['getVoiceQueueRtPauses'](_0x223dd8['id'])[_0x29ac('0x93')](function(_0x1f3051){var _0x487662=_0x223dd8['loggedIn']-_0x1f3051[0x0][_0x29ac('0x1e3')];var _0x24e091=_0x223dd8[_0x29ac('0x1c8')]*0x3c;var _0xce8244=_0x55bb34[0x0][_0x29ac('0x4f')]+_0x55bb34[0x0][_0x29ac('0x4d')];var _0x46e228=(_0x55bb34[0x0][_0x29ac('0x47')]+_0x55bb34[0x0][_0x29ac('0x49')]+_0x55bb34[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x55bb34[0x0][_0x29ac('0x45')];var _0x1e463b=_0x223dd8['dialPredictiveOptimizationPercentage']/0x64;_0x223dd8[_0x29ac('0x1e4')]=_0x1f3051[0x0]['outboundQueuePauses']||0x0;_0x223dd8['predictiveIntervalHitRate']=_0x46e228>0x0?_0x46e228:0x1;return _0x58451d[_0x29ac('0x1dd')](_0x487662,_0x24e091,_0xce8244,_0x46e228,_0x1e463b);})['then'](function(_0x5a559f){return _0x27a2f5(_0x5a559f);})[_0x29ac('0x96')](function(_0x3fb67f){return _0x341108(msgResponse(_0x29ac('0x1e5'),'Failure',JSON['stringify'](_0x3fb67f)));});}}else{return _0x341108(msgResponse(_0x29ac('0x1de'),_0x29ac('0x88'),'check\x20failure'));}});};};Dialer[_0x29ac('0x1b')]['startMethodPredictive']=function(_0x1d3970){var _0x1bedb1=this;return function(){var _0x1e92db=0x0;var _0x1e70bf=Math[_0x29ac('0x1c2')](_0x1d3970['erlangCallToSecond']*0x3e8);if(_0x1e70bf>0x0){_0x1e70bf=_0x1e70bf<0x64?0x64:_0x1e70bf;loggerPredictive[_0x29ac('0x44')](_0x1d3970[_0x29ac('0x41')],_0x29ac('0x1e6'),_0x1e70bf,_0x29ac('0x1e7'));_0x1d3970['handlePredictive']=setInterval(function(){_0x1bedb1[_0x29ac('0x5d')](_0x1d3970);loggerPredictiveCalls[_0x29ac('0x44')]('[handlePredictive]',_0x1e92db+=0x1);},_0x1e70bf);}else{loggerPredictive[_0x29ac('0x44')](_0x1d3970[_0x29ac('0x41')],_0x29ac('0x1e8'));}};};Dialer['prototype'][_0x29ac('0x1e9')]=function(_0x2a3376,_0x5f1c7a){var _0x5b956f=this;return function(_0x52cf7f){if(_[_0x29ac('0x43')](_0x52cf7f)){if(_[_0x29ac('0xf1')](_0x5f1c7a[_0x29ac('0x15d')])||!_0x5f1c7a['recallme']){if(_0x2a3376[_0x29ac('0xa7')]==='booked'){_0x2a3376[_0x29ac('0x6c')]=_['isUndefined'](_0x2a3376[_0x29ac('0x6c')])?!![]:_0x2a3376[_0x29ac('0x6c')];var _0x3d0016=uuid['v4']();_0x5b956f[_0x29ac('0x25')][_0x3d0016]=new Action(_0x2a3376,_0x5f1c7a,_0x3d0016);loggerBooked[_0x29ac('0x44')](_0x29ac('0x1ea'),_0x3d0016,'queueStatusComplete:\x20',JSON[_0x29ac('0x6e')](_0x2a3376[_0x29ac('0x6c')]),_0x29ac('0x1eb'),_0x2a3376[_0x29ac('0x41')]);if(_0x2a3376[_0x29ac('0x6c')]){_0x2a3376[_0x29ac('0x6c')]=![];_0x5b956f[_0x29ac('0xf5')][_0x5b956f['actions'][_0x3d0016][_0x29ac('0xb7')]]=[];ami[_0x29ac('0x91')]({'actionid':_0x3d0016,'action':_0x29ac('0x1ec'),'queue':_0x2a3376['name']})['catch'](function(){utils[_0x29ac('0xba')](_0x2a3376,'[checkContactBlack]');hopperUtils[_0x29ac('0xd6')]({'active':![],'ContactId':_0x5b956f[_0x29ac('0x25')][_0x3d0016]['ContactId'],'ListId':_0x5b956f[_0x29ac('0x25')][_0x3d0016]['ListId'],'VoiceQueueId':_0x5b956f['actions'][_0x3d0016][_0x29ac('0xda')]||undefined,'CampaignId':_0x5b956f['actions'][_0x3d0016][_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x1ed')));delete _0x5b956f[_0x29ac('0x25')][_0x3d0016];});}else{loggerBooked['info'](_0x29ac('0x1ee'),JSON[_0x29ac('0x6e')](_0x2a3376['queueStatusComplete']),_0x29ac('0x1eb'),_0x2a3376[_0x29ac('0x41')]);utils['decrementOriginate'](_0x2a3376,_0x29ac('0x1ef'));hopperUtils[_0x29ac('0xd6')]({'active':![],'ContactId':_0x5b956f[_0x29ac('0x25')][_0x3d0016]['ContactId'],'ListId':_0x5b956f['actions'][_0x3d0016][_0x29ac('0xd9')],'VoiceQueueId':_0x5b956f[_0x29ac('0x25')][_0x3d0016][_0x29ac('0xda')]||undefined,'CampaignId':_0x5b956f[_0x29ac('0x25')][_0x3d0016][_0x29ac('0xdb')]||undefined})[_0x29ac('0x96')](loggerCatch(_0x29ac('0x1ed')));delete _0x5b956f[_0x29ac('0x25')][_0x3d0016];}}else{return _0x5b956f['actionOriginate'](_0x2a3376,_0x5f1c7a);}}else{if(utils[_0x29ac('0xc5')](undefined,_0x5f1c7a[_0x29ac('0x1f0')])<_0x2a3376[_0x29ac('0x1f1')]*0x3c){if(_0x5f1c7a[_0x29ac('0x1f2')]&&!_0x5f1c7a[_0x29ac('0x1f2')][_0x29ac('0x1f3')]){_0x5b956f['preview']['run'](_0x5f1c7a['id'])[_0x29ac('0xfa')](function(){utils[_0x29ac('0xba')](_0x2a3376,'[checkContactBlack]');});}else{hopperUtils['unlockContact']({'active':![]},_0x5f1c7a['id'],0x1)['finally'](function(){utils[_0x29ac('0xba')](_0x2a3376,_0x29ac('0x1ef'));});}}else{_0x2a3376[_0x29ac('0x1f4')]+=0x1;utils[_0x29ac('0xba')](_0x2a3376,_0x29ac('0x1ef'));if(_0x2a3376[_0x29ac('0x1f5')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5f1c7a[_0x29ac('0xd8')],'ListId':_0x5f1c7a['ListId'],'VoiceQueueId':_0x5f1c7a[_0x29ac('0xda')]||undefined,'CampaignId':_0x5f1c7a[_0x29ac('0xdb')]||undefined})['catch'](loggerCatch(_0x29ac('0x1f6')));hopperUtils[_0x29ac('0xdf')](createObjHistory(_0x2a3376,_0x5f1c7a,utils[_0x29ac('0x66')][_0x29ac('0x1f7')],0x17,_0x29ac('0x1f8')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x5b956f[_0x29ac('0x11a')](createObjHistory(_0x2a3376,_0x5f1c7a,utils[_0x29ac('0x66')]['RECALL_TIMEOUT'],0x16,_0x29ac('0x1f9')),_0x29ac('0x1fa'),'[Originate][HistoryRecallClose]');}}}}else{_0x2a3376[_0x29ac('0x1fb')]+=0x1;_0x5b956f[_0x29ac('0x11a')](createObjHistory(_0x2a3376,_0x5f1c7a,utils[_0x29ac('0x66')][_0x29ac('0x1fc')],0xd,_0x29ac('0x1fd')),'[Originate][historyBlacklist]',_0x29ac('0x1fe'));throw _0x29ac('0x1ff');}};};Dialer['prototype'][_0x29ac('0x200')]=function(_0xc3e732){var _0x5519dd=this;var _0x240388=_0xc3e732[_0x29ac('0x201')]-_0xc3e732[_0x29ac('0x202')];emitCampaignSummary(_0xc3e732);if(_0x240388>0x0&&_0xc3e732[_0x29ac('0x203')]==0x0){if(_0x240388>this[_0x29ac('0x23')]){_0x240388=this[_0x29ac('0x23')];}_0xc3e732[_0x29ac('0x203')]=0x1;hopperUtils['getContactDialerIvr'](_0xc3e732,_0x240388)[_0x29ac('0x93')](function(_0x175f97){_0xc3e732[_0x29ac('0x203')]=0x0;if(_0x175f97){if(!utils[_0x29ac('0x204')](_0x175f97)){_0xc3e732[_0x29ac('0x65')]=utils['CAMPAIGN_STATUS'][_0x29ac('0x205')];logger[_0x29ac('0x44')](_0x29ac('0x206')+_0xc3e732['name']);}else{_0xc3e732[_0x29ac('0x202')]+=_0x175f97[_0x29ac('0x8f')];_0xc3e732[_0x29ac('0x65')]=utils[_0x29ac('0x66')][_0x29ac('0x207')];for(var _0x5cc1c8=0x0;_0x5cc1c8<_0x175f97[_0x29ac('0x8f')];_0x5cc1c8+=0x1){_0xc3e732[_0x29ac('0x208')]+=0x1;if(_[_0x29ac('0xf1')](_0x175f97[_0x5cc1c8])||_[_0x29ac('0xf1')](_0x175f97[_0x5cc1c8]['Contact'])||_[_0x29ac('0xf1')](_0x175f97[_0x5cc1c8][_0x29ac('0x165')])){_0x5519dd[_0x29ac('0x15a')]('[actionOriginate]\x20',_0xc3e732,_0x175f97[_0x5cc1c8]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x29ac('0x6f')](_0x175f97[_0x5cc1c8],[_0x29ac('0xdb'),_0x29ac('0x165')]))[_0x29ac('0x93')](_0x5519dd[_0x29ac('0x1e9')](_0xc3e732,_0x175f97[_0x5cc1c8]))[_0x29ac('0x96')](function(_0x2f75a1){logger[_0x29ac('0x5f')](_0x29ac('0x209'),_0x2f75a1);utils[_0x29ac('0xba')](_0xc3e732,_0x29ac('0x20a'));});}}}}})['catch'](function(_0x283e11){_0xc3e732[_0x29ac('0x203')]=0x0;logger['error'](_0x29ac('0x20b'),_0x283e11);});}};Dialer[_0x29ac('0x1b')][_0x29ac('0xa9')]=function(_0x410e37,_0x28e14f){var _0x526ca8=this;var _0x1a4092=[];if(_0x28e14f<0x1||_0x410e37[_0x29ac('0xa7')]===_0x29ac('0x9')){_0x28e14f=0x1;}var _0x4c52de=Math['floor'](_0x410e37[_0x29ac('0x1d9')]*_0x28e14f)-_0x410e37[_0x29ac('0x202')];if(_0x410e37['dialLimitQueue']>0x0){var _0x2d32ec=_0x410e37[_0x29ac('0x20c')]-_0x410e37[_0x29ac('0x202')]-_0x410e37[_0x29ac('0x1c1')]-_0x410e37[_0x29ac('0x20d')];if(_0x4c52de>_0x2d32ec){_0x4c52de=_0x2d32ec;}}if(_0x4c52de>0x0&&_0x410e37[_0x29ac('0x203')]==0x0){if(_0x410e37[_0x29ac('0xa7')]==='booked'){_0x4c52de=0x1;}if(_0x4c52de>this['maxNumberOriginate']){_0x4c52de=this[_0x29ac('0x23')];}for(var _0x113098 in this[_0x29ac('0xf2')]){if(typeof this[_0x29ac('0xf2')][_0x113098]!=='undefined'){if(this[_0x29ac('0xf2')][_0x113098]['state']===_0x29ac('0x20e')&&this[_0x29ac('0xf2')][_0x113098][_0x29ac('0x7e')]==='reachable'){_0x1a4092['push'](this[_0x29ac('0xf2')][_0x113098]['id']);}}}_0x410e37[_0x29ac('0x203')]=0x1;hopperUtils[_0x29ac('0x20f')](_0x410e37,_0x1a4092,_0x4c52de)[_0x29ac('0x93')](function(_0x1e6a8f){_0x410e37[_0x29ac('0x203')]=0x0;if(_0x1e6a8f){if(!utils[_0x29ac('0x204')](_0x1e6a8f)){hopperUtils[_0x29ac('0x210')](_0x410e37)['then'](sendMessageReschedule(_0x410e37))['catch'](loggerCatch(_0x29ac('0x211')));}else{_0x410e37[_0x29ac('0x202')]+=_0x1e6a8f[_0x29ac('0x8f')];_0x410e37[_0x29ac('0x65')]=_0x410e37[_0x29ac('0xa7')]==='booked'?utils[_0x29ac('0x66')]['ACTIVE']:utils[_0x29ac('0x66')][_0x29ac('0x207')];for(var _0x566bd1=0x0;_0x566bd1<_0x1e6a8f[_0x29ac('0x8f')];_0x566bd1+=0x1){if(_[_0x29ac('0xf1')](_0x1e6a8f[_0x566bd1])||_['isNil'](_0x1e6a8f[_0x566bd1]['Contact'])||_[_0x29ac('0xf1')](_0x1e6a8f[_0x566bd1][_0x29ac('0x165')])){_0x526ca8[_0x29ac('0x15a')](_0x29ac('0x212'),_0x410e37,_0x1e6a8f[_0x566bd1]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x1e6a8f[_0x566bd1],['VoiceQueueId','phone']))[_0x29ac('0x93')](_0x526ca8[_0x29ac('0x1e9')](_0x410e37,_0x1e6a8f[_0x566bd1]))[_0x29ac('0x96')](function(_0x2266f1){logger[_0x29ac('0x5f')](_0x29ac('0x213'),_0x2266f1);utils[_0x29ac('0xba')](_0x410e37,_0x29ac('0x214'));});}}}}})[_0x29ac('0x96')](function(_0x200749){_0x410e37[_0x29ac('0x203')]=0x0;logger[_0x29ac('0x5f')](_0x29ac('0x20b'),_0x200749);});}};Dialer[_0x29ac('0x1b')][_0x29ac('0x5d')]=function(_0x5adaed){if(_0x5adaed['dialLimitQueue']>0x0){var _0x126071=_0x5adaed[_0x29ac('0x20c')]-_0x5adaed[_0x29ac('0x202')]-_0x5adaed[_0x29ac('0x1c1')];if(_0x126071>0x0&&_0x5adaed[_0x29ac('0x203')]==0x0){this[_0x29ac('0x215')](_0x5adaed);}else{loggerPredictiveCalls[_0x29ac('0x44')](_0x29ac('0x216'));}}else{this['tryOriginatePredictive'](_0x5adaed);}};Dialer[_0x29ac('0x1b')]['tryOriginatePredictive']=function(_0x4b8c61){var _0x2eb02a=this;var _0x8742ed=[];_0x4b8c61[_0x29ac('0x202')]+=0x1;for(var _0x2db3df in this[_0x29ac('0xf2')]){if(typeof this[_0x29ac('0xf2')][_0x2db3df]!==_0x29ac('0x155')){if(this[_0x29ac('0xf2')][_0x2db3df][_0x29ac('0x68')]===_0x29ac('0x20e')&&this['agents'][_0x2db3df][_0x29ac('0x7e')]===_0x29ac('0x14d')){_0x8742ed[_0x29ac('0x90')](this[_0x29ac('0xf2')][_0x2db3df]['id']);}}}_0x4b8c61[_0x29ac('0x203')]=0x1;return this[_0x29ac('0x20f')](_0x4b8c61['id'],_0x8742ed,0x1,_0x4b8c61[_0x29ac('0x217')],_0x4b8c61)[_0x29ac('0x93')](function(_0x5d3ddb){_0x4b8c61[_0x29ac('0x203')]=0x1;if(_0x5d3ddb){if(!utils[_0x29ac('0x204')](_0x5d3ddb)){utils[_0x29ac('0x218')](_0x4b8c61,0x1,0x0);return hopperUtils[_0x29ac('0x210')](_0x4b8c61)['then'](sendMessageReschedule(_0x4b8c61))[_0x29ac('0x96')](loggerCatch(_0x29ac('0x211')));}else{_0x4b8c61[_0x29ac('0x65')]=utils[_0x29ac('0x66')][_0x29ac('0x207')];if(_[_0x29ac('0xf1')](_0x5d3ddb[0x0])||_[_0x29ac('0xf1')](_0x5d3ddb[0x0][_0x29ac('0x219')])||_[_0x29ac('0xf1')](_0x5d3ddb[0x0][_0x29ac('0x165')])){_0x2eb02a[_0x29ac('0x15a')]('[actionOriginate]\x20',_0x4b8c61,_0x5d3ddb[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x29ac('0x6f')](_0x5d3ddb[0x0],['VoiceQueueId',_0x29ac('0x165')]))[_0x29ac('0x93')](_0x2eb02a[_0x29ac('0x1e9')](_0x4b8c61,_0x5d3ddb[0x0]))[_0x29ac('0x96')](function(_0x16d766){logger[_0x29ac('0x5f')]('[actionOriginatePredictive]',_0x16d766);utils[_0x29ac('0xba')](_0x4b8c61,'[actionOriginatePredictive]');});}}}})['catch'](function(_0x22413e){_0x4b8c61[_0x29ac('0x203')]=0x0;logger[_0x29ac('0x5f')](_0x29ac('0x20b'),_0x22413e);});};Dialer['prototype'][_0x29ac('0x1db')]=function(_0x112f83,_0x2bde8c,_0x65f107,_0x58d94a,_0x250464,_0x418e6c){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x29ac('0x44')](_0x29ac('0x21a'),_0x112f83);loggerPredictive['info'](_0x29ac('0x21b'),_0x2bde8c);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x21c'),_0x65f107);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',_0x58d94a);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x21d'),_0x250464);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x50'));return new Promise(function(_0x9bea16,_0x309915){if(_0x112f83<=0x0||isNaN(_0x112f83)){return _0x309915(msgResponse(_0x29ac('0x21e'),_0x29ac('0x7a'),_0x29ac('0x21f')+_0x112f83));}if(_0x65f107<=0x0||isNaN(_0x65f107)){return _0x309915(msgResponse('[abandonmentRate]','Error',_0x29ac('0x220')+_0x65f107));}if(_0x58d94a<=0x0||isNaN(_0x58d94a)){return _0x309915(msgResponse(_0x29ac('0x21e'),'Error','p\x20=\x20'+_0x58d94a));}if(_0x2bde8c<=0x0||isNaN(_0x2bde8c)){return _0x309915(msgResponse(_0x29ac('0x21e'),_0x29ac('0x7a'),_0x29ac('0x221')+_0x2bde8c));}if(_0x250464<=0x0||isNaN(_0x250464)){return _0x309915(msgResponse(_0x29ac('0x21e'),_0x29ac('0x7a'),_0x29ac('0x222')+_0x250464));}_0x418e6c=_0x418e6c||0x0;var _0x42e485=0x1/_0x65f107;var _0x5ead04=0x0;var _0x357896=0x0;var _0x5425b6=0x0;var _0x384153=0x0;for(var _0x554c53=0x0;_0x5425b6<_0x250464;_0x554c53+=0x1){_0x357896=_0x554c53/_0x2bde8c;_0x5ead04=(_0x58d94a*_0x357896+_0x418e6c)/_0x42e485;_0x5425b6=utils[_0x29ac('0x223')](_0x5ead04,_0x112f83);_0x384153=_0x5ead04/_0x112f83*(0x1-utils['erlangb'](_0x5ead04,_0x112f83));}return _0x9bea16({'erlangCalls':_0x554c53,'erlangCallToSecond':_0x2bde8c/_0x554c53,'erlangAbandonmentRate':_0x5425b6,'erlangBusyFactor':_0x384153});});};Dialer[_0x29ac('0x1b')][_0x29ac('0x1dd')]=function(_0x4ccb51,_0x1785e6,_0x48b3ab,_0x529f5a,_0x541979,_0x2e6f19){loggerPredictive[_0x29ac('0x44')](_0x29ac('0x224'));loggerPredictive['info'](_0x29ac('0x21a'),_0x4ccb51);loggerPredictive['info'](_0x29ac('0x21b'),_0x1785e6);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x21c'),_0x48b3ab);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x225'),_0x529f5a);loggerPredictive[_0x29ac('0x44')](_0x29ac('0x226'),_0x541979);loggerPredictive[_0x29ac('0x44')]('---------------------------');return new Promise(function(_0xdd69be,_0x2c61cb){if(_0x4ccb51<=0x0||isNaN(_0x4ccb51)){return _0x2c61cb(msgResponse(_0x29ac('0x227'),_0x29ac('0x7a'),_0x29ac('0x21f')+_0x4ccb51));}if(_0x48b3ab<=0x0||isNaN(_0x48b3ab)){return _0x2c61cb(msgResponse(_0x29ac('0x227'),_0x29ac('0x7a'),_0x29ac('0x220')+_0x48b3ab));}if(_0x529f5a<=0x0||isNaN(_0x529f5a)){return _0x2c61cb(msgResponse(_0x29ac('0x227'),_0x29ac('0x7a'),'p\x20=\x20'+_0x529f5a));}if(_0x1785e6<=0x0||isNaN(_0x1785e6)){return _0x2c61cb(msgResponse(_0x29ac('0x227'),_0x29ac('0x7a'),'interval\x20=\x20'+_0x1785e6));}if(_0x541979<=0x0||isNaN(_0x541979)){return _0x2c61cb(msgResponse(_0x29ac('0x227'),'Error',_0x29ac('0x228')+_0x541979));}_0x2e6f19=_0x2e6f19||0x0;var _0x897fb3=0x1/_0x48b3ab;var _0x5408e7=0x0;var _0x3d9aa3=0x0;var _0x29966a=0x0;var _0x2d166c=0x0;for(var _0x481ead=0x0;_0x2d166c<_0x541979;_0x481ead+=0x1){_0x3d9aa3=_0x481ead/_0x1785e6;_0x5408e7=(_0x529f5a*_0x3d9aa3+_0x2e6f19)/_0x897fb3;_0x29966a=utils['erlangb'](_0x5408e7,_0x4ccb51);_0x2d166c=_0x5408e7/_0x4ccb51*(0x1-utils[_0x29ac('0x223')](_0x5408e7,_0x4ccb51));}return _0xdd69be({'erlangCalls':_0x481ead,'erlangCallToSecond':_0x1785e6/_0x481ead,'erlangAbandonmentRate':_0x29966a,'erlangBusyFactor':_0x2d166c});});};module[_0x29ac('0x229')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index dec52b8..40672e4 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa02a=['uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','exports','lodash','moment','isNil','string','voiceQueue'];(function(_0x21c109,_0x2174d5){var _0x446ba4=function(_0x27555b){while(--_0x27555b){_0x21c109['push'](_0x21c109['shift']());}};_0x446ba4(++_0x2174d5);}(_0xa02a,0x1b3));var _0xaa02=function(_0x5745d2,_0x536b58){_0x5745d2=_0x5745d2-0x0;var _0xd6df54=_0xa02a[_0x5745d2];return _0xd6df54;};'use strict';var util=require('util');var _=require(_0xaa02('0x0'));var moment=require(_0xaa02('0x1'));function checkNameSurname(_0x4a8218,_0x51e93e,_0x279399){var _0x1110f3='';if(!_[_0xaa02('0x2')](_0x51e93e)&&_0xaa02('0x3')===typeof _0x51e93e){_0x1110f3+=_0x51e93e;}if(!_[_0xaa02('0x2')](_0x279399)&&_0xaa02('0x3')===typeof _0x279399){_0x1110f3+='\x20'+_0x279399;}if(_0x1110f3!==''){return _0x1110f3;}return _0x4a8218;}function Action(_0x56e440,_0x507780,_0x4be011){this[_0xaa02('0x4')]=_0x56e440;this[_0xaa02('0x5')]=_0x4be011||undefined;this[_0xaa02('0x6')]=checkNameSurname(_0x507780[_0xaa02('0x7')][_0xaa02('0x8')],_0x507780[_0xaa02('0x7')][_0xaa02('0x9')],_0x507780[_0xaa02('0x7')][_0xaa02('0xa')]);this[_0xaa02('0xb')]=_0x507780[_0xaa02('0x8')];this[_0xaa02('0xc')]=_0x56e440[_0xaa02('0x6')];this[_0xaa02('0xd')]=_0x507780[_0xaa02('0xd')]||![];this[_0xaa02('0xe')]=_0x56e440[_0xaa02('0xe')];this[_0xaa02('0xf')]=_0x56e440[_0xaa02('0xf')]||0x3;this[_0xaa02('0x10')]=_0x507780[_0xaa02('0x10')];this[_0xaa02('0x11')]=_0x507780[_0xaa02('0x11')];this[_0xaa02('0x12')]=_0x507780[_0xaa02('0x12')];this[_0xaa02('0x13')]=_0x507780[_0xaa02('0x13')];this[_0xaa02('0x14')]=_0x507780[_0xaa02('0x14')];this[_0xaa02('0x15')]=_0x507780[_0xaa02('0x15')];this[_0xaa02('0x16')]=_0x507780[_0xaa02('0x16')];this[_0xaa02('0x17')]=_0x507780['countmachineretry'];this[_0xaa02('0x18')]=_0x507780[_0xaa02('0x18')];this[_0xaa02('0x19')]=_0x507780[_0xaa02('0x19')];this['ListId']=_0x507780[_0xaa02('0x1a')];this[_0xaa02('0x1b')]=_0x507780[_0xaa02('0x1b')];this[_0xaa02('0x1c')]=_0x507780[_0xaa02('0x1c')];this[_0xaa02('0x1d')]=_0x507780[_0xaa02('0x1d')];this['idHopper']=_0x507780['id'];this[_0xaa02('0x1e')]=_0x507780[_0xaa02('0x7')]['firstName']||'';this[_0xaa02('0x1f')]=moment()[_0xaa02('0x20')](_0xaa02('0x21'));this[_0xaa02('0x22')]=_0x507780[_0xaa02('0x22')];this['callbackuniqueid']=_0x507780['callbackuniqueid'];this['callbackat']=_0x507780[_0xaa02('0x23')];this[_0xaa02('0x24')]=_0x507780['recallme'];this[_0xaa02('0x25')]='';this['originatecalleridname']='';}Action['prototype'][_0xaa02('0x26')]=function(){return util[_0xaa02('0x20')](_0xaa02('0x27'),this['name'],this[_0xaa02('0x4')][_0xaa02('0x28')]>0x0?this['number'][_0xaa02('0x29')](this[_0xaa02('0x4')][_0xaa02('0x28')]):this['number']);};Action[_0xaa02('0x2a')]['getQueue']=function(){return this['queue'];};module[_0xaa02('0x2b')]=Action; \ No newline at end of file +var _0x31f4=['callbackuniqueid','callbackat','originatecalleridnum','originatecalleridname','prototype','getCaller','format','number','substring','dialCutDigit','getQueue','lodash','moment','string','isNil','voiceQueue','uniqueid','name','Contact','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','callback'];(function(_0xb786da,_0x329f86){var _0x5eb28c=function(_0x4c89f2){while(--_0x4c89f2){_0xb786da['push'](_0xb786da['shift']());}};_0x5eb28c(++_0x329f86);}(_0x31f4,0xd8));var _0x431f=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x31f4[_0x1a0daa];return _0x1dbe15;};'use strict';var util=require('util');var _=require(_0x431f('0x0'));var moment=require(_0x431f('0x1'));function checkNameSurname(_0x2e526a,_0x1487da,_0x3765a2){var _0x139916='';if(!_['isNil'](_0x1487da)&&_0x431f('0x2')===typeof _0x1487da){_0x139916+=_0x1487da;}if(!_[_0x431f('0x3')](_0x3765a2)&&_0x431f('0x2')===typeof _0x3765a2){_0x139916+='\x20'+_0x3765a2;}if(_0x139916!==''){return _0x139916;}return _0x2e526a;}function Action(_0x1ed889,_0x3898c9,_0x529bce){this[_0x431f('0x4')]=_0x1ed889;this[_0x431f('0x5')]=_0x529bce||undefined;this[_0x431f('0x6')]=checkNameSurname(_0x3898c9[_0x431f('0x7')]['phone'],_0x3898c9[_0x431f('0x7')][_0x431f('0x8')],_0x3898c9[_0x431f('0x7')][_0x431f('0x9')]);this['number']=_0x3898c9['phone'];this[_0x431f('0xa')]=_0x1ed889['name'];this[_0x431f('0xb')]=_0x3898c9[_0x431f('0xb')]||![];this['type']=_0x1ed889[_0x431f('0xc')];this[_0x431f('0xd')]=_0x1ed889[_0x431f('0xd')]||0x3;this['scheduledat']=_0x3898c9[_0x431f('0xe')];this[_0x431f('0xf')]=_0x3898c9['countbusyretry'];this[_0x431f('0x10')]=_0x3898c9['countcongestionretry'];this[_0x431f('0x11')]=_0x3898c9[_0x431f('0x11')];this[_0x431f('0x12')]=_0x3898c9[_0x431f('0x12')];this[_0x431f('0x13')]=_0x3898c9[_0x431f('0x13')];this[_0x431f('0x14')]=_0x3898c9[_0x431f('0x14')];this[_0x431f('0x15')]=_0x3898c9['countmachineretry'];this['countagentrejectretry']=_0x3898c9['countagentrejectretry'];this[_0x431f('0x16')]=_0x3898c9['ContactId'];this[_0x431f('0x17')]=_0x3898c9[_0x431f('0x17')];this['UserId']=_0x3898c9[_0x431f('0x18')];this[_0x431f('0x19')]=_0x3898c9['VoiceQueueId'];this[_0x431f('0x1a')]=_0x3898c9[_0x431f('0x1a')];this['idHopper']=_0x3898c9['id'];this[_0x431f('0x1b')]=_0x3898c9[_0x431f('0x7')]['firstName']||'';this[_0x431f('0x1c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x431f('0x1d')]=_0x3898c9[_0x431f('0x1d')];this[_0x431f('0x1e')]=_0x3898c9['callbackuniqueid'];this['callbackat']=_0x3898c9[_0x431f('0x1f')];this['recallme']=_0x3898c9['recallme'];this[_0x431f('0x20')]='';this[_0x431f('0x21')]='';}Action[_0x431f('0x22')][_0x431f('0x23')]=function(){return util[_0x431f('0x24')]('\x22%s\x22\x20<%s>',this[_0x431f('0x6')],this['voiceQueue']['dialCutDigit']>0x0?this[_0x431f('0x25')][_0x431f('0x26')](this[_0x431f('0x4')][_0x431f('0x27')]):this['number']);};Action['prototype'][_0x431f('0x28')]=function(){return this[_0x431f('0xa')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 557137c..591e991 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6138=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','endtime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x4bca67,_0x135bc1){var _0x5bca77=function(_0x346dc3){while(--_0x346dc3){_0x4bca67['push'](_0x4bca67['shift']());}};_0x5bca77(++_0x135bc1);}(_0x6138,0x113));var _0x8613=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6138[_0x465028];return _0xb783d4;};'use strict';var moment=require(_0x8613('0x0'));var utils=require(_0x8613('0x1'));function AgentComplete(_0x2484ae,_0x55e126){this[_0x8613('0x2')]=0x4;this['statedesc']=_0x8613('0x3');this['scheduledat']=_0x2484ae[_0x8613('0x4')];this[_0x8613('0x5')]=_0x2484ae['type'];this[_0x8613('0x6')]=_0x2484ae[_0x8613('0x5')]===_0x8613('0x7')?_0x8613('0x8'):_0x2484ae[_0x8613('0x5')];this['countbusyretry']=_0x2484ae[_0x8613('0x9')];this['countcongestionretry']=_0x2484ae[_0x8613('0xa')];this['countnoanswerretry']=_0x2484ae['countnoanswerretry'];this[_0x8613('0xb')]=_0x2484ae[_0x8613('0x9')]+_0x2484ae[_0x8613('0xa')]+_0x2484ae[_0x8613('0xc')]+_0x2484ae['countnosuchnumberretry']+_0x2484ae['countdropretry']+_0x2484ae[_0x8613('0xd')]+_0x2484ae[_0x8613('0xe')]+_0x2484ae[_0x8613('0xf')];this[_0x8613('0x10')]=_0x2484ae['countnosuchnumberretry'];this[_0x8613('0x11')]=_0x2484ae[_0x8613('0x11')];this[_0x8613('0xd')]=_0x2484ae[_0x8613('0xd')];this[_0x8613('0xe')]=_0x2484ae[_0x8613('0xe')];this[_0x8613('0xf')]=_0x2484ae[_0x8613('0xf')];this['uniqueid']=_0x55e126[_0x8613('0x12')];this[_0x8613('0x13')]=_0x2484ae[_0x8613('0x14')];this['calleridnum']=_0x2484ae[_0x8613('0x15')];this['starttime']=_0x2484ae[_0x8613('0x16')];this[_0x8613('0x17')]=_0x2484ae['responsetime'];this[_0x8613('0x18')]=_0x2484ae[_0x8613('0x18')];this['endtime']=moment()[_0x8613('0x19')](_0x8613('0x1a'));this[_0x8613('0x1b')]=utils[_0x8613('0x1c')](_0x2484ae['responsetime'],_0x2484ae[_0x8613('0x16')]);this[_0x8613('0x1d')]=utils[_0x8613('0x1c')](_0x2484ae['answertime'],_0x2484ae[_0x8613('0x17')]);this[_0x8613('0x1e')]=utils[_0x8613('0x1c')](this[_0x8613('0x1f')],_0x2484ae[_0x8613('0x18')]);this[_0x8613('0x8')]=_0x55e126[_0x8613('0x8')];this['membername']=_0x55e126['membername'];this[_0x8613('0x20')]=_0x55e126[_0x8613('0x20')];this[_0x8613('0x21')]=_0x2484ae[_0x8613('0x21')];this[_0x8613('0x22')]=_0x2484ae[_0x8613('0x22')];this[_0x8613('0x23')]=_0x2484ae[_0x8613('0x23')];this['recallme']=_0x2484ae[_0x8613('0x24')];this['ContactId']=_0x2484ae[_0x8613('0x25')];this[_0x8613('0x26')]=_0x2484ae[_0x8613('0x26')];this['UserId']=_0x2484ae[_0x8613('0x27')];this[_0x8613('0x28')]=_0x2484ae['VoiceQueueId'];this[_0x8613('0x29')]=_0x2484ae[_0x8613('0x29')];this['originatecalleridnum']=_0x2484ae[_0x8613('0x2a')]||'';this[_0x8613('0x2b')]=_0x2484ae[_0x8613('0x2b')]||'';this['agiafterat']=_0x2484ae[_0x8613('0x2c')];}module['exports']=AgentComplete; \ No newline at end of file +var _0x0d6e=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','statedesc'];(function(_0x3e055e,_0x37c730){var _0x3e792f=function(_0x1ac384){while(--_0x1ac384){_0x3e055e['push'](_0x3e055e['shift']());}};_0x3e792f(++_0x37c730);}(_0x0d6e,0x81));var _0xe0d6=function(_0x4ef4e7,_0x42e7e9){_0x4ef4e7=_0x4ef4e7-0x0;var _0x3a7c7c=_0x0d6e[_0x4ef4e7];return _0x3a7c7c;};'use strict';var moment=require(_0xe0d6('0x0'));var utils=require(_0xe0d6('0x1'));function AgentComplete(_0x312bd9,_0xb045dc){this['state']=0x4;this[_0xe0d6('0x2')]='Answer';this[_0xe0d6('0x3')]=_0x312bd9[_0xe0d6('0x3')];this[_0xe0d6('0x4')]=_0x312bd9[_0xe0d6('0x4')];this[_0xe0d6('0x5')]=_0x312bd9[_0xe0d6('0x4')]===_0xe0d6('0x6')?_0xe0d6('0x7'):_0x312bd9[_0xe0d6('0x4')];this['countbusyretry']=_0x312bd9[_0xe0d6('0x8')];this[_0xe0d6('0x9')]=_0x312bd9[_0xe0d6('0x9')];this[_0xe0d6('0xa')]=_0x312bd9[_0xe0d6('0xa')];this[_0xe0d6('0xb')]=_0x312bd9[_0xe0d6('0x8')]+_0x312bd9[_0xe0d6('0x9')]+_0x312bd9['countnoanswerretry']+_0x312bd9[_0xe0d6('0xc')]+_0x312bd9[_0xe0d6('0xd')]+_0x312bd9[_0xe0d6('0xe')]+_0x312bd9[_0xe0d6('0xf')]+_0x312bd9[_0xe0d6('0x10')];this['countnosuchnumberretry']=_0x312bd9[_0xe0d6('0xc')];this[_0xe0d6('0xd')]=_0x312bd9[_0xe0d6('0xd')];this[_0xe0d6('0xe')]=_0x312bd9[_0xe0d6('0xe')];this[_0xe0d6('0xf')]=_0x312bd9[_0xe0d6('0xf')];this[_0xe0d6('0x10')]=_0x312bd9[_0xe0d6('0x10')];this[_0xe0d6('0x11')]=_0xb045dc[_0xe0d6('0x11')];this[_0xe0d6('0x12')]=_0x312bd9[_0xe0d6('0x13')];this['calleridnum']=_0x312bd9['number'];this[_0xe0d6('0x14')]=_0x312bd9[_0xe0d6('0x14')];this[_0xe0d6('0x15')]=_0x312bd9[_0xe0d6('0x15')];this[_0xe0d6('0x16')]=_0x312bd9['answertime'];this['endtime']=moment()[_0xe0d6('0x17')](_0xe0d6('0x18'));this[_0xe0d6('0x19')]=utils['getSeconds'](_0x312bd9[_0xe0d6('0x15')],_0x312bd9[_0xe0d6('0x14')]);this[_0xe0d6('0x1a')]=utils[_0xe0d6('0x1b')](_0x312bd9[_0xe0d6('0x16')],_0x312bd9['responsetime']);this[_0xe0d6('0x1c')]=utils['getSeconds'](this[_0xe0d6('0x1d')],_0x312bd9[_0xe0d6('0x16')]);this['queue']=_0xb045dc[_0xe0d6('0x7')];this['membername']=_0xb045dc[_0xe0d6('0x1e')];this[_0xe0d6('0x1f')]=_0xb045dc['reason'];this[_0xe0d6('0x20')]=_0x312bd9[_0xe0d6('0x20')];this[_0xe0d6('0x21')]=_0x312bd9[_0xe0d6('0x21')];this['callbackat']=_0x312bd9[_0xe0d6('0x22')];this['recallme']=_0x312bd9[_0xe0d6('0x23')];this[_0xe0d6('0x24')]=_0x312bd9[_0xe0d6('0x24')];this[_0xe0d6('0x25')]=_0x312bd9['ListId'];this[_0xe0d6('0x26')]=_0x312bd9[_0xe0d6('0x26')];this[_0xe0d6('0x27')]=_0x312bd9[_0xe0d6('0x27')];this[_0xe0d6('0x28')]=_0x312bd9[_0xe0d6('0x28')];this[_0xe0d6('0x29')]=_0x312bd9[_0xe0d6('0x29')]||'';this[_0xe0d6('0x2a')]=_0x312bd9[_0xe0d6('0x2a')]||'';this[_0xe0d6('0x2b')]=_0x312bd9[_0xe0d6('0x2b')];}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 7ce61d0..8970bac 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07dc=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x4a8390,_0xe3c59e){var _0x1539d2=function(_0xb0d461){while(--_0xb0d461){_0x4a8390['push'](_0x4a8390['shift']());}};_0x1539d2(++_0xe3c59e);}(_0x07dc,0xfb));var _0xc07d=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x07dc[_0x36eaaa];return _0x461349;};'use strict';function Final(_0x150d04){this[_0xc07d('0x0')]=_0x150d04['uniqueid'];this[_0xc07d('0x1')]=_0x150d04[_0xc07d('0x1')];this['type']=_0x150d04[_0xc07d('0x2')];this[_0xc07d('0x3')]=_0x150d04['type']===_0xc07d('0x4')?'queue':_0x150d04[_0xc07d('0x2')];this[_0xc07d('0x5')]=_0x150d04[_0xc07d('0x5')];this[_0xc07d('0x6')]=_0x150d04[_0xc07d('0x6')];this[_0xc07d('0x7')]=_0x150d04[_0xc07d('0x7')];this[_0xc07d('0x8')]=_0x150d04[_0xc07d('0x5')]+_0x150d04[_0xc07d('0x6')]+_0x150d04[_0xc07d('0x7')]+_0x150d04[_0xc07d('0x9')]+_0x150d04[_0xc07d('0xa')]+_0x150d04[_0xc07d('0xb')]+_0x150d04[_0xc07d('0xc')]+_0x150d04[_0xc07d('0xd')];this[_0xc07d('0x9')]=_0x150d04[_0xc07d('0x9')];this[_0xc07d('0xa')]=_0x150d04[_0xc07d('0xa')];this[_0xc07d('0xb')]=_0x150d04[_0xc07d('0xb')];this['countmachineretry']=_0x150d04[_0xc07d('0xc')];this['countagentrejectretry']=_0x150d04[_0xc07d('0xd')];this[_0xc07d('0xe')]=_0x150d04[_0xc07d('0xe')];this[_0xc07d('0xf')]=_0x150d04['calleridname'];this['calleridnum']=_0x150d04[_0xc07d('0x10')];this[_0xc07d('0x11')]=_0x150d04['starttime'];this[_0xc07d('0x12')]=_0x150d04[_0xc07d('0x12')];this[_0xc07d('0x13')]=_0x150d04[_0xc07d('0x12')];this[_0xc07d('0x14')]=_0x150d04[_0xc07d('0x14')]||0x0;this[_0xc07d('0x15')]=_0x150d04['holdtime']||0x0;this[_0xc07d('0x16')]=_0x150d04[_0xc07d('0x16')]||0x0;this[_0xc07d('0x17')]=_0x150d04[_0xc07d('0x17')];this[_0xc07d('0x18')]=_0x150d04['callbackuniqueid'];this[_0xc07d('0x19')]=_0x150d04[_0xc07d('0x19')];this['recallme']=_0x150d04[_0xc07d('0x1a')];this[_0xc07d('0x1b')]=_0x150d04[_0xc07d('0x1b')];this[_0xc07d('0x1c')]=_0x150d04[_0xc07d('0x1c')];this[_0xc07d('0x1d')]=_0x150d04[_0xc07d('0x1d')];this['VoiceQueueId']=_0x150d04[_0xc07d('0x1e')];this['CampaignId']=_0x150d04[_0xc07d('0x1f')];this['originatecalleridnum']=_0x150d04[_0xc07d('0x20')]||'';this[_0xc07d('0x21')]=_0x150d04[_0xc07d('0x21')]||'';this[_0xc07d('0x22')]=_0x150d04[_0xc07d('0x22')];this[_0xc07d('0x23')]=_0x150d04[_0xc07d('0x23')];}module[_0xc07d('0x24')]=Final; \ No newline at end of file +var _0x7eeb=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum'];(function(_0x3104f6,_0x45d998){var _0x5bcc96=function(_0x504c0d){while(--_0x504c0d){_0x3104f6['push'](_0x3104f6['shift']());}};_0x5bcc96(++_0x45d998);}(_0x7eeb,0x78));var _0xb7ee=function(_0x5497d3,_0x193adf){_0x5497d3=_0x5497d3-0x0;var _0x42f1ef=_0x7eeb[_0x5497d3];return _0x42f1ef;};'use strict';function Final(_0x4b56e1){this[_0xb7ee('0x0')]=_0x4b56e1['uniqueid'];this[_0xb7ee('0x1')]=_0x4b56e1[_0xb7ee('0x1')];this[_0xb7ee('0x2')]=_0x4b56e1[_0xb7ee('0x2')];this[_0xb7ee('0x3')]=_0x4b56e1[_0xb7ee('0x2')]===_0xb7ee('0x4')?_0xb7ee('0x5'):_0x4b56e1[_0xb7ee('0x2')];this[_0xb7ee('0x6')]=_0x4b56e1[_0xb7ee('0x6')];this[_0xb7ee('0x7')]=_0x4b56e1[_0xb7ee('0x7')];this[_0xb7ee('0x8')]=_0x4b56e1[_0xb7ee('0x8')];this['countglobal']=_0x4b56e1[_0xb7ee('0x6')]+_0x4b56e1['countcongestionretry']+_0x4b56e1[_0xb7ee('0x8')]+_0x4b56e1[_0xb7ee('0x9')]+_0x4b56e1[_0xb7ee('0xa')]+_0x4b56e1['countabandonedretry']+_0x4b56e1['countmachineretry']+_0x4b56e1['countagentrejectretry'];this[_0xb7ee('0x9')]=_0x4b56e1['countnosuchnumberretry'];this[_0xb7ee('0xa')]=_0x4b56e1[_0xb7ee('0xa')];this['countabandonedretry']=_0x4b56e1[_0xb7ee('0xb')];this[_0xb7ee('0xc')]=_0x4b56e1[_0xb7ee('0xc')];this[_0xb7ee('0xd')]=_0x4b56e1['countagentrejectretry'];this['queue']=_0x4b56e1[_0xb7ee('0x5')];this['calleridname']=_0x4b56e1[_0xb7ee('0xe')];this[_0xb7ee('0xf')]=_0x4b56e1[_0xb7ee('0xf')];this['starttime']=_0x4b56e1[_0xb7ee('0x10')];this[_0xb7ee('0x11')]=_0x4b56e1[_0xb7ee('0x11')];this[_0xb7ee('0x12')]=_0x4b56e1[_0xb7ee('0x11')];this[_0xb7ee('0x13')]=_0x4b56e1[_0xb7ee('0x13')]||0x0;this[_0xb7ee('0x14')]=_0x4b56e1[_0xb7ee('0x14')]||0x0;this[_0xb7ee('0x15')]=_0x4b56e1[_0xb7ee('0x15')]||0x0;this[_0xb7ee('0x16')]=_0x4b56e1[_0xb7ee('0x16')];this[_0xb7ee('0x17')]=_0x4b56e1[_0xb7ee('0x17')];this['callbackat']=_0x4b56e1[_0xb7ee('0x18')];this[_0xb7ee('0x19')]=_0x4b56e1['recallme'];this[_0xb7ee('0x1a')]=_0x4b56e1[_0xb7ee('0x1a')];this[_0xb7ee('0x1b')]=_0x4b56e1[_0xb7ee('0x1b')];this[_0xb7ee('0x1c')]=_0x4b56e1['UserId'];this[_0xb7ee('0x1d')]=_0x4b56e1[_0xb7ee('0x1d')];this['CampaignId']=_0x4b56e1['CampaignId'];this[_0xb7ee('0x1e')]=_0x4b56e1['originatecalleridnum']||'';this[_0xb7ee('0x1f')]=_0x4b56e1[_0xb7ee('0x1f')]||'';this['state']=_0x4b56e1['state'];this[_0xb7ee('0x20')]=_0x4b56e1[_0xb7ee('0x20')];}module[_0xb7ee('0x21')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index b197d0c..9560628 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd544=['VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','ringtime','getSeconds','holdtime','queue','IVR','reason','cause-txt','callback','callbackat','recallme','ListId','UserId'];(function(_0x4ceeac,_0x47286a){var _0x26307b=function(_0x212f91){while(--_0x212f91){_0x4ceeac['push'](_0x4ceeac['shift']());}};_0x26307b(++_0x47286a);}(_0xd544,0x19d));var _0x4d54=function(_0x1eb7ae,_0x1ce33c){_0x1eb7ae=_0x1eb7ae-0x0;var _0x4f54c9=_0xd544[_0x1eb7ae];return _0x4f54c9;};'use strict';var moment=require(_0x4d54('0x0'));var utils=require(_0x4d54('0x1'));function Hangup(_0x2a5ab7,_0x3b8baf){this[_0x4d54('0x2')]=0x4;this[_0x4d54('0x3')]=_0x4d54('0x4');this[_0x4d54('0x5')]=_0x2a5ab7[_0x4d54('0x5')];this[_0x4d54('0x6')]=_0x2a5ab7['type'];this[_0x4d54('0x7')]=_0x2a5ab7[_0x4d54('0x6')]===_0x4d54('0x8')?'queue':_0x2a5ab7[_0x4d54('0x6')];this[_0x4d54('0x9')]=_0x2a5ab7[_0x4d54('0x9')]||![];this[_0x4d54('0xa')]=_0x2a5ab7[_0x4d54('0xa')];this[_0x4d54('0xb')]=_0x2a5ab7[_0x4d54('0xb')];this[_0x4d54('0xc')]=_0x2a5ab7[_0x4d54('0xc')];this['countglobal']=_0x2a5ab7[_0x4d54('0xa')]+_0x2a5ab7[_0x4d54('0xb')]+_0x2a5ab7[_0x4d54('0xc')]+_0x2a5ab7[_0x4d54('0xd')]+_0x2a5ab7[_0x4d54('0xe')]+_0x2a5ab7['countabandonedretry']+_0x2a5ab7[_0x4d54('0xf')]+_0x2a5ab7[_0x4d54('0x10')];this['countnosuchnumberretry']=_0x2a5ab7[_0x4d54('0xd')];this[_0x4d54('0xe')]=_0x2a5ab7['countdropretry'];this['countabandonedretry']=_0x2a5ab7[_0x4d54('0x11')];this['countmachineretry']=_0x2a5ab7[_0x4d54('0xf')];this[_0x4d54('0x10')]=_0x2a5ab7[_0x4d54('0x10')];this['uniqueid']=_0x3b8baf[_0x4d54('0x12')];this[_0x4d54('0x13')]=_0x2a5ab7[_0x4d54('0x14')];this['calleridnum']=_0x2a5ab7[_0x4d54('0x15')];this[_0x4d54('0x16')]=_0x2a5ab7[_0x4d54('0x16')];this['responsetime']=_0x2a5ab7[_0x4d54('0x17')];this[_0x4d54('0x18')]=moment()[_0x4d54('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4d54('0x1a')]=utils[_0x4d54('0x1b')](_0x2a5ab7[_0x4d54('0x17')],_0x2a5ab7['starttime']);this[_0x4d54('0x1c')]=0x0;this['talktime']=utils['getSeconds'](this[_0x4d54('0x18')],_0x2a5ab7[_0x4d54('0x17')]);this[_0x4d54('0x1d')]=_0x2a5ab7['queue'];this['membername']=_0x4d54('0x1e');this[_0x4d54('0x1f')]=_0x3b8baf[_0x4d54('0x20')];this[_0x4d54('0x21')]=_0x2a5ab7['callback'];this['callbackuniqueid']=_0x2a5ab7['callbackuniqueid'];this[_0x4d54('0x22')]=_0x2a5ab7[_0x4d54('0x22')];this[_0x4d54('0x23')]=_0x2a5ab7[_0x4d54('0x23')];this['ContactId']=_0x2a5ab7['ContactId'];this[_0x4d54('0x24')]=_0x2a5ab7[_0x4d54('0x24')];this[_0x4d54('0x25')]=_0x2a5ab7[_0x4d54('0x25')];this[_0x4d54('0x26')]=_0x2a5ab7['VoiceQueueId'];this[_0x4d54('0x27')]=_0x2a5ab7[_0x4d54('0x27')];}module[_0x4d54('0x28')]=Hangup; \ No newline at end of file +var _0x997d=['reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','membername','IVR'];(function(_0x22f649,_0x190bbc){var _0x2fc66c=function(_0x109314){while(--_0x109314){_0x22f649['push'](_0x22f649['shift']());}};_0x2fc66c(++_0x190bbc);}(_0x997d,0x18d));var _0xd997=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x997d[_0x47a349];return _0x18ab75;};'use strict';var moment=require(_0xd997('0x0'));var utils=require(_0xd997('0x1'));function Hangup(_0xb4a538,_0x1684f1){this[_0xd997('0x2')]=0x4;this[_0xd997('0x3')]=_0xd997('0x4');this[_0xd997('0x5')]=_0xb4a538['scheduledat'];this[_0xd997('0x6')]=_0xb4a538[_0xd997('0x6')];this[_0xd997('0x7')]=_0xb4a538[_0xd997('0x6')]===_0xd997('0x8')?_0xd997('0x9'):_0xb4a538['type'];this[_0xd997('0xa')]=_0xb4a538[_0xd997('0xa')]||![];this[_0xd997('0xb')]=_0xb4a538[_0xd997('0xb')];this[_0xd997('0xc')]=_0xb4a538[_0xd997('0xc')];this[_0xd997('0xd')]=_0xb4a538[_0xd997('0xd')];this[_0xd997('0xe')]=_0xb4a538[_0xd997('0xb')]+_0xb4a538[_0xd997('0xc')]+_0xb4a538[_0xd997('0xd')]+_0xb4a538['countnosuchnumberretry']+_0xb4a538['countdropretry']+_0xb4a538[_0xd997('0xf')]+_0xb4a538[_0xd997('0x10')]+_0xb4a538[_0xd997('0x11')];this[_0xd997('0x12')]=_0xb4a538['countnosuchnumberretry'];this[_0xd997('0x13')]=_0xb4a538[_0xd997('0x13')];this['countabandonedretry']=_0xb4a538[_0xd997('0xf')];this[_0xd997('0x10')]=_0xb4a538[_0xd997('0x10')];this[_0xd997('0x11')]=_0xb4a538[_0xd997('0x11')];this[_0xd997('0x14')]=_0x1684f1[_0xd997('0x14')];this[_0xd997('0x15')]=_0xb4a538[_0xd997('0x16')];this[_0xd997('0x17')]=_0xb4a538[_0xd997('0x18')];this[_0xd997('0x19')]=_0xb4a538[_0xd997('0x19')];this['responsetime']=_0xb4a538[_0xd997('0x1a')];this['endtime']=moment()[_0xd997('0x1b')](_0xd997('0x1c'));this[_0xd997('0x1d')]=utils[_0xd997('0x1e')](_0xb4a538['responsetime'],_0xb4a538[_0xd997('0x19')]);this['holdtime']=0x0;this['talktime']=utils[_0xd997('0x1e')](this['endtime'],_0xb4a538['responsetime']);this[_0xd997('0x9')]=_0xb4a538['queue'];this[_0xd997('0x1f')]=_0xd997('0x20');this[_0xd997('0x21')]=_0x1684f1[_0xd997('0x22')];this[_0xd997('0x23')]=_0xb4a538['callback'];this['callbackuniqueid']=_0xb4a538[_0xd997('0x24')];this[_0xd997('0x25')]=_0xb4a538[_0xd997('0x25')];this[_0xd997('0x26')]=_0xb4a538[_0xd997('0x26')];this[_0xd997('0x27')]=_0xb4a538['ContactId'];this[_0xd997('0x28')]=_0xb4a538[_0xd997('0x28')];this['UserId']=_0xb4a538['UserId'];this['VoiceQueueId']=_0xb4a538['VoiceQueueId'];this['CampaignId']=_0xb4a538[_0xd997('0x29')];}module[_0xd997('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index b19404a..7b3c798 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9fd=['queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound'];(function(_0x49e80d,_0x523385){var _0x391939=function(_0x589a94){while(--_0x589a94){_0x49e80d['push'](_0x49e80d['shift']());}};_0x391939(++_0x523385);}(_0xb9fd,0x104));var _0xdb9f=function(_0x58a4ac,_0x43fd42){_0x58a4ac=_0x58a4ac-0x0;var _0x545810=_0xb9fd[_0x58a4ac];return _0x545810;};'use strict';var utils=require(_0xdb9f('0x0'));function History(_0x29974b){this['uniqueid']=_0x29974b[_0xdb9f('0x1')];this[_0xdb9f('0x2')]=_0x29974b[_0xdb9f('0x2')]||undefined;this[_0xdb9f('0x3')]=_0x29974b[_0xdb9f('0x3')];this[_0xdb9f('0x4')]=_0x29974b[_0xdb9f('0x3')]===_0xdb9f('0x5')?_0xdb9f('0x6'):_0x29974b[_0xdb9f('0x3')];this['countbusyretry']=_0x29974b['countbusyretry'];this[_0xdb9f('0x7')]=_0x29974b[_0xdb9f('0x7')];this[_0xdb9f('0x8')]=_0x29974b['countnoanswerretry'];this[_0xdb9f('0x9')]=_0x29974b[_0xdb9f('0xa')]+_0x29974b[_0xdb9f('0x7')]+_0x29974b[_0xdb9f('0x8')]+_0x29974b[_0xdb9f('0xb')]+_0x29974b['countdropretry']+_0x29974b['countabandonedretry']+_0x29974b[_0xdb9f('0xc')]+_0x29974b[_0xdb9f('0xd')];this[_0xdb9f('0xb')]=_0x29974b[_0xdb9f('0xb')];this[_0xdb9f('0xe')]=_0x29974b['countdropretry'];this[_0xdb9f('0xf')]=_0x29974b['countabandonedretry'];this[_0xdb9f('0xc')]=_0x29974b[_0xdb9f('0xc')];this['countagentrejectretry']=_0x29974b['countagentrejectretry'];this[_0xdb9f('0x6')]=_0x29974b[_0xdb9f('0x6')];this[_0xdb9f('0x10')]=_0x29974b[_0xdb9f('0x11')];this[_0xdb9f('0x12')]=_0x29974b['number'];this[_0xdb9f('0x13')]=_0x29974b['starttime'];this['responsetime']=_0x29974b[_0xdb9f('0x14')];this[_0xdb9f('0x15')]=_0x29974b[_0xdb9f('0x14')];this[_0xdb9f('0x16')]=utils['getSeconds'](_0x29974b[_0xdb9f('0x14')],_0x29974b[_0xdb9f('0x13')]);this[_0xdb9f('0x17')]=0x0;this[_0xdb9f('0x18')]=0x0;this[_0xdb9f('0x19')]=_0x29974b[_0xdb9f('0x19')];this['callbackuniqueid']=_0x29974b[_0xdb9f('0x1a')];this['callbackat']=_0x29974b[_0xdb9f('0x1b')];this[_0xdb9f('0x1c')]=_0x29974b[_0xdb9f('0x1c')];this[_0xdb9f('0x1d')]=_0x29974b[_0xdb9f('0x1d')];this[_0xdb9f('0x1e')]=_0x29974b['ListId'];this['UserId']=_0x29974b['UserId'];this[_0xdb9f('0x1f')]=_0x29974b['VoiceQueueId'];this['CampaignId']=_0x29974b[_0xdb9f('0x20')];this[_0xdb9f('0x21')]=_0x29974b[_0xdb9f('0x21')]||'';this[_0xdb9f('0x22')]=_0x29974b[_0xdb9f('0x22')]||'';this[_0xdb9f('0x23')]=_0x29974b[_0xdb9f('0x23')];this[_0xdb9f('0x24')]=_0x29974b[_0xdb9f('0x24')];}module[_0xdb9f('0x25')]=History; \ No newline at end of file +var _0x2b29=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x2b29,0x135));var _0x92b2=function(_0x2bca44,_0x411dc6){_0x2bca44=_0x2bca44-0x0;var _0x13d554=_0x2b29[_0x2bca44];return _0x13d554;};'use strict';var utils=require(_0x92b2('0x0'));function History(_0x47b0ed){this[_0x92b2('0x1')]=_0x47b0ed[_0x92b2('0x1')];this['scheduledat']=_0x47b0ed[_0x92b2('0x2')]||undefined;this[_0x92b2('0x3')]=_0x47b0ed[_0x92b2('0x3')];this[_0x92b2('0x4')]=_0x47b0ed['type']===_0x92b2('0x5')?_0x92b2('0x6'):_0x47b0ed['type'];this[_0x92b2('0x7')]=_0x47b0ed['countbusyretry'];this['countcongestionretry']=_0x47b0ed[_0x92b2('0x8')];this[_0x92b2('0x9')]=_0x47b0ed[_0x92b2('0x9')];this[_0x92b2('0xa')]=_0x47b0ed[_0x92b2('0x7')]+_0x47b0ed[_0x92b2('0x8')]+_0x47b0ed[_0x92b2('0x9')]+_0x47b0ed['countnosuchnumberretry']+_0x47b0ed[_0x92b2('0xb')]+_0x47b0ed[_0x92b2('0xc')]+_0x47b0ed['countmachineretry']+_0x47b0ed[_0x92b2('0xd')];this[_0x92b2('0xe')]=_0x47b0ed[_0x92b2('0xe')];this['countdropretry']=_0x47b0ed[_0x92b2('0xb')];this[_0x92b2('0xc')]=_0x47b0ed[_0x92b2('0xc')];this[_0x92b2('0xf')]=_0x47b0ed[_0x92b2('0xf')];this[_0x92b2('0xd')]=_0x47b0ed[_0x92b2('0xd')];this['queue']=_0x47b0ed['queue'];this['calleridname']=_0x47b0ed['name'];this[_0x92b2('0x10')]=_0x47b0ed[_0x92b2('0x11')];this[_0x92b2('0x12')]=_0x47b0ed[_0x92b2('0x12')];this[_0x92b2('0x13')]=_0x47b0ed[_0x92b2('0x13')];this[_0x92b2('0x14')]=_0x47b0ed['responsetime'];this['ringtime']=utils['getSeconds'](_0x47b0ed[_0x92b2('0x13')],_0x47b0ed[_0x92b2('0x12')]);this[_0x92b2('0x15')]=0x0;this[_0x92b2('0x16')]=0x0;this[_0x92b2('0x17')]=_0x47b0ed['callback'];this[_0x92b2('0x18')]=_0x47b0ed[_0x92b2('0x18')];this[_0x92b2('0x19')]=_0x47b0ed[_0x92b2('0x19')];this[_0x92b2('0x1a')]=_0x47b0ed['recallme'];this[_0x92b2('0x1b')]=_0x47b0ed[_0x92b2('0x1b')];this[_0x92b2('0x1c')]=_0x47b0ed[_0x92b2('0x1c')];this[_0x92b2('0x1d')]=_0x47b0ed[_0x92b2('0x1d')];this[_0x92b2('0x1e')]=_0x47b0ed[_0x92b2('0x1e')];this[_0x92b2('0x1f')]=_0x47b0ed[_0x92b2('0x1f')];this[_0x92b2('0x20')]=_0x47b0ed[_0x92b2('0x20')]||'';this[_0x92b2('0x21')]=_0x47b0ed['originatecalleridname']||'';this[_0x92b2('0x22')]=_0x47b0ed[_0x92b2('0x22')];this[_0x92b2('0x23')]=_0x47b0ed[_0x92b2('0x23')];}module[_0x92b2('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index de37554..24830ef 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x62cd=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','getSeconds','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x599aaf,_0x3d3622){var _0xd995f3=function(_0x19825e){while(--_0x19825e){_0x599aaf['push'](_0x599aaf['shift']());}};_0xd995f3(++_0x3d3622);}(_0x62cd,0x1b6));var _0xd62c=function(_0xf4917f,_0x228b54){_0xf4917f=_0xf4917f-0x0;var _0x4d8083=_0x62cd[_0xf4917f];return _0x4d8083;};'use strict';var utils=require(_0xd62c('0x0'));function QueueCallerAbandon(_0x27f122,_0x13efe0){this['scheduledat']=_0x27f122[_0xd62c('0x1')];this[_0xd62c('0x2')]=_0x27f122[_0xd62c('0x2')];this[_0xd62c('0x3')]=_0x27f122['type']==='outbound'?_0xd62c('0x4'):_0x27f122['type'];this[_0xd62c('0x5')]=_0x27f122[_0xd62c('0x5')];this['countcongestionretry']=_0x27f122[_0xd62c('0x6')];this[_0xd62c('0x7')]=_0x27f122[_0xd62c('0x7')];this[_0xd62c('0x8')]=_0x27f122[_0xd62c('0x5')]+_0x27f122[_0xd62c('0x6')]+_0x27f122[_0xd62c('0x7')]+_0x27f122['countnosuchnumberretry']+_0x27f122['countdropretry']+_0x27f122[_0xd62c('0x9')]+_0x27f122['countmachineretry']+_0x27f122[_0xd62c('0xa')];this[_0xd62c('0xb')]=_0x27f122[_0xd62c('0xb')];this['countdropretry']=_0x27f122[_0xd62c('0xc')];this[_0xd62c('0x9')]=_0x27f122['countabandonedretry'];this['countmachineretry']=_0x27f122[_0xd62c('0xd')];this[_0xd62c('0xa')]=_0x27f122[_0xd62c('0xa')];this[_0xd62c('0xe')]=_0x13efe0[_0xd62c('0xe')];this['calleridname']=_0x27f122[_0xd62c('0xf')];this[_0xd62c('0x10')]=_0x27f122[_0xd62c('0x11')];this[_0xd62c('0x12')]=_0x27f122[_0xd62c('0x12')];this['responsetime']=_0x27f122[_0xd62c('0x13')];this['droptime']=_0x27f122[_0xd62c('0x14')];this[_0xd62c('0x15')]=_0x27f122[_0xd62c('0x15')];this[_0xd62c('0x16')]=this[_0xd62c('0x14')];this[_0xd62c('0x17')]=utils['getSeconds'](_0x27f122[_0xd62c('0x13')],_0x27f122[_0xd62c('0x12')]);this[_0xd62c('0x18')]=utils[_0xd62c('0x19')](this[_0xd62c('0x14')],_0x27f122[_0xd62c('0x13')]);this[_0xd62c('0x1a')]=0x0;this[_0xd62c('0x4')]=_0x13efe0[_0xd62c('0x4')];this['membername']=_0x13efe0[_0xd62c('0x1b')];this['reason']=_0x13efe0[_0xd62c('0x1c')];this[_0xd62c('0x1d')]=_0x27f122[_0xd62c('0x1d')];this[_0xd62c('0x1e')]=_0x27f122['callbackuniqueid'];this['callbackat']=_0x27f122[_0xd62c('0x1f')];this['recallme']=_0x27f122[_0xd62c('0x20')];this[_0xd62c('0x21')]=_0x27f122[_0xd62c('0x21')];this['ListId']=_0x27f122[_0xd62c('0x22')];this[_0xd62c('0x23')]=_0x27f122[_0xd62c('0x23')];this[_0xd62c('0x24')]=_0x27f122['VoiceQueueId'];this[_0xd62c('0x25')]=_0x27f122['CampaignId'];this[_0xd62c('0x26')]=_0x27f122['originatecalleridnum']||'';this[_0xd62c('0x27')]=_0x27f122['originatecalleridname']||'';this[_0xd62c('0x28')]=_0x27f122['agiafterat'];this[_0xd62c('0x29')]=_0x27f122['state'];this[_0xd62c('0x2a')]=_0x27f122[_0xd62c('0x2a')];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x9cdb=['talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','getSeconds'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9cdb,0x94));var _0xb9cd=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0x9cdb[_0x2f57b2];return _0x5ace77;};'use strict';var utils=require(_0xb9cd('0x0'));function QueueCallerAbandon(_0x32830b,_0x21d456){this[_0xb9cd('0x1')]=_0x32830b[_0xb9cd('0x1')];this[_0xb9cd('0x2')]=_0x32830b[_0xb9cd('0x2')];this['campaigntype']=_0x32830b[_0xb9cd('0x2')]===_0xb9cd('0x3')?_0xb9cd('0x4'):_0x32830b[_0xb9cd('0x2')];this[_0xb9cd('0x5')]=_0x32830b[_0xb9cd('0x5')];this[_0xb9cd('0x6')]=_0x32830b[_0xb9cd('0x6')];this[_0xb9cd('0x7')]=_0x32830b[_0xb9cd('0x7')];this[_0xb9cd('0x8')]=_0x32830b[_0xb9cd('0x5')]+_0x32830b[_0xb9cd('0x6')]+_0x32830b[_0xb9cd('0x7')]+_0x32830b[_0xb9cd('0x9')]+_0x32830b[_0xb9cd('0xa')]+_0x32830b[_0xb9cd('0xb')]+_0x32830b['countmachineretry']+_0x32830b[_0xb9cd('0xc')];this[_0xb9cd('0x9')]=_0x32830b[_0xb9cd('0x9')];this[_0xb9cd('0xa')]=_0x32830b[_0xb9cd('0xa')];this[_0xb9cd('0xb')]=_0x32830b[_0xb9cd('0xb')];this[_0xb9cd('0xd')]=_0x32830b[_0xb9cd('0xd')];this[_0xb9cd('0xc')]=_0x32830b[_0xb9cd('0xc')];this['uniqueid']=_0x21d456['uniqueid'];this[_0xb9cd('0xe')]=_0x32830b[_0xb9cd('0xf')];this[_0xb9cd('0x10')]=_0x32830b[_0xb9cd('0x11')];this[_0xb9cd('0x12')]=_0x32830b[_0xb9cd('0x12')];this[_0xb9cd('0x13')]=_0x32830b[_0xb9cd('0x13')];this[_0xb9cd('0x14')]=_0x32830b[_0xb9cd('0x14')];this['dropreason']=_0x32830b['dropreason'];this[_0xb9cd('0x15')]=this[_0xb9cd('0x14')];this[_0xb9cd('0x16')]=utils[_0xb9cd('0x17')](_0x32830b[_0xb9cd('0x13')],_0x32830b[_0xb9cd('0x12')]);this['holdtime']=utils[_0xb9cd('0x17')](this[_0xb9cd('0x14')],_0x32830b[_0xb9cd('0x13')]);this[_0xb9cd('0x18')]=0x0;this[_0xb9cd('0x4')]=_0x21d456[_0xb9cd('0x4')];this[_0xb9cd('0x19')]=_0x21d456[_0xb9cd('0x1a')];this['reason']=_0x21d456[_0xb9cd('0x1b')];this['callback']=_0x32830b[_0xb9cd('0x1c')];this['callbackuniqueid']=_0x32830b[_0xb9cd('0x1d')];this['callbackat']=_0x32830b[_0xb9cd('0x1e')];this[_0xb9cd('0x1f')]=_0x32830b[_0xb9cd('0x1f')];this[_0xb9cd('0x20')]=_0x32830b[_0xb9cd('0x20')];this['ListId']=_0x32830b[_0xb9cd('0x21')];this[_0xb9cd('0x22')]=_0x32830b[_0xb9cd('0x22')];this[_0xb9cd('0x23')]=_0x32830b[_0xb9cd('0x23')];this[_0xb9cd('0x24')]=_0x32830b[_0xb9cd('0x24')];this[_0xb9cd('0x25')]=_0x32830b['originatecalleridnum']||'';this[_0xb9cd('0x26')]=_0x32830b[_0xb9cd('0x26')]||'';this['agiafterat']=_0x32830b[_0xb9cd('0x27')];this[_0xb9cd('0x28')]=_0x32830b[_0xb9cd('0x28')];this[_0xb9cd('0x29')]=_0x32830b['statedesc'];}module[_0xb9cd('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 09217e5..89e2f76 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','[checkIsBlackList]','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','inspect','getContactDialer','catch','error','[getContactDialer]','getContactDialerIvr','dialOrderByScheduledAt','temp','countReScheduled','[countReScheduled]'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x814b,0x1a2));var _0xb814=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0x814b[_0x121b1a];return _0x2d89a6;};'use strict';var util=require(_0xb814('0x0'));var logger=require(_0xb814('0x1'))(_0xb814('0x2'));var cmHopper=require(_0xb814('0x3'));var cmHopperAdditionalPhone=require(_0xb814('0x4'));var cmHopperBlack=require(_0xb814('0x5'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x38c21a){return util[_0xb814('0x6')](_0x38c21a,{'showHidden':![],'depth':null});}function getContactDialer(_0x258866,_0x4237bc,_0x44931c){return cmHopper[_0xb814('0x7')](_0x258866['id'],_0x4237bc,_0x44931c,_0x258866['dialOrderByScheduledAt'])[_0xb814('0x8')](function(_0x2e6272){_0x258866['temp']=0x0;logger[_0xb814('0x9')](_0xb814('0xa'),inspectError(_0x2e6272));});}exports[_0xb814('0x7')]=getContactDialer;function getContactDialerIvr(_0x41166c,_0x1fea33){return cmHopper[_0xb814('0xb')](_0x41166c['id'],_0x1fea33,_0x41166c[_0xb814('0xc')])[_0xb814('0x8')](function(_0x207dbc){_0x41166c[_0xb814('0xd')]=0x0;logger[_0xb814('0x9')]('[getContactDialerIvr]',inspectError(_0x207dbc));});}exports[_0xb814('0xb')]=getContactDialerIvr;function countReScheduled(_0x56278f){return cmHopper[_0xb814('0xe')](_0x56278f)[_0xb814('0x8')](function(_0x35b10d){logger[_0xb814('0x9')](_0xb814('0xf'),inspectError(_0x35b10d));});}exports[_0xb814('0xe')]=countReScheduled;function rescheduleContact(_0x1438e7){return cmHopper[_0xb814('0x10')](_0x1438e7)[_0xb814('0x8')](function(_0x2ab627){logger[_0xb814('0x9')](_0xb814('0x11'),inspectError(_0x2ab627));});}exports[_0xb814('0x10')]=rescheduleContact;function unlockContact(_0x39bfcf,_0x303aca,_0x3a71d6){return cmHopper[_0xb814('0x12')](_0x39bfcf,_0x303aca,_0x3a71d6)[_0xb814('0x8')](function(_0x125ce2){logger[_0xb814('0x9')](_0xb814('0x13'),inspectError(_0x125ce2));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x168a48){return cmHopper['moveContactManagedDialer'](_0x168a48)[_0xb814('0x8')](function(_0xfac75b){logger['error']('[moveContactManagedDialer]',inspectError(_0xfac75b));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x399b43){return cmHopperBlack['checkIsBlackList'](_0x399b43)['catch'](function(_0xb684ea){logger[_0xb814('0x9')](_0xb814('0x14'),inspectError(_0xb684ea));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0xf5b8aa){return cmHopperBlack['checkIsBlackListIvr'](_0xf5b8aa)[_0xb814('0x8')](function(_0x1808a3){logger[_0xb814('0x9')](_0xb814('0x15'),inspectError(_0x1808a3));});}exports[_0xb814('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2bd039,_0x1f5d40,_0x594470){return cmHopperAdditionalPhone[_0xb814('0x17')](_0x2bd039,_0x1f5d40,_0x594470)['catch'](function(_0x3f81d0){logger[_0xb814('0x9')](_0xb814('0x18'),inspectError(_0x3f81d0));});}exports[_0xb814('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1c8a2e,_0xb9e57d,_0x3d836c){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x1c8a2e,_0xb9e57d,_0x3d836c)[_0xb814('0x8')](function(_0xc0ef66){logger[_0xb814('0x9')](_0xb814('0x19'),inspectError(_0xc0ef66));});}exports[_0xb814('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x1d5965){return cmHopperHistory[_0xb814('0x1b')](_0x1d5965)[_0xb814('0x8')](function(_0x5a6291){logger[_0xb814('0x9')](_0xb814('0x1c'),inspectError(_0x5a6291));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x9008b2){return cmHopperHistory[_0xb814('0x1d')](_0x9008b2)[_0xb814('0x8')](function(_0x499f22){logger[_0xb814('0x9')](_0xb814('0x1e'),inspectError(_0x499f22));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0x4888=['[avgHandleTime]','createHistory','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','getContactDialerIvr','error','[getContactDialerIvr]','countReScheduled','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime'];(function(_0xcfa72c,_0x6dc88c){var _0xce192b=function(_0x4a7843){while(--_0x4a7843){_0xcfa72c['push'](_0xcfa72c['shift']());}};_0xce192b(++_0x6dc88c);}(_0x4888,0x198));var _0x8488=function(_0x5ee89d,_0x1a7c29){_0x5ee89d=_0x5ee89d-0x0;var _0x3fa4cc=_0x4888[_0x5ee89d];return _0x3fa4cc;};'use strict';var util=require('util');var logger=require(_0x8488('0x0'))(_0x8488('0x1'));var cmHopper=require(_0x8488('0x2'));var cmHopperAdditionalPhone=require(_0x8488('0x3'));var cmHopperBlack=require(_0x8488('0x4'));var cmHopperHistory=require(_0x8488('0x5'));function inspectError(_0x19e51d){return util['inspect'](_0x19e51d,{'showHidden':![],'depth':null});}function getContactDialer(_0x267093,_0xf45c3f,_0x1a97f4){return cmHopper[_0x8488('0x6')](_0x267093['id'],_0xf45c3f,_0x1a97f4,_0x267093[_0x8488('0x7')])[_0x8488('0x8')](function(_0x5250a1){_0x267093['temp']=0x0;logger['error']('[getContactDialer]',inspectError(_0x5250a1));});}exports[_0x8488('0x6')]=getContactDialer;function getContactDialerIvr(_0x1bae81,_0x542bd8){return cmHopper[_0x8488('0x9')](_0x1bae81['id'],_0x542bd8,_0x1bae81[_0x8488('0x7')])[_0x8488('0x8')](function(_0x19a2ee){_0x1bae81['temp']=0x0;logger[_0x8488('0xa')](_0x8488('0xb'),inspectError(_0x19a2ee));});}exports[_0x8488('0x9')]=getContactDialerIvr;function countReScheduled(_0x256bab){return cmHopper[_0x8488('0xc')](_0x256bab)['catch'](function(_0x14462e){logger[_0x8488('0xa')]('[countReScheduled]',inspectError(_0x14462e));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x150b52){return cmHopper['rescheduleContact'](_0x150b52)[_0x8488('0x8')](function(_0x4e94fc){logger['error'](_0x8488('0xd'),inspectError(_0x4e94fc));});}exports[_0x8488('0xe')]=rescheduleContact;function unlockContact(_0x5700b,_0x2bcb7c,_0x3b3cfa){return cmHopper[_0x8488('0xf')](_0x5700b,_0x2bcb7c,_0x3b3cfa)[_0x8488('0x8')](function(_0x4e44af){logger[_0x8488('0xa')](_0x8488('0x10'),inspectError(_0x4e44af));});}exports[_0x8488('0xf')]=unlockContact;function moveContactManagedDialer(_0x37361d){return cmHopper[_0x8488('0x11')](_0x37361d)[_0x8488('0x8')](function(_0x1aedb1){logger[_0x8488('0xa')](_0x8488('0x12'),inspectError(_0x1aedb1));});}exports[_0x8488('0x11')]=moveContactManagedDialer;function checkIsBlackList(_0x10bfd6){return cmHopperBlack[_0x8488('0x13')](_0x10bfd6)[_0x8488('0x8')](function(_0x554ec6){logger['error'](_0x8488('0x14'),inspectError(_0x554ec6));});}exports[_0x8488('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0xbb10fe){return cmHopperBlack[_0x8488('0x15')](_0xbb10fe)[_0x8488('0x8')](function(_0x1bef99){logger[_0x8488('0xa')](_0x8488('0x16'),inspectError(_0x1bef99));});}exports[_0x8488('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5123d0,_0x476a14,_0x4e07e1){return cmHopperAdditionalPhone[_0x8488('0x17')](_0x5123d0,_0x476a14,_0x4e07e1)[_0x8488('0x8')](function(_0x290b33){logger['error']('[verifyAdditionalPhone]',inspectError(_0x290b33));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x59b5e2,_0x472624,_0x51fe30){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x59b5e2,_0x472624,_0x51fe30)[_0x8488('0x8')](function(_0x2f350a){logger[_0x8488('0xa')](_0x8488('0x18'),inspectError(_0x2f350a));});}exports[_0x8488('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x503b83){return cmHopperHistory[_0x8488('0x1a')](_0x503b83)[_0x8488('0x8')](function(_0xf9720e){logger[_0x8488('0xa')](_0x8488('0x1b'),inspectError(_0xf9720e));});}exports[_0x8488('0x1a')]=avgHandleTime;function createHistory(_0x2c15ff){return cmHopperHistory[_0x8488('0x1c')](_0x2c15ff)[_0x8488('0x8')](function(_0x1d9317){logger[_0x8488('0xa')]('[createHistory]',inspectError(_0x1d9317));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 61586f2..8e185dd 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x782b=['Interval','Intervals','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','status','TrunkBackup','INACTIVE','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','error','decrementOriginate','length','erlangb','[checkContactLowerLimitOriginate]\x20','createdAt','updatedAt','undefined','includes','description','toUpperCase','toString','XMD-','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval'];(function(_0x1a7658,_0x14e2ca){var _0x3e6f38=function(_0x9bd29){while(--_0x9bd29){_0x1a7658['push'](_0x1a7658['shift']());}};_0x3e6f38(++_0x14e2ca);}(_0x782b,0x137));var _0xb782=function(_0x3c2242,_0x135684){_0x3c2242=_0x3c2242-0x0;var _0x15a7c6=_0x782b[_0x3c2242];return _0x15a7c6;};'use strict';var _=require(_0xb782('0x0'));var moment=require(_0xb782('0x1'));var util=require(_0xb782('0x2'));var logger=require(_0xb782('0x3'))(_0xb782('0x4'));var timezones=require(_0xb782('0x5'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xb782('0x6'),'BLACKLIST':_0xb782('0x7'),'CONTACTS_RESCHEDULED':_0xb782('0x8'),'DEACTIVATED':_0xb782('0x9'),'DISACTIVED':_0xb782('0xa'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xb782('0xb'),'NO_AGENTS_LOGGED':_0xb782('0xc'),'NO_AVAILABLE_CONTACTS':_0xb782('0xd'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xb782('0xe'),'OVERTIME_GLOBAL_INTERVAL':_0xb782('0xf'),'QUEUE_RECALL':_0xb782('0x10'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xb782('0x11'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xb782('0x12')};exports[_0xb782('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0xebbc07){return _0xebbc07['dialMethod']==='preview';}exports[_0xb782('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x45d259){return _0x45d259[_0xb782('0x15')]===_0xb782('0x16');}exports[_0xb782('0x17')]=isIVRCampaign;function isOutboundQueue(_0x10f13d){return _0x10f13d[_0xb782('0x15')]===_0xb782('0x18');}exports[_0xb782('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x27c04d){return _0x27c04d[_0xb782('0x1a')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x1a9c3b){return _0x1a9c3b[_0xb782('0x1b')];}exports[_0xb782('0x1c')]=isIVRCampaignActive;function getSeconds(_0x22b021,_0x40649d){var _0xd4b474=moment(_0x22b021)[_0xb782('0x1d')](0x0);var _0x90da12=moment(_0x40649d)[_0xb782('0x1d')](0x0);return _0xd4b474[_0xb782('0x1e')](_0x90da12,_0xb782('0x1f'));}exports[_0xb782('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x461285,_0x37fc8c){var _0x23db39=![];var _0x2fadb1=_0x461285[_0xb782('0x21')]!==_0x37fc8c[_0xb782('0x21')]||_0x461285[_0xb782('0x1a')]!==_0x37fc8c['dialActive']||_0x461285[_0xb782('0x22')]!==_0x37fc8c[_0xb782('0x22')];var _0x2a2221=_0x461285['available']!==_0x37fc8c[_0xb782('0x23')]||_0x461285[_0xb782('0x24')]!==_0x37fc8c[_0xb782('0x24')]||_0x461285['loggedInDb']!==_0x37fc8c[_0xb782('0x25')]||_0x461285['paused']!==_0x37fc8c[_0xb782('0x26')]||_0x461285[_0xb782('0x27')]!==_0x37fc8c[_0xb782('0x27')]||_0x461285['pTalking']!==_0x37fc8c[_0xb782('0x28')]||_0x461285[_0xb782('0x29')]!==_0x37fc8c['waiting']||_0x461285[_0xb782('0x2a')]!==_0x37fc8c[_0xb782('0x2a')]||_0x461285[_0xb782('0x2b')]!==_0x37fc8c[_0xb782('0x2b')];if(_0x461285[_0xb782('0x2c')]&&_0x37fc8c['Trunk']){_0x23db39=_0x461285[_0xb782('0x2c')][_0xb782('0x2d')]!==_0x37fc8c['Trunk'][_0xb782('0x2d')]||_0x461285['Trunk'][_0xb782('0x1b')]!==_0x37fc8c[_0xb782('0x2c')]['active'];}return _0x2fadb1||_0x2a2221||_0x23db39;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5080bc){var _0x2d0fba=null;var _0x424c0b=_0x5080bc[_0xb782('0x2e')];if(_[_0xb782('0x2f')](_0x5080bc[_0xb782('0x30')])||_[_0xb782('0x2f')](_0x5080bc['Interval'])||_[_0xb782('0x2f')](_0x5080bc[_0xb782('0x31')][_0xb782('0x32')])){_0x2d0fba=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xb782('0x33')](_0x5080bc[_0xb782('0x30')])||_[_0xb782('0x33')](_0x5080bc[_0xb782('0x31')][_0xb782('0x32')])){_0x2d0fba=CAMPAIGN_STATUS[_0xb782('0x34')];}else if(_0x424c0b&&!timezones[_0x424c0b]){_0x2d0fba=CAMPAIGN_STATUS[_0xb782('0x35')];}return _0x2d0fba;}function checkAnyValidTrunk(_0x441b90,_0x75994b){var _0x24b89f=null;var _0x1e9aa0='SIP/';var _0x2e8365=[_0xb782('0x36'),_0xb782('0x37')];var _0x3acddb=!![];if(_0x441b90['Trunk']&&_0x441b90[_0xb782('0x2c')][_0xb782('0x1b')]){_0x1e9aa0+=_0x441b90['Trunk']['name'];_0x24b89f=_0x75994b[_0x1e9aa0];_0x3acddb=_0x2e8365['includes'](_0x24b89f[_0xb782('0x38')]);}else if(_0x441b90[_0xb782('0x39')]&&_0x441b90[_0xb782('0x39')][_0xb782('0x1b')]){_0x1e9aa0+=_0x441b90[_0xb782('0x39')][_0xb782('0x2d')];_0x24b89f=_0x75994b[_0x1e9aa0];_0x3acddb=_0x2e8365['includes'](_0x24b89f[_0xb782('0x38')]);}return _0x3acddb;}function getQueueCampaignStatusMessage(_0x501bc0,_0x5ae73f){var _0x592943=CAMPAIGN_STATUS[_0xb782('0x6')];var _0x34c734=isPreviewCampaign(_0x501bc0);if(!isQueueCampaignActive(_0x501bc0)){if(_0x34c734){_0x592943=CAMPAIGN_STATUS[_0xb782('0x3a')];}else{if(_0x501bc0[_0xb782('0x2b')]===0x0&&_0x501bc0['talking']===0x0&&_0x501bc0[_0xb782('0x29')]===0x0&&(_0x501bc0[_0xb782('0x28')]||0x0)===0x0){_0x592943=CAMPAIGN_STATUS[_0xb782('0x3a')];}else{_0x592943=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x501bc0[_0xb782('0x24')]===0x0){_0x592943=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x501bc0,_0x5ae73f)){_0x592943=CAMPAIGN_STATUS[_0xb782('0x3b')];}else if(!isPreviewCampaign(_0x501bc0)){var _0x1b18da=checkAnyValidQueueCampaignInterval(_0x501bc0);if(_0x1b18da){_0x592943=_0x1b18da;}}return _0x592943;}exports[_0xb782('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x60427b){var _0x1da6d5=CAMPAIGN_STATUS[_0xb782('0x3d')];if(_0x60427b[_0xb782('0x2b')]===0x0&&_0x60427b[_0xb782('0x27')]===0x0&&_0x60427b[_0xb782('0x29')]===0x0&&(_0x60427b[_0xb782('0x28')]||0x0)===0x0){_0x1da6d5=CAMPAIGN_STATUS[_0xb782('0x3a')];}return _0x1da6d5;}exports[_0xb782('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x368598){var _0x294e0d=_0x368598[_0xb782('0x3f')](/"(.*?)"/);return _0x294e0d?_0x294e0d[0x1]:_0x368598;}exports[_0xb782('0x40')]=extractCalleridName;function getCallerId(_0x1dca24,_0x3be83a,_0x5e048c){if(!_['isUndefined'](_0x5e048c)&&typeof _0x5e048c==='string'&&!_[_0xb782('0x33')](_0x5e048c)){if(!_[_0xb782('0x41')](_0x3be83a)&&typeof _0x3be83a==='string'&&!_[_0xb782('0x33')](_0x3be83a)){return util[_0xb782('0x42')](_0xb782('0x43'),_0x3be83a,_0x5e048c);}return util[_0xb782('0x42')](_0xb782('0x43'),_0x5e048c,_0x5e048c);}if(!_['isUndefined'](_0x1dca24)&&typeof _0x1dca24===_0xb782('0x44')&&!_['isEmpty'](_0x1dca24)){return _0x1dca24;}return _0xb782('0x45');}exports[_0xb782('0x46')]=getCallerId;function getCallerIdRandom(_0x3d8a52,_0x519f6a){var _0x13c1cc;var _0x3f4804;var _0x51b785;if(_0x519f6a<=0x0){_0x519f6a=0x1;}_0x13c1cc=new RegExp(_0xb782('0x47')+_0x519f6a+'}$');_0x3f4804=Math[_0xb782('0x48')](0xa,_0x519f6a-0x1);_0x51b785=Math[_0xb782('0x48')](0xa,_0x519f6a)-0x1;return util[_0xb782('0x42')]('%s',_[_0xb782('0x49')](_0x3d8a52,_0x13c1cc,_[_0xb782('0x4a')](_0x3f4804,_0x51b785)['toString']()));}exports[_0xb782('0x4b')]=getCallerIdRandom;function decrementOriginate(_0x377f4f,_0x3d479f){if(_0x377f4f[_0xb782('0x2b')]&&_0x377f4f[_0xb782('0x2b')]>0x0){_0x377f4f[_0xb782('0x2b')]-=0x1;}else{logger[_0xb782('0x4c')]('[decrementOriginate]\x20queue\x20originate\x20value',_0x3d479f);}}exports[_0xb782('0x4d')]=decrementOriginate;function checkContactEmpty(_0x3f16e7){return _0x3f16e7&&_0x3f16e7[_0xb782('0x4e')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x3114e8,_0x5deba8){if(_0x5deba8===0x0){return 0x0;}var _0x250c19=0x1;for(var _0x495c87=0x1;_0x495c87<=_0x5deba8;_0x495c87+=0x1){_0x250c19=0x1+_0x250c19*_0x495c87/_0x3114e8;}return 0x1/_0x250c19;}exports[_0xb782('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x71247d,_0x2c0a93,_0x5cba20){if(_0x2c0a93>_0x5cba20){for(var _0x136f5a=0x0;_0x136f5a<_0x2c0a93-_0x5cba20;_0x136f5a+=0x1){decrementOriginate(_0x71247d,_0xb782('0x50'));}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x3e119a){var _0xcee39f={};var _0x2c0e98=['id',_0xb782('0x51'),'tags',_0xb782('0x52')];const _0x238f3d=0xfa;if(_0x3e119a){for(var _0x500956 in _0x3e119a){if(typeof _0x3e119a[_0x500956]!==_0xb782('0x53')){if(!_[_0xb782('0x2f')](_0x3e119a[_0x500956])&&!_0x2c0e98[_0xb782('0x54')](_0x500956)){if(_0x500956===_0xb782('0x55')&&_0x3e119a[_0x500956][_0xb782('0x4e')]>_0x238f3d){_0xcee39f['XMD-'+_0x500956[_0xb782('0x56')]()]=_0x3e119a[_0x500956][_0xb782('0x57')]()['substring'](0x0,_0x238f3d);}else{_0xcee39f[_0xb782('0x58')+_0x500956[_0xb782('0x56')]()]=_0x3e119a[_0x500956];}}}}}return _0xcee39f;}exports[_0xb782('0x59')]=setXMDContactVariables; \ No newline at end of file +var _0xddbf=['setXMDContactVariables','lodash','moment','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','EMPTY_INTERVAL','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','checkContactEmpty','[checkContactLowerLimitOriginate]\x20','createdAt','tags','updatedAt','undefined','description','length','XMD-','substring','toUpperCase'];(function(_0x2968fe,_0x4d11bb){var _0x1b361f=function(_0xe96328){while(--_0xe96328){_0x2968fe['push'](_0x2968fe['shift']());}};_0x1b361f(++_0x4d11bb);}(_0xddbf,0x1c8));var _0xfddb=function(_0x344a56,_0x1045a4){_0x344a56=_0x344a56-0x0;var _0x2ac981=_0xddbf[_0x344a56];return _0x2ac981;};'use strict';var _=require(_0xfddb('0x0'));var moment=require(_0xfddb('0x1'));var util=require(_0xfddb('0x2'));var logger=require(_0xfddb('0x3'))('dialer');var timezones=require(_0xfddb('0x4'))[_0xfddb('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xfddb('0x6'),'BLACKLIST':_0xfddb('0x7'),'CONTACTS_RESCHEDULED':_0xfddb('0x8'),'DEACTIVATED':_0xfddb('0x9'),'DISACTIVED':_0xfddb('0xa'),'EMPTY_INTERVAL':_0xfddb('0xb'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xfddb('0xc'),'OVERTIME_INTERVAL':_0xfddb('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xfddb('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xfddb('0xf'),'RUNNING':_0xfddb('0x10'),'UNKNOWN_TIMEZONE':_0xfddb('0x11'),'UNREACHABLE_TRUNK':_0xfddb('0x12')};exports[_0xfddb('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x15ba9f){return _0x15ba9f['dialMethod']===_0xfddb('0x14');}exports[_0xfddb('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x332586){return _0x332586[_0xfddb('0x16')]===_0xfddb('0x17');}exports[_0xfddb('0x18')]=isIVRCampaign;function isOutboundQueue(_0x116849){return _0x116849['type']===_0xfddb('0x19');}exports[_0xfddb('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0x226121){return _0x226121[_0xfddb('0x1b')];}exports[_0xfddb('0x1c')]=isQueueCampaignActive;function isIVRCampaignActive(_0x42d4b1){return _0x42d4b1['active'];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x1a4b62,_0x40702d){var _0x21b96f=moment(_0x1a4b62)['milliseconds'](0x0);var _0x1d242e=moment(_0x40702d)[_0xfddb('0x1d')](0x0);return _0x21b96f[_0xfddb('0x1e')](_0x1d242e,_0xfddb('0x1f'));}exports[_0xfddb('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x405dc3,_0x58bf89){var _0x234e0b=![];var _0x58a57d=_0x405dc3[_0xfddb('0x21')]!==_0x58bf89[_0xfddb('0x21')]||_0x405dc3[_0xfddb('0x1b')]!==_0x58bf89['dialActive']||_0x405dc3[_0xfddb('0x22')]!==_0x58bf89[_0xfddb('0x22')];var _0xa9e057=_0x405dc3['available']!==_0x58bf89[_0xfddb('0x23')]||_0x405dc3[_0xfddb('0x24')]!==_0x58bf89[_0xfddb('0x24')]||_0x405dc3[_0xfddb('0x25')]!==_0x58bf89['loggedInDb']||_0x405dc3[_0xfddb('0x26')]!==_0x58bf89[_0xfddb('0x26')]||_0x405dc3[_0xfddb('0x27')]!==_0x58bf89[_0xfddb('0x27')]||_0x405dc3[_0xfddb('0x28')]!==_0x58bf89[_0xfddb('0x28')]||_0x405dc3[_0xfddb('0x29')]!==_0x58bf89[_0xfddb('0x29')]||_0x405dc3[_0xfddb('0x2a')]!==_0x58bf89[_0xfddb('0x2a')]||_0x405dc3[_0xfddb('0x2b')]!==_0x58bf89['originated'];if(_0x405dc3['Trunk']&&_0x58bf89[_0xfddb('0x2c')]){_0x234e0b=_0x405dc3[_0xfddb('0x2c')]['name']!==_0x58bf89[_0xfddb('0x2c')][_0xfddb('0x2d')]||_0x405dc3[_0xfddb('0x2c')][_0xfddb('0x2e')]!==_0x58bf89[_0xfddb('0x2c')][_0xfddb('0x2e')];}return _0x58a57d||_0xa9e057||_0x234e0b;}exports[_0xfddb('0x2f')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1e41af){var _0x187438=null;var _0x32a341=_0x1e41af['dialTimezone'];if(_[_0xfddb('0x30')](_0x1e41af[_0xfddb('0x31')])||_[_0xfddb('0x30')](_0x1e41af[_0xfddb('0x32')])||_[_0xfddb('0x30')](_0x1e41af[_0xfddb('0x32')][_0xfddb('0x33')])){_0x187438=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xfddb('0x34')](_0x1e41af[_0xfddb('0x31')])||_[_0xfddb('0x34')](_0x1e41af[_0xfddb('0x32')][_0xfddb('0x33')])){_0x187438=CAMPAIGN_STATUS[_0xfddb('0x35')];}else if(_0x32a341&&!timezones[_0x32a341]){_0x187438=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x187438;}function checkAnyValidTrunk(_0x2f47b5,_0x283f05){var _0x3fcdd5=null;var _0x598506='SIP/';var _0x42ecb0=[_0xfddb('0x36'),_0xfddb('0x37')];var _0x59ab45=!![];if(_0x2f47b5[_0xfddb('0x2c')]&&_0x2f47b5[_0xfddb('0x2c')][_0xfddb('0x2e')]){_0x598506+=_0x2f47b5[_0xfddb('0x2c')][_0xfddb('0x2d')];_0x3fcdd5=_0x283f05[_0x598506];_0x59ab45=_0x42ecb0[_0xfddb('0x38')](_0x3fcdd5[_0xfddb('0x39')]);}else if(_0x2f47b5[_0xfddb('0x3a')]&&_0x2f47b5[_0xfddb('0x3a')][_0xfddb('0x2e')]){_0x598506+=_0x2f47b5[_0xfddb('0x3a')][_0xfddb('0x2d')];_0x3fcdd5=_0x283f05[_0x598506];_0x59ab45=_0x42ecb0['includes'](_0x3fcdd5[_0xfddb('0x39')]);}return _0x59ab45;}function getQueueCampaignStatusMessage(_0x180a63,_0x3486bf){var _0x2787ab=CAMPAIGN_STATUS[_0xfddb('0x6')];var _0x52762d=isPreviewCampaign(_0x180a63);if(!isQueueCampaignActive(_0x180a63)){if(_0x52762d){_0x2787ab=CAMPAIGN_STATUS[_0xfddb('0x3b')];}else{if(_0x180a63[_0xfddb('0x2b')]===0x0&&_0x180a63[_0xfddb('0x27')]===0x0&&_0x180a63[_0xfddb('0x29')]===0x0&&(_0x180a63[_0xfddb('0x28')]||0x0)===0x0){_0x2787ab=CAMPAIGN_STATUS['INACTIVE'];}else{_0x2787ab=CAMPAIGN_STATUS[_0xfddb('0x3c')];}}}else if(_0x180a63[_0xfddb('0x24')]===0x0){_0x2787ab=CAMPAIGN_STATUS[_0xfddb('0x3d')];}else if(!checkAnyValidTrunk(_0x180a63,_0x3486bf)){_0x2787ab=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x180a63)){var _0x50df2d=checkAnyValidQueueCampaignInterval(_0x180a63);if(_0x50df2d){_0x2787ab=_0x50df2d;}}return _0x2787ab;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x124d16){var _0x3eb527=CAMPAIGN_STATUS['DISACTIVED'];if(_0x124d16['originated']===0x0&&_0x124d16[_0xfddb('0x27')]===0x0&&_0x124d16[_0xfddb('0x29')]===0x0&&(_0x124d16['pTalking']||0x0)===0x0){_0x3eb527=CAMPAIGN_STATUS[_0xfddb('0x3b')];}return _0x3eb527;}exports[_0xfddb('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x241170){var _0x52a4b9=_0x241170['match'](/"(.*?)"/);return _0x52a4b9?_0x52a4b9[0x1]:_0x241170;}exports[_0xfddb('0x3f')]=extractCalleridName;function getCallerId(_0x5e6b23,_0x9fbc6e,_0x170b56){if(!_[_0xfddb('0x40')](_0x170b56)&&typeof _0x170b56===_0xfddb('0x41')&&!_[_0xfddb('0x34')](_0x170b56)){if(!_[_0xfddb('0x40')](_0x9fbc6e)&&typeof _0x9fbc6e===_0xfddb('0x41')&&!_[_0xfddb('0x34')](_0x9fbc6e)){return util[_0xfddb('0x42')](_0xfddb('0x43'),_0x9fbc6e,_0x170b56);}return util[_0xfddb('0x42')](_0xfddb('0x43'),_0x170b56,_0x170b56);}if(!_[_0xfddb('0x40')](_0x5e6b23)&&typeof _0x5e6b23===_0xfddb('0x41')&&!_[_0xfddb('0x34')](_0x5e6b23)){return _0x5e6b23;}return _0xfddb('0x44');}exports[_0xfddb('0x45')]=getCallerId;function getCallerIdRandom(_0x5ebaf7,_0x17f916){var _0x16969b;var _0x1d5b1b;var _0x1d316b;if(_0x17f916<=0x0){_0x17f916=0x1;}_0x16969b=new RegExp(_0xfddb('0x46')+_0x17f916+'}$');_0x1d5b1b=Math[_0xfddb('0x47')](0xa,_0x17f916-0x1);_0x1d316b=Math[_0xfddb('0x47')](0xa,_0x17f916)-0x1;return util[_0xfddb('0x42')]('%s',_[_0xfddb('0x48')](_0x5ebaf7,_0x16969b,_[_0xfddb('0x49')](_0x1d5b1b,_0x1d316b)[_0xfddb('0x4a')]()));}exports[_0xfddb('0x4b')]=getCallerIdRandom;function decrementOriginate(_0x1d5f81,_0x42b9f6){if(_0x1d5f81[_0xfddb('0x2b')]&&_0x1d5f81['originated']>0x0){_0x1d5f81[_0xfddb('0x2b')]-=0x1;}else{logger[_0xfddb('0x4c')](_0xfddb('0x4d'),_0x42b9f6);}}exports[_0xfddb('0x4e')]=decrementOriginate;function checkContactEmpty(_0x2ae463){return _0x2ae463&&_0x2ae463['length']>0x0;}exports[_0xfddb('0x4f')]=checkContactEmpty;function erlangb(_0x1c2a5e,_0x532afc){if(_0x532afc===0x0){return 0x0;}var _0x4c33fa=0x1;for(var _0x5e332=0x1;_0x5e332<=_0x532afc;_0x5e332+=0x1){_0x4c33fa=0x1+_0x4c33fa*_0x5e332/_0x1c2a5e;}return 0x1/_0x4c33fa;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x5bad14,_0x544c76,_0x4020de){if(_0x544c76>_0x4020de){for(var _0x3a7c7f=0x0;_0x3a7c7f<_0x544c76-_0x4020de;_0x3a7c7f+=0x1){decrementOriginate(_0x5bad14,_0xfddb('0x50'));}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x209fbb){var _0x3613ee={};var _0x174ab9=['id',_0xfddb('0x51'),_0xfddb('0x52'),_0xfddb('0x53')];const _0x1558a3=0xfa;if(_0x209fbb){for(var _0x44f636 in _0x209fbb){if(typeof _0x209fbb[_0x44f636]!==_0xfddb('0x54')){if(!_['isNil'](_0x209fbb[_0x44f636])&&!_0x174ab9[_0xfddb('0x38')](_0x44f636)){if(_0x44f636===_0xfddb('0x55')&&_0x209fbb[_0x44f636][_0xfddb('0x56')]>_0x1558a3){_0x3613ee[_0xfddb('0x57')+_0x44f636['toUpperCase']()]=_0x209fbb[_0x44f636]['toString']()[_0xfddb('0x58')](0x0,_0x1558a3);}else{_0x3613ee['XMD-'+_0x44f636[_0xfddb('0x59')]()]=_0x209fbb[_0x44f636];}}}}}return _0x3613ee;}exports[_0xfddb('0x5a')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 65dd20b..ba8b018 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(_0x39eb36,_0x260851){var _0x257c9c=function(_0x455ac1){while(--_0x455ac1){_0x39eb36['push'](_0x39eb36['shift']());}};_0x257c9c(++_0x260851);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x2f2a0e,_0x2f5593){var _0x4b2d9d=function(_0x5a3c2b){while(--_0x5a3c2b){_0x2f2a0e['push'](_0x2f2a0e['shift']());}};_0x4b2d9d(++_0x2f5593);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 56ab8b0..6d2be6a 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 _0x2852=['\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','fax','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','../../../config/logger','../ami','./util/util','./action','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','hasOwnProperty','syncNewState','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20'];(function(_0x47ee00,_0x256539){var _0x3d35f9=function(_0x5797c7){while(--_0x5797c7){_0x47ee00['push'](_0x47ee00['shift']());}};_0x3d35f9(++_0x256539);}(_0x2852,0xa2));var _0x2285=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0x2852[_0xd299c3];return _0x376574;};'use strict';var util=require(_0x2285('0x0'));var _=require(_0x2285('0x1'));var BPromise=require(_0x2285('0x2'));var uuid=require('uuid');var moment=require(_0x2285('0x3'));var path=require(_0x2285('0x4'));var tiff2pdf=require(_0x2285('0x5'));var gs=require('./util/gs');var logger=require(_0x2285('0x6'))('fax');var ami=require(_0x2285('0x7'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0x2285('0x8'));var Action=require(_0x2285('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0x2285('0xa'));function Fax(_0x131746){this[_0x2285('0xb')]={};this[_0x2285('0xc')]=_0x131746[_0x2285('0xc')];this[_0x2285('0xd')]=_0x131746[_0x2285('0xd')];this['actions']={};ami['on'](_0x2285('0xe'),this[_0x2285('0xf')][_0x2285('0x10')](this));ami['on'](_0x2285('0x11'),this[_0x2285('0x12')][_0x2285('0x10')](this));ami['on'](_0x2285('0x13'),this['syncNewState'][_0x2285('0x10')](this));ami['on'](_0x2285('0x14'),this['syncNewExten']['bind'](this));ami['on']('faxstatus',this['syncFaxStatus']['bind'](this));ami['on'](_0x2285('0x15'),this[_0x2285('0x16')]['bind'](this));ami['on'](_0x2285('0x17'),this[_0x2285('0x18')]['bind'](this));ami['on'](_0x2285('0x19'),this[_0x2285('0x1a')][_0x2285('0x10')](this));}Fax[_0x2285('0x1b')][_0x2285('0xf')]=function(_0x350aee){if(_0x350aee[_0x2285('0x1c')]===_0x2285('0x1d')){for(var _0x4ef77a in this[_0x2285('0xc')]){if(this[_0x2285('0xc')]['hasOwnProperty'](_0x4ef77a)){if(_0x350aee[_0x2285('0x1e')]===this[_0x2285('0xc')][_0x4ef77a][_0x2285('0x1f')]){this['channels'][_0x350aee[_0x2285('0x20')]]={};this[_0x2285('0xb')][_0x350aee[_0x2285('0x20')]][_0x2285('0x21')]=_0x350aee[_0x2285('0x21')];this['channels'][_0x350aee[_0x2285('0x20')]]['id']=this[_0x2285('0xc')][_0x4ef77a]['id'];this[_0x2285('0xb')][_0x350aee[_0x2285('0x20')]][_0x2285('0x22')]=this[_0x2285('0xc')][_0x4ef77a][_0x2285('0x22')];logger[_0x2285('0x23')](_0x350aee['uniqueid'],_0x2285('0x24'));}}}}if(this[_0x2285('0x25')][_0x350aee['uniqueid']]){this[_0x2285('0xb')][_0x350aee['uniqueid']]={};this['channels'][_0x350aee[_0x2285('0x20')]]['channel']=_0x350aee['channel'];logger['info'](_0x350aee[_0x2285('0x20')],_0x2285('0x24'));}};Fax[_0x2285('0x1b')][_0x2285('0x12')]=function(_0x3a7038){if(this[_0x2285('0xb')][_0x3a7038[_0x2285('0x20')]]){for(var _0x509186 in _0x3a7038[_0x2285('0x26')]){if(_0x3a7038[_0x2285('0x26')][_0x2285('0x27')](_0x509186)){this['channels'][_0x3a7038['uniqueid']][_0x509186]=_0x3a7038['value'];}}}};Fax[_0x2285('0x1b')][_0x2285('0x28')]=function(_0x14b0b1){if(this[_0x2285('0xb')][_0x14b0b1[_0x2285('0x20')]]){this[_0x2285('0xb')][_0x14b0b1[_0x2285('0x20')]]['channelstate']=_0x14b0b1['channelstate'];this[_0x2285('0xb')][_0x14b0b1[_0x2285('0x20')]][_0x2285('0x29')]=_0x14b0b1['channelstatedesc'];}};Fax[_0x2285('0x1b')]['syncNewExten']=function(_0x13c77d){if(this['channels'][_0x13c77d[_0x2285('0x20')]]){for(var _0x4ecccf in _0x13c77d[_0x2285('0x26')]){if(_0x13c77d[_0x2285('0x26')][_0x2285('0x27')](_0x4ecccf)){this[_0x2285('0xb')][_0x13c77d[_0x2285('0x20')]][_0x4ecccf]=_0x13c77d['value'];}}}};Fax[_0x2285('0x1b')][_0x2285('0x2a')]=function(_0x427c8){if(this[_0x2285('0xb')][_0x427c8['uniqueid']]){this['channels'][_0x427c8['uniqueid']][_0x2285('0x2b')]=_0x427c8['operation'];this[_0x2285('0xb')][_0x427c8[_0x2285('0x20')]][_0x2285('0x2c')]=_0x427c8[_0x2285('0x2c')];this[_0x2285('0xb')][_0x427c8['uniqueid']][_0x2285('0x1f')]=_0x427c8['localstationid'];this[_0x2285('0xb')][_0x427c8['uniqueid']][_0x2285('0x2d')]=_0x427c8[_0x2285('0x2d')];logger['info'](_0x427c8[_0x2285('0x20')],_0x2285('0x2e'));}};Fax[_0x2285('0x1b')][_0x2285('0x16')]=function(_0x4fb7bb){var _0x980372=this;if(this[_0x2285('0xb')][_0x4fb7bb['uniqueid']]){var _0x62326a=this[_0x2285('0xb')][_0x4fb7bb[_0x2285('0x20')]]['id'];this[_0x2285('0xb')][_0x4fb7bb[_0x2285('0x20')]][_0x2285('0x2f')]=_0x4fb7bb[_0x2285('0x2f')];this[_0x2285('0xb')][_0x4fb7bb[_0x2285('0x20')]][_0x2285('0x30')]=_0x4fb7bb['pagestransferred'];this[_0x2285('0xb')][_0x4fb7bb[_0x2285('0x20')]][_0x2285('0x1f')]=_0x4fb7bb[_0x2285('0x1f')];this[_0x2285('0xb')][_0x4fb7bb[_0x2285('0x20')]][_0x2285('0x31')]=_0x4fb7bb[_0x2285('0x31')];this[_0x2285('0xb')][_0x4fb7bb[_0x2285('0x20')]]['transferrate']=_0x4fb7bb[_0x2285('0x32')];this['channels'][_0x4fb7bb[_0x2285('0x20')]][_0x2285('0x2d')]=_0x4fb7bb[_0x2285('0x2d')];this[_0x2285('0xb')][_0x4fb7bb[_0x2285('0x20')]]['calleridnum']=_0x4fb7bb[_0x2285('0x33')];if(this[_0x2285('0xb')][_0x4fb7bb['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x4fb7bb[_0x2285('0x2d')],'/var/opt/motion2/server/files/attachments/',function(_0x1b46b8){logger[_0x2285('0x23')](_0x4fb7bb[_0x2285('0x20')],_0x2285('0x34'),_0x1b46b8[_0x2285('0x35')]);attachment[_0x2285('0x36')]({'name':path[_0x2285('0x37')](_0x4fb7bb[_0x2285('0x2d')])[_0x2285('0x22')],'basename':path[_0x2285('0x37')](_0x4fb7bb[_0x2285('0x2d')])['name']+_0x2285('0x38'),'type':_0x2285('0x39')})[_0x2285('0x3a')](function(_0x196730){faxAccount[_0x2285('0x3b')](_0x62326a,{'from':_0x4fb7bb[_0x2285('0x33')],'mapKey':'fax','body':path['parse'](_0x4fb7bb[_0x2285('0x2d')])[_0x2285('0x22')]+_0x2285('0x38'),'AttachmentId':_0x196730['id']})[_0x2285('0x3c')](function(_0x333e1e){logger[_0x2285('0x3d')](_0x4fb7bb['uniqueid'],'\x20notify\x20',JSON[_0x2285('0x3e')](_0x333e1e));});})[_0x2285('0x3c')](function(_0x45d9f3){logger['error'](_0x4fb7bb[_0x2285('0x20')],_0x2285('0x3f'),JSON['stringify'](_0x45d9f3));});});}logger[_0x2285('0x23')](_0x4fb7bb['uniqueid'],_0x2285('0x3f'));}};Fax['prototype'][_0x2285('0x1a')]=function(_0x24137a){if(this[_0x2285('0x25')][_0x24137a[_0x2285('0x20')]]){_[_0x2285('0x40')](this[_0x2285('0xb')][_0x24137a['uniqueid']],_[_0x2285('0x41')](_0x24137a,[_0x2285('0x42'),_0x2285('0x43')]));}};function updateStatus(_0x49459f){if(_0x49459f[_0x2285('0x44')]){faxMessage[_0x2285('0x45')](_0x49459f[_0x2285('0x44')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x2285('0x3a')](function(_0x30b5eb){ut[_0x2285('0x46')]('[Fax][Message][Error][Updated]',_0x30b5eb);})[_0x2285('0x3c')](function(_0x6e97d7){ut['logger'](_0x2285('0x47'),_0x6e97d7);});}else{ut[_0x2285('0x46')](_0x2285('0x48'));}}Fax['prototype']['updateStatus']=function(_0xde0739,_0x29e66,_0x483a72){var _0x4c8d9a=this;var _0xf3c04e={};if(_0x29e66){_0xf3c04e={'read':_0x29e66};}else{_0xf3c04e={'failMessage':_0x483a72};}if(this['actions'][_0xde0739][_0x2285('0x44')]){faxMessage[_0x2285('0x45')](this[_0x2285('0x25')][_0xde0739][_0x2285('0x44')],_0xf3c04e)[_0x2285('0x3a')](function(_0x426fb4){ut['logger'](_0x2285('0x49'),_0x426fb4);})['catch'](function(_0x126632){ut[_0x2285('0x46')]('[Fax][Message][NoUpdate1]',_0x126632);})[_0x2285('0x4a')](function(){delete _0x4c8d9a[_0x2285('0xb')][_0xde0739];delete _0x4c8d9a['actions'][_0xde0739];});}else{ut[_0x2285('0x46')](_0x2285('0x4b'));this[_0x2285('0x4c')](_0xde0739);delete this[_0x2285('0x25')][_0xde0739];}};Fax[_0x2285('0x1b')][_0x2285('0x18')]=function(_0x3df77b){var _0x2f0775=this;if(this['channels'][_0x3df77b['uniqueid']]){if(this['actions'][_0x3df77b[_0x2285('0x20')]]){this[_0x2285('0xb')][_0x3df77b[_0x2285('0x20')]]['id']=this['actions'][_0x3df77b['uniqueid']]['id'];this[_0x2285('0xb')][_0x3df77b[_0x2285('0x20')]][_0x2285('0x22')]=this[_0x2285('0x25')][_0x3df77b[_0x2285('0x20')]][_0x2285('0x22')];}logger[_0x2285('0x23')](_0x3df77b['uniqueid'],this[_0x2285('0x25')][_0x3df77b['uniqueid']]?_0x2285('0x4d'):_0x2285('0x4e'),JSON[_0x2285('0x3e')](this[_0x2285('0xb')][_0x3df77b['uniqueid']]));if(this[_0x2285('0x25')][_0x3df77b[_0x2285('0x20')]]){if(this[_0x2285('0xb')][_0x3df77b[_0x2285('0x20')]][_0x2285('0x4f')]>0x0&&this[_0x2285('0xb')][_0x3df77b['uniqueid']][_0x2285('0x50')]==='SUCCESS'){this[_0x2285('0x51')](_0x3df77b[_0x2285('0x20')],!![]);}else{this['updateStatus'](_0x3df77b['uniqueid'],![],this[_0x2285('0xb')][_0x3df77b[_0x2285('0x20')]][_0x2285('0x52')]?_0x2285('0x53')+this[_0x2285('0xb')][_0x3df77b[_0x2285('0x20')]][_0x2285('0x52')]:_0x2285('0x54'));}}}};Fax[_0x2285('0x1b')]['send']=function(_0x4dcf5a){var _0x19e878=this;return new BPromise(function(_0x364f15,_0x55bb93){_0x19e878[_0x2285('0x55')](_0x4dcf5a,_0x19e878[_0x2285('0xc')][_0x4dcf5a[_0x2285('0x56')]])['then'](function(_0x370b99){ut[_0x2285('0x46')](_0x2285('0x57'),_0x370b99);_0x364f15(ut[_0x2285('0x35')](_0x2285('0x58')));})[_0x2285('0x3c')](function(_0x4936a8){ut[_0x2285('0x46')](_0x2285('0x59'),_0x4936a8);updateStatus(_0x4dcf5a);_0x55bb93(ut[_0x2285('0x35')](_0x2285('0x5a')));});});};Fax[_0x2285('0x1b')][_0x2285('0x5b')]=function(_0x3acb15){var _0x46b3db=this;return new BPromise(function(_0x26fdf1,_0x5b792e){var _0x260d8f=_0x46b3db[_0x2285('0x5c')](_0x46b3db['faxAccounts'][_0x3acb15['FaxAccountId']][_0x2285('0x5d')],_0x3acb15);if(_0x260d8f['isValid']){_0x26fdf1(ut['message'](_0x2285('0x5e')));}else{_0x5b792e(ut['message'](_0x260d8f['message']));}});};function originate(_0x3a0339,_0x4eb0a5,_0x2c0ebc){return new BPromise(function(_0x41fb8e,_0xbc6451){if(_0x2c0ebc){var _0x357319=util[_0x2285('0x5f')](_0x2285('0x60'),path[_0x2285('0x37')](_0x3a0339['path'])[_0x2285('0x22')],_0x3a0339[_0x2285('0x4')]);gs['execute'](_0x357319)[_0x2285('0x3a')](function(){_0x3a0339['path']=util['format'](_0x2285('0x61'),path[_0x2285('0x37')](_0x3a0339['path'])[_0x2285('0x62')],path[_0x2285('0x37')](_0x3a0339[_0x2285('0x4')])[_0x2285('0x22')]);_0x4eb0a5[_0x2285('0x63')]=_0x3a0339[_0x2285('0x4')];ut['logger'](_0x2285('0x64'),'');ami[_0x2285('0x65')](ut[_0x2285('0x66')](_0x3a0339,_0x4eb0a5))[_0x2285('0x3a')](function(_0x37e023){_0x41fb8e(_0x37e023);})['catch'](function(_0x18683c){_0xbc6451(_0x18683c);});})[_0x2285('0x3c')](function(_0x3efa39){_0xbc6451(_0x3efa39);});}else{ami[_0x2285('0x65')](ut[_0x2285('0x66')](_0x3a0339,_0x4eb0a5))[_0x2285('0x3a')](function(_0x41fa3a){_0x41fb8e(_0x41fa3a);})[_0x2285('0x3c')](function(_0x9a7082){_0xbc6451(_0x9a7082);});}});}Fax[_0x2285('0x1b')]['execOriginate']=function(_0x4bbfe6,_0x368b43){var _0x2af036=this;return new BPromise(function(_0x1dda6a,_0x17c190){var _0x42e166=uuid['v4']();var _0x15c778=ut[_0x2285('0x67')](_0x4bbfe6,_0x368b43);_0x2af036[_0x2285('0x25')][_0x42e166]=new Action(_0x42e166,_0x368b43,_0x4bbfe6);var _0x2942d8=_0x2af036['actions'][_0x42e166];if(path[_0x2285('0x37')](_0x4bbfe6['path'])[_0x2285('0x68')]===_0x2285('0x38')){originate(_0x2942d8,_0x15c778,!![])[_0x2285('0x3a')](function(_0x73161c){_0x1dda6a(_0x73161c);})[_0x2285('0x3c')](function(_0x1496d9){_0x17c190(_0x1496d9);});}else{originate(_0x2942d8,_0x15c778,![])[_0x2285('0x3a')](function(_0x5a745d){_0x1dda6a(_0x5a745d);})[_0x2285('0x3c')](function(_0x5747a7){_0x17c190(_0x5747a7);});}});};Fax[_0x2285('0x1b')][_0x2285('0x69')]=function(_0x58aefb){return!_[_0x2285('0x6a')](_0x58aefb)&&!_[_0x2285('0x6a')](_0x58aefb['name'])&&!_[_0x2285('0x6a')](_0x58aefb['active'])&&_0x58aefb[_0x2285('0x6b')]&&!_[_0x2285('0x6a')](this[_0x2285('0xd')][util[_0x2285('0x5f')]('SIP/%s',_0x58aefb[_0x2285('0x22')])])&&!_['isNil'](this[_0x2285('0xd')][util[_0x2285('0x5f')](_0x2285('0x6c'),_0x58aefb[_0x2285('0x22')])][_0x2285('0x2c')])&&(this['trunks'][util[_0x2285('0x5f')]('SIP/%s',_0x58aefb['name'])][_0x2285('0x2c')]===_0x2285('0x6d')||this[_0x2285('0xd')][util[_0x2285('0x5f')](_0x2285('0x6c'),_0x58aefb[_0x2285('0x22')])]['status']===_0x2285('0x6e'));};Fax[_0x2285('0x1b')]['checkTrunk']=function(_0x505892,_0x58d736){if(!this[_0x2285('0x69')](_0x505892)){ut['logger'](_0x2285('0x6f'),_[_0x2285('0x6a')](_0x505892)?'':_0x505892[_0x2285('0x22')]+_0x2285('0x70'));return{'isValid':![],'message':_0x2285('0x71')};}if(_[_0x2285('0x6a')](_0x58d736[_0x2285('0x72')])){ut[_0x2285('0x46')](_0x2285('0x73'),JSON[_0x2285('0x3e')](_0x58d736));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x2285('0x6a')](_0x58d736[_0x2285('0x4')])){ut[_0x2285('0x46')](_0x2285('0x74'),JSON[_0x2285('0x3e')](_0x58d736));return{'isValid':![],'message':_0x2285('0x75')};}return{'isValid':!![],'message':_0x2285('0x76')};};Fax[_0x2285('0x1b')][_0x2285('0x4c')]=function(_0x161834,_0x2e2304=0x2710){if(this['channels'][_0x161834]){setTimeout(()=>{delete this['channels'][_0x161834];},_0x2e2304);}};module[_0x2285('0x77')]=Fax; \ No newline at end of file +var _0x19c4=['channelstate','channelstatedesc','value','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','name','.pdf','application/pdf','notify','catch','\x20notify\x20','error','\x20receiveFax\x20','stringify','merge','pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','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','format','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','lodash','uuid','moment','path','tiff2pdf','../../../config/logger','fax','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','info','\x20syncNewchannel\x20','variable'];(function(_0x27799b,_0xc3152b){var _0x522e82=function(_0x5cc404){while(--_0x5cc404){_0x27799b['push'](_0x27799b['shift']());}};_0x522e82(++_0xc3152b);}(_0x19c4,0x144));var _0x419c=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0x19c4[_0x1fd675];return _0x16b554;};'use strict';var util=require(_0x419c('0x0'));var _=require(_0x419c('0x1'));var BPromise=require('bluebird');var uuid=require(_0x419c('0x2'));var moment=require(_0x419c('0x3'));var path=require(_0x419c('0x4'));var tiff2pdf=require(_0x419c('0x5'));var gs=require('./util/gs');var logger=require(_0x419c('0x6'))(_0x419c('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0x419c('0x8'));var Action=require(_0x419c('0x9'));var faxAccount=require(_0x419c('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x419c('0xb'));function Fax(_0x5ed6a9){this[_0x419c('0xc')]={};this[_0x419c('0xd')]=_0x5ed6a9['faxAccounts'];this['trunks']=_0x5ed6a9[_0x419c('0xe')];this[_0x419c('0xf')]={};ami['on']('newchannel',this['syncNewchannel'][_0x419c('0x10')](this));ami['on'](_0x419c('0x11'),this[_0x419c('0x12')]['bind'](this));ami['on'](_0x419c('0x13'),this[_0x419c('0x14')][_0x419c('0x10')](this));ami['on'](_0x419c('0x15'),this[_0x419c('0x16')][_0x419c('0x10')](this));ami['on'](_0x419c('0x17'),this[_0x419c('0x18')]['bind'](this));ami['on'](_0x419c('0x19'),this[_0x419c('0x1a')][_0x419c('0x10')](this));ami['on']('hangup',this[_0x419c('0x1b')][_0x419c('0x10')](this));ami['on'](_0x419c('0x1c'),this[_0x419c('0x1d')][_0x419c('0x10')](this));}Fax[_0x419c('0x1e')][_0x419c('0x1f')]=function(_0x33c8a7){if(_0x33c8a7[_0x419c('0x20')]===_0x419c('0x21')){for(var _0x49dac8 in this['faxAccounts']){if(this[_0x419c('0xd')][_0x419c('0x22')](_0x49dac8)){if(_0x33c8a7[_0x419c('0x23')]===this[_0x419c('0xd')][_0x49dac8][_0x419c('0x24')]){this[_0x419c('0xc')][_0x33c8a7[_0x419c('0x25')]]={};this['channels'][_0x33c8a7['uniqueid']][_0x419c('0x26')]=_0x33c8a7[_0x419c('0x26')];this[_0x419c('0xc')][_0x33c8a7[_0x419c('0x25')]]['id']=this[_0x419c('0xd')][_0x49dac8]['id'];this[_0x419c('0xc')][_0x33c8a7[_0x419c('0x25')]]['name']=this[_0x419c('0xd')][_0x49dac8]['name'];logger[_0x419c('0x27')](_0x33c8a7['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0x419c('0xf')][_0x33c8a7[_0x419c('0x25')]]){this[_0x419c('0xc')][_0x33c8a7[_0x419c('0x25')]]={};this[_0x419c('0xc')][_0x33c8a7[_0x419c('0x25')]][_0x419c('0x26')]=_0x33c8a7['channel'];logger[_0x419c('0x27')](_0x33c8a7[_0x419c('0x25')],_0x419c('0x28'));}};Fax[_0x419c('0x1e')]['syncVarSet']=function(_0x3b464d){if(this[_0x419c('0xc')][_0x3b464d[_0x419c('0x25')]]){for(var _0x7ac591 in _0x3b464d[_0x419c('0x29')]){if(_0x3b464d[_0x419c('0x29')]['hasOwnProperty'](_0x7ac591)){this[_0x419c('0xc')][_0x3b464d[_0x419c('0x25')]][_0x7ac591]=_0x3b464d['value'];}}}};Fax['prototype'][_0x419c('0x14')]=function(_0x5cd6b4){if(this[_0x419c('0xc')][_0x5cd6b4[_0x419c('0x25')]]){this[_0x419c('0xc')][_0x5cd6b4[_0x419c('0x25')]][_0x419c('0x2a')]=_0x5cd6b4[_0x419c('0x2a')];this[_0x419c('0xc')][_0x5cd6b4['uniqueid']][_0x419c('0x2b')]=_0x5cd6b4['channelstatedesc'];}};Fax[_0x419c('0x1e')]['syncNewExten']=function(_0x5e0985){if(this['channels'][_0x5e0985['uniqueid']]){for(var _0x752573 in _0x5e0985['variable']){if(_0x5e0985[_0x419c('0x29')][_0x419c('0x22')](_0x752573)){this[_0x419c('0xc')][_0x5e0985[_0x419c('0x25')]][_0x752573]=_0x5e0985[_0x419c('0x2c')];}}}};Fax[_0x419c('0x1e')][_0x419c('0x18')]=function(_0x52a111){if(this['channels'][_0x52a111['uniqueid']]){this[_0x419c('0xc')][_0x52a111[_0x419c('0x25')]][_0x419c('0x2d')]=_0x52a111[_0x419c('0x2d')];this[_0x419c('0xc')][_0x52a111[_0x419c('0x25')]][_0x419c('0x2e')]=_0x52a111[_0x419c('0x2e')];this[_0x419c('0xc')][_0x52a111[_0x419c('0x25')]]['localstationid']=_0x52a111[_0x419c('0x24')];this[_0x419c('0xc')][_0x52a111['uniqueid']][_0x419c('0x2f')]=_0x52a111[_0x419c('0x2f')];logger[_0x419c('0x27')](_0x52a111[_0x419c('0x25')],'\x20syncFaxStatus\x20');}};Fax['prototype']['syncReceiveFax']=function(_0x244e2b){var _0xe98320=this;if(this[_0x419c('0xc')][_0x244e2b['uniqueid']]){var _0x40ea80=this['channels'][_0x244e2b[_0x419c('0x25')]]['id'];this[_0x419c('0xc')][_0x244e2b[_0x419c('0x25')]][_0x419c('0x30')]=_0x244e2b[_0x419c('0x30')];this[_0x419c('0xc')][_0x244e2b[_0x419c('0x25')]][_0x419c('0x31')]=_0x244e2b[_0x419c('0x31')];this[_0x419c('0xc')][_0x244e2b[_0x419c('0x25')]]['localstationid']=_0x244e2b[_0x419c('0x24')];this['channels'][_0x244e2b[_0x419c('0x25')]]['resolution']=_0x244e2b[_0x419c('0x32')];this[_0x419c('0xc')][_0x244e2b[_0x419c('0x25')]][_0x419c('0x33')]=_0x244e2b[_0x419c('0x33')];this[_0x419c('0xc')][_0x244e2b[_0x419c('0x25')]][_0x419c('0x2f')]=_0x244e2b[_0x419c('0x2f')];this['channels'][_0x244e2b[_0x419c('0x25')]][_0x419c('0x34')]=_0x244e2b[_0x419c('0x34')];if(this[_0x419c('0xc')][_0x244e2b['uniqueid']][_0x419c('0x31')]>0x0){tiff2pdf(_0x244e2b[_0x419c('0x2f')],_0x419c('0x35'),function(_0x32e479){logger[_0x419c('0x27')](_0x244e2b['uniqueid'],_0x419c('0x36'),_0x32e479[_0x419c('0x37')]);attachment[_0x419c('0x38')]({'name':path[_0x419c('0x39')](_0x244e2b[_0x419c('0x2f')])['name'],'basename':path[_0x419c('0x39')](_0x244e2b['filename'])[_0x419c('0x3a')]+_0x419c('0x3b'),'type':_0x419c('0x3c')})['then'](function(_0x503ab7){faxAccount[_0x419c('0x3d')](_0x40ea80,{'from':_0x244e2b['calleridnum'],'mapKey':_0x419c('0x7'),'body':path[_0x419c('0x39')](_0x244e2b['filename'])['name']+_0x419c('0x3b'),'AttachmentId':_0x503ab7['id']})[_0x419c('0x3e')](function(_0x1b59a2){logger['error'](_0x244e2b['uniqueid'],_0x419c('0x3f'),JSON['stringify'](_0x1b59a2));});})['catch'](function(_0x326370){logger[_0x419c('0x40')](_0x244e2b['uniqueid'],_0x419c('0x41'),JSON[_0x419c('0x42')](_0x326370));});});}logger[_0x419c('0x27')](_0x244e2b[_0x419c('0x25')],'\x20receiveFax\x20');}};Fax[_0x419c('0x1e')][_0x419c('0x1d')]=function(_0x128a18){if(this[_0x419c('0xf')][_0x128a18['uniqueid']]){_[_0x419c('0x43')](this[_0x419c('0xc')][_0x128a18[_0x419c('0x25')]],_[_0x419c('0x44')](_0x128a18,['response',_0x419c('0x45')]));}};function updateStatus(_0x49b5e4){if(_0x49b5e4['AttachmentId']){faxMessage[_0x419c('0x46')](_0x49b5e4[_0x419c('0x47')],{'failMessage':_0x419c('0x48')})[_0x419c('0x49')](function(_0x59efa8){ut['logger'](_0x419c('0x4a'),_0x59efa8);})[_0x419c('0x3e')](function(_0x376fc3){ut[_0x419c('0x4b')](_0x419c('0x4c'),_0x376fc3);});}else{ut[_0x419c('0x4b')](_0x419c('0x4d'));}}Fax[_0x419c('0x1e')][_0x419c('0x4e')]=function(_0x109fb6,_0x462b9b,_0x5d74a4){var _0x595d17=this;var _0x547525={};if(_0x462b9b){_0x547525={'read':_0x462b9b};}else{_0x547525={'failMessage':_0x5d74a4};}if(this['actions'][_0x109fb6]['AttachmentId']){faxMessage[_0x419c('0x46')](this['actions'][_0x109fb6][_0x419c('0x47')],_0x547525)[_0x419c('0x49')](function(_0x38797a){ut[_0x419c('0x4b')](_0x419c('0x4f'),_0x38797a);})[_0x419c('0x3e')](function(_0x14ee04){ut['logger'](_0x419c('0x50'),_0x14ee04);})[_0x419c('0x51')](function(){delete _0x595d17[_0x419c('0xc')][_0x109fb6];delete _0x595d17[_0x419c('0xf')][_0x109fb6];});}else{ut['logger'](_0x419c('0x52'));this[_0x419c('0x53')](_0x109fb6);delete this[_0x419c('0xf')][_0x109fb6];}};Fax[_0x419c('0x1e')]['syncHangup']=function(_0x2657e8){var _0x5df71a=this;if(this[_0x419c('0xc')][_0x2657e8[_0x419c('0x25')]]){if(this[_0x419c('0xf')][_0x2657e8[_0x419c('0x25')]]){this[_0x419c('0xc')][_0x2657e8[_0x419c('0x25')]]['id']=this[_0x419c('0xf')][_0x2657e8[_0x419c('0x25')]]['id'];this[_0x419c('0xc')][_0x2657e8[_0x419c('0x25')]]['name']=this[_0x419c('0xf')][_0x2657e8[_0x419c('0x25')]][_0x419c('0x3a')];}logger['info'](_0x2657e8['uniqueid'],this[_0x419c('0xf')][_0x2657e8[_0x419c('0x25')]]?_0x419c('0x54'):_0x419c('0x55'),JSON[_0x419c('0x42')](this[_0x419c('0xc')][_0x2657e8[_0x419c('0x25')]]));if(this[_0x419c('0xf')][_0x2657e8[_0x419c('0x25')]]){if(this['channels'][_0x2657e8[_0x419c('0x25')]][_0x419c('0x56')]>0x0&&this[_0x419c('0xc')][_0x2657e8[_0x419c('0x25')]][_0x419c('0x17')]===_0x419c('0x57')){this['updateStatus'](_0x2657e8[_0x419c('0x25')],!![]);}else{this[_0x419c('0x4e')](_0x2657e8[_0x419c('0x25')],![],this[_0x419c('0xc')][_0x2657e8[_0x419c('0x25')]][_0x419c('0x58')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x2657e8[_0x419c('0x25')]]['faxstatusstring']:_0x419c('0x59'));}}}};Fax[_0x419c('0x1e')][_0x419c('0x5a')]=function(_0x5835e7){var _0x494170=this;return new BPromise(function(_0x5dc4bc,_0x570a0a){_0x494170['execOriginate'](_0x5835e7,_0x494170[_0x419c('0xd')][_0x5835e7[_0x419c('0x5b')]])[_0x419c('0x49')](function(_0xcbb3c0){ut[_0x419c('0x4b')](_0x419c('0x5c'),_0xcbb3c0);_0x5dc4bc(ut['message'](_0x419c('0x5d')));})[_0x419c('0x3e')](function(_0x518d90){ut[_0x419c('0x4b')](_0x419c('0x5e'),_0x518d90);updateStatus(_0x5835e7);_0x570a0a(ut[_0x419c('0x37')](_0x419c('0x5f')));});});};Fax[_0x419c('0x1e')][_0x419c('0x60')]=function(_0x153a77){var _0x3913de=this;return new BPromise(function(_0x5f00ab,_0x172a42){var _0x5c5f17=_0x3913de[_0x419c('0x61')](_0x3913de[_0x419c('0xd')][_0x153a77[_0x419c('0x5b')]][_0x419c('0x62')],_0x153a77);if(_0x5c5f17[_0x419c('0x63')]){_0x5f00ab(ut[_0x419c('0x37')]('Trunk\x20Reachable'));}else{_0x172a42(ut[_0x419c('0x37')](_0x5c5f17[_0x419c('0x37')]));}});};function originate(_0x5e343d,_0x2da6f0,_0xfbfa35){return new BPromise(function(_0x279099,_0x362890){if(_0xfbfa35){var _0x1de1ef=util['format'](_0x419c('0x64'),path[_0x419c('0x39')](_0x5e343d[_0x419c('0x4')])[_0x419c('0x3a')],_0x5e343d[_0x419c('0x4')]);gs['execute'](_0x1de1ef)[_0x419c('0x49')](function(){_0x5e343d[_0x419c('0x4')]=util[_0x419c('0x65')](_0x419c('0x66'),path['parse'](_0x5e343d['path'])['dir'],path[_0x419c('0x39')](_0x5e343d[_0x419c('0x4')])[_0x419c('0x3a')]);_0x2da6f0[_0x419c('0x67')]=_0x5e343d[_0x419c('0x4')];ut[_0x419c('0x4b')](_0x419c('0x68'),'');ami[_0x419c('0x69')](ut['variablesAction'](_0x5e343d,_0x2da6f0))[_0x419c('0x49')](function(_0x2ffcf6){_0x279099(_0x2ffcf6);})[_0x419c('0x3e')](function(_0x5d4816){_0x362890(_0x5d4816);});})['catch'](function(_0x2f3b4d){_0x362890(_0x2f3b4d);});}else{ami[_0x419c('0x69')](ut[_0x419c('0x6a')](_0x5e343d,_0x2da6f0))['then'](function(_0x4b086b){_0x279099(_0x4b086b);})['catch'](function(_0x3c620e){_0x362890(_0x3c620e);});}});}Fax['prototype'][_0x419c('0x6b')]=function(_0x31630d,_0x58bb8c){var _0x18b5e8=this;return new BPromise(function(_0x3ca09d,_0x53286b){var _0x546b59=uuid['v4']();var _0x26a8ca=ut[_0x419c('0x6c')](_0x31630d,_0x58bb8c);_0x18b5e8[_0x419c('0xf')][_0x546b59]=new Action(_0x546b59,_0x58bb8c,_0x31630d);var _0x3442f0=_0x18b5e8['actions'][_0x546b59];if(path[_0x419c('0x39')](_0x31630d[_0x419c('0x4')])['ext']===_0x419c('0x3b')){originate(_0x3442f0,_0x26a8ca,!![])[_0x419c('0x49')](function(_0x5dcbb0){_0x3ca09d(_0x5dcbb0);})[_0x419c('0x3e')](function(_0xba1d7a){_0x53286b(_0xba1d7a);});}else{originate(_0x3442f0,_0x26a8ca,![])[_0x419c('0x49')](function(_0x3af800){_0x3ca09d(_0x3af800);})['catch'](function(_0x1dd7ec){_0x53286b(_0x1dd7ec);});}});};Fax[_0x419c('0x1e')][_0x419c('0x6d')]=function(_0x2e720d){return!_[_0x419c('0x6e')](_0x2e720d)&&!_[_0x419c('0x6e')](_0x2e720d['name'])&&!_['isNil'](_0x2e720d[_0x419c('0x6f')])&&_0x2e720d[_0x419c('0x6f')]&&!_['isNil'](this[_0x419c('0xe')][util[_0x419c('0x65')](_0x419c('0x70'),_0x2e720d[_0x419c('0x3a')])])&&!_['isNil'](this[_0x419c('0xe')][util[_0x419c('0x65')](_0x419c('0x70'),_0x2e720d[_0x419c('0x3a')])]['status'])&&(this[_0x419c('0xe')][util['format'](_0x419c('0x70'),_0x2e720d[_0x419c('0x3a')])][_0x419c('0x2e')]===_0x419c('0x71')||this['trunks'][util[_0x419c('0x65')](_0x419c('0x70'),_0x2e720d[_0x419c('0x3a')])]['status']===_0x419c('0x72'));};Fax[_0x419c('0x1e')][_0x419c('0x61')]=function(_0x5b42fe,_0x1c800d){if(!this[_0x419c('0x6d')](_0x5b42fe)){ut['logger'](_0x419c('0x73'),_[_0x419c('0x6e')](_0x5b42fe)?'':_0x5b42fe[_0x419c('0x3a')]+_0x419c('0x74'));return{'isValid':![],'message':_0x419c('0x75')};}if(_[_0x419c('0x6e')](_0x1c800d[_0x419c('0x7')])){ut[_0x419c('0x4b')](_0x419c('0x76'),JSON[_0x419c('0x42')](_0x1c800d));return{'isValid':![],'message':_0x419c('0x77')};}if(_[_0x419c('0x6e')](_0x1c800d[_0x419c('0x4')])){ut[_0x419c('0x4b')](_0x419c('0x78'),JSON[_0x419c('0x42')](_0x1c800d));return{'isValid':![],'message':_0x419c('0x79')};}return{'isValid':!![],'message':'Is\x20Valid'};};Fax[_0x419c('0x1e')][_0x419c('0x53')]=function(_0xe04c08,_0x3f7a40=0x2710){if(this[_0x419c('0xc')][_0xe04c08]){setTimeout(()=>{delete this[_0x419c('0xc')][_0xe04c08];},_0x3f7a40);}};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index fec75a7..6c46cf7 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 _0x5f53=['notify','resolve','catch','util','../../../config/logger','../rpc/faxAccount','error'];(function(_0x2d7886,_0xeb9063){var _0x8e97d7=function(_0x258d5e){while(--_0x258d5e){_0x2d7886['push'](_0x2d7886['shift']());}};_0x8e97d7(++_0xeb9063);}(_0x5f53,0x81));var _0x35f5=function(_0x222214,_0x5c3279){_0x222214=_0x222214-0x0;var _0x303520=_0x5f53[_0x222214];return _0x303520;};'use strict';var util=require(_0x35f5('0x0'));var BPromise=require('bluebird');var logger=require(_0x35f5('0x1'))('preview');var _=require('lodash');var faxAccount=require(_0x35f5('0x2'));function loggerCatch(_0x25c0d0){return function(_0x1beea6){logger[_0x35f5('0x3')](_0x25c0d0,util['inspect'](_0x1beea6,{'showHidden':![],'depth':null}));};}exports[_0x35f5('0x4')]=function(_0x18a421,_0x452cd0){return BPromise[_0x35f5('0x5')]()['then'](faxAccount[_0x35f5('0x4')](_0x18a421,_0x452cd0))[_0x35f5('0x6')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x946d=['lodash','../rpc/faxAccount','error','notify','resolve','then','catch','util','../../../config/logger'];(function(_0x1fdb63,_0x38efab){var _0xd842c9=function(_0x5be500){while(--_0x5be500){_0x1fdb63['push'](_0x1fdb63['shift']());}};_0xd842c9(++_0x38efab);}(_0x946d,0x166));var _0xd946=function(_0x43ec1c,_0x8c42ba){_0x43ec1c=_0x43ec1c-0x0;var _0xcb0afb=_0x946d[_0x43ec1c];return _0xcb0afb;};'use strict';var util=require(_0xd946('0x0'));var BPromise=require('bluebird');var logger=require(_0xd946('0x1'))('preview');var _=require(_0xd946('0x2'));var faxAccount=require(_0xd946('0x3'));function loggerCatch(_0x15da48){return function(_0x30eef7){logger[_0xd946('0x4')](_0x15da48,util['inspect'](_0x30eef7,{'showHidden':![],'depth':null}));};}exports[_0xd946('0x5')]=function(_0x112038,_0x415fd0){return BPromise[_0xd946('0x6')]()[_0xd946('0x7')](faxAccount[_0xd946('0x5')](_0x112038,_0x415fd0))[_0xd946('0x8')](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 721ed78..d2a33f6 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 _0x9ea0=['fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x5527eb,_0x1e73d7){var _0xd9fe89=function(_0x56ee1a){while(--_0x56ee1a){_0x5527eb['push'](_0x5527eb['shift']());}};_0xd9fe89(++_0x1e73d7);}(_0x9ea0,0xae));var _0x09ea=function(_0x44c844,_0x1e3d7d){_0x44c844=_0x44c844-0x0;var _0x1d51b7=_0x9ea0[_0x44c844];return _0x1d51b7;};'use strict';var util=require(_0x09ea('0x0'));var logger=require(_0x09ea('0x1'))(_0x09ea('0x2'));var BPromise=require(_0x09ea('0x3'));var exec=require(_0x09ea('0x4'))[_0x09ea('0x5')];exports[_0x09ea('0x6')]=function(_0x32d6f6){return new BPromise(function(_0x29d7c9,_0x4c2f67){exec(_0x32d6f6,function(_0x122019,_0x4a72f4,_0x2e6a67){logger[_0x09ea('0x7')](_0x09ea('0x8'),_0x4a72f4);if(_0x122019){logger[_0x09ea('0x7')]('Exec\x20gs',_0x09ea('0x9'),util[_0x09ea('0xa')](_0x122019,{'showHidden':![],'depth':null}),_0x4a72f4,_0x2e6a67);_0x4c2f67(_0x122019);}_0x29d7c9(_0x4a72f4);});});}; \ No newline at end of file +var _0x3607=['inspect','util','fax','bluebird','child_process','exec','info','Exec\x20gs','\x20Error\x20:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3607,0x172));var _0x7360=function(_0x17337d,_0xb44970){_0x17337d=_0x17337d-0x0;var _0x365362=_0x3607[_0x17337d];return _0x365362;};'use strict';var util=require(_0x7360('0x0'));var logger=require('../../../../config/logger')(_0x7360('0x1'));var BPromise=require(_0x7360('0x2'));var exec=require(_0x7360('0x3'))[_0x7360('0x4')];exports['execute']=function(_0x1074a9){return new BPromise(function(_0x4c95d1,_0x2886a9){exec(_0x1074a9,function(_0x21fb0a,_0x4f4e79,_0x332d80){logger[_0x7360('0x5')](_0x7360('0x6'),_0x4f4e79);if(_0x21fb0a){logger[_0x7360('0x5')](_0x7360('0x6'),_0x7360('0x7'),util[_0x7360('0x8')](_0x21fb0a,{'showHidden':![],'depth':null}),_0x4f4e79,_0x332d80);_0x2886a9(_0x21fb0a);}_0x4c95d1(_0x4f4e79);});});}; \ 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 94fc536..f38a529 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 _0xb9d7=['t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid','util','lodash','moment','../../../../config/logger','fax','logger','info','addVariables','ecm','minrate','maxrate','format','\x22%s\x22','modem','gateway'];(function(_0x3a2797,_0x1f905c){var _0x5c2d96=function(_0x3c7bd7){while(--_0x3c7bd7){_0x3a2797['push'](_0x3a2797['shift']());}};_0x5c2d96(++_0x1f905c);}(_0xb9d7,0xf5));var _0x7b9d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb9d7[_0x21a9d9];return _0x46adce;};'use strict';var util=require(_0x7b9d('0x0'));var _=require(_0x7b9d('0x1'));var moment=require(_0x7b9d('0x2'));var logger=require(_0x7b9d('0x3'))(_0x7b9d('0x4'));exports['message']=function(_0x2c20be){return{'message':_0x2c20be};};exports[_0x7b9d('0x5')]=function(_0x468bf6,_0x36713e){logger[_0x7b9d('0x6')](_0x468bf6,util['inspect'](_0x36713e,{'showHidden':![],'depth':null}));};exports[_0x7b9d('0x7')]=function(_0x45116d,_0x8d9d01){var _0x3da36d={'XMF-ECM':_0x8d9d01[_0x7b9d('0x8')],'XMF-HEADERINFO':_0x8d9d01['headerinfo'],'XMF-MINRATE':_0x8d9d01[_0x7b9d('0x9')],'XMF-MAXRATE':_0x8d9d01[_0x7b9d('0xa')],'XMF-MODEM':util[_0x7b9d('0xb')](_0x7b9d('0xc'),_0x8d9d01[_0x7b9d('0xd')]),'XMF-GATEWAY':_0x8d9d01[_0x7b9d('0xe')],'XMF-FAXDETECT':_0x8d9d01['faxdetect'],'XMF-T38TIMEOUT':_0x8d9d01[_0x7b9d('0xf')],'XMF-LOCALSTATIONID':_0x8d9d01['localstationid'],'XMF-PATH':_0x45116d[_0x7b9d('0x10')]};return _0x3da36d;};exports[_0x7b9d('0x11')]=function(_0x439ad4,_0x831fa5){return{'actionid':_0x439ad4[_0x7b9d('0x12')],'action':_0x7b9d('0x13'),'channel':_0x439ad4[_0x7b9d('0x14')],'Exten':_0x7b9d('0x15'),'Context':_0x7b9d('0x16'),'Priority':'1','callerid':util[_0x7b9d('0xb')](_0x7b9d('0x17'),_0x439ad4[_0x7b9d('0x18')]?_0x439ad4[_0x7b9d('0x18')]:'',_0x439ad4[_0x7b9d('0x19')]),'variable':_0x831fa5,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x439ad4[_0x7b9d('0x12')]};}; \ No newline at end of file +var _0xfffd=['ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','format','localstationid','util','../../../../config/logger','fax','message','info'];(function(_0x40042a,_0x3efa20){var _0x3af43b=function(_0x4deacd){while(--_0x4deacd){_0x40042a['push'](_0x40042a['shift']());}};_0x3af43b(++_0x3efa20);}(_0xfffd,0xe2));var _0xdfff=function(_0x49905b,_0x5aa72f){_0x49905b=_0x49905b-0x0;var _0x1543bf=_0xfffd[_0x49905b];return _0x1543bf;};'use strict';var util=require(_0xdfff('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0xdfff('0x1'))(_0xdfff('0x2'));exports[_0xdfff('0x3')]=function(_0x57eea7){return{'message':_0x57eea7};};exports['logger']=function(_0x14d08e,_0x37823d){logger[_0xdfff('0x4')](_0x14d08e,util['inspect'](_0x37823d,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x17f484,_0x23342f){var _0x448a7d={'XMF-ECM':_0x23342f[_0xdfff('0x5')],'XMF-HEADERINFO':_0x23342f[_0xdfff('0x6')],'XMF-MINRATE':_0x23342f[_0xdfff('0x7')],'XMF-MAXRATE':_0x23342f[_0xdfff('0x8')],'XMF-MODEM':util['format'](_0xdfff('0x9'),_0x23342f[_0xdfff('0xa')]),'XMF-GATEWAY':_0x23342f[_0xdfff('0xb')],'XMF-FAXDETECT':_0x23342f[_0xdfff('0xc')],'XMF-T38TIMEOUT':_0x23342f['t38timeout'],'XMF-LOCALSTATIONID':_0x23342f['localstationid'],'XMF-PATH':_0x17f484[_0xdfff('0xd')]};return _0x448a7d;};exports[_0xdfff('0xe')]=function(_0x186579,_0x29d83e){return{'actionid':_0x186579[_0xdfff('0xf')],'action':_0xdfff('0x10'),'channel':_0x186579[_0xdfff('0x11')],'Exten':_0xdfff('0x12'),'Context':'from-sip','Priority':'1','callerid':util[_0xdfff('0x13')]('\x22%s\x22\x20<%s>',_0x186579[_0xdfff('0x6')]?_0x186579[_0xdfff('0x6')]:'',_0x186579[_0xdfff('0x14')]),'variable':_0x29d83e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x186579[_0xdfff('0xf')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 3a7a7fa..d337d05 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 _0xd29f=['./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','inspect','listen','sync','catch','[index.js][main]','moment','./server','./trigger','./dialer','./preview','./fax'];(function(_0x381aba,_0x308216){var _0x3f0abd=function(_0xb20b85){while(--_0xb20b85){_0x381aba['push'](_0x381aba['shift']());}};_0x3f0abd(++_0x308216);}(_0xd29f,0x1f2));var _0xfd29=function(_0x216494,_0x21a0b4){_0x216494=_0x216494-0x0;var _0x3fce22=_0xd29f[_0x216494];return _0x3fce22;};'use strict';var util=require('util');var moment=require(_0xfd29('0x0'));var server=require(_0xfd29('0x1'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0xfd29('0x2'));var Dialer=require(_0xfd29('0x3'));var Preview=require(_0xfd29('0x4'));var Fax=require(_0xfd29('0x5'));var user=require('./rpc/user');var voiceQueue=require(_0xfd29('0x6'));var voiceQueueReport=require(_0xfd29('0x7'));var voiceCallReport=require(_0xfd29('0x8'));var trunk=require('./rpc/trunk');var trigger=require(_0xfd29('0x9'));var template=require(_0xfd29('0xa'));var cmHopperHistory=require(_0xfd29('0xb'));var campaign=require(_0xfd29('0xc'));var voiceExtension=require(_0xfd29('0xd'));var faxAccount=require(_0xfd29('0xe'));var zendesk=require(_0xfd29('0xf'));var salesforce=require(_0xfd29('0x10'));var sugarcrm=require(_0xfd29('0x11'));var freshdesk=require(_0xfd29('0x12'));var desk=require(_0xfd29('0x13'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xfd29('0x14'));var freshsales=require(_0xfd29('0x15'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xfd29('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0xfd29('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xfd29('0x18')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xfd29('0x18')](_0xfd29('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xfd29('0x1a')]()['then'](user['getAgents']())[_0xfd29('0x1b')](realtime['initAgents']())[_0xfd29('0x1b')](user[_0xfd29('0x1c')]())[_0xfd29('0x1b')](realtime[_0xfd29('0x1d')]())[_0xfd29('0x1b')](trunk[_0xfd29('0x1e')]())['then'](realtime[_0xfd29('0x1f')]())[_0xfd29('0x1b')](voiceQueue[_0xfd29('0x20')]())[_0xfd29('0x1b')](realtime[_0xfd29('0x21')]())['then'](trigger['getTriggers']())[_0xfd29('0x1b')](realtime[_0xfd29('0x22')]())[_0xfd29('0x1b')](template[_0xfd29('0x23')]())['then'](realtime[_0xfd29('0x24')]())[_0xfd29('0x1b')](zendesk[_0xfd29('0x25')]())[_0xfd29('0x1b')](realtime[_0xfd29('0x26')]())[_0xfd29('0x1b')](salesforce[_0xfd29('0x27')]())['then'](realtime[_0xfd29('0x28')]())[_0xfd29('0x1b')](sugarcrm[_0xfd29('0x29')]())[_0xfd29('0x1b')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0xfd29('0x2a')]())[_0xfd29('0x1b')](realtime[_0xfd29('0x2b')]())[_0xfd29('0x1b')](desk[_0xfd29('0x2c')]())[_0xfd29('0x1b')](realtime[_0xfd29('0x2d')]())['then'](zoho[_0xfd29('0x2e')]())[_0xfd29('0x1b')](realtime[_0xfd29('0x2f')]())[_0xfd29('0x1b')](vtiger[_0xfd29('0x30')]())[_0xfd29('0x1b')](realtime[_0xfd29('0x31')]())[_0xfd29('0x1b')](freshsales[_0xfd29('0x32')]())[_0xfd29('0x1b')](realtime[_0xfd29('0x33')]())[_0xfd29('0x1b')](servicenow[_0xfd29('0x34')]())['then'](realtime[_0xfd29('0x35')]())[_0xfd29('0x1b')](dynamics365[_0xfd29('0x36')]())[_0xfd29('0x1b')](realtime[_0xfd29('0x37')]())[_0xfd29('0x1b')](campaign[_0xfd29('0x38')]())['then'](realtime['initCampaigns']())[_0xfd29('0x1b')](voiceExtension[_0xfd29('0x39')]())['then'](realtime[_0xfd29('0x3a')]())[_0xfd29('0x1b')](faxAccount['getFaxAccounts']())[_0xfd29('0x1b')](realtime[_0xfd29('0x3b')]())[_0xfd29('0x1b')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0xfd29('0x1b')](voiceQueueReport['getVoiceQueueReports']())[_0xfd29('0x1b')](realtime[_0xfd29('0x3c')]())[_0xfd29('0x1b')](cmHopperHistory[_0xfd29('0x3d')]())[_0xfd29('0x1b')](realtime[_0xfd29('0x3e')]())[_0xfd29('0x1b')](cmHopperHistory['getCampaignHopperHistory']())[_0xfd29('0x1b')](realtime[_0xfd29('0x3f')]())[_0xfd29('0x1b')](voiceCallReport[_0xfd29('0x40')]())[_0xfd29('0x1b')](realtime[_0xfd29('0x41')]())['catch'](function(_0x3c9856){logger[_0xfd29('0x42')]('[index.js][initParams]',util[_0xfd29('0x43')](_0x3c9856,{'showHidden':![],'depth':null}));});}function main(){return server[_0xfd29('0x44')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0xfd29('0x1b')](function(){return initParams();})[_0xfd29('0x1b')](function(){report[_0xfd29('0x45')]();setInterval(initRealtime,0x1388);})[_0xfd29('0x46')](function(_0x16e772){logger[_0xfd29('0x42')](_0xfd29('0x47'),util[_0xfd29('0x43')](_0x16e772,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xf6a2=['initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./realtime','./report','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','hour','get','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getDeskAccounts'];(function(_0x3c7899,_0x12decb){var _0x2dc8cf=function(_0x4ed765){while(--_0x4ed765){_0x3c7899['push'](_0x3c7899['shift']());}};_0x2dc8cf(++_0x12decb);}(_0xf6a2,0x1d0));var _0x2f6a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xf6a2[_0x50a0c2];return _0x5ebadd;};'use strict';var util=require(_0x2f6a('0x0'));var moment=require(_0x2f6a('0x1'));var server=require(_0x2f6a('0x2'));var Realtime=require(_0x2f6a('0x3'));var Report=require(_0x2f6a('0x4'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x2f6a('0x5'));var Preview=require(_0x2f6a('0x6'));var Fax=require(_0x2f6a('0x7'));var user=require(_0x2f6a('0x8'));var voiceQueue=require(_0x2f6a('0x9'));var voiceQueueReport=require(_0x2f6a('0xa'));var voiceCallReport=require(_0x2f6a('0xb'));var trunk=require(_0x2f6a('0xc'));var trigger=require('./rpc/trigger');var template=require(_0x2f6a('0xd'));var cmHopperHistory=require(_0x2f6a('0xe'));var campaign=require(_0x2f6a('0xf'));var voiceExtension=require(_0x2f6a('0x10'));var faxAccount=require(_0x2f6a('0x11'));var zendesk=require(_0x2f6a('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x2f6a('0x13'));var freshdesk=require(_0x2f6a('0x14'));var desk=require(_0x2f6a('0x15'));var zoho=require(_0x2f6a('0x16'));var vtiger=require(_0x2f6a('0x17'));var freshsales=require(_0x2f6a('0x18'));var servicenow=require(_0x2f6a('0x19'));var dynamics365=require(_0x2f6a('0x1a'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x2f6a('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2f6a('0x1c')](_0x2f6a('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x2f6a('0x1d')](user[_0x2f6a('0x1e')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x1f')]())['then'](user[_0x2f6a('0x20')]())['then'](realtime['initTelephones']())[_0x2f6a('0x1d')](trunk[_0x2f6a('0x21')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x22')]())[_0x2f6a('0x1d')](voiceQueue[_0x2f6a('0x23')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x24')]())['then'](trigger[_0x2f6a('0x25')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x26')]())[_0x2f6a('0x1d')](template['getTemplates']())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x27')]())['then'](zendesk[_0x2f6a('0x28')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x29')]())[_0x2f6a('0x1d')](salesforce[_0x2f6a('0x2a')]())['then'](realtime[_0x2f6a('0x2b')]())['then'](sugarcrm[_0x2f6a('0x2c')]())['then'](realtime[_0x2f6a('0x2d')]())['then'](freshdesk['getFreshdeskAccounts']())[_0x2f6a('0x1d')](realtime['initFreshdeskAccounts']())[_0x2f6a('0x1d')](desk[_0x2f6a('0x2e')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x2f')]())[_0x2f6a('0x1d')](zoho[_0x2f6a('0x30')]())[_0x2f6a('0x1d')](realtime['initZohoAccounts']())[_0x2f6a('0x1d')](vtiger[_0x2f6a('0x31')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x32')]())[_0x2f6a('0x1d')](freshsales[_0x2f6a('0x33')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x34')]())['then'](servicenow[_0x2f6a('0x35')]())['then'](realtime['initServicenowAccounts']())[_0x2f6a('0x1d')](dynamics365[_0x2f6a('0x36')]())[_0x2f6a('0x1d')](realtime['initDynamics365Accounts']())['then'](campaign['getCampaigns']())['then'](realtime[_0x2f6a('0x37')]())[_0x2f6a('0x1d')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x2f6a('0x38')]())[_0x2f6a('0x1d')](faxAccount[_0x2f6a('0x39')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x3a')]())[_0x2f6a('0x1d')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x2f6a('0x1d')](voiceQueueReport[_0x2f6a('0x3b')]())['then'](realtime[_0x2f6a('0x3c')]())['then'](cmHopperHistory[_0x2f6a('0x3d')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x3e')]())[_0x2f6a('0x1d')](cmHopperHistory[_0x2f6a('0x3f')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x40')]())['then'](voiceCallReport[_0x2f6a('0x41')]())[_0x2f6a('0x1d')](realtime[_0x2f6a('0x42')]())['catch'](function(_0x5b2089){logger[_0x2f6a('0x43')](_0x2f6a('0x44'),util[_0x2f6a('0x45')](_0x5b2089,{'showHidden':![],'depth':null}));});}function main(){return server[_0x2f6a('0x46')](realtime,preview,fax)[_0x2f6a('0x1d')](function(){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0x2f6a('0x47')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x241548){logger[_0x2f6a('0x43')](_0x2f6a('0x48'),util[_0x2f6a('0x45')](_0x241548,{'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 3b93219..f225183 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 _0x6f64=['mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format','address','voiceStatusQueue','interface','emit','omit','user:presence','exports','util','moment','md5','ioredis','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','phone'];(function(_0x3bbd1f,_0x119571){var _0x4cb1fe=function(_0x354967){while(--_0x354967){_0x3bbd1f['push'](_0x3bbd1f['shift']());}};_0x4cb1fe(++_0x119571);}(_0x6f64,0x1de));var _0x46f6=function(_0x2a43e5,_0x4ad894){_0x2a43e5=_0x2a43e5-0x0;var _0x28301d=_0x6f64[_0x2a43e5];return _0x28301d;};'use strict';var _=require('lodash');var util=require(_0x46f6('0x0'));var moment=require(_0x46f6('0x1'));var md5=require(_0x46f6('0x2'));var Redis=require(_0x46f6('0x3'));var config=require('../../../config/environment');config[_0x46f6('0x4')]=_[_0x46f6('0x5')](config[_0x46f6('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x46f6('0x6'))(new Redis(config[_0x46f6('0x4')]));function Agent(_0x527b04){this['id']=_0x527b04['id']||0x0;this['name']=_0x527b04[_0x46f6('0x7')]||'';this[_0x46f6('0x8')]=_0x527b04[_0x46f6('0x8')]||'';this[_0x46f6('0x9')]=_0x527b04[_0x46f6('0x9')]||'';this[_0x46f6('0xa')]=_0x527b04[_0x46f6('0xa')]||'';this[_0x46f6('0xb')]=_0x46f6('0xc');this[_0x46f6('0xd')]=0x0;this[_0x46f6('0xe')]=_0x46f6('0xc');this['address']='';this[_0x46f6('0xf')]='';this[_0x46f6('0x10')]='';this['interface']='';this['online']=_0x527b04[_0x46f6('0x11')]||![];this[_0x46f6('0x12')]=_0x46f6('0xc');this[_0x46f6('0x13')]=0x0;this[_0x46f6('0x14')]='';this['voiceStatusQueue']='';this[_0x46f6('0x15')]=![];this[_0x46f6('0x16')]=![];this[_0x46f6('0x2')]='';}Agent['prototype'][_0x46f6('0x17')]=function(_0x719bfe){var _0x6e1c7e;if(_0x719bfe&&_0x719bfe[_0x46f6('0xb')]){_0x6e1c7e=_0x719bfe['state'][_0x46f6('0x18')]();switch(_0x6e1c7e){case _0x46f6('0x19'):_0x6e1c7e=_0x46f6('0x1a');break;case _0x46f6('0x1b'):_0x6e1c7e='talking';break;}}if(_0x6e1c7e&&this[_0x46f6('0x12')]!==_0x6e1c7e||_0x719bfe[_0x46f6('0x1c')]){this[_0x46f6('0x13')]=_[_0x46f6('0x1d')](moment()[_0x46f6('0x1e')]('x'));}if(_0x6e1c7e){this[_0x46f6('0x12')]=_0x6e1c7e;}var _0x13197f={'id':this['id'],'name':this[_0x46f6('0x7')],'email':this[_0x46f6('0x8')],'accountcode':this[_0x46f6('0x9')],'fullname':this[_0x46f6('0xa')],'state':this[_0x46f6('0xb')],'stateTime':this[_0x46f6('0xd')],'status':this[_0x46f6('0xe')],'address':this[_0x46f6('0x1f')],'online':this[_0x46f6('0x11')],'voiceStatus':this[_0x46f6('0x12')],'voiceStatusTime':this[_0x46f6('0x13')],'voiceStatusCallerIdNumber':this[_0x46f6('0x14')],'voiceStatusQueue':this[_0x46f6('0x20')],'interface':this[_0x46f6('0x21')],'onhold':this[_0x46f6('0x15')]};var _0x29d392=md5(JSON['stringify'](_0x13197f));if(this[_0x46f6('0x2')]!==_0x29d392){this['md5']=_0x29d392;io['to'](util[_0x46f6('0x1e')]('user:%s',_0x13197f[_0x46f6('0x7')]))[_0x46f6('0x22')]('user:ami:update',_[_0x46f6('0x23')](_0x13197f,[_0x46f6('0x11')]));io[_0x46f6('0x22')](_0x46f6('0x24'),_0x13197f);}};module[_0x46f6('0x25')]=Agent; \ No newline at end of file +var _0xacf5=['lodash','util','moment','md5','ioredis','redis','name','email','accountcode','fullname','unknown','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusQueue','local','prototype','state','toLowerCase','idle','inuse','voiceStatus','toNumber','format','stateTime','status','onhold','stringify','user:%s','emit','user:ami:update','omit','user:presence','exports'];(function(_0x15c9f1,_0x20529f){var _0x468ea6=function(_0x292360){while(--_0x292360){_0x15c9f1['push'](_0x15c9f1['shift']());}};_0x468ea6(++_0x20529f);}(_0xacf5,0x128));var _0x5acf=function(_0x896ce,_0x288208){_0x896ce=_0x896ce-0x0;var _0x4fc85a=_0xacf5[_0x896ce];return _0x4fc85a;};'use strict';var _=require(_0x5acf('0x0'));var util=require(_0x5acf('0x1'));var moment=require(_0x5acf('0x2'));var md5=require(_0x5acf('0x3'));var Redis=require(_0x5acf('0x4'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x5acf('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x5ee488){this['id']=_0x5ee488['id']||0x0;this[_0x5acf('0x6')]=_0x5ee488[_0x5acf('0x6')]||'';this[_0x5acf('0x7')]=_0x5ee488[_0x5acf('0x7')]||'';this['accountcode']=_0x5ee488[_0x5acf('0x8')]||'';this[_0x5acf('0x9')]=_0x5ee488[_0x5acf('0x9')]||'';this['state']=_0x5acf('0xa');this['stateTime']=0x0;this['status']=_0x5acf('0xa');this[_0x5acf('0xb')]='';this[_0x5acf('0xc')]='';this[_0x5acf('0xd')]='';this[_0x5acf('0xe')]='';this[_0x5acf('0xf')]=_0x5ee488[_0x5acf('0xf')]||![];this['voiceStatus']='unknown';this[_0x5acf('0x10')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x5acf('0x11')]='';this['onhold']=![];this[_0x5acf('0x12')]=![];this[_0x5acf('0x3')]='';}Agent[_0x5acf('0x13')]['updateStatusRealtime']=function(_0x5dca90){var _0x498db9;if(_0x5dca90&&_0x5dca90[_0x5acf('0x14')]){_0x498db9=_0x5dca90['state'][_0x5acf('0x15')]();switch(_0x498db9){case'not_inuse':_0x498db9=_0x5acf('0x16');break;case _0x5acf('0x17'):_0x498db9='talking';break;}}if(_0x498db9&&this[_0x5acf('0x18')]!==_0x498db9||_0x5dca90['statePause']){this[_0x5acf('0x10')]=_[_0x5acf('0x19')](moment()[_0x5acf('0x1a')]('x'));}if(_0x498db9){this[_0x5acf('0x18')]=_0x498db9;}var _0x327ea3={'id':this['id'],'name':this[_0x5acf('0x6')],'email':this[_0x5acf('0x7')],'accountcode':this[_0x5acf('0x8')],'fullname':this[_0x5acf('0x9')],'state':this['state'],'stateTime':this[_0x5acf('0x1b')],'status':this[_0x5acf('0x1c')],'address':this[_0x5acf('0xb')],'online':this[_0x5acf('0xf')],'voiceStatus':this[_0x5acf('0x18')],'voiceStatusTime':this[_0x5acf('0x10')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x5acf('0xe')],'onhold':this[_0x5acf('0x1d')]};var _0x2071b2=md5(JSON[_0x5acf('0x1e')](_0x327ea3));if(this[_0x5acf('0x3')]!==_0x2071b2){this[_0x5acf('0x3')]=_0x2071b2;io['to'](util['format'](_0x5acf('0x1f'),_0x327ea3[_0x5acf('0x6')]))[_0x5acf('0x20')](_0x5acf('0x21'),_[_0x5acf('0x22')](_0x327ea3,[_0x5acf('0xf')]));io[_0x5acf('0x20')](_0x5acf('0x23'),_0x327ea3);}};module[_0x5acf('0x24')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 68bf3dd..3015483 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 _0x26d9=['SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','temp','ivrTotalCallsDays','message','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'];(function(_0x2de8a7,_0x54360b){var _0x23ed5e=function(_0x23b0cc){while(--_0x23b0cc){_0x2de8a7['push'](_0x2de8a7['shift']());}};_0x23ed5e(++_0x54360b);}(_0x26d9,0x71));var _0x926d=function(_0x23698a,_0x4bb64f){_0x23698a=_0x23698a-0x0;var _0x16ffaa=_0x26d9[_0x23698a];return _0x16ffaa;};'use strict';function Campaign(_0x4c84c1){this['id']=_0x4c84c1['id']||0x0;this[_0x926d('0x0')]=_0x4c84c1[_0x926d('0x0')]||'';this[_0x926d('0x1')]=_0x4c84c1[_0x926d('0x1')]||'campaign';this['originated']=0x0;this[_0x926d('0x2')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x926d('0x3')]=0x0;this[_0x926d('0x4')]='';this['sendMessageOneNotActive']=!![];this[_0x926d('0x5')]=_0x4c84c1[_0x926d('0x5')];this[_0x926d('0x6')]=_0x4c84c1[_0x926d('0x6')];this[_0x926d('0x7')]=_0x4c84c1[_0x926d('0x7')]||null;this[_0x926d('0x8')]=_0x4c84c1[_0x926d('0x8')]?_0x4c84c1[_0x926d('0x8')]:null;this[_0x926d('0x9')]=_0x4c84c1[_0x926d('0x9')];this['dialOriginateCallerIdNumber']=_0x4c84c1[_0x926d('0xa')];this[_0x926d('0xb')]=_0x4c84c1[_0x926d('0xb')]||0x1e;this[_0x926d('0xc')]=_0x4c84c1[_0x926d('0xc')];this[_0x926d('0xd')]=_0x4c84c1[_0x926d('0xd')];this[_0x926d('0xe')]=_0x4c84c1[_0x926d('0xe')];this[_0x926d('0xf')]=_0x4c84c1['dialBusyRetryFrequency'];this[_0x926d('0x10')]=_0x4c84c1['dialNoAnswerMaxRetry'];this[_0x926d('0x11')]=_0x4c84c1[_0x926d('0x11')];this[_0x926d('0x12')]=_0x4c84c1[_0x926d('0x12')];this[_0x926d('0x13')]=_0x4c84c1[_0x926d('0x13')]||0x3;this[_0x926d('0x14')]=_0x4c84c1[_0x926d('0x14')]||0x96;this[_0x926d('0x15')]=_0x4c84c1[_0x926d('0x15')]||0x3;this[_0x926d('0x16')]=_0x4c84c1[_0x926d('0x16')]||0x96;this[_0x926d('0x17')]=_0x4c84c1[_0x926d('0x17')]||0x3;this[_0x926d('0x18')]=_0x4c84c1[_0x926d('0x18')]||0x96;this[_0x926d('0x19')]=_0x4c84c1[_0x926d('0x19')]||0x3;this[_0x926d('0x1a')]=_0x4c84c1[_0x926d('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x4c84c1[_0x926d('0x1b')]||0x3;this[_0x926d('0x1c')]=_0x4c84c1[_0x926d('0x1c')]||0x96;this[_0x926d('0x1d')]=_0x4c84c1[_0x926d('0x1d')]||_0x926d('0x1e');this['dialPrefix']=_0x4c84c1[_0x926d('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x4c84c1[_0x926d('0x20')]||undefined;this[_0x926d('0x21')]=_0x4c84c1[_0x926d('0x21')]||undefined;this['TrunkBackup']=_0x4c84c1[_0x926d('0x22')]?_0x4c84c1[_0x926d('0x22')]:undefined;this['Trunk']=_0x4c84c1['Trunk']?_0x4c84c1[_0x926d('0x23')]:undefined;this[_0x926d('0x24')]=_0x4c84c1['Interval']?_0x4c84c1[_0x926d('0x24')]:undefined;this[_0x926d('0x25')]=_0x4c84c1[_0x926d('0x25')]?_0x4c84c1[_0x926d('0x25')]:undefined;this[_0x926d('0x26')]=_0x4c84c1[_0x926d('0x25')]?_0x4c84c1[_0x926d('0x25')][_0x926d('0x0')]:undefined;this[_0x926d('0x27')]=_0x4c84c1[_0x926d('0x27')]||![];this[_0x926d('0x28')]=_0x4c84c1[_0x926d('0x28')];this[_0x926d('0x29')]=_0x4c84c1[_0x926d('0x29')];this[_0x926d('0x2a')]=_0x4c84c1[_0x926d('0x2a')];this[_0x926d('0x2b')]=_0x4c84c1[_0x926d('0x2b')];this[_0x926d('0x2c')]=_0x4c84c1[_0x926d('0x2c')];this['dialAMDBetweenWordsSilence']=_0x4c84c1[_0x926d('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x4c84c1[_0x926d('0x2e')];this[_0x926d('0x2f')]=_0x4c84c1[_0x926d('0x2f')];this[_0x926d('0x30')]=_0x4c84c1[_0x926d('0x30')];}module[_0x926d('0x31')]=Campaign; \ No newline at end of file +var _0x0152=['dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x552fc5,_0x54972e){var _0x3ae584=function(_0x4fa784){while(--_0x4fa784){_0x552fc5['push'](_0x552fc5['shift']());}};_0x3ae584(++_0x54972e);}(_0x0152,0x1c3));var _0x2015=function(_0x5af45f,_0x30be2f){_0x5af45f=_0x5af45f-0x0;var _0x1bab77=_0x0152[_0x5af45f];return _0x1bab77;};'use strict';function Campaign(_0x4bff92){this['id']=_0x4bff92['id']||0x0;this[_0x2015('0x0')]=_0x4bff92[_0x2015('0x0')]||'';this[_0x2015('0x1')]=_0x4bff92[_0x2015('0x1')]||_0x2015('0x2');this[_0x2015('0x3')]=0x0;this['temp']=0x0;this[_0x2015('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x2015('0x5')]='';this[_0x2015('0x6')]=!![];this[_0x2015('0x7')]=_0x4bff92[_0x2015('0x7')];this[_0x2015('0x8')]=_0x4bff92['limitCalls'];this[_0x2015('0x9')]=_0x4bff92['dialTimezone']||null;this[_0x2015('0xa')]=_0x4bff92[_0x2015('0xa')]?_0x4bff92[_0x2015('0xa')]:null;this[_0x2015('0xb')]=_0x4bff92[_0x2015('0xb')];this[_0x2015('0xc')]=_0x4bff92[_0x2015('0xc')];this[_0x2015('0xd')]=_0x4bff92[_0x2015('0xd')]||0x1e;this[_0x2015('0xe')]=_0x4bff92[_0x2015('0xe')];this[_0x2015('0xf')]=_0x4bff92['dialCongestionRetryFrequency'];this[_0x2015('0x10')]=_0x4bff92[_0x2015('0x10')];this['dialBusyRetryFrequency']=_0x4bff92['dialBusyRetryFrequency'];this[_0x2015('0x11')]=_0x4bff92[_0x2015('0x11')];this['dialNoAnswerRetryFrequency']=_0x4bff92[_0x2015('0x12')];this[_0x2015('0x13')]=_0x4bff92[_0x2015('0x13')];this[_0x2015('0x14')]=_0x4bff92[_0x2015('0x14')]||0x3;this[_0x2015('0x15')]=_0x4bff92['dialNoSuchNumberRetryFrequency']||0x96;this[_0x2015('0x16')]=_0x4bff92['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x4bff92[_0x2015('0x17')]||0x96;this[_0x2015('0x18')]=_0x4bff92[_0x2015('0x18')]||0x3;this[_0x2015('0x19')]=_0x4bff92['dialAbandonedRetryFrequency']||0x96;this[_0x2015('0x1a')]=_0x4bff92[_0x2015('0x1a')]||0x3;this[_0x2015('0x1b')]=_0x4bff92[_0x2015('0x1b')]||0x96;this[_0x2015('0x1c')]=_0x4bff92[_0x2015('0x1c')]||0x3;this[_0x2015('0x1d')]=_0x4bff92[_0x2015('0x1d')]||0x96;this[_0x2015('0x1e')]=_0x4bff92[_0x2015('0x1e')]||_0x2015('0x1f');this['dialPrefix']=_0x4bff92[_0x2015('0x20')]||undefined;this[_0x2015('0x21')]=_0x4bff92[_0x2015('0x21')]||undefined;this[_0x2015('0x22')]=_0x4bff92[_0x2015('0x22')]||undefined;this['TrunkBackup']=_0x4bff92[_0x2015('0x23')]?_0x4bff92[_0x2015('0x23')]:undefined;this['Trunk']=_0x4bff92[_0x2015('0x24')]?_0x4bff92['Trunk']:undefined;this[_0x2015('0x25')]=_0x4bff92['Interval']?_0x4bff92[_0x2015('0x25')]:undefined;this[_0x2015('0x26')]=_0x4bff92[_0x2015('0x26')]?_0x4bff92[_0x2015('0x26')]:undefined;this[_0x2015('0x27')]=_0x4bff92[_0x2015('0x26')]?_0x4bff92[_0x2015('0x26')]['name']:undefined;this['dialAMDActive']=_0x4bff92[_0x2015('0x28')]||![];this[_0x2015('0x29')]=_0x4bff92['dialAMDInitialSilence'];this[_0x2015('0x2a')]=_0x4bff92[_0x2015('0x2a')];this[_0x2015('0x2b')]=_0x4bff92[_0x2015('0x2b')];this['dialAMDTotalAnalysisTime']=_0x4bff92[_0x2015('0x2c')];this['dialAMDMinWordLength']=_0x4bff92[_0x2015('0x2d')];this[_0x2015('0x2e')]=_0x4bff92[_0x2015('0x2e')];this[_0x2015('0x2f')]=_0x4bff92[_0x2015('0x2f')];this[_0x2015('0x30')]=_0x4bff92[_0x2015('0x30')];this[_0x2015('0x31')]=_0x4bff92[_0x2015('0x31')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index b146158..8b29f6c 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 _0xe056=['duration','billableseconds','holdtime','tag','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime','destinationchannel','calleridnum','calleridname','connectedlinename','context','uniqueid','answertime','endtime','unmanaged','lastapplication','lastdata'];(function(_0x4b4fc2,_0x5e5c2f){var _0x5d7643=function(_0x4b1421){while(--_0x4b1421){_0x4b4fc2['push'](_0x4b4fc2['shift']());}};_0x5d7643(++_0x5e5c2f);}(_0xe056,0xdb));var _0x6e05=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xe056[_0x31cb5f];return _0x586042;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0x6e05('0x0')]='';this[_0x6e05('0x1')]=0x0;this[_0x6e05('0x2')]='';this['connectedlinenum']=undefined;this[_0x6e05('0x3')]=undefined;this['accountcode']=0x0;this[_0x6e05('0x4')]='';this[_0x6e05('0x5')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this['answered']=![];this[_0x6e05('0x6')]=null;this[_0x6e05('0x7')]=null;this[_0x6e05('0x8')]=![];this['abandoned']=![];this[_0x6e05('0x9')]='';this[_0x6e05('0xa')]='';this[_0x6e05('0xb')]=0x0;this[_0x6e05('0xc')]=0x0;this[_0x6e05('0xd')]=0x0;this['type']=null;this[_0x6e05('0xe')]=null;this[_0x6e05('0xf')]=null;this[_0x6e05('0x10')]=![];this[_0x6e05('0x11')]=null;this[_0x6e05('0x12')]=null;this[_0x6e05('0x13')]=[];this['transfercalleridnum']=undefined;this[_0x6e05('0x14')]=undefined;this[_0x6e05('0x15')]=undefined;this[_0x6e05('0x16')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x7d8a=['type','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','lastapplication','lastdata','duration','holdtime'];(function(_0x133a5f,_0x4d19a9){var _0x208c8d=function(_0x2c7538){while(--_0x2c7538){_0x133a5f['push'](_0x133a5f['shift']());}};_0x208c8d(++_0x4d19a9);}(_0x7d8a,0xbf));var _0xa7d8=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x7d8a[_0x1bc0ae];return _0x501104;};'use strict';function Channel(){this[_0xa7d8('0x0')]=null;this[_0xa7d8('0x1')]='';this[_0xa7d8('0x2')]='';this['calleridnum']=0x0;this[_0xa7d8('0x3')]='';this['connectedlinenum']=undefined;this[_0xa7d8('0x4')]=undefined;this[_0xa7d8('0x5')]=0x0;this[_0xa7d8('0x6')]='';this[_0xa7d8('0x7')]=0x0;this[_0xa7d8('0x8')]=0x0;this['exten']=0x0;this[_0xa7d8('0x9')]=![];this[_0xa7d8('0xa')]=null;this[_0xa7d8('0xb')]=null;this[_0xa7d8('0xc')]=![];this['abandoned']=![];this[_0xa7d8('0xd')]='';this[_0xa7d8('0xe')]='';this[_0xa7d8('0xf')]=0x0;this['billableseconds']=0x0;this[_0xa7d8('0x10')]=0x0;this[_0xa7d8('0x11')]=null;this[_0xa7d8('0x12')]=null;this['disposition']=null;this[_0xa7d8('0x13')]=![];this[_0xa7d8('0x14')]=null;this[_0xa7d8('0x15')]=null;this[_0xa7d8('0x16')]=[];this[_0xa7d8('0x17')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0xa7d8('0x18')]=0x0;}module[_0xa7d8('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 0c3ebd9..0488884 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 _0x2e08=['username','remoteUri','authType','password','consumerKey','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x4f3381,_0x16a6ee){var _0x35e396=function(_0x3b0cf1){while(--_0x3b0cf1){_0x4f3381['push'](_0x4f3381['shift']());}};_0x35e396(++_0x16a6ee);}(_0x2e08,0x1bb));var _0x82e0=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2e08[_0x40a045];return _0x1a687c;};'use strict';function DeskAccount(_0x116bb5){this['id']=_0x116bb5['id']||0x0;this['name']=_0x116bb5[_0x82e0('0x0')]||'';this['username']=_0x116bb5[_0x82e0('0x1')]||'';this[_0x82e0('0x2')]=_0x116bb5[_0x82e0('0x2')]||'';this[_0x82e0('0x3')]=_0x116bb5[_0x82e0('0x3')]||'';this['password']=_0x116bb5[_0x82e0('0x4')]||'';this[_0x82e0('0x5')]=_0x116bb5['consumerKey']||'';this['consumerSecret']=_0x116bb5['consumerSecret']||'';this[_0x82e0('0x6')]=_0x116bb5[_0x82e0('0x6')]||'';this[_0x82e0('0x7')]=_0x116bb5[_0x82e0('0x7')]||'';this[_0x82e0('0x8')]=_0x116bb5[_0x82e0('0x8')]||'';this[_0x82e0('0x9')]=_0x116bb5['serverUrl']||'';this[_0x82e0('0xa')]=_0x116bb5[_0x82e0('0xa')]||{};}module[_0x82e0('0xb')]=DeskAccount; \ No newline at end of file +var _0x1256=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType'];(function(_0x45b8b0,_0x1f875f){var _0x405624=function(_0x52d3ac){while(--_0x52d3ac){_0x45b8b0['push'](_0x45b8b0['shift']());}};_0x405624(++_0x1f875f);}(_0x1256,0xe0));var _0x6125=function(_0x851fae,_0x5efd08){_0x851fae=_0x851fae-0x0;var _0x12dcff=_0x1256[_0x851fae];return _0x12dcff;};'use strict';function DeskAccount(_0x2f455e){this['id']=_0x2f455e['id']||0x0;this[_0x6125('0x0')]=_0x2f455e['name']||'';this[_0x6125('0x1')]=_0x2f455e[_0x6125('0x1')]||'';this[_0x6125('0x2')]=_0x2f455e[_0x6125('0x2')]||'';this[_0x6125('0x3')]=_0x2f455e[_0x6125('0x3')]||'';this[_0x6125('0x4')]=_0x2f455e[_0x6125('0x4')]||'';this[_0x6125('0x5')]=_0x2f455e['consumerKey']||'';this[_0x6125('0x6')]=_0x2f455e[_0x6125('0x6')]||'';this[_0x6125('0x7')]=_0x2f455e[_0x6125('0x7')]||'';this[_0x6125('0x8')]=_0x2f455e[_0x6125('0x8')]||'';this[_0x6125('0x9')]=_0x2f455e[_0x6125('0x9')]||'';this['serverUrl']=_0x2f455e[_0x6125('0xa')]||'';this['Configurations']=_0x2f455e[_0x6125('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 8c0cd6b..c6741e8 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 _0xe3a7=['Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xe3a7,0xe7));var _0x7e3a=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xe3a7[_0x25bea7];return _0x175952;};'use strict';function Dynamics365Account(_0x4dccfd){this['id']=_0x4dccfd['id']||0x0;this[_0x7e3a('0x0')]=_0x4dccfd[_0x7e3a('0x0')]||'';this[_0x7e3a('0x1')]=_0x4dccfd['username']||'';this[_0x7e3a('0x2')]=_0x4dccfd[_0x7e3a('0x2')]||'';this['remoteUri']=_0x4dccfd[_0x7e3a('0x3')]||'';this[_0x7e3a('0x4')]=_0x4dccfd[_0x7e3a('0x4')]||'';this[_0x7e3a('0x5')]=_0x4dccfd[_0x7e3a('0x5')]||'';this[_0x7e3a('0x6')]=_0x4dccfd['clientSecret']||{};this[_0x7e3a('0x7')]=_0x4dccfd['serverUrl']||'';this[_0x7e3a('0x8')]=_0x4dccfd['modernAuthentication']||![];this[_0x7e3a('0x9')]=_0x4dccfd['Configurations']||{};this[_0x7e3a('0xa')]=_0x4dccfd[_0x7e3a('0xa')]||{};}module[_0x7e3a('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x820e=['modernAuthentication','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0xa8fb74,_0x34ffca){var _0x2c68ab=function(_0x3b06d7){while(--_0x3b06d7){_0xa8fb74['push'](_0xa8fb74['shift']());}};_0x2c68ab(++_0x34ffca);}(_0x820e,0x18f));var _0xe820=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x820e[_0x432682];return _0x463d05;};'use strict';function Dynamics365Account(_0x556431){this['id']=_0x556431['id']||0x0;this[_0xe820('0x0')]=_0x556431[_0xe820('0x0')]||'';this[_0xe820('0x1')]=_0x556431[_0xe820('0x1')]||'';this[_0xe820('0x2')]=_0x556431[_0xe820('0x2')]||'';this[_0xe820('0x3')]=_0x556431[_0xe820('0x3')]||'';this['tenantId']=_0x556431[_0xe820('0x4')]||'';this[_0xe820('0x5')]=_0x556431['clientId']||'';this[_0xe820('0x6')]=_0x556431['clientSecret']||{};this[_0xe820('0x7')]=_0x556431[_0xe820('0x7')]||'';this[_0xe820('0x8')]=_0x556431[_0xe820('0x8')]||![];this[_0xe820('0x9')]=_0x556431[_0xe820('0x9')]||{};this['CloudProvider']=_0x556431['CloudProvider']||{};}module[_0xe820('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 43d7430..9c9aad5 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 _0x37f9=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','faxdetect','t38timeout','SIP','Trunk','ListId','key','exports','name'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x37f9,0x1af));var _0x937f=function(_0x2b4500,_0xbd860b){_0x2b4500=_0x2b4500-0x0;var _0x591927=_0x37f9[_0x2b4500];return _0x591927;};'use strict';function FaxAccount(_0x27fab1){this['id']=_0x27fab1['id']||0x0;this['name']=_0x27fab1[_0x937f('0x0')]||'';this[_0x937f('0x1')]=_0x27fab1[_0x937f('0x1')];this['ecm']=_0x27fab1[_0x937f('0x2')];this[_0x937f('0x3')]=_0x27fab1['headerinfo'];this[_0x937f('0x4')]=_0x27fab1[_0x937f('0x4')];this[_0x937f('0x5')]=_0x27fab1['minrate']||0x960;this['maxrate']=_0x27fab1[_0x937f('0x6')]||0x3840;this[_0x937f('0x7')]=_0x27fab1[_0x937f('0x7')]||_0x937f('0x8');this['gateway']=_0x27fab1['gateway']||'no';this[_0x937f('0x9')]=_0x27fab1[_0x937f('0x9')]||'no';this['t38timeout']=_0x27fab1[_0x937f('0xa')]||0x1388;this['tech']=_0x27fab1['tech']||_0x937f('0xb');this[_0x937f('0xc')]=_0x27fab1[_0x937f('0xc')]?_0x27fab1[_0x937f('0xc')]:undefined;this[_0x937f('0xd')]=_0x27fab1[_0x937f('0xd')];this[_0x937f('0xe')]=_0x27fab1[_0x937f('0xe')];}module[_0x937f('0xf')]=FaxAccount; \ No newline at end of file +var _0xdf49=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','name','ecm'];(function(_0x4a220b,_0x509237){var _0x59c102=function(_0x30c569){while(--_0x30c569){_0x4a220b['push'](_0x4a220b['shift']());}};_0x59c102(++_0x509237);}(_0xdf49,0x157));var _0x9df4=function(_0x59b533,_0x59fdcc){_0x59b533=_0x59b533-0x0;var _0x2beced=_0xdf49[_0x59b533];return _0x2beced;};'use strict';function FaxAccount(_0x17f781){this['id']=_0x17f781['id']||0x0;this['name']=_0x17f781[_0x9df4('0x0')]||'';this['description']=_0x17f781['description'];this[_0x9df4('0x1')]=_0x17f781[_0x9df4('0x1')];this['headerinfo']=_0x17f781[_0x9df4('0x2')];this[_0x9df4('0x3')]=_0x17f781[_0x9df4('0x3')];this[_0x9df4('0x4')]=_0x17f781[_0x9df4('0x4')]||0x960;this[_0x9df4('0x5')]=_0x17f781[_0x9df4('0x5')]||0x3840;this[_0x9df4('0x6')]=_0x17f781['modem']||_0x9df4('0x7');this[_0x9df4('0x8')]=_0x17f781[_0x9df4('0x8')]||'no';this[_0x9df4('0x9')]=_0x17f781[_0x9df4('0x9')]||'no';this[_0x9df4('0xa')]=_0x17f781[_0x9df4('0xa')]||0x1388;this['tech']=_0x17f781[_0x9df4('0xb')]||'SIP';this['Trunk']=_0x17f781[_0x9df4('0xc')]?_0x17f781[_0x9df4('0xc')]:undefined;this[_0x9df4('0xd')]=_0x17f781[_0x9df4('0xd')];this[_0x9df4('0xe')]=_0x17f781[_0x9df4('0xe')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 3d4845f..003a264 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 _0x65a9=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x65a9,0xfe));var _0x965a=function(_0x1cc30e,_0xb32302){_0x1cc30e=_0x1cc30e-0x0;var _0x38ef7c=_0x65a9[_0x1cc30e];return _0x38ef7c;};'use strict';function FreshdeskAccount(_0x200113){this['id']=_0x200113['id']||0x0;this[_0x965a('0x0')]=_0x200113[_0x965a('0x0')]||'';this[_0x965a('0x1')]=_0x200113[_0x965a('0x1')]||'';this[_0x965a('0x2')]=_0x200113[_0x965a('0x3')]||'';this[_0x965a('0x4')]=_0x200113['remoteUri']||'';this[_0x965a('0x5')]=_0x200113[_0x965a('0x5')]||'';this['Configurations']=_0x200113[_0x965a('0x6')]||{};}module[_0x965a('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xf81a=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0xf81a,0x178));var _0xaf81=function(_0x4dc591,_0x1b3156){_0x4dc591=_0x4dc591-0x0;var _0x1db009=_0xf81a[_0x4dc591];return _0x1db009;};'use strict';function FreshdeskAccount(_0x3e272b){this['id']=_0x3e272b['id']||0x0;this[_0xaf81('0x0')]=_0x3e272b[_0xaf81('0x0')]||'';this['username']=_0x3e272b[_0xaf81('0x1')]||'';this[_0xaf81('0x2')]=_0x3e272b[_0xaf81('0x3')]||'';this['remoteUri']=_0x3e272b[_0xaf81('0x4')]||'';this['serverUrl']=_0x3e272b[_0xaf81('0x5')]||'';this['Configurations']=_0x3e272b[_0xaf81('0x6')]||{};}module[_0xaf81('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 31005c1..2f86b55 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 _0x806b=['apiKey','token','remoteUri','serverUrl','Configurations','name','username'];(function(_0x5bb1e9,_0x15f025){var _0x262c24=function(_0x553d41){while(--_0x553d41){_0x5bb1e9['push'](_0x5bb1e9['shift']());}};_0x262c24(++_0x15f025);}(_0x806b,0x163));var _0xb806=function(_0x45384e,_0xee2549){_0x45384e=_0x45384e-0x0;var _0x4fa3fb=_0x806b[_0x45384e];return _0x4fa3fb;};'use strict';function FreshsalesAccount(_0x5bbdc6){this['id']=_0x5bbdc6['id']||0x0;this[_0xb806('0x0')]=_0x5bbdc6[_0xb806('0x0')]||'';this[_0xb806('0x1')]=_0x5bbdc6[_0xb806('0x1')]||'';this[_0xb806('0x2')]=_0x5bbdc6[_0xb806('0x3')]||'';this[_0xb806('0x4')]=_0x5bbdc6['remoteUri']||'';this[_0xb806('0x5')]=_0x5bbdc6[_0xb806('0x5')]||'';this[_0xb806('0x6')]=_0x5bbdc6[_0xb806('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xdb70=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x447b32,_0x51b42b){var _0x22dfc8=function(_0x49ad87){while(--_0x49ad87){_0x447b32['push'](_0x447b32['shift']());}};_0x22dfc8(++_0x51b42b);}(_0xdb70,0xa0));var _0x0db7=function(_0x5938ab,_0x45cae1){_0x5938ab=_0x5938ab-0x0;var _0x17bd46=_0xdb70[_0x5938ab];return _0x17bd46;};'use strict';function FreshsalesAccount(_0x1c9665){this['id']=_0x1c9665['id']||0x0;this[_0x0db7('0x0')]=_0x1c9665[_0x0db7('0x0')]||'';this['username']=_0x1c9665[_0x0db7('0x1')]||'';this[_0x0db7('0x2')]=_0x1c9665[_0x0db7('0x3')]||'';this[_0x0db7('0x4')]=_0x1c9665[_0x0db7('0x4')]||'';this[_0x0db7('0x5')]=_0x1c9665[_0x0db7('0x5')]||'';this[_0x0db7('0x6')]=_0x1c9665[_0x0db7('0x6')]||{};}module[_0x0db7('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 7568ad6..d8fc5cf 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 _0xf015=['mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','connectedlinenum','connectedlinename','accountcode','context','priority','lastAssignedTo','motionChannel','voice'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xf015,0x122));var _0x5f01=function(_0x150024,_0x10451c){_0x150024=_0x150024-0x0;var _0x584dfa=_0xf015[_0x150024];return _0x584dfa;};'use strict';function QueueReport(){this[_0x5f01('0x0')]=_0x5f01('0x1');this[_0x5f01('0x2')]='';this[_0x5f01('0x3')]='';this[_0x5f01('0x4')]='';this[_0x5f01('0x5')]='';this['queuecallerjoinAt']=null;this[_0x5f01('0x6')]=null;this[_0x5f01('0x7')]=0x1;this[_0x5f01('0x8')]=0x1;this[_0x5f01('0x9')]=![];this[_0x5f01('0xa')]=null;this[_0x5f01('0xb')]=![];this[_0x5f01('0xc')]=null;this[_0x5f01('0xd')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this['channel']='';this[_0x5f01('0xe')]='';this[_0x5f01('0xf')]='';this[_0x5f01('0x10')]='';this[_0x5f01('0x11')]='';this['exten']='';this[_0x5f01('0x12')]='';this['holdtime']=0x0;this['assigned']=![];this[_0x5f01('0x13')]='';this[_0x5f01('0x14')]=_0x5f01('0x15');this[_0x5f01('0x16')]=0x0;this['variables']={};}module[_0x5f01('0x17')]=QueueReport; \ No newline at end of file +var _0x2e7b=['holdtime','assigned','lastAssignedTo','motionChannel','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','priority'];(function(_0x13ff86,_0x1263f9){var _0x24242a=function(_0x5a2abb){while(--_0x5a2abb){_0x13ff86['push'](_0x13ff86['shift']());}};_0x24242a(++_0x1263f9);}(_0x2e7b,0x130));var _0xb2e7=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2e7b[_0x3b380d];return _0x54502b;};'use strict';function QueueReport(){this[_0xb2e7('0x0')]=_0xb2e7('0x1');this[_0xb2e7('0x2')]='';this[_0xb2e7('0x3')]='';this[_0xb2e7('0x4')]='';this[_0xb2e7('0x5')]='';this['queuecallerjoinAt']=null;this[_0xb2e7('0x6')]=null;this[_0xb2e7('0x7')]=0x1;this[_0xb2e7('0x8')]=0x1;this['queuecallerabandon']=![];this[_0xb2e7('0x9')]=null;this[_0xb2e7('0xa')]=![];this[_0xb2e7('0xb')]=null;this[_0xb2e7('0xc')]=![];this[_0xb2e7('0xd')]=null;this['originalposition']=0x1;this[_0xb2e7('0xe')]='';this[_0xb2e7('0xf')]='';this[_0xb2e7('0x10')]='';this[_0xb2e7('0x11')]='';this[_0xb2e7('0x12')]='';this['exten']='';this[_0xb2e7('0x13')]='';this[_0xb2e7('0x14')]=0x0;this[_0xb2e7('0x15')]=![];this[_0xb2e7('0x16')]='';this[_0xb2e7('0x17')]='voice';this[_0xb2e7('0x18')]=0x0;this[_0xb2e7('0x19')]={};}module[_0xb2e7('0x1a')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 96ac930..9bdfcd3 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 _0x917d=['clientSecret','securityToken','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x79cd47,_0x16102d){var _0x3b9484=function(_0x23db95){while(--_0x23db95){_0x79cd47['push'](_0x79cd47['shift']());}};_0x3b9484(++_0x16102d);}(_0x917d,0x17c));var _0xd917=function(_0x2adcd9,_0x52f1a0){_0x2adcd9=_0x2adcd9-0x0;var _0x50d33a=_0x917d[_0x2adcd9];return _0x50d33a;};'use strict';function SalesforceAccount(_0x1b5383){this['id']=_0x1b5383['id']||0x0;this[_0xd917('0x0')]=_0x1b5383['name']||'';this[_0xd917('0x1')]=_0x1b5383[_0xd917('0x1')]||'';this[_0xd917('0x2')]=_0x1b5383['remoteUri']||'';this[_0xd917('0x3')]=_0x1b5383[_0xd917('0x3')]||'';this['clientId']=_0x1b5383[_0xd917('0x4')]||'';this[_0xd917('0x5')]=_0x1b5383[_0xd917('0x5')]||'';this[_0xd917('0x6')]=_0x1b5383[_0xd917('0x6')]||'';this['type']=_0x1b5383['type']||_0xd917('0x7');this[_0xd917('0x8')]=_0x1b5383[_0xd917('0x8')]||'';this[_0xd917('0x9')]=_0x1b5383[_0xd917('0x9')]||{};}module[_0xd917('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xf65d=['type','integrationTab','Configurations','exports','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0xe002f,_0x5af963){var _0x5de752=function(_0x220f89){while(--_0x220f89){_0xe002f['push'](_0xe002f['shift']());}};_0x5de752(++_0x5af963);}(_0xf65d,0x13a));var _0xdf65=function(_0x4471b3,_0x511a9f){_0x4471b3=_0x4471b3-0x0;var _0x386593=_0xf65d[_0x4471b3];return _0x386593;};'use strict';function SalesforceAccount(_0x12450b){this['id']=_0x12450b['id']||0x0;this['name']=_0x12450b['name']||'';this[_0xdf65('0x0')]=_0x12450b[_0xdf65('0x0')]||'';this[_0xdf65('0x1')]=_0x12450b['remoteUri']||'';this[_0xdf65('0x2')]=_0x12450b['password']||'';this[_0xdf65('0x3')]=_0x12450b[_0xdf65('0x3')]||'';this[_0xdf65('0x4')]=_0x12450b[_0xdf65('0x4')]||'';this[_0xdf65('0x5')]=_0x12450b[_0xdf65('0x5')]||'';this[_0xdf65('0x6')]=_0x12450b[_0xdf65('0x6')]||_0xdf65('0x7');this['serverUrl']=_0x12450b['serverUrl']||'';this[_0xdf65('0x8')]=_0x12450b[_0xdf65('0x8')]||{};}module[_0xdf65('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 0ba77f4..0be668a 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 _0x8711=['password','remoteUri','Configurations','exports','name','username'];(function(_0x5fd9a3,_0x4d6377){var _0x45fc16=function(_0x2cc90b){while(--_0x2cc90b){_0x5fd9a3['push'](_0x5fd9a3['shift']());}};_0x45fc16(++_0x4d6377);}(_0x8711,0x124));var _0x1871=function(_0x299ca8,_0x4e74fa){_0x299ca8=_0x299ca8-0x0;var _0x5dbd44=_0x8711[_0x299ca8];return _0x5dbd44;};'use strict';function ServicenowAccount(_0x118e4f){this['id']=_0x118e4f['id']||0x0;this[_0x1871('0x0')]=_0x118e4f[_0x1871('0x0')]||'';this['username']=_0x118e4f[_0x1871('0x1')]||'';this[_0x1871('0x2')]=_0x118e4f['password']||'';this[_0x1871('0x3')]=_0x118e4f['remoteUri']||'';this['serverUrl']=_0x118e4f['serverUrl']||'';this[_0x1871('0x4')]=_0x118e4f['Configurations']||{};}module[_0x1871('0x5')]=ServicenowAccount; \ No newline at end of file +var _0xe529=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x3c2666,_0x15fd23){var _0x10c814=function(_0x4660c0){while(--_0x4660c0){_0x3c2666['push'](_0x3c2666['shift']());}};_0x10c814(++_0x15fd23);}(_0xe529,0xc1));var _0x9e52=function(_0x5300b6,_0x4a5846){_0x5300b6=_0x5300b6-0x0;var _0x58980e=_0xe529[_0x5300b6];return _0x58980e;};'use strict';function ServicenowAccount(_0x3c45b2){this['id']=_0x3c45b2['id']||0x0;this[_0x9e52('0x0')]=_0x3c45b2[_0x9e52('0x0')]||'';this[_0x9e52('0x1')]=_0x3c45b2['username']||'';this[_0x9e52('0x2')]=_0x3c45b2[_0x9e52('0x2')]||'';this[_0x9e52('0x3')]=_0x3c45b2[_0x9e52('0x3')]||'';this[_0x9e52('0x4')]=_0x3c45b2['serverUrl']||'';this[_0x9e52('0x5')]=_0x3c45b2['Configurations']||{};}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 ec87d5a..d046332 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 _0xc865=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x34e83f,_0x4f3ef9){var _0x45b9c0=function(_0x594bfd){while(--_0x594bfd){_0x34e83f['push'](_0x34e83f['shift']());}};_0x45b9c0(++_0x4f3ef9);}(_0xc865,0x86));var _0x5c86=function(_0x52dceb,_0x37764c){_0x52dceb=_0x52dceb-0x0;var _0xa6a3a2=_0xc865[_0x52dceb];return _0xa6a3a2;};'use strict';function SugarcrmAccount(_0x12a66d){this['id']=_0x12a66d['id']||0x0;this['name']=_0x12a66d[_0x5c86('0x0')]||'';this[_0x5c86('0x1')]=_0x12a66d[_0x5c86('0x1')]||'';this[_0x5c86('0x2')]=_0x12a66d['password']||'';this[_0x5c86('0x3')]=_0x12a66d[_0x5c86('0x3')]||'';this[_0x5c86('0x4')]=_0x12a66d[_0x5c86('0x4')]||'';this[_0x5c86('0x5')]=_0x12a66d[_0x5c86('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xdcbd=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x1b3163,_0x589734){var _0x428ee6=function(_0x5e4ded){while(--_0x5e4ded){_0x1b3163['push'](_0x1b3163['shift']());}};_0x428ee6(++_0x589734);}(_0xdcbd,0xb6));var _0xddcb=function(_0x473a5b,_0x1d31b7){_0x473a5b=_0x473a5b-0x0;var _0x48007a=_0xdcbd[_0x473a5b];return _0x48007a;};'use strict';function SugarcrmAccount(_0x4ce832){this['id']=_0x4ce832['id']||0x0;this['name']=_0x4ce832[_0xddcb('0x0')]||'';this[_0xddcb('0x1')]=_0x4ce832['username']||'';this[_0xddcb('0x2')]=_0x4ce832['password']||'';this['remoteUri']=_0x4ce832[_0xddcb('0x3')]||'';this[_0xddcb('0x4')]=_0x4ce832[_0xddcb('0x4')]||'';this[_0xddcb('0x5')]=_0x4ce832[_0xddcb('0x5')]||{};}module[_0xddcb('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 5b7fe0c..c1a7914 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 _0x7e04=['exports','name','accountcode','unknown','stateTime','status','address'];(function(_0x3b67dc,_0x19ffac){var _0x3e2d55=function(_0x2ff297){while(--_0x2ff297){_0x3b67dc['push'](_0x3b67dc['shift']());}};_0x3e2d55(++_0x19ffac);}(_0x7e04,0x1cf));var _0x47e0=function(_0x1ac6e5,_0x40f47f){_0x1ac6e5=_0x1ac6e5-0x0;var _0x5877dc=_0x7e04[_0x1ac6e5];return _0x5877dc;};'use strict';function Telephone(_0x449cfb){this['id']=_0x449cfb['id']||0x0;this['name']=_0x449cfb[_0x47e0('0x0')]||'';this[_0x47e0('0x1')]=_0x449cfb[_0x47e0('0x1')]||'';this['state']=_0x47e0('0x2');this[_0x47e0('0x3')]=0x0;this[_0x47e0('0x4')]=_0x47e0('0x2');this[_0x47e0('0x5')]='';}module[_0x47e0('0x6')]=Telephone; \ No newline at end of file +var _0xb939=['name','accountcode','state','unknown','stateTime','status'];(function(_0x3c6266,_0x503711){var _0x39fb79=function(_0x4fd8b8){while(--_0x4fd8b8){_0x3c6266['push'](_0x3c6266['shift']());}};_0x39fb79(++_0x503711);}(_0xb939,0xd2));var _0x9b93=function(_0x262263,_0xf13273){_0x262263=_0x262263-0x0;var _0x1c7829=_0xb939[_0x262263];return _0x1c7829;};'use strict';function Telephone(_0x52ffbd){this['id']=_0x52ffbd['id']||0x0;this[_0x9b93('0x0')]=_0x52ffbd['name']||'';this[_0x9b93('0x1')]=_0x52ffbd[_0x9b93('0x1')]||'';this[_0x9b93('0x2')]=_0x9b93('0x3');this[_0x9b93('0x4')]=0x0;this[_0x9b93('0x5')]='unknown';this['address']='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index cbcfc3f..94bc7cc 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0xafcaa0,_0x327076){var _0x49c4c8=function(_0x52bc61){while(--_0x52bc61){_0xafcaa0['push'](_0xafcaa0['shift']());}};_0x49c4c8(++_0x327076);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x1f036d,_0x45e323){var _0x624d56=function(_0x536c17){while(--_0x536c17){_0x1f036d['push'](_0x1f036d['shift']());}};_0x624d56(++_0x45e323);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 1ef5279..58d06e3 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 _0x14a0=['voice','status','AnyConditions','Actions','name','channel'];(function(_0x26ea59,_0x316bec){var _0x9e45f8=function(_0x46af8c){while(--_0x46af8c){_0x26ea59['push'](_0x26ea59['shift']());}};_0x9e45f8(++_0x316bec);}(_0x14a0,0x8e));var _0x014a=function(_0x739965,_0x554633){_0x739965=_0x739965-0x0;var _0x15e37e=_0x14a0[_0x739965];return _0x15e37e;};'use strict';function Trigger(_0x1ee939){this['id']=_0x1ee939['id']||0x0;this[_0x014a('0x0')]=_0x1ee939[_0x014a('0x0')]||'';this[_0x014a('0x1')]=_0x1ee939[_0x014a('0x1')]||_0x014a('0x2');this[_0x014a('0x3')]=_0x1ee939[_0x014a('0x3')]||![];this['AllConditions']=_0x1ee939['AllConditions']||[];this[_0x014a('0x4')]=_0x1ee939[_0x014a('0x4')]||[];this[_0x014a('0x5')]=_0x1ee939['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x274321,_0x4c20ac){var _0x449cf8=function(_0x557ebf){while(--_0x557ebf){_0x274321['push'](_0x274321['shift']());}};_0x449cf8(++_0x4c20ac);}(_0xda2d,0x102));var _0xdda2=function(_0x3294d2,_0xfcc7a5){_0x3294d2=_0x3294d2-0x0;var _0x44ffa0=_0xda2d[_0x3294d2];return _0x44ffa0;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 4ab0688..7dba657 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 _0x2705=['name','state','stateTime','unknown','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active'];(function(_0x54a229,_0x479dd1){var _0x36232e=function(_0x48a4d3){while(--_0x48a4d3){_0x54a229['push'](_0x54a229['shift']());}};_0x36232e(++_0x479dd1);}(_0x2705,0x143));var _0x5270=function(_0x477d64,_0x212d38){_0x477d64=_0x477d64-0x0;var _0x50cf2b=_0x2705[_0x477d64];return _0x50cf2b;};'use strict';function Trunk(_0x1bb010){this['id']=_0x1bb010['id']||0x0;this[_0x5270('0x0')]=_0x1bb010[_0x5270('0x0')]||![];this['name']=_0x1bb010[_0x5270('0x1')]||'';this[_0x5270('0x2')]='unknown';this[_0x5270('0x3')]=0x0;this['status']=_0x5270('0x4');this[_0x5270('0x5')]=_0x1bb010[_0x5270('0x5')]&&_0x1bb010['registry'][_0x5270('0x6')](':')?_0x1bb010[_0x5270('0x5')][_0x5270('0x7')](':')[0x0]:'';this[_0x5270('0x8')]='';this[_0x5270('0x9')]='';this[_0x5270('0xa')]='';this[_0x5270('0xb')]='';this[_0x5270('0xc')]='';this[_0x5270('0xd')]=_0x5270('0x4');this[_0x5270('0xe')]='';this[_0x5270('0xf')]='';this[_0x5270('0x10')]=_0x1bb010[_0x5270('0x10')]||'';}module[_0x5270('0x11')]=Trunk; \ No newline at end of file +var _0x2d16=['split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf'];(function(_0x296632,_0x5234cc){var _0x59f7d2=function(_0xeef0d7){while(--_0xeef0d7){_0x296632['push'](_0x296632['shift']());}};_0x59f7d2(++_0x5234cc);}(_0x2d16,0x13b));var _0x62d1=function(_0x115795,_0x3dc6b8){_0x115795=_0x115795-0x0;var _0x26e31a=_0x2d16[_0x115795];return _0x26e31a;};'use strict';function Trunk(_0x447756){this['id']=_0x447756['id']||0x0;this[_0x62d1('0x0')]=_0x447756[_0x62d1('0x0')]||![];this['name']=_0x447756[_0x62d1('0x1')]||'';this[_0x62d1('0x2')]=_0x62d1('0x3');this[_0x62d1('0x4')]=0x0;this[_0x62d1('0x5')]=_0x62d1('0x3');this[_0x62d1('0x6')]=_0x447756['registry']&&_0x447756[_0x62d1('0x6')][_0x62d1('0x7')](':')?_0x447756[_0x62d1('0x6')][_0x62d1('0x8')](':')[0x0]:'';this[_0x62d1('0x9')]='';this[_0x62d1('0xa')]='';this[_0x62d1('0xb')]='';this[_0x62d1('0xc')]='';this[_0x62d1('0xd')]='';this[_0x62d1('0xe')]=_0x62d1('0x3');this[_0x62d1('0xf')]='';this[_0x62d1('0x10')]='';this[_0x62d1('0x11')]=_0x447756[_0x62d1('0x11')]||'';}module[_0x62d1('0x12')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 6195127..0a2077c 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 _0x5a4d=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x57d671,_0x1a101c){var _0x450dfe=function(_0x53c457){while(--_0x53c457){_0x57d671['push'](_0x57d671['shift']());}};_0x450dfe(++_0x1a101c);}(_0x5a4d,0x87));var _0xd5a4=function(_0x11959f,_0x3ec466){_0x11959f=_0x11959f-0x0;var _0x410da1=_0x5a4d[_0x11959f];return _0x410da1;};'use strict';function voiceExtension(_0x554d02){this['id']=_0x554d02['id']||0x0;this['exten']=_0x554d02[_0xd5a4('0x0')]||'';this['recordingFormat']=_0x554d02[_0xd5a4('0x1')]||_0xd5a4('0x2');this[_0xd5a4('0x3')]=_0x554d02[_0xd5a4('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x2527=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2527,0xde));var _0x7252=function(_0x493fe6,_0x50ecf7){_0x493fe6=_0x493fe6-0x0;var _0x21ce12=_0x2527[_0x493fe6];return _0x21ce12;};'use strict';function voiceExtension(_0x5e6714){this['id']=_0x5e6714['id']||0x0;this[_0x7252('0x0')]=_0x5e6714['exten']||'';this['recordingFormat']=_0x5e6714[_0x7252('0x1')]||'none';this['mandatoryDisposition']=_0x5e6714[_0x7252('0x2')]||![];}module[_0x7252('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 48d1f87..879bb25 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 _0xc84c=['timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','random','roundrobin','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','loggedIn','onHold','paused','ringing','talking','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking'];(function(_0x5ed54b,_0x3a2827){var _0x4b58c7=function(_0x19d3b6){while(--_0x19d3b6){_0x5ed54b['push'](_0x5ed54b['shift']());}};_0x4b58c7(++_0x3a2827);}(_0xc84c,0x12f));var _0xcc84=function(_0x2d8935,_0x2c9d2e){_0x2d8935=_0x2d8935-0x0;var _0x2c5156=_0xc84c[_0x2d8935];return _0x2c5156;};'use strict';var monitorFormat={'wav':_0xcc84('0x0'),'wav49':_0xcc84('0x1'),'gsm':_0xcc84('0x2')};var strategy={'fewestcalls':_0xcc84('0x3'),'leastrecent':_0xcc84('0x4'),'linear':'linear','random':_0xcc84('0x5'),'ringall':'ringall','rr':_0xcc84('0x6'),'rrmemory':_0xcc84('0x7'),'rrordered':_0xcc84('0x8'),'wrandom':'wrandom'};function VoiceQueue(_0x2aeeb4){this['id']=_0x2aeeb4['id']||0x0;this['name']=_0x2aeeb4[_0xcc84('0x9')]||'';this['monitor_format']=_0x2aeeb4[_0xcc84('0xa')]||'';this[_0xcc84('0xb')]=_0x2aeeb4[_0xcc84('0xb')]||_0xcc84('0xc');this[_0xcc84('0xd')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0xcc84('0xe')]=0x0;this[_0xcc84('0xf')]=0x0;this[_0xcc84('0x10')]=0x0;this[_0xcc84('0x11')]=0x0;this[_0xcc84('0x12')]=0x0;this[_0xcc84('0x13')]=0x0;this[_0xcc84('0x14')]=0x0;this[_0xcc84('0x15')]=0x0;this['invalid']=0x0;this[_0xcc84('0x16')]=0x0;this['notInUse']=0x0;this[_0xcc84('0x17')]=0x0;this[_0xcc84('0x18')]=0x0;this[_0xcc84('0x19')]=0x0;this['ringInUse']=0x0;this[_0xcc84('0x1a')]=0x0;this['unavailable']=0x0;this['unknown']=0x0;this['acw']=_0x2aeeb4['acw']||![];this[_0xcc84('0x1b')]=_0x2aeeb4[_0xcc84('0x1b')]||0xa;this[_0xcc84('0x1c')]=_0x2aeeb4[_0xcc84('0x1c')]||'no';this[_0xcc84('0x1d')]=!![];this[_0xcc84('0x1e')]='';this[_0xcc84('0x1f')]='';this[_0xcc84('0x20')]=0x0;this[_0xcc84('0x21')]=0x0;this[_0xcc84('0x22')]=_0x2aeeb4[_0xcc84('0x22')]||null;this[_0xcc84('0x23')]=_0x2aeeb4['dialGlobalInterval']?_0x2aeeb4['dialGlobalInterval']:null;this[_0xcc84('0x24')]=_0x2aeeb4['dialActive'];this[_0xcc84('0x25')]=_0x2aeeb4['dialMethod']||_0xcc84('0x26');this[_0xcc84('0x27')]=_0x2aeeb4[_0xcc84('0x27')]||0x0;this['dialLimitQueue']=_0x2aeeb4['dialLimitQueue']||0x0;this[_0xcc84('0x28')]=_0x2aeeb4[_0xcc84('0x28')]||0x1;this[_0xcc84('0x29')]=_0x2aeeb4[_0xcc84('0x29')]||'dropRate';this[_0xcc84('0x2a')]=_0x2aeeb4[_0xcc84('0x2a')]||0.03;this[_0xcc84('0x2b')]=_0x2aeeb4[_0xcc84('0x2b')]||0x258;this[_0xcc84('0x2c')]=_0x2aeeb4[_0xcc84('0x2c')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x2aeeb4[_0xcc84('0x2d')]||'anonymous';this[_0xcc84('0x2e')]=_0x2aeeb4[_0xcc84('0x2e')]||0x1e;this[_0xcc84('0x2f')]=_0x2aeeb4[_0xcc84('0x2f')]||'tTxX';this[_0xcc84('0x30')]=_0x2aeeb4[_0xcc84('0x30')]||0x3;this[_0xcc84('0x31')]=_0x2aeeb4[_0xcc84('0x31')]||undefined;this[_0xcc84('0x32')]=_0x2aeeb4[_0xcc84('0x32')]||0x3;this[_0xcc84('0x33')]=_0x2aeeb4['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x2aeeb4[_0xcc84('0x34')]||0x3;this[_0xcc84('0x35')]=_0x2aeeb4[_0xcc84('0x35')]||0x96;this['dialNoAnswerMaxRetry']=_0x2aeeb4[_0xcc84('0x36')]||0x3;this[_0xcc84('0x37')]=_0x2aeeb4[_0xcc84('0x37')]||0x96;this[_0xcc84('0x38')]=_0x2aeeb4[_0xcc84('0x38')]||0x3;this[_0xcc84('0x39')]=_0x2aeeb4[_0xcc84('0x39')]||0x96;this[_0xcc84('0x3a')]=_0x2aeeb4[_0xcc84('0x3a')]||0x3;this[_0xcc84('0x3b')]=_0x2aeeb4[_0xcc84('0x3b')]||0x96;this[_0xcc84('0x3c')]=_0x2aeeb4[_0xcc84('0x3c')]||0x3;this[_0xcc84('0x3d')]=_0x2aeeb4[_0xcc84('0x3d')]||0x96;this[_0xcc84('0x3e')]=_0x2aeeb4[_0xcc84('0x3e')]||0x3;this[_0xcc84('0x3f')]=_0x2aeeb4[_0xcc84('0x3f')]||0x96;this[_0xcc84('0x40')]=_0x2aeeb4[_0xcc84('0x40')]||0x3;this[_0xcc84('0x41')]=_0x2aeeb4[_0xcc84('0x41')]||0x96;this[_0xcc84('0x42')]=_0x2aeeb4[_0xcc84('0x42')]||0x3;this[_0xcc84('0x43')]=_0x2aeeb4[_0xcc84('0x43')]||0x4;this['Trunk']=_0x2aeeb4['Trunk']?_0x2aeeb4['Trunk']:undefined;this[_0xcc84('0x44')]=_0x2aeeb4[_0xcc84('0x44')]?_0x2aeeb4[_0xcc84('0x44')]:undefined;this[_0xcc84('0x45')]=_0x2aeeb4['dialPrefix']||undefined;this[_0xcc84('0x46')]=_0x2aeeb4[_0xcc84('0x46')]?_0x2aeeb4[_0xcc84('0x46')]:undefined;this['dialOrderByScheduledAt']=_0x2aeeb4[_0xcc84('0x47')]||_0xcc84('0x48');this['dialRandomLastDigitCallerIdNumber']=_0x2aeeb4[_0xcc84('0x49')]||undefined;this[_0xcc84('0x4a')]=_0x2aeeb4[_0xcc84('0x4a')]||undefined;this[_0xcc84('0x4b')]=strategy[_0x2aeeb4['strategy']];this['queueStatusComplete']=!![];this[_0xcc84('0x4c')]=_0x2aeeb4['dialAMDActive']||![];this[_0xcc84('0x4d')]=_0x2aeeb4[_0xcc84('0x4d')];this[_0xcc84('0x4e')]=_0x2aeeb4['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x2aeeb4[_0xcc84('0x4f')];this[_0xcc84('0x50')]=_0x2aeeb4[_0xcc84('0x50')];this[_0xcc84('0x51')]=_0x2aeeb4[_0xcc84('0x51')];this[_0xcc84('0x52')]=_0x2aeeb4['dialAMDBetweenWordsSilence'];this[_0xcc84('0x53')]=_0x2aeeb4[_0xcc84('0x53')];this['dialAMDSilenceThreshold']=_0x2aeeb4['dialAMDSilenceThreshold'];this[_0xcc84('0x54')]=_0x2aeeb4[_0xcc84('0x54')];this[_0xcc84('0x55')]=0x0;this[_0xcc84('0x56')]=0x0;this[_0xcc84('0x57')]=_0x2aeeb4['timeout'];this[_0xcc84('0x58')]=0x0;this[_0xcc84('0x59')]=0x0;this[_0xcc84('0x5a')]=0x0;this[_0xcc84('0x5b')]=0x0;this[_0xcc84('0x5c')]=0x0;this[_0xcc84('0x5d')]=0x0;this[_0xcc84('0x5e')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xcc84('0x5f')]=0x0;this[_0xcc84('0x60')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xcc84('0x61')]=0x0;this[_0xcc84('0x62')]=0x0;this[_0xcc84('0x63')]=0x0;this[_0xcc84('0x64')]=undefined;this[_0xcc84('0x65')]=undefined;this[_0xcc84('0x66')]=undefined;this[_0xcc84('0x67')]=1.05;this[_0xcc84('0x68')]=0x0;this[_0xcc84('0x69')]=0x0;this[_0xcc84('0x6a')]=0x0;this[_0xcc84('0x6b')]=0x0;this[_0xcc84('0x6c')]=0x0;this[_0xcc84('0x6d')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xcc84('0x6e')]=_0x2aeeb4[_0xcc84('0x6f')]||0x14;this[_0xcc84('0x70')]=_0x2aeeb4[_0xcc84('0x6f')]||0xa;this[_0xcc84('0x71')]=0x0;this[_0xcc84('0x72')]=0x0;this[_0xcc84('0x73')]=0x1;this[_0xcc84('0x74')]=0x0;this[_0xcc84('0x75')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xcc84('0x76')]=0x0;this[_0xcc84('0x77')]=_0x2aeeb4[_0xcc84('0x77')]||0x1e;this[_0xcc84('0x78')]=_0x2aeeb4[_0xcc84('0x78')]||![];this[_0xcc84('0x79')]=!!_0x2aeeb4['dialPreviewAutoRecallMe']||![];this[_0xcc84('0x7a')]=!!_0x2aeeb4[_0xcc84('0x7a')]||![];this['dialQueueProject2']=_0x2aeeb4[_0xcc84('0x7b')]||undefined;this[_0xcc84('0x7c')]=_0x2aeeb4['dialAgiAfterHangupClient']||![];this[_0xcc84('0x7d')]=_0x2aeeb4[_0xcc84('0x7d')]||![];this[_0xcc84('0xa')]=monitorFormat[_0x2aeeb4[_0xcc84('0xa')]]?monitorFormat[_0x2aeeb4['monitor_format']]:undefined;this[_0xcc84('0x7e')]=_0x2aeeb4[_0xcc84('0x7e')]||![];this[_0xcc84('0x7f')]=_0x2aeeb4[_0xcc84('0x7f')]?_0x2aeeb4[_0xcc84('0x7f')]:undefined;this[_0xcc84('0x80')]=![];}module[_0xcc84('0x81')]=VoiceQueue; \ No newline at end of file +var _0x77f7=['Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','roundrobin','wrandom','name','monitor_format','type','inbound','waiting','answered','sumHoldTime','sumBillable','abandoned','available','busy','invalid','loggedIn','notInUse','onHold','paused','ringing','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry'];(function(_0x9b4b12,_0x5b26b8){var _0x1d8fdc=function(_0xfc7c53){while(--_0xfc7c53){_0x9b4b12['push'](_0x9b4b12['shift']());}};_0x1d8fdc(++_0x5b26b8);}(_0x77f7,0xbd));var _0x777f=function(_0x2b1e8e,_0x1f52c7){_0x2b1e8e=_0x2b1e8e-0x0;var _0x48268f=_0x77f7[_0x2b1e8e];return _0x48268f;};'use strict';var monitorFormat={'wav':_0x777f('0x0'),'wav49':_0x777f('0x1'),'gsm':_0x777f('0x2')};var strategy={'fewestcalls':_0x777f('0x3'),'leastrecent':_0x777f('0x4'),'linear':_0x777f('0x5'),'random':_0x777f('0x6'),'ringall':_0x777f('0x7'),'rr':_0x777f('0x8'),'rrmemory':'rrmemory','rrordered':'rrordered','wrandom':_0x777f('0x9')};function VoiceQueue(_0x188bf1){this['id']=_0x188bf1['id']||0x0;this[_0x777f('0xa')]=_0x188bf1[_0x777f('0xa')]||'';this[_0x777f('0xb')]=_0x188bf1[_0x777f('0xb')]||'';this[_0x777f('0xc')]=_0x188bf1[_0x777f('0xc')]||_0x777f('0xd');this[_0x777f('0xe')]=0x0;this['total']=0x0;this[_0x777f('0xf')]=0x0;this['sumDuration']=0x0;this[_0x777f('0x10')]=0x0;this[_0x777f('0x11')]=0x0;this['unmanaged']=0x0;this[_0x777f('0x12')]=0x0;this[_0x777f('0x13')]=0x0;this[_0x777f('0x14')]=0x0;this['inUse']=0x0;this[_0x777f('0x15')]=0x0;this[_0x777f('0x16')]=0x0;this[_0x777f('0x17')]=0x0;this[_0x777f('0x18')]=0x0;this[_0x777f('0x19')]=0x0;this[_0x777f('0x1a')]=0x0;this['ringInUse']=0x0;this[_0x777f('0x1b')]=0x0;this[_0x777f('0x1c')]=0x0;this['unknown']=0x0;this[_0x777f('0x1d')]=_0x188bf1[_0x777f('0x1d')]||![];this[_0x777f('0x1e')]=_0x188bf1[_0x777f('0x1e')]||0xa;this[_0x777f('0x1f')]=_0x188bf1[_0x777f('0x1f')]||'no';this[_0x777f('0x20')]=!![];this['message']='';this[_0x777f('0x21')]='';this[_0x777f('0x22')]=0x0;this[_0x777f('0x23')]=0x0;this[_0x777f('0x24')]=_0x188bf1[_0x777f('0x24')]||null;this[_0x777f('0x25')]=_0x188bf1[_0x777f('0x25')]?_0x188bf1['dialGlobalInterval']:null;this['dialActive']=_0x188bf1[_0x777f('0x26')];this[_0x777f('0x27')]=_0x188bf1[_0x777f('0x27')]||_0x777f('0x28');this[_0x777f('0x29')]=_0x188bf1[_0x777f('0x29')]||0x0;this[_0x777f('0x2a')]=_0x188bf1[_0x777f('0x2a')]||0x0;this['dialPowerLevel']=_0x188bf1[_0x777f('0x2b')]||0x1;this['dialPredictiveOptimization']=_0x188bf1[_0x777f('0x2c')]||_0x777f('0x2d');this[_0x777f('0x2e')]=_0x188bf1[_0x777f('0x2e')]||0.03;this[_0x777f('0x2f')]=_0x188bf1[_0x777f('0x2f')]||0x258;this[_0x777f('0x30')]=_0x188bf1['dialOriginateCallerIdName']||_0x777f('0x31');this[_0x777f('0x32')]=_0x188bf1['dialOriginateCallerIdNumber']||_0x777f('0x31');this['dialOriginateTimeout']=_0x188bf1[_0x777f('0x33')]||0x1e;this[_0x777f('0x34')]=_0x188bf1[_0x777f('0x34')]||_0x777f('0x35');this[_0x777f('0x36')]=_0x188bf1[_0x777f('0x36')]||0x3;this[_0x777f('0x37')]=_0x188bf1[_0x777f('0x37')]||undefined;this[_0x777f('0x38')]=_0x188bf1['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x188bf1[_0x777f('0x39')]||0x96;this[_0x777f('0x3a')]=_0x188bf1[_0x777f('0x3a')]||0x3;this[_0x777f('0x3b')]=_0x188bf1[_0x777f('0x3b')]||0x96;this[_0x777f('0x3c')]=_0x188bf1[_0x777f('0x3c')]||0x3;this['dialNoAnswerRetryFrequency']=_0x188bf1[_0x777f('0x3d')]||0x96;this[_0x777f('0x3e')]=_0x188bf1['dialNoSuchNumberMaxRetry']||0x3;this[_0x777f('0x3f')]=_0x188bf1[_0x777f('0x3f')]||0x96;this['dialDropMaxRetry']=_0x188bf1['dialDropMaxRetry']||0x3;this[_0x777f('0x40')]=_0x188bf1[_0x777f('0x40')]||0x96;this[_0x777f('0x41')]=_0x188bf1[_0x777f('0x41')]||0x3;this[_0x777f('0x42')]=_0x188bf1[_0x777f('0x42')]||0x96;this[_0x777f('0x43')]=_0x188bf1[_0x777f('0x43')]||0x3;this[_0x777f('0x44')]=_0x188bf1[_0x777f('0x44')]||0x96;this['dialAgentRejectMaxRetry']=_0x188bf1[_0x777f('0x45')]||0x3;this[_0x777f('0x46')]=_0x188bf1[_0x777f('0x46')]||0x96;this[_0x777f('0x47')]=_0x188bf1[_0x777f('0x47')]||0x3;this[_0x777f('0x48')]=_0x188bf1['dialGlobalMaxRetry']||0x4;this[_0x777f('0x49')]=_0x188bf1[_0x777f('0x49')]?_0x188bf1['Trunk']:undefined;this[_0x777f('0x4a')]=_0x188bf1['TrunkBackup']?_0x188bf1['TrunkBackup']:undefined;this[_0x777f('0x4b')]=_0x188bf1[_0x777f('0x4b')]||undefined;this[_0x777f('0x4c')]=_0x188bf1[_0x777f('0x4c')]?_0x188bf1[_0x777f('0x4c')]:undefined;this[_0x777f('0x4d')]=_0x188bf1[_0x777f('0x4d')]||_0x777f('0x4e');this['dialRandomLastDigitCallerIdNumber']=_0x188bf1['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x777f('0x4f')]=_0x188bf1[_0x777f('0x4f')]||undefined;this[_0x777f('0x50')]=strategy[_0x188bf1[_0x777f('0x50')]];this[_0x777f('0x51')]=!![];this[_0x777f('0x52')]=_0x188bf1[_0x777f('0x52')]||![];this[_0x777f('0x53')]=_0x188bf1['dialAMDInitialSilence'];this[_0x777f('0x54')]=_0x188bf1[_0x777f('0x54')];this[_0x777f('0x55')]=_0x188bf1[_0x777f('0x55')];this[_0x777f('0x56')]=_0x188bf1[_0x777f('0x56')];this[_0x777f('0x57')]=_0x188bf1[_0x777f('0x57')];this['dialAMDBetweenWordsSilence']=_0x188bf1['dialAMDBetweenWordsSilence'];this[_0x777f('0x58')]=_0x188bf1['dialAMDMaximumNumberOfWords'];this[_0x777f('0x59')]=_0x188bf1[_0x777f('0x59')];this[_0x777f('0x5a')]=_0x188bf1[_0x777f('0x5a')];this[_0x777f('0x5b')]=0x0;this['pTalking']=0x0;this[_0x777f('0x5c')]=_0x188bf1[_0x777f('0x5c')];this[_0x777f('0x5d')]=0x0;this[_0x777f('0x5e')]=0x0;this[_0x777f('0x5f')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x777f('0x60')]=0x0;this[_0x777f('0x61')]=0x0;this[_0x777f('0x62')]=0x0;this[_0x777f('0x63')]=0x0;this[_0x777f('0x64')]=0x0;this[_0x777f('0x65')]=0x0;this[_0x777f('0x66')]=0x0;this[_0x777f('0x67')]=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0x777f('0x68')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x777f('0x69')]=1.05;this[_0x777f('0x6a')]=0x0;this[_0x777f('0x6b')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x777f('0x6c')]=0x0;this[_0x777f('0x6d')]=0x0;this[_0x777f('0x6e')]=0x0;this[_0x777f('0x6f')]=0x0;this['predictiveIntervalMaxThreshold']=_0x188bf1[_0x777f('0x70')]||0x14;this[_0x777f('0x71')]=_0x188bf1[_0x777f('0x70')]||0xa;this[_0x777f('0x72')]=0x0;this[_0x777f('0x73')]=0x0;this[_0x777f('0x74')]=0x1;this[_0x777f('0x75')]=0x0;this[_0x777f('0x76')]=0x0;this[_0x777f('0x77')]=0x0;this[_0x777f('0x78')]=0x0;this[_0x777f('0x79')]=_0x188bf1[_0x777f('0x79')]||0x1e;this[_0x777f('0x7a')]=_0x188bf1[_0x777f('0x7a')]||![];this[_0x777f('0x7b')]=!!_0x188bf1['dialPreviewAutoRecallMe']||![];this[_0x777f('0x7c')]=!!_0x188bf1[_0x777f('0x7c')]||![];this[_0x777f('0x7d')]=_0x188bf1[_0x777f('0x7d')]||undefined;this['dialAgiAfterHangupClient']=_0x188bf1[_0x777f('0x7e')]||![];this[_0x777f('0x7f')]=_0x188bf1[_0x777f('0x7f')]||![];this['monitor_format']=monitorFormat[_0x188bf1['monitor_format']]?monitorFormat[_0x188bf1[_0x777f('0xb')]]:undefined;this['mandatoryDisposition']=_0x188bf1['mandatoryDisposition']||![];this[_0x777f('0x80')]=_0x188bf1[_0x777f('0x80')]?_0x188bf1[_0x777f('0x80')]:undefined;this[_0x777f('0x81')]=![];}module[_0x777f('0x82')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 405d59f..2dbe3b7 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab86=['total','name','strategy','abandoned','answered','busy','invalid','onHold','paused','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','createReport','notInUse','loggedin','callers','length','SIP/','incall','includes','status','queue','dialer','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundUnknownCallsDay','preview','exports','available','loggedIn','loggedInDb','talking','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration'];(function(_0x385314,_0x23ec21){var _0x5ed4e4=function(_0x39670d){while(--_0x39670d){_0x385314['push'](_0x385314['shift']());}};_0x5ed4e4(++_0x23ec21);}(_0xab86,0x13e));var _0x6ab8=function(_0x43a95b,_0x20195d){_0x43a95b=_0x43a95b-0x0;var _0x542f53=_0xab86[_0x43a95b];return _0x542f53;};'use strict';var INBOUND_COUNTERS=[_0x6ab8('0x0'),_0x6ab8('0x1'),_0x6ab8('0x2'),'paused','ringing',_0x6ab8('0x3'),'waiting'];var OUTBOUND_COUNTERS=[_0x6ab8('0x0'),'answered',_0x6ab8('0x4'),_0x6ab8('0x1'),_0x6ab8('0x2'),_0x6ab8('0x5'),_0x6ab8('0x6'),_0x6ab8('0x7'),_0x6ab8('0x8'),_0x6ab8('0x9'),_0x6ab8('0xa'),_0x6ab8('0xb'),_0x6ab8('0xc'),_0x6ab8('0xd'),_0x6ab8('0xe'),'outboundUnknownCallsDay','paused',_0x6ab8('0xf'),'talking',_0x6ab8('0x10'),_0x6ab8('0x11'),_0x6ab8('0x12'),'waiting'];function VoiceQueueSummary(_0x2c8a8d){this['id']=_0x2c8a8d['id'];this[_0x6ab8('0x13')]=_0x2c8a8d['name'];this[_0x6ab8('0x14')]=_0x2c8a8d[_0x6ab8('0x14')];this[_0x6ab8('0x15')]=_0x2c8a8d['abandoned']||0x0;this[_0x6ab8('0x16')]=_0x2c8a8d[_0x6ab8('0x16')]||0x0;this[_0x6ab8('0x0')]=_0x2c8a8d[_0x6ab8('0x0')]||0x0;this[_0x6ab8('0x17')]=_0x2c8a8d[_0x6ab8('0x17')]||0x0;this[_0x6ab8('0x4')]=_0x2c8a8d[_0x6ab8('0x4')]||0x0;this[_0x6ab8('0x18')]=_0x2c8a8d['invalid']||0x0;this[_0x6ab8('0x1')]=_0x2c8a8d[_0x6ab8('0x1')]||0x0;this[_0x6ab8('0x2')]=_0x2c8a8d['loggedInDb']||0x0;this[_0x6ab8('0x19')]=_0x2c8a8d[_0x6ab8('0x19')]||0x0;this['notInUse']=_0x2c8a8d['notInUse']||0x0;this[_0x6ab8('0x1a')]=_0x2c8a8d['paused']||0x0;this[_0x6ab8('0x1b')]=_0x2c8a8d[_0x6ab8('0x1b')]||0x0;this[_0x6ab8('0x1c')]=_0x2c8a8d['ringInUse'];this[_0x6ab8('0x10')]=_0x2c8a8d[_0x6ab8('0x10')];this[_0x6ab8('0x11')]=_0x2c8a8d[_0x6ab8('0x11')];this['sumHoldTime']=_0x2c8a8d[_0x6ab8('0x1d')]||0x0;this[_0x6ab8('0x3')]=_0x2c8a8d['talking']||0x0;this['total']=_0x2c8a8d['total']||0x0;this[_0x6ab8('0x1e')]=_0x2c8a8d[_0x6ab8('0x1e')];this[_0x6ab8('0x1f')]=_0x2c8a8d['unavailable']||0x0;this[_0x6ab8('0x20')]=_0x2c8a8d[_0x6ab8('0x20')]||0x0;this['unmanaged']=_0x2c8a8d['unmanaged']||0x0;this[_0x6ab8('0x21')]=_0x2c8a8d[_0x6ab8('0x21')]||0x0;if(_0x2c8a8d['type']===_0x6ab8('0x22')){this[_0x6ab8('0xf')]=_0x2c8a8d[_0x6ab8('0xf')]||0x0;this[_0x6ab8('0x23')]=_0x2c8a8d[_0x6ab8('0x23')];this[_0x6ab8('0x24')]=_0x2c8a8d[_0x6ab8('0x24')];this[_0x6ab8('0x25')]=_0x2c8a8d['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x2c8a8d[_0x6ab8('0x26')];this['dialOriginateTimeout']=_0x2c8a8d[_0x6ab8('0x27')];this[_0x6ab8('0x28')]=_0x2c8a8d[_0x6ab8('0x28')];this['temp']=_0x2c8a8d['temp'];this['outboundAnswerAgiCallsDay']=_0x2c8a8d[_0x6ab8('0x29')];this[_0x6ab8('0x7')]=_0x2c8a8d[_0x6ab8('0x7')];this[_0x6ab8('0x8')]=_0x2c8a8d[_0x6ab8('0x8')];this[_0x6ab8('0x9')]=_0x2c8a8d[_0x6ab8('0x9')];this[_0x6ab8('0xa')]=_0x2c8a8d[_0x6ab8('0xa')];this[_0x6ab8('0x2a')]=_0x2c8a8d[_0x6ab8('0x2a')];this[_0x6ab8('0x2b')]=_0x2c8a8d[_0x6ab8('0x2b')];this['outboundDropCallsDayTimeout']=_0x2c8a8d['outboundDropCallsDayTimeout'];this[_0x6ab8('0xb')]=_0x2c8a8d['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x2c8a8d[_0x6ab8('0xc')];this[_0x6ab8('0x2c')]=_0x2c8a8d['outboundOriginateFailureCallsDay'];this[_0x6ab8('0xd')]=_0x2c8a8d['outboundReCallsDay'];this[_0x6ab8('0xe')]=_0x2c8a8d[_0x6ab8('0xe')];this['outboundUnknownCallsDay']=_0x2c8a8d['outboundUnknownCallsDay'];this[_0x6ab8('0x2d')]=_0x2c8a8d[_0x6ab8('0x2d')];this[_0x6ab8('0x2e')]=_0x2c8a8d[_0x6ab8('0x2e')];this[_0x6ab8('0x2f')]=_0x2c8a8d[_0x6ab8('0x2f')];this[_0x6ab8('0x30')]=_0x2c8a8d[_0x6ab8('0x30')];this['predictiveIntervalDroppedCallsTimeout']=_0x2c8a8d[_0x6ab8('0x31')];this[_0x6ab8('0x32')]=_0x2c8a8d[_0x6ab8('0x32')];this[_0x6ab8('0x33')]=_0x2c8a8d[_0x6ab8('0x33')];this[_0x6ab8('0x34')]=_0x2c8a8d['predictiveIntervalHitRate'];this[_0x6ab8('0x35')]=_0x2c8a8d[_0x6ab8('0x35')];this[_0x6ab8('0x36')]=_0x2c8a8d['predictiveIntervalPauses'];this['predictiveIntervalAvailable']=_0x2c8a8d[_0x6ab8('0x37')];this[_0x6ab8('0x38')]=_0x2c8a8d[_0x6ab8('0x38')];this[_0x6ab8('0x5')]=_0x2c8a8d[_0x6ab8('0x5')];this['erlangCalls']=_0x2c8a8d['erlangCalls'];this[_0x6ab8('0x39')]=_0x2c8a8d['erlangCallToSecond'];this[_0x6ab8('0x3a')]=_0x2c8a8d[_0x6ab8('0x3a')];this['erlangBusyFactor']=_0x2c8a8d['erlangBusyFactor'];this[_0x6ab8('0x3b')]=_0x2c8a8d[_0x6ab8('0x3b')];this[_0x6ab8('0x3c')]=_0x2c8a8d[_0x6ab8('0x3c')];this[_0x6ab8('0x3d')]=_0x2c8a8d[_0x6ab8('0x3d')];this[_0x6ab8('0x3e')]=_0x2c8a8d['statusMessage'];}if(_0x2c8a8d['Trunk']){this[_0x6ab8('0x3f')]={'id':_0x2c8a8d[_0x6ab8('0x3f')]['id'],'name':_0x2c8a8d[_0x6ab8('0x3f')][_0x6ab8('0x13')],'active':_0x2c8a8d['Trunk'][_0x6ab8('0x40')],'callerid':_0x2c8a8d['Trunk']['callerid']};}}VoiceQueueSummary[_0x6ab8('0x41')][_0x6ab8('0x42')]=function(_0x45735d,_0x3d7c84,_0x42400f,_0x5e8b39){this[_0x6ab8('0x2')]=0x0;this[_0x6ab8('0x3')]=0x0;this[_0x6ab8('0x1a')]=0x0;this[_0x6ab8('0x20')]=0x0;this[_0x6ab8('0x43')]=0x0;this[_0x6ab8('0x4')]=0x0;this['busy']=0x0;this[_0x6ab8('0x18')]=0x0;this[_0x6ab8('0x1f')]=0x0;this[_0x6ab8('0x1b')]=0x0;this[_0x6ab8('0x1c')]=0x0;this['onHold']=0x0;if(_0x42400f){if(_0x42400f[_0x6ab8('0x0')]){this['available']=Number(_0x42400f[_0x6ab8('0x0')]);}if(_0x42400f[_0x6ab8('0x44')]){this['loggedIn']=Number(_0x42400f[_0x6ab8('0x44')]);}if(_0x42400f[_0x6ab8('0x45')]){this['waiting']=Number(_0x42400f[_0x6ab8('0x45')]);}}for(var _0x262aa4=0x0;_0x262aa4<_0x45735d[_0x6ab8('0x46')];_0x262aa4++){var _0x222e21=_0x3d7c84[_0x6ab8('0x47')+_0x45735d[_0x262aa4]['name']];if(_0x222e21&&_0x222e21['online']){this['loggedInDb']+=0x1;}if(_0x45735d[_0x262aa4][_0x6ab8('0x48')]==='1'){this[_0x6ab8('0x3')]+=0x1;}if(_0x45735d[_0x262aa4]['paused']==='1'&&!['2','7','8'][_0x6ab8('0x49')](_0x45735d[_0x262aa4][_0x6ab8('0x4a')])){this[_0x6ab8('0x1a')]+=0x1;}switch(_0x45735d[_0x262aa4][_0x6ab8('0x4a')]){case'0':this[_0x6ab8('0x20')]+=0x1;break;case'1':this[_0x6ab8('0x43')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x6ab8('0x17')]+=0x1;break;case'4':this[_0x6ab8('0x18')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x6ab8('0x1b')]+=0x1;break;case'7':this[_0x6ab8('0x1c')]+=0x1;break;case'8':this[_0x6ab8('0x19')]+=0x1;break;}}if(this['dialMethod']==='booked'){var _0x1c61bc=Object['keys'](_0x5e8b39);for(var _0x31965e=0x0;_0x31965e<_0x1c61bc['length'];_0x31965e++){var _0x214b8e=_0x1c61bc[_0x31965e];var _0x7303f0=_0x5e8b39[_0x214b8e];if(_0x7303f0[_0x6ab8('0x4b')]===this[_0x6ab8('0x13')]&&_0x7303f0[_0x6ab8('0x1e')]===_0x6ab8('0x4c')&&_0x7303f0['exten']==='xcally-motion-preview'){this['talking']+=0x1;}}if(this[_0x6ab8('0x3')]>this['inUse']){this[_0x6ab8('0x3')]=this[_0x6ab8('0x4')];}this[_0x6ab8('0xf')]=0x0;}return this;};VoiceQueueSummary[_0x6ab8('0x41')][_0x6ab8('0x4d')]=function(_0x6097d0){var _0x799e3e=![];if(_0x6097d0){_0x799e3e=INBOUND_COUNTERS[_0x6ab8('0x4e')](function(_0x4d4e88){return this[_0x4d4e88]!==_0x6097d0[_0x4d4e88];},this);}return _0x799e3e;};VoiceQueueSummary[_0x6ab8('0x41')][_0x6ab8('0x4f')]=function(_0x174825){var _0xdd8b96=![];var _0x5af74c=![];var _0x619b55=![];if(_0x174825){_0xdd8b96=this[_0x6ab8('0x24')]!==_0x174825[_0x6ab8('0x24')]||this[_0x6ab8('0x23')]!==_0x174825[_0x6ab8('0x23')]||this[_0x6ab8('0x3d')]!==_0x174825[_0x6ab8('0x3d')]||this[_0x6ab8('0x3e')]!==_0x174825['statusMessage'];_0x5af74c=OUTBOUND_COUNTERS[_0x6ab8('0x4e')](function(_0x2b5b1b){return this[_0x2b5b1b]!==_0x174825[_0x2b5b1b];},this);if(this['Trunk']&&_0x174825[_0x6ab8('0x3f')]){_0x619b55=this[_0x6ab8('0x3f')][_0x6ab8('0x13')]!==_0x174825[_0x6ab8('0x3f')][_0x6ab8('0x13')]||this[_0x6ab8('0x3f')][_0x6ab8('0x40')]!==_0x174825[_0x6ab8('0x3f')][_0x6ab8('0x40')];}}return _0xdd8b96||_0x5af74c||_0x619b55;};VoiceQueueSummary['prototype'][_0x6ab8('0x50')]=function(_0x1b4315){this[_0x6ab8('0x16')]=_0x1b4315[_0x6ab8('0x16')];this['message']=_0x1b4315['message'];this[_0x6ab8('0x3e')]=_0x1b4315[_0x6ab8('0x3e')];this[_0x6ab8('0x5')]=_0x1b4315[_0x6ab8('0x5')];this[_0x6ab8('0x6')]=_0x1b4315[_0x6ab8('0x6')];this[_0x6ab8('0x7')]=_0x1b4315[_0x6ab8('0x7')];this[_0x6ab8('0x8')]=_0x1b4315[_0x6ab8('0x8')];this['outboundBusyCallsDay']=_0x1b4315['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x1b4315[_0x6ab8('0xa')];this[_0x6ab8('0xb')]=_0x1b4315[_0x6ab8('0xb')];this['outboundNoSuchCallsDay']=_0x1b4315[_0x6ab8('0xc')];this[_0x6ab8('0xd')]=_0x1b4315[_0x6ab8('0xd')];this[_0x6ab8('0xe')]=_0x1b4315[_0x6ab8('0xe')];this['outboundUnknownCallsDay']=_0x1b4315[_0x6ab8('0x51')];this['sumBillable']=_0x1b4315[_0x6ab8('0x10')];this[_0x6ab8('0x11')]=_0x1b4315[_0x6ab8('0x11')];this['total']=_0x1b4315[_0x6ab8('0x12')];if(this[_0x6ab8('0x24')]===_0x6ab8('0x52')){this[_0x6ab8('0xf')]=_0x1b4315['pTalking'];}};module[_0x6ab8('0x53')]=VoiceQueueSummary; \ No newline at end of file +var _0xb0df=['outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','loggedin','callers','SIP/','online','incall','includes','status','booked','length','queue','dialer','exten','compareToOutboundQueue','some','active','updateReportFromOutboundQueue','outboundAbandonedCallsDay','exports','loggedIn','loggedInDb','paused','ringing','talking','waiting','available','answered','inUse','originated','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay'];(function(_0x4ab956,_0x50b68c){var _0x1c1f57=function(_0x8e0899){while(--_0x8e0899){_0x4ab956['push'](_0x4ab956['shift']());}};_0x1c1f57(++_0x50b68c);}(_0xb0df,0x85));var _0xfb0d=function(_0x65d12e,_0x4b0a30){_0x65d12e=_0x65d12e-0x0;var _0x4274e0=_0xb0df[_0x65d12e];return _0x4274e0;};'use strict';var INBOUND_COUNTERS=['available',_0xfb0d('0x0'),_0xfb0d('0x1'),_0xfb0d('0x2'),_0xfb0d('0x3'),_0xfb0d('0x4'),_0xfb0d('0x5')];var OUTBOUND_COUNTERS=[_0xfb0d('0x6'),_0xfb0d('0x7'),_0xfb0d('0x8'),'loggedIn',_0xfb0d('0x1'),_0xfb0d('0x9'),'outboundAbandonedCallsDay','outboundAnswerCallsDay',_0xfb0d('0xa'),_0xfb0d('0xb'),'outboundCongestionCallsDay','outboundNoAnswerCallsDay',_0xfb0d('0xc'),_0xfb0d('0xd'),'outboundRejectCallsDay',_0xfb0d('0xe'),_0xfb0d('0x2'),_0xfb0d('0xf'),_0xfb0d('0x4'),_0xfb0d('0x10'),_0xfb0d('0x11'),'total',_0xfb0d('0x5')];function VoiceQueueSummary(_0x580405){this['id']=_0x580405['id'];this[_0xfb0d('0x12')]=_0x580405[_0xfb0d('0x12')];this[_0xfb0d('0x13')]=_0x580405[_0xfb0d('0x13')];this[_0xfb0d('0x14')]=_0x580405[_0xfb0d('0x14')]||0x0;this[_0xfb0d('0x7')]=_0x580405['answered']||0x0;this['available']=_0x580405['available']||0x0;this[_0xfb0d('0x15')]=_0x580405[_0xfb0d('0x15')]||0x0;this[_0xfb0d('0x8')]=_0x580405[_0xfb0d('0x8')]||0x0;this[_0xfb0d('0x16')]=_0x580405[_0xfb0d('0x16')]||0x0;this[_0xfb0d('0x0')]=_0x580405['loggedIn']||0x0;this[_0xfb0d('0x1')]=_0x580405[_0xfb0d('0x1')]||0x0;this[_0xfb0d('0x17')]=_0x580405[_0xfb0d('0x17')]||0x0;this['notInUse']=_0x580405[_0xfb0d('0x18')]||0x0;this[_0xfb0d('0x2')]=_0x580405[_0xfb0d('0x2')]||0x0;this[_0xfb0d('0x3')]=_0x580405[_0xfb0d('0x3')]||0x0;this[_0xfb0d('0x19')]=_0x580405[_0xfb0d('0x19')];this['sumBillable']=_0x580405[_0xfb0d('0x10')];this[_0xfb0d('0x11')]=_0x580405[_0xfb0d('0x11')];this[_0xfb0d('0x1a')]=_0x580405[_0xfb0d('0x1a')]||0x0;this[_0xfb0d('0x4')]=_0x580405[_0xfb0d('0x4')]||0x0;this[_0xfb0d('0x1b')]=_0x580405[_0xfb0d('0x1b')]||0x0;this[_0xfb0d('0x1c')]=_0x580405[_0xfb0d('0x1c')];this[_0xfb0d('0x1d')]=_0x580405['unavailable']||0x0;this[_0xfb0d('0x1e')]=_0x580405[_0xfb0d('0x1e')]||0x0;this['unmanaged']=_0x580405['unmanaged']||0x0;this[_0xfb0d('0x5')]=_0x580405[_0xfb0d('0x5')]||0x0;if(_0x580405['type']===_0xfb0d('0x1f')){this[_0xfb0d('0xf')]=_0x580405[_0xfb0d('0xf')]||0x0;this[_0xfb0d('0x20')]=_0x580405[_0xfb0d('0x20')];this[_0xfb0d('0x21')]=_0x580405[_0xfb0d('0x21')];this[_0xfb0d('0x22')]=_0x580405[_0xfb0d('0x22')];this[_0xfb0d('0x23')]=_0x580405[_0xfb0d('0x23')];this[_0xfb0d('0x24')]=_0x580405['dialOriginateTimeout'];this[_0xfb0d('0x25')]=_0x580405[_0xfb0d('0x25')];this['temp']=_0x580405[_0xfb0d('0x26')];this[_0xfb0d('0x27')]=_0x580405[_0xfb0d('0x27')];this[_0xfb0d('0x28')]=_0x580405['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x580405[_0xfb0d('0xa')];this['outboundBusyCallsDay']=_0x580405[_0xfb0d('0xb')];this['outboundCongestionCallsDay']=_0x580405[_0xfb0d('0x29')];this[_0xfb0d('0x2a')]=_0x580405[_0xfb0d('0x2a')];this[_0xfb0d('0x2b')]=_0x580405['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0x580405[_0xfb0d('0x2c')];this[_0xfb0d('0x2d')]=_0x580405[_0xfb0d('0x2d')];this[_0xfb0d('0xc')]=_0x580405['outboundNoSuchCallsDay'];this[_0xfb0d('0x2e')]=_0x580405['outboundOriginateFailureCallsDay'];this[_0xfb0d('0xd')]=_0x580405['outboundReCallsDay'];this[_0xfb0d('0x2f')]=_0x580405[_0xfb0d('0x2f')];this[_0xfb0d('0xe')]=_0x580405[_0xfb0d('0xe')];this[_0xfb0d('0x30')]=_0x580405[_0xfb0d('0x30')];this['predictiveIntervalAvgHoldtime']=_0x580405[_0xfb0d('0x31')];this[_0xfb0d('0x32')]=_0x580405[_0xfb0d('0x32')];this[_0xfb0d('0x33')]=_0x580405[_0xfb0d('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x580405[_0xfb0d('0x34')];this[_0xfb0d('0x35')]=_0x580405[_0xfb0d('0x35')];this[_0xfb0d('0x36')]=_0x580405['predictiveIntervalErlangCallsDroppedCalls'];this['predictiveIntervalHitRate']=_0x580405['predictiveIntervalHitRate'];this[_0xfb0d('0x37')]=_0x580405[_0xfb0d('0x37')];this[_0xfb0d('0x38')]=_0x580405[_0xfb0d('0x38')];this[_0xfb0d('0x39')]=_0x580405[_0xfb0d('0x39')];this[_0xfb0d('0x3a')]=_0x580405['predictiveIntervalTotalCalls'];this[_0xfb0d('0x9')]=_0x580405[_0xfb0d('0x9')];this['erlangCalls']=_0x580405['erlangCalls'];this[_0xfb0d('0x3b')]=_0x580405[_0xfb0d('0x3b')];this[_0xfb0d('0x3c')]=_0x580405[_0xfb0d('0x3c')];this[_0xfb0d('0x3d')]=_0x580405['erlangBusyFactor'];this[_0xfb0d('0x3e')]=_0x580405[_0xfb0d('0x3e')];this[_0xfb0d('0x3f')]=_0x580405[_0xfb0d('0x3f')];this['message']=_0x580405[_0xfb0d('0x40')];this[_0xfb0d('0x41')]=_0x580405['statusMessage'];}if(_0x580405[_0xfb0d('0x42')]){this[_0xfb0d('0x42')]={'id':_0x580405[_0xfb0d('0x42')]['id'],'name':_0x580405[_0xfb0d('0x42')][_0xfb0d('0x12')],'active':_0x580405[_0xfb0d('0x42')]['active'],'callerid':_0x580405[_0xfb0d('0x42')][_0xfb0d('0x43')]};}}VoiceQueueSummary[_0xfb0d('0x44')]['createReport']=function(_0x22f73b,_0xe571c4,_0x51233a,_0x11e2ae){this['loggedInDb']=0x0;this[_0xfb0d('0x4')]=0x0;this[_0xfb0d('0x2')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0xfb0d('0x8')]=0x0;this['busy']=0x0;this[_0xfb0d('0x16')]=0x0;this[_0xfb0d('0x1d')]=0x0;this[_0xfb0d('0x3')]=0x0;this[_0xfb0d('0x19')]=0x0;this[_0xfb0d('0x17')]=0x0;if(_0x51233a){if(_0x51233a[_0xfb0d('0x6')]){this[_0xfb0d('0x6')]=Number(_0x51233a['available']);}if(_0x51233a[_0xfb0d('0x45')]){this[_0xfb0d('0x0')]=Number(_0x51233a[_0xfb0d('0x45')]);}if(_0x51233a[_0xfb0d('0x46')]){this[_0xfb0d('0x5')]=Number(_0x51233a['callers']);}}for(var _0x3fff94=0x0;_0x3fff94<_0x22f73b['length'];_0x3fff94++){var _0x91cc9e=_0xe571c4[_0xfb0d('0x47')+_0x22f73b[_0x3fff94][_0xfb0d('0x12')]];if(_0x91cc9e&&_0x91cc9e[_0xfb0d('0x48')]){this[_0xfb0d('0x1')]+=0x1;}if(_0x22f73b[_0x3fff94][_0xfb0d('0x49')]==='1'){this[_0xfb0d('0x4')]+=0x1;}if(_0x22f73b[_0x3fff94]['paused']==='1'&&!['2','7','8'][_0xfb0d('0x4a')](_0x22f73b[_0x3fff94][_0xfb0d('0x4b')])){this[_0xfb0d('0x2')]+=0x1;}switch(_0x22f73b[_0x3fff94][_0xfb0d('0x4b')]){case'0':this[_0xfb0d('0x1e')]+=0x1;break;case'1':this[_0xfb0d('0x18')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xfb0d('0x15')]+=0x1;break;case'4':this[_0xfb0d('0x16')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xfb0d('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0xfb0d('0x21')]===_0xfb0d('0x4c')){var _0x3bb2dd=Object['keys'](_0x11e2ae);for(var _0x3d6893=0x0;_0x3d6893<_0x3bb2dd[_0xfb0d('0x4d')];_0x3d6893++){var _0x16c6ea=_0x3bb2dd[_0x3d6893];var _0xc6785d=_0x11e2ae[_0x16c6ea];if(_0xc6785d[_0xfb0d('0x4e')]===this[_0xfb0d('0x12')]&&_0xc6785d[_0xfb0d('0x1c')]===_0xfb0d('0x4f')&&_0xc6785d[_0xfb0d('0x50')]==='xcally-motion-preview'){this[_0xfb0d('0x4')]+=0x1;}}if(this['talking']>this[_0xfb0d('0x8')]){this['talking']=this[_0xfb0d('0x8')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xfb0d('0x44')]['compareToInboundQueue']=function(_0x16d3b7){var _0x42e06c=![];if(_0x16d3b7){_0x42e06c=INBOUND_COUNTERS['some'](function(_0x46c545){return this[_0x46c545]!==_0x16d3b7[_0x46c545];},this);}return _0x42e06c;};VoiceQueueSummary[_0xfb0d('0x44')][_0xfb0d('0x51')]=function(_0x1b8090){var _0x19a732=![];var _0x53ee4c=![];var _0x1cc7d6=![];if(_0x1b8090){_0x19a732=this['dialMethod']!==_0x1b8090[_0xfb0d('0x21')]||this[_0xfb0d('0x20')]!==_0x1b8090[_0xfb0d('0x20')]||this['message']!==_0x1b8090[_0xfb0d('0x40')]||this[_0xfb0d('0x41')]!==_0x1b8090[_0xfb0d('0x41')];_0x53ee4c=OUTBOUND_COUNTERS[_0xfb0d('0x52')](function(_0x527965){return this[_0x527965]!==_0x1b8090[_0x527965];},this);if(this[_0xfb0d('0x42')]&&_0x1b8090[_0xfb0d('0x42')]){_0x1cc7d6=this[_0xfb0d('0x42')][_0xfb0d('0x12')]!==_0x1b8090[_0xfb0d('0x42')][_0xfb0d('0x12')]||this[_0xfb0d('0x42')][_0xfb0d('0x53')]!==_0x1b8090['Trunk'][_0xfb0d('0x53')];}}return _0x19a732||_0x53ee4c||_0x1cc7d6;};VoiceQueueSummary[_0xfb0d('0x44')][_0xfb0d('0x54')]=function(_0x585848){this[_0xfb0d('0x7')]=_0x585848[_0xfb0d('0x7')];this[_0xfb0d('0x40')]=_0x585848[_0xfb0d('0x40')];this['statusMessage']=_0x585848[_0xfb0d('0x41')];this['originated']=_0x585848[_0xfb0d('0x9')];this['outboundAbandonedCallsDay']=_0x585848[_0xfb0d('0x55')];this[_0xfb0d('0x28')]=_0x585848['outboundAnswerCallsDay'];this[_0xfb0d('0xa')]=_0x585848[_0xfb0d('0xa')];this[_0xfb0d('0xb')]=_0x585848[_0xfb0d('0xb')];this[_0xfb0d('0x29')]=_0x585848[_0xfb0d('0x29')];this[_0xfb0d('0x2d')]=_0x585848['outboundNoAnswerCallsDay'];this[_0xfb0d('0xc')]=_0x585848[_0xfb0d('0xc')];this['outboundReCallsDay']=_0x585848['outboundReCallsDay'];this[_0xfb0d('0x2f')]=_0x585848[_0xfb0d('0x2f')];this[_0xfb0d('0xe')]=_0x585848[_0xfb0d('0xe')];this[_0xfb0d('0x10')]=_0x585848['sumBillable'];this[_0xfb0d('0x11')]=_0x585848['sumDuration'];this[_0xfb0d('0x1b')]=_0x585848[_0xfb0d('0x1b')];if(this[_0xfb0d('0x21')]==='preview'){this['pTalking']=_0x585848[_0xfb0d('0xf')];}};module[_0xfb0d('0x56')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index fce3065..f1b6c60 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 _0x377e=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0xb4d59d,_0x5c30d2){var _0x562ebb=function(_0x41bc79){while(--_0x41bc79){_0xb4d59d['push'](_0xb4d59d['shift']());}};_0x562ebb(++_0x5c30d2);}(_0x377e,0x1d9));var _0xe377=function(_0x201d8e,_0x46f74b){_0x201d8e=_0x201d8e-0x0;var _0x403d73=_0x377e[_0x201d8e];return _0x403d73;};'use strict';function VtigerAccount(_0x5c5f30){this['id']=_0x5c5f30['id']||0x0;this['name']=_0x5c5f30[_0xe377('0x0')]||'';this['username']=_0x5c5f30[_0xe377('0x1')]||'';this[_0xe377('0x2')]=_0x5c5f30[_0xe377('0x2')]||'';this[_0xe377('0x3')]=_0x5c5f30['remoteUri']||'';this[_0xe377('0x4')]=_0x5c5f30[_0xe377('0x4')]||'';this['Configurations']=_0x5c5f30[_0xe377('0x5')]||{};}module[_0xe377('0x6')]=VtigerAccount; \ No newline at end of file +var _0xe89e=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3b0c9d,_0x3ddeb5){var _0xcfc8d7=function(_0x320dc6){while(--_0x320dc6){_0x3b0c9d['push'](_0x3b0c9d['shift']());}};_0xcfc8d7(++_0x3ddeb5);}(_0xe89e,0x116));var _0xee89=function(_0x1c0138,_0x4603c5){_0x1c0138=_0x1c0138-0x0;var _0x55add3=_0xe89e[_0x1c0138];return _0x55add3;};'use strict';function VtigerAccount(_0x462715){this['id']=_0x462715['id']||0x0;this[_0xee89('0x0')]=_0x462715[_0xee89('0x0')]||'';this[_0xee89('0x1')]=_0x462715[_0xee89('0x1')]||'';this[_0xee89('0x2')]=_0x462715['accessKey']||'';this[_0xee89('0x3')]=_0x462715[_0xee89('0x3')]||'';this['serverUrl']=_0x462715[_0xee89('0x4')]||'';this[_0xee89('0x5')]=_0x462715[_0xee89('0x5')]||{};}module[_0xee89('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 c191117..2d1ae98 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 _0xc453=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc453,0x92));var _0x3c45=function(_0x2ac4db,_0x3be5bd){_0x2ac4db=_0x2ac4db-0x0;var _0x2be2d2=_0xc453[_0x2ac4db];return _0x2be2d2;};'use strict';function ZendeskAccount(_0x1c0fc3){this['id']=_0x1c0fc3['id']||0x0;this[_0x3c45('0x0')]=_0x1c0fc3['name']||'';this['username']=_0x1c0fc3[_0x3c45('0x1')]||'';this['password']=_0x1c0fc3[_0x3c45('0x2')]||'';this[_0x3c45('0x3')]=_0x1c0fc3[_0x3c45('0x3')]||'';this[_0x3c45('0x4')]=_0x1c0fc3[_0x3c45('0x4')]||'';this[_0x3c45('0x5')]=_0x1c0fc3[_0x3c45('0x5')]||'';this[_0x3c45('0x6')]=_0x1c0fc3['type']||_0x3c45('0x7');this[_0x3c45('0x8')]=_0x1c0fc3['serverUrl']||'';this[_0x3c45('0x9')]=_0x1c0fc3[_0x3c45('0x9')]||{};}module[_0x3c45('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x78a6=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_0x78a6,0x1a6));var _0x678a=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x78a6[_0x4ea69d];return _0x5318e0;};'use strict';function ZendeskAccount(_0x4d7f2e){this['id']=_0x4d7f2e['id']||0x0;this[_0x678a('0x0')]=_0x4d7f2e[_0x678a('0x0')]||'';this['username']=_0x4d7f2e[_0x678a('0x1')]||'';this[_0x678a('0x2')]=_0x4d7f2e[_0x678a('0x2')]||'';this[_0x678a('0x3')]=_0x4d7f2e[_0x678a('0x3')]||'';this[_0x678a('0x4')]=_0x4d7f2e[_0x678a('0x4')]||'';this[_0x678a('0x5')]=_0x4d7f2e[_0x678a('0x5')]||'';this[_0x678a('0x6')]=_0x4d7f2e[_0x678a('0x6')]||_0x678a('0x7');this[_0x678a('0x8')]=_0x4d7f2e['serverUrl']||'';this[_0x678a('0x9')]=_0x4d7f2e[_0x678a('0x9')]||{};}module[_0x678a('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 5a0c46e..353f275 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 _0x71b9=['clientId','clientSecret','serverUrl','refreshToken','Configurations','name','description','host','zone'];(function(_0x11ab32,_0x28a165){var _0x4571d7=function(_0x282a1f){while(--_0x282a1f){_0x11ab32['push'](_0x11ab32['shift']());}};_0x4571d7(++_0x28a165);}(_0x71b9,0x1d9));var _0x971b=function(_0x36f2dc,_0x590ba6){_0x36f2dc=_0x36f2dc-0x0;var _0x3441d6=_0x71b9[_0x36f2dc];return _0x3441d6;};'use strict';function ZohoAccount(_0x4a7695){this['id']=_0x4a7695['id']||0x0;this[_0x971b('0x0')]=_0x4a7695[_0x971b('0x0')]||'';this[_0x971b('0x1')]=_0x4a7695[_0x971b('0x1')]||'';this[_0x971b('0x2')]=_0x4a7695[_0x971b('0x2')]||'';this[_0x971b('0x3')]=_0x4a7695['zone']||'';this[_0x971b('0x4')]=_0x4a7695[_0x971b('0x4')]||'';this['clientSecret']=_0x4a7695[_0x971b('0x5')]||'';this[_0x971b('0x6')]=_0x4a7695[_0x971b('0x6')]||'';this['code']=_0x4a7695['code']||'';this[_0x971b('0x7')]=_0x4a7695['refreshToken']||'';this[_0x971b('0x8')]=_0x4a7695['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x1723=['name','description','host','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x4d94e2,_0x3b3b7e){var _0x1d43a3=function(_0x472321){while(--_0x472321){_0x4d94e2['push'](_0x4d94e2['shift']());}};_0x1d43a3(++_0x3b3b7e);}(_0x1723,0xbd));var _0x3172=function(_0x43e5ae,_0x505bbf){_0x43e5ae=_0x43e5ae-0x0;var _0x1e5731=_0x1723[_0x43e5ae];return _0x1e5731;};'use strict';function ZohoAccount(_0x55028b){this['id']=_0x55028b['id']||0x0;this[_0x3172('0x0')]=_0x55028b['name']||'';this[_0x3172('0x1')]=_0x55028b['description']||'';this[_0x3172('0x2')]=_0x55028b[_0x3172('0x2')]||'';this['zone']=_0x55028b['zone']||'';this['clientId']=_0x55028b['clientId']||'';this[_0x3172('0x3')]=_0x55028b[_0x3172('0x3')]||'';this[_0x3172('0x4')]=_0x55028b[_0x3172('0x4')]||'';this['code']=_0x55028b[_0x3172('0x5')]||'';this['refreshToken']=_0x55028b[_0x3172('0x6')]||'';this[_0x3172('0x7')]=_0x55028b[_0x3172('0x7')]||{};}module[_0x3172('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index e1706d1..6125335 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 _0x6343=['format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','number','moment','string','isNil','queue','name','type','campaigntype','Agent','channelAgent','membername'];(function(_0x3c896c,_0x1cba86){var _0x44af1c=function(_0x252c14){while(--_0x252c14){_0x3c896c['push'](_0x3c896c['shift']());}};_0x44af1c(++_0x1cba86);}(_0x6343,0x168));var _0x3634=function(_0xfc254a,_0x569cc7){_0xfc254a=_0xfc254a-0x0;var _0x3bfbe3=_0x6343[_0xfc254a];return _0x3bfbe3;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x3634('0x0'));function checkNameSurname(_0x26d852,_0x53a78f,_0x518246){var _0x5a4621='';if(!_['isNil'](_0x53a78f)&&_0x3634('0x1')===typeof _0x53a78f){_0x5a4621+=_0x53a78f;}if(!_[_0x3634('0x2')](_0x518246)&&'string'===typeof _0x518246){_0x5a4621+='\x20'+_0x518246;}if(_0x5a4621!==''){return _0x5a4621;}return _0x26d852;}function Action(_0x247964,_0x388c18,_0x4bb496,_0x302828,_0xd40513){this['uniqueid']=_0x4bb496||undefined;this['idContact']=_0x247964['id'];this[_0x3634('0x3')]=_0x388c18[_0x3634('0x4')];this[_0x3634('0x5')]=_0x388c18[_0x3634('0x5')];this[_0x3634('0x6')]=_0x3634('0x3');this['dialAnswer']=![];this['membername']=_[_0x3634('0x2')](_0x247964[_0x3634('0x7')])?undefined:_0x247964['Agent'][_0x3634('0x4')];this[_0x3634('0x8')]=this[_0x3634('0x9')]?util[_0x3634('0xa')](_0x3634('0xb'),this[_0x3634('0x9')]):_0x302828||undefined;this[_0x3634('0xc')]=checkNameSurname(_0x247964[_0x3634('0xd')][_0x3634('0xe')],_0x247964[_0x3634('0xd')][_0x3634('0xf')],_0x247964[_0x3634('0xd')][_0x3634('0x10')]);this[_0x3634('0x11')]=_0x247964['active']||![];this[_0x3634('0x12')]=_0x247964['phone'];this[_0x3634('0x13')]=_0x247964[_0x3634('0x13')];this[_0x3634('0x14')]=_0x247964[_0x3634('0x14')]||0x0;this[_0x3634('0x15')]=_0x247964['countcongestionretry']||0x0;this[_0x3634('0x16')]=_0x247964['countnoanswerretry']||0x0;this['countglobal']=(_0x247964[_0x3634('0x14')]||0x0)+(_0x247964['countcongestionretry']||0x0)+(_0x247964[_0x3634('0x16')]||0x0)+(_0x247964[_0x3634('0x17')]||0x0)+(_0x247964[_0x3634('0x18')]||0x0)+(_0x247964['countabandonedretry']||0x0)+(_0x247964[_0x3634('0x19')]||0x0)+(_0x247964[_0x3634('0x1a')]||0x0);this['countnosuchnumberretry']=_0x247964[_0x3634('0x17')]||0x0;this['countdropretry']=_0x247964[_0x3634('0x18')]||0x0;this[_0x3634('0x1b')]=_0x247964['countabandonedretry']||0x0;this[_0x3634('0x19')]=_0x247964[_0x3634('0x19')]||0x0;this[_0x3634('0x1a')]=_0x247964['countagentrejectretry']||0x0;this[_0x3634('0x1c')]=_0x247964[_0x3634('0x1c')];this['callbackuniqueid']=_0x247964[_0x3634('0x1d')];this['callbackat']=_0x247964['callbackat'];this[_0x3634('0x1e')]=_0x247964[_0x3634('0x1e')];this['ContactId']=_0x247964[_0x3634('0x1f')];this[_0x3634('0x20')]=_0x247964[_0x3634('0x20')];this[_0x3634('0x21')]=_[_0x3634('0x2')](_0x247964[_0x3634('0x7')])?_0x247964[_0x3634('0x21')]:_0x247964[_0x3634('0x7')]['id'];this[_0x3634('0x22')]=_0x247964['VoiceQueueId'];this[_0x3634('0x23')]='';this['originatecalleridname']='';}Action['prototype']['getCaller']=function(){return util[_0x3634('0xa')]('\x22%s\x22\x20<%s>',this[_0x3634('0xc')],this[_0x3634('0x24')]);};module['exports']=Action; \ No newline at end of file +var _0x02ce=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','firstName','lastName','active','phone','scheduledat'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0x02ce,0x1ac));var _0xe02c=function(_0x436277,_0x5df0e9){_0x436277=_0x436277-0x0;var _0x33de60=_0x02ce[_0x436277];return _0x33de60;};'use strict';var util=require(_0xe02c('0x0'));var _=require(_0xe02c('0x1'));var moment=require(_0xe02c('0x2'));function checkNameSurname(_0x5a49d9,_0x2d73b6,_0x53d2a3){var _0x2b3d58='';if(!_[_0xe02c('0x3')](_0x2d73b6)&&_0xe02c('0x4')===typeof _0x2d73b6){_0x2b3d58+=_0x2d73b6;}if(!_[_0xe02c('0x3')](_0x53d2a3)&&_0xe02c('0x4')===typeof _0x53d2a3){_0x2b3d58+='\x20'+_0x53d2a3;}if(_0x2b3d58!==''){return _0x2b3d58;}return _0x5a49d9;}function Action(_0x229653,_0x3f7436,_0x2b804f,_0x36a87f,_0x4fecb3){this['uniqueid']=_0x2b804f||undefined;this[_0xe02c('0x5')]=_0x229653['id'];this[_0xe02c('0x6')]=_0x3f7436[_0xe02c('0x7')];this[_0xe02c('0x8')]=_0x3f7436[_0xe02c('0x8')];this[_0xe02c('0x9')]=_0xe02c('0x6');this[_0xe02c('0xa')]=![];this[_0xe02c('0xb')]=_[_0xe02c('0x3')](_0x229653[_0xe02c('0xc')])?undefined:_0x229653[_0xe02c('0xc')][_0xe02c('0x7')];this[_0xe02c('0xd')]=this[_0xe02c('0xb')]?util[_0xe02c('0xe')](_0xe02c('0xf'),this[_0xe02c('0xb')]):_0x36a87f||undefined;this['calleridname']=checkNameSurname(_0x229653[_0xe02c('0x10')]['phone'],_0x229653['Contact'][_0xe02c('0x11')],_0x229653['Contact'][_0xe02c('0x12')]);this['active']=_0x229653[_0xe02c('0x13')]||![];this['calleridnum']=_0x229653[_0xe02c('0x14')];this[_0xe02c('0x15')]=_0x229653['scheduledat'];this[_0xe02c('0x16')]=_0x229653[_0xe02c('0x16')]||0x0;this['countcongestionretry']=_0x229653[_0xe02c('0x17')]||0x0;this[_0xe02c('0x18')]=_0x229653['countnoanswerretry']||0x0;this['countglobal']=(_0x229653[_0xe02c('0x16')]||0x0)+(_0x229653['countcongestionretry']||0x0)+(_0x229653[_0xe02c('0x18')]||0x0)+(_0x229653[_0xe02c('0x19')]||0x0)+(_0x229653[_0xe02c('0x1a')]||0x0)+(_0x229653[_0xe02c('0x1b')]||0x0)+(_0x229653[_0xe02c('0x1c')]||0x0)+(_0x229653['countagentrejectretry']||0x0);this[_0xe02c('0x19')]=_0x229653['countnosuchnumberretry']||0x0;this['countdropretry']=_0x229653[_0xe02c('0x1a')]||0x0;this[_0xe02c('0x1b')]=_0x229653['countabandonedretry']||0x0;this[_0xe02c('0x1c')]=_0x229653[_0xe02c('0x1c')]||0x0;this['countagentrejectretry']=_0x229653[_0xe02c('0x1d')]||0x0;this[_0xe02c('0x1e')]=_0x229653[_0xe02c('0x1e')];this[_0xe02c('0x1f')]=_0x229653[_0xe02c('0x1f')];this[_0xe02c('0x20')]=_0x229653[_0xe02c('0x20')];this[_0xe02c('0x21')]=_0x229653[_0xe02c('0x21')];this[_0xe02c('0x22')]=_0x229653[_0xe02c('0x22')];this['ListId']=_0x229653[_0xe02c('0x23')];this[_0xe02c('0x24')]=_[_0xe02c('0x3')](_0x229653[_0xe02c('0xc')])?_0x229653[_0xe02c('0x24')]:_0x229653[_0xe02c('0xc')]['id'];this[_0xe02c('0x25')]=_0x229653[_0xe02c('0x25')];this['originatecalleridnum']='';this[_0xe02c('0x26')]='';}Action[_0xe02c('0x27')][_0xe02c('0x28')]=function(){return util['format'](_0xe02c('0x29'),this[_0xe02c('0x2a')],this[_0xe02c('0x2b')]);};module[_0xe02c('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 07a1ddc..48d512b 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 _0xa70a=['sumBillable','[syncHangup][talking][decrement]','linkedid','BUSY','outboundBusyCallsDay','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','countbusyretry','dialBusyMaxRetry','scheduledAt','incrementPreviewCounters','outboundNoAnswerCallsDay','dialNoAnswerRetryFrequency','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','countnoanswerretry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','decrementOriginate','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','\x20Queue','originated:\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','isEmpty','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','active','SIP/%s','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','execCall','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','assign','merge','toLowerVariables','starttime','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','lookAgent','logLookAgent','clone','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','uuid','ioredis','../../../config/logger','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','localhost','socket.io-emitter','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','loopCampaigns','emit','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','prototype','syncCampaigns','preview','dialMethod','booked','type','outbound','clearZombieChannels','hasOwnProperty','dialActive','dialPreviewAutoRecallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','pTalking','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','message','No\x20such\x20channel','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][Preview]','info','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','catch','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','unlockAgent','activeContact','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','mandatoryDisposition','custom:agentConnectPreview','channelAgent','complete','total','answered','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime'];(function(_0x354cd1,_0x297ac1){var _0x4ccd02=function(_0x431fd0){while(--_0x431fd0){_0x354cd1['push'](_0x354cd1['shift']());}};_0x4ccd02(++_0x297ac1);}(_0xa70a,0xaa));var _0xaa70=function(_0xa76870,_0x3b3c93){_0xa76870=_0xa76870-0x0;var _0x4caa58=_0xa70a[_0xa76870];return _0x4caa58;};'use strict';var util=require(_0xaa70('0x0'));var _=require('lodash');var uuid=require(_0xaa70('0x1'));var moment=require('moment');var Redis=require(_0xaa70('0x2'));var config=require('../../../config/environment');var logger=require(_0xaa70('0x3'))('preview');var loggerAction=require(_0xaa70('0x3'))(_0xaa70('0x4'));var ami=require('../ami');var rpcDb=require(_0xaa70('0x5'));var cmHopperAdditionalPhone=require(_0xaa70('0x6'));var Action=require(_0xaa70('0x7'));var ut=require(_0xaa70('0x8'));var utils=require('../dialer/utils');config[_0xaa70('0x9')]=_['defaults'](config[_0xaa70('0x9')],{'host':_0xaa70('0xa'),'port':0x18eb});var io=require(_0xaa70('0xb'))(new Redis(config[_0xaa70('0x9')]));var Sequence=function(){};Sequence['prototype'][_0xaa70('0xc')]=function(_0x2379fd){this[_0xaa70('0xd')]=this[_0xaa70('0xd')]?this[_0xaa70('0xd')]['finally'](_0x2379fd):_0x2379fd();};function Preview(_0x17048f){this[_0xaa70('0xe')]=new Sequence();this[_0xaa70('0xf')]=_0x17048f[_0xaa70('0x10')];this[_0xaa70('0x11')]=_0x17048f[_0xaa70('0x11')];this['actions']={};this[_0xaa70('0x12')]=_0x17048f[_0xaa70('0x12')];this[_0xaa70('0x13')]=0x0;ami['on'](_0xaa70('0x14'),this['syncOriginateResponse'][_0xaa70('0x15')](this));ami['on'](_0xaa70('0x16'),this[_0xaa70('0x17')][_0xaa70('0x15')](this));ami['on'](_0xaa70('0x18'),this['syncHangupRequest'][_0xaa70('0x15')](this));ami['on'](_0xaa70('0x19'),this[_0xaa70('0x1a')][_0xaa70('0x15')](this));ami['on'](_0xaa70('0x1b'),this[_0xaa70('0x1c')][_0xaa70('0x15')](this));ami['on'](_0xaa70('0x1d'),this[_0xaa70('0x1e')]['bind'](this));ami['on'](_0xaa70('0x1f'),this['syncAttendedTransfer'][_0xaa70('0x15')](this));ami['on'](_0xaa70('0x20'),this['syncBlindTransfer']['bind'](this));this[_0xaa70('0x21')](this['campaignsPreview']);}function emit(_0x3915c6,_0x46f948,_0x59c209){io['to'](_0x3915c6)[_0xaa70('0x22')](_0x46f948,_0x59c209);}function emitVoiceQueueChannelRemove(_0x126b14){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xaa70('0x23')](_0x126b14));emit(util[_0xaa70('0x24')](_0xaa70('0x25'),_0x126b14[_0xaa70('0x26')]),_0xaa70('0x27'),_0x126b14);io[_0xaa70('0x22')](_0xaa70('0x28'),_0x126b14);}function notSendMessagesQueue(_0x36f819){if(_0x36f819[_0xaa70('0x29')]){if(_0x36f819[_0xaa70('0x2a')]===0x0&&_0x36f819['pTalking']===0x0){_0x36f819['sendMessageOneNotActive']=![];_0x36f819[_0xaa70('0x2b')]=0x0;_0x36f819[_0xaa70('0x2c')]=0x0;_0x36f819['message']=utils[_0xaa70('0x2d')][_0xaa70('0x2e')];ut[_0xaa70('0x2f')](_0xaa70('0x30'),_0x36f819[_0xaa70('0x26')]+'\x20is\x20not\x20active');}else{_0x36f819['message']=utils[_0xaa70('0x2d')][_0xaa70('0x31')];ut[_0xaa70('0x2f')](_0xaa70('0x30'),_0x36f819['name']+'\x20is\x20deactivated');}}}Preview[_0xaa70('0x32')][_0xaa70('0x21')]=function(){var _0x15a373=this;setInterval(function(){_0x15a373[_0xaa70('0x33')]();},0x7cf);};Preview[_0xaa70('0x32')][_0xaa70('0x33')]=function(){var _0x2aa9d7=this[_0xaa70('0xf')];this['clockClearZombieChannels']+=0x1;for(var _0x4d3544 in _0x2aa9d7){if(_0x2aa9d7['hasOwnProperty'](_0x4d3544)&&(_0x2aa9d7[_0x4d3544]['dialMethod']===_0xaa70('0x34')||_0x2aa9d7[_0x4d3544][_0xaa70('0x35')]===_0xaa70('0x36'))&&_0x2aa9d7[_0x4d3544][_0xaa70('0x37')]===_0xaa70('0x38')){if(this[_0xaa70('0x13')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xaa70('0x39')]();}}if(_0x2aa9d7[_0xaa70('0x3a')](_0x4d3544)&&_0x2aa9d7[_0x4d3544]['dialMethod']===_0xaa70('0x34')&&_0x2aa9d7[_0x4d3544][_0xaa70('0x37')]===_0xaa70('0x38')){if(_0x2aa9d7[_0x4d3544][_0xaa70('0x3b')]){this['setMessage'](_0x2aa9d7[_0x4d3544]);if(_0x2aa9d7[_0x4d3544][_0xaa70('0x3c')])this['recallMe'](_0x2aa9d7[_0x4d3544]);}else{notSendMessagesQueue(_0x2aa9d7[_0x4d3544]);}}}};Preview[_0xaa70('0x32')][_0xaa70('0x3d')]=function(_0x2b3fc5){var _0xe24fe3=this;this['sequence'][_0xaa70('0xc')](function(){if(!_[_0xaa70('0x3e')](_0xe24fe3[_0xaa70('0x3f')][_0x2b3fc5])){loggerAction['info'](_0xaa70('0x40'),_0x2b3fc5,_0xaa70('0x41'),_0xe24fe3[_0xaa70('0x3f')][_0x2b3fc5][_0xaa70('0x42')],'originated:\x20',JSON[_0xaa70('0x23')](_0xe24fe3[_0xaa70('0xf')][_0xe24fe3[_0xaa70('0x3f')][_0x2b3fc5][_0xaa70('0x42')]][_0xaa70('0x2a')]),_0xaa70('0x43'),JSON[_0xaa70('0x23')](_0xe24fe3[_0xaa70('0xf')][_0xe24fe3['actions'][_0x2b3fc5][_0xaa70('0x42')]][_0xaa70('0x44')]),JSON[_0xaa70('0x23')](_0xe24fe3['actions'][_0x2b3fc5][_0xaa70('0x45')]),JSON[_0xaa70('0x23')](_[_0xaa70('0x46')](_0xe24fe3[_0xaa70('0x3f')][_0x2b3fc5],[_0xaa70('0x47'),_0xaa70('0x48'),_0xaa70('0x49'),_0xaa70('0x4a')])));return ami['Action']({'action':_0xaa70('0x4b'),'channel':_0xe24fe3[_0xaa70('0x3f')][_0x2b3fc5][_0xaa70('0x4c')]})['catch'](function(_0x43fbb0){if(_0x43fbb0[_0xaa70('0x4d')]===_0xaa70('0x4e')){setTimeout(function(){if(_0xe24fe3[_0xaa70('0x3f')][_0x2b3fc5]){utils['decrementOriginate'](_0xe24fe3[_0xaa70('0xf')][_0xe24fe3[_0xaa70('0x3f')][_0x2b3fc5][_0xaa70('0x42')]],_0xaa70('0x4f'));if(_0xe24fe3[_0xaa70('0x3f')][_0x2b3fc5][_0xaa70('0x45')]===!![]){ut[_0xaa70('0x50')](_0xe24fe3['campaignsPreview'][_0xe24fe3[_0xaa70('0x3f')][_0x2b3fc5][_0xaa70('0x42')]],_0xaa70('0x4f'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x2b3fc5,_0xe24fe3['actions'][_0x2b3fc5][_0xaa70('0x42')]);}ut[_0xaa70('0x51')](_0xaa70('0x52')+_0x2b3fc5,_0xe24fe3['actions'][_0x2b3fc5][_0xaa70('0x42')]);delete _0xe24fe3[_0xaa70('0x3f')][_0x2b3fc5];}},0x2328);}});}});};Preview['prototype'][_0xaa70('0x39')]=function(){var _0x37081e=this;loggerAction[_0xaa70('0x53')](_0xaa70('0x54'),_[_0xaa70('0x55')](this['actions']));for(var _0x3eaad2 in this['actions']){if(_0x37081e[_0xaa70('0x3f')][_0xaa70('0x3a')](_0x3eaad2)){_0x37081e['clearZombieChannel'](_0x3eaad2);}}};Preview[_0xaa70('0x32')]['recallMe']=function(_0x24092d){var _0x13d68a=this;rpcDb[_0xaa70('0x56')](_0x24092d['id'],ut[_0xaa70('0x57')](this[_0xaa70('0x12')]))[_0xaa70('0x58')](function(_0x195d00){if(!_[_0xaa70('0x3e')](_0x195d00)){for(var _0x47982c=0x0;_0x47982c<_0x195d00[_0xaa70('0x59')];_0x47982c+=0x1){if(ut[_0xaa70('0x5a')](_0x195d00[_0x47982c][_0xaa70('0x5b')])<_0x24092d[_0xaa70('0x5c')]*0x3c){if(_0x195d00[_0x47982c][_0xaa70('0x5d')]&&!_0x195d00[_0x47982c][_0xaa70('0x5d')][_0xaa70('0x5e')]){_0x13d68a[_0xaa70('0x5f')](_0x195d00[_0x47982c]['id'])[_0xaa70('0x58')](ut[_0xaa70('0x60')](_0xaa70('0x61')))[_0xaa70('0x62')](ut[_0xaa70('0x60')](_0xaa70('0x61')));}else{rpcDb[_0xaa70('0x63')](_0x195d00[_0x47982c]['id']);}}else{var _0x5cb857=new Action(_0x195d00[_0x47982c],_0x24092d);_0x5cb857['starttime']=moment()['format'](_0xaa70('0x64'));_0x24092d['outboundReCallsDay']+=0x1;ut[_0xaa70('0x65')](_0x5cb857,0x17,_0xaa70('0x66'));if(_0x24092d[_0xaa70('0x67')]){rpcDb[_0xaa70('0x68')](ut[_0xaa70('0x69')](_0x195d00[_0x47982c]));rpcDb[_0xaa70('0x6a')](_0x5cb857,_0xaa70('0x6b'));}else{ut['logCustomer'](_0x5cb857,0x16,_0xaa70('0x6c'));rpcDb['createCustomerHistory'](_0x5cb857,'[HistoryRecallClose]');rpcDb[_0xaa70('0x6d')](_0x5cb857,_0xaa70('0x6e'));}}}}})['catch'](ut['logger2'](_0xaa70('0x6f')));};Preview[_0xaa70('0x32')][_0xaa70('0x70')]=function(_0x248020){_0x248020[_0xaa70('0x29')]=!![];if(ut[_0xaa70('0x71')](_0x248020[_0xaa70('0x72')])){_0x248020[_0xaa70('0x4d')]=utils[_0xaa70('0x2d')][_0xaa70('0x73')];}else if(!ut[_0xaa70('0x74')](_0x248020[_0xaa70('0x3b')])){_0x248020[_0xaa70('0x4d')]=utils[_0xaa70('0x2d')][_0xaa70('0x2e')];}else if(!this[_0xaa70('0x75')](_0x248020[_0xaa70('0x76')])){if(!this['isTrunkReachable'](_0x248020[_0xaa70('0x77')])){_0x248020[_0xaa70('0x4d')]=utils['CAMPAIGN_STATUS']['UNREACHABLE_TRUNK'];}else{_0x248020[_0xaa70('0x4d')]=utils[_0xaa70('0x2d')][_0xaa70('0x78')];}}else{_0x248020[_0xaa70('0x4d')]=utils[_0xaa70('0x2d')]['ACTIVE'];}};Preview[_0xaa70('0x32')]['callProgressDetectingCustomer']=function(_0x58c48e,_0x812213,_0x230939){var _0x5ed060=this;var _0x25b54d=this[_0xaa70('0x3f')][_0x812213];var _0x347937=this[_0xaa70('0xf')][_0x25b54d[_0xaa70('0x42')]];var _0x3d73b0;var _0x583740=![];var _0x29209c=0x2;var _0x9b428d=0x3;if(_0x347937){switch(_0x230939){case'1':_0x347937[_0xaa70('0x79')]+=0x1;_0x25b54d[_0xaa70('0x7a')]+=0x1;_0x25b54d['countglobal']=ut[_0xaa70('0x7b')](_0x25b54d);ut[_0xaa70('0x65')](_0x25b54d,0x0,'NoSuchNumber');ami['emit'](_0xaa70('0x7c'),ut[_0xaa70('0x7d')](_0x25b54d,_0xaa70('0x7e')));rpcDb['createCustomerHistory'](_0x25b54d,'[callProgressDetectingCustomer][logNoSuch]');_0x5ed060['verifyAdditionalPhones'](_0x25b54d,'0',_0x347937)[_0xaa70('0x58')](function(_0x3eb3c3){_0x583740=_0x3eb3c3[_0xaa70('0x7f')]==0x1;_0x29209c=_0x347937[_0xaa70('0x80')];_0x9b428d=_0x347937[_0xaa70('0x81')];if(!_0x583740){if(ut[_0xaa70('0x7b')](_0x25b54d)>=_0x347937[_0xaa70('0x82')]){_0x3d73b0=ut[_0xaa70('0x83')](_0x25b54d,0xf,_0xaa70('0x84'));rpcDb['createCustomerFinal'](_0x3d73b0,_0xaa70('0x85'));}else{if(_0x25b54d[_0xaa70('0x7a')]>=_0x347937[_0xaa70('0x86')]){rpcDb[_0xaa70('0x6d')](_0x25b54d,_0xaa70('0x85'));}else{rpcDb[_0xaa70('0x87')](ut['scheduledAt'](_0x25b54d,_0xaa70('0x7a'),_0x347937[_0xaa70('0x80')]),_0x25b54d[_0xaa70('0x88')],_0x25b54d[_0xaa70('0x89')]);}}delete this[_0xaa70('0x3f')][_0x58c48e['linkedid']];}else{_0x25b54d[_0xaa70('0x7a')]++;logger[_0xaa70('0x53')]('actioncountonusuch',_0x25b54d[_0xaa70('0x7a')]);logger[_0xaa70('0x53')]('id',_0x25b54d[_0xaa70('0x8a')]);_0x5ed060['incrementPreviewCounters']({'id':_0x25b54d[_0xaa70('0x8a')],'field':{'countnosuchnumberretry':_0x25b54d[_0xaa70('0x7a')]}})[_0xaa70('0x58')](function(){_0x5ed060[_0xaa70('0x8b')](_0x25b54d,_0x29209c,_0x9b428d)[_0xaa70('0x58')](function(){});});}});break;case _0xaa70('0x8c'):var _0x28fb8e=moment()[_0xaa70('0x24')](_0xaa70('0x64'));_0x25b54d[_0xaa70('0x8d')]=_0x28fb8e;_0x25b54d[_0xaa70('0x8e')]=_0x28fb8e;_0x25b54d['dialAnswer']=!![];_0x347937[_0xaa70('0x44')]+=0x1;logger[_0xaa70('0x53')](_0xaa70('0x8f'),_0x25b54d[_0xaa70('0x90')],'\x20Queue',_0x347937[_0xaa70('0x26')],'pTalking:\x20',_0x347937[_0xaa70('0x44')]);ami[_0xaa70('0x22')](_0xaa70('0x91'),ut[_0xaa70('0x7d')](_0x25b54d,_0xaa70('0x92'),this[_0xaa70('0xf')][_0x25b54d[_0xaa70('0x42')]]));if(_0x347937['acw']||_0x347937[_0xaa70('0x93')]){ami['emit'](_0xaa70('0x94'),{'queue':_0x25b54d['queue'],'interface':_0x25b54d[_0xaa70('0x95')],'uniqueid':_0x25b54d[_0xaa70('0x90')]});}break;case'16':ami[_0xaa70('0x22')]('custom:agentcomplete',ut[_0xaa70('0x7d')](_0x25b54d,_0xaa70('0x96'),this[_0xaa70('0xf')][_0x25b54d[_0xaa70('0x42')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x25b54d,_0xaa70('0x96')));_0x347937['outboundAnswerCallsDay']+=0x1;_0x347937[_0xaa70('0x97')]+=0x1;_0x347937[_0xaa70('0x98')]+=0x1;ut['decrementTalking'](_0x347937,'[16]');_0x25b54d[_0xaa70('0x99')]=ut[_0xaa70('0x7b')](_0x25b54d);ut[_0xaa70('0x65')](_0x25b54d,0x4,_0xaa70('0x9a'));rpcDb[_0xaa70('0x6a')](_0x25b54d,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xaa70('0x6d')](_0x25b54d,_0xaa70('0x9b'));rpcDb[_0xaa70('0x9c')](_0x25b54d);_0x347937[_0xaa70('0x9d')]+=_0x25b54d[_0xaa70('0x9e')];_0x347937[_0xaa70('0x9f')]+=_0x25b54d[_0xaa70('0x9e')];logger[_0xaa70('0x53')](_0xaa70('0xa0'),_0x25b54d[_0xaa70('0x90')],'\x20Queue',_0x347937[_0xaa70('0x26')],_0xaa70('0x43'),_0x347937[_0xaa70('0x44')]);delete this['actions'][_0x58c48e[_0xaa70('0xa1')]];break;case _0xaa70('0xa2'):_0x347937[_0xaa70('0xa3')]+=0x1;_0x25b54d['countbusyretry']+=0x1;_0x25b54d[_0xaa70('0x99')]=ut['totalGlobal'](_0x25b54d);ut[_0xaa70('0x65')](_0x25b54d,0x5,'Busy');_0x29209c=_0x347937[_0xaa70('0xa4')];_0x9b428d=_0x347937[_0xaa70('0x81')];ami[_0xaa70('0x22')](_0xaa70('0xa5'),ut[_0xaa70('0x7d')](_0x25b54d,_0xaa70('0xa6')));rpcDb[_0xaa70('0x6a')](_0x25b54d,_0xaa70('0xa7'));_0x5ed060[_0xaa70('0xa8')](_0x25b54d,'5',_0x347937)[_0xaa70('0x58')](function(_0x34f2d4){_0x583740=_0x34f2d4['additional']==0x1;if(!_0x583740){if(ut['totalGlobal'](_0x25b54d)>=_0x347937[_0xaa70('0x82')]){_0x3d73b0=ut[_0xaa70('0x83')](_0x25b54d,0xf,_0xaa70('0x84'));rpcDb['createCustomerFinal'](_0x3d73b0,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x25b54d[_0xaa70('0xa9')]>=_0x347937[_0xaa70('0xaa')]){rpcDb[_0xaa70('0x6d')](_0x25b54d,_0xaa70('0xa7'));}else{rpcDb[_0xaa70('0x87')](ut[_0xaa70('0xab')](_0x25b54d,_0xaa70('0xa9'),_0x347937[_0xaa70('0xa4')]),_0x25b54d[_0xaa70('0x88')],_0x25b54d[_0xaa70('0x89')]);}}}else{_0x25b54d[_0xaa70('0xa9')]++;_0x5ed060[_0xaa70('0xac')]({'id':_0x25b54d[_0xaa70('0x8a')],'field':{'countbusyretry':_0x25b54d[_0xaa70('0xa9')]}})[_0xaa70('0x58')](function(){_0x5ed060[_0xaa70('0x8b')](_0x25b54d,_0x29209c,_0x9b428d)[_0xaa70('0x58')](function(){});});}});break;case'NOANSWER':_0x347937[_0xaa70('0xad')]+=0x1;_0x25b54d['countnoanswerretry']+=0x1;_0x25b54d[_0xaa70('0x99')]=ut[_0xaa70('0x7b')](_0x25b54d);ut[_0xaa70('0x65')](_0x25b54d,0x3,'NoAnswer');_0x29209c=_0x347937[_0xaa70('0xae')];_0x9b428d=_0x347937[_0xaa70('0x81')];var _0x39fe44=ut['buildNoAnswerEventPayload'](_0x25b54d,_0x347937);ami['emit'](_0xaa70('0xaf'),_0x39fe44);rpcDb['createCustomerHistory'](_0x25b54d,_0xaa70('0xb0'));_0x5ed060[_0xaa70('0xa8')](_0x25b54d,'3',_0x347937)['then'](function(_0x4f0758){_0x583740=_0x4f0758[_0xaa70('0x7f')]==0x1;if(!_0x583740){if(ut[_0xaa70('0x7b')](_0x25b54d)>=_0x347937[_0xaa70('0x82')]){_0x3d73b0=ut[_0xaa70('0x83')](_0x25b54d,0xf,'Global');rpcDb[_0xaa70('0x6d')](_0x3d73b0,_0xaa70('0xb1'));}else{if(_0x25b54d['countnoanswerretry']>=_0x347937[_0xaa70('0xb2')]){rpcDb[_0xaa70('0x6d')](_0x25b54d,_0xaa70('0xb0'));}else{rpcDb['rescheduleContact'](ut[_0xaa70('0xab')](_0x25b54d,_0xaa70('0xb3'),_0x347937[_0xaa70('0xae')]),_0x25b54d[_0xaa70('0x88')],_0x25b54d[_0xaa70('0x89')]);}}}else{_0x25b54d[_0xaa70('0xb3')]++;_0x5ed060[_0xaa70('0xac')]({'id':_0x25b54d[_0xaa70('0x8a')],'field':{'countnoanswerretry':_0x25b54d[_0xaa70('0xb3')]}})['then'](function(){_0x5ed060[_0xaa70('0x8b')](_0x25b54d,_0x29209c,_0x9b428d)[_0xaa70('0x58')](function(){});});}});break;case _0xaa70('0xb4'):_0x347937[_0xaa70('0xb5')]+=0x1;_0x25b54d[_0xaa70('0xb6')]+=0x1;_0x25b54d[_0xaa70('0x99')]=ut['totalGlobal'](_0x25b54d);ut[_0xaa70('0x65')](_0x25b54d,0x8,_0xaa70('0xb7'));_0x29209c=_0x347937[_0xaa70('0xb8')];_0x9b428d=_0x347937[_0xaa70('0x81')];ami[_0xaa70('0x22')](_0xaa70('0xb9'),ut[_0xaa70('0x7d')](_0x25b54d,_0xaa70('0xba')));rpcDb['createCustomerHistory'](_0x25b54d,'[callProgressDetectingCustomer][logCongestion]');_0x5ed060['verifyAdditionalPhones'](_0x25b54d,'8',_0x347937)[_0xaa70('0x58')](function(_0x3db512){_0x583740=_0x3db512[_0xaa70('0x7f')]==0x1;if(!_0x583740){if(ut[_0xaa70('0x7b')](_0x25b54d)>=_0x347937['dialGlobalMaxRetry']){_0x3d73b0=ut[_0xaa70('0x83')](_0x25b54d,0xf,'Global');rpcDb['createCustomerFinal'](_0x3d73b0,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x25b54d[_0xaa70('0xb6')]>=_0x347937[_0xaa70('0xbb')]){rpcDb['createCustomerFinal'](_0x25b54d,_0xaa70('0xbc'));}else{rpcDb[_0xaa70('0x87')](ut[_0xaa70('0xab')](_0x25b54d,_0xaa70('0xb6'),_0x347937[_0xaa70('0xa4')]),_0x25b54d['unlockAgent'],_0x25b54d[_0xaa70('0x89')]);}}}else{_0x25b54d[_0xaa70('0xb6')]++;_0x5ed060[_0xaa70('0xac')]({'id':_0x25b54d['idContact'],'field':{'countcongestionretry':_0x25b54d[_0xaa70('0xb6')]}})[_0xaa70('0x58')](function(){_0x5ed060[_0xaa70('0x8b')](_0x25b54d,_0x29209c,_0x9b428d)[_0xaa70('0x58')](function(){});});}});break;case _0xaa70('0xbd'):_0x347937['outboundRejectCallsDay']+=0x1;_0x25b54d[_0xaa70('0xbe')]+=0x1;_0x25b54d['countglobal']=ut[_0xaa70('0x7b')](_0x25b54d);ut[_0xaa70('0x65')](_0x25b54d,0x14,_0xaa70('0xbf'));_0x29209c=_0x347937[_0xaa70('0xc0')];_0x9b428d=_0x347937['callAdditionalPhoneAfterMin'];ami[_0xaa70('0x22')](_0xaa70('0xc1'),ut[_0xaa70('0x7d')](_0x25b54d,_0xaa70('0xc2')));rpcDb[_0xaa70('0x6a')](_0x25b54d,'[syncHangupRequest][logAgentReject]');_0x5ed060[_0xaa70('0xa8')](_0x25b54d,'20',_0x347937)[_0xaa70('0x58')](function(_0x6be523){_0x583740=_0x6be523[_0xaa70('0x7f')]==0x1;if(!_0x583740){if(ut[_0xaa70('0x7b')](_0x25b54d)>=_0x347937[_0xaa70('0x82')]){_0x3d73b0=ut['cloneAction'](_0x25b54d,0x14,_0xaa70('0xbf'));rpcDb[_0xaa70('0x6d')](_0x3d73b0,_0xaa70('0xc3'));}else{if(_0x25b54d[_0xaa70('0xbe')]>=_0x347937[_0xaa70('0xc4')]){rpcDb[_0xaa70('0x6d')](_0x25b54d,_0xaa70('0xc3'));}else{rpcDb[_0xaa70('0x87')](ut['scheduledAt'](_0x25b54d,_0xaa70('0xbe'),_0x347937['dialAgentRejectRetryFrequency']),_0x25b54d[_0xaa70('0x88')],_0x25b54d['activeContact']);}}}else{_0x25b54d[_0xaa70('0xb3')]++;_0x5ed060[_0xaa70('0xac')]({'id':_0x25b54d['idContact'],'field':{'countnoanswerretry':_0x25b54d[_0xaa70('0xb3')]}})[_0xaa70('0x58')](function(){_0x5ed060[_0xaa70('0x8b')](_0x25b54d,_0x29209c,_0x9b428d)[_0xaa70('0x58')](function(){});});}});break;case _0xaa70('0xc5'):_0x347937[_0xaa70('0xc6')]+=0x1;_0x25b54d[_0xaa70('0xc7')]+=0x1;_0x25b54d[_0xaa70('0x99')]=ut['totalGlobal'](_0x25b54d);ut[_0xaa70('0x65')](_0x25b54d,0xb,_0xaa70('0xc8'));rpcDb[_0xaa70('0x6a')](_0x25b54d,_0xaa70('0xc9'));_0x5ed060[_0xaa70('0xa8')](_0x25b54d,'11',_0x347937)[_0xaa70('0x58')](function(_0x150f3a){_0x583740=_0x150f3a['additional']==0x1;if(!_0x583740){if(ut[_0xaa70('0x7b')](_0x25b54d)>=_0x347937[_0xaa70('0x82')]){_0x3d73b0=ut[_0xaa70('0x83')](_0x25b54d,0xf,_0xaa70('0x84'));rpcDb[_0xaa70('0x6d')](_0x3d73b0,_0xaa70('0xc9'));}else{if(_0x25b54d[_0xaa70('0xca')]>=_0x347937[_0xaa70('0xcb')]){rpcDb[_0xaa70('0x6d')](_0x25b54d,_0xaa70('0xc9'));}else{rpcDb['rescheduleContact'](ut[_0xaa70('0xab')](_0x25b54d,_0xaa70('0xc7'),_0x347937[_0xaa70('0xcc')]),_0x25b54d[_0xaa70('0x88')],_0x25b54d['activeContact']);}}}else{_0x25b54d['countnoanswerretry']++;_0x5ed060[_0xaa70('0xac')]({'id':_0x25b54d[_0xaa70('0x8a')],'field':{'countnoanswerretry':_0x25b54d[_0xaa70('0xb3')]}})['then'](function(){_0x5ed060[_0xaa70('0x8b')](_0x25b54d,_0x29209c,_0x9b428d)[_0xaa70('0x58')](function(){});});}});break;case'18':_0x347937['outboundUnknownCallsDay']+=0x1;_0x25b54d[_0xaa70('0xcd')]+=0x1;_0x25b54d[_0xaa70('0x99')]=ut[_0xaa70('0x7b')](_0x25b54d);ut[_0xaa70('0x65')](_0x25b54d,0x12,_0x58c48e[_0xaa70('0xce')]||_0x58c48e[_0xaa70('0xcf')]);ami[_0xaa70('0x22')](_0xaa70('0xd0'),ut[_0xaa70('0x7d')](_0x25b54d,_0xaa70('0xd1')));rpcDb[_0xaa70('0x6a')](_0x25b54d,_0xaa70('0xd2'));_0x5ed060[_0xaa70('0xa8')](_0x25b54d,'18',_0x347937)[_0xaa70('0x58')](function(_0x291724){_0x583740=_0x291724[_0xaa70('0x7f')]==0x1;if(!_0x583740){if(ut[_0xaa70('0x7b')](_0x25b54d)>=_0x347937['dialGlobalMaxRetry']){_0x3d73b0=ut['cloneAction'](_0x25b54d,0x12,'Global');rpcDb[_0xaa70('0x6d')](_0x3d73b0,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xaa70('0x6d')](_0x25b54d,_0xaa70('0xd2'));}}else{_0x25b54d['countnoanswerretry']++;_0x5ed060['incrementPreviewCounters']({'id':_0x25b54d[_0xaa70('0x8a')],'field':{'countnoanswerretry':_0x25b54d[_0xaa70('0xb3')]}})[_0xaa70('0x58')](function(){_0x5ed060['swapAdditionalPhones'](_0x25b54d,_0x29209c,_0x9b428d)[_0xaa70('0x58')](function(){});});}});delete this['actions'][_0x58c48e['linkedid']];break;case'19':_0x347937[_0xaa70('0xd3')]+=0x1;_0x25b54d['countglobal']=ut[_0xaa70('0x7b')](_0x25b54d);ut['logCustomer'](_0x25b54d,0x13,_0x58c48e[_0xaa70('0xce')]||_0x58c48e[_0xaa70('0xcf')]);ami['emit']('custom:amd',ut[_0xaa70('0x7d')](_0x25b54d,'amd'));rpcDb[_0xaa70('0x6a')](_0x25b54d,_0xaa70('0xd4'));_0x5ed060[_0xaa70('0xa8')](_0x25b54d,'18',_0x347937)['then'](function(_0x52da8e){_0x583740=_0x52da8e[_0xaa70('0x7f')]==0x1;if(!_0x583740){if(ut[_0xaa70('0x7b')](_0x25b54d)>=_0x347937[_0xaa70('0x82')]){_0x3d73b0=ut[_0xaa70('0x83')](_0x25b54d,0xf,_0xaa70('0x84'));rpcDb['createCustomerFinal'](_0x3d73b0,_0xaa70('0xd4'));}else{rpcDb[_0xaa70('0x6d')](_0x25b54d,'[callProgressDetectingCustomer][machine]');}}else{_0x25b54d[_0xaa70('0xb3')]++;_0x5ed060[_0xaa70('0xac')]({'id':_0x25b54d['idContact'],'field':{'countnoanswerretry':_0x25b54d[_0xaa70('0xb3')]}})[_0xaa70('0x58')](function(){_0x5ed060[_0xaa70('0x8b')](_0x25b54d,_0x29209c,_0x9b428d)['then'](function(){});});}});delete this['actions'][_0x58c48e[_0xaa70('0xa1')]];break;default:if(_0x25b54d[_0xaa70('0x45')]){ut[_0xaa70('0x50')](_0x347937,_0xaa70('0xd5'));ut[_0xaa70('0x51')](_0xaa70('0xd6')+_0x347937[_0xaa70('0x26')],_0x58c48e);}_0x347937[_0xaa70('0xd3')]+=0x1;_0x25b54d['countglobal']=ut[_0xaa70('0x7b')](_0x25b54d);ut[_0xaa70('0x65')](_0x25b54d,0xc,_0x58c48e[_0xaa70('0xce')]||_0x58c48e[_0xaa70('0xcf')]);_0x29209c=_0x347937[_0xaa70('0xc0')];_0x9b428d=_0x347937['callAdditionalPhoneAfterMin'];rpcDb[_0xaa70('0x6a')](_0x25b54d,'[callProgressDetectingCustomer][logUnknown]');_0x5ed060[_0xaa70('0xa8')](_0x25b54d,'20',_0x347937)[_0xaa70('0x58')](function(_0x36f54e){_0x583740=_0x36f54e['additional']==0x1;if(!_0x583740){if(ut[_0xaa70('0x7b')](_0x25b54d)>=_0x347937[_0xaa70('0x82')]){_0x3d73b0=ut['cloneAction'](_0x25b54d,0xf,'Global');rpcDb[_0xaa70('0x6d')](_0x3d73b0,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xaa70('0x6d')](_0x25b54d,_0xaa70('0xd7'));}delete this[_0xaa70('0x3f')][_0x58c48e[_0xaa70('0xa1')]];}else{_0x5ed060[_0xaa70('0x8b')](_0x25b54d,_0x29209c,_0x9b428d)['then'](function(){});}});}if(!(_0x25b54d[_0xaa70('0x45')]&&_0x230939==='16')){utils['decrementOriginate'](_0x347937,_0xaa70('0xd8'));logger[_0xaa70('0x53')](_0xaa70('0xd9'),_0x25b54d[_0xaa70('0x90')],'\x20Queue',_0x347937[_0xaa70('0x26')],'originated:\x20',_0x347937['originated']);}if(_0x230939!==_0xaa70('0x8c')){delete this[_0xaa70('0x3f')][_0x58c48e[_0xaa70('0xa1')]];delete this[_0xaa70('0x3f')][_0x58c48e[_0xaa70('0xda')]];}_0x347937['queueSummaryCountersUpdated']=!![];}};Preview[_0xaa70('0x32')][_0xaa70('0xdb')]=function(_0x124e0e,_0x256532,_0x4e02c8){if(_[_0xaa70('0xdc')](_0x256532)&&_0xaa70('0xdd')!==typeof _0x256532){return;}if(_[_0xaa70('0xdc')](_0x4e02c8)&&_0xaa70('0xdd')!==typeof _0x4e02c8){return;}switch(_0x4e02c8[_0xaa70('0xde')]){case'0':ut[_0xaa70('0xdf')](_0x124e0e,0x0,_0xaa70('0xe0'));rpcDb[_0xaa70('0xe1')](_0x124e0e,_0xaa70('0xe2'));break;case'3':ut[_0xaa70('0xdf')](_0x124e0e,0x3,_0xaa70('0xe3'));rpcDb[_0xaa70('0xe1')](_0x124e0e,_0xaa70('0xe4'));break;case'5':ut['logAgent'](_0x124e0e,0x5,_0xaa70('0xe5'));rpcDb['createAgentHistory'](_0x124e0e,_0xaa70('0xe6'));break;case'8':ut[_0xaa70('0xdf')](_0x124e0e,0x8,'Congestion');rpcDb[_0xaa70('0xe1')](_0x124e0e,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xaa70('0xdf')](_0x124e0e,0x16,_0xaa70('0xe7'));rpcDb[_0xaa70('0xe1')](_0x124e0e,_0xaa70('0xe8'));break;default:ut[_0xaa70('0xdf')](_0x124e0e,0xc,_0x4e02c8['reason']);rpcDb[_0xaa70('0xe1')](_0x124e0e,_0xaa70('0xe9'));}utils[_0xaa70('0xea')](_0x256532,_0xaa70('0xeb'));logger[_0xaa70('0x53')](_0xaa70('0xec'),_0x124e0e[_0xaa70('0x90')],_0xaa70('0xed'),_0x256532[_0xaa70('0x26')],_0xaa70('0xee'),_0x256532[_0xaa70('0x2a')]);delete this[_0xaa70('0x3f')][_0x124e0e[_0xaa70('0x90')]];};Preview['prototype'][_0xaa70('0xa8')]=function(_0x3c5a58,_0x221db6,_0x562fc5){return cmHopperAdditionalPhone[_0xaa70('0xa8')](_0x3c5a58,_0x221db6,_0x562fc5)[_0xaa70('0x62')](logger[_0xaa70('0x53')]('[verifyAdditionalPhone]\x20'));};Preview[_0xaa70('0x32')]['swapAdditionalPhones']=function(_0x579a94,_0x10e155,_0x1d035d){return cmHopperAdditionalPhone[_0xaa70('0x8b')](_0x579a94,_0x10e155,_0x1d035d)[_0xaa70('0x62')](logger[_0xaa70('0x53')]('[swapAdditionalPhone]\x20'));};Preview['prototype'][_0xaa70('0xac')]=function(_0x4456d5){return Promise['resolve']()['then'](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x4456d5))['catch'](logger['info'](_0xaa70('0xef')));};Preview[_0xaa70('0x32')][_0xaa70('0xf0')]=function(_0x1c40ae,_0x3a7e47,_0x6fce62,_0x22b97f,_0x28dad2){var _0x31699e=this;return new Promise(function(_0x3fe7a7,_0x15afc7){if(_[_0xaa70('0x3e')](_0x3a7e47)||_['isNil'](_0x3a7e47[_0xaa70('0xf1')])||_[_0xaa70('0x3e')](_0x3a7e47[_0xaa70('0xf2')])||_[_0xaa70('0x3e')](_0x3a7e47[_0xaa70('0x49')])){_0x15afc7(ut[_0xaa70('0x4d')]('Contact\x20is\x20undefined',_0x22b97f,_0x28dad2));return;}var _0x35234e=uuid['v4']();var _0x5c9535=_0x31699e[_0xaa70('0xf')][_0x3a7e47[_0xaa70('0x41')]['name']];var _0x2274f1=_0x6fce62?_0x31699e['agents'][_0x6fce62]['id']:undefined;_0x31699e[_0xaa70('0x3f')][_0x35234e]=new Action(_0x3a7e47,_0x5c9535,_0x35234e,_0x6fce62,_0x2274f1);var _0x525884=_0x31699e[_0xaa70('0x3f')][_0x35234e];_0x525884[_0xaa70('0x88')]=_0x22b97f;_0x525884[_0xaa70('0x89')]=_0x28dad2;_0x525884['lookAgent']=_0x6fce62;if(_[_0xaa70('0xf3')](_0x1c40ae)){_0x31699e['execCall'](_0x525884,_0x5c9535,_0x3a7e47,_0x6fce62)['then'](function(_0x4252e3){logger[_0xaa70('0x53')]('[Preview][execCall][success]',_0xaa70('0xf4')+_0x525884[_0xaa70('0x42')]+_0xaa70('0xf5')+_0x525884['idContact'],JSON['stringify'](_0x4252e3));ami[_0xaa70('0x22')](_0xaa70('0xf6'),ut[_0xaa70('0x7d')](_0x525884,_0xaa70('0xf7'),_0x31699e[_0xaa70('0xf')][_0x525884[_0xaa70('0x42')]]));_0x3fe7a7(ut[_0xaa70('0x4d')](_0xaa70('0xf8')));})[_0xaa70('0x62')](function(_0x1e9993){ut[_0xaa70('0x2f')](_0xaa70('0xf9'),_0x1e9993);_0x15afc7(ut[_0xaa70('0x4d')](_0xaa70('0xfa'),_0x22b97f,_0x28dad2));});}else{_0x5c9535[_0xaa70('0xfb')]+=0x1;ut[_0xaa70('0xfc')](_0x525884);rpcDb['createHistory'](_0x525884,'[Blacklist][error]');delete _0x31699e[_0xaa70('0x3f')][_0x35234e];_0x15afc7(ut[_0xaa70('0x4d')]('Contact\x20in\x20black\x20List',_0x22b97f,_0x28dad2));}});};Preview['prototype'][_0xaa70('0x75')]=function(_0xc5041c){return!_['isNil'](_0xc5041c)&&!_[_0xaa70('0x3e')](_0xc5041c['name'])&&!_[_0xaa70('0x3e')](_0xc5041c[_0xaa70('0xfd')])&&_0xc5041c[_0xaa70('0xfd')]&&!_[_0xaa70('0x3e')](this[_0xaa70('0x11')][util[_0xaa70('0x24')](_0xaa70('0xfe'),_0xc5041c[_0xaa70('0x26')])])&&!_[_0xaa70('0x3e')](this[_0xaa70('0x11')][util['format'](_0xaa70('0xfe'),_0xc5041c[_0xaa70('0x26')])][_0xaa70('0x4b')])&&(this['trunks'][util[_0xaa70('0x24')]('SIP/%s',_0xc5041c[_0xaa70('0x26')])]['status']==='reachable'||this['trunks'][util[_0xaa70('0x24')](_0xaa70('0xfe'),_0xc5041c[_0xaa70('0x26')])][_0xaa70('0x4b')]==='unmonitored');};Preview[_0xaa70('0x32')][_0xaa70('0x5f')]=function(_0x15ce8f,_0x6ff7a5){return this[_0xaa70('0xff')](_0x15ce8f,_0x6ff7a5)['then'](function(_0x1e917b){return _['pick'](_0x1e917b,[_0xaa70('0x4d')]);})[_0xaa70('0x62')](function(_0x42da84){if(_0x42da84[_0xaa70('0x100')]){rpcDb[_0xaa70('0x101')](_0x15ce8f);}if(_0x42da84[_0xaa70('0xfd')]){rpcDb[_0xaa70('0x63')](_0x15ce8f);}throw _[_0xaa70('0x46')](_0x42da84,[_0xaa70('0x4d')]);});};Preview[_0xaa70('0x32')][_0xaa70('0xff')]=function(_0x431ae5,_0x412ba2){var _0x229c25=this;var _0x4daa37,_0x38dcf7;return rpcDb[_0xaa70('0x102')](_0x431ae5)['then'](function(_0x2f9e21){if(!_['isNil'](_0x2f9e21[0x0])){_0x38dcf7=_0x2f9e21[0x0][_0xaa70('0x103')]?![]:!![];_0x4daa37=_0x2f9e21[0x0][_0xaa70('0x103')]?!![]:![];_0x4daa37=_0x412ba2?!![]:_0x4daa37;}var _0x3a28c0=_0x229c25[_0xaa70('0x104')](_0x2f9e21);if(_0x3a28c0['isValid']){rpcDb['checkIsBlackList'](_[_0xaa70('0x46')](_0x2f9e21[0x0],[_0xaa70('0x49'),'phone']))[_0xaa70('0x58')](function(_0x55c837){_0x229c25[_0xaa70('0xf0')](_0x55c837,_0x2f9e21[0x0],_0x412ba2,_0x38dcf7,_0x4daa37)['then'](function(_0x4be1f5){return _0x4be1f5;})[_0xaa70('0x62')](function(_0xd03a04){throw _0xd03a04;});})[_0xaa70('0x62')](function(_0x22791a){ut['logger'](_0xaa70('0x105'),_0x22791a);throw ut[_0xaa70('0x4d')](_0xaa70('0x106'),_0x38dcf7,_0x4daa37);});}else{throw ut[_0xaa70('0x4d')](_0x3a28c0[_0xaa70('0x4d')],_0x38dcf7,_0x4daa37);}})[_0xaa70('0x62')](function(_0x505ae1){ut[_0xaa70('0x2f')](_0xaa70('0x107'),_0x505ae1);throw ut[_0xaa70('0x4d')](_0xaa70('0x106'),![],!![]);});};Preview[_0xaa70('0x32')][_0xaa70('0x104')]=function(_0x598587){if(_[_0xaa70('0x3e')](_0x598587)||_['isEmpty'](_0x598587)||!_[_0xaa70('0x3e')](_0x598587[0x0][_0xaa70('0x5d')])&&_[_0xaa70('0x3e')](_0x598587[0x0][_0xaa70('0x5d')][_0xaa70('0x26')])){ut[_0xaa70('0x2f')](_0xaa70('0x108'),_0x598587);return{'isValid':![],'message':_0xaa70('0x109')};}var _0x5bf999=this['campaignsPreview'][_0x598587[0x0][_0xaa70('0x41')][_0xaa70('0x26')]];_0x5bf999[_0xaa70('0x4d')]=utils[_0xaa70('0x2d')][_0xaa70('0x78')];if(_[_0xaa70('0x3e')](_0x5bf999)){ut[_0xaa70('0x2f')](_0xaa70('0x10a'),_0x5bf999);return{'isValid':![],'message':_0xaa70('0x10b')};}if(!this[_0xaa70('0x75')](_0x5bf999[_0xaa70('0x76')])){ut[_0xaa70('0x2f')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0xaa70('0x10c')+_0x5bf999['name']+_0xaa70('0x10d'));if(!this['isTrunkReachable'](_0x5bf999[_0xaa70('0x77')])){ut[_0xaa70('0x2f')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x5bf999[_0xaa70('0x26')]+_0xaa70('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0x5bf999[_0xaa70('0x3b')])){ut['logger'](_0xaa70('0x10f'),_0x5bf999[_0xaa70('0x26')]+_0xaa70('0x110'));return{'isValid':![],'message':_0xaa70('0x10c')+_0x5bf999[_0xaa70('0x26')]+_0xaa70('0x110')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xaa70('0x32')][_0xaa70('0x111')]=function(_0x32fa75,_0x5af470,_0x5bc6fb,_0x1998ac){var _0x422035=this;return new Promise(function(_0x2253f0,_0x1124b2){var _0xc9a96b=_0x32fa75[_0xaa70('0x90')];var _0x431988=_0x422035[_0xaa70('0x75')](_0x5af470['Trunk'])?util[_0xaa70('0x24')](_0xaa70('0x112'),_0x5af470[_0xaa70('0x76')]['name'],_[_0xaa70('0x3e')](_0x5af470[_0xaa70('0x113')])?'':_0x5af470[_0xaa70('0x113')][_0xaa70('0x114')]()||'',_0x5af470['dialCutDigit']>0x0?_0x5bc6fb[_0xaa70('0xf2')][_0xaa70('0x115')](_0x5af470['dialCutDigit']):_0x5bc6fb['phone']):util[_0xaa70('0x24')]('SIP/%s/%s%s',_[_0xaa70('0x3e')](_0x5af470[_0xaa70('0x77')])?_0x5af470[_0xaa70('0x76')][_0xaa70('0x26')]:_0x5af470[_0xaa70('0x77')][_0xaa70('0x26')],_[_0xaa70('0x3e')](_0x5af470['dialPrefix'])?'':_0x5af470[_0xaa70('0x113')][_0xaa70('0x114')]()||'',_0x5af470[_0xaa70('0x116')]>0x0?_0x5bc6fb[_0xaa70('0xf2')][_0xaa70('0x115')](_0x5af470[_0xaa70('0x116')]):_0x5bc6fb['phone']);var _0x2229b7=_0x422035['isTrunkReachable'](_0x5af470[_0xaa70('0x76')])?ut[_0xaa70('0x117')](_0x5af470[_0xaa70('0x76')][_0xaa70('0x118')],_0x5af470[_0xaa70('0x119')],_0x5af470['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x5af470[_0xaa70('0x11a')],_0x5af470['dialRandomLastDigitCallerIdNumber']):_0x5af470[_0xaa70('0x11a')]):ut[_0xaa70('0x117')](_[_0xaa70('0x3e')](_0x5af470[_0xaa70('0x77')])?_0x5af470[_0xaa70('0x76')][_0xaa70('0x118')]:_0x5af470[_0xaa70('0x77')]['callerid'],_0x5af470[_0xaa70('0x119')],_0x5af470[_0xaa70('0x11b')]>0x0?ut[_0xaa70('0x11c')](_0x5af470['dialOriginateCallerIdNumber'],_0x5af470['dialRandomLastDigitCallerIdNumber']):_0x5af470[_0xaa70('0x11a')]);if(_0x2229b7){_0x32fa75[_0xaa70('0x11d')]=ut[_0xaa70('0x11e')](_0x2229b7);_0x32fa75[_0xaa70('0x11f')]=ut[_0xaa70('0x120')](_0x2229b7);}var _0x4f3306=ut[_0xaa70('0x121')](_0x5af470,_0x5bc6fb,_0x431988,_0x2229b7,_0xc9a96b,_0x32fa75);var _0x510c17=utils['setXMDContactVariables'](_0x5bc6fb[_0xaa70('0xf1')]);Object[_0xaa70('0x122')](_0x4f3306,_0x510c17);_[_0xaa70('0x123')](_0x32fa75,ut[_0xaa70('0x124')](_0x4f3306));_0x32fa75[_0xaa70('0x125')]=moment()['format'](_0xaa70('0x64'));_0x5af470['variables']=_0x4f3306;var _0x1552d8=ut[_0xaa70('0x126')](_0x32fa75,_0x5af470,_0x4f3306,_0x32fa75[_0xaa70('0x89')],_0x1998ac);return ami['Action'](_0x1552d8)[_0xaa70('0x58')](function(_0x3a6580){_0x5af470[_0xaa70('0x2a')]+=0x1;logger[_0xaa70('0x53')](_0xaa70('0x127'),_0xc9a96b,_0xaa70('0xed'),_0x5af470[_0xaa70('0x26')],_0xaa70('0xee'),_0x5af470[_0xaa70('0x2a')]);_0x2253f0(_0x3a6580);})[_0xaa70('0x62')](function(_0x58b27d){ut[_0xaa70('0xdf')](_0x32fa75,0xe,_0xaa70('0x128'));rpcDb[_0xaa70('0xe1')](_0x32fa75,_0xaa70('0x129'));_0x1124b2(_0x58b27d);});});};Preview['prototype'][_0xaa70('0x1c')]=function(_0x3b31cf){if(this[_0xaa70('0x3f')][_0x3b31cf[_0xaa70('0xa1')]]){this[_0xaa70('0x3f')][_0x3b31cf[_0xaa70('0xa1')]][_0xaa70('0x4c')]=_0x3b31cf[_0xaa70('0x4c')];}};Preview[_0xaa70('0x32')][_0xaa70('0x12a')]=function(_0x45ce39){var _0x3b279b=this;var _0x54af10=this[_0xaa70('0x3f')][_0x45ce39[_0xaa70('0x12b')]];if(_0x54af10){if(_0x54af10[_0xaa70('0x12c')]&&this['agents'][_0x54af10[_0xaa70('0x12c')]]){ut[_0xaa70('0x12d')](_0x54af10,this[_0xaa70('0x12')][_0x54af10[_0xaa70('0x12c')]][_0xaa70('0x26')],this[_0xaa70('0x12')][_0x54af10[_0xaa70('0x12c')]]['id']);}var _0x5aa667=_[_0xaa70('0x12e')](_0x54af10);_0x5aa667[_0xaa70('0x8d')]=moment()[_0xaa70('0x24')](_0xaa70('0x64'));var _0xb1baed=_0x3b279b['campaignsPreview'][_0x54af10[_0xaa70('0x42')]];if(ut['isFailure'](_0x45ce39[_0xaa70('0x12f')])){if(_0x54af10[_0xaa70('0x88')]){rpcDb[_0xaa70('0x101')](_0x54af10[_0xaa70('0x8a')]);}if(_0x54af10[_0xaa70('0x89')]){rpcDb[_0xaa70('0x63')](_0x54af10[_0xaa70('0x8a')]);}ami[_0xaa70('0x22')](_0xaa70('0x130'),ut['buildObj'](_0x54af10,'rejected',this['campaignsPreview'][_0x54af10[_0xaa70('0x42')]]));this[_0xaa70('0xdb')](_0x5aa667,_0xb1baed,_0x45ce39);}else{_0x54af10[_0xaa70('0x125')]=moment()[_0xaa70('0x24')](_0xaa70('0x64'));ut[_0xaa70('0xdf')](_0x5aa667,0x4,_0xaa70('0x9a'));rpcDb[_0xaa70('0xe1')](_0x5aa667,_0xaa70('0x131'));}}};Preview[_0xaa70('0x32')][_0xaa70('0x17')]=function(_0x29cd4e){var _0xed3ec8=this[_0xaa70('0x3f')][_0x29cd4e['linkedid']];var _0xe47cdd;if(_0xed3ec8){_0xe47cdd=this[_0xaa70('0xf')][_0xed3ec8[_0xaa70('0x42')]];logger[_0xaa70('0x53')](_0xaa70('0x132'),_0x29cd4e[_0xaa70('0xa1')],_0xaa70('0xed'),_0xe47cdd[_0xaa70('0x26')],'pTalking:\x20',_0xe47cdd[_0xaa70('0x44')]);}if(this[_0xaa70('0x3f')][_0x29cd4e[_0xaa70('0xa1')]]&&_0x29cd4e[_0xaa70('0xa1')]!==_0x29cd4e[_0xaa70('0x90')]){if(_0x29cd4e[_0xaa70('0x133')]==='16'&&this[_0xaa70('0x3f')][_0x29cd4e[_0xaa70('0xa1')]]['dialAnswer']){this[_0xaa70('0x134')](_0x29cd4e,_0x29cd4e[_0xaa70('0xa1')],_0x29cd4e[_0xaa70('0x133')]);}else if(this['actions'][_0x29cd4e['linkedid']]['dialAnswer']){logger['info']('[syncHangup][talking][cause]',_0x29cd4e['linkedid'],_0x29cd4e[_0xaa70('0x133')],'\x20Queue',_0xe47cdd['name'],'pTalking:\x20',_0xe47cdd[_0xaa70('0x44')]);this[_0xaa70('0x134')](_0x29cd4e,_0x29cd4e['linkedid'],_0x29cd4e[_0xaa70('0x133')]);}}else if(_0xed3ec8&&_[_0xaa70('0x3e')](_0xed3ec8[_0xaa70('0x135')])&&_0xe47cdd[_0xaa70('0x136')]&&_0x29cd4e[_0xaa70('0xa1')]===_0x29cd4e[_0xaa70('0x90')]&&_[_0xaa70('0x3e')](_0x29cd4e[_0xaa70('0xde')])&&_0x29cd4e[_0xaa70('0x133')]==='16'&&_0x29cd4e['channelstate']==='6'&&_[_0xaa70('0xdc')](_0xed3ec8[_0xaa70('0x137')])){if(_0xed3ec8[_0xaa70('0x88')]){rpcDb[_0xaa70('0x101')](_0xed3ec8[_0xaa70('0x8a')]);}if(_0xed3ec8[_0xaa70('0x89')]){rpcDb[_0xaa70('0x63')](_0xed3ec8['idContact']);}_0x29cd4e['reason']='22';this['callProgressDetectingAgent'](_0xed3ec8,_0xe47cdd,_0x29cd4e);}else if(_0xed3ec8&&_0xed3ec8[_0xaa70('0x137')]){if(_0x29cd4e[_0xaa70('0x133')]==='16'&&this[_0xaa70('0x3f')][_0x29cd4e[_0xaa70('0xa1')]][_0xaa70('0x45')]){logger[_0xaa70('0x53')](_0xaa70('0x138'),_0x29cd4e[_0xaa70('0xa1')],_0x29cd4e[_0xaa70('0x133')],_0xaa70('0xed'),_0xe47cdd[_0xaa70('0x26')],_0xaa70('0x43'),_0xe47cdd['pTalking']);this[_0xaa70('0x134')](_0x29cd4e,_0x29cd4e['linkedid'],_0x29cd4e[_0xaa70('0x133')]);}else if(this[_0xaa70('0x3f')][_0x29cd4e[_0xaa70('0xa1')]][_0xaa70('0x45')]){logger[_0xaa70('0x53')](_0xaa70('0x139'),_0x29cd4e[_0xaa70('0xa1')],_0x29cd4e[_0xaa70('0x133')],_0xaa70('0xed'),_0xe47cdd['name'],'pTalking:\x20',_0xe47cdd[_0xaa70('0x44')]);this[_0xaa70('0x134')](_0x29cd4e,_0x29cd4e[_0xaa70('0xa1')],_0x29cd4e[_0xaa70('0x133')]);}}};Preview[_0xaa70('0x32')][_0xaa70('0x1a')]=function(_0xd8e43d){if(this[_0xaa70('0x3f')][_0xd8e43d[_0xaa70('0xda')]]&&_0xd8e43d[_0xaa70('0xda')]!==_0xd8e43d['destuniqueid']){this[_0xaa70('0x134')](_0xd8e43d,_0xd8e43d['destlinkedid'],_0xd8e43d[_0xaa70('0xcf')]);}};Preview[_0xaa70('0x32')][_0xaa70('0x13a')]=function(_0x299ded){if(this[_0xaa70('0x3f')][_0x299ded[_0xaa70('0xa1')]]&&_0x299ded[_0xaa70('0xa1')]!==_0x299ded[_0xaa70('0x90')]&&!this['actions'][_0x299ded[_0xaa70('0xa1')]][_0xaa70('0x45')]){if(_0x299ded['cause']==='1'){this[_0xaa70('0x134')](_0x299ded,_0x299ded[_0xaa70('0xa1')],_0x299ded[_0xaa70('0x133')]);}}};Preview[_0xaa70('0x32')][_0xaa70('0x13b')]=function(_0x46e4df,_0x43859a,_0x4ff338){if(this[_0xaa70('0x3f')][_0x46e4df]){if(_[_0xaa70('0x3e')](this[_0xaa70('0x3f')][_0x46e4df][_0xaa70('0x13c')])){this['actions'][_0x46e4df][_0xaa70('0x13c')]={};}this[_0xaa70('0x3f')][_0x46e4df][_0xaa70('0x13c')][_0x43859a]=_0x4ff338;}};Preview['prototype']['syncVarSet']=function(_0x3ce89f){try{if(!_[_0xaa70('0x3e')](_0x3ce89f)){if(ut[_0xaa70('0x13d')](_[_0xaa70('0x13e')](_0x3ce89f[_0xaa70('0x13f')])[0x0])){this['addVariable'](_0x3ce89f[_0xaa70('0x90')],_[_0xaa70('0x13e')](_0x3ce89f['variable'])[0x0],_0x3ce89f[_0xaa70('0x140')]);}}}catch(_0x3bf967){logger[_0xaa70('0x141')](_0xaa70('0x142'),util[_0xaa70('0x143')](_0x3bf967,{'showHidden':![],'depth':null}));}};Preview[_0xaa70('0x32')][_0xaa70('0x144')]=function(_0x15d15a){if(_0x15d15a){if(this[_0xaa70('0x3f')][_0x15d15a[_0xaa70('0x145')]]){this[_0xaa70('0x3f')][_0x15d15a[_0xaa70('0x145')]]['transfer']=!![];}}};Preview[_0xaa70('0x32')][_0xaa70('0x146')]=function(_0x5d05db){if(_0x5d05db){if(this[_0xaa70('0x3f')][_0x5d05db[_0xaa70('0x147')]]){this[_0xaa70('0x3f')][_0x5d05db['transfererlinkedid']][_0xaa70('0x137')]=!![];}}};module[_0xaa70('0x148')]=Preview; \ No newline at end of file +var _0x9a18=['finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','name','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','logger','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','preview','dialMethod','type','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','UserId','VoiceQueueId','ListId','Action','channel','No\x20such\x20channel','decrementOriginate','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','catch','disableContact','starttime','format','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','loggedIn','NO_AGENTS_LOGGED','isActive','Trunk','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','NoSuchNumber','custom:agentnosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','mandatoryDisposition','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','total','[16]','totalGlobal','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','countglobal','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countcongestionretry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','createAgentHistory','logAgent','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','\x20IdHopper:\x20','Calling','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','pick','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][getContactPreview]','Call\x20unsuccessful','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','getCallerIdRandom','originatecalleridname','extractCalleridNumber','assign','merge','toLowerVariables','variables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','response','unlockContact','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','exports','util','lodash','uuid','moment','ioredis','../../../config/logger','./action','./util/util','redis','socket.io-emitter','prototype','enqueue','tail'];(function(_0x283ca5,_0x259097){var _0x2f3270=function(_0x46711d){while(--_0x46711d){_0x283ca5['push'](_0x283ca5['shift']());}};_0x2f3270(++_0x259097);}(_0x9a18,0x13a));var _0x89a1=function(_0x1c18ca,_0x3da48c){_0x1c18ca=_0x1c18ca-0x0;var _0xbff7c4=_0x9a18[_0x1c18ca];return _0xbff7c4;};'use strict';var util=require(_0x89a1('0x0'));var _=require(_0x89a1('0x1'));var uuid=require(_0x89a1('0x2'));var moment=require(_0x89a1('0x3'));var Redis=require(_0x89a1('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x89a1('0x5'))('actionPreview');var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x89a1('0x6'));var ut=require(_0x89a1('0x7'));var utils=require('../dialer/utils');config[_0x89a1('0x8')]=_['defaults'](config[_0x89a1('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x89a1('0x9'))(new Redis(config[_0x89a1('0x8')]));var Sequence=function(){};Sequence[_0x89a1('0xa')][_0x89a1('0xb')]=function(_0x23430c){this[_0x89a1('0xc')]=this[_0x89a1('0xc')]?this['tail'][_0x89a1('0xd')](_0x23430c):_0x23430c();};function Preview(_0x479afe){this[_0x89a1('0xe')]=new Sequence();this[_0x89a1('0xf')]=_0x479afe[_0x89a1('0x10')];this[_0x89a1('0x11')]=_0x479afe[_0x89a1('0x11')];this[_0x89a1('0x12')]={};this[_0x89a1('0x13')]=_0x479afe['agents'];this[_0x89a1('0x14')]=0x0;ami['on']('originateresponse',this[_0x89a1('0x15')][_0x89a1('0x16')](this));ami['on'](_0x89a1('0x17'),this[_0x89a1('0x18')][_0x89a1('0x16')](this));ami['on'](_0x89a1('0x19'),this[_0x89a1('0x1a')][_0x89a1('0x16')](this));ami['on'](_0x89a1('0x1b'),this[_0x89a1('0x1c')]['bind'](this));ami['on'](_0x89a1('0x1d'),this[_0x89a1('0x1e')][_0x89a1('0x16')](this));ami['on'](_0x89a1('0x1f'),this[_0x89a1('0x20')][_0x89a1('0x16')](this));ami['on'](_0x89a1('0x21'),this[_0x89a1('0x22')][_0x89a1('0x16')](this));ami['on'](_0x89a1('0x23'),this['syncBlindTransfer']['bind'](this));this[_0x89a1('0x24')](this[_0x89a1('0xf')]);}function emit(_0x1ce4a8,_0x47cf3d,_0x6b8b53){io['to'](_0x1ce4a8)['emit'](_0x47cf3d,_0x6b8b53);}function emitVoiceQueueChannelRemove(_0x4f677a){logger[_0x89a1('0x25')](_0x89a1('0x26'),JSON[_0x89a1('0x27')](_0x4f677a));emit(util['format'](_0x89a1('0x28'),_0x4f677a[_0x89a1('0x29')]),_0x89a1('0x2a'),_0x4f677a);io[_0x89a1('0x2b')](_0x89a1('0x2c'),_0x4f677a);}function notSendMessagesQueue(_0x703ac7){if(_0x703ac7[_0x89a1('0x2d')]){if(_0x703ac7[_0x89a1('0x2e')]===0x0&&_0x703ac7[_0x89a1('0x2f')]===0x0){_0x703ac7[_0x89a1('0x2d')]=![];_0x703ac7[_0x89a1('0x30')]=0x0;_0x703ac7[_0x89a1('0x31')]=0x0;_0x703ac7[_0x89a1('0x32')]=utils[_0x89a1('0x33')][_0x89a1('0x34')];ut['logger'](_0x89a1('0x35'),_0x703ac7[_0x89a1('0x29')]+_0x89a1('0x36'));}else{_0x703ac7[_0x89a1('0x32')]=utils[_0x89a1('0x33')]['DEACTIVATED'];ut[_0x89a1('0x37')](_0x89a1('0x35'),_0x703ac7[_0x89a1('0x29')]+_0x89a1('0x38'));}}}Preview['prototype']['loopCampaigns']=function(){var _0x393647=this;setInterval(function(){_0x393647[_0x89a1('0x39')]();},0x7cf);};Preview[_0x89a1('0xa')][_0x89a1('0x39')]=function(){var _0x5535da=this[_0x89a1('0xf')];this[_0x89a1('0x14')]+=0x1;for(var _0x2dc141 in _0x5535da){if(_0x5535da[_0x89a1('0x3a')](_0x2dc141)&&(_0x5535da[_0x2dc141]['dialMethod']===_0x89a1('0x3b')||_0x5535da[_0x2dc141][_0x89a1('0x3c')]==='booked')&&_0x5535da[_0x2dc141][_0x89a1('0x3d')]===_0x89a1('0x3e')){if(this[_0x89a1('0x14')]>0x7){this[_0x89a1('0x14')]=0x0;this[_0x89a1('0x3f')]();}}if(_0x5535da[_0x89a1('0x3a')](_0x2dc141)&&_0x5535da[_0x2dc141][_0x89a1('0x3c')]===_0x89a1('0x3b')&&_0x5535da[_0x2dc141][_0x89a1('0x3d')]===_0x89a1('0x3e')){if(_0x5535da[_0x2dc141][_0x89a1('0x40')]){this[_0x89a1('0x41')](_0x5535da[_0x2dc141]);if(_0x5535da[_0x2dc141][_0x89a1('0x42')])this[_0x89a1('0x43')](_0x5535da[_0x2dc141]);}else{notSendMessagesQueue(_0x5535da[_0x2dc141]);}}}};Preview['prototype'][_0x89a1('0x44')]=function(_0xc6e77a){var _0x5401f1=this;this['sequence'][_0x89a1('0xb')](function(){if(!_[_0x89a1('0x45')](_0x5401f1[_0x89a1('0x12')][_0xc6e77a])){loggerAction[_0x89a1('0x25')](_0x89a1('0x46'),_0xc6e77a,_0x89a1('0x47'),_0x5401f1[_0x89a1('0x12')][_0xc6e77a][_0x89a1('0x48')],_0x89a1('0x49'),JSON['stringify'](_0x5401f1[_0x89a1('0xf')][_0x5401f1['actions'][_0xc6e77a][_0x89a1('0x48')]][_0x89a1('0x2e')]),_0x89a1('0x4a'),JSON[_0x89a1('0x27')](_0x5401f1['campaignsPreview'][_0x5401f1[_0x89a1('0x12')][_0xc6e77a][_0x89a1('0x48')]][_0x89a1('0x2f')]),JSON[_0x89a1('0x27')](_0x5401f1[_0x89a1('0x12')][_0xc6e77a][_0x89a1('0x4b')]),JSON['stringify'](_['pick'](_0x5401f1[_0x89a1('0x12')][_0xc6e77a],['contactId',_0x89a1('0x4c'),_0x89a1('0x4d'),_0x89a1('0x4e')])));return ami[_0x89a1('0x4f')]({'action':'status','channel':_0x5401f1[_0x89a1('0x12')][_0xc6e77a][_0x89a1('0x50')]})['catch'](function(_0x336175){if(_0x336175[_0x89a1('0x32')]===_0x89a1('0x51')){setTimeout(function(){if(_0x5401f1['actions'][_0xc6e77a]){utils[_0x89a1('0x52')](_0x5401f1[_0x89a1('0xf')][_0x5401f1[_0x89a1('0x12')][_0xc6e77a][_0x89a1('0x48')]],'[clearZombieChannel]');if(_0x5401f1[_0x89a1('0x12')][_0xc6e77a]['dialAnswer']===!![]){ut[_0x89a1('0x53')](_0x5401f1[_0x89a1('0xf')][_0x5401f1[_0x89a1('0x12')][_0xc6e77a]['queue']],'[clearZombieChannel]');ut[_0x89a1('0x54')](_0x89a1('0x55')+_0xc6e77a,_0x5401f1[_0x89a1('0x12')][_0xc6e77a][_0x89a1('0x48')]);}ut['loggerError'](_0x89a1('0x56')+_0xc6e77a,_0x5401f1[_0x89a1('0x12')][_0xc6e77a][_0x89a1('0x48')]);delete _0x5401f1[_0x89a1('0x12')][_0xc6e77a];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x3233c7=this;loggerAction['info'](_0x89a1('0x57'),_[_0x89a1('0x58')](this[_0x89a1('0x12')]));for(var _0x157cb5 in this[_0x89a1('0x12')]){if(_0x3233c7[_0x89a1('0x12')][_0x89a1('0x3a')](_0x157cb5)){_0x3233c7[_0x89a1('0x44')](_0x157cb5);}}};Preview[_0x89a1('0xa')][_0x89a1('0x43')]=function(_0x502d1f){var _0x354cfc=this;rpcDb[_0x89a1('0x59')](_0x502d1f['id'],ut[_0x89a1('0x5a')](this[_0x89a1('0x13')]))[_0x89a1('0x5b')](function(_0x2c7cc1){if(!_[_0x89a1('0x45')](_0x2c7cc1)){for(var _0xfa453f=0x0;_0xfa453f<_0x2c7cc1[_0x89a1('0x5c')];_0xfa453f+=0x1){if(ut[_0x89a1('0x5d')](_0x2c7cc1[_0xfa453f]['scheduledat'])<_0x502d1f[_0x89a1('0x5e')]*0x3c){if(_0x2c7cc1[_0xfa453f]['Agent']&&!_0x2c7cc1[_0xfa453f][_0x89a1('0x5f')]['voicePause']){_0x354cfc[_0x89a1('0x60')](_0x2c7cc1[_0xfa453f]['id'])[_0x89a1('0x5b')](ut[_0x89a1('0x61')](_0x89a1('0x62')))[_0x89a1('0x63')](ut['logger2']('[RecallMe]'));}else{rpcDb[_0x89a1('0x64')](_0x2c7cc1[_0xfa453f]['id']);}}else{var _0x41d0eb=new Action(_0x2c7cc1[_0xfa453f],_0x502d1f);_0x41d0eb[_0x89a1('0x65')]=moment()[_0x89a1('0x66')]('YYYY-MM-DD\x20HH:mm:ss');_0x502d1f[_0x89a1('0x67')]+=0x1;ut[_0x89a1('0x68')](_0x41d0eb,0x17,_0x89a1('0x69'));if(_0x502d1f[_0x89a1('0x6a')]){rpcDb['rescheduleContactInQueue'](ut[_0x89a1('0x6b')](_0x2c7cc1[_0xfa453f]));rpcDb['createCustomerHistory'](_0x41d0eb,_0x89a1('0x6c'));}else{ut['logCustomer'](_0x41d0eb,0x16,_0x89a1('0x6d'));rpcDb[_0x89a1('0x6e')](_0x41d0eb,_0x89a1('0x6f'));rpcDb[_0x89a1('0x70')](_0x41d0eb,'[HistoryRecallClose]');}}}}})[_0x89a1('0x63')](ut[_0x89a1('0x61')]('[getContactRecallMe]'));};Preview['prototype'][_0x89a1('0x41')]=function(_0x44c29a){_0x44c29a[_0x89a1('0x2d')]=!![];if(ut['IsNotLoggedIn'](_0x44c29a[_0x89a1('0x71')])){_0x44c29a[_0x89a1('0x32')]=utils['CAMPAIGN_STATUS'][_0x89a1('0x72')];}else if(!ut[_0x89a1('0x73')](_0x44c29a[_0x89a1('0x40')])){_0x44c29a[_0x89a1('0x32')]=utils[_0x89a1('0x33')][_0x89a1('0x34')];}else if(!this['isTrunkReachable'](_0x44c29a[_0x89a1('0x74')])){if(!this[_0x89a1('0x75')](_0x44c29a['TrunkBackup'])){_0x44c29a['message']=utils[_0x89a1('0x33')][_0x89a1('0x76')];}else{_0x44c29a[_0x89a1('0x32')]=utils[_0x89a1('0x33')][_0x89a1('0x77')];}}else{_0x44c29a[_0x89a1('0x32')]=utils[_0x89a1('0x33')][_0x89a1('0x77')];}};Preview[_0x89a1('0xa')][_0x89a1('0x78')]=function(_0x1da1c5,_0xb5d5a2,_0xeaa5cf){var _0xa00f50=this;var _0x1392ab=this['actions'][_0xb5d5a2];var _0x20cf2c=this[_0x89a1('0xf')][_0x1392ab[_0x89a1('0x48')]];var _0x150bb4;var _0x100d92=![];var _0x71f8d7=0x2;var _0x10053f=0x3;if(_0x20cf2c){switch(_0xeaa5cf){case'1':_0x20cf2c[_0x89a1('0x79')]+=0x1;_0x1392ab[_0x89a1('0x7a')]+=0x1;_0x1392ab['countglobal']=ut['totalGlobal'](_0x1392ab);ut[_0x89a1('0x68')](_0x1392ab,0x0,_0x89a1('0x7b'));ami[_0x89a1('0x2b')](_0x89a1('0x7c'),ut['buildObj'](_0x1392ab,'nosuchnumber'));rpcDb[_0x89a1('0x6e')](_0x1392ab,_0x89a1('0x7d'));_0xa00f50[_0x89a1('0x7e')](_0x1392ab,'0',_0x20cf2c)[_0x89a1('0x5b')](function(_0x36deb8){_0x100d92=_0x36deb8[_0x89a1('0x7f')]==0x1;_0x71f8d7=_0x20cf2c[_0x89a1('0x80')];_0x10053f=_0x20cf2c['callAdditionalPhoneAfterMin'];if(!_0x100d92){if(ut['totalGlobal'](_0x1392ab)>=_0x20cf2c['dialGlobalMaxRetry']){_0x150bb4=ut['cloneAction'](_0x1392ab,0xf,_0x89a1('0x81'));rpcDb[_0x89a1('0x70')](_0x150bb4,_0x89a1('0x82'));}else{if(_0x1392ab[_0x89a1('0x7a')]>=_0x20cf2c[_0x89a1('0x83')]){rpcDb[_0x89a1('0x70')](_0x1392ab,_0x89a1('0x82'));}else{rpcDb[_0x89a1('0x84')](ut[_0x89a1('0x85')](_0x1392ab,_0x89a1('0x7a'),_0x20cf2c[_0x89a1('0x80')]),_0x1392ab[_0x89a1('0x86')],_0x1392ab[_0x89a1('0x87')]);}}delete this[_0x89a1('0x12')][_0x1da1c5[_0x89a1('0x88')]];}else{_0x1392ab[_0x89a1('0x7a')]++;logger['info'](_0x89a1('0x89'),_0x1392ab['countnosuchnumberretry']);logger[_0x89a1('0x25')]('id',_0x1392ab[_0x89a1('0x8a')]);_0xa00f50[_0x89a1('0x8b')]({'id':_0x1392ab[_0x89a1('0x8a')],'field':{'countnosuchnumberretry':_0x1392ab[_0x89a1('0x7a')]}})['then'](function(){_0xa00f50[_0x89a1('0x8c')](_0x1392ab,_0x71f8d7,_0x10053f)[_0x89a1('0x5b')](function(){});});}});break;case _0x89a1('0x8d'):var _0x1cf5ad=moment()[_0x89a1('0x66')](_0x89a1('0x8e'));_0x1392ab[_0x89a1('0x8f')]=_0x1cf5ad;_0x1392ab[_0x89a1('0x90')]=_0x1cf5ad;_0x1392ab['dialAnswer']=!![];_0x20cf2c[_0x89a1('0x2f')]+=0x1;logger[_0x89a1('0x25')](_0x89a1('0x91'),_0x1392ab[_0x89a1('0x92')],_0x89a1('0x93'),_0x20cf2c[_0x89a1('0x29')],_0x89a1('0x4a'),_0x20cf2c[_0x89a1('0x2f')]);ami[_0x89a1('0x2b')](_0x89a1('0x94'),ut[_0x89a1('0x95')](_0x1392ab,_0x89a1('0x96'),this['campaignsPreview'][_0x1392ab[_0x89a1('0x48')]]));if(_0x20cf2c['acw']||_0x20cf2c[_0x89a1('0x97')]){ami[_0x89a1('0x2b')](_0x89a1('0x98'),{'queue':_0x1392ab[_0x89a1('0x48')],'interface':_0x1392ab[_0x89a1('0x99')],'uniqueid':_0x1392ab['uniqueid']});}break;case'16':ami[_0x89a1('0x2b')](_0x89a1('0x9a'),ut['buildObj'](_0x1392ab,_0x89a1('0x9b'),this['campaignsPreview'][_0x1392ab[_0x89a1('0x48')]]));emitVoiceQueueChannelRemove(ut[_0x89a1('0x95')](_0x1392ab,_0x89a1('0x9b')));_0x20cf2c[_0x89a1('0x9c')]+=0x1;_0x20cf2c[_0x89a1('0x9d')]+=0x1;_0x20cf2c['answered']+=0x1;ut[_0x89a1('0x53')](_0x20cf2c,_0x89a1('0x9e'));_0x1392ab['countglobal']=ut[_0x89a1('0x9f')](_0x1392ab);ut[_0x89a1('0x68')](_0x1392ab,0x4,_0x89a1('0xa0'));rpcDb[_0x89a1('0x6e')](_0x1392ab,_0x89a1('0xa1'));rpcDb[_0x89a1('0x70')](_0x1392ab,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x89a1('0xa2')](_0x1392ab);_0x20cf2c[_0x89a1('0xa3')]+=_0x1392ab[_0x89a1('0xa4')];_0x20cf2c[_0x89a1('0xa5')]+=_0x1392ab[_0x89a1('0xa4')];logger[_0x89a1('0x25')](_0x89a1('0xa6'),_0x1392ab['uniqueid'],'\x20Queue',_0x20cf2c['name'],_0x89a1('0x4a'),_0x20cf2c[_0x89a1('0x2f')]);delete this[_0x89a1('0x12')][_0x1da1c5[_0x89a1('0x88')]];break;case _0x89a1('0xa7'):_0x20cf2c[_0x89a1('0xa8')]+=0x1;_0x1392ab[_0x89a1('0xa9')]+=0x1;_0x1392ab[_0x89a1('0xaa')]=ut[_0x89a1('0x9f')](_0x1392ab);ut[_0x89a1('0x68')](_0x1392ab,0x5,_0x89a1('0xab'));_0x71f8d7=_0x20cf2c[_0x89a1('0xac')];_0x10053f=_0x20cf2c[_0x89a1('0xad')];ami['emit'](_0x89a1('0xae'),ut[_0x89a1('0x95')](_0x1392ab,_0x89a1('0xaf')));rpcDb[_0x89a1('0x6e')](_0x1392ab,_0x89a1('0xb0'));_0xa00f50[_0x89a1('0x7e')](_0x1392ab,'5',_0x20cf2c)[_0x89a1('0x5b')](function(_0x9b45d2){_0x100d92=_0x9b45d2[_0x89a1('0x7f')]==0x1;if(!_0x100d92){if(ut[_0x89a1('0x9f')](_0x1392ab)>=_0x20cf2c[_0x89a1('0xb1')]){_0x150bb4=ut[_0x89a1('0xb2')](_0x1392ab,0xf,'Global');rpcDb['createCustomerFinal'](_0x150bb4,_0x89a1('0xb3'));}else{if(_0x1392ab[_0x89a1('0xa9')]>=_0x20cf2c[_0x89a1('0xb4')]){rpcDb['createCustomerFinal'](_0x1392ab,_0x89a1('0xb0'));}else{rpcDb[_0x89a1('0x84')](ut[_0x89a1('0x85')](_0x1392ab,_0x89a1('0xa9'),_0x20cf2c[_0x89a1('0xac')]),_0x1392ab[_0x89a1('0x86')],_0x1392ab[_0x89a1('0x87')]);}}}else{_0x1392ab['countbusyretry']++;_0xa00f50[_0x89a1('0x8b')]({'id':_0x1392ab[_0x89a1('0x8a')],'field':{'countbusyretry':_0x1392ab[_0x89a1('0xa9')]}})[_0x89a1('0x5b')](function(){_0xa00f50[_0x89a1('0x8c')](_0x1392ab,_0x71f8d7,_0x10053f)[_0x89a1('0x5b')](function(){});});}});break;case _0x89a1('0xb5'):_0x20cf2c[_0x89a1('0xb6')]+=0x1;_0x1392ab['countnoanswerretry']+=0x1;_0x1392ab['countglobal']=ut[_0x89a1('0x9f')](_0x1392ab);ut[_0x89a1('0x68')](_0x1392ab,0x3,_0x89a1('0xb7'));_0x71f8d7=_0x20cf2c['dialNoAnswerRetryFrequency'];_0x10053f=_0x20cf2c[_0x89a1('0xad')];var _0x3d9f59=ut['buildNoAnswerEventPayload'](_0x1392ab,_0x20cf2c);ami[_0x89a1('0x2b')](_0x89a1('0xb8'),_0x3d9f59);rpcDb[_0x89a1('0x6e')](_0x1392ab,'[callProgressDetectingCustomer][logNoAnswer]');_0xa00f50['verifyAdditionalPhones'](_0x1392ab,'3',_0x20cf2c)['then'](function(_0x20bc5d){_0x100d92=_0x20bc5d['additional']==0x1;if(!_0x100d92){if(ut[_0x89a1('0x9f')](_0x1392ab)>=_0x20cf2c[_0x89a1('0xb1')]){_0x150bb4=ut[_0x89a1('0xb2')](_0x1392ab,0xf,_0x89a1('0x81'));rpcDb[_0x89a1('0x70')](_0x150bb4,_0x89a1('0xb9'));}else{if(_0x1392ab[_0x89a1('0xba')]>=_0x20cf2c['dialNoAnswerMaxRetry']){rpcDb[_0x89a1('0x70')](_0x1392ab,_0x89a1('0xbb'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1392ab,_0x89a1('0xba'),_0x20cf2c[_0x89a1('0xbc')]),_0x1392ab[_0x89a1('0x86')],_0x1392ab[_0x89a1('0x87')]);}}}else{_0x1392ab[_0x89a1('0xba')]++;_0xa00f50[_0x89a1('0x8b')]({'id':_0x1392ab[_0x89a1('0x8a')],'field':{'countnoanswerretry':_0x1392ab[_0x89a1('0xba')]}})['then'](function(){_0xa00f50[_0x89a1('0x8c')](_0x1392ab,_0x71f8d7,_0x10053f)[_0x89a1('0x5b')](function(){});});}});break;case'CONGESTION':_0x20cf2c[_0x89a1('0xbd')]+=0x1;_0x1392ab['countcongestionretry']+=0x1;_0x1392ab[_0x89a1('0xaa')]=ut[_0x89a1('0x9f')](_0x1392ab);ut['logCustomer'](_0x1392ab,0x8,_0x89a1('0xbe'));_0x71f8d7=_0x20cf2c['dialCongestionRetryFrequency'];_0x10053f=_0x20cf2c['callAdditionalPhoneAfterMin'];ami[_0x89a1('0x2b')](_0x89a1('0xbf'),ut[_0x89a1('0x95')](_0x1392ab,_0x89a1('0xc0')));rpcDb[_0x89a1('0x6e')](_0x1392ab,_0x89a1('0xc1'));_0xa00f50['verifyAdditionalPhones'](_0x1392ab,'8',_0x20cf2c)[_0x89a1('0x5b')](function(_0x1b06eb){_0x100d92=_0x1b06eb[_0x89a1('0x7f')]==0x1;if(!_0x100d92){if(ut[_0x89a1('0x9f')](_0x1392ab)>=_0x20cf2c[_0x89a1('0xb1')]){_0x150bb4=ut['cloneAction'](_0x1392ab,0xf,'Global');rpcDb[_0x89a1('0x70')](_0x150bb4,_0x89a1('0xc2'));}else{if(_0x1392ab['countcongestionretry']>=_0x20cf2c[_0x89a1('0xc3')]){rpcDb['createCustomerFinal'](_0x1392ab,_0x89a1('0xc1'));}else{rpcDb[_0x89a1('0x84')](ut[_0x89a1('0x85')](_0x1392ab,_0x89a1('0xc4'),_0x20cf2c[_0x89a1('0xac')]),_0x1392ab[_0x89a1('0x86')],_0x1392ab[_0x89a1('0x87')]);}}}else{_0x1392ab[_0x89a1('0xc4')]++;_0xa00f50[_0x89a1('0x8b')]({'id':_0x1392ab[_0x89a1('0x8a')],'field':{'countcongestionretry':_0x1392ab[_0x89a1('0xc4')]}})['then'](function(){_0xa00f50[_0x89a1('0x8c')](_0x1392ab,_0x71f8d7,_0x10053f)['then'](function(){});});}});break;case _0x89a1('0xc5'):_0x20cf2c[_0x89a1('0xc6')]+=0x1;_0x1392ab[_0x89a1('0xc7')]+=0x1;_0x1392ab[_0x89a1('0xaa')]=ut[_0x89a1('0x9f')](_0x1392ab);ut[_0x89a1('0x68')](_0x1392ab,0x14,_0x89a1('0xc8'));_0x71f8d7=_0x20cf2c[_0x89a1('0xc9')];_0x10053f=_0x20cf2c[_0x89a1('0xad')];ami[_0x89a1('0x2b')](_0x89a1('0xca'),ut[_0x89a1('0x95')](_0x1392ab,_0x89a1('0xcb')));rpcDb[_0x89a1('0x6e')](_0x1392ab,_0x89a1('0xcc'));_0xa00f50[_0x89a1('0x7e')](_0x1392ab,'20',_0x20cf2c)[_0x89a1('0x5b')](function(_0xeb8345){_0x100d92=_0xeb8345[_0x89a1('0x7f')]==0x1;if(!_0x100d92){if(ut['totalGlobal'](_0x1392ab)>=_0x20cf2c['dialGlobalMaxRetry']){_0x150bb4=ut[_0x89a1('0xb2')](_0x1392ab,0x14,_0x89a1('0xc8'));rpcDb['createCustomerFinal'](_0x150bb4,_0x89a1('0xcd'));}else{if(_0x1392ab[_0x89a1('0xc7')]>=_0x20cf2c[_0x89a1('0xce')]){rpcDb[_0x89a1('0x70')](_0x1392ab,_0x89a1('0xcd'));}else{rpcDb[_0x89a1('0x84')](ut[_0x89a1('0x85')](_0x1392ab,_0x89a1('0xc7'),_0x20cf2c[_0x89a1('0xc9')]),_0x1392ab[_0x89a1('0x86')],_0x1392ab[_0x89a1('0x87')]);}}}else{_0x1392ab[_0x89a1('0xba')]++;_0xa00f50[_0x89a1('0x8b')]({'id':_0x1392ab['idContact'],'field':{'countnoanswerretry':_0x1392ab[_0x89a1('0xba')]}})[_0x89a1('0x5b')](function(){_0xa00f50['swapAdditionalPhones'](_0x1392ab,_0x71f8d7,_0x10053f)['then'](function(){});});}});break;case _0x89a1('0xcf'):_0x20cf2c[_0x89a1('0xd0')]+=0x1;_0x1392ab[_0x89a1('0xd1')]+=0x1;_0x1392ab[_0x89a1('0xaa')]=ut[_0x89a1('0x9f')](_0x1392ab);ut[_0x89a1('0x68')](_0x1392ab,0xb,_0x89a1('0xd2'));rpcDb[_0x89a1('0x6e')](_0x1392ab,_0x89a1('0xd3'));_0xa00f50[_0x89a1('0x7e')](_0x1392ab,'11',_0x20cf2c)[_0x89a1('0x5b')](function(_0x2d37d3){_0x100d92=_0x2d37d3[_0x89a1('0x7f')]==0x1;if(!_0x100d92){if(ut[_0x89a1('0x9f')](_0x1392ab)>=_0x20cf2c[_0x89a1('0xb1')]){_0x150bb4=ut[_0x89a1('0xb2')](_0x1392ab,0xf,'Global');rpcDb['createCustomerFinal'](_0x150bb4,_0x89a1('0xd3'));}else{if(_0x1392ab[_0x89a1('0xd4')]>=_0x20cf2c[_0x89a1('0xd5')]){rpcDb['createCustomerFinal'](_0x1392ab,_0x89a1('0xd3'));}else{rpcDb[_0x89a1('0x84')](ut[_0x89a1('0x85')](_0x1392ab,_0x89a1('0xd1'),_0x20cf2c['dialAbandonedRetryFrequency']),_0x1392ab['unlockAgent'],_0x1392ab[_0x89a1('0x87')]);}}}else{_0x1392ab[_0x89a1('0xba')]++;_0xa00f50['incrementPreviewCounters']({'id':_0x1392ab['idContact'],'field':{'countnoanswerretry':_0x1392ab[_0x89a1('0xba')]}})[_0x89a1('0x5b')](function(){_0xa00f50[_0x89a1('0x8c')](_0x1392ab,_0x71f8d7,_0x10053f)['then'](function(){});});}});break;case'18':_0x20cf2c[_0x89a1('0xd6')]+=0x1;_0x1392ab['countmachineretry']+=0x1;_0x1392ab['countglobal']=ut[_0x89a1('0x9f')](_0x1392ab);ut[_0x89a1('0x68')](_0x1392ab,0x12,_0x1da1c5[_0x89a1('0xd7')]||_0x1da1c5[_0x89a1('0xd8')]);ami['emit'](_0x89a1('0xd9'),ut[_0x89a1('0x95')](_0x1392ab,'amd'));rpcDb['createCustomerHistory'](_0x1392ab,_0x89a1('0xda'));_0xa00f50[_0x89a1('0x7e')](_0x1392ab,'18',_0x20cf2c)[_0x89a1('0x5b')](function(_0x1b8a62){_0x100d92=_0x1b8a62[_0x89a1('0x7f')]==0x1;if(!_0x100d92){if(ut[_0x89a1('0x9f')](_0x1392ab)>=_0x20cf2c['dialGlobalMaxRetry']){_0x150bb4=ut['cloneAction'](_0x1392ab,0x12,'Global');rpcDb[_0x89a1('0x70')](_0x150bb4,_0x89a1('0xda'));}else{rpcDb[_0x89a1('0x70')](_0x1392ab,_0x89a1('0xda'));}}else{_0x1392ab[_0x89a1('0xba')]++;_0xa00f50[_0x89a1('0x8b')]({'id':_0x1392ab['idContact'],'field':{'countnoanswerretry':_0x1392ab[_0x89a1('0xba')]}})[_0x89a1('0x5b')](function(){_0xa00f50[_0x89a1('0x8c')](_0x1392ab,_0x71f8d7,_0x10053f)[_0x89a1('0x5b')](function(){});});}});delete this['actions'][_0x1da1c5[_0x89a1('0x88')]];break;case'19':_0x20cf2c['outboundUnknownCallsDay']+=0x1;_0x1392ab[_0x89a1('0xaa')]=ut[_0x89a1('0x9f')](_0x1392ab);ut['logCustomer'](_0x1392ab,0x13,_0x1da1c5[_0x89a1('0xd7')]||_0x1da1c5[_0x89a1('0xd8')]);ami[_0x89a1('0x2b')](_0x89a1('0xd9'),ut['buildObj'](_0x1392ab,_0x89a1('0xdb')));rpcDb[_0x89a1('0x6e')](_0x1392ab,_0x89a1('0xdc'));_0xa00f50['verifyAdditionalPhones'](_0x1392ab,'18',_0x20cf2c)[_0x89a1('0x5b')](function(_0x19ace5){_0x100d92=_0x19ace5['additional']==0x1;if(!_0x100d92){if(ut[_0x89a1('0x9f')](_0x1392ab)>=_0x20cf2c[_0x89a1('0xb1')]){_0x150bb4=ut[_0x89a1('0xb2')](_0x1392ab,0xf,'Global');rpcDb[_0x89a1('0x70')](_0x150bb4,_0x89a1('0xdc'));}else{rpcDb[_0x89a1('0x70')](_0x1392ab,'[callProgressDetectingCustomer][machine]');}}else{_0x1392ab['countnoanswerretry']++;_0xa00f50[_0x89a1('0x8b')]({'id':_0x1392ab[_0x89a1('0x8a')],'field':{'countnoanswerretry':_0x1392ab[_0x89a1('0xba')]}})[_0x89a1('0x5b')](function(){_0xa00f50[_0x89a1('0x8c')](_0x1392ab,_0x71f8d7,_0x10053f)[_0x89a1('0x5b')](function(){});});}});delete this[_0x89a1('0x12')][_0x1da1c5['linkedid']];break;default:if(_0x1392ab[_0x89a1('0x4b')]){ut[_0x89a1('0x53')](_0x20cf2c,_0x89a1('0xdd'));ut[_0x89a1('0x54')]('[Dialer][decrementTalking][no\x20Hangup][Preview]'+_0x20cf2c[_0x89a1('0x29')],_0x1da1c5);}_0x20cf2c[_0x89a1('0xd6')]+=0x1;_0x1392ab['countglobal']=ut['totalGlobal'](_0x1392ab);ut[_0x89a1('0x68')](_0x1392ab,0xc,_0x1da1c5['cause-txt']||_0x1da1c5['dialstatus']);_0x71f8d7=_0x20cf2c[_0x89a1('0xc9')];_0x10053f=_0x20cf2c[_0x89a1('0xad')];rpcDb[_0x89a1('0x6e')](_0x1392ab,_0x89a1('0xde'));_0xa00f50['verifyAdditionalPhones'](_0x1392ab,'20',_0x20cf2c)[_0x89a1('0x5b')](function(_0x281626){_0x100d92=_0x281626[_0x89a1('0x7f')]==0x1;if(!_0x100d92){if(ut[_0x89a1('0x9f')](_0x1392ab)>=_0x20cf2c[_0x89a1('0xb1')]){_0x150bb4=ut['cloneAction'](_0x1392ab,0xf,'Global');rpcDb['createCustomerFinal'](_0x150bb4,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x89a1('0x70')](_0x1392ab,_0x89a1('0xdf'));}delete this['actions'][_0x1da1c5[_0x89a1('0x88')]];}else{_0xa00f50[_0x89a1('0x8c')](_0x1392ab,_0x71f8d7,_0x10053f)['then'](function(){});}});}if(!(_0x1392ab[_0x89a1('0x4b')]&&_0xeaa5cf==='16')){utils['decrementOriginate'](_0x20cf2c,'[callProgressDetectingCustomer]');logger[_0x89a1('0x25')](_0x89a1('0xe0'),_0x1392ab[_0x89a1('0x92')],_0x89a1('0x93'),_0x20cf2c[_0x89a1('0x29')],_0x89a1('0x49'),_0x20cf2c[_0x89a1('0x2e')]);}if(_0xeaa5cf!==_0x89a1('0x8d')){delete this[_0x89a1('0x12')][_0x1da1c5[_0x89a1('0x88')]];delete this['actions'][_0x1da1c5[_0x89a1('0xe1')]];}_0x20cf2c['queueSummaryCountersUpdated']=!![];}};Preview[_0x89a1('0xa')]['callProgressDetectingAgent']=function(_0x51ab1e,_0x1234b8,_0x2878ae){if(_[_0x89a1('0xe2')](_0x1234b8)&&_0x89a1('0xe3')!==typeof _0x1234b8){return;}if(_[_0x89a1('0xe2')](_0x2878ae)&&_0x89a1('0xe3')!==typeof _0x2878ae){return;}switch(_0x2878ae[_0x89a1('0xe4')]){case'0':ut['logAgent'](_0x51ab1e,0x0,_0x89a1('0x7b'));rpcDb[_0x89a1('0xe5')](_0x51ab1e,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x51ab1e,0x3,_0x89a1('0xb7'));rpcDb[_0x89a1('0xe5')](_0x51ab1e,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x51ab1e,0x5,'Busy');rpcDb[_0x89a1('0xe5')](_0x51ab1e,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x89a1('0xe6')](_0x51ab1e,0x8,_0x89a1('0xbe'));rpcDb[_0x89a1('0xe5')](_0x51ab1e,_0x89a1('0xe7'));break;case'22':ut[_0x89a1('0xe6')](_0x51ab1e,0x16,_0x89a1('0xe8'));rpcDb[_0x89a1('0xe5')](_0x51ab1e,_0x89a1('0xe9'));break;default:ut[_0x89a1('0xe6')](_0x51ab1e,0xc,_0x2878ae[_0x89a1('0xe4')]);rpcDb[_0x89a1('0xe5')](_0x51ab1e,_0x89a1('0xe7'));}utils[_0x89a1('0x52')](_0x1234b8,_0x89a1('0xea'));logger['info'](_0x89a1('0xeb'),_0x51ab1e[_0x89a1('0x92')],_0x89a1('0x93'),_0x1234b8[_0x89a1('0x29')],_0x89a1('0x49'),_0x1234b8['originated']);delete this[_0x89a1('0x12')][_0x51ab1e[_0x89a1('0x92')]];};Preview[_0x89a1('0xa')][_0x89a1('0x7e')]=function(_0x357331,_0x2d991c,_0x551159){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x357331,_0x2d991c,_0x551159)[_0x89a1('0x63')](logger[_0x89a1('0x25')](_0x89a1('0xec')));};Preview[_0x89a1('0xa')][_0x89a1('0x8c')]=function(_0x17f4fa,_0x2e42cf,_0x483678){return cmHopperAdditionalPhone[_0x89a1('0x8c')](_0x17f4fa,_0x2e42cf,_0x483678)[_0x89a1('0x63')](logger[_0x89a1('0x25')](_0x89a1('0xed')));};Preview[_0x89a1('0xa')][_0x89a1('0x8b')]=function(_0x65785d){return Promise[_0x89a1('0xee')]()[_0x89a1('0x5b')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x65785d))[_0x89a1('0x63')](logger['info']('[incrementPreviewCounters]\x20'));};Preview[_0x89a1('0xa')]['checkInBlack']=function(_0x5ed43e,_0x270b2a,_0x1926cf,_0x29d026,_0x6f071){var _0x26019b=this;return new Promise(function(_0x55bee8,_0x4bb19d){if(_[_0x89a1('0x45')](_0x270b2a)||_['isNil'](_0x270b2a[_0x89a1('0xef')])||_[_0x89a1('0x45')](_0x270b2a[_0x89a1('0xf0')])||_[_0x89a1('0x45')](_0x270b2a['VoiceQueueId'])){_0x4bb19d(ut[_0x89a1('0x32')](_0x89a1('0xf1'),_0x29d026,_0x6f071));return;}var _0x635dd1=uuid['v4']();var _0x433be7=_0x26019b[_0x89a1('0xf')][_0x270b2a[_0x89a1('0x47')][_0x89a1('0x29')]];var _0x567311=_0x1926cf?_0x26019b[_0x89a1('0x13')][_0x1926cf]['id']:undefined;_0x26019b[_0x89a1('0x12')][_0x635dd1]=new Action(_0x270b2a,_0x433be7,_0x635dd1,_0x1926cf,_0x567311);var _0x4c803a=_0x26019b[_0x89a1('0x12')][_0x635dd1];_0x4c803a[_0x89a1('0x86')]=_0x29d026;_0x4c803a['activeContact']=_0x6f071;_0x4c803a[_0x89a1('0xf2')]=_0x1926cf;if(_[_0x89a1('0xf3')](_0x5ed43e)){_0x26019b['execCall'](_0x4c803a,_0x433be7,_0x270b2a,_0x1926cf)[_0x89a1('0x5b')](function(_0x44c481){logger[_0x89a1('0x25')](_0x89a1('0xf4'),'Queue:\x20'+_0x4c803a[_0x89a1('0x48')]+_0x89a1('0xf5')+_0x4c803a[_0x89a1('0x8a')],JSON['stringify'](_0x44c481));ami[_0x89a1('0x2b')]('custom:agentcalled',ut[_0x89a1('0x95')](_0x4c803a,'called',_0x26019b['campaignsPreview'][_0x4c803a[_0x89a1('0x48')]]));_0x55bee8(ut[_0x89a1('0x32')](_0x89a1('0xf6')));})[_0x89a1('0x63')](function(_0x2d3a98){ut[_0x89a1('0x37')]('[Preview][execCall][failure]',_0x2d3a98);_0x4bb19d(ut[_0x89a1('0x32')](_0x89a1('0xf7'),_0x29d026,_0x6f071));});}else{_0x433be7[_0x89a1('0xf8')]+=0x1;ut[_0x89a1('0xf9')](_0x4c803a);rpcDb[_0x89a1('0xfa')](_0x4c803a,_0x89a1('0xfb'));delete _0x26019b[_0x89a1('0x12')][_0x635dd1];_0x4bb19d(ut[_0x89a1('0x32')]('Contact\x20in\x20black\x20List',_0x29d026,_0x6f071));}});};Preview[_0x89a1('0xa')][_0x89a1('0x75')]=function(_0x56c6a3){return!_[_0x89a1('0x45')](_0x56c6a3)&&!_[_0x89a1('0x45')](_0x56c6a3[_0x89a1('0x29')])&&!_[_0x89a1('0x45')](_0x56c6a3[_0x89a1('0xfc')])&&_0x56c6a3['active']&&!_['isNil'](this[_0x89a1('0x11')][util[_0x89a1('0x66')](_0x89a1('0xfd'),_0x56c6a3[_0x89a1('0x29')])])&&!_[_0x89a1('0x45')](this['trunks'][util[_0x89a1('0x66')](_0x89a1('0xfd'),_0x56c6a3[_0x89a1('0x29')])][_0x89a1('0xfe')])&&(this[_0x89a1('0x11')][util[_0x89a1('0x66')](_0x89a1('0xfd'),_0x56c6a3[_0x89a1('0x29')])]['status']===_0x89a1('0xff')||this[_0x89a1('0x11')][util[_0x89a1('0x66')](_0x89a1('0xfd'),_0x56c6a3['name'])][_0x89a1('0xfe')]===_0x89a1('0x100'));};Preview['prototype'][_0x89a1('0x60')]=function(_0x3f23e6,_0x5da478){return this[_0x89a1('0x101')](_0x3f23e6,_0x5da478)[_0x89a1('0x5b')](function(_0x400d2f){return _['pick'](_0x400d2f,[_0x89a1('0x32')]);})[_0x89a1('0x63')](function(_0x12352f){if(_0x12352f[_0x89a1('0x102')]){rpcDb['unlockContact'](_0x3f23e6);}if(_0x12352f[_0x89a1('0xfc')]){rpcDb[_0x89a1('0x64')](_0x3f23e6);}throw _[_0x89a1('0x103')](_0x12352f,[_0x89a1('0x32')]);});};Preview[_0x89a1('0xa')]['execRun']=function(_0x567711,_0x169e4f){var _0x14f211=this;var _0x5db5c2,_0x51423a;return rpcDb[_0x89a1('0x104')](_0x567711)['then'](function(_0x2a11b9){if(!_['isNil'](_0x2a11b9[0x0])){_0x51423a=_0x2a11b9[0x0]['recallme']?![]:!![];_0x5db5c2=_0x2a11b9[0x0][_0x89a1('0x105')]?!![]:![];_0x5db5c2=_0x169e4f?!![]:_0x5db5c2;}var _0x1c0d4b=_0x14f211[_0x89a1('0x106')](_0x2a11b9);if(_0x1c0d4b[_0x89a1('0x107')]){rpcDb[_0x89a1('0x108')](_[_0x89a1('0x103')](_0x2a11b9[0x0],[_0x89a1('0x4d'),_0x89a1('0xf0')]))[_0x89a1('0x5b')](function(_0x440368){_0x14f211[_0x89a1('0x109')](_0x440368,_0x2a11b9[0x0],_0x169e4f,_0x51423a,_0x5db5c2)[_0x89a1('0x5b')](function(_0x386a30){return _0x386a30;})[_0x89a1('0x63')](function(_0x1ac863){throw _0x1ac863;});})['catch'](function(_0x4f9ce9){ut[_0x89a1('0x37')]('[Preview][checkIsBlackList]',_0x4f9ce9);throw ut[_0x89a1('0x32')]('Call\x20unsuccessful',_0x51423a,_0x5db5c2);});}else{throw ut['message'](_0x1c0d4b[_0x89a1('0x32')],_0x51423a,_0x5db5c2);}})[_0x89a1('0x63')](function(_0x188677){ut[_0x89a1('0x37')](_0x89a1('0x10a'),_0x188677);throw ut[_0x89a1('0x32')](_0x89a1('0x10b'),![],!![]);});};Preview['prototype'][_0x89a1('0x106')]=function(_0x12ff62){if(_[_0x89a1('0x45')](_0x12ff62)||_[_0x89a1('0xf3')](_0x12ff62)||!_[_0x89a1('0x45')](_0x12ff62[0x0][_0x89a1('0x5f')])&&_[_0x89a1('0x45')](_0x12ff62[0x0][_0x89a1('0x5f')][_0x89a1('0x29')])){ut[_0x89a1('0x37')]('[Preview][validateContact][Empty\x20Contact]',_0x12ff62);return{'isValid':![],'message':_0x89a1('0x10c')};}var _0x40ff55=this['campaignsPreview'][_0x12ff62[0x0]['Queue'][_0x89a1('0x29')]];_0x40ff55[_0x89a1('0x32')]=utils[_0x89a1('0x33')][_0x89a1('0x77')];if(_[_0x89a1('0x45')](_0x40ff55)){ut[_0x89a1('0x37')](_0x89a1('0x10d'),_0x40ff55);return{'isValid':![],'message':_0x89a1('0x10e')};}if(!this['isTrunkReachable'](_0x40ff55[_0x89a1('0x74')])){ut['logger'](_0x89a1('0x10f'),_0x89a1('0x110')+_0x40ff55[_0x89a1('0x29')]+_0x89a1('0x111'));if(!this[_0x89a1('0x75')](_0x40ff55[_0x89a1('0x112')])){ut[_0x89a1('0x37')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x40ff55['name']+_0x89a1('0x113'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0x40ff55[_0x89a1('0x40')])){ut[_0x89a1('0x37')]('[Preview][validateContact][Campaign\x20Active]',_0x40ff55[_0x89a1('0x29')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x40ff55[_0x89a1('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x89a1('0x114')};};Preview[_0x89a1('0xa')][_0x89a1('0x115')]=function(_0x67212a,_0x58fa28,_0x16a969,_0xd2f65b){var _0xfc6650=this;return new Promise(function(_0x3f7b56,_0x249c46){var _0x472811=_0x67212a[_0x89a1('0x92')];var _0x17cc06=_0xfc6650[_0x89a1('0x75')](_0x58fa28[_0x89a1('0x74')])?util[_0x89a1('0x66')](_0x89a1('0x116'),_0x58fa28['Trunk'][_0x89a1('0x29')],_[_0x89a1('0x45')](_0x58fa28[_0x89a1('0x117')])?'':_0x58fa28[_0x89a1('0x117')][_0x89a1('0x118')]()||'',_0x58fa28[_0x89a1('0x119')]>0x0?_0x16a969['phone']['substring'](_0x58fa28[_0x89a1('0x119')]):_0x16a969[_0x89a1('0xf0')]):util[_0x89a1('0x66')](_0x89a1('0x116'),_['isNil'](_0x58fa28[_0x89a1('0x112')])?_0x58fa28[_0x89a1('0x74')][_0x89a1('0x29')]:_0x58fa28[_0x89a1('0x112')][_0x89a1('0x29')],_[_0x89a1('0x45')](_0x58fa28[_0x89a1('0x117')])?'':_0x58fa28[_0x89a1('0x117')][_0x89a1('0x118')]()||'',_0x58fa28[_0x89a1('0x119')]>0x0?_0x16a969[_0x89a1('0xf0')][_0x89a1('0x11a')](_0x58fa28[_0x89a1('0x119')]):_0x16a969['phone']);var _0x382962=_0xfc6650[_0x89a1('0x75')](_0x58fa28[_0x89a1('0x74')])?ut['getCallerId'](_0x58fa28['Trunk'][_0x89a1('0x11b')],_0x58fa28[_0x89a1('0x11c')],_0x58fa28[_0x89a1('0x11d')]>0x0?ut['getCallerIdRandom'](_0x58fa28[_0x89a1('0x11e')],_0x58fa28[_0x89a1('0x11d')]):_0x58fa28[_0x89a1('0x11e')]):ut[_0x89a1('0x11f')](_[_0x89a1('0x45')](_0x58fa28[_0x89a1('0x112')])?_0x58fa28[_0x89a1('0x74')][_0x89a1('0x11b')]:_0x58fa28['TrunkBackup']['callerid'],_0x58fa28['dialOriginateCallerIdName'],_0x58fa28[_0x89a1('0x11d')]>0x0?ut[_0x89a1('0x120')](_0x58fa28[_0x89a1('0x11e')],_0x58fa28[_0x89a1('0x11d')]):_0x58fa28['dialOriginateCallerIdNumber']);if(_0x382962){_0x67212a[_0x89a1('0x121')]=ut['extractCalleridName'](_0x382962);_0x67212a['originatecalleridnum']=ut[_0x89a1('0x122')](_0x382962);}var _0x5c610e=ut['addVariables'](_0x58fa28,_0x16a969,_0x17cc06,_0x382962,_0x472811,_0x67212a);var _0x80eac3=utils['setXMDContactVariables'](_0x16a969[_0x89a1('0xef')]);Object[_0x89a1('0x123')](_0x5c610e,_0x80eac3);_[_0x89a1('0x124')](_0x67212a,ut[_0x89a1('0x125')](_0x5c610e));_0x67212a[_0x89a1('0x65')]=moment()['format'](_0x89a1('0x8e'));_0x58fa28[_0x89a1('0x126')]=_0x5c610e;var _0x514238=ut[_0x89a1('0x127')](_0x67212a,_0x58fa28,_0x5c610e,_0x67212a[_0x89a1('0x87')],_0xd2f65b);return ami['Action'](_0x514238)[_0x89a1('0x5b')](function(_0x363420){_0x58fa28['originated']+=0x1;logger[_0x89a1('0x25')]('[originated][increment]',_0x472811,_0x89a1('0x93'),_0x58fa28['name'],'originated:\x20',_0x58fa28[_0x89a1('0x2e')]);_0x3f7b56(_0x363420);})[_0x89a1('0x63')](function(_0x12cdee){ut[_0x89a1('0xe6')](_0x67212a,0xe,_0x89a1('0x128'));rpcDb['createAgentHistory'](_0x67212a,_0x89a1('0x129'));_0x249c46(_0x12cdee);});});};Preview[_0x89a1('0xa')][_0x89a1('0x1e')]=function(_0x35cfe1){if(this['actions'][_0x35cfe1[_0x89a1('0x88')]]){this[_0x89a1('0x12')][_0x35cfe1[_0x89a1('0x88')]]['channel']=_0x35cfe1[_0x89a1('0x50')];}};Preview[_0x89a1('0xa')][_0x89a1('0x15')]=function(_0x47837e){var _0x30abac=this;var _0x113621=this[_0x89a1('0x12')][_0x47837e[_0x89a1('0x12a')]];if(_0x113621){if(_0x113621['lookAgent']&&this[_0x89a1('0x13')][_0x113621[_0x89a1('0xf2')]]){ut[_0x89a1('0x12b')](_0x113621,this[_0x89a1('0x13')][_0x113621[_0x89a1('0xf2')]][_0x89a1('0x29')],this['agents'][_0x113621[_0x89a1('0xf2')]]['id']);}var _0x459de0=_[_0x89a1('0x12c')](_0x113621);_0x459de0[_0x89a1('0x8f')]=moment()[_0x89a1('0x66')](_0x89a1('0x8e'));var _0x23e46f=_0x30abac[_0x89a1('0xf')][_0x113621[_0x89a1('0x48')]];if(ut['isFailure'](_0x47837e[_0x89a1('0x12d')])){if(_0x113621[_0x89a1('0x86')]){rpcDb[_0x89a1('0x12e')](_0x113621[_0x89a1('0x8a')]);}if(_0x113621['activeContact']){rpcDb[_0x89a1('0x64')](_0x113621[_0x89a1('0x8a')]);}ami['emit'](_0x89a1('0x12f'),ut[_0x89a1('0x95')](_0x113621,_0x89a1('0x130'),this[_0x89a1('0xf')][_0x113621[_0x89a1('0x48')]]));this[_0x89a1('0x131')](_0x459de0,_0x23e46f,_0x47837e);}else{_0x113621[_0x89a1('0x65')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut[_0x89a1('0xe6')](_0x459de0,0x4,_0x89a1('0xa0'));rpcDb[_0x89a1('0xe5')](_0x459de0,_0x89a1('0x132'));}}};Preview[_0x89a1('0xa')][_0x89a1('0x18')]=function(_0x49e7fd){var _0x1ccb2c=this['actions'][_0x49e7fd[_0x89a1('0x88')]];var _0x4c6fe6;if(_0x1ccb2c){_0x4c6fe6=this[_0x89a1('0xf')][_0x1ccb2c[_0x89a1('0x48')]];logger['info'](_0x89a1('0x133'),_0x49e7fd[_0x89a1('0x88')],_0x89a1('0x93'),_0x4c6fe6['name'],_0x89a1('0x4a'),_0x4c6fe6['pTalking']);}if(this['actions'][_0x49e7fd[_0x89a1('0x88')]]&&_0x49e7fd['linkedid']!==_0x49e7fd[_0x89a1('0x92')]){if(_0x49e7fd[_0x89a1('0x134')]==='16'&&this[_0x89a1('0x12')][_0x49e7fd['linkedid']][_0x89a1('0x4b')]){this[_0x89a1('0x78')](_0x49e7fd,_0x49e7fd[_0x89a1('0x88')],_0x49e7fd[_0x89a1('0x134')]);}else if(this[_0x89a1('0x12')][_0x49e7fd['linkedid']][_0x89a1('0x4b')]){logger['info']('[syncHangup][talking][cause]',_0x49e7fd[_0x89a1('0x88')],_0x49e7fd[_0x89a1('0x134')],_0x89a1('0x93'),_0x4c6fe6[_0x89a1('0x29')],_0x89a1('0x4a'),_0x4c6fe6[_0x89a1('0x2f')]);this[_0x89a1('0x78')](_0x49e7fd,_0x49e7fd[_0x89a1('0x88')],_0x49e7fd[_0x89a1('0x134')]);}}else if(_0x1ccb2c&&_[_0x89a1('0x45')](_0x1ccb2c[_0x89a1('0x135')])&&_0x4c6fe6[_0x89a1('0x136')]&&_0x49e7fd[_0x89a1('0x88')]===_0x49e7fd[_0x89a1('0x92')]&&_['isNil'](_0x49e7fd[_0x89a1('0xe4')])&&_0x49e7fd['cause']==='16'&&_0x49e7fd[_0x89a1('0x137')]==='6'&&_['isUndefined'](_0x1ccb2c[_0x89a1('0x138')])){if(_0x1ccb2c[_0x89a1('0x86')]){rpcDb['unlockContact'](_0x1ccb2c['idContact']);}if(_0x1ccb2c[_0x89a1('0x87')]){rpcDb[_0x89a1('0x64')](_0x1ccb2c[_0x89a1('0x8a')]);}_0x49e7fd[_0x89a1('0xe4')]='22';this[_0x89a1('0x131')](_0x1ccb2c,_0x4c6fe6,_0x49e7fd);}else if(_0x1ccb2c&&_0x1ccb2c[_0x89a1('0x138')]){if(_0x49e7fd['cause']==='16'&&this[_0x89a1('0x12')][_0x49e7fd[_0x89a1('0x88')]][_0x89a1('0x4b')]){logger[_0x89a1('0x25')](_0x89a1('0x139'),_0x49e7fd['linkedid'],_0x49e7fd[_0x89a1('0x134')],'\x20Queue',_0x4c6fe6[_0x89a1('0x29')],_0x89a1('0x4a'),_0x4c6fe6['pTalking']);this[_0x89a1('0x78')](_0x49e7fd,_0x49e7fd[_0x89a1('0x88')],_0x49e7fd[_0x89a1('0x134')]);}else if(this[_0x89a1('0x12')][_0x49e7fd[_0x89a1('0x88')]][_0x89a1('0x4b')]){logger[_0x89a1('0x25')](_0x89a1('0x13a'),_0x49e7fd['linkedid'],_0x49e7fd[_0x89a1('0x134')],'\x20Queue',_0x4c6fe6[_0x89a1('0x29')],_0x89a1('0x4a'),_0x4c6fe6[_0x89a1('0x2f')]);this[_0x89a1('0x78')](_0x49e7fd,_0x49e7fd[_0x89a1('0x88')],_0x49e7fd['cause']);}}};Preview[_0x89a1('0xa')][_0x89a1('0x1c')]=function(_0x15fa7d){if(this['actions'][_0x15fa7d['destlinkedid']]&&_0x15fa7d[_0x89a1('0xe1')]!==_0x15fa7d[_0x89a1('0x13b')]){this[_0x89a1('0x78')](_0x15fa7d,_0x15fa7d['destlinkedid'],_0x15fa7d[_0x89a1('0xd8')]);}};Preview[_0x89a1('0xa')][_0x89a1('0x1a')]=function(_0x495e39){if(this[_0x89a1('0x12')][_0x495e39[_0x89a1('0x88')]]&&_0x495e39[_0x89a1('0x88')]!==_0x495e39[_0x89a1('0x92')]&&!this[_0x89a1('0x12')][_0x495e39[_0x89a1('0x88')]][_0x89a1('0x4b')]){if(_0x495e39['cause']==='1'){this['callProgressDetectingCustomer'](_0x495e39,_0x495e39[_0x89a1('0x88')],_0x495e39['cause']);}}};Preview[_0x89a1('0xa')][_0x89a1('0x13c')]=function(_0x5c91ef,_0x51b315,_0x473213){if(this[_0x89a1('0x12')][_0x5c91ef]){if(_[_0x89a1('0x45')](this['actions'][_0x5c91ef][_0x89a1('0x126')])){this[_0x89a1('0x12')][_0x5c91ef][_0x89a1('0x126')]={};}this[_0x89a1('0x12')][_0x5c91ef][_0x89a1('0x126')][_0x51b315]=_0x473213;}};Preview['prototype'][_0x89a1('0x20')]=function(_0x299bbe){try{if(!_[_0x89a1('0x45')](_0x299bbe)){if(ut[_0x89a1('0x13d')](_[_0x89a1('0x13e')](_0x299bbe['variable'])[0x0])){this[_0x89a1('0x13c')](_0x299bbe[_0x89a1('0x92')],_[_0x89a1('0x13e')](_0x299bbe[_0x89a1('0x13f')])[0x0],_0x299bbe[_0x89a1('0x140')]);}}}catch(_0x518b89){logger[_0x89a1('0x141')](_0x89a1('0x142'),util[_0x89a1('0x143')](_0x518b89,{'showHidden':![],'depth':null}));}};Preview[_0x89a1('0xa')]['syncAttendedTransfer']=function(_0x552639){if(_0x552639){if(this[_0x89a1('0x12')][_0x552639[_0x89a1('0x144')]]){this[_0x89a1('0x12')][_0x552639['transfertargetlinkedid']][_0x89a1('0x138')]=!![];}}};Preview[_0x89a1('0xa')][_0x89a1('0x145')]=function(_0x4bd506){if(_0x4bd506){if(this['actions'][_0x4bd506['transfererlinkedid']]){this['actions'][_0x4bd506['transfererlinkedid']][_0x89a1('0x138')]=!![];}}};module[_0x89a1('0x146')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index a8386ff..6ff6224 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 _0x66a9=['UserId','countReScheduled','[unlockContact]\x20','disableContact','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','context','from-sip','exten','holdtime','assigned','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContact','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','resolve','then','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createCustomerHistory'];(function(_0x3add24,_0x55ce02){var _0x418713=function(_0xa915fa){while(--_0xa915fa){_0x3add24['push'](_0x3add24['shift']());}};_0x418713(++_0x55ce02);}(_0x66a9,0x85));var _0x966a=function(_0x22730b,_0x3aafcd){_0x22730b=_0x22730b-0x0;var _0x20af64=_0x66a9[_0x22730b];return _0x20af64;};'use strict';var util=require(_0x966a('0x0'));var BPromise=require(_0x966a('0x1'));var logger=require('../../../config/logger')(_0x966a('0x2'));var cmHopper=require(_0x966a('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x966a('0x4'));var agentReportPreview=require(_0x966a('0x5'));var voiceQueueReport=require(_0x966a('0x6'));function loggerCatch(_0x1e123d){return function(_0x967d6b){logger[_0x966a('0x7')](_0x1e123d,util[_0x966a('0x8')](_0x967d6b,{'showHidden':![],'depth':null}));};}function create(_0x3919a4){return cmHopperHistory[_0x966a('0x9')](_0x3919a4)['catch'](loggerCatch(_0x966a('0xa')));}function createAgent(_0x2cc9c6){return BPromise[_0x966a('0xb')]()[_0x966a('0xc')](agentReportPreview[_0x966a('0x9')](_0x2cc9c6))[_0x966a('0xd')](loggerCatch(_0x966a('0xa')));}function moveContact(_0x1cf6ea){return cmHopper[_0x966a('0xe')](_0x1cf6ea,!![])[_0x966a('0xd')](loggerCatch(_0x966a('0xf')));}exports[_0x966a('0x10')]=function(_0x9cffb5){return cmHopperBlack[_0x966a('0x10')](_0x9cffb5)['catch'](loggerCatch(_0x966a('0x11')));};exports[_0x966a('0x12')]=function(_0x10555b){return BPromise['resolve']()['then'](cmHopper[_0x966a('0x12')](_0x10555b))[_0x966a('0xd')](loggerCatch('[getContactPreview]\x20'));};exports[_0x966a('0x9')]=function(_0x625a9d,_0x2e62e2){create(_0x625a9d)[_0x966a('0xd')](loggerCatch(_0x2e62e2));moveContact(_0x625a9d)[_0x966a('0xd')](loggerCatch(_0x2e62e2));};exports['createAgentHistory']=function(_0x2833b2,_0x3bd8e2){createAgent(_0x2833b2)[_0x966a('0xd')](loggerCatch(_0x3bd8e2));};exports[_0x966a('0x13')]=function(_0x2ae06f,_0x27d761){create(_0x2ae06f)[_0x966a('0xd')](loggerCatch(_0x27d761));};exports['createCustomerFinal']=function(_0x5caf80,_0x147be8){moveContact(_0x5caf80)[_0x966a('0xd')](loggerCatch(_0x147be8));};exports['rescheduleContact']=function(_0xb6b75a,_0x37f922,_0x5c12ae){if(_0x37f922){_0xb6b75a[_0x966a('0x14')]=null;}if(_0x5c12ae){_0xb6b75a['active']=![];}return cmHopper['rescheduleContact'](_0xb6b75a)[_0x966a('0xd')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x4db3cb){return cmHopper[_0x966a('0x15')](_0x4db3cb)[_0x966a('0xd')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x576390){return cmHopper['unlockContact']({'UserId':null},_0x576390,0x1)['catch'](loggerCatch(_0x966a('0x16')));};exports[_0x966a('0x17')]=function(_0x11dd0a){return cmHopper[_0x966a('0x18')]({'active':![]},_0x11dd0a,0x1)[_0x966a('0xd')](loggerCatch(_0x966a('0x19')));};exports[_0x966a('0x1a')]=function(_0x3b5c39){var _0x206771={};_0x206771[_0x966a('0x1b')]=_0x3b5c39[_0x966a('0x1b')];_0x206771[_0x966a('0x1c')]=_0x3b5c39['uniqueid'];_0x206771['calleridnum']=_0x3b5c39['calleridnum'];_0x206771[_0x966a('0x1d')]=_0x3b5c39[_0x966a('0x1d')];_0x206771[_0x966a('0x1e')]=_0x3b5c39[_0x966a('0x1e')];_0x206771[_0x966a('0x1f')]=_0x3b5c39[_0x966a('0x20')];_0x206771[_0x966a('0x21')]=_0x3b5c39[_0x966a('0x20')];_0x206771[_0x966a('0x22')]=0x1;_0x206771[_0x966a('0x23')]=_0x3b5c39[_0x966a('0x24')];_0x206771['connectedlinename']=_0x3b5c39['membername'];_0x206771[_0x966a('0x25')]=_0x966a('0x26');_0x206771[_0x966a('0x27')]='xcally-motion-preview';_0x206771[_0x966a('0x28')]=0x0;_0x206771[_0x966a('0x29')]=0x1;_0x206771['lastAssignedTo']=_0x3b5c39[_0x966a('0x2a')];_0x206771[_0x966a('0x2b')]=_0x966a('0x2c');return BPromise['resolve']()[_0x966a('0xc')](voiceQueueReport[_0x966a('0x2d')](_0x206771))[_0x966a('0xd')](loggerCatch(_0x966a('0x2e')));};exports[_0x966a('0x2f')]=function(_0x8ebf51,_0x120fd9){return BPromise[_0x966a('0xb')]()[_0x966a('0xc')](cmHopper['getContactRecallMe'](_0x8ebf51,_0x120fd9))[_0x966a('0xd')](loggerCatch(_0x966a('0x30')));};exports['rescheduleContactInQueue']=function(_0x561f47){return cmHopper[_0x966a('0x31')](_0x561f47,!![],!![])[_0x966a('0xd')](loggerCatch(_0x966a('0x32')));}; \ No newline at end of file +var _0x60f2=['moveContactManagedDialer','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','util','preview','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','resolve','then','catch','[createHistory]\x20'];(function(_0x31685d,_0x203f48){var _0x491db6=function(_0x4ece67){while(--_0x4ece67){_0x31685d['push'](_0x31685d['shift']());}};_0x491db6(++_0x203f48);}(_0x60f2,0xe4));var _0x260f=function(_0x3a93cc,_0x804c22){_0x3a93cc=_0x3a93cc-0x0;var _0x1f8154=_0x60f2[_0x3a93cc];return _0x1f8154;};'use strict';var util=require(_0x260f('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x260f('0x1'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x260f('0x2'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x260f('0x3'));var voiceQueueReport=require(_0x260f('0x4'));function loggerCatch(_0x36f3dd){return function(_0x16ddfc){logger[_0x260f('0x5')](_0x36f3dd,util[_0x260f('0x6')](_0x16ddfc,{'showHidden':![],'depth':null}));};}function create(_0x40483c){return cmHopperHistory[_0x260f('0x7')](_0x40483c)['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x55f42e){return BPromise[_0x260f('0x8')]()[_0x260f('0x9')](agentReportPreview[_0x260f('0x7')](_0x55f42e))[_0x260f('0xa')](loggerCatch(_0x260f('0xb')));}function moveContact(_0x6ad2db){return cmHopper[_0x260f('0xc')](_0x6ad2db,!![])[_0x260f('0xa')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x260f('0xd')]=function(_0x96660d){return cmHopperBlack['checkIsBlackList'](_0x96660d)[_0x260f('0xa')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x34e4fd){return BPromise[_0x260f('0x8')]()[_0x260f('0x9')](cmHopper[_0x260f('0xe')](_0x34e4fd))['catch'](loggerCatch(_0x260f('0xf')));};exports[_0x260f('0x7')]=function(_0x4c85d1,_0x55632b){create(_0x4c85d1)[_0x260f('0xa')](loggerCatch(_0x55632b));moveContact(_0x4c85d1)[_0x260f('0xa')](loggerCatch(_0x55632b));};exports[_0x260f('0x10')]=function(_0x8d9ef6,_0x29969d){createAgent(_0x8d9ef6)['catch'](loggerCatch(_0x29969d));};exports[_0x260f('0x11')]=function(_0x234686,_0x7c3ca0){create(_0x234686)[_0x260f('0xa')](loggerCatch(_0x7c3ca0));};exports[_0x260f('0x12')]=function(_0x1bc85c,_0x1a5289){moveContact(_0x1bc85c)['catch'](loggerCatch(_0x1a5289));};exports[_0x260f('0x13')]=function(_0x456a64,_0x3f94cc,_0x1d46a5){if(_0x3f94cc){_0x456a64[_0x260f('0x14')]=null;}if(_0x1d46a5){_0x456a64[_0x260f('0x15')]=![];}return cmHopper[_0x260f('0x13')](_0x456a64)[_0x260f('0xa')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x260f('0x16')]=function(_0x372ce5){return cmHopper[_0x260f('0x16')](_0x372ce5)[_0x260f('0xa')](loggerCatch('[countReScheduled]\x20'));};exports[_0x260f('0x17')]=function(_0x5a6c2b){return cmHopper[_0x260f('0x17')]({'UserId':null},_0x5a6c2b,0x1)[_0x260f('0xa')](loggerCatch(_0x260f('0x18')));};exports[_0x260f('0x19')]=function(_0x4eb23a){return cmHopper[_0x260f('0x17')]({'active':![]},_0x4eb23a,0x1)[_0x260f('0xa')](loggerCatch(_0x260f('0x1a')));};exports['crateCustomerReportQueue']=function(_0x34393a){var _0x5e33d8={};_0x5e33d8[_0x260f('0x1b')]=_0x34393a[_0x260f('0x1b')];_0x5e33d8[_0x260f('0x1c')]=_0x34393a[_0x260f('0x1c')];_0x5e33d8[_0x260f('0x1d')]=_0x34393a[_0x260f('0x1d')];_0x5e33d8[_0x260f('0x1e')]=_0x34393a[_0x260f('0x1e')];_0x5e33d8[_0x260f('0x1f')]=_0x34393a[_0x260f('0x1f')];_0x5e33d8[_0x260f('0x20')]=_0x34393a[_0x260f('0x21')];_0x5e33d8[_0x260f('0x22')]=_0x34393a[_0x260f('0x21')];_0x5e33d8['queuecallercomplete']=0x1;_0x5e33d8['queuecallercompleteAt']=_0x34393a[_0x260f('0x23')];_0x5e33d8[_0x260f('0x24')]=_0x34393a[_0x260f('0x25')];_0x5e33d8['context']=_0x260f('0x26');_0x5e33d8[_0x260f('0x27')]=_0x260f('0x28');_0x5e33d8[_0x260f('0x29')]=0x0;_0x5e33d8['assigned']=0x1;_0x5e33d8['lastAssignedTo']=_0x34393a[_0x260f('0x25')];_0x5e33d8[_0x260f('0x2a')]=_0x260f('0x2b');return BPromise[_0x260f('0x8')]()[_0x260f('0x9')](voiceQueueReport[_0x260f('0x2c')](_0x5e33d8))[_0x260f('0xa')](loggerCatch(_0x260f('0x2d')));};exports[_0x260f('0x2e')]=function(_0x4c9c90,_0x1555db){return BPromise[_0x260f('0x8')]()[_0x260f('0x9')](cmHopper[_0x260f('0x2e')](_0x4c9c90,_0x1555db))['catch'](loggerCatch(_0x260f('0x2f')));};exports['rescheduleContactInQueue']=function(_0x262597){return cmHopper[_0x260f('0x13')](_0x262597,!![],!![])[_0x260f('0xa')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index aa59940..8ac34a8 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 _0x5e54=['Failure','RECALL','uniqueid','originate','calleridnum','timeout','totalGlobal','countbusyretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ListId','VoiceQueueId','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','lastevent','name','queue','interface','channelAgent','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','campaigntype','dialAnswer','membername','countcongestionretry','countglobal','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitter','getCallerIdRandom','pow','replace','random','match','extractCalleridNumber','noanswer','forEach','toLowerCase','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','calleridname','ContactId','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','starttime','responsetime','endtime','logAgent','statedesc','getSeconds','logLookAgent','logCustomer','ringtime','answertime'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x5e54,0xd3));var _0x45e5=function(_0x212cc9,_0x555b66){_0x212cc9=_0x212cc9-0x0;var _0x4267d7=_0x5e54[_0x212cc9];return _0x4267d7;};'use strict';var util=require(_0x45e5('0x0'));var _=require(_0x45e5('0x1'));var moment=require(_0x45e5('0x2'));var logger=require(_0x45e5('0x3'))(_0x45e5('0x4'));var ipAgi=process[_0x45e5('0x5')][_0x45e5('0x6')]||_0x45e5('0x7');var utils=require('../../dialer/utils');exports[_0x45e5('0x8')]=function(_0x1677c3){return function(_0x4b4e95){logger[_0x45e5('0x9')](_0x1677c3,util[_0x45e5('0xa')](_0x4b4e95,{'showHidden':![],'depth':null}));};};exports[_0x45e5('0xb')]=function(_0x46906a,_0xe87f64){logger[_0x45e5('0xc')](_0x46906a,util[_0x45e5('0xa')](_0xe87f64,{'showHidden':![],'depth':null}));};exports[_0x45e5('0xd')]=function(_0x168ee6,_0x1e4bf1){logger[_0x45e5('0x9')](_0x168ee6,util[_0x45e5('0xa')](_0x1e4bf1,{'showHidden':![],'depth':null}));};exports[_0x45e5('0xe')]=function(_0x2cc31c){return function(_0x43273a){logger[_0x45e5('0xc')](_0x2cc31c,util[_0x45e5('0xa')](_0x43273a,{'showHidden':![],'depth':null}));};};exports[_0x45e5('0xf')]=function(_0x43408f,_0x3b2e81,_0x2a08cf){return{'message':_0x43408f,'unlock':_0x3b2e81,'active':_0x2a08cf};};exports[_0x45e5('0x10')]=function(_0x2fad2b,_0x2839a6,_0x12c9f1){if(!_[_0x45e5('0x11')](_0x12c9f1)&&_0x45e5('0x12')===typeof _0x12c9f1&&!_[_0x45e5('0x13')](_0x12c9f1)){if(!_[_0x45e5('0x11')](_0x2839a6)&&_0x45e5('0x12')===typeof _0x2839a6&&!_[_0x45e5('0x13')](_0x2839a6)){return util[_0x45e5('0x14')](_0x45e5('0x15'),_0x2839a6,_0x12c9f1);}return util[_0x45e5('0x14')](_0x45e5('0x15'),_0x12c9f1,_0x12c9f1);}if(!_['isUndefined'](_0x2fad2b)&&_0x45e5('0x12')===typeof _0x2fad2b&&!_[_0x45e5('0x13')](_0x2fad2b)){return _0x2fad2b;}return _0x45e5('0x16');};exports[_0x45e5('0x17')]=function(_0xbc7178){if(_[_0x45e5('0x18')](_0xbc7178)){return![];}return _0xbc7178;};exports['addVariables']=function(_0xe79494,_0x5edd1d,_0x5f0f28,_0x3c24c7,_0x1c2f26,_0x32770a){var _0x50ba80={'XMD-QUEUE':_0x5edd1d[_0x45e5('0x19')]?_0x5edd1d[_0x45e5('0x19')]['name']:'','XMD-CALLERID':_0x3c24c7,'XMD-CALLERID-PREVIEW':_0x32770a?util[_0x45e5('0x14')]('\x22%s\x22\x20<%s>',_0x32770a[_0x45e5('0x1a')],_0x32770a['calleridnum']):_0x3c24c7,'XMD-DIALID':_0x1c2f26,'XMD-CONTACTID':_0x5edd1d[_0x45e5('0x1b')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3c24c7,'XMD-VOICEQUEUEID':_0x5edd1d['VoiceQueueId'],'XMD-DIALCHANNEL':_0x5f0f28,'XMD-DIALTIMEOUT':_0xe79494[_0x45e5('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x45e5('0x14')]('\x22rtTxX%s%s\x22',_0xe79494[_0x45e5('0x1d')]?'g':'',_['isEmpty'](_0xe79494['monitor_format'])?'':_0x45e5('0x1e')),'XMD-DIALURL':_0xe79494[_0x45e5('0x1f')]||'','XMD-AGI':_0xe79494[_0x45e5('0x20')]?util[_0x45e5('0x14')](_0x45e5('0x21'),ipAgi,_0xe79494[_0x45e5('0x20')]):_0x45e5('0x22'),'XMD-AGIAFTER':_0xe79494[_0x45e5('0x1d')]?util[_0x45e5('0x14')](_0x45e5('0x21'),ipAgi,_0xe79494[_0x45e5('0x1d')]):_0x45e5('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x32770a?_0x32770a[_0x45e5('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x32770a?_0x32770a[_0x45e5('0x24')]:'','XMD-DESTINATION':_0x45e5('0x25'),'SIPADDHEADER':_0x45e5('0x26')};if(!_[_0x45e5('0x13')](_0xe79494[_0x45e5('0x27')])){_0x50ba80[util['format']('%s',_0x45e5('0x28'))]=_0xe79494[_0x45e5('0x27')];_0x50ba80[util[_0x45e5('0x14')]('%s',_0x45e5('0x29'))]=_0x1c2f26;}return _0x50ba80;};exports[_0x45e5('0x2a')]=function(_0x50a3f5){var _0x2ee146={};for(var _0x54791f in _0x50a3f5){if(_0x50a3f5[_0x45e5('0x2b')](_0x54791f)){_0x2ee146[util[_0x45e5('0x14')]('%s',_['toLower'](_0x54791f))]=_0x50a3f5[_0x54791f];}}return{'variables':_0x2ee146};};exports[_0x45e5('0x2c')]=function(_0x5d884c){var _0x5a6d45=moment()[_0x45e5('0x14')](_0x45e5('0x2d'));_0x5d884c[_0x45e5('0x2e')]=0xd;_0x5d884c['statedesc']='Blacklist';_0x5d884c[_0x45e5('0x2f')]=_0x5a6d45;_0x5d884c[_0x45e5('0x30')]=_0x5a6d45;_0x5d884c[_0x45e5('0x31')]=_0x5a6d45;};exports[_0x45e5('0x32')]=function(_0x196aa2,_0x1dedd5,_0x12cf58){var _0x17c131=moment()[_0x45e5('0x14')](_0x45e5('0x2d'));_0x196aa2[_0x45e5('0x2e')]=_0x1dedd5;_0x196aa2[_0x45e5('0x33')]=_0x12cf58;_0x196aa2[_0x45e5('0x30')]=_0x17c131;_0x196aa2['ringtime']=utils[_0x45e5('0x34')](_0x196aa2[_0x45e5('0x30')],_0x196aa2[_0x45e5('0x2f')]);};exports[_0x45e5('0x35')]=function(_0x27b333,_0x36e011,_0x194ab5){_0x27b333['membername']=_0x36e011;_0x27b333['UserId']=_0x194ab5;};exports[_0x45e5('0x36')]=function(_0x49ffb2,_0x58dc94,_0x3cab9c){var _0xa3a182=moment()[_0x45e5('0x14')](_0x45e5('0x2d'));_0x49ffb2[_0x45e5('0x2e')]=_0x58dc94;_0x49ffb2[_0x45e5('0x33')]=_0x3cab9c;_0x49ffb2[_0x45e5('0x30')]=_0x49ffb2[_0x45e5('0x30')]?_0x49ffb2[_0x45e5('0x30')]:_0xa3a182;_0x49ffb2[_0x45e5('0x31')]=_0x49ffb2[_0x45e5('0x31')]?_0x49ffb2[_0x45e5('0x31')]:_0xa3a182;_0x49ffb2[_0x45e5('0x37')]=utils[_0x45e5('0x34')](_0x49ffb2[_0x45e5('0x30')]||0x0,_0x49ffb2[_0x45e5('0x2f')]||0x0);_0x49ffb2['talktime']=_0x49ffb2[_0x45e5('0x38')]?utils[_0x45e5('0x34')](_0x49ffb2[_0x45e5('0x31')],_0x49ffb2[_0x45e5('0x38')]):0x0;};exports['isFailure']=function(_0x50bb22){return _0x50bb22===_0x45e5('0x39');};exports['variablesAction']=function(_0x3f3ea1,_0xcc971b,_0x1f56d1,_0x354fda,_0x400db2){var _0x4b6a49=_0x354fda?_0x45e5('0x3a'):_0x3f3ea1[_0x45e5('0x1a')];_0x4b6a49=_0x400db2?'BOOKED':_0x4b6a49;return{'actionid':_0x3f3ea1[_0x45e5('0x3b')],'action':_0x45e5('0x3c'),'channel':_0x3f3ea1['channelAgent'],'callerid':util[_0x45e5('0x14')]('\x22%s\x22\x20<%s>',_0x4b6a49,_0x3f3ea1[_0x45e5('0x3d')]),'Exten':_0x45e5('0x25'),'Context':'from-sip','Priority':'1','variable':_0x1f56d1,'timeout':(_0xcc971b[_0x45e5('0x3e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3f3ea1[_0x45e5('0x3b')]};};exports[_0x45e5('0x3f')]=function(_0x5c2ad1){return _0x5c2ad1[_0x45e5('0x40')]+_0x5c2ad1['countcongestionretry']+_0x5c2ad1[_0x45e5('0x41')]+_0x5c2ad1['countagentrejectretry']+_0x5c2ad1[_0x45e5('0x42')];};exports[_0x45e5('0x43')]=function(_0x6ecd68){var _0x30759f=_[_0x45e5('0x44')](_0x6ecd68);_0x30759f[_0x45e5('0x2e')]=0xf;_0x30759f[_0x45e5('0x33')]=_0x45e5('0x45');return _0x30759f;};exports[_0x45e5('0x46')]=function(_0x4b82bd,_0x2bc15a,_0x7b85a9){var _0x5b752f={};_0x5b752f[_0x2bc15a]=_0x4b82bd[_0x2bc15a];_0x5b752f[_0x45e5('0x47')]=![];_0x5b752f[_0x45e5('0x48')]=moment()[_0x45e5('0x49')](_0x7b85a9,'minutes')[_0x45e5('0x14')](_0x45e5('0x2d'));_0x5b752f[_0x45e5('0x1b')]=_0x4b82bd[_0x45e5('0x1b')];_0x5b752f[_0x45e5('0x4a')]=_0x4b82bd[_0x45e5('0x4a')];_0x5b752f[_0x45e5('0x4b')]=_0x4b82bd[_0x45e5('0x4b')]||undefined;return _0x5b752f;};exports['decrementTalking']=function(_0x251197,_0x423936){if(!_[_0x45e5('0x18')](_0x251197)){if(_0x251197[_0x45e5('0x4c')]>0x0){_0x251197['pTalking']-=0x1;}else{logger['info'](_0x423936,_0x45e5('0x4d'));}}else{logger[_0x45e5('0x9')](_0x423936,'[decrementTalking]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x14f033){if(_0x14f033<=0x0){return!![];}return![];};function buildObj(_0x4464bc,_0x4002d5,_0x3f8c95){_0x4464bc[_0x45e5('0x4e')]=_0x4002d5;_0x4464bc[_0x45e5('0x4f')]=_0x4464bc[_0x45e5('0x50')];_0x4464bc[_0x45e5('0x51')]=_0x4464bc[_0x45e5('0x52')];_0x4464bc['motionChannel']='voice';if(_0x3f8c95){_0x4464bc[_0x45e5('0x53')]=_0x3f8c95[_0x45e5('0x53')];}return _0x4464bc;}exports[_0x45e5('0x54')]=buildObj;exports[_0x45e5('0x55')]=function(_0xd0aa86){var _0x19d705=[];for(var _0x2ffabb in _0xd0aa86){if(_0xd0aa86['hasOwnProperty'](_0x2ffabb)){if(!_['isNil'](_0xd0aa86[_0x2ffabb])&&_0xd0aa86[_0x2ffabb][_0x45e5('0x2e')]===_0x45e5('0x56')&&_0xd0aa86[_0x2ffabb][_0x45e5('0x57')]===_0x45e5('0x58')){_0x19d705[_0x45e5('0x59')](_0xd0aa86[_0x2ffabb]['id']);}}}return _0x19d705;};exports[_0x45e5('0x5a')]=function(_0x43a7b6){var _0x52441b=moment()[_0x45e5('0x5b')](0x0);var _0x1f4811=moment(_0x43a7b6)['milliseconds'](0x0);return _0x52441b[_0x45e5('0x5c')](_0x1f4811,_0x45e5('0x5d'));};exports[_0x45e5('0x5e')]=function(_0x47a7cf){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x47a7cf[_0x45e5('0x1b')],'ListId':_0x47a7cf[_0x45e5('0x4a')],'VoiceQueueId':_0x47a7cf[_0x45e5('0x4b')]||undefined,'CampaignId':_0x47a7cf[_0x45e5('0x5f')]||undefined};};exports[_0x45e5('0x60')]=function(_0x572cd0){if(_0x572cd0===_0x45e5('0x3b')||_0x572cd0==='idContact'||_0x572cd0==='queue'||_0x572cd0==='type'||_0x572cd0===_0x45e5('0x61')||_0x572cd0===_0x45e5('0x62')||_0x572cd0===_0x45e5('0x63')||_0x572cd0==='channelAgent'||_0x572cd0===_0x45e5('0x1a')||_0x572cd0===_0x45e5('0x47')||_0x572cd0===_0x45e5('0x3d')||_0x572cd0==='scheduledat'||_0x572cd0===_0x45e5('0x40')||_0x572cd0===_0x45e5('0x64')||_0x572cd0==='countnoanswerretry'||_0x572cd0===_0x45e5('0x65')||_0x572cd0==='callback'||_0x572cd0===_0x45e5('0x66')||_0x572cd0===_0x45e5('0x67')||_0x572cd0===_0x45e5('0x68')||_0x572cd0===_0x45e5('0x1b')||_0x572cd0===_0x45e5('0x4a')||_0x572cd0===_0x45e5('0x69')||_0x572cd0===_0x45e5('0x4b')||_0x572cd0===_0x45e5('0x6a')||_0x572cd0===_0x45e5('0x6b')||_0x572cd0===_0x45e5('0x6c')||_0x572cd0===_0x45e5('0x6d')||_0x572cd0===_0x45e5('0x6e')||_0x572cd0==='xmd-dialurl'||_0x572cd0==='xmd-dialtimeout'||_0x572cd0===_0x45e5('0x6f')||_0x572cd0==='xmd-dialid'||_0x572cd0===_0x45e5('0x70')||_0x572cd0===_0x45e5('0x71')||_0x572cd0===_0x45e5('0x72')||_0x572cd0===_0x45e5('0x73')||_0x572cd0==='xmd-agiafter'||_0x572cd0===_0x45e5('0x74')||_0x572cd0===_0x45e5('0x75')||_0x572cd0==='rtpaudioqosbridged'||_0x572cd0==='rtpaudioqosjitter'||_0x572cd0===_0x45e5('0x76')||_0x572cd0===_0x45e5('0x77')||_0x572cd0===_0x45e5('0x78')||_0x572cd0===_0x45e5('0x79')||_0x572cd0===_0x45e5('0x7a')||_0x572cd0===_0x45e5('0x75')||_0x572cd0===_0x45e5('0x7b')||_0x572cd0===_0x45e5('0x7c')||_0x572cd0===_0x45e5('0x76')||_0x572cd0===_0x45e5('0x77')||_0x572cd0===_0x45e5('0x78')||_0x572cd0===_0x45e5('0x79')||_0x572cd0===_0x45e5('0x7a')||_0x572cd0==='bridgepeer'||_0x572cd0==='bridgepvtcallid'||_0x572cd0===_0x45e5('0x2e')||_0x572cd0===_0x45e5('0x33')){return![];}return!![];};exports[_0x45e5('0x7d')]=function(_0x2516fb,_0x2e5eb8){var _0x42544f,_0x39b6f7,_0x59537a;if(_0x2e5eb8<=0x0){_0x2e5eb8=0x1;}_0x42544f=new RegExp('\x5cw{0,'+_0x2e5eb8+'}$');_0x39b6f7=Math['pow'](0xa,_0x2e5eb8-0x1);_0x59537a=Math[_0x45e5('0x7e')](0xa,_0x2e5eb8)-0x1;return util[_0x45e5('0x14')]('%s',_[_0x45e5('0x7f')](_0x2516fb,_0x42544f,_[_0x45e5('0x80')](_0x39b6f7,_0x59537a)));};exports['extractCalleridName']=function(_0x3de26a){var _0x42ddd9=_0x3de26a[_0x45e5('0x81')](/"(.*?)"/);return _0x42ddd9?_0x42ddd9[0x1]:_0x3de26a;};exports[_0x45e5('0x82')]=function(_0x1bef7d){var _0x504307=_0x1bef7d['match'](/<(.*?)>/);return _0x504307?_0x504307[0x1]:_0x1bef7d;};function buildNoAnswerEventPayload(_0x44d6a3,_0x2526fd){var _0x1eb2cd=buildObj(_0x44d6a3,_0x45e5('0x83'));if(!_[_0x45e5('0x13')](_0x2526fd['variables'])){Object['keys'](_0x2526fd['variables'])[_0x45e5('0x84')](function(_0x50b63a){_0x1eb2cd[_0x50b63a[_0x45e5('0x85')]()]=_0x2526fd['variables'][_0x50b63a];});}return _0x1eb2cd;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x9bb5=['uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','Global','scheduledAt','active','scheduledat','minutes','ContactId','ListId','decrementTalking','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','queue','motionChannel','mandatoryDisposition','buildObj','agentReadyId','hasOwnProperty','not_inuse','push','milliseconds','CampaignId','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','env','XCALLY_IP_AGI','../../dialer/utils','error','logger','info','loggerError','inspect','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isNil','addVariables','Queue','name','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','endtime','responsetime','getSeconds','starttime','logLookAgent','membername','UserId','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','originate','channelAgent','xcally-motion-preview','from-sip','timeout'];(function(_0x29c86a,_0x52ee0e){var _0x6727e=function(_0x10110a){while(--_0x10110a){_0x29c86a['push'](_0x29c86a['shift']());}};_0x6727e(++_0x52ee0e);}(_0x9bb5,0x1ba));var _0x59bb=function(_0x4c14a7,_0x550e7d){_0x4c14a7=_0x4c14a7-0x0;var _0x563a39=_0x9bb5[_0x4c14a7];return _0x563a39;};'use strict';var util=require(_0x59bb('0x0'));var _=require(_0x59bb('0x1'));var moment=require(_0x59bb('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0x59bb('0x3')][_0x59bb('0x4')]||'127.0.0.1';var utils=require(_0x59bb('0x5'));exports['loggerCatch']=function(_0x1ce7c0){return function(_0x26ffb5){logger[_0x59bb('0x6')](_0x1ce7c0,util['inspect'](_0x26ffb5,{'showHidden':![],'depth':null}));};};exports[_0x59bb('0x7')]=function(_0x3ff896,_0x4808f1){logger[_0x59bb('0x8')](_0x3ff896,util['inspect'](_0x4808f1,{'showHidden':![],'depth':null}));};exports[_0x59bb('0x9')]=function(_0x4e854f,_0x3d25a7){logger[_0x59bb('0x6')](_0x4e854f,util[_0x59bb('0xa')](_0x3d25a7,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x102ce7){return function(_0x3ed9ba){logger[_0x59bb('0x8')](_0x102ce7,util[_0x59bb('0xa')](_0x3ed9ba,{'showHidden':![],'depth':null}));};};exports[_0x59bb('0xb')]=function(_0x1fe341,_0x62eff6,_0x2b79ec){return{'message':_0x1fe341,'unlock':_0x62eff6,'active':_0x2b79ec};};exports[_0x59bb('0xc')]=function(_0x3e4535,_0x55806c,_0x11aa8b){if(!_[_0x59bb('0xd')](_0x11aa8b)&&_0x59bb('0xe')===typeof _0x11aa8b&&!_[_0x59bb('0xf')](_0x11aa8b)){if(!_['isUndefined'](_0x55806c)&&'string'===typeof _0x55806c&&!_[_0x59bb('0xf')](_0x55806c)){return util['format']('\x22%s\x22\x20<%s>',_0x55806c,_0x11aa8b);}return util[_0x59bb('0x10')](_0x59bb('0x11'),_0x11aa8b,_0x11aa8b);}if(!_[_0x59bb('0xd')](_0x3e4535)&&_0x59bb('0xe')===typeof _0x3e4535&&!_[_0x59bb('0xf')](_0x3e4535)){return _0x3e4535;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x130e00){if(_[_0x59bb('0x12')](_0x130e00)){return![];}return _0x130e00;};exports[_0x59bb('0x13')]=function(_0x1054f8,_0x3f3c46,_0x55e769,_0xff489f,_0x5f0165,_0x2c7913){var _0x1cb16f={'XMD-QUEUE':_0x3f3c46['Queue']?_0x3f3c46[_0x59bb('0x14')][_0x59bb('0x15')]:'','XMD-CALLERID':_0xff489f,'XMD-CALLERID-PREVIEW':_0x2c7913?util[_0x59bb('0x10')]('\x22%s\x22\x20<%s>',_0x2c7913[_0x59bb('0x16')],_0x2c7913[_0x59bb('0x17')]):_0xff489f,'XMD-DIALID':_0x5f0165,'XMD-CONTACTID':_0x3f3c46['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xff489f,'XMD-VOICEQUEUEID':_0x3f3c46[_0x59bb('0x18')],'XMD-DIALCHANNEL':_0x55e769,'XMD-DIALTIMEOUT':_0x1054f8[_0x59bb('0x19')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x59bb('0x1a'),_0x1054f8[_0x59bb('0x1b')]?'g':'',_[_0x59bb('0xf')](_0x1054f8[_0x59bb('0x1c')])?'':_0x59bb('0x1d')),'XMD-DIALURL':_0x1054f8[_0x59bb('0x1e')]||'','XMD-AGI':_0x1054f8[_0x59bb('0x1f')]?util[_0x59bb('0x10')](_0x59bb('0x20'),ipAgi,_0x1054f8[_0x59bb('0x1f')]):_0x59bb('0x21'),'XMD-AGIAFTER':_0x1054f8[_0x59bb('0x1b')]?util[_0x59bb('0x10')](_0x59bb('0x20'),ipAgi,_0x1054f8[_0x59bb('0x1b')]):_0x59bb('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x2c7913?_0x2c7913[_0x59bb('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x2c7913?_0x2c7913[_0x59bb('0x23')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x59bb('0x24')};if(!_['isEmpty'](_0x1054f8['monitor_format'])){_0x1cb16f[util[_0x59bb('0x10')]('%s',_0x59bb('0x25'))]=_0x1054f8['monitor_format'];_0x1cb16f[util[_0x59bb('0x10')]('%s',_0x59bb('0x26'))]=_0x5f0165;}return _0x1cb16f;};exports[_0x59bb('0x27')]=function(_0x574b68){var _0x301fce={};for(var _0x12edb5 in _0x574b68){if(_0x574b68['hasOwnProperty'](_0x12edb5)){_0x301fce[util[_0x59bb('0x10')]('%s',_[_0x59bb('0x28')](_0x12edb5))]=_0x574b68[_0x12edb5];}}return{'variables':_0x301fce};};exports['logBlacklist']=function(_0x44dc82){var _0x34d5ec=moment()['format'](_0x59bb('0x29'));_0x44dc82[_0x59bb('0x2a')]=0xd;_0x44dc82[_0x59bb('0x2b')]='Blacklist';_0x44dc82['starttime']=_0x34d5ec;_0x44dc82['responsetime']=_0x34d5ec;_0x44dc82[_0x59bb('0x2c')]=_0x34d5ec;};exports['logAgent']=function(_0x376de1,_0x40bb9d,_0x2e64d4){var _0x5c9a0b=moment()[_0x59bb('0x10')](_0x59bb('0x29'));_0x376de1['state']=_0x40bb9d;_0x376de1[_0x59bb('0x2b')]=_0x2e64d4;_0x376de1[_0x59bb('0x2d')]=_0x5c9a0b;_0x376de1['ringtime']=utils[_0x59bb('0x2e')](_0x376de1[_0x59bb('0x2d')],_0x376de1[_0x59bb('0x2f')]);};exports[_0x59bb('0x30')]=function(_0x2e6c07,_0x6ccb45,_0x284c13){_0x2e6c07[_0x59bb('0x31')]=_0x6ccb45;_0x2e6c07[_0x59bb('0x32')]=_0x284c13;};exports['logCustomer']=function(_0x103764,_0x4c26a2,_0x41187e){var _0x265c0b=moment()[_0x59bb('0x10')](_0x59bb('0x29'));_0x103764['state']=_0x4c26a2;_0x103764[_0x59bb('0x2b')]=_0x41187e;_0x103764[_0x59bb('0x2d')]=_0x103764[_0x59bb('0x2d')]?_0x103764['responsetime']:_0x265c0b;_0x103764[_0x59bb('0x2c')]=_0x103764[_0x59bb('0x2c')]?_0x103764[_0x59bb('0x2c')]:_0x265c0b;_0x103764['ringtime']=utils[_0x59bb('0x2e')](_0x103764['responsetime']||0x0,_0x103764['starttime']||0x0);_0x103764[_0x59bb('0x33')]=_0x103764[_0x59bb('0x34')]?utils[_0x59bb('0x2e')](_0x103764['endtime'],_0x103764[_0x59bb('0x34')]):0x0;};exports['isFailure']=function(_0x1dbff0){return _0x1dbff0===_0x59bb('0x35');};exports[_0x59bb('0x36')]=function(_0x50bddc,_0x40564e,_0xb79827,_0x3ae977,_0x266821){var _0x3bf272=_0x3ae977?_0x59bb('0x37'):_0x50bddc['calleridname'];_0x3bf272=_0x266821?_0x59bb('0x38'):_0x3bf272;return{'actionid':_0x50bddc['uniqueid'],'action':_0x59bb('0x39'),'channel':_0x50bddc[_0x59bb('0x3a')],'callerid':util[_0x59bb('0x10')](_0x59bb('0x11'),_0x3bf272,_0x50bddc[_0x59bb('0x17')]),'Exten':_0x59bb('0x3b'),'Context':_0x59bb('0x3c'),'Priority':'1','variable':_0xb79827,'timeout':(_0x40564e[_0x59bb('0x3d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x50bddc[_0x59bb('0x3e')]};};exports[_0x59bb('0x3f')]=function(_0x6ba3c2){return _0x6ba3c2[_0x59bb('0x40')]+_0x6ba3c2[_0x59bb('0x41')]+_0x6ba3c2[_0x59bb('0x42')]+_0x6ba3c2[_0x59bb('0x43')]+_0x6ba3c2['countnosuchnumberretry'];};exports['cloneAction']=function(_0x254a85){var _0x1d20db=_['clone'](_0x254a85);_0x1d20db[_0x59bb('0x2a')]=0xf;_0x1d20db['statedesc']=_0x59bb('0x44');return _0x1d20db;};exports[_0x59bb('0x45')]=function(_0x50a2cd,_0x325d97,_0x574bf1){var _0x1bfd21={};_0x1bfd21[_0x325d97]=_0x50a2cd[_0x325d97];_0x1bfd21[_0x59bb('0x46')]=![];_0x1bfd21[_0x59bb('0x47')]=moment()['add'](_0x574bf1,_0x59bb('0x48'))[_0x59bb('0x10')](_0x59bb('0x29'));_0x1bfd21[_0x59bb('0x49')]=_0x50a2cd[_0x59bb('0x49')];_0x1bfd21[_0x59bb('0x4a')]=_0x50a2cd[_0x59bb('0x4a')];_0x1bfd21[_0x59bb('0x18')]=_0x50a2cd[_0x59bb('0x18')]||undefined;return _0x1bfd21;};exports[_0x59bb('0x4b')]=function(_0xd9f579,_0xd7fc61){if(!_['isNil'](_0xd9f579)){if(_0xd9f579[_0x59bb('0x4c')]>0x0){_0xd9f579[_0x59bb('0x4c')]-=0x1;}else{logger[_0x59bb('0x8')](_0xd7fc61,_0x59bb('0x4d'));}}else{logger[_0x59bb('0x6')](_0xd7fc61,'[decrementTalking]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x5348c6){if(_0x5348c6<=0x0){return!![];}return![];};function buildObj(_0x35e904,_0x104123,_0x2c6efd){_0x35e904['lastevent']=_0x104123;_0x35e904['name']=_0x35e904[_0x59bb('0x4e')];_0x35e904['interface']=_0x35e904[_0x59bb('0x3a')];_0x35e904[_0x59bb('0x4f')]='voice';if(_0x2c6efd){_0x35e904[_0x59bb('0x50')]=_0x2c6efd['mandatoryDisposition'];}return _0x35e904;}exports[_0x59bb('0x51')]=buildObj;exports[_0x59bb('0x52')]=function(_0x23c46d){var _0x5c6797=[];for(var _0x5b1886 in _0x23c46d){if(_0x23c46d[_0x59bb('0x53')](_0x5b1886)){if(!_[_0x59bb('0x12')](_0x23c46d[_0x5b1886])&&_0x23c46d[_0x5b1886]['state']===_0x59bb('0x54')&&_0x23c46d[_0x5b1886]['status']==='reachable'){_0x5c6797[_0x59bb('0x55')](_0x23c46d[_0x5b1886]['id']);}}}return _0x5c6797;};exports['getDiff']=function(_0x4850a4){var _0x495ac7=moment()[_0x59bb('0x56')](0x0);var _0x35c7d6=moment(_0x4850a4)[_0x59bb('0x56')](0x0);return _0x495ac7['diff'](_0x35c7d6,'seconds');};exports['createBody']=function(_0x446259){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x446259[_0x59bb('0x49')],'ListId':_0x446259[_0x59bb('0x4a')],'VoiceQueueId':_0x446259['VoiceQueueId']||undefined,'CampaignId':_0x446259[_0x59bb('0x57')]||undefined};};exports['filterKey']=function(_0x4bcf54){if(_0x4bcf54===_0x59bb('0x3e')||_0x4bcf54==='idContact'||_0x4bcf54===_0x59bb('0x4e')||_0x4bcf54===_0x59bb('0x58')||_0x4bcf54===_0x59bb('0x59')||_0x4bcf54===_0x59bb('0x5a')||_0x4bcf54===_0x59bb('0x31')||_0x4bcf54===_0x59bb('0x3a')||_0x4bcf54==='calleridname'||_0x4bcf54===_0x59bb('0x46')||_0x4bcf54==='calleridnum'||_0x4bcf54===_0x59bb('0x47')||_0x4bcf54===_0x59bb('0x40')||_0x4bcf54===_0x59bb('0x41')||_0x4bcf54===_0x59bb('0x42')||_0x4bcf54===_0x59bb('0x5b')||_0x4bcf54===_0x59bb('0x5c')||_0x4bcf54===_0x59bb('0x5d')||_0x4bcf54===_0x59bb('0x5e')||_0x4bcf54===_0x59bb('0x5f')||_0x4bcf54===_0x59bb('0x49')||_0x4bcf54===_0x59bb('0x4a')||_0x4bcf54===_0x59bb('0x32')||_0x4bcf54===_0x59bb('0x18')||_0x4bcf54===_0x59bb('0x60')||_0x4bcf54===_0x59bb('0x61')||_0x4bcf54===_0x59bb('0x62')||_0x4bcf54===_0x59bb('0x63')||_0x4bcf54==='xmd-listid'||_0x4bcf54===_0x59bb('0x64')||_0x4bcf54==='xmd-dialtimeout'||_0x4bcf54==='xmd-dialoptions'||_0x4bcf54==='xmd-dialid'||_0x4bcf54==='xmd-dialchannel'||_0x4bcf54===_0x59bb('0x65')||_0x4bcf54===_0x59bb('0x66')||_0x4bcf54==='xmd-callerid'||_0x4bcf54===_0x59bb('0x67')||_0x4bcf54==='xmd-agi'||_0x4bcf54===_0x59bb('0x68')||_0x4bcf54===_0x59bb('0x69')||_0x4bcf54===_0x59bb('0x6a')||_0x4bcf54===_0x59bb('0x6b')||_0x4bcf54===_0x59bb('0x6c')||_0x4bcf54===_0x59bb('0x6d')||_0x4bcf54===_0x59bb('0x6e')||_0x4bcf54===_0x59bb('0x6f')||_0x4bcf54===_0x59bb('0x68')||_0x4bcf54==='rtpaudioqosbridged'||_0x4bcf54===_0x59bb('0x6a')||_0x4bcf54===_0x59bb('0x6b')||_0x4bcf54==='rtpaudioqosloss'||_0x4bcf54===_0x59bb('0x6d')||_0x4bcf54===_0x59bb('0x6e')||_0x4bcf54===_0x59bb('0x6f')||_0x4bcf54===_0x59bb('0x70')||_0x4bcf54==='bridgepvtcallid'||_0x4bcf54===_0x59bb('0x2a')||_0x4bcf54==='statedesc'){return![];}return!![];};exports[_0x59bb('0x71')]=function(_0x483d34,_0x1a0268){var _0x4a4b3a,_0x4bb05c,_0x1b9214;if(_0x1a0268<=0x0){_0x1a0268=0x1;}_0x4a4b3a=new RegExp('\x5cw{0,'+_0x1a0268+'}$');_0x4bb05c=Math[_0x59bb('0x72')](0xa,_0x1a0268-0x1);_0x1b9214=Math[_0x59bb('0x72')](0xa,_0x1a0268)-0x1;return util[_0x59bb('0x10')]('%s',_[_0x59bb('0x73')](_0x483d34,_0x4a4b3a,_[_0x59bb('0x74')](_0x4bb05c,_0x1b9214)));};exports[_0x59bb('0x75')]=function(_0x37443f){var _0x4d1487=_0x37443f[_0x59bb('0x76')](/"(.*?)"/);return _0x4d1487?_0x4d1487[0x1]:_0x37443f;};exports[_0x59bb('0x77')]=function(_0x561c53){var _0x15d740=_0x561c53[_0x59bb('0x76')](/<(.*?)>/);return _0x15d740?_0x15d740[0x1]:_0x561c53;};function buildNoAnswerEventPayload(_0x2de748,_0x448b4a){var _0x385f1a=buildObj(_0x2de748,_0x59bb('0x78'));if(!_['isEmpty'](_0x448b4a[_0x59bb('0x79')])){Object[_0x59bb('0x7a')](_0x448b4a[_0x59bb('0x79')])[_0x59bb('0x7b')](function(_0x300854){_0x385f1a[_0x300854[_0x59bb('0x7c')]()]=_0x448b4a[_0x59bb('0x79')][_0x300854];});}return _0x385f1a;}exports[_0x59bb('0x7d')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index eb2cb2d..77501e9 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 _0x3025=['queueremove','queuepause','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean'];(function(_0x14f481,_0x277bab){var _0x250824=function(_0x349ec9){while(--_0x349ec9){_0x14f481['push'](_0x14f481['shift']());}};_0x250824(++_0x277bab);}(_0x3025,0x72));var _0x5302=function(_0x406693,_0x42b4f2){_0x406693=_0x406693-0x0;var _0x57a51a=_0x3025[_0x406693];return _0x57a51a;};'use strict';exports[_0x5302('0x0')]={'queue':{'type':_0x5302('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x5302('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x5302('0x2'),'required':![]}};exports[_0x5302('0x3')]={'queue':{'type':_0x5302('0x1'),'required':!![]},'interface':{'type':_0x5302('0x1'),'required':!![]}};exports[_0x5302('0x4')]={'interface':{'type':_0x5302('0x1'),'required':!![]},'paused':{'type':_0x5302('0x2')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x5302('0x1'),'required':![]}};exports[_0x5302('0x5')]={'uniqueid':{'type':_0x5302('0x1'),'required':!![]}};exports[_0x5302('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x5302('0x1')},'format':{'type':_0x5302('0x1')},'mixmonitorid':{'type':_0x5302('0x1')}};exports[_0x5302('0x7')]={'uniqueid':{'type':_0x5302('0x1'),'required':!![]}};exports[_0x5302('0x8')]={'uniqueid':{'type':_0x5302('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x5302('0x1')}}; \ No newline at end of file +var _0x1723=['voicequeuechannelhangup','queueadd','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x1723,0x1c3));var _0x3172=function(_0x3b2572,_0x278dd7){_0x3b2572=_0x3b2572-0x0;var _0x2ba96d=_0x1723[_0x3b2572];return _0x2ba96d;};'use strict';exports[_0x3172('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x3172('0x1'),'required':!![]},'penalty':{'type':_0x3172('0x2'),'required':![]},'paused':{'type':_0x3172('0x3'),'required':![]}};exports[_0x3172('0x4')]={'queue':{'type':_0x3172('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x3172('0x5')]={'interface':{'type':_0x3172('0x1'),'required':!![]},'paused':{'type':_0x3172('0x3')},'reason':{'type':_0x3172('0x1'),'required':![]}};exports[_0x3172('0x6')]={'module':{'type':_0x3172('0x1'),'required':![]}};exports[_0x3172('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x3172('0x8')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0x3172('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x3172('0x9')]={'uniqueid':{'type':_0x3172('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x3172('0x1'),'required':!![]},'exten':{'type':_0x3172('0x1'),'required':!![]},'context':{'type':_0x3172('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 9892572..b30a791 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 _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x53a0f4,_0x500787){var _0x370dfa=function(_0x209588){while(--_0x209588){_0x53a0f4['push'](_0x53a0f4['shift']());}};_0x370dfa(++_0x500787);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file +var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x53e977,_0x26e81e){var _0x1f89bc=function(_0x2f78e5){while(--_0x2f78e5){_0x53e977['push'](_0x53e977['shift']());}};_0x1f89bc(++_0x26e81e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1ee037,_0x31bf6a){_0x1ee037=_0x1ee037-0x0;var _0x1cf1c4=_0x5f2f[_0x1ee037];return _0x1cf1c4;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 15c89c9..66939b4 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1227=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x745b7f,_0x10e3ff){var _0x3cb51b=function(_0x834843){while(--_0x834843){_0x745b7f['push'](_0x745b7f['shift']());}};_0x3cb51b(++_0x10e3ff);}(_0x1227,0x156));var _0x7122=function(_0x2ab05e,_0x754af8){_0x2ab05e=_0x2ab05e-0x0;var _0x5ceae4=_0x1227[_0x2ab05e];return _0x5ceae4;};'use strict';function mergeDBDataToRealtime(_0x1dcb28,_0x5471a2){var _0x1631f3=Object[_0x7122('0x0')]({},_0x1dcb28);for(var _0x50fe1e in _0x5471a2){if(_0x1631f3[_0x7122('0x1')](_0x50fe1e)){_0x1631f3[_0x50fe1e]=_0x5471a2[_0x50fe1e];}}return _0x1631f3;}exports[_0x7122('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x74ee=['assign'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x74ee,0xaf));var _0xe74e=function(_0x5de172,_0x31e576){_0x5de172=_0x5de172-0x0;var _0x5dd0b5=_0x74ee[_0x5de172];return _0x5dd0b5;};'use strict';function mergeDBDataToRealtime(_0xc23873,_0x13adc6){var _0x5291c1=Object[_0xe74e('0x0')]({},_0xc23873);for(var _0x26d2ce in _0x13adc6){if(_0x5291c1['hasOwnProperty'](_0x26d2ce)){_0x5291c1[_0x26d2ce]=_0x13adc6[_0x26d2ce];}}return _0x5291c1;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 7306c82..a6d54a2 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 _0xf6d5=['../rpc/memberReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','findAgent','name','isNil','find','interface','format','SIP/%s','connectedlinenum','accountcode','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','calleridnum','outbound','internal','destination','exten','type','dialer','queue','context','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','transfers','transfereelinkedid','uniqueid','linkedid','UserId','split','membername','monitor','monitors','length','filename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','util','../rpc/voiceCallReport'];(function(_0x40e7a9,_0x12e772){var _0x14d743=function(_0x39ef13){while(--_0x39ef13){_0x40e7a9['push'](_0x40e7a9['shift']());}};_0x14d743(++_0x12e772);}(_0xf6d5,0x14e));var _0x5f6d=function(_0x1fd4f0,_0x5bac6d){_0x1fd4f0=_0x1fd4f0-0x0;var _0x1cd3d4=_0xf6d5[_0x1fd4f0];return _0x1cd3d4;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x5f6d('0x0'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x5f6d('0x1'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x5f6d('0x2'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x5f6d('0x3'));var VoiceAgentReport=require(_0x5f6d('0x4'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x5f6d('0x5'));function Report(_0x700226){this[_0x5f6d('0x6')]=_0x700226;this['agents']=_0x700226[_0x5f6d('0x7')];this[_0x5f6d('0x8')]=_0x700226['telephones'];}Report[_0x5f6d('0x9')][_0x5f6d('0xa')]=function(_0x2ddabd){var _0x249559=new VoiceQueueReport(this[_0x5f6d('0x6')]);var _0x229175=new VoiceAgentReport(this[_0x5f6d('0x6')]);var _0x14c105=new VoiceDialReport(this[_0x5f6d('0x6')]);var _0x1f9594=new VoiceCallReport(this['realtime']);var _0x23c07a=new UserReport(this[_0x5f6d('0x6')]);if(config['xdr']&&config[_0x5f6d('0xb')][_0x5f6d('0xc')]){ami['on'](_0x5f6d('0xd'),this[_0x5f6d('0xe')]['bind'](this));ami['on'](_0x5f6d('0xf'),this[_0x5f6d('0x10')][_0x5f6d('0x11')](this));ami['on'](_0x5f6d('0x12'),this[_0x5f6d('0x13')][_0x5f6d('0x11')](this));ami['on']('custom:voiceDialReport',this[_0x5f6d('0x14')]['bind'](this));ami['on'](_0x5f6d('0x15'),this[_0x5f6d('0x16')][_0x5f6d('0x11')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x5f6d('0x11')](this));}};Report[_0x5f6d('0x9')][_0x5f6d('0x17')]=function(_0x3d13c3){var _0x301e6e;_0x301e6e=_['find'](this[_0x5f6d('0x7')],function(_0x177191){return _0x177191['accountcode']==_0x3d13c3||_0x177191[_0x5f6d('0x18')]==_0x3d13c3;});if(_[_0x5f6d('0x19')](_0x301e6e)){var _0x4a97f1=_[_0x5f6d('0x1a')](this[_0x5f6d('0x8')],function(_0x4c3e1d){return _0x4c3e1d['accountcode']==_0x3d13c3||_0x4c3e1d[_0x5f6d('0x18')]==_0x3d13c3;});if(_0x4a97f1){_0x301e6e=_[_0x5f6d('0x1a')](this[_0x5f6d('0x7')],function(_0x5ee7ce){return _0x5ee7ce[_0x5f6d('0x1b')]==util[_0x5f6d('0x1c')](_0x5f6d('0x1d'),_0x4a97f1[_0x5f6d('0x18')]);});}}return _0x301e6e;};Report['prototype'][_0x5f6d('0xe')]=function(_0x19d6e8){for(var _0x455fbc=0x0;_0x455fbc<_0x19d6e8['length'];_0x455fbc+=0x1){var _0x1f3802=this['findAgent'](_0x19d6e8[_0x455fbc][_0x5f6d('0x1e')]);if(_0x1f3802){_0x19d6e8[_0x455fbc][_0x5f6d('0x1f')]=_0x1f3802[_0x5f6d('0x1f')];_0x19d6e8[_0x455fbc]['assigned']=!![];_0x19d6e8[_0x455fbc][_0x5f6d('0x20')]=_0x1f3802[_0x5f6d('0x18')];_0x19d6e8[_0x455fbc][_0x5f6d('0x1b')]=_[_0x5f6d('0x19')](_0x1f3802[_0x5f6d('0x1b')])?util[_0x5f6d('0x1c')](_0x5f6d('0x1d'),_0x1f3802[_0x5f6d('0x18')]):_0x1f3802[_0x5f6d('0x1b')];if(_0x19d6e8[_0x455fbc][_0x5f6d('0x21')]){_0x19d6e8[_0x455fbc][_0x5f6d('0x22')]=moment()[_0x5f6d('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x19d6e8[_0x455fbc][_0x5f6d('0x23')]){_0x19d6e8[_0x455fbc][_0x5f6d('0x24')]=moment()[_0x5f6d('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x5f6d('0xe')](_0x19d6e8[_0x455fbc]);}RpcVoiceQueueReport[_0x5f6d('0x25')](_0x19d6e8[_0x455fbc]);}};function extractCalleridNumber(_0x509309){var _0x39f7ae=_0x509309[_0x5f6d('0x26')](/<(.*?)>/);return _0x39f7ae?_0x39f7ae[0x1]:_0x509309;}Report[_0x5f6d('0x9')][_0x5f6d('0x27')]=function(_0x124dc4){for(var _0xbfaa39=0x0;_0xbfaa39',_0x5c5921['calleridname'],_0x5c5921[_0x5f6d('0x2a')]);}if(RpcVoiceTransferReport[_0x5f6d('0x3b')][_0x5c5921['linkedid']]){var _0xd17cd9=RpcVoiceTransferReport[_0x5f6d('0x3b')][_0x5c5921['linkedid']];_0xd17cd9[_0x5f6d('0x3c')]=_0x5c5921[_0x5f6d('0x3d')];RpcVoiceTransferReport[_0x5f6d('0x16')](_0xd17cd9);delete RpcVoiceTransferReport[_0x5f6d('0x3b')][_0x5c5921[_0x5f6d('0x3e')]];}if(_[_0x5f6d('0x19')](_0x5c5921[_0x5f6d('0x2f')])){_0x5c5921[_0x5f6d('0x2f')]=this[_0x5f6d('0x29')](_0x5c5921);}if(_['isNil'](_0x5c5921[_0x5f6d('0x3f')])){var _0xdb387f=_0x5c5921[_0x5f6d('0x38')][_0x5f6d('0x40')]('-')[0x0];var _0x74a178=this[_0x5f6d('0x7')][_0xdb387f];if(!_0x74a178)_0x74a178=this[_0x5f6d('0x27')](_0x5c5921['accountcode']);if(_0x74a178){_0x5c5921[_0x5f6d('0x3f')]=_0x74a178['id'];_0x5c5921[_0x5f6d('0x41')]=_0x74a178[_0x5f6d('0x18')];}}RpcVoiceCallReport[_0x5f6d('0x25')](_0x5c5921);if(_0x5c5921[_0x5f6d('0x42')]){for(var _0x6b3af8=0x0;_0x6b3af8<_0x5c5921[_0x5f6d('0x43')][_0x5f6d('0x44')];_0x6b3af8+=0x1){_0x5c5921['monitorFilename']=_0x5c5921[_0x5f6d('0x43')][_0x6b3af8][_0x5f6d('0x45')];_0x5c5921['createdAt']=_0x5c5921[_0x5f6d('0x43')][_0x6b3af8][_0x5f6d('0x46')];if(_0x5c5921[_0x5f6d('0x2e')]==_0x5f6d('0x35')){_0x5c5921[_0x5f6d('0x2a')]=_0x5c5921[_0x5f6d('0x1e')];_0x5c5921[_0x5f6d('0x47')]=_0x5c5921[_0x5f6d('0x48')];_0x5c5921[_0x5f6d('0x1e')]=_0x5c5921['accountcode'];_0x5c5921[_0x5f6d('0x48')]=_0x5c5921[_0x5f6d('0x41')];_0x5c5921['exten']=_0x5c5921['originatecalleridnum'];}else if(_0x5c5921[_0x5f6d('0x2e')]==_0x5f6d('0x49')){_0x5c5921[_0x5f6d('0x2a')]=_0x5c5921[_0x5f6d('0x2d')];_0x5c5921[_0x5f6d('0x2e')]=_0x5c5921['originatecalleridnum'];}RpcVoiceRecording[_0x5f6d('0x25')](_0x5c5921);}}};Report[_0x5f6d('0x9')]['voiceAgentReport']=function(_0x13760b){if(_['isArray'](_0x13760b)){_0x13760b[_0x5f6d('0x4a')](function(_0x3b9485){RpcVoiceAgentReport['create'](_0x3b9485);});}else{RpcVoiceAgentReport['create'](_0x13760b);}};Report[_0x5f6d('0x9')]['voiceDialReport']=function(_0x208174){RpcVoiceDialReport[_0x5f6d('0x25')](_0x208174);var _0x2947be;var _0x55db31;var _0x434e5d=_0x208174[_0x5f6d('0x38')];if(_[_0x5f6d('0x4b')](_0x434e5d,_0x5f6d('0x4c'))){_0x55db31=_0x434e5d[_0x5f6d('0x4d')](_0x434e5d[_0x5f6d('0x4e')]('/')+0x1,_0x434e5d[_0x5f6d('0x4e')]('@'));_0x2947be=_[_0x5f6d('0x1a')](this[_0x5f6d('0x7')],function(_0x41d0c7){return _0x41d0c7[_0x5f6d('0x4f')]==_0x55db31||_0x41d0c7[_0x5f6d('0x50')]==_0x55db31||_0x41d0c7[_0x5f6d('0x1f')]==_0x55db31;});}else{_0x55db31=_0x434e5d['substring'](_0x434e5d[_0x5f6d('0x4e')]('/')+0x1,_0x434e5d[_0x5f6d('0x51')]('-'));_0x2947be=this[_0x5f6d('0x17')](_0x55db31);}if(_0x2947be){_0x208174['interface']=_['isNil'](_0x2947be[_0x5f6d('0x1b')])?util['format'](_0x5f6d('0x1d'),_0x2947be['name']):_0x2947be[_0x5f6d('0x1b')];_0x208174['membername']=_0x2947be[_0x5f6d('0x18')];_0x208174[_0x5f6d('0x1f')]=_0x2947be['accountcode'];RpcMemberReport[_0x5f6d('0x14')](_0x208174);}};Report[_0x5f6d('0x9')][_0x5f6d('0x16')]=function(_0xc9ee39){RpcVoiceTransferReport['transfers'][_0xc9ee39[_0x5f6d('0x52')]]=_0xc9ee39;};Report[_0x5f6d('0x9')][_0x5f6d('0x53')]=function(_0x434f10){RpcVoiceTransferReport[_0x5f6d('0x53')](_0x434f10);};module['exports']=Report; \ No newline at end of file +var _0x8ab1=['keys','channel','split','calleridnum','outbound','destination','exten','type','lastapplication','context','from-voip-provider','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','callerid','calleridpreview','disposition','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','getCallType','UserId','membername','create','monitor','monitors','monitorFilename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','forEach','startsWith','Local','substring','indexOf','mobile','phone','attendedTransfer','exports','lodash','moment','../../../config/environment','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','custom:voiceQueueReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','prototype','findAgent','find','accountcode','name','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','voiceQueueReport','match','getAgentByInternal'];(function(_0x409ef8,_0x238031){var _0x39b747=function(_0x290810){while(--_0x290810){_0x409ef8['push'](_0x409ef8['shift']());}};_0x39b747(++_0x238031);}(_0x8ab1,0x81));var _0x18ab=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0x8ab1[_0x118139];return _0x2fece9;};'use strict';var _=require(_0x18ab('0x0'));var moment=require(_0x18ab('0x1'));var util=require('util');var config=require(_0x18ab('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x18ab('0x3'));var RpcVoiceDialReport=require(_0x18ab('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x18ab('0x5'));var RpcVoiceRecording=require(_0x18ab('0x6'));var RpcVoiceTransferReport=require(_0x18ab('0x7'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x18ab('0x8'));var VoiceDialReport=require(_0x18ab('0x9'));var UserReport=require(_0x18ab('0xa'));function Report(_0x28d322){this[_0x18ab('0xb')]=_0x28d322;this[_0x18ab('0xc')]=_0x28d322[_0x18ab('0xc')];this['telephones']=_0x28d322[_0x18ab('0xd')];}Report['prototype'][_0x18ab('0xe')]=function(_0x9bac44){var _0x2ac2ed=new VoiceQueueReport(this[_0x18ab('0xb')]);var _0x37b944=new VoiceAgentReport(this['realtime']);var _0x1613a2=new VoiceDialReport(this[_0x18ab('0xb')]);var _0x4e7ea8=new VoiceCallReport(this[_0x18ab('0xb')]);var _0x40e293=new UserReport(this[_0x18ab('0xb')]);if(config[_0x18ab('0xf')]&&config[_0x18ab('0xf')]['disabled']){ami['on'](_0x18ab('0x10'),this['voiceQueueReport'][_0x18ab('0x11')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0x18ab('0x11')](this));ami['on'](_0x18ab('0x12'),this[_0x18ab('0x13')][_0x18ab('0x11')](this));ami['on']('custom:voiceDialReport',this[_0x18ab('0x14')][_0x18ab('0x11')](this));ami['on'](_0x18ab('0x15'),this[_0x18ab('0x16')]['bind'](this));ami['on'](_0x18ab('0x17'),this['attendedTransfer'][_0x18ab('0x11')](this));}};Report[_0x18ab('0x18')][_0x18ab('0x19')]=function(_0x5be585){var _0x4a0a15;_0x4a0a15=_[_0x18ab('0x1a')](this[_0x18ab('0xc')],function(_0x3da9b9){return _0x3da9b9[_0x18ab('0x1b')]==_0x5be585||_0x3da9b9[_0x18ab('0x1c')]==_0x5be585;});if(_['isNil'](_0x4a0a15)){var _0x3110e1=_[_0x18ab('0x1a')](this[_0x18ab('0xd')],function(_0x2333be){return _0x2333be['accountcode']==_0x5be585||_0x2333be['name']==_0x5be585;});if(_0x3110e1){_0x4a0a15=_[_0x18ab('0x1a')](this[_0x18ab('0xc')],function(_0x5ace39){return _0x5ace39[_0x18ab('0x1d')]==util[_0x18ab('0x1e')](_0x18ab('0x1f'),_0x3110e1['name']);});}}return _0x4a0a15;};Report['prototype']['voiceQueueReport']=function(_0x566bda){for(var _0x258dc8=0x0;_0x258dc8<_0x566bda[_0x18ab('0x20')];_0x258dc8+=0x1){var _0xe0422c=this[_0x18ab('0x19')](_0x566bda[_0x258dc8][_0x18ab('0x21')]);if(_0xe0422c){_0x566bda[_0x258dc8]['accountcode']=_0xe0422c[_0x18ab('0x1b')];_0x566bda[_0x258dc8][_0x18ab('0x22')]=!![];_0x566bda[_0x258dc8][_0x18ab('0x23')]=_0xe0422c[_0x18ab('0x1c')];_0x566bda[_0x258dc8][_0x18ab('0x1d')]=_[_0x18ab('0x24')](_0xe0422c[_0x18ab('0x1d')])?util[_0x18ab('0x1e')](_0x18ab('0x1f'),_0xe0422c['name']):_0xe0422c[_0x18ab('0x1d')];if(_0x566bda[_0x258dc8][_0x18ab('0x25')]){_0x566bda[_0x258dc8][_0x18ab('0x26')]=moment()[_0x18ab('0x1e')](_0x18ab('0x27'));}if(_0x566bda[_0x258dc8][_0x18ab('0x28')]){_0x566bda[_0x258dc8][_0x18ab('0x29')]=moment()[_0x18ab('0x1e')](_0x18ab('0x27'));}RpcMemberReport[_0x18ab('0x2a')](_0x566bda[_0x258dc8]);}RpcVoiceQueueReport['create'](_0x566bda[_0x258dc8]);}};function extractCalleridNumber(_0xc04f97){var _0x321072=_0xc04f97[_0x18ab('0x2b')](/<(.*?)>/);return _0x321072?_0x321072[0x1]:_0xc04f97;}Report['prototype'][_0x18ab('0x2c')]=function(_0x896ede){for(var _0x3fea9d=0x0;_0x3fea9d{delete this[_0xa7df('0x2d')][_0x2d4c38];},_0x5de6a8);}};module[_0xa7df('0xa0')]=VoiceAgentReport; \ No newline at end of file +var _0x7cb6=['syncVarSet','hangup','musiconholdstart','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','isUndefined','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','interface','queue','format','YYYY-MM-DD\x20HH:mm:ss','mandatoryDisposition','type','inbound','voice','assign','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','variables','user:%s','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','info','connectedlinename','connectedlinenum','destchannelstate','holdtime','lastevent','connect','pick','name','accountcode','exten','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','agentconnectAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','channels','voiceChannels','voiceQueues','agents','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','bind','agentcomplete'];(function(_0x5898c2,_0x200fcc){var _0x483123=function(_0x520796){while(--_0x520796){_0x5898c2['push'](_0x5898c2['shift']());}};_0x483123(++_0x200fcc);}(_0x7cb6,0x88));var _0x67cb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7cb6[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x67cb('0x0'));var moment=require(_0x67cb('0x1'));var util=require(_0x67cb('0x2'));var Redis=require(_0x67cb('0x3'));var config=require(_0x67cb('0x4'));var logger=require(_0x67cb('0x5'))(_0x67cb('0x6'));var ami=require(_0x67cb('0x7'));config[_0x67cb('0x8')]=_[_0x67cb('0x9')](config[_0x67cb('0x8')],{'host':_0x67cb('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x1892b8){this[_0x67cb('0xb')]={};this[_0x67cb('0xc')]=_0x1892b8[_0x67cb('0xb')];this[_0x67cb('0xd')]=_0x1892b8['voiceQueues'];this[_0x67cb('0xe')]=_0x1892b8[_0x67cb('0xe')];this['variables']={};ami['on'](_0x67cb('0xf'),this[_0x67cb('0x10')]['bind'](this));ami['on'](_0x67cb('0x11'),this[_0x67cb('0x12')]['bind'](this));ami['on']('agentringnoanswer',this[_0x67cb('0x13')]['bind'](this));ami['on'](_0x67cb('0x14'),this['syncQueueCallerAbandon'][_0x67cb('0x15')](this));ami['on'](_0x67cb('0x16'),this['syncAgentComplete'][_0x67cb('0x15')](this));ami['on']('varset',this[_0x67cb('0x17')]['bind'](this));ami['on'](_0x67cb('0x18'),this['syncHangup'][_0x67cb('0x15')](this));ami['on'](_0x67cb('0x19'),this['syncMusicOnHoldStart'][_0x67cb('0x15')](this));ami['on']('musiconholdstop',this[_0x67cb('0x1a')]['bind'](this));ami['on']('attendedtransfer',this[_0x67cb('0x1b')][_0x67cb('0x15')](this));ami['on'](_0x67cb('0x1c'),this['syncBlindTransfer'][_0x67cb('0x15')](this));}VoiceAgentReport[_0x67cb('0x1d')]['emit']=function(_0x565a18,_0x13ee7b,_0x234c7f){io['to'](_0x565a18)[_0x67cb('0x1e')](_0x13ee7b,_0x234c7f);};VoiceAgentReport['prototype'][_0x67cb('0x1f')]=function(_0x36c87b){return _0x36c87b!==null&&!_[_0x67cb('0x20')](_0x36c87b);};VoiceAgentReport['prototype'][_0x67cb('0x10')]=function(_0x4884f6){try{if(this[_0x67cb('0x1f')](_0x4884f6)){logger['info']('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x4884f6[_0x67cb('0x21')],_0x4884f6[_0x67cb('0x22')],_0x4884f6[_0x67cb('0x23')]);logger[_0x67cb('0x24')](_0x67cb('0x25'),_0x4884f6[_0x67cb('0x21')],util[_0x67cb('0x26')](_0x4884f6,{'showHidden':![],'depth':null}));if(_[_0x67cb('0x20')](this[_0x67cb('0xb')][_0x4884f6[_0x67cb('0x21')]])){this[_0x67cb('0xb')][_0x4884f6['uniqueid']]={};}var _0x142965=this[_0x67cb('0xe')][_0x4884f6[_0x67cb('0x27')]];var _0x3e314d=this[_0x67cb('0xb')][_0x4884f6[_0x67cb('0x21')]][_0x4884f6['destuniqueid']];var _0x51831d=this[_0x67cb('0xd')][_0x4884f6[_0x67cb('0x28')]];var _0x468d4d=this['variables'][_0x4884f6['uniqueid']];if(_[_0x67cb('0x20')](_0x3e314d)){_0x3e314d={'agentcalledAt':moment()[_0x67cb('0x29')](_0x67cb('0x2a')),'lastevent':'called','mandatoryDisposition':_0x51831d&&_0x51831d['mandatoryDisposition']?_0x51831d[_0x67cb('0x2b')]:![],'type':_0x51831d&&_0x51831d[_0x67cb('0x2c')]?_0x51831d[_0x67cb('0x2c')]:_0x67cb('0x2d'),'variables':_0x468d4d,'motionChannel':_0x67cb('0x2e')};}Object[_0x67cb('0x2f')](_0x3e314d,_[_0x67cb('0x30')](_0x4884f6,[_0x67cb('0x31'),_0x67cb('0x32')]));this[_0x67cb('0xb')][_0x4884f6[_0x67cb('0x21')]][_0x4884f6[_0x67cb('0x23')]]=_0x3e314d;logger['debug'](_0x67cb('0x33'),_0x4884f6['uniqueid'],util[_0x67cb('0x26')](_0x3e314d,{'showHidden':![],'depth':null}));ami['emit'](_0x67cb('0x34'),_0x3e314d);var _0x369fd1={'id':_0x142965['id'],'calleridnum':_0x3e314d['calleridnum'],'queue':_0x3e314d['queue'],'variables':_0x3e314d[_0x67cb('0x35')],'uniqueid':_0x4884f6[_0x67cb('0x21')]};logger[_0x67cb('0x24')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x4884f6[_0x67cb('0x21')],util[_0x67cb('0x26')](_0x369fd1,{'showHidden':![],'depth':null}));this['emit'](util[_0x67cb('0x29')](_0x67cb('0x36'),_0x4884f6[_0x67cb('0x22')]),'user:called',_0x369fd1);}}catch(_0x5c93b2){logger['error'](_0x67cb('0x37'),_0x4884f6[_0x67cb('0x21')],util['inspect'](_0x5c93b2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67cb('0x1d')][_0x67cb('0x12')]=function(_0x191a64){try{if(this['isNotNull'](_0x191a64)){if(this[_0x67cb('0xb')][_0x191a64[_0x67cb('0x21')]]){for(var _0x3d538d in this[_0x67cb('0xb')][_0x191a64['uniqueid']]){if(this[_0x67cb('0xb')][_0x191a64['uniqueid']][_0x67cb('0x38')](_0x3d538d)){if(_0x191a64[_0x67cb('0x23')]===_0x3d538d){logger[_0x67cb('0x39')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x191a64[_0x67cb('0x21')],_0x191a64[_0x67cb('0x22')],_0x191a64[_0x67cb('0x23')]);this[_0x67cb('0xb')][_0x191a64[_0x67cb('0x21')]][_0x3d538d]['agentconnectAt']=moment()[_0x67cb('0x29')](_0x67cb('0x2a'));this['channels'][_0x191a64['uniqueid']][_0x3d538d][_0x67cb('0x3a')]=_0x191a64[_0x67cb('0x3a')];this[_0x67cb('0xb')][_0x191a64[_0x67cb('0x21')]][_0x3d538d][_0x67cb('0x3b')]=_0x191a64[_0x67cb('0x3b')];this[_0x67cb('0xb')][_0x191a64['uniqueid']][_0x3d538d][_0x67cb('0x3c')]=_0x191a64[_0x67cb('0x3c')];this[_0x67cb('0xb')][_0x191a64[_0x67cb('0x21')]][_0x3d538d]['destchannelstatedesc']=_0x191a64['destchannelstatedesc'];this[_0x67cb('0xb')][_0x191a64[_0x67cb('0x21')]][_0x3d538d][_0x67cb('0x3d')]=_0x191a64[_0x67cb('0x3d')];this[_0x67cb('0xb')][_0x191a64[_0x67cb('0x21')]][_0x3d538d][_0x67cb('0x3e')]=_0x67cb('0x3f');_['merge'](this[_0x67cb('0xe')][_0x191a64[_0x67cb('0x27')]],_[_0x67cb('0x40')](_0x191a64,[_0x67cb('0x28'),'destconnectedlinenum']));var _0x44d9bc=this[_0x67cb('0xe')][_0x191a64[_0x67cb('0x27')]];var _0x175901={'id':_0x44d9bc['id'],'name':_0x44d9bc[_0x67cb('0x41')],'agentconnected':!![],'destaccountcode':_0x44d9bc[_0x67cb('0x42')],'destconnectedlinenum':this[_0x67cb('0xb')][_0x191a64[_0x67cb('0x21')]][_0x191a64[_0x67cb('0x23')]][_0x67cb('0x43')],'queue':this['channels'][_0x191a64[_0x67cb('0x21')]][_0x191a64[_0x67cb('0x23')]]['queue'],'uniqueid':this['channels'][_0x191a64[_0x67cb('0x21')]][_0x191a64[_0x67cb('0x23')]][_0x67cb('0x21')]};ami[_0x67cb('0x1e')]('custom:agentconnect',this['channels'][_0x191a64[_0x67cb('0x21')]][_0x191a64['destuniqueid']]);this[_0x67cb('0x1e')](util[_0x67cb('0x29')](_0x67cb('0x36'),_0x191a64[_0x67cb('0x22')]),'user:agentconnect',_0x175901);}else if(!this[_0x67cb('0xb')][_0x191a64[_0x67cb('0x21')]][_0x3d538d][_0x67cb('0x44')]&&!this[_0x67cb('0xb')][_0x191a64[_0x67cb('0x21')]][_0x3d538d][_0x67cb('0x16')]){logger[_0x67cb('0x39')](_0x67cb('0x45'),_0x191a64[_0x67cb('0x21')],this[_0x67cb('0xb')][_0x191a64[_0x67cb('0x21')]][_0x3d538d]['membername'],_0x3d538d);this['channels'][_0x191a64[_0x67cb('0x21')]][_0x3d538d][_0x67cb('0x44')]=!![];this[_0x67cb('0xb')][_0x191a64['uniqueid']][_0x3d538d][_0x67cb('0x46')]=moment()[_0x67cb('0x29')](_0x67cb('0x2a'));this[_0x67cb('0xb')][_0x191a64[_0x67cb('0x21')]][_0x3d538d][_0x67cb('0x47')]=_0x191a64[_0x67cb('0x23')];this[_0x67cb('0xb')][_0x191a64[_0x67cb('0x21')]][_0x3d538d][_0x67cb('0x48')]=_0x191a64['membername'];this[_0x67cb('0xb')][_0x191a64[_0x67cb('0x21')]][_0x3d538d][_0x67cb('0x3e')]='answered_elsewhere';this[_0x67cb('0xb')][_0x191a64[_0x67cb('0x21')]][_0x3d538d]['reason']='answered_elsewhere';logger[_0x67cb('0x24')](_0x67cb('0x49'),_0x191a64['uniqueid'],util['inspect'](this[_0x67cb('0xb')][_0x191a64[_0x67cb('0x21')]][_0x3d538d],{'showHidden':![],'depth':null}));ami[_0x67cb('0x1e')]('custom:agentansweredelsewhere',this[_0x67cb('0xb')][_0x191a64[_0x67cb('0x21')]][_0x3d538d]);}else{logger[_0x67cb('0x24')](_0x67cb('0x4a'),_0x191a64[_0x67cb('0x21')]);}}}}}}catch(_0x20b8fc){logger[_0x67cb('0x4b')](_0x67cb('0x4c'),_0x191a64[_0x67cb('0x21')],util['inspect'](_0x20b8fc,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x67cb('0x13')]=function(_0x5426ec){try{if(this['isNotNull'](_0x5426ec)){logger[_0x67cb('0x24')](_0x67cb('0x4d'),_0x5426ec[_0x67cb('0x21')],util['inspect'](_0x5426ec,{'showHidden':![],'depth':null}));if(this[_0x67cb('0xb')][_0x5426ec[_0x67cb('0x21')]]&&this[_0x67cb('0xb')][_0x5426ec['uniqueid']][_0x5426ec[_0x67cb('0x23')]]){logger['info'](_0x67cb('0x4e'),_0x5426ec[_0x67cb('0x21')],_0x5426ec[_0x67cb('0x22')],_0x5426ec[_0x67cb('0x23')]);var _0x39e3b9=this[_0x67cb('0xe')][_0x5426ec[_0x67cb('0x27')]];var _0x464806=this[_0x67cb('0xb')][_0x5426ec[_0x67cb('0x21')]][_0x5426ec[_0x67cb('0x23')]];_0x464806['agentringnoanswer']=!![];_0x464806['agentringnoanswerAt']=moment()[_0x67cb('0x29')]('YYYY-MM-DD\x20HH:mm:ss');_0x464806[_0x67cb('0x3e')]=_0x67cb('0x4f');_0x464806[_0x67cb('0x50')]=_0x67cb('0x4f');var _0x444a75={'id':_0x39e3b9['id'],'name':_0x39e3b9[_0x67cb('0x41')],'queue':_0x464806[_0x67cb('0x28')],'uniqueid':_0x464806[_0x67cb('0x21')]};logger[_0x67cb('0x24')](_0x67cb('0x51'),_0x5426ec['uniqueid'],util[_0x67cb('0x26')](_0x444a75,{'showHidden':![],'depth':null}));this[_0x67cb('0x1e')](util[_0x67cb('0x29')]('user:%s',_0x39e3b9[_0x67cb('0x41')]),_0x67cb('0x52'),_0x444a75);ami[_0x67cb('0x1e')](_0x67cb('0x53'),_0x464806);this[_0x67cb('0xb')][_0x5426ec[_0x67cb('0x21')]][_0x5426ec[_0x67cb('0x23')]]=Object[_0x67cb('0x2f')]({},_0x464806);}}}catch(_0x1031be){logger[_0x67cb('0x4b')]('[%s][voiceAgentReport][agentringnoanswer]',_0x5426ec['uniqueid'],util[_0x67cb('0x26')](_0x1031be,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67cb('0x1d')][_0x67cb('0x54')]=function(_0x428f2a){try{if(this[_0x67cb('0x1f')](_0x428f2a)){logger[_0x67cb('0x24')](_0x67cb('0x55'),_0x428f2a[_0x67cb('0x21')],util[_0x67cb('0x26')](_0x428f2a,{'showHidden':![],'depth':null}));if(this[_0x67cb('0xb')][_0x428f2a['uniqueid']]){for(var _0x10c65c in this[_0x67cb('0xb')][_0x428f2a[_0x67cb('0x21')]]){if(this[_0x67cb('0xb')][_0x428f2a[_0x67cb('0x21')]]['hasOwnProperty'](_0x10c65c)&&!this[_0x67cb('0xb')][_0x428f2a['uniqueid']][_0x10c65c]['agentringnoanswer']&&!this['channels'][_0x428f2a['uniqueid']][_0x10c65c]['agentcomplete']){logger[_0x67cb('0x39')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x428f2a[_0x67cb('0x21')],this['channels'][_0x428f2a[_0x67cb('0x21')]][_0x10c65c]['membername'],_0x10c65c);this[_0x67cb('0xb')][_0x428f2a[_0x67cb('0x21')]][_0x10c65c][_0x67cb('0x44')]=!![];this['channels'][_0x428f2a['uniqueid']][_0x10c65c][_0x67cb('0x46')]=moment()[_0x67cb('0x29')](_0x67cb('0x2a'));this['channels'][_0x428f2a['uniqueid']][_0x10c65c]['lastevent']=_0x67cb('0x56');this['channels'][_0x428f2a[_0x67cb('0x21')]][_0x10c65c][_0x67cb('0x50')]=_0x67cb('0x56');logger[_0x67cb('0x24')](_0x67cb('0x57'),_0x428f2a[_0x67cb('0x21')],util[_0x67cb('0x26')](this[_0x67cb('0xb')][_0x428f2a[_0x67cb('0x21')]][_0x10c65c],{'showHidden':![],'depth':null}));ami[_0x67cb('0x1e')](_0x67cb('0x58'),this[_0x67cb('0xb')][_0x428f2a[_0x67cb('0x21')]][_0x10c65c]);}}}}}catch(_0x52b113){logger[_0x67cb('0x4b')](_0x67cb('0x59'),_0x428f2a[_0x67cb('0x21')],util['inspect'](_0x52b113,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x67cb('0x5a')]=function(_0x5d77a2){try{if(this['isNotNull'](_0x5d77a2)){logger[_0x67cb('0x24')](_0x67cb('0x5b'),_0x5d77a2['uniqueid'],util[_0x67cb('0x26')](_0x5d77a2,{'showHidden':![],'depth':null}));if(this[_0x67cb('0xb')][_0x5d77a2['uniqueid']]){for(var _0x502e3b in this['channels'][_0x5d77a2[_0x67cb('0x21')]]){if(this[_0x67cb('0xb')][_0x5d77a2[_0x67cb('0x21')]][_0x67cb('0x38')](_0x502e3b)){if(this[_0x67cb('0xb')][_0x5d77a2[_0x67cb('0x21')]][_0x502e3b][_0x67cb('0x5c')]&&!this[_0x67cb('0xb')][_0x5d77a2[_0x67cb('0x21')]][_0x502e3b][_0x67cb('0x16')]){logger['info']('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5d77a2['uniqueid'],this['channels'][_0x5d77a2[_0x67cb('0x21')]][_0x502e3b][_0x67cb('0x22')],_0x502e3b);this[_0x67cb('0xb')][_0x5d77a2[_0x67cb('0x21')]][_0x502e3b][_0x67cb('0x16')]=!![];this['channels'][_0x5d77a2[_0x67cb('0x21')]][_0x502e3b]['agentcompleteAt']=moment()[_0x67cb('0x29')](_0x67cb('0x2a'));this[_0x67cb('0xb')][_0x5d77a2[_0x67cb('0x21')]][_0x502e3b]['lastevent']=_0x67cb('0x5d');this[_0x67cb('0xb')][_0x5d77a2[_0x67cb('0x21')]][_0x502e3b][_0x67cb('0x50')]=_0x5d77a2[_0x67cb('0x50')]==_0x67cb('0x5e')?_0x67cb('0x5f'):_0x5d77a2[_0x67cb('0x50')];this[_0x67cb('0xb')][_0x5d77a2[_0x67cb('0x21')]][_0x502e3b][_0x67cb('0x60')]=_0x5d77a2['talktime'];if(this[_0x67cb('0xd')][_0x5d77a2[_0x67cb('0x28')]]&&this[_0x67cb('0xd')][_0x5d77a2[_0x67cb('0x28')]][_0x67cb('0x61')]){this[_0x67cb('0xb')][_0x5d77a2['uniqueid']][_0x502e3b][_0x67cb('0x62')]=this[_0x67cb('0xd')][_0x5d77a2[_0x67cb('0x28')]][_0x67cb('0x63')];this[_0x67cb('0xb')][_0x5d77a2['uniqueid']][_0x502e3b][_0x67cb('0x64')]=!![];}this['agents'][_0x5d77a2[_0x67cb('0x27')]]=_[_0x67cb('0x30')](this[_0x67cb('0xe')][_0x5d77a2[_0x67cb('0x27')]],[_0x67cb('0x28'),_0x67cb('0x65')]);logger[_0x67cb('0x24')](_0x67cb('0x66'),_0x5d77a2['uniqueid'],util[_0x67cb('0x26')](this[_0x67cb('0xb')][_0x5d77a2[_0x67cb('0x21')]][_0x502e3b],{'showHidden':![],'depth':null}));ami[_0x67cb('0x1e')](_0x67cb('0x67'),this[_0x67cb('0xb')][_0x5d77a2[_0x67cb('0x21')]][_0x502e3b]);logger[_0x67cb('0x24')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x5d77a2[_0x67cb('0x21')],util['inspect']({'id':this[_0x67cb('0xe')][_0x5d77a2[_0x67cb('0x27')]]['id'],'destaccountcode':_0x5d77a2[_0x67cb('0x68')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x67cb('0x29')](_0x67cb('0x36'),_0x5d77a2['membername']),_0x67cb('0x69'),{'id':this[_0x67cb('0xe')][_0x5d77a2['interface']]['id'],'destaccountcode':Number(_0x5d77a2[_0x67cb('0x68')])});}}}}}}catch(_0x1adbb5){logger[_0x67cb('0x4b')](_0x67cb('0x6a'),_0x5d77a2[_0x67cb('0x21')],util[_0x67cb('0x26')](_0x1adbb5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67cb('0x1d')][_0x67cb('0x17')]=function(_0x2fd3db){try{if(this[_0x67cb('0x1f')](_0x2fd3db)){logger[_0x67cb('0x24')]('[%s][voiceAgentReport][varset]\x20event:',_0x2fd3db[_0x67cb('0x21')],util[_0x67cb('0x26')](_0x2fd3db,{'showHidden':![],'depth':null}));this['addVariable'](_0x2fd3db[_0x67cb('0x21')],_[_0x67cb('0x6b')](_0x2fd3db[_0x67cb('0x6c')])[0x0],_0x2fd3db['value']);if(this[_0x67cb('0xb')][_0x2fd3db[_0x67cb('0x21')]]){for(var _0x24834d in this[_0x67cb('0xb')][_0x2fd3db[_0x67cb('0x21')]]){if(this['channels'][_0x2fd3db['uniqueid']][_0x67cb('0x38')](_0x24834d)){logger['info'](_0x67cb('0x6d'),_0x2fd3db['uniqueid'],_0x24834d,_[_0x67cb('0x6b')](_0x2fd3db[_0x67cb('0x6c')])[0x0],_0x2fd3db[_0x67cb('0x6e')]);if(_[_0x67cb('0x20')](this['channels'][_0x2fd3db['uniqueid']][_0x24834d][_0x67cb('0x35')])){this['channels'][_0x2fd3db['uniqueid']][_0x24834d][_0x67cb('0x35')]={};}this[_0x67cb('0xb')][_0x2fd3db[_0x67cb('0x21')]][_0x24834d]['variables']=this['variables'][_0x2fd3db[_0x67cb('0x21')]];}}}}}catch(_0x4cfa1a){logger[_0x67cb('0x4b')]('[%s][voiceAgentReport][varset]',_0x2fd3db[_0x67cb('0x21')],util[_0x67cb('0x26')](_0x4cfa1a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67cb('0x1d')]['addVariable']=function(_0x312ee6,_0x43daac,_0x419a1c){var _0x5598d0=[_0x67cb('0x6f'),'rtpaudioqosbridged',_0x67cb('0x70'),_0x67cb('0x71'),_0x67cb('0x72'),_0x67cb('0x73'),_0x67cb('0x74'),_0x67cb('0x75'),'sipcallid',_0x67cb('0x76'),_0x67cb('0x77'),_0x67cb('0x78'),_0x67cb('0x79'),_0x67cb('0x7a'),_0x67cb('0x7b'),_0x67cb('0x7c'),_0x67cb('0x22'),_0x67cb('0x7d'),_0x67cb('0x7e')];if(!_[_0x67cb('0x7f')](_0x43daac)&&!_[_0x67cb('0x80')](_0x5598d0,_0x43daac)){if(_[_0x67cb('0x20')](this[_0x67cb('0x35')][_0x312ee6])){this[_0x67cb('0x35')][_0x312ee6]={};}this[_0x67cb('0x35')][_0x312ee6][_0x43daac]=_0x419a1c;}};VoiceAgentReport[_0x67cb('0x1d')][_0x67cb('0x81')]=function(_0x338c36){try{if(this['isNotNull'](_0x338c36)){logger[_0x67cb('0x24')]('[%s][voiceAgentReport][hangup]\x20event:',_0x338c36[_0x67cb('0x21')],util['inspect'](_0x338c36,{'showHidden':![],'depth':null}));if(this[_0x67cb('0xb')][_0x338c36['uniqueid']]){for(var _0xdd193 in this['channels'][_0x338c36['uniqueid']]){if(this[_0x67cb('0xb')][_0x338c36[_0x67cb('0x21')]]['hasOwnProperty'](_0xdd193)){if(this[_0x67cb('0xb')][_0x338c36[_0x67cb('0x21')]][_0xdd193][_0x67cb('0x50')]=='transfer'&&this['channels'][_0x338c36[_0x67cb('0x21')]][_0xdd193]['agentcomplete']){logger[_0x67cb('0x39')](_0x67cb('0x82'),_0x338c36[_0x67cb('0x21')],_0xdd193);this[_0x67cb('0xb')][_0x338c36[_0x67cb('0x21')]][_0xdd193]['agentcompleteAt']=moment()[_0x67cb('0x29')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x67cb('0x24')](_0x67cb('0x83'),_0x338c36[_0x67cb('0x21')],util[_0x67cb('0x26')](_[_0x67cb('0x84')](this['channels'][_0x338c36[_0x67cb('0x21')]]),{'showHidden':![],'depth':null}));ami['emit'](_0x67cb('0x85'),_['values'](this[_0x67cb('0xb')][_0x338c36[_0x67cb('0x21')]]));this['deleteChannelAfterTimeout'](_0x338c36['uniqueid']);}if(this['variables'][_0x338c36[_0x67cb('0x21')]]){delete this[_0x67cb('0x35')][_0x338c36[_0x67cb('0x21')]];}}}catch(_0x431197){logger['error'](_0x67cb('0x86'),_0x338c36['uniqueid'],util[_0x67cb('0x26')](_0x431197,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67cb('0x1d')][_0x67cb('0x1b')]=function(_0xa79f20){try{if(this[_0x67cb('0x1f')](_0xa79f20)){logger[_0x67cb('0x24')](_0x67cb('0x87'),_0xa79f20[_0x67cb('0x21')],util[_0x67cb('0x26')](_0xa79f20,{'showHidden':![],'depth':null}));if(this[_0x67cb('0xb')][_0xa79f20[_0x67cb('0x88')]]){for(var _0x2e3dd4 in this[_0x67cb('0xb')][_0xa79f20['transfereeuniqueid']]){if(this[_0x67cb('0xb')][_0xa79f20['transfereeuniqueid']][_0x67cb('0x38')](_0x2e3dd4)){if(_0xa79f20[_0x67cb('0x89')]===_0x2e3dd4){logger[_0x67cb('0x39')](_0x67cb('0x8a'),_0xa79f20['uniqueid'],this[_0x67cb('0xb')][_0xa79f20[_0x67cb('0x88')]][_0x2e3dd4][_0x67cb('0x22')],_0x2e3dd4);var _0x1aad30=moment();this['channels'][_0xa79f20[_0x67cb('0x88')]][_0x2e3dd4][_0x67cb('0x16')]=!![];this['channels'][_0xa79f20['transfereeuniqueid']][_0x2e3dd4][_0x67cb('0x8b')]=moment()[_0x67cb('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x67cb('0xb')][_0xa79f20['transfereeuniqueid']][_0x2e3dd4][_0x67cb('0x3e')]=_0x67cb('0x5d');this[_0x67cb('0xb')][_0xa79f20[_0x67cb('0x88')]][_0x2e3dd4][_0x67cb('0x50')]=_0x67cb('0x5e');this[_0x67cb('0xb')][_0xa79f20[_0x67cb('0x88')]][_0x2e3dd4]['talktime']=_0x1aad30[_0x67cb('0x8c')](this[_0x67cb('0xb')][_0xa79f20[_0x67cb('0x88')]][_0x2e3dd4][_0x67cb('0x5c')],_0x67cb('0x8d'));}}}}if(this['channels'][_0xa79f20[_0x67cb('0x8e')]]){var _0x2058c1=this[_0x67cb('0xb')][_0xa79f20['secondtransfereruniqueid']];this[_0x67cb('0xb')][_0xa79f20[_0x67cb('0x8e')]]=this[_0x67cb('0xb')][_0xa79f20[_0x67cb('0x88')]];this[_0x67cb('0xb')][_0xa79f20[_0x67cb('0x88')]]=_0x2058c1;}}}catch(_0x4a0a37){logger[_0x67cb('0x4b')](_0x67cb('0x8f'),_0xa79f20[_0x67cb('0x21')],util[_0x67cb('0x26')](_0x4a0a37,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67cb('0x1d')][_0x67cb('0x90')]=function(_0x27bca9){try{if(this[_0x67cb('0x1f')](_0x27bca9)){logger[_0x67cb('0x24')](_0x67cb('0x91'),_0x27bca9[_0x67cb('0x21')],util['inspect'](_0x27bca9,{'showHidden':![],'depth':null}));if(this['channels'][_0x27bca9[_0x67cb('0x88')]]){for(var _0x30a878 in this[_0x67cb('0xb')][_0x27bca9['transfereeuniqueid']]){if(this[_0x67cb('0xb')][_0x27bca9[_0x67cb('0x88')]][_0x67cb('0x38')](_0x30a878)){if(_0x27bca9[_0x67cb('0x92')]===_0x30a878){logger[_0x67cb('0x39')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x27bca9['uniqueid'],this[_0x67cb('0xb')][_0x27bca9[_0x67cb('0x88')]][_0x30a878][_0x67cb('0x22')],_0x30a878);var _0x500b6f=moment();this['channels'][_0x27bca9[_0x67cb('0x88')]][_0x30a878][_0x67cb('0x16')]=!![];this[_0x67cb('0xb')][_0x27bca9['transfereeuniqueid']][_0x30a878]['agentcompleteAt']=_0x500b6f;this[_0x67cb('0xb')][_0x27bca9['transfereeuniqueid']][_0x30a878][_0x67cb('0x3e')]='complete';this[_0x67cb('0xb')][_0x27bca9[_0x67cb('0x88')]][_0x30a878]['reason']=_0x67cb('0x5e');this[_0x67cb('0xb')][_0x27bca9[_0x67cb('0x88')]][_0x30a878][_0x67cb('0x60')]=_0x500b6f[_0x67cb('0x8c')](this[_0x67cb('0xb')][_0x27bca9[_0x67cb('0x88')]][_0x30a878]['agentconnectAt'],_0x67cb('0x8d'));}}}}}}catch(_0x41791e){logger['error']('[%s][voiceAgentReport][blindtransfer]',_0x27bca9[_0x67cb('0x21')],util[_0x67cb('0x26')](_0x41791e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x67cb('0x93')]=function(_0x5f5ba5){var _0x41dc59='';try{if(this['isNotNull'](_0x5f5ba5)){logger[_0x67cb('0x24')](_0x67cb('0x94'),_0x5f5ba5[_0x67cb('0x21')],util[_0x67cb('0x26')](_0x5f5ba5,{'showHidden':![],'depth':null}));if(_0x5f5ba5[_0x67cb('0x95')]){_0x41dc59=_0x5f5ba5['channel']['substring'](0x0,_0x5f5ba5[_0x67cb('0x95')]['lastIndexOf']('-'));if(this[_0x67cb('0xe')][_0x41dc59]){logger[_0x67cb('0x39')](_0x67cb('0x96'),_0x5f5ba5[_0x67cb('0x21')],_0x41dc59);this[_0x67cb('0xe')][_0x41dc59][_0x67cb('0x97')]=!![];}}}}catch(_0xfbf119){logger[_0x67cb('0x4b')](_0x67cb('0x98'),_0x5f5ba5['uniqueid'],util[_0x67cb('0x26')](_0xfbf119,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x67cb('0x1a')]=function(_0x50b7a0){var _0x427b10='';try{if(this[_0x67cb('0x1f')](_0x50b7a0)){logger[_0x67cb('0x24')](_0x67cb('0x99'),_0x50b7a0[_0x67cb('0x21')],util[_0x67cb('0x26')](_0x50b7a0,{'showHidden':![],'depth':null}));if(_0x50b7a0[_0x67cb('0x95')]){_0x427b10=_0x50b7a0[_0x67cb('0x95')][_0x67cb('0x9a')](0x0,_0x50b7a0['channel'][_0x67cb('0x9b')]('-'));if(this['agents'][_0x427b10]){logger[_0x67cb('0x39')](_0x67cb('0x9c'),_0x50b7a0['uniqueid'],_0x427b10);this[_0x67cb('0xe')][_0x427b10]['onhold']=![];}}}}catch(_0x550bdb){logger['error'](_0x67cb('0x9d'),_0x50b7a0['uniqueid'],util[_0x67cb('0x26')](_0x550bdb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x67cb('0x1d')]['deleteChannelAfterTimeout']=function(_0x2d9c1a,_0xe7ab59=0x2710){if(this[_0x67cb('0xb')][_0x2d9c1a]){setTimeout(()=>{delete this['channels'][_0x2d9c1a];},_0xe7ab59);}};module[_0x67cb('0x9e')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 669bdb5..2fe79f2 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e82=['diff','destinationchannel','UserId','membername','xcally-motion-preview','connectedlinename','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','.WAV','monitorFilename','monitors','push','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','transferType','resolve','then','undefined','transferToInternal','isEmpty','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','transferconnectedlinenum','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/logger','../ami','../model/channel','../rpc/setting','queue','agi','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','localhost','channels','agents','blindTransfers','coreshowchannel','bind','syncNewExten','newchannel','syncNewChannel','newstate','syncNewState','varset','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','keys','context','from-sip','channel','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','disposition','toNumber','channelstate','pick','split','exten','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','lastapplication','lastdata','set','startsWith','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime'];(function(_0x21481c,_0x1b51ba){var _0x5dd77a=function(_0x4ee13c){while(--_0x4ee13c){_0x21481c['push'](_0x21481c['shift']());}};_0x5dd77a(++_0x1b51ba);}(_0x4e82,0x1ee));var _0x24e8=function(_0x517875,_0x9edf81){_0x517875=_0x517875-0x0;var _0x382afc=_0x4e82[_0x517875];return _0x382afc;};'use strict';var _=require(_0x24e8('0x0'));var moment=require(_0x24e8('0x1'));var util=require(_0x24e8('0x2'));var path=require('path');var Redis=require(_0x24e8('0x3'));var config=require('../../../config/environment');var logger=require(_0x24e8('0x4'))('ami');var ami=require(_0x24e8('0x5'));var Channel=require(_0x24e8('0x6'));var RpcSetting=require(_0x24e8('0x7'));var applications=['set',_0x24e8('0x8'),_0x24e8('0x9'),_0x24e8('0xa'),_0x24e8('0xb'),'voicemail'];var dispositions=[_0x24e8('0xc'),_0x24e8('0xd'),'FAILED',_0x24e8('0xc'),_0x24e8('0xc'),_0x24e8('0xc'),_0x24e8('0xe'),_0x24e8('0xf'),_0x24e8('0xd'),_0x24e8('0xd'),'FAILED'];config[_0x24e8('0x10')]=_['defaults'](config[_0x24e8('0x10')],{'host':_0x24e8('0x11'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x24e8('0x10')]));function VoiceCallReport(_0x5e1012){this[_0x24e8('0x12')]=_0x5e1012['channels'];this[_0x24e8('0x13')]=_0x5e1012[_0x24e8('0x13')];this[_0x24e8('0x14')]={};ami['on'](_0x24e8('0x15'),this['syncNewExten'][_0x24e8('0x16')](this));ami['on']('newexten',this[_0x24e8('0x17')][_0x24e8('0x16')](this));ami['on'](_0x24e8('0x18'),this[_0x24e8('0x19')]['bind'](this));ami['on'](_0x24e8('0x1a'),this[_0x24e8('0x1b')][_0x24e8('0x16')](this));ami['on'](_0x24e8('0x1c'),this['syncVarSet'][_0x24e8('0x16')](this));ami['on'](_0x24e8('0x1d'),this[_0x24e8('0x1e')][_0x24e8('0x16')](this));ami['on'](_0x24e8('0x1f'),this['syncNewCallerId'][_0x24e8('0x16')](this));ami['on'](_0x24e8('0x20'),this[_0x24e8('0x21')][_0x24e8('0x16')](this));ami['on'](_0x24e8('0x22'),this[_0x24e8('0x23')][_0x24e8('0x16')](this));ami['on'](_0x24e8('0x24'),this[_0x24e8('0x25')][_0x24e8('0x16')](this));ami['on'](_0x24e8('0x26'),this[_0x24e8('0x27')][_0x24e8('0x16')](this));try{logger[_0x24e8('0x28')](_0x24e8('0x29'));ami[_0x24e8('0x2a')]();}catch(_0x188666){logger['error'](_0x24e8('0x2b'),util[_0x24e8('0x2c')](_0x188666,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x24e8('0x2d')]=function(_0x250542){return _0x250542!==null&&!_[_0x24e8('0x2e')](_0x250542);};VoiceCallReport[_0x24e8('0x2f')][_0x24e8('0x30')]=function(_0x3bb4b1,_0x177824,_0x22976c){io['to'](_0x3bb4b1)['emit'](_0x177824,_0x22976c);};VoiceCallReport[_0x24e8('0x2f')][_0x24e8('0x31')]=function(_0x1d1ee4){try{if(this[_0x24e8('0x2d')](_0x1d1ee4)){logger['info'](_0x24e8('0x32'),_0x1d1ee4[_0x24e8('0x33')],_0x1d1ee4[_0x24e8('0x34')],_0x1d1ee4[_0x24e8('0x35')]);logger[_0x24e8('0x36')](_0x24e8('0x37'),_0x1d1ee4['uniqueid'],util[_0x24e8('0x2c')](_0x1d1ee4,{'showHidden':![],'depth':null}));if(_0x1d1ee4[_0x24e8('0x33')]===_0x1d1ee4[_0x24e8('0x38')]){if(!_[_0x24e8('0x2e')](this['channels'][_0x1d1ee4['uniqueid']])){_[_0x24e8('0x39')](this[_0x24e8('0x12')][_0x1d1ee4['uniqueid']],_['pick'](_0x1d1ee4,_[_0x24e8('0x3a')](this[_0x24e8('0x12')][_0x1d1ee4[_0x24e8('0x33')]])));}}if(_0x1d1ee4[_0x24e8('0x3b')]===_0x24e8('0x3c')){var _0x2cd07e=this[_0x24e8('0x13')][_0x1d1ee4[_0x24e8('0x3d')]['split']('-')[0x0]];if(_0x2cd07e){if(_0x1d1ee4['exten']=='xcally-motion-preview'){_0x2cd07e[_0x24e8('0x3e')]=_0x1d1ee4[_0x24e8('0x3f')];this['emit'](util[_0x24e8('0x40')](_0x24e8('0x41'),_0x2cd07e[_0x24e8('0x42')]),_0x24e8('0x43'),{'id':_0x2cd07e['id'],'destaccountcode':_0x2cd07e[_0x24e8('0x44')],'destconnectedlinenum':_0x1d1ee4[_0x24e8('0x3f')]});}}}}}catch(_0x403156){logger[_0x24e8('0x45')](_0x24e8('0x46'),_0x1d1ee4['uniqueid'],util['inspect'](_0x403156,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x24e8('0x2f')][_0x24e8('0x19')]=function(_0x3c909b){try{if(this[_0x24e8('0x2d')](_0x3c909b)){logger['debug'](_0x24e8('0x47'),_0x3c909b[_0x24e8('0x33')],util[_0x24e8('0x2c')](_0x3c909b,{'showHidden':![],'depth':null}));if(this['channels'][_0x3c909b[_0x24e8('0x33')]]){return;}if(_0x3c909b[_0x24e8('0x3d')]===_0x24e8('0x48')){return;}if(_0x3c909b[_0x24e8('0x33')]!==_0x3c909b[_0x24e8('0x38')]&&!this['blindTransfers'][_0x3c909b['linkedid']]){return;}logger['info'](_0x24e8('0x49'),_0x3c909b['uniqueid'],_0x3c909b['context'],_0x3c909b['exten']);this[_0x24e8('0x12')][_0x3c909b[_0x24e8('0x33')]]=new Channel();this[_0x24e8('0x12')][_0x3c909b[_0x24e8('0x33')]][_0x24e8('0x4a')]=moment()[_0x24e8('0x40')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x24e8('0x12')][_0x3c909b[_0x24e8('0x33')]][_0x24e8('0x4b')]=dispositions[_[_0x24e8('0x4c')](_0x3c909b[_0x24e8('0x4d')])];_[_0x24e8('0x39')](this[_0x24e8('0x12')][_0x3c909b['uniqueid']],_[_0x24e8('0x4e')](_0x3c909b,_[_0x24e8('0x3a')](this[_0x24e8('0x12')][_0x3c909b[_0x24e8('0x33')]])));if(_0x3c909b[_0x24e8('0x3b')]===_0x24e8('0x3c')){var _0x28e40e=this[_0x24e8('0x13')][_0x3c909b['channel'][_0x24e8('0x4f')]('-')[0x0]];if(_0x28e40e&&typeof _0x28e40e[_0x24e8('0x3e')]==='undefined'){_0x28e40e[_0x24e8('0x3e')]=_0x3c909b[_0x24e8('0x50')];logger[_0x24e8('0x36')](_0x24e8('0x51'),_0x3c909b['uniqueid'],util[_0x24e8('0x2c')]({'id':_0x28e40e['id'],'destaccountcode':_0x28e40e[_0x24e8('0x44')],'destconnectedlinenum':_0x3c909b['exten']},{'showHidden':![],'depth':null}));this[_0x24e8('0x30')](util[_0x24e8('0x40')](_0x24e8('0x41'),_0x28e40e[_0x24e8('0x42')]),'user:agentconnect',{'id':_0x28e40e['id'],'destaccountcode':_0x28e40e[_0x24e8('0x44')],'destconnectedlinenum':_0x3c909b[_0x24e8('0x50')]});}}}}catch(_0x495292){logger['error'](_0x24e8('0x52'),_0x3c909b[_0x24e8('0x33')],util[_0x24e8('0x2c')](_0x495292,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x24e8('0x2f')]['syncNewExten']=function(_0x5e2000){try{if(this['isNotNull'](_0x5e2000)){logger['debug'](_0x24e8('0x53'),_0x5e2000[_0x24e8('0x33')],util['inspect'](_0x5e2000,{'showHidden':![],'depth':null}));if(_0x5e2000[_0x24e8('0x3d')]===_0x24e8('0x48')||_0x5e2000['exten']==='h')return;if(_0x5e2000[_0x24e8('0x33')]===_0x5e2000['linkedid']||this['blindTransfers'][_0x5e2000[_0x24e8('0x38')]]){_0x5e2000['application']=_0x5e2000[_0x24e8('0x54')]?_0x5e2000[_0x24e8('0x54')][_0x24e8('0x55')]():undefined;_0x5e2000[_0x24e8('0x56')]=_0x5e2000[_0x24e8('0x57')]||_0x5e2000[_0x24e8('0x56')];if(_0x5e2000[_0x24e8('0x57')]&&_0x5e2000['application']!==_0x24e8('0x8')){_0x5e2000['applicationdata']=_0x5e2000[_0x24e8('0x56')][_0x24e8('0x55')]();}logger[_0x24e8('0x28')](_0x24e8('0x58'),_0x5e2000[_0x24e8('0x33')],_0x5e2000[_0x24e8('0x54')],_0x5e2000[_0x24e8('0x56')]);if(_[_0x24e8('0x2e')](this[_0x24e8('0x12')][_0x5e2000['uniqueid']])){this['channels'][_0x5e2000['uniqueid']]=new Channel();this[_0x24e8('0x12')][_0x5e2000[_0x24e8('0x33')]][_0x24e8('0x4a')]=_0x5e2000['duration']?moment()[_0x24e8('0x59')](moment[_0x24e8('0x5a')](_0x5e2000[_0x24e8('0x5a')])['seconds'](),_0x24e8('0x5b'))[_0x24e8('0x40')](_0x24e8('0x5c')):moment()['format'](_0x24e8('0x5c'));this[_0x24e8('0x12')][_0x5e2000[_0x24e8('0x33')]][_0x24e8('0x4b')]=_0x24e8('0xc');}_['merge'](this[_0x24e8('0x12')][_0x5e2000['uniqueid']],_['pick'](_0x5e2000,_[_0x24e8('0x3a')](this[_0x24e8('0x12')][_0x5e2000[_0x24e8('0x33')]])));if(_['includes'](applications,_0x5e2000[_0x24e8('0x54')])){this[_0x24e8('0x12')][_0x5e2000['uniqueid']][_0x24e8('0x5d')]=_0x5e2000[_0x24e8('0x54')];this[_0x24e8('0x12')][_0x5e2000['uniqueid']][_0x24e8('0x5e')]=_0x5e2000[_0x24e8('0x56')];if(_0x5e2000['application']===_0x24e8('0x5f')&&_[_0x24e8('0x60')](_0x5e2000[_0x24e8('0x56')][_0x24e8('0x55')](),_0x24e8('0x61'))){var _0x2e2789=_0x5e2000[_0x24e8('0x56')][_0x24e8('0x4f')]('=');var _0x3c619d=_0x2e2789[0x0][_0x24e8('0x55')]()[_0x24e8('0x62')](/cdr\((.*)\)/);if(_0x3c619d){if(_0x3c619d[0x1]===_0x24e8('0x63')&&!_[_0x24e8('0x64')](this[_0x24e8('0x12')][_0x5e2000['uniqueid']][_0x3c619d[0x1]]))return;this[_0x24e8('0x12')][_0x5e2000[_0x24e8('0x33')]][_0x3c619d[0x1]]=_0x2e2789[0x1];}}else if(_0x5e2000[_0x24e8('0x54')]==='queue'){this[_0x24e8('0x12')][_0x5e2000[_0x24e8('0x33')]][_0x24e8('0x8')]=_0x5e2000[_0x24e8('0x56')]['split'](',')[0x0];}}}}}catch(_0x3c4014){logger[_0x24e8('0x45')](_0x24e8('0x65'),_0x5e2000[_0x24e8('0x33')],util[_0x24e8('0x2c')](_0x3c4014,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x24e8('0x2f')]['syncNewState']=function(_0x52ece7){try{if(this[_0x24e8('0x2d')](_0x52ece7)){logger[_0x24e8('0x28')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x52ece7['uniqueid'],_0x52ece7[_0x24e8('0x38')],_0x52ece7['calleridname'],_0x52ece7[_0x24e8('0x35')]);logger[_0x24e8('0x36')](_0x24e8('0x66'),_0x52ece7[_0x24e8('0x33')],util[_0x24e8('0x2c')](_0x52ece7,{'showHidden':![],'depth':null}));if(_0x52ece7['channelstate']!=='6')return;var _0x35aa8a=this[_0x24e8('0x13')][_0x52ece7[_0x24e8('0x3d')]['split']('-')[0x0]];if(_0x52ece7[_0x24e8('0x33')]!==_0x52ece7[_0x24e8('0x38')]){var _0x666200=moment();if(this['channels'][_0x52ece7[_0x24e8('0x38')]]){if(!this['channels'][_0x52ece7['linkedid']][_0x24e8('0x67')]){this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x38')]]['answered']=!![];this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x38')]][_0x24e8('0x68')]=_0x666200[_0x24e8('0x40')](_0x24e8('0x5c'));if(this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x38')]][_0x24e8('0x4a')]){this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x38')]][_0x24e8('0x69')]=_0x666200[_0x24e8('0x6a')](this['channels'][_0x52ece7['linkedid']][_0x24e8('0x4a')],_0x24e8('0x5b'));}}this[_0x24e8('0x12')][_0x52ece7['linkedid']]['linkedid']=_0x52ece7[_0x24e8('0x33')];if(_0x52ece7['calleridnum']!=='xcally-motion-preview'){this['channels'][_0x52ece7[_0x24e8('0x38')]]['connectedlinenum']=_0x52ece7[_0x24e8('0x35')];}this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x38')]]['connectedlinename']=_0x52ece7[_0x24e8('0x34')];this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x38')]][_0x24e8('0x6b')]=_0x52ece7[_0x24e8('0x3d')];this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x38')]][_0x24e8('0x4b')]=dispositions[_[_0x24e8('0x4c')](_0x52ece7[_0x24e8('0x4d')])];if(_0x35aa8a){this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x38')]][_0x24e8('0x6c')]=_0x35aa8a['id'];this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x38')]][_0x24e8('0x6d')]=_0x35aa8a['name'];}}if(this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x33')]]){if(!this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x33')]]['answered']){this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x33')]][_0x24e8('0x67')]=!![];this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x33')]]['answertime']=_0x666200[_0x24e8('0x40')](_0x24e8('0x5c'));if(this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x33')]]['starttime']){this[_0x24e8('0x12')][_0x52ece7['uniqueid']][_0x24e8('0x69')]=_0x666200[_0x24e8('0x6a')](this['channels'][_0x52ece7[_0x24e8('0x33')]]['starttime'],'seconds');}}if(_0x52ece7['calleridnum']!==_0x24e8('0x6e')){this['channels'][_0x52ece7[_0x24e8('0x33')]][_0x24e8('0x3f')]=_0x52ece7['calleridnum'];}this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x33')]][_0x24e8('0x6f')]=_0x52ece7['calleridname'];this['channels'][_0x52ece7[_0x24e8('0x33')]][_0x24e8('0x6b')]=_0x52ece7[_0x24e8('0x3d')];this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x33')]][_0x24e8('0x4b')]=dispositions[_[_0x24e8('0x4c')](_0x52ece7['channelstate'])];}}else{if(this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x33')]]){if(_0x35aa8a){this['channels'][_0x52ece7['uniqueid']][_0x24e8('0x6c')]=_0x35aa8a['id'];this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x33')]][_0x24e8('0x6d')]=_0x35aa8a[_0x24e8('0x42')];}}}if(_0x52ece7['context']==='from-sip'){if(_0x35aa8a){_0x35aa8a[_0x24e8('0x3e')]=_0x52ece7[_0x24e8('0x50')];var _0x183612;if(this[_0x24e8('0x12')][_0x52ece7['uniqueid']]){_0x183612=this[_0x24e8('0x12')][_0x52ece7[_0x24e8('0x33')]][_0x24e8('0x8')];}else if(this[_0x24e8('0x12')][_0x52ece7['linkedid']]){_0x183612=this['channels'][_0x52ece7[_0x24e8('0x38')]]['queue'];}_0x35aa8a['queue']=_0x183612;var _0x3f01dc={'id':_0x35aa8a['id'],'name':_0x35aa8a['name'],'agentconnected':!![],'destaccountcode':_0x35aa8a[_0x24e8('0x44')],'destconnectedlinenum':_0x52ece7[_0x24e8('0x50')],'queue':_0x183612||undefined,'uniqueid':_0x52ece7[_0x24e8('0x38')]};logger[_0x24e8('0x36')](_0x24e8('0x70'),_0x52ece7[_0x24e8('0x33')],util['inspect'](_0x3f01dc,{'showHidden':![],'depth':null}));this[_0x24e8('0x30')](util[_0x24e8('0x40')](_0x24e8('0x41'),_0x35aa8a['name']),_0x24e8('0x43'),_0x3f01dc);}}}}catch(_0x8dce05){logger[_0x24e8('0x45')](_0x24e8('0x71'),_0x52ece7[_0x24e8('0x33')],util['inspect'](_0x8dce05,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x24e8('0x2f')][_0x24e8('0x72')]=function(_0x48a953,_0x7bc920){try{if(this[_0x24e8('0x12')][_0x48a953]){logger[_0x24e8('0x28')](_0x24e8('0x73'),_0x48a953,_0x7bc920);this[_0x24e8('0x12')][_0x48a953]['monitor']=!![];if(_[_0x24e8('0x74')](_0x7bc920,_0x24e8('0x75'))){_0x7bc920=_0x7bc920['replace']('.wav49',_0x24e8('0x76'));}this['channels'][_0x48a953][_0x24e8('0x77')]=_0x7bc920;var _0x25e447=_['find'](this['channels'][_0x48a953][_0x24e8('0x78')],{'filename':_0x7bc920});if(_['isNil'](_0x25e447)){this['channels'][_0x48a953][_0x24e8('0x78')][_0x24e8('0x79')]({'filename':_0x7bc920,'createdAt':moment()['format'](_0x24e8('0x5c')),'mixmonitorid':'','status':'rec'});}}}catch(_0x2d8db4){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0x48a953,util[_0x24e8('0x2c')](_0x2d8db4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x24e8('0x2f')]['syncVarSet']=function(_0x300ddf){try{if(this['isNotNull'](_0x300ddf)){logger[_0x24e8('0x36')]('[%s][voiceCallReport][varset]\x20event:',_0x300ddf[_0x24e8('0x33')],util['inspect'](_0x300ddf,{'showHidden':![],'depth':null}));if(this['channels'][_0x300ddf[_0x24e8('0x33')]]&&_0x300ddf[_0x24e8('0x3d')]!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x300ddf[_0x24e8('0x7a')])){if(this[_0x24e8('0x2d')](_0x300ddf[_0x24e8('0x7a')][_0x24e8('0x7b')])){logger[_0x24e8('0x28')](_0x24e8('0x7c'),_0x300ddf[_0x24e8('0x33')],_0x300ddf[_0x24e8('0x7d')]);this[_0x24e8('0x72')](_0x300ddf[_0x24e8('0x33')],_0x300ddf[_0x24e8('0x7d')]);}else if(this[_0x24e8('0x2d')](_0x300ddf['variable'][_0x24e8('0x7e')])){logger[_0x24e8('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x300ddf['uniqueid'],_0x300ddf[_0x24e8('0x7d')]);this['channels'][_0x300ddf['uniqueid']]['calleridnum']=_0x300ddf[_0x24e8('0x7d')];}else if(this[_0x24e8('0x2d')](_0x300ddf['variable'][_0x24e8('0x7f')])){logger['info'](_0x24e8('0x80'),_0x300ddf[_0x24e8('0x33')],_0x300ddf[_0x24e8('0x7d')]);this['channels'][_0x300ddf['uniqueid']][_0x24e8('0x81')]=_0x300ddf['value'];}else if(this[_0x24e8('0x2d')](_0x300ddf[_0x24e8('0x7a')][_0x24e8('0x82')])){logger[_0x24e8('0x28')](_0x24e8('0x83'),_0x300ddf[_0x24e8('0x33')],_0x300ddf[_0x24e8('0x7d')]);this['channels'][_0x300ddf['uniqueid']][_0x24e8('0x63')]=_0x300ddf[_0x24e8('0x7d')];}else if(this[_0x24e8('0x2d')](_0x300ddf[_0x24e8('0x7a')]['xmd-queue'])){logger[_0x24e8('0x28')](_0x24e8('0x84'),_0x300ddf[_0x24e8('0x33')],_0x300ddf['value'][_0x24e8('0x4f')](',')[0x0]);this[_0x24e8('0x12')][_0x300ddf[_0x24e8('0x33')]][_0x24e8('0x8')]=_0x300ddf[_0x24e8('0x7d')]['split'](',')[0x0];}else if(this[_0x24e8('0x2d')](_0x300ddf[_0x24e8('0x7a')]['xmd-originatecalleridnum'])){logger[_0x24e8('0x28')](_0x24e8('0x85'),_0x300ddf['uniqueid'],_0x300ddf[_0x24e8('0x7d')]);this[_0x24e8('0x12')][_0x300ddf[_0x24e8('0x33')]]['originatecalleridnum']=_0x300ddf['value'];}else if(this[_0x24e8('0x2d')](_0x300ddf[_0x24e8('0x7a')][_0x24e8('0x86')])){logger['info'](_0x24e8('0x87'),_0x300ddf['uniqueid'],_0x300ddf[_0x24e8('0x7d')]);this[_0x24e8('0x12')][_0x300ddf[_0x24e8('0x33')]][_0x24e8('0x88')]=_0x300ddf[_0x24e8('0x7d')];}else if(this[_0x24e8('0x2d')](_0x300ddf[_0x24e8('0x7a')][_0x24e8('0x89')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x300ddf[_0x24e8('0x33')],_0x300ddf['value']);this[_0x24e8('0x12')][_0x300ddf[_0x24e8('0x33')]][_0x24e8('0x8a')]=_0x300ddf[_0x24e8('0x7d')];}else if(this[_0x24e8('0x2d')](_0x300ddf[_0x24e8('0x7a')][_0x24e8('0x8b')])){logger['info'](_0x24e8('0x8c'),_0x300ddf[_0x24e8('0x33')],_0x300ddf['value']);this['channels'][_0x300ddf['uniqueid']]['queue']=_0x300ddf['value'];}else if(this['isNotNull'](_0x300ddf[_0x24e8('0x7a')][_0x24e8('0x8d')])){logger[_0x24e8('0x28')](_0x24e8('0x8e'),_0x300ddf[_0x24e8('0x33')],_0x300ddf['value']);this['channels'][_0x300ddf[_0x24e8('0x33')]][_0x24e8('0x8f')]=_0x300ddf[_0x24e8('0x7d')];}}}else if(this[_0x24e8('0x2d')](_0x300ddf[_0x24e8('0x7a')][_0x24e8('0x7b')])){if(_0x300ddf[_0x24e8('0x7d')]){var _0x252cfa=path[_0x24e8('0x90')](_0x300ddf[_0x24e8('0x7d')])['name'];logger['info'](_0x24e8('0x7c'),_0x252cfa,_0x300ddf[_0x24e8('0x7d')]);this['syncMixMonitorFilename'](_0x252cfa,_0x300ddf[_0x24e8('0x7d')]);}}else if(this[_0x24e8('0x12')][_0x300ddf[_0x24e8('0x38')]]){if(this['isNotNull'](_0x300ddf[_0x24e8('0x7a')])){if(this[_0x24e8('0x2d')](_0x300ddf[_0x24e8('0x7a')][_0x24e8('0x8d')])){logger[_0x24e8('0x28')](_0x24e8('0x8e'),_0x300ddf[_0x24e8('0x38')],_0x300ddf[_0x24e8('0x7d')]);this[_0x24e8('0x12')][_0x300ddf[_0x24e8('0x38')]][_0x24e8('0x91')]=_0x300ddf[_0x24e8('0x7d')];}}}}}catch(_0xfcbf42){logger[_0x24e8('0x45')](_0x24e8('0x92'),_0x300ddf[_0x24e8('0x33')],util['inspect'](_0xfcbf42,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x24e8('0x2f')]['syncHangup']=function(_0x180c0a){try{if(this[_0x24e8('0x2d')](_0x180c0a)){logger[_0x24e8('0x36')]('[%s][voiceCallReport][hangup]\x20event:',_0x180c0a['uniqueid'],util['inspect'](_0x180c0a,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x180c0a[_0x24e8('0x38')]]){if(this['channels'][this['blindTransfers'][_0x180c0a['linkedid']][_0x24e8('0x38')]]){this['channels'][this[_0x24e8('0x14')][_0x180c0a[_0x24e8('0x38')]][_0x24e8('0x38')]][_0x24e8('0x33')]=_0x180c0a['uniqueid'];this['channels'][this['blindTransfers'][_0x180c0a['linkedid']]['linkedid']][_0x24e8('0x67')]=this[_0x24e8('0x12')][_0x180c0a[_0x24e8('0x33')]][_0x24e8('0x67')];this[_0x24e8('0x12')][this[_0x24e8('0x14')][_0x180c0a[_0x24e8('0x38')]][_0x24e8('0x38')]][_0x24e8('0x68')]=this['channels'][_0x180c0a[_0x24e8('0x33')]][_0x24e8('0x68')];this[_0x24e8('0x12')][this[_0x24e8('0x14')][_0x180c0a[_0x24e8('0x38')]][_0x24e8('0x38')]]['destinationchannel']=this[_0x24e8('0x12')][this[_0x24e8('0x14')][_0x180c0a[_0x24e8('0x38')]][_0x24e8('0x38')]][_0x24e8('0x3d')];this[_0x24e8('0x12')][this['blindTransfers'][_0x180c0a[_0x24e8('0x38')]][_0x24e8('0x38')]][_0x24e8('0x4b')]=this['channels'][_0x180c0a[_0x24e8('0x33')]]['disposition'];this[_0x24e8('0x12')][_0x180c0a[_0x24e8('0x33')]]=this[_0x24e8('0x12')][this[_0x24e8('0x14')][_0x180c0a[_0x24e8('0x38')]][_0x24e8('0x38')]];this['deleteChannelAfterTimeout'](this[_0x24e8('0x14')][_0x180c0a[_0x24e8('0x38')]][_0x24e8('0x38')]);}else if(this['channels'][this[_0x24e8('0x14')][_0x180c0a[_0x24e8('0x38')]][_0x24e8('0x33')]]){this[_0x24e8('0x12')][this[_0x24e8('0x14')][_0x180c0a[_0x24e8('0x38')]][_0x24e8('0x33')]][_0x24e8('0x33')]=[this[_0x24e8('0x12')][this['blindTransfers'][_0x180c0a['linkedid']]['uniqueid']][_0x24e8('0x38')],this[_0x24e8('0x12')][this['blindTransfers'][_0x180c0a[_0x24e8('0x38')]][_0x24e8('0x33')]]['linkedid']=this[_0x24e8('0x12')][this[_0x24e8('0x14')][_0x180c0a['linkedid']][_0x24e8('0x33')]][_0x24e8('0x33')]][0x0];this['channels'][this[_0x24e8('0x14')][_0x180c0a[_0x24e8('0x38')]][_0x24e8('0x33')]][_0x24e8('0x67')]=this[_0x24e8('0x12')][_0x180c0a[_0x24e8('0x33')]][_0x24e8('0x67')];this[_0x24e8('0x12')][this['blindTransfers'][_0x180c0a['linkedid']][_0x24e8('0x33')]]['answertime']=this[_0x24e8('0x12')][_0x180c0a[_0x24e8('0x33')]][_0x24e8('0x68')];this[_0x24e8('0x12')][this[_0x24e8('0x14')][_0x180c0a[_0x24e8('0x38')]]['uniqueid']][_0x24e8('0x6b')]=this['channels'][this[_0x24e8('0x14')][_0x180c0a[_0x24e8('0x38')]][_0x24e8('0x33')]]['channel'];this[_0x24e8('0x12')][this[_0x24e8('0x14')][_0x180c0a[_0x24e8('0x38')]][_0x24e8('0x33')]]['disposition']=this[_0x24e8('0x12')][_0x180c0a[_0x24e8('0x33')]][_0x24e8('0x4b')];this['channels'][_0x180c0a[_0x24e8('0x33')]]=this[_0x24e8('0x12')][this[_0x24e8('0x14')][_0x180c0a[_0x24e8('0x38')]][_0x24e8('0x33')]];this[_0x24e8('0x93')](this[_0x24e8('0x14')][_0x180c0a[_0x24e8('0x38')]][_0x24e8('0x33')]);}}if(this[_0x24e8('0x12')][_0x180c0a['uniqueid']]){logger[_0x24e8('0x28')](_0x24e8('0x94'),_0x180c0a[_0x24e8('0x33')],_0x180c0a[_0x24e8('0x95')]);var _0x344828=moment();this[_0x24e8('0x12')][_0x180c0a[_0x24e8('0x33')]][_0x24e8('0x96')]=_0x344828[_0x24e8('0x40')](_0x24e8('0x5c'));this[_0x24e8('0x12')][_0x180c0a['uniqueid']][_0x24e8('0x5a')]=_0x344828['diff'](this['channels'][_0x180c0a[_0x24e8('0x33')]][_0x24e8('0x4a')],_0x24e8('0x5b'));if(this[_0x24e8('0x12')][_0x180c0a[_0x24e8('0x33')]][_0x24e8('0x67')]){this[_0x24e8('0x12')][_0x180c0a[_0x24e8('0x33')]][_0x24e8('0x97')]=_0x344828['diff'](this[_0x24e8('0x12')][_0x180c0a[_0x24e8('0x33')]][_0x24e8('0x68')],_0x24e8('0x5b'));this[_0x24e8('0x12')][_0x180c0a[_0x24e8('0x33')]][_0x24e8('0x69')]=this['channels'][_0x180c0a[_0x24e8('0x33')]][_0x24e8('0x5a')]-this[_0x24e8('0x12')][_0x180c0a[_0x24e8('0x33')]][_0x24e8('0x97')];}if(_0x180c0a['context']==='from-sip'){if(this[_0x24e8('0x13')][_0x180c0a['channel']['split']('-')[0x0]]){this['agents'][_0x180c0a[_0x24e8('0x3d')][_0x24e8('0x4f')]('-')[0x0]]=_['omit'](this[_0x24e8('0x13')][_0x180c0a[_0x24e8('0x3d')][_0x24e8('0x4f')]('-')[0x0]],['destconnectedlinenum']);logger[_0x24e8('0x36')](_0x24e8('0x98'),_0x180c0a[_0x24e8('0x33')],util['inspect']({'id':this['agents'][_0x180c0a['channel'][_0x24e8('0x4f')]('-')[0x0]]['id'],'destaccountcode':this[_0x24e8('0x13')][_0x180c0a[_0x24e8('0x3d')][_0x24e8('0x4f')]('-')[0x0]][_0x24e8('0x44')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x24e8('0x40')](_0x24e8('0x41'),this[_0x24e8('0x13')][_0x180c0a[_0x24e8('0x3d')]['split']('-')[0x0]][_0x24e8('0x42')]),'user:agentcomplete',{'id':this['agents'][_0x180c0a[_0x24e8('0x3d')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x24e8('0x13')][_0x180c0a[_0x24e8('0x3d')]['split']('-')[0x0]][_0x24e8('0x44')]});for(var _0x7c1b31=0x0;_0x7c1b31{delete this[_0x24e8('0x12')][_0x66b054];},_0x42a9bc);}};module[_0x24e8('0xc7')]=VoiceCallReport; \ No newline at end of file +var _0x1d4d=['util','path','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','set','queue','agi','dial','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isNotNull','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','[%s][voiceCallReport][newcallerid]\x20event:','isUndefined','merge','pick','keys','context','from-sip','channel','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','linkedid','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','disposition','toNumber','channelstate','split','undefined','debug','[%s][voiceCallReport][newchannel]','application','toLowerCase','applicationdata','appdata','starttime','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','startsWith','cdr(','match','type','isNil','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','diff','calleridnum','destinationchannel','answertime','connectedlinename','membername','user:%s','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','mixmonitor_filename','parse','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','then','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','Action','catch','finally','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','routeid','ATTENDED','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BLIND','transfereruniqueid','BlindTransfer','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x1d4d,0x188));var _0xd1d4=function(_0x4ebe9a,_0x466362){_0x4ebe9a=_0x4ebe9a-0x0;var _0x4d2fd6=_0x1d4d[_0x4ebe9a];return _0x4d2fd6;};'use strict';var _=require(_0xd1d4('0x0'));var moment=require(_0xd1d4('0x1'));var util=require(_0xd1d4('0x2'));var path=require(_0xd1d4('0x3'));var Redis=require('ioredis');var config=require(_0xd1d4('0x4'));var logger=require(_0xd1d4('0x5'))(_0xd1d4('0x6'));var ami=require(_0xd1d4('0x7'));var Channel=require(_0xd1d4('0x8'));var RpcSetting=require(_0xd1d4('0x9'));var applications=[_0xd1d4('0xa'),_0xd1d4('0xb'),_0xd1d4('0xc'),_0xd1d4('0xd'),'playback',_0xd1d4('0xe')];var dispositions=[_0xd1d4('0xf'),_0xd1d4('0x10'),_0xd1d4('0x10'),_0xd1d4('0xf'),_0xd1d4('0xf'),'NO\x20ANSWER','ANSWERED',_0xd1d4('0x11'),_0xd1d4('0x10'),_0xd1d4('0x10'),'FAILED'];config[_0xd1d4('0x12')]=_[_0xd1d4('0x13')](config[_0xd1d4('0x12')],{'host':'localhost','port':0x18eb});var io=require(_0xd1d4('0x14'))(new Redis(config[_0xd1d4('0x12')]));function VoiceCallReport(_0x283bbe){this[_0xd1d4('0x15')]=_0x283bbe['channels'];this[_0xd1d4('0x16')]=_0x283bbe[_0xd1d4('0x16')];this[_0xd1d4('0x17')]={};ami['on'](_0xd1d4('0x18'),this[_0xd1d4('0x19')][_0xd1d4('0x1a')](this));ami['on'](_0xd1d4('0x1b'),this[_0xd1d4('0x19')][_0xd1d4('0x1a')](this));ami['on'](_0xd1d4('0x1c'),this[_0xd1d4('0x1d')][_0xd1d4('0x1a')](this));ami['on'](_0xd1d4('0x1e'),this['syncNewState']['bind'](this));ami['on'](_0xd1d4('0x1f'),this[_0xd1d4('0x20')]['bind'](this));ami['on']('hangup',this[_0xd1d4('0x21')][_0xd1d4('0x1a')](this));ami['on'](_0xd1d4('0x22'),this[_0xd1d4('0x23')][_0xd1d4('0x1a')](this));ami['on'](_0xd1d4('0x24'),this[_0xd1d4('0x25')][_0xd1d4('0x1a')](this));ami['on']('blindtransfer',this[_0xd1d4('0x26')][_0xd1d4('0x1a')](this));ami['on'](_0xd1d4('0x27'),this['syncMusicOnHoldStart'][_0xd1d4('0x1a')](this));ami['on']('musiconholdstop',this[_0xd1d4('0x28')][_0xd1d4('0x1a')](this));try{logger[_0xd1d4('0x29')](_0xd1d4('0x2a'));ami[_0xd1d4('0x2b')]();}catch(_0x18951b){logger[_0xd1d4('0x2c')]('[voiceCallReport][coreshowchannels]',util[_0xd1d4('0x2d')](_0x18951b,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xd1d4('0x2e')][_0xd1d4('0x2f')]=function(_0x4fc3a8){return _0x4fc3a8!==null&&!_['isUndefined'](_0x4fc3a8);};VoiceCallReport[_0xd1d4('0x2e')][_0xd1d4('0x30')]=function(_0x50ca1d,_0x27bef2,_0x2808b8){io['to'](_0x50ca1d)[_0xd1d4('0x30')](_0x27bef2,_0x2808b8);};VoiceCallReport[_0xd1d4('0x2e')][_0xd1d4('0x23')]=function(_0x2dbf82){try{if(this[_0xd1d4('0x2f')](_0x2dbf82)){logger[_0xd1d4('0x29')](_0xd1d4('0x31'),_0x2dbf82[_0xd1d4('0x32')],_0x2dbf82[_0xd1d4('0x33')],_0x2dbf82['calleridnum']);logger['debug'](_0xd1d4('0x34'),_0x2dbf82[_0xd1d4('0x32')],util['inspect'](_0x2dbf82,{'showHidden':![],'depth':null}));if(_0x2dbf82[_0xd1d4('0x32')]===_0x2dbf82['linkedid']){if(!_[_0xd1d4('0x35')](this[_0xd1d4('0x15')][_0x2dbf82[_0xd1d4('0x32')]])){_[_0xd1d4('0x36')](this['channels'][_0x2dbf82['uniqueid']],_[_0xd1d4('0x37')](_0x2dbf82,_[_0xd1d4('0x38')](this[_0xd1d4('0x15')][_0x2dbf82[_0xd1d4('0x32')]])));}}if(_0x2dbf82[_0xd1d4('0x39')]===_0xd1d4('0x3a')){var _0x5719ff=this[_0xd1d4('0x16')][_0x2dbf82[_0xd1d4('0x3b')]['split']('-')[0x0]];if(_0x5719ff){if(_0x2dbf82[_0xd1d4('0x3c')]==_0xd1d4('0x3d')){_0x5719ff[_0xd1d4('0x3e')]=_0x2dbf82[_0xd1d4('0x3f')];this[_0xd1d4('0x30')](util[_0xd1d4('0x40')]('user:%s',_0x5719ff[_0xd1d4('0x41')]),_0xd1d4('0x42'),{'id':_0x5719ff['id'],'destaccountcode':_0x5719ff[_0xd1d4('0x43')],'destconnectedlinenum':_0x2dbf82['connectedlinenum']});}}}}}catch(_0x1cbdc7){logger[_0xd1d4('0x2c')](_0xd1d4('0x44'),_0x2dbf82['uniqueid'],util[_0xd1d4('0x2d')](_0x1cbdc7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd1d4('0x2e')][_0xd1d4('0x1d')]=function(_0x44550d){try{if(this[_0xd1d4('0x2f')](_0x44550d)){logger['debug'](_0xd1d4('0x45'),_0x44550d[_0xd1d4('0x32')],util[_0xd1d4('0x2d')](_0x44550d,{'showHidden':![],'depth':null}));if(this[_0xd1d4('0x15')][_0x44550d[_0xd1d4('0x32')]]){return;}if(_0x44550d[_0xd1d4('0x3b')]===_0xd1d4('0x46')){return;}if(_0x44550d[_0xd1d4('0x32')]!==_0x44550d[_0xd1d4('0x47')]&&!this[_0xd1d4('0x17')][_0x44550d[_0xd1d4('0x47')]]){return;}logger[_0xd1d4('0x29')](_0xd1d4('0x48'),_0x44550d[_0xd1d4('0x32')],_0x44550d['context'],_0x44550d[_0xd1d4('0x3c')]);this[_0xd1d4('0x15')][_0x44550d[_0xd1d4('0x32')]]=new Channel();this[_0xd1d4('0x15')][_0x44550d[_0xd1d4('0x32')]]['starttime']=moment()[_0xd1d4('0x40')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd1d4('0x15')][_0x44550d['uniqueid']][_0xd1d4('0x49')]=dispositions[_[_0xd1d4('0x4a')](_0x44550d[_0xd1d4('0x4b')])];_[_0xd1d4('0x36')](this[_0xd1d4('0x15')][_0x44550d['uniqueid']],_[_0xd1d4('0x37')](_0x44550d,_['keys'](this[_0xd1d4('0x15')][_0x44550d[_0xd1d4('0x32')]])));if(_0x44550d[_0xd1d4('0x39')]===_0xd1d4('0x3a')){var _0x265c7d=this['agents'][_0x44550d[_0xd1d4('0x3b')][_0xd1d4('0x4c')]('-')[0x0]];if(_0x265c7d&&typeof _0x265c7d[_0xd1d4('0x3e')]===_0xd1d4('0x4d')){_0x265c7d[_0xd1d4('0x3e')]=_0x44550d['exten'];logger[_0xd1d4('0x4e')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x44550d[_0xd1d4('0x32')],util['inspect']({'id':_0x265c7d['id'],'destaccountcode':_0x265c7d[_0xd1d4('0x43')],'destconnectedlinenum':_0x44550d[_0xd1d4('0x3c')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xd1d4('0x40')]('user:%s',_0x265c7d[_0xd1d4('0x41')]),_0xd1d4('0x42'),{'id':_0x265c7d['id'],'destaccountcode':_0x265c7d[_0xd1d4('0x43')],'destconnectedlinenum':_0x44550d[_0xd1d4('0x3c')]});}}}}catch(_0x35eb36){logger[_0xd1d4('0x2c')](_0xd1d4('0x4f'),_0x44550d['uniqueid'],util[_0xd1d4('0x2d')](_0x35eb36,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd1d4('0x2e')][_0xd1d4('0x19')]=function(_0x2d24e0){try{if(this[_0xd1d4('0x2f')](_0x2d24e0)){logger[_0xd1d4('0x4e')]('[%s][voiceCallReport][newexten]\x20event:',_0x2d24e0[_0xd1d4('0x32')],util[_0xd1d4('0x2d')](_0x2d24e0,{'showHidden':![],'depth':null}));if(_0x2d24e0['channel']===_0xd1d4('0x46')||_0x2d24e0[_0xd1d4('0x3c')]==='h')return;if(_0x2d24e0[_0xd1d4('0x32')]===_0x2d24e0[_0xd1d4('0x47')]||this[_0xd1d4('0x17')][_0x2d24e0['linkedid']]){_0x2d24e0[_0xd1d4('0x50')]=_0x2d24e0[_0xd1d4('0x50')]?_0x2d24e0['application'][_0xd1d4('0x51')]():undefined;_0x2d24e0[_0xd1d4('0x52')]=_0x2d24e0[_0xd1d4('0x53')]||_0x2d24e0[_0xd1d4('0x52')];if(_0x2d24e0[_0xd1d4('0x53')]&&_0x2d24e0['application']!==_0xd1d4('0xb')){_0x2d24e0[_0xd1d4('0x52')]=_0x2d24e0[_0xd1d4('0x52')][_0xd1d4('0x51')]();}logger[_0xd1d4('0x29')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x2d24e0[_0xd1d4('0x32')],_0x2d24e0[_0xd1d4('0x50')],_0x2d24e0[_0xd1d4('0x52')]);if(_[_0xd1d4('0x35')](this[_0xd1d4('0x15')][_0x2d24e0['uniqueid']])){this[_0xd1d4('0x15')][_0x2d24e0[_0xd1d4('0x32')]]=new Channel();this[_0xd1d4('0x15')][_0x2d24e0[_0xd1d4('0x32')]][_0xd1d4('0x54')]=_0x2d24e0[_0xd1d4('0x55')]?moment()[_0xd1d4('0x56')](moment['duration'](_0x2d24e0[_0xd1d4('0x55')])[_0xd1d4('0x57')](),_0xd1d4('0x57'))[_0xd1d4('0x40')](_0xd1d4('0x58')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xd1d4('0x15')][_0x2d24e0[_0xd1d4('0x32')]][_0xd1d4('0x49')]=_0xd1d4('0xf');}_[_0xd1d4('0x36')](this[_0xd1d4('0x15')][_0x2d24e0[_0xd1d4('0x32')]],_[_0xd1d4('0x37')](_0x2d24e0,_[_0xd1d4('0x38')](this[_0xd1d4('0x15')][_0x2d24e0['uniqueid']])));if(_[_0xd1d4('0x59')](applications,_0x2d24e0[_0xd1d4('0x50')])){this[_0xd1d4('0x15')][_0x2d24e0['uniqueid']][_0xd1d4('0x5a')]=_0x2d24e0[_0xd1d4('0x50')];this[_0xd1d4('0x15')][_0x2d24e0[_0xd1d4('0x32')]][_0xd1d4('0x5b')]=_0x2d24e0[_0xd1d4('0x52')];if(_0x2d24e0['application']===_0xd1d4('0xa')&&_[_0xd1d4('0x5c')](_0x2d24e0[_0xd1d4('0x52')][_0xd1d4('0x51')](),_0xd1d4('0x5d'))){var _0x44c333=_0x2d24e0[_0xd1d4('0x52')]['split']('=');var _0x424c59=_0x44c333[0x0][_0xd1d4('0x51')]()[_0xd1d4('0x5e')](/cdr\((.*)\)/);if(_0x424c59){if(_0x424c59[0x1]===_0xd1d4('0x5f')&&!_[_0xd1d4('0x60')](this[_0xd1d4('0x15')][_0x2d24e0[_0xd1d4('0x32')]][_0x424c59[0x1]]))return;this[_0xd1d4('0x15')][_0x2d24e0['uniqueid']][_0x424c59[0x1]]=_0x44c333[0x1];}}else if(_0x2d24e0[_0xd1d4('0x50')]===_0xd1d4('0xb')){this[_0xd1d4('0x15')][_0x2d24e0['uniqueid']][_0xd1d4('0xb')]=_0x2d24e0[_0xd1d4('0x52')]['split'](',')[0x0];}}}}}catch(_0x46a571){logger['error']('[%s][voiceCallReport][newexten]',_0x2d24e0['uniqueid'],util[_0xd1d4('0x2d')](_0x46a571,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd1d4('0x2e')]['syncNewState']=function(_0x22ec36){try{if(this[_0xd1d4('0x2f')](_0x22ec36)){logger[_0xd1d4('0x29')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x22ec36['uniqueid'],_0x22ec36['linkedid'],_0x22ec36[_0xd1d4('0x33')],_0x22ec36['calleridnum']);logger[_0xd1d4('0x4e')](_0xd1d4('0x61'),_0x22ec36[_0xd1d4('0x32')],util[_0xd1d4('0x2d')](_0x22ec36,{'showHidden':![],'depth':null}));if(_0x22ec36[_0xd1d4('0x4b')]!=='6')return;var _0x317faf=this['agents'][_0x22ec36[_0xd1d4('0x3b')]['split']('-')[0x0]];if(_0x22ec36[_0xd1d4('0x32')]!==_0x22ec36[_0xd1d4('0x47')]){var _0x408840=moment();if(this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x47')]]){if(!this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x47')]][_0xd1d4('0x62')]){this['channels'][_0x22ec36[_0xd1d4('0x47')]]['answered']=!![];this['channels'][_0x22ec36['linkedid']]['answertime']=_0x408840[_0xd1d4('0x40')](_0xd1d4('0x58'));if(this['channels'][_0x22ec36[_0xd1d4('0x47')]][_0xd1d4('0x54')]){this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x47')]][_0xd1d4('0x63')]=_0x408840[_0xd1d4('0x64')](this['channels'][_0x22ec36[_0xd1d4('0x47')]][_0xd1d4('0x54')],_0xd1d4('0x57'));}}this[_0xd1d4('0x15')][_0x22ec36['linkedid']][_0xd1d4('0x47')]=_0x22ec36[_0xd1d4('0x32')];if(_0x22ec36[_0xd1d4('0x65')]!==_0xd1d4('0x3d')){this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x47')]][_0xd1d4('0x3f')]=_0x22ec36[_0xd1d4('0x65')];}this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x47')]]['connectedlinename']=_0x22ec36['calleridname'];this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x47')]][_0xd1d4('0x66')]=_0x22ec36[_0xd1d4('0x3b')];this[_0xd1d4('0x15')][_0x22ec36['linkedid']][_0xd1d4('0x49')]=dispositions[_['toNumber'](_0x22ec36[_0xd1d4('0x4b')])];if(_0x317faf){this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x47')]]['UserId']=_0x317faf['id'];this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x47')]]['membername']=_0x317faf[_0xd1d4('0x41')];}}if(this[_0xd1d4('0x15')][_0x22ec36['uniqueid']]){if(!this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x32')]][_0xd1d4('0x62')]){this[_0xd1d4('0x15')][_0x22ec36['uniqueid']][_0xd1d4('0x62')]=!![];this['channels'][_0x22ec36[_0xd1d4('0x32')]][_0xd1d4('0x67')]=_0x408840['format'](_0xd1d4('0x58'));if(this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x32')]][_0xd1d4('0x54')]){this[_0xd1d4('0x15')][_0x22ec36['uniqueid']][_0xd1d4('0x63')]=_0x408840[_0xd1d4('0x64')](this['channels'][_0x22ec36['uniqueid']][_0xd1d4('0x54')],_0xd1d4('0x57'));}}if(_0x22ec36[_0xd1d4('0x65')]!==_0xd1d4('0x3d')){this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x32')]][_0xd1d4('0x3f')]=_0x22ec36['calleridnum'];}this['channels'][_0x22ec36['uniqueid']][_0xd1d4('0x68')]=_0x22ec36[_0xd1d4('0x33')];this['channels'][_0x22ec36['uniqueid']][_0xd1d4('0x66')]=_0x22ec36[_0xd1d4('0x3b')];this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x32')]]['disposition']=dispositions[_[_0xd1d4('0x4a')](_0x22ec36[_0xd1d4('0x4b')])];}}else{if(this[_0xd1d4('0x15')][_0x22ec36['uniqueid']]){if(_0x317faf){this['channels'][_0x22ec36[_0xd1d4('0x32')]]['UserId']=_0x317faf['id'];this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x32')]][_0xd1d4('0x69')]=_0x317faf[_0xd1d4('0x41')];}}}if(_0x22ec36[_0xd1d4('0x39')]===_0xd1d4('0x3a')){if(_0x317faf){_0x317faf[_0xd1d4('0x3e')]=_0x22ec36[_0xd1d4('0x3c')];var _0x3b5982;if(this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x32')]]){_0x3b5982=this[_0xd1d4('0x15')][_0x22ec36[_0xd1d4('0x32')]][_0xd1d4('0xb')];}else if(this['channels'][_0x22ec36[_0xd1d4('0x47')]]){_0x3b5982=this['channels'][_0x22ec36[_0xd1d4('0x47')]][_0xd1d4('0xb')];}_0x317faf[_0xd1d4('0xb')]=_0x3b5982;var _0x52a9d3={'id':_0x317faf['id'],'name':_0x317faf[_0xd1d4('0x41')],'agentconnected':!![],'destaccountcode':_0x317faf[_0xd1d4('0x43')],'destconnectedlinenum':_0x22ec36[_0xd1d4('0x3c')],'queue':_0x3b5982||undefined,'uniqueid':_0x22ec36['linkedid']};logger[_0xd1d4('0x4e')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x22ec36[_0xd1d4('0x32')],util[_0xd1d4('0x2d')](_0x52a9d3,{'showHidden':![],'depth':null}));this['emit'](util[_0xd1d4('0x40')](_0xd1d4('0x6a'),_0x317faf[_0xd1d4('0x41')]),_0xd1d4('0x42'),_0x52a9d3);}}}}catch(_0x3e83de){logger[_0xd1d4('0x2c')]('[%s][voiceCallReport][newstate]',_0x22ec36[_0xd1d4('0x32')],util[_0xd1d4('0x2d')](_0x3e83de,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd1d4('0x6b')]=function(_0xc5d322,_0x4ca399){try{if(this[_0xd1d4('0x15')][_0xc5d322]){logger['info'](_0xd1d4('0x6c'),_0xc5d322,_0x4ca399);this[_0xd1d4('0x15')][_0xc5d322][_0xd1d4('0x6d')]=!![];if(_[_0xd1d4('0x6e')](_0x4ca399,_0xd1d4('0x6f'))){_0x4ca399=_0x4ca399[_0xd1d4('0x70')](_0xd1d4('0x6f'),_0xd1d4('0x71'));}this['channels'][_0xc5d322]['monitorFilename']=_0x4ca399;var _0x2f2a79=_[_0xd1d4('0x72')](this[_0xd1d4('0x15')][_0xc5d322][_0xd1d4('0x73')],{'filename':_0x4ca399});if(_[_0xd1d4('0x60')](_0x2f2a79)){this[_0xd1d4('0x15')][_0xc5d322][_0xd1d4('0x73')][_0xd1d4('0x74')]({'filename':_0x4ca399,'createdAt':moment()['format'](_0xd1d4('0x58')),'mixmonitorid':'','status':_0xd1d4('0x75')});}}}catch(_0xbd58c2){logger[_0xd1d4('0x2c')](_0xd1d4('0x76'),_0xc5d322,util[_0xd1d4('0x2d')](_0xbd58c2,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd1d4('0x20')]=function(_0x563c2c){try{if(this[_0xd1d4('0x2f')](_0x563c2c)){logger[_0xd1d4('0x4e')](_0xd1d4('0x77'),_0x563c2c['uniqueid'],util[_0xd1d4('0x2d')](_0x563c2c,{'showHidden':![],'depth':null}));if(this[_0xd1d4('0x15')][_0x563c2c[_0xd1d4('0x32')]]&&_0x563c2c[_0xd1d4('0x3b')]!=_0xd1d4('0x46')){if(this[_0xd1d4('0x2f')](_0x563c2c[_0xd1d4('0x78')])){if(this['isNotNull'](_0x563c2c[_0xd1d4('0x78')]['mixmonitor_filename'])){logger[_0xd1d4('0x29')](_0xd1d4('0x79'),_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x6b')](_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')]);}else if(this[_0xd1d4('0x2f')](_0x563c2c[_0xd1d4('0x78')][_0xd1d4('0x7b')])){logger[_0xd1d4('0x29')](_0xd1d4('0x7c'),_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x15')][_0x563c2c[_0xd1d4('0x32')]][_0xd1d4('0x65')]=_0x563c2c['value'];}else if(this[_0xd1d4('0x2f')](_0x563c2c[_0xd1d4('0x78')][_0xd1d4('0x7d')])){logger[_0xd1d4('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x15')][_0x563c2c[_0xd1d4('0x32')]][_0xd1d4('0x7e')]=_0x563c2c[_0xd1d4('0x7a')];}else if(this[_0xd1d4('0x2f')](_0x563c2c[_0xd1d4('0x78')]['xmd-cdrtype'])){logger[_0xd1d4('0x29')](_0xd1d4('0x7f'),_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x15')][_0x563c2c[_0xd1d4('0x32')]][_0xd1d4('0x5f')]=_0x563c2c['value'];}else if(this['isNotNull'](_0x563c2c[_0xd1d4('0x78')][_0xd1d4('0x80')])){logger[_0xd1d4('0x29')](_0xd1d4('0x81'),_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')][_0xd1d4('0x4c')](',')[0x0]);this['channels'][_0x563c2c['uniqueid']][_0xd1d4('0xb')]=_0x563c2c[_0xd1d4('0x7a')][_0xd1d4('0x4c')](',')[0x0];}else if(this['isNotNull'](_0x563c2c[_0xd1d4('0x78')]['xmd-originatecalleridnum'])){logger[_0xd1d4('0x29')](_0xd1d4('0x82'),_0x563c2c[_0xd1d4('0x32')],_0x563c2c['value']);this[_0xd1d4('0x15')][_0x563c2c['uniqueid']]['originatecalleridnum']=_0x563c2c[_0xd1d4('0x7a')];}else if(this[_0xd1d4('0x2f')](_0x563c2c[_0xd1d4('0x78')][_0xd1d4('0x83')])){logger[_0xd1d4('0x29')](_0xd1d4('0x84'),_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x15')][_0x563c2c['uniqueid']][_0xd1d4('0x85')]=_0x563c2c[_0xd1d4('0x7a')];}else if(this[_0xd1d4('0x2f')](_0x563c2c['variable'][_0xd1d4('0x86')])){logger[_0xd1d4('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x15')][_0x563c2c[_0xd1d4('0x32')]][_0xd1d4('0x87')]=_0x563c2c[_0xd1d4('0x7a')];}else if(this[_0xd1d4('0x2f')](_0x563c2c['variable'][_0xd1d4('0x88')])){logger[_0xd1d4('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x563c2c['uniqueid'],_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x15')][_0x563c2c[_0xd1d4('0x32')]][_0xd1d4('0xb')]=_0x563c2c[_0xd1d4('0x7a')];}else if(this[_0xd1d4('0x2f')](_0x563c2c[_0xd1d4('0x78')][_0xd1d4('0x89')])){logger[_0xd1d4('0x29')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x563c2c[_0xd1d4('0x32')],_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x15')][_0x563c2c[_0xd1d4('0x32')]]['sipcalluniqueid']=_0x563c2c[_0xd1d4('0x7a')];}}}else if(this['isNotNull'](_0x563c2c[_0xd1d4('0x78')][_0xd1d4('0x8a')])){if(_0x563c2c['value']){var _0x5c7ca9=path[_0xd1d4('0x8b')](_0x563c2c[_0xd1d4('0x7a')])[_0xd1d4('0x41')];logger[_0xd1d4('0x29')](_0xd1d4('0x79'),_0x5c7ca9,_0x563c2c[_0xd1d4('0x7a')]);this[_0xd1d4('0x6b')](_0x5c7ca9,_0x563c2c[_0xd1d4('0x7a')]);}}else if(this['channels'][_0x563c2c[_0xd1d4('0x47')]]){if(this[_0xd1d4('0x2f')](_0x563c2c[_0xd1d4('0x78')])){if(this[_0xd1d4('0x2f')](_0x563c2c[_0xd1d4('0x78')][_0xd1d4('0x89')])){logger[_0xd1d4('0x29')](_0xd1d4('0x8c'),_0x563c2c[_0xd1d4('0x47')],_0x563c2c[_0xd1d4('0x7a')]);this['channels'][_0x563c2c[_0xd1d4('0x47')]][_0xd1d4('0x8d')]=_0x563c2c[_0xd1d4('0x7a')];}}}}}catch(_0x41c662){logger[_0xd1d4('0x2c')]('[%s][voiceCallReport][varset]',_0x563c2c[_0xd1d4('0x32')],util[_0xd1d4('0x2d')](_0x41c662,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd1d4('0x2e')][_0xd1d4('0x21')]=function(_0x694682){try{if(this['isNotNull'](_0x694682)){logger[_0xd1d4('0x4e')](_0xd1d4('0x8e'),_0x694682[_0xd1d4('0x32')],util['inspect'](_0x694682,{'showHidden':![],'depth':null}));if(this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]]){if(this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x47')]]){this[_0xd1d4('0x15')][this['blindTransfers'][_0x694682['linkedid']][_0xd1d4('0x47')]][_0xd1d4('0x32')]=_0x694682[_0xd1d4('0x32')];this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]]['linkedid']]['answered']=this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x62')];this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x47')]][_0xd1d4('0x67')]=this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x67')];this[_0xd1d4('0x15')][this['blindTransfers'][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x47')]]['destinationchannel']=this['channels'][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x47')]][_0xd1d4('0x3b')];this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x47')]][_0xd1d4('0x49')]=this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x49')];this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]]=this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]]['linkedid']];this[_0xd1d4('0x8f')](this[_0xd1d4('0x17')][_0x694682['linkedid']][_0xd1d4('0x47')]);}else if(this['channels'][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x32')]]){this['channels'][this['blindTransfers'][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x32')]][_0xd1d4('0x32')]=[this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x32')]][_0xd1d4('0x47')],this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x32')]]['linkedid']=this[_0xd1d4('0x15')][this['blindTransfers'][_0x694682[_0xd1d4('0x47')]]['uniqueid']][_0xd1d4('0x32')]][0x0];this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x32')]][_0xd1d4('0x62')]=this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x62')];this['channels'][this[_0xd1d4('0x17')][_0x694682['linkedid']][_0xd1d4('0x32')]]['answertime']=this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]]['answertime'];this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]]['uniqueid']][_0xd1d4('0x66')]=this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682[_0xd1d4('0x47')]][_0xd1d4('0x32')]][_0xd1d4('0x3b')];this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682['linkedid']][_0xd1d4('0x32')]][_0xd1d4('0x49')]=this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x49')];this['channels'][_0x694682[_0xd1d4('0x32')]]=this[_0xd1d4('0x15')][this[_0xd1d4('0x17')][_0x694682['linkedid']][_0xd1d4('0x32')]];this['deleteChannelAfterTimeout'](this[_0xd1d4('0x17')][_0x694682['linkedid']][_0xd1d4('0x32')]);}}if(this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]]){logger[_0xd1d4('0x29')](_0xd1d4('0x90'),_0x694682[_0xd1d4('0x32')],_0x694682['cause-txt']);var _0x2f9a36=moment();this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]]['endtime']=_0x2f9a36[_0xd1d4('0x40')](_0xd1d4('0x58'));this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x55')]=_0x2f9a36['diff'](this[_0xd1d4('0x15')][_0x694682['uniqueid']][_0xd1d4('0x54')],_0xd1d4('0x57'));if(this['channels'][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x62')]){this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x91')]=_0x2f9a36[_0xd1d4('0x64')](this['channels'][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x67')],_0xd1d4('0x57'));this[_0xd1d4('0x15')][_0x694682['uniqueid']][_0xd1d4('0x63')]=this['channels'][_0x694682['uniqueid']][_0xd1d4('0x55')]-this[_0xd1d4('0x15')][_0x694682[_0xd1d4('0x32')]][_0xd1d4('0x91')];}if(_0x694682[_0xd1d4('0x39')]===_0xd1d4('0x3a')){if(this[_0xd1d4('0x16')][_0x694682[_0xd1d4('0x3b')]['split']('-')[0x0]]){this[_0xd1d4('0x16')][_0x694682['channel']['split']('-')[0x0]]=_[_0xd1d4('0x92')](this['agents'][_0x694682[_0xd1d4('0x3b')][_0xd1d4('0x4c')]('-')[0x0]],[_0xd1d4('0x3e')]);logger[_0xd1d4('0x4e')](_0xd1d4('0x93'),_0x694682[_0xd1d4('0x32')],util[_0xd1d4('0x2d')]({'id':this[_0xd1d4('0x16')][_0x694682[_0xd1d4('0x3b')][_0xd1d4('0x4c')]('-')[0x0]]['id'],'destaccountcode':this[_0xd1d4('0x16')][_0x694682[_0xd1d4('0x3b')][_0xd1d4('0x4c')]('-')[0x0]][_0xd1d4('0x43')]},{'showHidden':![],'depth':null}));this[_0xd1d4('0x30')](util[_0xd1d4('0x40')](_0xd1d4('0x6a'),this[_0xd1d4('0x16')][_0x694682[_0xd1d4('0x3b')][_0xd1d4('0x4c')]('-')[0x0]][_0xd1d4('0x41')]),_0xd1d4('0x94'),{'id':this[_0xd1d4('0x16')][_0x694682['channel']['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x694682[_0xd1d4('0x3b')][_0xd1d4('0x4c')]('-')[0x0]][_0xd1d4('0x43')]});for(var _0x1c62ee=0x0;_0x1c62ee{delete this['channels'][_0x393b46];},_0x159478);}};module[_0xd1d4('0xc4')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 8db36b1..8f8eae7 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81b6=['privilege','info','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','debug','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','duration','endtime','diff','starttime','seconds','complete','total','answertime','holdtime','billableseconds','sumHoldTime','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','startsWith','match','exports','lodash','moment','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','[%s][voiceDialReport][dialbegin]\x20event:','inspect','uniqueid','merge','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','event'];(function(_0x17d9af,_0x4b29c6){var _0x4853d5=function(_0x4c4642){while(--_0x4c4642){_0x17d9af['push'](_0x17d9af['shift']());}};_0x4853d5(++_0x4b29c6);}(_0x81b6,0x137));var _0x681b=function(_0x99a0fd,_0x188d72){_0x99a0fd=_0x99a0fd-0x0;var _0xfb2e82=_0x81b6[_0x99a0fd];return _0xfb2e82;};'use strict';var _=require(_0x681b('0x0'));var moment=require(_0x681b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x681b('0x2'));var logger=require(_0x681b('0x3'))('ami');var ami=require(_0x681b('0x4'));config[_0x681b('0x5')]=_[_0x681b('0x6')](config[_0x681b('0x5')],{'host':_0x681b('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x24fec8){this['channels']=_0x24fec8[_0x681b('0x8')];this[_0x681b('0x9')]=_0x24fec8['outbound'];this[_0x681b('0xa')]={};this[_0x681b('0xb')]={};ami['on'](_0x681b('0xc'),this[_0x681b('0xd')][_0x681b('0xe')](this));ami['on'](_0x681b('0xf'),this[_0x681b('0x10')][_0x681b('0xe')](this));ami['on']('varset',this[_0x681b('0x11')][_0x681b('0xe')](this));ami['on'](_0x681b('0x12'),this[_0x681b('0x13')][_0x681b('0xe')](this));}VoiceDialReport[_0x681b('0x14')][_0x681b('0x15')]=function(_0x5a8ae0){return _0x5a8ae0!==null&&!_[_0x681b('0x16')](_0x5a8ae0);};VoiceDialReport['prototype'][_0x681b('0x17')]=function(_0x5bcd17,_0x238123,_0x1aba52){io['to'](_0x5bcd17)[_0x681b('0x17')](_0x238123,_0x1aba52);};VoiceDialReport['prototype'][_0x681b('0xd')]=function(_0x100318){try{if(this['isNotNull'](_0x100318)){logger['debug'](_0x681b('0x18'),_0x100318['uniqueid'],util[_0x681b('0x19')](_0x100318,{'showHidden':![],'depth':null}));if(this['channels'][_0x100318[_0x681b('0x1a')]]){_[_0x681b('0x1b')](this[_0x681b('0x1c')][_0x100318[_0x681b('0x1a')]],{'starttime':moment()[_0x681b('0x1d')](_0x681b('0x1e')),'lastevent':_0x681b('0x1f'),'interface':_0x100318[_0x681b('0x20')]['substring'](0x0,_0x100318[_0x681b('0x20')][_0x681b('0x21')]('-')),'membername':_0x100318['channel'][_0x681b('0x22')](_0x100318[_0x681b('0x20')]['lastIndexOf']('/')+0x1,_0x100318[_0x681b('0x20')][_0x681b('0x21')]('-'))},_[_0x681b('0x23')](_0x100318,[_0x681b('0x24'),_0x681b('0x25')]));logger[_0x681b('0x26')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x100318[_0x681b('0x1a')],this[_0x681b('0x1c')][_0x100318[_0x681b('0x1a')]][_0x681b('0x27')],this[_0x681b('0x1c')][_0x100318[_0x681b('0x1a')]]['interface']);logger['debug'](_0x681b('0x28'),_0x100318[_0x681b('0x1a')],util[_0x681b('0x19')](this[_0x681b('0x1c')][_0x100318[_0x681b('0x1a')]],{'showHidden':![],'depth':null}));if(this[_0x681b('0xa')][_0x100318['uniqueid']])_[_0x681b('0x1b')](this[_0x681b('0x1c')][_0x100318[_0x681b('0x1a')]],this['applications'][_0x100318[_0x681b('0x1a')]]);this[_0x681b('0x17')](_0x681b('0x29'),'voice_outbound_channel:save',this[_0x681b('0x1c')][_0x100318[_0x681b('0x1a')]]);logger[_0x681b('0x2a')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x100318['uniqueid'],util['inspect'](this['channels'][_0x100318['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x681b('0x17')]('custom:dialbegin',this['channels'][_0x100318[_0x681b('0x1a')]]);}}}catch(_0x4b57e2){logger[_0x681b('0x2b')]('[%s][voiceDialReport][dialbegin]',_0x100318[_0x681b('0x1a')],util[_0x681b('0x19')](_0x4b57e2,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncDialEnd']=function(_0x2b3452){try{if(this[_0x681b('0x15')](_0x2b3452)){logger['debug'](_0x681b('0x2c'),_0x2b3452['uniqueid'],util['inspect'](_0x2b3452,{'showHidden':![],'depth':null}));if(this['channels'][_0x2b3452[_0x681b('0x1a')]]){this['channels'][_0x2b3452[_0x681b('0x1a')]][_0x681b('0x2d')]=_0x2b3452[_0x681b('0x2d')];if(_0x2b3452[_0x681b('0x2d')]===_0x681b('0x2e')){this[_0x681b('0x1c')][_0x2b3452[_0x681b('0x1a')]][_0x681b('0x2f')]=_0x2b3452[_0x681b('0x2f')];this[_0x681b('0x1c')][_0x2b3452[_0x681b('0x1a')]]['connectedlinename']=_0x2b3452[_0x681b('0x30')];this[_0x681b('0x1c')][_0x2b3452['uniqueid']]['answertime']=moment()[_0x681b('0x1d')](_0x681b('0x1e'));this[_0x681b('0x1c')][_0x2b3452[_0x681b('0x1a')]][_0x681b('0x31')]='connect';logger[_0x681b('0x26')](_0x681b('0x32'),_0x2b3452[_0x681b('0x1a')],_0x2b3452[_0x681b('0x20')][_0x681b('0x22')](_0x2b3452[_0x681b('0x20')][_0x681b('0x21')]('/')+0x1,_0x2b3452[_0x681b('0x20')]['lastIndexOf']('-')));logger['debug'](_0x681b('0x33'),_0x2b3452[_0x681b('0x1a')],util[_0x681b('0x19')](this[_0x681b('0x1c')][_0x2b3452['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x681b('0x17')](_0x681b('0x34'),this[_0x681b('0x1c')][_0x2b3452['uniqueid']]);}logger['debug'](_0x681b('0x35'),_0x2b3452[_0x681b('0x1a')],util[_0x681b('0x19')](this[_0x681b('0x1c')][_0x2b3452[_0x681b('0x1a')]],{'showHidden':![],'depth':null}));this[_0x681b('0x17')](_0x681b('0x29'),'voice_outbound_channel:save',this[_0x681b('0x1c')][_0x2b3452[_0x681b('0x1a')]]);}}}catch(_0x3ce3f2){logger['error']('[%s][voiceDialReport][dialend]',_0x2b3452[_0x681b('0x1a')],util[_0x681b('0x19')](_0x3ce3f2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x681b('0x14')][_0x681b('0x11')]=function(_0x2b0414){try{if(this[_0x681b('0x15')](_0x2b0414)){logger[_0x681b('0x2a')](_0x681b('0x36'),_0x2b0414[_0x681b('0x1a')],util['inspect'](_0x2b0414,{'showHidden':![],'depth':null}));this[_0x681b('0x37')](_0x2b0414['uniqueid'],_[_0x681b('0x38')](_0x2b0414[_0x681b('0x39')])[0x0],_0x2b0414[_0x681b('0x3a')]);if(this[_0x681b('0x15')](_0x2b0414['variable'])&&this[_0x681b('0x15')](_0x2b0414['variable']['outboundrouteid'])){if(_[_0x681b('0x16')](this['channels'][_0x2b0414[_0x681b('0x1a')]])){this[_0x681b('0x1c')][_0x2b0414[_0x681b('0x1a')]]={'routeId':_0x2b0414[_0x681b('0x3a')],'variables':this[_0x681b('0xb')][_0x2b0414[_0x681b('0x1a')]],'motionChannel':_0x681b('0x3b')};logger[_0x681b('0x26')](_0x681b('0x3c'),_0x2b0414['uniqueid'],_0x2b0414[_0x681b('0x39')]['outboundrouteid'],_[_0x681b('0x38')](_0x2b0414[_0x681b('0x39')])[0x0],_0x2b0414['value']);logger['debug'](_0x681b('0x3d'),_0x2b0414[_0x681b('0x1a')],util[_0x681b('0x19')](this['channels'][_0x2b0414['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x681b('0x29'),_0x681b('0x3e'),this[_0x681b('0x1c')][_0x2b0414[_0x681b('0x1a')]]);}}}}catch(_0x346209){logger[_0x681b('0x2b')](_0x681b('0x3f'),_0x2b0414[_0x681b('0x1a')],util['inspect'](_0x346209,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x681b('0x37')]=function(_0x2e3133,_0x31ddd0,_0x4844e2){var _0x827a2b=[_0x681b('0x40'),'rtpaudioqosbridged',_0x681b('0x41'),_0x681b('0x42'),_0x681b('0x43'),'rtpaudioqoslossbridged',_0x681b('0x44'),_0x681b('0x45'),_0x681b('0x46'),_0x681b('0x47'),_0x681b('0x48'),_0x681b('0x49'),_0x681b('0x4a'),_0x681b('0x4b'),_0x681b('0x4c'),'memberlastcall',_0x681b('0x27'),_0x681b('0x4d'),_0x681b('0x4e')];if(!_[_0x681b('0x4f')](_0x31ddd0)&&!_['includes'](_0x827a2b,_0x31ddd0)){if(_[_0x681b('0x16')](this['variables'][_0x2e3133])){this[_0x681b('0xb')][_0x2e3133]={};}this['variables'][_0x2e3133][_0x31ddd0]=_0x4844e2;}};VoiceDialReport[_0x681b('0x14')][_0x681b('0x13')]=function(_0x10ad24){try{if(this[_0x681b('0x15')](_0x10ad24)){logger[_0x681b('0x2a')]('[%s][voiceDialReport][hangup]\x20event:',_0x10ad24['uniqueid'],util[_0x681b('0x19')](_0x10ad24,{'showHidden':![],'depth':null}));if(this[_0x681b('0x1c')][_0x10ad24[_0x681b('0x1a')]]){logger['info'](_0x681b('0x50'),_0x10ad24[_0x681b('0x1a')],_0x10ad24[_0x681b('0x51')]);this[_0x681b('0x1c')][_0x10ad24[_0x681b('0x1a')]]['endtime']=moment()[_0x681b('0x1d')](_0x681b('0x1e'));this[_0x681b('0x1c')][_0x10ad24['uniqueid']][_0x681b('0x52')]=moment(this[_0x681b('0x1c')][_0x10ad24[_0x681b('0x1a')]][_0x681b('0x53')])[_0x681b('0x54')](this['channels'][_0x10ad24[_0x681b('0x1a')]][_0x681b('0x55')],_0x681b('0x56'));this[_0x681b('0x1c')][_0x10ad24[_0x681b('0x1a')]][_0x681b('0x31')]=_0x681b('0x57');this[_0x681b('0x9')][_0x681b('0x58')]+=0x1;if(this[_0x681b('0x1c')][_0x10ad24[_0x681b('0x1a')]][_0x681b('0x59')]){this['outbound']['answered']+=0x1;this[_0x681b('0x1c')][_0x10ad24[_0x681b('0x1a')]][_0x681b('0x5a')]=moment(this[_0x681b('0x1c')][_0x10ad24[_0x681b('0x1a')]]['answertime'])[_0x681b('0x54')](this[_0x681b('0x1c')][_0x10ad24[_0x681b('0x1a')]][_0x681b('0x55')],'seconds');this[_0x681b('0x1c')][_0x10ad24[_0x681b('0x1a')]][_0x681b('0x5b')]=moment(this['channels'][_0x10ad24[_0x681b('0x1a')]][_0x681b('0x53')])[_0x681b('0x54')](this['channels'][_0x10ad24['uniqueid']][_0x681b('0x59')],_0x681b('0x56'));this[_0x681b('0x9')][_0x681b('0x5c')]+=this[_0x681b('0x1c')][_0x10ad24['uniqueid']]['holdtime']||0x0;this[_0x681b('0x9')]['sumBillable']+=this['channels'][_0x10ad24[_0x681b('0x1a')]]['billableseconds'];}this[_0x681b('0x9')][_0x681b('0x5d')]+=this['channels'][_0x10ad24[_0x681b('0x1a')]][_0x681b('0x52')];logger['debug'](_0x681b('0x5e'),_0x10ad24[_0x681b('0x1a')],util[_0x681b('0x19')](this[_0x681b('0x1c')][_0x10ad24[_0x681b('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0x681b('0x5f'),this[_0x681b('0x1c')][_0x10ad24[_0x681b('0x1a')]]);logger[_0x681b('0x2a')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x10ad24['uniqueid'],util[_0x681b('0x19')](this[_0x681b('0x1c')][_0x10ad24[_0x681b('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x681b('0x17')](_0x681b('0x60'),this[_0x681b('0x1c')][_0x10ad24['uniqueid']]);logger[_0x681b('0x2a')](_0x681b('0x61'),_0x10ad24[_0x681b('0x1a')],util[_0x681b('0x19')](this[_0x681b('0x1c')][_0x10ad24[_0x681b('0x1a')]],{'showHidden':![],'depth':null}));this['emit'](_0x681b('0x29'),_0x681b('0x62'),this[_0x681b('0x9')]);logger[_0x681b('0x26')](_0x681b('0x63'),JSON[_0x681b('0x64')](this[_0x681b('0x1c')][_0x10ad24[_0x681b('0x1a')]]));logger[_0x681b('0x2a')](_0x681b('0x65'),_0x10ad24[_0x681b('0x1a')],util[_0x681b('0x19')](this[_0x681b('0x1c')][_0x10ad24['uniqueid']],{'showHidden':![],'depth':null}));this[_0x681b('0x17')](_0x681b('0x29'),_0x681b('0x66'),this['channels'][_0x10ad24[_0x681b('0x1a')]]);this[_0x681b('0x67')](_0x10ad24[_0x681b('0x1a')]);}else if(this[_0x681b('0x1c')][_0x10ad24['linkedid']]){this[_0x681b('0x1c')][_0x10ad24[_0x681b('0x68')]][_0x681b('0x1a')]=this[_0x681b('0x1c')][_0x10ad24[_0x681b('0x68')]][_0x681b('0x69')];}if(this['variables'][_0x10ad24[_0x681b('0x1a')]]){delete this[_0x681b('0xb')][_0x10ad24[_0x681b('0x1a')]];}}}catch(_0x4cbc6b){logger[_0x681b('0x2b')](_0x681b('0x6a'),_0x10ad24[_0x681b('0x1a')],util[_0x681b('0x19')](_0x4cbc6b,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x681b('0x6b')]=function(_0x3ae2b2){try{if(this[_0x681b('0x15')](_0x3ae2b2)){logger[_0x681b('0x2a')](_0x681b('0x6c'),_0x3ae2b2[_0x681b('0x1a')],util[_0x681b('0x19')](_0x3ae2b2,{'showHidden':![],'depth':null}));if(_0x3ae2b2[_0x681b('0x6d')][_0x681b('0x6e')]()===_0x681b('0x6f')){_0x3ae2b2[_0x681b('0x70')]=(_0x3ae2b2['appdata']||_0x3ae2b2[_0x681b('0x70')])['toLowerCase']();if(_[_0x681b('0x71')](_0x3ae2b2['applicationdata'],'cdr(')){if(_['isUndefined'](this[_0x681b('0xa')][_0x3ae2b2[_0x681b('0x1a')]]))this[_0x681b('0xa')][_0x3ae2b2[_0x681b('0x1a')]]={};logger[_0x681b('0x26')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x3ae2b2['uniqueid'],_0x3ae2b2[_0x681b('0x6d')],_0x3ae2b2[_0x681b('0x70')]);var _0x387533=_0x3ae2b2[_0x681b('0x70')]['split']('=');var _0x2f3382=_0x387533[0x0][_0x681b('0x72')](/cdr\((.*)\)/);if(_0x2f3382)this[_0x681b('0xa')][_0x3ae2b2[_0x681b('0x1a')]][_0x2f3382[0x1]]=_0x387533[0x1];}}}}catch(_0x565b12){logger[_0x681b('0x2b')]('[%s][voiceDialReport][newexten]',_0x3ae2b2['uniqueid'],util['inspect'](_0x565b12,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x681b('0x14')][_0x681b('0x67')]=function(_0x31214a,_0x2d05ad=0x2710){if(this[_0x681b('0x1c')][_0x31214a]){setTimeout(()=>{delete this[_0x681b('0x1c')][_0x31214a];},_0x2d05ad);}};module[_0x681b('0x73')]=VoiceDialReport; \ No newline at end of file +var _0xa728=['info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','voice:outbound','[%s][voiceDialReport][dialend]','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','YYYY-MM-DD\x20HH:mm:ss','duration','diff','starttime','seconds','lastevent','complete','total','answertime','answered','billableseconds','sumHoldTime','holdtime','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','application','set','applicationdata','appdata','toLowerCase','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncHangup','isNotNull','isUndefined','prototype','debug','[%s][voiceDialReport][dialbegin]\x20event:','inspect','uniqueid','merge','format','channel','substring','lastIndexOf','omit','event','interface','emit','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','ANSWER','connectedlinenum','connectedlinename','connect'];(function(_0xcca2ea,_0x3942fe){var _0x6b85d1=function(_0x4e8ef1){while(--_0x4e8ef1){_0xcca2ea['push'](_0xcca2ea['shift']());}};_0x6b85d1(++_0x3942fe);}(_0xa728,0xb4));var _0x8a72=function(_0x150598,_0xde21f7){_0x150598=_0x150598-0x0;var _0x4840e2=_0xa728[_0x150598];return _0x4840e2;};'use strict';var _=require(_0x8a72('0x0'));var moment=require(_0x8a72('0x1'));var util=require(_0x8a72('0x2'));var Redis=require(_0x8a72('0x3'));var config=require('../../../config/environment');var logger=require(_0x8a72('0x4'))(_0x8a72('0x5'));var ami=require(_0x8a72('0x6'));config[_0x8a72('0x7')]=_['defaults'](config[_0x8a72('0x7')],{'host':_0x8a72('0x8'),'port':0x18eb});var io=require(_0x8a72('0x9'))(new Redis(config[_0x8a72('0x7')]));function VoiceDialReport(_0x44a8a9){this[_0x8a72('0xa')]=_0x44a8a9[_0x8a72('0xb')];this[_0x8a72('0xc')]=_0x44a8a9[_0x8a72('0xc')];this[_0x8a72('0xd')]={};this[_0x8a72('0xe')]={};ami['on'](_0x8a72('0xf'),this[_0x8a72('0x10')][_0x8a72('0x11')](this));ami['on'](_0x8a72('0x12'),this[_0x8a72('0x13')][_0x8a72('0x11')](this));ami['on'](_0x8a72('0x14'),this['syncVarSet']['bind'](this));ami['on']('hangup',this[_0x8a72('0x15')]['bind'](this));}VoiceDialReport['prototype'][_0x8a72('0x16')]=function(_0x1c9467){return _0x1c9467!==null&&!_[_0x8a72('0x17')](_0x1c9467);};VoiceDialReport[_0x8a72('0x18')]['emit']=function(_0x17a65b,_0x14840f,_0x1a9533){io['to'](_0x17a65b)['emit'](_0x14840f,_0x1a9533);};VoiceDialReport[_0x8a72('0x18')][_0x8a72('0x10')]=function(_0xce0af){try{if(this[_0x8a72('0x16')](_0xce0af)){logger[_0x8a72('0x19')](_0x8a72('0x1a'),_0xce0af['uniqueid'],util[_0x8a72('0x1b')](_0xce0af,{'showHidden':![],'depth':null}));if(this['channels'][_0xce0af[_0x8a72('0x1c')]]){_[_0x8a72('0x1d')](this[_0x8a72('0xa')][_0xce0af[_0x8a72('0x1c')]],{'starttime':moment()[_0x8a72('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0xce0af[_0x8a72('0x1f')][_0x8a72('0x20')](0x0,_0xce0af[_0x8a72('0x1f')][_0x8a72('0x21')]('-')),'membername':_0xce0af[_0x8a72('0x1f')][_0x8a72('0x20')](_0xce0af['channel'][_0x8a72('0x21')]('/')+0x1,_0xce0af[_0x8a72('0x1f')][_0x8a72('0x21')]('-'))},_[_0x8a72('0x22')](_0xce0af,[_0x8a72('0x23'),'privilege']));logger['info']('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0xce0af[_0x8a72('0x1c')],this[_0x8a72('0xa')][_0xce0af[_0x8a72('0x1c')]]['membername'],this[_0x8a72('0xa')][_0xce0af[_0x8a72('0x1c')]][_0x8a72('0x24')]);logger[_0x8a72('0x19')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0xce0af[_0x8a72('0x1c')],util[_0x8a72('0x1b')](this[_0x8a72('0xa')][_0xce0af[_0x8a72('0x1c')]],{'showHidden':![],'depth':null}));if(this[_0x8a72('0xd')][_0xce0af[_0x8a72('0x1c')]])_[_0x8a72('0x1d')](this['channels'][_0xce0af[_0x8a72('0x1c')]],this['applications'][_0xce0af[_0x8a72('0x1c')]]);this[_0x8a72('0x25')]('voice:outbound',_0x8a72('0x26'),this[_0x8a72('0xa')][_0xce0af[_0x8a72('0x1c')]]);logger['debug'](_0x8a72('0x27'),_0xce0af[_0x8a72('0x1c')],util['inspect'](this[_0x8a72('0xa')][_0xce0af[_0x8a72('0x1c')]],{'showHidden':![],'depth':null}));ami['emit'](_0x8a72('0x28'),this[_0x8a72('0xa')][_0xce0af[_0x8a72('0x1c')]]);}}}catch(_0x238c2a){logger[_0x8a72('0x29')](_0x8a72('0x2a'),_0xce0af['uniqueid'],util['inspect'](_0x238c2a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8a72('0x18')][_0x8a72('0x13')]=function(_0x148fd1){try{if(this[_0x8a72('0x16')](_0x148fd1)){logger[_0x8a72('0x19')](_0x8a72('0x2b'),_0x148fd1[_0x8a72('0x1c')],util['inspect'](_0x148fd1,{'showHidden':![],'depth':null}));if(this[_0x8a72('0xa')][_0x148fd1['uniqueid']]){this[_0x8a72('0xa')][_0x148fd1['uniqueid']]['dialstatus']=_0x148fd1['dialstatus'];if(_0x148fd1['dialstatus']===_0x8a72('0x2c')){this['channels'][_0x148fd1[_0x8a72('0x1c')]][_0x8a72('0x2d')]=_0x148fd1[_0x8a72('0x2d')];this[_0x8a72('0xa')][_0x148fd1[_0x8a72('0x1c')]][_0x8a72('0x2e')]=_0x148fd1[_0x8a72('0x2e')];this[_0x8a72('0xa')][_0x148fd1['uniqueid']]['answertime']=moment()[_0x8a72('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x148fd1[_0x8a72('0x1c')]]['lastevent']=_0x8a72('0x2f');logger[_0x8a72('0x30')](_0x8a72('0x31'),_0x148fd1['uniqueid'],_0x148fd1[_0x8a72('0x1f')][_0x8a72('0x20')](_0x148fd1[_0x8a72('0x1f')][_0x8a72('0x21')]('/')+0x1,_0x148fd1[_0x8a72('0x1f')][_0x8a72('0x21')]('-')));logger['debug'](_0x8a72('0x32'),_0x148fd1['uniqueid'],util['inspect'](this[_0x8a72('0xa')][_0x148fd1['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x8a72('0x25')]('custom:dialconnect',this[_0x8a72('0xa')][_0x148fd1[_0x8a72('0x1c')]]);}logger[_0x8a72('0x19')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x148fd1[_0x8a72('0x1c')],util[_0x8a72('0x1b')](this['channels'][_0x148fd1[_0x8a72('0x1c')]],{'showHidden':![],'depth':null}));this[_0x8a72('0x25')](_0x8a72('0x33'),_0x8a72('0x26'),this['channels'][_0x148fd1['uniqueid']]);}}}catch(_0x35b1a6){logger['error'](_0x8a72('0x34'),_0x148fd1[_0x8a72('0x1c')],util[_0x8a72('0x1b')](_0x35b1a6,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x19f7ef){try{if(this[_0x8a72('0x16')](_0x19f7ef)){logger[_0x8a72('0x19')]('[%s][voiceDialReport][varset]\x20event:',_0x19f7ef['uniqueid'],util['inspect'](_0x19f7ef,{'showHidden':![],'depth':null}));this[_0x8a72('0x35')](_0x19f7ef[_0x8a72('0x1c')],_[_0x8a72('0x36')](_0x19f7ef[_0x8a72('0x37')])[0x0],_0x19f7ef[_0x8a72('0x38')]);if(this['isNotNull'](_0x19f7ef[_0x8a72('0x37')])&&this[_0x8a72('0x16')](_0x19f7ef['variable'][_0x8a72('0x39')])){if(_[_0x8a72('0x17')](this[_0x8a72('0xa')][_0x19f7ef[_0x8a72('0x1c')]])){this['channels'][_0x19f7ef[_0x8a72('0x1c')]]={'routeId':_0x19f7ef['value'],'variables':this['variables'][_0x19f7ef[_0x8a72('0x1c')]],'motionChannel':'voice'};logger[_0x8a72('0x30')](_0x8a72('0x3a'),_0x19f7ef['uniqueid'],_0x19f7ef[_0x8a72('0x37')][_0x8a72('0x39')],_[_0x8a72('0x36')](_0x19f7ef['variable'])[0x0],_0x19f7ef[_0x8a72('0x38')]);logger[_0x8a72('0x19')](_0x8a72('0x3b'),_0x19f7ef[_0x8a72('0x1c')],util['inspect'](this[_0x8a72('0xa')][_0x19f7ef[_0x8a72('0x1c')]],{'showHidden':![],'depth':null}));this[_0x8a72('0x25')]('voice:outbound',_0x8a72('0x26'),this[_0x8a72('0xa')][_0x19f7ef[_0x8a72('0x1c')]]);}}}}catch(_0x271c66){logger[_0x8a72('0x29')]('[%s][voiceDialReport][varset]',_0x19f7ef[_0x8a72('0x1c')],util[_0x8a72('0x1b')](_0x271c66,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x73aa50,_0x3bbeb2,_0x15df4e){var _0x2a03d1=[_0x8a72('0x3c'),'rtpaudioqosbridged',_0x8a72('0x3d'),_0x8a72('0x3e'),_0x8a72('0x3f'),'rtpaudioqoslossbridged',_0x8a72('0x40'),_0x8a72('0x41'),'sipcallid',_0x8a72('0x42'),_0x8a72('0x43'),_0x8a72('0x44'),_0x8a72('0x45'),_0x8a72('0x46'),_0x8a72('0x47'),_0x8a72('0x48'),'membername',_0x8a72('0x49'),'memberrealtime'];if(!_[_0x8a72('0x4a')](_0x3bbeb2)&&!_['includes'](_0x2a03d1,_0x3bbeb2)){if(_['isUndefined'](this['variables'][_0x73aa50])){this[_0x8a72('0xe')][_0x73aa50]={};}this['variables'][_0x73aa50][_0x3bbeb2]=_0x15df4e;}};VoiceDialReport[_0x8a72('0x18')][_0x8a72('0x15')]=function(_0x4f156e){try{if(this['isNotNull'](_0x4f156e)){logger[_0x8a72('0x19')]('[%s][voiceDialReport][hangup]\x20event:',_0x4f156e[_0x8a72('0x1c')],util[_0x8a72('0x1b')](_0x4f156e,{'showHidden':![],'depth':null}));if(this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]]){logger[_0x8a72('0x30')](_0x8a72('0x4b'),_0x4f156e['uniqueid'],_0x4f156e[_0x8a72('0x4c')]);this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x4d')]=moment()[_0x8a72('0x1e')](_0x8a72('0x4e'));this['channels'][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x4f')]=moment(this['channels'][_0x4f156e['uniqueid']][_0x8a72('0x4d')])[_0x8a72('0x50')](this['channels'][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x51')],_0x8a72('0x52'));this['channels'][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x53')]=_0x8a72('0x54');this[_0x8a72('0xc')][_0x8a72('0x55')]+=0x1;if(this[_0x8a72('0xa')][_0x4f156e['uniqueid']][_0x8a72('0x56')]){this[_0x8a72('0xc')][_0x8a72('0x57')]+=0x1;this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]]['holdtime']=moment(this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]]['answertime'])[_0x8a72('0x50')](this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x51')],_0x8a72('0x52'));this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x58')]=moment(this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x4d')])[_0x8a72('0x50')](this['channels'][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x56')],'seconds');this[_0x8a72('0xc')][_0x8a72('0x59')]+=this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]][_0x8a72('0x5a')]||0x0;this[_0x8a72('0xc')]['sumBillable']+=this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]]['billableseconds'];}this[_0x8a72('0xc')]['sumDuration']+=this[_0x8a72('0xa')][_0x4f156e['uniqueid']][_0x8a72('0x4f')];logger[_0x8a72('0x19')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x4f156e[_0x8a72('0x1c')],util['inspect'](this[_0x8a72('0xa')][_0x4f156e['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x8a72('0x25')](_0x8a72('0x5b'),this['channels'][_0x4f156e[_0x8a72('0x1c')]]);logger[_0x8a72('0x19')](_0x8a72('0x5c'),_0x4f156e[_0x8a72('0x1c')],util[_0x8a72('0x1b')](this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialend',this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]]);logger[_0x8a72('0x19')](_0x8a72('0x5d'),_0x4f156e[_0x8a72('0x1c')],util[_0x8a72('0x1b')](this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]],{'showHidden':![],'depth':null}));this['emit'](_0x8a72('0x33'),_0x8a72('0x5e'),this[_0x8a72('0xc')]);logger[_0x8a72('0x30')](_0x8a72('0x5f'),JSON[_0x8a72('0x60')](this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]]));logger[_0x8a72('0x19')](_0x8a72('0x61'),_0x4f156e['uniqueid'],util['inspect'](this['channels'][_0x4f156e[_0x8a72('0x1c')]],{'showHidden':![],'depth':null}));this[_0x8a72('0x25')](_0x8a72('0x33'),_0x8a72('0x62'),this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x1c')]]);this[_0x8a72('0x63')](_0x4f156e[_0x8a72('0x1c')]);}else if(this['channels'][_0x4f156e['linkedid']]){this[_0x8a72('0xa')][_0x4f156e[_0x8a72('0x64')]][_0x8a72('0x1c')]=this[_0x8a72('0xa')][_0x4f156e['linkedid']][_0x8a72('0x65')];}if(this['variables'][_0x4f156e['uniqueid']]){delete this['variables'][_0x4f156e[_0x8a72('0x1c')]];}}}catch(_0x2400d9){logger[_0x8a72('0x29')](_0x8a72('0x66'),_0x4f156e[_0x8a72('0x1c')],util[_0x8a72('0x1b')](_0x2400d9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8a72('0x18')][_0x8a72('0x67')]=function(_0x5dc40d){try{if(this[_0x8a72('0x16')](_0x5dc40d)){logger[_0x8a72('0x19')]('[%s][voiceDialReport][newexten]\x20event:',_0x5dc40d[_0x8a72('0x1c')],util['inspect'](_0x5dc40d,{'showHidden':![],'depth':null}));if(_0x5dc40d[_0x8a72('0x68')]['toLowerCase']()===_0x8a72('0x69')){_0x5dc40d[_0x8a72('0x6a')]=(_0x5dc40d[_0x8a72('0x6b')]||_0x5dc40d[_0x8a72('0x6a')])[_0x8a72('0x6c')]();if(_[_0x8a72('0x6d')](_0x5dc40d[_0x8a72('0x6a')],_0x8a72('0x6e'))){if(_[_0x8a72('0x17')](this[_0x8a72('0xd')][_0x5dc40d[_0x8a72('0x1c')]]))this['applications'][_0x5dc40d['uniqueid']]={};logger[_0x8a72('0x30')](_0x8a72('0x6f'),_0x5dc40d['uniqueid'],_0x5dc40d[_0x8a72('0x68')],_0x5dc40d['applicationdata']);var _0x1c7401=_0x5dc40d[_0x8a72('0x6a')][_0x8a72('0x70')]('=');var _0x5d85aa=_0x1c7401[0x0]['match'](/cdr\((.*)\)/);if(_0x5d85aa)this[_0x8a72('0xd')][_0x5dc40d[_0x8a72('0x1c')]][_0x5d85aa[0x1]]=_0x1c7401[0x1];}}}}catch(_0x189b50){logger[_0x8a72('0x29')]('[%s][voiceDialReport][newexten]',_0x5dc40d[_0x8a72('0x1c')],util[_0x8a72('0x1b')](_0x189b50,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8a72('0x18')]['deleteChannelAfterTimeout']=function(_0x316c96,_0x52a9e7=0x2710){if(this[_0x8a72('0xa')][_0x316c96]){setTimeout(()=>{delete this[_0x8a72('0xa')][_0x316c96];},_0x52a9e7);}};module[_0x8a72('0x71')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index e79013b..07091bb 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec64=['then','actionid','queuestatus','[voiceQueueReport][queuesummary]','summaryEvent','createReport','handleInboundQueueSummaryReport','createQueueSummaryReport','compareToInboundQueue','assign','type','outbound','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','isNotNull','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','pick','keys','emitVoiceQueueChannelSave','queuecallerjoin','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','queuecallerabandonAt','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','queuecallerexit','queuecallerexitAt','transfer','reason','startsWith','local/','linkedid','add','queuecallerexitreason','FORWARDTRANSFER','transfertype','transferexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberdynamic','memberlastcall','memberpenalty','length','sumHoldTime','diff','seconds','milliseconds','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][hangup]','handleHangup','cause-txt','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','transfereeuniqueid','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','secondtransfererexten','[%s][voiceQueueReport][attendedtransfer]','syncBlindTransfer','BLINDTRANSFER','BLIND','extension','BlindTransfer','[%s][voiceQueueReport][blindtransfer]','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','toLowerCase','set','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','application','split','match','[%s][voiceQueueReport][newexten]','moment','ioredis','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','defaults','localhost','socket.io-emitter','redis','prototype','tail','finally','queueReports','realtime','agents','queueChannels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','hasOwnProperty','isEmpty','originated','waiting','queueStatusComplete','unlockRR','queuecallercomplete','clearZombieChannels','channels','switch','sequence','enqueue','isNil','Action','status','channel','No\x20such\x20channel','inspect','error','[%s][voiceQueueReport][checkQueueReport]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','queue','voice_queue_channel:save','voice_queue_presence:save','ATTENDEDTRANSFER','voice_queue_channel:remove','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isUndefined','queues','catch','[voiceQueueReport][queues]','isRunning'];(function(_0x482b54,_0x14b147){var _0x15f42c=function(_0x349738){while(--_0x349738){_0x482b54['push'](_0x482b54['shift']());}};_0x15f42c(++_0x14b147);}(_0xec64,0x172));var _0x4ec6=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0xec64[_0x5712f8];return _0x14a364;};'use strict';var _=require('lodash');var moment=require(_0x4ec6('0x0'));var util=require('util');var Redis=require(_0x4ec6('0x1'));var config=require('../../../config/environment');var logger=require(_0x4ec6('0x2'))(_0x4ec6('0x3'));var ami=require(_0x4ec6('0x4'));var QueueReport=require(_0x4ec6('0x5'));var VoiceQueueSummary=require(_0x4ec6('0x6'));config['redis']=_[_0x4ec6('0x7')](config['redis'],{'host':_0x4ec6('0x8'),'port':0x18eb});var io=require(_0x4ec6('0x9'))(new Redis(config[_0x4ec6('0xa')]));var Sequence=function(){};Sequence[_0x4ec6('0xb')]['enqueue']=function(_0x431aac){this['tail']=this[_0x4ec6('0xc')]?this['tail'][_0x4ec6('0xd')](_0x431aac):_0x431aac();};function VoiceQueueReport(_0x377c37){this['sequence']=new Sequence();this[_0x4ec6('0xe')]={};this[_0x4ec6('0xf')]=_0x377c37;this['agents']=_0x377c37[_0x4ec6('0x10')];this['channels']=_0x377c37[_0x4ec6('0x11')];this[_0x4ec6('0x12')]=_0x377c37['voiceQueues'];this[_0x4ec6('0x13')]=_0x377c37[_0x4ec6('0x13')];this[_0x4ec6('0x14')]=initializeSummary();this[_0x4ec6('0x15')]={};ami['on'](_0x4ec6('0x16'),this[_0x4ec6('0x17')][_0x4ec6('0x18')](this));ami['on'](_0x4ec6('0x19'),this[_0x4ec6('0x1a')][_0x4ec6('0x18')](this));ami['on'](_0x4ec6('0x1b'),this[_0x4ec6('0x1c')][_0x4ec6('0x18')](this));ami['on'](_0x4ec6('0x1d'),this[_0x4ec6('0x1e')][_0x4ec6('0x18')](this));ami['on']('queuecallerjoin',this[_0x4ec6('0x1f')][_0x4ec6('0x18')](this));ami['on'](_0x4ec6('0x20'),this[_0x4ec6('0x21')]['bind'](this));ami['on']('queuecallerleave',this[_0x4ec6('0x22')][_0x4ec6('0x18')](this));ami['on']('agentcomplete',this[_0x4ec6('0x23')][_0x4ec6('0x18')](this));ami['on'](_0x4ec6('0x24'),this[_0x4ec6('0x25')]['bind'](this));ami['on'](_0x4ec6('0x26'),this[_0x4ec6('0x27')][_0x4ec6('0x18')](this));ami['on'](_0x4ec6('0x28'),this[_0x4ec6('0x29')][_0x4ec6('0x18')](this));ami['on'](_0x4ec6('0x2a'),this[_0x4ec6('0x2b')][_0x4ec6('0x18')](this));ami['on'](_0x4ec6('0x2c'),this[_0x4ec6('0x2d')]['bind'](this));ami['on']('musiconholdstop',this[_0x4ec6('0x2e')][_0x4ec6('0x18')](this));ami['on'](_0x4ec6('0x2f'),this[_0x4ec6('0x30')]['bind'](this));ami['on'](_0x4ec6('0x31'),this['syncBlindTransfer']['bind'](this));this[_0x4ec6('0x32')]();this[_0x4ec6('0x33')]();}function clearChannels(_0x363699){if(!_['isEmpty'](_0x363699)){for(var _0x2ca3e6 in _0x363699){if(_0x363699[_0x4ec6('0x34')](_0x2ca3e6)){delete _0x363699[_0x2ca3e6];}}}}function clearCampaigns(_0x1114c9){if(!_[_0x4ec6('0x35')](_0x1114c9)){for(var _0x267832 in _0x1114c9){if(_0x1114c9[_0x4ec6('0x34')](_0x267832)){_0x1114c9[_0x267832][_0x4ec6('0x36')]=0x0;}}}}function clearVoiceQueues(_0xafa317){if(!_[_0x4ec6('0x35')](_0xafa317)){for(var _0x31c0b5 in _0xafa317){if(_0xafa317[_0x4ec6('0x34')](_0x31c0b5)){_0xafa317[_0x31c0b5]['originated']=0x0;_0xafa317[_0x31c0b5]['talking']=0x0;_0xafa317[_0x31c0b5]['pTalking']=0x0;_0xafa317[_0x31c0b5][_0x4ec6('0x37')]=0x0;_0xafa317[_0x31c0b5][_0x4ec6('0x38')]=!![];}}}}function clearAgentBooked(_0x28b80e){if(!_[_0x4ec6('0x35')](_0x28b80e)){for(var _0x21b20d in _0x28b80e){if(_0x28b80e[_0x4ec6('0x34')](_0x21b20d)){_0x28b80e[_0x21b20d][_0x4ec6('0x39')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x15d4b9){return _0x15d4b9['queuecallerexit']||_0x15d4b9['queuecallerabandon']||_0x15d4b9[_0x4ec6('0x3a')];}VoiceQueueReport[_0x4ec6('0xb')][_0x4ec6('0x3b')]=function(){var _0x3488b3=this;for(var _0x5a0393 in this[_0x4ec6('0x3c')]){if(this['channels'][_0x4ec6('0x34')](_0x5a0393)&&!this[_0x4ec6('0x3c')][_0x5a0393][_0x4ec6('0x3d')]){this[_0x4ec6('0x3e')][_0x4ec6('0x3f')](function(){if(!_[_0x4ec6('0x40')](_0x3488b3[_0x4ec6('0x3c')][_0x5a0393])){return ami[_0x4ec6('0x41')]({'action':_0x4ec6('0x42'),'channel':_0x3488b3[_0x4ec6('0x3c')][_0x5a0393][_0x4ec6('0x43')]})['catch'](function(_0x23a73b){if(_0x23a73b['message']===_0x4ec6('0x44')){setTimeout(function(){if(_0x3488b3[_0x4ec6('0x3c')][_0x5a0393]){delete _0x3488b3[_0x4ec6('0x3c')][_0x5a0393];logger['error']('[%s][voiceQueueReport][checkChannel]',_0x5a0393,util[_0x4ec6('0x45')](_0x23a73b,{'showHidden':![],'depth':null}));}if(_0x3488b3[_0x4ec6('0xe')][_0x5a0393]){delete _0x3488b3[_0x4ec6('0xe')][_0x5a0393];logger[_0x4ec6('0x46')](_0x4ec6('0x47'),_0x5a0393,util[_0x4ec6('0x45')](_0x23a73b,{'showHidden':![],'depth':null}));}if(_0x3488b3[_0x4ec6('0x15')][_0x5a0393]){delete _0x3488b3[_0x4ec6('0x15')][_0x5a0393];logger[_0x4ec6('0x46')]('[%s][voiceQueueReport][checkVariables]',_0x5a0393,util[_0x4ec6('0x45')](_0x23a73b,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x4ec6('0xb')]['syncFullyBooted']=function(){logger[_0x4ec6('0x46')](_0x4ec6('0x48'));clearChannels(this[_0x4ec6('0x3c')]);this[_0x4ec6('0x49')](this[_0x4ec6('0xe')]);clearAgentBooked(this[_0x4ec6('0x10')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0x4ec6('0x13')]);this['summary']=initializeSummary();};VoiceQueueReport[_0x4ec6('0xb')][_0x4ec6('0x49')]=function(_0x15e554){var _0x28193f=this;if(!_['isEmpty'](_0x15e554)){for(var _0x10f2ef in _0x15e554){if(_0x15e554[_0x4ec6('0x34')](_0x10f2ef)){_0x28193f[_0x4ec6('0x4a')](_0x15e554[_0x10f2ef],_0x4ec6('0x4b'));delete _0x15e554[_0x10f2ef];}}}};VoiceQueueReport[_0x4ec6('0xb')]['emit']=function(_0x3bc5c0,_0x2e8b17,_0xaa4658){io['to'](_0x3bc5c0)[_0x4ec6('0x4c')](_0x2e8b17,_0xaa4658);};VoiceQueueReport['prototype']['emitVoiceQueueChannelSave']=function(_0x26b548,_0x344581){logger[_0x4ec6('0x4d')](_0x4ec6('0x4e')+_0x344581+_0x4ec6('0x4f'),_0x26b548[_0x4ec6('0x50')],util[_0x4ec6('0x45')](_0x26b548,{'showHidden':![],'depth':null}));this[_0x4ec6('0x4c')](util[_0x4ec6('0x51')]('voice:queue:%s',_0x26b548[_0x4ec6('0x52')]),_0x4ec6('0x53'),_0x26b548);io[_0x4ec6('0x4c')](_0x4ec6('0x54'),_0x26b548);};VoiceQueueReport[_0x4ec6('0xb')]['emitVoiceQueueChannelRemove']=function(_0x112fe0,_0x581231){logger[_0x4ec6('0x4d')](_0x4ec6('0x4e')+_0x581231+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x112fe0[_0x4ec6('0x50')],util[_0x4ec6('0x45')](_0x112fe0,{'showHidden':![],'depth':null}));if(_0x112fe0['queuecallerexitreason']===_0x4ec6('0x55')){return;}this[_0x4ec6('0x4c')](util[_0x4ec6('0x51')]('voice:queue:%s',_0x112fe0[_0x4ec6('0x52')]),_0x4ec6('0x56'),_0x112fe0);io[_0x4ec6('0x4c')]('voice_queue_presence:remove',_0x112fe0);};VoiceQueueReport[_0x4ec6('0xb')]['emitInboundVoiceQueueSummary']=function(_0x2bee4e){if(_0x2bee4e['type']===_0x4ec6('0x57')){logger[_0x4ec6('0x4d')](_0x4ec6('0x58'),util['inspect'](_0x2bee4e,{'showHidden':![],'depth':null}));this['emit'](util[_0x4ec6('0x51')]('voice:queue:%s',_0x2bee4e[_0x4ec6('0x59')]),_0x4ec6('0x5a'),_0x2bee4e);}};VoiceQueueReport[_0x4ec6('0xb')]['isNotNull']=function(_0x36f216){return _0x36f216!==null&&!_[_0x4ec6('0x5b')](_0x36f216);};VoiceQueueReport['prototype'][_0x4ec6('0x33')]=function(){var _0x3b4a9a=this;setInterval(function(){_0x3b4a9a[_0x4ec6('0x3b')]();ami[_0x4ec6('0x41')]({'action':_0x4ec6('0x5c')})[_0x4ec6('0x5d')](function(_0x4c4b2b){logger[_0x4ec6('0x46')](_0x4ec6('0x5e'),util[_0x4ec6('0x45')](_0x4c4b2b,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x4ec6('0xb')][_0x4ec6('0x32')]=function(){var _0x1381a0=this;setInterval(function(){if(!_0x1381a0[_0x4ec6('0x14')][_0x4ec6('0x5f')]){return ami[_0x4ec6('0x41')]({'action':_0x4ec6('0x16')})[_0x4ec6('0x60')](function(_0x5111d6){_0x1381a0[_0x4ec6('0x14')]['id']=_0x5111d6[_0x4ec6('0x61')];_0x1381a0[_0x4ec6('0x14')][_0x4ec6('0x5f')]=!![];_0x1381a0[_0x4ec6('0x14')][_0x4ec6('0x62')][_0x5111d6[_0x4ec6('0x61')]]={};})[_0x4ec6('0x5d')](function(_0x381f93){logger['error'](_0x4ec6('0x63'),util['inspect'](_0x381f93,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x4ec6('0xb')]['createQueueSummaryReport']=function(_0x2dd6ff,_0xe13b7){var _0xb28962;if(this[_0x4ec6('0x14')]&&this[_0x4ec6('0x14')][_0x4ec6('0x5c')]&&this[_0x4ec6('0x14')]['queues'][_0x2dd6ff[_0x4ec6('0x59')]]){_0xb28962=this[_0x4ec6('0x14')][_0x4ec6('0x5c')][_0x2dd6ff[_0x4ec6('0x59')]][_0x4ec6('0x64')];}var _0x5e1883=new VoiceQueueSummary(_0x2dd6ff);return _0x5e1883[_0x4ec6('0x65')](_0xe13b7[_0x4ec6('0x10')],this[_0x4ec6('0x10')],_0xb28962,this[_0x4ec6('0xf')][_0x4ec6('0x3c')]);};VoiceQueueReport[_0x4ec6('0xb')][_0x4ec6('0x66')]=function(_0x3ca5d6,_0x5c8c87){var _0x46b477=this[_0x4ec6('0x67')](_0x3ca5d6,_0x5c8c87);var _0x3b488b=![];_0x3b488b=_0x46b477[_0x4ec6('0x68')](_0x3ca5d6);if(_0x3b488b){Object[_0x4ec6('0x69')](_0x3ca5d6,_0x46b477);this[_0x4ec6('0xf')][_0x4ec6('0x12')][_0x3ca5d6[_0x4ec6('0x59')]]=_0x3ca5d6;this['emitInboundVoiceQueueSummary'](_0x46b477);}};VoiceQueueReport[_0x4ec6('0xb')][_0x4ec6('0x1e')]=function(_0x3e7eb7){var _0x333f4d=null;var _0x202a4b=this['summary']['id'];if(this[_0x4ec6('0x14')][_0x4ec6('0x62')][_0x202a4b]){_0x333f4d=this['summary'][_0x4ec6('0x62')][_0x202a4b][_0x3e7eb7[_0x4ec6('0x61')]];}if(!_0x333f4d){this['summary']=initializeSummary();return;}var _0x478ec7=this['voiceQueues'][_0x333f4d[_0x4ec6('0x52')]];if(_0x478ec7[_0x4ec6('0x6a')]===_0x4ec6('0x57')){this[_0x4ec6('0x66')](_0x478ec7,_0x333f4d);}else if(_0x478ec7[_0x4ec6('0x6a')]===_0x4ec6('0x6b')){var _0x209663=this[_0x4ec6('0x67')](_0x478ec7,_0x333f4d);ami[_0x4ec6('0x4c')]('custom:queuesummary',_0x209663);}this[_0x4ec6('0x14')]['statusRequests']-=0x1;var _0x2b5d3a=this['summary'][_0x4ec6('0x6c')]>0x0?!![]:![];if(!_0x2b5d3a){return this[_0x4ec6('0x1a')](this[_0x4ec6('0x14')][_0x4ec6('0x6d')]);}};VoiceQueueReport[_0x4ec6('0xb')][_0x4ec6('0x1c')]=function(_0x243d8e){var _0x14c04c=this[_0x4ec6('0x14')]['id'];if(this[_0x4ec6('0x14')][_0x4ec6('0x62')][_0x14c04c]&&this['summary'][_0x4ec6('0x62')][_0x14c04c][_0x243d8e[_0x4ec6('0x61')]]){this[_0x4ec6('0x14')][_0x4ec6('0x62')][_0x14c04c][_0x243d8e[_0x4ec6('0x61')]][_0x4ec6('0x10')][_0x4ec6('0x6e')](_0x243d8e);}};VoiceQueueReport[_0x4ec6('0xb')][_0x4ec6('0x17')]=function(_0x35907a){var _0x5cb80f=this;try{if(this['isNotNull'](_0x35907a)&&this['isNotNull'](_0x35907a['queue'])){logger[_0x4ec6('0x4d')](_0x4ec6('0x6f'),util['inspect'](_0x35907a,{'showHidden':![],'depth':null}));var _0x4201e2=this[_0x4ec6('0x12')][_0x35907a[_0x4ec6('0x52')]];if(_0x4201e2){logger['debug']('[voiceQueueReport][queuesummary]\x20name:%s',_0x4201e2[_0x4ec6('0x59')]);this[_0x4ec6('0x14')][_0x4ec6('0x5c')][_0x4201e2[_0x4ec6('0x59')]]={'summaryEvent':_0x35907a};this[_0x4ec6('0x14')][_0x4ec6('0x6c')]+=0x1;return ami[_0x4ec6('0x41')]({'action':_0x4ec6('0x62'),'queue':_0x4201e2[_0x4ec6('0x59')]})[_0x4ec6('0x60')](function(_0x4f34ce){if(!_0x5cb80f[_0x4ec6('0x14')][_0x4ec6('0x62')][_0x35907a[_0x4ec6('0x61')]]){_0x5cb80f[_0x4ec6('0x14')][_0x4ec6('0x62')][_0x35907a[_0x4ec6('0x61')]]={};}_0x5cb80f[_0x4ec6('0x14')]['queuestatus'][_0x35907a[_0x4ec6('0x61')]][_0x4f34ce['actionid']]={'queue':_0x4201e2[_0x4ec6('0x59')],'agents':[]};})[_0x4ec6('0x5d')](function(_0x2a4fb2){throw _0x2a4fb2;});}}}catch(_0x17d812){logger[_0x4ec6('0x46')](_0x4ec6('0x63'),util[_0x4ec6('0x45')](_0x17d812,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4ec6('0x1a')]=function(_0x171406){if(this[_0x4ec6('0x14')]['statusRequests']>0x0){this[_0x4ec6('0x14')][_0x4ec6('0x6d')]=_0x171406;return;}logger[_0x4ec6('0x4d')](_0x4ec6('0x70'),util['inspect'](_0x171406,{'showHidden':![],'depth':null}));this[_0x4ec6('0x14')]=initializeSummary();ami['emit'](_0x4ec6('0x71'),{});};VoiceQueueReport[_0x4ec6('0xb')][_0x4ec6('0x1f')]=function(_0x5c180b){try{if(this[_0x4ec6('0x72')](_0x5c180b)){logger[_0x4ec6('0x4d')](_0x4ec6('0x73'),_0x5c180b[_0x4ec6('0x50')],util[_0x4ec6('0x45')](_0x5c180b,{'showHidden':![],'depth':null}));if(_[_0x4ec6('0x5b')](this[_0x4ec6('0xe')][_0x5c180b[_0x4ec6('0x50')]])){this[_0x4ec6('0xe')][_0x5c180b[_0x4ec6('0x50')]]=[];}if(_[_0x4ec6('0x5b')](this['channels'][_0x5c180b[_0x4ec6('0x50')]])){this[_0x4ec6('0x3c')][_0x5c180b['uniqueid']]={};}var _0x278a27=new QueueReport();_0x278a27[_0x4ec6('0x52')]=_0x5c180b[_0x4ec6('0x52')];_0x278a27[_0x4ec6('0x6a')]=this['voiceQueues'][_0x278a27['queue']]&&this[_0x4ec6('0x12')][_0x278a27[_0x4ec6('0x52')]][_0x4ec6('0x6a')]?this['voiceQueues'][_0x278a27[_0x4ec6('0x52')]]['type']||_0x4ec6('0x57'):_0x4ec6('0x57');_0x278a27[_0x4ec6('0x74')]=moment()[_0x4ec6('0x51')](_0x4ec6('0x75'));_0x278a27[_0x4ec6('0x76')]=_0x5c180b[_0x4ec6('0x76')];_0x278a27['count']=_0x5c180b[_0x4ec6('0x77')];_0x278a27[_0x4ec6('0x50')]=_0x5c180b[_0x4ec6('0x50')];logger[_0x4ec6('0x78')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x278a27['queue'],_0x278a27[_0x4ec6('0x6a')]);Object[_0x4ec6('0x69')](_0x278a27,_[_0x4ec6('0x79')](_0x5c180b,_[_0x4ec6('0x7a')](_0x278a27)));this[_0x4ec6('0xe')][_0x5c180b['uniqueid']][_0x4ec6('0x6e')](_0x278a27);this[_0x4ec6('0x3c')][_0x5c180b[_0x4ec6('0x50')]]=_0x278a27;this[_0x4ec6('0x7b')](_0x278a27,_0x4ec6('0x7c'));}}catch(_0x576329){logger['error'](_0x4ec6('0x73'),_0x5c180b['uniqueid'],util[_0x4ec6('0x45')](_0x576329,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4ec6('0xb')]['syncQueueCallerAbandon']=function(_0x16fa40){try{if(this['isNotNull'](_0x16fa40)){logger[_0x4ec6('0x4d')](_0x4ec6('0x7d'),_0x16fa40[_0x4ec6('0x50')],util[_0x4ec6('0x45')](_0x16fa40,{'showHidden':![],'depth':null}));if(this[_0x4ec6('0xe')][_0x16fa40[_0x4ec6('0x50')]]){var _0x3442f8=_[_0x4ec6('0x7e')](this[_0x4ec6('0xe')][_0x16fa40[_0x4ec6('0x50')]]);_0x3442f8[_0x4ec6('0x3a')]=![];_0x3442f8[_0x4ec6('0x7f')]=null;_0x3442f8[_0x4ec6('0x80')]=_0x16fa40['holdtime'];_0x3442f8['originalposition']=_0x16fa40['originalposition'];_0x3442f8['queuecallerabandon']=!![];_0x3442f8[_0x4ec6('0x81')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3442f8['queuecallerexitreason']='ABANDONED';_0x3442f8[_0x4ec6('0x82')]=null;logger[_0x4ec6('0x78')](_0x4ec6('0x83'),_0x3442f8[_0x4ec6('0x52')],_0x3442f8[_0x4ec6('0x6a')]);this[_0x4ec6('0x3c')][_0x16fa40['uniqueid']]=_0x3442f8;this[_0x4ec6('0x4a')](_0x3442f8,_0x4ec6('0x20'));}}}catch(_0xde137a){logger[_0x4ec6('0x46')]('[%s][voiceQueueReport][queuecallerabandon]',_0x16fa40[_0x4ec6('0x50')],util[_0x4ec6('0x45')](_0xde137a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4ec6('0x22')]=function(_0x32f833){try{if(this[_0x4ec6('0x72')](_0x32f833)){logger['debug'](_0x4ec6('0x84'),_0x32f833[_0x4ec6('0x50')],util['inspect'](_0x32f833,{'showHidden':![],'depth':null}));if(this[_0x4ec6('0xe')][_0x32f833['uniqueid']]){var _0x3a8743=_[_0x4ec6('0x7e')](this[_0x4ec6('0xe')][_0x32f833[_0x4ec6('0x50')]]);_0x3a8743[_0x4ec6('0x85')]=moment()[_0x4ec6('0x51')](_0x4ec6('0x75'));_0x3a8743[_0x4ec6('0x86')]=_0x32f833[_0x4ec6('0x86')];_0x3a8743['connectedlinename']=_0x32f833[_0x4ec6('0x87')];logger[_0x4ec6('0x78')](_0x4ec6('0x88'),_0x3a8743[_0x4ec6('0x52')],_0x3a8743[_0x4ec6('0x6a')],_0x32f833[_0x4ec6('0x86')],_0x32f833[_0x4ec6('0x87')]);this[_0x4ec6('0x3c')][_0x32f833[_0x4ec6('0x50')]]=_0x3a8743;this[_0x4ec6('0x7b')](_0x3a8743,_0x4ec6('0x89'));}}}catch(_0x583a0e){logger[_0x4ec6('0x46')](_0x4ec6('0x84'),_0x32f833[_0x4ec6('0x50')],util[_0x4ec6('0x45')](_0x583a0e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4ec6('0xb')][_0x4ec6('0x25')]=function(_0x41ca62){try{if(this['isNotNull'](_0x41ca62)){logger[_0x4ec6('0x4d')](_0x4ec6('0x8a'),_0x41ca62[_0x4ec6('0x50')],util[_0x4ec6('0x45')](_0x41ca62,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x41ca62[_0x4ec6('0x50')]]){var _0x32e4f4=_[_0x4ec6('0x7e')](this[_0x4ec6('0xe')][_0x41ca62[_0x4ec6('0x50')]]);_0x32e4f4[_0x4ec6('0x3a')]=!![];_0x32e4f4['queuecallerexitreason']=_0x4ec6('0x8b');logger['info'](_0x4ec6('0x8c'),_0x32e4f4[_0x4ec6('0x52')],_0x32e4f4[_0x4ec6('0x6a')]);}}}catch(_0x2448ce){logger[_0x4ec6('0x46')](_0x4ec6('0x8a'),_0x41ca62[_0x4ec6('0x50')],util['inspect'](_0x2448ce,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4ec6('0xb')][_0x4ec6('0x23')]=function(_0x536b03){try{if(this[_0x4ec6('0x72')](_0x536b03)){logger[_0x4ec6('0x4d')](_0x4ec6('0x8d'),_0x536b03['uniqueid'],util['inspect'](_0x536b03,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x536b03[_0x4ec6('0x50')]]){var _0x40a06a=_['last'](this['queueReports'][_0x536b03[_0x4ec6('0x50')]]);_0x40a06a[_0x4ec6('0x20')]=![];_0x40a06a['queuecallerabandonAt']=null;_0x40a06a[_0x4ec6('0x8e')]=!![];_0x40a06a['lastAssignedTo']=_0x536b03['membername'];_0x40a06a[_0x4ec6('0x80')]=_0x536b03[_0x4ec6('0x80')];_0x40a06a[_0x4ec6('0x3a')]=!![];_0x40a06a[_0x4ec6('0x8f')]=![];_0x40a06a[_0x4ec6('0x90')]=null;if(!_0x40a06a[_0x4ec6('0x91')]){if(_0x536b03[_0x4ec6('0x92')]==_0x4ec6('0x91')){_0x40a06a['queuecallerexitreason']='COMPLETED';logger[_0x4ec6('0x78')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x40a06a[_0x4ec6('0x52')],_0x40a06a[_0x4ec6('0x6a')]);}else{if(_[_0x4ec6('0x93')](_0x536b03['channel']['toLowerCase'](),_0x4ec6('0x94'))){if(this[_0x4ec6('0xe')][_0x536b03[_0x4ec6('0x95')]]){var _0x1cf8a=_[_0x4ec6('0x7e')](this['queueReports'][_0x536b03[_0x4ec6('0x95')]]);_0x1cf8a[_0x4ec6('0x3a')]=![];_0x1cf8a[_0x4ec6('0x8f')]=!![];_0x1cf8a[_0x4ec6('0x90')]=moment(_0x40a06a[_0x4ec6('0x74')])[_0x4ec6('0x96')](_0x536b03[_0x4ec6('0x80')],'seconds')[_0x4ec6('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x1cf8a[_0x4ec6('0x97')]=_0x4ec6('0x98');_0x1cf8a['transfer']=!![];_0x1cf8a[_0x4ec6('0x99')]='FORWARD';_0x1cf8a[_0x4ec6('0x9a')]=_0x536b03['destexten'];_0x1cf8a[_0x4ec6('0x9b')]=_0x536b03['uniqueid'];logger[_0x4ec6('0x78')](_0x4ec6('0x9c'),_0x1cf8a[_0x4ec6('0x52')],_0x1cf8a[_0x4ec6('0x6a')]);var _0x29296b=this[_0x4ec6('0xe')][_0x536b03[_0x4ec6('0x95')]];this['queueReports'][_0x536b03['linkedid']]=this[_0x4ec6('0xe')][_0x536b03['uniqueid']];this[_0x4ec6('0xe')][_0x536b03[_0x4ec6('0x50')]]=_0x29296b;}}else{_0x40a06a[_0x4ec6('0x97')]=_0x4ec6('0x9d')+_0x536b03[_0x4ec6('0x92')][_0x4ec6('0x9e')]();logger['info'](_0x4ec6('0x9f'),_0x40a06a[_0x4ec6('0x52')],_0x40a06a[_0x4ec6('0x6a')],_0x40a06a['queuecallerexitreason']);}}}this[_0x4ec6('0x3c')][_0x536b03[_0x4ec6('0x50')]]=_0x40a06a;}}}catch(_0x5353a9){logger['error'](_0x4ec6('0x8d'),_0x536b03[_0x4ec6('0x50')],util[_0x4ec6('0x45')](_0x5353a9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4ec6('0xb')]['syncVarSet']=function(_0x3746a4){try{if(this['isNotNull'](_0x3746a4)){logger[_0x4ec6('0x4d')](_0x4ec6('0xa0'),_0x3746a4['uniqueid'],util[_0x4ec6('0x45')](_0x3746a4,{'showHidden':![],'depth':null}));this[_0x4ec6('0xa1')](_0x3746a4[_0x4ec6('0x50')],_['keys'](_0x3746a4['variable'])[0x0],_0x3746a4['value']);if(this[_0x4ec6('0xe')][_0x3746a4[_0x4ec6('0x50')]]){var _0x471f57=_[_0x4ec6('0x7e')](this[_0x4ec6('0xe')][_0x3746a4[_0x4ec6('0x50')]]);if(_0x471f57){if(this[_0x4ec6('0x72')](_0x3746a4['variable'])&&this['isNotNull'](_0x3746a4[_0x4ec6('0xa2')][_0x4ec6('0x62')])){switch(_0x3746a4[_0x4ec6('0xa3')]){case'CONTINUE':_0x471f57[_0x4ec6('0x8f')]=![];_0x471f57[_0x4ec6('0x90')]=null;break;case _0x4ec6('0xa4'):_0x471f57[_0x4ec6('0xa5')]=_0x4ec6('0xa6');_0x471f57[_0x4ec6('0x8f')]=!![];_0x471f57[_0x4ec6('0x90')]=moment()['format'](_0x4ec6('0x75'));_0x471f57[_0x4ec6('0x85')]=moment()[_0x4ec6('0x51')](_0x4ec6('0x75'));logger[_0x4ec6('0x4d')](_0x4ec6('0xa7'),_0x3746a4[_0x4ec6('0x50')],util[_0x4ec6('0x45')](_0x471f57,{'showHidden':![],'depth':null}));ami[_0x4ec6('0x4c')](_0x4ec6('0xa8'),_0x471f57);break;default:_0x471f57[_0x4ec6('0x8f')]=!![];_0x471f57[_0x4ec6('0x90')]=moment()[_0x4ec6('0x51')](_0x4ec6('0x75'));_0x471f57[_0x4ec6('0x85')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x471f57[_0x4ec6('0x20')]=![];_0x471f57[_0x4ec6('0x81')]=null;_0x471f57['queuecallerexitreason']=_0x3746a4[_0x4ec6('0xa3')];this['channels'][_0x3746a4[_0x4ec6('0x50')]]=_0x471f57;this[_0x4ec6('0x4a')](_0x471f57,_0x4ec6('0x26'));}else if(this[_0x4ec6('0x72')](_0x3746a4['variable'])&&this[_0x4ec6('0x72')](_0x3746a4[_0x4ec6('0xa2')]['queueposition'])){if(!_0x471f57['queuecallerabandon']){_0x471f57['queuecallerexit']=!![];_0x471f57['queuecallerexitAt']=moment()['format'](_0x4ec6('0x75'));_0x471f57[_0x4ec6('0x97')]='EXITWITHKEY';_0x471f57[_0x4ec6('0x85')]=moment()[_0x4ec6('0x51')](_0x4ec6('0x75'));this['channels'][_0x3746a4[_0x4ec6('0x50')]]=_0x471f57;}}logger[_0x4ec6('0x78')](_0x4ec6('0xa9'),_0x3746a4[_0x4ec6('0x50')],_0x471f57[_0x4ec6('0x52')],_0x471f57[_0x4ec6('0x6a')],_[_0x4ec6('0x7a')](_0x3746a4[_0x4ec6('0xa2')])[0x0],_0x3746a4[_0x4ec6('0xa3')]);_0x471f57['variables']=this[_0x4ec6('0x15')][_0x3746a4['uniqueid']];}}}}catch(_0x100cee){logger[_0x4ec6('0x46')](_0x4ec6('0xa0'),_0x3746a4[_0x4ec6('0x50')],util[_0x4ec6('0x45')](_0x100cee,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4ec6('0xb')][_0x4ec6('0xa1')]=function(_0x1fe505,_0x5028c9,_0x17d555){var _0x1eb078=['rtpaudioqos',_0x4ec6('0xaa'),'rtpaudioqosjitter',_0x4ec6('0xab'),_0x4ec6('0xac'),_0x4ec6('0xad'),_0x4ec6('0xae'),_0x4ec6('0xaf'),_0x4ec6('0xb0'),'sipuri',_0x4ec6('0xb1'),'bridgepvtcallid',_0x4ec6('0xb2'),_0x4ec6('0xb3'),'memberinterface',_0x4ec6('0xb4'),'membername',_0x4ec6('0xb5'),'memberrealtime'];if(!_[_0x4ec6('0x40')](_0x5028c9)&&!_['includes'](_0x1eb078,_0x5028c9)){if(_[_0x4ec6('0x5b')](this['variables'][_0x1fe505])){this['variables'][_0x1fe505]={};}this['variables'][_0x1fe505][_0x5028c9]=_0x17d555;}};VoiceQueueReport[_0x4ec6('0xb')]['handleHangup']=function(_0x47e87d,_0x3c36c6,_0x463d7a){try{var _0x47d7d7={};if(this['queueReports'][_0x47e87d]){for(var _0xd93d71=0x0;_0xd93d71{delete this['channels'][_0x1a493b];},_0x1dee30);}};module['exports']=VoiceQueueReport; \ No newline at end of file +var _0xe5e1=['emit','emitVoiceQueueChannelSave',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','voice:queue:%s','queue','voice_queue_channel:save','voice_queue_presence:save','debug','[%s][voiceQueueReport][','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','name','voice_queue:save','isNotNull','isUndefined','catch','[voiceQueueReport][queues]','then','actionid','isRunning','queuestatus','createQueueSummaryReport','queues','summaryEvent','createReport','handleInboundQueueSummaryReport','compareToInboundQueue','assign','syncQueueStatusComplete','inbound','outbound','custom:queuesummary','statusRequests','completeEvent','syncQueueMember','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','queuecallerjoin','[%s][voiceQueueReport][queuecallerabandon]','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','info','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','last','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','queuecallerexitAt','reason','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','local/','linkedid','queuecallercomplete','add','seconds','transfertype','transferexten','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','keys','variable','value','CONTINUE','TIMEOUT','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberpenalty','memberrealtime','isNil','handleHangup','length','diff','total','answered','sumBillable','milliseconds','unmanaged','lastevent','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','sumHoldTime','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][hangup]','cause-txt','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][blindtransfer]','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','transfererchannel','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohstarttime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','toLowerCase','set','applicationdata','appdata','startsWith','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','application','split','match','[%s][voiceQueueReport][newexten]','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','queueReports','realtime','agents','channels','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuemember','queuestatuscomplete','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','syncAgentConnect','varset','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','queuecallerexit','clearZombieChannels','Action','status','channel','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','voiceQueues','emitVoiceQueueChannelRemove','clearqueuereport'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xe5e1,0xaa));var _0x1e5e=function(_0x21d76f,_0x4cb87a){_0x21d76f=_0x21d76f-0x0;var _0x308322=_0xe5e1[_0x21d76f];return _0x308322;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x1e5e('0x0'));var Redis=require(_0x1e5e('0x1'));var config=require(_0x1e5e('0x2'));var logger=require(_0x1e5e('0x3'))(_0x1e5e('0x4'));var ami=require(_0x1e5e('0x5'));var QueueReport=require(_0x1e5e('0x6'));var VoiceQueueSummary=require(_0x1e5e('0x7'));config['redis']=_[_0x1e5e('0x8')](config[_0x1e5e('0x9')],{'host':_0x1e5e('0xa'),'port':0x18eb});var io=require(_0x1e5e('0xb'))(new Redis(config[_0x1e5e('0x9')]));var Sequence=function(){};Sequence[_0x1e5e('0xc')][_0x1e5e('0xd')]=function(_0x3575da){this['tail']=this[_0x1e5e('0xe')]?this[_0x1e5e('0xe')]['finally'](_0x3575da):_0x3575da();};function VoiceQueueReport(_0x5b9b1b){this[_0x1e5e('0xf')]=new Sequence();this[_0x1e5e('0x10')]={};this[_0x1e5e('0x11')]=_0x5b9b1b;this[_0x1e5e('0x12')]=_0x5b9b1b[_0x1e5e('0x12')];this[_0x1e5e('0x13')]=_0x5b9b1b['queueChannels'];this['voiceQueues']=_0x5b9b1b['voiceQueues'];this[_0x1e5e('0x14')]=_0x5b9b1b[_0x1e5e('0x14')];this[_0x1e5e('0x15')]=initializeSummary();this[_0x1e5e('0x16')]={};ami['on'](_0x1e5e('0x17'),this[_0x1e5e('0x18')][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x1a'),this[_0x1e5e('0x1b')][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x1c'),this['syncQueueMember']['bind'](this));ami['on'](_0x1e5e('0x1d'),this['syncQueueStatusComplete'][_0x1e5e('0x19')](this));ami['on']('queuecallerjoin',this[_0x1e5e('0x1e')][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x1f'),this[_0x1e5e('0x20')][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x21'),this[_0x1e5e('0x22')]['bind'](this));ami['on']('agentcomplete',this[_0x1e5e('0x23')][_0x1e5e('0x19')](this));ami['on']('agentconnect',this[_0x1e5e('0x24')]['bind'](this));ami['on'](_0x1e5e('0x25'),this['syncVarSet'][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x26'),this[_0x1e5e('0x27')][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x28'),this[_0x1e5e('0x29')][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x2a'),this[_0x1e5e('0x2b')][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x2c'),this['syncMusicOnHoldStop'][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x2d'),this[_0x1e5e('0x2e')][_0x1e5e('0x19')](this));ami['on'](_0x1e5e('0x2f'),this['syncBlindTransfer'][_0x1e5e('0x19')](this));this[_0x1e5e('0x30')]();this[_0x1e5e('0x31')]();}function clearChannels(_0x20e9d9){if(!_[_0x1e5e('0x32')](_0x20e9d9)){for(var _0x1aec8d in _0x20e9d9){if(_0x20e9d9[_0x1e5e('0x33')](_0x1aec8d)){delete _0x20e9d9[_0x1aec8d];}}}}function clearCampaigns(_0x5c9c8d){if(!_[_0x1e5e('0x32')](_0x5c9c8d)){for(var _0x4a924f in _0x5c9c8d){if(_0x5c9c8d[_0x1e5e('0x33')](_0x4a924f)){_0x5c9c8d[_0x4a924f][_0x1e5e('0x34')]=0x0;}}}}function clearVoiceQueues(_0x56f073){if(!_[_0x1e5e('0x32')](_0x56f073)){for(var _0x400b8c in _0x56f073){if(_0x56f073[_0x1e5e('0x33')](_0x400b8c)){_0x56f073[_0x400b8c][_0x1e5e('0x34')]=0x0;_0x56f073[_0x400b8c][_0x1e5e('0x35')]=0x0;_0x56f073[_0x400b8c][_0x1e5e('0x36')]=0x0;_0x56f073[_0x400b8c][_0x1e5e('0x37')]=0x0;_0x56f073[_0x400b8c][_0x1e5e('0x38')]=!![];}}}}function clearAgentBooked(_0x560949){if(!_[_0x1e5e('0x32')](_0x560949)){for(var _0x2a1155 in _0x560949){if(_0x560949['hasOwnProperty'](_0x2a1155)){_0x560949[_0x2a1155]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x40f82f){return _0x40f82f[_0x1e5e('0x39')]||_0x40f82f[_0x1e5e('0x1f')]||_0x40f82f['queuecallercomplete'];}VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x3a')]=function(){var _0x34645e=this;for(var _0x3dfb72 in this['channels']){if(this[_0x1e5e('0x13')][_0x1e5e('0x33')](_0x3dfb72)&&!this[_0x1e5e('0x13')][_0x3dfb72]['switch']){this['sequence'][_0x1e5e('0xd')](function(){if(!_['isNil'](_0x34645e[_0x1e5e('0x13')][_0x3dfb72])){return ami[_0x1e5e('0x3b')]({'action':_0x1e5e('0x3c'),'channel':_0x34645e['channels'][_0x3dfb72][_0x1e5e('0x3d')]})['catch'](function(_0x179111){if(_0x179111['message']===_0x1e5e('0x3e')){setTimeout(function(){if(_0x34645e['channels'][_0x3dfb72]){delete _0x34645e[_0x1e5e('0x13')][_0x3dfb72];logger[_0x1e5e('0x3f')](_0x1e5e('0x40'),_0x3dfb72,util[_0x1e5e('0x41')](_0x179111,{'showHidden':![],'depth':null}));}if(_0x34645e[_0x1e5e('0x10')][_0x3dfb72]){delete _0x34645e['queueReports'][_0x3dfb72];logger[_0x1e5e('0x3f')](_0x1e5e('0x42'),_0x3dfb72,util[_0x1e5e('0x41')](_0x179111,{'showHidden':![],'depth':null}));}if(_0x34645e[_0x1e5e('0x16')][_0x3dfb72]){delete _0x34645e[_0x1e5e('0x16')][_0x3dfb72];logger[_0x1e5e('0x3f')](_0x1e5e('0x43'),_0x3dfb72,util[_0x1e5e('0x41')](_0x179111,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x29')]=function(){logger[_0x1e5e('0x3f')](_0x1e5e('0x44'));clearChannels(this['channels']);this[_0x1e5e('0x45')](this[_0x1e5e('0x10')]);clearAgentBooked(this[_0x1e5e('0x12')]);clearVoiceQueues(this[_0x1e5e('0x46')]);clearCampaigns(this[_0x1e5e('0x14')]);this['summary']=initializeSummary();};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x45')]=function(_0x3f1c85){var _0x8f99d8=this;if(!_[_0x1e5e('0x32')](_0x3f1c85)){for(var _0xf76a6b in _0x3f1c85){if(_0x3f1c85[_0x1e5e('0x33')](_0xf76a6b)){_0x8f99d8[_0x1e5e('0x47')](_0x3f1c85[_0xf76a6b],_0x1e5e('0x48'));delete _0x3f1c85[_0xf76a6b];}}}};VoiceQueueReport['prototype'][_0x1e5e('0x49')]=function(_0x3b9cc3,_0x25a53b,_0x301a49){io['to'](_0x3b9cc3)['emit'](_0x25a53b,_0x301a49);};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x4a')]=function(_0x2ad211,_0xf0fad3){logger['debug']('[%s][voiceQueueReport]['+_0xf0fad3+_0x1e5e('0x4b'),_0x2ad211[_0x1e5e('0x4c')],util[_0x1e5e('0x41')](_0x2ad211,{'showHidden':![],'depth':null}));this[_0x1e5e('0x49')](util['format'](_0x1e5e('0x4d'),_0x2ad211[_0x1e5e('0x4e')]),_0x1e5e('0x4f'),_0x2ad211);io['emit'](_0x1e5e('0x50'),_0x2ad211);};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x47')]=function(_0x446868,_0xfa583){logger[_0x1e5e('0x51')](_0x1e5e('0x52')+_0xfa583+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x446868[_0x1e5e('0x4c')],util[_0x1e5e('0x41')](_0x446868,{'showHidden':![],'depth':null}));if(_0x446868[_0x1e5e('0x53')]===_0x1e5e('0x54')){return;}this[_0x1e5e('0x49')](util['format'](_0x1e5e('0x4d'),_0x446868[_0x1e5e('0x4e')]),_0x1e5e('0x55'),_0x446868);io[_0x1e5e('0x49')](_0x1e5e('0x56'),_0x446868);};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x57')]=function(_0x5dc8dc){if(_0x5dc8dc[_0x1e5e('0x58')]==='inbound'){logger['debug'](_0x1e5e('0x59'),util[_0x1e5e('0x41')](_0x5dc8dc,{'showHidden':![],'depth':null}));this[_0x1e5e('0x49')](util[_0x1e5e('0x5a')]('voice:queue:%s',_0x5dc8dc[_0x1e5e('0x5b')]),_0x1e5e('0x5c'),_0x5dc8dc);}};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x5d')]=function(_0x14c48a){return _0x14c48a!==null&&!_[_0x1e5e('0x5e')](_0x14c48a);};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x31')]=function(){var _0x5c3fd2=this;setInterval(function(){_0x5c3fd2['clearZombieChannels']();ami[_0x1e5e('0x3b')]({'action':'queues'})[_0x1e5e('0x5f')](function(_0x22105b){logger['error'](_0x1e5e('0x60'),util[_0x1e5e('0x41')](_0x22105b,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0x1e5e('0x30')]=function(){var _0x5f1953=this;setInterval(function(){if(!_0x5f1953[_0x1e5e('0x15')]['isRunning']){return ami['Action']({'action':'queuesummary'})[_0x1e5e('0x61')](function(_0x1810e7){_0x5f1953[_0x1e5e('0x15')]['id']=_0x1810e7[_0x1e5e('0x62')];_0x5f1953[_0x1e5e('0x15')][_0x1e5e('0x63')]=!![];_0x5f1953[_0x1e5e('0x15')][_0x1e5e('0x64')][_0x1810e7['actionid']]={};})['catch'](function(_0x2361fc){logger[_0x1e5e('0x3f')]('[voiceQueueReport][queuesummary]',util[_0x1e5e('0x41')](_0x2361fc,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x1e5e('0x65')]=function(_0x5d88b7,_0x26df1d){var _0x4f6870;if(this['summary']&&this['summary'][_0x1e5e('0x66')]&&this[_0x1e5e('0x15')][_0x1e5e('0x66')][_0x5d88b7[_0x1e5e('0x5b')]]){_0x4f6870=this[_0x1e5e('0x15')]['queues'][_0x5d88b7[_0x1e5e('0x5b')]][_0x1e5e('0x67')];}var _0x379913=new VoiceQueueSummary(_0x5d88b7);return _0x379913[_0x1e5e('0x68')](_0x26df1d[_0x1e5e('0x12')],this[_0x1e5e('0x12')],_0x4f6870,this[_0x1e5e('0x11')][_0x1e5e('0x13')]);};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x69')]=function(_0x58f0bc,_0x5e3f46){var _0x14af63=this[_0x1e5e('0x65')](_0x58f0bc,_0x5e3f46);var _0x3aac3b=![];_0x3aac3b=_0x14af63[_0x1e5e('0x6a')](_0x58f0bc);if(_0x3aac3b){Object[_0x1e5e('0x6b')](_0x58f0bc,_0x14af63);this['realtime']['voiceQueues'][_0x58f0bc[_0x1e5e('0x5b')]]=_0x58f0bc;this[_0x1e5e('0x57')](_0x14af63);}};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x6c')]=function(_0x2edbe6){var _0x5acfc1=null;var _0x2ccc13=this[_0x1e5e('0x15')]['id'];if(this['summary'][_0x1e5e('0x64')][_0x2ccc13]){_0x5acfc1=this['summary'][_0x1e5e('0x64')][_0x2ccc13][_0x2edbe6[_0x1e5e('0x62')]];}if(!_0x5acfc1){this['summary']=initializeSummary();return;}var _0x3725a9=this[_0x1e5e('0x46')][_0x5acfc1[_0x1e5e('0x4e')]];if(_0x3725a9[_0x1e5e('0x58')]===_0x1e5e('0x6d')){this[_0x1e5e('0x69')](_0x3725a9,_0x5acfc1);}else if(_0x3725a9[_0x1e5e('0x58')]===_0x1e5e('0x6e')){var _0x2a63ff=this[_0x1e5e('0x65')](_0x3725a9,_0x5acfc1);ami[_0x1e5e('0x49')](_0x1e5e('0x6f'),_0x2a63ff);}this[_0x1e5e('0x15')][_0x1e5e('0x70')]-=0x1;var _0x799a93=this[_0x1e5e('0x15')][_0x1e5e('0x70')]>0x0?!![]:![];if(!_0x799a93){return this[_0x1e5e('0x1b')](this[_0x1e5e('0x15')][_0x1e5e('0x71')]);}};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x72')]=function(_0x2e2dfb){var _0x2a85ad=this['summary']['id'];if(this[_0x1e5e('0x15')]['queuestatus'][_0x2a85ad]&&this[_0x1e5e('0x15')][_0x1e5e('0x64')][_0x2a85ad][_0x2e2dfb[_0x1e5e('0x62')]]){this[_0x1e5e('0x15')][_0x1e5e('0x64')][_0x2a85ad][_0x2e2dfb['actionid']][_0x1e5e('0x12')][_0x1e5e('0x73')](_0x2e2dfb);}};VoiceQueueReport[_0x1e5e('0xc')]['syncQueueSummary']=function(_0x168440){var _0x69e367=this;try{if(this['isNotNull'](_0x168440)&&this[_0x1e5e('0x5d')](_0x168440[_0x1e5e('0x4e')])){logger[_0x1e5e('0x51')](_0x1e5e('0x74'),util[_0x1e5e('0x41')](_0x168440,{'showHidden':![],'depth':null}));var _0x165569=this[_0x1e5e('0x46')][_0x168440[_0x1e5e('0x4e')]];if(_0x165569){logger['debug'](_0x1e5e('0x75'),_0x165569[_0x1e5e('0x5b')]);this[_0x1e5e('0x15')][_0x1e5e('0x66')][_0x165569[_0x1e5e('0x5b')]]={'summaryEvent':_0x168440};this['summary']['statusRequests']+=0x1;return ami['Action']({'action':'queuestatus','queue':_0x165569[_0x1e5e('0x5b')]})[_0x1e5e('0x61')](function(_0x35fc40){if(!_0x69e367['summary']['queuestatus'][_0x168440[_0x1e5e('0x62')]]){_0x69e367[_0x1e5e('0x15')]['queuestatus'][_0x168440[_0x1e5e('0x62')]]={};}_0x69e367['summary']['queuestatus'][_0x168440[_0x1e5e('0x62')]][_0x35fc40[_0x1e5e('0x62')]]={'queue':_0x165569[_0x1e5e('0x5b')],'agents':[]};})[_0x1e5e('0x5f')](function(_0x9d1009){throw _0x9d1009;});}}}catch(_0x435ccd){logger[_0x1e5e('0x3f')]('[voiceQueueReport][queuesummary]',util[_0x1e5e('0x41')](_0x435ccd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x1b')]=function(_0x2408ec){if(this[_0x1e5e('0x15')][_0x1e5e('0x70')]>0x0){this[_0x1e5e('0x15')][_0x1e5e('0x71')]=_0x2408ec;return;}logger['debug'](_0x1e5e('0x76'),util['inspect'](_0x2408ec,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami['emit'](_0x1e5e('0x77'),{});};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x1e')]=function(_0x3310ea){try{if(this[_0x1e5e('0x5d')](_0x3310ea)){logger['debug'](_0x1e5e('0x78'),_0x3310ea[_0x1e5e('0x4c')],util['inspect'](_0x3310ea,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x1e5e('0x10')][_0x3310ea[_0x1e5e('0x4c')]])){this[_0x1e5e('0x10')][_0x3310ea[_0x1e5e('0x4c')]]=[];}if(_[_0x1e5e('0x5e')](this[_0x1e5e('0x13')][_0x3310ea['uniqueid']])){this[_0x1e5e('0x13')][_0x3310ea[_0x1e5e('0x4c')]]={};}var _0x14e83d=new QueueReport();_0x14e83d[_0x1e5e('0x4e')]=_0x3310ea[_0x1e5e('0x4e')];_0x14e83d[_0x1e5e('0x58')]=this[_0x1e5e('0x46')][_0x14e83d[_0x1e5e('0x4e')]]&&this[_0x1e5e('0x46')][_0x14e83d['queue']][_0x1e5e('0x58')]?this[_0x1e5e('0x46')][_0x14e83d[_0x1e5e('0x4e')]][_0x1e5e('0x58')]||_0x1e5e('0x6d'):_0x1e5e('0x6d');_0x14e83d[_0x1e5e('0x79')]=moment()['format'](_0x1e5e('0x7a'));_0x14e83d['position']=_0x3310ea[_0x1e5e('0x7b')];_0x14e83d['count']=_0x3310ea[_0x1e5e('0x7c')];_0x14e83d[_0x1e5e('0x4c')]=_0x3310ea['uniqueid'];logger['info'](_0x1e5e('0x7d'),_0x14e83d[_0x1e5e('0x4e')],_0x14e83d[_0x1e5e('0x58')]);Object['assign'](_0x14e83d,_['pick'](_0x3310ea,_['keys'](_0x14e83d)));this['queueReports'][_0x3310ea[_0x1e5e('0x4c')]][_0x1e5e('0x73')](_0x14e83d);this[_0x1e5e('0x13')][_0x3310ea[_0x1e5e('0x4c')]]=_0x14e83d;this[_0x1e5e('0x4a')](_0x14e83d,_0x1e5e('0x7e'));}}catch(_0x37ec48){logger[_0x1e5e('0x3f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x3310ea[_0x1e5e('0x4c')],util['inspect'](_0x37ec48,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1e5e('0x20')]=function(_0x19fd68){try{if(this[_0x1e5e('0x5d')](_0x19fd68)){logger[_0x1e5e('0x51')](_0x1e5e('0x7f'),_0x19fd68[_0x1e5e('0x4c')],util[_0x1e5e('0x41')](_0x19fd68,{'showHidden':![],'depth':null}));if(this[_0x1e5e('0x10')][_0x19fd68[_0x1e5e('0x4c')]]){var _0x53b03f=_['last'](this[_0x1e5e('0x10')][_0x19fd68[_0x1e5e('0x4c')]]);_0x53b03f['queuecallercomplete']=![];_0x53b03f[_0x1e5e('0x80')]=null;_0x53b03f[_0x1e5e('0x81')]=_0x19fd68['holdtime'];_0x53b03f[_0x1e5e('0x82')]=_0x19fd68[_0x1e5e('0x82')];_0x53b03f['queuecallerabandon']=!![];_0x53b03f[_0x1e5e('0x83')]=moment()[_0x1e5e('0x5a')](_0x1e5e('0x7a'));_0x53b03f[_0x1e5e('0x53')]=_0x1e5e('0x84');_0x53b03f[_0x1e5e('0x85')]=null;logger[_0x1e5e('0x86')](_0x1e5e('0x87'),_0x53b03f['queue'],_0x53b03f[_0x1e5e('0x58')]);this['channels'][_0x19fd68['uniqueid']]=_0x53b03f;this[_0x1e5e('0x47')](_0x53b03f,_0x1e5e('0x1f'));}}}catch(_0x59eb01){logger[_0x1e5e('0x3f')](_0x1e5e('0x7f'),_0x19fd68[_0x1e5e('0x4c')],util[_0x1e5e('0x41')](_0x59eb01,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x2a775f){try{if(this[_0x1e5e('0x5d')](_0x2a775f)){logger[_0x1e5e('0x51')](_0x1e5e('0x88'),_0x2a775f['uniqueid'],util['inspect'](_0x2a775f,{'showHidden':![],'depth':null}));if(this[_0x1e5e('0x10')][_0x2a775f[_0x1e5e('0x4c')]]){var _0x38ea92=_['last'](this[_0x1e5e('0x10')][_0x2a775f[_0x1e5e('0x4c')]]);_0x38ea92[_0x1e5e('0x89')]=moment()[_0x1e5e('0x5a')](_0x1e5e('0x7a'));_0x38ea92['connectedlinenum']=_0x2a775f[_0x1e5e('0x8a')];_0x38ea92[_0x1e5e('0x8b')]=_0x2a775f[_0x1e5e('0x8b')];logger['info'](_0x1e5e('0x8c'),_0x38ea92[_0x1e5e('0x4e')],_0x38ea92[_0x1e5e('0x58')],_0x2a775f[_0x1e5e('0x8a')],_0x2a775f[_0x1e5e('0x8b')]);this[_0x1e5e('0x13')][_0x2a775f['uniqueid']]=_0x38ea92;this[_0x1e5e('0x4a')](_0x38ea92,_0x1e5e('0x21'));}}}catch(_0xf0d653){logger[_0x1e5e('0x3f')](_0x1e5e('0x88'),_0x2a775f[_0x1e5e('0x4c')],util['inspect'](_0xf0d653,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1e5e('0x24')]=function(_0x4b2800){try{if(this[_0x1e5e('0x5d')](_0x4b2800)){logger['debug'](_0x1e5e('0x8d'),_0x4b2800[_0x1e5e('0x4c')],util[_0x1e5e('0x41')](_0x4b2800,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4b2800['uniqueid']]){var _0x37a059=_[_0x1e5e('0x8e')](this[_0x1e5e('0x10')][_0x4b2800[_0x1e5e('0x4c')]]);_0x37a059['queuecallercomplete']=!![];_0x37a059[_0x1e5e('0x53')]=_0x1e5e('0x8f');logger[_0x1e5e('0x86')](_0x1e5e('0x90'),_0x37a059[_0x1e5e('0x4e')],_0x37a059[_0x1e5e('0x58')]);}}}catch(_0x24aff7){logger[_0x1e5e('0x3f')](_0x1e5e('0x8d'),_0x4b2800['uniqueid'],util[_0x1e5e('0x41')](_0x24aff7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0x23')]=function(_0x1d1e00){try{if(this['isNotNull'](_0x1d1e00)){logger[_0x1e5e('0x51')](_0x1e5e('0x91'),_0x1d1e00[_0x1e5e('0x4c')],util[_0x1e5e('0x41')](_0x1d1e00,{'showHidden':![],'depth':null}));if(this[_0x1e5e('0x10')][_0x1d1e00[_0x1e5e('0x4c')]]){var _0x74ae53=_[_0x1e5e('0x8e')](this['queueReports'][_0x1d1e00[_0x1e5e('0x4c')]]);_0x74ae53[_0x1e5e('0x1f')]=![];_0x74ae53[_0x1e5e('0x83')]=null;_0x74ae53['assigned']=!![];_0x74ae53[_0x1e5e('0x85')]=_0x1d1e00['membername'];_0x74ae53[_0x1e5e('0x81')]=_0x1d1e00[_0x1e5e('0x81')];_0x74ae53['queuecallercomplete']=!![];_0x74ae53[_0x1e5e('0x39')]=![];_0x74ae53[_0x1e5e('0x92')]=null;if(!_0x74ae53['transfer']){if(_0x1d1e00[_0x1e5e('0x93')]==_0x1e5e('0x94')){_0x74ae53[_0x1e5e('0x53')]=_0x1e5e('0x95');logger[_0x1e5e('0x86')](_0x1e5e('0x96'),_0x74ae53[_0x1e5e('0x4e')],_0x74ae53[_0x1e5e('0x58')]);}else{if(_['startsWith'](_0x1d1e00[_0x1e5e('0x3d')]['toLowerCase'](),_0x1e5e('0x97'))){if(this['queueReports'][_0x1d1e00[_0x1e5e('0x98')]]){var _0x32d44d=_[_0x1e5e('0x8e')](this['queueReports'][_0x1d1e00['linkedid']]);_0x32d44d[_0x1e5e('0x99')]=![];_0x32d44d[_0x1e5e('0x39')]=!![];_0x32d44d[_0x1e5e('0x92')]=moment(_0x74ae53[_0x1e5e('0x79')])[_0x1e5e('0x9a')](_0x1d1e00[_0x1e5e('0x81')],_0x1e5e('0x9b'))[_0x1e5e('0x5a')](_0x1e5e('0x7a'));_0x32d44d[_0x1e5e('0x53')]='FORWARDTRANSFER';_0x32d44d[_0x1e5e('0x94')]=!![];_0x32d44d[_0x1e5e('0x9c')]='FORWARD';_0x32d44d[_0x1e5e('0x9d')]=_0x1d1e00[_0x1e5e('0x9e')];_0x32d44d[_0x1e5e('0x9f')]=_0x1d1e00[_0x1e5e('0x4c')];logger[_0x1e5e('0x86')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x32d44d[_0x1e5e('0x4e')],_0x32d44d[_0x1e5e('0x58')]);var _0x5798db=this[_0x1e5e('0x10')][_0x1d1e00[_0x1e5e('0x98')]];this['queueReports'][_0x1d1e00[_0x1e5e('0x98')]]=this[_0x1e5e('0x10')][_0x1d1e00[_0x1e5e('0x4c')]];this['queueReports'][_0x1d1e00[_0x1e5e('0x4c')]]=_0x5798db;}}else{_0x74ae53[_0x1e5e('0x53')]=_0x1e5e('0xa0')+_0x1d1e00[_0x1e5e('0x93')][_0x1e5e('0xa1')]();logger[_0x1e5e('0x86')](_0x1e5e('0xa2'),_0x74ae53[_0x1e5e('0x4e')],_0x74ae53['type'],_0x74ae53[_0x1e5e('0x53')]);}}}this[_0x1e5e('0x13')][_0x1d1e00[_0x1e5e('0x4c')]]=_0x74ae53;}}}catch(_0x2ecb60){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0x1d1e00[_0x1e5e('0x4c')],util[_0x1e5e('0x41')](_0x2ecb60,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x4c0b6b){try{if(this[_0x1e5e('0x5d')](_0x4c0b6b)){logger[_0x1e5e('0x51')](_0x1e5e('0xa3'),_0x4c0b6b[_0x1e5e('0x4c')],util[_0x1e5e('0x41')](_0x4c0b6b,{'showHidden':![],'depth':null}));this['addVariable'](_0x4c0b6b[_0x1e5e('0x4c')],_[_0x1e5e('0xa4')](_0x4c0b6b[_0x1e5e('0xa5')])[0x0],_0x4c0b6b['value']);if(this[_0x1e5e('0x10')][_0x4c0b6b[_0x1e5e('0x4c')]]){var _0x33947c=_[_0x1e5e('0x8e')](this[_0x1e5e('0x10')][_0x4c0b6b['uniqueid']]);if(_0x33947c){if(this[_0x1e5e('0x5d')](_0x4c0b6b[_0x1e5e('0xa5')])&&this[_0x1e5e('0x5d')](_0x4c0b6b[_0x1e5e('0xa5')]['queuestatus'])){switch(_0x4c0b6b[_0x1e5e('0xa6')]){case _0x1e5e('0xa7'):_0x33947c[_0x1e5e('0x39')]=![];_0x33947c[_0x1e5e('0x92')]=null;break;case _0x1e5e('0xa8'):_0x33947c['lastevent']=_0x1e5e('0xa9');_0x33947c[_0x1e5e('0x39')]=!![];_0x33947c['queuecallerexitAt']=moment()[_0x1e5e('0x5a')](_0x1e5e('0x7a'));_0x33947c[_0x1e5e('0x89')]=moment()[_0x1e5e('0x5a')](_0x1e5e('0x7a'));logger[_0x1e5e('0x51')](_0x1e5e('0xaa'),_0x4c0b6b[_0x1e5e('0x4c')],util['inspect'](_0x33947c,{'showHidden':![],'depth':null}));ami[_0x1e5e('0x49')](_0x1e5e('0xab'),_0x33947c);break;default:_0x33947c[_0x1e5e('0x39')]=!![];_0x33947c[_0x1e5e('0x92')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x33947c[_0x1e5e('0x89')]=moment()['format'](_0x1e5e('0x7a'));}_0x33947c[_0x1e5e('0x1f')]=![];_0x33947c[_0x1e5e('0x83')]=null;_0x33947c[_0x1e5e('0x53')]=_0x4c0b6b['value'];this[_0x1e5e('0x13')][_0x4c0b6b[_0x1e5e('0x4c')]]=_0x33947c;this[_0x1e5e('0x47')](_0x33947c,_0x1e5e('0x25'));}else if(this[_0x1e5e('0x5d')](_0x4c0b6b[_0x1e5e('0xa5')])&&this[_0x1e5e('0x5d')](_0x4c0b6b[_0x1e5e('0xa5')][_0x1e5e('0xac')])){if(!_0x33947c[_0x1e5e('0x1f')]){_0x33947c['queuecallerexit']=!![];_0x33947c[_0x1e5e('0x92')]=moment()[_0x1e5e('0x5a')](_0x1e5e('0x7a'));_0x33947c['queuecallerexitreason']=_0x1e5e('0xad');_0x33947c[_0x1e5e('0x89')]=moment()[_0x1e5e('0x5a')](_0x1e5e('0x7a'));this['channels'][_0x4c0b6b[_0x1e5e('0x4c')]]=_0x33947c;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x4c0b6b[_0x1e5e('0x4c')],_0x33947c[_0x1e5e('0x4e')],_0x33947c[_0x1e5e('0x58')],_['keys'](_0x4c0b6b['variable'])[0x0],_0x4c0b6b['value']);_0x33947c['variables']=this['variables'][_0x4c0b6b[_0x1e5e('0x4c')]];}}}}catch(_0x3ba08e){logger[_0x1e5e('0x3f')](_0x1e5e('0xa3'),_0x4c0b6b[_0x1e5e('0x4c')],util['inspect'](_0x3ba08e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0xae')]=function(_0x2c862d,_0x249ac1,_0x1cfeab){var _0x393a75=[_0x1e5e('0xaf'),_0x1e5e('0xb0'),_0x1e5e('0xb1'),_0x1e5e('0xb2'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0x1e5e('0xb3'),_0x1e5e('0xb4'),'sipuri',_0x1e5e('0xb5'),_0x1e5e('0xb6'),_0x1e5e('0xb7'),_0x1e5e('0xb8'),'memberinterface','memberlastcall','membername',_0x1e5e('0xb9'),_0x1e5e('0xba')];if(!_[_0x1e5e('0xbb')](_0x249ac1)&&!_['includes'](_0x393a75,_0x249ac1)){if(_[_0x1e5e('0x5e')](this[_0x1e5e('0x16')][_0x2c862d])){this[_0x1e5e('0x16')][_0x2c862d]={};}this[_0x1e5e('0x16')][_0x2c862d][_0x249ac1]=_0x1cfeab;}};VoiceQueueReport[_0x1e5e('0xc')][_0x1e5e('0xbc')]=function(_0x2a8fe0,_0x3dccb3,_0xb6db17){try{var _0xd55495={};if(this['queueReports'][_0x2a8fe0]){for(var _0x2229dd=0x0;_0x2229dd{delete this['channels'][_0x53861f];},_0x2bda20);}};module['exports']=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 9ec5b67..25ccda3 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b85=['createHistory','campaign','Request','../client'];(function(_0x5a8b2a,_0x5e94b6){var _0x5288cb=function(_0x4a917f){while(--_0x4a917f){_0x5a8b2a['push'](_0x5a8b2a['shift']());}};_0x5288cb(++_0x5e94b6);}(_0x5b85,0x15f));var _0x55b8=function(_0x39a937,_0x5d4156){_0x39a937=_0x39a937-0x0;var _0x3100f7=_0x5b85[_0x39a937];return _0x3100f7;};'use strict';var client=require(_0x55b8('0x0'));exports[_0x55b8('0x1')]=function(_0xe39ec3){return function(){_0xe39ec3[_0x55b8('0x2')]=_0xe39ec3['queue'];return client[_0x55b8('0x3')]('CreateReportAgentPreview',{'body':_0xe39ec3,'log':'CreateReportAgentPreview'});};}; \ No newline at end of file +var _0x6b82=['queue','Request','CreateReportAgentPreview','../client','createHistory','campaign'];(function(_0x255445,_0x5a6a88){var _0x31397d=function(_0x249704){while(--_0x249704){_0x255445['push'](_0x255445['shift']());}};_0x31397d(++_0x5a6a88);}(_0x6b82,0x75));var _0x26b8=function(_0x54b2b0,_0x55f332){_0x54b2b0=_0x54b2b0-0x0;var _0x1a0d6b=_0x6b82[_0x54b2b0];return _0x1a0d6b;};'use strict';var client=require(_0x26b8('0x0'));exports[_0x26b8('0x1')]=function(_0x319c73){return function(){_0x319c73[_0x26b8('0x2')]=_0x319c73[_0x26b8('0x3')];return client[_0x26b8('0x4')](_0x26b8('0x5'),{'body':_0x319c73,'log':_0x26b8('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 86aa185..7d9d0f6 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd89=['CreateAttachment','create','Request'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xcd89,0x67));var _0x9cd8=function(_0x1d72d5,_0xfdcc8){_0x1d72d5=_0x1d72d5-0x0;var _0x41a8f1=_0xcd89[_0x1d72d5];return _0x41a8f1;};'use strict';var client=require('../client');exports[_0x9cd8('0x0')]=function(_0x405f62){return client[_0x9cd8('0x1')]('CreateAttachment',{'body':_0x405f62,'log':_0x9cd8('0x2')});}; \ No newline at end of file +var _0x7f0d=['CreateAttachment'];(function(_0x5ea8d8,_0x404d40){var _0xfe09=function(_0x2807f7){while(--_0x2807f7){_0x5ea8d8['push'](_0x5ea8d8['shift']());}};_0xfe09(++_0x404d40);}(_0x7f0d,0x89));var _0xd7f0=function(_0x5ed435,_0x1a0d7d){_0x5ed435=_0x5ed435-0x0;var _0x327146=_0x7f0d[_0x5ed435];return _0x327146;};'use strict';var client=require('../client');exports['create']=function(_0x548c1f){return client['Request']('CreateAttachment',{'body':_0x548c1f,'log':_0xd7f0('0x0')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index e2a8095..7313767 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x4a5cce,_0x34265f){var _0x347252=function(_0x7d6755){while(--_0x7d6755){_0x4a5cce['push'](_0x4a5cce['shift']());}};_0x347252(++_0x34265f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),_0xac4a('0x5'),'active','limitCalls','dialOriginateCallerIdName',_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0xc'),_0xac4a('0xd'),'dialGlobalMaxRetry','dialNoSuchNumberMaxRetry',_0xac4a('0xe'),_0xac4a('0xf'),_0xac4a('0x10'),'dialAbandonedMaxRetry',_0xac4a('0x11'),_0xac4a('0x12'),_0xac4a('0x13'),'dialAgentRejectMaxRetry',_0xac4a('0x14'),'dialTimezone',_0xac4a('0x15'),'dialAMDActive',_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x18'),'dialAMDTotalAnalysisTime',_0xac4a('0x19'),_0xac4a('0x1a'),_0xac4a('0x1b'),_0xac4a('0x1c'),_0xac4a('0x1d'),_0xac4a('0x1e'),_0xac4a('0x1f'),_0xac4a('0x20'),_0xac4a('0x21')],'include':[{'model':_0xac4a('0x22'),'as':_0xac4a('0x22'),'attributes':['id',_0xac4a('0x4'),'callerid',_0xac4a('0x23')]},{'model':_0xac4a('0x22'),'as':_0xac4a('0x24'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x25'),_0xac4a('0x23')]},{'model':_0xac4a('0x26'),'as':_0xac4a('0x26'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xac4a('0x27'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x28')]}]},{'model':'SquareProject','as':_0xac4a('0x29'),'attributes':['id',_0xac4a('0x4')]}]},'log':_0xac4a('0x2a')});};}; \ No newline at end of file +var _0x326f=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialPrefix','Trunk','callerid','TrunkBackup','Interval','Intervals','SquareProject','../client','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName'];(function(_0xd47394,_0x42c0d2){var _0x198ac5=function(_0x31672b){while(--_0x31672b){_0xd47394['push'](_0xd47394['shift']());}};_0x198ac5(++_0x42c0d2);}(_0x326f,0xd1));var _0xf326=function(_0x184fd4,_0x5691a1){_0x184fd4=_0x184fd4-0x0;var _0x4cdb9a=_0x326f[_0x184fd4];return _0x4cdb9a;};'use strict';var client=require(_0xf326('0x0'));exports['getCampaigns']=function(){return function(){return client['Request'](_0xf326('0x1'),{'options':{'raw':![],'attributes':['id',_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa'),'dialBusyMaxRetry',_0xf326('0xb'),_0xf326('0xc'),_0xf326('0xd'),_0xf326('0xe'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xf326('0xf'),_0xf326('0x10'),_0xf326('0x11'),_0xf326('0x12'),_0xf326('0x13'),'dialAgentRejectMaxRetry',_0xf326('0x14'),'dialTimezone',_0xf326('0x15'),'dialAMDActive',_0xf326('0x16'),'dialAMDGreeting',_0xf326('0x17'),_0xf326('0x18'),'dialAMDMinWordLength',_0xf326('0x19'),_0xf326('0x1a'),_0xf326('0x1b'),_0xf326('0x1c'),'dialOrderByScheduledAt',_0xf326('0x1d'),'dialRandomLastDigitCallerIdNumber','dialCutDigit'],'include':[{'model':_0xf326('0x1e'),'as':_0xf326('0x1e'),'attributes':['id',_0xf326('0x2'),_0xf326('0x1f'),_0xf326('0x4')]},{'model':_0xf326('0x1e'),'as':_0xf326('0x20'),'attributes':['id',_0xf326('0x2'),'callerid',_0xf326('0x4')]},{'model':_0xf326('0x21'),'as':_0xf326('0x21'),'attributes':['id',_0xf326('0x2')],'include':[{'model':_0xf326('0x21'),'as':_0xf326('0x22'),'attributes':['id','name','interval']}]},{'model':'SquareProject','as':_0xf326('0x23'),'attributes':['id',_0xf326('0x2')]}]},'log':'getCampaign'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index f05d6fe..0cf675a 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe183=['createContact','CreateCmContact','getContacts','Request','GetCmContact','../client'];(function(_0x1ce67b,_0x5d1e9f){var _0xc64cb0=function(_0x376ce4){while(--_0x376ce4){_0x1ce67b['push'](_0x1ce67b['shift']());}};_0xc64cb0(++_0x5d1e9f);}(_0xe183,0x119));var _0x3e18=function(_0x274dd7,_0x2e6051){_0x274dd7=_0x274dd7-0x0;var _0x148829=_0xe183[_0x274dd7];return _0x148829;};'use strict';var client=require(_0x3e18('0x0'));exports[_0x3e18('0x1')]=function(_0x566df0){return function(){return client['Request'](_0x3e18('0x2'),{'body':_0x566df0,'log':'CreateCmContact'});};};exports[_0x3e18('0x3')]=function(_0x15f4ab){return function(){return client[_0x3e18('0x4')]('GetCmContact',{'options':_0x15f4ab,'log':_0x3e18('0x5')});};}; \ No newline at end of file +var _0x873c=['../client','CreateCmContact','getContacts','Request','GetCmContact'];(function(_0x2c9a11,_0x44e8af){var _0x2cd3aa=function(_0x71e93){while(--_0x71e93){_0x2c9a11['push'](_0x2c9a11['shift']());}};_0x2cd3aa(++_0x44e8af);}(_0x873c,0x104));var _0xc873=function(_0x529595,_0x2fcbc0){_0x529595=_0x529595-0x0;var _0x382a36=_0x873c[_0x529595];return _0x382a36;};'use strict';var client=require(_0xc873('0x0'));exports['createContact']=function(_0x59ef45){return function(){return client['Request'](_0xc873('0x1'),{'body':_0x59ef45,'log':_0xc873('0x1')});};};exports[_0xc873('0x2')]=function(_0xffcf0a){return function(){return client[_0xc873('0x3')](_0xc873('0x4'),{'options':_0xffcf0a,'log':_0xc873('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index d47ab95..eb5a3c8 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb41=['MoveContactManagedDialer','countReScheduled','CountReScheduled','getContactPreview','GetCmHopperPreview','Agent','name','unlockContact','UpdateCmHopper','getContactRecallMe','User','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','getContacts','Request','CmContact','Contact','getCmHopper','updateContacts','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','VoiceQueueId','destroyContact','DestroyCmHopper','GetContactDialer','priority','DESC','scheduledat','ASC','getContactDialerIvr','moveContactManagedDialer','campaign','queue'];(function(_0x5cb7dd,_0x290cfb){var _0x5ee23e=function(_0x594d25){while(--_0x594d25){_0x5cb7dd['push'](_0x5cb7dd['shift']());}};_0x5ee23e(++_0x290cfb);}(_0xcb41,0x1df));var _0x1cb4=function(_0x3ba56c,_0x3e37e3){_0x3ba56c=_0x3ba56c-0x0;var _0x488717=_0xcb41[_0x3ba56c];return _0x488717;};'use strict';var client=require(_0x1cb4('0x0'));var moment=require(_0x1cb4('0x1'));exports[_0x1cb4('0x2')]=function(_0x4427c9,_0x4f9dd0){return function(){return client[_0x1cb4('0x3')]('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x4427c9},'include':[{'model':_0x1cb4('0x4'),'as':_0x1cb4('0x5')}],'limit':_0x4f9dd0,'raw':![]},'log':_0x1cb4('0x6')});};};exports[_0x1cb4('0x7')]=function(_0x2099b0,_0x547f4,_0x2eaeb4){return function(){return client[_0x1cb4('0x3')]('UpdateCmHopper',{'body':_0x2099b0,'options':{'where':{'VoiceQueueId':_0x547f4,'scheduledat':{'$lte':moment()[_0x1cb4('0x8')](_0x1cb4('0x9'))}},'limit':_0x2eaeb4},'log':'UpdateCmHopper'});};};exports[_0x1cb4('0xa')]=function(_0x4214ce){return client[_0x1cb4('0x3')]('UpdateCmHopper',{'body':_0x4214ce,'options':{'where':{'ContactId':_0x4214ce[_0x1cb4('0xb')],'ListId':_0x4214ce[_0x1cb4('0xc')],'VoiceQueueId':_0x4214ce[_0x1cb4('0xd')],'CampaignId':_0x4214ce['CampaignId']}},'log':'rescheduleContact'});};exports[_0x1cb4('0xe')]=function(_0x574f01,_0x238ce4,_0x18f956){return function(){return client[_0x1cb4('0x3')](_0x1cb4('0xf'),{'options':{'where':{'VoiceQueueId':_0x574f01,'ListId':_0x238ce4,'ContactId':_0x18f956}},'log':_0x1cb4('0xf')});};};exports['getContactDialer']=function(_0xc16752,_0x4cb3c9,_0x273a0b,_0x3d2f2e){return client[_0x1cb4('0x3')](_0x1cb4('0x10'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xc16752,'active':![],'scheduledat':{'$lte':moment()[_0x1cb4('0x8')](_0x1cb4('0x9'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x4cb3c9}}]},'order':[[_0x1cb4('0x11'),_0x1cb4('0x12')],[_0x1cb4('0x13'),_0x3d2f2e],['id',_0x1cb4('0x14')]],'raw':!![],'limit':_0x273a0b},'log':'GetContactDialer'});};exports[_0x1cb4('0x15')]=function(_0x514285,_0x2d5748,_0x10326c){return client['Request']('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x514285,'active':![],'scheduledat':{'$lte':moment()[_0x1cb4('0x8')](_0x1cb4('0x9'))}},'include':[{'model':_0x1cb4('0x4'),'as':_0x1cb4('0x5')}],'order':[[_0x1cb4('0x11'),_0x1cb4('0x12')],[_0x1cb4('0x13'),_0x10326c],['id',_0x1cb4('0x14')]],'raw':!![],'limit':_0x2d5748},'log':'GetContactDialerIvr'});};exports[_0x1cb4('0x16')]=function(_0x1d1a19,_0x5a24ec){_0x1d1a19[_0x1cb4('0x17')]=_0x1d1a19[_0x1cb4('0x18')];return client[_0x1cb4('0x3')](_0x1cb4('0x19'),{'body':_0x1d1a19,'options':{'where':{'ContactId':_0x1d1a19['ContactId'],'ListId':_0x1d1a19[_0x1cb4('0xc')],'VoiceQueueId':_0x1d1a19['VoiceQueueId'],'CampaignId':_0x1d1a19['CampaignId'],'active':_0x5a24ec?undefined:!![]}},'log':_0x1cb4('0x19')});};exports[_0x1cb4('0x1a')]=function(_0x3aea31){return client['Request'](_0x1cb4('0x1b'),{'options':{'where':{'VoiceQueueId':_0x3aea31['id']?_0x3aea31['id']||null:null}},'log':_0x1cb4('0x1a')});};exports[_0x1cb4('0x1c')]=function(_0x5bce36){return function(){return client[_0x1cb4('0x3')](_0x1cb4('0x1d'),{'options':{'where':{'id':_0x5bce36},'include':[{'model':_0x1cb4('0x4'),'as':_0x1cb4('0x5')},{'model':'User','as':_0x1cb4('0x1e'),'attributes':['id','name']},{'model':'VoiceQueue','as':'Queue','attributes':['id',_0x1cb4('0x1f')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0x1cb4('0x20')]=function(_0x17f4e1,_0x569fff,_0x5ef7b0){return client[_0x1cb4('0x3')](_0x1cb4('0x21'),{'body':_0x17f4e1,'options':{'where':{'id':_0x569fff},'limit':_0x5ef7b0},'log':_0x1cb4('0x21')});};exports[_0x1cb4('0x22')]=function(_0x29dba9,_0x15956b){return function(){return client['Request']('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x29dba9,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0x1cb4('0x9'))},'UserId':{'$in':_0x15956b}},'order':[[_0x1cb4('0x11'),_0x1cb4('0x12')],[_0x1cb4('0x13'),_0x1cb4('0x12')],['id',_0x1cb4('0x14')]],'include':[{'model':_0x1cb4('0x4'),'as':_0x1cb4('0x5')},{'model':_0x1cb4('0x23'),'as':_0x1cb4('0x1e'),'attributes':['id',_0x1cb4('0x1f'),_0x1cb4('0x24')]}],'group':_0x1cb4('0x25'),'raw':!![]},'log':_0x1cb4('0x10')});};};exports[_0x1cb4('0x26')]=function(_0x1aaf36,_0x32418a){return client[_0x1cb4('0x3')]('ResetActiveCalls',{'body':_0x1aaf36,'options':_0x32418a||{},'log':_0x1cb4('0x27')});};exports[_0x1cb4('0x28')]=function(_0x2f21a5,_0x1d169b,_0x292540){return function(){return client['Request'](_0x1cb4('0x29'),{'body':{'where':{'voiceQueueIds':_0x2f21a5,'interval':_0x1d169b,'availableAgentsIds':_0x292540}},'log':_0x1cb4('0x28')});};}; \ No newline at end of file +var _0xbcc7=['destroyContact','DestroyCmHopper','getContactDialer','YYYY-MM-DD\x20HH:mm:ss','priority','DESC','scheduledat','ASC','GetContactDialer','GetContactDialerIvr','moveContactManagedDialer','MoveContactManagedDialer','ListId','VoiceQueueId','CampaignId','countReScheduled','CountReScheduled','getContactPreview','GetCmHopperPreview','User','VoiceQueue','name','unlockContact','getContactRecallMe','GetContactRecallMe','CmContact','Agent','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','GetCmHopper','Contact','getCmHopper','Request','UpdateCmHopper','format','ContactId','rescheduleContact'];(function(_0x1b1ae3,_0x4ee04d){var _0x43bcbe=function(_0x20836e){while(--_0x20836e){_0x1b1ae3['push'](_0x1b1ae3['shift']());}};_0x43bcbe(++_0x4ee04d);}(_0xbcc7,0x19a));var _0x7bcc=function(_0x5db16f,_0x3a2a32){_0x5db16f=_0x5db16f-0x0;var _0x12ff59=_0xbcc7[_0x5db16f];return _0x12ff59;};'use strict';var client=require(_0x7bcc('0x0'));var moment=require(_0x7bcc('0x1'));exports['getContacts']=function(_0x446ead,_0x4bd2e1){return function(){return client['Request'](_0x7bcc('0x2'),{'options':{'where':{'VoiceQueueId':_0x446ead},'include':[{'model':'CmContact','as':_0x7bcc('0x3')}],'limit':_0x4bd2e1,'raw':![]},'log':_0x7bcc('0x4')});};};exports['updateContacts']=function(_0x1bf847,_0x24ff05,_0x82b2e1){return function(){return client[_0x7bcc('0x5')](_0x7bcc('0x6'),{'body':_0x1bf847,'options':{'where':{'VoiceQueueId':_0x24ff05,'scheduledat':{'$lte':moment()[_0x7bcc('0x7')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x82b2e1},'log':_0x7bcc('0x6')});};};exports['rescheduleContact']=function(_0x317db2){return client[_0x7bcc('0x5')]('UpdateCmHopper',{'body':_0x317db2,'options':{'where':{'ContactId':_0x317db2[_0x7bcc('0x8')],'ListId':_0x317db2['ListId'],'VoiceQueueId':_0x317db2['VoiceQueueId'],'CampaignId':_0x317db2['CampaignId']}},'log':_0x7bcc('0x9')});};exports[_0x7bcc('0xa')]=function(_0xb3207,_0x1121d1,_0x45fedf){return function(){return client[_0x7bcc('0x5')](_0x7bcc('0xb'),{'options':{'where':{'VoiceQueueId':_0xb3207,'ListId':_0x1121d1,'ContactId':_0x45fedf}},'log':'DestroyCmHopper'});};};exports[_0x7bcc('0xc')]=function(_0x101354,_0x4659c5,_0x12714f,_0x39f912){return client[_0x7bcc('0x5')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x101354,'active':![],'scheduledat':{'$lte':moment()[_0x7bcc('0x7')](_0x7bcc('0xd'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x4659c5}}]},'order':[[_0x7bcc('0xe'),_0x7bcc('0xf')],[_0x7bcc('0x10'),_0x39f912],['id',_0x7bcc('0x11')]],'raw':!![],'limit':_0x12714f},'log':_0x7bcc('0x12')});};exports['getContactDialerIvr']=function(_0x20105e,_0x4ce248,_0x3156f3){return client[_0x7bcc('0x5')](_0x7bcc('0x12'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x20105e,'active':![],'scheduledat':{'$lte':moment()[_0x7bcc('0x7')]('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':'CmContact','as':_0x7bcc('0x3')}],'order':[[_0x7bcc('0xe'),_0x7bcc('0xf')],[_0x7bcc('0x10'),_0x3156f3],['id',_0x7bcc('0x11')]],'raw':!![],'limit':_0x4ce248},'log':_0x7bcc('0x13')});};exports[_0x7bcc('0x14')]=function(_0x3d0719,_0x15b2c3){_0x3d0719['campaign']=_0x3d0719['queue'];return client[_0x7bcc('0x5')](_0x7bcc('0x15'),{'body':_0x3d0719,'options':{'where':{'ContactId':_0x3d0719[_0x7bcc('0x8')],'ListId':_0x3d0719[_0x7bcc('0x16')],'VoiceQueueId':_0x3d0719[_0x7bcc('0x17')],'CampaignId':_0x3d0719[_0x7bcc('0x18')],'active':_0x15b2c3?undefined:!![]}},'log':_0x7bcc('0x15')});};exports[_0x7bcc('0x19')]=function(_0x32b3ea){return client['Request'](_0x7bcc('0x1a'),{'options':{'where':{'VoiceQueueId':_0x32b3ea['id']?_0x32b3ea['id']||null:null}},'log':_0x7bcc('0x19')});};exports[_0x7bcc('0x1b')]=function(_0x3875df){return function(){return client[_0x7bcc('0x5')](_0x7bcc('0x1c'),{'options':{'where':{'id':_0x3875df},'include':[{'model':'CmContact','as':'Contact'},{'model':_0x7bcc('0x1d'),'as':'Agent','attributes':['id','name']},{'model':_0x7bcc('0x1e'),'as':'Queue','attributes':['id',_0x7bcc('0x1f')]}],'raw':!![]},'log':_0x7bcc('0x4')});};};exports[_0x7bcc('0x20')]=function(_0x5b919f,_0x17c3ce,_0x1dea55){return client[_0x7bcc('0x5')](_0x7bcc('0x6'),{'body':_0x5b919f,'options':{'where':{'id':_0x17c3ce},'limit':_0x1dea55},'log':_0x7bcc('0x6')});};exports[_0x7bcc('0x21')]=function(_0x9fdacf,_0x57aa56){return function(){return client[_0x7bcc('0x5')](_0x7bcc('0x22'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x9fdacf,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x57aa56}},'order':[[_0x7bcc('0xe'),'DESC'],[_0x7bcc('0x10'),_0x7bcc('0xf')],['id',_0x7bcc('0x11')]],'include':[{'model':_0x7bcc('0x23'),'as':'Contact'},{'model':_0x7bcc('0x1d'),'as':_0x7bcc('0x24'),'attributes':['id',_0x7bcc('0x1f'),'voicePause']}],'group':_0x7bcc('0x25'),'raw':!![]},'log':_0x7bcc('0x12')});};};exports[_0x7bcc('0x26')]=function(_0x26c033,_0x1c562f){return client[_0x7bcc('0x5')](_0x7bcc('0x27'),{'body':_0x26c033,'options':_0x1c562f||{},'log':_0x7bcc('0x27')});};exports[_0x7bcc('0x28')]=function(_0x338e79,_0x2865a1,_0x529c55){return function(){return client[_0x7bcc('0x5')](_0x7bcc('0x29'),{'body':{'where':{'voiceQueueIds':_0x338e79,'interval':_0x2865a1,'availableAgentsIds':_0x529c55}},'log':_0x7bcc('0x28')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 3f8105e..f2c74fe 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x971e=['VerifyAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','verifyAdditionalPhones','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x971e,0x7c));var _0xe971=function(_0x26ea7d,_0x3f6c0f){_0x26ea7d=_0x26ea7d-0x0;var _0x3f85fb=_0x971e[_0x26ea7d];return _0x3f85fb;};'use strict';var client=require('../client');exports[_0xe971('0x0')]=function(_0x59dc5e,_0x1e3e41,_0x2ee639){return client[_0xe971('0x1')](_0xe971('0x2'),{'body':_0x59dc5e,'reason':_0x1e3e41,'entity':_0x2ee639,'log':_0xe971('0x2')});};exports['swapAdditionalPhones']=function(_0x2fb762,_0x1c707c,_0x1f940b){return client['Request'](_0xe971('0x3'),{'body':_0x2fb762,'duration':_0x1c707c,'waitTime':_0x1f940b,'log':_0xe971('0x3')});};exports[_0xe971('0x4')]=function(_0x4a201f){return function(){return client[_0xe971('0x1')](_0xe971('0x5'),{'body':_0x4a201f,'log':_0xe971('0x5')});};}; \ No newline at end of file +var _0x545b=['Request','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones','VerifyAdditionalPhones','swapAdditionalPhones'];(function(_0x550ddc,_0x2f6d5f){var _0x14726f=function(_0x406865){while(--_0x406865){_0x550ddc['push'](_0x550ddc['shift']());}};_0x14726f(++_0x2f6d5f);}(_0x545b,0x1ec));var _0xb545=function(_0x4a1e37,_0x2eef28){_0x4a1e37=_0x4a1e37-0x0;var _0xeb1f8b=_0x545b[_0x4a1e37];return _0xeb1f8b;};'use strict';var client=require(_0xb545('0x0'));exports[_0xb545('0x1')]=function(_0x252744,_0x90a761,_0x170234){return client['Request'](_0xb545('0x2'),{'body':_0x252744,'reason':_0x90a761,'entity':_0x170234,'log':'VerifyAdditionalPhones'});};exports[_0xb545('0x3')]=function(_0x41886f,_0x288031,_0x1fda61){return client[_0xb545('0x4')](_0xb545('0x5'),{'body':_0x41886f,'duration':_0x288031,'waitTime':_0x1fda61,'log':_0xb545('0x5')});};exports[_0xb545('0x6')]=function(_0x43bc0c){return function(){return client[_0xb545('0x4')]('IncrementPreviewCounters',{'body':_0x43bc0c,'log':_0xb545('0x7')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index eaae372..da10b3e 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ab9=['Request','VoiceQueueId','phone','GetCmHopperBlack','checkIsBlackListIvr','../client','checkIsBlackList'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x0ab9,0x1a9));var _0x90ab=function(_0xb4ea63,_0x12712d){_0xb4ea63=_0xb4ea63-0x0;var _0x22812d=_0x0ab9[_0xb4ea63];return _0x22812d;};'use strict';var client=require(_0x90ab('0x0'));exports[_0x90ab('0x1')]=function(_0x3427c2){return client[_0x90ab('0x2')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x3427c2[_0x90ab('0x3')],'phone':_0x3427c2[_0x90ab('0x4')]},'raw':![]},'log':_0x90ab('0x5')});};exports[_0x90ab('0x6')]=function(_0xefaa6a){return client[_0x90ab('0x2')]('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0xefaa6a['CampaignId'],'phone':_0xefaa6a[_0x90ab('0x4')]},'raw':![]},'log':'GetCmHopperBlackIvr'});}; \ No newline at end of file +var _0xf9da=['GetCmHopperBlack','GetCmHopperBlackIvr','../client','checkIsBlackList','VoiceQueueId','phone','checkIsBlackListIvr','Request'];(function(_0x3b79ee,_0x2c7e90){var _0x1541e1=function(_0x16b4d4){while(--_0x16b4d4){_0x3b79ee['push'](_0x3b79ee['shift']());}};_0x1541e1(++_0x2c7e90);}(_0xf9da,0x11a));var _0xaf9d=function(_0x4498ac,_0x30e301){_0x4498ac=_0x4498ac-0x0;var _0x4bf1b6=_0xf9da[_0x4498ac];return _0x4bf1b6;};'use strict';var client=require(_0xaf9d('0x0'));exports[_0xaf9d('0x1')]=function(_0x265758){return client['Request']('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x265758[_0xaf9d('0x2')],'phone':_0x265758[_0xaf9d('0x3')]},'raw':![]},'log':'GetCmHopperBlack'});};exports[_0xaf9d('0x4')]=function(_0x373172){return client[_0xaf9d('0x5')](_0xaf9d('0x6'),{'options':{'where':{'CampaignId':_0x373172['CampaignId'],'phone':_0x373172[_0xaf9d('0x3')]},'raw':![]},'log':_0xaf9d('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 74ea3c9..baece57 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e5b=['Request','CreateCmHopperFinal','createContact'];(function(_0x28a65c,_0x3726f8){var _0x315a00=function(_0x1ece40){while(--_0x1ece40){_0x28a65c['push'](_0x28a65c['shift']());}};_0x315a00(++_0x3726f8);}(_0x1e5b,0x7d));var _0xb1e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e5b[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xb1e5('0x0')]=function(_0x4170bf){return function(){_0x4170bf['campaign']=_0x4170bf['queue'];return client[_0xb1e5('0x1')](_0xb1e5('0x2'),{'body':_0x4170bf,'log':_0xb1e5('0x2')});};}; \ No newline at end of file +var _0xf133=['campaign','queue','Request','CreateCmHopperFinal','../client','createContact'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xf133,0x106));var _0x3f13=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xf133[_0x88cd7b];return _0x56fcc8;};'use strict';var client=require(_0x3f13('0x0'));exports[_0x3f13('0x1')]=function(_0x52f2eb){return function(){_0x52f2eb[_0x3f13('0x2')]=_0x52f2eb[_0x3f13('0x3')];return client[_0x3f13('0x4')](_0x3f13('0x5'),{'body':_0x52f2eb,'log':_0x3f13('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index f9cc2bc..605da07 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2168=['day','endOf','getCampaignHopperHistory','startOf','GetCampaignHopperHistory','moment','createHistory','campaign','queue','Request','CreateCmHopperHistory','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory'];(function(_0x3481c3,_0x2ce48e){var _0x46a7a0=function(_0x13c771){while(--_0x13c771){_0x3481c3['push'](_0x3481c3['shift']());}};_0x46a7a0(++_0x2ce48e);}(_0x2168,0x15b));var _0x8216=function(_0x3f36f0,_0x5f41f7){_0x3f36f0=_0x3f36f0-0x0;var _0x9d6f3d=_0x2168[_0x3f36f0];return _0x9d6f3d;};'use strict';var client=require('../client');var moment=require(_0x8216('0x0'));exports[_0x8216('0x1')]=function(_0x94ea16){_0x94ea16[_0x8216('0x2')]=_0x94ea16[_0x8216('0x3')];return client[_0x8216('0x4')](_0x8216('0x5'),{'body':_0x94ea16,'log':_0x8216('0x5')});};exports['avgHandleTime']=function(_0x43cc7c){return client[_0x8216('0x4')](_0x8216('0x6'),{'options':{'where':{'endtime':{'$between':[moment()[_0x8216('0x7')](_0x43cc7c,_0x8216('0x8'))[_0x8216('0x9')](_0x8216('0xa')),moment()['format'](_0x8216('0xa'))]}},'raw':![]},'log':_0x8216('0xb')});};exports[_0x8216('0xc')]=function(){return function(){return client[_0x8216('0x4')](_0x8216('0xd'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x8216('0xe'))[_0x8216('0x9')](_0x8216('0xa')),moment()[_0x8216('0xf')](_0x8216('0xe'))[_0x8216('0x9')](_0x8216('0xa'))]},'campaigntype':_0x8216('0x3')},'raw':![]},'log':_0x8216('0xd')});};};exports[_0x8216('0x10')]=function(){return function(){return client['Request']('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0x8216('0x11')](_0x8216('0xe'))[_0x8216('0x9')](_0x8216('0xa')),moment()['endOf'](_0x8216('0xe'))[_0x8216('0x9')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':'ivr'},'raw':![]},'log':_0x8216('0x12')});};}; \ No newline at end of file +var _0x2706=['endOf','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivr','../client','campaign','queue','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','startOf','day'];(function(_0x59547f,_0x441963){var _0x3a5309=function(_0x414561){while(--_0x414561){_0x59547f['push'](_0x59547f['shift']());}};_0x3a5309(++_0x441963);}(_0x2706,0x1b4));var _0x6270=function(_0x456e19,_0x56b700){_0x456e19=_0x456e19-0x0;var _0x297a29=_0x2706[_0x456e19];return _0x297a29;};'use strict';var client=require(_0x6270('0x0'));var moment=require('moment');exports['createHistory']=function(_0x3f226f){_0x3f226f[_0x6270('0x1')]=_0x3f226f[_0x6270('0x2')];return client[_0x6270('0x3')](_0x6270('0x4'),{'body':_0x3f226f,'log':_0x6270('0x4')});};exports[_0x6270('0x5')]=function(_0x454f8b){return client[_0x6270('0x3')](_0x6270('0x6'),{'options':{'where':{'endtime':{'$between':[moment()[_0x6270('0x7')](_0x454f8b,_0x6270('0x8'))[_0x6270('0x9')](_0x6270('0xa')),moment()[_0x6270('0x9')](_0x6270('0xa'))]}},'raw':![]},'log':_0x6270('0xb')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client[_0x6270('0x3')]('GetVoiceQueueHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0x6270('0xc')](_0x6270('0xd'))[_0x6270('0x9')](_0x6270('0xa')),moment()[_0x6270('0xe')](_0x6270('0xd'))[_0x6270('0x9')](_0x6270('0xa'))]},'campaigntype':_0x6270('0x2')},'raw':![]},'log':_0x6270('0xf')});};};exports['getCampaignHopperHistory']=function(){return function(){return client[_0x6270('0x3')](_0x6270('0x10'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x6270('0xc')]('day')[_0x6270('0x9')](_0x6270('0xa')),moment()[_0x6270('0xe')](_0x6270('0xd'))[_0x6270('0x9')](_0x6270('0xa'))]},'campaigntype':_0x6270('0x11')},'raw':![]},'log':_0x6270('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 1e54eb4..72fe77d 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac41=['maxrate','modem','gateway','faxdetect','t38timeout','tech','TrunkId','ListId','key','Trunk','callerid','active','getFaxAccount','NotifyFaxAccount','../client','getFaxAccounts','Request','GetFaxAccount','name','description','ecm','headerinfo','minrate'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xac41,0xdd));var _0x1ac4=function(_0x5768d1,_0x491b4a){_0x5768d1=_0x5768d1-0x0;var _0x5d50e9=_0xac41[_0x5768d1];return _0x5d50e9;};'use strict';var client=require(_0x1ac4('0x0'));exports[_0x1ac4('0x1')]=function(){return function(){return client[_0x1ac4('0x2')](_0x1ac4('0x3'),{'options':{'raw':![],'attributes':['id',_0x1ac4('0x4'),_0x1ac4('0x5'),_0x1ac4('0x6'),_0x1ac4('0x7'),'localstationid',_0x1ac4('0x8'),_0x1ac4('0x9'),_0x1ac4('0xa'),_0x1ac4('0xb'),_0x1ac4('0xc'),_0x1ac4('0xd'),_0x1ac4('0xe'),_0x1ac4('0xf'),_0x1ac4('0x10'),_0x1ac4('0x11')],'include':[{'model':_0x1ac4('0x12'),'as':_0x1ac4('0x12'),'attributes':['id',_0x1ac4('0x4'),_0x1ac4('0x13'),_0x1ac4('0x14')]}]},'log':_0x1ac4('0x15')});};};exports['notify']=function(_0x2d4ac7,_0x550dc0){return client[_0x1ac4('0x2')](_0x1ac4('0x16'),{'account':{'id':_0x2d4ac7},'body':_0x550dc0,'log':'NotifyFaxAccount'});}; \ No newline at end of file +var _0xb4f4=['ListId','key','Trunk','active','getFaxAccount','notify','Request','NotifyFaxAccount','../client','getFaxAccounts','GetFaxAccount','name','description','ecm','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout'];(function(_0x593b5d,_0x2e9d34){var _0x37a171=function(_0x2455bc){while(--_0x2455bc){_0x593b5d['push'](_0x593b5d['shift']());}};_0x37a171(++_0x2e9d34);}(_0xb4f4,0xda));var _0x4b4f=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xb4f4[_0x576170];return _0x397c70;};'use strict';var client=require(_0x4b4f('0x0'));exports[_0x4b4f('0x1')]=function(){return function(){return client['Request'](_0x4b4f('0x2'),{'options':{'raw':![],'attributes':['id',_0x4b4f('0x3'),_0x4b4f('0x4'),_0x4b4f('0x5'),'headerinfo',_0x4b4f('0x6'),_0x4b4f('0x7'),_0x4b4f('0x8'),_0x4b4f('0x9'),_0x4b4f('0xa'),_0x4b4f('0xb'),_0x4b4f('0xc'),'tech','TrunkId',_0x4b4f('0xd'),_0x4b4f('0xe')],'include':[{'model':_0x4b4f('0xf'),'as':_0x4b4f('0xf'),'attributes':['id',_0x4b4f('0x3'),'callerid',_0x4b4f('0x10')]}]},'log':_0x4b4f('0x11')});};};exports[_0x4b4f('0x12')]=function(_0x5f0f0b,_0x4a65db){return client[_0x4b4f('0x13')]('NotifyFaxAccount',{'account':{'id':_0x5f0f0b},'body':_0x4a65db,'log':_0x4b4f('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index 16e6c79..0eedd13 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb63=['UpdateFaxMessage','../client','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeb63,0x88));var _0x3eb6=function(_0x5db2e5,_0x5ade38){_0x5db2e5=_0x5db2e5-0x0;var _0x40953f=_0xeb63[_0x5db2e5];return _0x40953f;};'use strict';var client=require(_0x3eb6('0x0'));exports['update']=function(_0x515a95,_0x10eca3){return client[_0x3eb6('0x1')](_0x3eb6('0x2'),{'body':_0x10eca3,'options':{'where':{'AttachmentId':_0x515a95}},'log':'UpdateFaxMessage'});}; \ No newline at end of file +var _0xaf18=['update','Request','UpdateFaxMessage','../client'];(function(_0x3995e0,_0x13833a){var _0xb9ea5e=function(_0x597289){while(--_0x597289){_0x3995e0['push'](_0x3995e0['shift']());}};_0xb9ea5e(++_0x13833a);}(_0xaf18,0x15f));var _0x8af1=function(_0x7048ce,_0x2358f2){_0x7048ce=_0x7048ce-0x0;var _0x166188=_0xaf18[_0x7048ce];return _0x166188;};'use strict';var client=require(_0x8af1('0x0'));exports[_0x8af1('0x1')]=function(_0x24fad4,_0x19df3e){return client[_0x8af1('0x2')](_0x8af1('0x3'),{'body':_0x19df3e,'options':{'where':{'AttachmentId':_0x24fad4}},'log':_0x8af1('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index 6e006dd..00748d5 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd52d=['Configurations','DeskField','Subjects','content','variableName','Variable','Descriptions','key','keyContent','nameField','customField','name','Tags','GetDeskAccount','getDeskAccounts','Request','username','password','remoteUri','authType','type','serverUrl','DeskConfiguration'];(function(_0x4ef6d1,_0x5d725c){var _0x2dfb6b=function(_0x4f9c84){while(--_0x4f9c84){_0x4ef6d1['push'](_0x4ef6d1['shift']());}};_0x2dfb6b(++_0x5d725c);}(_0xd52d,0x1f1));var _0xdd52=function(_0x1c3561,_0x230830){_0x1c3561=_0x1c3561-0x0;var _0x11652e=_0xd52d[_0x1c3561];return _0x11652e;};'use strict';var client=require('../../client');exports[_0xdd52('0x0')]=function(){return function(_0x356347){return client[_0xdd52('0x1')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id','name','description',_0xdd52('0x2'),_0xdd52('0x3'),_0xdd52('0x4'),_0xdd52('0x5'),_0xdd52('0x6'),_0xdd52('0x7')],'include':[{'model':_0xdd52('0x8'),'as':_0xdd52('0x9'),'attributes':['id','name'],'include':[{'model':_0xdd52('0xa'),'as':_0xdd52('0xb'),'attributes':['id','type',_0xdd52('0xc'),_0xdd52('0xd')],'include':[{'model':'Variable','as':_0xdd52('0xe'),'attributes':['id','name']}]},{'model':'DeskField','as':_0xdd52('0xf'),'attributes':['id',_0xdd52('0x6'),_0xdd52('0xc'),_0xdd52('0x10'),'keyType',_0xdd52('0x11'),_0xdd52('0xd')],'include':[{'model':_0xdd52('0xe'),'as':_0xdd52('0xe'),'attributes':['id','name']}]},{'model':_0xdd52('0xa'),'as':'Fields','attributes':['id',_0xdd52('0x6'),'content','idField',_0xdd52('0x12'),_0xdd52('0x13'),_0xdd52('0xd')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xdd52('0x14')]}]},{'model':'Tag','as':_0xdd52('0x15'),'attributes':['id',_0xdd52('0x14')]}]}]},'log':_0xdd52('0x16')});};}; \ No newline at end of file +var _0x848c=['password','remoteUri','authType','DeskConfiguration','Configurations','DeskField','Subjects','content','variableName','Variable','Descriptions','type','keyType','keyContent','Fields','idField','Tags','../../client','Request','GetDeskAccount','name','description','username'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x848c,0x181));var _0xc848=function(_0x2037e0,_0x23cc47){_0x2037e0=_0x2037e0-0x0;var _0x4f6502=_0x848c[_0x2037e0];return _0x4f6502;};'use strict';var client=require(_0xc848('0x0'));exports['getDeskAccounts']=function(){return function(_0x118a3e){return client[_0xc848('0x1')](_0xc848('0x2'),{'options':{'raw':![],'attributes':['id',_0xc848('0x3'),_0xc848('0x4'),_0xc848('0x5'),_0xc848('0x6'),_0xc848('0x7'),_0xc848('0x8'),'type','serverUrl'],'include':[{'model':_0xc848('0x9'),'as':_0xc848('0xa'),'attributes':['id',_0xc848('0x3')],'include':[{'model':_0xc848('0xb'),'as':_0xc848('0xc'),'attributes':['id','type',_0xc848('0xd'),_0xc848('0xe')],'include':[{'model':_0xc848('0xf'),'as':_0xc848('0xf'),'attributes':['id',_0xc848('0x3')]}]},{'model':_0xc848('0xb'),'as':_0xc848('0x10'),'attributes':['id',_0xc848('0x11'),'content','key',_0xc848('0x12'),_0xc848('0x13'),_0xc848('0xe')],'include':[{'model':_0xc848('0xf'),'as':'Variable','attributes':['id','name']}]},{'model':_0xc848('0xb'),'as':_0xc848('0x14'),'attributes':['id',_0xc848('0x11'),_0xc848('0xd'),_0xc848('0x15'),'nameField','customField',_0xc848('0xe')],'include':[{'model':_0xc848('0xf'),'as':_0xc848('0xf'),'attributes':['id',_0xc848('0x3')]}]},{'model':'Tag','as':_0xc848('0x16'),'attributes':['id',_0xc848('0x3')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index aeaadae..d21ba8d 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5fb=['remoteUri','tenantId','clientId','clientSecret','serverUrl','description','Configurations','ticketType','moduleCreate','Dynamics365Field','type','content','variableName','Variable','Descriptions','keyType','keyContent','Fields','idField','CloudProvider','data5','data7','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','username','password'];(function(_0x1a4cb0,_0x28a0ee){var _0x2805fc=function(_0x144bc2){while(--_0x144bc2){_0x1a4cb0['push'](_0x1a4cb0['shift']());}};_0x2805fc(++_0x28a0ee);}(_0xb5fb,0x172));var _0xbb5f=function(_0x4fdda9,_0x388021){_0x4fdda9=_0x4fdda9-0x0;var _0x4e71e9=_0xb5fb[_0x4fdda9];return _0x4e71e9;};'use strict';var client=require(_0xbb5f('0x0'));exports[_0xbb5f('0x1')]=function(){return function(_0x1aeade){return client[_0xbb5f('0x2')](_0xbb5f('0x3'),{'options':{'raw':![],'attributes':['id',_0xbb5f('0x4'),_0xbb5f('0x5'),_0xbb5f('0x6'),_0xbb5f('0x7'),_0xbb5f('0x8'),_0xbb5f('0x9'),_0xbb5f('0xa'),_0xbb5f('0xb'),_0xbb5f('0xc'),'modernAuthentication'],'include':[{'model':'Dynamics365Configuration','as':_0xbb5f('0xd'),'attributes':['id','name',_0xbb5f('0xe'),_0xbb5f('0xf'),'additionalSearchContact','openNewTab'],'include':[{'model':_0xbb5f('0x10'),'as':'Subjects','attributes':['id',_0xbb5f('0x11'),_0xbb5f('0x12'),_0xbb5f('0x13')],'include':[{'model':_0xbb5f('0x14'),'as':_0xbb5f('0x14'),'attributes':['id',_0xbb5f('0x4')]}]},{'model':_0xbb5f('0x10'),'as':_0xbb5f('0x15'),'attributes':['id','type',_0xbb5f('0x12'),'key',_0xbb5f('0x16'),_0xbb5f('0x17'),_0xbb5f('0x13')],'include':[{'model':'Variable','as':_0xbb5f('0x14'),'attributes':['id',_0xbb5f('0x4')]}]},{'model':'Dynamics365Field','as':_0xbb5f('0x18'),'attributes':['id',_0xbb5f('0x11'),_0xbb5f('0x12'),_0xbb5f('0x19'),'nameField','customField',_0xbb5f('0x13')],'include':[{'model':'Variable','as':_0xbb5f('0x14'),'attributes':['id',_0xbb5f('0x4')]}]}]},{'model':'CloudProvider','as':_0xbb5f('0x1a'),'attributes':['id','data2',_0xbb5f('0x1b'),_0xbb5f('0x1c')]}]},'log':_0xbb5f('0x3')});};}; \ No newline at end of file +var _0x351d=['moduleCreate','Dynamics365Field','type','content','Variable','key','keyType','keyContent','Fields','idField','customField','CloudProvider','data2','data7','../../client','Request','GetDynamics365Account','username','remoteUri','tenantId','clientSecret','serverUrl','description','Dynamics365Configuration','Configurations','ticketType'];(function(_0x3b9072,_0x263a6d){var _0x1d69bb=function(_0x4f2806){while(--_0x4f2806){_0x3b9072['push'](_0x3b9072['shift']());}};_0x1d69bb(++_0x263a6d);}(_0x351d,0x90));var _0xd351=function(_0x4c100f,_0x268ef2){_0x4c100f=_0x4c100f-0x0;var _0x4e803c=_0x351d[_0x4c100f];return _0x4e803c;};'use strict';var client=require(_0xd351('0x0'));exports['getDynamics365Accounts']=function(){return function(_0x109108){return client[_0xd351('0x1')](_0xd351('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xd351('0x3'),'password',_0xd351('0x4'),_0xd351('0x5'),'clientId',_0xd351('0x6'),_0xd351('0x7'),_0xd351('0x8'),'modernAuthentication'],'include':[{'model':_0xd351('0x9'),'as':_0xd351('0xa'),'attributes':['id','name',_0xd351('0xb'),_0xd351('0xc'),'additionalSearchContact','openNewTab'],'include':[{'model':_0xd351('0xd'),'as':'Subjects','attributes':['id',_0xd351('0xe'),_0xd351('0xf'),'variableName'],'include':[{'model':_0xd351('0x10'),'as':_0xd351('0x10'),'attributes':['id','name']}]},{'model':_0xd351('0xd'),'as':'Descriptions','attributes':['id','type',_0xd351('0xf'),_0xd351('0x11'),_0xd351('0x12'),_0xd351('0x13'),'variableName'],'include':[{'model':_0xd351('0x10'),'as':_0xd351('0x10'),'attributes':['id','name']}]},{'model':_0xd351('0xd'),'as':_0xd351('0x14'),'attributes':['id',_0xd351('0xe'),_0xd351('0xf'),_0xd351('0x15'),'nameField',_0xd351('0x16'),'variableName'],'include':[{'model':'Variable','as':_0xd351('0x10'),'attributes':['id','name']}]}]},{'model':_0xd351('0x17'),'as':_0xd351('0x17'),'attributes':['id',_0xd351('0x18'),'data5',_0xd351('0x19')]}]},'log':_0xd351('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index a632997..43cb9a8 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x726f=['content','variableName','Variable','keyContent','Fields','idField','nameField','GetFreshdeskAccount','../../client','getFreshdeskAccounts','Request','username','apiKey','remoteUri','serverUrl','FreshdeskConfiguration','Configurations','name','Tag','FreshdeskField','Subjects','type'];(function(_0x36018a,_0x54d3c7){var _0x420750=function(_0x573ac1){while(--_0x573ac1){_0x36018a['push'](_0x36018a['shift']());}};_0x420750(++_0x54d3c7);}(_0x726f,0xa2));var _0xf726=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x726f[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0xf726('0x0'));exports[_0xf726('0x1')]=function(){return function(_0x594bf2){return client[_0xf726('0x2')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id','name',_0xf726('0x3'),_0xf726('0x4'),_0xf726('0x5'),_0xf726('0x6')],'include':[{'model':_0xf726('0x7'),'as':_0xf726('0x8'),'attributes':['id',_0xf726('0x9')],'include':[{'model':_0xf726('0xa'),'attributes':['id',_0xf726('0x9')]},{'model':_0xf726('0xb'),'as':_0xf726('0xc'),'attributes':['id',_0xf726('0xd'),_0xf726('0xe'),_0xf726('0xf')],'include':[{'model':_0xf726('0x10'),'as':_0xf726('0x10'),'attributes':['id',_0xf726('0x9')]}]},{'model':'FreshdeskField','as':'Descriptions','attributes':['id','type',_0xf726('0xe'),'key','keyType',_0xf726('0x11'),_0xf726('0xf')],'include':[{'model':'Variable','as':_0xf726('0x10'),'attributes':['id',_0xf726('0x9')]}]},{'model':_0xf726('0xb'),'as':_0xf726('0x12'),'attributes':['id',_0xf726('0xd'),_0xf726('0xe'),_0xf726('0x13'),_0xf726('0x14'),'customField',_0xf726('0xf')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xf726('0x9')]}]}]}]},'log':_0xf726('0x15')});};}; \ No newline at end of file +var _0xb2af=['Fields','nameField','GetFreshdeskAccount','../../client','getFreshdeskAccounts','Request','name','username','apiKey','remoteUri','serverUrl','Configurations','Tag','FreshdeskField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','keyContent'];(function(_0x1b2050,_0x309da3){var _0xb5643c=function(_0x55cc90){while(--_0x55cc90){_0x1b2050['push'](_0x1b2050['shift']());}};_0xb5643c(++_0x309da3);}(_0xb2af,0xd2));var _0xfb2a=function(_0x4c3730,_0x1e071d){_0x4c3730=_0x4c3730-0x0;var _0x56330a=_0xb2af[_0x4c3730];return _0x56330a;};'use strict';var client=require(_0xfb2a('0x0'));exports[_0xfb2a('0x1')]=function(){return function(_0xf5c2e0){return client[_0xfb2a('0x2')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id',_0xfb2a('0x3'),_0xfb2a('0x4'),_0xfb2a('0x5'),_0xfb2a('0x6'),_0xfb2a('0x7')],'include':[{'model':'FreshdeskConfiguration','as':_0xfb2a('0x8'),'attributes':['id',_0xfb2a('0x3')],'include':[{'model':_0xfb2a('0x9'),'attributes':['id','name']},{'model':_0xfb2a('0xa'),'as':_0xfb2a('0xb'),'attributes':['id',_0xfb2a('0xc'),_0xfb2a('0xd'),_0xfb2a('0xe')],'include':[{'model':_0xfb2a('0xf'),'as':_0xfb2a('0xf'),'attributes':['id',_0xfb2a('0x3')]}]},{'model':_0xfb2a('0xa'),'as':_0xfb2a('0x10'),'attributes':['id',_0xfb2a('0xc'),_0xfb2a('0xd'),_0xfb2a('0x11'),_0xfb2a('0x12'),_0xfb2a('0x13'),_0xfb2a('0xe')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0xfb2a('0xa'),'as':_0xfb2a('0x14'),'attributes':['id',_0xfb2a('0xc'),_0xfb2a('0xd'),'idField',_0xfb2a('0x15'),'customField','variableName'],'include':[{'model':_0xfb2a('0xf'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0xfb2a('0x16')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index c77c850..cc7c700 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa899=['variableName','../../client','getFreshsalesAccounts','GetFreshsalesAccount','name','username','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','Subjects','type','content','Variable','Descriptions','key','keyType','keyContent'];(function(_0x124037,_0x72eb62){var _0x489eb1=function(_0x1da511){while(--_0x1da511){_0x124037['push'](_0x124037['shift']());}};_0x489eb1(++_0x72eb62);}(_0xa899,0x155));var _0x9a89=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0xa899[_0x3c487b];return _0x1d65f6;};'use strict';var client=require(_0x9a89('0x0'));exports[_0x9a89('0x1')]=function(){return function(_0x2134fe){return client['Request'](_0x9a89('0x2'),{'options':{'raw':![],'attributes':['id',_0x9a89('0x3'),_0x9a89('0x4'),_0x9a89('0x5'),_0x9a89('0x6'),_0x9a89('0x7')],'include':[{'model':_0x9a89('0x8'),'as':_0x9a89('0x9'),'attributes':['id',_0x9a89('0x3')],'include':[{'model':_0x9a89('0xa'),'as':_0x9a89('0xb'),'attributes':['id',_0x9a89('0xc'),_0x9a89('0xd'),'variableName'],'include':[{'model':'Variable','as':_0x9a89('0xe'),'attributes':['id',_0x9a89('0x3')]}]},{'model':'FreshsalesField','as':_0x9a89('0xf'),'attributes':['id','type',_0x9a89('0xd'),_0x9a89('0x10'),_0x9a89('0x11'),_0x9a89('0x12'),_0x9a89('0x13')],'include':[{'model':_0x9a89('0xe'),'as':_0x9a89('0xe'),'attributes':['id','name']}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file +var _0x4873=['getFreshsalesAccounts','GetFreshsalesAccount','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','name','FreshsalesField','Subjects','content','variableName','Variable','Descriptions','key','../../client'];(function(_0x519958,_0x8db673){var _0x39de83=function(_0x331383){while(--_0x331383){_0x519958['push'](_0x519958['shift']());}};_0x39de83(++_0x8db673);}(_0x4873,0x1df));var _0x3487=function(_0x382d96,_0x3ba1ce){_0x382d96=_0x382d96-0x0;var _0x20a5a3=_0x4873[_0x382d96];return _0x20a5a3;};'use strict';var client=require(_0x3487('0x0'));exports[_0x3487('0x1')]=function(){return function(_0x332e18){return client['Request'](_0x3487('0x2'),{'options':{'raw':![],'attributes':['id','name','username',_0x3487('0x3'),_0x3487('0x4'),_0x3487('0x5')],'include':[{'model':_0x3487('0x6'),'as':_0x3487('0x7'),'attributes':['id',_0x3487('0x8')],'include':[{'model':_0x3487('0x9'),'as':_0x3487('0xa'),'attributes':['id','type',_0x3487('0xb'),_0x3487('0xc')],'include':[{'model':_0x3487('0xd'),'as':_0x3487('0xd'),'attributes':['id',_0x3487('0x8')]}]},{'model':'FreshsalesField','as':_0x3487('0xe'),'attributes':['id','type',_0x3487('0xb'),_0x3487('0xf'),'keyType','keyContent',_0x3487('0xc')],'include':[{'model':_0x3487('0xd'),'as':'Variable','attributes':['id',_0x3487('0x8')]}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index 8fd871b..b128ac9 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3cae=['Variable','SalesforceField','Descriptions','../../client','getSalesforceAccounts','Request','GetSalesforceAccount','name','username','remoteUri','clientId','securityToken','type','SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead','Subjects'];(function(_0x3769df,_0x5adb5a){var _0x27ee74=function(_0x1aef37){while(--_0x1aef37){_0x3769df['push'](_0x3769df['shift']());}};_0x27ee74(++_0x5adb5a);}(_0x3cae,0x117));var _0xe3ca=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x3cae[_0x2f3848];return _0x102668;};'use strict';var client=require(_0xe3ca('0x0'));exports[_0xe3ca('0x1')]=function(){return function(_0x39d2cb){return client[_0xe3ca('0x2')](_0xe3ca('0x3'),{'options':{'raw':![],'attributes':['id',_0xe3ca('0x4'),_0xe3ca('0x5'),'password',_0xe3ca('0x6'),_0xe3ca('0x7'),'clientSecret',_0xe3ca('0x8'),'serverUrl',_0xe3ca('0x9')],'include':[{'model':_0xe3ca('0xa'),'as':_0xe3ca('0xb'),'attributes':['id','name',_0xe3ca('0xc'),_0xe3ca('0xd'),_0xe3ca('0xe'),_0xe3ca('0xf'),_0xe3ca('0x10'),_0xe3ca('0x11'),_0xe3ca('0x12')],'include':[{'model':'SalesforceField','as':_0xe3ca('0x13'),'include':[{'model':'Variable','as':_0xe3ca('0x14'),'attributes':['id',_0xe3ca('0x4')]}]},{'model':_0xe3ca('0x15'),'as':_0xe3ca('0x16'),'include':[{'model':_0xe3ca('0x14'),'as':'Variable','attributes':['id','name']}]},{'model':_0xe3ca('0x15'),'as':'Fields','include':[{'model':_0xe3ca('0x14'),'as':_0xe3ca('0x14'),'attributes':['id','name']}]}]}]},'log':_0xe3ca('0x3')});};}; \ No newline at end of file +var _0x3149=['additionalSearchLead','SalesforceField','Variable','Descriptions','Fields','../../client','Request','GetSalesforceAccount','name','password','remoteUri','clientId','clientSecret','securityToken','type','SalesforceConfiguration','Configurations','moduleSearch','ticketType','additionalSearchAccount'];(function(_0x37522d,_0x1c637c){var _0x48075f=function(_0x5eeb0){while(--_0x5eeb0){_0x37522d['push'](_0x37522d['shift']());}};_0x48075f(++_0x1c637c);}(_0x3149,0x181));var _0x9314=function(_0x3df299,_0x1a02c3){_0x3df299=_0x3df299-0x0;var _0x5106d8=_0x3149[_0x3df299];return _0x5106d8;};'use strict';var client=require(_0x9314('0x0'));exports['getSalesforceAccounts']=function(){return function(_0x905bad){return client[_0x9314('0x1')](_0x9314('0x2'),{'options':{'raw':![],'attributes':['id',_0x9314('0x3'),'username',_0x9314('0x4'),_0x9314('0x5'),_0x9314('0x6'),_0x9314('0x7'),_0x9314('0x8'),'serverUrl',_0x9314('0x9')],'include':[{'model':_0x9314('0xa'),'as':_0x9314('0xb'),'attributes':['id',_0x9314('0x3'),_0x9314('0xc'),'moduleCreate',_0x9314('0xd'),'leadId',_0x9314('0xe'),'additionalSearchContact',_0x9314('0xf')],'include':[{'model':_0x9314('0x10'),'as':'Subjects','include':[{'model':_0x9314('0x11'),'as':'Variable','attributes':['id',_0x9314('0x3')]}]},{'model':_0x9314('0x10'),'as':_0x9314('0x12'),'include':[{'model':'Variable','as':_0x9314('0x11'),'attributes':['id',_0x9314('0x3')]}]},{'model':_0x9314('0x10'),'as':_0x9314('0x13'),'include':[{'model':_0x9314('0x11'),'as':_0x9314('0x11'),'attributes':['id',_0x9314('0x3')]}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 3281037..963bada 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2542=['content','variableName','Variable','key','keyType','Fields','idField','nameField','GetServicenowkAccount','../../client','getServicenowAccounts','Request','name','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','Subjects','type'];(function(_0x428935,_0x11fd0f){var _0x5c957e=function(_0x34821e){while(--_0x34821e){_0x428935['push'](_0x428935['shift']());}};_0x5c957e(++_0x11fd0f);}(_0x2542,0x169));var _0x2254=function(_0x4cd578,_0x794b88){_0x4cd578=_0x4cd578-0x0;var _0x3ec07d=_0x2542[_0x4cd578];return _0x3ec07d;};'use strict';var client=require(_0x2254('0x0'));exports[_0x2254('0x1')]=function(){return function(_0x2f3bcd){return client[_0x2254('0x2')]('GetServicenowAccount',{'options':{'raw':![],'attributes':['id',_0x2254('0x3'),'description',_0x2254('0x4'),_0x2254('0x5'),_0x2254('0x6'),_0x2254('0x7'),_0x2254('0x8')],'include':[{'model':'ServicenowConfiguration','as':_0x2254('0x9'),'attributes':['id',_0x2254('0x3')],'include':[{'model':_0x2254('0xa'),'as':_0x2254('0xb'),'attributes':['id',_0x2254('0xc'),_0x2254('0xd'),_0x2254('0xe')],'include':[{'model':_0x2254('0xf'),'as':_0x2254('0xf'),'attributes':['id',_0x2254('0x3')]}]},{'model':_0x2254('0xa'),'as':'Descriptions','attributes':['id',_0x2254('0xc'),_0x2254('0xd'),_0x2254('0x10'),_0x2254('0x11'),'keyContent','variableName'],'include':[{'model':_0x2254('0xf'),'as':_0x2254('0xf'),'attributes':['id',_0x2254('0x3')]}]},{'model':_0x2254('0xa'),'as':_0x2254('0x12'),'attributes':['id',_0x2254('0xc'),'content',_0x2254('0x13'),_0x2254('0x14'),'customField',_0x2254('0xe')],'include':[{'model':_0x2254('0xf'),'as':_0x2254('0xf'),'attributes':['id',_0x2254('0x3')]}]}]}]},'log':_0x2254('0x15')});};}; \ No newline at end of file +var _0x524e=['name','description','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','Request','GetServicenowAccount'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x524e,0x15e));var _0xe524=function(_0x1bc173,_0x18de49){_0x1bc173=_0x1bc173-0x0;var _0x7d18bd=_0x524e[_0x1bc173];return _0x7d18bd;};'use strict';var client=require('../../client');exports['getServicenowAccounts']=function(){return function(_0x353d8a){return client[_0xe524('0x0')](_0xe524('0x1'),{'options':{'raw':![],'attributes':['id',_0xe524('0x2'),_0xe524('0x3'),_0xe524('0x4'),_0xe524('0x5'),_0xe524('0x6'),_0xe524('0x7'),_0xe524('0x8')],'include':[{'model':'ServicenowConfiguration','as':_0xe524('0x9'),'attributes':['id',_0xe524('0x2')],'include':[{'model':_0xe524('0xa'),'as':'Subjects','attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0xd')],'include':[{'model':_0xe524('0xe'),'as':_0xe524('0xe'),'attributes':['id',_0xe524('0x2')]}]},{'model':_0xe524('0xa'),'as':_0xe524('0xf'),'attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0x10'),_0xe524('0x11'),_0xe524('0x12'),_0xe524('0xd')],'include':[{'model':_0xe524('0xe'),'as':_0xe524('0xe'),'attributes':['id','name']}]},{'model':'ServicenowField','as':_0xe524('0x13'),'attributes':['id',_0xe524('0xb'),_0xe524('0xc'),_0xe524('0x14'),_0xe524('0x15'),'customField',_0xe524('0xd')],'include':[{'model':'Variable','as':_0xe524('0xe'),'attributes':['id',_0xe524('0x2')]}]}]}]},'log':'GetServicenowkAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index 17d8574..ae01b98 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a85=['serverUrl','Configurations','SugarcrmField','type','content','Variable','Descriptions','key','keyType','keyContent','variableName','name','Fields','idField','nameField','Request','GetSugarcrmAccount','password','remoteUri'];(function(_0x24e79d,_0x19e8a3){var _0x2c7d13=function(_0x5249a6){while(--_0x5249a6){_0x24e79d['push'](_0x24e79d['shift']());}};_0x2c7d13(++_0x19e8a3);}(_0x1a85,0x178));var _0x51a8=function(_0x482214,_0x2550ff){_0x482214=_0x482214-0x0;var _0x38d0cb=_0x1a85[_0x482214];return _0x38d0cb;};'use strict';var client=require('../../client');exports['getSugarcrmAccounts']=function(){return function(_0x305f18){return client[_0x51a8('0x0')](_0x51a8('0x1'),{'options':{'raw':![],'attributes':['id','name','username',_0x51a8('0x2'),_0x51a8('0x3'),_0x51a8('0x4')],'include':[{'model':'SugarcrmConfiguration','as':_0x51a8('0x5'),'attributes':['id','name'],'include':[{'model':_0x51a8('0x6'),'as':'Subjects','attributes':['id',_0x51a8('0x7'),_0x51a8('0x8'),'variableName'],'include':[{'model':_0x51a8('0x9'),'as':'Variable','attributes':['id','name']}]},{'model':_0x51a8('0x6'),'as':_0x51a8('0xa'),'attributes':['id',_0x51a8('0x7'),_0x51a8('0x8'),_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe')],'include':[{'model':_0x51a8('0x9'),'as':_0x51a8('0x9'),'attributes':['id',_0x51a8('0xf')]}]},{'model':_0x51a8('0x6'),'as':_0x51a8('0x10'),'attributes':['id',_0x51a8('0x7'),_0x51a8('0x8'),_0x51a8('0x11'),_0x51a8('0x12'),'customField',_0x51a8('0xe')],'include':[{'model':_0x51a8('0x9'),'as':_0x51a8('0x9'),'attributes':['id','name']}]}]}]},'log':_0x51a8('0x1')});};}; \ No newline at end of file +var _0xadb5=['idField','nameField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','password','remoteUri','serverUrl','Configurations','SugarcrmField','Subjects','type','content','variableName','Variable','Descriptions','keyContent','Fields'];(function(_0x44330c,_0x22f9b5){var _0x5b3cd9=function(_0x3fa058){while(--_0x3fa058){_0x44330c['push'](_0x44330c['shift']());}};_0x5b3cd9(++_0x22f9b5);}(_0xadb5,0xad));var _0x5adb=function(_0x2d185c,_0x5667a2){_0x2d185c=_0x2d185c-0x0;var _0x49e1ca=_0xadb5[_0x2d185c];return _0x49e1ca;};'use strict';var client=require('../../client');exports[_0x5adb('0x0')]=function(){return function(_0x49fc17){return client[_0x5adb('0x1')](_0x5adb('0x2'),{'options':{'raw':![],'attributes':['id',_0x5adb('0x3'),'username',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6')],'include':[{'model':'SugarcrmConfiguration','as':_0x5adb('0x7'),'attributes':['id',_0x5adb('0x3')],'include':[{'model':_0x5adb('0x8'),'as':_0x5adb('0x9'),'attributes':['id',_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc')],'include':[{'model':_0x5adb('0xd'),'as':_0x5adb('0xd'),'attributes':['id',_0x5adb('0x3')]}]},{'model':_0x5adb('0x8'),'as':_0x5adb('0xe'),'attributes':['id',_0x5adb('0xa'),_0x5adb('0xb'),'key','keyType',_0x5adb('0xf'),_0x5adb('0xc')],'include':[{'model':_0x5adb('0xd'),'as':'Variable','attributes':['id',_0x5adb('0x3')]}]},{'model':'SugarcrmField','as':_0x5adb('0x10'),'attributes':['id','type',_0x5adb('0xb'),_0x5adb('0x11'),_0x5adb('0x12'),'customField',_0x5adb('0xc')],'include':[{'model':_0x5adb('0xd'),'as':_0x5adb('0xd'),'attributes':['id','name']}]}]}]},'log':_0x5adb('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 9ada684..49434ca 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88dc=['Subjects','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField','GetVtigerAccount','../../client','getVtigerAccounts','Request','name','description','username','serverUrl','VtigerConfiguration','Configurations','VtigerField'];(function(_0x246227,_0x12bfcb){var _0x37bd4a=function(_0x4670f4){while(--_0x4670f4){_0x246227['push'](_0x246227['shift']());}};_0x37bd4a(++_0x12bfcb);}(_0x88dc,0xfe));var _0xc88d=function(_0xe7da70,_0x3dd724){_0xe7da70=_0xe7da70-0x0;var _0xca594=_0x88dc[_0xe7da70];return _0xca594;};'use strict';var client=require(_0xc88d('0x0'));exports[_0xc88d('0x1')]=function(){return function(_0x4c02e0){return client[_0xc88d('0x2')]('GetVtigerAccount',{'options':{'raw':![],'attributes':['id',_0xc88d('0x3'),_0xc88d('0x4'),_0xc88d('0x5'),'accessKey','remoteUri',_0xc88d('0x6')],'include':[{'model':_0xc88d('0x7'),'as':_0xc88d('0x8'),'attributes':['id','name'],'include':[{'model':_0xc88d('0x9'),'as':_0xc88d('0xa'),'attributes':['id',_0xc88d('0xb'),_0xc88d('0xc'),_0xc88d('0xd')],'include':[{'model':_0xc88d('0xe'),'as':_0xc88d('0xe'),'attributes':['id',_0xc88d('0x3')]}]},{'model':_0xc88d('0x9'),'as':_0xc88d('0xf'),'attributes':['id',_0xc88d('0xb'),'content',_0xc88d('0x10'),_0xc88d('0x11'),_0xc88d('0x12'),_0xc88d('0xd')],'include':[{'model':_0xc88d('0xe'),'as':_0xc88d('0xe'),'attributes':['id',_0xc88d('0x3')]}]},{'model':_0xc88d('0x9'),'as':_0xc88d('0x13'),'attributes':['id',_0xc88d('0xb'),_0xc88d('0xc'),_0xc88d('0x14'),_0xc88d('0x15'),_0xc88d('0x16'),_0xc88d('0xd')],'include':[{'model':_0xc88d('0xe'),'as':_0xc88d('0xe'),'attributes':['id','name']}]}]}]},'log':_0xc88d('0x17')});};}; \ No newline at end of file +var _0x2c62=['Subjects','type','variableName','Variable','Descriptions','content','keyType','keyContent','Fields','customField','../../client','getVtigerAccounts','Request','GetVtigerAccount','name','description','username','remoteUri','serverUrl','VtigerConfiguration','Configurations','VtigerField'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x2c62,0x196));var _0x22c6=function(_0x125414,_0x440af9){_0x125414=_0x125414-0x0;var _0x2dfd84=_0x2c62[_0x125414];return _0x2dfd84;};'use strict';var client=require(_0x22c6('0x0'));exports[_0x22c6('0x1')]=function(){return function(_0x30288a){return client[_0x22c6('0x2')](_0x22c6('0x3'),{'options':{'raw':![],'attributes':['id',_0x22c6('0x4'),_0x22c6('0x5'),_0x22c6('0x6'),'accessKey',_0x22c6('0x7'),_0x22c6('0x8')],'include':[{'model':_0x22c6('0x9'),'as':_0x22c6('0xa'),'attributes':['id','name'],'include':[{'model':_0x22c6('0xb'),'as':_0x22c6('0xc'),'attributes':['id',_0x22c6('0xd'),'content',_0x22c6('0xe')],'include':[{'model':_0x22c6('0xf'),'as':_0x22c6('0xf'),'attributes':['id',_0x22c6('0x4')]}]},{'model':_0x22c6('0xb'),'as':_0x22c6('0x10'),'attributes':['id',_0x22c6('0xd'),_0x22c6('0x11'),'key',_0x22c6('0x12'),_0x22c6('0x13'),_0x22c6('0xe')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0x22c6('0xb'),'as':_0x22c6('0x14'),'attributes':['id','type',_0x22c6('0x11'),'idField','nameField',_0x22c6('0x15'),_0x22c6('0xe')],'include':[{'model':_0x22c6('0xf'),'as':_0x22c6('0xf'),'attributes':['id',_0x22c6('0x4')]}]}]}]},'log':_0x22c6('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index f2a278c..4eb3e3d 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1572=['username','password','token','remoteUri','authType','serverUrl','type','Configurations','Tag','ZendeskField','Subjects','variableName','Variable','Descriptions','content','key','keyType','keyContent','idField','nameField','customField','../../client','getZendeskAccounts','GetZendeskAccount','name'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x1572,0x92));var _0x2157=function(_0x18ac29,_0x45a21f){_0x18ac29=_0x18ac29-0x0;var _0x3ccaf9=_0x1572[_0x18ac29];return _0x3ccaf9;};'use strict';var client=require(_0x2157('0x0'));exports[_0x2157('0x1')]=function(){return function(_0x37d46b){return client['Request'](_0x2157('0x2'),{'options':{'raw':![],'attributes':['id',_0x2157('0x3'),_0x2157('0x4'),_0x2157('0x5'),_0x2157('0x6'),_0x2157('0x7'),_0x2157('0x8'),_0x2157('0x9'),_0x2157('0xa')],'include':[{'model':'ZendeskConfiguration','as':_0x2157('0xb'),'attributes':['id',_0x2157('0x3')],'include':[{'model':_0x2157('0xc'),'attributes':['id','name']},{'model':_0x2157('0xd'),'as':_0x2157('0xe'),'attributes':['id',_0x2157('0xa'),'content',_0x2157('0xf')],'include':[{'model':'Variable','as':_0x2157('0x10'),'attributes':['id','name']}]},{'model':_0x2157('0xd'),'as':_0x2157('0x11'),'attributes':['id',_0x2157('0xa'),_0x2157('0x12'),_0x2157('0x13'),_0x2157('0x14'),_0x2157('0x15'),_0x2157('0xf')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x2157('0x3')]}]},{'model':_0x2157('0xd'),'as':'Fields','attributes':['id',_0x2157('0xa'),_0x2157('0x12'),_0x2157('0x16'),_0x2157('0x17'),_0x2157('0x18'),'variableName'],'include':[{'model':_0x2157('0x10'),'as':_0x2157('0x10'),'attributes':['id',_0x2157('0x3')]}]}]}]},'log':_0x2157('0x2')});};}; \ No newline at end of file +var _0x4649=['ZendeskConfiguration','ZendeskField','Subjects','content','variableName','Variable','Descriptions','key','keyContent','Fields','idField','nameField','customField','../../client','getZendeskAccounts','Request','GetZendeskAccount','name','username','password','serverUrl','type'];(function(_0x200941,_0x83e581){var _0x15d44b=function(_0x59d0d1){while(--_0x59d0d1){_0x200941['push'](_0x200941['shift']());}};_0x15d44b(++_0x83e581);}(_0x4649,0x1af));var _0x9464=function(_0x20c465,_0x5d9a01){_0x20c465=_0x20c465-0x0;var _0x40b121=_0x4649[_0x20c465];return _0x40b121;};'use strict';var client=require(_0x9464('0x0'));exports[_0x9464('0x1')]=function(){return function(_0x46e743){return client[_0x9464('0x2')](_0x9464('0x3'),{'options':{'raw':![],'attributes':['id',_0x9464('0x4'),_0x9464('0x5'),_0x9464('0x6'),'token','remoteUri','authType',_0x9464('0x7'),_0x9464('0x8')],'include':[{'model':_0x9464('0x9'),'as':'Configurations','attributes':['id',_0x9464('0x4')],'include':[{'model':'Tag','attributes':['id',_0x9464('0x4')]},{'model':_0x9464('0xa'),'as':_0x9464('0xb'),'attributes':['id',_0x9464('0x8'),_0x9464('0xc'),_0x9464('0xd')],'include':[{'model':_0x9464('0xe'),'as':_0x9464('0xe'),'attributes':['id',_0x9464('0x4')]}]},{'model':_0x9464('0xa'),'as':_0x9464('0xf'),'attributes':['id',_0x9464('0x8'),_0x9464('0xc'),_0x9464('0x10'),'keyType',_0x9464('0x11'),_0x9464('0xd')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x9464('0x4')]}]},{'model':_0x9464('0xa'),'as':_0x9464('0x12'),'attributes':['id',_0x9464('0x8'),_0x9464('0xc'),_0x9464('0x13'),_0x9464('0x14'),_0x9464('0x15'),_0x9464('0xd')],'include':[{'model':_0x9464('0xe'),'as':_0x9464('0xe'),'attributes':['id',_0x9464('0x4')]}]}]}]},'log':_0x9464('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index e27bda3..93438fd 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3135=['GetZohoAccount','description','host','zone','clientId','clientSecret','serverUrl','code','Configurations','name','moduleCreate','Subjects','content','variableName','Variable','ZohoField','Descriptions','key','keyType','Fields','idField','nameField','getZohoAccounts'];(function(_0x22b8d9,_0x35b9f6){var _0x210964=function(_0x5d1e3c){while(--_0x5d1e3c){_0x22b8d9['push'](_0x22b8d9['shift']());}};_0x210964(++_0x35b9f6);}(_0x3135,0xb7));var _0x5313=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3135[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../../client');exports[_0x5313('0x0')]=function(){return function(_0x965370){return client['Request'](_0x5313('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x5313('0x2'),_0x5313('0x3'),_0x5313('0x4'),_0x5313('0x5'),_0x5313('0x6'),_0x5313('0x7'),_0x5313('0x8'),'refreshToken'],'include':[{'model':'ZohoConfiguration','as':_0x5313('0x9'),'attributes':['id',_0x5313('0xa'),_0x5313('0xb'),'moduleSearch',_0x5313('0x2')],'include':[{'model':'ZohoField','as':_0x5313('0xc'),'attributes':['id','type',_0x5313('0xd'),_0x5313('0xe')],'include':[{'model':_0x5313('0xf'),'as':_0x5313('0xf'),'attributes':['id','name']}]},{'model':_0x5313('0x10'),'as':_0x5313('0x11'),'attributes':['id','type',_0x5313('0xd'),_0x5313('0x12'),_0x5313('0x13'),'keyContent','variableName'],'include':[{'model':_0x5313('0xf'),'as':_0x5313('0xf'),'attributes':['id',_0x5313('0xa')]}]},{'model':_0x5313('0x10'),'as':_0x5313('0x14'),'attributes':['id','type',_0x5313('0xd'),_0x5313('0x15'),_0x5313('0x16'),'customField',_0x5313('0xe')],'include':[{'model':_0x5313('0xf'),'as':_0x5313('0xf'),'attributes':['id',_0x5313('0xa')]}]}]}]},'log':_0x5313('0x1')});};}; \ No newline at end of file +var _0xd788=['variableName','Variable','name','ZohoField','Descriptions','key','keyType','keyContent','idField','nameField','customField','../../client','getZohoAccounts','Request','GetZohoAccount','description','host','clientSecret','code','refreshToken','ZohoConfiguration','Configurations','moduleSearch','Subjects','type','content'];(function(_0x3fbeea,_0x59b594){var _0x479753=function(_0x2d874d){while(--_0x2d874d){_0x3fbeea['push'](_0x3fbeea['shift']());}};_0x479753(++_0x59b594);}(_0xd788,0xa7));var _0x8d78=function(_0x265ff2,_0x183632){_0x265ff2=_0x265ff2-0x0;var _0x3d723f=_0xd788[_0x265ff2];return _0x3d723f;};'use strict';var client=require(_0x8d78('0x0'));exports[_0x8d78('0x1')]=function(){return function(_0x423ff1){return client[_0x8d78('0x2')](_0x8d78('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8d78('0x4'),_0x8d78('0x5'),'zone','clientId',_0x8d78('0x6'),'serverUrl',_0x8d78('0x7'),_0x8d78('0x8')],'include':[{'model':_0x8d78('0x9'),'as':_0x8d78('0xa'),'attributes':['id','name','moduleCreate',_0x8d78('0xb'),_0x8d78('0x4')],'include':[{'model':'ZohoField','as':_0x8d78('0xc'),'attributes':['id',_0x8d78('0xd'),_0x8d78('0xe'),_0x8d78('0xf')],'include':[{'model':_0x8d78('0x10'),'as':'Variable','attributes':['id',_0x8d78('0x11')]}]},{'model':_0x8d78('0x12'),'as':_0x8d78('0x13'),'attributes':['id',_0x8d78('0xd'),_0x8d78('0xe'),_0x8d78('0x14'),_0x8d78('0x15'),_0x8d78('0x16'),_0x8d78('0xf')],'include':[{'model':'Variable','as':_0x8d78('0x10'),'attributes':['id','name']}]},{'model':_0x8d78('0x12'),'as':'Fields','attributes':['id',_0x8d78('0xd'),_0x8d78('0xe'),_0x8d78('0x17'),_0x8d78('0x18'),_0x8d78('0x19'),_0x8d78('0xf')],'include':[{'model':_0x8d78('0x10'),'as':_0x8d78('0x10'),'attributes':['id',_0x8d78('0x11')]}]}]}]},'log':_0x8d78('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index cae4218..01501dd 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2755=['number','string','map','length','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','../client','trim','silly','intervalIftime\x20called\x20with','isArray','resolve'];(function(_0x431a4d,_0x474639){var _0x78961e=function(_0xd0c27e){while(--_0xd0c27e){_0x431a4d['push'](_0x431a4d['shift']());}};_0x78961e(++_0x474639);}(_0x2755,0x1c9));var _0x5275=function(_0x18381f,_0x1497e1){_0x18381f=_0x18381f-0x0;var _0x517079=_0x2755[_0x18381f];return _0x517079;};var logger=require(_0x5275('0x0'))('dialer');var client=require(_0x5275('0x1'));function intervalIftime(_0x5e1111,_0x3f3093){const _0x12c41c=new Error()['stack']['replace'](/^Error/,'')[_0x5275('0x2')]();logger[_0x5275('0x3')](_0x5275('0x4'),_0x5e1111,_0x3f3093,_0x12c41c);const _0x52d656=Array[_0x5275('0x5')](_0x5e1111);if(!_0x5e1111||_0x52d656&&_0x5e1111['length']===0x0){return Promise[_0x5275('0x6')](![]);}else{var _0x2f48c8=[];var _0x47758c=[];var _0x265c84=_0x52d656?_0x5e1111:[_0x5e1111];var _0x53fc01=_0x265c84['every'](function(_0x1fd88f){return typeof _0x1fd88f===_0x5275('0x7');});var _0x37e468=_0x265c84['every'](function(_0x1f8d26){return typeof _0x1f8d26===_0x5275('0x8');});if(!_0x53fc01&&!_0x37e468){_0x2f48c8=_0x265c84[_0x5275('0x9')](function(_0x521a77){return _0x521a77['id'];});if(_0x2f48c8[_0x5275('0xa')]===0x0){_0x47758c=_0x265c84['map'](function(_0xfd287c){return _0xfd287c[_0x5275('0xb')];});}}else{if(_0x53fc01){_0x2f48c8=_0x2f48c8[_0x5275('0xc')](_0x265c84);}if(_0x37e468){_0x47758c=_0x47758c[_0x5275('0xc')](_0x265c84);}}return client[_0x5275('0xd')]('IntervalIftime',{'intervalIds':_0x2f48c8,'intervals':_0x47758c,'timezone':_0x3f3093,'log':_0x5275('0xe')});}}exports[_0x5275('0xf')]=intervalIftime; \ No newline at end of file +var _0xe505=['intervalIftime','../../../config/logger','dialer','stack','silly','intervalIftime\x20called\x20with','isArray','length','every','number','map','interval','concat','Request','IntervalIftime'];(function(_0x501e72,_0x4301a3){var _0x3bf720=function(_0x2ef3fa){while(--_0x2ef3fa){_0x501e72['push'](_0x501e72['shift']());}};_0x3bf720(++_0x4301a3);}(_0xe505,0xf1));var _0x5e50=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0xe505[_0x334599];return _0x4cdff2;};var logger=require(_0x5e50('0x0'))(_0x5e50('0x1'));var client=require('../client');function intervalIftime(_0x2a73ce,_0x37ffb9){const _0x28ef0b=new Error()[_0x5e50('0x2')]['replace'](/^Error/,'')['trim']();logger[_0x5e50('0x3')](_0x5e50('0x4'),_0x2a73ce,_0x37ffb9,_0x28ef0b);const _0x58d931=Array[_0x5e50('0x5')](_0x2a73ce);if(!_0x2a73ce||_0x58d931&&_0x2a73ce[_0x5e50('0x6')]===0x0){return Promise['resolve'](![]);}else{var _0x338c8b=[];var _0x454d28=[];var _0x18cb3d=_0x58d931?_0x2a73ce:[_0x2a73ce];var _0x53e077=_0x18cb3d[_0x5e50('0x7')](function(_0x3ac052){return typeof _0x3ac052===_0x5e50('0x8');});var _0x53a187=_0x18cb3d[_0x5e50('0x7')](function(_0x16db91){return typeof _0x16db91==='string';});if(!_0x53e077&&!_0x53a187){_0x338c8b=_0x18cb3d[_0x5e50('0x9')](function(_0x179482){return _0x179482['id'];});if(_0x338c8b[_0x5e50('0x6')]===0x0){_0x454d28=_0x18cb3d[_0x5e50('0x9')](function(_0x40455c){return _0x40455c[_0x5e50('0xa')];});}}else{if(_0x53e077){_0x338c8b=_0x338c8b[_0x5e50('0xb')](_0x18cb3d);}if(_0x53a187){_0x454d28=_0x454d28[_0x5e50('0xb')](_0x18cb3d);}}return client[_0x5e50('0xc')](_0x5e50('0xd'),{'intervalIds':_0x338c8b,'intervals':_0x454d28,'timezone':_0x37ffb9,'log':_0x5e50('0xd')});}}exports[_0x5e50('0xe')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 0b50b3b..eab80ed 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1dc6=['exten','queue','accountcode','toNumber','uniqueid','voiceDialReport','membername','TALKING','starttime','endtime','seconds','outbound','agent','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','interface','format','SIP/%s','lastAssignedTo','diff','queuecallerleaveAt','inbound'];(function(_0x18cc08,_0x34c324){var _0x230d93=function(_0x1d318e){while(--_0x1d318e){_0x18cc08['push'](_0x18cc08['shift']());}};_0x230d93(++_0x34c324);}(_0x1dc6,0x157));var _0x61dc=function(_0x4c4dac,_0x27da26){_0x4c4dac=_0x4c4dac-0x0;var _0x4ba252=_0x1dc6[_0x4c4dac];return _0x4ba252;};'use strict';var moment=require(_0x61dc('0x0'));var _=require(_0x61dc('0x1'));var util=require(_0x61dc('0x2'));var client=require(_0x61dc('0x3'));exports[_0x61dc('0x4')]=function(_0x3201e3){var _0x590cdf=_0x3201e3[_0x61dc('0x5')]||_0x3201e3[_0x61dc('0x6')];return client[_0x61dc('0x7')](_0x61dc('0x8'),{'body':{'channel':_0x61dc('0x9'),'membername':_0x3201e3['lastAssignedTo'],'interface':_['isNil'](_0x3201e3[_0x61dc('0xa')])?util[_0x61dc('0xb')](_0x61dc('0xc'),_0x3201e3[_0x61dc('0xd')]):_0x3201e3[_0x61dc('0xa')],'type':'TALKING','enterAt':_0x3201e3['queuecallerleaveAt'],'exitAt':_0x590cdf,'duration':moment(_0x590cdf)[_0x61dc('0xe')](_0x3201e3[_0x61dc('0xf')],'seconds'),'data1':_0x61dc('0x10'),'data2':_0x3201e3['calleridnum'],'data3':_0x3201e3[_0x61dc('0x11')],'data4':null,'data5':_0x3201e3[_0x61dc('0x12')],'role':'agent','internal':_0x3201e3[_0x61dc('0x13')]?_[_0x61dc('0x14')](_0x3201e3['accountcode']):undefined,'uniqueid':_0x3201e3[_0x61dc('0x15')]},'log':_0x61dc('0x8')});};exports[_0x61dc('0x16')]=function(_0x2005d3){return client[_0x61dc('0x7')](_0x61dc('0x8'),{'body':{'channel':_0x61dc('0x9'),'membername':_0x2005d3[_0x61dc('0x17')],'interface':_0x2005d3['interface'],'type':_0x61dc('0x18'),'enterAt':_0x2005d3[_0x61dc('0x19')],'exitAt':_0x2005d3[_0x61dc('0x1a')],'duration':moment(_0x2005d3['endtime'])[_0x61dc('0xe')](_0x2005d3['starttime'],_0x61dc('0x1b'))>=0x0?moment(_0x2005d3['endtime'])['diff'](_0x2005d3[_0x61dc('0x19')],_0x61dc('0x1b')):null,'data1':_0x61dc('0x1c'),'data2':_0x2005d3[_0x61dc('0x13')],'data3':_0x2005d3['exten'],'data4':_0x2005d3['dialstring']||null,'role':_0x61dc('0x1d'),'internal':_0x2005d3[_0x61dc('0x13')]?_[_0x61dc('0x14')](_0x2005d3[_0x61dc('0x13')]):undefined,'uniqueid':_0x2005d3[_0x61dc('0x15')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x432b=['lodash','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','isNil','interface','format','SIP/%s','lastAssignedTo','queuecallerleaveAt','diff','inbound','calleridnum','exten','queue','toNumber','accountcode','membername','TALKING','starttime','endtime','outbound','dialstring','agent','uniqueid','moment'];(function(_0x38323b,_0x5f79df){var _0x2b9af5=function(_0x576caa){while(--_0x576caa){_0x38323b['push'](_0x38323b['shift']());}};_0x2b9af5(++_0x5f79df);}(_0x432b,0x8b));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xb432('0x0'));var _=require(_0xb432('0x1'));var util=require('util');var client=require('../client');exports[_0xb432('0x2')]=function(_0xc5239b){var _0xae743f=_0xc5239b[_0xb432('0x3')]||_0xc5239b['queuecallerexitAt'];return client[_0xb432('0x4')](_0xb432('0x5'),{'body':{'channel':_0xb432('0x6'),'membername':_0xc5239b['lastAssignedTo'],'interface':_[_0xb432('0x7')](_0xc5239b[_0xb432('0x8')])?util[_0xb432('0x9')](_0xb432('0xa'),_0xc5239b[_0xb432('0xb')]):_0xc5239b[_0xb432('0x8')],'type':'TALKING','enterAt':_0xc5239b[_0xb432('0xc')],'exitAt':_0xae743f,'duration':moment(_0xae743f)[_0xb432('0xd')](_0xc5239b[_0xb432('0xc')],'seconds'),'data1':_0xb432('0xe'),'data2':_0xc5239b[_0xb432('0xf')],'data3':_0xc5239b[_0xb432('0x10')],'data4':null,'data5':_0xc5239b[_0xb432('0x11')],'role':'agent','internal':_0xc5239b['accountcode']?_[_0xb432('0x12')](_0xc5239b[_0xb432('0x13')]):undefined,'uniqueid':_0xc5239b['uniqueid']},'log':_0xb432('0x5')});};exports['voiceDialReport']=function(_0xd9525e){return client[_0xb432('0x4')](_0xb432('0x5'),{'body':{'channel':_0xb432('0x6'),'membername':_0xd9525e[_0xb432('0x14')],'interface':_0xd9525e[_0xb432('0x8')],'type':_0xb432('0x15'),'enterAt':_0xd9525e[_0xb432('0x16')],'exitAt':_0xd9525e['endtime'],'duration':moment(_0xd9525e[_0xb432('0x17')])[_0xb432('0xd')](_0xd9525e[_0xb432('0x16')],'seconds')>=0x0?moment(_0xd9525e['endtime'])['diff'](_0xd9525e[_0xb432('0x16')],'seconds'):null,'data1':_0xb432('0x18'),'data2':_0xd9525e[_0xb432('0x13')],'data3':_0xd9525e[_0xb432('0x10')],'data4':_0xd9525e[_0xb432('0x19')]||null,'role':_0xb432('0x1a'),'internal':_0xd9525e[_0xb432('0x13')]?_['toNumber'](_0xd9525e[_0xb432('0x13')]):undefined,'uniqueid':_0xd9525e[_0xb432('0x1b')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index ca65f09..0254ace 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 _0x5eb8=['GetSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x29ca73,_0x3d35ff){var _0x276bdc=function(_0x19e19b){while(--_0x19e19b){_0x29ca73['push'](_0x29ca73['shift']());}};_0x276bdc(++_0x3d35ff);}(_0x5eb8,0xb0));var _0x85eb=function(_0x54fe1c,_0x5d208c){_0x54fe1c=_0x54fe1c-0x0;var _0x460aaa=_0x5eb8[_0x54fe1c];return _0x460aaa;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x85eb('0x0')](_0x85eb('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x85eb('0x2'),_0x85eb('0x3')]},'log':_0x85eb('0x4')});}; \ No newline at end of file +var _0xd0a4=['previewRecallmeReminderInterval','GetSettings','../client','getSettings'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xd0a4,0x166));var _0x4d0a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0a4[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x4d0a('0x0'));exports[_0x4d0a('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x4d0a('0x2')]},'log':_0x4d0a('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 01f38c6..e507004 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 _0x1f65=['getTemplates','Request','name','html','GetTemplate','../client'];(function(_0x10f8f3,_0x21e890){var _0x2d0a23=function(_0x2565d2){while(--_0x2565d2){_0x10f8f3['push'](_0x10f8f3['shift']());}};_0x2d0a23(++_0x21e890);}(_0x1f65,0x185));var _0x51f6=function(_0x3beb4e,_0x2d1a69){_0x3beb4e=_0x3beb4e-0x0;var _0xd40198=_0x1f65[_0x3beb4e];return _0xd40198;};'use strict';var client=require(_0x51f6('0x0'));exports[_0x51f6('0x1')]=function(_0xdd6894){return function(_0x565034){return client[_0x51f6('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x51f6('0x3'),_0x51f6('0x4')]},'log':_0x51f6('0x5')});};}; \ No newline at end of file +var _0x62ef=['Request','GetTemplate','html','../client','getTemplates'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x62ef,0xd0));var _0xf62e=function(_0x3aa0ac,_0x5f5da6){_0x3aa0ac=_0x3aa0ac-0x0;var _0x568a11=_0x62ef[_0x3aa0ac];return _0x568a11;};'use strict';var client=require(_0xf62e('0x0'));exports[_0xf62e('0x1')]=function(_0x3182ed){return function(_0x5cad8f){return client[_0xf62e('0x2')](_0xf62e('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xf62e('0x4')]},'log':_0xf62e('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index ef9704b..4b3b073 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 _0xbda0=['data7','getTriggers','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','AnyConditions','value','action','data1','data2','data3','data5','data6'];(function(_0x45cd35,_0x41147c){var _0x16db84=function(_0x1ce5e9){while(--_0x1ce5e9){_0x45cd35['push'](_0x45cd35['shift']());}};_0x16db84(++_0x41147c);}(_0xbda0,0xa3));var _0x0bda=function(_0x3a5c10,_0x2094ca){_0x3a5c10=_0x3a5c10-0x0;var _0x3d56e5=_0xbda0[_0x3a5c10];return _0x3d56e5;};'use strict';var client=require('../client');exports[_0x0bda('0x0')]=function(_0x3c8d65){return function(_0x2a4295){return client['Request'](_0x0bda('0x1'),{'options':{'raw':![],'attributes':['id',_0x0bda('0x2'),_0x0bda('0x3'),_0x0bda('0x4')],'include':[{'model':_0x0bda('0x5'),'as':_0x0bda('0x6'),'attributes':['id',_0x0bda('0x7'),_0x0bda('0x8'),'value']},{'model':_0x0bda('0x5'),'as':_0x0bda('0x9'),'attributes':['id',_0x0bda('0x7'),'operator',_0x0bda('0xa')]},{'model':'Action','as':'Actions','attributes':['id',_0x0bda('0xb'),_0x0bda('0xc'),_0x0bda('0xd'),_0x0bda('0xe'),'data4',_0x0bda('0xf'),_0x0bda('0x10'),_0x0bda('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x5945=['getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1','data2','data3','data4','data6','data7','../client'];(function(_0x1211bd,_0x5171bc){var _0x86d777=function(_0x42d011){while(--_0x42d011){_0x1211bd['push'](_0x1211bd['shift']());}};_0x86d777(++_0x5171bc);}(_0x5945,0xfb));var _0x5594=function(_0x1405c1,_0x532676){_0x1405c1=_0x1405c1-0x0;var _0x59aabc=_0x5945[_0x1405c1];return _0x59aabc;};'use strict';var client=require(_0x5594('0x0'));exports[_0x5594('0x1')]=function(_0x2bc64b){return function(_0x2656c7){return client[_0x5594('0x2')](_0x5594('0x3'),{'options':{'raw':![],'attributes':['id',_0x5594('0x4'),_0x5594('0x5'),'status'],'include':[{'model':_0x5594('0x6'),'as':_0x5594('0x7'),'attributes':['id',_0x5594('0x8'),_0x5594('0x9'),_0x5594('0xa')]},{'model':_0x5594('0x6'),'as':_0x5594('0xb'),'attributes':['id',_0x5594('0x8'),_0x5594('0x9'),'value']},{'model':_0x5594('0xc'),'as':_0x5594('0xd'),'attributes':['id',_0x5594('0xe'),_0x5594('0xf'),_0x5594('0x10'),_0x5594('0x11'),_0x5594('0x12'),'data5',_0x5594('0x13'),_0x5594('0x14')]}]},'log':_0x5594('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 4342d76..6fab072 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 _0xb5c2=['defaultuser','GetTrunk','getTrunks','name'];(function(_0x42ab00,_0x3b3f5e){var _0xd75c67=function(_0x31966a){while(--_0x31966a){_0x42ab00['push'](_0x42ab00['shift']());}};_0xd75c67(++_0x3b3f5e);}(_0xb5c2,0x1ce));var _0x2b5c=function(_0x16ce4e,_0x94d2c7){_0x16ce4e=_0x16ce4e-0x0;var _0x124d6d=_0xb5c2[_0x16ce4e];return _0x124d6d;};'use strict';var client=require('../client');exports[_0x2b5c('0x0')]=function(_0x34916e){return function(_0x1aa1b6){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x2b5c('0x1'),'registry',_0x2b5c('0x2')]},'log':_0x2b5c('0x3')});};}; \ No newline at end of file +var _0x1b69=['Request','GetTrunk','name','defaultuser'];(function(_0x3692c4,_0x2af72e){var _0x47b06d=function(_0x1d521f){while(--_0x1d521f){_0x3692c4['push'](_0x3692c4['shift']());}};_0x47b06d(++_0x2af72e);}(_0x1b69,0x1d0));var _0x91b6=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x1b69[_0x4a7631];return _0x1a5a6f;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x4dbd62){return function(_0x133e5e){return client[_0x91b6('0x0')](_0x91b6('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x91b6('0x2'),'registry',_0x91b6('0x3')]},'log':_0x91b6('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 535b004..6a12f0b 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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x2fdce9,_0x45dad8){var _0x527747=function(_0x1be7e9){while(--_0x1be7e9){_0x2fdce9['push'](_0x2fdce9['shift']());}};_0x527747(++_0x45dad8);}(_0x70e0,0x17b));var _0x070e=function(_0x14a1c5,_0x334363){_0x14a1c5=_0x14a1c5-0x0;var _0x382504=_0x70e0[_0x14a1c5];return _0x382504;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x3c68d1,_0x6238b2){var _0x620ba9=function(_0x4e3617){while(--_0x4e3617){_0x3c68d1['push'](_0x3c68d1['shift']());}};_0x620ba9(++_0x6238b2);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 7a7695e..b91b959 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 _0xe7c5=['CreateVoiceAgentReport','UpdateVoiceAgentReport','create','Request'];(function(_0x47c07d,_0xd9d19c){var _0x2036c3=function(_0x3122ec){while(--_0x3122ec){_0x47c07d['push'](_0x47c07d['shift']());}};_0x2036c3(++_0xd9d19c);}(_0xe7c5,0x18a));var _0x5e7c=function(_0x36fe51,_0x2267b3){_0x36fe51=_0x36fe51-0x0;var _0x30e4b1=_0xe7c5[_0x36fe51];return _0x30e4b1;};'use strict';var client=require('../client');exports[_0x5e7c('0x0')]=function(_0x46b5c8){return client[_0x5e7c('0x1')]('CreateVoiceAgentReport',{'body':_0x46b5c8,'log':_0x5e7c('0x2')});};exports['update']=function(_0x5a1840,_0x476b5e,_0x546dcb){return client[_0x5e7c('0x1')](_0x5e7c('0x3'),{'body':_0x5a1840,'options':{'where':{'uniqueid':_0x476b5e,'interface':_0x546dcb,'agentcomplete':!![]}},'log':_0x5e7c('0x3')});}; \ No newline at end of file +var _0x3a08=['../client','create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0x3a08,0x172));var _0x83a0=function(_0x4c8a11,_0x193f3e){_0x4c8a11=_0x4c8a11-0x0;var _0x45c948=_0x3a08[_0x4c8a11];return _0x45c948;};'use strict';var client=require(_0x83a0('0x0'));exports[_0x83a0('0x1')]=function(_0xed1a3a){return client[_0x83a0('0x2')]('CreateVoiceAgentReport',{'body':_0xed1a3a,'log':_0x83a0('0x3')});};exports['update']=function(_0x4bf04b,_0x1b9b43,_0x141c15){return client[_0x83a0('0x2')](_0x83a0('0x4'),{'body':_0x4bf04b,'options':{'where':{'uniqueid':_0x1b9b43,'interface':_0x141c15,'agentcomplete':!![]}},'log':_0x83a0('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 9b7318f..9d009c3 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 _0xa53e=['CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','duration','billableseconds','GetVoiceCallReports','lodash','../client','create','Request'];(function(_0x41c6b2,_0x5e63f5){var _0x18823c=function(_0x56232e){while(--_0x56232e){_0x41c6b2['push'](_0x41c6b2['shift']());}};_0x18823c(++_0x5e63f5);}(_0xa53e,0xce));var _0xea53=function(_0x3f2f75,_0x50dfdd){_0x3f2f75=_0x3f2f75-0x0;var _0x138214=_0xa53e[_0x3f2f75];return _0x138214;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0xea53('0x0'));var client=require(_0xea53('0x1'));exports[_0xea53('0x2')]=function(_0x6ff208){return client[_0xea53('0x3')](_0xea53('0x4'),{'body':_[_0xea53('0x5')](_0x6ff208,{'source':_0x6ff208[_0xea53('0x6')],'destinationcontext':_0x6ff208[_0xea53('0x7')],'callerid':_0x6ff208[_0xea53('0x8')],'amaflags':_0xea53('0x9')}),'log':'CreateVoiceCallReport'});};exports[_0xea53('0xa')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0xea53('0xb')],'createdAt':{'$between':[moment()['startOf'](_0xea53('0xc'))['format'](_0xea53('0xd')),moment()[_0xea53('0xe')](_0xea53('0xc'))[_0xea53('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xea53('0x10'),_0xea53('0x11'),_0xea53('0x12'),_0xea53('0x13')]},'log':_0xea53('0x14')});};}; \ No newline at end of file +var _0x3e0e=['callerid','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','GetVoiceCallReports','moment','util','../client','create','CreateVoiceCallReport','merge','calleridnum'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e0e,0x14f));var _0xe3e0=function(_0x42453c,_0x5cc5bf){_0x42453c=_0x42453c-0x0;var _0x5b3465=_0x3e0e[_0x42453c];return _0x5b3465;};'use strict';var moment=require(_0xe3e0('0x0'));var util=require(_0xe3e0('0x1'));var _=require('lodash');var client=require(_0xe3e0('0x2'));exports[_0xe3e0('0x3')]=function(_0x230604){return client['Request'](_0xe3e0('0x4'),{'body':_[_0xe3e0('0x5')](_0x230604,{'source':_0x230604[_0xe3e0('0x6')],'destinationcontext':_0x230604['context'],'callerid':_0x230604[_0xe3e0('0x7')],'amaflags':_0xe3e0('0x8')}),'log':_0xe3e0('0x4')});};exports[_0xe3e0('0x9')]=function(){return function(){return client[_0xe3e0('0xa')](_0xe3e0('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0xe3e0('0xc'))[_0xe3e0('0xd')](_0xe3e0('0xe')),moment()[_0xe3e0('0xf')](_0xe3e0('0xc'))[_0xe3e0('0xd')](_0xe3e0('0xe'))]}},'attributes':['type',_0xe3e0('0x10'),_0xe3e0('0x11'),'billableseconds']},'log':_0xe3e0('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 29c8d39..b81be67 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 _0x469d=['Request','CreateVoiceDialReport','create'];(function(_0x3a7a7d,_0x410e73){var _0x1bd27e=function(_0x32ee7b){while(--_0x32ee7b){_0x3a7a7d['push'](_0x3a7a7d['shift']());}};_0x1bd27e(++_0x410e73);}(_0x469d,0xd1));var _0xd469=function(_0xf133dd,_0x4c260d){_0xf133dd=_0xf133dd-0x0;var _0x399db6=_0x469d[_0xf133dd];return _0x399db6;};'use strict';var client=require('../client');exports[_0xd469('0x0')]=function(_0xe18d77){return client[_0xd469('0x1')](_0xd469('0x2'),{'body':_0xe18d77,'log':_0xd469('0x2')});}; \ No newline at end of file +var _0x31da=['create','Request','CreateVoiceDialReport','../client'];(function(_0xdfb29a,_0x3443b5){var _0x52f21e=function(_0x56598e){while(--_0x56598e){_0xdfb29a['push'](_0xdfb29a['shift']());}};_0x52f21e(++_0x3443b5);}(_0x31da,0xdf));var _0xa31d=function(_0xbe80e3,_0x4165de){_0xbe80e3=_0xbe80e3-0x0;var _0x5301ef=_0x31da[_0xbe80e3];return _0x5301ef;};'use strict';var client=require(_0xa31d('0x0'));exports[_0xa31d('0x1')]=function(_0x567c10){return client[_0xa31d('0x2')](_0xa31d('0x3'),{'body':_0x567c10,'log':_0xa31d('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 5ef1efd..1177fe4 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 _0x1d5b=['../client','getVoiceExtensions','Request','exten'];(function(_0x2718f2,_0x4b92a1){var _0x135725=function(_0x39c779){while(--_0x39c779){_0x2718f2['push'](_0x2718f2['shift']());}};_0x135725(++_0x4b92a1);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x349078,_0x1a7641){_0x349078=_0x349078-0x0;var _0x2a1f9b=_0x1d5b[_0x349078];return _0x2a1f9b;};'use strict';var client=require(_0xb1d5('0x0'));exports[_0xb1d5('0x1')]=function(){return function(){return client[_0xb1d5('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xb1d5('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xb1d5('0x1')});};}; \ No newline at end of file +var _0x6ea9=['GetVoiceExtension','exten','../client','getVoiceExtensions','Request'];(function(_0x88fab1,_0x1accff){var _0x20c571=function(_0x12de1c){while(--_0x12de1c){_0x88fab1['push'](_0x88fab1['shift']());}};_0x20c571(++_0x1accff);}(_0x6ea9,0x89));var _0x96ea=function(_0x10ccd9,_0x3b2baa){_0x10ccd9=_0x10ccd9-0x0;var _0x474e73=_0x6ea9[_0x10ccd9];return _0x474e73;};'use strict';var client=require(_0x96ea('0x0'));exports[_0x96ea('0x1')]=function(){return function(){return client[_0x96ea('0x2')](_0x96ea('0x3'),{'options':{'raw':!![],'attributes':['id',_0x96ea('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x96ea('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 584bc87..93c3427 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 _0x0b8a=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','name','TrunkBackup','Interval','Intervals','interval','../client','Request','GetVoiceQueue','acw','acwTimeout','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0xa1f267,_0x41bfb6){var _0x593bfa=function(_0x25b437){while(--_0x25b437){_0xa1f267['push'](_0xa1f267['shift']());}};_0x593bfa(++_0x41bfb6);}(_0x0b8a,0x11c));var _0xa0b8=function(_0x1094d7,_0x139d85){_0x1094d7=_0x1094d7-0x0;var _0x430101=_0x0b8a[_0x1094d7];return _0x430101;};'use strict';var client=require(_0xa0b8('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xa0b8('0x1')](_0xa0b8('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xa0b8('0x3'),_0xa0b8('0x4'),'autopause','monitor_format',_0xa0b8('0x5'),_0xa0b8('0x6'),_0xa0b8('0x7'),_0xa0b8('0x8'),_0xa0b8('0x9'),_0xa0b8('0xa'),_0xa0b8('0xb'),_0xa0b8('0xc'),'dialPredictiveInterval',_0xa0b8('0xd'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0xa0b8('0xe'),_0xa0b8('0xf'),'dialQueueProject',_0xa0b8('0x10'),_0xa0b8('0x11'),_0xa0b8('0x12'),_0xa0b8('0x13'),_0xa0b8('0x14'),_0xa0b8('0x15'),_0xa0b8('0x16'),_0xa0b8('0x17'),_0xa0b8('0x18'),_0xa0b8('0x19'),_0xa0b8('0x1a'),'dialAMDActive',_0xa0b8('0x1b'),_0xa0b8('0x1c'),_0xa0b8('0x1d'),_0xa0b8('0x1e'),'dialAMDMinWordLength',_0xa0b8('0x1f'),_0xa0b8('0x20'),_0xa0b8('0x21'),_0xa0b8('0x22'),_0xa0b8('0x23'),'dialRecallMeTimeout',_0xa0b8('0x24'),_0xa0b8('0x25'),_0xa0b8('0x26'),_0xa0b8('0x27'),_0xa0b8('0x28'),'monitor_format',_0xa0b8('0x29'),_0xa0b8('0x2a'),'dialCutDigit',_0xa0b8('0x2b'),_0xa0b8('0x2c'),'dialDropMaxRetry',_0xa0b8('0x2d'),'dialAbandonedMaxRetry',_0xa0b8('0x2e'),_0xa0b8('0x2f'),_0xa0b8('0x30'),_0xa0b8('0x31'),'dialAgentRejectRetryFrequency','mandatoryDisposition',_0xa0b8('0x32'),_0xa0b8('0x33'),_0xa0b8('0x34'),'dialPreviewRecallmeReminder'],'include':[{'model':_0xa0b8('0x35'),'as':_0xa0b8('0x35'),'attributes':['id','name',_0xa0b8('0x36'),_0xa0b8('0x37')]},{'model':_0xa0b8('0x38'),'as':_0xa0b8('0x39'),'attributes':['id',_0xa0b8('0x3a')]},{'model':_0xa0b8('0x35'),'as':_0xa0b8('0x3b'),'attributes':['id','name',_0xa0b8('0x36'),_0xa0b8('0x37')]},{'model':_0xa0b8('0x3c'),'as':_0xa0b8('0x3c'),'attributes':['id',_0xa0b8('0x3a')],'include':[{'model':_0xa0b8('0x3c'),'as':_0xa0b8('0x3d'),'attributes':['id',_0xa0b8('0x3a'),_0xa0b8('0x3e')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0xa382=['dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','Trunk','name','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialCutDigit','dialNoSuchNumberMaxRetry'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xa382,0x1cd));var _0x2a38=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xa382[_0x2be8c2];return _0x97f531;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client[_0x2a38('0x0')](_0x2a38('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x2a38('0x2'),_0x2a38('0x3'),_0x2a38('0x4'),_0x2a38('0x5'),_0x2a38('0x6'),_0x2a38('0x7'),_0x2a38('0x8'),'dialLimitChannel',_0x2a38('0x9'),_0x2a38('0xa'),_0x2a38('0xb'),_0x2a38('0xc'),_0x2a38('0xd'),_0x2a38('0xe'),_0x2a38('0xf'),_0x2a38('0x10'),_0x2a38('0x11'),_0x2a38('0x12'),_0x2a38('0x13'),'dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry',_0x2a38('0x14'),_0x2a38('0x15'),'dialNoAnswerRetryFrequency',_0x2a38('0x16'),'dialTimezone','dialGlobalInterval',_0x2a38('0x17'),_0x2a38('0x18'),_0x2a38('0x19'),_0x2a38('0x1a'),_0x2a38('0x1b'),_0x2a38('0x1c'),_0x2a38('0x1d'),_0x2a38('0x1e'),_0x2a38('0x1f'),_0x2a38('0x20'),_0x2a38('0x21'),_0x2a38('0x22'),_0x2a38('0x23'),_0x2a38('0x24'),_0x2a38('0x25'),_0x2a38('0x26'),_0x2a38('0x27'),_0x2a38('0x28'),'dialQueueProject2',_0x2a38('0x5'),'strategy','dialRandomLastDigitCallerIdNumber',_0x2a38('0x29'),_0x2a38('0x2a'),_0x2a38('0x2b'),'dialDropMaxRetry',_0x2a38('0x2c'),_0x2a38('0x2d'),'dialAbandonedRetryFrequency',_0x2a38('0x2e'),_0x2a38('0x2f'),_0x2a38('0x30'),_0x2a38('0x31'),_0x2a38('0x32'),_0x2a38('0x33'),'dialPredictiveIntervalMinThreshold',_0x2a38('0x34'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x2a38('0x35'),'as':_0x2a38('0x35'),'attributes':['id',_0x2a38('0x36'),_0x2a38('0x37'),_0x2a38('0x38')]},{'model':_0x2a38('0x39'),'as':'mandatoryDispositionPause','attributes':['id',_0x2a38('0x36')]},{'model':_0x2a38('0x35'),'as':_0x2a38('0x3a'),'attributes':['id',_0x2a38('0x36'),_0x2a38('0x37'),'active']},{'model':_0x2a38('0x3b'),'as':'Interval','attributes':['id',_0x2a38('0x36')],'include':[{'model':_0x2a38('0x3b'),'as':_0x2a38('0x3c'),'attributes':['id',_0x2a38('0x36'),_0x2a38('0x3d')]}]}]},'log':_0x2a38('0x3e')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index a99bc8c..eb9815d 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(_0x12b892,_0x4f12ea){var _0x1cc118=function(_0x368b52){while(--_0x368b52){_0x12b892['push'](_0x12b892['shift']());}};_0x1cc118(++_0x4f12ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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(_0x51e924,_0x1669ef){var _0x4df4b4=function(_0x393f6d){while(--_0x393f6d){_0x51e924['push'](_0x51e924['shift']());}};_0x4df4b4(++_0x1669ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 931431f..25381d2 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 _0xb993=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xb993,0x138));var _0x3b99=function(_0x581dd1,_0x1da82f){_0x581dd1=_0x581dd1-0x0;var _0x11ea73=_0xb993[_0x581dd1];return _0x11ea73;};'use strict';var client=require(_0x3b99('0x0'));exports[_0x3b99('0x1')]=function(_0x21b383){return function(){return client['Request'](_0x3b99('0x2'),{'options':{'where':{'VoiceQueueId':_0x21b383,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x2ecb=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x3509bc,_0x15f09f){var _0x360da8=function(_0x4d402d){while(--_0x4d402d){_0x3509bc['push'](_0x3509bc['shift']());}};_0x360da8(++_0x15f09f);}(_0x2ecb,0x13e));var _0xb2ec=function(_0x95ad05,_0x3cadb6){_0x95ad05=_0x95ad05-0x0;var _0x2d79f4=_0x2ecb[_0x95ad05];return _0x2d79f4;};'use strict';var client=require('../client');exports[_0xb2ec('0x0')]=function(_0x3a56af){return function(){return client['Request'](_0xb2ec('0x1'),{'options':{'where':{'VoiceQueueId':_0x3a56af,'paused':!![]},'raw':!![]},'log':_0xb2ec('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 1b8c72c..4f015ea 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(_0x313b71,_0x5a3a0f){var _0x3a58de=function(_0x41dc9c){while(--_0x41dc9c){_0x313b71['push'](_0x313b71['shift']());}};_0x3a58de(++_0x5a3a0f);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x20d82c,_0x3fab0a){var _0x3567a5=function(_0x2e77a6){while(--_0x2e77a6){_0x20d82c['push'](_0x20d82c['shift']());}};_0x3567a5(++_0x3fab0a);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 66db8c1..560bb9d 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 _0xf617=['transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransfererexten','attended','../client','transfers','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','context','extension','blind','attendedTransfer','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum'];(function(_0x49b2de,_0x586aa2){var _0x4ca453=function(_0x542553){while(--_0x542553){_0x49b2de['push'](_0x49b2de['shift']());}};_0x4ca453(++_0x586aa2);}(_0xf617,0xeb));var _0x7f61=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf617[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7f61('0x0'));exports[_0x7f61('0x1')]={};exports[_0x7f61('0x2')]=function(_0x53278b){return client[_0x7f61('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x53278b[_0x7f61('0x4')],'transfererchannel':_0x53278b[_0x7f61('0x5')],'transferercalleridnum':_0x53278b[_0x7f61('0x6')],'transferercalleridname':_0x53278b[_0x7f61('0x7')],'transfererconnectedlinenum':_0x53278b[_0x7f61('0x8')],'transfererconnectedlinename':_0x53278b['transfererconnectedlinename'],'transfereraccountcode':_0x53278b['transfereraccountcode'],'transferercontext':_0x53278b[_0x7f61('0x9')],'transfererexten':_0x53278b[_0x7f61('0xa')],'transfererlinkedid':_0x53278b[_0x7f61('0xb')],'transfereechannel':_0x53278b[_0x7f61('0xc')],'transfereecalleridnum':_0x53278b[_0x7f61('0xd')],'transfereecalleridname':_0x53278b['transfereecalleridname'],'transfereeconnectedlinenum':_0x53278b['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x53278b[_0x7f61('0xe')],'transfereeaccountcode':_0x53278b[_0x7f61('0xf')],'transfereecontext':_0x53278b['transfereecontext'],'transfereeexten':_0x53278b['transfereeexten'],'transfereelinkedid':_0x53278b[_0x7f61('0x10')],'isexternal':_0x53278b['isexternal'],'context':_0x53278b[_0x7f61('0x11')],'extension':_0x53278b[_0x7f61('0x12')],'type':_0x7f61('0x13')},'log':'CreateVoiceTransferReport'});};exports[_0x7f61('0x14')]=function(_0x243989){return client[_0x7f61('0x3')](_0x7f61('0x15'),{'body':{'result':_0x243989[_0x7f61('0x4')],'transfererchannel':_0x243989[_0x7f61('0x16')],'transferercalleridnum':_0x243989['origtransferercalleridnum'],'transferercalleridname':_0x243989[_0x7f61('0x17')],'transfererconnectedlinenum':_0x243989['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x243989[_0x7f61('0x18')],'transfereraccountcode':_0x243989[_0x7f61('0x19')],'transferercontext':_0x243989['secondtransferercontext'],'transfererexten':_0x243989[_0x7f61('0x1a')],'transfererlinkedid':_0x243989[_0x7f61('0x1b')],'transfereechannel':_0x243989[_0x7f61('0x1c')],'transfereecalleridnum':_0x243989[_0x7f61('0x1d')],'transfereecalleridname':_0x243989['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x243989[_0x7f61('0x1e')],'transfereeconnectedlinename':_0x243989['transfertargetconnectedlinename'],'transfereeaccountcode':_0x243989[_0x7f61('0x1f')],'transfereecontext':_0x243989[_0x7f61('0x20')],'transfereeexten':_0x243989[_0x7f61('0x21')],'transfereelinkedid':_0x243989[_0x7f61('0x22')],'isexternal':_0x243989[_0x7f61('0x23')],'context':_0x243989['origtransferercontext'],'extension':_0x243989[_0x7f61('0x24')],'type':_0x7f61('0x25')},'log':_0x7f61('0x15')});}; \ No newline at end of file +var _0x669a=['secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','transfers','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','Request','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname'];(function(_0x2b9b5f,_0x24c34b){var _0xfab9e=function(_0x58c0f6){while(--_0x58c0f6){_0x2b9b5f['push'](_0x2b9b5f['shift']());}};_0xfab9e(++_0x24c34b);}(_0x669a,0xb2));var _0xa669=function(_0xde001,_0xe7b70e){_0xde001=_0xde001-0x0;var _0xa4d114=_0x669a[_0xde001];return _0xa4d114;};'use strict';var client=require('../client');exports[_0xa669('0x0')]={};exports[_0xa669('0x1')]=function(_0x473450){return client['Request'](_0xa669('0x2'),{'body':{'result':_0x473450['result'],'transfererchannel':_0x473450[_0xa669('0x3')],'transferercalleridnum':_0x473450[_0xa669('0x4')],'transferercalleridname':_0x473450[_0xa669('0x5')],'transfererconnectedlinenum':_0x473450['transfererconnectedlinenum'],'transfererconnectedlinename':_0x473450[_0xa669('0x6')],'transfereraccountcode':_0x473450['transfereraccountcode'],'transferercontext':_0x473450[_0xa669('0x7')],'transfererexten':_0x473450[_0xa669('0x8')],'transfererlinkedid':_0x473450[_0xa669('0x9')],'transfereechannel':_0x473450['transfereechannel'],'transfereecalleridnum':_0x473450[_0xa669('0xa')],'transfereecalleridname':_0x473450[_0xa669('0xb')],'transfereeconnectedlinenum':_0x473450[_0xa669('0xc')],'transfereeconnectedlinename':_0x473450[_0xa669('0xd')],'transfereeaccountcode':_0x473450[_0xa669('0xe')],'transfereecontext':_0x473450[_0xa669('0xf')],'transfereeexten':_0x473450[_0xa669('0x10')],'transfereelinkedid':_0x473450[_0xa669('0x11')],'isexternal':_0x473450[_0xa669('0x12')],'context':_0x473450[_0xa669('0x13')],'extension':_0x473450[_0xa669('0x14')],'type':'blind'},'log':_0xa669('0x2')});};exports[_0xa669('0x15')]=function(_0x552100){return client[_0xa669('0x16')](_0xa669('0x2'),{'body':{'result':_0x552100[_0xa669('0x17')],'transfererchannel':_0x552100[_0xa669('0x18')],'transferercalleridnum':_0x552100[_0xa669('0x19')],'transferercalleridname':_0x552100[_0xa669('0x1a')],'transfererconnectedlinenum':_0x552100[_0xa669('0x1b')],'transfererconnectedlinename':_0x552100[_0xa669('0x1c')],'transfereraccountcode':_0x552100[_0xa669('0x1d')],'transferercontext':_0x552100[_0xa669('0x1e')],'transfererexten':_0x552100[_0xa669('0x1f')],'transfererlinkedid':_0x552100['origtransfererlinkedid'],'transfereechannel':_0x552100[_0xa669('0x20')],'transfereecalleridnum':_0x552100['transfertargetcalleridnum'],'transfereecalleridname':_0x552100[_0xa669('0x21')],'transfereeconnectedlinenum':_0x552100[_0xa669('0x22')],'transfereeconnectedlinename':_0x552100['transfertargetconnectedlinename'],'transfereeaccountcode':_0x552100[_0xa669('0x23')],'transfereecontext':_0x552100[_0xa669('0x24')],'transfereeexten':_0x552100[_0xa669('0x25')],'transfereelinkedid':_0x552100[_0xa669('0x26')],'isexternal':_0x552100[_0xa669('0x12')],'context':_0x552100[_0xa669('0x27')],'extension':_0x552100[_0xa669('0x28')],'type':'attended'},'log':_0xa669('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index d66eea4..7402601 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 _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x3fe672,_0x27935d){var _0x3ed975=function(_0x4a1830){while(--_0x4a1830){_0x3fe672['push'](_0x3fe672['shift']());}};_0x3ed975(++_0x27935d);}(_0x7a54,0x106));var _0x47a5=function(_0x48a143,_0x5f259b){_0x48a143=_0x48a143-0x0;var _0x5934e0=_0x7a54[_0x48a143];return _0x5934e0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x38b708,_0x28e052){var _0x3d1743=function(_0x916791){while(--_0x916791){_0x38b708['push'](_0x38b708['shift']());}};_0x3d1743(++_0x28e052);}(_0x7a54,0x106));var _0x47a5=function(_0x3818ea,_0x414ef2){_0x3818ea=_0x3818ea-0x0;var _0x1301f6=_0x7a54[_0x3818ea];return _0x1301f6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+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 8751e41..6987a39 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 _0x5e68=['action','merge','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','info','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','resolve','push','format','user:%s'];(function(_0x5ee73b,_0x282c4c){var _0x22948a=function(_0x4bb79b){while(--_0x4bb79b){_0x5ee73b['push'](_0x5ee73b['shift']());}};_0x22948a(++_0x282c4c);}(_0x5e68,0x140));var _0x85e6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5e68[_0x432682];return _0x463d05;};'use strict';var _=require(_0x85e6('0x0'));var BPromise=require(_0x85e6('0x1'));var Redis=require(_0x85e6('0x2'));var util=require(_0x85e6('0x3'));var config=require('../../../../config/environment');var logger=require(_0x85e6('0x4'))(_0x85e6('0x5'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_['defaults'](config[_0x85e6('0x6')],{'host':_0x85e6('0x7'),'port':0x18eb});var io=require(_0x85e6('0x8'))(new Redis(config[_0x85e6('0x6')]));function emit(_0x5c828b,_0x7d2b27,_0x2bd9ff,_0x37229e,_0x3e7821){logger['info'](_0x85e6('0x9'),_0x5c828b,_0x7d2b27['id'],_0x2bd9ff,_0x37229e,JSON[_0x85e6('0xa')](_0x3e7821));io['to'](_0x2bd9ff)['emit'](_0x37229e,_0x3e7821);}exports['exec']=function(_0x5367ba,_0x3cb7de,_0x4a5f4e,_0x147a30){var _0x23b106,_0x1dfe66;var _0x3e1416={};var _0x2d7418;var _0x38587b=Number(_0x4a5f4e[_0x85e6('0xb')]);var _0x2323d9=_0x4a5f4e[_0x85e6('0xc')]?Boolean(Number(_0x4a5f4e[_0x85e6('0xc')])):![];var _0x2caaef;var _0x7519b0=![];if(!_[_0x85e6('0xd')](_0x4a5f4e[_0x85e6('0xe')])){if(_0x4a5f4e[_0x85e6('0xe')]=='1')_0x7519b0=!![];}if(!_0x7519b0){if(_0x147a30[_0x85e6('0xf')]){_0x3e1416['id']=_0x147a30[_0x85e6('0xf')];}}if(!_0x3e1416['id']){_0x3e1416[_0x85e6('0x10')]=_0x38587b;_0x2caaef=_0x4a5f4e[_0x85e6('0x11')]&&_0x4a5f4e[_0x85e6('0x11')]!=='0'?_0x4a5f4e[_0x85e6('0x11')][_0x85e6('0x12')](','):[_0x85e6('0x13')];_0x3e1416[_0x85e6('0x14')]=_[_0x85e6('0x15')](_0x2caaef,function(_0x9e6278){var _0x2f6504={};_0x2f6504[_0x9e6278]=_0x147a30[_0x85e6('0x16')]?_0x147a30[_0x85e6('0x17')]:_0x147a30[_0x85e6('0x18')];return _0x2f6504;});_0x2d7418=_0x147a30['routeId']?_0x147a30[_0x85e6('0x17')]:_0x147a30[_0x85e6('0x18')];}var _0x53bd11=['id',_0x85e6('0x19'),_0x85e6('0x1a'),_0x85e6('0x13'),_0x85e6('0x1b'),_0x85e6('0x1c'),_0x85e6('0x10'),_0x85e6('0x1d'),_0x85e6('0x1e'),_0x85e6('0x1f')];var _0x1cb155=_[_0x85e6('0x20')](_0x53bd11,_0x2caaef);BPromise['resolve']()[_0x85e6('0x21')](cmContactRpc[_0x85e6('0x22')]({'attributes':_0x1cb155,'where':_0x3e1416,'phone':_0x2d7418}))[_0x85e6('0x21')](function(_0x23640f){_0x1dfe66=_0x23640f;if(!_[_0x85e6('0x23')](_0x1dfe66)){if(_0x1dfe66[_0x85e6('0x24')]===0x1){_0x23b106=_0x1dfe66[0x0];logger[_0x85e6('0x25')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x147a30[_0x85e6('0x26')],_0x3cb7de['id'],_0x23b106['id']);}else{logger['info'](_0x85e6('0x27'),_0x147a30[_0x85e6('0x26')],_0x3cb7de['id'],_[_0x85e6('0x15')](_0x1dfe66,'id')['join'](','));}return;}else{logger[_0x85e6('0x25')](_0x85e6('0x28'),_0x147a30[_0x85e6('0x26')],_0x3cb7de['id']);var _0x591553={'ListId':_0x38587b};var _0x28cbef=_0x4a5f4e[_0x85e6('0x29')]&&_0x4a5f4e[_0x85e6('0x29')]!=='0'?_0x4a5f4e[_0x85e6('0x29')]:'phone';if(_0x2323d9){logger['info'](_0x85e6('0x2a'),_0x147a30[_0x85e6('0x26')],_0x3cb7de['id']);_0x591553[_0x28cbef]=_[_0x85e6('0xd')](_0x147a30[_0x85e6('0x16')])?_0x147a30[_0x85e6('0x18')]:_0x147a30['destcalleridnum'];if(_[_0x85e6('0xd')](_0x147a30[_0x85e6('0x16')])){_0x591553[_0x85e6('0x19')]=_0x147a30[_0x85e6('0x2b')]&&_0x147a30[_0x85e6('0x2b')]!==_0x85e6('0x2c')?_0x147a30[_0x85e6('0x2b')]:_0x85e6('0x2d');}else{_0x591553[_0x85e6('0x19')]=_0x147a30[_0x85e6('0x2e')]&&_0x147a30[_0x85e6('0x2e')]!==_0x85e6('0x2c')?_0x147a30[_0x85e6('0x2e')]:'Unknown';}return BPromise[_0x85e6('0x2f')]()[_0x85e6('0x21')](cmContactRpc['createContact'](_0x591553))[_0x85e6('0x21')](function(_0x25ca36){_0x23b106=_0x25ca36;_0x1dfe66[_0x85e6('0x30')](_0x25ca36);if(_0x23b106){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x147a30[_0x85e6('0x26')],_0x3cb7de['id'],_0x23b106['id']);}return;});}else{logger[_0x85e6('0x25')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x147a30[_0x85e6('0x26')],_0x3cb7de['id']);_0x591553[_0x28cbef]=_['isNil'](_0x147a30[_0x85e6('0x16')])?_0x147a30[_0x85e6('0x18')]:_0x147a30[_0x85e6('0x17')];if(_[_0x85e6('0xd')](_0x147a30[_0x85e6('0x16')])){_0x591553[_0x85e6('0x19')]=_0x147a30['calleridname']&&_0x147a30[_0x85e6('0x2b')]!==_0x85e6('0x2c')?_0x147a30[_0x85e6('0x2b')]:_0x85e6('0x2d');}else{_0x591553[_0x85e6('0x19')]=_0x147a30['destcalleridname']&&_0x147a30[_0x85e6('0x2e')]!==''?_0x147a30[_0x85e6('0x2e')]:_0x85e6('0x2d');}_0x23b106=_0x591553;_0x1dfe66[_0x85e6('0x30')](_0x591553);return;}}})['then'](function(){if(_0x5367ba){emit(_0x147a30['uniqueid'],_0x3cb7de,util[_0x85e6('0x31')](_0x85e6('0x32'),_0x5367ba['name']),util[_0x85e6('0x31')]('trigger:%s',_0x4a5f4e[_0x85e6('0x33')]['toLowerCase']()),{'evt':_[_0x85e6('0x34')](_0x147a30,{'autoCreate':_0x2323d9}),'contact':_0x23b106===undefined?{}:_0x23b106,'contacts':_0x1dfe66[_0x85e6('0x24')]===0x0?undefined:_0x1dfe66});}});}; \ No newline at end of file +var _0xaf9f=['calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','trigger:%s','merge','lodash','ioredis','util','../../../../config/environment','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','lastName','phone','mobile','fax','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','firstName'];(function(_0x1b1270,_0x4b4fe7){var _0x335d12=function(_0x320fd5){while(--_0x320fd5){_0x1b1270['push'](_0x1b1270['shift']());}};_0x335d12(++_0x4b4fe7);}(_0xaf9f,0x1b4));var _0xfaf9=function(_0x55b3b5,_0x254983){_0x55b3b5=_0x55b3b5-0x0;var _0x5297a9=_0xaf9f[_0x55b3b5];return _0x5297a9;};'use strict';var _=require(_0xfaf9('0x0'));var BPromise=require('bluebird');var Redis=require(_0xfaf9('0x1'));var util=require(_0xfaf9('0x2'));var config=require(_0xfaf9('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0xfaf9('0x4'));config[_0xfaf9('0x5')]=_[_0xfaf9('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xfaf9('0x7'))(new Redis(config[_0xfaf9('0x5')]));function emit(_0x44dbe6,_0x7ffdc6,_0x48babf,_0x1bfbf8,_0x4a8b44){logger[_0xfaf9('0x8')](_0xfaf9('0x9'),_0x44dbe6,_0x7ffdc6['id'],_0x48babf,_0x1bfbf8,JSON[_0xfaf9('0xa')](_0x4a8b44));io['to'](_0x48babf)[_0xfaf9('0xb')](_0x1bfbf8,_0x4a8b44);}exports[_0xfaf9('0xc')]=function(_0x31e9ad,_0x35f316,_0x5107bf,_0x260a5b){var _0x489db6,_0x497979;var _0x39e0f2={};var _0x3cb254;var _0x4baff2=Number(_0x5107bf['data1']);var _0xe2e4a7=_0x5107bf[_0xfaf9('0xd')]?Boolean(Number(_0x5107bf['data2'])):![];var _0x811fe9;var _0x4a39e6=![];if(!_[_0xfaf9('0xe')](_0x5107bf['data5'])){if(_0x5107bf[_0xfaf9('0xf')]=='1')_0x4a39e6=!![];}if(!_0x4a39e6){if(_0x260a5b[_0xfaf9('0x10')]){_0x39e0f2['id']=_0x260a5b[_0xfaf9('0x10')];}}if(!_0x39e0f2['id']){_0x39e0f2[_0xfaf9('0x11')]=_0x4baff2;_0x811fe9=_0x5107bf[_0xfaf9('0x12')]&&_0x5107bf[_0xfaf9('0x12')]!=='0'?_0x5107bf[_0xfaf9('0x12')][_0xfaf9('0x13')](','):['phone'];_0x39e0f2[_0xfaf9('0x14')]=_[_0xfaf9('0x15')](_0x811fe9,function(_0x462e5d){var _0x73baa6={};_0x73baa6[_0x462e5d]=_0x260a5b[_0xfaf9('0x16')]?_0x260a5b['destcalleridnum']:_0x260a5b['calleridnum'];return _0x73baa6;});_0x3cb254=_0x260a5b[_0xfaf9('0x16')]?_0x260a5b[_0xfaf9('0x17')]:_0x260a5b['calleridnum'];}var _0x420d21=['id','firstName',_0xfaf9('0x18'),_0xfaf9('0x19'),_0xfaf9('0x1a'),_0xfaf9('0x1b'),_0xfaf9('0x11'),'createdAt','scheduledAt','updatedAt'];var _0x5069bb=_[_0xfaf9('0x1c')](_0x420d21,_0x811fe9);BPromise[_0xfaf9('0x1d')]()['then'](cmContactRpc[_0xfaf9('0x1e')]({'attributes':_0x5069bb,'where':_0x39e0f2,'phone':_0x3cb254}))[_0xfaf9('0x1f')](function(_0x497eea){_0x497979=_0x497eea;if(!_[_0xfaf9('0x20')](_0x497979)){if(_0x497979[_0xfaf9('0x21')]===0x1){_0x489db6=_0x497979[0x0];logger[_0xfaf9('0x8')](_0xfaf9('0x22'),_0x260a5b[_0xfaf9('0x23')],_0x35f316['id'],_0x489db6['id']);}else{logger['info'](_0xfaf9('0x24'),_0x260a5b[_0xfaf9('0x23')],_0x35f316['id'],_[_0xfaf9('0x15')](_0x497979,'id')[_0xfaf9('0x25')](','));}return;}else{logger[_0xfaf9('0x8')](_0xfaf9('0x26'),_0x260a5b['uniqueid'],_0x35f316['id']);var _0x486750={'ListId':_0x4baff2};var _0x21ead6=_0x5107bf[_0xfaf9('0x27')]&&_0x5107bf[_0xfaf9('0x27')]!=='0'?_0x5107bf[_0xfaf9('0x27')]:'phone';if(_0xe2e4a7){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x260a5b[_0xfaf9('0x23')],_0x35f316['id']);_0x486750[_0x21ead6]=_[_0xfaf9('0xe')](_0x260a5b[_0xfaf9('0x16')])?_0x260a5b['calleridnum']:_0x260a5b['destcalleridnum'];if(_['isNil'](_0x260a5b['routeId'])){_0x486750[_0xfaf9('0x28')]=_0x260a5b['calleridname']&&_0x260a5b[_0xfaf9('0x29')]!==_0xfaf9('0x2a')?_0x260a5b['calleridname']:_0xfaf9('0x2b');}else{_0x486750['firstName']=_0x260a5b[_0xfaf9('0x2c')]&&_0x260a5b[_0xfaf9('0x2c')]!==_0xfaf9('0x2a')?_0x260a5b[_0xfaf9('0x2c')]:_0xfaf9('0x2b');}return BPromise[_0xfaf9('0x1d')]()['then'](cmContactRpc[_0xfaf9('0x2d')](_0x486750))[_0xfaf9('0x1f')](function(_0x2d2a18){_0x489db6=_0x2d2a18;_0x497979[_0xfaf9('0x2e')](_0x2d2a18);if(_0x489db6){logger[_0xfaf9('0x8')](_0xfaf9('0x2f'),_0x260a5b[_0xfaf9('0x23')],_0x35f316['id'],_0x489db6['id']);}return;});}else{logger[_0xfaf9('0x8')](_0xfaf9('0x30'),_0x260a5b[_0xfaf9('0x23')],_0x35f316['id']);_0x486750[_0x21ead6]=_[_0xfaf9('0xe')](_0x260a5b['routeId'])?_0x260a5b['calleridnum']:_0x260a5b[_0xfaf9('0x17')];if(_['isNil'](_0x260a5b[_0xfaf9('0x16')])){_0x486750['firstName']=_0x260a5b[_0xfaf9('0x29')]&&_0x260a5b[_0xfaf9('0x29')]!==_0xfaf9('0x2a')?_0x260a5b[_0xfaf9('0x29')]:_0xfaf9('0x2b');}else{_0x486750['firstName']=_0x260a5b[_0xfaf9('0x2c')]&&_0x260a5b[_0xfaf9('0x2c')]!==_0xfaf9('0x2a')?_0x260a5b['destcalleridname']:_0xfaf9('0x2b');}_0x489db6=_0x486750;_0x497979[_0xfaf9('0x2e')](_0x486750);return;}}})[_0xfaf9('0x1f')](function(){if(_0x31e9ad){emit(_0x260a5b['uniqueid'],_0x35f316,util['format'](_0xfaf9('0x31'),_0x31e9ad[_0xfaf9('0x32')]),util['format'](_0xfaf9('0x33'),_0x5107bf['action']['toLowerCase']()),{'evt':_[_0xfaf9('0x34')](_0x260a5b,{'autoCreate':_0xe2e4a7}),'contact':_0x489db6===undefined?{}:_0x489db6,'contacts':_0x497979[_0xfaf9('0x21')]===0x0?undefined:_0x497979});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 0fcc1bd..2966dce 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 _0x788e=['buildUri','isNil','data3','location','uriLocation','data4','windowWidth','800','data5','data6','600','winapp','winApplication','render','winArguments','format','user:%s','name','toLowerCase','jscripty','trigger:%s','exec','integration','queue','script','parse','search','replace','every','checkConditions','channel','some','AnyConditions','debug','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','message','event','agent','membername','lastevent','routeId','mailSubstatus','null','substatus','offlineMessage','created','equals','lodash','url','mustache','ioredis','./urlforward','./cmContact','./script','../../../config/logger','redis','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','deskAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','clone','motionChannel','undefined','voice','inspect','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','action','contactmanager','motionbar','browser','data1','TemplateId','data2','html'];(function(_0xf80b3,_0x25d5f3){var _0x10c489=function(_0x3c5aee){while(--_0x3c5aee){_0xf80b3['push'](_0xf80b3['shift']());}};_0x10c489(++_0x25d5f3);}(_0x788e,0x12e));var _0xe788=function(_0x49000a,_0x1389be){_0x49000a=_0x49000a-0x0;var _0x2dc5bb=_0x788e[_0x49000a];return _0x2dc5bb;};'use strict';var util=require('util');var _=require(_0xe788('0x0'));var url=require(_0xe788('0x1'));var Mustache=require(_0xe788('0x2'));var Redis=require(_0xe788('0x3'));var urlforward=require(_0xe788('0x4'));var integration=require('./integration');var cmContact=require(_0xe788('0x5'));var script=require(_0xe788('0x6'));var config=require('../../../config/environment');var logger=require(_0xe788('0x7'))('trigger');var ami=require('../ami');config[_0xe788('0x8')]=_['defaults'](config['redis'],{'host':_0xe788('0x9'),'port':0x18eb});var io=require(_0xe788('0xa'))(new Redis(config[_0xe788('0x8')]));var operators={'equals':function(_0x47ec65,_0x51811a){return _0x47ec65==_0x51811a;},'not_equals':function(_0xf7ab45,_0x519ee4){return _0xf7ab45!=_0x519ee4;}};var barAndWebActions=[_0xe788('0xb'),_0xe788('0x1'),'winapp'];function Trigger(_0x2b00ed){this['triggers']=_0x2b00ed[_0xe788('0xc')];this[_0xe788('0xd')]=_0x2b00ed['agents'];this[_0xe788('0xe')]=_0x2b00ed[_0xe788('0xe')];this[_0xe788('0xf')]=_0x2b00ed[_0xe788('0xf')];this[_0xe788('0x10')]=_0x2b00ed[_0xe788('0x10')];this[_0xe788('0x11')]=_0x2b00ed[_0xe788('0x11')];this[_0xe788('0x12')]=_0x2b00ed['freshdeskAccounts'];this[_0xe788('0x13')]=_0x2b00ed['salesforceAccounts'];this[_0xe788('0x14')]=_0x2b00ed[_0xe788('0x14')];this[_0xe788('0x15')]=_0x2b00ed[_0xe788('0x15')];this['deskAccounts']=_0x2b00ed['deskAccounts'];this['vtigerAccounts']=_0x2b00ed[_0xe788('0x16')];this[_0xe788('0x17')]=_0x2b00ed['servicenowAccounts'];this[_0xe788('0x18')]=_0x2b00ed[_0xe788('0x18')];this['freshsalesAccounts']=_0x2b00ed[_0xe788('0x19')];this[_0xe788('0x1a')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xe788('0x13')],'freshdesk':this[_0xe788('0x12')],'sugarcrm':this[_0xe788('0x14')],'zoho':this['zohoAccounts'],'desk':this[_0xe788('0x1b')],'vtiger':this[_0xe788('0x16')],'dynamics365':this['dynamics365Accounts'],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xe788('0x17')]};ami['on'](_0xe788('0x1c'),this[_0xe788('0x1d')][_0xe788('0x1e')](this));ami['on']('custom:agentconnect',this[_0xe788('0x1d')][_0xe788('0x1e')](this));ami['on']('custom:agentringnoanswer',this[_0xe788('0x1d')]['bind'](this));ami['on']('custom:agentcomplete',this['syncCustomEvent'][_0xe788('0x1e')](this));ami['on'](_0xe788('0x1f'),this[_0xe788('0x1d')][_0xe788('0x1e')](this));ami['on'](_0xe788('0x20'),this[_0xe788('0x1d')]['bind'](this));ami['on']('custom:agentbusy',this[_0xe788('0x1d')][_0xe788('0x1e')](this));ami['on'](_0xe788('0x21'),this[_0xe788('0x1d')][_0xe788('0x1e')](this));ami['on']('custom:agentreject',this[_0xe788('0x1d')][_0xe788('0x1e')](this));ami['on'](_0xe788('0x22'),this['syncCustomEvent']['bind'](this));ami['on'](_0xe788('0x23'),this['syncCustomEvent'][_0xe788('0x1e')](this));ami['on'](_0xe788('0x24'),this['syncCustomEvent']['bind'](this));ami['on'](_0xe788('0x25'),this[_0xe788('0x26')][_0xe788('0x1e')](this));ami['on'](_0xe788('0x27'),this['syncAgentDial']['bind'](this));ami['on']('custom:dialend',this[_0xe788('0x26')][_0xe788('0x1e')](this));ami['on'](_0xe788('0x28'),this[_0xe788('0x1d')]['bind'](this));ami['on']('custom:closedinteraction',this['syncCustomEvent'][_0xe788('0x1e')](this));ami['on']('custom:substatus',this[_0xe788('0x1d')][_0xe788('0x1e')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent'][_0xe788('0x1e')](this));ami['on'](_0xe788('0x29'),this['syncCustomEvent'][_0xe788('0x1e')](this));ami['on'](_0xe788('0x2a'),this[_0xe788('0x1d')][_0xe788('0x1e')](this));ami['on'](_0xe788('0x2b'),this[_0xe788('0x1d')][_0xe788('0x1e')](this));ami['on'](_0xe788('0x2c'),this[_0xe788('0x1d')]['bind'](this));}Trigger[_0xe788('0x2d')][_0xe788('0x2e')]=function(_0x4a58f4,_0x4d9e9c,_0x429198){logger[_0xe788('0x2f')](_0x4a58f4,_0x4d9e9c,JSON['stringify'](_0x429198));io['to'](_0x4a58f4)['emit'](_0x4d9e9c,_0x429198);};Trigger[_0xe788('0x2d')][_0xe788('0x1d')]=function(_0x3637a6){var _0x2f0144=_[_0xe788('0x30')](_0x3637a6);if(typeof _0x2f0144[_0xe788('0x31')]===_0xe788('0x32')){_0x2f0144[_0xe788('0x31')]=_0xe788('0x33');}logger['debug'](_0xe788('0x1d'),util[_0xe788('0x34')](_0x2f0144,{'showHidden':!![],'depth':null}));this[_0xe788('0x35')](_0x2f0144);};Trigger[_0xe788('0x2d')][_0xe788('0x26')]=function(_0x4ec584){if(this[_0xe788('0xd')][_0x4ec584[_0xe788('0x36')]]){this[_0xe788('0x1d')](_0x4ec584);}};Trigger['prototype']['checkTriggers']=function(_0x8fb179){var _0x3df817;for(var _0x27d647 in this[_0xe788('0xc')]){if(this[_0xe788('0xc')][_0xe788('0x37')](_0x27d647)){if(this[_0xe788('0xc')][_0x27d647][_0xe788('0x38')]){_0x3df817=this[_0xe788('0x39')](this['triggers'][_0x27d647],_0x8fb179);if(_0x3df817){_[_0xe788('0x3a')](_0x8fb179,_0x8fb179[_0xe788('0x3b')]);for(var _0x89c52e=0x0,_0x3bbd35,_0x2574e3,_0x2c38f4;_0x89c52e0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3a4318,_0x13c6eb){_0x3a4318=_0x3a4318-0x0;var _0x36d746=_0x5fc3[_0x3a4318];return _0x36d746;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ 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 21d783e..10ead3a 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 _0x28f5=['Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','dynamics365','../../../../config/environment','defaults','localhost','socket.io-emitter','redis','modernAuthentication','remoteUri','CloudProvider','resolve','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','userEmail','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','length','userId','calleridnum','POST','/systemusers(','body','headers','substring','lastIndexOf','toLowerCase','outbound','destcalleridnum','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','indexOf','content','ticketType','incident','incidents','assign','Subjects','getString','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','data7','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name'];(function(_0xb1c178,_0x3a4d02){var _0x5e885b=function(_0x436a81){while(--_0x436a81){_0xb1c178['push'](_0xb1c178['shift']());}};_0x5e885b(++_0x3a4d02);}(_0x28f5,0x14e));var _0x528f=function(_0x9b29c3,_0x1a656e){_0x9b29c3=_0x9b29c3-0x0;var _0x294ffc=_0x28f5[_0x9b29c3];return _0x294ffc;};'use strict';var _=require(_0x528f('0x0'));var rp=require(_0x528f('0x1'));var util=require('util');var intUtil=require(_0x528f('0x2'));var md5=require(_0x528f('0x3'));var Redis=require(_0x528f('0x4'));var logger=require('../../../../config/logger')(_0x528f('0x5'));var config=require(_0x528f('0x6'));config['redis']=_[_0x528f('0x7')](config['redis'],{'host':_0x528f('0x8'),'port':0x18eb});var io=require(_0x528f('0x9'))(new Redis(config[_0x528f('0xa')]));function getAuthToken(_0x724e68,_0x3b940e,_0x3ab61a){if(_0x724e68[_0x528f('0xb')]){_0x724e68[_0x528f('0xc')]=_0x724e68['CloudProvider']['data7'];_0x724e68['tenantId']=_0x724e68[_0x528f('0xd')]['data2'];return Promise[_0x528f('0xe')](_0x724e68['CloudProvider']['data5']);}var _0x19d829={'method':'POST','uri':_0x3b940e,'form':{'client_id':_0x724e68[_0x528f('0xf')],'resource':_0x724e68[_0x528f('0xc')],'username':_0x724e68[_0x528f('0x10')],'password':_0x724e68[_0x528f('0x11')],'grant_type':'password','client_secret':_0x724e68[_0x528f('0x12')]},'json':!![]};return rp(_0x19d829)[_0x528f('0x13')](function(_0x1929bf){return _0x1929bf[_0x528f('0x14')];})[_0x528f('0x15')](function(_0x199250){logger[_0x528f('0x16')]('['+[_0x3ab61a[_0x528f('0x17')]()]+_0x528f('0x18'));return _0x199250[_0x528f('0x19')];});}function getUser(_0x5c940a,_0x4e8444,_0x24f18e,_0x22344f,_0x421c66,_0x5739bc){return new Promise(function(_0x4fad68,_0xff058e){return getAuthToken(_0x4e8444,_0x22344f,_0x5739bc)[_0x528f('0x13')](function(_0x2596a4){var _0x19dcd3={'method':'GET','uri':_0x421c66+_0x528f('0x1a'),'headers':{'Authorization':_0x528f('0x1b')+_0x2596a4,'OData-Version':_0x528f('0x1c')},'json':!![]};return rp(_0x19dcd3);})['then'](function(_0xfcfb6e){var _0x614628=_0xfcfb6e[_0x528f('0x1d')];var _0x5a8933=![];var _0x51550b=null;if(!_['isNil'](_0x24f18e)){if(intUtil[_0x528f('0x1e')](_0x24f18e[_0x528f('0x1f')])){_0x5c940a[_0x528f('0x20')]=_0x24f18e[_0x528f('0x1f')];for(_0x51550b=0x0;_0x51550b<_0x614628['length'];_0x51550b++){if(_0x614628[_0x51550b][_0x528f('0x21')]===_0x24f18e[_0x528f('0x1f')]&&!_0x614628[_0x51550b][_0x528f('0x22')]){_0x5a8933=!![];logger[_0x528f('0x23')]('['+[_0x5739bc[_0x528f('0x17')]()]+_0x528f('0x24')+_0x614628[_0x51550b][_0x528f('0x25')]+'!');_0x5c940a['userId']=_0x614628[_0x51550b]['systemuserid'];}}}}if(!_0x5a8933){logger['info']('['+[_0x5739bc[_0x528f('0x17')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x5c940a[_0x528f('0x20')]=_0x4e8444[_0x528f('0x10')];for(_0x51550b=0x0;_0x51550b<_0x614628[_0x528f('0x26')];_0x51550b++){if(_0x614628[_0x51550b]['internalemailaddress']===_0x4e8444[_0x528f('0x10')]){_0x5c940a[_0x528f('0x27')]=_0x614628[_0x51550b][_0x528f('0x25')];}}}_0x4fad68(_0x5c940a);})[_0x528f('0x15')](function(_0x5573bd){_0xff058e(_0x5573bd['message']);});});}function createEndUser(_0x11e800,_0x5c9346,_0x2ef935,_0x5036c9,_0x479cbe,_0x212468,_0xc297b9){return new Promise(function(_0x527f55,_0x53fa48){return getAuthToken(_0x5c9346,_0x2ef935,_0x212468)[_0x528f('0x13')](function(_0x3f2ff7){var _0x1b3ad7=_0x212468['toLowerCase']()==='outbound'?_0x479cbe['destcalleridnum']:_0x479cbe[_0x528f('0x28')];var _0x23d11d={'method':_0x528f('0x29'),'uri':_0x5036c9+'contacts','body':{'fullname':_0x1b3ad7,'firstname':_0x1b3ad7,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x528f('0x2a')+_0x11e800[_0x528f('0x27')]+')'},'headers':{'Authorization':_0x528f('0x1b')+_0x3f2ff7,'OData-Version':_0x528f('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x23d11d[_0x528f('0x2b')][_0xc297b9]=_0x1b3ad7;return rp(_0x23d11d);})['then'](function(_0x290667){var _0x2dc711=_0x290667[_0x528f('0x2c')]['odata-entityid'];var _0x513f55=_0x2dc711[_0x528f('0x2d')](_0x2dc711[_0x528f('0x2e')]('(')+0x1,_0x2dc711[_0x528f('0x2e')](')'));_0x11e800['enduserId']=_0x513f55;_0x527f55(_0x11e800);})[_0x528f('0x15')](function(_0x18e4a8){_0x53fa48(_0x18e4a8['message']);});});}function getEndUser(_0x5ada04,_0x46fa27,_0x32204a,_0x3b8b72,_0x286d9a,_0x307cab,_0x161c33,_0x579247){var _0x23a0ab=_0x307cab[_0x528f('0x2f')]()===_0x528f('0x30')?_0x286d9a[_0x528f('0x31')]:_0x286d9a['calleridnum'];return getAuthToken(_0x46fa27,_0x32204a,_0x307cab)[_0x528f('0x13')](function(_0x228d84){_0x579247=_0x579247?_0x579247:_0x528f('0x32');var _0x2be497={'method':'GET','uri':_0x3b8b72+_0x528f('0x33')+_0x579247+_0x528f('0x34')+_0x579247+_0x528f('0x35')+_0x23a0ab['replace']('+',_0x528f('0x36'))+'\x27','headers':{'Authorization':_0x528f('0x1b')+_0x228d84,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2be497);})['then'](function(_0x16cbe1){var _0x43d848=![];if(!_0x16cbe1)return _0x43d848;var _0x52d2ee=_0x16cbe1[_0x528f('0x1d')];for(var _0x3726c4=0x0;_0x3726c4<_0x52d2ee[_0x528f('0x26')];_0x3726c4++){if(_0x52d2ee[_0x3726c4][_0x579247]===_0x23a0ab){_0x43d848=!![];_0x5ada04[_0x528f('0x37')]=_0x52d2ee[_0x3726c4][_0x528f('0x38')];}}return _0x43d848;})['then'](function(_0x302369){if(_0x302369)return _0x5ada04;if(_0x161c33===_0x528f('0x39')){logger['info']('['+[_0x307cab[_0x528f('0x17')]()]+_0x528f('0x3a'));return _0x5ada04;}return createEndUser(_0x5ada04,_0x46fa27,_0x32204a,_0x3b8b72,_0x286d9a,_0x307cab,_0x579247)[_0x528f('0x13')](function(_0x25e2cc){logger['info']('['+[_0x307cab[_0x528f('0x17')]()]+_0x528f('0x3b'),_0x25e2cc[_0x528f('0x37')]);return _0x25e2cc;});});}function getCustomFields(_0xf43b3c,_0x3651e9,_0x1a4012){var _0x2615c7={};if(_0xf43b3c[_0x528f('0x26')]>0x0){_[_0x528f('0x3c')](_0xf43b3c,function(_0xefa232){if(_[_0x528f('0x3d')]([_0x528f('0x3e'),_0x528f('0x3f')],_0xefa232[_0x528f('0x40')])&&_0xefa232[_0x528f('0x41')]&&!_0xefa232[_0x528f('0x42')]){var _0x3b49bf=_0xefa232['idField'][_0x528f('0x2f')]();var _0x4b397e=_0x3b49bf[_0x528f('0x2d')](0x0,_0x3b49bf[_0x528f('0x43')]('_'));var _0xd57489=_0x3b49bf['substring'](_0x3b49bf[_0x528f('0x43')]('_')+0x1);if(_0x4b397e===_0x1a4012){_0x2615c7[_0xd57489]=_0xefa232[_0x528f('0x44')];}}});}return _0x2615c7;}function getTicket(_0x1888b3,_0x4f5827,_0x2af799,_0x234b60,_0x2c02b1,_0x16378a,_0x36920a){return new Promise(function(_0x17cb5a,_0x43584d){var _0x2a6cc4;return getAuthToken(_0x4f5827,_0x2af799,_0x36920a)['then'](function(_0xbfc41d){if(_0x16378a[_0x528f('0x45')]===_0x528f('0x46')){_0x2a6cc4={'method':_0x528f('0x29'),'uri':_0x234b60+_0x528f('0x47'),'body':Object[_0x528f('0x48')]({},{'title':intUtil['getString'](_0x16378a[_0x528f('0x49')],_0x2c02b1,'\x20'),'description':intUtil[_0x528f('0x4a')](_0x16378a[_0x528f('0x4b')],_0x2c02b1,'\x0a'),'customerid_contact@odata.bind':_0x1888b3['enduserId']?_0x528f('0x4c')+_0x1888b3['enduserId']+')':undefined,'ownerid@odata.bind':_0x528f('0x2a')+_0x1888b3['userId']+')','caseorigincode':'1'},getCustomFields(_0x16378a[_0x528f('0x4d')],_0x2c02b1,_0x16378a[_0x528f('0x45')])),'headers':{'Authorization':_0x528f('0x1b')+_0xbfc41d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x16378a[_0x528f('0x45')]===_0x528f('0x4e')){var _0xfe4e48=_0x1888b3[_0x528f('0x37')]?[{'partyid_systemuser@odata.bind':_0x528f('0x2a')+_0x1888b3['userId']+')','participationtypemask':_0x1888b3[_0x528f('0x4f')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x528f('0x4c')+_0x1888b3[_0x528f('0x37')]+')','participationtypemask':_0x1888b3[_0x528f('0x4f')]===_0x528f('0x50')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x528f('0x2a')+_0x1888b3[_0x528f('0x27')]+')','participationtypemask':_0x1888b3['callDirection']===_0x528f('0x50')?0x2:0x1}];_0x2a6cc4={'method':_0x528f('0x29'),'uri':_0x234b60+'phonecalls','body':Object[_0x528f('0x48')]({},{'subject':intUtil[_0x528f('0x4a')](_0x16378a['Subjects'],_0x2c02b1,'\x20'),'phonenumber':String(_0x2c02b1['calleridnum']),'description':intUtil[_0x528f('0x4a')](_0x16378a[_0x528f('0x4b')],_0x2c02b1,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1888b3[_0x528f('0x37')]?_0x528f('0x4c')+_0x1888b3[_0x528f('0x37')]+')':undefined,'ownerid@odata.bind':_0x528f('0x2a')+_0x1888b3[_0x528f('0x27')]+')','directioncode':_0x1888b3[_0x528f('0x4f')]===_0x528f('0x50')?![]:!![],'phonecall_activity_parties':_0xfe4e48},getCustomFields(_0x16378a[_0x528f('0x4d')],_0x2c02b1,_0x16378a[_0x528f('0x45')])),'headers':{'Authorization':_0x528f('0x1b')+_0xbfc41d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2a6cc4);})['then'](function(_0x501a0e){var _0x303de0=_0x501a0e['headers']['odata-entityid'];var _0x1c48c7=_0x303de0[_0x528f('0x2d')](_0x303de0[_0x528f('0x2e')]('(')+0x1,_0x303de0[_0x528f('0x2e')](')'));_0x1888b3['ticketId']=_0x1c48c7;_0x17cb5a(_0x1888b3);})[_0x528f('0x15')](function(_0x4c1b26){_0x43584d(_0x4c1b26[_0x528f('0x19')]);});});}function emit(_0x5cc7a5,_0x537b03,_0x2dcea4,_0x15e4eb){var _0x2759a3={'uri':util[_0x528f('0x51')](_0x528f('0x52'),_0x5cc7a5,_0x2dcea4,_0x15e4eb)};io['to'](util[_0x528f('0x51')](_0x528f('0x53'),_0x537b03))[_0x528f('0x54')]('trigger:browser:url',_0x2759a3);}exports['cs']=function(_0x45762e,_0x2564fe,_0x2ae0c5,_0x4479e5,_0x15be87,_0x4bba38,_0x591540,_0x236a8b){var _0x3bf9af={};_0x4bba38['remoteUri']=_0x4bba38[_0x528f('0xb')]?intUtil['stripTrailingSlash'](_0x4bba38[_0x528f('0xd')][_0x528f('0x55')]):intUtil[_0x528f('0x56')](_0x4bba38[_0x528f('0xc')]);_0x4bba38['serverUrl']=intUtil[_0x528f('0x56')](_0x4bba38[_0x528f('0x57')]);_0x3bf9af[_0x528f('0x4f')]=_0x236a8b===_0x528f('0x50')||_0x236a8b==='unmanaged'?_0x528f('0x50'):'outbound';var _0x3b11cb=_0x4bba38[_0x528f('0xb')]?util['format'](_0x528f('0x58'),_0x4bba38[_0x528f('0xd')]['data7']):util['format'](_0x528f('0x58'),_0x4bba38[_0x528f('0xc')]);var _0x20e563=util[_0x528f('0x51')]('https://login.microsoftonline.com/%s/oauth2/token',_0x4bba38[_0x528f('0x59')]);var _0x10e93c=util[_0x528f('0x51')](_0x528f('0x5a'),_0x4bba38['serverUrl'],_0x2564fe['uniqueid'],md5(_0x2564fe[_0x528f('0x5b')]));if(_0x15be87&&_0x15be87[_0x528f('0x5c')]){logger[_0x528f('0x23')](_0x528f('0x5d'),_0x528f('0x5e'));_0x2564fe['recordingURL']=_0x10e93c;}else if(_0x591540&&_0x591540[_0x528f('0x5f')]&&_0x591540[_0x528f('0x5f')]!==_0x528f('0x60')){logger[_0x528f('0x23')](_0x528f('0x61'),_0x528f('0x5e'));_0x2564fe[_0x528f('0x62')]=_0x10e93c;}else{_0x2564fe[_0x528f('0x62')]='';}return getUser(_0x3bf9af,_0x4bba38,_0x4479e5,_0x20e563,_0x3b11cb,_0x236a8b)['then'](function(_0x43bac2){logger[_0x528f('0x23')]('['+_0x236a8b[_0x528f('0x17')]()+_0x528f('0x63'),_0x43bac2[_0x528f('0x27')]);logger[_0x528f('0x23')]('['+_0x236a8b['toUpperCase']()+_0x528f('0x64'),_0x43bac2[_0x528f('0x20')]);return getEndUser(_0x43bac2,_0x4bba38,_0x20e563,_0x3b11cb,_0x2564fe,_0x236a8b,_0x2ae0c5[_0x528f('0x65')],_0x2ae0c5['additionalSearchContact']);})[_0x528f('0x13')](function(_0x551a9a){logger['info']('['+_0x236a8b[_0x528f('0x17')]()+_0x528f('0x66'),_0x551a9a[_0x528f('0x37')]);logger[_0x528f('0x23')]('['+_0x236a8b['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x2564fe['calleridnum']);return getTicket(_0x551a9a,_0x4bba38,_0x20e563,_0x3b11cb,_0x2564fe,_0x2ae0c5,_0x236a8b);})['then'](function(_0x32628a){logger[_0x528f('0x23')](util['format']('['+_0x236a8b[_0x528f('0x17')]()+_0x528f('0x67'),_0x2ae0c5[_0x528f('0x45')],_0x32628a[_0x528f('0x68')]));logger[_0x528f('0x23')](util[_0x528f('0x51')]('['+_0x236a8b['toUpperCase']()+_0x528f('0x69'),_0x236a8b));if(_0x236a8b!==_0x528f('0x6a')&&_0x2ae0c5[_0x528f('0x6b')]){logger[_0x528f('0x23')]('['+_0x236a8b['toUpperCase']()+']',_0x528f('0x6c'));emit(_0x4bba38[_0x528f('0xc')],_0x4479e5[_0x528f('0x6d')],_0x2ae0c5['ticketType'],_0x32628a[_0x528f('0x68')]);}})[_0x528f('0x15')](function(_0x62ee5f){logger['error']('['+_0x236a8b['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x62ee5f[_0x528f('0x19')]);console[_0x528f('0x16')](_0x528f('0x6e'),_0x62ee5f);});}; \ No newline at end of file +var _0x06bf=['nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','phonecall','queue','callDirection','phonecalls','Subjects','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','serverUrl','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','ioredis','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','POST','clientId','username','password','clientSecret','then','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','userEmail','length','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','body','headers','substring','lastIndexOf','enduserId','outbound','telephone1','&$filter=','\x20eq\x20\x27','replace'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x06bf,0x110));var _0xf06b=function(_0x1dac1f,_0x4d84e9){_0x1dac1f=_0x1dac1f-0x0;var _0x10f42f=_0x06bf[_0x1dac1f];return _0x10f42f;};'use strict';var _=require(_0xf06b('0x0'));var rp=require(_0xf06b('0x1'));var util=require('util');var intUtil=require(_0xf06b('0x2'));var md5=require('md5');var Redis=require(_0xf06b('0x3'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0xf06b('0x4'));config[_0xf06b('0x5')]=_[_0xf06b('0x6')](config[_0xf06b('0x5')],{'host':_0xf06b('0x7'),'port':0x18eb});var io=require(_0xf06b('0x8'))(new Redis(config[_0xf06b('0x5')]));function getAuthToken(_0x183840,_0x15d2e2,_0x372dfa){if(_0x183840[_0xf06b('0x9')]){_0x183840[_0xf06b('0xa')]=_0x183840[_0xf06b('0xb')][_0xf06b('0xc')];_0x183840[_0xf06b('0xd')]=_0x183840[_0xf06b('0xb')]['data2'];return Promise['resolve'](_0x183840['CloudProvider']['data5']);}var _0x1aff31={'method':_0xf06b('0xe'),'uri':_0x15d2e2,'form':{'client_id':_0x183840[_0xf06b('0xf')],'resource':_0x183840['remoteUri'],'username':_0x183840[_0xf06b('0x10')],'password':_0x183840['password'],'grant_type':_0xf06b('0x11'),'client_secret':_0x183840[_0xf06b('0x12')]},'json':!![]};return rp(_0x1aff31)[_0xf06b('0x13')](function(_0x51eee7){return _0x51eee7['access_token'];})[_0xf06b('0x14')](function(_0x3de233){logger[_0xf06b('0x15')]('['+[_0x372dfa['toUpperCase']()]+_0xf06b('0x16'));return _0x3de233[_0xf06b('0x17')];});}function getUser(_0x200908,_0x27ff7a,_0x438900,_0x761148,_0x1e9acf,_0xb3b566){return new Promise(function(_0x15d31b,_0x26a11f){return getAuthToken(_0x27ff7a,_0x761148,_0xb3b566)[_0xf06b('0x13')](function(_0x25bd18){var _0x590a92={'method':_0xf06b('0x18'),'uri':_0x1e9acf+_0xf06b('0x19'),'headers':{'Authorization':_0xf06b('0x1a')+_0x25bd18,'OData-Version':_0xf06b('0x1b')},'json':!![]};return rp(_0x590a92);})[_0xf06b('0x13')](function(_0x352ef2){var _0x4e6233=_0x352ef2[_0xf06b('0x1c')];var _0x468712=![];var _0x31aaa3=null;if(!_[_0xf06b('0x1d')](_0x438900)){if(intUtil['validateEmail'](_0x438900[_0xf06b('0x1e')])){_0x200908[_0xf06b('0x1f')]=_0x438900['email'];for(_0x31aaa3=0x0;_0x31aaa3<_0x4e6233[_0xf06b('0x20')];_0x31aaa3++){if(_0x4e6233[_0x31aaa3][_0xf06b('0x21')]===_0x438900[_0xf06b('0x1e')]&&!_0x4e6233[_0x31aaa3]['isdisabled']){_0x468712=!![];logger[_0xf06b('0x22')]('['+[_0xb3b566[_0xf06b('0x23')]()]+_0xf06b('0x24')+_0x4e6233[_0x31aaa3][_0xf06b('0x25')]+'!');_0x200908[_0xf06b('0x26')]=_0x4e6233[_0x31aaa3][_0xf06b('0x25')];}}}}if(!_0x468712){logger[_0xf06b('0x22')]('['+[_0xb3b566[_0xf06b('0x23')]()]+_0xf06b('0x27'));_0x200908[_0xf06b('0x1f')]=_0x27ff7a[_0xf06b('0x10')];for(_0x31aaa3=0x0;_0x31aaa3<_0x4e6233[_0xf06b('0x20')];_0x31aaa3++){if(_0x4e6233[_0x31aaa3][_0xf06b('0x21')]===_0x27ff7a[_0xf06b('0x10')]){_0x200908[_0xf06b('0x26')]=_0x4e6233[_0x31aaa3][_0xf06b('0x25')];}}}_0x15d31b(_0x200908);})['catch'](function(_0x51a393){_0x26a11f(_0x51a393[_0xf06b('0x17')]);});});}function createEndUser(_0x4c7a90,_0x1530aa,_0x4beb02,_0x39cbab,_0x24bdfe,_0x1d8367,_0x15ccea){return new Promise(function(_0x3dfc2c,_0x439f04){return getAuthToken(_0x1530aa,_0x4beb02,_0x1d8367)['then'](function(_0x415b5c){var _0x2ddd46=_0x1d8367[_0xf06b('0x28')]()==='outbound'?_0x24bdfe[_0xf06b('0x29')]:_0x24bdfe[_0xf06b('0x2a')];var _0x284b00={'method':_0xf06b('0xe'),'uri':_0x39cbab+_0xf06b('0x2b'),'body':{'fullname':_0x2ddd46,'firstname':_0x2ddd46,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xf06b('0x2c')+_0x4c7a90[_0xf06b('0x26')]+')'},'headers':{'Authorization':_0xf06b('0x1a')+_0x415b5c,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x284b00[_0xf06b('0x2d')][_0x15ccea]=_0x2ddd46;return rp(_0x284b00);})['then'](function(_0x2c6b41){var _0x3f5f88=_0x2c6b41[_0xf06b('0x2e')]['odata-entityid'];var _0x101938=_0x3f5f88[_0xf06b('0x2f')](_0x3f5f88[_0xf06b('0x30')]('(')+0x1,_0x3f5f88[_0xf06b('0x30')](')'));_0x4c7a90[_0xf06b('0x31')]=_0x101938;_0x3dfc2c(_0x4c7a90);})[_0xf06b('0x14')](function(_0x4c35d4){_0x439f04(_0x4c35d4[_0xf06b('0x17')]);});});}function getEndUser(_0x99a20f,_0x611834,_0x2f1dac,_0x114a20,_0x27175d,_0x27b069,_0xc5f5dd,_0xa19385){var _0x5c90b2=_0x27b069[_0xf06b('0x28')]()===_0xf06b('0x32')?_0x27175d[_0xf06b('0x29')]:_0x27175d[_0xf06b('0x2a')];return getAuthToken(_0x611834,_0x2f1dac,_0x27b069)['then'](function(_0x570dc2){_0xa19385=_0xa19385?_0xa19385:_0xf06b('0x33');var _0x2358b3={'method':_0xf06b('0x18'),'uri':_0x114a20+'contacts?$select='+_0xa19385+_0xf06b('0x34')+_0xa19385+_0xf06b('0x35')+_0x5c90b2[_0xf06b('0x36')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x570dc2,'If-None-Match':null,'OData-Version':_0xf06b('0x1b')},'json':!![]};return rp(_0x2358b3);})[_0xf06b('0x13')](function(_0x1110a6){var _0x5359de=![];if(!_0x1110a6)return _0x5359de;var _0xea9d03=_0x1110a6[_0xf06b('0x1c')];for(var _0x5811a8=0x0;_0x5811a8<_0xea9d03[_0xf06b('0x20')];_0x5811a8++){if(_0xea9d03[_0x5811a8][_0xa19385]===_0x5c90b2){_0x5359de=!![];_0x99a20f[_0xf06b('0x31')]=_0xea9d03[_0x5811a8]['contactid'];}}return _0x5359de;})[_0xf06b('0x13')](function(_0x47f804){if(_0x47f804)return _0x99a20f;if(_0xc5f5dd===_0xf06b('0x37')){logger[_0xf06b('0x22')]('['+[_0x27b069[_0xf06b('0x23')]()]+_0xf06b('0x38'));return _0x99a20f;}return createEndUser(_0x99a20f,_0x611834,_0x2f1dac,_0x114a20,_0x27175d,_0x27b069,_0xa19385)[_0xf06b('0x13')](function(_0x44f6c6){logger[_0xf06b('0x22')]('['+[_0x27b069['toUpperCase']()]+']\x20Enduser\x20created!',_0x44f6c6[_0xf06b('0x31')]);return _0x44f6c6;});});}function getCustomFields(_0x23b942,_0x9cd347,_0x2e4821){var _0x38cbf1={};if(_0x23b942[_0xf06b('0x20')]>0x0){_[_0xf06b('0x39')](_0x23b942,function(_0x2e316d){if(_['includes'](['string',_0xf06b('0x3a')],_0x2e316d[_0xf06b('0x3b')])&&_0x2e316d[_0xf06b('0x3c')]&&!_0x2e316d[_0xf06b('0x3d')]){var _0x5b9726=_0x2e316d[_0xf06b('0x3e')][_0xf06b('0x28')]();var _0x37a70e=_0x5b9726[_0xf06b('0x2f')](0x0,_0x5b9726[_0xf06b('0x3f')]('_'));var _0x27e3b6=_0x5b9726[_0xf06b('0x2f')](_0x5b9726[_0xf06b('0x3f')]('_')+0x1);if(_0x37a70e===_0x2e4821){_0x38cbf1[_0x27e3b6]=_0x2e316d[_0xf06b('0x40')];}}});}return _0x38cbf1;}function getTicket(_0x575716,_0x1f7097,_0x3118a0,_0x3fd8fa,_0xfc54e7,_0x153f1f,_0x5ba3f3){return new Promise(function(_0x363180,_0xabc74){var _0x336224;return getAuthToken(_0x1f7097,_0x3118a0,_0x5ba3f3)[_0xf06b('0x13')](function(_0x325921){if(_0x153f1f[_0xf06b('0x41')]===_0xf06b('0x42')){_0x336224={'method':_0xf06b('0xe'),'uri':_0x3fd8fa+_0xf06b('0x43'),'body':Object[_0xf06b('0x44')]({},{'title':intUtil[_0xf06b('0x45')](_0x153f1f['Subjects'],_0xfc54e7,'\x20'),'description':intUtil['getString'](_0x153f1f[_0xf06b('0x46')],_0xfc54e7,'\x0a'),'customerid_contact@odata.bind':_0x575716['enduserId']?_0xf06b('0x47')+_0x575716['enduserId']+')':undefined,'ownerid@odata.bind':_0xf06b('0x2c')+_0x575716[_0xf06b('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x153f1f[_0xf06b('0x48')],_0xfc54e7,_0x153f1f[_0xf06b('0x41')])),'headers':{'Authorization':'Bearer\x20'+_0x325921,'OData-Version':_0xf06b('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x153f1f[_0xf06b('0x41')]===_0xf06b('0x49')){var _0x2b4ca3=_0x575716[_0xf06b('0x31')]?[{'partyid_systemuser@odata.bind':_0xf06b('0x2c')+_0x575716[_0xf06b('0x26')]+')','participationtypemask':_0x575716['callDirection']===_0xf06b('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':_0xf06b('0x47')+_0x575716[_0xf06b('0x31')]+')','participationtypemask':_0x575716['callDirection']===_0xf06b('0x4a')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xf06b('0x2c')+_0x575716['userId']+')','participationtypemask':_0x575716[_0xf06b('0x4b')]===_0xf06b('0x4a')?0x2:0x1}];_0x336224={'method':_0xf06b('0xe'),'uri':_0x3fd8fa+_0xf06b('0x4c'),'body':Object[_0xf06b('0x44')]({},{'subject':intUtil[_0xf06b('0x45')](_0x153f1f[_0xf06b('0x4d')],_0xfc54e7,'\x20'),'phonenumber':String(_0xfc54e7[_0xf06b('0x2a')]),'description':intUtil[_0xf06b('0x45')](_0x153f1f[_0xf06b('0x46')],_0xfc54e7,'\x0a'),'regardingobjectid_contact@odata.bind':_0x575716[_0xf06b('0x31')]?_0xf06b('0x47')+_0x575716[_0xf06b('0x31')]+')':undefined,'ownerid@odata.bind':_0xf06b('0x2c')+_0x575716[_0xf06b('0x26')]+')','directioncode':_0x575716[_0xf06b('0x4b')]===_0xf06b('0x4a')?![]:!![],'phonecall_activity_parties':_0x2b4ca3},getCustomFields(_0x153f1f[_0xf06b('0x48')],_0xfc54e7,_0x153f1f['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x325921,'OData-Version':_0xf06b('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x336224);})[_0xf06b('0x13')](function(_0xf6d2cb){var _0x242ee2=_0xf6d2cb[_0xf06b('0x2e')][_0xf06b('0x4e')];var _0x5d0a48=_0x242ee2[_0xf06b('0x2f')](_0x242ee2[_0xf06b('0x30')]('(')+0x1,_0x242ee2[_0xf06b('0x30')](')'));_0x575716[_0xf06b('0x4f')]=_0x5d0a48;_0x363180(_0x575716);})[_0xf06b('0x14')](function(_0x5a5c51){_0xabc74(_0x5a5c51['message']);});});}function emit(_0x1531c0,_0x5c3861,_0x85013e,_0x1433ed){var _0x52539b={'uri':util[_0xf06b('0x50')](_0xf06b('0x51'),_0x1531c0,_0x85013e,_0x1433ed)};io['to'](util[_0xf06b('0x50')](_0xf06b('0x52'),_0x5c3861))['emit'](_0xf06b('0x53'),_0x52539b);}exports['cs']=function(_0x301324,_0x2aa8ca,_0x52fca9,_0x1c0a74,_0x2b919e,_0x174a74,_0x42976d,_0xe5813e){var _0x325c82={};_0x174a74['remoteUri']=_0x174a74[_0xf06b('0x9')]?intUtil['stripTrailingSlash'](_0x174a74[_0xf06b('0xb')]['data7']):intUtil['stripTrailingSlash'](_0x174a74[_0xf06b('0xa')]);_0x174a74[_0xf06b('0x54')]=intUtil[_0xf06b('0x55')](_0x174a74[_0xf06b('0x54')]);_0x325c82['callDirection']=_0xe5813e==='queue'||_0xe5813e===_0xf06b('0x56')?_0xf06b('0x4a'):_0xf06b('0x32');var _0x5cd027=_0x174a74[_0xf06b('0x9')]?util[_0xf06b('0x50')](_0xf06b('0x57'),_0x174a74[_0xf06b('0xb')][_0xf06b('0xc')]):util['format'](_0xf06b('0x57'),_0x174a74[_0xf06b('0xa')]);var _0xe77015=util['format'](_0xf06b('0x58'),_0x174a74[_0xf06b('0xd')]);var _0x592091=util[_0xf06b('0x50')](_0xf06b('0x59'),_0x174a74['serverUrl'],_0x2aa8ca[_0xf06b('0x5a')],md5(_0x2aa8ca[_0xf06b('0x5a')]));if(_0x2b919e&&_0x2b919e[_0xf06b('0x5b')]){logger[_0xf06b('0x22')](_0xf06b('0x5c'),_0xf06b('0x5d'));_0x2aa8ca[_0xf06b('0x5e')]=_0x592091;}else if(_0x42976d&&_0x42976d[_0xf06b('0x5f')]&&_0x42976d[_0xf06b('0x5f')]!==_0xf06b('0x60')){logger[_0xf06b('0x22')](_0xf06b('0x61'),_0xf06b('0x5d'));_0x2aa8ca['recordingURL']=_0x592091;}else{_0x2aa8ca[_0xf06b('0x5e')]='';}return getUser(_0x325c82,_0x174a74,_0x1c0a74,_0xe77015,_0x5cd027,_0xe5813e)[_0xf06b('0x13')](function(_0x3b02ec){logger[_0xf06b('0x22')]('['+_0xe5813e['toUpperCase']()+_0xf06b('0x62'),_0x3b02ec[_0xf06b('0x26')]);logger[_0xf06b('0x22')]('['+_0xe5813e[_0xf06b('0x23')]()+_0xf06b('0x63'),_0x3b02ec[_0xf06b('0x1f')]);return getEndUser(_0x3b02ec,_0x174a74,_0xe77015,_0x5cd027,_0x2aa8ca,_0xe5813e,_0x52fca9[_0xf06b('0x64')],_0x52fca9[_0xf06b('0x65')]);})[_0xf06b('0x13')](function(_0x319f17){logger[_0xf06b('0x22')]('['+_0xe5813e['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x319f17[_0xf06b('0x31')]);logger[_0xf06b('0x22')]('['+_0xe5813e[_0xf06b('0x23')]()+_0xf06b('0x66'),_0x2aa8ca['calleridnum']);return getTicket(_0x319f17,_0x174a74,_0xe77015,_0x5cd027,_0x2aa8ca,_0x52fca9,_0xe5813e);})[_0xf06b('0x13')](function(_0x100ead){logger['info'](util[_0xf06b('0x50')]('['+_0xe5813e[_0xf06b('0x23')]()+_0xf06b('0x67'),_0x52fca9[_0xf06b('0x41')],_0x100ead[_0xf06b('0x4f')]));logger[_0xf06b('0x22')](util[_0xf06b('0x50')]('['+_0xe5813e['toUpperCase']()+_0xf06b('0x68'),_0xe5813e));if(_0xe5813e!=='unmanaged'&&_0x52fca9[_0xf06b('0x69')]){logger[_0xf06b('0x22')]('['+_0xe5813e[_0xf06b('0x23')]()+']',_0xf06b('0x6a'));emit(_0x174a74['remoteUri'],_0x1c0a74['name'],_0x52fca9[_0xf06b('0x41')],_0x100ead[_0xf06b('0x4f')]);}})['catch'](function(_0x32c1fb){logger[_0xf06b('0x15')]('['+_0xe5813e['toUpperCase']()+_0xf06b('0x6b'),_0x32c1fb['message']);console[_0xf06b('0x15')](_0xf06b('0x6c'),_0x32c1fb);});}; \ 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 672a29d..04852d3 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 _0x37de=['includes','string','picklist','type','nameField','toLowerCase','customField','push','variable','idField','variableName','customVariable','Variable','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','%s/helpdesk/tickets/%d','unmanaged','toUpperCase','calleridname','lastevent','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','getString','Subjects','Descriptions','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','length','Agent\x20found!','find','email','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','debug','[HTTP]','stringify','map','forEach'];(function(_0x1ba50e,_0x25e8fe){var _0x426103=function(_0x56bf0d){while(--_0x56bf0d){_0x1ba50e['push'](_0x1ba50e['shift']());}};_0x426103(++_0x25e8fe);}(_0x37de,0x146));var _0xe37d=function(_0x5613de,_0x479c93){_0x5613de=_0x5613de-0x0;var _0x5b40cb=_0x37de[_0x5613de];return _0x5b40cb;};'use strict';var _=require(_0xe37d('0x0'));var rp=require(_0xe37d('0x1'));var md5=require(_0xe37d('0x2'));var util=require(_0xe37d('0x3'));var Redis=require(_0xe37d('0x4'));var intUtil=require(_0xe37d('0x5'));var config=require(_0xe37d('0x6'));var logger=require(_0xe37d('0x7'))(_0xe37d('0x8'));config[_0xe37d('0x9')]=_[_0xe37d('0xa')](config[_0xe37d('0x9')],{'host':_0xe37d('0xb'),'port':0x18eb});var io=require(_0xe37d('0xc'))(new Redis(config[_0xe37d('0x9')]));var headers={'Content-Type':'application/json','Accept':_0xe37d('0xd')};function emit(_0x20dc83,_0x5892de,_0x1f8d09){io['to'](_0x20dc83)[_0xe37d('0xe')](_0x5892de,_0x1f8d09);}function getTicket(_0x772329,_0x478463,_0x5b4ca1,_0x303586,_0x123217){logger[_0xe37d('0xf')](_0xe37d('0x10'));var _0xef7c2e=_[_0xe37d('0x11')]({'responder_id':_0x478463['id'],'requester_id':_0x5b4ca1['id'],'name':util[_0xe37d('0x12')](_0xe37d('0x13'),_0x123217['calleridname']),'phone':_0x123217['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe37d('0x14')](_0x303586[_0xe37d('0x15')],_0x123217,'\x20'),'description':intUtil['getString'](_0x303586[_0xe37d('0x16')],_0x123217,'
'),'tags':getTags(_0x303586['Tags'],_0xe37d('0x17'))},getCustomFields(_0x303586[_0xe37d('0x18')],_0x123217));_0xef7c2e[_0xe37d('0x19')]=_[_0xe37d('0x1a')](_[_0xe37d('0x1b')](_0xef7c2e[_0xe37d('0x19')],'id'),_0xe37d('0x1c'));return request({'uri':util['format'](_0xe37d('0x1d'),_0x772329['remoteUri']),'method':_0xe37d('0x1e'),'body':_0xef7c2e})['then'](function(_0x1da98a){logger['info'](_0xe37d('0x1f'));return _0x1da98a;});}function getUser(_0x480587,_0x270c3e){if(intUtil[_0xe37d('0x20')](_0x270c3e)){return request({'uri':util[_0xe37d('0x12')](_0xe37d('0x21'),_0x480587[_0xe37d('0x22')]),'qs':{'email':_0x270c3e}})[_0xe37d('0x23')](function(_0x59fcc5){if(_0x59fcc5[_0xe37d('0x24')]){logger[_0xe37d('0xf')](_0xe37d('0x25'));return _[_0xe37d('0x26')](_0x59fcc5,function(_0x500501){return _0x500501['contact'][_0xe37d('0x27')]===_0x270c3e;});}else{logger[_0xe37d('0xf')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe37d('0x12')]('%s/api/v2/agents/me',_0x480587[_0xe37d('0x22')])})['then'](function(_0x50056c){logger[_0xe37d('0xf')](_0xe37d('0x28'));return _0x50056c;});}});}else{logger[_0xe37d('0xf')](_0xe37d('0x29'));return request({'uri':util['format'](_0xe37d('0x2a'),_0x480587[_0xe37d('0x22')])})['then'](function(_0x3a87f6){logger[_0xe37d('0xf')](_0xe37d('0x28'));return _0x3a87f6;});}}function getEndUser(_0x36fe02,_0x3afd00,_0x37bd4d){logger[_0xe37d('0xf')](_0xe37d('0x2b'),_0x37bd4d);return request({'uri':util[_0xe37d('0x12')](_0xe37d('0x2c'),_0x36fe02['remoteUri']),'qs':{'phone':_0x37bd4d}})[_0xe37d('0x23')](function(_0x2fd570){if(_0x2fd570[_0xe37d('0x24')]){logger['info']('Enduser\x20found!');return _[_0xe37d('0x26')](_0x2fd570,{'phone':_0x37bd4d});}else{logger[_0xe37d('0xf')](_0xe37d('0x2d'));return request({'uri':util['format'](_0xe37d('0x2c'),_0x36fe02[_0xe37d('0x22')]),'method':_0xe37d('0x1e'),'body':{'name':_0x3afd00,'phone':_0x37bd4d}})[_0xe37d('0x23')](function(_0x4d7b7b){logger[_0xe37d('0xf')](_0xe37d('0x2e'));return _0x4d7b7b;});}});}function getAuth(_0x3ca50d){return util[_0xe37d('0x12')](_0xe37d('0x2f'),new Buffer(_0x3ca50d['apiKey']+':X')[_0xe37d('0x30')]('base64'));}function request(_0x3ebf75){logger[_0xe37d('0x31')](_0xe37d('0x32'),JSON[_0xe37d('0x33')](_0x3ebf75));return rp(_[_0xe37d('0xa')](_0x3ebf75,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x33d03e,_0x4ff599){var _0x579a05=[];if(_0x33d03e&&_0x33d03e[_0xe37d('0x24')]>0x0){_0x579a05=_[_0xe37d('0x34')](_0x33d03e,_0x4ff599);}return _0x579a05;}function getCustomFields(_0x38a09b,_0x425520){var _0x39b221=[];var _0x4cc1e2={'custom_fields':[]};if(_0x38a09b['length']>0x0){_[_0xe37d('0x35')](_0x38a09b,function(_0x4c1395){if(_[_0xe37d('0x36')]([_0xe37d('0x37'),_0xe37d('0x38')],_0x4c1395[_0xe37d('0x39')])&&_0x4c1395[_0xe37d('0x3a')]&&!_0x4c1395['customField']){_0x4cc1e2[_0x4c1395[_0xe37d('0x3a')][_0xe37d('0x3b')]()]=_0x4c1395['content'][_0xe37d('0x30')]();}else if(_[_0xe37d('0x36')]([_0xe37d('0x37'),_0xe37d('0x38')],_0x4c1395[_0xe37d('0x39')])&&_0x4c1395['idField']&&_0x4c1395[_0xe37d('0x3c')]){_0x4cc1e2[_0xe37d('0x19')][_0xe37d('0x3d')]({'id':_0x4c1395['idField'],'value':_0x4c1395['content'][_0xe37d('0x30')]()});}else if(_0x4c1395['type']===_0xe37d('0x3e')&&_0x4c1395['variableName']&&_0x4c1395[_0xe37d('0x3f')]&&_0x4c1395[_0xe37d('0x3c')]){_0x425520[_0x4c1395['variableName']]&&_0x4cc1e2[_0xe37d('0x19')][_0xe37d('0x3d')]({'id':_0x4c1395[_0xe37d('0x3f')],'value':_0x425520[_0x4c1395[_0xe37d('0x40')]]['toString']()});}else if(_0x4c1395['type']===_0xe37d('0x41')&&_0x4c1395[_0xe37d('0x42')]&&_0x4c1395[_0xe37d('0x42')]['name']&&_0x4c1395[_0xe37d('0x3f')]&&_0x4c1395['customField']){_0x425520[_0x4c1395['Variable']['name']['toLowerCase']()]&&_0x4cc1e2['custom_fields'][_0xe37d('0x3d')]({'id':_0x4c1395[_0xe37d('0x3f')],'value':_0x425520[_0x4c1395['Variable'][_0xe37d('0x17')][_0xe37d('0x3b')]()][_0xe37d('0x30')]()});}});}return _0x4cc1e2;}exports['queue']=function(_0xb7ea33,_0x2365e9,_0x363389,_0x569206,_0x36b44e,_0xf342fe){var _0x159aa1,_0x4805d8;_0xf342fe[_0xe37d('0x22')]=intUtil[_0xe37d('0x43')](_0xf342fe[_0xe37d('0x22')]);_0xf342fe['serverUrl']=intUtil[_0xe37d('0x43')](_0xf342fe['serverUrl']);if(_0x36b44e&&_0x36b44e[_0xe37d('0x44')]){logger[_0xe37d('0xf')](_0xe37d('0x45'),'Recording\x20is\x20enabled!');_0x2365e9[_0xe37d('0x46')]=util[_0xe37d('0x12')](_0xe37d('0x47'),_0xf342fe[_0xe37d('0x48')],_0x2365e9['uniqueid'],md5(_0x2365e9[_0xe37d('0x49')]));}else{_0x2365e9[_0xe37d('0x46')]='';}headers[_0xe37d('0x4a')]=getAuth(_0xf342fe);return getUser(_0xf342fe,_0x569206[_0xe37d('0x27')])[_0xe37d('0x23')](function(_0xfe2417){_0x159aa1=_0xfe2417;logger[_0xe37d('0xf')](_0xe37d('0x4b'),_0x159aa1['id']);return getEndUser(_0xf342fe,_0x2365e9['calleridname'],_0x2365e9[_0xe37d('0x4c')]);})['then'](function(_0x1ca4b4){_0x4805d8=_0x1ca4b4;logger[_0xe37d('0xf')](_0xe37d('0x4d'),_0x4805d8['id']);return getTicket(_0xf342fe,_0x159aa1,_0x4805d8,_0x363389,_0x2365e9);})['then'](function(_0x476660){if(_0x476660&&_0x476660['id']){logger['info']('Ticket\x20created!');logger[_0xe37d('0xf')](_0xe37d('0x4e'),_0x476660['id']);logger[_0xe37d('0xf')]('[QUEUE]',_0xe37d('0x4f'));emit(util[_0xe37d('0x12')](_0xe37d('0x50'),_0x569206[_0xe37d('0x17')]),_0xe37d('0x51'),{'uri':util[_0xe37d('0x12')]('%s/helpdesk/tickets/%d',_0xf342fe[_0xe37d('0x22')],_0x476660['id'])});}})[_0xe37d('0x52')](function(_0x2494b){logger['error'](_0xe37d('0x45'),JSON[_0xe37d('0x33')](_0x2494b));});};exports[_0xe37d('0x53')]=function(_0xf80310,_0x59cacb,_0x156650,_0x1eb3e9,_0xcb55f4,_0x18c5a7,_0xff947){var _0x5a5094,_0x3f7bff;_0x18c5a7[_0xe37d('0x22')]=intUtil[_0xe37d('0x43')](_0x18c5a7['remoteUri']);_0x18c5a7['serverUrl']=intUtil[_0xe37d('0x43')](_0x18c5a7[_0xe37d('0x48')]);if(_0xff947&&_0xff947[_0xe37d('0x54')]&&_0xff947[_0xe37d('0x54')]!==_0xe37d('0x55')){logger[_0xe37d('0xf')](_0xe37d('0x56'),_0xe37d('0x57'));_0x59cacb['recordingURL']=util[_0xe37d('0x12')](_0xe37d('0x47'),_0x18c5a7[_0xe37d('0x48')],_0x59cacb[_0xe37d('0x49')],md5(_0x59cacb[_0xe37d('0x49')]));}headers[_0xe37d('0x4a')]=getAuth(_0x18c5a7);return getUser(_0x18c5a7,_0x1eb3e9[_0xe37d('0x27')])[_0xe37d('0x23')](function(_0x5cc8e0){_0x5a5094=_0x5cc8e0;logger[_0xe37d('0xf')]('The\x20User\x20ID\x20is:',_0x5a5094['id']);return getEndUser(_0x18c5a7,_0x59cacb[_0xe37d('0x58')],_0x59cacb[_0xe37d('0x59')]);})['then'](function(_0x2b28e0){_0x3f7bff=_0x2b28e0;logger['info'](_0xe37d('0x4d'),_0x3f7bff['id']);return getTicket(_0x18c5a7,_0x5a5094,_0x3f7bff,_0x156650,_0x59cacb);})[_0xe37d('0x23')](function(_0x553a27){if(_0x553a27&&_0x553a27['id']){logger[_0xe37d('0xf')](_0xe37d('0x1f'));logger[_0xe37d('0xf')](_0xe37d('0x4e'),_0x553a27['id']);logger[_0xe37d('0xf')]('[OUTBOUND]',_0xe37d('0x4f'));emit(util[_0xe37d('0x12')](_0xe37d('0x50'),_0x1eb3e9['name']),_0xe37d('0x51'),{'uri':util[_0xe37d('0x12')](_0xe37d('0x5a'),_0x18c5a7['remoteUri'],_0x553a27['id'])});}})['catch'](function(_0x3bf44e){logger['error'](_0xe37d('0x56'),JSON['stringify'](_0x3bf44e));});};exports[_0xe37d('0x5b')]=function(_0x4743f4,_0x1208ee,_0x736e2a,_0x25dfd3,_0x52c642,_0x148954){var _0x2020ac,_0x22ffd4;_0x148954['remoteUri']=intUtil[_0xe37d('0x43')](_0x148954['remoteUri']);_0x148954['serverUrl']=intUtil[_0xe37d('0x43')](_0x148954[_0xe37d('0x48')]);if(_0x52c642&&_0x52c642[_0xe37d('0x44')]){logger[_0xe37d('0xf')]('['+_0x1208ee['lastevent'][_0xe37d('0x5c')]()+']',_0xe37d('0x57'));_0x1208ee[_0xe37d('0x46')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x148954['serverUrl'],_0x1208ee[_0xe37d('0x49')],md5(_0x1208ee[_0xe37d('0x49')]));}else{_0x1208ee[_0xe37d('0x46')]='';}headers[_0xe37d('0x4a')]=getAuth(_0x148954);return getUser(_0x148954,'')[_0xe37d('0x23')](function(_0x211660){_0x2020ac=_0x211660;logger[_0xe37d('0xf')](_0xe37d('0x4b'),_0x2020ac['id']);return getEndUser(_0x148954,_0x1208ee[_0xe37d('0x5d')],_0x1208ee[_0xe37d('0x4c')]);})[_0xe37d('0x23')](function(_0xb97f15){_0x22ffd4=_0xb97f15;logger[_0xe37d('0xf')](_0xe37d('0x4d'),_0x22ffd4['id']);return getTicket(_0x148954,_0x2020ac,_0x22ffd4,_0x736e2a,_0x1208ee);})[_0xe37d('0x23')](function(_0x26bb21){if(_0x26bb21){logger['info'](_0xe37d('0x1f'));logger[_0xe37d('0xf')](_0xe37d('0x4e'),_0x26bb21['id']);}})[_0xe37d('0x52')](function(_0x291bd8){logger['error']('['+_0x1208ee[_0xe37d('0x5e')][_0xe37d('0x5c')]()+']',JSON[_0xe37d('0x33')](_0x291bd8));});}; \ No newline at end of file +var _0x6669=['Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','stringify','GET','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','push','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','calleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/helpdesk/tickets/%d','monitor_format','toUpperCase','lastevent','lodash','request-promise','md5','../../../../config/environment','redis','defaults','localhost','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','email'];(function(_0x4ba566,_0x1e59f2){var _0x5b2031=function(_0x1ddad0){while(--_0x1ddad0){_0x4ba566['push'](_0x4ba566['shift']());}};_0x5b2031(++_0x1e59f2);}(_0x6669,0x189));var _0x9666=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x6669[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0x9666('0x0'));var rp=require(_0x9666('0x1'));var md5=require(_0x9666('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x9666('0x3'));var logger=require('../../../../config/logger')('freshdesk');config[_0x9666('0x4')]=_[_0x9666('0x5')](config[_0x9666('0x4')],{'host':_0x9666('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9666('0x4')]));var headers={'Content-Type':'application/json','Accept':_0x9666('0x7')};function emit(_0x38a848,_0x5df440,_0x4ab970){io['to'](_0x38a848)[_0x9666('0x8')](_0x5df440,_0x4ab970);}function getTicket(_0x3493a1,_0x435834,_0xd7f58f,_0x1e578b,_0x142ca6){logger[_0x9666('0x9')]('Creating\x20new\x20ticket...');var _0x6afc09=_[_0x9666('0xa')]({'responder_id':_0x435834['id'],'requester_id':_0xd7f58f['id'],'name':util[_0x9666('0xb')](_0x9666('0xc'),_0x142ca6[_0x9666('0xd')]),'phone':_0x142ca6['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9666('0xe')](_0x1e578b['Subjects'],_0x142ca6,'\x20'),'description':intUtil[_0x9666('0xe')](_0x1e578b[_0x9666('0xf')],_0x142ca6,_0x9666('0x10')),'tags':getTags(_0x1e578b[_0x9666('0x11')],_0x9666('0x12'))},getCustomFields(_0x1e578b[_0x9666('0x13')],_0x142ca6));_0x6afc09[_0x9666('0x14')]=_[_0x9666('0x15')](_[_0x9666('0x16')](_0x6afc09[_0x9666('0x14')],'id'),'value');return request({'uri':util[_0x9666('0xb')](_0x9666('0x17'),_0x3493a1[_0x9666('0x18')]),'method':_0x9666('0x19'),'body':_0x6afc09})[_0x9666('0x1a')](function(_0x200c33){logger[_0x9666('0x9')](_0x9666('0x1b'));return _0x200c33;});}function getUser(_0xabb6cd,_0x4b75b3){if(intUtil[_0x9666('0x1c')](_0x4b75b3)){return request({'uri':util[_0x9666('0xb')](_0x9666('0x1d'),_0xabb6cd[_0x9666('0x18')]),'qs':{'email':_0x4b75b3}})['then'](function(_0x25fe32){if(_0x25fe32[_0x9666('0x1e')]){logger['info']('Agent\x20found!');return _['find'](_0x25fe32,function(_0x410936){return _0x410936['contact'][_0x9666('0x1f')]===_0x4b75b3;});}else{logger[_0x9666('0x9')](_0x9666('0x20'));return request({'uri':util['format'](_0x9666('0x21'),_0xabb6cd[_0x9666('0x18')])})[_0x9666('0x1a')](function(_0x4fa57f){logger['info'](_0x9666('0x22'));return _0x4fa57f;});}});}else{logger[_0x9666('0x9')](_0x9666('0x23'));return request({'uri':util['format'](_0x9666('0x21'),_0xabb6cd['remoteUri'])})['then'](function(_0x40fdc9){logger[_0x9666('0x9')](_0x9666('0x22'));return _0x40fdc9;});}}function getEndUser(_0x31147a,_0x127a19,_0x50a260){logger['info']('Searching\x20enduser\x20with\x20phone',_0x50a260);return request({'uri':util[_0x9666('0xb')]('%s/api/v2/contacts',_0x31147a[_0x9666('0x18')]),'qs':{'phone':_0x50a260}})[_0x9666('0x1a')](function(_0x424bb2){if(_0x424bb2[_0x9666('0x1e')]){logger[_0x9666('0x9')]('Enduser\x20found!');return _[_0x9666('0x24')](_0x424bb2,{'phone':_0x50a260});}else{logger['info'](_0x9666('0x25'));return request({'uri':util[_0x9666('0xb')](_0x9666('0x26'),_0x31147a[_0x9666('0x18')]),'method':_0x9666('0x19'),'body':{'name':_0x127a19,'phone':_0x50a260}})[_0x9666('0x1a')](function(_0xbad8cd){logger['info'](_0x9666('0x27'));return _0xbad8cd;});}});}function getAuth(_0x5cadba){return util[_0x9666('0xb')](_0x9666('0x28'),new Buffer(_0x5cadba[_0x9666('0x29')]+':X')[_0x9666('0x2a')]('base64'));}function request(_0x4c1d2c){logger[_0x9666('0x2b')]('[HTTP]',JSON[_0x9666('0x2c')](_0x4c1d2c));return rp(_[_0x9666('0x5')](_0x4c1d2c,{'method':_0x9666('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x33ec2f,_0x40f195){var _0x245525=[];if(_0x33ec2f&&_0x33ec2f[_0x9666('0x1e')]>0x0){_0x245525=_['map'](_0x33ec2f,_0x40f195);}return _0x245525;}function getCustomFields(_0x491a45,_0x4e085c){var _0x16e4ef=[];var _0x48c05d={'custom_fields':[]};if(_0x491a45[_0x9666('0x1e')]>0x0){_['forEach'](_0x491a45,function(_0x1c9828){if(_[_0x9666('0x2e')]([_0x9666('0x2f'),_0x9666('0x30')],_0x1c9828[_0x9666('0x31')])&&_0x1c9828[_0x9666('0x32')]&&!_0x1c9828['customField']){_0x48c05d[_0x1c9828[_0x9666('0x32')][_0x9666('0x33')]()]=_0x1c9828[_0x9666('0x34')]['toString']();}else if(_[_0x9666('0x2e')](['string','picklist'],_0x1c9828[_0x9666('0x31')])&&_0x1c9828[_0x9666('0x35')]&&_0x1c9828[_0x9666('0x36')]){_0x48c05d['custom_fields'][_0x9666('0x37')]({'id':_0x1c9828[_0x9666('0x35')],'value':_0x1c9828[_0x9666('0x34')][_0x9666('0x2a')]()});}else if(_0x1c9828[_0x9666('0x31')]==='variable'&&_0x1c9828['variableName']&&_0x1c9828['idField']&&_0x1c9828[_0x9666('0x36')]){_0x4e085c[_0x1c9828[_0x9666('0x38')]]&&_0x48c05d[_0x9666('0x14')][_0x9666('0x37')]({'id':_0x1c9828[_0x9666('0x35')],'value':_0x4e085c[_0x1c9828[_0x9666('0x38')]]['toString']()});}else if(_0x1c9828['type']===_0x9666('0x39')&&_0x1c9828[_0x9666('0x3a')]&&_0x1c9828[_0x9666('0x3a')][_0x9666('0x12')]&&_0x1c9828[_0x9666('0x35')]&&_0x1c9828[_0x9666('0x36')]){_0x4e085c[_0x1c9828[_0x9666('0x3a')]['name']['toLowerCase']()]&&_0x48c05d[_0x9666('0x14')][_0x9666('0x37')]({'id':_0x1c9828[_0x9666('0x35')],'value':_0x4e085c[_0x1c9828[_0x9666('0x3a')]['name'][_0x9666('0x33')]()][_0x9666('0x2a')]()});}});}return _0x48c05d;}exports[_0x9666('0x3b')]=function(_0x5e5b6e,_0x16d6c5,_0x40eed6,_0xfa2e3,_0x26047d,_0x6d099a){var _0x4c01e9,_0x10ba9e;_0x6d099a[_0x9666('0x18')]=intUtil[_0x9666('0x3c')](_0x6d099a[_0x9666('0x18')]);_0x6d099a[_0x9666('0x3d')]=intUtil[_0x9666('0x3c')](_0x6d099a[_0x9666('0x3d')]);if(_0x26047d&&_0x26047d['monitor_format']){logger[_0x9666('0x9')](_0x9666('0x3e'),_0x9666('0x3f'));_0x16d6c5['recordingURL']=util[_0x9666('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x6d099a[_0x9666('0x3d')],_0x16d6c5[_0x9666('0x40')],md5(_0x16d6c5[_0x9666('0x40')]));}else{_0x16d6c5[_0x9666('0x41')]='';}headers[_0x9666('0x42')]=getAuth(_0x6d099a);return getUser(_0x6d099a,_0xfa2e3[_0x9666('0x1f')])[_0x9666('0x1a')](function(_0x36960b){_0x4c01e9=_0x36960b;logger[_0x9666('0x9')]('The\x20User\x20ID\x20is:',_0x4c01e9['id']);return getEndUser(_0x6d099a,_0x16d6c5[_0x9666('0xd')],_0x16d6c5[_0x9666('0x43')]);})[_0x9666('0x1a')](function(_0x47d580){_0x10ba9e=_0x47d580;logger['info']('The\x20Enduser\x20ID\x20is:',_0x10ba9e['id']);return getTicket(_0x6d099a,_0x4c01e9,_0x10ba9e,_0x40eed6,_0x16d6c5);})[_0x9666('0x1a')](function(_0x510ef0){if(_0x510ef0&&_0x510ef0['id']){logger[_0x9666('0x9')](_0x9666('0x1b'));logger[_0x9666('0x9')](_0x9666('0x44'),_0x510ef0['id']);logger['info']('[QUEUE]',_0x9666('0x45'));emit(util[_0x9666('0xb')](_0x9666('0x46'),_0xfa2e3[_0x9666('0x12')]),_0x9666('0x47'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x6d099a[_0x9666('0x18')],_0x510ef0['id'])});}})[_0x9666('0x48')](function(_0x425368){logger[_0x9666('0x49')]('[QUEUE]',JSON[_0x9666('0x2c')](_0x425368));});};exports['outbound']=function(_0x5b5d7b,_0x1c23ae,_0x326abc,_0x54e74f,_0x390328,_0x3a093a,_0x28e8be){var _0x9549,_0x1e6360;_0x3a093a['remoteUri']=intUtil[_0x9666('0x3c')](_0x3a093a[_0x9666('0x18')]);_0x3a093a['serverUrl']=intUtil[_0x9666('0x3c')](_0x3a093a[_0x9666('0x3d')]);if(_0x28e8be&&_0x28e8be[_0x9666('0x4a')]&&_0x28e8be['recordingFormat']!==_0x9666('0x4b')){logger['info'](_0x9666('0x4c'),_0x9666('0x3f'));_0x1c23ae['recordingURL']=util[_0x9666('0xb')](_0x9666('0x4d'),_0x3a093a['serverUrl'],_0x1c23ae['uniqueid'],md5(_0x1c23ae[_0x9666('0x40')]));}headers[_0x9666('0x42')]=getAuth(_0x3a093a);return getUser(_0x3a093a,_0x54e74f[_0x9666('0x1f')])[_0x9666('0x1a')](function(_0x58d7f6){_0x9549=_0x58d7f6;logger[_0x9666('0x9')](_0x9666('0x4e'),_0x9549['id']);return getEndUser(_0x3a093a,_0x1c23ae['destcalleridname'],_0x1c23ae[_0x9666('0x4f')]);})[_0x9666('0x1a')](function(_0x1ea89b){_0x1e6360=_0x1ea89b;logger[_0x9666('0x9')](_0x9666('0x50'),_0x1e6360['id']);return getTicket(_0x3a093a,_0x9549,_0x1e6360,_0x326abc,_0x1c23ae);})[_0x9666('0x1a')](function(_0x28cda7){if(_0x28cda7&&_0x28cda7['id']){logger['info']('Ticket\x20created!');logger[_0x9666('0x9')](_0x9666('0x44'),_0x28cda7['id']);logger[_0x9666('0x9')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x9666('0x46'),_0x54e74f[_0x9666('0x12')]),_0x9666('0x47'),{'uri':util[_0x9666('0xb')](_0x9666('0x51'),_0x3a093a[_0x9666('0x18')],_0x28cda7['id'])});}})[_0x9666('0x48')](function(_0x2daae2){logger[_0x9666('0x49')](_0x9666('0x4c'),JSON[_0x9666('0x2c')](_0x2daae2));});};exports['unmanaged']=function(_0x47569d,_0x46e65d,_0x3b9cfa,_0x231c1e,_0x18c7eb,_0x5cdff0){var _0x42a628,_0x22f64d;_0x5cdff0[_0x9666('0x18')]=intUtil[_0x9666('0x3c')](_0x5cdff0['remoteUri']);_0x5cdff0[_0x9666('0x3d')]=intUtil[_0x9666('0x3c')](_0x5cdff0['serverUrl']);if(_0x18c7eb&&_0x18c7eb[_0x9666('0x52')]){logger[_0x9666('0x9')]('['+_0x46e65d['lastevent'][_0x9666('0x53')]()+']',_0x9666('0x3f'));_0x46e65d[_0x9666('0x41')]=util[_0x9666('0xb')](_0x9666('0x4d'),_0x5cdff0['serverUrl'],_0x46e65d[_0x9666('0x40')],md5(_0x46e65d[_0x9666('0x40')]));}else{_0x46e65d[_0x9666('0x41')]='';}headers[_0x9666('0x42')]=getAuth(_0x5cdff0);return getUser(_0x5cdff0,'')[_0x9666('0x1a')](function(_0x1139dc){_0x42a628=_0x1139dc;logger['info'](_0x9666('0x4e'),_0x42a628['id']);return getEndUser(_0x5cdff0,_0x46e65d[_0x9666('0xd')],_0x46e65d['calleridnum']);})['then'](function(_0x510d47){_0x22f64d=_0x510d47;logger[_0x9666('0x9')](_0x9666('0x50'),_0x22f64d['id']);return getTicket(_0x5cdff0,_0x42a628,_0x22f64d,_0x3b9cfa,_0x46e65d);})[_0x9666('0x1a')](function(_0x35a2ce){if(_0x35a2ce){logger[_0x9666('0x9')](_0x9666('0x1b'));logger[_0x9666('0x9')]('The\x20Ticket\x20ID\x20is:',_0x35a2ce['id']);}})['catch'](function(_0x296e5c){logger['error']('['+_0x46e65d[_0x9666('0x54')][_0x9666('0x53')]()+']',JSON['stringify'](_0x296e5c));});}; \ 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 b47def1..2a04f92 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 _0x31a2=['length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','GET','headers','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','message','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Contact','add','ticketId','task','toUpperCase','/contacts/','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','calleridnum','callDirection','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','./util','freshsales','redis','defaults','localhost','socket.io-emitter','info','Getting\x20admin\x20information','then','users'];(function(_0x152fa3,_0x77e219){var _0x4fbfa8=function(_0x28bf0f){while(--_0x28bf0f){_0x152fa3['push'](_0x152fa3['shift']());}};_0x4fbfa8(++_0x77e219);}(_0x31a2,0x186));var _0x231a=function(_0x59c319,_0xe59661){_0x59c319=_0x59c319-0x0;var _0x361b78=_0x31a2[_0x59c319];return _0x361b78;};'use strict';var _=require(_0x231a('0x0'));var rp=require(_0x231a('0x1'));var md5=require(_0x231a('0x2'));var util=require(_0x231a('0x3'));var moment=require(_0x231a('0x4'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0x231a('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x231a('0x6'));config[_0x231a('0x7')]=_[_0x231a('0x8')](config[_0x231a('0x7')],{'host':_0x231a('0x9'),'port':0x18eb});var io=require(_0x231a('0xa'))(new Redis(config['redis']));function getAdminId(_0x6e59a6,_0x2e9bd1,_0x3b59d1,_0x7ed600){return new Promise(function(_0x3fed77,_0x367281){var _0x2c12d0=![];var _0xdde7ee={'method':'GET','uri':_0x7ed600+'/api/selector/owners','json':!![]};_0xdde7ee['headers']=_0x3b59d1;logger[_0x231a('0xb')](_0x231a('0xc'));return rp(_0xdde7ee)[_0x231a('0xd')](function(_0x33f6cc){if(_0x33f6cc){var _0x54e0d5=_0x33f6cc[_0x231a('0xe')];var _0x12ef11=null;for(_0x12ef11=0x0;_0x12ef11<_0x54e0d5[_0x231a('0xf')];_0x12ef11++){if(_0x54e0d5[_0x12ef11][_0x231a('0x10')]===_0x6e59a6[_0x231a('0x11')]){_0x6e59a6[_0x231a('0x12')]=_0x54e0d5[_0x12ef11]['id'];_0x2c12d0=!![];}}if(_0x2c12d0){logger[_0x231a('0xb')](_0x231a('0x13'),_0x6e59a6['adminId']);_0x3fed77(_0x6e59a6);}else{_0x367281({'statusCode':0x194,'message':_0x231a('0x14')});}}else{_0x367281({'statusCode':0x194,'message':_0x231a('0x14')});}})[_0x231a('0x15')](function(_0x399ce1){logger[_0x231a('0x16')]('['+[_0x2e9bd1['toUpperCase']()]+']',_0x399ce1['message']);_0x367281(_0x399ce1);});});}function getUser(_0x1da605,_0xd6db69,_0x2e1666){return function(_0x492146){return new Promise(function(_0x3f1933,_0x4b187f){var _0x59bf6e={'method':_0x231a('0x17'),'uri':_0x2e1666+'/api/selector/owners','json':!![]};_0x59bf6e[_0x231a('0x18')]=_0xd6db69;logger[_0x231a('0xb')]('Getting\x20user\x20list');return rp(_0x59bf6e)[_0x231a('0xd')](function(_0x3b0a72){if(_0x3b0a72){var _0x43cbd2=_0x3b0a72[_0x231a('0xe')];var _0xfca8ee=![];var _0x3997f1=null;if(_0x492146[_0x231a('0x19')]!==null){logger[_0x231a('0xb')](_0x231a('0x1a'),_0x492146[_0x231a('0x19')]);_0x492146[_0x231a('0x1b')]=_0x492146[_0x231a('0x19')];for(_0x3997f1=0x0;_0x3997f1<_0x43cbd2[_0x231a('0xf')];_0x3997f1++){if(_0x43cbd2[_0x3997f1][_0x231a('0x10')]===_0x492146[_0x231a('0x19')]){_0xfca8ee=!![];_0x492146[_0x231a('0x1c')]=_0x43cbd2[_0x3997f1]['id'];logger['info']('User\x20found:',_0x492146[_0x231a('0x1c')]);}}}if(!_0xfca8ee){logger['info'](_0x231a('0x1d'));_0x492146[_0x231a('0x1b')]=_0x492146[_0x231a('0x11')];_0x492146[_0x231a('0x1c')]=_0x492146[_0x231a('0x12')];_0xfca8ee=!![];}if(_0xfca8ee){_0x3f1933(_0x492146);}else{_0x4b187f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4b187f({'statusCode':0x194,'message':_0x231a('0x14')});}})['catch'](function(_0x5a1fb7){logger[_0x231a('0x16')]('['+[_0x1da605['toUpperCase']()]+']',_0x5a1fb7[_0x231a('0x1e')]);_0x4b187f(_0x5a1fb7);});});};}function searchContact(_0x4250b7,_0x2260c3,_0x4dcaae,_0x5e0fc9){return new Promise(function(_0x78281c,_0x47057f){var _0x1a99e6={'method':'GET','headers':_0x2260c3,'uri':_0x4250b7+_0x231a('0x1f')+_0x5e0fc9+_0x231a('0x20')+_0x4dcaae+'&entities=contact','json':!![]};rp(_0x1a99e6)[_0x231a('0xd')](function(_0x28d243){var _0x356d24=_[_0x231a('0x21')](_0x28d243[_0x231a('0x22')]['contacts'],[_0x4dcaae,_0x5e0fc9]);_0x78281c(_0x356d24);})[_0x231a('0x15')](function(_0x852bf1){_0x47057f(_0x852bf1);});});}function getEndUser(_0x3285e5,_0x55011c,_0x14724a){return function(_0x1dcfd8){return new Promise(function(_0x4a7f33,_0x66fc3b){logger[_0x231a('0xb')](util[_0x231a('0x23')](_0x231a('0x24'),_0x1dcfd8[_0x231a('0x25')]));searchContact(_0x14724a,_0x55011c,_0x231a('0x26'),_0x1dcfd8[_0x231a('0x25')])[_0x231a('0xd')](function(_0x41cc4e){if(_0x41cc4e){_0x1dcfd8[_0x231a('0x27')]=_0x41cc4e['id'];logger['info'](_0x231a('0x28'),_0x1dcfd8['endUserId']);return _0x4a7f33(_0x1dcfd8);}searchContact(_0x14724a,_0x55011c,_0x231a('0x29'),_0x1dcfd8[_0x231a('0x25')])[_0x231a('0xd')](function(_0x5e8bed){if(_0x5e8bed){_0x1dcfd8[_0x231a('0x27')]=_0x5e8bed['id'];logger[_0x231a('0xb')](_0x231a('0x2a'),_0x1dcfd8[_0x231a('0x27')]);return _0x4a7f33(_0x1dcfd8);}createEndUser(_0x1dcfd8,_0x3285e5,_0x55011c,_0x14724a)[_0x231a('0xd')](function(_0x509587){logger[_0x231a('0xb')](_0x231a('0x2b'),_0x509587[_0x231a('0x27')]);return _0x4a7f33(_0x509587);});});})[_0x231a('0x15')](function(_0x59786e){_0x66fc3b(_0x59786e);});});};}function createEndUser(_0x480b6b,_0x48ecb3,_0x55ccf8,_0x2fcf9d){return new Promise(function(_0x54737d,_0x2a056b){var _0x2ea5d6=moment();var _0x580420={'method':_0x231a('0x2c'),'uri':_0x2fcf9d+_0x231a('0x2d'),'body':{'contact':{'last_name':_0x480b6b[_0x231a('0x25')],'work_number':_0x480b6b['contactNumber'],'mobile_number':_0x480b6b['contactNumber'],'owner_id':_0x480b6b[_0x231a('0x1c')],'created_at':_0x2ea5d6[_0x231a('0x23')](_0x231a('0x2e'))}},'json':!![]};_0x580420[_0x231a('0x18')]=_0x55ccf8;logger[_0x231a('0xb')](_0x231a('0x2f'));return rp(_0x580420)[_0x231a('0xd')](function(_0x48f4d2){_0x480b6b[_0x231a('0x27')]=_0x48f4d2[_0x231a('0x30')]['id'];_0x54737d(_0x480b6b);})['catch'](function(_0x366041){logger[_0x231a('0x16')]('['+[_0x48ecb3['toUpperCase']()]+']',_0x366041[_0x231a('0x1e')]);_0x2a056b(_0x366041[_0x231a('0x1e')]);});});}function getTicket(_0x179dcb,_0x5681d0,_0x3e6b86,_0x4608f2,_0xae01da){return function(_0x4d838e){logger[_0x231a('0xb')]('Creating\x20new\x20task');return new Promise(function(_0xd2735b,_0x4a816c){var _0x1f78d9=moment();var _0x2ef582={'method':_0x231a('0x2c'),'uri':_0x3e6b86+_0x231a('0x31'),'body':{'title':intUtil[_0x231a('0x32')](_0x4608f2[_0x231a('0x33')],_0xae01da,'\x20'),'description':intUtil[_0x231a('0x32')](_0x4608f2['Descriptions'],_0xae01da,'\x0a'),'owner_id':_0x4d838e[_0x231a('0x1c')],'creater_id':_0x4d838e[_0x231a('0x12')],'targetable_id':_0x4d838e[_0x231a('0x27')],'targetable_type':_0x231a('0x34'),'created_at':_0x1f78d9['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x1f78d9[_0x231a('0x35')](0x1e,'m')[_0x231a('0x23')](_0x231a('0x2e'))},'json':!![]};_0x2ef582['headers']=_0x5681d0;return rp(_0x2ef582)[_0x231a('0xd')](function(_0xb62c8d){_0x4d838e[_0x231a('0x36')]=_0xb62c8d[_0x231a('0x37')]['id'];logger[_0x231a('0xb')]('Task\x20created:',_0x4d838e[_0x231a('0x36')]);_0xd2735b(_0x4d838e);})[_0x231a('0x15')](function(_0x22d51e){logger[_0x231a('0x16')]('['+[_0x179dcb[_0x231a('0x38')]()]+']',_0x22d51e[_0x231a('0x1e')]);_0x4a816c(_0x22d51e['message']);});});};}function emit(_0x1cd868,_0x4a7fa5,_0x2eab72){var _0x3a7ecd={'uri':_0x1cd868+_0x231a('0x39')+_0x2eab72};io['to'](util['format']('user:%s',_0x4a7fa5))['emit']('trigger:browser:url',_0x3a7ecd);}exports['cs']=function(_0x42c164,_0x5bb084,_0x903196,_0x4f395a,_0x50e679,_0x13ebd4,_0x119415,_0x470e08){var _0x1ebc25={};var _0x5d1677={'Authorization':_0x231a('0x3a')+_0x13ebd4[_0x231a('0x3b')]};_0x13ebd4[_0x231a('0x3c')]=intUtil[_0x231a('0x3d')](_0x13ebd4[_0x231a('0x3c')]);_0x13ebd4[_0x231a('0x3e')]=intUtil[_0x231a('0x3d')](_0x13ebd4[_0x231a('0x3e')]);var _0x5d9f51=_0x13ebd4[_0x231a('0x3c')];_0x1ebc25[_0x231a('0x11')]=_0x13ebd4[_0x231a('0x3f')];_0x1ebc25['contactNumber']=_0x470e08[_0x231a('0x40')]()==='outbound'?_0x5bb084['destcalleridnum']:_0x5bb084[_0x231a('0x41')];_0x1ebc25[_0x231a('0x42')]=_0x470e08===_0x231a('0x43')||_0x470e08==='unmanaged'?_0x231a('0x43'):_0x231a('0x44');if(_0x4f395a){_0x1ebc25[_0x231a('0x19')]=_0x4f395a[_0x231a('0x10')];}var _0x14a2c5=util[_0x231a('0x23')](_0x231a('0x45'),_0x13ebd4['serverUrl'],_0x5bb084[_0x231a('0x46')],md5(_0x5bb084[_0x231a('0x46')]));if(_0x50e679&&_0x50e679[_0x231a('0x47')]){logger['info'](_0x231a('0x48'),_0x231a('0x49'));_0x5bb084[_0x231a('0x4a')]=_0x14a2c5;}else if(_0x119415&&_0x119415[_0x231a('0x4b')]&&_0x119415[_0x231a('0x4b')]!=='none'){logger[_0x231a('0xb')](_0x231a('0x4c'),_0x231a('0x49'));_0x5bb084[_0x231a('0x4a')]=_0x14a2c5;}else{_0x5bb084[_0x231a('0x4a')]='';}return getAdminId(_0x1ebc25,_0x470e08,_0x5d1677,_0x5d9f51)[_0x231a('0xd')](getUser(_0x470e08,_0x5d1677,_0x5d9f51))[_0x231a('0xd')](getEndUser(_0x470e08,_0x5d1677,_0x5d9f51))[_0x231a('0xd')](getTicket(_0x470e08,_0x5d1677,_0x5d9f51,_0x903196,_0x5bb084))['then'](function(_0x271e52){logger[_0x231a('0xb')](util[_0x231a('0x23')]('The\x20ticket\x20ID\x20is:\x20%s',_0x271e52[_0x231a('0x36')]));if(_0x470e08!==_0x231a('0x4d')){logger['info']('['+[_0x470e08['toUpperCase']()]+']',_0x231a('0x4e'));emit(_0x5d9f51,_0x4f395a[_0x231a('0x4f')],_0x271e52['endUserId']);}})[_0x231a('0x15')](function(_0x1521fe){logger[_0x231a('0x16')]('['+[_0x470e08[_0x231a('0x38')]()]+_0x231a('0x50'),util['inspect'](_0x1521fe,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x232f=[']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','then','users','length','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','headers','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','adminEmail','adminId','error','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','/api/tasks','getString','Descriptions','Contact','add','ticketId','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name'];(function(_0x4a372d,_0x3bd91f){var _0x546ac0=function(_0x1311f5){while(--_0x1311f5){_0x4a372d['push'](_0x4a372d['shift']());}};_0x546ac0(++_0x3bd91f);}(_0x232f,0xa9));var _0xf232=function(_0x4583f5,_0x48986e){_0x4583f5=_0x4583f5-0x0;var _0x16513b=_0x232f[_0x4583f5];return _0x16513b;};'use strict';var _=require(_0xf232('0x0'));var rp=require(_0xf232('0x1'));var md5=require(_0xf232('0x2'));var util=require(_0xf232('0x3'));var moment=require('moment');var Promise=require(_0xf232('0x4'));var Redis=require(_0xf232('0x5'));var intUtil=require(_0xf232('0x6'));var config=require(_0xf232('0x7'));var logger=require(_0xf232('0x8'))(_0xf232('0x9'));config[_0xf232('0xa')]=_[_0xf232('0xb')](config[_0xf232('0xa')],{'host':_0xf232('0xc'),'port':0x18eb});var io=require(_0xf232('0xd'))(new Redis(config[_0xf232('0xa')]));function getAdminId(_0x491c90,_0x19dc61,_0x144e56,_0x314c3a){return new Promise(function(_0x1fed48,_0x27510b){var _0x57bbca=![];var _0x4e6356={'method':_0xf232('0xe'),'uri':_0x314c3a+_0xf232('0xf'),'json':!![]};_0x4e6356['headers']=_0x144e56;logger[_0xf232('0x10')]('Getting\x20admin\x20information');return rp(_0x4e6356)[_0xf232('0x11')](function(_0x49a222){if(_0x49a222){var _0x1cdb6c=_0x49a222[_0xf232('0x12')];var _0x2d8c06=null;for(_0x2d8c06=0x0;_0x2d8c06<_0x1cdb6c[_0xf232('0x13')];_0x2d8c06++){if(_0x1cdb6c[_0x2d8c06]['email']===_0x491c90['adminEmail']){_0x491c90['adminId']=_0x1cdb6c[_0x2d8c06]['id'];_0x57bbca=!![];}}if(_0x57bbca){logger[_0xf232('0x10')](_0xf232('0x14'),_0x491c90['adminId']);_0x1fed48(_0x491c90);}else{_0x27510b({'statusCode':0x194,'message':_0xf232('0x15')});}}else{_0x27510b({'statusCode':0x194,'message':_0xf232('0x15')});}})[_0xf232('0x16')](function(_0x1a20e1){logger['error']('['+[_0x19dc61[_0xf232('0x17')]()]+']',_0x1a20e1[_0xf232('0x18')]);_0x27510b(_0x1a20e1);});});}function getUser(_0x44820a,_0x3185d1,_0x509769){return function(_0x3ffe7d){return new Promise(function(_0x52bb6c,_0x1b3621){var _0xa20261={'method':_0xf232('0xe'),'uri':_0x509769+_0xf232('0xf'),'json':!![]};_0xa20261[_0xf232('0x19')]=_0x3185d1;logger[_0xf232('0x10')]('Getting\x20user\x20list');return rp(_0xa20261)[_0xf232('0x11')](function(_0x28ed31){if(_0x28ed31){var _0x3ce1fa=_0x28ed31[_0xf232('0x12')];var _0x522b5e=![];var _0x572a71=null;if(_0x3ffe7d[_0xf232('0x1a')]!==null){logger[_0xf232('0x10')](_0xf232('0x1b'),_0x3ffe7d[_0xf232('0x1a')]);_0x3ffe7d[_0xf232('0x1c')]=_0x3ffe7d[_0xf232('0x1a')];for(_0x572a71=0x0;_0x572a71<_0x3ce1fa[_0xf232('0x13')];_0x572a71++){if(_0x3ce1fa[_0x572a71]['email']===_0x3ffe7d[_0xf232('0x1a')]){_0x522b5e=!![];_0x3ffe7d['userId']=_0x3ce1fa[_0x572a71]['id'];logger[_0xf232('0x10')]('User\x20found:',_0x3ffe7d[_0xf232('0x1d')]);}}}if(!_0x522b5e){logger[_0xf232('0x10')](_0xf232('0x1e'));_0x3ffe7d[_0xf232('0x1c')]=_0x3ffe7d[_0xf232('0x1f')];_0x3ffe7d[_0xf232('0x1d')]=_0x3ffe7d[_0xf232('0x20')];_0x522b5e=!![];}if(_0x522b5e){_0x52bb6c(_0x3ffe7d);}else{_0x1b3621({'statusCode':0x194,'message':_0xf232('0x15')});}}else{_0x1b3621({'statusCode':0x194,'message':_0xf232('0x15')});}})[_0xf232('0x16')](function(_0x1a952e){logger[_0xf232('0x21')]('['+[_0x44820a[_0xf232('0x17')]()]+']',_0x1a952e[_0xf232('0x18')]);_0x1b3621(_0x1a952e);});});};}function searchContact(_0x3d97ce,_0x33bbb7,_0x5c6ae4,_0x3b38ce){return new Promise(function(_0x519a33,_0x5c6367){var _0x9d4b1f={'method':_0xf232('0xe'),'headers':_0x33bbb7,'uri':_0x3d97ce+'/api/lookup?q='+_0x3b38ce+_0xf232('0x22')+_0x5c6ae4+_0xf232('0x23'),'json':!![]};rp(_0x9d4b1f)[_0xf232('0x11')](function(_0x231ed7){var _0x211f0b=_[_0xf232('0x24')](_0x231ed7[_0xf232('0x25')]['contacts'],[_0x5c6ae4,_0x3b38ce]);_0x519a33(_0x211f0b);})['catch'](function(_0x1bc9ec){_0x5c6367(_0x1bc9ec);});});}function getEndUser(_0x5a7490,_0xb31f1a,_0x13a35c){return function(_0x2c8caf){return new Promise(function(_0x28a098,_0x22876d){logger[_0xf232('0x10')](util['format'](_0xf232('0x26'),_0x2c8caf[_0xf232('0x27')]));searchContact(_0x13a35c,_0xb31f1a,_0xf232('0x28'),_0x2c8caf[_0xf232('0x27')])[_0xf232('0x11')](function(_0x3e95b3){if(_0x3e95b3){_0x2c8caf[_0xf232('0x29')]=_0x3e95b3['id'];logger[_0xf232('0x10')](_0xf232('0x2a'),_0x2c8caf[_0xf232('0x29')]);return _0x28a098(_0x2c8caf);}searchContact(_0x13a35c,_0xb31f1a,_0xf232('0x2b'),_0x2c8caf[_0xf232('0x27')])[_0xf232('0x11')](function(_0x1ce5f0){if(_0x1ce5f0){_0x2c8caf['endUserId']=_0x1ce5f0['id'];logger[_0xf232('0x10')]('Contact\x20found\x20work_number:',_0x2c8caf[_0xf232('0x29')]);return _0x28a098(_0x2c8caf);}createEndUser(_0x2c8caf,_0x5a7490,_0xb31f1a,_0x13a35c)[_0xf232('0x11')](function(_0x316d63){logger['info']('Contact\x20created:',_0x316d63[_0xf232('0x29')]);return _0x28a098(_0x316d63);});});})[_0xf232('0x16')](function(_0x564781){_0x22876d(_0x564781);});});};}function createEndUser(_0x3c4ee7,_0x57f2d7,_0x2a13c6,_0x3dd472){return new Promise(function(_0x30c0f8,_0x53270f){var _0x4300f6=moment();var _0x24345f={'method':'POST','uri':_0x3dd472+_0xf232('0x2c'),'body':{'contact':{'last_name':_0x3c4ee7['contactNumber'],'work_number':_0x3c4ee7[_0xf232('0x27')],'mobile_number':_0x3c4ee7[_0xf232('0x27')],'owner_id':_0x3c4ee7[_0xf232('0x1d')],'created_at':_0x4300f6[_0xf232('0x2d')](_0xf232('0x2e'))}},'json':!![]};_0x24345f[_0xf232('0x19')]=_0x2a13c6;logger['info'](_0xf232('0x2f'));return rp(_0x24345f)[_0xf232('0x11')](function(_0x25a674){_0x3c4ee7[_0xf232('0x29')]=_0x25a674[_0xf232('0x30')]['id'];_0x30c0f8(_0x3c4ee7);})[_0xf232('0x16')](function(_0x1bad4c){logger['error']('['+[_0x57f2d7[_0xf232('0x17')]()]+']',_0x1bad4c[_0xf232('0x18')]);_0x53270f(_0x1bad4c['message']);});});}function getTicket(_0x4f233d,_0x37b7b4,_0x3b5a73,_0xb1738c,_0x75747e){return function(_0x22619d){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x1b94bd,_0x484034){var _0x2b1dfa=moment();var _0x1267a0={'method':_0xf232('0x31'),'uri':_0x3b5a73+_0xf232('0x32'),'body':{'title':intUtil['getString'](_0xb1738c['Subjects'],_0x75747e,'\x20'),'description':intUtil[_0xf232('0x33')](_0xb1738c[_0xf232('0x34')],_0x75747e,'\x0a'),'owner_id':_0x22619d['userId'],'creater_id':_0x22619d[_0xf232('0x20')],'targetable_id':_0x22619d[_0xf232('0x29')],'targetable_type':_0xf232('0x35'),'created_at':_0x2b1dfa[_0xf232('0x2d')](_0xf232('0x2e')),'due_date':_0x2b1dfa[_0xf232('0x36')](0x1e,'m')[_0xf232('0x2d')](_0xf232('0x2e'))},'json':!![]};_0x1267a0[_0xf232('0x19')]=_0x37b7b4;return rp(_0x1267a0)[_0xf232('0x11')](function(_0x59b28d){_0x22619d[_0xf232('0x37')]=_0x59b28d['task']['id'];logger['info'](_0xf232('0x38'),_0x22619d[_0xf232('0x37')]);_0x1b94bd(_0x22619d);})[_0xf232('0x16')](function(_0x15faf3){logger[_0xf232('0x21')]('['+[_0x4f233d[_0xf232('0x17')]()]+']',_0x15faf3[_0xf232('0x18')]);_0x484034(_0x15faf3[_0xf232('0x18')]);});});};}function emit(_0x510ae5,_0x22b85f,_0x36c7cc){var _0x4872a9={'uri':_0x510ae5+'/contacts/'+_0x36c7cc};io['to'](util[_0xf232('0x2d')](_0xf232('0x39'),_0x22b85f))[_0xf232('0x3a')](_0xf232('0x3b'),_0x4872a9);}exports['cs']=function(_0x54aa58,_0x2e139b,_0x5317dc,_0x19dcfd,_0xa5dc4c,_0x195f8d,_0x5b5b78,_0x34cdd2){var _0xde6e23={};var _0x46bb4b={'Authorization':_0xf232('0x3c')+_0x195f8d[_0xf232('0x3d')]};_0x195f8d['remoteUri']=intUtil[_0xf232('0x3e')](_0x195f8d[_0xf232('0x3f')]);_0x195f8d['serverUrl']=intUtil['stripTrailingSlash'](_0x195f8d[_0xf232('0x40')]);var _0x4c9b07=_0x195f8d['remoteUri'];_0xde6e23[_0xf232('0x1f')]=_0x195f8d['username'];_0xde6e23['contactNumber']=_0x34cdd2[_0xf232('0x41')]()===_0xf232('0x42')?_0x2e139b['destcalleridnum']:_0x2e139b[_0xf232('0x43')];_0xde6e23[_0xf232('0x44')]=_0x34cdd2===_0xf232('0x45')||_0x34cdd2===_0xf232('0x46')?_0xf232('0x45'):_0xf232('0x42');if(_0x19dcfd){_0xde6e23['agentEmail']=_0x19dcfd[_0xf232('0x47')];}var _0x147fef=util[_0xf232('0x2d')](_0xf232('0x48'),_0x195f8d[_0xf232('0x40')],_0x2e139b[_0xf232('0x49')],md5(_0x2e139b[_0xf232('0x49')]));if(_0xa5dc4c&&_0xa5dc4c[_0xf232('0x4a')]){logger[_0xf232('0x10')](_0xf232('0x4b'),_0xf232('0x4c'));_0x2e139b[_0xf232('0x4d')]=_0x147fef;}else if(_0x5b5b78&&_0x5b5b78['recordingFormat']&&_0x5b5b78[_0xf232('0x4e')]!=='none'){logger[_0xf232('0x10')](_0xf232('0x4f'),_0xf232('0x4c'));_0x2e139b[_0xf232('0x4d')]=_0x147fef;}else{_0x2e139b[_0xf232('0x4d')]='';}return getAdminId(_0xde6e23,_0x34cdd2,_0x46bb4b,_0x4c9b07)[_0xf232('0x11')](getUser(_0x34cdd2,_0x46bb4b,_0x4c9b07))['then'](getEndUser(_0x34cdd2,_0x46bb4b,_0x4c9b07))[_0xf232('0x11')](getTicket(_0x34cdd2,_0x46bb4b,_0x4c9b07,_0x5317dc,_0x2e139b))[_0xf232('0x11')](function(_0x4ca573){logger[_0xf232('0x10')](util[_0xf232('0x2d')](_0xf232('0x50'),_0x4ca573[_0xf232('0x37')]));if(_0x34cdd2!=='unmanaged'){logger[_0xf232('0x10')]('['+[_0x34cdd2[_0xf232('0x17')]()]+']',_0xf232('0x51'));emit(_0x4c9b07,_0x19dcfd[_0xf232('0x52')],_0x4ca573[_0xf232('0x29')]);}})['catch'](function(_0x30635a){logger[_0xf232('0x21')]('['+[_0x34cdd2[_0xf232('0x17')]()]+_0xf232('0x53'),util['inspect'](_0x30635a,{'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 ee7b712..9bf200f 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 _0x80ae=['freshdesk','log','unknown\x20integration','error','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./freshdesk','./desk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','Configurations','data3','queue','outbound','EVENT\x20UNKNOWN'];(function(_0x44469c,_0x2d3b10){var _0x57315e=function(_0xe2ce40){while(--_0xe2ce40){_0x44469c['push'](_0x44469c['shift']());}};_0x57315e(++_0x2d3b10);}(_0x80ae,0x144));var _0xe80a=function(_0x366e99,_0x15d82d){_0x366e99=_0x366e99-0x0;var _0x180bbe=_0x80ae[_0x366e99];return _0x180bbe;};'use strict';var _=require(_0xe80a('0x0'));var util=require('util');var zendesk=require(_0xe80a('0x1'));var salesforce=require(_0xe80a('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xe80a('0x3'));var zoho=require('./zoho');var desk=require(_0xe80a('0x4'));var vtiger=require('./vtiger');var servicenow=require(_0xe80a('0x5'));var dynamics365=require(_0xe80a('0x6'));var freshsales=require(_0xe80a('0x7'));var integrations=[_0xe80a('0x8'),_0xe80a('0x9'),_0xe80a('0xa'),'freshdesk',_0xe80a('0xb'),_0xe80a('0xc'),_0xe80a('0xd'),'dynamics365',_0xe80a('0xe'),_0xe80a('0xf')];exports[_0xe80a('0x10')]=function(_0x2980fd,_0x194cce,_0xa2b8af,_0x59a322,_0x18fe2b,_0x3ad997){if(_0xa2b8af){if(_[_0xe80a('0x11')](integrations,_0x2980fd[_0xe80a('0x12')][_0xe80a('0x13')]())){try{var _0x2d9823=null;var _0x1acff1='';var _0x45b54f=_0xa2b8af[_0x2980fd[_0xe80a('0x12')][_0xe80a('0x13')]()];if(_0x45b54f){var _0x5a0ecd=_0x45b54f[_0x2980fd[_0xe80a('0x14')]];if(_0x5a0ecd){var _0x34ca76=_['find'](_0x5a0ecd[_0xe80a('0x15')],{'id':parseInt(_0x2980fd[_0xe80a('0x16')],0xa)});if(_0x34ca76){if(_0x59a322){if(_0x18fe2b&&_0x194cce[_0xe80a('0x17')]){_0x1acff1=_0xe80a('0x17');}else if(_0x194cce['routeId']){_0x1acff1=_0xe80a('0x18');}else{console['log'](_0xe80a('0x19'),_0x194cce);}}else{_0x1acff1='unmanaged';}switch(_0x2980fd[_0xe80a('0x12')]['toLowerCase']()){case _0xe80a('0x8'):zendesk[_0x1acff1](_0x2980fd,_0x194cce,_0x34ca76,_0x59a322,_0x18fe2b,_0x5a0ecd,_0x3ad997);break;case _0xe80a('0x9'):salesforce[_0x1acff1](_0x2980fd,_0x194cce,_0x34ca76,_0x59a322,_0x18fe2b,_0x5a0ecd,_0x3ad997);break;case _0xe80a('0xa'):sugarcrm[_0x1acff1](_0x2980fd,_0x194cce,_0x34ca76,_0x59a322,_0x18fe2b,_0x5a0ecd,_0x3ad997);break;case _0xe80a('0x1a'):freshdesk[_0x1acff1](_0x2980fd,_0x194cce,_0x34ca76,_0x59a322,_0x18fe2b,_0x5a0ecd,_0x3ad997);break;case _0xe80a('0xb'):zoho[_0x1acff1](_0x2980fd,_0x194cce,_0x34ca76,_0x59a322,_0x18fe2b,_0x5a0ecd,_0x3ad997);break;case'desk':desk[_0x1acff1](_0x2980fd,_0x194cce,_0x34ca76,_0x59a322,_0x18fe2b,_0x5a0ecd,_0x3ad997);break;case'vtiger':vtiger[_0x1acff1](_0x2980fd,_0x194cce,_0x34ca76,_0x59a322,_0x18fe2b,_0x5a0ecd,_0x3ad997);break;case _0xe80a('0xe'):freshsales['cs'](_0x2980fd,_0x194cce,_0x34ca76,_0x59a322,_0x18fe2b,_0x5a0ecd,_0x3ad997,_0x1acff1);break;case'servicenow':servicenow['cs'](_0x2980fd,_0x194cce,_0x34ca76,_0x59a322,_0x18fe2b,_0x5a0ecd,_0x3ad997,_0x1acff1);break;case'dynamics365':dynamics365['cs'](_0x2980fd,_0x194cce,_0x34ca76,_0x59a322,_0x18fe2b,_0x5a0ecd,_0x3ad997,_0x1acff1);break;default:console[_0xe80a('0x1b')](_0xe80a('0x1c'));}}else{_0x2d9823=require('../../../../config/logger')(_0x2980fd[_0xe80a('0x12')][_0xe80a('0x13')]());_0x2d9823[_0xe80a('0x1d')]('[EXEC]',util[_0xe80a('0x1e')](_0xe80a('0x1f'),_0x2980fd[_0xe80a('0x12')]['toLowerCase'](),_0x2980fd[_0xe80a('0x16')]));}}else{_0x2d9823=require(_0xe80a('0x20'))(_0x2980fd['data1'][_0xe80a('0x13')]());_0x2d9823['error'](_0xe80a('0x21'),util[_0xe80a('0x1e')](_0xe80a('0x22'),_0x2980fd[_0xe80a('0x12')][_0xe80a('0x13')](),_0x2980fd[_0xe80a('0x14')]));}}else{}}catch(_0x2ca315){console['error'](_0x2ca315);}}}}; \ No newline at end of file +var _0xfc89=['toLowerCase','data1','find','Configurations','queue','outbound','log','unmanaged','zendesk','dynamics365','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','data3','[EXEC]','%s\x20account\x20#%s\x20not\x20found','data2','./zendesk','./sugarcrm','./zoho','./desk','./dynamics365','./freshsales','sugarcrm','freshdesk','zoho','vtiger','servicenow','exec','includes'];(function(_0x20a086,_0x15cef2){var _0x379cc3=function(_0xe4c176){while(--_0xe4c176){_0x20a086['push'](_0x20a086['shift']());}};_0x379cc3(++_0x15cef2);}(_0xfc89,0xf3));var _0x9fc8=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xfc89[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x9fc8('0x0'));var salesforce=require('./salesforce');var sugarcrm=require(_0x9fc8('0x1'));var freshdesk=require('./freshdesk');var zoho=require(_0x9fc8('0x2'));var desk=require(_0x9fc8('0x3'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x9fc8('0x4'));var freshsales=require(_0x9fc8('0x5'));var integrations=['zendesk','salesforce',_0x9fc8('0x6'),_0x9fc8('0x7'),_0x9fc8('0x8'),'desk',_0x9fc8('0x9'),'dynamics365','freshsales',_0x9fc8('0xa')];exports[_0x9fc8('0xb')]=function(_0x35ecf0,_0x463b45,_0xd246c8,_0x459ec9,_0x5d5b18,_0x32991c){if(_0xd246c8){if(_[_0x9fc8('0xc')](integrations,_0x35ecf0['data1'][_0x9fc8('0xd')]())){try{var _0x500801=null;var _0x44cba8='';var _0x3c45e4=_0xd246c8[_0x35ecf0[_0x9fc8('0xe')][_0x9fc8('0xd')]()];if(_0x3c45e4){var _0x408381=_0x3c45e4[_0x35ecf0['data2']];if(_0x408381){var _0x1a59b6=_[_0x9fc8('0xf')](_0x408381[_0x9fc8('0x10')],{'id':parseInt(_0x35ecf0['data3'],0xa)});if(_0x1a59b6){if(_0x459ec9){if(_0x5d5b18&&_0x463b45[_0x9fc8('0x11')]){_0x44cba8=_0x9fc8('0x11');}else if(_0x463b45['routeId']){_0x44cba8=_0x9fc8('0x12');}else{console[_0x9fc8('0x13')]('EVENT\x20UNKNOWN',_0x463b45);}}else{_0x44cba8=_0x9fc8('0x14');}switch(_0x35ecf0[_0x9fc8('0xe')][_0x9fc8('0xd')]()){case _0x9fc8('0x15'):zendesk[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case'salesforce':salesforce[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case _0x9fc8('0x6'):sugarcrm[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case _0x9fc8('0x7'):freshdesk[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case _0x9fc8('0x8'):zoho[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case'desk':desk[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case'vtiger':vtiger[_0x44cba8](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c);break;case'freshsales':freshsales['cs'](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c,_0x44cba8);break;case _0x9fc8('0xa'):servicenow['cs'](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c,_0x44cba8);break;case _0x9fc8('0x16'):dynamics365['cs'](_0x35ecf0,_0x463b45,_0x1a59b6,_0x459ec9,_0x5d5b18,_0x408381,_0x32991c,_0x44cba8);break;default:console[_0x9fc8('0x13')](_0x9fc8('0x17'));}}else{_0x500801=require(_0x9fc8('0x18'))(_0x35ecf0[_0x9fc8('0xe')][_0x9fc8('0xd')]());_0x500801[_0x9fc8('0x19')]('[EXEC]',util[_0x9fc8('0x1a')](_0x9fc8('0x1b'),_0x35ecf0['data1'][_0x9fc8('0xd')](),_0x35ecf0[_0x9fc8('0x1c')]));}}else{_0x500801=require(_0x9fc8('0x18'))(_0x35ecf0[_0x9fc8('0xe')][_0x9fc8('0xd')]());_0x500801['error'](_0x9fc8('0x1d'),util[_0x9fc8('0x1a')](_0x9fc8('0x1e'),_0x35ecf0[_0x9fc8('0xe')]['toLowerCase'](),_0x35ecf0[_0x9fc8('0x1f')]));}}else{}}catch(_0x5390f5){console[_0x9fc8('0x19')](_0x5390f5);}}}}; \ 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 b3ff9e5..31bc99e 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 _0x1eff=['variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','[OUTBOUND]','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','defaults','localhost','socket.io-emitter','redis','emit','assign','getString','Subjects','Task','utc','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','account','WhatId','ticketType','Case','ContactId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','isNil','validateEmail','sobject','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','upperFirst','create','includes','type','idField','content','toString'];(function(_0x5894c0,_0xba3d89){var _0x4369e7=function(_0x4d8e93){while(--_0x4d8e93){_0x5894c0['push'](_0x5894c0['shift']());}};_0x4369e7(++_0xba3d89);}(_0x1eff,0xb3));var _0xf1ef=function(_0x490fb0,_0x38c69e){_0x490fb0=_0x490fb0-0x0;var _0x4d1df6=_0x1eff[_0x490fb0];return _0x4d1df6;};'use strict';var _=require(_0xf1ef('0x0'));var rp=require('request-promise');var moment=require(_0xf1ef('0x1'));var BPromise=require(_0xf1ef('0x2'));var md5=require(_0xf1ef('0x3'));var jsforce=require(_0xf1ef('0x4'));var util=require(_0xf1ef('0x5'));var Redis=require(_0xf1ef('0x6'));var intUtil=require(_0xf1ef('0x7'));var config=require(_0xf1ef('0x8'));var logger=require('../../../../config/logger')(_0xf1ef('0x9'));config['redis']=_[_0xf1ef('0xa')](config['redis'],{'host':_0xf1ef('0xb'),'port':0x18eb});var io=require(_0xf1ef('0xc'))(new Redis(config[_0xf1ef('0xd')]));function emit(_0x41ca84,_0x2748b0,_0x28790e){io['to'](_0x41ca84)[_0xf1ef('0xe')](_0x2748b0,_0x28790e);}function getTicket(_0x1d1b28,_0x1d06a6,_0x2946f9,_0x4777de,_0x295838,_0x37d9fd,_0x3a30f8,_0x5b0f61){var _0x20815e=Object[_0xf1ef('0xf')]({},{'OwnerId':_0x1d06a6['id'],'Subject':intUtil[_0xf1ef('0x10')](_0x4777de[_0xf1ef('0x11')],_0x295838,'\x20'),'Description':intUtil[_0xf1ef('0x10')](_0x4777de['Descriptions'],_0x295838,'\x0a')},getCustomFields(_0x37d9fd,_0x295838));if(_0x2946f9){if(_0x4777de['ticketType']===_0xf1ef('0x12')){_0x20815e['ActivityDate']=moment[_0xf1ef('0x13')]();_0x20815e[_0xf1ef('0x14')]=![];_0x20815e[_0xf1ef('0x15')]=![];if(_0x2946f9[_0xf1ef('0x16')]===_0xf1ef('0x17')||_0x2946f9[_0xf1ef('0x16')]==='lead'){_0x20815e[_0xf1ef('0x18')]=_0x2946f9['id'];}else if(_0x2946f9[_0xf1ef('0x16')]===_0xf1ef('0x19')){_0x20815e[_0xf1ef('0x1a')]=_0x2946f9['id'];}}else if(_0x4777de[_0xf1ef('0x1b')]===_0xf1ef('0x1c')){if(_0x2946f9[_0xf1ef('0x16')]===_0xf1ef('0x17')){_0x20815e[_0xf1ef('0x1d')]=_0x2946f9['id'];}else if(_0x2946f9['endUserType']==='account'){_0x20815e['AccountId']=_0x2946f9['id'];}else if(_0x2946f9[_0xf1ef('0x16')]===_0xf1ef('0x1e')&&_0x4777de[_0xf1ef('0x1f')]){_0x20815e[_0x4777de[_0xf1ef('0x1f')]]=_0x2946f9['id'];}else{logger[_0xf1ef('0x20')](_0xf1ef('0x21'));}}}return _0x3a30f8['sobject'](_0x4777de[_0xf1ef('0x1b')])['create'](_0x20815e);}function getUser(_0x214a08,_0x5f36b9,_0x4fd95f){if(!_[_0xf1ef('0x22')](_0x5f36b9)&&intUtil[_0xf1ef('0x23')](_0x5f36b9)){var _0x334288={'Email':_0x5f36b9};var _0x3f10a2={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4fd95f[_0xf1ef('0x24')](_0xf1ef('0x25'))[_0xf1ef('0x26')](_0x334288,_0x3f10a2)[_0xf1ef('0x27')]()[_0xf1ef('0x28')](function(_0x18bc8f){if(_0x18bc8f[_0xf1ef('0x29')]){var _0x41ec01=_[_0xf1ef('0x26')](_0x18bc8f,function(_0x57807d){return _0x57807d[_0xf1ef('0x2a')]===_0x5f36b9;});if(_0x41ec01){logger[_0xf1ef('0x20')](_0xf1ef('0x2b'),_0x5f36b9);return BPromise[_0xf1ef('0x2c')]({'id':_0x41ec01['Id'],'name':_0x41ec01[_0xf1ef('0x2d')]});}}else{logger[_0xf1ef('0x20')](_0xf1ef('0x2e'),_0x5f36b9);return _0x4fd95f[_0xf1ef('0x2f')]()['then'](function(_0x2a8f6d){return BPromise[_0xf1ef('0x2c')]({'id':_0x2a8f6d[_0xf1ef('0x30')],'name':_0x2a8f6d[_0xf1ef('0x31')]});});}});}else{logger[_0xf1ef('0x20')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5f36b9);return _0x4fd95f[_0xf1ef('0x2f')]()['then'](function(_0xf65a5b){return BPromise[_0xf1ef('0x2c')]({'id':_0xf65a5b[_0xf1ef('0x30')],'name':_0xf65a5b[_0xf1ef('0x31')]});});}}function getEndUser(_0x821120,_0x790f3a,_0x4acd2f,_0x2f216c,_0x1b1fc3){var _0x4798d9={'$or':{'Phone':_0x2f216c}};var _0x587980={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xf1ef('0x28')](function(){logger['info'](_0xf1ef('0x32'),_0x2f216c,_0x790f3a['moduleSearch']);switch(_0x790f3a[_0xf1ef('0x33')]){case _0xf1ef('0x34'):var _0x4b066a=_[_0xf1ef('0x35')](_0x4798d9);if(_0x790f3a[_0xf1ef('0x36')]){var _0x2ebf2e={};_0x2ebf2e[_0x790f3a[_0xf1ef('0x36')]]=_0x2f216c;_['merge'](_0x4b066a[_0xf1ef('0x37')],_0x2ebf2e);}return _0x1b1fc3[_0xf1ef('0x24')](_0xf1ef('0x38'))[_0xf1ef('0x26')](_0x4b066a,_0x587980)[_0xf1ef('0x27')]()[_0xf1ef('0x28')](function(_0x463b85){if(_0x463b85&&_0x463b85[_0xf1ef('0x29')]){return _0x463b85;}else{var _0x238b56=_[_0xf1ef('0x35')](_0x4798d9);if(_0x790f3a[_0xf1ef('0x39')]){var _0x35fef7={};_0x35fef7[_0x790f3a['additionalSearchLead']]=_0x2f216c;_[_0xf1ef('0x3a')](_0x238b56[_0xf1ef('0x37')],_0x35fef7);}return _0x1b1fc3['sobject'](_0xf1ef('0x3b'))['find'](_0x238b56,_0x587980);}});case _0xf1ef('0x3c'):var _0x5560cb=_[_0xf1ef('0x35')](_0x4798d9);if(_0x790f3a[_0xf1ef('0x3d')]){var _0x2ebf2e={};_0x2ebf2e[_0x790f3a['additionalSearchAccount']]=_0x2f216c;_[_0xf1ef('0x3a')](_0x5560cb['$or'],_0x2ebf2e);}return _0x1b1fc3[_0xf1ef('0x24')](_0xf1ef('0x3e'))['find'](_0x5560cb,_0x587980)[_0xf1ef('0x27')]()['then'](function(_0x5f2589){if(_0x5f2589&&_0x5f2589[_0xf1ef('0x29')]){return _0x5f2589;}else{var _0x7db0d9=_[_0xf1ef('0x35')](_0x4798d9);if(_0x790f3a[_0xf1ef('0x36')]){var _0x42f26c={};_0x42f26c[_0x790f3a[_0xf1ef('0x36')]]=_0x2f216c;_[_0xf1ef('0x3a')](_0x7db0d9['$or'],_0x42f26c);}return _0x1b1fc3[_0xf1ef('0x24')]('Contact')[_0xf1ef('0x26')](_0x7db0d9,_0x587980)[_0xf1ef('0x28')](function(_0x5b095f){if(_0x5b095f&&_0x5b095f['length']){return _0x5b095f;}else{var _0x11f38a=_[_0xf1ef('0x35')](_0x4798d9);if(_0x790f3a['additionalSearchLead']){var _0x535ea7={};_0x535ea7[_0x790f3a[_0xf1ef('0x39')]]=_0x2f216c;_[_0xf1ef('0x3a')](_0x11f38a[_0xf1ef('0x37')],_0x535ea7);}return _0x1b1fc3[_0xf1ef('0x24')](_0xf1ef('0x3b'))[_0xf1ef('0x26')](_0x11f38a,_0x587980);}});}});case _0xf1ef('0x17'):var _0x4b066a=_[_0xf1ef('0x35')](_0x4798d9);if(_0x790f3a['additionalSearchContact']){var _0x2ebf2e={};_0x2ebf2e[_0x790f3a[_0xf1ef('0x36')]]=_0x2f216c;_['merge'](_0x4b066a[_0xf1ef('0x37')],_0x2ebf2e);}return _0x1b1fc3[_0xf1ef('0x24')](_0xf1ef('0x38'))[_0xf1ef('0x26')](_0x4b066a,_0x587980)['execute']();case _0xf1ef('0x1e'):var _0x233282=_['cloneDeep'](_0x4798d9);if(_0x790f3a['additionalSearchLead']){var _0x2ebf2e={};_0x2ebf2e[_0x790f3a[_0xf1ef('0x39')]]=_0x2f216c;_['merge'](_0x233282[_0xf1ef('0x37')],_0x2ebf2e);}return _0x1b1fc3[_0xf1ef('0x24')](_0xf1ef('0x3b'))[_0xf1ef('0x26')](_0x233282,_0x587980);case _0xf1ef('0x19'):var _0x5560cb=_[_0xf1ef('0x35')](_0x4798d9);if(_0x790f3a[_0xf1ef('0x3d')]){var _0x2ebf2e={};_0x2ebf2e[_0x790f3a[_0xf1ef('0x3d')]]=_0x2f216c;_[_0xf1ef('0x3a')](_0x5560cb[_0xf1ef('0x37')],_0x2ebf2e);}return _0x1b1fc3[_0xf1ef('0x24')](_0xf1ef('0x3e'))[_0xf1ef('0x26')](_0x5560cb,_0x587980);default:return null;}})['then'](function(_0xbdbeb){if(_0xbdbeb&&_0xbdbeb[_0xf1ef('0x29')]){var _0xe3241b=_[_0xf1ef('0x3f')](_0xbdbeb);if(_0xe3241b){return BPromise[_0xf1ef('0x2c')]({'id':_0xe3241b['Id'],'name':_0xe3241b[_0xf1ef('0x2d')],'phone':_0xe3241b[_0xf1ef('0x40')],'endUserType':_0xe3241b[_0xf1ef('0x41')]['type'][_0xf1ef('0x42')]()});}}})[_0xf1ef('0x28')](function(_0x35d7e0){if(_0x35d7e0){logger[_0xf1ef('0x20')](_0xf1ef('0x43'),_0x35d7e0['endUserType'],_0x2f216c);return BPromise[_0xf1ef('0x2c')](_0x35d7e0);}else{logger[_0xf1ef('0x20')](_0xf1ef('0x44'),_0x2f216c);var _0x44efd2={'Phone':_0x2f216c};if(_0x790f3a[_0xf1ef('0x45')]){if(_0x790f3a[_0xf1ef('0x45')]===_0xf1ef('0x17')){logger[_0xf1ef('0x20')](_0xf1ef('0x46'),_0x2f216c,_0x790f3a[_0xf1ef('0x45')]);_0x44efd2[_0xf1ef('0x47')]=_0x4acd2f!==_0xf1ef('0x48')?_0x4acd2f:util[_0xf1ef('0x49')](_0xf1ef('0x4a'),_0x2f216c);}else if(_0x790f3a[_0xf1ef('0x45')]==='lead'){logger['info'](_0xf1ef('0x46'),_0x2f216c,_0x790f3a[_0xf1ef('0x45')]);_0x44efd2[_0xf1ef('0x47')]=_0x4acd2f!==''?_0x4acd2f:util['format'](_0xf1ef('0x4a'),_0x2f216c);_0x44efd2[_0xf1ef('0x4b')]='No\x20Company';}else if(_0x790f3a[_0xf1ef('0x45')]===_0xf1ef('0x19')){logger[_0xf1ef('0x20')](_0xf1ef('0x46'),_0x2f216c,_0x790f3a[_0xf1ef('0x45')]);_0x44efd2[_0xf1ef('0x2d')]=_0x4acd2f!==_0xf1ef('0x48')?_0x4acd2f:util['format']('Caller\x20-\x20%s',_0x2f216c);}else{return null;}}return _0x1b1fc3[_0xf1ef('0x24')](_[_0xf1ef('0x4c')](_0x790f3a['moduleCreate']))[_0xf1ef('0x4d')](_0x44efd2)[_0xf1ef('0x28')](function(_0x203efb){return BPromise[_0xf1ef('0x2c')]({'id':_0x203efb['id'],'endUserType':_0x790f3a[_0xf1ef('0x45')]});});}});}function getCustomFields(_0x2173b2,_0x52cb3f){var _0x329349={};if(_0x2173b2[_0xf1ef('0x29')]>0x0){_['forEach'](_0x2173b2,function(_0x305869){if(_[_0xf1ef('0x4e')](['string','picklist'],_0x305869[_0xf1ef('0x4f')])&&_0x305869[_0xf1ef('0x50')]){_0x329349[_0x305869[_0xf1ef('0x50')]]=_0x305869[_0xf1ef('0x51')][_0xf1ef('0x52')]();}else if(_0x305869[_0xf1ef('0x4f')]==='variable'&&_0x305869[_0xf1ef('0x53')]&&_0x305869['idField']){_0x52cb3f[_0x305869[_0xf1ef('0x53')]]&&(_0x329349[_0x305869[_0xf1ef('0x50')]]=_0x52cb3f[_0x305869[_0xf1ef('0x53')]][_0xf1ef('0x52')]());}else if(_0x305869[_0xf1ef('0x4f')]===_0xf1ef('0x54')&&_0x305869[_0xf1ef('0x55')]&&_0x305869[_0xf1ef('0x55')][_0xf1ef('0x56')]&&_0x305869[_0xf1ef('0x50')]){_0x52cb3f[_0x305869[_0xf1ef('0x55')][_0xf1ef('0x56')][_0xf1ef('0x42')]()]&&(_0x329349[_0x305869['idField']]=_0x52cb3f[_0x305869['Variable']['name'][_0xf1ef('0x42')]()][_0xf1ef('0x52')]());}});}return _0x329349;}function getConnection(_0x3dd94c){var _0x4cc352=_0x3dd94c[_0xf1ef('0x57')][_0xf1ef('0x58')](_0x3dd94c[_0xf1ef('0x59')]);var _0x3074a1=new jsforce[(_0xf1ef('0x5a'))]({'oauth2':{'loginUrl':_0x3dd94c[_0xf1ef('0x5b')]||_0xf1ef('0x5c'),'clientId':_0x3dd94c[_0xf1ef('0x5d')],'clientSecret':_0x3dd94c[_0xf1ef('0x5e')]}});return _0x3074a1[_0xf1ef('0x5f')](_0x3dd94c[_0xf1ef('0x60')],_0x4cc352)[_0xf1ef('0x28')](function(){logger[_0xf1ef('0x20')](_0xf1ef('0x61'));return _0x3074a1;});}exports['queue']=function(_0x3d0d12,_0x1e4862,_0x4a81c9,_0x88bcb2,_0x22a7e6,_0x3e0611){var _0x59d55f,_0xfe42d2,_0x47c9b8,_0x1def57;_0x3e0611['serverUrl']=intUtil[_0xf1ef('0x62')](_0x3e0611[_0xf1ef('0x63')]);_0x3e0611['remoteUri']=intUtil['stripTrailingSlash'](_0x3e0611[_0xf1ef('0x5b')]);if(_0x22a7e6&&_0x22a7e6[_0xf1ef('0x64')]){logger[_0xf1ef('0x20')](_0xf1ef('0x65'),_0xf1ef('0x66'));_0x1e4862['recordingURL']=util[_0xf1ef('0x49')](_0xf1ef('0x67'),_0x3e0611[_0xf1ef('0x63')],_0x1e4862[_0xf1ef('0x68')],md5(_0x1e4862[_0xf1ef('0x68')]));}else{_0x1e4862[_0xf1ef('0x69')]='';}return getConnection(_0x3e0611)[_0xf1ef('0x28')](function(_0x1165f7){_0x1def57=_0x1165f7;return getUser(_0x3e0611,_0x88bcb2[_0xf1ef('0x6a')],_0x1def57);})[_0xf1ef('0x28')](function(_0x502d08){_0x59d55f=_0x502d08;return getEndUser(_0x3e0611,_0x4a81c9,_0x1e4862[_0xf1ef('0x6b')],_0x1e4862[_0xf1ef('0x6c')],_0x1def57);})[_0xf1ef('0x28')](function(_0x5c2d40){_0xfe42d2=_0x5c2d40;return getTicket(_0x3e0611,_0x59d55f,_0xfe42d2,_0x4a81c9,_0x1e4862,_0x4a81c9[_0xf1ef('0x6d')],_0x1def57,'queue');})['then'](function(_0x39952d){_0x47c9b8=_0x39952d;logger[_0xf1ef('0x20')](_0xf1ef('0x6e'),_0x47c9b8['id']);logger[_0xf1ef('0x20')](_0xf1ef('0x6f'),_0x47c9b8['id'],_0x88bcb2[_0xf1ef('0x56')],_0x3e0611[_0xf1ef('0x4f')]);switch(_0x3e0611['type']){case'integrationTab':emit(util[_0xf1ef('0x49')]('user:%s',_0x88bcb2[_0xf1ef('0x56')]),_0xf1ef('0x70'),{'recordId':_0x47c9b8['id']});break;case _0xf1ef('0x71'):emit(util['format'](_0xf1ef('0x72'),_0x88bcb2[_0xf1ef('0x56')]),_0xf1ef('0x73'),{'uri':util[_0xf1ef('0x49')]('%s/%s/e',_0x1def57[_0xf1ef('0x74')],_0x47c9b8['id'])});break;default:logger[_0xf1ef('0x75')](_0xf1ef('0x76'));}})[_0xf1ef('0x77')](function(_0x21c9ea){logger[_0xf1ef('0x75')](_0xf1ef('0x65'),_0x21c9ea);});};exports[_0xf1ef('0x78')]=function(_0x355e81,_0x17244b,_0x16c611,_0xd59185,_0x575084,_0xcfe9ed,_0x27eba4){var _0x4717a1,_0x48c4cb,_0x38c2a3,_0x5e4e86;_0xcfe9ed[_0xf1ef('0x63')]=intUtil[_0xf1ef('0x62')](_0xcfe9ed['serverUrl']);_0xcfe9ed['remoteUri']=intUtil[_0xf1ef('0x62')](_0xcfe9ed[_0xf1ef('0x5b')]);if(_0x27eba4&&_0x27eba4[_0xf1ef('0x79')]&&_0x27eba4[_0xf1ef('0x79')]!=='none'){logger[_0xf1ef('0x20')](_0xf1ef('0x7a'),_0xf1ef('0x66'));_0x17244b[_0xf1ef('0x69')]=util['format'](_0xf1ef('0x67'),_0xcfe9ed['serverUrl'],_0x17244b[_0xf1ef('0x68')],md5(_0x17244b['uniqueid']));}return getConnection(_0xcfe9ed)[_0xf1ef('0x28')](function(_0x278fa9){_0x5e4e86=_0x278fa9;return getUser(_0xcfe9ed,_0xd59185['email'],_0x5e4e86);})[_0xf1ef('0x28')](function(_0x56b0e8){_0x4717a1=_0x56b0e8;return getEndUser(_0xcfe9ed,_0x16c611,_0x17244b[_0xf1ef('0x7b')],_0x17244b['destcalleridnum'],_0x5e4e86);})[_0xf1ef('0x28')](function(_0x385ed9){_0x48c4cb=_0x385ed9;return getTicket(_0xcfe9ed,_0x4717a1,_0x48c4cb,_0x16c611,_0x17244b,_0x16c611[_0xf1ef('0x6d')],_0x5e4e86,_0xf1ef('0x78'));})[_0xf1ef('0x28')](function(_0x2544d2){_0x38c2a3=_0x2544d2;logger[_0xf1ef('0x20')](_0xf1ef('0x7c'),_0x38c2a3['id']);logger['info'](_0xf1ef('0x7d'),_0x38c2a3['id'],_0xd59185[_0xf1ef('0x56')],_0xcfe9ed[_0xf1ef('0x4f')]);switch(_0xcfe9ed['type']){case _0xf1ef('0x7e'):emit(util[_0xf1ef('0x49')]('user:%s',_0xd59185[_0xf1ef('0x56')]),_0xf1ef('0x70'),{'recordId':_0x38c2a3['id']});break;case _0xf1ef('0x71'):emit(util['format'](_0xf1ef('0x72'),_0xd59185[_0xf1ef('0x56')]),_0xf1ef('0x73'),{'uri':util[_0xf1ef('0x49')]('%s/%s/e',_0x5e4e86[_0xf1ef('0x74')],_0x38c2a3['id'])});break;default:logger[_0xf1ef('0x75')](_0xf1ef('0x7a'),_0xf1ef('0x7f'));}})[_0xf1ef('0x77')](function(_0x8a9b75){logger[_0xf1ef('0x75')](_0xf1ef('0x7a'),_0x8a9b75);});};exports['unmanaged']=function(_0x26d4f3,_0x261263,_0x4d4bf5,_0x4e4792,_0x30754d,_0x4c7acd){var _0x539e93,_0x5e6121,_0x2aea26,_0x446de3;_0x4c7acd[_0xf1ef('0x63')]=intUtil[_0xf1ef('0x62')](_0x4c7acd[_0xf1ef('0x63')]);_0x4c7acd['remoteUri']=intUtil[_0xf1ef('0x62')](_0x4c7acd[_0xf1ef('0x5b')]);if(_0x30754d&&_0x30754d[_0xf1ef('0x64')]){logger[_0xf1ef('0x20')]('['+_0x261263[_0xf1ef('0x80')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x261263[_0xf1ef('0x69')]=util[_0xf1ef('0x49')](_0xf1ef('0x67'),_0x4c7acd[_0xf1ef('0x63')],_0x261263[_0xf1ef('0x68')],md5(_0x261263['uniqueid']));}else{_0x261263[_0xf1ef('0x69')]='';}return getConnection(_0x4c7acd)['then'](function(_0xe0aecc){_0x446de3=_0xe0aecc;if(!_[_0xf1ef('0x22')](_0x4e4792)){return getUser(_0x4c7acd,_0x4e4792['name'],_0x446de3);}else{return getUser(_0x4c7acd,null,_0x446de3);}})[_0xf1ef('0x28')](function(_0x4b1f5c){_0x539e93=_0x4b1f5c;return getEndUser(_0x4c7acd,_0x4d4bf5,_0x261263['calleridname'],_0x261263[_0xf1ef('0x6c')],_0x446de3);})[_0xf1ef('0x28')](function(_0x2e0e42){_0x5e6121=_0x2e0e42;return getTicket(_0x4c7acd,_0x539e93,_0x5e6121,_0x4d4bf5,_0x261263,_0x4d4bf5[_0xf1ef('0x6d')],_0x446de3);})[_0xf1ef('0x28')](function(_0x25e4f3){_0x2aea26=_0x25e4f3;logger[_0xf1ef('0x20')]('['+_0x261263['lastevent'][_0xf1ef('0x81')]()+']\x20Ticket\x20%s\x20created.',_0x2aea26['id']);logger[_0xf1ef('0x20')]('['+_0x261263[_0xf1ef('0x80')][_0xf1ef('0x81')]()+_0xf1ef('0x82'),_0x4c7acd[_0xf1ef('0x4f')]);})[_0xf1ef('0x77')](function(_0x1b2a88){logger[_0xf1ef('0x75')]('['+_0x261263[_0xf1ef('0x80')][_0xf1ef('0x81')]()+']',_0x1b2a88);});}; \ No newline at end of file +var _0x5a5d=['[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','unmanaged','monitor_format','lastevent',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','contact','endUserType','lead','WhoId','account','WhatId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','then','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','Lead','additionalSearchAccount','Account','length','first','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','includes','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','queue','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum'];(function(_0x50e334,_0x4052c9){var _0x58ac30=function(_0x2eda11){while(--_0x2eda11){_0x50e334['push'](_0x50e334['shift']());}};_0x58ac30(++_0x4052c9);}(_0x5a5d,0x118));var _0xd5a5=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5a5d[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd5a5('0x0'));var rp=require('request-promise');var moment=require(_0xd5a5('0x1'));var BPromise=require(_0xd5a5('0x2'));var md5=require(_0xd5a5('0x3'));var jsforce=require(_0xd5a5('0x4'));var util=require(_0xd5a5('0x5'));var Redis=require(_0xd5a5('0x6'));var intUtil=require('./util');var config=require(_0xd5a5('0x7'));var logger=require('../../../../config/logger')(_0xd5a5('0x8'));config[_0xd5a5('0x9')]=_[_0xd5a5('0xa')](config[_0xd5a5('0x9')],{'host':_0xd5a5('0xb'),'port':0x18eb});var io=require(_0xd5a5('0xc'))(new Redis(config[_0xd5a5('0x9')]));function emit(_0x41f53d,_0x49e47c,_0x4466df){io['to'](_0x41f53d)[_0xd5a5('0xd')](_0x49e47c,_0x4466df);}function getTicket(_0x2dd066,_0x387bc2,_0x1a057e,_0x3df968,_0x13b72f,_0x408e96,_0x299c85,_0x2f7337){var _0x1b5faa=Object[_0xd5a5('0xe')]({},{'OwnerId':_0x387bc2['id'],'Subject':intUtil[_0xd5a5('0xf')](_0x3df968['Subjects'],_0x13b72f,'\x20'),'Description':intUtil['getString'](_0x3df968[_0xd5a5('0x10')],_0x13b72f,'\x0a')},getCustomFields(_0x408e96,_0x13b72f));if(_0x1a057e){if(_0x3df968[_0xd5a5('0x11')]===_0xd5a5('0x12')){_0x1b5faa[_0xd5a5('0x13')]=moment[_0xd5a5('0x14')]();_0x1b5faa[_0xd5a5('0x15')]=![];_0x1b5faa['IsRecurrence']=![];if(_0x1a057e['endUserType']===_0xd5a5('0x16')||_0x1a057e[_0xd5a5('0x17')]===_0xd5a5('0x18')){_0x1b5faa[_0xd5a5('0x19')]=_0x1a057e['id'];}else if(_0x1a057e[_0xd5a5('0x17')]===_0xd5a5('0x1a')){_0x1b5faa[_0xd5a5('0x1b')]=_0x1a057e['id'];}}else if(_0x3df968['ticketType']==='Case'){if(_0x1a057e[_0xd5a5('0x17')]===_0xd5a5('0x16')){_0x1b5faa['ContactId']=_0x1a057e['id'];}else if(_0x1a057e[_0xd5a5('0x17')]===_0xd5a5('0x1a')){_0x1b5faa[_0xd5a5('0x1c')]=_0x1a057e['id'];}else if(_0x1a057e[_0xd5a5('0x17')]===_0xd5a5('0x18')&&_0x3df968[_0xd5a5('0x1d')]){_0x1b5faa[_0x3df968[_0xd5a5('0x1d')]]=_0x1a057e['id'];}else{logger['info'](_0xd5a5('0x1e'));}}}return _0x299c85[_0xd5a5('0x1f')](_0x3df968[_0xd5a5('0x11')])[_0xd5a5('0x20')](_0x1b5faa);}function getUser(_0x2f5c76,_0x35cbb0,_0x1e1285){if(!_[_0xd5a5('0x21')](_0x35cbb0)&&intUtil[_0xd5a5('0x22')](_0x35cbb0)){var _0x572e37={'Email':_0x35cbb0};var _0x538318={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1e1285[_0xd5a5('0x1f')](_0xd5a5('0x23'))[_0xd5a5('0x24')](_0x572e37,_0x538318)['execute']()[_0xd5a5('0x25')](function(_0xbdfbca){if(_0xbdfbca['length']){var _0x365cd7=_['find'](_0xbdfbca,function(_0x5a365d){return _0x5a365d[_0xd5a5('0x26')]===_0x35cbb0;});if(_0x365cd7){logger[_0xd5a5('0x27')](_0xd5a5('0x28'),_0x35cbb0);return BPromise[_0xd5a5('0x29')]({'id':_0x365cd7['Id'],'name':_0x365cd7[_0xd5a5('0x2a')]});}}else{logger[_0xd5a5('0x27')](_0xd5a5('0x2b'),_0x35cbb0);return _0x1e1285[_0xd5a5('0x2c')]()[_0xd5a5('0x25')](function(_0x12ec57){return BPromise[_0xd5a5('0x29')]({'id':_0x12ec57['user_id'],'name':_0x12ec57[_0xd5a5('0x2d')]});});}});}else{logger['info'](_0xd5a5('0x2b'),_0x35cbb0);return _0x1e1285[_0xd5a5('0x2c')]()[_0xd5a5('0x25')](function(_0x4f6f78){return BPromise[_0xd5a5('0x29')]({'id':_0x4f6f78['user_id'],'name':_0x4f6f78[_0xd5a5('0x2d')]});});}}function getEndUser(_0x423b4c,_0x341728,_0x4edd66,_0x39aef5,_0x2170cb){var _0x1e4806={'$or':{'Phone':_0x39aef5}};var _0x548d43={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd5a5('0x29')]()[_0xd5a5('0x25')](function(){logger[_0xd5a5('0x27')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x39aef5,_0x341728[_0xd5a5('0x2e')]);switch(_0x341728[_0xd5a5('0x2e')]){case'contact_lead':var _0x47ce24=_[_0xd5a5('0x2f')](_0x1e4806);if(_0x341728[_0xd5a5('0x30')]){var _0x1937b0={};_0x1937b0[_0x341728[_0xd5a5('0x30')]]=_0x39aef5;_[_0xd5a5('0x31')](_0x47ce24[_0xd5a5('0x32')],_0x1937b0);}return _0x2170cb[_0xd5a5('0x1f')](_0xd5a5('0x33'))[_0xd5a5('0x24')](_0x47ce24,_0x548d43)[_0xd5a5('0x34')]()[_0xd5a5('0x25')](function(_0x1df325){if(_0x1df325&&_0x1df325['length']){return _0x1df325;}else{var _0x5b174c=_[_0xd5a5('0x2f')](_0x1e4806);if(_0x341728[_0xd5a5('0x35')]){var _0x43b72d={};_0x43b72d[_0x341728['additionalSearchLead']]=_0x39aef5;_[_0xd5a5('0x31')](_0x5b174c['$or'],_0x43b72d);}return _0x2170cb[_0xd5a5('0x1f')](_0xd5a5('0x36'))[_0xd5a5('0x24')](_0x5b174c,_0x548d43);}});case'account_contact_lead':var _0x4239e3=_[_0xd5a5('0x2f')](_0x1e4806);if(_0x341728[_0xd5a5('0x37')]){var _0x1937b0={};_0x1937b0[_0x341728['additionalSearchAccount']]=_0x39aef5;_[_0xd5a5('0x31')](_0x4239e3[_0xd5a5('0x32')],_0x1937b0);}return _0x2170cb[_0xd5a5('0x1f')](_0xd5a5('0x38'))[_0xd5a5('0x24')](_0x4239e3,_0x548d43)[_0xd5a5('0x34')]()['then'](function(_0x2e20ae){if(_0x2e20ae&&_0x2e20ae[_0xd5a5('0x39')]){return _0x2e20ae;}else{var _0x1ad08d=_[_0xd5a5('0x2f')](_0x1e4806);if(_0x341728[_0xd5a5('0x30')]){var _0x1d7896={};_0x1d7896[_0x341728['additionalSearchContact']]=_0x39aef5;_[_0xd5a5('0x31')](_0x1ad08d[_0xd5a5('0x32')],_0x1d7896);}return _0x2170cb[_0xd5a5('0x1f')]('Contact')[_0xd5a5('0x24')](_0x1ad08d,_0x548d43)[_0xd5a5('0x25')](function(_0x261092){if(_0x261092&&_0x261092[_0xd5a5('0x39')]){return _0x261092;}else{var _0x59c760=_[_0xd5a5('0x2f')](_0x1e4806);if(_0x341728[_0xd5a5('0x35')]){var _0xb77dd1={};_0xb77dd1[_0x341728[_0xd5a5('0x35')]]=_0x39aef5;_[_0xd5a5('0x31')](_0x59c760['$or'],_0xb77dd1);}return _0x2170cb[_0xd5a5('0x1f')]('Lead')[_0xd5a5('0x24')](_0x59c760,_0x548d43);}});}});case _0xd5a5('0x16'):var _0x47ce24=_[_0xd5a5('0x2f')](_0x1e4806);if(_0x341728[_0xd5a5('0x30')]){var _0x1937b0={};_0x1937b0[_0x341728['additionalSearchContact']]=_0x39aef5;_[_0xd5a5('0x31')](_0x47ce24['$or'],_0x1937b0);}return _0x2170cb[_0xd5a5('0x1f')](_0xd5a5('0x33'))['find'](_0x47ce24,_0x548d43)[_0xd5a5('0x34')]();case'lead':var _0x5cabbf=_['cloneDeep'](_0x1e4806);if(_0x341728['additionalSearchLead']){var _0x1937b0={};_0x1937b0[_0x341728['additionalSearchLead']]=_0x39aef5;_[_0xd5a5('0x31')](_0x5cabbf[_0xd5a5('0x32')],_0x1937b0);}return _0x2170cb[_0xd5a5('0x1f')](_0xd5a5('0x36'))[_0xd5a5('0x24')](_0x5cabbf,_0x548d43);case _0xd5a5('0x1a'):var _0x4239e3=_[_0xd5a5('0x2f')](_0x1e4806);if(_0x341728[_0xd5a5('0x37')]){var _0x1937b0={};_0x1937b0[_0x341728[_0xd5a5('0x37')]]=_0x39aef5;_[_0xd5a5('0x31')](_0x4239e3[_0xd5a5('0x32')],_0x1937b0);}return _0x2170cb['sobject']('Account')[_0xd5a5('0x24')](_0x4239e3,_0x548d43);default:return null;}})[_0xd5a5('0x25')](function(_0x145cd8){if(_0x145cd8&&_0x145cd8[_0xd5a5('0x39')]){var _0x4da31e=_[_0xd5a5('0x3a')](_0x145cd8);if(_0x4da31e){return BPromise['resolve']({'id':_0x4da31e['Id'],'name':_0x4da31e[_0xd5a5('0x2a')],'phone':_0x4da31e['Phone'],'endUserType':_0x4da31e['attributes']['type'][_0xd5a5('0x3b')]()});}}})[_0xd5a5('0x25')](function(_0x73347b){if(_0x73347b){logger[_0xd5a5('0x27')](_0xd5a5('0x3c'),_0x73347b[_0xd5a5('0x17')],_0x39aef5);return BPromise[_0xd5a5('0x29')](_0x73347b);}else{logger[_0xd5a5('0x27')](_0xd5a5('0x3d'),_0x39aef5);var _0x30fef5={'Phone':_0x39aef5};if(_0x341728[_0xd5a5('0x3e')]){if(_0x341728[_0xd5a5('0x3e')]===_0xd5a5('0x16')){logger['info'](_0xd5a5('0x3f'),_0x39aef5,_0x341728[_0xd5a5('0x3e')]);_0x30fef5[_0xd5a5('0x40')]=_0x4edd66!==_0xd5a5('0x41')?_0x4edd66:util[_0xd5a5('0x42')](_0xd5a5('0x43'),_0x39aef5);}else if(_0x341728['moduleCreate']===_0xd5a5('0x18')){logger[_0xd5a5('0x27')](_0xd5a5('0x3f'),_0x39aef5,_0x341728[_0xd5a5('0x3e')]);_0x30fef5[_0xd5a5('0x40')]=_0x4edd66!==''?_0x4edd66:util['format'](_0xd5a5('0x43'),_0x39aef5);_0x30fef5[_0xd5a5('0x44')]=_0xd5a5('0x45');}else if(_0x341728[_0xd5a5('0x3e')]===_0xd5a5('0x1a')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x39aef5,_0x341728[_0xd5a5('0x3e')]);_0x30fef5[_0xd5a5('0x2a')]=_0x4edd66!==_0xd5a5('0x41')?_0x4edd66:util['format']('Caller\x20-\x20%s',_0x39aef5);}else{return null;}}return _0x2170cb[_0xd5a5('0x1f')](_[_0xd5a5('0x46')](_0x341728[_0xd5a5('0x3e')]))[_0xd5a5('0x20')](_0x30fef5)[_0xd5a5('0x25')](function(_0x2dbdca){return BPromise[_0xd5a5('0x29')]({'id':_0x2dbdca['id'],'endUserType':_0x341728[_0xd5a5('0x3e')]});});}});}function getCustomFields(_0x5745ea,_0x6ca226){var _0x4a6d51={};if(_0x5745ea[_0xd5a5('0x39')]>0x0){_['forEach'](_0x5745ea,function(_0x5c9146){if(_[_0xd5a5('0x47')](['string',_0xd5a5('0x48')],_0x5c9146[_0xd5a5('0x49')])&&_0x5c9146[_0xd5a5('0x4a')]){_0x4a6d51[_0x5c9146[_0xd5a5('0x4a')]]=_0x5c9146[_0xd5a5('0x4b')][_0xd5a5('0x4c')]();}else if(_0x5c9146[_0xd5a5('0x49')]==='variable'&&_0x5c9146[_0xd5a5('0x4d')]&&_0x5c9146['idField']){_0x6ca226[_0x5c9146[_0xd5a5('0x4d')]]&&(_0x4a6d51[_0x5c9146[_0xd5a5('0x4a')]]=_0x6ca226[_0x5c9146[_0xd5a5('0x4d')]]['toString']());}else if(_0x5c9146[_0xd5a5('0x49')]===_0xd5a5('0x4e')&&_0x5c9146[_0xd5a5('0x4f')]&&_0x5c9146[_0xd5a5('0x4f')][_0xd5a5('0x50')]&&_0x5c9146[_0xd5a5('0x4a')]){_0x6ca226[_0x5c9146[_0xd5a5('0x4f')][_0xd5a5('0x50')][_0xd5a5('0x3b')]()]&&(_0x4a6d51[_0x5c9146[_0xd5a5('0x4a')]]=_0x6ca226[_0x5c9146[_0xd5a5('0x4f')]['name'][_0xd5a5('0x3b')]()][_0xd5a5('0x4c')]());}});}return _0x4a6d51;}function getConnection(_0x4cf99a){var _0x2a9bd3=_0x4cf99a['password'][_0xd5a5('0x51')](_0x4cf99a[_0xd5a5('0x52')]);var _0x27c361=new jsforce[(_0xd5a5('0x53'))]({'oauth2':{'loginUrl':_0x4cf99a[_0xd5a5('0x54')]||_0xd5a5('0x55'),'clientId':_0x4cf99a[_0xd5a5('0x56')],'clientSecret':_0x4cf99a[_0xd5a5('0x57')]}});return _0x27c361['login'](_0x4cf99a[_0xd5a5('0x58')],_0x2a9bd3)[_0xd5a5('0x25')](function(){logger[_0xd5a5('0x27')]('Connection\x20established.');return _0x27c361;});}exports[_0xd5a5('0x59')]=function(_0x488bc9,_0x282d8f,_0x320e70,_0xaf4e69,_0x27d1f5,_0xa22db0){var _0x4cd21d,_0x155f8a,_0x5c9330,_0xdd9345;_0xa22db0[_0xd5a5('0x5a')]=intUtil['stripTrailingSlash'](_0xa22db0[_0xd5a5('0x5a')]);_0xa22db0[_0xd5a5('0x54')]=intUtil['stripTrailingSlash'](_0xa22db0[_0xd5a5('0x54')]);if(_0x27d1f5&&_0x27d1f5['monitor_format']){logger[_0xd5a5('0x27')](_0xd5a5('0x5b'),_0xd5a5('0x5c'));_0x282d8f[_0xd5a5('0x5d')]=util[_0xd5a5('0x42')](_0xd5a5('0x5e'),_0xa22db0[_0xd5a5('0x5a')],_0x282d8f[_0xd5a5('0x5f')],md5(_0x282d8f[_0xd5a5('0x5f')]));}else{_0x282d8f['recordingURL']='';}return getConnection(_0xa22db0)[_0xd5a5('0x25')](function(_0x431b54){_0xdd9345=_0x431b54;return getUser(_0xa22db0,_0xaf4e69[_0xd5a5('0x60')],_0xdd9345);})[_0xd5a5('0x25')](function(_0x2f2de9){_0x4cd21d=_0x2f2de9;return getEndUser(_0xa22db0,_0x320e70,_0x282d8f['calleridname'],_0x282d8f[_0xd5a5('0x61')],_0xdd9345);})[_0xd5a5('0x25')](function(_0x498445){_0x155f8a=_0x498445;return getTicket(_0xa22db0,_0x4cd21d,_0x155f8a,_0x320e70,_0x282d8f,_0x320e70['Fields'],_0xdd9345,_0xd5a5('0x59'));})[_0xd5a5('0x25')](function(_0x57868e){_0x5c9330=_0x57868e;logger[_0xd5a5('0x27')](_0xd5a5('0x62'),_0x5c9330['id']);logger['info'](_0xd5a5('0x63'),_0x5c9330['id'],_0xaf4e69[_0xd5a5('0x50')],_0xa22db0[_0xd5a5('0x49')]);switch(_0xa22db0['type']){case _0xd5a5('0x64'):emit(util['format']('user:%s',_0xaf4e69[_0xd5a5('0x50')]),_0xd5a5('0x65'),{'recordId':_0x5c9330['id']});break;case'newTab':emit(util[_0xd5a5('0x42')](_0xd5a5('0x66'),_0xaf4e69['name']),_0xd5a5('0x67'),{'uri':util[_0xd5a5('0x42')](_0xd5a5('0x68'),_0xdd9345[_0xd5a5('0x69')],_0x5c9330['id'])});break;default:logger[_0xd5a5('0x6a')](_0xd5a5('0x6b'));}})[_0xd5a5('0x6c')](function(_0x4c5836){logger[_0xd5a5('0x6a')](_0xd5a5('0x5b'),_0x4c5836);});};exports[_0xd5a5('0x6d')]=function(_0x1310fb,_0x806144,_0x4c808a,_0x2a032b,_0x3fa763,_0x58e889,_0x2a44b3){var _0x3d84a5,_0x212b21,_0x295a36,_0x293f99;_0x58e889[_0xd5a5('0x5a')]=intUtil['stripTrailingSlash'](_0x58e889[_0xd5a5('0x5a')]);_0x58e889[_0xd5a5('0x54')]=intUtil[_0xd5a5('0x6e')](_0x58e889['remoteUri']);if(_0x2a44b3&&_0x2a44b3['recordingFormat']&&_0x2a44b3[_0xd5a5('0x6f')]!==_0xd5a5('0x70')){logger[_0xd5a5('0x27')](_0xd5a5('0x71'),_0xd5a5('0x5c'));_0x806144[_0xd5a5('0x5d')]=util[_0xd5a5('0x42')](_0xd5a5('0x5e'),_0x58e889['serverUrl'],_0x806144[_0xd5a5('0x5f')],md5(_0x806144[_0xd5a5('0x5f')]));}return getConnection(_0x58e889)[_0xd5a5('0x25')](function(_0x5e65d8){_0x293f99=_0x5e65d8;return getUser(_0x58e889,_0x2a032b['email'],_0x293f99);})[_0xd5a5('0x25')](function(_0x2a24e1){_0x3d84a5=_0x2a24e1;return getEndUser(_0x58e889,_0x4c808a,_0x806144[_0xd5a5('0x72')],_0x806144[_0xd5a5('0x73')],_0x293f99);})['then'](function(_0x4c1a50){_0x212b21=_0x4c1a50;return getTicket(_0x58e889,_0x3d84a5,_0x212b21,_0x4c808a,_0x806144,_0x4c808a[_0xd5a5('0x74')],_0x293f99,_0xd5a5('0x6d'));})['then'](function(_0x1192ae){_0x295a36=_0x1192ae;logger['info'](_0xd5a5('0x75'),_0x295a36['id']);logger['info'](_0xd5a5('0x76'),_0x295a36['id'],_0x2a032b['name'],_0x58e889[_0xd5a5('0x49')]);switch(_0x58e889['type']){case'integrationTab':emit(util[_0xd5a5('0x42')]('user:%s',_0x2a032b['name']),_0xd5a5('0x65'),{'recordId':_0x295a36['id']});break;case _0xd5a5('0x77'):emit(util['format'](_0xd5a5('0x66'),_0x2a032b['name']),_0xd5a5('0x67'),{'uri':util[_0xd5a5('0x42')](_0xd5a5('0x68'),_0x293f99[_0xd5a5('0x69')],_0x295a36['id'])});break;default:logger[_0xd5a5('0x6a')](_0xd5a5('0x71'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xd5a5('0x6c')](function(_0x552bf9){logger['error']('[OUTBOUND]',_0x552bf9);});};exports[_0xd5a5('0x78')]=function(_0x44c2b3,_0x595deb,_0x43a7a4,_0x4cc66c,_0x1ad763,_0x3bfc70){var _0x463eb2,_0x2cce84,_0x274967,_0x2aba5d;_0x3bfc70['serverUrl']=intUtil[_0xd5a5('0x6e')](_0x3bfc70[_0xd5a5('0x5a')]);_0x3bfc70['remoteUri']=intUtil[_0xd5a5('0x6e')](_0x3bfc70[_0xd5a5('0x54')]);if(_0x1ad763&&_0x1ad763[_0xd5a5('0x79')]){logger[_0xd5a5('0x27')]('['+_0x595deb[_0xd5a5('0x7a')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x595deb[_0xd5a5('0x5d')]=util[_0xd5a5('0x42')](_0xd5a5('0x5e'),_0x3bfc70[_0xd5a5('0x5a')],_0x595deb[_0xd5a5('0x5f')],md5(_0x595deb[_0xd5a5('0x5f')]));}else{_0x595deb['recordingURL']='';}return getConnection(_0x3bfc70)[_0xd5a5('0x25')](function(_0x567961){_0x2aba5d=_0x567961;if(!_['isNil'](_0x4cc66c)){return getUser(_0x3bfc70,_0x4cc66c['name'],_0x2aba5d);}else{return getUser(_0x3bfc70,null,_0x2aba5d);}})['then'](function(_0x4b44a3){_0x463eb2=_0x4b44a3;return getEndUser(_0x3bfc70,_0x43a7a4,_0x595deb['calleridname'],_0x595deb[_0xd5a5('0x61')],_0x2aba5d);})[_0xd5a5('0x25')](function(_0xbe7018){_0x2cce84=_0xbe7018;return getTicket(_0x3bfc70,_0x463eb2,_0x2cce84,_0x43a7a4,_0x595deb,_0x43a7a4[_0xd5a5('0x74')],_0x2aba5d);})[_0xd5a5('0x25')](function(_0x4ea4fe){_0x274967=_0x4ea4fe;logger[_0xd5a5('0x27')]('['+_0x595deb[_0xd5a5('0x7a')]['toUpperCase']()+_0xd5a5('0x7b'),_0x274967['id']);logger[_0xd5a5('0x27')]('['+_0x595deb[_0xd5a5('0x7a')][_0xd5a5('0x7c')]()+_0xd5a5('0x7d'),_0x3bfc70[_0xd5a5('0x49')]);})[_0xd5a5('0x6c')](function(_0xa7e80f){logger[_0xd5a5('0x6a')]('['+_0x595deb[_0xd5a5('0x7a')][_0xd5a5('0x7c')]()+']',_0xa7e80f);});}; \ 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 3ed0d63..0597dbf 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 _0xe93b=['Incident','Incident\x20-\x20','ticketNumber','push','all','Tags','name','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','format','isNil','email','destcalleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','catch','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','adminEmail','error','message',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','customField','nameField','toLowerCase','content','toString','string','idField','variable','variableName','Variable','outbound','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry'];(function(_0x48d2ed,_0x432efb){var _0x467ecd=function(_0x3cf1b4){while(--_0x3cf1b4){_0x48d2ed['push'](_0x48d2ed['shift']());}};_0x467ecd(++_0x432efb);}(_0xe93b,0x16a));var _0xbe93=function(_0xc5db8d,_0x5aa943){_0xc5db8d=_0xc5db8d-0x0;var _0x59da2d=_0xe93b[_0xc5db8d];return _0x59da2d;};'use strict';var _=require(_0xbe93('0x0'));var Promise=require(_0xbe93('0x1'));var rp=require(_0xbe93('0x2'));var util=require(_0xbe93('0x3'));var md5=require(_0xbe93('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xbe93('0x5'));var logger=require(_0xbe93('0x6'))(_0xbe93('0x7'));config[_0xbe93('0x8')]=_['defaults'](config['redis'],{'host':_0xbe93('0x9'),'port':0x18eb});var io=require(_0xbe93('0xa'))(new Redis(config[_0xbe93('0x8')]));function getAdminUser(_0x3ab63c,_0x396b8c,_0x1edee5,_0xeacefb,_0x1d5ece,_0x35ac7f){return new Promise(function(_0x51e120,_0x50c3d1){var _0x2c0d74={'method':_0xbe93('0xb'),'uri':_0xeacefb+_0xbe93('0xc')+'&'+_0x1d5ece+'&'+_0x35ac7f,'auth':_0x396b8c,'json':!![]};return rp(_0x2c0d74)[_0xbe93('0xd')](function(_0x4d6b73){if(_0x4d6b73[_0xbe93('0xe')][_0xbe93('0xf')]>0x0){_0x1edee5[_0xbe93('0x10')]=_0x4d6b73[_0xbe93('0xe')][0x0][_0xbe93('0x11')];}logger[_0xbe93('0x12')]('['+[_0x3ab63c['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x1edee5);_0x51e120(_0x1edee5);})[_0xbe93('0x13')](function(_0x4f5806){logger['error']('['+[_0x3ab63c[_0xbe93('0x14')]()]+']',_0x4f5806['message']);_0x50c3d1(_0x4f5806['message']);});});}function getUser(_0x32ada7,_0x32c4b2,_0x266f65,_0x661791,_0x109a56){return function(_0x37706a){logger[_0xbe93('0x12')]('['+[_0x32ada7['toUpperCase']()]+_0xbe93('0x15'),_0x37706a);return new Promise(function(_0x16994b,_0x152a62){if(intUtil[_0xbe93('0x16')](_0x37706a[_0xbe93('0x17')])){var _0xd79b70={'method':_0xbe93('0xb'),'uri':_0x266f65+_0xbe93('0x18')+_0x37706a[_0xbe93('0x17')]+'&'+_0x661791+'&'+_0x109a56,'auth':_0x32c4b2,'json':!![]};logger[_0xbe93('0x12')]('['+[_0x32ada7[_0xbe93('0x14')]()]+_0xbe93('0x19'),_0xd79b70);return rp(_0xd79b70)['then'](function(_0x3e9059){logger[_0xbe93('0x12')]('['+[_0x32ada7[_0xbe93('0x14')]()]+_0xbe93('0x1a'),_0x3e9059);if(_0x3e9059[_0xbe93('0xe')]['length']>0x0&&String(_0x3e9059[_0xbe93('0xe')][0x0]['active'])===_0xbe93('0x1b')){_0x37706a[_0xbe93('0x1c')]=_0x3e9059[_0xbe93('0xe')][0x0][_0xbe93('0x11')];}else{_0x37706a[_0xbe93('0x1c')]=_0x37706a[_0xbe93('0x10')];_0x37706a['userEmail']=_0x37706a[_0xbe93('0x1d')];}logger['info']('['+[_0x32ada7[_0xbe93('0x14')]()]+'],\x20getUser\x20crm',_0x37706a);_0x16994b(_0x37706a);})[_0xbe93('0x13')](function(_0x488b35){logger[_0xbe93('0x1e')]('['+[_0x32ada7[_0xbe93('0x14')]()]+']',_0x488b35[_0xbe93('0x1f')]);_0x152a62(_0x488b35['message']);});}else{logger[_0xbe93('0x12')]('['+[_0x32ada7[_0xbe93('0x14')]()]+_0xbe93('0x20'));_0x37706a[_0xbe93('0x1c')]=_0x37706a[_0xbe93('0x10')];_0x37706a[_0xbe93('0x17')]=_0x37706a[_0xbe93('0x1d')];_0x16994b(_0x37706a);}});};}function createEndUser(_0x5e3761,_0xf149ed,_0x4b88b5,_0x42d504,_0x279273){logger['info']('['+[_0x5e3761[_0xbe93('0x14')]()]+_0xbe93('0x21'),_0x4b88b5);return new Promise(function(_0x2c7ff0,_0x553d82){var _0x217659={'method':_0xbe93('0x22'),'uri':_0x42d504+_0xbe93('0x23')+_0x279273,'body':{'user_name':_0x4b88b5[_0xbe93('0x24')],'roles':_0xbe93('0x25'),'first_name':_0x4b88b5['endUserNumber'],'active':_0xbe93('0x1b'),'date_format':_0xbe93('0x26'),'phone':_0x4b88b5[_0xbe93('0x24')]},'auth':_0xf149ed,'json':!![]};return rp(_0x217659)[_0xbe93('0xd')](function(_0x154d11){logger[_0xbe93('0x12')]('['+[_0x5e3761[_0xbe93('0x14')]()]+_0xbe93('0x27'),_0x154d11[_0xbe93('0xe')]);_0x4b88b5[_0xbe93('0x28')]=_0x154d11[_0xbe93('0xe')][_0xbe93('0x11')];_0x2c7ff0(_0x4b88b5);})[_0xbe93('0x13')](function(_0x40d74e){logger[_0xbe93('0x1e')]('['+[_0x5e3761[_0xbe93('0x14')]()]+']',_0x40d74e[_0xbe93('0x1f')]);_0x553d82(_0x40d74e[_0xbe93('0x1f')]);});});}function getEndUser(_0xaf873d,_0x7e1747,_0x5430b0,_0x125c9a,_0x2f8c61){return function(_0x53df81){logger[_0xbe93('0x12')]('['+[_0xaf873d[_0xbe93('0x14')]()]+_0xbe93('0x29'),_0x53df81);return new Promise(function(_0x24757a,_0x276705){var _0x5b9796={'method':_0xbe93('0xb'),'uri':_0x5430b0+_0xbe93('0x2a')+_0x53df81[_0xbe93('0x24')]+'&'+_0x125c9a+'&'+_0x2f8c61,'auth':_0x7e1747,'json':!![]};return rp(_0x5b9796)[_0xbe93('0xd')](function(_0x132b27){if(_0x132b27[_0xbe93('0xe')][_0xbe93('0xf')]>0x0){_0x53df81['endUserId']=_0x132b27[_0xbe93('0xe')][0x0][_0xbe93('0x11')];logger[_0xbe93('0x12')]('['+[_0xaf873d[_0xbe93('0x14')]()]+_0xbe93('0x2b'),_0x53df81);_0x24757a(_0x53df81);}else{return createEndUser(_0xaf873d,_0x7e1747,_0x53df81,_0x5430b0,_0x125c9a)['then'](function(_0x4afa42){logger[_0xbe93('0x12')]('['+[_0xaf873d[_0xbe93('0x14')]()]+_0xbe93('0x2c'),_0x4afa42);_0x24757a(_0x4afa42);});}})[_0xbe93('0x13')](function(_0x389b3d){logger[_0xbe93('0x1e')]('['+[_0xaf873d[_0xbe93('0x14')]()]+']',_0x389b3d['message']);_0x276705(_0x389b3d[_0xbe93('0x1f')]);});});};}function getCustomFields(_0x4e4792,_0x14f5a1){var _0x4535d7={};if(_0x4e4792[_0xbe93('0xf')]>0x0){_[_0xbe93('0x2d')](_0x4e4792,function(_0x313ff8){if(_[_0xbe93('0x2e')](['string',_0xbe93('0x2f')],_0x313ff8[_0xbe93('0x30')])&&_0x313ff8['nameField']&&!_0x313ff8[_0xbe93('0x31')]){_0x4535d7[_0x313ff8[_0xbe93('0x32')][_0xbe93('0x33')]()]=_0x313ff8[_0xbe93('0x34')][_0xbe93('0x35')]();}else if(_[_0xbe93('0x2e')]([_0xbe93('0x36'),_0xbe93('0x2f')],_0x313ff8['type'])&&_0x313ff8[_0xbe93('0x37')]&&_0x313ff8[_0xbe93('0x31')]){_0x4535d7[_0x313ff8['idField'][_0xbe93('0x33')]()]=_0x313ff8['content'][_0xbe93('0x35')]();}else if(_0x313ff8[_0xbe93('0x30')]===_0xbe93('0x38')&&_0x313ff8[_0xbe93('0x39')]&&_0x313ff8[_0xbe93('0x37')]&&_0x313ff8['customField']){_0x4535d7[_0x313ff8['idField'][_0xbe93('0x33')]()]=_0x14f5a1[_0x313ff8[_0xbe93('0x39')]][_0xbe93('0x35')]();}else if(_0x313ff8[_0xbe93('0x30')]==='customVariable'&&_0x313ff8['Variable']&&_0x313ff8[_0xbe93('0x3a')]['name']&&_0x313ff8[_0xbe93('0x37')]&&_0x313ff8[_0xbe93('0x31')]){_0x4535d7[_0x313ff8['idField'][_0xbe93('0x33')]()]=_0x14f5a1[_0x313ff8[_0xbe93('0x3a')]['name'][_0xbe93('0x33')]()][_0xbe93('0x35')]();}});}return _0x4535d7;}function getTicket(_0x1d3e14,_0x3300e3,_0x5b8df6,_0x11dde9,_0x1fc953,_0x5572d8){return function(_0x6752c3){logger[_0xbe93('0x12')]('['+[_0x1d3e14[_0xbe93('0x14')]()]+']\x20getTicket\x20input\x20crm',_0x6752c3);return new Promise(function(_0x3a82e6,_0xdec30c){var _0x3f365a=_0x1d3e14[_0xbe93('0x33')]()===_0xbe93('0x3b')?_0x6752c3[_0xbe93('0x1c')]:_0x6752c3[_0xbe93('0x28')];var _0x10c880={'method':_0xbe93('0x22'),'uri':_0x5b8df6+'incident'+'?'+_0x5572d8,'body':Object['assign']({},{'active':'true','caller_id':_0x3f365a,'assigned_to':_0x6752c3[_0xbe93('0x1c')],'short_description':intUtil['getString'](_0x11dde9[_0xbe93('0x3c')],_0x1fc953,'\x20'),'description':intUtil['getString'](_0x11dde9[_0xbe93('0x3d')],_0x1fc953,'\x0a')},getCustomFields(_0x11dde9[_0xbe93('0x3e')],_0x1fc953)),'auth':_0x3300e3,'json':!![]};return rp(_0x10c880)[_0xbe93('0xd')](function(_0x36708f){logger[_0xbe93('0x12')]('['+[_0x1d3e14['toUpperCase']()]+_0xbe93('0x3f'),_0x36708f['result']);_0x6752c3[_0xbe93('0x40')]=_0x36708f['result'][_0xbe93('0x11')];_0x6752c3['ticketNumber']=_0x36708f[_0xbe93('0xe')][_0xbe93('0x41')];logger[_0xbe93('0x12')]('['+[_0x1d3e14[_0xbe93('0x14')]()]+_0xbe93('0x42'),_0x6752c3);_0x3a82e6(_0x6752c3);})['catch'](function(_0x33efea){logger[_0xbe93('0x1e')]('['+[_0x1d3e14['toUpperCase']()]+']',_0x33efea[_0xbe93('0x1f')]);_0xdec30c(_0x33efea[_0xbe93('0x1f')]);});});};}function createRemoteTag(_0x495dc0,_0x1847f5,_0x49aa4d,_0x56749e){return new Promise(function(_0x3d7d52,_0x54f502){var _0x3d1491={'method':_0xbe93('0x22'),'uri':_0x49aa4d+_0xbe93('0x43')+'?'+_0x56749e,'body':{'short_description':_0x495dc0,'global':!![],'active':!![],'name':_0x495dc0},'auth':_0x1847f5,'json':!![]};return rp(_0x3d1491)[_0xbe93('0xd')](function(_0x31481e){var _0x3a024f=_0x31481e['result'][_0xbe93('0x11')];_0x3d7d52(_0x3a024f);});});}function getRemoteTag(_0xc90c70,_0x5713b3,_0x3b0f48,_0x55d8e2,_0x3e8423){return new Promise(function(_0x3ab5ea,_0x1018c5){var _0x1861e7={'method':_0xbe93('0xb'),'uri':_0x3b0f48+'label'+_0xbe93('0x44')+_0xc90c70+'&'+_0x55d8e2,'auth':_0x5713b3,'json':!![]};return rp(_0x1861e7)[_0xbe93('0xd')](function(_0x4d3772){if(_0x4d3772[_0xbe93('0xe')][_0xbe93('0xf')]>0x0){var _0x8c100e=_0x4d3772['result'][0x0][_0xbe93('0x11')];_0x3ab5ea(_0x8c100e);}else{return createRemoteTag(_0xc90c70,_0x5713b3,_0x3b0f48,_0x55d8e2)['then'](function(_0x39a419){_0x3ab5ea(_0x39a419);});}});});}function assignTagToIncident(_0x4fde9b,_0x4a9d1a,_0x15023b,_0x297227,_0x3398ba){return new Promise(function(_0x5c0b57,_0x3d2fbf){var _0x148adc={'method':_0xbe93('0x22'),'uri':_0x15023b+_0xbe93('0x45')+'?'+_0x3398ba,'body':{'label':_0x4fde9b,'table':'incident','id_type':_0xbe93('0x46'),'table_key':_0x297227[_0xbe93('0x40')],'title':_0xbe93('0x47')+_0x297227[_0xbe93('0x48')],'id_display':_0x297227[_0xbe93('0x48')]},'auth':_0x4a9d1a,'json':!![]};return rp(_0x148adc)['then'](function(_0x4c8382){_0x5c0b57();})[_0xbe93('0x13')](function(){_0x5c0b57();});});}function manageTags(_0x3eadf0,_0x277d3e,_0x43345d,_0x47aee4,_0x43ab8f,_0x452d6e,_0x3d02b4){return new Promise(function(_0x12534d,_0x5c7740){var _0x53841d=[];_0x277d3e[_0xbe93('0x2d')](function(_0x3fedfc){_0x53841d[_0xbe93('0x49')](getRemoteTag(_0x3fedfc,_0x43345d,_0x47aee4,_0x452d6e,_0x3d02b4));});return Promise[_0xbe93('0x4a')](_0x53841d)[_0xbe93('0xd')](function(_0x51ff6b){if(_0x51ff6b[_0xbe93('0xf')]){logger[_0xbe93('0x12')]('['+[_0x3eadf0['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x51ff6b);var _0x308b45=[];_0x51ff6b[_0xbe93('0x2d')](function(_0x4de954){_0x308b45[_0xbe93('0x49')](assignTagToIncident(_0x4de954,_0x43345d,_0x47aee4,_0x43ab8f,_0x452d6e));});return Promise[_0xbe93('0x4a')](_0x308b45)[_0xbe93('0xd')](function(){_0x12534d();})[_0xbe93('0x13')](function(){_0x12534d();});}else{_0x12534d();}});});}function getTags(_0xc64d9c,_0x112a87,_0x382784,_0x5a2018,_0x368f7f,_0x571183){return function(_0x1c22bb){return new Promise(function(_0x3a2a4c,_0x4e0654){var _0x48973f=[];var _0x2cd191=_0x5a2018[_0xbe93('0x4b')];if(_0x2cd191&&_0x2cd191['length']>0x0){_0x48973f=_['map'](_0x2cd191,_0xbe93('0x4c'));}if(_0x48973f[_0xbe93('0xf')]>0x0){return manageTags(_0xc64d9c,_0x48973f,_0x112a87,_0x382784,_0x1c22bb,_0x368f7f,_0x571183)[_0xbe93('0xd')](function(){_0x3a2a4c(_0x1c22bb);});}else{_0x3a2a4c(_0x1c22bb);}});};}function emit(_0x5c5c6d,_0x811f59,_0x2190c4){var _0x1e112a='%26sysparm_record_target%3Dincident'+_0xbe93('0x4d')+_0xbe93('0x4e')+_0xbe93('0x4f');var _0x10fc6f={'uri':_0x5c5c6d+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x2190c4+_0x1e112a};io['to'](util['format'](_0xbe93('0x50'),_0x811f59))['emit'](_0xbe93('0x51'),_0x10fc6f);}exports['cs']=function(_0xf3f489,_0x1951b9,_0x1e4a32,_0x1b5870,_0x18043f,_0x265012,_0x429d3d,_0x339176){var _0x3b5d4d={};var _0x28d532={'user':_0x265012[_0xbe93('0x52')],'pass':_0x265012[_0xbe93('0x53')]};var _0x54aac8=_0xbe93('0x54');var _0x1a86d7=_0xbe93('0x55');_0x265012[_0xbe93('0x56')]=intUtil['stripTrailingSlash'](_0x265012[_0xbe93('0x56')]);_0x265012[_0xbe93('0x57')]=intUtil[_0xbe93('0x58')](_0x265012[_0xbe93('0x57')]);var _0x37cddf=util[_0xbe93('0x59')]('%s/api/now/table/',_0x265012[_0xbe93('0x56')]);_0x3b5d4d[_0xbe93('0x17')]=!_[_0xbe93('0x5a')](_0x1b5870)?_0x1b5870[_0xbe93('0x5b')]:null;_0x3b5d4d[_0xbe93('0x1d')]=_0x265012['email'];_0x3b5d4d[_0xbe93('0x24')]=_0x339176['toLowerCase']()===_0xbe93('0x3b')?_0x1951b9[_0xbe93('0x5c')]:_0x1951b9['calleridnum'];_0x3b5d4d['callDirection']=_0x339176===_0xbe93('0x5d')||_0x339176===_0xbe93('0x5e')?_0xbe93('0x5d'):'outbound';var _0x48b818=util['format'](_0xbe93('0x5f'),_0x265012[_0xbe93('0x57')],_0x1951b9[_0xbe93('0x60')],md5(_0x1951b9[_0xbe93('0x60')]));if(_0x18043f&&_0x18043f[_0xbe93('0x61')]){logger[_0xbe93('0x12')](_0xbe93('0x62'),_0xbe93('0x63'));_0x1951b9[_0xbe93('0x64')]=_0x48b818;}else if(_0x429d3d&&_0x429d3d[_0xbe93('0x65')]&&_0x429d3d[_0xbe93('0x65')]!=='none'){logger['info'](_0xbe93('0x66'),_0xbe93('0x63'));_0x1951b9[_0xbe93('0x64')]=_0x48b818;}else{_0x1951b9[_0xbe93('0x64')]='';}return getAdminUser(_0x339176,_0x28d532,_0x3b5d4d,_0x37cddf,_0x1a86d7,_0x54aac8)[_0xbe93('0xd')](getUser(_0x339176,_0x28d532,_0x37cddf,_0x1a86d7,_0x54aac8))[_0xbe93('0xd')](getEndUser(_0x339176,_0x28d532,_0x37cddf,_0x1a86d7,_0x54aac8))[_0xbe93('0xd')](getTicket(_0x339176,_0x28d532,_0x37cddf,_0x1e4a32,_0x1951b9,_0x1a86d7))[_0xbe93('0xd')](function(_0x5a4c9c){logger[_0xbe93('0x12')](util[_0xbe93('0x59')](_0xbe93('0x67'),_0x5a4c9c['ticketId']));logger[_0xbe93('0x12')](util[_0xbe93('0x59')](_0xbe93('0x68'),_0x339176));if(_0x339176!==_0xbe93('0x5e')){logger[_0xbe93('0x12')]('['+[_0x339176[_0xbe93('0x14')]()]+']',_0xbe93('0x69'));emit(_0x265012['remoteUri'],_0x1b5870['name'],_0x5a4c9c[_0xbe93('0x40')]);}})['catch'](function(_0x4d4707){logger[_0xbe93('0x1e')]('['+[_0x339176['toUpperCase']()]+_0xbe93('0x6a'),util[_0xbe93('0x6b')](_0x4d4707,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb1a5=['user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','%s/api/now/table/','email','adminEmail','destcalleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','result','adminId','sys_id','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','length','active','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','true','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','content','toString','includes','idField','customField','toLowerCase','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format'];(function(_0x12309b,_0x59dd8c){var _0x482e4d=function(_0x308407){while(--_0x308407){_0x12309b['push'](_0x12309b['shift']());}};_0x482e4d(++_0x59dd8c);}(_0xb1a5,0x8a));var _0x5b1a=function(_0x7aafa0,_0x3377c8){_0x7aafa0=_0x7aafa0-0x0;var _0x315548=_0xb1a5[_0x7aafa0];return _0x315548;};'use strict';var _=require(_0x5b1a('0x0'));var Promise=require(_0x5b1a('0x1'));var rp=require(_0x5b1a('0x2'));var util=require(_0x5b1a('0x3'));var md5=require(_0x5b1a('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x5b1a('0x5'));var logger=require(_0x5b1a('0x6'))(_0x5b1a('0x7'));config[_0x5b1a('0x8')]=_[_0x5b1a('0x9')](config['redis'],{'host':_0x5b1a('0xa'),'port':0x18eb});var io=require(_0x5b1a('0xb'))(new Redis(config[_0x5b1a('0x8')]));function getAdminUser(_0x8e03ab,_0x829b48,_0x321544,_0x417fa3,_0x3ca2be,_0x421b50){return new Promise(function(_0x51a16a,_0x4b06f5){var _0x4d8569={'method':'GET','uri':_0x417fa3+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x3ca2be+'&'+_0x421b50,'auth':_0x829b48,'json':!![]};return rp(_0x4d8569)['then'](function(_0x169ac5){if(_0x169ac5[_0x5b1a('0xc')]['length']>0x0){_0x321544[_0x5b1a('0xd')]=_0x169ac5['result'][0x0][_0x5b1a('0xe')];}logger[_0x5b1a('0xf')]('['+[_0x8e03ab[_0x5b1a('0x10')]()]+'],\x20getAdminUser\x20crm',_0x321544);_0x51a16a(_0x321544);})[_0x5b1a('0x11')](function(_0x42de72){logger[_0x5b1a('0x12')]('['+[_0x8e03ab[_0x5b1a('0x10')]()]+']',_0x42de72[_0x5b1a('0x13')]);_0x4b06f5(_0x42de72[_0x5b1a('0x13')]);});});}function getUser(_0x3ef7db,_0x42846b,_0x45536b,_0x108d15,_0x1ea7ec){return function(_0x423a7a){logger[_0x5b1a('0xf')]('['+[_0x3ef7db[_0x5b1a('0x10')]()]+_0x5b1a('0x14'),_0x423a7a);return new Promise(function(_0x24e858,_0x205980){if(intUtil[_0x5b1a('0x15')](_0x423a7a[_0x5b1a('0x16')])){var _0x108493={'method':_0x5b1a('0x17'),'uri':_0x45536b+'sys_user?sysparm_query=email%3D'+_0x423a7a[_0x5b1a('0x16')]+'&'+_0x108d15+'&'+_0x1ea7ec,'auth':_0x42846b,'json':!![]};logger[_0x5b1a('0xf')]('['+[_0x3ef7db[_0x5b1a('0x10')]()]+_0x5b1a('0x18'),_0x108493);return rp(_0x108493)[_0x5b1a('0x19')](function(_0x14d2f8){logger[_0x5b1a('0xf')]('['+[_0x3ef7db[_0x5b1a('0x10')]()]+_0x5b1a('0x1a'),_0x14d2f8);if(_0x14d2f8['result'][_0x5b1a('0x1b')]>0x0&&String(_0x14d2f8[_0x5b1a('0xc')][0x0][_0x5b1a('0x1c')])==='true'){_0x423a7a[_0x5b1a('0x1d')]=_0x14d2f8[_0x5b1a('0xc')][0x0][_0x5b1a('0xe')];}else{_0x423a7a[_0x5b1a('0x1d')]=_0x423a7a[_0x5b1a('0xd')];_0x423a7a[_0x5b1a('0x16')]=_0x423a7a['adminEmail'];}logger[_0x5b1a('0xf')]('['+[_0x3ef7db['toUpperCase']()]+_0x5b1a('0x1e'),_0x423a7a);_0x24e858(_0x423a7a);})[_0x5b1a('0x11')](function(_0x504526){logger[_0x5b1a('0x12')]('['+[_0x3ef7db[_0x5b1a('0x10')]()]+']',_0x504526['message']);_0x205980(_0x504526['message']);});}else{logger[_0x5b1a('0xf')]('['+[_0x3ef7db[_0x5b1a('0x10')]()]+_0x5b1a('0x1f'));_0x423a7a[_0x5b1a('0x1d')]=_0x423a7a[_0x5b1a('0xd')];_0x423a7a[_0x5b1a('0x16')]=_0x423a7a['adminEmail'];_0x24e858(_0x423a7a);}});};}function createEndUser(_0x16e647,_0x755d89,_0x1838ff,_0x2ef92e,_0x468295){logger[_0x5b1a('0xf')]('['+[_0x16e647[_0x5b1a('0x10')]()]+_0x5b1a('0x20'),_0x1838ff);return new Promise(function(_0x5f3959,_0x50b866){var _0x467e95={'method':_0x5b1a('0x21'),'uri':_0x2ef92e+_0x5b1a('0x22')+_0x468295,'body':{'user_name':_0x1838ff[_0x5b1a('0x23')],'roles':'user','first_name':_0x1838ff[_0x5b1a('0x23')],'active':_0x5b1a('0x24'),'date_format':_0x5b1a('0x25'),'phone':_0x1838ff['endUserNumber']},'auth':_0x755d89,'json':!![]};return rp(_0x467e95)[_0x5b1a('0x19')](function(_0x27ba9a){logger['info']('['+[_0x16e647[_0x5b1a('0x10')]()]+_0x5b1a('0x26'),_0x27ba9a[_0x5b1a('0xc')]);_0x1838ff['endUserId']=_0x27ba9a[_0x5b1a('0xc')][_0x5b1a('0xe')];_0x5f3959(_0x1838ff);})[_0x5b1a('0x11')](function(_0x44675e){logger[_0x5b1a('0x12')]('['+[_0x16e647['toUpperCase']()]+']',_0x44675e[_0x5b1a('0x13')]);_0x50b866(_0x44675e[_0x5b1a('0x13')]);});});}function getEndUser(_0x14bc2a,_0x4e0214,_0x58232b,_0x2270b6,_0x4a4c42){return function(_0x55f4d7){logger['info']('['+[_0x14bc2a[_0x5b1a('0x10')]()]+_0x5b1a('0x27'),_0x55f4d7);return new Promise(function(_0x531d22,_0x3a562b){var _0x3b92f2={'method':_0x5b1a('0x17'),'uri':_0x58232b+'sys_user?sysparm_query=phone%3D'+_0x55f4d7[_0x5b1a('0x23')]+'&'+_0x2270b6+'&'+_0x4a4c42,'auth':_0x4e0214,'json':!![]};return rp(_0x3b92f2)[_0x5b1a('0x19')](function(_0x49ec6f){if(_0x49ec6f[_0x5b1a('0xc')]['length']>0x0){_0x55f4d7[_0x5b1a('0x28')]=_0x49ec6f[_0x5b1a('0xc')][0x0]['sys_id'];logger['info']('['+[_0x14bc2a['toUpperCase']()]+_0x5b1a('0x29'),_0x55f4d7);_0x531d22(_0x55f4d7);}else{return createEndUser(_0x14bc2a,_0x4e0214,_0x55f4d7,_0x58232b,_0x2270b6)['then'](function(_0x2b9145){logger['info']('['+[_0x14bc2a['toUpperCase']()]+_0x5b1a('0x2a'),_0x2b9145);_0x531d22(_0x2b9145);});}})[_0x5b1a('0x11')](function(_0x530bbe){logger[_0x5b1a('0x12')]('['+[_0x14bc2a['toUpperCase']()]+']',_0x530bbe['message']);_0x3a562b(_0x530bbe[_0x5b1a('0x13')]);});});};}function getCustomFields(_0x4a7c05,_0x50b1df){var _0x204909={};if(_0x4a7c05[_0x5b1a('0x1b')]>0x0){_[_0x5b1a('0x2b')](_0x4a7c05,function(_0x190f6f){if(_['includes']([_0x5b1a('0x2c'),_0x5b1a('0x2d')],_0x190f6f[_0x5b1a('0x2e')])&&_0x190f6f[_0x5b1a('0x2f')]&&!_0x190f6f['customField']){_0x204909[_0x190f6f[_0x5b1a('0x2f')]['toLowerCase']()]=_0x190f6f[_0x5b1a('0x30')][_0x5b1a('0x31')]();}else if(_[_0x5b1a('0x32')]([_0x5b1a('0x2c'),_0x5b1a('0x2d')],_0x190f6f[_0x5b1a('0x2e')])&&_0x190f6f[_0x5b1a('0x33')]&&_0x190f6f[_0x5b1a('0x34')]){_0x204909[_0x190f6f[_0x5b1a('0x33')][_0x5b1a('0x35')]()]=_0x190f6f[_0x5b1a('0x30')][_0x5b1a('0x31')]();}else if(_0x190f6f[_0x5b1a('0x2e')]==='variable'&&_0x190f6f['variableName']&&_0x190f6f[_0x5b1a('0x33')]&&_0x190f6f[_0x5b1a('0x34')]){_0x204909[_0x190f6f['idField'][_0x5b1a('0x35')]()]=_0x50b1df[_0x190f6f[_0x5b1a('0x36')]][_0x5b1a('0x31')]();}else if(_0x190f6f[_0x5b1a('0x2e')]===_0x5b1a('0x37')&&_0x190f6f['Variable']&&_0x190f6f[_0x5b1a('0x38')][_0x5b1a('0x39')]&&_0x190f6f[_0x5b1a('0x33')]&&_0x190f6f[_0x5b1a('0x34')]){_0x204909[_0x190f6f['idField']['toLowerCase']()]=_0x50b1df[_0x190f6f[_0x5b1a('0x38')][_0x5b1a('0x39')]['toLowerCase']()][_0x5b1a('0x31')]();}});}return _0x204909;}function getTicket(_0x274f79,_0x4384dd,_0x5ebb82,_0xb569e6,_0x275a94,_0x3f6f6d){return function(_0x1c14b4){logger[_0x5b1a('0xf')]('['+[_0x274f79[_0x5b1a('0x10')]()]+_0x5b1a('0x3a'),_0x1c14b4);return new Promise(function(_0x59e622,_0x2c185b){var _0x268773=_0x274f79['toLowerCase']()==='outbound'?_0x1c14b4[_0x5b1a('0x1d')]:_0x1c14b4[_0x5b1a('0x28')];var _0x36c0bf={'method':'POST','uri':_0x5ebb82+_0x5b1a('0x3b')+'?'+_0x3f6f6d,'body':Object[_0x5b1a('0x3c')]({},{'active':'true','caller_id':_0x268773,'assigned_to':_0x1c14b4[_0x5b1a('0x1d')],'short_description':intUtil[_0x5b1a('0x3d')](_0xb569e6[_0x5b1a('0x3e')],_0x275a94,'\x20'),'description':intUtil[_0x5b1a('0x3d')](_0xb569e6[_0x5b1a('0x3f')],_0x275a94,'\x0a')},getCustomFields(_0xb569e6[_0x5b1a('0x40')],_0x275a94)),'auth':_0x4384dd,'json':!![]};return rp(_0x36c0bf)['then'](function(_0x4b1985){logger['info']('['+[_0x274f79[_0x5b1a('0x10')]()]+_0x5b1a('0x41'),_0x4b1985[_0x5b1a('0xc')]);_0x1c14b4[_0x5b1a('0x42')]=_0x4b1985[_0x5b1a('0xc')][_0x5b1a('0xe')];_0x1c14b4[_0x5b1a('0x43')]=_0x4b1985[_0x5b1a('0xc')][_0x5b1a('0x44')];logger[_0x5b1a('0xf')]('['+[_0x274f79['toUpperCase']()]+_0x5b1a('0x45'),_0x1c14b4);_0x59e622(_0x1c14b4);})[_0x5b1a('0x11')](function(_0x5501e4){logger['error']('['+[_0x274f79[_0x5b1a('0x10')]()]+']',_0x5501e4[_0x5b1a('0x13')]);_0x2c185b(_0x5501e4[_0x5b1a('0x13')]);});});};}function createRemoteTag(_0x377e37,_0x5cfc95,_0x398ea4,_0x21d227){return new Promise(function(_0x205ed4,_0x552e74){var _0x1fbbe4={'method':_0x5b1a('0x21'),'uri':_0x398ea4+_0x5b1a('0x46')+'?'+_0x21d227,'body':{'short_description':_0x377e37,'global':!![],'active':!![],'name':_0x377e37},'auth':_0x5cfc95,'json':!![]};return rp(_0x1fbbe4)[_0x5b1a('0x19')](function(_0x39ae74){var _0x2945ad=_0x39ae74[_0x5b1a('0xc')][_0x5b1a('0xe')];_0x205ed4(_0x2945ad);});});}function getRemoteTag(_0x471ec9,_0x5e4750,_0x479a1d,_0x302ba0,_0x54eef2){return new Promise(function(_0x28a506,_0x292e94){var _0x281b8e={'method':'GET','uri':_0x479a1d+_0x5b1a('0x46')+_0x5b1a('0x47')+_0x471ec9+'&'+_0x302ba0,'auth':_0x5e4750,'json':!![]};return rp(_0x281b8e)[_0x5b1a('0x19')](function(_0x57151c){if(_0x57151c[_0x5b1a('0xc')][_0x5b1a('0x1b')]>0x0){var _0x5f299e=_0x57151c['result'][0x0][_0x5b1a('0xe')];_0x28a506(_0x5f299e);}else{return createRemoteTag(_0x471ec9,_0x5e4750,_0x479a1d,_0x302ba0)[_0x5b1a('0x19')](function(_0x298545){_0x28a506(_0x298545);});}});});}function assignTagToIncident(_0x16197a,_0x2a6c3a,_0x5beeb6,_0x3b7d0c,_0x10b0f6){return new Promise(function(_0x4b9cf6,_0x19b7b1){var _0x76f7d7={'method':_0x5b1a('0x21'),'uri':_0x5beeb6+_0x5b1a('0x48')+'?'+_0x10b0f6,'body':{'label':_0x16197a,'table':'incident','id_type':_0x5b1a('0x49'),'table_key':_0x3b7d0c['ticketId'],'title':_0x5b1a('0x4a')+_0x3b7d0c['ticketNumber'],'id_display':_0x3b7d0c[_0x5b1a('0x43')]},'auth':_0x2a6c3a,'json':!![]};return rp(_0x76f7d7)['then'](function(_0x185428){_0x4b9cf6();})['catch'](function(){_0x4b9cf6();});});}function manageTags(_0x8de6a8,_0x120ef4,_0x4fc470,_0xec2ac2,_0x44652f,_0x34e9db,_0x1e90cd){return new Promise(function(_0x41f49e,_0xe6818f){var _0x192d9b=[];_0x120ef4[_0x5b1a('0x2b')](function(_0x41618c){_0x192d9b[_0x5b1a('0x4b')](getRemoteTag(_0x41618c,_0x4fc470,_0xec2ac2,_0x34e9db,_0x1e90cd));});return Promise['all'](_0x192d9b)[_0x5b1a('0x19')](function(_0x1bd2a9){if(_0x1bd2a9[_0x5b1a('0x1b')]){logger['info']('['+[_0x8de6a8[_0x5b1a('0x10')]()]+_0x5b1a('0x4c'),_0x1bd2a9);var _0x4470f2=[];_0x1bd2a9[_0x5b1a('0x2b')](function(_0x195893){_0x4470f2[_0x5b1a('0x4b')](assignTagToIncident(_0x195893,_0x4fc470,_0xec2ac2,_0x44652f,_0x34e9db));});return Promise['all'](_0x4470f2)[_0x5b1a('0x19')](function(){_0x41f49e();})[_0x5b1a('0x11')](function(){_0x41f49e();});}else{_0x41f49e();}});});}function getTags(_0x597e9d,_0x1650ce,_0x149286,_0x1999ac,_0x41f423,_0xf19e0f){return function(_0x2e2077){return new Promise(function(_0x2e52de,_0x2c1a9d){var _0x244295=[];var _0x5e05df=_0x1999ac[_0x5b1a('0x4d')];if(_0x5e05df&&_0x5e05df['length']>0x0){_0x244295=_[_0x5b1a('0x4e')](_0x5e05df,'name');}if(_0x244295[_0x5b1a('0x1b')]>0x0){return manageTags(_0x597e9d,_0x244295,_0x1650ce,_0x149286,_0x2e2077,_0x41f423,_0xf19e0f)[_0x5b1a('0x19')](function(){_0x2e52de(_0x2e2077);});}else{_0x2e52de(_0x2e2077);}});};}function emit(_0x2fb209,_0x124db9,_0x2e2612){var _0x26ac70=_0x5b1a('0x4f')+_0x5b1a('0x50')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x5b1a('0x51');var _0x1f77d1={'uri':_0x2fb209+_0x5b1a('0x52')+_0x2e2612+_0x26ac70};io['to'](util[_0x5b1a('0x53')](_0x5b1a('0x54'),_0x124db9))[_0x5b1a('0x55')](_0x5b1a('0x56'),_0x1f77d1);}exports['cs']=function(_0x5ad092,_0x7415de,_0x124c7e,_0x2b3ed5,_0xd6a61,_0x22c5d2,_0x208262,_0x23bde6){var _0x2cde2c={};var _0xd8cfbb={'user':_0x22c5d2[_0x5b1a('0x57')],'pass':_0x22c5d2[_0x5b1a('0x58')]};var _0x3393ea=_0x5b1a('0x59');var _0x27388d='sysparm_display_value=true';_0x22c5d2[_0x5b1a('0x5a')]=intUtil[_0x5b1a('0x5b')](_0x22c5d2[_0x5b1a('0x5a')]);_0x22c5d2['serverUrl']=intUtil[_0x5b1a('0x5b')](_0x22c5d2['serverUrl']);var _0x4a01f4=util[_0x5b1a('0x53')](_0x5b1a('0x5c'),_0x22c5d2[_0x5b1a('0x5a')]);_0x2cde2c['userEmail']=!_['isNil'](_0x2b3ed5)?_0x2b3ed5[_0x5b1a('0x5d')]:null;_0x2cde2c[_0x5b1a('0x5e')]=_0x22c5d2[_0x5b1a('0x5d')];_0x2cde2c['endUserNumber']=_0x23bde6[_0x5b1a('0x35')]()==='outbound'?_0x7415de[_0x5b1a('0x5f')]:_0x7415de['calleridnum'];_0x2cde2c[_0x5b1a('0x60')]=_0x23bde6===_0x5b1a('0x61')||_0x23bde6==='unmanaged'?_0x5b1a('0x61'):'outbound';var _0x4e4dfc=util[_0x5b1a('0x53')](_0x5b1a('0x62'),_0x22c5d2[_0x5b1a('0x63')],_0x7415de[_0x5b1a('0x64')],md5(_0x7415de[_0x5b1a('0x64')]));if(_0xd6a61&&_0xd6a61[_0x5b1a('0x65')]){logger['info'](_0x5b1a('0x66'),_0x5b1a('0x67'));_0x7415de[_0x5b1a('0x68')]=_0x4e4dfc;}else if(_0x208262&&_0x208262[_0x5b1a('0x69')]&&_0x208262[_0x5b1a('0x69')]!==_0x5b1a('0x6a')){logger[_0x5b1a('0xf')]('[OUTBOUND]',_0x5b1a('0x67'));_0x7415de[_0x5b1a('0x68')]=_0x4e4dfc;}else{_0x7415de['recordingURL']='';}return getAdminUser(_0x23bde6,_0xd8cfbb,_0x2cde2c,_0x4a01f4,_0x27388d,_0x3393ea)['then'](getUser(_0x23bde6,_0xd8cfbb,_0x4a01f4,_0x27388d,_0x3393ea))[_0x5b1a('0x19')](getEndUser(_0x23bde6,_0xd8cfbb,_0x4a01f4,_0x27388d,_0x3393ea))[_0x5b1a('0x19')](getTicket(_0x23bde6,_0xd8cfbb,_0x4a01f4,_0x124c7e,_0x7415de,_0x27388d))[_0x5b1a('0x19')](function(_0x426e42){logger[_0x5b1a('0xf')](util['format'](_0x5b1a('0x6b'),_0x426e42[_0x5b1a('0x42')]));logger[_0x5b1a('0xf')](util['format'](_0x5b1a('0x6c'),_0x23bde6));if(_0x23bde6!=='unmanaged'){logger['info']('['+[_0x23bde6[_0x5b1a('0x10')]()]+']',_0x5b1a('0x6d'));emit(_0x22c5d2[_0x5b1a('0x5a')],_0x2b3ed5['name'],_0x426e42[_0x5b1a('0x42')]);}})[_0x5b1a('0x11')](function(_0x3b3e06){logger[_0x5b1a('0x12')]('['+[_0x23bde6[_0x5b1a('0x10')]()]+_0x5b1a('0x6e'),util['inspect'](_0x3b3e06,{'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 886847b..e117422 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 _0x1605=['The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Outbound','Ticket\x20created!','version','trigger:browser:url','catch','unmanaged','monitor_format','lastevent','toUpperCase','calleridname','Inbound','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','name','direction','length','variableName','push','idField','set_entry','JSON','stringify','format','toString','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','find','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','entry_list','phone_home','Enduser\x20found!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','forEach','type','string','nameField','customField','toLowerCase','content','variable','custom_fields','customVariable','Variable','login','username','xCALLY\x20Motion\x20integration','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x1605,0x97));var _0x5160=function(_0x137ef0,_0x5239c9){_0x137ef0=_0x137ef0-0x0;var _0x59c977=_0x1605[_0x137ef0];return _0x59c977;};'use strict';var _=require(_0x5160('0x0'));var rp=require(_0x5160('0x1'));var BPromise=require('bluebird');var md5=require(_0x5160('0x2'));var util=require(_0x5160('0x3'));var Redis=require('ioredis');var intUtil=require(_0x5160('0x4'));var config=require(_0x5160('0x5'));var logger=require(_0x5160('0x6'))('sugarcrm');config[_0x5160('0x7')]=_[_0x5160('0x8')](config[_0x5160('0x7')],{'host':_0x5160('0x9'),'port':0x18eb});var io=require(_0x5160('0xa'))(new Redis(config[_0x5160('0x7')]));var def={'method':_0x5160('0xb'),'json':!![]};function emit(_0x4a1c3c,_0x4e098d,_0x3d9e24){io['to'](_0x4a1c3c)[_0x5160('0xc')](_0x4e098d,_0x3d9e24);}function getTicket(_0x1366ae,_0x2c7162,_0x4c2991,_0x366a94,_0x2e73e3,_0x193203,_0x24e932,_0x367b7c){logger[_0x5160('0xd')](_0x5160('0xe'));var _0x22544c=new Date();var _0x57ee0c=[{'name':'name','value':intUtil[_0x5160('0xf')](_0x366a94[_0x5160('0x10')],_0x2e73e3,'\x20')},{'name':_0x5160('0x11'),'value':_0x2c7162['id']},{'name':_0x5160('0x12'),'value':_0x2c7162['id']},{'name':_0x5160('0x13'),'value':intUtil[_0x5160('0xf')](_0x366a94[_0x5160('0x14')],_0x2e73e3,'\x0a')},{'name':_0x5160('0x15'),'value':_0x22544c[_0x5160('0x16')]()[_0x5160('0x17')](0x0,0x13)[_0x5160('0x18')]('T','\x20')},{'name':_0x5160('0x19'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x5160('0x1a'),'value':_0x4c2991['id']},{'name':_0x5160('0x1b'),'value':_0x5160('0x1c')},{'name':_0x5160('0x1d'),'value':_0x4c2991[_0x5160('0x1e')]},{'name':_0x5160('0x1f'),'value':_0x367b7c}];if(_0x193203[_0x5160('0x20')]){_['forEach'](_0x193203,function(_0x447465){if(_0x2e73e3[_0x447465[_0x5160('0x21')]]){_0x57ee0c[_0x5160('0x22')]({'name':_0x447465[_0x5160('0x23')],'value':_0x2e73e3[_0x447465[_0x5160('0x21')]]});}});}return request({'form':{'method':_0x5160('0x24'),'input_type':_0x5160('0x25'),'response_type':'JSON','rest_data':JSON[_0x5160('0x26')]({'session':_0x24e932['id'],'module_name':'Calls','name_value_list':_0x57ee0c})}});}function getAuth(_0x29e8e7){return util[_0x5160('0x27')]('Basic\x20%s',new Buffer(_0x29e8e7['apiKey']+':X')[_0x5160('0x28')]('base64'));}function getServerInfo(_0x5ede0d){return request({'form':{'method':'get_server_info','input_type':_0x5160('0x25'),'response_type':_0x5160('0x25'),'rest_data':JSON[_0x5160('0x26')]({'session':_0x5ede0d['id']})}});}function getUser(_0x288749,_0x7651,_0x54c886){if(!_['isNil'](_0x7651)){logger['info'](_0x5160('0x29'),_0x7651);return request({'form':{'method':'get_entry_list','input_type':_0x5160('0x25'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x54c886['id'],'module_name':_0x5160('0x2a'),'query':util[_0x5160('0x27')](_0x5160('0x2b'),_0x7651),'order_by':'','offset':'0','select_fields':['id',_0x5160('0x1e'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5160('0x2c')](function(_0x343c19){if(_0x343c19['entry_list']['length']){var _0x4c3018=_[_0x5160('0x2d')](_0x343c19['entry_list'],function(_0x3aefcb){return _0x3aefcb[_0x5160('0x2e')][_0x5160('0x2f')][_0x5160('0x30')]===_0x7651;});if(_0x4c3018){logger[_0x5160('0xd')](_0x5160('0x31'));return BPromise[_0x5160('0x32')]({'id':_0x4c3018[_0x5160('0x2e')]['id']['value'],'name':_0x4c3018[_0x5160('0x2e')][_0x5160('0x1e')]['value']});}}logger[_0x5160('0xd')](_0x5160('0x33'));return BPromise[_0x5160('0x32')]({'id':_0x54c886[_0x5160('0x2e')][_0x5160('0x34')][_0x5160('0x30')],'name':_0x54c886[_0x5160('0x2e')][_0x5160('0x2f')]['value']});});}else{logger['info'](_0x5160('0x35'));return BPromise[_0x5160('0x32')]({'id':_0x54c886[_0x5160('0x2e')]['user_id']['value'],'name':_0x54c886[_0x5160('0x2e')]['user_name'][_0x5160('0x30')]});}}function getEndUser(_0x2868b9,_0xf33720,_0x1e1d53,_0x592c5d){logger[_0x5160('0xd')](_0x5160('0x36'),_0x1e1d53);return request({'form':{'method':_0x5160('0x37'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x592c5d['id'],'module_name':'Contacts','query':util['format'](_0x5160('0x38'),_0x1e1d53),'order_by':'','offset':'0','select_fields':['id',_0x5160('0x1e'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5160('0x2c')](function(_0x210c73){if(_0x210c73[_0x5160('0x39')][_0x5160('0x20')]){var _0x13e346=_[_0x5160('0x2d')](_0x210c73['entry_list'],function(_0x309835){return _0x309835[_0x5160('0x2e')][_0x5160('0x3a')]['value']===_0x1e1d53;});if(_0x13e346){logger[_0x5160('0xd')](_0x5160('0x3b'));return BPromise[_0x5160('0x32')]({'id':_0x13e346['name_value_list']['id'][_0x5160('0x30')],'name':_0x13e346[_0x5160('0x2e')][_0x5160('0x1e')]['value'],'phone':_0x13e346[_0x5160('0x2e')]['phone_home']['value']});}}else{logger[_0x5160('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x5160('0x24'),'input_type':'JSON','response_type':_0x5160('0x25'),'rest_data':JSON[_0x5160('0x26')]({'session':_0x592c5d['id'],'module_name':_0x5160('0x1c'),'name_value_list':[{'name':'first_name','value':_0xf33720!==_0x5160('0x3c')?_0xf33720:util[_0x5160('0x27')](_0x5160('0x3d'),_0x1e1d53)},{'name':_0x5160('0x3a'),'value':_0x1e1d53}]})}})[_0x5160('0x2c')](function(_0x193ae1){logger[_0x5160('0xd')](_0x5160('0x3e'));return BPromise['resolve']({'id':_0x193ae1['id'],'name':_0x193ae1['entry_list'][_0x5160('0x3f')][_0x5160('0x30')],'phone':_0x193ae1[_0x5160('0x39')]['phone_home'][_0x5160('0x30')]});});}});}function request(_0x4b7ee3){logger[_0x5160('0x40')](_0x5160('0x41'),JSON['stringify'](_0x4b7ee3));return rp(_[_0x5160('0x42')](def,_0x4b7ee3));}function getTags(_0x382555,_0x488015){var _0x55f396=[];if(_0x382555&&_0x382555[_0x5160('0x20')]>0x0){_0x55f396=_[_0x5160('0x43')](_0x382555,_0x488015);}return _0x55f396;}function getCustomFields(_0x14532c,_0x229da0){var _0x1a8d51=[];var _0x2faa5b={'custom_fields':[]};if(_0x14532c[_0x5160('0x20')]>0x0){_[_0x5160('0x44')](_0x14532c,function(_0x1e9c03){if(_0x1e9c03[_0x5160('0x45')]===_0x5160('0x46')&&_0x1e9c03[_0x5160('0x47')]&&!_0x1e9c03[_0x5160('0x48')]){_0x2faa5b[_0x1e9c03[_0x5160('0x47')][_0x5160('0x49')]()]=_0x1e9c03['content']['toString']();}else if(_0x1e9c03[_0x5160('0x45')]===_0x5160('0x46')&&_0x1e9c03[_0x5160('0x23')]&&_0x1e9c03[_0x5160('0x48')]){_0x2faa5b['custom_fields']['push']({'id':_0x1e9c03['idField'],'value':_0x1e9c03[_0x5160('0x4a')]['toString']()});}else if(_0x1e9c03[_0x5160('0x45')]===_0x5160('0x4b')&&_0x1e9c03[_0x5160('0x21')]&&_0x1e9c03[_0x5160('0x23')]&&_0x1e9c03[_0x5160('0x48')]){_0x229da0[_0x1e9c03[_0x5160('0x21')]]&&_0x2faa5b[_0x5160('0x4c')][_0x5160('0x22')]({'id':_0x1e9c03['idField'],'value':_0x229da0[_0x1e9c03[_0x5160('0x21')]]['toString']()});}else if(_0x1e9c03[_0x5160('0x45')]===_0x5160('0x4d')&&_0x1e9c03[_0x5160('0x4e')]&&_0x1e9c03[_0x5160('0x4e')]['name']&&_0x1e9c03['idField']&&_0x1e9c03[_0x5160('0x48')]){_0x229da0[_0x1e9c03[_0x5160('0x4e')]['name'][_0x5160('0x49')]()]&&_0x2faa5b[_0x5160('0x4c')][_0x5160('0x22')]({'id':_0x1e9c03[_0x5160('0x23')],'value':_0x229da0[_0x1e9c03['Variable']['name'][_0x5160('0x49')]()][_0x5160('0x28')]()});}});}return _0x2faa5b;}function getConnection(_0x43e713){return request({'method':_0x5160('0xb'),'form':{'method':_0x5160('0x4f'),'input_type':_0x5160('0x25'),'response_type':_0x5160('0x25'),'rest_data':JSON[_0x5160('0x26')]({'user_auth':{'user_name':_0x43e713[_0x5160('0x50')],'password':_0x43e713['password'],'encryption':'PLAIN'},'application':_0x5160('0x51')})}})['then'](function(_0x4ff5a2){var _0x3b801f=_0x4ff5a2;if(_0x3b801f['id']){def['sessionID']=_0x3b801f['id'];return BPromise[_0x5160('0x32')](_0x3b801f);}else{throw new Error(util[_0x5160('0x27')]('Account\x20%d\x20is\x20not\x20valid',_0x43e713['id']));}});}function setRelationship(_0x371f48,_0x410eca,_0x1052d7,_0x56f1a2){return request({'form':{'method':_0x5160('0x52'),'input_type':'JSON','response_type':_0x5160('0x25'),'rest_data':JSON[_0x5160('0x26')]({'session':_0x371f48['id'],'module_name':_0x5160('0x53'),'module_id':_0x1052d7['id'],'link_field_name':_0x56f1a2,'related_ids':[_0x410eca['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x528df0,_0x56497b,_0x50a5fa,_0x586944,_0x5396b6,_0x19dec1){var _0x417549,_0x2f69b5,_0x37c6a9,_0xc8f207;_0x19dec1[_0x5160('0x54')]=intUtil[_0x5160('0x55')](_0x19dec1[_0x5160('0x54')]);_0x19dec1[_0x5160('0x56')]=intUtil[_0x5160('0x55')](_0x19dec1['serverUrl']);def[_0x5160('0x57')]=util[_0x5160('0x27')](_0x5160('0x58'),_0x19dec1[_0x5160('0x54')]);if(_0x5396b6&&_0x5396b6['monitor_format']){logger['info'](_0x5160('0x59'),_0x5160('0x5a'));_0x56497b[_0x5160('0x5b')]=util[_0x5160('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x19dec1[_0x5160('0x56')],_0x56497b[_0x5160('0x5c')],md5(_0x56497b['uniqueid']));}else{_0x56497b[_0x5160('0x5b')]='';}return getConnection(_0x19dec1)['then'](function(_0x5a8397){_0xc8f207=_0x5a8397;return getUser(_0x19dec1,_0x586944[_0x5160('0x1e')],_0xc8f207);})[_0x5160('0x2c')](function(_0x1ddc07){_0x417549=_0x1ddc07;logger[_0x5160('0xd')](_0x5160('0x5d'),_0x417549['id']);return getEndUser(_0x19dec1,_0x56497b['calleridname'],_0x56497b[_0x5160('0x5e')],_0xc8f207);})[_0x5160('0x2c')](function(_0x5a3c28){_0x2f69b5=_0x5a3c28;logger[_0x5160('0xd')](_0x5160('0x5f'),_0x2f69b5['id']);return getTicket(_0x19dec1,_0x417549,_0x2f69b5,_0x50a5fa,_0x56497b,_0x50a5fa[_0x5160('0x60')],_0xc8f207,'Inbound');})[_0x5160('0x2c')](function(_0x144c7c){_0x37c6a9=_0x144c7c;logger['info']('Ticket\x20created!');logger[_0x5160('0xd')](_0x5160('0x61'),_0x37c6a9['id']);return setRelationship(_0xc8f207,_0x417549,_0x37c6a9,_0x5160('0x62'));})[_0x5160('0x2c')](function(){return setRelationship(_0xc8f207,_0x2f69b5,_0x37c6a9,_0x5160('0x63'));})[_0x5160('0x2c')](function(){return getServerInfo(_0xc8f207);})[_0x5160('0x2c')](function(_0x24f89f){var _0xd014dc=parseInt(_0x24f89f['version'][_0x5160('0x64')](0x0));var _0x24d4e6=util['format'](_0x5160('0x65'),_0x19dec1[_0x5160('0x54')],_0x37c6a9['id']);if(_0xd014dc>0x6){_0x24d4e6=util[_0x5160('0x27')](_0x5160('0x66'),_0x19dec1[_0x5160('0x54')],_0x37c6a9['id']);}logger[_0x5160('0xd')](_0x5160('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5160('0x27')](_0x5160('0x67'),_0x586944[_0x5160('0x1e')]),'trigger:browser:url',{'uri':_0x24d4e6});})['catch'](function(_0x6dc4b9){logger[_0x5160('0x68')](_0x5160('0x59'),JSON[_0x5160('0x26')](_0x6dc4b9));});};exports[_0x5160('0x69')]=function(_0x5ef6e5,_0x30df57,_0x243b45,_0x5626b7,_0x15a0d9,_0x2dbfa3,_0x2d7dc7){var _0x323ac3,_0x29a9c7,_0x18b4a2,_0x37c75e;_0x2dbfa3[_0x5160('0x54')]=intUtil[_0x5160('0x55')](_0x2dbfa3[_0x5160('0x54')]);_0x2dbfa3[_0x5160('0x56')]=intUtil[_0x5160('0x55')](_0x2dbfa3['serverUrl']);def[_0x5160('0x57')]=util[_0x5160('0x27')]('%s/service/v4_1/rest.php',_0x2dbfa3['remoteUri']);if(_0x2d7dc7&&_0x2d7dc7[_0x5160('0x6a')]&&_0x2d7dc7[_0x5160('0x6a')]!==_0x5160('0x6b')){logger[_0x5160('0xd')](_0x5160('0x6c'),_0x5160('0x5a'));_0x30df57[_0x5160('0x5b')]=util[_0x5160('0x27')](_0x5160('0x6d'),_0x2dbfa3['serverUrl'],_0x30df57['uniqueid'],md5(_0x30df57[_0x5160('0x5c')]));}return getConnection(_0x2dbfa3)[_0x5160('0x2c')](function(_0x5872df){_0x37c75e=_0x5872df;return getUser(_0x2dbfa3,_0x5626b7['name'],_0x37c75e);})[_0x5160('0x2c')](function(_0x173fb0){_0x323ac3=_0x173fb0;logger['info'](_0x5160('0x5d'),_0x323ac3['id']);return getEndUser(_0x2dbfa3,_0x30df57['destcalleridname'],_0x30df57[_0x5160('0x6e')],_0x37c75e);})[_0x5160('0x2c')](function(_0x5d04cc){_0x29a9c7=_0x5d04cc;logger[_0x5160('0xd')](_0x5160('0x5f'),_0x29a9c7['id']);return getTicket(_0x2dbfa3,_0x323ac3,_0x29a9c7,_0x243b45,_0x30df57,_0x243b45[_0x5160('0x60')],_0x37c75e,_0x5160('0x6f'));})[_0x5160('0x2c')](function(_0x330831){_0x18b4a2=_0x330831;logger[_0x5160('0xd')](_0x5160('0x70'));logger[_0x5160('0xd')](_0x5160('0x61'),_0x18b4a2['id']);return setRelationship(_0x37c75e,_0x323ac3,_0x18b4a2,'users');})[_0x5160('0x2c')](function(){return setRelationship(_0x37c75e,_0x29a9c7,_0x18b4a2,_0x5160('0x63'));})[_0x5160('0x2c')](function(){return getServerInfo(_0x37c75e);})[_0x5160('0x2c')](function(_0x5692f0){var _0x6cc95c=parseInt(_0x5692f0[_0x5160('0x71')][_0x5160('0x64')](0x0));var _0x2ec699=util[_0x5160('0x27')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2dbfa3[_0x5160('0x54')],_0x18b4a2['id']);if(_0x6cc95c>0x6){_0x2ec699=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2dbfa3['remoteUri'],_0x18b4a2['id']);}logger[_0x5160('0xd')](_0x5160('0x6c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5160('0x27')](_0x5160('0x67'),_0x5626b7[_0x5160('0x1e')]),_0x5160('0x72'),{'uri':_0x2ec699});})[_0x5160('0x73')](function(_0x127bea){logger[_0x5160('0x68')](_0x5160('0x6c'),JSON['stringify'](_0x127bea));});};exports[_0x5160('0x74')]=function(_0x4d048c,_0x47db52,_0x2e7279,_0x28248e,_0x2329f8,_0x170c3d){var _0x45ea80,_0x55b08e,_0x507cca,_0x488b08;_0x170c3d[_0x5160('0x54')]=intUtil[_0x5160('0x55')](_0x170c3d[_0x5160('0x54')]);_0x170c3d['serverUrl']=intUtil['stripTrailingSlash'](_0x170c3d[_0x5160('0x56')]);def[_0x5160('0x57')]=util[_0x5160('0x27')](_0x5160('0x58'),_0x170c3d[_0x5160('0x54')]);if(_0x2329f8&&_0x2329f8[_0x5160('0x75')]){logger['info']('['+_0x47db52[_0x5160('0x76')][_0x5160('0x77')]()+']',_0x5160('0x5a'));_0x47db52[_0x5160('0x5b')]=util[_0x5160('0x27')](_0x5160('0x6d'),_0x170c3d['serverUrl'],_0x47db52[_0x5160('0x5c')],md5(_0x47db52[_0x5160('0x5c')]));}else{_0x47db52[_0x5160('0x5b')]='';}return getConnection(_0x170c3d)[_0x5160('0x2c')](function(_0x4892b2){_0x488b08=_0x4892b2;if(!_['isNil'](_0x28248e)){return getUser(_0x170c3d,_0x28248e[_0x5160('0x1e')],_0x488b08);}else{return getUser(_0x170c3d,null,_0x488b08);}})[_0x5160('0x2c')](function(_0x1af8f6){_0x45ea80=_0x1af8f6;logger[_0x5160('0xd')](_0x5160('0x5d'),_0x45ea80['id']);return getEndUser(_0x170c3d,_0x47db52[_0x5160('0x78')],_0x47db52[_0x5160('0x5e')],_0x488b08);})[_0x5160('0x2c')](function(_0x384e47){_0x55b08e=_0x384e47;logger[_0x5160('0xd')](_0x5160('0x5f'),_0x55b08e['id']);return getTicket(_0x170c3d,_0x45ea80,_0x55b08e,_0x2e7279,_0x47db52,_0x2e7279['Fields'],_0x488b08,_0x5160('0x79'));})[_0x5160('0x2c')](function(_0xc519d8){_0x507cca=_0xc519d8;logger[_0x5160('0xd')](_0x5160('0x70'));logger[_0x5160('0xd')](_0x5160('0x61'),_0x507cca['id']);return setRelationship(_0x488b08,_0x45ea80,_0x507cca,_0x5160('0x62'));})[_0x5160('0x2c')](function(){return setRelationship(_0x488b08,_0x55b08e,_0x507cca,'contacts');})['then'](function(){return getServerInfo(_0x488b08);})[_0x5160('0x73')](function(_0x3e9a55){logger[_0x5160('0x68')]('['+_0x47db52[_0x5160('0x76')][_0x5160('0x77')]()+']',JSON['stringify'](_0x3e9a55));});}; \ No newline at end of file +var _0x3750=['calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','uri','recordingFormat','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','trigger:browser:url','lastevent','toUpperCase','calleridnum','lodash','request-promise','bluebird','md5','util','./util','../../../../config/logger','defaults','localhost','socket.io-emitter','redis','POST','getString','created_by','description','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','name','direction','length','variableName','push','idField','JSON','stringify','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','Agent\x20found!','resolve','value','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','Enduser\x20created.','debug','merge','forEach','string','customField','nameField','content','type','toString','variable','customVariable','Variable','toLowerCase','custom_fields','login','username','password','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3750,0x1f4));var _0x0375=function(_0x419c0c,_0x2598ad){_0x419c0c=_0x419c0c-0x0;var _0x391694=_0x3750[_0x419c0c];return _0x391694;};'use strict';var _=require(_0x0375('0x0'));var rp=require(_0x0375('0x1'));var BPromise=require(_0x0375('0x2'));var md5=require(_0x0375('0x3'));var util=require(_0x0375('0x4'));var Redis=require('ioredis');var intUtil=require(_0x0375('0x5'));var config=require('../../../../config/environment');var logger=require(_0x0375('0x6'))('sugarcrm');config['redis']=_[_0x0375('0x7')](config['redis'],{'host':_0x0375('0x8'),'port':0x18eb});var io=require(_0x0375('0x9'))(new Redis(config[_0x0375('0xa')]));var def={'method':_0x0375('0xb'),'json':!![]};function emit(_0xd7bf4e,_0x5620cf,_0x1a21b8){io['to'](_0xd7bf4e)['emit'](_0x5620cf,_0x1a21b8);}function getTicket(_0x32e136,_0x51ed50,_0x29a3ea,_0x308a5e,_0x306fa5,_0x95ddc4,_0x56894e,_0x13dbb7){logger['info']('Creating\x20new\x20ticket...');var _0x157956=new Date();var _0x501ebb=[{'name':'name','value':intUtil[_0x0375('0xc')](_0x308a5e['Subjects'],_0x306fa5,'\x20')},{'name':'assigned_user_id','value':_0x51ed50['id']},{'name':_0x0375('0xd'),'value':_0x51ed50['id']},{'name':_0x0375('0xe'),'value':intUtil[_0x0375('0xc')](_0x308a5e['Descriptions'],_0x306fa5,'\x0a')},{'name':_0x0375('0xf'),'value':_0x157956[_0x0375('0x10')]()[_0x0375('0x11')](0x0,0x13)[_0x0375('0x12')]('T','\x20')},{'name':_0x0375('0x13'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x0375('0x14'),'value':_0x29a3ea['id']},{'name':_0x0375('0x15'),'value':_0x0375('0x16')},{'name':_0x0375('0x17'),'value':_0x29a3ea[_0x0375('0x18')]},{'name':_0x0375('0x19'),'value':_0x13dbb7}];if(_0x95ddc4[_0x0375('0x1a')]){_['forEach'](_0x95ddc4,function(_0x40d0f3){if(_0x306fa5[_0x40d0f3[_0x0375('0x1b')]]){_0x501ebb[_0x0375('0x1c')]({'name':_0x40d0f3[_0x0375('0x1d')],'value':_0x306fa5[_0x40d0f3[_0x0375('0x1b')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x0375('0x1e'),'response_type':_0x0375('0x1e'),'rest_data':JSON[_0x0375('0x1f')]({'session':_0x56894e['id'],'module_name':'Calls','name_value_list':_0x501ebb})}});}function getAuth(_0x1b2e41){return util[_0x0375('0x20')](_0x0375('0x21'),new Buffer(_0x1b2e41[_0x0375('0x22')]+':X')['toString'](_0x0375('0x23')));}function getServerInfo(_0x1b9756){return request({'form':{'method':_0x0375('0x24'),'input_type':_0x0375('0x1e'),'response_type':_0x0375('0x1e'),'rest_data':JSON[_0x0375('0x1f')]({'session':_0x1b9756['id']})}});}function getUser(_0x359c2f,_0x1b13d8,_0xde1308){if(!_[_0x0375('0x25')](_0x1b13d8)){logger[_0x0375('0x26')](_0x0375('0x27'),_0x1b13d8);return request({'form':{'method':_0x0375('0x28'),'input_type':_0x0375('0x1e'),'response_type':_0x0375('0x1e'),'rest_data':JSON[_0x0375('0x1f')]({'session':_0xde1308['id'],'module_name':'Employees','query':util[_0x0375('0x20')](_0x0375('0x29'),_0x1b13d8),'order_by':'','offset':'0','select_fields':['id',_0x0375('0x18'),_0x0375('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0375('0x2b')](function(_0x51a3c5){if(_0x51a3c5[_0x0375('0x2c')][_0x0375('0x1a')]){var _0x27f97c=_['find'](_0x51a3c5[_0x0375('0x2c')],function(_0x25feea){return _0x25feea[_0x0375('0x2d')]['user_name']['value']===_0x1b13d8;});if(_0x27f97c){logger[_0x0375('0x26')](_0x0375('0x2e'));return BPromise[_0x0375('0x2f')]({'id':_0x27f97c['name_value_list']['id'][_0x0375('0x30')],'name':_0x27f97c[_0x0375('0x2d')][_0x0375('0x18')][_0x0375('0x30')]});}}logger[_0x0375('0x26')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x0375('0x2f')]({'id':_0xde1308[_0x0375('0x2d')][_0x0375('0x31')]['value'],'name':_0xde1308[_0x0375('0x2d')][_0x0375('0x2a')][_0x0375('0x30')]});});}else{logger['info'](_0x0375('0x32'));return BPromise[_0x0375('0x2f')]({'id':_0xde1308[_0x0375('0x2d')][_0x0375('0x31')][_0x0375('0x30')],'name':_0xde1308[_0x0375('0x2d')]['user_name'][_0x0375('0x30')]});}}function getEndUser(_0x3102e8,_0x546506,_0x425954,_0x15ee11){logger[_0x0375('0x26')](_0x0375('0x33'),_0x425954);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x0375('0x1e'),'rest_data':JSON[_0x0375('0x1f')]({'session':_0x15ee11['id'],'module_name':_0x0375('0x16'),'query':util[_0x0375('0x20')](_0x0375('0x34'),_0x425954),'order_by':'','offset':'0','select_fields':['id',_0x0375('0x18'),_0x0375('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3f36e6){if(_0x3f36e6['entry_list']['length']){var _0x392f50=_[_0x0375('0x36')](_0x3f36e6[_0x0375('0x2c')],function(_0x5494db){return _0x5494db[_0x0375('0x2d')][_0x0375('0x35')]['value']===_0x425954;});if(_0x392f50){logger[_0x0375('0x26')](_0x0375('0x37'));return BPromise[_0x0375('0x2f')]({'id':_0x392f50[_0x0375('0x2d')]['id'][_0x0375('0x30')],'name':_0x392f50[_0x0375('0x2d')][_0x0375('0x18')][_0x0375('0x30')],'phone':_0x392f50['name_value_list'][_0x0375('0x35')][_0x0375('0x30')]});}}else{logger[_0x0375('0x26')](_0x0375('0x38'));return request({'form':{'method':_0x0375('0x39'),'input_type':_0x0375('0x1e'),'response_type':_0x0375('0x1e'),'rest_data':JSON[_0x0375('0x1f')]({'session':_0x15ee11['id'],'module_name':'Contacts','name_value_list':[{'name':_0x0375('0x3a'),'value':_0x546506!==''?_0x546506:util[_0x0375('0x20')]('Caller\x20-\x20%s',_0x425954)},{'name':_0x0375('0x35'),'value':_0x425954}]})}})[_0x0375('0x2b')](function(_0x26bf54){logger['info'](_0x0375('0x3b'));return BPromise[_0x0375('0x2f')]({'id':_0x26bf54['id'],'name':_0x26bf54[_0x0375('0x2c')]['first_name'][_0x0375('0x30')],'phone':_0x26bf54['entry_list'][_0x0375('0x35')][_0x0375('0x30')]});});}});}function request(_0x1e5dfc){logger[_0x0375('0x3c')]('[HTTP]',JSON[_0x0375('0x1f')](_0x1e5dfc));return rp(_[_0x0375('0x3d')](def,_0x1e5dfc));}function getTags(_0x5861ec,_0x207d9f){var _0x531148=[];if(_0x5861ec&&_0x5861ec['length']>0x0){_0x531148=_['map'](_0x5861ec,_0x207d9f);}return _0x531148;}function getCustomFields(_0x3f22a8,_0x3ade9b){var _0x369ec2=[];var _0x5846fe={'custom_fields':[]};if(_0x3f22a8['length']>0x0){_[_0x0375('0x3e')](_0x3f22a8,function(_0x4beadb){if(_0x4beadb['type']===_0x0375('0x3f')&&_0x4beadb['nameField']&&!_0x4beadb[_0x0375('0x40')]){_0x5846fe[_0x4beadb[_0x0375('0x41')]['toLowerCase']()]=_0x4beadb[_0x0375('0x42')]['toString']();}else if(_0x4beadb[_0x0375('0x43')]===_0x0375('0x3f')&&_0x4beadb['idField']&&_0x4beadb['customField']){_0x5846fe['custom_fields']['push']({'id':_0x4beadb[_0x0375('0x1d')],'value':_0x4beadb[_0x0375('0x42')][_0x0375('0x44')]()});}else if(_0x4beadb[_0x0375('0x43')]===_0x0375('0x45')&&_0x4beadb[_0x0375('0x1b')]&&_0x4beadb[_0x0375('0x1d')]&&_0x4beadb['customField']){_0x3ade9b[_0x4beadb[_0x0375('0x1b')]]&&_0x5846fe['custom_fields'][_0x0375('0x1c')]({'id':_0x4beadb['idField'],'value':_0x3ade9b[_0x4beadb[_0x0375('0x1b')]][_0x0375('0x44')]()});}else if(_0x4beadb[_0x0375('0x43')]===_0x0375('0x46')&&_0x4beadb['Variable']&&_0x4beadb[_0x0375('0x47')][_0x0375('0x18')]&&_0x4beadb[_0x0375('0x1d')]&&_0x4beadb[_0x0375('0x40')]){_0x3ade9b[_0x4beadb[_0x0375('0x47')]['name'][_0x0375('0x48')]()]&&_0x5846fe[_0x0375('0x49')][_0x0375('0x1c')]({'id':_0x4beadb[_0x0375('0x1d')],'value':_0x3ade9b[_0x4beadb[_0x0375('0x47')][_0x0375('0x18')][_0x0375('0x48')]()]['toString']()});}});}return _0x5846fe;}function getConnection(_0x2168eb){return request({'method':_0x0375('0xb'),'form':{'method':_0x0375('0x4a'),'input_type':_0x0375('0x1e'),'response_type':_0x0375('0x1e'),'rest_data':JSON[_0x0375('0x1f')]({'user_auth':{'user_name':_0x2168eb[_0x0375('0x4b')],'password':_0x2168eb[_0x0375('0x4c')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x324305){var _0x56da90=_0x324305;if(_0x56da90['id']){def[_0x0375('0x4d')]=_0x56da90['id'];return BPromise[_0x0375('0x2f')](_0x56da90);}else{throw new Error(util['format'](_0x0375('0x4e'),_0x2168eb['id']));}});}function setRelationship(_0x1d064f,_0x1f867e,_0x34806b,_0x3ddc8b){return request({'form':{'method':_0x0375('0x4f'),'input_type':_0x0375('0x1e'),'response_type':'JSON','rest_data':JSON[_0x0375('0x1f')]({'session':_0x1d064f['id'],'module_name':_0x0375('0x50'),'module_id':_0x34806b['id'],'link_field_name':_0x3ddc8b,'related_ids':[_0x1f867e['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x11894f,_0xfca372,_0x579cb1,_0x32b345,_0x6cfab3,_0x4aa764){var _0x4de55d,_0x22b39b,_0x2f0d31,_0x41ce0d;_0x4aa764[_0x0375('0x51')]=intUtil[_0x0375('0x52')](_0x4aa764[_0x0375('0x51')]);_0x4aa764[_0x0375('0x53')]=intUtil[_0x0375('0x52')](_0x4aa764[_0x0375('0x53')]);def['uri']=util[_0x0375('0x20')](_0x0375('0x54'),_0x4aa764['remoteUri']);if(_0x6cfab3&&_0x6cfab3[_0x0375('0x55')]){logger[_0x0375('0x26')]('[QUEUE]',_0x0375('0x56'));_0xfca372[_0x0375('0x57')]=util['format'](_0x0375('0x58'),_0x4aa764[_0x0375('0x53')],_0xfca372[_0x0375('0x59')],md5(_0xfca372[_0x0375('0x59')]));}else{_0xfca372['recordingURL']='';}return getConnection(_0x4aa764)['then'](function(_0x43a8a0){_0x41ce0d=_0x43a8a0;return getUser(_0x4aa764,_0x32b345[_0x0375('0x18')],_0x41ce0d);})['then'](function(_0x5dab6c){_0x4de55d=_0x5dab6c;logger[_0x0375('0x26')]('The\x20User\x20ID\x20is:',_0x4de55d['id']);return getEndUser(_0x4aa764,_0xfca372[_0x0375('0x5a')],_0xfca372['calleridnum'],_0x41ce0d);})[_0x0375('0x2b')](function(_0x2ee88d){_0x22b39b=_0x2ee88d;logger[_0x0375('0x26')](_0x0375('0x5b'),_0x22b39b['id']);return getTicket(_0x4aa764,_0x4de55d,_0x22b39b,_0x579cb1,_0xfca372,_0x579cb1[_0x0375('0x5c')],_0x41ce0d,_0x0375('0x5d'));})[_0x0375('0x2b')](function(_0x129e9c){_0x2f0d31=_0x129e9c;logger[_0x0375('0x26')](_0x0375('0x5e'));logger[_0x0375('0x26')](_0x0375('0x5f'),_0x2f0d31['id']);return setRelationship(_0x41ce0d,_0x4de55d,_0x2f0d31,'users');})['then'](function(){return setRelationship(_0x41ce0d,_0x22b39b,_0x2f0d31,_0x0375('0x60'));})[_0x0375('0x2b')](function(){return getServerInfo(_0x41ce0d);})[_0x0375('0x2b')](function(_0x101b48){var _0x5e65b6=parseInt(_0x101b48[_0x0375('0x61')][_0x0375('0x62')](0x0));var _0x49d36e=util['format'](_0x0375('0x63'),_0x4aa764[_0x0375('0x51')],_0x2f0d31['id']);if(_0x5e65b6>0x6){_0x49d36e=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4aa764[_0x0375('0x51')],_0x2f0d31['id']);}logger[_0x0375('0x26')](_0x0375('0x64'),_0x0375('0x65'));emit(util[_0x0375('0x20')](_0x0375('0x66'),_0x32b345[_0x0375('0x18')]),'trigger:browser:url',{'uri':_0x49d36e});})[_0x0375('0x67')](function(_0x2f37e0){logger[_0x0375('0x68')](_0x0375('0x64'),JSON[_0x0375('0x1f')](_0x2f37e0));});};exports[_0x0375('0x69')]=function(_0x459c6a,_0x2295fd,_0xf3f0bf,_0x968b48,_0x38d1ca,_0x52d605,_0x5913fc){var _0x1cf460,_0x36e5d8,_0x3b6174,_0x32d17a;_0x52d605['remoteUri']=intUtil['stripTrailingSlash'](_0x52d605[_0x0375('0x51')]);_0x52d605[_0x0375('0x53')]=intUtil[_0x0375('0x52')](_0x52d605['serverUrl']);def[_0x0375('0x6a')]=util[_0x0375('0x20')](_0x0375('0x54'),_0x52d605[_0x0375('0x51')]);if(_0x5913fc&&_0x5913fc[_0x0375('0x6b')]&&_0x5913fc[_0x0375('0x6b')]!=='none'){logger['info']('[OUTBOUND]',_0x0375('0x56'));_0x2295fd[_0x0375('0x57')]=util[_0x0375('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x52d605['serverUrl'],_0x2295fd['uniqueid'],md5(_0x2295fd[_0x0375('0x59')]));}return getConnection(_0x52d605)[_0x0375('0x2b')](function(_0x23e615){_0x32d17a=_0x23e615;return getUser(_0x52d605,_0x968b48[_0x0375('0x18')],_0x32d17a);})['then'](function(_0x501abc){_0x1cf460=_0x501abc;logger['info'](_0x0375('0x6c'),_0x1cf460['id']);return getEndUser(_0x52d605,_0x2295fd['destcalleridname'],_0x2295fd[_0x0375('0x6d')],_0x32d17a);})[_0x0375('0x2b')](function(_0x3540a6){_0x36e5d8=_0x3540a6;logger[_0x0375('0x26')](_0x0375('0x5b'),_0x36e5d8['id']);return getTicket(_0x52d605,_0x1cf460,_0x36e5d8,_0xf3f0bf,_0x2295fd,_0xf3f0bf['Fields'],_0x32d17a,_0x0375('0x6e'));})[_0x0375('0x2b')](function(_0x15c312){_0x3b6174=_0x15c312;logger[_0x0375('0x26')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x3b6174['id']);return setRelationship(_0x32d17a,_0x1cf460,_0x3b6174,_0x0375('0x6f'));})['then'](function(){return setRelationship(_0x32d17a,_0x36e5d8,_0x3b6174,_0x0375('0x60'));})[_0x0375('0x2b')](function(){return getServerInfo(_0x32d17a);})[_0x0375('0x2b')](function(_0x393850){var _0x208fca=parseInt(_0x393850[_0x0375('0x61')]['charAt'](0x0));var _0x36f00a=util['format'](_0x0375('0x63'),_0x52d605[_0x0375('0x51')],_0x3b6174['id']);if(_0x208fca>0x6){_0x36f00a=util[_0x0375('0x20')](_0x0375('0x70'),_0x52d605[_0x0375('0x51')],_0x3b6174['id']);}logger[_0x0375('0x26')](_0x0375('0x71'),_0x0375('0x65'));emit(util[_0x0375('0x20')](_0x0375('0x66'),_0x968b48[_0x0375('0x18')]),_0x0375('0x72'),{'uri':_0x36f00a});})[_0x0375('0x67')](function(_0x317775){logger[_0x0375('0x68')](_0x0375('0x71'),JSON[_0x0375('0x1f')](_0x317775));});};exports['unmanaged']=function(_0x2d974b,_0x29f8f6,_0x4a510b,_0x15cdd6,_0x124ae4,_0x439913){var _0x48e72e,_0x5f4f23,_0x5a4fdf,_0x15cd08;_0x439913[_0x0375('0x51')]=intUtil[_0x0375('0x52')](_0x439913[_0x0375('0x51')]);_0x439913[_0x0375('0x53')]=intUtil[_0x0375('0x52')](_0x439913[_0x0375('0x53')]);def['uri']=util['format'](_0x0375('0x54'),_0x439913['remoteUri']);if(_0x124ae4&&_0x124ae4[_0x0375('0x55')]){logger['info']('['+_0x29f8f6[_0x0375('0x73')][_0x0375('0x74')]()+']',_0x0375('0x56'));_0x29f8f6[_0x0375('0x57')]=util[_0x0375('0x20')](_0x0375('0x58'),_0x439913[_0x0375('0x53')],_0x29f8f6[_0x0375('0x59')],md5(_0x29f8f6[_0x0375('0x59')]));}else{_0x29f8f6[_0x0375('0x57')]='';}return getConnection(_0x439913)['then'](function(_0x18cca6){_0x15cd08=_0x18cca6;if(!_['isNil'](_0x15cdd6)){return getUser(_0x439913,_0x15cdd6['name'],_0x15cd08);}else{return getUser(_0x439913,null,_0x15cd08);}})[_0x0375('0x2b')](function(_0x3b4ae4){_0x48e72e=_0x3b4ae4;logger[_0x0375('0x26')](_0x0375('0x6c'),_0x48e72e['id']);return getEndUser(_0x439913,_0x29f8f6['calleridname'],_0x29f8f6[_0x0375('0x75')],_0x15cd08);})[_0x0375('0x2b')](function(_0x46b647){_0x5f4f23=_0x46b647;logger[_0x0375('0x26')](_0x0375('0x5b'),_0x5f4f23['id']);return getTicket(_0x439913,_0x48e72e,_0x5f4f23,_0x4a510b,_0x29f8f6,_0x4a510b['Fields'],_0x15cd08,_0x0375('0x5d'));})[_0x0375('0x2b')](function(_0x31a933){_0x5a4fdf=_0x31a933;logger[_0x0375('0x26')](_0x0375('0x5e'));logger[_0x0375('0x26')]('The\x20Ticket\x20ID\x20is:',_0x5a4fdf['id']);return setRelationship(_0x15cd08,_0x48e72e,_0x5a4fdf,_0x0375('0x6f'));})[_0x0375('0x2b')](function(){return setRelationship(_0x15cd08,_0x5f4f23,_0x5a4fdf,_0x0375('0x60'));})['then'](function(){return getServerInfo(_0x15cd08);})[_0x0375('0x67')](function(_0x1e2fb9){logger[_0x0375('0x68')]('['+_0x29f8f6[_0x0375('0x73')][_0x0375('0x74')]()+']',JSON[_0x0375('0x1f')](_0x1e2fb9));});}; \ 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 4f6e7da..bcfcdd0 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 _0x4953=['%s:\x20%s','keyContent','keyType','join','stripTrailingSlash','substring','validateEmail','test','lodash','util','length','string','content','variableName','push','toString','customVariable','Variable','name','toLowerCase','type','keyValue','key','format'];(function(_0x4903d8,_0x27bd10){var _0x381e19=function(_0x4e0bdd){while(--_0x4e0bdd){_0x4903d8['push'](_0x4903d8['shift']());}};_0x381e19(++_0x27bd10);}(_0x4953,0x158));var _0x3495=function(_0x93d815,_0x181c04){_0x93d815=_0x93d815-0x0;var _0x3eb590=_0x4953[_0x93d815];return _0x3eb590;};'use strict';var _=require(_0x3495('0x0'));var util=require(_0x3495('0x1'));exports['getString']=function(_0xd8a2da,_0x38d5e0,_0x362e48){var _0x193106=[];if(_0xd8a2da[_0x3495('0x2')]>0x0){var _0xca97ba=_['sortBy'](_0xd8a2da,['id']);for(var _0x462b63=0x0;_0x462b63<_0xca97ba[_0x3495('0x2')];_0x462b63++){var _0x233251=_0xca97ba[_0x462b63];if(_0x233251['type']===_0x3495('0x3')){_0x193106['push'](_0x233251[_0x3495('0x4')]);}else if(_0x233251['type']==='variable'&&_0x233251['variableName']){_0x38d5e0[_0x233251[_0x3495('0x5')]]&&_0x193106[_0x3495('0x6')](_0x38d5e0[_0x233251[_0x3495('0x5')]][_0x3495('0x7')]());}else if(_0x233251['type']===_0x3495('0x8')&&_0x233251[_0x3495('0x9')]&&_0x233251[_0x3495('0x9')]['name']){_0x38d5e0[_0x233251[_0x3495('0x9')][_0x3495('0xa')][_0x3495('0xb')]()]&&_0x193106[_0x3495('0x6')](_0x38d5e0[_0x233251[_0x3495('0x9')][_0x3495('0xa')][_0x3495('0xb')]()][_0x3495('0x7')]());}else if(_0x233251[_0x3495('0xc')]===_0x3495('0xd')){if(_0x233251['keyType']===_0x3495('0x3')&&_0x233251[_0x3495('0xe')]){_0x193106[_0x3495('0x6')](util[_0x3495('0xf')](_0x3495('0x10'),_0x233251[_0x3495('0xe')],_0x233251[_0x3495('0x11')]));}else if(_0x233251[_0x3495('0x12')]==='variable'&&_0x233251[_0x3495('0x5')]&&_0x233251[_0x3495('0xe')]){_0x38d5e0[_0x233251[_0x3495('0x5')]]&&_0x193106[_0x3495('0x6')](util['format'](_0x3495('0x10'),_0x233251[_0x3495('0xe')],_0x38d5e0[_0x233251['variableName']]));}else if(_0x233251[_0x3495('0x12')]===_0x3495('0x8')&&_0x233251['Variable']&&_0x233251[_0x3495('0x9')][_0x3495('0xa')]&&_0x233251['key']){_0x38d5e0[_0x233251[_0x3495('0x9')][_0x3495('0xa')][_0x3495('0xb')]()]&&_0x193106[_0x3495('0x6')](util[_0x3495('0xf')](_0x3495('0x10'),_0x233251['key'],_0x38d5e0[_0x233251[_0x3495('0x9')][_0x3495('0xa')]['toLowerCase']()]));}}}}return _0x193106[_0x3495('0x13')](_0x362e48);};exports[_0x3495('0x14')]=function(_0x2952ae){var _0x1985d9=_0x2952ae['slice'](-0x1);if(_0x1985d9==='/'){_0x2952ae=_0x2952ae[_0x3495('0x15')](0x0,_0x2952ae['lastIndexOf'](_0x1985d9));}return _0x2952ae;};exports[_0x3495('0x16')]=function(_0xf1276b){if(!_['isNil'](_0xf1276b)&&_0xf1276b!==''){var _0x6082c4=/^(([^<>()\[\]\\.,;:\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 _0x6082c4[_0x3495('0x17')](String(_0xf1276b)[_0x3495('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x1eff=['substring','validateEmail','test','getString','sortBy','type','string','push','content','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s','keyContent','customVariable','join','slice'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x1eff,0x1a1));var _0xf1ef=function(_0x488238,_0x50c7c1){_0x488238=_0x488238-0x0;var _0x5ae48e=_0x1eff[_0x488238];return _0x5ae48e;};'use strict';var _=require('lodash');var util=require('util');exports[_0xf1ef('0x0')]=function(_0x508105,_0x5e7895,_0x224132){var _0x4a1cc4=[];if(_0x508105['length']>0x0){var _0x3ca9a3=_[_0xf1ef('0x1')](_0x508105,['id']);for(var _0x43f3e0=0x0;_0x43f3e0<_0x3ca9a3['length'];_0x43f3e0++){var _0x572a8b=_0x3ca9a3[_0x43f3e0];if(_0x572a8b[_0xf1ef('0x2')]===_0xf1ef('0x3')){_0x4a1cc4[_0xf1ef('0x4')](_0x572a8b[_0xf1ef('0x5')]);}else if(_0x572a8b[_0xf1ef('0x2')]===_0xf1ef('0x6')&&_0x572a8b[_0xf1ef('0x7')]){_0x5e7895[_0x572a8b['variableName']]&&_0x4a1cc4[_0xf1ef('0x4')](_0x5e7895[_0x572a8b[_0xf1ef('0x7')]][_0xf1ef('0x8')]());}else if(_0x572a8b[_0xf1ef('0x2')]==='customVariable'&&_0x572a8b[_0xf1ef('0x9')]&&_0x572a8b[_0xf1ef('0x9')][_0xf1ef('0xa')]){_0x5e7895[_0x572a8b[_0xf1ef('0x9')][_0xf1ef('0xa')][_0xf1ef('0xb')]()]&&_0x4a1cc4['push'](_0x5e7895[_0x572a8b[_0xf1ef('0x9')][_0xf1ef('0xa')][_0xf1ef('0xb')]()][_0xf1ef('0x8')]());}else if(_0x572a8b['type']===_0xf1ef('0xc')){if(_0x572a8b[_0xf1ef('0xd')]===_0xf1ef('0x3')&&_0x572a8b[_0xf1ef('0xe')]){_0x4a1cc4[_0xf1ef('0x4')](util['format'](_0xf1ef('0xf'),_0x572a8b[_0xf1ef('0xe')],_0x572a8b[_0xf1ef('0x10')]));}else if(_0x572a8b[_0xf1ef('0xd')]===_0xf1ef('0x6')&&_0x572a8b[_0xf1ef('0x7')]&&_0x572a8b[_0xf1ef('0xe')]){_0x5e7895[_0x572a8b[_0xf1ef('0x7')]]&&_0x4a1cc4[_0xf1ef('0x4')](util['format'](_0xf1ef('0xf'),_0x572a8b[_0xf1ef('0xe')],_0x5e7895[_0x572a8b[_0xf1ef('0x7')]]));}else if(_0x572a8b[_0xf1ef('0xd')]===_0xf1ef('0x11')&&_0x572a8b[_0xf1ef('0x9')]&&_0x572a8b[_0xf1ef('0x9')][_0xf1ef('0xa')]&&_0x572a8b[_0xf1ef('0xe')]){_0x5e7895[_0x572a8b[_0xf1ef('0x9')][_0xf1ef('0xa')][_0xf1ef('0xb')]()]&&_0x4a1cc4[_0xf1ef('0x4')](util['format'](_0xf1ef('0xf'),_0x572a8b[_0xf1ef('0xe')],_0x5e7895[_0x572a8b[_0xf1ef('0x9')][_0xf1ef('0xa')][_0xf1ef('0xb')]()]));}}}}return _0x4a1cc4[_0xf1ef('0x12')](_0x224132);};exports['stripTrailingSlash']=function(_0x37a20b){var _0x34fc7b=_0x37a20b[_0xf1ef('0x13')](-0x1);if(_0x34fc7b==='/'){_0x37a20b=_0x37a20b[_0xf1ef('0x14')](0x0,_0x37a20b['lastIndexOf'](_0x34fc7b));}return _0x37a20b;};exports[_0xf1ef('0x15')]=function(_0x25f8a6){if(!_['isNil'](_0x25f8a6)&&_0x25f8a6!==''){var _0x31be01=/^(([^<>()\[\]\\.,;:\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 _0x31be01[_0xf1ef('0x16')](String(_0x25f8a6)[_0xf1ef('0xb')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 0bbd98e..f78450b 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x23327c,_0x47ee3b){var _0x4d1111=function(_0x32bdae){while(--_0x32bdae){_0x23327c['push'](_0x23327c['shift']());}};_0x4d1111(++_0x47ee3b);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x1076b3,_0x619f9c){var _0x5bb848=function(_0x1e3572){while(--_0x1e3572){_0x1076b3['push'](_0x1076b3['shift']());}};_0x5bb848(++_0x619f9c);}(_0x34e8,0x12c));var _0x834e=function(_0x29aef6,_0x460596){_0x29aef6=_0x29aef6-0x0;var _0x2bc5ea=_0x34e8[_0x29aef6];return _0x2bc5ea;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 5d1e766..c872f5b 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 _0xb029=['push','variable','variableName','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','none','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','catch','\x20Error\x20running\x20Zendesk\x20integration','lodash','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','getString','Subjects','Fields','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','then','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','idField','custom_fields'];(function(_0x567539,_0xd7c7a8){var _0xbbcd0d=function(_0x2da317){while(--_0x2da317){_0x567539['push'](_0x567539['shift']());}};_0xbbcd0d(++_0xd7c7a8);}(_0xb029,0x10b));var _0x9b02=function(_0x5c30a3,_0x2b165e){_0x5c30a3=_0x5c30a3-0x0;var _0x341d09=_0xb029[_0x5c30a3];return _0x341d09;};'use strict';var _=require(_0x9b02('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var Redis=require(_0x9b02('0x1'));var intUtil=require(_0x9b02('0x2'));var config=require(_0x9b02('0x3'));var logger=require('../../../../config/logger')(_0x9b02('0x4'));config[_0x9b02('0x5')]=_[_0x9b02('0x6')](config[_0x9b02('0x5')],{'host':_0x9b02('0x7'),'port':0x18eb});var io=require(_0x9b02('0x8'))(new Redis(config[_0x9b02('0x5')]));function emit(_0x22449c,_0x1074fd,_0x99fa8){io['to'](_0x22449c)[_0x9b02('0x9')](_0x1074fd,_0x99fa8);}var headers={'Content-Type':_0x9b02('0xa'),'Accept':_0x9b02('0xa')};function getTicket(_0x1d03d8,_0x4b3709,_0x35cca2,_0x1b2ed4,_0x3f36d6){logger[_0x9b02('0xb')](_0x9b02('0xc'));return request({'uri':util[_0x9b02('0xd')](_0x9b02('0xe'),_0x1d03d8[_0x9b02('0xf')]),'method':_0x9b02('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x35cca2['id'],'submitter_id':_0x4b3709?_0x4b3709['id']:undefined,'assignee_id':_0x4b3709?_0x4b3709['id']:undefined,'tags':getTags(_0x1b2ed4[_0x9b02('0x11')],'name'),'subject':intUtil[_0x9b02('0x12')](_0x1b2ed4[_0x9b02('0x13')],_0x3f36d6,'\x20'),'description':intUtil['getString'](_0x1b2ed4['Descriptions'],_0x3f36d6,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x1b2ed4['Descriptions'],_0x3f36d6,'\x0a')}},getCustomFields(_0x1b2ed4[_0x9b02('0x14')],_0x3f36d6))}})['then'](function(_0x3f4f11){logger[_0x9b02('0xb')]('Ticket\x20created!');return _0x3f4f11['ticket'];});}function getUser(_0xeaa22f,_0x405a5f){if(intUtil[_0x9b02('0x15')](_0x405a5f)){logger[_0x9b02('0xb')](_0x9b02('0x16'),_0x405a5f);return request({'uri':util[_0x9b02('0xd')](_0x9b02('0x17'),_0xeaa22f['remoteUri']),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x405a5f)}})[_0x9b02('0x18')](function(_0x47b88b){if(_0x47b88b[_0x9b02('0x19')]){logger[_0x9b02('0xb')](_0x9b02('0x1a'));return _[_0x9b02('0x1b')](_0x47b88b[_0x9b02('0x1c')],{'email':_0x405a5f,'role':_0x9b02('0x1d')});}else{logger[_0x9b02('0xb')](_0x9b02('0x1e'));return request({'uri':util[_0x9b02('0xd')]('%s/users/me.json',_0xeaa22f['remoteUri'])})[_0x9b02('0x18')](function(_0x59b1f3){logger['info']('Admin\x20account\x20selected.');return _0x59b1f3[_0x9b02('0x1f')];});}});}else{logger[_0x9b02('0xb')](_0x9b02('0x1e'));return request({'uri':util[_0x9b02('0xd')]('%s/users/me.json',_0xeaa22f[_0x9b02('0xf')])})['then'](function(_0x46f1b1){logger[_0x9b02('0xb')](_0x9b02('0x20'));return _0x46f1b1[_0x9b02('0x1f')];});}}function getEndUser(_0x2c43e1,_0x606f1e,_0x407dc9){logger[_0x9b02('0xb')](_0x9b02('0x21'),_0x407dc9);return request({'uri':util[_0x9b02('0xd')]('%s/search.json',_0x2c43e1[_0x9b02('0xf')]),'qs':{'query':util[_0x9b02('0xd')](_0x9b02('0x22'),_0x407dc9)}})[_0x9b02('0x18')](function(_0x234709){var _0x2913b6;if(_0x234709['results'][_0x9b02('0x23')]){_0x234709[_0x9b02('0x1c')]=_[_0x9b02('0x24')](_0x234709[_0x9b02('0x1c')],{'suspended':![],'role':_0x9b02('0x25')});if(_0x234709[_0x9b02('0x1c')][_0x9b02('0x23')]){_0x2913b6=_[_0x9b02('0x26')](_0x234709[_0x9b02('0x1c')]);}}if(_0x2913b6){logger['info'](_0x9b02('0x27'));return _0x2913b6;}else{logger[_0x9b02('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x9b02('0xd')](_0x9b02('0x28'),_0x2c43e1[_0x9b02('0xf')]),'method':_0x9b02('0x10'),'body':{'user':{'role':'end-user','name':util['format'](_0x9b02('0x29'),_0x606f1e||_0x407dc9),'phone':_0x407dc9}}})['then'](function(_0x4c99b9){logger[_0x9b02('0xb')](_0x9b02('0x2a'));return _0x4c99b9[_0x9b02('0x1f')];});}});}function getAuth(_0x463436){var _0x2de5b4;if(_0x463436[_0x9b02('0x2b')]==='password'){_0x2de5b4=util['format'](_0x9b02('0x2c'),_0x463436[_0x9b02('0x2d')],_0x463436[_0x9b02('0x2e')]);}else if(_0x463436[_0x9b02('0x2b')]===_0x9b02('0x2f')){_0x2de5b4=util[_0x9b02('0xd')](_0x9b02('0x30'),_0x463436[_0x9b02('0x2d')],_0x463436[_0x9b02('0x2f')]);}return util['format'](_0x9b02('0x31'),new Buffer(_0x2de5b4)[_0x9b02('0x32')](_0x9b02('0x33')));}function request(_0x1c6b7f){logger[_0x9b02('0x34')](_0x9b02('0x35'),JSON[_0x9b02('0x36')](_0x1c6b7f));return rp(_[_0x9b02('0x6')](_0x1c6b7f,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2e4e18,_0x1fb389){var _0x4e6a34=[];if(_0x2e4e18&&_0x2e4e18[_0x9b02('0x23')]>0x0){_0x4e6a34=_['map'](_0x2e4e18,_0x1fb389);}return _0x4e6a34;}function getCustomFields(_0x3e9901,_0x1f794b){var _0x82880e=[];var _0x472a79={'custom_fields':[]};if(_0x3e9901[_0x9b02('0x23')]>0x0){_[_0x9b02('0x37')](_0x3e9901,function(_0x16ab4f){if(_[_0x9b02('0x38')]([_0x9b02('0x39'),_0x9b02('0x3a')],_0x16ab4f['type'])&&_0x16ab4f[_0x9b02('0x3b')]&&!_0x16ab4f[_0x9b02('0x3c')]){_0x472a79[_0x16ab4f[_0x9b02('0x3b')][_0x9b02('0x3d')]()]=_0x16ab4f[_0x9b02('0x3e')][_0x9b02('0x32')]();}else if(_[_0x9b02('0x38')]([_0x9b02('0x39'),_0x9b02('0x3a')],_0x16ab4f[_0x9b02('0x3f')])&&_0x16ab4f[_0x9b02('0x40')]&&_0x16ab4f[_0x9b02('0x3c')]){_0x472a79[_0x9b02('0x41')][_0x9b02('0x42')]({'id':_0x16ab4f[_0x9b02('0x40')],'value':_0x16ab4f['content'][_0x9b02('0x32')]()});}else if(_0x16ab4f[_0x9b02('0x3f')]===_0x9b02('0x43')&&_0x16ab4f[_0x9b02('0x44')]&&_0x16ab4f[_0x9b02('0x40')]&&_0x16ab4f[_0x9b02('0x3c')]){_0x1f794b[_0x16ab4f[_0x9b02('0x44')]]&&_0x472a79[_0x9b02('0x41')][_0x9b02('0x42')]({'id':_0x16ab4f[_0x9b02('0x40')],'value':_0x1f794b[_0x16ab4f[_0x9b02('0x44')]][_0x9b02('0x32')]()});}else if(_0x16ab4f[_0x9b02('0x3f')]==='customVariable'&&_0x16ab4f[_0x9b02('0x45')]&&_0x16ab4f[_0x9b02('0x45')][_0x9b02('0x46')]&&_0x16ab4f[_0x9b02('0x40')]&&_0x16ab4f[_0x9b02('0x3c')]){_0x1f794b[_0x16ab4f[_0x9b02('0x45')]['name']['toLowerCase']()]&&_0x472a79[_0x9b02('0x41')][_0x9b02('0x42')]({'id':_0x16ab4f[_0x9b02('0x40')],'value':_0x1f794b[_0x16ab4f[_0x9b02('0x45')][_0x9b02('0x46')][_0x9b02('0x3d')]()]['toString']()});}});}return _0x472a79;}exports[_0x9b02('0x47')]=function(_0x4be5dc,_0x295248,_0x234a36,_0x3cdb70,_0x2a5a58,_0x11f65c){var _0x3493f9,_0x4cffbd;_0x11f65c[_0x9b02('0xf')]=intUtil[_0x9b02('0x48')](_0x11f65c[_0x9b02('0xf')]);_0x11f65c[_0x9b02('0x49')]=intUtil[_0x9b02('0x48')](_0x11f65c[_0x9b02('0x49')]);if(_0x2a5a58&&_0x2a5a58[_0x9b02('0x4a')]){logger[_0x9b02('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x295248[_0x9b02('0x4b')]=util[_0x9b02('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x11f65c[_0x9b02('0x49')],_0x295248[_0x9b02('0x4c')],md5(_0x295248[_0x9b02('0x4c')]));}else{_0x295248[_0x9b02('0x4b')]='';}headers[_0x9b02('0x4d')]=getAuth(_0x11f65c);return getUser(_0x11f65c,_0x3cdb70[_0x9b02('0x4e')])[_0x9b02('0x18')](function(_0x41ae93){_0x3493f9=_0x41ae93;logger[_0x9b02('0xb')](_0x9b02('0x4f'),_0x3493f9['id']);return getEndUser(_0x11f65c,_0x295248[_0x9b02('0x50')],_0x295248[_0x9b02('0x51')]);})[_0x9b02('0x18')](function(_0x3860e0){_0x4cffbd=_0x3860e0;logger[_0x9b02('0xb')]('The\x20Enduser\x20ID\x20is:',_0x4cffbd['id']);return getTicket(_0x11f65c,_0x3493f9,_0x4cffbd,_0x234a36,_0x295248);})[_0x9b02('0x18')](function(_0x48b7ca){if(_0x48b7ca){logger[_0x9b02('0xb')](_0x9b02('0x52'),_0x48b7ca['id']);switch(_0x11f65c[_0x9b02('0x3f')]){case _0x9b02('0x53'):logger['info']('[QUEUE]',_0x9b02('0x54'));return request({'uri':util[_0x9b02('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x11f65c[_0x9b02('0xf')],_0x3493f9['id'],_0x48b7ca['id']),'method':_0x9b02('0x10')});case _0x9b02('0x55'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9b02('0xd')](_0x9b02('0x56'),_0x3cdb70[_0x9b02('0x46')]),_0x9b02('0x57'),{'uri':util[_0x9b02('0xd')](_0x9b02('0x58'),_0x11f65c[_0x9b02('0xf')][_0x9b02('0x59')](_0x9b02('0x5a'),''),_0x48b7ca['id'])});break;default:logger['error'](_0x9b02('0x5b'),_0x9b02('0x5c'));}}})['catch'](function(_0x579cf5){logger[_0x9b02('0x5d')](_0x9b02('0x5e'),util[_0x9b02('0x5f')](_0x579cf5,{'showHidden':!![],'depth':null}));});};exports[_0x9b02('0x60')]=function(_0x4c8c95,_0x44a735,_0x17e363,_0x4bd8b4,_0x383aa9,_0x5a0cee,_0x3103d9){var _0x322c08,_0x2527e0;_0x5a0cee['remoteUri']=intUtil[_0x9b02('0x48')](_0x5a0cee[_0x9b02('0xf')]);_0x5a0cee[_0x9b02('0x49')]=intUtil['stripTrailingSlash'](_0x5a0cee['serverUrl']);if(_0x3103d9&&_0x3103d9['recordingFormat']&&_0x3103d9['recordingFormat']!==_0x9b02('0x61')){logger[_0x9b02('0xb')]('[OUTBOUND]',_0x9b02('0x62'));_0x44a735[_0x9b02('0x4b')]=util['format'](_0x9b02('0x63'),_0x5a0cee[_0x9b02('0x49')],_0x44a735['uniqueid'],md5(_0x44a735[_0x9b02('0x4c')]));}headers[_0x9b02('0x4d')]=getAuth(_0x5a0cee);return getUser(_0x5a0cee,_0x4bd8b4['email'])[_0x9b02('0x18')](function(_0x482b22){_0x322c08=_0x482b22;logger[_0x9b02('0xb')](_0x9b02('0x4f'),_0x322c08['id']);return getEndUser(_0x5a0cee,_0x44a735[_0x9b02('0x64')],_0x44a735[_0x9b02('0x65')]);})['then'](function(_0x3fb82d){_0x2527e0=_0x3fb82d;logger[_0x9b02('0xb')](_0x9b02('0x66'),_0x2527e0['id']);return getTicket(_0x5a0cee,_0x322c08,_0x2527e0,_0x17e363,_0x44a735);})['then'](function(_0xd28066){if(_0xd28066){logger[_0x9b02('0xb')](_0x9b02('0x52'),_0xd28066['id']);switch(_0x5a0cee[_0x9b02('0x3f')]){case _0x9b02('0x53'):logger[_0x9b02('0xb')](_0x9b02('0x67'),_0x9b02('0x54'));return request({'uri':util[_0x9b02('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5a0cee['remoteUri'],_0x322c08['id'],_0xd28066['id']),'method':_0x9b02('0x10')});case _0x9b02('0x55'):logger[_0x9b02('0xb')]('[OUTBOUND]',_0x9b02('0x68'));emit(util['format']('user:%s',_0x4bd8b4['name']),_0x9b02('0x57'),{'uri':util[_0x9b02('0xd')](_0x9b02('0x58'),_0x5a0cee[_0x9b02('0xf')][_0x9b02('0x59')]('/api/v2',''),_0xd28066['id'])});break;default:logger[_0x9b02('0x5d')](_0x9b02('0x67'),_0x9b02('0x5c'));}}})['catch'](function(_0x51968a){logger[_0x9b02('0x5d')](_0x9b02('0x69'),util[_0x9b02('0x5f')](_0x51968a,{'showHidden':!![],'depth':null}));});};exports[_0x9b02('0x6a')]=function(_0x8dd151,_0x4adbb6,_0x2eadb7,_0x2d619c,_0x36cd59,_0x42f208){var _0x2c032c,_0x277b35;_0x42f208[_0x9b02('0xf')]=intUtil[_0x9b02('0x48')](_0x42f208[_0x9b02('0xf')]);_0x42f208['serverUrl']=intUtil[_0x9b02('0x48')](_0x42f208[_0x9b02('0x49')]);if(_0x36cd59&&_0x36cd59[_0x9b02('0x4a')]){logger[_0x9b02('0xb')]('['+_0x4adbb6[_0x9b02('0x6b')][_0x9b02('0x6c')]()+']','Recording\x20is\x20enabled!');_0x4adbb6[_0x9b02('0x4b')]=util['format'](_0x9b02('0x63'),_0x42f208[_0x9b02('0x49')],_0x4adbb6[_0x9b02('0x4c')],md5(_0x4adbb6['uniqueid']));}else{_0x4adbb6[_0x9b02('0x4b')]='';}headers[_0x9b02('0x4d')]=getAuth(_0x42f208);return getUser(_0x42f208)['then'](function(_0x5d6cd6){_0x2c032c=_0x5d6cd6;logger[_0x9b02('0xb')](_0x9b02('0x4f'),_0x2c032c['id']);return getEndUser(_0x42f208,_0x4adbb6['calleridname'],_0x4adbb6[_0x9b02('0x51')]);})['then'](function(_0x13b576){_0x277b35=_0x13b576;logger['info']('The\x20Enduser\x20ID\x20is:',_0x277b35['id']);return getTicket(_0x42f208,_0x2c032c,_0x277b35,_0x2eadb7,_0x4adbb6);})[_0x9b02('0x18')](function(_0x2729db){if(_0x2729db){logger[_0x9b02('0xb')]('The\x20Ticket\x20ID\x20is:',_0x2729db['id']);}})[_0x9b02('0x6d')](function(_0x21e238){logger[_0x9b02('0x5d')]('['+_0x4adbb6[_0x9b02('0x6b')]['toUpperCase']()+']'+_0x9b02('0x6e'),util[_0x9b02('0x5f')](_0x21e238,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6ec8=['destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','results','agent','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','first','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','nameField','toLowerCase','content','toString','type','idField','custom_fields','push','variable','variableName','customField','customVariable','Variable','queue','stripTrailingSlash','serverUrl','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','integrationTab','[QUEUE]','%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','catch','recordingFormat','none','destcalleridname'];(function(_0x26b30a,_0xfb3217){var _0x269187=function(_0x468148){while(--_0x468148){_0x26b30a['push'](_0x26b30a['shift']());}};_0x269187(++_0xfb3217);}(_0x6ec8,0x85));var _0x86ec=function(_0x1c5f32,_0x1ac260){_0x1c5f32=_0x1c5f32-0x0;var _0x3bd1e8=_0x6ec8[_0x1c5f32];return _0x3bd1e8;};'use strict';var _=require(_0x86ec('0x0'));var rp=require('request-promise');var md5=require(_0x86ec('0x1'));var util=require('util');var Redis=require(_0x86ec('0x2'));var intUtil=require(_0x86ec('0x3'));var config=require(_0x86ec('0x4'));var logger=require(_0x86ec('0x5'))(_0x86ec('0x6'));config[_0x86ec('0x7')]=_[_0x86ec('0x8')](config[_0x86ec('0x7')],{'host':_0x86ec('0x9'),'port':0x18eb});var io=require(_0x86ec('0xa'))(new Redis(config['redis']));function emit(_0x4423b8,_0x35e04b,_0x1ee23b){io['to'](_0x4423b8)[_0x86ec('0xb')](_0x35e04b,_0x1ee23b);}var headers={'Content-Type':'application/json','Accept':_0x86ec('0xc')};function getTicket(_0x43571,_0x2ef210,_0x477389,_0x636675,_0x531496){logger['info'](_0x86ec('0xd'));return request({'uri':util[_0x86ec('0xe')](_0x86ec('0xf'),_0x43571[_0x86ec('0x10')]),'method':'POST','body':{'ticket':_[_0x86ec('0x11')]({'requester_id':_0x477389['id'],'submitter_id':_0x2ef210?_0x2ef210['id']:undefined,'assignee_id':_0x2ef210?_0x2ef210['id']:undefined,'tags':getTags(_0x636675[_0x86ec('0x12')],_0x86ec('0x13')),'subject':intUtil[_0x86ec('0x14')](_0x636675[_0x86ec('0x15')],_0x531496,'\x20'),'description':intUtil[_0x86ec('0x14')](_0x636675[_0x86ec('0x16')],_0x531496,'\x0a'),'comment':{'public':![],'body':intUtil[_0x86ec('0x14')](_0x636675[_0x86ec('0x16')],_0x531496,'\x0a')}},getCustomFields(_0x636675[_0x86ec('0x17')],_0x531496))}})[_0x86ec('0x18')](function(_0x59b2f4){logger[_0x86ec('0x19')](_0x86ec('0x1a'));return _0x59b2f4[_0x86ec('0x1b')];});}function getUser(_0x34f70a,_0x10c5d9){if(intUtil[_0x86ec('0x1c')](_0x10c5d9)){logger[_0x86ec('0x19')]('Getting\x20agent\x20with\x20email',_0x10c5d9);return request({'uri':util[_0x86ec('0xe')](_0x86ec('0x1d'),_0x34f70a[_0x86ec('0x10')]),'qs':{'query':util['format'](_0x86ec('0x1e'),_0x10c5d9)}})['then'](function(_0x1b76f5){if(_0x1b76f5['count']){logger[_0x86ec('0x19')](_0x86ec('0x1f'));return _['find'](_0x1b76f5[_0x86ec('0x20')],{'email':_0x10c5d9,'role':_0x86ec('0x21')});}else{logger[_0x86ec('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x86ec('0xe')]('%s/users/me.json',_0x34f70a['remoteUri'])})['then'](function(_0x10294d){logger[_0x86ec('0x19')](_0x86ec('0x22'));return _0x10294d[_0x86ec('0x23')];});}});}else{logger[_0x86ec('0x19')](_0x86ec('0x24'));return request({'uri':util['format'](_0x86ec('0x25'),_0x34f70a[_0x86ec('0x10')])})['then'](function(_0x4e1d33){logger[_0x86ec('0x19')](_0x86ec('0x22'));return _0x4e1d33[_0x86ec('0x23')];});}}function getEndUser(_0x5b23f8,_0x287da8,_0x5e44cd){logger[_0x86ec('0x19')](_0x86ec('0x26'),_0x5e44cd);return request({'uri':util[_0x86ec('0xe')]('%s/search.json',_0x5b23f8[_0x86ec('0x10')]),'qs':{'query':util['format'](_0x86ec('0x27'),_0x5e44cd)}})['then'](function(_0x3783c1){var _0x2316b6;if(_0x3783c1[_0x86ec('0x20')][_0x86ec('0x28')]){_0x3783c1['results']=_['filter'](_0x3783c1[_0x86ec('0x20')],{'suspended':![],'role':_0x86ec('0x29')});if(_0x3783c1[_0x86ec('0x20')][_0x86ec('0x28')]){_0x2316b6=_[_0x86ec('0x2a')](_0x3783c1['results']);}}if(_0x2316b6){logger[_0x86ec('0x19')]('Enduser\x20found!');return _0x2316b6;}else{logger[_0x86ec('0x19')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x86ec('0xe')](_0x86ec('0x2b'),_0x5b23f8[_0x86ec('0x10')]),'method':_0x86ec('0x2c'),'body':{'user':{'role':'end-user','name':util[_0x86ec('0xe')](_0x86ec('0x2d'),_0x287da8||_0x5e44cd),'phone':_0x5e44cd}}})[_0x86ec('0x18')](function(_0xee42e2){logger[_0x86ec('0x19')](_0x86ec('0x2e'));return _0xee42e2[_0x86ec('0x23')];});}});}function getAuth(_0x5c5179){var _0xecd28d;if(_0x5c5179[_0x86ec('0x2f')]===_0x86ec('0x30')){_0xecd28d=util[_0x86ec('0xe')](_0x86ec('0x31'),_0x5c5179[_0x86ec('0x32')],_0x5c5179[_0x86ec('0x30')]);}else if(_0x5c5179['authType']===_0x86ec('0x33')){_0xecd28d=util['format'](_0x86ec('0x34'),_0x5c5179[_0x86ec('0x32')],_0x5c5179[_0x86ec('0x33')]);}return util[_0x86ec('0xe')](_0x86ec('0x35'),new Buffer(_0xecd28d)['toString'](_0x86ec('0x36')));}function request(_0xd34af0){logger[_0x86ec('0x37')](_0x86ec('0x38'),JSON[_0x86ec('0x39')](_0xd34af0));return rp(_['defaults'](_0xd34af0,{'method':_0x86ec('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x3bd6e8,_0x1b486d){var _0x4a21e3=[];if(_0x3bd6e8&&_0x3bd6e8[_0x86ec('0x28')]>0x0){_0x4a21e3=_[_0x86ec('0x3b')](_0x3bd6e8,_0x1b486d);}return _0x4a21e3;}function getCustomFields(_0x1b9e5b,_0x577f72){var _0x4c3605=[];var _0x3875ba={'custom_fields':[]};if(_0x1b9e5b[_0x86ec('0x28')]>0x0){_[_0x86ec('0x3c')](_0x1b9e5b,function(_0x25d08b){if(_[_0x86ec('0x3d')]([_0x86ec('0x3e'),_0x86ec('0x3f')],_0x25d08b['type'])&&_0x25d08b['nameField']&&!_0x25d08b['customField']){_0x3875ba[_0x25d08b[_0x86ec('0x40')][_0x86ec('0x41')]()]=_0x25d08b[_0x86ec('0x42')][_0x86ec('0x43')]();}else if(_[_0x86ec('0x3d')]([_0x86ec('0x3e'),_0x86ec('0x3f')],_0x25d08b[_0x86ec('0x44')])&&_0x25d08b[_0x86ec('0x45')]&&_0x25d08b['customField']){_0x3875ba[_0x86ec('0x46')][_0x86ec('0x47')]({'id':_0x25d08b[_0x86ec('0x45')],'value':_0x25d08b[_0x86ec('0x42')][_0x86ec('0x43')]()});}else if(_0x25d08b[_0x86ec('0x44')]===_0x86ec('0x48')&&_0x25d08b[_0x86ec('0x49')]&&_0x25d08b[_0x86ec('0x45')]&&_0x25d08b[_0x86ec('0x4a')]){_0x577f72[_0x25d08b['variableName']]&&_0x3875ba[_0x86ec('0x46')][_0x86ec('0x47')]({'id':_0x25d08b[_0x86ec('0x45')],'value':_0x577f72[_0x25d08b['variableName']]['toString']()});}else if(_0x25d08b[_0x86ec('0x44')]===_0x86ec('0x4b')&&_0x25d08b['Variable']&&_0x25d08b[_0x86ec('0x4c')]['name']&&_0x25d08b[_0x86ec('0x45')]&&_0x25d08b['customField']){_0x577f72[_0x25d08b['Variable']['name']['toLowerCase']()]&&_0x3875ba[_0x86ec('0x46')][_0x86ec('0x47')]({'id':_0x25d08b[_0x86ec('0x45')],'value':_0x577f72[_0x25d08b['Variable'][_0x86ec('0x13')][_0x86ec('0x41')]()][_0x86ec('0x43')]()});}});}return _0x3875ba;}exports[_0x86ec('0x4d')]=function(_0x1e83f4,_0x52af77,_0x512eca,_0x3231d8,_0x5d8dae,_0x50a972){var _0x24c7ce,_0x10cd1f;_0x50a972['remoteUri']=intUtil[_0x86ec('0x4e')](_0x50a972[_0x86ec('0x10')]);_0x50a972[_0x86ec('0x4f')]=intUtil[_0x86ec('0x4e')](_0x50a972['serverUrl']);if(_0x5d8dae&&_0x5d8dae['monitor_format']){logger[_0x86ec('0x19')]('[QUEUE]','Recording\x20is\x20enabled!');_0x52af77[_0x86ec('0x50')]=util[_0x86ec('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x50a972[_0x86ec('0x4f')],_0x52af77['uniqueid'],md5(_0x52af77[_0x86ec('0x51')]));}else{_0x52af77['recordingURL']='';}headers[_0x86ec('0x52')]=getAuth(_0x50a972);return getUser(_0x50a972,_0x3231d8[_0x86ec('0x53')])[_0x86ec('0x18')](function(_0x40e56f){_0x24c7ce=_0x40e56f;logger[_0x86ec('0x19')](_0x86ec('0x54'),_0x24c7ce['id']);return getEndUser(_0x50a972,_0x52af77['calleridname'],_0x52af77[_0x86ec('0x55')]);})[_0x86ec('0x18')](function(_0x37adab){_0x10cd1f=_0x37adab;logger[_0x86ec('0x19')]('The\x20Enduser\x20ID\x20is:',_0x10cd1f['id']);return getTicket(_0x50a972,_0x24c7ce,_0x10cd1f,_0x512eca,_0x52af77);})[_0x86ec('0x18')](function(_0xd2df3f){if(_0xd2df3f){logger[_0x86ec('0x19')]('The\x20Ticket\x20ID\x20is:',_0xd2df3f['id']);switch(_0x50a972['type']){case _0x86ec('0x56'):logger[_0x86ec('0x19')](_0x86ec('0x57'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x86ec('0xe')](_0x86ec('0x58'),_0x50a972['remoteUri'],_0x24c7ce['id'],_0xd2df3f['id']),'method':_0x86ec('0x2c')});case _0x86ec('0x59'):logger[_0x86ec('0x19')](_0x86ec('0x57'),_0x86ec('0x5a'));emit(util[_0x86ec('0xe')](_0x86ec('0x5b'),_0x3231d8[_0x86ec('0x13')]),_0x86ec('0x5c'),{'uri':util[_0x86ec('0xe')](_0x86ec('0x5d'),_0x50a972[_0x86ec('0x10')][_0x86ec('0x5e')](_0x86ec('0x5f'),''),_0xd2df3f['id'])});break;default:logger[_0x86ec('0x60')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x86ec('0x61')](function(_0x2ccc6a){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x2ccc6a,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x4fe23c,_0x3d8549,_0xc9439,_0x5bc447,_0x173315,_0x149dc4,_0x2f207d){var _0x5408b9,_0x195154;_0x149dc4[_0x86ec('0x10')]=intUtil[_0x86ec('0x4e')](_0x149dc4[_0x86ec('0x10')]);_0x149dc4[_0x86ec('0x4f')]=intUtil[_0x86ec('0x4e')](_0x149dc4[_0x86ec('0x4f')]);if(_0x2f207d&&_0x2f207d[_0x86ec('0x62')]&&_0x2f207d['recordingFormat']!==_0x86ec('0x63')){logger[_0x86ec('0x19')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3d8549['recordingURL']=util[_0x86ec('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x149dc4[_0x86ec('0x4f')],_0x3d8549['uniqueid'],md5(_0x3d8549[_0x86ec('0x51')]));}headers[_0x86ec('0x52')]=getAuth(_0x149dc4);return getUser(_0x149dc4,_0x5bc447[_0x86ec('0x53')])[_0x86ec('0x18')](function(_0x4223a5){_0x5408b9=_0x4223a5;logger[_0x86ec('0x19')](_0x86ec('0x54'),_0x5408b9['id']);return getEndUser(_0x149dc4,_0x3d8549[_0x86ec('0x64')],_0x3d8549[_0x86ec('0x65')]);})[_0x86ec('0x18')](function(_0x30484a){_0x195154=_0x30484a;logger['info'](_0x86ec('0x66'),_0x195154['id']);return getTicket(_0x149dc4,_0x5408b9,_0x195154,_0xc9439,_0x3d8549);})[_0x86ec('0x18')](function(_0x173c65){if(_0x173c65){logger['info'](_0x86ec('0x67'),_0x173c65['id']);switch(_0x149dc4[_0x86ec('0x44')]){case _0x86ec('0x56'):logger[_0x86ec('0x19')](_0x86ec('0x68'),_0x86ec('0x69'));return request({'uri':util[_0x86ec('0xe')](_0x86ec('0x58'),_0x149dc4[_0x86ec('0x10')],_0x5408b9['id'],_0x173c65['id']),'method':'POST'});case _0x86ec('0x59'):logger[_0x86ec('0x19')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x86ec('0xe')](_0x86ec('0x5b'),_0x5bc447[_0x86ec('0x13')]),_0x86ec('0x5c'),{'uri':util[_0x86ec('0xe')]('%s/agent/tickets/%s',_0x149dc4[_0x86ec('0x10')]['replace'](_0x86ec('0x5f'),''),_0x173c65['id'])});break;default:logger[_0x86ec('0x60')](_0x86ec('0x68'),_0x86ec('0x6a'));}}})[_0x86ec('0x61')](function(_0x2b1776){logger[_0x86ec('0x60')](_0x86ec('0x6b'),util[_0x86ec('0x6c')](_0x2b1776,{'showHidden':!![],'depth':null}));});};exports[_0x86ec('0x6d')]=function(_0x3b3169,_0x5b0f9b,_0x3ce02a,_0x2417c6,_0x99fb2b,_0x2ea2a9){var _0x5f5dc7,_0x16dd83;_0x2ea2a9[_0x86ec('0x10')]=intUtil['stripTrailingSlash'](_0x2ea2a9[_0x86ec('0x10')]);_0x2ea2a9[_0x86ec('0x4f')]=intUtil['stripTrailingSlash'](_0x2ea2a9[_0x86ec('0x4f')]);if(_0x99fb2b&&_0x99fb2b[_0x86ec('0x6e')]){logger['info']('['+_0x5b0f9b[_0x86ec('0x6f')][_0x86ec('0x70')]()+']',_0x86ec('0x71'));_0x5b0f9b[_0x86ec('0x50')]=util[_0x86ec('0xe')](_0x86ec('0x72'),_0x2ea2a9[_0x86ec('0x4f')],_0x5b0f9b[_0x86ec('0x51')],md5(_0x5b0f9b[_0x86ec('0x51')]));}else{_0x5b0f9b[_0x86ec('0x50')]='';}headers[_0x86ec('0x52')]=getAuth(_0x2ea2a9);return getUser(_0x2ea2a9)[_0x86ec('0x18')](function(_0x1a6053){_0x5f5dc7=_0x1a6053;logger[_0x86ec('0x19')](_0x86ec('0x54'),_0x5f5dc7['id']);return getEndUser(_0x2ea2a9,_0x5b0f9b[_0x86ec('0x73')],_0x5b0f9b[_0x86ec('0x55')]);})['then'](function(_0xbeec98){_0x16dd83=_0xbeec98;logger[_0x86ec('0x19')](_0x86ec('0x66'),_0x16dd83['id']);return getTicket(_0x2ea2a9,_0x5f5dc7,_0x16dd83,_0x3ce02a,_0x5b0f9b);})[_0x86ec('0x18')](function(_0x236d59){if(_0x236d59){logger[_0x86ec('0x19')](_0x86ec('0x67'),_0x236d59['id']);}})['catch'](function(_0x3ef74d){logger['error']('['+_0x5b0f9b[_0x86ec('0x6f')]['toUpperCase']()+']'+_0x86ec('0x74'),util[_0x86ec('0x6c')](_0x3ef74d,{'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 2b1c7a8..a0b9030 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 _0xb0db=['recordingFormat','none','com','destcalleridname','destcalleridnum','[OUTBOUND]','unmanaged','toUpperCase','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','emit','debug','length','forEach','includes','string','idField','toString','variable','variableName','type','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','refresh_token','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','Zoho-oauthtoken\x20','then','isArrayLikeObject','findIndex','info','Agent\x20found!','Using\x20the\x20admin\x20account!','users','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Leads','Owner','administrator','Subject','getString','Subjects','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','Fields','code','err','log','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash'];(function(_0x3cb152,_0x57eb54){var _0x4f54c3=function(_0x273a45){while(--_0x273a45){_0x3cb152['push'](_0x3cb152['shift']());}};_0x4f54c3(++_0x57eb54);}(_0xb0db,0xa3));var _0xbb0d=function(_0x46ee98,_0xb0d78c){_0x46ee98=_0x46ee98-0x0;var _0x6fad51=_0xb0db[_0x46ee98];return _0x6fad51;};'use strict';var _=require('lodash');var rp=require(_0xbb0d('0x0'));var md5=require(_0xbb0d('0x1'));var util=require(_0xbb0d('0x2'));var intUtil=require(_0xbb0d('0x3'));var moment=require(_0xbb0d('0x4'));var Redis=require(_0xbb0d('0x5'));var BPromise=require(_0xbb0d('0x6'));var config=require('../../../../config/environment');var logger=require(_0xbb0d('0x7'))(_0xbb0d('0x8'));config[_0xbb0d('0x9')]=_[_0xbb0d('0xa')](config[_0xbb0d('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x50cb7e,_0x2d2ff7,_0x2bccd2){io['to'](_0x50cb7e)[_0xbb0d('0xb')](_0x2d2ff7,_0x2bccd2);}function request(_0x5d8ba2){logger[_0xbb0d('0xc')]('[HTTP]',JSON['stringify'](_0x5d8ba2));return rp(_0x5d8ba2);}function getCustomFields(_0x17d5ae,_0xcaebec){var _0x55a820={};if(_0x17d5ae[_0xbb0d('0xd')]>0x0){_[_0xbb0d('0xe')](_0x17d5ae,function(_0xddbc47){if(_[_0xbb0d('0xf')]([_0xbb0d('0x10'),'picklist'],_0xddbc47['type'])&&_0xddbc47['idField']){_0x55a820[_0xddbc47[_0xbb0d('0x11')]]=_0xddbc47['content'][_0xbb0d('0x12')]();}else if(_0xddbc47['type']===_0xbb0d('0x13')&&_0xddbc47['variableName']&&_0xddbc47['idField']&&_0xcaebec[_0xddbc47[_0xbb0d('0x14')]]){_0x55a820[_0xddbc47[_0xbb0d('0x11')]]=_0xcaebec[_0xddbc47[_0xbb0d('0x14')]][_0xbb0d('0x12')]();}else if(_0xddbc47[_0xbb0d('0x15')]===_0xbb0d('0x16')&&_0xddbc47[_0xbb0d('0x17')]&&_0xddbc47[_0xbb0d('0x17')]['name']&&_0xddbc47['idField']&&_0xcaebec[_0xddbc47[_0xbb0d('0x17')][_0xbb0d('0x18')]['toLowerCase']()]){_0x55a820[_0xddbc47[_0xbb0d('0x11')]]=_0xcaebec[_0xddbc47[_0xbb0d('0x17')][_0xbb0d('0x18')][_0xbb0d('0x19')]()]['toString']();}});}return _0x55a820;}function getName(_0x3f28c5){if(_0x3f28c5[_0xbb0d('0x1a')]('\x20')>0x0){var _0x9c13a=_0x3f28c5[_0xbb0d('0x1b')](/ (.+)/);if(_0x9c13a[0x1]){return _0x9c13a;}}return[_0x3f28c5,_0x3f28c5];}var accountsTokens={};function getAccessToken(_0x270169){return new Promise(function(_0x19761e,_0x1d113e){if(!_['isNil'](accountsTokens[_0x270169['id']])&&!_[_0xbb0d('0x1c')](accountsTokens[_0x270169['id']][_0xbb0d('0x1d')])){if(moment()['isBefore'](accountsTokens[_0x270169['id']][_0xbb0d('0x1e')])){_0x19761e(accountsTokens[_0x270169['id']][_0xbb0d('0x1d')]);}}var _0x3e0c44;switch(_0x270169[_0xbb0d('0x1f')]){case'US':_0x3e0c44=_0xbb0d('0x20');break;case'AU':_0x3e0c44=_0xbb0d('0x21');break;case'EU':_0x3e0c44='https://accounts.zoho.eu';break;case'IN':_0x3e0c44='https://accounts.zoho.in';break;case'CN':_0x3e0c44='https://accounts.zoho.com.cn';break;default:_0x3e0c44=_0xbb0d('0x22');break;}var _0x5af9ed={'method':'POST','uri':_0x3e0c44+_0xbb0d('0x23'),'qs':{'refresh_token':_0x270169[_0xbb0d('0x24')],'client_id':_0x270169[_0xbb0d('0x25')],'client_secret':_0x270169['clientSecret'],'grant_type':_0xbb0d('0x26')},'json':!![]};return rp(_0x5af9ed)['then'](function(_0x1cfff2){accountsTokens[_0x270169['id']]={'access_token':_0x1cfff2[_0xbb0d('0x1d')],'expires_in':moment()[_0xbb0d('0x27')](_0x1cfff2[_0xbb0d('0x1e')],_0xbb0d('0x28'))};_0x19761e(_0x1cfff2[_0xbb0d('0x1d')]);})[_0xbb0d('0x29')](function(_0x44e436){logger[_0xbb0d('0x2a')](_0xbb0d('0x2b'),_0x44e436[_0xbb0d('0x2c')]);_0x1d113e(_0x44e436);});});}function getUser(_0x20fe83,_0x14adbe,_0x2278e3,_0x57b26f){logger['info'](_0xbb0d('0x2d'));return request({'method':_0xbb0d('0x2e'),'uri':util[_0xbb0d('0x2f')]('https://www.zohoapis.%s/crm/v2/users',_0x14adbe),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xbb0d('0x30')+_0x20fe83},'json':!![]})[_0xbb0d('0x31')](function(_0x3b5d57){if(_0x3b5d57['users']){var _0x30e208=-0x1;if(_[_0xbb0d('0x32')](_0x3b5d57['users'])){if(!_['isNil'](_0x57b26f)){_0x30e208=_[_0xbb0d('0x33')](_0x3b5d57['users'],function(_0x56579d){return _0x56579d['email']===_0x57b26f;});}if(_0x30e208>=0x0){logger[_0xbb0d('0x34')](_0xbb0d('0x35'));}else{logger[_0xbb0d('0x34')](_0xbb0d('0x36'));_0x30e208=_[_0xbb0d('0x33')](_0x3b5d57[_0xbb0d('0x37')],function(_0x1622df){return _0x1622df[_0xbb0d('0x38')][_0xbb0d('0x18')]===_0xbb0d('0x39');});}return _0x3b5d57[_0xbb0d('0x37')][_0x30e208];}else{if(_0x3b5d57[_0xbb0d('0x3a')]['profile'][_0xbb0d('0x18')]==='Administrator'){logger[_0xbb0d('0x34')](_0xbb0d('0x36'));user=_0x3b5d57[_0xbb0d('0x3a')];return user;}else{logger[_0xbb0d('0x2a')](_0xbb0d('0x3b'),JSON[_0xbb0d('0x3c')](_0x3b5d57));throw new Error(_0xbb0d('0x3d')+JSON[_0xbb0d('0x3c')](_0x3b5d57));}}}else{logger['error'](_0xbb0d('0x3b'),JSON[_0xbb0d('0x3c')](_0x3b5d57));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xbb0d('0x3c')](_0x3b5d57));}})[_0xbb0d('0x29')](function(_0x455ccb){console[_0xbb0d('0x2a')](_0x455ccb);});}function getZohoUser(_0x14f0bd,_0x3f0d09){return new BPromise(function(_0x46e903,_0x57d3cd){request(_0x14f0bd)[_0xbb0d('0x31')](function(_0x309168){var _0x5b1c36=null;if(_0x309168){_0x5b1c36=_0x309168[_0xbb0d('0x3e')][0x0];_0x5b1c36[_0xbb0d('0x3f')]=_0x3f0d09;}_0x46e903(_0x5b1c36);})[_0xbb0d('0x29')](function(_0x1dbcc2){_0x57d3cd(_0x1dbcc2);});});}function createEndUser(_0x5ad1a4,_0x40c964,_0x23c580,_0x5e4164,_0x36c3a2,_0x47c1ec){var _0x23c580=getName(_0x23c580);return request({'method':_0xbb0d('0x40'),'uri':_0xbb0d('0x41')+_0x40c964+_0xbb0d('0x42')+_[_0xbb0d('0x43')](_0x47c1ec[_0xbb0d('0x44')])+'s','body':{'data':[{'Last_Name':_0x23c580[0x1],'First_Name':_0x23c580[0x0],'Phone':_0x5e4164,'Owner':{'name':!_['isNil'](_0x36c3a2['role']['name'])?_0x36c3a2[_0xbb0d('0x45')]['name']:!_['isNil'](_0x36c3a2['first_name'])?_0x36c3a2[_0xbb0d('0x46')]+'\x20'+_0x36c3a2[_0xbb0d('0x47')]:_0x36c3a2[_0xbb0d('0x47')],'id':_0x36c3a2['id']}}]},'headers':{'Authorization':_0xbb0d('0x30')+_0x5ad1a4},'json':!![]})[_0xbb0d('0x31')](function(_0x24d054){if(_0x24d054&&_0x24d054[_0xbb0d('0x3e')][0x0]['code']===_0xbb0d('0x48')){var _0x261990=_0x24d054[_0xbb0d('0x3e')][0x0][_0xbb0d('0x49')];_0x261990[_0xbb0d('0x3f')]=_[_0xbb0d('0x43')](_0x47c1ec[_0xbb0d('0x44')])+'s';return _0x261990;}logger[_0xbb0d('0x2a')](_0xbb0d('0x3b'),JSON[_0xbb0d('0x3c')](data));throw new Error('Error:\x20'+JSON[_0xbb0d('0x3c')](data));})['catch'](function(_0x1d22f7){console['log'](_0xbb0d('0x4a'),_0x1d22f7);});}function getEndUser(_0x1d89f2,_0xa3cf26,_0x2e8762,_0x107808,_0x492658,_0x1340fd,_0x948a40){var _0x130e10={'method':'GET','uri':'','headers':{'Authorization':_0xbb0d('0x30')+_0x1d89f2},'json':!![]};switch(_0x948a40[_0xbb0d('0x4b')]){case _0xbb0d('0x4c'):_0x130e10[_0xbb0d('0x4d')]=_0xbb0d('0x41')+_0xa3cf26+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x492658+'))';return getZohoUser(_0x130e10,_0xbb0d('0x4e'))['then'](function(_0x18cd24){if(_0x18cd24)return _0x18cd24;_0x130e10[_0xbb0d('0x4d')]='https://www.zohoapis.'+_0xa3cf26+_0xbb0d('0x4f')+_0x492658+'))';return getZohoUser(_0x130e10,'Leads')[_0xbb0d('0x31')](function(_0x26819d){if(_0x26819d)return _0x26819d;if(_0x948a40[_0xbb0d('0x44')]!=_0xbb0d('0x50')){return createEndUser(_0x1d89f2,_0xa3cf26,_0x107808,_0x492658,_0x1340fd,_0x948a40);}else{return{};}});});break;case _0xbb0d('0x51'):_0x130e10[_0xbb0d('0x4d')]=_0xbb0d('0x41')+_0xa3cf26+_0xbb0d('0x52')+_0x492658+'))';return getZohoUser(_0x130e10,'Contacts')[_0xbb0d('0x31')](function(_0x34a7a5){if(_0x34a7a5)return _0x34a7a5;if(_0x948a40['moduleCreate']!='nothing'){return createEndUser(_0x1d89f2,_0xa3cf26,_0x107808,_0x492658,_0x1340fd,_0x948a40);}else{return{};}});break;case _0xbb0d('0x53'):_0x130e10[_0xbb0d('0x4d')]=_0xbb0d('0x41')+_0xa3cf26+_0xbb0d('0x4f')+_0x492658+'))';return getZohoUser(_0x130e10,_0xbb0d('0x54'))[_0xbb0d('0x31')](function(_0x22a985){if(_0x22a985)return _0x22a985;if(_0x948a40['moduleCreate']!=_0xbb0d('0x50')){return createEndUser(_0x1d89f2,_0xa3cf26,_0x107808,_0x492658,_0x1340fd,_0x948a40);}else{return{};}});break;}}function getCall(_0x452387,_0x20f728,_0x1225e1,_0x30b547,_0x28d41e,_0x41e1b0,_0x375d55,_0xba2015){logger[_0xbb0d('0x34')]('Creating\x20new\x20call...');var _0x5ea223={};_0x5ea223[_0xbb0d('0x55')]={'name':!_[_0xbb0d('0x1c')](_0x30b547[_0xbb0d('0x45')]['name'])&&!_['isNil'](_0x30b547[_0xbb0d('0x38')][_0xbb0d('0x18')])&&_0x30b547['profile']['name']===_0xbb0d('0x56')?_0x30b547[_0xbb0d('0x45')]['name']:!_['isNil'](_0x30b547[_0xbb0d('0x46')])?_0x30b547[_0xbb0d('0x46')]+'\x20'+_0x30b547[_0xbb0d('0x47')]:_0x30b547[_0xbb0d('0x47')],'id':_0x30b547['id']};_0x5ea223[_0xbb0d('0x57')]=intUtil[_0xbb0d('0x58')](_0x41e1b0[_0xbb0d('0x59')],_0x375d55,'\x20');_0x5ea223['Description']=intUtil[_0xbb0d('0x58')](_0x41e1b0[_0xbb0d('0x5a')],_0x375d55,'\x0a');if(_0x28d41e[_0xbb0d('0x3f')]===_0xbb0d('0x4e')){_0x5ea223['Who_Id']={'name':!_[_0xbb0d('0x1c')](_0x28d41e[_0xbb0d('0x5b')])?_0x28d41e[_0xbb0d('0x5b')]:!_['isNil'](_0x28d41e['First_Name'])?_0x28d41e[_0xbb0d('0x5c')]+'\x20'+_0x28d41e['Last_Name']:_0x28d41e[_0xbb0d('0x5d')],'id':_0x28d41e['id']};}if(_0x28d41e[_0xbb0d('0x3f')]===_0xbb0d('0x54')){_0x5ea223[_0xbb0d('0x5e')]={'name':!_['isNil'](_0x28d41e[_0xbb0d('0x5b')])?_0x28d41e[_0xbb0d('0x5b')]:!_[_0xbb0d('0x1c')](_0x28d41e[_0xbb0d('0x5c')])?_0x28d41e[_0xbb0d('0x5c')]+'\x20'+_0x28d41e[_0xbb0d('0x5d')]:_0x28d41e[_0xbb0d('0x5d')],'id':_0x28d41e['id']};_0x5ea223[_0xbb0d('0x5f')]=_[_0xbb0d('0x43')](_0x28d41e[_0xbb0d('0x3f')]);}if(_0x375d55[_0xbb0d('0x60')]){_0x5ea223[_0xbb0d('0x61')]=moment[_0xbb0d('0x62')](parseInt(_0x375d55[_0xbb0d('0x60')])*0x3e8)[_0xbb0d('0x2f')](_0xbb0d('0x63'));}else if(_0x375d55[_0xbb0d('0x64')]&&_0x375d55['endtime']){_0x5ea223[_0xbb0d('0x61')]=moment[_0xbb0d('0x62')](moment(_0x375d55[_0xbb0d('0x65')],_0xbb0d('0x66'))[_0xbb0d('0x67')](moment(_0x375d55[_0xbb0d('0x68')],'YYYY-MM-DDTHH:mm:ss')))[_0xbb0d('0x2f')](_0xbb0d('0x63'));}switch(_0x375d55[_0xbb0d('0x69')]){case _0xbb0d('0x6a'):_0x5ea223[_0xbb0d('0x6b')]=_0xbb0d('0x6c');break;case _0xbb0d('0x6d'):case _0xbb0d('0x6e'):_0x5ea223[_0xbb0d('0x6b')]=_0xbb0d('0x6f');break;case _0xbb0d('0x70'):_0x5ea223[_0xbb0d('0x6b')]=_0xbb0d('0x71');break;case _0xbb0d('0x72'):_0x5ea223[_0xbb0d('0x6b')]=_0xbb0d('0x73');break;case _0xbb0d('0x74'):_0x5ea223['Call_Result']=_0xbb0d('0x75');default:}_0x5ea223['Call_Start_Time']=(_0xba2015===_0xbb0d('0x76')?moment(_0x375d55[_0xbb0d('0x68')])[_0xbb0d('0x2f')](_0xbb0d('0x66')):moment(_0x375d55[_0xbb0d('0x77')])[_0xbb0d('0x2f')](_0xbb0d('0x66')))||moment()[_0xbb0d('0x2f')](_0xbb0d('0x66'));_0x5ea223[_0xbb0d('0x78')]=_0xba2015||'Inbound';_0x5ea223=_['merge'](_0x5ea223,getCustomFields(_0x41e1b0[_0xbb0d('0x79')],_0x375d55));return request({'method':_0xbb0d('0x40'),'uri':_0xbb0d('0x41')+_0x20f728+'/crm/v2/Calls','headers':{'Authorization':_0xbb0d('0x30')+_0x452387},'body':{'data':[_0x5ea223]},'json':!![]})[_0xbb0d('0x31')](function(_0x5e5c72){if(_0x5e5c72&&_0x5e5c72[_0xbb0d('0x3e')][0x0][_0xbb0d('0x7a')]===_0xbb0d('0x48')){logger['info']('Call\x20created!');return{'id':_0x5e5c72[_0xbb0d('0x3e')][0x0][_0xbb0d('0x49')]['id']};}})[_0xbb0d('0x29')](function(_0x2573f6){logger['info'](_0xbb0d('0x7b'),_0x2573f6[_0xbb0d('0x2c')]);console[_0xbb0d('0x7c')](_0xbb0d('0x7b'),_0x2573f6);});}exports['queue']=function(_0x4f5541,_0x5d66fa,_0x1f7978,_0x402488,_0x3476d3,_0x5565e6){var _0x14e05e,_0x4565ea,_0x51a99a;_0x5565e6[_0xbb0d('0x7d')]=intUtil['stripTrailingSlash'](_0x5565e6[_0xbb0d('0x7d')]);_0x5565e6[_0xbb0d('0x7e')]=intUtil['stripTrailingSlash'](_0x5565e6[_0xbb0d('0x7e')]);if(_0x3476d3&&_0x3476d3[_0xbb0d('0x7f')]){logger[_0xbb0d('0x34')](_0xbb0d('0x80'),_0xbb0d('0x81'));_0x5d66fa[_0xbb0d('0x82')]=_0x5565e6['serverUrl']+_0xbb0d('0x83')+_0x5d66fa['uniqueid']+_0xbb0d('0x84')+md5(_0x5d66fa[_0xbb0d('0x85')]);}else{_0x5d66fa[_0xbb0d('0x82')]='';}var _0x5e9e4d=_0x5565e6['host']===_0xbb0d('0x86')?'eu':'com';return getAccessToken(_0x5565e6)[_0xbb0d('0x31')](function(_0x5dac67){_0x51a99a=_0x5dac67;return getUser(_0x51a99a,_0x5e9e4d,_0x5565e6,_0x402488[_0xbb0d('0x87')]);})[_0xbb0d('0x31')](function(_0x550c54){_0x14e05e=_0x550c54;logger['info'](_0xbb0d('0x88'),_0x14e05e['id']);return getEndUser(_0x51a99a,_0x5e9e4d,_0x5565e6,_0x5d66fa[_0xbb0d('0x89')],_0x5d66fa[_0xbb0d('0x8a')],_0x14e05e,_0x1f7978);})[_0xbb0d('0x31')](function(_0x1faae4){_0x4565ea=_0x1faae4;return getCall(_0x51a99a,_0x5e9e4d,_0x5565e6,_0x14e05e,_0x4565ea,_0x1f7978,_0x5d66fa,_0xbb0d('0x8b'));})[_0xbb0d('0x31')](function(_0x49a45b){if(_0x49a45b){logger[_0xbb0d('0x34')](_0xbb0d('0x8c'),_0x49a45b['id']);logger[_0xbb0d('0x34')](_0xbb0d('0x80'),_0xbb0d('0x8d'));emit(util[_0xbb0d('0x2f')](_0xbb0d('0x8e'),_0x402488[_0xbb0d('0x18')]),_0xbb0d('0x8f'),{'uri':_0xbb0d('0x90')+_0x5565e6[_0xbb0d('0x7d')]+_0xbb0d('0x91')+_0x49a45b['id']});}})[_0xbb0d('0x29')](function(_0x305ee1){logger['error'](_0xbb0d('0x80'),JSON[_0xbb0d('0x3c')](_0x305ee1));});};exports[_0xbb0d('0x76')]=function(_0xb342df,_0xb0ad20,_0x5d3bf5,_0x1b7ce5,_0x31c806,_0x16161d,_0x387af2){var _0x1ff77c,_0x3339e7,_0x84ab16;_0x16161d[_0xbb0d('0x7d')]=intUtil[_0xbb0d('0x92')](_0x16161d[_0xbb0d('0x7d')]);_0x16161d[_0xbb0d('0x7e')]=intUtil['stripTrailingSlash'](_0x16161d[_0xbb0d('0x7e')]);if(_0x387af2&&_0x387af2['recordingFormat']&&_0x387af2[_0xbb0d('0x93')]!==_0xbb0d('0x94')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0xb0ad20[_0xbb0d('0x82')]=_0x16161d[_0xbb0d('0x7e')]+_0xbb0d('0x83')+_0xb0ad20[_0xbb0d('0x85')]+_0xbb0d('0x84')+md5(_0xb0ad20[_0xbb0d('0x85')]);}var _0x4fdc66=_0x16161d[_0xbb0d('0x7d')]===_0xbb0d('0x86')?'eu':_0xbb0d('0x95');return getAccessToken(_0x16161d)[_0xbb0d('0x31')](function(_0x3339d4){_0x84ab16=_0x3339d4;return getUser(_0x84ab16,_0x4fdc66,_0x16161d,_0x1b7ce5[_0xbb0d('0x87')]);})['then'](function(_0x12de1d){_0x1ff77c=_0x12de1d;logger[_0xbb0d('0x34')](_0xbb0d('0x88'),_0x1ff77c['id']);return getEndUser(_0x84ab16,_0x4fdc66,_0x16161d,_0xb0ad20[_0xbb0d('0x96')],_0xb0ad20[_0xbb0d('0x97')],_0x1ff77c,_0x5d3bf5);})[_0xbb0d('0x31')](function(_0x5d5999){_0x3339e7=_0x5d5999;return getCall(_0x84ab16,_0x4fdc66,_0x16161d,_0x1ff77c,_0x3339e7,_0x5d3bf5,_0xb0ad20,'Outbound');})[_0xbb0d('0x31')](function(_0x44ffb5){if(_0x44ffb5){logger[_0xbb0d('0x34')](_0xbb0d('0x8c'),_0x44ffb5['id']);logger[_0xbb0d('0x34')](_0xbb0d('0x98'),_0xbb0d('0x8d'));emit(util[_0xbb0d('0x2f')]('user:%s',_0x1b7ce5[_0xbb0d('0x18')]),_0xbb0d('0x8f'),{'uri':_0xbb0d('0x90')+_0x16161d[_0xbb0d('0x7d')]+_0xbb0d('0x91')+_0x44ffb5['id']});}})[_0xbb0d('0x29')](function(_0x10bb16){logger[_0xbb0d('0x2a')](_0xbb0d('0x98'),JSON[_0xbb0d('0x3c')](_0x10bb16));});};exports[_0xbb0d('0x99')]=function(_0x515b0d,_0x366396,_0x1d7fe6,_0x39ade7,_0x59c4a6,_0x16e0ba){var _0x49c4bd,_0x16eb0f,_0x69f145;_0x16e0ba[_0xbb0d('0x7d')]=intUtil[_0xbb0d('0x92')](_0x16e0ba['host']);_0x16e0ba[_0xbb0d('0x7e')]=intUtil[_0xbb0d('0x92')](_0x16e0ba[_0xbb0d('0x7e')]);if(_0x59c4a6&&_0x59c4a6['monitor_format']){logger[_0xbb0d('0x34')]('['+_0x366396[_0xbb0d('0x69')][_0xbb0d('0x9a')]()+']',_0xbb0d('0x81'));_0x366396[_0xbb0d('0x82')]=_0x16e0ba[_0xbb0d('0x7e')]+_0xbb0d('0x83')+_0x366396['uniqueid']+_0xbb0d('0x84')+md5(_0x366396[_0xbb0d('0x85')]);}else{_0x366396[_0xbb0d('0x82')]='';}var _0x1293a7=_0x16e0ba[_0xbb0d('0x7d')]===_0xbb0d('0x86')?'eu':_0xbb0d('0x95');return getAccessToken(_0x16e0ba)[_0xbb0d('0x31')](function(_0x52160e){_0x69f145=_0x52160e;return getUser(_0x69f145,_0x1293a7,_0x16e0ba);})['then'](function(_0x59ede3){_0x49c4bd=_0x59ede3;logger['info'](_0xbb0d('0x88'),_0x49c4bd['id']);return getEndUser(_0x69f145,_0x1293a7,_0x16e0ba,_0x366396[_0xbb0d('0x89')],_0x366396[_0xbb0d('0x8a')],_0x49c4bd,_0x1d7fe6);})[_0xbb0d('0x31')](function(_0x89c69e){_0x16eb0f=_0x89c69e;return getCall(_0x69f145,_0x1293a7,_0x16e0ba,_0x49c4bd,_0x16eb0f,_0x1d7fe6,_0x366396,'Inbound');})[_0xbb0d('0x31')](function(_0x3a1e20){if(_0x3a1e20){logger[_0xbb0d('0x34')]('The\x20Call\x20ID\x20is:',_0x3a1e20['id']);}})[_0xbb0d('0x29')](function(_0x3482ea){logger[_0xbb0d('0x2a')]('['+_0x366396[_0xbb0d('0x69')][_0xbb0d('0x9a')]()+']',JSON[_0xbb0d('0x3c')](_0x3482ea));});}; \ No newline at end of file +var _0x2617=['What_Id','First_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','called','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','merge','Fields','Call\x20created!','details','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','com','email','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','[OUTBOUND]','/api/voice/recordings/','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','toUpperCase','zoho.eu','calleridnum','Inbound','lodash','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','includes','picklist','type','variableName','idField','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','data','enduserType','moduleCreate','Error:\x20','log','moduleSearch','contact_lead','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','Leads','nothing','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Full_Name','Last_Name'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x2617,0x175));var _0x7261=function(_0x208ad9,_0x69c80c){_0x208ad9=_0x208ad9-0x0;var _0x18dd92=_0x2617[_0x208ad9];return _0x18dd92;};'use strict';var _=require(_0x7261('0x0'));var rp=require('request-promise');var md5=require(_0x7261('0x1'));var util=require(_0x7261('0x2'));var intUtil=require(_0x7261('0x3'));var moment=require(_0x7261('0x4'));var Redis=require('ioredis');var BPromise=require(_0x7261('0x5'));var config=require(_0x7261('0x6'));var logger=require(_0x7261('0x7'))(_0x7261('0x8'));config[_0x7261('0x9')]=_[_0x7261('0xa')](config[_0x7261('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x7261('0xb'))(new Redis(config[_0x7261('0x9')]));function emit(_0x38444d,_0x33be81,_0x548b65){io['to'](_0x38444d)[_0x7261('0xc')](_0x33be81,_0x548b65);}function request(_0x14f348){logger[_0x7261('0xd')](_0x7261('0xe'),JSON[_0x7261('0xf')](_0x14f348));return rp(_0x14f348);}function getCustomFields(_0x5f125f,_0x5a49f4){var _0x1d5f5b={};if(_0x5f125f['length']>0x0){_[_0x7261('0x10')](_0x5f125f,function(_0x54642d){if(_[_0x7261('0x11')](['string',_0x7261('0x12')],_0x54642d[_0x7261('0x13')])&&_0x54642d['idField']){_0x1d5f5b[_0x54642d['idField']]=_0x54642d['content']['toString']();}else if(_0x54642d[_0x7261('0x13')]==='variable'&&_0x54642d[_0x7261('0x14')]&&_0x54642d[_0x7261('0x15')]&&_0x5a49f4[_0x54642d[_0x7261('0x14')]]){_0x1d5f5b[_0x54642d['idField']]=_0x5a49f4[_0x54642d[_0x7261('0x14')]][_0x7261('0x16')]();}else if(_0x54642d[_0x7261('0x13')]===_0x7261('0x17')&&_0x54642d[_0x7261('0x18')]&&_0x54642d[_0x7261('0x18')][_0x7261('0x19')]&&_0x54642d[_0x7261('0x15')]&&_0x5a49f4[_0x54642d['Variable'][_0x7261('0x19')][_0x7261('0x1a')]()]){_0x1d5f5b[_0x54642d['idField']]=_0x5a49f4[_0x54642d[_0x7261('0x18')][_0x7261('0x19')][_0x7261('0x1a')]()][_0x7261('0x16')]();}});}return _0x1d5f5b;}function getName(_0x9346e){if(_0x9346e[_0x7261('0x1b')]('\x20')>0x0){var _0x1ca019=_0x9346e[_0x7261('0x1c')](/ (.+)/);if(_0x1ca019[0x1]){return _0x1ca019;}}return[_0x9346e,_0x9346e];}var accountsTokens={};function getAccessToken(_0x250fb4){return new Promise(function(_0x22ce40,_0x54f777){if(!_[_0x7261('0x1d')](accountsTokens[_0x250fb4['id']])&&!_['isNil'](accountsTokens[_0x250fb4['id']][_0x7261('0x1e')])){if(moment()[_0x7261('0x1f')](accountsTokens[_0x250fb4['id']][_0x7261('0x20')])){_0x22ce40(accountsTokens[_0x250fb4['id']]['access_token']);}}var _0x352d08;switch(_0x250fb4[_0x7261('0x21')]){case'US':_0x352d08=_0x7261('0x22');break;case'AU':_0x352d08='https://accounts.zoho.com.au';break;case'EU':_0x352d08=_0x7261('0x23');break;case'IN':_0x352d08=_0x7261('0x24');break;case'CN':_0x352d08=_0x7261('0x25');break;default:_0x352d08=_0x7261('0x23');break;}var _0x41902b={'method':_0x7261('0x26'),'uri':_0x352d08+'/oauth/v2/token','qs':{'refresh_token':_0x250fb4[_0x7261('0x27')],'client_id':_0x250fb4[_0x7261('0x28')],'client_secret':_0x250fb4[_0x7261('0x29')],'grant_type':_0x7261('0x2a')},'json':!![]};return rp(_0x41902b)[_0x7261('0x2b')](function(_0x2899e5){accountsTokens[_0x250fb4['id']]={'access_token':_0x2899e5['access_token'],'expires_in':moment()[_0x7261('0x2c')](_0x2899e5[_0x7261('0x20')],'seconds')};_0x22ce40(_0x2899e5[_0x7261('0x1e')]);})[_0x7261('0x2d')](function(_0x38ea99){logger[_0x7261('0x2e')](_0x7261('0x2f'),_0x38ea99[_0x7261('0x30')]);_0x54f777(_0x38ea99);});});}function getUser(_0x5acf91,_0x197ff3,_0xc2428c,_0x1f1637){logger[_0x7261('0x31')](_0x7261('0x32'));return request({'method':_0x7261('0x33'),'uri':util[_0x7261('0x34')](_0x7261('0x35'),_0x197ff3),'qs':{'type':_0x7261('0x36')},'headers':{'Authorization':_0x7261('0x37')+_0x5acf91},'json':!![]})[_0x7261('0x2b')](function(_0x245558){if(_0x245558['users']){var _0x317d20=-0x1;if(_[_0x7261('0x38')](_0x245558[_0x7261('0x39')])){if(!_[_0x7261('0x1d')](_0x1f1637)){_0x317d20=_[_0x7261('0x3a')](_0x245558['users'],function(_0x12c145){return _0x12c145['email']===_0x1f1637;});}if(_0x317d20>=0x0){logger[_0x7261('0x31')](_0x7261('0x3b'));}else{logger['info'](_0x7261('0x3c'));_0x317d20=_[_0x7261('0x3a')](_0x245558[_0x7261('0x39')],function(_0x584560){return _0x584560[_0x7261('0x3d')][_0x7261('0x19')]==='Administrator';});}return _0x245558[_0x7261('0x39')][_0x317d20];}else{if(_0x245558['user'][_0x7261('0x3d')]['name']===_0x7261('0x3e')){logger[_0x7261('0x31')](_0x7261('0x3c'));user=_0x245558[_0x7261('0x3f')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x245558));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x7261('0xf')](_0x245558));}}}else{logger[_0x7261('0x2e')](_0x7261('0x40'),JSON[_0x7261('0xf')](_0x245558));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x7261('0xf')](_0x245558));}})[_0x7261('0x2d')](function(_0x151f29){console[_0x7261('0x2e')](_0x151f29);});}function getZohoUser(_0x3cf499,_0x3d36f5){return new BPromise(function(_0x28971f,_0x30ce2f){request(_0x3cf499)[_0x7261('0x2b')](function(_0x16a288){var _0x4a7c1e=null;if(_0x16a288){_0x4a7c1e=_0x16a288['data'][0x0];_0x4a7c1e['enduserType']=_0x3d36f5;}_0x28971f(_0x4a7c1e);})[_0x7261('0x2d')](function(_0x5f50ab){_0x30ce2f(_0x5f50ab);});});}function createEndUser(_0x5dfe3e,_0x46ea16,_0x25a551,_0x4e2450,_0x2dd4ac,_0x63e940){var _0x25a551=getName(_0x25a551);return request({'method':_0x7261('0x26'),'uri':'https://www.zohoapis.'+_0x46ea16+_0x7261('0x41')+_[_0x7261('0x42')](_0x63e940['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x25a551[0x1],'First_Name':_0x25a551[0x0],'Phone':_0x4e2450,'Owner':{'name':!_[_0x7261('0x1d')](_0x2dd4ac[_0x7261('0x43')][_0x7261('0x19')])?_0x2dd4ac[_0x7261('0x43')]['name']:!_['isNil'](_0x2dd4ac[_0x7261('0x44')])?_0x2dd4ac[_0x7261('0x44')]+'\x20'+_0x2dd4ac[_0x7261('0x45')]:_0x2dd4ac['last_name'],'id':_0x2dd4ac['id']}}]},'headers':{'Authorization':_0x7261('0x37')+_0x5dfe3e},'json':!![]})[_0x7261('0x2b')](function(_0x50e18a){if(_0x50e18a&&_0x50e18a['data'][0x0][_0x7261('0x46')]===_0x7261('0x47')){var _0x39027d=_0x50e18a[_0x7261('0x48')][0x0]['details'];_0x39027d[_0x7261('0x49')]=_[_0x7261('0x42')](_0x63e940[_0x7261('0x4a')])+'s';return _0x39027d;}logger['error'](_0x7261('0x40'),JSON['stringify'](data));throw new Error(_0x7261('0x4b')+JSON[_0x7261('0xf')](data));})[_0x7261('0x2d')](function(_0x339f53){console[_0x7261('0x4c')]('CREATE\x20ERROR',_0x339f53);});}function getEndUser(_0x12f9b0,_0x250493,_0x59c9eb,_0x3ec6ec,_0x2e6148,_0x2d10cd,_0x49f60a){var _0x18ab3b={'method':_0x7261('0x33'),'uri':'','headers':{'Authorization':_0x7261('0x37')+_0x12f9b0},'json':!![]};switch(_0x49f60a[_0x7261('0x4d')]){case _0x7261('0x4e'):_0x18ab3b['uri']=_0x7261('0x4f')+_0x250493+_0x7261('0x50')+_0x2e6148+'))';return getZohoUser(_0x18ab3b,_0x7261('0x51'))[_0x7261('0x2b')](function(_0x154ca5){if(_0x154ca5)return _0x154ca5;_0x18ab3b[_0x7261('0x52')]=_0x7261('0x4f')+_0x250493+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2e6148+'))';return getZohoUser(_0x18ab3b,_0x7261('0x53'))[_0x7261('0x2b')](function(_0x1befa5){if(_0x1befa5)return _0x1befa5;if(_0x49f60a['moduleCreate']!=_0x7261('0x54')){return createEndUser(_0x12f9b0,_0x250493,_0x3ec6ec,_0x2e6148,_0x2d10cd,_0x49f60a);}else{return{};}});});break;case'contact':_0x18ab3b[_0x7261('0x52')]=_0x7261('0x4f')+_0x250493+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2e6148+'))';return getZohoUser(_0x18ab3b,'Contacts')[_0x7261('0x2b')](function(_0x27cc1b){if(_0x27cc1b)return _0x27cc1b;if(_0x49f60a['moduleCreate']!=_0x7261('0x54')){return createEndUser(_0x12f9b0,_0x250493,_0x3ec6ec,_0x2e6148,_0x2d10cd,_0x49f60a);}else{return{};}});break;case'lead':_0x18ab3b[_0x7261('0x52')]=_0x7261('0x4f')+_0x250493+_0x7261('0x55')+_0x2e6148+'))';return getZohoUser(_0x18ab3b,'Leads')[_0x7261('0x2b')](function(_0x524b2e){if(_0x524b2e)return _0x524b2e;if(_0x49f60a['moduleCreate']!=_0x7261('0x54')){return createEndUser(_0x12f9b0,_0x250493,_0x3ec6ec,_0x2e6148,_0x2d10cd,_0x49f60a);}else{return{};}});break;}}function getCall(_0x47e2af,_0x524698,_0x52e012,_0xa1c87b,_0x2ee0e5,_0x138e3a,_0x518337,_0x4befea){logger['info'](_0x7261('0x56'));var _0x3d9293={};_0x3d9293[_0x7261('0x57')]={'name':!_['isNil'](_0xa1c87b[_0x7261('0x43')]['name'])&&!_[_0x7261('0x1d')](_0xa1c87b[_0x7261('0x3d')][_0x7261('0x19')])&&_0xa1c87b[_0x7261('0x3d')][_0x7261('0x19')]===_0x7261('0x58')?_0xa1c87b[_0x7261('0x43')]['name']:!_[_0x7261('0x1d')](_0xa1c87b[_0x7261('0x44')])?_0xa1c87b[_0x7261('0x44')]+'\x20'+_0xa1c87b['last_name']:_0xa1c87b[_0x7261('0x45')],'id':_0xa1c87b['id']};_0x3d9293['Subject']=intUtil[_0x7261('0x59')](_0x138e3a[_0x7261('0x5a')],_0x518337,'\x20');_0x3d9293[_0x7261('0x5b')]=intUtil[_0x7261('0x59')](_0x138e3a[_0x7261('0x5c')],_0x518337,'\x0a');if(_0x2ee0e5[_0x7261('0x49')]==='Contacts'){_0x3d9293['Who_Id']={'name':!_[_0x7261('0x1d')](_0x2ee0e5[_0x7261('0x5d')])?_0x2ee0e5[_0x7261('0x5d')]:!_[_0x7261('0x1d')](_0x2ee0e5['First_Name'])?_0x2ee0e5['First_Name']+'\x20'+_0x2ee0e5[_0x7261('0x5e')]:_0x2ee0e5[_0x7261('0x5e')],'id':_0x2ee0e5['id']};}if(_0x2ee0e5[_0x7261('0x49')]===_0x7261('0x53')){_0x3d9293[_0x7261('0x5f')]={'name':!_['isNil'](_0x2ee0e5[_0x7261('0x5d')])?_0x2ee0e5[_0x7261('0x5d')]:!_[_0x7261('0x1d')](_0x2ee0e5[_0x7261('0x60')])?_0x2ee0e5[_0x7261('0x60')]+'\x20'+_0x2ee0e5[_0x7261('0x5e')]:_0x2ee0e5[_0x7261('0x5e')],'id':_0x2ee0e5['id']};_0x3d9293[_0x7261('0x61')]=_[_0x7261('0x42')](_0x2ee0e5[_0x7261('0x49')]);}if(_0x518337[_0x7261('0x62')]){_0x3d9293[_0x7261('0x63')]=moment[_0x7261('0x64')](parseInt(_0x518337['talktime'])*0x3e8)[_0x7261('0x34')](_0x7261('0x65'));}else if(_0x518337[_0x7261('0x66')]&&_0x518337['endtime']){_0x3d9293['Call_Duration']=moment['utc'](moment(_0x518337[_0x7261('0x67')],_0x7261('0x68'))['diff'](moment(_0x518337[_0x7261('0x69')],_0x7261('0x68'))))['format']('mm:ss');}switch(_0x518337['lastevent']){case _0x7261('0x6a'):_0x3d9293[_0x7261('0x6b')]=_0x7261('0x6c');break;case _0x7261('0x6d'):case _0x7261('0x6e'):_0x3d9293[_0x7261('0x6b')]='Answered';break;case _0x7261('0x6f'):_0x3d9293[_0x7261('0x6b')]=_0x7261('0x70');break;case _0x7261('0x71'):_0x3d9293['Call_Result']='Abandoned';break;case _0x7261('0x72'):_0x3d9293[_0x7261('0x6b')]=_0x7261('0x73');default:}_0x3d9293[_0x7261('0x74')]=(_0x4befea==='outbound'?moment(_0x518337[_0x7261('0x69')])[_0x7261('0x34')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x518337[_0x7261('0x75')])[_0x7261('0x34')](_0x7261('0x68')))||moment()['format'](_0x7261('0x68'));_0x3d9293[_0x7261('0x76')]=_0x4befea||'Inbound';_0x3d9293=_[_0x7261('0x77')](_0x3d9293,getCustomFields(_0x138e3a[_0x7261('0x78')],_0x518337));return request({'method':_0x7261('0x26'),'uri':_0x7261('0x4f')+_0x524698+'/crm/v2/Calls','headers':{'Authorization':_0x7261('0x37')+_0x47e2af},'body':{'data':[_0x3d9293]},'json':!![]})[_0x7261('0x2b')](function(_0x8316bc){if(_0x8316bc&&_0x8316bc[_0x7261('0x48')][0x0]['code']===_0x7261('0x47')){logger[_0x7261('0x31')](_0x7261('0x79'));return{'id':_0x8316bc[_0x7261('0x48')][0x0][_0x7261('0x7a')]['id']};}})[_0x7261('0x2d')](function(_0x8b2068){logger[_0x7261('0x31')]('err',_0x8b2068[_0x7261('0x30')]);console[_0x7261('0x4c')](_0x7261('0x7b'),_0x8b2068);});}exports[_0x7261('0x7c')]=function(_0x3ab700,_0x4c6eff,_0x5eada1,_0x3acda2,_0x3123b2,_0x273579){var _0xbc2ed0,_0x1e2a03,_0x34bccf;_0x273579[_0x7261('0x7d')]=intUtil[_0x7261('0x7e')](_0x273579[_0x7261('0x7d')]);_0x273579[_0x7261('0x7f')]=intUtil[_0x7261('0x7e')](_0x273579[_0x7261('0x7f')]);if(_0x3123b2&&_0x3123b2[_0x7261('0x80')]){logger['info']('[QUEUE]',_0x7261('0x81'));_0x4c6eff[_0x7261('0x82')]=_0x273579[_0x7261('0x7f')]+'/api/voice/recordings/'+_0x4c6eff[_0x7261('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x4c6eff[_0x7261('0x83')]);}else{_0x4c6eff[_0x7261('0x82')]='';}var _0x1d55db=_0x273579[_0x7261('0x7d')]==='zoho.eu'?'eu':_0x7261('0x84');return getAccessToken(_0x273579)[_0x7261('0x2b')](function(_0x930214){_0x34bccf=_0x930214;return getUser(_0x34bccf,_0x1d55db,_0x273579,_0x3acda2[_0x7261('0x85')]);})[_0x7261('0x2b')](function(_0x4a1cc9){_0xbc2ed0=_0x4a1cc9;logger['info'](_0x7261('0x86'),_0xbc2ed0['id']);return getEndUser(_0x34bccf,_0x1d55db,_0x273579,_0x4c6eff[_0x7261('0x87')],_0x4c6eff['calleridnum'],_0xbc2ed0,_0x5eada1);})[_0x7261('0x2b')](function(_0x36f3db){_0x1e2a03=_0x36f3db;return getCall(_0x34bccf,_0x1d55db,_0x273579,_0xbc2ed0,_0x1e2a03,_0x5eada1,_0x4c6eff,'Inbound');})[_0x7261('0x2b')](function(_0x3b24af){if(_0x3b24af){logger[_0x7261('0x31')](_0x7261('0x88'),_0x3b24af['id']);logger[_0x7261('0x31')](_0x7261('0x89'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x7261('0x8a'),_0x3acda2[_0x7261('0x19')]),_0x7261('0x8b'),{'uri':_0x7261('0x8c')+_0x273579[_0x7261('0x7d')]+_0x7261('0x8d')+_0x3b24af['id']});}})[_0x7261('0x2d')](function(_0x62d2f2){logger[_0x7261('0x2e')]('[QUEUE]',JSON['stringify'](_0x62d2f2));});};exports[_0x7261('0x8e')]=function(_0x4c959b,_0x4abec1,_0x39a98e,_0x875061,_0x4f588a,_0x3cc8b6,_0x361385){var _0x5f0ede,_0x189bdb,_0x49be88;_0x3cc8b6['host']=intUtil[_0x7261('0x7e')](_0x3cc8b6['host']);_0x3cc8b6[_0x7261('0x7f')]=intUtil['stripTrailingSlash'](_0x3cc8b6[_0x7261('0x7f')]);if(_0x361385&&_0x361385[_0x7261('0x8f')]&&_0x361385[_0x7261('0x8f')]!=='none'){logger[_0x7261('0x31')](_0x7261('0x90'),_0x7261('0x81'));_0x4abec1[_0x7261('0x82')]=_0x3cc8b6['serverUrl']+_0x7261('0x91')+_0x4abec1[_0x7261('0x83')]+_0x7261('0x92')+md5(_0x4abec1['uniqueid']);}var _0x3d8d34=_0x3cc8b6[_0x7261('0x7d')]==='zoho.eu'?'eu':_0x7261('0x84');return getAccessToken(_0x3cc8b6)[_0x7261('0x2b')](function(_0x1c14ce){_0x49be88=_0x1c14ce;return getUser(_0x49be88,_0x3d8d34,_0x3cc8b6,_0x875061[_0x7261('0x85')]);})['then'](function(_0x53a131){_0x5f0ede=_0x53a131;logger[_0x7261('0x31')]('The\x20User\x20ID\x20is:',_0x5f0ede['id']);return getEndUser(_0x49be88,_0x3d8d34,_0x3cc8b6,_0x4abec1[_0x7261('0x93')],_0x4abec1[_0x7261('0x94')],_0x5f0ede,_0x39a98e);})[_0x7261('0x2b')](function(_0x63dcf0){_0x189bdb=_0x63dcf0;return getCall(_0x49be88,_0x3d8d34,_0x3cc8b6,_0x5f0ede,_0x189bdb,_0x39a98e,_0x4abec1,_0x7261('0x95'));})[_0x7261('0x2b')](function(_0x2b6287){if(_0x2b6287){logger[_0x7261('0x31')](_0x7261('0x88'),_0x2b6287['id']);logger['info'](_0x7261('0x90'),_0x7261('0x96'));emit(util['format'](_0x7261('0x8a'),_0x875061['name']),'trigger:browser:url',{'uri':_0x7261('0x8c')+_0x3cc8b6[_0x7261('0x7d')]+_0x7261('0x8d')+_0x2b6287['id']});}})[_0x7261('0x2d')](function(_0x36a034){logger[_0x7261('0x2e')](_0x7261('0x90'),JSON[_0x7261('0xf')](_0x36a034));});};exports['unmanaged']=function(_0x3249a5,_0x1bdd12,_0x5f16a2,_0x5b45f8,_0x5d95d0,_0x90220){var _0x38b262,_0x19e337,_0x53eefd;_0x90220[_0x7261('0x7d')]=intUtil['stripTrailingSlash'](_0x90220[_0x7261('0x7d')]);_0x90220['serverUrl']=intUtil['stripTrailingSlash'](_0x90220[_0x7261('0x7f')]);if(_0x5d95d0&&_0x5d95d0[_0x7261('0x80')]){logger[_0x7261('0x31')]('['+_0x1bdd12[_0x7261('0x97')][_0x7261('0x98')]()+']','Recording\x20is\x20enabled!');_0x1bdd12[_0x7261('0x82')]=_0x90220[_0x7261('0x7f')]+'/api/voice/recordings/'+_0x1bdd12[_0x7261('0x83')]+_0x7261('0x92')+md5(_0x1bdd12['uniqueid']);}else{_0x1bdd12[_0x7261('0x82')]='';}var _0x572712=_0x90220['host']===_0x7261('0x99')?'eu':_0x7261('0x84');return getAccessToken(_0x90220)['then'](function(_0x3687a0){_0x53eefd=_0x3687a0;return getUser(_0x53eefd,_0x572712,_0x90220);})[_0x7261('0x2b')](function(_0xaf541){_0x38b262=_0xaf541;logger[_0x7261('0x31')](_0x7261('0x86'),_0x38b262['id']);return getEndUser(_0x53eefd,_0x572712,_0x90220,_0x1bdd12[_0x7261('0x87')],_0x1bdd12[_0x7261('0x9a')],_0x38b262,_0x5f16a2);})['then'](function(_0x15a966){_0x19e337=_0x15a966;return getCall(_0x53eefd,_0x572712,_0x90220,_0x38b262,_0x19e337,_0x5f16a2,_0x1bdd12,_0x7261('0x9b'));})[_0x7261('0x2b')](function(_0x5c9945){if(_0x5c9945){logger[_0x7261('0x31')]('The\x20Call\x20ID\x20is:',_0x5c9945['id']);}})[_0x7261('0x2d')](function(_0x4cce9c){logger[_0x7261('0x2e')]('['+_0x1bdd12[_0x7261('0x97')][_0x7261('0x98')]()+']',JSON[_0x7261('0xf')](_0x4cce9c));});}; \ 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 f34e598..4d1673c 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 _0xb946=['exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb946,0x8d));var _0x6b94=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xb946[_0x24061a];return _0x82054e;};'use strict';var util=require(_0x6b94('0x0'));var sh=require(_0x6b94('0x1'));var Mustache=require(_0x6b94('0x2'));var logger=require('../../../../config/logger')('trigger');exports[_0x6b94('0x3')]=function(_0xe99961,_0x3cd23a){var _0x326fcd=_0xe99961[_0x6b94('0x4')]?_0xe99961['data2']:_0x6b94('0x5');var _0x11f5ba=_0xe99961[_0x6b94('0x6')]?Mustache[_0x6b94('0x7')](_0xe99961[_0x6b94('0x6')],_0x3cd23a):_0x3cd23a;sh[_0x6b94('0x3')](_0x11f5ba,function(_0x27545f,_0x28c691,_0x4567a9){if(_0x27545f!==0x0){logger[_0x6b94('0x8')](util[_0x6b94('0x9')](_0x6b94('0xa'),_0x326fcd,_0x11f5ba,_0x27545f,_0x4567a9));}else{logger['info'](util[_0x6b94('0x9')](_0x6b94('0xb'),_0x326fcd,_0x11f5ba,_0x28c691));}});}; \ No newline at end of file +var _0x35a0=['trigger','data2','Script','data3','render','exec','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger'];(function(_0x4008de,_0x15f2e9){var _0x596738=function(_0x2d4060){while(--_0x2d4060){_0x4008de['push'](_0x4008de['shift']());}};_0x596738(++_0x15f2e9);}(_0x35a0,0x76));var _0x035a=function(_0x4651ae,_0x3d2bc0){_0x4651ae=_0x4651ae-0x0;var _0x29a97c=_0x35a0[_0x4651ae];return _0x29a97c;};'use strict';var util=require('util');var sh=require(_0x035a('0x0'));var Mustache=require(_0x035a('0x1'));var logger=require(_0x035a('0x2'))(_0x035a('0x3'));exports['exec']=function(_0x2fcb6d,_0x5baf7c){var _0x15f69c=_0x2fcb6d[_0x035a('0x4')]?_0x2fcb6d[_0x035a('0x4')]:_0x035a('0x5');var _0x36c841=_0x2fcb6d[_0x035a('0x6')]?Mustache[_0x035a('0x7')](_0x2fcb6d[_0x035a('0x6')],_0x5baf7c):_0x5baf7c;sh[_0x035a('0x8')](_0x36c841,function(_0x4ca235,_0xfd60dd,_0x56b57a){if(_0x4ca235!==0x0){logger['error'](util[_0x035a('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x15f69c,_0x36c841,_0x4ca235,_0x56b57a));}else{logger['info'](util[_0x035a('0x9')](_0x035a('0xa'),_0x15f69c,_0x36c841,_0xfd60dd));}});}; \ 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 a173505..b07afa9 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 _0x9c92=['body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','lodash','mustache','../../../../config/logger','data1','render','data2','data5','number','data6','parse','stack','GET','DELETE','data7'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x9c92,0x1b3));var _0x29c9=function(_0x545951,_0x1c81dc){_0x545951=_0x545951-0x0;var _0x38b27d=_0x9c92[_0x545951];return _0x38b27d;};'use strict';var rp=require(_0x29c9('0x0'));var util=require('util');var _=require(_0x29c9('0x1'));var Mustache=require(_0x29c9('0x2'));var logger=require(_0x29c9('0x3'))('trigger');exports['exec']=function(_0x23dd69,_0x308587){var _0x525a84,_0x15df93;var _0x18aebc={'method':_0x23dd69[_0x29c9('0x4')]['toUpperCase'](),'uri':Mustache[_0x29c9('0x5')](_0x23dd69[_0x29c9('0x6')],_0x308587),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x23dd69[_0x29c9('0x7')])===_0x29c9('0x8')&&parseInt(_0x23dd69['data5'])>=0x1&&parseInt(_0x23dd69['data5'])<=0xa?parseInt(_0x23dd69[_0x29c9('0x7')])*0x3e8:0x5*0x3e8};try{_0x18aebc['headers']=_0x23dd69[_0x29c9('0x9')]?JSON[_0x29c9('0xa')](Mustache[_0x29c9('0x5')](_0x23dd69[_0x29c9('0x9')],_0x308587)):{};}catch(_0x1ca09f){logger['error'](_0x1ca09f[_0x29c9('0xb')]);}switch(_0x23dd69[_0x29c9('0x4')]['toUpperCase']()){case _0x29c9('0xc'):case _0x29c9('0xd'):_0x525a84=null;_0x18aebc['qs']=_0x308587;break;case'POST':case'PUT':if(_0x23dd69[_0x29c9('0xe')]){try{_0x525a84=JSON[_0x29c9('0xa')](Mustache[_0x29c9('0x5')](_0x23dd69[_0x29c9('0xe')],_0x308587));_0x18aebc[_0x29c9('0xf')]=_0x525a84;}catch(_0x106095){logger['error'](_0x106095[_0x29c9('0xb')]);logger[_0x29c9('0x10')](_0x29c9('0x11'));}}else{_0x525a84=_0x308587;_0x18aebc[_0x29c9('0xf')]=_0x525a84;}break;}logger[_0x29c9('0x12')](util[_0x29c9('0x13')](_0x29c9('0x14'),_0x23dd69[_0x29c9('0x4')],_0x23dd69[_0x29c9('0x6')],JSON['stringify'](_0x18aebc)));rp(_0x18aebc)[_0x29c9('0x15')](function(_0x2201ff){_0x525a84=!_[_0x29c9('0x16')](_0x525a84)?',\x20request\x20body:\x20'+_0x525a84:'';_0x15df93=typeof _0x2201ff[_0x29c9('0xf')]==='object'?JSON[_0x29c9('0x17')](_0x2201ff['body']):_0x2201ff[_0x29c9('0xf')];logger[_0x29c9('0x12')](util[_0x29c9('0x13')](_0x29c9('0x18'),_0x23dd69[_0x29c9('0x4')],_0x23dd69[_0x29c9('0x6')],_0x2201ff[_0x29c9('0x19')],_0x15df93));})[_0x29c9('0x1a')](function(_0x39ba2d){logger['error'](util['format'](_0x29c9('0x1b'),_0x23dd69['data1'],_0x23dd69[_0x29c9('0x6')],_0x39ba2d[_0x29c9('0x19')],_0x39ba2d[_0x29c9('0x1c')],_0x39ba2d[_0x29c9('0x1d')]));});}; \ No newline at end of file +var _0xca35=['data2','data5','headers','parse','render','data6','error','stack','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','message','request-promise','util','mustache','../../../../config/logger','exec','data1','toUpperCase'];(function(_0x39f10c,_0x4d5802){var _0x2c4194=function(_0x5401a2){while(--_0x5401a2){_0x39f10c['push'](_0x39f10c['shift']());}};_0x2c4194(++_0x4d5802);}(_0xca35,0x199));var _0x5ca3=function(_0x4cd14a,_0x3c08b4){_0x4cd14a=_0x4cd14a-0x0;var _0x59ac6a=_0xca35[_0x4cd14a];return _0x59ac6a;};'use strict';var rp=require(_0x5ca3('0x0'));var util=require(_0x5ca3('0x1'));var _=require('lodash');var Mustache=require(_0x5ca3('0x2'));var logger=require(_0x5ca3('0x3'))('trigger');exports[_0x5ca3('0x4')]=function(_0x4302ab,_0xd95380){var _0x588df6,_0x40b830;var _0x40e805={'method':_0x4302ab[_0x5ca3('0x5')][_0x5ca3('0x6')](),'uri':Mustache['render'](_0x4302ab[_0x5ca3('0x7')],_0xd95380),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4302ab[_0x5ca3('0x8')])==='number'&&parseInt(_0x4302ab[_0x5ca3('0x8')])>=0x1&&parseInt(_0x4302ab['data5'])<=0xa?parseInt(_0x4302ab[_0x5ca3('0x8')])*0x3e8:0x5*0x3e8};try{_0x40e805[_0x5ca3('0x9')]=_0x4302ab['data6']?JSON[_0x5ca3('0xa')](Mustache[_0x5ca3('0xb')](_0x4302ab[_0x5ca3('0xc')],_0xd95380)):{};}catch(_0x126beb){logger[_0x5ca3('0xd')](_0x126beb[_0x5ca3('0xe')]);}switch(_0x4302ab[_0x5ca3('0x5')][_0x5ca3('0x6')]()){case _0x5ca3('0xf'):case _0x5ca3('0x10'):_0x588df6=null;_0x40e805['qs']=_0xd95380;break;case _0x5ca3('0x11'):case _0x5ca3('0x12'):if(_0x4302ab[_0x5ca3('0x13')]){try{_0x588df6=JSON[_0x5ca3('0xa')](Mustache[_0x5ca3('0xb')](_0x4302ab[_0x5ca3('0x13')],_0xd95380));_0x40e805[_0x5ca3('0x14')]=_0x588df6;}catch(_0x356f2b){logger[_0x5ca3('0xd')](_0x356f2b[_0x5ca3('0xe')]);logger[_0x5ca3('0xd')](_0x5ca3('0x15'));}}else{_0x588df6=_0xd95380;_0x40e805['body']=_0x588df6;}break;}logger[_0x5ca3('0x16')](util[_0x5ca3('0x17')](_0x5ca3('0x18'),_0x4302ab[_0x5ca3('0x5')],_0x4302ab['data2'],JSON[_0x5ca3('0x19')](_0x40e805)));rp(_0x40e805)[_0x5ca3('0x1a')](function(_0x572a21){_0x588df6=!_['isNil'](_0x588df6)?_0x5ca3('0x1b')+_0x588df6:'';_0x40b830=typeof _0x572a21[_0x5ca3('0x14')]===_0x5ca3('0x1c')?JSON[_0x5ca3('0x19')](_0x572a21[_0x5ca3('0x14')]):_0x572a21['body'];logger[_0x5ca3('0x16')](util[_0x5ca3('0x17')](_0x5ca3('0x1d'),_0x4302ab['data1'],_0x4302ab[_0x5ca3('0x7')],_0x572a21['statusCode'],_0x40b830));})[_0x5ca3('0x1e')](function(_0x3b6177){logger[_0x5ca3('0xd')](util[_0x5ca3('0x17')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x4302ab[_0x5ca3('0x5')],_0x4302ab[_0x5ca3('0x7')],_0x3b6177['statusCode'],_0x3b6177['name'],_0x3b6177[_0x5ca3('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 5d3f928..93cab81 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 _0x9ad4=['result','exports','jayson/promise','../../config/logger','http','Request','request','debug','rpc','routing','error','message'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x9ad4,0x1e2));var _0x49ad=function(_0x83d48e,_0x507328){_0x83d48e=_0x83d48e-0x0;var _0x26f1d1=_0x9ad4[_0x83d48e];return _0x26f1d1;};'use strict';var jayson=require(_0x49ad('0x0'));var BPromise=require('bluebird');var logger=require(_0x49ad('0x1'))('routing');var client=jayson['client'][_0x49ad('0x2')]({'port':0x2329});client[_0x49ad('0x3')]=function(_0x3f29ae,_0x55f7e8){return new BPromise(function(_0x1d2a12,_0x4fcd78){return client[_0x49ad('0x4')](_0x3f29ae,_0x55f7e8)['then'](function(_0x4662c3){logger[_0x49ad('0x5')](_0x49ad('0x6'),_0x49ad('0x7'),_0x3f29ae,_0x55f7e8,_0x4662c3);if(_0x4662c3['error']){logger[_0x49ad('0x8')]('rpc',_0x49ad('0x7'),_0x3f29ae,_0x4662c3[_0x49ad('0x8')][_0x49ad('0x9')],_0x55f7e8);return _0x4fcd78(_0x4662c3[_0x49ad('0x8')][_0x49ad('0x9')]);}else{return _0x1d2a12(_0x4662c3[_0x49ad('0xa')]);}})['catch'](function(_0x4ffa75){logger[_0x49ad('0x8')](_0x49ad('0x6'),'routing',_0x3f29ae,_0x4ffa75,_0x55f7e8);return _0x4fcd78(_0x4ffa75);});});};module[_0x49ad('0xb')]=client; \ No newline at end of file +var _0x4e5e=['../../config/logger','routing','client','http','Request','request','rpc','error','message','result','catch','exports','jayson/promise','bluebird'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x4e5e,0x14e));var _0xe4e5=function(_0x13791a,_0xc4218e){_0x13791a=_0x13791a-0x0;var _0x116430=_0x4e5e[_0x13791a];return _0x116430;};'use strict';var jayson=require(_0xe4e5('0x0'));var BPromise=require(_0xe4e5('0x1'));var logger=require(_0xe4e5('0x2'))(_0xe4e5('0x3'));var client=jayson[_0xe4e5('0x4')][_0xe4e5('0x5')]({'port':0x2329});client[_0xe4e5('0x6')]=function(_0x122810,_0x53d4f8){return new BPromise(function(_0x2d4551,_0x3807d2){return client[_0xe4e5('0x7')](_0x122810,_0x53d4f8)['then'](function(_0x214fdb){logger['debug'](_0xe4e5('0x8'),_0xe4e5('0x3'),_0x122810,_0x53d4f8,_0x214fdb);if(_0x214fdb[_0xe4e5('0x9')]){logger[_0xe4e5('0x9')]('rpc',_0xe4e5('0x3'),_0x122810,_0x214fdb[_0xe4e5('0x9')][_0xe4e5('0xa')],_0x53d4f8);return _0x3807d2(_0x214fdb[_0xe4e5('0x9')]['message']);}else{return _0x2d4551(_0x214fdb[_0xe4e5('0xb')]);}})[_0xe4e5('0xc')](function(_0x275692){logger[_0xe4e5('0x9')]('rpc',_0xe4e5('0x3'),_0x122810,_0x275692,_0x53d4f8);return _0x3807d2(_0x275692);});});};module[_0xe4e5('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 6fac396..2b50ecc 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 _0x7c07=['catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','email','getMailAccounts','then','initMailAccounts','listen','getSettings','loginMailFrequency'];(function(_0x1f4e75,_0x2520a1){var _0x31103a=function(_0x2352fe){while(--_0x2352fe){_0x1f4e75['push'](_0x1f4e75['shift']());}};_0x31103a(++_0x2520a1);}(_0x7c07,0xd5));var _0x77c0=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x7c07[_0xf0bcac];return _0x4e4c65;};'use strict';var server=require(_0x77c0('0x0'));var Realtime=require(_0x77c0('0x1'));var EmailChannel=require(_0x77c0('0x2'));var mailAccount=require(_0x77c0('0x3'));var setting=require(_0x77c0('0x4'));var logger=require('../../config/logger')(_0x77c0('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount[_0x77c0('0x6')]())[_0x77c0('0x7')](realtime[_0x77c0('0x8')]())[_0x77c0('0x7')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x77c0('0x9')](realtime,email)[_0x77c0('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0x77c0('0xa')]();})[_0x77c0('0x7')](function(_0x25e195){return setInterval(initRealtime,_0x25e195[_0x77c0('0xb')]*0x3e8);})[_0x77c0('0xc')](function(_0x4dd8d7){logger[_0x77c0('0xd')](_0x77c0('0xe'),_0x4dd8d7);});}main(); \ No newline at end of file +var _0x7ac0=['catch','error','Email\x20service\x20initialization','./lib/email','../../config/logger','email','resolve','then','getMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7ac0,0x145));var _0x07ac=function(_0x51fa75,_0x5171ca){_0x51fa75=_0x51fa75-0x0;var _0x648a6e=_0x7ac0[_0x51fa75];return _0x648a6e;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x07ac('0x0'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0x07ac('0x1'))(_0x07ac('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x07ac('0x3')]()[_0x07ac('0x4')](mailAccount[_0x07ac('0x5')]())[_0x07ac('0x4')](realtime['initMailAccounts']())['then'](function(){email[_0x07ac('0x6')](realtime[_0x07ac('0x7')]);return realtime;});}function main(){return server[_0x07ac('0x8')](realtime,email)[_0x07ac('0x4')](function(){return initRealtime();})['then'](function(){return setting[_0x07ac('0x9')]();})[_0x07ac('0x4')](function(_0xd97bf2){return setInterval(initRealtime,_0xd97bf2[_0x07ac('0xa')]*0x3e8);})[_0x07ac('0xb')](function(_0x251089){logger[_0x07ac('0xc')](_0x07ac('0xd'),_0x251089);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 712fce2..e40c311 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 _0x77e6=['lastSync','messageStatus','sendMail','smtp','verifySmtp','Smtp','verify','then','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','info','start\x20email\x20channel','imapAccounts','emit','mailAccounts','name','active','status','Imap','total','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x77e6,0x1a0));var _0x677e=function(_0x20c20f,_0x2174cf){_0x20c20f=_0x20c20f-0x0;var _0x29004b=_0x77e6[_0x20c20f];return _0x29004b;};'use strict';var _=require(_0x677e('0x0'));var moment=require(_0x677e('0x1'));var BPromise=require(_0x677e('0x2'));var md5=require(_0x677e('0x3'));var Redis=require(_0x677e('0x4'));var config=require(_0x677e('0x5'));var logger=require(_0x677e('0x6'))(_0x677e('0x7'));config[_0x677e('0x8')]=_[_0x677e('0x9')](config[_0x677e('0x8')],{'host':_0x677e('0xa'),'port':0x18eb});var io=require(_0x677e('0xb'))(new Redis(config[_0x677e('0x8')]));var EmailImap=require(_0x677e('0xc'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0xf42b3a){logger[_0x677e('0xd')](_0x677e('0xe'));this['mailAccounts']=_0xf42b3a['mailAccounts'];this[_0x677e('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x677e('0x10')]=function(_0x84a6a8){var _0x206b02=this[_0x677e('0x11')][_0x84a6a8];var _0x263771={'id':_0x206b02['id'],'name':_0x206b02[_0x677e('0x12')],'key':_0x206b02['key'],'active':_0x206b02[_0x677e('0x13')],'Imap':{'status':_0x206b02['Imap'][_0x677e('0x14')],'messageStatus':_0x206b02[_0x677e('0x15')]['messageStatus'],'total':_0x206b02[_0x677e('0x15')][_0x677e('0x16')]}};if(_[_0x677e('0x17')](md5Accounts[_0x84a6a8])){md5Accounts[_0x84a6a8]={};}var _0x280b48=md5(JSON[_0x677e('0x18')](_0x263771));if(md5Accounts[_0x84a6a8][_0x677e('0x3')]!==_0x280b48){md5Accounts[_0x84a6a8][_0x677e('0x3')]=_0x280b48;io[_0x677e('0x10')](_0x677e('0x19'),_0x263771);}};EmailChannel[_0x677e('0x1a')][_0x677e('0x1b')]=function(_0x1bcb36){for(var _0x5537c1 in _0x1bcb36){if(_0x1bcb36[_0x677e('0x1c')](_0x5537c1)){if(_0x1bcb36[_0x5537c1][_0x677e('0x15')]&&_0x1bcb36[_0x5537c1][_0x677e('0x13')]){var _0x15e1f2=_0x1bcb36[_0x5537c1]['Imap'];if(!_0x15e1f2[_0x677e('0x1d')]&&_0x1bcb36[_0x5537c1][_0x677e('0x1e')]!==_0x677e('0x1f'))_0x15e1f2[_0x677e('0x1d')]=_0x1bcb36[_0x5537c1][_0x677e('0x1e')];if(!this[_0x677e('0xf')][_0x677e('0x1c')](_0x15e1f2['id'])){this[_0x677e('0xf')][_0x15e1f2['id']]=new EmailImap(_0x15e1f2,_0x1bcb36[_0x5537c1]['email']);this[_0x677e('0xf')][_0x15e1f2['id']]['on'](_0x677e('0x20'),this[_0x677e('0x21')][_0x677e('0x22')](this,_0x5537c1));this[_0x677e('0xf')][_0x15e1f2['id']]['on'](_0x677e('0x7'),this[_0x677e('0x23')][_0x677e('0x22')](this,_0x5537c1));this[_0x677e('0xf')][_0x15e1f2['id']]['on'](_0x677e('0x24'),this[_0x677e('0x25')][_0x677e('0x22')](this,_0x5537c1));this['imapAccounts'][_0x15e1f2['id']]['on'](_0x677e('0x26'),this[_0x677e('0x27')]['bind'](this,_0x5537c1));}}else{if(_[_0x677e('0x17')](this[_0x677e('0x11')][_0x5537c1][_0x677e('0x15')])){this['mailAccounts'][_0x5537c1][_0x677e('0x15')]={};}this[_0x677e('0x11')][_0x5537c1][_0x677e('0x15')][_0x677e('0x14')]=_0x677e('0x28');this['mailAccounts'][_0x5537c1]['Imap']['messageStatus']='';this[_0x677e('0x10')](_0x5537c1);}}}};EmailChannel[_0x677e('0x1a')][_0x677e('0x21')]=function(_0x5f0ec4,_0x417f90){if(this['mailAccounts'][_0x5f0ec4]){this[_0x677e('0x11')][_0x5f0ec4][_0x677e('0x15')][_0x677e('0x14')]=_0x677e('0x29');this[_0x677e('0x11')][_0x5f0ec4][_0x677e('0x15')]['messageStatus']=_0x417f90[_0x677e('0x12')];if(_0x417f90[_0x677e('0x2a')]){this[_0x677e('0x11')][_0x5f0ec4]['Imap'][_0x677e('0x16')]=_0x417f90[_0x677e('0x2a')][_0x677e('0x16')];}return this[_0x677e('0x10')](_0x5f0ec4);}};EmailChannel[_0x677e('0x1a')][_0x677e('0x23')]=function(_0x17a7da,_0x5ef3c6){logger['info'](_0x677e('0x2b'),_0x5ef3c6['firstName'],_0x5ef3c6['lastName'],_0x5ef3c6[_0x677e('0x2c')],_0x17a7da);if(this[_0x677e('0x11')][_0x17a7da]){return mailAccount[_0x677e('0x2d')](_0x17a7da,_0x5ef3c6)['then'](function(_0x517a7d){if(_0x517a7d){logger[_0x677e('0xd')]('Mail\x20accepted\x20from\x20routing');}})[_0x677e('0x2e')](function(_0x27e5ae){logger['error'](_0x677e('0x2f'),JSON[_0x677e('0x18')](_0x27e5ae));});}};EmailChannel[_0x677e('0x1a')][_0x677e('0x25')]=function(_0x57489c){if(this[_0x677e('0x11')][_0x57489c]&&this[_0x677e('0x11')][_0x57489c]['Imap']){if(this[_0x677e('0xf')][this[_0x677e('0x11')][_0x57489c][_0x677e('0x15')]['id']]){delete this['imapAccounts'][this[_0x677e('0x11')][_0x57489c][_0x677e('0x15')]['id']];}this[_0x677e('0x11')][_0x57489c]['Imap'][_0x677e('0x30')]=moment();this['emit'](_0x57489c);}};EmailChannel['prototype']['handleImapError']=function(_0xf4da2f,_0x37b10f){if(this[_0x677e('0x11')][_0xf4da2f]){this[_0x677e('0x11')][_0xf4da2f][_0x677e('0x15')][_0x677e('0x14')]=_0x677e('0x26');this[_0x677e('0x11')][_0xf4da2f][_0x677e('0x15')][_0x677e('0x31')]=_0x37b10f;return this[_0x677e('0x10')](_0xf4da2f);}};EmailChannel['prototype'][_0x677e('0x32')]=function(_0x3149b9,_0x2de881){return this[_0x677e('0x33')]['send'](_0x3149b9,_0x2de881);};EmailChannel[_0x677e('0x1a')][_0x677e('0x34')]=function(_0x2e3b10){var _0x5ea7e0=this;if(this[_0x677e('0x11')][_0x2e3b10['id']]){if(_[_0x677e('0x17')](this[_0x677e('0x11')][_0x2e3b10['id']][_0x677e('0x35')])){this[_0x677e('0x11')][_0x2e3b10['id']]['Smtp']={};}this[_0x677e('0x11')][_0x2e3b10['id']][_0x677e('0x35')]['lastSync']=moment();return new BPromise(function(_0x4b1f0c,_0x125bcb){return _0x5ea7e0['smtp'][_0x677e('0x36')](_0x2e3b10)[_0x677e('0x37')](function(_0xa8fb33){_0x5ea7e0['mailAccounts'][_0x2e3b10['id']][_0x677e('0x35')][_0x677e('0x14')]=_0x677e('0x38');_0x5ea7e0['mailAccounts'][_0x2e3b10['id']][_0x677e('0x35')]['messageStatus']='';_0x5ea7e0[_0x677e('0x10')](_0x2e3b10['id']);_0x4b1f0c(_0xa8fb33);})[_0x677e('0x2e')](function(_0x531f89){_0x5ea7e0[_0x677e('0x11')][_0x2e3b10['id']][_0x677e('0x35')][_0x677e('0x14')]=_0x677e('0x26');_0x5ea7e0[_0x677e('0x11')][_0x2e3b10['id']][_0x677e('0x35')][_0x677e('0x31')]=_0x531f89;_0x5ea7e0[_0x677e('0x10')](_0x2e3b10['id']);_0x125bcb(_0x531f89);});});}return this['smtp'][_0x677e('0x36')](_0x2e3b10);};module[_0x677e('0x39')]=EmailChannel; \ No newline at end of file +var _0xe9fd=['service','provider','imapAccounts','hasOwnProperty','email','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','disabled','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','then','info','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','sendMail','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','Imap','status','messageStatus','isNil','md5','mailAccount:update','refresh','active'];(function(_0x5aa1c2,_0x1adfb1){var _0x44a665=function(_0x3910ef){while(--_0x3910ef){_0x5aa1c2['push'](_0x5aa1c2['shift']());}};_0x44a665(++_0x1adfb1);}(_0xe9fd,0x176));var _0xde9f=function(_0x54d87e,_0x25dde1){_0x54d87e=_0x54d87e-0x0;var _0x2538c4=_0xe9fd[_0x54d87e];return _0x2538c4;};'use strict';var _=require(_0xde9f('0x0'));var moment=require(_0xde9f('0x1'));var BPromise=require(_0xde9f('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xde9f('0x3'));var logger=require(_0xde9f('0x4'))('email');config[_0xde9f('0x5')]=_[_0xde9f('0x6')](config[_0xde9f('0x5')],{'host':_0xde9f('0x7'),'port':0x18eb});var io=require(_0xde9f('0x8'))(new Redis(config[_0xde9f('0x5')]));var EmailImap=require(_0xde9f('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x258c71){logger['info'](_0xde9f('0xa'));this[_0xde9f('0xb')]=_0x258c71['mailAccounts'];this['imapAccounts']={};this[_0xde9f('0xc')]=new EmailSmtp();}EmailChannel[_0xde9f('0xd')][_0xde9f('0xe')]=function(_0x1fa3e5){var _0x441e8f=this[_0xde9f('0xb')][_0x1fa3e5];var _0x5d68db={'id':_0x441e8f['id'],'name':_0x441e8f[_0xde9f('0xf')],'key':_0x441e8f[_0xde9f('0x10')],'active':_0x441e8f['active'],'Imap':{'status':_0x441e8f[_0xde9f('0x11')][_0xde9f('0x12')],'messageStatus':_0x441e8f['Imap'][_0xde9f('0x13')],'total':_0x441e8f[_0xde9f('0x11')]['total']}};if(_[_0xde9f('0x14')](md5Accounts[_0x1fa3e5])){md5Accounts[_0x1fa3e5]={};}var _0x3ee018=md5(JSON['stringify'](_0x5d68db));if(md5Accounts[_0x1fa3e5][_0xde9f('0x15')]!==_0x3ee018){md5Accounts[_0x1fa3e5][_0xde9f('0x15')]=_0x3ee018;io['emit'](_0xde9f('0x16'),_0x5d68db);}};EmailChannel[_0xde9f('0xd')][_0xde9f('0x17')]=function(_0x378a27){for(var _0x2d8224 in _0x378a27){if(_0x378a27['hasOwnProperty'](_0x2d8224)){if(_0x378a27[_0x2d8224][_0xde9f('0x11')]&&_0x378a27[_0x2d8224][_0xde9f('0x18')]){var _0x21d9d5=_0x378a27[_0x2d8224][_0xde9f('0x11')];if(!_0x21d9d5[_0xde9f('0x19')]&&_0x378a27[_0x2d8224][_0xde9f('0x1a')]!=='custom')_0x21d9d5['service']=_0x378a27[_0x2d8224][_0xde9f('0x1a')];if(!this[_0xde9f('0x1b')][_0xde9f('0x1c')](_0x21d9d5['id'])){this[_0xde9f('0x1b')][_0x21d9d5['id']]=new EmailImap(_0x21d9d5,_0x378a27[_0x2d8224][_0xde9f('0x1d')]);this['imapAccounts'][_0x21d9d5['id']]['on'](_0xde9f('0x1e'),this[_0xde9f('0x1f')][_0xde9f('0x20')](this,_0x2d8224));this[_0xde9f('0x1b')][_0x21d9d5['id']]['on'](_0xde9f('0x1d'),this[_0xde9f('0x21')]['bind'](this,_0x2d8224));this['imapAccounts'][_0x21d9d5['id']]['on'](_0xde9f('0x22'),this[_0xde9f('0x23')][_0xde9f('0x20')](this,_0x2d8224));this[_0xde9f('0x1b')][_0x21d9d5['id']]['on']('error',this[_0xde9f('0x24')]['bind'](this,_0x2d8224));}}else{if(_[_0xde9f('0x14')](this[_0xde9f('0xb')][_0x2d8224][_0xde9f('0x11')])){this['mailAccounts'][_0x2d8224][_0xde9f('0x11')]={};}this['mailAccounts'][_0x2d8224][_0xde9f('0x11')][_0xde9f('0x12')]=_0xde9f('0x25');this[_0xde9f('0xb')][_0x2d8224][_0xde9f('0x11')][_0xde9f('0x13')]='';this[_0xde9f('0xe')](_0x2d8224);}}}};EmailChannel[_0xde9f('0xd')]['handleImapBox']=function(_0x1b5dba,_0x4d0265){if(this['mailAccounts'][_0x1b5dba]){this[_0xde9f('0xb')][_0x1b5dba]['Imap'][_0xde9f('0x12')]=_0xde9f('0x26');this[_0xde9f('0xb')][_0x1b5dba][_0xde9f('0x11')][_0xde9f('0x13')]=_0x4d0265[_0xde9f('0xf')];if(_0x4d0265['messages']){this[_0xde9f('0xb')][_0x1b5dba][_0xde9f('0x11')]['total']=_0x4d0265[_0xde9f('0x27')][_0xde9f('0x28')];}return this['emit'](_0x1b5dba);}};EmailChannel[_0xde9f('0xd')][_0xde9f('0x21')]=function(_0x11fe3c,_0x467da7){logger['info'](_0xde9f('0x29'),_0x467da7[_0xde9f('0x2a')],_0x467da7['lastName'],_0x467da7[_0xde9f('0x2b')],_0x11fe3c);if(this[_0xde9f('0xb')][_0x11fe3c]){return mailAccount['notify'](_0x11fe3c,_0x467da7)[_0xde9f('0x2c')](function(_0x1fc2ab){if(_0x1fc2ab){logger[_0xde9f('0x2d')]('Mail\x20accepted\x20from\x20routing');}})[_0xde9f('0x2e')](function(_0x52395d){logger[_0xde9f('0x2f')](_0xde9f('0x30'),JSON[_0xde9f('0x31')](_0x52395d));});}};EmailChannel[_0xde9f('0xd')][_0xde9f('0x23')]=function(_0xb086d8){if(this[_0xde9f('0xb')][_0xb086d8]&&this[_0xde9f('0xb')][_0xb086d8]['Imap']){if(this[_0xde9f('0x1b')][this[_0xde9f('0xb')][_0xb086d8][_0xde9f('0x11')]['id']]){delete this['imapAccounts'][this[_0xde9f('0xb')][_0xb086d8][_0xde9f('0x11')]['id']];}this[_0xde9f('0xb')][_0xb086d8][_0xde9f('0x11')]['lastSync']=moment();this[_0xde9f('0xe')](_0xb086d8);}};EmailChannel[_0xde9f('0xd')][_0xde9f('0x24')]=function(_0x59dd96,_0x37a7f3){if(this[_0xde9f('0xb')][_0x59dd96]){this[_0xde9f('0xb')][_0x59dd96][_0xde9f('0x11')]['status']='error';this[_0xde9f('0xb')][_0x59dd96][_0xde9f('0x11')][_0xde9f('0x13')]=_0x37a7f3;return this['emit'](_0x59dd96);}};EmailChannel[_0xde9f('0xd')][_0xde9f('0x32')]=function(_0x26c0a3,_0x4a9495){return this[_0xde9f('0xc')][_0xde9f('0x33')](_0x26c0a3,_0x4a9495);};EmailChannel[_0xde9f('0xd')][_0xde9f('0x34')]=function(_0x2bd4d5){var _0x391ee1=this;if(this[_0xde9f('0xb')][_0x2bd4d5['id']]){if(_[_0xde9f('0x14')](this[_0xde9f('0xb')][_0x2bd4d5['id']][_0xde9f('0x35')])){this['mailAccounts'][_0x2bd4d5['id']][_0xde9f('0x35')]={};}this[_0xde9f('0xb')][_0x2bd4d5['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x2445b0,_0x319d21){return _0x391ee1[_0xde9f('0xc')][_0xde9f('0x36')](_0x2bd4d5)[_0xde9f('0x2c')](function(_0x3c082c){_0x391ee1[_0xde9f('0xb')][_0x2bd4d5['id']][_0xde9f('0x35')]['status']=_0xde9f('0x37');_0x391ee1['mailAccounts'][_0x2bd4d5['id']][_0xde9f('0x35')][_0xde9f('0x13')]='';_0x391ee1[_0xde9f('0xe')](_0x2bd4d5['id']);_0x2445b0(_0x3c082c);})[_0xde9f('0x2e')](function(_0x545faa){_0x391ee1[_0xde9f('0xb')][_0x2bd4d5['id']][_0xde9f('0x35')][_0xde9f('0x12')]=_0xde9f('0x2f');_0x391ee1['mailAccounts'][_0x2bd4d5['id']]['Smtp'][_0xde9f('0x13')]=_0x545faa;_0x391ee1['emit'](_0x2bd4d5['id']);_0x319d21(_0x545faa);});});}return this[_0xde9f('0xc')][_0xde9f('0x36')](_0x2bd4d5);};module[_0xde9f('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 1842876..acc32d8 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 _0x563e=['once','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','lodash','util','imap','mailparser','simpleParser','Iconv','events','../../../config/logger','email','mailbox','account','getAccount','handleReady','end','handleEnd','error','handleError','bind','inherits','prototype','connTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage'];(function(_0x367ad0,_0x4b5d29){var _0x4e6f1e=function(_0x3197ef){while(--_0x3197ef){_0x367ad0['push'](_0x367ad0['shift']());}};_0x4e6f1e(++_0x4b5d29);}(_0x563e,0x1cf));var _0xe563=function(_0x1d75f7,_0x139d5e){_0x1d75f7=_0x1d75f7-0x0;var _0x307f9a=_0x563e[_0x1d75f7];return _0x307f9a;};'use strict';var _=require(_0xe563('0x0'));var util=require(_0xe563('0x1'));var Imap=require(_0xe563('0x2'));var simpleParser=require(_0xe563('0x3'))[_0xe563('0x4')];var Iconv=require('iconv')[_0xe563('0x5')];var EventEmitter=require(_0xe563('0x6'))['EventEmitter'];var utils=require('./utils');var logger=require(_0xe563('0x7'))(_0xe563('0x8'));function EmailImap(_0x4879af,_0x4bcade){this['mailbox']=_0x4879af[_0xe563('0x9')];this[_0xe563('0xa')]=this[_0xe563('0xb')](_0x4879af,_0x4bcade);this[_0xe563('0x2')]=new Imap(this['account']);this[_0xe563('0x2')]['once']('ready',this[_0xe563('0xc')]['bind'](this));this[_0xe563('0x2')]['once'](_0xe563('0xd'),this[_0xe563('0xe')]['bind'](this));this[_0xe563('0x2')]['on'](_0xe563('0xf'),this[_0xe563('0x10')][_0xe563('0x11')](this));this[_0xe563('0x2')]['connect']();}util[_0xe563('0x12')](EmailImap,EventEmitter);EmailImap[_0xe563('0x13')][_0xe563('0xb')]=function(_0x44b0d8,_0x5ab414){var _0x1b5c93={'connTimeout':_0x44b0d8[_0xe563('0x14')]?_0x44b0d8[_0xe563('0x14')]*0x3e8:0x2710,'authTimeout':_0x44b0d8['authTimeout']?_0x44b0d8['authTimeout']*0x3e8:0x1388};if(_0x44b0d8[_0xe563('0x15')]){_0x1b5c93[_0xe563('0x16')]=_0x44b0d8[_0xe563('0x16')];if(_0x44b0d8[_0xe563('0x17')]){_0x1b5c93[_0xe563('0x18')]=utils[_0xe563('0x19')](_0x44b0d8[_0xe563('0x1a')][_0xe563('0x1b')],_0x44b0d8[_0xe563('0x16')]);}else{_0x1b5c93[_0xe563('0x1c')]=_0x44b0d8[_0xe563('0x1c')];}}else{if(_0x44b0d8[_0xe563('0x1d')]){_0x1b5c93[_0xe563('0x16')]=_0x44b0d8['user'];_0x1b5c93[_0xe563('0x1c')]=_0x44b0d8[_0xe563('0x1c')];}}_0x1b5c93[_0xe563('0x8')]=_0x5ab414||_0x44b0d8[_0xe563('0x16')]||_0xe563('0x1e');_0x1b5c93[_0xe563('0x1f')]=_0x44b0d8[_0xe563('0x1f')];_0x1b5c93[_0xe563('0x20')]=_0x44b0d8[_0xe563('0x20')]||0x3e1;if(_0x44b0d8[_0xe563('0x21')]){_0x1b5c93[_0xe563('0x21')]=!![];}else{_0x1b5c93[_0xe563('0x21')]=![];_0x1b5c93[_0xe563('0x22')]=_0xe563('0x23');}return _0x1b5c93;};EmailImap[_0xe563('0x13')][_0xe563('0xc')]=function(){this[_0xe563('0x2')][_0xe563('0x24')](this[_0xe563('0x9')],![],this[_0xe563('0x25')][_0xe563('0x11')](this));};EmailImap[_0xe563('0x13')][_0xe563('0x25')]=function(_0x546b30,_0x32f616){if(_0x546b30){this[_0xe563('0x10')](_0x546b30,!![]);}else{this[_0xe563('0x26')](_0xe563('0x27'),_0x32f616);this[_0xe563('0x28')]();}};EmailImap[_0xe563('0x13')][_0xe563('0x29')]=function(_0x5a7bbf){if(_0x5a7bbf){this['handleError'](_0x5a7bbf,!![]);}else{this['imap'][_0xe563('0xd')]();}};EmailImap[_0xe563('0x13')]['readUnseen']=function(){this[_0xe563('0x2')][_0xe563('0x2a')]([_0xe563('0x2b')],this[_0xe563('0x2c')]['bind'](this));};EmailImap[_0xe563('0x13')][_0xe563('0x2c')]=function(_0xc8d399,_0x3cf9a3){if(_0xc8d399){this[_0xe563('0x10')](_0xc8d399,!![]);}else{if(_0x3cf9a3[_0xe563('0x2d')]){try{var _0x25d47d=this[_0xe563('0x2')][_0xe563('0x2e')](_0x3cf9a3['slice'](0x0,0xa),{'bodies':'','markSeen':!![]});_0x25d47d['on'](_0xe563('0x2f'),this[_0xe563('0x30')][_0xe563('0x11')](this));_0x25d47d[_0xe563('0x31')](_0xe563('0xf'),this[_0xe563('0x32')][_0xe563('0x11')](this));_0x25d47d['once'](_0xe563('0xd'),this[_0xe563('0x33')]['bind'](this));}catch(_0x46ca10){logger[_0xe563('0xf')](_0x46ca10);}}else{this['imap'][_0xe563('0x34')](!![],this['handleCloseBox']['bind'](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0xf17309){_0xf17309['on'](_0xe563('0x35'),this[_0xe563('0x36')][_0xe563('0x11')](this));_0xf17309[_0xe563('0x31')](_0xe563('0x37'),this[_0xe563('0x38')]['bind'](this));_0xf17309[_0xe563('0x31')](_0xe563('0xd'),this[_0xe563('0x39')]['bind'](this));};EmailImap['prototype']['handleMessageBody']=function(_0x3b259f){simpleParser(_0x3b259f,{'Iconv':Iconv},this['handleSimpleParser'][_0xe563('0x11')](this));};EmailImap[_0xe563('0x13')][_0xe563('0x38')]=function(){};EmailImap['prototype'][_0xe563('0x39')]=function(){};EmailImap[_0xe563('0x13')][_0xe563('0x3a')]=function(_0x4089ff,_0x10ffac){if(_0x4089ff){logger[_0xe563('0xf')](_0x4089ff);}else{var _0x19dc36=this;utils[_0xe563('0x3b')](this[_0xe563('0xa')],_0x10ffac,function(_0x23134a){_0x19dc36[_0xe563('0x26')]('email',_0x23134a);});}};EmailImap[_0xe563('0x13')][_0xe563('0x33')]=function(){this[_0xe563('0x2')]['closeBox'](!![],this[_0xe563('0x29')][_0xe563('0x11')](this));};EmailImap[_0xe563('0x13')][_0xe563('0x32')]=function(_0x53af95){this[_0xe563('0x10')](_0x53af95);this[_0xe563('0x2')][_0xe563('0x34')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xe563('0x13')][_0xe563('0xe')]=function(){this[_0xe563('0x26')](_0xe563('0xd'));};EmailImap[_0xe563('0x13')][_0xe563('0x10')]=function(_0x3d5b8a,_0x27e90f){logger[_0xe563('0xf')](_0xe563('0x10'),this[_0xe563('0xa')][_0xe563('0x8')],JSON[_0xe563('0x3c')](_0x3d5b8a));var _0x1591e6='';if(_0x3d5b8a){if(_0x3d5b8a[_0xe563('0x3d')]){_0x1591e6=_0x3d5b8a[_0xe563('0x3d')];}else{for(var _0x5dd875 in _0x3d5b8a){if(_0x3d5b8a[_0xe563('0x3e')](_0x5dd875)){_0x1591e6+=_[_0xe563('0x3f')](_0x5dd875)+':\x20'+_0x3d5b8a[_0x5dd875]+'\x0a';}}}}if(_0x27e90f){this[_0xe563('0x2')][_0xe563('0xd')]();}else{this[_0xe563('0x26')](_0xe563('0xf'),_0x1591e6);this[_0xe563('0x26')]('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0xe0d5=['util','imap','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','once','handleReady','bind','handleEnd','error','handleError','connect','prototype','connTimeout','authTimeout','user','modernAuthentication','xoauth2','CloudProvider','data5','password','anonymous@xcally.com','host','tls','openBox','handleOpenBox','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','slice','message','handleFetchMessage','handleFetchError','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','handleFetchEnd','closeBox','stringify','textCode','hasOwnProperty','exports','lodash'];(function(_0x2788b2,_0x4e735c){var _0xbca93f=function(_0x4dccf8){while(--_0x4dccf8){_0x2788b2['push'](_0x2788b2['shift']());}};_0xbca93f(++_0x4e735c);}(_0xe0d5,0xb3));var _0x5e0d=function(_0x23d3dd,_0x3be1be){_0x23d3dd=_0x23d3dd-0x0;var _0x872358=_0xe0d5[_0x23d3dd];return _0x872358;};'use strict';var _=require(_0x5e0d('0x0'));var util=require(_0x5e0d('0x1'));var Imap=require(_0x5e0d('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x5e0d('0x3'))[_0x5e0d('0x4')];var EventEmitter=require(_0x5e0d('0x5'))[_0x5e0d('0x6')];var utils=require(_0x5e0d('0x7'));var logger=require(_0x5e0d('0x8'))(_0x5e0d('0x9'));function EmailImap(_0x33e044,_0x4cc05c){this['mailbox']=_0x33e044[_0x5e0d('0xa')];this[_0x5e0d('0xb')]=this[_0x5e0d('0xc')](_0x33e044,_0x4cc05c);this[_0x5e0d('0x2')]=new Imap(this[_0x5e0d('0xb')]);this[_0x5e0d('0x2')][_0x5e0d('0xd')]('ready',this[_0x5e0d('0xe')][_0x5e0d('0xf')](this));this[_0x5e0d('0x2')][_0x5e0d('0xd')]('end',this[_0x5e0d('0x10')][_0x5e0d('0xf')](this));this[_0x5e0d('0x2')]['on'](_0x5e0d('0x11'),this[_0x5e0d('0x12')][_0x5e0d('0xf')](this));this[_0x5e0d('0x2')][_0x5e0d('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x5e0d('0x14')][_0x5e0d('0xc')]=function(_0x6db885,_0x27f68b){var _0x3d1d14={'connTimeout':_0x6db885['connTimeout']?_0x6db885[_0x5e0d('0x15')]*0x3e8:0x2710,'authTimeout':_0x6db885['authTimeout']?_0x6db885[_0x5e0d('0x16')]*0x3e8:0x1388};if(_0x6db885['service']){_0x3d1d14[_0x5e0d('0x17')]=_0x6db885[_0x5e0d('0x17')];if(_0x6db885[_0x5e0d('0x18')]){_0x3d1d14[_0x5e0d('0x19')]=utils['generateXOAuth2Token'](_0x6db885[_0x5e0d('0x1a')][_0x5e0d('0x1b')],_0x6db885['user']);}else{_0x3d1d14[_0x5e0d('0x1c')]=_0x6db885[_0x5e0d('0x1c')];}}else{if(_0x6db885['authentication']){_0x3d1d14[_0x5e0d('0x17')]=_0x6db885[_0x5e0d('0x17')];_0x3d1d14[_0x5e0d('0x1c')]=_0x6db885['password'];}}_0x3d1d14[_0x5e0d('0x9')]=_0x27f68b||_0x6db885[_0x5e0d('0x17')]||_0x5e0d('0x1d');_0x3d1d14[_0x5e0d('0x1e')]=_0x6db885['host'];_0x3d1d14['port']=_0x6db885['port']||0x3e1;if(_0x6db885[_0x5e0d('0x1f')]){_0x3d1d14['tls']=!![];}else{_0x3d1d14[_0x5e0d('0x1f')]=![];_0x3d1d14['autotls']='required';}return _0x3d1d14;};EmailImap[_0x5e0d('0x14')][_0x5e0d('0xe')]=function(){this[_0x5e0d('0x2')][_0x5e0d('0x20')](this['mailbox'],![],this[_0x5e0d('0x21')][_0x5e0d('0xf')](this));};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x21')]=function(_0x1daebb,_0x159bd7){if(_0x1daebb){this[_0x5e0d('0x12')](_0x1daebb,!![]);}else{this['emit'](_0x5e0d('0x22'),_0x159bd7);this[_0x5e0d('0x23')]();}};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x24')]=function(_0x30e96a){if(_0x30e96a){this[_0x5e0d('0x12')](_0x30e96a,!![]);}else{this['imap'][_0x5e0d('0x25')]();}};EmailImap[_0x5e0d('0x14')]['readUnseen']=function(){this[_0x5e0d('0x2')][_0x5e0d('0x26')]([_0x5e0d('0x27')],this['handleReadUnseen'][_0x5e0d('0xf')](this));};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x28')]=function(_0x129942,_0x3d33f8){if(_0x129942){this[_0x5e0d('0x12')](_0x129942,!![]);}else{if(_0x3d33f8[_0x5e0d('0x29')]){try{var _0x10f94c=this[_0x5e0d('0x2')][_0x5e0d('0x2a')](_0x3d33f8[_0x5e0d('0x2b')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x10f94c['on'](_0x5e0d('0x2c'),this[_0x5e0d('0x2d')][_0x5e0d('0xf')](this));_0x10f94c[_0x5e0d('0xd')](_0x5e0d('0x11'),this[_0x5e0d('0x2e')]['bind'](this));_0x10f94c[_0x5e0d('0xd')](_0x5e0d('0x25'),this['handleFetchEnd'][_0x5e0d('0xf')](this));}catch(_0x3ae409){logger['error'](_0x3ae409);}}else{this[_0x5e0d('0x2')]['closeBox'](!![],this['handleCloseBox'][_0x5e0d('0xf')](this));}}};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x2d')]=function(_0x5a879b){_0x5a879b['on'](_0x5e0d('0x2f'),this[_0x5e0d('0x30')][_0x5e0d('0xf')](this));_0x5a879b[_0x5e0d('0xd')]('attributes',this[_0x5e0d('0x31')][_0x5e0d('0xf')](this));_0x5a879b['once'](_0x5e0d('0x25'),this[_0x5e0d('0x32')][_0x5e0d('0xf')](this));};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x30')]=function(_0x415b72){simpleParser(_0x415b72,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap['prototype'][_0x5e0d('0x31')]=function(){};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x32')]=function(){};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x33')]=function(_0x46d2d3,_0x47dfa8){if(_0x46d2d3){logger[_0x5e0d('0x11')](_0x46d2d3);}else{var _0x5922fe=this;utils[_0x5e0d('0x34')](this[_0x5e0d('0xb')],_0x47dfa8,function(_0x292d57){_0x5922fe[_0x5e0d('0x35')](_0x5e0d('0x9'),_0x292d57);});}};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x36')]=function(){this[_0x5e0d('0x2')][_0x5e0d('0x37')](!![],this['handleCloseBox'][_0x5e0d('0xf')](this));};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x2e')]=function(_0x4a8dd6){this[_0x5e0d('0x12')](_0x4a8dd6);this[_0x5e0d('0x2')]['closeBox'](!![],this[_0x5e0d('0x24')][_0x5e0d('0xf')](this));};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x10')]=function(){this['emit'](_0x5e0d('0x25'));};EmailImap[_0x5e0d('0x14')][_0x5e0d('0x12')]=function(_0x3fcf4b,_0x24e581){logger[_0x5e0d('0x11')](_0x5e0d('0x12'),this['account'][_0x5e0d('0x9')],JSON[_0x5e0d('0x38')](_0x3fcf4b));var _0x225839='';if(_0x3fcf4b){if(_0x3fcf4b[_0x5e0d('0x39')]){_0x225839=_0x3fcf4b['textCode'];}else{for(var _0x32af66 in _0x3fcf4b){if(_0x3fcf4b[_0x5e0d('0x3a')](_0x32af66)){_0x225839+=_['upperFirst'](_0x32af66)+':\x20'+_0x3fcf4b[_0x32af66]+'\x0a';}}}}if(_0x24e581){this[_0x5e0d('0x2')][_0x5e0d('0x25')]();}else{this['emit'](_0x5e0d('0x11'),_0x225839);this[_0x5e0d('0x35')](_0x5e0d('0x25'));}};module[_0x5e0d('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 3d890d2..0c5fe2b 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 _0x78d5=['compile','toString','verify','exports','nodemailer','prototype','send','createTransport'];(function(_0x399595,_0x4e92ae){var _0x509338=function(_0x1134f0){while(--_0x1134f0){_0x399595['push'](_0x399595['shift']());}};_0x509338(++_0x4e92ae);}(_0x78d5,0x1dc));var _0x578d=function(_0x44f72f,_0x3cdb11){_0x44f72f=_0x44f72f-0x0;var _0x215af3=_0x78d5[_0x44f72f];return _0x215af3;};'use strict';var nodemailer=require(_0x578d('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x578d('0x1')][_0x578d('0x2')]=function(_0x2c3632,_0x30648b){return new Promise(function(_0x46a9aa,_0x42691a){var _0x554c69=nodemailer[_0x578d('0x3')](_0x2c3632);_0x554c69['use'](_0x578d('0x4'),inlineBase64());_0x554c69['sendMail'](_0x30648b,function(_0x1490b5,_0x2cae84){if(_0x1490b5){_0x42691a(_0x1490b5[_0x578d('0x5')]());}else{_0x46a9aa(_0x2cae84);}});});};EmailSmtp['prototype'][_0x578d('0x6')]=function(_0x51950f){return new Promise(function(_0x24ce08,_0x22bda2){var _0x204f0e=nodemailer[_0x578d('0x3')](_0x51950f);_0x204f0e[_0x578d('0x6')](function(_0x46188c,_0x257875){if(_0x46188c){_0x22bda2(_0x46188c['toString']());}else{if(_0x257875){_0x24ce08(_0x257875);}else{_0x22bda2('Not\x20verifired');}}});});};module[_0x578d('0x7')]=EmailSmtp; \ No newline at end of file +var _0x260b=['toString','prototype','verify','Not\x20verifired','exports','nodemailer','send','createTransport','use','compile'];(function(_0x3a0020,_0xe3feaa){var _0x1adcb7=function(_0x3627c3){while(--_0x3627c3){_0x3a0020['push'](_0x3a0020['shift']());}};_0x1adcb7(++_0xe3feaa);}(_0x260b,0x7d));var _0xb260=function(_0x145435,_0x326220){_0x145435=_0x145435-0x0;var _0x55a234=_0x260b[_0x145435];return _0x55a234;};'use strict';var nodemailer=require(_0xb260('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0xb260('0x1')]=function(_0x27cbaa,_0x442bc1){return new Promise(function(_0x54195d,_0x1cf70e){var _0x3393c1=nodemailer[_0xb260('0x2')](_0x27cbaa);_0x3393c1[_0xb260('0x3')](_0xb260('0x4'),inlineBase64());_0x3393c1['sendMail'](_0x442bc1,function(_0x52fcc4,_0x289892){if(_0x52fcc4){_0x1cf70e(_0x52fcc4[_0xb260('0x5')]());}else{_0x54195d(_0x289892);}});});};EmailSmtp[_0xb260('0x6')][_0xb260('0x7')]=function(_0x472a42){return new Promise(function(_0x58a765,_0x44ee4b){var _0x20a709=nodemailer[_0xb260('0x2')](_0x472a42);_0x20a709[_0xb260('0x7')](function(_0x1176d1,_0x5111e8){if(_0x1176d1){_0x44ee4b(_0x1176d1[_0xb260('0x5')]());}else{if(_0x5111e8){_0x58a765(_0x5111e8);}else{_0x44ee4b(_0xb260('0x8'));}}});});};module[_0xb260('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 75a8e53..0e8f7b1 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 _0x311f=['messageId','inReplyTo','date','textAsHtml','filter','info','format','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','

Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','auth=Bearer\x20','base64','lodash','moment','path','util','node-tnef','email','../../../config/environment','value','address','generate','@xcally.com','name','substring','split','length','slice','join','Anonymous','pop','html','test','replace','includes','attachments','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','0x1?_0x2636b5[_0xf311('0xf')](0x0,-0x1)[_0xf311('0x10')]('\x20'):_0x2fe5d2[_0xf311('0xb')];}return _0xf311('0x11');}function getLastName(_0x8a976a){var _0x5455f1=_['head'](_0x8a976a[_0xf311('0x7')]);if(_0x5455f1&&_0x5455f1[_0xf311('0xb')]){var _0x123b51=_0x5455f1['name'][_0xf311('0xd')](/\s+/);return _0x123b51[_0xf311('0xe')]>0x1?_0x123b51[_0xf311('0x12')]():'';}return'';}function getMails(_0xbacaa6,_0x30a68b){var _0x29383a='';for(var _0x277e15=0x0;_0x277e15<_0x30a68b['value'][_0xf311('0xe')];_0x277e15+=0x1){if(_0x30a68b['value'][_0x277e15]['address']!==_0xbacaa6){if(!_['isEmpty'](_0x29383a)){_0x29383a+=',';}_0x29383a+=_0x30a68b[_0xf311('0x7')][_0x277e15]['name']||_0x30a68b['value'][_0x277e15][_0xf311('0x8')]||'';_0x29383a+='\x20<';_0x29383a+=_0x30a68b[_0xf311('0x7')][_0x277e15][_0xf311('0x8')]?_0x30a68b[_0xf311('0x7')][_0x277e15][_0xf311('0x8')]:'anonymous'+random[_0xf311('0x9')](0x6)+_0xf311('0xa');_0x29383a+='>';}}return _0x29383a;}function parseEmail(_0x2b5910,_0x24ca6,_0x21a71f){if(_0x24ca6[_0xf311('0x13')]){var _0x4aadc3=/)<[^<]*)*<\/script>/gi;while(_0x4aadc3[_0xf311('0x14')](_0x24ca6['html'])){_0x24ca6[_0xf311('0x13')]=_0x24ca6[_0xf311('0x13')][_0xf311('0x15')](_0x4aadc3,'');}if(_0x24ca6[_0xf311('0x13')][_0xf311('0x16')]('{_0x594d50[_0xf311('0x19')](_0x599094[_0xf311('0x1a')]);});var _0xc7e87f=/]+>/g;var _0x2c81dd=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x435318=_0x24ca6[_0xf311('0x13')][_0xf311('0x15')](_0x2c81dd,_0xf311('0x1b'));var _0x59e363=_0x435318[_0xf311('0x15')](_0xc7e87f,_0xf311('0x1c'));for(let _0x493eca=0x0;_0x493eca<_0x594d50[_0xf311('0xe')];_0x493eca++){var _0x382052=_0x59e363['replace']('_IMG',_0xf311('0x1d')+_0x594d50[_0x493eca]+_0xf311('0x1e'));_0x59e363=_0x382052;}_0x24ca6[_0xf311('0x13')]=_0x59e363;}_0x21a71f['body']=_0x24ca6['html'];}else{_0x21a71f[_0xf311('0x1f')]=_0x24ca6['textAsHtml'];}if(_0x21a71f[_0xf311('0x1f')]){_0x21a71f[_0xf311('0x1f')]=_0x21a71f[_0xf311('0x1f')]['replace'](/0x0){var _0x38e1a6=[_0xf311('0x2f'),_0xf311('0x30'),'Precedence:\x20auto_reply'];for(var _0x1ba39a=0x0;_0x1ba39a<_0x24ca6['headerLines']['length'];_0x1ba39a++){var _0x54944b=_[_0xf311('0x31')](_0x38e1a6,_0x24ca6['headerLines'][_0x1ba39a][_0xf311('0x32')]);if(_0x54944b>=0x0){_0x21a71f[_0xf311('0x33')]=!![];}}}return _0x21a71f;}exports[_0xf311('0x34')]=function(_0x29bd7e,_0x415b61,_0xe523f0){var _0x16fd09={'from':getAddress(_0x415b61[_0xf311('0x35')]),'firstName':getFirstName(_0x415b61[_0xf311('0x35')]),'lastName':getLastName(_0x415b61['from']),'mapKey':_0xf311('0x5'),'message':{'from':getMails(_0x29bd7e[_0xf311('0x5')],_0x415b61[_0xf311('0x35')]),'to':_0x29bd7e[_0xf311('0x5')],'cc':'','subject':_0x415b61[_0xf311('0x36')]||'','messageId':_0x415b61[_0xf311('0x37')],'inReplyTo':_0x415b61[_0xf311('0x38')],'sentAt':moment(_0x415b61[_0xf311('0x39')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x415b61[_0xf311('0x13')]&&!_0x415b61[_0xf311('0x3a')]){var _0x8a4b3=_[_0xf311('0x3b')](_0x415b61[_0xf311('0x17')],{'contentType':'application/ms-tnef'});if(_0x8a4b3[_0xf311('0xe')]){logger[_0xf311('0x3c')](util[_0xf311('0x3d')](_0xf311('0x3e'),_0x415b61[_0xf311('0x37')]));tnef[_0xf311('0x3f')](_['first'](_0x8a4b3)['content'],function(_0x3d67a2,_0x312291){if(_0x312291){_0x415b61[_0xf311('0x13')]=_0x312291['BodyHTML']||_0xf311('0x40');if(_0x312291[_0xf311('0x41')]){for(var _0x42a669=0x0;_0x42a669<_0x312291[_0xf311('0x41')][_0xf311('0xe')];_0x42a669++){var _0x18dc96=_0x312291['Attachments'][_0x42a669];_0x16fd09[_0xf311('0x21')][_0xf311('0x17')][_0xf311('0x19')]({'filename':_0x18dc96[_0xf311('0x42')],'content':Buffer[_0xf311('0x35')](_0x18dc96['Data'])});}}}_0xe523f0(parseEmail(_0x29bd7e,_0x415b61,_0x16fd09));});}else{_0x415b61[_0xf311('0x13')]=_0xf311('0x40');_0xe523f0(parseEmail(_0x29bd7e,_0x415b61,_0x16fd09));}}else{_0xe523f0(parseEmail(_0x29bd7e,_0x415b61,_0x16fd09));}};exports[_0xf311('0x43')]=function(_0x2c4f90,_0x54554e){var _0x2946ab=[_0xf311('0x44')+(_0x54554e||''),_0xf311('0x45')+_0x2c4f90,'',''];return Buffer[_0xf311('0x35')](_0x2946ab['join'](''),'utf-8')['toString'](_0xf311('0x46'));}; \ No newline at end of file +var _0x921d=['attach','type','attachment','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','messageId','inReplyTo','date','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','

Empty\x20message

','generateXOAuth2Token','auth=Bearer\x20','utf-8','base64','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','substring','indexOf','split','length','slice','join','Anonymous','isEmpty','html','test','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','originCc','bcc'];(function(_0x3e3663,_0x4712be){var _0xc20576=function(_0x53ec5c){while(--_0x53ec5c){_0x3e3663['push'](_0x3e3663['shift']());}};_0xc20576(++_0x4712be);}(_0x921d,0x1de));var _0xd921=function(_0x2c46ba,_0x51febd){_0x2c46ba=_0x2c46ba-0x0;var _0x1aa617=_0x921d[_0x2c46ba];return _0x1aa617;};'use strict';var _=require('lodash');var moment=require('moment');var random=require(_0xd921('0x0'));var fs=require('fs');var path=require('path');var util=require(_0xd921('0x1'));var tnef=require(_0xd921('0x2'));var logger=require(_0xd921('0x3'))(_0xd921('0x4'));var config=require(_0xd921('0x5'));function getAddress(_0xb2ad0f){var _0x302f47=_['head'](_0xb2ad0f[_0xd921('0x6')]);return _0x302f47&&_0x302f47[_0xd921('0x7')]?_0x302f47[_0xd921('0x7')]:_0xd921('0x8')+random[_0xd921('0x9')](0x6)+_0xd921('0xa');}function getFirstName(_0x34c1b9){var _0x4aca1f=_[_0xd921('0xb')](_0x34c1b9[_0xd921('0x6')]);if(_0x4aca1f&&_0x4aca1f[_0xd921('0xc')]){if(_0x4aca1f[_0xd921('0xc')]==_0x4aca1f[_0xd921('0x7')]){return _0x4aca1f[_0xd921('0xc')][_0xd921('0xd')](0x0,_0x4aca1f['name'][_0xd921('0xe')]('@'));}var _0x2d921f=_0x4aca1f[_0xd921('0xc')][_0xd921('0xf')](/\s+/);return _0x2d921f[_0xd921('0x10')]>0x1?_0x2d921f[_0xd921('0x11')](0x0,-0x1)[_0xd921('0x12')]('\x20'):_0x4aca1f[_0xd921('0xc')];}return _0xd921('0x13');}function getLastName(_0x44d4df){var _0x261fea=_[_0xd921('0xb')](_0x44d4df['value']);if(_0x261fea&&_0x261fea[_0xd921('0xc')]){var _0x1f79f0=_0x261fea[_0xd921('0xc')][_0xd921('0xf')](/\s+/);return _0x1f79f0['length']>0x1?_0x1f79f0['pop']():'';}return'';}function getMails(_0x16438c,_0x2af8b2){var _0x43abd9='';for(var _0x66ee00=0x0;_0x66ee00<_0x2af8b2[_0xd921('0x6')][_0xd921('0x10')];_0x66ee00+=0x1){if(_0x2af8b2['value'][_0x66ee00][_0xd921('0x7')]!==_0x16438c){if(!_[_0xd921('0x14')](_0x43abd9)){_0x43abd9+=',';}_0x43abd9+=_0x2af8b2[_0xd921('0x6')][_0x66ee00][_0xd921('0xc')]||_0x2af8b2[_0xd921('0x6')][_0x66ee00]['address']||'';_0x43abd9+='\x20<';_0x43abd9+=_0x2af8b2[_0xd921('0x6')][_0x66ee00][_0xd921('0x7')]?_0x2af8b2[_0xd921('0x6')][_0x66ee00][_0xd921('0x7')]:_0xd921('0x8')+random[_0xd921('0x9')](0x6)+_0xd921('0xa');_0x43abd9+='>';}}return _0x43abd9;}function parseEmail(_0x480a60,_0x146b9d,_0x1d1922){if(_0x146b9d[_0xd921('0x15')]){var _0x31f1de=/)<[^<]*)*<\/script>/gi;while(_0x31f1de[_0xd921('0x16')](_0x146b9d[_0xd921('0x15')])){_0x146b9d[_0xd921('0x15')]=_0x146b9d['html']['replace'](_0x31f1de,'');}if(_0x146b9d[_0xd921('0x15')][_0xd921('0x17')](_0xd921('0x18'))){var _0x30e8ea=[];_0x146b9d[_0xd921('0x19')][_0xd921('0x1a')](_0x57ebc6=>{_0x30e8ea[_0xd921('0x1b')](_0x57ebc6[_0xd921('0x1c')]);});var _0x1ba9fa=/]+>/g;var _0x56b4f4=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x54f5c=_0x146b9d[_0xd921('0x15')][_0xd921('0x1d')](_0x56b4f4,_0xd921('0x1e'));var _0x4a93ea=_0x54f5c[_0xd921('0x1d')](_0x1ba9fa,_0xd921('0x1f'));for(let _0x1ae8d5=0x0;_0x1ae8d5<_0x30e8ea[_0xd921('0x10')];_0x1ae8d5++){var _0x3b85fc=_0x4a93ea[_0xd921('0x1d')]('_IMG',_0xd921('0x20')+_0x30e8ea[_0x1ae8d5]+_0xd921('0x21'));_0x4a93ea=_0x3b85fc;}_0x146b9d[_0xd921('0x15')]=_0x4a93ea;}_0x1d1922[_0xd921('0x22')]=_0x146b9d['html'];}else{_0x1d1922['body']=_0x146b9d[_0xd921('0x23')];}if(_0x1d1922[_0xd921('0x22')]){_0x1d1922[_0xd921('0x22')]=_0x1d1922[_0xd921('0x22')]['replace'](/0x0){var _0x2e1e94=['Auto-Submitted:\x20auto-replied',_0xd921('0x34'),_0xd921('0x35')];for(var _0x506059=0x0;_0x506059<_0x146b9d[_0xd921('0x33')][_0xd921('0x10')];_0x506059++){var _0x395db8=_[_0xd921('0xe')](_0x2e1e94,_0x146b9d[_0xd921('0x33')][_0x506059][_0xd921('0x36')]);if(_0x395db8>=0x0){_0x1d1922[_0xd921('0x37')]=!![];}}}return _0x1d1922;}exports[_0xd921('0x38')]=function(_0x4e9b1a,_0x3270d6,_0x5a48d3){var _0x9d12ea={'from':getAddress(_0x3270d6[_0xd921('0x39')]),'firstName':getFirstName(_0x3270d6[_0xd921('0x39')]),'lastName':getLastName(_0x3270d6[_0xd921('0x39')]),'mapKey':_0xd921('0x4'),'message':{'from':getMails(_0x4e9b1a[_0xd921('0x4')],_0x3270d6[_0xd921('0x39')]),'to':_0x4e9b1a[_0xd921('0x4')],'cc':'','subject':_0x3270d6['subject']||'','messageId':_0x3270d6[_0xd921('0x3a')],'inReplyTo':_0x3270d6[_0xd921('0x3b')],'sentAt':moment(_0x3270d6[_0xd921('0x3c')])[_0xd921('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x3270d6[_0xd921('0x15')]&&!_0x3270d6[_0xd921('0x23')]){var _0x1e8d6f=_[_0xd921('0x3d')](_0x3270d6[_0xd921('0x19')],{'contentType':_0xd921('0x3e')});if(_0x1e8d6f['length']){logger[_0xd921('0x3f')](util['format'](_0xd921('0x40'),_0x3270d6['messageId']));tnef[_0xd921('0x41')](_[_0xd921('0x42')](_0x1e8d6f)[_0xd921('0x31')],function(_0x6e86e7,_0x2e7f4f){if(_0x2e7f4f){_0x3270d6[_0xd921('0x15')]=_0x2e7f4f[_0xd921('0x43')]||'

Empty\x20message

';if(_0x2e7f4f['Attachments']){for(var _0x284f83=0x0;_0x284f83<_0x2e7f4f[_0xd921('0x44')][_0xd921('0x10')];_0x284f83++){var _0x499d1d=_0x2e7f4f['Attachments'][_0x284f83];_0x9d12ea['message'][_0xd921('0x19')]['push']({'filename':_0x499d1d['Title'],'content':Buffer[_0xd921('0x39')](_0x499d1d['Data'])});}}}_0x5a48d3(parseEmail(_0x4e9b1a,_0x3270d6,_0x9d12ea));});}else{_0x3270d6[_0xd921('0x15')]=_0xd921('0x45');_0x5a48d3(parseEmail(_0x4e9b1a,_0x3270d6,_0x9d12ea));}}else{_0x5a48d3(parseEmail(_0x4e9b1a,_0x3270d6,_0x9d12ea));}};exports[_0xd921('0x46')]=function(_0x423948,_0xc1815e){var _0x2902a7=['user='+(_0xc1815e||''),_0xd921('0x47')+_0x423948,'',''];return Buffer[_0xd921('0x39')](_0x2902a7[_0xd921('0x12')](''),_0xd921('0x48'))['toString'](_0xd921('0x49'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 044bad6..47499f4 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 _0xac16=['lodash','name','Service','key','Imap','Smtp'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac16,0x150));var _0x6ac1=function(_0x12e723,_0x2f0c21){_0x12e723=_0x12e723-0x0;var _0x3052f6=_0xac16[_0x12e723];return _0x3052f6;};'use strict';var _=require(_0x6ac1('0x0'));function MailAccount(_0x5cd8a9){this['id']=_0x5cd8a9['id']||0x0;this[_0x6ac1('0x1')]=_0x5cd8a9[_0x6ac1('0x1')]||_0x6ac1('0x2');this['key']=_0x5cd8a9[_0x6ac1('0x3')]||'SERV';this['active']=_0x5cd8a9['active']||![];this[_0x6ac1('0x4')]=_0x5cd8a9[_0x6ac1('0x4')]||[];this['Smtp']=_0x5cd8a9[_0x6ac1('0x5')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0xbe6f=['lodash','name','Service','key','active','Imap','Smtp','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbe6f,0xe0));var _0xfbe6=function(_0x24f747,_0x2b5a82){_0x24f747=_0x24f747-0x0;var _0x3b13d3=_0xbe6f[_0x24f747];return _0x3b13d3;};'use strict';var _=require(_0xfbe6('0x0'));function MailAccount(_0x24ac08){this['id']=_0x24ac08['id']||0x0;this[_0xfbe6('0x1')]=_0x24ac08[_0xfbe6('0x1')]||_0xfbe6('0x2');this[_0xfbe6('0x3')]=_0x24ac08[_0xfbe6('0x3')]||'SERV';this[_0xfbe6('0x4')]=_0x24ac08[_0xfbe6('0x4')]||![];this[_0xfbe6('0x5')]=_0x24ac08[_0xfbe6('0x5')]||[];this[_0xfbe6('0x6')]=_0x24ac08[_0xfbe6('0x6')]||[];}module[_0xfbe6('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 0d8e116..9b2668b 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 _0x9f8f=['isUndefined','merge','exports','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length'];(function(_0x3b4b1d,_0x15029e){var _0x488c36=function(_0x56c8b3){while(--_0x56c8b3){_0x3b4b1d['push'](_0x3b4b1d['shift']());}};_0x488c36(++_0x15029e);}(_0x9f8f,0x85));var _0xf9f8=function(_0x16c19f,_0x2b2242){_0x16c19f=_0x16c19f-0x0;var _0x37eed1=_0x9f8f[_0x16c19f];return _0x37eed1;};'use strict';var _=require('lodash');var MailAccount=require(_0xf9f8('0x0'));var Realtime=function(){this[_0xf9f8('0x1')]={};};function freeIsNotKey(_0x36909e,_0x2c6be8,_0xbf356){var _0x478d54=_['mapKeys'](_0x36909e,function(_0x426900,_0x32785b){return _0x426900[_0xbf356];});for(var _0xd37036 in _0x2c6be8){if(_0x2c6be8[_0xf9f8('0x2')](_0xd37036)){if(!_0x478d54[_0xd37036]){delete _0x2c6be8[_0xd37036];}}}}Realtime[_0xf9f8('0x3')][_0xf9f8('0x4')]=function(_0x171d8a,_0x2e1795){for(var _0x199b28 in _0x2e1795){if(_0x171d8a[_0xf9f8('0x2')](_0x199b28)){_0x171d8a[_0x199b28]=_0x2e1795[_0x199b28];}}};Realtime[_0xf9f8('0x3')][_0xf9f8('0x5')]=function(){var _0x30a98d=this;return function(_0x5a901d){if(_0x5a901d){freeIsNotKey(_0x5a901d,_0x30a98d[_0xf9f8('0x1')],'id');for(var _0x4e9113=0x0,_0x5c9a31={},_0xae51a6={};_0x4e9113<_0x5a901d[_0xf9f8('0x6')];_0x4e9113+=0x1){_0x5c9a31=_0x5a901d[_0x4e9113];if(_[_0xf9f8('0x7')](_0x30a98d[_0xf9f8('0x1')][_0x5c9a31['id']])){_0x30a98d[_0xf9f8('0x1')][_0x5c9a31['id']]=new MailAccount(_0x5c9a31);}else{_[_0xf9f8('0x8')](_0x30a98d[_0xf9f8('0x1')][_0x5c9a31['id']],_0x5c9a31);}}}return _0x30a98d[_0xf9f8('0x1')];};};module[_0xf9f8('0x9')]=Realtime; \ No newline at end of file +var _0x7226=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined'];(function(_0x3e8c3d,_0x37629a){var _0x1d5201=function(_0x2f33c0){while(--_0x2f33c0){_0x3e8c3d['push'](_0x3e8c3d['shift']());}};_0x1d5201(++_0x37629a);}(_0x7226,0xa9));var _0x6722=function(_0x374d5a,_0x42a75){_0x374d5a=_0x374d5a-0x0;var _0x4cf62a=_0x7226[_0x374d5a];return _0x4cf62a;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0xa1a6b8,_0x4077b7,_0x4a1ed2){var _0x41284e=_[_0x6722('0x0')](_0xa1a6b8,function(_0x1fe5f3,_0x2eedff){return _0x1fe5f3[_0x4a1ed2];});for(var _0x36a92c in _0x4077b7){if(_0x4077b7[_0x6722('0x1')](_0x36a92c)){if(!_0x41284e[_0x36a92c]){delete _0x4077b7[_0x36a92c];}}}}Realtime[_0x6722('0x2')][_0x6722('0x3')]=function(_0x3a876a,_0x580b9d){for(var _0x20c25c in _0x580b9d){if(_0x3a876a[_0x6722('0x1')](_0x20c25c)){_0x3a876a[_0x20c25c]=_0x580b9d[_0x20c25c];}}};Realtime[_0x6722('0x2')]['initMailAccounts']=function(){var _0x3a13e6=this;return function(_0x1fd77e){if(_0x1fd77e){freeIsNotKey(_0x1fd77e,_0x3a13e6['mailAccounts'],'id');for(var _0x49a61a=0x0,_0xc71294={},_0x1aa00e={};_0x49a61a<_0x1fd77e[_0x6722('0x4')];_0x49a61a+=0x1){_0xc71294=_0x1fd77e[_0x49a61a];if(_[_0x6722('0x5')](_0x3a13e6[_0x6722('0x6')][_0xc71294['id']])){_0x3a13e6['mailAccounts'][_0xc71294['id']]=new MailAccount(_0xc71294);}else{_['merge'](_0x3a13e6['mailAccounts'][_0xc71294['id']],_0xc71294);}}}return _0x3a13e6[_0x6722('0x6')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 75504e2..4982305 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 _0x77a9=['../client','Request','name','provider','service','email','key','ListId','TemplateId','MailServerIn','Imap','type','CloudProvider','MailServerOut','Smtp','data5','getMailAccount','NotifyMailAccount'];(function(_0x55e3b3,_0xbaa9e1){var _0x1bb1bd=function(_0x3d7072){while(--_0x3d7072){_0x55e3b3['push'](_0x55e3b3['shift']());}};_0x1bb1bd(++_0xbaa9e1);}(_0x77a9,0x19e));var _0x977a=function(_0x19b744,_0xf5cf3f){_0x19b744=_0x19b744-0x0;var _0x47fdc4=_0x77a9[_0x19b744];return _0x47fdc4;};'use strict';var client=require(_0x977a('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x977a('0x1')]('GetMailAccount',{'options':{'attributes':['id',_0x977a('0x2'),_0x977a('0x3'),_0x977a('0x4'),_0x977a('0x5'),'active',_0x977a('0x6'),_0x977a('0x7'),_0x977a('0x8')],'raw':![],'include':[{'model':_0x977a('0x9'),'as':_0x977a('0xa'),'include':[{'model':'CloudProvider','attributes':['id','name',_0x977a('0x4'),_0x977a('0xb'),'data5'],'as':_0x977a('0xc')}]},{'model':_0x977a('0xd'),'as':_0x977a('0xe'),'include':[{'model':_0x977a('0xc'),'attributes':['id',_0x977a('0x2'),_0x977a('0x4'),_0x977a('0xb'),_0x977a('0xf')],'as':_0x977a('0xc')}]}]},'log':_0x977a('0x10')});};};exports['notify']=function(_0x401731,_0x1e81c1){return client[_0x977a('0x1')](_0x977a('0x11'),{'account':{'id':_0x401731},'body':_0x1e81c1,'log':_0x977a('0x11')});}; \ No newline at end of file +var _0xf6da=['GetMailAccount','name','provider','service','email','active','key','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request'];(function(_0x43d106,_0x96a475){var _0x2160bc=function(_0x1219fb){while(--_0x1219fb){_0x43d106['push'](_0x43d106['shift']());}};_0x2160bc(++_0x96a475);}(_0xf6da,0x19f));var _0xaf6d=function(_0x54b774,_0x2bc4a3){_0x54b774=_0x54b774-0x0;var _0x3065d4=_0xf6da[_0x54b774];return _0x3065d4;};'use strict';var client=require(_0xaf6d('0x0'));exports[_0xaf6d('0x1')]=function(){return function(){return client[_0xaf6d('0x2')](_0xaf6d('0x3'),{'options':{'attributes':['id',_0xaf6d('0x4'),_0xaf6d('0x5'),_0xaf6d('0x6'),_0xaf6d('0x7'),_0xaf6d('0x8'),_0xaf6d('0x9'),'ListId',_0xaf6d('0xa')],'raw':![],'include':[{'model':_0xaf6d('0xb'),'as':_0xaf6d('0xc'),'include':[{'model':_0xaf6d('0xd'),'attributes':['id',_0xaf6d('0x4'),_0xaf6d('0x6'),_0xaf6d('0xe'),_0xaf6d('0xf')],'as':'CloudProvider'}]},{'model':_0xaf6d('0x10'),'as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0xaf6d('0x4'),_0xaf6d('0x6'),_0xaf6d('0xe'),_0xaf6d('0xf')],'as':_0xaf6d('0xd')}]}]},'log':_0xaf6d('0x11')});};};exports['notify']=function(_0x2ec5b8,_0x28e257){return client[_0xaf6d('0x2')](_0xaf6d('0x12'),{'account':{'id':_0x2ec5b8},'body':_0x28e257,'log':_0xaf6d('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index d1dd9ea..a9353d6 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 _0x0820=['../client','getSettings','Request','loginMailFrequency','GetSettings'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0820,0x1e0));var _0x0082=function(_0x24f010,_0x4bc43d){_0x24f010=_0x24f010-0x0;var _0x2a308b=_0x0820[_0x24f010];return _0x2a308b;};'use strict';var client=require(_0x0082('0x0'));exports[_0x0082('0x1')]=function(){return client[_0x0082('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0082('0x3')]},'log':_0x0082('0x4')});}; \ No newline at end of file +var _0x3ef1=['Request','ShowSetting','GetSettings','../client'];(function(_0x4fd42e,_0x446a11){var _0x33c1dc=function(_0x11ce06){while(--_0x11ce06){_0x4fd42e['push'](_0x4fd42e['shift']());}};_0x33c1dc(++_0x446a11);}(_0x3ef1,0x19b));var _0x13ef=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x3ef1[_0xdea41a];return _0x15d0d8;};'use strict';var client=require(_0x13ef('0x0'));exports['getSettings']=function(){return client[_0x13ef('0x1')](_0x13ef('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x13ef('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index c71e0ff..487a38f 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(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 d42a5a7..5951293 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 _0xd3b1=['Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','defaults','redis','localhost','adapter','../../config/triggers','default','../../routes','once','listening'];(function(_0x2e6339,_0x4ac07c){var _0x504a91=function(_0x4dd00e){while(--_0x4dd00e){_0x2e6339['push'](_0x2e6339['shift']());}};_0x504a91(++_0x4ac07c);}(_0xd3b1,0x14c));var _0x1d3b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd3b1[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x1d3b('0x0'));var http=require(_0x1d3b('0x1'));var express=require(_0x1d3b('0x2'));var sticky=require(_0x1d3b('0x3'));var Redis=require('ioredis');var config=require(_0x1d3b('0x4'));var app=express();var server=http[_0x1d3b('0x5')](app);server[_0x1d3b('0x6')]=0xdbba0;if(sticky[_0x1d3b('0x7')](server,config[_0x1d3b('0x8')])){var socketio=require(_0x1d3b('0x9'))(server,{'transports':[_0x1d3b('0xa'),'polling']});config['redis']=_[_0x1d3b('0xb')](config[_0x1d3b('0xc')],{'host':_0x1d3b('0xd'),'port':0x18eb});socketio[_0x1d3b('0xe')](require('socket.io-redis')({'pubClient':new Redis(config[_0x1d3b('0xc')]),'subClient':new Redis(config[_0x1d3b('0xc')])}));require(_0x1d3b('0xf'))[_0x1d3b('0x10')]();require('../../config/socketio')[_0x1d3b('0x10')](socketio);require('../../config/express')[_0x1d3b('0x10')](app);require(_0x1d3b('0x11'))[_0x1d3b('0x10')](app);}else{server[_0x1d3b('0x12')](_0x1d3b('0x13'),function(){console['log'](_0x1d3b('0x14'),config[_0x1d3b('0x8')]);});}exports=module[_0x1d3b('0x15')]=app; \ No newline at end of file +var _0x4e53=['once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','express','sticky-session','ioredis','../../config/environment','timeout','listen','socket.io','websocket','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','default','../../routes'];(function(_0x5307a6,_0x4f6e7b){var _0x5410b9=function(_0x5f526f){while(--_0x5f526f){_0x5307a6['push'](_0x5307a6['shift']());}};_0x5410b9(++_0x4f6e7b);}(_0x4e53,0x1a9));var _0x34e5=function(_0xe47217,_0x3a35db){_0xe47217=_0xe47217-0x0;var _0x3dc84c=_0x4e53[_0xe47217];return _0x3dc84c;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x34e5('0x0'));var sticky=require(_0x34e5('0x1'));var Redis=require(_0x34e5('0x2'));var config=require(_0x34e5('0x3'));var app=express();var server=http['createServer'](app);server[_0x34e5('0x4')]=0xdbba0;if(sticky[_0x34e5('0x5')](server,config['port'])){var socketio=require(_0x34e5('0x6'))(server,{'transports':[_0x34e5('0x7'),_0x34e5('0x8')]});config[_0x34e5('0x9')]=_[_0x34e5('0xa')](config[_0x34e5('0x9')],{'host':'localhost','port':0x18eb});socketio[_0x34e5('0xb')](require(_0x34e5('0xc'))({'pubClient':new Redis(config[_0x34e5('0x9')]),'subClient':new Redis(config['redis'])}));require(_0x34e5('0xd'))[_0x34e5('0xe')]();require('../../config/socketio')[_0x34e5('0xe')](socketio);require('../../config/express')[_0x34e5('0xe')](app);require(_0x34e5('0xf'))[_0x34e5('0xe')](app);}else{server[_0x34e5('0x10')](_0x34e5('0x11'),function(){console[_0x34e5('0x12')](_0x34e5('0x13'),config['port']);});}exports=module[_0x34e5('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 72bb8c9..0802d7e 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 _0xc2b3=['routing','error','message','result','jayson/promise','bluebird','../../config/logger','client','http','then','debug','rpc'];(function(_0x10b317,_0x2adf32){var _0x1e3054=function(_0x38ed3e){while(--_0x38ed3e){_0x10b317['push'](_0x10b317['shift']());}};_0x1e3054(++_0x2adf32);}(_0xc2b3,0x1d8));var _0x3c2b=function(_0x42a039,_0xd63c50){_0x42a039=_0x42a039-0x0;var _0x100f77=_0xc2b3[_0x42a039];return _0x100f77;};'use strict';var jayson=require(_0x3c2b('0x0'));var BPromise=require(_0x3c2b('0x1'));var logger=require(_0x3c2b('0x2'))('routing');var client=jayson[_0x3c2b('0x3')][_0x3c2b('0x4')]({'port':0x2329});client['Request']=function(_0x259895,_0x18a98a){return new BPromise(function(_0x2a58b2,_0x3980a5){return client['request'](_0x259895,_0x18a98a)[_0x3c2b('0x5')](function(_0x48cccf){logger[_0x3c2b('0x6')](_0x3c2b('0x7'),_0x3c2b('0x8'),_0x259895,_0x18a98a,_0x48cccf);if(_0x48cccf[_0x3c2b('0x9')]){logger[_0x3c2b('0x9')](_0x3c2b('0x7'),_0x3c2b('0x8'),_0x259895,_0x48cccf[_0x3c2b('0x9')][_0x3c2b('0xa')],_0x18a98a);return _0x3980a5(_0x48cccf[_0x3c2b('0x9')][_0x3c2b('0xa')]);}else{return _0x2a58b2(_0x48cccf[_0x3c2b('0xb')]);}})['catch'](function(_0x54e0eb){logger[_0x3c2b('0x9')](_0x3c2b('0x7'),'routing',_0x259895,_0x54e0eb,_0x18a98a);return _0x3980a5(_0x54e0eb);});});};module['exports']=client; \ No newline at end of file +var _0x0558=['rpc','routing','error','message','result','catch','exports','jayson/promise','bluebird','client','debug'];(function(_0x3ab14c,_0x4093a1){var _0x423753=function(_0x278031){while(--_0x278031){_0x3ab14c['push'](_0x3ab14c['shift']());}};_0x423753(++_0x4093a1);}(_0x0558,0x6a));var _0x8055=function(_0x1af98d,_0x3c608e){_0x1af98d=_0x1af98d-0x0;var _0x3553ea=_0x0558[_0x1af98d];return _0x3553ea;};'use strict';var jayson=require(_0x8055('0x0'));var BPromise=require(_0x8055('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0x8055('0x2')]['http']({'port':0x2329});client['Request']=function(_0x55a9be,_0x3eda70){return new BPromise(function(_0x1879f2,_0x2e9f13){return client['request'](_0x55a9be,_0x3eda70)['then'](function(_0x1cd4d3){logger[_0x8055('0x3')](_0x8055('0x4'),_0x8055('0x5'),_0x55a9be,_0x3eda70,_0x1cd4d3);if(_0x1cd4d3['error']){logger[_0x8055('0x6')](_0x8055('0x4'),_0x8055('0x5'),_0x55a9be,_0x1cd4d3['error']['message'],_0x3eda70);return _0x2e9f13(_0x1cd4d3[_0x8055('0x6')][_0x8055('0x7')]);}else{return _0x1879f2(_0x1cd4d3[_0x8055('0x8')]);}})[_0x8055('0x9')](function(_0x33768c){logger[_0x8055('0x6')]('rpc',_0x8055('0x5'),_0x55a9be,_0x33768c,_0x3eda70);return _0x2e9f13(_0x33768c);});});};module[_0x8055('0xa')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index c46787d..646f02c 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 _0x1303=['./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','bluebird','./server'];(function(_0x356998,_0x153edc){var _0x124f22=function(_0x19333e){while(--_0x19333e){_0x356998['push'](_0x356998['shift']());}};_0x124f22(++_0x153edc);}(_0x1303,0xcd));var _0x3130=function(_0x22499b,_0x3d5a5c){_0x22499b=_0x22499b-0x0;var _0x35cabe=_0x1303[_0x22499b];return _0x35cabe;};'use strict';var BPromise=require(_0x3130('0x0'));var server=require(_0x3130('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x3130('0x2'));var smsQueue=require(_0x3130('0x3'));var mailQueue=require(_0x3130('0x4'));var faxQueue=require(_0x3130('0x5'));var whatsappQueue=require(_0x3130('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x3130('0x7')](user[_0x3130('0x8')]())['then'](realtime[_0x3130('0x9')]())[_0x3130('0x7')](interval[_0x3130('0xa')]())[_0x3130('0x7')](realtime[_0x3130('0xb')]())[_0x3130('0x7')](openchannelQueue[_0x3130('0xc')]())['then'](realtime['initOpenchannelQueues']())['then'](chatQueue[_0x3130('0xd')]())[_0x3130('0x7')](realtime[_0x3130('0xe')]())[_0x3130('0x7')](smsQueue[_0x3130('0xf')]())[_0x3130('0x7')](realtime['initSmsQueues']())[_0x3130('0x7')](mailQueue[_0x3130('0x10')]())['then'](realtime[_0x3130('0x11')]())[_0x3130('0x7')](faxQueue[_0x3130('0x12')]())[_0x3130('0x7')](realtime[_0x3130('0x13')]())['then'](whatsappQueue['getWhatsappQueues']())[_0x3130('0x7')](realtime[_0x3130('0x14')]())[_0x3130('0x7')](function(){return realtime;});}function main(){return server[_0x3130('0x15')](realtime)[_0x3130('0x7')](function(_0x75d4a4){return initRealtime();})[_0x3130('0x7')](function(_0x14c65f){return setInterval(initRealtime,0x1388);})[_0x3130('0x16')](function(_0x2e221d){console['log'](_0x2e221d);});}main(); \ No newline at end of file +var _0x8c9d=['resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x8c9d,0xd8));var _0xd8c9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8c9d[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0xd8c9('0x0'));var server=require('./server');var Realtime=require(_0xd8c9('0x1'));var user=require(_0xd8c9('0x2'));var interval=require(_0xd8c9('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xd8c9('0x4'));var smsQueue=require(_0xd8c9('0x5'));var mailQueue=require(_0xd8c9('0x6'));var faxQueue=require(_0xd8c9('0x7'));var whatsappQueue=require(_0xd8c9('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xd8c9('0x9')]()[_0xd8c9('0xa')](user[_0xd8c9('0xb')]())['then'](realtime[_0xd8c9('0xc')]())[_0xd8c9('0xa')](interval[_0xd8c9('0xd')]())[_0xd8c9('0xa')](realtime[_0xd8c9('0xe')]())[_0xd8c9('0xa')](openchannelQueue[_0xd8c9('0xf')]())[_0xd8c9('0xa')](realtime['initOpenchannelQueues']())[_0xd8c9('0xa')](chatQueue[_0xd8c9('0x10')]())[_0xd8c9('0xa')](realtime[_0xd8c9('0x11')]())['then'](smsQueue['getSmsQueues']())[_0xd8c9('0xa')](realtime['initSmsQueues']())[_0xd8c9('0xa')](mailQueue[_0xd8c9('0x12')]())[_0xd8c9('0xa')](realtime[_0xd8c9('0x13')]())[_0xd8c9('0xa')](faxQueue[_0xd8c9('0x14')]())['then'](realtime[_0xd8c9('0x15')]())['then'](whatsappQueue['getWhatsappQueues']())[_0xd8c9('0xa')](realtime[_0xd8c9('0x16')]())[_0xd8c9('0xa')](function(){return realtime;});}function main(){return server[_0xd8c9('0x17')](realtime)[_0xd8c9('0xa')](function(_0x318204){return initRealtime();})[_0xd8c9('0xa')](function(_0x4e13ea){return setInterval(initRealtime,0x1388);})[_0xd8c9('0x18')](function(_0x1afcad){console['log'](_0x1afcad);});}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 5a99cdf..a086af7 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x3712d3,_0x44effa){var _0x447bb8=function(_0x4e4358){while(--_0x4e4358){_0x3712d3['push'](_0x3712d3['shift']());}};_0x447bb8(++_0x44effa);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc4aa[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x4a8378,_0x57627b){var _0xf67798=function(_0x3a58fd){while(--_0x3a58fd){_0x4a8378['push'](_0x4a8378['shift']());}};_0xf67798(++_0x57627b);}(_0xe14b,0x93));var _0xbe14=function(_0x67126c,_0x4ccffc){_0x67126c=_0x67126c-0x0;var _0x442091=_0xe14b[_0x67126c];return _0x442091;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index e0cf13f..992189e 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 _0x9a86=['jayson/promise','client','then','error','message','result','catch','bluebird'];(function(_0x3ad70b,_0x20e2c4){var _0x2e5ec6=function(_0xbc66b7){while(--_0xbc66b7){_0x3ad70b['push'](_0x3ad70b['shift']());}};_0x2e5ec6(++_0x20e2c4);}(_0x9a86,0x167));var _0x69a8=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x9a86[_0x235482];return _0x5f5bea;};'use strict';var BPromise=require(_0x69a8('0x0'));var jayson=require(_0x69a8('0x1'));var client=jayson[_0x69a8('0x2')]['http']({'port':0x232b});function request(_0x399b45,_0x4a8024){return new BPromise(function(_0x1bcef3,_0x59bc1d){return client['request'](_0x399b45,_0x4a8024)[_0x69a8('0x3')](function(_0x385f4c){if(_0x385f4c[_0x69a8('0x4')]){return _0x59bc1d(_0x385f4c[_0x69a8('0x4')][_0x69a8('0x5')]);}else{return _0x1bcef3(_0x385f4c[_0x69a8('0x6')]);}})[_0x69a8('0x7')](function(_0x51fdfd){return _0x59bc1d(_0x51fdfd);});});}exports['sendMailMessage']=function(_0x3dec55,_0x425476){return request('SendMail',{'account':_0x3dec55,'message':_0x425476});}; \ No newline at end of file +var _0xaf01=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','http','request','then','error'];(function(_0x205db5,_0x5ae499){var _0x530649=function(_0x28a350){while(--_0x28a350){_0x205db5['push'](_0x205db5['shift']());}};_0x530649(++_0x5ae499);}(_0xaf01,0xc0));var _0x1af0=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xaf01[_0x49b207];return _0x2dc8fa;};'use strict';var BPromise=require(_0x1af0('0x0'));var jayson=require(_0x1af0('0x1'));var client=jayson['client'][_0x1af0('0x2')]({'port':0x232b});function request(_0x3f51cf,_0xd24604){return new BPromise(function(_0x4b2cce,_0x49cbd2){return client[_0x1af0('0x3')](_0x3f51cf,_0xd24604)[_0x1af0('0x4')](function(_0x47b680){if(_0x47b680[_0x1af0('0x5')]){return _0x49cbd2(_0x47b680['error']['message']);}else{return _0x4b2cce(_0x47b680['result']);}})[_0x1af0('0x6')](function(_0x124a92){return _0x49cbd2(_0x124a92);});});}exports[_0x1af0('0x7')]=function(_0x57aca7,_0x31dffd){return request(_0x1af0('0x8'),{'account':_0x57aca7,'message':_0x31dffd});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 5d43114..02ca111 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 _0x5204=['working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','StatusTime','format','Status','faxStatusTime','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','smsWaitingInteractions','emit','user:routing:update','omit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity'];(function(_0x5a2fef,_0x438b15){var _0x4b7c1c=function(_0xc2b617){while(--_0xc2b617){_0x5a2fef['push'](_0x5a2fef['shift']());}};_0x4b7c1c(++_0x438b15);}(_0x5204,0xdf));var _0x4520=function(_0x5d6e35,_0x4d1ac0){_0x5d6e35=_0x5d6e35-0x0;var _0x5d7ada=_0x5204[_0x5d6e35];return _0x5d7ada;};'use strict';var _=require(_0x4520('0x0'));var md5=require(_0x4520('0x1'));var moment=require('moment');var Redis=require(_0x4520('0x2'));var config=require(_0x4520('0x3'));config[_0x4520('0x4')]=_[_0x4520('0x5')](config[_0x4520('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x4520('0x6'))(new Redis(config['redis']));function Agent(_0x180174){this['id']=_0x180174['id']||0x0;this[_0x4520('0x7')]=_0x180174[_0x4520('0x7')]||'';this[_0x4520('0x8')]=_0x180174[_0x4520('0x8')]||!![];this[_0x4520('0x9')]=_0x180174[_0x4520('0x9')]||![];this['chatPause']=_0x180174[_0x4520('0xa')]||![];this['mailPause']=_0x180174[_0x4520('0xb')]||![];this[_0x4520('0xc')]=_0x180174[_0x4520('0xc')]||![];this[_0x4520('0xd')]=_0x180174[_0x4520('0xd')]||![];this[_0x4520('0xe')]=_0x180174[_0x4520('0xe')]||![];this[_0x4520('0xf')]=_0x4520('0x10');this[_0x4520('0x11')]=0x0;this[_0x4520('0x12')]=_0x180174[_0x4520('0x12')]||0x0;this[_0x4520('0x13')]=0x0;this[_0x4520('0x14')]=_0x4520('0x10');this[_0x4520('0x15')]=0x0;this[_0x4520('0x16')]=_0x180174[_0x4520('0x16')]||0x0;this[_0x4520('0x17')]=0x0;this[_0x4520('0x18')]=_0x4520('0x10');this['faxStatusTime']=0x0;this[_0x4520('0x19')]=_0x180174[_0x4520('0x19')]||0x0;this[_0x4520('0x1a')]=0x0;this[_0x4520('0x1b')]=_0x4520('0x10');this['smsStatusTime']=0x0;this[_0x4520('0x1c')]=_0x180174[_0x4520('0x1c')]||0x0;this[_0x4520('0x1d')]=0x0;this[_0x4520('0x1e')]=_0x4520('0x10');this[_0x4520('0x1f')]=0x0;this[_0x4520('0x20')]=_0x180174[_0x4520('0x20')]||0x0;this[_0x4520('0x21')]=0x0;this[_0x4520('0x22')]=_0x4520('0x10');this[_0x4520('0x23')]=0x0;this['openchannelCapacity']=_0x180174[_0x4520('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0x4520('0x1')]='';this['chatWaitingInteractions']={};this[_0x4520('0x25')]={};this[_0x4520('0x26')]={};this[_0x4520('0x27')]={};this['smsWaitingInteractions']={};this[_0x4520('0x28')]={};this[_0x4520('0x29')]();}Agent[_0x4520('0x2a')]['getChannelStatus']=function(_0x198c34){if(this[_0x198c34+_0x4520('0x2b')]>0x0){if(this[_0x198c34+_0x4520('0x2c')]>0x0&&this[_0x198c34+_0x4520('0x2b')]>=this[_0x198c34+_0x4520('0x2c')]){return'maxcapacity';}else{return _0x4520('0x2d');}}else{return _0x4520('0x2e');}};Agent[_0x4520('0x2a')][_0x4520('0x29')]=function(){var _0x57306b=[_0x4520('0x2f'),_0x4520('0x30'),_0x4520('0x31'),_0x4520('0x32'),_0x4520('0x33'),_0x4520('0x34')];for(var _0x2d6902=0x0;_0x2d6902<_0x57306b[_0x4520('0x35')];_0x2d6902+=0x1){var _0x180c44=this[_0x4520('0x36')](_0x57306b[_0x2d6902]);if(this[_0x57306b[_0x2d6902]+'Status']!==_0x180c44){this[_0x57306b[_0x2d6902]+_0x4520('0x37')]=_['toNumber'](moment()[_0x4520('0x38')]('x'));}this[_0x57306b[_0x2d6902]+_0x4520('0x39')]=_0x180c44;}var _0x43b4a2={'id':this['id'],'name':this[_0x4520('0x7')],'online':this[_0x4520('0x8')],'voicePause':this[_0x4520('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0x4520('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0x4520('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x4520('0xf')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x4520('0x12')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x4520('0x15')],'mailCapacity':this[_0x4520('0x16')],'mailCurrentCapacity':this[_0x4520('0x17')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x4520('0x3a')],'faxCapacity':this[_0x4520('0x19')],'faxCurrentCapacity':this[_0x4520('0x1a')],'smsStatus':this[_0x4520('0x1b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x4520('0x1d')],'whatsappStatus':this[_0x4520('0x1e')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x4520('0x20')],'whatsappCurrentCapacity':this[_0x4520('0x21')],'openchannelStatus':this[_0x4520('0x22')],'openchannelStatusTime':this[_0x4520('0x23')],'openchannelCapacity':this[_0x4520('0x24')],'openchannelCurrentCapacity':this[_0x4520('0x3b')],'busy':this['busy'],'busyQueue':this[_0x4520('0x3c')],'chatWaitingInteractions':this[_0x4520('0x3d')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x4520('0x26')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x4520('0x3e')],'whatsappWaitingInteractions':this[_0x4520('0x28')]};var _0x4f2dc4=md5(JSON['stringify'](_0x43b4a2));if(this['md5']!==_0x4f2dc4){this[_0x4520('0x1')]=_0x4f2dc4;io[_0x4520('0x3f')](_0x4520('0x40'),_[_0x4520('0x41')](_0x43b4a2,[_0x4520('0x8')]));}};module[_0x4520('0x42')]=Agent; \ No newline at end of file +var _0x8aad=['mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','StatusTime','toNumber','format','mailPause','mailCurrentCapacity','smsStatusTime','smsCurrentCapacity','whatsappCurrentCapacity','faxWaitingInteractions','whatsappWaitingInteractions','stringify','user:routing:update','omit','exports','lodash','md5','ioredis','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus'];(function(_0x4f7a18,_0x5b58f1){var _0xdf7def=function(_0x4d534a){while(--_0x4d534a){_0x4f7a18['push'](_0x4f7a18['shift']());}};_0xdf7def(++_0x5b58f1);}(_0x8aad,0x146));var _0xd8aa=function(_0x453e52,_0x5d59ac){_0x453e52=_0x453e52-0x0;var _0x16cffb=_0x8aad[_0x453e52];return _0x16cffb;};'use strict';var _=require(_0xd8aa('0x0'));var md5=require(_0xd8aa('0x1'));var moment=require('moment');var Redis=require(_0xd8aa('0x2'));var config=require('../../../config/environment');config[_0xd8aa('0x3')]=_[_0xd8aa('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd8aa('0x5'))(new Redis(config['redis']));function Agent(_0x53248c){this['id']=_0x53248c['id']||0x0;this[_0xd8aa('0x6')]=_0x53248c[_0xd8aa('0x6')]||'';this[_0xd8aa('0x7')]=_0x53248c['online']||!![];this[_0xd8aa('0x8')]=_0x53248c[_0xd8aa('0x8')]||![];this[_0xd8aa('0x9')]=_0x53248c[_0xd8aa('0x9')]||![];this['mailPause']=_0x53248c['mailPause']||![];this[_0xd8aa('0xa')]=_0x53248c[_0xd8aa('0xa')]||![];this[_0xd8aa('0xb')]=_0x53248c[_0xd8aa('0xb')]||![];this[_0xd8aa('0xc')]=_0x53248c['openchannelPause']||![];this[_0xd8aa('0xd')]=_0xd8aa('0xe');this[_0xd8aa('0xf')]=0x0;this[_0xd8aa('0x10')]=_0x53248c[_0xd8aa('0x10')]||0x0;this[_0xd8aa('0x11')]=0x0;this[_0xd8aa('0x12')]=_0xd8aa('0xe');this[_0xd8aa('0x13')]=0x0;this[_0xd8aa('0x14')]=_0x53248c['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0xd8aa('0x15')]=_0xd8aa('0xe');this[_0xd8aa('0x16')]=0x0;this['faxCapacity']=_0x53248c[_0xd8aa('0x17')]||0x0;this[_0xd8aa('0x18')]=0x0;this[_0xd8aa('0x19')]=_0xd8aa('0xe');this['smsStatusTime']=0x0;this[_0xd8aa('0x1a')]=_0x53248c[_0xd8aa('0x1a')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xd8aa('0x1b')]=_0xd8aa('0xe');this[_0xd8aa('0x1c')]=0x0;this[_0xd8aa('0x1d')]=_0x53248c[_0xd8aa('0x1d')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xd8aa('0x1e')]=_0xd8aa('0xe');this[_0xd8aa('0x1f')]=0x0;this[_0xd8aa('0x20')]=_0x53248c['openchannelCapacity']||0x0;this[_0xd8aa('0x21')]=0x0;this[_0xd8aa('0x22')]=![];this[_0xd8aa('0x23')]=undefined;this[_0xd8aa('0x1')]='';this[_0xd8aa('0x24')]={};this['faxWaitingInteractions']={};this[_0xd8aa('0x25')]={};this[_0xd8aa('0x26')]={};this[_0xd8aa('0x27')]={};this['whatsappWaitingInteractions']={};this[_0xd8aa('0x28')]();}Agent[_0xd8aa('0x29')][_0xd8aa('0x2a')]=function(_0x290849){if(this[_0x290849+_0xd8aa('0x2b')]>0x0){if(this[_0x290849+_0xd8aa('0x2c')]>0x0&&this[_0x290849+_0xd8aa('0x2b')]>=this[_0x290849+_0xd8aa('0x2c')]){return _0xd8aa('0x2d');}else{return _0xd8aa('0x2e');}}else{return _0xd8aa('0x2f');}};Agent[_0xd8aa('0x29')][_0xd8aa('0x28')]=function(){var _0x5f1027=[_0xd8aa('0x30'),_0xd8aa('0x31'),_0xd8aa('0x32'),_0xd8aa('0x33'),_0xd8aa('0x34'),_0xd8aa('0x35')];for(var _0x26ab06=0x0;_0x26ab06<_0x5f1027[_0xd8aa('0x36')];_0x26ab06+=0x1){var _0x3bba1d=this[_0xd8aa('0x2a')](_0x5f1027[_0x26ab06]);if(this[_0x5f1027[_0x26ab06]+'Status']!==_0x3bba1d){this[_0x5f1027[_0x26ab06]+_0xd8aa('0x37')]=_[_0xd8aa('0x38')](moment()[_0xd8aa('0x39')]('x'));}this[_0x5f1027[_0x26ab06]+'Status']=_0x3bba1d;}var _0x19a59d={'id':this['id'],'name':this['name'],'online':this[_0xd8aa('0x7')],'voicePause':this[_0xd8aa('0x8')],'chatPause':this[_0xd8aa('0x9')],'mailPause':this[_0xd8aa('0x3a')],'smsPause':this[_0xd8aa('0xb')],'faxPause':this[_0xd8aa('0xa')],'openchannelPause':this[_0xd8aa('0xc')],'chatStatus':this[_0xd8aa('0xd')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xd8aa('0x10')],'chatCurrentCapacity':this[_0xd8aa('0x11')],'mailStatus':this[_0xd8aa('0x12')],'mailStatusTime':this[_0xd8aa('0x13')],'mailCapacity':this[_0xd8aa('0x14')],'mailCurrentCapacity':this[_0xd8aa('0x3b')],'faxStatus':this[_0xd8aa('0x15')],'faxStatusTime':this[_0xd8aa('0x16')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xd8aa('0x18')],'smsStatus':this[_0xd8aa('0x19')],'smsStatusTime':this[_0xd8aa('0x3c')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xd8aa('0x3d')],'whatsappStatus':this[_0xd8aa('0x1b')],'whatsappStatusTime':this[_0xd8aa('0x1c')],'whatsappCapacity':this[_0xd8aa('0x1d')],'whatsappCurrentCapacity':this[_0xd8aa('0x3e')],'openchannelStatus':this[_0xd8aa('0x1e')],'openchannelStatusTime':this[_0xd8aa('0x1f')],'openchannelCapacity':this[_0xd8aa('0x20')],'openchannelCurrentCapacity':this[_0xd8aa('0x21')],'busy':this['busy'],'busyQueue':this[_0xd8aa('0x23')],'chatWaitingInteractions':this[_0xd8aa('0x24')],'faxWaitingInteractions':this[_0xd8aa('0x3f')],'mailWaitingInteractions':this[_0xd8aa('0x25')],'openchannelWaitingInteractions':this[_0xd8aa('0x26')],'smsWaitingInteractions':this[_0xd8aa('0x27')],'whatsappWaitingInteractions':this[_0xd8aa('0x40')]};var _0x30b0c4=md5(JSON[_0xd8aa('0x41')](_0x19a59d));if(this['md5']!==_0x30b0c4){this[_0xd8aa('0x1')]=_0x30b0c4;io['emit'](_0xd8aa('0x42'),_[_0xd8aa('0x43')](_0x19a59d,['online']));}};module[_0xd8aa('0x44')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 04dbfdb..481e77d 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 _0x1072=['util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0x1072,0x115));var _0x2107=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x1072[_0x486f4a];return _0x135d99;};'use strict';var _=require(_0x2107('0x0'));var md5=require(_0x2107('0x1'));var util=require(_0x2107('0x2'));var Redis=require(_0x2107('0x3'));var config=require(_0x2107('0x4'));config[_0x2107('0x5')]=_['defaults'](config[_0x2107('0x5')],{'host':_0x2107('0x6'),'port':0x18eb});var io=require(_0x2107('0x7'))(new Redis(config['redis']));function ChatQueue(_0x5a5456){this['id']=_0x5a5456['id']||0x0;this[_0x2107('0x8')]=_0x5a5456[_0x2107('0x8')]||'';this[_0x2107('0x9')]=_0x5a5456[_0x2107('0x9')]||0xa;this['strategy']=_0x5a5456['strategy']||_0x2107('0xa');this['Agents']=_0x5a5456[_0x2107('0xb')];this[_0x2107('0xc')]={};this[_0x2107('0xd')]=0x0;this[_0x2107('0x1')]='';this[_0x2107('0xe')]();this[_0x2107('0xf')]();}ChatQueue['prototype'][_0x2107('0xe')]=function(){var _0x2e80bd=this['mapAgentsId'][_0x2107('0x10')];this['mapAgentsId']=_[_0x2107('0x11')](this[_0x2107('0xb')],'id');this['mapAgentsId'][_0x2107('0x10')]=_0x2e80bd;};ChatQueue[_0x2107('0x12')]['updateRealtime']=function(){this[_0x2107('0x13')]=0x0;this[_0x2107('0x14')]=0x0;for(var _0x3d33ab=0x0;_0x3d33ab=0x0?this[_0x2107('0x18')]:0x0;var _0x3c2018={'id':this['id'],'available':this[_0x2107('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x2107('0x8')],'paused':this[_0x2107('0x14')],'waiting':this['waiting']};var _0x43e73b=md5(JSON[_0x2107('0x19')](_0x3c2018));if(this['md5']!==_0x43e73b){this[_0x2107('0x1')]=_0x43e73b;io['to'](util[_0x2107('0x1a')](_0x2107('0x1b'),_0x3c2018[_0x2107('0x8')]))[_0x2107('0x1c')](_0x2107('0x1d'),_0x3c2018);}};module[_0x2107('0x1e')]=ChatQueue; \ No newline at end of file +var _0x8a1a=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','paused','online','loggedIn','available','stringify','chat:queue:%s','emit','chat_queue:save','lodash','md5','util'];(function(_0x218424,_0x4beac7){var _0x450c16=function(_0x367ea0){while(--_0x367ea0){_0x218424['push'](_0x218424['shift']());}};_0x450c16(++_0x4beac7);}(_0x8a1a,0x115));var _0xa8a1=function(_0x13524d,_0x505b49){_0x13524d=_0x13524d-0x0;var _0x9918b4=_0x8a1a[_0x13524d];return _0x9918b4;};'use strict';var _=require(_0xa8a1('0x0'));var md5=require(_0xa8a1('0x1'));var util=require(_0xa8a1('0x2'));var Redis=require('ioredis');var config=require(_0xa8a1('0x3'));config[_0xa8a1('0x4')]=_[_0xa8a1('0x5')](config[_0xa8a1('0x4')],{'host':_0xa8a1('0x6'),'port':0x18eb});var io=require(_0xa8a1('0x7'))(new Redis(config[_0xa8a1('0x4')]));function ChatQueue(_0x1fface){this['id']=_0x1fface['id']||0x0;this[_0xa8a1('0x8')]=_0x1fface[_0xa8a1('0x8')]||'';this[_0xa8a1('0x9')]=_0x1fface['timeout']||0xa;this['strategy']=_0x1fface[_0xa8a1('0xa')]||_0xa8a1('0xb');this[_0xa8a1('0xc')]=_0x1fface['Agents'];this['mapAgentsId']={};this[_0xa8a1('0xd')]=0x0;this['md5']='';this[_0xa8a1('0xe')]();this[_0xa8a1('0xf')]();}ChatQueue[_0xa8a1('0x10')][_0xa8a1('0xe')]=function(){var _0x311c3a=this['mapAgentsId'][_0xa8a1('0x11')];this[_0xa8a1('0x12')]=_[_0xa8a1('0x13')](this['Agents'],'id');this[_0xa8a1('0x12')]['_rr']=_0x311c3a;};ChatQueue['prototype'][_0xa8a1('0xf')]=function(){this['loggedIn']=0x0;this[_0xa8a1('0x14')]=0x0;for(var _0x1b0a47=0x0;_0x1b0a47=0x0?this[_0xa8a1('0x17')]:0x0;var _0x3bd0a4={'id':this['id'],'available':this[_0xa8a1('0x17')],'loggedIn':this[_0xa8a1('0x16')],'name':this[_0xa8a1('0x8')],'paused':this[_0xa8a1('0x14')],'waiting':this[_0xa8a1('0xd')]};var _0x27ac5d=md5(JSON[_0xa8a1('0x18')](_0x3bd0a4));if(this[_0xa8a1('0x1')]!==_0x27ac5d){this[_0xa8a1('0x1')]=_0x27ac5d;io['to'](util['format'](_0xa8a1('0x19'),_0x3bd0a4[_0xa8a1('0x8')]))[_0xa8a1('0x1a')](_0xa8a1('0x1b'),_0x3bd0a4);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 10cec25..5d5eb52 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 _0xa238=['updateRealtime','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','_rr','map'];(function(_0xf66a7e,_0x4a338b){var _0x41cc33=function(_0x52d0d9){while(--_0x52d0d9){_0xf66a7e['push'](_0xf66a7e['shift']());}};_0x41cc33(++_0x4a338b);}(_0xa238,0x1cf));var _0x8a23=function(_0x3e8fb0,_0x3d99be){_0x3e8fb0=_0x3e8fb0-0x0;var _0x16498f=_0xa238[_0x3e8fb0];return _0x16498f;};'use strict';var _=require(_0x8a23('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x8a23('0x1'));var config=require(_0x8a23('0x2'));config['redis']=_[_0x8a23('0x3')](config[_0x8a23('0x4')],{'host':_0x8a23('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8a23('0x4')]));function FaxQueue(_0x53802f){this['id']=_0x53802f['id']||0x0;this[_0x8a23('0x6')]=_0x53802f['name']||'';this[_0x8a23('0x7')]=_0x53802f[_0x8a23('0x7')]||0xa;this['strategy']=_0x53802f[_0x8a23('0x8')]||_0x8a23('0x9');this['Agents']=_0x53802f[_0x8a23('0xa')];this[_0x8a23('0xb')]={};this[_0x8a23('0xc')]=0x0;this[_0x8a23('0xd')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue['prototype'][_0x8a23('0xe')]=function(){var _0x2cc7b5=this[_0x8a23('0xb')][_0x8a23('0xf')];this[_0x8a23('0xb')]=_[_0x8a23('0x10')](this['Agents'],'id');this[_0x8a23('0xb')][_0x8a23('0xf')]=_0x2cc7b5;};FaxQueue['prototype'][_0x8a23('0x11')]=function(){this[_0x8a23('0x12')]=0x0;this[_0x8a23('0x13')]=0x0;for(var _0xfd22a5=0x0;_0xfd22a5=0x0?this[_0x8a23('0x17')]:0x0;var _0xb29bc4={'id':this['id'],'available':this[_0x8a23('0x17')],'loggedIn':this[_0x8a23('0x12')],'name':this['name'],'paused':this[_0x8a23('0x13')],'waiting':this[_0x8a23('0xc')]};var _0xc7d467=md5(JSON[_0x8a23('0x18')](_0xb29bc4));if(this[_0x8a23('0xd')]!==_0xc7d467){this[_0x8a23('0xd')]=_0xc7d467;io['to'](util[_0x8a23('0x19')](_0x8a23('0x1a'),_0xb29bc4[_0x8a23('0x6')]))[_0x8a23('0x1b')](_0x8a23('0x1c'),_0xb29bc4);}};module[_0x8a23('0x1d')]=FaxQueue; \ No newline at end of file +var _0x7abe=['fax:queue:%s','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','paused','length','available','stringify','format'];(function(_0x4cf628,_0x56c30f){var _0x44d7f3=function(_0x194ee9){while(--_0x194ee9){_0x4cf628['push'](_0x4cf628['shift']());}};_0x44d7f3(++_0x56c30f);}(_0x7abe,0x161));var _0xe7ab=function(_0x3f6527,_0x4b541a){_0x3f6527=_0x3f6527-0x0;var _0x129de2=_0x7abe[_0x3f6527];return _0x129de2;};'use strict';var _=require(_0xe7ab('0x0'));var md5=require('md5');var util=require(_0xe7ab('0x1'));var Redis=require('ioredis');var config=require(_0xe7ab('0x2'));config[_0xe7ab('0x3')]=_[_0xe7ab('0x4')](config['redis'],{'host':_0xe7ab('0x5'),'port':0x18eb});var io=require(_0xe7ab('0x6'))(new Redis(config[_0xe7ab('0x3')]));function FaxQueue(_0x3800b7){this['id']=_0x3800b7['id']||0x0;this[_0xe7ab('0x7')]=_0x3800b7[_0xe7ab('0x7')]||'';this[_0xe7ab('0x8')]=_0x3800b7['timeout']||0xa;this['strategy']=_0x3800b7['strategy']||_0xe7ab('0x9');this[_0xe7ab('0xa')]=_0x3800b7[_0xe7ab('0xa')];this[_0xe7ab('0xb')]={};this[_0xe7ab('0xc')]=0x0;this[_0xe7ab('0xd')]='';this[_0xe7ab('0xe')]();this['updateRealtime']();}FaxQueue['prototype'][_0xe7ab('0xe')]=function(){var _0x5f4c5d=this['mapAgentsId'][_0xe7ab('0xf')];this[_0xe7ab('0xb')]=_[_0xe7ab('0x10')](this['Agents'],'id');this[_0xe7ab('0xb')][_0xe7ab('0xf')]=_0x5f4c5d;};FaxQueue[_0xe7ab('0x11')][_0xe7ab('0x12')]=function(){this[_0xe7ab('0x13')]=0x0;this[_0xe7ab('0x14')]=0x0;for(var _0xa3514a=0x0;_0xa3514a=0x0?this[_0xe7ab('0x16')]:0x0;var _0xa0c33d={'id':this['id'],'available':this[_0xe7ab('0x16')],'loggedIn':this[_0xe7ab('0x13')],'name':this[_0xe7ab('0x7')],'paused':this[_0xe7ab('0x14')],'waiting':this[_0xe7ab('0xc')]};var _0x406a46=md5(JSON[_0xe7ab('0x17')](_0xa0c33d));if(this[_0xe7ab('0xd')]!==_0x406a46){this[_0xe7ab('0xd')]=_0x406a46;io['to'](util[_0xe7ab('0x18')](_0xe7ab('0x19'),_0xa0c33d[_0xe7ab('0x7')]))['emit']('fax_queue:save',_0xa0c33d);}};module[_0xe7ab('0x1a')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 0fef036..b2bdc1f 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 _0xb1ca=['exports','name','Intervals'];(function(_0x441819,_0x5b8d0a){var _0x478882=function(_0x369786){while(--_0x369786){_0x441819['push'](_0x441819['shift']());}};_0x478882(++_0x5b8d0a);}(_0xb1ca,0x1f0));var _0xab1c=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xb1ca[_0x36ed48];return _0x51c63a;};'use strict';function Interval(_0x5be2d4){this['id']=_0x5be2d4['id']||0x0;this[_0xab1c('0x0')]=_0x5be2d4[_0xab1c('0x0')]||'';this[_0xab1c('0x1')]=_0x5be2d4[_0xab1c('0x1')]||{};}module[_0xab1c('0x2')]=Interval; \ No newline at end of file +var _0x4702=['name','Intervals','exports'];(function(_0x2ae278,_0x5eb5a4){var _0x412c37=function(_0xcaab64){while(--_0xcaab64){_0x2ae278['push'](_0x2ae278['shift']());}};_0x412c37(++_0x5eb5a4);}(_0x4702,0x120));var _0x2470=function(_0x585551,_0x489080){_0x585551=_0x585551-0x0;var _0x55c80b=_0x4702[_0x585551];return _0x55c80b;};'use strict';function Interval(_0x4c9b49){this['id']=_0x4c9b49['id']||0x0;this[_0x2470('0x0')]=_0x4c9b49['name']||'';this[_0x2470('0x1')]=_0x4c9b49[_0x2470('0x1')]||{};}module[_0x2470('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 0b883f5..4cbe091 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 _0x2dac=['../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','paused','length','loggedIn','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','md5','ioredis'];(function(_0x158a70,_0x503d58){var _0x2bf62f=function(_0xb50f31){while(--_0xb50f31){_0x158a70['push'](_0x158a70['shift']());}};_0x2bf62f(++_0x503d58);}(_0x2dac,0xd6));var _0xc2da=function(_0x45d569,_0x319867){_0x45d569=_0x45d569-0x0;var _0x4e9425=_0x2dac[_0x45d569];return _0x4e9425;};'use strict';var _=require('lodash');var md5=require(_0xc2da('0x0'));var util=require('util');var Redis=require(_0xc2da('0x1'));var config=require(_0xc2da('0x2'));config['redis']=_[_0xc2da('0x3')](config[_0xc2da('0x4')],{'host':_0xc2da('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x1fcd33){this['id']=_0x1fcd33['id']||0x0;this[_0xc2da('0x6')]=_0x1fcd33[_0xc2da('0x6')]||'';this[_0xc2da('0x7')]=_0x1fcd33[_0xc2da('0x7')]||0xa;this[_0xc2da('0x8')]=_0x1fcd33[_0xc2da('0x8')]||_0xc2da('0x9');this[_0xc2da('0xa')]=_0x1fcd33[_0xc2da('0xa')];this[_0xc2da('0xb')]={};this[_0xc2da('0xc')]=0x0;this[_0xc2da('0x0')]='';this['updateRouting']();this[_0xc2da('0xd')]();}MailQueue[_0xc2da('0xe')][_0xc2da('0xf')]=function(){var _0x4fac01=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xc2da('0x10')](this[_0xc2da('0xa')],'id');this[_0xc2da('0xb')]['_rr']=_0x4fac01;};MailQueue[_0xc2da('0xe')][_0xc2da('0xd')]=function(){this['loggedIn']=0x0;this[_0xc2da('0x11')]=0x0;for(var _0xbc890c=0x0;_0xbc890c=0x0?this[_0xc2da('0x14')]:0x0;var _0x37c484={'id':this['id'],'available':this[_0xc2da('0x14')],'loggedIn':this[_0xc2da('0x13')],'name':this[_0xc2da('0x6')],'paused':this['paused'],'waiting':this[_0xc2da('0xc')]};var _0x1fbbee=md5(JSON[_0xc2da('0x15')](_0x37c484));if(this[_0xc2da('0x0')]!==_0x1fbbee){this[_0xc2da('0x0')]=_0x1fbbee;io['to'](util[_0xc2da('0x16')](_0xc2da('0x17'),_0x37c484[_0xc2da('0x6')]))[_0xc2da('0x18')](_0xc2da('0x19'),_0x37c484);}};module[_0xc2da('0x1a')]=MailQueue; \ No newline at end of file +var _0xe0e2=['md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','paused','length','online','loggedIn','mailPause','available','mail:queue:%s','emit','mail_queue:save','exports','lodash'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xe0e2,0x1b1));var _0x2e0e=function(_0x3bdc30,_0x119486){_0x3bdc30=_0x3bdc30-0x0;var _0x1a4986=_0xe0e2[_0x3bdc30];return _0x1a4986;};'use strict';var _=require(_0x2e0e('0x0'));var md5=require(_0x2e0e('0x1'));var util=require(_0x2e0e('0x2'));var Redis=require(_0x2e0e('0x3'));var config=require(_0x2e0e('0x4'));config[_0x2e0e('0x5')]=_[_0x2e0e('0x6')](config[_0x2e0e('0x5')],{'host':_0x2e0e('0x7'),'port':0x18eb});var io=require(_0x2e0e('0x8'))(new Redis(config[_0x2e0e('0x5')]));function MailQueue(_0x791cb1){this['id']=_0x791cb1['id']||0x0;this[_0x2e0e('0x9')]=_0x791cb1['name']||'';this[_0x2e0e('0xa')]=_0x791cb1['timeout']||0xa;this[_0x2e0e('0xb')]=_0x791cb1[_0x2e0e('0xb')]||_0x2e0e('0xc');this[_0x2e0e('0xd')]=_0x791cb1[_0x2e0e('0xd')];this[_0x2e0e('0xe')]={};this[_0x2e0e('0xf')]=0x0;this[_0x2e0e('0x1')]='';this[_0x2e0e('0x10')]();this[_0x2e0e('0x11')]();}MailQueue['prototype'][_0x2e0e('0x10')]=function(){var _0x24bc77=this['mapAgentsId'][_0x2e0e('0x12')];this[_0x2e0e('0xe')]=_[_0x2e0e('0x13')](this['Agents'],'id');this[_0x2e0e('0xe')]['_rr']=_0x24bc77;};MailQueue[_0x2e0e('0x14')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x2e0e('0x15')]=0x0;for(var _0x585b45=0x0;_0x585b45=0x0?this[_0x2e0e('0x1a')]:0x0;var _0x45d7df={'id':this['id'],'available':this[_0x2e0e('0x1a')],'loggedIn':this[_0x2e0e('0x18')],'name':this[_0x2e0e('0x9')],'paused':this[_0x2e0e('0x15')],'waiting':this[_0x2e0e('0xf')]};var _0x58aab3=md5(JSON['stringify'](_0x45d7df));if(this['md5']!==_0x58aab3){this[_0x2e0e('0x1')]=_0x58aab3;io['to'](util['format'](_0x2e0e('0x1b'),_0x45d7df[_0x2e0e('0x9')]))[_0x2e0e('0x1c')](_0x2e0e('0x1d'),_0x45d7df);}};module[_0x2e0e('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 3205c87..3dc3dd5 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(_0x4ee9cd,_0xd375b0){var _0x328a5b=function(_0x3ad1f4){while(--_0x3ad1f4){_0x4ee9cd['push'](_0x4ee9cd['shift']());}};_0x328a5b(++_0xd375b0);}(_0x2ef3,0xba));var _0x32ef=function(_0x28ef83,_0x45272f){_0x28ef83=_0x28ef83-0x0;var _0x53440e=_0x2ef3[_0x28ef83];return _0x53440e;};'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 _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x326f,0xd1));var _0xf326=function(_0x294d35,_0x32f743){_0x294d35=_0x294d35-0x0;var _0x5e5cd3=_0x326f[_0x294d35];return _0x5e5cd3;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index bcc1258..7e02a84 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 _0x0eec=['paused','format','emit','sms_queue:save','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','length','online','loggedIn','available'];(function(_0x98db01,_0x352720){var _0x343f92=function(_0x54efbd){while(--_0x54efbd){_0x98db01['push'](_0x98db01['shift']());}};_0x343f92(++_0x352720);}(_0x0eec,0xac));var _0xc0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc0ee('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xc0ee('0x1'));var config=require(_0xc0ee('0x2'));config[_0xc0ee('0x3')]=_[_0xc0ee('0x4')](config[_0xc0ee('0x3')],{'host':_0xc0ee('0x5'),'port':0x18eb});var io=require(_0xc0ee('0x6'))(new Redis(config['redis']));function SmsQueue(_0x10ab80){this['id']=_0x10ab80['id']||0x0;this['name']=_0x10ab80[_0xc0ee('0x7')]||'';this[_0xc0ee('0x8')]=_0x10ab80[_0xc0ee('0x8')]||0xa;this[_0xc0ee('0x9')]=_0x10ab80[_0xc0ee('0x9')]||_0xc0ee('0xa');this[_0xc0ee('0xb')]=_0x10ab80['Agents'];this[_0xc0ee('0xc')]={};this[_0xc0ee('0xd')]=0x0;this[_0xc0ee('0xe')]='';this[_0xc0ee('0xf')]();this[_0xc0ee('0x10')]();}SmsQueue[_0xc0ee('0x11')][_0xc0ee('0xf')]=function(){var _0x47aedf=this[_0xc0ee('0xc')][_0xc0ee('0x12')];this[_0xc0ee('0xc')]=_[_0xc0ee('0x13')](this[_0xc0ee('0xb')],'id');this[_0xc0ee('0xc')][_0xc0ee('0x12')]=_0x47aedf;};SmsQueue[_0xc0ee('0x11')][_0xc0ee('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x1f3ad9=0x0;_0x1f3ad9=0x0?this['available']:0x0;var _0x4e7e82={'id':this['id'],'available':this[_0xc0ee('0x17')],'loggedIn':this[_0xc0ee('0x16')],'name':this[_0xc0ee('0x7')],'paused':this['paused'],'waiting':this[_0xc0ee('0xd')]};var _0xe15d59=md5(JSON['stringify'](_0x4e7e82));if(this['md5']!==_0xe15d59){this[_0xc0ee('0xe')]=_0xe15d59;io['to'](util[_0xc0ee('0x19')]('sms:queue:%s',_0x4e7e82[_0xc0ee('0x7')]))[_0xc0ee('0x1a')](_0xc0ee('0x1b'),_0x4e7e82);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x6a24=['name','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','smsPause','available','waiting','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter'];(function(_0x30e4c8,_0x11b4e5){var _0x5b129d=function(_0x45cd55){while(--_0x45cd55){_0x30e4c8['push'](_0x30e4c8['shift']());}};_0x5b129d(++_0x11b4e5);}(_0x6a24,0xd1));var _0x46a2=function(_0x1e725e,_0x815936){_0x1e725e=_0x1e725e-0x0;var _0x2fdfe1=_0x6a24[_0x1e725e];return _0x2fdfe1;};'use strict';var _=require(_0x46a2('0x0'));var md5=require(_0x46a2('0x1'));var util=require('util');var Redis=require(_0x46a2('0x2'));var config=require(_0x46a2('0x3'));config[_0x46a2('0x4')]=_[_0x46a2('0x5')](config[_0x46a2('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x46a2('0x6'))(new Redis(config[_0x46a2('0x4')]));function SmsQueue(_0x4f6948){this['id']=_0x4f6948['id']||0x0;this[_0x46a2('0x7')]=_0x4f6948[_0x46a2('0x7')]||'';this['timeout']=_0x4f6948['timeout']||0xa;this[_0x46a2('0x8')]=_0x4f6948[_0x46a2('0x8')]||'beepall';this[_0x46a2('0x9')]=_0x4f6948['Agents'];this[_0x46a2('0xa')]={};this['waiting']=0x0;this[_0x46a2('0x1')]='';this[_0x46a2('0xb')]();this[_0x46a2('0xc')]();}SmsQueue[_0x46a2('0xd')][_0x46a2('0xb')]=function(){var _0x40ef63=this[_0x46a2('0xa')][_0x46a2('0xe')];this['mapAgentsId']=_['map'](this[_0x46a2('0x9')],'id');this[_0x46a2('0xa')]['_rr']=_0x40ef63;};SmsQueue[_0x46a2('0xd')][_0x46a2('0xc')]=function(){this[_0x46a2('0xf')]=0x0;this[_0x46a2('0x10')]=0x0;for(var _0xddc328=0x0;_0xddc328=0x0?this['available']:0x0;var _0x27250b={'id':this['id'],'available':this[_0x46a2('0x13')],'loggedIn':this['loggedIn'],'name':this[_0x46a2('0x7')],'paused':this[_0x46a2('0x10')],'waiting':this[_0x46a2('0x14')]};var _0xc28d15=md5(JSON[_0x46a2('0x15')](_0x27250b));if(this[_0x46a2('0x1')]!==_0xc28d15){this[_0x46a2('0x1')]=_0xc28d15;io['to'](util[_0x46a2('0x16')](_0x46a2('0x17'),_0x27250b[_0x46a2('0x7')]))[_0x46a2('0x18')](_0x46a2('0x19'),_0x27250b);}};module[_0x46a2('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 8d0787b..1f5d774 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 _0x3c41=['redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','online','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','../../../config/environment','defaults'];(function(_0xc28c98,_0x345521){var _0x233fea=function(_0x26a400){while(--_0x26a400){_0xc28c98['push'](_0xc28c98['shift']());}};_0x233fea(++_0x345521);}(_0x3c41,0xef));var _0x13c4=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3c41[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var md5=require(_0x13c4('0x0'));var util=require(_0x13c4('0x1'));var Redis=require('ioredis');var config=require(_0x13c4('0x2'));config['redis']=_[_0x13c4('0x3')](config[_0x13c4('0x4')],{'host':_0x13c4('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x13c4('0x4')]));function WhatsappQueue(_0x1a8ab9){this['id']=_0x1a8ab9['id']||0x0;this[_0x13c4('0x6')]=_0x1a8ab9[_0x13c4('0x6')]||'';this[_0x13c4('0x7')]=_0x1a8ab9['timeout']||0xa;this[_0x13c4('0x8')]=_0x1a8ab9[_0x13c4('0x8')]||_0x13c4('0x9');this[_0x13c4('0xa')]=_0x1a8ab9[_0x13c4('0xa')];this[_0x13c4('0xb')]={};this[_0x13c4('0xc')]=0x0;this[_0x13c4('0x0')]='';this[_0x13c4('0xd')]();this[_0x13c4('0xe')]();}WhatsappQueue[_0x13c4('0xf')][_0x13c4('0xd')]=function(){var _0x45e901=this[_0x13c4('0xb')]['_rr'];this[_0x13c4('0xb')]=_['map'](this['Agents'],'id');this[_0x13c4('0xb')][_0x13c4('0x10')]=_0x45e901;};WhatsappQueue[_0x13c4('0xf')]['updateRealtime']=function(){this[_0x13c4('0x11')]=0x0;this[_0x13c4('0x12')]=0x0;for(var _0x3bf218=0x0;_0x3bf218=0x0?this[_0x13c4('0x15')]:0x0;var _0x4ee79c={'id':this['id'],'available':this[_0x13c4('0x15')],'loggedIn':this[_0x13c4('0x11')],'name':this[_0x13c4('0x6')],'paused':this[_0x13c4('0x12')],'waiting':this[_0x13c4('0xc')]};var _0x317cb0=md5(JSON['stringify'](_0x4ee79c));if(this[_0x13c4('0x0')]!==_0x317cb0){this['md5']=_0x317cb0;io['to'](util[_0x13c4('0x16')](_0x13c4('0x17'),_0x4ee79c['name']))[_0x13c4('0x18')](_0x13c4('0x19'),_0x4ee79c);}};module[_0x13c4('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0xcf92=['md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','loggedIn','paused','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash'];(function(_0x27f92f,_0x2fa692){var _0x1a1729=function(_0x138ed4){while(--_0x138ed4){_0x27f92f['push'](_0x27f92f['shift']());}};_0x1a1729(++_0x2fa692);}(_0xcf92,0x95));var _0x2cf9=function(_0x3200ce,_0x48615a){_0x3200ce=_0x3200ce-0x0;var _0x3f766e=_0xcf92[_0x3200ce];return _0x3f766e;};'use strict';var _=require(_0x2cf9('0x0'));var md5=require(_0x2cf9('0x1'));var util=require(_0x2cf9('0x2'));var Redis=require(_0x2cf9('0x3'));var config=require(_0x2cf9('0x4'));config[_0x2cf9('0x5')]=_[_0x2cf9('0x6')](config[_0x2cf9('0x5')],{'host':_0x2cf9('0x7'),'port':0x18eb});var io=require(_0x2cf9('0x8'))(new Redis(config[_0x2cf9('0x5')]));function WhatsappQueue(_0x3d219f){this['id']=_0x3d219f['id']||0x0;this[_0x2cf9('0x9')]=_0x3d219f[_0x2cf9('0x9')]||'';this['timeout']=_0x3d219f[_0x2cf9('0xa')]||0xa;this['strategy']=_0x3d219f[_0x2cf9('0xb')]||'beepall';this[_0x2cf9('0xc')]=_0x3d219f[_0x2cf9('0xc')];this['mapAgentsId']={};this[_0x2cf9('0xd')]=0x0;this[_0x2cf9('0x1')]='';this[_0x2cf9('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x2cf9('0xf')][_0x2cf9('0xe')]=function(){var _0x56ced6=this[_0x2cf9('0x10')][_0x2cf9('0x11')];this[_0x2cf9('0x10')]=_[_0x2cf9('0x12')](this['Agents'],'id');this[_0x2cf9('0x10')]['_rr']=_0x56ced6;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0x2cf9('0x13')]=0x0;this[_0x2cf9('0x14')]=0x0;for(var _0x5c91b1=0x0;_0x5c91b1=0x0?this['available']:0x0;var _0x308aec={'id':this['id'],'available':this[_0x2cf9('0x17')],'loggedIn':this[_0x2cf9('0x13')],'name':this[_0x2cf9('0x9')],'paused':this[_0x2cf9('0x14')],'waiting':this[_0x2cf9('0xd')]};var _0x390da2=md5(JSON[_0x2cf9('0x18')](_0x308aec));if(this[_0x2cf9('0x1')]!==_0x390da2){this[_0x2cf9('0x1')]=_0x390da2;io['to'](util[_0x2cf9('0x19')](_0x2cf9('0x1a'),_0x308aec[_0x2cf9('0x9')]))[_0x2cf9('0x1b')](_0x2cf9('0x1c'),_0x308aec);}};module[_0x2cf9('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index b34229d..4118a3d 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x273d6b,_0xf40005){var _0x545b1f=function(_0xc6fff1){while(--_0xc6fff1){_0x273d6b['push'](_0x273d6b['shift']());}};_0x545b1f(++_0xf40005);}(_0xb10b,0x12a));var _0xbb10=function(_0x5211cd,_0x266b93){_0x5211cd=_0x5211cd-0x0;var _0x366c0f=_0xb10b[_0x5211cd];return _0x366c0f;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x22a020,_0x5193a4){var _0x3afdc9=function(_0x1d4c16){while(--_0x1d4c16){_0x22a020['push'](_0x22a020['shift']());}};_0x3afdc9(++_0x5193a4);}(_0xb10b,0x12a));var _0xbb10=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xb10b[_0x50a0c2];return _0x5ebadd;};'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 95441b5..aa7d6e3 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 _0x7978=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x5bda3b,_0x41160f){var _0x431bb9=function(_0x160122){while(--_0x160122){_0x5bda3b['push'](_0x5bda3b['shift']());}};_0x431bb9(++_0x41160f);}(_0x7978,0x149));var _0x8797=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x7978[_0x29d915];return _0x160f86;};'use strict';var client=require(_0x8797('0x0'));exports[_0x8797('0x1')]=function(_0x559558,_0x2069b9){return client[_0x8797('0x2')](_0x8797('0x3'),{'body':_0x2069b9,'options':{'where':{'id':_0x559558}},'log':_0x8797('0x4')});};exports[_0x8797('0x5')]=function(_0x3d702e,_0x509a6a){return client[_0x8797('0x2')](_0x8797('0x6'),{'body':_0x509a6a,'options':{'where':{'id':_0x3d702e}},'log':_0x8797('0x7')});}; \ No newline at end of file +var _0xc418=['update','Request','updateChatInteraction','AddTagsToChatInteraction'];(function(_0x558165,_0xf5d905){var _0x41138d=function(_0x203da7){while(--_0x203da7){_0x558165['push'](_0x558165['shift']());}};_0x41138d(++_0xf5d905);}(_0xc418,0x1cc));var _0x8c41=function(_0x33fdfc,_0x7c0a3a){_0x33fdfc=_0x33fdfc-0x0;var _0xc0f0f1=_0xc418[_0x33fdfc];return _0xc0f0f1;};'use strict';var client=require('../client');exports[_0x8c41('0x0')]=function(_0x306b18,_0x939722){return client[_0x8c41('0x1')]('UpdateChatInteraction',{'body':_0x939722,'options':{'where':{'id':_0x306b18}},'log':_0x8c41('0x2')});};exports['addTags']=function(_0x295506,_0x1e633a){return client[_0x8c41('0x1')](_0x8c41('0x3'),{'body':_0x1e633a,'options':{'where':{'id':_0x295506}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 0b1b9a5..0b60bab 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 _0x5625=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x285c33,_0x34bc26){var _0x3d7c22=function(_0x6fbef7){while(--_0x6fbef7){_0x285c33['push'](_0x285c33['shift']());}};_0x3d7c22(++_0x34bc26);}(_0x5625,0xd7));var _0x5562=function(_0x51332,_0x2e8ccf){_0x51332=_0x51332-0x0;var _0x4742e1=_0x5625[_0x51332];return _0x4742e1;};'use strict';var client=require(_0x5562('0x0'));exports[_0x5562('0x1')]=function(_0x15b199){return client[_0x5562('0x2')](_0x5562('0x3'),{'body':_0x15b199,'log':_0x5562('0x4')});}; \ No newline at end of file +var _0x3242=['create','Request','../client'];(function(_0x2c40bf,_0x5ce37a){var _0x31ab19=function(_0x56303){while(--_0x56303){_0x2c40bf['push'](_0x2c40bf['shift']());}};_0x31ab19(++_0x5ce37a);}(_0x3242,0x1be));var _0x2324=function(_0x3cf65f,_0x58fd7d){_0x3cf65f=_0x3cf65f-0x0;var _0x29ab47=_0x3242[_0x3cf65f];return _0x29ab47;};'use strict';var client=require(_0x2324('0x0'));exports[_0x2324('0x1')]=function(_0x1c248e){return client[_0x2324('0x2')]('CreateChatMessage',{'body':_0x1c248e,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 2c58078..06d041d 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 _0x55d2=['timeout','strategy','User','online','chatPause','getChatQueues','Request','GetChatQueue','name'];(function(_0x41fe67,_0x1a9aa5){var _0x4bb5fb=function(_0x1615cc){while(--_0x1615cc){_0x41fe67['push'](_0x41fe67['shift']());}};_0x4bb5fb(++_0x1a9aa5);}(_0x55d2,0x9f));var _0x255d=function(_0x48961c,_0x280e9d){_0x48961c=_0x48961c-0x0;var _0x1d895d=_0x55d2[_0x48961c];return _0x1d895d;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0x255d('0x0')](_0x255d('0x1'),{'options':{'raw':![],'attributes':['id',_0x255d('0x2'),_0x255d('0x3'),_0x255d('0x4')],'include':[{'model':_0x255d('0x5'),'as':'Agents','attributes':['id',_0x255d('0x2'),_0x255d('0x6'),_0x255d('0x7')]}]},'log':_0x255d('0x8')});};}; \ No newline at end of file +var _0xa13d=['User','Agents','chatPause','getChatQueues','../client','Request','GetChatQueue','timeout'];(function(_0x18da2d,_0x177ab1){var _0x4c8590=function(_0x2f8459){while(--_0x2f8459){_0x18da2d['push'](_0x18da2d['shift']());}};_0x4c8590(++_0x177ab1);}(_0xa13d,0x154));var _0xda13=function(_0xa92c15,_0x2ec505){_0xa92c15=_0xa92c15-0x0;var _0x395588=_0xa13d[_0xa92c15];return _0x395588;};'use strict';var client=require(_0xda13('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xda13('0x1')](_0xda13('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xda13('0x3'),'strategy'],'include':[{'model':_0xda13('0x4'),'as':_0xda13('0x5'),'attributes':['id','name','online',_0xda13('0x6')]}]},'log':_0xda13('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 305606d..d43caab 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 _0xf109=['UpdateChatQueueReport','DESC','../client','create','update','Request'];(function(_0x1a1689,_0x141eef){var _0x4e043e=function(_0x2172d4){while(--_0x2172d4){_0x1a1689['push'](_0x1a1689['shift']());}};_0x4e043e(++_0x141eef);}(_0xf109,0xce));var _0x9f10=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf109[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0x9f10('0x0'));exports[_0x9f10('0x1')]=function(_0x44c4f2){return client['Request']('CreateChatQueueReport',{'body':_0x44c4f2,'log':'CreateChatQueueReport'});};exports[_0x9f10('0x2')]=function(_0x74f517,_0x74d0ee){return client[_0x9f10('0x3')](_0x9f10('0x4'),{'body':_0x74d0ee,'options':{'where':{'uniqueid':_0x74f517},'order':[['id',_0x9f10('0x5')]],'limit':0x1},'log':_0x9f10('0x4')});}; \ No newline at end of file +var _0x1cc7=['update','UpdateChatQueueReport','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cc7,0x15a));var _0x71cc=function(_0x5d9f1e,_0x409ac7){_0x5d9f1e=_0x5d9f1e-0x0;var _0x1ee06b=_0x1cc7[_0x5d9f1e];return _0x1ee06b;};'use strict';var client=require(_0x71cc('0x0'));exports[_0x71cc('0x1')]=function(_0x7812aa){return client['Request']('CreateChatQueueReport',{'body':_0x7812aa,'log':'CreateChatQueueReport'});};exports[_0x71cc('0x2')]=function(_0x1fac93,_0x402191){return client['Request']('UpdateChatQueueReport',{'body':_0x402191,'options':{'where':{'uniqueid':_0x1fac93},'order':[['id','DESC']],'limit':0x1},'log':_0x71cc('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 8b20e03..20e0492 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0xfcf737,_0x132075){var _0x5eccbe=function(_0x2dc482){while(--_0x2dc482){_0xfcf737['push'](_0xfcf737['shift']());}};_0x5eccbe(++_0x132075);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0xc36d01,_0x3bf1a6){var _0xecb231=function(_0x2fb301){while(--_0x2fb301){_0xc36d01['push'](_0xc36d01['shift']());}};_0xecb231(++_0x3bf1a6);}(_0x7a54,0x106));var _0x47a5=function(_0x3f9a71,_0x5b8939){_0x3f9a71=_0x3f9a71-0x0;var _0x10d1f1=_0x7a54[_0x3f9a71];return _0x10d1f1;};'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 651c124..2533b3d 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 _0xc3db=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0xc3db,0x1b5));var _0xbc3d=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0xc3db[_0x22eb96];return _0x5e1adf;};'use strict';var client=require(_0xbc3d('0x0'));exports[_0xbc3d('0x1')]=function(_0x3259a9){return client[_0xbc3d('0x2')](_0xbc3d('0x3'),{'body':_0x3259a9,'log':_0xbc3d('0x4')});}; \ No newline at end of file +var _0x2a86=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x4a28b3,_0x1453f4){var _0x2793f3=function(_0x1195ea){while(--_0x1195ea){_0x4a28b3['push'](_0x4a28b3['shift']());}};_0x2793f3(++_0x1453f4);}(_0x2a86,0x122));var _0x62a8=function(_0x34667c,_0x1b3daf){_0x34667c=_0x34667c-0x0;var _0x60c5aa=_0x2a86[_0x34667c];return _0x60c5aa;};'use strict';var client=require(_0x62a8('0x0'));exports[_0x62a8('0x1')]=function(_0x44eca2){return client[_0x62a8('0x2')](_0x62a8('0x3'),{'body':_0x44eca2,'log':_0x62a8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 10daa4e..9928ed4 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 _0x1f16=['strategy','User','faxPause','../client','getFaxQueues','Request','GetFaxQueue','timeout'];(function(_0x89fd5f,_0x1dde54){var _0x5cc67d=function(_0x41d2c6){while(--_0x41d2c6){_0x89fd5f['push'](_0x89fd5f['shift']());}};_0x5cc67d(++_0x1dde54);}(_0x1f16,0x103));var _0x61f1=function(_0x1acc41,_0x3fd32c){_0x1acc41=_0x1acc41-0x0;var _0x1434f9=_0x1f16[_0x1acc41];return _0x1434f9;};'use strict';var client=require(_0x61f1('0x0'));exports[_0x61f1('0x1')]=function(){return function(){return client[_0x61f1('0x2')](_0x61f1('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x61f1('0x4'),_0x61f1('0x5')],'include':[{'model':_0x61f1('0x6'),'as':'Agents','attributes':['id','name','online',_0x61f1('0x7')]}]},'log':_0x61f1('0x1')});};}; \ No newline at end of file +var _0x75b9=['getFaxQueues','Request','GetFaxQueue','name','User','online','../client'];(function(_0x4c440b,_0x4e24f9){var _0x5bba98=function(_0x2e9724){while(--_0x2e9724){_0x4c440b['push'](_0x4c440b['shift']());}};_0x5bba98(++_0x4e24f9);}(_0x75b9,0xe6));var _0x975b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x75b9[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0x975b('0x0'));exports[_0x975b('0x1')]=function(){return function(){return client[_0x975b('0x2')](_0x975b('0x3'),{'options':{'raw':![],'attributes':['id',_0x975b('0x4'),'timeout','strategy'],'include':[{'model':_0x975b('0x5'),'as':'Agents','attributes':['id','name',_0x975b('0x6'),'faxPause']}]},'log':_0x975b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 9a0726d..6bbb655 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 _0xaf3a=['Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client'];(function(_0x56c263,_0x56bdf5){var _0x4e5967=function(_0x5152c1){while(--_0x5152c1){_0x56c263['push'](_0x56c263['shift']());}};_0x4e5967(++_0x56bdf5);}(_0xaf3a,0x13f));var _0xaaf3=function(_0x4336a6,_0xc235ca){_0x4336a6=_0x4336a6-0x0;var _0x4012f3=_0xaf3a[_0x4336a6];return _0x4012f3;};'use strict';var client=require(_0xaaf3('0x0'));exports['create']=function(_0x1c4480){return client[_0xaaf3('0x1')]('CreateFaxQueueReport',{'body':_0x1c4480,'log':_0xaaf3('0x2')});};exports['update']=function(_0xb36fb6,_0x1b2631){return client[_0xaaf3('0x1')](_0xaaf3('0x3'),{'body':_0x1b2631,'options':{'where':{'uniqueid':_0xb36fb6},'order':[['id',_0xaaf3('0x4')]],'limit':0x1},'log':_0xaaf3('0x3')});}; \ No newline at end of file +var _0x85a4=['CreateFaxQueueReport','update','UpdateFaxQueueReport','../client','create','Request'];(function(_0x26b8a9,_0x30ef00){var _0x3323d0=function(_0x35a331){while(--_0x35a331){_0x26b8a9['push'](_0x26b8a9['shift']());}};_0x3323d0(++_0x30ef00);}(_0x85a4,0xc9));var _0x485a=function(_0x437835,_0x1d781e){_0x437835=_0x437835-0x0;var _0x3abef4=_0x85a4[_0x437835];return _0x3abef4;};'use strict';var client=require(_0x485a('0x0'));exports[_0x485a('0x1')]=function(_0x1a5843){return client[_0x485a('0x2')](_0x485a('0x3'),{'body':_0x1a5843,'log':'CreateFaxQueueReport'});};exports[_0x485a('0x4')]=function(_0x11444e,_0x34077e){return client['Request'](_0x485a('0x5'),{'body':_0x34077e,'options':{'where':{'uniqueid':_0x11444e},'order':[['id','DESC']],'limit':0x1},'log':_0x485a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 1c983e3..9054aeb 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 _0xfa35=['name','Interval','Intervals','../client','getIntervals','Request','GetInterval'];(function(_0x567fff,_0xd8acd8){var _0x465a37=function(_0x9d7bf7){while(--_0x9d7bf7){_0x567fff['push'](_0x567fff['shift']());}};_0x465a37(++_0xd8acd8);}(_0xfa35,0x1e6));var _0x5fa3=function(_0x8a7bcb,_0x2cf7d1){_0x8a7bcb=_0x8a7bcb-0x0;var _0x23ccc0=_0xfa35[_0x8a7bcb];return _0x23ccc0;};'use strict';var client=require(_0x5fa3('0x0'));exports[_0x5fa3('0x1')]=function(){return function(){return client[_0x5fa3('0x2')](_0x5fa3('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x5fa3('0x4')],'include':[{'model':_0x5fa3('0x5'),'as':_0x5fa3('0x6'),'attributes':['id',_0x5fa3('0x4'),'interval']}]},'log':_0x5fa3('0x1')});};}; \ No newline at end of file +var _0x9281=['GetInterval','Interval','Intervals','name','interval','getIntervals','Request'];(function(_0x1d7876,_0x12a04e){var _0x57d572=function(_0x3eab5c){while(--_0x3eab5c){_0x1d7876['push'](_0x1d7876['shift']());}};_0x57d572(++_0x12a04e);}(_0x9281,0x83));var _0x1928=function(_0x3b3b8f,_0x3ad593){_0x3b3b8f=_0x3b3b8f-0x0;var _0x50d91d=_0x9281[_0x3b3b8f];return _0x50d91d;};'use strict';var client=require('../client');exports[_0x1928('0x0')]=function(){return function(){return client[_0x1928('0x1')](_0x1928('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x1928('0x3'),'as':_0x1928('0x4'),'attributes':['id',_0x1928('0x5'),_0x1928('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 0586598..7c313ae 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 _0x32b6=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x3ba38b,_0x39c0be){var _0x574206=function(_0x138d19){while(--_0x138d19){_0x3ba38b['push'](_0x3ba38b['shift']());}};_0x574206(++_0x39c0be);}(_0x32b6,0x1d1));var _0x632b=function(_0x1ff912,_0x8252e2){_0x1ff912=_0x1ff912-0x0;var _0x3624f5=_0x32b6[_0x1ff912];return _0x3624f5;};'use strict';var client=require(_0x632b('0x0'));exports[_0x632b('0x1')]=function(_0x4d7646,_0x1f0635){return client[_0x632b('0x2')]('UpdateMailInteraction',{'body':_0x1f0635,'options':{'where':{'id':_0x4d7646}},'log':'updateMailInteraction'});};exports[_0x632b('0x3')]=function(_0x3435e8,_0x3ba3a7){return client[_0x632b('0x2')](_0x632b('0x4'),{'body':_0x3ba3a7,'options':{'where':{'id':_0x3435e8}},'log':_0x632b('0x5')});}; \ No newline at end of file +var _0x0b0e=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3374fd,_0x59a9bc){_0x3374fd=_0x3374fd-0x0;var _0xb10792=_0x0b0e[_0x3374fd];return _0xb10792;};'use strict';var client=require(_0xe0b0('0x0'));exports['update']=function(_0xc416e3,_0x536e9b){return client[_0xe0b0('0x1')](_0xe0b0('0x2'),{'body':_0x536e9b,'options':{'where':{'id':_0xc416e3}},'log':_0xe0b0('0x3')});};exports[_0xe0b0('0x4')]=function(_0x28040c,_0x38a058){return client[_0xe0b0('0x1')](_0xe0b0('0x5'),{'body':_0x38a058,'options':{'where':{'id':_0x28040c}},'log':_0xe0b0('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 846c44b..2e794c0 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 _0x390a=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x390a,0x140));var _0xa390=function(_0x74d1d8,_0x1ccb17){_0x74d1d8=_0x74d1d8-0x0;var _0x333b4d=_0x390a[_0x74d1d8];return _0x333b4d;};'use strict';var client=require(_0xa390('0x0'));exports[_0xa390('0x1')]=function(_0x5ff1bc){return client[_0xa390('0x2')](_0xa390('0x3'),{'body':_0x5ff1bc,'log':_0xa390('0x4')});}; \ No newline at end of file +var _0xc63d=['createMailMessage','../client','create'];(function(_0xa900c7,_0x2e57ae){var _0x5bf424=function(_0x3ca0fa){while(--_0x3ca0fa){_0xa900c7['push'](_0xa900c7['shift']());}};_0x5bf424(++_0x2e57ae);}(_0xc63d,0x151));var _0xdc63=function(_0x27c4a9,_0x1c7b56){_0x27c4a9=_0x27c4a9-0x0;var _0x677b94=_0xc63d[_0x27c4a9];return _0x677b94;};'use strict';var client=require(_0xdc63('0x0'));exports[_0xdc63('0x1')]=function(_0x15bd1b){return client['Request']('CreateMailMessage',{'body':_0x15bd1b,'log':_0xdc63('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 9a275d5..b859d47 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 _0x0ef2=['timeout','strategy','Agents','mailPause','../client','getMailQueues','GetMailQueue','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ef2,0x114));var _0x20ef=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x0ef2[_0x386c3e];return _0x4b8e13;};'use strict';var client=require(_0x20ef('0x0'));exports[_0x20ef('0x1')]=function(){return function(){return client['Request'](_0x20ef('0x2'),{'options':{'raw':![],'attributes':['id',_0x20ef('0x3'),_0x20ef('0x4'),_0x20ef('0x5')],'include':[{'model':'User','as':_0x20ef('0x6'),'attributes':['id',_0x20ef('0x3'),'online',_0x20ef('0x7')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x6877=['name','online','mailPause','../client','getMailQueues','Request','GetMailQueue','timeout','strategy','User'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6877,0xe9));var _0x7687=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x6877[_0x220f3f];return _0x1f170e;};'use strict';var client=require(_0x7687('0x0'));exports[_0x7687('0x1')]=function(){return function(){return client[_0x7687('0x2')](_0x7687('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x7687('0x4'),_0x7687('0x5')],'include':[{'model':_0x7687('0x6'),'as':'Agents','attributes':['id',_0x7687('0x7'),_0x7687('0x8'),_0x7687('0x9')]}]},'log':_0x7687('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index e01739c..a109e35 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 _0x3c88=['CreateMailQueueReport','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x69e16f,_0x133987){var _0x3fde56=function(_0x513f3e){while(--_0x513f3e){_0x69e16f['push'](_0x69e16f['shift']());}};_0x3fde56(++_0x133987);}(_0x3c88,0x177));var _0x83c8=function(_0x48ddf2,_0x4fe392){_0x48ddf2=_0x48ddf2-0x0;var _0x1817a3=_0x3c88[_0x48ddf2];return _0x1817a3;};'use strict';var client=require(_0x83c8('0x0'));exports[_0x83c8('0x1')]=function(_0x482680){return client[_0x83c8('0x2')](_0x83c8('0x3'),{'body':_0x482680,'log':_0x83c8('0x3')});};exports['update']=function(_0x4c8553,_0x506143){return client[_0x83c8('0x2')](_0x83c8('0x4'),{'body':_0x506143,'options':{'where':{'uniqueid':_0x4c8553},'order':[['id',_0x83c8('0x5')]],'limit':0x1},'log':_0x83c8('0x4')});}; \ No newline at end of file +var _0xb3d7=['UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport','update'];(function(_0x4c9c0f,_0x5ea524){var _0x33b70c=function(_0x112e75){while(--_0x112e75){_0x4c9c0f['push'](_0x4c9c0f['shift']());}};_0x33b70c(++_0x5ea524);}(_0xb3d7,0xf7));var _0x7b3d=function(_0x27c3a4,_0x4ae6c5){_0x27c3a4=_0x27c3a4-0x0;var _0x343d36=_0xb3d7[_0x27c3a4];return _0x343d36;};'use strict';var client=require(_0x7b3d('0x0'));exports[_0x7b3d('0x1')]=function(_0x46ec9c){return client[_0x7b3d('0x2')](_0x7b3d('0x3'),{'body':_0x46ec9c,'log':_0x7b3d('0x3')});};exports[_0x7b3d('0x4')]=function(_0x416d4a,_0x35fb14){return client[_0x7b3d('0x2')](_0x7b3d('0x5'),{'body':_0x35fb14,'options':{'where':{'uniqueid':_0x416d4a},'order':[['id',_0x7b3d('0x6')]],'limit':0x1},'log':_0x7b3d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 1a146cd..b03f18d 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 _0x04de=['updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction'];(function(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0x04de,0xf3));var _0xe04d=function(_0x473fbf,_0x400290){_0x473fbf=_0x473fbf-0x0;var _0x24ea6d=_0x04de[_0x473fbf];return _0x24ea6d;};'use strict';var client=require(_0xe04d('0x0'));exports['update']=function(_0x1a0e28,_0x1b6e6f){return client[_0xe04d('0x1')](_0xe04d('0x2'),{'body':_0x1b6e6f,'options':{'where':{'id':_0x1a0e28}},'log':_0xe04d('0x3')});};exports['addTags']=function(_0x3c867d,_0x3964e4){return client[_0xe04d('0x1')](_0xe04d('0x4'),{'body':_0x3964e4,'options':{'where':{'id':_0x3c867d}},'log':_0xe04d('0x5')});}; \ No newline at end of file +var _0x40ac=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update'];(function(_0x367494,_0x3cdb4d){var _0x5c1a13=function(_0x5dac8a){while(--_0x5dac8a){_0x367494['push'](_0x367494['shift']());}};_0x5c1a13(++_0x3cdb4d);}(_0x40ac,0x76));var _0xc40a=function(_0xb2423a,_0x71b6a3){_0xb2423a=_0xb2423a-0x0;var _0x3b88ba=_0x40ac[_0xb2423a];return _0x3b88ba;};'use strict';var client=require('../client');exports[_0xc40a('0x0')]=function(_0x338532,_0x11f320){return client[_0xc40a('0x1')](_0xc40a('0x2'),{'body':_0x11f320,'options':{'where':{'id':_0x338532}},'log':_0xc40a('0x3')});};exports[_0xc40a('0x4')]=function(_0x53712e,_0x25dda4){return client[_0xc40a('0x1')](_0xc40a('0x5'),{'body':_0x25dda4,'options':{'where':{'id':_0x53712e}},'log':_0xc40a('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index a1624bb..780b782 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 _0x2dfb=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x2dfb,0x103));var _0xb2df=function(_0x42db0a,_0x8dc677){_0x42db0a=_0x42db0a-0x0;var _0x338510=_0x2dfb[_0x42db0a];return _0x338510;};'use strict';var client=require(_0xb2df('0x0'));exports[_0xb2df('0x1')]=function(_0x15537b){return client[_0xb2df('0x2')](_0xb2df('0x3'),{'body':_0x15537b,'log':_0xb2df('0x4')});}; \ No newline at end of file +var _0xfccf=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x50da7c,_0x530fd6){var _0x4aeee2=function(_0x4b2daa){while(--_0x4b2daa){_0x50da7c['push'](_0x50da7c['shift']());}};_0x4aeee2(++_0x530fd6);}(_0xfccf,0x167));var _0xffcc=function(_0x4ec67c,_0x539e5f){_0x4ec67c=_0x4ec67c-0x0;var _0x47ab9b=_0xfccf[_0x4ec67c];return _0x47ab9b;};'use strict';var client=require(_0xffcc('0x0'));exports[_0xffcc('0x1')]=function(_0x5b59f9){return client[_0xffcc('0x2')](_0xffcc('0x3'),{'body':_0x5b59f9,'log':_0xffcc('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index b725bad..f511aee 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 _0xe12d=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','openchannelPause'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe12d,0xc8));var _0xde12=function(_0x2425a1,_0x5ecf03){_0x2425a1=_0x2425a1-0x0;var _0x46e20c=_0xe12d[_0x2425a1];return _0x46e20c;};'use strict';var client=require(_0xde12('0x0'));exports[_0xde12('0x1')]=function(){return function(){return client[_0xde12('0x2')](_0xde12('0x3'),{'options':{'raw':![],'attributes':['id',_0xde12('0x4'),_0xde12('0x5'),_0xde12('0x6')],'include':[{'model':_0xde12('0x7'),'as':_0xde12('0x8'),'attributes':['id','name','online',_0xde12('0x9')]}]},'log':_0xde12('0x1')});};}; \ No newline at end of file +var _0x8b2b=['../client','getOpenchannelQueues','Request','name','timeout','strategy','User','Agents'];(function(_0x594e88,_0x442655){var _0x518fa8=function(_0x49a3db){while(--_0x49a3db){_0x594e88['push'](_0x594e88['shift']());}};_0x518fa8(++_0x442655);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x496e07,_0x3d12b8){_0x496e07=_0x496e07-0x0;var _0x266fde=_0x8b2b[_0x496e07];return _0x266fde;};'use strict';var client=require(_0xb8b2('0x0'));exports[_0xb8b2('0x1')]=function(){return function(){return client[_0xb8b2('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xb8b2('0x3'),_0xb8b2('0x4'),_0xb8b2('0x5')],'include':[{'model':_0xb8b2('0x6'),'as':_0xb8b2('0x7'),'attributes':['id',_0xb8b2('0x3'),'online','openchannelPause']}]},'log':_0xb8b2('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 71173b4..ede866a 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 _0xb6e4=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x24502f,_0x134350){var _0x402fd9=function(_0x5e90b2){while(--_0x5e90b2){_0x24502f['push'](_0x24502f['shift']());}};_0x402fd9(++_0x134350);}(_0xb6e4,0x117));var _0x4b6e=function(_0x482601,_0x228726){_0x482601=_0x482601-0x0;var _0x264e8a=_0xb6e4[_0x482601];return _0x264e8a;};'use strict';var client=require(_0x4b6e('0x0'));exports[_0x4b6e('0x1')]=function(_0x444158){return client[_0x4b6e('0x2')](_0x4b6e('0x3'),{'body':_0x444158,'log':'CreateOpenchannelQueueReport'});};exports[_0x4b6e('0x4')]=function(_0x2e5140,_0x3206de){return client[_0x4b6e('0x2')](_0x4b6e('0x5'),{'body':_0x3206de,'options':{'where':{'uniqueid':_0x2e5140},'order':[['id',_0x4b6e('0x6')]],'limit':0x1},'log':_0x4b6e('0x5')});}; \ No newline at end of file +var _0x754b=['Request','CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','../client','create'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0x754b,0x1ef));var _0xb754=function(_0x813d0a,_0x4fd3d7){_0x813d0a=_0x813d0a-0x0;var _0x241352=_0x754b[_0x813d0a];return _0x241352;};'use strict';var client=require(_0xb754('0x0'));exports[_0xb754('0x1')]=function(_0x26624c){return client[_0xb754('0x2')](_0xb754('0x3'),{'body':_0x26624c,'log':'CreateOpenchannelQueueReport'});};exports[_0xb754('0x4')]=function(_0x5bf7c2,_0x1b5592){return client[_0xb754('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x1b5592,'options':{'where':{'uniqueid':_0x5bf7c2},'order':[['id',_0xb754('0x5')]],'limit':0x1},'log':_0xb754('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 5fc04fe..2720a42 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 _0xdfe7=['addTags','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x446580,_0x488928){var _0x49d5f9=function(_0x3aae57){while(--_0x3aae57){_0x446580['push'](_0x446580['shift']());}};_0x49d5f9(++_0x488928);}(_0xdfe7,0xc8));var _0x7dfe=function(_0x4f768c,_0x2312fa){_0x4f768c=_0x4f768c-0x0;var _0x5973e2=_0xdfe7[_0x4f768c];return _0x5973e2;};'use strict';var client=require('../client');exports[_0x7dfe('0x0')]=function(_0x3eb9c1,_0x5e0531){return client[_0x7dfe('0x1')](_0x7dfe('0x2'),{'body':_0x5e0531,'options':{'where':{'id':_0x3eb9c1}},'log':_0x7dfe('0x3')});};exports[_0x7dfe('0x4')]=function(_0x527490,_0x2c07d2){return client[_0x7dfe('0x1')]('AddTagsToSmsInteraction',{'body':_0x2c07d2,'options':{'where':{'id':_0x527490}},'log':_0x7dfe('0x5')});}; \ No newline at end of file +var _0x02ef=['addTags','AddTagsToSmsInteraction','../client','Request','UpdateSmsInteraction'];(function(_0x508276,_0x56c804){var _0xfc4c3=function(_0x52a106){while(--_0x52a106){_0x508276['push'](_0x508276['shift']());}};_0xfc4c3(++_0x56c804);}(_0x02ef,0x11a));var _0xf02e=function(_0xce5934,_0x34cbbb){_0xce5934=_0xce5934-0x0;var _0x6cf803=_0x02ef[_0xce5934];return _0x6cf803;};'use strict';var client=require(_0xf02e('0x0'));exports['update']=function(_0x3c6866,_0x4ba323){return client[_0xf02e('0x1')](_0xf02e('0x2'),{'body':_0x4ba323,'options':{'where':{'id':_0x3c6866}},'log':'updateSmsInteraction'});};exports[_0xf02e('0x3')]=function(_0x4783f7,_0x1edc1c){return client[_0xf02e('0x1')](_0xf02e('0x4'),{'body':_0x1edc1c,'options':{'where':{'id':_0x4783f7}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index d9e950b..91fe6b3 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 _0x74a4=['../client','create','Request','createSmsMessage'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0x74a4,0x120));var _0x474a=function(_0x316ea0,_0x4a45dd){_0x316ea0=_0x316ea0-0x0;var _0x2f5bb1=_0x74a4[_0x316ea0];return _0x2f5bb1;};'use strict';var client=require(_0x474a('0x0'));exports[_0x474a('0x1')]=function(_0x593043){return client[_0x474a('0x2')]('CreateSmsMessage',{'body':_0x593043,'log':_0x474a('0x3')});}; \ No newline at end of file +var _0xc78f=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x3ec0d0,_0x35445c){var _0x353575=function(_0x44443a){while(--_0x44443a){_0x3ec0d0['push'](_0x3ec0d0['shift']());}};_0x353575(++_0x35445c);}(_0xc78f,0xb9));var _0xfc78=function(_0x23fc42,_0x532e6b){_0x23fc42=_0x23fc42-0x0;var _0x4d1509=_0xc78f[_0x23fc42];return _0x4d1509;};'use strict';var client=require(_0xfc78('0x0'));exports[_0xfc78('0x1')]=function(_0x25353c){return client[_0xfc78('0x2')](_0xfc78('0x3'),{'body':_0x25353c,'log':_0xfc78('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 5a8c5b5..9a39966 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x194b07,_0x29c86f){var _0x2624c1=function(_0x44b2d2){while(--_0x44b2d2){_0x194b07['push'](_0x194b07['shift']());}};_0x2624c1(++_0x29c86f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xcb91[_0x5a3cf0];return _0x5a64ee;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x27652b,_0x47deda){var _0x4aff00=function(_0x580866){while(--_0x580866){_0x27652b['push'](_0x27652b['shift']());}};_0x4aff00(++_0x47deda);}(_0xe706,0xa3));var _0x6e70=function(_0x40f2f0,_0x724659){_0x40f2f0=_0x40f2f0-0x0;var _0x11a018=_0xe706[_0x40f2f0];return _0x11a018;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 54844a2..3577093 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x4f72c4,_0x307d9b){var _0x44166a=function(_0x265f57){while(--_0x265f57){_0x4f72c4['push'](_0x4f72c4['shift']());}};_0x44166a(++_0x307d9b);}(_0x70e0,0x17b));var _0x070e=function(_0x48aad1,_0x4f323a){_0x48aad1=_0x48aad1-0x0;var _0x57b723=_0x70e0[_0x48aad1];return _0x57b723;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x359bdd,_0x5a32a3){var _0x5805b9=function(_0x3e1180){while(--_0x3e1180){_0x359bdd['push'](_0x359bdd['shift']());}};_0x5805b9(++_0x5a32a3);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 37733e4..8eb3e3a 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(_0x2ff501,_0x4f8e6e){var _0x21dda1=function(_0x78ba35){while(--_0x78ba35){_0x2ff501['push'](_0x2ff501['shift']());}};_0x21dda1(++_0x4f8e6e);}(_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 +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x49fee4,_0x150d6b){var _0x373c4d=function(_0x39cc78){while(--_0x39cc78){_0x49fee4['push'](_0x49fee4['shift']());}};_0x373c4d(++_0x150d6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 cfc36f0..5325cc8 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 _0x304b=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update'];(function(_0x1be67f,_0x2de2f3){var _0x2abef4=function(_0x57dd81){while(--_0x57dd81){_0x1be67f['push'](_0x1be67f['shift']());}};_0x2abef4(++_0x2de2f3);}(_0x304b,0xfb));var _0xb304=function(_0x2f3151,_0x7aa260){_0x2f3151=_0x2f3151-0x0;var _0x5cbec3=_0x304b[_0x2f3151];return _0x5cbec3;};'use strict';var client=require('../client');exports[_0xb304('0x0')]=function(_0x32f7d1,_0x26e437){return client[_0xb304('0x1')](_0xb304('0x2'),{'body':_0x26e437,'options':{'where':{'id':_0x32f7d1}},'log':_0xb304('0x3')});};exports[_0xb304('0x4')]=function(_0xedd10a,_0x546729){return client['Request'](_0xb304('0x5'),{'body':_0x546729,'options':{'where':{'id':_0xedd10a}},'log':_0xb304('0x6')});}; \ No newline at end of file +var _0x292c=['../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x59c2e3,_0x254882){var _0x111701=function(_0x49da99){while(--_0x49da99){_0x59c2e3['push'](_0x59c2e3['shift']());}};_0x111701(++_0x254882);}(_0x292c,0x66));var _0xc292=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0x292c[_0x3acee8];return _0x5046cc;};'use strict';var client=require(_0xc292('0x0'));exports['update']=function(_0x286dcb,_0x379366){return client[_0xc292('0x1')](_0xc292('0x2'),{'body':_0x379366,'options':{'where':{'id':_0x286dcb}},'log':_0xc292('0x3')});};exports['addTags']=function(_0x1f14f9,_0x536154){return client['Request'](_0xc292('0x4'),{'body':_0x536154,'options':{'where':{'id':_0x1f14f9}},'log':_0xc292('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index e098219..05d5d23 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 _0x693d=['../client','create','Request','CreateWhatsappMessage'];(function(_0x35bf51,_0x40b7d5){var _0x259556=function(_0x33034f){while(--_0x33034f){_0x35bf51['push'](_0x35bf51['shift']());}};_0x259556(++_0x40b7d5);}(_0x693d,0x1d4));var _0xd693=function(_0xa0190e,_0x190c62){_0xa0190e=_0xa0190e-0x0;var _0x7240c1=_0x693d[_0xa0190e];return _0x7240c1;};'use strict';var client=require(_0xd693('0x0'));exports[_0xd693('0x1')]=function(_0x1e856e){return client[_0xd693('0x2')](_0xd693('0x3'),{'body':_0x1e856e,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x7110=['../client','create','CreateWhatsappMessage'];(function(_0x1ba3f0,_0x3b220d){var _0x53064d=function(_0x4ac6e3){while(--_0x4ac6e3){_0x1ba3f0['push'](_0x1ba3f0['shift']());}};_0x53064d(++_0x3b220d);}(_0x7110,0x96));var _0x0711=function(_0x201178,_0x17b907){_0x201178=_0x201178-0x0;var _0x4abbd0=_0x7110[_0x201178];return _0x4abbd0;};'use strict';var client=require(_0x0711('0x0'));exports[_0x0711('0x1')]=function(_0x292f0){return client['Request'](_0x0711('0x2'),{'body':_0x292f0,'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 c47c3a8..adf32bc 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 _0x3f73=['strategy','Agents','online','../client','getWhatsappQueues','name'];(function(_0x4c3070,_0xc2fb4c){var _0x536a44=function(_0x1412a5){while(--_0x1412a5){_0x4c3070['push'](_0x4c3070['shift']());}};_0x536a44(++_0xc2fb4c);}(_0x3f73,0xc3));var _0x33f7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3f73[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x33f7('0x0'));exports[_0x33f7('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x33f7('0x2'),'timeout',_0x33f7('0x3')],'include':[{'model':'User','as':_0x33f7('0x4'),'attributes':['id',_0x33f7('0x2'),_0x33f7('0x5'),'whatsappPause']}]},'log':_0x33f7('0x1')});};}; \ No newline at end of file +var _0x4c9e=['timeout','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','name'];(function(_0x10319c,_0x511e1d){var _0x4a808b=function(_0x510463){while(--_0x510463){_0x10319c['push'](_0x10319c['shift']());}};_0x4a808b(++_0x511e1d);}(_0x4c9e,0xba));var _0xe4c9=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x4c9e[_0x92c450];return _0x2a9599;};'use strict';var client=require(_0xe4c9('0x0'));exports[_0xe4c9('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xe4c9('0x2'),_0xe4c9('0x3'),_0xe4c9('0x4')],'include':[{'model':_0xe4c9('0x5'),'as':_0xe4c9('0x6'),'attributes':['id','name',_0xe4c9('0x7'),_0xe4c9('0x8')]}]},'log':_0xe4c9('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 8d26d6d..852f9b6 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 _0x4cac=['DESC','../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x569f3d,_0x5b5362){var _0x400c82=function(_0xbe5ebd){while(--_0xbe5ebd){_0x569f3d['push'](_0x569f3d['shift']());}};_0x400c82(++_0x5b5362);}(_0x4cac,0x19e));var _0xc4ca=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4cac[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0xc4ca('0x0'));exports[_0xc4ca('0x1')]=function(_0x2201ec){return client[_0xc4ca('0x2')](_0xc4ca('0x3'),{'body':_0x2201ec,'log':'CreateWhatsappQueueReport'});};exports[_0xc4ca('0x4')]=function(_0x4ec3a0,_0x5165d3){return client[_0xc4ca('0x2')](_0xc4ca('0x5'),{'body':_0x5165d3,'options':{'where':{'uniqueid':_0x4ec3a0},'order':[['id',_0xc4ca('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xeaee=['update','DESC','create','Request','CreateWhatsappQueueReport'];(function(_0x2758aa,_0x47a165){var _0x826371=function(_0x514b1a){while(--_0x514b1a){_0x2758aa['push'](_0x2758aa['shift']());}};_0x826371(++_0x47a165);}(_0xeaee,0x7a));var _0xeeae=function(_0xa03806,_0x3dc70e){_0xa03806=_0xa03806-0x0;var _0x155be9=_0xeaee[_0xa03806];return _0x155be9;};'use strict';var client=require('../client');exports[_0xeeae('0x0')]=function(_0x463cb6){return client[_0xeeae('0x1')]('CreateWhatsappQueueReport',{'body':_0x463cb6,'log':_0xeeae('0x2')});};exports[_0xeeae('0x3')]=function(_0x43adb1,_0x72b104){return client['Request']('UpdateWhatsappQueueReport',{'body':_0x72b104,'options':{'where':{'uniqueid':_0x43adb1},'order':[['id',_0xeeae('0x4')]],'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 322206c..b92628c 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 _0x569e=['join','stop','find','timeout','createQueue','atimeout','channel','START:%s','rules','info','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','util','../../../../config/logger','./strategy','string','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','message'];(function(_0x3cb413,_0x43dd24){var _0x38e703=function(_0x5703f2){while(--_0x5703f2){_0x3cb413['push'](_0x3cb413['shift']());}};_0x38e703(++_0x43dd24);}(_0x569e,0x1c0));var _0xe569=function(_0x333767,_0x220733){_0x333767=_0x333767-0x0;var _0x42a755=_0x569e[_0x333767];return _0x42a755;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xe569('0x0'));var seqqueue=require('seq-queue');var logger=require(_0xe569('0x1'))('routing');var strategy=require(_0xe569('0x2'));var queue=schema({'name':{'type':_0xe569('0x3'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xe569('0x4'),'message':_0xe569('0x5')}});function writeLog(_0x5b5f88,_0x5951ba,_0x532bc6){return logger['info'](util[_0xe569('0x6')](_0xe569('0x7'),_0x5b5f88,_0x5951ba['name'],_0x532bc6));}function handleFindAgent(_0x3e19ee){return function(_0x45d825){return _0x45d825[_0xe569('0x8')]['toLowerCase']()===_0x3e19ee[_0xe569('0x9')]();};}exports[_0xe569('0xa')]=function(_0x3d718b,_0x1e80bd,_0x18d4da,_0x24b1f8){return function(_0x52b625){try{var _0x49f916={'name':_0x1e80bd[0x0],'timeout':_0x1e80bd[0x1]};var _0x1b3cfa=queue[_0xe569('0xb')](_0x49f916,{'typecast':!![]});if(_0x1b3cfa[_0xe569('0xc')]){logger['error']('[%s][AGENT]\x20%s',_0x3d718b,_['map'](_0x1b3cfa,_0xe569('0xd'))[_0xe569('0xe')](',\x20'));_0x52b625[_0xe569('0xf')]();}else{var _0x1b565a=_[_0xe569('0x10')](_0x18d4da['agents'],handleFindAgent(_0x49f916['name']));if(_0x1b565a){var _0x5c1b09=(_0x49f916[_0xe569('0x11')]||0xa)*0x3e8;var _0xdadcfe,_0x1d1009;var _0x4b60f8=seqqueue[_0xe569('0x12')](_0x5c1b09);_0x4b60f8['id']=_0x3d718b;_0x4b60f8[_0xe569('0x13')]=_0x5c1b09;_0x4b60f8['channel']=_0x24b1f8[_0xe569('0x14')];writeLog(_0x3d718b,_0x1b565a,util['format'](_0xe569('0x15'),_0x5c1b09));_0x18d4da[_0xe569('0x16')][_0x3d718b]['on']('end',function(){logger[_0xe569('0x17')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x3d718b);clearTimeout(_0x1d1009);_0x1d1009=undefined;_0x4b60f8[_0xe569('0x18')]();if(_0x18d4da[_0xe569('0x16')][_0x3d718b]){delete _0x18d4da[_0xe569('0x16')][_0x3d718b];}_0x52b625[_0xe569('0xf')]();});_0x18d4da['rules'][_0x3d718b]['on'](_0xe569('0x19'),function(){if(_0x18d4da[_0xe569('0x16')][_0x3d718b]){delete _0x18d4da[_0xe569('0x16')][_0x3d718b];}});_0x1d1009=setTimeout(function(){logger['info'](_0xe569('0x1a'),_0x3d718b);clearTimeout(_0x1d1009);_0x4b60f8[_0xe569('0x18')]();_0x52b625[_0xe569('0x1b')]();},_0x5c1b09);strategy[_0xe569('0x1c')](_0x4b60f8,_0x1b565a,_0x18d4da,_0x24b1f8);}else{logger[_0xe569('0x1d')](_0xe569('0x1e'),_0x3d718b,_0x49f916[_0xe569('0x8')]);_0x52b625['stop']();}}}catch(_0x99784){console[_0xe569('0x1f')](_0x99784);logger['error'](_0xe569('0x20'),_0x3d718b,_0x99784['stack']);_0x52b625[_0xe569('0xf')]();}};}; \ No newline at end of file +var _0x90e9=['format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','join','find','agents','createQueue','atimeout','channel','START:%s','rules','stop','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info'];(function(_0x182bc6,_0xfb6bb2){var _0x44375e=function(_0x3f99f0){while(--_0x3f99f0){_0x182bc6['push'](_0x182bc6['shift']());}};_0x44375e(++_0xfb6bb2);}(_0x90e9,0x1a7));var _0x990e=function(_0x3284f7,_0x509078){_0x3284f7=_0x3284f7-0x0;var _0x56fc6a=_0x90e9[_0x3284f7];return _0x56fc6a;};'use strict';var schema=require(_0x990e('0x0'));var _=require(_0x990e('0x1'));var util=require(_0x990e('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x990e('0x3'))(_0x990e('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x990e('0x5'),'required':!![],'message':_0x990e('0x6')},'timeout':{'type':'number','message':_0x990e('0x7')}});function writeLog(_0x69bf5e,_0x3516b4,_0x37696d){return logger[_0x990e('0x8')](util[_0x990e('0x9')](_0x990e('0xa'),_0x69bf5e,_0x3516b4[_0x990e('0xb')],_0x37696d));}function handleFindAgent(_0x3b840f){return function(_0x5bb34e){return _0x5bb34e[_0x990e('0xb')][_0x990e('0xc')]()===_0x3b840f[_0x990e('0xc')]();};}exports[_0x990e('0xd')]=function(_0x3ba73c,_0x479f8b,_0x2394c4,_0x56fac2){return function(_0x4a47ed){try{var _0x460d25={'name':_0x479f8b[0x0],'timeout':_0x479f8b[0x1]};var _0x498fb9=queue['validate'](_0x460d25,{'typecast':!![]});if(_0x498fb9[_0x990e('0xe')]){logger['error'](_0x990e('0xf'),_0x3ba73c,_[_0x990e('0x10')](_0x498fb9,'message')[_0x990e('0x11')](',\x20'));_0x4a47ed['stop']();}else{var _0x17e012=_[_0x990e('0x12')](_0x2394c4[_0x990e('0x13')],handleFindAgent(_0x460d25[_0x990e('0xb')]));if(_0x17e012){var _0x44b052=(_0x460d25['timeout']||0xa)*0x3e8;var _0x4fdce8,_0x5a8e5f;var _0x46b36c=seqqueue[_0x990e('0x14')](_0x44b052);_0x46b36c['id']=_0x3ba73c;_0x46b36c[_0x990e('0x15')]=_0x44b052;_0x46b36c[_0x990e('0x16')]=_0x56fac2[_0x990e('0x16')];writeLog(_0x3ba73c,_0x17e012,util[_0x990e('0x9')](_0x990e('0x17'),_0x44b052));_0x2394c4[_0x990e('0x18')][_0x3ba73c]['on']('end',function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x3ba73c);clearTimeout(_0x5a8e5f);_0x5a8e5f=undefined;_0x46b36c['close']();if(_0x2394c4[_0x990e('0x18')][_0x3ba73c]){delete _0x2394c4['rules'][_0x3ba73c];}_0x4a47ed[_0x990e('0x19')]();});_0x2394c4[_0x990e('0x18')][_0x3ba73c]['on'](_0x990e('0x1a'),function(){if(_0x2394c4['rules'][_0x3ba73c]){delete _0x2394c4['rules'][_0x3ba73c];}});_0x5a8e5f=setTimeout(function(){logger[_0x990e('0x8')](_0x990e('0x1b'),_0x3ba73c);clearTimeout(_0x5a8e5f);_0x46b36c[_0x990e('0x1c')]();_0x4a47ed[_0x990e('0x1d')]();},_0x44b052);strategy[_0x990e('0x1e')](_0x46b36c,_0x17e012,_0x2394c4,_0x56fac2);}else{logger[_0x990e('0x1f')](_0x990e('0x20'),_0x3ba73c,_0x460d25[_0x990e('0xb')]);_0x4a47ed[_0x990e('0x19')]();}}}catch(_0x44a5fe){console[_0x990e('0x21')](_0x44a5fe);logger[_0x990e('0x1f')](_0x990e('0x22'),_0x3ba73c,_0x44a5fe[_0x990e('0x23')]);_0x4a47ed['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index a07eb2e..4de0379 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 _0x1de5=['amazonlex','providerResponse','dialogState','Failed','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','Message','create','then','info','catch','stringify','stop','LexRuntime','$LATEST','message','postText','error','next'];(function(_0x3543c3,_0xc0a89a){var _0x1e41f4=function(_0x6dc66){while(--_0x6dc66){_0x3543c3['push'](_0x3543c3['shift']());}};_0x1e41f4(++_0xc0a89a);}(_0x1de5,0xef));var _0x51de=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x1de5[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x51de('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0x51de('0x1'));var logger=require(_0x51de('0x2'))('routing');var rpc={'chatMessage':require(_0x51de('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x51de('0x4')),'smsMessage':require(_0x51de('0x5')),'faxMessage':require(_0x51de('0x6')),'whatsappMessage':require(_0x51de('0x7'))};exports[_0x51de('0x8')]=function(_0x2d8858,_0x2c449c){return function(_0x6e5a89){try{if(!_[_0x51de('0x9')](this[_0x51de('0xa')][_0x51de('0xb')])){logger['info'](_0x51de('0xc'),_0x2d8858,_0x51de('0xd'));return _0x6e5a89['next']();}var _0x1dc18c={'ContactId':this[_0x51de('0xe')]['id'],'sentAt':moment()[_0x51de('0xf')](_0x51de('0x10')),'direction':'out'};if(this['channel']===_0x51de('0x11')||this[_0x51de('0x12')]===_0x51de('0x13')){_0x1dc18c[_0x51de('0x14')]=this['interaction'][_0x51de('0x14')];}var _0x2bf46b=this[_0x51de('0x12')];if(_0x2bf46b===_0x51de('0x15')){_0x1dc18c[_0x51de('0x16')]=this[_0x51de('0x17')]['id'];}else{_0x1dc18c[_[_0x51de('0x18')](_0x2bf46b)+_0x51de('0x19')]=this[_0x51de('0x17')]['id'];}_0x1dc18c[_[_0x51de('0x18')](_0x2bf46b)+_0x51de('0x1a')]=this[_0x51de('0xa')]['id'];if(this[_0x51de('0xa')][_0x51de('0x1b')]){var _0x5a28b1=_0x2c449c[0x4];if(!_['isEmpty'](_0x5a28b1)){_0x1dc18c[_0x51de('0x1c')]=utils[_0x51de('0x1d')](_0x5a28b1,this);return rpc[_0x2bf46b+_0x51de('0x1e')][_0x51de('0x1f')](_0x1dc18c)[_0x51de('0x20')](function(_0x50bf6f){logger[_0x51de('0x21')](_0x51de('0xc'),_0x2d8858,_0x1dc18c['body']);})[_0x51de('0x22')](function(_0x240463){logger['error'](_0x51de('0xc'),_0x2d8858,JSON[_0x51de('0x23')](_0x240463));})['finally'](function(){logger[_0x51de('0x21')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2d8858);_0x6e5a89[_0x51de('0x24')]();});}else{logger[_0x51de('0x21')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2d8858);_0x6e5a89['stop']();}}else{var _0x177765=this;var _0x73794b=new AWS[(_0x51de('0x25'))]({'accessKeyId':_0x2c449c[0x0],'secretAccessKey':_0x2c449c[0x1],'region':_0x2c449c[0x2]});var _0x9310c4={'botAlias':_0x51de('0x26'),'botName':_0x2c449c[0x3],'inputText':this[_0x51de('0x27')][_0x51de('0x1c')],'userId':this['channel']+':'+this['interaction']['id']['toString']()};_0x73794b[_0x51de('0x28')](_0x9310c4,function(_0x2a2c50,_0x38e2ae){if(_0x2a2c50){logger[_0x51de('0x29')](_0x51de('0xc'),_0x2d8858,_0x2a2c50['message']);_0x6e5a89[_0x51de('0x2a')]();}else if(_0x38e2ae&&_0x38e2ae[_0x51de('0x27')]){_0x177765[_0x51de('0x1c')][_0x51de('0x2b')]=_0x38e2ae;_0x1dc18c[_0x51de('0x1c')]=_0x38e2ae['message'];_0x1dc18c['providerName']=_0x51de('0x2b');_0x1dc18c[_0x51de('0x2c')]=JSON[_0x51de('0x23')](_0x38e2ae);return rpc[_0x2bf46b+_0x51de('0x1e')][_0x51de('0x1f')](_0x1dc18c)[_0x51de('0x20')](function(_0x5e7d65){logger[_0x51de('0x21')]('[%s][AMAZONLEX]\x20%s',_0x2d8858,_0x1dc18c['body']);if(_0x38e2ae[_0x51de('0x2d')]==_0x51de('0x2e')){_0x6e5a89[_0x51de('0x2a')]();}else{_0x6e5a89[_0x51de('0x24')]();}})[_0x51de('0x22')](function(_0x339a22){logger[_0x51de('0x29')]('[%s][AMAZONLEX]\x20%s',_0x2d8858,JSON[_0x51de('0x23')](_0x339a22));_0x6e5a89[_0x51de('0x2a')]();});}else{_0x6e5a89[_0x51de('0x2a')]();}});}}catch(_0x4332e9){logger['error'](_0x51de('0xc'),_0x2d8858,JSON[_0x51de('0x23')](_0x4332e9));_0x6e5a89[_0x51de('0x24')]();}};}; \ No newline at end of file +var _0xc7c7=['InteractionId','isEmpty','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','postText','next','amazonlex','providerResponse','dialogState','Failed','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','account','upperFirst','AccountId'];(function(_0xd71be8,_0x33725f){var _0x3d7728=function(_0x357e27){while(--_0x357e27){_0xd71be8['push'](_0xd71be8['shift']());}};_0x3d7728(++_0x33725f);}(_0xc7c7,0x1c7));var _0x7c7c=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xc7c7[_0x4e1d03];return _0x362d4b;};'use strict';var _=require('lodash');var moment=require(_0x7c7c('0x0'));var AWS=require(_0x7c7c('0x1'));var utils=require(_0x7c7c('0x2'));var logger=require(_0x7c7c('0x3'))(_0x7c7c('0x4'));var rpc={'chatMessage':require(_0x7c7c('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x7c7c('0x6')),'smsMessage':require(_0x7c7c('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x7c7c('0x8')]=function(_0x1fdb12,_0x45d402){return function(_0x36e915){try{if(!_[_0x7c7c('0x9')](this[_0x7c7c('0xa')][_0x7c7c('0xb')])){logger[_0x7c7c('0xc')]('[%s][AMAZONLEX]\x20%s',_0x1fdb12,_0x7c7c('0xd'));return _0x36e915['next']();}var _0x5dfe08={'ContactId':this[_0x7c7c('0xe')]['id'],'sentAt':moment()[_0x7c7c('0xf')](_0x7c7c('0x10')),'direction':_0x7c7c('0x11')};if(this[_0x7c7c('0x12')]===_0x7c7c('0x13')||this[_0x7c7c('0x12')]===_0x7c7c('0x14')){_0x5dfe08[_0x7c7c('0x15')]=this[_0x7c7c('0xa')][_0x7c7c('0x15')];}var _0x58b24b=this[_0x7c7c('0x12')];if(_0x58b24b==='chat'){_0x5dfe08['ChatWebsiteId']=this[_0x7c7c('0x16')]['id'];}else{_0x5dfe08[_[_0x7c7c('0x17')](_0x58b24b)+_0x7c7c('0x18')]=this[_0x7c7c('0x16')]['id'];}_0x5dfe08[_[_0x7c7c('0x17')](_0x58b24b)+_0x7c7c('0x19')]=this[_0x7c7c('0xa')]['id'];if(this['interaction']['created']){var _0x563005=_0x45d402[0x4];if(!_[_0x7c7c('0x1a')](_0x563005)){_0x5dfe08[_0x7c7c('0x1b')]=utils[_0x7c7c('0x1c')](_0x563005,this);return rpc[_0x58b24b+_0x7c7c('0x1d')][_0x7c7c('0x1e')](_0x5dfe08)[_0x7c7c('0x1f')](function(_0x1e1ad4){logger[_0x7c7c('0xc')](_0x7c7c('0x20'),_0x1fdb12,_0x5dfe08['body']);})[_0x7c7c('0x21')](function(_0x2374da){logger[_0x7c7c('0x22')](_0x7c7c('0x20'),_0x1fdb12,JSON[_0x7c7c('0x23')](_0x2374da));})['finally'](function(){logger[_0x7c7c('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1fdb12);_0x36e915['stop']();});}else{logger[_0x7c7c('0xc')](_0x7c7c('0x24'),_0x1fdb12);_0x36e915[_0x7c7c('0x25')]();}}else{var _0x24a7a6=this;var _0x14ceab=new AWS[(_0x7c7c('0x26'))]({'accessKeyId':_0x45d402[0x0],'secretAccessKey':_0x45d402[0x1],'region':_0x45d402[0x2]});var _0x37b125={'botAlias':_0x7c7c('0x27'),'botName':_0x45d402[0x3],'inputText':this[_0x7c7c('0x28')]['body'],'userId':this[_0x7c7c('0x12')]+':'+this[_0x7c7c('0xa')]['id'][_0x7c7c('0x29')]()};_0x14ceab[_0x7c7c('0x2a')](_0x37b125,function(_0x1db828,_0x5aea46){if(_0x1db828){logger[_0x7c7c('0x22')](_0x7c7c('0x20'),_0x1fdb12,_0x1db828[_0x7c7c('0x28')]);_0x36e915[_0x7c7c('0x2b')]();}else if(_0x5aea46&&_0x5aea46[_0x7c7c('0x28')]){_0x24a7a6['body'][_0x7c7c('0x2c')]=_0x5aea46;_0x5dfe08['body']=_0x5aea46['message'];_0x5dfe08['providerName']=_0x7c7c('0x2c');_0x5dfe08[_0x7c7c('0x2d')]=JSON[_0x7c7c('0x23')](_0x5aea46);return rpc[_0x58b24b+'Message'][_0x7c7c('0x1e')](_0x5dfe08)[_0x7c7c('0x1f')](function(_0xfe9c7f){logger[_0x7c7c('0xc')](_0x7c7c('0x20'),_0x1fdb12,_0x5dfe08[_0x7c7c('0x1b')]);if(_0x5aea46[_0x7c7c('0x2e')]==_0x7c7c('0x2f')){_0x36e915['next']();}else{_0x36e915['stop']();}})[_0x7c7c('0x21')](function(_0x51def7){logger[_0x7c7c('0x22')](_0x7c7c('0x20'),_0x1fdb12,JSON[_0x7c7c('0x23')](_0x51def7));_0x36e915[_0x7c7c('0x2b')]();});}else{_0x36e915[_0x7c7c('0x2b')]();}});}}catch(_0x47d332){logger[_0x7c7c('0x22')](_0x7c7c('0x20'),_0x1fdb12,JSON[_0x7c7c('0x23')](_0x47d332));_0x36e915[_0x7c7c('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 4fea601..687c4a4 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 _0xeddc=['isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','getMustacheRender','message','from','phone','read','subject','startsWith','chat','account','upperFirst','AccountId','inReplyTo','messageId','html','','replace','','sendMailMessage','then','Message','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','update','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body'];(function(_0x2f8257,_0x4644e9){var _0x908e5c=function(_0x12dc26){while(--_0x12dc26){_0x2f8257['push'](_0x2f8257['shift']());}};_0x908e5c(++_0x4644e9);}(_0xeddc,0x169));var _0xcedd=function(_0x3d1b74,_0x1a3f65){_0x3d1b74=_0x3d1b74-0x0;var _0x4f1fcb=_0xeddc[_0x3d1b74];return _0x4f1fcb;};'use strict';var _=require(_0xcedd('0x0'));var moment=require('moment');var utils=require(_0xcedd('0x1'));var logger=require('../../../../config/logger')(_0xcedd('0x2'));var rpc={'chatMessage':require(_0xcedd('0x3')),'openchannelMessage':require(_0xcedd('0x4')),'mailMessage':require(_0xcedd('0x5')),'smsMessage':require(_0xcedd('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xcedd('0x7')),'chatInteraction':require(_0xcedd('0x8')),'openchannelInteraction':require(_0xcedd('0x9')),'mailInteraction':require(_0xcedd('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xcedd('0xb'))};var mailRpc=require(_0xcedd('0xc'));exports[_0xcedd('0xd')]=function(_0x2e5c7c,_0xf4f8a3,_0x5c5397,_0x431d95){return function(_0x20771a){try{var _0x35ca3d=this[_0xcedd('0xe')];if(_0x35ca3d===_0xcedd('0xf')&&_0x431d95[_0xcedd('0x10')][_0xcedd('0x11')]){logger[_0xcedd('0x12')](_0xcedd('0x13'),_0x2e5c7c,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x20771a[_0xcedd('0x14')]();}if(_0xf4f8a3[0x0]==='1'&&(_[_0xcedd('0x15')](this['interaction']['created'])||!this[_0xcedd('0x16')][_0xcedd('0x17')])){logger[_0xcedd('0x12')]('[%s][AUTOREPLY]\x20%s',_0x2e5c7c,'Autoreply\x20already\x20sent');return _0x20771a[_0xcedd('0x14')]();}if(_0xf4f8a3[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger['info'](_0xcedd('0x18'),_0x2e5c7c,_0xcedd('0x19'));return _0x20771a[_0xcedd('0x14')]();}var _0x6e3fd2={'ContactId':this[_0xcedd('0x1a')]['id'],'sentAt':moment()[_0xcedd('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xcedd('0x1c')};if(this[_0xcedd('0xe')]==='mail'){_0x6e3fd2[_0xcedd('0x10')]=utils[_0xcedd('0x1d')](_0xf4f8a3[0x2],this);}else{_0x6e3fd2[_0xcedd('0x10')]=utils[_0xcedd('0x1d')](_0xf4f8a3[0x1],this);}if(this[_0xcedd('0x1e')]){_0x6e3fd2['to']=this['message'][_0xcedd('0x1f')]||'';if(this[_0xcedd('0xe')]===_0xcedd('0xf')&&_0xf4f8a3[0x1]==='1'){_0x6e3fd2['cc']=this[_0xcedd('0x1e')]['cc']||'';}_0x6e3fd2[_0xcedd('0x1f')]=this[_0xcedd('0x1e')]['to']||'';_0x6e3fd2[_0xcedd('0x20')]=this[_0xcedd('0x1e')]['phone']||'';_0x6e3fd2[_0xcedd('0x21')]=!![];if(this[_0xcedd('0x1e')]['subject']){_0x6e3fd2[_0xcedd('0x22')]='';_0x6e3fd2[_0xcedd('0x22')]+=_[_0xcedd('0x23')](this[_0xcedd('0x1e')][_0xcedd('0x22')],'Re:')?'':'Re:\x20';_0x6e3fd2[_0xcedd('0x22')]+=this[_0xcedd('0x1e')][_0xcedd('0x22')];}}if(this[_0xcedd('0xe')]===_0xcedd('0x24')){_0x6e3fd2['ChatWebsiteId']=this[_0xcedd('0x25')]['id'];}else{_0x6e3fd2[_[_0xcedd('0x26')](this[_0xcedd('0xe')])+_0xcedd('0x27')]=this[_0xcedd('0x25')]['id'];}_0x6e3fd2[_['upperFirst'](this[_0xcedd('0xe')])+'InteractionId']=this[_0xcedd('0x16')]['id'];var _0x588294=this[_0xcedd('0x16')];if(rpc[this[_0xcedd('0xe')]+'Message']){if(this[_0xcedd('0xe')]===_0xcedd('0xf')){_0x6e3fd2[_0xcedd('0x28')]=this[_0xcedd('0x1e')][_0xcedd('0x29')];_0x6e3fd2[_0xcedd('0x2a')]=_0xcedd('0x2b')+_[_0xcedd('0x2c')](_0x6e3fd2[_0xcedd('0x10')],_0xcedd('0x2d'),_0xcedd('0x2e'))+_0xcedd('0x2f');_0x6e3fd2['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':'auto_reply'};return mailRpc[_0xcedd('0x30')](this[_0xcedd('0x25')]['smtpOptions'],_0x6e3fd2)[_0xcedd('0x31')](function(_0x2e4df9){logger[_0xcedd('0x12')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x2e5c7c);_0x6e3fd2['messageId']=_0x2e4df9[_0xcedd('0x1e')][_0xcedd('0x29')];return rpc[_0x35ca3d+_0xcedd('0x32')][_0xcedd('0x33')](_0x6e3fd2);})[_0xcedd('0x31')](function(_0x48a354){logger[_0xcedd('0x12')](_0xcedd('0x13'),_0x2e5c7c,JSON[_0xcedd('0x34')](_0x48a354));})[_0xcedd('0x35')](function(_0x2e4b40){logger[_0xcedd('0x36')](_0xcedd('0x37'),_0x2e5c7c,JSON[_0xcedd('0x34')](_0x2e4b40));})[_0xcedd('0x38')](function(){Promise[_0xcedd('0x39')]()[_0xcedd('0x31')](function(){if(_0xf4f8a3[0x0]!=='2'||_0x588294[_0xcedd('0x3a')])return;return rpc[_0x35ca3d+'Interaction'][_0xcedd('0x3b')](_0x588294['id'],{'autoreplyExecuted':!![]})['then'](function(_0x3c13a8){logger[_0xcedd('0x12')](_0xcedd('0x18'),_0x2e5c7c,JSON[_0xcedd('0x34')](_0x3c13a8));})['catch'](function(_0x318f0f){logger[_0xcedd('0x36')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2e5c7c,JSON[_0xcedd('0x34')](_0x318f0f));});})[_0xcedd('0x31')](function(){_0x20771a['next']();});});}else{return rpc[this[_0xcedd('0xe')]+_0xcedd('0x32')]['create'](_0x6e3fd2)[_0xcedd('0x31')](function(){logger['info']('[%s][AUTOREPLY]\x20%s',_0x2e5c7c,_0x6e3fd2[_0xcedd('0x10')]);})['catch'](function(_0x44ba74){logger[_0xcedd('0x36')](_0xcedd('0x13'),_0x2e5c7c,JSON[_0xcedd('0x34')](_0x44ba74));})[_0xcedd('0x38')](function(){Promise[_0xcedd('0x39')]()['then'](function(){if(_0xf4f8a3[0x0]!=='2'||_0x588294[_0xcedd('0x3a')])return;return rpc[_0x35ca3d+_0xcedd('0x3c')][_0xcedd('0x3b')](_0x588294['id'],{'autoreplyExecuted':!![]})['then'](function(_0xd145be){logger['info'](_0xcedd('0x18'),_0x2e5c7c,JSON[_0xcedd('0x34')](_0xd145be));})[_0xcedd('0x35')](function(_0x156a0c){logger[_0xcedd('0x36')](_0xcedd('0x3d'),_0x2e5c7c,JSON['stringify'](_0x156a0c));});})[_0xcedd('0x31')](function(){_0x20771a[_0xcedd('0x14')]();});});}}}catch(_0x5e0afa){logger[_0xcedd('0x36')](_0xcedd('0x13'),_0x2e5c7c,JSON[_0xcedd('0x34')](_0x5e0afa));_0x20771a[_0xcedd('0x3e')]();}};}; \ No newline at end of file +var _0x8ccc=['','','headers','auto-replied','auto_reply','sendMailMessage','smtpOptions','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','then','autoreplyExecuted','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','./utils','routing','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','Autoreply\x20already\x20sent','next','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','account','InteractionId','Message','inReplyTo','messageId','html'];(function(_0x335a61,_0x21b879){var _0x48a02b=function(_0x2978a8){while(--_0x2978a8){_0x335a61['push'](_0x335a61['shift']());}};_0x48a02b(++_0x21b879);}(_0x8ccc,0x159));var _0xc8cc=function(_0x372e7c,_0x186d77){_0x372e7c=_0x372e7c-0x0;var _0x1b09ae=_0x8ccc[_0x372e7c];return _0x1b09ae;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0xc8cc('0x0'));var logger=require('../../../../config/logger')(_0xc8cc('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc8cc('0x2')),'whatsappMessage':require(_0xc8cc('0x3')),'chatInteraction':require(_0xc8cc('0x4')),'openchannelInteraction':require(_0xc8cc('0x5')),'mailInteraction':require(_0xc8cc('0x6')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xc8cc('0x7'))};var mailRpc=require(_0xc8cc('0x8'));exports[_0xc8cc('0x9')]=function(_0x3f4ef6,_0x1bd5c5,_0x264605,_0x860819){return function(_0x3d38ea){try{var _0x351d41=this[_0xc8cc('0xa')];if(_0x351d41===_0xc8cc('0xb')&&_0x860819[_0xc8cc('0xc')]['isAutoreply']){logger[_0xc8cc('0xd')](_0xc8cc('0xe'),_0x3f4ef6,_0xc8cc('0xf'));return _0x3d38ea['next']();}if(_0x1bd5c5[0x0]==='1'&&(_[_0xc8cc('0x10')](this[_0xc8cc('0x11')][_0xc8cc('0x12')])||!this[_0xc8cc('0x11')][_0xc8cc('0x12')])){logger[_0xc8cc('0xd')](_0xc8cc('0xe'),_0x3f4ef6,_0xc8cc('0x13'));return _0x3d38ea[_0xc8cc('0x14')]();}if(_0x1bd5c5[0x0]==='2'&&this[_0xc8cc('0x11')]['autoreplyExecuted']){logger[_0xc8cc('0xd')](_0xc8cc('0x15'),_0x3f4ef6,_0xc8cc('0x16'));return _0x3d38ea['next']();}var _0x5bcc64={'ContactId':this[_0xc8cc('0x17')]['id'],'sentAt':moment()[_0xc8cc('0x18')](_0xc8cc('0x19')),'direction':_0xc8cc('0x1a')};if(this[_0xc8cc('0xa')]===_0xc8cc('0xb')){_0x5bcc64[_0xc8cc('0xc')]=utils[_0xc8cc('0x1b')](_0x1bd5c5[0x2],this);}else{_0x5bcc64[_0xc8cc('0xc')]=utils[_0xc8cc('0x1b')](_0x1bd5c5[0x1],this);}if(this[_0xc8cc('0x1c')]){_0x5bcc64['to']=this[_0xc8cc('0x1c')]['from']||'';if(this['channel']==='mail'&&_0x1bd5c5[0x1]==='1'){_0x5bcc64['cc']=this[_0xc8cc('0x1c')]['cc']||'';}_0x5bcc64[_0xc8cc('0x1d')]=this[_0xc8cc('0x1c')]['to']||'';_0x5bcc64[_0xc8cc('0x1e')]=this['message'][_0xc8cc('0x1e')]||'';_0x5bcc64[_0xc8cc('0x1f')]=!![];if(this['message'][_0xc8cc('0x20')]){_0x5bcc64[_0xc8cc('0x20')]='';_0x5bcc64[_0xc8cc('0x20')]+=_[_0xc8cc('0x21')](this[_0xc8cc('0x1c')]['subject'],_0xc8cc('0x22'))?'':_0xc8cc('0x23');_0x5bcc64[_0xc8cc('0x20')]+=this[_0xc8cc('0x1c')][_0xc8cc('0x20')];}}if(this[_0xc8cc('0xa')]===_0xc8cc('0x24')){_0x5bcc64[_0xc8cc('0x25')]=this['account']['id'];}else{_0x5bcc64[_[_0xc8cc('0x26')](this[_0xc8cc('0xa')])+'AccountId']=this[_0xc8cc('0x27')]['id'];}_0x5bcc64[_['upperFirst'](this[_0xc8cc('0xa')])+_0xc8cc('0x28')]=this[_0xc8cc('0x11')]['id'];var _0x426013=this[_0xc8cc('0x11')];if(rpc[this['channel']+_0xc8cc('0x29')]){if(this[_0xc8cc('0xa')]===_0xc8cc('0xb')){_0x5bcc64[_0xc8cc('0x2a')]=this[_0xc8cc('0x1c')][_0xc8cc('0x2b')];_0x5bcc64[_0xc8cc('0x2c')]=_0xc8cc('0x2d')+_['replace'](_0x5bcc64[_0xc8cc('0xc')],']+(>|$)/g,''),'priorityTrue':_0x5d9cd8[0x1],'priorityFalse':_0x5d9cd8[0x2]};var _0x32b43d=gotoif[_0x2fe1('0x0')](_0x2ed186,{'typecast':!![]});if(_0x32b43d[_0x2fe1('0xe')]){logger[_0x2fe1('0xf')]('[%s][GOTOIF]\x20%s',_0x39f961,_['map'](_0x32b43d,'message')[_0x2fe1('0x10')](',\x20'));_0x20ab37[_0x2fe1('0x11')]();}else{try{var _0x193f45=eval('('+_0x2ed186[_0x2fe1('0x12')]+')');var _0x53d81f=_0x193f45?_0x2ed186[_0x2fe1('0x13')]:_0x2ed186[_0x2fe1('0x14')];logger[_0x2fe1('0x15')](_0x2fe1('0x16'),_0x39f961,_0x2ed186[_0x2fe1('0x12')],_0x193f45,_0x53d81f||'next');if(_0x53d81f){var _0x544aa0=_[_0x2fe1('0x17')](_0x20ab37['rules'](),{'p':_0x53d81f});if(_0x544aa0>=0x0){logger[_0x2fe1('0x15')](_0x2fe1('0x18'),_0x39f961,_0x53d81f||'next',_0x544aa0);_0x20ab37[_0x2fe1('0x19')](_0x544aa0);}else{logger['info'](_0x2fe1('0x1a'),_0x39f961,_0x53d81f||_0x2fe1('0x19'));_0x20ab37['stop']();}}else{_0x20ab37[_0x2fe1('0x19')]();}}catch(_0x2c6fe4){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x39f961,_0x2c6fe4[_0x2fe1('0x1b')]);_0x20ab37[_0x2fe1('0x11')]();}}}catch(_0x1fe509){logger[_0x2fe1('0xf')](_0x2fe1('0x1c'),_0x39f961,JSON[_0x2fe1('0x1d')](_0x1fe509));_0x20ab37[_0x2fe1('0x11')]();}};}; \ No newline at end of file +var _0xee87=['consequence','replace','validate','error','map','message','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number'];(function(_0x526d62,_0x7f3be){var _0x273839=function(_0x3aa857){while(--_0x3aa857){_0x526d62['push'](_0x526d62['shift']());}};_0x273839(++_0x7f3be);}(_0xee87,0x19a));var _0x7ee8=function(_0x5768f2,_0x1d26f9){_0x5768f2=_0x5768f2-0x0;var _0x9401b5=_0xee87[_0x5768f2];return _0x9401b5;};'use strict';var schema=require('validate');var _=require(_0x7ee8('0x0'));var htmlToText=require(_0x7ee8('0x1'));var utils=require(_0x7ee8('0x2'));var logger=require(_0x7ee8('0x3'))(_0x7ee8('0x4'));var gotoif=schema({'condition':{'type':_0x7ee8('0x5'),'required':!![],'message':_0x7ee8('0x6')},'priorityTrue':{'type':_0x7ee8('0x7'),'message':_0x7ee8('0x8')},'priorityFalse':{'type':_0x7ee8('0x7'),'message':_0x7ee8('0x9')}});exports[_0x7ee8('0xa')]=function(_0x111068,_0x139e39){return function(_0x3b0e7f){try{var _0x463c35={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x139e39[0x0],this),{'wordwrap':![]})[_0x7ee8('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x139e39[0x1],'priorityFalse':_0x139e39[0x2]};var _0x139257=gotoif[_0x7ee8('0xc')](_0x463c35,{'typecast':!![]});if(_0x139257['length']){logger[_0x7ee8('0xd')]('[%s][GOTOIF]\x20%s',_0x111068,_[_0x7ee8('0xe')](_0x139257,_0x7ee8('0xf'))[_0x7ee8('0x10')](',\x20'));_0x3b0e7f[_0x7ee8('0x11')]();}else{try{var _0x5800d=eval('('+_0x463c35[_0x7ee8('0x12')]+')');var _0x499c52=_0x5800d?_0x463c35['priorityTrue']:_0x463c35[_0x7ee8('0x13')];logger[_0x7ee8('0x14')](_0x7ee8('0x15'),_0x111068,_0x463c35[_0x7ee8('0x12')],_0x5800d,_0x499c52||_0x7ee8('0x16'));if(_0x499c52){var _0x22a6e1=_['findIndex'](_0x3b0e7f[_0x7ee8('0x17')](),{'p':_0x499c52});if(_0x22a6e1>=0x0){logger['info'](_0x7ee8('0x18'),_0x111068,_0x499c52||_0x7ee8('0x16'),_0x22a6e1);_0x3b0e7f[_0x7ee8('0x16')](_0x22a6e1);}else{logger[_0x7ee8('0x14')](_0x7ee8('0x19'),_0x111068,_0x499c52||_0x7ee8('0x16'));_0x3b0e7f[_0x7ee8('0x11')]();}}else{_0x3b0e7f[_0x7ee8('0x16')]();}}catch(_0x1c892f){logger['error'](_0x7ee8('0x1a'),_0x111068,_0x1c892f[_0x7ee8('0xf')]);_0x3b0e7f[_0x7ee8('0x11')]();}}}catch(_0x5d9f59){logger['error'](_0x7ee8('0x1b'),_0x111068,JSON['stringify'](_0x5d9f59));_0x3b0e7f[_0x7ee8('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index e01692d..2ee3195 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 _0x5dfa=['join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','length','error','[%s][GOTOP]\x20%s','map'];(function(_0x5eb9d5,_0x1f613d){var _0xace0=function(_0x294b42){while(--_0x294b42){_0x5eb9d5['push'](_0x5eb9d5['shift']());}};_0xace0(++_0x1f613d);}(_0x5dfa,0x1df));var _0xa5df=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5dfa[_0x20a584];return _0x4b41a8;};'use strict';var schema=require(_0xa5df('0x0'));var _=require(_0xa5df('0x1'));var logger=require('../../../../config/logger')(_0xa5df('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x56b03a,_0x2b6084){return function(_0x4760aa){try{var _0xe80995={'priority':_0x2b6084[0x0]};var _0x2e66d9=gotop['validate'](_0xe80995,{'typecast':!![]});if(_0x2e66d9[_0xa5df('0x3')]){logger[_0xa5df('0x4')](_0xa5df('0x5'),_0x56b03a,_[_0xa5df('0x6')](_0x2e66d9,'message')[_0xa5df('0x7')](',\x20'));_0x4760aa[_0xa5df('0x8')]();}else{logger[_0xa5df('0x9')](_0xa5df('0xa'),_0x56b03a,_0xe80995[_0xa5df('0xb')]);if(_0xe80995[_0xa5df('0xb')]){var _0x5e01b8=_[_0xa5df('0xc')](_0x4760aa[_0xa5df('0xd')](),{'p':_0xe80995[_0xa5df('0xb')]});if(_0x5e01b8>=0x0){logger[_0xa5df('0x9')](_0xa5df('0xe'),_0x56b03a,_0xe80995[_0xa5df('0xb')]||_0xa5df('0xf'),_0x5e01b8);_0x4760aa['next'](_0x5e01b8);}else{logger[_0xa5df('0x9')](_0xa5df('0x10'),_0x56b03a,_0xe80995[_0xa5df('0xb')]||'next');_0x4760aa[_0xa5df('0x8')]();}}else{_0x4760aa[_0xa5df('0xf')]();}}}catch(_0x295b0f){logger[_0xa5df('0x4')](_0xa5df('0x5'),_0x56b03a,JSON[_0xa5df('0x11')](_0x295b0f));_0x4760aa[_0xa5df('0x8')]();}};}; \ No newline at end of file +var _0x53a2=['stop','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','validate','length','[%s][GOTOP]\x20%s','map','join'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x53a2,0x91));var _0x253a=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x53a2[_0x18ab2a];return _0x16dcee;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require('../../../../config/logger')(_0x253a('0x0'));var gotop=schema({'priority':{'type':_0x253a('0x1'),'required':!![],'message':_0x253a('0x2')}});exports['consequence']=function(_0x126433,_0xd7272a){return function(_0x120311){try{var _0x46044c={'priority':_0xd7272a[0x0]};var _0x157c78=gotop[_0x253a('0x3')](_0x46044c,{'typecast':!![]});if(_0x157c78[_0x253a('0x4')]){logger['error'](_0x253a('0x5'),_0x126433,_[_0x253a('0x6')](_0x157c78,'message')[_0x253a('0x7')](',\x20'));_0x120311[_0x253a('0x8')]();}else{logger[_0x253a('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0x126433,_0x46044c[_0x253a('0xa')]);if(_0x46044c[_0x253a('0xa')]){var _0x5166b1=_[_0x253a('0xb')](_0x120311['rules'](),{'p':_0x46044c[_0x253a('0xa')]});if(_0x5166b1>=0x0){logger[_0x253a('0x9')](_0x253a('0xc'),_0x126433,_0x46044c[_0x253a('0xa')]||'next',_0x5166b1);_0x120311[_0x253a('0xd')](_0x5166b1);}else{logger[_0x253a('0x9')](_0x253a('0xe'),_0x126433,_0x46044c[_0x253a('0xa')]||_0x253a('0xd'));_0x120311[_0x253a('0x8')]();}}else{_0x120311[_0x253a('0xd')]();}}}catch(_0x195f19){logger[_0x253a('0xf')](_0x253a('0x5'),_0x126433,JSON[_0x253a('0x10')](_0x195f19));_0x120311[_0x253a('0x8')]();}};}; \ 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 df1eaa9..4aaee6b 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 _0x2fee=['consequence','getMustacheRender','contact','channel','chat','account','upperFirst','AccountId','InteractionId','interaction','Message','create','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage'];(function(_0x19e66f,_0x54cd24){var _0x299387=function(_0x262281){while(--_0x262281){_0x19e66f['push'](_0x19e66f['shift']());}};_0x299387(++_0x54cd24);}(_0x2fee,0x11a));var _0xe2fe=function(_0x32e2f3,_0x5c9fe7){_0x32e2f3=_0x32e2f3-0x0;var _0xcc7735=_0x2fee[_0x32e2f3];return _0xcc7735;};'use strict';var _=require(_0xe2fe('0x0'));var utils=require('./utils');var logger=require(_0xe2fe('0x1'))('routing');var rpc={'chatMessage':require(_0xe2fe('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xe2fe('0x3')),'smsMessage':require(_0xe2fe('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe2fe('0x5'))};exports[_0xe2fe('0x6')]=function(_0x128ac4,_0x4d4ac4){return function(_0x20d031){try{var _0x361d40={'body':utils[_0xe2fe('0x7')](_0x4d4ac4[0x0],this),'ContactId':this[_0xe2fe('0x8')]['id']};if(this[_0xe2fe('0x9')]===_0xe2fe('0xa')){_0x361d40['ChatWebsiteId']=this[_0xe2fe('0xb')]['id'];}else{_0x361d40[_[_0xe2fe('0xc')](this['channel'])+_0xe2fe('0xd')]=this[_0xe2fe('0xb')]['id'];}_0x361d40[_[_0xe2fe('0xc')](this[_0xe2fe('0x9')])+_0xe2fe('0xe')]=this[_0xe2fe('0xf')]['id'];if(rpc[this[_0xe2fe('0x9')]+_0xe2fe('0x10')]){return rpc[this[_0xe2fe('0x9')]+_0xe2fe('0x10')][_0xe2fe('0x11')](_0x361d40)['then'](function(_0x3b2753){logger['info'](_0xe2fe('0x12'),_0x128ac4,_0x361d40['body']);_0x20d031[_0xe2fe('0x13')]();})[_0xe2fe('0x14')](function(_0x3a3d22){logger[_0xe2fe('0x15')]('[%s][MESSAGE]\x20%s',_0x128ac4,JSON[_0xe2fe('0x16')](_0x3a3d22));_0x20d031[_0xe2fe('0x17')]();});}}catch(_0x5d3322){logger['error'](_0xe2fe('0x12'),_0x128ac4,JSON['stringify'](_0x5d3322));_0x20d031['stop']();}};}; \ No newline at end of file +var _0x9789=['Message','create','[%s][MESSAGE]\x20%s','next','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','chat','ChatWebsiteId','upperFirst','channel','account','InteractionId'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x9789,0xc7));var _0x9978=function(_0x48081d,_0x2091f0){_0x48081d=_0x48081d-0x0;var _0x2904bb=_0x9789[_0x48081d];return _0x2904bb;};'use strict';var _=require(_0x9978('0x0'));var utils=require(_0x9978('0x1'));var logger=require(_0x9978('0x2'))('routing');var rpc={'chatMessage':require(_0x9978('0x3')),'openchannelMessage':require(_0x9978('0x4')),'mailMessage':require(_0x9978('0x5')),'smsMessage':require(_0x9978('0x6')),'faxMessage':require(_0x9978('0x7')),'whatsappMessage':require(_0x9978('0x8'))};exports[_0x9978('0x9')]=function(_0x2a1751,_0x556690){return function(_0x2bb8ff){try{var _0x1f3ad0={'body':utils['getMustacheRender'](_0x556690[0x0],this),'ContactId':this[_0x9978('0xa')]['id']};if(this['channel']===_0x9978('0xb')){_0x1f3ad0[_0x9978('0xc')]=this['account']['id'];}else{_0x1f3ad0[_[_0x9978('0xd')](this[_0x9978('0xe')])+'AccountId']=this[_0x9978('0xf')]['id'];}_0x1f3ad0[_[_0x9978('0xd')](this[_0x9978('0xe')])+_0x9978('0x10')]=this['interaction']['id'];if(rpc[this['channel']+_0x9978('0x11')]){return rpc[this['channel']+_0x9978('0x11')][_0x9978('0x12')](_0x1f3ad0)['then'](function(_0x5a40c2){logger['info'](_0x9978('0x13'),_0x2a1751,_0x1f3ad0['body']);_0x2bb8ff[_0x9978('0x14')]();})['catch'](function(_0x525f56){logger[_0x9978('0x15')](_0x9978('0x13'),_0x2a1751,JSON[_0x9978('0x16')](_0x525f56));_0x2bb8ff[_0x9978('0x17')]();});}}catch(_0x29fd6f){logger[_0x9978('0x15')](_0x9978('0x13'),_0x2a1751,JSON[_0x9978('0x16')](_0x29fd6f));_0x2bb8ff['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 6796e12..99811a2 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 _0xb4b7=['./utils','routing','consequence','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4b7,0x90));var _0x7b4b=function(_0x599300,_0xb1eb1d){_0x599300=_0x599300-0x0;var _0x461707=_0xb4b7[_0x599300];return _0x461707;};'use strict';var utils=require(_0x7b4b('0x0'));var logger=require('../../../../config/logger')(_0x7b4b('0x1'));exports[_0x7b4b('0x2')]=function(_0x579064,_0x42267c){return function(_0x3760a2){try{logger['info'](_0x7b4b('0x3'),_0x579064,utils[_0x7b4b('0x4')](_0x42267c[0x0],this));_0x3760a2[_0x7b4b('0x5')]();}catch(_0x1d2844){logger[_0x7b4b('0x6')](_0x7b4b('0x3'),_0x579064,JSON[_0x7b4b('0x7')](_0x1d2844));_0x3760a2['stop']();}};}; \ No newline at end of file +var _0xdf23=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdf23,0x7f));var _0x3df2=function(_0x230324,_0x336f9b){_0x230324=_0x230324-0x0;var _0x3ed632=_0xdf23[_0x230324];return _0x3ed632;};'use strict';var utils=require(_0x3df2('0x0'));var logger=require(_0x3df2('0x1'))(_0x3df2('0x2'));exports[_0x3df2('0x3')]=function(_0x443006,_0x4c6bb3){return function(_0x224933){try{logger[_0x3df2('0x4')](_0x3df2('0x5'),_0x443006,utils[_0x3df2('0x6')](_0x4c6bb3[0x0],this));_0x224933[_0x3df2('0x7')]();}catch(_0x4ee1ce){logger[_0x3df2('0x8')]('[%s][NOOP]\x20%s',_0x443006,JSON[_0x3df2('0x9')](_0x4ee1ce));_0x224933[_0x3df2('0xa')]();}};}; \ 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 ed1247d..b9a4d3f 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 _0x474f=['YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message','AccountId','WebsiteId','name','QueueReport','create','catch','error','waiting','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','Queues','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','account','capitalize','InteractionId','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body'];(function(_0x56510d,_0x38220a){var _0x167cae=function(_0x7dc22c){while(--_0x7dc22c){_0x56510d['push'](_0x56510d['shift']());}};_0x167cae(++_0x38220a);}(_0x474f,0x1cd));var _0xf474=function(_0x430144,_0x3cc6ea){_0x430144=_0x430144-0x0;var _0x377f50=_0x474f[_0x430144];return _0x377f50;};'use strict';var schema=require(_0xf474('0x0'));var _=require(_0xf474('0x1'));var util=require(_0xf474('0x2'));var seqqueue=require(_0xf474('0x3'));var moment=require(_0xf474('0x4'));var Redis=require(_0xf474('0x5'));var config=require(_0xf474('0x6'));var logger=require(_0xf474('0x7'))(_0xf474('0x8'));var strategy=require(_0xf474('0x9'));config[_0xf474('0xa')]=_[_0xf474('0xb')](config[_0xf474('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xf474('0xc'))(new Redis(config[_0xf474('0xa')]));var attributes=['id',_0xf474('0xd'),'account',_0xf474('0xe'),_0xf474('0xf'),_0xf474('0x10')];function emit(_0x20bc55,_0x4d7a26,_0xaca716){io['to'](_0x20bc55)[_0xf474('0x11')](_0x4d7a26,_0xaca716);}function emitChannelQueueInteraction(_0x320847,_0x160382,_0x5d035a,_0x2648da,_0x1643eb,_0x393c4e,_0x6c0c25,_0xe8c4a3){var _0x29c712=_[_0xf474('0x12')](_0x5d035a);_0x29c712['queue_id']=_0xe8c4a3;_0x29c712['queue']=_0x160382;_0x29c712[_0xf474('0x13')]=_0x2648da;_0x29c712['id']=_0x1643eb;if(_0x393c4e){attributes['push'](_[_0xf474('0x14')](_0x320847)+_0xf474('0x15'));_0x6c0c25[util['format']('%sQueuesWaitingInteractions',_0x320847)][_0x1643eb]=_[_0xf474('0x16')](_0x29c712,attributes);}else{delete _0x6c0c25[util[_0xf474('0x17')](_0xf474('0x18'),_0x320847)][_0x1643eb];}emit(util[_0xf474('0x17')](_0xf474('0x19'),_0x320847,_0x160382),util[_0xf474('0x17')](_0xf474('0x1a'),_0x320847,_0x393c4e?_0xf474('0x1b'):_0xf474('0x1c')),_[_0xf474('0x16')](_0x29c712,attributes));}var rpc={'openchannelQueueReport':require(_0xf474('0x1d')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xf474('0x1e')),'faxQueueReport':require(_0xf474('0x1f')),'whatsappQueueReport':require(_0xf474('0x20')),'chatInteraction':require(_0xf474('0x21')),'faxInteraction':require(_0xf474('0x22')),'mailInteraction':require(_0xf474('0x23')),'openchannelInteraction':require(_0xf474('0x24')),'smsInteraction':require(_0xf474('0x25')),'whatsappInteraction':require(_0xf474('0x26'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xf474('0x27')},'timeout':{'type':_0xf474('0x28'),'message':_0xf474('0x29')}});function startRouting(_0x8d3b9e,_0x42d5d4,_0x31f170,_0x457dcd){if(_0x8d3b9e&&_0x42d5d4&&_0x31f170){_0x42d5d4['waiting']+=0x1;var _0xca9a15={'uniqueid':_0x8d3b9e,'from':_0x31f170[_0xf474('0x2a')]?_0x31f170['body']['from']:'','joinAt':moment()[_0xf474('0x17')](_0xf474('0x2b')),'ContactId':_0x31f170[_0xf474('0x2c')]?_0x31f170[_0xf474('0x2c')]['id']:null,'ListId':_0x31f170[_0xf474('0x2d')]?_0x31f170['list']['id']:null};_0xca9a15[_[_0xf474('0x2e')](_0x31f170[_0xf474('0x2f')])+_0xf474('0x30')]=_0x42d5d4['id']||null;_0xca9a15[_[_0xf474('0x2e')](_0x31f170[_0xf474('0x2f')])+'InteractionId']=_0x31f170[_0xf474('0x31')]?_0x31f170[_0xf474('0x31')]['id']:null;_0xca9a15[_[_0xf474('0x2e')](_0x31f170[_0xf474('0x2f')])+'MessageId']=_0x31f170[_0xf474('0x32')]?_0x31f170[_0xf474('0x32')]['id']:null;_0xca9a15[_[_0xf474('0x2e')](_0x31f170[_0xf474('0x2f')])+(_0x31f170['channel']!=='chat'?_0xf474('0x33'):_0xf474('0x34'))]=_0x31f170[_0xf474('0x13')]?_0x31f170['account']['id']:null;logger['info'](util[_0xf474('0x17')]('[%s][START:QUEUE][NAME:%s]',_0x8d3b9e,_0x42d5d4[_0xf474('0x35')]));emitChannelQueueInteraction(_0x31f170[_0xf474('0x2f')],_0x42d5d4['name'],_0xca9a15,_0x31f170[_0xf474('0x13')][_0xf474('0x35')],_0x31f170[_0xf474('0x32')]['id'],!![],_0x457dcd,_0x42d5d4['id']);if(rpc[_0x31f170['channel']+_0xf474('0x36')]){return rpc[_0x31f170[_0xf474('0x2f')]+_0xf474('0x36')][_0xf474('0x37')](_0xca9a15)[_0xf474('0x38')](function(_0x1c4c55){logger[_0xf474('0x39')]('create\x20queue\x20report',_0x1c4c55);});}}}function stopRouting(_0x168a89,_0x302f72,_0x3af53d,_0x56a137){if(_0x168a89&&_0x302f72){_0x302f72[_0xf474('0x3a')]-=0x1;var _0x3f515f={'leaveAt':moment()['format'](_0xf474('0x2b')),'acceptAt':moment()['format'](_0xf474('0x2b')),'reason':'accepted'};logger[_0xf474('0x3b')](util[_0xf474('0x17')](_0xf474('0x3c'),_0x168a89,_0x302f72[_0xf474('0x35')]));emitChannelQueueInteraction(_0x3af53d[_0xf474('0x2f')],_0x302f72[_0xf474('0x35')],_0x3af53d['body'],_0x3af53d[_0xf474('0x13')][_0xf474('0x35')],_0x3af53d['message']['id'],![],_0x56a137,_0x302f72['id']);return rpc[_0x3af53d[_0xf474('0x2f')]+'Interaction'][_0xf474('0x3d')](_0x3af53d[_0xf474('0x31')]['id'],{'queueId':_0x302f72['id']})['then'](function(){if(rpc[_0x3af53d['channel']+_0xf474('0x36')]){return rpc[_0x3af53d['channel']+_0xf474('0x36')]['update'](_0x168a89,_0x3f515f)['catch'](function(_0x208d05){logger['error']('update\x20queue\x20report',_0x208d05);});}});}}function endRouting(_0x18c09b,_0x325dd0,_0x527de4,_0x5150af){if(_0x18c09b&&_0x325dd0){_0x325dd0['waiting']-=0x1;var _0xa393de={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xf474('0x17')](_0xf474('0x2b')),'reason':_0xf474('0x3e')};logger[_0xf474('0x3b')](util['format'](_0xf474('0x3f'),_0x18c09b,_0x325dd0[_0xf474('0x35')]));emitChannelQueueInteraction(_0x527de4[_0xf474('0x2f')],_0x325dd0[_0xf474('0x35')],_0x527de4['body'],_0x527de4[_0xf474('0x13')][_0xf474('0x35')],_0x527de4[_0xf474('0x32')]['id'],![],_0x5150af);if(rpc[_0x527de4['channel']+_0xf474('0x36')]){return rpc[_0x527de4['channel']+'QueueReport'][_0xf474('0x3d')](_0x18c09b,_0xa393de)[_0xf474('0x38')](function(_0x491089){logger[_0xf474('0x39')](_0xf474('0x40'),_0x491089);});}}}function handleFindQueue(_0x57bd07){return function(_0x1f0ad6){return _0x1f0ad6[_0xf474('0x35')][_0xf474('0x41')]()===_0x57bd07['toLowerCase']();};}exports[_0xf474('0x42')]=function(_0x36e265,_0x63e135,_0x12dc17,_0x1d33ad){return function(_0x34a87c){try{var _0x39ad8c={'name':_0x63e135[0x0],'timeout':_0x63e135[0x1]};var _0x5d3bf1=queue[_0xf474('0x0')](_0x39ad8c,{'typecast':!![]});if(_0x5d3bf1['length']){logger[_0xf474('0x39')](_0xf474('0x43'),_0x36e265,_[_0xf474('0x44')](_0x5d3bf1,_0xf474('0x32'))[_0xf474('0x45')](',\x20'));_0x34a87c[_0xf474('0x46')]();}else{var _0x8e8bb5=_['find'](_0x12dc17[_0x1d33ad[_0xf474('0x2f')]+_0xf474('0x47')],handleFindQueue(_0x39ad8c['name']));if(_0x8e8bb5){startRouting(_0x36e265,_0x8e8bb5,_0x1d33ad,_0x12dc17);var _0x64d899=(_0x8e8bb5['timeout']||0xa)*0x3e8;var _0x4a48a6=(_0x39ad8c['timeout']||0x14)*0x3e8;var _0x21c226;if(_0x64d899>_0x4a48a6){_0x4a48a6=_0x64d899;}var _0x4900ee=seqqueue[_0xf474('0x48')](_0x64d899);_0x4900ee['id']=_0x36e265;_0x4900ee[_0xf474('0x49')]=_0x64d899;_0x4900ee['qtimeout']=_0x4a48a6;_0x4900ee['channel']=_0x1d33ad[_0xf474('0x2f')];_0x12dc17[_0xf474('0x4a')][_0x36e265]['on'](_0xf474('0x4b'),function(){logger[_0xf474('0x3b')](_0xf474('0x4c'),_0x36e265);stopRouting(_0x36e265,_0x8e8bb5,_0x1d33ad,_0x12dc17);clearTimeout(_0x21c226);_0x21c226=undefined;_0x4900ee[_0xf474('0x4d')](!![]);if(_0x12dc17[_0xf474('0x4a')][_0x36e265]){delete _0x12dc17[_0xf474('0x4a')][_0x36e265];}_0x34a87c[_0xf474('0x46')]();});_0x12dc17['rules'][_0x36e265]['on'](_0xf474('0x4e'),function(){if(_0x12dc17['rules'][_0x36e265]){delete _0x12dc17[_0xf474('0x4a')][_0x36e265];}});_0x21c226=setTimeout(function(){logger[_0xf474('0x3b')](_0xf474('0x4f'),_0x36e265);endRouting(_0x36e265,_0x8e8bb5,_0x1d33ad,_0x12dc17);clearTimeout(_0x21c226);_0x4900ee[_0xf474('0x4d')](!![]);_0x34a87c[_0xf474('0x50')]();},_0x4a48a6);switch(_0x8e8bb5[_0xf474('0x51')]){case _0xf474('0x52'):strategy['rrmemory'](_0x4900ee,_0x8e8bb5,_0x12dc17,_0x1d33ad);break;default:strategy['beepall'](_0x4900ee,_0x8e8bb5,_0x12dc17,_0x1d33ad);}}else{logger['error'](_0xf474('0x53'),_0x36e265,_0x39ad8c[_0xf474('0x35')]);_0x34a87c['stop']();}}}catch(_0x2588c4){logger['error'](_0xf474('0x43'),_0x36e265,_0x2588c4['stack']);_0x34a87c['stop']();}};}; \ No newline at end of file +var _0xaf00=['redis','defaults','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','capitalize','InteractionId','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','interaction','channel','MessageId','message','chat','WebsiteId','account','info','name','QueueReport','create','catch','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','error','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','Queues','timeout','createQueue','atimeout','qtimeout','rules','end','stop','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','util','seq-queue','moment','../../../../config/logger','routing','./strategy'];(function(_0x5510a6,_0x4975b9){var _0x962a10=function(_0x5cca76){while(--_0x5cca76){_0x5510a6['push'](_0x5510a6['shift']());}};_0x962a10(++_0x4975b9);}(_0xaf00,0xf5));var _0x0af0=function(_0x1d83db,_0x89d115){_0x1d83db=_0x1d83db-0x0;var _0x2dc1d1=_0xaf00[_0x1d83db];return _0x2dc1d1;};'use strict';var schema=require(_0x0af0('0x0'));var _=require('lodash');var util=require(_0x0af0('0x1'));var seqqueue=require(_0x0af0('0x2'));var moment=require(_0x0af0('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x0af0('0x4'))(_0x0af0('0x5'));var strategy=require(_0x0af0('0x6'));config[_0x0af0('0x7')]=_[_0x0af0('0x8')](config[_0x0af0('0x7')],{'host':_0x0af0('0x9'),'port':0x18eb});var io=require(_0x0af0('0xa'))(new Redis(config[_0x0af0('0x7')]));var attributes=['id',_0x0af0('0xb'),'account',_0x0af0('0xc'),_0x0af0('0xd'),_0x0af0('0xe')];function emit(_0x1bb550,_0x1bd51d,_0x6bcc5a){io['to'](_0x1bb550)[_0x0af0('0xf')](_0x1bd51d,_0x6bcc5a);}function emitChannelQueueInteraction(_0x245193,_0x4cc9fa,_0x1f1a79,_0xca5aed,_0x1df7a3,_0xf68742,_0xa2a860,_0x56c5b9){var _0x12a27b=_[_0x0af0('0x10')](_0x1f1a79);_0x12a27b[_0x0af0('0xb')]=_0x56c5b9;_0x12a27b[_0x0af0('0xc')]=_0x4cc9fa;_0x12a27b['account']=_0xca5aed;_0x12a27b['id']=_0x1df7a3;if(_0xf68742){attributes['push'](_[_0x0af0('0x11')](_0x245193)+_0x0af0('0x12'));_0xa2a860[util[_0x0af0('0x13')]('%sQueuesWaitingInteractions',_0x245193)][_0x1df7a3]=_[_0x0af0('0x14')](_0x12a27b,attributes);}else{delete _0xa2a860[util[_0x0af0('0x13')](_0x0af0('0x15'),_0x245193)][_0x1df7a3];}emit(util[_0x0af0('0x13')](_0x0af0('0x16'),_0x245193,_0x4cc9fa),util[_0x0af0('0x13')](_0x0af0('0x17'),_0x245193,_0xf68742?_0x0af0('0x18'):_0x0af0('0x19')),_['pick'](_0x12a27b,attributes));}var rpc={'openchannelQueueReport':require(_0x0af0('0x1a')),'mailQueueReport':require(_0x0af0('0x1b')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x0af0('0x1c')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x0af0('0x1d')),'chatInteraction':require(_0x0af0('0x1e')),'faxInteraction':require(_0x0af0('0x1f')),'mailInteraction':require(_0x0af0('0x20')),'openchannelInteraction':require(_0x0af0('0x21')),'smsInteraction':require(_0x0af0('0x22')),'whatsappInteraction':require(_0x0af0('0x23'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x0af0('0x24')},'timeout':{'type':'number','message':_0x0af0('0x25')}});function startRouting(_0x38d0a3,_0x287d30,_0x622824,_0x22e55d){if(_0x38d0a3&&_0x287d30&&_0x622824){_0x287d30[_0x0af0('0x26')]+=0x1;var _0x276a0b={'uniqueid':_0x38d0a3,'from':_0x622824[_0x0af0('0x27')]?_0x622824['body'][_0x0af0('0xd')]:'','joinAt':moment()[_0x0af0('0x13')](_0x0af0('0x28')),'ContactId':_0x622824[_0x0af0('0x29')]?_0x622824[_0x0af0('0x29')]['id']:null,'ListId':_0x622824['list']?_0x622824[_0x0af0('0x2a')]['id']:null};_0x276a0b[_['upperFirst'](_0x622824['channel'])+'QueueId']=_0x287d30['id']||null;_0x276a0b[_[_0x0af0('0x2b')](_0x622824['channel'])+'InteractionId']=_0x622824['interaction']?_0x622824[_0x0af0('0x2c')]['id']:null;_0x276a0b[_[_0x0af0('0x2b')](_0x622824[_0x0af0('0x2d')])+_0x0af0('0x2e')]=_0x622824[_0x0af0('0x2f')]?_0x622824[_0x0af0('0x2f')]['id']:null;_0x276a0b[_[_0x0af0('0x2b')](_0x622824[_0x0af0('0x2d')])+(_0x622824[_0x0af0('0x2d')]!==_0x0af0('0x30')?'AccountId':_0x0af0('0x31'))]=_0x622824[_0x0af0('0x32')]?_0x622824[_0x0af0('0x32')]['id']:null;logger[_0x0af0('0x33')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x38d0a3,_0x287d30[_0x0af0('0x34')]));emitChannelQueueInteraction(_0x622824['channel'],_0x287d30[_0x0af0('0x34')],_0x276a0b,_0x622824[_0x0af0('0x32')][_0x0af0('0x34')],_0x622824[_0x0af0('0x2f')]['id'],!![],_0x22e55d,_0x287d30['id']);if(rpc[_0x622824[_0x0af0('0x2d')]+_0x0af0('0x35')]){return rpc[_0x622824[_0x0af0('0x2d')]+'QueueReport'][_0x0af0('0x36')](_0x276a0b)[_0x0af0('0x37')](function(_0x1f2053){logger['error']('create\x20queue\x20report',_0x1f2053);});}}}function stopRouting(_0x36bc5a,_0x1ee20c,_0x4e5268,_0xa7831c){if(_0x36bc5a&&_0x1ee20c){_0x1ee20c['waiting']-=0x1;var _0x31acae={'leaveAt':moment()['format'](_0x0af0('0x28')),'acceptAt':moment()[_0x0af0('0x13')](_0x0af0('0x28')),'reason':'accepted'};logger[_0x0af0('0x33')](util[_0x0af0('0x13')](_0x0af0('0x38'),_0x36bc5a,_0x1ee20c[_0x0af0('0x34')]));emitChannelQueueInteraction(_0x4e5268[_0x0af0('0x2d')],_0x1ee20c[_0x0af0('0x34')],_0x4e5268[_0x0af0('0x27')],_0x4e5268[_0x0af0('0x32')][_0x0af0('0x34')],_0x4e5268[_0x0af0('0x2f')]['id'],![],_0xa7831c,_0x1ee20c['id']);return rpc[_0x4e5268[_0x0af0('0x2d')]+_0x0af0('0x39')][_0x0af0('0x3a')](_0x4e5268[_0x0af0('0x2c')]['id'],{'queueId':_0x1ee20c['id']})[_0x0af0('0x3b')](function(){if(rpc[_0x4e5268[_0x0af0('0x2d')]+_0x0af0('0x35')]){return rpc[_0x4e5268[_0x0af0('0x2d')]+'QueueReport'][_0x0af0('0x3a')](_0x36bc5a,_0x31acae)[_0x0af0('0x37')](function(_0x346afd){logger[_0x0af0('0x3c')](_0x0af0('0x3d'),_0x346afd);});}});}}function endRouting(_0x252876,_0x58d0cf,_0xcae2ec,_0x43b005){if(_0x252876&&_0x58d0cf){_0x58d0cf[_0x0af0('0x26')]-=0x1;var _0x1d4c2f={'leaveAt':moment()['format'](_0x0af0('0x28')),'exitAt':moment()[_0x0af0('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0x0af0('0x33')](util[_0x0af0('0x13')](_0x0af0('0x3e'),_0x252876,_0x58d0cf[_0x0af0('0x34')]));emitChannelQueueInteraction(_0xcae2ec['channel'],_0x58d0cf[_0x0af0('0x34')],_0xcae2ec[_0x0af0('0x27')],_0xcae2ec[_0x0af0('0x32')][_0x0af0('0x34')],_0xcae2ec[_0x0af0('0x2f')]['id'],![],_0x43b005);if(rpc[_0xcae2ec[_0x0af0('0x2d')]+_0x0af0('0x35')]){return rpc[_0xcae2ec['channel']+_0x0af0('0x35')][_0x0af0('0x3a')](_0x252876,_0x1d4c2f)[_0x0af0('0x37')](function(_0x39a21f){logger[_0x0af0('0x3c')](_0x0af0('0x3d'),_0x39a21f);});}}}function handleFindQueue(_0x249cb2){return function(_0x54d1b9){return _0x54d1b9[_0x0af0('0x34')][_0x0af0('0x3f')]()===_0x249cb2[_0x0af0('0x3f')]();};}exports[_0x0af0('0x40')]=function(_0x136a05,_0x22a913,_0x233083,_0x7d817d){return function(_0x43807b){try{var _0x11b98b={'name':_0x22a913[0x0],'timeout':_0x22a913[0x1]};var _0x2837d4=queue[_0x0af0('0x0')](_0x11b98b,{'typecast':!![]});if(_0x2837d4[_0x0af0('0x41')]){logger[_0x0af0('0x3c')](_0x0af0('0x42'),_0x136a05,_[_0x0af0('0x43')](_0x2837d4,_0x0af0('0x2f'))[_0x0af0('0x44')](',\x20'));_0x43807b['stop']();}else{var _0x4c5a02=_['find'](_0x233083[_0x7d817d['channel']+_0x0af0('0x45')],handleFindQueue(_0x11b98b[_0x0af0('0x34')]));if(_0x4c5a02){startRouting(_0x136a05,_0x4c5a02,_0x7d817d,_0x233083);var _0x5975ba=(_0x4c5a02['timeout']||0xa)*0x3e8;var _0xe7144d=(_0x11b98b[_0x0af0('0x46')]||0x14)*0x3e8;var _0x1c253a;if(_0x5975ba>_0xe7144d){_0xe7144d=_0x5975ba;}var _0x389453=seqqueue[_0x0af0('0x47')](_0x5975ba);_0x389453['id']=_0x136a05;_0x389453[_0x0af0('0x48')]=_0x5975ba;_0x389453[_0x0af0('0x49')]=_0xe7144d;_0x389453[_0x0af0('0x2d')]=_0x7d817d[_0x0af0('0x2d')];_0x233083[_0x0af0('0x4a')][_0x136a05]['on'](_0x0af0('0x4b'),function(){logger[_0x0af0('0x33')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x136a05);stopRouting(_0x136a05,_0x4c5a02,_0x7d817d,_0x233083);clearTimeout(_0x1c253a);_0x1c253a=undefined;_0x389453['close'](!![]);if(_0x233083['rules'][_0x136a05]){delete _0x233083[_0x0af0('0x4a')][_0x136a05];}_0x43807b[_0x0af0('0x4c')]();});_0x233083[_0x0af0('0x4a')][_0x136a05]['on']('complete',function(){if(_0x233083[_0x0af0('0x4a')][_0x136a05]){delete _0x233083['rules'][_0x136a05];}});_0x1c253a=setTimeout(function(){logger[_0x0af0('0x33')](_0x0af0('0x4d'),_0x136a05);endRouting(_0x136a05,_0x4c5a02,_0x7d817d,_0x233083);clearTimeout(_0x1c253a);_0x389453[_0x0af0('0x4e')](!![]);_0x43807b[_0x0af0('0x4f')]();},_0xe7144d);switch(_0x4c5a02[_0x0af0('0x50')]){case _0x0af0('0x51'):strategy[_0x0af0('0x51')](_0x389453,_0x4c5a02,_0x233083,_0x7d817d);break;default:strategy[_0x0af0('0x52')](_0x389453,_0x4c5a02,_0x233083,_0x7d817d);}}else{logger[_0x0af0('0x3c')](_0x0af0('0x53'),_0x136a05,_0x11b98b[_0x0af0('0x34')]);_0x43807b[_0x0af0('0x4c')]();}}}catch(_0x33215f){logger[_0x0af0('0x3c')]('[%s][QUEUE]\x20%s',_0x136a05,_0x33215f['stack']);_0x43807b[_0x0af0('0x4c')]();}};}; \ 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 180fa21..4e6df9f 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 _0x5c12=['squeue','realtime','bind','handleTimeout','timeout','drained','handleDrained','push','handleRun','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','agents','saveWaitingNotification','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','prototype','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','writeLog','STOP','TIMEOUT','exports','uuid','./util','routing','notificationId'];(function(_0x4ecb36,_0x84bab4){var _0x21784c=function(_0xf071a0){while(--_0xf071a0){_0x4ecb36['push'](_0x4ecb36['shift']());}};_0x21784c(++_0x84bab4);}(_0x5c12,0x188));var _0x25c1=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x5c12[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var uuid=require(_0x25c1('0x0'));var util=require(_0x25c1('0x1'));var logger=require('../../../../../config/logger')(_0x25c1('0x2'));var Agent=function(_0x1991e5,_0x4042fe,_0x10f10c,_0x2c5df0){this[_0x25c1('0x3')]=uuid['v4']();this[_0x25c1('0x4')]=_0x1991e5;this['agent']=_0x4042fe;this[_0x25c1('0x5')]=_0x10f10c;this[_0x25c1('0x2')]=_0x2c5df0;this[_0x25c1('0x4')]['push'](this['handleRun'][_0x25c1('0x6')](this),this[_0x25c1('0x7')][_0x25c1('0x6')](this));this[_0x25c1('0x4')]['on'](_0x25c1('0x8'),this['handleTimeout'][_0x25c1('0x6')](this));this[_0x25c1('0x4')]['on'](_0x25c1('0x9'),this[_0x25c1('0xa')][_0x25c1('0x6')](this));};Agent['prototype'][_0x25c1('0xb')]=function(){this[_0x25c1('0x4')]['push'](this[_0x25c1('0xc')][_0x25c1('0x6')](this),this[_0x25c1('0x7')][_0x25c1('0x6')](this));};Agent['prototype']['handleDrained']=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x25c1('0xc')]=function(){logger[_0x25c1('0xd')](_0x25c1('0xe'),this[_0x25c1('0x4')]['id'],this[_0x25c1('0xf')]['id']);if(_['isNil'](this[_0x25c1('0x5')]['agents'][this['agent']['id']])){logger['debug'](_0x25c1('0x10'),this[_0x25c1('0x4')]['id'],this['agent']['id']);setTimeout(this['push'][_0x25c1('0x6')](this),0x3e8);}else{if(this['routing'][_0x25c1('0x11')]||util[_0x25c1('0x12')](this['squeue']['id'],this['realtime']['agents'][this[_0x25c1('0xf')]['id']],this[_0x25c1('0x4')][_0x25c1('0x13')],![])){this[_0x25c1('0x5')]['agents'][this[_0x25c1('0xf')]['id']][_0x25c1('0x14')]=!![];this[_0x25c1('0x5')][_0x25c1('0x15')][this['agent']['id']]['busyQueue']=undefined;util[_0x25c1('0x16')](this[_0x25c1('0x5')],this[_0x25c1('0x2')],this[_0x25c1('0xf')],this[_0x25c1('0x4')][_0x25c1('0x13')]);util[_0x25c1('0x17')](this[_0x25c1('0x3')],this[_0x25c1('0x4')]['id'],this[_0x25c1('0x5')][_0x25c1('0x15')][this[_0x25c1('0xf')]['id']],null,this[_0x25c1('0x2')]);util['writeLog'](this[_0x25c1('0x4')]['id'],this[_0x25c1('0x5')][_0x25c1('0x15')][this[_0x25c1('0xf')]['id']],_0x25c1('0x18')+(this[_0x25c1('0x2')]['forcedOwnership']?_0x25c1('0x19'):''));}else{logger[_0x25c1('0xd')](_0x25c1('0x1a'),this[_0x25c1('0x4')]['id'],this[_0x25c1('0xf')]['id']);setTimeout(this[_0x25c1('0xb')]['bind'](this),0x3e8);}}};Agent[_0x25c1('0x1b')]['handleTimeout']=function(_0x76b360){if(_[_0x25c1('0x1c')](this[_0x25c1('0x5')][_0x25c1('0x15')][this[_0x25c1('0xf')]['id']])){return logger[_0x25c1('0xd')](_0x25c1('0x10'),this[_0x25c1('0x4')]['id'],this[_0x25c1('0xf')]['id']);}else{logger['debug'](_0x25c1('0x1d'),this['squeue']['id'],this['agent']['id']);util[_0x25c1('0x1e')](this[_0x25c1('0x3')],this['squeue']['id'],this[_0x25c1('0x5')]['agents'][this[_0x25c1('0xf')]['id']],null,this['routing']);this[_0x25c1('0x5')][_0x25c1('0x15')][this[_0x25c1('0xf')]['id']][_0x25c1('0x14')]=![];this[_0x25c1('0x5')][_0x25c1('0x15')][this[_0x25c1('0xf')]['id']][_0x25c1('0x1f')]=undefined;util['removeWaitingNotification'](this[_0x25c1('0x5')],this['routing'],this[_0x25c1('0xf')],this['squeue'][_0x25c1('0x13')]);util[_0x25c1('0x20')](this[_0x25c1('0x4')]['id'],this[_0x25c1('0x5')][_0x25c1('0x15')][this[_0x25c1('0xf')]['id']],_0x76b360?_0x25c1('0x21'):_0x25c1('0x22'));}if(!_0x76b360){setTimeout(this[_0x25c1('0xb')][_0x25c1('0x6')](this),0x3e8);}};function agent(_0x26ed98,_0x3f02f2,_0x1041a3,_0x1b6e92){return new Agent(_0x26ed98,_0x3f02f2,_0x1041a3,_0x1b6e92);}module[_0x25c1('0x23')]=agent; \ No newline at end of file +var _0xe14d=['[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','[%s][AGENT]\x20try\x20with\x20%s','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','busy','busyQueue','saveWaitingNotification','channel','showNotification','writeLog','forcedOwnership',':FORCED','isNil'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe14d,0x1ee));var _0xde14=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xe14d[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0xde14('0x0'));var uuid=require(_0xde14('0x1'));var util=require(_0xde14('0x2'));var logger=require(_0xde14('0x3'))('routing');var Agent=function(_0x1c5b4,_0x28965b,_0x4b20e2,_0x1c3e94){this[_0xde14('0x4')]=uuid['v4']();this[_0xde14('0x5')]=_0x1c5b4;this[_0xde14('0x6')]=_0x28965b;this[_0xde14('0x7')]=_0x4b20e2;this[_0xde14('0x8')]=_0x1c3e94;this['squeue']['push'](this[_0xde14('0x9')][_0xde14('0xa')](this),this[_0xde14('0xb')][_0xde14('0xa')](this));this[_0xde14('0x5')]['on'](_0xde14('0xc'),this[_0xde14('0xb')][_0xde14('0xa')](this));this['squeue']['on'](_0xde14('0xd'),this[_0xde14('0xe')][_0xde14('0xa')](this));};Agent[_0xde14('0xf')][_0xde14('0x10')]=function(){this[_0xde14('0x5')][_0xde14('0x10')](this[_0xde14('0x9')][_0xde14('0xa')](this),this[_0xde14('0xb')][_0xde14('0xa')](this));};Agent[_0xde14('0xf')][_0xde14('0xe')]=function(){this[_0xde14('0xb')](!![]);};Agent[_0xde14('0xf')]['handleRun']=function(){logger['debug'](_0xde14('0x11'),this[_0xde14('0x5')]['id'],this[_0xde14('0x6')]['id']);if(_['isNil'](this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']])){logger[_0xde14('0x13')](_0xde14('0x14'),this[_0xde14('0x5')]['id'],this[_0xde14('0x6')]['id']);setTimeout(this[_0xde14('0x10')][_0xde14('0xa')](this),0x3e8);}else{if(this[_0xde14('0x8')]['forcedOwnership']||util[_0xde14('0x15')](this[_0xde14('0x5')]['id'],this[_0xde14('0x7')][_0xde14('0x12')][this['agent']['id']],this[_0xde14('0x5')]['channel'],![])){this[_0xde14('0x7')]['agents'][this[_0xde14('0x6')]['id']][_0xde14('0x16')]=!![];this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']][_0xde14('0x17')]=undefined;util[_0xde14('0x18')](this[_0xde14('0x7')],this[_0xde14('0x8')],this[_0xde14('0x6')],this[_0xde14('0x5')][_0xde14('0x19')]);util[_0xde14('0x1a')](this['notificationId'],this[_0xde14('0x5')]['id'],this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']],null,this[_0xde14('0x8')]);util[_0xde14('0x1b')](this[_0xde14('0x5')]['id'],this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']],'RINGING'+(this[_0xde14('0x8')][_0xde14('0x1c')]?_0xde14('0x1d'):''));}else{logger[_0xde14('0x13')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xde14('0x5')]['id'],this[_0xde14('0x6')]['id']);setTimeout(this[_0xde14('0x10')]['bind'](this),0x3e8);}}};Agent[_0xde14('0xf')]['handleTimeout']=function(_0x2760f9){if(_[_0xde14('0x1e')](this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']])){return logger[_0xde14('0x13')](_0xde14('0x14'),this[_0xde14('0x5')]['id'],this['agent']['id']);}else{logger[_0xde14('0x13')](_0xde14('0x1f'),this['squeue']['id'],this[_0xde14('0x6')]['id']);util['hideNotification'](this[_0xde14('0x4')],this[_0xde14('0x5')]['id'],this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']],null,this['routing']);this[_0xde14('0x7')][_0xde14('0x12')][this['agent']['id']][_0xde14('0x16')]=![];this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']][_0xde14('0x17')]=undefined;util[_0xde14('0x20')](this[_0xde14('0x7')],this[_0xde14('0x8')],this[_0xde14('0x6')],this['squeue']['channel']);util[_0xde14('0x1b')](this[_0xde14('0x5')]['id'],this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']],_0x2760f9?_0xde14('0x21'):_0xde14('0x22'));}if(!_0x2760f9){setTimeout(this[_0xde14('0x10')][_0xde14('0xa')](this),0x3e8);}};function agent(_0x4e33e0,_0x1854d3,_0x48c043,_0x4a363c){return new Agent(_0x4e33e0,_0x1854d3,_0x48c043,_0x4a363c);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 5b60084..095a129 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 _0x034e=['handleTimeout','drained','handleDrained','prototype','isNil','queue','Agents','length','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','busy','busyQueue','name','saveWaitingNotification','showNotification','agents','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','TIMEOUT','removeWaitingNotification','exports','lodash','notificationId','squeue','realtime','routing','push','handleRun','bind'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x034e,0x16c));var _0xe034=function(_0x1c712a,_0x2b1ad4){_0x1c712a=_0x1c712a-0x0;var _0x49d160=_0x034e[_0x1c712a];return _0x49d160;};'use strict';var _=require(_0xe034('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x440444,_0x4bd0df,_0x426c6b,_0x38bd7b){this[_0xe034('0x1')]=uuid['v4']();this[_0xe034('0x2')]=_0x440444;this['queue']=_0x4bd0df;this[_0xe034('0x3')]=_0x426c6b;this[_0xe034('0x4')]=_0x38bd7b;this[_0xe034('0x2')][_0xe034('0x5')](this[_0xe034('0x6')][_0xe034('0x7')](this),this['handleTimeout'][_0xe034('0x7')](this));this[_0xe034('0x2')]['on']('timeout',this[_0xe034('0x8')][_0xe034('0x7')](this));this[_0xe034('0x2')]['on'](_0xe034('0x9'),this[_0xe034('0xa')][_0xe034('0x7')](this));};Beepall[_0xe034('0xb')]['push']=function(){this[_0xe034('0x2')][_0xe034('0x5')](this['handleRun'][_0xe034('0x7')](this),this[_0xe034('0x8')][_0xe034('0x7')](this));};Beepall[_0xe034('0xb')][_0xe034('0xa')]=function(){this[_0xe034('0x8')](!![]);};Beepall[_0xe034('0xb')][_0xe034('0x6')]=function(){var _0x5a60e=!![];if(!_[_0xe034('0xc')](this['queue'])&&!_[_0xe034('0xc')](this[_0xe034('0xd')][_0xe034('0xe')])&&this[_0xe034('0xd')]['Agents']['length']>0x0){for(var _0x1047db=0x0,_0x423d63;_0x1047db0x0){for(var _0x1b0550=0x0,_0x23bf83;_0x1b05500x0&&_0x40416b[_0x393d9f+_0x0263('0x1f')]>=_0x40416b[_0x393d9f+_0x0263('0x20')]){writeLog(_0x167ee2,_0x40416b,_0x393d9f[_0x0263('0x21')]()+_0x0263('0x22'));return![];}}return!![];};exports['showNotification']=function(_0x305018,_0x3ec532,_0x41b743,_0x1a15bc,_0x26e66c){return sendNotification(!![],_0x305018,_0x3ec532,_0x41b743,_0x1a15bc,_0x26e66c);};exports[_0x0263('0x23')]=function(_0x3ef70f,_0x2552d2,_0x1e7296,_0x333184,_0x121f50){return sendNotification(![],_0x3ef70f,_0x2552d2,_0x1e7296,_0x333184,_0x121f50);};exports[_0x0263('0x24')]=function(_0x30d1f0,_0x52a2f5,_0x508cfc){var _0x1c331d=_0x52a2f5[_0x0263('0x25')][_0x0263('0x26')];if(!_0x1c331d&&_0x508cfc){_0x1c331d=_0x508cfc['id'];}var _0x4485a8=_[_0x0263('0x27')](_0x30d1f0[_0x52a2f5[_0x0263('0x28')]+_0x0263('0x29')],function(_0x2033ca){var _0x273d6f=_[_0x0263('0x2a')](_0x52a2f5[_0x0263('0x28')])+_0x0263('0x2b');return _0x2033ca[_0x273d6f]===_0x52a2f5[_0x0263('0x25')]['id'];});if(!_0x4485a8&&_0x1c331d&&_0x30d1f0['agents'][_0x1c331d]){_0x4485a8=_[_0x0263('0x27')](_0x30d1f0[_0x0263('0x2c')][_0x1c331d][_0x52a2f5[_0x0263('0x28')]+'WaitingInteractions'],function(_0x313591){return _0x313591['id']===_0x52a2f5['interaction']['id'];});}return _0x4485a8;};exports['saveWaitingNotification']=function(_0x1a01eb,_0x22f86a,_0x281cf4,_0x22db35){if(_0x281cf4&&_0x281cf4['id']&&_0x1a01eb[_0x0263('0x2c')]&&_0x1a01eb['agents'][_0x281cf4['id']]){_0x1a01eb['agents'][_0x281cf4['id']][_0x22db35+'WaitingInteractions'][_0x22f86a[_0x0263('0x2d')]['id']]={'id':_0x22f86a['interaction']['id']};}};exports[_0x0263('0x2e')]=function(_0x106cee,_0x518aa6,_0x5e8e1c,_0x2d661e){if(_0x5e8e1c&&_0x5e8e1c['id']&&_0x106cee[_0x0263('0x2c')]&&_0x106cee[_0x0263('0x2c')][_0x5e8e1c['id']]){delete _0x106cee[_0x0263('0x2c')][_0x5e8e1c['id']][_0x2d661e+_0x0263('0x2f')][_0x518aa6[_0x0263('0x2d')]['id']];}};exports[_0x0263('0x30')]=writeLog; \ No newline at end of file +var _0x3bb8=['Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','UserId','some','channel','QueuesWaitingInteractions','capitalize','interaction','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','routing','defaults','redis','localhost','split','name','notificationSound','account','body','queue','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','format','message','user:%s','notification:%s','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3bb8,0x173));var _0x83bb=function(_0xc116f3,_0x2e506a){_0xc116f3=_0xc116f3-0x0;var _0x2561ac=_0x3bb8[_0xc116f3];return _0x2561ac;};'use strict';var _=require(_0x83bb('0x0'));var util=require(_0x83bb('0x1'));var utils=require(_0x83bb('0x2'));var Redis=require(_0x83bb('0x3'));var config=require(_0x83bb('0x4'));var logger=require('../../../../../config/logger')(_0x83bb('0x5'));config['redis']=_[_0x83bb('0x6')](config[_0x83bb('0x7')],{'host':_0x83bb('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function sendNotification(_0x353d9b,_0x3bdf48,_0x5df35e,_0x550d1a,_0x3d3fc5,_0x54a1b0){var _0x205d2b=_0x54a1b0||{};var _0xd0a30d=_0x5df35e[_0x83bb('0x9')]('.');var _0x20b5c3={'uniqueid':_0x3bdf48,'channel':_0xd0a30d[0x0],'id':_0xd0a30d[0x1],'title':_0xd0a30d[0x0]+'\x20interaction','interactionId':_0xd0a30d[0x2],'queue':_0x3d3fc5?_0x3d3fc5[_0x83bb('0xa')]:null,'sound':_0x205d2b['account'][_0x83bb('0xb')],'shake':_0x205d2b[_0x83bb('0xc')]['notificationShake']};try{if(!_0x205d2b['body']){_0x205d2b[_0x83bb('0xd')]={};}if(_0x3d3fc5){_0x205d2b[_0x83bb('0xd')]['queue']=_0x3d3fc5;}else if(_0x205d2b['body'][_0x83bb('0xe')]){delete _0x205d2b[_0x83bb('0xd')][_0x83bb('0xe')];}_0x20b5c3['msg']=utils['getMustacheRender'](_0x205d2b[_0x83bb('0xc')][_0x83bb('0xf')],_0x205d2b);}catch(_0x43e71c){_0x20b5c3[_0x83bb('0x10')]=_0x83bb('0x11');logger[_0x83bb('0x12')](util[_0x83bb('0x13')]('[%s][QUEUE]\x20%s',_0x3bdf48,_0x43e71c[_0x83bb('0x14')]));}io['to'](util[_0x83bb('0x13')](_0x83bb('0x15'),_0x550d1a['name']))['emit'](util[_0x83bb('0x13')](_0x83bb('0x16'),_0x353d9b?'save':_0x83bb('0x17')),_0x20b5c3);}function writeLog(_0x17161a,_0x29a2ff,_0x2461a3){return logger[_0x83bb('0x18')](util['format'](_0x83bb('0x19'),_0x17161a,_0x29a2ff[_0x83bb('0xa')],_0x2461a3));}exports['isAgentAvailable']=function(_0x52cadc,_0x26461f,_0x8bd0ef,_0x262eff){if(_0x26461f[_0x83bb('0x1a')]){writeLog(_0x52cadc,_0x26461f,_0x83bb('0x1b'));return![];}if(!_0x26461f[_0x83bb('0x1c')]){writeLog(_0x52cadc,_0x26461f,'OFFLINE');return![];}if(_0x26461f[_0x8bd0ef+_0x83bb('0x1d')]){writeLog(_0x52cadc,_0x26461f,_0x83bb('0x1e'));return![];}if(_0x262eff&&_0x26461f['hasOwnProperty'](_0x8bd0ef+_0x83bb('0x1f'))&&_0x26461f[_0x83bb('0x20')](_0x8bd0ef+'CurrentCapacity')){if(_0x26461f[_0x8bd0ef+'Capacity']>0x0&&_0x26461f[_0x8bd0ef+_0x83bb('0x21')]>=_0x26461f[_0x8bd0ef+'Capacity']){writeLog(_0x52cadc,_0x26461f,_0x8bd0ef[_0x83bb('0x22')]()+_0x83bb('0x23'));return![];}}return!![];};exports[_0x83bb('0x24')]=function(_0x24eef6,_0x29fa80,_0x34efb0,_0x3d8abf,_0x3fc96a){return sendNotification(!![],_0x24eef6,_0x29fa80,_0x34efb0,_0x3d8abf,_0x3fc96a);};exports[_0x83bb('0x25')]=function(_0x39df38,_0x2c35fe,_0x4dab2d,_0x35c257,_0x2c86ee){return sendNotification(![],_0x39df38,_0x2c35fe,_0x4dab2d,_0x35c257,_0x2c86ee);};exports[_0x83bb('0x26')]=function(_0x18d478,_0x33ca19,_0x3ee849){var _0x3f4d43=_0x33ca19['interaction'][_0x83bb('0x27')];if(!_0x3f4d43&&_0x3ee849){_0x3f4d43=_0x3ee849['id'];}var _0x4a9ecf=_[_0x83bb('0x28')](_0x18d478[_0x33ca19[_0x83bb('0x29')]+_0x83bb('0x2a')],function(_0x2f3768){var _0x10cfc5=_[_0x83bb('0x2b')](_0x33ca19[_0x83bb('0x29')])+'InteractionId';return _0x2f3768[_0x10cfc5]===_0x33ca19[_0x83bb('0x2c')]['id'];});if(!_0x4a9ecf&&_0x3f4d43&&_0x18d478[_0x83bb('0x2d')][_0x3f4d43]){_0x4a9ecf=_[_0x83bb('0x28')](_0x18d478[_0x83bb('0x2d')][_0x3f4d43][_0x33ca19[_0x83bb('0x29')]+_0x83bb('0x2e')],function(_0x117fc9){return _0x117fc9['id']===_0x33ca19[_0x83bb('0x2c')]['id'];});}return _0x4a9ecf;};exports[_0x83bb('0x2f')]=function(_0x1fb7f5,_0x30d24a,_0x24085c,_0x234c44){if(_0x24085c&&_0x24085c['id']&&_0x1fb7f5[_0x83bb('0x2d')]&&_0x1fb7f5['agents'][_0x24085c['id']]){_0x1fb7f5[_0x83bb('0x2d')][_0x24085c['id']][_0x234c44+_0x83bb('0x2e')][_0x30d24a[_0x83bb('0x14')]['id']]={'id':_0x30d24a[_0x83bb('0x2c')]['id']};}};exports[_0x83bb('0x30')]=function(_0x84ed71,_0x1cd910,_0x324c2c,_0x30a7b6){if(_0x324c2c&&_0x324c2c['id']&&_0x84ed71[_0x83bb('0x2d')]&&_0x84ed71[_0x83bb('0x2d')][_0x324c2c['id']]){delete _0x84ed71['agents'][_0x324c2c['id']][_0x30a7b6+_0x83bb('0x2e')][_0x1cd910[_0x83bb('0x14')]['id']];}};exports[_0x83bb('0x31')]=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 31c1800..dd636eb 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 _0x8f82=['info','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','error','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','map'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x8f82,0x77));var _0x28f8=function(_0x8dcdd0,_0x4d849e){_0x8dcdd0=_0x8dcdd0-0x0;var _0x2d7ff6=_0x8f82[_0x8dcdd0];return _0x2d7ff6;};'use strict';var schema=require(_0x28f8('0x0'));var sh=require(_0x28f8('0x1'));var _=require(_0x28f8('0x2'));var utils=require(_0x28f8('0x3'));var logger=require(_0x28f8('0x4'))('routing');var system=schema({'command':{'type':_0x28f8('0x5'),'required':!![],'message':_0x28f8('0x6')}});exports[_0x28f8('0x7')]=function(_0x3cee73,_0x25a734){return function(_0x2fe458){try{var _0x3da5a7={'command':_0x25a734[0x0]};var _0x1ff461=system[_0x28f8('0x0')](_0x3da5a7,{'typecast':!![]});if(_0x1ff461[_0x28f8('0x8')]){logger['error'](_0x28f8('0x9'),_0x3cee73,_[_0x28f8('0xa')](_0x1ff461,'message')['join'](',\x20'));logger[_0x28f8('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3cee73);_0x2fe458[_0x28f8('0xc')]();}else{var _0x64707d=this;var _0x294c7b=utils['getMustacheRender'](_0x25a734[0x0],this);logger[_0x28f8('0xb')](_0x28f8('0xd'),_0x3cee73,_0x294c7b);sh[_0x28f8('0xe')](_[_0x28f8('0xf')](_0x294c7b),function(_0x9d37bd,_0x5234bc){logger[_0x28f8('0xb')](_0x28f8('0x10'),_0x3cee73,_0x9d37bd);if(_0x9d37bd==0x0){var _0x469468=_0x5234bc[_0x28f8('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x28f8('0x12')](_0x25a734[0x1])||_[_0x28f8('0x13')](_0x25a734[0x1])){logger[_0x28f8('0xb')](_0x28f8('0x14'),_0x3cee73);_0x64707d['body'][_0x25a734[0x1]]=_0x469468;}else{logger[_0x28f8('0xb')](_0x28f8('0x15'),_0x3cee73,_0x25a734[0x1],_0x469468);_0x64707d[_0x28f8('0x16')][_0x25a734[0x1]]=_0x469468;}}_0x2fe458[_0x28f8('0xc')]();});}}catch(_0x4aab77){logger[_0x28f8('0x17')](_0x28f8('0x9'),_0x3cee73,_[_0x28f8('0x18')](_0x4aab77)?JSON[_0x28f8('0x19')](_0x4aab77):_0x4aab77);logger[_0x28f8('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3cee73);_0x2fe458[_0x28f8('0xc')]();}};}; \ No newline at end of file +var _0x6cf2=['info','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][SYSTEM]\x20%s','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender'];(function(_0x4a01bd,_0x172e88){var _0x2c01e7=function(_0x8e717e){while(--_0x8e717e){_0x4a01bd['push'](_0x4a01bd['shift']());}};_0x2c01e7(++_0x172e88);}(_0x6cf2,0x7c));var _0x26cf=function(_0x289afd,_0x4503ea){_0x289afd=_0x289afd-0x0;var _0x160b43=_0x6cf2[_0x289afd];return _0x160b43;};'use strict';var schema=require('validate');var sh=require(_0x26cf('0x0'));var _=require(_0x26cf('0x1'));var utils=require(_0x26cf('0x2'));var logger=require(_0x26cf('0x3'))(_0x26cf('0x4'));var system=schema({'command':{'type':_0x26cf('0x5'),'required':!![],'message':_0x26cf('0x6')}});exports[_0x26cf('0x7')]=function(_0x54e531,_0x2d8e78){return function(_0x384b91){try{var _0x3b5c2f={'command':_0x2d8e78[0x0]};var _0x2b519b=system[_0x26cf('0x8')](_0x3b5c2f,{'typecast':!![]});if(_0x2b519b[_0x26cf('0x9')]){logger['error'](_0x26cf('0xa'),_0x54e531,_['map'](_0x2b519b,_0x26cf('0xb'))[_0x26cf('0xc')](',\x20'));logger['info'](_0x26cf('0xd'),_0x54e531);_0x384b91[_0x26cf('0xe')]();}else{var _0x3d652e=this;var _0x3e138d=utils[_0x26cf('0xf')](_0x2d8e78[0x0],this);logger[_0x26cf('0x10')](_0x26cf('0x11'),_0x54e531,_0x3e138d);sh[_0x26cf('0x12')](_['trim'](_0x3e138d),function(_0x3fff46,_0x157326){logger[_0x26cf('0x10')](_0x26cf('0x13'),_0x54e531,_0x3fff46);if(_0x3fff46==0x0){var _0xfe0837=_0x157326[_0x26cf('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x26cf('0x15')](_0x2d8e78[0x1])||_['isEmpty'](_0x2d8e78[0x1])){logger[_0x26cf('0x10')](_0x26cf('0x16'),_0x54e531);_0x3d652e[_0x26cf('0x17')][_0x2d8e78[0x1]]=_0xfe0837;}else{logger[_0x26cf('0x10')](_0x26cf('0x18'),_0x54e531,_0x2d8e78[0x1],_0xfe0837);_0x3d652e[_0x26cf('0x17')][_0x2d8e78[0x1]]=_0xfe0837;}}_0x384b91[_0x26cf('0xe')]();});}}catch(_0x3f2e84){logger[_0x26cf('0x19')](_0x26cf('0xa'),_0x54e531,_[_0x26cf('0x1a')](_0x3f2e84)?JSON[_0x26cf('0x1b')](_0x3f2e84):_0x3f2e84);logger[_0x26cf('0x10')](_0x26cf('0xd'),_0x54e531);_0x384b91[_0x26cf('0xe')]();}};}; \ 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 b3a917d..553172a 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 _0x8186=['stringify','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8186,0x1a6));var _0x6818=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0x8186[_0x35c5a8];return _0x34782c;};'use strict';var schema=require(_0x6818('0x0'));var _=require(_0x6818('0x1'));var rpc={'chatInteraction':require(_0x6818('0x2')),'openchannelInteraction':require(_0x6818('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x6818('0x4')),'faxInteraction':require(_0x6818('0x5')),'whatsappInteraction':require(_0x6818('0x6'))};var logger=require(_0x6818('0x7'))(_0x6818('0x8'));var tag=schema({'tag':{'type':_0x6818('0x9'),'required':!![],'message':_0x6818('0xa')}});exports[_0x6818('0xb')]=function(_0x1b6912,_0x2e2d80,_0x163491,_0x54f2f3){return function(_0x11692c){try{var _0x170e45={'tag':_0x2e2d80[0x0]};var _0x33f48c=tag[_0x6818('0x0')](_0x170e45,{'typecast':!![]});if(_0x33f48c[_0x6818('0xc')]){logger[_0x6818('0xd')](_0x6818('0xe'),_0x1b6912,_['map'](_0x33f48c,_0x6818('0xf'))[_0x6818('0x10')](',\x20'));logger[_0x6818('0x11')](_0x6818('0x12'),_0x1b6912);_0x11692c[_0x6818('0x13')]();}else{var _0x4aae01={'ids':[_0x2e2d80[0x0]]};if(rpc[_0x54f2f3['channel']+_0x6818('0x14')]){rpc[_0x54f2f3[_0x6818('0x15')]+_0x6818('0x14')][_0x6818('0x16')](_0x54f2f3[_0x6818('0x17')]['id'],_0x4aae01)[_0x6818('0x18')](function(_0xfefa07){logger['info'](_0x6818('0x19'),_0x1b6912,_0x2e2d80[0x1],_0x54f2f3[_0x6818('0x15')],_0x54f2f3['interaction']['id']);})['catch'](function(_0x26be78){logger[_0x6818('0xd')](_0x6818('0xe'),_0x1b6912,JSON[_0x6818('0x1a')](_0x26be78));logger[_0x6818('0x11')](_0x6818('0x12'),_0x1b6912);})['finally'](function(){_0x11692c['next']();});}}}catch(_0x21a44e){logger[_0x6818('0xd')](_0x6818('0xe'),_0x1b6912,_[_0x6818('0x1b')](_0x21a44e)?JSON[_0x6818('0x1a')](_0x21a44e):_0x21a44e);logger[_0x6818('0x11')](_0x6818('0x12'),_0x1b6912);_0x11692c[_0x6818('0x13')]();}};}; \ No newline at end of file +var _0x9912=['stringify','finally','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','join','info','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch'];(function(_0x2460d9,_0x15da87){var _0x4bc204=function(_0x40bbce){while(--_0x40bbce){_0x2460d9['push'](_0x2460d9['shift']());}};_0x4bc204(++_0x15da87);}(_0x9912,0x8f));var _0x2991=function(_0x338f1d,_0x7fd33e){_0x338f1d=_0x338f1d-0x0;var _0x268ac0=_0x9912[_0x338f1d];return _0x268ac0;};'use strict';var schema=require(_0x2991('0x0'));var _=require(_0x2991('0x1'));var rpc={'chatInteraction':require(_0x2991('0x2')),'openchannelInteraction':require(_0x2991('0x3')),'smsInteraction':require(_0x2991('0x4')),'mailInteraction':require(_0x2991('0x5')),'faxInteraction':require(_0x2991('0x6')),'whatsappInteraction':require(_0x2991('0x7'))};var logger=require('../../../../config/logger')(_0x2991('0x8'));var tag=schema({'tag':{'type':_0x2991('0x9'),'required':!![],'message':_0x2991('0xa')}});exports[_0x2991('0xb')]=function(_0x5ce197,_0x4dea4b,_0xf1c560,_0x49493a){return function(_0x54cc04){try{var _0x3cd144={'tag':_0x4dea4b[0x0]};var _0x29b3c8=tag['validate'](_0x3cd144,{'typecast':!![]});if(_0x29b3c8['length']){logger[_0x2991('0xc')](_0x2991('0xd'),_0x5ce197,_[_0x2991('0xe')](_0x29b3c8,'message')[_0x2991('0xf')](',\x20'));logger[_0x2991('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5ce197);_0x54cc04[_0x2991('0x11')]();}else{var _0x3ec161={'ids':[_0x4dea4b[0x0]]};if(rpc[_0x49493a[_0x2991('0x12')]+_0x2991('0x13')]){rpc[_0x49493a[_0x2991('0x12')]+_0x2991('0x13')][_0x2991('0x14')](_0x49493a[_0x2991('0x15')]['id'],_0x3ec161)[_0x2991('0x16')](function(_0x490596){logger[_0x2991('0x10')](_0x2991('0x17'),_0x5ce197,_0x4dea4b[0x1],_0x49493a[_0x2991('0x12')],_0x49493a[_0x2991('0x15')]['id']);})[_0x2991('0x18')](function(_0x31f2c5){logger['error']('[%s][TAG]\x20%s',_0x5ce197,JSON[_0x2991('0x19')](_0x31f2c5));logger[_0x2991('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5ce197);})[_0x2991('0x1a')](function(){_0x54cc04['next']();});}}}catch(_0x42f8d7){logger[_0x2991('0xc')](_0x2991('0xd'),_0x5ce197,_['isObject'](_0x42f8d7)?JSON[_0x2991('0x19')](_0x42f8d7):_0x42f8d7);logger[_0x2991('0x10')](_0x2991('0x1b'),_0x5ce197);_0x54cc04[_0x2991('0x11')]();}};}; \ 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 cde014e..ba07f0e 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 _0xa140=['routing','lodash','\x20-\x20','includes','push','urlOnAnswer','urlOnRing','?params=','2.0','method','login','params','utf8','application/json-rpc','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','&data=','stringify','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next'];(function(_0x215797,_0x49d505){var _0x4a3697=function(_0x23a93a){while(--_0x23a93a){_0x215797['push'](_0x215797['shift']());}};_0x4a3697(++_0x49d505);}(_0xa140,0xd2));var _0x0a14=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xa140[_0x13ce0c];return _0x4388fb;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')(_0x0a14('0x0'));var _=require(_0x0a14('0x1'));var arr=[];exports['consequence']=function(_0xfc94b,_0x31f239){return function(_0x31e334){var _0x11bcf0=_0x31f239[0xa];var _0x18c58a=_0x31f239[0xb];var _0x14c2f5=_0x31f239[0xc];var _0x25f968=_0x31f239[0xd];var _0x506f77=_0x31f239[0xe];var _0x4b478f=_0x31f239[0xf]['replace'](/\n/g,_0x0a14('0x2'));var _0x59db19=_0x31f239[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x0a14('0x3')](_0x18c58a)){arr[_0x0a14('0x4')](_0x18c58a);var _0x575faf=_0x31f239[0x3];var _0xd71208=_0x31f239[0x4];var _0x4b43b4=_0x31f239[0x1];var _0x5c28bb=_0x31f239[0x0];var _0x443b05={};_0x443b05[_0x0a14('0x5')]=_0x31f239[0x8]+'?params='+_0x14c2f5+'|'+_0x11bcf0+'|'+_0x25f968+'|'+_0x18c58a+'|'+_0x506f77;_0x443b05[_0x0a14('0x6')]=_0x31f239[0x7]+_0x0a14('0x7')+_0x14c2f5+'|'+_0x11bcf0+'|'+_0x25f968+'|'+_0x18c58a+'|'+_0x506f77+'|'+_0x4b478f+'|'+_0x59db19;_0x443b05['title']=_0x31f239[0x9];var _0x400a04={};_0x400a04['jsonrpc']=_0x0a14('0x8');_0x400a04[_0x0a14('0x9')]=_0x0a14('0xa');var _0x25f543=[];_0x25f543['push'](_0x31f239[0x2]);_0x25f543[_0x0a14('0x4')](_0x31f239[0x5]);_0x25f543[_0x0a14('0x4')](_0x31f239[0x6]);_0x400a04[_0x0a14('0xb')]=_0x25f543;_0x400a04['id']=0x1;var _0x4b9448=JSON['stringify'](_0x400a04);var _0x4448e6={'encoding':_0x0a14('0xc'),'method':'POST','timeout':0x2710,'url':_0x575faf,'headers':{'Content-Type':_0x0a14('0xd')},'body':_0x4b9448};return rp(_0x4448e6)['then'](function(_0x3b8a00){const _0x8c1ef5=JSON[_0x0a14('0xe')](_0x3b8a00);if(!_0x8c1ef5[_0x0a14('0xf')][_0x0a14('0x10')]){throw new Error(_0x0a14('0x11'));}var _0xeb369c=_0x18c58a;var _0x48a774='channelId='+_0x4b43b4+_0x0a14('0x12')+_0x5c28bb+_0x0a14('0x13')+_0xeb369c+_0x0a14('0x14')+JSON[_0x0a14('0x15')](_0x443b05);var _0x3fdea5=_0xd71208+'?'+_0x48a774;return rp(_0x3fdea5);})[_0x0a14('0x16')](function(_0x3a277b){logger[_0x0a14('0x17')](_0x0a14('0x18'),_0xfc94b,_0x3a277b);_0x31e334[_0x0a14('0x19')]();})[_0x0a14('0x1a')](function(_0x1f3eaa){logger['error'](_0x0a14('0x1b'),_0xfc94b,_[_0x0a14('0x1c')](_0x1f3eaa)?JSON['stringify'](_0x1f3eaa):_0x1f3eaa);_0x31e334['stop']();});}else{logger['info'](_0x0a14('0x1d'),_0xfc94b);_0x31e334['next']();}};}; \ No newline at end of file +var _0xe223=['title','jsonrpc','method','login','params','stringify','utf8','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing'];(function(_0x2f0c11,_0x46aa9e){var _0xe984ed=function(_0x54d71f){while(--_0x54d71f){_0x2f0c11['push'](_0x2f0c11['shift']());}};_0xe984ed(++_0x46aa9e);}(_0xe223,0x16b));var _0x3e22=function(_0x3165ab,_0x49ab2b){_0x3165ab=_0x3165ab-0x0;var _0x1b49d4=_0xe223[_0x3165ab];return _0x1b49d4;};'use strict';var rp=require('request-promise');var logger=require(_0x3e22('0x0'))(_0x3e22('0x1'));var _=require(_0x3e22('0x2'));var arr=[];exports[_0x3e22('0x3')]=function(_0xc34bf5,_0x1c8c1b){return function(_0x7505fb){var _0x5bbcbc=_0x1c8c1b[0xa];var _0x17038c=_0x1c8c1b[0xb];var _0xfe28bc=_0x1c8c1b[0xc];var _0x3c3732=_0x1c8c1b[0xd];var _0x2886c6=_0x1c8c1b[0xe];var _0x1cf672=_0x1c8c1b[0xf][_0x3e22('0x4')](/\n/g,_0x3e22('0x5'));var _0x31fb8c=_0x1c8c1b[0x10][_0x3e22('0x4')](/\n/g,'\x20');if(!arr[_0x3e22('0x6')](_0x17038c)){arr[_0x3e22('0x7')](_0x17038c);var _0x4f2e13=_0x1c8c1b[0x3];var _0x2c325f=_0x1c8c1b[0x4];var _0x5bcf6f=_0x1c8c1b[0x1];var _0x14777d=_0x1c8c1b[0x0];var _0x1b8383={};_0x1b8383[_0x3e22('0x8')]=_0x1c8c1b[0x8]+_0x3e22('0x9')+_0xfe28bc+'|'+_0x5bbcbc+'|'+_0x3c3732+'|'+_0x17038c+'|'+_0x2886c6;_0x1b8383[_0x3e22('0xa')]=_0x1c8c1b[0x7]+_0x3e22('0x9')+_0xfe28bc+'|'+_0x5bbcbc+'|'+_0x3c3732+'|'+_0x17038c+'|'+_0x2886c6+'|'+_0x1cf672+'|'+_0x31fb8c;_0x1b8383[_0x3e22('0xb')]=_0x1c8c1b[0x9];var _0x31d4af={};_0x31d4af[_0x3e22('0xc')]='2.0';_0x31d4af[_0x3e22('0xd')]=_0x3e22('0xe');var _0x1bc8e9=[];_0x1bc8e9[_0x3e22('0x7')](_0x1c8c1b[0x2]);_0x1bc8e9[_0x3e22('0x7')](_0x1c8c1b[0x5]);_0x1bc8e9['push'](_0x1c8c1b[0x6]);_0x31d4af[_0x3e22('0xf')]=_0x1bc8e9;_0x31d4af['id']=0x1;var _0x45313f=JSON[_0x3e22('0x10')](_0x31d4af);var _0x5a1240={'encoding':_0x3e22('0x11'),'method':'POST','timeout':0x2710,'url':_0x4f2e13,'headers':{'Content-Type':'application/json-rpc'},'body':_0x45313f};return rp(_0x5a1240)[_0x3e22('0x12')](function(_0x2d0280){const _0x4f15e8=JSON[_0x3e22('0x13')](_0x2d0280);if(!_0x4f15e8[_0x3e22('0x14')][_0x3e22('0x15')]){throw new Error(_0x3e22('0x16'));}var _0x128e39=_0x17038c;var _0x52a133=_0x3e22('0x17')+_0x5bcf6f+'&serviceId='+_0x14777d+_0x3e22('0x18')+_0x128e39+_0x3e22('0x19')+JSON[_0x3e22('0x10')](_0x1b8383);var _0x11b6a1=_0x2c325f+'?'+_0x52a133;return rp(_0x11b6a1);})[_0x3e22('0x12')](function(_0x23126c){logger[_0x3e22('0x1a')](_0x3e22('0x1b'),_0xc34bf5,_0x23126c);_0x7505fb[_0x3e22('0x1c')]();})[_0x3e22('0x1d')](function(_0x39f0af){logger[_0x3e22('0x1e')](_0x3e22('0x1f'),_0xc34bf5,_['isObject'](_0x39f0af)?JSON['stringify'](_0x39f0af):_0x39f0af);_0x7505fb[_0x3e22('0x1c')]();});}else{logger['info'](_0x3e22('0x20'),_0xc34bf5);_0x7505fb[_0x3e22('0x21')]();}};}; \ 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 8a01143..8483a36 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(_0x465c38,_0x1369f4){var _0xc894d=function(_0x37c5bb){while(--_0x37c5bb){_0x465c38['push'](_0x465c38['shift']());}};_0xc894d(++_0x1369f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x212d03,_0xf6fbc6){var _0x32070f=function(_0x1f2a25){while(--_0x1f2a25){_0x212d03['push'](_0x212d03['shift']());}};_0x32070f(++_0xf6fbc6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index f4d61df..68dae45 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 _0xc022=['smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','stringify','127.0.0.1','log','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/mailQueueReport','../rpc/faxQueueReport','format','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','.js','app','toLowerCase','mail','push','slice','dialogflow','appdata','dialogflowv2','split','amazonlex','getMustacheRender','notificationTemplate','body','./interval','condition','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','execute','Applications\x20executed','matchPath','emit','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues'];(function(_0x482bea,_0xb6c790){var _0x25f4f4=function(_0x272df8){while(--_0x272df8){_0x482bea['push'](_0x482bea['shift']());}};_0x25f4f4(++_0xb6c790);}(_0xc022,0x173));var _0x2c02=function(_0x397c86,_0x24edb8){_0x397c86=_0x397c86-0x0;var _0x5c40c5=_0xc022[_0x397c86];return _0x5c40c5;};'use strict';var _=require('lodash');var util=require(_0x2c02('0x0'));var path=require(_0x2c02('0x1'));var fs=require('fs');var jayson=require(_0x2c02('0x2'));var BPromise=require(_0x2c02('0x3'));var utils=require(_0x2c02('0x4'));var sUtils=require(_0x2c02('0x5'));var logger=require('../../../config/logger')(_0x2c02('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x2c02('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x2c02('0x8')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x305ca6,_0x22014c,_0x3a914e){return util[_0x2c02('0x9')]('%s.%s.%s',_0x305ca6,_0x22014c||0x0,_0x3a914e||0x0);}function getIntervals(_0x82145e,_0x316c63){var _0xd522c7=[];if(!_[_0x2c02('0xa')](_0x316c63['IntervalId'])&&!_[_0x2c02('0xa')](_0x82145e[_0x316c63['IntervalId']])&&!_['isNil'](_0x82145e[_0x316c63[_0x2c02('0xb')]][_0x2c02('0xc')])){_0xd522c7=_['map'](_0x82145e[_0x316c63[_0x2c02('0xb')]][_0x2c02('0xc')],_0x2c02('0xd'));}else if(!_[_0x2c02('0xa')](_0x316c63[_0x2c02('0xd')])){_0xd522c7=[_0x316c63[_0x2c02('0xd')]];}return _0xd522c7;}exports[_0x2c02('0xe')]=function(_0x4f4e33){_0x4f4e33[_0x2c02('0xf')]={};return new BPromise(function(_0x29f647,_0x26c1fa){var _0x3e86b3={'Start':function(_0x1bd1d9){var _0x57854f=this;return new Promise(function(_0x9e8ae6,_0x15d347){if(_0x1bd1d9){try{var _0x770f2e=[];var _0x2cd047=getId(_0x1bd1d9[_0x2c02('0x10')],_0x1bd1d9[_0x2c02('0x11')]?_0x1bd1d9['message']['id']:0x0,_0x1bd1d9[_0x2c02('0x12')]?_0x1bd1d9['interaction']['id']:0x0);var _0x840b9b=sUtils[_0x2c02('0x13')](_0x4f4e33,_0x1bd1d9);if(_0x1bd1d9['transfer']||!_0x840b9b&&_0x1bd1d9[_0x2c02('0x14')]&&_[_0x2c02('0x15')](_0x1bd1d9[_0x2c02('0x14')])&&_0x1bd1d9[_0x2c02('0x14')][_0x2c02('0x16')]){for(var _0x4f2f50=0x0;_0x4f2f50<_0x1bd1d9[_0x2c02('0x14')]['length'];_0x4f2f50+=0x1){var _0x220138=_0x1bd1d9[_0x2c02('0x14')][_0x4f2f50];if(fs[_0x2c02('0x17')](path[_0x2c02('0x18')](__dirname,_0x2c02('0x14'),_0x220138['app']+_0x2c02('0x19')))){var _0x3adf3e=[];switch(_0x220138[_0x2c02('0x1a')][_0x2c02('0x1b')]()){case'autoreply':var _0x4eb454=_0x220138['appdata']['split'](',');if(_0x1bd1d9['channel']===_0x2c02('0x1c')){_0x3adf3e['push'](_0x4eb454[0x0]);_0x3adf3e[_0x2c02('0x1d')](_0x4eb454[0x1]);_0x3adf3e[_0x2c02('0x1d')](_0x4eb454[_0x2c02('0x1e')](0x2,_0x4eb454[_0x2c02('0x16')])[_0x2c02('0x18')](','));}else{_0x3adf3e['push'](_0x4eb454[0x0]);_0x3adf3e[_0x2c02('0x1d')](_0x4eb454['slice'](0x1,_0x4eb454[_0x2c02('0x16')])[_0x2c02('0x18')](','));}break;case _0x2c02('0x1f'):var _0x47dc8f=_0x220138[_0x2c02('0x20')]['split'](',');_0x3adf3e[_0x2c02('0x1d')](_0x47dc8f[0x0]);_0x3adf3e['push'](_0x47dc8f[0x1]);_0x3adf3e[_0x2c02('0x1d')](_0x47dc8f[_0x2c02('0x1e')](0x2,_0x47dc8f['length'])[_0x2c02('0x18')](','));break;case _0x2c02('0x21'):var _0xd8cdd3=_0x220138[_0x2c02('0x20')][_0x2c02('0x22')](',');_0x3adf3e[_0x2c02('0x1d')](_0xd8cdd3[0x0]);_0x3adf3e[_0x2c02('0x1d')](_0xd8cdd3[0x1]);_0x3adf3e[_0x2c02('0x1d')](_0xd8cdd3[0x2]);_0x3adf3e[_0x2c02('0x1d')](_0xd8cdd3[0x3]);_0x3adf3e[_0x2c02('0x1d')](_0xd8cdd3['slice'](0x4,_0xd8cdd3[_0x2c02('0x16')])['join'](','));break;case _0x2c02('0x23'):var _0x124101=_0x220138[_0x2c02('0x20')][_0x2c02('0x22')](',');_0x3adf3e[_0x2c02('0x1d')](_0x124101[0x0]);_0x3adf3e[_0x2c02('0x1d')](_0x124101[0x1]);_0x3adf3e[_0x2c02('0x1d')](_0x124101[0x2]);_0x3adf3e['push'](_0x124101[0x3]);_0x3adf3e['push'](_0x124101[_0x2c02('0x1e')](0x4,_0x124101[_0x2c02('0x16')])[_0x2c02('0x18')](','));break;case _0x2c02('0x11'):_0x3adf3e[_0x2c02('0x1d')](_0x220138[_0x2c02('0x20')]);break;case'tag':_0x3adf3e[_0x2c02('0x1d')](_0x220138['TagId']);_0x3adf3e[_0x2c02('0x1d')](_0x220138[_0x2c02('0x20')]);break;case'tvox':var _0x80665d=utils[_0x2c02('0x24')](_0x1bd1d9['account'][_0x2c02('0x25')],_0x1bd1d9);var _0x5d1a07=_0x220138[_0x2c02('0x20')][_0x2c02('0x22')](',');_0x3adf3e[_0x2c02('0x1d')](_0x5d1a07[0x0]);_0x3adf3e[_0x2c02('0x1d')](_0x5d1a07[0x1]);_0x3adf3e[_0x2c02('0x1d')](_0x5d1a07[0x2]);_0x3adf3e[_0x2c02('0x1d')](_0x5d1a07[0x3]);_0x3adf3e[_0x2c02('0x1d')](_0x5d1a07[0x4]);_0x3adf3e['push'](_0x5d1a07[0x5]);_0x3adf3e[_0x2c02('0x1d')](_0x5d1a07[0x6]);_0x3adf3e[_0x2c02('0x1d')](_0x5d1a07[0x7]);_0x3adf3e['push'](_0x5d1a07[0x8]);_0x3adf3e[_0x2c02('0x1d')](_0x5d1a07[0x9]);_0x3adf3e['push'](_0x5d1a07[0xa]);_0x3adf3e[_0x2c02('0x1d')](_0x1bd1d9[_0x2c02('0x12')]['id']);_0x3adf3e[_0x2c02('0x1d')](_0x1bd1d9['message']['id']);_0x3adf3e[_0x2c02('0x1d')](_0x220138['ChatWebsiteId']);_0x3adf3e[_0x2c02('0x1d')](_0x1bd1d9[_0x2c02('0x12')]['ContactId']);_0x3adf3e[_0x2c02('0x1d')](_0x1bd1d9[_0x2c02('0x26')][_0x2c02('0x26')]);_0x3adf3e[_0x2c02('0x1d')](_0x80665d);break;default:_0x3adf3e=_['isNil'](_0x220138[_0x2c02('0x20')])?[]:_0x220138[_0x2c02('0x20')][_0x2c02('0x22')](',');}var _0x197c12={'id':util[_0x2c02('0x9')]('%s:%s:%s',_0x2cd047,_0x220138['id'],_0x220138[_0x2c02('0x1a')]),'condition':require(_0x2c02('0x27'))[_0x2c02('0x28')](_0x2cd047,getIntervals(_0x4f4e33['intervals'],_0x220138),_0x4f4e33),'consequence':require(_0x2c02('0x29')+_0x220138[_0x2c02('0x1a')])[_0x2c02('0x2a')](_0x2cd047,_0x3adf3e,_0x4f4e33,_0x1bd1d9),'p':_0x220138['priority']||0x0};logger[_0x2c02('0x2b')](_0x2c02('0x2c'),_0x197c12['id'],_0x2c02('0x2d'),getIntervals(_0x4f4e33[_0x2c02('0x2e')],_0x220138)[_0x2c02('0x18')](_0x2c02('0x2f')));_0x770f2e[_0x2c02('0x1d')](_0x197c12);}else{logger[_0x2c02('0x30')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x220138['app']+_0x2c02('0x19')));}}_0x4f4e33[_0x2c02('0xf')][_0x2cd047]=new RuleEngine(_0x770f2e);_0x4f4e33[_0x2c02('0xf')][_0x2cd047][_0x2c02('0x31')](_0x1bd1d9,function(_0x497963){logger[_0x2c02('0x2b')](_0x2c02('0x32'),JSON['stringify'](_0x497963[_0x2c02('0x33')]));if(_0x4f4e33[_0x2c02('0xf')][_0x2cd047]){_0x4f4e33[_0x2c02('0xf')][_0x2cd047][_0x2c02('0x34')]('complete');}});return _0x9e8ae6({'code':0xc8,'message':_0x1bd1d9});}else{if(_0x840b9b){logger[_0x2c02('0x2b')](util[_0x2c02('0x9')]('Skipped\x20routing\x20for\x20%s',_0x2cd047));}else{logger[_0x2c02('0x2b')](_0x2c02('0x35'));}return _0x9e8ae6({'code':0xc8,'message':_0x1bd1d9});}}catch(_0x570850){logger[_0x2c02('0x30')](_0x570850['stack']);return _0x15d347(_0x57854f[_0x2c02('0x30')](0x1f4,_0x570850));}}return _0x15d347(_0x2c02('0x36'));});},'AcceptMessage':function(_0x1b4266){var _0x35b953=this;return new Promise(function(_0x22b4c8,_0x27753e){if(_0x1b4266[_0x2c02('0x37')]&&_0x1b4266['agent']['id']){if(_0x4f4e33['agents'][_0x1b4266[_0x2c02('0x37')]['id']]){_0x4f4e33[_0x2c02('0x38')][_0x1b4266[_0x2c02('0x37')]['id']][_0x2c02('0x39')]=![];_0x4f4e33['agents'][_0x1b4266[_0x2c02('0x37')]['id']]['busyQueue']=undefined;}}if(_0x1b4266[_0x2c02('0x11')]&&_0x1b4266['message']['id']){try{var _0xecb41d=getId(_0x1b4266[_0x2c02('0x10')],_0x1b4266['message']?_0x1b4266[_0x2c02('0x11')]['id']:0x0,_0x1b4266['interaction']?_0x1b4266[_0x2c02('0x12')]['id']:0x0);if(_0x4f4e33[_0x2c02('0xf')][_0xecb41d]){_0x4f4e33[_0x2c02('0xf')][_0xecb41d][_0x2c02('0x34')](_0x2c02('0x3a'));if(rpc[_0x1b4266[_0x2c02('0x10')]+_0x2c02('0x3b')]){rpc[_0x1b4266[_0x2c02('0x10')]+_0x2c02('0x3b')]['update'](_0xecb41d,{'UserId':_0x1b4266[_0x2c02('0x11')]['UserId']})[_0x2c02('0x3c')](function(){logger[_0x2c02('0x30')](_0x2c02('0x3d'));});}}return _0x22b4c8({'code':0xc8,'message':_0x1b4266});}catch(_0x55a903){logger[_0x2c02('0x30')](_0x55a903[_0x2c02('0x3e')]);return _0x27753e(_0x35b953[_0x2c02('0x30')](0x1f4,_0x55a903));}}logger[_0x2c02('0x30')](_0x2c02('0x3f'));return _0x27753e(_0x35b953['error'](0x1f4,_0x2c02('0x3f')));});},'RejectMessage':function(_0x825df){var _0x395d00=this;return new Promise(function(_0x2ffccc,_0x5d862d){if(_0x825df[_0x2c02('0x37')]&&_0x825df[_0x2c02('0x37')]['id']){try{if(_0x4f4e33[_0x2c02('0x38')][_0x825df[_0x2c02('0x37')]['id']]){_0x4f4e33[_0x2c02('0x38')][_0x825df[_0x2c02('0x37')]['id']]['busy']=![];_0x4f4e33[_0x2c02('0x38')][_0x825df[_0x2c02('0x37')]['id']]['busyQueue']=undefined;}return _0x2ffccc({'code':0xc8,'message':_0x825df});}catch(_0x3adc97){logger[_0x2c02('0x30')](_0x3adc97['stack']);return _0x5d862d(_0x395d00[_0x2c02('0x30')](0x1f4,_0x3adc97));}}logger[_0x2c02('0x30')](_0x2c02('0x3f'));return _0x5d862d(_0x395d00['error'](0x1f4,_0x2c02('0x3f')));});},'AbandonInteraction':function(_0x2690c9){var _0x4a4b7a=this;return new Promise(function(_0x15a1c7,_0x176e36){if(_0x2690c9[_0x2c02('0x10')]&&_0x2690c9[_0x2c02('0x12')]&&_0x2690c9[_0x2c02('0x12')]['id']){try{var _0xb11a4=getId(_0x2690c9['channel'],_0x2690c9[_0x2c02('0x11')]?_0x2690c9[_0x2c02('0x11')]['id']:0x0,_0x2690c9['interaction']?_0x2690c9[_0x2c02('0x12')]['id']:0x0);if(_0x4f4e33[_0x2c02('0xf')][_0xb11a4]){_0x4f4e33['rules'][_0xb11a4]['emit'](_0x2c02('0x3a'));}return _0x15a1c7({'code':0xc8,'message':_0x2690c9});}catch(_0x2d39a6){logger['error'](_0x2d39a6[_0x2c02('0x3e')]);return _0x176e36(_0x4a4b7a[_0x2c02('0x30')](0x1f4,_0x2d39a6));}}logger[_0x2c02('0x30')](_0x2c02('0x3f'));return _0x176e36(_0x4a4b7a[_0x2c02('0x30')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x358df2){var _0x44fcae=this;return new Promise(function(_0x447a14,_0xa72222){if(_0x4f4e33[_0x2c02('0x38')][_0x2c02('0x40')](_0x358df2['id'])){for(var _0x3f613b in _0x358df2['capacity']){if(_0x358df2[_0x2c02('0x41')][_0x2c02('0x40')](_0x3f613b)){if(_0x4f4e33[_0x2c02('0x38')][_0x358df2['id']]['hasOwnProperty'](_0x3f613b+_0x2c02('0x42'))){_0x4f4e33[_0x2c02('0x38')][_0x358df2['id']][_0x3f613b+_0x2c02('0x42')]=parseInt(_0x358df2[_0x2c02('0x41')][_0x3f613b],0xa);}}}_0x4f4e33[_0x2c02('0x38')][_0x358df2['id']][_0x2c02('0x43')]();return _0x447a14({'code':0xc8,'message':_0x4f4e33['agents'][_0x358df2['id']]});}else{return _0xa72222(_0x44fcae[_0x2c02('0x30')](0x1f4,_0x2c02('0x44')));}});},'Agents':function(_0x38af9f){return new Promise(function(_0x3fbd50){var _0x311e35=_[_0x2c02('0x45')](_0x4f4e33['agents']);if(_0x38af9f&&_0x38af9f['id']){var _0x291d78=_[_0x2c02('0x46')](_0x311e35,function(_0x118586){return _0x118586['id']===_0x38af9f['id'];});_0x3fbd50(_0x291d78);}else{_0x3fbd50({'count':_0x311e35[_0x2c02('0x16')],'rows':_0x311e35});}});},'ChatQueues':function(){return new Promise(function(_0x5c04b5){var _0x379051=[];for(var _0x24056a in _0x4f4e33[_0x2c02('0x47')]){if(_0x4f4e33[_0x2c02('0x47')]['hasOwnProperty'](_0x24056a)){var _0x5e0e08=_0x4f4e33[_0x2c02('0x47')][_0x24056a];var _0x2ecd13={'id':_0x5e0e08['id'],'available':_0x5e0e08['available'],'loggedIn':_0x5e0e08[_0x2c02('0x48')],'name':_0x5e0e08[_0x2c02('0x49')],'paused':_0x5e0e08[_0x2c02('0x4a')],'waiting':_0x5e0e08[_0x2c02('0x4b')]};_0x379051[_0x2c02('0x1d')](_0x2ecd13);}}_0x5c04b5({'count':_0x379051[_0x2c02('0x16')],'rows':_0x379051});});},'MailQueues':function(){return new Promise(function(_0x34f46e){var _0x5d118d=[];for(var _0x3955ba in _0x4f4e33[_0x2c02('0x4c')]){if(_0x4f4e33[_0x2c02('0x4c')][_0x2c02('0x40')](_0x3955ba)){var _0x4436fd=_0x4f4e33['mailQueues'][_0x3955ba];var _0x26fe2a={'id':_0x4436fd['id'],'available':_0x4436fd[_0x2c02('0x4d')],'loggedIn':_0x4436fd[_0x2c02('0x48')],'name':_0x4436fd[_0x2c02('0x49')],'paused':_0x4436fd[_0x2c02('0x4a')],'waiting':_0x4436fd[_0x2c02('0x4b')]};_0x5d118d['push'](_0x26fe2a);}}_0x34f46e({'count':_0x5d118d['length'],'rows':_0x5d118d});});},'OpenchannelQueues':function(){return new Promise(function(_0x40a015){var _0x301f98=[];for(var _0x52d424 in _0x4f4e33[_0x2c02('0x4e')]){if(_0x4f4e33[_0x2c02('0x4e')][_0x2c02('0x40')](_0x52d424)){var _0x85e915=_0x4f4e33['openchannelQueues'][_0x52d424];var _0x3e0153={'id':_0x85e915['id'],'available':_0x85e915[_0x2c02('0x4d')],'loggedIn':_0x85e915['loggedIn'],'name':_0x85e915[_0x2c02('0x49')],'paused':_0x85e915[_0x2c02('0x4a')],'waiting':_0x85e915[_0x2c02('0x4b')]};_0x301f98[_0x2c02('0x1d')](_0x3e0153);}}_0x40a015({'count':_0x301f98[_0x2c02('0x16')],'rows':_0x301f98});});},'SmsQueues':function(){return new Promise(function(_0x2b9f43){var _0x2eef80=[];for(var _0x3c19ca in _0x4f4e33['smsQueues']){if(_0x4f4e33[_0x2c02('0x4f')][_0x2c02('0x40')](_0x3c19ca)){var _0x1e3918=_0x4f4e33['smsQueues'][_0x3c19ca];var _0x518e7f={'id':_0x1e3918['id'],'available':_0x1e3918[_0x2c02('0x4d')],'loggedIn':_0x1e3918[_0x2c02('0x48')],'name':_0x1e3918['name'],'paused':_0x1e3918[_0x2c02('0x4a')],'waiting':_0x1e3918[_0x2c02('0x4b')]};_0x2eef80[_0x2c02('0x1d')](_0x518e7f);}}_0x2b9f43({'count':_0x2eef80[_0x2c02('0x16')],'rows':_0x2eef80});});},'FaxQueues':function(){return new Promise(function(_0x313c33){var _0x282b1e=[];for(var _0x2897ea in _0x4f4e33[_0x2c02('0x50')]){if(_0x4f4e33[_0x2c02('0x50')]['hasOwnProperty'](_0x2897ea)){var _0x44d10a=_0x4f4e33['faxQueues'][_0x2897ea];var _0x91d3e0={'id':_0x44d10a['id'],'available':_0x44d10a[_0x2c02('0x4d')],'loggedIn':_0x44d10a[_0x2c02('0x48')],'name':_0x44d10a[_0x2c02('0x49')],'paused':_0x44d10a[_0x2c02('0x4a')],'waiting':_0x44d10a[_0x2c02('0x4b')]};_0x282b1e['push'](_0x91d3e0);}}_0x313c33({'count':_0x282b1e[_0x2c02('0x16')],'rows':_0x282b1e});});},'WhatsappQueues':function(){return new Promise(function(_0x56417b){var _0x392fa8=[];for(var _0x2d0f51 in _0x4f4e33[_0x2c02('0x51')]){if(_0x4f4e33['whatsappQueues'][_0x2c02('0x40')](_0x2d0f51)){var _0x102763=_0x4f4e33[_0x2c02('0x51')][_0x2d0f51];var _0x51d754={'id':_0x102763['id'],'available':_0x102763[_0x2c02('0x4d')],'loggedIn':_0x102763['loggedIn'],'name':_0x102763[_0x2c02('0x49')],'paused':_0x102763['paused'],'waiting':_0x102763['waiting']};_0x392fa8[_0x2c02('0x1d')](_0x51d754);}}_0x56417b({'count':_0x392fa8[_0x2c02('0x16')],'rows':_0x392fa8});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x395740){var _0x3007af=_[_0x2c02('0x45')](_0x4f4e33[_0x2c02('0x52')]);_0x395740({'count':_0x3007af[_0x2c02('0x16')],'rows':_0x3007af});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x48bcaa){var _0xecdeb1=_[_0x2c02('0x45')](_0x4f4e33[_0x2c02('0x53')]);_0x48bcaa({'count':_0xecdeb1[_0x2c02('0x16')],'rows':_0xecdeb1});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x54c40b){var _0x43c7a9=_['values'](_0x4f4e33['openchannelQueuesWaitingInteractions']);_0x54c40b({'count':_0x43c7a9[_0x2c02('0x16')],'rows':_0x43c7a9});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x361f4c){var _0x4f2b50=_['values'](_0x4f4e33['smsQueuesWaitingInteractions']);_0x361f4c({'count':_0x4f2b50[_0x2c02('0x16')],'rows':_0x4f2b50});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x39b6d7){var _0x295799=_['values'](_0x4f4e33[_0x2c02('0x54')]);_0x39b6d7({'count':_0x295799[_0x2c02('0x16')],'rows':_0x295799});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x15c6f7){var _0x400008=_[_0x2c02('0x45')](_0x4f4e33['whatsappQueuesWaitingInteractions']);_0x15c6f7({'count':_0x400008[_0x2c02('0x16')],'rows':_0x400008});});}};var _0x435c65=jayson['server'](_0x3e86b3)[_0x2c02('0x55')]();_0x435c65['on'](_0x2c02('0x30'),function(_0x44c76d){logger[_0x2c02('0x30')](JSON[_0x2c02('0x56')](_0x44c76d));return _0x26c1fa(_0x44c76d);});_0x435c65[_0x2c02('0xe')](0x232c,_0x2c02('0x57'),function(){console[_0x2c02('0x58')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x29f647(_0x2c02('0x59')+0x232c);});});}; \ No newline at end of file +var _0x8d62=['rules','execute','stringify','matchPath','complete','format','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busyQueue','emit','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','mailQueues','loggedIn','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','error','Please\x20create\x20a\x20new\x20file\x20under','.js'];(function(_0x27d446,_0x17135c){var _0x16935f=function(_0x119593){while(--_0x119593){_0x27d446['push'](_0x27d446['shift']());}};_0x16935f(++_0x17135c);}(_0x8d62,0xf8));var _0x28d6=function(_0x1e1762,_0x185229){_0x1e1762=_0x1e1762-0x0;var _0x3f58d0=_0x8d62[_0x1e1762];return _0x3f58d0;};'use strict';var _=require('lodash');var util=require(_0x28d6('0x0'));var path=require(_0x28d6('0x1'));var fs=require('fs');var jayson=require(_0x28d6('0x2'));var BPromise=require(_0x28d6('0x3'));var utils=require(_0x28d6('0x4'));var sUtils=require(_0x28d6('0x5'));var logger=require(_0x28d6('0x6'))(_0x28d6('0x7'));var rpc={'openchannelQueueReport':require(_0x28d6('0x8')),'mailQueueReport':require(_0x28d6('0x9')),'chatQueueReport':require(_0x28d6('0xa')),'smsQueueReport':require(_0x28d6('0xb')),'faxQueueReport':require(_0x28d6('0xc')),'whatsappQueueReport':require(_0x28d6('0xd'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x1d5399,_0xb9dccb,_0x3f3235){return util['format'](_0x28d6('0xe'),_0x1d5399,_0xb9dccb||0x0,_0x3f3235||0x0);}function getIntervals(_0x4b564f,_0x13eeb6){var _0x7726e1=[];if(!_[_0x28d6('0xf')](_0x13eeb6[_0x28d6('0x10')])&&!_[_0x28d6('0xf')](_0x4b564f[_0x13eeb6['IntervalId']])&&!_[_0x28d6('0xf')](_0x4b564f[_0x13eeb6[_0x28d6('0x10')]][_0x28d6('0x11')])){_0x7726e1=_[_0x28d6('0x12')](_0x4b564f[_0x13eeb6[_0x28d6('0x10')]][_0x28d6('0x11')],_0x28d6('0x13'));}else if(!_[_0x28d6('0xf')](_0x13eeb6['interval'])){_0x7726e1=[_0x13eeb6[_0x28d6('0x13')]];}return _0x7726e1;}exports[_0x28d6('0x14')]=function(_0x33ba38){_0x33ba38['rules']={};return new BPromise(function(_0x1621ee,_0x53f101){var _0x19c21d={'Start':function(_0x425ffb){var _0x4b82e2=this;return new Promise(function(_0x1881a8,_0x159d2a){if(_0x425ffb){try{var _0x2d5eee=[];var _0x17a822=getId(_0x425ffb[_0x28d6('0x15')],_0x425ffb['message']?_0x425ffb[_0x28d6('0x16')]['id']:0x0,_0x425ffb['interaction']?_0x425ffb[_0x28d6('0x17')]['id']:0x0);var _0x155151=sUtils[_0x28d6('0x18')](_0x33ba38,_0x425ffb);if(_0x425ffb[_0x28d6('0x19')]||!_0x155151&&_0x425ffb[_0x28d6('0x1a')]&&_[_0x28d6('0x1b')](_0x425ffb[_0x28d6('0x1a')])&&_0x425ffb['applications'][_0x28d6('0x1c')]){for(var _0x20f2fd=0x0;_0x20f2fd<_0x425ffb['applications'][_0x28d6('0x1c')];_0x20f2fd+=0x1){var _0x24f764=_0x425ffb[_0x28d6('0x1a')][_0x20f2fd];if(fs[_0x28d6('0x1d')](path[_0x28d6('0x1e')](__dirname,_0x28d6('0x1a'),_0x24f764[_0x28d6('0x1f')]+'.js'))){var _0xcf8fa0=[];switch(_0x24f764['app'][_0x28d6('0x20')]()){case _0x28d6('0x21'):var _0x455dd6=_0x24f764[_0x28d6('0x22')][_0x28d6('0x23')](',');if(_0x425ffb[_0x28d6('0x15')]==='mail'){_0xcf8fa0['push'](_0x455dd6[0x0]);_0xcf8fa0[_0x28d6('0x24')](_0x455dd6[0x1]);_0xcf8fa0[_0x28d6('0x24')](_0x455dd6[_0x28d6('0x25')](0x2,_0x455dd6[_0x28d6('0x1c')])['join'](','));}else{_0xcf8fa0[_0x28d6('0x24')](_0x455dd6[0x0]);_0xcf8fa0[_0x28d6('0x24')](_0x455dd6[_0x28d6('0x25')](0x1,_0x455dd6[_0x28d6('0x1c')])[_0x28d6('0x1e')](','));}break;case _0x28d6('0x26'):var _0x60ded0=_0x24f764[_0x28d6('0x22')][_0x28d6('0x23')](',');_0xcf8fa0[_0x28d6('0x24')](_0x60ded0[0x0]);_0xcf8fa0[_0x28d6('0x24')](_0x60ded0[0x1]);_0xcf8fa0[_0x28d6('0x24')](_0x60ded0[_0x28d6('0x25')](0x2,_0x60ded0[_0x28d6('0x1c')])['join'](','));break;case'dialogflowv2':var _0x1de585=_0x24f764[_0x28d6('0x22')][_0x28d6('0x23')](',');_0xcf8fa0[_0x28d6('0x24')](_0x1de585[0x0]);_0xcf8fa0[_0x28d6('0x24')](_0x1de585[0x1]);_0xcf8fa0[_0x28d6('0x24')](_0x1de585[0x2]);_0xcf8fa0['push'](_0x1de585[0x3]);_0xcf8fa0[_0x28d6('0x24')](_0x1de585['slice'](0x4,_0x1de585[_0x28d6('0x1c')])['join'](','));break;case _0x28d6('0x27'):var _0x2594cb=_0x24f764[_0x28d6('0x22')][_0x28d6('0x23')](',');_0xcf8fa0[_0x28d6('0x24')](_0x2594cb[0x0]);_0xcf8fa0['push'](_0x2594cb[0x1]);_0xcf8fa0['push'](_0x2594cb[0x2]);_0xcf8fa0[_0x28d6('0x24')](_0x2594cb[0x3]);_0xcf8fa0[_0x28d6('0x24')](_0x2594cb['slice'](0x4,_0x2594cb[_0x28d6('0x1c')])['join'](','));break;case _0x28d6('0x16'):_0xcf8fa0['push'](_0x24f764[_0x28d6('0x22')]);break;case'tag':_0xcf8fa0[_0x28d6('0x24')](_0x24f764[_0x28d6('0x28')]);_0xcf8fa0[_0x28d6('0x24')](_0x24f764[_0x28d6('0x22')]);break;case _0x28d6('0x29'):var _0x10b374=utils[_0x28d6('0x2a')](_0x425ffb['account'][_0x28d6('0x2b')],_0x425ffb);var _0x23a04b=_0x24f764[_0x28d6('0x22')][_0x28d6('0x23')](',');_0xcf8fa0['push'](_0x23a04b[0x0]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0x1]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0x2]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0x3]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0x4]);_0xcf8fa0['push'](_0x23a04b[0x5]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0x6]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0x7]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0x8]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0x9]);_0xcf8fa0[_0x28d6('0x24')](_0x23a04b[0xa]);_0xcf8fa0[_0x28d6('0x24')](_0x425ffb[_0x28d6('0x17')]['id']);_0xcf8fa0[_0x28d6('0x24')](_0x425ffb[_0x28d6('0x16')]['id']);_0xcf8fa0[_0x28d6('0x24')](_0x24f764[_0x28d6('0x2c')]);_0xcf8fa0[_0x28d6('0x24')](_0x425ffb[_0x28d6('0x17')][_0x28d6('0x2d')]);_0xcf8fa0[_0x28d6('0x24')](_0x425ffb[_0x28d6('0x2e')]['body']);_0xcf8fa0['push'](_0x10b374);break;default:_0xcf8fa0=_['isNil'](_0x24f764[_0x28d6('0x22')])?[]:_0x24f764['appdata']['split'](',');}var _0x293320={'id':util['format'](_0x28d6('0x2f'),_0x17a822,_0x24f764['id'],_0x24f764[_0x28d6('0x1f')]),'condition':require('./interval')[_0x28d6('0x30')](_0x17a822,getIntervals(_0x33ba38[_0x28d6('0x31')],_0x24f764),_0x33ba38),'consequence':require(_0x28d6('0x32')+_0x24f764[_0x28d6('0x1f')])[_0x28d6('0x33')](_0x17a822,_0xcf8fa0,_0x33ba38,_0x425ffb),'p':_0x24f764[_0x28d6('0x34')]||0x0};logger[_0x28d6('0x35')](_0x28d6('0x36'),_0x293320['id'],'on\x20interval',getIntervals(_0x33ba38[_0x28d6('0x31')],_0x24f764)[_0x28d6('0x1e')]('\x20|\x20'));_0x2d5eee[_0x28d6('0x24')](_0x293320);}else{logger[_0x28d6('0x37')](_0x28d6('0x38'),path['join'](__dirname,_0x28d6('0x1a'),_0x24f764[_0x28d6('0x1f')]+_0x28d6('0x39')));}}_0x33ba38[_0x28d6('0x3a')][_0x17a822]=new RuleEngine(_0x2d5eee);_0x33ba38['rules'][_0x17a822][_0x28d6('0x3b')](_0x425ffb,function(_0x3559ab){logger[_0x28d6('0x35')]('Applications\x20executed',JSON[_0x28d6('0x3c')](_0x3559ab[_0x28d6('0x3d')]));if(_0x33ba38[_0x28d6('0x3a')][_0x17a822]){_0x33ba38[_0x28d6('0x3a')][_0x17a822]['emit'](_0x28d6('0x3e'));}});return _0x1881a8({'code':0xc8,'message':_0x425ffb});}else{if(_0x155151){logger[_0x28d6('0x35')](util[_0x28d6('0x3f')](_0x28d6('0x40'),_0x17a822));}else{logger[_0x28d6('0x35')]('No\x20applications\x20to\x20execute');}return _0x1881a8({'code':0xc8,'message':_0x425ffb});}}catch(_0x159580){logger[_0x28d6('0x37')](_0x159580[_0x28d6('0x41')]);return _0x159d2a(_0x4b82e2[_0x28d6('0x37')](0x1f4,_0x159580));}}return _0x159d2a(_0x28d6('0x42'));});},'AcceptMessage':function(_0x182d70){var _0x10a52=this;return new Promise(function(_0x6876a5,_0x293c76){if(_0x182d70[_0x28d6('0x43')]&&_0x182d70['agent']['id']){if(_0x33ba38['agents'][_0x182d70[_0x28d6('0x43')]['id']]){_0x33ba38['agents'][_0x182d70['agent']['id']]['busy']=![];_0x33ba38[_0x28d6('0x44')][_0x182d70['agent']['id']][_0x28d6('0x45')]=undefined;}}if(_0x182d70['message']&&_0x182d70[_0x28d6('0x16')]['id']){try{var _0x3b7f2e=getId(_0x182d70[_0x28d6('0x15')],_0x182d70['message']?_0x182d70['message']['id']:0x0,_0x182d70['interaction']?_0x182d70[_0x28d6('0x17')]['id']:0x0);if(_0x33ba38[_0x28d6('0x3a')][_0x3b7f2e]){_0x33ba38['rules'][_0x3b7f2e][_0x28d6('0x46')](_0x28d6('0x47'));if(rpc[_0x182d70[_0x28d6('0x15')]+_0x28d6('0x48')]){rpc[_0x182d70[_0x28d6('0x15')]+_0x28d6('0x48')][_0x28d6('0x49')](_0x3b7f2e,{'UserId':_0x182d70[_0x28d6('0x16')]['UserId']})[_0x28d6('0x4a')](function(){logger[_0x28d6('0x37')](_0x28d6('0x4b'));});}}return _0x6876a5({'code':0xc8,'message':_0x182d70});}catch(_0x2b0b72){logger[_0x28d6('0x37')](_0x2b0b72[_0x28d6('0x41')]);return _0x293c76(_0x10a52[_0x28d6('0x37')](0x1f4,_0x2b0b72));}}logger['error'](_0x28d6('0x4c'));return _0x293c76(_0x10a52['error'](0x1f4,_0x28d6('0x4c')));});},'RejectMessage':function(_0x2f8f42){var _0x6ee4d9=this;return new Promise(function(_0x15edd6,_0x69aa04){if(_0x2f8f42[_0x28d6('0x43')]&&_0x2f8f42['agent']['id']){try{if(_0x33ba38[_0x28d6('0x44')][_0x2f8f42['agent']['id']]){_0x33ba38[_0x28d6('0x44')][_0x2f8f42['agent']['id']][_0x28d6('0x4d')]=![];_0x33ba38[_0x28d6('0x44')][_0x2f8f42[_0x28d6('0x43')]['id']][_0x28d6('0x45')]=undefined;}return _0x15edd6({'code':0xc8,'message':_0x2f8f42});}catch(_0x49a01a){logger[_0x28d6('0x37')](_0x49a01a[_0x28d6('0x41')]);return _0x69aa04(_0x6ee4d9[_0x28d6('0x37')](0x1f4,_0x49a01a));}}logger[_0x28d6('0x37')](_0x28d6('0x4c'));return _0x69aa04(_0x6ee4d9[_0x28d6('0x37')](0x1f4,_0x28d6('0x4c')));});},'AbandonInteraction':function(_0x1ed92e){var _0x164f53=this;return new Promise(function(_0xe55cde,_0x267661){if(_0x1ed92e['channel']&&_0x1ed92e[_0x28d6('0x17')]&&_0x1ed92e[_0x28d6('0x17')]['id']){try{var _0x45a288=getId(_0x1ed92e[_0x28d6('0x15')],_0x1ed92e[_0x28d6('0x16')]?_0x1ed92e['message']['id']:0x0,_0x1ed92e[_0x28d6('0x17')]?_0x1ed92e[_0x28d6('0x17')]['id']:0x0);if(_0x33ba38[_0x28d6('0x3a')][_0x45a288]){_0x33ba38[_0x28d6('0x3a')][_0x45a288][_0x28d6('0x46')]('end');}return _0xe55cde({'code':0xc8,'message':_0x1ed92e});}catch(_0x3bf12f){logger[_0x28d6('0x37')](_0x3bf12f[_0x28d6('0x41')]);return _0x267661(_0x164f53[_0x28d6('0x37')](0x1f4,_0x3bf12f));}}logger['error'](_0x28d6('0x4c'));return _0x267661(_0x164f53['error'](0x1f4,_0x28d6('0x4c')));});},'AgentCapacity':function(_0x1b8ed6){var _0x351f8d=this;return new Promise(function(_0x4c5c36,_0x21fd25){if(_0x33ba38[_0x28d6('0x44')][_0x28d6('0x4e')](_0x1b8ed6['id'])){for(var _0x16ced4 in _0x1b8ed6[_0x28d6('0x4f')]){if(_0x1b8ed6[_0x28d6('0x4f')][_0x28d6('0x4e')](_0x16ced4)){if(_0x33ba38['agents'][_0x1b8ed6['id']][_0x28d6('0x4e')](_0x16ced4+_0x28d6('0x50'))){_0x33ba38[_0x28d6('0x44')][_0x1b8ed6['id']][_0x16ced4+_0x28d6('0x50')]=parseInt(_0x1b8ed6[_0x28d6('0x4f')][_0x16ced4],0xa);}}}_0x33ba38[_0x28d6('0x44')][_0x1b8ed6['id']][_0x28d6('0x51')]();return _0x4c5c36({'code':0xc8,'message':_0x33ba38[_0x28d6('0x44')][_0x1b8ed6['id']]});}else{return _0x21fd25(_0x351f8d[_0x28d6('0x37')](0x1f4,_0x28d6('0x52')));}});},'Agents':function(_0x5d1441){return new Promise(function(_0x3a87c8){var _0xbe3e6=_[_0x28d6('0x53')](_0x33ba38[_0x28d6('0x44')]);if(_0x5d1441&&_0x5d1441['id']){var _0xbd4b4b=_['find'](_0xbe3e6,function(_0x2322c6){return _0x2322c6['id']===_0x5d1441['id'];});_0x3a87c8(_0xbd4b4b);}else{_0x3a87c8({'count':_0xbe3e6[_0x28d6('0x1c')],'rows':_0xbe3e6});}});},'ChatQueues':function(){return new Promise(function(_0xd6b590){var _0x3676b3=[];for(var _0x221dec in _0x33ba38[_0x28d6('0x54')]){if(_0x33ba38[_0x28d6('0x54')]['hasOwnProperty'](_0x221dec)){var _0x543770=_0x33ba38[_0x28d6('0x54')][_0x221dec];var _0x245872={'id':_0x543770['id'],'available':_0x543770[_0x28d6('0x55')],'loggedIn':_0x543770['loggedIn'],'name':_0x543770[_0x28d6('0x56')],'paused':_0x543770['paused'],'waiting':_0x543770['waiting']};_0x3676b3[_0x28d6('0x24')](_0x245872);}}_0xd6b590({'count':_0x3676b3[_0x28d6('0x1c')],'rows':_0x3676b3});});},'MailQueues':function(){return new Promise(function(_0x2613fb){var _0x2f0580=[];for(var _0x45245a in _0x33ba38[_0x28d6('0x57')]){if(_0x33ba38[_0x28d6('0x57')]['hasOwnProperty'](_0x45245a)){var _0x5956de=_0x33ba38['mailQueues'][_0x45245a];var _0x2fae42={'id':_0x5956de['id'],'available':_0x5956de[_0x28d6('0x55')],'loggedIn':_0x5956de[_0x28d6('0x58')],'name':_0x5956de[_0x28d6('0x56')],'paused':_0x5956de[_0x28d6('0x59')],'waiting':_0x5956de[_0x28d6('0x5a')]};_0x2f0580[_0x28d6('0x24')](_0x2fae42);}}_0x2613fb({'count':_0x2f0580[_0x28d6('0x1c')],'rows':_0x2f0580});});},'OpenchannelQueues':function(){return new Promise(function(_0x26a2f7){var _0x1ed7e3=[];for(var _0x5e1ba4 in _0x33ba38[_0x28d6('0x5b')]){if(_0x33ba38[_0x28d6('0x5b')][_0x28d6('0x4e')](_0x5e1ba4)){var _0xb9a647=_0x33ba38[_0x28d6('0x5b')][_0x5e1ba4];var _0x278401={'id':_0xb9a647['id'],'available':_0xb9a647[_0x28d6('0x55')],'loggedIn':_0xb9a647[_0x28d6('0x58')],'name':_0xb9a647[_0x28d6('0x56')],'paused':_0xb9a647['paused'],'waiting':_0xb9a647['waiting']};_0x1ed7e3[_0x28d6('0x24')](_0x278401);}}_0x26a2f7({'count':_0x1ed7e3[_0x28d6('0x1c')],'rows':_0x1ed7e3});});},'SmsQueues':function(){return new Promise(function(_0x6bdf9f){var _0x5418ba=[];for(var _0x376a7d in _0x33ba38[_0x28d6('0x5c')]){if(_0x33ba38[_0x28d6('0x5c')][_0x28d6('0x4e')](_0x376a7d)){var _0x228f44=_0x33ba38[_0x28d6('0x5c')][_0x376a7d];var _0x2dbdf6={'id':_0x228f44['id'],'available':_0x228f44[_0x28d6('0x55')],'loggedIn':_0x228f44[_0x28d6('0x58')],'name':_0x228f44[_0x28d6('0x56')],'paused':_0x228f44[_0x28d6('0x59')],'waiting':_0x228f44[_0x28d6('0x5a')]};_0x5418ba[_0x28d6('0x24')](_0x2dbdf6);}}_0x6bdf9f({'count':_0x5418ba[_0x28d6('0x1c')],'rows':_0x5418ba});});},'FaxQueues':function(){return new Promise(function(_0x22d73b){var _0x51adbb=[];for(var _0x12cac4 in _0x33ba38[_0x28d6('0x5d')]){if(_0x33ba38[_0x28d6('0x5d')][_0x28d6('0x4e')](_0x12cac4)){var _0x4bf2cd=_0x33ba38[_0x28d6('0x5d')][_0x12cac4];var _0x51c690={'id':_0x4bf2cd['id'],'available':_0x4bf2cd[_0x28d6('0x55')],'loggedIn':_0x4bf2cd[_0x28d6('0x58')],'name':_0x4bf2cd['name'],'paused':_0x4bf2cd[_0x28d6('0x59')],'waiting':_0x4bf2cd['waiting']};_0x51adbb[_0x28d6('0x24')](_0x51c690);}}_0x22d73b({'count':_0x51adbb[_0x28d6('0x1c')],'rows':_0x51adbb});});},'WhatsappQueues':function(){return new Promise(function(_0x4a6903){var _0x3fede2=[];for(var _0x18c0aa in _0x33ba38[_0x28d6('0x5e')]){if(_0x33ba38['whatsappQueues'][_0x28d6('0x4e')](_0x18c0aa)){var _0x359fe2=_0x33ba38[_0x28d6('0x5e')][_0x18c0aa];var _0x1a8def={'id':_0x359fe2['id'],'available':_0x359fe2[_0x28d6('0x55')],'loggedIn':_0x359fe2[_0x28d6('0x58')],'name':_0x359fe2[_0x28d6('0x56')],'paused':_0x359fe2[_0x28d6('0x59')],'waiting':_0x359fe2['waiting']};_0x3fede2[_0x28d6('0x24')](_0x1a8def);}}_0x4a6903({'count':_0x3fede2[_0x28d6('0x1c')],'rows':_0x3fede2});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x801f2f){var _0x4f2ac4=_[_0x28d6('0x53')](_0x33ba38[_0x28d6('0x5f')]);_0x801f2f({'count':_0x4f2ac4[_0x28d6('0x1c')],'rows':_0x4f2ac4});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x26aab9){var _0x5632ba=_['values'](_0x33ba38[_0x28d6('0x60')]);_0x26aab9({'count':_0x5632ba[_0x28d6('0x1c')],'rows':_0x5632ba});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4da055){var _0x15b53a=_['values'](_0x33ba38[_0x28d6('0x61')]);_0x4da055({'count':_0x15b53a[_0x28d6('0x1c')],'rows':_0x15b53a});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3f0eff){var _0xca226b=_['values'](_0x33ba38['smsQueuesWaitingInteractions']);_0x3f0eff({'count':_0xca226b[_0x28d6('0x1c')],'rows':_0xca226b});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5e1ce0){var _0x261cfb=_['values'](_0x33ba38[_0x28d6('0x62')]);_0x5e1ce0({'count':_0x261cfb[_0x28d6('0x1c')],'rows':_0x261cfb});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3b6e84){var _0x5383c8=_[_0x28d6('0x53')](_0x33ba38['whatsappQueuesWaitingInteractions']);_0x3b6e84({'count':_0x5383c8[_0x28d6('0x1c')],'rows':_0x5383c8});});}};var _0x2788b7=jayson['server'](_0x19c21d)[_0x28d6('0x63')]();_0x2788b7['on'](_0x28d6('0x37'),function(_0x420931){logger['error'](JSON[_0x28d6('0x3c')](_0x420931));return _0x53f101(_0x420931);});_0x2788b7['listen'](0x232c,_0x28d6('0x64'),function(){console['log'](_0x28d6('0x65'),0x232c);return _0x1621ee('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index b8984da..c807488 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 _0x562a=['stack','stop','lodash','../../../config/logger','routing','client','http','request','then','error','message','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','Command','format','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','join'];(function(_0xd60072,_0x107603){var _0x5a8d4a=function(_0x1ee2a8){while(--_0x1ee2a8){_0xd60072['push'](_0xd60072['shift']());}};_0x5a8d4a(++_0x107603);}(_0x562a,0x1de));var _0xa562=function(_0x562f1b,_0x53a634){_0x562f1b=_0x562f1b-0x0;var _0x48bd97=_0x562a[_0x562f1b];return _0x48bd97;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0xa562('0x0'));var logger=require(_0xa562('0x1'))(_0xa562('0x2'));var client=jayson[_0xa562('0x3')][_0xa562('0x4')]({'port':0x232a});function request(_0x5ecb22,_0x480458){return new BPromise(function(_0x3831b5,_0x2065c0){return client[_0xa562('0x5')](_0x5ecb22,_0x480458)[_0xa562('0x6')](function(_0x103fa2){if(_0x103fa2[_0xa562('0x7')]){return _0x2065c0(_0x103fa2[_0xa562('0x7')][_0xa562('0x8')]);}else{return _0x3831b5(_0x103fa2[_0xa562('0x9')]);}})[_0xa562('0xa')](function(_0x12c576){return _0x2065c0(_0x12c576);});});}exports['condition']=function(_0x32f993,_0x2776a8,_0x190cae){return function(_0x56f108){if(_0x190cae['rules']&&!_0x190cae[_0xa562('0xb')][_0x32f993]){logger[_0xa562('0xc')](_0xa562('0xd'),_0x32f993);return _0x56f108['stop']();}var _0x5014f3=[];for(var _0x14b5cc=0x0;_0x14b5cc<_0x2776a8['length'];_0x14b5cc+=0x1){_0x5014f3[_0xa562('0xe')](request(_0xa562('0xf'),{'command':util[_0xa562('0x10')]('iftime\x20%s',_0x2776a8[_0x14b5cc])})[_0xa562('0x6')](function(_0x528f71){return _0x528f71&&_0x528f71['message']&&_0x528f71[_0xa562('0x8')][_0xa562('0x11')](_0xa562('0x12'))>=0x0?!![]:![];})[_0xa562('0xa')](function(){logger[_0xa562('0x7')](_0xa562('0x13'),_0x32f993,_0x2776a8[_0x14b5cc]);}));}BPromise[_0xa562('0x14')](_0x5014f3)[_0xa562('0x6')](function(_0x2bfa7d){var _0x351cc0=_[_0xa562('0x15')](_0x2bfa7d);logger[_0xa562('0xc')](_0xa562('0x16'),_0x32f993,_0x2776a8['join'](_0xa562('0x17')),_0x351cc0);_0x56f108[_0xa562('0x18')](_0x351cc0);})[_0xa562('0xa')](function(_0xaf8be2){logger[_0xa562('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x32f993,_0x2776a8[_0xa562('0x19')](_0xa562('0x17')),_0xaf8be2[_0xa562('0x1a')]);_0x56f108[_0xa562('0x1b')]();});};}; \ No newline at end of file +var _0x5cda=['request','error','message','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','then','indexOf','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','jayson/promise','lodash','routing','client','http'];(function(_0x5699dd,_0x1d1244){var _0xb60868=function(_0x141966){while(--_0x141966){_0x5699dd['push'](_0x5699dd['shift']());}};_0xb60868(++_0x1d1244);}(_0x5cda,0xe9));var _0xa5cd=function(_0x319a54,_0x518cb9){_0x319a54=_0x319a54-0x0;var _0x2a2caf=_0x5cda[_0x319a54];return _0x2a2caf;};'use strict';var util=require(_0xa5cd('0x0'));var BPromise=require(_0xa5cd('0x1'));var jayson=require(_0xa5cd('0x2'));var _=require(_0xa5cd('0x3'));var logger=require('../../../config/logger')(_0xa5cd('0x4'));var client=jayson[_0xa5cd('0x5')][_0xa5cd('0x6')]({'port':0x232a});function request(_0x16e235,_0x181253){return new BPromise(function(_0x3427ea,_0x208d5e){return client[_0xa5cd('0x7')](_0x16e235,_0x181253)['then'](function(_0xfab420){if(_0xfab420[_0xa5cd('0x8')]){return _0x208d5e(_0xfab420[_0xa5cd('0x8')][_0xa5cd('0x9')]);}else{return _0x3427ea(_0xfab420['result']);}})[_0xa5cd('0xa')](function(_0x923ff4){return _0x208d5e(_0x923ff4);});});}exports['condition']=function(_0x23ac73,_0x5ea947,_0x54fee2){return function(_0x3878d7){if(_0x54fee2[_0xa5cd('0xb')]&&!_0x54fee2[_0xa5cd('0xb')][_0x23ac73]){logger[_0xa5cd('0xc')](_0xa5cd('0xd'),_0x23ac73);return _0x3878d7[_0xa5cd('0xe')]();}var _0x57d394=[];for(var _0x6da564=0x0;_0x6da564<_0x5ea947[_0xa5cd('0xf')];_0x6da564+=0x1){_0x57d394[_0xa5cd('0x10')](request(_0xa5cd('0x11'),{'command':util[_0xa5cd('0x12')](_0xa5cd('0x13'),_0x5ea947[_0x6da564])})[_0xa5cd('0x14')](function(_0x2c84d6){return _0x2c84d6&&_0x2c84d6['message']&&_0x2c84d6[_0xa5cd('0x9')][_0xa5cd('0x15')]('true')>=0x0?!![]:![];})[_0xa5cd('0xa')](function(){logger[_0xa5cd('0x8')](_0xa5cd('0x16'),_0x23ac73,_0x5ea947[_0x6da564]);}));}BPromise[_0xa5cd('0x17')](_0x57d394)[_0xa5cd('0x14')](function(_0x34f18e){var _0x4db486=_[_0xa5cd('0x18')](_0x34f18e);logger[_0xa5cd('0xc')](_0xa5cd('0x19'),_0x23ac73,_0x5ea947[_0xa5cd('0x1a')](_0xa5cd('0x1b')),_0x4db486);_0x3878d7[_0xa5cd('0x1c')](_0x4db486);})[_0xa5cd('0xa')](function(_0x2470b6){logger['error'](_0xa5cd('0x19'),_0x23ac73,_0x5ea947['join']('\x20|\x20'),_0x2470b6[_0xa5cd('0x1d')]);_0x3878d7['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 581d6c9..90ec56e 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 _0x4522=['agent','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalledAt','called','info','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','reason','timeout','holdtime','ringtime','talktime','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','debug','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connect','forIn','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','transfer','transfertype','extension','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','transferexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agentcompleteAt'];(function(_0x57e18a,_0x199383){var _0x1181c7=function(_0x2503e8){while(--_0x2503e8){_0x57e18a['push'](_0x57e18a['shift']());}};_0x1181c7(++_0x199383);}(_0x4522,0x1a0));var _0x2452=function(_0x54b3bf,_0x1ee37c){_0x54b3bf=_0x54b3bf-0x0;var _0x3d3056=_0x4522[_0x54b3bf];return _0x3d3056;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x2452('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0xa5f6b7,_0x4a08d4){utils['info'](util[_0x2452('0x1')](_0x2452('0x2'),_0xa5f6b7[_0x2452('0x3')],_0xa5f6b7[_0x2452('0x4')],_0xa5f6b7[_0x2452('0x5')],_0xa5f6b7[_0x2452('0x6')],_0xa5f6b7[_0x2452('0x7')],_0xa5f6b7[_0x2452('0x8')],_0xa5f6b7[_0x2452('0x9')],_0xa5f6b7[_0x2452('0xa')]));if(_0xa5f6b7[_0x2452('0x5')]){utils[_0x2452('0xb')](_0xa5f6b7[_0x2452('0x5')])[_0x2452('0xc')](function(_0x2e5caa){if(_0x2e5caa){_0xa5f6b7[_0x2452('0xd')]=_0x2e5caa['type'];_0xa5f6b7['agentacw']=_0xa5f6b7[_0x2452('0xe')]?_0x2e5caa['acw']:![];_0xa5f6b7['acwtime']=_0xa5f6b7[_0x2452('0xf')]?_0x2e5caa[_0x2452('0x10')]:0x0;}utils[_0x2452('0x11')](_0x2452('0x12'),_0xa5f6b7);});}else{utils[_0x2452('0x11')](_0x2452('0x12'),_0xa5f6b7);}if(_0x4a08d4){delete transfers[_0xa5f6b7[_0x2452('0x3')]];}else{delete agents[_0xa5f6b7[_0x2452('0x13')]];}}exports['agentcalled']=function(_0x529fb2){try{utils['debug'](util[_0x2452('0x1')]('[%s][agents][agentcalled]',_0x529fb2[_0x2452('0x3')]),_0x529fb2);agents[_0x529fb2['destuniqueid']]=_0x529fb2;agents[_0x529fb2[_0x2452('0x13')]][_0x2452('0x14')]=utils['now']();agents[_0x529fb2[_0x2452('0x13')]]['lastevent']=_0x2452('0x15');agents[_0x529fb2[_0x2452('0x13')]][_0x2452('0x9')]=null;agents[_0x529fb2[_0x2452('0x13')]]['connectedlinename']=null;utils[_0x2452('0x16')](util[_0x2452('0x1')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x529fb2['uniqueid'],agents[_0x529fb2[_0x2452('0x13')]][_0x2452('0x6')],_0x529fb2[_0x2452('0x13')]));}catch(_0x57cb03){utils[_0x2452('0x17')](util[_0x2452('0x1')](_0x2452('0x18'),_0x529fb2[_0x2452('0x3')]),_0x57cb03);}};exports[_0x2452('0x19')]=function(_0x1c70cb){try{if(!_[_0x2452('0x1a')](agents[_0x1c70cb[_0x2452('0x13')]])){utils['debug'](util['format'](_0x2452('0x1b'),_0x1c70cb[_0x2452('0x3')]),_0x1c70cb);utils['info'](util[_0x2452('0x1')](_0x2452('0x1c'),_0x1c70cb[_0x2452('0x3')],agents[_0x1c70cb[_0x2452('0x13')]][_0x2452('0x6')],_0x1c70cb[_0x2452('0x13')]));agents[_0x1c70cb[_0x2452('0x13')]]['agentringnoanswer']=!![];agents[_0x1c70cb[_0x2452('0x13')]][_0x2452('0x1d')]=utils[_0x2452('0x1e')]();agents[_0x1c70cb[_0x2452('0x13')]][_0x2452('0xa')]='timeout';agents[_0x1c70cb['destuniqueid']][_0x2452('0x1f')]=_0x2452('0x20');agents[_0x1c70cb[_0x2452('0x13')]][_0x2452('0x21')]=_0x1c70cb[_0x2452('0x22')]?parseInt(_0x1c70cb['ringtime'])/0x3e8:0x0;agents[_0x1c70cb[_0x2452('0x13')]][_0x2452('0x23')]=0x0;unanswered['push'](_0x1c70cb['destuniqueid']);}}catch(_0x332878){utils[_0x2452('0x17')](util[_0x2452('0x1')](_0x2452('0x1b'),_0x1c70cb[_0x2452('0x3')]),_0x332878);}};exports[_0x2452('0x24')]=function(_0x504162){try{_['forIn'](agents,function(_0x46b611,_0x454e0a){if(_0x46b611[_0x2452('0x3')]==_0x504162['uniqueid']&&!_[_0x2452('0x25')](unanswered,_0x46b611[_0x2452('0x13')])){utils['debug'](util[_0x2452('0x1')](_0x2452('0x26'),_0x504162[_0x2452('0x3')]),_0x504162);utils[_0x2452('0x16')](util[_0x2452('0x1')](_0x2452('0x27'),_0x504162[_0x2452('0x3')],_0x46b611[_0x2452('0x6')],_0x46b611[_0x2452('0x13')]));_0x46b611[_0x2452('0x19')]=!![];_0x46b611[_0x2452('0x1d')]=utils[_0x2452('0x1e')]();_0x46b611[_0x2452('0xa')]='abandoned';_0x46b611[_0x2452('0x1f')]=_0x2452('0x28');_0x46b611['holdtime']=_0x504162[_0x2452('0x21')];_0x46b611['talktime']=0x0;writeDB(_0x46b611);}});}catch(_0x2c6843){utils[_0x2452('0x17')](util['format'](_0x2452('0x26'),_0x504162[_0x2452('0x3')]),_0x2c6843);}};exports[_0x2452('0x29')]=function(_0x5ce5fb){try{if(agents[_0x5ce5fb[_0x2452('0x13')]]){utils[_0x2452('0x2a')](util['format'](_0x2452('0x2b'),_0x5ce5fb[_0x2452('0x3')]),_0x5ce5fb);utils[_0x2452('0x16')](util[_0x2452('0x1')](_0x2452('0x2c'),_0x5ce5fb['uniqueid'],agents[_0x5ce5fb['destuniqueid']]['membername'],_0x5ce5fb[_0x2452('0x13')]));agents[_0x5ce5fb[_0x2452('0x13')]][_0x2452('0x2d')]=utils[_0x2452('0x1e')]();agents[_0x5ce5fb[_0x2452('0x13')]]['connectedlinenum']=_0x5ce5fb[_0x2452('0x9')];agents[_0x5ce5fb['destuniqueid']]['connectedlinename']=_0x5ce5fb[_0x2452('0x2e')];agents[_0x5ce5fb['destuniqueid']][_0x2452('0x21')]=_0x5ce5fb[_0x2452('0x22')];agents[_0x5ce5fb['destuniqueid']][_0x2452('0xa')]=_0x2452('0x2f');_[_0x2452('0x30')](agents,function(_0x34d7f9,_0x2babbe){if(_0x34d7f9[_0x2452('0x13')]!=_0x5ce5fb[_0x2452('0x13')]&&_0x34d7f9[_0x2452('0x3')]==_0x5ce5fb['uniqueid']){_0x34d7f9[_0x2452('0x23')]=0x0;_0x34d7f9['holdtime']=_0x5ce5fb[_0x2452('0x22')];_0x34d7f9[_0x2452('0x19')]=!![];_0x34d7f9['agentringnoanswerAt']=utils[_0x2452('0x1e')]();_0x34d7f9[_0x2452('0xa')]=_0x2452('0x31');_0x34d7f9[_0x2452('0x1f')]=_0x2452('0x31');_0x34d7f9['answeredelsewheredestinationuniqueid']=_0x5ce5fb[_0x2452('0x13')];_0x34d7f9[_0x2452('0x32')]=_0x5ce5fb['membername'];writeDB(_0x34d7f9);}});}}catch(_0xfabbd8){utils[_0x2452('0x17')](util[_0x2452('0x1')](_0x2452('0x2b'),_0x5ce5fb['uniqueid']),_0xfabbd8);}};exports[_0x2452('0xe')]=function(_0x304942){try{if(!_[_0x2452('0x1a')](agents[_0x304942[_0x2452('0x13')]])){utils[_0x2452('0x2a')](util[_0x2452('0x1')]('[%s][agents][agentcomplete]',_0x304942[_0x2452('0x3')]),_0x304942);utils['info'](util[_0x2452('0x1')](_0x2452('0x33'),_0x304942['uniqueid'],agents[_0x304942['destuniqueid']]['membername'],_0x304942['destuniqueid']));agents[_0x304942[_0x2452('0x13')]]['agentcomplete']=!![];agents[_0x304942[_0x2452('0x13')]]['agentcompleteAt']=utils[_0x2452('0x1e')]();agents[_0x304942[_0x2452('0x13')]]['talktime']=utils['diffTime'](agents[_0x304942[_0x2452('0x13')]]['agentcompleteAt'],agents[_0x304942[_0x2452('0x13')]][_0x2452('0x2d')]);agents[_0x304942[_0x2452('0x13')]][_0x2452('0x1f')]=_0x304942['reason'];agents[_0x304942['destuniqueid']][_0x2452('0xa')]=_0x2452('0x34');writeDB(agents[_0x304942[_0x2452('0x13')]]);}}catch(_0x2d06f2){utils[_0x2452('0x17')](util['format'](_0x2452('0x35'),_0x304942['uniqueid']),_0x2d06f2);}};exports[_0x2452('0x36')]=function(_0x53fd05){try{if(!_[_0x2452('0x1a')](agents[_0x53fd05[_0x2452('0x37')]])){utils['debug'](util[_0x2452('0x1')]('[%s][agents][blindtransfer]',_0x53fd05[_0x2452('0x3')]),_0x53fd05);utils['info'](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x53fd05[_0x2452('0x3')],agents[_0x53fd05[_0x2452('0x37')]][_0x2452('0x6')],agents[_0x53fd05['transfereruniqueid']][_0x2452('0x3')]));agents[_0x53fd05[_0x2452('0x37')]][_0x2452('0x38')]=!![];agents[_0x53fd05[_0x2452('0x37')]][_0x2452('0x39')]='blind';agents[_0x53fd05[_0x2452('0x37')]]['transferexten']=_0x53fd05[_0x2452('0x3a')];agents[_0x53fd05[_0x2452('0x37')]][_0x2452('0x3b')]=agents[_0x53fd05[_0x2452('0x37')]][_0x2452('0x3')];}}catch(_0x2096e2){utils[_0x2452('0x17')](util[_0x2452('0x1')](_0x2452('0x3c'),_0x53fd05['uniqueid']),_0x2096e2);}};exports[_0x2452('0x3d')]=function(_0x595f9f){try{utils[_0x2452('0x2a')](util['format'](_0x2452('0x3e'),_0x595f9f[_0x2452('0x3f')]),_0x595f9f);if(_0x595f9f['origtransfereruniqueid']==_0x595f9f[_0x2452('0x40')]){if(!_[_0x2452('0x1a')](agents[_0x595f9f[_0x2452('0x41')]])){utils[_0x2452('0x16')](util[_0x2452('0x1')](_0x2452('0x42'),_0x595f9f[_0x2452('0x3f')],agents[_0x595f9f[_0x2452('0x41')]][_0x2452('0x6')]));agents[_0x595f9f[_0x2452('0x41')]][_0x2452('0x38')]=!![];agents[_0x595f9f['secondtransfereruniqueid']][_0x2452('0x39')]='ATTENDED';agents[_0x595f9f[_0x2452('0x41')]]['transferexten']=_0x595f9f[_0x2452('0x43')];agents[_0x595f9f[_0x2452('0x41')]][_0x2452('0x3b')]=_0x595f9f[_0x2452('0x3f')];}if(_0x595f9f[_0x2452('0x44')]&&agents[_0x595f9f[_0x2452('0x44')]]){agents[_0x595f9f[_0x2452('0x44')]][_0x2452('0x45')]=0x1;transfers[_0x595f9f[_0x2452('0x44')]]=_[_0x2452('0x46')](agents[_0x595f9f[_0x2452('0x44')]]);transfers[_0x595f9f['transfereeuniqueid']][_0x2452('0x8')]=agents[_0x595f9f[_0x2452('0x41')]][_0x2452('0x8')];transfers[_0x595f9f[_0x2452('0x44')]][_0x2452('0x47')]=agents[_0x595f9f[_0x2452('0x41')]]['calleridname'];transfers[_0x595f9f[_0x2452('0x44')]][_0x2452('0x14')]=utils['now']();transfers[_0x595f9f[_0x2452('0x44')]][_0x2452('0x2d')]=utils[_0x2452('0x1e')]();transfers[_0x595f9f[_0x2452('0x44')]][_0x2452('0x21')]=0x0;transfers[_0x595f9f[_0x2452('0x44')]][_0x2452('0x45')]=0x2;}}else if(_0x595f9f[_0x2452('0x41')]==_0x595f9f[_0x2452('0x48')]){if(!_[_0x2452('0x1a')](agents[_0x595f9f[_0x2452('0x3f')]])){utils['info'](util['format'](_0x2452('0x42'),_0x595f9f['origtransfereruniqueid'],agents[_0x595f9f[_0x2452('0x3f')]][_0x2452('0x6')]));agents[_0x595f9f[_0x2452('0x3f')]][_0x2452('0x38')]=!![];agents[_0x595f9f[_0x2452('0x3f')]][_0x2452('0x39')]='ATTENDED';agents[_0x595f9f['origtransfereruniqueid']][_0x2452('0x49')]=_0x595f9f['secondtransfererexten'];agents[_0x595f9f[_0x2452('0x3f')]]['transferuniqueid']=_0x595f9f[_0x2452('0x41')];}if(_0x595f9f[_0x2452('0x4a')]&&agents[_0x595f9f[_0x2452('0x4a')]]){agents[_0x595f9f[_0x2452('0x4a')]]['agententerreason']=0x1;transfers[_0x595f9f['transfertargetuniqueid']]=_['clone'](agents[_0x595f9f[_0x2452('0x4a')]]);transfers[_0x595f9f[_0x2452('0x4a')]]['calleridnum']=agents[_0x595f9f['origtransfereruniqueid']]['calleridnum'];transfers[_0x595f9f['transfertargetuniqueid']]['calleridname']=agents[_0x595f9f[_0x2452('0x3f')]]['calleridname'];transfers[_0x595f9f['transfertargetuniqueid']][_0x2452('0x14')]=utils[_0x2452('0x1e')]();transfers[_0x595f9f[_0x2452('0x4a')]][_0x2452('0x2d')]=utils[_0x2452('0x1e')]();transfers[_0x595f9f[_0x2452('0x4a')]]['holdtime']=0x0;transfers[_0x595f9f[_0x2452('0x4a')]][_0x2452('0x45')]=0x2;}}}catch(_0x45c850){utils['error'](util['format'](_0x2452('0x3e'),_0x595f9f[_0x2452('0x3f')]),_0x45c850);}};exports[_0x2452('0x4b')]=function(_0x1dec54){try{utils[_0x2452('0x2a')](util[_0x2452('0x1')](_0x2452('0x4c'),_0x1dec54[_0x2452('0x3')]),_0x1dec54);if(agents[_0x1dec54['uniqueid']]&&agents[_0x1dec54[_0x2452('0x3')]][_0x2452('0x1f')]===_0x2452('0x20')){if(_0x1dec54[_0x2452('0x4d')]==='21'){agents[_0x1dec54['uniqueid']][_0x2452('0x1f')]=_0x2452('0x4e');agents[_0x1dec54['uniqueid']][_0x2452('0xa')]=_0x2452('0x4e');}utils[_0x2452('0x16')](util[_0x2452('0x1')](_0x2452('0x4f'),_0x1dec54[_0x2452('0x3')],agents[_0x1dec54[_0x2452('0x3')]][_0x2452('0x6')],agents[_0x1dec54['uniqueid']]['reason'],agents[_0x1dec54[_0x2452('0x3')]][_0x2452('0xa')]));writeDB(agents[_0x1dec54[_0x2452('0x3')]]);var _0x1530fe=unanswered['indexOf'](_0x1dec54[_0x2452('0x3')]);if(_0x1530fe>-0x1){unanswered[_0x2452('0x50')](_0x1530fe,0x1);}}if(transfers[_0x1dec54[_0x2452('0x3')]]){transfers[_0x1dec54[_0x2452('0x3')]]['agentcomplete']=!![];transfers[_0x1dec54[_0x2452('0x3')]][_0x2452('0x51')]=utils[_0x2452('0x1e')]();transfers[_0x1dec54[_0x2452('0x3')]]['talktime']=utils['diffTime'](transfers[_0x1dec54[_0x2452('0x3')]][_0x2452('0x51')],transfers[_0x1dec54['uniqueid']][_0x2452('0x2d')]);transfers[_0x1dec54[_0x2452('0x3')]][_0x2452('0x1f')]=_0x2452('0x52');transfers[_0x1dec54[_0x2452('0x3')]][_0x2452('0xa')]=_0x2452('0x34');utils[_0x2452('0x16')](util[_0x2452('0x1')](_0x2452('0x4f'),_0x1dec54[_0x2452('0x3')],transfers[_0x1dec54[_0x2452('0x3')]][_0x2452('0x6')],transfers[_0x1dec54[_0x2452('0x3')]][_0x2452('0x1f')],transfers[_0x1dec54[_0x2452('0x3')]]['lastevent']));writeDB(transfers[_0x1dec54[_0x2452('0x3')]],!![]);}if(agents[_0x1dec54[_0x2452('0x3')]]&&agents[_0x1dec54[_0x2452('0x3')]]['agentconnectAt']){agents[_0x1dec54['uniqueid']]['agentcomplete']=!![];agents[_0x1dec54[_0x2452('0x3')]][_0x2452('0x51')]=utils[_0x2452('0x1e')]();agents[_0x1dec54[_0x2452('0x3')]]['talktime']=utils['diffTime'](agents[_0x1dec54['uniqueid']][_0x2452('0x51')],agents[_0x1dec54['uniqueid']][_0x2452('0x2d')]);agents[_0x1dec54['uniqueid']][_0x2452('0x1f')]=agents[_0x1dec54['uniqueid']][_0x2452('0x38')]?'transfer':_0x2452('0x52');agents[_0x1dec54[_0x2452('0x3')]][_0x2452('0xa')]=_0x2452('0x34');utils[_0x2452('0x16')](util['format'](_0x2452('0x4f'),_0x1dec54[_0x2452('0x3')],agents[_0x1dec54[_0x2452('0x3')]][_0x2452('0x6')],agents[_0x1dec54[_0x2452('0x3')]][_0x2452('0x1f')],agents[_0x1dec54[_0x2452('0x3')]][_0x2452('0xa')]));writeDB(agents[_0x1dec54[_0x2452('0x3')]]);}}catch(_0x3b681c){utils[_0x2452('0x17')](util['format'](_0x2452('0x4c'),_0x1dec54['uniqueid']),_0x3b681c);}}; \ No newline at end of file +var _0x9354=['agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','transfer','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error'];(function(_0x338bb1,_0x42f96e){var _0x4de306=function(_0x49e0ec){while(--_0x49e0ec){_0x338bb1['push'](_0x338bb1['shift']());}};_0x4de306(++_0x42f96e);}(_0x9354,0x96));var _0x4935=function(_0x4b8ecc,_0x4cd01c){_0x4b8ecc=_0x4b8ecc-0x0;var _0x48c1b9=_0x9354[_0x4b8ecc];return _0x48c1b9;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var utils=require(_0x4935('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4896da,_0x263dd5){utils[_0x4935('0x2')](util[_0x4935('0x3')](_0x4935('0x4'),_0x4896da['uniqueid'],_0x4896da[_0x4935('0x5')],_0x4896da[_0x4935('0x6')],_0x4896da[_0x4935('0x7')],_0x4896da[_0x4935('0x8')],_0x4896da[_0x4935('0x9')],_0x4896da[_0x4935('0xa')],_0x4896da[_0x4935('0xb')]));if(_0x4896da[_0x4935('0x6')]){utils[_0x4935('0xc')](_0x4896da['queue'])[_0x4935('0xd')](function(_0x47a44f){if(_0x47a44f){_0x4896da[_0x4935('0xe')]=_0x47a44f[_0x4935('0xe')];_0x4896da[_0x4935('0xf')]=_0x4896da[_0x4935('0x10')]?_0x47a44f[_0x4935('0x11')]:![];_0x4896da[_0x4935('0x12')]=_0x4896da['agentacw']?_0x47a44f['acwTimeout']:0x0;}utils[_0x4935('0x13')]('CreateVoiceAgentReport',_0x4896da);});}else{utils['request'](_0x4935('0x14'),_0x4896da);}if(_0x263dd5){delete transfers[_0x4896da[_0x4935('0x15')]];}else{delete agents[_0x4896da[_0x4935('0x16')]];}}exports[_0x4935('0x17')]=function(_0x3b246a){try{utils[_0x4935('0x18')](util[_0x4935('0x3')](_0x4935('0x19'),_0x3b246a[_0x4935('0x15')]),_0x3b246a);agents[_0x3b246a[_0x4935('0x16')]]=_0x3b246a;agents[_0x3b246a[_0x4935('0x16')]][_0x4935('0x1a')]=utils[_0x4935('0x1b')]();agents[_0x3b246a[_0x4935('0x16')]][_0x4935('0xb')]=_0x4935('0x1c');agents[_0x3b246a['destuniqueid']][_0x4935('0xa')]=null;agents[_0x3b246a[_0x4935('0x16')]][_0x4935('0x1d')]=null;utils[_0x4935('0x2')](util[_0x4935('0x3')](_0x4935('0x1e'),_0x3b246a['uniqueid'],agents[_0x3b246a[_0x4935('0x16')]][_0x4935('0x7')],_0x3b246a['destuniqueid']));}catch(_0x288eff){utils[_0x4935('0x1f')](util[_0x4935('0x3')]('[%s][agents][agentcalled]',_0x3b246a['uniqueid']),_0x288eff);}};exports[_0x4935('0x20')]=function(_0x6b849f){try{if(!_[_0x4935('0x21')](agents[_0x6b849f[_0x4935('0x16')]])){utils[_0x4935('0x18')](util[_0x4935('0x3')](_0x4935('0x22'),_0x6b849f[_0x4935('0x15')]),_0x6b849f);utils['info'](util[_0x4935('0x3')](_0x4935('0x23'),_0x6b849f[_0x4935('0x15')],agents[_0x6b849f[_0x4935('0x16')]][_0x4935('0x7')],_0x6b849f['destuniqueid']));agents[_0x6b849f['destuniqueid']][_0x4935('0x20')]=!![];agents[_0x6b849f[_0x4935('0x16')]][_0x4935('0x24')]=utils[_0x4935('0x1b')]();agents[_0x6b849f[_0x4935('0x16')]][_0x4935('0xb')]=_0x4935('0x25');agents[_0x6b849f[_0x4935('0x16')]][_0x4935('0x26')]=_0x4935('0x25');agents[_0x6b849f[_0x4935('0x16')]][_0x4935('0x27')]=_0x6b849f[_0x4935('0x28')]?parseInt(_0x6b849f[_0x4935('0x28')])/0x3e8:0x0;agents[_0x6b849f[_0x4935('0x16')]]['talktime']=0x0;unanswered['push'](_0x6b849f['destuniqueid']);}}catch(_0x1fc218){utils[_0x4935('0x1f')](util['format'](_0x4935('0x22'),_0x6b849f[_0x4935('0x15')]),_0x1fc218);}};exports[_0x4935('0x29')]=function(_0x9fe9f6){try{_[_0x4935('0x2a')](agents,function(_0x24262e,_0x28afc2){if(_0x24262e[_0x4935('0x15')]==_0x9fe9f6['uniqueid']&&!_[_0x4935('0x2b')](unanswered,_0x24262e[_0x4935('0x16')])){utils['debug'](util['format'](_0x4935('0x2c'),_0x9fe9f6['uniqueid']),_0x9fe9f6);utils[_0x4935('0x2')](util[_0x4935('0x3')](_0x4935('0x2d'),_0x9fe9f6['uniqueid'],_0x24262e['membername'],_0x24262e[_0x4935('0x16')]));_0x24262e[_0x4935('0x20')]=!![];_0x24262e['agentringnoanswerAt']=utils[_0x4935('0x1b')]();_0x24262e[_0x4935('0xb')]=_0x4935('0x2e');_0x24262e[_0x4935('0x26')]=_0x4935('0x2e');_0x24262e['holdtime']=_0x9fe9f6['holdtime'];_0x24262e[_0x4935('0x2f')]=0x0;writeDB(_0x24262e);}});}catch(_0x1016cc){utils['error'](util['format'](_0x4935('0x2c'),_0x9fe9f6['uniqueid']),_0x1016cc);}};exports[_0x4935('0x30')]=function(_0x3f32fb){try{if(agents[_0x3f32fb[_0x4935('0x16')]]){utils[_0x4935('0x18')](util[_0x4935('0x3')](_0x4935('0x31'),_0x3f32fb['uniqueid']),_0x3f32fb);utils[_0x4935('0x2')](util['format'](_0x4935('0x32'),_0x3f32fb['uniqueid'],agents[_0x3f32fb[_0x4935('0x16')]]['membername'],_0x3f32fb[_0x4935('0x16')]));agents[_0x3f32fb[_0x4935('0x16')]][_0x4935('0x33')]=utils[_0x4935('0x1b')]();agents[_0x3f32fb[_0x4935('0x16')]][_0x4935('0xa')]=_0x3f32fb[_0x4935('0xa')];agents[_0x3f32fb['destuniqueid']]['connectedlinename']=_0x3f32fb[_0x4935('0x1d')];agents[_0x3f32fb['destuniqueid']]['holdtime']=_0x3f32fb[_0x4935('0x28')];agents[_0x3f32fb['destuniqueid']][_0x4935('0xb')]=_0x4935('0x34');_[_0x4935('0x2a')](agents,function(_0x99b7c5,_0xb366e6){if(_0x99b7c5['destuniqueid']!=_0x3f32fb['destuniqueid']&&_0x99b7c5[_0x4935('0x15')]==_0x3f32fb[_0x4935('0x15')]){_0x99b7c5[_0x4935('0x2f')]=0x0;_0x99b7c5[_0x4935('0x27')]=_0x3f32fb[_0x4935('0x28')];_0x99b7c5[_0x4935('0x20')]=!![];_0x99b7c5[_0x4935('0x24')]=utils[_0x4935('0x1b')]();_0x99b7c5['lastevent']='answered_elsewhere';_0x99b7c5[_0x4935('0x26')]=_0x4935('0x35');_0x99b7c5['answeredelsewheredestinationuniqueid']=_0x3f32fb[_0x4935('0x16')];_0x99b7c5[_0x4935('0x36')]=_0x3f32fb[_0x4935('0x7')];writeDB(_0x99b7c5);}});}}catch(_0xe5c9f5){utils['error'](util['format'](_0x4935('0x31'),_0x3f32fb[_0x4935('0x15')]),_0xe5c9f5);}};exports['agentcomplete']=function(_0x1eaa47){try{if(!_[_0x4935('0x21')](agents[_0x1eaa47[_0x4935('0x16')]])){utils['debug'](util[_0x4935('0x3')](_0x4935('0x37'),_0x1eaa47[_0x4935('0x15')]),_0x1eaa47);utils[_0x4935('0x2')](util[_0x4935('0x3')](_0x4935('0x38'),_0x1eaa47[_0x4935('0x15')],agents[_0x1eaa47[_0x4935('0x16')]][_0x4935('0x7')],_0x1eaa47[_0x4935('0x16')]));agents[_0x1eaa47[_0x4935('0x16')]][_0x4935('0x10')]=!![];agents[_0x1eaa47[_0x4935('0x16')]][_0x4935('0x39')]=utils[_0x4935('0x1b')]();agents[_0x1eaa47[_0x4935('0x16')]][_0x4935('0x2f')]=utils[_0x4935('0x3a')](agents[_0x1eaa47['destuniqueid']][_0x4935('0x39')],agents[_0x1eaa47['destuniqueid']][_0x4935('0x33')]);agents[_0x1eaa47[_0x4935('0x16')]][_0x4935('0x26')]=_0x1eaa47[_0x4935('0x26')];agents[_0x1eaa47['destuniqueid']][_0x4935('0xb')]=_0x4935('0x3b');writeDB(agents[_0x1eaa47[_0x4935('0x16')]]);}}catch(_0xa55ce1){utils[_0x4935('0x1f')](util[_0x4935('0x3')](_0x4935('0x37'),_0x1eaa47[_0x4935('0x15')]),_0xa55ce1);}};exports[_0x4935('0x3c')]=function(_0x392cba){try{if(!_['isNil'](agents[_0x392cba[_0x4935('0x3d')]])){utils[_0x4935('0x18')](util['format'](_0x4935('0x3e'),_0x392cba[_0x4935('0x15')]),_0x392cba);utils[_0x4935('0x2')](util[_0x4935('0x3')](_0x4935('0x3f'),_0x392cba[_0x4935('0x15')],agents[_0x392cba[_0x4935('0x3d')]][_0x4935('0x7')],agents[_0x392cba['transfereruniqueid']][_0x4935('0x15')]));agents[_0x392cba['transfereruniqueid']]['transfer']=!![];agents[_0x392cba[_0x4935('0x3d')]][_0x4935('0x40')]=_0x4935('0x41');agents[_0x392cba[_0x4935('0x3d')]][_0x4935('0x42')]=_0x392cba['extension'];agents[_0x392cba[_0x4935('0x3d')]][_0x4935('0x43')]=agents[_0x392cba[_0x4935('0x3d')]][_0x4935('0x15')];}}catch(_0x377ff4){utils[_0x4935('0x1f')](util[_0x4935('0x3')](_0x4935('0x3e'),_0x392cba[_0x4935('0x15')]),_0x377ff4);}};exports[_0x4935('0x44')]=function(_0x4c1fb4){try{utils[_0x4935('0x18')](util['format'](_0x4935('0x45'),_0x4c1fb4[_0x4935('0x46')]),_0x4c1fb4);if(_0x4c1fb4['origtransfereruniqueid']==_0x4c1fb4[_0x4935('0x47')]){if(!_['isNil'](agents[_0x4c1fb4['secondtransfereruniqueid']])){utils['info'](util[_0x4935('0x3')](_0x4935('0x48'),_0x4c1fb4[_0x4935('0x46')],agents[_0x4c1fb4[_0x4935('0x49')]][_0x4935('0x7')]));agents[_0x4c1fb4['secondtransfereruniqueid']]['transfer']=!![];agents[_0x4c1fb4[_0x4935('0x49')]][_0x4935('0x40')]=_0x4935('0x4a');agents[_0x4c1fb4['secondtransfereruniqueid']][_0x4935('0x42')]=_0x4c1fb4[_0x4935('0x4b')];agents[_0x4c1fb4[_0x4935('0x49')]][_0x4935('0x43')]=_0x4c1fb4['origtransfereruniqueid'];}if(_0x4c1fb4[_0x4935('0x4c')]&&agents[_0x4c1fb4['transfereeuniqueid']]){agents[_0x4c1fb4['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x4c1fb4[_0x4935('0x4c')]]=_[_0x4935('0x4d')](agents[_0x4c1fb4['transfereeuniqueid']]);transfers[_0x4c1fb4[_0x4935('0x4c')]][_0x4935('0x9')]=agents[_0x4c1fb4['secondtransfereruniqueid']][_0x4935('0x9')];transfers[_0x4c1fb4[_0x4935('0x4c')]][_0x4935('0x4e')]=agents[_0x4c1fb4[_0x4935('0x49')]][_0x4935('0x4e')];transfers[_0x4c1fb4[_0x4935('0x4c')]][_0x4935('0x1a')]=utils['now']();transfers[_0x4c1fb4[_0x4935('0x4c')]]['agentconnectAt']=utils['now']();transfers[_0x4c1fb4[_0x4935('0x4c')]][_0x4935('0x27')]=0x0;transfers[_0x4c1fb4['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x4c1fb4[_0x4935('0x49')]==_0x4c1fb4[_0x4935('0x4f')]){if(!_[_0x4935('0x21')](agents[_0x4c1fb4['origtransfereruniqueid']])){utils[_0x4935('0x2')](util['format'](_0x4935('0x48'),_0x4c1fb4[_0x4935('0x46')],agents[_0x4c1fb4[_0x4935('0x46')]][_0x4935('0x7')]));agents[_0x4c1fb4[_0x4935('0x46')]]['transfer']=!![];agents[_0x4c1fb4[_0x4935('0x46')]][_0x4935('0x40')]='ATTENDED';agents[_0x4c1fb4[_0x4935('0x46')]][_0x4935('0x42')]=_0x4c1fb4[_0x4935('0x50')];agents[_0x4c1fb4[_0x4935('0x46')]][_0x4935('0x43')]=_0x4c1fb4[_0x4935('0x49')];}if(_0x4c1fb4[_0x4935('0x51')]&&agents[_0x4c1fb4[_0x4935('0x51')]]){agents[_0x4c1fb4[_0x4935('0x51')]][_0x4935('0x52')]=0x1;transfers[_0x4c1fb4[_0x4935('0x51')]]=_['clone'](agents[_0x4c1fb4[_0x4935('0x51')]]);transfers[_0x4c1fb4[_0x4935('0x51')]][_0x4935('0x9')]=agents[_0x4c1fb4[_0x4935('0x46')]][_0x4935('0x9')];transfers[_0x4c1fb4[_0x4935('0x51')]][_0x4935('0x4e')]=agents[_0x4c1fb4[_0x4935('0x46')]][_0x4935('0x4e')];transfers[_0x4c1fb4[_0x4935('0x51')]][_0x4935('0x1a')]=utils[_0x4935('0x1b')]();transfers[_0x4c1fb4[_0x4935('0x51')]]['agentconnectAt']=utils['now']();transfers[_0x4c1fb4[_0x4935('0x51')]][_0x4935('0x27')]=0x0;transfers[_0x4c1fb4['transfertargetuniqueid']][_0x4935('0x52')]=0x2;}}}catch(_0x30e77f){utils['error'](util['format'](_0x4935('0x45'),_0x4c1fb4[_0x4935('0x46')]),_0x30e77f);}};exports[_0x4935('0x53')]=function(_0x2abd63){try{utils[_0x4935('0x18')](util['format'](_0x4935('0x54'),_0x2abd63[_0x4935('0x15')]),_0x2abd63);if(agents[_0x2abd63[_0x4935('0x15')]]&&agents[_0x2abd63[_0x4935('0x15')]]['reason']===_0x4935('0x25')){if(_0x2abd63['cause']==='21'){agents[_0x2abd63['uniqueid']][_0x4935('0x26')]=_0x4935('0x55');agents[_0x2abd63['uniqueid']][_0x4935('0xb')]=_0x4935('0x55');}utils[_0x4935('0x2')](util['format'](_0x4935('0x56'),_0x2abd63['uniqueid'],agents[_0x2abd63['uniqueid']][_0x4935('0x7')],agents[_0x2abd63[_0x4935('0x15')]][_0x4935('0x26')],agents[_0x2abd63[_0x4935('0x15')]][_0x4935('0xb')]));writeDB(agents[_0x2abd63[_0x4935('0x15')]]);var _0x2eae00=unanswered[_0x4935('0x57')](_0x2abd63['uniqueid']);if(_0x2eae00>-0x1){unanswered[_0x4935('0x58')](_0x2eae00,0x1);}}if(transfers[_0x2abd63[_0x4935('0x15')]]){transfers[_0x2abd63[_0x4935('0x15')]]['agentcomplete']=!![];transfers[_0x2abd63['uniqueid']][_0x4935('0x39')]=utils[_0x4935('0x1b')]();transfers[_0x2abd63['uniqueid']][_0x4935('0x2f')]=utils['diffTime'](transfers[_0x2abd63['uniqueid']][_0x4935('0x39')],transfers[_0x2abd63[_0x4935('0x15')]][_0x4935('0x33')]);transfers[_0x2abd63['uniqueid']]['reason']=_0x4935('0x59');transfers[_0x2abd63['uniqueid']][_0x4935('0xb')]='complete';utils[_0x4935('0x2')](util[_0x4935('0x3')](_0x4935('0x56'),_0x2abd63[_0x4935('0x15')],transfers[_0x2abd63[_0x4935('0x15')]][_0x4935('0x7')],transfers[_0x2abd63[_0x4935('0x15')]]['reason'],transfers[_0x2abd63[_0x4935('0x15')]]['lastevent']));writeDB(transfers[_0x2abd63[_0x4935('0x15')]],!![]);}if(agents[_0x2abd63[_0x4935('0x15')]]&&agents[_0x2abd63['uniqueid']][_0x4935('0x33')]){agents[_0x2abd63['uniqueid']][_0x4935('0x10')]=!![];agents[_0x2abd63[_0x4935('0x15')]]['agentcompleteAt']=utils['now']();agents[_0x2abd63['uniqueid']][_0x4935('0x2f')]=utils['diffTime'](agents[_0x2abd63['uniqueid']][_0x4935('0x39')],agents[_0x2abd63['uniqueid']][_0x4935('0x33')]);agents[_0x2abd63['uniqueid']]['reason']=agents[_0x2abd63['uniqueid']][_0x4935('0x5a')]?'transfer':_0x4935('0x59');agents[_0x2abd63[_0x4935('0x15')]][_0x4935('0xb')]=_0x4935('0x3b');utils[_0x4935('0x2')](util['format'](_0x4935('0x56'),_0x2abd63[_0x4935('0x15')],agents[_0x2abd63['uniqueid']][_0x4935('0x7')],agents[_0x2abd63[_0x4935('0x15')]]['reason'],agents[_0x2abd63[_0x4935('0x15')]][_0x4935('0xb')]));writeDB(agents[_0x2abd63['uniqueid']]);}}catch(_0x390767){utils['error'](util[_0x4935('0x3')](_0x4935('0x54'),_0x2abd63['uniqueid']),_0x390767);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 171c25a..496df5a 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 _0x0e27=['_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%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','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','lastIndexOf','noop','gotoif','lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','answertime','hangup','debug','[%s][calls][hangup]','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','callerid','endtime','now','starttime','billableseconds','diffTime','error','attendedtransfer','localtwolinkedid','transfereechannel','origtransfereruniqueid','secondtransfererchannel','destinationchannel','userfield'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0x0e27,0x163));var _0x70e2=function(_0x101a01,_0x18bd83){_0x101a01=_0x101a01-0x0;var _0x538e92=_0x0e27[_0x101a01];return _0x538e92;};'use strict';var _=require(_0x70e2('0x0'));var util=require(_0x70e2('0x1'));var utils=require(_0x70e2('0x2'));var dispositions=[_0x70e2('0x3'),_0x70e2('0x4'),_0x70e2('0x4'),_0x70e2('0x3'),_0x70e2('0x3'),_0x70e2('0x3'),_0x70e2('0x5'),'BUSY',_0x70e2('0x4'),_0x70e2('0x4'),_0x70e2('0x4')];var channels={};function writeDB(_0x46d506){utils[_0x70e2('0x6')](util['format'](_0x70e2('0x7'),_0x46d506[_0x70e2('0x8')],_0x46d506[_0x70e2('0x9')],_0x46d506[_0x70e2('0xa')],_0x46d506[_0x70e2('0xb')],_0x46d506['interface'],_0x46d506[_0x70e2('0xc')],_0x46d506['connectedlinenum'],_0x46d506['lastevent']));if(_0x46d506[_0x70e2('0xd')]){utils[_0x70e2('0xe')](_0x46d506[_0x70e2('0xd')])[_0x70e2('0xf')](function(_0x1fa0cd){if(_0x1fa0cd){_0x46d506[_0x70e2('0x10')]=_0x1fa0cd['id'];}utils[_0x70e2('0x11')]('CreateVoiceCallReport',_0x46d506);});}else{utils[_0x70e2('0x11')](_0x70e2('0x12'),_0x46d506);}if(channels[_0x46d506['uniqueid']]){delete channels[_0x46d506['uniqueid']];}}exports[_0x70e2('0x13')]=function(_0x4cb2bc){try{utils['debug'](util['format'](_0x70e2('0x14'),_0x4cb2bc['uniqueid']),_0x4cb2bc);if(_0x4cb2bc[_0x70e2('0x8')]==_0x4cb2bc[_0x70e2('0x15')]&&_0x4cb2bc[_0x70e2('0x9')]!=_0x70e2('0x16')){utils['info'](util[_0x70e2('0x17')](_0x70e2('0x18'),_0x4cb2bc[_0x70e2('0x8')],_0x4cb2bc[_0x70e2('0x19')],_0x4cb2bc['exten']));channels[_0x4cb2bc[_0x70e2('0x8')]]={'uniqueid':_0x4cb2bc[_0x70e2('0x8')],'accountcode':_0x4cb2bc['accountcode'],'source':_0x4cb2bc['calleridnum'],'destination':_0x4cb2bc[_0x70e2('0x1a')],'destinationcontext':_0x4cb2bc[_0x70e2('0x19')],'channel':_0x4cb2bc[_0x70e2('0x9')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x900d2f){utils['error'](util[_0x70e2('0x17')](_0x70e2('0x14'),_0x4cb2bc[_0x70e2('0x8')]),_0x900d2f);}};exports[_0x70e2('0x1b')]=function(_0x4ff864){try{utils['debug'](util[_0x70e2('0x17')](_0x70e2('0x1c'),_0x4ff864[_0x70e2('0x8')]),_0x4ff864);if(!_[_0x70e2('0x1d')](channels[_0x4ff864[_0x70e2('0x8')]])&&_0x4ff864[_0x70e2('0x1e')]==0x6){utils[_0x70e2('0x6')](util[_0x70e2('0x17')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x4ff864[_0x70e2('0x8')],_0x4ff864[_0x70e2('0x19')],_0x4ff864['channel']));if(_[_0x70e2('0x1d')](channels[_0x4ff864[_0x70e2('0x8')]][_0x70e2('0x1f')])){channels[_0x4ff864[_0x70e2('0x8')]][_0x70e2('0x1f')]=utils['now']();}}else if(!_[_0x70e2('0x1d')](channels[_0x4ff864[_0x70e2('0x15')]])&&_0x4ff864[_0x70e2('0x1e')]==0x6&&_0x4ff864[_0x70e2('0x19')]!=_0x70e2('0x20')){utils['info'](util[_0x70e2('0x17')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x4ff864[_0x70e2('0x8')],_0x4ff864[_0x70e2('0x15')],_0x4ff864[_0x70e2('0x19')],_0x4ff864[_0x70e2('0x9')]));channels[_0x4ff864['linkedid']]['accountcode']=_0x4ff864['accountcode'];channels[_0x4ff864['linkedid']]['destinationchannel']=_0x4ff864[_0x70e2('0x9')];if(_[_0x70e2('0x1d')](channels[_0x4ff864[_0x70e2('0x15')]][_0x70e2('0x21')])){channels[_0x4ff864['linkedid']]['answertime']=utils['now']();}channels[_0x4ff864[_0x70e2('0x15')]]['disposition']=dispositions[_['toNumber'](_0x4ff864['channelstate'])]||_0x70e2('0x5');}}catch(_0x18712a){utils['error'](util[_0x70e2('0x17')](_0x70e2('0x1c'),_0x4ff864['uniqueid']),_0x18712a);}};exports[_0x70e2('0x22')]=function(_0x4c5d8b){try{if(!_[_0x70e2('0x1d')](channels[_0x4c5d8b[_0x70e2('0x8')]])){utils[_0x70e2('0x23')](util[_0x70e2('0x17')](_0x70e2('0x24'),_0x4c5d8b[_0x70e2('0x8')]),_0x4c5d8b);if(_[_0x70e2('0x1d')](channels[_0x4c5d8b[_0x70e2('0x8')]]['callerid'])){channels[_0x4c5d8b[_0x70e2('0x8')]]['callerid']=_0x4c5d8b[_0x70e2('0x25')]+'\x20<'+_0x4c5d8b[_0x70e2('0xc')]+'>';}utils[_0x70e2('0x6')](util[_0x70e2('0x17')](_0x70e2('0x26'),_0x4c5d8b['uniqueid'],channels[_0x4c5d8b[_0x70e2('0x8')]][_0x70e2('0x27')],_0x4c5d8b['cause-txt']));channels[_0x4c5d8b[_0x70e2('0x8')]][_0x70e2('0x28')]=utils[_0x70e2('0x29')]();channels[_0x4c5d8b[_0x70e2('0x8')]]['duration']=utils['diffTime'](channels[_0x4c5d8b[_0x70e2('0x8')]]['endtime'],channels[_0x4c5d8b[_0x70e2('0x8')]][_0x70e2('0x2a')]);channels[_0x4c5d8b[_0x70e2('0x8')]][_0x70e2('0x2b')]=channels[_0x4c5d8b['uniqueid']][_0x70e2('0x21')]?utils[_0x70e2('0x2c')](channels[_0x4c5d8b[_0x70e2('0x8')]][_0x70e2('0x28')],channels[_0x4c5d8b[_0x70e2('0x8')]][_0x70e2('0x21')]):0x0;writeDB(channels[_0x4c5d8b[_0x70e2('0x8')]]);}}catch(_0x3569ec){utils[_0x70e2('0x2d')](util[_0x70e2('0x17')](_0x70e2('0x24'),_0x4c5d8b[_0x70e2('0x8')]),_0x3569ec);}};exports[_0x70e2('0x2e')]=function(_0xfa9688){try{if(!_[_0x70e2('0x1d')](channels[_0xfa9688['localtwolinkedid']])){utils[_0x70e2('0x23')](util[_0x70e2('0x17')]('[%s][calls][attendedtransfer]',_0xfa9688['origtransfereruniqueid']),_0xfa9688);if(channels[_0xfa9688[_0x70e2('0x2f')]][_0x70e2('0x9')]==_0xfa9688[_0x70e2('0x30')]){utils[_0x70e2('0x6')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xfa9688[_0x70e2('0x31')],_0xfa9688['localtwolinkedid'],_0xfa9688[_0x70e2('0x32')]));channels[_0xfa9688[_0x70e2('0x2f')]][_0x70e2('0x33')]=_0xfa9688[_0x70e2('0x32')];channels[_0xfa9688[_0x70e2('0x2f')]][_0x70e2('0x34')]=_0x70e2('0x35');}else if(channels[_0xfa9688[_0x70e2('0x2f')]][_0x70e2('0x9')]=_0xfa9688[_0x70e2('0x36')]){utils['info'](util[_0x70e2('0x17')](_0x70e2('0x37'),_0xfa9688[_0x70e2('0x31')],_0xfa9688['localtwolinkedid'],_0xfa9688[_0x70e2('0x38')]));channels[_0xfa9688[_0x70e2('0x2f')]][_0x70e2('0x33')]=_0xfa9688[_0x70e2('0x38')];channels[_0xfa9688['localtwolinkedid']]['userfield']=_0x70e2('0x35');}}}catch(_0x327953){utils[_0x70e2('0x2d')](util[_0x70e2('0x17')](_0x70e2('0x39'),_0xfa9688[_0x70e2('0x31')]),_0x327953);}};exports[_0x70e2('0x3a')]=function(_0x5bc249){try{if(!_[_0x70e2('0x1d')](channels[_0x5bc249['uniqueid']])){utils[_0x70e2('0x23')](util['format'](_0x70e2('0x3b'),_0x5bc249[_0x70e2('0x8')]),_0x5bc249);channels[_0x5bc249['uniqueid']][_0x70e2('0x3c')]=utils[_0x70e2('0x29')]();utils[_0x70e2('0x6')](util[_0x70e2('0x17')](_0x70e2('0x3d'),_0x5bc249[_0x70e2('0x8')],channels[_0x5bc249[_0x70e2('0x8')]][_0x70e2('0x3c')]));}}catch(_0x3eb1ae){utils[_0x70e2('0x2d')](util[_0x70e2('0x17')](_0x70e2('0x3b'),_0x5bc249[_0x70e2('0x8')]),_0x3eb1ae);}};exports['musiconholdstop']=function(_0x3b4227){try{if(!_[_0x70e2('0x1d')](channels[_0x3b4227['uniqueid']])){utils['debug'](util['format'](_0x70e2('0x3e'),_0x3b4227['uniqueid']),_0x3b4227);if(!_[_0x70e2('0x1d')](channels[_0x3b4227[_0x70e2('0x8')]]['musiconholdstartAt'])){channels[_0x3b4227[_0x70e2('0x8')]][_0x70e2('0x3f')]+=utils[_0x70e2('0x2c')](utils[_0x70e2('0x29')](),channels[_0x3b4227[_0x70e2('0x8')]]['musiconholdstartAt']);utils[_0x70e2('0x6')](util[_0x70e2('0x17')](_0x70e2('0x40'),_0x3b4227[_0x70e2('0x8')],channels[_0x3b4227['uniqueid']][_0x70e2('0x3f')]));delete channels[_0x3b4227[_0x70e2('0x8')]][_0x70e2('0x3c')];}}}catch(_0xce16ad){utils[_0x70e2('0x2d')](util[_0x70e2('0x17')](_0x70e2('0x3e'),_0x3b4227[_0x70e2('0x8')]),_0xce16ad);}};exports[_0x70e2('0x41')]=function(_0x13ea64){try{if(!_[_0x70e2('0x1d')](channels[_0x13ea64[_0x70e2('0x8')]])){utils[_0x70e2('0x23')](util[_0x70e2('0x17')](_0x70e2('0x42'),_0x13ea64[_0x70e2('0x8')]),_0x13ea64);if(!_[_0x70e2('0x1d')](_0x13ea64['variable'][_0x70e2('0x43')])){utils['info'](util[_0x70e2('0x17')](_0x70e2('0x44'),_0x13ea64[_0x70e2('0x8')],_0x13ea64[_0x70e2('0x45')]));channels[_0x13ea64[_0x70e2('0x8')]][_0x70e2('0x46')]=_0x13ea64[_0x70e2('0x45')];}if(!_['isNil'](_0x13ea64[_0x70e2('0x47')][_0x70e2('0x48')])){utils['info'](util['format'](_0x70e2('0x49'),_0x13ea64[_0x70e2('0x8')],_0x13ea64[_0x70e2('0x45')]));channels[_0x13ea64[_0x70e2('0x8')]][_0x70e2('0x4a')]=_0x13ea64[_0x70e2('0x45')];channels[_0x13ea64['uniqueid']][_0x70e2('0x27')]='\x22'+_0x13ea64['value']+_0x70e2('0x4b')+_0x13ea64['value']+'>';}if(!_[_0x70e2('0x1d')](_0x13ea64[_0x70e2('0x47')]['xmd-callerid-preview'])||!_[_0x70e2('0x1d')](_0x13ea64[_0x70e2('0x47')][_0x70e2('0x4c')])){utils[_0x70e2('0x6')](util[_0x70e2('0x17')](_0x70e2('0x4d'),_0x13ea64['uniqueid'],!_[_0x70e2('0x1d')](_0x13ea64[_0x70e2('0x47')]['xmd-callerid-preview'])?_0x70e2('0x4e'):_0x70e2('0x4c'),_0x13ea64['value']));channels[_0x13ea64[_0x70e2('0x8')]][_0x70e2('0x27')]=_0x13ea64[_0x70e2('0x45')];}if(!_[_0x70e2('0x1d')](_0x13ea64[_0x70e2('0x47')][_0x70e2('0x4f')])||!_[_0x70e2('0x1d')](_0x13ea64[_0x70e2('0x47')]['xmcs-queue'])){utils[_0x70e2('0x6')](util[_0x70e2('0x17')](_0x70e2('0x4d'),_0x13ea64[_0x70e2('0x8')],!_[_0x70e2('0x1d')](_0x13ea64[_0x70e2('0x47')]['xmd-queue'])?_0x70e2('0x4f'):_0x70e2('0x50'),_0x13ea64[_0x70e2('0x45')]));channels[_0x13ea64['uniqueid']][_0x70e2('0x51')]=_0x70e2('0x52');channels[_0x13ea64['uniqueid']]['lastdata']=_0x13ea64['value'];channels[_0x13ea64[_0x70e2('0x8')]][_0x70e2('0xa')]=!![];}if(!_['isNil'](_0x13ea64[_0x70e2('0x47')][_0x70e2('0x53')])){utils[_0x70e2('0x6')](util[_0x70e2('0x17')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x13ea64[_0x70e2('0x8')],_0x13ea64[_0x70e2('0x45')]));channels[_0x13ea64['uniqueid']][_0x70e2('0x54')]=_0x13ea64[_0x70e2('0x45')];}if(!_['isNil'](_0x13ea64[_0x70e2('0x47')][_0x70e2('0x55')])){utils[_0x70e2('0x6')](util[_0x70e2('0x17')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x13ea64[_0x70e2('0x8')],_0x13ea64[_0x70e2('0x45')]));channels[_0x13ea64['uniqueid']]['type']=_0x13ea64['value'];}if(!_['isNil'](_0x13ea64['variable'][_0x70e2('0x56')])){utils[_0x70e2('0x6')](util[_0x70e2('0x17')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x13ea64['uniqueid'],_0x13ea64[_0x70e2('0x45')]));channels[_0x13ea64[_0x70e2('0x8')]]['routeid']=_0x13ea64[_0x70e2('0x45')];}if(!_[_0x70e2('0x1d')](_0x13ea64[_0x70e2('0x47')][_0x70e2('0x57')])){utils[_0x70e2('0x6')](util['format'](_0x70e2('0x58'),_0x13ea64[_0x70e2('0x8')],_0x13ea64[_0x70e2('0x45')]));channels[_0x13ea64[_0x70e2('0x8')]][_0x70e2('0x57')]=_0x13ea64['value'];}}}catch(_0x3ff2ed){utils[_0x70e2('0x2d')](util['format']('[%s][calls][varset]',_0x13ea64[_0x70e2('0x8')]),_0x3ff2ed);}};exports['newexten']=function(_0x3316d6){try{if(!_[_0x70e2('0x1d')](channels[_0x3316d6[_0x70e2('0x8')]])){utils[_0x70e2('0x23')](util[_0x70e2('0x17')](_0x70e2('0x59'),_0x3316d6['uniqueid']),_0x3316d6);utils[_0x70e2('0x6')](util[_0x70e2('0x17')](_0x70e2('0x5a'),_0x3316d6[_0x70e2('0x8')],_0x3316d6[_0x70e2('0x5b')],_0x3316d6[_0x70e2('0x5c')]));if(_0x3316d6[_0x70e2('0x5b')][_0x70e2('0x5d')]()==_0x70e2('0x5e')&&_[_0x70e2('0x5f')](_0x3316d6[_0x70e2('0x5c')][_0x70e2('0x5d')](),_0x70e2('0x60'))){var _0x19971c=_0x3316d6[_0x70e2('0x5c')][_0x70e2('0x61')]('=');var _0x5b2c5e=_0x19971c[0x0]['substring'](_0x19971c[0x0][_0x70e2('0x62')]('(')+0x1,_0x19971c[0x0][_0x70e2('0x62')](')'));var _0x225e16=_0x19971c[0x1];channels[_0x3316d6['uniqueid']][_0x5b2c5e]=_0x225e16;}if(!_['includes']([_0x70e2('0x22'),_0x70e2('0x63'),'execif','set',_0x70e2('0x64')],_0x3316d6[_0x70e2('0x5b')]['toLowerCase']())){channels[_0x3316d6[_0x70e2('0x8')]]['lastapplication']=_0x3316d6[_0x70e2('0x5b')];channels[_0x3316d6[_0x70e2('0x8')]][_0x70e2('0x65')]=_0x3316d6['appdata'];}}}catch(_0x12f7e5){utils[_0x70e2('0x2d')](util[_0x70e2('0x17')](_0x70e2('0x59'),_0x3316d6[_0x70e2('0x8')]),_0x12f7e5);}}; \ No newline at end of file +var _0x9e13=['format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','diffTime','starttime','billableseconds','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','mohtime','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed'];(function(_0x172856,_0x13bc1f){var _0xc158fc=function(_0x2df1bf){while(--_0x2df1bf){_0x172856['push'](_0x172856['shift']());}};_0xc158fc(++_0x13bc1f);}(_0x9e13,0x190));var _0x39e1=function(_0x3e37ed,_0x373d5a){_0x3e37ed=_0x3e37ed-0x0;var _0x432e99=_0x9e13[_0x3e37ed];return _0x432e99;};'use strict';var _=require(_0x39e1('0x0'));var util=require(_0x39e1('0x1'));var utils=require(_0x39e1('0x2'));var dispositions=[_0x39e1('0x3'),_0x39e1('0x4'),_0x39e1('0x4'),'NO\x20ANSWER',_0x39e1('0x3'),_0x39e1('0x3'),'ANSWERED','BUSY',_0x39e1('0x4'),_0x39e1('0x4'),'FAILED'];var channels={};function writeDB(_0x5e49a8){utils[_0x39e1('0x5')](util['format'](_0x39e1('0x6'),_0x5e49a8[_0x39e1('0x7')],_0x5e49a8[_0x39e1('0x8')],_0x5e49a8[_0x39e1('0x9')],_0x5e49a8[_0x39e1('0xa')],_0x5e49a8[_0x39e1('0xb')],_0x5e49a8[_0x39e1('0xc')],_0x5e49a8[_0x39e1('0xd')],_0x5e49a8['lastevent']));if(_0x5e49a8[_0x39e1('0xe')]){utils[_0x39e1('0xf')](_0x5e49a8[_0x39e1('0xe')])[_0x39e1('0x10')](function(_0x2cdffa){if(_0x2cdffa){_0x5e49a8[_0x39e1('0x11')]=_0x2cdffa['id'];}utils[_0x39e1('0x12')]('CreateVoiceCallReport',_0x5e49a8);});}else{utils[_0x39e1('0x12')]('CreateVoiceCallReport',_0x5e49a8);}if(channels[_0x5e49a8[_0x39e1('0x7')]]){delete channels[_0x5e49a8[_0x39e1('0x7')]];}}exports[_0x39e1('0x13')]=function(_0x540b98){try{utils[_0x39e1('0x14')](util['format'](_0x39e1('0x15'),_0x540b98[_0x39e1('0x7')]),_0x540b98);if(_0x540b98[_0x39e1('0x7')]==_0x540b98[_0x39e1('0x16')]&&_0x540b98[_0x39e1('0x8')]!=_0x39e1('0x17')){utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x19'),_0x540b98['uniqueid'],_0x540b98[_0x39e1('0x1a')],_0x540b98[_0x39e1('0x1b')]));channels[_0x540b98[_0x39e1('0x7')]]={'uniqueid':_0x540b98[_0x39e1('0x7')],'accountcode':_0x540b98[_0x39e1('0xe')],'source':_0x540b98[_0x39e1('0xc')],'destination':_0x540b98['exten'],'destinationcontext':_0x540b98[_0x39e1('0x1a')],'channel':_0x540b98['channel'],'starttime':utils[_0x39e1('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x39e1('0x3'),'amaflags':_0x39e1('0x1d')};}}catch(_0x43ee6f){utils[_0x39e1('0x1e')](util[_0x39e1('0x18')](_0x39e1('0x15'),_0x540b98[_0x39e1('0x7')]),_0x43ee6f);}};exports[_0x39e1('0x1f')]=function(_0x58903f){try{utils['debug'](util['format']('[%s][calls][newstate]',_0x58903f[_0x39e1('0x7')]),_0x58903f);if(!_[_0x39e1('0x20')](channels[_0x58903f[_0x39e1('0x7')]])&&_0x58903f[_0x39e1('0x21')]==0x6){utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x22'),_0x58903f[_0x39e1('0x7')],_0x58903f[_0x39e1('0x1a')],_0x58903f[_0x39e1('0x8')]));if(_[_0x39e1('0x20')](channels[_0x58903f['uniqueid']][_0x39e1('0x23')])){channels[_0x58903f['uniqueid']]['systemanswertime']=utils[_0x39e1('0x1c')]();}}else if(!_[_0x39e1('0x20')](channels[_0x58903f['linkedid']])&&_0x58903f[_0x39e1('0x21')]==0x6&&_0x58903f[_0x39e1('0x1a')]!='transfer'){utils['info'](util[_0x39e1('0x18')](_0x39e1('0x24'),_0x58903f['uniqueid'],_0x58903f[_0x39e1('0x16')],_0x58903f[_0x39e1('0x1a')],_0x58903f[_0x39e1('0x8')]));channels[_0x58903f[_0x39e1('0x16')]]['accountcode']=_0x58903f[_0x39e1('0xe')];channels[_0x58903f[_0x39e1('0x16')]][_0x39e1('0x25')]=_0x58903f[_0x39e1('0x8')];if(_[_0x39e1('0x20')](channels[_0x58903f[_0x39e1('0x16')]][_0x39e1('0x26')])){channels[_0x58903f[_0x39e1('0x16')]][_0x39e1('0x26')]=utils[_0x39e1('0x1c')]();}channels[_0x58903f[_0x39e1('0x16')]][_0x39e1('0x27')]=dispositions[_[_0x39e1('0x28')](_0x58903f[_0x39e1('0x21')])]||_0x39e1('0x29');}}catch(_0x4b9f26){utils[_0x39e1('0x1e')](util[_0x39e1('0x18')]('[%s][calls][newstate]',_0x58903f[_0x39e1('0x7')]),_0x4b9f26);}};exports[_0x39e1('0x2a')]=function(_0x1552f6){try{if(!_['isNil'](channels[_0x1552f6[_0x39e1('0x7')]])){utils[_0x39e1('0x14')](util[_0x39e1('0x18')](_0x39e1('0x2b'),_0x1552f6[_0x39e1('0x7')]),_0x1552f6);if(_[_0x39e1('0x20')](channels[_0x1552f6[_0x39e1('0x7')]]['callerid'])){channels[_0x1552f6[_0x39e1('0x7')]][_0x39e1('0x2c')]=_0x1552f6[_0x39e1('0x2d')]+'\x20<'+_0x1552f6[_0x39e1('0xc')]+'>';}utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x2e'),_0x1552f6[_0x39e1('0x7')],channels[_0x1552f6[_0x39e1('0x7')]][_0x39e1('0x2c')],_0x1552f6['cause-txt']));channels[_0x1552f6[_0x39e1('0x7')]][_0x39e1('0x2f')]=utils[_0x39e1('0x1c')]();channels[_0x1552f6[_0x39e1('0x7')]]['duration']=utils[_0x39e1('0x30')](channels[_0x1552f6['uniqueid']][_0x39e1('0x2f')],channels[_0x1552f6['uniqueid']][_0x39e1('0x31')]);channels[_0x1552f6['uniqueid']][_0x39e1('0x32')]=channels[_0x1552f6[_0x39e1('0x7')]]['answertime']?utils['diffTime'](channels[_0x1552f6[_0x39e1('0x7')]]['endtime'],channels[_0x1552f6[_0x39e1('0x7')]][_0x39e1('0x26')]):0x0;writeDB(channels[_0x1552f6[_0x39e1('0x7')]]);}}catch(_0x6e6fec){utils[_0x39e1('0x1e')](util[_0x39e1('0x18')](_0x39e1('0x2b'),_0x1552f6[_0x39e1('0x7')]),_0x6e6fec);}};exports[_0x39e1('0x33')]=function(_0x4af8b5){try{if(!_[_0x39e1('0x20')](channels[_0x4af8b5['localtwolinkedid']])){utils[_0x39e1('0x14')](util[_0x39e1('0x18')](_0x39e1('0x34'),_0x4af8b5[_0x39e1('0x35')]),_0x4af8b5);if(channels[_0x4af8b5[_0x39e1('0x36')]][_0x39e1('0x8')]==_0x4af8b5['transfereechannel']){utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x37'),_0x4af8b5['origtransfereruniqueid'],_0x4af8b5[_0x39e1('0x36')],_0x4af8b5[_0x39e1('0x38')]));channels[_0x4af8b5['localtwolinkedid']][_0x39e1('0x25')]=_0x4af8b5[_0x39e1('0x38')];channels[_0x4af8b5['localtwolinkedid']]['userfield']=_0x39e1('0x39');}else if(channels[_0x4af8b5[_0x39e1('0x36')]][_0x39e1('0x8')]=_0x4af8b5[_0x39e1('0x3a')]){utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x37'),_0x4af8b5[_0x39e1('0x35')],_0x4af8b5['localtwolinkedid'],_0x4af8b5['origtransfererchannel']));channels[_0x4af8b5['localtwolinkedid']][_0x39e1('0x25')]=_0x4af8b5[_0x39e1('0x3b')];channels[_0x4af8b5[_0x39e1('0x36')]][_0x39e1('0x3c')]=_0x39e1('0x39');}}}catch(_0x3d2e86){utils[_0x39e1('0x1e')](util[_0x39e1('0x18')](_0x39e1('0x34'),_0x4af8b5[_0x39e1('0x35')]),_0x3d2e86);}};exports['musiconholdstart']=function(_0x33bdcb){try{if(!_['isNil'](channels[_0x33bdcb[_0x39e1('0x7')]])){utils[_0x39e1('0x14')](util[_0x39e1('0x18')](_0x39e1('0x3d'),_0x33bdcb[_0x39e1('0x7')]),_0x33bdcb);channels[_0x33bdcb[_0x39e1('0x7')]][_0x39e1('0x3e')]=utils[_0x39e1('0x1c')]();utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x3f'),_0x33bdcb[_0x39e1('0x7')],channels[_0x33bdcb[_0x39e1('0x7')]]['musiconholdstartAt']));}}catch(_0x32d7bd){utils[_0x39e1('0x1e')](util['format']('[%s][calls][musiconholdstart]',_0x33bdcb[_0x39e1('0x7')]),_0x32d7bd);}};exports['musiconholdstop']=function(_0x1404e0){try{if(!_[_0x39e1('0x20')](channels[_0x1404e0[_0x39e1('0x7')]])){utils[_0x39e1('0x14')](util[_0x39e1('0x18')]('[%s][calls][musiconholdstop]',_0x1404e0['uniqueid']),_0x1404e0);if(!_[_0x39e1('0x20')](channels[_0x1404e0[_0x39e1('0x7')]][_0x39e1('0x3e')])){channels[_0x1404e0[_0x39e1('0x7')]][_0x39e1('0x40')]+=utils[_0x39e1('0x30')](utils['now'](),channels[_0x1404e0[_0x39e1('0x7')]][_0x39e1('0x3e')]);utils[_0x39e1('0x5')](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x1404e0[_0x39e1('0x7')],channels[_0x1404e0[_0x39e1('0x7')]][_0x39e1('0x40')]));delete channels[_0x1404e0['uniqueid']][_0x39e1('0x3e')];}}}catch(_0x80e424){utils[_0x39e1('0x1e')](util[_0x39e1('0x18')](_0x39e1('0x41'),_0x1404e0[_0x39e1('0x7')]),_0x80e424);}};exports[_0x39e1('0x42')]=function(_0x1fc81e){try{if(!_[_0x39e1('0x20')](channels[_0x1fc81e[_0x39e1('0x7')]])){utils[_0x39e1('0x14')](util[_0x39e1('0x18')](_0x39e1('0x43'),_0x1fc81e[_0x39e1('0x7')]),_0x1fc81e);if(!_[_0x39e1('0x20')](_0x1fc81e[_0x39e1('0x44')]['xmd-originatecalleridnum'])){utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x45'),_0x1fc81e[_0x39e1('0x7')],_0x1fc81e[_0x39e1('0x46')]));channels[_0x1fc81e[_0x39e1('0x7')]]['source']=_0x1fc81e[_0x39e1('0x46')];}if(!_[_0x39e1('0x20')](_0x1fc81e[_0x39e1('0x44')]['xmd-phone'])){utils['info'](util[_0x39e1('0x18')](_0x39e1('0x47'),_0x1fc81e[_0x39e1('0x7')],_0x1fc81e[_0x39e1('0x46')]));channels[_0x1fc81e[_0x39e1('0x7')]][_0x39e1('0x48')]=_0x1fc81e[_0x39e1('0x46')];channels[_0x1fc81e['uniqueid']][_0x39e1('0x2c')]='\x22'+_0x1fc81e[_0x39e1('0x46')]+_0x39e1('0x49')+_0x1fc81e[_0x39e1('0x46')]+'>';}if(!_['isNil'](_0x1fc81e['variable'][_0x39e1('0x4a')])||!_[_0x39e1('0x20')](_0x1fc81e[_0x39e1('0x44')]['xmd-callerid'])){utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x4b'),_0x1fc81e['uniqueid'],!_['isNil'](_0x1fc81e[_0x39e1('0x44')][_0x39e1('0x4a')])?_0x39e1('0x4a'):'xmd-callerid',_0x1fc81e['value']));channels[_0x1fc81e[_0x39e1('0x7')]][_0x39e1('0x2c')]=_0x1fc81e[_0x39e1('0x46')];}if(!_[_0x39e1('0x20')](_0x1fc81e[_0x39e1('0x44')][_0x39e1('0x4c')])||!_[_0x39e1('0x20')](_0x1fc81e[_0x39e1('0x44')][_0x39e1('0x4d')])){utils['info'](util['format'](_0x39e1('0x4b'),_0x1fc81e[_0x39e1('0x7')],!_['isNil'](_0x1fc81e['variable'][_0x39e1('0x4c')])?'xmd-queue':_0x39e1('0x4d'),_0x1fc81e[_0x39e1('0x46')]));channels[_0x1fc81e[_0x39e1('0x7')]][_0x39e1('0x4e')]=_0x39e1('0x4f');channels[_0x1fc81e['uniqueid']][_0x39e1('0x50')]=_0x1fc81e[_0x39e1('0x46')];channels[_0x1fc81e['uniqueid']][_0x39e1('0x9')]=!![];}if(!_['isNil'](_0x1fc81e[_0x39e1('0x44')][_0x39e1('0x51')])){utils['info'](util['format'](_0x39e1('0x52'),_0x1fc81e[_0x39e1('0x7')],_0x1fc81e[_0x39e1('0x46')]));channels[_0x1fc81e['uniqueid']][_0x39e1('0x53')]=_0x1fc81e['value'];}if(!_['isNil'](_0x1fc81e[_0x39e1('0x44')][_0x39e1('0x54')])){utils['info'](util[_0x39e1('0x18')](_0x39e1('0x55'),_0x1fc81e[_0x39e1('0x7')],_0x1fc81e['value']));channels[_0x1fc81e[_0x39e1('0x7')]][_0x39e1('0x56')]=_0x1fc81e[_0x39e1('0x46')];}if(!_[_0x39e1('0x20')](_0x1fc81e[_0x39e1('0x44')][_0x39e1('0x57')])){utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x58'),_0x1fc81e[_0x39e1('0x7')],_0x1fc81e[_0x39e1('0x46')]));channels[_0x1fc81e[_0x39e1('0x7')]][_0x39e1('0x59')]=_0x1fc81e[_0x39e1('0x46')];}if(!_[_0x39e1('0x20')](_0x1fc81e[_0x39e1('0x44')]['sipcallid'])){utils['info'](util[_0x39e1('0x18')](_0x39e1('0x5a'),_0x1fc81e['uniqueid'],_0x1fc81e[_0x39e1('0x46')]));channels[_0x1fc81e[_0x39e1('0x7')]]['sipcallid']=_0x1fc81e['value'];}}}catch(_0x38c895){utils['error'](util[_0x39e1('0x18')](_0x39e1('0x43'),_0x1fc81e[_0x39e1('0x7')]),_0x38c895);}};exports[_0x39e1('0x5b')]=function(_0x328d2b){try{if(!_[_0x39e1('0x20')](channels[_0x328d2b[_0x39e1('0x7')]])){utils[_0x39e1('0x14')](util[_0x39e1('0x18')]('[%s][calls][newexten]',_0x328d2b[_0x39e1('0x7')]),_0x328d2b);utils[_0x39e1('0x5')](util[_0x39e1('0x18')](_0x39e1('0x5c'),_0x328d2b['uniqueid'],_0x328d2b[_0x39e1('0x5d')],_0x328d2b[_0x39e1('0x5e')]));if(_0x328d2b[_0x39e1('0x5d')][_0x39e1('0x5f')]()==_0x39e1('0x60')&&_[_0x39e1('0x61')](_0x328d2b[_0x39e1('0x5e')][_0x39e1('0x5f')](),_0x39e1('0x62'))){var _0x2c1fe3=_0x328d2b[_0x39e1('0x5e')][_0x39e1('0x63')]('=');var _0x3f53f8=_0x2c1fe3[0x0][_0x39e1('0x64')](_0x2c1fe3[0x0][_0x39e1('0x65')]('(')+0x1,_0x2c1fe3[0x0][_0x39e1('0x65')](')'));var _0x2a26fb=_0x2c1fe3[0x1];channels[_0x328d2b[_0x39e1('0x7')]][_0x3f53f8]=_0x2a26fb;}if(!_[_0x39e1('0x66')](['hangup',_0x39e1('0x67'),_0x39e1('0x68'),'set',_0x39e1('0x69')],_0x328d2b[_0x39e1('0x5d')][_0x39e1('0x5f')]())){channels[_0x328d2b[_0x39e1('0x7')]][_0x39e1('0x4e')]=_0x328d2b[_0x39e1('0x5d')];channels[_0x328d2b[_0x39e1('0x7')]]['lastdata']=_0x328d2b['appdata'];}}}catch(_0x3f25e7){utils[_0x39e1('0x1e')](util[_0x39e1('0x18')]('[%s][calls][newexten]',_0x328d2b['uniqueid']),_0x3f25e7);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index eec7770..ecaab85 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 _0x70e8=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x2a9c0a,_0x19162d){var _0x20798c=function(_0x121240){while(--_0x121240){_0x2a9c0a['push'](_0x2a9c0a['shift']());}};_0x20798c(++_0x19162d);}(_0x70e8,0x18d));var _0x870e=function(_0x1ce9d8,_0x47e1f7){_0x1ce9d8=_0x1ce9d8-0x0;var _0x4e2438=_0x70e8[_0x1ce9d8];return _0x4e2438;};'use strict';var utils=require(_0x870e('0x0'));exports[_0x870e('0x1')]=function(){utils[_0x870e('0x2')](_0x870e('0x3'));};exports[_0x870e('0x4')]=function(){utils[_0x870e('0x2')](_0x870e('0x5'));};exports[_0x870e('0x6')]=function(){utils[_0x870e('0x2')](_0x870e('0x7'));};exports[_0x870e('0x8')]=function(_0x269605){utils[_0x870e('0x8')](_0x870e('0x9'),_0x269605);};exports[_0x870e('0xa')]=function(){utils['info'](_0x870e('0xb'));};exports[_0x870e('0xc')]=function(_0x1944c5){}; \ No newline at end of file +var _0x8ee8=['[core]\x20connected','shutdown','info','fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close','managerevent','./utils'];(function(_0x4da735,_0x22a02a){var _0x57dfc8=function(_0x2b67ea){while(--_0x2b67ea){_0x4da735['push'](_0x4da735['shift']());}};_0x57dfc8(++_0x22a02a);}(_0x8ee8,0x8b));var _0x88ee=function(_0x4e98fb,_0x5709f5){_0x4e98fb=_0x4e98fb-0x0;var _0x132c42=_0x8ee8[_0x4e98fb];return _0x132c42;};'use strict';var utils=require(_0x88ee('0x0'));exports['connect']=function(){utils['info'](_0x88ee('0x1'));};exports[_0x88ee('0x2')]=function(){utils[_0x88ee('0x3')]('[core]\x20shutdown');};exports[_0x88ee('0x4')]=function(){utils[_0x88ee('0x3')](_0x88ee('0x5'));};exports[_0x88ee('0x6')]=function(_0xd2e1e9){utils[_0x88ee('0x6')](_0x88ee('0x7'),_0xd2e1e9);};exports['close']=function(){utils['info'](_0x88ee('0x8'));};exports[_0x88ee('0x9')]=function(_0x46fd47){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index e7947e6..36af1ee 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 _0xe40b=['[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','starttime','lastevent','called','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]','hangup','calleridname','cause-txt','now','duration','diffTime','endtime','holdtime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug'];(function(_0x21fe98,_0x55db4c){var _0x19dde3=function(_0x3c38ae){while(--_0x3c38ae){_0x21fe98['push'](_0x21fe98['shift']());}};_0x19dde3(++_0x55db4c);}(_0xe40b,0x189));var _0xbe40=function(_0x930cf7,_0x368e48){_0x930cf7=_0x930cf7-0x0;var _0x151ce3=_0xe40b[_0x930cf7];return _0x151ce3;};'use strict';var _=require('lodash');var util=require(_0xbe40('0x0'));var utils=require(_0xbe40('0x1'));var dials={};function writeDB(_0x3289cd){utils[_0xbe40('0x2')](util[_0xbe40('0x3')](_0xbe40('0x4'),_0x3289cd['uniqueid'],_0x3289cd[_0xbe40('0x5')],_0x3289cd[_0xbe40('0x6')],_0x3289cd[_0xbe40('0x7')],_0x3289cd[_0xbe40('0x8')],_0x3289cd[_0xbe40('0x9')]));utils[_0xbe40('0xa')](_0xbe40('0xb'),_0x3289cd);delete dials[_0x3289cd[_0xbe40('0xc')]];}exports[_0xbe40('0xd')]=function(_0x474ffc){try{utils[_0xbe40('0xe')](util[_0xbe40('0x3')](_0xbe40('0xf'),_0x474ffc[_0xbe40('0xc')]),_0x474ffc);utils[_0xbe40('0x2')](util[_0xbe40('0x3')](_0xbe40('0x10'),_0x474ffc[_0xbe40('0xc')],_0x474ffc[_0xbe40('0x11')],_0x474ffc[_0xbe40('0x12')]));if(_0x474ffc[_0xbe40('0x11')][_0xbe40('0x13')]()==_0xbe40('0x14')&&_[_0xbe40('0x15')](_0x474ffc[_0xbe40('0x12')][_0xbe40('0x13')](),_0xbe40('0x16'))){var _0x2f06d6=_0x474ffc[_0xbe40('0x12')][_0xbe40('0x17')]('=');dials[_0x474ffc[_0xbe40('0xc')]]={'routeId':_0x2f06d6[0x1]};}}catch(_0x408e94){utils[_0xbe40('0x18')](util['format'](_0xbe40('0xf'),_0x474ffc['uniqueid']),_0x408e94);}};exports[_0xbe40('0x19')]=function(_0x47e763){try{utils[_0xbe40('0xe')](util[_0xbe40('0x3')](_0xbe40('0x1a'),_0x47e763[_0xbe40('0xc')]),_0x47e763);if(!_[_0xbe40('0x1b')](_0x47e763[_0xbe40('0x1c')]['outboundrouteid'])){utils[_0xbe40('0x2')](util[_0xbe40('0x3')](_0xbe40('0x1d'),_0x47e763['uniqueid'],_0x47e763['value']));dials[_0x47e763[_0xbe40('0xc')]]={'routeId':_0x47e763[_0xbe40('0x1e')]};}}catch(_0x237397){utils['error'](util[_0xbe40('0x3')](_0xbe40('0x1a'),_0x47e763[_0xbe40('0xc')]),_0x237397);}};exports[_0xbe40('0x1f')]=function(_0x4efb02){try{if(!_[_0xbe40('0x1b')](dials[_0x4efb02[_0xbe40('0xc')]])){utils['debug'](util[_0xbe40('0x3')](_0xbe40('0x20'),_0x4efb02[_0xbe40('0xc')]),_0x4efb02);dials[_0x4efb02[_0xbe40('0xc')]]=_['assign'](dials[_0x4efb02['uniqueid']],_0x4efb02);dials[_0x4efb02[_0xbe40('0xc')]][_0xbe40('0x21')]=utils['now']();dials[_0x4efb02[_0xbe40('0xc')]][_0xbe40('0x22')]=_0xbe40('0x23');utils[_0xbe40('0x2')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x4efb02[_0xbe40('0xc')],dials[_0x4efb02[_0xbe40('0xc')]][_0xbe40('0x21')]));}}catch(_0x35ea7e){utils['error'](util[_0xbe40('0x3')]('[%s][dials][dialbegin]',_0x4efb02[_0xbe40('0xc')]),_0x35ea7e);}};exports['dialend']=function(_0x5925b7){try{if(!_[_0xbe40('0x1b')](dials[_0x5925b7[_0xbe40('0xc')]])){utils[_0xbe40('0xe')](util[_0xbe40('0x3')]('[%s][dials][dialend]',_0x5925b7['uniqueid']),_0x5925b7);dials[_0x5925b7[_0xbe40('0xc')]][_0xbe40('0x9')]=_0x5925b7[_0xbe40('0x9')];if(_0x5925b7[_0xbe40('0x9')]==_0xbe40('0x24')){dials[_0x5925b7[_0xbe40('0xc')]]=_[_0xbe40('0x25')](dials[_0x5925b7[_0xbe40('0xc')]],_0x5925b7);dials[_0x5925b7['uniqueid']][_0xbe40('0x26')]=utils['now']();dials[_0x5925b7[_0xbe40('0xc')]]['lastevent']=_0xbe40('0x27');utils[_0xbe40('0x2')](util[_0xbe40('0x3')](_0xbe40('0x28'),_0x5925b7['uniqueid'],_0x5925b7[_0xbe40('0x9')],dials[_0x5925b7[_0xbe40('0xc')]][_0xbe40('0x26')]));}else{utils[_0xbe40('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x5925b7['uniqueid'],_0x5925b7[_0xbe40('0x9')]));}}}catch(_0x443fc7){utils['error'](util[_0xbe40('0x3')](_0xbe40('0x29'),_0x5925b7[_0xbe40('0xc')]),_0x443fc7);}};exports[_0xbe40('0x2a')]=function(_0x142574){try{if(!_['isNil'](dials[_0x142574[_0xbe40('0xc')]])){utils[_0xbe40('0xe')](util['format']('[%s][dials][hangup]',_0x142574['uniqueid']),_0x142574);utils['info'](util[_0xbe40('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x142574['uniqueid'],_0x142574[_0xbe40('0x7')],_0x142574[_0xbe40('0x2b')],_0x142574[_0xbe40('0x2c')]));dials[_0x142574[_0xbe40('0xc')]]=_['assign'](dials[_0x142574[_0xbe40('0xc')]],{'endtime':utils[_0xbe40('0x2d')](),'lastevent':'complete'});dials[_0x142574['uniqueid']][_0xbe40('0x2e')]=utils[_0xbe40('0x2f')](dials[_0x142574[_0xbe40('0xc')]][_0xbe40('0x30')],dials[_0x142574[_0xbe40('0xc')]][_0xbe40('0x21')]);dials[_0x142574[_0xbe40('0xc')]][_0xbe40('0x31')]=utils[_0xbe40('0x2f')](dials[_0x142574[_0xbe40('0xc')]][_0xbe40('0x26')]||dials[_0x142574['uniqueid']][_0xbe40('0x30')],dials[_0x142574[_0xbe40('0xc')]][_0xbe40('0x21')]);dials[_0x142574['uniqueid']][_0xbe40('0x32')]=dials[_0x142574[_0xbe40('0xc')]]['answertime']?utils[_0xbe40('0x2f')](dials[_0x142574['uniqueid']][_0xbe40('0x30')],dials[_0x142574['uniqueid']][_0xbe40('0x26')]):0x0;writeDB(dials[_0x142574[_0xbe40('0xc')]]);}}catch(_0x4fbd11){utils[_0xbe40('0x18')](util['format']('[%s][dials][hangup]',_0x142574[_0xbe40('0xc')]),_0x4fbd11);}}; \ No newline at end of file +var _0xbe7a=['appdata','toLowerCase','startsWith','cdr(routeid)','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','assign','starttime','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','endtime','holdtime','diffTime','billableseconds','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','request','uniqueid','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0xe19c6d,_0x1271b6){var _0xa842a0=function(_0x53368d){while(--_0x53368d){_0xe19c6d['push'](_0xe19c6d['shift']());}};_0xa842a0(++_0x1271b6);}(_0xbe7a,0xf4));var _0xabe7=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xbe7a[_0x5cb1af];return _0x8d7940;};'use strict';var _=require(_0xabe7('0x0'));var util=require(_0xabe7('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x2589df){utils[_0xabe7('0x2')](util[_0xabe7('0x3')](_0xabe7('0x4'),_0x2589df['uniqueid'],_0x2589df[_0xabe7('0x5')],_0x2589df[_0xabe7('0x6')],_0x2589df[_0xabe7('0x7')],_0x2589df[_0xabe7('0x8')],_0x2589df['dialstatus']));utils[_0xabe7('0x9')]('CreateVoiceDialReport',_0x2589df);delete dials[_0x2589df[_0xabe7('0xa')]];}exports[_0xabe7('0xb')]=function(_0x10efa1){try{utils[_0xabe7('0xc')](util[_0xabe7('0x3')](_0xabe7('0xd'),_0x10efa1[_0xabe7('0xa')]),_0x10efa1);utils['info'](util['format'](_0xabe7('0xe'),_0x10efa1[_0xabe7('0xa')],_0x10efa1[_0xabe7('0xf')],_0x10efa1[_0xabe7('0x10')]));if(_0x10efa1[_0xabe7('0xf')][_0xabe7('0x11')]()=='set'&&_[_0xabe7('0x12')](_0x10efa1[_0xabe7('0x10')][_0xabe7('0x11')](),_0xabe7('0x13'))){var _0x5d152e=_0x10efa1[_0xabe7('0x10')]['split']('=');dials[_0x10efa1[_0xabe7('0xa')]]={'routeId':_0x5d152e[0x1]};}}catch(_0x3fd0f0){utils[_0xabe7('0x14')](util['format'](_0xabe7('0xd'),_0x10efa1[_0xabe7('0xa')]),_0x3fd0f0);}};exports[_0xabe7('0x15')]=function(_0x770bd5){try{utils['debug'](util[_0xabe7('0x3')](_0xabe7('0x16'),_0x770bd5[_0xabe7('0xa')]),_0x770bd5);if(!_['isNil'](_0x770bd5[_0xabe7('0x17')][_0xabe7('0x18')])){utils['info'](util[_0xabe7('0x3')](_0xabe7('0x19'),_0x770bd5['uniqueid'],_0x770bd5[_0xabe7('0x1a')]));dials[_0x770bd5[_0xabe7('0xa')]]={'routeId':_0x770bd5['value']};}}catch(_0x14ba57){utils[_0xabe7('0x14')](util['format']('[%s][dials][varset]',_0x770bd5[_0xabe7('0xa')]),_0x14ba57);}};exports['dialbegin']=function(_0x2d9ebf){try{if(!_[_0xabe7('0x1b')](dials[_0x2d9ebf[_0xabe7('0xa')]])){utils[_0xabe7('0xc')](util['format']('[%s][dials][dialbegin]',_0x2d9ebf[_0xabe7('0xa')]),_0x2d9ebf);dials[_0x2d9ebf[_0xabe7('0xa')]]=_[_0xabe7('0x1c')](dials[_0x2d9ebf[_0xabe7('0xa')]],_0x2d9ebf);dials[_0x2d9ebf['uniqueid']][_0xabe7('0x1d')]=utils['now']();dials[_0x2d9ebf[_0xabe7('0xa')]][_0xabe7('0x1e')]='called';utils[_0xabe7('0x2')](util[_0xabe7('0x3')](_0xabe7('0x1f'),_0x2d9ebf[_0xabe7('0xa')],dials[_0x2d9ebf[_0xabe7('0xa')]][_0xabe7('0x1d')]));}}catch(_0x381ec8){utils[_0xabe7('0x14')](util[_0xabe7('0x3')](_0xabe7('0x20'),_0x2d9ebf[_0xabe7('0xa')]),_0x381ec8);}};exports[_0xabe7('0x21')]=function(_0x5c96aa){try{if(!_[_0xabe7('0x1b')](dials[_0x5c96aa[_0xabe7('0xa')]])){utils[_0xabe7('0xc')](util[_0xabe7('0x3')](_0xabe7('0x22'),_0x5c96aa[_0xabe7('0xa')]),_0x5c96aa);dials[_0x5c96aa[_0xabe7('0xa')]]['dialstatus']=_0x5c96aa[_0xabe7('0x23')];if(_0x5c96aa['dialstatus']=='ANSWER'){dials[_0x5c96aa[_0xabe7('0xa')]]=_[_0xabe7('0x1c')](dials[_0x5c96aa['uniqueid']],_0x5c96aa);dials[_0x5c96aa[_0xabe7('0xa')]]['answertime']=utils[_0xabe7('0x24')]();dials[_0x5c96aa[_0xabe7('0xa')]][_0xabe7('0x1e')]=_0xabe7('0x25');utils[_0xabe7('0x2')](util[_0xabe7('0x3')](_0xabe7('0x26'),_0x5c96aa[_0xabe7('0xa')],_0x5c96aa[_0xabe7('0x23')],dials[_0x5c96aa[_0xabe7('0xa')]][_0xabe7('0x27')]));}else{utils['info'](util['format'](_0xabe7('0x28'),_0x5c96aa[_0xabe7('0xa')],_0x5c96aa[_0xabe7('0x23')]));}}}catch(_0x48cd73){utils[_0xabe7('0x14')](util[_0xabe7('0x3')](_0xabe7('0x22'),_0x5c96aa[_0xabe7('0xa')]),_0x48cd73);}};exports[_0xabe7('0x29')]=function(_0x3e0362){try{if(!_[_0xabe7('0x1b')](dials[_0x3e0362[_0xabe7('0xa')]])){utils['debug'](util[_0xabe7('0x3')](_0xabe7('0x2a'),_0x3e0362[_0xabe7('0xa')]),_0x3e0362);utils[_0xabe7('0x2')](util[_0xabe7('0x3')](_0xabe7('0x2b'),_0x3e0362['uniqueid'],_0x3e0362[_0xabe7('0x7')],_0x3e0362[_0xabe7('0x2c')],_0x3e0362[_0xabe7('0x2d')]));dials[_0x3e0362['uniqueid']]=_['assign'](dials[_0x3e0362['uniqueid']],{'endtime':utils[_0xabe7('0x24')](),'lastevent':_0xabe7('0x2e')});dials[_0x3e0362['uniqueid']][_0xabe7('0x2f')]=utils['diffTime'](dials[_0x3e0362[_0xabe7('0xa')]][_0xabe7('0x30')],dials[_0x3e0362[_0xabe7('0xa')]][_0xabe7('0x1d')]);dials[_0x3e0362['uniqueid']][_0xabe7('0x31')]=utils[_0xabe7('0x32')](dials[_0x3e0362[_0xabe7('0xa')]]['answertime']||dials[_0x3e0362[_0xabe7('0xa')]]['endtime'],dials[_0x3e0362[_0xabe7('0xa')]][_0xabe7('0x1d')]);dials[_0x3e0362['uniqueid']][_0xabe7('0x33')]=dials[_0x3e0362[_0xabe7('0xa')]][_0xabe7('0x27')]?utils[_0xabe7('0x32')](dials[_0x3e0362['uniqueid']][_0xabe7('0x30')],dials[_0x3e0362[_0xabe7('0xa')]][_0xabe7('0x27')]):0x0;writeDB(dials[_0x3e0362[_0xabe7('0xa')]]);}}catch(_0xd1e16f){utils[_0xabe7('0x14')](util[_0xabe7('0x3')](_0xabe7('0x2a'),_0x3e0362[_0xabe7('0xa')]),_0xd1e16f);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index f7c8f4d..8df949f 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 _0x042c=['shutdown','fullybooted','error','close','format','[%s][index][devicestatechange]','device','devicestatechange','debug','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','xdr','disabled','production','local','asterisk','port','username','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x042c,0xb7));var _0xc042=function(_0x3df335,_0x241519){_0x3df335=_0x3df335-0x0;var _0x239e58=_0x042c[_0x3df335];return _0x239e58;};var AsteriskManager=require('asterisk-manager');var config=require(_0xc042('0x0'));var utils=require(_0xc042('0x1'));var util=require('util');var isXDREnabled=config[_0xc042('0x2')]&&config[_0xc042('0x2')]['disabled']?!config['xdr'][_0xc042('0x3')]:!![];var isProduction=config['env']===_0xc042('0x4')||![];var isLocalAsterisk=config[_0xc042('0x2')]&&config[_0xc042('0x2')][_0xc042('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0xc042('0x6')][_0xc042('0x7')],config[_0xc042('0x6')]['ip'],config[_0xc042('0x6')][_0xc042('0x8')],config[_0xc042('0x6')][_0xc042('0x9')],!![]);ami[_0xc042('0xa')]();if(!isXDREnabled){utils['info'](_0xc042('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xc042('0xc')](_0xc042('0xd'));}else{var agents=require(_0xc042('0xe'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0xc042('0xf'));var members=require(_0xc042('0x10'));var dials=require(_0xc042('0x11'));var transfers=require(_0xc042('0x12'));var core=require(_0xc042('0x13'));ami['on'](_0xc042('0x14'),core[_0xc042('0x14')]);ami['on'](_0xc042('0x15'),core[_0xc042('0x15')]);ami['on'](_0xc042('0x16'),core[_0xc042('0x16')]);ami['on'](_0xc042('0x17'),core['error']);ami['on'](_0xc042('0x18'),core[_0xc042('0x18')]);ami['on']('managerevent',core['managerevent']);ami['on']('devicestatechange',function(_0x2984d1){try{utils['debug'](util[_0xc042('0x19')](_0xc042('0x1a'),_0x2984d1[_0xc042('0x1b')]),_0x2984d1);members[_0xc042('0x1c')](_0x2984d1);}catch(_0x5c151b){utils[_0xc042('0x17')](util[_0xc042('0x19')](_0xc042('0x1a'),_0x2984d1[_0xc042('0x1b')]),_0x5c151b);}});ami['on']('agentcalled',function(_0x347d50){try{utils[_0xc042('0x1d')](util['format'](_0xc042('0x1e'),_0x347d50['uniqueid']),_0x347d50);agents['agentcalled'](_0x347d50);}catch(_0x1eab77){utils[_0xc042('0x17')](util['format'](_0xc042('0x1e'),_0x347d50[_0xc042('0x1f')]),_0x1eab77);}});ami['on']('agentringnoanswer',function(_0x597124){try{utils[_0xc042('0x1d')](util[_0xc042('0x19')](_0xc042('0x20'),_0x597124[_0xc042('0x1f')]),_0x597124);agents[_0xc042('0x21')](_0x597124);}catch(_0x5a540f){utils[_0xc042('0x17')](util[_0xc042('0x19')](_0xc042('0x20'),_0x597124[_0xc042('0x1f')]),_0x5a540f);}});ami['on']('agentconnect',function(_0x40b14f){try{utils[_0xc042('0x1d')](util[_0xc042('0x19')](_0xc042('0x22'),_0x40b14f[_0xc042('0x1f')]),_0x40b14f);agents[_0xc042('0x23')](_0x40b14f);queues[_0xc042('0x23')](_0x40b14f);}catch(_0x305050){utils[_0xc042('0x17')](util[_0xc042('0x19')](_0xc042('0x22'),_0x40b14f[_0xc042('0x1f')]),_0x305050);}});ami['on'](_0xc042('0x24'),function(_0x51f72d){try{utils[_0xc042('0x1d')](util['format'](_0xc042('0x25'),_0x51f72d[_0xc042('0x1f')]),_0x51f72d);agents[_0xc042('0x24')](_0x51f72d);queues['agentcomplete'](_0x51f72d);members[_0xc042('0x24')](_0x51f72d);}catch(_0x243535){utils[_0xc042('0x17')](util[_0xc042('0x19')](_0xc042('0x25'),_0x51f72d['uniqueid']),_0x243535);}});ami['on'](_0xc042('0x26'),function(_0x484f35){try{utils[_0xc042('0x1d')](util['format'](_0xc042('0x27'),_0x484f35['uniqueid']),_0x484f35);agents['queuecallerabandon'](_0x484f35);queues[_0xc042('0x26')](_0x484f35);}catch(_0x1a1635){utils[_0xc042('0x17')](util['format'](_0xc042('0x27'),_0x484f35[_0xc042('0x1f')]),_0x1a1635);}});ami['on'](_0xc042('0x28'),function(_0x4389e1){try{utils[_0xc042('0x1d')](util[_0xc042('0x19')](_0xc042('0x29'),_0x4389e1[_0xc042('0x1f')]),_0x4389e1);queues[_0xc042('0x28')](_0x4389e1);recordings[_0xc042('0x28')](_0x4389e1);}catch(_0x4fc031){utils[_0xc042('0x17')](util['format'](_0xc042('0x29'),_0x4389e1[_0xc042('0x1f')]),_0x4fc031);}});ami['on']('queuecallerleave',function(_0x5b2b44){try{utils['debug'](util[_0xc042('0x19')]('[%s][index][queuecallerleave]',_0x5b2b44[_0xc042('0x1f')]),_0x5b2b44);queues[_0xc042('0x2a')](_0x5b2b44);}catch(_0x3f9757){utils[_0xc042('0x17')](util[_0xc042('0x19')]('[%s][index][queuecallerleave]',_0x5b2b44[_0xc042('0x1f')]),_0x3f9757);}});ami['on']('musiconholdstart',function(_0x27c4f1){try{utils[_0xc042('0x1d')](util[_0xc042('0x19')]('[%s][index][musiconholdstart]',_0x27c4f1['uniqueid']),_0x27c4f1);queues[_0xc042('0x2b')](_0x27c4f1);calls['musiconholdstart'](_0x27c4f1);}catch(_0x40c4c4){utils[_0xc042('0x17')](util['format'](_0xc042('0x2c'),_0x27c4f1[_0xc042('0x1f')]),_0x40c4c4);}});ami['on']('musiconholdstop',function(_0x4bce09){try{utils[_0xc042('0x1d')](util['format'](_0xc042('0x2d'),_0x4bce09[_0xc042('0x1f')]),_0x4bce09);queues['musiconholdstop'](_0x4bce09);calls[_0xc042('0x2e')](_0x4bce09);}catch(_0x4312e5){utils[_0xc042('0x17')](util[_0xc042('0x19')]('[%s][index][musiconholdstop]',_0x4bce09[_0xc042('0x1f')]),_0x4312e5);}});ami['on'](_0xc042('0x2f'),function(_0x4e7c3){try{utils[_0xc042('0x1d')](util[_0xc042('0x19')](_0xc042('0x30'),_0x4e7c3[_0xc042('0x1f')]),_0x4e7c3);calls['newstate'](_0x4e7c3);recordings[_0xc042('0x2f')](_0x4e7c3);}catch(_0x54fe70){utils['error'](util[_0xc042('0x19')](_0xc042('0x30'),_0x4e7c3[_0xc042('0x1f')]),_0x54fe70);}});ami['on'](_0xc042('0x31'),function(_0x1d21a0){try{utils['debug'](util[_0xc042('0x19')](_0xc042('0x32'),_0x1d21a0[_0xc042('0x1f')]),_0x1d21a0);calls[_0xc042('0x31')](_0x1d21a0);recordings[_0xc042('0x31')](_0x1d21a0);dials[_0xc042('0x31')](_0x1d21a0);agents[_0xc042('0x31')](_0x1d21a0);queues[_0xc042('0x31')](_0x1d21a0);}catch(_0x2d364f){utils[_0xc042('0x17')](util['format'](_0xc042('0x32'),_0x1d21a0[_0xc042('0x1f')]),_0x2d364f);}});ami['on'](_0xc042('0x33'),function(_0xe445d9){try{utils[_0xc042('0x1d')](util[_0xc042('0x19')]('[%s][index][cdr]',_0xe445d9[_0xc042('0x1f')]),_0xe445d9);members[_0xc042('0x33')](_0xe445d9);}catch(_0x7818fb){utils['error'](util[_0xc042('0x19')](_0xc042('0x34'),_0xe445d9[_0xc042('0x1f')]),_0x7818fb);}});ami['on'](_0xc042('0x35'),function(_0x8dfcd){try{utils['debug'](util[_0xc042('0x19')]('[%s][index][blindtransfer]',_0x8dfcd['uniqueid']),_0x8dfcd);queues[_0xc042('0x35')](_0x8dfcd);agents[_0xc042('0x35')](_0x8dfcd);transfers[_0xc042('0x35')](_0x8dfcd);}catch(_0x50ab5c){utils[_0xc042('0x17')](util[_0xc042('0x19')](_0xc042('0x36'),_0x8dfcd[_0xc042('0x1f')]),_0x50ab5c);}});ami['on'](_0xc042('0x37'),function(_0x5680ba){try{utils[_0xc042('0x1d')](util['format'](_0xc042('0x38'),_0x5680ba['origtransfereruniqueid']),_0x5680ba);queues[_0xc042('0x37')](_0x5680ba);transfers[_0xc042('0x37')](_0x5680ba);agents[_0xc042('0x37')](_0x5680ba);calls[_0xc042('0x37')](_0x5680ba);}catch(_0x4cfc12){utils['error'](util[_0xc042('0x19')](_0xc042('0x38'),_0x5680ba[_0xc042('0x39')]),_0x4cfc12);}});ami['on'](_0xc042('0x3a'),function(_0x27c589){try{utils['debug'](util[_0xc042('0x19')](_0xc042('0x3b'),_0x27c589[_0xc042('0x1f')]),_0x27c589);queues['varset'](_0x27c589);recordings['varset'](_0x27c589);calls[_0xc042('0x3a')](_0x27c589);dials[_0xc042('0x3a')](_0x27c589);}catch(_0x5078d2){utils[_0xc042('0x17')](util[_0xc042('0x19')]('[%s][index][varset]',_0x27c589['uniqueid']),_0x5078d2);}});ami['on'](_0xc042('0x3c'),function(_0x4c0fd2){try{utils[_0xc042('0x1d')](util['format'](_0xc042('0x3d'),_0x4c0fd2[_0xc042('0x1f')]),_0x4c0fd2);calls[_0xc042('0x3c')](_0x4c0fd2);recordings[_0xc042('0x3c')](_0x4c0fd2);dials['newexten'](_0x4c0fd2);}catch(_0x4b9ecb){utils[_0xc042('0x17')](util['format'](_0xc042('0x3d'),_0x4c0fd2[_0xc042('0x1f')]),_0x4b9ecb);}});ami['on']('newchannel',function(_0x2f5e3a){try{utils[_0xc042('0x1d')](util['format']('[%s][index][newchannel]',_0x2f5e3a['uniqueid']),_0x2f5e3a);calls[_0xc042('0x3e')](_0x2f5e3a);recordings['newchannel'](_0x2f5e3a);}catch(_0x135c3d){utils[_0xc042('0x17')](util[_0xc042('0x19')](_0xc042('0x3f'),_0x2f5e3a[_0xc042('0x1f')]),_0x135c3d);}});ami['on'](_0xc042('0x40'),function(_0x10a371){try{utils['debug'](util[_0xc042('0x19')]('[%s][index][dialbegin]',_0x10a371[_0xc042('0x1f')]),_0x10a371);dials[_0xc042('0x40')](_0x10a371);}catch(_0x300921){utils['error'](util['format'](_0xc042('0x41'),_0x10a371[_0xc042('0x1f')]),_0x300921);}});ami['on'](_0xc042('0x42'),function(_0x11b849){try{utils['debug'](util[_0xc042('0x19')](_0xc042('0x43'),_0x11b849['uniqueid']),_0x11b849);dials[_0xc042('0x42')](_0x11b849);}catch(_0x51476d){utils[_0xc042('0x17')](util[_0xc042('0x19')](_0xc042('0x43'),_0x11b849[_0xc042('0x1f')]),_0x51476d);}});} \ No newline at end of file +var _0xf79f=['[%s][index][newstate]','[%s][index][hangup]','hangup','[%s][index][cdr]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xf79f,0x9b));var _0xff79=function(_0x14286a,_0x54bf72){_0x14286a=_0x14286a-0x0;var _0x26d207=_0xf79f[_0x14286a];return _0x26d207;};var AsteriskManager=require(_0xff79('0x0'));var config=require('../../config/environment');var utils=require(_0xff79('0x1'));var util=require(_0xff79('0x2'));var isXDREnabled=config['xdr']&&config[_0xff79('0x3')][_0xff79('0x4')]?!config[_0xff79('0x3')][_0xff79('0x4')]:!![];var isProduction=config['env']===_0xff79('0x5')||![];var isLocalAsterisk=config[_0xff79('0x3')]&&config[_0xff79('0x3')][_0xff79('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xff79('0x7')][_0xff79('0x8')],config[_0xff79('0x7')]['ip'],config[_0xff79('0x7')][_0xff79('0x9')],config[_0xff79('0x7')][_0xff79('0xa')],!![]);ami[_0xff79('0xb')]();if(!isXDREnabled){utils[_0xff79('0xc')](_0xff79('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xff79('0xc')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xff79('0xe'));var calls=require(_0xff79('0xf'));var queues=require('./queues.controller');var recordings=require(_0xff79('0x10'));var members=require(_0xff79('0x11'));var dials=require(_0xff79('0x12'));var transfers=require(_0xff79('0x13'));var core=require(_0xff79('0x14'));ami['on'](_0xff79('0x15'),core[_0xff79('0x15')]);ami['on']('shutdown',core[_0xff79('0x16')]);ami['on'](_0xff79('0x17'),core[_0xff79('0x17')]);ami['on']('error',core[_0xff79('0x18')]);ami['on'](_0xff79('0x19'),core[_0xff79('0x19')]);ami['on'](_0xff79('0x1a'),core['managerevent']);ami['on']('devicestatechange',function(_0x40b20b){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x1d'),_0x40b20b[_0xff79('0x1e')]),_0x40b20b);members['devicestatechange'](_0x40b20b);}catch(_0x114cb0){utils[_0xff79('0x18')](util['format'](_0xff79('0x1d'),_0x40b20b[_0xff79('0x1e')]),_0x114cb0);}});ami['on'](_0xff79('0x1f'),function(_0x2f7d06){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x20'),_0x2f7d06[_0xff79('0x21')]),_0x2f7d06);agents[_0xff79('0x1f')](_0x2f7d06);}catch(_0x514c13){utils[_0xff79('0x18')](util[_0xff79('0x1c')](_0xff79('0x20'),_0x2f7d06[_0xff79('0x21')]),_0x514c13);}});ami['on'](_0xff79('0x22'),function(_0x139a75){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x23'),_0x139a75['uniqueid']),_0x139a75);agents['agentringnoanswer'](_0x139a75);}catch(_0x35d82f){utils['error'](util[_0xff79('0x1c')](_0xff79('0x23'),_0x139a75['uniqueid']),_0x35d82f);}});ami['on'](_0xff79('0x24'),function(_0x29eedf){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')]('[%s][index][agentconnect]',_0x29eedf['uniqueid']),_0x29eedf);agents[_0xff79('0x24')](_0x29eedf);queues['agentconnect'](_0x29eedf);}catch(_0x2a5503){utils[_0xff79('0x18')](util[_0xff79('0x1c')]('[%s][index][agentconnect]',_0x29eedf[_0xff79('0x21')]),_0x2a5503);}});ami['on'](_0xff79('0x25'),function(_0x9dab15){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x26'),_0x9dab15[_0xff79('0x21')]),_0x9dab15);agents[_0xff79('0x25')](_0x9dab15);queues[_0xff79('0x25')](_0x9dab15);members[_0xff79('0x25')](_0x9dab15);}catch(_0x4ce80d){utils['error'](util[_0xff79('0x1c')](_0xff79('0x26'),_0x9dab15[_0xff79('0x21')]),_0x4ce80d);}});ami['on'](_0xff79('0x27'),function(_0x375d83){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x28'),_0x375d83[_0xff79('0x21')]),_0x375d83);agents[_0xff79('0x27')](_0x375d83);queues[_0xff79('0x27')](_0x375d83);}catch(_0x22d4e7){utils['error'](util[_0xff79('0x1c')](_0xff79('0x28'),_0x375d83[_0xff79('0x21')]),_0x22d4e7);}});ami['on']('queuecallerjoin',function(_0x592686){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')]('[%s][index][queuecallerjoin]',_0x592686[_0xff79('0x21')]),_0x592686);queues['queuecallerjoin'](_0x592686);recordings[_0xff79('0x29')](_0x592686);}catch(_0x195f21){utils[_0xff79('0x18')](util['format']('[%s][index][queuecallerjoin]',_0x592686[_0xff79('0x21')]),_0x195f21);}});ami['on'](_0xff79('0x2a'),function(_0x578e07){try{utils[_0xff79('0x1b')](util['format'](_0xff79('0x2b'),_0x578e07[_0xff79('0x21')]),_0x578e07);queues['queuecallerleave'](_0x578e07);}catch(_0x310527){utils['error'](util[_0xff79('0x1c')](_0xff79('0x2b'),_0x578e07[_0xff79('0x21')]),_0x310527);}});ami['on'](_0xff79('0x2c'),function(_0xbc86a1){try{utils[_0xff79('0x1b')](util['format'](_0xff79('0x2d'),_0xbc86a1[_0xff79('0x21')]),_0xbc86a1);queues['musiconholdstart'](_0xbc86a1);calls[_0xff79('0x2c')](_0xbc86a1);}catch(_0x5200d9){utils[_0xff79('0x18')](util[_0xff79('0x1c')](_0xff79('0x2d'),_0xbc86a1[_0xff79('0x21')]),_0x5200d9);}});ami['on']('musiconholdstop',function(_0x3f0ac3){try{utils['debug'](util[_0xff79('0x1c')](_0xff79('0x2e'),_0x3f0ac3[_0xff79('0x21')]),_0x3f0ac3);queues[_0xff79('0x2f')](_0x3f0ac3);calls[_0xff79('0x2f')](_0x3f0ac3);}catch(_0xd5d477){utils['error'](util[_0xff79('0x1c')](_0xff79('0x2e'),_0x3f0ac3['uniqueid']),_0xd5d477);}});ami['on'](_0xff79('0x30'),function(_0x1b0e29){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x31'),_0x1b0e29[_0xff79('0x21')]),_0x1b0e29);calls[_0xff79('0x30')](_0x1b0e29);recordings[_0xff79('0x30')](_0x1b0e29);}catch(_0xd8b4cf){utils[_0xff79('0x18')](util['format'](_0xff79('0x31'),_0x1b0e29[_0xff79('0x21')]),_0xd8b4cf);}});ami['on']('hangup',function(_0x14a445){try{utils['debug'](util['format'](_0xff79('0x32'),_0x14a445[_0xff79('0x21')]),_0x14a445);calls['hangup'](_0x14a445);recordings[_0xff79('0x33')](_0x14a445);dials[_0xff79('0x33')](_0x14a445);agents['hangup'](_0x14a445);queues[_0xff79('0x33')](_0x14a445);}catch(_0x1cd716){utils[_0xff79('0x18')](util[_0xff79('0x1c')](_0xff79('0x32'),_0x14a445[_0xff79('0x21')]),_0x1cd716);}});ami['on']('cdr',function(_0x263d44){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x34'),_0x263d44[_0xff79('0x21')]),_0x263d44);members['cdr'](_0x263d44);}catch(_0x406853){utils[_0xff79('0x18')](util['format'](_0xff79('0x34'),_0x263d44['uniqueid']),_0x406853);}});ami['on'](_0xff79('0x35'),function(_0x16d6f9){try{utils[_0xff79('0x1b')](util['format']('[%s][index][blindtransfer]',_0x16d6f9[_0xff79('0x21')]),_0x16d6f9);queues[_0xff79('0x35')](_0x16d6f9);agents[_0xff79('0x35')](_0x16d6f9);transfers[_0xff79('0x35')](_0x16d6f9);}catch(_0x234352){utils[_0xff79('0x18')](util[_0xff79('0x1c')]('[%s][index][blindtransfer]',_0x16d6f9[_0xff79('0x21')]),_0x234352);}});ami['on'](_0xff79('0x36'),function(_0xdfe74){try{utils[_0xff79('0x1b')](util['format'](_0xff79('0x37'),_0xdfe74['origtransfereruniqueid']),_0xdfe74);queues[_0xff79('0x36')](_0xdfe74);transfers['attendedtransfer'](_0xdfe74);agents['attendedtransfer'](_0xdfe74);calls[_0xff79('0x36')](_0xdfe74);}catch(_0x2372fa){utils[_0xff79('0x18')](util[_0xff79('0x1c')](_0xff79('0x37'),_0xdfe74[_0xff79('0x38')]),_0x2372fa);}});ami['on'](_0xff79('0x39'),function(_0x37e99e){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x3a'),_0x37e99e[_0xff79('0x21')]),_0x37e99e);queues[_0xff79('0x39')](_0x37e99e);recordings[_0xff79('0x39')](_0x37e99e);calls[_0xff79('0x39')](_0x37e99e);dials['varset'](_0x37e99e);}catch(_0x43a75f){utils['error'](util[_0xff79('0x1c')](_0xff79('0x3a'),_0x37e99e['uniqueid']),_0x43a75f);}});ami['on'](_0xff79('0x3b'),function(_0x35b850){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x3c'),_0x35b850[_0xff79('0x21')]),_0x35b850);calls[_0xff79('0x3b')](_0x35b850);recordings[_0xff79('0x3b')](_0x35b850);dials[_0xff79('0x3b')](_0x35b850);}catch(_0x3c3a3e){utils['error'](util[_0xff79('0x1c')](_0xff79('0x3c'),_0x35b850[_0xff79('0x21')]),_0x3c3a3e);}});ami['on'](_0xff79('0x3d'),function(_0x388f8c){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x3e'),_0x388f8c['uniqueid']),_0x388f8c);calls[_0xff79('0x3d')](_0x388f8c);recordings[_0xff79('0x3d')](_0x388f8c);}catch(_0x402a05){utils[_0xff79('0x18')](util[_0xff79('0x1c')](_0xff79('0x3e'),_0x388f8c['uniqueid']),_0x402a05);}});ami['on'](_0xff79('0x3f'),function(_0x1cb4e8){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')](_0xff79('0x40'),_0x1cb4e8[_0xff79('0x21')]),_0x1cb4e8);dials[_0xff79('0x3f')](_0x1cb4e8);}catch(_0xe16faf){utils[_0xff79('0x18')](util[_0xff79('0x1c')](_0xff79('0x41'),_0x1cb4e8['uniqueid']),_0xe16faf);}});ami['on'](_0xff79('0x42'),function(_0x9c35){try{utils[_0xff79('0x1b')](util[_0xff79('0x1c')]('[%s][index][dialend]',_0x9c35['uniqueid']),_0x9c35);dials[_0xff79('0x42')](_0x9c35);}catch(_0x52a3e2){utils[_0xff79('0x18')](util['format'](_0xff79('0x43'),_0x9c35['uniqueid']),_0x52a3e2);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index df957ae..e764f59 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 _0xcd63=['BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt','uniqueid','[%s][members][devicestatechange]','agentcomplete','debug','queue','[%s][members][agentcomplete]','[%s][members][cdr]','assign','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','interface','channel','data2','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','devicestatechange','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE'];(function(_0x961cb2,_0x420a66){var _0x4a9703=function(_0x15af80){while(--_0x15af80){_0x961cb2['push'](_0x961cb2['shift']());}};_0x4a9703(++_0x420a66);}(_0xcd63,0xe4));var _0x3cd6=function(_0x4d538f,_0x38e47b){_0x4d538f=_0x4d538f-0x0;var _0x42cbcd=_0xcd63[_0x4d538f];return _0x42cbcd;};'use strict';var _=require(_0x3cd6('0x0'));var util=require(_0x3cd6('0x1'));var utils=require(_0x3cd6('0x2'));var members={};var exclude=[_0x3cd6('0x3'),_0x3cd6('0x4')];function writeDB(_0x5ae7c0){utils[_0x3cd6('0x5')](util[_0x3cd6('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x5ae7c0['uniqueid'],_0x5ae7c0[_0x3cd6('0x7')],_0x5ae7c0[_0x3cd6('0x8')],_0x5ae7c0[_0x3cd6('0x9')],_0x5ae7c0['membername'],_0x5ae7c0[_0x3cd6('0xa')]));if(_0x5ae7c0[_0x3cd6('0x7')]){utils[_0x3cd6('0xb')](_0x5ae7c0[_0x3cd6('0x7')])['then'](function(_0x43d4b9){if(_0x43d4b9){_0x5ae7c0['membername']=_0x43d4b9[_0x3cd6('0xc')];_0x5ae7c0[_0x3cd6('0xd')]=_0x43d4b9[_0x3cd6('0xd')];utils[_0x3cd6('0xe')](_0x3cd6('0xf'),_0x5ae7c0);}else{utils[_0x3cd6('0x10')](_0x5ae7c0[_0x3cd6('0x7')][_0x3cd6('0x11')]('/')[0x1])['then'](function(_0x5e7424){if(_0x5e7424){_0x5ae7c0['membername']=_0x5e7424[_0x3cd6('0xc')];_0x5ae7c0[_0x3cd6('0xd')]=_0x5e7424[_0x3cd6('0xd')];utils[_0x3cd6('0xe')](_0x3cd6('0xf'),_0x5ae7c0);}});}})[_0x3cd6('0x12')](function(_0x16a015){utils[_0x3cd6('0x13')](util[_0x3cd6('0x6')](_0x3cd6('0x14'),_0x5ae7c0['uniqueid']),_0x16a015);});}delete members[_0x5ae7c0['interface']];}function startsWith(_0x2a1d88,_0x581247){return _[_0x3cd6('0x15')](_0x2a1d88,function(_0x812fe3){return _['startsWith'](_0x581247,_0x812fe3);});}exports[_0x3cd6('0x16')]=function(_0x4ba5cd){try{utils['debug'](util['format']('[%s][members][devicestatechange]',members[_0x4ba5cd['device']]?members[_0x4ba5cd['device']]['uniqueid']:_0x4ba5cd[_0x3cd6('0x17')]),_0x4ba5cd);utils[_0x3cd6('0x5')](util[_0x3cd6('0x6')](_0x3cd6('0x18'),members[_0x4ba5cd['device']]?members[_0x4ba5cd[_0x3cd6('0x17')]]['uniqueid']:_0x4ba5cd[_0x3cd6('0x17')],_0x4ba5cd['state'],_0x4ba5cd['device']));switch(_0x4ba5cd[_0x3cd6('0x19')]){case _0x3cd6('0x1a'):case _0x3cd6('0x1b'):if(!startsWith(exclude,_0x4ba5cd[_0x3cd6('0x17')])){members[_0x4ba5cd['device']]={'channel':_0x3cd6('0x1c'),'interface':_0x4ba5cd[_0x3cd6('0x17')],'type':_0x3cd6('0x1d'),'enterAt':utils[_0x3cd6('0x1e')](),'role':_0x3cd6('0x1f')};}break;case _0x3cd6('0x20'):if(!_[_0x3cd6('0x21')](members[_0x4ba5cd[_0x3cd6('0x17')]])){members[_0x4ba5cd[_0x3cd6('0x17')]][_0x3cd6('0x22')]=utils[_0x3cd6('0x1e')]();members[_0x4ba5cd['device']][_0x3cd6('0x23')]=utils['diffTime'](members[_0x4ba5cd[_0x3cd6('0x17')]][_0x3cd6('0x22')],members[_0x4ba5cd['device']][_0x3cd6('0x24')]);if(members[_0x4ba5cd[_0x3cd6('0x17')]][_0x3cd6('0x25')]){writeDB(members[_0x4ba5cd[_0x3cd6('0x17')]]);}}break;default:break;}}catch(_0x26fd00){utils['error'](util[_0x3cd6('0x6')](_0x3cd6('0x26'),members[_0x4ba5cd[_0x3cd6('0x17')]]?members[_0x4ba5cd[_0x3cd6('0x17')]]['uniqueid']:_0x4ba5cd[_0x3cd6('0x17')]),_0x26fd00);}};exports[_0x3cd6('0x27')]=function(_0x2c92fd){try{if(!_[_0x3cd6('0x21')](members[_0x2c92fd['interface']])){utils[_0x3cd6('0x28')](util[_0x3cd6('0x6')]('[%s][members][agentcomplete]',_0x2c92fd['uniqueid']),_0x2c92fd);utils[_0x3cd6('0x5')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x2c92fd[_0x3cd6('0x25')],_0x2c92fd['interface'],_0x2c92fd['queue']));members[_0x2c92fd['interface']]=_['assign'](members[_0x2c92fd[_0x3cd6('0x7')]],{'data4':_0x2c92fd[_0x3cd6('0x29')],'uniqueid':_0x2c92fd[_0x3cd6('0x25')]});}}catch(_0x2683fb){utils[_0x3cd6('0x13')](util['format'](_0x3cd6('0x2a'),_0x2c92fd[_0x3cd6('0x25')]),_0x2683fb);}};exports['cdr']=function(_0xd1e9e0){try{utils[_0x3cd6('0x28')](util[_0x3cd6('0x6')](_0x3cd6('0x2b'),_0xd1e9e0['uniqueid']),_0xd1e9e0);if(_0xd1e9e0['channel']){var _0x2b5748=_0xd1e9e0[_0x3cd6('0x8')][_0x3cd6('0x11')]('-')[0x0];if(!_['isNil'](members[_0x2b5748])){members[_0x2b5748]=_[_0x3cd6('0x2c')](members[_0x2b5748],{'data1':members[_0x2b5748][_0x3cd6('0x2d')]||_0xd1e9e0[_0x3cd6('0xa')],'data2':members[_0x2b5748][_0x3cd6('0x9')]||_0xd1e9e0[_0x3cd6('0x2e')],'data3':members[_0x2b5748][_0x3cd6('0x2f')]||_0xd1e9e0[_0x3cd6('0x30')],'uniqueid':members[_0x2b5748][_0x3cd6('0x25')]||_0xd1e9e0[_0x3cd6('0x25')]});utils[_0x3cd6('0x5')](util[_0x3cd6('0x6')](_0x3cd6('0x31'),_0xd1e9e0['uniqueid'],members[_0x2b5748][_0x3cd6('0x2d')],members[_0x2b5748]['data2'],members[_0x2b5748][_0x3cd6('0x2f')]));if(members[_0x2b5748][_0x3cd6('0x22')]){writeDB(members[_0x2b5748]);}}}if(_0xd1e9e0['destinationchannel']){var _0x1251d1=_0xd1e9e0[_0x3cd6('0x32')][_0x3cd6('0x11')]('-')[0x0];if(!_[_0x3cd6('0x21')](members[_0x1251d1])){members[_0x1251d1]=_[_0x3cd6('0x2c')](members[_0x1251d1],{'data1':members[_0x1251d1][_0x3cd6('0x2d')]||_0xd1e9e0[_0x3cd6('0xa')],'data2':members[_0x1251d1][_0x3cd6('0x9')]||_0xd1e9e0['source'],'data3':members[_0x1251d1][_0x3cd6('0x2f')]||_0xd1e9e0[_0x3cd6('0x30')],'uniqueid':members[_0x1251d1][_0x3cd6('0x25')]||_0xd1e9e0[_0x3cd6('0x25')]});utils[_0x3cd6('0x5')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xd1e9e0[_0x3cd6('0x25')],members[_0x1251d1][_0x3cd6('0x2d')],members[_0x1251d1]['data2'],members[_0x1251d1][_0x3cd6('0x2f')]));if(members[_0x1251d1]['exitAt']){writeDB(members[_0x1251d1]);}}}}catch(_0x385d17){utils[_0x3cd6('0x13')](util['format'](_0x3cd6('0x2b'),_0xd1e9e0[_0x3cd6('0x25')]),_0x385d17);}}; \ No newline at end of file +var _0xfb68=['name','internal','CreateMemberReport','getUserByName','split','request','catch','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','state','BUSY','now','agent','NOT_INUSE','duration','exitAt','agentcomplete','isNil','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data2','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','source','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','getUserByInterface','then'];(function(_0x2de012,_0x5276dd){var _0x5b6423=function(_0x50136d){while(--_0x50136d){_0x2de012['push'](_0x2de012['shift']());}};_0x5b6423(++_0x5276dd);}(_0xfb68,0x1d2));var _0x8fb6=function(_0x3f5f4a,_0x56220b){_0x3f5f4a=_0x3f5f4a-0x0;var _0x2e8114=_0xfb68[_0x3f5f4a];return _0x2e8114;};'use strict';var _=require(_0x8fb6('0x0'));var util=require(_0x8fb6('0x1'));var utils=require(_0x8fb6('0x2'));var members={};var exclude=[_0x8fb6('0x3'),_0x8fb6('0x4')];function writeDB(_0x5b1aea){utils['info'](util[_0x8fb6('0x5')](_0x8fb6('0x6'),_0x5b1aea[_0x8fb6('0x7')],_0x5b1aea[_0x8fb6('0x8')],_0x5b1aea[_0x8fb6('0x9')],_0x5b1aea['data2'],_0x5b1aea[_0x8fb6('0xa')],_0x5b1aea[_0x8fb6('0xb')]));if(_0x5b1aea[_0x8fb6('0x8')]){utils[_0x8fb6('0xc')](_0x5b1aea[_0x8fb6('0x8')])[_0x8fb6('0xd')](function(_0x368988){if(_0x368988){_0x5b1aea['membername']=_0x368988[_0x8fb6('0xe')];_0x5b1aea['internal']=_0x368988[_0x8fb6('0xf')];utils['request'](_0x8fb6('0x10'),_0x5b1aea);}else{utils[_0x8fb6('0x11')](_0x5b1aea['interface'][_0x8fb6('0x12')]('/')[0x1])[_0x8fb6('0xd')](function(_0x28d16b){if(_0x28d16b){_0x5b1aea[_0x8fb6('0xa')]=_0x28d16b[_0x8fb6('0xe')];_0x5b1aea['internal']=_0x28d16b[_0x8fb6('0xf')];utils[_0x8fb6('0x13')]('CreateMemberReport',_0x5b1aea);}});}})[_0x8fb6('0x14')](function(_0x287935){utils[_0x8fb6('0x15')](util[_0x8fb6('0x5')](_0x8fb6('0x16'),_0x5b1aea[_0x8fb6('0x7')]),_0x287935);});}delete members[_0x5b1aea[_0x8fb6('0x8')]];}function startsWith(_0x11543c,_0x10db95){return _['some'](_0x11543c,function(_0x551c16){return _[_0x8fb6('0x17')](_0x10db95,_0x551c16);});}exports[_0x8fb6('0x18')]=function(_0x259deb){try{utils[_0x8fb6('0x19')](util[_0x8fb6('0x5')](_0x8fb6('0x1a'),members[_0x259deb[_0x8fb6('0x1b')]]?members[_0x259deb[_0x8fb6('0x1b')]][_0x8fb6('0x7')]:_0x259deb[_0x8fb6('0x1b')]),_0x259deb);utils['info'](util[_0x8fb6('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x259deb['device']]?members[_0x259deb[_0x8fb6('0x1b')]][_0x8fb6('0x7')]:_0x259deb['device'],_0x259deb['state'],_0x259deb[_0x8fb6('0x1b')]));switch(_0x259deb[_0x8fb6('0x1c')]){case'INUSE':case _0x8fb6('0x1d'):if(!startsWith(exclude,_0x259deb['device'])){members[_0x259deb['device']]={'channel':'voice','interface':_0x259deb[_0x8fb6('0x1b')],'type':'TALKING','enterAt':utils[_0x8fb6('0x1e')](),'role':_0x8fb6('0x1f')};}break;case _0x8fb6('0x20'):if(!_['isNil'](members[_0x259deb[_0x8fb6('0x1b')]])){members[_0x259deb[_0x8fb6('0x1b')]]['exitAt']=utils[_0x8fb6('0x1e')]();members[_0x259deb['device']][_0x8fb6('0x21')]=utils['diffTime'](members[_0x259deb[_0x8fb6('0x1b')]][_0x8fb6('0x22')],members[_0x259deb[_0x8fb6('0x1b')]]['enterAt']);if(members[_0x259deb['device']]['uniqueid']){writeDB(members[_0x259deb[_0x8fb6('0x1b')]]);}}break;default:break;}}catch(_0x443cce){utils[_0x8fb6('0x15')](util[_0x8fb6('0x5')]('[%s][members][devicestatechange]',members[_0x259deb[_0x8fb6('0x1b')]]?members[_0x259deb[_0x8fb6('0x1b')]][_0x8fb6('0x7')]:_0x259deb[_0x8fb6('0x1b')]),_0x443cce);}};exports[_0x8fb6('0x23')]=function(_0x4438c3){try{if(!_[_0x8fb6('0x24')](members[_0x4438c3['interface']])){utils[_0x8fb6('0x19')](util[_0x8fb6('0x5')]('[%s][members][agentcomplete]',_0x4438c3['uniqueid']),_0x4438c3);utils[_0x8fb6('0x25')](util['format'](_0x8fb6('0x26'),_0x4438c3[_0x8fb6('0x7')],_0x4438c3[_0x8fb6('0x8')],_0x4438c3[_0x8fb6('0x27')]));members[_0x4438c3['interface']]=_[_0x8fb6('0x28')](members[_0x4438c3[_0x8fb6('0x8')]],{'data4':_0x4438c3[_0x8fb6('0x27')],'uniqueid':_0x4438c3[_0x8fb6('0x7')]});}}catch(_0xcdecf0){utils[_0x8fb6('0x15')](util[_0x8fb6('0x5')]('[%s][members][agentcomplete]',_0x4438c3[_0x8fb6('0x7')]),_0xcdecf0);}};exports['cdr']=function(_0x44236a){try{utils[_0x8fb6('0x19')](util['format'](_0x8fb6('0x29'),_0x44236a[_0x8fb6('0x7')]),_0x44236a);if(_0x44236a[_0x8fb6('0x9')]){var _0x35898f=_0x44236a[_0x8fb6('0x9')][_0x8fb6('0x12')]('-')[0x0];if(!_['isNil'](members[_0x35898f])){members[_0x35898f]=_[_0x8fb6('0x28')](members[_0x35898f],{'data1':members[_0x35898f]['data1']||_0x44236a[_0x8fb6('0xb')],'data2':members[_0x35898f][_0x8fb6('0x2a')]||_0x44236a['source'],'data3':members[_0x35898f][_0x8fb6('0x2b')]||_0x44236a[_0x8fb6('0x2c')],'uniqueid':members[_0x35898f]['uniqueid']||_0x44236a[_0x8fb6('0x7')]});utils['info'](util['format'](_0x8fb6('0x2d'),_0x44236a[_0x8fb6('0x7')],members[_0x35898f][_0x8fb6('0x2e')],members[_0x35898f]['data2'],members[_0x35898f]['data3']));if(members[_0x35898f][_0x8fb6('0x22')]){writeDB(members[_0x35898f]);}}}if(_0x44236a['destinationchannel']){var _0x5d9a95=_0x44236a['destinationchannel']['split']('-')[0x0];if(!_[_0x8fb6('0x24')](members[_0x5d9a95])){members[_0x5d9a95]=_['assign'](members[_0x5d9a95],{'data1':members[_0x5d9a95][_0x8fb6('0x2e')]||_0x44236a[_0x8fb6('0xb')],'data2':members[_0x5d9a95][_0x8fb6('0x2a')]||_0x44236a[_0x8fb6('0x2f')],'data3':members[_0x5d9a95][_0x8fb6('0x2b')]||_0x44236a['destination'],'uniqueid':members[_0x5d9a95][_0x8fb6('0x7')]||_0x44236a['uniqueid']});utils[_0x8fb6('0x25')](util[_0x8fb6('0x5')](_0x8fb6('0x2d'),_0x44236a[_0x8fb6('0x7')],members[_0x5d9a95][_0x8fb6('0x2e')],members[_0x5d9a95][_0x8fb6('0x2a')],members[_0x5d9a95][_0x8fb6('0x2b')]));if(members[_0x5d9a95]['exitAt']){writeDB(members[_0x5d9a95]);}}}}catch(_0x306f7c){utils[_0x8fb6('0x15')](util[_0x8fb6('0x5')](_0x8fb6('0x29'),_0x44236a[_0x8fb6('0x7')]),_0x306f7c);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index ac2b92d..0e2821b 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 _0xff4c=['TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','transferuniqueid','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridnum','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','uniqueid','queue','lastAssignedTo','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','[%s][queues][queuecallerjoin]','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','isNil','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer'];(function(_0x28d8e9,_0x7893f4){var _0x42925f=function(_0x335286){while(--_0x335286){_0x28d8e9['push'](_0x28d8e9['shift']());}};_0x42925f(++_0x7893f4);}(_0xff4c,0x8d));var _0xcff4=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0xff4c[_0x43f881];return _0x365c14;};'use strict';var _=require(_0xcff4('0x0'));var util=require(_0xcff4('0x1'));var utils=require(_0xcff4('0x2'));var queues={};function writeDB(_0x55d2f8){utils[_0xcff4('0x3')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x55d2f8[_0xcff4('0x4')],_0x55d2f8['channel'],_0x55d2f8[_0xcff4('0x5')],_0x55d2f8[_0xcff4('0x6')],_0x55d2f8['calleridnum'],_0x55d2f8[_0xcff4('0x7')],_0x55d2f8[_0xcff4('0x8')]));if(_0x55d2f8[_0xcff4('0x5')]){utils['getVoiceQueueByName'](_0x55d2f8[_0xcff4('0x5')])[_0xcff4('0x9')](function(_0x1204b3){if(_0x1204b3){_0x55d2f8[_0xcff4('0xa')]=_0x1204b3['type'];}utils[_0xcff4('0xb')](_0xcff4('0xc'),_0x55d2f8);});}else{utils[_0xcff4('0xb')](_0xcff4('0xc'),_0x55d2f8);}if(_0x55d2f8[_0xcff4('0xd')]){delete queues[_0x55d2f8['transfereduniqueid']];}else{delete queues[_0x55d2f8[_0xcff4('0x4')]];}}exports[_0xcff4('0xe')]=function(_0x4d091f){try{utils[_0xcff4('0xf')](util[_0xcff4('0x10')]('[%s][queues][queuecallerjoin]',_0x4d091f['uniqueid']),_0x4d091f);utils[_0xcff4('0x3')](util['format'](_0xcff4('0x11'),_0x4d091f[_0xcff4('0x4')],_0x4d091f['queue'],_0x4d091f[_0xcff4('0x12')]));queues[_0x4d091f[_0xcff4('0x4')]]=_[_0xcff4('0x13')](_0x4d091f,{'originalposition':_0x4d091f[_0xcff4('0x12')],'queuecallerjoinAt':utils[_0xcff4('0x14')](),'mohtime':0x0});}catch(_0x491fe9){utils['error'](util[_0xcff4('0x10')](_0xcff4('0x15'),_0x4d091f[_0xcff4('0x4')]),_0x491fe9);}};exports[_0xcff4('0x16')]=function(_0x5afadc){try{if(!_['isNil'](queues[_0x5afadc['uniqueid']])){utils[_0xcff4('0xf')](util[_0xcff4('0x10')](_0xcff4('0x17'),_0x5afadc[_0xcff4('0x4')]),_0x5afadc);if(queues[_0x5afadc[_0xcff4('0x4')]][_0xcff4('0x18')]){if(!queues[_0x5afadc['uniqueid']][_0xcff4('0x19')]&&!queues[_0x5afadc[_0xcff4('0x4')]][_0xcff4('0x1a')]){queues[_0x5afadc['uniqueid']][_0xcff4('0x1b')]=!![];queues[_0x5afadc[_0xcff4('0x4')]]['queuecallercompleteAt']=utils['now']();queues[_0x5afadc[_0xcff4('0x4')]]['queuecallerexitreason']=_0xcff4('0x1c');}utils[_0xcff4('0x3')](util[_0xcff4('0x10')](_0xcff4('0x1d'),_0x5afadc[_0xcff4('0x4')],queues[_0x5afadc[_0xcff4('0x4')]][_0xcff4('0x1e')],queues[_0x5afadc[_0xcff4('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x5afadc[_0xcff4('0x4')]]);}else if(queues[_0x5afadc['uniqueid']][_0xcff4('0xd')]){utils[_0xcff4('0x3')](util[_0xcff4('0x10')](_0xcff4('0x1f'),_0x5afadc[_0xcff4('0x4')],queues[_0x5afadc[_0xcff4('0x4')]][_0xcff4('0x1e')],queues[_0x5afadc[_0xcff4('0x4')]][_0xcff4('0xd')]));queues[queues[_0x5afadc[_0xcff4('0x4')]][_0xcff4('0xd')]]=queues[_0x5afadc[_0xcff4('0x4')]];queues[queues[_0x5afadc[_0xcff4('0x4')]][_0xcff4('0xd')]][_0xcff4('0x20')]=0x2;delete queues[_0x5afadc['uniqueid']];}}}catch(_0x15911e){utils['error'](util[_0xcff4('0x10')](_0xcff4('0x17'),_0x5afadc['uniqueid']),_0x15911e);}};exports[_0xcff4('0x21')]=function(_0xbd2c3e){try{utils['debug'](util['format'](_0xcff4('0x22'),_0xbd2c3e[_0xcff4('0x4')]),_0xbd2c3e);if(!_[_0xcff4('0x23')](_0xbd2c3e['variable']['queuestatus'])&&_0xbd2c3e[_0xcff4('0x24')][_0xcff4('0x25')]()!==_0xcff4('0x26')){if(!_[_0xcff4('0x23')](queues[_0xbd2c3e['uniqueid']])){queues[_0xbd2c3e[_0xcff4('0x4')]][_0xcff4('0x19')]=![];queues[_0xbd2c3e[_0xcff4('0x4')]][_0xcff4('0x27')]=null;queues[_0xbd2c3e['uniqueid']]['queuecallerexit']=!![];queues[_0xbd2c3e[_0xcff4('0x4')]][_0xcff4('0x28')]=utils[_0xcff4('0x14')]();queues[_0xbd2c3e[_0xcff4('0x4')]][_0xcff4('0x8')]=_0xbd2c3e['value']['toUpperCase']();utils['info'](util['format'](_0xcff4('0x29'),_0xbd2c3e[_0xcff4('0x4')],queues[_0xbd2c3e[_0xcff4('0x4')]][_0xcff4('0x1e')],_0xbd2c3e[_0xcff4('0x24')],queues[_0xbd2c3e['uniqueid']][_0xcff4('0x8')]));writeDB(queues[_0xbd2c3e['uniqueid']]);}}else if(!_[_0xcff4('0x23')](_0xbd2c3e['variable'][_0xcff4('0x2a')])){if(!_[_0xcff4('0x23')](queues[_0xbd2c3e[_0xcff4('0x4')]])&&!queues[_0xbd2c3e[_0xcff4('0x4')]]['queuecallerabandon']){queues[_0xbd2c3e['uniqueid']][_0xcff4('0x19')]=![];queues[_0xbd2c3e[_0xcff4('0x4')]][_0xcff4('0x27')]=null;queues[_0xbd2c3e['uniqueid']][_0xcff4('0x1a')]=!![];queues[_0xbd2c3e['uniqueid']][_0xcff4('0x28')]=utils[_0xcff4('0x14')]();queues[_0xbd2c3e[_0xcff4('0x4')]]['queuecallerexitreason']=_0xcff4('0x2b');utils[_0xcff4('0x3')](util[_0xcff4('0x10')](_0xcff4('0x2c'),_0xbd2c3e[_0xcff4('0x4')],queues[_0xbd2c3e[_0xcff4('0x4')]][_0xcff4('0x1e')],_0xbd2c3e[_0xcff4('0x24')],queues[_0xbd2c3e[_0xcff4('0x4')]][_0xcff4('0x8')]));}}}catch(_0x62d6ed){utils[_0xcff4('0x2d')](util[_0xcff4('0x10')](_0xcff4('0x22'),_0xbd2c3e[_0xcff4('0x4')]),_0x62d6ed);}};exports[_0xcff4('0x19')]=function(_0x5bd56e){try{if(!_['isNil'](queues[_0x5bd56e[_0xcff4('0x4')]])){utils[_0xcff4('0xf')](util['format']('[%s][queues][queuecallerabandon]',_0x5bd56e[_0xcff4('0x4')]),_0x5bd56e);queues[_0x5bd56e[_0xcff4('0x4')]]['queuecallerexit']=![];queues[_0x5bd56e[_0xcff4('0x4')]][_0xcff4('0x28')]=null;queues[_0x5bd56e['uniqueid']][_0xcff4('0x19')]=!![];queues[_0x5bd56e[_0xcff4('0x4')]][_0xcff4('0x27')]=utils['now']();queues[_0x5bd56e[_0xcff4('0x4')]]['queuecallerexitreason']=_0xcff4('0x2e');utils['info'](util['format'](_0xcff4('0x2f'),_0x5bd56e['uniqueid'],queues[_0x5bd56e['uniqueid']][_0xcff4('0x1e')],queues[_0x5bd56e[_0xcff4('0x4')]][_0xcff4('0x8')]));}}catch(_0x2b7e91){utils[_0xcff4('0x2d')](util[_0xcff4('0x10')](_0xcff4('0x30'),_0x5bd56e[_0xcff4('0x4')]),_0x2b7e91);}};exports[_0xcff4('0x31')]=function(_0x4e48f7){try{if(!_['isNil'](queues[_0x4e48f7[_0xcff4('0x4')]])){utils[_0xcff4('0xf')](util['format']('[%s][queues][queuecallerleave]',_0x4e48f7[_0xcff4('0x4')]),_0x4e48f7);utils['info'](util[_0xcff4('0x10')](_0xcff4('0x32'),_0x4e48f7['uniqueid'],queues[_0x4e48f7[_0xcff4('0x4')]][_0xcff4('0x1e')],_0x4e48f7[_0xcff4('0x33')],_0x4e48f7['connectedlinename']));queues[_0x4e48f7[_0xcff4('0x4')]][_0xcff4('0x31')]=!![];queues[_0x4e48f7[_0xcff4('0x4')]]['queuecallerleaveAt']=utils[_0xcff4('0x14')]();queues[_0x4e48f7[_0xcff4('0x4')]][_0xcff4('0x34')]=utils[_0xcff4('0x35')](queues[_0x4e48f7[_0xcff4('0x4')]][_0xcff4('0x18')],queues[_0x4e48f7[_0xcff4('0x4')]][_0xcff4('0x36')]);queues[_0x4e48f7['uniqueid']][_0xcff4('0x12')]=_0x4e48f7[_0xcff4('0x12')];queues[_0x4e48f7[_0xcff4('0x4')]][_0xcff4('0x37')]=_0x4e48f7[_0xcff4('0x37')];queues[_0x4e48f7[_0xcff4('0x4')]][_0xcff4('0x33')]=_0x4e48f7[_0xcff4('0x33')];queues[_0x4e48f7[_0xcff4('0x4')]]['connectedlinename']=_0x4e48f7['connectedlinename'];}}catch(_0x5ac5bf){utils[_0xcff4('0x2d')](util[_0xcff4('0x10')](_0xcff4('0x38'),_0x4e48f7['uniqueid']),_0x5ac5bf);}};exports[_0xcff4('0x39')]=function(_0x394a1d){try{if(!_['isNil'](queues[_0x394a1d[_0xcff4('0x4')]])){utils['debug'](util['format'](_0xcff4('0x3a'),_0x394a1d['uniqueid']),_0x394a1d);utils[_0xcff4('0x3')](util[_0xcff4('0x10')](_0xcff4('0x3b'),_0x394a1d[_0xcff4('0x4')],queues[_0x394a1d[_0xcff4('0x4')]]['name'],_0x394a1d[_0xcff4('0x3c')],_0x394a1d[_0xcff4('0x3d')]));queues[_0x394a1d['uniqueid']][_0xcff4('0x19')]=![];queues[_0x394a1d[_0xcff4('0x4')]]['queuecallerabandon']=![];queues[_0x394a1d[_0xcff4('0x4')]][_0xcff4('0x27')]=null;queues[_0x394a1d[_0xcff4('0x4')]][_0xcff4('0x1a')]=![];queues[_0x394a1d[_0xcff4('0x4')]][_0xcff4('0x8')]=null;queues[_0x394a1d[_0xcff4('0x4')]]['queuecallerexitAt']=null;queues[_0x394a1d['uniqueid']][_0xcff4('0x3e')]=!![];queues[_0x394a1d[_0xcff4('0x4')]]['accountcode']=_0x394a1d['destaccountcode'];queues[_0x394a1d[_0xcff4('0x4')]]['lastAssignedTo']=_0x394a1d['membername'];}}catch(_0x216728){utils[_0xcff4('0x2d')](util[_0xcff4('0x10')]('[%s][queues][agentconnect]',_0x394a1d[_0xcff4('0x4')]),_0x216728);}};exports['agentcomplete']=function(_0x1c929a){try{if(!_[_0xcff4('0x23')](queues[_0x1c929a[_0xcff4('0x4')]])){if(queues[_0x1c929a[_0xcff4('0x4')]][_0xcff4('0x18')]){utils[_0xcff4('0xf')](util[_0xcff4('0x10')](_0xcff4('0x3f'),_0x1c929a[_0xcff4('0x4')]),_0x1c929a);queues[_0x1c929a['uniqueid']][_0xcff4('0x19')]=![];queues[_0x1c929a['uniqueid']][_0xcff4('0x19')]=![];queues[_0x1c929a['uniqueid']][_0xcff4('0x27')]=null;queues[_0x1c929a[_0xcff4('0x4')]][_0xcff4('0x1a')]=![];queues[_0x1c929a['uniqueid']]['queuecallerexitAt']=null;queues[_0x1c929a[_0xcff4('0x4')]]['assigned']=!![];queues[_0x1c929a[_0xcff4('0x4')]]['lastAssignedTo']=_0x1c929a[_0xcff4('0x3c')];queues[_0x1c929a['uniqueid']][_0xcff4('0x1b')]=!![];queues[_0x1c929a[_0xcff4('0x4')]][_0xcff4('0x40')]=utils['now']();if(_0x1c929a[_0xcff4('0x41')]==_0xcff4('0x42')){if(!queues[_0x1c929a[_0xcff4('0x4')]][_0xcff4('0x42')]){queues[_0x1c929a['uniqueid']]['queuecallerexitreason']=_0xcff4('0x43');}}else{queues[_0x1c929a['uniqueid']][_0xcff4('0x8')]=_0xcff4('0x44')+_0x1c929a['reason'][_0xcff4('0x25')]();}utils[_0xcff4('0x3')](util['format'](_0xcff4('0x45'),_0x1c929a['uniqueid'],queues[_0x1c929a[_0xcff4('0x4')]]['name'],_0x1c929a[_0xcff4('0x3c')],queues[_0x1c929a[_0xcff4('0x4')]][_0xcff4('0x8')]));writeDB(queues[_0x1c929a[_0xcff4('0x4')]]);}}}catch(_0x13d653){utils['error'](util[_0xcff4('0x10')]('[%s][queues][agentcomplete]',_0x1c929a[_0xcff4('0x4')]),_0x13d653);}};exports['blindtransfer']=function(_0x273639){try{if(!_[_0xcff4('0x23')](queues[_0x273639[_0xcff4('0x46')]])){utils['debug'](util[_0xcff4('0x10')](_0xcff4('0x47'),_0x273639[_0xcff4('0x4')]),_0x273639);queues[_0x273639[_0xcff4('0x46')]][_0xcff4('0x42')]=!![];queues[_0x273639[_0xcff4('0x46')]][_0xcff4('0x48')]='BLIND';queues[_0x273639['transfereeuniqueid']][_0xcff4('0x49')]=_0x273639['extension'];queues[_0x273639[_0xcff4('0x46')]][_0xcff4('0x4a')]=_0x273639[_0xcff4('0x46')];queues[_0x273639['transfereeuniqueid']][_0xcff4('0x8')]='BLINDTRANSFER';utils[_0xcff4('0x3')](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x273639['uniqueid'],queues[_0x273639[_0xcff4('0x46')]][_0xcff4('0x1e')],_0x273639['transfereeuniqueid'],_0x273639[_0xcff4('0x4b')]));}}catch(_0x43e8e3){utils[_0xcff4('0x2d')](util['format'](_0xcff4('0x47'),_0x273639['uniqueid']),_0x43e8e3);}};exports[_0xcff4('0x4c')]=function(_0x14d3a0){try{utils[_0xcff4('0xf')](util[_0xcff4('0x10')](_0xcff4('0x4d'),_0x14d3a0[_0xcff4('0x4e')]),_0x14d3a0);if(_0x14d3a0['origtransfereruniqueid']==_0x14d3a0[_0xcff4('0x4f')]){if(!_[_0xcff4('0x23')](queues[_0x14d3a0[_0xcff4('0x50')]])){utils[_0xcff4('0x3')](util[_0xcff4('0x10')](_0xcff4('0x51'),_0x14d3a0[_0xcff4('0x4e')],queues[_0x14d3a0[_0xcff4('0x50')]][_0xcff4('0x1e')],_0x14d3a0['origtransfererexten']));queues[_0x14d3a0[_0xcff4('0x50')]]['transfer']=!![];queues[_0x14d3a0[_0xcff4('0x50')]][_0xcff4('0x48')]=_0xcff4('0x52');queues[_0x14d3a0['secondtransfererlinkedid']][_0xcff4('0x49')]=_0x14d3a0[_0xcff4('0x53')];queues[_0x14d3a0[_0xcff4('0x50')]][_0xcff4('0x4a')]=_0x14d3a0[_0xcff4('0x4e')];queues[_0x14d3a0['secondtransfererlinkedid']]['queuecallerexitreason']=_0xcff4('0x54');}if(!_['isNil'](queues[_0x14d3a0[_0xcff4('0x4f')]])){if(_0x14d3a0[_0xcff4('0x55')]&&queues[_0x14d3a0['transfereelinkedid']]){queues[_0x14d3a0['transfereelinkedid']][_0xcff4('0x20')]=0x1;queues[_0x14d3a0['transfereeuniqueid']]=_[_0xcff4('0x56')](queues[_0x14d3a0[_0xcff4('0x55')]]);queues[_0x14d3a0[_0xcff4('0x46')]][_0xcff4('0xd')]=_0x14d3a0[_0xcff4('0x57')];queues[_0x14d3a0[_0xcff4('0x46')]]['queuecallerenterreason']=0x2;queues[_0x14d3a0[_0xcff4('0x46')]]['calleridnum']=queues[_0x14d3a0[_0xcff4('0x50')]]['calleridnum'];queues[_0x14d3a0[_0xcff4('0x46')]][_0xcff4('0x58')]=queues[_0x14d3a0[_0xcff4('0x50')]]['calleridname'];queues[_0x14d3a0['transfereeuniqueid']][_0xcff4('0x36')]=utils[_0xcff4('0x14')]();queues[_0x14d3a0[_0xcff4('0x46')]][_0xcff4('0x18')]=utils[_0xcff4('0x14')]();queues[_0x14d3a0['transfereeuniqueid']][_0xcff4('0x34')]=0x0;queues[_0x14d3a0[_0xcff4('0x46')]][_0xcff4('0x59')]=0x0;utils[_0xcff4('0x3')](util[_0xcff4('0x10')](_0xcff4('0x5a'),_0x14d3a0[_0xcff4('0x4e')],queues[_0x14d3a0[_0xcff4('0x46')]]['name'],queues[_0x14d3a0['transfereeuniqueid']][_0xcff4('0x5b')],queues[_0x14d3a0['transfereeuniqueid']]['calleridname']));}else{utils[_0xcff4('0x3')](util[_0xcff4('0x10')](_0xcff4('0x5c'),_0x14d3a0[_0xcff4('0x4e')],queues[_0x14d3a0[_0xcff4('0x4f')]][_0xcff4('0x1e')],_0x14d3a0[_0xcff4('0x50')]));queues[_0x14d3a0[_0xcff4('0x4f')]][_0xcff4('0xd')]=_0x14d3a0[_0xcff4('0x50')];}}}else if(_0x14d3a0[_0xcff4('0x5d')]==_0x14d3a0['secondtransfererlinkedid']){if(!_[_0xcff4('0x23')](queues[_0x14d3a0[_0xcff4('0x4f')]])){utils['info'](util[_0xcff4('0x10')](_0xcff4('0x5e'),_0x14d3a0[_0xcff4('0x4e')],queues[_0x14d3a0[_0xcff4('0x4f')]]['name'],_0x14d3a0[_0xcff4('0x5d')],_0x14d3a0[_0xcff4('0x5f')]));queues[_0x14d3a0[_0xcff4('0x4f')]][_0xcff4('0x42')]=!![];queues[_0x14d3a0[_0xcff4('0x4f')]]['transfertype']=_0xcff4('0x52');queues[_0x14d3a0[_0xcff4('0x4f')]][_0xcff4('0x49')]=_0x14d3a0['secondtransfererexten'];queues[_0x14d3a0[_0xcff4('0x4f')]][_0xcff4('0x4a')]=_0x14d3a0[_0xcff4('0x5d')];queues[_0x14d3a0[_0xcff4('0x4f')]][_0xcff4('0x8')]='ATTENDEDTRANSFER';}if(!_[_0xcff4('0x23')](queues[_0x14d3a0[_0xcff4('0x50')]])){if(_0x14d3a0[_0xcff4('0x60')]&&queues[_0x14d3a0[_0xcff4('0x60')]]){queues[_0x14d3a0['transfertargetlinkedid']][_0xcff4('0x20')]=0x1;queues[_0x14d3a0[_0xcff4('0x57')]]=_[_0xcff4('0x56')](queues[_0x14d3a0['transfertargetlinkedid']]);queues[_0x14d3a0[_0xcff4('0x57')]][_0xcff4('0xd')]=_0x14d3a0[_0xcff4('0x57')];queues[_0x14d3a0[_0xcff4('0x57')]][_0xcff4('0x20')]=0x2;queues[_0x14d3a0[_0xcff4('0x57')]]['calleridnum']=queues[_0x14d3a0[_0xcff4('0x4f')]][_0xcff4('0x5b')];queues[_0x14d3a0[_0xcff4('0x57')]]['calleridname']=queues[_0x14d3a0['origtransfererlinkedid']][_0xcff4('0x58')];queues[_0x14d3a0[_0xcff4('0x57')]][_0xcff4('0x36')]=utils['now']();queues[_0x14d3a0[_0xcff4('0x57')]][_0xcff4('0x18')]=utils['now']();queues[_0x14d3a0[_0xcff4('0x57')]][_0xcff4('0x34')]=0x0;queues[_0x14d3a0[_0xcff4('0x57')]][_0xcff4('0x59')]=0x0;utils[_0xcff4('0x3')](util[_0xcff4('0x10')](_0xcff4('0x61'),_0x14d3a0[_0xcff4('0x4e')],queues[_0x14d3a0[_0xcff4('0x57')]][_0xcff4('0x1e')],queues[_0x14d3a0[_0xcff4('0x57')]][_0xcff4('0xd')],queues[_0x14d3a0[_0xcff4('0x57')]][_0xcff4('0x5b')],queues[_0x14d3a0[_0xcff4('0x57')]][_0xcff4('0x58')]));}else{utils[_0xcff4('0x3')](util[_0xcff4('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x14d3a0['origtransfereruniqueid'],queues[_0x14d3a0[_0xcff4('0x50')]][_0xcff4('0x1e')],_0x14d3a0['origtransfererlinkedid']));queues[_0x14d3a0[_0xcff4('0x50')]][_0xcff4('0xd')]=_0x14d3a0[_0xcff4('0x4f')];}}}}catch(_0xb261f6){utils[_0xcff4('0x2d')](util['format']('[%s][queues][attendedtransfer]',_0x14d3a0[_0xcff4('0x4e')]),_0xb261f6);}};exports[_0xcff4('0x62')]=function(_0x1e0630){try{if(!_[_0xcff4('0x23')](queues[_0x1e0630[_0xcff4('0x4')]])){utils[_0xcff4('0xf')](util[_0xcff4('0x10')](_0xcff4('0x63'),_0x1e0630[_0xcff4('0x4')]),_0x1e0630);queues[_0x1e0630[_0xcff4('0x4')]]['musiconholdstartAt']=utils[_0xcff4('0x14')]();utils[_0xcff4('0x3')](util[_0xcff4('0x10')](_0xcff4('0x64'),_0x1e0630[_0xcff4('0x4')],queues[_0x1e0630['uniqueid']][_0xcff4('0x1e')],queues[_0x1e0630[_0xcff4('0x4')]][_0xcff4('0x65')]));}}catch(_0x22a489){utils[_0xcff4('0x2d')](util[_0xcff4('0x10')](_0xcff4('0x63'),_0x1e0630['uniqueid']),_0x22a489);}};exports['musiconholdstop']=function(_0x2de49a){try{if(!_[_0xcff4('0x23')](queues[_0x2de49a[_0xcff4('0x4')]])){if(!_[_0xcff4('0x23')](queues[_0x2de49a['uniqueid']][_0xcff4('0x65')])){utils[_0xcff4('0xf')](util['format']('[%s][queues][musiconholdstop]',_0x2de49a[_0xcff4('0x4')]),_0x2de49a);queues[_0x2de49a[_0xcff4('0x4')]][_0xcff4('0x59')]+=utils[_0xcff4('0x35')](utils[_0xcff4('0x14')](),queues[_0x2de49a[_0xcff4('0x4')]][_0xcff4('0x65')]);utils[_0xcff4('0x3')](util[_0xcff4('0x10')](_0xcff4('0x66'),_0x2de49a['uniqueid'],queues[_0x2de49a[_0xcff4('0x4')]][_0xcff4('0x1e')],queues[_0x2de49a[_0xcff4('0x4')]][_0xcff4('0x59')]));delete queues[_0x2de49a[_0xcff4('0x4')]][_0xcff4('0x65')];}}}catch(_0xe076cd){utils[_0xcff4('0x2d')](util[_0xcff4('0x10')](_0xcff4('0x67'),_0x2de49a[_0xcff4('0x4')]),_0xe076cd);}}; \ No newline at end of file +var _0x3073=['calleridname','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','format','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','assign','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','position','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','queuecallercomplete','reason','transfer','TRANSFER','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transferexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid'];(function(_0x41568f,_0x7c6734){var _0x2b35e5=function(_0x486c48){while(--_0x486c48){_0x41568f['push'](_0x41568f['shift']());}};_0x2b35e5(++_0x7c6734);}(_0x3073,0x73));var _0x3307=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x3073[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x3307('0x0'));var util=require('util');var utils=require(_0x3307('0x1'));var queues={};function writeDB(_0x367003){utils['info'](util[_0x3307('0x2')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x367003[_0x3307('0x3')],_0x367003['channel'],_0x367003[_0x3307('0x4')],_0x367003[_0x3307('0x5')],_0x367003[_0x3307('0x6')],_0x367003[_0x3307('0x7')],_0x367003[_0x3307('0x8')]));if(_0x367003['queue']){utils[_0x3307('0x9')](_0x367003[_0x3307('0x4')])[_0x3307('0xa')](function(_0x353712){if(_0x353712){_0x367003['type']=_0x353712['type'];}utils[_0x3307('0xb')]('CreateVoiceQueueReport',_0x367003);});}else{utils[_0x3307('0xb')]('CreateVoiceQueueReport',_0x367003);}if(_0x367003[_0x3307('0xc')]){delete queues[_0x367003[_0x3307('0xc')]];}else{delete queues[_0x367003[_0x3307('0x3')]];}}exports[_0x3307('0xd')]=function(_0x2cef96){try{utils[_0x3307('0xe')](util[_0x3307('0x2')](_0x3307('0xf'),_0x2cef96[_0x3307('0x3')]),_0x2cef96);utils[_0x3307('0x10')](util[_0x3307('0x2')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x2cef96[_0x3307('0x3')],_0x2cef96[_0x3307('0x4')],_0x2cef96['position']));queues[_0x2cef96[_0x3307('0x3')]]=_[_0x3307('0x11')](_0x2cef96,{'originalposition':_0x2cef96['position'],'queuecallerjoinAt':utils[_0x3307('0x12')](),'mohtime':0x0});}catch(_0x30a61f){utils[_0x3307('0x13')](util['format'](_0x3307('0xf'),_0x2cef96['uniqueid']),_0x30a61f);}};exports['hangup']=function(_0x6aafac){try{if(!_[_0x3307('0x14')](queues[_0x6aafac[_0x3307('0x3')]])){utils[_0x3307('0xe')](util['format'](_0x3307('0x15'),_0x6aafac[_0x3307('0x3')]),_0x6aafac);if(queues[_0x6aafac['uniqueid']][_0x3307('0x16')]){if(!queues[_0x6aafac[_0x3307('0x3')]]['queuecallerabandon']&&!queues[_0x6aafac[_0x3307('0x3')]][_0x3307('0x17')]){queues[_0x6aafac[_0x3307('0x3')]]['queuecallercomplete']=!![];queues[_0x6aafac[_0x3307('0x3')]][_0x3307('0x18')]=utils[_0x3307('0x12')]();queues[_0x6aafac[_0x3307('0x3')]][_0x3307('0x8')]=_0x3307('0x19');}utils['info'](util[_0x3307('0x2')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x6aafac[_0x3307('0x3')],queues[_0x6aafac['uniqueid']][_0x3307('0x1a')],queues[_0x6aafac[_0x3307('0x3')]][_0x3307('0x8')]));writeDB(queues[_0x6aafac[_0x3307('0x3')]]);}else if(queues[_0x6aafac[_0x3307('0x3')]][_0x3307('0xc')]){utils[_0x3307('0x10')](util['format'](_0x3307('0x1b'),_0x6aafac[_0x3307('0x3')],queues[_0x6aafac[_0x3307('0x3')]][_0x3307('0x1a')],queues[_0x6aafac['uniqueid']][_0x3307('0xc')]));queues[queues[_0x6aafac['uniqueid']][_0x3307('0xc')]]=queues[_0x6aafac[_0x3307('0x3')]];queues[queues[_0x6aafac[_0x3307('0x3')]][_0x3307('0xc')]][_0x3307('0x1c')]=0x2;delete queues[_0x6aafac[_0x3307('0x3')]];}}}catch(_0x1b84cb){utils['error'](util[_0x3307('0x2')]('[%s][queues][hangup]',_0x6aafac['uniqueid']),_0x1b84cb);}};exports['varset']=function(_0x263f05){try{utils['debug'](util[_0x3307('0x2')](_0x3307('0x1d'),_0x263f05[_0x3307('0x3')]),_0x263f05);if(!_['isNil'](_0x263f05[_0x3307('0x1e')][_0x3307('0x1f')])&&_0x263f05[_0x3307('0x20')][_0x3307('0x21')]()!==_0x3307('0x22')){if(!_[_0x3307('0x14')](queues[_0x263f05[_0x3307('0x3')]])){queues[_0x263f05[_0x3307('0x3')]][_0x3307('0x23')]=![];queues[_0x263f05[_0x3307('0x3')]][_0x3307('0x24')]=null;queues[_0x263f05[_0x3307('0x3')]][_0x3307('0x17')]=!![];queues[_0x263f05[_0x3307('0x3')]][_0x3307('0x25')]=utils[_0x3307('0x12')]();queues[_0x263f05['uniqueid']][_0x3307('0x8')]=_0x263f05['value'][_0x3307('0x21')]();utils[_0x3307('0x10')](util['format'](_0x3307('0x26'),_0x263f05[_0x3307('0x3')],queues[_0x263f05[_0x3307('0x3')]]['name'],_0x263f05[_0x3307('0x20')],queues[_0x263f05['uniqueid']][_0x3307('0x8')]));writeDB(queues[_0x263f05[_0x3307('0x3')]]);}}else if(!_[_0x3307('0x14')](_0x263f05[_0x3307('0x1e')][_0x3307('0x27')])){if(!_[_0x3307('0x14')](queues[_0x263f05[_0x3307('0x3')]])&&!queues[_0x263f05[_0x3307('0x3')]]['queuecallerabandon']){queues[_0x263f05[_0x3307('0x3')]][_0x3307('0x23')]=![];queues[_0x263f05[_0x3307('0x3')]]['queuecallerabandonAt']=null;queues[_0x263f05[_0x3307('0x3')]]['queuecallerexit']=!![];queues[_0x263f05[_0x3307('0x3')]]['queuecallerexitAt']=utils[_0x3307('0x12')]();queues[_0x263f05[_0x3307('0x3')]][_0x3307('0x8')]=_0x3307('0x28');utils[_0x3307('0x10')](util['format'](_0x3307('0x29'),_0x263f05['uniqueid'],queues[_0x263f05[_0x3307('0x3')]]['name'],_0x263f05[_0x3307('0x20')],queues[_0x263f05[_0x3307('0x3')]][_0x3307('0x8')]));}}}catch(_0x24ee69){utils['error'](util[_0x3307('0x2')]('[%s][queues][varset]',_0x263f05[_0x3307('0x3')]),_0x24ee69);}};exports[_0x3307('0x23')]=function(_0x38f1d8){try{if(!_[_0x3307('0x14')](queues[_0x38f1d8[_0x3307('0x3')]])){utils[_0x3307('0xe')](util['format'](_0x3307('0x2a'),_0x38f1d8[_0x3307('0x3')]),_0x38f1d8);queues[_0x38f1d8[_0x3307('0x3')]][_0x3307('0x17')]=![];queues[_0x38f1d8[_0x3307('0x3')]]['queuecallerexitAt']=null;queues[_0x38f1d8[_0x3307('0x3')]][_0x3307('0x23')]=!![];queues[_0x38f1d8[_0x3307('0x3')]]['queuecallerabandonAt']=utils[_0x3307('0x12')]();queues[_0x38f1d8[_0x3307('0x3')]][_0x3307('0x8')]='ABANDONED';utils[_0x3307('0x10')](util[_0x3307('0x2')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x38f1d8['uniqueid'],queues[_0x38f1d8['uniqueid']][_0x3307('0x1a')],queues[_0x38f1d8[_0x3307('0x3')]][_0x3307('0x8')]));}}catch(_0x1f0ada){utils[_0x3307('0x13')](util[_0x3307('0x2')](_0x3307('0x2a'),_0x38f1d8[_0x3307('0x3')]),_0x1f0ada);}};exports['queuecallerleave']=function(_0x367936){try{if(!_[_0x3307('0x14')](queues[_0x367936['uniqueid']])){utils[_0x3307('0xe')](util[_0x3307('0x2')](_0x3307('0x2b'),_0x367936['uniqueid']),_0x367936);utils['info'](util[_0x3307('0x2')](_0x3307('0x2c'),_0x367936[_0x3307('0x3')],queues[_0x367936[_0x3307('0x3')]]['name'],_0x367936[_0x3307('0x2d')],_0x367936[_0x3307('0x2e')]));queues[_0x367936[_0x3307('0x3')]][_0x3307('0x2f')]=!![];queues[_0x367936[_0x3307('0x3')]][_0x3307('0x16')]=utils[_0x3307('0x12')]();queues[_0x367936[_0x3307('0x3')]][_0x3307('0x30')]=utils[_0x3307('0x31')](queues[_0x367936[_0x3307('0x3')]][_0x3307('0x16')],queues[_0x367936['uniqueid']]['queuecallerjoinAt']);queues[_0x367936[_0x3307('0x3')]]['position']=_0x367936[_0x3307('0x32')];queues[_0x367936['uniqueid']][_0x3307('0x33')]=_0x367936[_0x3307('0x33')];queues[_0x367936[_0x3307('0x3')]][_0x3307('0x2d')]=_0x367936['connectedlinenum'];queues[_0x367936[_0x3307('0x3')]][_0x3307('0x2e')]=_0x367936[_0x3307('0x2e')];}}catch(_0x23ce78){utils[_0x3307('0x13')](util['format'](_0x3307('0x2b'),_0x367936[_0x3307('0x3')]),_0x23ce78);}};exports[_0x3307('0x34')]=function(_0x249044){try{if(!_['isNil'](queues[_0x249044[_0x3307('0x3')]])){utils[_0x3307('0xe')](util[_0x3307('0x2')](_0x3307('0x35'),_0x249044[_0x3307('0x3')]),_0x249044);utils[_0x3307('0x10')](util[_0x3307('0x2')](_0x3307('0x36'),_0x249044[_0x3307('0x3')],queues[_0x249044['uniqueid']][_0x3307('0x1a')],_0x249044[_0x3307('0x37')],_0x249044[_0x3307('0x38')]));queues[_0x249044[_0x3307('0x3')]][_0x3307('0x23')]=![];queues[_0x249044[_0x3307('0x3')]][_0x3307('0x23')]=![];queues[_0x249044[_0x3307('0x3')]][_0x3307('0x24')]=null;queues[_0x249044[_0x3307('0x3')]][_0x3307('0x17')]=![];queues[_0x249044[_0x3307('0x3')]][_0x3307('0x8')]=null;queues[_0x249044[_0x3307('0x3')]][_0x3307('0x25')]=null;queues[_0x249044[_0x3307('0x3')]][_0x3307('0x39')]=!![];queues[_0x249044['uniqueid']][_0x3307('0x7')]=_0x249044['destaccountcode'];queues[_0x249044['uniqueid']][_0x3307('0x5')]=_0x249044[_0x3307('0x37')];}}catch(_0x41991f){utils[_0x3307('0x13')](util[_0x3307('0x2')](_0x3307('0x35'),_0x249044['uniqueid']),_0x41991f);}};exports[_0x3307('0x3a')]=function(_0x35a947){try{if(!_[_0x3307('0x14')](queues[_0x35a947[_0x3307('0x3')]])){if(queues[_0x35a947[_0x3307('0x3')]][_0x3307('0x16')]){utils[_0x3307('0xe')](util['format']('[%s][queues][agentcomplete]',_0x35a947[_0x3307('0x3')]),_0x35a947);queues[_0x35a947['uniqueid']][_0x3307('0x23')]=![];queues[_0x35a947[_0x3307('0x3')]][_0x3307('0x23')]=![];queues[_0x35a947[_0x3307('0x3')]]['queuecallerabandonAt']=null;queues[_0x35a947[_0x3307('0x3')]][_0x3307('0x17')]=![];queues[_0x35a947[_0x3307('0x3')]][_0x3307('0x25')]=null;queues[_0x35a947[_0x3307('0x3')]][_0x3307('0x39')]=!![];queues[_0x35a947[_0x3307('0x3')]]['lastAssignedTo']=_0x35a947[_0x3307('0x37')];queues[_0x35a947[_0x3307('0x3')]][_0x3307('0x3b')]=!![];queues[_0x35a947[_0x3307('0x3')]][_0x3307('0x18')]=utils[_0x3307('0x12')]();if(_0x35a947[_0x3307('0x3c')]==_0x3307('0x3d')){if(!queues[_0x35a947[_0x3307('0x3')]]['transfer']){queues[_0x35a947[_0x3307('0x3')]]['queuecallerexitreason']=_0x3307('0x3e');}}else{queues[_0x35a947[_0x3307('0x3')]][_0x3307('0x8')]='COMPLETEDBY'+_0x35a947[_0x3307('0x3c')][_0x3307('0x21')]();}utils[_0x3307('0x10')](util[_0x3307('0x2')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x35a947[_0x3307('0x3')],queues[_0x35a947[_0x3307('0x3')]]['name'],_0x35a947[_0x3307('0x37')],queues[_0x35a947['uniqueid']][_0x3307('0x8')]));writeDB(queues[_0x35a947[_0x3307('0x3')]]);}}}catch(_0x5c887b){utils[_0x3307('0x13')](util[_0x3307('0x2')](_0x3307('0x3f'),_0x35a947[_0x3307('0x3')]),_0x5c887b);}};exports[_0x3307('0x40')]=function(_0x26f5bd){try{if(!_[_0x3307('0x14')](queues[_0x26f5bd['transfereeuniqueid']])){utils[_0x3307('0xe')](util[_0x3307('0x2')]('[%s][queues][blindtransfer]',_0x26f5bd[_0x3307('0x3')]),_0x26f5bd);queues[_0x26f5bd[_0x3307('0x41')]][_0x3307('0x3d')]=!![];queues[_0x26f5bd[_0x3307('0x41')]][_0x3307('0x42')]=_0x3307('0x43');queues[_0x26f5bd[_0x3307('0x41')]]['transferexten']=_0x26f5bd['extension'];queues[_0x26f5bd[_0x3307('0x41')]][_0x3307('0x44')]=_0x26f5bd['transfereeuniqueid'];queues[_0x26f5bd[_0x3307('0x41')]][_0x3307('0x8')]=_0x3307('0x45');utils[_0x3307('0x10')](util[_0x3307('0x2')](_0x3307('0x46'),_0x26f5bd[_0x3307('0x3')],queues[_0x26f5bd['transfereeuniqueid']][_0x3307('0x1a')],_0x26f5bd['transfereeuniqueid'],_0x26f5bd[_0x3307('0x47')]));}}catch(_0x4fec19){utils[_0x3307('0x13')](util[_0x3307('0x2')](_0x3307('0x48'),_0x26f5bd[_0x3307('0x3')]),_0x4fec19);}};exports[_0x3307('0x49')]=function(_0xbc79bb){try{utils['debug'](util['format'](_0x3307('0x4a'),_0xbc79bb[_0x3307('0x4b')]),_0xbc79bb);if(_0xbc79bb['origtransfereruniqueid']==_0xbc79bb['origtransfererlinkedid']){if(!_[_0x3307('0x14')](queues[_0xbc79bb[_0x3307('0x4c')]])){utils[_0x3307('0x10')](util['format'](_0x3307('0x4d'),_0xbc79bb['origtransfereruniqueid'],queues[_0xbc79bb[_0x3307('0x4c')]][_0x3307('0x1a')],_0xbc79bb[_0x3307('0x4e')]));queues[_0xbc79bb[_0x3307('0x4c')]][_0x3307('0x3d')]=!![];queues[_0xbc79bb[_0x3307('0x4c')]][_0x3307('0x42')]='ATTENDED';queues[_0xbc79bb[_0x3307('0x4c')]][_0x3307('0x4f')]=_0xbc79bb['origtransfererexten'];queues[_0xbc79bb[_0x3307('0x4c')]]['transferuniqueid']=_0xbc79bb['origtransfereruniqueid'];queues[_0xbc79bb[_0x3307('0x4c')]][_0x3307('0x8')]=_0x3307('0x50');}if(!_[_0x3307('0x14')](queues[_0xbc79bb[_0x3307('0x51')]])){if(_0xbc79bb['transfereelinkedid']&&queues[_0xbc79bb['transfereelinkedid']]){queues[_0xbc79bb[_0x3307('0x52')]][_0x3307('0x1c')]=0x1;queues[_0xbc79bb[_0x3307('0x41')]]=_[_0x3307('0x53')](queues[_0xbc79bb[_0x3307('0x52')]]);queues[_0xbc79bb[_0x3307('0x41')]][_0x3307('0xc')]=_0xbc79bb[_0x3307('0x54')];queues[_0xbc79bb[_0x3307('0x41')]][_0x3307('0x1c')]=0x2;queues[_0xbc79bb[_0x3307('0x41')]]['calleridnum']=queues[_0xbc79bb['secondtransfererlinkedid']][_0x3307('0x6')];queues[_0xbc79bb[_0x3307('0x41')]][_0x3307('0x55')]=queues[_0xbc79bb[_0x3307('0x4c')]][_0x3307('0x55')];queues[_0xbc79bb[_0x3307('0x41')]][_0x3307('0x56')]=utils[_0x3307('0x12')]();queues[_0xbc79bb[_0x3307('0x41')]]['queuecallerleaveAt']=utils[_0x3307('0x12')]();queues[_0xbc79bb['transfereeuniqueid']][_0x3307('0x30')]=0x0;queues[_0xbc79bb[_0x3307('0x41')]]['mohtime']=0x0;utils[_0x3307('0x10')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0xbc79bb[_0x3307('0x4b')],queues[_0xbc79bb['transfereeuniqueid']][_0x3307('0x1a')],queues[_0xbc79bb[_0x3307('0x41')]][_0x3307('0x6')],queues[_0xbc79bb['transfereeuniqueid']][_0x3307('0x55')]));}else{utils['info'](util[_0x3307('0x2')](_0x3307('0x57'),_0xbc79bb[_0x3307('0x4b')],queues[_0xbc79bb[_0x3307('0x51')]][_0x3307('0x1a')],_0xbc79bb['secondtransfererlinkedid']));queues[_0xbc79bb['origtransfererlinkedid']][_0x3307('0xc')]=_0xbc79bb[_0x3307('0x4c')];}}}else if(_0xbc79bb[_0x3307('0x58')]==_0xbc79bb['secondtransfererlinkedid']){if(!_['isNil'](queues[_0xbc79bb[_0x3307('0x51')]])){utils[_0x3307('0x10')](util[_0x3307('0x2')](_0x3307('0x59'),_0xbc79bb[_0x3307('0x4b')],queues[_0xbc79bb[_0x3307('0x51')]]['name'],_0xbc79bb['secondtransfereruniqueid'],_0xbc79bb['secondtransfererexten']));queues[_0xbc79bb['origtransfererlinkedid']][_0x3307('0x3d')]=!![];queues[_0xbc79bb[_0x3307('0x51')]][_0x3307('0x42')]='ATTENDED';queues[_0xbc79bb[_0x3307('0x51')]][_0x3307('0x4f')]=_0xbc79bb[_0x3307('0x5a')];queues[_0xbc79bb[_0x3307('0x51')]][_0x3307('0x44')]=_0xbc79bb[_0x3307('0x58')];queues[_0xbc79bb['origtransfererlinkedid']][_0x3307('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x3307('0x14')](queues[_0xbc79bb[_0x3307('0x4c')]])){if(_0xbc79bb[_0x3307('0x5b')]&&queues[_0xbc79bb[_0x3307('0x5b')]]){queues[_0xbc79bb[_0x3307('0x5b')]][_0x3307('0x1c')]=0x1;queues[_0xbc79bb[_0x3307('0x54')]]=_[_0x3307('0x53')](queues[_0xbc79bb['transfertargetlinkedid']]);queues[_0xbc79bb[_0x3307('0x54')]]['transfereduniqueid']=_0xbc79bb[_0x3307('0x54')];queues[_0xbc79bb[_0x3307('0x54')]][_0x3307('0x1c')]=0x2;queues[_0xbc79bb[_0x3307('0x54')]][_0x3307('0x6')]=queues[_0xbc79bb[_0x3307('0x51')]][_0x3307('0x6')];queues[_0xbc79bb[_0x3307('0x54')]][_0x3307('0x55')]=queues[_0xbc79bb['origtransfererlinkedid']][_0x3307('0x55')];queues[_0xbc79bb[_0x3307('0x54')]]['queuecallerjoinAt']=utils[_0x3307('0x12')]();queues[_0xbc79bb['transfertargetuniqueid']][_0x3307('0x16')]=utils[_0x3307('0x12')]();queues[_0xbc79bb[_0x3307('0x54')]]['holdtime']=0x0;queues[_0xbc79bb[_0x3307('0x54')]][_0x3307('0x5c')]=0x0;utils['info'](util[_0x3307('0x2')](_0x3307('0x5d'),_0xbc79bb[_0x3307('0x4b')],queues[_0xbc79bb['transfertargetuniqueid']][_0x3307('0x1a')],queues[_0xbc79bb[_0x3307('0x54')]][_0x3307('0xc')],queues[_0xbc79bb[_0x3307('0x54')]][_0x3307('0x6')],queues[_0xbc79bb['transfertargetuniqueid']][_0x3307('0x55')]));}else{utils[_0x3307('0x10')](util[_0x3307('0x2')](_0x3307('0x57'),_0xbc79bb[_0x3307('0x4b')],queues[_0xbc79bb['secondtransfererlinkedid']][_0x3307('0x1a')],_0xbc79bb[_0x3307('0x51')]));queues[_0xbc79bb['secondtransfererlinkedid']][_0x3307('0xc')]=_0xbc79bb[_0x3307('0x51')];}}}}catch(_0x3ceadc){utils[_0x3307('0x13')](util[_0x3307('0x2')](_0x3307('0x4a'),_0xbc79bb['origtransfereruniqueid']),_0x3ceadc);}};exports[_0x3307('0x5e')]=function(_0x310472){try{if(!_['isNil'](queues[_0x310472[_0x3307('0x3')]])){utils['debug'](util[_0x3307('0x2')](_0x3307('0x5f'),_0x310472[_0x3307('0x3')]),_0x310472);queues[_0x310472[_0x3307('0x3')]][_0x3307('0x60')]=utils[_0x3307('0x12')]();utils[_0x3307('0x10')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x310472[_0x3307('0x3')],queues[_0x310472[_0x3307('0x3')]][_0x3307('0x1a')],queues[_0x310472[_0x3307('0x3')]][_0x3307('0x60')]));}}catch(_0x382d6f){utils[_0x3307('0x13')](util['format']('[%s][queues][musiconholdstart]',_0x310472[_0x3307('0x3')]),_0x382d6f);}};exports[_0x3307('0x61')]=function(_0x5113b6){try{if(!_[_0x3307('0x14')](queues[_0x5113b6[_0x3307('0x3')]])){if(!_['isNil'](queues[_0x5113b6[_0x3307('0x3')]]['musiconholdstartAt'])){utils[_0x3307('0xe')](util[_0x3307('0x2')](_0x3307('0x62'),_0x5113b6[_0x3307('0x3')]),_0x5113b6);queues[_0x5113b6[_0x3307('0x3')]][_0x3307('0x5c')]+=utils[_0x3307('0x31')](utils['now'](),queues[_0x5113b6[_0x3307('0x3')]]['musiconholdstartAt']);utils['info'](util[_0x3307('0x2')](_0x3307('0x63'),_0x5113b6[_0x3307('0x3')],queues[_0x5113b6[_0x3307('0x3')]][_0x3307('0x1a')],queues[_0x5113b6[_0x3307('0x3')]][_0x3307('0x5c')]));delete queues[_0x5113b6[_0x3307('0x3')]][_0x3307('0x60')];}}}catch(_0x432a28){utils[_0x3307('0x13')](util[_0x3307('0x2')](_0x3307('0x62'),_0x5113b6[_0x3307('0x3')]),_0x432a28);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index a464f9a..5029e5f 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 _0x4780=['application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','isNil','channelstate','channel','linkedid','transfer','[%s][recordings][newstate]','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten'];(function(_0x388509,_0x2f30fa){var _0x52a884=function(_0x3def68){while(--_0x3def68){_0x388509['push'](_0x388509['shift']());}};_0x52a884(++_0x2f30fa);}(_0x4780,0x1d5));var _0x0478=function(_0x21025c,_0x22b9c8){_0x21025c=_0x21025c-0x0;var _0x489329=_0x4780[_0x21025c];return _0x489329;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x723c08){utils[_0x0478('0x0')](util['format'](_0x0478('0x1'),_0x723c08[_0x0478('0x2')]));if(_0x723c08[_0x0478('0x3')]){utils[_0x0478('0x4')](_0x723c08[_0x0478('0x3')])['then'](function(_0x408059){if(_0x408059){_0x723c08[_0x0478('0x5')]=_0x408059['name'];_0x723c08[_0x0478('0x6')]=_0x408059['id'];}utils['request'](_0x0478('0x7'),_0x723c08);});}else{utils[_0x0478('0x8')](_0x0478('0x7'),_0x723c08);}}exports[_0x0478('0x9')]=function(_0x3c3d66){try{utils[_0x0478('0xa')](util['format'](_0x0478('0xb'),_0x3c3d66[_0x0478('0x2')]),_0x3c3d66);if(_0x3c3d66[_0x0478('0x2')]==_0x3c3d66['linkedid']){utils[_0x0478('0x0')](util[_0x0478('0xc')](_0x0478('0xd'),_0x3c3d66[_0x0478('0x2')],_0x3c3d66[_0x0478('0xe')],_0x3c3d66[_0x0478('0xf')]));recordings[_0x3c3d66[_0x0478('0x2')]]={'uniqueid':_0x3c3d66[_0x0478('0x2')],'accountcode':_0x3c3d66[_0x0478('0x3')],'exten':_0x3c3d66[_0x0478('0xf')],'context':_0x3c3d66[_0x0478('0xe')],'channel':_0x3c3d66['channel'],'monitors':[]};}}catch(_0x412776){utils[_0x0478('0x10')](util[_0x0478('0xc')]('[%s][recordings][newchannel]',_0x3c3d66['uniqueid']),_0x412776);}};exports[_0x0478('0x11')]=function(_0x25f519){try{utils[_0x0478('0xa')](util[_0x0478('0xc')]('[%s][recordings][newstate]',_0x25f519['uniqueid']),_0x25f519);if(!_[_0x0478('0x12')](recordings[_0x25f519[_0x0478('0x2')]])&&_0x25f519[_0x0478('0x13')]==0x6){utils['info'](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x25f519[_0x0478('0x2')],_0x25f519['context'],_0x25f519[_0x0478('0x14')]));}else if(!_['isNil'](recordings[_0x25f519[_0x0478('0x15')]])&&_0x25f519['channelstate']==0x6&&_0x25f519[_0x0478('0xe')]!=_0x0478('0x16')){utils['info'](util[_0x0478('0xc')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x25f519[_0x0478('0x2')],_0x25f519[_0x0478('0x15')],_0x25f519[_0x0478('0xe')],_0x25f519[_0x0478('0x14')]));recordings[_0x25f519[_0x0478('0x15')]]['accountcode']=_0x25f519[_0x0478('0x3')];}}catch(_0x502ac9){utils[_0x0478('0x10')](util['format'](_0x0478('0x17'),_0x25f519[_0x0478('0x2')]),_0x502ac9);}};exports['varset']=function(_0x30769d){try{if(!_[_0x0478('0x12')](_0x30769d[_0x0478('0x18')])&&!_['isNil'](_0x30769d['variable']['mixmonitor_filename'])){utils[_0x0478('0xa')](util[_0x0478('0xc')](_0x0478('0x19'),_0x30769d['uniqueid']),_0x30769d);utils[_0x0478('0x0')](util[_0x0478('0xc')](_0x0478('0x1a'),_0x30769d['uniqueid'],_0x30769d[_0x0478('0x18')],_0x30769d['value']));if(_[_0x0478('0x1b')](_0x30769d[_0x0478('0x1c')],_0x0478('0x1d'))){_0x30769d['value']=_0x30769d[_0x0478('0x1c')]['replace'](_0x0478('0x1d'),'.WAV');}if(recordings[_0x30769d[_0x0478('0x15')]]){var _0x1cec61=_['find'](recordings[_0x30769d[_0x0478('0x15')]][_0x0478('0x1e')],{'value':_0x30769d[_0x0478('0x1c')]});if(_['isNil'](_0x1cec61)){recordings[_0x30769d[_0x0478('0x15')]][_0x0478('0x1e')][_0x0478('0x1f')]({'value':_0x30769d[_0x0478('0x1c')]});}}}}catch(_0x1ffeff){utils['error'](util[_0x0478('0xc')](_0x0478('0x19'),_0x30769d[_0x0478('0x2')]),_0x1ffeff);}};exports[_0x0478('0x20')]=function(_0x50d0a7){try{if(!_['isNil'](recordings[_0x50d0a7[_0x0478('0x2')]])){utils['debug'](util[_0x0478('0xc')](_0x0478('0x21'),_0x50d0a7[_0x0478('0x2')]),_0x50d0a7);utils[_0x0478('0x0')](util['format'](_0x0478('0x22'),_0x50d0a7['uniqueid'],_0x50d0a7[_0x0478('0x23')],_0x50d0a7['calleridname'],_0x50d0a7[_0x0478('0x24')]));recordings[_0x50d0a7[_0x0478('0x2')]][_0x0478('0x23')]=_0x50d0a7[_0x0478('0x23')];recordings[_0x50d0a7[_0x0478('0x2')]][_0x0478('0x25')]=_0x50d0a7[_0x0478('0x25')];recordings[_0x50d0a7[_0x0478('0x2')]][_0x0478('0x26')]=_0x50d0a7[_0x0478('0x26')];recordings[_0x50d0a7[_0x0478('0x2')]][_0x0478('0x27')]=_0x50d0a7['connectedlinename'];if(recordings[_0x50d0a7['uniqueid']][_0x0478('0x28')]==_0x0478('0x29')&&recordings[_0x50d0a7[_0x0478('0x2')]]['accountcode']){recordings[_0x50d0a7[_0x0478('0x2')]][_0x0478('0x26')]=recordings[_0x50d0a7[_0x0478('0x2')]][_0x0478('0x3')];recordings[_0x50d0a7[_0x0478('0x2')]][_0x0478('0x27')]='';}recordings[_0x50d0a7[_0x0478('0x2')]][_0x0478('0x1e')]['forEach'](function(_0x3f9b7d){var _0x594e69=_[_0x0478('0x2a')](recordings[_0x50d0a7[_0x0478('0x2')]]);_0x594e69[_0x0478('0x1c')]=_0x3f9b7d['value'];writeDB(_0x594e69);});delete recordings[_0x50d0a7[_0x0478('0x2')]];}}catch(_0x5649c8){utils['error'](util[_0x0478('0xc')](_0x0478('0x21'),_0x50d0a7['uniqueid']),_0x5649c8);}};exports[_0x0478('0x2b')]=function(_0x3d2b27){try{if(!_[_0x0478('0x12')](recordings[_0x3d2b27[_0x0478('0x2')]])){utils[_0x0478('0xa')](util['format']('[%s][recordings][newexten]',_0x3d2b27[_0x0478('0x2')]),_0x3d2b27);utils[_0x0478('0x0')](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x3d2b27[_0x0478('0x2')],_0x3d2b27[_0x0478('0x2c')],_0x3d2b27[_0x0478('0x2d')]));if(_0x3d2b27[_0x0478('0x2c')][_0x0478('0x2e')]()==_0x0478('0x2f')&&_[_0x0478('0x30')](_0x3d2b27[_0x0478('0x2d')]['toLowerCase'](),_0x0478('0x31'))){var _0xd551c8=_0x3d2b27[_0x0478('0x2d')][_0x0478('0x32')]('=');var _0x32008a=_0xd551c8[0x0][_0x0478('0x33')](_0xd551c8[0x0]['lastIndexOf']('(')+0x1,_0xd551c8[0x0][_0x0478('0x34')](')'));var _0x463de2=_0xd551c8[0x1];recordings[_0x3d2b27['uniqueid']][_0x32008a]=_0x463de2;}}}catch(_0x4a51bf){utils[_0x0478('0x10')](util[_0x0478('0xc')](_0x0478('0x35'),_0x3d2b27[_0x0478('0x2')]),_0x4a51bf);}};exports[_0x0478('0x36')]=function(_0x3d89c3){try{if(!_[_0x0478('0x12')](recordings[_0x3d89c3[_0x0478('0x2')]])){utils['debug'](util['format'](_0x0478('0x37'),_0x3d89c3[_0x0478('0x2')]),_0x3d89c3);utils[_0x0478('0x0')](util[_0x0478('0xc')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x3d89c3['uniqueid'],_0x3d89c3['queue']));recordings[_0x3d89c3['uniqueid']][_0x0478('0x38')]=_0x3d89c3['queue'];}}catch(_0x9bd65f){utils[_0x0478('0x10')](util['format'](_0x0478('0x37'),_0x3d89c3[_0x0478('0x2')]),_0x9bd65f);}}; \ No newline at end of file +var _0x2d76=['uniqueid','accountcode','getUserByInternal','then','membername','name','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','channel','error','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','variable','mixmonitor_filename','value','replace','.wav49','.WAV','find','monitors','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d76,0xeb));var _0x62d7=function(_0xeafe71,_0x4c7f64){_0xeafe71=_0xeafe71-0x0;var _0x35f1a=_0x2d76[_0xeafe71];return _0x35f1a;};'use strict';var _=require(_0x62d7('0x0'));var util=require(_0x62d7('0x1'));var utils=require(_0x62d7('0x2'));var recordings={};function writeDB(_0x50cb92){utils[_0x62d7('0x3')](util[_0x62d7('0x4')]('[%s][recordings][writeDB]',_0x50cb92[_0x62d7('0x5')]));if(_0x50cb92[_0x62d7('0x6')]){utils[_0x62d7('0x7')](_0x50cb92[_0x62d7('0x6')])[_0x62d7('0x8')](function(_0x353428){if(_0x353428){_0x50cb92[_0x62d7('0x9')]=_0x353428[_0x62d7('0xa')];_0x50cb92['UserId']=_0x353428['id'];}utils[_0x62d7('0xb')](_0x62d7('0xc'),_0x50cb92);});}else{utils['request'](_0x62d7('0xc'),_0x50cb92);}}exports['newchannel']=function(_0x3190ba){try{utils[_0x62d7('0xd')](util[_0x62d7('0x4')](_0x62d7('0xe'),_0x3190ba[_0x62d7('0x5')]),_0x3190ba);if(_0x3190ba['uniqueid']==_0x3190ba[_0x62d7('0xf')]){utils[_0x62d7('0x3')](util[_0x62d7('0x4')](_0x62d7('0x10'),_0x3190ba[_0x62d7('0x5')],_0x3190ba[_0x62d7('0x11')],_0x3190ba['exten']));recordings[_0x3190ba[_0x62d7('0x5')]]={'uniqueid':_0x3190ba['uniqueid'],'accountcode':_0x3190ba[_0x62d7('0x6')],'exten':_0x3190ba['exten'],'context':_0x3190ba[_0x62d7('0x11')],'channel':_0x3190ba[_0x62d7('0x12')],'monitors':[]};}}catch(_0x26f5dc){utils[_0x62d7('0x13')](util[_0x62d7('0x4')]('[%s][recordings][newchannel]',_0x3190ba[_0x62d7('0x5')]),_0x26f5dc);}};exports['newstate']=function(_0x40f3b6){try{utils['debug'](util[_0x62d7('0x4')](_0x62d7('0x14'),_0x40f3b6['uniqueid']),_0x40f3b6);if(!_['isNil'](recordings[_0x40f3b6[_0x62d7('0x5')]])&&_0x40f3b6[_0x62d7('0x15')]==0x6){utils[_0x62d7('0x3')](util[_0x62d7('0x4')](_0x62d7('0x16'),_0x40f3b6[_0x62d7('0x5')],_0x40f3b6[_0x62d7('0x11')],_0x40f3b6[_0x62d7('0x12')]));}else if(!_[_0x62d7('0x17')](recordings[_0x40f3b6[_0x62d7('0xf')]])&&_0x40f3b6[_0x62d7('0x15')]==0x6&&_0x40f3b6[_0x62d7('0x11')]!=_0x62d7('0x18')){utils[_0x62d7('0x3')](util[_0x62d7('0x4')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x40f3b6[_0x62d7('0x5')],_0x40f3b6[_0x62d7('0xf')],_0x40f3b6[_0x62d7('0x11')],_0x40f3b6[_0x62d7('0x12')]));recordings[_0x40f3b6['linkedid']][_0x62d7('0x6')]=_0x40f3b6[_0x62d7('0x6')];}}catch(_0x74b22b){utils['error'](util[_0x62d7('0x4')](_0x62d7('0x14'),_0x40f3b6['uniqueid']),_0x74b22b);}};exports['varset']=function(_0x5de132){try{if(!_[_0x62d7('0x17')](_0x5de132[_0x62d7('0x19')])&&!_['isNil'](_0x5de132['variable'][_0x62d7('0x1a')])){utils[_0x62d7('0xd')](util[_0x62d7('0x4')]('[%s][recordings][varset]',_0x5de132[_0x62d7('0x5')]),_0x5de132);utils[_0x62d7('0x3')](util[_0x62d7('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x5de132[_0x62d7('0x5')],_0x5de132[_0x62d7('0x19')],_0x5de132[_0x62d7('0x1b')]));if(_['endsWith'](_0x5de132[_0x62d7('0x1b')],'.wav49')){_0x5de132[_0x62d7('0x1b')]=_0x5de132[_0x62d7('0x1b')][_0x62d7('0x1c')](_0x62d7('0x1d'),_0x62d7('0x1e'));}if(recordings[_0x5de132['linkedid']]){var _0x22dfed=_[_0x62d7('0x1f')](recordings[_0x5de132[_0x62d7('0xf')]]['monitors'],{'value':_0x5de132['value']});if(_['isNil'](_0x22dfed)){recordings[_0x5de132['linkedid']][_0x62d7('0x20')]['push']({'value':_0x5de132[_0x62d7('0x1b')]});}}}}catch(_0x113a5c){utils[_0x62d7('0x13')](util[_0x62d7('0x4')](_0x62d7('0x21'),_0x5de132[_0x62d7('0x5')]),_0x113a5c);}};exports[_0x62d7('0x22')]=function(_0xe60217){try{if(!_[_0x62d7('0x17')](recordings[_0xe60217['uniqueid']])){utils[_0x62d7('0xd')](util[_0x62d7('0x4')](_0x62d7('0x23'),_0xe60217[_0x62d7('0x5')]),_0xe60217);utils[_0x62d7('0x3')](util[_0x62d7('0x4')](_0x62d7('0x24'),_0xe60217['uniqueid'],_0xe60217[_0x62d7('0x25')],_0xe60217['calleridname'],_0xe60217[_0x62d7('0x26')]));recordings[_0xe60217[_0x62d7('0x5')]][_0x62d7('0x25')]=_0xe60217[_0x62d7('0x25')];recordings[_0xe60217[_0x62d7('0x5')]]['calleridname']=_0xe60217[_0x62d7('0x27')];recordings[_0xe60217['uniqueid']][_0x62d7('0x28')]=_0xe60217['connectedlinenum'];recordings[_0xe60217['uniqueid']][_0x62d7('0x29')]=_0xe60217[_0x62d7('0x29')];if(recordings[_0xe60217['uniqueid']][_0x62d7('0x2a')]==_0x62d7('0x2b')&&recordings[_0xe60217['uniqueid']][_0x62d7('0x6')]){recordings[_0xe60217[_0x62d7('0x5')]][_0x62d7('0x28')]=recordings[_0xe60217[_0x62d7('0x5')]][_0x62d7('0x6')];recordings[_0xe60217[_0x62d7('0x5')]][_0x62d7('0x29')]='';}recordings[_0xe60217['uniqueid']][_0x62d7('0x20')][_0x62d7('0x2c')](function(_0x386d28){var _0x15dec6=_[_0x62d7('0x2d')](recordings[_0xe60217[_0x62d7('0x5')]]);_0x15dec6['value']=_0x386d28[_0x62d7('0x1b')];writeDB(_0x15dec6);});delete recordings[_0xe60217['uniqueid']];}}catch(_0xa2a5d7){utils[_0x62d7('0x13')](util['format'](_0x62d7('0x23'),_0xe60217[_0x62d7('0x5')]),_0xa2a5d7);}};exports[_0x62d7('0x2e')]=function(_0x2f0356){try{if(!_[_0x62d7('0x17')](recordings[_0x2f0356['uniqueid']])){utils[_0x62d7('0xd')](util['format'](_0x62d7('0x2f'),_0x2f0356['uniqueid']),_0x2f0356);utils['info'](util[_0x62d7('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x2f0356[_0x62d7('0x5')],_0x2f0356[_0x62d7('0x30')],_0x2f0356[_0x62d7('0x31')]));if(_0x2f0356['application'][_0x62d7('0x32')]()==_0x62d7('0x33')&&_['startsWith'](_0x2f0356['appdata'][_0x62d7('0x32')](),_0x62d7('0x34'))){var _0x3b7fd7=_0x2f0356[_0x62d7('0x31')][_0x62d7('0x35')]('=');var _0x4ced10=_0x3b7fd7[0x0][_0x62d7('0x36')](_0x3b7fd7[0x0][_0x62d7('0x37')]('(')+0x1,_0x3b7fd7[0x0][_0x62d7('0x37')](')'));var _0x42e171=_0x3b7fd7[0x1];recordings[_0x2f0356[_0x62d7('0x5')]][_0x4ced10]=_0x42e171;}}}catch(_0x5d029e){utils[_0x62d7('0x13')](util[_0x62d7('0x4')](_0x62d7('0x2f'),_0x2f0356['uniqueid']),_0x5d029e);}};exports[_0x62d7('0x38')]=function(_0x5e10d2){try{if(!_[_0x62d7('0x17')](recordings[_0x5e10d2[_0x62d7('0x5')]])){utils['debug'](util[_0x62d7('0x4')](_0x62d7('0x39'),_0x5e10d2[_0x62d7('0x5')]),_0x5e10d2);utils[_0x62d7('0x3')](util[_0x62d7('0x4')](_0x62d7('0x3a'),_0x5e10d2[_0x62d7('0x5')],_0x5e10d2[_0x62d7('0x3b')]));recordings[_0x5e10d2[_0x62d7('0x5')]][_0x62d7('0x3b')]=_0x5e10d2[_0x62d7('0x3b')];}}catch(_0x23a803){utils[_0x62d7('0x13')](util['format']('[%s][recordings][queuecallerjoin]',_0x5e10d2['uniqueid']),_0x23a803);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index b7a647b..73f7335 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 _0xc2cd=['secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','type','origtransfereruniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode'];(function(_0x4e7901,_0x405fbf){var _0x44ef3b=function(_0x80cb32){while(--_0x80cb32){_0x4e7901['push'](_0x4e7901['shift']());}};_0x44ef3b(++_0x405fbf);}(_0xc2cd,0x103));var _0xdc2c=function(_0x1b8e96,_0x5425a0){_0x1b8e96=_0x1b8e96-0x0;var _0x38da7e=_0xc2cd[_0x1b8e96];return _0x38da7e;};'use strict';var _=require('lodash');var util=require(_0xdc2c('0x0'));var utils=require(_0xdc2c('0x1'));function writeDB(_0x3e75a3){utils[_0xdc2c('0x2')](util[_0xdc2c('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x3e75a3[_0xdc2c('0x4')]==='attended'?_0x3e75a3[_0xdc2c('0x5')]:_0x3e75a3['uniqueid'],_0x3e75a3['type']));utils[_0xdc2c('0x6')](_0xdc2c('0x7'),_0x3e75a3);}exports['blindtransfer']=function(_0x32ba7d){try{utils[_0xdc2c('0x8')](util['format'](_0xdc2c('0x9'),_0x32ba7d['uniqueid']),_0x32ba7d);utils[_0xdc2c('0x2')](util[_0xdc2c('0x3')](_0xdc2c('0xa'),_0x32ba7d[_0xdc2c('0xb')],_0x32ba7d['transferercalleridnum'],_0x32ba7d[_0xdc2c('0xc')],_0x32ba7d[_0xdc2c('0xd')],_0x32ba7d[_0xdc2c('0xe')]));_0x32ba7d[_0xdc2c('0x4')]=_0xdc2c('0xf');writeDB(_0x32ba7d);}catch(_0x29e0c9){utils[_0xdc2c('0x10')](util[_0xdc2c('0x3')](_0xdc2c('0x9'),_0x32ba7d['uniqueid']),_0x29e0c9);}};exports[_0xdc2c('0x11')]=function(_0x139795){try{utils[_0xdc2c('0x8')](util[_0xdc2c('0x3')](_0xdc2c('0x12'),_0x139795['origtransfereruniqueid']),_0x139795);utils[_0xdc2c('0x2')](util[_0xdc2c('0x3')](_0xdc2c('0x13'),_0x139795[_0xdc2c('0x5')],_0x139795[_0xdc2c('0x14')],_0x139795['origtransferercalleridname'],_0x139795[_0xdc2c('0x15')],_0x139795[_0xdc2c('0x16')]));_0x139795=_[_0xdc2c('0x17')](_0x139795,{'transfererchannel':_0x139795[_0xdc2c('0x18')],'transferercalleridnum':_0x139795['origtransferercalleridnum'],'transferercalleridname':_0x139795[_0xdc2c('0x19')],'transfererconnectedlinenum':_0x139795['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x139795[_0xdc2c('0x1a')],'transfereraccountcode':_0x139795[_0xdc2c('0x1b')],'transferercontext':_0x139795[_0xdc2c('0x1c')],'transfererexten':_0x139795[_0xdc2c('0x1d')],'transfererlinkedid':_0x139795[_0xdc2c('0x1e')],'context':_0x139795['origtransferercontext'],'extension':_0x139795[_0xdc2c('0x1f')],'type':_0xdc2c('0x20')});if(_[_0xdc2c('0x21')](_0x139795[_0xdc2c('0x22')])){_0x139795=_[_0xdc2c('0x17')](_0x139795,{'transfereechannel':_0x139795[_0xdc2c('0x23')],'transfereecalleridnum':_0x139795[_0xdc2c('0x15')],'transfereecalleridname':_0x139795[_0xdc2c('0x16')],'transfereeconnectedlinenum':_0x139795[_0xdc2c('0x24')],'transfereeconnectedlinename':_0x139795[_0xdc2c('0x25')],'transfereeaccountcode':_0x139795[_0xdc2c('0x26')],'transfereecontext':_0x139795['transfertargetcontext'],'transfereeexten':_0x139795[_0xdc2c('0x27')],'transfereelinkedid':_0x139795[_0xdc2c('0x28')]});}writeDB(_0x139795);}catch(_0x140bbc){utils['error'](util[_0xdc2c('0x3')](_0xdc2c('0x12'),_0x139795[_0xdc2c('0x5')]),_0x140bbc);}}; \ No newline at end of file +var _0x7130=['transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','util','info','format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','transferercalleridnum','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum'];(function(_0x477491,_0x5ca700){var _0xac6aec=function(_0x180568){while(--_0x180568){_0x477491['push'](_0x477491['shift']());}};_0xac6aec(++_0x5ca700);}(_0x7130,0x1a7));var _0x0713=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x7130[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x0713('0x0'));var util=require(_0x0713('0x1'));var utils=require('./utils');function writeDB(_0x1deef1){utils[_0x0713('0x2')](util[_0x0713('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x1deef1[_0x0713('0x4')]===_0x0713('0x5')?_0x1deef1[_0x0713('0x6')]:_0x1deef1[_0x0713('0x7')],_0x1deef1[_0x0713('0x4')]));utils[_0x0713('0x8')](_0x0713('0x9'),_0x1deef1);}exports['blindtransfer']=function(_0x332e6a){try{utils[_0x0713('0xa')](util[_0x0713('0x3')](_0x0713('0xb'),_0x332e6a[_0x0713('0x7')]),_0x332e6a);utils[_0x0713('0x2')](util[_0x0713('0x3')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x332e6a[_0x0713('0x7')],_0x332e6a[_0x0713('0xc')],_0x332e6a['transferercalleridname'],_0x332e6a['transfereecalleridnum'],_0x332e6a['transfereecalleridname']));_0x332e6a[_0x0713('0x4')]=_0x0713('0xd');writeDB(_0x332e6a);}catch(_0x5a6ada){utils[_0x0713('0xe')](util[_0x0713('0x3')](_0x0713('0xb'),_0x332e6a[_0x0713('0x7')]),_0x5a6ada);}};exports[_0x0713('0xf')]=function(_0x2ffc09){try{utils[_0x0713('0xa')](util[_0x0713('0x3')](_0x0713('0x10'),_0x2ffc09[_0x0713('0x6')]),_0x2ffc09);utils['info'](util[_0x0713('0x3')](_0x0713('0x11'),_0x2ffc09[_0x0713('0x6')],_0x2ffc09[_0x0713('0x12')],_0x2ffc09[_0x0713('0x13')],_0x2ffc09[_0x0713('0x14')],_0x2ffc09[_0x0713('0x15')]));_0x2ffc09=_[_0x0713('0x16')](_0x2ffc09,{'transfererchannel':_0x2ffc09[_0x0713('0x17')],'transferercalleridnum':_0x2ffc09[_0x0713('0x12')],'transferercalleridname':_0x2ffc09['origtransferercalleridname'],'transfererconnectedlinenum':_0x2ffc09[_0x0713('0x18')],'transfererconnectedlinename':_0x2ffc09['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2ffc09['origtransfereraccountcode'],'transferercontext':_0x2ffc09[_0x0713('0x19')],'transfererexten':_0x2ffc09[_0x0713('0x1a')],'transfererlinkedid':_0x2ffc09[_0x0713('0x1b')],'context':_0x2ffc09[_0x0713('0x1c')],'extension':_0x2ffc09[_0x0713('0x1d')],'type':'attended'});if(_[_0x0713('0x1e')](_0x2ffc09[_0x0713('0x1f')])){_0x2ffc09=_[_0x0713('0x16')](_0x2ffc09,{'transfereechannel':_0x2ffc09[_0x0713('0x20')],'transfereecalleridnum':_0x2ffc09[_0x0713('0x14')],'transfereecalleridname':_0x2ffc09['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2ffc09[_0x0713('0x21')],'transfereeconnectedlinename':_0x2ffc09['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2ffc09[_0x0713('0x22')],'transfereecontext':_0x2ffc09[_0x0713('0x23')],'transfereeexten':_0x2ffc09[_0x0713('0x24')],'transfereelinkedid':_0x2ffc09['transfertargetlinkedid']});}writeDB(_0x2ffc09);}catch(_0x5517ad){utils[_0x0713('0xe')](util['format'](_0x0713('0x10'),_0x2ffc09[_0x0713('0x6')]),_0x5517ad);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index a3750fd..9717bec 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 _0x22dd=['[utils][getUserByInternal]','[utils][getUserByInterface]','getUserByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','../../config/logger','info','inspect','error','request','then','debug','[utils][request]\x20name:%s','catch','internal','name','interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound'];(function(_0x4ebe88,_0x10b8a8){var _0x3dbfae=function(_0x5adc06){while(--_0x5adc06){_0x4ebe88['push'](_0x4ebe88['shift']());}};_0x3dbfae(++_0x10b8a8);}(_0x22dd,0x98));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xd22d('0x0'));var jayson=require(_0xd22d('0x1'));var moment=require(_0xd22d('0x2'));var util=require(_0xd22d('0x3'));var client=jayson[_0xd22d('0x4')]['http']({'port':0x2329});var logger=require(_0xd22d('0x5'))('xdr');exports[_0xd22d('0x6')]=function(_0x1b38af,_0x3d6c6f){logger['info'](_0x1b38af,_0x3d6c6f?util['inspect'](_0x3d6c6f,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x158b68,_0xdc40fb){logger['debug'](_0x158b68,_0xdc40fb?util[_0xd22d('0x7')](_0xdc40fb,{'showHidden':![],'depth':null}):'');};exports[_0xd22d('0x8')]=function(_0xd6c64b,_0x1bcf34){logger[_0xd22d('0x8')](_0xd6c64b,_0x1bcf34?util['inspect'](_0x1bcf34,{'showHidden':![],'depth':null}):'');};exports[_0xd22d('0x9')]=function(_0x58ccaf,_0x45dd73){return client[_0xd22d('0x9')](_0x58ccaf,{'body':_0x45dd73})[_0xd22d('0xa')](function(_0x1e68fd){logger[_0xd22d('0xb')](_0xd22d('0xc'),_0x58ccaf,_0x1e68fd?util[_0xd22d('0x7')](_0x1e68fd,{'showHidden':![],'depth':null}):'');})[_0xd22d('0xd')](function(_0x5cc7aa){logger[_0xd22d('0x8')](_0xd22d('0xc'),_0x58ccaf,_0x5cc7aa?util[_0xd22d('0x7')](_0x5cc7aa,{'showHidden':![],'depth':null}):'');});};function getUser(_0x46b9a2){return client[_0xd22d('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xd22d('0xe'),_0xd22d('0xf'),_0xd22d('0x10')],'where':_0x46b9a2,'limit':0x1}})[_0xd22d('0xa')](function(_0x944593){logger[_0xd22d('0xb')](_0xd22d('0x11'),JSON['stringify'](_0x46b9a2),_0x944593?util['inspect'](_0x944593,{'showHidden':![],'depth':null}):'');return _0x944593[_0xd22d('0x12')][_0xd22d('0x13')]?_0x944593[_0xd22d('0x12')][0x0]:null;});}exports[_0xd22d('0x14')]=function(_0x9d5923){return new BPromise(function(_0x5319b0,_0x38af0f){if(_0x9d5923){return getUser({'internal':_0x9d5923})[_0xd22d('0xa')](function(_0x57de77){logger[_0xd22d('0x6')](_0xd22d('0x15'),_0x9d5923,_0x57de77?_0xd22d('0x16'):_0xd22d('0x17'));return _0x5319b0(_0x57de77);})[_0xd22d('0xd')](function(_0x518243){logger[_0xd22d('0x8')](_0xd22d('0x18'),_0x518243?util[_0xd22d('0x7')](_0x518243,{'showHidden':![],'depth':null}):'');return _0x5319b0(null);});}return _0x5319b0(null);});};exports['getUserByInterface']=function(_0x39c84c){return new BPromise(function(_0x3c2972,_0x43ebff){if(_0x39c84c){return getUser({'interface':_0x39c84c})[_0xd22d('0xa')](function(_0x441181){logger[_0xd22d('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x39c84c,_0x441181?'found':'notfound');return _0x3c2972(_0x441181);})[_0xd22d('0xd')](function(_0x2037c7){logger[_0xd22d('0x8')](_0xd22d('0x19'),_0x2037c7?util['inspect'](_0x2037c7,{'showHidden':![],'depth':null}):'');return _0x3c2972(null);});}return _0x3c2972(null);});};exports[_0xd22d('0x1a')]=function(_0x3820d2){return new BPromise(function(_0x5e8234,_0x47206f){if(_0x3820d2){return getUser({'name':_0x3820d2})[_0xd22d('0xa')](function(_0x28e5da){logger[_0xd22d('0x6')]('[utils][getUserByName]\x20name:%s\x20%s',_0x3820d2,_0x28e5da?_0xd22d('0x16'):'notfound');return _0x5e8234(_0x28e5da);})[_0xd22d('0xd')](function(_0x28bafa){logger[_0xd22d('0x8')]('[utils][getUserByName]',_0x28bafa?util[_0xd22d('0x7')](_0x28bafa,{'showHidden':![],'depth':null}):'');return _0x5e8234(null);});}return _0x5e8234(null);});};exports['getVoiceQueueByName']=function(_0x3fcbfc){return new BPromise(function(_0x384977,_0x126784){if(_0x3fcbfc){return client[_0xd22d('0x9')](_0xd22d('0x1b'),{'options':{'raw':!![],'attributes':['id',_0xd22d('0xf'),_0xd22d('0x1c'),'acw',_0xd22d('0x1d')],'where':{'name':_0x3fcbfc},'limit':0x1}})[_0xd22d('0xa')](function(_0x4e4d43){logger[_0xd22d('0xb')](_0xd22d('0x1e'),_0x3fcbfc,_0x4e4d43?util[_0xd22d('0x7')](_0x4e4d43,{'showHidden':![],'depth':null}):'');logger[_0xd22d('0x6')](_0xd22d('0x1f'),_0x3fcbfc,_0x4e4d43?'found':_0xd22d('0x17'));return _0x384977(_0x4e4d43[_0xd22d('0x12')][_0xd22d('0x13')]?_0x4e4d43[_0xd22d('0x12')][0x0]:null);})[_0xd22d('0xd')](function(_0x2bfc5c){logger[_0xd22d('0x8')](_0xd22d('0x20'),_0x2bfc5c?util[_0xd22d('0x7')](_0x2bfc5c,{'showHidden':![],'depth':null}):'');return _0x384977(null);});}return _0x384977(null);});};exports[_0xd22d('0x21')]=function(_0x28f47f,_0x1da09b){return moment(_0x28f47f)['add'](_0x1da09b,_0xd22d('0x22'))[_0xd22d('0x23')](_0xd22d('0x24'));};exports[_0xd22d('0x25')]=function(_0xdbefda,_0x7c2926){return moment(_0xdbefda)[_0xd22d('0x26')](_0x7c2926,'seconds')['format'](_0xd22d('0x24'));};exports['diffTime']=function(_0x50da78,_0x519fbf){return moment(_0x50da78)[_0xd22d('0x27')](moment(_0x519fbf),_0xd22d('0x22'));};exports[_0xd22d('0x28')]=function(_0x5583b9,_0x19b95e){return parseInt(_0x5583b9,0xa)+parseInt(_0x19b95e,0xa);};exports[_0xd22d('0x29')]=function(){return moment()[_0xd22d('0x23')](_0xd22d('0x24'));};exports[_0xd22d('0x2a')]=function(_0x12e6ab,_0x50d779){if(_0x50d779){return moment(_0x12e6ab)[_0xd22d('0x2a')](_0x50d779);}return!![];};exports[_0xd22d('0x2b')]=function(_0x126110,_0x533bbb){if(_0x533bbb){return moment(_0x126110)['isBefore'](_0x533bbb);}else if(_0x126110){return!![];}return![];}; \ No newline at end of file +var _0xb1f7=['debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','result','length','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','subtractTime','subtract','format','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','now','isAfter','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb1f7,0x19d));var _0x7b1f=function(_0xbef885,_0x245e90){_0xbef885=_0xbef885-0x0;var _0x5502f0=_0xb1f7[_0xbef885];return _0x5502f0;};'use strict';var BPromise=require(_0x7b1f('0x0'));var jayson=require(_0x7b1f('0x1'));var moment=require(_0x7b1f('0x2'));var util=require(_0x7b1f('0x3'));var client=jayson[_0x7b1f('0x4')][_0x7b1f('0x5')]({'port':0x2329});var logger=require(_0x7b1f('0x6'))(_0x7b1f('0x7'));exports[_0x7b1f('0x8')]=function(_0x2941cc,_0x23838f){logger[_0x7b1f('0x8')](_0x2941cc,_0x23838f?util[_0x7b1f('0x9')](_0x23838f,{'showHidden':![],'depth':null}):'');};exports[_0x7b1f('0xa')]=function(_0x2c6da6,_0x467c4c){logger[_0x7b1f('0xa')](_0x2c6da6,_0x467c4c?util[_0x7b1f('0x9')](_0x467c4c,{'showHidden':![],'depth':null}):'');};exports[_0x7b1f('0xb')]=function(_0x2783a0,_0x2df717){logger[_0x7b1f('0xb')](_0x2783a0,_0x2df717?util[_0x7b1f('0x9')](_0x2df717,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x5bda9a,_0x4802ab){return client[_0x7b1f('0xc')](_0x5bda9a,{'body':_0x4802ab})[_0x7b1f('0xd')](function(_0x1d0989){logger['debug'](_0x7b1f('0xe'),_0x5bda9a,_0x1d0989?util[_0x7b1f('0x9')](_0x1d0989,{'showHidden':![],'depth':null}):'');})[_0x7b1f('0xf')](function(_0x3484db){logger['error'](_0x7b1f('0xe'),_0x5bda9a,_0x3484db?util[_0x7b1f('0x9')](_0x3484db,{'showHidden':![],'depth':null}):'');});};function getUser(_0x416c65){return client[_0x7b1f('0xc')](_0x7b1f('0x10'),{'options':{'raw':!![],'attributes':['id',_0x7b1f('0x11'),'name',_0x7b1f('0x12')],'where':_0x416c65,'limit':0x1}})['then'](function(_0x57f110){logger[_0x7b1f('0xa')](_0x7b1f('0x13'),JSON[_0x7b1f('0x14')](_0x416c65),_0x57f110?util['inspect'](_0x57f110,{'showHidden':![],'depth':null}):'');return _0x57f110[_0x7b1f('0x15')][_0x7b1f('0x16')]?_0x57f110['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x5576ca){return new BPromise(function(_0x1c269c,_0x3b768b){if(_0x5576ca){return getUser({'internal':_0x5576ca})[_0x7b1f('0xd')](function(_0x4dca3b){logger[_0x7b1f('0x8')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x5576ca,_0x4dca3b?_0x7b1f('0x17'):_0x7b1f('0x18'));return _0x1c269c(_0x4dca3b);})[_0x7b1f('0xf')](function(_0x5890af){logger[_0x7b1f('0xb')]('[utils][getUserByInternal]',_0x5890af?util[_0x7b1f('0x9')](_0x5890af,{'showHidden':![],'depth':null}):'');return _0x1c269c(null);});}return _0x1c269c(null);});};exports[_0x7b1f('0x19')]=function(_0xf5a059){return new BPromise(function(_0xc3a52a,_0x48487d){if(_0xf5a059){return getUser({'interface':_0xf5a059})['then'](function(_0x264483){logger['info'](_0x7b1f('0x1a'),_0xf5a059,_0x264483?_0x7b1f('0x17'):_0x7b1f('0x18'));return _0xc3a52a(_0x264483);})['catch'](function(_0x580cbb){logger[_0x7b1f('0xb')]('[utils][getUserByInterface]',_0x580cbb?util[_0x7b1f('0x9')](_0x580cbb,{'showHidden':![],'depth':null}):'');return _0xc3a52a(null);});}return _0xc3a52a(null);});};exports[_0x7b1f('0x1b')]=function(_0x309bd6){return new BPromise(function(_0x5de8e2,_0x3d6dc6){if(_0x309bd6){return getUser({'name':_0x309bd6})[_0x7b1f('0xd')](function(_0x299df8){logger[_0x7b1f('0x8')]('[utils][getUserByName]\x20name:%s\x20%s',_0x309bd6,_0x299df8?_0x7b1f('0x17'):_0x7b1f('0x18'));return _0x5de8e2(_0x299df8);})[_0x7b1f('0xf')](function(_0xf3764a){logger['error'](_0x7b1f('0x1c'),_0xf3764a?util[_0x7b1f('0x9')](_0xf3764a,{'showHidden':![],'depth':null}):'');return _0x5de8e2(null);});}return _0x5de8e2(null);});};exports[_0x7b1f('0x1d')]=function(_0x46842d){return new BPromise(function(_0x455f0a,_0x4be6da){if(_0x46842d){return client[_0x7b1f('0xc')](_0x7b1f('0x1e'),{'options':{'raw':!![],'attributes':['id','name',_0x7b1f('0x1f'),_0x7b1f('0x20'),_0x7b1f('0x21')],'where':{'name':_0x46842d},'limit':0x1}})[_0x7b1f('0xd')](function(_0x7eb9d3){logger['debug'](_0x7b1f('0x22'),_0x46842d,_0x7eb9d3?util[_0x7b1f('0x9')](_0x7eb9d3,{'showHidden':![],'depth':null}):'');logger[_0x7b1f('0x8')](_0x7b1f('0x23'),_0x46842d,_0x7eb9d3?_0x7b1f('0x17'):_0x7b1f('0x18'));return _0x455f0a(_0x7eb9d3[_0x7b1f('0x15')]['length']?_0x7eb9d3[_0x7b1f('0x15')][0x0]:null);})[_0x7b1f('0xf')](function(_0xa9bc63){logger[_0x7b1f('0xb')]('[utils][getVoiceQueueByName]',_0xa9bc63?util[_0x7b1f('0x9')](_0xa9bc63,{'showHidden':![],'depth':null}):'');return _0x455f0a(null);});}return _0x455f0a(null);});};exports[_0x7b1f('0x24')]=function(_0x1b969c,_0x35260c){return moment(_0x1b969c)[_0x7b1f('0x25')](_0x35260c,_0x7b1f('0x26'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7b1f('0x27')]=function(_0x2562b3,_0x4f2979){return moment(_0x2562b3)[_0x7b1f('0x28')](_0x4f2979,'seconds')[_0x7b1f('0x29')](_0x7b1f('0x2a'));};exports['diffTime']=function(_0x291038,_0x31669a){return moment(_0x291038)[_0x7b1f('0x2b')](moment(_0x31669a),_0x7b1f('0x26'));};exports[_0x7b1f('0x2c')]=function(_0x4f6944,_0x46f649){return parseInt(_0x4f6944,0xa)+parseInt(_0x46f649,0xa);};exports[_0x7b1f('0x2d')]=function(){return moment()[_0x7b1f('0x29')](_0x7b1f('0x2a'));};exports['isAfter']=function(_0x1f43ff,_0x50c9d8){if(_0x50c9d8){return moment(_0x1f43ff)[_0x7b1f('0x2e')](_0x50c9d8);}return!![];};exports['isBefore']=function(_0x4a8d93,_0x2b06ca){if(_0x2b06ca){return moment(_0x4a8d93)['isBefore'](_0x2b06ca);}else if(_0x4a8d93){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 7a2e4ed..f05ee65 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 _0xe602=['auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','x-forwarded-for','headers','remoteAddress','url','statusCode','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','format','method','agent_id','agent_name','fs-extra','lodash','./loggers','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','xcally','client','role','name','ensureDir','then','catch','log','user','no-user','data','timestamp','error'];(function(_0x2945b5,_0x22a14b){var _0x3976b7=function(_0x1b256e){while(--_0x1b256e){_0x2945b5['push'](_0x2945b5['shift']());}};_0x3976b7(++_0x22a14b);}(_0xe602,0xb8));var _0x2e60=function(_0x2ceeb9,_0x2932ee){_0x2ceeb9=_0x2ceeb9-0x0;var _0x1cb07b=_0xe602[_0x2ceeb9];return _0x1cb07b;};var fs=require(_0x2e60('0x0'));var _=require(_0x2e60('0x1'));var ewinston=require('express-winston');var path=require('path');var util=require('util');var fileLogger=require(_0x2e60('0x2'))[_0x2e60('0x3')];var safeTemplate=require(_0x2e60('0x4'))[_0x2e60('0x5')];var maskSensitiveData=require('./mask-sensitive-data')[_0x2e60('0x6')];function ClientSideLogger(){function _0x561148(_0x5f3e9f){var _0x458da7=path[_0x2e60('0x7')]('/var','log',_0x2e60('0x8'));var _0x3721f5=path[_0x2e60('0x7')](_0x2e60('0x9'),_0x5f3e9f[_0x2e60('0xa')]+'-'+_0x5f3e9f[_0x2e60('0xb')]);return fs[_0x2e60('0xc')](path['join'](_0x458da7,_0x3721f5))[_0x2e60('0xd')](function(){var _0x47f855=fileLogger(_0x2e60('0x9'),path[_0x2e60('0x7')](_0x458da7,_0x3721f5));return _0x47f855;})[_0x2e60('0xe')](function(_0x5aa826){throw _0x5aa826;});}this[_0x2e60('0xf')]=function(_0x43325f,_0x272cea,_0x18eb74,_0x31bf0d){return _0x561148(_0x43325f[_0x2e60('0x10')])[_0x2e60('0xd')](function(_0x16d6b9){var _0x962f3a=_0x16d6b9[_0x272cea];return _0x962f3a;})[_0x2e60('0xd')](function(_0x370e6f){var _0x30c231=_0x43325f['user']?_0x43325f[_0x2e60('0x10')]['id']:_0x2e60('0x11');var _0x4104c3=_0x31bf0d[_0x2e60('0x12')];var _0x396411=_0x31bf0d[_0x2e60('0x13')];var _0x279425=new Date(Number(_0x396411));return _0x370e6f(_0x30c231,_0x279425,_0x18eb74,_0x4104c3);})[_0x2e60('0xe')](function(_0x475375){fileLogger(_0x2e60('0x9'))[_0x2e60('0x14')](_0x475375);});};}function setupLoggers(_0x4b3699){return new Promise(function(_0x5d4265){var _0x1be1f2=new ClientSideLogger();var _0x4006aa=fileLogger('api');var _0x55cc40=fileLogger(_0x2e60('0x15'));_0x4b3699[_0x2e60('0x16')](_0x2e60('0x17'),_0x1be1f2);_0x4b3699[_0x2e60('0x18')](ewinston[_0x2e60('0x19')]({'winstonInstance':_0x4006aa,'meta':![],'statusLevels':!![],'msg':function(_0x19a8dc,_0x345477){var _0x1503da=_0x2e60('0x1a');if(!_[_0x2e60('0x1b')](_0x19a8dc['body'])){_0x1503da+=_0x2e60('0x1c');var _0x26e64d=_0x19a8dc[_0x2e60('0x1d')];maskSensitiveData(_0x26e64d);}return safeTemplate(util['format'](_0x1503da,_0x19a8dc['method'],_0x19a8dc['headers'][_0x2e60('0x1e')]?_0x19a8dc[_0x2e60('0x1f')][_0x2e60('0x1e')]:_0x19a8dc['connection'][_0x2e60('0x20')]||_0x19a8dc['ip'],_0x19a8dc[_0x2e60('0x21')],_0x345477[_0x2e60('0x22')],_0x345477['responseTime'],_0x19a8dc[_0x2e60('0x10')]?_0x19a8dc['user']['id']:null,_0x19a8dc[_0x2e60('0x10')]?_0x19a8dc[_0x2e60('0x10')][_0x2e60('0xb')]:null,_0x19a8dc[_0x2e60('0x10')]?_0x19a8dc[_0x2e60('0x10')][_0x2e60('0xa')]:null,_0x26e64d?util['inspect'](_0x26e64d,![],null):''));}}));_0x4b3699['use'](ewinston[_0x2e60('0x19')]({'winstonInstance':_0x55cc40,'meta':![],'statusLevels':!![],'msg':function(_0x30ac5e,_0x323f78){var _0x518bf9=_0x2e60('0x23');if(_0x30ac5e[_0x2e60('0x1d')]&&_0x30ac5e[_0x2e60('0x1d')][_0x2e60('0x24')]&&_0x30ac5e[_0x2e60('0x1d')]['agent_id']){_0x518bf9='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x2e60('0x25')](_0x518bf9,_0x30ac5e[_0x2e60('0x26')],_0x30ac5e[_0x2e60('0x1f')][_0x2e60('0x1e')]?_0x30ac5e['headers'][_0x2e60('0x1e')]:_0x30ac5e['connection'][_0x2e60('0x20')]||_0x30ac5e['ip'],_0x30ac5e[_0x2e60('0x21')],_0x323f78[_0x2e60('0x22')],_0x323f78['responseTime'],_0x30ac5e['user']?_0x30ac5e[_0x2e60('0x10')]['id']:null,_0x30ac5e['user']?_0x30ac5e[_0x2e60('0x10')][_0x2e60('0xb')]:null,_0x30ac5e[_0x2e60('0x10')]?_0x30ac5e['user'][_0x2e60('0xa')]:null,_0x30ac5e[_0x2e60('0x1d')]&&_0x30ac5e[_0x2e60('0x1d')][_0x2e60('0x24')]?_0x30ac5e[_0x2e60('0x1d')]['device']:'other',_0x30ac5e[_0x2e60('0x1d')]&&_0x30ac5e[_0x2e60('0x1d')][_0x2e60('0x27')]?_0x30ac5e[_0x2e60('0x1d')][_0x2e60('0x27')]:'',_0x30ac5e[_0x2e60('0x1d')]&&_0x30ac5e[_0x2e60('0x1d')]['agent_name']?_0x30ac5e['body'][_0x2e60('0x28')]:'');},'ignoreRoute':function(_0x5f1e4f){var _0x1177a9=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1177a9['test'](_0x5f1e4f[_0x2e60('0x21')]);}}));return _0x5d4265();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x5651=['%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_id','agent_name','url','setupLoggers','lodash','express-winston','path','util','./loggers','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','log','xcally','client','ensureDir','catch','user','then','no-user','data','error','api','auth','set','use','isEmpty','body','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','name','inspect','logger','device'];(function(_0x458b8f,_0x1c7ac5){var _0x23aba3=function(_0x239548){while(--_0x239548){_0x458b8f['push'](_0x458b8f['shift']());}};_0x23aba3(++_0x1c7ac5);}(_0x5651,0xdd));var _0x1565=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x5651[_0x57486e];return _0x5f110b;};var fs=require('fs-extra');var _=require(_0x1565('0x0'));var ewinston=require(_0x1565('0x1'));var path=require(_0x1565('0x2'));var util=require(_0x1565('0x3'));var fileLogger=require(_0x1565('0x4'))['fileLogger'];var safeTemplate=require('./safe-template')[_0x1565('0x5')];var maskSensitiveData=require(_0x1565('0x6'))[_0x1565('0x7')];function ClientSideLogger(){function _0x44ef8a(_0x4051f0){var _0x1a5806=path[_0x1565('0x8')]('/var',_0x1565('0x9'),_0x1565('0xa'));var _0x4660dc=path[_0x1565('0x8')](_0x1565('0xb'),_0x4051f0['role']+'-'+_0x4051f0['name']);return fs[_0x1565('0xc')](path[_0x1565('0x8')](_0x1a5806,_0x4660dc))['then'](function(){var _0x1c8895=fileLogger(_0x1565('0xb'),path[_0x1565('0x8')](_0x1a5806,_0x4660dc));return _0x1c8895;})[_0x1565('0xd')](function(_0x2c092d){throw _0x2c092d;});}this[_0x1565('0x9')]=function(_0x4b1152,_0x4774c4,_0x3da62b,_0x43ee7c){return _0x44ef8a(_0x4b1152[_0x1565('0xe')])[_0x1565('0xf')](function(_0x5668cc){var _0x59979d=_0x5668cc[_0x4774c4];return _0x59979d;})[_0x1565('0xf')](function(_0x29181d){var _0x424ad0=_0x4b1152['user']?_0x4b1152[_0x1565('0xe')]['id']:_0x1565('0x10');var _0x1454cf=_0x43ee7c[_0x1565('0x11')];var _0x2ee426=_0x43ee7c['timestamp'];var _0x262568=new Date(Number(_0x2ee426));return _0x29181d(_0x424ad0,_0x262568,_0x3da62b,_0x1454cf);})[_0x1565('0xd')](function(_0x15ac73){fileLogger(_0x1565('0xb'))[_0x1565('0x12')](_0x15ac73);});};}function setupLoggers(_0x53613e){return new Promise(function(_0x4ebee8){var _0x380f07=new ClientSideLogger();var _0x54a10f=fileLogger(_0x1565('0x13'));var _0x516f3c=fileLogger(_0x1565('0x14'));_0x53613e[_0x1565('0x15')]('client-side-logger',_0x380f07);_0x53613e[_0x1565('0x16')](ewinston['logger']({'winstonInstance':_0x54a10f,'meta':![],'statusLevels':!![],'msg':function(_0x343bb3,_0x2df3a3){var _0xeb732f='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x1565('0x17')](_0x343bb3[_0x1565('0x18')])){_0xeb732f+='\x20body=%s';var _0x5d43d4=_0x343bb3[_0x1565('0x18')];maskSensitiveData(_0x5d43d4);}return safeTemplate(util[_0x1565('0x19')](_0xeb732f,_0x343bb3[_0x1565('0x1a')],_0x343bb3[_0x1565('0x1b')][_0x1565('0x1c')]?_0x343bb3['headers']['x-forwarded-for']:_0x343bb3[_0x1565('0x1d')][_0x1565('0x1e')]||_0x343bb3['ip'],_0x343bb3['url'],_0x2df3a3[_0x1565('0x1f')],_0x2df3a3[_0x1565('0x20')],_0x343bb3[_0x1565('0xe')]?_0x343bb3[_0x1565('0xe')]['id']:null,_0x343bb3[_0x1565('0xe')]?_0x343bb3[_0x1565('0xe')][_0x1565('0x21')]:null,_0x343bb3[_0x1565('0xe')]?_0x343bb3['user']['role']:null,_0x5d43d4?util[_0x1565('0x22')](_0x5d43d4,![],null):''));}}));_0x53613e['use'](ewinston[_0x1565('0x23')]({'winstonInstance':_0x516f3c,'meta':![],'statusLevels':!![],'msg':function(_0x5ef8b4,_0x5beb21){var _0x23c8d7='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x5ef8b4[_0x1565('0x18')]&&_0x5ef8b4[_0x1565('0x18')][_0x1565('0x24')]&&_0x5ef8b4[_0x1565('0x18')]['agent_id']){_0x23c8d7=_0x1565('0x25');}return util['format'](_0x23c8d7,_0x5ef8b4['method'],_0x5ef8b4[_0x1565('0x1b')][_0x1565('0x1c')]?_0x5ef8b4['headers'][_0x1565('0x1c')]:_0x5ef8b4[_0x1565('0x1d')]['remoteAddress']||_0x5ef8b4['ip'],_0x5ef8b4['url'],_0x5beb21[_0x1565('0x1f')],_0x5beb21['responseTime'],_0x5ef8b4['user']?_0x5ef8b4[_0x1565('0xe')]['id']:null,_0x5ef8b4['user']?_0x5ef8b4[_0x1565('0xe')][_0x1565('0x21')]:null,_0x5ef8b4[_0x1565('0xe')]?_0x5ef8b4[_0x1565('0xe')]['role']:null,_0x5ef8b4[_0x1565('0x18')]&&_0x5ef8b4[_0x1565('0x18')][_0x1565('0x24')]?_0x5ef8b4[_0x1565('0x18')][_0x1565('0x24')]:_0x1565('0x26'),_0x5ef8b4[_0x1565('0x18')]&&_0x5ef8b4[_0x1565('0x18')][_0x1565('0x27')]?_0x5ef8b4[_0x1565('0x18')]['agent_id']:'',_0x5ef8b4[_0x1565('0x18')]&&_0x5ef8b4['body'][_0x1565('0x28')]?_0x5ef8b4[_0x1565('0x18')][_0x1565('0x28')]:'');},'ignoreRoute':function(_0x525e01){var _0x48026e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x48026e['test'](_0x525e01[_0x1565('0x29')]);}}));return _0x4ebee8();});}exports[_0x1565('0x2a')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 822ff69..03dea0e 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3fc=['max','min','MMM','monthCompare','guess','test','isMoment','padStart','length','lodash','moment-timezone','source','join','Interval\x20string\x20not\x20valid','isValid','split','locale','weekdaysShort','map','indexOf','slice','concat','exports','monthsShort','toLowerCase','circularMonthInterval','clone','hours','minutes','isBefore','endOf','isBetween','timeCompare','format','includes','date','daysInMonth'];(function(_0x49f1c8,_0x1bd6fe){var _0x3ceda5=function(_0x1838ca){while(--_0x1838ca){_0x49f1c8['push'](_0x49f1c8['shift']());}};_0x3ceda5(++_0x1bd6fe);}(_0xa3fc,0xe7));var _0xca3f=function(_0x1b9c2a,_0x50582e){_0x1b9c2a=_0x1b9c2a-0x0;var _0x21ab47=_0xa3fc[_0x1b9c2a];return _0x21ab47;};var _=require(_0xca3f('0x0'));var moment=require(_0xca3f('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x1808fd){return _0x1808fd[_0xca3f('0x2')];})[_0xca3f('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xca3f('0x4');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x13db55){if(!_0x13db55[_0xca3f('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x2f1092){var _0x54e9f2=_0x2f1092[_0xca3f('0x6')](':')['map'](function(_0x2fcdcb){return parseInt(_0x2fcdcb,0xa);});var _0x4b98dc=_0x54e9f2[0x0];var _0x34cd24=_0x54e9f2[0x1];if(_0x4b98dc<0x0||_0x4b98dc>0x17||_0x34cd24<0x0||_0x34cd24>0x3b){throw new Error(EINVALID_DATE);}return[_0x4b98dc,_0x34cd24];}function circularDoWInterval(_0xc1cb04,_0x36dff3){if(_0xc1cb04===_0x36dff3){return[_0xc1cb04];}else{var _0x59bb37=moment[_0xca3f('0x7')]();moment[_0xca3f('0x7')]('en');var _0x3f23dd=moment[_0xca3f('0x8')]()[_0xca3f('0x9')](function(_0x32d261){return _0x32d261['toLowerCase']();});moment['locale'](_0x59bb37);var _0x320757=_0x3f23dd[_0xca3f('0xa')](_0xc1cb04);var _0x45670e=_0x3f23dd[_0xca3f('0xa')](_0x36dff3);if(_0x45670e>_0x320757){return _0x3f23dd[_0xca3f('0xb')](_0x320757,_0x45670e+0x1);}else{var _0x1860c4=_0x3f23dd[_0xca3f('0xb')](0x0,_0x45670e+0x1);var _0x113ed5=_0x3f23dd[_0xca3f('0xb')](_0x320757);return _0x113ed5[_0xca3f('0xc')](_0x1860c4);}}}module[_0xca3f('0xd')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x395087,_0x433516){if(_0x395087===_0x433516){return[_0x395087];}else{var _0xb7ddd8=moment['locale']();moment[_0xca3f('0x7')]('en');var _0x5b123c=moment[_0xca3f('0xe')]()['map'](function(_0xb6c24d){return _0xb6c24d[_0xca3f('0xf')]();});moment[_0xca3f('0x7')](_0xb7ddd8);var _0x53fbf1=_0x5b123c[_0xca3f('0xa')](_0x395087);var _0x5b2352=_0x5b123c[_0xca3f('0xa')](_0x433516);if(_0x5b2352>_0x53fbf1){return _0x5b123c[_0xca3f('0xb')](_0x53fbf1,_0x5b2352+0x1);}else{var _0x549a4f=_0x5b123c[_0xca3f('0xb')](0x0,_0x5b2352+0x1);var _0x4cfeff=_0x5b123c[_0xca3f('0xb')](_0x53fbf1);return _0x4cfeff[_0xca3f('0xc')](_0x549a4f);}}}module[_0xca3f('0xd')][_0xca3f('0x10')]=circularMonthInterval;function parseDom(_0x243bb6){var _0x5e9fb4=parseInt(_0x243bb6,0xa);if(_0x5e9fb4<0x1||_0x5e9fb4>0x1f){throw new Error(EINVALID_DATE);}return _0x5e9fb4;}function timeCompare(_0x3b5800,_0x495aa7,_0x3ca2a2){var _0xb720f1=_0x3b5800[_0xca3f('0x11')]();var _0x45c9a1=extractTime(_0x495aa7);var _0x28caf9=_0x45c9a1[0x0];var _0x152bd4=_0x45c9a1[0x1];var _0x522d7b=_0x3b5800[_0xca3f('0x11')]()['hours'](_0x28caf9)['minutes'](_0x152bd4);throwIfDateNotValid(_0x522d7b);var _0xe064f4=extractTime(_0x3ca2a2);var _0x2270d7=_0xe064f4[0x0];var _0x3d8621=_0xe064f4[0x1];var _0x9ff69=_0x3b5800['clone']()[_0xca3f('0x12')](_0x2270d7)[_0xca3f('0x13')](_0x3d8621);throwIfDateNotValid(_0x9ff69);if(_0x9ff69[_0xca3f('0x14')](_0x522d7b)){var _0xe1d788=_0xb720f1[_0xca3f('0x11')]()['startOf']('day');var _0x10db45=_0xb720f1[_0xca3f('0x11')]()[_0xca3f('0x15')]('day');return _0xb720f1['isBetween'](_0x522d7b,_0x10db45,undefined,'[]')||_0xb720f1[_0xca3f('0x16')](_0xe1d788,_0x9ff69,undefined,'[]');}else{return _0xb720f1[_0xca3f('0x16')](_0x522d7b,_0x9ff69,undefined,'[]');}}module['exports'][_0xca3f('0x17')]=timeCompare;function dowCompare(_0x18bd97,_0x16310b,_0x3714de){var _0x507b29=_0x18bd97[_0xca3f('0x7')]('en')[_0xca3f('0x18')]('ddd')[_0xca3f('0xf')]();return circularDoWInterval(_0x16310b,_0x3714de)[_0xca3f('0x19')](_0x507b29);}module[_0xca3f('0xd')]['dowCompare']=dowCompare;function domCompare(_0x327c62,_0x4f955,_0x509e2a){var _0x57dcbf=_0x327c62[_0xca3f('0x1a')]();if(_0x4f955===_0x509e2a){return _0x57dcbf===_0x4f955;}else{var _0x259819=_0x327c62[_0xca3f('0x1b')]();var _0x89e9e9=_0x4f955<_0x509e2a;let _0x509a1f=![];var _0x329f13=0x0;var _0x24dc07=0x0;if(_0x89e9e9){_0x329f13=Math[_0xca3f('0x1c')](0x1,_0x4f955);_0x24dc07=Math[_0xca3f('0x1d')](_0x509e2a,_0x259819);_0x509a1f=_0x57dcbf>=_0x329f13&&_0x57dcbf<=_0x24dc07;}else{_0x329f13=Math[_0xca3f('0x1d')](_0x4f955,_0x259819);_0x24dc07=Math['max'](0x1,_0x509e2a);_0x509a1f=_0x57dcbf>=_0x329f13||_0x57dcbf<=_0x24dc07;}return _0x509a1f;}}module[_0xca3f('0xd')]['domCompare']=domCompare;function monthCompare(_0x2d0932,_0x2eeda9,_0x42f761){var _0x12b6f3=_0x2d0932[_0xca3f('0x7')]('en')['format'](_0xca3f('0x1e'))[_0xca3f('0xf')]();return circularMonthInterval(_0x2eeda9,_0x42f761)[_0xca3f('0x19')](_0x12b6f3);}module[_0xca3f('0xd')][_0xca3f('0x1f')]=monthCompare;function iftime(_0xc959ef,_0x1eae1c=moment['tz'][_0xca3f('0x20')](),_0x2de984=moment()){if(!validateRx[_0xca3f('0x21')](_0xc959ef)){throw new Error(EINVALID_STRING);}else{var _0x21c187=(moment[_0xca3f('0x22')](_0x2de984)?_0x2de984[_0xca3f('0x11')]():moment(_0x2de984))['tz'](_0x1eae1c)[_0xca3f('0x7')]('en');throwIfDateNotValid(_0x21c187);var _0xe95aa7=_0xc959ef[_0xca3f('0x6')](',');var _0x470352=_0xe95aa7[0x0];var _0x3a6ef5=_0xe95aa7[0x1];var _0x36918a=_0xe95aa7[0x2];var _0x2fc51f=_0xe95aa7[0x3];let _0x3ef65a=!![];if(_0x470352!=='*'){var _0x171e1b=_0x470352[_0xca3f('0x6')]('-');var _0x23100b=_[_0xca3f('0x23')](_0x171e1b[0x0],0x5,'0');var _0x172b28=_0x171e1b[_0xca3f('0x24')]===0x2?_['padStart'](_0x171e1b[0x1],0x5,'0'):_0x23100b;_0x3ef65a=timeCompare(_0x21c187,_0x23100b,_0x172b28);}let _0x25f980=!![];if(_0x3a6ef5!=='*'){var _0x4cc68b=_0x3a6ef5[_0xca3f('0x6')]('-');var _0x3a8d17=_0x4cc68b[0x0];var _0x30d665=_0x4cc68b[_0xca3f('0x24')]===0x2?_0x4cc68b[0x1]:_0x3a8d17;_0x25f980=dowCompare(_0x21c187,_0x3a8d17,_0x30d665);}let _0x230078=!![];if(_0x36918a!=='*'){var _0x4d8543=_0x36918a[_0xca3f('0x6')]('-');var _0xdec241=parseDom(_0x4d8543[0x0]);var _0x4e4503=_0x4d8543[_0xca3f('0x24')]===0x2?parseDom(_0x4d8543[0x1]):_0xdec241;_0x230078=domCompare(_0x21c187,_0xdec241,_0x4e4503);}let _0xf5150=!![];if(_0x2fc51f!=='*'){var _0x19f995=_0x2fc51f['split']('-');var _0x500b6f=_0x19f995[0x0];var _0xd44725=_0x19f995[_0xca3f('0x24')]===0x2?_0x19f995[0x1]:_0x19f995[0x0];_0xf5150=monthCompare(_0x21c187,_0x500b6f,_0xd44725);}return _0x3ef65a&&_0x25f980&&_0x230078&&_0xf5150;}}module[_0xca3f('0xd')]['iftime']=iftime; \ No newline at end of file +var _0xf861=['includes','daysInMonth','max','domCompare','MMM','guess','isMoment','split','padStart','length','iftime','lodash','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes','isBefore','startOf','endOf','day','isBetween','format','ddd'];(function(_0x38b4de,_0x3b2b10){var _0x54f3dc=function(_0xf82116){while(--_0xf82116){_0x38b4de['push'](_0x38b4de['shift']());}};_0x54f3dc(++_0x3b2b10);}(_0xf861,0x1a2));var _0x1f86=function(_0x266009,_0x4f5aa7){_0x266009=_0x266009-0x0;var _0x3c1bff=_0xf861[_0x266009];return _0x3c1bff;};var _=require(_0x1f86('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x1f86('0x1')](function(_0x4f072e){return _0x4f072e[_0x1f86('0x2')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x1f86('0x3');var EINVALID_DATE=_0x1f86('0x4');function throwIfDateNotValid(_0x4df542){if(!_0x4df542[_0x1f86('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x16e12a){var _0x4310fe=_0x16e12a['split'](':')[_0x1f86('0x1')](function(_0x2076a2){return parseInt(_0x2076a2,0xa);});var _0x4ce289=_0x4310fe[0x0];var _0xb1275b=_0x4310fe[0x1];if(_0x4ce289<0x0||_0x4ce289>0x17||_0xb1275b<0x0||_0xb1275b>0x3b){throw new Error(EINVALID_DATE);}return[_0x4ce289,_0xb1275b];}function circularDoWInterval(_0x5d5174,_0x12fc03){if(_0x5d5174===_0x12fc03){return[_0x5d5174];}else{var _0x142d7e=moment[_0x1f86('0x6')]();moment[_0x1f86('0x6')]('en');var _0x571c51=moment[_0x1f86('0x7')]()['map'](function(_0xc4738){return _0xc4738[_0x1f86('0x8')]();});moment['locale'](_0x142d7e);var _0x423933=_0x571c51[_0x1f86('0x9')](_0x5d5174);var _0x10c345=_0x571c51[_0x1f86('0x9')](_0x12fc03);if(_0x10c345>_0x423933){return _0x571c51['slice'](_0x423933,_0x10c345+0x1);}else{var _0xc548d1=_0x571c51[_0x1f86('0xa')](0x0,_0x10c345+0x1);var _0x2c5c1d=_0x571c51[_0x1f86('0xa')](_0x423933);return _0x2c5c1d[_0x1f86('0xb')](_0xc548d1);}}}module[_0x1f86('0xc')][_0x1f86('0xd')]=circularDoWInterval;function circularMonthInterval(_0x3e53c0,_0x66bf20){if(_0x3e53c0===_0x66bf20){return[_0x3e53c0];}else{var _0x32bf5a=moment['locale']();moment[_0x1f86('0x6')]('en');var _0x42a0de=moment[_0x1f86('0xe')]()[_0x1f86('0x1')](function(_0x5a3287){return _0x5a3287[_0x1f86('0x8')]();});moment[_0x1f86('0x6')](_0x32bf5a);var _0x356dc2=_0x42a0de[_0x1f86('0x9')](_0x3e53c0);var _0x5da1a4=_0x42a0de[_0x1f86('0x9')](_0x66bf20);if(_0x5da1a4>_0x356dc2){return _0x42a0de[_0x1f86('0xa')](_0x356dc2,_0x5da1a4+0x1);}else{var _0xb3c835=_0x42a0de[_0x1f86('0xa')](0x0,_0x5da1a4+0x1);var _0x5a989b=_0x42a0de[_0x1f86('0xa')](_0x356dc2);return _0x5a989b['concat'](_0xb3c835);}}}module[_0x1f86('0xc')][_0x1f86('0xf')]=circularMonthInterval;function parseDom(_0x2f38d4){var _0x53fd22=parseInt(_0x2f38d4,0xa);if(_0x53fd22<0x1||_0x53fd22>0x1f){throw new Error(EINVALID_DATE);}return _0x53fd22;}function timeCompare(_0x36691f,_0x51a121,_0x4e36e7){var _0x5a6e11=_0x36691f[_0x1f86('0x10')]();var _0x1cca91=extractTime(_0x51a121);var _0x1dc469=_0x1cca91[0x0];var _0x1abfb1=_0x1cca91[0x1];var _0x514073=_0x36691f[_0x1f86('0x10')]()[_0x1f86('0x11')](_0x1dc469)[_0x1f86('0x12')](_0x1abfb1);throwIfDateNotValid(_0x514073);var _0x24d40d=extractTime(_0x4e36e7);var _0x17932c=_0x24d40d[0x0];var _0x3b968f=_0x24d40d[0x1];var _0x3842f8=_0x36691f[_0x1f86('0x10')]()[_0x1f86('0x11')](_0x17932c)['minutes'](_0x3b968f);throwIfDateNotValid(_0x3842f8);if(_0x3842f8[_0x1f86('0x13')](_0x514073)){var _0x40a5d8=_0x5a6e11[_0x1f86('0x10')]()[_0x1f86('0x14')]('day');var _0x36ad1e=_0x5a6e11[_0x1f86('0x10')]()[_0x1f86('0x15')](_0x1f86('0x16'));return _0x5a6e11[_0x1f86('0x17')](_0x514073,_0x36ad1e,undefined,'[]')||_0x5a6e11['isBetween'](_0x40a5d8,_0x3842f8,undefined,'[]');}else{return _0x5a6e11[_0x1f86('0x17')](_0x514073,_0x3842f8,undefined,'[]');}}module[_0x1f86('0xc')]['timeCompare']=timeCompare;function dowCompare(_0x4f3254,_0x1be542,_0x2ef7f4){var _0x2a5c45=_0x4f3254[_0x1f86('0x6')]('en')[_0x1f86('0x18')](_0x1f86('0x19'))[_0x1f86('0x8')]();return circularDoWInterval(_0x1be542,_0x2ef7f4)[_0x1f86('0x1a')](_0x2a5c45);}module[_0x1f86('0xc')]['dowCompare']=dowCompare;function domCompare(_0x12d826,_0xc8e7ba,_0x1f91ca){var _0x107eac=_0x12d826['date']();if(_0xc8e7ba===_0x1f91ca){return _0x107eac===_0xc8e7ba;}else{var _0x2ac4a8=_0x12d826[_0x1f86('0x1b')]();var _0x490103=_0xc8e7ba<_0x1f91ca;let _0x4e94db=![];var _0x4bec99=0x0;var _0x173b18=0x0;if(_0x490103){_0x4bec99=Math[_0x1f86('0x1c')](0x1,_0xc8e7ba);_0x173b18=Math['min'](_0x1f91ca,_0x2ac4a8);_0x4e94db=_0x107eac>=_0x4bec99&&_0x107eac<=_0x173b18;}else{_0x4bec99=Math['min'](_0xc8e7ba,_0x2ac4a8);_0x173b18=Math[_0x1f86('0x1c')](0x1,_0x1f91ca);_0x4e94db=_0x107eac>=_0x4bec99||_0x107eac<=_0x173b18;}return _0x4e94db;}}module[_0x1f86('0xc')][_0x1f86('0x1d')]=domCompare;function monthCompare(_0x51d374,_0x31e1a5,_0x181ad9){var _0x1f4774=_0x51d374[_0x1f86('0x6')]('en')[_0x1f86('0x18')](_0x1f86('0x1e'))['toLowerCase']();return circularMonthInterval(_0x31e1a5,_0x181ad9)['includes'](_0x1f4774);}module[_0x1f86('0xc')]['monthCompare']=monthCompare;function iftime(_0x74ff94,_0x5693f4=moment['tz'][_0x1f86('0x1f')](),_0x4b3acf=moment()){if(!validateRx['test'](_0x74ff94)){throw new Error(EINVALID_STRING);}else{var _0x52a585=(moment[_0x1f86('0x20')](_0x4b3acf)?_0x4b3acf[_0x1f86('0x10')]():moment(_0x4b3acf))['tz'](_0x5693f4)[_0x1f86('0x6')]('en');throwIfDateNotValid(_0x52a585);var _0x3ba678=_0x74ff94[_0x1f86('0x21')](',');var _0x3d8076=_0x3ba678[0x0];var _0x284fb3=_0x3ba678[0x1];var _0x5b6cc5=_0x3ba678[0x2];var _0x3eb41d=_0x3ba678[0x3];let _0x2e92e=!![];if(_0x3d8076!=='*'){var _0xf26fa1=_0x3d8076[_0x1f86('0x21')]('-');var _0x103421=_[_0x1f86('0x22')](_0xf26fa1[0x0],0x5,'0');var _0x2c0f61=_0xf26fa1['length']===0x2?_['padStart'](_0xf26fa1[0x1],0x5,'0'):_0x103421;_0x2e92e=timeCompare(_0x52a585,_0x103421,_0x2c0f61);}let _0x3a9780=!![];if(_0x284fb3!=='*'){var _0x39786e=_0x284fb3[_0x1f86('0x21')]('-');var _0x42b3e0=_0x39786e[0x0];var _0x1ba5f4=_0x39786e[_0x1f86('0x23')]===0x2?_0x39786e[0x1]:_0x42b3e0;_0x3a9780=dowCompare(_0x52a585,_0x42b3e0,_0x1ba5f4);}let _0x4429be=!![];if(_0x5b6cc5!=='*'){var _0x49ecae=_0x5b6cc5[_0x1f86('0x21')]('-');var _0x4e49d4=parseDom(_0x49ecae[0x0]);var _0x26b223=_0x49ecae[_0x1f86('0x23')]===0x2?parseDom(_0x49ecae[0x1]):_0x4e49d4;_0x4429be=domCompare(_0x52a585,_0x4e49d4,_0x26b223);}let _0x211780=!![];if(_0x3eb41d!=='*'){var _0x5045e1=_0x3eb41d[_0x1f86('0x21')]('-');var _0x1de914=_0x5045e1[0x0];var _0xd2042d=_0x5045e1['length']===0x2?_0x5045e1[0x1]:_0x5045e1[0x0];_0x211780=monthCompare(_0x52a585,_0x1de914,_0xd2042d);}return _0x2e92e&&_0x3a9780&&_0x4429be&&_0x211780;}}module['exports'][_0x1f86('0x24')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 367303a..b023eb8 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9fd=['bold\x20cyan','addColors','/var/log/xcally','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','meta','keys','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','transports','File','%s-%s','error','warn','fileLogger','path','util','../config/environment','debugLevel','toLowerCase','red','white','bold\x20green','gray','bold\x20blue'];(function(_0x3f1f6a,_0x6ceb8e){var _0x71afae=function(_0x48f54f){while(--_0x48f54f){_0x3f1f6a['push'](_0x3f1f6a['shift']());}};_0x71afae(++_0x6ceb8e);}(_0xa9fd,0x1d6));var _0xda9f=function(_0x15c909,_0x3fde7e){_0x15c909=_0x15c909-0x0;var _0x44523c=_0xa9fd[_0x15c909];return _0x44523c;};'use strict';var path=require(_0xda9f('0x0'));var util=require(_0xda9f('0x1'));var moment=require('moment');var winston=require('winston');var config=require(_0xda9f('0x2'));var debugLevel=config[_0xda9f('0x3')]?config[_0xda9f('0x3')][_0xda9f('0x4')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xda9f('0x5'),'warn':'bold\x20yellow','info':_0xda9f('0x6'),'print':'bold\x20white','success':_0xda9f('0x7'),'http':_0xda9f('0x8'),'verbose':'bold\x20magenta','debug':_0xda9f('0x9'),'silly':_0xda9f('0xa')};winston[_0xda9f('0xb')](XC_LOG_COLORS);function getLogFileName(_0x3d8dc3,_0xb19a3a,_0x53d5b2){var _0x3e08dc=_0x3d8dc3||_0xda9f('0xc');return path['join'](_0x3e08dc,util[_0xda9f('0xd')](_0xda9f('0xe'),_0xb19a3a,_0x53d5b2));}function formatter(_0x54f63f,_0x13c3c8){_0x13c3c8[_0xda9f('0xf')]=_0x13c3c8[_0xda9f('0xf')][_0xda9f('0x10')](/@@{/g,_0xda9f('0x11'))[_0xda9f('0x10')](/}@@/g,_0xda9f('0x12'))[_0xda9f('0x10')](/@{/g,'{{')[_0xda9f('0x10')](/}@/g,'}}');return util[_0xda9f('0xd')](_0xda9f('0x13'),moment()[_0xda9f('0xd')](_0xda9f('0x14')),_0x13c3c8['level']['toUpperCase'](),_0x54f63f,_0x13c3c8['message']);}function fileFormat(_0x460bc6,_0x1167d4){_0x1167d4[_0xda9f('0xf')]=_0x1167d4[_0xda9f('0xf')][_0xda9f('0x10')](/@@{/g,'{{{')['replace'](/}@@/g,_0xda9f('0x12'))[_0xda9f('0x10')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0xb172ac=_0x1167d4[_0xda9f('0x15')]&&Object[_0xda9f('0x16')](_0x1167d4[_0xda9f('0x15')])['length']?'\x0a\x09'+JSON['stringify'](_0x1167d4[_0xda9f('0x15')]):'';return util[_0xda9f('0xd')](_0xda9f('0x17'),moment()[_0xda9f('0xd')](_0xda9f('0x14')),_0x1167d4['level'][_0xda9f('0x18')](),_0x460bc6,_0x1167d4['message'],_0xb172ac);}function consoleLogger(){var _0x4ab501=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':'warn','json':![],'formatter':function(_0x40a94e){return formatter('',_0x40a94e);}})]});return _0x4ab501;}function fileLogger(_0x35cd07,_0x1b8804){var _0x335785=new winston[(_0xda9f('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xda9f('0x1a'))][(_0xda9f('0x1b'))]({'name':util['format'](_0xda9f('0x1c'),_0x35cd07,_0xda9f('0x1d')),'filename':getLogFileName(_0x1b8804,_0x35cd07,_0xda9f('0x1d')),'level':_0xda9f('0x1d'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x69c669){return fileFormat(_0x35cd07,_0x69c669);}}),new winston[(_0xda9f('0x1a'))]['File']({'name':util['format']('%s-%s',_0x35cd07,debugLevel),'filename':getLogFileName(_0x1b8804,_0x35cd07,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x82866e){return fileFormat(_0x35cd07,_0x82866e);}}),new winston[(_0xda9f('0x1a'))]['Console']({'level':_0xda9f('0x1e'),'json':![],'formatter':function(_0x521126){return fileFormat(_0x35cd07,_0x521126);}})]});return _0x335785;}exports['consoleLogger']=consoleLogger;exports[_0xda9f('0x1f')]=fileLogger; \ No newline at end of file +var _0x9c52=['warn','transports','File','%s-%s','error','Console','consoleLogger','fileLogger','path','moment','../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow','white','bold\x20white','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/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','}}}','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9c52,0x119));var _0x29c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c52[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0x29c5('0x0'));var util=require('util');var moment=require(_0x29c5('0x1'));var winston=require('winston');var config=require(_0x29c5('0x2'));var debugLevel=config[_0x29c5('0x3')]?config[_0x29c5('0x3')][_0x29c5('0x4')]():_0x29c5('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x29c5('0x6'),'warn':_0x29c5('0x7'),'info':_0x29c5('0x8'),'print':_0x29c5('0x9'),'success':'bold\x20green','http':'gray','verbose':_0x29c5('0xa'),'debug':_0x29c5('0xb'),'silly':_0x29c5('0xc')};winston[_0x29c5('0xd')](XC_LOG_COLORS);function getLogFileName(_0x4f8317,_0x244863,_0x40a436){var _0x2aa54d=_0x4f8317||_0x29c5('0xe');return path[_0x29c5('0xf')](_0x2aa54d,util[_0x29c5('0x10')](_0x29c5('0x11'),_0x244863,_0x40a436));}function formatter(_0x556065,_0x20a996){_0x20a996[_0x29c5('0x12')]=_0x20a996[_0x29c5('0x12')][_0x29c5('0x13')](/@@{/g,_0x29c5('0x14'))['replace'](/}@@/g,'}}}')['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x29c5('0x15'),moment()[_0x29c5('0x10')](_0x29c5('0x16')),_0x20a996[_0x29c5('0x17')]['toUpperCase'](),_0x556065,_0x20a996[_0x29c5('0x12')]);}function fileFormat(_0x29e439,_0x3fc7ef){_0x3fc7ef[_0x29c5('0x12')]=_0x3fc7ef[_0x29c5('0x12')]['replace'](/@@{/g,'{{{')[_0x29c5('0x13')](/}@@/g,_0x29c5('0x18'))[_0x29c5('0x13')](/@{/g,'{{')[_0x29c5('0x13')](/}@/g,'}}');var _0x2bd1a7=_0x3fc7ef[_0x29c5('0x19')]&&Object[_0x29c5('0x1a')](_0x3fc7ef[_0x29c5('0x19')])['length']?'\x0a\x09'+JSON[_0x29c5('0x1b')](_0x3fc7ef[_0x29c5('0x19')]):'';return util[_0x29c5('0x10')](_0x29c5('0x1c'),moment()[_0x29c5('0x10')](_0x29c5('0x16')),_0x3fc7ef[_0x29c5('0x17')][_0x29c5('0x1d')](),_0x29e439,_0x3fc7ef[_0x29c5('0x12')],_0x2bd1a7);}function consoleLogger(){var _0x5bffa2=new winston[(_0x29c5('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':_0x29c5('0x1f'),'json':![],'formatter':function(_0x5ef666){return formatter('',_0x5ef666);}})]});return _0x5bffa2;}function fileLogger(_0x42a9eb,_0x19491f){var _0x4e9f7f=new winston[(_0x29c5('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x29c5('0x20'))][(_0x29c5('0x21'))]({'name':util[_0x29c5('0x10')](_0x29c5('0x22'),_0x42a9eb,'error'),'filename':getLogFileName(_0x19491f,_0x42a9eb,_0x29c5('0x23')),'level':_0x29c5('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x15cdca){return fileFormat(_0x42a9eb,_0x15cdca);}}),new winston[(_0x29c5('0x20'))]['File']({'name':util['format'](_0x29c5('0x22'),_0x42a9eb,debugLevel),'filename':getLogFileName(_0x19491f,_0x42a9eb,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x301fb2){return fileFormat(_0x42a9eb,_0x301fb2);}}),new winston['transports'][(_0x29c5('0x24'))]({'level':'warn','json':![],'formatter':function(_0x2c0843){return fileFormat(_0x42a9eb,_0x2c0843);}})]});return _0x4e9f7f;}exports[_0x29c5('0x25')]=consoleLogger;exports[_0x29c5('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 8f26498..7e2b1c8 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(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0x1967,0x173));var _0x7196=function(_0x5ebcb5,_0x3dc720){_0x5ebcb5=_0x5ebcb5-0x0;var _0x1d45da=_0x1967[_0x5ebcb5];return _0x1d45da;};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 _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x1a85,0x178));var _0x51a8=function(_0x20d08e,_0x4cc575){_0x20d08e=_0x20d08e-0x0;var _0x2cbd12=_0x1a85[_0x20d08e];return _0x2cbd12;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 0869cf4..2d00c00 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['exports','\x5c$&'];(function(_0x216f3b,_0x5be576){var _0x3c8d60=function(_0x1a67e9){while(--_0x1a67e9){_0x216f3b['push'](_0x216f3b['shift']());}};_0x3c8d60(++_0x5be576);}(_0x7a54,0x106));var _0x47a5=function(_0x507c45,_0x4f01d4){_0x507c45=_0x507c45-0x0;var _0x46d935=_0x7a54[_0x507c45];return _0x46d935;};module[_0x47a5('0x0')]={'escapeRegExp'(_0x46f3fa,_0x44b31e=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x46f3fa['replace'](_0x44b31e,_0x47a5('0x1'));}}; \ No newline at end of file +var _0x5f2f=['\x5c$&','exports','replace'];(function(_0x200293,_0x37b867){var _0x496a1d=function(_0x3b03ca){while(--_0x3b03ca){_0x200293['push'](_0x200293['shift']());}};_0x496a1d(++_0x37b867);}(_0x5f2f,0x73));var _0xf5f2=function(_0x526ba2,_0x4a5be1){_0x526ba2=_0x526ba2-0x0;var _0x1094d2=_0x5f2f[_0x526ba2];return _0x1094d2;};module[_0xf5f2('0x0')]={'escapeRegExp'(_0x423dd9,_0x2dcf60=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x423dd9[_0xf5f2('0x1')](_0x2dcf60,_0xf5f2('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index ec22b3a..27eed66 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 _0x93e9=['string','map','isPlainObject','keys','reduce','exports','lodash','{\x20{\x20','\x20}\x20}'];(function(_0xde4717,_0x15e5e9){var _0x5b380a=function(_0x3aed23){while(--_0x3aed23){_0xde4717['push'](_0xde4717['shift']());}};_0x5b380a(++_0x15e5e9);}(_0x93e9,0xcc));var _0x993e=function(_0x153738,_0xe704c1){_0x153738=_0x153738-0x0;var _0x3028d9=_0x93e9[_0x153738];return _0x3028d9;};var _=require(_0x993e('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0xcf3bfd){return _0xcf3bfd==='{{'?_0x993e('0x1'):_0x993e('0x2');}function safeTemplate(_0x43b7b0){var _0x2a63eb=_0x43b7b0;if(typeof _0x43b7b0===_0x993e('0x3')){_0x2a63eb=_0x43b7b0['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x43b7b0)){_0x2a63eb=_0x43b7b0[_0x993e('0x4')](function(_0x255045){return safeTemplate(_0x255045);});}else if(_[_0x993e('0x5')](_0x43b7b0)){_0x2a63eb=Object[_0x993e('0x6')](_0x43b7b0)[_0x993e('0x7')](function(_0x2366d9,_0x12ac94){_0x2366d9[_0x12ac94]=safeTemplate(_0x43b7b0[_0x12ac94]);return _0x2366d9;},{});}return _0x2a63eb;}module[_0x993e('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x3423=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace'];(function(_0x53f540,_0xcacc66){var _0x22d8e6=function(_0x2b8795){while(--_0x2b8795){_0x53f540['push'](_0x53f540['shift']());}};_0x22d8e6(++_0xcacc66);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4a04c7){return _0x4a04c7==='{{'?_0x3342('0x0'):_0x3342('0x1');}function safeTemplate(_0x3477de){var _0x3b763d=_0x3477de;if(typeof _0x3477de===_0x3342('0x2')){_0x3b763d=_0x3477de[_0x3342('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3342('0x4')](_0x3477de)){_0x3b763d=_0x3477de[_0x3342('0x5')](function(_0x3075f8){return safeTemplate(_0x3075f8);});}else if(_[_0x3342('0x6')](_0x3477de)){_0x3b763d=Object[_0x3342('0x7')](_0x3477de)[_0x3342('0x8')](function(_0x29c40c,_0x420d4b){_0x29c40c[_0x420d4b]=safeTemplate(_0x3477de[_0x420d4b]);return _0x29c40c;},{});}return _0x3b763d;}module[_0x3342('0x9')][_0x3342('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index f5b8300..daa56ad 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6c0=['../config/environment','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','info','Updating\x20app.json','exports','fs-extra','path'];(function(_0x26d58f,_0xf7cd46){var _0x4f372a=function(_0x431b13){while(--_0x431b13){_0x26d58f['push'](_0x26d58f['shift']());}};_0x4f372a(++_0xf7cd46);}(_0xd6c0,0xb9));var _0x0d6c=function(_0x482cce,_0x2fd9ce){_0x482cce=_0x482cce-0x0;var _0x162a9d=_0xd6c0[_0x482cce];return _0x162a9d;};var fs=require(_0x0d6c('0x0'));var path=require(_0x0d6c('0x1'));var config=require(_0x0d6c('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0x0d6c('0x3')](root,_0x0d6c('0x4'));var NODEPATH=path[_0x0d6c('0x3')](root,_0x0d6c('0x5'));function setLegacyLibsNodeEnvPath(_0x580ab4){let _0x2809c0=![];if(Array[_0x0d6c('0x6')](_0x580ab4[_0x0d6c('0x7')])){var _0x4ef2f9=_0x580ab4[_0x0d6c('0x7')][_0x0d6c('0x8')](function(_0x584bdb){return _0x584bdb[_0x0d6c('0x9')]===_0x0d6c('0xa');});if(_0x4ef2f9>-0x1){var _0x35851f=_0x580ab4[_0x0d6c('0x7')][_0x4ef2f9];if(typeof _0x35851f[_0x0d6c('0xb')][_0x0d6c('0xc')]!==_0x0d6c('0xd')){_0x35851f[_0x0d6c('0xb')][_0x0d6c('0xc')]=NODEPATH;_0x2809c0=!![];}}return{'appConfig':_0x580ab4,'updated':_0x2809c0};}}function updateAppConfig(_0xa6956a){return fs['pathExists'](APP_JSON_PATH)['then'](function(_0x455591){if(_0x455591){return fs['readJSON'](APP_JSON_PATH)['then'](function(_0x75d694){var _0x11cce2=setLegacyLibsNodeEnvPath(_0x75d694);if(_0x11cce2['updated']){_0xa6956a[_0x0d6c('0xe')](_0x0d6c('0xf'));return fs['writeJSON'](APP_JSON_PATH,_0x75d694,{'spaces':0x2});}else{return Promise[_0x0d6c('0x3')]();}});}else{return Promise[_0x0d6c('0x3')]();}});}module[_0x0d6c('0x10')]=updateAppConfig; \ No newline at end of file +var _0x1a0e=['motion2','NODE_PATH','string','env','pathExists','then','readJSON','updated','Updating\x20app.json','exports','path','../config/environment','root','resolve','legacy-libs','isArray','apps','findIndex','name'];(function(_0xa989f6,_0x1a950e){var _0x50e6c7=function(_0x177e29){while(--_0x177e29){_0xa989f6['push'](_0xa989f6['shift']());}};_0x50e6c7(++_0x1a950e);}(_0x1a0e,0xee));var _0xe1a0=function(_0x3f2fea,_0x3c4ea8){_0x3f2fea=_0x3f2fea-0x0;var _0x69a4d5=_0x1a0e[_0x3f2fea];return _0x69a4d5;};var fs=require('fs-extra');var path=require(_0xe1a0('0x0'));var config=require(_0xe1a0('0x1'));var root=config[_0xe1a0('0x2')];var APP_JSON_PATH=path['resolve'](root,'server/app.json');var NODEPATH=path[_0xe1a0('0x3')](root,_0xe1a0('0x4'));function setLegacyLibsNodeEnvPath(_0x497300){let _0x263952=![];if(Array[_0xe1a0('0x5')](_0x497300[_0xe1a0('0x6')])){var _0x14e5a0=_0x497300[_0xe1a0('0x6')][_0xe1a0('0x7')](function(_0x250e16){return _0x250e16[_0xe1a0('0x8')]===_0xe1a0('0x9');});if(_0x14e5a0>-0x1){var _0x5c0561=_0x497300[_0xe1a0('0x6')][_0x14e5a0];if(typeof _0x5c0561['env'][_0xe1a0('0xa')]!==_0xe1a0('0xb')){_0x5c0561[_0xe1a0('0xc')]['NODE_PATH']=NODEPATH;_0x263952=!![];}}return{'appConfig':_0x497300,'updated':_0x263952};}}function updateAppConfig(_0x329a00){return fs[_0xe1a0('0xd')](APP_JSON_PATH)[_0xe1a0('0xe')](function(_0x4ee58a){if(_0x4ee58a){return fs[_0xe1a0('0xf')](APP_JSON_PATH)[_0xe1a0('0xe')](function(_0x5280af){var _0xd570bf=setLegacyLibsNodeEnvPath(_0x5280af);if(_0xd570bf[_0xe1a0('0x10')]){_0x329a00['info'](_0xe1a0('0x11'));return fs['writeJSON'](APP_JSON_PATH,_0x5280af,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0xe1a0('0x3')]();}});}module[_0xe1a0('0x12')]=updateAppConfig; \ No newline at end of file